From: Cris Di Sclafani Date: Mon, 12 Jul 2021 13:27:24 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.31 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png/%22?a=commitdiff_plain;h=8e3d4cbde319aaa1d6c0cdc1590569f27806fdb5;p=motion2.git Built motion from commit (unavailable).|2.5.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 941283a..283034a 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-07-09T13:40:47.044Z", + "time": "2021-07-12T13:18:32.483Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 8af26e3..aa84dcf 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-07-09T13:40:47.044Z", + "time": "2021-07-12T13:18:32.483Z", "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 45f1f4c..56ec48a 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 _0x25f4=['sequelize','exports','VIRTUAL','getDataValue','STRING','integration','motionbar','jscripty','urlForward','browser','bot','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]','TEXT'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x25f4,0xe0));var _0x425f=function(_0x5c74fc,_0x9617df){_0x5c74fc=_0x5c74fc-0x0;var _0x1dd063=_0x25f4[_0x5c74fc];return _0x1dd063;};'use strict';var Sequelize=require(_0x425f('0x0'));module[_0x425f('0x1')]={'name':{'type':Sequelize[_0x425f('0x2')],'get':function(_0x42d387){return this[_0x425f('0x3')]('action');}},'action':{'type':Sequelize[_0x425f('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x425f('0x5'),_0x425f('0x6'),_0x425f('0x7'),_0x425f('0x8'),_0x425f('0x9'),_0x425f('0xa'),_0x425f('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x425f('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x425f('0xd')},'data2':{'type':Sequelize[_0x425f('0x4')](0x1000),'comment':_0x425f('0xe')},'data3':{'type':Sequelize[_0x425f('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x425f('0x4')](0x1000)},'data5':{'type':Sequelize[_0x425f('0x4')](0x1000)},'data6':{'type':Sequelize[_0x425f('0x4')]},'data7':{'type':Sequelize[_0x425f('0xf')]}}; \ No newline at end of file +var _0x4dfe=['motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','getDataValue','action','STRING','contactManager','integration'];(function(_0x2f8296,_0x50308b){var _0x1300d7=function(_0x338ba0){while(--_0x338ba0){_0x2f8296['push'](_0x2f8296['shift']());}};_0x1300d7(++_0x50308b);}(_0x4dfe,0x19e));var _0xe4df=function(_0xd98c2e,_0x3a23e7){_0xd98c2e=_0xd98c2e-0x0;var _0x1d06c8=_0x4dfe[_0xd98c2e];return _0x1d06c8;};'use strict';var Sequelize=require(_0xe4df('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1acbc5){return this[_0xe4df('0x1')](_0xe4df('0x2'));}},'action':{'type':Sequelize[_0xe4df('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe4df('0x4'),_0xe4df('0x5'),_0xe4df('0x6'),_0xe4df('0x7'),_0xe4df('0x8'),_0xe4df('0x9'),'bot',_0xe4df('0xa')]],'msg':_0xe4df('0xb')}},'comment':_0xe4df('0xb')},'data1':{'type':Sequelize['STRING'](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[_0xe4df('0x3')](0x1000),'comment':_0xe4df('0xc')},'data3':{'type':Sequelize[_0xe4df('0x3')](0x1000),'comment':_0xe4df('0xd')},'data4':{'type':Sequelize[_0xe4df('0x3')](0x1000)},'data5':{'type':Sequelize[_0xe4df('0x3')](0x1000)},'data6':{'type':Sequelize[_0xe4df('0x3')]},'data7':{'type':Sequelize[_0xe4df('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b1cf3fd..1533fa2 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 _0x4a3a=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','apply','reject','save','update','then','stack','name','render','merge','body','contact','interaction','account','params','catch','destroy','Action','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3c64dc,_0x4c829f){var _0x4ee9d5=function(_0xffd463){while(--_0xffd463){_0x3c64dc['push'](_0x3c64dc['shift']());}};_0x4ee9d5(++_0x4c829f);}(_0x4a3a,0x140));var _0xa4a3=function(_0x5e257c,_0x1df417){_0x5e257c=_0x5e257c-0x0;var _0x33821d=_0x4a3a[_0x5e257c];return _0x33821d;};'use strict';var emlformat=require(_0xa4a3('0x0'));var rimraf=require(_0xa4a3('0x1'));var zipdir=require(_0xa4a3('0x2'));var jsonpatch=require(_0xa4a3('0x3'));var rp=require(_0xa4a3('0x4'));var moment=require('moment');var BPromise=require(_0xa4a3('0x5'));var Mustache=require('mustache');var util=require(_0xa4a3('0x6'));var path=require('path');var sox=require(_0xa4a3('0x7'));var csv=require(_0xa4a3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4a3('0x9'));var _=require(_0xa4a3('0xa'));var squel=require(_0xa4a3('0xb'));var crypto=require(_0xa4a3('0xc'));var jsforce=require(_0xa4a3('0xd'));var deskjs=require(_0xa4a3('0xe'));var toCsv=require(_0xa4a3('0x8'));var querystring=require(_0xa4a3('0xf'));var Papa=require(_0xa4a3('0x10'));var Redis=require(_0xa4a3('0x11'));var authService=require(_0xa4a3('0x12'));var qs=require(_0xa4a3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa4a3('0x14'));var logger=require(_0xa4a3('0x15'))('api');var utils=require(_0xa4a3('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa4a3('0x17'))['db'];function respondWithStatusCode(_0x2bfc0b,_0xe073b6){_0xe073b6=_0xe073b6||0xcc;return function(_0x1118ec){if(_0x1118ec){return _0x2bfc0b['sendStatus'](_0xe073b6);}return _0x2bfc0b[_0xa4a3('0x18')](_0xe073b6)[_0xa4a3('0x19')]();};}function respondWithResult(_0x476b62,_0x3d092d){_0x3d092d=_0x3d092d||0xc8;return function(_0x24e0c3){if(_0x24e0c3){return _0x476b62[_0xa4a3('0x18')](_0x3d092d)[_0xa4a3('0x1a')](_0x24e0c3);}};}function respondWithFilteredResult(_0x2b378d,_0x1b3ace){return function(_0x55966a){if(_0x55966a){var _0x40b0a5=typeof _0x1b3ace[_0xa4a3('0x1b')]===_0xa4a3('0x1c')&&typeof _0x1b3ace['limit']===_0xa4a3('0x1c');var _0x42696a=_0x55966a[_0xa4a3('0x1d')];var _0x35e6e4=_0x40b0a5?0x0:_0x1b3ace[_0xa4a3('0x1b')];var _0x1d9342=_0x40b0a5?_0x55966a['count']:_0x1b3ace['offset']+_0x1b3ace['limit'];var _0xe49d88;if(_0x1d9342>=_0x42696a){_0x1d9342=_0x42696a;_0xe49d88=0xc8;}else{_0xe49d88=0xce;}_0x2b378d['status'](_0xe49d88);return _0x2b378d['set']('Content-Range',_0x35e6e4+'-'+_0x1d9342+'/'+_0x42696a)[_0xa4a3('0x1a')](_0x55966a);}return null;};}function patchUpdates(_0x4afc76){return function(_0x257c8a){try{jsonpatch[_0xa4a3('0x1e')](_0x257c8a,_0x4afc76,!![]);}catch(_0x272539){return BPromise[_0xa4a3('0x1f')](_0x272539);}return _0x257c8a[_0xa4a3('0x20')]();};}function saveUpdates(_0x48c53e,_0xc34496){return function(_0x319fb8){if(_0x319fb8){return _0x319fb8[_0xa4a3('0x21')](_0x48c53e)['then'](function(_0x27bcc4){return _0x27bcc4;});}return null;};}function removeEntity(_0x455855,_0x115f57){return function(_0x7455ad){if(_0x7455ad){return _0x7455ad['destroy']()[_0xa4a3('0x22')](function(){_0x455855[_0xa4a3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38c7a9,_0x36cbd8){return function(_0x5073e9){if(!_0x5073e9){_0x38c7a9['sendStatus'](0x194);}return _0x5073e9;};}function handleError(_0x3a056a,_0x2b1f2b){_0x2b1f2b=_0x2b1f2b||0x1f4;return function(_0x21baf8){logger['error'](_0x21baf8[_0xa4a3('0x23')]);if(_0x21baf8[_0xa4a3('0x24')]){delete _0x21baf8['name'];}_0x3a056a[_0xa4a3('0x18')](_0x2b1f2b)['send'](_0x21baf8);};}function getMustacheRender(_0x3b97fd,_0x45cb98){return Mustache[_0xa4a3('0x25')](_0x3b97fd,_[_0xa4a3('0x26')](_0x45cb98[_0xa4a3('0x27')],{'contact':_0x45cb98[_0xa4a3('0x28')],'message':_0x45cb98['message'],'agent':_0x45cb98['agent'],'interaction':_0x45cb98[_0xa4a3('0x29')],'account':_0x45cb98[_0xa4a3('0x2a')]}))||'';}exports['update']=function(_0x5ab91a,_0x4414ce){if(_0x5ab91a['body']['id']){delete _0x5ab91a[_0xa4a3('0x27')]['id'];}return db['Action']['find']({'where':{'id':_0x5ab91a[_0xa4a3('0x2b')]['id']}})[_0xa4a3('0x22')](handleEntityNotFound(_0x4414ce,null))[_0xa4a3('0x22')](saveUpdates(_0x5ab91a[_0xa4a3('0x27')],null))[_0xa4a3('0x22')](respondWithResult(_0x4414ce,null))[_0xa4a3('0x2c')](handleError(_0x4414ce,null));};exports[_0xa4a3('0x2d')]=function(_0x6b143b,_0x3a0e7c){return db[_0xa4a3('0x2e')][_0xa4a3('0x2f')]({'where':{'id':_0x6b143b['params']['id']}})[_0xa4a3('0x22')](handleEntityNotFound(_0x3a0e7c,null))[_0xa4a3('0x22')](removeEntity(_0x3a0e7c,null))[_0xa4a3('0x2c')](handleError(_0x3a0e7c,null));}; \ No newline at end of file +var _0x559a=['../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','end','error','stack','name','render','merge','contact','message','agent','account','body','Action','find','params','then','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x4de560,_0x2c8ace){var _0x1aa979=function(_0x4366e6){while(--_0x4366e6){_0x4de560['push'](_0x4de560['shift']());}};_0x1aa979(++_0x2c8ace);}(_0x559a,0xb3));var _0xa559=function(_0x445c05,_0x3618b0){_0x445c05=_0x445c05-0x0;var _0xb30ecf=_0x559a[_0x445c05];return _0xb30ecf;};'use strict';var emlformat=require(_0xa559('0x0'));var rimraf=require(_0xa559('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa559('0x2'));var rp=require(_0xa559('0x3'));var moment=require(_0xa559('0x4'));var BPromise=require(_0xa559('0x5'));var Mustache=require(_0xa559('0x6'));var util=require(_0xa559('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa559('0x8'));var ejs=require(_0xa559('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa559('0xa'));var squel=require(_0xa559('0xb'));var crypto=require('crypto');var jsforce=require(_0xa559('0xc'));var deskjs=require(_0xa559('0xd'));var toCsv=require(_0xa559('0x8'));var querystring=require(_0xa559('0xe'));var Papa=require('papaparse');var Redis=require(_0xa559('0xf'));var authService=require(_0xa559('0x10'));var qs=require(_0xa559('0x11'));var as=require(_0xa559('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa559('0x13'));var utils=require(_0xa559('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa559('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x442e26,_0x5f0463){_0x5f0463=_0x5f0463||0xcc;return function(_0x2a646e){if(_0x2a646e){return _0x442e26[_0xa559('0x16')](_0x5f0463);}return _0x442e26[_0xa559('0x17')](_0x5f0463)['end']();};}function respondWithResult(_0xe93c61,_0x3853fd){_0x3853fd=_0x3853fd||0xc8;return function(_0x5ed915){if(_0x5ed915){return _0xe93c61[_0xa559('0x17')](_0x3853fd)[_0xa559('0x18')](_0x5ed915);}};}function respondWithFilteredResult(_0x369d26,_0x1e48b3){return function(_0x539a4b){if(_0x539a4b){var _0x309c27=typeof _0x1e48b3['offset']===_0xa559('0x19')&&typeof _0x1e48b3[_0xa559('0x1a')]==='undefined';var _0x2c6993=_0x539a4b[_0xa559('0x1b')];var _0x163405=_0x309c27?0x0:_0x1e48b3[_0xa559('0x1c')];var _0x1a4c42=_0x309c27?_0x539a4b[_0xa559('0x1b')]:_0x1e48b3[_0xa559('0x1c')]+_0x1e48b3[_0xa559('0x1a')];var _0x329d59;if(_0x1a4c42>=_0x2c6993){_0x1a4c42=_0x2c6993;_0x329d59=0xc8;}else{_0x329d59=0xce;}_0x369d26[_0xa559('0x17')](_0x329d59);return _0x369d26['set']('Content-Range',_0x163405+'-'+_0x1a4c42+'/'+_0x2c6993)[_0xa559('0x18')](_0x539a4b);}return null;};}function patchUpdates(_0x3aa532){return function(_0x47cb65){try{jsonpatch[_0xa559('0x1d')](_0x47cb65,_0x3aa532,!![]);}catch(_0x190a9e){return BPromise[_0xa559('0x1e')](_0x190a9e);}return _0x47cb65[_0xa559('0x1f')]();};}function saveUpdates(_0x1812ef,_0x2dd8cf){return function(_0x572046){if(_0x572046){return _0x572046[_0xa559('0x20')](_0x1812ef)['then'](function(_0x1d4370){return _0x1d4370;});}return null;};}function removeEntity(_0x396fe9,_0x314fef){return function(_0x487a60){if(_0x487a60){return _0x487a60[_0xa559('0x21')]()['then'](function(){_0x396fe9[_0xa559('0x17')](0xcc)[_0xa559('0x22')]();});}};}function handleEntityNotFound(_0x5834c6,_0x2a5181){return function(_0x552c2c){if(!_0x552c2c){_0x5834c6['sendStatus'](0x194);}return _0x552c2c;};}function handleError(_0x1581b9,_0x1914e7){_0x1914e7=_0x1914e7||0x1f4;return function(_0x3fcf7f){logger[_0xa559('0x23')](_0x3fcf7f[_0xa559('0x24')]);if(_0x3fcf7f[_0xa559('0x25')]){delete _0x3fcf7f[_0xa559('0x25')];}_0x1581b9[_0xa559('0x17')](_0x1914e7)['send'](_0x3fcf7f);};}function getMustacheRender(_0x11a3d2,_0x30a781){return Mustache[_0xa559('0x26')](_0x11a3d2,_[_0xa559('0x27')](_0x30a781['body'],{'contact':_0x30a781[_0xa559('0x28')],'message':_0x30a781[_0xa559('0x29')],'agent':_0x30a781[_0xa559('0x2a')],'interaction':_0x30a781['interaction'],'account':_0x30a781[_0xa559('0x2b')]}))||'';}exports[_0xa559('0x20')]=function(_0xd0481e,_0x469a4e){if(_0xd0481e[_0xa559('0x2c')]['id']){delete _0xd0481e[_0xa559('0x2c')]['id'];}return db[_0xa559('0x2d')][_0xa559('0x2e')]({'where':{'id':_0xd0481e[_0xa559('0x2f')]['id']}})['then'](handleEntityNotFound(_0x469a4e,null))[_0xa559('0x30')](saveUpdates(_0xd0481e[_0xa559('0x2c')],null))[_0xa559('0x30')](respondWithResult(_0x469a4e,null))[_0xa559('0x31')](handleError(_0x469a4e,null));};exports['destroy']=function(_0x2b6eeb,_0x5e9389){return db[_0xa559('0x2d')][_0xa559('0x2e')]({'where':{'id':_0x2b6eeb[_0xa559('0x2f')]['id']}})[_0xa559('0x30')](handleEntityNotFound(_0x5e9389,null))[_0xa559('0x30')](removeEntity(_0x5e9389,null))[_0xa559('0x31')](handleError(_0x5e9389,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 436a9e2..1e042e8 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 _0x68ba=['define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./action.attributes','exports'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0x68ba,0x6b));var _0xa68b=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x68ba[_0x9d14e3];return _0x19bf32;};'use strict';var _=require(_0xa68b('0x0'));var util=require(_0xa68b('0x1'));var logger=require(_0xa68b('0x2'))('api');var moment=require(_0xa68b('0x3'));var BPromise=require(_0xa68b('0x4'));var rp=require(_0xa68b('0x5'));var fs=require('fs');var path=require(_0xa68b('0x6'));var rimraf=require(_0xa68b('0x7'));var config=require('../../config/environment');var attributes=require(_0xa68b('0x8'));module[_0xa68b('0x9')]=function(_0x2e5eea,_0x30474f){return _0x2e5eea[_0xa68b('0xa')](_0xa68b('0xb'),attributes,{'tableName':_0xa68b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0258=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','Action','lodash','util'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x0258,0x82));var _0x8025=function(_0x40b8bd,_0x45e5c1){_0x40b8bd=_0x40b8bd-0x0;var _0x19c510=_0x0258[_0x40b8bd];return _0x19c510;};'use strict';var _=require(_0x8025('0x0'));var util=require(_0x8025('0x1'));var logger=require(_0x8025('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8025('0x3'));var rp=require(_0x8025('0x4'));var fs=require('fs');var path=require(_0x8025('0x5'));var rimraf=require(_0x8025('0x6'));var config=require(_0x8025('0x7'));var attributes=require(_0x8025('0x8'));module[_0x8025('0x9')]=function(_0x35305e,_0x189327){return _0x35305e['define'](_0x8025('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 77523e1..5f08290 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 _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1cc458,_0x5edc40){var _0x3e0dc=function(_0x400348){while(--_0x400348){_0x1cc458['push'](_0x1cc458['shift']());}};_0x3e0dc(++_0x5edc40);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\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(_0x5e2936,_0x4c2f47){var _0x3cfc5a=function(_0x3962a2){while(--_0x3962a2){_0x5e2936['push'](_0x5e2936['shift']());}};_0x3cfc5a(++_0x4c2f47);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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/action/index.js b/server/api/action/index.js index 6ff7dd1..6b99b07 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 _0xc12d=['exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete'];(function(_0x2cf8d3,_0x545a19){var _0x17a79d=function(_0x33f9fd){while(--_0x33f9fd){_0x2cf8d3['push'](_0x2cf8d3['shift']());}};_0x17a79d(++_0x545a19);}(_0xc12d,0x1e2));var _0xdc12=function(_0x16d321,_0x1a3de6){_0x16d321=_0x16d321-0x0;var _0x5a1e15=_0xc12d[_0x16d321];return _0x5a1e15;};'use strict';var multer=require(_0xdc12('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdc12('0x1'));var express=require('express');var router=express[_0xdc12('0x2')]();var fs_extra=require(_0xdc12('0x3'));var auth=require(_0xdc12('0x4'));var interaction=require(_0xdc12('0x5'));var config=require('../../config/environment');var controller=require(_0xdc12('0x6'));router[_0xdc12('0x7')](_0xdc12('0x8'),auth[_0xdc12('0x9')](),controller[_0xdc12('0xa')]);router[_0xdc12('0xb')](_0xdc12('0x8'),auth[_0xdc12('0x9')](),controller['destroy']);module[_0xdc12('0xc')]=router; \ No newline at end of file +var _0xdab2=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x1616ee,_0x308f00){var _0x347134=function(_0x1e1801){while(--_0x1e1801){_0x1616ee['push'](_0x1616ee['shift']());}};_0x347134(++_0x308f00);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var path=require('path');var timeout=require(_0x2dab('0x2'));var express=require(_0x2dab('0x3'));var router=express[_0x2dab('0x4')]();var fs_extra=require(_0x2dab('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2dab('0x6'));var config=require(_0x2dab('0x7'));var controller=require(_0x2dab('0x8'));router[_0x2dab('0x9')](_0x2dab('0xa'),auth[_0x2dab('0xb')](),controller[_0x2dab('0xc')]);router[_0x2dab('0xd')](_0x2dab('0xa'),auth[_0x2dab('0xb')](),controller[_0x2dab('0xe')]);module[_0x2dab('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 7fb05be..5bb7669 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 _0xcfef=['STRING','TEXT','sequelize','exports'];(function(_0x4b80fb,_0x435f51){var _0x21d929=function(_0x791ca8){while(--_0x791ca8){_0x4b80fb['push'](_0x4b80fb['shift']());}};_0x21d929(++_0x435f51);}(_0xcfef,0x12e));var _0xfcfe=function(_0x359994,_0x45527b){_0x359994=_0x359994-0x0;var _0x3e0575=_0xcfef[_0x359994];return _0x3e0575;};'use strict';var Sequelize=require(_0xfcfe('0x0'));module[_0xfcfe('0x1')]={'name':{'type':Sequelize[_0xfcfe('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xfcfe('0x2')]},'table':{'type':Sequelize[_0xfcfe('0x2')]},'conditions':{'type':Sequelize[_0xfcfe('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x330d=['sequelize','STRING'];(function(_0x818c70,_0x706bbe){var _0x466a06=function(_0x2d1f06){while(--_0x2d1f06){_0x818c70['push'](_0x818c70['shift']());}};_0x466a06(++_0x706bbe);}(_0x330d,0x8e));var _0xd330=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x330d[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require(_0xd330('0x0'));module['exports']={'name':{'type':Sequelize[_0xd330('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd330('0x1')]},'parent':{'type':Sequelize[_0xd330('0x1')]},'table':{'type':Sequelize[_0xd330('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d62e3be..3a5f1c4 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 _0x5cbe=['replace','function','format','orderBy','DESC','alias','joins','foreignTable','foreignKey','parentKey','conditions','debug','sequelize','toString','QueryTypes','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','groupBy','parse','%s.%s\x20=\x20%s.%s','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','fork','../../files/reports','savename','COUNT(*)','SELECT','run','IS\x20NULL','IS\x20NOT\x20EMPTY','Sequelize','Limited\x20Query:','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','get','CustomReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','render','body','agent','account','index','map','AnalyticCustomReport','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','getFields','AnalyticMetric','from','table','MetricId','metric'];(function(_0x35592d,_0x139db7){var _0x3315bf=function(_0x445848){while(--_0x445848){_0x35592d['push'](_0x35592d['shift']());}};_0x3315bf(++_0x139db7);}(_0x5cbe,0xdd));var _0xe5cb=function(_0x154691,_0x1a205a){_0x154691=_0x154691-0x0;var _0x4de432=_0x5cbe[_0x154691];return _0x4de432;};'use strict';var emlformat=require(_0xe5cb('0x0'));var rimraf=require(_0xe5cb('0x1'));var zipdir=require(_0xe5cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe5cb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe5cb('0x4'));var util=require(_0xe5cb('0x5'));var path=require('path');var sox=require(_0xe5cb('0x6'));var csv=require(_0xe5cb('0x7'));var ejs=require(_0xe5cb('0x8'));var fs=require('fs');var fs_extra=require(_0xe5cb('0x9'));var _=require(_0xe5cb('0xa'));var squel=require('squel');var crypto=require(_0xe5cb('0xb'));var jsforce=require(_0xe5cb('0xc'));var deskjs=require(_0xe5cb('0xd'));var toCsv=require(_0xe5cb('0x7'));var querystring=require(_0xe5cb('0xe'));var Papa=require(_0xe5cb('0xf'));var Redis=require('ioredis');var authService=require(_0xe5cb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe5cb('0x11'));var hardwareService=require(_0xe5cb('0x12'));var logger=require(_0xe5cb('0x13'))(_0xe5cb('0x14'));var utils=require('../../config/utils');var config=require(_0xe5cb('0x15'));var licenseUtil=require(_0xe5cb('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe5cb('0x17'))[_0xe5cb('0x18')];function respondWithStatusCode(_0x412cea,_0x13a7d4){_0x13a7d4=_0x13a7d4||0xcc;return function(_0x5ad97a){if(_0x5ad97a){return _0x412cea['sendStatus'](_0x13a7d4);}return _0x412cea[_0xe5cb('0x19')](_0x13a7d4)[_0xe5cb('0x1a')]();};}function respondWithResult(_0x14b240,_0x540060){_0x540060=_0x540060||0xc8;return function(_0x421743){if(_0x421743){return _0x14b240[_0xe5cb('0x19')](_0x540060)[_0xe5cb('0x1b')](_0x421743);}};}function respondWithFilteredResult(_0x3de278,_0x1704ef){return function(_0x3cafec){if(_0x3cafec){var _0x5e1b99=typeof _0x1704ef['offset']===_0xe5cb('0x1c')&&typeof _0x1704ef[_0xe5cb('0x1d')]===_0xe5cb('0x1c');var _0x356b2d=_0x3cafec[_0xe5cb('0x1e')];var _0x26d178=_0x5e1b99?0x0:_0x1704ef['offset'];var _0x14f0a7=_0x5e1b99?_0x3cafec[_0xe5cb('0x1e')]:_0x1704ef[_0xe5cb('0x1f')]+_0x1704ef[_0xe5cb('0x1d')];var _0x4f9054;if(_0x14f0a7>=_0x356b2d){_0x14f0a7=_0x356b2d;_0x4f9054=0xc8;}else{_0x4f9054=0xce;}_0x3de278[_0xe5cb('0x19')](_0x4f9054);return _0x3de278['set'](_0xe5cb('0x20'),_0x26d178+'-'+_0x14f0a7+'/'+_0x356b2d)[_0xe5cb('0x1b')](_0x3cafec);}return null;};}function patchUpdates(_0x22bc17){return function(_0x184f18){try{jsonpatch[_0xe5cb('0x21')](_0x184f18,_0x22bc17,!![]);}catch(_0x47f051){return BPromise['reject'](_0x47f051);}return _0x184f18[_0xe5cb('0x22')]();};}function saveUpdates(_0x457622,_0x4713e4){return function(_0x2bd1bd){if(_0x2bd1bd){return _0x2bd1bd[_0xe5cb('0x23')](_0x457622)[_0xe5cb('0x24')](function(_0x4188c1){return _0x4188c1;});}return null;};}function removeEntity(_0xed464,_0xea5461){return function(_0x445de6){if(_0x445de6){return _0x445de6['destroy']()[_0xe5cb('0x24')](function(){var _0x4c527c=_0x445de6[_0xe5cb('0x25')]({'plain':!![]});var _0x51c2ca=_0xe5cb('0x26');return db[_0xe5cb('0x27')][_0xe5cb('0x28')]({'where':{'type':_0x51c2ca,'resourceId':_0x4c527c['id']}})[_0xe5cb('0x24')](function(){return _0x445de6;});})[_0xe5cb('0x24')](function(){_0xed464['status'](0xcc)[_0xe5cb('0x1a')]();});}};}function handleEntityNotFound(_0x284bda,_0x1ffd1a){return function(_0x142d33){if(!_0x142d33){_0x284bda[_0xe5cb('0x29')](0x194);}return _0x142d33;};}function handleError(_0x1650d6,_0x5b3324){_0x5b3324=_0x5b3324||0x1f4;return function(_0x41845b){logger[_0xe5cb('0x2a')](_0x41845b[_0xe5cb('0x2b')]);if(_0x41845b[_0xe5cb('0x2c')]){delete _0x41845b[_0xe5cb('0x2c')];}_0x1650d6[_0xe5cb('0x19')](_0x5b3324)[_0xe5cb('0x2d')](_0x41845b);};}function getMustacheRender(_0x1b6e86,_0x6b3d86){return Mustache[_0xe5cb('0x2e')](_0x1b6e86,_['merge'](_0x6b3d86[_0xe5cb('0x2f')],{'contact':_0x6b3d86['contact'],'message':_0x6b3d86['message'],'agent':_0x6b3d86[_0xe5cb('0x30')],'interaction':_0x6b3d86['interaction'],'account':_0x6b3d86[_0xe5cb('0x31')]}))||'';}exports[_0xe5cb('0x32')]=function(_0x241227,_0x3f1752){var _0x871686={},_0x1c285c={},_0x39719d={'count':0x0,'rows':[]};var _0x37f3fc=_[_0xe5cb('0x33')](db[_0xe5cb('0x34')][_0xe5cb('0x35')],function(_0x12b661){return{'name':_0x12b661['fieldName'],'type':_0x12b661[_0xe5cb('0x36')]['key']};});_0x1c285c[_0xe5cb('0x37')]=_[_0xe5cb('0x33')](_0x37f3fc,_0xe5cb('0x2c'));_0x1c285c['query']=_['keys'](_0x241227[_0xe5cb('0x38')]);_0x1c285c[_0xe5cb('0x39')]=_['intersection'](_0x1c285c[_0xe5cb('0x37')],_0x1c285c['query']);_0x871686['attributes']=_[_0xe5cb('0x3a')](_0x1c285c['model'],qs[_0xe5cb('0x3b')](_0x241227[_0xe5cb('0x38')][_0xe5cb('0x3b')]));_0x871686[_0xe5cb('0x3c')]=_0x871686['attributes'][_0xe5cb('0x3d')]?_0x871686[_0xe5cb('0x3c')]:_0x1c285c[_0xe5cb('0x37')];if(!_0x241227[_0xe5cb('0x38')][_0xe5cb('0x3e')](_0xe5cb('0x3f'))){_0x871686[_0xe5cb('0x1d')]=qs[_0xe5cb('0x1d')](_0x241227['query'][_0xe5cb('0x1d')]);_0x871686[_0xe5cb('0x1f')]=qs['offset'](_0x241227[_0xe5cb('0x38')]['offset']);}_0x871686[_0xe5cb('0x40')]=qs[_0xe5cb('0x41')](_0x241227[_0xe5cb('0x38')][_0xe5cb('0x41')]);_0x871686[_0xe5cb('0x42')]=qs[_0xe5cb('0x39')](_[_0xe5cb('0x43')](_0x241227[_0xe5cb('0x38')],_0x1c285c[_0xe5cb('0x39')]),_0x37f3fc);if(_0x241227[_0xe5cb('0x38')][_0xe5cb('0x44')]){_0x871686[_0xe5cb('0x42')]=_[_0xe5cb('0x45')](_0x871686[_0xe5cb('0x42')],{'$or':_[_0xe5cb('0x33')](_0x37f3fc,function(_0x1f8528){if(_0x1f8528[_0xe5cb('0x36')]!==_0xe5cb('0x46')){var _0x674e11={};_0x674e11[_0x1f8528['name']]={'$like':'%'+_0x241227[_0xe5cb('0x38')][_0xe5cb('0x44')]+'%'};return _0x674e11;}})});}_0x871686=_[_0xe5cb('0x45')]({},_0x871686,_0x241227[_0xe5cb('0x47')]);var _0x31e725={'where':_0x871686[_0xe5cb('0x42')]};return db[_0xe5cb('0x34')][_0xe5cb('0x1e')](_0x31e725)[_0xe5cb('0x24')](function(_0x5cbbb9){_0x39719d[_0xe5cb('0x1e')]=_0x5cbbb9;if(_0x241227[_0xe5cb('0x38')][_0xe5cb('0x48')]){_0x871686[_0xe5cb('0x49')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xe5cb('0x4a')](_0x871686);})[_0xe5cb('0x24')](function(_0x586b8c){_0x39719d[_0xe5cb('0x4b')]=_0x586b8c;return _0x39719d;})[_0xe5cb('0x24')](respondWithFilteredResult(_0x3f1752,_0x871686))[_0xe5cb('0x4c')](handleError(_0x3f1752,null));};exports[_0xe5cb('0x4d')]=function(_0x20ae32,_0x514d08){var _0x11465c={'raw':![],'where':{'id':_0x20ae32[_0xe5cb('0x4e')]['id']}},_0x33cb62={};_0x33cb62[_0xe5cb('0x37')]=_['keys'](db['AnalyticCustomReport'][_0xe5cb('0x35')]);_0x33cb62[_0xe5cb('0x38')]=_[_0xe5cb('0x4f')](_0x20ae32['query']);_0x33cb62['filters']=_[_0xe5cb('0x3a')](_0x33cb62[_0xe5cb('0x37')],_0x33cb62['query']);_0x11465c[_0xe5cb('0x3c')]=_[_0xe5cb('0x3a')](_0x33cb62['model'],qs[_0xe5cb('0x3b')](_0x20ae32[_0xe5cb('0x38')][_0xe5cb('0x3b')]));_0x11465c['attributes']=_0x11465c[_0xe5cb('0x3c')][_0xe5cb('0x3d')]?_0x11465c['attributes']:_0x33cb62[_0xe5cb('0x37')];if(_0x20ae32[_0xe5cb('0x38')]['includeAll']){_0x11465c[_0xe5cb('0x49')]=[{'all':!![]}];}_0x11465c=_[_0xe5cb('0x45')]({},_0x11465c,_0x20ae32[_0xe5cb('0x47')]);return db[_0xe5cb('0x34')][_0xe5cb('0x50')](_0x11465c)['then'](handleEntityNotFound(_0x514d08,null))[_0xe5cb('0x24')](respondWithResult(_0x514d08,null))[_0xe5cb('0x4c')](handleError(_0x514d08,null));};exports[_0xe5cb('0x51')]=function(_0x549a21,_0x54b40a){return db[_0xe5cb('0x34')][_0xe5cb('0x51')](_0x549a21[_0xe5cb('0x2f')],{})[_0xe5cb('0x24')](function(_0x24e596){var _0x396c5f=_0x549a21[_0xe5cb('0x52')]['get']({'plain':!![]});if(!_0x396c5f)throw new Error(_0xe5cb('0x53'));if(_0x396c5f['role']===_0xe5cb('0x52')){var _0x3dd158=_0x24e596[_0xe5cb('0x25')]({'plain':!![]});var _0x8d343d=_0xe5cb('0x54');return db[_0xe5cb('0x55')][_0xe5cb('0x50')]({'where':{'name':_0x8d343d,'userProfileId':_0x396c5f[_0xe5cb('0x56')]},'raw':!![]})['then'](function(_0x165a41){if(_0x165a41&&_0x165a41[_0xe5cb('0x57')]===0x0){return db[_0xe5cb('0x27')][_0xe5cb('0x51')]({'name':_0x3dd158[_0xe5cb('0x2c')],'resourceId':_0x3dd158['id'],'type':_0xe5cb('0x26'),'sectionId':_0x165a41['id']},{})['then'](function(){return _0x24e596;});}else{return _0x24e596;}})[_0xe5cb('0x4c')](function(_0x43de93){logger[_0xe5cb('0x2a')](_0xe5cb('0x58'),_0x43de93);throw _0x43de93;});}return _0x24e596;})['then'](respondWithResult(_0x54b40a,0xc9))[_0xe5cb('0x4c')](handleError(_0x54b40a,null));};exports[_0xe5cb('0x23')]=function(_0x353a75,_0x3efe3b){if(_0x353a75[_0xe5cb('0x2f')]['id']){delete _0x353a75['body']['id'];}return db[_0xe5cb('0x34')][_0xe5cb('0x50')]({'where':{'id':_0x353a75[_0xe5cb('0x4e')]['id']}})[_0xe5cb('0x24')](handleEntityNotFound(_0x3efe3b,null))['then'](saveUpdates(_0x353a75[_0xe5cb('0x2f')],null))[_0xe5cb('0x24')](respondWithResult(_0x3efe3b,null))[_0xe5cb('0x4c')](handleError(_0x3efe3b,null));};exports[_0xe5cb('0x28')]=function(_0x5ffbf4,_0x31f851){return db[_0xe5cb('0x34')][_0xe5cb('0x50')]({'where':{'id':_0x5ffbf4[_0xe5cb('0x4e')]['id']}})[_0xe5cb('0x24')](handleEntityNotFound(_0x31f851,null))[_0xe5cb('0x24')](removeEntity(_0x31f851,null))[_0xe5cb('0x4c')](handleError(_0x31f851,null));};exports[_0xe5cb('0x59')]=function(_0x39c82f,_0xe0a963){var _0x22e744=0xa;var _0x1a7c0e=[_0xe5cb('0x5a'),_0xe5cb('0x5b'),_0xe5cb('0x5c'),_0xe5cb('0x5d')];var _0x57e70b={'SUM':'SUM(%s)','COUNT':_0xe5cb('0x5e'),'COUNT DISTINCT':_0xe5cb('0x5f'),'MAX':_0xe5cb('0x60'),'MIN':_0xe5cb('0x61'),'AVG':_0xe5cb('0x62'),'GROUP_CONCAT':_0xe5cb('0x63'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe5cb('0x64')};var _0x4eb125={'SEC_TO_TIME':_0xe5cb('0x65'),'DATE':'DATE(%s)','HOUR':_0xe5cb('0x66'),'ROUND':_0xe5cb('0x67'),'UNIX_TIMESTAMP':_0xe5cb('0x68')};var _0x3e2db2=function(_0x5e96c1){return!_[_0xe5cb('0x69')](['IS\x20NULL',_0xe5cb('0x6a'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5e96c1);};var _0x1dca86=function(_0x2fabff){if(!_0x2fabff||!_0x2fabff[_0xe5cb('0x6b')][_0xe5cb('0x3d')]){return'';}for(var _0x2528a1='(',_0x5c45e4=0x0;_0x5c45e4<_0x2fabff[_0xe5cb('0x6b')][_0xe5cb('0x3d')];_0x5c45e4+=0x1){_0x5c45e4>0x0&&(_0x2528a1+='\x20'+_0x2fabff[_0xe5cb('0x6c')]+'\x20');_0x2528a1+=_0x2fabff[_0xe5cb('0x6b')][_0x5c45e4][_0xe5cb('0x6d')]?_0x1dca86(_0x2fabff[_0xe5cb('0x6b')][_0x5c45e4][_0xe5cb('0x6d')]):_0x2fabff['rules'][_0x5c45e4][_0xe5cb('0x6e')]+'\x20'+_0x2fabff[_0xe5cb('0x6b')][_0x5c45e4][_0xe5cb('0x6f')]+(_0x3e2db2(_0x2fabff['rules'][_0x5c45e4][_0xe5cb('0x6f')])?'\x20'+_0x2fabff[_0xe5cb('0x6b')][_0x5c45e4][_0xe5cb('0x70')]:'');}return _0x2528a1+')';};var _0x431dc3={'where':{'id':_0x39c82f[_0xe5cb('0x4e')]['id']}},_0x29b10a,_0x2602d4,_0x24147a,_0xd924a,_0x256a20;_0x431dc3=_[_0xe5cb('0x45')]({},_0x431dc3,_0x39c82f['options']);return db[_0xe5cb('0x34')][_0xe5cb('0x50')](_0x431dc3)[_0xe5cb('0x24')](function(_0x5167df){if(_0x5167df){_0x29b10a=_0x5167df;return _0x5167df[_0xe5cb('0x71')]();}return null;})[_0xe5cb('0x24')](function(_0x98a796){if(_0x98a796){if(!_0x98a796['length']){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2602d4=_0x98a796;return db[_0xe5cb('0x72')][_0xe5cb('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x1da6fd){if(_0x1da6fd){_0x24147a=_['keyBy'](_0x1da6fd,'id');var _0x2e163e;var _0x53bcbf=squel['select']();_0x53bcbf[_0xe5cb('0x73')](_0x29b10a[_0xe5cb('0x74')]);for(var _0x151c1d=0x0;_0x151c1d<_0x2602d4[_0xe5cb('0x3d')];_0x151c1d+=0x1){_0x2e163e=_0x2602d4[_0x151c1d][_0xe5cb('0x75')]?_0x24147a[_0x2602d4[_0x151c1d][_0xe5cb('0x75')]][_0xe5cb('0x76')]:_0x2602d4[_0x151c1d]['field'];_0x2e163e=_0x2602d4[_0x151c1d]['function']?_[_0xe5cb('0x77')](_0x57e70b[_0x2602d4[_0x151c1d][_0xe5cb('0x78')]],'%s',_0x2e163e):_0x2e163e;_0x2e163e=_0x2602d4[_0x151c1d][_0xe5cb('0x79')]?_[_0xe5cb('0x77')](_0x4eb125[_0x2602d4[_0x151c1d]['format']],'%s',_0x2e163e):_0x2e163e;if(_0x2602d4[_0x151c1d]['groupBy']){_0x53bcbf[_0xe5cb('0x6d')](_0x2e163e);}_0x2602d4[_0x151c1d][_0xe5cb('0x7a')]&&_0x53bcbf[_0xe5cb('0x40')](_0x2e163e,_0x2602d4[_0x151c1d][_0xe5cb('0x7a')]===_0xe5cb('0x7b')?![]:!![]);_0x53bcbf[_0xe5cb('0x6e')](_0x2e163e,_0x2602d4[_0x151c1d][_0xe5cb('0x7c')]||_0x2e163e);}if(_0x29b10a[_0xe5cb('0x7d')]){_0x29b10a[_0xe5cb('0x7d')]=JSON['parse'](_0x29b10a[_0xe5cb('0x7d')]);for(var _0x22bac0=0x0;_0x22bac0<_0x29b10a['joins'][_0xe5cb('0x3d')];_0x22bac0+=0x1){if(_0x29b10a[_0xe5cb('0x7d')][_0x22bac0][_0xe5cb('0x36')]&&_[_0xe5cb('0x69')](_0x1a7c0e,_0x29b10a[_0xe5cb('0x7d')][_0x22bac0]['type'])&&_0x29b10a['joins'][_0x22bac0]['parentKey']&&_0x29b10a[_0xe5cb('0x7d')][_0x22bac0][_0xe5cb('0x7e')]&&_0x29b10a[_0xe5cb('0x7d')][_0x22bac0][_0xe5cb('0x7f')]){_0x53bcbf[_0x29b10a[_0xe5cb('0x7d')][_0x22bac0][_0xe5cb('0x36')]](_0x29b10a[_0xe5cb('0x7d')][_0x22bac0][_0xe5cb('0x7e')],null,util[_0xe5cb('0x79')]('%s.%s\x20=\x20%s.%s',_0x29b10a[_0xe5cb('0x74')],_0x29b10a[_0xe5cb('0x7d')][_0x22bac0][_0xe5cb('0x80')],_0x29b10a[_0xe5cb('0x7d')][_0x22bac0][_0xe5cb('0x7e')],_0x29b10a['joins'][_0x22bac0][_0xe5cb('0x7f')]));}}}if(_0x29b10a[_0xe5cb('0x81')]){_0x29b10a[_0xe5cb('0x81')]=JSON['parse'](_0x29b10a[_0xe5cb('0x81')]);_0x53bcbf[_0xe5cb('0x42')](_0x1dca86(_0x29b10a['conditions']['group']));}_0x256a20=_0x53bcbf['clone']();_0x53bcbf[_0xe5cb('0x1d')](_0x22e744);_0x53bcbf[_0xe5cb('0x1f')](0x0);logger[_0xe5cb('0x82')]('Limited\x20Query:',_0x53bcbf['toString']());return dbH[_0xe5cb('0x83')]['query'](_0x53bcbf[_0xe5cb('0x84')](),{'type':dbH['sequelize'][_0xe5cb('0x85')]['SELECT']});}})[_0xe5cb('0x24')](respondWithResult(_0xe0a963,null))[_0xe5cb('0x4c')](handleError(_0xe0a963,null));};function runReport(_0x11b55c,_0x36e0f3,_0x1c3ee8){var _0x305452=_0x36e0f3[_0xe5cb('0x2c')];var _0x2916ae=0xa;var _0x3a4bf6=[_0xe5cb('0x5a'),_0xe5cb('0x5b'),_0xe5cb('0x5c'),_0xe5cb('0x5d')];var _0x51a7d4={'SUM':_0xe5cb('0x86'),'COUNT':_0xe5cb('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xe5cb('0x61'),'AVG':_0xe5cb('0x62'),'GROUP_CONCAT':_0xe5cb('0x63'),'GROUP_CONCAT ASC':_0xe5cb('0x87'),'GROUP_CONCAT DESC':_0xe5cb('0x64')};var _0x55464c={'SEC_TO_TIME':_0xe5cb('0x65'),'DATE':_0xe5cb('0x88'),'HOUR':'HOUR(%s)','ROUND':_0xe5cb('0x67'),'UNIX_TIMESTAMP':_0xe5cb('0x68')};var _0x23d39b=function(_0x2807ec){return!_[_0xe5cb('0x69')](['IS\x20NULL',_0xe5cb('0x6a'),_0xe5cb('0x89'),'IS\x20NOT\x20EMPTY'],_0x2807ec);};var _0x111000=function(_0x1116fc){if(!_0x1116fc||!_0x1116fc[_0xe5cb('0x6b')]['length']){return'';}for(var _0x3d1e7c='(',_0x4a2e2d=0x0;_0x4a2e2d<_0x1116fc[_0xe5cb('0x6b')][_0xe5cb('0x3d')];_0x4a2e2d+=0x1){_0x4a2e2d>0x0&&(_0x3d1e7c+='\x20'+_0x1116fc['operator']+'\x20');_0x3d1e7c+=_0x1116fc[_0xe5cb('0x6b')][_0x4a2e2d]['group']?_0x111000(_0x1116fc['rules'][_0x4a2e2d]['group']):_0x1116fc[_0xe5cb('0x6b')][_0x4a2e2d][_0xe5cb('0x6e')]+'\x20'+_0x1116fc[_0xe5cb('0x6b')][_0x4a2e2d][_0xe5cb('0x6f')]+(_0x23d39b(_0x1116fc[_0xe5cb('0x6b')][_0x4a2e2d][_0xe5cb('0x6f')])?'\x20'+_0x1116fc[_0xe5cb('0x6b')][_0x4a2e2d][_0xe5cb('0x70')]:'');}return _0x3d1e7c+')';};var _0x535f9f={'where':{'id':_0x11b55c['id']}},_0x42bbaf,_0x3e677c,_0x468674,_0x12babf,_0xd25210;_0x535f9f=_[_0xe5cb('0x45')]({},_0x535f9f,_0x1c3ee8);return db[_0xe5cb('0x34')][_0xe5cb('0x50')](_0x535f9f)[_0xe5cb('0x24')](function(_0x22048e){if(_0x22048e){_0x42bbaf=_0x22048e;return _0x22048e[_0xe5cb('0x71')]();}return null;})[_0xe5cb('0x24')](function(_0x4d749a){if(_0x4d749a){if(!_0x4d749a[_0xe5cb('0x3d')]){throw new db['Sequelize'][(_0xe5cb('0x8a'))](_0xe5cb('0x8b'),0x193);}_0x3e677c=_0x4d749a;return db[_0xe5cb('0x72')][_0xe5cb('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x3572b1){if(_0x3572b1){_0x468674=_[_0xe5cb('0x8c')](_0x3572b1,'id');var _0x5f4017;var _0x212a34=squel[_0xe5cb('0x8d')]();_0x212a34[_0xe5cb('0x73')](_0x42bbaf[_0xe5cb('0x74')]);for(var _0x5a54ec=0x0;_0x5a54ec<_0x3e677c[_0xe5cb('0x3d')];_0x5a54ec+=0x1){_0x5f4017=_0x3e677c[_0x5a54ec]['MetricId']?_0x468674[_0x3e677c[_0x5a54ec][_0xe5cb('0x75')]][_0xe5cb('0x76')]:_0x3e677c[_0x5a54ec][_0xe5cb('0x6e')];_0x5f4017=_0x3e677c[_0x5a54ec][_0xe5cb('0x78')]?_['replace'](_0x51a7d4[_0x3e677c[_0x5a54ec][_0xe5cb('0x78')]],'%s',_0x5f4017):_0x5f4017;_0x5f4017=_0x3e677c[_0x5a54ec][_0xe5cb('0x79')]?_[_0xe5cb('0x77')](_0x55464c[_0x3e677c[_0x5a54ec][_0xe5cb('0x79')]],'%s',_0x5f4017):_0x5f4017;if(_0x3e677c[_0x5a54ec][_0xe5cb('0x8e')]){_0x212a34[_0xe5cb('0x6d')](_0x5f4017);}_0x3e677c[_0x5a54ec]['orderBy']&&_0x212a34[_0xe5cb('0x40')](_0x5f4017,_0x3e677c[_0x5a54ec][_0xe5cb('0x7a')]===_0xe5cb('0x7b')?![]:!![]);_0x212a34[_0xe5cb('0x6e')](_0x5f4017,_0x3e677c[_0x5a54ec][_0xe5cb('0x7c')]||_0x5f4017);}if(_0x42bbaf[_0xe5cb('0x7d')]){_0x42bbaf[_0xe5cb('0x7d')]=JSON[_0xe5cb('0x8f')](_0x42bbaf[_0xe5cb('0x7d')]);for(var _0x3d75e4=0x0;_0x3d75e4<_0x42bbaf['joins'][_0xe5cb('0x3d')];_0x3d75e4+=0x1){if(_0x42bbaf[_0xe5cb('0x7d')][_0x3d75e4]['type']&&_[_0xe5cb('0x69')](_0x3a4bf6,_0x42bbaf[_0xe5cb('0x7d')][_0x3d75e4]['type'])&&_0x42bbaf[_0xe5cb('0x7d')][_0x3d75e4]['parentKey']&&_0x42bbaf[_0xe5cb('0x7d')][_0x3d75e4][_0xe5cb('0x7e')]&&_0x42bbaf['joins'][_0x3d75e4][_0xe5cb('0x7f')]){_0x212a34[_0x42bbaf[_0xe5cb('0x7d')][_0x3d75e4][_0xe5cb('0x36')]](_0x42bbaf[_0xe5cb('0x7d')][_0x3d75e4][_0xe5cb('0x7e')],null,util[_0xe5cb('0x79')](_0xe5cb('0x90'),_0x42bbaf[_0xe5cb('0x74')],_0x42bbaf[_0xe5cb('0x7d')][_0x3d75e4][_0xe5cb('0x80')],_0x42bbaf['joins'][_0x3d75e4]['foreignTable'],_0x42bbaf[_0xe5cb('0x7d')][_0x3d75e4][_0xe5cb('0x7f')]));}}}if(_0x42bbaf[_0xe5cb('0x81')]){_0x42bbaf[_0xe5cb('0x81')]=JSON[_0xe5cb('0x8f')](_0x42bbaf[_0xe5cb('0x81')]);_0x212a34[_0xe5cb('0x42')](_0x111000(_0x42bbaf[_0xe5cb('0x81')][_0xe5cb('0x6d')]));}_0xd25210=_0x212a34[_0xe5cb('0x91')]();_0x212a34[_0xe5cb('0x1d')](_0x2916ae);_0x212a34[_0xe5cb('0x1f')](0x0);return;}})[_0xe5cb('0x24')](function(){if(_0x36e0f3[_0xe5cb('0x92')]==='web'){return null;}var _0x4560e3=_[_0xe5cb('0x45')](_0x36e0f3,{'name':_0x36e0f3[_0xe5cb('0x93')]||_0x36e0f3['name']||_0x42bbaf[_0xe5cb('0x2c')],'basename':_0x305452,'savename':util['format'](_0xe5cb('0x94'),_0x36e0f3[_0xe5cb('0x2c')]||_0x42bbaf[_0xe5cb('0x2c')],require(_0xe5cb('0x95'))[_0xe5cb('0x96')](0x4),_0x36e0f3[_0xe5cb('0x92')]||_0xe5cb('0x97')),'reportId':_0x42bbaf['id'],'reportType':_0xe5cb('0x98')});return db[_0xe5cb('0x99')][_0xe5cb('0x51')](_0x4560e3,{'raw':!![]});})['then'](function(_0x8e9c06){if(_0x42bbaf['table']===_0xe5cb('0x9a')){_0xd25210[_0xe5cb('0x42')](_0x42bbaf['table']+_0xe5cb('0x9b'),_0x36e0f3[_0xe5cb('0x9c')],_0x36e0f3['endDate']);}else{_0xd25210[_0xe5cb('0x42')](_0x42bbaf[_0xe5cb('0x74')]+_0xe5cb('0x9d'),_0x36e0f3[_0xe5cb('0x9c')],_0x36e0f3[_0xe5cb('0x9e')]);}if(_0x8e9c06){logger['info'](_0xe5cb('0x9f'),_0xd25210[_0xe5cb('0x84')]());require('child_process')[_0xe5cb('0xa0')](path[_0xe5cb('0x5a')](__dirname,'../../components/export/',_0x8e9c06['output']),[_0x8e9c06['id'],_0xd25210['toString'](),path[_0xe5cb('0x5a')](__dirname,_0xe5cb('0xa1'),_0x8e9c06[_0xe5cb('0xa2')]),_0x305452]);return _0x8e9c06;}else{var _0x4e3df5=squel['select']();_0x4e3df5[_0xe5cb('0x73')]('('+_0xd25210['toString']()+')','countTable');_0x4e3df5['field'](_0xe5cb('0xa3'),_0xe5cb('0x1e'));_0xd25210[_0xe5cb('0x1d')](_0x36e0f3[_0xe5cb('0x1d')]||_0x2916ae);_0xd25210['offset'](_0x36e0f3[_0xe5cb('0x1f')]||0x0);return dbH[_0xe5cb('0x83')]['query'](_0x4e3df5[_0xe5cb('0x84')](),{'type':dbH[_0xe5cb('0x83')][_0xe5cb('0x85')][_0xe5cb('0xa4')]})[_0xe5cb('0x24')](function(_0x566549){if(!_0x566549[_0xe5cb('0x3d')]){_0x12babf=0x0;}else{_0x12babf=_0x566549[0x0][_0xe5cb('0x1e')]||0x0;}return dbH['sequelize'][_0xe5cb('0x38')](_0xd25210[_0xe5cb('0x84')](),{'type':dbH['sequelize'][_0xe5cb('0x85')][_0xe5cb('0xa4')]});})[_0xe5cb('0x24')](function(_0x2d7de6){return{'rows':_0x2d7de6||[],'count':_0x12babf};});}});}exports[_0xe5cb('0xa5')]=function(_0x4f81bf,_0x3a17cd){return runReport(_0x4f81bf[_0xe5cb('0x4e')],_0x4f81bf['query'],_0x4f81bf[_0xe5cb('0x47')])['then'](respondWithResult(_0x3a17cd,null))[_0xe5cb('0x4c')](handleError(_0x3a17cd,null));};exports['runReport']=runReport;exports[_0xe5cb('0x38')]=function(_0x279492,_0x368b86){var _0x1fbde8=0xa;var _0x352c65=[_0xe5cb('0x5a'),_0xe5cb('0x5b'),_0xe5cb('0x5c'),_0xe5cb('0x5d')];var _0x24a132={'SUM':_0xe5cb('0x86'),'COUNT':_0xe5cb('0x5e'),'COUNT DISTINCT':_0xe5cb('0x5f'),'MAX':_0xe5cb('0x60'),'MIN':_0xe5cb('0x61'),'AVG':_0xe5cb('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe5cb('0x87'),'GROUP_CONCAT DESC':_0xe5cb('0x64')};var _0xc2ff9c={'SEC_TO_TIME':_0xe5cb('0x65'),'DATE':'DATE(%s)','HOUR':_0xe5cb('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe5cb('0x68')};var _0x34d940=function(_0x4dd998){return!_[_0xe5cb('0x69')]([_0xe5cb('0xa6'),_0xe5cb('0x6a'),_0xe5cb('0x89'),_0xe5cb('0xa7')],_0x4dd998);};var _0x43dfdc=function(_0x2b5e87){if(!_0x2b5e87||!_0x2b5e87[_0xe5cb('0x6b')][_0xe5cb('0x3d')]){return'';}for(var _0x459d34='(',_0x374088=0x0;_0x374088<_0x2b5e87[_0xe5cb('0x6b')]['length'];_0x374088+=0x1){_0x374088>0x0&&(_0x459d34+='\x20'+_0x2b5e87[_0xe5cb('0x6c')]+'\x20');_0x459d34+=_0x2b5e87[_0xe5cb('0x6b')][_0x374088][_0xe5cb('0x6d')]?_0x43dfdc(_0x2b5e87[_0xe5cb('0x6b')][_0x374088][_0xe5cb('0x6d')]):_0x2b5e87[_0xe5cb('0x6b')][_0x374088][_0xe5cb('0x6e')]+'\x20'+_0x2b5e87[_0xe5cb('0x6b')][_0x374088]['condition']+(_0x34d940(_0x2b5e87[_0xe5cb('0x6b')][_0x374088][_0xe5cb('0x6f')])?'\x20'+_0x2b5e87[_0xe5cb('0x6b')][_0x374088]['value']:'');}return _0x459d34+')';};var _0x498e72={'where':{'id':_0x279492[_0xe5cb('0x4e')]['id']}},_0xd941e3,_0x11ed1d,_0x3a4f18,_0x2ad11c,_0x48c0a9;_0x498e72=_['merge']({},_0x498e72,_0x279492[_0xe5cb('0x47')]);return db[_0xe5cb('0x34')]['find'](_0x498e72)[_0xe5cb('0x24')](function(_0x23b188){if(_0x23b188){_0xd941e3=_0x23b188;return _0x23b188[_0xe5cb('0x71')]();}return null;})[_0xe5cb('0x24')](function(_0x4237a7){if(_0x4237a7){if(!_0x4237a7[_0xe5cb('0x3d')]){throw new db[(_0xe5cb('0xa8'))][(_0xe5cb('0x8a'))](_0xe5cb('0x8b'),0x193);}_0x11ed1d=_0x4237a7;return db['AnalyticMetric'][_0xe5cb('0x4a')]({'raw':!![]});}return null;})[_0xe5cb('0x24')](function(_0x2ca730){if(_0x2ca730){_0x3a4f18=_['keyBy'](_0x2ca730,'id');var _0x548964;var _0xdf8dc4=squel[_0xe5cb('0x8d')]();_0xdf8dc4[_0xe5cb('0x73')](_0xd941e3['table']);for(var _0x142759=0x0;_0x142759<_0x11ed1d[_0xe5cb('0x3d')];_0x142759+=0x1){_0x548964=_0x11ed1d[_0x142759]['MetricId']?_0x3a4f18[_0x11ed1d[_0x142759][_0xe5cb('0x75')]][_0xe5cb('0x76')]:_0x11ed1d[_0x142759][_0xe5cb('0x6e')];_0x548964=_0x11ed1d[_0x142759][_0xe5cb('0x78')]?_[_0xe5cb('0x77')](_0x24a132[_0x11ed1d[_0x142759][_0xe5cb('0x78')]],'%s',_0x548964):_0x548964;_0x548964=_0x11ed1d[_0x142759][_0xe5cb('0x79')]?_[_0xe5cb('0x77')](_0xc2ff9c[_0x11ed1d[_0x142759][_0xe5cb('0x79')]],'%s',_0x548964):_0x548964;if(_0x11ed1d[_0x142759][_0xe5cb('0x8e')]){_0xdf8dc4[_0xe5cb('0x6d')](_0x548964);}_0x11ed1d[_0x142759][_0xe5cb('0x7a')]&&_0xdf8dc4['order'](_0x548964,_0x11ed1d[_0x142759][_0xe5cb('0x7a')]===_0xe5cb('0x7b')?![]:!![]);_0xdf8dc4[_0xe5cb('0x6e')](_0x548964,_0x11ed1d[_0x142759][_0xe5cb('0x7c')]||_0x548964);}if(_0xd941e3[_0xe5cb('0x7d')]){_0xd941e3[_0xe5cb('0x7d')]=JSON['parse'](_0xd941e3[_0xe5cb('0x7d')]);for(var _0x201e5a=0x0;_0x201e5a<_0xd941e3[_0xe5cb('0x7d')][_0xe5cb('0x3d')];_0x201e5a+=0x1){if(_0xd941e3[_0xe5cb('0x7d')][_0x201e5a]['type']&&_[_0xe5cb('0x69')](_0x352c65,_0xd941e3['joins'][_0x201e5a][_0xe5cb('0x36')])&&_0xd941e3[_0xe5cb('0x7d')][_0x201e5a][_0xe5cb('0x80')]&&_0xd941e3['joins'][_0x201e5a][_0xe5cb('0x7e')]&&_0xd941e3[_0xe5cb('0x7d')][_0x201e5a]['foreignKey']){_0xdf8dc4[_0xd941e3['joins'][_0x201e5a][_0xe5cb('0x36')]](_0xd941e3[_0xe5cb('0x7d')][_0x201e5a]['foreignTable'],null,util[_0xe5cb('0x79')](_0xe5cb('0x90'),_0xd941e3[_0xe5cb('0x74')],_0xd941e3[_0xe5cb('0x7d')][_0x201e5a][_0xe5cb('0x80')],_0xd941e3[_0xe5cb('0x7d')][_0x201e5a][_0xe5cb('0x7e')],_0xd941e3[_0xe5cb('0x7d')][_0x201e5a][_0xe5cb('0x7f')]));}}}if(_0xd941e3['conditions']){_0xd941e3['conditions']=JSON[_0xe5cb('0x8f')](_0xd941e3[_0xe5cb('0x81')]);_0xdf8dc4[_0xe5cb('0x42')](_0x43dfdc(_0xd941e3[_0xe5cb('0x81')][_0xe5cb('0x6d')]));}_0x48c0a9=_0xdf8dc4[_0xe5cb('0x91')]();_0xdf8dc4[_0xe5cb('0x1d')](_0x1fbde8);_0xdf8dc4[_0xe5cb('0x1f')](0x0);logger[_0xe5cb('0x82')](_0xe5cb('0xa9'),_0xdf8dc4['toString']());return dbH['sequelize']['query'](_0xdf8dc4[_0xe5cb('0x84')](),{'type':dbH[_0xe5cb('0x83')][_0xe5cb('0x85')][_0xe5cb('0xa4')]});}})[_0xe5cb('0x24')](function(){return{'sql':_0x48c0a9[_0xe5cb('0x84')]()};})[_0xe5cb('0x24')](respondWithResult(_0x368b86,null))[_0xe5cb('0x4c')](handleError(_0x368b86,null));}; \ No newline at end of file +var _0xcb2d=['account','index','map','AnalyticCustomReport','rawAttributes','fieldName','model','keys','query','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','params','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','operator','value','select','web','randomstring','output','custom','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20EMPTY','getFields','metric','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','contact','message','agent','interaction'];(function(_0x44e843,_0x18e958){var _0x4f0a2d=function(_0xd7cb2){while(--_0xd7cb2){_0x44e843['push'](_0x44e843['shift']());}};_0x4f0a2d(++_0x18e958);}(_0xcb2d,0x125));var _0xdcb2=function(_0x5acf2b,_0x4cd989){_0x5acf2b=_0x5acf2b-0x0;var _0x23ef03=_0xcb2d[_0x5acf2b];return _0x23ef03;};'use strict';var emlformat=require(_0xdcb2('0x0'));var rimraf=require(_0xdcb2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdcb2('0x2'));var rp=require(_0xdcb2('0x3'));var moment=require(_0xdcb2('0x4'));var BPromise=require(_0xdcb2('0x5'));var Mustache=require(_0xdcb2('0x6'));var util=require(_0xdcb2('0x7'));var path=require('path');var sox=require(_0xdcb2('0x8'));var csv=require(_0xdcb2('0x9'));var ejs=require(_0xdcb2('0xa'));var fs=require('fs');var fs_extra=require(_0xdcb2('0xb'));var _=require(_0xdcb2('0xc'));var squel=require('squel');var crypto=require(_0xdcb2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdcb2('0xe'));var toCsv=require(_0xdcb2('0x9'));var querystring=require(_0xdcb2('0xf'));var Papa=require(_0xdcb2('0x10'));var Redis=require(_0xdcb2('0x11'));var authService=require(_0xdcb2('0x12'));var qs=require(_0xdcb2('0x13'));var as=require(_0xdcb2('0x14'));var hardwareService=require(_0xdcb2('0x15'));var logger=require('../../config/logger')(_0xdcb2('0x16'));var utils=require(_0xdcb2('0x17'));var config=require(_0xdcb2('0x18'));var licenseUtil=require(_0xdcb2('0x19'));var db=require(_0xdcb2('0x1a'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x1585fa,_0x3099e8){_0x3099e8=_0x3099e8||0xcc;return function(_0x4ef3d2){if(_0x4ef3d2){return _0x1585fa['sendStatus'](_0x3099e8);}return _0x1585fa['status'](_0x3099e8)[_0xdcb2('0x1b')]();};}function respondWithResult(_0x50241b,_0x4bf90f){_0x4bf90f=_0x4bf90f||0xc8;return function(_0x32a1ec){if(_0x32a1ec){return _0x50241b[_0xdcb2('0x1c')](_0x4bf90f)[_0xdcb2('0x1d')](_0x32a1ec);}};}function respondWithFilteredResult(_0x2cd20a,_0x332827){return function(_0x46741c){if(_0x46741c){var _0x40058c=typeof _0x332827[_0xdcb2('0x1e')]===_0xdcb2('0x1f')&&typeof _0x332827[_0xdcb2('0x20')]===_0xdcb2('0x1f');var _0x2ba1a5=_0x46741c[_0xdcb2('0x21')];var _0x45a54c=_0x40058c?0x0:_0x332827[_0xdcb2('0x1e')];var _0x4e3838=_0x40058c?_0x46741c[_0xdcb2('0x21')]:_0x332827['offset']+_0x332827['limit'];var _0xfce711;if(_0x4e3838>=_0x2ba1a5){_0x4e3838=_0x2ba1a5;_0xfce711=0xc8;}else{_0xfce711=0xce;}_0x2cd20a['status'](_0xfce711);return _0x2cd20a[_0xdcb2('0x22')](_0xdcb2('0x23'),_0x45a54c+'-'+_0x4e3838+'/'+_0x2ba1a5)[_0xdcb2('0x1d')](_0x46741c);}return null;};}function patchUpdates(_0x169d5d){return function(_0x3b916c){try{jsonpatch[_0xdcb2('0x24')](_0x3b916c,_0x169d5d,!![]);}catch(_0x293ac0){return BPromise[_0xdcb2('0x25')](_0x293ac0);}return _0x3b916c[_0xdcb2('0x26')]();};}function saveUpdates(_0x461042,_0x36fd7a){return function(_0x21b311){if(_0x21b311){return _0x21b311[_0xdcb2('0x27')](_0x461042)[_0xdcb2('0x28')](function(_0x5c1eb1){return _0x5c1eb1;});}return null;};}function removeEntity(_0x49286e,_0x43fbf4){return function(_0xe59077){if(_0xe59077){return _0xe59077[_0xdcb2('0x29')]()[_0xdcb2('0x28')](function(){var _0x56e948=_0xe59077['get']({'plain':!![]});var _0x2c48c4=_0xdcb2('0x2a');return db[_0xdcb2('0x2b')]['destroy']({'where':{'type':_0x2c48c4,'resourceId':_0x56e948['id']}})[_0xdcb2('0x28')](function(){return _0xe59077;});})[_0xdcb2('0x28')](function(){_0x49286e[_0xdcb2('0x1c')](0xcc)[_0xdcb2('0x1b')]();});}};}function handleEntityNotFound(_0x2ab459,_0x20a8f1){return function(_0x305779){if(!_0x305779){_0x2ab459[_0xdcb2('0x2c')](0x194);}return _0x305779;};}function handleError(_0x418e4b,_0x3c8447){_0x3c8447=_0x3c8447||0x1f4;return function(_0x1f9126){logger[_0xdcb2('0x2d')](_0x1f9126[_0xdcb2('0x2e')]);if(_0x1f9126[_0xdcb2('0x2f')]){delete _0x1f9126[_0xdcb2('0x2f')];}_0x418e4b['status'](_0x3c8447)[_0xdcb2('0x30')](_0x1f9126);};}function getMustacheRender(_0x540ef2,_0x4294ca){return Mustache['render'](_0x540ef2,_['merge'](_0x4294ca['body'],{'contact':_0x4294ca[_0xdcb2('0x31')],'message':_0x4294ca[_0xdcb2('0x32')],'agent':_0x4294ca[_0xdcb2('0x33')],'interaction':_0x4294ca[_0xdcb2('0x34')],'account':_0x4294ca[_0xdcb2('0x35')]}))||'';}exports[_0xdcb2('0x36')]=function(_0x3fa84a,_0x54a374){var _0x264d21={},_0xde76b8={},_0x465c13={'count':0x0,'rows':[]};var _0x5d3f58=_[_0xdcb2('0x37')](db[_0xdcb2('0x38')][_0xdcb2('0x39')],function(_0x5bc976){return{'name':_0x5bc976[_0xdcb2('0x3a')],'type':_0x5bc976['type']['key']};});_0xde76b8[_0xdcb2('0x3b')]=_[_0xdcb2('0x37')](_0x5d3f58,_0xdcb2('0x2f'));_0xde76b8['query']=_[_0xdcb2('0x3c')](_0x3fa84a[_0xdcb2('0x3d')]);_0xde76b8[_0xdcb2('0x3e')]=_['intersection'](_0xde76b8[_0xdcb2('0x3b')],_0xde76b8[_0xdcb2('0x3d')]);_0x264d21[_0xdcb2('0x3f')]=_['intersection'](_0xde76b8[_0xdcb2('0x3b')],qs[_0xdcb2('0x40')](_0x3fa84a[_0xdcb2('0x3d')][_0xdcb2('0x40')]));_0x264d21[_0xdcb2('0x3f')]=_0x264d21[_0xdcb2('0x3f')]['length']?_0x264d21['attributes']:_0xde76b8[_0xdcb2('0x3b')];if(!_0x3fa84a[_0xdcb2('0x3d')][_0xdcb2('0x41')]('nolimit')){_0x264d21[_0xdcb2('0x20')]=qs['limit'](_0x3fa84a['query'][_0xdcb2('0x20')]);_0x264d21['offset']=qs['offset'](_0x3fa84a[_0xdcb2('0x3d')][_0xdcb2('0x1e')]);}_0x264d21[_0xdcb2('0x42')]=qs[_0xdcb2('0x43')](_0x3fa84a[_0xdcb2('0x3d')][_0xdcb2('0x43')]);_0x264d21[_0xdcb2('0x44')]=qs[_0xdcb2('0x3e')](_[_0xdcb2('0x45')](_0x3fa84a[_0xdcb2('0x3d')],_0xde76b8[_0xdcb2('0x3e')]),_0x5d3f58);if(_0x3fa84a['query'][_0xdcb2('0x46')]){_0x264d21['where']=_[_0xdcb2('0x47')](_0x264d21[_0xdcb2('0x44')],{'$or':_[_0xdcb2('0x37')](_0x5d3f58,function(_0x38fe35){if(_0x38fe35[_0xdcb2('0x48')]!==_0xdcb2('0x49')){var _0x5efdd5={};_0x5efdd5[_0x38fe35[_0xdcb2('0x2f')]]={'$like':'%'+_0x3fa84a['query']['filter']+'%'};return _0x5efdd5;}})});}_0x264d21=_['merge']({},_0x264d21,_0x3fa84a[_0xdcb2('0x4a')]);var _0x4ca9bc={'where':_0x264d21['where']};return db['AnalyticCustomReport']['count'](_0x4ca9bc)[_0xdcb2('0x28')](function(_0x5d357){_0x465c13[_0xdcb2('0x21')]=_0x5d357;if(_0x3fa84a[_0xdcb2('0x3d')][_0xdcb2('0x4b')]){_0x264d21[_0xdcb2('0x4c')]=[{'all':!![]}];}return db[_0xdcb2('0x38')][_0xdcb2('0x4d')](_0x264d21);})['then'](function(_0x539de0){_0x465c13[_0xdcb2('0x4e')]=_0x539de0;return _0x465c13;})[_0xdcb2('0x28')](respondWithFilteredResult(_0x54a374,_0x264d21))[_0xdcb2('0x4f')](handleError(_0x54a374,null));};exports[_0xdcb2('0x50')]=function(_0x4da3c0,_0x271acf){var _0xffe701={'raw':![],'where':{'id':_0x4da3c0['params']['id']}},_0xf36f90={};_0xf36f90['model']=_[_0xdcb2('0x3c')](db[_0xdcb2('0x38')]['rawAttributes']);_0xf36f90[_0xdcb2('0x3d')]=_['keys'](_0x4da3c0['query']);_0xf36f90[_0xdcb2('0x3e')]=_[_0xdcb2('0x51')](_0xf36f90[_0xdcb2('0x3b')],_0xf36f90[_0xdcb2('0x3d')]);_0xffe701[_0xdcb2('0x3f')]=_[_0xdcb2('0x51')](_0xf36f90[_0xdcb2('0x3b')],qs['fields'](_0x4da3c0[_0xdcb2('0x3d')]['fields']));_0xffe701[_0xdcb2('0x3f')]=_0xffe701[_0xdcb2('0x3f')][_0xdcb2('0x52')]?_0xffe701['attributes']:_0xf36f90[_0xdcb2('0x3b')];if(_0x4da3c0[_0xdcb2('0x3d')][_0xdcb2('0x4b')]){_0xffe701[_0xdcb2('0x4c')]=[{'all':!![]}];}_0xffe701=_['merge']({},_0xffe701,_0x4da3c0[_0xdcb2('0x4a')]);return db[_0xdcb2('0x38')][_0xdcb2('0x53')](_0xffe701)[_0xdcb2('0x28')](handleEntityNotFound(_0x271acf,null))[_0xdcb2('0x28')](respondWithResult(_0x271acf,null))[_0xdcb2('0x4f')](handleError(_0x271acf,null));};exports[_0xdcb2('0x54')]=function(_0x270230,_0xb97b30){return db[_0xdcb2('0x38')][_0xdcb2('0x54')](_0x270230[_0xdcb2('0x55')],{})[_0xdcb2('0x28')](function(_0x48e540){var _0x2d528d=_0x270230[_0xdcb2('0x56')][_0xdcb2('0x57')]({'plain':!![]});if(!_0x2d528d)throw new Error(_0xdcb2('0x58'));if(_0x2d528d[_0xdcb2('0x59')]==='user'){var _0x39f6c7=_0x48e540[_0xdcb2('0x57')]({'plain':!![]});var _0x2d8a27=_0xdcb2('0x5a');return db[_0xdcb2('0x5b')]['find']({'where':{'name':_0x2d8a27,'userProfileId':_0x2d528d[_0xdcb2('0x5c')]},'raw':!![]})[_0xdcb2('0x28')](function(_0x314bc9){if(_0x314bc9&&_0x314bc9[_0xdcb2('0x5d')]===0x0){return db[_0xdcb2('0x2b')][_0xdcb2('0x54')]({'name':_0x39f6c7[_0xdcb2('0x2f')],'resourceId':_0x39f6c7['id'],'type':_0xdcb2('0x2a'),'sectionId':_0x314bc9['id']},{})[_0xdcb2('0x28')](function(){return _0x48e540;});}else{return _0x48e540;}})[_0xdcb2('0x4f')](function(_0xe50f08){logger[_0xdcb2('0x2d')](_0xdcb2('0x5e'),_0xe50f08);throw _0xe50f08;});}return _0x48e540;})['then'](respondWithResult(_0xb97b30,0xc9))['catch'](handleError(_0xb97b30,null));};exports[_0xdcb2('0x27')]=function(_0x452e87,_0x2c1f9e){if(_0x452e87[_0xdcb2('0x55')]['id']){delete _0x452e87['body']['id'];}return db['AnalyticCustomReport'][_0xdcb2('0x53')]({'where':{'id':_0x452e87['params']['id']}})[_0xdcb2('0x28')](handleEntityNotFound(_0x2c1f9e,null))[_0xdcb2('0x28')](saveUpdates(_0x452e87[_0xdcb2('0x55')],null))[_0xdcb2('0x28')](respondWithResult(_0x2c1f9e,null))['catch'](handleError(_0x2c1f9e,null));};exports[_0xdcb2('0x29')]=function(_0x5c69c9,_0x26dfed){return db['AnalyticCustomReport']['find']({'where':{'id':_0x5c69c9['params']['id']}})[_0xdcb2('0x28')](handleEntityNotFound(_0x26dfed,null))[_0xdcb2('0x28')](removeEntity(_0x26dfed,null))[_0xdcb2('0x4f')](handleError(_0x26dfed,null));};exports['preview']=function(_0x4d0747,_0x1af683){var _0x1cb3e4=0xa;var _0x27ae2e=[_0xdcb2('0x5f'),_0xdcb2('0x60'),_0xdcb2('0x61'),_0xdcb2('0x62')];var _0x45315e={'SUM':'SUM(%s)','COUNT':_0xdcb2('0x63'),'COUNT DISTINCT':_0xdcb2('0x64'),'MAX':_0xdcb2('0x65'),'MIN':_0xdcb2('0x66'),'AVG':_0xdcb2('0x67'),'GROUP_CONCAT':_0xdcb2('0x68'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xdcb2('0x69')};var _0xde4860={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xdcb2('0x6a'),'HOUR':_0xdcb2('0x6b'),'ROUND':_0xdcb2('0x6c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5e0e31=function(_0x16475b){return!_[_0xdcb2('0x6d')]([_0xdcb2('0x6e'),_0xdcb2('0x6f'),'IS\x20EMPTY',_0xdcb2('0x70')],_0x16475b);};var _0x348a7=function(_0x2e3d87){if(!_0x2e3d87||!_0x2e3d87['rules'][_0xdcb2('0x52')]){return'';}for(var _0x57d6d6='(',_0x3b5b8e=0x0;_0x3b5b8e<_0x2e3d87[_0xdcb2('0x71')][_0xdcb2('0x52')];_0x3b5b8e+=0x1){_0x3b5b8e>0x0&&(_0x57d6d6+='\x20'+_0x2e3d87['operator']+'\x20');_0x57d6d6+=_0x2e3d87['rules'][_0x3b5b8e][_0xdcb2('0x72')]?_0x348a7(_0x2e3d87[_0xdcb2('0x71')][_0x3b5b8e][_0xdcb2('0x72')]):_0x2e3d87[_0xdcb2('0x71')][_0x3b5b8e][_0xdcb2('0x73')]+'\x20'+_0x2e3d87[_0xdcb2('0x71')][_0x3b5b8e][_0xdcb2('0x74')]+(_0x5e0e31(_0x2e3d87[_0xdcb2('0x71')][_0x3b5b8e][_0xdcb2('0x74')])?'\x20'+_0x2e3d87[_0xdcb2('0x71')][_0x3b5b8e]['value']:'');}return _0x57d6d6+')';};var _0x36eaa6={'where':{'id':_0x4d0747[_0xdcb2('0x75')]['id']}},_0x405032,_0x2991e8,_0x1a0edf,_0x9b98a8,_0x586d3;_0x36eaa6=_['merge']({},_0x36eaa6,_0x4d0747[_0xdcb2('0x4a')]);return db[_0xdcb2('0x38')]['find'](_0x36eaa6)[_0xdcb2('0x28')](function(_0x58ba07){if(_0x58ba07){_0x405032=_0x58ba07;return _0x58ba07['getFields']();}return null;})[_0xdcb2('0x28')](function(_0x244c10){if(_0x244c10){if(!_0x244c10[_0xdcb2('0x52')]){throw new db[(_0xdcb2('0x76'))][(_0xdcb2('0x77'))](_0xdcb2('0x78'),0x193);}_0x2991e8=_0x244c10;return db[_0xdcb2('0x79')]['findAll']({'raw':!![]});}return null;})[_0xdcb2('0x28')](function(_0x545957){if(_0x545957){_0x1a0edf=_[_0xdcb2('0x7a')](_0x545957,'id');var _0x2d34b8;var _0x2a0561=squel['select']();_0x2a0561[_0xdcb2('0x7b')](_0x405032['table']);for(var _0x485512=0x0;_0x485512<_0x2991e8[_0xdcb2('0x52')];_0x485512+=0x1){_0x2d34b8=_0x2991e8[_0x485512]['MetricId']?_0x1a0edf[_0x2991e8[_0x485512][_0xdcb2('0x7c')]]['metric']:_0x2991e8[_0x485512][_0xdcb2('0x73')];_0x2d34b8=_0x2991e8[_0x485512][_0xdcb2('0x7d')]?_['replace'](_0x45315e[_0x2991e8[_0x485512]['function']],'%s',_0x2d34b8):_0x2d34b8;_0x2d34b8=_0x2991e8[_0x485512]['format']?_[_0xdcb2('0x7e')](_0xde4860[_0x2991e8[_0x485512][_0xdcb2('0x7f')]],'%s',_0x2d34b8):_0x2d34b8;if(_0x2991e8[_0x485512][_0xdcb2('0x80')]){_0x2a0561[_0xdcb2('0x72')](_0x2d34b8);}_0x2991e8[_0x485512][_0xdcb2('0x81')]&&_0x2a0561[_0xdcb2('0x42')](_0x2d34b8,_0x2991e8[_0x485512]['orderBy']===_0xdcb2('0x82')?![]:!![]);_0x2a0561['field'](_0x2d34b8,_0x2991e8[_0x485512][_0xdcb2('0x83')]||_0x2d34b8);}if(_0x405032[_0xdcb2('0x84')]){_0x405032['joins']=JSON[_0xdcb2('0x85')](_0x405032['joins']);for(var _0x22c34b=0x0;_0x22c34b<_0x405032[_0xdcb2('0x84')][_0xdcb2('0x52')];_0x22c34b+=0x1){if(_0x405032['joins'][_0x22c34b]['type']&&_[_0xdcb2('0x6d')](_0x27ae2e,_0x405032[_0xdcb2('0x84')][_0x22c34b]['type'])&&_0x405032[_0xdcb2('0x84')][_0x22c34b][_0xdcb2('0x86')]&&_0x405032[_0xdcb2('0x84')][_0x22c34b][_0xdcb2('0x87')]&&_0x405032[_0xdcb2('0x84')][_0x22c34b][_0xdcb2('0x88')]){_0x2a0561[_0x405032['joins'][_0x22c34b][_0xdcb2('0x48')]](_0x405032[_0xdcb2('0x84')][_0x22c34b]['foreignTable'],null,util[_0xdcb2('0x7f')](_0xdcb2('0x89'),_0x405032[_0xdcb2('0x8a')],_0x405032[_0xdcb2('0x84')][_0x22c34b]['parentKey'],_0x405032[_0xdcb2('0x84')][_0x22c34b][_0xdcb2('0x87')],_0x405032[_0xdcb2('0x84')][_0x22c34b][_0xdcb2('0x88')]));}}}if(_0x405032[_0xdcb2('0x8b')]){_0x405032[_0xdcb2('0x8b')]=JSON[_0xdcb2('0x85')](_0x405032[_0xdcb2('0x8b')]);_0x2a0561[_0xdcb2('0x44')](_0x348a7(_0x405032[_0xdcb2('0x8b')][_0xdcb2('0x72')]));}_0x586d3=_0x2a0561[_0xdcb2('0x8c')]();_0x2a0561[_0xdcb2('0x20')](_0x1cb3e4);_0x2a0561[_0xdcb2('0x1e')](0x0);logger[_0xdcb2('0x8d')](_0xdcb2('0x8e'),_0x2a0561[_0xdcb2('0x8f')]());return dbH[_0xdcb2('0x90')]['query'](_0x2a0561['toString'](),{'type':dbH[_0xdcb2('0x90')][_0xdcb2('0x91')][_0xdcb2('0x92')]});}})[_0xdcb2('0x28')](respondWithResult(_0x1af683,null))[_0xdcb2('0x4f')](handleError(_0x1af683,null));};function runReport(_0x1c81a6,_0x267951,_0x21f301){var _0x6a5183=_0x267951['name'];var _0x3596dc=0xa;var _0x4c5244=['join',_0xdcb2('0x60'),_0xdcb2('0x61'),'cross_join'];var _0x2f7198={'SUM':_0xdcb2('0x93'),'COUNT':_0xdcb2('0x63'),'COUNT DISTINCT':_0xdcb2('0x64'),'MAX':_0xdcb2('0x65'),'MIN':_0xdcb2('0x66'),'AVG':_0xdcb2('0x67'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x455152={'SEC_TO_TIME':_0xdcb2('0x94'),'DATE':'DATE(%s)','HOUR':_0xdcb2('0x6b'),'ROUND':_0xdcb2('0x6c'),'UNIX_TIMESTAMP':_0xdcb2('0x95')};var _0x1e922d=function(_0x1bb678){return!_[_0xdcb2('0x6d')]([_0xdcb2('0x6e'),_0xdcb2('0x6f'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1bb678);};var _0x26d06d=function(_0x34c02d){if(!_0x34c02d||!_0x34c02d[_0xdcb2('0x71')]['length']){return'';}for(var _0x211207='(',_0x3d4e43=0x0;_0x3d4e43<_0x34c02d[_0xdcb2('0x71')][_0xdcb2('0x52')];_0x3d4e43+=0x1){_0x3d4e43>0x0&&(_0x211207+='\x20'+_0x34c02d[_0xdcb2('0x96')]+'\x20');_0x211207+=_0x34c02d['rules'][_0x3d4e43][_0xdcb2('0x72')]?_0x26d06d(_0x34c02d[_0xdcb2('0x71')][_0x3d4e43][_0xdcb2('0x72')]):_0x34c02d[_0xdcb2('0x71')][_0x3d4e43][_0xdcb2('0x73')]+'\x20'+_0x34c02d['rules'][_0x3d4e43][_0xdcb2('0x74')]+(_0x1e922d(_0x34c02d[_0xdcb2('0x71')][_0x3d4e43][_0xdcb2('0x74')])?'\x20'+_0x34c02d['rules'][_0x3d4e43][_0xdcb2('0x97')]:'');}return _0x211207+')';};var _0x38701a={'where':{'id':_0x1c81a6['id']}},_0x12c02d,_0x3a3411,_0x384bd0,_0x358934,_0x19ac5c;_0x38701a=_[_0xdcb2('0x47')]({},_0x38701a,_0x21f301);return db[_0xdcb2('0x38')][_0xdcb2('0x53')](_0x38701a)[_0xdcb2('0x28')](function(_0x53dd7c){if(_0x53dd7c){_0x12c02d=_0x53dd7c;return _0x53dd7c['getFields']();}return null;})[_0xdcb2('0x28')](function(_0x254531){if(_0x254531){if(!_0x254531[_0xdcb2('0x52')]){throw new db[(_0xdcb2('0x76'))]['ValidationErrorItem'](_0xdcb2('0x78'),0x193);}_0x3a3411=_0x254531;return db[_0xdcb2('0x79')]['findAll']({'raw':!![]});}return null;})[_0xdcb2('0x28')](function(_0x118b69){if(_0x118b69){_0x384bd0=_[_0xdcb2('0x7a')](_0x118b69,'id');var _0x2af21a;var _0x4c1310=squel[_0xdcb2('0x98')]();_0x4c1310[_0xdcb2('0x7b')](_0x12c02d[_0xdcb2('0x8a')]);for(var _0x58bd45=0x0;_0x58bd45<_0x3a3411['length'];_0x58bd45+=0x1){_0x2af21a=_0x3a3411[_0x58bd45]['MetricId']?_0x384bd0[_0x3a3411[_0x58bd45][_0xdcb2('0x7c')]]['metric']:_0x3a3411[_0x58bd45][_0xdcb2('0x73')];_0x2af21a=_0x3a3411[_0x58bd45][_0xdcb2('0x7d')]?_['replace'](_0x2f7198[_0x3a3411[_0x58bd45][_0xdcb2('0x7d')]],'%s',_0x2af21a):_0x2af21a;_0x2af21a=_0x3a3411[_0x58bd45][_0xdcb2('0x7f')]?_[_0xdcb2('0x7e')](_0x455152[_0x3a3411[_0x58bd45][_0xdcb2('0x7f')]],'%s',_0x2af21a):_0x2af21a;if(_0x3a3411[_0x58bd45][_0xdcb2('0x80')]){_0x4c1310[_0xdcb2('0x72')](_0x2af21a);}_0x3a3411[_0x58bd45][_0xdcb2('0x81')]&&_0x4c1310[_0xdcb2('0x42')](_0x2af21a,_0x3a3411[_0x58bd45][_0xdcb2('0x81')]==='DESC'?![]:!![]);_0x4c1310['field'](_0x2af21a,_0x3a3411[_0x58bd45]['alias']||_0x2af21a);}if(_0x12c02d[_0xdcb2('0x84')]){_0x12c02d[_0xdcb2('0x84')]=JSON[_0xdcb2('0x85')](_0x12c02d[_0xdcb2('0x84')]);for(var _0x562d79=0x0;_0x562d79<_0x12c02d[_0xdcb2('0x84')][_0xdcb2('0x52')];_0x562d79+=0x1){if(_0x12c02d[_0xdcb2('0x84')][_0x562d79][_0xdcb2('0x48')]&&_['includes'](_0x4c5244,_0x12c02d[_0xdcb2('0x84')][_0x562d79][_0xdcb2('0x48')])&&_0x12c02d[_0xdcb2('0x84')][_0x562d79][_0xdcb2('0x86')]&&_0x12c02d[_0xdcb2('0x84')][_0x562d79][_0xdcb2('0x87')]&&_0x12c02d[_0xdcb2('0x84')][_0x562d79][_0xdcb2('0x88')]){_0x4c1310[_0x12c02d[_0xdcb2('0x84')][_0x562d79][_0xdcb2('0x48')]](_0x12c02d['joins'][_0x562d79]['foreignTable'],null,util[_0xdcb2('0x7f')](_0xdcb2('0x89'),_0x12c02d[_0xdcb2('0x8a')],_0x12c02d[_0xdcb2('0x84')][_0x562d79][_0xdcb2('0x86')],_0x12c02d[_0xdcb2('0x84')][_0x562d79][_0xdcb2('0x87')],_0x12c02d[_0xdcb2('0x84')][_0x562d79][_0xdcb2('0x88')]));}}}if(_0x12c02d['conditions']){_0x12c02d[_0xdcb2('0x8b')]=JSON[_0xdcb2('0x85')](_0x12c02d[_0xdcb2('0x8b')]);_0x4c1310[_0xdcb2('0x44')](_0x26d06d(_0x12c02d[_0xdcb2('0x8b')]['group']));}_0x19ac5c=_0x4c1310[_0xdcb2('0x8c')]();_0x4c1310[_0xdcb2('0x20')](_0x3596dc);_0x4c1310['offset'](0x0);return;}})[_0xdcb2('0x28')](function(){if(_0x267951['output']===_0xdcb2('0x99')){return null;}var _0xfa23e3=_[_0xdcb2('0x47')](_0x267951,{'name':_0x267951['fullPath']||_0x267951[_0xdcb2('0x2f')]||_0x12c02d[_0xdcb2('0x2f')],'basename':_0x6a5183,'savename':util['format']('%s-%s.%s',_0x267951[_0xdcb2('0x2f')]||_0x12c02d['name'],require(_0xdcb2('0x9a'))['generate'](0x4),_0x267951[_0xdcb2('0x9b')]||'csv'),'reportId':_0x12c02d['id'],'reportType':_0xdcb2('0x9c')});return db[_0xdcb2('0x9d')]['create'](_0xfa23e3,{'raw':!![]});})['then'](function(_0x415d69){if(_0x12c02d[_0xdcb2('0x8a')]===_0xdcb2('0x9e')){_0x19ac5c[_0xdcb2('0x44')](_0x12c02d['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x267951[_0xdcb2('0x9f')],_0x267951[_0xdcb2('0xa0')]);}else{_0x19ac5c[_0xdcb2('0x44')](_0x12c02d[_0xdcb2('0x8a')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x267951[_0xdcb2('0x9f')],_0x267951['endDate']);}if(_0x415d69){logger[_0xdcb2('0xa1')](_0xdcb2('0xa2'),_0x19ac5c[_0xdcb2('0x8f')]());require(_0xdcb2('0xa3'))[_0xdcb2('0xa4')](path['join'](__dirname,_0xdcb2('0xa5'),_0x415d69[_0xdcb2('0x9b')]),[_0x415d69['id'],_0x19ac5c[_0xdcb2('0x8f')](),path['join'](__dirname,_0xdcb2('0xa6'),_0x415d69[_0xdcb2('0xa7')]),_0x6a5183]);return _0x415d69;}else{var _0x5346c0=squel[_0xdcb2('0x98')]();_0x5346c0[_0xdcb2('0x7b')]('('+_0x19ac5c[_0xdcb2('0x8f')]()+')','countTable');_0x5346c0[_0xdcb2('0x73')](_0xdcb2('0xa8'),'count');_0x19ac5c[_0xdcb2('0x20')](_0x267951[_0xdcb2('0x20')]||_0x3596dc);_0x19ac5c[_0xdcb2('0x1e')](_0x267951[_0xdcb2('0x1e')]||0x0);return dbH[_0xdcb2('0x90')]['query'](_0x5346c0[_0xdcb2('0x8f')](),{'type':dbH[_0xdcb2('0x90')][_0xdcb2('0x91')][_0xdcb2('0x92')]})[_0xdcb2('0x28')](function(_0x52eb90){if(!_0x52eb90[_0xdcb2('0x52')]){_0x358934=0x0;}else{_0x358934=_0x52eb90[0x0][_0xdcb2('0x21')]||0x0;}return dbH['sequelize'][_0xdcb2('0x3d')](_0x19ac5c[_0xdcb2('0x8f')](),{'type':dbH[_0xdcb2('0x90')]['QueryTypes'][_0xdcb2('0x92')]});})[_0xdcb2('0x28')](function(_0x4d03a5){return{'rows':_0x4d03a5||[],'count':_0x358934};});}});}exports['run']=function(_0x436e01,_0x130b82){return runReport(_0x436e01['params'],_0x436e01[_0xdcb2('0x3d')],_0x436e01[_0xdcb2('0x4a')])['then'](respondWithResult(_0x130b82,null))[_0xdcb2('0x4f')](handleError(_0x130b82,null));};exports['runReport']=runReport;exports[_0xdcb2('0x3d')]=function(_0xa5f4fb,_0x451cb9){var _0x1edd48=0xa;var _0xd232e=[_0xdcb2('0x5f'),_0xdcb2('0x60'),_0xdcb2('0x61'),_0xdcb2('0x62')];var _0x266d44={'SUM':'SUM(%s)','COUNT':_0xdcb2('0x63'),'COUNT DISTINCT':_0xdcb2('0x64'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xdcb2('0x68'),'GROUP_CONCAT ASC':_0xdcb2('0xa9'),'GROUP_CONCAT DESC':_0xdcb2('0x69')};var _0x4d10bc={'SEC_TO_TIME':_0xdcb2('0x94'),'DATE':_0xdcb2('0x6a'),'HOUR':_0xdcb2('0x6b'),'ROUND':_0xdcb2('0x6c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x586320=function(_0x2ede64){return!_['includes'](['IS\x20NULL',_0xdcb2('0x6f'),_0xdcb2('0xaa'),_0xdcb2('0x70')],_0x2ede64);};var _0xf00a52=function(_0x1c77bc){if(!_0x1c77bc||!_0x1c77bc[_0xdcb2('0x71')]['length']){return'';}for(var _0x289523='(',_0x10ffb2=0x0;_0x10ffb2<_0x1c77bc[_0xdcb2('0x71')][_0xdcb2('0x52')];_0x10ffb2+=0x1){_0x10ffb2>0x0&&(_0x289523+='\x20'+_0x1c77bc['operator']+'\x20');_0x289523+=_0x1c77bc[_0xdcb2('0x71')][_0x10ffb2][_0xdcb2('0x72')]?_0xf00a52(_0x1c77bc[_0xdcb2('0x71')][_0x10ffb2][_0xdcb2('0x72')]):_0x1c77bc['rules'][_0x10ffb2]['field']+'\x20'+_0x1c77bc[_0xdcb2('0x71')][_0x10ffb2][_0xdcb2('0x74')]+(_0x586320(_0x1c77bc[_0xdcb2('0x71')][_0x10ffb2]['condition'])?'\x20'+_0x1c77bc['rules'][_0x10ffb2]['value']:'');}return _0x289523+')';};var _0x5338ce={'where':{'id':_0xa5f4fb['params']['id']}},_0x4df523,_0x55242c,_0xb511c2,_0x19408b,_0x184d09;_0x5338ce=_['merge']({},_0x5338ce,_0xa5f4fb[_0xdcb2('0x4a')]);return db['AnalyticCustomReport'][_0xdcb2('0x53')](_0x5338ce)['then'](function(_0x147c59){if(_0x147c59){_0x4df523=_0x147c59;return _0x147c59[_0xdcb2('0xab')]();}return null;})[_0xdcb2('0x28')](function(_0x2f8941){if(_0x2f8941){if(!_0x2f8941[_0xdcb2('0x52')]){throw new db['Sequelize'][(_0xdcb2('0x77'))](_0xdcb2('0x78'),0x193);}_0x55242c=_0x2f8941;return db['AnalyticMetric'][_0xdcb2('0x4d')]({'raw':!![]});}return null;})[_0xdcb2('0x28')](function(_0x1bd0b1){if(_0x1bd0b1){_0xb511c2=_[_0xdcb2('0x7a')](_0x1bd0b1,'id');var _0x1299a4;var _0x206c89=squel['select']();_0x206c89[_0xdcb2('0x7b')](_0x4df523[_0xdcb2('0x8a')]);for(var _0x25d5e7=0x0;_0x25d5e7<_0x55242c['length'];_0x25d5e7+=0x1){_0x1299a4=_0x55242c[_0x25d5e7][_0xdcb2('0x7c')]?_0xb511c2[_0x55242c[_0x25d5e7][_0xdcb2('0x7c')]][_0xdcb2('0xac')]:_0x55242c[_0x25d5e7][_0xdcb2('0x73')];_0x1299a4=_0x55242c[_0x25d5e7][_0xdcb2('0x7d')]?_['replace'](_0x266d44[_0x55242c[_0x25d5e7][_0xdcb2('0x7d')]],'%s',_0x1299a4):_0x1299a4;_0x1299a4=_0x55242c[_0x25d5e7][_0xdcb2('0x7f')]?_[_0xdcb2('0x7e')](_0x4d10bc[_0x55242c[_0x25d5e7][_0xdcb2('0x7f')]],'%s',_0x1299a4):_0x1299a4;if(_0x55242c[_0x25d5e7][_0xdcb2('0x80')]){_0x206c89[_0xdcb2('0x72')](_0x1299a4);}_0x55242c[_0x25d5e7][_0xdcb2('0x81')]&&_0x206c89[_0xdcb2('0x42')](_0x1299a4,_0x55242c[_0x25d5e7]['orderBy']===_0xdcb2('0x82')?![]:!![]);_0x206c89[_0xdcb2('0x73')](_0x1299a4,_0x55242c[_0x25d5e7][_0xdcb2('0x83')]||_0x1299a4);}if(_0x4df523[_0xdcb2('0x84')]){_0x4df523[_0xdcb2('0x84')]=JSON['parse'](_0x4df523[_0xdcb2('0x84')]);for(var _0x38aa55=0x0;_0x38aa55<_0x4df523[_0xdcb2('0x84')][_0xdcb2('0x52')];_0x38aa55+=0x1){if(_0x4df523[_0xdcb2('0x84')][_0x38aa55][_0xdcb2('0x48')]&&_[_0xdcb2('0x6d')](_0xd232e,_0x4df523['joins'][_0x38aa55][_0xdcb2('0x48')])&&_0x4df523['joins'][_0x38aa55][_0xdcb2('0x86')]&&_0x4df523[_0xdcb2('0x84')][_0x38aa55][_0xdcb2('0x87')]&&_0x4df523[_0xdcb2('0x84')][_0x38aa55][_0xdcb2('0x88')]){_0x206c89[_0x4df523[_0xdcb2('0x84')][_0x38aa55][_0xdcb2('0x48')]](_0x4df523['joins'][_0x38aa55][_0xdcb2('0x87')],null,util[_0xdcb2('0x7f')](_0xdcb2('0x89'),_0x4df523[_0xdcb2('0x8a')],_0x4df523[_0xdcb2('0x84')][_0x38aa55][_0xdcb2('0x86')],_0x4df523[_0xdcb2('0x84')][_0x38aa55][_0xdcb2('0x87')],_0x4df523[_0xdcb2('0x84')][_0x38aa55][_0xdcb2('0x88')]));}}}if(_0x4df523['conditions']){_0x4df523[_0xdcb2('0x8b')]=JSON[_0xdcb2('0x85')](_0x4df523['conditions']);_0x206c89[_0xdcb2('0x44')](_0xf00a52(_0x4df523[_0xdcb2('0x8b')][_0xdcb2('0x72')]));}_0x184d09=_0x206c89['clone']();_0x206c89[_0xdcb2('0x20')](_0x1edd48);_0x206c89[_0xdcb2('0x1e')](0x0);logger[_0xdcb2('0x8d')](_0xdcb2('0x8e'),_0x206c89[_0xdcb2('0x8f')]());return dbH[_0xdcb2('0x90')][_0xdcb2('0x3d')](_0x206c89[_0xdcb2('0x8f')](),{'type':dbH[_0xdcb2('0x90')][_0xdcb2('0x91')][_0xdcb2('0x92')]});}})['then'](function(){return{'sql':_0x184d09[_0xdcb2('0x8f')]()};})[_0xdcb2('0x28')](respondWithResult(_0x451cb9,null))[_0xdcb2('0x4f')](handleError(_0x451cb9,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 671678a..23800fd 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 _0xc2f7=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x4c1361,_0x54b845){var _0x5d3639=function(_0x46ba1d){while(--_0x46ba1d){_0x4c1361['push'](_0x4c1361['shift']());}};_0x5d3639(++_0x54b845);}(_0xc2f7,0x1d5));var _0x7c2f=function(_0x4f0cef,_0x3a48ef){_0x4f0cef=_0x4f0cef-0x0;var _0x10c590=_0xc2f7[_0x4f0cef];return _0x10c590;};'use strict';var _=require(_0x7c2f('0x0'));var util=require(_0x7c2f('0x1'));var logger=require(_0x7c2f('0x2'))(_0x7c2f('0x3'));var moment=require(_0x7c2f('0x4'));var BPromise=require(_0x7c2f('0x5'));var rp=require(_0x7c2f('0x6'));var fs=require('fs');var path=require(_0x7c2f('0x7'));var rimraf=require(_0x7c2f('0x8'));var config=require(_0x7c2f('0x9'));var attributes=require(_0x7c2f('0xa'));module[_0x7c2f('0xb')]=function(_0x3faa1c,_0x50608e){return _0x3faa1c[_0x7c2f('0xc')](_0x7c2f('0xd'),attributes,{'tableName':_0x7c2f('0xe'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe02a=['moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','analytics_custom_reports','lodash','util','api'];(function(_0x40632e,_0x1f7f8f){var _0x3708c4=function(_0x3fd2d1){while(--_0x3fd2d1){_0x40632e['push'](_0x40632e['shift']());}};_0x3708c4(++_0x1f7f8f);}(_0xe02a,0xb8));var _0xae02=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe02a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xae02('0x0'));var util=require(_0xae02('0x1'));var logger=require('../../config/logger')(_0xae02('0x2'));var moment=require(_0xae02('0x3'));var BPromise=require(_0xae02('0x4'));var rp=require(_0xae02('0x5'));var fs=require('fs');var path=require(_0xae02('0x6'));var rimraf=require('rimraf');var config=require(_0xae02('0x7'));var attributes=require(_0xae02('0x8'));module[_0xae02('0x9')]=function(_0x51c003,_0x3175d0){return _0x51c003['define']('AnalyticCustomReport',attributes,{'tableName':_0xae02('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 11af6b8..f06b62e 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 _0x4753=['lodash','util','moment','randomstring','ioredis','../../config/utils','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0x4753,0x1f4));var _0x3475=function(_0x4f46ee,_0x52facb){_0x4f46ee=_0x4f46ee-0x0;var _0xe40af3=_0x4753[_0x4f46ee];return _0xe40af3;};'use strict';var _=require(_0x3475('0x0'));var util=require(_0x3475('0x1'));var moment=require(_0x3475('0x2'));var BPromise=require('bluebird');var rs=require(_0x3475('0x3'));var fs=require('fs');var Redis=require(_0x3475('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3475('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3475('0x6')][_0x3475('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48c6af,_0x820cbe,_0x157c1e){return new BPromise(function(_0x409bfc,_0x1d021b){return client[_0x3475('0x8')](_0x48c6af,_0x157c1e)[_0x3475('0x9')](function(_0x2c4cd7){logger[_0x3475('0xa')](_0x3475('0xb'),_0x820cbe,_0x3475('0xc'));logger['debug'](_0x3475('0xd'),_0x820cbe,_0x3475('0xc'),JSON[_0x3475('0xe')](_0x2c4cd7));if(_0x2c4cd7['error']){if(_0x2c4cd7[_0x3475('0xf')][_0x3475('0x10')]===0x1f4){logger['error'](_0x3475('0xb'),_0x820cbe,_0x2c4cd7['error'][_0x3475('0x11')]);return _0x1d021b(_0x2c4cd7[_0x3475('0xf')][_0x3475('0x11')]);}logger['error'](_0x3475('0xb'),_0x820cbe,_0x2c4cd7[_0x3475('0xf')][_0x3475('0x11')]);return _0x409bfc(_0x2c4cd7[_0x3475('0xf')]['message']);}else{logger[_0x3475('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x820cbe,'request\x20sent');_0x409bfc(_0x2c4cd7[_0x3475('0x12')][_0x3475('0x11')]);}})[_0x3475('0x13')](function(_0x1e0c0a){logger[_0x3475('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x820cbe,_0x1e0c0a);_0x1d021b(_0x1e0c0a);});});} \ No newline at end of file +var _0xbc41=['then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbc41,0x129));var _0x1bc4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc41[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1bc4('0x0'));var util=require(_0x1bc4('0x1'));var moment=require(_0x1bc4('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bc4('0x3'));var fs=require('fs');var Redis=require(_0x1bc4('0x4'));var db=require(_0x1bc4('0x5'))['db'];var utils=require(_0x1bc4('0x6'));var logger=require(_0x1bc4('0x7'))('rpc');var config=require(_0x1bc4('0x8'));var jayson=require(_0x1bc4('0x9'));var client=jayson['client'][_0x1bc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17545d,_0x388043,_0x4b2290){return new BPromise(function(_0xf76e64,_0x4209af){return client['request'](_0x17545d,_0x4b2290)[_0x1bc4('0xb')](function(_0xccc513){logger[_0x1bc4('0xc')](_0x1bc4('0xd'),_0x388043,_0x1bc4('0xe'));logger[_0x1bc4('0xf')](_0x1bc4('0x10'),_0x388043,'request\x20sent',JSON[_0x1bc4('0x11')](_0xccc513));if(_0xccc513['error']){if(_0xccc513[_0x1bc4('0x12')][_0x1bc4('0x13')]===0x1f4){logger[_0x1bc4('0x12')](_0x1bc4('0xd'),_0x388043,_0xccc513[_0x1bc4('0x12')]['message']);return _0x4209af(_0xccc513[_0x1bc4('0x12')][_0x1bc4('0x14')]);}logger[_0x1bc4('0x12')](_0x1bc4('0xd'),_0x388043,_0xccc513[_0x1bc4('0x12')][_0x1bc4('0x14')]);return _0xf76e64(_0xccc513[_0x1bc4('0x12')]['message']);}else{logger['info'](_0x1bc4('0xd'),_0x388043,_0x1bc4('0xe'));_0xf76e64(_0xccc513[_0x1bc4('0x15')][_0x1bc4('0x14')]);}})['catch'](function(_0x1afbec){logger[_0x1bc4('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x388043,_0x1afbec);_0x4209af(_0x1afbec);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 7e80dd4..ce3638b 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 _0x5790=['../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','/:id/query','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5790,0xa1));var _0x0579=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5790[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x0579('0x0'));var util=require('util');var path=require(_0x0579('0x1'));var timeout=require(_0x0579('0x2'));var express=require(_0x0579('0x3'));var router=express[_0x0579('0x4')]();var fs_extra=require(_0x0579('0x5'));var auth=require(_0x0579('0x6'));var interaction=require(_0x0579('0x7'));var config=require(_0x0579('0x8'));var controller=require(_0x0579('0x9'));router[_0x0579('0xa')]('/',auth[_0x0579('0xb')](),controller[_0x0579('0xc')]);router[_0x0579('0xa')](_0x0579('0xd'),auth[_0x0579('0xb')](),controller[_0x0579('0xe')]);router[_0x0579('0xa')](_0x0579('0xf'),auth[_0x0579('0xb')](),controller['preview']);router['get'](_0x0579('0x10'),auth[_0x0579('0xb')](),controller['run']);router[_0x0579('0xa')](_0x0579('0x11'),auth['isAuthenticated'](),controller['query']);router[_0x0579('0x12')]('/',auth[_0x0579('0xb')](),controller[_0x0579('0x13')]);router[_0x0579('0x14')](_0x0579('0xd'),auth[_0x0579('0xb')](),controller['update']);router[_0x0579('0x15')](_0x0579('0xd'),auth[_0x0579('0xb')](),controller[_0x0579('0x16')]);module[_0x0579('0x17')]=router; \ No newline at end of file +var _0x4b38=['delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','index','/:id','show','preview','/:id/run','isAuthenticated','/:id/query','query','update'];(function(_0x2c288a,_0x5bec79){var _0x1ec358=function(_0x2c3f43){while(--_0x2c3f43){_0x2c288a['push'](_0x2c288a['shift']());}};_0x1ec358(++_0x5bec79);}(_0x4b38,0x157));var _0x84b3=function(_0x19ab7c,_0xea4711){_0x19ab7c=_0x19ab7c-0x0;var _0x56492a=_0x4b38[_0x19ab7c];return _0x56492a;};'use strict';var multer=require(_0x84b3('0x0'));var util=require('util');var path=require(_0x84b3('0x1'));var timeout=require('connect-timeout');var express=require(_0x84b3('0x2'));var router=express[_0x84b3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x84b3('0x4'));var interaction=require(_0x84b3('0x5'));var config=require('../../config/environment');var controller=require(_0x84b3('0x6'));router[_0x84b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x84b3('0x8')]);router['get'](_0x84b3('0x9'),auth['isAuthenticated'](),controller[_0x84b3('0xa')]);router[_0x84b3('0x7')]('/:id/preview',auth['isAuthenticated'](),controller[_0x84b3('0xb')]);router[_0x84b3('0x7')](_0x84b3('0xc'),auth[_0x84b3('0xd')](),controller['run']);router[_0x84b3('0x7')](_0x84b3('0xe'),auth[_0x84b3('0xd')](),controller[_0x84b3('0xf')]);router['post']('/',auth[_0x84b3('0xd')](),controller['create']);router['put'](_0x84b3('0x9'),auth[_0x84b3('0xd')](),controller[_0x84b3('0x10')]);router[_0x84b3('0x11')](_0x84b3('0x9'),auth[_0x84b3('0xd')](),controller[_0x84b3('0x12')]);module[_0x84b3('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index ff04620..0edfa65 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 _0x5a49=['sequelize','STRING','TEXT'];(function(_0x50771b,_0x2bcea9){var _0x10071b=function(_0x3ca6a5){while(--_0x3ca6a5){_0x50771b['push'](_0x50771b['shift']());}};_0x10071b(++_0x2bcea9);}(_0x5a49,0x18f));var _0x95a4=function(_0x21987e,_0x24e684){_0x21987e=_0x21987e-0x0;var _0x4535e9=_0x5a49[_0x21987e];return _0x4535e9;};'use strict';var Sequelize=require(_0x95a4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x95a4('0x1')]},'parent':{'type':Sequelize[_0x95a4('0x1')]},'table':{'type':Sequelize[_0x95a4('0x1')]},'conditions':{'type':Sequelize[_0x95a4('0x2')]},'joins':{'type':Sequelize[_0x95a4('0x2')]}}; \ No newline at end of file +var _0x6168=['STRING','TEXT','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6168,0x1ea));var _0x8616=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x6168[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0x8616('0x0'));module[_0x8616('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8616('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8616('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index dff12dd..e15fc1c 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 _0xcb7b=['nolimit','order','sort','filters','filter','where','VIRTUAL','options','include','rows','catch','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','MAX(%s)','MIN(%s)','DATE(%s)','operator','condition','Sequelize','output','web','fullPath','randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','QueryTypes','SELECT','run','runReport','GROUP_CONCAT(%s)','ValidationErrorItem','select','eml-format','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','send','render','merge','contact','message','interaction','account','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','intersection','fields','length','attributes','hasOwnProperty'];(function(_0x2bf966,_0xbbf9bf){var _0x3bf11f=function(_0x22c90a){while(--_0x22c90a){_0x2bf966['push'](_0x2bf966['shift']());}};_0x3bf11f(++_0xbbf9bf);}(_0xcb7b,0x119));var _0xbcb7=function(_0x1087ca,_0x170952){_0x1087ca=_0x1087ca-0x0;var _0x4887b5=_0xcb7b[_0x1087ca];return _0x4887b5;};'use strict';var emlformat=require(_0xbcb7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbcb7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbcb7('0x2'));var util=require(_0xbcb7('0x3'));var path=require(_0xbcb7('0x4'));var sox=require(_0xbcb7('0x5'));var csv=require(_0xbcb7('0x6'));var ejs=require(_0xbcb7('0x7'));var fs=require('fs');var fs_extra=require(_0xbcb7('0x8'));var _=require(_0xbcb7('0x9'));var squel=require(_0xbcb7('0xa'));var crypto=require('crypto');var jsforce=require(_0xbcb7('0xb'));var deskjs=require(_0xbcb7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbcb7('0xd'));var Papa=require(_0xbcb7('0xe'));var Redis=require(_0xbcb7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbcb7('0x10'));var as=require(_0xbcb7('0x11'));var hardwareService=require(_0xbcb7('0x12'));var logger=require(_0xbcb7('0x13'))('api');var utils=require(_0xbcb7('0x14'));var config=require(_0xbcb7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbcb7('0x16'))['db'];var dbH=require(_0xbcb7('0x16'))['dbH'];function respondWithStatusCode(_0x30cab3,_0x19c7b5){_0x19c7b5=_0x19c7b5||0xcc;return function(_0x26f7ee){if(_0x26f7ee){return _0x30cab3[_0xbcb7('0x17')](_0x19c7b5);}return _0x30cab3[_0xbcb7('0x18')](_0x19c7b5)[_0xbcb7('0x19')]();};}function respondWithResult(_0x483a0d,_0x492ecb){_0x492ecb=_0x492ecb||0xc8;return function(_0x1c6981){if(_0x1c6981){return _0x483a0d[_0xbcb7('0x18')](_0x492ecb)[_0xbcb7('0x1a')](_0x1c6981);}};}function respondWithFilteredResult(_0x3f3e10,_0x51c93e){return function(_0x509504){if(_0x509504){var _0x7eb71d=typeof _0x51c93e[_0xbcb7('0x1b')]===_0xbcb7('0x1c')&&typeof _0x51c93e['limit']===_0xbcb7('0x1c');var _0x2008aa=_0x509504['count'];var _0x13fb5a=_0x7eb71d?0x0:_0x51c93e[_0xbcb7('0x1b')];var _0xe7d4b2=_0x7eb71d?_0x509504[_0xbcb7('0x1d')]:_0x51c93e['offset']+_0x51c93e[_0xbcb7('0x1e')];var _0x31325c;if(_0xe7d4b2>=_0x2008aa){_0xe7d4b2=_0x2008aa;_0x31325c=0xc8;}else{_0x31325c=0xce;}_0x3f3e10[_0xbcb7('0x18')](_0x31325c);return _0x3f3e10[_0xbcb7('0x1f')](_0xbcb7('0x20'),_0x13fb5a+'-'+_0xe7d4b2+'/'+_0x2008aa)[_0xbcb7('0x1a')](_0x509504);}return null;};}function patchUpdates(_0x53a20c){return function(_0x47a305){try{jsonpatch[_0xbcb7('0x21')](_0x47a305,_0x53a20c,!![]);}catch(_0x551fbf){return BPromise['reject'](_0x551fbf);}return _0x47a305[_0xbcb7('0x22')]();};}function saveUpdates(_0x5af0a7,_0x16d9b9){return function(_0x21a0b9){if(_0x21a0b9){return _0x21a0b9[_0xbcb7('0x23')](_0x5af0a7)[_0xbcb7('0x24')](function(_0x52c101){return _0x52c101;});}return null;};}function removeEntity(_0x2e69ac,_0x46d8f1){return function(_0x1a7a2b){if(_0x1a7a2b){return _0x1a7a2b[_0xbcb7('0x25')]()[_0xbcb7('0x24')](function(){var _0x2f1ced=_0x1a7a2b[_0xbcb7('0x26')]({'plain':!![]});var _0x31f352=_0xbcb7('0x27');return db[_0xbcb7('0x28')]['destroy']({'where':{'type':_0x31f352,'resourceId':_0x2f1ced['id']}})['then'](function(){return _0x1a7a2b;});})['then'](function(){_0x2e69ac[_0xbcb7('0x18')](0xcc)[_0xbcb7('0x19')]();});}};}function handleEntityNotFound(_0x5b40b5,_0x575ddf){return function(_0x24dd96){if(!_0x24dd96){_0x5b40b5['sendStatus'](0x194);}return _0x24dd96;};}function handleError(_0x5da60b,_0x4bba00){_0x4bba00=_0x4bba00||0x1f4;return function(_0x9fd152){logger['error'](_0x9fd152['stack']);if(_0x9fd152[_0xbcb7('0x29')]){delete _0x9fd152[_0xbcb7('0x29')];}_0x5da60b[_0xbcb7('0x18')](_0x4bba00)[_0xbcb7('0x2a')](_0x9fd152);};}function getMustacheRender(_0x502ff1,_0x2d2a7b){return Mustache[_0xbcb7('0x2b')](_0x502ff1,_[_0xbcb7('0x2c')](_0x2d2a7b['body'],{'contact':_0x2d2a7b[_0xbcb7('0x2d')],'message':_0x2d2a7b[_0xbcb7('0x2e')],'agent':_0x2d2a7b['agent'],'interaction':_0x2d2a7b[_0xbcb7('0x2f')],'account':_0x2d2a7b[_0xbcb7('0x30')]}))||'';}exports[_0xbcb7('0x31')]=function(_0x283c99,_0x4c89d4){var _0x5965fd={},_0x1d482a={},_0x173788={'count':0x0,'rows':[]};var _0x19e074=_[_0xbcb7('0x32')](db[_0xbcb7('0x33')][_0xbcb7('0x34')],function(_0x18851c){return{'name':_0x18851c[_0xbcb7('0x35')],'type':_0x18851c[_0xbcb7('0x36')]['key']};});_0x1d482a[_0xbcb7('0x37')]=_[_0xbcb7('0x32')](_0x19e074,'name');_0x1d482a[_0xbcb7('0x38')]=_[_0xbcb7('0x39')](_0x283c99[_0xbcb7('0x38')]);_0x1d482a['filters']=_['intersection'](_0x1d482a[_0xbcb7('0x37')],_0x1d482a[_0xbcb7('0x38')]);_0x5965fd['attributes']=_[_0xbcb7('0x3a')](_0x1d482a['model'],qs[_0xbcb7('0x3b')](_0x283c99[_0xbcb7('0x38')][_0xbcb7('0x3b')]));_0x5965fd['attributes']=_0x5965fd['attributes'][_0xbcb7('0x3c')]?_0x5965fd[_0xbcb7('0x3d')]:_0x1d482a[_0xbcb7('0x37')];if(!_0x283c99[_0xbcb7('0x38')][_0xbcb7('0x3e')](_0xbcb7('0x3f'))){_0x5965fd[_0xbcb7('0x1e')]=qs[_0xbcb7('0x1e')](_0x283c99[_0xbcb7('0x38')][_0xbcb7('0x1e')]);_0x5965fd[_0xbcb7('0x1b')]=qs[_0xbcb7('0x1b')](_0x283c99[_0xbcb7('0x38')][_0xbcb7('0x1b')]);}_0x5965fd[_0xbcb7('0x40')]=qs[_0xbcb7('0x41')](_0x283c99[_0xbcb7('0x38')]['sort']);_0x5965fd['where']=qs[_0xbcb7('0x42')](_['pick'](_0x283c99[_0xbcb7('0x38')],_0x1d482a[_0xbcb7('0x42')]),_0x19e074);if(_0x283c99[_0xbcb7('0x38')][_0xbcb7('0x43')]){_0x5965fd[_0xbcb7('0x44')]=_['merge'](_0x5965fd[_0xbcb7('0x44')],{'$or':_['map'](_0x19e074,function(_0x246251){if(_0x246251['type']!==_0xbcb7('0x45')){var _0x58504b={};_0x58504b[_0x246251['name']]={'$like':'%'+_0x283c99[_0xbcb7('0x38')][_0xbcb7('0x43')]+'%'};return _0x58504b;}})});}_0x5965fd=_['merge']({},_0x5965fd,_0x283c99[_0xbcb7('0x46')]);var _0x291471={'where':_0x5965fd[_0xbcb7('0x44')]};return db[_0xbcb7('0x33')][_0xbcb7('0x1d')](_0x291471)[_0xbcb7('0x24')](function(_0x5720a3){_0x173788[_0xbcb7('0x1d')]=_0x5720a3;if(_0x283c99[_0xbcb7('0x38')]['includeAll']){_0x5965fd[_0xbcb7('0x47')]=[{'all':!![]}];}return db[_0xbcb7('0x33')]['findAll'](_0x5965fd);})[_0xbcb7('0x24')](function(_0x470bd7){_0x173788[_0xbcb7('0x48')]=_0x470bd7;return _0x173788;})[_0xbcb7('0x24')](respondWithFilteredResult(_0x4c89d4,_0x5965fd))[_0xbcb7('0x49')](handleError(_0x4c89d4,null));};exports['show']=function(_0x311121,_0x3781b3){var _0x3b2a6a={'raw':!![],'where':{'id':_0x311121['params']['id']}},_0x8d966={};_0x8d966[_0xbcb7('0x37')]=_['keys'](db[_0xbcb7('0x33')][_0xbcb7('0x34')]);_0x8d966['query']=_[_0xbcb7('0x39')](_0x311121['query']);_0x8d966[_0xbcb7('0x42')]=_[_0xbcb7('0x3a')](_0x8d966[_0xbcb7('0x37')],_0x8d966['query']);_0x3b2a6a['attributes']=_[_0xbcb7('0x3a')](_0x8d966[_0xbcb7('0x37')],qs['fields'](_0x311121[_0xbcb7('0x38')][_0xbcb7('0x3b')]));_0x3b2a6a['attributes']=_0x3b2a6a[_0xbcb7('0x3d')][_0xbcb7('0x3c')]?_0x3b2a6a[_0xbcb7('0x3d')]:_0x8d966[_0xbcb7('0x37')];if(_0x311121[_0xbcb7('0x38')][_0xbcb7('0x4a')]){_0x3b2a6a[_0xbcb7('0x47')]=[{'all':!![]}];}_0x3b2a6a=_['merge']({},_0x3b2a6a,_0x311121[_0xbcb7('0x46')]);return db['AnalyticDefaultReport'][_0xbcb7('0x4b')](_0x3b2a6a)[_0xbcb7('0x24')](handleEntityNotFound(_0x3781b3,null))[_0xbcb7('0x24')](respondWithResult(_0x3781b3,null))['catch'](handleError(_0x3781b3,null));};exports[_0xbcb7('0x4c')]=function(_0xc68bba,_0x5636f2){return db[_0xbcb7('0x33')][_0xbcb7('0x4c')](_0xc68bba['body'],{})[_0xbcb7('0x24')](function(_0x9d640f){var _0x1b7bbd=_0xc68bba[_0xbcb7('0x4d')][_0xbcb7('0x26')]({'plain':!![]});if(!_0x1b7bbd)throw new Error(_0xbcb7('0x4e'));if(_0x1b7bbd[_0xbcb7('0x4f')]==='user'){var _0x37237b=_0x9d640f[_0xbcb7('0x26')]({'plain':!![]});var _0x253187=_0xbcb7('0x50');return db[_0xbcb7('0x51')]['find']({'where':{'name':_0x253187,'userProfileId':_0x1b7bbd[_0xbcb7('0x52')]},'raw':!![]})[_0xbcb7('0x24')](function(_0x3f337e){if(_0x3f337e&&_0x3f337e[_0xbcb7('0x53')]===0x0){return db['UserProfileResource'][_0xbcb7('0x4c')]({'name':_0x37237b[_0xbcb7('0x29')],'resourceId':_0x37237b['id'],'type':_0xbcb7('0x27'),'sectionId':_0x3f337e['id']},{})['then'](function(){return _0x9d640f;});}else{return _0x9d640f;}})[_0xbcb7('0x49')](function(_0x28c726){logger[_0xbcb7('0x54')](_0xbcb7('0x55'),_0x28c726);throw _0x28c726;});}return _0x9d640f;})[_0xbcb7('0x24')](respondWithResult(_0x5636f2,0xc9))[_0xbcb7('0x49')](handleError(_0x5636f2,null));};exports['update']=function(_0x2e7895,_0x522a62){if(_0x2e7895['body']['id']){delete _0x2e7895['body']['id'];}return db[_0xbcb7('0x33')][_0xbcb7('0x4b')]({'where':{'id':_0x2e7895['params']['id']}})[_0xbcb7('0x24')](handleEntityNotFound(_0x522a62,null))['then'](saveUpdates(_0x2e7895[_0xbcb7('0x56')],null))[_0xbcb7('0x24')](respondWithResult(_0x522a62,null))[_0xbcb7('0x49')](handleError(_0x522a62,null));};exports[_0xbcb7('0x25')]=function(_0x3bfdb1,_0x435c31){return db[_0xbcb7('0x33')]['find']({'where':{'id':_0x3bfdb1[_0xbcb7('0x57')]['id']}})[_0xbcb7('0x24')](handleEntityNotFound(_0x435c31,null))['then'](removeEntity(_0x435c31,null))[_0xbcb7('0x49')](handleError(_0x435c31,null));};exports[_0xbcb7('0x58')]=function(_0x3adf98,_0x1ec83e){var _0x3775f5=0xa;var _0x1355f4=[_0xbcb7('0x59'),_0xbcb7('0x5a'),_0xbcb7('0x5b'),_0xbcb7('0x5c')];var _0x159e96={'SUM':_0xbcb7('0x5d'),'COUNT':_0xbcb7('0x5e'),'COUNT DISTINCT':_0xbcb7('0x5f'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xbcb7('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbcb7('0x61'),'GROUP_CONCAT DESC':_0xbcb7('0x62')};var _0x7eda18={'SEC_TO_TIME':_0xbcb7('0x63'),'DATE':'DATE(%s)','HOUR':_0xbcb7('0x64'),'ROUND':_0xbcb7('0x65'),'UNIX_TIMESTAMP':_0xbcb7('0x66')};var _0x2ea261=function(_0x120c97){return!_[_0xbcb7('0x67')]([_0xbcb7('0x68'),_0xbcb7('0x69'),_0xbcb7('0x6a'),_0xbcb7('0x6b')],_0x120c97);};var _0x155949=function(_0xf576dd){if(!_0xf576dd||!_0xf576dd['rules'][_0xbcb7('0x3c')]){return'';}for(var _0x341840='(',_0x586d1b=0x0;_0x586d1b<_0xf576dd[_0xbcb7('0x6c')]['length'];_0x586d1b+=0x1){_0x586d1b>0x0&&(_0x341840+='\x20'+_0xf576dd['operator']+'\x20');_0x341840+=_0xf576dd['rules'][_0x586d1b][_0xbcb7('0x6d')]?_0x155949(_0xf576dd['rules'][_0x586d1b][_0xbcb7('0x6d')]):_0xf576dd[_0xbcb7('0x6c')][_0x586d1b]['field']+'\x20'+_0xf576dd[_0xbcb7('0x6c')][_0x586d1b]['condition']+(_0x2ea261(_0xf576dd['rules'][_0x586d1b]['condition'])?'\x20'+_0xf576dd[_0xbcb7('0x6c')][_0x586d1b][_0xbcb7('0x6e')]:'');}return _0x341840+')';};var _0x47c12d={'where':{'id':_0x3adf98[_0xbcb7('0x57')]['id']}},_0x3b84d0,_0x21e834,_0x4740f2,_0x3774e1,_0x425ac2;_0x47c12d=_['merge']({},_0x47c12d,_0x3adf98[_0xbcb7('0x46')]);return db[_0xbcb7('0x33')][_0xbcb7('0x4b')](_0x47c12d)['then'](function(_0x560328){if(_0x560328){_0x3b84d0=_0x560328;return _0x560328[_0xbcb7('0x6f')]();}return null;})[_0xbcb7('0x24')](function(_0x5376f1){if(_0x5376f1){if(!_0x5376f1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xbcb7('0x70'),0x193);}_0x21e834=_0x5376f1;return db[_0xbcb7('0x71')][_0xbcb7('0x72')]({'raw':!![]});}return null;})[_0xbcb7('0x24')](function(_0x3aac9f){if(_0x3aac9f){_0x4740f2=_[_0xbcb7('0x73')](_0x3aac9f,'id');var _0x4bfcac;var _0x2f3e13=squel['select']();_0x2f3e13[_0xbcb7('0x74')](_0x3b84d0['table']);for(var _0x1e49c4=0x0;_0x1e49c4<_0x21e834[_0xbcb7('0x3c')];_0x1e49c4+=0x1){_0x4bfcac=_0x21e834[_0x1e49c4]['MetricId']?_0x4740f2[_0x21e834[_0x1e49c4][_0xbcb7('0x75')]][_0xbcb7('0x76')]:_0x21e834[_0x1e49c4][_0xbcb7('0x77')];_0x4bfcac=_0x21e834[_0x1e49c4][_0xbcb7('0x78')]?_[_0xbcb7('0x79')](_0x159e96[_0x21e834[_0x1e49c4]['function']],'%s',_0x4bfcac):_0x4bfcac;_0x4bfcac=_0x21e834[_0x1e49c4][_0xbcb7('0x7a')]?_[_0xbcb7('0x79')](_0x7eda18[_0x21e834[_0x1e49c4]['format']],'%s',_0x4bfcac):_0x4bfcac;if(_0x21e834[_0x1e49c4][_0xbcb7('0x7b')]){_0x2f3e13[_0xbcb7('0x6d')](_0x4bfcac);}_0x21e834[_0x1e49c4][_0xbcb7('0x7c')]&&_0x2f3e13['order'](_0x4bfcac,_0x21e834[_0x1e49c4][_0xbcb7('0x7c')]===_0xbcb7('0x7d')?![]:!![]);_0x2f3e13['field'](_0x4bfcac,_0x21e834[_0x1e49c4][_0xbcb7('0x7e')]||_0x4bfcac);}if(_0x3b84d0[_0xbcb7('0x7f')]){_0x3b84d0['joins']=JSON[_0xbcb7('0x80')](_0x3b84d0[_0xbcb7('0x7f')]);for(var _0x4a95e6=0x0;_0x4a95e6<_0x3b84d0[_0xbcb7('0x7f')][_0xbcb7('0x3c')];_0x4a95e6+=0x1){if(_0x3b84d0[_0xbcb7('0x7f')][_0x4a95e6][_0xbcb7('0x36')]&&_[_0xbcb7('0x67')](_0x1355f4,_0x3b84d0[_0xbcb7('0x7f')][_0x4a95e6][_0xbcb7('0x36')])&&_0x3b84d0[_0xbcb7('0x7f')][_0x4a95e6][_0xbcb7('0x81')]&&_0x3b84d0[_0xbcb7('0x7f')][_0x4a95e6][_0xbcb7('0x82')]&&_0x3b84d0[_0xbcb7('0x7f')][_0x4a95e6][_0xbcb7('0x83')]){_0x2f3e13[_0x3b84d0[_0xbcb7('0x7f')][_0x4a95e6][_0xbcb7('0x36')]](_0x3b84d0['joins'][_0x4a95e6][_0xbcb7('0x82')],null,util['format'](_0xbcb7('0x84'),_0x3b84d0[_0xbcb7('0x85')],_0x3b84d0[_0xbcb7('0x7f')][_0x4a95e6][_0xbcb7('0x81')],_0x3b84d0['joins'][_0x4a95e6][_0xbcb7('0x82')],_0x3b84d0[_0xbcb7('0x7f')][_0x4a95e6][_0xbcb7('0x83')]));}}}if(_0x3b84d0['conditions']){_0x3b84d0['conditions']=JSON[_0xbcb7('0x80')](_0x3b84d0[_0xbcb7('0x86')]);_0x2f3e13['where'](_0x155949(_0x3b84d0['conditions'][_0xbcb7('0x6d')]));}_0x425ac2=_0x2f3e13[_0xbcb7('0x87')]();_0x2f3e13['limit'](_0x3775f5);_0x2f3e13['offset'](0x0);logger[_0xbcb7('0x88')](_0xbcb7('0x89'),_0x2f3e13[_0xbcb7('0x8a')]());return dbH['sequelize'][_0xbcb7('0x38')](_0x2f3e13[_0xbcb7('0x8a')](),{'type':dbH[_0xbcb7('0x8b')]['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0x1ec83e,null))[_0xbcb7('0x49')](handleError(_0x1ec83e,null));};function runReport(_0x157d9b,_0x409c13,_0x4ee778){var _0x635e7e=_0x409c13[_0xbcb7('0x29')];var _0x2947cd=0xa;var _0x5f3786=['join','left_join',_0xbcb7('0x5b'),_0xbcb7('0x5c')];var _0x4fa18e={'SUM':_0xbcb7('0x5d'),'COUNT':_0xbcb7('0x5e'),'COUNT DISTINCT':_0xbcb7('0x5f'),'MAX':_0xbcb7('0x8c'),'MIN':_0xbcb7('0x8d'),'AVG':_0xbcb7('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbcb7('0x61'),'GROUP_CONCAT DESC':_0xbcb7('0x62')};var _0xac6514={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xbcb7('0x8e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbcb7('0x66')};var _0x253171=function(_0x4f10b3){return!_['includes']([_0xbcb7('0x68'),_0xbcb7('0x69'),_0xbcb7('0x6a'),_0xbcb7('0x6b')],_0x4f10b3);};var _0x53f3ab=function(_0x144ce9){if(!_0x144ce9||!_0x144ce9[_0xbcb7('0x6c')][_0xbcb7('0x3c')]){return'';}for(var _0x447687='(',_0x2bf32c=0x0;_0x2bf32c<_0x144ce9[_0xbcb7('0x6c')][_0xbcb7('0x3c')];_0x2bf32c+=0x1){_0x2bf32c>0x0&&(_0x447687+='\x20'+_0x144ce9[_0xbcb7('0x8f')]+'\x20');_0x447687+=_0x144ce9[_0xbcb7('0x6c')][_0x2bf32c][_0xbcb7('0x6d')]?_0x53f3ab(_0x144ce9[_0xbcb7('0x6c')][_0x2bf32c][_0xbcb7('0x6d')]):_0x144ce9[_0xbcb7('0x6c')][_0x2bf32c][_0xbcb7('0x77')]+'\x20'+_0x144ce9[_0xbcb7('0x6c')][_0x2bf32c][_0xbcb7('0x90')]+(_0x253171(_0x144ce9['rules'][_0x2bf32c]['condition'])?'\x20'+_0x144ce9['rules'][_0x2bf32c][_0xbcb7('0x6e')]:'');}return _0x447687+')';};var _0x2578dd={'where':{'id':_0x157d9b['id']}},_0x5c2a45,_0x10e5cb,_0x1f4543,_0x5559ba,_0x1d28fe;_0x2578dd=_[_0xbcb7('0x2c')]({},_0x2578dd,_0x4ee778);return db['AnalyticDefaultReport'][_0xbcb7('0x4b')](_0x2578dd)['then'](function(_0x11fc6b){if(_0x11fc6b){_0x5c2a45=_0x11fc6b;return _0x11fc6b[_0xbcb7('0x6f')]();}return null;})[_0xbcb7('0x24')](function(_0x40f156){if(_0x40f156){if(!_0x40f156['length']){throw new db[(_0xbcb7('0x91'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10e5cb=_0x40f156;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xbcb7('0x24')](function(_0x2aa4c0){if(_0x2aa4c0){_0x1f4543=_[_0xbcb7('0x73')](_0x2aa4c0,'id');var _0x404475;var _0x277833=squel['select']();_0x277833[_0xbcb7('0x74')](_0x5c2a45[_0xbcb7('0x85')]);for(var _0x2d91ef=0x0;_0x2d91ef<_0x10e5cb['length'];_0x2d91ef+=0x1){_0x404475=_0x10e5cb[_0x2d91ef][_0xbcb7('0x75')]?_0x1f4543[_0x10e5cb[_0x2d91ef]['MetricId']][_0xbcb7('0x76')]:_0x10e5cb[_0x2d91ef][_0xbcb7('0x77')];_0x404475=_0x10e5cb[_0x2d91ef][_0xbcb7('0x78')]?_[_0xbcb7('0x79')](_0x4fa18e[_0x10e5cb[_0x2d91ef][_0xbcb7('0x78')]],'%s',_0x404475):_0x404475;_0x404475=_0x10e5cb[_0x2d91ef][_0xbcb7('0x7a')]?_[_0xbcb7('0x79')](_0xac6514[_0x10e5cb[_0x2d91ef]['format']],'%s',_0x404475):_0x404475;if(_0x10e5cb[_0x2d91ef][_0xbcb7('0x7b')]){_0x277833[_0xbcb7('0x6d')](_0x404475);}_0x10e5cb[_0x2d91ef][_0xbcb7('0x7c')]&&_0x277833['order'](_0x404475,_0x10e5cb[_0x2d91ef][_0xbcb7('0x7c')]==='DESC'?![]:!![]);_0x277833[_0xbcb7('0x77')](_0x404475,_0x10e5cb[_0x2d91ef][_0xbcb7('0x7e')]||_0x404475);}if(_0x5c2a45[_0xbcb7('0x7f')]){_0x5c2a45[_0xbcb7('0x7f')]=JSON[_0xbcb7('0x80')](_0x5c2a45[_0xbcb7('0x7f')]);for(var _0x50ffdc=0x0;_0x50ffdc<_0x5c2a45[_0xbcb7('0x7f')][_0xbcb7('0x3c')];_0x50ffdc+=0x1){if(_0x5c2a45[_0xbcb7('0x7f')][_0x50ffdc][_0xbcb7('0x36')]&&_['includes'](_0x5f3786,_0x5c2a45[_0xbcb7('0x7f')][_0x50ffdc][_0xbcb7('0x36')])&&_0x5c2a45[_0xbcb7('0x7f')][_0x50ffdc]['parentKey']&&_0x5c2a45['joins'][_0x50ffdc][_0xbcb7('0x82')]&&_0x5c2a45[_0xbcb7('0x7f')][_0x50ffdc][_0xbcb7('0x83')]){_0x277833[_0x5c2a45[_0xbcb7('0x7f')][_0x50ffdc][_0xbcb7('0x36')]](_0x5c2a45[_0xbcb7('0x7f')][_0x50ffdc][_0xbcb7('0x82')],null,util['format'](_0xbcb7('0x84'),_0x5c2a45['table'],_0x5c2a45[_0xbcb7('0x7f')][_0x50ffdc]['parentKey'],_0x5c2a45[_0xbcb7('0x7f')][_0x50ffdc][_0xbcb7('0x82')],_0x5c2a45['joins'][_0x50ffdc]['foreignKey']));}}}if(_0x5c2a45['conditions']){_0x5c2a45[_0xbcb7('0x86')]=JSON['parse'](_0x5c2a45[_0xbcb7('0x86')]);_0x277833['where'](_0x53f3ab(_0x5c2a45[_0xbcb7('0x86')][_0xbcb7('0x6d')]));}_0x1d28fe=_0x277833[_0xbcb7('0x87')]();_0x277833[_0xbcb7('0x1e')](_0x2947cd);_0x277833[_0xbcb7('0x1b')](0x0);return;}})['then'](function(){if(_0x409c13[_0xbcb7('0x92')]===_0xbcb7('0x93')){return null;}var _0x25ee1d=_['merge'](_0x409c13,{'name':_0x409c13[_0xbcb7('0x94')]||_0x409c13['name']||_0x5c2a45[_0xbcb7('0x29')],'basename':_0x635e7e,'savename':util[_0xbcb7('0x7a')]('%s-%s.%s',_0x409c13[_0xbcb7('0x29')]||_0x5c2a45[_0xbcb7('0x29')],require(_0xbcb7('0x95'))['generate'](0x4),_0x409c13[_0xbcb7('0x92')]||_0xbcb7('0x96')),'reportId':_0x5c2a45['id'],'reportType':_0xbcb7('0x97')});return db[_0xbcb7('0x98')][_0xbcb7('0x4c')](_0x25ee1d,{'raw':!![]});})[_0xbcb7('0x24')](function(_0x277500){if(_0x5c2a45[_0xbcb7('0x85')]===_0xbcb7('0x99')){_0x1d28fe['where'](_0x5c2a45['table']+_0xbcb7('0x9a'),_0x409c13[_0xbcb7('0x9b')],_0x409c13[_0xbcb7('0x9c')]);}else{_0x1d28fe['where'](_0x5c2a45['table']+_0xbcb7('0x9d'),_0x409c13['startDate'],_0x409c13[_0xbcb7('0x9c')]);}if(_0x277500){logger[_0xbcb7('0x9e')](_0xbcb7('0x9f'),_0x1d28fe['toString']());require(_0xbcb7('0xa0'))[_0xbcb7('0xa1')](path['join'](__dirname,_0xbcb7('0xa2'),_0x277500['output']),[_0x277500['id'],_0x1d28fe['toString'](),path[_0xbcb7('0x59')](__dirname,_0xbcb7('0xa3'),_0x277500['savename']),_0x635e7e]);return _0x277500;}else{var _0x1a7f55=squel['select']();_0x1a7f55[_0xbcb7('0x74')]('('+_0x1d28fe['toString']()+')',_0xbcb7('0xa4'));_0x1a7f55[_0xbcb7('0x77')]('COUNT(*)',_0xbcb7('0x1d'));_0x1d28fe[_0xbcb7('0x1e')](_0x409c13['limit']||_0x2947cd);_0x1d28fe[_0xbcb7('0x1b')](_0x409c13[_0xbcb7('0x1b')]||0x0);return dbH[_0xbcb7('0x8b')][_0xbcb7('0x38')](_0x1a7f55[_0xbcb7('0x8a')](),{'type':dbH[_0xbcb7('0x8b')][_0xbcb7('0xa5')][_0xbcb7('0xa6')]})[_0xbcb7('0x24')](function(_0x5d34e1){if(!_0x5d34e1['length']){_0x5559ba=0x0;}else{_0x5559ba=_0x5d34e1[0x0]['count']||0x0;}return dbH[_0xbcb7('0x8b')][_0xbcb7('0x38')](_0x1d28fe['toString'](),{'type':dbH[_0xbcb7('0x8b')][_0xbcb7('0xa5')][_0xbcb7('0xa6')]});})['then'](function(_0x476fc7){return{'rows':_0x476fc7||[],'count':_0x5559ba};});}});}exports[_0xbcb7('0xa7')]=function(_0x369d47,_0xc2bf97){return runReport(_0x369d47['params'],_0x369d47[_0xbcb7('0x38')],_0x369d47[_0xbcb7('0x46')])[_0xbcb7('0x24')](respondWithResult(_0xc2bf97,null))[_0xbcb7('0x49')](handleError(_0xc2bf97,null));};exports[_0xbcb7('0xa8')]=runReport;exports['query']=function(_0x370b64,_0x345840){var _0x5a2630=0xa;var _0x365ee5=['join',_0xbcb7('0x5a'),_0xbcb7('0x5b'),_0xbcb7('0x5c')];var _0x5265ae={'SUM':'SUM(%s)','COUNT':_0xbcb7('0x5e'),'COUNT DISTINCT':_0xbcb7('0x5f'),'MAX':_0xbcb7('0x8c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xbcb7('0xa9'),'GROUP_CONCAT ASC':_0xbcb7('0x61'),'GROUP_CONCAT DESC':_0xbcb7('0x62')};var _0x2b4e3e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xbcb7('0x8e'),'HOUR':_0xbcb7('0x64'),'ROUND':_0xbcb7('0x65'),'UNIX_TIMESTAMP':_0xbcb7('0x66')};var _0x51df76=function(_0x348666){return!_[_0xbcb7('0x67')](['IS\x20NULL',_0xbcb7('0x69'),_0xbcb7('0x6a'),_0xbcb7('0x6b')],_0x348666);};var _0x1066fe=function(_0x3239e9){if(!_0x3239e9||!_0x3239e9[_0xbcb7('0x6c')][_0xbcb7('0x3c')]){return'';}for(var _0x4e347a='(',_0x568af1=0x0;_0x568af1<_0x3239e9[_0xbcb7('0x6c')][_0xbcb7('0x3c')];_0x568af1+=0x1){_0x568af1>0x0&&(_0x4e347a+='\x20'+_0x3239e9[_0xbcb7('0x8f')]+'\x20');_0x4e347a+=_0x3239e9[_0xbcb7('0x6c')][_0x568af1][_0xbcb7('0x6d')]?_0x1066fe(_0x3239e9['rules'][_0x568af1][_0xbcb7('0x6d')]):_0x3239e9['rules'][_0x568af1][_0xbcb7('0x77')]+'\x20'+_0x3239e9[_0xbcb7('0x6c')][_0x568af1][_0xbcb7('0x90')]+(_0x51df76(_0x3239e9[_0xbcb7('0x6c')][_0x568af1][_0xbcb7('0x90')])?'\x20'+_0x3239e9['rules'][_0x568af1][_0xbcb7('0x6e')]:'');}return _0x4e347a+')';};var _0x2112ba={'where':{'id':_0x370b64[_0xbcb7('0x57')]['id']}},_0x369160,_0x192016,_0x40e76d,_0x4e9af9,_0xb8b293;_0x2112ba=_[_0xbcb7('0x2c')]({},_0x2112ba,_0x370b64['options']);return db[_0xbcb7('0x33')]['find'](_0x2112ba)['then'](function(_0x5ac2fc){if(_0x5ac2fc){_0x369160=_0x5ac2fc;return _0x5ac2fc[_0xbcb7('0x6f')]();}return null;})[_0xbcb7('0x24')](function(_0x573003){if(_0x573003){if(!_0x573003[_0xbcb7('0x3c')]){throw new db['Sequelize'][(_0xbcb7('0xaa'))](_0xbcb7('0x70'),0x193);}_0x192016=_0x573003;return db[_0xbcb7('0x71')][_0xbcb7('0x72')]({'raw':!![]});}return null;})[_0xbcb7('0x24')](function(_0xe8e08b){if(_0xe8e08b){_0x40e76d=_[_0xbcb7('0x73')](_0xe8e08b,'id');var _0x267869;var _0x171271=squel[_0xbcb7('0xab')]();_0x171271[_0xbcb7('0x74')](_0x369160[_0xbcb7('0x85')]);for(var _0x3810b7=0x0;_0x3810b7<_0x192016[_0xbcb7('0x3c')];_0x3810b7+=0x1){_0x267869=_0x192016[_0x3810b7][_0xbcb7('0x75')]?_0x40e76d[_0x192016[_0x3810b7]['MetricId']][_0xbcb7('0x76')]:_0x192016[_0x3810b7][_0xbcb7('0x77')];_0x267869=_0x192016[_0x3810b7][_0xbcb7('0x78')]?_[_0xbcb7('0x79')](_0x5265ae[_0x192016[_0x3810b7][_0xbcb7('0x78')]],'%s',_0x267869):_0x267869;_0x267869=_0x192016[_0x3810b7][_0xbcb7('0x7a')]?_['replace'](_0x2b4e3e[_0x192016[_0x3810b7][_0xbcb7('0x7a')]],'%s',_0x267869):_0x267869;if(_0x192016[_0x3810b7]['groupBy']){_0x171271[_0xbcb7('0x6d')](_0x267869);}_0x192016[_0x3810b7][_0xbcb7('0x7c')]&&_0x171271[_0xbcb7('0x40')](_0x267869,_0x192016[_0x3810b7][_0xbcb7('0x7c')]===_0xbcb7('0x7d')?![]:!![]);_0x171271[_0xbcb7('0x77')](_0x267869,_0x192016[_0x3810b7][_0xbcb7('0x7e')]||_0x267869);}if(_0x369160['joins']){_0x369160['joins']=JSON[_0xbcb7('0x80')](_0x369160[_0xbcb7('0x7f')]);for(var _0x1a5397=0x0;_0x1a5397<_0x369160[_0xbcb7('0x7f')][_0xbcb7('0x3c')];_0x1a5397+=0x1){if(_0x369160['joins'][_0x1a5397][_0xbcb7('0x36')]&&_['includes'](_0x365ee5,_0x369160[_0xbcb7('0x7f')][_0x1a5397][_0xbcb7('0x36')])&&_0x369160[_0xbcb7('0x7f')][_0x1a5397][_0xbcb7('0x81')]&&_0x369160['joins'][_0x1a5397][_0xbcb7('0x82')]&&_0x369160[_0xbcb7('0x7f')][_0x1a5397][_0xbcb7('0x83')]){_0x171271[_0x369160['joins'][_0x1a5397][_0xbcb7('0x36')]](_0x369160['joins'][_0x1a5397][_0xbcb7('0x82')],null,util[_0xbcb7('0x7a')](_0xbcb7('0x84'),_0x369160[_0xbcb7('0x85')],_0x369160[_0xbcb7('0x7f')][_0x1a5397]['parentKey'],_0x369160[_0xbcb7('0x7f')][_0x1a5397]['foreignTable'],_0x369160['joins'][_0x1a5397][_0xbcb7('0x83')]));}}}if(_0x369160[_0xbcb7('0x86')]){_0x369160[_0xbcb7('0x86')]=JSON[_0xbcb7('0x80')](_0x369160[_0xbcb7('0x86')]);_0x171271['where'](_0x1066fe(_0x369160[_0xbcb7('0x86')]['group']));}_0xb8b293=_0x171271[_0xbcb7('0x87')]();_0x171271[_0xbcb7('0x1e')](_0x5a2630);_0x171271['offset'](0x0);logger[_0xbcb7('0x88')](_0xbcb7('0x89'),_0x171271['toString']());return dbH[_0xbcb7('0x8b')][_0xbcb7('0x38')](_0x171271['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xbcb7('0xa6')]});}})[_0xbcb7('0x24')](function(){return{'sql':_0xb8b293[_0xbcb7('0x8a')]()};})[_0xbcb7('0x24')](respondWithResult(_0x345840,null))[_0xbcb7('0x49')](handleError(_0x345840,null));}; \ No newline at end of file +var _0xdcba=['includeAll','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','error','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','select','from','table','metric','replace','function','format','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20EMPTY','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','MetricId','output','web','fullPath','%s-%s.%s','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','savename','countTable','COUNT(*)','run','HOUR(%s)','operator','AnalyticMetric','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','DefaultReports','UserProfileResource','destroy','end','stack','render','merge','body','message','agent','interaction','account','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','options','findAll','catch','show','params'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0xdcba,0x1a6));var _0xadcb=function(_0x54aff6,_0xc4c096){_0x54aff6=_0x54aff6-0x0;var _0x487a36=_0xdcba[_0x54aff6];return _0x487a36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xadcb('0x0'));var zipdir=require(_0xadcb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadcb('0x2'));var moment=require(_0xadcb('0x3'));var BPromise=require(_0xadcb('0x4'));var Mustache=require(_0xadcb('0x5'));var util=require('util');var path=require(_0xadcb('0x6'));var sox=require(_0xadcb('0x7'));var csv=require(_0xadcb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xadcb('0x9'));var _=require('lodash');var squel=require(_0xadcb('0xa'));var crypto=require(_0xadcb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xadcb('0xc'));var toCsv=require(_0xadcb('0x8'));var querystring=require(_0xadcb('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xadcb('0xe'));var qs=require(_0xadcb('0xf'));var as=require(_0xadcb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xadcb('0x11'))(_0xadcb('0x12'));var utils=require(_0xadcb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xadcb('0x14'));var db=require(_0xadcb('0x15'))['db'];var dbH=require(_0xadcb('0x15'))[_0xadcb('0x16')];function respondWithStatusCode(_0x3cef0b,_0x4dbbaa){_0x4dbbaa=_0x4dbbaa||0xcc;return function(_0x190ea2){if(_0x190ea2){return _0x3cef0b[_0xadcb('0x17')](_0x4dbbaa);}return _0x3cef0b['status'](_0x4dbbaa)['end']();};}function respondWithResult(_0x42c275,_0x1c401b){_0x1c401b=_0x1c401b||0xc8;return function(_0x38e155){if(_0x38e155){return _0x42c275[_0xadcb('0x18')](_0x1c401b)[_0xadcb('0x19')](_0x38e155);}};}function respondWithFilteredResult(_0x10a9f5,_0x45d521){return function(_0x1da726){if(_0x1da726){var _0x5399e2=typeof _0x45d521[_0xadcb('0x1a')]===_0xadcb('0x1b')&&typeof _0x45d521[_0xadcb('0x1c')]==='undefined';var _0x3f12b9=_0x1da726[_0xadcb('0x1d')];var _0x262d07=_0x5399e2?0x0:_0x45d521['offset'];var _0x57105d=_0x5399e2?_0x1da726[_0xadcb('0x1d')]:_0x45d521[_0xadcb('0x1a')]+_0x45d521[_0xadcb('0x1c')];var _0x4fd595;if(_0x57105d>=_0x3f12b9){_0x57105d=_0x3f12b9;_0x4fd595=0xc8;}else{_0x4fd595=0xce;}_0x10a9f5[_0xadcb('0x18')](_0x4fd595);return _0x10a9f5[_0xadcb('0x1e')](_0xadcb('0x1f'),_0x262d07+'-'+_0x57105d+'/'+_0x3f12b9)['json'](_0x1da726);}return null;};}function patchUpdates(_0x3d69fc){return function(_0x34262d){try{jsonpatch[_0xadcb('0x20')](_0x34262d,_0x3d69fc,!![]);}catch(_0x13b61f){return BPromise[_0xadcb('0x21')](_0x13b61f);}return _0x34262d[_0xadcb('0x22')]();};}function saveUpdates(_0x269c02,_0x358031){return function(_0x3347ad){if(_0x3347ad){return _0x3347ad[_0xadcb('0x23')](_0x269c02)[_0xadcb('0x24')](function(_0x5352b3){return _0x5352b3;});}return null;};}function removeEntity(_0x1e9bc2,_0x3e84cb){return function(_0x59c3ad){if(_0x59c3ad){return _0x59c3ad['destroy']()[_0xadcb('0x24')](function(){var _0x1e3c15=_0x59c3ad['get']({'plain':!![]});var _0x3d7f22=_0xadcb('0x25');return db[_0xadcb('0x26')][_0xadcb('0x27')]({'where':{'type':_0x3d7f22,'resourceId':_0x1e3c15['id']}})[_0xadcb('0x24')](function(){return _0x59c3ad;});})[_0xadcb('0x24')](function(){_0x1e9bc2['status'](0xcc)[_0xadcb('0x28')]();});}};}function handleEntityNotFound(_0x386319,_0x25cc17){return function(_0x6baa73){if(!_0x6baa73){_0x386319[_0xadcb('0x17')](0x194);}return _0x6baa73;};}function handleError(_0x6ef92,_0x28bb4e){_0x28bb4e=_0x28bb4e||0x1f4;return function(_0x57f141){logger['error'](_0x57f141[_0xadcb('0x29')]);if(_0x57f141['name']){delete _0x57f141['name'];}_0x6ef92[_0xadcb('0x18')](_0x28bb4e)['send'](_0x57f141);};}function getMustacheRender(_0x1ff5cd,_0x4ca65a){return Mustache[_0xadcb('0x2a')](_0x1ff5cd,_[_0xadcb('0x2b')](_0x4ca65a[_0xadcb('0x2c')],{'contact':_0x4ca65a['contact'],'message':_0x4ca65a[_0xadcb('0x2d')],'agent':_0x4ca65a[_0xadcb('0x2e')],'interaction':_0x4ca65a[_0xadcb('0x2f')],'account':_0x4ca65a[_0xadcb('0x30')]}))||'';}exports[_0xadcb('0x31')]=function(_0x50b7d6,_0x5cbf19){var _0x5852d5={},_0x434943={},_0x687b44={'count':0x0,'rows':[]};var _0x3c1fe5=_[_0xadcb('0x32')](db[_0xadcb('0x33')][_0xadcb('0x34')],function(_0x4345ce){return{'name':_0x4345ce[_0xadcb('0x35')],'type':_0x4345ce[_0xadcb('0x36')][_0xadcb('0x37')]};});_0x434943[_0xadcb('0x38')]=_[_0xadcb('0x32')](_0x3c1fe5,_0xadcb('0x39'));_0x434943[_0xadcb('0x3a')]=_[_0xadcb('0x3b')](_0x50b7d6[_0xadcb('0x3a')]);_0x434943['filters']=_[_0xadcb('0x3c')](_0x434943[_0xadcb('0x38')],_0x434943[_0xadcb('0x3a')]);_0x5852d5[_0xadcb('0x3d')]=_['intersection'](_0x434943[_0xadcb('0x38')],qs[_0xadcb('0x3e')](_0x50b7d6[_0xadcb('0x3a')][_0xadcb('0x3e')]));_0x5852d5[_0xadcb('0x3d')]=_0x5852d5[_0xadcb('0x3d')][_0xadcb('0x3f')]?_0x5852d5[_0xadcb('0x3d')]:_0x434943['model'];if(!_0x50b7d6[_0xadcb('0x3a')][_0xadcb('0x40')](_0xadcb('0x41'))){_0x5852d5[_0xadcb('0x1c')]=qs[_0xadcb('0x1c')](_0x50b7d6[_0xadcb('0x3a')]['limit']);_0x5852d5[_0xadcb('0x1a')]=qs['offset'](_0x50b7d6[_0xadcb('0x3a')][_0xadcb('0x1a')]);}_0x5852d5['order']=qs[_0xadcb('0x42')](_0x50b7d6['query'][_0xadcb('0x42')]);_0x5852d5['where']=qs[_0xadcb('0x43')](_['pick'](_0x50b7d6[_0xadcb('0x3a')],_0x434943[_0xadcb('0x43')]),_0x3c1fe5);if(_0x50b7d6['query'][_0xadcb('0x44')]){_0x5852d5[_0xadcb('0x45')]=_[_0xadcb('0x2b')](_0x5852d5['where'],{'$or':_[_0xadcb('0x32')](_0x3c1fe5,function(_0x548fb5){if(_0x548fb5['type']!==_0xadcb('0x46')){var _0x22914={};_0x22914[_0x548fb5[_0xadcb('0x39')]]={'$like':'%'+_0x50b7d6[_0xadcb('0x3a')][_0xadcb('0x44')]+'%'};return _0x22914;}})});}_0x5852d5=_['merge']({},_0x5852d5,_0x50b7d6[_0xadcb('0x47')]);var _0x3036b7={'where':_0x5852d5[_0xadcb('0x45')]};return db['AnalyticDefaultReport'][_0xadcb('0x1d')](_0x3036b7)['then'](function(_0x452539){_0x687b44[_0xadcb('0x1d')]=_0x452539;if(_0x50b7d6[_0xadcb('0x3a')]['includeAll']){_0x5852d5['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xadcb('0x48')](_0x5852d5);})[_0xadcb('0x24')](function(_0x2a782c){_0x687b44['rows']=_0x2a782c;return _0x687b44;})[_0xadcb('0x24')](respondWithFilteredResult(_0x5cbf19,_0x5852d5))[_0xadcb('0x49')](handleError(_0x5cbf19,null));};exports[_0xadcb('0x4a')]=function(_0x162453,_0x21e57f){var _0x17c9c0={'raw':!![],'where':{'id':_0x162453[_0xadcb('0x4b')]['id']}},_0x20aaaa={};_0x20aaaa[_0xadcb('0x38')]=_[_0xadcb('0x3b')](db[_0xadcb('0x33')][_0xadcb('0x34')]);_0x20aaaa[_0xadcb('0x3a')]=_[_0xadcb('0x3b')](_0x162453[_0xadcb('0x3a')]);_0x20aaaa[_0xadcb('0x43')]=_[_0xadcb('0x3c')](_0x20aaaa[_0xadcb('0x38')],_0x20aaaa[_0xadcb('0x3a')]);_0x17c9c0[_0xadcb('0x3d')]=_[_0xadcb('0x3c')](_0x20aaaa[_0xadcb('0x38')],qs[_0xadcb('0x3e')](_0x162453[_0xadcb('0x3a')][_0xadcb('0x3e')]));_0x17c9c0['attributes']=_0x17c9c0['attributes'][_0xadcb('0x3f')]?_0x17c9c0[_0xadcb('0x3d')]:_0x20aaaa['model'];if(_0x162453[_0xadcb('0x3a')][_0xadcb('0x4c')]){_0x17c9c0['include']=[{'all':!![]}];}_0x17c9c0=_['merge']({},_0x17c9c0,_0x162453[_0xadcb('0x47')]);return db[_0xadcb('0x33')]['find'](_0x17c9c0)[_0xadcb('0x24')](handleEntityNotFound(_0x21e57f,null))[_0xadcb('0x24')](respondWithResult(_0x21e57f,null))[_0xadcb('0x49')](handleError(_0x21e57f,null));};exports['create']=function(_0x41ee6a,_0x1e53f0){return db[_0xadcb('0x33')][_0xadcb('0x4d')](_0x41ee6a[_0xadcb('0x2c')],{})[_0xadcb('0x24')](function(_0x545305){var _0x106c08=_0x41ee6a[_0xadcb('0x4e')][_0xadcb('0x4f')]({'plain':!![]});if(!_0x106c08)throw new Error(_0xadcb('0x50'));if(_0x106c08['role']===_0xadcb('0x4e')){var _0x40e2ea=_0x545305[_0xadcb('0x4f')]({'plain':!![]});var _0x30f70b=_0xadcb('0x51');return db[_0xadcb('0x52')][_0xadcb('0x53')]({'where':{'name':_0x30f70b,'userProfileId':_0x106c08[_0xadcb('0x54')]},'raw':!![]})[_0xadcb('0x24')](function(_0x46c2c8){if(_0x46c2c8&&_0x46c2c8['autoAssociation']===0x0){return db[_0xadcb('0x26')][_0xadcb('0x4d')]({'name':_0x40e2ea[_0xadcb('0x39')],'resourceId':_0x40e2ea['id'],'type':_0xadcb('0x25'),'sectionId':_0x46c2c8['id']},{})[_0xadcb('0x24')](function(){return _0x545305;});}else{return _0x545305;}})['catch'](function(_0x5bb937){logger[_0xadcb('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bb937);throw _0x5bb937;});}return _0x545305;})[_0xadcb('0x24')](respondWithResult(_0x1e53f0,0xc9))[_0xadcb('0x49')](handleError(_0x1e53f0,null));};exports[_0xadcb('0x23')]=function(_0x35786f,_0x40c0c7){if(_0x35786f[_0xadcb('0x2c')]['id']){delete _0x35786f[_0xadcb('0x2c')]['id'];}return db['AnalyticDefaultReport'][_0xadcb('0x53')]({'where':{'id':_0x35786f[_0xadcb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x40c0c7,null))[_0xadcb('0x24')](saveUpdates(_0x35786f[_0xadcb('0x2c')],null))['then'](respondWithResult(_0x40c0c7,null))[_0xadcb('0x49')](handleError(_0x40c0c7,null));};exports['destroy']=function(_0x2f0fc8,_0x5dc2ee){return db[_0xadcb('0x33')][_0xadcb('0x53')]({'where':{'id':_0x2f0fc8['params']['id']}})['then'](handleEntityNotFound(_0x5dc2ee,null))['then'](removeEntity(_0x5dc2ee,null))[_0xadcb('0x49')](handleError(_0x5dc2ee,null));};exports[_0xadcb('0x56')]=function(_0x2ad27c,_0x5d0b2d){var _0x55e11f=0xa;var _0x2673bb=[_0xadcb('0x57'),'left_join',_0xadcb('0x58'),_0xadcb('0x59')];var _0x5731d7={'SUM':_0xadcb('0x5a'),'COUNT':_0xadcb('0x5b'),'COUNT DISTINCT':_0xadcb('0x5c'),'MAX':_0xadcb('0x5d'),'MIN':_0xadcb('0x5e'),'AVG':_0xadcb('0x5f'),'GROUP_CONCAT':_0xadcb('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xadcb('0x61')};var _0x11946f={'SEC_TO_TIME':_0xadcb('0x62'),'DATE':_0xadcb('0x63'),'HOUR':'HOUR(%s)','ROUND':_0xadcb('0x64'),'UNIX_TIMESTAMP':_0xadcb('0x65')};var _0x8b34cc=function(_0x1c7ea7){return!_[_0xadcb('0x66')]([_0xadcb('0x67'),_0xadcb('0x68'),'IS\x20EMPTY',_0xadcb('0x69')],_0x1c7ea7);};var _0x28c48=function(_0x25b5b5){if(!_0x25b5b5||!_0x25b5b5[_0xadcb('0x6a')][_0xadcb('0x3f')]){return'';}for(var _0x244977='(',_0x2acbe9=0x0;_0x2acbe9<_0x25b5b5[_0xadcb('0x6a')][_0xadcb('0x3f')];_0x2acbe9+=0x1){_0x2acbe9>0x0&&(_0x244977+='\x20'+_0x25b5b5['operator']+'\x20');_0x244977+=_0x25b5b5[_0xadcb('0x6a')][_0x2acbe9][_0xadcb('0x6b')]?_0x28c48(_0x25b5b5['rules'][_0x2acbe9][_0xadcb('0x6b')]):_0x25b5b5[_0xadcb('0x6a')][_0x2acbe9][_0xadcb('0x6c')]+'\x20'+_0x25b5b5[_0xadcb('0x6a')][_0x2acbe9][_0xadcb('0x6d')]+(_0x8b34cc(_0x25b5b5['rules'][_0x2acbe9][_0xadcb('0x6d')])?'\x20'+_0x25b5b5[_0xadcb('0x6a')][_0x2acbe9][_0xadcb('0x6e')]:'');}return _0x244977+')';};var _0x13e433={'where':{'id':_0x2ad27c[_0xadcb('0x4b')]['id']}},_0x573169,_0x5e9f36,_0x15d97a,_0x4af0fb,_0x1778cd;_0x13e433=_[_0xadcb('0x2b')]({},_0x13e433,_0x2ad27c[_0xadcb('0x47')]);return db['AnalyticDefaultReport']['find'](_0x13e433)['then'](function(_0x298c84){if(_0x298c84){_0x573169=_0x298c84;return _0x298c84[_0xadcb('0x6f')]();}return null;})[_0xadcb('0x24')](function(_0x2f8e04){if(_0x2f8e04){if(!_0x2f8e04[_0xadcb('0x3f')]){throw new db['Sequelize'][(_0xadcb('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5e9f36=_0x2f8e04;return db['AnalyticMetric'][_0xadcb('0x48')]({'raw':!![]});}return null;})[_0xadcb('0x24')](function(_0x405bd7){if(_0x405bd7){_0x15d97a=_['keyBy'](_0x405bd7,'id');var _0x8ad66;var _0x4e8ae2=squel[_0xadcb('0x71')]();_0x4e8ae2[_0xadcb('0x72')](_0x573169[_0xadcb('0x73')]);for(var _0xd206b7=0x0;_0xd206b7<_0x5e9f36['length'];_0xd206b7+=0x1){_0x8ad66=_0x5e9f36[_0xd206b7]['MetricId']?_0x15d97a[_0x5e9f36[_0xd206b7]['MetricId']][_0xadcb('0x74')]:_0x5e9f36[_0xd206b7][_0xadcb('0x6c')];_0x8ad66=_0x5e9f36[_0xd206b7]['function']?_[_0xadcb('0x75')](_0x5731d7[_0x5e9f36[_0xd206b7][_0xadcb('0x76')]],'%s',_0x8ad66):_0x8ad66;_0x8ad66=_0x5e9f36[_0xd206b7][_0xadcb('0x77')]?_[_0xadcb('0x75')](_0x11946f[_0x5e9f36[_0xd206b7][_0xadcb('0x77')]],'%s',_0x8ad66):_0x8ad66;if(_0x5e9f36[_0xd206b7][_0xadcb('0x78')]){_0x4e8ae2[_0xadcb('0x6b')](_0x8ad66);}_0x5e9f36[_0xd206b7][_0xadcb('0x79')]&&_0x4e8ae2[_0xadcb('0x7a')](_0x8ad66,_0x5e9f36[_0xd206b7][_0xadcb('0x79')]===_0xadcb('0x7b')?![]:!![]);_0x4e8ae2[_0xadcb('0x6c')](_0x8ad66,_0x5e9f36[_0xd206b7][_0xadcb('0x7c')]||_0x8ad66);}if(_0x573169[_0xadcb('0x7d')]){_0x573169[_0xadcb('0x7d')]=JSON[_0xadcb('0x7e')](_0x573169[_0xadcb('0x7d')]);for(var _0x573bc6=0x0;_0x573bc6<_0x573169[_0xadcb('0x7d')][_0xadcb('0x3f')];_0x573bc6+=0x1){if(_0x573169['joins'][_0x573bc6]['type']&&_[_0xadcb('0x66')](_0x2673bb,_0x573169[_0xadcb('0x7d')][_0x573bc6][_0xadcb('0x36')])&&_0x573169[_0xadcb('0x7d')][_0x573bc6][_0xadcb('0x7f')]&&_0x573169[_0xadcb('0x7d')][_0x573bc6][_0xadcb('0x80')]&&_0x573169[_0xadcb('0x7d')][_0x573bc6][_0xadcb('0x81')]){_0x4e8ae2[_0x573169[_0xadcb('0x7d')][_0x573bc6][_0xadcb('0x36')]](_0x573169['joins'][_0x573bc6][_0xadcb('0x80')],null,util['format'](_0xadcb('0x82'),_0x573169['table'],_0x573169[_0xadcb('0x7d')][_0x573bc6][_0xadcb('0x7f')],_0x573169[_0xadcb('0x7d')][_0x573bc6]['foreignTable'],_0x573169[_0xadcb('0x7d')][_0x573bc6]['foreignKey']));}}}if(_0x573169[_0xadcb('0x83')]){_0x573169['conditions']=JSON[_0xadcb('0x7e')](_0x573169[_0xadcb('0x83')]);_0x4e8ae2[_0xadcb('0x45')](_0x28c48(_0x573169[_0xadcb('0x83')]['group']));}_0x1778cd=_0x4e8ae2[_0xadcb('0x84')]();_0x4e8ae2['limit'](_0x55e11f);_0x4e8ae2[_0xadcb('0x1a')](0x0);logger[_0xadcb('0x85')](_0xadcb('0x86'),_0x4e8ae2[_0xadcb('0x87')]());return dbH[_0xadcb('0x88')][_0xadcb('0x3a')](_0x4e8ae2['toString'](),{'type':dbH[_0xadcb('0x88')][_0xadcb('0x89')][_0xadcb('0x8a')]});}})[_0xadcb('0x24')](respondWithResult(_0x5d0b2d,null))['catch'](handleError(_0x5d0b2d,null));};function runReport(_0x4d0280,_0x2653ff,_0x2bb863){var _0x216dc6=_0x2653ff[_0xadcb('0x39')];var _0x4463c9=0xa;var _0x686362=[_0xadcb('0x57'),_0xadcb('0x8b'),_0xadcb('0x58'),'cross_join'];var _0x26485a={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xadcb('0x5d'),'MIN':_0xadcb('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xadcb('0x60'),'GROUP_CONCAT ASC':_0xadcb('0x8c'),'GROUP_CONCAT DESC':_0xadcb('0x61')};var _0x169866={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xadcb('0x63'),'HOUR':'HOUR(%s)','ROUND':_0xadcb('0x64'),'UNIX_TIMESTAMP':_0xadcb('0x65')};var _0x288068=function(_0x39c492){return!_[_0xadcb('0x66')](['IS\x20NULL',_0xadcb('0x68'),_0xadcb('0x8d'),_0xadcb('0x69')],_0x39c492);};var _0x1e509f=function(_0xeec9af){if(!_0xeec9af||!_0xeec9af[_0xadcb('0x6a')]['length']){return'';}for(var _0x337289='(',_0x1a0285=0x0;_0x1a0285<_0xeec9af[_0xadcb('0x6a')][_0xadcb('0x3f')];_0x1a0285+=0x1){_0x1a0285>0x0&&(_0x337289+='\x20'+_0xeec9af['operator']+'\x20');_0x337289+=_0xeec9af[_0xadcb('0x6a')][_0x1a0285][_0xadcb('0x6b')]?_0x1e509f(_0xeec9af[_0xadcb('0x6a')][_0x1a0285][_0xadcb('0x6b')]):_0xeec9af[_0xadcb('0x6a')][_0x1a0285][_0xadcb('0x6c')]+'\x20'+_0xeec9af[_0xadcb('0x6a')][_0x1a0285][_0xadcb('0x6d')]+(_0x288068(_0xeec9af[_0xadcb('0x6a')][_0x1a0285]['condition'])?'\x20'+_0xeec9af['rules'][_0x1a0285][_0xadcb('0x6e')]:'');}return _0x337289+')';};var _0x3b7fd6={'where':{'id':_0x4d0280['id']}},_0x51f2fa,_0x2c616d,_0x646b96,_0x2fb8f7,_0x2ad91a;_0x3b7fd6=_['merge']({},_0x3b7fd6,_0x2bb863);return db[_0xadcb('0x33')]['find'](_0x3b7fd6)[_0xadcb('0x24')](function(_0x576988){if(_0x576988){_0x51f2fa=_0x576988;return _0x576988['getFields']();}return null;})['then'](function(_0x2caa82){if(_0x2caa82){if(!_0x2caa82['length']){throw new db[(_0xadcb('0x8e'))]['ValidationErrorItem'](_0xadcb('0x8f'),0x193);}_0x2c616d=_0x2caa82;return db['AnalyticMetric'][_0xadcb('0x48')]({'raw':!![]});}return null;})[_0xadcb('0x24')](function(_0x1cde25){if(_0x1cde25){_0x646b96=_[_0xadcb('0x90')](_0x1cde25,'id');var _0x52c1e6;var _0x308b59=squel['select']();_0x308b59[_0xadcb('0x72')](_0x51f2fa[_0xadcb('0x73')]);for(var _0x295254=0x0;_0x295254<_0x2c616d['length'];_0x295254+=0x1){_0x52c1e6=_0x2c616d[_0x295254][_0xadcb('0x91')]?_0x646b96[_0x2c616d[_0x295254][_0xadcb('0x91')]][_0xadcb('0x74')]:_0x2c616d[_0x295254][_0xadcb('0x6c')];_0x52c1e6=_0x2c616d[_0x295254]['function']?_[_0xadcb('0x75')](_0x26485a[_0x2c616d[_0x295254][_0xadcb('0x76')]],'%s',_0x52c1e6):_0x52c1e6;_0x52c1e6=_0x2c616d[_0x295254]['format']?_[_0xadcb('0x75')](_0x169866[_0x2c616d[_0x295254][_0xadcb('0x77')]],'%s',_0x52c1e6):_0x52c1e6;if(_0x2c616d[_0x295254][_0xadcb('0x78')]){_0x308b59[_0xadcb('0x6b')](_0x52c1e6);}_0x2c616d[_0x295254][_0xadcb('0x79')]&&_0x308b59[_0xadcb('0x7a')](_0x52c1e6,_0x2c616d[_0x295254][_0xadcb('0x79')]===_0xadcb('0x7b')?![]:!![]);_0x308b59[_0xadcb('0x6c')](_0x52c1e6,_0x2c616d[_0x295254][_0xadcb('0x7c')]||_0x52c1e6);}if(_0x51f2fa[_0xadcb('0x7d')]){_0x51f2fa['joins']=JSON[_0xadcb('0x7e')](_0x51f2fa[_0xadcb('0x7d')]);for(var _0x49aa42=0x0;_0x49aa42<_0x51f2fa[_0xadcb('0x7d')][_0xadcb('0x3f')];_0x49aa42+=0x1){if(_0x51f2fa['joins'][_0x49aa42]['type']&&_[_0xadcb('0x66')](_0x686362,_0x51f2fa[_0xadcb('0x7d')][_0x49aa42]['type'])&&_0x51f2fa['joins'][_0x49aa42][_0xadcb('0x7f')]&&_0x51f2fa['joins'][_0x49aa42][_0xadcb('0x80')]&&_0x51f2fa[_0xadcb('0x7d')][_0x49aa42]['foreignKey']){_0x308b59[_0x51f2fa[_0xadcb('0x7d')][_0x49aa42][_0xadcb('0x36')]](_0x51f2fa[_0xadcb('0x7d')][_0x49aa42][_0xadcb('0x80')],null,util[_0xadcb('0x77')]('%s.%s\x20=\x20%s.%s',_0x51f2fa['table'],_0x51f2fa[_0xadcb('0x7d')][_0x49aa42][_0xadcb('0x7f')],_0x51f2fa['joins'][_0x49aa42][_0xadcb('0x80')],_0x51f2fa['joins'][_0x49aa42]['foreignKey']));}}}if(_0x51f2fa[_0xadcb('0x83')]){_0x51f2fa['conditions']=JSON[_0xadcb('0x7e')](_0x51f2fa[_0xadcb('0x83')]);_0x308b59[_0xadcb('0x45')](_0x1e509f(_0x51f2fa[_0xadcb('0x83')][_0xadcb('0x6b')]));}_0x2ad91a=_0x308b59[_0xadcb('0x84')]();_0x308b59[_0xadcb('0x1c')](_0x4463c9);_0x308b59[_0xadcb('0x1a')](0x0);return;}})['then'](function(){if(_0x2653ff[_0xadcb('0x92')]===_0xadcb('0x93')){return null;}var _0xf90f6b=_[_0xadcb('0x2b')](_0x2653ff,{'name':_0x2653ff[_0xadcb('0x94')]||_0x2653ff[_0xadcb('0x39')]||_0x51f2fa[_0xadcb('0x39')],'basename':_0x216dc6,'savename':util['format'](_0xadcb('0x95'),_0x2653ff[_0xadcb('0x39')]||_0x51f2fa[_0xadcb('0x39')],require('randomstring')['generate'](0x4),_0x2653ff[_0xadcb('0x92')]||_0xadcb('0x96')),'reportId':_0x51f2fa['id'],'reportType':_0xadcb('0x97')});return db['AnalyticExtractedReport']['create'](_0xf90f6b,{'raw':!![]});})[_0xadcb('0x24')](function(_0x2f1b76){if(_0x51f2fa[_0xadcb('0x73')]===_0xadcb('0x98')){_0x2ad91a['where'](_0x51f2fa[_0xadcb('0x73')]+_0xadcb('0x99'),_0x2653ff[_0xadcb('0x9a')],_0x2653ff[_0xadcb('0x9b')]);}else{_0x2ad91a[_0xadcb('0x45')](_0x51f2fa['table']+_0xadcb('0x9c'),_0x2653ff[_0xadcb('0x9a')],_0x2653ff['endDate']);}if(_0x2f1b76){logger['info'](_0xadcb('0x9d'),_0x2ad91a[_0xadcb('0x87')]());require(_0xadcb('0x9e'))['fork'](path[_0xadcb('0x57')](__dirname,'../../components/export/',_0x2f1b76[_0xadcb('0x92')]),[_0x2f1b76['id'],_0x2ad91a[_0xadcb('0x87')](),path[_0xadcb('0x57')](__dirname,'../../files/reports',_0x2f1b76[_0xadcb('0x9f')]),_0x216dc6]);return _0x2f1b76;}else{var _0x361250=squel[_0xadcb('0x71')]();_0x361250[_0xadcb('0x72')]('('+_0x2ad91a[_0xadcb('0x87')]()+')',_0xadcb('0xa0'));_0x361250[_0xadcb('0x6c')](_0xadcb('0xa1'),_0xadcb('0x1d'));_0x2ad91a[_0xadcb('0x1c')](_0x2653ff[_0xadcb('0x1c')]||_0x4463c9);_0x2ad91a[_0xadcb('0x1a')](_0x2653ff[_0xadcb('0x1a')]||0x0);return dbH[_0xadcb('0x88')][_0xadcb('0x3a')](_0x361250['toString'](),{'type':dbH[_0xadcb('0x88')][_0xadcb('0x89')][_0xadcb('0x8a')]})[_0xadcb('0x24')](function(_0x36455b){if(!_0x36455b[_0xadcb('0x3f')]){_0x2fb8f7=0x0;}else{_0x2fb8f7=_0x36455b[0x0][_0xadcb('0x1d')]||0x0;}return dbH['sequelize'][_0xadcb('0x3a')](_0x2ad91a[_0xadcb('0x87')](),{'type':dbH['sequelize']['QueryTypes'][_0xadcb('0x8a')]});})[_0xadcb('0x24')](function(_0xad9b0e){return{'rows':_0xad9b0e||[],'count':_0x2fb8f7};});}});}exports[_0xadcb('0xa2')]=function(_0x15b65c,_0x511725){return runReport(_0x15b65c[_0xadcb('0x4b')],_0x15b65c[_0xadcb('0x3a')],_0x15b65c['options'])[_0xadcb('0x24')](respondWithResult(_0x511725,null))[_0xadcb('0x49')](handleError(_0x511725,null));};exports['runReport']=runReport;exports['query']=function(_0x47db54,_0x506942){var _0x3ee93e=0xa;var _0x1e2c3a=['join',_0xadcb('0x8b'),'right_join','cross_join'];var _0x4f515d={'SUM':_0xadcb('0x5a'),'COUNT':_0xadcb('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xadcb('0x5d'),'MIN':_0xadcb('0x5e'),'AVG':_0xadcb('0x5f'),'GROUP_CONCAT':_0xadcb('0x60'),'GROUP_CONCAT ASC':_0xadcb('0x8c'),'GROUP_CONCAT DESC':_0xadcb('0x61')};var _0x128fe0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xadcb('0x63'),'HOUR':_0xadcb('0xa3'),'ROUND':_0xadcb('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x213b0c=function(_0x1df5d6){return!_[_0xadcb('0x66')]([_0xadcb('0x67'),_0xadcb('0x68'),_0xadcb('0x8d'),_0xadcb('0x69')],_0x1df5d6);};var _0x46f2cf=function(_0x384e4b){if(!_0x384e4b||!_0x384e4b[_0xadcb('0x6a')][_0xadcb('0x3f')]){return'';}for(var _0x5d630e='(',_0x1d1088=0x0;_0x1d1088<_0x384e4b['rules'][_0xadcb('0x3f')];_0x1d1088+=0x1){_0x1d1088>0x0&&(_0x5d630e+='\x20'+_0x384e4b[_0xadcb('0xa4')]+'\x20');_0x5d630e+=_0x384e4b['rules'][_0x1d1088][_0xadcb('0x6b')]?_0x46f2cf(_0x384e4b[_0xadcb('0x6a')][_0x1d1088][_0xadcb('0x6b')]):_0x384e4b[_0xadcb('0x6a')][_0x1d1088][_0xadcb('0x6c')]+'\x20'+_0x384e4b[_0xadcb('0x6a')][_0x1d1088]['condition']+(_0x213b0c(_0x384e4b['rules'][_0x1d1088][_0xadcb('0x6d')])?'\x20'+_0x384e4b[_0xadcb('0x6a')][_0x1d1088][_0xadcb('0x6e')]:'');}return _0x5d630e+')';};var _0x5ae9f7={'where':{'id':_0x47db54[_0xadcb('0x4b')]['id']}},_0x3ff8f1,_0x100966,_0x125106,_0x1dc2fb,_0x29f14a;_0x5ae9f7=_['merge']({},_0x5ae9f7,_0x47db54[_0xadcb('0x47')]);return db[_0xadcb('0x33')][_0xadcb('0x53')](_0x5ae9f7)['then'](function(_0x123c08){if(_0x123c08){_0x3ff8f1=_0x123c08;return _0x123c08[_0xadcb('0x6f')]();}return null;})[_0xadcb('0x24')](function(_0x42ccbb){if(_0x42ccbb){if(!_0x42ccbb[_0xadcb('0x3f')]){throw new db[(_0xadcb('0x8e'))][(_0xadcb('0x70'))](_0xadcb('0x8f'),0x193);}_0x100966=_0x42ccbb;return db[_0xadcb('0xa5')][_0xadcb('0x48')]({'raw':!![]});}return null;})[_0xadcb('0x24')](function(_0x11ca79){if(_0x11ca79){_0x125106=_[_0xadcb('0x90')](_0x11ca79,'id');var _0x3115e6;var _0x1399c9=squel[_0xadcb('0x71')]();_0x1399c9[_0xadcb('0x72')](_0x3ff8f1['table']);for(var _0x300f47=0x0;_0x300f47<_0x100966['length'];_0x300f47+=0x1){_0x3115e6=_0x100966[_0x300f47]['MetricId']?_0x125106[_0x100966[_0x300f47][_0xadcb('0x91')]][_0xadcb('0x74')]:_0x100966[_0x300f47]['field'];_0x3115e6=_0x100966[_0x300f47][_0xadcb('0x76')]?_['replace'](_0x4f515d[_0x100966[_0x300f47]['function']],'%s',_0x3115e6):_0x3115e6;_0x3115e6=_0x100966[_0x300f47]['format']?_[_0xadcb('0x75')](_0x128fe0[_0x100966[_0x300f47][_0xadcb('0x77')]],'%s',_0x3115e6):_0x3115e6;if(_0x100966[_0x300f47][_0xadcb('0x78')]){_0x1399c9[_0xadcb('0x6b')](_0x3115e6);}_0x100966[_0x300f47]['orderBy']&&_0x1399c9['order'](_0x3115e6,_0x100966[_0x300f47][_0xadcb('0x79')]===_0xadcb('0x7b')?![]:!![]);_0x1399c9[_0xadcb('0x6c')](_0x3115e6,_0x100966[_0x300f47]['alias']||_0x3115e6);}if(_0x3ff8f1[_0xadcb('0x7d')]){_0x3ff8f1[_0xadcb('0x7d')]=JSON[_0xadcb('0x7e')](_0x3ff8f1[_0xadcb('0x7d')]);for(var _0x355ba6=0x0;_0x355ba6<_0x3ff8f1[_0xadcb('0x7d')]['length'];_0x355ba6+=0x1){if(_0x3ff8f1[_0xadcb('0x7d')][_0x355ba6][_0xadcb('0x36')]&&_[_0xadcb('0x66')](_0x1e2c3a,_0x3ff8f1[_0xadcb('0x7d')][_0x355ba6][_0xadcb('0x36')])&&_0x3ff8f1[_0xadcb('0x7d')][_0x355ba6][_0xadcb('0x7f')]&&_0x3ff8f1[_0xadcb('0x7d')][_0x355ba6][_0xadcb('0x80')]&&_0x3ff8f1[_0xadcb('0x7d')][_0x355ba6][_0xadcb('0x81')]){_0x1399c9[_0x3ff8f1[_0xadcb('0x7d')][_0x355ba6]['type']](_0x3ff8f1[_0xadcb('0x7d')][_0x355ba6][_0xadcb('0x80')],null,util[_0xadcb('0x77')]('%s.%s\x20=\x20%s.%s',_0x3ff8f1[_0xadcb('0x73')],_0x3ff8f1['joins'][_0x355ba6][_0xadcb('0x7f')],_0x3ff8f1['joins'][_0x355ba6][_0xadcb('0x80')],_0x3ff8f1['joins'][_0x355ba6][_0xadcb('0x81')]));}}}if(_0x3ff8f1['conditions']){_0x3ff8f1['conditions']=JSON[_0xadcb('0x7e')](_0x3ff8f1[_0xadcb('0x83')]);_0x1399c9[_0xadcb('0x45')](_0x46f2cf(_0x3ff8f1['conditions'][_0xadcb('0x6b')]));}_0x29f14a=_0x1399c9[_0xadcb('0x84')]();_0x1399c9[_0xadcb('0x1c')](_0x3ee93e);_0x1399c9[_0xadcb('0x1a')](0x0);logger['debug'](_0xadcb('0x86'),_0x1399c9['toString']());return dbH[_0xadcb('0x88')][_0xadcb('0x3a')](_0x1399c9[_0xadcb('0x87')](),{'type':dbH['sequelize']['QueryTypes'][_0xadcb('0x8a')]});}})['then'](function(){return{'sql':_0x29f14a[_0xadcb('0x87')]()};})[_0xadcb('0x24')](respondWithResult(_0x506942,null))[_0xadcb('0x49')](handleError(_0x506942,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index c41b5dc..2375937 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 _0xc370=['../../config/environment','exports','define','AnalyticDefaultReport','util','api','moment','bluebird','path','rimraf'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0xc370,0x13a));var _0x0c37=function(_0xeb0a1b,_0x179ad2){_0xeb0a1b=_0xeb0a1b-0x0;var _0x4caf8c=_0xc370[_0xeb0a1b];return _0x4caf8c;};'use strict';var _=require('lodash');var util=require(_0x0c37('0x0'));var logger=require('../../config/logger')(_0x0c37('0x1'));var moment=require(_0x0c37('0x2'));var BPromise=require(_0x0c37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c37('0x4'));var rimraf=require(_0x0c37('0x5'));var config=require(_0x0c37('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x0c37('0x7')]=function(_0x2e5b32,_0x49fbeb){return _0x2e5b32[_0x0c37('0x8')](_0x0c37('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e3d=['request-promise','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','api','moment','bluebird'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x2e3d,0x1be));var _0xd2e3=function(_0x146114,_0x12ee38){_0x146114=_0x146114-0x0;var _0x277348=_0x2e3d[_0x146114];return _0x277348;};'use strict';var _=require(_0xd2e3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd2e3('0x1'));var moment=require(_0xd2e3('0x2'));var BPromise=require(_0xd2e3('0x3'));var rp=require(_0xd2e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd2e3('0x5'));var attributes=require('./analyticDefaultReport.attributes');module[_0xd2e3('0x6')]=function(_0x2ba133,_0x3beebf){return _0x2ba133[_0xd2e3('0x7')](_0xd2e3('0x8'),attributes,{'tableName':_0xd2e3('0x9'),'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 2c6d0b9..41f4d6f 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 _0xe205=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xe205,0xa7));var _0x5e20=function(_0x454d18,_0x4771d2){_0x454d18=_0x454d18-0x0;var _0x2151ef=_0xe205[_0x454d18];return _0x2151ef;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});} \ No newline at end of file +var _0x1572=['info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x284318,_0xd1ce42){var _0x2682f5=function(_0x1115db){while(--_0x1115db){_0x284318['push'](_0x284318['shift']());}};_0x2682f5(++_0xd1ce42);}(_0x1572,0xf5));var _0x2157=function(_0x5ea2a3,_0x19858f){_0x5ea2a3=_0x5ea2a3-0x0;var _0x34b5df=_0x1572[_0x5ea2a3];return _0x34b5df;};'use strict';var _=require(_0x2157('0x0'));var util=require(_0x2157('0x1'));var moment=require(_0x2157('0x2'));var BPromise=require(_0x2157('0x3'));var rs=require(_0x2157('0x4'));var fs=require('fs');var Redis=require(_0x2157('0x5'));var db=require(_0x2157('0x6'))['db'];var utils=require(_0x2157('0x7'));var logger=require(_0x2157('0x8'))(_0x2157('0x9'));var config=require(_0x2157('0xa'));var jayson=require(_0x2157('0xb'));var client=jayson[_0x2157('0xc')][_0x2157('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x286be0,_0x462657,_0x471e09){return new BPromise(function(_0x91bf75,_0x5e9959){return client[_0x2157('0xe')](_0x286be0,_0x471e09)['then'](function(_0x91d81){logger[_0x2157('0xf')](_0x2157('0x10'),_0x462657,_0x2157('0x11'));logger[_0x2157('0x12')](_0x2157('0x13'),_0x462657,_0x2157('0x11'),JSON[_0x2157('0x14')](_0x91d81));if(_0x91d81['error']){if(_0x91d81[_0x2157('0x15')][_0x2157('0x16')]===0x1f4){logger[_0x2157('0x15')](_0x2157('0x10'),_0x462657,_0x91d81['error'][_0x2157('0x17')]);return _0x5e9959(_0x91d81[_0x2157('0x15')][_0x2157('0x17')]);}logger[_0x2157('0x15')](_0x2157('0x10'),_0x462657,_0x91d81[_0x2157('0x15')][_0x2157('0x17')]);return _0x91bf75(_0x91d81['error']['message']);}else{logger['info'](_0x2157('0x10'),_0x462657,_0x2157('0x11'));_0x91bf75(_0x91d81[_0x2157('0x18')][_0x2157('0x17')]);}})[_0x2157('0x19')](function(_0x465b2b){logger[_0x2157('0x15')](_0x2157('0x10'),_0x462657,_0x465b2b);_0x5e9959(_0x465b2b);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 7bd6f09..bed4c6e 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 _0x859c=['get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x859c,0x16e));var _0xc859=function(_0x36a4ed,_0x5d2f77){_0x36a4ed=_0x36a4ed-0x0;var _0x21f5ff=_0x859c[_0x36a4ed];return _0x21f5ff;};'use strict';var multer=require(_0xc859('0x0'));var util=require(_0xc859('0x1'));var path=require(_0xc859('0x2'));var timeout=require(_0xc859('0x3'));var express=require(_0xc859('0x4'));var router=express[_0xc859('0x5')]();var fs_extra=require(_0xc859('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc859('0x7'));var config=require(_0xc859('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0xc859('0x9')]('/',auth[_0xc859('0xa')](),controller[_0xc859('0xb')]);router[_0xc859('0x9')](_0xc859('0xc'),auth[_0xc859('0xa')](),controller[_0xc859('0xd')]);router['get'](_0xc859('0xe'),auth[_0xc859('0xa')](),controller[_0xc859('0xf')]);router[_0xc859('0x9')](_0xc859('0x10'),auth[_0xc859('0xa')](),controller[_0xc859('0x11')]);router[_0xc859('0x9')](_0xc859('0x12'),auth[_0xc859('0xa')](),controller['query']);router[_0xc859('0x13')]('/',auth[_0xc859('0xa')](),controller[_0xc859('0x14')]);router[_0xc859('0x15')]('/:id',auth[_0xc859('0xa')](),controller[_0xc859('0x16')]);router[_0xc859('0x17')](_0xc859('0xc'),auth[_0xc859('0xa')](),controller['destroy']);module[_0xc859('0x18')]=router; \ No newline at end of file +var _0xa2e0=['isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa2e0,0x124));var _0x0a2e=function(_0x484a8a,_0x520c6f){_0x484a8a=_0x484a8a-0x0;var _0x141a0f=_0xa2e0[_0x484a8a];return _0x141a0f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0a2e('0x0'));var timeout=require(_0x0a2e('0x1'));var express=require(_0x0a2e('0x2'));var router=express[_0x0a2e('0x3')]();var fs_extra=require(_0x0a2e('0x4'));var auth=require(_0x0a2e('0x5'));var interaction=require(_0x0a2e('0x6'));var config=require('../../config/environment');var controller=require(_0x0a2e('0x7'));router['get']('/',auth[_0x0a2e('0x8')](),controller[_0x0a2e('0x9')]);router[_0x0a2e('0xa')](_0x0a2e('0xb'),auth[_0x0a2e('0x8')](),controller[_0x0a2e('0xc')]);router[_0x0a2e('0xa')](_0x0a2e('0xd'),auth[_0x0a2e('0x8')](),controller[_0x0a2e('0xe')]);router['get'](_0x0a2e('0xf'),auth['isAuthenticated'](),controller[_0x0a2e('0x10')]);router[_0x0a2e('0xa')](_0x0a2e('0x11'),auth[_0x0a2e('0x8')](),controller[_0x0a2e('0x12')]);router[_0x0a2e('0x13')]('/',auth[_0x0a2e('0x8')](),controller[_0x0a2e('0x14')]);router[_0x0a2e('0x15')](_0x0a2e('0xb'),auth['isAuthenticated'](),controller[_0x0a2e('0x16')]);router[_0x0a2e('0x17')]('/:id',auth[_0x0a2e('0x8')](),controller['destroy']);module[_0x0a2e('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 5fb516f..8d13c22 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 _0x9b55=['Loading','manual','INTEGER','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0x9b55,0x87));var _0x59b5=function(_0x185bde,_0x43e4c6){_0x185bde=_0x185bde-0x0;var _0x39c312=_0x9b55[_0x185bde];return _0x39c312;};'use strict';var Sequelize=require(_0x59b5('0x0'));var moment=require(_0x59b5('0x1'));module[_0x59b5('0x2')]={'name':{'type':Sequelize[_0x59b5('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x59b5('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x5'),_0x59b5('0x6'),_0x59b5('0x7')),'allowNull':![],'defaultValue':_0x59b5('0x5')},'savename':{'type':Sequelize[_0x59b5('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x59b5('0x8')]},'endDate':{'type':Sequelize[_0x59b5('0x8')]},'status':{'type':Sequelize[_0x59b5('0x3')],'defaultValue':_0x59b5('0x9')},'type':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0x59b5('0xa')},'reportId':{'type':Sequelize[_0x59b5('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x59b5('0x3')]}}; \ No newline at end of file +var _0x1321=['pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','csv'];(function(_0xd006b2,_0x300238){var _0xded2ef=function(_0x5e0156){while(--_0x5e0156){_0xd006b2['push'](_0xd006b2['shift']());}};_0xded2ef(++_0x300238);}(_0x1321,0x8a));var _0x1132=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1321[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x1132('0x0'));var moment=require(_0x1132('0x1'));module[_0x1132('0x2')]={'name':{'type':Sequelize[_0x1132('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x1132('0x4'),_0x1132('0x5'),_0x1132('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x1132('0x7')]},'endDate':{'type':Sequelize[_0x1132('0x7')]},'status':{'type':Sequelize[_0x1132('0x3')],'defaultValue':_0x1132('0x8')},'type':{'type':Sequelize['ENUM']('manual',_0x1132('0x9')),'allowNull':![],'defaultValue':_0x1132('0xa')},'reportId':{'type':Sequelize[_0x1132('0xb')](0xb)[_0x1132('0xc')]},'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 0cd8cfe..46a391b 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 _0x43f0=['offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','stack','name','send','render','merge','body','contact','interaction','map','AnalyticExtractedReport','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x2f346d,_0xb3e493){var _0x1c2009=function(_0x4ef267){while(--_0x4ef267){_0x2f346d['push'](_0x2f346d['shift']());}};_0x1c2009(++_0xb3e493);}(_0x43f0,0xab));var _0x043f=function(_0x45a93b,_0x31dff5){_0x45a93b=_0x45a93b-0x0;var _0x1b70e3=_0x43f0[_0x45a93b];return _0x1b70e3;};'use strict';var emlformat=require(_0x043f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x043f('0x1'));var jsonpatch=require(_0x043f('0x2'));var rp=require(_0x043f('0x3'));var moment=require('moment');var BPromise=require(_0x043f('0x4'));var Mustache=require(_0x043f('0x5'));var util=require(_0x043f('0x6'));var path=require(_0x043f('0x7'));var sox=require('sox');var csv=require(_0x043f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x043f('0x9'));var _=require(_0x043f('0xa'));var squel=require(_0x043f('0xb'));var crypto=require(_0x043f('0xc'));var jsforce=require(_0x043f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x043f('0x8'));var querystring=require(_0x043f('0xe'));var Papa=require(_0x043f('0xf'));var Redis=require('ioredis');var authService=require(_0x043f('0x10'));var qs=require(_0x043f('0x11'));var as=require(_0x043f('0x12'));var hardwareService=require(_0x043f('0x13'));var logger=require(_0x043f('0x14'))(_0x043f('0x15'));var utils=require(_0x043f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x043f('0x17'));var db=require(_0x043f('0x18'))['db'];function respondWithStatusCode(_0x27769b,_0x4b1eaa){_0x4b1eaa=_0x4b1eaa||0xcc;return function(_0x3c7c27){if(_0x3c7c27){return _0x27769b[_0x043f('0x19')](_0x4b1eaa);}return _0x27769b[_0x043f('0x1a')](_0x4b1eaa)[_0x043f('0x1b')]();};}function respondWithResult(_0x29be82,_0x5a2d1d){_0x5a2d1d=_0x5a2d1d||0xc8;return function(_0x408eda){if(_0x408eda){return _0x29be82[_0x043f('0x1a')](_0x5a2d1d)[_0x043f('0x1c')](_0x408eda);}};}function respondWithFilteredResult(_0x25b2cb,_0x59b616){return function(_0x5b1675){if(_0x5b1675){var _0x5c145d=typeof _0x59b616[_0x043f('0x1d')]==='undefined'&&typeof _0x59b616[_0x043f('0x1e')]===_0x043f('0x1f');var _0x16b68c=_0x5b1675[_0x043f('0x20')];var _0x46c75d=_0x5c145d?0x0:_0x59b616[_0x043f('0x1d')];var _0x526f68=_0x5c145d?_0x5b1675[_0x043f('0x20')]:_0x59b616[_0x043f('0x1d')]+_0x59b616[_0x043f('0x1e')];var _0x566f78;if(_0x526f68>=_0x16b68c){_0x526f68=_0x16b68c;_0x566f78=0xc8;}else{_0x566f78=0xce;}_0x25b2cb[_0x043f('0x1a')](_0x566f78);return _0x25b2cb[_0x043f('0x21')](_0x043f('0x22'),_0x46c75d+'-'+_0x526f68+'/'+_0x16b68c)['json'](_0x5b1675);}return null;};}function patchUpdates(_0x2839b4){return function(_0x44ff9b){try{jsonpatch[_0x043f('0x23')](_0x44ff9b,_0x2839b4,!![]);}catch(_0x33d972){return BPromise[_0x043f('0x24')](_0x33d972);}return _0x44ff9b[_0x043f('0x25')]();};}function saveUpdates(_0x50b530,_0x724f85){return function(_0xb0df07){if(_0xb0df07){return _0xb0df07[_0x043f('0x26')](_0x50b530)['then'](function(_0x389998){return _0x389998;});}return null;};}function removeEntity(_0x5cb91d,_0x3fddea){return function(_0x35b853){if(_0x35b853){return _0x35b853['destroy']()[_0x043f('0x27')](function(){var _0x46d832=_0x35b853[_0x043f('0x28')]({'plain':!![]});var _0x398215=_0x043f('0x29');return db[_0x043f('0x2a')][_0x043f('0x2b')]({'where':{'type':_0x398215,'resourceId':_0x46d832['id']}})[_0x043f('0x27')](function(){return _0x35b853;});})[_0x043f('0x27')](function(){_0x5cb91d[_0x043f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4142eb,_0x1135ba){return function(_0x15b6e5){if(!_0x15b6e5){_0x4142eb[_0x043f('0x19')](0x194);}return _0x15b6e5;};}function handleError(_0x2cad8c,_0x548565){_0x548565=_0x548565||0x1f4;return function(_0x1930fd){logger['error'](_0x1930fd[_0x043f('0x2c')]);if(_0x1930fd[_0x043f('0x2d')]){delete _0x1930fd[_0x043f('0x2d')];}_0x2cad8c[_0x043f('0x1a')](_0x548565)[_0x043f('0x2e')](_0x1930fd);};}function getMustacheRender(_0x3b12a3,_0x4b65e2){return Mustache[_0x043f('0x2f')](_0x3b12a3,_[_0x043f('0x30')](_0x4b65e2[_0x043f('0x31')],{'contact':_0x4b65e2[_0x043f('0x32')],'message':_0x4b65e2['message'],'agent':_0x4b65e2['agent'],'interaction':_0x4b65e2[_0x043f('0x33')],'account':_0x4b65e2['account']}))||'';}exports['index']=function(_0xb73d7b,_0x3b8be0){var _0x44cea4={},_0x133944={},_0x25f681={'count':0x0,'rows':[]};var _0x52d9ad=_[_0x043f('0x34')](db[_0x043f('0x35')][_0x043f('0x36')],function(_0x11ab3d){return{'name':_0x11ab3d['fieldName'],'type':_0x11ab3d['type'][_0x043f('0x37')]};});_0x133944[_0x043f('0x38')]=_[_0x043f('0x34')](_0x52d9ad,_0x043f('0x2d'));_0x133944[_0x043f('0x39')]=_['keys'](_0xb73d7b[_0x043f('0x39')]);_0x133944[_0x043f('0x3a')]=_['intersection'](_0x133944[_0x043f('0x38')],_0x133944[_0x043f('0x39')]);_0x44cea4[_0x043f('0x3b')]=_[_0x043f('0x3c')](_0x133944[_0x043f('0x38')],qs[_0x043f('0x3d')](_0xb73d7b[_0x043f('0x39')][_0x043f('0x3d')]));_0x44cea4[_0x043f('0x3b')]=_0x44cea4[_0x043f('0x3b')][_0x043f('0x3e')]?_0x44cea4[_0x043f('0x3b')]:_0x133944[_0x043f('0x38')];if(!_0xb73d7b[_0x043f('0x39')]['hasOwnProperty'](_0x043f('0x3f'))){_0x44cea4[_0x043f('0x1e')]=qs[_0x043f('0x1e')](_0xb73d7b[_0x043f('0x39')][_0x043f('0x1e')]);_0x44cea4[_0x043f('0x1d')]=qs[_0x043f('0x1d')](_0xb73d7b['query'][_0x043f('0x1d')]);}_0x44cea4[_0x043f('0x40')]=qs[_0x043f('0x41')](_0xb73d7b[_0x043f('0x39')][_0x043f('0x41')]);_0x44cea4[_0x043f('0x42')]=qs[_0x043f('0x3a')](_[_0x043f('0x43')](_0xb73d7b['query'],_0x133944[_0x043f('0x3a')]),_0x52d9ad);if(_0xb73d7b[_0x043f('0x39')]['filter']){_0x44cea4[_0x043f('0x42')]=_['merge'](_0x44cea4[_0x043f('0x42')],{'$or':_[_0x043f('0x34')](_0x52d9ad,function(_0x236e47){if(_0x236e47['type']!==_0x043f('0x44')){var _0x3a654d={};_0x3a654d[_0x236e47['name']]={'$like':'%'+_0xb73d7b[_0x043f('0x39')][_0x043f('0x45')]+'%'};return _0x3a654d;}})});}_0x44cea4=_['merge']({},_0x44cea4,_0xb73d7b[_0x043f('0x46')]);var _0x5ee8e5={'where':_0x44cea4['where']};return db[_0x043f('0x35')]['count'](_0x5ee8e5)[_0x043f('0x27')](function(_0x2ccd02){_0x25f681[_0x043f('0x20')]=_0x2ccd02;if(_0xb73d7b[_0x043f('0x39')][_0x043f('0x47')]){_0x44cea4[_0x043f('0x48')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x043f('0x49')](_0x44cea4);})['then'](function(_0x1f0ea6){_0x25f681['rows']=_0x1f0ea6;return _0x25f681;})[_0x043f('0x27')](respondWithFilteredResult(_0x3b8be0,_0x44cea4))[_0x043f('0x4a')](handleError(_0x3b8be0,null));};exports[_0x043f('0x4b')]=function(_0x264a11,_0x5e1252){var _0x3fb850={'raw':!![],'where':{'id':_0x264a11[_0x043f('0x4c')]['id']}},_0x490816={};_0x490816[_0x043f('0x38')]=_[_0x043f('0x4d')](db[_0x043f('0x35')][_0x043f('0x36')]);_0x490816[_0x043f('0x39')]=_[_0x043f('0x4d')](_0x264a11[_0x043f('0x39')]);_0x490816[_0x043f('0x3a')]=_[_0x043f('0x3c')](_0x490816['model'],_0x490816[_0x043f('0x39')]);_0x3fb850['attributes']=_['intersection'](_0x490816[_0x043f('0x38')],qs[_0x043f('0x3d')](_0x264a11[_0x043f('0x39')][_0x043f('0x3d')]));_0x3fb850[_0x043f('0x3b')]=_0x3fb850['attributes'][_0x043f('0x3e')]?_0x3fb850['attributes']:_0x490816[_0x043f('0x38')];if(_0x264a11[_0x043f('0x39')][_0x043f('0x47')]){_0x3fb850[_0x043f('0x48')]=[{'all':!![]}];}_0x3fb850=_['merge']({},_0x3fb850,_0x264a11[_0x043f('0x46')]);return db[_0x043f('0x35')][_0x043f('0x4e')](_0x3fb850)[_0x043f('0x27')](handleEntityNotFound(_0x5e1252,null))[_0x043f('0x27')](respondWithResult(_0x5e1252,null))[_0x043f('0x4a')](handleError(_0x5e1252,null));};exports[_0x043f('0x4f')]=function(_0x5a4e4f,_0xa64898){return db[_0x043f('0x35')][_0x043f('0x4f')](_0x5a4e4f['body'],{})[_0x043f('0x27')](function(_0x49312b){var _0x25ae90=_0x5a4e4f[_0x043f('0x50')][_0x043f('0x28')]({'plain':!![]});if(!_0x25ae90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25ae90[_0x043f('0x51')]===_0x043f('0x50')){var _0xb7cdb9=_0x49312b[_0x043f('0x28')]({'plain':!![]});var _0x53b52f=_0x043f('0x29');return db[_0x043f('0x52')][_0x043f('0x4e')]({'where':{'name':_0x53b52f,'userProfileId':_0x25ae90[_0x043f('0x53')]},'raw':!![]})[_0x043f('0x27')](function(_0x11b534){if(_0x11b534&&_0x11b534['autoAssociation']===0x0){return db[_0x043f('0x2a')]['create']({'name':_0xb7cdb9[_0x043f('0x2d')],'resourceId':_0xb7cdb9['id'],'type':_0x11b534[_0x043f('0x2d')],'sectionId':_0x11b534['id']},{})[_0x043f('0x27')](function(){return _0x49312b;});}else{return _0x49312b;}})[_0x043f('0x4a')](function(_0x19a35a){logger['error'](_0x043f('0x54'),_0x19a35a);throw _0x19a35a;});}return _0x49312b;})['then'](respondWithResult(_0xa64898,0xc9))[_0x043f('0x4a')](handleError(_0xa64898,null));};exports[_0x043f('0x26')]=function(_0x1da715,_0x1a1ecb){if(_0x1da715[_0x043f('0x31')]['id']){delete _0x1da715['body']['id'];}return db[_0x043f('0x35')][_0x043f('0x4e')]({'where':{'id':_0x1da715[_0x043f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a1ecb,null))[_0x043f('0x27')](saveUpdates(_0x1da715[_0x043f('0x31')],null))[_0x043f('0x27')](respondWithResult(_0x1a1ecb,null))[_0x043f('0x4a')](handleError(_0x1a1ecb,null));};exports[_0x043f('0x2b')]=function(_0x43b2a9,_0x2381c6){return db[_0x043f('0x35')][_0x043f('0x4e')]({'where':{'id':_0x43b2a9['params']['id']}})['then'](handleEntityNotFound(_0x2381c6,null))[_0x043f('0x27')](removeEntity(_0x2381c6,null))[_0x043f('0x4a')](handleError(_0x2381c6,null));};exports[_0x043f('0x55')]=function(_0x5a5f3d,_0x23d207,_0x203ada){return db['AnalyticExtractedReport'][_0x043f('0x4e')]({'where':{'id':_0x5a5f3d[_0x043f('0x4c')]['id']},'attributes':['name',_0x043f('0x56'),'savename',_0x043f('0x57')],'raw':!![]})[_0x043f('0x27')](handleEntityNotFound(_0x23d207,null))['then'](function(_0x1c0fe8){if(_0x1c0fe8){if(!fs[_0x043f('0x58')](path[_0x043f('0x59')](config['root'],_0x043f('0x5a'),_0x1c0fe8[_0x043f('0x5b')]))){throw new db[(_0x043f('0x5c'))][(_0x043f('0x5d'))](_0x043f('0x5e'));}if(_0x5a5f3d[_0x043f('0x39')][_0x043f('0x5f')]){return _0x23d207[_0x043f('0x19')](0xc8);}return _0x23d207[_0x043f('0x55')](path[_0x043f('0x59')](config[_0x043f('0x60')],_0x043f('0x5a'),_0x1c0fe8[_0x043f('0x5b')]),util[_0x043f('0x61')](_0x043f('0x62'),_0x1c0fe8[_0x043f('0x56')]||_0x1c0fe8[_0x043f('0x2d')],_0x1c0fe8[_0x043f('0x57')][_0x043f('0x63')]()));}})['catch'](handleError(_0x23d207,null));}; \ No newline at end of file +var _0xb04a=['rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','render','merge','body','message','agent','interaction','account','index','map','AnalyticExtractedReport','fieldName','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','VIRTUAL','options','includeAll','include','rows','catch','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','existsSync','join','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','output','toLowerCase','eml-format'];(function(_0x5a36ce,_0xff2dfb){var _0x589e66=function(_0x559a68){while(--_0x559a68){_0x5a36ce['push'](_0x5a36ce['shift']());}};_0x589e66(++_0xff2dfb);}(_0xb04a,0x1df));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xab04('0x0'));var rimraf=require(_0xab04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xab04('0x2'));var moment=require('moment');var BPromise=require(_0xab04('0x3'));var Mustache=require(_0xab04('0x4'));var util=require(_0xab04('0x5'));var path=require(_0xab04('0x6'));var sox=require('sox');var csv=require(_0xab04('0x7'));var ejs=require(_0xab04('0x8'));var fs=require('fs');var fs_extra=require(_0xab04('0x9'));var _=require(_0xab04('0xa'));var squel=require('squel');var crypto=require(_0xab04('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xab04('0xc'));var toCsv=require(_0xab04('0x7'));var querystring=require('querystring');var Papa=require(_0xab04('0xd'));var Redis=require(_0xab04('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xab04('0xf'));var as=require(_0xab04('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab04('0x11'))(_0xab04('0x12'));var utils=require(_0xab04('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f6589,_0xa66eb){_0xa66eb=_0xa66eb||0xcc;return function(_0x47b6dd){if(_0x47b6dd){return _0x4f6589[_0xab04('0x14')](_0xa66eb);}return _0x4f6589['status'](_0xa66eb)[_0xab04('0x15')]();};}function respondWithResult(_0x43dc85,_0x5cc13f){_0x5cc13f=_0x5cc13f||0xc8;return function(_0x5922ac){if(_0x5922ac){return _0x43dc85[_0xab04('0x16')](_0x5cc13f)[_0xab04('0x17')](_0x5922ac);}};}function respondWithFilteredResult(_0x1967c7,_0x44ed8c){return function(_0x239ea2){if(_0x239ea2){var _0x4a61db=typeof _0x44ed8c[_0xab04('0x18')]===_0xab04('0x19')&&typeof _0x44ed8c[_0xab04('0x1a')]===_0xab04('0x19');var _0x3d7e4d=_0x239ea2[_0xab04('0x1b')];var _0x3756d2=_0x4a61db?0x0:_0x44ed8c[_0xab04('0x18')];var _0x4a2465=_0x4a61db?_0x239ea2[_0xab04('0x1b')]:_0x44ed8c[_0xab04('0x18')]+_0x44ed8c[_0xab04('0x1a')];var _0x3a3371;if(_0x4a2465>=_0x3d7e4d){_0x4a2465=_0x3d7e4d;_0x3a3371=0xc8;}else{_0x3a3371=0xce;}_0x1967c7['status'](_0x3a3371);return _0x1967c7[_0xab04('0x1c')](_0xab04('0x1d'),_0x3756d2+'-'+_0x4a2465+'/'+_0x3d7e4d)[_0xab04('0x17')](_0x239ea2);}return null;};}function patchUpdates(_0x415f3b){return function(_0x431712){try{jsonpatch['apply'](_0x431712,_0x415f3b,!![]);}catch(_0x1d04bd){return BPromise[_0xab04('0x1e')](_0x1d04bd);}return _0x431712[_0xab04('0x1f')]();};}function saveUpdates(_0x2da149,_0x39b1a5){return function(_0x4897d4){if(_0x4897d4){return _0x4897d4[_0xab04('0x20')](_0x2da149)[_0xab04('0x21')](function(_0x268db8){return _0x268db8;});}return null;};}function removeEntity(_0x5733d7,_0xd1b834){return function(_0x106527){if(_0x106527){return _0x106527[_0xab04('0x22')]()['then'](function(){var _0x444412=_0x106527[_0xab04('0x23')]({'plain':!![]});var _0x5c2bca=_0xab04('0x24');return db[_0xab04('0x25')]['destroy']({'where':{'type':_0x5c2bca,'resourceId':_0x444412['id']}})['then'](function(){return _0x106527;});})['then'](function(){_0x5733d7['status'](0xcc)[_0xab04('0x15')]();});}};}function handleEntityNotFound(_0x4bb702,_0x2d4161){return function(_0x1f211c){if(!_0x1f211c){_0x4bb702[_0xab04('0x14')](0x194);}return _0x1f211c;};}function handleError(_0x2ee412,_0xd3d382){_0xd3d382=_0xd3d382||0x1f4;return function(_0x204765){logger[_0xab04('0x26')](_0x204765[_0xab04('0x27')]);if(_0x204765[_0xab04('0x28')]){delete _0x204765[_0xab04('0x28')];}_0x2ee412[_0xab04('0x16')](_0xd3d382)['send'](_0x204765);};}function getMustacheRender(_0x562475,_0x10d6c0){return Mustache[_0xab04('0x29')](_0x562475,_[_0xab04('0x2a')](_0x10d6c0[_0xab04('0x2b')],{'contact':_0x10d6c0['contact'],'message':_0x10d6c0[_0xab04('0x2c')],'agent':_0x10d6c0[_0xab04('0x2d')],'interaction':_0x10d6c0[_0xab04('0x2e')],'account':_0x10d6c0[_0xab04('0x2f')]}))||'';}exports[_0xab04('0x30')]=function(_0xa6cc59,_0x146ca5){var _0x5a704e={},_0x3c55d5={},_0x15bed9={'count':0x0,'rows':[]};var _0x51c87b=_[_0xab04('0x31')](db[_0xab04('0x32')]['rawAttributes'],function(_0x18b2d4){return{'name':_0x18b2d4[_0xab04('0x33')],'type':_0x18b2d4[_0xab04('0x34')]['key']};});_0x3c55d5['model']=_[_0xab04('0x31')](_0x51c87b,_0xab04('0x28'));_0x3c55d5['query']=_[_0xab04('0x35')](_0xa6cc59[_0xab04('0x36')]);_0x3c55d5['filters']=_[_0xab04('0x37')](_0x3c55d5[_0xab04('0x38')],_0x3c55d5['query']);_0x5a704e[_0xab04('0x39')]=_[_0xab04('0x37')](_0x3c55d5[_0xab04('0x38')],qs['fields'](_0xa6cc59[_0xab04('0x36')][_0xab04('0x3a')]));_0x5a704e[_0xab04('0x39')]=_0x5a704e[_0xab04('0x39')][_0xab04('0x3b')]?_0x5a704e[_0xab04('0x39')]:_0x3c55d5[_0xab04('0x38')];if(!_0xa6cc59['query'][_0xab04('0x3c')](_0xab04('0x3d'))){_0x5a704e[_0xab04('0x1a')]=qs[_0xab04('0x1a')](_0xa6cc59[_0xab04('0x36')][_0xab04('0x1a')]);_0x5a704e[_0xab04('0x18')]=qs[_0xab04('0x18')](_0xa6cc59[_0xab04('0x36')][_0xab04('0x18')]);}_0x5a704e[_0xab04('0x3e')]=qs['sort'](_0xa6cc59[_0xab04('0x36')]['sort']);_0x5a704e['where']=qs[_0xab04('0x3f')](_[_0xab04('0x40')](_0xa6cc59[_0xab04('0x36')],_0x3c55d5[_0xab04('0x3f')]),_0x51c87b);if(_0xa6cc59[_0xab04('0x36')][_0xab04('0x41')]){_0x5a704e[_0xab04('0x42')]=_[_0xab04('0x2a')](_0x5a704e[_0xab04('0x42')],{'$or':_[_0xab04('0x31')](_0x51c87b,function(_0xdcdac5){if(_0xdcdac5[_0xab04('0x34')]!==_0xab04('0x43')){var _0xcb05d8={};_0xcb05d8[_0xdcdac5['name']]={'$like':'%'+_0xa6cc59['query'][_0xab04('0x41')]+'%'};return _0xcb05d8;}})});}_0x5a704e=_[_0xab04('0x2a')]({},_0x5a704e,_0xa6cc59[_0xab04('0x44')]);var _0x803f91={'where':_0x5a704e[_0xab04('0x42')]};return db[_0xab04('0x32')][_0xab04('0x1b')](_0x803f91)['then'](function(_0x34d8a6){_0x15bed9[_0xab04('0x1b')]=_0x34d8a6;if(_0xa6cc59[_0xab04('0x36')][_0xab04('0x45')]){_0x5a704e[_0xab04('0x46')]=[{'all':!![]}];}return db[_0xab04('0x32')]['findAll'](_0x5a704e);})[_0xab04('0x21')](function(_0x5159fe){_0x15bed9[_0xab04('0x47')]=_0x5159fe;return _0x15bed9;})['then'](respondWithFilteredResult(_0x146ca5,_0x5a704e))[_0xab04('0x48')](handleError(_0x146ca5,null));};exports['show']=function(_0x109816,_0x55a117){var _0x134159={'raw':!![],'where':{'id':_0x109816['params']['id']}},_0x5c7925={};_0x5c7925[_0xab04('0x38')]=_[_0xab04('0x35')](db[_0xab04('0x32')][_0xab04('0x49')]);_0x5c7925[_0xab04('0x36')]=_[_0xab04('0x35')](_0x109816[_0xab04('0x36')]);_0x5c7925[_0xab04('0x3f')]=_[_0xab04('0x37')](_0x5c7925[_0xab04('0x38')],_0x5c7925[_0xab04('0x36')]);_0x134159[_0xab04('0x39')]=_[_0xab04('0x37')](_0x5c7925['model'],qs[_0xab04('0x3a')](_0x109816[_0xab04('0x36')][_0xab04('0x3a')]));_0x134159[_0xab04('0x39')]=_0x134159[_0xab04('0x39')][_0xab04('0x3b')]?_0x134159[_0xab04('0x39')]:_0x5c7925[_0xab04('0x38')];if(_0x109816['query'][_0xab04('0x45')]){_0x134159[_0xab04('0x46')]=[{'all':!![]}];}_0x134159=_[_0xab04('0x2a')]({},_0x134159,_0x109816[_0xab04('0x44')]);return db[_0xab04('0x32')]['find'](_0x134159)['then'](handleEntityNotFound(_0x55a117,null))[_0xab04('0x21')](respondWithResult(_0x55a117,null))[_0xab04('0x48')](handleError(_0x55a117,null));};exports[_0xab04('0x4a')]=function(_0x569e06,_0xb2e058){return db[_0xab04('0x32')][_0xab04('0x4a')](_0x569e06[_0xab04('0x2b')],{})[_0xab04('0x21')](function(_0xecba2){var _0x4cd278=_0x569e06[_0xab04('0x4b')][_0xab04('0x23')]({'plain':!![]});if(!_0x4cd278)throw new Error(_0xab04('0x4c'));if(_0x4cd278[_0xab04('0x4d')]===_0xab04('0x4b')){var _0x4c7110=_0xecba2[_0xab04('0x23')]({'plain':!![]});var _0xd3a5fb='ExtractedReports';return db['UserProfileSection'][_0xab04('0x4e')]({'where':{'name':_0xd3a5fb,'userProfileId':_0x4cd278['userProfileId']},'raw':!![]})[_0xab04('0x21')](function(_0x36447d){if(_0x36447d&&_0x36447d[_0xab04('0x4f')]===0x0){return db[_0xab04('0x25')][_0xab04('0x4a')]({'name':_0x4c7110[_0xab04('0x28')],'resourceId':_0x4c7110['id'],'type':_0x36447d['name'],'sectionId':_0x36447d['id']},{})[_0xab04('0x21')](function(){return _0xecba2;});}else{return _0xecba2;}})[_0xab04('0x48')](function(_0x3d5a45){logger[_0xab04('0x26')](_0xab04('0x50'),_0x3d5a45);throw _0x3d5a45;});}return _0xecba2;})['then'](respondWithResult(_0xb2e058,0xc9))[_0xab04('0x48')](handleError(_0xb2e058,null));};exports[_0xab04('0x20')]=function(_0x5c0afb,_0x49fae0){if(_0x5c0afb[_0xab04('0x2b')]['id']){delete _0x5c0afb[_0xab04('0x2b')]['id'];}return db[_0xab04('0x32')]['find']({'where':{'id':_0x5c0afb['params']['id']}})[_0xab04('0x21')](handleEntityNotFound(_0x49fae0,null))[_0xab04('0x21')](saveUpdates(_0x5c0afb[_0xab04('0x2b')],null))[_0xab04('0x21')](respondWithResult(_0x49fae0,null))[_0xab04('0x48')](handleError(_0x49fae0,null));};exports[_0xab04('0x22')]=function(_0xa696a8,_0x1475bd){return db[_0xab04('0x32')]['find']({'where':{'id':_0xa696a8[_0xab04('0x51')]['id']}})[_0xab04('0x21')](handleEntityNotFound(_0x1475bd,null))[_0xab04('0x21')](removeEntity(_0x1475bd,null))[_0xab04('0x48')](handleError(_0x1475bd,null));};exports[_0xab04('0x52')]=function(_0x280502,_0x3417ab,_0x4365f1){return db[_0xab04('0x32')]['find']({'where':{'id':_0x280502[_0xab04('0x51')]['id']},'attributes':[_0xab04('0x28'),'basename','savename','output'],'raw':!![]})[_0xab04('0x21')](handleEntityNotFound(_0x3417ab,null))['then'](function(_0x5a1bf1){if(_0x5a1bf1){if(!fs[_0xab04('0x53')](path[_0xab04('0x54')](config['root'],_0xab04('0x55'),_0x5a1bf1[_0xab04('0x56')]))){throw new db[(_0xab04('0x57'))][(_0xab04('0x58'))](_0xab04('0x59'));}if(_0x280502[_0xab04('0x36')][_0xab04('0x5a')]){return _0x3417ab[_0xab04('0x14')](0xc8);}return _0x3417ab[_0xab04('0x52')](path['join'](config[_0xab04('0x5b')],_0xab04('0x55'),_0x5a1bf1[_0xab04('0x56')]),util[_0xab04('0x5c')](_0xab04('0x5d'),_0x5a1bf1['basename']||_0x5a1bf1['name'],_0x5a1bf1[_0xab04('0x5e')][_0xab04('0x5f')]()));}})[_0xab04('0x48')](handleError(_0x3417ab,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 1ff4bf7..bcff5a5 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 _0xf9c3=['request-promise','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xf9c3,0x1db));var _0x3f9c=function(_0x157111,_0x3a9771){_0x157111=_0x157111-0x0;var _0x5b00c4=_0xf9c3[_0x157111];return _0x5b00c4;};'use strict';var _=require(_0x3f9c('0x0'));var util=require(_0x3f9c('0x1'));var logger=require('../../config/logger')(_0x3f9c('0x2'));var moment=require(_0x3f9c('0x3'));var BPromise=require(_0x3f9c('0x4'));var rp=require(_0x3f9c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f9c('0x6'));var config=require('../../config/environment');var attributes=require(_0x3f9c('0x7'));module[_0x3f9c('0x8')]=function(_0x104b16,_0x38d6ae){return _0x104b16[_0x3f9c('0x9')](_0x3f9c('0xa'),attributes,{'tableName':_0x3f9c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5b0=['request-promise','path','rimraf','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','api','moment','bluebird'];(function(_0x24634f,_0x360eef){var _0x475dcf=function(_0x4af5f4){while(--_0x4af5f4){_0x24634f['push'](_0x24634f['shift']());}};_0x475dcf(++_0x360eef);}(_0xa5b0,0x130));var _0x0a5b=function(_0x4853fc,_0x52cd55){_0x4853fc=_0x4853fc-0x0;var _0x23be73=_0xa5b0[_0x4853fc];return _0x23be73;};'use strict';var _=require(_0x0a5b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0a5b('0x1'));var moment=require(_0x0a5b('0x2'));var BPromise=require(_0x0a5b('0x3'));var rp=require(_0x0a5b('0x4'));var fs=require('fs');var path=require(_0x0a5b('0x5'));var rimraf=require(_0x0a5b('0x6'));var config=require('../../config/environment');var attributes=require(_0x0a5b('0x7'));module[_0x0a5b('0x8')]=function(_0x289944,_0x25ca93){return _0x289944['define'](_0x0a5b('0x9'),attributes,{'tableName':_0x0a5b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 559f548..125abc4 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 _0x2ef2=['client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0x2ef2,0x187));var _0x22ef=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x2ef2[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x22ef('0x0'));var util=require('util');var moment=require(_0x22ef('0x1'));var BPromise=require(_0x22ef('0x2'));var rs=require(_0x22ef('0x3'));var fs=require('fs');var Redis=require(_0x22ef('0x4'));var db=require(_0x22ef('0x5'))['db'];var utils=require(_0x22ef('0x6'));var logger=require(_0x22ef('0x7'))(_0x22ef('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x22ef('0x9')][_0x22ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b36da,_0x25e491,_0x23f094){return new BPromise(function(_0x594c59,_0xe3a0c6){return client['request'](_0x2b36da,_0x23f094)[_0x22ef('0xb')](function(_0x22f661){logger[_0x22ef('0xc')](_0x22ef('0xd'),_0x25e491,_0x22ef('0xe'));logger[_0x22ef('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x25e491,'request\x20sent',JSON['stringify'](_0x22f661));if(_0x22f661[_0x22ef('0x10')]){if(_0x22f661['error'][_0x22ef('0x11')]===0x1f4){logger['error'](_0x22ef('0xd'),_0x25e491,_0x22f661[_0x22ef('0x10')]['message']);return _0xe3a0c6(_0x22f661[_0x22ef('0x10')][_0x22ef('0x12')]);}logger[_0x22ef('0x10')](_0x22ef('0xd'),_0x25e491,_0x22f661[_0x22ef('0x10')]['message']);return _0x594c59(_0x22f661['error'][_0x22ef('0x12')]);}else{logger[_0x22ef('0xc')](_0x22ef('0xd'),_0x25e491,_0x22ef('0xe'));_0x594c59(_0x22f661['result'][_0x22ef('0x12')]);}})[_0x22ef('0x13')](function(_0x1a0764){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x25e491,_0x1a0764);_0xe3a0c6(_0x1a0764);});});} \ No newline at end of file +var _0xd86d=['../../config/utils','../../config/environment','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','AnalyticExtractedReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x202a78,_0x753c8b){var _0x14dabf=function(_0x3f57bc){while(--_0x3f57bc){_0x202a78['push'](_0x202a78['shift']());}};_0x14dabf(++_0x753c8b);}(_0xd86d,0x189));var _0xdd86=function(_0x1f9d32,_0x2dcdaa){_0x1f9d32=_0x1f9d32-0x0;var _0x4c2205=_0xd86d[_0x1f9d32];return _0x4c2205;};'use strict';var _=require(_0xdd86('0x0'));var util=require(_0xdd86('0x1'));var moment=require(_0xdd86('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd86('0x3'));var fs=require('fs');var Redis=require(_0xdd86('0x4'));var db=require(_0xdd86('0x5'))['db'];var utils=require(_0xdd86('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdd86('0x7'));var jayson=require(_0xdd86('0x8'));var client=jayson['client'][_0xdd86('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x542c44,_0x391c2b,_0x53ddb8){return new BPromise(function(_0x3f57c8,_0xb58d22){return client[_0xdd86('0xa')](_0x542c44,_0x53ddb8)['then'](function(_0x2d9edb){logger[_0xdd86('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x391c2b,'request\x20sent');logger['debug'](_0xdd86('0xc'),_0x391c2b,'request\x20sent',JSON['stringify'](_0x2d9edb));if(_0x2d9edb[_0xdd86('0xd')]){if(_0x2d9edb['error']['code']===0x1f4){logger['error'](_0xdd86('0xe'),_0x391c2b,_0x2d9edb[_0xdd86('0xd')][_0xdd86('0xf')]);return _0xb58d22(_0x2d9edb[_0xdd86('0xd')][_0xdd86('0xf')]);}logger['error'](_0xdd86('0xe'),_0x391c2b,_0x2d9edb[_0xdd86('0xd')][_0xdd86('0xf')]);return _0x3f57c8(_0x2d9edb['error'][_0xdd86('0xf')]);}else{logger[_0xdd86('0xb')](_0xdd86('0xe'),_0x391c2b,_0xdd86('0x10'));_0x3f57c8(_0x2d9edb[_0xdd86('0x11')][_0xdd86('0xf')]);}})[_0xdd86('0x12')](function(_0x15636d){logger[_0xdd86('0xd')](_0xdd86('0xe'),_0x391c2b,_0x15636d);_0xb58d22(_0x15636d);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 2ca754c..584a0a0 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 _0x4be0=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post'];(function(_0x24a4be,_0x2cac64){var _0xf7e46c=function(_0x467bab){while(--_0x467bab){_0x24a4be['push'](_0x24a4be['shift']());}};_0xf7e46c(++_0x2cac64);}(_0x4be0,0x9e));var _0x04be=function(_0x516cee,_0x262a39){_0x516cee=_0x516cee-0x0;var _0x56d2be=_0x4be0[_0x516cee];return _0x56d2be;};'use strict';var multer=require(_0x04be('0x0'));var util=require(_0x04be('0x1'));var path=require(_0x04be('0x2'));var timeout=require(_0x04be('0x3'));var express=require(_0x04be('0x4'));var router=express[_0x04be('0x5')]();var fs_extra=require(_0x04be('0x6'));var auth=require(_0x04be('0x7'));var interaction=require(_0x04be('0x8'));var config=require(_0x04be('0x9'));var controller=require('./analyticExtractedReport.controller');router[_0x04be('0xa')]('/',auth[_0x04be('0xb')](),controller[_0x04be('0xc')]);router[_0x04be('0xa')](_0x04be('0xd'),auth[_0x04be('0xb')](),controller[_0x04be('0xe')]);router[_0x04be('0xa')](_0x04be('0xf'),auth['isAuthenticated'](),controller[_0x04be('0x10')]);router[_0x04be('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x04be('0x12')](_0x04be('0xd'),auth[_0x04be('0xb')](),controller[_0x04be('0x13')]);router['delete']('/:id',auth[_0x04be('0xb')](),controller[_0x04be('0x14')]);module[_0x04be('0x15')]=router; \ No newline at end of file +var _0x175c=['fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1aa56a,_0x56f0df){var _0x1195d7=function(_0x2eb851){while(--_0x2eb851){_0x1aa56a['push'](_0x1aa56a['shift']());}};_0x1195d7(++_0x56f0df);}(_0x175c,0x1b5));var _0xc175=function(_0x5b59ab,_0x1f6d5c){_0x5b59ab=_0x5b59ab-0x0;var _0x27cc47=_0x175c[_0x5b59ab];return _0x27cc47;};'use strict';var multer=require(_0xc175('0x0'));var util=require('util');var path=require(_0xc175('0x1'));var timeout=require(_0xc175('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc175('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc175('0x4'));var config=require(_0xc175('0x5'));var controller=require(_0xc175('0x6'));router[_0xc175('0x7')]('/',auth['isAuthenticated'](),controller[_0xc175('0x8')]);router[_0xc175('0x7')](_0xc175('0x9'),auth[_0xc175('0xa')](),controller['show']);router[_0xc175('0x7')](_0xc175('0xb'),auth[_0xc175('0xa')](),controller[_0xc175('0xc')]);router[_0xc175('0xd')]('/',auth[_0xc175('0xa')](),controller[_0xc175('0xe')]);router[_0xc175('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc175('0x10')]);router[_0xc175('0x11')](_0xc175('0x9'),auth[_0xc175('0xa')](),controller[_0xc175('0x12')]);module[_0xc175('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 62afdaf..ef820dd 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 _0xe14b=['sequelize','exports','STRING'];(function(_0x5bd0f1,_0x567887){var _0x17838c=function(_0xc89a6a){while(--_0xc89a6a){_0x5bd0f1['push'](_0x5bd0f1['shift']());}};_0x17838c(++_0x567887);}(_0xe14b,0x93));var _0xbe14=function(_0x4c8d54,_0x446909){_0x4c8d54=_0x4c8d54-0x0;var _0x1b1ef0=_0xe14b[_0x4c8d54];return _0x1b1ef0;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING'];(function(_0x161797,_0x26668a){var _0x46f893=function(_0x5d5112){while(--_0x5d5112){_0x161797['push'](_0x161797['shift']());}};_0x46f893(++_0x26668a);}(_0xe14b,0x93));var _0xbe14=function(_0xde0ad0,_0x198d2e){_0xde0ad0=_0xde0ad0-0x0;var _0x5b11b0=_0xe14b[_0xde0ad0];return _0x5b11b0;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'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 e56ff79..195f236 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 _0x55bd=['apply','save','destroy','then','status','error','name','render','body','message','agent','interaction','index','map','AnalyticFieldReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','include','find','catch','create','update','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','set','Content-Range'];(function(_0x16f6ed,_0x2690ec){var _0x22cb8c=function(_0x58eb94){while(--_0x58eb94){_0x16f6ed['push'](_0x16f6ed['shift']());}};_0x22cb8c(++_0x2690ec);}(_0x55bd,0x8c));var _0xd55b=function(_0x226345,_0x1e16fe){_0x226345=_0x226345-0x0;var _0x2ca077=_0x55bd[_0x226345];return _0x2ca077;};'use strict';var emlformat=require(_0xd55b('0x0'));var rimraf=require(_0xd55b('0x1'));var zipdir=require(_0xd55b('0x2'));var jsonpatch=require(_0xd55b('0x3'));var rp=require(_0xd55b('0x4'));var moment=require('moment');var BPromise=require(_0xd55b('0x5'));var Mustache=require('mustache');var util=require(_0xd55b('0x6'));var path=require(_0xd55b('0x7'));var sox=require(_0xd55b('0x8'));var csv=require('to-csv');var ejs=require(_0xd55b('0x9'));var fs=require('fs');var fs_extra=require(_0xd55b('0xa'));var _=require(_0xd55b('0xb'));var squel=require(_0xd55b('0xc'));var crypto=require(_0xd55b('0xd'));var jsforce=require(_0xd55b('0xe'));var deskjs=require(_0xd55b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd55b('0x10'));var authService=require(_0xd55b('0x11'));var qs=require(_0xd55b('0x12'));var as=require(_0xd55b('0x13'));var hardwareService=require(_0xd55b('0x14'));var logger=require(_0xd55b('0x15'))(_0xd55b('0x16'));var utils=require(_0xd55b('0x17'));var config=require(_0xd55b('0x18'));var licenseUtil=require(_0xd55b('0x19'));var db=require(_0xd55b('0x1a'))['db'];function respondWithStatusCode(_0x544b96,_0x1d0e5c){_0x1d0e5c=_0x1d0e5c||0xcc;return function(_0x4c8647){if(_0x4c8647){return _0x544b96[_0xd55b('0x1b')](_0x1d0e5c);}return _0x544b96['status'](_0x1d0e5c)['end']();};}function respondWithResult(_0x28b43c,_0x4bd0fd){_0x4bd0fd=_0x4bd0fd||0xc8;return function(_0x26713b){if(_0x26713b){return _0x28b43c['status'](_0x4bd0fd)[_0xd55b('0x1c')](_0x26713b);}};}function respondWithFilteredResult(_0x443077,_0x35135c){return function(_0x270de6){if(_0x270de6){var _0x1339be=typeof _0x35135c[_0xd55b('0x1d')]===_0xd55b('0x1e')&&typeof _0x35135c['limit']===_0xd55b('0x1e');var _0x4a9e85=_0x270de6[_0xd55b('0x1f')];var _0x3b8e65=_0x1339be?0x0:_0x35135c[_0xd55b('0x1d')];var _0x346345=_0x1339be?_0x270de6[_0xd55b('0x1f')]:_0x35135c[_0xd55b('0x1d')]+_0x35135c['limit'];var _0x232c2d;if(_0x346345>=_0x4a9e85){_0x346345=_0x4a9e85;_0x232c2d=0xc8;}else{_0x232c2d=0xce;}_0x443077['status'](_0x232c2d);return _0x443077[_0xd55b('0x20')](_0xd55b('0x21'),_0x3b8e65+'-'+_0x346345+'/'+_0x4a9e85)[_0xd55b('0x1c')](_0x270de6);}return null;};}function patchUpdates(_0x2efbbf){return function(_0x4c6955){try{jsonpatch[_0xd55b('0x22')](_0x4c6955,_0x2efbbf,!![]);}catch(_0x357da){return BPromise['reject'](_0x357da);}return _0x4c6955[_0xd55b('0x23')]();};}function saveUpdates(_0x5ce595,_0xab86b4){return function(_0x6f1b){if(_0x6f1b){return _0x6f1b['update'](_0x5ce595)['then'](function(_0x26df23){return _0x26df23;});}return null;};}function removeEntity(_0x46649a,_0x3c202f){return function(_0x11f265){if(_0x11f265){return _0x11f265[_0xd55b('0x24')]()[_0xd55b('0x25')](function(){_0x46649a[_0xd55b('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ff02e,_0x5f698f){return function(_0x1e3e52){if(!_0x1e3e52){_0x4ff02e['sendStatus'](0x194);}return _0x1e3e52;};}function handleError(_0x23d194,_0x19f2dd){_0x19f2dd=_0x19f2dd||0x1f4;return function(_0x408aea){logger[_0xd55b('0x27')](_0x408aea['stack']);if(_0x408aea[_0xd55b('0x28')]){delete _0x408aea[_0xd55b('0x28')];}_0x23d194[_0xd55b('0x26')](_0x19f2dd)['send'](_0x408aea);};}function getMustacheRender(_0x4a7732,_0x2caf7c){return Mustache[_0xd55b('0x29')](_0x4a7732,_['merge'](_0x2caf7c[_0xd55b('0x2a')],{'contact':_0x2caf7c['contact'],'message':_0x2caf7c[_0xd55b('0x2b')],'agent':_0x2caf7c[_0xd55b('0x2c')],'interaction':_0x2caf7c[_0xd55b('0x2d')],'account':_0x2caf7c['account']}))||'';}exports[_0xd55b('0x2e')]=function(_0x347051,_0x5b261d){var _0x474fba={},_0x551e2f={},_0x4b6237={'count':0x0,'rows':[]};var _0x3caa0c=_[_0xd55b('0x2f')](db[_0xd55b('0x30')][_0xd55b('0x31')],function(_0x4771a3){return{'name':_0x4771a3['fieldName'],'type':_0x4771a3[_0xd55b('0x32')][_0xd55b('0x33')]};});_0x551e2f[_0xd55b('0x34')]=_[_0xd55b('0x2f')](_0x3caa0c,_0xd55b('0x28'));_0x551e2f['query']=_[_0xd55b('0x35')](_0x347051[_0xd55b('0x36')]);_0x551e2f[_0xd55b('0x37')]=_[_0xd55b('0x38')](_0x551e2f[_0xd55b('0x34')],_0x551e2f['query']);_0x474fba[_0xd55b('0x39')]=_['intersection'](_0x551e2f[_0xd55b('0x34')],qs[_0xd55b('0x3a')](_0x347051[_0xd55b('0x36')][_0xd55b('0x3a')]));_0x474fba[_0xd55b('0x39')]=_0x474fba[_0xd55b('0x39')][_0xd55b('0x3b')]?_0x474fba['attributes']:_0x551e2f[_0xd55b('0x34')];if(!_0x347051[_0xd55b('0x36')][_0xd55b('0x3c')](_0xd55b('0x3d'))){_0x474fba[_0xd55b('0x3e')]=qs['limit'](_0x347051[_0xd55b('0x36')][_0xd55b('0x3e')]);_0x474fba['offset']=qs[_0xd55b('0x1d')](_0x347051[_0xd55b('0x36')][_0xd55b('0x1d')]);}_0x474fba[_0xd55b('0x3f')]=qs[_0xd55b('0x40')](_0x347051[_0xd55b('0x36')][_0xd55b('0x40')]);_0x474fba['where']=qs[_0xd55b('0x37')](_[_0xd55b('0x41')](_0x347051['query'],_0x551e2f[_0xd55b('0x37')]),_0x3caa0c);if(_0x347051[_0xd55b('0x36')][_0xd55b('0x42')]){_0x474fba[_0xd55b('0x43')]=_[_0xd55b('0x44')](_0x474fba[_0xd55b('0x43')],{'$or':_[_0xd55b('0x2f')](_0x3caa0c,function(_0x12fb35){if(_0x12fb35[_0xd55b('0x32')]!==_0xd55b('0x45')){var _0x1867c5={};_0x1867c5[_0x12fb35[_0xd55b('0x28')]]={'$like':'%'+_0x347051['query'][_0xd55b('0x42')]+'%'};return _0x1867c5;}})});}_0x474fba=_[_0xd55b('0x44')]({},_0x474fba,_0x347051[_0xd55b('0x46')]);var _0x281403={'where':_0x474fba[_0xd55b('0x43')]};return db[_0xd55b('0x30')][_0xd55b('0x1f')](_0x281403)[_0xd55b('0x25')](function(_0x218f7f){_0x4b6237['count']=_0x218f7f;if(_0x347051[_0xd55b('0x36')][_0xd55b('0x47')]){_0x474fba['include']=[{'all':!![]}];}return db[_0xd55b('0x30')][_0xd55b('0x48')](_0x474fba);})[_0xd55b('0x25')](function(_0x12303e){_0x4b6237['rows']=_0x12303e;return _0x4b6237;})[_0xd55b('0x25')](respondWithFilteredResult(_0x5b261d,_0x474fba))['catch'](handleError(_0x5b261d,null));};exports[_0xd55b('0x49')]=function(_0x3cfb80,_0x44ac06){var _0x29715a={'raw':![],'where':{'id':_0x3cfb80['params']['id']}},_0x9a9193={};_0x9a9193[_0xd55b('0x34')]=_[_0xd55b('0x35')](db['AnalyticFieldReport'][_0xd55b('0x31')]);_0x9a9193[_0xd55b('0x36')]=_[_0xd55b('0x35')](_0x3cfb80['query']);_0x9a9193['filters']=_[_0xd55b('0x38')](_0x9a9193[_0xd55b('0x34')],_0x9a9193['query']);_0x29715a[_0xd55b('0x39')]=_[_0xd55b('0x38')](_0x9a9193[_0xd55b('0x34')],qs[_0xd55b('0x3a')](_0x3cfb80['query']['fields']));_0x29715a['attributes']=_0x29715a[_0xd55b('0x39')][_0xd55b('0x3b')]?_0x29715a['attributes']:_0x9a9193[_0xd55b('0x34')];if(_0x3cfb80['query'][_0xd55b('0x47')]){_0x29715a[_0xd55b('0x4a')]=[{'all':!![]}];}_0x29715a=_[_0xd55b('0x44')]({},_0x29715a,_0x3cfb80[_0xd55b('0x46')]);return db[_0xd55b('0x30')][_0xd55b('0x4b')](_0x29715a)[_0xd55b('0x25')](handleEntityNotFound(_0x44ac06,null))[_0xd55b('0x25')](respondWithResult(_0x44ac06,null))[_0xd55b('0x4c')](handleError(_0x44ac06,null));};exports[_0xd55b('0x4d')]=function(_0x7c2c5f,_0xbfc3c8){return db['AnalyticFieldReport']['create'](_0x7c2c5f['body'],{})['then'](respondWithResult(_0xbfc3c8,0xc9))[_0xd55b('0x4c')](handleError(_0xbfc3c8,null));};exports['bulkCreate']=function(_0x52ff89,_0x179872){return db[_0xd55b('0x30')]['bulkCreate'](_0x52ff89[_0xd55b('0x2a')],{'raw':![],'individualHooks':!![]})[_0xd55b('0x25')](respondWithResult(_0x179872,0xc9))[_0xd55b('0x4c')](handleError(_0x179872,null));};exports[_0xd55b('0x4e')]=function(_0x1ca25f,_0x3134e2){if(_0x1ca25f[_0xd55b('0x2a')]['id']){delete _0x1ca25f['body']['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x1ca25f[_0xd55b('0x4f')]['id']}})[_0xd55b('0x25')](handleEntityNotFound(_0x3134e2,null))[_0xd55b('0x25')](saveUpdates(_0x1ca25f['body'],null))[_0xd55b('0x25')](respondWithResult(_0x3134e2,null))[_0xd55b('0x4c')](handleError(_0x3134e2,null));};exports[_0xd55b('0x24')]=function(_0x3f0821,_0x2a1ca5){return db[_0xd55b('0x30')]['find']({'where':{'id':_0x3f0821[_0xd55b('0x4f')]['id']}})[_0xd55b('0x25')](handleEntityNotFound(_0x2a1ca5,null))['then'](removeEntity(_0x2a1ca5,null))[_0xd55b('0x4c')](handleError(_0x2a1ca5,null));};exports[_0xd55b('0x50')]=function(_0x1faa99,_0x312c5f){return db['AnalyticFieldReport'][_0xd55b('0x24')]({'where':{'id':_0x1faa99[_0xd55b('0x36')][_0xd55b('0x51')]||[]},'raw':![],'individualHooks':!![]})[_0xd55b('0x25')](respondWithResult(_0x312c5f,0xcc))[_0xd55b('0x4c')](handleError(_0x312c5f,null));};exports[_0xd55b('0x52')]=function(_0xff224e,_0x28e59b,_0x343d09){return db[_0xd55b('0x53')]['findOne']({'where':{'id':_0xff224e[_0xd55b('0x4f')]['id']}})[_0xd55b('0x25')](handleEntityNotFound(_0x28e59b,null))[_0xd55b('0x25')](function(_0x2fa1c5){if(_0x2fa1c5){return db[_0xd55b('0x54')][_0xd55b('0x55')](function(_0x3bf6c8){return db[_0xd55b('0x30')][_0xd55b('0x24')]({'where':{'CustomReportId':_0xff224e[_0xd55b('0x4f')]['id']},'transaction':_0x3bf6c8})[_0xd55b('0x25')](function(_0x221ff7){var _0x2df510=_['map'](_0xff224e[_0xd55b('0x2a')],function(_0x59cbd0){delete _0x59cbd0['id'];_0x59cbd0[_0xd55b('0x56')]=_0xff224e['params']['id'];return _0x59cbd0;});return db['AnalyticFieldReport']['bulkCreate'](_0x2df510,{'transaction':_0x3bf6c8});});})[_0xd55b('0x25')](function(){return db[_0xd55b('0x30')][_0xd55b('0x48')]({'where':{'CustomReportId':_0xff224e['params']['id']}});});}})[_0xd55b('0x25')](respondWithResult(_0x28e59b,null))[_0xd55b('0x4c')](handleError(_0x28e59b,null));}; \ No newline at end of file +var _0x230e=['../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','offset','limit','undefined','count','set','apply','save','update','then','destroy','end','stack','name','send','merge','body','message','agent','interaction','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','catch','show','params','keys','find','create','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x5bc4f4,_0x294bcd){var _0x4979cb=function(_0x45b37f){while(--_0x45b37f){_0x5bc4f4['push'](_0x5bc4f4['shift']());}};_0x4979cb(++_0x294bcd);}(_0x230e,0x1da));var _0xe230=function(_0x542e0a,_0x1d2021){_0x542e0a=_0x542e0a-0x0;var _0x195b71=_0x230e[_0x542e0a];return _0x195b71;};'use strict';var emlformat=require(_0xe230('0x0'));var rimraf=require(_0xe230('0x1'));var zipdir=require(_0xe230('0x2'));var jsonpatch=require(_0xe230('0x3'));var rp=require(_0xe230('0x4'));var moment=require(_0xe230('0x5'));var BPromise=require(_0xe230('0x6'));var Mustache=require('mustache');var util=require(_0xe230('0x7'));var path=require(_0xe230('0x8'));var sox=require('sox');var csv=require(_0xe230('0x9'));var ejs=require(_0xe230('0xa'));var fs=require('fs');var fs_extra=require(_0xe230('0xb'));var _=require('lodash');var squel=require(_0xe230('0xc'));var crypto=require('crypto');var jsforce=require(_0xe230('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe230('0x9'));var querystring=require('querystring');var Papa=require(_0xe230('0xe'));var Redis=require(_0xe230('0xf'));var authService=require(_0xe230('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe230('0x11'));var hardwareService=require(_0xe230('0x12'));var logger=require(_0xe230('0x13'))(_0xe230('0x14'));var utils=require(_0xe230('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaf6d6a,_0x487184){_0x487184=_0x487184||0xcc;return function(_0x2fb5fd){if(_0x2fb5fd){return _0xaf6d6a[_0xe230('0x16')](_0x487184);}return _0xaf6d6a[_0xe230('0x17')](_0x487184)['end']();};}function respondWithResult(_0x1dd3a6,_0x15235e){_0x15235e=_0x15235e||0xc8;return function(_0x3d2cfc){if(_0x3d2cfc){return _0x1dd3a6[_0xe230('0x17')](_0x15235e)['json'](_0x3d2cfc);}};}function respondWithFilteredResult(_0x54f947,_0x5ef615){return function(_0x348292){if(_0x348292){var _0x35a7c4=typeof _0x5ef615[_0xe230('0x18')]==='undefined'&&typeof _0x5ef615[_0xe230('0x19')]===_0xe230('0x1a');var _0xd91943=_0x348292['count'];var _0x2b636d=_0x35a7c4?0x0:_0x5ef615[_0xe230('0x18')];var _0x2fc2ef=_0x35a7c4?_0x348292[_0xe230('0x1b')]:_0x5ef615['offset']+_0x5ef615[_0xe230('0x19')];var _0x1cf1fc;if(_0x2fc2ef>=_0xd91943){_0x2fc2ef=_0xd91943;_0x1cf1fc=0xc8;}else{_0x1cf1fc=0xce;}_0x54f947['status'](_0x1cf1fc);return _0x54f947[_0xe230('0x1c')]('Content-Range',_0x2b636d+'-'+_0x2fc2ef+'/'+_0xd91943)['json'](_0x348292);}return null;};}function patchUpdates(_0x248708){return function(_0x55e3bf){try{jsonpatch[_0xe230('0x1d')](_0x55e3bf,_0x248708,!![]);}catch(_0x48bf0e){return BPromise['reject'](_0x48bf0e);}return _0x55e3bf[_0xe230('0x1e')]();};}function saveUpdates(_0x487a94,_0x4f618d){return function(_0x3bcaa9){if(_0x3bcaa9){return _0x3bcaa9[_0xe230('0x1f')](_0x487a94)[_0xe230('0x20')](function(_0x53b8cf){return _0x53b8cf;});}return null;};}function removeEntity(_0x2d3f13,_0x49c2ee){return function(_0x48922f){if(_0x48922f){return _0x48922f[_0xe230('0x21')]()[_0xe230('0x20')](function(){_0x2d3f13[_0xe230('0x17')](0xcc)[_0xe230('0x22')]();});}};}function handleEntityNotFound(_0x2160a8,_0x74a757){return function(_0x28c359){if(!_0x28c359){_0x2160a8['sendStatus'](0x194);}return _0x28c359;};}function handleError(_0x7b3911,_0xb7dd02){_0xb7dd02=_0xb7dd02||0x1f4;return function(_0x29ee9c){logger['error'](_0x29ee9c[_0xe230('0x23')]);if(_0x29ee9c[_0xe230('0x24')]){delete _0x29ee9c[_0xe230('0x24')];}_0x7b3911[_0xe230('0x17')](_0xb7dd02)[_0xe230('0x25')](_0x29ee9c);};}function getMustacheRender(_0x23b8e3,_0x5989a6){return Mustache['render'](_0x23b8e3,_[_0xe230('0x26')](_0x5989a6[_0xe230('0x27')],{'contact':_0x5989a6['contact'],'message':_0x5989a6[_0xe230('0x28')],'agent':_0x5989a6[_0xe230('0x29')],'interaction':_0x5989a6[_0xe230('0x2a')],'account':_0x5989a6['account']}))||'';}exports[_0xe230('0x2b')]=function(_0x23adf7,_0x25c5a2){var _0x4935c4={},_0x3f658e={},_0x56f444={'count':0x0,'rows':[]};var _0x5bfe94=_[_0xe230('0x2c')](db[_0xe230('0x2d')][_0xe230('0x2e')],function(_0xd5036){return{'name':_0xd5036[_0xe230('0x2f')],'type':_0xd5036[_0xe230('0x30')][_0xe230('0x31')]};});_0x3f658e['model']=_[_0xe230('0x2c')](_0x5bfe94,_0xe230('0x24'));_0x3f658e[_0xe230('0x32')]=_['keys'](_0x23adf7['query']);_0x3f658e[_0xe230('0x33')]=_[_0xe230('0x34')](_0x3f658e['model'],_0x3f658e[_0xe230('0x32')]);_0x4935c4[_0xe230('0x35')]=_[_0xe230('0x34')](_0x3f658e[_0xe230('0x36')],qs[_0xe230('0x37')](_0x23adf7[_0xe230('0x32')]['fields']));_0x4935c4['attributes']=_0x4935c4[_0xe230('0x35')][_0xe230('0x38')]?_0x4935c4[_0xe230('0x35')]:_0x3f658e['model'];if(!_0x23adf7['query'][_0xe230('0x39')](_0xe230('0x3a'))){_0x4935c4['limit']=qs[_0xe230('0x19')](_0x23adf7[_0xe230('0x32')][_0xe230('0x19')]);_0x4935c4[_0xe230('0x18')]=qs['offset'](_0x23adf7[_0xe230('0x32')][_0xe230('0x18')]);}_0x4935c4[_0xe230('0x3b')]=qs[_0xe230('0x3c')](_0x23adf7[_0xe230('0x32')][_0xe230('0x3c')]);_0x4935c4[_0xe230('0x3d')]=qs['filters'](_['pick'](_0x23adf7[_0xe230('0x32')],_0x3f658e['filters']),_0x5bfe94);if(_0x23adf7[_0xe230('0x32')][_0xe230('0x3e')]){_0x4935c4[_0xe230('0x3d')]=_[_0xe230('0x26')](_0x4935c4[_0xe230('0x3d')],{'$or':_['map'](_0x5bfe94,function(_0x5a7d2c){if(_0x5a7d2c[_0xe230('0x30')]!=='VIRTUAL'){var _0x5f0e88={};_0x5f0e88[_0x5a7d2c[_0xe230('0x24')]]={'$like':'%'+_0x23adf7[_0xe230('0x32')][_0xe230('0x3e')]+'%'};return _0x5f0e88;}})});}_0x4935c4=_[_0xe230('0x26')]({},_0x4935c4,_0x23adf7[_0xe230('0x3f')]);var _0xc912cb={'where':_0x4935c4[_0xe230('0x3d')]};return db['AnalyticFieldReport'][_0xe230('0x1b')](_0xc912cb)[_0xe230('0x20')](function(_0xe94841){_0x56f444[_0xe230('0x1b')]=_0xe94841;if(_0x23adf7[_0xe230('0x32')][_0xe230('0x40')]){_0x4935c4[_0xe230('0x41')]=[{'all':!![]}];}return db[_0xe230('0x2d')]['findAll'](_0x4935c4);})[_0xe230('0x20')](function(_0x2cf70d){_0x56f444['rows']=_0x2cf70d;return _0x56f444;})[_0xe230('0x20')](respondWithFilteredResult(_0x25c5a2,_0x4935c4))[_0xe230('0x42')](handleError(_0x25c5a2,null));};exports[_0xe230('0x43')]=function(_0x3b5f87,_0x1b513d){var _0x5a5fff={'raw':![],'where':{'id':_0x3b5f87[_0xe230('0x44')]['id']}},_0x3e9f58={};_0x3e9f58[_0xe230('0x36')]=_[_0xe230('0x45')](db['AnalyticFieldReport'][_0xe230('0x2e')]);_0x3e9f58[_0xe230('0x32')]=_[_0xe230('0x45')](_0x3b5f87[_0xe230('0x32')]);_0x3e9f58[_0xe230('0x33')]=_[_0xe230('0x34')](_0x3e9f58[_0xe230('0x36')],_0x3e9f58['query']);_0x5a5fff[_0xe230('0x35')]=_[_0xe230('0x34')](_0x3e9f58['model'],qs['fields'](_0x3b5f87[_0xe230('0x32')][_0xe230('0x37')]));_0x5a5fff[_0xe230('0x35')]=_0x5a5fff[_0xe230('0x35')][_0xe230('0x38')]?_0x5a5fff[_0xe230('0x35')]:_0x3e9f58[_0xe230('0x36')];if(_0x3b5f87['query'][_0xe230('0x40')]){_0x5a5fff[_0xe230('0x41')]=[{'all':!![]}];}_0x5a5fff=_[_0xe230('0x26')]({},_0x5a5fff,_0x3b5f87[_0xe230('0x3f')]);return db[_0xe230('0x2d')][_0xe230('0x46')](_0x5a5fff)[_0xe230('0x20')](handleEntityNotFound(_0x1b513d,null))[_0xe230('0x20')](respondWithResult(_0x1b513d,null))[_0xe230('0x42')](handleError(_0x1b513d,null));};exports[_0xe230('0x47')]=function(_0x5024d2,_0x5680d9){return db['AnalyticFieldReport'][_0xe230('0x47')](_0x5024d2[_0xe230('0x27')],{})[_0xe230('0x20')](respondWithResult(_0x5680d9,0xc9))[_0xe230('0x42')](handleError(_0x5680d9,null));};exports['bulkCreate']=function(_0x367f19,_0x31eca5){return db[_0xe230('0x2d')][_0xe230('0x48')](_0x367f19[_0xe230('0x27')],{'raw':![],'individualHooks':!![]})[_0xe230('0x20')](respondWithResult(_0x31eca5,0xc9))[_0xe230('0x42')](handleError(_0x31eca5,null));};exports[_0xe230('0x1f')]=function(_0x53094f,_0x869f81){if(_0x53094f['body']['id']){delete _0x53094f['body']['id'];}return db[_0xe230('0x2d')][_0xe230('0x46')]({'where':{'id':_0x53094f[_0xe230('0x44')]['id']}})[_0xe230('0x20')](handleEntityNotFound(_0x869f81,null))[_0xe230('0x20')](saveUpdates(_0x53094f['body'],null))[_0xe230('0x20')](respondWithResult(_0x869f81,null))[_0xe230('0x42')](handleError(_0x869f81,null));};exports[_0xe230('0x21')]=function(_0x48b122,_0x86eeba){return db[_0xe230('0x2d')][_0xe230('0x46')]({'where':{'id':_0x48b122[_0xe230('0x44')]['id']}})[_0xe230('0x20')](handleEntityNotFound(_0x86eeba,null))['then'](removeEntity(_0x86eeba,null))['catch'](handleError(_0x86eeba,null));};exports[_0xe230('0x49')]=function(_0x4b1147,_0x5cc75c){return db[_0xe230('0x2d')][_0xe230('0x21')]({'where':{'id':_0x4b1147[_0xe230('0x32')][_0xe230('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xe230('0x20')](respondWithResult(_0x5cc75c,0xcc))[_0xe230('0x42')](handleError(_0x5cc75c,null));};exports[_0xe230('0x4b')]=function(_0xef18e5,_0x21f57f,_0xd29ba4){return db[_0xe230('0x4c')][_0xe230('0x4d')]({'where':{'id':_0xef18e5[_0xe230('0x44')]['id']}})['then'](handleEntityNotFound(_0x21f57f,null))['then'](function(_0x3ec6c0){if(_0x3ec6c0){return db[_0xe230('0x4e')][_0xe230('0x4f')](function(_0x4777f8){return db[_0xe230('0x2d')][_0xe230('0x21')]({'where':{'CustomReportId':_0xef18e5[_0xe230('0x44')]['id']},'transaction':_0x4777f8})['then'](function(_0x38020d){var _0x43177e=_[_0xe230('0x2c')](_0xef18e5[_0xe230('0x27')],function(_0x5a190b){delete _0x5a190b['id'];_0x5a190b[_0xe230('0x50')]=_0xef18e5[_0xe230('0x44')]['id'];return _0x5a190b;});return db[_0xe230('0x2d')][_0xe230('0x48')](_0x43177e,{'transaction':_0x4777f8});});})[_0xe230('0x20')](function(){return db[_0xe230('0x2d')][_0xe230('0x51')]({'where':{'CustomReportId':_0xef18e5['params']['id']}});});}})[_0xe230('0x20')](respondWithResult(_0x21f57f,null))[_0xe230('0x42')](handleError(_0x21f57f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f7030e5..0bb9abb 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 _0x399c=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','lodash','util'];(function(_0x57c3ab,_0x353af9){var _0x5dba29=function(_0x2848f9){while(--_0x2848f9){_0x57c3ab['push'](_0x57c3ab['shift']());}};_0x5dba29(++_0x353af9);}(_0x399c,0x12a));var _0xc399=function(_0x42afde,_0x5f3b01){_0x42afde=_0x42afde-0x0;var _0x25980e=_0x399c[_0x42afde];return _0x25980e;};'use strict';var _=require(_0xc399('0x0'));var util=require(_0xc399('0x1'));var logger=require(_0xc399('0x2'))(_0xc399('0x3'));var moment=require(_0xc399('0x4'));var BPromise=require(_0xc399('0x5'));var rp=require(_0xc399('0x6'));var fs=require('fs');var path=require(_0xc399('0x7'));var rimraf=require('rimraf');var config=require(_0xc399('0x8'));var attributes=require(_0xc399('0x9'));module[_0xc399('0xa')]=function(_0x53bce9,_0x127c51){return _0x53bce9[_0xc399('0xb')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e41=['../../config/logger','api','bluebird','request-promise','path','./analyticFieldReport.attributes','exports','analytics_report_fields','lodash','util'];(function(_0x545e41,_0x55830d){var _0x20ee17=function(_0xac9b17){while(--_0xac9b17){_0x545e41['push'](_0x545e41['shift']());}};_0x20ee17(++_0x55830d);}(_0x7e41,0x10c));var _0x17e4=function(_0xd0bce2,_0x251a3e){_0xd0bce2=_0xd0bce2-0x0;var _0x1bfed9=_0x7e41[_0xd0bce2];return _0x1bfed9;};'use strict';var _=require(_0x17e4('0x0'));var util=require(_0x17e4('0x1'));var logger=require(_0x17e4('0x2'))(_0x17e4('0x3'));var moment=require('moment');var BPromise=require(_0x17e4('0x4'));var rp=require(_0x17e4('0x5'));var fs=require('fs');var path=require(_0x17e4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x17e4('0x7'));module[_0x17e4('0x8')]=function(_0x5a927e,_0x1fc364){return _0x5a927e['define']('AnalyticFieldReport',attributes,{'tableName':_0x17e4('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 4a0743b..042a9dc 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 _0x26af=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x26af,0x1d8));var _0xf26a=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x26af[_0x202d24];return _0x2b3a8e;};'use strict';var _=require(_0xf26a('0x0'));var util=require(_0xf26a('0x1'));var moment=require('moment');var BPromise=require(_0xf26a('0x2'));var rs=require(_0xf26a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf26a('0x4'))['db'];var utils=require(_0xf26a('0x5'));var logger=require('../../config/logger')(_0xf26a('0x6'));var config=require('../../config/environment');var jayson=require(_0xf26a('0x7'));var client=jayson[_0xf26a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cf010,_0x2eb51b,_0x22eeea){return new BPromise(function(_0x26f417,_0x327ad1){return client[_0xf26a('0x9')](_0x4cf010,_0x22eeea)[_0xf26a('0xa')](function(_0x1fd9b6){logger[_0xf26a('0xb')](_0xf26a('0xc'),_0x2eb51b,_0xf26a('0xd'));logger[_0xf26a('0xe')](_0xf26a('0xf'),_0x2eb51b,'request\x20sent',JSON[_0xf26a('0x10')](_0x1fd9b6));if(_0x1fd9b6[_0xf26a('0x11')]){if(_0x1fd9b6[_0xf26a('0x11')][_0xf26a('0x12')]===0x1f4){logger['error'](_0xf26a('0xc'),_0x2eb51b,_0x1fd9b6['error'][_0xf26a('0x13')]);return _0x327ad1(_0x1fd9b6[_0xf26a('0x11')][_0xf26a('0x13')]);}logger[_0xf26a('0x11')](_0xf26a('0xc'),_0x2eb51b,_0x1fd9b6[_0xf26a('0x11')]['message']);return _0x26f417(_0x1fd9b6[_0xf26a('0x11')][_0xf26a('0x13')]);}else{logger[_0xf26a('0xb')](_0xf26a('0xc'),_0x2eb51b,_0xf26a('0xd'));_0x26f417(_0x1fd9b6['result'][_0xf26a('0x13')]);}})[_0xf26a('0x14')](function(_0x2bd0fa){logger[_0xf26a('0x11')](_0xf26a('0xc'),_0x2eb51b,_0x2bd0fa);_0x327ad1(_0x2bd0fa);});});} \ No newline at end of file +var _0x20a5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x20a5,0x1ae));var _0x520a=function(_0x4afd36,_0x6de43d){_0x4afd36=_0x4afd36-0x0;var _0x3b7072=_0x20a5[_0x4afd36];return _0x3b7072;};'use strict';var _=require(_0x520a('0x0'));var util=require(_0x520a('0x1'));var moment=require(_0x520a('0x2'));var BPromise=require(_0x520a('0x3'));var rs=require(_0x520a('0x4'));var fs=require('fs');var Redis=require(_0x520a('0x5'));var db=require(_0x520a('0x6'))['db'];var utils=require(_0x520a('0x7'));var logger=require(_0x520a('0x8'))('rpc');var config=require(_0x520a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x520a('0xa')][_0x520a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32be6c,_0x41d247,_0x4b865b){return new BPromise(function(_0x2cd3d6,_0x1008df){return client['request'](_0x32be6c,_0x4b865b)[_0x520a('0xc')](function(_0x117b48){logger[_0x520a('0xd')](_0x520a('0xe'),_0x41d247,'request\x20sent');logger[_0x520a('0xf')](_0x520a('0x10'),_0x41d247,_0x520a('0x11'),JSON[_0x520a('0x12')](_0x117b48));if(_0x117b48[_0x520a('0x13')]){if(_0x117b48[_0x520a('0x13')][_0x520a('0x14')]===0x1f4){logger['error'](_0x520a('0xe'),_0x41d247,_0x117b48[_0x520a('0x13')][_0x520a('0x15')]);return _0x1008df(_0x117b48[_0x520a('0x13')][_0x520a('0x15')]);}logger[_0x520a('0x13')](_0x520a('0xe'),_0x41d247,_0x117b48[_0x520a('0x13')]['message']);return _0x2cd3d6(_0x117b48[_0x520a('0x13')][_0x520a('0x15')]);}else{logger[_0x520a('0xd')](_0x520a('0xe'),_0x41d247,_0x520a('0x11'));_0x2cd3d6(_0x117b48[_0x520a('0x16')][_0x520a('0x15')]);}})[_0x520a('0x17')](function(_0x1c622c){logger[_0x520a('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x41d247,_0x1c622c);_0x1008df(_0x1c622c);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0fe3b04..cf68123 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 _0x7b44=['/create_many','bulkCreate','/:id/create_many','addFields','put','/:id','delete','/destroy_many','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','show','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b44,0x14f));var _0x47b4=function(_0x452f50,_0x2734ff){_0x452f50=_0x452f50-0x0;var _0x451d69=_0x7b44[_0x452f50];return _0x451d69;};'use strict';var multer=require(_0x47b4('0x0'));var util=require(_0x47b4('0x1'));var path=require(_0x47b4('0x2'));var timeout=require('connect-timeout');var express=require(_0x47b4('0x3'));var router=express[_0x47b4('0x4')]();var fs_extra=require(_0x47b4('0x5'));var auth=require(_0x47b4('0x6'));var interaction=require(_0x47b4('0x7'));var config=require(_0x47b4('0x8'));var controller=require(_0x47b4('0x9'));router[_0x47b4('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x47b4('0xa')]('/:id',auth[_0x47b4('0xb')](),controller[_0x47b4('0xc')]);router[_0x47b4('0xd')]('/',auth[_0x47b4('0xb')](),controller[_0x47b4('0xe')]);router['post'](_0x47b4('0xf'),auth['isAuthenticated'](),controller[_0x47b4('0x10')]);router[_0x47b4('0xd')](_0x47b4('0x11'),auth[_0x47b4('0xb')](),controller[_0x47b4('0x12')]);router[_0x47b4('0x13')](_0x47b4('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x47b4('0x15')](_0x47b4('0x16'),auth[_0x47b4('0xb')](),controller['bulkDestroy']);router[_0x47b4('0x15')](_0x47b4('0x14'),auth[_0x47b4('0xb')](),controller[_0x47b4('0x17')]);module[_0x47b4('0x18')]=router; \ No newline at end of file +var _0x6b4d=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','put','update'];(function(_0x5926c4,_0x404826){var _0x337b23=function(_0x4eb36f){while(--_0x4eb36f){_0x5926c4['push'](_0x5926c4['shift']());}};_0x337b23(++_0x404826);}(_0x6b4d,0x1e8));var _0xd6b4=function(_0x550cce,_0x5aba5d){_0x550cce=_0x550cce-0x0;var _0x222211=_0x6b4d[_0x550cce];return _0x222211;};'use strict';var multer=require(_0xd6b4('0x0'));var util=require(_0xd6b4('0x1'));var path=require(_0xd6b4('0x2'));var timeout=require(_0xd6b4('0x3'));var express=require('express');var router=express[_0xd6b4('0x4')]();var fs_extra=require(_0xd6b4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd6b4('0x6'));var controller=require('./analyticFieldReport.controller');router[_0xd6b4('0x7')]('/',auth[_0xd6b4('0x8')](),controller[_0xd6b4('0x9')]);router[_0xd6b4('0x7')](_0xd6b4('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd6b4('0xb')]('/',auth[_0xd6b4('0x8')](),controller[_0xd6b4('0xc')]);router[_0xd6b4('0xb')](_0xd6b4('0xd'),auth[_0xd6b4('0x8')](),controller[_0xd6b4('0xe')]);router['post'](_0xd6b4('0xf'),auth[_0xd6b4('0x8')](),controller['addFields']);router[_0xd6b4('0x10')](_0xd6b4('0xa'),auth[_0xd6b4('0x8')](),controller[_0xd6b4('0x11')]);router[_0xd6b4('0x12')](_0xd6b4('0x13'),auth['isAuthenticated'](),controller[_0xd6b4('0x14')]);router['delete'](_0xd6b4('0xa'),auth['isAuthenticated'](),controller[_0xd6b4('0x15')]);module[_0xd6b4('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 77fbdf5..b5079a0 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 _0xbc4a=['sequelize','exports','STRING'];(function(_0x92ab1,_0x5d2b6a){var _0x426f4a=function(_0x37d264){while(--_0x37d264){_0x92ab1['push'](_0x92ab1['shift']());}};_0x426f4a(++_0x5d2b6a);}(_0xbc4a,0x1dd));var _0xabc4=function(_0x558841,_0x5cdb84){_0x558841=_0x558841-0x0;var _0x39b015=_0xbc4a[_0x558841];return _0x39b015;};'use strict';var Sequelize=require(_0xabc4('0x0'));module[_0xabc4('0x1')]={'name':{'type':Sequelize[_0xabc4('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6b72=['TEXT','sequelize','STRING','name'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x6b72,0x19d));var _0x26b7=function(_0x1c9d25,_0x52c419){_0x1c9d25=_0x1c9d25-0x0;var _0x93af2d=_0x6b72[_0x1c9d25];return _0x93af2d;};'use strict';var Sequelize=require(_0x26b7('0x0'));module['exports']={'name':{'type':Sequelize[_0x26b7('0x1')],'allowNull':![],'unique':_0x26b7('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x26b7('0x3')]},'description':{'type':Sequelize[_0x26b7('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index dc5b622..f033e83 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 _0x0962=['Metrics','UserProfileResource','end','error','name','send','render','merge','contact','message','interaction','account','index','map','AnalyticMetric','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','type','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','length','options','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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/auth/service','../../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','apply','reject','save','update','destroy','then','get'];(function(_0x46f0bd,_0x1f042f){var _0x57b5ea=function(_0x4d030a){while(--_0x4d030a){_0x46f0bd['push'](_0x46f0bd['shift']());}};_0x57b5ea(++_0x1f042f);}(_0x0962,0x198));var _0x2096=function(_0x48c98c,_0x3b6f60){_0x48c98c=_0x48c98c-0x0;var _0x4eb693=_0x0962[_0x48c98c];return _0x4eb693;};'use strict';var emlformat=require(_0x2096('0x0'));var rimraf=require(_0x2096('0x1'));var zipdir=require(_0x2096('0x2'));var jsonpatch=require(_0x2096('0x3'));var rp=require('request-promise');var moment=require(_0x2096('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2096('0x5'));var path=require(_0x2096('0x6'));var sox=require(_0x2096('0x7'));var csv=require(_0x2096('0x8'));var ejs=require(_0x2096('0x9'));var fs=require('fs');var fs_extra=require(_0x2096('0xa'));var _=require(_0x2096('0xb'));var squel=require(_0x2096('0xc'));var crypto=require('crypto');var jsforce=require(_0x2096('0xd'));var deskjs=require(_0x2096('0xe'));var toCsv=require(_0x2096('0x8'));var querystring=require(_0x2096('0xf'));var Papa=require(_0x2096('0x10'));var Redis=require(_0x2096('0x11'));var authService=require(_0x2096('0x12'));var qs=require(_0x2096('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2096('0x14'));var logger=require(_0x2096('0x15'))('api');var utils=require(_0x2096('0x16'));var config=require(_0x2096('0x17'));var licenseUtil=require(_0x2096('0x18'));var db=require(_0x2096('0x19'))['db'];function respondWithStatusCode(_0x5d351e,_0x541213){_0x541213=_0x541213||0xcc;return function(_0x404e2b){if(_0x404e2b){return _0x5d351e[_0x2096('0x1a')](_0x541213);}return _0x5d351e[_0x2096('0x1b')](_0x541213)['end']();};}function respondWithResult(_0x14bf54,_0x45b7ec){_0x45b7ec=_0x45b7ec||0xc8;return function(_0x420c57){if(_0x420c57){return _0x14bf54['status'](_0x45b7ec)[_0x2096('0x1c')](_0x420c57);}};}function respondWithFilteredResult(_0x37dcd0,_0x2c6e88){return function(_0x305ada){if(_0x305ada){var _0x5b151a=typeof _0x2c6e88[_0x2096('0x1d')]===_0x2096('0x1e')&&typeof _0x2c6e88[_0x2096('0x1f')]==='undefined';var _0x479ba2=_0x305ada[_0x2096('0x20')];var _0x22c478=_0x5b151a?0x0:_0x2c6e88['offset'];var _0xd7e9e0=_0x5b151a?_0x305ada[_0x2096('0x20')]:_0x2c6e88[_0x2096('0x1d')]+_0x2c6e88['limit'];var _0x2a9f62;if(_0xd7e9e0>=_0x479ba2){_0xd7e9e0=_0x479ba2;_0x2a9f62=0xc8;}else{_0x2a9f62=0xce;}_0x37dcd0['status'](_0x2a9f62);return _0x37dcd0[_0x2096('0x21')](_0x2096('0x22'),_0x22c478+'-'+_0xd7e9e0+'/'+_0x479ba2)[_0x2096('0x1c')](_0x305ada);}return null;};}function patchUpdates(_0x12fe63){return function(_0x3f4d7d){try{jsonpatch[_0x2096('0x23')](_0x3f4d7d,_0x12fe63,!![]);}catch(_0x2125ad){return BPromise[_0x2096('0x24')](_0x2125ad);}return _0x3f4d7d[_0x2096('0x25')]();};}function saveUpdates(_0x58c61c,_0x40f28c){return function(_0x4b74e2){if(_0x4b74e2){return _0x4b74e2[_0x2096('0x26')](_0x58c61c)['then'](function(_0x5dfdd5){return _0x5dfdd5;});}return null;};}function removeEntity(_0x362414,_0x686f15){return function(_0x3c3d9c){if(_0x3c3d9c){return _0x3c3d9c[_0x2096('0x27')]()[_0x2096('0x28')](function(){var _0x2b7866=_0x3c3d9c[_0x2096('0x29')]({'plain':!![]});var _0xe72b8a=_0x2096('0x2a');return db[_0x2096('0x2b')][_0x2096('0x27')]({'where':{'type':_0xe72b8a,'resourceId':_0x2b7866['id']}})[_0x2096('0x28')](function(){return _0x3c3d9c;});})['then'](function(){_0x362414['status'](0xcc)[_0x2096('0x2c')]();});}};}function handleEntityNotFound(_0x1119a1,_0x224362){return function(_0x35f1c3){if(!_0x35f1c3){_0x1119a1[_0x2096('0x1a')](0x194);}return _0x35f1c3;};}function handleError(_0xeec1a7,_0x1a8df7){_0x1a8df7=_0x1a8df7||0x1f4;return function(_0x1e980c){logger[_0x2096('0x2d')](_0x1e980c['stack']);if(_0x1e980c[_0x2096('0x2e')]){delete _0x1e980c[_0x2096('0x2e')];}_0xeec1a7[_0x2096('0x1b')](_0x1a8df7)[_0x2096('0x2f')](_0x1e980c);};}function getMustacheRender(_0x2402d5,_0x2464a0){return Mustache[_0x2096('0x30')](_0x2402d5,_[_0x2096('0x31')](_0x2464a0['body'],{'contact':_0x2464a0[_0x2096('0x32')],'message':_0x2464a0[_0x2096('0x33')],'agent':_0x2464a0['agent'],'interaction':_0x2464a0[_0x2096('0x34')],'account':_0x2464a0[_0x2096('0x35')]}))||'';}exports[_0x2096('0x36')]=function(_0x3cc62f,_0x8ab4ab){var _0x315a35={},_0xd584c4={},_0x43b756={'count':0x0,'rows':[]};var _0x570316=_[_0x2096('0x37')](db[_0x2096('0x38')]['rawAttributes'],function(_0x6abbfe){return{'name':_0x6abbfe['fieldName'],'type':_0x6abbfe['type'][_0x2096('0x39')]};});_0xd584c4[_0x2096('0x3a')]=_[_0x2096('0x37')](_0x570316,_0x2096('0x2e'));_0xd584c4['query']=_['keys'](_0x3cc62f[_0x2096('0x3b')]);_0xd584c4[_0x2096('0x3c')]=_[_0x2096('0x3d')](_0xd584c4[_0x2096('0x3a')],_0xd584c4['query']);_0x315a35['attributes']=_[_0x2096('0x3d')](_0xd584c4[_0x2096('0x3a')],qs['fields'](_0x3cc62f[_0x2096('0x3b')][_0x2096('0x3e')]));_0x315a35['attributes']=_0x315a35[_0x2096('0x3f')]['length']?_0x315a35['attributes']:_0xd584c4[_0x2096('0x3a')];if(!_0x3cc62f['query'][_0x2096('0x40')]('nolimit')){_0x315a35[_0x2096('0x1f')]=qs[_0x2096('0x1f')](_0x3cc62f[_0x2096('0x3b')][_0x2096('0x1f')]);_0x315a35[_0x2096('0x1d')]=qs[_0x2096('0x1d')](_0x3cc62f[_0x2096('0x3b')][_0x2096('0x1d')]);}_0x315a35[_0x2096('0x41')]=qs[_0x2096('0x42')](_0x3cc62f[_0x2096('0x3b')][_0x2096('0x42')]);_0x315a35['where']=qs[_0x2096('0x3c')](_['pick'](_0x3cc62f[_0x2096('0x3b')],_0xd584c4[_0x2096('0x3c')]),_0x570316);if(_0x3cc62f[_0x2096('0x3b')][_0x2096('0x43')]){_0x315a35[_0x2096('0x44')]=_[_0x2096('0x31')](_0x315a35[_0x2096('0x44')],{'$or':_[_0x2096('0x37')](_0x570316,function(_0xfbdff7){if(_0xfbdff7[_0x2096('0x45')]!==_0x2096('0x46')){var _0x5f3fc8={};_0x5f3fc8[_0xfbdff7[_0x2096('0x2e')]]={'$like':'%'+_0x3cc62f['query'][_0x2096('0x43')]+'%'};return _0x5f3fc8;}})});}_0x315a35=_[_0x2096('0x31')]({},_0x315a35,_0x3cc62f['options']);var _0x492116={'where':_0x315a35[_0x2096('0x44')]};return db[_0x2096('0x38')]['count'](_0x492116)[_0x2096('0x28')](function(_0x2e757d){_0x43b756[_0x2096('0x20')]=_0x2e757d;if(_0x3cc62f[_0x2096('0x3b')][_0x2096('0x47')]){_0x315a35[_0x2096('0x48')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x2096('0x49')](_0x315a35);})[_0x2096('0x28')](function(_0x34ff3){_0x43b756['rows']=_0x34ff3;return _0x43b756;})[_0x2096('0x28')](respondWithFilteredResult(_0x8ab4ab,_0x315a35))[_0x2096('0x4a')](handleError(_0x8ab4ab,null));};exports[_0x2096('0x4b')]=function(_0x5f5214,_0x2f0bf5){var _0x322a77={'raw':!![],'where':{'id':_0x5f5214[_0x2096('0x4c')]['id']}},_0x56a236={};_0x56a236[_0x2096('0x3a')]=_[_0x2096('0x4d')](db[_0x2096('0x38')]['rawAttributes']);_0x56a236['query']=_[_0x2096('0x4d')](_0x5f5214['query']);_0x56a236['filters']=_['intersection'](_0x56a236[_0x2096('0x3a')],_0x56a236[_0x2096('0x3b')]);_0x322a77[_0x2096('0x3f')]=_[_0x2096('0x3d')](_0x56a236['model'],qs['fields'](_0x5f5214[_0x2096('0x3b')][_0x2096('0x3e')]));_0x322a77[_0x2096('0x3f')]=_0x322a77[_0x2096('0x3f')][_0x2096('0x4e')]?_0x322a77[_0x2096('0x3f')]:_0x56a236['model'];if(_0x5f5214['query'][_0x2096('0x47')]){_0x322a77[_0x2096('0x48')]=[{'all':!![]}];}_0x322a77=_[_0x2096('0x31')]({},_0x322a77,_0x5f5214[_0x2096('0x4f')]);return db[_0x2096('0x38')]['find'](_0x322a77)['then'](handleEntityNotFound(_0x2f0bf5,null))[_0x2096('0x28')](respondWithResult(_0x2f0bf5,null))[_0x2096('0x4a')](handleError(_0x2f0bf5,null));};exports['create']=function(_0x3a93b6,_0x3aad69){return db[_0x2096('0x38')]['create'](_0x3a93b6['body'],{})['then'](function(_0x9b0989){var _0x42d1c2=_0x3a93b6[_0x2096('0x50')][_0x2096('0x29')]({'plain':!![]});if(!_0x42d1c2)throw new Error(_0x2096('0x51'));if(_0x42d1c2[_0x2096('0x52')]==='user'){var _0x2aff64=_0x9b0989[_0x2096('0x29')]({'plain':!![]});var _0x5f0b7d='Metrics';return db[_0x2096('0x53')][_0x2096('0x54')]({'where':{'name':_0x5f0b7d,'userProfileId':_0x42d1c2[_0x2096('0x55')]},'raw':!![]})[_0x2096('0x28')](function(_0x46e66b){if(_0x46e66b&&_0x46e66b[_0x2096('0x56')]===0x0){return db[_0x2096('0x2b')][_0x2096('0x57')]({'name':_0x2aff64[_0x2096('0x2e')],'resourceId':_0x2aff64['id'],'type':_0x46e66b[_0x2096('0x2e')],'sectionId':_0x46e66b['id']},{})['then'](function(){return _0x9b0989;});}else{return _0x9b0989;}})[_0x2096('0x4a')](function(_0x2d1f95){logger[_0x2096('0x2d')](_0x2096('0x58'),_0x2d1f95);throw _0x2d1f95;});}return _0x9b0989;})[_0x2096('0x28')](respondWithResult(_0x3aad69,0xc9))['catch'](handleError(_0x3aad69,null));};exports['update']=function(_0x51eacd,_0x48ec17){if(_0x51eacd['body']['id']){delete _0x51eacd[_0x2096('0x59')]['id'];}return db[_0x2096('0x38')][_0x2096('0x54')]({'where':{'id':_0x51eacd[_0x2096('0x4c')]['id']}})[_0x2096('0x28')](handleEntityNotFound(_0x48ec17,null))[_0x2096('0x28')](saveUpdates(_0x51eacd[_0x2096('0x59')],null))[_0x2096('0x28')](respondWithResult(_0x48ec17,null))[_0x2096('0x4a')](handleError(_0x48ec17,null));};exports[_0x2096('0x27')]=function(_0x554fcd,_0x16822f){return db[_0x2096('0x38')][_0x2096('0x54')]({'where':{'id':_0x554fcd[_0x2096('0x4c')]['id']}})[_0x2096('0x28')](handleEntityNotFound(_0x16822f,null))['then'](removeEntity(_0x16822f,null))[_0x2096('0x4a')](handleError(_0x16822f,null));}; \ No newline at end of file +var _0x495e=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','merge','body','contact','message','interaction','account','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','findAll','catch','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment'];(function(_0x5a2b54,_0x385211){var _0x4dfce6=function(_0xdddaef){while(--_0xdddaef){_0x5a2b54['push'](_0x5a2b54['shift']());}};_0x4dfce6(++_0x385211);}(_0x495e,0xfb));var _0xe495=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0x495e[_0x25bca6];return _0x3f8d02;};'use strict';var emlformat=require(_0xe495('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe495('0x1'));var rp=require(_0xe495('0x2'));var moment=require(_0xe495('0x3'));var BPromise=require(_0xe495('0x4'));var Mustache=require('mustache');var util=require(_0xe495('0x5'));var path=require(_0xe495('0x6'));var sox=require(_0xe495('0x7'));var csv=require(_0xe495('0x8'));var ejs=require(_0xe495('0x9'));var fs=require('fs');var fs_extra=require(_0xe495('0xa'));var _=require(_0xe495('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe495('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe495('0xd'));var Papa=require(_0xe495('0xe'));var Redis=require(_0xe495('0xf'));var authService=require(_0xe495('0x10'));var qs=require(_0xe495('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe495('0x12'));var logger=require(_0xe495('0x13'))(_0xe495('0x14'));var utils=require('../../config/utils');var config=require(_0xe495('0x15'));var licenseUtil=require(_0xe495('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51c2d4,_0x1d73a5){_0x1d73a5=_0x1d73a5||0xcc;return function(_0x13aedb){if(_0x13aedb){return _0x51c2d4['sendStatus'](_0x1d73a5);}return _0x51c2d4[_0xe495('0x17')](_0x1d73a5)[_0xe495('0x18')]();};}function respondWithResult(_0xab9c10,_0x14744d){_0x14744d=_0x14744d||0xc8;return function(_0x2b5e19){if(_0x2b5e19){return _0xab9c10['status'](_0x14744d)[_0xe495('0x19')](_0x2b5e19);}};}function respondWithFilteredResult(_0x103c25,_0x19d096){return function(_0x1c2d78){if(_0x1c2d78){var _0x1ea256=typeof _0x19d096['offset']==='undefined'&&typeof _0x19d096['limit']===_0xe495('0x1a');var _0x142978=_0x1c2d78[_0xe495('0x1b')];var _0x577fb7=_0x1ea256?0x0:_0x19d096[_0xe495('0x1c')];var _0x302ca0=_0x1ea256?_0x1c2d78[_0xe495('0x1b')]:_0x19d096[_0xe495('0x1c')]+_0x19d096[_0xe495('0x1d')];var _0x525953;if(_0x302ca0>=_0x142978){_0x302ca0=_0x142978;_0x525953=0xc8;}else{_0x525953=0xce;}_0x103c25['status'](_0x525953);return _0x103c25[_0xe495('0x1e')](_0xe495('0x1f'),_0x577fb7+'-'+_0x302ca0+'/'+_0x142978)[_0xe495('0x19')](_0x1c2d78);}return null;};}function patchUpdates(_0x169bd2){return function(_0x5d5d35){try{jsonpatch[_0xe495('0x20')](_0x5d5d35,_0x169bd2,!![]);}catch(_0x46ec15){return BPromise[_0xe495('0x21')](_0x46ec15);}return _0x5d5d35['save']();};}function saveUpdates(_0xa0c9bc,_0x17d13f){return function(_0x475a7e){if(_0x475a7e){return _0x475a7e[_0xe495('0x22')](_0xa0c9bc)[_0xe495('0x23')](function(_0x4840fa){return _0x4840fa;});}return null;};}function removeEntity(_0x33f19,_0x4d836b){return function(_0x181ead){if(_0x181ead){return _0x181ead[_0xe495('0x24')]()[_0xe495('0x23')](function(){var _0x5d095f=_0x181ead[_0xe495('0x25')]({'plain':!![]});var _0x2a6fd6=_0xe495('0x26');return db[_0xe495('0x27')][_0xe495('0x24')]({'where':{'type':_0x2a6fd6,'resourceId':_0x5d095f['id']}})[_0xe495('0x23')](function(){return _0x181ead;});})[_0xe495('0x23')](function(){_0x33f19['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2506f7,_0x5db642){return function(_0x1651d4){if(!_0x1651d4){_0x2506f7[_0xe495('0x28')](0x194);}return _0x1651d4;};}function handleError(_0x598108,_0x4e3a4d){_0x4e3a4d=_0x4e3a4d||0x1f4;return function(_0xd6585c){logger[_0xe495('0x29')](_0xd6585c[_0xe495('0x2a')]);if(_0xd6585c[_0xe495('0x2b')]){delete _0xd6585c[_0xe495('0x2b')];}_0x598108[_0xe495('0x17')](_0x4e3a4d)[_0xe495('0x2c')](_0xd6585c);};}function getMustacheRender(_0x8bff82,_0x535d23){return Mustache['render'](_0x8bff82,_[_0xe495('0x2d')](_0x535d23[_0xe495('0x2e')],{'contact':_0x535d23[_0xe495('0x2f')],'message':_0x535d23[_0xe495('0x30')],'agent':_0x535d23['agent'],'interaction':_0x535d23[_0xe495('0x31')],'account':_0x535d23[_0xe495('0x32')]}))||'';}exports[_0xe495('0x33')]=function(_0xba78e9,_0xc238a){var _0x15fbcd={},_0x2ffb33={},_0x391b31={'count':0x0,'rows':[]};var _0x447aef=_[_0xe495('0x34')](db[_0xe495('0x35')][_0xe495('0x36')],function(_0x31b515){return{'name':_0x31b515[_0xe495('0x37')],'type':_0x31b515[_0xe495('0x38')]['key']};});_0x2ffb33[_0xe495('0x39')]=_[_0xe495('0x34')](_0x447aef,'name');_0x2ffb33[_0xe495('0x3a')]=_[_0xe495('0x3b')](_0xba78e9['query']);_0x2ffb33['filters']=_[_0xe495('0x3c')](_0x2ffb33[_0xe495('0x39')],_0x2ffb33[_0xe495('0x3a')]);_0x15fbcd[_0xe495('0x3d')]=_['intersection'](_0x2ffb33[_0xe495('0x39')],qs[_0xe495('0x3e')](_0xba78e9[_0xe495('0x3a')]['fields']));_0x15fbcd['attributes']=_0x15fbcd[_0xe495('0x3d')]['length']?_0x15fbcd[_0xe495('0x3d')]:_0x2ffb33[_0xe495('0x39')];if(!_0xba78e9['query']['hasOwnProperty'](_0xe495('0x3f'))){_0x15fbcd[_0xe495('0x1d')]=qs[_0xe495('0x1d')](_0xba78e9[_0xe495('0x3a')][_0xe495('0x1d')]);_0x15fbcd[_0xe495('0x1c')]=qs[_0xe495('0x1c')](_0xba78e9[_0xe495('0x3a')][_0xe495('0x1c')]);}_0x15fbcd[_0xe495('0x40')]=qs[_0xe495('0x41')](_0xba78e9[_0xe495('0x3a')]['sort']);_0x15fbcd[_0xe495('0x42')]=qs[_0xe495('0x43')](_[_0xe495('0x44')](_0xba78e9[_0xe495('0x3a')],_0x2ffb33['filters']),_0x447aef);if(_0xba78e9[_0xe495('0x3a')][_0xe495('0x45')]){_0x15fbcd['where']=_['merge'](_0x15fbcd['where'],{'$or':_[_0xe495('0x34')](_0x447aef,function(_0xa0dcf0){if(_0xa0dcf0[_0xe495('0x38')]!==_0xe495('0x46')){var _0x77c1c7={};_0x77c1c7[_0xa0dcf0[_0xe495('0x2b')]]={'$like':'%'+_0xba78e9['query'][_0xe495('0x45')]+'%'};return _0x77c1c7;}})});}_0x15fbcd=_[_0xe495('0x2d')]({},_0x15fbcd,_0xba78e9[_0xe495('0x47')]);var _0xe7f3f3={'where':_0x15fbcd[_0xe495('0x42')]};return db[_0xe495('0x35')][_0xe495('0x1b')](_0xe7f3f3)[_0xe495('0x23')](function(_0x30ebf4){_0x391b31['count']=_0x30ebf4;if(_0xba78e9['query'][_0xe495('0x48')]){_0x15fbcd['include']=[{'all':!![]}];}return db[_0xe495('0x35')][_0xe495('0x49')](_0x15fbcd);})['then'](function(_0x35aaef){_0x391b31['rows']=_0x35aaef;return _0x391b31;})['then'](respondWithFilteredResult(_0xc238a,_0x15fbcd))[_0xe495('0x4a')](handleError(_0xc238a,null));};exports['show']=function(_0x41518b,_0x4d7f59){var _0x40a8a8={'raw':!![],'where':{'id':_0x41518b[_0xe495('0x4b')]['id']}},_0x3f2add={};_0x3f2add[_0xe495('0x39')]=_[_0xe495('0x3b')](db[_0xe495('0x35')][_0xe495('0x36')]);_0x3f2add[_0xe495('0x3a')]=_[_0xe495('0x3b')](_0x41518b[_0xe495('0x3a')]);_0x3f2add['filters']=_[_0xe495('0x3c')](_0x3f2add['model'],_0x3f2add[_0xe495('0x3a')]);_0x40a8a8[_0xe495('0x3d')]=_[_0xe495('0x3c')](_0x3f2add[_0xe495('0x39')],qs['fields'](_0x41518b['query']['fields']));_0x40a8a8[_0xe495('0x3d')]=_0x40a8a8[_0xe495('0x3d')]['length']?_0x40a8a8[_0xe495('0x3d')]:_0x3f2add[_0xe495('0x39')];if(_0x41518b[_0xe495('0x3a')][_0xe495('0x48')]){_0x40a8a8[_0xe495('0x4c')]=[{'all':!![]}];}_0x40a8a8=_[_0xe495('0x2d')]({},_0x40a8a8,_0x41518b[_0xe495('0x47')]);return db['AnalyticMetric'][_0xe495('0x4d')](_0x40a8a8)[_0xe495('0x23')](handleEntityNotFound(_0x4d7f59,null))[_0xe495('0x23')](respondWithResult(_0x4d7f59,null))[_0xe495('0x4a')](handleError(_0x4d7f59,null));};exports[_0xe495('0x4e')]=function(_0x4c366e,_0x5a547f){return db[_0xe495('0x35')][_0xe495('0x4e')](_0x4c366e[_0xe495('0x2e')],{})['then'](function(_0x4b9b76){var _0x1a7d15=_0x4c366e['user'][_0xe495('0x25')]({'plain':!![]});if(!_0x1a7d15)throw new Error(_0xe495('0x4f'));if(_0x1a7d15['role']===_0xe495('0x50')){var _0x3e03a2=_0x4b9b76[_0xe495('0x25')]({'plain':!![]});var _0x45813c=_0xe495('0x26');return db[_0xe495('0x51')][_0xe495('0x4d')]({'where':{'name':_0x45813c,'userProfileId':_0x1a7d15[_0xe495('0x52')]},'raw':!![]})[_0xe495('0x23')](function(_0x42c7dc){if(_0x42c7dc&&_0x42c7dc[_0xe495('0x53')]===0x0){return db[_0xe495('0x27')]['create']({'name':_0x3e03a2[_0xe495('0x2b')],'resourceId':_0x3e03a2['id'],'type':_0x42c7dc[_0xe495('0x2b')],'sectionId':_0x42c7dc['id']},{})[_0xe495('0x23')](function(){return _0x4b9b76;});}else{return _0x4b9b76;}})[_0xe495('0x4a')](function(_0x910a24){logger[_0xe495('0x29')](_0xe495('0x54'),_0x910a24);throw _0x910a24;});}return _0x4b9b76;})[_0xe495('0x23')](respondWithResult(_0x5a547f,0xc9))[_0xe495('0x4a')](handleError(_0x5a547f,null));};exports[_0xe495('0x22')]=function(_0x588069,_0x573547){if(_0x588069[_0xe495('0x2e')]['id']){delete _0x588069[_0xe495('0x2e')]['id'];}return db['AnalyticMetric'][_0xe495('0x4d')]({'where':{'id':_0x588069[_0xe495('0x4b')]['id']}})[_0xe495('0x23')](handleEntityNotFound(_0x573547,null))[_0xe495('0x23')](saveUpdates(_0x588069['body'],null))[_0xe495('0x23')](respondWithResult(_0x573547,null))[_0xe495('0x4a')](handleError(_0x573547,null));};exports[_0xe495('0x24')]=function(_0x368566,_0x256e6e){return db[_0xe495('0x35')]['find']({'where':{'id':_0x368566[_0xe495('0x4b')]['id']}})['then'](handleEntityNotFound(_0x256e6e,null))[_0xe495('0x23')](removeEntity(_0x256e6e,null))['catch'](handleError(_0x256e6e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 39fb0f5..ff254a5 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 _0x7086=['analytics_metrics','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric'];(function(_0x1484c4,_0x2d844b){var _0x598b70=function(_0x3245f9){while(--_0x3245f9){_0x1484c4['push'](_0x1484c4['shift']());}};_0x598b70(++_0x2d844b);}(_0x7086,0xa9));var _0x6708=function(_0x589fff,_0x121c4e){_0x589fff=_0x589fff-0x0;var _0x53cb48=_0x7086[_0x589fff];return _0x53cb48;};'use strict';var _=require(_0x6708('0x0'));var util=require('util');var logger=require(_0x6708('0x1'))(_0x6708('0x2'));var moment=require(_0x6708('0x3'));var BPromise=require('bluebird');var rp=require(_0x6708('0x4'));var fs=require('fs');var path=require(_0x6708('0x5'));var rimraf=require(_0x6708('0x6'));var config=require(_0x6708('0x7'));var attributes=require(_0x6708('0x8'));module[_0x6708('0x9')]=function(_0x5795e7,_0x41779e){return _0x5795e7['define'](_0x6708('0xa'),attributes,{'tableName':_0x6708('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x107a=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','util','../../config/logger','api'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x107a,0x14d));var _0xa107=function(_0x56fc30,_0xab0047){_0x56fc30=_0x56fc30-0x0;var _0xd549f0=_0x107a[_0x56fc30];return _0xd549f0;};'use strict';var _=require('lodash');var util=require(_0xa107('0x0'));var logger=require(_0xa107('0x1'))(_0xa107('0x2'));var moment=require('moment');var BPromise=require(_0xa107('0x3'));var rp=require(_0xa107('0x4'));var fs=require('fs');var path=require(_0xa107('0x5'));var rimraf=require(_0xa107('0x6'));var config=require(_0xa107('0x7'));var attributes=require(_0xa107('0x8'));module[_0xa107('0x9')]=function(_0x55c40a,_0x1f48ef){return _0x55c40a['define'](_0xa107('0xa'),attributes,{'tableName':_0xa107('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 3d2a5d2..5376311 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 _0xb1a1=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0xb1a1,0x12d));var _0x1b1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1a1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1b1a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1b1a('0x1'));var rs=require(_0x1b1a('0x2'));var fs=require('fs');var Redis=require(_0x1b1a('0x3'));var db=require(_0x1b1a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1b1a('0x5'));var config=require(_0x1b1a('0x6'));var jayson=require(_0x1b1a('0x7'));var client=jayson['client'][_0x1b1a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x517883,_0x3d7037,_0x7dd44f){return new BPromise(function(_0x5e11a9,_0x280120){return client[_0x1b1a('0x9')](_0x517883,_0x7dd44f)[_0x1b1a('0xa')](function(_0xa8a08e){logger['info'](_0x1b1a('0xb'),_0x3d7037,_0x1b1a('0xc'));logger[_0x1b1a('0xd')](_0x1b1a('0xe'),_0x3d7037,_0x1b1a('0xc'),JSON[_0x1b1a('0xf')](_0xa8a08e));if(_0xa8a08e[_0x1b1a('0x10')]){if(_0xa8a08e['error'][_0x1b1a('0x11')]===0x1f4){logger[_0x1b1a('0x10')](_0x1b1a('0xb'),_0x3d7037,_0xa8a08e[_0x1b1a('0x10')][_0x1b1a('0x12')]);return _0x280120(_0xa8a08e[_0x1b1a('0x10')]['message']);}logger[_0x1b1a('0x10')](_0x1b1a('0xb'),_0x3d7037,_0xa8a08e[_0x1b1a('0x10')]['message']);return _0x5e11a9(_0xa8a08e[_0x1b1a('0x10')][_0x1b1a('0x12')]);}else{logger[_0x1b1a('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x3d7037,_0x1b1a('0xc'));_0x5e11a9(_0xa8a08e['result'][_0x1b1a('0x12')]);}})[_0x1b1a('0x14')](function(_0x193b73){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3d7037,_0x193b73);_0x280120(_0x193b73);});});} \ No newline at end of file +var _0xdf64=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','AnalyticMetric,\x20%s,\x20%s','result','catch'];(function(_0xdd1f52,_0x227e9e){var _0x368782=function(_0x480309){while(--_0x480309){_0xdd1f52['push'](_0xdd1f52['shift']());}};_0x368782(++_0x227e9e);}(_0xdf64,0xe6));var _0x4df6=function(_0x4f53a6,_0x582ff5){_0x4f53a6=_0x4f53a6-0x0;var _0x30e4b7=_0xdf64[_0x4f53a6];return _0x30e4b7;};'use strict';var _=require('lodash');var util=require(_0x4df6('0x0'));var moment=require(_0x4df6('0x1'));var BPromise=require(_0x4df6('0x2'));var rs=require(_0x4df6('0x3'));var fs=require('fs');var Redis=require(_0x4df6('0x4'));var db=require(_0x4df6('0x5'))['db'];var utils=require(_0x4df6('0x6'));var logger=require(_0x4df6('0x7'))(_0x4df6('0x8'));var config=require(_0x4df6('0x9'));var jayson=require(_0x4df6('0xa'));var client=jayson[_0x4df6('0xb')][_0x4df6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15b0d2,_0x4caef1,_0x5f8046){return new BPromise(function(_0xaaccfe,_0x3d6f8c){return client[_0x4df6('0xd')](_0x15b0d2,_0x5f8046)[_0x4df6('0xe')](function(_0xbf5b33){logger[_0x4df6('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x4caef1,_0x4df6('0x10'));logger['debug'](_0x4df6('0x11'),_0x4caef1,_0x4df6('0x10'),JSON['stringify'](_0xbf5b33));if(_0xbf5b33[_0x4df6('0x12')]){if(_0xbf5b33[_0x4df6('0x12')]['code']===0x1f4){logger[_0x4df6('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x4caef1,_0xbf5b33[_0x4df6('0x12')][_0x4df6('0x13')]);return _0x3d6f8c(_0xbf5b33[_0x4df6('0x12')][_0x4df6('0x13')]);}logger['error'](_0x4df6('0x14'),_0x4caef1,_0xbf5b33[_0x4df6('0x12')][_0x4df6('0x13')]);return _0xaaccfe(_0xbf5b33[_0x4df6('0x12')][_0x4df6('0x13')]);}else{logger[_0x4df6('0xf')](_0x4df6('0x14'),_0x4caef1,_0x4df6('0x10'));_0xaaccfe(_0xbf5b33[_0x4df6('0x15')]['message']);}})[_0x4df6('0x16')](function(_0x1ca456){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x4caef1,_0x1ca456);_0x3d6f8c(_0x1ca456);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 742eed5..9450215 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x27e9be,_0x2f3a0d){var _0x42b8b9=function(_0x39e50e){while(--_0x39e50e){_0x27e9be['push'](_0x27e9be['shift']());}};_0x42b8b9(++_0x2f3a0d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./analyticMetric.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x8603,0x190));var _0x3860=function(_0x3b1bba,_0x220536){_0x3b1bba=_0x3b1bba-0x0;var _0x4ca374=_0x8603[_0x3b1bba];return _0x4ca374;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index eada9c3..800169a 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 _0x6fd7=['sequelize','exports'];(function(_0x119f1c,_0x34e245){var _0x5833e2=function(_0x5d8295){while(--_0x5d8295){_0x119f1c['push'](_0x119f1c['shift']());}};_0x5833e2(++_0x34e245);}(_0x6fd7,0x13e));var _0x76fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fd7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x76fd('0x0'));module[_0x76fd('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xe700=['TEXT'];(function(_0x2e8a0d,_0x28d640){var _0x4c8c75=function(_0x2fbc52){while(--_0x2fbc52){_0x2e8a0d['push'](_0x2e8a0d['shift']());}};_0x4c8c75(++_0x28d640);}(_0xe700,0x8e));var _0x0e70=function(_0x227020,_0x5c5b2c){_0x227020=_0x227020-0x0;var _0x171f72=_0xe700[_0x227020];return _0x171f72;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x0e70('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index e2019d2..6952253 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 _0xdd94=['then','includeAll','include','findAll','rows','catch','params','options','find','create','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','render','merge','body','contact','agent','interaction','index','map','AnalyticTreeReport','rawAttributes','fieldName','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL'];(function(_0x1e7496,_0x43c0fd){var _0x292c30=function(_0x38575e){while(--_0x38575e){_0x1e7496['push'](_0x1e7496['shift']());}};_0x292c30(++_0x43c0fd);}(_0xdd94,0x18b));var _0x4dd9=function(_0x159d5a,_0x1ad924){_0x159d5a=_0x159d5a-0x0;var _0x5623c9=_0xdd94[_0x159d5a];return _0x5623c9;};'use strict';var emlformat=require(_0x4dd9('0x0'));var rimraf=require(_0x4dd9('0x1'));var zipdir=require(_0x4dd9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4dd9('0x3'));var moment=require(_0x4dd9('0x4'));var BPromise=require(_0x4dd9('0x5'));var Mustache=require(_0x4dd9('0x6'));var util=require(_0x4dd9('0x7'));var path=require(_0x4dd9('0x8'));var sox=require(_0x4dd9('0x9'));var csv=require(_0x4dd9('0xa'));var ejs=require(_0x4dd9('0xb'));var fs=require('fs');var fs_extra=require(_0x4dd9('0xc'));var _=require(_0x4dd9('0xd'));var squel=require('squel');var crypto=require(_0x4dd9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4dd9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4dd9('0x10'));var Papa=require('papaparse');var Redis=require(_0x4dd9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4dd9('0x12'));var hardwareService=require(_0x4dd9('0x13'));var logger=require('../../config/logger')(_0x4dd9('0x14'));var utils=require('../../config/utils');var config=require(_0x4dd9('0x15'));var licenseUtil=require(_0x4dd9('0x16'));var db=require(_0x4dd9('0x17'))['db'];function respondWithStatusCode(_0x47cf44,_0xfdf92c){_0xfdf92c=_0xfdf92c||0xcc;return function(_0x51e46c){if(_0x51e46c){return _0x47cf44[_0x4dd9('0x18')](_0xfdf92c);}return _0x47cf44[_0x4dd9('0x19')](_0xfdf92c)[_0x4dd9('0x1a')]();};}function respondWithResult(_0x104522,_0x35b55e){_0x35b55e=_0x35b55e||0xc8;return function(_0x4ecfda){if(_0x4ecfda){return _0x104522['status'](_0x35b55e)[_0x4dd9('0x1b')](_0x4ecfda);}};}function respondWithFilteredResult(_0x221f46,_0x54e8e8){return function(_0x1b97b9){if(_0x1b97b9){var _0x1049a2=typeof _0x54e8e8[_0x4dd9('0x1c')]===_0x4dd9('0x1d')&&typeof _0x54e8e8['limit']===_0x4dd9('0x1d');var _0x19fb02=_0x1b97b9[_0x4dd9('0x1e')];var _0x5dd475=_0x1049a2?0x0:_0x54e8e8[_0x4dd9('0x1c')];var _0x3b7e51=_0x1049a2?_0x1b97b9[_0x4dd9('0x1e')]:_0x54e8e8[_0x4dd9('0x1c')]+_0x54e8e8['limit'];var _0x323277;if(_0x3b7e51>=_0x19fb02){_0x3b7e51=_0x19fb02;_0x323277=0xc8;}else{_0x323277=0xce;}_0x221f46['status'](_0x323277);return _0x221f46['set'](_0x4dd9('0x1f'),_0x5dd475+'-'+_0x3b7e51+'/'+_0x19fb02)[_0x4dd9('0x1b')](_0x1b97b9);}return null;};}function patchUpdates(_0x3d1fdf){return function(_0x5337fe){try{jsonpatch[_0x4dd9('0x20')](_0x5337fe,_0x3d1fdf,!![]);}catch(_0x2db0a3){return BPromise[_0x4dd9('0x21')](_0x2db0a3);}return _0x5337fe[_0x4dd9('0x22')]();};}function saveUpdates(_0x5d34e0,_0x26f9e7){return function(_0x1b7fcd){if(_0x1b7fcd){return _0x1b7fcd[_0x4dd9('0x23')](_0x5d34e0)['then'](function(_0x5cab6f){return _0x5cab6f;});}return null;};}function removeEntity(_0x37f82c,_0xf44981){return function(_0x34f8c8){if(_0x34f8c8){return _0x34f8c8[_0x4dd9('0x24')]()['then'](function(){_0x37f82c['status'](0xcc)[_0x4dd9('0x1a')]();});}};}function handleEntityNotFound(_0x22e5d6,_0x15af40){return function(_0x1c61f4){if(!_0x1c61f4){_0x22e5d6[_0x4dd9('0x18')](0x194);}return _0x1c61f4;};}function handleError(_0x340cdf,_0x5afd14){_0x5afd14=_0x5afd14||0x1f4;return function(_0x3d4ada){logger[_0x4dd9('0x25')](_0x3d4ada[_0x4dd9('0x26')]);if(_0x3d4ada['name']){delete _0x3d4ada[_0x4dd9('0x27')];}_0x340cdf['status'](_0x5afd14)[_0x4dd9('0x28')](_0x3d4ada);};}function getMustacheRender(_0x1b4025,_0x3540c7){return Mustache[_0x4dd9('0x29')](_0x1b4025,_[_0x4dd9('0x2a')](_0x3540c7[_0x4dd9('0x2b')],{'contact':_0x3540c7[_0x4dd9('0x2c')],'message':_0x3540c7['message'],'agent':_0x3540c7[_0x4dd9('0x2d')],'interaction':_0x3540c7[_0x4dd9('0x2e')],'account':_0x3540c7['account']}))||'';}exports[_0x4dd9('0x2f')]=function(_0x404ef0,_0x22889e){var _0x1e41fd={},_0x16547f={},_0x4f7cf2={'count':0x0,'rows':[]};var _0x5764df=_[_0x4dd9('0x30')](db[_0x4dd9('0x31')][_0x4dd9('0x32')],function(_0x5e0d38){return{'name':_0x5e0d38[_0x4dd9('0x33')],'type':_0x5e0d38['type']['key']};});_0x16547f[_0x4dd9('0x34')]=_[_0x4dd9('0x30')](_0x5764df,'name');_0x16547f['query']=_[_0x4dd9('0x35')](_0x404ef0['query']);_0x16547f[_0x4dd9('0x36')]=_['intersection'](_0x16547f[_0x4dd9('0x34')],_0x16547f['query']);_0x1e41fd['attributes']=_[_0x4dd9('0x37')](_0x16547f[_0x4dd9('0x34')],qs['fields'](_0x404ef0[_0x4dd9('0x38')][_0x4dd9('0x39')]));_0x1e41fd[_0x4dd9('0x3a')]=_0x1e41fd[_0x4dd9('0x3a')][_0x4dd9('0x3b')]?_0x1e41fd[_0x4dd9('0x3a')]:_0x16547f[_0x4dd9('0x34')];if(!_0x404ef0['query'][_0x4dd9('0x3c')](_0x4dd9('0x3d'))){_0x1e41fd['limit']=qs[_0x4dd9('0x3e')](_0x404ef0[_0x4dd9('0x38')][_0x4dd9('0x3e')]);_0x1e41fd[_0x4dd9('0x1c')]=qs[_0x4dd9('0x1c')](_0x404ef0['query'][_0x4dd9('0x1c')]);}_0x1e41fd['order']=qs[_0x4dd9('0x3f')](_0x404ef0[_0x4dd9('0x38')][_0x4dd9('0x3f')]);_0x1e41fd[_0x4dd9('0x40')]=qs['filters'](_['pick'](_0x404ef0[_0x4dd9('0x38')],_0x16547f[_0x4dd9('0x36')]),_0x5764df);if(_0x404ef0[_0x4dd9('0x38')][_0x4dd9('0x41')]){_0x1e41fd[_0x4dd9('0x40')]=_[_0x4dd9('0x2a')](_0x1e41fd[_0x4dd9('0x40')],{'$or':_[_0x4dd9('0x30')](_0x5764df,function(_0x27bc83){if(_0x27bc83['type']!==_0x4dd9('0x42')){var _0x5cb468={};_0x5cb468[_0x27bc83['name']]={'$like':'%'+_0x404ef0['query'][_0x4dd9('0x41')]+'%'};return _0x5cb468;}})});}_0x1e41fd=_['merge']({},_0x1e41fd,_0x404ef0['options']);var _0x47b73d={'where':_0x1e41fd[_0x4dd9('0x40')]};return db[_0x4dd9('0x31')]['count'](_0x47b73d)[_0x4dd9('0x43')](function(_0x1a167f){_0x4f7cf2[_0x4dd9('0x1e')]=_0x1a167f;if(_0x404ef0[_0x4dd9('0x38')][_0x4dd9('0x44')]){_0x1e41fd[_0x4dd9('0x45')]=[{'all':!![]}];}return db[_0x4dd9('0x31')][_0x4dd9('0x46')](_0x1e41fd);})['then'](function(_0x35ae52){_0x4f7cf2[_0x4dd9('0x47')]=_0x35ae52;return _0x4f7cf2;})['then'](respondWithFilteredResult(_0x22889e,_0x1e41fd))[_0x4dd9('0x48')](handleError(_0x22889e,null));};exports['show']=function(_0x2ac6e4,_0x572e71){var _0x531205={'raw':!![],'where':{'id':_0x2ac6e4[_0x4dd9('0x49')]['id']}},_0x449aed={};_0x449aed[_0x4dd9('0x34')]=_[_0x4dd9('0x35')](db[_0x4dd9('0x31')][_0x4dd9('0x32')]);_0x449aed['query']=_['keys'](_0x2ac6e4[_0x4dd9('0x38')]);_0x449aed[_0x4dd9('0x36')]=_[_0x4dd9('0x37')](_0x449aed[_0x4dd9('0x34')],_0x449aed['query']);_0x531205[_0x4dd9('0x3a')]=_[_0x4dd9('0x37')](_0x449aed[_0x4dd9('0x34')],qs[_0x4dd9('0x39')](_0x2ac6e4['query'][_0x4dd9('0x39')]));_0x531205[_0x4dd9('0x3a')]=_0x531205['attributes']['length']?_0x531205[_0x4dd9('0x3a')]:_0x449aed[_0x4dd9('0x34')];if(_0x2ac6e4[_0x4dd9('0x38')]['includeAll']){_0x531205['include']=[{'all':!![]}];}_0x531205=_[_0x4dd9('0x2a')]({},_0x531205,_0x2ac6e4[_0x4dd9('0x4a')]);return db[_0x4dd9('0x31')][_0x4dd9('0x4b')](_0x531205)[_0x4dd9('0x43')](handleEntityNotFound(_0x572e71,null))[_0x4dd9('0x43')](respondWithResult(_0x572e71,null))[_0x4dd9('0x48')](handleError(_0x572e71,null));};exports['create']=function(_0x10573d,_0x3ac9a7){return db['AnalyticTreeReport'][_0x4dd9('0x4c')](_0x10573d[_0x4dd9('0x2b')],{})['then'](respondWithResult(_0x3ac9a7,0xc9))[_0x4dd9('0x48')](handleError(_0x3ac9a7,null));};exports[_0x4dd9('0x23')]=function(_0x25facf,_0x4d16c6){if(_0x25facf['body']['id']){delete _0x25facf[_0x4dd9('0x2b')]['id'];}return db[_0x4dd9('0x31')]['find']({'where':{'id':_0x25facf[_0x4dd9('0x49')]['id']}})[_0x4dd9('0x43')](handleEntityNotFound(_0x4d16c6,null))[_0x4dd9('0x43')](saveUpdates(_0x25facf[_0x4dd9('0x2b')],null))[_0x4dd9('0x43')](respondWithResult(_0x4d16c6,null))[_0x4dd9('0x48')](handleError(_0x4d16c6,null));};exports[_0x4dd9('0x24')]=function(_0x2c9fb4,_0x307934){return db[_0x4dd9('0x31')][_0x4dd9('0x4b')]({'where':{'id':_0x2c9fb4[_0x4dd9('0x49')]['id']}})['then'](handleEntityNotFound(_0x307934,null))['then'](removeEntity(_0x307934,null))[_0x4dd9('0x48')](handleError(_0x307934,null));}; \ No newline at end of file +var _0xff8a=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','error','stack','name','render','merge','body','message','agent','interaction','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','AnalyticTreeReport','then','includeAll','findAll','rows','catch','show','params','keys','include','create','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x3beffb,_0x5c62bb){var _0x2274ca=function(_0x67ebf7){while(--_0x67ebf7){_0x3beffb['push'](_0x3beffb['shift']());}};_0x2274ca(++_0x5c62bb);}(_0xff8a,0x167));var _0xaff8=function(_0x4561fa,_0x1c2d3f){_0x4561fa=_0x4561fa-0x0;var _0x1775f6=_0xff8a[_0x4561fa];return _0x1775f6;};'use strict';var emlformat=require(_0xaff8('0x0'));var rimraf=require(_0xaff8('0x1'));var zipdir=require(_0xaff8('0x2'));var jsonpatch=require(_0xaff8('0x3'));var rp=require(_0xaff8('0x4'));var moment=require(_0xaff8('0x5'));var BPromise=require(_0xaff8('0x6'));var Mustache=require(_0xaff8('0x7'));var util=require(_0xaff8('0x8'));var path=require(_0xaff8('0x9'));var sox=require(_0xaff8('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaff8('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaff8('0xc'));var deskjs=require(_0xaff8('0xd'));var toCsv=require(_0xaff8('0xe'));var querystring=require(_0xaff8('0xf'));var Papa=require(_0xaff8('0x10'));var Redis=require(_0xaff8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaff8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaff8('0x13'))(_0xaff8('0x14'));var utils=require(_0xaff8('0x15'));var config=require(_0xaff8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaff8('0x17'))['db'];function respondWithStatusCode(_0x1d74c1,_0x165c9b){_0x165c9b=_0x165c9b||0xcc;return function(_0x333b4c){if(_0x333b4c){return _0x1d74c1[_0xaff8('0x18')](_0x165c9b);}return _0x1d74c1[_0xaff8('0x19')](_0x165c9b)[_0xaff8('0x1a')]();};}function respondWithResult(_0x5d5d29,_0x45a9b4){_0x45a9b4=_0x45a9b4||0xc8;return function(_0x4d1eb0){if(_0x4d1eb0){return _0x5d5d29['status'](_0x45a9b4)[_0xaff8('0x1b')](_0x4d1eb0);}};}function respondWithFilteredResult(_0x174707,_0x253f2e){return function(_0x4149b3){if(_0x4149b3){var _0x2bfd0c=typeof _0x253f2e[_0xaff8('0x1c')]===_0xaff8('0x1d')&&typeof _0x253f2e[_0xaff8('0x1e')]===_0xaff8('0x1d');var _0x4cd75e=_0x4149b3['count'];var _0x4a60e2=_0x2bfd0c?0x0:_0x253f2e[_0xaff8('0x1c')];var _0x271dd4=_0x2bfd0c?_0x4149b3[_0xaff8('0x1f')]:_0x253f2e[_0xaff8('0x1c')]+_0x253f2e[_0xaff8('0x1e')];var _0x12ca42;if(_0x271dd4>=_0x4cd75e){_0x271dd4=_0x4cd75e;_0x12ca42=0xc8;}else{_0x12ca42=0xce;}_0x174707[_0xaff8('0x19')](_0x12ca42);return _0x174707[_0xaff8('0x20')](_0xaff8('0x21'),_0x4a60e2+'-'+_0x271dd4+'/'+_0x4cd75e)['json'](_0x4149b3);}return null;};}function patchUpdates(_0x4ca6ea){return function(_0x2f840e){try{jsonpatch['apply'](_0x2f840e,_0x4ca6ea,!![]);}catch(_0x4a89e4){return BPromise[_0xaff8('0x22')](_0x4a89e4);}return _0x2f840e[_0xaff8('0x23')]();};}function saveUpdates(_0x3f9355,_0x32c3aa){return function(_0x25aa57){if(_0x25aa57){return _0x25aa57['update'](_0x3f9355)['then'](function(_0x66fc28){return _0x66fc28;});}return null;};}function removeEntity(_0x2c05fb,_0x13679d){return function(_0x5bf46d){if(_0x5bf46d){return _0x5bf46d[_0xaff8('0x24')]()['then'](function(){_0x2c05fb[_0xaff8('0x19')](0xcc)[_0xaff8('0x1a')]();});}};}function handleEntityNotFound(_0x48d3f8,_0x433518){return function(_0x587e22){if(!_0x587e22){_0x48d3f8[_0xaff8('0x18')](0x194);}return _0x587e22;};}function handleError(_0x285f6e,_0x3ec552){_0x3ec552=_0x3ec552||0x1f4;return function(_0x440c5d){logger[_0xaff8('0x25')](_0x440c5d[_0xaff8('0x26')]);if(_0x440c5d['name']){delete _0x440c5d[_0xaff8('0x27')];}_0x285f6e[_0xaff8('0x19')](_0x3ec552)['send'](_0x440c5d);};}function getMustacheRender(_0x5a0aa0,_0x7f8f59){return Mustache[_0xaff8('0x28')](_0x5a0aa0,_[_0xaff8('0x29')](_0x7f8f59[_0xaff8('0x2a')],{'contact':_0x7f8f59['contact'],'message':_0x7f8f59[_0xaff8('0x2b')],'agent':_0x7f8f59[_0xaff8('0x2c')],'interaction':_0x7f8f59[_0xaff8('0x2d')],'account':_0x7f8f59['account']}))||'';}exports['index']=function(_0x422b49,_0x1d6235){var _0x5ea3e3={},_0x5c2f43={},_0xd21a85={'count':0x0,'rows':[]};var _0x45eea4=_['map'](db['AnalyticTreeReport'][_0xaff8('0x2e')],function(_0xfac538){return{'name':_0xfac538['fieldName'],'type':_0xfac538[_0xaff8('0x2f')][_0xaff8('0x30')]};});_0x5c2f43[_0xaff8('0x31')]=_[_0xaff8('0x32')](_0x45eea4,'name');_0x5c2f43[_0xaff8('0x33')]=_['keys'](_0x422b49['query']);_0x5c2f43[_0xaff8('0x34')]=_[_0xaff8('0x35')](_0x5c2f43[_0xaff8('0x31')],_0x5c2f43['query']);_0x5ea3e3[_0xaff8('0x36')]=_['intersection'](_0x5c2f43[_0xaff8('0x31')],qs[_0xaff8('0x37')](_0x422b49[_0xaff8('0x33')][_0xaff8('0x37')]));_0x5ea3e3[_0xaff8('0x36')]=_0x5ea3e3[_0xaff8('0x36')][_0xaff8('0x38')]?_0x5ea3e3['attributes']:_0x5c2f43[_0xaff8('0x31')];if(!_0x422b49['query'][_0xaff8('0x39')](_0xaff8('0x3a'))){_0x5ea3e3[_0xaff8('0x1e')]=qs[_0xaff8('0x1e')](_0x422b49['query']['limit']);_0x5ea3e3['offset']=qs[_0xaff8('0x1c')](_0x422b49['query'][_0xaff8('0x1c')]);}_0x5ea3e3[_0xaff8('0x3b')]=qs[_0xaff8('0x3c')](_0x422b49[_0xaff8('0x33')]['sort']);_0x5ea3e3[_0xaff8('0x3d')]=qs['filters'](_[_0xaff8('0x3e')](_0x422b49[_0xaff8('0x33')],_0x5c2f43[_0xaff8('0x34')]),_0x45eea4);if(_0x422b49[_0xaff8('0x33')]['filter']){_0x5ea3e3[_0xaff8('0x3d')]=_[_0xaff8('0x29')](_0x5ea3e3[_0xaff8('0x3d')],{'$or':_[_0xaff8('0x32')](_0x45eea4,function(_0x36ab27){if(_0x36ab27[_0xaff8('0x2f')]!=='VIRTUAL'){var _0x256887={};_0x256887[_0x36ab27['name']]={'$like':'%'+_0x422b49[_0xaff8('0x33')][_0xaff8('0x3f')]+'%'};return _0x256887;}})});}_0x5ea3e3=_[_0xaff8('0x29')]({},_0x5ea3e3,_0x422b49[_0xaff8('0x40')]);var _0x5c82d1={'where':_0x5ea3e3[_0xaff8('0x3d')]};return db[_0xaff8('0x41')][_0xaff8('0x1f')](_0x5c82d1)[_0xaff8('0x42')](function(_0x5cf40a){_0xd21a85[_0xaff8('0x1f')]=_0x5cf40a;if(_0x422b49[_0xaff8('0x33')][_0xaff8('0x43')]){_0x5ea3e3['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xaff8('0x44')](_0x5ea3e3);})[_0xaff8('0x42')](function(_0x1d82f4){_0xd21a85[_0xaff8('0x45')]=_0x1d82f4;return _0xd21a85;})[_0xaff8('0x42')](respondWithFilteredResult(_0x1d6235,_0x5ea3e3))[_0xaff8('0x46')](handleError(_0x1d6235,null));};exports[_0xaff8('0x47')]=function(_0x37e6f7,_0x49056b){var _0x391ad3={'raw':!![],'where':{'id':_0x37e6f7[_0xaff8('0x48')]['id']}},_0x5bd1af={};_0x5bd1af[_0xaff8('0x31')]=_[_0xaff8('0x49')](db[_0xaff8('0x41')][_0xaff8('0x2e')]);_0x5bd1af['query']=_[_0xaff8('0x49')](_0x37e6f7['query']);_0x5bd1af['filters']=_[_0xaff8('0x35')](_0x5bd1af[_0xaff8('0x31')],_0x5bd1af[_0xaff8('0x33')]);_0x391ad3[_0xaff8('0x36')]=_[_0xaff8('0x35')](_0x5bd1af[_0xaff8('0x31')],qs['fields'](_0x37e6f7[_0xaff8('0x33')][_0xaff8('0x37')]));_0x391ad3[_0xaff8('0x36')]=_0x391ad3[_0xaff8('0x36')][_0xaff8('0x38')]?_0x391ad3[_0xaff8('0x36')]:_0x5bd1af[_0xaff8('0x31')];if(_0x37e6f7[_0xaff8('0x33')]['includeAll']){_0x391ad3[_0xaff8('0x4a')]=[{'all':!![]}];}_0x391ad3=_[_0xaff8('0x29')]({},_0x391ad3,_0x37e6f7[_0xaff8('0x40')]);return db[_0xaff8('0x41')]['find'](_0x391ad3)['then'](handleEntityNotFound(_0x49056b,null))['then'](respondWithResult(_0x49056b,null))[_0xaff8('0x46')](handleError(_0x49056b,null));};exports[_0xaff8('0x4b')]=function(_0x2a710f,_0x4999aa){return db[_0xaff8('0x41')][_0xaff8('0x4b')](_0x2a710f[_0xaff8('0x2a')],{})[_0xaff8('0x42')](respondWithResult(_0x4999aa,0xc9))[_0xaff8('0x46')](handleError(_0x4999aa,null));};exports['update']=function(_0x3cbb8f,_0x4ab967){if(_0x3cbb8f[_0xaff8('0x2a')]['id']){delete _0x3cbb8f[_0xaff8('0x2a')]['id'];}return db['AnalyticTreeReport'][_0xaff8('0x4c')]({'where':{'id':_0x3cbb8f['params']['id']}})['then'](handleEntityNotFound(_0x4ab967,null))[_0xaff8('0x42')](saveUpdates(_0x3cbb8f[_0xaff8('0x2a')],null))[_0xaff8('0x42')](respondWithResult(_0x4ab967,null))['catch'](handleError(_0x4ab967,null));};exports[_0xaff8('0x24')]=function(_0xbfd93c,_0x26682e){return db[_0xaff8('0x41')][_0xaff8('0x4c')]({'where':{'id':_0xbfd93c[_0xaff8('0x48')]['id']}})[_0xaff8('0x42')](handleEntityNotFound(_0x26682e,null))[_0xaff8('0x42')](removeEntity(_0x26682e,null))[_0xaff8('0x46')](handleError(_0x26682e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 43d10ec..8342fa5 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 _0x5204=['request-promise','path','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird'];(function(_0x5f0f7a,_0x244c53){var _0x8742e7=function(_0x48ff6e){while(--_0x48ff6e){_0x5f0f7a['push'](_0x5f0f7a['shift']());}};_0x8742e7(++_0x244c53);}(_0x5204,0xdf));var _0x4520=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x5204[_0x324012];return _0x435cf2;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa37=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash'];(function(_0x3d6e71,_0x5816fb){var _0x2b17af=function(_0x54266b){while(--_0x54266b){_0x3d6e71['push'](_0x3d6e71['shift']());}};_0x2b17af(++_0x5816fb);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xaa37[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var logger=require(_0x7aa3('0x2'))(_0x7aa3('0x3'));var moment=require('moment');var BPromise=require(_0x7aa3('0x4'));var rp=require(_0x7aa3('0x5'));var fs=require('fs');var path=require(_0x7aa3('0x6'));var rimraf=require(_0x7aa3('0x7'));var config=require(_0x7aa3('0x8'));var attributes=require(_0x7aa3('0x9'));module[_0x7aa3('0xa')]=function(_0x5b738a,_0x437b90){return _0x5b738a[_0x7aa3('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0x7aa3('0xc'),'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 c3ef9de..dbca7ac 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 _0x9aa9=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticTreeReport,\x20%s,\x20%s','message','moment','bluebird'];(function(_0x2c7eb4,_0x37591e){var _0xe2dedc=function(_0x2ccac0){while(--_0x2ccac0){_0x2c7eb4['push'](_0x2c7eb4['shift']());}};_0xe2dedc(++_0x37591e);}(_0x9aa9,0x12e));var _0x99aa=function(_0x47acac,_0x3b8af6){_0x47acac=_0x47acac-0x0;var _0xebed16=_0x9aa9[_0x47acac];return _0xebed16;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x99aa('0x0'));var BPromise=require(_0x99aa('0x1'));var rs=require(_0x99aa('0x2'));var fs=require('fs');var Redis=require(_0x99aa('0x3'));var db=require(_0x99aa('0x4'))['db'];var utils=require(_0x99aa('0x5'));var logger=require('../../config/logger')(_0x99aa('0x6'));var config=require(_0x99aa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x99aa('0x8')][_0x99aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xec0bee,_0x30b6e4,_0x5e4aa6){return new BPromise(function(_0x166bd7,_0x42424d){return client['request'](_0xec0bee,_0x5e4aa6)['then'](function(_0x2f02a5){logger[_0x99aa('0xa')]('AnalyticTreeReport,\x20%s,\x20%s',_0x30b6e4,_0x99aa('0xb'));logger[_0x99aa('0xc')](_0x99aa('0xd'),_0x30b6e4,_0x99aa('0xb'),JSON[_0x99aa('0xe')](_0x2f02a5));if(_0x2f02a5['error']){if(_0x2f02a5[_0x99aa('0xf')][_0x99aa('0x10')]===0x1f4){logger['error'](_0x99aa('0x11'),_0x30b6e4,_0x2f02a5['error'][_0x99aa('0x12')]);return _0x42424d(_0x2f02a5[_0x99aa('0xf')]['message']);}logger['error'](_0x99aa('0x11'),_0x30b6e4,_0x2f02a5[_0x99aa('0xf')][_0x99aa('0x12')]);return _0x166bd7(_0x2f02a5[_0x99aa('0xf')]['message']);}else{logger[_0x99aa('0xa')](_0x99aa('0x11'),_0x30b6e4,_0x99aa('0xb'));_0x166bd7(_0x2f02a5['result'][_0x99aa('0x12')]);}})['catch'](function(_0x29b248){logger[_0x99aa('0xf')](_0x99aa('0x11'),_0x30b6e4,_0x29b248);_0x42424d(_0x29b248);});});} \ No newline at end of file +var _0x0d1e=['rpc','jayson/promise','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2cd9e8,_0x3520ed){var _0x2f712f=function(_0x769f94){while(--_0x769f94){_0x2cd9e8['push'](_0x2cd9e8['shift']());}};_0x2f712f(++_0x3520ed);}(_0x0d1e,0x184));var _0xe0d1=function(_0x2b304e,_0x27a4a1){_0x2b304e=_0x2b304e-0x0;var _0x274ae5=_0x0d1e[_0x2b304e];return _0x274ae5;};'use strict';var _=require(_0xe0d1('0x0'));var util=require(_0xe0d1('0x1'));var moment=require(_0xe0d1('0x2'));var BPromise=require(_0xe0d1('0x3'));var rs=require(_0xe0d1('0x4'));var fs=require('fs');var Redis=require(_0xe0d1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0d1('0x6'));var logger=require(_0xe0d1('0x7'))(_0xe0d1('0x8'));var config=require('../../config/environment');var jayson=require(_0xe0d1('0x9'));var client=jayson['client'][_0xe0d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x557d45,_0xf5393,_0x1d7dc4){return new BPromise(function(_0x53aa0f,_0x1cfff5){return client[_0xe0d1('0xb')](_0x557d45,_0x1d7dc4)[_0xe0d1('0xc')](function(_0x43def3){logger[_0xe0d1('0xd')](_0xe0d1('0xe'),_0xf5393,_0xe0d1('0xf'));logger[_0xe0d1('0x10')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xf5393,_0xe0d1('0xf'),JSON[_0xe0d1('0x11')](_0x43def3));if(_0x43def3['error']){if(_0x43def3[_0xe0d1('0x12')][_0xe0d1('0x13')]===0x1f4){logger[_0xe0d1('0x12')](_0xe0d1('0xe'),_0xf5393,_0x43def3[_0xe0d1('0x12')]['message']);return _0x1cfff5(_0x43def3[_0xe0d1('0x12')][_0xe0d1('0x14')]);}logger[_0xe0d1('0x12')](_0xe0d1('0xe'),_0xf5393,_0x43def3[_0xe0d1('0x12')][_0xe0d1('0x14')]);return _0x53aa0f(_0x43def3[_0xe0d1('0x12')]['message']);}else{logger[_0xe0d1('0xd')](_0xe0d1('0xe'),_0xf5393,_0xe0d1('0xf'));_0x53aa0f(_0x43def3['result'][_0xe0d1('0x14')]);}})[_0xe0d1('0x15')](function(_0xa0160b){logger[_0xe0d1('0x12')](_0xe0d1('0xe'),_0xf5393,_0xa0160b);_0x1cfff5(_0xa0160b);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index b32e5de..ebb2d45 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 _0x2524=['show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x2524,0x8c));var _0x4252=function(_0x54e756,_0x18fa40){_0x54e756=_0x54e756-0x0;var _0x351911=_0x2524[_0x54e756];return _0x351911;};'use strict';var multer=require(_0x4252('0x0'));var util=require(_0x4252('0x1'));var path=require('path');var timeout=require(_0x4252('0x2'));var express=require(_0x4252('0x3'));var router=express[_0x4252('0x4')]();var fs_extra=require(_0x4252('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4252('0x6'));var config=require(_0x4252('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x4252('0x8')]('/',auth[_0x4252('0x9')](),controller[_0x4252('0xa')]);router[_0x4252('0x8')](_0x4252('0xb'),auth[_0x4252('0x9')](),controller[_0x4252('0xc')]);router[_0x4252('0xd')]('/',auth[_0x4252('0x9')](),controller[_0x4252('0xe')]);router[_0x4252('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x4252('0x10')]);router['delete']('/:id',auth[_0x4252('0x9')](),controller[_0x4252('0x11')]);module[_0x4252('0x12')]=router; \ No newline at end of file +var _0x2964=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x46b392,_0x59e8bd){var _0x30963a=function(_0xe26c37){while(--_0xe26c37){_0x46b392['push'](_0x46b392['shift']());}};_0x30963a(++_0x59e8bd);}(_0x2964,0x108));var _0x4296=function(_0x7f0f22,_0xaa2187){_0x7f0f22=_0x7f0f22-0x0;var _0x50334a=_0x2964[_0x7f0f22];return _0x50334a;};'use strict';var multer=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var path=require(_0x4296('0x2'));var timeout=require(_0x4296('0x3'));var express=require(_0x4296('0x4'));var router=express[_0x4296('0x5')]();var fs_extra=require(_0x4296('0x6'));var auth=require(_0x4296('0x7'));var interaction=require(_0x4296('0x8'));var config=require('../../config/environment');var controller=require(_0x4296('0x9'));router[_0x4296('0xa')]('/',auth[_0x4296('0xb')](),controller[_0x4296('0xc')]);router[_0x4296('0xa')](_0x4296('0xd'),auth['isAuthenticated'](),controller[_0x4296('0xe')]);router[_0x4296('0xf')]('/',auth[_0x4296('0xb')](),controller[_0x4296('0x10')]);router[_0x4296('0x11')](_0x4296('0xd'),auth[_0x4296('0xb')](),controller[_0x4296('0x12')]);router[_0x4296('0x13')](_0x4296('0xd'),auth[_0x4296('0xb')](),controller[_0x4296('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index dcfc99d..b33e775 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 _0x44b3=['exports','STRING','sequelize'];(function(_0x1a3d17,_0x95a7be){var _0x539d97=function(_0x1ce73f){while(--_0x1ce73f){_0x1a3d17['push'](_0x1a3d17['shift']());}};_0x539d97(++_0x95a7be);}(_0x44b3,0x1a9));var _0x344b=function(_0x4858b1,_0x11ddb8){_0x4858b1=_0x4858b1-0x0;var _0x2e222c=_0x44b3[_0x4858b1];return _0x2e222c;};'use strict';var Sequelize=require(_0x344b('0x0'));module[_0x344b('0x1')]={'name':{'type':Sequelize[_0x344b('0x2')]},'basename':{'type':Sequelize[_0x344b('0x2')]},'type':{'type':Sequelize[_0x344b('0x2')]}}; \ No newline at end of file +var _0xbb72=['sequelize','STRING'];(function(_0x3c729b,_0x2a4146){var _0x55894c=function(_0x183a16){while(--_0x183a16){_0x3c729b['push'](_0x3c729b['shift']());}};_0x55894c(++_0x2a4146);}(_0xbb72,0x19c));var _0x2bb7=function(_0x3aebfe,_0x54ea35){_0x3aebfe=_0x3aebfe-0x0;var _0x458547=_0xbb72[_0x3aebfe];return _0x458547;};'use strict';var Sequelize=require(_0x2bb7('0x0'));module['exports']={'name':{'type':Sequelize[_0x2bb7('0x1')]},'basename':{'type':Sequelize[_0x2bb7('0x1')]},'type':{'type':Sequelize[_0x2bb7('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 62d1ae2..a98a1d3 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 _0x6bd4=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','update','then','destroy','send','render','merge','body','message','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','Attachment','rows','catch','show','params','find','get','omit','createdAt','updatedAt','create','file','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x55ee0c,_0x51b713){var _0x2d8f6b=function(_0x4c217c){while(--_0x4c217c){_0x55ee0c['push'](_0x55ee0c['shift']());}};_0x2d8f6b(++_0x51b713);}(_0x6bd4,0x1b2));var _0x46bd=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x6bd4[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require(_0x46bd('0x0'));var rimraf=require(_0x46bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x46bd('0x2'));var moment=require(_0x46bd('0x3'));var BPromise=require(_0x46bd('0x4'));var Mustache=require(_0x46bd('0x5'));var util=require(_0x46bd('0x6'));var path=require(_0x46bd('0x7'));var sox=require(_0x46bd('0x8'));var csv=require(_0x46bd('0x9'));var ejs=require(_0x46bd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46bd('0xb'));var squel=require(_0x46bd('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46bd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x46bd('0xe'));var Papa=require(_0x46bd('0xf'));var Redis=require(_0x46bd('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46bd('0x11'));var logger=require(_0x46bd('0x12'))(_0x46bd('0x13'));var utils=require(_0x46bd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x46bd('0x15'));var db=require(_0x46bd('0x16'))['db'];function respondWithStatusCode(_0x4d586d,_0x49284d){_0x49284d=_0x49284d||0xcc;return function(_0x1f0141){if(_0x1f0141){return _0x4d586d[_0x46bd('0x17')](_0x49284d);}return _0x4d586d[_0x46bd('0x18')](_0x49284d)[_0x46bd('0x19')]();};}function respondWithResult(_0x3f5412,_0x5ed420){_0x5ed420=_0x5ed420||0xc8;return function(_0x36e9c3){if(_0x36e9c3){return _0x3f5412[_0x46bd('0x18')](_0x5ed420)['json'](_0x36e9c3);}};}function respondWithFilteredResult(_0x4406c4,_0xb0c162){return function(_0x3aa267){if(_0x3aa267){var _0x28b5db=typeof _0xb0c162[_0x46bd('0x1a')]===_0x46bd('0x1b')&&typeof _0xb0c162[_0x46bd('0x1c')]===_0x46bd('0x1b');var _0xf3d78c=_0x3aa267['count'];var _0xe8c5e2=_0x28b5db?0x0:_0xb0c162['offset'];var _0x3b9d1a=_0x28b5db?_0x3aa267[_0x46bd('0x1d')]:_0xb0c162[_0x46bd('0x1a')]+_0xb0c162[_0x46bd('0x1c')];var _0x503665;if(_0x3b9d1a>=_0xf3d78c){_0x3b9d1a=_0xf3d78c;_0x503665=0xc8;}else{_0x503665=0xce;}_0x4406c4[_0x46bd('0x18')](_0x503665);return _0x4406c4[_0x46bd('0x1e')]('Content-Range',_0xe8c5e2+'-'+_0x3b9d1a+'/'+_0xf3d78c)[_0x46bd('0x1f')](_0x3aa267);}return null;};}function patchUpdates(_0x5505f2){return function(_0x1e9fcb){try{jsonpatch[_0x46bd('0x20')](_0x1e9fcb,_0x5505f2,!![]);}catch(_0x34dec6){return BPromise['reject'](_0x34dec6);}return _0x1e9fcb['save']();};}function saveUpdates(_0x37e702,_0x3b759c){return function(_0xd36dcb){if(_0xd36dcb){return _0xd36dcb[_0x46bd('0x21')](_0x37e702)[_0x46bd('0x22')](function(_0x80ff54){return _0x80ff54;});}return null;};}function removeEntity(_0x33bcd7,_0x208c20){return function(_0x4ec149){if(_0x4ec149){return _0x4ec149[_0x46bd('0x23')]()[_0x46bd('0x22')](function(){_0x33bcd7['status'](0xcc)[_0x46bd('0x19')]();});}};}function handleEntityNotFound(_0x3821d2,_0x5b9ad0){return function(_0x268c88){if(!_0x268c88){_0x3821d2[_0x46bd('0x17')](0x194);}return _0x268c88;};}function handleError(_0x5b824f,_0x362fba){_0x362fba=_0x362fba||0x1f4;return function(_0x29b1cd){logger['error'](_0x29b1cd['stack']);if(_0x29b1cd['name']){delete _0x29b1cd['name'];}_0x5b824f[_0x46bd('0x18')](_0x362fba)[_0x46bd('0x24')](_0x29b1cd);};}function getMustacheRender(_0x29b4fa,_0x5ff485){return Mustache[_0x46bd('0x25')](_0x29b4fa,_[_0x46bd('0x26')](_0x5ff485[_0x46bd('0x27')],{'contact':_0x5ff485['contact'],'message':_0x5ff485[_0x46bd('0x28')],'agent':_0x5ff485[_0x46bd('0x29')],'interaction':_0x5ff485[_0x46bd('0x2a')],'account':_0x5ff485[_0x46bd('0x2b')]}))||'';}exports[_0x46bd('0x2c')]=function(_0x309908,_0x5da82f){var _0x51ae76={},_0x2c64f3={},_0x11f8ad={'count':0x0,'rows':[]};var _0x49bb29=_[_0x46bd('0x2d')](db['Attachment'][_0x46bd('0x2e')],function(_0x54708f){return{'name':_0x54708f[_0x46bd('0x2f')],'type':_0x54708f[_0x46bd('0x30')][_0x46bd('0x31')]};});_0x2c64f3[_0x46bd('0x32')]=_[_0x46bd('0x2d')](_0x49bb29,_0x46bd('0x33'));_0x2c64f3['query']=_[_0x46bd('0x34')](_0x309908[_0x46bd('0x35')]);_0x2c64f3[_0x46bd('0x36')]=_[_0x46bd('0x37')](_0x2c64f3['model'],_0x2c64f3['query']);_0x51ae76['attributes']=_[_0x46bd('0x37')](_0x2c64f3[_0x46bd('0x32')],qs['fields'](_0x309908[_0x46bd('0x35')][_0x46bd('0x38')]));_0x51ae76['attributes']=_0x51ae76[_0x46bd('0x39')][_0x46bd('0x3a')]?_0x51ae76[_0x46bd('0x39')]:_0x2c64f3[_0x46bd('0x32')];if(!_0x309908[_0x46bd('0x35')][_0x46bd('0x3b')](_0x46bd('0x3c'))){_0x51ae76[_0x46bd('0x1c')]=qs['limit'](_0x309908[_0x46bd('0x35')][_0x46bd('0x1c')]);_0x51ae76[_0x46bd('0x1a')]=qs[_0x46bd('0x1a')](_0x309908[_0x46bd('0x35')][_0x46bd('0x1a')]);}_0x51ae76[_0x46bd('0x3d')]=qs['sort'](_0x309908[_0x46bd('0x35')][_0x46bd('0x3e')]);_0x51ae76[_0x46bd('0x3f')]=qs[_0x46bd('0x36')](_[_0x46bd('0x40')](_0x309908[_0x46bd('0x35')],_0x2c64f3[_0x46bd('0x36')]),_0x49bb29);if(_0x309908['query'][_0x46bd('0x41')]){_0x51ae76[_0x46bd('0x3f')]=_[_0x46bd('0x26')](_0x51ae76[_0x46bd('0x3f')],{'$or':_['map'](_0x49bb29,function(_0x3525c7){if(_0x3525c7['type']!==_0x46bd('0x42')){var _0x49e674={};_0x49e674[_0x3525c7[_0x46bd('0x33')]]={'$like':'%'+_0x309908[_0x46bd('0x35')][_0x46bd('0x41')]+'%'};return _0x49e674;}})});}_0x51ae76=_[_0x46bd('0x26')]({},_0x51ae76,_0x309908[_0x46bd('0x43')]);var _0x265435={'where':_0x51ae76['where']};return db['Attachment'][_0x46bd('0x1d')](_0x265435)[_0x46bd('0x22')](function(_0x30f9b6){_0x11f8ad[_0x46bd('0x1d')]=_0x30f9b6;if(_0x309908[_0x46bd('0x35')][_0x46bd('0x44')]){_0x51ae76[_0x46bd('0x45')]=[{'all':!![]}];}return db[_0x46bd('0x46')]['findAll'](_0x51ae76);})[_0x46bd('0x22')](function(_0x1ace91){_0x11f8ad[_0x46bd('0x47')]=_0x1ace91;return _0x11f8ad;})[_0x46bd('0x22')](respondWithFilteredResult(_0x5da82f,_0x51ae76))[_0x46bd('0x48')](handleError(_0x5da82f,null));};exports[_0x46bd('0x49')]=function(_0x275873,_0x16b631){var _0x3b6c23={'raw':!![],'where':{'id':_0x275873[_0x46bd('0x4a')]['id']}},_0x28fe2e={};_0x28fe2e[_0x46bd('0x32')]=_[_0x46bd('0x34')](db['Attachment'][_0x46bd('0x2e')]);_0x28fe2e[_0x46bd('0x35')]=_[_0x46bd('0x34')](_0x275873[_0x46bd('0x35')]);_0x28fe2e[_0x46bd('0x36')]=_['intersection'](_0x28fe2e[_0x46bd('0x32')],_0x28fe2e['query']);_0x3b6c23[_0x46bd('0x39')]=_[_0x46bd('0x37')](_0x28fe2e[_0x46bd('0x32')],qs['fields'](_0x275873[_0x46bd('0x35')][_0x46bd('0x38')]));_0x3b6c23['attributes']=_0x3b6c23[_0x46bd('0x39')]['length']?_0x3b6c23[_0x46bd('0x39')]:_0x28fe2e['model'];if(_0x275873[_0x46bd('0x35')][_0x46bd('0x44')]){_0x3b6c23['include']=[{'all':!![]}];}_0x3b6c23=_[_0x46bd('0x26')]({},_0x3b6c23,_0x275873['options']);return db['Attachment'][_0x46bd('0x4b')](_0x3b6c23)[_0x46bd('0x22')](handleEntityNotFound(_0x16b631,null))[_0x46bd('0x22')](respondWithResult(_0x16b631,null))['catch'](handleError(_0x16b631,null));};exports['clone']=function(_0x2480a9,_0x34bec4){var _0x41de22={'where':{'id':_0x2480a9[_0x46bd('0x4a')]['id']}},_0x4f7e35={};_0x4f7e35[_0x46bd('0x32')]=_[_0x46bd('0x34')](db[_0x46bd('0x46')][_0x46bd('0x2e')]);_0x41de22[_0x46bd('0x39')]=_['intersection'](_0x4f7e35['model'],qs[_0x46bd('0x38')](_0x2480a9[_0x46bd('0x35')][_0x46bd('0x38')]));_0x41de22[_0x46bd('0x39')]=_0x41de22[_0x46bd('0x39')][_0x46bd('0x3a')]?_0x41de22[_0x46bd('0x39')]:_0x4f7e35['model'];if(_0x2480a9['query'][_0x46bd('0x44')]){_0x41de22[_0x46bd('0x45')]=[{'all':!![]}];}_0x41de22=_[_0x46bd('0x26')]({},_0x41de22,_0x2480a9[_0x46bd('0x43')]);return db[_0x46bd('0x46')][_0x46bd('0x4b')](_0x41de22)[_0x46bd('0x22')](handleEntityNotFound(_0x34bec4,null))['then'](function(_0x1f0acd){if(_0x1f0acd){var _0x58bf81=_0x1f0acd[_0x46bd('0x4c')]({'plain':!![]});_0x58bf81=qs[_0x46bd('0x4d')](_0x58bf81,['id',_0x46bd('0x4e'),_0x46bd('0x4f')]);_0x2480a9[_0x46bd('0x27')]=_[_0x46bd('0x4d')](_0x2480a9[_0x46bd('0x27')],['id',_0x46bd('0x4e'),'updatedAt']);return db['Attachment'][_0x46bd('0x50')](_[_0x46bd('0x26')](_0x58bf81,_0x2480a9[_0x46bd('0x27')]),{'include':_0x2480a9[_0x46bd('0x35')][_0x46bd('0x44')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x34bec4,0xc9))[_0x46bd('0x48')](handleError(_0x34bec4,null));};exports[_0x46bd('0x21')]=function(_0x191c5a,_0x46c345){if(_0x191c5a[_0x46bd('0x27')]['id']){delete _0x191c5a[_0x46bd('0x27')]['id'];}return db['Attachment'][_0x46bd('0x4b')]({'where':{'id':_0x191c5a[_0x46bd('0x4a')]['id']}})[_0x46bd('0x22')](handleEntityNotFound(_0x46c345,null))['then'](saveUpdates(_0x191c5a[_0x46bd('0x27')],null))['then'](respondWithResult(_0x46c345,null))['catch'](handleError(_0x46c345,null));};exports[_0x46bd('0x23')]=function(_0x267eba,_0x14f9e7){return db['Attachment'][_0x46bd('0x4b')]({'where':{'id':_0x267eba[_0x46bd('0x4a')]['id']}})[_0x46bd('0x22')](handleEntityNotFound(_0x14f9e7,null))['then'](removeEntity(_0x14f9e7,null))['catch'](handleError(_0x14f9e7,null));};exports[_0x46bd('0x50')]=function(_0x4acb2f,_0x494b73,_0x4aec93){_0x4acb2f[_0x46bd('0x27')]['name']=_0x4acb2f[_0x46bd('0x51')]['originalname'];_0x4acb2f[_0x46bd('0x27')][_0x46bd('0x52')]=_0x4acb2f[_0x46bd('0x51')]['filename'];_0x4acb2f[_0x46bd('0x27')]['type']=_0x4acb2f[_0x46bd('0x51')][_0x46bd('0x53')];return db[_0x46bd('0x46')][_0x46bd('0x50')](_0x4acb2f[_0x46bd('0x27')])[_0x46bd('0x22')](respondWithResult(_0x494b73,0xc9))['catch'](handleError(_0x494b73,null));};exports[_0x46bd('0x54')]=function(_0x5959dc,_0x4d2bcb,_0xce4a88){return db[_0x46bd('0x46')][_0x46bd('0x55')]({'where':{'id':_0x5959dc[_0x46bd('0x4a')]['id']},'raw':!![]})[_0x46bd('0x22')](handleEntityNotFound(_0x4d2bcb,null))[_0x46bd('0x22')](function(_0x176d06){if(_0x176d06){var _0x46d3b4=_0x176d06[_0x46bd('0x56')]!==null;var _0x22b014=path[_0x46bd('0x57')](config[_0x46bd('0x58')],_0x46bd('0x59'));if(_0x46d3b4){_0x22b014=path[_0x46bd('0x57')](_0x22b014,_0x46bd('0x5a'));}var _0x3f951a=path[_0x46bd('0x57')](_0x22b014,_0x176d06[_0x46bd('0x52')]);return _0x4d2bcb[_0x46bd('0x54')](_0x3f951a);}})['catch'](handleError(_0x4d2bcb,null));}; \ No newline at end of file +var _0xb0c9=['length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','Attachment','includeAll','include','findAll','rows','catch','show','params','find','clone','createdAt','updatedAt','body','omit','create','file','basename','filename','mimetype','download','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','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','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','then','stack','name','send','render','merge','message','agent','interaction','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes'];(function(_0x33d398,_0xbdbd3c){var _0xa63b07=function(_0x158a0e){while(--_0x158a0e){_0x33d398['push'](_0x33d398['shift']());}};_0xa63b07(++_0xbdbd3c);}(_0xb0c9,0x13b));var _0x9b0c=function(_0x572068,_0x588353){_0x572068=_0x572068-0x0;var _0x4f3fed=_0xb0c9[_0x572068];return _0x4f3fed;};'use strict';var emlformat=require(_0x9b0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b0c('0x1'));var jsonpatch=require(_0x9b0c('0x2'));var rp=require(_0x9b0c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9b0c('0x4'));var util=require(_0x9b0c('0x5'));var path=require(_0x9b0c('0x6'));var sox=require(_0x9b0c('0x7'));var csv=require('to-csv');var ejs=require(_0x9b0c('0x8'));var fs=require('fs');var fs_extra=require(_0x9b0c('0x9'));var _=require(_0x9b0c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9b0c('0xb'));var toCsv=require(_0x9b0c('0xc'));var querystring=require(_0x9b0c('0xd'));var Papa=require(_0x9b0c('0xe'));var Redis=require(_0x9b0c('0xf'));var authService=require(_0x9b0c('0x10'));var qs=require(_0x9b0c('0x11'));var as=require(_0x9b0c('0x12'));var hardwareService=require(_0x9b0c('0x13'));var logger=require(_0x9b0c('0x14'))(_0x9b0c('0x15'));var utils=require(_0x9b0c('0x16'));var config=require(_0x9b0c('0x17'));var licenseUtil=require(_0x9b0c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x293486,_0x9580d0){_0x9580d0=_0x9580d0||0xcc;return function(_0x9a115a){if(_0x9a115a){return _0x293486['sendStatus'](_0x9580d0);}return _0x293486['status'](_0x9580d0)[_0x9b0c('0x19')]();};}function respondWithResult(_0xdd533c,_0x2a55c9){_0x2a55c9=_0x2a55c9||0xc8;return function(_0x2a6091){if(_0x2a6091){return _0xdd533c[_0x9b0c('0x1a')](_0x2a55c9)[_0x9b0c('0x1b')](_0x2a6091);}};}function respondWithFilteredResult(_0x268bf5,_0x22a31d){return function(_0x548f0){if(_0x548f0){var _0x19ea36=typeof _0x22a31d[_0x9b0c('0x1c')]===_0x9b0c('0x1d')&&typeof _0x22a31d['limit']==='undefined';var _0x14ebac=_0x548f0[_0x9b0c('0x1e')];var _0xababa=_0x19ea36?0x0:_0x22a31d['offset'];var _0x4f366f=_0x19ea36?_0x548f0['count']:_0x22a31d[_0x9b0c('0x1c')]+_0x22a31d[_0x9b0c('0x1f')];var _0x3b9c89;if(_0x4f366f>=_0x14ebac){_0x4f366f=_0x14ebac;_0x3b9c89=0xc8;}else{_0x3b9c89=0xce;}_0x268bf5[_0x9b0c('0x1a')](_0x3b9c89);return _0x268bf5[_0x9b0c('0x20')](_0x9b0c('0x21'),_0xababa+'-'+_0x4f366f+'/'+_0x14ebac)[_0x9b0c('0x1b')](_0x548f0);}return null;};}function patchUpdates(_0x362acf){return function(_0xc5f214){try{jsonpatch['apply'](_0xc5f214,_0x362acf,!![]);}catch(_0x4e51ce){return BPromise['reject'](_0x4e51ce);}return _0xc5f214[_0x9b0c('0x22')]();};}function saveUpdates(_0x87363e,_0x57e1d0){return function(_0x42a10f){if(_0x42a10f){return _0x42a10f[_0x9b0c('0x23')](_0x87363e)['then'](function(_0x17efdf){return _0x17efdf;});}return null;};}function removeEntity(_0x151523,_0x1e02fe){return function(_0x575613){if(_0x575613){return _0x575613[_0x9b0c('0x24')]()[_0x9b0c('0x25')](function(){_0x151523[_0x9b0c('0x1a')](0xcc)[_0x9b0c('0x19')]();});}};}function handleEntityNotFound(_0x431ec9,_0x592a79){return function(_0x23661f){if(!_0x23661f){_0x431ec9['sendStatus'](0x194);}return _0x23661f;};}function handleError(_0x59f03c,_0x4b0f0a){_0x4b0f0a=_0x4b0f0a||0x1f4;return function(_0x22e467){logger['error'](_0x22e467[_0x9b0c('0x26')]);if(_0x22e467[_0x9b0c('0x27')]){delete _0x22e467['name'];}_0x59f03c[_0x9b0c('0x1a')](_0x4b0f0a)[_0x9b0c('0x28')](_0x22e467);};}function getMustacheRender(_0x2a410e,_0x4cdae2){return Mustache[_0x9b0c('0x29')](_0x2a410e,_[_0x9b0c('0x2a')](_0x4cdae2['body'],{'contact':_0x4cdae2['contact'],'message':_0x4cdae2[_0x9b0c('0x2b')],'agent':_0x4cdae2[_0x9b0c('0x2c')],'interaction':_0x4cdae2[_0x9b0c('0x2d')],'account':_0x4cdae2['account']}))||'';}exports[_0x9b0c('0x2e')]=function(_0x5523e9,_0x17944c){var _0xe0f264={},_0xf04053={},_0x57fa98={'count':0x0,'rows':[]};var _0x35cf68=_[_0x9b0c('0x2f')](db['Attachment'][_0x9b0c('0x30')],function(_0x622e0b){return{'name':_0x622e0b[_0x9b0c('0x31')],'type':_0x622e0b['type'][_0x9b0c('0x32')]};});_0xf04053['model']=_[_0x9b0c('0x2f')](_0x35cf68,_0x9b0c('0x27'));_0xf04053[_0x9b0c('0x33')]=_[_0x9b0c('0x34')](_0x5523e9[_0x9b0c('0x33')]);_0xf04053['filters']=_[_0x9b0c('0x35')](_0xf04053[_0x9b0c('0x36')],_0xf04053[_0x9b0c('0x33')]);_0xe0f264['attributes']=_[_0x9b0c('0x35')](_0xf04053['model'],qs[_0x9b0c('0x37')](_0x5523e9[_0x9b0c('0x33')][_0x9b0c('0x37')]));_0xe0f264[_0x9b0c('0x38')]=_0xe0f264[_0x9b0c('0x38')][_0x9b0c('0x39')]?_0xe0f264[_0x9b0c('0x38')]:_0xf04053[_0x9b0c('0x36')];if(!_0x5523e9['query'][_0x9b0c('0x3a')](_0x9b0c('0x3b'))){_0xe0f264['limit']=qs[_0x9b0c('0x1f')](_0x5523e9[_0x9b0c('0x33')][_0x9b0c('0x1f')]);_0xe0f264[_0x9b0c('0x1c')]=qs[_0x9b0c('0x1c')](_0x5523e9[_0x9b0c('0x33')][_0x9b0c('0x1c')]);}_0xe0f264[_0x9b0c('0x3c')]=qs[_0x9b0c('0x3d')](_0x5523e9[_0x9b0c('0x33')][_0x9b0c('0x3d')]);_0xe0f264[_0x9b0c('0x3e')]=qs[_0x9b0c('0x3f')](_[_0x9b0c('0x40')](_0x5523e9[_0x9b0c('0x33')],_0xf04053[_0x9b0c('0x3f')]),_0x35cf68);if(_0x5523e9['query'][_0x9b0c('0x41')]){_0xe0f264[_0x9b0c('0x3e')]=_[_0x9b0c('0x2a')](_0xe0f264[_0x9b0c('0x3e')],{'$or':_[_0x9b0c('0x2f')](_0x35cf68,function(_0x1106c7){if(_0x1106c7[_0x9b0c('0x42')]!==_0x9b0c('0x43')){var _0x4d3fa8={};_0x4d3fa8[_0x1106c7['name']]={'$like':'%'+_0x5523e9['query'][_0x9b0c('0x41')]+'%'};return _0x4d3fa8;}})});}_0xe0f264=_[_0x9b0c('0x2a')]({},_0xe0f264,_0x5523e9[_0x9b0c('0x44')]);var _0x1f34fc={'where':_0xe0f264[_0x9b0c('0x3e')]};return db[_0x9b0c('0x45')][_0x9b0c('0x1e')](_0x1f34fc)[_0x9b0c('0x25')](function(_0x2ce5b4){_0x57fa98[_0x9b0c('0x1e')]=_0x2ce5b4;if(_0x5523e9[_0x9b0c('0x33')][_0x9b0c('0x46')]){_0xe0f264[_0x9b0c('0x47')]=[{'all':!![]}];}return db[_0x9b0c('0x45')][_0x9b0c('0x48')](_0xe0f264);})[_0x9b0c('0x25')](function(_0x7200d1){_0x57fa98[_0x9b0c('0x49')]=_0x7200d1;return _0x57fa98;})['then'](respondWithFilteredResult(_0x17944c,_0xe0f264))[_0x9b0c('0x4a')](handleError(_0x17944c,null));};exports[_0x9b0c('0x4b')]=function(_0x4e875d,_0x150f76){var _0x22bafd={'raw':!![],'where':{'id':_0x4e875d[_0x9b0c('0x4c')]['id']}},_0x58aa62={};_0x58aa62['model']=_[_0x9b0c('0x34')](db[_0x9b0c('0x45')][_0x9b0c('0x30')]);_0x58aa62[_0x9b0c('0x33')]=_['keys'](_0x4e875d[_0x9b0c('0x33')]);_0x58aa62[_0x9b0c('0x3f')]=_[_0x9b0c('0x35')](_0x58aa62[_0x9b0c('0x36')],_0x58aa62['query']);_0x22bafd[_0x9b0c('0x38')]=_[_0x9b0c('0x35')](_0x58aa62['model'],qs['fields'](_0x4e875d[_0x9b0c('0x33')][_0x9b0c('0x37')]));_0x22bafd['attributes']=_0x22bafd[_0x9b0c('0x38')]['length']?_0x22bafd['attributes']:_0x58aa62[_0x9b0c('0x36')];if(_0x4e875d['query']['includeAll']){_0x22bafd[_0x9b0c('0x47')]=[{'all':!![]}];}_0x22bafd=_[_0x9b0c('0x2a')]({},_0x22bafd,_0x4e875d[_0x9b0c('0x44')]);return db['Attachment'][_0x9b0c('0x4d')](_0x22bafd)[_0x9b0c('0x25')](handleEntityNotFound(_0x150f76,null))[_0x9b0c('0x25')](respondWithResult(_0x150f76,null))[_0x9b0c('0x4a')](handleError(_0x150f76,null));};exports[_0x9b0c('0x4e')]=function(_0x32f182,_0x943409){var _0x53d8b9={'where':{'id':_0x32f182[_0x9b0c('0x4c')]['id']}},_0x26b3b2={};_0x26b3b2[_0x9b0c('0x36')]=_['keys'](db['Attachment'][_0x9b0c('0x30')]);_0x53d8b9[_0x9b0c('0x38')]=_[_0x9b0c('0x35')](_0x26b3b2[_0x9b0c('0x36')],qs[_0x9b0c('0x37')](_0x32f182[_0x9b0c('0x33')]['fields']));_0x53d8b9['attributes']=_0x53d8b9[_0x9b0c('0x38')][_0x9b0c('0x39')]?_0x53d8b9[_0x9b0c('0x38')]:_0x26b3b2['model'];if(_0x32f182[_0x9b0c('0x33')][_0x9b0c('0x46')]){_0x53d8b9[_0x9b0c('0x47')]=[{'all':!![]}];}_0x53d8b9=_[_0x9b0c('0x2a')]({},_0x53d8b9,_0x32f182['options']);return db[_0x9b0c('0x45')][_0x9b0c('0x4d')](_0x53d8b9)['then'](handleEntityNotFound(_0x943409,null))[_0x9b0c('0x25')](function(_0x3ebfe3){if(_0x3ebfe3){var _0x4f453e=_0x3ebfe3['get']({'plain':!![]});_0x4f453e=qs['omit'](_0x4f453e,['id',_0x9b0c('0x4f'),_0x9b0c('0x50')]);_0x32f182[_0x9b0c('0x51')]=_[_0x9b0c('0x52')](_0x32f182[_0x9b0c('0x51')],['id',_0x9b0c('0x4f'),'updatedAt']);return db[_0x9b0c('0x45')][_0x9b0c('0x53')](_[_0x9b0c('0x2a')](_0x4f453e,_0x32f182[_0x9b0c('0x51')]),{'include':_0x32f182[_0x9b0c('0x33')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x9b0c('0x25')](respondWithResult(_0x943409,0xc9))[_0x9b0c('0x4a')](handleError(_0x943409,null));};exports[_0x9b0c('0x23')]=function(_0x1cdf60,_0x4a2c5b){if(_0x1cdf60['body']['id']){delete _0x1cdf60[_0x9b0c('0x51')]['id'];}return db[_0x9b0c('0x45')]['find']({'where':{'id':_0x1cdf60[_0x9b0c('0x4c')]['id']}})[_0x9b0c('0x25')](handleEntityNotFound(_0x4a2c5b,null))[_0x9b0c('0x25')](saveUpdates(_0x1cdf60['body'],null))['then'](respondWithResult(_0x4a2c5b,null))[_0x9b0c('0x4a')](handleError(_0x4a2c5b,null));};exports['destroy']=function(_0x2f1222,_0x2e431b){return db[_0x9b0c('0x45')][_0x9b0c('0x4d')]({'where':{'id':_0x2f1222[_0x9b0c('0x4c')]['id']}})[_0x9b0c('0x25')](handleEntityNotFound(_0x2e431b,null))[_0x9b0c('0x25')](removeEntity(_0x2e431b,null))['catch'](handleError(_0x2e431b,null));};exports['create']=function(_0x2a4572,_0x15304f,_0x4ed4c6){_0x2a4572['body'][_0x9b0c('0x27')]=_0x2a4572[_0x9b0c('0x54')]['originalname'];_0x2a4572[_0x9b0c('0x51')][_0x9b0c('0x55')]=_0x2a4572[_0x9b0c('0x54')][_0x9b0c('0x56')];_0x2a4572[_0x9b0c('0x51')][_0x9b0c('0x42')]=_0x2a4572[_0x9b0c('0x54')][_0x9b0c('0x57')];return db[_0x9b0c('0x45')][_0x9b0c('0x53')](_0x2a4572[_0x9b0c('0x51')])[_0x9b0c('0x25')](respondWithResult(_0x15304f,0xc9))['catch'](handleError(_0x15304f,null));};exports[_0x9b0c('0x58')]=function(_0x43ab96,_0x154995,_0x557060){return db[_0x9b0c('0x45')]['findOne']({'where':{'id':_0x43ab96[_0x9b0c('0x4c')]['id']},'raw':!![]})[_0x9b0c('0x25')](handleEntityNotFound(_0x154995,null))[_0x9b0c('0x25')](function(_0x586b34){if(_0x586b34){var _0xdc05fc=_0x586b34['ChatOfflineMessageId']!==null;var _0x1aa352=path[_0x9b0c('0x59')](config[_0x9b0c('0x5a')],_0x9b0c('0x5b'));if(_0xdc05fc){_0x1aa352=path[_0x9b0c('0x59')](_0x1aa352,_0x9b0c('0x5c'));}var _0x452dfc=path[_0x9b0c('0x59')](_0x1aa352,_0x586b34['basename']);return _0x154995[_0x9b0c('0x58')](_0x452dfc);}})[_0x9b0c('0x4a')](handleError(_0x154995,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 3c7f85b..1c7e3af 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 _0xbb35=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','util'];(function(_0x1677b6,_0x410aa6){var _0x1ff2ce=function(_0xba5d2d){while(--_0xba5d2d){_0x1677b6['push'](_0x1677b6['shift']());}};_0x1ff2ce(++_0x410aa6);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x737577,_0x2fdccf){_0x737577=_0x737577-0x0;var _0xc7b83b=_0xbb35[_0x737577];return _0xc7b83b;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var logger=require(_0x5bb3('0x1'))(_0x5bb3('0x2'));var moment=require(_0x5bb3('0x3'));var BPromise=require(_0x5bb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bb3('0x5'));var rimraf=require(_0x5bb3('0x6'));var config=require(_0x5bb3('0x7'));var attributes=require(_0x5bb3('0x8'));module[_0x5bb3('0x9')]=function(_0x321535,_0x46ef03){return _0x321535[_0x5bb3('0xa')](_0x5bb3('0xb'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefda=['../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','api','moment','request-promise','path','rimraf'];(function(_0x1f5837,_0xf8895f){var _0x1c2a7c=function(_0x18dc6a){while(--_0x18dc6a){_0x1f5837['push'](_0x1f5837['shift']());}};_0x1c2a7c(++_0xf8895f);}(_0xefda,0x96));var _0xaefd=function(_0x5242fa,_0x3efff5){_0x5242fa=_0x5242fa-0x0;var _0x1a1376=_0xefda[_0x5242fa];return _0x1a1376;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'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 5e56877..7efc319 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 _0xb75b=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment','Attachment','body','options','raw','util','moment','randomstring','ioredis'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb75b,0x191));var _0xbb75=function(_0x3edf31,_0x5abfc0){_0x3edf31=_0x3edf31-0x0;var _0x37d919=_0xb75b[_0x3edf31];return _0x37d919;};'use strict';var _=require('lodash');var util=require(_0xbb75('0x0'));var moment=require(_0xbb75('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb75('0x2'));var fs=require('fs');var Redis=require(_0xbb75('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb75('0x4'));var logger=require(_0xbb75('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbb75('0x6'));var client=jayson[_0xbb75('0x7')][_0xbb75('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x255829,_0x43f6fa,_0x49a757){return new BPromise(function(_0xd6d99e,_0x94734c){return client[_0xbb75('0x9')](_0x255829,_0x49a757)[_0xbb75('0xa')](function(_0x578005){logger[_0xbb75('0xb')](_0xbb75('0xc'),_0x43f6fa,'request\x20sent');logger[_0xbb75('0xd')](_0xbb75('0xe'),_0x43f6fa,_0xbb75('0xf'),JSON[_0xbb75('0x10')](_0x578005));if(_0x578005[_0xbb75('0x11')]){if(_0x578005[_0xbb75('0x11')][_0xbb75('0x12')]===0x1f4){logger[_0xbb75('0x11')]('Attachment,\x20%s,\x20%s',_0x43f6fa,_0x578005[_0xbb75('0x11')]['message']);return _0x94734c(_0x578005['error'][_0xbb75('0x13')]);}logger[_0xbb75('0x11')](_0xbb75('0xc'),_0x43f6fa,_0x578005[_0xbb75('0x11')]['message']);return _0xd6d99e(_0x578005[_0xbb75('0x11')]['message']);}else{logger[_0xbb75('0xb')]('Attachment,\x20%s,\x20%s',_0x43f6fa,'request\x20sent');_0xd6d99e(_0x578005[_0xbb75('0x14')][_0xbb75('0x13')]);}})[_0xbb75('0x15')](function(_0x4b3399){logger[_0xbb75('0x11')](_0xbb75('0xc'),_0x43f6fa,_0x4b3399);_0x94734c(_0x4b3399);});});}exports[_0xbb75('0x16')]=function(_0x1cb01b){var _0x4ecd83=this;return new Promise(function(_0x39de03,_0x306ca9){return db[_0xbb75('0x17')]['create'](_0x1cb01b[_0xbb75('0x18')],{'raw':_0x1cb01b[_0xbb75('0x19')]?_0x1cb01b[_0xbb75('0x19')][_0xbb75('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2f588e){logger['info'](_0xbb75('0x16'),_0x1cb01b);logger[_0xbb75('0xd')](_0xbb75('0x16'),_0x1cb01b,JSON[_0xbb75('0x10')](_0x2f588e));_0x39de03(_0x2f588e);})[_0xbb75('0x15')](function(_0x976cad){logger[_0xbb75('0x11')](_0xbb75('0x16'),_0x976cad[_0xbb75('0x13')],_0x1cb01b);_0x306ca9(_0x4ecd83[_0xbb75('0x11')](0x1f4,_0x976cad[_0xbb75('0x13')]));});});}; \ No newline at end of file +var _0x358e=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','Attachment','options','raw','CreateAttachment','stringify','lodash','moment','bluebird'];(function(_0x35ec0e,_0x29f53f){var _0x157ae4=function(_0x203bee){while(--_0x203bee){_0x35ec0e['push'](_0x35ec0e['shift']());}};_0x157ae4(++_0x29f53f);}(_0x358e,0xa5));var _0xe358=function(_0x2f23c6,_0x8eacbc){_0x2f23c6=_0x2f23c6-0x0;var _0x12e26a=_0x358e[_0x2f23c6];return _0x12e26a;};'use strict';var _=require(_0xe358('0x0'));var util=require('util');var moment=require(_0xe358('0x1'));var BPromise=require(_0xe358('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe358('0x3'));var db=require(_0xe358('0x4'))['db'];var utils=require(_0xe358('0x5'));var logger=require('../../config/logger')(_0xe358('0x6'));var config=require(_0xe358('0x7'));var jayson=require(_0xe358('0x8'));var client=jayson[_0xe358('0x9')][_0xe358('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a4c47,_0x3fb916,_0x48d8b8){return new BPromise(function(_0x59f89f,_0x7291b2){return client[_0xe358('0xb')](_0x5a4c47,_0x48d8b8)[_0xe358('0xc')](function(_0x1b1147){logger['info'](_0xe358('0xd'),_0x3fb916,_0xe358('0xe'));logger[_0xe358('0xf')](_0xe358('0x10'),_0x3fb916,_0xe358('0xe'),JSON['stringify'](_0x1b1147));if(_0x1b1147[_0xe358('0x11')]){if(_0x1b1147[_0xe358('0x11')][_0xe358('0x12')]===0x1f4){logger[_0xe358('0x11')](_0xe358('0xd'),_0x3fb916,_0x1b1147[_0xe358('0x11')][_0xe358('0x13')]);return _0x7291b2(_0x1b1147[_0xe358('0x11')][_0xe358('0x13')]);}logger[_0xe358('0x11')](_0xe358('0xd'),_0x3fb916,_0x1b1147[_0xe358('0x11')][_0xe358('0x13')]);return _0x59f89f(_0x1b1147[_0xe358('0x11')][_0xe358('0x13')]);}else{logger[_0xe358('0x14')]('Attachment,\x20%s,\x20%s',_0x3fb916,'request\x20sent');_0x59f89f(_0x1b1147[_0xe358('0x15')][_0xe358('0x13')]);}})[_0xe358('0x16')](function(_0x8bee2c){logger[_0xe358('0x11')]('Attachment,\x20%s,\x20%s',_0x3fb916,_0x8bee2c);_0x7291b2(_0x8bee2c);});});}exports['CreateAttachment']=function(_0x181d0b){var _0x27cd85=this;return new Promise(function(_0xb27463,_0x32a2b6){return db[_0xe358('0x17')]['create'](_0x181d0b['body'],{'raw':_0x181d0b[_0xe358('0x18')]?_0x181d0b['options'][_0xe358('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x12f918){logger[_0xe358('0x14')](_0xe358('0x1a'),_0x181d0b);logger[_0xe358('0xf')](_0xe358('0x1a'),_0x181d0b,JSON[_0xe358('0x1b')](_0x12f918));_0xb27463(_0x12f918);})['catch'](function(_0x41ecab){logger['error'](_0xe358('0x1a'),_0x41ecab['message'],_0x181d0b);_0x32a2b6(_0x27cd85[_0xe358('0x11')](0x1f4,_0x41ecab[_0xe358('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 57da883..76836ba 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 _0x536f=['multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./attachment.controller','isAuthenticated','index','get','show','/:id/download','/:id/clone','join','root','format','%s-%s','now','originalname','replace','post','single','file','create','put','/:id','update','destroy','exports'];(function(_0x409675,_0x66199f){var _0x26aab0=function(_0x4247de){while(--_0x4247de){_0x409675['push'](_0x409675['shift']());}};_0x26aab0(++_0x66199f);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf536('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf536('0x1')]();var fs_extra=require(_0xf536('0x2'));var auth=require(_0xf536('0x3'));var interaction=require(_0xf536('0x4'));var config=require('../../config/environment');var controller=require(_0xf536('0x5'));router['get']('/',auth[_0xf536('0x6')](),controller[_0xf536('0x7')]);router[_0xf536('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf536('0x9')]);router[_0xf536('0x8')](_0xf536('0xa'),auth[_0xf536('0x6')](),controller['download']);router['post'](_0xf536('0xb'),auth[_0xf536('0x6')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3c811b,_0x3ac49c,_0x16c1ae){_0x16c1ae(null,path[_0xf536('0xc')](config[_0xf536('0xd')],'server/files/attachments/'));},'filename':function(_0x398700,_0x539d44,_0x146970){_0x146970(null,util[_0xf536('0xe')](_0xf536('0xf'),Date[_0xf536('0x10')](),_0x539d44[_0xf536('0x11')][_0xf536('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf536('0x13')]('/',upload[_0xf536('0x14')](_0xf536('0x15')),controller[_0xf536('0x16')]);router[_0xf536('0x17')](_0xf536('0x18'),auth['isAuthenticated'](),controller[_0xf536('0x19')]);router['delete'](_0xf536('0x18'),auth['isAuthenticated'](),controller[_0xf536('0x1a')]);module[_0xf536('0x1b')]=router; \ No newline at end of file +var _0xaa5e=['get','isAuthenticated','/:id','/:id/download','download','/:id/clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./attachment.controller'];(function(_0x57a145,_0x5e58a9){var _0x2305de=function(_0x348b4f){while(--_0x348b4f){_0x57a145['push'](_0x57a145['shift']());}};_0x2305de(++_0x5e58a9);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x37894d,_0x33c763){_0x37894d=_0x37894d-0x0;var _0x44d09e=_0xaa5e[_0x37894d];return _0x44d09e;};'use strict';var multer=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var path=require('path');var timeout=require(_0xeaa5('0x2'));var express=require(_0xeaa5('0x3'));var router=express[_0xeaa5('0x4')]();var fs_extra=require(_0xeaa5('0x5'));var auth=require(_0xeaa5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeaa5('0x7'));var controller=require(_0xeaa5('0x8'));router[_0xeaa5('0x9')]('/',auth[_0xeaa5('0xa')](),controller['index']);router['get'](_0xeaa5('0xb'),auth[_0xeaa5('0xa')](),controller['show']);router[_0xeaa5('0x9')](_0xeaa5('0xc'),auth['isAuthenticated'](),controller[_0xeaa5('0xd')]);router['post'](_0xeaa5('0xe'),auth[_0xeaa5('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0xeaa5('0xf')]({'destination':function(_0x299f44,_0x140a6a,_0x46806d){_0x46806d(null,path[_0xeaa5('0x10')](config[_0xeaa5('0x11')],_0xeaa5('0x12')));},'filename':function(_0x2c3561,_0x123d6e,_0x47a779){_0x47a779(null,util[_0xeaa5('0x13')](_0xeaa5('0x14'),Date[_0xeaa5('0x15')](),_0x123d6e[_0xeaa5('0x16')][_0xeaa5('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0xeaa5('0x18')]('file'),controller[_0xeaa5('0x19')]);router[_0xeaa5('0x1a')](_0xeaa5('0xb'),auth['isAuthenticated'](),controller[_0xeaa5('0x1b')]);router['delete'](_0xeaa5('0xb'),auth[_0xeaa5('0xa')](),controller[_0xeaa5('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5b37cfe..5f4f9d6 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 _0x6f8b=['getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','/login','email','callback','authenticate','use','clientSecret','secret','Setting','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes'];(function(_0x1eb6cc,_0x165c4f){var _0xbeacea=function(_0x104568){while(--_0x104568){_0x1eb6cc['push'](_0x1eb6cc['shift']());}};_0xbeacea(++_0x165c4f);}(_0x6f8b,0x1be));var _0xb6f8=function(_0x39f42a,_0x3c68dc){_0x39f42a=_0x39f42a-0x0;var _0x44a41d=_0x6f8b[_0x39f42a];return _0x44a41d;};'use strict';var _=require('lodash');var passport=require(_0xb6f8('0x0'));var GoogleStrategy=require(_0xb6f8('0x1'))[_0xb6f8('0x2')];var moment=require(_0xb6f8('0x3'));var db=require(_0xb6f8('0x4'))['db'];var config=require(_0xb6f8('0x5'));var signToken=require(_0xb6f8('0x6'))[_0xb6f8('0x7')];var utils=require(_0xb6f8('0x8'));exports[_0xb6f8('0x9')]=passport['authenticate'](_0xb6f8('0xa'),{'failureRedirect':_0xb6f8('0xb'),'scope':['profile',_0xb6f8('0xc')],'session':![]});exports[_0xb6f8('0xd')]=passport[_0xb6f8('0xe')]('google',{'failureRedirect':'/login','session':![]});passport[_0xb6f8('0xf')](new GoogleStrategy({'clientID':config[_0xb6f8('0xa')]?config[_0xb6f8('0xa')]['clientID']:'id','clientSecret':config[_0xb6f8('0xa')]?config[_0xb6f8('0xa')][_0xb6f8('0x10')]:_0xb6f8('0x11'),'callbackURL':config[_0xb6f8('0xa')]?config[_0xb6f8('0xa')]['callbackURL']:''},function(_0x10ed95,_0xedbb6f,_0x1a109f,_0x69329e){var _0x7133e2,_0x17f09b;return db[_0xb6f8('0x12')]['findOne']({'where':{'id':0x1},'attributes':[_0xb6f8('0x13'),_0xb6f8('0x14')],'raw':!![]})[_0xb6f8('0x15')](function(_0x1c67e4){_0x7133e2=_0x1c67e4;return db[_0xb6f8('0x16')][_0xb6f8('0x17')]({'where':{'email':_[_0xb6f8('0x18')](_0x1a109f[_0xb6f8('0x19')],_0xb6f8('0x1a')),'role':{'$or':[_0xb6f8('0x1b'),_0xb6f8('0x1c'),_0xb6f8('0x1d')]}}});})[_0xb6f8('0x15')](function(_0x5ce62f){_0x17f09b=_0x5ce62f;if(_0x17f09b){if(_0x17f09b['disabled']){return _0x69329e(_0xb6f8('0x1e'));}else if(_0x7133e2[_0xb6f8('0x14')]>0x0){if(_0x17f09b[_0xb6f8('0x1f')]){if(moment(_0x17f09b[_0xb6f8('0x20')])[_0xb6f8('0x21')](_0x7133e2[_0xb6f8('0x14')],_0xb6f8('0x22'))>moment()){return _0x69329e(_0xb6f8('0x1e'));}else{return utils['clearBlockUser'](_0x17f09b,0x0,![],null)[_0xb6f8('0x15')](function(){return utils[_0xb6f8('0x23')](_0x17f09b);})['then'](function(){return _0x69329e(null,_0x17f09b);});}}else{return utils[_0xb6f8('0x23')](_0x17f09b)['then'](function(){return _0x69329e(null,_0x17f09b);});}}else{return utils[_0xb6f8('0x23')](_0x17f09b)[_0xb6f8('0x15')](function(){return _0x69329e(null,_0x17f09b);});}}return _0x69329e(_0xb6f8('0x1e'));})[_0xb6f8('0x24')](function(_0xdeece1){_0x69329e(_0xdeece1);});})); \ No newline at end of file +var _0x1af6=['value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','clearBlockUser','getLicense','catch','lodash','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','authenticate','google','/login','profile','email','clientID','clientSecret','secret','callbackURL','Setting','allowedLoginAttempts','blockDuration','then','User','find','map'];(function(_0x3ec0e8,_0x485a9d){var _0x26fd54=function(_0x4df6a5){while(--_0x4df6a5){_0x3ec0e8['push'](_0x3ec0e8['shift']());}};_0x26fd54(++_0x485a9d);}(_0x1af6,0xd8));var _0x61af=function(_0x55b986,_0x24d086){_0x55b986=_0x55b986-0x0;var _0x1722af=_0x1af6[_0x55b986];return _0x1722af;};'use strict';var _=require(_0x61af('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0x61af('0x1')];var moment=require('moment');var db=require(_0x61af('0x2'))['db'];var config=require(_0x61af('0x3'));var signToken=require(_0x61af('0x4'))['signToken'];var utils=require(_0x61af('0x5'));exports['login']=passport[_0x61af('0x6')](_0x61af('0x7'),{'failureRedirect':_0x61af('0x8'),'scope':[_0x61af('0x9'),_0x61af('0xa')],'session':![]});exports['callback']=passport[_0x61af('0x6')](_0x61af('0x7'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x61af('0x7')]?config[_0x61af('0x7')][_0x61af('0xb')]:'id','clientSecret':config['google']?config[_0x61af('0x7')][_0x61af('0xc')]:_0x61af('0xd'),'callbackURL':config[_0x61af('0x7')]?config[_0x61af('0x7')][_0x61af('0xe')]:''},function(_0x542e8f,_0x103573,_0x4c0882,_0x5e9fcc){var _0x2f6b56,_0x48ccfb;return db[_0x61af('0xf')]['findOne']({'where':{'id':0x1},'attributes':[_0x61af('0x10'),_0x61af('0x11')],'raw':!![]})[_0x61af('0x12')](function(_0x450239){_0x2f6b56=_0x450239;return db[_0x61af('0x13')][_0x61af('0x14')]({'where':{'email':_[_0x61af('0x15')](_0x4c0882['emails'],_0x61af('0x16')),'role':{'$or':[_0x61af('0x17'),_0x61af('0x18'),_0x61af('0x19')]}}});})[_0x61af('0x12')](function(_0x36562c){_0x48ccfb=_0x36562c;if(_0x48ccfb){if(_0x48ccfb[_0x61af('0x1a')]){return _0x5e9fcc(_0x61af('0x1b'));}else if(_0x2f6b56[_0x61af('0x11')]>0x0){if(_0x48ccfb[_0x61af('0x1c')]){if(moment(_0x48ccfb[_0x61af('0x1d')])['add'](_0x2f6b56[_0x61af('0x11')],_0x61af('0x1e'))>moment()){return _0x5e9fcc(_0x61af('0x1b'));}else{return utils[_0x61af('0x1f')](_0x48ccfb,0x0,![],null)[_0x61af('0x12')](function(){return utils[_0x61af('0x20')](_0x48ccfb);})[_0x61af('0x12')](function(){return _0x5e9fcc(null,_0x48ccfb);});}}else{return utils[_0x61af('0x20')](_0x48ccfb)['then'](function(){return _0x5e9fcc(null,_0x48ccfb);});}}else{return utils['getLicense'](_0x48ccfb)[_0x61af('0x12')](function(){return _0x5e9fcc(null,_0x48ccfb);});}}return _0x5e9fcc(_0x61af('0x1b'));})[_0x61af('0x21')](function(_0x28e1ab){_0x5e9fcc(_0x28e1ab);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 57aa3d9..545ceba 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 _0x3ae9=['isMiddleware','setTokenCookie','exports','Router','./authGoogle.controller','../user/user.controller.js','get','login','/callback'];(function(_0x20aad0,_0x41a776){var _0x2a21ad=function(_0x4b7236){while(--_0x4b7236){_0x20aad0['push'](_0x20aad0['shift']());}};_0x2a21ad(++_0x41a776);}(_0x3ae9,0xdb));var _0x93ae=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x3ae9[_0x580576];return _0x3f55a0;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x93ae('0x0')]();var controller=require(_0x93ae('0x1'));var userController=require(_0x93ae('0x2'));var authService=require('../../components/auth/service');router[_0x93ae('0x3')]('/',controller[_0x93ae('0x4')]);router[_0x93ae('0x3')](_0x93ae('0x5'),controller['callback'],authService[_0x93ae('0x6')],userController['login'],authService[_0x93ae('0x7')]);module[_0x93ae('0x8')]=router; \ No newline at end of file +var _0xde56=['express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports'];(function(_0x2da363,_0x4758c8){var _0x18c022=function(_0x3755e2){while(--_0x3755e2){_0x2da363['push'](_0x2da363['shift']());}};_0x18c022(++_0x4758c8);}(_0xde56,0x144));var _0x6de5=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xde56[_0x500419];return _0x241c1a;};'use strict';var express=require(_0x6de5('0x0'));var passport=require('passport');var router=express[_0x6de5('0x1')]();var controller=require(_0x6de5('0x2'));var userController=require(_0x6de5('0x3'));var authService=require(_0x6de5('0x4'));router[_0x6de5('0x5')]('/',controller[_0x6de5('0x6')]);router[_0x6de5('0x5')](_0x6de5('0x7'),controller[_0x6de5('0x8')],authService[_0x6de5('0x9')],userController['login'],authService[_0x6de5('0xa')]);module[_0x6de5('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 45e4b0c..56e9577 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 _0x33af=['allowedLoginAttempts','blockDuration','then','salt','role','disabled','blocked','blockedAt','admin','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','\x22%s\x22\x20<%s>','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','validatePasswordHistory','Password\x20reset!','use','passport','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33af,0xec));var _0xf33a=function(_0x2d2153,_0x4509d6){_0x2d2153=_0x2d2153-0x0;var _0x20299e=_0x33af[_0x2d2153];return _0x20299e;};'use strict';var util=require('util');var passport=require(_0xf33a('0x0'));var LocalStrategy=require('passport-local')[_0xf33a('0x1')];var jayson=require(_0xf33a('0x2'));var _=require(_0xf33a('0x3'));var rs=require(_0xf33a('0x4'));var moment=require(_0xf33a('0x5'));var db=require(_0xf33a('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xf33a('0x7'));var client=jayson[_0xf33a('0x8')]['http']({'port':0x232b});function localAuthenticate(_0xc0dd13,_0x384b14,_0x1b2b01,_0x2f3730){var _0x2baabb,_0x2cb169;return db['Setting'][_0xf33a('0x9')]({'where':{'id':0x1},'attributes':[_0xf33a('0xa'),_0xf33a('0xb')],'raw':!![]})[_0xf33a('0xc')](function(_0x44ee7f){_0x2baabb=_0x44ee7f;return _0xc0dd13[_0xf33a('0x9')]({'attributes':['id','name','password',_0xf33a('0xd'),_0xf33a('0xe'),_0xf33a('0xf'),_0xf33a('0x10'),_0xf33a('0x11'),'loginAttempts'],'where':{'name':_0x384b14,'role':{'$or':[_0xf33a('0x12'),_0xf33a('0x13'),'agent']}}});})['then'](function(_0x374b01){if(!_0x374b01||_0x374b01&&_0x374b01[_0xf33a('0x14')]!==_0x384b14){throw new Error(_0xf33a('0x15'));}else{_0x2cb169=_0x374b01;return _0x2cb169;}})[_0xf33a('0xc')](function(){_0x2cb169[_0xf33a('0x16')](_0x1b2b01,function(_0xc01217,_0x45e311){var _0x1f2b1b=_0x2cb169['loginAttempts']+0x1;if(_0xc01217){return _0x2f3730(_0xc01217);}else if(!_0x45e311){if(_0x2cb169[_0xf33a('0xf')]){return _0x2f3730(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2baabb[_0xf33a('0xa')]>0x0){if(_0x2cb169[_0xf33a('0x10')]){if(_0x2baabb['blockDuration']>0x0){if(moment(_0x2cb169[_0xf33a('0x11')])[_0xf33a('0x17')](_0x2baabb['blockDuration'],_0xf33a('0x18'))>moment()){return _0x2f3730(null,![],{'message':_0xf33a('0x15')});}else{return utils[_0xf33a('0x19')](_0x2cb169,_0x1f2b1b,![],null)[_0xf33a('0xc')](function(){return _0x2f3730(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x2f3730(null,![],{'message':_0xf33a('0x15')});}}else{if(_0x1f2b1b>=_0x2baabb[_0xf33a('0xa')]){return utils[_0xf33a('0x19')](_0x2cb169,0x0,!![],moment())[_0xf33a('0xc')](function(){return _0x2f3730(null,![],{'message':_0xf33a('0x15')});});}else{return utils[_0xf33a('0x19')](_0x2cb169,_0x1f2b1b,![],null)[_0xf33a('0xc')](function(){return _0x2f3730(null,![],{'message':_0xf33a('0x15')});});}}}else{return _0x2f3730(null,![],{'message':_0xf33a('0x15')});}}else{if(_0x2cb169[_0xf33a('0xf')]){return _0x2f3730(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2baabb[_0xf33a('0xa')]>0x0){if(_0x2cb169[_0xf33a('0x10')]){if(_0x2baabb[_0xf33a('0xb')]>0x0){if(moment(_0x2cb169[_0xf33a('0x11')])[_0xf33a('0x17')](_0x2baabb['blockDuration'],_0xf33a('0x18'))>moment()){return _0x2f3730(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf33a('0x19')](_0x2cb169,0x0,![],null)[_0xf33a('0xc')](function(){return utils[_0xf33a('0x1a')](_0x2cb169);})[_0xf33a('0xc')](function(){return _0x2f3730(null,_0x2cb169);});}}else{return _0x2f3730(null,![],{'message':_0xf33a('0x15')});}}else{return utils['clearBlockUser'](_0x2cb169,0x0,![],null)[_0xf33a('0xc')](function(){return utils[_0xf33a('0x1a')](_0x2cb169);})['then'](function(){return _0x2f3730(null,_0x2cb169);})['catch'](function(_0x16ef31){return _0x2f3730(null,![],_0x16ef31);});}}else{if(_0x2cb169['blocked']){return _0x2f3730(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf33a('0x1a')](_0x2cb169)['then'](function(){return _0x2f3730(null,_0x2cb169);});}}}});})[_0xf33a('0x1b')](function(_0x553480){return _0x2f3730(null,![],_0x553480);});}function sendServiceMail(_0x331115){return db[_0xf33a('0x1c')][_0xf33a('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xf33a('0x14'),_0xf33a('0x1e')],'include':[{'model':db[_0xf33a('0x1f')],'as':_0xf33a('0x20')}]})[_0xf33a('0xc')](function(_0x26e81){if(!_0x26e81){throw new Error(_0xf33a('0x21'));}var _0x77b7c1={'tls':{'rejectUnauthorized':![]}};if(_0x26e81[_0xf33a('0x20')][_0xf33a('0x22')]){_0x77b7c1[_0xf33a('0x22')]=_0x26e81[_0xf33a('0x20')]['service'];}else{_0x77b7c1[_0xf33a('0x23')]=_0x26e81[_0xf33a('0x20')][_0xf33a('0x23')];_0x77b7c1[_0xf33a('0x24')]=_0x26e81['Smtp'][_0xf33a('0x24')];_0x77b7c1[_0xf33a('0x25')]=_0x26e81[_0xf33a('0x20')][_0xf33a('0x25')];}if(_0x26e81[_0xf33a('0x20')][_0xf33a('0x26')]){_0x77b7c1['auth']={'user':_0x26e81[_0xf33a('0x20')][_0xf33a('0x13')],'pass':_0x26e81[_0xf33a('0x20')][_0xf33a('0x27')]};}var _0x2036f2={'account':_0x77b7c1,'message':_['merge']({'from':util['format'](_0xf33a('0x28'),_0x26e81['name'],_0x26e81['email']||_0x26e81['Smtp'][_0xf33a('0x13')])},_0x331115)};return client[_0xf33a('0x29')]('SendMail',_0x2036f2);})[_0xf33a('0xc')](function(_0x55f457){if(_0x55f457[_0xf33a('0x2a')]){throw new Error(util[_0xf33a('0x2b')](_0xf33a('0x2c'),_0x55f457[_0xf33a('0x2a')][_0xf33a('0x2d')]||JSON[_0xf33a('0x2e')](_0x55f457['error'])));}return!![];});}function handleError(_0x16ca8b,_0x29a39f,_0x5b8607){return _0x16ca8b[_0xf33a('0x2f')](_0x29a39f||0x1f4)[_0xf33a('0x30')]({'message':_0x5b8607?_0x5b8607[_0xf33a('0x2d')]||_0x5b8607:''});}exports['login']=function(_0x7a06e1,_0x1650c,_0x334bc4){passport[_0xf33a('0x16')](_0xf33a('0x31'),function(_0x7a6aa4,_0x1b4d59,_0x128baf){var _0xd488ef=_0x7a6aa4||_0x128baf;if(_0xd488ef){return handleError(_0x1650c,0x191,_0xd488ef);}if(!_0x1b4d59){return handleError(_0x1650c,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x31028b={'payload':{'id':_0x1b4d59['id'],'role':_0x1b4d59[_0xf33a('0xe')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x31028b)[_0xf33a('0xc')](function(_0x4c6906){_0x1650c['json']({'id':_0x1b4d59['id'],'token':_0x4c6906,'statusCall':'','isAlreadyLogged':_0x1b4d59[_0xf33a('0x32')]});});}})(_0x7a06e1,_0x1650c,_0x334bc4);};exports[_0xf33a('0x33')]=function(_0x4dada1,_0x1db810,_0x1e368f){if(!_0x4dada1[_0xf33a('0x34')]['email']){return handleError(_0x1db810,0x1f4,{'message':_0xf33a('0x35')});}var _0x21b8da=rs['generate']();_0x4dada1[_0xf33a('0x34')][_0xf33a('0x1e')]=_0x4dada1[_0xf33a('0x34')][_0xf33a('0x1e')][_0xf33a('0x36')]()['toLowerCase']();var _0x45ae15;return db[_0xf33a('0x37')][_0xf33a('0x9')]({'where':{'id':0x1},'attributes':[_0xf33a('0xa'),_0xf33a('0xb')],'raw':!![]})['then'](function(_0x175825){_0x45ae15=_0x175825;return db[_0xf33a('0x38')][_0xf33a('0x1d')]({'where':{'email':_0x4dada1['body'][_0xf33a('0x1e')]}});})[_0xf33a('0xc')](function(_0x428d75){if(!_0x428d75){throw new Error(_0xf33a('0x39'));}if(_0x428d75[_0xf33a('0xf')]){throw new Error(_0xf33a('0x3a'));}if(_0x428d75['blocked']){if(moment(_0x428d75[_0xf33a('0x11')])[_0xf33a('0x17')](_0x45ae15[_0xf33a('0xb')],_0xf33a('0x18'))>moment()){throw new Error(_0xf33a('0x3b'));}else{_0x428d75['blocked']=![];_0x428d75[_0xf33a('0x11')]=null;}}_0x428d75[_0xf33a('0x3c')]=_0x21b8da;_0x428d75[_0xf33a('0x3d')]=Date['now']()+0x36ee80;return _0x428d75[_0xf33a('0x3e')]();})[_0xf33a('0xc')](function(){return sendServiceMail({'to':_0x4dada1['body']['email'],'subject':_0xf33a('0x3f'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xf33a('0x40')+_0xf33a('0x41')+_0x4dada1[_0xf33a('0x42')][_0xf33a('0x23')]+_0xf33a('0x43')+_0x21b8da+'\x0a\x0a'+_0xf33a('0x44')});})[_0xf33a('0xc')](function(){_0x1db810[_0xf33a('0x2f')](0xc8)[_0xf33a('0x30')]({'message':_0xf33a('0x45')});})[_0xf33a('0x1b')](function(_0x4107b1){return handleError(_0x1db810,0x1f4,_0x4107b1);});};exports[_0xf33a('0x46')]=function(_0x6b79da,_0xdcb4f8,_0x1a8a4e){return db[_0xf33a('0x38')][_0xf33a('0x1d')]({'where':{'resetPasswordToken':_0x6b79da[_0xf33a('0x47')][_0xf33a('0x48')],'resetPasswordExpires':{'$gt':Date[_0xf33a('0x49')]()}}})[_0xf33a('0xc')](function(_0x3bafbf){if(!_0x3bafbf){throw new Error(_0xf33a('0x4a'));}return db[_0xf33a('0x37')][_0xf33a('0x9')]({'attributes':['id',_0xf33a('0x4b'),_0xf33a('0x4c'),_0xf33a('0x4d')]})['then'](function(_0x349d3f){if(_0x349d3f[_0xf33a('0x4b')])authService['validatePasswordPattern'](_0x6b79da[_0xf33a('0x34')][_0xf33a('0x4e')]);if(!_0x349d3f[_0xf33a('0x4c')]||!_0x3bafbf['previousPasswords'])return _0x3bafbf;authService[_0xf33a('0x4f')](_0x6b79da[_0xf33a('0x34')][_0xf33a('0x4e')],_0x3bafbf['previousPasswords'],_0x349d3f[_0xf33a('0x4d')]);return _0x3bafbf;})['then'](function(){_0x3bafbf[_0xf33a('0x4e')]=_0x6b79da[_0xf33a('0x34')]['password'];_0x3bafbf['resetPasswordToken']=null;_0x3bafbf[_0xf33a('0x3d')]=null;return _0x3bafbf[_0xf33a('0x3e')]();});})[_0xf33a('0xc')](function(){_0xdcb4f8['status'](0xc8)[_0xf33a('0x30')]({'message':_0xf33a('0x50')});})[_0xf33a('0x1b')](function(_0x24f373){return handleError(_0xdcb4f8,0x1f4,_0x24f373);});};passport[_0xf33a('0x51')](new LocalStrategy({'usernameField':_0xf33a('0x14'),'passwordField':_0xf33a('0x4e')},function(_0x5d66a4,_0xa858b4,_0x4fadba){return localAuthenticate(db['User'],_0x5d66a4,_0xa858b4,_0x4fadba);})); \ No newline at end of file +var _0xb091=['SendMail','error','stringify','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','Email\x20parameter\x20is\x20missing','body','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','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','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','password','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','randomstring','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blocked','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','port','secure','authentication','auth','merge','format','request'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xb091,0x16e));var _0x1b09=function(_0x3e743d,_0x1dc23f){_0x3e743d=_0x3e743d-0x0;var _0x242ddd=_0xb091[_0x3e743d];return _0x242ddd;};'use strict';var util=require('util');var passport=require(_0x1b09('0x0'));var LocalStrategy=require(_0x1b09('0x1'))[_0x1b09('0x2')];var jayson=require(_0x1b09('0x3'));var _=require('lodash');var rs=require(_0x1b09('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x1b09('0x5'));var utils=require(_0x1b09('0x6'));var client=jayson['client'][_0x1b09('0x7')]({'port':0x232b});function localAuthenticate(_0x5fa348,_0x2bf4f6,_0x5ce726,_0x142c33){var _0x8c26a5,_0x2f359f;return db[_0x1b09('0x8')][_0x1b09('0x9')]({'where':{'id':0x1},'attributes':[_0x1b09('0xa'),_0x1b09('0xb')],'raw':!![]})[_0x1b09('0xc')](function(_0x3249a1){_0x8c26a5=_0x3249a1;return _0x5fa348[_0x1b09('0x9')]({'attributes':['id',_0x1b09('0xd'),'password',_0x1b09('0xe'),_0x1b09('0xf'),'disabled','blocked',_0x1b09('0x10'),_0x1b09('0x11')],'where':{'name':_0x2bf4f6,'role':{'$or':[_0x1b09('0x12'),_0x1b09('0x13'),_0x1b09('0x14')]}}});})[_0x1b09('0xc')](function(_0x1fd3bc){if(!_0x1fd3bc||_0x1fd3bc&&_0x1fd3bc['name']!==_0x2bf4f6){throw new Error(_0x1b09('0x15'));}else{_0x2f359f=_0x1fd3bc;return _0x2f359f;}})['then'](function(){_0x2f359f[_0x1b09('0x16')](_0x5ce726,function(_0x27a731,_0x11ab46){var _0x37673e=_0x2f359f[_0x1b09('0x11')]+0x1;if(_0x27a731){return _0x142c33(_0x27a731);}else if(!_0x11ab46){if(_0x2f359f[_0x1b09('0x17')]){return _0x142c33(null,![],{'message':_0x1b09('0x15')});}else if(_0x8c26a5[_0x1b09('0xa')]>0x0){if(_0x2f359f[_0x1b09('0x18')]){if(_0x8c26a5[_0x1b09('0xb')]>0x0){if(moment(_0x2f359f[_0x1b09('0x10')])[_0x1b09('0x19')](_0x8c26a5[_0x1b09('0xb')],'minutes')>moment()){return _0x142c33(null,![],{'message':_0x1b09('0x15')});}else{return utils[_0x1b09('0x1a')](_0x2f359f,_0x37673e,![],null)['then'](function(){return _0x142c33(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x142c33(null,![],{'message':_0x1b09('0x15')});}}else{if(_0x37673e>=_0x8c26a5['allowedLoginAttempts']){return utils[_0x1b09('0x1a')](_0x2f359f,0x0,!![],moment())['then'](function(){return _0x142c33(null,![],{'message':_0x1b09('0x15')});});}else{return utils[_0x1b09('0x1a')](_0x2f359f,_0x37673e,![],null)[_0x1b09('0xc')](function(){return _0x142c33(null,![],{'message':_0x1b09('0x15')});});}}}else{return _0x142c33(null,![],{'message':_0x1b09('0x15')});}}else{if(_0x2f359f[_0x1b09('0x17')]){return _0x142c33(null,![],{'message':_0x1b09('0x15')});}else if(_0x8c26a5[_0x1b09('0xa')]>0x0){if(_0x2f359f['blocked']){if(_0x8c26a5['blockDuration']>0x0){if(moment(_0x2f359f[_0x1b09('0x10')])[_0x1b09('0x19')](_0x8c26a5['blockDuration'],_0x1b09('0x1b'))>moment()){return _0x142c33(null,![],{'message':_0x1b09('0x15')});}else{return utils[_0x1b09('0x1a')](_0x2f359f,0x0,![],null)[_0x1b09('0xc')](function(){return utils['getLicense'](_0x2f359f);})[_0x1b09('0xc')](function(){return _0x142c33(null,_0x2f359f);});}}else{return _0x142c33(null,![],{'message':_0x1b09('0x15')});}}else{return utils['clearBlockUser'](_0x2f359f,0x0,![],null)[_0x1b09('0xc')](function(){return utils[_0x1b09('0x1c')](_0x2f359f);})['then'](function(){return _0x142c33(null,_0x2f359f);})[_0x1b09('0x1d')](function(_0x108d80){return _0x142c33(null,![],_0x108d80);});}}else{if(_0x2f359f[_0x1b09('0x18')]){return _0x142c33(null,![],{'message':_0x1b09('0x15')});}else{return utils['getLicense'](_0x2f359f)[_0x1b09('0xc')](function(){return _0x142c33(null,_0x2f359f);});}}}});})[_0x1b09('0x1d')](function(_0x532589){return _0x142c33(null,![],_0x532589);});}function sendServiceMail(_0x2d1ec0){return db[_0x1b09('0x1e')][_0x1b09('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x1b09('0xd'),_0x1b09('0x20')],'include':[{'model':db[_0x1b09('0x21')],'as':_0x1b09('0x22')}]})['then'](function(_0x22e3ee){if(!_0x22e3ee){throw new Error(_0x1b09('0x23'));}var _0x4bf0ad={'tls':{'rejectUnauthorized':![]}};if(_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x24')]){_0x4bf0ad[_0x1b09('0x24')]=_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x24')];}else{_0x4bf0ad['host']=_0x22e3ee[_0x1b09('0x22')]['host'];_0x4bf0ad[_0x1b09('0x25')]=_0x22e3ee['Smtp'][_0x1b09('0x25')];_0x4bf0ad[_0x1b09('0x26')]=_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x26')];}if(_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x27')]){_0x4bf0ad[_0x1b09('0x28')]={'user':_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x13')],'pass':_0x22e3ee[_0x1b09('0x22')]['pass']};}var _0x267b28={'account':_0x4bf0ad,'message':_[_0x1b09('0x29')]({'from':util[_0x1b09('0x2a')]('\x22%s\x22\x20<%s>',_0x22e3ee[_0x1b09('0xd')],_0x22e3ee[_0x1b09('0x20')]||_0x22e3ee[_0x1b09('0x22')][_0x1b09('0x13')])},_0x2d1ec0)};return client[_0x1b09('0x2b')](_0x1b09('0x2c'),_0x267b28);})[_0x1b09('0xc')](function(_0x1fff0b){if(_0x1fff0b['error']){throw new Error(util[_0x1b09('0x2a')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1fff0b[_0x1b09('0x2d')]['message']||JSON[_0x1b09('0x2e')](_0x1fff0b[_0x1b09('0x2d')])));}return!![];});}function handleError(_0x46e202,_0x2ba156,_0x226cc1){return _0x46e202[_0x1b09('0x2f')](_0x2ba156||0x1f4)[_0x1b09('0x30')]({'message':_0x226cc1?_0x226cc1[_0x1b09('0x31')]||_0x226cc1:''});}exports[_0x1b09('0x32')]=function(_0x68fbfb,_0x1b7b3b,_0x3caa9b){passport[_0x1b09('0x16')]('local',function(_0x588b90,_0x23ce9a,_0xb2ef05){var _0x27a78c=_0x588b90||_0xb2ef05;if(_0x27a78c){return handleError(_0x1b7b3b,0x191,_0x27a78c);}if(!_0x23ce9a){return handleError(_0x1b7b3b,0x194,{'message':_0x1b09('0x33')});}else{var _0x147c2b={'payload':{'id':_0x23ce9a['id'],'role':_0x23ce9a[_0x1b09('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x1b09('0x34')](_0x147c2b)[_0x1b09('0xc')](function(_0x4dd7e2){_0x1b7b3b['json']({'id':_0x23ce9a['id'],'token':_0x4dd7e2,'statusCall':'','isAlreadyLogged':_0x23ce9a[_0x1b09('0x35')]});});}})(_0x68fbfb,_0x1b7b3b,_0x3caa9b);};exports['forgot']=function(_0x966873,_0x31dbfd,_0x1434ef){if(!_0x966873['body'][_0x1b09('0x20')]){return handleError(_0x31dbfd,0x1f4,{'message':_0x1b09('0x36')});}var _0x202b18=rs['generate']();_0x966873[_0x1b09('0x37')][_0x1b09('0x20')]=_0x966873[_0x1b09('0x37')][_0x1b09('0x20')]['trim']()[_0x1b09('0x38')]();var _0x2b2341;return db['Setting'][_0x1b09('0x9')]({'where':{'id':0x1},'attributes':[_0x1b09('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x4b388d){_0x2b2341=_0x4b388d;return db['User'][_0x1b09('0x1f')]({'where':{'email':_0x966873[_0x1b09('0x37')][_0x1b09('0x20')]}});})['then'](function(_0x207af5){if(!_0x207af5){throw new Error(_0x1b09('0x39'));}if(_0x207af5['disabled']){throw new Error(_0x1b09('0x3a'));}if(_0x207af5[_0x1b09('0x18')]){if(moment(_0x207af5[_0x1b09('0x10')])[_0x1b09('0x19')](_0x2b2341[_0x1b09('0xb')],_0x1b09('0x1b'))>moment()){throw new Error(_0x1b09('0x3b'));}else{_0x207af5[_0x1b09('0x18')]=![];_0x207af5[_0x1b09('0x10')]=null;}}_0x207af5[_0x1b09('0x3c')]=_0x202b18;_0x207af5['resetPasswordExpires']=Date[_0x1b09('0x3d')]()+0x36ee80;return _0x207af5[_0x1b09('0x3e')]();})[_0x1b09('0xc')](function(){return sendServiceMail({'to':_0x966873['body'][_0x1b09('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x1b09('0x3f')+_0x1b09('0x40')+'https://'+_0x966873[_0x1b09('0x41')][_0x1b09('0x42')]+_0x1b09('0x43')+_0x202b18+'\x0a\x0a'+_0x1b09('0x44')});})[_0x1b09('0xc')](function(){_0x31dbfd[_0x1b09('0x2f')](0xc8)['send']({'message':_0x1b09('0x45')});})['catch'](function(_0x35d9ee){return handleError(_0x31dbfd,0x1f4,_0x35d9ee);});};exports['reset']=function(_0x50a66c,_0x55376,_0x141b98){return db[_0x1b09('0x46')][_0x1b09('0x1f')]({'where':{'resetPasswordToken':_0x50a66c[_0x1b09('0x47')][_0x1b09('0x48')],'resetPasswordExpires':{'$gt':Date[_0x1b09('0x3d')]()}}})[_0x1b09('0xc')](function(_0x5bb402){if(!_0x5bb402){throw new Error(_0x1b09('0x49'));}return db[_0x1b09('0x8')][_0x1b09('0x9')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x1b09('0x4a')]})['then'](function(_0x2abc94){if(_0x2abc94[_0x1b09('0x4b')])authService['validatePasswordPattern'](_0x50a66c[_0x1b09('0x37')][_0x1b09('0x4c')]);if(!_0x2abc94['enforcePasswordHistory']||!_0x5bb402[_0x1b09('0x4d')])return _0x5bb402;authService[_0x1b09('0x4e')](_0x50a66c[_0x1b09('0x37')][_0x1b09('0x4c')],_0x5bb402[_0x1b09('0x4d')],_0x2abc94['passwordHistoryLimit']);return _0x5bb402;})[_0x1b09('0xc')](function(){_0x5bb402[_0x1b09('0x4c')]=_0x50a66c[_0x1b09('0x37')][_0x1b09('0x4c')];_0x5bb402[_0x1b09('0x3c')]=null;_0x5bb402[_0x1b09('0x4f')]=null;return _0x5bb402[_0x1b09('0x3e')]();});})['then'](function(){_0x55376['status'](0xc8)[_0x1b09('0x30')]({'message':_0x1b09('0x50')});})[_0x1b09('0x1d')](function(_0x533eb5){return handleError(_0x55376,0x1f4,_0x533eb5);});};passport[_0x1b09('0x51')](new LocalStrategy({'usernameField':_0x1b09('0xd'),'passwordField':_0x1b09('0x4c')},function(_0x5cc8f7,_0xbcf954,_0x2dcdb6){return localAuthenticate(db[_0x1b09('0x46')],_0x5cc8f7,_0xbcf954,_0x2dcdb6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b418f8d..3b6f6f3 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 _0x7a85=['Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','express'];(function(_0x47f7f5,_0xa5caf){var _0x52fe6b=function(_0x7ee9cf){while(--_0x7ee9cf){_0x47f7f5['push'](_0x47f7f5['shift']());}};_0x52fe6b(++_0xa5caf);}(_0x7a85,0x185));var _0x57a8=function(_0x16d30d,_0x5eb352){_0x16d30d=_0x16d30d-0x0;var _0x1350df=_0x7a85[_0x16d30d];return _0x1350df;};'use strict';var express=require(_0x57a8('0x0'));var router=express[_0x57a8('0x1')]();var controller=require(_0x57a8('0x2'));router[_0x57a8('0x3')]('/',controller[_0x57a8('0x4')]);router[_0x57a8('0x3')](_0x57a8('0x5'),controller[_0x57a8('0x6')]);router[_0x57a8('0x3')](_0x57a8('0x7'),controller[_0x57a8('0x8')]);module[_0x57a8('0x9')]=router; \ No newline at end of file +var _0xa835=['/reset/:token','exports','post','login','/forgot'];(function(_0x8323e0,_0x1e856e){var _0x58d579=function(_0x254676){while(--_0x254676){_0x8323e0['push'](_0x8323e0['shift']());}};_0x58d579(++_0x1e856e);}(_0xa835,0x6b));var _0x5a83=function(_0x275aa9,_0x253099){_0x275aa9=_0x275aa9-0x0;var _0x53d36d=_0xa835[_0x275aa9];return _0x53d36d;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router[_0x5a83('0x0')]('/',controller[_0x5a83('0x1')]);router['post'](_0x5a83('0x2'),controller['forgot']);router[_0x5a83('0x0')](_0x5a83('0x3'),controller['reset']);module[_0x5a83('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 7866173..41f3ab0 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 _0x9301=['exports','STRING','INTEGER','sequelize'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x9301,0xe7));var _0x1930=function(_0x2e892c,_0x1b8aba){_0x2e892c=_0x2e892c-0x0;var _0x3ff0fb=_0x9301[_0x2e892c];return _0x3ff0fb;};'use strict';var Sequelize=require(_0x1930('0x0'));module[_0x1930('0x1')]={'name':{'type':Sequelize[_0x1930('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1930('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1930('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x46ef=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x46ef,0xcf));var _0xf46e=function(_0x405af2,_0x4e13e1){_0x405af2=_0x405af2-0x0;var _0x7c6ef8=_0x46ef[_0x405af2];return _0x7c6ef8;};'use strict';var Sequelize=require(_0xf46e('0x0'));module[_0xf46e('0x1')]={'name':{'type':Sequelize[_0xf46e('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xf46e('0x2')]},'description':{'type':Sequelize[_0xf46e('0x2')]},'status':{'type':Sequelize[_0xf46e('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index bcaed5f..c628fe1 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 _0xb7e7=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','show','params','include','find','catch','create','destroy','addConditions','Condition','ids','omit','findOne','getConditions','addActions','Action','map','getActions','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','name','render','body','message','agent','interaction','index','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x40e139,_0x38b8ce){var _0x2084cf=function(_0x128b7b){while(--_0x128b7b){_0x40e139['push'](_0x40e139['shift']());}};_0x2084cf(++_0x38b8ce);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xb7e7[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=typeof _0x3d2fb2[_0x7b7e('0x1d')]===_0x7b7e('0x1e')&&typeof _0x3d2fb2[_0x7b7e('0x1f')]===_0x7b7e('0x1e');var _0x2cc400=_0x5703fd[_0x7b7e('0x20')];var _0x242368=_0x51baf6?0x0:_0x3d2fb2[_0x7b7e('0x1d')];var _0x2acb8c=_0x51baf6?_0x5703fd[_0x7b7e('0x20')]:_0x3d2fb2[_0x7b7e('0x1d')]+_0x3d2fb2[_0x7b7e('0x1f')];var _0x448980;if(_0x2acb8c>=_0x2cc400){_0x2acb8c=_0x2cc400;_0x448980=0xc8;}else{_0x448980=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x448980);return _0x457ec5[_0x7b7e('0x21')](_0x7b7e('0x22'),_0x242368+'-'+_0x2acb8c+'/'+_0x2cc400)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x49eddb){return function(_0x69262b){try{jsonpatch[_0x7b7e('0x23')](_0x69262b,_0x49eddb,!![]);}catch(_0x24718c){return BPromise['reject'](_0x24718c);}return _0x69262b[_0x7b7e('0x24')]();};}function saveUpdates(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x25')](_0xbf0cb3)[_0x7b7e('0x26')](function(_0x28bf43){return _0x28bf43;});}return null;};}function removeEntity(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(_0x5d6215){return _0x5d6215['destroy']()[_0x7b7e('0x26')](function(){_0x10a66a[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x483c6f,_0x51d3b1){return function(_0x5dadbb){if(!_0x5dadbb){_0x483c6f[_0x7b7e('0x19')](0x194);}return _0x5dadbb;};}function handleError(_0x3c8192,_0x16a3c7){_0x16a3c7=_0x16a3c7||0x1f4;return function(_0x7aa71){logger[_0x7b7e('0x27')](_0x7aa71['stack']);if(_0x7aa71[_0x7b7e('0x28')]){delete _0x7aa71[_0x7b7e('0x28')];}_0x3c8192['status'](_0x16a3c7)['send'](_0x7aa71);};}function getMustacheRender(_0x4e5de7,_0x12ef0b){return Mustache[_0x7b7e('0x29')](_0x4e5de7,_['merge'](_0x12ef0b[_0x7b7e('0x2a')],{'contact':_0x12ef0b['contact'],'message':_0x12ef0b[_0x7b7e('0x2b')],'agent':_0x12ef0b[_0x7b7e('0x2c')],'interaction':_0x12ef0b[_0x7b7e('0x2d')],'account':_0x12ef0b['account']}))||'';}exports[_0x7b7e('0x2e')]=function(_0xe31336,_0x35602a){var _0x326dd2={},_0x33f9a1={},_0x5732ee={'count':0x0,'rows':[]};var _0x41af57=_['map'](db[_0x7b7e('0x2f')][_0x7b7e('0x30')],function(_0x383de5){return{'name':_0x383de5[_0x7b7e('0x31')],'type':_0x383de5[_0x7b7e('0x32')][_0x7b7e('0x33')]};});_0x33f9a1[_0x7b7e('0x34')]=_['map'](_0x41af57,'name');_0x33f9a1[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0xe31336['query']);_0x33f9a1[_0x7b7e('0x37')]=_[_0x7b7e('0x38')](_0x33f9a1[_0x7b7e('0x34')],_0x33f9a1['query']);_0x326dd2[_0x7b7e('0x39')]=_[_0x7b7e('0x38')](_0x33f9a1[_0x7b7e('0x34')],qs[_0x7b7e('0x3a')](_0xe31336[_0x7b7e('0x35')][_0x7b7e('0x3a')]));_0x326dd2[_0x7b7e('0x39')]=_0x326dd2[_0x7b7e('0x39')][_0x7b7e('0x3b')]?_0x326dd2[_0x7b7e('0x39')]:_0x33f9a1[_0x7b7e('0x34')];if(!_0xe31336[_0x7b7e('0x35')][_0x7b7e('0x3c')](_0x7b7e('0x3d'))){_0x326dd2[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0xe31336['query'][_0x7b7e('0x1f')]);_0x326dd2[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0xe31336[_0x7b7e('0x35')][_0x7b7e('0x1d')]);}_0x326dd2[_0x7b7e('0x3e')]=qs[_0x7b7e('0x3f')](_0xe31336[_0x7b7e('0x35')][_0x7b7e('0x3f')]);_0x326dd2[_0x7b7e('0x40')]=qs['filters'](_[_0x7b7e('0x41')](_0xe31336[_0x7b7e('0x35')],_0x33f9a1[_0x7b7e('0x37')]),_0x41af57);if(_0xe31336[_0x7b7e('0x35')]['filter']){_0x326dd2[_0x7b7e('0x40')]=_[_0x7b7e('0x42')](_0x326dd2[_0x7b7e('0x40')],{'$or':_['map'](_0x41af57,function(_0x4a2888){if(_0x4a2888[_0x7b7e('0x32')]!=='VIRTUAL'){var _0x35382c={};_0x35382c[_0x4a2888[_0x7b7e('0x28')]]={'$like':'%'+_0xe31336['query'][_0x7b7e('0x43')]+'%'};return _0x35382c;}})});}_0x326dd2=_[_0x7b7e('0x42')]({},_0x326dd2,_0xe31336[_0x7b7e('0x44')]);var _0x5e7b6b={'where':_0x326dd2[_0x7b7e('0x40')]};return db[_0x7b7e('0x2f')][_0x7b7e('0x20')](_0x5e7b6b)[_0x7b7e('0x26')](function(_0x157871){_0x5732ee['count']=_0x157871;if(_0xe31336['query'][_0x7b7e('0x45')]){_0x326dd2['include']=[{'all':!![]}];}return db[_0x7b7e('0x2f')]['findAll'](_0x326dd2);})['then'](function(_0x356db0){_0x5732ee['rows']=_0x356db0;return _0x5732ee;})[_0x7b7e('0x26')](respondWithFilteredResult(_0x35602a,_0x326dd2))['catch'](handleError(_0x35602a,null));};exports[_0x7b7e('0x46')]=function(_0x3e58be,_0x7ea84c){var _0x231fdf={'raw':![],'where':{'id':_0x3e58be[_0x7b7e('0x47')]['id']}},_0x4fd335={};_0x4fd335[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x2f')][_0x7b7e('0x30')]);_0x4fd335[_0x7b7e('0x35')]=_['keys'](_0x3e58be['query']);_0x4fd335['filters']=_[_0x7b7e('0x38')](_0x4fd335[_0x7b7e('0x34')],_0x4fd335[_0x7b7e('0x35')]);_0x231fdf[_0x7b7e('0x39')]=_[_0x7b7e('0x38')](_0x4fd335[_0x7b7e('0x34')],qs['fields'](_0x3e58be[_0x7b7e('0x35')][_0x7b7e('0x3a')]));_0x231fdf['attributes']=_0x231fdf['attributes'][_0x7b7e('0x3b')]?_0x231fdf[_0x7b7e('0x39')]:_0x4fd335[_0x7b7e('0x34')];if(_0x3e58be[_0x7b7e('0x35')][_0x7b7e('0x45')]){_0x231fdf[_0x7b7e('0x48')]=[{'all':!![]}];}_0x231fdf=_['merge']({},_0x231fdf,_0x3e58be[_0x7b7e('0x44')]);return db['Automation'][_0x7b7e('0x49')](_0x231fdf)[_0x7b7e('0x26')](handleEntityNotFound(_0x7ea84c,null))[_0x7b7e('0x26')](respondWithResult(_0x7ea84c,null))[_0x7b7e('0x4a')](handleError(_0x7ea84c,null));};exports['create']=function(_0x3b649e,_0x1010b3){return db[_0x7b7e('0x2f')][_0x7b7e('0x4b')](_0x3b649e[_0x7b7e('0x2a')],{})['then'](respondWithResult(_0x1010b3,0xc9))[_0x7b7e('0x4a')](handleError(_0x1010b3,null));};exports[_0x7b7e('0x25')]=function(_0x21868a,_0xcb5186){if(_0x21868a[_0x7b7e('0x2a')]['id']){delete _0x21868a['body']['id'];}return db[_0x7b7e('0x2f')][_0x7b7e('0x49')]({'where':{'id':_0x21868a[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0xcb5186,null))[_0x7b7e('0x26')](saveUpdates(_0x21868a[_0x7b7e('0x2a')],null))[_0x7b7e('0x26')](respondWithResult(_0xcb5186,null))['catch'](handleError(_0xcb5186,null));};exports[_0x7b7e('0x4c')]=function(_0x5d7c89,_0x16730c){return db[_0x7b7e('0x2f')]['find']({'where':{'id':_0x5d7c89[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x16730c,null))[_0x7b7e('0x26')](removeEntity(_0x16730c,null))[_0x7b7e('0x4a')](handleError(_0x16730c,null));};exports[_0x7b7e('0x4d')]=function(_0x36ffd4,_0x337d06,_0x5f15ce){return db[_0x7b7e('0x4e')][_0x7b7e('0x49')]({'where':{'id':_0x36ffd4[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x337d06,null))['then'](function(_0x527403){if(_0x527403){return _0x527403['addConditions'](_0x36ffd4[_0x7b7e('0x2a')][_0x7b7e('0x4f')],_[_0x7b7e('0x50')](_0x36ffd4['body'],['ids','id'])||{});}})[_0x7b7e('0x26')](respondWithResult(_0x337d06,null))[_0x7b7e('0x4a')](handleError(_0x337d06,null));};exports['getConditions']=function(_0xf54f87,_0xbe02ed,_0x44c30a){var _0x56ea8a={};var _0x2b0657={};var _0x1d9af5;var _0x4d9a71;return db[_0x7b7e('0x2f')][_0x7b7e('0x51')]({'where':{'id':_0xf54f87[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0xbe02ed,null))[_0x7b7e('0x26')](function(_0x310b9a){if(_0x310b9a){_0x1d9af5=_0x310b9a;_0x2b0657[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x4e')]['rawAttributes']);_0x2b0657[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0xf54f87['query']);_0x2b0657[_0x7b7e('0x37')]=_[_0x7b7e('0x38')](_0x2b0657[_0x7b7e('0x34')],_0x2b0657['query']);_0x56ea8a[_0x7b7e('0x39')]=_['intersection'](_0x2b0657[_0x7b7e('0x34')],qs[_0x7b7e('0x3a')](_0xf54f87['query'][_0x7b7e('0x3a')]));_0x56ea8a[_0x7b7e('0x39')]=_0x56ea8a['attributes'][_0x7b7e('0x3b')]?_0x56ea8a[_0x7b7e('0x39')]:_0x2b0657[_0x7b7e('0x34')];_0x56ea8a[_0x7b7e('0x3e')]=qs['sort'](_0xf54f87[_0x7b7e('0x35')][_0x7b7e('0x3f')]);_0x56ea8a[_0x7b7e('0x40')]=qs[_0x7b7e('0x37')](_[_0x7b7e('0x41')](_0xf54f87[_0x7b7e('0x35')],_0x2b0657[_0x7b7e('0x37')]));if(_0xf54f87[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x56ea8a[_0x7b7e('0x40')]=_['merge'](_0x56ea8a[_0x7b7e('0x40')],{'$or':_['map'](_0x56ea8a['attributes'],function(_0x2b105a){var _0x7cbe6c={};_0x7cbe6c[_0x2b105a]={'$like':'%'+_0xf54f87[_0x7b7e('0x35')][_0x7b7e('0x43')]+'%'};return _0x7cbe6c;})});}_0x56ea8a=_['merge']({},_0x56ea8a,_0xf54f87[_0x7b7e('0x44')]);return _0x1d9af5[_0x7b7e('0x52')](_0x56ea8a);}})[_0x7b7e('0x26')](function(_0x3d4b2d){if(_0x3d4b2d){_0x4d9a71=_0x3d4b2d[_0x7b7e('0x3b')];if(!_0xf54f87[_0x7b7e('0x35')]['hasOwnProperty'](_0x7b7e('0x3d'))){_0x56ea8a['limit']=qs['limit'](_0xf54f87[_0x7b7e('0x35')]['limit']);_0x56ea8a[_0x7b7e('0x1d')]=qs['offset'](_0xf54f87[_0x7b7e('0x35')][_0x7b7e('0x1d')]);}return _0x1d9af5['getConditions'](_0x56ea8a);}})[_0x7b7e('0x26')](function(_0x2da71e){if(_0x2da71e){return _0x2da71e?{'count':_0x4d9a71,'rows':_0x2da71e}:null;}})['then'](respondWithResult(_0xbe02ed,null))[_0x7b7e('0x4a')](handleError(_0xbe02ed,null));};exports[_0x7b7e('0x53')]=function(_0x50184c,_0x430033,_0x36ea09){return db[_0x7b7e('0x54')][_0x7b7e('0x49')]({'where':{'id':_0x50184c[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x430033,null))[_0x7b7e('0x26')](function(_0x589b02){if(_0x589b02){return _0x589b02['addActions'](_0x50184c[_0x7b7e('0x2a')][_0x7b7e('0x4f')],_[_0x7b7e('0x50')](_0x50184c[_0x7b7e('0x2a')],[_0x7b7e('0x4f'),'id'])||{});}})[_0x7b7e('0x26')](respondWithResult(_0x430033,null))[_0x7b7e('0x4a')](handleError(_0x430033,null));};exports['getActions']=function(_0x28e6ac,_0x2aca93,_0x4ff2c8){var _0x3ce80e={};var _0x3f8162={};var _0x2fea85;var _0x271318;return db[_0x7b7e('0x2f')][_0x7b7e('0x51')]({'where':{'id':_0x28e6ac[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x2aca93,null))[_0x7b7e('0x26')](function(_0x3b6bc6){if(_0x3b6bc6){_0x2fea85=_0x3b6bc6;_0x3f8162[_0x7b7e('0x34')]=_['keys'](db[_0x7b7e('0x54')][_0x7b7e('0x30')]);_0x3f8162[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x28e6ac[_0x7b7e('0x35')]);_0x3f8162[_0x7b7e('0x37')]=_[_0x7b7e('0x38')](_0x3f8162['model'],_0x3f8162[_0x7b7e('0x35')]);_0x3ce80e[_0x7b7e('0x39')]=_[_0x7b7e('0x38')](_0x3f8162['model'],qs[_0x7b7e('0x3a')](_0x28e6ac[_0x7b7e('0x35')][_0x7b7e('0x3a')]));_0x3ce80e[_0x7b7e('0x39')]=_0x3ce80e[_0x7b7e('0x39')]['length']?_0x3ce80e['attributes']:_0x3f8162['model'];_0x3ce80e[_0x7b7e('0x3e')]=qs[_0x7b7e('0x3f')](_0x28e6ac[_0x7b7e('0x35')]['sort']);_0x3ce80e[_0x7b7e('0x40')]=qs[_0x7b7e('0x37')](_[_0x7b7e('0x41')](_0x28e6ac['query'],_0x3f8162[_0x7b7e('0x37')]));if(_0x28e6ac[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x3ce80e[_0x7b7e('0x40')]=_['merge'](_0x3ce80e[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x55')](_0x3ce80e[_0x7b7e('0x39')],function(_0x259f6e){var _0x4f0745={};_0x4f0745[_0x259f6e]={'$like':'%'+_0x28e6ac['query'][_0x7b7e('0x43')]+'%'};return _0x4f0745;})});}_0x3ce80e=_['merge']({},_0x3ce80e,_0x28e6ac[_0x7b7e('0x44')]);return _0x2fea85[_0x7b7e('0x56')](_0x3ce80e);}})[_0x7b7e('0x26')](function(_0x30b703){if(_0x30b703){_0x271318=_0x30b703['length'];if(!_0x28e6ac[_0x7b7e('0x35')][_0x7b7e('0x3c')](_0x7b7e('0x3d'))){_0x3ce80e[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x28e6ac[_0x7b7e('0x35')][_0x7b7e('0x1f')]);_0x3ce80e[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x28e6ac[_0x7b7e('0x35')][_0x7b7e('0x1d')]);}return _0x2fea85[_0x7b7e('0x56')](_0x3ce80e);}})[_0x7b7e('0x26')](function(_0x24189a){if(_0x24189a){return _0x24189a?{'count':_0x271318,'rows':_0x24189a}:null;}})[_0x7b7e('0x26')](respondWithResult(_0x2aca93,null))[_0x7b7e('0x4a')](handleError(_0x2aca93,null));}; \ No newline at end of file +var _0xd8b0=['omit','getActions','Action','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','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','count','set','Content-Range','apply','save','update','then','destroy','error','name','render','body','message','interaction','index','Automation','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','rows','params','rawAttributes','length','includeAll','include','find','catch','create','Condition','ids','getConditions','findOne','pick','addActions'];(function(_0x24516c,_0x59fcd8){var _0xaf2987=function(_0x9f8828){while(--_0x9f8828){_0x24516c['push'](_0x24516c['shift']());}};_0xaf2987(++_0x59fcd8);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}function getMustacheRender(_0xcbc4ac,_0x59aa83){return Mustache[_0x0d8b('0x28')](_0xcbc4ac,_['merge'](_0x59aa83[_0x0d8b('0x29')],{'contact':_0x59aa83['contact'],'message':_0x59aa83[_0x0d8b('0x2a')],'agent':_0x59aa83['agent'],'interaction':_0x59aa83[_0x0d8b('0x2b')],'account':_0x59aa83['account']}))||'';}exports[_0x0d8b('0x2c')]=function(_0x106e4c,_0x2c058d){var _0x56120a={},_0x4c80a2={},_0x51cf32={'count':0x0,'rows':[]};var _0x4e8992=_['map'](db[_0x0d8b('0x2d')]['rawAttributes'],function(_0x5d05fc){return{'name':_0x5d05fc[_0x0d8b('0x2e')],'type':_0x5d05fc[_0x0d8b('0x2f')][_0x0d8b('0x30')]};});_0x4c80a2[_0x0d8b('0x31')]=_[_0x0d8b('0x32')](_0x4e8992,_0x0d8b('0x27'));_0x4c80a2[_0x0d8b('0x33')]=_[_0x0d8b('0x34')](_0x106e4c['query']);_0x4c80a2[_0x0d8b('0x35')]=_[_0x0d8b('0x36')](_0x4c80a2['model'],_0x4c80a2[_0x0d8b('0x33')]);_0x56120a[_0x0d8b('0x37')]=_[_0x0d8b('0x36')](_0x4c80a2['model'],qs[_0x0d8b('0x38')](_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x38')]));_0x56120a[_0x0d8b('0x37')]=_0x56120a[_0x0d8b('0x37')]['length']?_0x56120a[_0x0d8b('0x37')]:_0x4c80a2[_0x0d8b('0x31')];if(!_0x106e4c['query'][_0x0d8b('0x39')](_0x0d8b('0x3a'))){_0x56120a[_0x0d8b('0x3b')]=qs[_0x0d8b('0x3b')](_0x106e4c[_0x0d8b('0x33')]['limit']);_0x56120a['offset']=qs[_0x0d8b('0x1c')](_0x106e4c['query']['offset']);}_0x56120a[_0x0d8b('0x3c')]=qs[_0x0d8b('0x3d')](_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x3d')]);_0x56120a[_0x0d8b('0x3e')]=qs[_0x0d8b('0x35')](_['pick'](_0x106e4c[_0x0d8b('0x33')],_0x4c80a2[_0x0d8b('0x35')]),_0x4e8992);if(_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x3f')]){_0x56120a[_0x0d8b('0x3e')]=_[_0x0d8b('0x40')](_0x56120a[_0x0d8b('0x3e')],{'$or':_['map'](_0x4e8992,function(_0x1d06b6){if(_0x1d06b6[_0x0d8b('0x2f')]!==_0x0d8b('0x41')){var _0x1f196d={};_0x1f196d[_0x1d06b6['name']]={'$like':'%'+_0x106e4c[_0x0d8b('0x33')]['filter']+'%'};return _0x1f196d;}})});}_0x56120a=_[_0x0d8b('0x40')]({},_0x56120a,_0x106e4c[_0x0d8b('0x42')]);var _0x32d7d7={'where':_0x56120a[_0x0d8b('0x3e')]};return db[_0x0d8b('0x2d')][_0x0d8b('0x1e')](_0x32d7d7)[_0x0d8b('0x24')](function(_0x373f69){_0x51cf32[_0x0d8b('0x1e')]=_0x373f69;if(_0x106e4c[_0x0d8b('0x33')]['includeAll']){_0x56120a['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x56120a);})['then'](function(_0x1a46f6){_0x51cf32[_0x0d8b('0x43')]=_0x1a46f6;return _0x51cf32;})[_0x0d8b('0x24')](respondWithFilteredResult(_0x2c058d,_0x56120a))['catch'](handleError(_0x2c058d,null));};exports['show']=function(_0x1b216d,_0x192de1){var _0x344278={'raw':![],'where':{'id':_0x1b216d[_0x0d8b('0x44')]['id']}},_0x513b93={};_0x513b93[_0x0d8b('0x31')]=_['keys'](db['Automation'][_0x0d8b('0x45')]);_0x513b93['query']=_[_0x0d8b('0x34')](_0x1b216d['query']);_0x513b93['filters']=_[_0x0d8b('0x36')](_0x513b93[_0x0d8b('0x31')],_0x513b93['query']);_0x344278['attributes']=_['intersection'](_0x513b93['model'],qs[_0x0d8b('0x38')](_0x1b216d[_0x0d8b('0x33')][_0x0d8b('0x38')]));_0x344278['attributes']=_0x344278[_0x0d8b('0x37')][_0x0d8b('0x46')]?_0x344278[_0x0d8b('0x37')]:_0x513b93[_0x0d8b('0x31')];if(_0x1b216d[_0x0d8b('0x33')][_0x0d8b('0x47')]){_0x344278[_0x0d8b('0x48')]=[{'all':!![]}];}_0x344278=_[_0x0d8b('0x40')]({},_0x344278,_0x1b216d[_0x0d8b('0x42')]);return db[_0x0d8b('0x2d')][_0x0d8b('0x49')](_0x344278)[_0x0d8b('0x24')](handleEntityNotFound(_0x192de1,null))[_0x0d8b('0x24')](respondWithResult(_0x192de1,null))[_0x0d8b('0x4a')](handleError(_0x192de1,null));};exports[_0x0d8b('0x4b')]=function(_0xdfcf32,_0x245325){return db[_0x0d8b('0x2d')][_0x0d8b('0x4b')](_0xdfcf32['body'],{})[_0x0d8b('0x24')](respondWithResult(_0x245325,0xc9))['catch'](handleError(_0x245325,null));};exports['update']=function(_0x39a31d,_0x113fb7){if(_0x39a31d[_0x0d8b('0x29')]['id']){delete _0x39a31d[_0x0d8b('0x29')]['id'];}return db['Automation'][_0x0d8b('0x49')]({'where':{'id':_0x39a31d[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x113fb7,null))[_0x0d8b('0x24')](saveUpdates(_0x39a31d[_0x0d8b('0x29')],null))['then'](respondWithResult(_0x113fb7,null))['catch'](handleError(_0x113fb7,null));};exports['destroy']=function(_0x573f4f,_0x368ede){return db[_0x0d8b('0x2d')]['find']({'where':{'id':_0x573f4f['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x368ede,null))[_0x0d8b('0x24')](removeEntity(_0x368ede,null))['catch'](handleError(_0x368ede,null));};exports['addConditions']=function(_0x900906,_0xeeefd4,_0x3cd00a){return db[_0x0d8b('0x4c')][_0x0d8b('0x49')]({'where':{'id':_0x900906['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0xeeefd4,null))[_0x0d8b('0x24')](function(_0x5481fc){if(_0x5481fc){return _0x5481fc['addConditions'](_0x900906[_0x0d8b('0x29')][_0x0d8b('0x4d')],_['omit'](_0x900906['body'],[_0x0d8b('0x4d'),'id'])||{});}})[_0x0d8b('0x24')](respondWithResult(_0xeeefd4,null))[_0x0d8b('0x4a')](handleError(_0xeeefd4,null));};exports[_0x0d8b('0x4e')]=function(_0x4a2989,_0x356b3d,_0x598e03){var _0x5c271c={};var _0x38c24e={};var _0x44043b;var _0x54aa03;return db['Automation'][_0x0d8b('0x4f')]({'where':{'id':_0x4a2989[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x356b3d,null))[_0x0d8b('0x24')](function(_0x3afc3a){if(_0x3afc3a){_0x44043b=_0x3afc3a;_0x38c24e[_0x0d8b('0x31')]=_[_0x0d8b('0x34')](db[_0x0d8b('0x4c')]['rawAttributes']);_0x38c24e[_0x0d8b('0x33')]=_[_0x0d8b('0x34')](_0x4a2989[_0x0d8b('0x33')]);_0x38c24e[_0x0d8b('0x35')]=_[_0x0d8b('0x36')](_0x38c24e[_0x0d8b('0x31')],_0x38c24e[_0x0d8b('0x33')]);_0x5c271c[_0x0d8b('0x37')]=_[_0x0d8b('0x36')](_0x38c24e['model'],qs[_0x0d8b('0x38')](_0x4a2989[_0x0d8b('0x33')][_0x0d8b('0x38')]));_0x5c271c[_0x0d8b('0x37')]=_0x5c271c[_0x0d8b('0x37')]['length']?_0x5c271c[_0x0d8b('0x37')]:_0x38c24e[_0x0d8b('0x31')];_0x5c271c[_0x0d8b('0x3c')]=qs[_0x0d8b('0x3d')](_0x4a2989[_0x0d8b('0x33')]['sort']);_0x5c271c['where']=qs[_0x0d8b('0x35')](_[_0x0d8b('0x50')](_0x4a2989[_0x0d8b('0x33')],_0x38c24e[_0x0d8b('0x35')]));if(_0x4a2989['query'][_0x0d8b('0x3f')]){_0x5c271c[_0x0d8b('0x3e')]=_[_0x0d8b('0x40')](_0x5c271c['where'],{'$or':_[_0x0d8b('0x32')](_0x5c271c['attributes'],function(_0x2fce07){var _0x3ed63e={};_0x3ed63e[_0x2fce07]={'$like':'%'+_0x4a2989[_0x0d8b('0x33')][_0x0d8b('0x3f')]+'%'};return _0x3ed63e;})});}_0x5c271c=_[_0x0d8b('0x40')]({},_0x5c271c,_0x4a2989[_0x0d8b('0x42')]);return _0x44043b['getConditions'](_0x5c271c);}})[_0x0d8b('0x24')](function(_0x4c074d){if(_0x4c074d){_0x54aa03=_0x4c074d[_0x0d8b('0x46')];if(!_0x4a2989[_0x0d8b('0x33')][_0x0d8b('0x39')](_0x0d8b('0x3a'))){_0x5c271c['limit']=qs[_0x0d8b('0x3b')](_0x4a2989[_0x0d8b('0x33')][_0x0d8b('0x3b')]);_0x5c271c[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x4a2989[_0x0d8b('0x33')][_0x0d8b('0x1c')]);}return _0x44043b[_0x0d8b('0x4e')](_0x5c271c);}})[_0x0d8b('0x24')](function(_0x34affb){if(_0x34affb){return _0x34affb?{'count':_0x54aa03,'rows':_0x34affb}:null;}})['then'](respondWithResult(_0x356b3d,null))['catch'](handleError(_0x356b3d,null));};exports[_0x0d8b('0x51')]=function(_0x3eb647,_0x53e399,_0xb1aa96){return db['Action']['find']({'where':{'id':_0x3eb647[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x53e399,null))['then'](function(_0x587128){if(_0x587128){return _0x587128[_0x0d8b('0x51')](_0x3eb647[_0x0d8b('0x29')][_0x0d8b('0x4d')],_[_0x0d8b('0x52')](_0x3eb647[_0x0d8b('0x29')],[_0x0d8b('0x4d'),'id'])||{});}})[_0x0d8b('0x24')](respondWithResult(_0x53e399,null))['catch'](handleError(_0x53e399,null));};exports[_0x0d8b('0x53')]=function(_0x5878c2,_0x1a203e,_0x2c6242){var _0x2bb690={};var _0x14a34b={};var _0x49f610;var _0x3fe47d;return db['Automation'][_0x0d8b('0x4f')]({'where':{'id':_0x5878c2[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x1a203e,null))[_0x0d8b('0x24')](function(_0xc5c35f){if(_0xc5c35f){_0x49f610=_0xc5c35f;_0x14a34b[_0x0d8b('0x31')]=_[_0x0d8b('0x34')](db[_0x0d8b('0x54')][_0x0d8b('0x45')]);_0x14a34b[_0x0d8b('0x33')]=_['keys'](_0x5878c2[_0x0d8b('0x33')]);_0x14a34b['filters']=_[_0x0d8b('0x36')](_0x14a34b[_0x0d8b('0x31')],_0x14a34b['query']);_0x2bb690[_0x0d8b('0x37')]=_['intersection'](_0x14a34b[_0x0d8b('0x31')],qs[_0x0d8b('0x38')](_0x5878c2[_0x0d8b('0x33')][_0x0d8b('0x38')]));_0x2bb690[_0x0d8b('0x37')]=_0x2bb690[_0x0d8b('0x37')][_0x0d8b('0x46')]?_0x2bb690[_0x0d8b('0x37')]:_0x14a34b['model'];_0x2bb690[_0x0d8b('0x3c')]=qs[_0x0d8b('0x3d')](_0x5878c2['query'][_0x0d8b('0x3d')]);_0x2bb690[_0x0d8b('0x3e')]=qs[_0x0d8b('0x35')](_[_0x0d8b('0x50')](_0x5878c2[_0x0d8b('0x33')],_0x14a34b[_0x0d8b('0x35')]));if(_0x5878c2[_0x0d8b('0x33')][_0x0d8b('0x3f')]){_0x2bb690[_0x0d8b('0x3e')]=_[_0x0d8b('0x40')](_0x2bb690[_0x0d8b('0x3e')],{'$or':_[_0x0d8b('0x32')](_0x2bb690['attributes'],function(_0x1ece98){var _0x93fc55={};_0x93fc55[_0x1ece98]={'$like':'%'+_0x5878c2[_0x0d8b('0x33')]['filter']+'%'};return _0x93fc55;})});}_0x2bb690=_['merge']({},_0x2bb690,_0x5878c2[_0x0d8b('0x42')]);return _0x49f610[_0x0d8b('0x53')](_0x2bb690);}})[_0x0d8b('0x24')](function(_0x5b76af){if(_0x5b76af){_0x3fe47d=_0x5b76af['length'];if(!_0x5878c2[_0x0d8b('0x33')][_0x0d8b('0x39')](_0x0d8b('0x3a'))){_0x2bb690[_0x0d8b('0x3b')]=qs[_0x0d8b('0x3b')](_0x5878c2[_0x0d8b('0x33')][_0x0d8b('0x3b')]);_0x2bb690[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x5878c2[_0x0d8b('0x33')][_0x0d8b('0x1c')]);}return _0x49f610[_0x0d8b('0x53')](_0x2bb690);}})[_0x0d8b('0x24')](function(_0x5dbc6b){if(_0x5dbc6b){return _0x5dbc6b?{'count':_0x3fe47d,'rows':_0x5dbc6b}:null;}})[_0x0d8b('0x24')](respondWithResult(_0x1a203e,null))[_0x0d8b('0x4a')](handleError(_0x1a203e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 1e4342d..6a8c3d3 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 _0x112f=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','Automation','tools_automations'];(function(_0x132ac4,_0x4433e1){var _0x3c37cb=function(_0x46c973){while(--_0x46c973){_0x132ac4['push'](_0x132ac4['shift']());}};_0x3c37cb(++_0x4433e1);}(_0x112f,0x11e));var _0xf112=function(_0xa48618,_0x5afc11){_0xa48618=_0xa48618-0x0;var _0xf6f6a5=_0x112f[_0xa48618];return _0xf6f6a5;};'use strict';var _=require(_0xf112('0x0'));var util=require('util');var logger=require(_0xf112('0x1'))('api');var moment=require(_0xf112('0x2'));var BPromise=require(_0xf112('0x3'));var rp=require(_0xf112('0x4'));var fs=require('fs');var path=require(_0xf112('0x5'));var rimraf=require('rimraf');var config=require(_0xf112('0x6'));var attributes=require('./automation.attributes');module[_0xf112('0x7')]=function(_0x2ca020,_0x1b060d){return _0x2ca020[_0xf112('0x8')](_0xf112('0x9'),attributes,{'tableName':_0xf112('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36bd=['./automation.attributes','exports','define','Automation','tools_automations','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x4857a4,_0x34f0f2){var _0xe96904=function(_0x45dc84){while(--_0x45dc84){_0x4857a4['push'](_0x4857a4['shift']());}};_0xe96904(++_0x34f0f2);}(_0x36bd,0x179));var _0xd36b=function(_0x1e7619,_0x7e0a9b){_0x1e7619=_0x1e7619-0x0;var _0x43835e=_0x36bd[_0x1e7619];return _0x43835e;};'use strict';var _=require(_0xd36b('0x0'));var util=require(_0xd36b('0x1'));var logger=require('../../config/logger')(_0xd36b('0x2'));var moment=require(_0xd36b('0x3'));var BPromise=require(_0xd36b('0x4'));var rp=require(_0xd36b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd36b('0x6'));var config=require('../../config/environment');var attributes=require(_0xd36b('0x7'));module[_0xd36b('0x8')]=function(_0x45ddae,_0xdd7308){return _0x45ddae[_0xd36b('0x9')](_0xd36b('0xa'),attributes,{'tableName':_0xd36b('0xb'),'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 39b16b8..6081346 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 _0xe52b=['debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe52b,0x11a));var _0xbe52=function(_0x1bc611,_0x57c66e){_0x1bc611=_0x1bc611-0x0;var _0x356f76=_0xe52b[_0x1bc611];return _0x356f76;};'use strict';var _=require(_0xbe52('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe52('0x1'));var fs=require('fs');var Redis=require(_0xbe52('0x2'));var db=require(_0xbe52('0x3'))['db'];var utils=require(_0xbe52('0x4'));var logger=require('../../config/logger')(_0xbe52('0x5'));var config=require('../../config/environment');var jayson=require(_0xbe52('0x6'));var client=jayson[_0xbe52('0x7')][_0xbe52('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x379e1d,_0x5594af,_0x41bf76){return new BPromise(function(_0x310c3f,_0x329d9f){return client[_0xbe52('0x9')](_0x379e1d,_0x41bf76)['then'](function(_0x255657){logger[_0xbe52('0xa')](_0xbe52('0xb'),_0x5594af,'request\x20sent');logger[_0xbe52('0xc')](_0xbe52('0xd'),_0x5594af,_0xbe52('0xe'),JSON[_0xbe52('0xf')](_0x255657));if(_0x255657[_0xbe52('0x10')]){if(_0x255657[_0xbe52('0x10')][_0xbe52('0x11')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x5594af,_0x255657[_0xbe52('0x10')][_0xbe52('0x12')]);return _0x329d9f(_0x255657[_0xbe52('0x10')][_0xbe52('0x12')]);}logger[_0xbe52('0x10')](_0xbe52('0xb'),_0x5594af,_0x255657[_0xbe52('0x10')][_0xbe52('0x12')]);return _0x310c3f(_0x255657['error'][_0xbe52('0x12')]);}else{logger[_0xbe52('0xa')](_0xbe52('0xb'),_0x5594af,_0xbe52('0xe'));_0x310c3f(_0x255657[_0xbe52('0x13')][_0xbe52('0x12')]);}})[_0xbe52('0x14')](function(_0x3aea2f){logger[_0xbe52('0x10')](_0xbe52('0xb'),_0x5594af,_0x3aea2f);_0x329d9f(_0x3aea2f);});});} \ No newline at end of file +var _0x9e16=['bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x8769e0,_0x349138){var _0x3668d3=function(_0x34bbe1){while(--_0x34bbe1){_0x8769e0['push'](_0x8769e0['shift']());}};_0x3668d3(++_0x349138);}(_0x9e16,0x19b));var _0x69e1=function(_0x255e94,_0x1fd934){_0x255e94=_0x255e94-0x0;var _0x4d45c7=_0x9e16[_0x255e94];return _0x4d45c7;};'use strict';var _=require(_0x69e1('0x0'));var util=require(_0x69e1('0x1'));var moment=require(_0x69e1('0x2'));var BPromise=require(_0x69e1('0x3'));var rs=require(_0x69e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x69e1('0x5'))(_0x69e1('0x6'));var config=require(_0x69e1('0x7'));var jayson=require(_0x69e1('0x8'));var client=jayson[_0x69e1('0x9')][_0x69e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x472f65,_0x3b5062,_0x2410be){return new BPromise(function(_0x1c27da,_0xf6a7a1){return client[_0x69e1('0xb')](_0x472f65,_0x2410be)[_0x69e1('0xc')](function(_0x5ef11f){logger[_0x69e1('0xd')](_0x69e1('0xe'),_0x3b5062,_0x69e1('0xf'));logger[_0x69e1('0x10')](_0x69e1('0x11'),_0x3b5062,_0x69e1('0xf'),JSON[_0x69e1('0x12')](_0x5ef11f));if(_0x5ef11f[_0x69e1('0x13')]){if(_0x5ef11f[_0x69e1('0x13')]['code']===0x1f4){logger[_0x69e1('0x13')](_0x69e1('0xe'),_0x3b5062,_0x5ef11f[_0x69e1('0x13')][_0x69e1('0x14')]);return _0xf6a7a1(_0x5ef11f[_0x69e1('0x13')][_0x69e1('0x14')]);}logger[_0x69e1('0x13')](_0x69e1('0xe'),_0x3b5062,_0x5ef11f['error'][_0x69e1('0x14')]);return _0x1c27da(_0x5ef11f[_0x69e1('0x13')][_0x69e1('0x14')]);}else{logger[_0x69e1('0xd')](_0x69e1('0xe'),_0x3b5062,'request\x20sent');_0x1c27da(_0x5ef11f[_0x69e1('0x15')][_0x69e1('0x14')]);}})[_0x69e1('0x16')](function(_0x3bbf61){logger[_0x69e1('0x13')]('Automation,\x20%s,\x20%s',_0x3b5062,_0x3bbf61);_0xf6a7a1(_0x3bbf61);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e804c24..3df51dc 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 _0xc2a1=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc2a1,0x111));var _0x1c2a=function(_0x304655,_0x15b109){_0x304655=_0x304655-0x0;var _0x2fa58a=_0xc2a1[_0x304655];return _0x2fa58a;};'use strict';var multer=require('multer');var util=require(_0x1c2a('0x0'));var path=require(_0x1c2a('0x1'));var timeout=require(_0x1c2a('0x2'));var express=require(_0x1c2a('0x3'));var router=express[_0x1c2a('0x4')]();var fs_extra=require(_0x1c2a('0x5'));var auth=require(_0x1c2a('0x6'));var interaction=require(_0x1c2a('0x7'));var config=require(_0x1c2a('0x8'));var controller=require(_0x1c2a('0x9'));router[_0x1c2a('0xa')]('/',auth[_0x1c2a('0xb')](),controller[_0x1c2a('0xc')]);router[_0x1c2a('0xa')](_0x1c2a('0xd'),auth[_0x1c2a('0xb')](),controller[_0x1c2a('0xe')]);router[_0x1c2a('0xa')](_0x1c2a('0xf'),auth['isAuthenticated'](),controller['getConditions']);router['get'](_0x1c2a('0x10'),auth[_0x1c2a('0xb')](),controller[_0x1c2a('0x11')]);router[_0x1c2a('0x12')]('/',auth[_0x1c2a('0xb')](),controller[_0x1c2a('0x13')]);router[_0x1c2a('0x12')]('/:id/conditions',auth[_0x1c2a('0xb')](),controller[_0x1c2a('0x14')]);router[_0x1c2a('0x12')](_0x1c2a('0x10'),auth[_0x1c2a('0xb')](),controller[_0x1c2a('0x15')]);router[_0x1c2a('0x16')](_0x1c2a('0xd'),auth[_0x1c2a('0xb')](),controller[_0x1c2a('0x17')]);router[_0x1c2a('0x18')]('/:id',auth[_0x1c2a('0xb')](),controller[_0x1c2a('0x19')]);module[_0x1c2a('0x1a')]=router; \ No newline at end of file +var _0x17fb=['getActions','post','create','addConditions','addActions','update','/:id','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions'];(function(_0x21dfd7,_0x5ef1bb){var _0xad6e6f=function(_0x1fd1bd){while(--_0x1fd1bd){_0x21dfd7['push'](_0x21dfd7['shift']());}};_0xad6e6f(++_0x5ef1bb);}(_0x17fb,0xb0));var _0xb17f=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x17fb[_0x4bd06e];return _0x85ebb;};'use strict';var multer=require('multer');var util=require(_0xb17f('0x0'));var path=require(_0xb17f('0x1'));var timeout=require('connect-timeout');var express=require(_0xb17f('0x2'));var router=express['Router']();var fs_extra=require(_0xb17f('0x3'));var auth=require(_0xb17f('0x4'));var interaction=require(_0xb17f('0x5'));var config=require(_0xb17f('0x6'));var controller=require('./automation.controller');router[_0xb17f('0x7')]('/',auth[_0xb17f('0x8')](),controller['index']);router[_0xb17f('0x7')]('/:id',auth[_0xb17f('0x8')](),controller[_0xb17f('0x9')]);router['get'](_0xb17f('0xa'),auth[_0xb17f('0x8')](),controller[_0xb17f('0xb')]);router['get'](_0xb17f('0xc'),auth[_0xb17f('0x8')](),controller[_0xb17f('0xd')]);router[_0xb17f('0xe')]('/',auth[_0xb17f('0x8')](),controller[_0xb17f('0xf')]);router[_0xb17f('0xe')](_0xb17f('0xa'),auth[_0xb17f('0x8')](),controller[_0xb17f('0x10')]);router['post'](_0xb17f('0xc'),auth['isAuthenticated'](),controller[_0xb17f('0x11')]);router['put']('/:id',auth[_0xb17f('0x8')](),controller[_0xb17f('0x12')]);router['delete'](_0xb17f('0x13'),auth[_0xb17f('0x8')](),controller['destroy']);module[_0xb17f('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index a25e96d..d4241b8 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 _0x591a=['#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\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#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','ENUM','ivr','STRING','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,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x5c4b74,_0x240a7c){var _0x237de2=function(_0x2983d0){while(--_0x2983d0){_0x5c4b74['push'](_0x5c4b74['shift']());}};_0x237de2(++_0x240a7c);}(_0x591a,0x7c));var _0xa591=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x591a[_0xf51c06];return _0x1d5420;};'use strict';var Sequelize=require(_0xa591('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xa591('0x1')](_0xa591('0x2')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xa591('0x3')]},'active':{'type':Sequelize[_0xa591('0x4')],'defaultValue':0x0,'comment':_0xa591('0x5')},'limitCalls':{'type':Sequelize[_0xa591('0x6')](0x4)[_0xa591('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa591('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa591('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'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[_0xa591('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa591('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa591('0x6')](0x5)[_0xa591('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa591('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xa591('0x6')](0x3)[_0xa591('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa591('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa591('0x6')](0x5)[_0xa591('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa591('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa591('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa591('0x6')](0x5)[_0xa591('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa591('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa591('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa591('0xe')},'dialTimezone':{'type':Sequelize[_0xa591('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa591('0x3')],'defaultValue':_0xa591('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xa591('0x1')](_0xa591('0x10'),'never',_0xa591('0x11')),'defaultValue':_0xa591('0x10')},'dialAMDActive':{'type':Sequelize[_0xa591('0x4')],'defaultValue':0x0,'comment':_0xa591('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xa591('0x6')](0x9)[_0xa591('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa591('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xa591('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa591('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa591('0x6')](0x9)[_0xa591('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa591('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa591('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xa591('0x6')](0x9)[_0xa591('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa591('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa591('0x6')](0x9)[_0xa591('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa591('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xa591('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa591('0x6')](0x5)[_0xa591('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa591('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa591('0x6')](0x9)[_0xa591('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xa591('0x19'),_0xa591('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xa591('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa591('0x6')](0x3)[_0xa591('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa591('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xa591('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa591('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa591('0x6')](0x3)[_0xa591('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa591('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa591('0x6')](0x5)[_0xa591('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa591('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa591('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa591('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xa591('0x6')](0x5)[_0xa591('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa591('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa591('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa591('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa591('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa591('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa591('0x6')](0x5)[_0xa591('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa591('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa591('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa591('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa591('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa591('0x24')}}; \ No newline at end of file +var _0x4c0f=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','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)'];(function(_0x319b47,_0x31417f){var _0x509211=function(_0x10f2b0){while(--_0x10f2b0){_0x319b47['push'](_0x319b47['shift']());}};_0x509211(++_0x31417f);}(_0x4c0f,0x1a6));var _0xf4c0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4c0f[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xf4c0('0x0'));module[_0xf4c0('0x1')]={'name':{'type':Sequelize[_0xf4c0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf4c0('0x3')](_0xf4c0('0x4')),'allowNull':![],'defaultValue':_0xf4c0('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf4c0('0x5')],'defaultValue':0x0,'comment':_0xf4c0('0x6')},'limitCalls':{'type':Sequelize[_0xf4c0('0x7')](0x4)[_0xf4c0('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf4c0('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf4c0('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf4c0('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xf4c0('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf4c0('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf4c0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf4c0('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf4c0('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xf4c0('0x7')](0x3)[_0xf4c0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf4c0('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf4c0('0x7')](0x5)[_0xf4c0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4c0('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf4c0('0x8')],'defaultValue':0x3,'comment':_0xf4c0('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf4c0('0x7')](0x5)[_0xf4c0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4c0('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf4c0('0x7')](0x3)[_0xf4c0('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf4c0('0x10')},'dialTimezone':{'type':Sequelize[_0xf4c0('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf4c0('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xf4c0('0x3')](_0xf4c0('0x11'),'never',_0xf4c0('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xf4c0('0x5')],'defaultValue':0x0,'comment':_0xf4c0('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xf4c0('0x7')](0x9)[_0xf4c0('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf4c0('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xf4c0('0x7')](0x9)[_0xf4c0('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf4c0('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf4c0('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf4c0('0x7')](0x9)[_0xf4c0('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf4c0('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xf4c0('0x7')](0x9)[_0xf4c0('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf4c0('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf4c0('0x7')](0x9)[_0xf4c0('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf4c0('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf4c0('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf4c0('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf4c0('0x7')](0x5)[_0xf4c0('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf4c0('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf4c0('0x7')](0x9)[_0xf4c0('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf4c0('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf4c0('0x3')](_0xf4c0('0x1d'),'ASC'),'defaultValue':_0xf4c0('0x1d')},'dialPrefix':{'type':Sequelize[_0xf4c0('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf4c0('0x7')](0x3)[_0xf4c0('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf4c0('0x1e')},'dialCutDigit':{'type':Sequelize[_0xf4c0('0x7')](0x3)[_0xf4c0('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf4c0('0x7')](0x3)[_0xf4c0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf4c0('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf4c0('0x7')](0x5)[_0xf4c0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4c0('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xf4c0('0x7')](0x3)[_0xf4c0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf4c0('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xf4c0('0x7')](0x5)[_0xf4c0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4c0('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf4c0('0x7')](0x3)[_0xf4c0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf4c0('0x7')](0x5)[_0xf4c0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4c0('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xf4c0('0x7')](0x3)[_0xf4c0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xf4c0('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4c0('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf4c0('0x7')](0x3)[_0xf4c0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf4c0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf4c0('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 88922d1..9739c6b 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 _0x3bd0=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','render','merge','body','account','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','map','VIRTUAL','Campaign','includeAll','include','catch','show','params','options','find','create','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','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','findAll','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','NOW()','ContactId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x25dcfb,_0x4e0726){var _0x29f87f=function(_0x35e5e9){while(--_0x35e5e9){_0x25dcfb['push'](_0x25dcfb['shift']());}};_0x29f87f(++_0x4e0726);}(_0x3bd0,0xfe));var _0x03bd=function(_0x4453a9,_0x217f6c){_0x4453a9=_0x4453a9-0x0;var _0x2828ea=_0x3bd0[_0x4453a9];return _0x2828ea;};'use strict';var emlformat=require(_0x03bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03bd('0x1'));var jsonpatch=require(_0x03bd('0x2'));var rp=require(_0x03bd('0x3'));var moment=require(_0x03bd('0x4'));var BPromise=require(_0x03bd('0x5'));var Mustache=require('mustache');var util=require(_0x03bd('0x6'));var path=require('path');var sox=require(_0x03bd('0x7'));var csv=require(_0x03bd('0x8'));var ejs=require(_0x03bd('0x9'));var fs=require('fs');var fs_extra=require(_0x03bd('0xa'));var _=require(_0x03bd('0xb'));var squel=require(_0x03bd('0xc'));var crypto=require(_0x03bd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x03bd('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x03bd('0xf'));var Redis=require(_0x03bd('0x10'));var authService=require(_0x03bd('0x11'));var qs=require(_0x03bd('0x12'));var as=require(_0x03bd('0x13'));var hardwareService=require(_0x03bd('0x14'));var logger=require(_0x03bd('0x15'))(_0x03bd('0x16'));var utils=require(_0x03bd('0x17'));var config=require(_0x03bd('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x329b8c,_0x4933ff){_0x4933ff=_0x4933ff||0xcc;return function(_0x164759){if(_0x164759){return _0x329b8c[_0x03bd('0x19')](_0x4933ff);}return _0x329b8c[_0x03bd('0x1a')](_0x4933ff)['end']();};}function respondWithResult(_0x3b85ba,_0x1035b2){_0x1035b2=_0x1035b2||0xc8;return function(_0x30845b){if(_0x30845b){return _0x3b85ba[_0x03bd('0x1a')](_0x1035b2)[_0x03bd('0x1b')](_0x30845b);}};}function respondWithFilteredResult(_0x1c9622,_0x1a21b4){return function(_0x327d8c){if(_0x327d8c){var _0x3c5c69=typeof _0x1a21b4[_0x03bd('0x1c')]===_0x03bd('0x1d')&&typeof _0x1a21b4[_0x03bd('0x1e')]===_0x03bd('0x1d');var _0x49457c=_0x327d8c[_0x03bd('0x1f')];var _0x35b908=_0x3c5c69?0x0:_0x1a21b4[_0x03bd('0x1c')];var _0x56e2fb=_0x3c5c69?_0x327d8c[_0x03bd('0x1f')]:_0x1a21b4[_0x03bd('0x1c')]+_0x1a21b4[_0x03bd('0x1e')];var _0x5d3485;if(_0x56e2fb>=_0x49457c){_0x56e2fb=_0x49457c;_0x5d3485=0xc8;}else{_0x5d3485=0xce;}_0x1c9622[_0x03bd('0x1a')](_0x5d3485);return _0x1c9622[_0x03bd('0x20')]('Content-Range',_0x35b908+'-'+_0x56e2fb+'/'+_0x49457c)[_0x03bd('0x1b')](_0x327d8c);}return null;};}function patchUpdates(_0x4b09ad){return function(_0x533866){try{jsonpatch[_0x03bd('0x21')](_0x533866,_0x4b09ad,!![]);}catch(_0x199962){return BPromise[_0x03bd('0x22')](_0x199962);}return _0x533866[_0x03bd('0x23')]();};}function saveUpdates(_0xd73767,_0x46e7d4){return function(_0x266cf1){if(_0x266cf1){return _0x266cf1[_0x03bd('0x24')](_0xd73767)['then'](function(_0x2735f2){return _0x2735f2;});}return null;};}function removeEntity(_0x20f37d,_0x574f85){return function(_0x497118){if(_0x497118){return _0x497118['destroy']()[_0x03bd('0x25')](function(){var _0x3f30e5=_0x497118[_0x03bd('0x26')]({'plain':!![]});var _0x36ae15=_0x03bd('0x27');return db[_0x03bd('0x28')][_0x03bd('0x29')]({'where':{'type':_0x36ae15,'resourceId':_0x3f30e5['id']}})[_0x03bd('0x25')](function(){return _0x497118;});})[_0x03bd('0x25')](function(){_0x20f37d[_0x03bd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18e052,_0x373708){return function(_0x34d763){if(!_0x34d763){_0x18e052[_0x03bd('0x19')](0x194);}return _0x34d763;};}function handleError(_0x4ef79d,_0x435ad0){_0x435ad0=_0x435ad0||0x1f4;return function(_0x17af64){logger[_0x03bd('0x2a')](_0x17af64[_0x03bd('0x2b')]);if(_0x17af64[_0x03bd('0x2c')]){delete _0x17af64[_0x03bd('0x2c')];}_0x4ef79d[_0x03bd('0x1a')](_0x435ad0)[_0x03bd('0x2d')](_0x17af64);};}function getMustacheRender(_0x1b44b6,_0x3970b6){return Mustache[_0x03bd('0x2e')](_0x1b44b6,_[_0x03bd('0x2f')](_0x3970b6[_0x03bd('0x30')],{'contact':_0x3970b6['contact'],'message':_0x3970b6['message'],'agent':_0x3970b6['agent'],'interaction':_0x3970b6['interaction'],'account':_0x3970b6[_0x03bd('0x31')]}))||'';}exports['index']=function(_0x3fe57f,_0x5cf736){var _0x3c2f3b={},_0x391a7a={},_0x599c70={'count':0x0,'rows':[]};var _0x1cf1fe=_['map'](db['Campaign'][_0x03bd('0x32')],function(_0xb13209){return{'name':_0xb13209['fieldName'],'type':_0xb13209[_0x03bd('0x33')][_0x03bd('0x34')]};});_0x391a7a[_0x03bd('0x35')]=_['map'](_0x1cf1fe,_0x03bd('0x2c'));_0x391a7a[_0x03bd('0x36')]=_[_0x03bd('0x37')](_0x3fe57f[_0x03bd('0x36')]);_0x391a7a[_0x03bd('0x38')]=_['intersection'](_0x391a7a['model'],_0x391a7a[_0x03bd('0x36')]);_0x3c2f3b[_0x03bd('0x39')]=_[_0x03bd('0x3a')](_0x391a7a[_0x03bd('0x35')],qs[_0x03bd('0x3b')](_0x3fe57f[_0x03bd('0x36')][_0x03bd('0x3b')]));_0x3c2f3b[_0x03bd('0x39')]=_0x3c2f3b[_0x03bd('0x39')][_0x03bd('0x3c')]?_0x3c2f3b[_0x03bd('0x39')]:_0x391a7a[_0x03bd('0x35')];if(!_0x3fe57f['query']['hasOwnProperty'](_0x03bd('0x3d'))){_0x3c2f3b['limit']=qs['limit'](_0x3fe57f[_0x03bd('0x36')][_0x03bd('0x1e')]);_0x3c2f3b[_0x03bd('0x1c')]=qs[_0x03bd('0x1c')](_0x3fe57f[_0x03bd('0x36')][_0x03bd('0x1c')]);}_0x3c2f3b[_0x03bd('0x3e')]=qs[_0x03bd('0x3f')](_0x3fe57f['query'][_0x03bd('0x3f')]);_0x3c2f3b['where']=qs[_0x03bd('0x38')](_[_0x03bd('0x40')](_0x3fe57f[_0x03bd('0x36')],_0x391a7a['filters']),_0x1cf1fe);if(_0x3fe57f[_0x03bd('0x36')][_0x03bd('0x41')]){_0x3c2f3b[_0x03bd('0x42')]=_[_0x03bd('0x2f')](_0x3c2f3b[_0x03bd('0x42')],{'$or':_[_0x03bd('0x43')](_0x1cf1fe,function(_0x2c3a79){if(_0x2c3a79[_0x03bd('0x33')]!==_0x03bd('0x44')){var _0x16b2b1={};_0x16b2b1[_0x2c3a79[_0x03bd('0x2c')]]={'$like':'%'+_0x3fe57f['query']['filter']+'%'};return _0x16b2b1;}})});}_0x3c2f3b=_[_0x03bd('0x2f')]({},_0x3c2f3b,_0x3fe57f['options']);var _0x48ce0f={'where':_0x3c2f3b['where']};return db[_0x03bd('0x45')][_0x03bd('0x1f')](_0x48ce0f)[_0x03bd('0x25')](function(_0x54586d){_0x599c70[_0x03bd('0x1f')]=_0x54586d;if(_0x3fe57f['query'][_0x03bd('0x46')]){_0x3c2f3b[_0x03bd('0x47')]=[{'all':!![]}];}return db[_0x03bd('0x45')]['findAll'](_0x3c2f3b);})[_0x03bd('0x25')](function(_0x508d28){_0x599c70['rows']=_0x508d28;return _0x599c70;})[_0x03bd('0x25')](respondWithFilteredResult(_0x5cf736,_0x3c2f3b))[_0x03bd('0x48')](handleError(_0x5cf736,null));};exports[_0x03bd('0x49')]=function(_0x4a9ccd,_0x77482e){var _0x14247a={'raw':![],'where':{'id':_0x4a9ccd[_0x03bd('0x4a')]['id']}},_0x33533f={};_0x33533f['model']=_[_0x03bd('0x37')](db[_0x03bd('0x45')][_0x03bd('0x32')]);_0x33533f[_0x03bd('0x36')]=_[_0x03bd('0x37')](_0x4a9ccd[_0x03bd('0x36')]);_0x33533f[_0x03bd('0x38')]=_[_0x03bd('0x3a')](_0x33533f['model'],_0x33533f['query']);_0x14247a[_0x03bd('0x39')]=_[_0x03bd('0x3a')](_0x33533f[_0x03bd('0x35')],qs[_0x03bd('0x3b')](_0x4a9ccd['query']['fields']));_0x14247a['attributes']=_0x14247a[_0x03bd('0x39')][_0x03bd('0x3c')]?_0x14247a['attributes']:_0x33533f['model'];if(_0x4a9ccd[_0x03bd('0x36')][_0x03bd('0x46')]){_0x14247a[_0x03bd('0x47')]=[{'all':!![]}];}_0x14247a=_[_0x03bd('0x2f')]({},_0x14247a,_0x4a9ccd[_0x03bd('0x4b')]);return db['Campaign'][_0x03bd('0x4c')](_0x14247a)[_0x03bd('0x25')](handleEntityNotFound(_0x77482e,null))[_0x03bd('0x25')](respondWithResult(_0x77482e,null))[_0x03bd('0x48')](handleError(_0x77482e,null));};exports[_0x03bd('0x4d')]=function(_0x4d5e3a,_0x32e847){return db[_0x03bd('0x45')]['create'](_0x4d5e3a['body'],{})[_0x03bd('0x25')](function(_0x3463a8){var _0x2404dd=_0x4d5e3a[_0x03bd('0x4e')][_0x03bd('0x26')]({'plain':!![]});if(!_0x2404dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2404dd[_0x03bd('0x4f')]===_0x03bd('0x4e')){var _0x34c52b=_0x3463a8['get']({'plain':!![]});var _0x2bebd6=_0x03bd('0x27');return db[_0x03bd('0x50')]['find']({'where':{'name':_0x2bebd6,'userProfileId':_0x2404dd[_0x03bd('0x51')]},'raw':!![]})[_0x03bd('0x25')](function(_0xe20226){if(_0xe20226&&_0xe20226[_0x03bd('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x34c52b[_0x03bd('0x2c')],'resourceId':_0x34c52b['id'],'type':_0xe20226[_0x03bd('0x2c')],'sectionId':_0xe20226['id']},{})['then'](function(){return _0x3463a8;});}else{return _0x3463a8;}})[_0x03bd('0x48')](function(_0x37d4f1){logger[_0x03bd('0x2a')](_0x03bd('0x53'),_0x37d4f1);throw _0x37d4f1;});}return _0x3463a8;})[_0x03bd('0x25')](respondWithResult(_0x32e847,0xc9))[_0x03bd('0x48')](handleError(_0x32e847,null));};exports[_0x03bd('0x54')]=function(_0x417721,_0x2b2f7e){var _0x125c89={'where':{'id':_0x417721[_0x03bd('0x4a')]['id']}},_0x8acc31={};_0x8acc31[_0x03bd('0x35')]=_[_0x03bd('0x37')](db['Campaign'][_0x03bd('0x32')]);_0x125c89['attributes']=_[_0x03bd('0x3a')](_0x8acc31[_0x03bd('0x35')],qs[_0x03bd('0x3b')](_0x417721[_0x03bd('0x36')][_0x03bd('0x3b')]));_0x125c89['attributes']=_0x125c89[_0x03bd('0x39')][_0x03bd('0x3c')]?_0x125c89[_0x03bd('0x39')]:_0x8acc31[_0x03bd('0x35')];if(_0x417721['query'][_0x03bd('0x46')]){_0x125c89['include']=[{'all':!![]}];}_0x125c89=_[_0x03bd('0x2f')]({},_0x125c89,_0x417721[_0x03bd('0x4b')]);return db[_0x03bd('0x45')][_0x03bd('0x4c')](_0x125c89)[_0x03bd('0x25')](handleEntityNotFound(_0x2b2f7e,null))['then'](function(_0x4f1cce){if(_0x4f1cce){var _0x21c1e9=_0x4f1cce[_0x03bd('0x26')]({'plain':!![]});_0x21c1e9=qs[_0x03bd('0x55')](_0x21c1e9,['id',_0x03bd('0x56'),_0x03bd('0x57')]);_0x417721['body']=_[_0x03bd('0x55')](_0x417721['body'],['id',_0x03bd('0x56'),_0x03bd('0x57')]);return db[_0x03bd('0x45')][_0x03bd('0x4d')](_['merge'](_0x21c1e9,_0x417721['body']),{'include':_0x417721[_0x03bd('0x36')][_0x03bd('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x48be56){var _0x193e6e=_0x417721[_0x03bd('0x4e')]['get']({'plain':!![]});if(!_0x193e6e)throw new Error(_0x03bd('0x58'));if(_0x193e6e[_0x03bd('0x4f')]==='user'){var _0x1c6a2b=_0x48be56['get']({'plain':!![]});var _0x32f0b7=_0x03bd('0x27');return db[_0x03bd('0x50')][_0x03bd('0x4c')]({'where':{'name':_0x32f0b7,'userProfileId':_0x193e6e[_0x03bd('0x51')]},'raw':!![]})['then'](function(_0x356986){if(_0x356986&&_0x356986[_0x03bd('0x52')]===0x0){return db[_0x03bd('0x28')]['create']({'name':_0x1c6a2b[_0x03bd('0x2c')],'resourceId':_0x1c6a2b['id'],'type':_0x356986[_0x03bd('0x2c')],'sectionId':_0x356986['id']},{})['then'](function(){return _0x48be56;});}else{return _0x48be56;}})['catch'](function(_0xf9dcb4){logger['error'](_0x03bd('0x53'),_0xf9dcb4);throw _0xf9dcb4;});}return _0x48be56;});}})[_0x03bd('0x25')](respondWithResult(_0x2b2f7e,0xc9))[_0x03bd('0x48')](handleError(_0x2b2f7e,null));};exports[_0x03bd('0x24')]=function(_0x10e8b7,_0x47bc3e){if(_0x10e8b7[_0x03bd('0x30')]['id']){delete _0x10e8b7[_0x03bd('0x30')]['id'];}return db[_0x03bd('0x45')]['find']({'where':{'id':_0x10e8b7[_0x03bd('0x4a')]['id']}})[_0x03bd('0x25')](handleEntityNotFound(_0x47bc3e,null))['then'](saveUpdates(_0x10e8b7[_0x03bd('0x30')],null))[_0x03bd('0x25')](respondWithResult(_0x47bc3e,null))[_0x03bd('0x48')](handleError(_0x47bc3e,null));};exports['destroy']=function(_0x2c8159,_0x11d896){return db[_0x03bd('0x45')][_0x03bd('0x4c')]({'where':{'id':_0x2c8159[_0x03bd('0x4a')]['id']}})[_0x03bd('0x25')](handleEntityNotFound(_0x11d896,null))['then'](removeEntity(_0x11d896,null))[_0x03bd('0x48')](handleError(_0x11d896,null));};exports[_0x03bd('0x59')]=function(_0x3a0de3,_0x16eb65,_0x36c539){var _0x8c64bd={'raw':!![],'where':{}};var _0x31d7a5={};var _0x5eaea6={'count':0x0,'rows':[]};return db[_0x03bd('0x45')][_0x03bd('0x5a')]({'where':{'id':_0x3a0de3[_0x03bd('0x4a')]['id']}})[_0x03bd('0x25')](handleEntityNotFound(_0x16eb65,null))[_0x03bd('0x25')](function(_0x2b6c56){if(_0x2b6c56){_0x31d7a5[_0x03bd('0x35')]=_[_0x03bd('0x37')](db[_0x03bd('0x5b')][_0x03bd('0x32')]);_0x31d7a5[_0x03bd('0x36')]=_['keys'](_0x3a0de3[_0x03bd('0x36')]);_0x31d7a5[_0x03bd('0x38')]=_[_0x03bd('0x3a')](_0x31d7a5['model'],_0x31d7a5['query']);_0x8c64bd[_0x03bd('0x39')]=_['intersection'](_0x31d7a5[_0x03bd('0x35')],qs[_0x03bd('0x3b')](_0x3a0de3['query'][_0x03bd('0x3b')]));_0x8c64bd['attributes']=_0x8c64bd[_0x03bd('0x39')]['length']?_0x8c64bd[_0x03bd('0x39')]:_0x31d7a5[_0x03bd('0x35')];if(!_0x3a0de3[_0x03bd('0x36')][_0x03bd('0x5c')](_0x03bd('0x3d'))){_0x8c64bd[_0x03bd('0x1e')]=qs[_0x03bd('0x1e')](_0x3a0de3[_0x03bd('0x36')][_0x03bd('0x1e')]);_0x8c64bd['offset']=qs[_0x03bd('0x1c')](_0x3a0de3[_0x03bd('0x36')]['offset']);}_0x8c64bd['order']=qs[_0x03bd('0x3f')](_0x3a0de3['query'][_0x03bd('0x3f')]);_0x8c64bd[_0x03bd('0x42')]=qs[_0x03bd('0x38')](_[_0x03bd('0x40')](_0x3a0de3['query'],_0x31d7a5[_0x03bd('0x38')]));_0x8c64bd['where'][_0x03bd('0x5d')]=_0x2b6c56['id'];if(_0x3a0de3['query'][_0x03bd('0x41')]){_0x8c64bd[_0x03bd('0x42')]=_[_0x03bd('0x2f')](_0x8c64bd[_0x03bd('0x42')],{'$or':_[_0x03bd('0x43')](_0x8c64bd['attributes'],function(_0x516ec1){var _0x59aca9={};_0x59aca9[_0x516ec1]={'$like':'%'+_0x3a0de3['query'][_0x03bd('0x41')]+'%'};return _0x59aca9;})});}_0x8c64bd=_[_0x03bd('0x2f')]({},_0x8c64bd,_0x3a0de3[_0x03bd('0x4b')]);return db['CmHopper'][_0x03bd('0x1f')]({'where':_0x8c64bd[_0x03bd('0x42')]})['then'](function(_0x3de667){_0x5eaea6['count']=_0x3de667;if(_0x3a0de3[_0x03bd('0x36')]['includeAll']){_0x8c64bd[_0x03bd('0x47')]=[{'all':!![]}];}return db['CmHopper'][_0x03bd('0x5e')](_0x8c64bd);})[_0x03bd('0x25')](function(_0x3997cb){_0x5eaea6[_0x03bd('0x5f')]=_0x3997cb;return _0x5eaea6;});}})[_0x03bd('0x25')](respondWithFilteredResult(_0x16eb65,_0x8c64bd))[_0x03bd('0x48')](handleError(_0x16eb65,null));};exports[_0x03bd('0x60')]=function(_0x1765f3,_0x4b7e7b,_0x3163a7){var _0x25c356={'raw':!![],'where':{}};var _0x147524={};var _0xe90322={'count':0x0,'rows':[]};return db[_0x03bd('0x45')][_0x03bd('0x5a')]({'where':{'id':_0x1765f3[_0x03bd('0x4a')]['id']}})[_0x03bd('0x25')](handleEntityNotFound(_0x4b7e7b,null))[_0x03bd('0x25')](function(_0x14b285){if(_0x14b285){_0x147524[_0x03bd('0x35')]=_[_0x03bd('0x37')](db[_0x03bd('0x61')][_0x03bd('0x32')]);_0x147524['query']=_['keys'](_0x1765f3[_0x03bd('0x36')]);_0x147524['filters']=_[_0x03bd('0x3a')](_0x147524['model'],_0x147524[_0x03bd('0x36')]);_0x25c356[_0x03bd('0x39')]=_[_0x03bd('0x3a')](_0x147524[_0x03bd('0x35')],qs[_0x03bd('0x3b')](_0x1765f3[_0x03bd('0x36')][_0x03bd('0x3b')]));_0x25c356[_0x03bd('0x39')]=_0x25c356[_0x03bd('0x39')][_0x03bd('0x3c')]?_0x25c356['attributes']:_0x147524['model'];if(!_0x1765f3[_0x03bd('0x36')][_0x03bd('0x5c')](_0x03bd('0x3d'))){_0x25c356['limit']=qs[_0x03bd('0x1e')](_0x1765f3['query'][_0x03bd('0x1e')]);_0x25c356[_0x03bd('0x1c')]=qs[_0x03bd('0x1c')](_0x1765f3[_0x03bd('0x36')]['offset']);}_0x25c356[_0x03bd('0x3e')]=qs[_0x03bd('0x3f')](_0x1765f3[_0x03bd('0x36')][_0x03bd('0x3f')]);_0x25c356['where']=qs[_0x03bd('0x38')](_[_0x03bd('0x40')](_0x1765f3['query'],_0x147524['filters']));_0x25c356[_0x03bd('0x42')][_0x03bd('0x5d')]=_0x14b285['id'];if(_0x1765f3[_0x03bd('0x36')][_0x03bd('0x41')]){_0x25c356[_0x03bd('0x42')]=_[_0x03bd('0x2f')](_0x25c356[_0x03bd('0x42')],{'$or':_[_0x03bd('0x43')](_0x25c356[_0x03bd('0x39')],function(_0x518925){var _0x11c726={};_0x11c726[_0x518925]={'$like':'%'+_0x1765f3[_0x03bd('0x36')][_0x03bd('0x41')]+'%'};return _0x11c726;})});}_0x25c356=_[_0x03bd('0x2f')]({},_0x25c356,_0x1765f3[_0x03bd('0x4b')]);return db[_0x03bd('0x61')][_0x03bd('0x1f')]({'where':_0x25c356[_0x03bd('0x42')]})['then'](function(_0x13843b){_0xe90322[_0x03bd('0x1f')]=_0x13843b;if(_0x1765f3[_0x03bd('0x36')]['includeAll']){_0x25c356[_0x03bd('0x47')]=[{'all':!![]}];}return db[_0x03bd('0x61')][_0x03bd('0x5e')](_0x25c356);})[_0x03bd('0x25')](function(_0x2249af){_0xe90322[_0x03bd('0x5f')]=_0x2249af;return _0xe90322;});}})['then'](respondWithFilteredResult(_0x4b7e7b,_0x25c356))[_0x03bd('0x48')](handleError(_0x4b7e7b,null));};exports['getHopperFinals']=function(_0x43fd22,_0xec1c4d,_0x372693){var _0x47201d={'raw':!![],'where':{}};var _0x4ef890={};var _0x175fac={'count':0x0,'rows':[]};return db[_0x03bd('0x45')][_0x03bd('0x5a')]({'where':{'id':_0x43fd22[_0x03bd('0x4a')]['id']}})['then'](handleEntityNotFound(_0xec1c4d,null))['then'](function(_0x5ab5d7){if(_0x5ab5d7){_0x4ef890[_0x03bd('0x35')]=_[_0x03bd('0x37')](db[_0x03bd('0x62')][_0x03bd('0x32')]);_0x4ef890[_0x03bd('0x36')]=_[_0x03bd('0x37')](_0x43fd22['query']);_0x4ef890[_0x03bd('0x38')]=_[_0x03bd('0x3a')](_0x4ef890[_0x03bd('0x35')],_0x4ef890[_0x03bd('0x36')]);_0x47201d[_0x03bd('0x39')]=_['intersection'](_0x4ef890[_0x03bd('0x35')],qs[_0x03bd('0x3b')](_0x43fd22[_0x03bd('0x36')][_0x03bd('0x3b')]));_0x47201d['attributes']=_0x47201d['attributes'][_0x03bd('0x3c')]?_0x47201d[_0x03bd('0x39')]:_0x4ef890['model'];if(!_0x43fd22[_0x03bd('0x36')]['hasOwnProperty'](_0x03bd('0x3d'))){_0x47201d[_0x03bd('0x1e')]=qs[_0x03bd('0x1e')](_0x43fd22['query'][_0x03bd('0x1e')]);_0x47201d[_0x03bd('0x1c')]=qs[_0x03bd('0x1c')](_0x43fd22[_0x03bd('0x36')][_0x03bd('0x1c')]);}_0x47201d[_0x03bd('0x3e')]=qs[_0x03bd('0x3f')](_0x43fd22[_0x03bd('0x36')][_0x03bd('0x3f')]);_0x47201d[_0x03bd('0x42')]=qs[_0x03bd('0x38')](_[_0x03bd('0x40')](_0x43fd22['query'],_0x4ef890[_0x03bd('0x38')]));_0x47201d['where'][_0x03bd('0x5d')]=_0x5ab5d7['id'];if(_0x43fd22[_0x03bd('0x36')][_0x03bd('0x41')]){_0x47201d['where']=_[_0x03bd('0x2f')](_0x47201d[_0x03bd('0x42')],{'$or':_[_0x03bd('0x43')](_0x47201d[_0x03bd('0x39')],function(_0xb800b1){var _0x22f9e6={};_0x22f9e6[_0xb800b1]={'$like':'%'+_0x43fd22['query'][_0x03bd('0x41')]+'%'};return _0x22f9e6;})});}_0x47201d=_[_0x03bd('0x2f')]({},_0x47201d,_0x43fd22['options']);return db[_0x03bd('0x62')][_0x03bd('0x1f')]({'where':_0x47201d[_0x03bd('0x42')]})[_0x03bd('0x25')](function(_0x26786c){_0x175fac[_0x03bd('0x1f')]=_0x26786c;if(_0x43fd22[_0x03bd('0x36')]['includeAll']){_0x47201d[_0x03bd('0x47')]=[{'all':!![]}];}return db[_0x03bd('0x62')][_0x03bd('0x5e')](_0x47201d);})[_0x03bd('0x25')](function(_0x14b103){_0x175fac['rows']=_0x14b103;return _0x175fac;});}})[_0x03bd('0x25')](respondWithFilteredResult(_0xec1c4d,_0x47201d))[_0x03bd('0x48')](handleError(_0xec1c4d,null));};exports[_0x03bd('0x63')]=function(_0x52cb2c,_0x4dc23a,_0x2c55bb){var _0x356f2a={'raw':!![],'where':{}};var _0x89c70b={};var _0x3f64dd={'count':0x0,'rows':[]};return db['Campaign'][_0x03bd('0x5a')]({'where':{'id':_0x52cb2c['params']['id']}})[_0x03bd('0x25')](handleEntityNotFound(_0x4dc23a,null))[_0x03bd('0x25')](function(_0x17cf11){if(_0x17cf11){_0x89c70b['model']=_['keys'](db['CmHopperBlack'][_0x03bd('0x32')]);_0x89c70b[_0x03bd('0x36')]=_['keys'](_0x52cb2c[_0x03bd('0x36')]);_0x89c70b[_0x03bd('0x38')]=_['intersection'](_0x89c70b[_0x03bd('0x35')],_0x89c70b[_0x03bd('0x36')]);_0x356f2a[_0x03bd('0x39')]=_[_0x03bd('0x3a')](_0x89c70b[_0x03bd('0x35')],qs[_0x03bd('0x3b')](_0x52cb2c[_0x03bd('0x36')]['fields']));_0x356f2a[_0x03bd('0x39')]=_0x356f2a[_0x03bd('0x39')][_0x03bd('0x3c')]?_0x356f2a[_0x03bd('0x39')]:_0x89c70b[_0x03bd('0x35')];if(!_0x52cb2c[_0x03bd('0x36')][_0x03bd('0x5c')](_0x03bd('0x3d'))){_0x356f2a[_0x03bd('0x1e')]=qs['limit'](_0x52cb2c[_0x03bd('0x36')][_0x03bd('0x1e')]);_0x356f2a[_0x03bd('0x1c')]=qs['offset'](_0x52cb2c[_0x03bd('0x36')]['offset']);}_0x356f2a[_0x03bd('0x3e')]=qs[_0x03bd('0x3f')](_0x52cb2c[_0x03bd('0x36')]['sort']);_0x356f2a[_0x03bd('0x42')]=qs[_0x03bd('0x38')](_[_0x03bd('0x40')](_0x52cb2c['query'],_0x89c70b['filters']));_0x356f2a['where'][_0x03bd('0x5d')]=_0x17cf11['id'];if(_0x52cb2c[_0x03bd('0x36')][_0x03bd('0x41')]){_0x356f2a['where']=_[_0x03bd('0x2f')](_0x356f2a[_0x03bd('0x42')],{'$or':_['map'](_0x356f2a[_0x03bd('0x39')],function(_0x290e7c){var _0x50bd27={};_0x50bd27[_0x290e7c]={'$like':'%'+_0x52cb2c['query'][_0x03bd('0x41')]+'%'};return _0x50bd27;})});}_0x356f2a=_[_0x03bd('0x2f')]({},_0x356f2a,_0x52cb2c[_0x03bd('0x4b')]);return db[_0x03bd('0x64')][_0x03bd('0x1f')]({'where':_0x356f2a[_0x03bd('0x42')]})[_0x03bd('0x25')](function(_0x42ac1c){_0x3f64dd[_0x03bd('0x1f')]=_0x42ac1c;if(_0x52cb2c[_0x03bd('0x36')][_0x03bd('0x46')]){_0x356f2a[_0x03bd('0x47')]=[{'all':!![]}];}return db[_0x03bd('0x64')][_0x03bd('0x5e')](_0x356f2a);})['then'](function(_0x10129c){_0x3f64dd[_0x03bd('0x5f')]=_0x10129c;return _0x3f64dd;});}})[_0x03bd('0x25')](respondWithFilteredResult(_0x4dc23a,_0x356f2a))[_0x03bd('0x48')](handleError(_0x4dc23a,null));};exports[_0x03bd('0x65')]=function(_0x30f48e,_0x24a018,_0x42f78b){var _0x24232f={};var _0x317e92={};var _0x74308a;var _0x95dbb8;return db[_0x03bd('0x45')][_0x03bd('0x5a')]({'where':{'id':_0x30f48e[_0x03bd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24a018,null))[_0x03bd('0x25')](function(_0x43f275){if(_0x43f275){_0x74308a=_0x43f275;_0x317e92[_0x03bd('0x35')]=_['keys'](db[_0x03bd('0x66')][_0x03bd('0x32')]);_0x317e92['query']=_[_0x03bd('0x37')](_0x30f48e[_0x03bd('0x36')]);_0x317e92[_0x03bd('0x38')]=_[_0x03bd('0x3a')](_0x317e92[_0x03bd('0x35')],_0x317e92[_0x03bd('0x36')]);_0x24232f[_0x03bd('0x39')]=_[_0x03bd('0x3a')](_0x317e92[_0x03bd('0x35')],qs[_0x03bd('0x3b')](_0x30f48e[_0x03bd('0x36')]['fields']));_0x24232f[_0x03bd('0x39')]=_0x24232f[_0x03bd('0x39')][_0x03bd('0x3c')]?_0x24232f[_0x03bd('0x39')]:_0x317e92[_0x03bd('0x35')];_0x24232f[_0x03bd('0x3e')]=qs[_0x03bd('0x3f')](_0x30f48e['query'][_0x03bd('0x3f')]);_0x24232f[_0x03bd('0x42')]=qs[_0x03bd('0x38')](_[_0x03bd('0x40')](_0x30f48e[_0x03bd('0x36')],_0x317e92[_0x03bd('0x38')]));if(_0x30f48e['query'][_0x03bd('0x41')]){_0x24232f[_0x03bd('0x42')]=_[_0x03bd('0x2f')](_0x24232f['where'],{'$or':_[_0x03bd('0x43')](_0x24232f['attributes'],function(_0x23fb28){var _0x152c3c={};_0x152c3c[_0x23fb28]={'$like':'%'+_0x30f48e[_0x03bd('0x36')][_0x03bd('0x41')]+'%'};return _0x152c3c;})});}_0x24232f=_[_0x03bd('0x2f')]({},_0x24232f,_0x30f48e[_0x03bd('0x4b')]);return _0x74308a[_0x03bd('0x65')](_0x24232f);}})[_0x03bd('0x25')](function(_0x5d37e8){if(_0x5d37e8){_0x95dbb8=_0x5d37e8[_0x03bd('0x3c')];if(!_0x30f48e[_0x03bd('0x36')][_0x03bd('0x5c')](_0x03bd('0x3d'))){_0x24232f['limit']=qs[_0x03bd('0x1e')](_0x30f48e[_0x03bd('0x36')][_0x03bd('0x1e')]);_0x24232f[_0x03bd('0x1c')]=qs[_0x03bd('0x1c')](_0x30f48e[_0x03bd('0x36')]['offset']);}return _0x74308a[_0x03bd('0x65')](_0x24232f);}})[_0x03bd('0x25')](function(_0x5f7e61){if(_0x5f7e61){return _0x5f7e61?{'count':_0x95dbb8,'rows':_0x5f7e61}:null;}})[_0x03bd('0x25')](respondWithResult(_0x24a018,null))[_0x03bd('0x48')](handleError(_0x24a018,null));};exports[_0x03bd('0x67')]=function(_0x463a80,_0x9c918,_0x2967b0){var _0x15a221,_0x25adc7;return db['Campaign']['find']({'where':{'id':_0x463a80['params']['id']}})[_0x03bd('0x25')](handleEntityNotFound(_0x9c918,null))['then'](function(_0x5cf4da){if(_0x5cf4da){_0x25adc7=_0x5cf4da;return _0x5cf4da[_0x03bd('0x67')](_0x463a80[_0x03bd('0x30')]['ids'],_[_0x03bd('0x55')](_0x463a80[_0x03bd('0x30')],['ids','id'])||{});}return null;})['spread'](function(_0x5d8347){var _0xbceb3c;_0x15a221=_0x5d8347||[];var _0x53c250=[];if(_0x5d8347){for(var _0x12683=0x0;_0x12683<_0x5d8347['length'];_0x12683+=0x1){var _0x31e4bd=_0x5d8347[_0x12683][_0x03bd('0x26')]({'plain':!![]});_0x25adc7[_0x03bd('0x68')]=_0x463a80[_0x03bd('0x30')][_0x03bd('0x68')]?_0x463a80[_0x03bd('0x30')][_0x03bd('0x68')]:_0x25adc7['dialCheckDuplicateType'];switch(_0x25adc7[_0x03bd('0x68')]){case'always':_0xbceb3c=squel[_0x03bd('0x69')]()['into'](_0x03bd('0x6a'))[_0x03bd('0x6b')]([_0x03bd('0x6c'),_0x03bd('0x6d'),'ContactId',_0x03bd('0x6e'),_0x03bd('0x5d'),_0x03bd('0x56'),_0x03bd('0x57')],squel['select']()[_0x03bd('0x6f')](_0x03bd('0x6c'),_0x03bd('0x6c'))[_0x03bd('0x6f')](_0x03bd('0x70'),_0x03bd('0x6d'))[_0x03bd('0x6f')]('id',_0x03bd('0x71'))[_0x03bd('0x6f')](_0x31e4bd['CmListId'][_0x03bd('0x72')](),_0x03bd('0x6e'))[_0x03bd('0x6f')](_0x463a80[_0x03bd('0x4a')]['id'][_0x03bd('0x72')](),'CampaignId')[_0x03bd('0x6f')](_0x03bd('0x70'),'createdAt')[_0x03bd('0x6f')](_0x03bd('0x70'),_0x03bd('0x57'))['from'](_0x03bd('0x73'))[_0x03bd('0x42')](_0x03bd('0x74'))[_0x03bd('0x42')](_0x03bd('0x75'),_0x31e4bd[_0x03bd('0x76')][_0x03bd('0x72')]())[_0x03bd('0x42')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x03bd('0x77'),squel[_0x03bd('0x78')]()[_0x03bd('0x6f')](_0x03bd('0x79'))[_0x03bd('0x7a')]('cm_hopper_final')[_0x03bd('0x42')](_0x03bd('0x7b'),_0x463a80[_0x03bd('0x4a')]['id']['toString']()))[_0x03bd('0x42')](_0x03bd('0x77'),squel['select']()[_0x03bd('0x6f')](_0x03bd('0x7c'))[_0x03bd('0x7a')]('cm_hopper')['where'](_0x03bd('0x7b'),_0x463a80[_0x03bd('0x4a')]['id'][_0x03bd('0x72')]())))[_0x03bd('0x72')]();break;case _0x03bd('0x7d'):_0xbceb3c=squel[_0x03bd('0x69')]()[_0x03bd('0x7e')](_0x03bd('0x6a'))[_0x03bd('0x6b')](['phone',_0x03bd('0x6d'),_0x03bd('0x71'),'ListId','CampaignId',_0x03bd('0x56'),_0x03bd('0x57')],squel[_0x03bd('0x78')]()[_0x03bd('0x6f')]('phone','phone')[_0x03bd('0x6f')]('NOW()',_0x03bd('0x6d'))[_0x03bd('0x6f')]('id',_0x03bd('0x71'))[_0x03bd('0x6f')](_0x31e4bd[_0x03bd('0x76')][_0x03bd('0x72')](),'ListId')['field'](_0x463a80[_0x03bd('0x4a')]['id'][_0x03bd('0x72')](),'CampaignId')['field'](_0x03bd('0x70'),_0x03bd('0x56'))[_0x03bd('0x6f')](_0x03bd('0x70'),'updatedAt')[_0x03bd('0x7a')](_0x03bd('0x73'))['where'](_0x03bd('0x74'))[_0x03bd('0x42')]('ListId\x20=\x20?',_0x31e4bd[_0x03bd('0x76')][_0x03bd('0x72')]())[_0x03bd('0x42')](_0x03bd('0x7f'))['where'](_0x03bd('0x77'),squel[_0x03bd('0x78')]()['field'](_0x03bd('0x7c'))[_0x03bd('0x7a')](_0x03bd('0x6a'))[_0x03bd('0x42')](_0x03bd('0x7b'),_0x463a80['params']['id']['toString']())))[_0x03bd('0x72')]();break;default:_0xbceb3c=squel[_0x03bd('0x69')]()[_0x03bd('0x7e')]('cm_hopper')[_0x03bd('0x6b')]([_0x03bd('0x6c'),'scheduledAt',_0x03bd('0x71'),'ListId','CampaignId',_0x03bd('0x56'),_0x03bd('0x57')],squel[_0x03bd('0x78')]()[_0x03bd('0x6f')](_0x03bd('0x6c'),_0x03bd('0x6c'))[_0x03bd('0x6f')](_0x03bd('0x70'),_0x03bd('0x6d'))[_0x03bd('0x6f')]('id',_0x03bd('0x71'))['field'](_0x31e4bd['CmListId'][_0x03bd('0x72')](),_0x03bd('0x6e'))[_0x03bd('0x6f')](_0x463a80[_0x03bd('0x4a')]['id'][_0x03bd('0x72')](),_0x03bd('0x5d'))['field'](_0x03bd('0x70'),_0x03bd('0x56'))[_0x03bd('0x6f')](_0x03bd('0x70'),'updatedAt')[_0x03bd('0x7a')](_0x03bd('0x73'))[_0x03bd('0x42')]('deletedAt\x20IS\x20NULL')[_0x03bd('0x42')](_0x03bd('0x75'),_0x31e4bd['CmListId']['toString']())['where'](_0x03bd('0x7f')))[_0x03bd('0x72')]();}_0x53c250[_0x03bd('0x80')](db[_0x03bd('0x81')]['query'](_0xbceb3c));}return BPromise[_0x03bd('0x82')](_0x53c250);}})[_0x03bd('0x25')](function(){return _0x15a221;})[_0x03bd('0x25')](respondWithResult(_0x9c918,null))[_0x03bd('0x48')](handleError(_0x9c918,null));};exports[_0x03bd('0x83')]=function(_0x4b6c98,_0x6ac325,_0x506717){return db[_0x03bd('0x45')][_0x03bd('0x4c')]({'where':{'id':_0x4b6c98[_0x03bd('0x4a')]['id']}})[_0x03bd('0x25')](handleEntityNotFound(_0x6ac325,null))[_0x03bd('0x25')](function(_0x5f3edb){if(_0x5f3edb){return _0x5f3edb[_0x03bd('0x83')](_0x4b6c98[_0x03bd('0x36')][_0x03bd('0x84')]);}})[_0x03bd('0x25')](function(_0x14180b){if(_0x14180b){return db['CmHopper'][_0x03bd('0x29')]({'where':{'ListId':_0x4b6c98[_0x03bd('0x36')][_0x03bd('0x84')],'CampaignId':_0x4b6c98[_0x03bd('0x4a')]['id']}})[_0x03bd('0x25')](function(){return _0x14180b;});}})['then'](respondWithStatusCode(_0x6ac325,null))[_0x03bd('0x48')](handleError(_0x6ac325,null));};exports[_0x03bd('0x85')]=function(_0x3f3e34,_0x1d9026,_0x230a0e){var _0x35258d={};var _0x43a2ad={};var _0x15c3b5;var _0xd3de42;return db[_0x03bd('0x45')][_0x03bd('0x5a')]({'where':{'id':_0x3f3e34[_0x03bd('0x4a')]['id']}})[_0x03bd('0x25')](handleEntityNotFound(_0x1d9026,null))[_0x03bd('0x25')](function(_0x4684ed){if(_0x4684ed){_0x15c3b5=_0x4684ed;_0x43a2ad[_0x03bd('0x35')]=_[_0x03bd('0x37')](db[_0x03bd('0x66')]['rawAttributes']);_0x43a2ad[_0x03bd('0x36')]=_['keys'](_0x3f3e34[_0x03bd('0x36')]);_0x43a2ad[_0x03bd('0x38')]=_[_0x03bd('0x3a')](_0x43a2ad[_0x03bd('0x35')],_0x43a2ad[_0x03bd('0x36')]);_0x35258d[_0x03bd('0x39')]=_[_0x03bd('0x3a')](_0x43a2ad[_0x03bd('0x35')],qs[_0x03bd('0x3b')](_0x3f3e34[_0x03bd('0x36')]['fields']));_0x35258d[_0x03bd('0x39')]=_0x35258d[_0x03bd('0x39')][_0x03bd('0x3c')]?_0x35258d[_0x03bd('0x39')]:_0x43a2ad[_0x03bd('0x35')];_0x35258d[_0x03bd('0x3e')]=qs[_0x03bd('0x3f')](_0x3f3e34[_0x03bd('0x36')]['sort']);_0x35258d[_0x03bd('0x42')]=qs[_0x03bd('0x38')](_[_0x03bd('0x40')](_0x3f3e34[_0x03bd('0x36')],_0x43a2ad[_0x03bd('0x38')]));if(_0x3f3e34[_0x03bd('0x36')]['filter']){_0x35258d['where']=_[_0x03bd('0x2f')](_0x35258d['where'],{'$or':_['map'](_0x35258d[_0x03bd('0x39')],function(_0x720d68){var _0x3f8705={};_0x3f8705[_0x720d68]={'$like':'%'+_0x3f3e34['query'][_0x03bd('0x41')]+'%'};return _0x3f8705;})});}_0x35258d=_[_0x03bd('0x2f')]({},_0x35258d,_0x3f3e34[_0x03bd('0x4b')]);return _0x15c3b5[_0x03bd('0x85')](_0x35258d);}})['then'](function(_0x4f3e82){if(_0x4f3e82){_0xd3de42=_0x4f3e82['length'];if(!_0x3f3e34[_0x03bd('0x36')][_0x03bd('0x5c')](_0x03bd('0x3d'))){_0x35258d[_0x03bd('0x1e')]=qs[_0x03bd('0x1e')](_0x3f3e34['query'][_0x03bd('0x1e')]);_0x35258d[_0x03bd('0x1c')]=qs[_0x03bd('0x1c')](_0x3f3e34[_0x03bd('0x36')][_0x03bd('0x1c')]);}return _0x15c3b5[_0x03bd('0x85')](_0x35258d);}})[_0x03bd('0x25')](function(_0x14a48f){if(_0x14a48f){return _0x14a48f?{'count':_0xd3de42,'rows':_0x14a48f}:null;}})['then'](respondWithResult(_0x1d9026,null))['catch'](handleError(_0x1d9026,null));};exports[_0x03bd('0x86')]=function(_0x246db6,_0x3c3c02,_0x510584){var _0x280aaf,_0x36872a;return db[_0x03bd('0x45')][_0x03bd('0x4c')]({'where':{'id':_0x246db6[_0x03bd('0x4a')]['id']}})[_0x03bd('0x25')](handleEntityNotFound(_0x3c3c02,null))[_0x03bd('0x25')](function(_0x54abc8){if(_0x54abc8){_0x36872a=_0x54abc8;return _0x54abc8[_0x03bd('0x86')](_0x246db6[_0x03bd('0x30')][_0x03bd('0x84')],_[_0x03bd('0x55')](_0x246db6[_0x03bd('0x30')],[_0x03bd('0x84'),'id'])||{});}return null;})['spread'](function(_0x4748c2){var _0x5b7cf2;_0x280aaf=_0x4748c2||[];var _0x359eec=[];if(_0x4748c2){for(var _0x54defa=0x0;_0x54defa<_0x4748c2['length'];_0x54defa+=0x1){var _0xcb3ca1=_0x4748c2[_0x54defa][_0x03bd('0x26')]({'plain':!![]});_0x5b7cf2=squel[_0x03bd('0x69')]()[_0x03bd('0x7e')]('cm_hopper_black')[_0x03bd('0x6b')]([_0x03bd('0x6c'),'ContactId',_0x03bd('0x6e'),_0x03bd('0x5d'),_0x03bd('0x56'),_0x03bd('0x57')],squel[_0x03bd('0x78')]()[_0x03bd('0x6f')]('phone',_0x03bd('0x6c'))[_0x03bd('0x6f')]('id','ContactId')[_0x03bd('0x6f')](_0xcb3ca1[_0x03bd('0x76')][_0x03bd('0x72')](),_0x03bd('0x6e'))[_0x03bd('0x6f')](_0x246db6['params']['id'][_0x03bd('0x72')](),'CampaignId')[_0x03bd('0x6f')](_0x03bd('0x70'),_0x03bd('0x56'))[_0x03bd('0x6f')](_0x03bd('0x70'),_0x03bd('0x57'))[_0x03bd('0x7a')]('cm_contacts')['where'](_0x03bd('0x74'))[_0x03bd('0x42')](_0x03bd('0x75'),_0xcb3ca1['CmListId'][_0x03bd('0x72')]())[_0x03bd('0x42')](_0x03bd('0x7f')))[_0x03bd('0x72')]();_0x359eec['push'](db[_0x03bd('0x81')]['query'](_0x5b7cf2));}return BPromise['all'](_0x359eec);}})['then'](function(){return _0x280aaf;})[_0x03bd('0x25')](respondWithResult(_0x3c3c02,null))[_0x03bd('0x48')](handleError(_0x3c3c02,null));};exports[_0x03bd('0x87')]=function(_0x555e7d,_0x1b466c,_0x42fca7){return db['Campaign'][_0x03bd('0x4c')]({'where':{'id':_0x555e7d[_0x03bd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b466c,null))['then'](function(_0x4ff497){if(_0x4ff497){return _0x4ff497['removeBlackLists'](_0x555e7d['query']['ids']);}})[_0x03bd('0x25')](function(_0xb6efd7){if(_0xb6efd7){return db[_0x03bd('0x64')]['destroy']({'where':{'ListId':_0x555e7d[_0x03bd('0x36')][_0x03bd('0x84')],'CampaignId':_0x555e7d['params']['id']}})['then'](function(){return _0xb6efd7;});}})[_0x03bd('0x25')](respondWithStatusCode(_0x1b466c,null))['catch'](handleError(_0x1b466c,null));}; \ No newline at end of file +var _0xc21d=['includeAll','include','findAll','rows','catch','params','create','user','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','getHoppers','findOne','CmHopper','order','CampaignId','getHopperHistories','filter','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','select','field','NOW()','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','sequelize','all','removeLists','getBlackLists','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','count','limit','set','json','reject','save','destroy','then','get','IvrCampaigns','error','stack','name','render','merge','body','contact','message','interaction','map','Campaign','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','options'];(function(_0x267095,_0xd6b820){var _0x2c31be=function(_0xed99a8){while(--_0xed99a8){_0x267095['push'](_0x267095['shift']());}};_0x2c31be(++_0xd6b820);}(_0xc21d,0x150));var _0xdc21=function(_0x758122,_0x3c9b42){_0x758122=_0x758122-0x0;var _0x3ff10b=_0xc21d[_0x758122];return _0x3ff10b;};'use strict';var emlformat=require(_0xdc21('0x0'));var rimraf=require(_0xdc21('0x1'));var zipdir=require(_0xdc21('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc21('0x3'));var moment=require('moment');var BPromise=require(_0xdc21('0x4'));var Mustache=require(_0xdc21('0x5'));var util=require(_0xdc21('0x6'));var path=require(_0xdc21('0x7'));var sox=require('sox');var csv=require(_0xdc21('0x8'));var ejs=require(_0xdc21('0x9'));var fs=require('fs');var fs_extra=require(_0xdc21('0xa'));var _=require(_0xdc21('0xb'));var squel=require(_0xdc21('0xc'));var crypto=require('crypto');var jsforce=require(_0xdc21('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc21('0xe'));var Papa=require(_0xdc21('0xf'));var Redis=require(_0xdc21('0x10'));var authService=require(_0xdc21('0x11'));var qs=require(_0xdc21('0x12'));var as=require(_0xdc21('0x13'));var hardwareService=require(_0xdc21('0x14'));var logger=require(_0xdc21('0x15'))(_0xdc21('0x16'));var utils=require(_0xdc21('0x17'));var config=require(_0xdc21('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a1ad8,_0x1e80c3){_0x1e80c3=_0x1e80c3||0xcc;return function(_0x2eb0c0){if(_0x2eb0c0){return _0x1a1ad8[_0xdc21('0x19')](_0x1e80c3);}return _0x1a1ad8['status'](_0x1e80c3)[_0xdc21('0x1a')]();};}function respondWithResult(_0x44558f,_0x2398c1){_0x2398c1=_0x2398c1||0xc8;return function(_0x3b9688){if(_0x3b9688){return _0x44558f[_0xdc21('0x1b')](_0x2398c1)['json'](_0x3b9688);}};}function respondWithFilteredResult(_0x60ac07,_0x356dbe){return function(_0x44aa27){if(_0x44aa27){var _0x258ff4=typeof _0x356dbe[_0xdc21('0x1c')]===_0xdc21('0x1d')&&typeof _0x356dbe['limit']===_0xdc21('0x1d');var _0x46a019=_0x44aa27['count'];var _0x2878f0=_0x258ff4?0x0:_0x356dbe[_0xdc21('0x1c')];var _0x410c1c=_0x258ff4?_0x44aa27[_0xdc21('0x1e')]:_0x356dbe[_0xdc21('0x1c')]+_0x356dbe[_0xdc21('0x1f')];var _0x3ce518;if(_0x410c1c>=_0x46a019){_0x410c1c=_0x46a019;_0x3ce518=0xc8;}else{_0x3ce518=0xce;}_0x60ac07[_0xdc21('0x1b')](_0x3ce518);return _0x60ac07[_0xdc21('0x20')]('Content-Range',_0x2878f0+'-'+_0x410c1c+'/'+_0x46a019)[_0xdc21('0x21')](_0x44aa27);}return null;};}function patchUpdates(_0x356a5d){return function(_0x516b40){try{jsonpatch['apply'](_0x516b40,_0x356a5d,!![]);}catch(_0x2ac4c2){return BPromise[_0xdc21('0x22')](_0x2ac4c2);}return _0x516b40[_0xdc21('0x23')]();};}function saveUpdates(_0x495c40,_0x340e12){return function(_0x44a332){if(_0x44a332){return _0x44a332['update'](_0x495c40)['then'](function(_0x479cd5){return _0x479cd5;});}return null;};}function removeEntity(_0x1b2008,_0x5ba90a){return function(_0xb02e13){if(_0xb02e13){return _0xb02e13[_0xdc21('0x24')]()[_0xdc21('0x25')](function(){var _0x3b431c=_0xb02e13[_0xdc21('0x26')]({'plain':!![]});var _0x10dac2=_0xdc21('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x10dac2,'resourceId':_0x3b431c['id']}})[_0xdc21('0x25')](function(){return _0xb02e13;});})['then'](function(){_0x1b2008[_0xdc21('0x1b')](0xcc)[_0xdc21('0x1a')]();});}};}function handleEntityNotFound(_0x2a1e36,_0x2389c9){return function(_0x25a774){if(!_0x25a774){_0x2a1e36[_0xdc21('0x19')](0x194);}return _0x25a774;};}function handleError(_0x59e24f,_0x10ba4a){_0x10ba4a=_0x10ba4a||0x1f4;return function(_0x573561){logger[_0xdc21('0x28')](_0x573561[_0xdc21('0x29')]);if(_0x573561[_0xdc21('0x2a')]){delete _0x573561['name'];}_0x59e24f[_0xdc21('0x1b')](_0x10ba4a)['send'](_0x573561);};}function getMustacheRender(_0x5380bd,_0xb350c0){return Mustache[_0xdc21('0x2b')](_0x5380bd,_[_0xdc21('0x2c')](_0xb350c0[_0xdc21('0x2d')],{'contact':_0xb350c0[_0xdc21('0x2e')],'message':_0xb350c0[_0xdc21('0x2f')],'agent':_0xb350c0['agent'],'interaction':_0xb350c0[_0xdc21('0x30')],'account':_0xb350c0['account']}))||'';}exports['index']=function(_0xc335c9,_0x2786b0){var _0x4c7f6b={},_0x5c4e91={},_0x2fa16e={'count':0x0,'rows':[]};var _0x318331=_[_0xdc21('0x31')](db[_0xdc21('0x32')][_0xdc21('0x33')],function(_0x3420d9){return{'name':_0x3420d9[_0xdc21('0x34')],'type':_0x3420d9[_0xdc21('0x35')][_0xdc21('0x36')]};});_0x5c4e91['model']=_[_0xdc21('0x31')](_0x318331,'name');_0x5c4e91['query']=_[_0xdc21('0x37')](_0xc335c9['query']);_0x5c4e91[_0xdc21('0x38')]=_['intersection'](_0x5c4e91[_0xdc21('0x39')],_0x5c4e91[_0xdc21('0x3a')]);_0x4c7f6b[_0xdc21('0x3b')]=_[_0xdc21('0x3c')](_0x5c4e91[_0xdc21('0x39')],qs[_0xdc21('0x3d')](_0xc335c9[_0xdc21('0x3a')][_0xdc21('0x3d')]));_0x4c7f6b[_0xdc21('0x3b')]=_0x4c7f6b[_0xdc21('0x3b')][_0xdc21('0x3e')]?_0x4c7f6b[_0xdc21('0x3b')]:_0x5c4e91[_0xdc21('0x39')];if(!_0xc335c9[_0xdc21('0x3a')][_0xdc21('0x3f')](_0xdc21('0x40'))){_0x4c7f6b['limit']=qs['limit'](_0xc335c9[_0xdc21('0x3a')]['limit']);_0x4c7f6b[_0xdc21('0x1c')]=qs['offset'](_0xc335c9[_0xdc21('0x3a')]['offset']);}_0x4c7f6b['order']=qs['sort'](_0xc335c9[_0xdc21('0x3a')][_0xdc21('0x41')]);_0x4c7f6b[_0xdc21('0x42')]=qs['filters'](_[_0xdc21('0x43')](_0xc335c9[_0xdc21('0x3a')],_0x5c4e91[_0xdc21('0x38')]),_0x318331);if(_0xc335c9['query']['filter']){_0x4c7f6b[_0xdc21('0x42')]=_[_0xdc21('0x2c')](_0x4c7f6b[_0xdc21('0x42')],{'$or':_[_0xdc21('0x31')](_0x318331,function(_0x18bb02){if(_0x18bb02[_0xdc21('0x35')]!=='VIRTUAL'){var _0x599f03={};_0x599f03[_0x18bb02[_0xdc21('0x2a')]]={'$like':'%'+_0xc335c9[_0xdc21('0x3a')]['filter']+'%'};return _0x599f03;}})});}_0x4c7f6b=_[_0xdc21('0x2c')]({},_0x4c7f6b,_0xc335c9[_0xdc21('0x44')]);var _0x2ec1cc={'where':_0x4c7f6b['where']};return db[_0xdc21('0x32')][_0xdc21('0x1e')](_0x2ec1cc)[_0xdc21('0x25')](function(_0x28db6f){_0x2fa16e[_0xdc21('0x1e')]=_0x28db6f;if(_0xc335c9[_0xdc21('0x3a')][_0xdc21('0x45')]){_0x4c7f6b[_0xdc21('0x46')]=[{'all':!![]}];}return db[_0xdc21('0x32')][_0xdc21('0x47')](_0x4c7f6b);})['then'](function(_0x43edc2){_0x2fa16e[_0xdc21('0x48')]=_0x43edc2;return _0x2fa16e;})[_0xdc21('0x25')](respondWithFilteredResult(_0x2786b0,_0x4c7f6b))[_0xdc21('0x49')](handleError(_0x2786b0,null));};exports['show']=function(_0x34142a,_0x32b5e2){var _0x33b010={'raw':![],'where':{'id':_0x34142a[_0xdc21('0x4a')]['id']}},_0x50b7b0={};_0x50b7b0[_0xdc21('0x39')]=_[_0xdc21('0x37')](db[_0xdc21('0x32')][_0xdc21('0x33')]);_0x50b7b0[_0xdc21('0x3a')]=_[_0xdc21('0x37')](_0x34142a[_0xdc21('0x3a')]);_0x50b7b0[_0xdc21('0x38')]=_[_0xdc21('0x3c')](_0x50b7b0['model'],_0x50b7b0[_0xdc21('0x3a')]);_0x33b010['attributes']=_[_0xdc21('0x3c')](_0x50b7b0[_0xdc21('0x39')],qs[_0xdc21('0x3d')](_0x34142a[_0xdc21('0x3a')]['fields']));_0x33b010[_0xdc21('0x3b')]=_0x33b010['attributes'][_0xdc21('0x3e')]?_0x33b010['attributes']:_0x50b7b0[_0xdc21('0x39')];if(_0x34142a[_0xdc21('0x3a')][_0xdc21('0x45')]){_0x33b010[_0xdc21('0x46')]=[{'all':!![]}];}_0x33b010=_['merge']({},_0x33b010,_0x34142a[_0xdc21('0x44')]);return db[_0xdc21('0x32')]['find'](_0x33b010)[_0xdc21('0x25')](handleEntityNotFound(_0x32b5e2,null))[_0xdc21('0x25')](respondWithResult(_0x32b5e2,null))[_0xdc21('0x49')](handleError(_0x32b5e2,null));};exports[_0xdc21('0x4b')]=function(_0x3ec423,_0x4fef74){return db[_0xdc21('0x32')][_0xdc21('0x4b')](_0x3ec423[_0xdc21('0x2d')],{})[_0xdc21('0x25')](function(_0x4a76a1){var _0x3776cf=_0x3ec423[_0xdc21('0x4c')][_0xdc21('0x26')]({'plain':!![]});if(!_0x3776cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3776cf['role']==='user'){var _0x35d97c=_0x4a76a1[_0xdc21('0x26')]({'plain':!![]});var _0x1b6f1b=_0xdc21('0x27');return db['UserProfileSection'][_0xdc21('0x4d')]({'where':{'name':_0x1b6f1b,'userProfileId':_0x3776cf[_0xdc21('0x4e')]},'raw':!![]})[_0xdc21('0x25')](function(_0x23ddb2){if(_0x23ddb2&&_0x23ddb2['autoAssociation']===0x0){return db[_0xdc21('0x4f')][_0xdc21('0x4b')]({'name':_0x35d97c[_0xdc21('0x2a')],'resourceId':_0x35d97c['id'],'type':_0x23ddb2['name'],'sectionId':_0x23ddb2['id']},{})['then'](function(){return _0x4a76a1;});}else{return _0x4a76a1;}})['catch'](function(_0x88ace){logger[_0xdc21('0x28')](_0xdc21('0x50'),_0x88ace);throw _0x88ace;});}return _0x4a76a1;})[_0xdc21('0x25')](respondWithResult(_0x4fef74,0xc9))[_0xdc21('0x49')](handleError(_0x4fef74,null));};exports['clone']=function(_0x475ac6,_0x284e6b){var _0x2ceffa={'where':{'id':_0x475ac6[_0xdc21('0x4a')]['id']}},_0x2d0fcb={};_0x2d0fcb[_0xdc21('0x39')]=_[_0xdc21('0x37')](db[_0xdc21('0x32')][_0xdc21('0x33')]);_0x2ceffa[_0xdc21('0x3b')]=_[_0xdc21('0x3c')](_0x2d0fcb['model'],qs[_0xdc21('0x3d')](_0x475ac6[_0xdc21('0x3a')][_0xdc21('0x3d')]));_0x2ceffa[_0xdc21('0x3b')]=_0x2ceffa[_0xdc21('0x3b')][_0xdc21('0x3e')]?_0x2ceffa[_0xdc21('0x3b')]:_0x2d0fcb['model'];if(_0x475ac6['query'][_0xdc21('0x45')]){_0x2ceffa[_0xdc21('0x46')]=[{'all':!![]}];}_0x2ceffa=_[_0xdc21('0x2c')]({},_0x2ceffa,_0x475ac6[_0xdc21('0x44')]);return db[_0xdc21('0x32')][_0xdc21('0x4d')](_0x2ceffa)[_0xdc21('0x25')](handleEntityNotFound(_0x284e6b,null))[_0xdc21('0x25')](function(_0x273312){if(_0x273312){var _0x3a4c58=_0x273312['get']({'plain':!![]});_0x3a4c58=qs[_0xdc21('0x51')](_0x3a4c58,['id','createdAt',_0xdc21('0x52')]);_0x475ac6[_0xdc21('0x2d')]=_[_0xdc21('0x51')](_0x475ac6[_0xdc21('0x2d')],['id','createdAt',_0xdc21('0x52')]);return db[_0xdc21('0x32')][_0xdc21('0x4b')](_[_0xdc21('0x2c')](_0x3a4c58,_0x475ac6[_0xdc21('0x2d')]),{'include':_0x475ac6[_0xdc21('0x3a')][_0xdc21('0x45')]?[{'all':!![]}]:undefined})[_0xdc21('0x25')](function(_0x4eaa29){var _0xb47d26=_0x475ac6[_0xdc21('0x4c')][_0xdc21('0x26')]({'plain':!![]});if(!_0xb47d26)throw new Error(_0xdc21('0x53'));if(_0xb47d26[_0xdc21('0x54')]==='user'){var _0x46f553=_0x4eaa29[_0xdc21('0x26')]({'plain':!![]});var _0x3e14be=_0xdc21('0x27');return db[_0xdc21('0x55')][_0xdc21('0x4d')]({'where':{'name':_0x3e14be,'userProfileId':_0xb47d26['userProfileId']},'raw':!![]})['then'](function(_0x47f074){if(_0x47f074&&_0x47f074[_0xdc21('0x56')]===0x0){return db[_0xdc21('0x4f')]['create']({'name':_0x46f553[_0xdc21('0x2a')],'resourceId':_0x46f553['id'],'type':_0x47f074[_0xdc21('0x2a')],'sectionId':_0x47f074['id']},{})[_0xdc21('0x25')](function(){return _0x4eaa29;});}else{return _0x4eaa29;}})[_0xdc21('0x49')](function(_0x387044){logger[_0xdc21('0x28')](_0xdc21('0x50'),_0x387044);throw _0x387044;});}return _0x4eaa29;});}})[_0xdc21('0x25')](respondWithResult(_0x284e6b,0xc9))[_0xdc21('0x49')](handleError(_0x284e6b,null));};exports['update']=function(_0x5cd27c,_0x27983d){if(_0x5cd27c[_0xdc21('0x2d')]['id']){delete _0x5cd27c[_0xdc21('0x2d')]['id'];}return db['Campaign'][_0xdc21('0x4d')]({'where':{'id':_0x5cd27c[_0xdc21('0x4a')]['id']}})['then'](handleEntityNotFound(_0x27983d,null))[_0xdc21('0x25')](saveUpdates(_0x5cd27c[_0xdc21('0x2d')],null))[_0xdc21('0x25')](respondWithResult(_0x27983d,null))[_0xdc21('0x49')](handleError(_0x27983d,null));};exports[_0xdc21('0x24')]=function(_0x22da19,_0x2b3872){return db[_0xdc21('0x32')][_0xdc21('0x4d')]({'where':{'id':_0x22da19['params']['id']}})[_0xdc21('0x25')](handleEntityNotFound(_0x2b3872,null))[_0xdc21('0x25')](removeEntity(_0x2b3872,null))[_0xdc21('0x49')](handleError(_0x2b3872,null));};exports[_0xdc21('0x57')]=function(_0x2d5651,_0x2ff308,_0xc057b9){var _0x2cf457={'raw':!![],'where':{}};var _0x280526={};var _0x10dbc4={'count':0x0,'rows':[]};return db[_0xdc21('0x32')][_0xdc21('0x58')]({'where':{'id':_0x2d5651[_0xdc21('0x4a')]['id']}})[_0xdc21('0x25')](handleEntityNotFound(_0x2ff308,null))[_0xdc21('0x25')](function(_0x50fc13){if(_0x50fc13){_0x280526['model']=_['keys'](db[_0xdc21('0x59')][_0xdc21('0x33')]);_0x280526[_0xdc21('0x3a')]=_['keys'](_0x2d5651['query']);_0x280526[_0xdc21('0x38')]=_['intersection'](_0x280526[_0xdc21('0x39')],_0x280526['query']);_0x2cf457[_0xdc21('0x3b')]=_[_0xdc21('0x3c')](_0x280526['model'],qs[_0xdc21('0x3d')](_0x2d5651[_0xdc21('0x3a')][_0xdc21('0x3d')]));_0x2cf457['attributes']=_0x2cf457[_0xdc21('0x3b')][_0xdc21('0x3e')]?_0x2cf457[_0xdc21('0x3b')]:_0x280526[_0xdc21('0x39')];if(!_0x2d5651[_0xdc21('0x3a')]['hasOwnProperty'](_0xdc21('0x40'))){_0x2cf457[_0xdc21('0x1f')]=qs[_0xdc21('0x1f')](_0x2d5651['query'][_0xdc21('0x1f')]);_0x2cf457['offset']=qs['offset'](_0x2d5651[_0xdc21('0x3a')][_0xdc21('0x1c')]);}_0x2cf457[_0xdc21('0x5a')]=qs[_0xdc21('0x41')](_0x2d5651[_0xdc21('0x3a')][_0xdc21('0x41')]);_0x2cf457[_0xdc21('0x42')]=qs[_0xdc21('0x38')](_['pick'](_0x2d5651[_0xdc21('0x3a')],_0x280526[_0xdc21('0x38')]));_0x2cf457[_0xdc21('0x42')][_0xdc21('0x5b')]=_0x50fc13['id'];if(_0x2d5651[_0xdc21('0x3a')]['filter']){_0x2cf457[_0xdc21('0x42')]=_[_0xdc21('0x2c')](_0x2cf457[_0xdc21('0x42')],{'$or':_[_0xdc21('0x31')](_0x2cf457[_0xdc21('0x3b')],function(_0xa6fce6){var _0x198264={};_0x198264[_0xa6fce6]={'$like':'%'+_0x2d5651['query']['filter']+'%'};return _0x198264;})});}_0x2cf457=_[_0xdc21('0x2c')]({},_0x2cf457,_0x2d5651[_0xdc21('0x44')]);return db['CmHopper']['count']({'where':_0x2cf457['where']})[_0xdc21('0x25')](function(_0xbb2674){_0x10dbc4[_0xdc21('0x1e')]=_0xbb2674;if(_0x2d5651['query'][_0xdc21('0x45')]){_0x2cf457[_0xdc21('0x46')]=[{'all':!![]}];}return db[_0xdc21('0x59')][_0xdc21('0x47')](_0x2cf457);})[_0xdc21('0x25')](function(_0x710428){_0x10dbc4[_0xdc21('0x48')]=_0x710428;return _0x10dbc4;});}})[_0xdc21('0x25')](respondWithFilteredResult(_0x2ff308,_0x2cf457))['catch'](handleError(_0x2ff308,null));};exports[_0xdc21('0x5c')]=function(_0x56d06f,_0x1154a5,_0x5bc5b0){var _0x2e9a16={'raw':!![],'where':{}};var _0x299a5c={};var _0x1708a7={'count':0x0,'rows':[]};return db[_0xdc21('0x32')][_0xdc21('0x58')]({'where':{'id':_0x56d06f['params']['id']}})[_0xdc21('0x25')](handleEntityNotFound(_0x1154a5,null))[_0xdc21('0x25')](function(_0x42f1c6){if(_0x42f1c6){_0x299a5c['model']=_[_0xdc21('0x37')](db['CmHopperHistory']['rawAttributes']);_0x299a5c[_0xdc21('0x3a')]=_[_0xdc21('0x37')](_0x56d06f[_0xdc21('0x3a')]);_0x299a5c['filters']=_['intersection'](_0x299a5c[_0xdc21('0x39')],_0x299a5c[_0xdc21('0x3a')]);_0x2e9a16[_0xdc21('0x3b')]=_[_0xdc21('0x3c')](_0x299a5c['model'],qs[_0xdc21('0x3d')](_0x56d06f[_0xdc21('0x3a')][_0xdc21('0x3d')]));_0x2e9a16[_0xdc21('0x3b')]=_0x2e9a16['attributes'][_0xdc21('0x3e')]?_0x2e9a16['attributes']:_0x299a5c[_0xdc21('0x39')];if(!_0x56d06f[_0xdc21('0x3a')][_0xdc21('0x3f')]('nolimit')){_0x2e9a16[_0xdc21('0x1f')]=qs['limit'](_0x56d06f[_0xdc21('0x3a')][_0xdc21('0x1f')]);_0x2e9a16[_0xdc21('0x1c')]=qs['offset'](_0x56d06f[_0xdc21('0x3a')][_0xdc21('0x1c')]);}_0x2e9a16[_0xdc21('0x5a')]=qs[_0xdc21('0x41')](_0x56d06f[_0xdc21('0x3a')]['sort']);_0x2e9a16[_0xdc21('0x42')]=qs[_0xdc21('0x38')](_[_0xdc21('0x43')](_0x56d06f[_0xdc21('0x3a')],_0x299a5c[_0xdc21('0x38')]));_0x2e9a16['where'][_0xdc21('0x5b')]=_0x42f1c6['id'];if(_0x56d06f[_0xdc21('0x3a')][_0xdc21('0x5d')]){_0x2e9a16['where']=_[_0xdc21('0x2c')](_0x2e9a16['where'],{'$or':_[_0xdc21('0x31')](_0x2e9a16[_0xdc21('0x3b')],function(_0xab9fb6){var _0x168c1c={};_0x168c1c[_0xab9fb6]={'$like':'%'+_0x56d06f[_0xdc21('0x3a')]['filter']+'%'};return _0x168c1c;})});}_0x2e9a16=_[_0xdc21('0x2c')]({},_0x2e9a16,_0x56d06f[_0xdc21('0x44')]);return db[_0xdc21('0x5e')][_0xdc21('0x1e')]({'where':_0x2e9a16[_0xdc21('0x42')]})[_0xdc21('0x25')](function(_0x3a2625){_0x1708a7[_0xdc21('0x1e')]=_0x3a2625;if(_0x56d06f[_0xdc21('0x3a')][_0xdc21('0x45')]){_0x2e9a16['include']=[{'all':!![]}];}return db[_0xdc21('0x5e')][_0xdc21('0x47')](_0x2e9a16);})[_0xdc21('0x25')](function(_0x29a238){_0x1708a7[_0xdc21('0x48')]=_0x29a238;return _0x1708a7;});}})[_0xdc21('0x25')](respondWithFilteredResult(_0x1154a5,_0x2e9a16))[_0xdc21('0x49')](handleError(_0x1154a5,null));};exports['getHopperFinals']=function(_0x3e40ce,_0x592d8d,_0x34087e){var _0x30a06b={'raw':!![],'where':{}};var _0x223ab9={};var _0x28748d={'count':0x0,'rows':[]};return db[_0xdc21('0x32')][_0xdc21('0x58')]({'where':{'id':_0x3e40ce['params']['id']}})[_0xdc21('0x25')](handleEntityNotFound(_0x592d8d,null))[_0xdc21('0x25')](function(_0x1d1815){if(_0x1d1815){_0x223ab9['model']=_['keys'](db[_0xdc21('0x5f')][_0xdc21('0x33')]);_0x223ab9[_0xdc21('0x3a')]=_[_0xdc21('0x37')](_0x3e40ce[_0xdc21('0x3a')]);_0x223ab9['filters']=_[_0xdc21('0x3c')](_0x223ab9[_0xdc21('0x39')],_0x223ab9[_0xdc21('0x3a')]);_0x30a06b[_0xdc21('0x3b')]=_[_0xdc21('0x3c')](_0x223ab9[_0xdc21('0x39')],qs[_0xdc21('0x3d')](_0x3e40ce[_0xdc21('0x3a')][_0xdc21('0x3d')]));_0x30a06b[_0xdc21('0x3b')]=_0x30a06b[_0xdc21('0x3b')]['length']?_0x30a06b['attributes']:_0x223ab9[_0xdc21('0x39')];if(!_0x3e40ce[_0xdc21('0x3a')][_0xdc21('0x3f')](_0xdc21('0x40'))){_0x30a06b['limit']=qs['limit'](_0x3e40ce[_0xdc21('0x3a')]['limit']);_0x30a06b[_0xdc21('0x1c')]=qs[_0xdc21('0x1c')](_0x3e40ce[_0xdc21('0x3a')][_0xdc21('0x1c')]);}_0x30a06b['order']=qs[_0xdc21('0x41')](_0x3e40ce[_0xdc21('0x3a')][_0xdc21('0x41')]);_0x30a06b[_0xdc21('0x42')]=qs[_0xdc21('0x38')](_[_0xdc21('0x43')](_0x3e40ce[_0xdc21('0x3a')],_0x223ab9[_0xdc21('0x38')]));_0x30a06b['where'][_0xdc21('0x5b')]=_0x1d1815['id'];if(_0x3e40ce[_0xdc21('0x3a')][_0xdc21('0x5d')]){_0x30a06b[_0xdc21('0x42')]=_[_0xdc21('0x2c')](_0x30a06b['where'],{'$or':_['map'](_0x30a06b[_0xdc21('0x3b')],function(_0x190121){var _0x42bcd3={};_0x42bcd3[_0x190121]={'$like':'%'+_0x3e40ce['query'][_0xdc21('0x5d')]+'%'};return _0x42bcd3;})});}_0x30a06b=_['merge']({},_0x30a06b,_0x3e40ce[_0xdc21('0x44')]);return db[_0xdc21('0x5f')][_0xdc21('0x1e')]({'where':_0x30a06b[_0xdc21('0x42')]})[_0xdc21('0x25')](function(_0x3943b8){_0x28748d[_0xdc21('0x1e')]=_0x3943b8;if(_0x3e40ce['query'][_0xdc21('0x45')]){_0x30a06b[_0xdc21('0x46')]=[{'all':!![]}];}return db[_0xdc21('0x5f')][_0xdc21('0x47')](_0x30a06b);})[_0xdc21('0x25')](function(_0x46d965){_0x28748d[_0xdc21('0x48')]=_0x46d965;return _0x28748d;});}})[_0xdc21('0x25')](respondWithFilteredResult(_0x592d8d,_0x30a06b))[_0xdc21('0x49')](handleError(_0x592d8d,null));};exports[_0xdc21('0x60')]=function(_0x4d8f1b,_0x47757f,_0x33121d){var _0x21011f={'raw':!![],'where':{}};var _0x1ccfc5={};var _0x3aef7e={'count':0x0,'rows':[]};return db[_0xdc21('0x32')][_0xdc21('0x58')]({'where':{'id':_0x4d8f1b['params']['id']}})[_0xdc21('0x25')](handleEntityNotFound(_0x47757f,null))[_0xdc21('0x25')](function(_0x4f4d61){if(_0x4f4d61){_0x1ccfc5[_0xdc21('0x39')]=_[_0xdc21('0x37')](db[_0xdc21('0x61')][_0xdc21('0x33')]);_0x1ccfc5[_0xdc21('0x3a')]=_[_0xdc21('0x37')](_0x4d8f1b[_0xdc21('0x3a')]);_0x1ccfc5['filters']=_[_0xdc21('0x3c')](_0x1ccfc5[_0xdc21('0x39')],_0x1ccfc5['query']);_0x21011f[_0xdc21('0x3b')]=_[_0xdc21('0x3c')](_0x1ccfc5['model'],qs['fields'](_0x4d8f1b[_0xdc21('0x3a')][_0xdc21('0x3d')]));_0x21011f[_0xdc21('0x3b')]=_0x21011f[_0xdc21('0x3b')][_0xdc21('0x3e')]?_0x21011f[_0xdc21('0x3b')]:_0x1ccfc5[_0xdc21('0x39')];if(!_0x4d8f1b[_0xdc21('0x3a')][_0xdc21('0x3f')]('nolimit')){_0x21011f[_0xdc21('0x1f')]=qs[_0xdc21('0x1f')](_0x4d8f1b[_0xdc21('0x3a')][_0xdc21('0x1f')]);_0x21011f[_0xdc21('0x1c')]=qs[_0xdc21('0x1c')](_0x4d8f1b[_0xdc21('0x3a')][_0xdc21('0x1c')]);}_0x21011f[_0xdc21('0x5a')]=qs['sort'](_0x4d8f1b[_0xdc21('0x3a')][_0xdc21('0x41')]);_0x21011f[_0xdc21('0x42')]=qs[_0xdc21('0x38')](_['pick'](_0x4d8f1b['query'],_0x1ccfc5['filters']));_0x21011f[_0xdc21('0x42')][_0xdc21('0x5b')]=_0x4f4d61['id'];if(_0x4d8f1b['query'][_0xdc21('0x5d')]){_0x21011f[_0xdc21('0x42')]=_['merge'](_0x21011f[_0xdc21('0x42')],{'$or':_[_0xdc21('0x31')](_0x21011f[_0xdc21('0x3b')],function(_0x20c966){var _0x541a90={};_0x541a90[_0x20c966]={'$like':'%'+_0x4d8f1b['query'][_0xdc21('0x5d')]+'%'};return _0x541a90;})});}_0x21011f=_[_0xdc21('0x2c')]({},_0x21011f,_0x4d8f1b['options']);return db[_0xdc21('0x61')][_0xdc21('0x1e')]({'where':_0x21011f[_0xdc21('0x42')]})[_0xdc21('0x25')](function(_0x9cb135){_0x3aef7e[_0xdc21('0x1e')]=_0x9cb135;if(_0x4d8f1b[_0xdc21('0x3a')][_0xdc21('0x45')]){_0x21011f[_0xdc21('0x46')]=[{'all':!![]}];}return db[_0xdc21('0x61')]['findAll'](_0x21011f);})[_0xdc21('0x25')](function(_0x321449){_0x3aef7e[_0xdc21('0x48')]=_0x321449;return _0x3aef7e;});}})[_0xdc21('0x25')](respondWithFilteredResult(_0x47757f,_0x21011f))[_0xdc21('0x49')](handleError(_0x47757f,null));};exports[_0xdc21('0x62')]=function(_0xa3c18b,_0x4f3b7d,_0x2ccb47){var _0x51b57c={};var _0x27b349={};var _0x3529fa;var _0x44384f;return db[_0xdc21('0x32')]['findOne']({'where':{'id':_0xa3c18b[_0xdc21('0x4a')]['id']}})[_0xdc21('0x25')](handleEntityNotFound(_0x4f3b7d,null))['then'](function(_0x47275b){if(_0x47275b){_0x3529fa=_0x47275b;_0x27b349[_0xdc21('0x39')]=_['keys'](db[_0xdc21('0x63')][_0xdc21('0x33')]);_0x27b349[_0xdc21('0x3a')]=_[_0xdc21('0x37')](_0xa3c18b[_0xdc21('0x3a')]);_0x27b349[_0xdc21('0x38')]=_['intersection'](_0x27b349[_0xdc21('0x39')],_0x27b349[_0xdc21('0x3a')]);_0x51b57c[_0xdc21('0x3b')]=_['intersection'](_0x27b349[_0xdc21('0x39')],qs[_0xdc21('0x3d')](_0xa3c18b[_0xdc21('0x3a')][_0xdc21('0x3d')]));_0x51b57c['attributes']=_0x51b57c[_0xdc21('0x3b')][_0xdc21('0x3e')]?_0x51b57c[_0xdc21('0x3b')]:_0x27b349[_0xdc21('0x39')];_0x51b57c[_0xdc21('0x5a')]=qs[_0xdc21('0x41')](_0xa3c18b['query'][_0xdc21('0x41')]);_0x51b57c[_0xdc21('0x42')]=qs[_0xdc21('0x38')](_[_0xdc21('0x43')](_0xa3c18b['query'],_0x27b349[_0xdc21('0x38')]));if(_0xa3c18b['query'][_0xdc21('0x5d')]){_0x51b57c[_0xdc21('0x42')]=_[_0xdc21('0x2c')](_0x51b57c[_0xdc21('0x42')],{'$or':_[_0xdc21('0x31')](_0x51b57c[_0xdc21('0x3b')],function(_0x3fbb64){var _0x165c60={};_0x165c60[_0x3fbb64]={'$like':'%'+_0xa3c18b[_0xdc21('0x3a')][_0xdc21('0x5d')]+'%'};return _0x165c60;})});}_0x51b57c=_[_0xdc21('0x2c')]({},_0x51b57c,_0xa3c18b[_0xdc21('0x44')]);return _0x3529fa[_0xdc21('0x62')](_0x51b57c);}})[_0xdc21('0x25')](function(_0x1462fb){if(_0x1462fb){_0x44384f=_0x1462fb[_0xdc21('0x3e')];if(!_0xa3c18b[_0xdc21('0x3a')][_0xdc21('0x3f')]('nolimit')){_0x51b57c[_0xdc21('0x1f')]=qs['limit'](_0xa3c18b[_0xdc21('0x3a')][_0xdc21('0x1f')]);_0x51b57c['offset']=qs[_0xdc21('0x1c')](_0xa3c18b[_0xdc21('0x3a')][_0xdc21('0x1c')]);}return _0x3529fa['getLists'](_0x51b57c);}})[_0xdc21('0x25')](function(_0x589b09){if(_0x589b09){return _0x589b09?{'count':_0x44384f,'rows':_0x589b09}:null;}})[_0xdc21('0x25')](respondWithResult(_0x4f3b7d,null))['catch'](handleError(_0x4f3b7d,null));};exports[_0xdc21('0x64')]=function(_0xd685fb,_0x5426e3,_0x114961){var _0xe6c75f,_0x51a376;return db[_0xdc21('0x32')]['find']({'where':{'id':_0xd685fb[_0xdc21('0x4a')]['id']}})[_0xdc21('0x25')](handleEntityNotFound(_0x5426e3,null))[_0xdc21('0x25')](function(_0x46e8ea){if(_0x46e8ea){_0x51a376=_0x46e8ea;return _0x46e8ea[_0xdc21('0x64')](_0xd685fb[_0xdc21('0x2d')][_0xdc21('0x65')],_[_0xdc21('0x51')](_0xd685fb[_0xdc21('0x2d')],['ids','id'])||{});}return null;})[_0xdc21('0x66')](function(_0x5f4e8f){var _0xc37072;_0xe6c75f=_0x5f4e8f||[];var _0x3d82e8=[];if(_0x5f4e8f){for(var _0x1259fc=0x0;_0x1259fc<_0x5f4e8f[_0xdc21('0x3e')];_0x1259fc+=0x1){var _0x5e912c=_0x5f4e8f[_0x1259fc][_0xdc21('0x26')]({'plain':!![]});_0x51a376['dialCheckDuplicateType']=_0xd685fb[_0xdc21('0x2d')]['dialCheckDuplicateType']?_0xd685fb[_0xdc21('0x2d')]['dialCheckDuplicateType']:_0x51a376[_0xdc21('0x67')];switch(_0x51a376[_0xdc21('0x67')]){case'always':_0xc37072=squel[_0xdc21('0x68')]()[_0xdc21('0x69')](_0xdc21('0x6a'))[_0xdc21('0x6b')]([_0xdc21('0x6c'),_0xdc21('0x6d'),_0xdc21('0x6e'),_0xdc21('0x6f'),_0xdc21('0x5b'),_0xdc21('0x70'),_0xdc21('0x52')],squel[_0xdc21('0x71')]()[_0xdc21('0x72')](_0xdc21('0x6c'),_0xdc21('0x6c'))['field'](_0xdc21('0x73'),'scheduledAt')[_0xdc21('0x72')]('id',_0xdc21('0x6e'))[_0xdc21('0x72')](_0x5e912c[_0xdc21('0x74')][_0xdc21('0x75')](),_0xdc21('0x6f'))[_0xdc21('0x72')](_0xd685fb[_0xdc21('0x4a')]['id'][_0xdc21('0x75')](),'CampaignId')['field'](_0xdc21('0x73'),_0xdc21('0x70'))[_0xdc21('0x72')](_0xdc21('0x73'),'updatedAt')['from'](_0xdc21('0x76'))[_0xdc21('0x42')]('deletedAt\x20IS\x20NULL')[_0xdc21('0x42')](_0xdc21('0x77'),_0x5e912c[_0xdc21('0x74')]['toString']())[_0xdc21('0x42')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xdc21('0x78'),squel['select']()[_0xdc21('0x72')](_0xdc21('0x79'))[_0xdc21('0x7a')](_0xdc21('0x7b'))[_0xdc21('0x42')](_0xdc21('0x7c'),_0xd685fb[_0xdc21('0x4a')]['id'][_0xdc21('0x75')]()))[_0xdc21('0x42')](_0xdc21('0x78'),squel['select']()[_0xdc21('0x72')]('COALESCE(phone,\x27\x27)')[_0xdc21('0x7a')]('cm_hopper')[_0xdc21('0x42')](_0xdc21('0x7c'),_0xd685fb[_0xdc21('0x4a')]['id'][_0xdc21('0x75')]())))[_0xdc21('0x75')]();break;case _0xdc21('0x7d'):_0xc37072=squel[_0xdc21('0x68')]()['into'](_0xdc21('0x6a'))[_0xdc21('0x6b')](['phone',_0xdc21('0x6d'),_0xdc21('0x6e'),_0xdc21('0x6f'),'CampaignId',_0xdc21('0x70'),_0xdc21('0x52')],squel[_0xdc21('0x71')]()[_0xdc21('0x72')](_0xdc21('0x6c'),_0xdc21('0x6c'))['field'](_0xdc21('0x73'),_0xdc21('0x6d'))[_0xdc21('0x72')]('id',_0xdc21('0x6e'))[_0xdc21('0x72')](_0x5e912c[_0xdc21('0x74')]['toString'](),'ListId')[_0xdc21('0x72')](_0xd685fb[_0xdc21('0x4a')]['id'][_0xdc21('0x75')](),_0xdc21('0x5b'))[_0xdc21('0x72')](_0xdc21('0x73'),_0xdc21('0x70'))['field'](_0xdc21('0x73'),'updatedAt')['from']('cm_contacts')[_0xdc21('0x42')](_0xdc21('0x7e'))[_0xdc21('0x42')](_0xdc21('0x77'),_0x5e912c[_0xdc21('0x74')][_0xdc21('0x75')]())[_0xdc21('0x42')](_0xdc21('0x7f'))[_0xdc21('0x42')](_0xdc21('0x78'),squel['select']()[_0xdc21('0x72')]('COALESCE(phone,\x27\x27)')[_0xdc21('0x7a')](_0xdc21('0x6a'))['where'](_0xdc21('0x7c'),_0xd685fb[_0xdc21('0x4a')]['id'][_0xdc21('0x75')]())))[_0xdc21('0x75')]();break;default:_0xc37072=squel['insert']()[_0xdc21('0x69')](_0xdc21('0x6a'))[_0xdc21('0x6b')]([_0xdc21('0x6c'),_0xdc21('0x6d'),_0xdc21('0x6e'),'ListId',_0xdc21('0x5b'),_0xdc21('0x70'),'updatedAt'],squel[_0xdc21('0x71')]()[_0xdc21('0x72')](_0xdc21('0x6c'),'phone')[_0xdc21('0x72')](_0xdc21('0x73'),_0xdc21('0x6d'))['field']('id',_0xdc21('0x6e'))[_0xdc21('0x72')](_0x5e912c[_0xdc21('0x74')][_0xdc21('0x75')](),'ListId')[_0xdc21('0x72')](_0xd685fb[_0xdc21('0x4a')]['id']['toString'](),'CampaignId')[_0xdc21('0x72')](_0xdc21('0x73'),_0xdc21('0x70'))[_0xdc21('0x72')](_0xdc21('0x73'),_0xdc21('0x52'))['from'](_0xdc21('0x76'))[_0xdc21('0x42')](_0xdc21('0x7e'))[_0xdc21('0x42')](_0xdc21('0x77'),_0x5e912c[_0xdc21('0x74')][_0xdc21('0x75')]())[_0xdc21('0x42')](_0xdc21('0x7f')))[_0xdc21('0x75')]();}_0x3d82e8['push'](db[_0xdc21('0x80')][_0xdc21('0x3a')](_0xc37072));}return BPromise[_0xdc21('0x81')](_0x3d82e8);}})['then'](function(){return _0xe6c75f;})[_0xdc21('0x25')](respondWithResult(_0x5426e3,null))[_0xdc21('0x49')](handleError(_0x5426e3,null));};exports[_0xdc21('0x82')]=function(_0xd5df01,_0x5d2c47,_0x22a9c3){return db['Campaign']['find']({'where':{'id':_0xd5df01[_0xdc21('0x4a')]['id']}})[_0xdc21('0x25')](handleEntityNotFound(_0x5d2c47,null))['then'](function(_0x3999de){if(_0x3999de){return _0x3999de[_0xdc21('0x82')](_0xd5df01[_0xdc21('0x3a')][_0xdc21('0x65')]);}})[_0xdc21('0x25')](function(_0x283297){if(_0x283297){return db[_0xdc21('0x59')][_0xdc21('0x24')]({'where':{'ListId':_0xd5df01[_0xdc21('0x3a')][_0xdc21('0x65')],'CampaignId':_0xd5df01['params']['id']}})[_0xdc21('0x25')](function(){return _0x283297;});}})[_0xdc21('0x25')](respondWithStatusCode(_0x5d2c47,null))[_0xdc21('0x49')](handleError(_0x5d2c47,null));};exports[_0xdc21('0x83')]=function(_0x179519,_0x4d3867,_0x394d00){var _0x5ec883={};var _0x12915e={};var _0x235438;var _0x5caf81;return db[_0xdc21('0x32')][_0xdc21('0x58')]({'where':{'id':_0x179519[_0xdc21('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4d3867,null))[_0xdc21('0x25')](function(_0x30a73b){if(_0x30a73b){_0x235438=_0x30a73b;_0x12915e['model']=_[_0xdc21('0x37')](db[_0xdc21('0x63')][_0xdc21('0x33')]);_0x12915e[_0xdc21('0x3a')]=_[_0xdc21('0x37')](_0x179519['query']);_0x12915e[_0xdc21('0x38')]=_[_0xdc21('0x3c')](_0x12915e[_0xdc21('0x39')],_0x12915e[_0xdc21('0x3a')]);_0x5ec883[_0xdc21('0x3b')]=_[_0xdc21('0x3c')](_0x12915e[_0xdc21('0x39')],qs[_0xdc21('0x3d')](_0x179519['query']['fields']));_0x5ec883[_0xdc21('0x3b')]=_0x5ec883[_0xdc21('0x3b')][_0xdc21('0x3e')]?_0x5ec883[_0xdc21('0x3b')]:_0x12915e[_0xdc21('0x39')];_0x5ec883['order']=qs[_0xdc21('0x41')](_0x179519[_0xdc21('0x3a')][_0xdc21('0x41')]);_0x5ec883[_0xdc21('0x42')]=qs[_0xdc21('0x38')](_['pick'](_0x179519[_0xdc21('0x3a')],_0x12915e[_0xdc21('0x38')]));if(_0x179519['query'][_0xdc21('0x5d')]){_0x5ec883[_0xdc21('0x42')]=_['merge'](_0x5ec883[_0xdc21('0x42')],{'$or':_[_0xdc21('0x31')](_0x5ec883[_0xdc21('0x3b')],function(_0x18b2c1){var _0x43fefd={};_0x43fefd[_0x18b2c1]={'$like':'%'+_0x179519[_0xdc21('0x3a')][_0xdc21('0x5d')]+'%'};return _0x43fefd;})});}_0x5ec883=_['merge']({},_0x5ec883,_0x179519[_0xdc21('0x44')]);return _0x235438[_0xdc21('0x83')](_0x5ec883);}})[_0xdc21('0x25')](function(_0x40d8ce){if(_0x40d8ce){_0x5caf81=_0x40d8ce[_0xdc21('0x3e')];if(!_0x179519[_0xdc21('0x3a')][_0xdc21('0x3f')](_0xdc21('0x40'))){_0x5ec883['limit']=qs['limit'](_0x179519[_0xdc21('0x3a')][_0xdc21('0x1f')]);_0x5ec883[_0xdc21('0x1c')]=qs[_0xdc21('0x1c')](_0x179519[_0xdc21('0x3a')]['offset']);}return _0x235438[_0xdc21('0x83')](_0x5ec883);}})[_0xdc21('0x25')](function(_0x4ec354){if(_0x4ec354){return _0x4ec354?{'count':_0x5caf81,'rows':_0x4ec354}:null;}})[_0xdc21('0x25')](respondWithResult(_0x4d3867,null))[_0xdc21('0x49')](handleError(_0x4d3867,null));};exports['addBlackLists']=function(_0x4470e7,_0x1ad843,_0x2044d9){var _0xfab5a3,_0x150bcb;return db[_0xdc21('0x32')][_0xdc21('0x4d')]({'where':{'id':_0x4470e7[_0xdc21('0x4a')]['id']}})[_0xdc21('0x25')](handleEntityNotFound(_0x1ad843,null))[_0xdc21('0x25')](function(_0x4ad277){if(_0x4ad277){_0x150bcb=_0x4ad277;return _0x4ad277['addBlackLists'](_0x4470e7['body']['ids'],_[_0xdc21('0x51')](_0x4470e7['body'],[_0xdc21('0x65'),'id'])||{});}return null;})[_0xdc21('0x66')](function(_0x594a67){var _0x7b8196;_0xfab5a3=_0x594a67||[];var _0x323b08=[];if(_0x594a67){for(var _0x55b85=0x0;_0x55b85<_0x594a67['length'];_0x55b85+=0x1){var _0x310d71=_0x594a67[_0x55b85][_0xdc21('0x26')]({'plain':!![]});_0x7b8196=squel[_0xdc21('0x68')]()[_0xdc21('0x69')](_0xdc21('0x84'))[_0xdc21('0x6b')]([_0xdc21('0x6c'),_0xdc21('0x6e'),_0xdc21('0x6f'),_0xdc21('0x5b'),_0xdc21('0x70'),_0xdc21('0x52')],squel['select']()['field'](_0xdc21('0x6c'),_0xdc21('0x6c'))['field']('id','ContactId')['field'](_0x310d71[_0xdc21('0x74')]['toString'](),'ListId')['field'](_0x4470e7[_0xdc21('0x4a')]['id'][_0xdc21('0x75')](),_0xdc21('0x5b'))[_0xdc21('0x72')]('NOW()','createdAt')[_0xdc21('0x72')](_0xdc21('0x73'),_0xdc21('0x52'))['from'](_0xdc21('0x76'))[_0xdc21('0x42')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x310d71[_0xdc21('0x74')][_0xdc21('0x75')]())[_0xdc21('0x42')](_0xdc21('0x7f')))[_0xdc21('0x75')]();_0x323b08[_0xdc21('0x85')](db[_0xdc21('0x80')]['query'](_0x7b8196));}return BPromise[_0xdc21('0x81')](_0x323b08);}})[_0xdc21('0x25')](function(){return _0xfab5a3;})[_0xdc21('0x25')](respondWithResult(_0x1ad843,null))[_0xdc21('0x49')](handleError(_0x1ad843,null));};exports[_0xdc21('0x86')]=function(_0x46539d,_0x3b4c98,_0xfea613){return db[_0xdc21('0x32')][_0xdc21('0x4d')]({'where':{'id':_0x46539d['params']['id']}})[_0xdc21('0x25')](handleEntityNotFound(_0x3b4c98,null))[_0xdc21('0x25')](function(_0x2ab778){if(_0x2ab778){return _0x2ab778['removeBlackLists'](_0x46539d['query'][_0xdc21('0x65')]);}})[_0xdc21('0x25')](function(_0x2d350d){if(_0x2d350d){return db[_0xdc21('0x61')]['destroy']({'where':{'ListId':_0x46539d[_0xdc21('0x3a')][_0xdc21('0x65')],'CampaignId':_0x46539d[_0xdc21('0x4a')]['id']}})[_0xdc21('0x25')](function(){return _0x2d350d;});}})['then'](respondWithStatusCode(_0x3b4c98,null))['catch'](handleError(_0x3b4c98,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 5e55016..ae98ade 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 _0x3f36=['../../config/environment','./campaign.attributes','exports','define','Campaign','campaigns','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0x3f36,0x18e));var _0x63f3=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0x3f36[_0x43b08];return _0x5e05f4;};'use strict';var _=require(_0x63f3('0x0'));var util=require(_0x63f3('0x1'));var logger=require(_0x63f3('0x2'))(_0x63f3('0x3'));var moment=require('moment');var BPromise=require(_0x63f3('0x4'));var rp=require(_0x63f3('0x5'));var fs=require('fs');var path=require(_0x63f3('0x6'));var rimraf=require(_0x63f3('0x7'));var config=require(_0x63f3('0x8'));var attributes=require(_0x63f3('0x9'));module[_0x63f3('0xa')]=function(_0x569a0e,_0x17cf5b){return _0x569a0e[_0x63f3('0xb')](_0x63f3('0xc'),attributes,{'tableName':_0x63f3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8980=['../../config/logger','api','moment','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8980,0x17b));var _0x0898=function(_0x45262e,_0x1d9c0b){_0x45262e=_0x45262e-0x0;var _0x3b7f60=_0x8980[_0x45262e];return _0x3b7f60;};'use strict';var _=require(_0x0898('0x0'));var util=require('util');var logger=require(_0x0898('0x1'))(_0x0898('0x2'));var moment=require(_0x0898('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0898('0x4'));var config=require(_0x0898('0x5'));var attributes=require(_0x0898('0x6'));module[_0x0898('0x7')]=function(_0x26fe1c,_0x39fd82){return _0x26fe1c[_0x0898('0x8')](_0x0898('0x9'),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 19624aa..f2d8a55 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 _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x20b6f3,_0xa60bb7){var _0x38b3fe=function(_0x9be5b6){while(--_0x9be5b6){_0x20b6f3['push'](_0x20b6f3['shift']());}};_0x38b3fe(++_0xa60bb7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x26c88d,_0x3be317){var _0x52f047=function(_0x28d7d0){while(--_0x28d7d0){_0x26c88d['push'](_0x26c88d['shift']());}};_0x52f047(++_0x3be317);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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['GetCampaign']=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')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 301a843..fd0f649 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 _0x0bcc=['getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers'];(function(_0xdbbce6,_0x43883c){var _0x1ba2e7=function(_0x29c2b0){while(--_0x29c2b0){_0xdbbce6['push'](_0xdbbce6['shift']());}};_0x1ba2e7(++_0x43883c);}(_0x0bcc,0xdf));var _0xc0bc=function(_0x389abb,_0x241f9f){_0x389abb=_0x389abb-0x0;var _0x36d5b0=_0x0bcc[_0x389abb];return _0x36d5b0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0bc('0x0'));var timeout=require(_0xc0bc('0x1'));var express=require(_0xc0bc('0x2'));var router=express[_0xc0bc('0x3')]();var fs_extra=require(_0xc0bc('0x4'));var auth=require(_0xc0bc('0x5'));var interaction=require(_0xc0bc('0x6'));var config=require(_0xc0bc('0x7'));var controller=require(_0xc0bc('0x8'));router[_0xc0bc('0x9')]('/',auth[_0xc0bc('0xa')](),controller[_0xc0bc('0xb')]);router[_0xc0bc('0x9')](_0xc0bc('0xc'),auth['isAuthenticated'](),controller[_0xc0bc('0xd')]);router[_0xc0bc('0x9')](_0xc0bc('0xe'),auth[_0xc0bc('0xa')](),controller[_0xc0bc('0xf')]);router[_0xc0bc('0x9')](_0xc0bc('0x10'),auth[_0xc0bc('0xa')](),controller[_0xc0bc('0x11')]);router[_0xc0bc('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xc0bc('0x12')]);router[_0xc0bc('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0xc0bc('0x13')]);router[_0xc0bc('0x9')](_0xc0bc('0x14'),auth['isAuthenticated'](),controller[_0xc0bc('0x15')]);router['get'](_0xc0bc('0x16'),auth[_0xc0bc('0xa')](),controller[_0xc0bc('0x17')]);router[_0xc0bc('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc0bc('0x18')](_0xc0bc('0x19'),auth[_0xc0bc('0xa')](),controller[_0xc0bc('0x1a')]);router['post'](_0xc0bc('0x14'),auth[_0xc0bc('0xa')](),controller['addLists']);router[_0xc0bc('0x18')](_0xc0bc('0x16'),auth[_0xc0bc('0xa')](),controller[_0xc0bc('0x1b')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc0bc('0x1c')]);router[_0xc0bc('0x1d')](_0xc0bc('0xc'),auth['isAuthenticated'](),controller[_0xc0bc('0x1e')]);router['delete'](_0xc0bc('0x14'),auth[_0xc0bc('0xa')](),controller[_0xc0bc('0x1f')]);router[_0xc0bc('0x1d')](_0xc0bc('0x16'),auth[_0xc0bc('0xa')](),controller[_0xc0bc('0x20')]);module[_0xc0bc('0x21')]=router; \ No newline at end of file +var _0x40c4=['update','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','post','create','/:id/clone','addLists','/:id/blacklists','addBlackLists','put'];(function(_0x32351e,_0x25d53a){var _0xcc55=function(_0x1ce0dd){while(--_0x1ce0dd){_0x32351e['push'](_0x32351e['shift']());}};_0xcc55(++_0x25d53a);}(_0x40c4,0xbe));var _0x440c=function(_0x2a518f,_0x3fff40){_0x2a518f=_0x2a518f-0x0;var _0xb1d1f8=_0x40c4[_0x2a518f];return _0xb1d1f8;};'use strict';var multer=require(_0x440c('0x0'));var util=require(_0x440c('0x1'));var path=require(_0x440c('0x2'));var timeout=require(_0x440c('0x3'));var express=require(_0x440c('0x4'));var router=express[_0x440c('0x5')]();var fs_extra=require(_0x440c('0x6'));var auth=require(_0x440c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x440c('0x8')]('/',auth[_0x440c('0x9')](),controller[_0x440c('0xa')]);router['get'](_0x440c('0xb'),auth[_0x440c('0x9')](),controller['show']);router[_0x440c('0x8')](_0x440c('0xc'),auth[_0x440c('0x9')](),controller[_0x440c('0xd')]);router[_0x440c('0x8')](_0x440c('0xe'),auth['isAuthenticated'](),controller['getHopperHistories']);router['get'](_0x440c('0xf'),auth[_0x440c('0x9')](),controller[_0x440c('0x10')]);router[_0x440c('0x8')](_0x440c('0x11'),auth['isAuthenticated'](),controller[_0x440c('0x12')]);router[_0x440c('0x8')](_0x440c('0x13'),auth['isAuthenticated'](),controller['getLists']);router[_0x440c('0x8')]('/:id/blacklists',auth[_0x440c('0x9')](),controller['getBlackLists']);router[_0x440c('0x14')]('/',auth[_0x440c('0x9')](),controller[_0x440c('0x15')]);router[_0x440c('0x14')](_0x440c('0x16'),auth['isAuthenticated'](),controller['clone']);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0x440c('0x17')]);router[_0x440c('0x14')](_0x440c('0x18'),auth[_0x440c('0x9')](),controller[_0x440c('0x19')]);router[_0x440c('0x1a')](_0x440c('0xb'),auth[_0x440c('0x9')](),controller[_0x440c('0x1b')]);router['delete'](_0x440c('0xb'),auth[_0x440c('0x9')](),controller['destroy']);router['delete'](_0x440c('0x13'),auth[_0x440c('0x9')](),controller['removeLists']);router[_0x440c('0x1c')](_0x440c('0x18'),auth[_0x440c('0x9')](),controller[_0x440c('0x1d')]);module[_0x440c('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 b86c169..2a633f3 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 _0x906b=['getDataValue','key','sequelize','STRING','TEXT','VIRTUAL'];(function(_0x44fc35,_0x2e6c4d){var _0x5610a9=function(_0xee575b){while(--_0xee575b){_0x44fc35['push'](_0x44fc35['shift']());}};_0x5610a9(++_0x2e6c4d);}(_0x906b,0xfe));var _0xb906=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x906b[_0x4063a4];return _0x17908d;};'use strict';var Sequelize=require(_0xb906('0x0'));module['exports']={'key':{'type':Sequelize[_0xb906('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xb906('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xb906('0x3')],'get':function(){return this[_0xb906('0x4')](_0xb906('0x5'));}}}; \ No newline at end of file +var _0xc844=['key','sequelize','exports','STRING','TEXT','getDataValue'];(function(_0x4942db,_0x56a8e6){var _0x4b2946=function(_0x1164de){while(--_0x1164de){_0x4942db['push'](_0x4942db['shift']());}};_0x4b2946(++_0x56a8e6);}(_0xc844,0xe5));var _0x4c84=function(_0x5335ba,_0xe07dd7){_0x5335ba=_0x5335ba-0x0;var _0x4ca621=_0xc844[_0x5335ba];return _0x4ca621;};'use strict';var Sequelize=require(_0x4c84('0x0'));module[_0x4c84('0x1')]={'key':{'type':Sequelize[_0x4c84('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x4c84('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4c84('0x4')](_0x4c84('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 9f430aa..24a48e2 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 _0x6789=['params','rawAttributes','length','includeAll','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','merge','body','contact','message','agent','account','index','map','CannedAnswer','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','findAll','catch','show'];(function(_0xe86ed2,_0x389bc9){var _0x374ff1=function(_0x4a8f21){while(--_0x4a8f21){_0xe86ed2['push'](_0xe86ed2['shift']());}};_0x374ff1(++_0x389bc9);}(_0x6789,0xcb));var _0x9678=function(_0x296a3c,_0x22c355){_0x296a3c=_0x296a3c-0x0;var _0x257e73=_0x6789[_0x296a3c];return _0x257e73;};'use strict';var emlformat=require(_0x9678('0x0'));var rimraf=require(_0x9678('0x1'));var zipdir=require(_0x9678('0x2'));var jsonpatch=require(_0x9678('0x3'));var rp=require(_0x9678('0x4'));var moment=require(_0x9678('0x5'));var BPromise=require(_0x9678('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9678('0x7'));var sox=require(_0x9678('0x8'));var csv=require(_0x9678('0x9'));var ejs=require(_0x9678('0xa'));var fs=require('fs');var fs_extra=require(_0x9678('0xb'));var _=require('lodash');var squel=require(_0x9678('0xc'));var crypto=require('crypto');var jsforce=require(_0x9678('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9678('0xe'));var Papa=require(_0x9678('0xf'));var Redis=require(_0x9678('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9678('0x11'));var hardwareService=require(_0x9678('0x12'));var logger=require(_0x9678('0x13'))(_0x9678('0x14'));var utils=require(_0x9678('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9678('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3113bd,_0x3f8a33){_0x3f8a33=_0x3f8a33||0xcc;return function(_0x210a29){if(_0x210a29){return _0x3113bd[_0x9678('0x17')](_0x3f8a33);}return _0x3113bd[_0x9678('0x18')](_0x3f8a33)[_0x9678('0x19')]();};}function respondWithResult(_0x1e5922,_0x3da995){_0x3da995=_0x3da995||0xc8;return function(_0x33b4b4){if(_0x33b4b4){return _0x1e5922['status'](_0x3da995)['json'](_0x33b4b4);}};}function respondWithFilteredResult(_0x3d0f14,_0x3884e8){return function(_0x481973){if(_0x481973){var _0x3c91e2=typeof _0x3884e8['offset']===_0x9678('0x1a')&&typeof _0x3884e8[_0x9678('0x1b')]==='undefined';var _0x37b478=_0x481973[_0x9678('0x1c')];var _0xf79aec=_0x3c91e2?0x0:_0x3884e8['offset'];var _0x4a7a07=_0x3c91e2?_0x481973[_0x9678('0x1c')]:_0x3884e8[_0x9678('0x1d')]+_0x3884e8[_0x9678('0x1b')];var _0x42fdc6;if(_0x4a7a07>=_0x37b478){_0x4a7a07=_0x37b478;_0x42fdc6=0xc8;}else{_0x42fdc6=0xce;}_0x3d0f14['status'](_0x42fdc6);return _0x3d0f14[_0x9678('0x1e')]('Content-Range',_0xf79aec+'-'+_0x4a7a07+'/'+_0x37b478)[_0x9678('0x1f')](_0x481973);}return null;};}function patchUpdates(_0x5733c8){return function(_0x2c8aec){try{jsonpatch[_0x9678('0x20')](_0x2c8aec,_0x5733c8,!![]);}catch(_0x35a78d){return BPromise['reject'](_0x35a78d);}return _0x2c8aec[_0x9678('0x21')]();};}function saveUpdates(_0x1cc6b0,_0x42042b){return function(_0x3f81ba){if(_0x3f81ba){return _0x3f81ba[_0x9678('0x22')](_0x1cc6b0)[_0x9678('0x23')](function(_0x257f15){return _0x257f15;});}return null;};}function removeEntity(_0xe6f467,_0x298e2e){return function(_0x1a2d41){if(_0x1a2d41){return _0x1a2d41['destroy']()[_0x9678('0x23')](function(){var _0x2a62d9=_0x1a2d41[_0x9678('0x24')]({'plain':!![]});var _0xec32c8=_0x9678('0x25');return db[_0x9678('0x26')]['destroy']({'where':{'type':_0xec32c8,'resourceId':_0x2a62d9['id']}})['then'](function(){return _0x1a2d41;});})[_0x9678('0x23')](function(){_0xe6f467['status'](0xcc)[_0x9678('0x19')]();});}};}function handleEntityNotFound(_0x201da7,_0x8bfdb5){return function(_0x2361fb){if(!_0x2361fb){_0x201da7[_0x9678('0x17')](0x194);}return _0x2361fb;};}function handleError(_0x1b94bf,_0x48620d){_0x48620d=_0x48620d||0x1f4;return function(_0xe68f37){logger[_0x9678('0x27')](_0xe68f37[_0x9678('0x28')]);if(_0xe68f37[_0x9678('0x29')]){delete _0xe68f37[_0x9678('0x29')];}_0x1b94bf[_0x9678('0x18')](_0x48620d)[_0x9678('0x2a')](_0xe68f37);};}function getMustacheRender(_0x55c585,_0x446c8a){return Mustache['render'](_0x55c585,_[_0x9678('0x2b')](_0x446c8a[_0x9678('0x2c')],{'contact':_0x446c8a[_0x9678('0x2d')],'message':_0x446c8a[_0x9678('0x2e')],'agent':_0x446c8a[_0x9678('0x2f')],'interaction':_0x446c8a['interaction'],'account':_0x446c8a[_0x9678('0x30')]}))||'';}exports[_0x9678('0x31')]=function(_0x59789b,_0x10f389){var _0x1f3032={},_0x245aaf={},_0x3fcdd9={'count':0x0,'rows':[]};var _0x36d18d=_[_0x9678('0x32')](db[_0x9678('0x33')]['rawAttributes'],function(_0x46fc19){return{'name':_0x46fc19[_0x9678('0x34')],'type':_0x46fc19['type'][_0x9678('0x35')]};});_0x245aaf[_0x9678('0x36')]=_[_0x9678('0x32')](_0x36d18d,_0x9678('0x29'));_0x245aaf[_0x9678('0x37')]=_[_0x9678('0x38')](_0x59789b['query']);_0x245aaf[_0x9678('0x39')]=_[_0x9678('0x3a')](_0x245aaf['model'],_0x245aaf[_0x9678('0x37')]);_0x1f3032['attributes']=_[_0x9678('0x3a')](_0x245aaf[_0x9678('0x36')],qs[_0x9678('0x3b')](_0x59789b['query'][_0x9678('0x3b')]));_0x1f3032[_0x9678('0x3c')]=_0x1f3032[_0x9678('0x3c')]['length']?_0x1f3032[_0x9678('0x3c')]:_0x245aaf['model'];if(!_0x59789b[_0x9678('0x37')][_0x9678('0x3d')](_0x9678('0x3e'))){_0x1f3032[_0x9678('0x1b')]=qs[_0x9678('0x1b')](_0x59789b[_0x9678('0x37')]['limit']);_0x1f3032[_0x9678('0x1d')]=qs[_0x9678('0x1d')](_0x59789b[_0x9678('0x37')][_0x9678('0x1d')]);}_0x1f3032[_0x9678('0x3f')]=qs[_0x9678('0x40')](_0x59789b[_0x9678('0x37')][_0x9678('0x40')]);_0x1f3032[_0x9678('0x41')]=qs['filters'](_[_0x9678('0x42')](_0x59789b[_0x9678('0x37')],_0x245aaf[_0x9678('0x39')]),_0x36d18d);if(_0x59789b[_0x9678('0x37')][_0x9678('0x43')]){_0x1f3032['where']=_[_0x9678('0x2b')](_0x1f3032[_0x9678('0x41')],{'$or':[{'key':{'$like':'%'+_0x59789b['query']['filter']+'%'}},{'value':{'$like':'%'+_0x59789b[_0x9678('0x37')][_0x9678('0x43')]+'%'}}]});}_0x1f3032=_[_0x9678('0x2b')]({},_0x1f3032,_0x59789b[_0x9678('0x44')]);var _0x49cb20={'where':_0x1f3032['where']};return db[_0x9678('0x33')][_0x9678('0x1c')](_0x49cb20)[_0x9678('0x23')](function(_0x186282){_0x3fcdd9[_0x9678('0x1c')]=_0x186282;if(_0x59789b[_0x9678('0x37')]['includeAll']){_0x1f3032[_0x9678('0x45')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9678('0x46')](_0x1f3032);})['then'](function(_0x506eb5){_0x3fcdd9['rows']=_0x506eb5;return _0x3fcdd9;})[_0x9678('0x23')](respondWithFilteredResult(_0x10f389,_0x1f3032))[_0x9678('0x47')](handleError(_0x10f389,null));};exports[_0x9678('0x48')]=function(_0x3cacd8,_0x19371e){var _0x44a671={'raw':!![],'where':{'id':_0x3cacd8[_0x9678('0x49')]['id']}},_0x374ca2={};_0x374ca2['model']=_['keys'](db[_0x9678('0x33')][_0x9678('0x4a')]);_0x374ca2[_0x9678('0x37')]=_['keys'](_0x3cacd8[_0x9678('0x37')]);_0x374ca2[_0x9678('0x39')]=_[_0x9678('0x3a')](_0x374ca2[_0x9678('0x36')],_0x374ca2[_0x9678('0x37')]);_0x44a671['attributes']=_[_0x9678('0x3a')](_0x374ca2[_0x9678('0x36')],qs[_0x9678('0x3b')](_0x3cacd8[_0x9678('0x37')][_0x9678('0x3b')]));_0x44a671[_0x9678('0x3c')]=_0x44a671[_0x9678('0x3c')][_0x9678('0x4b')]?_0x44a671[_0x9678('0x3c')]:_0x374ca2['model'];if(_0x3cacd8[_0x9678('0x37')][_0x9678('0x4c')]){_0x44a671[_0x9678('0x45')]=[{'all':!![]}];}_0x44a671=_['merge']({},_0x44a671,_0x3cacd8[_0x9678('0x44')]);return db[_0x9678('0x33')][_0x9678('0x4d')](_0x44a671)[_0x9678('0x23')](handleEntityNotFound(_0x19371e,null))[_0x9678('0x23')](respondWithResult(_0x19371e,null))[_0x9678('0x47')](handleError(_0x19371e,null));};exports[_0x9678('0x22')]=function(_0x1a75f8,_0x5410fc){if(_0x1a75f8[_0x9678('0x2c')]['id']){delete _0x1a75f8['body']['id'];}return db[_0x9678('0x33')][_0x9678('0x4d')]({'where':{'id':_0x1a75f8[_0x9678('0x49')]['id']}})[_0x9678('0x23')](handleEntityNotFound(_0x5410fc,null))['then'](saveUpdates(_0x1a75f8[_0x9678('0x2c')],null))[_0x9678('0x23')](respondWithResult(_0x5410fc,null))['catch'](handleError(_0x5410fc,null));};exports['destroy']=function(_0x5d5835,_0x4e0067){return db[_0x9678('0x33')][_0x9678('0x4d')]({'where':{'id':_0x5d5835[_0x9678('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e0067,null))['then'](removeEntity(_0x4e0067,null))['catch'](handleError(_0x4e0067,null));};exports[_0x9678('0x4e')]=function(_0x7bb357,_0x262773){var _0x568aca={'key':_0x7bb357[_0x9678('0x2c')][_0x9678('0x35')]};if(_0x7bb357[_0x9678('0x2c')][_0x9678('0x4f')]){_0x568aca[_0x9678('0x4f')]=_0x7bb357[_0x9678('0x2c')][_0x9678('0x4f')];}else if(_0x7bb357['body'][_0x9678('0x50')]){_0x568aca['SmsAccountId']=_0x7bb357[_0x9678('0x2c')][_0x9678('0x50')];}else if(_0x7bb357[_0x9678('0x2c')][_0x9678('0x51')]){_0x568aca['OpenchannelAccountId']=_0x7bb357[_0x9678('0x2c')]['OpenchannelAccountId'];}else if(_0x7bb357['body'][_0x9678('0x52')]){_0x568aca['ChatWebsiteId']=_0x7bb357[_0x9678('0x2c')][_0x9678('0x52')];}return db[_0x9678('0x33')]['find']({'where':_0x568aca})[_0x9678('0x23')](function(_0x2121ce){if(_0x2121ce){throw new db['Sequelize'][(_0x9678('0x53'))](_0x9678('0x54'));}return db[_0x9678('0x33')][_0x9678('0x4e')](_0x7bb357['body']);})['then'](function(_0xb9c16f){var _0xbc9f67=_0x7bb357[_0x9678('0x55')]['get']({'plain':!![]});if(!_0xbc9f67)throw new Error(_0x9678('0x56'));if(_0xbc9f67[_0x9678('0x57')]===_0x9678('0x55')){var _0x1c0a34=_0xb9c16f['get']({'plain':!![]});return db[_0x9678('0x58')][_0x9678('0x4d')]({'where':{'name':'CannedAnswers','userProfileId':_0xbc9f67[_0x9678('0x59')]},'raw':!![]})[_0x9678('0x23')](function(_0x336a40){if(_0x336a40&&_0x336a40[_0x9678('0x5a')]===0x0){return db[_0x9678('0x26')][_0x9678('0x4e')]({'name':_0x1c0a34[_0x9678('0x29')],'resourceId':_0x1c0a34['id'],'type':_0x336a40['name'],'sectionId':_0x336a40['id']},{})[_0x9678('0x23')](function(){return _0xb9c16f;});}else{return _0xb9c16f;}})['catch'](function(_0x53fb50){logger[_0x9678('0x27')](_0x9678('0x5b'),_0x53fb50);throw _0x53fb50;});}return _0xb9c16f;})[_0x9678('0x23')](respondWithResult(_0x262773,0xc9))[_0x9678('0x47')](handleError(_0x262773,null));}; \ No newline at end of file +var _0x30f9=['show','params','find','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','undefined','count','offset','limit','apply','save','update','destroy','then','get','CannedAnswers','error','stack','name','send','render','body','contact','message','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CannedAnswer','include','findAll','rows'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x30f9,0xc5));var _0x930f=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x30f9[_0x56f7e2];return _0x36240b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x930f('0x0'));var jsonpatch=require(_0x930f('0x1'));var rp=require(_0x930f('0x2'));var moment=require(_0x930f('0x3'));var BPromise=require(_0x930f('0x4'));var Mustache=require(_0x930f('0x5'));var util=require(_0x930f('0x6'));var path=require(_0x930f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x930f('0x8'));var fs=require('fs');var fs_extra=require(_0x930f('0x9'));var _=require(_0x930f('0xa'));var squel=require('squel');var crypto=require(_0x930f('0xb'));var jsforce=require(_0x930f('0xc'));var deskjs=require(_0x930f('0xd'));var toCsv=require(_0x930f('0xe'));var querystring=require(_0x930f('0xf'));var Papa=require(_0x930f('0x10'));var Redis=require(_0x930f('0x11'));var authService=require(_0x930f('0x12'));var qs=require(_0x930f('0x13'));var as=require(_0x930f('0x14'));var hardwareService=require(_0x930f('0x15'));var logger=require(_0x930f('0x16'))(_0x930f('0x17'));var utils=require('../../config/utils');var config=require(_0x930f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aae22,_0x509ad1){_0x509ad1=_0x509ad1||0xcc;return function(_0x726ed6){if(_0x726ed6){return _0x2aae22[_0x930f('0x19')](_0x509ad1);}return _0x2aae22[_0x930f('0x1a')](_0x509ad1)[_0x930f('0x1b')]();};}function respondWithResult(_0x3760a9,_0x41c747){_0x41c747=_0x41c747||0xc8;return function(_0x3ae186){if(_0x3ae186){return _0x3760a9['status'](_0x41c747)['json'](_0x3ae186);}};}function respondWithFilteredResult(_0x35f2a9,_0x137134){return function(_0x348bcb){if(_0x348bcb){var _0x1c22ac=typeof _0x137134['offset']===_0x930f('0x1c')&&typeof _0x137134['limit']===_0x930f('0x1c');var _0x525d4b=_0x348bcb[_0x930f('0x1d')];var _0x5aac0c=_0x1c22ac?0x0:_0x137134[_0x930f('0x1e')];var _0x175ad5=_0x1c22ac?_0x348bcb[_0x930f('0x1d')]:_0x137134['offset']+_0x137134[_0x930f('0x1f')];var _0x4a4cac;if(_0x175ad5>=_0x525d4b){_0x175ad5=_0x525d4b;_0x4a4cac=0xc8;}else{_0x4a4cac=0xce;}_0x35f2a9[_0x930f('0x1a')](_0x4a4cac);return _0x35f2a9['set']('Content-Range',_0x5aac0c+'-'+_0x175ad5+'/'+_0x525d4b)['json'](_0x348bcb);}return null;};}function patchUpdates(_0x5ee21e){return function(_0x3944a6){try{jsonpatch[_0x930f('0x20')](_0x3944a6,_0x5ee21e,!![]);}catch(_0x3f8567){return BPromise['reject'](_0x3f8567);}return _0x3944a6[_0x930f('0x21')]();};}function saveUpdates(_0x376ee7,_0x9a181f){return function(_0x1b57ab){if(_0x1b57ab){return _0x1b57ab[_0x930f('0x22')](_0x376ee7)['then'](function(_0x33f507){return _0x33f507;});}return null;};}function removeEntity(_0x591f6b,_0x3eeb63){return function(_0x1759cd){if(_0x1759cd){return _0x1759cd[_0x930f('0x23')]()[_0x930f('0x24')](function(){var _0x8c7962=_0x1759cd[_0x930f('0x25')]({'plain':!![]});var _0x4a6058=_0x930f('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x4a6058,'resourceId':_0x8c7962['id']}})[_0x930f('0x24')](function(){return _0x1759cd;});})[_0x930f('0x24')](function(){_0x591f6b[_0x930f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d45e6,_0xb05646){return function(_0xe9cd48){if(!_0xe9cd48){_0x5d45e6[_0x930f('0x19')](0x194);}return _0xe9cd48;};}function handleError(_0x598ac8,_0x5e4c76){_0x5e4c76=_0x5e4c76||0x1f4;return function(_0x569885){logger[_0x930f('0x27')](_0x569885[_0x930f('0x28')]);if(_0x569885['name']){delete _0x569885[_0x930f('0x29')];}_0x598ac8[_0x930f('0x1a')](_0x5e4c76)[_0x930f('0x2a')](_0x569885);};}function getMustacheRender(_0x4f294a,_0x245301){return Mustache[_0x930f('0x2b')](_0x4f294a,_['merge'](_0x245301[_0x930f('0x2c')],{'contact':_0x245301[_0x930f('0x2d')],'message':_0x245301[_0x930f('0x2e')],'agent':_0x245301['agent'],'interaction':_0x245301['interaction'],'account':_0x245301['account']}))||'';}exports[_0x930f('0x2f')]=function(_0x113561,_0x4b483e){var _0x45df16={},_0xd1e94a={},_0x40d9a1={'count':0x0,'rows':[]};var _0x2d9c56=_['map'](db['CannedAnswer'][_0x930f('0x30')],function(_0x465222){return{'name':_0x465222[_0x930f('0x31')],'type':_0x465222['type'][_0x930f('0x32')]};});_0xd1e94a[_0x930f('0x33')]=_[_0x930f('0x34')](_0x2d9c56,_0x930f('0x29'));_0xd1e94a[_0x930f('0x35')]=_[_0x930f('0x36')](_0x113561[_0x930f('0x35')]);_0xd1e94a[_0x930f('0x37')]=_[_0x930f('0x38')](_0xd1e94a[_0x930f('0x33')],_0xd1e94a[_0x930f('0x35')]);_0x45df16[_0x930f('0x39')]=_['intersection'](_0xd1e94a[_0x930f('0x33')],qs[_0x930f('0x3a')](_0x113561[_0x930f('0x35')][_0x930f('0x3a')]));_0x45df16[_0x930f('0x39')]=_0x45df16[_0x930f('0x39')][_0x930f('0x3b')]?_0x45df16[_0x930f('0x39')]:_0xd1e94a[_0x930f('0x33')];if(!_0x113561[_0x930f('0x35')][_0x930f('0x3c')](_0x930f('0x3d'))){_0x45df16['limit']=qs[_0x930f('0x1f')](_0x113561['query']['limit']);_0x45df16['offset']=qs[_0x930f('0x1e')](_0x113561[_0x930f('0x35')][_0x930f('0x1e')]);}_0x45df16[_0x930f('0x3e')]=qs[_0x930f('0x3f')](_0x113561[_0x930f('0x35')]['sort']);_0x45df16[_0x930f('0x40')]=qs[_0x930f('0x37')](_[_0x930f('0x41')](_0x113561['query'],_0xd1e94a[_0x930f('0x37')]),_0x2d9c56);if(_0x113561[_0x930f('0x35')][_0x930f('0x42')]){_0x45df16['where']=_['merge'](_0x45df16[_0x930f('0x40')],{'$or':[{'key':{'$like':'%'+_0x113561['query']['filter']+'%'}},{'value':{'$like':'%'+_0x113561[_0x930f('0x35')][_0x930f('0x42')]+'%'}}]});}_0x45df16=_[_0x930f('0x43')]({},_0x45df16,_0x113561[_0x930f('0x44')]);var _0x2cfdbe={'where':_0x45df16['where']};return db[_0x930f('0x45')]['count'](_0x2cfdbe)['then'](function(_0x352089){_0x40d9a1[_0x930f('0x1d')]=_0x352089;if(_0x113561['query']['includeAll']){_0x45df16[_0x930f('0x46')]=[{'all':!![]}];}return db[_0x930f('0x45')][_0x930f('0x47')](_0x45df16);})['then'](function(_0x504bcd){_0x40d9a1[_0x930f('0x48')]=_0x504bcd;return _0x40d9a1;})[_0x930f('0x24')](respondWithFilteredResult(_0x4b483e,_0x45df16))['catch'](handleError(_0x4b483e,null));};exports[_0x930f('0x49')]=function(_0x4e8794,_0x4c1853){var _0x4ee32c={'raw':!![],'where':{'id':_0x4e8794[_0x930f('0x4a')]['id']}},_0x38e4c6={};_0x38e4c6[_0x930f('0x33')]=_[_0x930f('0x36')](db[_0x930f('0x45')][_0x930f('0x30')]);_0x38e4c6[_0x930f('0x35')]=_[_0x930f('0x36')](_0x4e8794['query']);_0x38e4c6[_0x930f('0x37')]=_[_0x930f('0x38')](_0x38e4c6[_0x930f('0x33')],_0x38e4c6[_0x930f('0x35')]);_0x4ee32c[_0x930f('0x39')]=_[_0x930f('0x38')](_0x38e4c6[_0x930f('0x33')],qs['fields'](_0x4e8794['query'][_0x930f('0x3a')]));_0x4ee32c['attributes']=_0x4ee32c['attributes'][_0x930f('0x3b')]?_0x4ee32c[_0x930f('0x39')]:_0x38e4c6[_0x930f('0x33')];if(_0x4e8794['query']['includeAll']){_0x4ee32c['include']=[{'all':!![]}];}_0x4ee32c=_[_0x930f('0x43')]({},_0x4ee32c,_0x4e8794[_0x930f('0x44')]);return db['CannedAnswer'][_0x930f('0x4b')](_0x4ee32c)['then'](handleEntityNotFound(_0x4c1853,null))['then'](respondWithResult(_0x4c1853,null))[_0x930f('0x4c')](handleError(_0x4c1853,null));};exports[_0x930f('0x22')]=function(_0x3420c4,_0x284dad){if(_0x3420c4[_0x930f('0x2c')]['id']){delete _0x3420c4[_0x930f('0x2c')]['id'];}return db[_0x930f('0x45')][_0x930f('0x4b')]({'where':{'id':_0x3420c4[_0x930f('0x4a')]['id']}})[_0x930f('0x24')](handleEntityNotFound(_0x284dad,null))[_0x930f('0x24')](saveUpdates(_0x3420c4[_0x930f('0x2c')],null))['then'](respondWithResult(_0x284dad,null))[_0x930f('0x4c')](handleError(_0x284dad,null));};exports[_0x930f('0x23')]=function(_0x360b23,_0x1b9a05){return db[_0x930f('0x45')][_0x930f('0x4b')]({'where':{'id':_0x360b23['params']['id']}})[_0x930f('0x24')](handleEntityNotFound(_0x1b9a05,null))[_0x930f('0x24')](removeEntity(_0x1b9a05,null))[_0x930f('0x4c')](handleError(_0x1b9a05,null));};exports[_0x930f('0x4d')]=function(_0x10593e,_0x7c4486){var _0xff8ce={'key':_0x10593e[_0x930f('0x2c')][_0x930f('0x32')]};if(_0x10593e['body'][_0x930f('0x4e')]){_0xff8ce[_0x930f('0x4e')]=_0x10593e[_0x930f('0x2c')][_0x930f('0x4e')];}else if(_0x10593e[_0x930f('0x2c')]['SmsAccountId']){_0xff8ce[_0x930f('0x4f')]=_0x10593e[_0x930f('0x2c')][_0x930f('0x4f')];}else if(_0x10593e['body']['OpenchannelAccountId']){_0xff8ce[_0x930f('0x50')]=_0x10593e[_0x930f('0x2c')]['OpenchannelAccountId'];}else if(_0x10593e[_0x930f('0x2c')]['ChatWebsiteId']){_0xff8ce[_0x930f('0x51')]=_0x10593e[_0x930f('0x2c')][_0x930f('0x51')];}return db[_0x930f('0x45')][_0x930f('0x4b')]({'where':_0xff8ce})[_0x930f('0x24')](function(_0x1f3b85){if(_0x1f3b85){throw new db[(_0x930f('0x52'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x930f('0x4d')](_0x10593e[_0x930f('0x2c')]);})[_0x930f('0x24')](function(_0x4c8e37){var _0x1d2833=_0x10593e[_0x930f('0x53')]['get']({'plain':!![]});if(!_0x1d2833)throw new Error(_0x930f('0x54'));if(_0x1d2833[_0x930f('0x55')]==='user'){var _0x3374eb=_0x4c8e37['get']({'plain':!![]});return db[_0x930f('0x56')]['find']({'where':{'name':_0x930f('0x26'),'userProfileId':_0x1d2833[_0x930f('0x57')]},'raw':!![]})[_0x930f('0x24')](function(_0x191058){if(_0x191058&&_0x191058['autoAssociation']===0x0){return db[_0x930f('0x58')][_0x930f('0x4d')]({'name':_0x3374eb[_0x930f('0x29')],'resourceId':_0x3374eb['id'],'type':_0x191058[_0x930f('0x29')],'sectionId':_0x191058['id']},{})[_0x930f('0x24')](function(){return _0x4c8e37;});}else{return _0x4c8e37;}})[_0x930f('0x4c')](function(_0x15000b){logger[_0x930f('0x27')](_0x930f('0x59'),_0x15000b);throw _0x15000b;});}return _0x4c8e37;})[_0x930f('0x24')](respondWithResult(_0x7c4486,0xc9))[_0x930f('0x4c')](handleError(_0x7c4486,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index e1e7055..58b495f 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 _0x0a62=['bluebird','request-promise','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a62,0x119));var _0x20a6=function(_0x573592,_0x5ef466){_0x573592=_0x573592-0x0;var _0x411ae5=_0x0a62[_0x573592];return _0x411ae5;};'use strict';var _=require(_0x20a6('0x0'));var util=require(_0x20a6('0x1'));var logger=require(_0x20a6('0x2'))(_0x20a6('0x3'));var moment=require(_0x20a6('0x4'));var BPromise=require(_0x20a6('0x5'));var rp=require(_0x20a6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x20a6('0x7'));var attributes=require(_0x20a6('0x8'));module['exports']=function(_0x5629dd,_0x274d40){return _0x5629dd[_0x20a6('0x9')](_0x20a6('0xa'),attributes,{'tableName':_0x20a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x20a6('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd64b=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x6bbba3,_0x473e95){var _0x7ce6e1=function(_0x2e1649){while(--_0x2e1649){_0x6bbba3['push'](_0x6bbba3['shift']());}};_0x7ce6e1(++_0x473e95);}(_0xd64b,0xc1));var _0xbd64=function(_0x5b041b,_0x39f3a8){_0x5b041b=_0x5b041b-0x0;var _0x345afd=_0xd64b[_0x5b041b];return _0x345afd;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var fs=require('fs');var path=require(_0xbd64('0x5'));var rimraf=require(_0xbd64('0x6'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x51e87d,_0x58e9e7){return _0x51e87d[_0xbd64('0x7')](_0xbd64('0x8'),attributes,{'tableName':_0xbd64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd64('0xa'),'collate':_0xbd64('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 72ffd47..7ce6fb1 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 _0xe901=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message'];(function(_0x2e58f5,_0x44502e){var _0x1fd29d=function(_0x56bd8d){while(--_0x56bd8d){_0x2e58f5['push'](_0x2e58f5['shift']());}};_0x1fd29d(++_0x44502e);}(_0xe901,0xfb));var _0x1e90=function(_0x1c7ac2,_0x295452){_0x1c7ac2=_0x1c7ac2-0x0;var _0xa6128f=_0xe901[_0x1c7ac2];return _0xa6128f;};'use strict';var _=require(_0x1e90('0x0'));var util=require(_0x1e90('0x1'));var moment=require(_0x1e90('0x2'));var BPromise=require(_0x1e90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e90('0x4'));var db=require(_0x1e90('0x5'))['db'];var utils=require(_0x1e90('0x6'));var logger=require(_0x1e90('0x7'))(_0x1e90('0x8'));var config=require(_0x1e90('0x9'));var jayson=require(_0x1e90('0xa'));var client=jayson[_0x1e90('0xb')][_0x1e90('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29fae8,_0x4e4307,_0x5cae3f){return new BPromise(function(_0x1c71c5,_0x58c9d8){return client[_0x1e90('0xd')](_0x29fae8,_0x5cae3f)[_0x1e90('0xe')](function(_0x9b004d){logger[_0x1e90('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x4e4307,'request\x20sent');logger[_0x1e90('0x10')](_0x1e90('0x11'),_0x4e4307,_0x1e90('0x12'),JSON[_0x1e90('0x13')](_0x9b004d));if(_0x9b004d[_0x1e90('0x14')]){if(_0x9b004d[_0x1e90('0x14')][_0x1e90('0x15')]===0x1f4){logger[_0x1e90('0x14')](_0x1e90('0x16'),_0x4e4307,_0x9b004d[_0x1e90('0x14')][_0x1e90('0x17')]);return _0x58c9d8(_0x9b004d[_0x1e90('0x14')]['message']);}logger[_0x1e90('0x14')](_0x1e90('0x16'),_0x4e4307,_0x9b004d['error'][_0x1e90('0x17')]);return _0x1c71c5(_0x9b004d[_0x1e90('0x14')][_0x1e90('0x17')]);}else{logger[_0x1e90('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x4e4307,_0x1e90('0x12'));_0x1c71c5(_0x9b004d[_0x1e90('0x18')][_0x1e90('0x17')]);}})['catch'](function(_0xcf3a5f){logger[_0x1e90('0x14')](_0x1e90('0x16'),_0x4e4307,_0xcf3a5f);_0x58c9d8(_0xcf3a5f);});});} \ No newline at end of file +var _0x1b17=['rpc','../../config/environment','jayson/promise','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x24fc50,_0x28e0fe){var _0x8befc3=function(_0x4abc08){while(--_0x4abc08){_0x24fc50['push'](_0x24fc50['shift']());}};_0x8befc3(++_0x28e0fe);}(_0x1b17,0x135));var _0x71b1=function(_0x2d3a4d,_0x47561e){_0x2d3a4d=_0x2d3a4d-0x0;var _0x3a94a3=_0x1b17[_0x2d3a4d];return _0x3a94a3;};'use strict';var _=require(_0x71b1('0x0'));var util=require(_0x71b1('0x1'));var moment=require(_0x71b1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71b1('0x3'));var db=require(_0x71b1('0x4'))['db'];var utils=require(_0x71b1('0x5'));var logger=require('../../config/logger')(_0x71b1('0x6'));var config=require(_0x71b1('0x7'));var jayson=require(_0x71b1('0x8'));var client=jayson['client'][_0x71b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x318285,_0x3161c7,_0x3c9627){return new BPromise(function(_0x32dc4c,_0x5197b8){return client[_0x71b1('0xa')](_0x318285,_0x3c9627)[_0x71b1('0xb')](function(_0x4b3152){logger[_0x71b1('0xc')](_0x71b1('0xd'),_0x3161c7,_0x71b1('0xe'));logger[_0x71b1('0xf')](_0x71b1('0x10'),_0x3161c7,_0x71b1('0xe'),JSON['stringify'](_0x4b3152));if(_0x4b3152[_0x71b1('0x11')]){if(_0x4b3152[_0x71b1('0x11')][_0x71b1('0x12')]===0x1f4){logger[_0x71b1('0x11')](_0x71b1('0xd'),_0x3161c7,_0x4b3152[_0x71b1('0x11')][_0x71b1('0x13')]);return _0x5197b8(_0x4b3152[_0x71b1('0x11')][_0x71b1('0x13')]);}logger[_0x71b1('0x11')](_0x71b1('0xd'),_0x3161c7,_0x4b3152['error']['message']);return _0x32dc4c(_0x4b3152[_0x71b1('0x11')]['message']);}else{logger[_0x71b1('0xc')](_0x71b1('0xd'),_0x3161c7,_0x71b1('0xe'));_0x32dc4c(_0x4b3152[_0x71b1('0x14')]['message']);}})['catch'](function(_0x4a9c58){logger[_0x71b1('0x11')](_0x71b1('0xd'),_0x3161c7,_0x4a9c58);_0x5197b8(_0x4a9c58);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index bfe0c4c..3f0f8a3 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 _0xa0b8=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show'];(function(_0x18d659,_0x2e92ad){var _0x36cf24=function(_0x3f708a){while(--_0x3f708a){_0x18d659['push'](_0x18d659['shift']());}};_0x36cf24(++_0x2e92ad);}(_0xa0b8,0x133));var _0x8a0b=function(_0x1263cc,_0x34b0a6){_0x1263cc=_0x1263cc-0x0;var _0x4132a0=_0xa0b8[_0x1263cc];return _0x4132a0;};'use strict';var multer=require(_0x8a0b('0x0'));var util=require('util');var path=require(_0x8a0b('0x1'));var timeout=require(_0x8a0b('0x2'));var express=require(_0x8a0b('0x3'));var router=express[_0x8a0b('0x4')]();var fs_extra=require(_0x8a0b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8a0b('0x6'));var config=require(_0x8a0b('0x7'));var controller=require(_0x8a0b('0x8'));router[_0x8a0b('0x9')]('/',auth[_0x8a0b('0xa')](),controller[_0x8a0b('0xb')]);router[_0x8a0b('0x9')]('/:id',auth[_0x8a0b('0xa')](),controller[_0x8a0b('0xc')]);router[_0x8a0b('0xd')]('/',auth[_0x8a0b('0xa')](),controller[_0x8a0b('0xe')]);router[_0x8a0b('0xf')]('/:id',auth[_0x8a0b('0xa')](),controller[_0x8a0b('0x10')]);router[_0x8a0b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8a0b('0x12')]);module[_0x8a0b('0x13')]=router; \ No newline at end of file +var _0xaf7d=['get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xaf7d,0x6f));var _0xdaf7=function(_0x41b37f,_0x48a056){_0x41b37f=_0x41b37f-0x0;var _0x22d1c7=_0xaf7d[_0x41b37f];return _0x22d1c7;};'use strict';var multer=require('multer');var util=require(_0xdaf7('0x0'));var path=require(_0xdaf7('0x1'));var timeout=require(_0xdaf7('0x2'));var express=require('express');var router=express[_0xdaf7('0x3')]();var fs_extra=require(_0xdaf7('0x4'));var auth=require(_0xdaf7('0x5'));var interaction=require(_0xdaf7('0x6'));var config=require(_0xdaf7('0x7'));var controller=require(_0xdaf7('0x8'));router[_0xdaf7('0x9')]('/',auth[_0xdaf7('0xa')](),controller[_0xdaf7('0xb')]);router['get'](_0xdaf7('0xc'),auth[_0xdaf7('0xa')](),controller[_0xdaf7('0xd')]);router[_0xdaf7('0xe')]('/',auth[_0xdaf7('0xa')](),controller['create']);router[_0xdaf7('0xf')](_0xdaf7('0xc'),auth[_0xdaf7('0xa')](),controller[_0xdaf7('0x10')]);router[_0xdaf7('0x11')](_0xdaf7('0xc'),auth['isAuthenticated'](),controller[_0xdaf7('0x12')]);module[_0xdaf7('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 16f5597..fabc4cf 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 _0xe99d=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x262548,_0x15dc38){var _0x4d16aa=function(_0x9d5663){while(--_0x9d5663){_0x262548['push'](_0x262548['shift']());}};_0x4d16aa(++_0x15dc38);}(_0xe99d,0x137));var _0xde99=function(_0x5873ea,_0x46ced5){_0x5873ea=_0x5873ea-0x0;var _0x56eb2e=_0xe99d[_0x5873ea];return _0x56eb2e;};'use strict';var Sequelize=require(_0xde99('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xde99('0x1')],'allowNull':![],'defaultValue':_0xde99('0x2')},'clid':{'type':Sequelize[_0xde99('0x3')]},'src':{'type':Sequelize[_0xde99('0x3')]},'dst':{'type':Sequelize[_0xde99('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xde99('0x3')]},'dstchannel':{'type':Sequelize[_0xde99('0x3')]},'lastapp':{'type':Sequelize[_0xde99('0x3')]},'lastdata':{'type':Sequelize[_0xde99('0x3')]},'duration':{'type':Sequelize[_0xde99('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xde99('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xde99('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xde99('0x3')]},'uniqueid':{'type':Sequelize[_0xde99('0x3')]},'linkedid':{'type':Sequelize[_0xde99('0x3')]},'sequence':{'type':Sequelize[_0xde99('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xde99('0x3')]}}; \ No newline at end of file +var _0x1eaf=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x3eab53,_0x326f8a){var _0x2ab3f3=function(_0x3a56ee){while(--_0x3a56ee){_0x3eab53['push'](_0x3eab53['shift']());}};_0x2ab3f3(++_0x326f8a);}(_0x1eaf,0x71));var _0xf1ea=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1eaf[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xf1ea('0x0'));module[_0xf1ea('0x1')]={'calldate':{'type':Sequelize[_0xf1ea('0x2')],'allowNull':![],'defaultValue':_0xf1ea('0x3')},'clid':{'type':Sequelize[_0xf1ea('0x4')]},'src':{'type':Sequelize[_0xf1ea('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xf1ea('0x4')]},'channel':{'type':Sequelize[_0xf1ea('0x4')]},'dstchannel':{'type':Sequelize[_0xf1ea('0x4')]},'lastapp':{'type':Sequelize[_0xf1ea('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xf1ea('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf1ea('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf1ea('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf1ea('0x4')]},'userfield':{'type':Sequelize[_0xf1ea('0x4')]},'uniqueid':{'type':Sequelize[_0xf1ea('0x4')]},'linkedid':{'type':Sequelize[_0xf1ea('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xf1ea('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xf1ea('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 466fada..44deffb 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 _0xae87=['apply','reject','save','update','then','destroy','status','error','stack','name','send','render','body','contact','message','agent','interaction','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','show','keys','length','include','merge','find','catch','create','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','offset','limit','undefined','count','set','Content-Range','json'];(function(_0x76d804,_0xb92a74){var _0x5b6d51=function(_0x8c378){while(--_0x8c378){_0x76d804['push'](_0x76d804['shift']());}};_0x5b6d51(++_0xb92a74);}(_0xae87,0x12f));var _0x7ae8=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0xae87[_0x195c21];return _0x3576a8;};'use strict';var emlformat=require(_0x7ae8('0x0'));var rimraf=require(_0x7ae8('0x1'));var zipdir=require(_0x7ae8('0x2'));var jsonpatch=require(_0x7ae8('0x3'));var rp=require(_0x7ae8('0x4'));var moment=require('moment');var BPromise=require(_0x7ae8('0x5'));var Mustache=require(_0x7ae8('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7ae8('0x7'));var csv=require('to-csv');var ejs=require(_0x7ae8('0x8'));var fs=require('fs');var fs_extra=require(_0x7ae8('0x9'));var _=require(_0x7ae8('0xa'));var squel=require(_0x7ae8('0xb'));var crypto=require(_0x7ae8('0xc'));var jsforce=require(_0x7ae8('0xd'));var deskjs=require(_0x7ae8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7ae8('0xf'));var Papa=require(_0x7ae8('0x10'));var Redis=require(_0x7ae8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7ae8('0x12'));var as=require(_0x7ae8('0x13'));var hardwareService=require(_0x7ae8('0x14'));var logger=require(_0x7ae8('0x15'))(_0x7ae8('0x16'));var utils=require('../../config/utils');var config=require(_0x7ae8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ae8('0x18'))['db'];function respondWithStatusCode(_0x4741be,_0xe306fb){_0xe306fb=_0xe306fb||0xcc;return function(_0x568e47){if(_0x568e47){return _0x4741be[_0x7ae8('0x19')](_0xe306fb);}return _0x4741be['status'](_0xe306fb)['end']();};}function respondWithResult(_0x4781e9,_0x2ec124){_0x2ec124=_0x2ec124||0xc8;return function(_0x3ca1e4){if(_0x3ca1e4){return _0x4781e9['status'](_0x2ec124)['json'](_0x3ca1e4);}};}function respondWithFilteredResult(_0x3f2671,_0x5e2d80){return function(_0x1bae45){if(_0x1bae45){var _0x1ec565=typeof _0x5e2d80[_0x7ae8('0x1a')]==='undefined'&&typeof _0x5e2d80[_0x7ae8('0x1b')]===_0x7ae8('0x1c');var _0x101ea6=_0x1bae45[_0x7ae8('0x1d')];var _0x240a5f=_0x1ec565?0x0:_0x5e2d80[_0x7ae8('0x1a')];var _0x209d96=_0x1ec565?_0x1bae45['count']:_0x5e2d80[_0x7ae8('0x1a')]+_0x5e2d80[_0x7ae8('0x1b')];var _0x5d53c2;if(_0x209d96>=_0x101ea6){_0x209d96=_0x101ea6;_0x5d53c2=0xc8;}else{_0x5d53c2=0xce;}_0x3f2671['status'](_0x5d53c2);return _0x3f2671[_0x7ae8('0x1e')](_0x7ae8('0x1f'),_0x240a5f+'-'+_0x209d96+'/'+_0x101ea6)[_0x7ae8('0x20')](_0x1bae45);}return null;};}function patchUpdates(_0x655430){return function(_0x5f3fa8){try{jsonpatch[_0x7ae8('0x21')](_0x5f3fa8,_0x655430,!![]);}catch(_0x3567da){return BPromise[_0x7ae8('0x22')](_0x3567da);}return _0x5f3fa8[_0x7ae8('0x23')]();};}function saveUpdates(_0x3068d4,_0x892d27){return function(_0x1838f3){if(_0x1838f3){return _0x1838f3[_0x7ae8('0x24')](_0x3068d4)[_0x7ae8('0x25')](function(_0x566776){return _0x566776;});}return null;};}function removeEntity(_0xfdbda1,_0x1baf58){return function(_0x1c48e2){if(_0x1c48e2){return _0x1c48e2[_0x7ae8('0x26')]()[_0x7ae8('0x25')](function(){_0xfdbda1[_0x7ae8('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58f980,_0xa7a6b8){return function(_0x38875c){if(!_0x38875c){_0x58f980['sendStatus'](0x194);}return _0x38875c;};}function handleError(_0x2c66a8,_0x2ec92d){_0x2ec92d=_0x2ec92d||0x1f4;return function(_0x5fdfa7){logger[_0x7ae8('0x28')](_0x5fdfa7[_0x7ae8('0x29')]);if(_0x5fdfa7[_0x7ae8('0x2a')]){delete _0x5fdfa7[_0x7ae8('0x2a')];}_0x2c66a8['status'](_0x2ec92d)[_0x7ae8('0x2b')](_0x5fdfa7);};}function getMustacheRender(_0x2a5324,_0x56638e){return Mustache[_0x7ae8('0x2c')](_0x2a5324,_['merge'](_0x56638e[_0x7ae8('0x2d')],{'contact':_0x56638e[_0x7ae8('0x2e')],'message':_0x56638e[_0x7ae8('0x2f')],'agent':_0x56638e[_0x7ae8('0x30')],'interaction':_0x56638e[_0x7ae8('0x31')],'account':_0x56638e['account']}))||'';}exports[_0x7ae8('0x32')]=function(_0x287510,_0x42ccfd){var _0x2cd132={},_0x56bc43={},_0x578e45={'count':0x0,'rows':[]};var _0x1ec581=_[_0x7ae8('0x33')](db[_0x7ae8('0x34')][_0x7ae8('0x35')],function(_0x780967){return{'name':_0x780967[_0x7ae8('0x36')],'type':_0x780967[_0x7ae8('0x37')][_0x7ae8('0x38')]};});_0x56bc43[_0x7ae8('0x39')]=_[_0x7ae8('0x33')](_0x1ec581,_0x7ae8('0x2a'));_0x56bc43['query']=_['keys'](_0x287510[_0x7ae8('0x3a')]);_0x56bc43[_0x7ae8('0x3b')]=_[_0x7ae8('0x3c')](_0x56bc43[_0x7ae8('0x39')],_0x56bc43[_0x7ae8('0x3a')]);_0x2cd132['attributes']=_[_0x7ae8('0x3c')](_0x56bc43[_0x7ae8('0x39')],qs[_0x7ae8('0x3d')](_0x287510['query'][_0x7ae8('0x3d')]));_0x2cd132[_0x7ae8('0x3e')]=_0x2cd132[_0x7ae8('0x3e')]['length']?_0x2cd132[_0x7ae8('0x3e')]:_0x56bc43['model'];if(!_0x287510[_0x7ae8('0x3a')][_0x7ae8('0x3f')](_0x7ae8('0x40'))){_0x2cd132['limit']=qs['limit'](_0x287510[_0x7ae8('0x3a')][_0x7ae8('0x1b')]);_0x2cd132[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x287510[_0x7ae8('0x3a')][_0x7ae8('0x1a')]);}_0x2cd132[_0x7ae8('0x41')]=qs['sort'](_0x287510[_0x7ae8('0x3a')][_0x7ae8('0x42')]);_0x2cd132[_0x7ae8('0x43')]=qs[_0x7ae8('0x3b')](_[_0x7ae8('0x44')](_0x287510[_0x7ae8('0x3a')],_0x56bc43[_0x7ae8('0x3b')]),_0x1ec581);if(_0x287510['query'][_0x7ae8('0x45')]){_0x2cd132[_0x7ae8('0x43')]=_['merge'](_0x2cd132['where'],{'$or':_[_0x7ae8('0x33')](_0x1ec581,function(_0x385efc){if(_0x385efc[_0x7ae8('0x37')]!==_0x7ae8('0x46')){var _0x136088={};_0x136088[_0x385efc[_0x7ae8('0x2a')]]={'$like':'%'+_0x287510[_0x7ae8('0x3a')][_0x7ae8('0x45')]+'%'};return _0x136088;}})});}_0x2cd132=_['merge']({},_0x2cd132,_0x287510['options']);var _0x3f25f6={'where':_0x2cd132[_0x7ae8('0x43')]};return db['Cdr'][_0x7ae8('0x1d')](_0x3f25f6)[_0x7ae8('0x25')](function(_0x342db8){_0x578e45[_0x7ae8('0x1d')]=_0x342db8;if(_0x287510['query'][_0x7ae8('0x47')]){_0x2cd132['include']=[{'all':!![]}];}return db[_0x7ae8('0x34')][_0x7ae8('0x48')](_0x2cd132);})[_0x7ae8('0x25')](function(_0x467724){_0x578e45[_0x7ae8('0x49')]=_0x467724;return _0x578e45;})[_0x7ae8('0x25')](respondWithFilteredResult(_0x42ccfd,_0x2cd132))['catch'](handleError(_0x42ccfd,null));};exports[_0x7ae8('0x4a')]=function(_0x25cc4c,_0x36d790){var _0x4c65f8={'raw':!![],'where':{'id':_0x25cc4c['params']['id']}},_0x13134f={};_0x13134f['model']=_[_0x7ae8('0x4b')](db['Cdr'][_0x7ae8('0x35')]);_0x13134f[_0x7ae8('0x3a')]=_[_0x7ae8('0x4b')](_0x25cc4c[_0x7ae8('0x3a')]);_0x13134f[_0x7ae8('0x3b')]=_[_0x7ae8('0x3c')](_0x13134f[_0x7ae8('0x39')],_0x13134f[_0x7ae8('0x3a')]);_0x4c65f8[_0x7ae8('0x3e')]=_['intersection'](_0x13134f[_0x7ae8('0x39')],qs['fields'](_0x25cc4c[_0x7ae8('0x3a')][_0x7ae8('0x3d')]));_0x4c65f8[_0x7ae8('0x3e')]=_0x4c65f8[_0x7ae8('0x3e')][_0x7ae8('0x4c')]?_0x4c65f8[_0x7ae8('0x3e')]:_0x13134f[_0x7ae8('0x39')];if(_0x25cc4c[_0x7ae8('0x3a')][_0x7ae8('0x47')]){_0x4c65f8[_0x7ae8('0x4d')]=[{'all':!![]}];}_0x4c65f8=_[_0x7ae8('0x4e')]({},_0x4c65f8,_0x25cc4c['options']);return db[_0x7ae8('0x34')][_0x7ae8('0x4f')](_0x4c65f8)[_0x7ae8('0x25')](handleEntityNotFound(_0x36d790,null))[_0x7ae8('0x25')](respondWithResult(_0x36d790,null))[_0x7ae8('0x50')](handleError(_0x36d790,null));};exports[_0x7ae8('0x51')]=function(_0x3f7eab,_0x380443){return db[_0x7ae8('0x34')]['create'](_0x3f7eab['body'],{})[_0x7ae8('0x25')](respondWithResult(_0x380443,0xc9))['catch'](handleError(_0x380443,null));};exports[_0x7ae8('0x24')]=function(_0x33f7f4,_0x276a14){if(_0x33f7f4[_0x7ae8('0x2d')]['id']){delete _0x33f7f4[_0x7ae8('0x2d')]['id'];}return db[_0x7ae8('0x34')][_0x7ae8('0x4f')]({'where':{'id':_0x33f7f4[_0x7ae8('0x52')]['id']}})[_0x7ae8('0x25')](handleEntityNotFound(_0x276a14,null))['then'](saveUpdates(_0x33f7f4['body'],null))['then'](respondWithResult(_0x276a14,null))[_0x7ae8('0x50')](handleError(_0x276a14,null));};exports[_0x7ae8('0x26')]=function(_0x5d5948,_0x3775ce){return db[_0x7ae8('0x34')][_0x7ae8('0x4f')]({'where':{'id':_0x5d5948[_0x7ae8('0x52')]['id']}})[_0x7ae8('0x25')](handleEntityNotFound(_0x3775ce,null))[_0x7ae8('0x25')](removeEntity(_0x3775ce,null))[_0x7ae8('0x50')](handleError(_0x3775ce,null));};exports[_0x7ae8('0x53')]=function(_0x1fd8df,_0xdb7a){return db[_0x7ae8('0x34')][_0x7ae8('0x53')]()[_0x7ae8('0x25')](respondWithResult(_0xdb7a,null))[_0x7ae8('0x50')](handleError(_0xdb7a,null));}; \ No newline at end of file +var _0x6788=['intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','options','includeAll','include','findAll','catch','params','find','create','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent','index','map','Cdr','rawAttributes','type','model','keys','query','filters'];(function(_0x53eba7,_0x38744c){var _0x32491b=function(_0x61ea1d){while(--_0x61ea1d){_0x53eba7['push'](_0x53eba7['shift']());}};_0x32491b(++_0x38744c);}(_0x6788,0x159));var _0x8678=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x6788[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0x8678('0x0'));var rimraf=require(_0x8678('0x1'));var zipdir=require(_0x8678('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8678('0x3'));var BPromise=require(_0x8678('0x4'));var Mustache=require(_0x8678('0x5'));var util=require(_0x8678('0x6'));var path=require(_0x8678('0x7'));var sox=require('sox');var csv=require(_0x8678('0x8'));var ejs=require(_0x8678('0x9'));var fs=require('fs');var fs_extra=require(_0x8678('0xa'));var _=require(_0x8678('0xb'));var squel=require(_0x8678('0xc'));var crypto=require(_0x8678('0xd'));var jsforce=require(_0x8678('0xe'));var deskjs=require(_0x8678('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8678('0x10'));var Papa=require(_0x8678('0x11'));var Redis=require(_0x8678('0x12'));var authService=require(_0x8678('0x13'));var qs=require(_0x8678('0x14'));var as=require(_0x8678('0x15'));var hardwareService=require(_0x8678('0x16'));var logger=require(_0x8678('0x17'))(_0x8678('0x18'));var utils=require(_0x8678('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8678('0x1a'));var db=require(_0x8678('0x1b'))['db'];function respondWithStatusCode(_0x3f10b4,_0x92bddc){_0x92bddc=_0x92bddc||0xcc;return function(_0x4d508a){if(_0x4d508a){return _0x3f10b4[_0x8678('0x1c')](_0x92bddc);}return _0x3f10b4[_0x8678('0x1d')](_0x92bddc)[_0x8678('0x1e')]();};}function respondWithResult(_0x5564ba,_0x1b7873){_0x1b7873=_0x1b7873||0xc8;return function(_0x8937b8){if(_0x8937b8){return _0x5564ba['status'](_0x1b7873)[_0x8678('0x1f')](_0x8937b8);}};}function respondWithFilteredResult(_0x1e83ad,_0x498472){return function(_0x4fa7e6){if(_0x4fa7e6){var _0x5df838=typeof _0x498472[_0x8678('0x20')]===_0x8678('0x21')&&typeof _0x498472['limit']===_0x8678('0x21');var _0x3623cb=_0x4fa7e6[_0x8678('0x22')];var _0x486c55=_0x5df838?0x0:_0x498472[_0x8678('0x20')];var _0x24ccf8=_0x5df838?_0x4fa7e6[_0x8678('0x22')]:_0x498472[_0x8678('0x20')]+_0x498472['limit'];var _0x5a61a8;if(_0x24ccf8>=_0x3623cb){_0x24ccf8=_0x3623cb;_0x5a61a8=0xc8;}else{_0x5a61a8=0xce;}_0x1e83ad[_0x8678('0x1d')](_0x5a61a8);return _0x1e83ad['set'](_0x8678('0x23'),_0x486c55+'-'+_0x24ccf8+'/'+_0x3623cb)['json'](_0x4fa7e6);}return null;};}function patchUpdates(_0x373149){return function(_0xdf7ef0){try{jsonpatch[_0x8678('0x24')](_0xdf7ef0,_0x373149,!![]);}catch(_0x297cad){return BPromise['reject'](_0x297cad);}return _0xdf7ef0[_0x8678('0x25')]();};}function saveUpdates(_0x4b3781,_0x2c047f){return function(_0x5e10ae){if(_0x5e10ae){return _0x5e10ae[_0x8678('0x26')](_0x4b3781)[_0x8678('0x27')](function(_0x14816a){return _0x14816a;});}return null;};}function removeEntity(_0x462f59,_0xaaddf2){return function(_0x2277cc){if(_0x2277cc){return _0x2277cc[_0x8678('0x28')]()['then'](function(){_0x462f59['status'](0xcc)[_0x8678('0x1e')]();});}};}function handleEntityNotFound(_0x1ff658,_0x3bf041){return function(_0x34587d){if(!_0x34587d){_0x1ff658[_0x8678('0x1c')](0x194);}return _0x34587d;};}function handleError(_0x2c0fc2,_0xc9e36e){_0xc9e36e=_0xc9e36e||0x1f4;return function(_0x2fbeec){logger[_0x8678('0x29')](_0x2fbeec[_0x8678('0x2a')]);if(_0x2fbeec[_0x8678('0x2b')]){delete _0x2fbeec['name'];}_0x2c0fc2[_0x8678('0x1d')](_0xc9e36e)[_0x8678('0x2c')](_0x2fbeec);};}function getMustacheRender(_0x745507,_0x587241){return Mustache[_0x8678('0x2d')](_0x745507,_[_0x8678('0x2e')](_0x587241[_0x8678('0x2f')],{'contact':_0x587241[_0x8678('0x30')],'message':_0x587241[_0x8678('0x31')],'agent':_0x587241[_0x8678('0x32')],'interaction':_0x587241['interaction'],'account':_0x587241['account']}))||'';}exports[_0x8678('0x33')]=function(_0x5d7a54,_0x3c0b63){var _0x5b00c3={},_0xf05d06={},_0x466edf={'count':0x0,'rows':[]};var _0x2fbec0=_[_0x8678('0x34')](db[_0x8678('0x35')][_0x8678('0x36')],function(_0x5b6f8e){return{'name':_0x5b6f8e['fieldName'],'type':_0x5b6f8e[_0x8678('0x37')]['key']};});_0xf05d06[_0x8678('0x38')]=_[_0x8678('0x34')](_0x2fbec0,_0x8678('0x2b'));_0xf05d06['query']=_[_0x8678('0x39')](_0x5d7a54[_0x8678('0x3a')]);_0xf05d06[_0x8678('0x3b')]=_[_0x8678('0x3c')](_0xf05d06[_0x8678('0x38')],_0xf05d06[_0x8678('0x3a')]);_0x5b00c3['attributes']=_[_0x8678('0x3c')](_0xf05d06[_0x8678('0x38')],qs[_0x8678('0x3d')](_0x5d7a54[_0x8678('0x3a')][_0x8678('0x3d')]));_0x5b00c3[_0x8678('0x3e')]=_0x5b00c3['attributes'][_0x8678('0x3f')]?_0x5b00c3[_0x8678('0x3e')]:_0xf05d06[_0x8678('0x38')];if(!_0x5d7a54[_0x8678('0x3a')][_0x8678('0x40')](_0x8678('0x41'))){_0x5b00c3['limit']=qs[_0x8678('0x42')](_0x5d7a54[_0x8678('0x3a')][_0x8678('0x42')]);_0x5b00c3[_0x8678('0x20')]=qs[_0x8678('0x20')](_0x5d7a54[_0x8678('0x3a')][_0x8678('0x20')]);}_0x5b00c3[_0x8678('0x43')]=qs[_0x8678('0x44')](_0x5d7a54['query'][_0x8678('0x44')]);_0x5b00c3['where']=qs[_0x8678('0x3b')](_[_0x8678('0x45')](_0x5d7a54[_0x8678('0x3a')],_0xf05d06[_0x8678('0x3b')]),_0x2fbec0);if(_0x5d7a54[_0x8678('0x3a')][_0x8678('0x46')]){_0x5b00c3[_0x8678('0x47')]=_[_0x8678('0x2e')](_0x5b00c3['where'],{'$or':_[_0x8678('0x34')](_0x2fbec0,function(_0x10667e){if(_0x10667e[_0x8678('0x37')]!=='VIRTUAL'){var _0x109613={};_0x109613[_0x10667e[_0x8678('0x2b')]]={'$like':'%'+_0x5d7a54[_0x8678('0x3a')]['filter']+'%'};return _0x109613;}})});}_0x5b00c3=_['merge']({},_0x5b00c3,_0x5d7a54[_0x8678('0x48')]);var _0x32bd16={'where':_0x5b00c3[_0x8678('0x47')]};return db['Cdr'][_0x8678('0x22')](_0x32bd16)[_0x8678('0x27')](function(_0x58c60d){_0x466edf[_0x8678('0x22')]=_0x58c60d;if(_0x5d7a54[_0x8678('0x3a')][_0x8678('0x49')]){_0x5b00c3[_0x8678('0x4a')]=[{'all':!![]}];}return db[_0x8678('0x35')][_0x8678('0x4b')](_0x5b00c3);})['then'](function(_0x3023ae){_0x466edf['rows']=_0x3023ae;return _0x466edf;})['then'](respondWithFilteredResult(_0x3c0b63,_0x5b00c3))[_0x8678('0x4c')](handleError(_0x3c0b63,null));};exports['show']=function(_0xd5cd81,_0x48487c){var _0xa467d3={'raw':!![],'where':{'id':_0xd5cd81[_0x8678('0x4d')]['id']}},_0x38b459={};_0x38b459[_0x8678('0x38')]=_[_0x8678('0x39')](db[_0x8678('0x35')][_0x8678('0x36')]);_0x38b459[_0x8678('0x3a')]=_[_0x8678('0x39')](_0xd5cd81[_0x8678('0x3a')]);_0x38b459[_0x8678('0x3b')]=_[_0x8678('0x3c')](_0x38b459[_0x8678('0x38')],_0x38b459[_0x8678('0x3a')]);_0xa467d3[_0x8678('0x3e')]=_[_0x8678('0x3c')](_0x38b459['model'],qs[_0x8678('0x3d')](_0xd5cd81[_0x8678('0x3a')][_0x8678('0x3d')]));_0xa467d3['attributes']=_0xa467d3['attributes'][_0x8678('0x3f')]?_0xa467d3[_0x8678('0x3e')]:_0x38b459[_0x8678('0x38')];if(_0xd5cd81['query'][_0x8678('0x49')]){_0xa467d3[_0x8678('0x4a')]=[{'all':!![]}];}_0xa467d3=_[_0x8678('0x2e')]({},_0xa467d3,_0xd5cd81['options']);return db['Cdr'][_0x8678('0x4e')](_0xa467d3)[_0x8678('0x27')](handleEntityNotFound(_0x48487c,null))[_0x8678('0x27')](respondWithResult(_0x48487c,null))[_0x8678('0x4c')](handleError(_0x48487c,null));};exports[_0x8678('0x4f')]=function(_0x16fe50,_0xa9d254){return db['Cdr'][_0x8678('0x4f')](_0x16fe50[_0x8678('0x2f')],{})['then'](respondWithResult(_0xa9d254,0xc9))[_0x8678('0x4c')](handleError(_0xa9d254,null));};exports[_0x8678('0x26')]=function(_0x37d37a,_0xf974a3){if(_0x37d37a[_0x8678('0x2f')]['id']){delete _0x37d37a[_0x8678('0x2f')]['id'];}return db['Cdr'][_0x8678('0x4e')]({'where':{'id':_0x37d37a[_0x8678('0x4d')]['id']}})[_0x8678('0x27')](handleEntityNotFound(_0xf974a3,null))['then'](saveUpdates(_0x37d37a[_0x8678('0x2f')],null))[_0x8678('0x27')](respondWithResult(_0xf974a3,null))[_0x8678('0x4c')](handleError(_0xf974a3,null));};exports[_0x8678('0x28')]=function(_0x4ab835,_0x5ed278){return db[_0x8678('0x35')]['find']({'where':{'id':_0x4ab835['params']['id']}})[_0x8678('0x27')](handleEntityNotFound(_0x5ed278,null))[_0x8678('0x27')](removeEntity(_0x5ed278,null))[_0x8678('0x4c')](handleError(_0x5ed278,null));};exports[_0x8678('0x50')]=function(_0x2e1c66,_0xe95133){return db['Cdr']['describe']()[_0x8678('0x27')](respondWithResult(_0xe95133,null))[_0x8678('0x4c')](handleError(_0xe95133,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index f631f18..18be60f 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 _0xe3da=['accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr'];(function(_0x251849,_0x361f8c){var _0xa344ab=function(_0x5a03b8){while(--_0x5a03b8){_0x251849['push'](_0x251849['shift']());}};_0xa344ab(++_0x361f8c);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]},{'name':'calldate','fields':['calldate']},{'name':_0xae3d('0xf'),'fields':[_0xae3d('0xf')]},{'name':_0xae3d('0x10'),'fields':[_0xae3d('0x10')]},{'name':_0xae3d('0x11'),'fields':[_0xae3d('0x11')]},{'name':'uniqueid','fields':[_0xae3d('0x12')]}],'timestamps':![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./cdr.attributes','define','Cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x53ec,0x192));var _0xc53e=function(_0x9f295b,_0x5d274d){_0x9f295b=_0x9f295b-0x0;var _0x36d06d=_0x53ec[_0x9f295b];return _0x36d06d;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]},{'name':_0xc53e('0xe'),'fields':[_0xc53e('0xe')]},{'name':_0xc53e('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0xc53e('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 830dee6..f4c6685 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 _0x8582=['http','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x8582,0xdf));var _0x2858=function(_0x410ab3,_0x3383ce){_0x410ab3=_0x410ab3-0x0;var _0x35a97a=_0x8582[_0x410ab3];return _0x35a97a;};'use strict';var _=require(_0x2858('0x0'));var util=require(_0x2858('0x1'));var moment=require('moment');var BPromise=require(_0x2858('0x2'));var rs=require(_0x2858('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2858('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2858('0x5'));var jayson=require(_0x2858('0x6'));var client=jayson[_0x2858('0x7')][_0x2858('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6d97fa,_0x2c6a84,_0x53bd97){return new BPromise(function(_0x43e91c,_0x5f3065){return client[_0x2858('0x9')](_0x6d97fa,_0x53bd97)[_0x2858('0xa')](function(_0x58374f){logger[_0x2858('0xb')](_0x2858('0xc'),_0x2c6a84,'request\x20sent');logger[_0x2858('0xd')](_0x2858('0xe'),_0x2c6a84,_0x2858('0xf'),JSON[_0x2858('0x10')](_0x58374f));if(_0x58374f[_0x2858('0x11')]){if(_0x58374f[_0x2858('0x11')]['code']===0x1f4){logger[_0x2858('0x11')](_0x2858('0xc'),_0x2c6a84,_0x58374f[_0x2858('0x11')][_0x2858('0x12')]);return _0x5f3065(_0x58374f[_0x2858('0x11')][_0x2858('0x12')]);}logger[_0x2858('0x11')]('Cdr,\x20%s,\x20%s',_0x2c6a84,_0x58374f[_0x2858('0x11')][_0x2858('0x12')]);return _0x43e91c(_0x58374f[_0x2858('0x11')]['message']);}else{logger[_0x2858('0xb')]('Cdr,\x20%s,\x20%s',_0x2c6a84,_0x2858('0xf'));_0x43e91c(_0x58374f[_0x2858('0x13')][_0x2858('0x12')]);}})[_0x2858('0x14')](function(_0x360ccb){logger[_0x2858('0x11')]('Cdr,\x20%s,\x20%s',_0x2c6a84,_0x360ccb);_0x5f3065(_0x360ccb);});});} \ No newline at end of file +var _0x2d45=['jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','Cdr,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x50d536,_0x41a698){var _0x20dbe7=function(_0x1e5e3a){while(--_0x1e5e3a){_0x50d536['push'](_0x50d536['shift']());}};_0x20dbe7(++_0x41a698);}(_0x2d45,0x109));var _0x52d4=function(_0x49143f,_0x5592de){_0x49143f=_0x49143f-0x0;var _0x181d27=_0x2d45[_0x49143f];return _0x181d27;};'use strict';var _=require(_0x52d4('0x0'));var util=require(_0x52d4('0x1'));var moment=require(_0x52d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x52d4('0x3'));var fs=require('fs');var Redis=require(_0x52d4('0x4'));var db=require(_0x52d4('0x5'))['db'];var utils=require(_0x52d4('0x6'));var logger=require(_0x52d4('0x7'))(_0x52d4('0x8'));var config=require(_0x52d4('0x9'));var jayson=require(_0x52d4('0xa'));var client=jayson[_0x52d4('0xb')][_0x52d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ddfea,_0x2a43d1,_0x230e6b){return new BPromise(function(_0x3677d0,_0x5480ff){return client[_0x52d4('0xd')](_0x4ddfea,_0x230e6b)[_0x52d4('0xe')](function(_0x4b6247){logger[_0x52d4('0xf')]('Cdr,\x20%s,\x20%s',_0x2a43d1,_0x52d4('0x10'));logger[_0x52d4('0x11')](_0x52d4('0x12'),_0x2a43d1,_0x52d4('0x10'),JSON[_0x52d4('0x13')](_0x4b6247));if(_0x4b6247[_0x52d4('0x14')]){if(_0x4b6247[_0x52d4('0x14')]['code']===0x1f4){logger[_0x52d4('0x14')]('Cdr,\x20%s,\x20%s',_0x2a43d1,_0x4b6247['error'][_0x52d4('0x15')]);return _0x5480ff(_0x4b6247[_0x52d4('0x14')][_0x52d4('0x15')]);}logger[_0x52d4('0x14')](_0x52d4('0x16'),_0x2a43d1,_0x4b6247[_0x52d4('0x14')][_0x52d4('0x15')]);return _0x3677d0(_0x4b6247['error'][_0x52d4('0x15')]);}else{logger[_0x52d4('0xf')](_0x52d4('0x16'),_0x2a43d1,_0x52d4('0x10'));_0x3677d0(_0x4b6247[_0x52d4('0x17')]['message']);}})[_0x52d4('0x18')](function(_0x3c4809){logger[_0x52d4('0x14')](_0x52d4('0x16'),_0x2a43d1,_0x3c4809);_0x5480ff(_0x3c4809);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c987412..3e3f10c 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 _0x0713=['fs-extra','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express'];(function(_0x272d58,_0x316e2d){var _0x11b242=function(_0x1dc812){while(--_0x1dc812){_0x272d58['push'](_0x272d58['shift']());}};_0x11b242(++_0x316e2d);}(_0x0713,0x18a));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var path=require(_0x3071('0x2'));var timeout=require(_0x3071('0x3'));var express=require(_0x3071('0x4'));var router=express['Router']();var fs_extra=require(_0x3071('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x6'));var config=require(_0x3071('0x7'));var controller=require(_0x3071('0x8'));router[_0x3071('0x9')]('/',auth[_0x3071('0xa')](),controller[_0x3071('0xb')]);router[_0x3071('0x9')](_0x3071('0xc'),auth['isAuthenticated'](),controller[_0x3071('0xd')]);router[_0x3071('0x9')]('/:id',auth[_0x3071('0xa')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')]('/',auth['isAuthenticated'](),controller[_0x3071('0x10')]);router[_0x3071('0x11')](_0x3071('0x12'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router[_0x3071('0x14')]('/:id',auth[_0x3071('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0c52=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cdr.controller','isAuthenticated','index','get','/describe','/:id','show','create','update','delete','destroy','exports'];(function(_0xd4fa88,_0x3f68bf){var _0x1ad003=function(_0x1b77d2){while(--_0x1b77d2){_0xd4fa88['push'](_0xd4fa88['shift']());}};_0x1ad003(++_0x3f68bf);}(_0x0c52,0x1a9));var _0x20c5=function(_0xf5723c,_0x1fbca0){_0xf5723c=_0xf5723c-0x0;var _0x3aa21b=_0x0c52[_0xf5723c];return _0x3aa21b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x20c5('0x0'));var express=require('express');var router=express[_0x20c5('0x1')]();var fs_extra=require(_0x20c5('0x2'));var auth=require(_0x20c5('0x3'));var interaction=require(_0x20c5('0x4'));var config=require('../../config/environment');var controller=require(_0x20c5('0x5'));router['get']('/',auth[_0x20c5('0x6')](),controller[_0x20c5('0x7')]);router[_0x20c5('0x8')](_0x20c5('0x9'),auth[_0x20c5('0x6')](),controller['describe']);router[_0x20c5('0x8')](_0x20c5('0xa'),auth[_0x20c5('0x6')](),controller[_0x20c5('0xb')]);router['post']('/',auth[_0x20c5('0x6')](),controller[_0x20c5('0xc')]);router['put'](_0x20c5('0xa'),auth[_0x20c5('0x6')](),controller[_0x20c5('0xd')]);router[_0x20c5('0xe')]('/:id',auth[_0x20c5('0x6')](),controller[_0x20c5('0xf')]);module[_0x20c5('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 21b3069..094498c 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 _0x34dc=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x4bf2d0,_0x4a78f2){var _0x32c4cd=function(_0x2b2681){while(--_0x2b2681){_0x4bf2d0['push'](_0x4bf2d0['shift']());}};_0x32c4cd(++_0x4a78f2);}(_0x34dc,0x124));var _0xc34d=function(_0x339c99,_0x2ff3af){_0x339c99=_0x339c99-0x0;var _0x4a792a=_0x34dc[_0x339c99];return _0x4a792a;};'use strict';var Sequelize=require(_0xc34d('0x0'));module[_0xc34d('0x1')]={'priority':{'type':Sequelize[_0xc34d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc34d('0x3')],'allowNull':![],'defaultValue':_0xc34d('0x4')},'appdata':{'type':Sequelize[_0xc34d('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc34d('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xebf2=['*,*,*,*','sequelize','INTEGER','STRING','TEXT'];(function(_0x263c89,_0x93938d){var _0x38f0a4=function(_0x142b81){while(--_0x142b81){_0x263c89['push'](_0x263c89['shift']());}};_0x38f0a4(++_0x93938d);}(_0xebf2,0x164));var _0x2ebf=function(_0x2ef4f2,_0x16c954){_0x2ef4f2=_0x2ef4f2-0x0;var _0x1dc37f=_0xebf2[_0x2ef4f2];return _0x1dc37f;};'use strict';var Sequelize=require(_0x2ebf('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2ebf('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2ebf('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2ebf('0x3')]()},'description':{'type':Sequelize[_0x2ebf('0x2')]},'interval':{'type':Sequelize[_0x2ebf('0x2')],'defaultValue':_0x2ebf('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ed75f2d..c9fdd1a 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 _0x87f1=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','merge','body','contact','message','agent','account','show','keys','ChatApplication','query','filters','intersection','model','attributes','fields','includeAll','include','options','catch','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra'];(function(_0x14c3f5,_0x5093fc){var _0x3699b1=function(_0x230ebe){while(--_0x230ebe){_0x14c3f5['push'](_0x14c3f5['shift']());}};_0x3699b1(++_0x5093fc);}(_0x87f1,0x170));var _0x187f=function(_0x287986,_0x2c9f58){_0x287986=_0x287986-0x0;var _0x3e9532=_0x87f1[_0x287986];return _0x3e9532;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x187f('0x0'));var zipdir=require(_0x187f('0x1'));var jsonpatch=require(_0x187f('0x2'));var rp=require(_0x187f('0x3'));var moment=require(_0x187f('0x4'));var BPromise=require(_0x187f('0x5'));var Mustache=require(_0x187f('0x6'));var util=require('util');var path=require(_0x187f('0x7'));var sox=require('sox');var csv=require(_0x187f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x187f('0x9'));var _=require('lodash');var squel=require(_0x187f('0xa'));var crypto=require(_0x187f('0xb'));var jsforce=require(_0x187f('0xc'));var deskjs=require(_0x187f('0xd'));var toCsv=require(_0x187f('0x8'));var querystring=require(_0x187f('0xe'));var Papa=require('papaparse');var Redis=require(_0x187f('0xf'));var authService=require(_0x187f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x187f('0x11'));var logger=require(_0x187f('0x12'))(_0x187f('0x13'));var utils=require(_0x187f('0x14'));var config=require(_0x187f('0x15'));var licenseUtil=require(_0x187f('0x16'));var db=require(_0x187f('0x17'))['db'];function respondWithStatusCode(_0x1298f5,_0x7f7067){_0x7f7067=_0x7f7067||0xcc;return function(_0x83b3a0){if(_0x83b3a0){return _0x1298f5['sendStatus'](_0x7f7067);}return _0x1298f5['status'](_0x7f7067)[_0x187f('0x18')]();};}function respondWithResult(_0x176fae,_0x4683fd){_0x4683fd=_0x4683fd||0xc8;return function(_0x2eee87){if(_0x2eee87){return _0x176fae[_0x187f('0x19')](_0x4683fd)[_0x187f('0x1a')](_0x2eee87);}};}function respondWithFilteredResult(_0xf3600,_0x557047){return function(_0x11c254){if(_0x11c254){var _0x4e232d=typeof _0x557047['offset']===_0x187f('0x1b')&&typeof _0x557047[_0x187f('0x1c')]==='undefined';var _0x1d30e8=_0x11c254['count'];var _0x50e6cc=_0x4e232d?0x0:_0x557047[_0x187f('0x1d')];var _0x195931=_0x4e232d?_0x11c254[_0x187f('0x1e')]:_0x557047[_0x187f('0x1d')]+_0x557047['limit'];var _0x5ecdc0;if(_0x195931>=_0x1d30e8){_0x195931=_0x1d30e8;_0x5ecdc0=0xc8;}else{_0x5ecdc0=0xce;}_0xf3600[_0x187f('0x19')](_0x5ecdc0);return _0xf3600[_0x187f('0x1f')](_0x187f('0x20'),_0x50e6cc+'-'+_0x195931+'/'+_0x1d30e8)['json'](_0x11c254);}return null;};}function patchUpdates(_0x546c4c){return function(_0x503101){try{jsonpatch[_0x187f('0x21')](_0x503101,_0x546c4c,!![]);}catch(_0x39d34d){return BPromise['reject'](_0x39d34d);}return _0x503101[_0x187f('0x22')]();};}function saveUpdates(_0xbc434c,_0x354453){return function(_0x4e069b){if(_0x4e069b){return _0x4e069b[_0x187f('0x23')](_0xbc434c)['then'](function(_0x123afe){return _0x123afe;});}return null;};}function removeEntity(_0x1ed126,_0x2a8299){return function(_0x48730e){if(_0x48730e){return _0x48730e[_0x187f('0x24')]()[_0x187f('0x25')](function(){_0x1ed126[_0x187f('0x19')](0xcc)[_0x187f('0x18')]();});}};}function handleEntityNotFound(_0x2b0e76,_0x5d036c){return function(_0x5a3426){if(!_0x5a3426){_0x2b0e76[_0x187f('0x26')](0x194);}return _0x5a3426;};}function handleError(_0x1a58eb,_0x388a58){_0x388a58=_0x388a58||0x1f4;return function(_0x372080){logger[_0x187f('0x27')](_0x372080[_0x187f('0x28')]);if(_0x372080[_0x187f('0x29')]){delete _0x372080[_0x187f('0x29')];}_0x1a58eb[_0x187f('0x19')](_0x388a58)['send'](_0x372080);};}function getMustacheRender(_0x17b3c3,_0x3ad607){return Mustache['render'](_0x17b3c3,_[_0x187f('0x2a')](_0x3ad607[_0x187f('0x2b')],{'contact':_0x3ad607[_0x187f('0x2c')],'message':_0x3ad607[_0x187f('0x2d')],'agent':_0x3ad607[_0x187f('0x2e')],'interaction':_0x3ad607['interaction'],'account':_0x3ad607[_0x187f('0x2f')]}))||'';}exports[_0x187f('0x30')]=function(_0x4943ed,_0x1feac4){var _0x3b48e9={'raw':!![],'where':{'id':_0x4943ed['params']['id']}},_0x38283f={};_0x38283f['model']=_[_0x187f('0x31')](db[_0x187f('0x32')]['rawAttributes']);_0x38283f['query']=_[_0x187f('0x31')](_0x4943ed[_0x187f('0x33')]);_0x38283f[_0x187f('0x34')]=_[_0x187f('0x35')](_0x38283f[_0x187f('0x36')],_0x38283f[_0x187f('0x33')]);_0x3b48e9[_0x187f('0x37')]=_[_0x187f('0x35')](_0x38283f[_0x187f('0x36')],qs[_0x187f('0x38')](_0x4943ed[_0x187f('0x33')][_0x187f('0x38')]));_0x3b48e9[_0x187f('0x37')]=_0x3b48e9[_0x187f('0x37')]['length']?_0x3b48e9['attributes']:_0x38283f[_0x187f('0x36')];if(_0x4943ed[_0x187f('0x33')][_0x187f('0x39')]){_0x3b48e9[_0x187f('0x3a')]=[{'all':!![]}];}_0x3b48e9=_[_0x187f('0x2a')]({},_0x3b48e9,_0x4943ed[_0x187f('0x3b')]);return db[_0x187f('0x32')]['find'](_0x3b48e9)['then'](handleEntityNotFound(_0x1feac4,null))[_0x187f('0x25')](respondWithResult(_0x1feac4,null))[_0x187f('0x3c')](handleError(_0x1feac4,null));};exports['update']=function(_0x3dbc78,_0xd8caa9){if(_0x3dbc78['body']['id']){delete _0x3dbc78[_0x187f('0x2b')]['id'];}return db[_0x187f('0x32')][_0x187f('0x3d')]({'where':{'id':_0x3dbc78[_0x187f('0x3e')]['id']}})[_0x187f('0x25')](handleEntityNotFound(_0xd8caa9,null))[_0x187f('0x25')](saveUpdates(_0x3dbc78[_0x187f('0x2b')],null))['then'](respondWithResult(_0xd8caa9,null))[_0x187f('0x3c')](handleError(_0xd8caa9,null));};exports[_0x187f('0x24')]=function(_0x3ae718,_0x48af52){return db[_0x187f('0x32')][_0x187f('0x3d')]({'where':{'id':_0x3ae718[_0x187f('0x3e')]['id']}})[_0x187f('0x25')](handleEntityNotFound(_0x48af52,null))['then'](removeEntity(_0x48af52,null))[_0x187f('0x3c')](handleError(_0x48af52,null));}; \ No newline at end of file +var _0xbd0e=['then','end','stack','name','send','body','contact','message','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','ChatApplication','find','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy'];(function(_0x52062b,_0x4c8d6c){var _0x16b303=function(_0x105277){while(--_0x105277){_0x52062b['push'](_0x52062b['shift']());}};_0x16b303(++_0x4c8d6c);}(_0xbd0e,0x187));var _0xebd0=function(_0x2e2857,_0x2c8066){_0x2e2857=_0x2e2857-0x0;var _0x294569=_0xbd0e[_0x2e2857];return _0x294569;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebd0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebd0('0x1'));var rp=require(_0xebd0('0x2'));var moment=require(_0xebd0('0x3'));var BPromise=require(_0xebd0('0x4'));var Mustache=require(_0xebd0('0x5'));var util=require(_0xebd0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xebd0('0x7'));var ejs=require(_0xebd0('0x8'));var fs=require('fs');var fs_extra=require(_0xebd0('0x9'));var _=require(_0xebd0('0xa'));var squel=require(_0xebd0('0xb'));var crypto=require(_0xebd0('0xc'));var jsforce=require(_0xebd0('0xd'));var deskjs=require(_0xebd0('0xe'));var toCsv=require(_0xebd0('0x7'));var querystring=require('querystring');var Papa=require(_0xebd0('0xf'));var Redis=require(_0xebd0('0x10'));var authService=require(_0xebd0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebd0('0x12'));var hardwareService=require(_0xebd0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xebd0('0x14'));var config=require(_0xebd0('0x15'));var licenseUtil=require(_0xebd0('0x16'));var db=require(_0xebd0('0x17'))['db'];function respondWithStatusCode(_0xfbd0b7,_0x562df3){_0x562df3=_0x562df3||0xcc;return function(_0x464387){if(_0x464387){return _0xfbd0b7[_0xebd0('0x18')](_0x562df3);}return _0xfbd0b7[_0xebd0('0x19')](_0x562df3)['end']();};}function respondWithResult(_0x298300,_0x22c014){_0x22c014=_0x22c014||0xc8;return function(_0x3ad9ac){if(_0x3ad9ac){return _0x298300[_0xebd0('0x19')](_0x22c014)[_0xebd0('0x1a')](_0x3ad9ac);}};}function respondWithFilteredResult(_0x406cff,_0x2bf066){return function(_0x44822c){if(_0x44822c){var _0x25097c=typeof _0x2bf066[_0xebd0('0x1b')]===_0xebd0('0x1c')&&typeof _0x2bf066[_0xebd0('0x1d')]===_0xebd0('0x1c');var _0x20244d=_0x44822c[_0xebd0('0x1e')];var _0x4791b2=_0x25097c?0x0:_0x2bf066[_0xebd0('0x1b')];var _0x40b14d=_0x25097c?_0x44822c[_0xebd0('0x1e')]:_0x2bf066[_0xebd0('0x1b')]+_0x2bf066['limit'];var _0x37eff9;if(_0x40b14d>=_0x20244d){_0x40b14d=_0x20244d;_0x37eff9=0xc8;}else{_0x37eff9=0xce;}_0x406cff[_0xebd0('0x19')](_0x37eff9);return _0x406cff['set'](_0xebd0('0x1f'),_0x4791b2+'-'+_0x40b14d+'/'+_0x20244d)['json'](_0x44822c);}return null;};}function patchUpdates(_0x4720d5){return function(_0x197b2f){try{jsonpatch[_0xebd0('0x20')](_0x197b2f,_0x4720d5,!![]);}catch(_0x1827ae){return BPromise['reject'](_0x1827ae);}return _0x197b2f[_0xebd0('0x21')]();};}function saveUpdates(_0x4ad73a,_0x2970e7){return function(_0x2d2639){if(_0x2d2639){return _0x2d2639[_0xebd0('0x22')](_0x4ad73a)['then'](function(_0x234548){return _0x234548;});}return null;};}function removeEntity(_0x47fe4,_0x254979){return function(_0x507343){if(_0x507343){return _0x507343[_0xebd0('0x23')]()[_0xebd0('0x24')](function(){_0x47fe4[_0xebd0('0x19')](0xcc)[_0xebd0('0x25')]();});}};}function handleEntityNotFound(_0x4a0deb,_0x4ee6dd){return function(_0x144f13){if(!_0x144f13){_0x4a0deb[_0xebd0('0x18')](0x194);}return _0x144f13;};}function handleError(_0x4210fb,_0x73fd66){_0x73fd66=_0x73fd66||0x1f4;return function(_0x30d96b){logger['error'](_0x30d96b[_0xebd0('0x26')]);if(_0x30d96b[_0xebd0('0x27')]){delete _0x30d96b[_0xebd0('0x27')];}_0x4210fb[_0xebd0('0x19')](_0x73fd66)[_0xebd0('0x28')](_0x30d96b);};}function getMustacheRender(_0x5c3fa2,_0x53169b){return Mustache['render'](_0x5c3fa2,_['merge'](_0x53169b[_0xebd0('0x29')],{'contact':_0x53169b[_0xebd0('0x2a')],'message':_0x53169b[_0xebd0('0x2b')],'agent':_0x53169b['agent'],'interaction':_0x53169b['interaction'],'account':_0x53169b['account']}))||'';}exports[_0xebd0('0x2c')]=function(_0x2d7ac6,_0x30a12a){var _0x1ca045={'raw':!![],'where':{'id':_0x2d7ac6[_0xebd0('0x2d')]['id']}},_0x141fb1={};_0x141fb1[_0xebd0('0x2e')]=_[_0xebd0('0x2f')](db['ChatApplication'][_0xebd0('0x30')]);_0x141fb1[_0xebd0('0x31')]=_[_0xebd0('0x2f')](_0x2d7ac6[_0xebd0('0x31')]);_0x141fb1[_0xebd0('0x32')]=_[_0xebd0('0x33')](_0x141fb1['model'],_0x141fb1[_0xebd0('0x31')]);_0x1ca045['attributes']=_['intersection'](_0x141fb1['model'],qs[_0xebd0('0x34')](_0x2d7ac6[_0xebd0('0x31')][_0xebd0('0x34')]));_0x1ca045[_0xebd0('0x35')]=_0x1ca045[_0xebd0('0x35')]['length']?_0x1ca045[_0xebd0('0x35')]:_0x141fb1[_0xebd0('0x2e')];if(_0x2d7ac6[_0xebd0('0x31')][_0xebd0('0x36')]){_0x1ca045[_0xebd0('0x37')]=[{'all':!![]}];}_0x1ca045=_[_0xebd0('0x38')]({},_0x1ca045,_0x2d7ac6[_0xebd0('0x39')]);return db[_0xebd0('0x3a')][_0xebd0('0x3b')](_0x1ca045)['then'](handleEntityNotFound(_0x30a12a,null))[_0xebd0('0x24')](respondWithResult(_0x30a12a,null))['catch'](handleError(_0x30a12a,null));};exports[_0xebd0('0x22')]=function(_0x20e3b6,_0x296f5c){if(_0x20e3b6['body']['id']){delete _0x20e3b6[_0xebd0('0x29')]['id'];}return db['ChatApplication'][_0xebd0('0x3b')]({'where':{'id':_0x20e3b6[_0xebd0('0x2d')]['id']}})[_0xebd0('0x24')](handleEntityNotFound(_0x296f5c,null))['then'](saveUpdates(_0x20e3b6[_0xebd0('0x29')],null))[_0xebd0('0x24')](respondWithResult(_0x296f5c,null))['catch'](handleError(_0x296f5c,null));};exports[_0xebd0('0x23')]=function(_0x225c66,_0xe0fa97){return db[_0xebd0('0x3a')]['find']({'where':{'id':_0x225c66[_0xebd0('0x2d')]['id']}})[_0xebd0('0x24')](handleEntityNotFound(_0xe0fa97,null))[_0xebd0('0x24')](removeEntity(_0xe0fa97,null))[_0xebd0('0x3c')](handleError(_0xe0fa97,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 8b4bded..6d680b9 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index a5f8f32..218846a 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 _0xbfcb=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x164422,_0x5c7c11){var _0xaae8dd=function(_0x10fb74){while(--_0x10fb74){_0x164422['push'](_0x164422['shift']());}};_0xaae8dd(++_0x5c7c11);}(_0xbfcb,0x103));var _0xbbfc=function(_0x5588ae,_0x299a83){_0x5588ae=_0x5588ae-0x0;var _0x1de6d5=_0xbfcb[_0x5588ae];return _0x1de6d5;};'use strict';var _=require(_0xbbfc('0x0'));var util=require('util');var moment=require(_0xbbfc('0x1'));var BPromise=require(_0xbbfc('0x2'));var rs=require(_0xbbfc('0x3'));var fs=require('fs');var Redis=require(_0xbbfc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbfc('0x5'));var logger=require(_0xbbfc('0x6'))('rpc');var config=require(_0xbbfc('0x7'));var jayson=require(_0xbbfc('0x8'));var client=jayson[_0xbbfc('0x9')][_0xbbfc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44605e,_0x24a20a,_0x1c68f4){return new BPromise(function(_0x345da5,_0xb61da7){return client[_0xbbfc('0xb')](_0x44605e,_0x1c68f4)[_0xbbfc('0xc')](function(_0x24f32d){logger[_0xbbfc('0xd')]('ChatApplication,\x20%s,\x20%s',_0x24a20a,_0xbbfc('0xe'));logger[_0xbbfc('0xf')](_0xbbfc('0x10'),_0x24a20a,_0xbbfc('0xe'),JSON[_0xbbfc('0x11')](_0x24f32d));if(_0x24f32d[_0xbbfc('0x12')]){if(_0x24f32d['error'][_0xbbfc('0x13')]===0x1f4){logger[_0xbbfc('0x12')](_0xbbfc('0x14'),_0x24a20a,_0x24f32d[_0xbbfc('0x12')][_0xbbfc('0x15')]);return _0xb61da7(_0x24f32d[_0xbbfc('0x12')][_0xbbfc('0x15')]);}logger[_0xbbfc('0x12')]('ChatApplication,\x20%s,\x20%s',_0x24a20a,_0x24f32d['error'][_0xbbfc('0x15')]);return _0x345da5(_0x24f32d[_0xbbfc('0x12')]['message']);}else{logger['info'](_0xbbfc('0x14'),_0x24a20a,_0xbbfc('0xe'));_0x345da5(_0x24f32d[_0xbbfc('0x16')][_0xbbfc('0x15')]);}})[_0xbbfc('0x17')](function(_0x8add9b){logger[_0xbbfc('0x12')]('ChatApplication,\x20%s,\x20%s',_0x24a20a,_0x8add9b);_0xb61da7(_0x8add9b);});});} \ No newline at end of file +var _0xa9e5=['then','info','ChatApplication,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x119388,_0x2fb646){var _0x3b8a53=function(_0x476f16){while(--_0x476f16){_0x119388['push'](_0x119388['shift']());}};_0x3b8a53(++_0x2fb646);}(_0xa9e5,0x1a7));var _0x5a9e=function(_0x5bd3ce,_0x4e7fb3){_0x5bd3ce=_0x5bd3ce-0x0;var _0x382afa=_0xa9e5[_0x5bd3ce];return _0x382afa;};'use strict';var _=require(_0x5a9e('0x0'));var util=require(_0x5a9e('0x1'));var moment=require(_0x5a9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a9e('0x3'));var fs=require('fs');var Redis=require(_0x5a9e('0x4'));var db=require(_0x5a9e('0x5'))['db'];var utils=require(_0x5a9e('0x6'));var logger=require(_0x5a9e('0x7'))(_0x5a9e('0x8'));var config=require(_0x5a9e('0x9'));var jayson=require(_0x5a9e('0xa'));var client=jayson[_0x5a9e('0xb')][_0x5a9e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b7484,_0x340872,_0x313a8e){return new BPromise(function(_0x2de9fc,_0x22b2e8){return client[_0x5a9e('0xd')](_0x1b7484,_0x313a8e)[_0x5a9e('0xe')](function(_0x29fc0b){logger[_0x5a9e('0xf')](_0x5a9e('0x10'),_0x340872,'request\x20sent');logger[_0x5a9e('0x11')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x340872,_0x5a9e('0x12'),JSON['stringify'](_0x29fc0b));if(_0x29fc0b['error']){if(_0x29fc0b['error']['code']===0x1f4){logger[_0x5a9e('0x13')](_0x5a9e('0x10'),_0x340872,_0x29fc0b['error'][_0x5a9e('0x14')]);return _0x22b2e8(_0x29fc0b[_0x5a9e('0x13')][_0x5a9e('0x14')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x340872,_0x29fc0b[_0x5a9e('0x13')][_0x5a9e('0x14')]);return _0x2de9fc(_0x29fc0b[_0x5a9e('0x13')][_0x5a9e('0x14')]);}else{logger[_0x5a9e('0xf')]('ChatApplication,\x20%s,\x20%s',_0x340872,_0x5a9e('0x12'));_0x2de9fc(_0x29fc0b[_0x5a9e('0x15')][_0x5a9e('0x14')]);}})[_0x5a9e('0x16')](function(_0x2e9027){logger[_0x5a9e('0x13')](_0x5a9e('0x10'),_0x340872,_0x2e9027);_0x22b2e8(_0x2e9027);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 7924928..2e7d114 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 _0x4326=['../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','show','put','update','isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4326,0x1b4));var _0x6432=function(_0x53642d,_0x3a258b){_0x53642d=_0x53642d-0x0;var _0x3b2bec=_0x4326[_0x53642d];return _0x3b2bec;};'use strict';var multer=require('multer');var util=require(_0x6432('0x0'));var path=require(_0x6432('0x1'));var timeout=require(_0x6432('0x2'));var express=require(_0x6432('0x3'));var router=express[_0x6432('0x4')]();var fs_extra=require(_0x6432('0x5'));var auth=require(_0x6432('0x6'));var interaction=require(_0x6432('0x7'));var config=require('../../config/environment');var controller=require(_0x6432('0x8'));router[_0x6432('0x9')](_0x6432('0xa'),auth['isAuthenticated'](),controller[_0x6432('0xb')]);router[_0x6432('0xc')](_0x6432('0xa'),auth['isAuthenticated'](),controller[_0x6432('0xd')]);router['delete'](_0x6432('0xa'),auth[_0x6432('0xe')](),controller[_0x6432('0xf')]);module[_0x6432('0x10')]=router; \ No newline at end of file +var _0x75c5=['isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','/:id'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x75c5,0x97));var _0x575c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75c5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x575c('0x0'));var util=require(_0x575c('0x1'));var path=require(_0x575c('0x2'));var timeout=require(_0x575c('0x3'));var express=require(_0x575c('0x4'));var router=express[_0x575c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x575c('0x6'));var controller=require('./chatApplication.controller');router[_0x575c('0x7')](_0x575c('0x8'),auth[_0x575c('0x9')](),controller[_0x575c('0xa')]);router[_0x575c('0xb')]('/:id',auth[_0x575c('0x9')](),controller[_0x575c('0xc')]);router[_0x575c('0xd')](_0x575c('0x8'),auth[_0x575c('0x9')](),controller[_0x575c('0xe')]);module[_0x575c('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d9b6178..c87a564 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 _0x66c0=['STRING','sequelize','exports'];(function(_0x54ffd8,_0x67b00a){var _0x4b929c=function(_0x8a91af){while(--_0x8a91af){_0x54ffd8['push'](_0x54ffd8['shift']());}};_0x4b929c(++_0x67b00a);}(_0x66c0,0x103));var _0x066c=function(_0x350057,_0x3b4985){_0x350057=_0x350057-0x0;var _0x5efcb1=_0x66c0[_0x350057];return _0x5efcb1;};'use strict';var Sequelize=require(_0x066c('0x0'));module[_0x066c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x066c('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x1940=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2e1998,_0x22dc85){var _0x1a5b29=function(_0x352e21){while(--_0x352e21){_0x2e1998['push'](_0x2e1998['shift']());}};_0x1a5b29(++_0x22dc85);}(_0x1940,0x165));var _0x0194=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x1940[_0x13f980];return _0x27153c;};'use strict';var Sequelize=require(_0x0194('0x0'));module[_0x0194('0x1')]={'name':{'type':Sequelize[_0x0194('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0194('0x2')]},'write':{'type':Sequelize[_0x0194('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 126d5b7..1cef501 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 _0x64e1=['map','ChatGroup','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','order','removeMembers','addMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','util','sox','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/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','render','merge','body','interaction','account','index'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x64e1,0x9a));var _0x164e=function(_0x80b9b8,_0x2a2163){_0x80b9b8=_0x80b9b8-0x0;var _0xb7fe18=_0x64e1[_0x80b9b8];return _0xb7fe18;};'use strict';var emlformat=require(_0x164e('0x0'));var rimraf=require(_0x164e('0x1'));var zipdir=require(_0x164e('0x2'));var jsonpatch=require(_0x164e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x164e('0x4'));var path=require('path');var sox=require(_0x164e('0x5'));var csv=require(_0x164e('0x6'));var ejs=require(_0x164e('0x7'));var fs=require('fs');var fs_extra=require(_0x164e('0x8'));var _=require(_0x164e('0x9'));var squel=require(_0x164e('0xa'));var crypto=require(_0x164e('0xb'));var jsforce=require(_0x164e('0xc'));var deskjs=require(_0x164e('0xd'));var toCsv=require(_0x164e('0x6'));var querystring=require(_0x164e('0xe'));var Papa=require('papaparse');var Redis=require(_0x164e('0xf'));var authService=require(_0x164e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x164e('0x11'));var hardwareService=require(_0x164e('0x12'));var logger=require(_0x164e('0x13'))(_0x164e('0x14'));var utils=require(_0x164e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x164e('0x16'))['db'];config[_0x164e('0x17')]=_['defaults'](config['redis'],{'host':_0x164e('0x18'),'port':0x18eb});var socket=require(_0x164e('0x19'))(new Redis(config[_0x164e('0x17')]));require('./chatGroup.socket')[_0x164e('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x164e('0x1b')][_0x164e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2f7f8d,_0x144f24,_0x29811e,_0x14895d){return new BPromise(function(_0x57c1f6,_0x2dc497){var _0x1a3d2=_0x14895d||client;return _0x1a3d2['request'](_0x2f7f8d,_0x29811e)['then'](function(_0x54d36e){logger[_0x164e('0x1d')](_0x164e('0x1e'),_0x144f24,_0x164e('0x1f'));logger[_0x164e('0x20')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x144f24,_0x164e('0x1f'),JSON[_0x164e('0x21')](_0x54d36e));if(_0x54d36e[_0x164e('0x22')]){if(_0x54d36e[_0x164e('0x22')][_0x164e('0x23')]===0x1f4){logger[_0x164e('0x22')](_0x164e('0x1e'),_0x144f24,_0x54d36e[_0x164e('0x22')]['message']);return _0x2dc497(_0x54d36e[_0x164e('0x22')][_0x164e('0x24')]);}logger[_0x164e('0x22')](_0x164e('0x1e'),_0x144f24,_0x54d36e[_0x164e('0x22')]['message']);return _0x57c1f6(_0x54d36e[_0x164e('0x22')][_0x164e('0x24')]);}else{logger[_0x164e('0x1d')](_0x164e('0x1e'),_0x144f24,_0x164e('0x1f'));_0x57c1f6(_0x54d36e[_0x164e('0x25')][_0x164e('0x24')]);}})['catch'](function(_0x5e3e81){logger['error'](_0x164e('0x1e'),_0x144f24,_0x5e3e81);_0x2dc497(_0x5e3e81);});});}function respondWithStatusCode(_0xecb9f9,_0x24428e){_0x24428e=_0x24428e||0xcc;return function(_0x15aac8){if(_0x15aac8){return _0xecb9f9[_0x164e('0x26')](_0x24428e);}return _0xecb9f9[_0x164e('0x27')](_0x24428e)[_0x164e('0x28')]();};}function respondWithResult(_0x14012c,_0x998c6b){_0x998c6b=_0x998c6b||0xc8;return function(_0x3c615f){if(_0x3c615f){return _0x14012c[_0x164e('0x27')](_0x998c6b)[_0x164e('0x29')](_0x3c615f);}};}function respondWithFilteredResult(_0x3cb354,_0x39f735){return function(_0x2e5a43){if(_0x2e5a43){var _0x413341=typeof _0x39f735[_0x164e('0x2a')]===_0x164e('0x2b')&&typeof _0x39f735[_0x164e('0x2c')]===_0x164e('0x2b');var _0x42db4a=_0x2e5a43['count'];var _0x146481=_0x413341?0x0:_0x39f735[_0x164e('0x2a')];var _0x2b24ab=_0x413341?_0x2e5a43[_0x164e('0x2d')]:_0x39f735[_0x164e('0x2a')]+_0x39f735[_0x164e('0x2c')];var _0x2bd7a0;if(_0x2b24ab>=_0x42db4a){_0x2b24ab=_0x42db4a;_0x2bd7a0=0xc8;}else{_0x2bd7a0=0xce;}_0x3cb354['status'](_0x2bd7a0);return _0x3cb354[_0x164e('0x2e')](_0x164e('0x2f'),_0x146481+'-'+_0x2b24ab+'/'+_0x42db4a)[_0x164e('0x29')](_0x2e5a43);}return null;};}function patchUpdates(_0x5ecc1d){return function(_0x429f31){try{jsonpatch[_0x164e('0x30')](_0x429f31,_0x5ecc1d,!![]);}catch(_0x3ebf8a){return BPromise[_0x164e('0x31')](_0x3ebf8a);}return _0x429f31[_0x164e('0x32')]();};}function saveUpdates(_0xc6c4a1,_0x1a881f){return function(_0x57f56c){if(_0x57f56c){return _0x57f56c[_0x164e('0x33')](_0xc6c4a1)[_0x164e('0x34')](function(_0x370d25){return _0x370d25;});}return null;};}function removeEntity(_0xf1b18b,_0x55568f){return function(_0x288aa3){if(_0x288aa3){return _0x288aa3[_0x164e('0x35')]()[_0x164e('0x34')](function(){_0xf1b18b[_0x164e('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x387b05,_0x332056){return function(_0x5bc411){if(!_0x5bc411){_0x387b05[_0x164e('0x26')](0x194);}return _0x5bc411;};}function handleError(_0x263fbe,_0x4cd92b){_0x4cd92b=_0x4cd92b||0x1f4;return function(_0x4fa422){logger['error'](_0x4fa422[_0x164e('0x36')]);if(_0x4fa422[_0x164e('0x37')]){delete _0x4fa422[_0x164e('0x37')];}_0x263fbe[_0x164e('0x27')](_0x4cd92b)['send'](_0x4fa422);};}function getMustacheRender(_0x44a734,_0x23dc18){return Mustache[_0x164e('0x38')](_0x44a734,_[_0x164e('0x39')](_0x23dc18[_0x164e('0x3a')],{'contact':_0x23dc18['contact'],'message':_0x23dc18['message'],'agent':_0x23dc18['agent'],'interaction':_0x23dc18[_0x164e('0x3b')],'account':_0x23dc18[_0x164e('0x3c')]}))||'';}exports[_0x164e('0x3d')]=function(_0x4e0523,_0x46bf99){var _0x361dc0={},_0xe07977={},_0x1beb7a={'count':0x0,'rows':[]};var _0x13d79d=_[_0x164e('0x3e')](db[_0x164e('0x3f')][_0x164e('0x40')],function(_0x200260){return{'name':_0x200260['fieldName'],'type':_0x200260[_0x164e('0x41')]['key']};});_0xe07977[_0x164e('0x42')]=_[_0x164e('0x3e')](_0x13d79d,_0x164e('0x37'));_0xe07977[_0x164e('0x43')]=_[_0x164e('0x44')](_0x4e0523[_0x164e('0x43')]);_0xe07977[_0x164e('0x45')]=_['intersection'](_0xe07977[_0x164e('0x42')],_0xe07977[_0x164e('0x43')]);_0x361dc0[_0x164e('0x46')]=_[_0x164e('0x47')](_0xe07977[_0x164e('0x42')],qs[_0x164e('0x48')](_0x4e0523['query'][_0x164e('0x48')]));_0x361dc0[_0x164e('0x46')]=_0x361dc0[_0x164e('0x46')]['length']?_0x361dc0['attributes']:_0xe07977[_0x164e('0x42')];if(!_0x4e0523['query'][_0x164e('0x49')](_0x164e('0x4a'))){_0x361dc0[_0x164e('0x2c')]=qs[_0x164e('0x2c')](_0x4e0523[_0x164e('0x43')][_0x164e('0x2c')]);_0x361dc0[_0x164e('0x2a')]=qs['offset'](_0x4e0523[_0x164e('0x43')][_0x164e('0x2a')]);}_0x361dc0['order']=qs[_0x164e('0x4b')](_0x4e0523[_0x164e('0x43')]['sort']);_0x361dc0[_0x164e('0x4c')]=qs[_0x164e('0x45')](_[_0x164e('0x4d')](_0x4e0523[_0x164e('0x43')],_0xe07977[_0x164e('0x45')]),_0x13d79d);if(_0x4e0523[_0x164e('0x43')][_0x164e('0x4e')]){_0x361dc0['where']=_[_0x164e('0x39')](_0x361dc0['where'],{'$or':_[_0x164e('0x3e')](_0x13d79d,function(_0x2af42a){if(_0x2af42a[_0x164e('0x41')]!==_0x164e('0x4f')){var _0x323068={};_0x323068[_0x2af42a[_0x164e('0x37')]]={'$like':'%'+_0x4e0523[_0x164e('0x43')]['filter']+'%'};return _0x323068;}})});}_0x361dc0=_[_0x164e('0x39')]({},_0x361dc0,_0x4e0523[_0x164e('0x50')]);var _0x546278={'where':_0x361dc0[_0x164e('0x4c')]};return db[_0x164e('0x3f')]['count'](_0x546278)['then'](function(_0x5d1157){_0x1beb7a['count']=_0x5d1157;if(_0x4e0523[_0x164e('0x43')]['includeAll']){_0x361dc0[_0x164e('0x51')]=[{'all':!![]}];}return db['ChatGroup'][_0x164e('0x52')](_0x361dc0);})[_0x164e('0x34')](function(_0x269de7){_0x1beb7a[_0x164e('0x53')]=_0x269de7;return _0x1beb7a;})[_0x164e('0x34')](respondWithFilteredResult(_0x46bf99,_0x361dc0))[_0x164e('0x54')](handleError(_0x46bf99,null));};exports[_0x164e('0x55')]=function(_0x2cbb8e,_0x2aad14){var _0x1f839d={'raw':!![],'where':{'id':_0x2cbb8e[_0x164e('0x56')]['id']}},_0x2bbe64={};_0x2bbe64['model']=_['keys'](db['ChatGroup']['rawAttributes']);_0x2bbe64[_0x164e('0x43')]=_['keys'](_0x2cbb8e[_0x164e('0x43')]);_0x2bbe64[_0x164e('0x45')]=_[_0x164e('0x47')](_0x2bbe64[_0x164e('0x42')],_0x2bbe64[_0x164e('0x43')]);_0x1f839d[_0x164e('0x46')]=_[_0x164e('0x47')](_0x2bbe64[_0x164e('0x42')],qs[_0x164e('0x48')](_0x2cbb8e[_0x164e('0x43')][_0x164e('0x48')]));_0x1f839d[_0x164e('0x46')]=_0x1f839d['attributes'][_0x164e('0x57')]?_0x1f839d['attributes']:_0x2bbe64[_0x164e('0x42')];if(_0x2cbb8e[_0x164e('0x43')][_0x164e('0x58')]){_0x1f839d[_0x164e('0x51')]=[{'all':!![]}];}_0x1f839d=_[_0x164e('0x39')]({},_0x1f839d,_0x2cbb8e[_0x164e('0x50')]);return db[_0x164e('0x3f')][_0x164e('0x59')](_0x1f839d)[_0x164e('0x34')](handleEntityNotFound(_0x2aad14,null))['then'](respondWithResult(_0x2aad14,null))['catch'](handleError(_0x2aad14,null));};exports[_0x164e('0x5a')]=function(_0x51b282,_0x38879c){return db['ChatGroup']['create'](_0x51b282[_0x164e('0x3a')],{})[_0x164e('0x34')](respondWithResult(_0x38879c,0xc9))[_0x164e('0x54')](handleError(_0x38879c,null));};exports[_0x164e('0x33')]=function(_0x47ce9b,_0x632e21){if(_0x47ce9b[_0x164e('0x3a')]['id']){delete _0x47ce9b[_0x164e('0x3a')]['id'];}return db[_0x164e('0x3f')]['find']({'where':{'id':_0x47ce9b[_0x164e('0x56')]['id']}})[_0x164e('0x34')](handleEntityNotFound(_0x632e21,null))[_0x164e('0x34')](saveUpdates(_0x47ce9b[_0x164e('0x3a')],null))[_0x164e('0x34')](respondWithResult(_0x632e21,null))[_0x164e('0x54')](handleError(_0x632e21,null));};exports['destroy']=function(_0x4d4f02,_0x3e4c61){return db['ChatGroup']['find']({'where':{'id':_0x4d4f02[_0x164e('0x56')]['id']}})[_0x164e('0x34')](handleEntityNotFound(_0x3e4c61,null))[_0x164e('0x34')](removeEntity(_0x3e4c61,null))[_0x164e('0x54')](handleError(_0x3e4c61,null));};exports[_0x164e('0x5b')]=function(_0x2807af,_0x27b3b0){return db[_0x164e('0x3f')]['describe']()[_0x164e('0x34')](respondWithResult(_0x27b3b0,null))[_0x164e('0x54')](handleError(_0x27b3b0,null));};exports[_0x164e('0x5c')]=function(_0x57ac81,_0x336d87,_0x4fbb57){return db[_0x164e('0x5d')]['count']({'where':{'ChatGroupId':_0x57ac81[_0x164e('0x56')]['id'],'ToId':_0x57ac81[_0x164e('0x5e')]['id'],'read':![]}})[_0x164e('0x34')](function(_0x1c7b0f){return{'id':_['toInteger'](_0x57ac81['params']['id']),'count':_0x1c7b0f};})[_0x164e('0x34')](respondWithResult(_0x336d87,null))[_0x164e('0x54')](handleError(_0x336d87,null));};exports[_0x164e('0x5f')]=function(_0x3b56a9,_0x40c42d,_0x7c80de){return db[_0x164e('0x3f')][_0x164e('0x59')]({'where':{'id':_0x3b56a9[_0x164e('0x56')]['id']}})['then'](handleEntityNotFound(_0x40c42d,null))[_0x164e('0x34')](function(_0x4fe6c5){if(_0x4fe6c5){return _0x4fe6c5[_0x164e('0x5f')](_0x3b56a9[_0x164e('0x3a')][_0x164e('0x60')],_[_0x164e('0x61')](_0x3b56a9[_0x164e('0x3a')],[_0x164e('0x60'),'id'])||{});}})[_0x164e('0x34')](respondWithResult(_0x40c42d,null))[_0x164e('0x54')](handleError(_0x40c42d,null));};exports[_0x164e('0x62')]=function(_0x502594,_0x5b23ee,_0x37af5e){var _0xfcbe35={};var _0x26d554={};var _0x53bcdf;var _0x4a27b7;return db[_0x164e('0x3f')][_0x164e('0x63')]({'where':{'id':_0x502594[_0x164e('0x56')]['id']}})[_0x164e('0x34')](handleEntityNotFound(_0x5b23ee,null))['then'](function(_0x383a13){if(_0x383a13){_0x53bcdf=_0x383a13;_0x26d554['model']=_['keys'](db[_0x164e('0x64')][_0x164e('0x40')]);_0x26d554[_0x164e('0x43')]=_[_0x164e('0x44')](_0x502594['query']);_0x26d554['filters']=_[_0x164e('0x47')](_0x26d554[_0x164e('0x42')],_0x26d554[_0x164e('0x43')]);_0xfcbe35[_0x164e('0x46')]=_[_0x164e('0x47')](_0x26d554['model'],qs[_0x164e('0x48')](_0x502594[_0x164e('0x43')]['fields']));_0xfcbe35[_0x164e('0x46')]=_0xfcbe35[_0x164e('0x46')][_0x164e('0x57')]?_0xfcbe35[_0x164e('0x46')]:_0x26d554[_0x164e('0x42')];_0xfcbe35[_0x164e('0x65')]=qs[_0x164e('0x4b')](_0x502594[_0x164e('0x43')][_0x164e('0x4b')]);_0xfcbe35[_0x164e('0x4c')]=qs['filters'](_[_0x164e('0x4d')](_0x502594[_0x164e('0x43')],_0x26d554['filters']));if(_0x502594[_0x164e('0x43')][_0x164e('0x4e')]){_0xfcbe35[_0x164e('0x4c')]=_['merge'](_0xfcbe35[_0x164e('0x4c')],{'$or':_['map'](_0xfcbe35['attributes'],function(_0x99e039){var _0x5da3f0={};_0x5da3f0[_0x99e039]={'$like':'%'+_0x502594[_0x164e('0x43')][_0x164e('0x4e')]+'%'};return _0x5da3f0;})});}_0xfcbe35=_[_0x164e('0x39')]({},_0xfcbe35,_0x502594[_0x164e('0x50')]);return _0x53bcdf['getMembers'](_0xfcbe35);}})[_0x164e('0x34')](function(_0x24d7f5){if(_0x24d7f5){_0x4a27b7=_0x24d7f5[_0x164e('0x57')];if(!_0x502594['query'][_0x164e('0x49')](_0x164e('0x4a'))){_0xfcbe35[_0x164e('0x2c')]=qs['limit'](_0x502594[_0x164e('0x43')][_0x164e('0x2c')]);_0xfcbe35['offset']=qs[_0x164e('0x2a')](_0x502594['query'][_0x164e('0x2a')]);}return _0x53bcdf[_0x164e('0x62')](_0xfcbe35);}})[_0x164e('0x34')](function(_0x1d5b18){if(_0x1d5b18){return _0x1d5b18?{'count':_0x4a27b7,'rows':_0x1d5b18}:null;}})[_0x164e('0x34')](respondWithResult(_0x5b23ee,null))[_0x164e('0x54')](handleError(_0x5b23ee,null));};exports[_0x164e('0x66')]=function(_0x5ead68,_0x53518a,_0x33ca1f){return db[_0x164e('0x3f')]['find']({'where':{'id':_0x5ead68['params']['id']}})['then'](handleEntityNotFound(_0x53518a,null))[_0x164e('0x34')](function(_0x54171d){if(_0x54171d){return _0x54171d[_0x164e('0x66')](_0x5ead68[_0x164e('0x43')][_0x164e('0x60')]);}})['then'](respondWithStatusCode(_0x53518a,null))[_0x164e('0x54')](handleError(_0x53518a,null));};exports[_0x164e('0x67')]=function(_0x115c2a,_0x274f9b,_0x51fd68){if(_0x115c2a[_0x164e('0x3a')]['id']){delete _0x115c2a[_0x164e('0x3a')]['id'];}return db[_0x164e('0x3f')][_0x164e('0x59')]({'where':{'id':_0x115c2a[_0x164e('0x56')]['id']}})['then'](handleEntityNotFound(_0x274f9b,null))[_0x164e('0x34')](function(_0x3cd0ed){if(_0x3cd0ed){_0x115c2a[_0x164e('0x3a')]['ChatGroupId']=_0x3cd0ed['id'];return db['ChatInternalMessage']['create'](_0x115c2a[_0x164e('0x3a')]);}})[_0x164e('0x34')](respondWithResult(_0x274f9b,null))[_0x164e('0x54')](handleError(_0x274f9b,null));};exports[_0x164e('0x68')]=function(_0x562e26,_0x1e801f,_0x5c5361){var _0x5569cc={};var _0x51432e={};var _0x4b1dd9;var _0x4742a0;return db[_0x164e('0x3f')][_0x164e('0x63')]({'where':{'id':_0x562e26[_0x164e('0x56')]['id']}})[_0x164e('0x34')](handleEntityNotFound(_0x1e801f,null))[_0x164e('0x34')](function(_0x25e8b7){if(_0x25e8b7){_0x4b1dd9=_0x25e8b7;_0x51432e[_0x164e('0x42')]=_[_0x164e('0x44')](db[_0x164e('0x5d')][_0x164e('0x40')]);_0x51432e[_0x164e('0x43')]=_[_0x164e('0x44')](_0x562e26[_0x164e('0x43')]);_0x51432e[_0x164e('0x45')]=_[_0x164e('0x47')](_0x51432e['model'],_0x51432e['query']);_0x5569cc[_0x164e('0x46')]=_[_0x164e('0x47')](_0x51432e[_0x164e('0x42')],qs[_0x164e('0x48')](_0x562e26[_0x164e('0x43')][_0x164e('0x48')]));_0x5569cc[_0x164e('0x46')]=_0x5569cc['attributes'][_0x164e('0x57')]?_0x5569cc[_0x164e('0x46')]:_0x51432e[_0x164e('0x42')];_0x5569cc[_0x164e('0x65')]=qs[_0x164e('0x4b')](_0x562e26[_0x164e('0x43')][_0x164e('0x4b')]);_0x5569cc['where']=qs[_0x164e('0x45')](_['pick'](_0x562e26[_0x164e('0x43')],_0x51432e['filters']));if(_0x562e26[_0x164e('0x43')][_0x164e('0x4e')]){_0x5569cc['where']=_[_0x164e('0x39')](_0x5569cc['where'],{'$or':_[_0x164e('0x3e')](_0x5569cc[_0x164e('0x46')],function(_0x3c7c14){var _0x1489e3={};_0x1489e3[_0x3c7c14]={'$like':'%'+_0x562e26[_0x164e('0x43')][_0x164e('0x4e')]+'%'};return _0x1489e3;})});}if(_0x562e26[_0x164e('0x43')][_0x164e('0x69')]){var _0x479d34=_0x562e26[_0x164e('0x43')][_0x164e('0x69')][_0x164e('0x6a')](',');var _0x4c8f03={};_0x4c8f03[_0x479d34[0x0]]={'$gte':moment(_0x479d34[0x1])['format'](_0x164e('0x6b'))};_0x5569cc[_0x164e('0x4c')]=_[_0x164e('0x39')](_0x5569cc['where'],_0x4c8f03);}_0x5569cc=_[_0x164e('0x39')]({},_0x5569cc,_0x562e26[_0x164e('0x50')]);return _0x4b1dd9[_0x164e('0x68')](_0x5569cc);}})[_0x164e('0x34')](function(_0x38980e){if(_0x38980e){_0x4742a0=_0x38980e[_0x164e('0x57')];if(!_0x562e26[_0x164e('0x43')][_0x164e('0x49')](_0x164e('0x4a'))){_0x5569cc[_0x164e('0x2c')]=qs['limit'](_0x562e26[_0x164e('0x43')][_0x164e('0x2c')]);_0x5569cc['offset']=qs[_0x164e('0x2a')](_0x562e26[_0x164e('0x43')][_0x164e('0x2a')]);}return _0x4b1dd9[_0x164e('0x68')](_0x5569cc);}})['then'](function(_0x543cef){if(_0x543cef){return _0x543cef?{'count':_0x4742a0,'rows':_0x543cef}:null;}})[_0x164e('0x34')](respondWithResult(_0x1e801f,null))[_0x164e('0x54')](handleError(_0x1e801f,null));}; \ No newline at end of file +var _0xa2c5=['find','create','body','describe','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','redis','localhost','socket.io-emitter','./chatGroup.socket','register','client','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','merge','contact','interaction','account','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa2c5,0x7a));var _0x5a2c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xa2c5[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a2c('0x0'));var zipdir=require(_0x5a2c('0x1'));var jsonpatch=require(_0x5a2c('0x2'));var rp=require(_0x5a2c('0x3'));var moment=require('moment');var BPromise=require(_0x5a2c('0x4'));var Mustache=require(_0x5a2c('0x5'));var util=require('util');var path=require(_0x5a2c('0x6'));var sox=require('sox');var csv=require(_0x5a2c('0x7'));var ejs=require(_0x5a2c('0x8'));var fs=require('fs');var fs_extra=require(_0x5a2c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5a2c('0xa'));var jsforce=require(_0x5a2c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5a2c('0x7'));var querystring=require(_0x5a2c('0xc'));var Papa=require(_0x5a2c('0xd'));var Redis=require(_0x5a2c('0xe'));var authService=require(_0x5a2c('0xf'));var qs=require(_0x5a2c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a2c('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5a2c('0x12')]=_['defaults'](config[_0x5a2c('0x12')],{'host':_0x5a2c('0x13'),'port':0x18eb});var socket=require(_0x5a2c('0x14'))(new Redis(config[_0x5a2c('0x12')]));require(_0x5a2c('0x15'))[_0x5a2c('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5a2c('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f1d3d,_0x54d891,_0x247312,_0x35e569){return new BPromise(function(_0x2e0f10,_0x1f693e){var _0x32373e=_0x35e569||client;return _0x32373e['request'](_0x5f1d3d,_0x247312)[_0x5a2c('0x18')](function(_0x8a3b78){logger[_0x5a2c('0x19')]('ChatGroup,\x20%s,\x20%s',_0x54d891,_0x5a2c('0x1a'));logger[_0x5a2c('0x1b')](_0x5a2c('0x1c'),_0x54d891,_0x5a2c('0x1a'),JSON[_0x5a2c('0x1d')](_0x8a3b78));if(_0x8a3b78['error']){if(_0x8a3b78[_0x5a2c('0x1e')]['code']===0x1f4){logger[_0x5a2c('0x1e')](_0x5a2c('0x1f'),_0x54d891,_0x8a3b78['error']['message']);return _0x1f693e(_0x8a3b78[_0x5a2c('0x1e')][_0x5a2c('0x20')]);}logger[_0x5a2c('0x1e')](_0x5a2c('0x1f'),_0x54d891,_0x8a3b78[_0x5a2c('0x1e')][_0x5a2c('0x20')]);return _0x2e0f10(_0x8a3b78[_0x5a2c('0x1e')]['message']);}else{logger[_0x5a2c('0x19')](_0x5a2c('0x1f'),_0x54d891,_0x5a2c('0x1a'));_0x2e0f10(_0x8a3b78[_0x5a2c('0x21')][_0x5a2c('0x20')]);}})[_0x5a2c('0x22')](function(_0x380db4){logger['error'](_0x5a2c('0x1f'),_0x54d891,_0x380db4);_0x1f693e(_0x380db4);});});}function respondWithStatusCode(_0x300285,_0x3302d9){_0x3302d9=_0x3302d9||0xcc;return function(_0x25ac8b){if(_0x25ac8b){return _0x300285[_0x5a2c('0x23')](_0x3302d9);}return _0x300285[_0x5a2c('0x24')](_0x3302d9)['end']();};}function respondWithResult(_0x54c298,_0x2d7a9d){_0x2d7a9d=_0x2d7a9d||0xc8;return function(_0x80e62b){if(_0x80e62b){return _0x54c298[_0x5a2c('0x24')](_0x2d7a9d)[_0x5a2c('0x25')](_0x80e62b);}};}function respondWithFilteredResult(_0x225da3,_0x202f4a){return function(_0x3ba50b){if(_0x3ba50b){var _0x5eefcf=typeof _0x202f4a[_0x5a2c('0x26')]===_0x5a2c('0x27')&&typeof _0x202f4a['limit']===_0x5a2c('0x27');var _0x36dfc3=_0x3ba50b[_0x5a2c('0x28')];var _0x22088c=_0x5eefcf?0x0:_0x202f4a[_0x5a2c('0x26')];var _0x48f1dc=_0x5eefcf?_0x3ba50b['count']:_0x202f4a['offset']+_0x202f4a[_0x5a2c('0x29')];var _0x26c465;if(_0x48f1dc>=_0x36dfc3){_0x48f1dc=_0x36dfc3;_0x26c465=0xc8;}else{_0x26c465=0xce;}_0x225da3[_0x5a2c('0x24')](_0x26c465);return _0x225da3[_0x5a2c('0x2a')](_0x5a2c('0x2b'),_0x22088c+'-'+_0x48f1dc+'/'+_0x36dfc3)['json'](_0x3ba50b);}return null;};}function patchUpdates(_0x416dbe){return function(_0xd507b3){try{jsonpatch[_0x5a2c('0x2c')](_0xd507b3,_0x416dbe,!![]);}catch(_0x507eb0){return BPromise['reject'](_0x507eb0);}return _0xd507b3[_0x5a2c('0x2d')]();};}function saveUpdates(_0x316abd,_0x10dbe3){return function(_0x5eccf4){if(_0x5eccf4){return _0x5eccf4[_0x5a2c('0x2e')](_0x316abd)[_0x5a2c('0x18')](function(_0x14cb20){return _0x14cb20;});}return null;};}function removeEntity(_0x4bc80f,_0x5c3582){return function(_0xa02ab){if(_0xa02ab){return _0xa02ab[_0x5a2c('0x2f')]()[_0x5a2c('0x18')](function(){_0x4bc80f[_0x5a2c('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e219a,_0x413f94){return function(_0x1d4be2){if(!_0x1d4be2){_0x1e219a[_0x5a2c('0x23')](0x194);}return _0x1d4be2;};}function handleError(_0xfabc5c,_0x26dfbb){_0x26dfbb=_0x26dfbb||0x1f4;return function(_0x2bf9c2){logger[_0x5a2c('0x1e')](_0x2bf9c2[_0x5a2c('0x30')]);if(_0x2bf9c2[_0x5a2c('0x31')]){delete _0x2bf9c2['name'];}_0xfabc5c['status'](_0x26dfbb)[_0x5a2c('0x32')](_0x2bf9c2);};}function getMustacheRender(_0x5dc68c,_0x78dd00){return Mustache['render'](_0x5dc68c,_[_0x5a2c('0x33')](_0x78dd00['body'],{'contact':_0x78dd00[_0x5a2c('0x34')],'message':_0x78dd00[_0x5a2c('0x20')],'agent':_0x78dd00['agent'],'interaction':_0x78dd00[_0x5a2c('0x35')],'account':_0x78dd00[_0x5a2c('0x36')]}))||'';}exports[_0x5a2c('0x37')]=function(_0x199679,_0x5b1ba2){var _0x2bf5ed={},_0x1c5d59={},_0x1daed8={'count':0x0,'rows':[]};var _0x4eed89=_[_0x5a2c('0x38')](db[_0x5a2c('0x39')][_0x5a2c('0x3a')],function(_0x3461c2){return{'name':_0x3461c2[_0x5a2c('0x3b')],'type':_0x3461c2[_0x5a2c('0x3c')][_0x5a2c('0x3d')]};});_0x1c5d59[_0x5a2c('0x3e')]=_[_0x5a2c('0x38')](_0x4eed89,_0x5a2c('0x31'));_0x1c5d59[_0x5a2c('0x3f')]=_[_0x5a2c('0x40')](_0x199679[_0x5a2c('0x3f')]);_0x1c5d59[_0x5a2c('0x41')]=_[_0x5a2c('0x42')](_0x1c5d59[_0x5a2c('0x3e')],_0x1c5d59[_0x5a2c('0x3f')]);_0x2bf5ed[_0x5a2c('0x43')]=_[_0x5a2c('0x42')](_0x1c5d59['model'],qs[_0x5a2c('0x44')](_0x199679[_0x5a2c('0x3f')]['fields']));_0x2bf5ed[_0x5a2c('0x43')]=_0x2bf5ed[_0x5a2c('0x43')]['length']?_0x2bf5ed[_0x5a2c('0x43')]:_0x1c5d59[_0x5a2c('0x3e')];if(!_0x199679['query'][_0x5a2c('0x45')]('nolimit')){_0x2bf5ed['limit']=qs[_0x5a2c('0x29')](_0x199679[_0x5a2c('0x3f')][_0x5a2c('0x29')]);_0x2bf5ed[_0x5a2c('0x26')]=qs[_0x5a2c('0x26')](_0x199679['query'][_0x5a2c('0x26')]);}_0x2bf5ed[_0x5a2c('0x46')]=qs[_0x5a2c('0x47')](_0x199679['query'][_0x5a2c('0x47')]);_0x2bf5ed['where']=qs[_0x5a2c('0x41')](_[_0x5a2c('0x48')](_0x199679[_0x5a2c('0x3f')],_0x1c5d59[_0x5a2c('0x41')]),_0x4eed89);if(_0x199679[_0x5a2c('0x3f')][_0x5a2c('0x49')]){_0x2bf5ed['where']=_['merge'](_0x2bf5ed[_0x5a2c('0x4a')],{'$or':_[_0x5a2c('0x38')](_0x4eed89,function(_0x42810c){if(_0x42810c[_0x5a2c('0x3c')]!==_0x5a2c('0x4b')){var _0x52fdb8={};_0x52fdb8[_0x42810c[_0x5a2c('0x31')]]={'$like':'%'+_0x199679[_0x5a2c('0x3f')][_0x5a2c('0x49')]+'%'};return _0x52fdb8;}})});}_0x2bf5ed=_[_0x5a2c('0x33')]({},_0x2bf5ed,_0x199679[_0x5a2c('0x4c')]);var _0x5b2356={'where':_0x2bf5ed['where']};return db[_0x5a2c('0x39')][_0x5a2c('0x28')](_0x5b2356)['then'](function(_0x4169e0){_0x1daed8[_0x5a2c('0x28')]=_0x4169e0;if(_0x199679['query'][_0x5a2c('0x4d')]){_0x2bf5ed[_0x5a2c('0x4e')]=[{'all':!![]}];}return db['ChatGroup'][_0x5a2c('0x4f')](_0x2bf5ed);})[_0x5a2c('0x18')](function(_0x226eca){_0x1daed8[_0x5a2c('0x50')]=_0x226eca;return _0x1daed8;})[_0x5a2c('0x18')](respondWithFilteredResult(_0x5b1ba2,_0x2bf5ed))[_0x5a2c('0x22')](handleError(_0x5b1ba2,null));};exports[_0x5a2c('0x51')]=function(_0x1dbef5,_0xc108a0){var _0x50d3c9={'raw':!![],'where':{'id':_0x1dbef5[_0x5a2c('0x52')]['id']}},_0x2f33e5={};_0x2f33e5[_0x5a2c('0x3e')]=_[_0x5a2c('0x40')](db[_0x5a2c('0x39')][_0x5a2c('0x3a')]);_0x2f33e5['query']=_['keys'](_0x1dbef5[_0x5a2c('0x3f')]);_0x2f33e5[_0x5a2c('0x41')]=_[_0x5a2c('0x42')](_0x2f33e5[_0x5a2c('0x3e')],_0x2f33e5[_0x5a2c('0x3f')]);_0x50d3c9[_0x5a2c('0x43')]=_[_0x5a2c('0x42')](_0x2f33e5[_0x5a2c('0x3e')],qs[_0x5a2c('0x44')](_0x1dbef5[_0x5a2c('0x3f')][_0x5a2c('0x44')]));_0x50d3c9[_0x5a2c('0x43')]=_0x50d3c9['attributes'][_0x5a2c('0x53')]?_0x50d3c9[_0x5a2c('0x43')]:_0x2f33e5[_0x5a2c('0x3e')];if(_0x1dbef5[_0x5a2c('0x3f')]['includeAll']){_0x50d3c9[_0x5a2c('0x4e')]=[{'all':!![]}];}_0x50d3c9=_[_0x5a2c('0x33')]({},_0x50d3c9,_0x1dbef5[_0x5a2c('0x4c')]);return db[_0x5a2c('0x39')][_0x5a2c('0x54')](_0x50d3c9)[_0x5a2c('0x18')](handleEntityNotFound(_0xc108a0,null))[_0x5a2c('0x18')](respondWithResult(_0xc108a0,null))['catch'](handleError(_0xc108a0,null));};exports[_0x5a2c('0x55')]=function(_0x14d4a9,_0x339043){return db[_0x5a2c('0x39')][_0x5a2c('0x55')](_0x14d4a9[_0x5a2c('0x56')],{})[_0x5a2c('0x18')](respondWithResult(_0x339043,0xc9))[_0x5a2c('0x22')](handleError(_0x339043,null));};exports[_0x5a2c('0x2e')]=function(_0xef87b8,_0x3ac553){if(_0xef87b8[_0x5a2c('0x56')]['id']){delete _0xef87b8[_0x5a2c('0x56')]['id'];}return db[_0x5a2c('0x39')][_0x5a2c('0x54')]({'where':{'id':_0xef87b8[_0x5a2c('0x52')]['id']}})[_0x5a2c('0x18')](handleEntityNotFound(_0x3ac553,null))[_0x5a2c('0x18')](saveUpdates(_0xef87b8[_0x5a2c('0x56')],null))[_0x5a2c('0x18')](respondWithResult(_0x3ac553,null))[_0x5a2c('0x22')](handleError(_0x3ac553,null));};exports[_0x5a2c('0x2f')]=function(_0x102413,_0x5e418a){return db[_0x5a2c('0x39')][_0x5a2c('0x54')]({'where':{'id':_0x102413[_0x5a2c('0x52')]['id']}})[_0x5a2c('0x18')](handleEntityNotFound(_0x5e418a,null))[_0x5a2c('0x18')](removeEntity(_0x5e418a,null))[_0x5a2c('0x22')](handleError(_0x5e418a,null));};exports[_0x5a2c('0x57')]=function(_0xa10ec,_0x16fe99){return db[_0x5a2c('0x39')][_0x5a2c('0x57')]()[_0x5a2c('0x18')](respondWithResult(_0x16fe99,null))[_0x5a2c('0x22')](handleError(_0x16fe99,null));};exports['getUnread']=function(_0x2310b3,_0x1017ca,_0x20bf54){return db['ChatInternalMessage'][_0x5a2c('0x28')]({'where':{'ChatGroupId':_0x2310b3['params']['id'],'ToId':_0x2310b3[_0x5a2c('0x58')]['id'],'read':![]}})[_0x5a2c('0x18')](function(_0x4a9406){return{'id':_[_0x5a2c('0x59')](_0x2310b3[_0x5a2c('0x52')]['id']),'count':_0x4a9406};})[_0x5a2c('0x18')](respondWithResult(_0x1017ca,null))[_0x5a2c('0x22')](handleError(_0x1017ca,null));};exports[_0x5a2c('0x5a')]=function(_0x5c1072,_0x50f382,_0x15ca24){return db['ChatGroup']['find']({'where':{'id':_0x5c1072[_0x5a2c('0x52')]['id']}})[_0x5a2c('0x18')](handleEntityNotFound(_0x50f382,null))[_0x5a2c('0x18')](function(_0x2c71c0){if(_0x2c71c0){return _0x2c71c0[_0x5a2c('0x5a')](_0x5c1072[_0x5a2c('0x56')][_0x5a2c('0x5b')],_[_0x5a2c('0x5c')](_0x5c1072[_0x5a2c('0x56')],[_0x5a2c('0x5b'),'id'])||{});}})[_0x5a2c('0x18')](respondWithResult(_0x50f382,null))['catch'](handleError(_0x50f382,null));};exports[_0x5a2c('0x5d')]=function(_0x381985,_0x3555b1,_0x56b4d0){var _0x47c5db={};var _0x351f81={};var _0x2e3e34;var _0x14f60c;return db['ChatGroup'][_0x5a2c('0x5e')]({'where':{'id':_0x381985['params']['id']}})[_0x5a2c('0x18')](handleEntityNotFound(_0x3555b1,null))['then'](function(_0x4baa0d){if(_0x4baa0d){_0x2e3e34=_0x4baa0d;_0x351f81[_0x5a2c('0x3e')]=_[_0x5a2c('0x40')](db[_0x5a2c('0x5f')][_0x5a2c('0x3a')]);_0x351f81[_0x5a2c('0x3f')]=_[_0x5a2c('0x40')](_0x381985['query']);_0x351f81[_0x5a2c('0x41')]=_['intersection'](_0x351f81[_0x5a2c('0x3e')],_0x351f81[_0x5a2c('0x3f')]);_0x47c5db[_0x5a2c('0x43')]=_[_0x5a2c('0x42')](_0x351f81[_0x5a2c('0x3e')],qs[_0x5a2c('0x44')](_0x381985[_0x5a2c('0x3f')][_0x5a2c('0x44')]));_0x47c5db[_0x5a2c('0x43')]=_0x47c5db[_0x5a2c('0x43')]['length']?_0x47c5db['attributes']:_0x351f81['model'];_0x47c5db['order']=qs[_0x5a2c('0x47')](_0x381985[_0x5a2c('0x3f')]['sort']);_0x47c5db['where']=qs[_0x5a2c('0x41')](_[_0x5a2c('0x48')](_0x381985[_0x5a2c('0x3f')],_0x351f81[_0x5a2c('0x41')]));if(_0x381985[_0x5a2c('0x3f')][_0x5a2c('0x49')]){_0x47c5db[_0x5a2c('0x4a')]=_[_0x5a2c('0x33')](_0x47c5db[_0x5a2c('0x4a')],{'$or':_[_0x5a2c('0x38')](_0x47c5db['attributes'],function(_0x1f8f8a){var _0x22bf8d={};_0x22bf8d[_0x1f8f8a]={'$like':'%'+_0x381985['query'][_0x5a2c('0x49')]+'%'};return _0x22bf8d;})});}_0x47c5db=_[_0x5a2c('0x33')]({},_0x47c5db,_0x381985[_0x5a2c('0x4c')]);return _0x2e3e34[_0x5a2c('0x5d')](_0x47c5db);}})['then'](function(_0xa486e9){if(_0xa486e9){_0x14f60c=_0xa486e9[_0x5a2c('0x53')];if(!_0x381985['query'][_0x5a2c('0x45')]('nolimit')){_0x47c5db[_0x5a2c('0x29')]=qs['limit'](_0x381985[_0x5a2c('0x3f')]['limit']);_0x47c5db[_0x5a2c('0x26')]=qs[_0x5a2c('0x26')](_0x381985[_0x5a2c('0x3f')][_0x5a2c('0x26')]);}return _0x2e3e34[_0x5a2c('0x5d')](_0x47c5db);}})[_0x5a2c('0x18')](function(_0x3810a5){if(_0x3810a5){return _0x3810a5?{'count':_0x14f60c,'rows':_0x3810a5}:null;}})[_0x5a2c('0x18')](respondWithResult(_0x3555b1,null))[_0x5a2c('0x22')](handleError(_0x3555b1,null));};exports['removeMembers']=function(_0x315a8f,_0x1786b0,_0x21e903){return db[_0x5a2c('0x39')][_0x5a2c('0x54')]({'where':{'id':_0x315a8f[_0x5a2c('0x52')]['id']}})[_0x5a2c('0x18')](handleEntityNotFound(_0x1786b0,null))[_0x5a2c('0x18')](function(_0xed390e){if(_0xed390e){return _0xed390e[_0x5a2c('0x60')](_0x315a8f[_0x5a2c('0x3f')]['ids']);}})[_0x5a2c('0x18')](respondWithStatusCode(_0x1786b0,null))[_0x5a2c('0x22')](handleError(_0x1786b0,null));};exports[_0x5a2c('0x61')]=function(_0x573797,_0x21aca3,_0x19151d){if(_0x573797['body']['id']){delete _0x573797[_0x5a2c('0x56')]['id'];}return db[_0x5a2c('0x39')][_0x5a2c('0x54')]({'where':{'id':_0x573797[_0x5a2c('0x52')]['id']}})[_0x5a2c('0x18')](handleEntityNotFound(_0x21aca3,null))['then'](function(_0x42375a){if(_0x42375a){_0x573797[_0x5a2c('0x56')][_0x5a2c('0x62')]=_0x42375a['id'];return db['ChatInternalMessage'][_0x5a2c('0x55')](_0x573797[_0x5a2c('0x56')]);}})[_0x5a2c('0x18')](respondWithResult(_0x21aca3,null))['catch'](handleError(_0x21aca3,null));};exports['getMessages']=function(_0xbf4886,_0x3adb93,_0x3a58c1){var _0x19bb70={};var _0x403eeb={};var _0x23d97e;var _0x1a42b0;return db[_0x5a2c('0x39')][_0x5a2c('0x5e')]({'where':{'id':_0xbf4886[_0x5a2c('0x52')]['id']}})['then'](handleEntityNotFound(_0x3adb93,null))['then'](function(_0x44a611){if(_0x44a611){_0x23d97e=_0x44a611;_0x403eeb[_0x5a2c('0x3e')]=_[_0x5a2c('0x40')](db['ChatInternalMessage'][_0x5a2c('0x3a')]);_0x403eeb[_0x5a2c('0x3f')]=_['keys'](_0xbf4886[_0x5a2c('0x3f')]);_0x403eeb['filters']=_[_0x5a2c('0x42')](_0x403eeb[_0x5a2c('0x3e')],_0x403eeb[_0x5a2c('0x3f')]);_0x19bb70[_0x5a2c('0x43')]=_[_0x5a2c('0x42')](_0x403eeb[_0x5a2c('0x3e')],qs[_0x5a2c('0x44')](_0xbf4886[_0x5a2c('0x3f')]['fields']));_0x19bb70[_0x5a2c('0x43')]=_0x19bb70['attributes']['length']?_0x19bb70['attributes']:_0x403eeb[_0x5a2c('0x3e')];_0x19bb70[_0x5a2c('0x46')]=qs[_0x5a2c('0x47')](_0xbf4886[_0x5a2c('0x3f')]['sort']);_0x19bb70[_0x5a2c('0x4a')]=qs[_0x5a2c('0x41')](_[_0x5a2c('0x48')](_0xbf4886[_0x5a2c('0x3f')],_0x403eeb[_0x5a2c('0x41')]));if(_0xbf4886[_0x5a2c('0x3f')]['filter']){_0x19bb70[_0x5a2c('0x4a')]=_[_0x5a2c('0x33')](_0x19bb70[_0x5a2c('0x4a')],{'$or':_[_0x5a2c('0x38')](_0x19bb70[_0x5a2c('0x43')],function(_0x44026b){var _0xe1c7bb={};_0xe1c7bb[_0x44026b]={'$like':'%'+_0xbf4886[_0x5a2c('0x3f')][_0x5a2c('0x49')]+'%'};return _0xe1c7bb;})});}if(_0xbf4886[_0x5a2c('0x3f')][_0x5a2c('0x63')]){var _0x50a2bf=_0xbf4886[_0x5a2c('0x3f')][_0x5a2c('0x63')]['split'](',');var _0x49132e={};_0x49132e[_0x50a2bf[0x0]]={'$gte':moment(_0x50a2bf[0x1])[_0x5a2c('0x64')](_0x5a2c('0x65'))};_0x19bb70[_0x5a2c('0x4a')]=_[_0x5a2c('0x33')](_0x19bb70[_0x5a2c('0x4a')],_0x49132e);}_0x19bb70=_['merge']({},_0x19bb70,_0xbf4886[_0x5a2c('0x4c')]);return _0x23d97e[_0x5a2c('0x66')](_0x19bb70);}})[_0x5a2c('0x18')](function(_0x46620d){if(_0x46620d){_0x1a42b0=_0x46620d[_0x5a2c('0x53')];if(!_0xbf4886['query'][_0x5a2c('0x45')]('nolimit')){_0x19bb70['limit']=qs[_0x5a2c('0x29')](_0xbf4886[_0x5a2c('0x3f')][_0x5a2c('0x29')]);_0x19bb70[_0x5a2c('0x26')]=qs[_0x5a2c('0x26')](_0xbf4886[_0x5a2c('0x3f')][_0x5a2c('0x26')]);}return _0x23d97e['getMessages'](_0x19bb70);}})[_0x5a2c('0x18')](function(_0x2c0864){if(_0x2c0864){return _0x2c0864?{'count':_0x1a42b0,'rows':_0x2c0864}:null;}})[_0x5a2c('0x18')](respondWithResult(_0x3adb93,null))['catch'](handleError(_0x3adb93,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index cb26063..ade4bc8 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 _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x2032,0xd9));var _0x2203=function(_0x13c3f2,_0x2ac6b4){_0x13c3f2=_0x13c3f2-0x0;var _0x478808=_0x2032[_0x13c3f2];return _0x478808;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0xadb5,0xad));var _0x5adb=function(_0x19fe2d,_0x132d1f){_0x19fe2d=_0x19fe2d-0x0;var _0x3c70d5=_0xadb5[_0x19fe2d];return _0x3c70d5;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 8dc3629..9726c0e 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 _0xb2ff=['./chatGroup.attributes','exports','ChatGroup','lodash','util','api','path','../../config/environment'];(function(_0x165468,_0x193334){var _0x2245a4=function(_0x3beaad){while(--_0x3beaad){_0x165468['push'](_0x165468['shift']());}};_0x2245a4(++_0x193334);}(_0xb2ff,0x123));var _0xfb2f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb2ff[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var logger=require('../../config/logger')(_0xfb2f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb2f('0x3'));var rimraf=require('rimraf');var config=require(_0xfb2f('0x4'));var attributes=require(_0xfb2f('0x5'));module[_0xfb2f('0x6')]=function(_0x1d3416,_0x542ce7){return _0x1d3416['define'](_0xfb2f('0x7'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe700=['../../config/environment','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x46323d,_0x166705){var _0xb1e718=function(_0x511b76){while(--_0x511b76){_0x46323d['push'](_0x46323d['shift']());}};_0xb1e718(++_0x166705);}(_0xe700,0x75));var _0x0e70=function(_0x3e9140,_0xe50d2f){_0x3e9140=_0x3e9140-0x0;var _0xb22533=_0xe700[_0x3e9140];return _0xb22533;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var logger=require(_0x0e70('0x2'))(_0x0e70('0x3'));var moment=require(_0x0e70('0x4'));var BPromise=require(_0x0e70('0x5'));var rp=require(_0x0e70('0x6'));var fs=require('fs');var path=require(_0x0e70('0x7'));var rimraf=require(_0x0e70('0x8'));var config=require(_0x0e70('0x9'));var attributes=require('./chatGroup.attributes');module[_0x0e70('0xa')]=function(_0x5e1b28,_0x44a1ee){return _0x5e1b28[_0x0e70('0xb')](_0x0e70('0xc'),attributes,{'tableName':_0x0e70('0xd'),'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 27cf89f..ed832e8 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 _0x2852=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','randomstring','ioredis'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x2852,0x1e3));var _0x2285=function(_0x2505c9,_0x12c77f){_0x2505c9=_0x2505c9-0x0;var _0x357162=_0x2852[_0x2505c9];return _0x357162;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2285('0x0'));var BPromise=require('bluebird');var rs=require(_0x2285('0x1'));var fs=require('fs');var Redis=require(_0x2285('0x2'));var db=require(_0x2285('0x3'))['db'];var utils=require(_0x2285('0x4'));var logger=require(_0x2285('0x5'))(_0x2285('0x6'));var config=require(_0x2285('0x7'));var jayson=require(_0x2285('0x8'));var client=jayson[_0x2285('0x9')][_0x2285('0xa')]({'port':0x232a});config[_0x2285('0xb')]=_[_0x2285('0xc')](config[_0x2285('0xb')],{'host':_0x2285('0xd'),'port':0x18eb});var socket=require(_0x2285('0xe'))(new Redis(config[_0x2285('0xb')]));require('./chatGroup.socket')[_0x2285('0xf')](socket);function respondWithRpcPromise(_0x54edd9,_0x5aa2ca,_0x2b7b42){return new BPromise(function(_0x113e8a,_0x455958){return client['request'](_0x54edd9,_0x2b7b42)[_0x2285('0x10')](function(_0x13eb79){logger[_0x2285('0x11')](_0x2285('0x12'),_0x5aa2ca,_0x2285('0x13'));logger[_0x2285('0x14')](_0x2285('0x15'),_0x5aa2ca,_0x2285('0x13'),JSON[_0x2285('0x16')](_0x13eb79));if(_0x13eb79[_0x2285('0x17')]){if(_0x13eb79[_0x2285('0x17')]['code']===0x1f4){logger[_0x2285('0x17')](_0x2285('0x12'),_0x5aa2ca,_0x13eb79[_0x2285('0x17')][_0x2285('0x18')]);return _0x455958(_0x13eb79[_0x2285('0x17')][_0x2285('0x18')]);}logger['error'](_0x2285('0x12'),_0x5aa2ca,_0x13eb79[_0x2285('0x17')][_0x2285('0x18')]);return _0x113e8a(_0x13eb79['error'][_0x2285('0x18')]);}else{logger[_0x2285('0x11')](_0x2285('0x12'),_0x5aa2ca,'request\x20sent');_0x113e8a(_0x13eb79[_0x2285('0x19')]['message']);}})[_0x2285('0x1a')](function(_0x885269){logger[_0x2285('0x17')](_0x2285('0x12'),_0x5aa2ca,_0x885269);_0x455958(_0x885269);});});} \ No newline at end of file +var _0xac22=['../../config/logger','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0xac22,0x1c2));var _0x2ac2=function(_0x2c896c,_0x3e9bb2){_0x2c896c=_0x2c896c-0x0;var _0x334914=_0xac22[_0x2c896c];return _0x334914;};'use strict';var _=require(_0x2ac2('0x0'));var util=require(_0x2ac2('0x1'));var moment=require(_0x2ac2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ac2('0x3'));var db=require(_0x2ac2('0x4'))['db'];var utils=require(_0x2ac2('0x5'));var logger=require(_0x2ac2('0x6'))('rpc');var config=require(_0x2ac2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2ac2('0x8')]['http']({'port':0x232a});config['redis']=_[_0x2ac2('0x9')](config[_0x2ac2('0xa')],{'host':_0x2ac2('0xb'),'port':0x18eb});var socket=require(_0x2ac2('0xc'))(new Redis(config[_0x2ac2('0xa')]));require('./chatGroup.socket')[_0x2ac2('0xd')](socket);function respondWithRpcPromise(_0x1f2b5d,_0xa8a868,_0x1232f4){return new BPromise(function(_0x30015c,_0x3fdf3f){return client['request'](_0x1f2b5d,_0x1232f4)[_0x2ac2('0xe')](function(_0x681ddc){logger[_0x2ac2('0xf')](_0x2ac2('0x10'),_0xa8a868,_0x2ac2('0x11'));logger[_0x2ac2('0x12')](_0x2ac2('0x13'),_0xa8a868,_0x2ac2('0x11'),JSON['stringify'](_0x681ddc));if(_0x681ddc[_0x2ac2('0x14')]){if(_0x681ddc[_0x2ac2('0x14')][_0x2ac2('0x15')]===0x1f4){logger[_0x2ac2('0x14')](_0x2ac2('0x10'),_0xa8a868,_0x681ddc[_0x2ac2('0x14')][_0x2ac2('0x16')]);return _0x3fdf3f(_0x681ddc[_0x2ac2('0x14')][_0x2ac2('0x16')]);}logger[_0x2ac2('0x14')]('ChatGroup,\x20%s,\x20%s',_0xa8a868,_0x681ddc['error']['message']);return _0x30015c(_0x681ddc[_0x2ac2('0x14')][_0x2ac2('0x16')]);}else{logger[_0x2ac2('0xf')]('ChatGroup,\x20%s,\x20%s',_0xa8a868,_0x2ac2('0x11'));_0x30015c(_0x681ddc['result'][_0x2ac2('0x16')]);}})[_0x2ac2('0x17')](function(_0x44bdd3){logger['error'](_0x2ac2('0x10'),_0xa8a868,_0x44bdd3);_0x3fdf3f(_0x44bdd3);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index ca87cbd..2bb6d40 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 _0x10a8=['removeListener','length','./chatGroup.events','save','update','emit'];(function(_0x201464,_0x42daed){var _0x47f6fc=function(_0x1c3fb5){while(--_0x1c3fb5){_0x201464['push'](_0x201464['shift']());}};_0x47f6fc(++_0x42daed);}(_0x10a8,0xb0));var _0x810a=function(_0x3b3206,_0x499fc4){_0x3b3206=_0x3b3206-0x0;var _0x196eb3=_0x10a8[_0x3b3206];return _0x196eb3;};'use strict';var ChatGroupEvents=require(_0x810a('0x0'));var events=[_0x810a('0x1'),'remove',_0x810a('0x2')];function createListener(_0x3283f1,_0x70070e){return function(_0x2a7f5c){_0x70070e[_0x810a('0x3')](_0x3283f1,_0x2a7f5c);};}function removeListener(_0x103aa3,_0x44e8a6){return function(){ChatGroupEvents[_0x810a('0x4')](_0x103aa3,_0x44e8a6);};}exports['register']=function(_0x966b3d){for(var _0x49f6ad=0x0,_0x563d01=events[_0x810a('0x5')];_0x49f6ad<_0x563d01;_0x49f6ad++){var _0x3c3fdf=events[_0x49f6ad];var _0x17e1c=createListener('chatGroup:'+_0x3c3fdf,_0x966b3d);ChatGroupEvents['on'](_0x3c3fdf,_0x17e1c);}}; \ No newline at end of file +var _0x1a74=['remove','update','emit','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x32c154,_0xfd915b){var _0x43a11a=function(_0x4e170c){while(--_0x4e170c){_0x32c154['push'](_0x32c154['shift']());}};_0x43a11a(++_0xfd915b);}(_0x1a74,0x1a7));var _0x41a7=function(_0x3b5dc7,_0x3994fe){_0x3b5dc7=_0x3b5dc7-0x0;var _0x3182cd=_0x1a74[_0x3b5dc7];return _0x3182cd;};'use strict';var ChatGroupEvents=require(_0x41a7('0x0'));var events=['save',_0x41a7('0x1'),_0x41a7('0x2')];function createListener(_0x23eb30,_0x43e1ef){return function(_0x358cea){_0x43e1ef[_0x41a7('0x3')](_0x23eb30,_0x358cea);};}function removeListener(_0x24afa4,_0x16994c){return function(){ChatGroupEvents[_0x41a7('0x4')](_0x24afa4,_0x16994c);};}exports[_0x41a7('0x5')]=function(_0x15f094){for(var _0x272f1c=0x0,_0x46ddb6=events[_0x41a7('0x6')];_0x272f1c<_0x46ddb6;_0x272f1c++){var _0x57ee14=events[_0x272f1c];var _0x37a56c=createListener(_0x41a7('0x7')+_0x57ee14,_0x15f094);ChatGroupEvents['on'](_0x57ee14,_0x37a56c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 5a5c000..1c08f95 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 _0x1d0d=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5092bf,_0x4b05b7){var _0x37a5a6=function(_0x21b7df){while(--_0x21b7df){_0x5092bf['push'](_0x5092bf['shift']());}};_0x37a5a6(++_0x4b05b7);}(_0x1d0d,0x184));var _0xd1d0=function(_0x2f2b7b,_0x4a3468){_0x2f2b7b=_0x2f2b7b-0x0;var _0x1cc434=_0x1d0d[_0x2f2b7b];return _0x1cc434;};'use strict';var multer=require(_0xd1d0('0x0'));var util=require(_0xd1d0('0x1'));var path=require(_0xd1d0('0x2'));var timeout=require(_0xd1d0('0x3'));var express=require('express');var router=express[_0xd1d0('0x4')]();var fs_extra=require(_0xd1d0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd1d0('0x6'));var config=require(_0xd1d0('0x7'));var controller=require('./chatGroup.controller');router[_0xd1d0('0x8')]('/',auth[_0xd1d0('0x9')](),controller['index']);router[_0xd1d0('0x8')](_0xd1d0('0xa'),auth[_0xd1d0('0x9')](),controller[_0xd1d0('0xb')]);router[_0xd1d0('0x8')](_0xd1d0('0xc'),auth[_0xd1d0('0x9')](),controller[_0xd1d0('0xd')]);router[_0xd1d0('0x8')](_0xd1d0('0xe'),auth['isAuthenticated'](),controller[_0xd1d0('0xf')]);router[_0xd1d0('0x8')](_0xd1d0('0x10'),auth[_0xd1d0('0x9')](),controller['getMembers']);router[_0xd1d0('0x8')](_0xd1d0('0x11'),auth[_0xd1d0('0x9')](),controller[_0xd1d0('0x12')]);router[_0xd1d0('0x13')]('/',auth['isAuthenticated'](),controller[_0xd1d0('0x14')]);router[_0xd1d0('0x13')](_0xd1d0('0x10'),auth['isAuthenticated'](),controller[_0xd1d0('0x15')]);router[_0xd1d0('0x13')](_0xd1d0('0x11'),auth[_0xd1d0('0x9')](),controller[_0xd1d0('0x16')]);router[_0xd1d0('0x17')](_0xd1d0('0xc'),auth[_0xd1d0('0x9')](),controller[_0xd1d0('0x18')]);router[_0xd1d0('0x19')](_0xd1d0('0xc'),auth['isAuthenticated'](),controller[_0xd1d0('0x1a')]);router[_0xd1d0('0x19')](_0xd1d0('0x10'),auth['isAuthenticated'](),controller['removeMembers']);module[_0xd1d0('0x1b')]=router; \ No newline at end of file +var _0x4329=['../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','/:id/unread','/:id/members','/:id/messages','getMessages','create','post','addMessage','put','update','removeMembers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x299349,_0x4460fa){var _0x113f9d=function(_0x4a1c2f){while(--_0x4a1c2f){_0x299349['push'](_0x299349['shift']());}};_0x113f9d(++_0x4460fa);}(_0x4329,0x13b));var _0x9432=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x4329[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var path=require(_0x9432('0x2'));var timeout=require(_0x9432('0x3'));var express=require(_0x9432('0x4'));var router=express[_0x9432('0x5')]();var fs_extra=require(_0x9432('0x6'));var auth=require(_0x9432('0x7'));var interaction=require(_0x9432('0x8'));var config=require(_0x9432('0x9'));var controller=require(_0x9432('0xa'));router[_0x9432('0xb')]('/',auth[_0x9432('0xc')](),controller[_0x9432('0xd')]);router['get'](_0x9432('0xe'),auth['isAuthenticated'](),controller[_0x9432('0xf')]);router[_0x9432('0xb')]('/:id',auth[_0x9432('0xc')](),controller[_0x9432('0x10')]);router[_0x9432('0xb')](_0x9432('0x11'),auth[_0x9432('0xc')](),controller['getUnread']);router[_0x9432('0xb')](_0x9432('0x12'),auth['isAuthenticated'](),controller['getMembers']);router[_0x9432('0xb')](_0x9432('0x13'),auth[_0x9432('0xc')](),controller[_0x9432('0x14')]);router['post']('/',auth[_0x9432('0xc')](),controller[_0x9432('0x15')]);router[_0x9432('0x16')](_0x9432('0x12'),auth[_0x9432('0xc')](),controller['addMembers']);router[_0x9432('0x16')](_0x9432('0x13'),auth['isAuthenticated'](),controller[_0x9432('0x17')]);router[_0x9432('0x18')]('/:id',auth[_0x9432('0xc')](),controller[_0x9432('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x9432('0x12'),auth[_0x9432('0xc')](),controller[_0x9432('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index fa46b92..035652f 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 _0xdbbc=['STRING','long','DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','TEXT'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0xdbbc,0x10c));var _0xcdbb=function(_0x5ca81f,_0x26d64c){_0x5ca81f=_0x5ca81f-0x0;var _0x1ea8be=_0xdbbc[_0x5ca81f];return _0x1ea8be;};'use strict';var Sequelize=require(_0xcdbb('0x0'));module[_0xcdbb('0x1')]={'closed':{'type':Sequelize[_0xcdbb('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xcdbb('0x3')]},'ratingType':{'type':Sequelize[_0xcdbb('0x4')](_0xcdbb('0x5'),'thumb'),'defaultValue':_0xcdbb('0x5')},'ratingMessage':{'type':Sequelize[_0xcdbb('0x6')]},'pathTranscript':{'type':Sequelize[_0xcdbb('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xcdbb('0x7')]},'secondDisposition':{'type':Sequelize[_0xcdbb('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xcdbb('0x7')]},'osName':{'type':Sequelize[_0xcdbb('0x7')]},'osVersion':{'type':Sequelize[_0xcdbb('0x7')]},'deviceModel':{'type':Sequelize[_0xcdbb('0x7')]},'deviceVendor':{'type':Sequelize[_0xcdbb('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xcdbb('0x6')]},'customerIp':{'type':Sequelize[_0xcdbb('0x7')]},'formData':{'type':Sequelize[_0xcdbb('0x6')](_0xcdbb('0x8'))},'read1stAt':{'type':Sequelize[_0xcdbb('0x9')]},'lastMsgAt':{'type':Sequelize[_0xcdbb('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xcdbb('0x4')]('in',_0xcdbb('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xcdbb('0x7')]},'customerPort':{'type':Sequelize[_0xcdbb('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xcdbb('0x6')]}}; \ No newline at end of file +var _0xf16f=['DATE','ENUM','out','sequelize','exports','BOOLEAN','INTEGER','star','thumb','STRING','TEXT','long'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xf16f,0x147));var _0xff16=function(_0xc950e1,_0x3de1f0){_0xc950e1=_0xc950e1-0x0;var _0x26f3c5=_0xf16f[_0xc950e1];return _0x26f3c5;};'use strict';var Sequelize=require(_0xff16('0x0'));module[_0xff16('0x1')]={'closed':{'type':Sequelize[_0xff16('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xff16('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0xff16('0x4'),_0xff16('0x5')),'defaultValue':_0xff16('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xff16('0x6')]},'secondDisposition':{'type':Sequelize[_0xff16('0x6')]},'thirdDisposition':{'type':Sequelize[_0xff16('0x6')]},'note':{'type':Sequelize[_0xff16('0x6')]},'browserName':{'type':Sequelize[_0xff16('0x6')]},'browserVersion':{'type':Sequelize[_0xff16('0x6')]},'osName':{'type':Sequelize[_0xff16('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xff16('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xff16('0x6')]},'referer':{'type':Sequelize[_0xff16('0x7')]},'customerIp':{'type':Sequelize[_0xff16('0x6')]},'formData':{'type':Sequelize[_0xff16('0x7')](_0xff16('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xff16('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xff16('0xa')]('in',_0xff16('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xff16('0x6')]},'customerPort':{'type':Sequelize[_0xff16('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xff16('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 6b5bd12..668d149 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 _0x5637=['users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','text','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','role','sequelize','toString','keyBy','merge','ChatInteraction','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.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','groupBy','all','rows','show','rawAttributes','includeAll','include','options','create','catch','update','params','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','ChatOfflineMessageId','root','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','ChatWebsite','Messages','%s%d','agentAlias','System','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatInteractionId','getMyMessages','findAll','setTags','ids','omit','spread','emit','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','secret','Owner','get','mkdirSync','Chat','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','referer','customerIp','customerPort','tail','existsSync','createWriteStream','out','firstName','renderFile','views','transcript-','.pdf','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatInteraction.socket','register','http','client','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','end','name','render','body','contact','interaction','account','Users','fullname','TagIds','split','Tags','push','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.fullname','ui.ChatInteractionId','left_join'];(function(_0x5c9087,_0x4f7f8a){var _0x2c8a69=function(_0x46b66c){while(--_0x46b66c){_0x5c9087['push'](_0x5c9087['shift']());}};_0x2c8a69(++_0x4f7f8a);}(_0x5637,0xd6));var _0x7563=function(_0x281ce6,_0x2d50f2){_0x281ce6=_0x281ce6-0x0;var _0x424048=_0x5637[_0x281ce6];return _0x424048;};'use strict';var emlformat=require(_0x7563('0x0'));var rimraf=require(_0x7563('0x1'));var zipdir=require(_0x7563('0x2'));var jsonpatch=require(_0x7563('0x3'));var rp=require(_0x7563('0x4'));var moment=require(_0x7563('0x5'));var BPromise=require(_0x7563('0x6'));var Mustache=require(_0x7563('0x7'));var util=require('util');var path=require(_0x7563('0x8'));var sox=require(_0x7563('0x9'));var csv=require(_0x7563('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7563('0xb'));var _=require(_0x7563('0xc'));var squel=require(_0x7563('0xd'));var crypto=require(_0x7563('0xe'));var jsforce=require(_0x7563('0xf'));var deskjs=require(_0x7563('0x10'));var toCsv=require(_0x7563('0xa'));var querystring=require(_0x7563('0x11'));var Papa=require(_0x7563('0x12'));var Redis=require(_0x7563('0x13'));var authService=require(_0x7563('0x14'));var qs=require(_0x7563('0x15'));var as=require(_0x7563('0x16'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x7563('0x17'));var logger=require(_0x7563('0x18'))(_0x7563('0x19'));var utils=require(_0x7563('0x1a'));var config=require(_0x7563('0x1b'));var licenseUtil=require(_0x7563('0x1c'));var db=require(_0x7563('0x1d'))['db'];config['redis']=_[_0x7563('0x1e')](config[_0x7563('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0x7563('0x20'))(new Redis(config[_0x7563('0x1f')]));require(_0x7563('0x21'))[_0x7563('0x22')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7563('0x23')]({'port':0x232b});var client9004=jayson[_0x7563('0x24')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5b5121,_0x86a695,_0x57146a,_0x4f1f18){return new BPromise(function(_0x7813f8,_0x54d828){var _0x42847a=_0x4f1f18||client;return _0x42847a[_0x7563('0x25')](_0x5b5121,_0x57146a)['then'](function(_0x62c614){logger[_0x7563('0x26')](_0x7563('0x27'),_0x86a695,_0x7563('0x28'));logger['debug'](_0x7563('0x29'),_0x86a695,_0x7563('0x28'),JSON[_0x7563('0x2a')](_0x62c614));if(_0x62c614[_0x7563('0x2b')]){if(_0x62c614['error'][_0x7563('0x2c')]===0x1f4){logger['error'](_0x7563('0x27'),_0x86a695,_0x62c614[_0x7563('0x2b')][_0x7563('0x2d')]);return _0x54d828(_0x62c614[_0x7563('0x2b')][_0x7563('0x2d')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x86a695,_0x62c614['error'][_0x7563('0x2d')]);return _0x7813f8(_0x62c614[_0x7563('0x2b')][_0x7563('0x2d')]);}else{logger[_0x7563('0x26')](_0x7563('0x27'),_0x86a695,_0x7563('0x28'));_0x7813f8(_0x62c614[_0x7563('0x2e')]['message']);}})['catch'](function(_0x3cc29f){logger[_0x7563('0x2b')](_0x7563('0x27'),_0x86a695,_0x3cc29f);_0x54d828(_0x3cc29f);});});}function respondWithStatusCode(_0x398050,_0x34ba95){_0x34ba95=_0x34ba95||0xcc;return function(_0x2678f6){if(_0x2678f6){return _0x398050[_0x7563('0x2f')](_0x34ba95);}return _0x398050[_0x7563('0x30')](_0x34ba95)['end']();};}function respondWithResult(_0x223ca9,_0x137587){_0x137587=_0x137587||0xc8;return function(_0x5a3638){if(_0x5a3638){return _0x223ca9[_0x7563('0x30')](_0x137587)['json'](_0x5a3638);}};}function respondWithFilteredResult(_0x15da54,_0x1f3b6b){return function(_0xcae00a){if(_0xcae00a){var _0xc36791=typeof _0x1f3b6b[_0x7563('0x31')]===_0x7563('0x32')&&typeof _0x1f3b6b[_0x7563('0x33')]===_0x7563('0x32');var _0x76a3f7=_0xcae00a[_0x7563('0x34')];var _0x2c0391=_0xc36791?0x0:_0x1f3b6b[_0x7563('0x31')];var _0x36a427=_0xc36791?_0xcae00a[_0x7563('0x34')]:_0x1f3b6b['offset']+_0x1f3b6b['limit'];var _0x397382;if(_0x36a427>=_0x76a3f7){_0x36a427=_0x76a3f7;_0x397382=0xc8;}else{_0x397382=0xce;}_0x15da54[_0x7563('0x30')](_0x397382);return _0x15da54[_0x7563('0x35')](_0x7563('0x36'),_0x2c0391+'-'+_0x36a427+'/'+_0x76a3f7)[_0x7563('0x37')](_0xcae00a);}return null;};}function patchUpdates(_0x1f0711){return function(_0x1f52a0){try{jsonpatch['apply'](_0x1f52a0,_0x1f0711,!![]);}catch(_0x4b9abd){return BPromise[_0x7563('0x38')](_0x4b9abd);}return _0x1f52a0[_0x7563('0x39')]();};}function saveUpdates(_0x58bb02,_0x2562e0){return function(_0x3dcbbf){if(_0x3dcbbf){return _0x3dcbbf['update'](_0x58bb02)[_0x7563('0x3a')](function(_0x3dab53){return _0x3dab53;});}return null;};}function removeEntity(_0x89aba,_0x1dcffe){return function(_0x1257a1){if(_0x1257a1){return _0x1257a1[_0x7563('0x3b')]()[_0x7563('0x3a')](function(){_0x89aba[_0x7563('0x30')](0xcc)[_0x7563('0x3c')]();});}};}function handleEntityNotFound(_0x2305ab,_0x50a587){return function(_0x31f230){if(!_0x31f230){_0x2305ab[_0x7563('0x2f')](0x194);}return _0x31f230;};}function handleError(_0x2fef9c,_0x1e7cb3){_0x1e7cb3=_0x1e7cb3||0x1f4;return function(_0xd9756e){logger['error'](_0xd9756e['stack']);if(_0xd9756e['name']){delete _0xd9756e[_0x7563('0x3d')];}_0x2fef9c['status'](_0x1e7cb3)['send'](_0xd9756e);};}function getMustacheRender(_0x572401,_0x19fbe9){return Mustache[_0x7563('0x3e')](_0x572401,_['merge'](_0x19fbe9[_0x7563('0x3f')],{'contact':_0x19fbe9[_0x7563('0x40')],'message':_0x19fbe9[_0x7563('0x2d')],'agent':_0x19fbe9['agent'],'interaction':_0x19fbe9[_0x7563('0x41')],'account':_0x19fbe9[_0x7563('0x42')]}))||'';}function getInteractionUsers(_0x4d3c22,_0x337f6c){return new BPromise(function(_0x2e3085,_0x5e4df2){try{if(_0x337f6c[_0x4d3c22['id']]){_0x4d3c22[_0x7563('0x43')]=_['map'](_0x337f6c[_0x4d3c22['id']],function(_0x36cf07){return{'id':_0x36cf07['id'],'fullname':_0x36cf07[_0x7563('0x44')]};});}}catch(_0x2a0c9e){_0x5e4df2(_0x2a0c9e);}_0x2e3085(_0x4d3c22);});}function getInteractionTags(_0x369ba5,_0x3ecf1b){return new BPromise(function(_0x5e4260,_0x3b9a49){try{if(_0x369ba5['TagIds']){_0x369ba5['Tags']=[];_0x369ba5[_0x7563('0x45')][_0x7563('0x46')](',')['forEach'](function(_0x3eaad0){_0x369ba5[_0x7563('0x47')][_0x7563('0x48')](_0x3ecf1b[_0x3eaad0]);});}delete _0x369ba5[_0x7563('0x45')];}catch(_0x24bfd5){_0x3b9a49(_0x24bfd5);}_0x5e4260(_0x369ba5);});}function updateChatInteraction(_0x356dc0,_0x269d7b,_0x4a7950){return new BPromise(function(_0x52a9d1,_0x4bd037){return getInteractionUsers(_0x356dc0,_0x4a7950)[_0x7563('0x3a')](function(_0x5be2cc){return getInteractionTags(_0x5be2cc,_0x269d7b);})[_0x7563('0x3a')](function(_0x2479b6){_0x52a9d1(_0x2479b6);})['catch'](function(_0x376268){_0x4bd037(_0x376268);});});}exports[_0x7563('0x49')]=function(_0x1d5f3e,_0x313ba9){var _0x5700bd={},_0x4ccf0d={},_0x1193cc={'count':0x0,'rows':[]};var _0x2a4e05=_[_0x7563('0x4a')](db['ChatInteraction']['rawAttributes'],function(_0x59471c){return{'name':_0x59471c['fieldName'],'type':_0x59471c[_0x7563('0x4b')][_0x7563('0x4c')]};});_0x4ccf0d[_0x7563('0x4d')]=_['map'](_0x2a4e05,_0x7563('0x3d'));_0x4ccf0d[_0x7563('0x4e')]=_[_0x7563('0x4f')](_0x1d5f3e['query']);_0x4ccf0d['filters']=_[_0x7563('0x50')](_0x4ccf0d[_0x7563('0x4d')],_0x4ccf0d[_0x7563('0x4e')]);_0x5700bd[_0x7563('0x51')]=_[_0x7563('0x50')](_0x4ccf0d['model'],qs['fields'](_0x1d5f3e[_0x7563('0x4e')][_0x7563('0x52')]));_0x5700bd[_0x7563('0x51')]=_0x5700bd['attributes'][_0x7563('0x53')]?_0x5700bd[_0x7563('0x51')]:_0x4ccf0d[_0x7563('0x4d')];if(!_0x1d5f3e['query'][_0x7563('0x54')](_0x7563('0x55'))){_0x5700bd[_0x7563('0x33')]=qs['limit'](_0x1d5f3e[_0x7563('0x4e')][_0x7563('0x33')]);_0x5700bd[_0x7563('0x31')]=qs[_0x7563('0x31')](_0x1d5f3e[_0x7563('0x4e')][_0x7563('0x31')]);}_0x5700bd[_0x7563('0x56')]=qs['sort'](_0x1d5f3e[_0x7563('0x4e')][_0x7563('0x57')]);_0x5700bd[_0x7563('0x58')]=qs['filters'](_[_0x7563('0x59')](_0x1d5f3e[_0x7563('0x4e')],_0x4ccf0d[_0x7563('0x5a')]),_0x2a4e05);var _0x1f9376=[];var _0x2b17de=squel[_0x7563('0x5b')]()[_0x7563('0x5c')]('id')[_0x7563('0x5c')]('name')[_0x7563('0x5c')](_0x7563('0x5d'))[_0x7563('0x5e')](_0x7563('0x5f'));var _0x478a09=squel[_0x7563('0x5b')]()['field']('u.id')[_0x7563('0x5c')](_0x7563('0x60'))['field'](_0x7563('0x61'))[_0x7563('0x5e')]('user_has_chat_interactions','ui')[_0x7563('0x62')](_0x7563('0x63'),'u','u.id\x20=\x20ui.UserId');var _0x3a4b03=squel[_0x7563('0x5b')]()[_0x7563('0x5e')]('chat_interactions','i')[_0x7563('0x62')](_0x7563('0x64'),'c',_0x7563('0x65'))['left_join']('users','o',_0x7563('0x66'))['left_join']('chat_websites','a',_0x7563('0x67'))['left_join'](_0x7563('0x68'),'me',_0x7563('0x69'))[_0x7563('0x62')](_0x7563('0x6a'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x7563('0x62')](_0x7563('0x5f'),'t',_0x7563('0x6b'));var _0x5a4a5f=squel[_0x7563('0x6c')]();var _0x23c1db=[];var _0x323593=squel[_0x7563('0x6c')]();var _0x1d2c10;if(_0x1d5f3e[_0x7563('0x4e')]['search']){_0x1d2c10=as[_0x7563('0x6d')](_0x1d5f3e[_0x7563('0x4e')][_0x7563('0x6e')]);var _0x4318c4=_0x1d2c10[_0x7563('0x6f')];for(var _0x56399d=0x0;_0x56399d<_0x1d2c10[_0x7563('0x70')]['length'];_0x56399d++){var _0x43dc3f=_0x1d2c10[_0x7563('0x70')][_0x56399d];var _0x34809a='i';var _0x499f44=_[_0x7563('0x71')](_0x2a4e05,['name',_0x43dc3f[_0x7563('0x5c')]]);if(!_0x499f44){switch(_0x43dc3f['field']){case'unreadMessages':if(_0x43dc3f[_0x7563('0x72')]==0x1){_0x3a4b03[_0x7563('0x73')]('`'+_0x43dc3f[_0x7563('0x5c')]+'`\x20=\x200');}else{_0x3a4b03[_0x7563('0x73')]('`'+_0x43dc3f[_0x7563('0x5c')]+_0x7563('0x74'));}break;case _0x7563('0x75'):if(_0x43dc3f['operator']==='$substring'){if(_0x43dc3f[_0x7563('0x72')][_0x7563('0x46')]('\x20')[_0x7563('0x53')]>0x1){_0x5a4a5f[_0x4318c4](_0x7563('0x76'),qs[_0x7563('0x77')](_0x43dc3f[_0x7563('0x72')]),null);}else{var _0x522876='%'+_0x43dc3f['value']+'%';_0x5a4a5f[_0x4318c4](_0x7563('0x78'),_0x522876,_0x522876,_0x522876);}}else{_0x499f44=_['find'](_0x2a4e05,[_0x7563('0x3d'),'ContactId']);_0x43dc3f[_0x7563('0x5c')]=_0x7563('0x79');_0x2737d7=as[_0x7563('0x7a')](_0x34809a,_0x499f44[_0x7563('0x4b')],_0x43dc3f);_0x5a4a5f[_0x4318c4](_0x2737d7['text'],_0x2737d7[_0x7563('0x72')][_0x7563('0x7b')],_0x2737d7[_0x7563('0x72')][_0x7563('0x3c')]);}break;case _0x7563('0x7c'):var _0x30f216=_0x43dc3f['value'][_0x7563('0x46')](',')['map'](function(_0x803076){return Number(_0x803076);});_0x30f216[_0x7563('0x7d')](function(_0x276692){_0x323593['or'](_0x7563('0x7e'),'%,'+_0x276692+',%');});_0x23c1db=_[_0x7563('0x7f')](_0x23c1db,_0x30f216);break;case _0x7563('0x80'):if(_0x43dc3f[_0x7563('0x81')]===_0x7563('0x82')){_0x5a4a5f[_0x4318c4]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x43dc3f[_0x7563('0x72')]+'%',null);}else{_0x499f44=_['find'](_0x2a4e05,[_0x7563('0x3d'),'UserId']);_0x43dc3f[_0x7563('0x5c')]='UserId';_0x2737d7=as['buildExpression'](_0x34809a,_0x499f44[_0x7563('0x4b')],_0x43dc3f);_0x5a4a5f[_0x4318c4](_0x2737d7[_0x7563('0x83')],_0x2737d7[_0x7563('0x72')]['start'],_0x2737d7[_0x7563('0x72')][_0x7563('0x3c')]);}break;case _0x7563('0x3f'):_0x2737d7=as[_0x7563('0x7a')]('me',null,_0x43dc3f);_0x5a4a5f[_0x4318c4](_0x2737d7[_0x7563('0x83')],_0x2737d7['value'][_0x7563('0x7b')],_0x2737d7['value'][_0x7563('0x3c')]);break;}}else{var _0x2737d7=as[_0x7563('0x7a')](_0x34809a,_0x499f44[_0x7563('0x4b')],_0x43dc3f);_0x5a4a5f[_0x4318c4](_0x2737d7[_0x7563('0x83')],_0x2737d7[_0x7563('0x72')]['start'],_0x2737d7[_0x7563('0x72')][_0x7563('0x3c')]);}}}else{var _0xe2f784=_(_0x1d5f3e[_0x7563('0x4e')])['keys']()[_0x7563('0x4a')](function(_0x5e3b2f){return _[_0x7563('0x84')](_0x2a4e05,['name',_0x5e3b2f])?_0x5e3b2f:undefined;})[_0x7563('0x85')]()[_0x7563('0x72')]();if(!_[_0x7563('0x86')](_0xe2f784)){_0xe2f784[_0x7563('0x7d')](function(_0x3c2012){if(_0x3c2012==='ChatWebsiteId'){_0x3a4b03['where'](_0x7563('0x87'),[][_0x7563('0x88')](_0x1d5f3e['query'][_0x3c2012]));}else if(_0x3c2012===_0x7563('0x89')){var _0x5843d5=JSON[_0x7563('0x8a')](_0x1d5f3e[_0x7563('0x4e')][_0x3c2012])[_0x7563('0x8b')];var _0x4ad170=JSON[_0x7563('0x8a')](_0x1d5f3e[_0x7563('0x4e')][_0x3c2012])['$lte'];_0x3a4b03['where'](_0x7563('0x8c'),_0x5843d5,_0x4ad170);}else{if(_0x1d5f3e[_0x7563('0x4e')][_0x3c2012]===_0x7563('0x8d')){_0x3a4b03['where']('i.'+_0x3c2012+_0x7563('0x8e'));}else{_0x3a4b03[_0x7563('0x58')]('i.'+_0x3c2012+_0x7563('0x8f'),_0x1d5f3e[_0x7563('0x4e')][_0x3c2012]);}}});}if(_0x1d5f3e[_0x7563('0x4e')][_0x7563('0x90')]){if(_0x1d5f3e[_0x7563('0x4e')][_0x7563('0x90')]==0x1){_0x3a4b03['having']('`unreadMessages`\x20=\x200');}else{_0x3a4b03[_0x7563('0x73')](_0x7563('0x91'));}}if(_0x1d5f3e[_0x7563('0x4e')][_0x7563('0x92')]){_0x23c1db=_[_0x7563('0x93')](_0x1d5f3e[_0x7563('0x4e')][_0x7563('0x92')])?_0x1d5f3e[_0x7563('0x4e')][_0x7563('0x92')]:new Array(_0x1d5f3e[_0x7563('0x4e')]['tag']);_0x23c1db[_0x7563('0x7d')](function(_0x3df3ca){_0x323593['or'](_0x7563('0x7e'),'%,'+_0x3df3ca+',%');});}if(_0x1d5f3e[_0x7563('0x4e')]['filter']){var _0x40e8b7=_0x1d5f3e['query'][_0x7563('0x94')][_0x7563('0x95')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x7563('0x96')](_0x40e8b7)){_0x5a4a5f['or']('i.id\x20LIKE\x20?',_0x40e8b7+'%');}else{_0x5a4a5f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7563('0x77')](_0x40e8b7))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x40e8b7+'%');}}}_0x3a4b03[_0x7563('0x58')](_0x5a4a5f);_0x3a4b03[_0x7563('0x97')](_0x7563('0x98'));var _0x392f35={'type':db[_0x7563('0x99')][_0x7563('0x9a')][_0x7563('0x9b')],'raw':!![]};var _0xc4615b=_0x3a4b03[_0x7563('0x9c')]();_0xc4615b['field'](_0x7563('0x98'));_0xc4615b[_0x7563('0x5c')](_0x7563('0x9d'),_0x7563('0x9e'));if(_0x5700bd[_0x7563('0x56')]){_0x5700bd[_0x7563('0x56')][_0x7563('0x7d')](function(_0x7dc11){var _0x3057c7=_0x7dc11[0x0]===_0x7563('0x9f')?_0x7dc11[0x0]:'i.'+_0x7dc11[0x0];_0x3a4b03[_0x7563('0x56')](_0x3057c7,_0x7dc11[0x1]===_0x7563('0xa0')?![]:!![]);});}if(!_[_0x7563('0x86')](_0x23c1db)){_0x3a4b03['having'](_0x323593);_0xc4615b[_0x7563('0x58')](_0x7563('0xa1'),_0x23c1db);}BPromise[_0x7563('0xa2')]()[_0x7563('0x3a')](function(){if(!_0x1d2c10){if(_0x1d5f3e[_0x7563('0x4e')][_0x7563('0xa3')])return;_0xc4615b[_0x7563('0x58')](_0x7563('0xa4'));_0x3a4b03['where'](_0x7563('0xa4'));return;}if(_0x1d5f3e[_0x7563('0xa5')]['role']!==_0x7563('0xa6'))return;return _0x1d5f3e['user'][_0x7563('0xa7')]({'attributes':['id'],'raw':!![]})[_0x7563('0x3a')](function(_0x182d2f){if(_['isEmpty'](_0x182d2f)){_0xc4615b['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x3a4b03[_0x7563('0x58')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0xc4615b[_0x7563('0x58')]('i.ChatWebsiteId\x20IN\x20?',_[_0x7563('0x4a')](_0x182d2f,'id'));_0x3a4b03[_0x7563('0x58')](_0x7563('0x87'),_[_0x7563('0x4a')](_0x182d2f,'id'));}});})[_0x7563('0x3a')](function(){if(_0x1d5f3e[_0x7563('0xa5')][_0x7563('0xa8')]==='agent'&&!_0x1d2c10&&!_0x1d5f3e[_0x7563('0x4e')][_0x7563('0xa3')])return[];return db[_0x7563('0xa9')][_0x7563('0x4e')](_0xc4615b[_0x7563('0xaa')](),_0x392f35);})[_0x7563('0x3a')](function(_0x1d06b5){_0x1193cc[_0x7563('0x34')]=_0x1d06b5[_0x7563('0x53')];if(_0x1193cc[_0x7563('0x34')]===0x0)return[];return db[_0x7563('0xa9')][_0x7563('0x4e')](_0x2b17de[_0x7563('0xaa')](),_0x392f35)[_0x7563('0x3a')](function(_0x4add75){_0x1f9376=_[_0x7563('0xab')](_0x4add75,'id');_0x392f35=_[_0x7563('0xac')](_0x392f35,{'model':db[_0x7563('0xad')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1d5f3e['query']['fields']){_0x5700bd[_0x7563('0x51')][_0x7563('0x7d')](function(_0x3e9e92){_0x3a4b03['field']('i.'+_0x3e9e92);});}else{_0x3a4b03[_0x7563('0x5c')](_0x7563('0x9d'),_0x7563('0x9e'));_0x3a4b03['field']('a.key',_0x7563('0xae'));_0x3a4b03['field'](_0x7563('0xaf'),_0x7563('0xb0'));_0x3a4b03[_0x7563('0x5c')](_0x7563('0xb1'),'contactName');_0x3a4b03[_0x7563('0x5c')](_0x7563('0xb2'));_0x3a4b03[_0x7563('0x5c')](_0x7563('0xb3'),'Contact.firstName');_0x3a4b03[_0x7563('0x5c')]('c.lastName',_0x7563('0xb4'));_0x3a4b03[_0x7563('0x5c')](_0x7563('0xb5'),_0x7563('0xb6'));_0x3a4b03[_0x7563('0x5c')](_0x7563('0xb7'),'Contact.phone');_0x3a4b03[_0x7563('0x5c')](_0x7563('0xb8'),_0x7563('0xb9'));_0x3a4b03[_0x7563('0x5c')](_0x7563('0xba'),_0x7563('0xbb'));_0x3a4b03[_0x7563('0x5c')]('o.fullname','Owner.fullname');_0x3a4b03['field'](_0x7563('0xbc'),_0x7563('0xbd'));_0x3a4b03['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5700bd[_0x7563('0x33')])_0x3a4b03['limit'](_0x5700bd[_0x7563('0x33')]);if(_0x5700bd[_0x7563('0x31')])_0x3a4b03['offset'](_0x5700bd[_0x7563('0x31')]);return db[_0x7563('0xa9')]['query'](_0x3a4b03[_0x7563('0xaa')](),_0x392f35);})[_0x7563('0x3a')](function(_0x4c1808){if(_0x4c1808['length']>0x0)_0x478a09['where']('ui.ChatInteractionId\x20IN\x20?',_[_0x7563('0x4a')](_0x4c1808,'id'));return db[_0x7563('0xa9')]['query'](_0x478a09[_0x7563('0xaa')](),_0x392f35)[_0x7563('0x3a')](function(_0x1c7b4e){var _0x17d28b=_[_0x7563('0xbe')](_0x1c7b4e,'ChatInteractionId');var _0x5a7acb=[];_0x4c1808['forEach'](function(_0x1147c5){_0x5a7acb[_0x7563('0x48')](updateChatInteraction(_0x1147c5,_0x1f9376,_0x17d28b));});return BPromise[_0x7563('0xbf')](_0x5a7acb);});});})[_0x7563('0x3a')](function(_0x403c5b){_0x1193cc[_0x7563('0xc0')]=_0x403c5b;return _0x1193cc;})[_0x7563('0x3a')](respondWithFilteredResult(_0x313ba9,_0x5700bd))['catch'](handleError(_0x313ba9,null));};exports[_0x7563('0xc1')]=function(_0x2c7e03,_0x268909){var _0x436faf={'raw':![],'where':{'id':_0x2c7e03['params']['id']}},_0x3cbf15={};_0x3cbf15[_0x7563('0x4d')]=_['keys'](db[_0x7563('0xad')][_0x7563('0xc2')]);_0x3cbf15[_0x7563('0x4e')]=_[_0x7563('0x4f')](_0x2c7e03[_0x7563('0x4e')]);_0x3cbf15['filters']=_[_0x7563('0x50')](_0x3cbf15[_0x7563('0x4d')],_0x3cbf15[_0x7563('0x4e')]);_0x436faf[_0x7563('0x51')]=_[_0x7563('0x50')](_0x3cbf15[_0x7563('0x4d')],qs[_0x7563('0x52')](_0x2c7e03['query']['fields']));_0x436faf[_0x7563('0x51')]=_0x436faf['attributes']['length']?_0x436faf['attributes']:_0x3cbf15[_0x7563('0x4d')];if(_0x2c7e03[_0x7563('0x4e')][_0x7563('0xc3')]){_0x436faf[_0x7563('0xc4')]=[{'all':!![]}];}_0x436faf=_[_0x7563('0xac')]({},_0x436faf,_0x2c7e03[_0x7563('0xc5')]);return db[_0x7563('0xad')][_0x7563('0x71')](_0x436faf)[_0x7563('0x3a')](handleEntityNotFound(_0x268909,null))[_0x7563('0x3a')](respondWithResult(_0x268909,null))['catch'](handleError(_0x268909,null));};exports[_0x7563('0xc6')]=function(_0x55c1e8,_0x439821){return db['ChatInteraction'][_0x7563('0xc6')](_0x55c1e8[_0x7563('0x3f')],{})[_0x7563('0x3a')](respondWithResult(_0x439821,0xc9))[_0x7563('0xc7')](handleError(_0x439821,null));};exports[_0x7563('0xc8')]=function(_0x42133b,_0x4b6754){if(_0x42133b[_0x7563('0x3f')]['id']){delete _0x42133b['body']['id'];}return db[_0x7563('0xad')]['find']({'where':{'id':_0x42133b[_0x7563('0xc9')]['id']}})[_0x7563('0x3a')](handleEntityNotFound(_0x4b6754,null))[_0x7563('0x3a')](saveUpdates(_0x42133b[_0x7563('0x3f')],null))[_0x7563('0x3a')](respondWithResult(_0x4b6754,null))[_0x7563('0xc7')](handleError(_0x4b6754,null));};exports[_0x7563('0x3b')]=function(_0x46062e,_0x2256ec){return db['ChatInteraction']['find']({'where':{'id':_0x46062e[_0x7563('0xc9')]['id']}})[_0x7563('0x3a')](handleEntityNotFound(_0x2256ec,null))[_0x7563('0x3a')](removeEntity(_0x2256ec,null))['catch'](handleError(_0x2256ec,null));};exports[_0x7563('0xca')]=function(_0x2f3e7b,_0xb14f47){return db[_0x7563('0xad')][_0x7563('0xca')]()[_0x7563('0x3a')](respondWithResult(_0xb14f47,null))[_0x7563('0xc7')](handleError(_0xb14f47,null));};exports[_0x7563('0xcb')]=function(_0x49d69a,_0x16ee76){var _0x855207=_0x49d69a['params']['id'];var _0x410e7d;var _0x240051;var _0x1ddd27;return db[_0x7563('0xad')][_0x7563('0xcc')]({'where':{'id':_0x855207}})[_0x7563('0x3a')](function(_0x3a5843){_0x410e7d=_0x3a5843;return db['ChatWebsite'][_0x7563('0xcc')]({'where':{'id':_0x3a5843[_0x7563('0xa3')]},'attributes':['id',_0x7563('0xcd'),_0x7563('0xce'),_0x7563('0xcf'),_0x7563('0xd0'),'vidaooMetadata'],'raw':!![]});})[_0x7563('0x3a')](function(_0x548143){if(_0x548143&&_0x548143['vidaooApiKey']&&_0x548143[_0x7563('0xce')]){_0x240051=_0x548143;var _0x49d7f2={'interaction':{'id':_0x855207},'agent':{'id':_0x49d69a[_0x7563('0xa5')]['id'],'name':_0x49d69a[_0x7563('0xa5')][_0x7563('0x3d')],'fullname':_0x49d69a['user'][_0x7563('0x44')],'email':_0x49d69a[_0x7563('0xa5')][_0x7563('0xd1')]},'contact':_0x49d69a[_0x7563('0x3f')][_0x7563('0x40')],'account':_0x49d69a[_0x7563('0x3f')][_0x7563('0x42')]};var _0x2c5e9d={'rejectUnauthorized':![],'method':'POST','url':_0x7563('0xd2'),'headers':{'X-APIKEY':_0x548143[_0x7563('0xcd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x49d69a[_0x7563('0xa5')][_0x7563('0xd1')]],'buttons':null,'topic':_0x240051['vidaooTopic'],'note':_[_0x7563('0xd3')](_0x240051[_0x7563('0xd0')])?null:getMustacheRender(_0x240051[_0x7563('0xd0')],_0x49d7f2),'metadata':null},'redirect':_0x7563('0xd4'),'json':!![]};try{if(!_[_0x7563('0xd3')](_0x240051[_0x7563('0xd5')])){var _0x15a960=getMustacheRender(_0x240051['vidaooMetadata'],_0x49d7f2);var _0x470dcd=JSON['parse'](_0x15a960);_0x2c5e9d[_0x7563('0x3f')]['metadata']=_0x470dcd;}}catch(_0x951eec){throw new db[(_0x7563('0x99'))][(_0x7563('0xd6'))](_0x7563('0xd7'));}return rp(_0x2c5e9d);}else{throw new db['Sequelize'][(_0x7563('0xd6'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x7563('0x3a')](function(_0x38d2e5){_0x1ddd27=_0x38d2e5;if(_0x1ddd27['id']){var _0x2cfe86={'body':_0x1ddd27['join_url'],'ChatWebsiteId':_0x240051['id'],'ChatInteractionId':_0x410e7d['id'],'direction':'out','UserId':_0x49d69a[_0x7563('0xa5')]['id']};return db[_0x7563('0xd8')][_0x7563('0xc6')](_0x2cfe86,{});}else{throw new db[(_0x7563('0x99'))][(_0x7563('0xd6'))](_0x7563('0xd9'));}})['then'](function(){return _0x410e7d[_0x7563('0xda')]({'vidaooSessionId':_0x1ddd27['id']});})[_0x7563('0x3a')](respondWithResult(_0x16ee76,null))[_0x7563('0xc7')](handleError(_0x16ee76,null));};exports[_0x7563('0xdb')]=function(_0x16df25,_0x1cd406){if(_0x16df25[_0x7563('0x3f')]['id']){delete _0x16df25['body']['id'];}return db['ChatInteraction'][_0x7563('0x71')]({'where':{'id':_0x16df25['params']['id']},'include':[{'model':db[_0x7563('0xdc')],'as':_0x7563('0x75')}]})[_0x7563('0x3a')](handleEntityNotFound(_0x1cd406,null))[_0x7563('0x3a')](saveUpdates(_0x16df25[_0x7563('0x3f')],null))[_0x7563('0x3a')](respondWithResult(_0x1cd406,null))[_0x7563('0xc7')](handleError(_0x1cd406,null));};exports[_0x7563('0xdd')]=function(_0x4310e9,_0x1670b9,_0x1a23df){if(_0x4310e9[_0x7563('0x3f')]['id']){delete _0x4310e9['body']['id'];}return db[_0x7563('0xad')][_0x7563('0x71')]({'where':{'id':_0x4310e9[_0x7563('0xc9')]['id']}})['then'](function(_0x4fb7ec){if(!_0x4fb7ec){logger[_0x7563('0x2b')](_0x7563('0xde'),'abandon',0x194,_0x7563('0xdf'));_0x1670b9[_0x7563('0x2f')](0x194);}else{if(_0x4fb7ec[_0x7563('0xe0')]){throw new db['Sequelize'][(_0x7563('0xd6'))](_0x7563('0xe1'));}}return _0x4fb7ec;})[_0x7563('0x3a')](function(_0x3906ec){if(_0x3906ec){return _0x3906ec[_0x7563('0xc8')]({'closed':_0x4310e9[_0x7563('0x3f')][_0x7563('0xe2')],'disposition':_0x4310e9[_0x7563('0x3f')][_0x7563('0xe3')]})[_0x7563('0x3a')](function(_0x317622){return _0x317622;});}})[_0x7563('0x3a')](function(_0x3448c1){return respondWithRpcPromise(_0x7563('0xe4'),_0x7563('0xdd'),_0x4310e9[_0x7563('0x3f')],client9004);})[_0x7563('0x3a')](respondWithResult(_0x1670b9,null))[_0x7563('0xc7')](handleError(_0x1670b9,null));};exports[_0x7563('0xe5')]=function(_0x50d774,_0x469550,_0x1570a4){_0x50d774[_0x7563('0x3f')][_0x7563('0x3d')]=_0x50d774['file'][_0x7563('0xe6')];_0x50d774[_0x7563('0x3f')][_0x7563('0xe7')]=_0x50d774[_0x7563('0xe8')][_0x7563('0xe9')];_0x50d774[_0x7563('0x3f')][_0x7563('0x4b')]=_0x50d774[_0x7563('0xe8')][_0x7563('0xea')];return db[_0x7563('0xeb')]['create'](_0x50d774[_0x7563('0x3f')])[_0x7563('0x3a')](respondWithResult(_0x469550,0xc9))[_0x7563('0xc7')](handleError(_0x469550,null));};exports[_0x7563('0xec')]=function(_0x25119f,_0x55d4e5,_0x4b725d){return db[_0x7563('0xad')]['findOne']({'where':{'id':_0x25119f[_0x7563('0xc9')]['id']},'raw':!![]})[_0x7563('0x3a')](handleEntityNotFound(_0x55d4e5,null))[_0x7563('0x3a')](function(_0x1d1ed0){if(_0x1d1ed0){if(_0x1d1ed0[_0x7563('0xe2')]){return _0x55d4e5['status'](0x193)[_0x7563('0x37')]({'status':0x193,'message':'Unauthorized'});}return db[_0x7563('0xeb')][_0x7563('0xcc')]({'where':{'id':_0x25119f[_0x7563('0x4e')]['attachId']},'raw':!![]})[_0x7563('0x3a')](handleEntityNotFound(_0x55d4e5,null));}})[_0x7563('0x3a')](function(_0x56dd6f){if(_0x56dd6f){var _0x4db0a6=_0x56dd6f[_0x7563('0xed')]!==null;var _0xadff04=path['join'](config[_0x7563('0xee')],'server/files/attachments/');if(_0x4db0a6){_0xadff04=path[_0x7563('0xef')](_0xadff04,_0x7563('0xf0'));}var _0x40db33=path[_0x7563('0xef')](_0xadff04,_0x56dd6f[_0x7563('0xe7')]);return _0x55d4e5[_0x7563('0xf1')](_0x40db33);}})['catch'](handleError(_0x55d4e5,null));};exports[_0x7563('0xf2')]=function(_0x2e769a,_0x125fad){var _0x5c8259=null;var _0x5eca1d=null;var _0x33bab1=null;var _0x2cc552=null;if(_0x2e769a[_0x7563('0x3f')]['id']){delete _0x2e769a[_0x7563('0x3f')]['id'];}if(_0x2e769a[_0x7563('0x3f')][_0x7563('0xf3')]){_0x2cc552=path[_0x7563('0xef')](config[_0x7563('0xee')],_0x7563('0xf4'),util[_0x7563('0xf5')]('transcript-%s.txt',Date[_0x7563('0xf6')]()));_0x2e769a[_0x7563('0x3f')][_0x7563('0xf7')]=_0x2cc552;}return db['ChatInteraction'][_0x7563('0x71')]({'where':{'id':_0x2e769a[_0x7563('0xc9')]['id']},'include':[{'model':db[_0x7563('0xd8')],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})[_0x7563('0x3a')](handleEntityNotFound(_0x125fad,null))[_0x7563('0x3a')](saveUpdates(_0x2e769a[_0x7563('0x3f')],null))[_0x7563('0x3a')](function(_0x356df7){if(_0x356df7){_0x5c8259=_0x356df7;return db[_0x7563('0xf8')][_0x7563('0x71')]({'where':{'id':_0x5c8259[_0x7563('0xa3')]}});}})[_0x7563('0x3a')](function(_0x46542d){if(_0x46542d){_0x33bab1=_0x46542d;return db[_0x7563('0xdc')][_0x7563('0x71')]({'where':{'id':_0x5c8259[_0x7563('0x79')]}});}})[_0x7563('0x3a')](function(_0x5f0ed1){if(_0x5f0ed1){_0x5eca1d=_0x5f0ed1;if(_0x2cc552){var _0x33362e=null;for(var _0x3fe546=0x1;_0x3fe546<_0x5c8259[_0x7563('0xf9')][_0x7563('0x53')];++_0x3fe546){_0x33362e=_0x5c8259[_0x7563('0xf9')][_0x3fe546];var _0x20b3ed=_0x33362e[_0x7563('0xe0')]?util[_0x7563('0xf5')](_0x7563('0xfa'),_0x33bab1[_0x7563('0xfb')],_0x33362e['UserId']):_0x7563('0xfc');var _0x5516f4=_0x2e769a['body']['customer']||util[_0x7563('0xf5')]('%s%d','Visitor',_0x33362e['ContactId']);switch(_0x33bab1[_0x7563('0xfd')]){case _0x7563('0xfe'):_0x20b3ed=_0x33362e[_0x7563('0xe0')]?util['format']('%s%d',_0x33bab1[_0x7563('0xfb')],_0x33362e[_0x7563('0xe0')]):_0x7563('0xfc');break;case'agent_alias':_0x20b3ed=_0x33362e[_0x7563('0xe0')]?_0x33362e[_0x7563('0x80')][_0x7563('0xff')]||_0x33362e[_0x7563('0x80')]['fullname']:'System';break;case _0x7563('0x100'):_0x20b3ed=_0x33362e['UserId']?_0x33362e['User']['fullname']:'System';break;default:_0x20b3ed=_0x33362e[_0x7563('0xe0')]?util[_0x7563('0xf5')](_0x7563('0xfa'),_0x33bab1[_0x7563('0xfb')],_0x33362e['UserId']):_0x7563('0xfc');}var _0xa83934=util['format'](_0x7563('0x101'),moment(_0x33362e[_0x7563('0x89')])[_0x7563('0xf5')]('MM/DD/YYYY\x20HH:mm:ss'),_0x33362e[_0x7563('0x102')]==='in'?_0x5516f4:_0x20b3ed,_0x33362e[_0x7563('0x3f')]);if(!_0x33362e['secret']){fs[_0x7563('0x103')](_0x2cc552,_0xa83934);}}return db[_0x7563('0x104')][_0x7563('0xcc')]({'where':{'service':!![]},'include':[{'model':db[_0x7563('0x105')],'as':_0x7563('0x106'),'raw':!![]}]});}}})[_0x7563('0x3a')](function(_0x1dd3aa){if(_0x1dd3aa&&_0x1dd3aa['Smtp']&&_0x2e769a['body']){var _0x1e37eb={'tls':{'rejectUnauthorized':![]}};if(_0x1dd3aa[_0x7563('0x106')][_0x7563('0x107')]){_0x1e37eb[_0x7563('0x107')]=_0x1dd3aa['Smtp'][_0x7563('0x107')];}else{_0x1e37eb[_0x7563('0x108')]=_0x1dd3aa[_0x7563('0x106')]['host'];_0x1e37eb[_0x7563('0x109')]=_0x1dd3aa['Smtp'][_0x7563('0x109')];_0x1e37eb[_0x7563('0x10a')]=_0x1dd3aa[_0x7563('0x106')]['secure'];}if(_0x1dd3aa[_0x7563('0x106')][_0x7563('0x10b')]){_0x1e37eb[_0x7563('0x10c')]={'user':_0x1dd3aa[_0x7563('0x106')]['user'],'pass':_0x1dd3aa[_0x7563('0x106')][_0x7563('0x10d')]};}return respondWithRpcPromise(_0x7563('0x10e'),'sendMail',{'account':_0x1e37eb,'message':{'from':util[_0x7563('0xf5')](_0x7563('0x10f'),_0x1dd3aa[_0x7563('0x3d')],_0x1dd3aa[_0x7563('0xd1')]||_0x1dd3aa[_0x7563('0x106')][_0x7563('0xa5')]),'to':_0x2e769a[_0x7563('0x3f')][_0x7563('0xf3')],'subject':'Mail\x20Transcript','text':util[_0x7563('0xf5')](_0x7563('0x110'),_0x2e769a[_0x7563('0x3f')]['mailTranscript']),'attachments':[{'path':_0x2cc552}]}})[_0x7563('0x3a')](function(){return _0x5c8259;})[_0x7563('0xc7')](function(_0x405c5d){console[_0x7563('0x2b')](_0x405c5d);});}else{return _0x5c8259;}})[_0x7563('0x3a')](respondWithStatusCode(_0x125fad,0xc8))[_0x7563('0xc7')](handleError(_0x125fad,null));};exports[_0x7563('0x111')]=function(_0x539c09,_0x1803af,_0x4d3d5f){return db[_0x7563('0xd8')][_0x7563('0x71')]({'where':{'id':_0x539c09['params']['id']}})[_0x7563('0x3a')](handleEntityNotFound(_0x1803af,null))['then'](function(_0x4aa4a4){if(_0x4aa4a4){return _0x4aa4a4[_0x7563('0x111')](_0x539c09['body']['ids'],_['omit'](_0x539c09['body'],['ids','id'])||{});}})[_0x7563('0x3a')](respondWithResult(_0x1803af,null))['catch'](handleError(_0x1803af,null));};exports['getMessages']=function(_0x11645b,_0xc01201,_0x5c965a){var _0x55eaf7={'raw':![],'where':{}};var _0x385909={};var _0x41f2d6={'count':0x0,'rows':[]};return db[_0x7563('0xad')][_0x7563('0xcc')]({'where':{'id':_0x11645b[_0x7563('0xc9')]['id']}})[_0x7563('0x3a')](handleEntityNotFound(_0xc01201,null))[_0x7563('0x3a')](function(_0x323777){if(_0x323777){_0x385909[_0x7563('0x4d')]=_['keys'](db['ChatMessage'][_0x7563('0xc2')]);_0x385909[_0x7563('0x4e')]=_[_0x7563('0x4f')](_0x11645b[_0x7563('0x4e')]);_0x385909['filters']=_[_0x7563('0x50')](_0x385909[_0x7563('0x4d')],_0x385909[_0x7563('0x4e')]);_0x55eaf7[_0x7563('0x51')]=_[_0x7563('0x50')](_0x385909[_0x7563('0x4d')],qs[_0x7563('0x52')](_0x11645b['query'][_0x7563('0x52')]));_0x55eaf7[_0x7563('0x51')]=_0x55eaf7[_0x7563('0x51')][_0x7563('0x53')]?_0x55eaf7[_0x7563('0x51')]:_0x385909['model'];if(!_0x11645b[_0x7563('0x4e')]['hasOwnProperty']('nolimit')){_0x55eaf7[_0x7563('0x33')]=qs['limit'](_0x11645b['query']['limit']);_0x55eaf7[_0x7563('0x31')]=qs[_0x7563('0x31')](_0x11645b[_0x7563('0x4e')]['offset']);}_0x55eaf7['order']=qs[_0x7563('0x57')](_0x11645b[_0x7563('0x4e')][_0x7563('0x57')]);_0x55eaf7[_0x7563('0x58')]=qs['filters'](_[_0x7563('0x59')](_0x11645b['query'],_0x385909[_0x7563('0x5a')]));_0x55eaf7[_0x7563('0x58')][_0x7563('0x112')]=_0x323777['id'];if(_0x11645b[_0x7563('0x4e')][_0x7563('0x94')]){_0x55eaf7[_0x7563('0x58')]=_[_0x7563('0xac')](_0x55eaf7[_0x7563('0x58')],{'$or':_[_0x7563('0x4a')](_0x55eaf7['attributes'],function(_0x51a3fc){var _0x1fc25f={};_0x1fc25f[_0x51a3fc]={'$like':'%'+_0x11645b[_0x7563('0x4e')][_0x7563('0x94')]+'%'};return _0x1fc25f;})});}if(_0x11645b[_0x7563('0x4e')][_0x7563('0x8b')]){var _0x2d988a=_0x11645b[_0x7563('0x4e')][_0x7563('0x8b')]['split'](',');var _0x5b09d9={};_0x5b09d9[_0x2d988a[0x0]]={'$gte':moment(_0x2d988a[0x1])[_0x7563('0xf5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x55eaf7[_0x7563('0x58')]=_[_0x7563('0xac')](_0x55eaf7['where'],_0x5b09d9);}_0x55eaf7=_[_0x7563('0xac')]({},_0x55eaf7,_0x11645b[_0x7563('0xc5')]);return db[_0x7563('0xd8')][_0x7563('0x34')]({'where':_0x55eaf7[_0x7563('0x58')]})[_0x7563('0x3a')](function(_0x5c9f24){_0x41f2d6[_0x7563('0x34')]=_0x5c9f24;if(_0x11645b['query'][_0x7563('0xc3')]){_0x55eaf7[_0x7563('0xc4')]=[{'all':!![]}];}return db[_0x7563('0xd8')]['findAll'](_0x55eaf7);})['then'](function(_0x3e1b69){_0x41f2d6[_0x7563('0xc0')]=_0x3e1b69;return _0x41f2d6;});}})['then'](respondWithFilteredResult(_0xc01201,_0x55eaf7))['catch'](handleError(_0xc01201,null));};exports[_0x7563('0x113')]=function(_0x4f66a9,_0x2c122d,_0x3e6b3b){var _0x56b01a={'where':{}},_0xa4a0de={},_0x34c089={'count':0x0,'rows':[]};return db[_0x7563('0xad')][_0x7563('0xcc')]({'where':{'id':_0x4f66a9[_0x7563('0xc9')]['id']}})['then'](handleEntityNotFound(_0x2c122d,null))[_0x7563('0x3a')](function(_0x56b24f){if(_0x56b24f){_0xa4a0de[_0x7563('0x4d')]=_[_0x7563('0x4f')](db['ChatMessage'][_0x7563('0xc2')]);_0xa4a0de[_0x7563('0x4e')]=_[_0x7563('0x4f')](_0x4f66a9[_0x7563('0x4e')]);_0xa4a0de[_0x7563('0x5a')]=_[_0x7563('0x50')](_0xa4a0de[_0x7563('0x4d')],_0xa4a0de[_0x7563('0x4e')]);_0x56b01a['attributes']=_[_0x7563('0x50')](_0xa4a0de[_0x7563('0x4d')],qs[_0x7563('0x52')](_0x4f66a9['query'][_0x7563('0x52')]));_0x56b01a[_0x7563('0x51')]=_0x56b01a['attributes'][_0x7563('0x53')]?_0x56b01a[_0x7563('0x51')]:_0xa4a0de['model'];if(!_0x4f66a9['query']['hasOwnProperty']('nolimit')){_0x56b01a['limit']=qs['limit'](_0x4f66a9[_0x7563('0x4e')][_0x7563('0x33')]);_0x56b01a[_0x7563('0x31')]=qs['offset'](_0x4f66a9[_0x7563('0x4e')][_0x7563('0x31')]);}_0x56b01a['order']=qs['sort'](_0x4f66a9['query'][_0x7563('0x57')]);_0x56b01a[_0x7563('0x58')]=qs[_0x7563('0x5a')](_[_0x7563('0x59')](_0x4f66a9['query'],_0xa4a0de[_0x7563('0x5a')]));_0x56b01a[_0x7563('0x58')][_0x7563('0x112')]=_0x56b24f['id'];if(_0x4f66a9[_0x7563('0x4e')][_0x7563('0x94')]){_0x56b01a['where']=_[_0x7563('0xac')](_0x56b01a[_0x7563('0x58')],{'$or':_[_0x7563('0x4a')](_0x56b01a[_0x7563('0x51')],function(_0x36d485){var _0x1156b5={};_0x1156b5[_0x36d485]={'$like':'%'+_0x4f66a9['query'][_0x7563('0x94')]+'%'};return _0x1156b5;})});}_0x56b01a[_0x7563('0x58')]['secret']=![];if(_0x4f66a9[_0x7563('0x4e')]['id']){_0x56b01a[_0x7563('0x58')]['id']={'$gt':_0x4f66a9['query']['id']};}_0x56b01a=_[_0x7563('0xac')]({},_0x56b01a,_0x4f66a9[_0x7563('0xc5')]);return db[_0x7563('0xd8')][_0x7563('0x34')]({'where':_0x56b01a[_0x7563('0x58')]})[_0x7563('0x3a')](function(_0x2b1729){_0x34c089[_0x7563('0x34')]=_0x2b1729;_0x56b01a[_0x7563('0xc4')]=[];if(_0x4f66a9[_0x7563('0x4e')]['includeAgent']){_0x56b01a[_0x7563('0xc4')]['push']({'model':db[_0x7563('0x80')],'as':_0x7563('0x80'),'attributes':['id',_0x7563('0x44'),_0x7563('0xff')]});}if(_0x4f66a9['query'][_0x7563('0xc3')]){_0x56b01a[_0x7563('0xc4')]=[{'all':!![]}];}return db[_0x7563('0xd8')][_0x7563('0x114')](_0x56b01a);})['then'](function(_0x1eba58){_0x34c089[_0x7563('0xc0')]=_0x1eba58;return _0x34c089;});}})[_0x7563('0x3a')](respondWithFilteredResult(_0x2c122d,_0x56b01a))[_0x7563('0xc7')](handleError(_0x2c122d,null));};exports['addTags']=function(_0x202891,_0x118451,_0x5ad1ef){return db[_0x7563('0xad')][_0x7563('0x71')]({'where':{'id':_0x202891[_0x7563('0xc9')]['id']}})[_0x7563('0x3a')](handleEntityNotFound(_0x118451,null))[_0x7563('0x3a')](function(_0x2977ee){if(_0x2977ee){return _0x2977ee[_0x7563('0x115')](_0x202891[_0x7563('0x3f')][_0x7563('0x116')],_[_0x7563('0x117')](_0x202891[_0x7563('0x3f')],[_0x7563('0x116'),'id'])||{})[_0x7563('0x118')](function(){return db[_0x7563('0x7c')]['findAll']({'attributes':['id',_0x7563('0x3d'),_0x7563('0x5d')],'where':{'id':_0x202891[_0x7563('0x3f')][_0x7563('0x116')]}});})['then'](function(_0x19f7e1){socket[_0x7563('0x119')](_0x7563('0x11a'),{'id':Number(_0x202891[_0x7563('0xc9')]['id']),'tags':_0x19f7e1||[]});return{'id':Number(_0x202891[_0x7563('0xc9')]['id']),'tags':_0x19f7e1||[]};});}})[_0x7563('0x3a')](respondWithResult(_0x118451,null))[_0x7563('0xc7')](handleError(_0x118451,null));};exports[_0x7563('0x11b')]=function(_0x39b3de,_0x582ec,_0x5a4973){return db[_0x7563('0xad')][_0x7563('0x71')]({'where':{'id':_0x39b3de[_0x7563('0xc9')]['id']}})[_0x7563('0x3a')](handleEntityNotFound(_0x582ec,null))[_0x7563('0x3a')](function(_0x258055){if(_0x258055){return _0x258055[_0x7563('0x11b')](_0x39b3de[_0x7563('0x4e')][_0x7563('0x116')]);}})[_0x7563('0x3a')](respondWithStatusCode(_0x582ec,null))[_0x7563('0xc7')](handleError(_0x582ec,null));};exports[_0x7563('0xf1')]=function(_0x4618cb,_0x1d678a){var _0x46a7e0=moment()['unix']()[_0x7563('0xaa')]();var _0x54db48=path[_0x7563('0xef')](config[_0x7563('0xee')],_0x7563('0x11c'),_0x7563('0x11d'),_0x7563('0x11e'));var _0x9b48cd=path[_0x7563('0xef')](config[_0x7563('0xee')],'server','files',_0x7563('0x11f'));var _0x1d00da=path[_0x7563('0xef')](_0x54db48,_0x46a7e0);var _0xfcaff=util[_0x7563('0xf5')](_0x7563('0x120'),_0x4618cb[_0x7563('0xc9')]['id'],_0x46a7e0);var _0x1c1f07=path[_0x7563('0xef')](_0x54db48,_0xfcaff);var _0x20fbf2=[];_0x20fbf2[_0x7563('0x48')]({'model':db[_0x7563('0x80')],'as':_0x7563('0x80'),'attributes':['id','fullname'],'raw':!![]});_0x20fbf2[_0x7563('0x48')]({'model':db[_0x7563('0xdc')],'as':_0x7563('0x75'),'attributes':['id','firstName',_0x7563('0x121')],'raw':!![]});if(_0x4618cb[_0x7563('0x4e')][_0x7563('0x11f')]){_0x20fbf2[_0x7563('0x48')]({'model':db[_0x7563('0xeb')],'as':_0x7563('0xeb'),'raw':!![]});}var _0xbbb338=[{'model':db[_0x7563('0xd8')],'as':_0x7563('0xf9'),'attributes':['id',_0x7563('0x3f'),_0x7563('0x89'),'direction',_0x7563('0x122'),_0x7563('0x90')],'include':_0x20fbf2}];_0xbbb338[_0x7563('0x48')]({'model':db[_0x7563('0xf8')],'as':'Account','attributes':['id',_0x7563('0x3d')]});_0xbbb338[_0x7563('0x48')]({'model':db[_0x7563('0x80')],'as':_0x7563('0x123'),'attributes':['id',_0x7563('0x44')]});return db[_0x7563('0xad')][_0x7563('0x71')]({'where':{'id':_0x4618cb[_0x7563('0xc9')]['id']},'include':_0xbbb338})[_0x7563('0x3a')](handleEntityNotFound(_0x1d678a,null))[_0x7563('0x3a')](function(_0x140c6a){if(_0x140c6a){var _0x5ee527=_0x140c6a[_0x7563('0x124')]({'plain':!![]});fs[_0x7563('0x125')](_0x1d00da);var _0x2862d1={'channel':_0x7563('0x126'),'account':_0x5ee527[_0x7563('0x127')][_0x7563('0x3d')],'agent':_0x5ee527[_0x7563('0x123')]?_0x5ee527['Owner'][_0x7563('0x44')]:_0x7563('0x128'),'createdAt':moment(_0x5ee527[_0x7563('0x89')])[_0x7563('0xf5')](_0x7563('0x129'))[_0x7563('0xaa')](),'closedAt':_0x5ee527[_0x7563('0xe2')]?moment(_0x5ee527[_0x7563('0x12a')])[_0x7563('0xf5')](_0x7563('0x129'))[_0x7563('0xaa')]():'','disposition':_0x5ee527[_0x7563('0xe3')],'chatInfo':{'browser':_0x5ee527['browserName'],'os':_0x5ee527['osName'],'referer':_0x5ee527[_0x7563('0x12b')],'customerIp':_0x5ee527[_0x7563('0x12c')],'customerPort':_0x5ee527[_0x7563('0x12d')]?_0x5ee527[_0x7563('0x12d')]:'N.A.'},'messages':_(_0x5ee527['Messages'])[_0x7563('0x12e')]()[_0x7563('0x94')]({'secret':![]})[_0x7563('0x4a')](function(_0x392b27){if(_0x392b27[_0x7563('0xeb')]){var _0x3b0792=path[_0x7563('0xef')](_0x9b48cd,_0x392b27[_0x7563('0xeb')][_0x7563('0xe7')]);if(fs[_0x7563('0x12f')](_0x3b0792)){fs['createReadStream'](_0x3b0792)['pipe'](fs[_0x7563('0x130')](path['join'](_0x1d00da,_0x392b27['Attachment'][_0x7563('0xe7')])));}}return{'date':moment(_0x392b27[_0x7563('0x89')])[_0x7563('0xf5')](_0x7563('0x129'))[_0x7563('0xaa')](),'sender':_0x392b27[_0x7563('0x102')]===_0x7563('0x131')?_0x392b27[_0x7563('0x80')]?_0x392b27['User'][_0x7563('0x44')]:_0x7563('0xfc'):_0x392b27['Contact'][_0x7563('0x132')]+(_0x392b27[_0x7563('0x75')]['lastName']?'\x20'+_0x392b27[_0x7563('0x75')][_0x7563('0x121')]:''),'body':_0x392b27[_0x7563('0xeb')]?_0x392b27[_0x7563('0xeb')]['basename']:_0x392b27[_0x7563('0x3f')],'direction':_0x392b27['direction']==='out'?'A':'C','secret':_0x392b27[_0x7563('0x122')],'read':_0x392b27[_0x7563('0x90')],'attachment':_0x392b27[_0x7563('0xeb')]};})[_0x7563('0x72')]()};return ejs[_0x7563('0x133')](path['join'](config['root'],_0x7563('0x11c'),_0x7563('0x134'),'downloadInteraction.html'),{'interaction':_0x2862d1})[_0x7563('0x3a')](function(_0x346354){var _0x16c46c=path[_0x7563('0xef')](_0x1d00da,_0x7563('0x135')+_0x5ee527['id']+'-'+_0x46a7e0+_0x7563('0x136'));var _0x513a34={'path':_0x16c46c,'channel':_0x7563('0x126'),'interactionId':_0x5ee527['id']};return pdf['createPdfFromHTML'](_0x346354,_0x513a34);})[_0x7563('0x3a')](function(){return new BPromise(function(_0x2e3e5,_0x48d2b7){zipdir(_0x1d00da,{'saveTo':_0x1c1f07},function(_0x2fbafc,_0x2a4dbc){if(_0x2fbafc)return _0x48d2b7(_0x2fbafc);return _0x2e3e5(_0x2a4dbc);});})[_0x7563('0x3a')](function(){return new BPromise(function(_0x1c8e61,_0x2c3150){rimraf(_0x1d00da,function(_0x536b54){if(_0x536b54)_0x2c3150(_0x536b54);return _0x1c8e61();});});})[_0x7563('0x3a')](function(){return _0x1d678a['download'](_0x1c1f07,_0xfcaff,function(_0x5c7987){if(_0x5c7987){console['log'](_0x7563('0x137'),_0x5c7987);}else{fs[_0x7563('0x138')](_0x1c1f07);}});});});}else{return _0x1d678a[_0x7563('0x2f')](0xc8);}})[_0x7563('0xc7')](handleError(_0x1d678a,null));}; \ No newline at end of file +var _0xb537=['hasOwnProperty','nolimit','order','sort','select','field','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','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','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','o.fullname','Owner.fullname','Owner.internal','groupBy','ChatInteractionId','all','params','includeAll','options','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','isNull','metadata','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','download','mailTranscript','join','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','CmContact','Messages','%s%d','agentAlias','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','System','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','auth','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','ids','omit','getMessages','pick','include','findAll','rows','includeAgent','alias','addTags','setTags','emit','chatInteractionTags:save','removeTags','unix','tmp','files','attachments','firstName','lastName','direction','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerPort','tail','basename','existsSync','pipe','createWriteStream','renderFile','server','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','merge','body','contact','agent','account','Users','map','fullname','TagIds','split','push','index','ChatInteraction','rawAttributes','type','key','query','keys','filters','attributes','intersection','fields','length','model'];(function(_0x678e88,_0x595a83){var _0x3d35f4=function(_0x18aa59){while(--_0x18aa59){_0x678e88['push'](_0x678e88['shift']());}};_0x3d35f4(++_0x595a83);}(_0xb537,0xdb));var _0x7b53=function(_0x47d5d4,_0x34b2bc){_0x47d5d4=_0x47d5d4-0x0;var _0x2e6dd6=_0xb537[_0x47d5d4];return _0x2e6dd6;};'use strict';var emlformat=require(_0x7b53('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b53('0x1'));var jsonpatch=require(_0x7b53('0x2'));var rp=require(_0x7b53('0x3'));var moment=require('moment');var BPromise=require(_0x7b53('0x4'));var Mustache=require(_0x7b53('0x5'));var util=require(_0x7b53('0x6'));var path=require(_0x7b53('0x7'));var sox=require(_0x7b53('0x8'));var csv=require(_0x7b53('0x9'));var ejs=require(_0x7b53('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b53('0xb'));var squel=require(_0x7b53('0xc'));var crypto=require('crypto');var jsforce=require(_0x7b53('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7b53('0xe'));var Papa=require(_0x7b53('0xf'));var Redis=require(_0x7b53('0x10'));var authService=require(_0x7b53('0x11'));var qs=require(_0x7b53('0x12'));var as=require(_0x7b53('0x13'));var pdf=require(_0x7b53('0x14'));var hardwareService=require(_0x7b53('0x15'));var logger=require(_0x7b53('0x16'))(_0x7b53('0x17'));var utils=require(_0x7b53('0x18'));var config=require(_0x7b53('0x19'));var licenseUtil=require(_0x7b53('0x1a'));var db=require(_0x7b53('0x1b'))['db'];config[_0x7b53('0x1c')]=_[_0x7b53('0x1d')](config[_0x7b53('0x1c')],{'host':_0x7b53('0x1e'),'port':0x18eb});var socket=require(_0x7b53('0x1f'))(new Redis(config[_0x7b53('0x1c')]));require(_0x7b53('0x20'))[_0x7b53('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7b53('0x22')]['http']({'port':0x232b});var client9004=jayson[_0x7b53('0x22')][_0x7b53('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x1af064,_0x4f9988,_0x5daa2a,_0x3ed967){return new BPromise(function(_0x4fb699,_0x266873){var _0x53a28a=_0x3ed967||client;return _0x53a28a[_0x7b53('0x24')](_0x1af064,_0x5daa2a)['then'](function(_0xc82456){logger[_0x7b53('0x25')](_0x7b53('0x26'),_0x4f9988,_0x7b53('0x27'));logger[_0x7b53('0x28')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4f9988,_0x7b53('0x27'),JSON['stringify'](_0xc82456));if(_0xc82456[_0x7b53('0x29')]){if(_0xc82456[_0x7b53('0x29')][_0x7b53('0x2a')]===0x1f4){logger[_0x7b53('0x29')](_0x7b53('0x26'),_0x4f9988,_0xc82456[_0x7b53('0x29')][_0x7b53('0x2b')]);return _0x266873(_0xc82456[_0x7b53('0x29')][_0x7b53('0x2b')]);}logger['error'](_0x7b53('0x26'),_0x4f9988,_0xc82456['error'][_0x7b53('0x2b')]);return _0x4fb699(_0xc82456[_0x7b53('0x29')][_0x7b53('0x2b')]);}else{logger[_0x7b53('0x25')](_0x7b53('0x26'),_0x4f9988,'request\x20sent');_0x4fb699(_0xc82456['result'][_0x7b53('0x2b')]);}})[_0x7b53('0x2c')](function(_0x4d93f9){logger[_0x7b53('0x29')](_0x7b53('0x26'),_0x4f9988,_0x4d93f9);_0x266873(_0x4d93f9);});});}function respondWithStatusCode(_0x5509cc,_0x1cda2b){_0x1cda2b=_0x1cda2b||0xcc;return function(_0x2e2593){if(_0x2e2593){return _0x5509cc[_0x7b53('0x2d')](_0x1cda2b);}return _0x5509cc[_0x7b53('0x2e')](_0x1cda2b)[_0x7b53('0x2f')]();};}function respondWithResult(_0x51f29e,_0x5bc2a3){_0x5bc2a3=_0x5bc2a3||0xc8;return function(_0x207bfe){if(_0x207bfe){return _0x51f29e[_0x7b53('0x2e')](_0x5bc2a3)[_0x7b53('0x30')](_0x207bfe);}};}function respondWithFilteredResult(_0x34cac3,_0x3846fd){return function(_0xfeeffc){if(_0xfeeffc){var _0x5bcedc=typeof _0x3846fd[_0x7b53('0x31')]===_0x7b53('0x32')&&typeof _0x3846fd[_0x7b53('0x33')]===_0x7b53('0x32');var _0x8f7337=_0xfeeffc[_0x7b53('0x34')];var _0x1e2ff0=_0x5bcedc?0x0:_0x3846fd[_0x7b53('0x31')];var _0x3b2375=_0x5bcedc?_0xfeeffc[_0x7b53('0x34')]:_0x3846fd[_0x7b53('0x31')]+_0x3846fd[_0x7b53('0x33')];var _0x4eda26;if(_0x3b2375>=_0x8f7337){_0x3b2375=_0x8f7337;_0x4eda26=0xc8;}else{_0x4eda26=0xce;}_0x34cac3['status'](_0x4eda26);return _0x34cac3[_0x7b53('0x35')](_0x7b53('0x36'),_0x1e2ff0+'-'+_0x3b2375+'/'+_0x8f7337)[_0x7b53('0x30')](_0xfeeffc);}return null;};}function patchUpdates(_0x53d59b){return function(_0x411f5c){try{jsonpatch[_0x7b53('0x37')](_0x411f5c,_0x53d59b,!![]);}catch(_0x598551){return BPromise[_0x7b53('0x38')](_0x598551);}return _0x411f5c[_0x7b53('0x39')]();};}function saveUpdates(_0x2840c3,_0x4460b2){return function(_0x498373){if(_0x498373){return _0x498373[_0x7b53('0x3a')](_0x2840c3)[_0x7b53('0x3b')](function(_0x12b448){return _0x12b448;});}return null;};}function removeEntity(_0x321b2d,_0xdaeb4e){return function(_0x227356){if(_0x227356){return _0x227356[_0x7b53('0x3c')]()['then'](function(){_0x321b2d[_0x7b53('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe71e,_0x56e2c5){return function(_0x4d5ee3){if(!_0x4d5ee3){_0x4fe71e[_0x7b53('0x2d')](0x194);}return _0x4d5ee3;};}function handleError(_0xd0605f,_0x2e7418){_0x2e7418=_0x2e7418||0x1f4;return function(_0x3b0cbb){logger['error'](_0x3b0cbb[_0x7b53('0x3d')]);if(_0x3b0cbb[_0x7b53('0x3e')]){delete _0x3b0cbb[_0x7b53('0x3e')];}_0xd0605f['status'](_0x2e7418)[_0x7b53('0x3f')](_0x3b0cbb);};}function getMustacheRender(_0x4481b2,_0x488ffd){return Mustache['render'](_0x4481b2,_[_0x7b53('0x40')](_0x488ffd[_0x7b53('0x41')],{'contact':_0x488ffd[_0x7b53('0x42')],'message':_0x488ffd[_0x7b53('0x2b')],'agent':_0x488ffd[_0x7b53('0x43')],'interaction':_0x488ffd['interaction'],'account':_0x488ffd[_0x7b53('0x44')]}))||'';}function getInteractionUsers(_0x19fefe,_0xb92a43){return new BPromise(function(_0x68bb86,_0x40c07e){try{if(_0xb92a43[_0x19fefe['id']]){_0x19fefe[_0x7b53('0x45')]=_[_0x7b53('0x46')](_0xb92a43[_0x19fefe['id']],function(_0x3ab6a3){return{'id':_0x3ab6a3['id'],'fullname':_0x3ab6a3[_0x7b53('0x47')]};});}}catch(_0x583b36){_0x40c07e(_0x583b36);}_0x68bb86(_0x19fefe);});}function getInteractionTags(_0x24cb2b,_0x56a17e){return new BPromise(function(_0x3e0374,_0x1c74d5){try{if(_0x24cb2b[_0x7b53('0x48')]){_0x24cb2b['Tags']=[];_0x24cb2b['TagIds'][_0x7b53('0x49')](',')['forEach'](function(_0x22bfb4){_0x24cb2b['Tags'][_0x7b53('0x4a')](_0x56a17e[_0x22bfb4]);});}delete _0x24cb2b[_0x7b53('0x48')];}catch(_0x1b693e){_0x1c74d5(_0x1b693e);}_0x3e0374(_0x24cb2b);});}function updateChatInteraction(_0x1456ed,_0x4dea74,_0x3acf99){return new BPromise(function(_0x49bee5,_0x452836){return getInteractionUsers(_0x1456ed,_0x3acf99)['then'](function(_0x3403dc){return getInteractionTags(_0x3403dc,_0x4dea74);})[_0x7b53('0x3b')](function(_0x57b3d2){_0x49bee5(_0x57b3d2);})[_0x7b53('0x2c')](function(_0x424204){_0x452836(_0x424204);});});}exports[_0x7b53('0x4b')]=function(_0x4f0ba4,_0x3f0cd5){var _0x23aff2={},_0x144d6b={},_0x3ecf4b={'count':0x0,'rows':[]};var _0x39a1ca=_[_0x7b53('0x46')](db[_0x7b53('0x4c')][_0x7b53('0x4d')],function(_0x1f0de6){return{'name':_0x1f0de6['fieldName'],'type':_0x1f0de6[_0x7b53('0x4e')][_0x7b53('0x4f')]};});_0x144d6b['model']=_[_0x7b53('0x46')](_0x39a1ca,'name');_0x144d6b[_0x7b53('0x50')]=_[_0x7b53('0x51')](_0x4f0ba4[_0x7b53('0x50')]);_0x144d6b[_0x7b53('0x52')]=_['intersection'](_0x144d6b['model'],_0x144d6b['query']);_0x23aff2[_0x7b53('0x53')]=_[_0x7b53('0x54')](_0x144d6b['model'],qs['fields'](_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x55')]));_0x23aff2[_0x7b53('0x53')]=_0x23aff2[_0x7b53('0x53')][_0x7b53('0x56')]?_0x23aff2[_0x7b53('0x53')]:_0x144d6b[_0x7b53('0x57')];if(!_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x58')](_0x7b53('0x59'))){_0x23aff2[_0x7b53('0x33')]=qs[_0x7b53('0x33')](_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x33')]);_0x23aff2[_0x7b53('0x31')]=qs[_0x7b53('0x31')](_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x31')]);}_0x23aff2[_0x7b53('0x5a')]=qs[_0x7b53('0x5b')](_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x5b')]);_0x23aff2['where']=qs[_0x7b53('0x52')](_['pick'](_0x4f0ba4[_0x7b53('0x50')],_0x144d6b[_0x7b53('0x52')]),_0x39a1ca);var _0x25c76a=[];var _0x38b916=squel[_0x7b53('0x5c')]()[_0x7b53('0x5d')]('id')[_0x7b53('0x5d')]('name')[_0x7b53('0x5d')]('color')[_0x7b53('0x5e')](_0x7b53('0x5f'));var _0x2ef1b3=squel[_0x7b53('0x5c')]()[_0x7b53('0x5d')]('u.id')['field'](_0x7b53('0x60'))[_0x7b53('0x5d')](_0x7b53('0x61'))[_0x7b53('0x5e')](_0x7b53('0x62'),'ui')['left_join'](_0x7b53('0x63'),'u','u.id\x20=\x20ui.UserId');var _0x945a1d=squel[_0x7b53('0x5c')]()['from']('chat_interactions','i')[_0x7b53('0x64')](_0x7b53('0x65'),'c',_0x7b53('0x66'))['left_join'](_0x7b53('0x63'),'o',_0x7b53('0x67'))[_0x7b53('0x64')](_0x7b53('0x68'),'a',_0x7b53('0x69'))['left_join'](_0x7b53('0x6a'),'me',_0x7b53('0x6b'))[_0x7b53('0x64')]('chat_interaction_has_tags','it',_0x7b53('0x6c'))['left_join']('tools_tags','t',_0x7b53('0x6d'));var _0x813bac=squel[_0x7b53('0x6e')]();var _0x3bc640=[];var _0x470326=squel[_0x7b53('0x6e')]();var _0x4d8d86;if(_0x4f0ba4['query']['search']){_0x4d8d86=as[_0x7b53('0x6f')](_0x4f0ba4[_0x7b53('0x50')]['search']);var _0xb5fbfe=_0x4d8d86[_0x7b53('0x70')];for(var _0xc5517c=0x0;_0xc5517c<_0x4d8d86[_0x7b53('0x71')][_0x7b53('0x56')];_0xc5517c++){var _0x22a53b=_0x4d8d86['conditions'][_0xc5517c];var _0x2ae13e='i';var _0xc7eb34=_[_0x7b53('0x72')](_0x39a1ca,[_0x7b53('0x3e'),_0x22a53b[_0x7b53('0x5d')]]);if(!_0xc7eb34){switch(_0x22a53b['field']){case _0x7b53('0x73'):if(_0x22a53b[_0x7b53('0x74')]==0x1){_0x945a1d[_0x7b53('0x75')]('`'+_0x22a53b[_0x7b53('0x5d')]+'`\x20=\x200');}else{_0x945a1d[_0x7b53('0x75')]('`'+_0x22a53b[_0x7b53('0x5d')]+_0x7b53('0x76'));}break;case _0x7b53('0x77'):if(_0x22a53b[_0x7b53('0x78')]===_0x7b53('0x79')){if(_0x22a53b[_0x7b53('0x74')]['split']('\x20')[_0x7b53('0x56')]>0x1){_0x813bac[_0xb5fbfe](_0x7b53('0x7a'),qs[_0x7b53('0x7b')](_0x22a53b[_0x7b53('0x74')]),null);}else{var _0x1a34e0='%'+_0x22a53b['value']+'%';_0x813bac[_0xb5fbfe](_0x7b53('0x7c'),_0x1a34e0,_0x1a34e0,_0x1a34e0);}}else{_0xc7eb34=_[_0x7b53('0x72')](_0x39a1ca,['name',_0x7b53('0x7d')]);_0x22a53b[_0x7b53('0x5d')]='ContactId';_0xd3087e=as['buildExpression'](_0x2ae13e,_0xc7eb34[_0x7b53('0x4e')],_0x22a53b);_0x813bac[_0xb5fbfe](_0xd3087e[_0x7b53('0x7e')],_0xd3087e[_0x7b53('0x74')][_0x7b53('0x7f')],_0xd3087e['value'][_0x7b53('0x2f')]);}break;case _0x7b53('0x80'):var _0x1ac6c6=_0x22a53b['value'][_0x7b53('0x49')](',')[_0x7b53('0x46')](function(_0x433081){return Number(_0x433081);});_0x1ac6c6[_0x7b53('0x81')](function(_0x3111f0){_0x470326['or'](_0x7b53('0x82'),'%,'+_0x3111f0+',%');});_0x3bc640=_[_0x7b53('0x83')](_0x3bc640,_0x1ac6c6);break;case _0x7b53('0x84'):if(_0x22a53b[_0x7b53('0x78')]===_0x7b53('0x79')){_0x813bac[_0xb5fbfe](_0x7b53('0x85'),'%'+_0x22a53b['value']+'%',null);}else{_0xc7eb34=_['find'](_0x39a1ca,['name','UserId']);_0x22a53b['field']=_0x7b53('0x86');_0xd3087e=as['buildExpression'](_0x2ae13e,_0xc7eb34[_0x7b53('0x4e')],_0x22a53b);_0x813bac[_0xb5fbfe](_0xd3087e['text'],_0xd3087e['value'][_0x7b53('0x7f')],_0xd3087e['value']['end']);}break;case _0x7b53('0x41'):_0xd3087e=as['buildExpression']('me',null,_0x22a53b);_0x813bac[_0xb5fbfe](_0xd3087e[_0x7b53('0x7e')],_0xd3087e[_0x7b53('0x74')][_0x7b53('0x7f')],_0xd3087e['value']['end']);break;}}else{var _0xd3087e=as[_0x7b53('0x87')](_0x2ae13e,_0xc7eb34['type'],_0x22a53b);_0x813bac[_0xb5fbfe](_0xd3087e[_0x7b53('0x7e')],_0xd3087e[_0x7b53('0x74')][_0x7b53('0x7f')],_0xd3087e[_0x7b53('0x74')]['end']);}}}else{var _0x4773e8=_(_0x4f0ba4[_0x7b53('0x50')])[_0x7b53('0x51')]()[_0x7b53('0x46')](function(_0xea8848){return _[_0x7b53('0x88')](_0x39a1ca,['name',_0xea8848])?_0xea8848:undefined;})[_0x7b53('0x89')]()[_0x7b53('0x74')]();if(!_['isEmpty'](_0x4773e8)){_0x4773e8[_0x7b53('0x81')](function(_0x17a1ca){if(_0x17a1ca===_0x7b53('0x8a')){_0x945a1d['where'](_0x7b53('0x8b'),[][_0x7b53('0x8c')](_0x4f0ba4[_0x7b53('0x50')][_0x17a1ca]));}else if(_0x17a1ca===_0x7b53('0x8d')){var _0x7cc2f=JSON[_0x7b53('0x8e')](_0x4f0ba4['query'][_0x17a1ca])[_0x7b53('0x8f')];var _0x54b43c=JSON[_0x7b53('0x8e')](_0x4f0ba4[_0x7b53('0x50')][_0x17a1ca])['$lte'];_0x945a1d[_0x7b53('0x90')](_0x7b53('0x91'),_0x7cc2f,_0x54b43c);}else{if(_0x4f0ba4[_0x7b53('0x50')][_0x17a1ca]===_0x7b53('0x92')){_0x945a1d[_0x7b53('0x90')]('i.'+_0x17a1ca+_0x7b53('0x93'));}else{_0x945a1d[_0x7b53('0x90')]('i.'+_0x17a1ca+_0x7b53('0x94'),_0x4f0ba4[_0x7b53('0x50')][_0x17a1ca]);}}});}if(_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x95')]){if(_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x95')]==0x1){_0x945a1d[_0x7b53('0x75')]('`unreadMessages`\x20=\x200');}else{_0x945a1d['having'](_0x7b53('0x96'));}}if(_0x4f0ba4[_0x7b53('0x50')]['tag']){_0x3bc640=_[_0x7b53('0x97')](_0x4f0ba4['query'][_0x7b53('0x98')])?_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x98')]:new Array(_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x98')]);_0x3bc640[_0x7b53('0x81')](function(_0x5cc8ef){_0x470326['or'](_0x7b53('0x82'),'%,'+_0x5cc8ef+',%');});}if(_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x99')]){var _0x28c5b9=_0x4f0ba4[_0x7b53('0x50')][_0x7b53('0x99')][_0x7b53('0x9a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x7b53('0x9b')](_0x28c5b9)){_0x813bac['or']('i.id\x20LIKE\x20?',_0x28c5b9+'%');}else{_0x813bac['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x28c5b9))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x28c5b9+'%');}}}_0x945a1d[_0x7b53('0x90')](_0x813bac);_0x945a1d['group'](_0x7b53('0x9c'));var _0x2186b7={'type':db[_0x7b53('0x9d')]['QueryTypes'][_0x7b53('0x9e')],'raw':!![]};var _0x1706a6=_0x945a1d['clone']();_0x1706a6[_0x7b53('0x5d')](_0x7b53('0x9c'));_0x1706a6[_0x7b53('0x5d')](_0x7b53('0x9f'),_0x7b53('0x73'));if(_0x23aff2[_0x7b53('0x5a')]){_0x23aff2[_0x7b53('0x5a')][_0x7b53('0x81')](function(_0x3ba64f){var _0x1de2d8=_0x3ba64f[0x0]===_0x7b53('0xa0')?_0x3ba64f[0x0]:'i.'+_0x3ba64f[0x0];_0x945a1d[_0x7b53('0x5a')](_0x1de2d8,_0x3ba64f[0x1]===_0x7b53('0xa1')?![]:!![]);});}if(!_['isEmpty'](_0x3bc640)){_0x945a1d['having'](_0x470326);_0x1706a6[_0x7b53('0x90')](_0x7b53('0xa2'),_0x3bc640);}BPromise[_0x7b53('0xa3')]()[_0x7b53('0x3b')](function(){if(!_0x4d8d86){if(_0x4f0ba4['query'][_0x7b53('0x8a')])return;_0x1706a6['where'](_0x7b53('0xa4'));_0x945a1d[_0x7b53('0x90')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x4f0ba4[_0x7b53('0xa5')]['role']!=='agent')return;return _0x4f0ba4['user'][_0x7b53('0xa6')]({'attributes':['id'],'raw':!![]})[_0x7b53('0x3b')](function(_0x531119){if(_['isEmpty'](_0x531119)){_0x1706a6[_0x7b53('0x90')](_0x7b53('0xa7'));_0x945a1d[_0x7b53('0x90')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1706a6[_0x7b53('0x90')](_0x7b53('0x8b'),_[_0x7b53('0x46')](_0x531119,'id'));_0x945a1d[_0x7b53('0x90')](_0x7b53('0x8b'),_[_0x7b53('0x46')](_0x531119,'id'));}});})[_0x7b53('0x3b')](function(){if(_0x4f0ba4['user'][_0x7b53('0xa8')]===_0x7b53('0x43')&&!_0x4d8d86&&!_0x4f0ba4[_0x7b53('0x50')]['ChatWebsiteId'])return[];return db[_0x7b53('0xa9')]['query'](_0x1706a6[_0x7b53('0xaa')](),_0x2186b7);})[_0x7b53('0x3b')](function(_0x4c6347){_0x3ecf4b[_0x7b53('0x34')]=_0x4c6347[_0x7b53('0x56')];if(_0x3ecf4b[_0x7b53('0x34')]===0x0)return[];return db['sequelize'][_0x7b53('0x50')](_0x38b916['toString'](),_0x2186b7)[_0x7b53('0x3b')](function(_0x31266e){_0x25c76a=_['keyBy'](_0x31266e,'id');_0x2186b7=_['merge'](_0x2186b7,{'model':db[_0x7b53('0x4c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4f0ba4[_0x7b53('0x50')]['fields']){_0x23aff2[_0x7b53('0x53')][_0x7b53('0x81')](function(_0x345a3c){_0x945a1d[_0x7b53('0x5d')]('i.'+_0x345a3c);});}else{_0x945a1d['field'](_0x7b53('0x9f'),_0x7b53('0x73'));_0x945a1d[_0x7b53('0x5d')]('a.key',_0x7b53('0xab'));_0x945a1d[_0x7b53('0x5d')](_0x7b53('0xac'),_0x7b53('0xad'));_0x945a1d[_0x7b53('0x5d')](_0x7b53('0xae'),'contactName');_0x945a1d[_0x7b53('0x5d')](_0x7b53('0xaf'));_0x945a1d[_0x7b53('0x5d')]('c.firstName',_0x7b53('0xb0'));_0x945a1d[_0x7b53('0x5d')](_0x7b53('0xb1'),_0x7b53('0xb2'));_0x945a1d[_0x7b53('0x5d')](_0x7b53('0xb3'),_0x7b53('0xb4'));_0x945a1d[_0x7b53('0x5d')](_0x7b53('0xb5'),_0x7b53('0xb6'));_0x945a1d[_0x7b53('0x5d')]('c.mobile','Contact.mobile');_0x945a1d['field']('c.fax','Contact.fax');_0x945a1d[_0x7b53('0x5d')](_0x7b53('0xb7'),_0x7b53('0xb8'));_0x945a1d['field']('o.internal',_0x7b53('0xb9'));_0x945a1d[_0x7b53('0x5d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7b53('0x48'));}if(_0x23aff2[_0x7b53('0x33')])_0x945a1d['limit'](_0x23aff2[_0x7b53('0x33')]);if(_0x23aff2[_0x7b53('0x31')])_0x945a1d[_0x7b53('0x31')](_0x23aff2[_0x7b53('0x31')]);return db['sequelize']['query'](_0x945a1d[_0x7b53('0xaa')](),_0x2186b7);})['then'](function(_0xfc443b){if(_0xfc443b['length']>0x0)_0x2ef1b3[_0x7b53('0x90')]('ui.ChatInteractionId\x20IN\x20?',_[_0x7b53('0x46')](_0xfc443b,'id'));return db[_0x7b53('0xa9')]['query'](_0x2ef1b3[_0x7b53('0xaa')](),_0x2186b7)[_0x7b53('0x3b')](function(_0x5109e9){var _0x42dd03=_[_0x7b53('0xba')](_0x5109e9,_0x7b53('0xbb'));var _0x5ab300=[];_0xfc443b[_0x7b53('0x81')](function(_0x3444a2){_0x5ab300[_0x7b53('0x4a')](updateChatInteraction(_0x3444a2,_0x25c76a,_0x42dd03));});return BPromise[_0x7b53('0xbc')](_0x5ab300);});});})[_0x7b53('0x3b')](function(_0x40dc20){_0x3ecf4b['rows']=_0x40dc20;return _0x3ecf4b;})[_0x7b53('0x3b')](respondWithFilteredResult(_0x3f0cd5,_0x23aff2))['catch'](handleError(_0x3f0cd5,null));};exports['show']=function(_0x3fa2bb,_0x466d42){var _0x511a68={'raw':![],'where':{'id':_0x3fa2bb[_0x7b53('0xbd')]['id']}},_0x176dea={};_0x176dea[_0x7b53('0x57')]=_[_0x7b53('0x51')](db['ChatInteraction'][_0x7b53('0x4d')]);_0x176dea[_0x7b53('0x50')]=_[_0x7b53('0x51')](_0x3fa2bb[_0x7b53('0x50')]);_0x176dea[_0x7b53('0x52')]=_[_0x7b53('0x54')](_0x176dea[_0x7b53('0x57')],_0x176dea[_0x7b53('0x50')]);_0x511a68[_0x7b53('0x53')]=_['intersection'](_0x176dea['model'],qs[_0x7b53('0x55')](_0x3fa2bb[_0x7b53('0x50')]['fields']));_0x511a68[_0x7b53('0x53')]=_0x511a68[_0x7b53('0x53')][_0x7b53('0x56')]?_0x511a68[_0x7b53('0x53')]:_0x176dea[_0x7b53('0x57')];if(_0x3fa2bb[_0x7b53('0x50')][_0x7b53('0xbe')]){_0x511a68['include']=[{'all':!![]}];}_0x511a68=_[_0x7b53('0x40')]({},_0x511a68,_0x3fa2bb[_0x7b53('0xbf')]);return db[_0x7b53('0x4c')][_0x7b53('0x72')](_0x511a68)[_0x7b53('0x3b')](handleEntityNotFound(_0x466d42,null))['then'](respondWithResult(_0x466d42,null))[_0x7b53('0x2c')](handleError(_0x466d42,null));};exports[_0x7b53('0xc0')]=function(_0x49e077,_0x911c9d){return db['ChatInteraction'][_0x7b53('0xc0')](_0x49e077['body'],{})['then'](respondWithResult(_0x911c9d,0xc9))['catch'](handleError(_0x911c9d,null));};exports['update']=function(_0x1b2927,_0x49e774){if(_0x1b2927[_0x7b53('0x41')]['id']){delete _0x1b2927[_0x7b53('0x41')]['id'];}return db[_0x7b53('0x4c')][_0x7b53('0x72')]({'where':{'id':_0x1b2927[_0x7b53('0xbd')]['id']}})[_0x7b53('0x3b')](handleEntityNotFound(_0x49e774,null))[_0x7b53('0x3b')](saveUpdates(_0x1b2927['body'],null))[_0x7b53('0x3b')](respondWithResult(_0x49e774,null))['catch'](handleError(_0x49e774,null));};exports[_0x7b53('0x3c')]=function(_0x2982a0,_0x53f873){return db[_0x7b53('0x4c')][_0x7b53('0x72')]({'where':{'id':_0x2982a0[_0x7b53('0xbd')]['id']}})[_0x7b53('0x3b')](handleEntityNotFound(_0x53f873,null))[_0x7b53('0x3b')](removeEntity(_0x53f873,null))[_0x7b53('0x2c')](handleError(_0x53f873,null));};exports[_0x7b53('0xc1')]=function(_0x1400eb,_0x2f4df6){return db[_0x7b53('0x4c')][_0x7b53('0xc1')]()[_0x7b53('0x3b')](respondWithResult(_0x2f4df6,null))[_0x7b53('0x2c')](handleError(_0x2f4df6,null));};exports['createVidaooSession']=function(_0x1f50b5,_0x4feed0){var _0x112c17=_0x1f50b5[_0x7b53('0xbd')]['id'];var _0x497ac8;var _0x41ffb4;var _0x489952;return db[_0x7b53('0x4c')][_0x7b53('0xc2')]({'where':{'id':_0x112c17}})[_0x7b53('0x3b')](function(_0x4ef331){_0x497ac8=_0x4ef331;return db[_0x7b53('0xc3')][_0x7b53('0xc2')]({'where':{'id':_0x4ef331[_0x7b53('0x8a')]},'attributes':['id',_0x7b53('0xc4'),_0x7b53('0xc5'),_0x7b53('0xc6'),_0x7b53('0xc7'),_0x7b53('0xc8')],'raw':!![]});})['then'](function(_0x889cd5){if(_0x889cd5&&_0x889cd5[_0x7b53('0xc4')]&&_0x889cd5['vidaooEscalation']){_0x41ffb4=_0x889cd5;var _0xfbac3b={'interaction':{'id':_0x112c17},'agent':{'id':_0x1f50b5['user']['id'],'name':_0x1f50b5['user']['name'],'fullname':_0x1f50b5['user'][_0x7b53('0x47')],'email':_0x1f50b5[_0x7b53('0xa5')][_0x7b53('0xc9')]},'contact':_0x1f50b5[_0x7b53('0x41')][_0x7b53('0x42')],'account':_0x1f50b5[_0x7b53('0x41')][_0x7b53('0x44')]};var _0x14b636={'rejectUnauthorized':![],'method':_0x7b53('0xca'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x889cd5['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1f50b5[_0x7b53('0xa5')][_0x7b53('0xc9')]],'buttons':null,'topic':_0x41ffb4[_0x7b53('0xc6')],'note':_['isNull'](_0x41ffb4['vidaooNote'])?null:getMustacheRender(_0x41ffb4[_0x7b53('0xc7')],_0xfbac3b),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x7b53('0xcb')](_0x41ffb4[_0x7b53('0xc8')])){var _0x59047f=getMustacheRender(_0x41ffb4[_0x7b53('0xc8')],_0xfbac3b);var _0x5656d5=JSON[_0x7b53('0x8e')](_0x59047f);_0x14b636['body'][_0x7b53('0xcc')]=_0x5656d5;}}catch(_0x556035){throw new db[(_0x7b53('0x9d'))][(_0x7b53('0xcd'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x14b636);}else{throw new db[(_0x7b53('0x9d'))][(_0x7b53('0xcd'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x7b53('0x3b')](function(_0x1e993c){_0x489952=_0x1e993c;if(_0x489952['id']){var _0x11bfea={'body':_0x489952[_0x7b53('0xce')],'ChatWebsiteId':_0x41ffb4['id'],'ChatInteractionId':_0x497ac8['id'],'direction':_0x7b53('0xcf'),'UserId':_0x1f50b5['user']['id']};return db[_0x7b53('0xd0')][_0x7b53('0xc0')](_0x11bfea,{});}else{throw new db[(_0x7b53('0x9d'))][(_0x7b53('0xcd'))](_0x7b53('0xd1'));}})[_0x7b53('0x3b')](function(){return _0x497ac8[_0x7b53('0xd2')]({'vidaooSessionId':_0x489952['id']});})[_0x7b53('0x3b')](respondWithResult(_0x4feed0,null))[_0x7b53('0x2c')](handleError(_0x4feed0,null));};exports[_0x7b53('0xd3')]=function(_0x51e8fd,_0x35047f){if(_0x51e8fd['body']['id']){delete _0x51e8fd[_0x7b53('0x41')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x51e8fd[_0x7b53('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0x35047f,null))[_0x7b53('0x3b')](saveUpdates(_0x51e8fd[_0x7b53('0x41')],null))['then'](respondWithResult(_0x35047f,null))[_0x7b53('0x2c')](handleError(_0x35047f,null));};exports['abandon']=function(_0x57e268,_0x458a4f,_0x4b8dca){if(_0x57e268['body']['id']){delete _0x57e268[_0x7b53('0x41')]['id'];}return db[_0x7b53('0x4c')]['find']({'where':{'id':_0x57e268[_0x7b53('0xbd')]['id']}})[_0x7b53('0x3b')](function(_0x2f98d){if(!_0x2f98d){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x7b53('0xd4'),0x194,'entity\x20not\x20found');_0x458a4f['sendStatus'](0x194);}else{if(_0x2f98d[_0x7b53('0x86')]){throw new db['Sequelize'][(_0x7b53('0xcd'))](_0x7b53('0xd5'));}}return _0x2f98d;})['then'](function(_0x2e03ae){if(_0x2e03ae){return _0x2e03ae[_0x7b53('0x3a')]({'closed':_0x57e268[_0x7b53('0x41')][_0x7b53('0xd6')],'disposition':_0x57e268[_0x7b53('0x41')][_0x7b53('0xd7')]})[_0x7b53('0x3b')](function(_0x656f30){return _0x656f30;});}})[_0x7b53('0x3b')](function(_0xe60737){return respondWithRpcPromise(_0x7b53('0xd8'),'abandon',_0x57e268[_0x7b53('0x41')],client9004);})[_0x7b53('0x3b')](respondWithResult(_0x458a4f,null))[_0x7b53('0x2c')](handleError(_0x458a4f,null));};exports[_0x7b53('0xd9')]=function(_0x2b2a82,_0x4661b5,_0x31ccd3){_0x2b2a82['body'][_0x7b53('0x3e')]=_0x2b2a82[_0x7b53('0xda')][_0x7b53('0xdb')];_0x2b2a82['body']['basename']=_0x2b2a82[_0x7b53('0xda')][_0x7b53('0xdc')];_0x2b2a82['body'][_0x7b53('0x4e')]=_0x2b2a82[_0x7b53('0xda')][_0x7b53('0xdd')];return db[_0x7b53('0xde')][_0x7b53('0xc0')](_0x2b2a82['body'])[_0x7b53('0x3b')](respondWithResult(_0x4661b5,0xc9))[_0x7b53('0x2c')](handleError(_0x4661b5,null));};exports['attachmentDownload']=function(_0x4aecc8,_0x584ab6,_0x22724a){return db[_0x7b53('0x4c')]['findOne']({'where':{'id':_0x4aecc8[_0x7b53('0xbd')]['id']},'raw':!![]})[_0x7b53('0x3b')](handleEntityNotFound(_0x584ab6,null))[_0x7b53('0x3b')](function(_0x9e85a8){if(_0x9e85a8){if(_0x9e85a8[_0x7b53('0xd6')]){return _0x584ab6['status'](0x193)[_0x7b53('0x30')]({'status':0x193,'message':_0x7b53('0xdf')});}return db[_0x7b53('0xde')]['findOne']({'where':{'id':_0x4aecc8[_0x7b53('0x50')][_0x7b53('0xe0')]},'raw':!![]})[_0x7b53('0x3b')](handleEntityNotFound(_0x584ab6,null));}})['then'](function(_0xd04f1c){if(_0xd04f1c){var _0x5be993=_0xd04f1c[_0x7b53('0xe1')]!==null;var _0x5a0dfd=path['join'](config[_0x7b53('0xe2')],_0x7b53('0xe3'));if(_0x5be993){_0x5a0dfd=path['join'](_0x5a0dfd,_0x7b53('0xe4'));}var _0x16ff99=path['join'](_0x5a0dfd,_0xd04f1c['basename']);return _0x584ab6[_0x7b53('0xe5')](_0x16ff99);}})['catch'](handleError(_0x584ab6,null));};exports['close']=function(_0x6b6d38,_0x5c19c7){var _0x519546=null;var _0x2b5368=null;var _0x1d85d3=null;var _0x5e5daa=null;if(_0x6b6d38[_0x7b53('0x41')]['id']){delete _0x6b6d38[_0x7b53('0x41')]['id'];}if(_0x6b6d38[_0x7b53('0x41')][_0x7b53('0xe6')]){_0x5e5daa=path[_0x7b53('0xe7')](config['root'],_0x7b53('0xe8'),util[_0x7b53('0xe9')](_0x7b53('0xea'),Date[_0x7b53('0xeb')]()));_0x6b6d38[_0x7b53('0x41')][_0x7b53('0xec')]=_0x5e5daa;}return db[_0x7b53('0x4c')]['find']({'where':{'id':_0x6b6d38[_0x7b53('0xbd')]['id']},'include':[{'model':db[_0x7b53('0xd0')],'as':'Messages','include':[{'model':db[_0x7b53('0x84')],'as':_0x7b53('0x84')}]}]})[_0x7b53('0x3b')](handleEntityNotFound(_0x5c19c7,null))['then'](saveUpdates(_0x6b6d38[_0x7b53('0x41')],null))['then'](function(_0xca0681){if(_0xca0681){_0x519546=_0xca0681;return db[_0x7b53('0xc3')][_0x7b53('0x72')]({'where':{'id':_0x519546[_0x7b53('0x8a')]}});}})[_0x7b53('0x3b')](function(_0xf4c013){if(_0xf4c013){_0x1d85d3=_0xf4c013;return db[_0x7b53('0xed')][_0x7b53('0x72')]({'where':{'id':_0x519546[_0x7b53('0x7d')]}});}})[_0x7b53('0x3b')](function(_0x5b748a){if(_0x5b748a){_0x2b5368=_0x5b748a;if(_0x5e5daa){var _0x11ce0e=null;for(var _0x140972=0x1;_0x140972<_0x519546['Messages'][_0x7b53('0x56')];++_0x140972){_0x11ce0e=_0x519546[_0x7b53('0xee')][_0x140972];var _0x405224=_0x11ce0e['UserId']?util['format'](_0x7b53('0xef'),_0x1d85d3[_0x7b53('0xf0')],_0x11ce0e[_0x7b53('0x86')]):'System';var _0xc1046d=_0x6b6d38['body']['customer']||util[_0x7b53('0xe9')](_0x7b53('0xef'),_0x7b53('0xf1'),_0x11ce0e[_0x7b53('0x7d')]);switch(_0x1d85d3[_0x7b53('0xf2')]){case _0x7b53('0xf3'):_0x405224=_0x11ce0e[_0x7b53('0x86')]?util[_0x7b53('0xe9')](_0x7b53('0xef'),_0x1d85d3[_0x7b53('0xf0')],_0x11ce0e['UserId']):'System';break;case _0x7b53('0xf4'):_0x405224=_0x11ce0e[_0x7b53('0x86')]?_0x11ce0e[_0x7b53('0x84')]['alias']||_0x11ce0e[_0x7b53('0x84')]['fullname']:'System';break;case _0x7b53('0xf5'):_0x405224=_0x11ce0e[_0x7b53('0x86')]?_0x11ce0e[_0x7b53('0x84')]['fullname']:'System';break;default:_0x405224=_0x11ce0e[_0x7b53('0x86')]?util['format'](_0x7b53('0xef'),_0x1d85d3[_0x7b53('0xf0')],_0x11ce0e[_0x7b53('0x86')]):_0x7b53('0xf6');}var _0x57dcab=util[_0x7b53('0xe9')](_0x7b53('0xf7'),moment(_0x11ce0e['createdAt'])[_0x7b53('0xe9')](_0x7b53('0xf8')),_0x11ce0e['direction']==='in'?_0xc1046d:_0x405224,_0x11ce0e[_0x7b53('0x41')]);if(!_0x11ce0e[_0x7b53('0xf9')]){fs[_0x7b53('0xfa')](_0x5e5daa,_0x57dcab);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x7b53('0xfb')],'as':'Smtp','raw':!![]}]});}}})['then'](function(_0x293b09){if(_0x293b09&&_0x293b09[_0x7b53('0xfc')]&&_0x6b6d38[_0x7b53('0x41')]){var _0x200ebd={'tls':{'rejectUnauthorized':![]}};if(_0x293b09[_0x7b53('0xfc')][_0x7b53('0xfd')]){_0x200ebd[_0x7b53('0xfd')]=_0x293b09[_0x7b53('0xfc')]['service'];}else{_0x200ebd[_0x7b53('0xfe')]=_0x293b09[_0x7b53('0xfc')][_0x7b53('0xfe')];_0x200ebd[_0x7b53('0xff')]=_0x293b09[_0x7b53('0xfc')]['port'];_0x200ebd['secure']=_0x293b09[_0x7b53('0xfc')][_0x7b53('0x100')];}if(_0x293b09['Smtp']['authentication']){_0x200ebd[_0x7b53('0x101')]={'user':_0x293b09['Smtp'][_0x7b53('0xa5')],'pass':_0x293b09['Smtp']['pass']};}return respondWithRpcPromise(_0x7b53('0x102'),_0x7b53('0x103'),{'account':_0x200ebd,'message':{'from':util[_0x7b53('0xe9')](_0x7b53('0x104'),_0x293b09[_0x7b53('0x3e')],_0x293b09[_0x7b53('0xc9')]||_0x293b09[_0x7b53('0xfc')][_0x7b53('0xa5')]),'to':_0x6b6d38['body'][_0x7b53('0xe6')],'subject':_0x7b53('0x105'),'text':util[_0x7b53('0xe9')](_0x7b53('0x106'),_0x6b6d38[_0x7b53('0x41')][_0x7b53('0xe6')]),'attachments':[{'path':_0x5e5daa}]}})[_0x7b53('0x3b')](function(){return _0x519546;})['catch'](function(_0x5ea5ee){console[_0x7b53('0x29')](_0x5ea5ee);});}else{return _0x519546;}})[_0x7b53('0x3b')](respondWithStatusCode(_0x5c19c7,0xc8))[_0x7b53('0x2c')](handleError(_0x5c19c7,null));};exports['addMessage']=function(_0x5c231a,_0x7bcd96,_0x462e42){return db[_0x7b53('0xd0')][_0x7b53('0x72')]({'where':{'id':_0x5c231a['params']['id']}})['then'](handleEntityNotFound(_0x7bcd96,null))[_0x7b53('0x3b')](function(_0x414066){if(_0x414066){return _0x414066['addMessage'](_0x5c231a['body'][_0x7b53('0x107')],_[_0x7b53('0x108')](_0x5c231a[_0x7b53('0x41')],[_0x7b53('0x107'),'id'])||{});}})['then'](respondWithResult(_0x7bcd96,null))['catch'](handleError(_0x7bcd96,null));};exports[_0x7b53('0x109')]=function(_0x1915d4,_0x50fdd2,_0x5d138e){var _0x1943e5={'raw':![],'where':{}};var _0x5d3382={};var _0x51cba6={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x1915d4['params']['id']}})['then'](handleEntityNotFound(_0x50fdd2,null))[_0x7b53('0x3b')](function(_0x3e4815){if(_0x3e4815){_0x5d3382['model']=_['keys'](db[_0x7b53('0xd0')][_0x7b53('0x4d')]);_0x5d3382[_0x7b53('0x50')]=_[_0x7b53('0x51')](_0x1915d4[_0x7b53('0x50')]);_0x5d3382[_0x7b53('0x52')]=_[_0x7b53('0x54')](_0x5d3382[_0x7b53('0x57')],_0x5d3382[_0x7b53('0x50')]);_0x1943e5[_0x7b53('0x53')]=_[_0x7b53('0x54')](_0x5d3382[_0x7b53('0x57')],qs[_0x7b53('0x55')](_0x1915d4[_0x7b53('0x50')][_0x7b53('0x55')]));_0x1943e5[_0x7b53('0x53')]=_0x1943e5['attributes'][_0x7b53('0x56')]?_0x1943e5[_0x7b53('0x53')]:_0x5d3382[_0x7b53('0x57')];if(!_0x1915d4[_0x7b53('0x50')]['hasOwnProperty'](_0x7b53('0x59'))){_0x1943e5[_0x7b53('0x33')]=qs['limit'](_0x1915d4['query'][_0x7b53('0x33')]);_0x1943e5['offset']=qs[_0x7b53('0x31')](_0x1915d4['query']['offset']);}_0x1943e5['order']=qs[_0x7b53('0x5b')](_0x1915d4['query'][_0x7b53('0x5b')]);_0x1943e5['where']=qs['filters'](_[_0x7b53('0x10a')](_0x1915d4['query'],_0x5d3382['filters']));_0x1943e5['where'][_0x7b53('0xbb')]=_0x3e4815['id'];if(_0x1915d4[_0x7b53('0x50')][_0x7b53('0x99')]){_0x1943e5[_0x7b53('0x90')]=_[_0x7b53('0x40')](_0x1943e5['where'],{'$or':_['map'](_0x1943e5[_0x7b53('0x53')],function(_0x1f8221){var _0x20838e={};_0x20838e[_0x1f8221]={'$like':'%'+_0x1915d4[_0x7b53('0x50')][_0x7b53('0x99')]+'%'};return _0x20838e;})});}if(_0x1915d4[_0x7b53('0x50')][_0x7b53('0x8f')]){var _0x243e12=_0x1915d4['query']['$gte'][_0x7b53('0x49')](',');var _0x559ea2={};_0x559ea2[_0x243e12[0x0]]={'$gte':moment(_0x243e12[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1943e5[_0x7b53('0x90')]=_[_0x7b53('0x40')](_0x1943e5[_0x7b53('0x90')],_0x559ea2);}_0x1943e5=_['merge']({},_0x1943e5,_0x1915d4['options']);return db[_0x7b53('0xd0')][_0x7b53('0x34')]({'where':_0x1943e5['where']})[_0x7b53('0x3b')](function(_0x4b0765){_0x51cba6[_0x7b53('0x34')]=_0x4b0765;if(_0x1915d4[_0x7b53('0x50')]['includeAll']){_0x1943e5[_0x7b53('0x10b')]=[{'all':!![]}];}return db[_0x7b53('0xd0')][_0x7b53('0x10c')](_0x1943e5);})[_0x7b53('0x3b')](function(_0xc55c0c){_0x51cba6[_0x7b53('0x10d')]=_0xc55c0c;return _0x51cba6;});}})['then'](respondWithFilteredResult(_0x50fdd2,_0x1943e5))[_0x7b53('0x2c')](handleError(_0x50fdd2,null));};exports['getMyMessages']=function(_0x1a7587,_0x3a957b,_0x50d73a){var _0x96e66a={'where':{}},_0xd8e214={},_0x562234={'count':0x0,'rows':[]};return db[_0x7b53('0x4c')]['findOne']({'where':{'id':_0x1a7587[_0x7b53('0xbd')]['id']}})[_0x7b53('0x3b')](handleEntityNotFound(_0x3a957b,null))['then'](function(_0x29c98a){if(_0x29c98a){_0xd8e214[_0x7b53('0x57')]=_[_0x7b53('0x51')](db[_0x7b53('0xd0')][_0x7b53('0x4d')]);_0xd8e214['query']=_[_0x7b53('0x51')](_0x1a7587[_0x7b53('0x50')]);_0xd8e214[_0x7b53('0x52')]=_['intersection'](_0xd8e214['model'],_0xd8e214[_0x7b53('0x50')]);_0x96e66a[_0x7b53('0x53')]=_[_0x7b53('0x54')](_0xd8e214['model'],qs[_0x7b53('0x55')](_0x1a7587[_0x7b53('0x50')][_0x7b53('0x55')]));_0x96e66a[_0x7b53('0x53')]=_0x96e66a[_0x7b53('0x53')][_0x7b53('0x56')]?_0x96e66a['attributes']:_0xd8e214[_0x7b53('0x57')];if(!_0x1a7587[_0x7b53('0x50')][_0x7b53('0x58')](_0x7b53('0x59'))){_0x96e66a[_0x7b53('0x33')]=qs[_0x7b53('0x33')](_0x1a7587[_0x7b53('0x50')][_0x7b53('0x33')]);_0x96e66a['offset']=qs['offset'](_0x1a7587[_0x7b53('0x50')][_0x7b53('0x31')]);}_0x96e66a[_0x7b53('0x5a')]=qs[_0x7b53('0x5b')](_0x1a7587[_0x7b53('0x50')][_0x7b53('0x5b')]);_0x96e66a[_0x7b53('0x90')]=qs[_0x7b53('0x52')](_[_0x7b53('0x10a')](_0x1a7587[_0x7b53('0x50')],_0xd8e214[_0x7b53('0x52')]));_0x96e66a['where'][_0x7b53('0xbb')]=_0x29c98a['id'];if(_0x1a7587['query']['filter']){_0x96e66a[_0x7b53('0x90')]=_[_0x7b53('0x40')](_0x96e66a[_0x7b53('0x90')],{'$or':_[_0x7b53('0x46')](_0x96e66a[_0x7b53('0x53')],function(_0x1e151c){var _0x522641={};_0x522641[_0x1e151c]={'$like':'%'+_0x1a7587[_0x7b53('0x50')][_0x7b53('0x99')]+'%'};return _0x522641;})});}_0x96e66a[_0x7b53('0x90')][_0x7b53('0xf9')]=![];if(_0x1a7587[_0x7b53('0x50')]['id']){_0x96e66a['where']['id']={'$gt':_0x1a7587[_0x7b53('0x50')]['id']};}_0x96e66a=_['merge']({},_0x96e66a,_0x1a7587['options']);return db[_0x7b53('0xd0')]['count']({'where':_0x96e66a['where']})[_0x7b53('0x3b')](function(_0xf2f830){_0x562234[_0x7b53('0x34')]=_0xf2f830;_0x96e66a[_0x7b53('0x10b')]=[];if(_0x1a7587[_0x7b53('0x50')][_0x7b53('0x10e')]){_0x96e66a[_0x7b53('0x10b')][_0x7b53('0x4a')]({'model':db[_0x7b53('0x84')],'as':_0x7b53('0x84'),'attributes':['id',_0x7b53('0x47'),_0x7b53('0x10f')]});}if(_0x1a7587[_0x7b53('0x50')][_0x7b53('0xbe')]){_0x96e66a[_0x7b53('0x10b')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x96e66a);})[_0x7b53('0x3b')](function(_0x3cceec){_0x562234[_0x7b53('0x10d')]=_0x3cceec;return _0x562234;});}})['then'](respondWithFilteredResult(_0x3a957b,_0x96e66a))[_0x7b53('0x2c')](handleError(_0x3a957b,null));};exports[_0x7b53('0x110')]=function(_0x394b17,_0x381eb0,_0x25f928){return db[_0x7b53('0x4c')][_0x7b53('0x72')]({'where':{'id':_0x394b17[_0x7b53('0xbd')]['id']}})['then'](handleEntityNotFound(_0x381eb0,null))[_0x7b53('0x3b')](function(_0x1e1d1c){if(_0x1e1d1c){return _0x1e1d1c[_0x7b53('0x111')](_0x394b17[_0x7b53('0x41')]['ids'],_[_0x7b53('0x108')](_0x394b17[_0x7b53('0x41')],[_0x7b53('0x107'),'id'])||{})['spread'](function(){return db[_0x7b53('0x80')][_0x7b53('0x10c')]({'attributes':['id',_0x7b53('0x3e'),'color'],'where':{'id':_0x394b17[_0x7b53('0x41')][_0x7b53('0x107')]}});})['then'](function(_0x54bd70){socket[_0x7b53('0x112')](_0x7b53('0x113'),{'id':Number(_0x394b17[_0x7b53('0xbd')]['id']),'tags':_0x54bd70||[]});return{'id':Number(_0x394b17[_0x7b53('0xbd')]['id']),'tags':_0x54bd70||[]};});}})[_0x7b53('0x3b')](respondWithResult(_0x381eb0,null))[_0x7b53('0x2c')](handleError(_0x381eb0,null));};exports[_0x7b53('0x114')]=function(_0x5a48ce,_0xbc6452,_0xd42c1e){return db['ChatInteraction'][_0x7b53('0x72')]({'where':{'id':_0x5a48ce[_0x7b53('0xbd')]['id']}})['then'](handleEntityNotFound(_0xbc6452,null))[_0x7b53('0x3b')](function(_0x2eb115){if(_0x2eb115){return _0x2eb115[_0x7b53('0x114')](_0x5a48ce[_0x7b53('0x50')][_0x7b53('0x107')]);}})[_0x7b53('0x3b')](respondWithStatusCode(_0xbc6452,null))['catch'](handleError(_0xbc6452,null));};exports[_0x7b53('0xe5')]=function(_0x663fe4,_0x136973){var _0x45f07b=moment()[_0x7b53('0x115')]()['toString']();var _0x236ea0=path[_0x7b53('0xe7')](config[_0x7b53('0xe2')],'server','files',_0x7b53('0x116'));var _0x1e9b88=path[_0x7b53('0xe7')](config['root'],'server',_0x7b53('0x117'),_0x7b53('0x118'));var _0x1f395a=path[_0x7b53('0xe7')](_0x236ea0,_0x45f07b);var _0x91a467=util[_0x7b53('0xe9')]('transcript-%d-%s.zip',_0x663fe4[_0x7b53('0xbd')]['id'],_0x45f07b);var _0x1148d5=path[_0x7b53('0xe7')](_0x236ea0,_0x91a467);var _0x13895f=[];_0x13895f['push']({'model':db[_0x7b53('0x84')],'as':_0x7b53('0x84'),'attributes':['id',_0x7b53('0x47')],'raw':!![]});_0x13895f[_0x7b53('0x4a')]({'model':db[_0x7b53('0xed')],'as':_0x7b53('0x77'),'attributes':['id',_0x7b53('0x119'),_0x7b53('0x11a')],'raw':!![]});if(_0x663fe4['query'][_0x7b53('0x118')]){_0x13895f[_0x7b53('0x4a')]({'model':db[_0x7b53('0xde')],'as':_0x7b53('0xde'),'raw':!![]});}var _0x81b9d8=[{'model':db[_0x7b53('0xd0')],'as':'Messages','attributes':['id',_0x7b53('0x41'),_0x7b53('0x8d'),_0x7b53('0x11b'),_0x7b53('0xf9'),'read'],'include':_0x13895f}];_0x81b9d8[_0x7b53('0x4a')]({'model':db[_0x7b53('0xc3')],'as':_0x7b53('0x11c'),'attributes':['id',_0x7b53('0x3e')]});_0x81b9d8[_0x7b53('0x4a')]({'model':db['User'],'as':_0x7b53('0x11d'),'attributes':['id',_0x7b53('0x47')]});return db[_0x7b53('0x4c')][_0x7b53('0x72')]({'where':{'id':_0x663fe4[_0x7b53('0xbd')]['id']},'include':_0x81b9d8})['then'](handleEntityNotFound(_0x136973,null))[_0x7b53('0x3b')](function(_0x3caca1){if(_0x3caca1){var _0x504b83=_0x3caca1[_0x7b53('0x11e')]({'plain':!![]});fs[_0x7b53('0x11f')](_0x1f395a);var _0x3a305e={'channel':_0x7b53('0x120'),'account':_0x504b83[_0x7b53('0x11c')][_0x7b53('0x3e')],'agent':_0x504b83[_0x7b53('0x11d')]?_0x504b83[_0x7b53('0x11d')][_0x7b53('0x47')]:_0x7b53('0x121'),'createdAt':moment(_0x504b83[_0x7b53('0x8d')])[_0x7b53('0xe9')](_0x7b53('0x122'))[_0x7b53('0xaa')](),'closedAt':_0x504b83[_0x7b53('0xd6')]?moment(_0x504b83[_0x7b53('0x123')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7b53('0xaa')]():'','disposition':_0x504b83[_0x7b53('0xd7')],'chatInfo':{'browser':_0x504b83[_0x7b53('0x124')],'os':_0x504b83['osName'],'referer':_0x504b83[_0x7b53('0x125')],'customerIp':_0x504b83['customerIp'],'customerPort':_0x504b83['customerPort']?_0x504b83[_0x7b53('0x126')]:_0x7b53('0x121')},'messages':_(_0x504b83[_0x7b53('0xee')])[_0x7b53('0x127')]()['filter']({'secret':![]})[_0x7b53('0x46')](function(_0x251968){if(_0x251968[_0x7b53('0xde')]){var _0x38bd42=path['join'](_0x1e9b88,_0x251968[_0x7b53('0xde')][_0x7b53('0x128')]);if(fs[_0x7b53('0x129')](_0x38bd42)){fs['createReadStream'](_0x38bd42)[_0x7b53('0x12a')](fs[_0x7b53('0x12b')](path[_0x7b53('0xe7')](_0x1f395a,_0x251968[_0x7b53('0xde')][_0x7b53('0x128')])));}}return{'date':moment(_0x251968[_0x7b53('0x8d')])[_0x7b53('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7b53('0xaa')](),'sender':_0x251968[_0x7b53('0x11b')]===_0x7b53('0xcf')?_0x251968[_0x7b53('0x84')]?_0x251968['User'][_0x7b53('0x47')]:_0x7b53('0xf6'):_0x251968[_0x7b53('0x77')][_0x7b53('0x119')]+(_0x251968['Contact'][_0x7b53('0x11a')]?'\x20'+_0x251968[_0x7b53('0x77')][_0x7b53('0x11a')]:''),'body':_0x251968['Attachment']?_0x251968[_0x7b53('0xde')][_0x7b53('0x128')]:_0x251968[_0x7b53('0x41')],'direction':_0x251968['direction']===_0x7b53('0xcf')?'A':'C','secret':_0x251968['secret'],'read':_0x251968[_0x7b53('0x95')],'attachment':_0x251968[_0x7b53('0xde')]};})[_0x7b53('0x74')]()};return ejs[_0x7b53('0x12c')](path[_0x7b53('0xe7')](config[_0x7b53('0xe2')],_0x7b53('0x12d'),'views','downloadInteraction.html'),{'interaction':_0x3a305e})[_0x7b53('0x3b')](function(_0x5a586f){var _0x38d145=path[_0x7b53('0xe7')](_0x1f395a,_0x7b53('0x12e')+_0x504b83['id']+'-'+_0x45f07b+_0x7b53('0x12f'));var _0x2de324={'path':_0x38d145,'channel':_0x7b53('0x120'),'interactionId':_0x504b83['id']};return pdf[_0x7b53('0x130')](_0x5a586f,_0x2de324);})[_0x7b53('0x3b')](function(){return new BPromise(function(_0x17156a,_0x368ed8){zipdir(_0x1f395a,{'saveTo':_0x1148d5},function(_0x579192,_0x133804){if(_0x579192)return _0x368ed8(_0x579192);return _0x17156a(_0x133804);});})[_0x7b53('0x3b')](function(){return new BPromise(function(_0x368264,_0x45213e){rimraf(_0x1f395a,function(_0x42a62c){if(_0x42a62c)_0x45213e(_0x42a62c);return _0x368264();});});})[_0x7b53('0x3b')](function(){return _0x136973[_0x7b53('0xe5')](_0x1148d5,_0x91a467,function(_0x497369){if(_0x497369){console['log'](_0x7b53('0x131'),_0x497369);}else{fs[_0x7b53('0x132')](_0x1148d5);}});});});}else{return _0x136973[_0x7b53('0x2d')](0xc8);}})['catch'](handleError(_0x136973,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d69888d..8b3796d 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 _0x2d95=['ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','ChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d95,0xca));var _0x52d9=function(_0x4a77dc,_0x352436){_0x4a77dc=_0x4a77dc-0x0;var _0x4144bc=_0x2d95[_0x4a77dc];return _0x4144bc;};'use strict';var EventEmitter=require(_0x52d9('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x52d9('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x52d9('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x52d9('0x3')](0x0);var events={'afterCreate':_0x52d9('0x4'),'afterUpdate':'update','afterDestroy':_0x52d9('0x5')};function emitEvent(_0x7aff8f){return function(_0x38acb9,_0x1d30e2,_0x16eb99){_0x38acb9[_0x52d9('0x6')]({'attributes':['id'],'raw':!![]})[_0x52d9('0x7')](function(_0x8fa664){_0x38acb9[_0x52d9('0x8')](_0x52d9('0x9'),_0x8fa664[_0x52d9('0xa')](function(_0x20991e){return{'id':_0x20991e['id']};}));return ChatMessage[_0x52d9('0xb')]({'where':{'ChatInteractionId':_0x38acb9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x52d9('0x7')](function(_0x5b0892){_0x38acb9['setDataValue']('unreadMessages',_0x5b0892[_0x52d9('0xc')]);ChatInteractionEvents[_0x52d9('0xd')](_0x7aff8f+':'+_0x38acb9['id'],_0x38acb9);ChatInteractionEvents[_0x52d9('0xd')](_0x7aff8f,_0x38acb9);_0x16eb99(null);})[_0x52d9('0xe')](_0x16eb99(null));};}for(var e in events){if(events[_0x52d9('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x52d9('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x0f25=['hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x939d84,_0xe5c706){var _0x4bd8b0=function(_0x388328){while(--_0x388328){_0x939d84['push'](_0x939d84['shift']());}};_0x4bd8b0(++_0xe5c706);}(_0x0f25,0xdf));var _0x50f2=function(_0x28a569,_0x59e3bd){_0x28a569=_0x28a569-0x0;var _0x4e57f6=_0x0f25[_0x28a569];return _0x4e57f6;};'use strict';var EventEmitter=require(_0x50f2('0x0'));var ChatInteraction=require(_0x50f2('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x50f2('0x1'))['db'][_0x50f2('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x50f2('0x3')](0x0);var events={'afterCreate':_0x50f2('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x19e72e){return function(_0x101e24,_0x8a81df,_0x19b8ac){_0x101e24[_0x50f2('0x5')]({'attributes':['id'],'raw':!![]})[_0x50f2('0x6')](function(_0x19e3ce){_0x101e24[_0x50f2('0x7')](_0x50f2('0x8'),_0x19e3ce[_0x50f2('0x9')](function(_0x519b84){return{'id':_0x519b84['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x101e24['id'],'direction':'in','read':![]},'raw':!![]});})[_0x50f2('0x6')](function(_0x29d972){_0x101e24[_0x50f2('0x7')](_0x50f2('0xa'),_0x29d972[_0x50f2('0xb')]);ChatInteractionEvents[_0x50f2('0xc')](_0x19e72e+':'+_0x101e24['id'],_0x101e24);ChatInteractionEvents[_0x50f2('0xc')](_0x19e72e,_0x101e24);_0x19b8ac(null);})[_0x50f2('0xd')](_0x19b8ac(null));};}for(var e in events){if(events[_0x50f2('0xe')](e)){var event=events[e];ChatInteraction[_0x50f2('0xf')](e,emitEvent(event));}}module[_0x50f2('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 2515744..327402a 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 _0xab63=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','changed'];(function(_0x4392af,_0xec5afe){var _0x9fa8eb=function(_0x41d7a4){while(--_0x41d7a4){_0x4392af['push'](_0x4392af['shift']());}};_0x9fa8eb(++_0xec5afe);}(_0xab63,0x1e5));var _0x3ab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab63[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ab6('0x0'));var util=require('util');var logger=require(_0x3ab6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3ab6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ab6('0x3'));var rimraf=require(_0x3ab6('0x4'));var config=require(_0x3ab6('0x5'));var attributes=require(_0x3ab6('0x6'));module['exports']=function(_0x572932,_0x25ef7c){return _0x572932[_0x3ab6('0x7')](_0x3ab6('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f5bbc,_0x3084b2,_0x26cc4c){if(_0x1f5bbc[_0x3ab6('0x9')](_0x3ab6('0xa'))){_0x1f5bbc[_0x3ab6('0xb')]=moment()[_0x3ab6('0xc')](_0x3ab6('0xd'));}_0x26cc4c(null,_0x1f5bbc);}},'charset':'utf8mb4','collate':_0x3ab6('0xe')});}; \ No newline at end of file +var _0x4b29=['utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x4b29,0xbf));var _0x94b2=function(_0x7e4176,_0x26ce05){_0x7e4176=_0x7e4176-0x0;var _0x4ebd2c=_0x4b29[_0x7e4176];return _0x4ebd2c;};'use strict';var _=require(_0x94b2('0x0'));var util=require(_0x94b2('0x1'));var logger=require(_0x94b2('0x2'))(_0x94b2('0x3'));var moment=require(_0x94b2('0x4'));var BPromise=require('bluebird');var rp=require(_0x94b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94b2('0x6'));var config=require(_0x94b2('0x7'));var attributes=require(_0x94b2('0x8'));module[_0x94b2('0x9')]=function(_0xf778f8,_0x4b6039){return _0xf778f8[_0x94b2('0xa')](_0x94b2('0xb'),attributes,{'tableName':_0x94b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8e822f,_0x7fcdc4,_0x1855f9){if(_0x8e822f[_0x94b2('0xd')](_0x94b2('0xe'))){_0x8e822f[_0x94b2('0xf')]=moment()[_0x94b2('0x10')](_0x94b2('0x11'));}_0x1855f9(null,_0x8e822f);}},'charset':_0x94b2('0x12'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index c0d0616..7043df3 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 _0x3a6d=['spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','UpdateChatInteraction','ChatInteraction','body','raw','options','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','ids','omit'];(function(_0x506844,_0x540ef7){var _0x30bc09=function(_0x441feb){while(--_0x441feb){_0x506844['push'](_0x506844['shift']());}};_0x30bc09(++_0x540ef7);}(_0x3a6d,0xae));var _0xd3a6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3a6d[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var rs=require(_0xd3a6('0x3'));var fs=require('fs');var Redis=require(_0xd3a6('0x4'));var db=require(_0xd3a6('0x5'))['db'];var utils=require(_0xd3a6('0x6'));var logger=require('../../config/logger')(_0xd3a6('0x7'));var config=require('../../config/environment');var jayson=require(_0xd3a6('0x8'));var client=jayson[_0xd3a6('0x9')][_0xd3a6('0xa')]({'port':0x232a});config['redis']=_[_0xd3a6('0xb')](config['redis'],{'host':_0xd3a6('0xc'),'port':0x18eb});var socket=require(_0xd3a6('0xd'))(new Redis(config[_0xd3a6('0xe')]));require(_0xd3a6('0xf'))[_0xd3a6('0x10')](socket);function respondWithRpcPromise(_0x25296a,_0x17ab2a,_0x4b1f2f){return new BPromise(function(_0x5947e5,_0x12713b){return client[_0xd3a6('0x11')](_0x25296a,_0x4b1f2f)[_0xd3a6('0x12')](function(_0x317151){logger[_0xd3a6('0x13')](_0xd3a6('0x14'),_0x17ab2a,_0xd3a6('0x15'));logger[_0xd3a6('0x16')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x17ab2a,_0xd3a6('0x15'),JSON[_0xd3a6('0x17')](_0x317151));if(_0x317151['error']){if(_0x317151[_0xd3a6('0x18')][_0xd3a6('0x19')]===0x1f4){logger[_0xd3a6('0x18')](_0xd3a6('0x14'),_0x17ab2a,_0x317151[_0xd3a6('0x18')]['message']);return _0x12713b(_0x317151[_0xd3a6('0x18')][_0xd3a6('0x1a')]);}logger['error'](_0xd3a6('0x14'),_0x17ab2a,_0x317151[_0xd3a6('0x18')]['message']);return _0x5947e5(_0x317151['error']['message']);}else{logger[_0xd3a6('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x17ab2a,_0xd3a6('0x15'));_0x5947e5(_0x317151['result'][_0xd3a6('0x1a')]);}})['catch'](function(_0x1362d1){logger[_0xd3a6('0x18')](_0xd3a6('0x14'),_0x17ab2a,_0x1362d1);_0x12713b(_0x1362d1);});});}exports[_0xd3a6('0x1b')]=function(_0xe5634e){var _0x551e73=this;return new Promise(function(_0x51e90e,_0x1ed001){return db[_0xd3a6('0x1c')]['update'](_0xe5634e[_0xd3a6('0x1d')],{'raw':_0xe5634e['options']?_0xe5634e['options'][_0xd3a6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe5634e[_0xd3a6('0x1f')]?_0xe5634e[_0xd3a6('0x1f')][_0xd3a6('0x20')]||null:null,'attributes':_0xe5634e[_0xd3a6('0x1f')]?_0xe5634e[_0xd3a6('0x1f')][_0xd3a6('0x21')]||null:null,'limit':_0xe5634e['options']?_0xe5634e[_0xd3a6('0x1f')][_0xd3a6('0x22')]||null:null})[_0xd3a6('0x12')](function(_0x4edd57){logger[_0xd3a6('0x13')](_0xd3a6('0x1b'),_0xe5634e);logger['debug'](_0xd3a6('0x1b'),_0xe5634e,JSON[_0xd3a6('0x17')](_0x4edd57));_0x51e90e(_0x4edd57);})[_0xd3a6('0x23')](function(_0x1b9e97){logger[_0xd3a6('0x18')](_0xd3a6('0x1b'),_0x1b9e97[_0xd3a6('0x1a')],_0xe5634e);_0x1ed001(_0x551e73[_0xd3a6('0x18')](0x1f4,_0x1b9e97['message']));});});};exports[_0xd3a6('0x24')]=function(_0x5a90cf){return new Promise(function(_0x2ca18c,_0x4003ec){return db[_0xd3a6('0x1c')][_0xd3a6('0x25')]({'where':_0x5a90cf[_0xd3a6('0x1f')]?_0x5a90cf['options']['where']||null:null})[_0xd3a6('0x12')](function(_0x5bbb29){if(_0x5bbb29){return _0x5bbb29[_0xd3a6('0x26')](_0x5a90cf[_0xd3a6('0x1d')][_0xd3a6('0x27')],_[_0xd3a6('0x28')](_0x5a90cf['body'],['ids','id'])||{});}})[_0xd3a6('0x29')](function(_0x4812a0){logger[_0xd3a6('0x13')](_0xd3a6('0x2a'),_0x5a90cf);logger[_0xd3a6('0x16')](_0xd3a6('0x2a'),_0x5a90cf,JSON['stringify'](_0x4812a0));_0x2ca18c(_0x4812a0);})[_0xd3a6('0x23')](function(_0x38f597){logger[_0xd3a6('0x18')](_0xd3a6('0x2a'),_0x38f597['message'],_0x5a90cf);_0x4003ec(_this[_0xd3a6('0x18')](0x1f4,_0x38f597[_0xd3a6('0x1a')]));});});}; \ No newline at end of file +var _0x4c8e=['localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','AddTagsToChatInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x144d3b,_0x139d2d){var _0x29736d=function(_0x405011){while(--_0x405011){_0x144d3b['push'](_0x144d3b['shift']());}};_0x29736d(++_0x139d2d);}(_0x4c8e,0x1c2));var _0xe4c8=function(_0x529a0f,_0x328763){_0x529a0f=_0x529a0f-0x0;var _0x187a88=_0x4c8e[_0x529a0f];return _0x187a88;};'use strict';var _=require(_0xe4c8('0x0'));var util=require(_0xe4c8('0x1'));var moment=require(_0xe4c8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4c8('0x3'));var db=require(_0xe4c8('0x4'))['db'];var utils=require(_0xe4c8('0x5'));var logger=require('../../config/logger')(_0xe4c8('0x6'));var config=require(_0xe4c8('0x7'));var jayson=require(_0xe4c8('0x8'));var client=jayson[_0xe4c8('0x9')][_0xe4c8('0xa')]({'port':0x232a});config[_0xe4c8('0xb')]=_['defaults'](config['redis'],{'host':_0xe4c8('0xc'),'port':0x18eb});var socket=require(_0xe4c8('0xd'))(new Redis(config[_0xe4c8('0xb')]));require(_0xe4c8('0xe'))['register'](socket);function respondWithRpcPromise(_0x19572a,_0x95c1cf,_0xb3fb12){return new BPromise(function(_0x32c4c4,_0x9ee151){return client[_0xe4c8('0xf')](_0x19572a,_0xb3fb12)[_0xe4c8('0x10')](function(_0x50239d){logger[_0xe4c8('0x11')](_0xe4c8('0x12'),_0x95c1cf,'request\x20sent');logger[_0xe4c8('0x13')](_0xe4c8('0x14'),_0x95c1cf,_0xe4c8('0x15'),JSON[_0xe4c8('0x16')](_0x50239d));if(_0x50239d[_0xe4c8('0x17')]){if(_0x50239d[_0xe4c8('0x17')][_0xe4c8('0x18')]===0x1f4){logger[_0xe4c8('0x17')](_0xe4c8('0x12'),_0x95c1cf,_0x50239d[_0xe4c8('0x17')][_0xe4c8('0x19')]);return _0x9ee151(_0x50239d[_0xe4c8('0x17')]['message']);}logger[_0xe4c8('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x95c1cf,_0x50239d[_0xe4c8('0x17')]['message']);return _0x32c4c4(_0x50239d['error'][_0xe4c8('0x19')]);}else{logger['info'](_0xe4c8('0x12'),_0x95c1cf,_0xe4c8('0x15'));_0x32c4c4(_0x50239d[_0xe4c8('0x1a')]['message']);}})[_0xe4c8('0x1b')](function(_0x507a43){logger['error'](_0xe4c8('0x12'),_0x95c1cf,_0x507a43);_0x9ee151(_0x507a43);});});}exports[_0xe4c8('0x1c')]=function(_0x13e2af){var _0x37e6ad=this;return new Promise(function(_0x2e8e9d,_0x3ad318){return db[_0xe4c8('0x1d')][_0xe4c8('0x1e')](_0x13e2af['body'],{'raw':_0x13e2af[_0xe4c8('0x1f')]?_0x13e2af[_0xe4c8('0x1f')][_0xe4c8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13e2af[_0xe4c8('0x1f')]?_0x13e2af[_0xe4c8('0x1f')][_0xe4c8('0x21')]||null:null,'attributes':_0x13e2af[_0xe4c8('0x1f')]?_0x13e2af['options'][_0xe4c8('0x22')]||null:null,'limit':_0x13e2af['options']?_0x13e2af['options'][_0xe4c8('0x23')]||null:null})[_0xe4c8('0x10')](function(_0x5c9171){logger[_0xe4c8('0x11')](_0xe4c8('0x1c'),_0x13e2af);logger[_0xe4c8('0x13')](_0xe4c8('0x1c'),_0x13e2af,JSON['stringify'](_0x5c9171));_0x2e8e9d(_0x5c9171);})[_0xe4c8('0x1b')](function(_0x4f8cbe){logger[_0xe4c8('0x17')]('UpdateChatInteraction',_0x4f8cbe['message'],_0x13e2af);_0x3ad318(_0x37e6ad['error'](0x1f4,_0x4f8cbe[_0xe4c8('0x19')]));});});};exports[_0xe4c8('0x24')]=function(_0x2920b9){return new Promise(function(_0x481ce6,_0x19c3a8){return db[_0xe4c8('0x1d')]['find']({'where':_0x2920b9[_0xe4c8('0x1f')]?_0x2920b9[_0xe4c8('0x1f')][_0xe4c8('0x21')]||null:null})['then'](function(_0x2aaa54){if(_0x2aaa54){return _0x2aaa54[_0xe4c8('0x25')](_0x2920b9['body'][_0xe4c8('0x26')],_[_0xe4c8('0x27')](_0x2920b9['body'],['ids','id'])||{});}})[_0xe4c8('0x28')](function(_0x41b0bb){logger[_0xe4c8('0x11')](_0xe4c8('0x29'),_0x2920b9);logger[_0xe4c8('0x13')]('AddTags',_0x2920b9,JSON['stringify'](_0x41b0bb));_0x481ce6(_0x41b0bb);})[_0xe4c8('0x1b')](function(_0x113e61){logger[_0xe4c8('0x17')](_0xe4c8('0x29'),_0x113e61[_0xe4c8('0x19')],_0x2920b9);_0x19c3a8(_this[_0xe4c8('0x17')](0x1f4,_0x113e61[_0xe4c8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8284f8d..f309eab 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 _0xcbfb=['update','emit','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x30e344,_0x5ba1dd){var _0x45013c=function(_0x612c30){while(--_0x612c30){_0x30e344['push'](_0x30e344['shift']());}};_0x45013c(++_0x5ba1dd);}(_0xcbfb,0x12a));var _0xbcbf=function(_0x8db583,_0x5bb1b3){_0x8db583=_0x8db583-0x0;var _0x276f94=_0xcbfb[_0x8db583];return _0x276f94;};'use strict';var ChatInteractionEvents=require(_0xbcbf('0x0'));var events=[_0xbcbf('0x1'),'remove',_0xbcbf('0x2')];function createListener(_0x276333,_0x22b68d){return function(_0x96f38){_0x22b68d[_0xbcbf('0x3')](_0x276333,_0x96f38);};}function removeListener(_0x29b55c,_0x2500cd){return function(){ChatInteractionEvents['removeListener'](_0x29b55c,_0x2500cd);};}exports['register']=function(_0x25f98f){for(var _0x27368e=0x0,_0x145187=events[_0xbcbf('0x4')];_0x27368e<_0x145187;_0x27368e++){var _0x2d781b=events[_0x27368e];var _0x31d7d8=createListener(_0xbcbf('0x5')+_0x2d781b,_0x25f98f);ChatInteractionEvents['on'](_0x2d781b,_0x31d7d8);}}; \ No newline at end of file +var _0xeb6c=['save','remove','update','emit','removeListener','length','chatInteraction:','./chatInteraction.events'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xeb6c,0x1a7));var _0xceb6=function(_0x4a6eeb,_0x3da661){_0x4a6eeb=_0x4a6eeb-0x0;var _0x38acad=_0xeb6c[_0x4a6eeb];return _0x38acad;};'use strict';var ChatInteractionEvents=require(_0xceb6('0x0'));var events=[_0xceb6('0x1'),_0xceb6('0x2'),_0xceb6('0x3')];function createListener(_0x33d20f,_0x9f4699){return function(_0x5eba2e){_0x9f4699[_0xceb6('0x4')](_0x33d20f,_0x5eba2e);};}function removeListener(_0x348f47,_0x5ebbd5){return function(){ChatInteractionEvents[_0xceb6('0x5')](_0x348f47,_0x5ebbd5);};}exports['register']=function(_0x5d7835){for(var _0x357010=0x0,_0x17ea10=events[_0xceb6('0x6')];_0x357010<_0x17ea10;_0x357010++){var _0x358563=events[_0x357010];var _0x46fa5e=createListener(_0xceb6('0x7')+_0x358563,_0x5d7835);ChatInteractionEvents['on'](_0x358563,_0x46fa5e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index dee14f8..6304c6d 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 _0xc857=['/:id/custom_update','abandon','close','delete','chatinteraction:destroy','destroy','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','addMessage','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0xc857,0x1ad));var _0x7c85=function(_0x16c8eb,_0xf75e2c){_0x16c8eb=_0x16c8eb-0x0;var _0x383f0d=_0xc857[_0x16c8eb];return _0x383f0d;};'use strict';var multer=require(_0x7c85('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7c85('0x1')]();var fs_extra=require(_0x7c85('0x2'));var auth=require(_0x7c85('0x3'));var interaction=require(_0x7c85('0x4'));var config=require(_0x7c85('0x5'));var controller=require(_0x7c85('0x6'));router[_0x7c85('0x7')]('/',auth[_0x7c85('0x8')](),controller['index']);router['get'](_0x7c85('0x9'),auth['isAuthenticated'](),controller[_0x7c85('0xa')]);router[_0x7c85('0x7')](_0x7c85('0xb'),auth[_0x7c85('0xc')](),controller['show']);router['get'](_0x7c85('0xd'),auth[_0x7c85('0xc')](),controller[_0x7c85('0xe')]);router[_0x7c85('0x7')](_0x7c85('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x7c85('0x10'),auth[_0x7c85('0xc')](),controller[_0x7c85('0x11')]);router['get'](_0x7c85('0x12'),auth['isAuthenticated'](),controller[_0x7c85('0x13')]);router[_0x7c85('0x14')]('/',auth[_0x7c85('0x8')](),controller[_0x7c85('0x15')]);router[_0x7c85('0x14')](_0x7c85('0x16'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x7c85('0x17')]({'destination':function(_0x52b269,_0xddef03,_0x28bc1e){_0x28bc1e(null,path['join'](config[_0x7c85('0x18')],_0x7c85('0x19')));},'filename':function(_0x28d6b8,_0x303a99,_0x3546b2){_0x3546b2(null,util[_0x7c85('0x1a')](_0x7c85('0x1b'),Date[_0x7c85('0x1c')](),_0x303a99[_0x7c85('0x1d')][_0x7c85('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7c85('0x14')](_0x7c85('0x1f'),upload[_0x7c85('0x20')]('file'),controller['attachmentUpload']);router[_0x7c85('0x14')]('/:id/messages',auth[_0x7c85('0xc')](),controller[_0x7c85('0x21')]);router['post']('/:id/tags',auth[_0x7c85('0x8')](),interaction[_0x7c85('0x22')]('chat',_0x7c85('0x23')),controller[_0x7c85('0x24')]);router[_0x7c85('0x25')](_0x7c85('0xb'),auth[_0x7c85('0x8')](),interaction[_0x7c85('0x22')](_0x7c85('0x26'),_0x7c85('0x27')),controller[_0x7c85('0x28')]);router[_0x7c85('0x25')](_0x7c85('0x29'),controller['customUpdate']);router[_0x7c85('0x25')]('/:id/abandon',auth[_0x7c85('0xc')](),controller[_0x7c85('0x2a')]);router[_0x7c85('0x25')]('/:id/close',controller[_0x7c85('0x2b')]);router[_0x7c85('0x2c')](_0x7c85('0xb'),auth['isAuthenticated'](),interaction[_0x7c85('0x22')]('chat',_0x7c85('0x2d')),controller[_0x7c85('0x2e')]);router[_0x7c85('0x2c')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x0975=['replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','/:id','chat','chatinteraction:update','customUpdate','/:id/abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','create','post','createVidaooSession','join','format','%s-%s','now'];(function(_0x3a8afd,_0x50a5e9){var _0x7d89e9=function(_0x515247){while(--_0x515247){_0x3a8afd['push'](_0x3a8afd['shift']());}};_0x7d89e9(++_0x50a5e9);}(_0x0975,0x1e9));var _0x5097=function(_0x4e31c1,_0xe002f8){_0x4e31c1=_0x4e31c1-0x0;var _0x3bd306=_0x0975[_0x4e31c1];return _0x3bd306;};'use strict';var multer=require(_0x5097('0x0'));var util=require(_0x5097('0x1'));var path=require(_0x5097('0x2'));var timeout=require(_0x5097('0x3'));var express=require(_0x5097('0x4'));var router=express[_0x5097('0x5')]();var fs_extra=require(_0x5097('0x6'));var auth=require(_0x5097('0x7'));var interaction=require(_0x5097('0x8'));var config=require('../../config/environment');var controller=require(_0x5097('0x9'));router[_0x5097('0xa')]('/',auth['isAuthenticated'](),controller[_0x5097('0xb')]);router[_0x5097('0xa')](_0x5097('0xc'),auth[_0x5097('0xd')](),controller[_0x5097('0xe')]);router[_0x5097('0xa')]('/:id',auth[_0x5097('0xf')](),controller[_0x5097('0x10')]);router[_0x5097('0xa')](_0x5097('0x11'),auth[_0x5097('0xf')](),controller[_0x5097('0x12')]);router[_0x5097('0xa')](_0x5097('0x13'),auth['isAuthenticated'](),controller[_0x5097('0x14')]);router['get'](_0x5097('0x15'),auth[_0x5097('0xf')](),controller[_0x5097('0x16')]);router['get']('/:id/download',auth[_0x5097('0xd')](),controller[_0x5097('0x17')]);router['post']('/',auth[_0x5097('0xd')](),controller[_0x5097('0x18')]);router[_0x5097('0x19')]('/:id/vidaoo',auth[_0x5097('0xd')](),controller[_0x5097('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1f36df,_0x714d0,_0x2d4b3e){_0x2d4b3e(null,path[_0x5097('0x1b')](config['root'],'server/files/attachments/'));},'filename':function(_0x3e18b8,_0x339ca3,_0x7bbd03){_0x7bbd03(null,util[_0x5097('0x1c')](_0x5097('0x1d'),Date[_0x5097('0x1e')](),_0x339ca3['originalname'][_0x5097('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x5097('0x20'),upload[_0x5097('0x21')](_0x5097('0x22')),controller['attachmentUpload']);router[_0x5097('0x19')](_0x5097('0x13'),auth[_0x5097('0xf')](),controller[_0x5097('0x23')]);router['post'](_0x5097('0x24'),auth[_0x5097('0xd')](),interaction[_0x5097('0x25')]('chat',_0x5097('0x26')),controller[_0x5097('0x27')]);router[_0x5097('0x28')](_0x5097('0x29'),auth[_0x5097('0xd')](),interaction[_0x5097('0x25')](_0x5097('0x2a'),_0x5097('0x2b')),controller['update']);router[_0x5097('0x28')]('/:id/custom_update',controller[_0x5097('0x2c')]);router['put'](_0x5097('0x2d'),auth[_0x5097('0xf')](),controller['abandon']);router['put'](_0x5097('0x2e'),controller['close']);router[_0x5097('0x2f')](_0x5097('0x29'),auth[_0x5097('0xd')](),interaction[_0x5097('0x25')](_0x5097('0x2a'),_0x5097('0x30')),controller[_0x5097('0x31')]);router[_0x5097('0x2f')](_0x5097('0x24'),auth[_0x5097('0xd')](),controller[_0x5097('0x32')]);module[_0x5097('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 8bc8b9a..456f5a9 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 _0x7a54=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x7a54,0x106));var _0x47a5=function(_0x1085b0,_0x338354){_0x1085b0=_0x1085b0-0x0;var _0x3a1e04=_0x7a54[_0x1085b0];return _0x3a1e04;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'body':{'type':Sequelize[_0x47a5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x4975=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4975,0x86));var _0x5497=function(_0x2d090e,_0x2a9ff7){_0x2d090e=_0x2d090e-0x0;var _0x5b9297=_0x4975[_0x2d090e];return _0x5b9297;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'body':{'type':Sequelize[_0x5497('0x1')](_0x5497('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5497('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5497('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 40ce43b..1f5a834 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 _0x5636=['catch','show','params','find','create','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','internal','online','showWebBar','-online','VoiceQueue','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','-createdAt','all','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','end','json','limit','undefined','count','offset','status','set','apply','save','update','then','error','stack','name','render','merge','body','contact','message','agent','interaction','account','index','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x1a1096,_0x3ba666){var _0x5b970c=function(_0x4b2b92){while(--_0x4b2b92){_0x1a1096['push'](_0x1a1096['shift']());}};_0x5b970c(++_0x3ba666);}(_0x5636,0x102));var _0x6563=function(_0x2bdde9,_0x270c2f){_0x2bdde9=_0x2bdde9-0x0;var _0x5da617=_0x5636[_0x2bdde9];return _0x5da617;};'use strict';var emlformat=require(_0x6563('0x0'));var rimraf=require(_0x6563('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6563('0x2'));var BPromise=require(_0x6563('0x3'));var Mustache=require(_0x6563('0x4'));var util=require('util');var path=require(_0x6563('0x5'));var sox=require(_0x6563('0x6'));var csv=require(_0x6563('0x7'));var ejs=require(_0x6563('0x8'));var fs=require('fs');var fs_extra=require(_0x6563('0x9'));var _=require(_0x6563('0xa'));var squel=require(_0x6563('0xb'));var crypto=require(_0x6563('0xc'));var jsforce=require(_0x6563('0xd'));var deskjs=require(_0x6563('0xe'));var toCsv=require(_0x6563('0x7'));var querystring=require(_0x6563('0xf'));var Papa=require(_0x6563('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6563('0x11'));var as=require(_0x6563('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6563('0x13'));var config=require(_0x6563('0x14'));var licenseUtil=require(_0x6563('0x15'));var db=require(_0x6563('0x16'))['db'];config[_0x6563('0x17')]=_[_0x6563('0x18')](config[_0x6563('0x17')],{'host':_0x6563('0x19'),'port':0x18eb});var socket=require(_0x6563('0x1a'))(new Redis(config['redis']));require(_0x6563('0x1b'))['register'](socket);function respondWithStatusCode(_0x37131e,_0x59bee1){_0x59bee1=_0x59bee1||0xcc;return function(_0x33f8e4){if(_0x33f8e4){return _0x37131e[_0x6563('0x1c')](_0x59bee1);}return _0x37131e['status'](_0x59bee1)[_0x6563('0x1d')]();};}function respondWithResult(_0x11baa2,_0x477d9b){_0x477d9b=_0x477d9b||0xc8;return function(_0xd398ce){if(_0xd398ce){return _0x11baa2['status'](_0x477d9b)[_0x6563('0x1e')](_0xd398ce);}};}function respondWithFilteredResult(_0x589632,_0x502694){return function(_0x47972a){if(_0x47972a){var _0x14c6a6=typeof _0x502694['offset']==='undefined'&&typeof _0x502694[_0x6563('0x1f')]===_0x6563('0x20');var _0x17a29f=_0x47972a[_0x6563('0x21')];var _0xf8b544=_0x14c6a6?0x0:_0x502694[_0x6563('0x22')];var _0x37ba3=_0x14c6a6?_0x47972a[_0x6563('0x21')]:_0x502694[_0x6563('0x22')]+_0x502694['limit'];var _0x2f2905;if(_0x37ba3>=_0x17a29f){_0x37ba3=_0x17a29f;_0x2f2905=0xc8;}else{_0x2f2905=0xce;}_0x589632[_0x6563('0x23')](_0x2f2905);return _0x589632[_0x6563('0x24')]('Content-Range',_0xf8b544+'-'+_0x37ba3+'/'+_0x17a29f)[_0x6563('0x1e')](_0x47972a);}return null;};}function patchUpdates(_0x5c37bb){return function(_0x5953c5){try{jsonpatch[_0x6563('0x25')](_0x5953c5,_0x5c37bb,!![]);}catch(_0x5610b0){return BPromise['reject'](_0x5610b0);}return _0x5953c5[_0x6563('0x26')]();};}function saveUpdates(_0x492f45,_0x1097d0){return function(_0x19f34e){if(_0x19f34e){return _0x19f34e[_0x6563('0x27')](_0x492f45)['then'](function(_0xd860d5){return _0xd860d5;});}return null;};}function removeEntity(_0x51ff06,_0x7ea857){return function(_0x1590e6){if(_0x1590e6){return _0x1590e6['destroy']()[_0x6563('0x28')](function(){_0x51ff06[_0x6563('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ddb2b,_0x5b03a7){return function(_0x1fe1cb){if(!_0x1fe1cb){_0x2ddb2b['sendStatus'](0x194);}return _0x1fe1cb;};}function handleError(_0x480408,_0x30f05a){_0x30f05a=_0x30f05a||0x1f4;return function(_0x118d31){logger[_0x6563('0x29')](_0x118d31[_0x6563('0x2a')]);if(_0x118d31[_0x6563('0x2b')]){delete _0x118d31['name'];}_0x480408[_0x6563('0x23')](_0x30f05a)['send'](_0x118d31);};}function getMustacheRender(_0x5b100b,_0x3582c9){return Mustache[_0x6563('0x2c')](_0x5b100b,_[_0x6563('0x2d')](_0x3582c9[_0x6563('0x2e')],{'contact':_0x3582c9[_0x6563('0x2f')],'message':_0x3582c9[_0x6563('0x30')],'agent':_0x3582c9[_0x6563('0x31')],'interaction':_0x3582c9[_0x6563('0x32')],'account':_0x3582c9[_0x6563('0x33')]}))||'';}exports[_0x6563('0x34')]=function(_0x59b1a6,_0x9b3d86){var _0x30b67c={},_0x29fb9d={},_0x1558fb={'count':0x0,'rows':[]};var _0x29ab06=_[_0x6563('0x35')](db[_0x6563('0x36')]['rawAttributes'],function(_0x8cf1){return{'name':_0x8cf1[_0x6563('0x37')],'type':_0x8cf1[_0x6563('0x38')][_0x6563('0x39')]};});_0x29fb9d[_0x6563('0x3a')]=_[_0x6563('0x35')](_0x29ab06,'name');_0x29fb9d[_0x6563('0x3b')]=_[_0x6563('0x3c')](_0x59b1a6[_0x6563('0x3b')]);_0x29fb9d[_0x6563('0x3d')]=_[_0x6563('0x3e')](_0x29fb9d[_0x6563('0x3a')],_0x29fb9d[_0x6563('0x3b')]);_0x30b67c['attributes']=_[_0x6563('0x3e')](_0x29fb9d[_0x6563('0x3a')],qs['fields'](_0x59b1a6[_0x6563('0x3b')][_0x6563('0x3f')]));_0x30b67c['attributes']=_0x30b67c['attributes'][_0x6563('0x40')]?_0x30b67c[_0x6563('0x41')]:_0x29fb9d[_0x6563('0x3a')];if(!_0x59b1a6[_0x6563('0x3b')]['hasOwnProperty'](_0x6563('0x42'))){_0x30b67c[_0x6563('0x1f')]=qs['limit'](_0x59b1a6[_0x6563('0x3b')][_0x6563('0x1f')]);_0x30b67c[_0x6563('0x22')]=qs[_0x6563('0x22')](_0x59b1a6[_0x6563('0x3b')][_0x6563('0x22')]);}_0x30b67c[_0x6563('0x43')]=qs[_0x6563('0x44')](_0x59b1a6[_0x6563('0x3b')]['sort']);_0x30b67c[_0x6563('0x45')]=qs[_0x6563('0x3d')](_[_0x6563('0x46')](_0x59b1a6[_0x6563('0x3b')],_0x29fb9d['filters']),_0x29ab06);if(_0x59b1a6['query'][_0x6563('0x47')]){_0x30b67c[_0x6563('0x45')]=_[_0x6563('0x2d')](_0x30b67c['where'],{'$or':_[_0x6563('0x35')](_0x29ab06,function(_0x50c3ce){if(_0x50c3ce[_0x6563('0x38')]!==_0x6563('0x48')){var _0x57c1bf={};_0x57c1bf[_0x50c3ce[_0x6563('0x2b')]]={'$like':'%'+_0x59b1a6[_0x6563('0x3b')][_0x6563('0x47')]+'%'};return _0x57c1bf;}})});}_0x30b67c=_[_0x6563('0x2d')]({},_0x30b67c,_0x59b1a6[_0x6563('0x49')]);var _0x1d742f={'where':_0x30b67c[_0x6563('0x45')]};return db[_0x6563('0x36')][_0x6563('0x21')](_0x1d742f)[_0x6563('0x28')](function(_0x2acb52){_0x1558fb['count']=_0x2acb52;if(_0x59b1a6['query'][_0x6563('0x4a')]){_0x30b67c[_0x6563('0x4b')]=[{'all':!![]}];}return db[_0x6563('0x36')][_0x6563('0x4c')](_0x30b67c);})[_0x6563('0x28')](function(_0x464d45){_0x1558fb[_0x6563('0x4d')]=_0x464d45;return _0x1558fb;})['then'](respondWithFilteredResult(_0x9b3d86,_0x30b67c))[_0x6563('0x4e')](handleError(_0x9b3d86,null));};exports[_0x6563('0x4f')]=function(_0x41fff0,_0xdb9a23){var _0x4c56ad={'raw':!![],'where':{'id':_0x41fff0[_0x6563('0x50')]['id']}},_0x355c97={};_0x355c97[_0x6563('0x3a')]=_[_0x6563('0x3c')](db[_0x6563('0x36')]['rawAttributes']);_0x355c97['query']=_[_0x6563('0x3c')](_0x41fff0[_0x6563('0x3b')]);_0x355c97[_0x6563('0x3d')]=_['intersection'](_0x355c97[_0x6563('0x3a')],_0x355c97[_0x6563('0x3b')]);_0x4c56ad[_0x6563('0x41')]=_[_0x6563('0x3e')](_0x355c97['model'],qs[_0x6563('0x3f')](_0x41fff0[_0x6563('0x3b')][_0x6563('0x3f')]));_0x4c56ad['attributes']=_0x4c56ad[_0x6563('0x41')]['length']?_0x4c56ad[_0x6563('0x41')]:_0x355c97['model'];if(_0x41fff0['query'][_0x6563('0x4a')]){_0x4c56ad[_0x6563('0x4b')]=[{'all':!![]}];}_0x4c56ad=_[_0x6563('0x2d')]({},_0x4c56ad,_0x41fff0[_0x6563('0x49')]);return db[_0x6563('0x36')][_0x6563('0x51')](_0x4c56ad)[_0x6563('0x28')](handleEntityNotFound(_0xdb9a23,null))[_0x6563('0x28')](respondWithResult(_0xdb9a23,null))[_0x6563('0x4e')](handleError(_0xdb9a23,null));};exports[_0x6563('0x52')]=function(_0x4951a6,_0x9469fe){return db['ChatInternalMessage'][_0x6563('0x52')](_0x4951a6[_0x6563('0x2e')],{})[_0x6563('0x28')](respondWithResult(_0x9469fe,0xc9))['catch'](handleError(_0x9469fe,null));};exports[_0x6563('0x27')]=function(_0x141f0c,_0x4f9884){if(_0x141f0c[_0x6563('0x2e')]['id']){delete _0x141f0c[_0x6563('0x2e')]['id'];}return db[_0x6563('0x36')][_0x6563('0x51')]({'where':{'id':_0x141f0c[_0x6563('0x50')]['id']}})['then'](handleEntityNotFound(_0x4f9884,null))[_0x6563('0x28')](saveUpdates(_0x141f0c['body'],null))[_0x6563('0x28')](respondWithResult(_0x4f9884,null))['catch'](handleError(_0x4f9884,null));};exports[_0x6563('0x53')]=function(_0x5992c8,_0x55e002){return db['ChatInternalMessage']['find']({'where':{'id':_0x5992c8[_0x6563('0x50')]['id']}})['then'](handleEntityNotFound(_0x55e002,null))[_0x6563('0x28')](removeEntity(_0x55e002,null))['catch'](handleError(_0x55e002,null));};exports[_0x6563('0x54')]=function(_0x10a127,_0x426664){return db[_0x6563('0x36')][_0x6563('0x54')]()[_0x6563('0x28')](respondWithResult(_0x426664,null))[_0x6563('0x4e')](handleError(_0x426664,null));};function wrapUser(_0xdc94f8){return function(_0x31623f){var _0x5827da=_0xdc94f8[_0x6563('0x55')]({'plain':!![]});_0x5827da[_0x6563('0x56')]=[];if(_0x31623f){_0x5827da[_0x6563('0x57')]=_0x31623f[_0x6563('0x58')];_0x5827da[_0x6563('0x59')]=_0x31623f;}else{_0x5827da[_0x6563('0x57')]=moment(0x0)[_0x6563('0x5a')](_0x6563('0x5b'));_0x5827da[_0x6563('0x59')]={};}return _0x5827da;};}exports[_0x6563('0x5c')]=function(_0x1fc431,_0x5c456b,_0x1a3317){var _0x1a6adb=[];return db[_0x6563('0x5d')][_0x6563('0x4c')]({'where':{'role':[_0x6563('0x31'),_0x6563('0x5e'),_0x6563('0x5f')]},'attributes':['id',_0x6563('0x60'),'name',_0x6563('0x61'),'userpic',_0x6563('0x62'),_0x6563('0x63'),'lastLoginAt','allowmessenger',_0x6563('0x64')],'order':qs[_0x6563('0x44')](_0x6563('0x65')),'include':[{'model':db[_0x6563('0x66')],'as':'VoiceQueues','attributes':['id',_0x6563('0x2b'),'type'],'through':{'attributes':[]}}]})[_0x6563('0x28')](function(_0x29aecb){if(_0x29aecb){var _0x5b0fe8=_0x1fc431['user'][_0x6563('0x55')]({'plain':!![]});if(!_0x5b0fe8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b0fe8['role']===_0x6563('0x5f')){return db['UserProfileSection'][_0x6563('0x51')]({'where':{'name':_0x6563('0x67'),'userProfileId':_0x5b0fe8[_0x6563('0x68')]},'raw':!![]})[_0x6563('0x28')](function(_0x4829ab){if(_0x4829ab){if(_0x4829ab[_0x6563('0x69')]===0x0){return db[_0x6563('0x6a')][_0x6563('0x4c')]({'where':{'sectionId':_0x4829ab['id']},'raw':!![]})[_0x6563('0x28')](function(_0x3ffb7f){var _0x2d4694=[];if(_[_0x6563('0x6b')](_0x3ffb7f)){_0x2d4694=_[_0x6563('0x47')](_0x29aecb,function(_0x58728d){if(_0x58728d['role']!==_0x6563('0x31')){return _0x58728d;}});return _0x2d4694;}else{for(var _0x3a756a=0x0;_0x3a756a<_0x29aecb['length'];_0x3a756a++){var _0x5924a3=_0x29aecb[_0x3a756a];if(_0x5924a3['role']===_0x6563('0x31')){var _0x2c02d6=_[_0x6563('0x51')](_0x3ffb7f,function(_0x149b74){return _0x149b74['resourceId']===_0x5924a3['id'];});if(_0x2c02d6)_0x2d4694[_0x6563('0x6c')](_0x5924a3);}else{_0x2d4694[_0x6563('0x6c')](_0x5924a3);}}return _0x2d4694;}});}else{return _0x29aecb;}}else{var _0x386597=_[_0x6563('0x47')](_0x29aecb,function(_0xb55389){if(_0xb55389['role']!=='agent'){return _0xb55389;}});return _0x386597;}});}else{return _0x29aecb;}}})[_0x6563('0x28')](function(_0x1d7b5d){var _0x2426cd=[];if(_0x1d7b5d){_0x1a6adb=_0x1d7b5d;for(var _0x5d365e=0x0;_0x5d365e<_0x1d7b5d[_0x6563('0x40')];_0x5d365e+=0x1){_0x1a6adb[_0x5d365e]['messages']=[];_0x2426cd[_0x6563('0x6c')](db[_0x6563('0x36')][_0x6563('0x51')]({'where':{'FromId':[_0x1fc431[_0x6563('0x5f')]['id'],_0x1d7b5d[_0x5d365e]['id']],'ToId':[_0x1fc431[_0x6563('0x5f')]['id'],_0x1d7b5d[_0x5d365e]['id']],'ChatGroupId':null},'attributes':['id',_0x6563('0x58'),_0x6563('0x6d'),'ToId','read',_0x6563('0x2e')],'order':qs[_0x6563('0x44')](_0x6563('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6563('0x28')](wrapUser(_0x1d7b5d[_0x5d365e])));}return BPromise[_0x6563('0x6f')](_0x2426cd);}return[];})[_0x6563('0x28')](function(_0x515e98){return{'rows':_0x515e98,'count':_0x515e98['length']};})['then'](respondWithResult(_0x5c456b,null))[_0x6563('0x4e')](handleError(_0x5c456b,null));}; \ No newline at end of file +var _0x3667=['localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','merge','body','account','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','ChatInternalMessage','count','includeAll','include','findAll','rows','catch','params','length','options','find','create','update','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','userpic','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','user','userProfileId','autoAssociation','isEmpty','resourceId','push','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7366('0x0'));var rimraf=require(_0x7366('0x1'));var zipdir=require(_0x7366('0x2'));var jsonpatch=require(_0x7366('0x3'));var rp=require(_0x7366('0x4'));var moment=require('moment');var BPromise=require(_0x7366('0x5'));var Mustache=require(_0x7366('0x6'));var util=require('util');var path=require(_0x7366('0x7'));var sox=require(_0x7366('0x8'));var csv=require(_0x7366('0x9'));var ejs=require(_0x7366('0xa'));var fs=require('fs');var fs_extra=require(_0x7366('0xb'));var _=require('lodash');var squel=require(_0x7366('0xc'));var crypto=require(_0x7366('0xd'));var jsforce=require(_0x7366('0xe'));var deskjs=require(_0x7366('0xf'));var toCsv=require(_0x7366('0x9'));var querystring=require(_0x7366('0x10'));var Papa=require(_0x7366('0x11'));var Redis=require(_0x7366('0x12'));var authService=require(_0x7366('0x13'));var qs=require(_0x7366('0x14'));var as=require(_0x7366('0x15'));var hardwareService=require(_0x7366('0x16'));var logger=require(_0x7366('0x17'))(_0x7366('0x18'));var utils=require(_0x7366('0x19'));var config=require(_0x7366('0x1a'));var licenseUtil=require(_0x7366('0x1b'));var db=require(_0x7366('0x1c'))['db'];config[_0x7366('0x1d')]=_[_0x7366('0x1e')](config[_0x7366('0x1d')],{'host':_0x7366('0x1f'),'port':0x18eb});var socket=require(_0x7366('0x20'))(new Redis(config[_0x7366('0x1d')]));require(_0x7366('0x21'))[_0x7366('0x22')](socket);function respondWithStatusCode(_0x22562f,_0xf4114){_0xf4114=_0xf4114||0xcc;return function(_0x4dd111){if(_0x4dd111){return _0x22562f[_0x7366('0x23')](_0xf4114);}return _0x22562f[_0x7366('0x24')](_0xf4114)[_0x7366('0x25')]();};}function respondWithResult(_0x2c0422,_0xe2c87b){_0xe2c87b=_0xe2c87b||0xc8;return function(_0x431c01){if(_0x431c01){return _0x2c0422[_0x7366('0x24')](_0xe2c87b)[_0x7366('0x26')](_0x431c01);}};}function respondWithFilteredResult(_0x83e5d5,_0x41113f){return function(_0x1a71f5){if(_0x1a71f5){var _0x49e50b=typeof _0x41113f[_0x7366('0x27')]==='undefined'&&typeof _0x41113f[_0x7366('0x28')]===_0x7366('0x29');var _0x3f23cd=_0x1a71f5['count'];var _0x29f725=_0x49e50b?0x0:_0x41113f[_0x7366('0x27')];var _0x3cfde9=_0x49e50b?_0x1a71f5['count']:_0x41113f[_0x7366('0x27')]+_0x41113f[_0x7366('0x28')];var _0x482946;if(_0x3cfde9>=_0x3f23cd){_0x3cfde9=_0x3f23cd;_0x482946=0xc8;}else{_0x482946=0xce;}_0x83e5d5[_0x7366('0x24')](_0x482946);return _0x83e5d5[_0x7366('0x2a')](_0x7366('0x2b'),_0x29f725+'-'+_0x3cfde9+'/'+_0x3f23cd)[_0x7366('0x26')](_0x1a71f5);}return null;};}function patchUpdates(_0x3c30a2){return function(_0x1d3139){try{jsonpatch[_0x7366('0x2c')](_0x1d3139,_0x3c30a2,!![]);}catch(_0x22ed7e){return BPromise[_0x7366('0x2d')](_0x22ed7e);}return _0x1d3139[_0x7366('0x2e')]();};}function saveUpdates(_0x12aed6,_0x1dc875){return function(_0x36903f){if(_0x36903f){return _0x36903f['update'](_0x12aed6)[_0x7366('0x2f')](function(_0x4fe7cf){return _0x4fe7cf;});}return null;};}function removeEntity(_0x379146,_0x4ab987){return function(_0x5e30fb){if(_0x5e30fb){return _0x5e30fb[_0x7366('0x30')]()['then'](function(){_0x379146[_0x7366('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256633,_0x191177){return function(_0x5c37e2){if(!_0x5c37e2){_0x256633[_0x7366('0x23')](0x194);}return _0x5c37e2;};}function handleError(_0x565aa7,_0x31c642){_0x31c642=_0x31c642||0x1f4;return function(_0x2b61af){logger['error'](_0x2b61af[_0x7366('0x31')]);if(_0x2b61af['name']){delete _0x2b61af[_0x7366('0x32')];}_0x565aa7[_0x7366('0x24')](_0x31c642)[_0x7366('0x33')](_0x2b61af);};}function getMustacheRender(_0x28386f,_0x2dda4b){return Mustache['render'](_0x28386f,_[_0x7366('0x34')](_0x2dda4b[_0x7366('0x35')],{'contact':_0x2dda4b['contact'],'message':_0x2dda4b['message'],'agent':_0x2dda4b['agent'],'interaction':_0x2dda4b['interaction'],'account':_0x2dda4b[_0x7366('0x36')]}))||'';}exports[_0x7366('0x37')]=function(_0x163a29,_0x15286a){var _0x59f032={},_0x3ca5e6={},_0x2abf10={'count':0x0,'rows':[]};var _0xdaffd3=_[_0x7366('0x38')](db['ChatInternalMessage'][_0x7366('0x39')],function(_0x311dab){return{'name':_0x311dab['fieldName'],'type':_0x311dab[_0x7366('0x3a')][_0x7366('0x3b')]};});_0x3ca5e6[_0x7366('0x3c')]=_[_0x7366('0x38')](_0xdaffd3,_0x7366('0x32'));_0x3ca5e6[_0x7366('0x3d')]=_[_0x7366('0x3e')](_0x163a29[_0x7366('0x3d')]);_0x3ca5e6[_0x7366('0x3f')]=_['intersection'](_0x3ca5e6[_0x7366('0x3c')],_0x3ca5e6[_0x7366('0x3d')]);_0x59f032['attributes']=_[_0x7366('0x40')](_0x3ca5e6[_0x7366('0x3c')],qs[_0x7366('0x41')](_0x163a29['query'][_0x7366('0x41')]));_0x59f032['attributes']=_0x59f032[_0x7366('0x42')]['length']?_0x59f032['attributes']:_0x3ca5e6[_0x7366('0x3c')];if(!_0x163a29['query'][_0x7366('0x43')](_0x7366('0x44'))){_0x59f032['limit']=qs[_0x7366('0x28')](_0x163a29['query'][_0x7366('0x28')]);_0x59f032[_0x7366('0x27')]=qs[_0x7366('0x27')](_0x163a29[_0x7366('0x3d')]['offset']);}_0x59f032[_0x7366('0x45')]=qs[_0x7366('0x46')](_0x163a29[_0x7366('0x3d')]['sort']);_0x59f032[_0x7366('0x47')]=qs[_0x7366('0x3f')](_[_0x7366('0x48')](_0x163a29[_0x7366('0x3d')],_0x3ca5e6[_0x7366('0x3f')]),_0xdaffd3);if(_0x163a29[_0x7366('0x3d')][_0x7366('0x49')]){_0x59f032['where']=_['merge'](_0x59f032[_0x7366('0x47')],{'$or':_[_0x7366('0x38')](_0xdaffd3,function(_0x59cd9a){if(_0x59cd9a[_0x7366('0x3a')]!==_0x7366('0x4a')){var _0x550fe2={};_0x550fe2[_0x59cd9a[_0x7366('0x32')]]={'$like':'%'+_0x163a29['query'][_0x7366('0x49')]+'%'};return _0x550fe2;}})});}_0x59f032=_[_0x7366('0x34')]({},_0x59f032,_0x163a29['options']);var _0x5b5a95={'where':_0x59f032[_0x7366('0x47')]};return db[_0x7366('0x4b')][_0x7366('0x4c')](_0x5b5a95)[_0x7366('0x2f')](function(_0x4d3df0){_0x2abf10[_0x7366('0x4c')]=_0x4d3df0;if(_0x163a29[_0x7366('0x3d')][_0x7366('0x4d')]){_0x59f032[_0x7366('0x4e')]=[{'all':!![]}];}return db[_0x7366('0x4b')][_0x7366('0x4f')](_0x59f032);})[_0x7366('0x2f')](function(_0x593a71){_0x2abf10[_0x7366('0x50')]=_0x593a71;return _0x2abf10;})[_0x7366('0x2f')](respondWithFilteredResult(_0x15286a,_0x59f032))[_0x7366('0x51')](handleError(_0x15286a,null));};exports['show']=function(_0x85e16,_0x16861e){var _0x5c3e45={'raw':!![],'where':{'id':_0x85e16[_0x7366('0x52')]['id']}},_0x135ad2={};_0x135ad2[_0x7366('0x3c')]=_['keys'](db[_0x7366('0x4b')][_0x7366('0x39')]);_0x135ad2[_0x7366('0x3d')]=_['keys'](_0x85e16[_0x7366('0x3d')]);_0x135ad2[_0x7366('0x3f')]=_[_0x7366('0x40')](_0x135ad2['model'],_0x135ad2[_0x7366('0x3d')]);_0x5c3e45[_0x7366('0x42')]=_[_0x7366('0x40')](_0x135ad2[_0x7366('0x3c')],qs['fields'](_0x85e16[_0x7366('0x3d')][_0x7366('0x41')]));_0x5c3e45[_0x7366('0x42')]=_0x5c3e45[_0x7366('0x42')][_0x7366('0x53')]?_0x5c3e45[_0x7366('0x42')]:_0x135ad2[_0x7366('0x3c')];if(_0x85e16[_0x7366('0x3d')][_0x7366('0x4d')]){_0x5c3e45['include']=[{'all':!![]}];}_0x5c3e45=_[_0x7366('0x34')]({},_0x5c3e45,_0x85e16[_0x7366('0x54')]);return db['ChatInternalMessage'][_0x7366('0x55')](_0x5c3e45)[_0x7366('0x2f')](handleEntityNotFound(_0x16861e,null))['then'](respondWithResult(_0x16861e,null))[_0x7366('0x51')](handleError(_0x16861e,null));};exports['create']=function(_0x3a16d6,_0x24411c){return db[_0x7366('0x4b')][_0x7366('0x56')](_0x3a16d6['body'],{})[_0x7366('0x2f')](respondWithResult(_0x24411c,0xc9))[_0x7366('0x51')](handleError(_0x24411c,null));};exports[_0x7366('0x57')]=function(_0x46a532,_0x1de0a7){if(_0x46a532[_0x7366('0x35')]['id']){delete _0x46a532[_0x7366('0x35')]['id'];}return db[_0x7366('0x4b')][_0x7366('0x55')]({'where':{'id':_0x46a532[_0x7366('0x52')]['id']}})[_0x7366('0x2f')](handleEntityNotFound(_0x1de0a7,null))[_0x7366('0x2f')](saveUpdates(_0x46a532['body'],null))[_0x7366('0x2f')](respondWithResult(_0x1de0a7,null))['catch'](handleError(_0x1de0a7,null));};exports['destroy']=function(_0x1d488b,_0xf8248f){return db['ChatInternalMessage'][_0x7366('0x55')]({'where':{'id':_0x1d488b[_0x7366('0x52')]['id']}})['then'](handleEntityNotFound(_0xf8248f,null))['then'](removeEntity(_0xf8248f,null))[_0x7366('0x51')](handleError(_0xf8248f,null));};exports['describe']=function(_0x178e71,_0x3eb766){return db['ChatInternalMessage'][_0x7366('0x58')]()[_0x7366('0x2f')](respondWithResult(_0x3eb766,null))[_0x7366('0x51')](handleError(_0x3eb766,null));};function wrapUser(_0x5506e7){return function(_0x2f678a){var _0x3b1daa=_0x5506e7[_0x7366('0x59')]({'plain':!![]});_0x3b1daa[_0x7366('0x5a')]=[];if(_0x2f678a){_0x3b1daa['lastMessageAt']=_0x2f678a[_0x7366('0x5b')];_0x3b1daa[_0x7366('0x5c')]=_0x2f678a;}else{_0x3b1daa[_0x7366('0x5d')]=moment(0x0)[_0x7366('0x5e')](_0x7366('0x5f'));_0x3b1daa['lastMessage']={};}return _0x3b1daa;};}exports[_0x7366('0x60')]=function(_0x9080f4,_0x5b3160,_0x1ec71e){var _0x54c117=[];return db[_0x7366('0x61')]['findAll']({'where':{'role':[_0x7366('0x62'),_0x7366('0x63'),'user']},'attributes':['id',_0x7366('0x64'),_0x7366('0x32'),_0x7366('0x65'),_0x7366('0x66'),'internal','online',_0x7366('0x67'),'allowmessenger',_0x7366('0x68')],'order':qs[_0x7366('0x46')](_0x7366('0x69')),'include':[{'model':db[_0x7366('0x6a')],'as':_0x7366('0x6b'),'attributes':['id',_0x7366('0x32'),_0x7366('0x3a')],'through':{'attributes':[]}}]})[_0x7366('0x2f')](function(_0x2abe8d){if(_0x2abe8d){var _0x4ce411=_0x9080f4[_0x7366('0x6c')]['get']({'plain':!![]});if(!_0x4ce411)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ce411['role']===_0x7366('0x6c')){return db['UserProfileSection'][_0x7366('0x55')]({'where':{'name':'Agents','userProfileId':_0x4ce411[_0x7366('0x6d')]},'raw':!![]})['then'](function(_0x32e6d5){if(_0x32e6d5){if(_0x32e6d5[_0x7366('0x6e')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x32e6d5['id']},'raw':!![]})[_0x7366('0x2f')](function(_0x22ad58){var _0x3f7b82=[];if(_[_0x7366('0x6f')](_0x22ad58)){_0x3f7b82=_['filter'](_0x2abe8d,function(_0x349bd2){if(_0x349bd2[_0x7366('0x65')]!==_0x7366('0x62')){return _0x349bd2;}});return _0x3f7b82;}else{for(var _0x5d5f01=0x0;_0x5d5f01<_0x2abe8d['length'];_0x5d5f01++){var _0x26ab9b=_0x2abe8d[_0x5d5f01];if(_0x26ab9b[_0x7366('0x65')]===_0x7366('0x62')){var _0x4e0cae=_[_0x7366('0x55')](_0x22ad58,function(_0x1e121f){return _0x1e121f[_0x7366('0x70')]===_0x26ab9b['id'];});if(_0x4e0cae)_0x3f7b82[_0x7366('0x71')](_0x26ab9b);}else{_0x3f7b82[_0x7366('0x71')](_0x26ab9b);}}return _0x3f7b82;}});}else{return _0x2abe8d;}}else{var _0x795971=_[_0x7366('0x49')](_0x2abe8d,function(_0x38c65b){if(_0x38c65b[_0x7366('0x65')]!==_0x7366('0x62')){return _0x38c65b;}});return _0x795971;}});}else{return _0x2abe8d;}}})[_0x7366('0x2f')](function(_0x5d5c2e){var _0x15d111=[];if(_0x5d5c2e){_0x54c117=_0x5d5c2e;for(var _0x866cda=0x0;_0x866cda<_0x5d5c2e['length'];_0x866cda+=0x1){_0x54c117[_0x866cda][_0x7366('0x5a')]=[];_0x15d111['push'](db['ChatInternalMessage'][_0x7366('0x55')]({'where':{'FromId':[_0x9080f4[_0x7366('0x6c')]['id'],_0x5d5c2e[_0x866cda]['id']],'ToId':[_0x9080f4[_0x7366('0x6c')]['id'],_0x5d5c2e[_0x866cda]['id']],'ChatGroupId':null},'attributes':['id',_0x7366('0x5b'),_0x7366('0x72'),_0x7366('0x73'),'read',_0x7366('0x35')],'order':qs[_0x7366('0x46')](_0x7366('0x74')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5d5c2e[_0x866cda])));}return BPromise[_0x7366('0x75')](_0x15d111);}return[];})['then'](function(_0x495adb){return{'rows':_0x495adb,'count':_0x495adb[_0x7366('0x53')]};})['then'](respondWithResult(_0x5b3160,null))[_0x7366('0x51')](handleError(_0x5b3160,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d671077..2759f1b 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 _0x8aaa=['update','remove','emit','hasOwnProperty','events','../../mysqldb','ChatInternalMessage','save'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x8aaa,0x64));var _0xa8aa=function(_0xbf09ab,_0x251a19){_0xbf09ab=_0xbf09ab-0x0;var _0x2a9aef=_0x8aaa[_0xbf09ab];return _0x2a9aef;};'use strict';var EventEmitter=require(_0xa8aa('0x0'));var ChatInternalMessage=require(_0xa8aa('0x1'))['db'][_0xa8aa('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8aa('0x3'),'afterUpdate':_0xa8aa('0x4'),'afterDestroy':_0xa8aa('0x5')};function emitEvent(_0x2c074e){return function(_0x28fa1b,_0x3443c7,_0x1ae929){ChatInternalMessageEvents[_0xa8aa('0x6')](_0x2c074e+':'+_0x28fa1b['id'],_0x28fa1b);ChatInternalMessageEvents['emit'](_0x2c074e,_0x28fa1b);_0x1ae929(null);};}for(var e in events){if(events[_0xa8aa('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x4aa3=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0xbf1132,_0x176b34){var _0xe63ce4=function(_0x52d8ed){while(--_0x52d8ed){_0xbf1132['push'](_0xbf1132['shift']());}};_0xe63ce4(++_0x176b34);}(_0x4aa3,0x174));var _0x34aa=function(_0x4ebb0f,_0x5031cb){_0x4ebb0f=_0x4ebb0f-0x0;var _0x39a2c5=_0x4aa3[_0x4ebb0f];return _0x39a2c5;};'use strict';var EventEmitter=require(_0x34aa('0x0'));var ChatInternalMessage=require(_0x34aa('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x34aa('0x2')](0x0);var events={'afterCreate':_0x34aa('0x3'),'afterUpdate':'update','afterDestroy':_0x34aa('0x4')};function emitEvent(_0x3c70d9){return function(_0x4a81e7,_0x3f367e,_0x384e96){ChatInternalMessageEvents[_0x34aa('0x5')](_0x3c70d9+':'+_0x4a81e7['id'],_0x4a81e7);ChatInternalMessageEvents['emit'](_0x3c70d9,_0x4a81e7);_0x384e96(null);};}for(var e in events){if(events[_0x34aa('0x6')](e)){var event=events[e];ChatInternalMessage[_0x34aa('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 2d9fc7f..0e8b9b1 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 _0xa9e0=['define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xb7e7=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0x56ac35,_0x555584){var _0x1f6cad=function(_0x3c11d2){while(--_0x3c11d2){_0x56ac35['push'](_0x56ac35['shift']());}};_0x1f6cad(++_0x555584);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb7e7[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 0a281c2..b419b35 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 _0xd308=['rpc','../../config/environment','jayson/promise','http','redis','defaults','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd308,0x118));var _0x8d30=function(_0x4dcf75,_0x12dbfa){_0x4dcf75=_0x4dcf75-0x0;var _0x38ea00=_0xd308[_0x4dcf75];return _0x38ea00;};'use strict';var _=require(_0x8d30('0x0'));var util=require(_0x8d30('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d30('0x2'));var fs=require('fs');var Redis=require(_0x8d30('0x3'));var db=require(_0x8d30('0x4'))['db'];var utils=require(_0x8d30('0x5'));var logger=require('../../config/logger')(_0x8d30('0x6'));var config=require(_0x8d30('0x7'));var jayson=require(_0x8d30('0x8'));var client=jayson['client'][_0x8d30('0x9')]({'port':0x232a});config[_0x8d30('0xa')]=_[_0x8d30('0xb')](config[_0x8d30('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d30('0xa')]));require(_0x8d30('0xc'))['register'](socket);function respondWithRpcPromise(_0x48b458,_0x318fc7,_0x16eb27){return new BPromise(function(_0x314d0a,_0x2895ee){return client[_0x8d30('0xd')](_0x48b458,_0x16eb27)[_0x8d30('0xe')](function(_0x399428){logger[_0x8d30('0xf')](_0x8d30('0x10'),_0x318fc7,_0x8d30('0x11'));logger[_0x8d30('0x12')](_0x8d30('0x13'),_0x318fc7,_0x8d30('0x11'),JSON[_0x8d30('0x14')](_0x399428));if(_0x399428[_0x8d30('0x15')]){if(_0x399428['error'][_0x8d30('0x16')]===0x1f4){logger[_0x8d30('0x15')](_0x8d30('0x10'),_0x318fc7,_0x399428[_0x8d30('0x15')][_0x8d30('0x17')]);return _0x2895ee(_0x399428[_0x8d30('0x15')]['message']);}logger[_0x8d30('0x15')](_0x8d30('0x10'),_0x318fc7,_0x399428['error'][_0x8d30('0x17')]);return _0x314d0a(_0x399428[_0x8d30('0x15')][_0x8d30('0x17')]);}else{logger[_0x8d30('0xf')](_0x8d30('0x10'),_0x318fc7,_0x8d30('0x11'));_0x314d0a(_0x399428[_0x8d30('0x18')][_0x8d30('0x17')]);}})[_0x8d30('0x19')](function(_0x5f248b){logger[_0x8d30('0x15')](_0x8d30('0x10'),_0x318fc7,_0x5f248b);_0x2895ee(_0x5f248b);});});} \ No newline at end of file +var _0x6743=['stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x260ce2,_0x2e22b8){var _0x16b105=function(_0x260a06){while(--_0x260a06){_0x260ce2['push'](_0x260ce2['shift']());}};_0x16b105(++_0x2e22b8);}(_0x6743,0x19a));var _0x3674=function(_0xf7c208,_0x5cbc84){_0xf7c208=_0xf7c208-0x0;var _0x16992d=_0x6743[_0xf7c208];return _0x16992d;};'use strict';var _=require(_0x3674('0x0'));var util=require(_0x3674('0x1'));var moment=require(_0x3674('0x2'));var BPromise=require('bluebird');var rs=require(_0x3674('0x3'));var fs=require('fs');var Redis=require(_0x3674('0x4'));var db=require(_0x3674('0x5'))['db'];var utils=require(_0x3674('0x6'));var logger=require(_0x3674('0x7'))(_0x3674('0x8'));var config=require(_0x3674('0x9'));var jayson=require(_0x3674('0xa'));var client=jayson[_0x3674('0xb')][_0x3674('0xc')]({'port':0x232a});config[_0x3674('0xd')]=_[_0x3674('0xe')](config[_0x3674('0xd')],{'host':_0x3674('0xf'),'port':0x18eb});var socket=require(_0x3674('0x10'))(new Redis(config[_0x3674('0xd')]));require('./chatInternalMessage.socket')[_0x3674('0x11')](socket);function respondWithRpcPromise(_0x2e6c63,_0x5f1878,_0x384bcf){return new BPromise(function(_0x9d3c7b,_0x5862b9){return client[_0x3674('0x12')](_0x2e6c63,_0x384bcf)[_0x3674('0x13')](function(_0x416771){logger[_0x3674('0x14')](_0x3674('0x15'),_0x5f1878,_0x3674('0x16'));logger[_0x3674('0x17')](_0x3674('0x18'),_0x5f1878,_0x3674('0x16'),JSON[_0x3674('0x19')](_0x416771));if(_0x416771[_0x3674('0x1a')]){if(_0x416771['error'][_0x3674('0x1b')]===0x1f4){logger[_0x3674('0x1a')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f1878,_0x416771[_0x3674('0x1a')][_0x3674('0x1c')]);return _0x5862b9(_0x416771[_0x3674('0x1a')][_0x3674('0x1c')]);}logger['error'](_0x3674('0x15'),_0x5f1878,_0x416771[_0x3674('0x1a')][_0x3674('0x1c')]);return _0x9d3c7b(_0x416771['error'][_0x3674('0x1c')]);}else{logger['info'](_0x3674('0x15'),_0x5f1878,_0x3674('0x16'));_0x9d3c7b(_0x416771['result'][_0x3674('0x1c')]);}})['catch'](function(_0x177f04){logger[_0x3674('0x1a')](_0x3674('0x15'),_0x5f1878,_0x177f04);_0x5862b9(_0x177f04);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 9816a35..6ee7d47 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 _0xe189=['update','removeListener','register','length','./chatInternalMessage.events'];(function(_0xbd7f4c,_0xe1119c){var _0x2fa90a=function(_0x28267b){while(--_0x28267b){_0xbd7f4c['push'](_0xbd7f4c['shift']());}};_0x2fa90a(++_0xe1119c);}(_0xe189,0x194));var _0x9e18=function(_0x2e869b,_0x10d65){_0x2e869b=_0x2e869b-0x0;var _0x31cd0f=_0xe189[_0x2e869b];return _0x31cd0f;};'use strict';var ChatInternalMessageEvents=require(_0x9e18('0x0'));var events=['save','remove',_0x9e18('0x1')];function createListener(_0x2bc037,_0x22eac1){return function(_0x30a009){_0x22eac1['emit'](_0x2bc037,_0x30a009);};}function removeListener(_0x49b0f7,_0x1c652d){return function(){ChatInternalMessageEvents[_0x9e18('0x2')](_0x49b0f7,_0x1c652d);};}exports[_0x9e18('0x3')]=function(_0x53d7c9){for(var _0x3e6881=0x0,_0x5e6097=events[_0x9e18('0x4')];_0x3e6881<_0x5e6097;_0x3e6881++){var _0x2e4691=events[_0x3e6881];var _0x4656a4=createListener('chatInternalMessage:'+_0x2e4691,_0x53d7c9);ChatInternalMessageEvents['on'](_0x2e4691,_0x4656a4);}}; \ No newline at end of file +var _0x86dd=['update','emit','removeListener','register','save'];(function(_0x34412f,_0x116bea){var _0x4b4b5a=function(_0x56fc5b){while(--_0x56fc5b){_0x34412f['push'](_0x34412f['shift']());}};_0x4b4b5a(++_0x116bea);}(_0x86dd,0x1ee));var _0xd86d=function(_0x556ffd,_0x2f6c54){_0x556ffd=_0x556ffd-0x0;var _0x45d593=_0x86dd[_0x556ffd];return _0x45d593;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xd86d('0x0'),'remove',_0xd86d('0x1')];function createListener(_0x2cb4b4,_0x287d1d){return function(_0x217373){_0x287d1d[_0xd86d('0x2')](_0x2cb4b4,_0x217373);};}function removeListener(_0x30a31c,_0x2e82a9){return function(){ChatInternalMessageEvents[_0xd86d('0x3')](_0x30a31c,_0x2e82a9);};}exports[_0xd86d('0x4')]=function(_0x1d5ffc){for(var _0x3b13f9=0x0,_0x4274f8=events['length'];_0x3b13f9<_0x4274f8;_0x3b13f9++){var _0x341335=events[_0x3b13f9];var _0xfcba94=createListener('chatInternalMessage:'+_0x341335,_0x1d5ffc);ChatInternalMessageEvents['on'](_0x341335,_0xfcba94);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 877df3a..3f2ebb4 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 _0x54ba=['isAuthenticated','/describe','describe','/users','getUsers','/:id','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x13d77c,_0x2e59c5){var _0x2d6df2=function(_0x3f0b7e){while(--_0x3f0b7e){_0x13d77c['push'](_0x13d77c['shift']());}};_0x2d6df2(++_0x2e59c5);}(_0x54ba,0x170));var _0xa54b=function(_0x509db5,_0x1db2f6){_0x509db5=_0x509db5-0x0;var _0x4f7431=_0x54ba[_0x509db5];return _0x4f7431;};'use strict';var multer=require(_0xa54b('0x0'));var util=require(_0xa54b('0x1'));var path=require(_0xa54b('0x2'));var timeout=require(_0xa54b('0x3'));var express=require(_0xa54b('0x4'));var router=express[_0xa54b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa54b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa54b('0x7'));var controller=require(_0xa54b('0x8'));router[_0xa54b('0x9')]('/',auth[_0xa54b('0xa')](),controller['index']);router['get'](_0xa54b('0xb'),auth[_0xa54b('0xa')](),controller[_0xa54b('0xc')]);router[_0xa54b('0x9')](_0xa54b('0xd'),auth[_0xa54b('0xa')](),controller[_0xa54b('0xe')]);router[_0xa54b('0x9')](_0xa54b('0xf'),auth[_0xa54b('0xa')](),controller['show']);router[_0xa54b('0x10')]('/',auth[_0xa54b('0xa')](),controller['create']);router[_0xa54b('0x11')](_0xa54b('0xf'),controller[_0xa54b('0x12')]);router['delete'](_0xa54b('0xf'),auth['isAuthenticated'](),controller[_0xa54b('0x13')]);module[_0xa54b('0x14')]=router; \ No newline at end of file +var _0x6b21=['get','/describe','describe','isAuthenticated','getUsers','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x597fcd,_0x4ccbe7){var _0x497a5a=function(_0x5d5564){while(--_0x5d5564){_0x597fcd['push'](_0x597fcd['shift']());}};_0x497a5a(++_0x4ccbe7);}(_0x6b21,0x75));var _0x16b2=function(_0x717d7f,_0x464dda){_0x717d7f=_0x717d7f-0x0;var _0x3277c2=_0x6b21[_0x717d7f];return _0x3277c2;};'use strict';var multer=require(_0x16b2('0x0'));var util=require(_0x16b2('0x1'));var path=require(_0x16b2('0x2'));var timeout=require(_0x16b2('0x3'));var express=require('express');var router=express[_0x16b2('0x4')]();var fs_extra=require(_0x16b2('0x5'));var auth=require(_0x16b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x16b2('0x7'));var controller=require(_0x16b2('0x8'));router[_0x16b2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x16b2('0xa'),auth['isAuthenticated'](),controller[_0x16b2('0xb')]);router['get']('/users',auth[_0x16b2('0xc')](),controller[_0x16b2('0xd')]);router[_0x16b2('0x9')](_0x16b2('0xe'),auth[_0x16b2('0xc')](),controller[_0x16b2('0xf')]);router[_0x16b2('0x10')]('/',auth[_0x16b2('0xc')](),controller['create']);router[_0x16b2('0x11')](_0x16b2('0xe'),controller[_0x16b2('0x12')]);router[_0x16b2('0x13')](_0x16b2('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x16b2('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1c8342b..97fc222 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 _0xe01f=['medium','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x3ff685,_0x304b9e){var _0x2046c9=function(_0x7a10e9){while(--_0x7a10e9){_0x3ff685['push'](_0x3ff685['shift']());}};_0x2046c9(++_0x304b9e);}(_0xe01f,0x1d9));var _0xfe01=function(_0x4bd838,_0x5b87d9){_0x4bd838=_0x4bd838-0x0;var _0x50ba73=_0xe01f[_0x4bd838];return _0x50ba73;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xfe01('0x0')](_0xfe01('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xfe01('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfe01('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfe01('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xfe01('0x4')]},'providerName':{'type':Sequelize[_0xfe01('0x5')]},'providerResponse':{'type':Sequelize[_0xfe01('0x0')]}}; \ No newline at end of file +var _0x86c5=['exports','TEXT','BOOLEAN','out','DATE','sequelize'];(function(_0x3a91f9,_0x22b14e){var _0x2e0ac2=function(_0x22a25d){while(--_0x22a25d){_0x3a91f9['push'](_0x3a91f9['shift']());}};_0x2e0ac2(++_0x22b14e);}(_0x86c5,0xe3));var _0x586c=function(_0x35036f,_0x59da0a){_0x35036f=_0x35036f-0x0;var _0x55a141=_0x86c5[_0x35036f];return _0x55a141;};'use strict';var Sequelize=require(_0x586c('0x0'));module[_0x586c('0x1')]={'body':{'type':Sequelize[_0x586c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x586c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x586c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x586c('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x586c('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index df37ee1..7202f3e 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=['query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','../../config/logger','chat-interactions','accept','chat','read','readAt','format','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','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','render','merge','body','agent','interaction','index','ChatMessage','rawAttributes','fieldName','model','map'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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);};}function getMustacheRender(_0x5640eb,_0x24936a){return Mustache[_0x0a9e('0x3a')](_0x5640eb,_[_0x0a9e('0x3b')](_0x24936a[_0x0a9e('0x3c')],{'contact':_0x24936a['contact'],'message':_0x24936a[_0x0a9e('0x26')],'agent':_0x24936a[_0x0a9e('0x3d')],'interaction':_0x24936a[_0x0a9e('0x3e')],'account':_0x24936a['account']}))||'';}exports[_0x0a9e('0x3f')]=function(_0x1a180b,_0x289467){var _0x4c1c0e={},_0x546ef8={},_0x11b61d={'count':0x0,'rows':[]};var _0x40d766=_['map'](db[_0x0a9e('0x40')][_0x0a9e('0x41')],function(_0x2e1b3a){return{'name':_0x2e1b3a[_0x0a9e('0x42')],'type':_0x2e1b3a['type']['key']};});_0x546ef8[_0x0a9e('0x43')]=_[_0x0a9e('0x44')](_0x40d766,'name');_0x546ef8[_0x0a9e('0x45')]=_[_0x0a9e('0x46')](_0x1a180b[_0x0a9e('0x45')]);_0x546ef8['filters']=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],_0x546ef8[_0x0a9e('0x45')]);_0x4c1c0e[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],qs[_0x0a9e('0x49')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x49')]));_0x4c1c0e[_0x0a9e('0x48')]=_0x4c1c0e[_0x0a9e('0x48')][_0x0a9e('0x4a')]?_0x4c1c0e[_0x0a9e('0x48')]:_0x546ef8[_0x0a9e('0x43')];if(!_0x1a180b[_0x0a9e('0x45')]['hasOwnProperty']('nolimit')){_0x4c1c0e[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x30')]);_0x4c1c0e[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x2d')]);}_0x4c1c0e[_0x0a9e('0x4b')]=qs[_0x0a9e('0x4c')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4c')]);_0x4c1c0e['where']=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x1a180b[_0x0a9e('0x45')],_0x546ef8[_0x0a9e('0x4d')]),_0x40d766);if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]){_0x4c1c0e[_0x0a9e('0x50')]=_[_0x0a9e('0x3b')](_0x4c1c0e['where'],{'$or':_[_0x0a9e('0x44')](_0x40d766,function(_0x48fd45){if(_0x48fd45[_0x0a9e('0x51')]!==_0x0a9e('0x52')){var _0x8d6dd1={};_0x8d6dd1[_0x48fd45['name']]={'$like':'%'+_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]+'%'};return _0x8d6dd1;}})});}_0x4c1c0e=_[_0x0a9e('0x3b')]({},_0x4c1c0e,_0x1a180b[_0x0a9e('0x53')]);var _0x45c845={'where':_0x4c1c0e[_0x0a9e('0x50')]};return db[_0x0a9e('0x40')]['count'](_0x45c845)[_0x0a9e('0x1d')](function(_0x1bde3c){_0x11b61d[_0x0a9e('0x2f')]=_0x1bde3c;if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x54')]){_0x4c1c0e[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x40')][_0x0a9e('0x56')](_0x4c1c0e);})[_0x0a9e('0x1d')](function(_0x58a5c2){_0x11b61d[_0x0a9e('0x57')]=_0x58a5c2;return _0x11b61d;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x289467,_0x4c1c0e))['catch'](handleError(_0x289467,null));};exports['show']=function(_0x5ddf84,_0x1adfee){var _0x4317e3={'raw':!![],'where':{'id':_0x5ddf84[_0x0a9e('0x58')]['id']}},_0x37edaa={};_0x37edaa[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](db[_0x0a9e('0x40')][_0x0a9e('0x41')]);_0x37edaa['query']=_['keys'](_0x5ddf84['query']);_0x37edaa[_0x0a9e('0x4d')]=_[_0x0a9e('0x47')](_0x37edaa[_0x0a9e('0x43')],_0x37edaa['query']);_0x4317e3[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x37edaa['model'],qs['fields'](_0x5ddf84[_0x0a9e('0x45')]['fields']));_0x4317e3[_0x0a9e('0x48')]=_0x4317e3['attributes'][_0x0a9e('0x4a')]?_0x4317e3[_0x0a9e('0x48')]:_0x37edaa[_0x0a9e('0x43')];if(_0x5ddf84['query'][_0x0a9e('0x54')]){_0x4317e3[_0x0a9e('0x55')]=[{'all':!![]}];}_0x4317e3=_['merge']({},_0x4317e3,_0x5ddf84['options']);return db[_0x0a9e('0x40')][_0x0a9e('0x59')](_0x4317e3)['then'](handleEntityNotFound(_0x1adfee,null))[_0x0a9e('0x1d')](respondWithResult(_0x1adfee,null))['catch'](handleError(_0x1adfee,null));};exports[_0x0a9e('0x5a')]=function(_0x523cd2,_0xe22ccc){return db['ChatMessage']['create'](_0x523cd2['body'],{})[_0x0a9e('0x1d')](respondWithResult(_0xe22ccc,0xc9))['catch'](handleError(_0xe22ccc,null));};exports[_0x0a9e('0x35')]=function(_0x65432,_0x3cfd00){if(_0x65432[_0x0a9e('0x3c')]['id']){delete _0x65432[_0x0a9e('0x3c')]['id'];}return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x65432[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x3cfd00,null))[_0x0a9e('0x1d')](saveUpdates(_0x65432[_0x0a9e('0x3c')],null))[_0x0a9e('0x1d')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x28')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x36')]=function(_0x156662,_0x5d86e9){return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x156662['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x5d86e9,null))['then'](removeEntity(_0x5d86e9,null))[_0x0a9e('0x28')](handleError(_0x5d86e9,null));};exports['describe']=function(_0x4b3c1a,_0x5674ee){return db[_0x0a9e('0x40')]['describe']()[_0x0a9e('0x1d')](respondWithResult(_0x5674ee,null))[_0x0a9e('0x28')](handleError(_0x5674ee,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x5d')]=function(_0x26d7db,_0x49eed0,_0x1627a7){var _0x5854cc={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x26d7db[_0x0a9e('0x3c')]['id']){delete _0x26d7db[_0x0a9e('0x3c')]['id'];}_0x26d7db['body'][_0x0a9e('0x5f')]=!![];_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x60')]=moment()[_0x0a9e('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x26d7db['body'][_0x0a9e('0x62')]||_0x26d7db[_0x0a9e('0x63')]['id'];_0x5854cc[_0x0a9e('0x3d')]['id']=_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db['ChatMessage'][_0x0a9e('0x59')]({'where':{'id':_0x26d7db[_0x0a9e('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x64')],'as':'Contact'}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))['then'](saveUpdates(_0x26d7db['body'],null))[_0x0a9e('0x1d')](function(_0x4556c5){if(_0x4556c5){_0x5854cc[_0x0a9e('0x26')]=_0x4556c5[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x4556c5[_0x0a9e('0x67')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))[_0x0a9e('0x1d')](function(_0x1cc4f3){if(_0x1cc4f3){return _0x1cc4f3[_0x0a9e('0x35')]({'UserId':_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')],'read1stAt':_[_0x0a9e('0x68')](_0x1cc4f3[_0x0a9e('0x69')])?moment()[_0x0a9e('0x61')](_0x0a9e('0x6a')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x5150a4){if(_0x5150a4){_0x5854cc[_0x0a9e('0x3e')]=_0x5150a4[_0x0a9e('0x65')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26d7db[_0x0a9e('0x63')]['id'],_0x26d7db[_0x0a9e('0x63')]['name'],_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x5854cc[_0x0a9e('0x3e')]['id'],_0x26d7db[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x26d7db['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x0a9e('0x6c'),_0x5854cc);}return null;})[_0x0a9e('0x1d')](function(_0x1104ad){if(_0x1104ad){if(_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x6d')]){_0x5854cc[_0x0a9e('0x26')][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x38')]);_0x5854cc[_0x0a9e('0x26')]['channel']=_0x5854cc[_0x0a9e('0x6f')];_0x5854cc['message'][_0x0a9e('0x70')]=_0x0a9e('0x5d');return respondWithRpcPromise('EventManager',_0x0a9e('0x71'),{'event':_0x0a9e('0x72'),'message':_[_0x0a9e('0x3b')](_0x5854cc[_0x0a9e('0x26')],JSON['parse'](_0x5854cc[_0x0a9e('0x3e')][_0x0a9e('0x73')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x5854cc;});}return _0x5854cc;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x49eed0,null))['catch'](handleError(_0x49eed0,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x33')]=function(_0x361b21,_0x4abc8f,_0x290d43){var _0x3511c9={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x361b21[_0x0a9e('0x3c')]['id']){delete _0x361b21[_0x0a9e('0x3c')]['id'];}_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]||_0x361b21[_0x0a9e('0x63')]['id'];_0x3511c9[_0x0a9e('0x3d')]['id']=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db[_0x0a9e('0x40')]['find']({'where':{'id':_0x361b21[_0x0a9e('0x58')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x563627){if(_0x563627){_0x3511c9[_0x0a9e('0x26')]=_0x563627[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x563627['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x2bbdb5){if(_0x2bbdb5){_0x3511c9['interaction']=_0x2bbdb5[_0x0a9e('0x65')]({'plain':!![]});interaction_log['info'](_0x0a9e('0x74'),_0x361b21[_0x0a9e('0x63')]['id'],_0x361b21['user'][_0x0a9e('0x38')],_0x361b21[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x3511c9[_0x0a9e('0x3e')]['id'],_0x361b21[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x361b21[_0x0a9e('0x3c')]):'null');return respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x76'),_0x3511c9);}return null;})[_0x0a9e('0x1d')](function(_0x16e5b9){if(_0x16e5b9){_0x16e5b9['message'][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x361b21[_0x0a9e('0x63')]['name']);_0x16e5b9[_0x0a9e('0x26')][_0x0a9e('0x6f')]=_0x3511c9[_0x0a9e('0x6f')];_0x16e5b9[_0x0a9e('0x26')]['event']='reject';respondWithRpcPromise(_0x0a9e('0x71'),_0x0a9e('0x71'),{'event':_0x0a9e('0x77'),'message':_0x16e5b9['message']},client9002);return _0x3511c9;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4abc8f,null))[_0x0a9e('0x28')](handleError(_0x4abc8f,null));}; \ No newline at end of file +var _0xa9e0=['query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','../../config/logger','chat-interactions','accept','chat','read','readAt','format','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','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','render','merge','body','agent','interaction','index','ChatMessage','rawAttributes','fieldName','model','map'];(function(_0x1324ec,_0x3c781b){var _0x2c76e1=function(_0x2edac6){while(--_0x2edac6){_0x1324ec['push'](_0x1324ec['shift']());}};_0x2c76e1(++_0x3c781b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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);};}function getMustacheRender(_0x5640eb,_0x24936a){return Mustache[_0x0a9e('0x3a')](_0x5640eb,_[_0x0a9e('0x3b')](_0x24936a[_0x0a9e('0x3c')],{'contact':_0x24936a['contact'],'message':_0x24936a[_0x0a9e('0x26')],'agent':_0x24936a[_0x0a9e('0x3d')],'interaction':_0x24936a[_0x0a9e('0x3e')],'account':_0x24936a['account']}))||'';}exports[_0x0a9e('0x3f')]=function(_0x1a180b,_0x289467){var _0x4c1c0e={},_0x546ef8={},_0x11b61d={'count':0x0,'rows':[]};var _0x40d766=_['map'](db[_0x0a9e('0x40')][_0x0a9e('0x41')],function(_0x2e1b3a){return{'name':_0x2e1b3a[_0x0a9e('0x42')],'type':_0x2e1b3a['type']['key']};});_0x546ef8[_0x0a9e('0x43')]=_[_0x0a9e('0x44')](_0x40d766,'name');_0x546ef8[_0x0a9e('0x45')]=_[_0x0a9e('0x46')](_0x1a180b[_0x0a9e('0x45')]);_0x546ef8['filters']=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],_0x546ef8[_0x0a9e('0x45')]);_0x4c1c0e[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],qs[_0x0a9e('0x49')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x49')]));_0x4c1c0e[_0x0a9e('0x48')]=_0x4c1c0e[_0x0a9e('0x48')][_0x0a9e('0x4a')]?_0x4c1c0e[_0x0a9e('0x48')]:_0x546ef8[_0x0a9e('0x43')];if(!_0x1a180b[_0x0a9e('0x45')]['hasOwnProperty']('nolimit')){_0x4c1c0e[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x30')]);_0x4c1c0e[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x2d')]);}_0x4c1c0e[_0x0a9e('0x4b')]=qs[_0x0a9e('0x4c')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4c')]);_0x4c1c0e['where']=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x1a180b[_0x0a9e('0x45')],_0x546ef8[_0x0a9e('0x4d')]),_0x40d766);if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]){_0x4c1c0e[_0x0a9e('0x50')]=_[_0x0a9e('0x3b')](_0x4c1c0e['where'],{'$or':_[_0x0a9e('0x44')](_0x40d766,function(_0x48fd45){if(_0x48fd45[_0x0a9e('0x51')]!==_0x0a9e('0x52')){var _0x8d6dd1={};_0x8d6dd1[_0x48fd45['name']]={'$like':'%'+_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]+'%'};return _0x8d6dd1;}})});}_0x4c1c0e=_[_0x0a9e('0x3b')]({},_0x4c1c0e,_0x1a180b[_0x0a9e('0x53')]);var _0x45c845={'where':_0x4c1c0e[_0x0a9e('0x50')]};return db[_0x0a9e('0x40')]['count'](_0x45c845)[_0x0a9e('0x1d')](function(_0x1bde3c){_0x11b61d[_0x0a9e('0x2f')]=_0x1bde3c;if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x54')]){_0x4c1c0e[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x40')][_0x0a9e('0x56')](_0x4c1c0e);})[_0x0a9e('0x1d')](function(_0x58a5c2){_0x11b61d[_0x0a9e('0x57')]=_0x58a5c2;return _0x11b61d;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x289467,_0x4c1c0e))['catch'](handleError(_0x289467,null));};exports['show']=function(_0x5ddf84,_0x1adfee){var _0x4317e3={'raw':!![],'where':{'id':_0x5ddf84[_0x0a9e('0x58')]['id']}},_0x37edaa={};_0x37edaa[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](db[_0x0a9e('0x40')][_0x0a9e('0x41')]);_0x37edaa['query']=_['keys'](_0x5ddf84['query']);_0x37edaa[_0x0a9e('0x4d')]=_[_0x0a9e('0x47')](_0x37edaa[_0x0a9e('0x43')],_0x37edaa['query']);_0x4317e3[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x37edaa['model'],qs['fields'](_0x5ddf84[_0x0a9e('0x45')]['fields']));_0x4317e3[_0x0a9e('0x48')]=_0x4317e3['attributes'][_0x0a9e('0x4a')]?_0x4317e3[_0x0a9e('0x48')]:_0x37edaa[_0x0a9e('0x43')];if(_0x5ddf84['query'][_0x0a9e('0x54')]){_0x4317e3[_0x0a9e('0x55')]=[{'all':!![]}];}_0x4317e3=_['merge']({},_0x4317e3,_0x5ddf84['options']);return db[_0x0a9e('0x40')][_0x0a9e('0x59')](_0x4317e3)['then'](handleEntityNotFound(_0x1adfee,null))[_0x0a9e('0x1d')](respondWithResult(_0x1adfee,null))['catch'](handleError(_0x1adfee,null));};exports[_0x0a9e('0x5a')]=function(_0x523cd2,_0xe22ccc){return db['ChatMessage']['create'](_0x523cd2['body'],{})[_0x0a9e('0x1d')](respondWithResult(_0xe22ccc,0xc9))['catch'](handleError(_0xe22ccc,null));};exports[_0x0a9e('0x35')]=function(_0x65432,_0x3cfd00){if(_0x65432[_0x0a9e('0x3c')]['id']){delete _0x65432[_0x0a9e('0x3c')]['id'];}return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x65432[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x3cfd00,null))[_0x0a9e('0x1d')](saveUpdates(_0x65432[_0x0a9e('0x3c')],null))[_0x0a9e('0x1d')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x28')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x36')]=function(_0x156662,_0x5d86e9){return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x156662['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x5d86e9,null))['then'](removeEntity(_0x5d86e9,null))[_0x0a9e('0x28')](handleError(_0x5d86e9,null));};exports['describe']=function(_0x4b3c1a,_0x5674ee){return db[_0x0a9e('0x40')]['describe']()[_0x0a9e('0x1d')](respondWithResult(_0x5674ee,null))[_0x0a9e('0x28')](handleError(_0x5674ee,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x5d')]=function(_0x26d7db,_0x49eed0,_0x1627a7){var _0x5854cc={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x26d7db[_0x0a9e('0x3c')]['id']){delete _0x26d7db[_0x0a9e('0x3c')]['id'];}_0x26d7db['body'][_0x0a9e('0x5f')]=!![];_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x60')]=moment()[_0x0a9e('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x26d7db['body'][_0x0a9e('0x62')]||_0x26d7db[_0x0a9e('0x63')]['id'];_0x5854cc[_0x0a9e('0x3d')]['id']=_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db['ChatMessage'][_0x0a9e('0x59')]({'where':{'id':_0x26d7db[_0x0a9e('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x64')],'as':'Contact'}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))['then'](saveUpdates(_0x26d7db['body'],null))[_0x0a9e('0x1d')](function(_0x4556c5){if(_0x4556c5){_0x5854cc[_0x0a9e('0x26')]=_0x4556c5[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x4556c5[_0x0a9e('0x67')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))[_0x0a9e('0x1d')](function(_0x1cc4f3){if(_0x1cc4f3){return _0x1cc4f3[_0x0a9e('0x35')]({'UserId':_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')],'read1stAt':_[_0x0a9e('0x68')](_0x1cc4f3[_0x0a9e('0x69')])?moment()[_0x0a9e('0x61')](_0x0a9e('0x6a')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x5150a4){if(_0x5150a4){_0x5854cc[_0x0a9e('0x3e')]=_0x5150a4[_0x0a9e('0x65')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26d7db[_0x0a9e('0x63')]['id'],_0x26d7db[_0x0a9e('0x63')]['name'],_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x5854cc[_0x0a9e('0x3e')]['id'],_0x26d7db[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x26d7db['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x0a9e('0x6c'),_0x5854cc);}return null;})[_0x0a9e('0x1d')](function(_0x1104ad){if(_0x1104ad){if(_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x6d')]){_0x5854cc[_0x0a9e('0x26')][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x38')]);_0x5854cc[_0x0a9e('0x26')]['channel']=_0x5854cc[_0x0a9e('0x6f')];_0x5854cc['message'][_0x0a9e('0x70')]=_0x0a9e('0x5d');return respondWithRpcPromise('EventManager',_0x0a9e('0x71'),{'event':_0x0a9e('0x72'),'message':_[_0x0a9e('0x3b')](_0x5854cc[_0x0a9e('0x26')],JSON['parse'](_0x5854cc[_0x0a9e('0x3e')][_0x0a9e('0x73')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x5854cc;});}return _0x5854cc;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x49eed0,null))['catch'](handleError(_0x49eed0,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x33')]=function(_0x361b21,_0x4abc8f,_0x290d43){var _0x3511c9={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x361b21[_0x0a9e('0x3c')]['id']){delete _0x361b21[_0x0a9e('0x3c')]['id'];}_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]||_0x361b21[_0x0a9e('0x63')]['id'];_0x3511c9[_0x0a9e('0x3d')]['id']=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db[_0x0a9e('0x40')]['find']({'where':{'id':_0x361b21[_0x0a9e('0x58')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x563627){if(_0x563627){_0x3511c9[_0x0a9e('0x26')]=_0x563627[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x563627['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x2bbdb5){if(_0x2bbdb5){_0x3511c9['interaction']=_0x2bbdb5[_0x0a9e('0x65')]({'plain':!![]});interaction_log['info'](_0x0a9e('0x74'),_0x361b21[_0x0a9e('0x63')]['id'],_0x361b21['user'][_0x0a9e('0x38')],_0x361b21[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x3511c9[_0x0a9e('0x3e')]['id'],_0x361b21[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x361b21[_0x0a9e('0x3c')]):'null');return respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x76'),_0x3511c9);}return null;})[_0x0a9e('0x1d')](function(_0x16e5b9){if(_0x16e5b9){_0x16e5b9['message'][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x361b21[_0x0a9e('0x63')]['name']);_0x16e5b9[_0x0a9e('0x26')][_0x0a9e('0x6f')]=_0x3511c9[_0x0a9e('0x6f')];_0x16e5b9[_0x0a9e('0x26')]['event']='reject';respondWithRpcPromise(_0x0a9e('0x71'),_0x0a9e('0x71'),{'event':_0x0a9e('0x77'),'message':_0x16e5b9['message']},client9002);return _0x3511c9;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4abc8f,null))[_0x0a9e('0x28')](handleError(_0x4abc8f,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index f7c21f3..8742747 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 _0x428a=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x414344,_0x4e1ecb){var _0x19654d=function(_0x5955de){while(--_0x5955de){_0x414344['push'](_0x414344['shift']());}};_0x19654d(++_0x4e1ecb);}(_0x428a,0xcc));var _0xa428=function(_0x5ba07c,_0x1f598c){_0x5ba07c=_0x5ba07c-0x0;var _0x111c38=_0x428a[_0x5ba07c];return _0x111c38;};'use strict';var EventEmitter=require(_0xa428('0x0'));var ChatMessage=require(_0xa428('0x1'))['db'][_0xa428('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa428('0x3'),'afterUpdate':_0xa428('0x4'),'afterDestroy':'remove'};function emitEvent(_0xdaee2){return function(_0x3e74c6,_0x5a0f32,_0x5a5702){ChatMessageEvents[_0xa428('0x5')](_0xdaee2+':'+_0x3e74c6['id'],_0x3e74c6);ChatMessageEvents['emit'](_0xdaee2,_0x3e74c6);_0x5a5702(null);};}for(var e in events){if(events[_0xa428('0x6')](e)){var event=events[e];ChatMessage[_0xa428('0x7')](e,emitEvent(event));}}module[_0xa428('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xf0ca=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x24318e,_0x6773ba){var _0x267948=function(_0x1c34be){while(--_0x1c34be){_0x24318e['push'](_0x24318e['shift']());}};_0x267948(++_0x6773ba);}(_0xf0ca,0x9d));var _0xaf0c=function(_0xfbe06e,_0x2fb7ab){_0xfbe06e=_0xfbe06e-0x0;var _0x24e5b6=_0xf0ca[_0xfbe06e];return _0x24e5b6;};'use strict';var EventEmitter=require(_0xaf0c('0x0'));var ChatMessage=require(_0xaf0c('0x1'))['db'][_0xaf0c('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xaf0c('0x3')};function emitEvent(_0xf20402){return function(_0x50c5fd,_0x13e122,_0x36ccc4){ChatMessageEvents['emit'](_0xf20402+':'+_0x50c5fd['id'],_0x50c5fd);ChatMessageEvents[_0xaf0c('0x4')](_0xf20402,_0x50c5fd);_0x36ccc4(null);};}for(var e in events){if(events[_0xaf0c('0x5')](e)){var event=events[e];ChatMessage[_0xaf0c('0x6')](e,emitEvent(event));}}module[_0xaf0c('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index bfb13c0..4887754 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 _0xdded=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','catch'];(function(_0x5c22ec,_0x3e5608){var _0x57727b=function(_0x980b74){while(--_0x980b74){_0x5c22ec['push'](_0x5c22ec['shift']());}};_0x57727b(++_0x3e5608);}(_0xdded,0x17a));var _0xddde=function(_0x5dd6d6,_0x438e51){_0x5dd6d6=_0x5dd6d6-0x0;var _0x358982=_0xdded[_0x5dd6d6];return _0x358982;};'use strict';var _=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var logger=require(_0xddde('0x2'))(_0xddde('0x3'));var moment=require(_0xddde('0x4'));var BPromise=require(_0xddde('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddde('0x6'));var rimraf=require(_0xddde('0x7'));var config=require(_0xddde('0x8'));var attributes=require(_0xddde('0x9'));module[_0xddde('0xa')]=function(_0x39fd85,_0x3c3021){return _0x39fd85[_0xddde('0xb')](_0xddde('0xc'),attributes,{'tableName':_0xddde('0xd'),'paranoid':![],'indexes':[{'name':_0xddde('0xe'),'fields':['body'],'type':_0xddde('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f0f3c,_0x48dd55,_0x4820a5){var _0x438f74=_0x39fd85['models'];var _0x247097=_0x4f0f3c['get']({'plain':!![]});if(_0x247097[_0xddde('0x10')][_0xddde('0x11')]()==='in'||_0x247097[_0xddde('0x10')][_0xddde('0x11')]()===_0xddde('0x12')&&!_0x247097[_0xddde('0x13')]&&!_[_0xddde('0x14')](_0x247097[_0xddde('0x15')])){_0x438f74['ChatInteraction'][_0xddde('0x16')]({'where':{'id':_0x247097[_0xddde('0x17')]}})[_0xddde('0x18')](function(_0x860ff4){if(_0x860ff4){_0x860ff4[_0xddde('0x19')]({'lastMsgAt':_0x247097[_0xddde('0x1a')],'lastMsgDirection':_0x247097['direction'][_0xddde('0x11')]()});}})[_0xddde('0x1b')](function(_0x3698d4){console['error'](_0x3698d4);});}_0x4820a5();}},'charset':'utf8mb4','collate':_0xddde('0x1c')});}; \ No newline at end of file +var _0x42b0=['get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','bluebird','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','FULLTEXT','models'];(function(_0x1753e0,_0x32ccd4){var _0xc9f908=function(_0x342122){while(--_0x342122){_0x1753e0['push'](_0x1753e0['shift']());}};_0xc9f908(++_0x32ccd4);}(_0x42b0,0xbc));var _0x042b=function(_0x52e64,_0x6ba4e8){_0x52e64=_0x52e64-0x0;var _0x282b80=_0x42b0[_0x52e64];return _0x282b80;};'use strict';var _=require(_0x042b('0x0'));var util=require(_0x042b('0x1'));var logger=require('../../config/logger')(_0x042b('0x2'));var moment=require('moment');var BPromise=require(_0x042b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x042b('0x4'));var config=require(_0x042b('0x5'));var attributes=require(_0x042b('0x6'));module[_0x042b('0x7')]=function(_0x135bc1,_0x5d194a){return _0x135bc1['define'](_0x042b('0x8'),attributes,{'tableName':_0x042b('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x042b('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x54a585,_0x8fd46a,_0x5686b7){var _0x3f01e1=_0x135bc1[_0x042b('0xb')];var _0x1d2796=_0x54a585[_0x042b('0xc')]({'plain':!![]});if(_0x1d2796[_0x042b('0xd')][_0x042b('0xe')]()==='in'||_0x1d2796[_0x042b('0xd')][_0x042b('0xe')]()===_0x042b('0xf')&&!_0x1d2796[_0x042b('0x10')]&&!_[_0x042b('0x11')](_0x1d2796[_0x042b('0x12')])){_0x3f01e1[_0x042b('0x13')]['findOne']({'where':{'id':_0x1d2796[_0x042b('0x14')]}})['then'](function(_0x1e5626){if(_0x1e5626){_0x1e5626['update']({'lastMsgAt':_0x1d2796[_0x042b('0x15')],'lastMsgDirection':_0x1d2796[_0x042b('0xd')][_0x042b('0xe')]()});}})[_0x042b('0x16')](function(_0x30c86f){console[_0x042b('0x17')](_0x30c86f);});}_0x5686b7();}},'charset':'utf8mb4','collate':_0x042b('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4726d78..8506b41 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 _0x593e=['request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register'];(function(_0x368aa8,_0x266626){var _0x34d435=function(_0x25e2b8){while(--_0x25e2b8){_0x368aa8['push'](_0x368aa8['shift']());}};_0x34d435(++_0x266626);}(_0x593e,0x1b1));var _0xe593=function(_0x5649ef,_0x3745d5){_0x5649ef=_0x5649ef-0x0;var _0x97109=_0x593e[_0x5649ef];return _0x97109;};'use strict';var _=require(_0xe593('0x0'));var util=require('util');var moment=require(_0xe593('0x1'));var BPromise=require(_0xe593('0x2'));var rs=require(_0xe593('0x3'));var fs=require('fs');var Redis=require(_0xe593('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe593('0x5'));var logger=require('../../config/logger')(_0xe593('0x6'));var config=require(_0xe593('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe593('0x8')][_0xe593('0x9')]({'port':0x232a});config[_0xe593('0xa')]=_['defaults'](config['redis'],{'host':_0xe593('0xb'),'port':0x18eb});var socket=require(_0xe593('0xc'))(new Redis(config[_0xe593('0xa')]));require(_0xe593('0xd'))[_0xe593('0xe')](socket);function respondWithRpcPromise(_0x35a138,_0x4d4920,_0x3b563a){return new BPromise(function(_0xdbe051,_0x51f4fc){return client[_0xe593('0xf')](_0x35a138,_0x3b563a)[_0xe593('0x10')](function(_0x2667ff){logger[_0xe593('0x11')]('ChatMessage,\x20%s,\x20%s',_0x4d4920,_0xe593('0x12'));logger[_0xe593('0x13')](_0xe593('0x14'),_0x4d4920,_0xe593('0x12'),JSON[_0xe593('0x15')](_0x2667ff));if(_0x2667ff[_0xe593('0x16')]){if(_0x2667ff[_0xe593('0x16')][_0xe593('0x17')]===0x1f4){logger['error'](_0xe593('0x18'),_0x4d4920,_0x2667ff[_0xe593('0x16')][_0xe593('0x19')]);return _0x51f4fc(_0x2667ff['error'][_0xe593('0x19')]);}logger[_0xe593('0x16')](_0xe593('0x18'),_0x4d4920,_0x2667ff[_0xe593('0x16')][_0xe593('0x19')]);return _0xdbe051(_0x2667ff[_0xe593('0x16')][_0xe593('0x19')]);}else{logger[_0xe593('0x11')](_0xe593('0x18'),_0x4d4920,'request\x20sent');_0xdbe051(_0x2667ff['result'][_0xe593('0x19')]);}})[_0xe593('0x1a')](function(_0x5ccecb){logger[_0xe593('0x16')]('ChatMessage,\x20%s,\x20%s',_0x4d4920,_0x5ccecb);_0x51f4fc(_0x5ccecb);});});}exports[_0xe593('0x1b')]=function(_0x25c0d5){var _0x269e24=this;return new Promise(function(_0x60e336,_0x4701e0){return db[_0xe593('0x1c')][_0xe593('0x1d')](_0x25c0d5['body'],{'raw':_0x25c0d5[_0xe593('0x1e')]?_0x25c0d5[_0xe593('0x1e')][_0xe593('0x1f')]===undefined?!![]:![]:!![]})[_0xe593('0x10')](function(_0x353207){logger[_0xe593('0x11')](_0xe593('0x1b'),_0x25c0d5);logger[_0xe593('0x13')]('CreateChatMessage',_0x25c0d5,JSON[_0xe593('0x15')](_0x353207));_0x60e336(_0x353207);})[_0xe593('0x1a')](function(_0x37e53f){logger[_0xe593('0x16')](_0xe593('0x1b'),_0x37e53f[_0xe593('0x19')],_0x25c0d5);_0x4701e0(_0x269e24['error'](0x1f4,_0x37e53f[_0xe593('0x19')]));});});}; \ No newline at end of file +var _0xf841=['info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateChatMessage','ChatMessage','body','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatMessage.socket','register','then'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0xf841,0x1ee));var _0x1f84=function(_0x4a858b,_0x270c1c){_0x4a858b=_0x4a858b-0x0;var _0x5ae6a0=_0xf841[_0x4a858b];return _0x5ae6a0;};'use strict';var _=require('lodash');var util=require(_0x1f84('0x0'));var moment=require('moment');var BPromise=require(_0x1f84('0x1'));var rs=require(_0x1f84('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f84('0x3'))['db'];var utils=require(_0x1f84('0x4'));var logger=require(_0x1f84('0x5'))(_0x1f84('0x6'));var config=require(_0x1f84('0x7'));var jayson=require(_0x1f84('0x8'));var client=jayson[_0x1f84('0x9')][_0x1f84('0xa')]({'port':0x232a});config[_0x1f84('0xb')]=_['defaults'](config[_0x1f84('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f84('0xc'))(new Redis(config[_0x1f84('0xb')]));require(_0x1f84('0xd'))[_0x1f84('0xe')](socket);function respondWithRpcPromise(_0xf5926b,_0x34973d,_0x4799a9){return new BPromise(function(_0x1d0694,_0x4217f7){return client['request'](_0xf5926b,_0x4799a9)[_0x1f84('0xf')](function(_0x27e0e6){logger[_0x1f84('0x10')](_0x1f84('0x11'),_0x34973d,_0x1f84('0x12'));logger[_0x1f84('0x13')](_0x1f84('0x14'),_0x34973d,_0x1f84('0x12'),JSON[_0x1f84('0x15')](_0x27e0e6));if(_0x27e0e6[_0x1f84('0x16')]){if(_0x27e0e6[_0x1f84('0x16')][_0x1f84('0x17')]===0x1f4){logger[_0x1f84('0x16')](_0x1f84('0x11'),_0x34973d,_0x27e0e6['error'][_0x1f84('0x18')]);return _0x4217f7(_0x27e0e6[_0x1f84('0x16')][_0x1f84('0x18')]);}logger['error'](_0x1f84('0x11'),_0x34973d,_0x27e0e6['error']['message']);return _0x1d0694(_0x27e0e6[_0x1f84('0x16')][_0x1f84('0x18')]);}else{logger['info'](_0x1f84('0x11'),_0x34973d,_0x1f84('0x12'));_0x1d0694(_0x27e0e6['result'][_0x1f84('0x18')]);}})['catch'](function(_0x59c512){logger[_0x1f84('0x16')]('ChatMessage,\x20%s,\x20%s',_0x34973d,_0x59c512);_0x4217f7(_0x59c512);});});}exports[_0x1f84('0x19')]=function(_0x451495){var _0x39b3b1=this;return new Promise(function(_0x5c0a61,_0x4c2caa){return db[_0x1f84('0x1a')]['create'](_0x451495[_0x1f84('0x1b')],{'raw':_0x451495['options']?_0x451495[_0x1f84('0x1c')][_0x1f84('0x1d')]===undefined?!![]:![]:!![]})[_0x1f84('0xf')](function(_0x467fe9){logger[_0x1f84('0x10')](_0x1f84('0x19'),_0x451495);logger['debug']('CreateChatMessage',_0x451495,JSON[_0x1f84('0x15')](_0x467fe9));_0x5c0a61(_0x467fe9);})['catch'](function(_0x129b16){logger[_0x1f84('0x16')](_0x1f84('0x19'),_0x129b16[_0x1f84('0x18')],_0x451495);_0x4c2caa(_0x39b3b1[_0x1f84('0x16')](0x1f4,_0x129b16['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8ed1165..d225fd1 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 _0x4137=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x4b06a5,_0x2f274f){var _0x4a7690=function(_0x3f98b7){while(--_0x3f98b7){_0x4b06a5['push'](_0x4b06a5['shift']());}};_0x4a7690(++_0x2f274f);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var ChatMessageEvents=require(_0x7413('0x0'));var events=[_0x7413('0x1'),_0x7413('0x2'),_0x7413('0x3')];function createListener(_0x392ebc,_0x410971){return function(_0x2e6df7){_0x410971[_0x7413('0x4')](_0x392ebc,_0x2e6df7);};}function removeListener(_0x258255,_0x3dc48a){return function(){ChatMessageEvents[_0x7413('0x5')](_0x258255,_0x3dc48a);};}exports[_0x7413('0x6')]=function(_0x4fbade){for(var _0xc808cd=0x0,_0x188d89=events[_0x7413('0x7')];_0xc808cd<_0x188d89;_0xc808cd++){var _0x15af0d=events[_0xc808cd];var _0x5f4cd0=createListener(_0x7413('0x8')+_0x15af0d,_0x4fbade);ChatMessageEvents['on'](_0x15af0d,_0x5f4cd0);}}; \ No newline at end of file +var _0x71ab=['length','chatMessage:','save','update','emit','removeListener','register'];(function(_0x150aef,_0x580edd){var _0x26c7ff=function(_0x426e06){while(--_0x426e06){_0x150aef['push'](_0x150aef['shift']());}};_0x26c7ff(++_0x580edd);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xb71a('0x0'),'remove',_0xb71a('0x1')];function createListener(_0x5bdf89,_0x3e985a){return function(_0x3f0529){_0x3e985a[_0xb71a('0x2')](_0x5bdf89,_0x3f0529);};}function removeListener(_0x4094b2,_0x37ce74){return function(){ChatMessageEvents[_0xb71a('0x3')](_0x4094b2,_0x37ce74);};}exports[_0xb71a('0x4')]=function(_0x38d931){for(var _0x22c072=0x0,_0x35a84e=events[_0xb71a('0x5')];_0x22c072<_0x35a84e;_0x22c072++){var _0x2a4c86=events[_0x22c072];var _0x43ca14=createListener(_0xb71a('0x6')+_0x2a4c86,_0x38d931);ChatMessageEvents['on'](_0x2a4c86,_0x43ca14);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 84e43b0..d5659ff 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 _0x777d=['delete','exports','util','path','connect-timeout','Router','fs-extra','./chatMessage.controller','isAuthenticated','get','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/reject','reject'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0x777d,0xe9));var _0xd777=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0x777d[_0x21f3bf];return _0x249d08;};'use strict';var multer=require('multer');var util=require(_0xd777('0x0'));var path=require(_0xd777('0x1'));var timeout=require(_0xd777('0x2'));var express=require('express');var router=express[_0xd777('0x3')]();var fs_extra=require(_0xd777('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd777('0x5'));router['get']('/',auth[_0xd777('0x6')](),controller['index']);router[_0xd777('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd777('0x7')](_0xd777('0x8'),auth[_0xd777('0x6')](),controller[_0xd777('0x9')]);router[_0xd777('0xa')]('/',auth[_0xd777('0x6')](),interaction[_0xd777('0xb')](_0xd777('0xc'),_0xd777('0xd')),controller[_0xd777('0xe')]);router[_0xd777('0xf')](_0xd777('0x8'),controller[_0xd777('0x10')]);router['put']('/:id/accept',auth[_0xd777('0x6')](),controller['accept']);router[_0xd777('0xf')](_0xd777('0x11'),auth[_0xd777('0x6')](),controller[_0xd777('0x12')]);router[_0xd777('0x13')]('/:id',auth[_0xd777('0x6')](),controller['destroy']);module[_0xd777('0x14')]=router; \ No newline at end of file +var _0x91a7=['isAuthenticated','/:id','show','post','tracked','chat','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','./chatMessage.controller','get','index','/describe'];(function(_0x456471,_0x5d22e1){var _0x118671=function(_0x57c48a){while(--_0x57c48a){_0x456471['push'](_0x456471['shift']());}};_0x118671(++_0x5d22e1);}(_0x91a7,0xe7));var _0x791a=function(_0xa62357,_0x40d75d){_0xa62357=_0xa62357-0x0;var _0x18f7b5=_0x91a7[_0xa62357];return _0x18f7b5;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['describe']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0xc')]('/',auth['isAuthenticated'](),interaction[_0x791a('0xd')](_0x791a('0xe'),'chatmessage:create'),controller[_0x791a('0xf')]);router[_0x791a('0x10')](_0x791a('0xa'),controller[_0x791a('0x11')]);router[_0x791a('0x10')](_0x791a('0x12'),auth['isAuthenticated'](),controller['accept']);router[_0x791a('0x10')](_0x791a('0x13'),auth['isAuthenticated'](),controller[_0x791a('0x14')]);router[_0x791a('0x15')]('/:id',auth[_0x791a('0x9')](),controller[_0x791a('0x16')]);module[_0x791a('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index b322cdf..934f0a3 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 _0x955a=['exports','TEXT','medium','sequelize'];(function(_0x5b38c8,_0x1cb4a3){var _0x2f4739=function(_0x3c29e8){while(--_0x3c29e8){_0x5b38c8['push'](_0x5b38c8['shift']());}};_0x2f4739(++_0x1cb4a3);}(_0x955a,0xdb));var _0xa955=function(_0x41f352,_0x59ae37){_0x41f352=_0x41f352-0x0;var _0x1b8cf8=_0x955a[_0x41f352];return _0x1b8cf8;};'use strict';var Sequelize=require(_0xa955('0x0'));module[_0xa955('0x1')]={'body':{'type':Sequelize[_0xa955('0x2')](_0xa955('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x334c=['medium','sequelize','TEXT'];(function(_0x4260f3,_0x4988d6){var _0x31b726=function(_0x5a5513){while(--_0x5a5513){_0x4260f3['push'](_0x4260f3['shift']());}};_0x31b726(++_0x4988d6);}(_0x334c,0x166));var _0xc334=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0x334c[_0x231dda];return _0x3f88cb;};'use strict';var Sequelize=require(_0xc334('0x0'));module['exports']={'body':{'type':Sequelize[_0xc334('0x1')](_0xc334('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 66f8091..940e73e 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 _0xb10b=['rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','VIRTUAL','filter','options','includeAll','include','catch','params','keys','find','create','Attachment','findAll','join','root','server','files','attachments','offline-chat','basename','existsSync','remove','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','render','merge','body','contact','message','agent','account','ChatOfflineMessage'];(function(_0x288a82,_0x3cfd2c){var _0x219ed9=function(_0x28238d){while(--_0x28238d){_0x288a82['push'](_0x288a82['shift']());}};_0x219ed9(++_0x3cfd2c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0xb10b[_0x3a13cf];return _0x4817c;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}function getMustacheRender(_0x2a0e8b,_0x4aabb9){return Mustache[_0xbb10('0x2a')](_0x2a0e8b,_[_0xbb10('0x2b')](_0x4aabb9[_0xbb10('0x2c')],{'contact':_0x4aabb9[_0xbb10('0x2d')],'message':_0x4aabb9[_0xbb10('0x2e')],'agent':_0x4aabb9[_0xbb10('0x2f')],'interaction':_0x4aabb9['interaction'],'account':_0x4aabb9[_0xbb10('0x30')]}))||'';}exports['index']=function(_0x448d5c,_0x56f2da){var _0x16ad2a={},_0x1dcc9c={},_0x1b59f9={'count':0x0,'rows':[]};var _0x491db4=_['map'](db[_0xbb10('0x31')][_0xbb10('0x32')],function(_0x4f590d){return{'name':_0x4f590d[_0xbb10('0x33')],'type':_0x4f590d[_0xbb10('0x34')][_0xbb10('0x35')]};});_0x1dcc9c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x491db4,_0xbb10('0x28'));_0x1dcc9c[_0xbb10('0x38')]=_['keys'](_0x448d5c[_0xbb10('0x38')]);_0x1dcc9c[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x1dcc9c[_0xbb10('0x36')],_0x1dcc9c[_0xbb10('0x38')]);_0x16ad2a[_0xbb10('0x3b')]=_[_0xbb10('0x3a')](_0x1dcc9c[_0xbb10('0x36')],qs[_0xbb10('0x3c')](_0x448d5c['query'][_0xbb10('0x3c')]));_0x16ad2a[_0xbb10('0x3b')]=_0x16ad2a[_0xbb10('0x3b')][_0xbb10('0x3d')]?_0x16ad2a['attributes']:_0x1dcc9c[_0xbb10('0x36')];if(!_0x448d5c['query']['hasOwnProperty'](_0xbb10('0x3e'))){_0x16ad2a[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x448d5c[_0xbb10('0x38')][_0xbb10('0x1c')]);_0x16ad2a[_0xbb10('0x1b')]=qs['offset'](_0x448d5c[_0xbb10('0x38')][_0xbb10('0x1b')]);}_0x16ad2a['order']=qs['sort'](_0x448d5c['query'][_0xbb10('0x3f')]);_0x16ad2a[_0xbb10('0x40')]=qs[_0xbb10('0x39')](_['pick'](_0x448d5c[_0xbb10('0x38')],_0x1dcc9c[_0xbb10('0x39')]),_0x491db4);if(_0x448d5c[_0xbb10('0x38')]['filter']){_0x16ad2a[_0xbb10('0x40')]=_[_0xbb10('0x2b')](_0x16ad2a[_0xbb10('0x40')],{'$or':_[_0xbb10('0x37')](_0x491db4,function(_0x4f1cdd){if(_0x4f1cdd[_0xbb10('0x34')]!==_0xbb10('0x41')){var _0x5835fd={};_0x5835fd[_0x4f1cdd[_0xbb10('0x28')]]={'$like':'%'+_0x448d5c[_0xbb10('0x38')][_0xbb10('0x42')]+'%'};return _0x5835fd;}})});}_0x16ad2a=_[_0xbb10('0x2b')]({},_0x16ad2a,_0x448d5c[_0xbb10('0x43')]);var _0x185a52={'where':_0x16ad2a['where']};return db[_0xbb10('0x31')][_0xbb10('0x1e')](_0x185a52)[_0xbb10('0x23')](function(_0x3d3c41){_0x1b59f9['count']=_0x3d3c41;if(_0x448d5c[_0xbb10('0x38')][_0xbb10('0x44')]){_0x16ad2a[_0xbb10('0x45')]=[{'all':!![]}];}return db[_0xbb10('0x31')]['findAll'](_0x16ad2a);})[_0xbb10('0x23')](function(_0x202c60){_0x1b59f9['rows']=_0x202c60;return _0x1b59f9;})['then'](respondWithFilteredResult(_0x56f2da,_0x16ad2a))[_0xbb10('0x46')](handleError(_0x56f2da,null));};exports['show']=function(_0x318984,_0x180933){var _0x4c66d8={'raw':!![],'where':{'id':_0x318984[_0xbb10('0x47')]['id']}},_0x366608={};_0x366608[_0xbb10('0x36')]=_['keys'](db[_0xbb10('0x31')][_0xbb10('0x32')]);_0x366608[_0xbb10('0x38')]=_[_0xbb10('0x48')](_0x318984[_0xbb10('0x38')]);_0x366608[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x366608[_0xbb10('0x36')],_0x366608[_0xbb10('0x38')]);_0x4c66d8[_0xbb10('0x3b')]=_[_0xbb10('0x3a')](_0x366608[_0xbb10('0x36')],qs['fields'](_0x318984[_0xbb10('0x38')][_0xbb10('0x3c')]));_0x4c66d8['attributes']=_0x4c66d8[_0xbb10('0x3b')][_0xbb10('0x3d')]?_0x4c66d8[_0xbb10('0x3b')]:_0x366608[_0xbb10('0x36')];if(_0x318984[_0xbb10('0x38')][_0xbb10('0x44')]){_0x4c66d8[_0xbb10('0x45')]=[{'all':!![]}];}_0x4c66d8=_['merge']({},_0x4c66d8,_0x318984['options']);return db[_0xbb10('0x31')][_0xbb10('0x49')](_0x4c66d8)[_0xbb10('0x23')](handleEntityNotFound(_0x180933,null))['then'](respondWithResult(_0x180933,null))['catch'](handleError(_0x180933,null));};exports[_0xbb10('0x4a')]=function(_0x34cf4e,_0x1bd054){return db[_0xbb10('0x31')][_0xbb10('0x4a')](_0x34cf4e[_0xbb10('0x2c')],{})[_0xbb10('0x23')](respondWithResult(_0x1bd054,0xc9))[_0xbb10('0x46')](handleError(_0x1bd054,null));};exports[_0xbb10('0x22')]=function(_0x3d7e7e,_0x550111){if(_0x3d7e7e['body']['id']){delete _0x3d7e7e[_0xbb10('0x2c')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x49')]({'where':{'id':_0x3d7e7e[_0xbb10('0x47')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x550111,null))[_0xbb10('0x23')](saveUpdates(_0x3d7e7e[_0xbb10('0x2c')],null))[_0xbb10('0x23')](respondWithResult(_0x550111,null))[_0xbb10('0x46')](handleError(_0x550111,null));};exports[_0xbb10('0x24')]=function(_0x19ca3e,_0x20e18a){return db[_0xbb10('0x4b')][_0xbb10('0x4c')]({'where':{'ChatOfflineMessageId':_0x19ca3e[_0xbb10('0x47')]['id']},'raw':!![]})['then'](function(_0x124052){_0x124052['forEach'](function(_0x33d60a){var _0x2e21a0=path[_0xbb10('0x4d')](config[_0xbb10('0x4e')],_0xbb10('0x4f'),_0xbb10('0x50'),_0xbb10('0x51'),_0xbb10('0x52'),_0x33d60a[_0xbb10('0x53')]);var _0x3d71e=fs[_0xbb10('0x54')](_0x2e21a0);if(_0x3d71e)fs_extra[_0xbb10('0x55')](_0x2e21a0);});})[_0xbb10('0x23')](function(){return db[_0xbb10('0x31')][_0xbb10('0x49')]({'where':{'id':_0x19ca3e['params']['id']},'individualHooks':!![]});})[_0xbb10('0x23')](handleEntityNotFound(_0x20e18a,null))[_0xbb10('0x23')](removeEntity(_0x20e18a,null))[_0xbb10('0x46')](handleError(_0x20e18a,null));};exports[_0xbb10('0x56')]=function(_0xbffa3c,_0x379d8c){return db['ChatOfflineMessage'][_0xbb10('0x56')]()[_0xbb10('0x23')](respondWithResult(_0x379d8c,null))[_0xbb10('0x46')](handleError(_0x379d8c,null));}; \ No newline at end of file +var _0x757a=['then','end','sendStatus','error','stack','name','render','body','contact','agent','account','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','catch','create','find','destroy','forEach','join','root','server','files','offline-chat','basename','existsSync','remove','describe','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','limit','Content-Range','apply','update'];(function(_0xd6afce,_0x40123e){var _0x7a718b=function(_0x406156){while(--_0x406156){_0xd6afce['push'](_0xd6afce['shift']());}};_0x7a718b(++_0x40123e);}(_0x757a,0xde));var _0xa757=function(_0xdc4c72,_0x188a4e){_0xdc4c72=_0xdc4c72-0x0;var _0x3e7a65=_0x757a[_0xdc4c72];return _0x3e7a65;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){_0x2ca10d['status'](0xcc)[_0xa757('0x1f')]();});}};}function handleEntityNotFound(_0x47903b,_0x40551d){return function(_0x3859ce){if(!_0x3859ce){_0x47903b[_0xa757('0x20')](0x194);}return _0x3859ce;};}function handleError(_0x4d58a4,_0x2b19d5){_0x2b19d5=_0x2b19d5||0x1f4;return function(_0xcd98bd){logger[_0xa757('0x21')](_0xcd98bd[_0xa757('0x22')]);if(_0xcd98bd['name']){delete _0xcd98bd[_0xa757('0x23')];}_0x4d58a4['status'](_0x2b19d5)['send'](_0xcd98bd);};}function getMustacheRender(_0x54b75e,_0x4f8de2){return Mustache[_0xa757('0x24')](_0x54b75e,_['merge'](_0x4f8de2[_0xa757('0x25')],{'contact':_0x4f8de2[_0xa757('0x26')],'message':_0x4f8de2['message'],'agent':_0x4f8de2[_0xa757('0x27')],'interaction':_0x4f8de2['interaction'],'account':_0x4f8de2[_0xa757('0x28')]}))||'';}exports[_0xa757('0x29')]=function(_0x5307c3,_0x235e54){var _0x5ade7b={},_0x3a4a66={},_0x27b3e2={'count':0x0,'rows':[]};var _0x458974=_[_0xa757('0x2a')](db[_0xa757('0x2b')][_0xa757('0x2c')],function(_0x1a44a9){return{'name':_0x1a44a9[_0xa757('0x2d')],'type':_0x1a44a9[_0xa757('0x2e')][_0xa757('0x2f')]};});_0x3a4a66[_0xa757('0x30')]=_[_0xa757('0x2a')](_0x458974,_0xa757('0x23'));_0x3a4a66[_0xa757('0x31')]=_[_0xa757('0x32')](_0x5307c3[_0xa757('0x31')]);_0x3a4a66[_0xa757('0x33')]=_[_0xa757('0x34')](_0x3a4a66[_0xa757('0x30')],_0x3a4a66[_0xa757('0x31')]);_0x5ade7b[_0xa757('0x35')]=_[_0xa757('0x34')](_0x3a4a66[_0xa757('0x30')],qs[_0xa757('0x36')](_0x5307c3['query'][_0xa757('0x36')]));_0x5ade7b[_0xa757('0x35')]=_0x5ade7b[_0xa757('0x35')][_0xa757('0x37')]?_0x5ade7b[_0xa757('0x35')]:_0x3a4a66['model'];if(!_0x5307c3[_0xa757('0x31')][_0xa757('0x38')](_0xa757('0x39'))){_0x5ade7b[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x5307c3[_0xa757('0x31')]['limit']);_0x5ade7b[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x5307c3[_0xa757('0x31')][_0xa757('0x17')]);}_0x5ade7b[_0xa757('0x3a')]=qs[_0xa757('0x3b')](_0x5307c3[_0xa757('0x31')][_0xa757('0x3b')]);_0x5ade7b[_0xa757('0x3c')]=qs['filters'](_[_0xa757('0x3d')](_0x5307c3[_0xa757('0x31')],_0x3a4a66[_0xa757('0x33')]),_0x458974);if(_0x5307c3[_0xa757('0x31')][_0xa757('0x3e')]){_0x5ade7b[_0xa757('0x3c')]=_['merge'](_0x5ade7b[_0xa757('0x3c')],{'$or':_[_0xa757('0x2a')](_0x458974,function(_0x48cde9){if(_0x48cde9['type']!==_0xa757('0x3f')){var _0x6193bf={};_0x6193bf[_0x48cde9['name']]={'$like':'%'+_0x5307c3['query'][_0xa757('0x3e')]+'%'};return _0x6193bf;}})});}_0x5ade7b=_[_0xa757('0x40')]({},_0x5ade7b,_0x5307c3[_0xa757('0x41')]);var _0x59d699={'where':_0x5ade7b[_0xa757('0x3c')]};return db[_0xa757('0x2b')][_0xa757('0x19')](_0x59d699)[_0xa757('0x1e')](function(_0x104e6b){_0x27b3e2['count']=_0x104e6b;if(_0x5307c3[_0xa757('0x31')]['includeAll']){_0x5ade7b['include']=[{'all':!![]}];}return db[_0xa757('0x2b')][_0xa757('0x42')](_0x5ade7b);})[_0xa757('0x1e')](function(_0x626b1f){_0x27b3e2[_0xa757('0x43')]=_0x626b1f;return _0x27b3e2;})['then'](respondWithFilteredResult(_0x235e54,_0x5ade7b))['catch'](handleError(_0x235e54,null));};exports[_0xa757('0x44')]=function(_0x129d77,_0x2b171c){var _0xe03a3c={'raw':!![],'where':{'id':_0x129d77[_0xa757('0x45')]['id']}},_0xc063db={};_0xc063db['model']=_[_0xa757('0x32')](db[_0xa757('0x2b')]['rawAttributes']);_0xc063db[_0xa757('0x31')]=_['keys'](_0x129d77[_0xa757('0x31')]);_0xc063db[_0xa757('0x33')]=_['intersection'](_0xc063db[_0xa757('0x30')],_0xc063db[_0xa757('0x31')]);_0xe03a3c['attributes']=_[_0xa757('0x34')](_0xc063db[_0xa757('0x30')],qs[_0xa757('0x36')](_0x129d77[_0xa757('0x31')]['fields']));_0xe03a3c[_0xa757('0x35')]=_0xe03a3c[_0xa757('0x35')][_0xa757('0x37')]?_0xe03a3c[_0xa757('0x35')]:_0xc063db['model'];if(_0x129d77[_0xa757('0x31')]['includeAll']){_0xe03a3c['include']=[{'all':!![]}];}_0xe03a3c=_[_0xa757('0x40')]({},_0xe03a3c,_0x129d77[_0xa757('0x41')]);return db[_0xa757('0x2b')]['find'](_0xe03a3c)[_0xa757('0x1e')](handleEntityNotFound(_0x2b171c,null))['then'](respondWithResult(_0x2b171c,null))[_0xa757('0x46')](handleError(_0x2b171c,null));};exports[_0xa757('0x47')]=function(_0x265793,_0xbef575){return db[_0xa757('0x2b')][_0xa757('0x47')](_0x265793[_0xa757('0x25')],{})[_0xa757('0x1e')](respondWithResult(_0xbef575,0xc9))['catch'](handleError(_0xbef575,null));};exports[_0xa757('0x1d')]=function(_0x7411a3,_0x33347a){if(_0x7411a3[_0xa757('0x25')]['id']){delete _0x7411a3[_0xa757('0x25')]['id'];}return db[_0xa757('0x2b')][_0xa757('0x48')]({'where':{'id':_0x7411a3[_0xa757('0x45')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x33347a,null))[_0xa757('0x1e')](saveUpdates(_0x7411a3[_0xa757('0x25')],null))[_0xa757('0x1e')](respondWithResult(_0x33347a,null))[_0xa757('0x46')](handleError(_0x33347a,null));};exports[_0xa757('0x49')]=function(_0x388573,_0x23caca){return db['Attachment'][_0xa757('0x42')]({'where':{'ChatOfflineMessageId':_0x388573['params']['id']},'raw':!![]})[_0xa757('0x1e')](function(_0x311c25){_0x311c25[_0xa757('0x4a')](function(_0x24c0ad){var _0x4cb461=path[_0xa757('0x4b')](config[_0xa757('0x4c')],_0xa757('0x4d'),_0xa757('0x4e'),'attachments',_0xa757('0x4f'),_0x24c0ad[_0xa757('0x50')]);var _0x216b32=fs[_0xa757('0x51')](_0x4cb461);if(_0x216b32)fs_extra[_0xa757('0x52')](_0x4cb461);});})[_0xa757('0x1e')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x388573['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x23caca,null))[_0xa757('0x1e')](removeEntity(_0x23caca,null))[_0xa757('0x46')](handleError(_0x23caca,null));};exports[_0xa757('0x53')]=function(_0x32313b,_0x1e31ef){return db[_0xa757('0x2b')]['describe']()[_0xa757('0x1e')](respondWithResult(_0x1e31ef,null))[_0xa757('0x46')](handleError(_0x1e31ef,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index f704b89..c19b8df 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 _0x0e85=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','rimraf','./chatOfflineMessage.attributes','exports','ChatOfflineMessage'];(function(_0x125ad9,_0x26f949){var _0x167be2=function(_0x5d02ac){while(--_0x5d02ac){_0x125ad9['push'](_0x125ad9['shift']());}};_0x167be2(++_0x26f949);}(_0x0e85,0x7c));var _0x50e8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0e85[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var logger=require('../../config/logger')(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x50e8('0x5'));module[_0x50e8('0x6')]=function(_0xe3151e,_0xfde42){return _0xe3151e['define'](_0x50e8('0x7'),attributes,{'tableName':_0x50e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x50e8('0x9'),'collate':_0x50e8('0xa')});}; \ No newline at end of file +var _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x34e8,0x12c));var _0x834e=function(_0x5113a7,_0x5e7852){_0x5113a7=_0x5113a7-0x0;var _0x2056d0=_0x34e8[_0x5113a7];return _0x2056d0;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x834e('0xd'),'collate':_0x834e('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index daaf2ab..f8e983d 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 _0x4b0e=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5f3a87,_0x5170c8){var _0x3749ac=function(_0x13c7ec){while(--_0x13c7ec){_0x5f3a87['push'](_0x5f3a87['shift']());}};_0x3749ac(++_0x5170c8);}(_0x4b0e,0xc3));var _0xe4b0=function(_0x1a1eab,_0x28d992){_0x1a1eab=_0x1a1eab-0x0;var _0x260bb7=_0x4b0e[_0x1a1eab];return _0x260bb7;};'use strict';var _=require('lodash');var util=require(_0xe4b0('0x0'));var moment=require('moment');var BPromise=require(_0xe4b0('0x1'));var rs=require(_0xe4b0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4b0('0x3'))['db'];var utils=require(_0xe4b0('0x4'));var logger=require(_0xe4b0('0x5'))(_0xe4b0('0x6'));var config=require(_0xe4b0('0x7'));var jayson=require(_0xe4b0('0x8'));var client=jayson[_0xe4b0('0x9')][_0xe4b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32b21b,_0x29348a,_0xc923bc){return new BPromise(function(_0x384e2d,_0xca9f01){return client[_0xe4b0('0xb')](_0x32b21b,_0xc923bc)['then'](function(_0x556900){logger['info'](_0xe4b0('0xc'),_0x29348a,_0xe4b0('0xd'));logger[_0xe4b0('0xe')](_0xe4b0('0xf'),_0x29348a,'request\x20sent',JSON[_0xe4b0('0x10')](_0x556900));if(_0x556900['error']){if(_0x556900[_0xe4b0('0x11')][_0xe4b0('0x12')]===0x1f4){logger[_0xe4b0('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x29348a,_0x556900[_0xe4b0('0x11')][_0xe4b0('0x13')]);return _0xca9f01(_0x556900[_0xe4b0('0x11')][_0xe4b0('0x13')]);}logger[_0xe4b0('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x29348a,_0x556900[_0xe4b0('0x11')][_0xe4b0('0x13')]);return _0x384e2d(_0x556900['error']['message']);}else{logger[_0xe4b0('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x29348a,_0xe4b0('0xd'));_0x384e2d(_0x556900[_0xe4b0('0x15')]['message']);}})[_0xe4b0('0x16')](function(_0xf364ca){logger['error'](_0xe4b0('0xc'),_0x29348a,_0xf364ca);_0xca9f01(_0xf364ca);});});} \ No newline at end of file +var _0xb1f9=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x5f13d4,_0x4188c4){var _0x2732d6=function(_0x45b719){while(--_0x45b719){_0x5f13d4['push'](_0x5f13d4['shift']());}};_0x2732d6(++_0x4188c4);}(_0xb1f9,0x111));var _0x9b1f=function(_0x4b196a,_0x35f101){_0x4b196a=_0x4b196a-0x0;var _0xcd766c=_0xb1f9[_0x4b196a];return _0xcd766c;};'use strict';var _=require(_0x9b1f('0x0'));var util=require(_0x9b1f('0x1'));var moment=require(_0x9b1f('0x2'));var BPromise=require(_0x9b1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b1f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9b1f('0x5'));var config=require(_0x9b1f('0x6'));var jayson=require(_0x9b1f('0x7'));var client=jayson[_0x9b1f('0x8')][_0x9b1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a6d0,_0x4125b1,_0x5000e8){return new BPromise(function(_0x35c632,_0x289d13){return client[_0x9b1f('0xa')](_0x2a6d0,_0x5000e8)[_0x9b1f('0xb')](function(_0x370bd5){logger['info'](_0x9b1f('0xc'),_0x4125b1,'request\x20sent');logger[_0x9b1f('0xd')](_0x9b1f('0xe'),_0x4125b1,_0x9b1f('0xf'),JSON[_0x9b1f('0x10')](_0x370bd5));if(_0x370bd5[_0x9b1f('0x11')]){if(_0x370bd5[_0x9b1f('0x11')]['code']===0x1f4){logger[_0x9b1f('0x11')](_0x9b1f('0xc'),_0x4125b1,_0x370bd5['error'][_0x9b1f('0x12')]);return _0x289d13(_0x370bd5['error']['message']);}logger[_0x9b1f('0x11')](_0x9b1f('0xc'),_0x4125b1,_0x370bd5['error'][_0x9b1f('0x12')]);return _0x35c632(_0x370bd5[_0x9b1f('0x11')]['message']);}else{logger[_0x9b1f('0x13')](_0x9b1f('0xc'),_0x4125b1,'request\x20sent');_0x35c632(_0x370bd5[_0x9b1f('0x14')][_0x9b1f('0x12')]);}})[_0x9b1f('0x15')](function(_0x3b6e66){logger[_0x9b1f('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4125b1,_0x3b6e66);_0x289d13(_0x3b6e66);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e7b41c9..c789b6f 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 _0x8b1e=['post','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show'];(function(_0x147914,_0x2cbf3b){var _0xfc1621=function(_0x550567){while(--_0x550567){_0x147914['push'](_0x147914['shift']());}};_0xfc1621(++_0x2cbf3b);}(_0x8b1e,0x16e));var _0xe8b1=function(_0x162905,_0x3ffe0e){_0x162905=_0x162905-0x0;var _0x50a69e=_0x8b1e[_0x162905];return _0x50a69e;};'use strict';var multer=require(_0xe8b1('0x0'));var util=require(_0xe8b1('0x1'));var path=require(_0xe8b1('0x2'));var timeout=require(_0xe8b1('0x3'));var express=require('express');var router=express[_0xe8b1('0x4')]();var fs_extra=require(_0xe8b1('0x5'));var auth=require(_0xe8b1('0x6'));var interaction=require(_0xe8b1('0x7'));var config=require(_0xe8b1('0x8'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0xe8b1('0x9')](),controller[_0xe8b1('0xa')]);router[_0xe8b1('0xb')](_0xe8b1('0xc'),auth[_0xe8b1('0x9')](),controller['describe']);router[_0xe8b1('0xb')]('/:id',auth[_0xe8b1('0x9')](),controller[_0xe8b1('0xd')]);router[_0xe8b1('0xe')]('/',auth[_0xe8b1('0x9')](),controller['create']);router['put'](_0xe8b1('0xf'),auth[_0xe8b1('0x9')](),controller[_0xe8b1('0x10')]);router[_0xe8b1('0x11')](_0xe8b1('0xf'),auth[_0xe8b1('0x9')](),controller[_0xe8b1('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd8e2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0xc12c20,_0x2facd4){var _0x2e349d=function(_0x58cdeb){while(--_0x58cdeb){_0xc12c20['push'](_0xc12c20['shift']());}};_0x2e349d(++_0x2facd4);}(_0xd8e2,0x18a));var _0x2d8e=function(_0x17ff7a,_0x268521){_0x17ff7a=_0x17ff7a-0x0;var _0x4e6081=_0xd8e2[_0x17ff7a];return _0x4e6081;};'use strict';var multer=require(_0x2d8e('0x0'));var util=require(_0x2d8e('0x1'));var path=require(_0x2d8e('0x2'));var timeout=require(_0x2d8e('0x3'));var express=require(_0x2d8e('0x4'));var router=express[_0x2d8e('0x5')]();var fs_extra=require(_0x2d8e('0x6'));var auth=require(_0x2d8e('0x7'));var interaction=require(_0x2d8e('0x8'));var config=require('../../config/environment');var controller=require(_0x2d8e('0x9'));router[_0x2d8e('0xa')]('/',auth[_0x2d8e('0xb')](),controller[_0x2d8e('0xc')]);router[_0x2d8e('0xa')](_0x2d8e('0xd'),auth['isAuthenticated'](),controller[_0x2d8e('0xe')]);router[_0x2d8e('0xa')]('/:id',auth[_0x2d8e('0xb')](),controller['show']);router[_0x2d8e('0xf')]('/',auth['isAuthenticated'](),controller[_0x2d8e('0x10')]);router['put'](_0x2d8e('0x11'),auth[_0x2d8e('0xb')](),controller[_0x2d8e('0x12')]);router[_0x2d8e('0x13')](_0x2d8e('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d8e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4cbceac..1eb3550 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 _0xb4ff=['INTEGER','sequelize','ENUM','mouseOver','timeout','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb4ff,0x19f));var _0xfb4f=function(_0x1747ef,_0x28ea62){_0x1747ef=_0x1747ef-0x0;var _0x40fa56=_0xb4ff[_0x1747ef];return _0x40fa56;};'use strict';var Sequelize=require(_0xfb4f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfb4f('0x1')](_0xfb4f('0x2'),_0xfb4f('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xfb4f('0x4')]},'timeout':{'type':Sequelize[_0xfb4f('0x5')]}}; \ No newline at end of file +var _0xf1da=['exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x5d02a2,_0x45984a){var _0x49346e=function(_0x5b3725){while(--_0x5b3725){_0x5d02a2['push'](_0x5d02a2['shift']());}};_0x49346e(++_0x45984a);}(_0xf1da,0x1bc));var _0xaf1d=function(_0x58a296,_0x2127e3){_0x58a296=_0x58a296-0x0;var _0x55c222=_0xf1da[_0x58a296];return _0x55c222;};'use strict';var Sequelize=require('sequelize');module[_0xaf1d('0x0')]={'name':{'type':Sequelize[_0xaf1d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xaf1d('0x2')](_0xaf1d('0x3'),_0xaf1d('0x4')),'defaultValue':_0xaf1d('0x3')},'selector':{'type':Sequelize[_0xaf1d('0x1')]},'timeout':{'type':Sequelize[_0xaf1d('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 1763e57..3a43143 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 _0x50ed=['catch','create','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','name','send','render','body','message','agent','interaction','account','show','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find'];(function(_0x560d2a,_0x4a9f54){var _0x3df62d=function(_0x1ce1ec){while(--_0x1ce1ec){_0x560d2a['push'](_0x560d2a['shift']());}};_0x3df62d(++_0x4a9f54);}(_0x50ed,0x8e));var _0xd50e=function(_0x57f481,_0x15e15e){_0x57f481=_0x57f481-0x0;var _0x5f1f5e=_0x50ed[_0x57f481];return _0x5f1f5e;};'use strict';var emlformat=require(_0xd50e('0x0'));var rimraf=require(_0xd50e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd50e('0x2'));var rp=require(_0xd50e('0x3'));var moment=require(_0xd50e('0x4'));var BPromise=require(_0xd50e('0x5'));var Mustache=require('mustache');var util=require(_0xd50e('0x6'));var path=require(_0xd50e('0x7'));var sox=require('sox');var csv=require(_0xd50e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd50e('0x9'));var _=require(_0xd50e('0xa'));var squel=require(_0xd50e('0xb'));var crypto=require('crypto');var jsforce=require(_0xd50e('0xc'));var deskjs=require(_0xd50e('0xd'));var toCsv=require(_0xd50e('0x8'));var querystring=require(_0xd50e('0xe'));var Papa=require(_0xd50e('0xf'));var Redis=require(_0xd50e('0x10'));var authService=require(_0xd50e('0x11'));var qs=require(_0xd50e('0x12'));var as=require(_0xd50e('0x13'));var hardwareService=require(_0xd50e('0x14'));var logger=require(_0xd50e('0x15'))(_0xd50e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd50e('0x17'));var db=require(_0xd50e('0x18'))['db'];function respondWithStatusCode(_0x1bf4be,_0x5a4a4c){_0x5a4a4c=_0x5a4a4c||0xcc;return function(_0x3f69b7){if(_0x3f69b7){return _0x1bf4be[_0xd50e('0x19')](_0x5a4a4c);}return _0x1bf4be[_0xd50e('0x1a')](_0x5a4a4c)[_0xd50e('0x1b')]();};}function respondWithResult(_0x2a0165,_0x119e81){_0x119e81=_0x119e81||0xc8;return function(_0x28c06d){if(_0x28c06d){return _0x2a0165[_0xd50e('0x1a')](_0x119e81)[_0xd50e('0x1c')](_0x28c06d);}};}function respondWithFilteredResult(_0x33449b,_0x62c4b5){return function(_0x3deb7f){if(_0x3deb7f){var _0x417f41=typeof _0x62c4b5['offset']===_0xd50e('0x1d')&&typeof _0x62c4b5[_0xd50e('0x1e')]===_0xd50e('0x1d');var _0x582299=_0x3deb7f[_0xd50e('0x1f')];var _0x5b481a=_0x417f41?0x0:_0x62c4b5['offset'];var _0x4dbdfb=_0x417f41?_0x3deb7f[_0xd50e('0x1f')]:_0x62c4b5[_0xd50e('0x20')]+_0x62c4b5[_0xd50e('0x1e')];var _0x688a93;if(_0x4dbdfb>=_0x582299){_0x4dbdfb=_0x582299;_0x688a93=0xc8;}else{_0x688a93=0xce;}_0x33449b[_0xd50e('0x1a')](_0x688a93);return _0x33449b[_0xd50e('0x21')](_0xd50e('0x22'),_0x5b481a+'-'+_0x4dbdfb+'/'+_0x582299)[_0xd50e('0x1c')](_0x3deb7f);}return null;};}function patchUpdates(_0xb1427b){return function(_0x489c17){try{jsonpatch[_0xd50e('0x23')](_0x489c17,_0xb1427b,!![]);}catch(_0x181ba1){return BPromise[_0xd50e('0x24')](_0x181ba1);}return _0x489c17[_0xd50e('0x25')]();};}function saveUpdates(_0x17ef69,_0x33a3f7){return function(_0xa19f99){if(_0xa19f99){return _0xa19f99['update'](_0x17ef69)['then'](function(_0x3c5b19){return _0x3c5b19;});}return null;};}function removeEntity(_0xfa26f1,_0x4f85e9){return function(_0x175618){if(_0x175618){return _0x175618[_0xd50e('0x26')]()[_0xd50e('0x27')](function(){_0xfa26f1[_0xd50e('0x1a')](0xcc)[_0xd50e('0x1b')]();});}};}function handleEntityNotFound(_0x4401aa,_0x463fe2){return function(_0x2f6c95){if(!_0x2f6c95){_0x4401aa[_0xd50e('0x19')](0x194);}return _0x2f6c95;};}function handleError(_0x521500,_0x17934d){_0x17934d=_0x17934d||0x1f4;return function(_0x12bd44){logger[_0xd50e('0x28')](_0x12bd44['stack']);if(_0x12bd44['name']){delete _0x12bd44[_0xd50e('0x29')];}_0x521500[_0xd50e('0x1a')](_0x17934d)[_0xd50e('0x2a')](_0x12bd44);};}function getMustacheRender(_0x4a400a,_0x4b7cf6){return Mustache[_0xd50e('0x2b')](_0x4a400a,_['merge'](_0x4b7cf6[_0xd50e('0x2c')],{'contact':_0x4b7cf6['contact'],'message':_0x4b7cf6[_0xd50e('0x2d')],'agent':_0x4b7cf6[_0xd50e('0x2e')],'interaction':_0x4b7cf6[_0xd50e('0x2f')],'account':_0x4b7cf6[_0xd50e('0x30')]}))||'';}exports[_0xd50e('0x31')]=function(_0x3becd7,_0x316a68){var _0x557f3e={'raw':!![],'where':{'id':_0x3becd7['params']['id']}},_0x2703e={};_0x2703e[_0xd50e('0x32')]=_['keys'](db[_0xd50e('0x33')][_0xd50e('0x34')]);_0x2703e[_0xd50e('0x35')]=_[_0xd50e('0x36')](_0x3becd7['query']);_0x2703e[_0xd50e('0x37')]=_[_0xd50e('0x38')](_0x2703e[_0xd50e('0x32')],_0x2703e[_0xd50e('0x35')]);_0x557f3e[_0xd50e('0x39')]=_[_0xd50e('0x38')](_0x2703e[_0xd50e('0x32')],qs['fields'](_0x3becd7['query'][_0xd50e('0x3a')]));_0x557f3e[_0xd50e('0x39')]=_0x557f3e[_0xd50e('0x39')][_0xd50e('0x3b')]?_0x557f3e['attributes']:_0x2703e[_0xd50e('0x32')];if(_0x3becd7[_0xd50e('0x35')][_0xd50e('0x3c')]){_0x557f3e[_0xd50e('0x3d')]=[{'all':!![]}];}_0x557f3e=_[_0xd50e('0x3e')]({},_0x557f3e,_0x3becd7[_0xd50e('0x3f')]);return db['ChatProactiveAction'][_0xd50e('0x40')](_0x557f3e)[_0xd50e('0x27')](handleEntityNotFound(_0x316a68,null))[_0xd50e('0x27')](respondWithResult(_0x316a68,null))[_0xd50e('0x41')](handleError(_0x316a68,null));};exports['create']=function(_0x4ff001,_0x2f68db){return db['ChatProactiveAction'][_0xd50e('0x42')](_0x4ff001[_0xd50e('0x2c')],{})[_0xd50e('0x27')](respondWithResult(_0x2f68db,0xc9))[_0xd50e('0x41')](handleError(_0x2f68db,null));};exports[_0xd50e('0x43')]=function(_0x23b4bc,_0x241080){if(_0x23b4bc[_0xd50e('0x2c')]['id']){delete _0x23b4bc['body']['id'];}return db['ChatProactiveAction'][_0xd50e('0x40')]({'where':{'id':_0x23b4bc[_0xd50e('0x44')]['id']}})[_0xd50e('0x27')](handleEntityNotFound(_0x241080,null))[_0xd50e('0x27')](saveUpdates(_0x23b4bc[_0xd50e('0x2c')],null))[_0xd50e('0x27')](respondWithResult(_0x241080,null))['catch'](handleError(_0x241080,null));};exports[_0xd50e('0x26')]=function(_0x379adb,_0x449377){return db[_0xd50e('0x33')][_0xd50e('0x40')]({'where':{'id':_0x379adb[_0xd50e('0x44')]['id']}})[_0xd50e('0x27')](handleEntityNotFound(_0x449377,null))[_0xd50e('0x27')](removeEntity(_0x449377,null))[_0xd50e('0x41')](handleError(_0x449377,null));}; \ No newline at end of file +var _0x603f=['../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','then','destroy','stack','name','send','render','merge','body','message','agent','interaction','account','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','includeAll','include','options','find','catch','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x101600,_0x2da5bb){var _0x46cc54=function(_0xbbde18){while(--_0xbbde18){_0x101600['push'](_0x101600['shift']());}};_0x46cc54(++_0x2da5bb);}(_0x603f,0x65));var _0xf603=function(_0x892b21,_0x121961){_0x892b21=_0x892b21-0x0;var _0x1e3e1=_0x603f[_0x892b21];return _0x1e3e1;};'use strict';var emlformat=require(_0xf603('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf603('0x1'));var jsonpatch=require(_0xf603('0x2'));var rp=require(_0xf603('0x3'));var moment=require('moment');var BPromise=require(_0xf603('0x4'));var Mustache=require(_0xf603('0x5'));var util=require('util');var path=require(_0xf603('0x6'));var sox=require(_0xf603('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf603('0x8'));var _=require(_0xf603('0x9'));var squel=require(_0xf603('0xa'));var crypto=require(_0xf603('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf603('0xc'));var toCsv=require(_0xf603('0xd'));var querystring=require('querystring');var Papa=require(_0xf603('0xe'));var Redis=require(_0xf603('0xf'));var authService=require(_0xf603('0x10'));var qs=require(_0xf603('0x11'));var as=require(_0xf603('0x12'));var hardwareService=require(_0xf603('0x13'));var logger=require(_0xf603('0x14'))(_0xf603('0x15'));var utils=require(_0xf603('0x16'));var config=require(_0xf603('0x17'));var licenseUtil=require(_0xf603('0x18'));var db=require(_0xf603('0x19'))['db'];function respondWithStatusCode(_0xfc3f21,_0x2e86b6){_0x2e86b6=_0x2e86b6||0xcc;return function(_0x1961d4){if(_0x1961d4){return _0xfc3f21[_0xf603('0x1a')](_0x2e86b6);}return _0xfc3f21[_0xf603('0x1b')](_0x2e86b6)['end']();};}function respondWithResult(_0x277a96,_0x274bfb){_0x274bfb=_0x274bfb||0xc8;return function(_0x200478){if(_0x200478){return _0x277a96[_0xf603('0x1b')](_0x274bfb)[_0xf603('0x1c')](_0x200478);}};}function respondWithFilteredResult(_0x550b07,_0x2364ba){return function(_0x2934b5){if(_0x2934b5){var _0x3a2bb8=typeof _0x2364ba[_0xf603('0x1d')]===_0xf603('0x1e')&&typeof _0x2364ba['limit']===_0xf603('0x1e');var _0x4a9caa=_0x2934b5[_0xf603('0x1f')];var _0x56340f=_0x3a2bb8?0x0:_0x2364ba[_0xf603('0x1d')];var _0x33a0af=_0x3a2bb8?_0x2934b5[_0xf603('0x1f')]:_0x2364ba[_0xf603('0x1d')]+_0x2364ba[_0xf603('0x20')];var _0x1f785b;if(_0x33a0af>=_0x4a9caa){_0x33a0af=_0x4a9caa;_0x1f785b=0xc8;}else{_0x1f785b=0xce;}_0x550b07[_0xf603('0x1b')](_0x1f785b);return _0x550b07[_0xf603('0x21')]('Content-Range',_0x56340f+'-'+_0x33a0af+'/'+_0x4a9caa)['json'](_0x2934b5);}return null;};}function patchUpdates(_0x5be48e){return function(_0x503e1b){try{jsonpatch['apply'](_0x503e1b,_0x5be48e,!![]);}catch(_0x16511e){return BPromise[_0xf603('0x22')](_0x16511e);}return _0x503e1b[_0xf603('0x23')]();};}function saveUpdates(_0x2174e6,_0x3221b3){return function(_0x5284dc){if(_0x5284dc){return _0x5284dc['update'](_0x2174e6)[_0xf603('0x24')](function(_0x5bbbad){return _0x5bbbad;});}return null;};}function removeEntity(_0x25f35b,_0x1afcad){return function(_0x14d7ce){if(_0x14d7ce){return _0x14d7ce[_0xf603('0x25')]()[_0xf603('0x24')](function(){_0x25f35b[_0xf603('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20e46d,_0x2f2157){return function(_0x20d9f4){if(!_0x20d9f4){_0x20e46d[_0xf603('0x1a')](0x194);}return _0x20d9f4;};}function handleError(_0x1f060d,_0x55ff40){_0x55ff40=_0x55ff40||0x1f4;return function(_0x20dc36){logger['error'](_0x20dc36[_0xf603('0x26')]);if(_0x20dc36[_0xf603('0x27')]){delete _0x20dc36[_0xf603('0x27')];}_0x1f060d['status'](_0x55ff40)[_0xf603('0x28')](_0x20dc36);};}function getMustacheRender(_0x52702f,_0x1f69dd){return Mustache[_0xf603('0x29')](_0x52702f,_[_0xf603('0x2a')](_0x1f69dd[_0xf603('0x2b')],{'contact':_0x1f69dd['contact'],'message':_0x1f69dd[_0xf603('0x2c')],'agent':_0x1f69dd[_0xf603('0x2d')],'interaction':_0x1f69dd[_0xf603('0x2e')],'account':_0x1f69dd[_0xf603('0x2f')]}))||'';}exports[_0xf603('0x30')]=function(_0x5f3045,_0x36a06a){var _0x3564fd={'raw':!![],'where':{'id':_0x5f3045[_0xf603('0x31')]['id']}},_0x34197d={};_0x34197d[_0xf603('0x32')]=_[_0xf603('0x33')](db[_0xf603('0x34')]['rawAttributes']);_0x34197d[_0xf603('0x35')]=_[_0xf603('0x33')](_0x5f3045['query']);_0x34197d[_0xf603('0x36')]=_[_0xf603('0x37')](_0x34197d[_0xf603('0x32')],_0x34197d[_0xf603('0x35')]);_0x3564fd[_0xf603('0x38')]=_[_0xf603('0x37')](_0x34197d[_0xf603('0x32')],qs['fields'](_0x5f3045['query']['fields']));_0x3564fd[_0xf603('0x38')]=_0x3564fd[_0xf603('0x38')]['length']?_0x3564fd[_0xf603('0x38')]:_0x34197d[_0xf603('0x32')];if(_0x5f3045['query'][_0xf603('0x39')]){_0x3564fd[_0xf603('0x3a')]=[{'all':!![]}];}_0x3564fd=_[_0xf603('0x2a')]({},_0x3564fd,_0x5f3045[_0xf603('0x3b')]);return db[_0xf603('0x34')][_0xf603('0x3c')](_0x3564fd)['then'](handleEntityNotFound(_0x36a06a,null))[_0xf603('0x24')](respondWithResult(_0x36a06a,null))[_0xf603('0x3d')](handleError(_0x36a06a,null));};exports['create']=function(_0x36908a,_0x1d21d7){return db[_0xf603('0x34')]['create'](_0x36908a[_0xf603('0x2b')],{})[_0xf603('0x24')](respondWithResult(_0x1d21d7,0xc9))['catch'](handleError(_0x1d21d7,null));};exports[_0xf603('0x3e')]=function(_0x418ea8,_0x5cc05b){if(_0x418ea8[_0xf603('0x2b')]['id']){delete _0x418ea8[_0xf603('0x2b')]['id'];}return db[_0xf603('0x34')][_0xf603('0x3c')]({'where':{'id':_0x418ea8[_0xf603('0x31')]['id']}})[_0xf603('0x24')](handleEntityNotFound(_0x5cc05b,null))['then'](saveUpdates(_0x418ea8['body'],null))['then'](respondWithResult(_0x5cc05b,null))['catch'](handleError(_0x5cc05b,null));};exports[_0xf603('0x25')]=function(_0x5012e2,_0x1a11e4){return db[_0xf603('0x34')][_0xf603('0x3c')]({'where':{'id':_0x5012e2[_0xf603('0x31')]['id']}})[_0xf603('0x24')](handleEntityNotFound(_0x1a11e4,null))['then'](removeEntity(_0x1a11e4,null))[_0xf603('0x3d')](handleError(_0x1a11e4,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index c0ad98c..e42360e 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 _0xc841=['api','moment','bluebird','rimraf','../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','util'];(function(_0x3e4387,_0x2120b1){var _0x29ef48=function(_0x1105fd){while(--_0x1105fd){_0x3e4387['push'](_0x3e4387['shift']());}};_0x29ef48(++_0x2120b1);}(_0xc841,0x153));var _0x1c84=function(_0xd6ee02,_0x33a6aa){_0xd6ee02=_0xd6ee02-0x0;var _0x11087d=_0xc841[_0xd6ee02];return _0x11087d;};'use strict';var _=require(_0x1c84('0x0'));var util=require(_0x1c84('0x1'));var logger=require('../../config/logger')(_0x1c84('0x2'));var moment=require(_0x1c84('0x3'));var BPromise=require(_0x1c84('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1c84('0x5'));var config=require(_0x1c84('0x6'));var attributes=require(_0x1c84('0x7'));module['exports']=function(_0x394b6c,_0x237eab){return _0x394b6c[_0x1c84('0x8')](_0x1c84('0x9'),attributes,{'tableName':_0x1c84('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8774=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x8774,0x1e0));var _0x4877=function(_0x3ac684,_0x161532){_0x3ac684=_0x3ac684-0x0;var _0x5bc94b=_0x8774[_0x3ac684];return _0x5bc94b;};'use strict';var _=require(_0x4877('0x0'));var util=require(_0x4877('0x1'));var logger=require(_0x4877('0x2'))(_0x4877('0x3'));var moment=require(_0x4877('0x4'));var BPromise=require(_0x4877('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4877('0x6'));var rimraf=require(_0x4877('0x7'));var config=require('../../config/environment');var attributes=require(_0x4877('0x8'));module[_0x4877('0x9')]=function(_0x313adc,_0x5a53fd){return _0x313adc[_0x4877('0xa')](_0x4877('0xb'),attributes,{'tableName':'chat_proactive_actions','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 3dac7b2..8ce6fdb 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 _0xfc85=['client','http','request','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x58ab89,_0xf01b2d){var _0xb93c04=function(_0x29e1b2){while(--_0x29e1b2){_0x58ab89['push'](_0x58ab89['shift']());}};_0xb93c04(++_0xf01b2d);}(_0xfc85,0x1d9));var _0x5fc8=function(_0x210d93,_0x1e6dba){_0x210d93=_0x210d93-0x0;var _0x10601a=_0xfc85[_0x210d93];return _0x10601a;};'use strict';var _=require(_0x5fc8('0x0'));var util=require(_0x5fc8('0x1'));var moment=require(_0x5fc8('0x2'));var BPromise=require(_0x5fc8('0x3'));var rs=require(_0x5fc8('0x4'));var fs=require('fs');var Redis=require(_0x5fc8('0x5'));var db=require(_0x5fc8('0x6'))['db'];var utils=require(_0x5fc8('0x7'));var logger=require(_0x5fc8('0x8'))('rpc');var config=require(_0x5fc8('0x9'));var jayson=require(_0x5fc8('0xa'));var client=jayson[_0x5fc8('0xb')][_0x5fc8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c3d13,_0x2a132d,_0x60a58a){return new BPromise(function(_0x4e7b97,_0x5683b0){return client[_0x5fc8('0xd')](_0x2c3d13,_0x60a58a)['then'](function(_0x10af14){logger['info'](_0x5fc8('0xe'),_0x2a132d,'request\x20sent');logger[_0x5fc8('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2a132d,_0x5fc8('0x10'),JSON['stringify'](_0x10af14));if(_0x10af14[_0x5fc8('0x11')]){if(_0x10af14[_0x5fc8('0x11')][_0x5fc8('0x12')]===0x1f4){logger['error'](_0x5fc8('0xe'),_0x2a132d,_0x10af14[_0x5fc8('0x11')][_0x5fc8('0x13')]);return _0x5683b0(_0x10af14[_0x5fc8('0x11')]['message']);}logger['error'](_0x5fc8('0xe'),_0x2a132d,_0x10af14[_0x5fc8('0x11')]['message']);return _0x4e7b97(_0x10af14['error'][_0x5fc8('0x13')]);}else{logger[_0x5fc8('0x14')](_0x5fc8('0xe'),_0x2a132d,_0x5fc8('0x10'));_0x4e7b97(_0x10af14['result'][_0x5fc8('0x13')]);}})[_0x5fc8('0x15')](function(_0xcce242){logger[_0x5fc8('0x11')](_0x5fc8('0xe'),_0x2a132d,_0xcce242);_0x5683b0(_0xcce242);});});} \ No newline at end of file +var _0xd571=['../../config/environment','client','http','request','then','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','catch','lodash','randomstring','ioredis','../../config/utils'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xd571,0x94));var _0x1d57=function(_0x1e4cbf,_0x34e2a1){_0x1e4cbf=_0x1e4cbf-0x0;var _0x5bf4d4=_0xd571[_0x1e4cbf];return _0x5bf4d4;};'use strict';var _=require(_0x1d57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d57('0x1'));var fs=require('fs');var Redis=require(_0x1d57('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d57('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x1d57('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x1d57('0x5')][_0x1d57('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x511697,_0x5d5cdf,_0xa5e411){return new BPromise(function(_0x160613,_0x25f92a){return client[_0x1d57('0x7')](_0x511697,_0xa5e411)[_0x1d57('0x8')](function(_0x338d05){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5d5cdf,_0x1d57('0x9'));logger[_0x1d57('0xa')](_0x1d57('0xb'),_0x5d5cdf,_0x1d57('0x9'),JSON[_0x1d57('0xc')](_0x338d05));if(_0x338d05[_0x1d57('0xd')]){if(_0x338d05[_0x1d57('0xd')][_0x1d57('0xe')]===0x1f4){logger['error'](_0x1d57('0xf'),_0x5d5cdf,_0x338d05[_0x1d57('0xd')][_0x1d57('0x10')]);return _0x25f92a(_0x338d05['error'][_0x1d57('0x10')]);}logger['error'](_0x1d57('0xf'),_0x5d5cdf,_0x338d05[_0x1d57('0xd')]['message']);return _0x160613(_0x338d05['error'][_0x1d57('0x10')]);}else{logger[_0x1d57('0x11')](_0x1d57('0xf'),_0x5d5cdf,_0x1d57('0x9'));_0x160613(_0x338d05['result']['message']);}})[_0x1d57('0x12')](function(_0x5f0d3f){logger[_0x1d57('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5d5cdf,_0x5f0d3f);_0x25f92a(_0x5f0d3f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 18bc995..9cc58d1 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 _0x39c5=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated','create','put','update','delete','destroy'];(function(_0x523a03,_0x47d6d3){var _0x1f6f00=function(_0x3396ca){while(--_0x3396ca){_0x523a03['push'](_0x523a03['shift']());}};_0x1f6f00(++_0x47d6d3);}(_0x39c5,0x145));var _0x539c=function(_0x80785c,_0x16b54d){_0x80785c=_0x80785c-0x0;var _0x1ae31a=_0x39c5[_0x80785c];return _0x1ae31a;};'use strict';var multer=require(_0x539c('0x0'));var util=require(_0x539c('0x1'));var path=require('path');var timeout=require(_0x539c('0x2'));var express=require(_0x539c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x539c('0x4'));var interaction=require(_0x539c('0x5'));var config=require(_0x539c('0x6'));var controller=require(_0x539c('0x7'));router[_0x539c('0x8')](_0x539c('0x9'),auth['isAuthenticated'](),controller[_0x539c('0xa')]);router['post']('/',auth[_0x539c('0xb')](),controller[_0x539c('0xc')]);router[_0x539c('0xd')]('/:id',auth[_0x539c('0xb')](),controller[_0x539c('0xe')]);router[_0x539c('0xf')](_0x539c('0x9'),auth[_0x539c('0xb')](),controller[_0x539c('0x10')]);module[_0x539c('0x11')]=router; \ No newline at end of file +var _0xfeb6=['post','create','put','update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x31ab89,_0x339e8e){var _0x3dac45=function(_0x5f431a){while(--_0x5f431a){_0x31ab89['push'](_0x31ab89['shift']());}};_0x3dac45(++_0x339e8e);}(_0xfeb6,0x9f));var _0x6feb=function(_0x257b45,_0x16f984){_0x257b45=_0x257b45-0x0;var _0x501ca4=_0xfeb6[_0x257b45];return _0x501ca4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6feb('0x0'));var timeout=require('connect-timeout');var express=require(_0x6feb('0x1'));var router=express[_0x6feb('0x2')]();var fs_extra=require(_0x6feb('0x3'));var auth=require(_0x6feb('0x4'));var interaction=require(_0x6feb('0x5'));var config=require(_0x6feb('0x6'));var controller=require(_0x6feb('0x7'));router[_0x6feb('0x8')](_0x6feb('0x9'),auth[_0x6feb('0xa')](),controller['show']);router[_0x6feb('0xb')]('/',auth[_0x6feb('0xa')](),controller[_0x6feb('0xc')]);router[_0x6feb('0xd')](_0x6feb('0x9'),auth[_0x6feb('0xa')](),controller[_0x6feb('0xe')]);router['delete'](_0x6feb('0x9'),auth[_0x6feb('0xa')](),controller[_0x6feb('0xf')]);module[_0x6feb('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 69910f3..8659a64 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 _0x17fd=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x17fd,0xf7));var _0xd17f=function(_0x3f192e,_0x1cd39e){_0x3f192e=_0x3f192e-0x0;var _0x2b55ff=_0x17fd[_0x3f192e];return _0x2b55ff;};'use strict';var Sequelize=require(_0xd17f('0x0'));module[_0xd17f('0x1')]={'name':{'type':Sequelize[_0xd17f('0x2')],'unique':_0xd17f('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd17f('0x2')]},'timeout':{'type':Sequelize[_0xd17f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd17f('0x5')](_0xd17f('0x6'),'beepall',_0xd17f('0x7'))}}; \ No newline at end of file +var _0xfc2e=['roundrobin','sequelize','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xfc2e,0x179));var _0xefc2=function(_0x4e9f1f,_0x1b1068){_0x4e9f1f=_0x4e9f1f-0x0;var _0x40f102=_0xfc2e[_0x4e9f1f];return _0x40f102;};'use strict';var Sequelize=require(_0xefc2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xefc2('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xefc2('0x2')]},'timeout':{'type':Sequelize[_0xefc2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xefc2('0x4')](_0xefc2('0x5'),_0xefc2('0x6'),_0xefc2('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 8d27f6f..25ef983 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 _0xe626=['ChatQueueId\x20=\x20?','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','spread','isArray','getAgents','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','redis','defaults','localhost','./chatQueue.socket','register','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','limit','offset','count','reject','update','destroy','get','ChatQueues','UserProfileResource','name','send','render','merge','body','agent','index','ChatQueue','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','map','options','includeAll','include','findAll','rows','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','describe','getMembers','findOne','UserChatQueue','nolimit','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','online','interface','flatMap','sequelize','transaction','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','from','team_has_chat_queues','join','user_has_teams'];(function(_0x2e7fee,_0x6b0532){var _0x508040=function(_0x5ce51a){while(--_0x5ce51a){_0x2e7fee['push'](_0x2e7fee['shift']());}};_0x508040(++_0x6b0532);}(_0xe626,0x9d));var _0x6e62=function(_0x11c328,_0x1f5158){_0x11c328=_0x11c328-0x0;var _0x4f608c=_0xe626[_0x11c328];return _0x4f608c;};'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'];config[_0x6e62('0x17')]=_[_0x6e62('0x18')](config[_0x6e62('0x17')],{'host':_0x6e62('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6e62('0x1a'))[_0x6e62('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6e62('0x1c')][_0x6e62('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x19a80d,_0x3f4e35,_0x58d84e,_0x416158){return new BPromise(function(_0x19deb1,_0x8aef1b){var _0x35748b=_0x416158||client;return _0x35748b[_0x6e62('0x1e')](_0x19a80d,_0x58d84e)[_0x6e62('0x1f')](function(_0x42c2ea){logger[_0x6e62('0x20')](_0x6e62('0x21'),_0x3f4e35,_0x6e62('0x22'));logger['debug'](_0x6e62('0x23'),_0x3f4e35,_0x6e62('0x22'),JSON['stringify'](_0x42c2ea));if(_0x42c2ea[_0x6e62('0x24')]){if(_0x42c2ea['error'][_0x6e62('0x25')]===0x1f4){logger[_0x6e62('0x24')](_0x6e62('0x21'),_0x3f4e35,_0x42c2ea[_0x6e62('0x24')][_0x6e62('0x26')]);return _0x8aef1b(_0x42c2ea[_0x6e62('0x24')][_0x6e62('0x26')]);}logger[_0x6e62('0x24')](_0x6e62('0x21'),_0x3f4e35,_0x42c2ea[_0x6e62('0x24')][_0x6e62('0x26')]);return _0x19deb1(_0x42c2ea['error'][_0x6e62('0x26')]);}else{logger['info'](_0x6e62('0x21'),_0x3f4e35,_0x6e62('0x22'));_0x19deb1(_0x42c2ea[_0x6e62('0x27')][_0x6e62('0x26')]);}})[_0x6e62('0x28')](function(_0x425d1c){logger[_0x6e62('0x24')](_0x6e62('0x21'),_0x3f4e35,_0x425d1c);_0x8aef1b(_0x425d1c);});});}function respondWithStatusCode(_0x2e4fe1,_0x448691){_0x448691=_0x448691||0xcc;return function(_0x5a6ffa){if(_0x5a6ffa){return _0x2e4fe1[_0x6e62('0x29')](_0x448691);}return _0x2e4fe1['status'](_0x448691)[_0x6e62('0x2a')]();};}function respondWithResult(_0x2f9baf,_0x318fc3){_0x318fc3=_0x318fc3||0xc8;return function(_0x17fee0){if(_0x17fee0){return _0x2f9baf[_0x6e62('0x2b')](_0x318fc3)[_0x6e62('0x2c')](_0x17fee0);}};}function respondWithFilteredResult(_0x4ecc45,_0x958169){return function(_0x26c991){if(_0x26c991){var _0x14cd51=typeof _0x958169['offset']==='undefined'&&typeof _0x958169[_0x6e62('0x2d')]==='undefined';var _0x479b12=_0x26c991['count'];var _0x5656d8=_0x14cd51?0x0:_0x958169[_0x6e62('0x2e')];var _0x4c6af1=_0x14cd51?_0x26c991[_0x6e62('0x2f')]:_0x958169['offset']+_0x958169[_0x6e62('0x2d')];var _0x2fb5ce;if(_0x4c6af1>=_0x479b12){_0x4c6af1=_0x479b12;_0x2fb5ce=0xc8;}else{_0x2fb5ce=0xce;}_0x4ecc45[_0x6e62('0x2b')](_0x2fb5ce);return _0x4ecc45['set']('Content-Range',_0x5656d8+'-'+_0x4c6af1+'/'+_0x479b12)[_0x6e62('0x2c')](_0x26c991);}return null;};}function patchUpdates(_0xb8d42e){return function(_0x578607){try{jsonpatch['apply'](_0x578607,_0xb8d42e,!![]);}catch(_0x53dfaa){return BPromise[_0x6e62('0x30')](_0x53dfaa);}return _0x578607['save']();};}function saveUpdates(_0xde2488,_0x6af555){return function(_0x3dc663){if(_0x3dc663){return _0x3dc663[_0x6e62('0x31')](_0xde2488)[_0x6e62('0x1f')](function(_0x4c8ed1){return _0x4c8ed1;});}return null;};}function removeEntity(_0x4b8397,_0x451e19){return function(_0x3e33e5){if(_0x3e33e5){return _0x3e33e5[_0x6e62('0x32')]()[_0x6e62('0x1f')](function(){var _0xf650a=_0x3e33e5[_0x6e62('0x33')]({'plain':!![]});var _0x9c62b=_0x6e62('0x34');return db[_0x6e62('0x35')]['destroy']({'where':{'type':_0x9c62b,'resourceId':_0xf650a['id']}})[_0x6e62('0x1f')](function(){return _0x3e33e5;});})[_0x6e62('0x1f')](function(){_0x4b8397[_0x6e62('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x134efd,_0x1e751d){return function(_0x504593){if(!_0x504593){_0x134efd[_0x6e62('0x29')](0x194);}return _0x504593;};}function handleError(_0x231120,_0x186e3c){_0x186e3c=_0x186e3c||0x1f4;return function(_0xa4f73a){logger[_0x6e62('0x24')](_0xa4f73a['stack']);if(_0xa4f73a[_0x6e62('0x36')]){delete _0xa4f73a[_0x6e62('0x36')];}_0x231120[_0x6e62('0x2b')](_0x186e3c)[_0x6e62('0x37')](_0xa4f73a);};}function getMustacheRender(_0x3f069c,_0x4900b0){return Mustache[_0x6e62('0x38')](_0x3f069c,_[_0x6e62('0x39')](_0x4900b0[_0x6e62('0x3a')],{'contact':_0x4900b0['contact'],'message':_0x4900b0[_0x6e62('0x26')],'agent':_0x4900b0[_0x6e62('0x3b')],'interaction':_0x4900b0['interaction'],'account':_0x4900b0['account']}))||'';}exports[_0x6e62('0x3c')]=function(_0x1c2ee1,_0x458ec0){var _0x5257be={},_0x5133a2={},_0x1ef318={'count':0x0,'rows':[]};var _0x4ac790=_['map'](db[_0x6e62('0x3d')][_0x6e62('0x3e')],function(_0xd07973){return{'name':_0xd07973[_0x6e62('0x3f')],'type':_0xd07973[_0x6e62('0x40')]['key']};});_0x5133a2[_0x6e62('0x41')]=_['map'](_0x4ac790,'name');_0x5133a2[_0x6e62('0x42')]=_[_0x6e62('0x43')](_0x1c2ee1[_0x6e62('0x42')]);_0x5133a2['filters']=_[_0x6e62('0x44')](_0x5133a2['model'],_0x5133a2[_0x6e62('0x42')]);_0x5257be[_0x6e62('0x45')]=_[_0x6e62('0x44')](_0x5133a2[_0x6e62('0x41')],qs[_0x6e62('0x46')](_0x1c2ee1[_0x6e62('0x42')][_0x6e62('0x46')]));_0x5257be[_0x6e62('0x45')]=_0x5257be[_0x6e62('0x45')][_0x6e62('0x47')]?_0x5257be['attributes']:_0x5133a2['model'];if(!_0x1c2ee1['query'][_0x6e62('0x48')]('nolimit')){_0x5257be[_0x6e62('0x2d')]=qs[_0x6e62('0x2d')](_0x1c2ee1['query'][_0x6e62('0x2d')]);_0x5257be[_0x6e62('0x2e')]=qs[_0x6e62('0x2e')](_0x1c2ee1[_0x6e62('0x42')][_0x6e62('0x2e')]);}_0x5257be[_0x6e62('0x49')]=qs[_0x6e62('0x4a')](_0x1c2ee1[_0x6e62('0x42')][_0x6e62('0x4a')]);_0x5257be[_0x6e62('0x4b')]=qs[_0x6e62('0x4c')](_[_0x6e62('0x4d')](_0x1c2ee1[_0x6e62('0x42')],_0x5133a2['filters']),_0x4ac790);if(_0x1c2ee1[_0x6e62('0x42')][_0x6e62('0x4e')]){_0x5257be['where']=_[_0x6e62('0x39')](_0x5257be['where'],{'$or':_[_0x6e62('0x4f')](_0x4ac790,function(_0x1aaec8){if(_0x1aaec8[_0x6e62('0x40')]!=='VIRTUAL'){var _0x447fc2={};_0x447fc2[_0x1aaec8[_0x6e62('0x36')]]={'$like':'%'+_0x1c2ee1[_0x6e62('0x42')][_0x6e62('0x4e')]+'%'};return _0x447fc2;}})});}_0x5257be=_[_0x6e62('0x39')]({},_0x5257be,_0x1c2ee1[_0x6e62('0x50')]);var _0x20ec84={'where':_0x5257be[_0x6e62('0x4b')]};return db[_0x6e62('0x3d')][_0x6e62('0x2f')](_0x20ec84)[_0x6e62('0x1f')](function(_0x5613a0){_0x1ef318['count']=_0x5613a0;if(_0x1c2ee1[_0x6e62('0x42')][_0x6e62('0x51')]){_0x5257be[_0x6e62('0x52')]=[{'all':!![]}];}return db[_0x6e62('0x3d')][_0x6e62('0x53')](_0x5257be);})[_0x6e62('0x1f')](function(_0x5b474f){_0x1ef318[_0x6e62('0x54')]=_0x5b474f;return _0x1ef318;})['then'](respondWithFilteredResult(_0x458ec0,_0x5257be))[_0x6e62('0x28')](handleError(_0x458ec0,null));};exports[_0x6e62('0x55')]=function(_0x3f9dd5,_0x7463fd){var _0x43afc9={'raw':!![],'where':{'id':_0x3f9dd5[_0x6e62('0x56')]['id']}},_0x498f95={};_0x498f95[_0x6e62('0x41')]=_[_0x6e62('0x43')](db[_0x6e62('0x3d')]['rawAttributes']);_0x498f95[_0x6e62('0x42')]=_['keys'](_0x3f9dd5[_0x6e62('0x42')]);_0x498f95[_0x6e62('0x4c')]=_[_0x6e62('0x44')](_0x498f95[_0x6e62('0x41')],_0x498f95[_0x6e62('0x42')]);_0x43afc9[_0x6e62('0x45')]=_[_0x6e62('0x44')](_0x498f95['model'],qs[_0x6e62('0x46')](_0x3f9dd5['query'][_0x6e62('0x46')]));_0x43afc9[_0x6e62('0x45')]=_0x43afc9[_0x6e62('0x45')][_0x6e62('0x47')]?_0x43afc9[_0x6e62('0x45')]:_0x498f95['model'];if(_0x3f9dd5[_0x6e62('0x42')]['includeAll']){_0x43afc9[_0x6e62('0x52')]=[{'all':!![]}];}_0x43afc9=_[_0x6e62('0x39')]({},_0x43afc9,_0x3f9dd5[_0x6e62('0x50')]);return db['ChatQueue'][_0x6e62('0x57')](_0x43afc9)[_0x6e62('0x1f')](handleEntityNotFound(_0x7463fd,null))['then'](respondWithResult(_0x7463fd,null))[_0x6e62('0x28')](handleError(_0x7463fd,null));};exports['create']=function(_0x3de583,_0x5bf3ef){return db[_0x6e62('0x3d')][_0x6e62('0x58')](_0x3de583['body'],{})[_0x6e62('0x1f')](function(_0x2f4f20){var _0x58b2e2=_0x3de583['user'][_0x6e62('0x33')]({'plain':!![]});if(!_0x58b2e2)throw new Error(_0x6e62('0x59'));if(_0x58b2e2[_0x6e62('0x5a')]===_0x6e62('0x5b')){var _0x171686=_0x2f4f20[_0x6e62('0x33')]({'plain':!![]});var _0x21b99c='ChatQueues';return db[_0x6e62('0x5c')][_0x6e62('0x57')]({'where':{'name':_0x21b99c,'userProfileId':_0x58b2e2[_0x6e62('0x5d')]},'raw':!![]})[_0x6e62('0x1f')](function(_0x109ff5){if(_0x109ff5&&_0x109ff5['autoAssociation']===0x0){return db[_0x6e62('0x35')][_0x6e62('0x58')]({'name':_0x171686['name'],'resourceId':_0x171686['id'],'type':_0x109ff5[_0x6e62('0x36')],'sectionId':_0x109ff5['id']},{})[_0x6e62('0x1f')](function(){return _0x2f4f20;});}else{return _0x2f4f20;}})[_0x6e62('0x28')](function(_0x2656cd){logger[_0x6e62('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2656cd);throw _0x2656cd;});}return _0x2f4f20;})[_0x6e62('0x1f')](respondWithResult(_0x5bf3ef,0xc9))[_0x6e62('0x28')](handleError(_0x5bf3ef,null));};exports[_0x6e62('0x31')]=function(_0x537cac,_0x2254ea){if(_0x537cac[_0x6e62('0x3a')]['id']){delete _0x537cac['body']['id'];}return db[_0x6e62('0x3d')]['find']({'where':{'id':_0x537cac[_0x6e62('0x56')]['id']}})[_0x6e62('0x1f')](handleEntityNotFound(_0x2254ea,null))[_0x6e62('0x1f')](saveUpdates(_0x537cac['body'],null))['then'](respondWithResult(_0x2254ea,null))[_0x6e62('0x28')](handleError(_0x2254ea,null));};exports[_0x6e62('0x32')]=function(_0x24e7d0,_0x92811d){return db[_0x6e62('0x3d')][_0x6e62('0x57')]({'where':{'id':_0x24e7d0[_0x6e62('0x56')]['id']}})[_0x6e62('0x1f')](handleEntityNotFound(_0x92811d,null))['then'](removeEntity(_0x92811d,null))[_0x6e62('0x28')](handleError(_0x92811d,null));};exports[_0x6e62('0x5e')]=function(_0x4e7ba3,_0x420455){return db['ChatQueue'][_0x6e62('0x5e')]()[_0x6e62('0x1f')](respondWithResult(_0x420455,null))[_0x6e62('0x28')](handleError(_0x420455,null));};exports[_0x6e62('0x5f')]=function(_0x5bbea0,_0x597a20,_0x1c4c3c){var _0xa15705={'raw':!![],'where':{}},_0x1a637b={},_0x1ccbff;return db[_0x6e62('0x3d')][_0x6e62('0x60')]({'where':{'id':_0x5bbea0[_0x6e62('0x56')]['id']}})[_0x6e62('0x1f')](handleEntityNotFound(_0x597a20,null))['then'](function(_0x1785bc){if(_0x1785bc){_0x1ccbff=_0x1785bc[_0x6e62('0x33')]({'plain':!![]});_0x1a637b[_0x6e62('0x41')]=_[_0x6e62('0x43')](db[_0x6e62('0x61')][_0x6e62('0x3e')]);_0x1a637b[_0x6e62('0x42')]=_[_0x6e62('0x43')](_0x5bbea0[_0x6e62('0x42')]);_0x1a637b['filters']=_[_0x6e62('0x44')](_0x1a637b[_0x6e62('0x41')],_0x1a637b[_0x6e62('0x42')]);_0xa15705[_0x6e62('0x45')]=_[_0x6e62('0x44')](_0x1a637b[_0x6e62('0x41')],qs[_0x6e62('0x46')](_0x5bbea0[_0x6e62('0x42')][_0x6e62('0x46')]));_0xa15705[_0x6e62('0x45')]=_0xa15705[_0x6e62('0x45')][_0x6e62('0x47')]?_0xa15705[_0x6e62('0x45')]:_0x1a637b[_0x6e62('0x41')];if(!_0x5bbea0[_0x6e62('0x42')][_0x6e62('0x48')](_0x6e62('0x62'))){_0xa15705['limit']=qs[_0x6e62('0x2d')](_0x5bbea0[_0x6e62('0x42')][_0x6e62('0x2d')]);_0xa15705[_0x6e62('0x2e')]=qs['offset'](_0x5bbea0[_0x6e62('0x42')][_0x6e62('0x2e')]);}_0xa15705[_0x6e62('0x49')]=qs['sort'](_0x5bbea0[_0x6e62('0x42')][_0x6e62('0x4a')]);_0xa15705[_0x6e62('0x4b')]=qs[_0x6e62('0x4c')](_['pick'](_0x5bbea0[_0x6e62('0x42')],_0x1a637b[_0x6e62('0x4c')]));_0xa15705[_0x6e62('0x4b')][_0x6e62('0x63')]=_0x1785bc['id'];if(_0x5bbea0[_0x6e62('0x42')][_0x6e62('0x4e')]){_0xa15705[_0x6e62('0x4b')]=_[_0x6e62('0x39')](_0xa15705[_0x6e62('0x4b')],{'$or':_[_0x6e62('0x4f')](_0xa15705[_0x6e62('0x45')],function(_0x25daa9){var _0x1cd07e={};_0x1cd07e[_0x25daa9]={'$like':'%'+_0x5bbea0[_0x6e62('0x42')]['filter']+'%'};return _0x1cd07e;})});}_0xa15705=_[_0x6e62('0x39')]({},_0xa15705,_0x5bbea0[_0x6e62('0x50')]);return db[_0x6e62('0x61')][_0x6e62('0x53')](_0xa15705);}})[_0x6e62('0x1f')](function(_0x26a242){if(_0x26a242){return db[_0x6e62('0x64')][_0x6e62('0x65')]({'where':{'id':_['map'](_0x26a242,_0x6e62('0x66')),'role':_0x6e62('0x3b')},'attributes':['id',_0x6e62('0x36'),_0x6e62('0x67'),_0x6e62('0x68'),_0x6e62('0x69')]});}})[_0x6e62('0x1f')](function(_0x489e44){if(_0x489e44){return{'count':_0x489e44[_0x6e62('0x2f')],'rows':_[_0x6e62('0x4f')](_0x489e44[_0x6e62('0x54')],function(_0x12bf32){return{'membername':_0x12bf32[_0x6e62('0x36')],'UserId':_0x12bf32['id'],'queue_name':_0x1ccbff[_0x6e62('0x36')],'ChatQueueId':_0x1ccbff['id'],'interface':util[_0x6e62('0x6a')](_0x6e62('0x6b'),_0x6e62('0x6c'),_0x12bf32[_0x6e62('0x36')]),'penalty':0x0,'paused':_0x12bf32[_0x6e62('0x67')],'createdAt':_0x12bf32[_0x6e62('0x69')],'updatedAt':_0x12bf32[_0x6e62('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6e62('0x1f')](respondWithFilteredResult(_0x597a20,_0xa15705))[_0x6e62('0x28')](handleError(_0x597a20,null));};exports[_0x6e62('0x6d')]=function(_0x4577c0,_0x46f419,_0x4cfd7b){var _0x349d64={};var _0x1a1303={};var _0x263105;var _0x28a758;return db[_0x6e62('0x3d')][_0x6e62('0x60')]({'where':{'id':_0x4577c0['params']['id']}})[_0x6e62('0x1f')](handleEntityNotFound(_0x46f419,null))[_0x6e62('0x1f')](function(_0x518213){if(_0x518213){_0x263105=_0x518213;_0x1a1303[_0x6e62('0x41')]=_['keys'](db['Team'][_0x6e62('0x3e')]);_0x1a1303[_0x6e62('0x42')]=_[_0x6e62('0x43')](_0x4577c0[_0x6e62('0x42')]);_0x1a1303['filters']=_[_0x6e62('0x44')](_0x1a1303[_0x6e62('0x41')],_0x1a1303[_0x6e62('0x42')]);_0x349d64[_0x6e62('0x45')]=_['intersection'](_0x1a1303[_0x6e62('0x41')],qs[_0x6e62('0x46')](_0x4577c0[_0x6e62('0x42')]['fields']));_0x349d64[_0x6e62('0x45')]=_0x349d64['attributes']['length']?_0x349d64[_0x6e62('0x45')]:_0x1a1303[_0x6e62('0x41')];_0x349d64[_0x6e62('0x49')]=qs['sort'](_0x4577c0['query'][_0x6e62('0x4a')]);_0x349d64[_0x6e62('0x4b')]=qs[_0x6e62('0x4c')](_[_0x6e62('0x4d')](_0x4577c0[_0x6e62('0x42')],_0x1a1303['filters']));if(_0x4577c0[_0x6e62('0x42')][_0x6e62('0x4e')]){_0x349d64[_0x6e62('0x4b')]=_[_0x6e62('0x39')](_0x349d64['where'],{'$or':_['map'](_0x349d64[_0x6e62('0x45')],function(_0x33003b){var _0x5f1e80={};_0x5f1e80[_0x33003b]={'$like':'%'+_0x4577c0['query'][_0x6e62('0x4e')]+'%'};return _0x5f1e80;})});}_0x349d64=_[_0x6e62('0x39')]({},_0x349d64,_0x4577c0[_0x6e62('0x50')]);return _0x263105[_0x6e62('0x6d')](_0x349d64);}})[_0x6e62('0x1f')](function(_0x288955){if(_0x288955){_0x28a758=_0x288955[_0x6e62('0x47')];if(!_0x4577c0[_0x6e62('0x42')][_0x6e62('0x48')]('nolimit')){_0x349d64[_0x6e62('0x2d')]=qs[_0x6e62('0x2d')](_0x4577c0[_0x6e62('0x42')]['limit']);_0x349d64[_0x6e62('0x2e')]=qs['offset'](_0x4577c0[_0x6e62('0x42')][_0x6e62('0x2e')]);}return _0x263105['getTeams'](_0x349d64);}})[_0x6e62('0x1f')](function(_0x19879c){if(_0x19879c){return _0x19879c?{'count':_0x28a758,'rows':_0x19879c}:null;}})[_0x6e62('0x1f')](respondWithResult(_0x46f419,null))[_0x6e62('0x28')](handleError(_0x46f419,null));};exports[_0x6e62('0x6e')]=function(_0x35f31b,_0x162750,_0x519e98){var _0x5e14a2=_0x35f31b[_0x6e62('0x3a')]['ids'];return db[_0x6e62('0x6f')][_0x6e62('0x53')]({'where':{'id':_0x5e14a2},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6e62('0x70'),'attributes':['id','name',_0x6e62('0x71'),'voicePause',_0x6e62('0x72')],'raw':!![]}]})['then'](function(_0x1dfd45){if(_0x1dfd45){var _0x1161cd=_[_0x6e62('0x73')](_0x1dfd45,function(_0x47745e){var _0x45f361=_0x47745e['get']({'plain':!![]});return _0x45f361[_0x6e62('0x70')];});return db[_0x6e62('0x3d')][_0x6e62('0x57')]({'where':{'id':_0x35f31b[_0x6e62('0x56')]['id']}})[_0x6e62('0x1f')](function(_0x2049e4){return db[_0x6e62('0x74')][_0x6e62('0x75')](function(_0x7fa90b){return _0x2049e4[_0x6e62('0x6e')](_0x5e14a2,{'transaction':_0x7fa90b})[_0x6e62('0x1f')](function(){return BPromise['each'](_0x1161cd,function(_0x3db7f6){return db[_0x6e62('0x61')]['findOrCreate']({'where':{'UserId':_0x3db7f6['id'],'ChatQueueId':_0x35f31b['params']['id']},'transaction':_0x7fa90b});});})['then'](function(){_0x1161cd[_0x6e62('0x76')](function(_0x6f6e16){socket[_0x6e62('0x77')](_0x6e62('0x78'),{'UserId':_0x6f6e16['id'],'ChatQueueId':_0x2049e4['id']});});});});});}})['then'](respondWithStatusCode(_0x162750,null))['catch'](handleError(_0x162750,null));};exports[_0x6e62('0x79')]=function(_0x22cfd7,_0x3571f5,_0x23b57e){return db[_0x6e62('0x6f')][_0x6e62('0x53')]({'where':{'id':_0x22cfd7[_0x6e62('0x42')][_0x6e62('0x7a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6e62('0x70'),'attributes':['id'],'raw':!![]}]})[_0x6e62('0x1f')](handleEntityNotFound(_0x3571f5,null))[_0x6e62('0x1f')](function(_0x2164d2){var _0x156723=_[_0x6e62('0x4f')](_0x2164d2,'id');var _0x5849c9=[];var _0x4a617e=[];var _0x1f7fdb=squel[_0x6e62('0x7b')]();_0x1f7fdb[_0x6e62('0x7c')]('tq.TeamId')[_0x6e62('0x7d')](_0x6e62('0x7e'),'tq')[_0x6e62('0x7f')](_0x6e62('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x6e62('0x81'),_0x22cfd7[_0x6e62('0x56')]['id']);for(var _0x959380=0x0;_0x959380<_0x2164d2['length'];_0x959380+=0x1){let _0x519dbb=_0x2164d2[_0x959380];for(var _0xe836d8=0x0;_0xe836d8<_0x519dbb[_0x6e62('0x70')]['length'];_0xe836d8+=0x1){let _0x28d0fc=_0x519dbb[_0x6e62('0x70')][_0xe836d8];var _0x5ef47f=_0x1f7fdb['clone']();_0x5ef47f['where']('ut.UserId\x20=\x20?',_0x28d0fc['id']);_0x4a617e['push'](db['sequelize'][_0x6e62('0x42')](_0x5ef47f['toString'](),{'type':db[_0x6e62('0x74')][_0x6e62('0x82')][_0x6e62('0x83')]})[_0x6e62('0x1f')](function(_0x2809db){if(_0x2809db[_0x6e62('0x47')]===0x1){return _0x28d0fc['id'];}else{var _0x43c6b6=_['every'](_[_0x6e62('0x4f')](_0x2809db,_0x6e62('0x84')),function(_0x5cd737){return _['includes'](_0x156723,_0x5cd737);});if(_0x43c6b6){return _0x28d0fc['id'];}}}));}}return BPromise[_0x6e62('0x85')](_0x4a617e)[_0x6e62('0x1f')](function(_0x4e7ff9){_0x5849c9=_(_0x5849c9)[_0x6e62('0x86')](_0x4e7ff9)[_0x6e62('0x87')]()[_0x6e62('0x88')]();return db['ChatQueue'][_0x6e62('0x57')]({'where':{'id':_0x22cfd7['params']['id']}})[_0x6e62('0x1f')](function(_0x3f0e1f){return db[_0x6e62('0x74')][_0x6e62('0x75')](function(_0x231d19){return _0x3f0e1f[_0x6e62('0x79')](_0x22cfd7[_0x6e62('0x42')][_0x6e62('0x7a')],{'transaction':_0x231d19})['then'](function(){if(!_[_0x6e62('0x89')](_0x5849c9)){return _0x3f0e1f[_0x6e62('0x8a')](_0x5849c9,{'transaction':_0x231d19});}})['then'](function(){_0x5849c9[_0x6e62('0x76')](function(_0x159d5a){socket[_0x6e62('0x77')]('userChatQueue:remove',{'UserId':_0x159d5a,'ChatQueueId':_0x3f0e1f['id']});});});});});});})[_0x6e62('0x1f')](respondWithStatusCode(_0x3571f5,null))['catch'](handleError(_0x3571f5,null));};exports[_0x6e62('0x8b')]=function(_0x361b0c,_0x2eafde,_0x437c38){return db[_0x6e62('0x3d')]['find']({'where':{'id':_0x361b0c[_0x6e62('0x56')]['id']}})[_0x6e62('0x1f')](handleEntityNotFound(_0x2eafde,null))[_0x6e62('0x1f')](function(_0x3229f2){if(_0x3229f2){return _0x3229f2[_0x6e62('0x8b')](_0x361b0c['body']['ids'],_['omit'](_0x361b0c[_0x6e62('0x3a')],[_0x6e62('0x7a'),'id'])||{})[_0x6e62('0x8c')](function(_0x2749f7){for(var _0x5dd09a=0x0;_0x5dd09a<_0x361b0c['body'][_0x6e62('0x7a')][_0x6e62('0x47')];_0x5dd09a+=0x1){socket['emit'](_0x6e62('0x78'),{'UserId':_0x361b0c['body']['ids'][_0x5dd09a],'ChatQueueId':_0x361b0c['params']['id']});}return _0x2749f7;});}})[_0x6e62('0x1f')](respondWithResult(_0x2eafde,null))[_0x6e62('0x28')](handleError(_0x2eafde,null));};exports['removeAgents']=function(_0x11961d,_0x3ae486,_0x14de92){return db['ChatQueue'][_0x6e62('0x57')]({'where':{'id':_0x11961d[_0x6e62('0x56')]['id']}})['then'](handleEntityNotFound(_0x3ae486,null))[_0x6e62('0x1f')](function(_0x4151c3){if(_0x4151c3){return _0x4151c3[_0x6e62('0x8a')](_0x11961d['query'][_0x6e62('0x7a')])[_0x6e62('0x1f')](function(){if(_[_0x6e62('0x8d')](_0x11961d['query']['ids'])){for(var _0x5d8fde=0x0;_0x5d8fde<_0x11961d[_0x6e62('0x42')][_0x6e62('0x7a')]['length'];_0x5d8fde+=0x1){socket[_0x6e62('0x77')]('userChatQueue:remove',{'UserId':Number(_0x11961d[_0x6e62('0x42')]['ids'][_0x5d8fde]),'ChatQueueId':Number(_0x11961d[_0x6e62('0x56')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x11961d[_0x6e62('0x42')][_0x6e62('0x7a')]),'ChatQueueId':Number(_0x11961d[_0x6e62('0x56')]['id'])});}});}})[_0x6e62('0x1f')](respondWithStatusCode(_0x3ae486,null))[_0x6e62('0x28')](handleError(_0x3ae486,null));};exports[_0x6e62('0x8e')]=function(_0x3b2d26,_0x5a1d40,_0x3856c8){var _0x2a9bd6={};var _0x3ae5c0={};var _0x36283d;var _0x59a413;return db[_0x6e62('0x3d')]['findOne']({'where':{'id':_0x3b2d26[_0x6e62('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a1d40,null))['then'](function(_0x4f2140){if(_0x4f2140){_0x36283d=_0x4f2140;_0x3ae5c0[_0x6e62('0x41')]=_[_0x6e62('0x43')](db[_0x6e62('0x64')]['rawAttributes']);_0x3ae5c0[_0x6e62('0x42')]=_['keys'](_0x3b2d26['query']);_0x3ae5c0[_0x6e62('0x4c')]=_[_0x6e62('0x44')](_0x3ae5c0['model'],_0x3ae5c0[_0x6e62('0x42')]);_0x2a9bd6[_0x6e62('0x45')]=_['intersection'](_0x3ae5c0['model'],qs[_0x6e62('0x46')](_0x3b2d26['query']['fields']));_0x2a9bd6[_0x6e62('0x45')]=_0x2a9bd6[_0x6e62('0x45')][_0x6e62('0x47')]?_0x2a9bd6[_0x6e62('0x45')]:_0x3ae5c0['model'];_0x2a9bd6[_0x6e62('0x49')]=qs[_0x6e62('0x4a')](_0x3b2d26[_0x6e62('0x42')][_0x6e62('0x4a')]);_0x2a9bd6['where']=qs[_0x6e62('0x4c')](_[_0x6e62('0x4d')](_0x3b2d26['query'],_0x3ae5c0[_0x6e62('0x4c')]));if(_0x3b2d26[_0x6e62('0x42')][_0x6e62('0x4e')]){_0x2a9bd6[_0x6e62('0x4b')]=_['merge'](_0x2a9bd6['where'],{'$or':_[_0x6e62('0x4f')](_0x2a9bd6[_0x6e62('0x45')],function(_0x58b4b9){var _0x5629ad={};_0x5629ad[_0x58b4b9]={'$like':'%'+_0x3b2d26['query']['filter']+'%'};return _0x5629ad;})});}_0x2a9bd6=_[_0x6e62('0x39')]({},_0x2a9bd6,_0x3b2d26[_0x6e62('0x50')]);return _0x36283d[_0x6e62('0x8e')](_0x2a9bd6);}})[_0x6e62('0x1f')](function(_0x1d89d7){if(_0x1d89d7){_0x59a413=_0x1d89d7['length'];if(!_0x3b2d26[_0x6e62('0x42')]['hasOwnProperty'](_0x6e62('0x62'))){_0x2a9bd6[_0x6e62('0x2d')]=qs[_0x6e62('0x2d')](_0x3b2d26['query'][_0x6e62('0x2d')]);_0x2a9bd6[_0x6e62('0x2e')]=qs['offset'](_0x3b2d26[_0x6e62('0x42')]['offset']);}return _0x36283d[_0x6e62('0x8e')](_0x2a9bd6);}})[_0x6e62('0x1f')](function(_0x1750de){if(_0x1750de){return _0x1750de?{'count':_0x59a413,'rows':_0x1750de}:null;}})[_0x6e62('0x1f')](respondWithResult(_0x5a1d40,null))[_0x6e62('0x28')](handleError(_0x5a1d40,null));}; \ No newline at end of file +var _0xef17=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','userChatQueue:remove','addAgents','userChatQueue:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','then','info','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatQueue,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','status','json','undefined','limit','count','offset','apply','reject','update','destroy','ChatQueues','end','stack','name','send','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','ChatQueue','includeAll','params','include','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','User','findAndCountAll','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','findAll','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','field','tq.TeamId','from','team_has_chat_queues','join'];(function(_0x12184f,_0x59c61c){var _0x8c3283=function(_0x1aaabb){while(--_0x1aaabb){_0x12184f['push'](_0x12184f['shift']());}};_0x8c3283(++_0x59c61c);}(_0xef17,0x136));var _0x7ef1=function(_0x4eee5e,_0x199407){_0x4eee5e=_0x4eee5e-0x0;var _0x1537ee=_0xef17[_0x4eee5e];return _0x1537ee;};'use strict';var emlformat=require(_0x7ef1('0x0'));var rimraf=require(_0x7ef1('0x1'));var zipdir=require(_0x7ef1('0x2'));var jsonpatch=require(_0x7ef1('0x3'));var rp=require(_0x7ef1('0x4'));var moment=require(_0x7ef1('0x5'));var BPromise=require(_0x7ef1('0x6'));var Mustache=require(_0x7ef1('0x7'));var util=require(_0x7ef1('0x8'));var path=require('path');var sox=require(_0x7ef1('0x9'));var csv=require('to-csv');var ejs=require(_0x7ef1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ef1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ef1('0xc'));var deskjs=require(_0x7ef1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7ef1('0xe'));var Papa=require(_0x7ef1('0xf'));var Redis=require(_0x7ef1('0x10'));var authService=require(_0x7ef1('0x11'));var qs=require(_0x7ef1('0x12'));var as=require(_0x7ef1('0x13'));var hardwareService=require(_0x7ef1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7ef1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7ef1('0x16')]=_['defaults'](config[_0x7ef1('0x16')],{'host':_0x7ef1('0x17'),'port':0x18eb});var socket=require(_0x7ef1('0x18'))(new Redis(config[_0x7ef1('0x16')]));require(_0x7ef1('0x19'))[_0x7ef1('0x1a')](socket);var jayson=require(_0x7ef1('0x1b'));var client=jayson[_0x7ef1('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4de80f,_0x267f0e,_0x5d0499,_0x20b843){return new BPromise(function(_0x3ae268,_0x55e84e){var _0x4e26d1=_0x20b843||client;return _0x4e26d1['request'](_0x4de80f,_0x5d0499)[_0x7ef1('0x1d')](function(_0x4da0fa){logger[_0x7ef1('0x1e')]('ChatQueue,\x20%s,\x20%s',_0x267f0e,'request\x20sent');logger['debug'](_0x7ef1('0x1f'),_0x267f0e,'request\x20sent',JSON[_0x7ef1('0x20')](_0x4da0fa));if(_0x4da0fa[_0x7ef1('0x21')]){if(_0x4da0fa['error']['code']===0x1f4){logger[_0x7ef1('0x21')]('ChatQueue,\x20%s,\x20%s',_0x267f0e,_0x4da0fa[_0x7ef1('0x21')][_0x7ef1('0x22')]);return _0x55e84e(_0x4da0fa[_0x7ef1('0x21')][_0x7ef1('0x22')]);}logger[_0x7ef1('0x21')](_0x7ef1('0x23'),_0x267f0e,_0x4da0fa[_0x7ef1('0x21')][_0x7ef1('0x22')]);return _0x3ae268(_0x4da0fa['error'][_0x7ef1('0x22')]);}else{logger[_0x7ef1('0x1e')](_0x7ef1('0x23'),_0x267f0e,_0x7ef1('0x24'));_0x3ae268(_0x4da0fa[_0x7ef1('0x25')][_0x7ef1('0x22')]);}})[_0x7ef1('0x26')](function(_0x144e74){logger['error']('ChatQueue,\x20%s,\x20%s',_0x267f0e,_0x144e74);_0x55e84e(_0x144e74);});});}function respondWithStatusCode(_0x33e008,_0x12ef5a){_0x12ef5a=_0x12ef5a||0xcc;return function(_0x132f2e){if(_0x132f2e){return _0x33e008[_0x7ef1('0x27')](_0x12ef5a);}return _0x33e008[_0x7ef1('0x28')](_0x12ef5a)['end']();};}function respondWithResult(_0x2e62a4,_0x9eca93){_0x9eca93=_0x9eca93||0xc8;return function(_0x445902){if(_0x445902){return _0x2e62a4[_0x7ef1('0x28')](_0x9eca93)[_0x7ef1('0x29')](_0x445902);}};}function respondWithFilteredResult(_0x238fdc,_0x21e8c5){return function(_0x58e7ee){if(_0x58e7ee){var _0x2e8f1b=typeof _0x21e8c5['offset']===_0x7ef1('0x2a')&&typeof _0x21e8c5[_0x7ef1('0x2b')]==='undefined';var _0x5f25de=_0x58e7ee[_0x7ef1('0x2c')];var _0x1136dc=_0x2e8f1b?0x0:_0x21e8c5['offset'];var _0xbf918d=_0x2e8f1b?_0x58e7ee['count']:_0x21e8c5[_0x7ef1('0x2d')]+_0x21e8c5['limit'];var _0x122999;if(_0xbf918d>=_0x5f25de){_0xbf918d=_0x5f25de;_0x122999=0xc8;}else{_0x122999=0xce;}_0x238fdc[_0x7ef1('0x28')](_0x122999);return _0x238fdc['set']('Content-Range',_0x1136dc+'-'+_0xbf918d+'/'+_0x5f25de)['json'](_0x58e7ee);}return null;};}function patchUpdates(_0x5f2976){return function(_0x1b72a1){try{jsonpatch[_0x7ef1('0x2e')](_0x1b72a1,_0x5f2976,!![]);}catch(_0x596abe){return BPromise[_0x7ef1('0x2f')](_0x596abe);}return _0x1b72a1['save']();};}function saveUpdates(_0x49fe6a,_0x2831cb){return function(_0x5c23ce){if(_0x5c23ce){return _0x5c23ce[_0x7ef1('0x30')](_0x49fe6a)[_0x7ef1('0x1d')](function(_0x112c22){return _0x112c22;});}return null;};}function removeEntity(_0x1bfa7b,_0x47e0e1){return function(_0x191575){if(_0x191575){return _0x191575[_0x7ef1('0x31')]()['then'](function(){var _0x52cf62=_0x191575['get']({'plain':!![]});var _0x507053=_0x7ef1('0x32');return db['UserProfileResource'][_0x7ef1('0x31')]({'where':{'type':_0x507053,'resourceId':_0x52cf62['id']}})[_0x7ef1('0x1d')](function(){return _0x191575;});})[_0x7ef1('0x1d')](function(){_0x1bfa7b[_0x7ef1('0x28')](0xcc)[_0x7ef1('0x33')]();});}};}function handleEntityNotFound(_0x29dd39,_0x43c6c4){return function(_0x278aaf){if(!_0x278aaf){_0x29dd39[_0x7ef1('0x27')](0x194);}return _0x278aaf;};}function handleError(_0x3eb9a3,_0x32becc){_0x32becc=_0x32becc||0x1f4;return function(_0x49bb71){logger[_0x7ef1('0x21')](_0x49bb71[_0x7ef1('0x34')]);if(_0x49bb71['name']){delete _0x49bb71[_0x7ef1('0x35')];}_0x3eb9a3[_0x7ef1('0x28')](_0x32becc)[_0x7ef1('0x36')](_0x49bb71);};}function getMustacheRender(_0x273bf1,_0x8ef5b3){return Mustache['render'](_0x273bf1,_[_0x7ef1('0x37')](_0x8ef5b3[_0x7ef1('0x38')],{'contact':_0x8ef5b3[_0x7ef1('0x39')],'message':_0x8ef5b3[_0x7ef1('0x22')],'agent':_0x8ef5b3[_0x7ef1('0x3a')],'interaction':_0x8ef5b3[_0x7ef1('0x3b')],'account':_0x8ef5b3[_0x7ef1('0x3c')]}))||'';}exports[_0x7ef1('0x3d')]=function(_0x1433df,_0x2ec2b8){var _0x252176={},_0x40977b={},_0x2da912={'count':0x0,'rows':[]};var _0x39b280=_[_0x7ef1('0x3e')](db['ChatQueue'][_0x7ef1('0x3f')],function(_0x1e3d07){return{'name':_0x1e3d07[_0x7ef1('0x40')],'type':_0x1e3d07[_0x7ef1('0x41')][_0x7ef1('0x42')]};});_0x40977b[_0x7ef1('0x43')]=_[_0x7ef1('0x3e')](_0x39b280,_0x7ef1('0x35'));_0x40977b[_0x7ef1('0x44')]=_[_0x7ef1('0x45')](_0x1433df[_0x7ef1('0x44')]);_0x40977b[_0x7ef1('0x46')]=_[_0x7ef1('0x47')](_0x40977b['model'],_0x40977b[_0x7ef1('0x44')]);_0x252176[_0x7ef1('0x48')]=_[_0x7ef1('0x47')](_0x40977b[_0x7ef1('0x43')],qs[_0x7ef1('0x49')](_0x1433df[_0x7ef1('0x44')]['fields']));_0x252176[_0x7ef1('0x48')]=_0x252176[_0x7ef1('0x48')][_0x7ef1('0x4a')]?_0x252176[_0x7ef1('0x48')]:_0x40977b[_0x7ef1('0x43')];if(!_0x1433df[_0x7ef1('0x44')]['hasOwnProperty'](_0x7ef1('0x4b'))){_0x252176[_0x7ef1('0x2b')]=qs[_0x7ef1('0x2b')](_0x1433df[_0x7ef1('0x44')]['limit']);_0x252176[_0x7ef1('0x2d')]=qs['offset'](_0x1433df['query'][_0x7ef1('0x2d')]);}_0x252176['order']=qs[_0x7ef1('0x4c')](_0x1433df['query'][_0x7ef1('0x4c')]);_0x252176[_0x7ef1('0x4d')]=qs[_0x7ef1('0x46')](_[_0x7ef1('0x4e')](_0x1433df[_0x7ef1('0x44')],_0x40977b[_0x7ef1('0x46')]),_0x39b280);if(_0x1433df[_0x7ef1('0x44')][_0x7ef1('0x4f')]){_0x252176['where']=_['merge'](_0x252176[_0x7ef1('0x4d')],{'$or':_[_0x7ef1('0x3e')](_0x39b280,function(_0x5bf125){if(_0x5bf125[_0x7ef1('0x41')]!==_0x7ef1('0x50')){var _0xd06ca9={};_0xd06ca9[_0x5bf125['name']]={'$like':'%'+_0x1433df['query'][_0x7ef1('0x4f')]+'%'};return _0xd06ca9;}})});}_0x252176=_['merge']({},_0x252176,_0x1433df['options']);var _0x2845d9={'where':_0x252176[_0x7ef1('0x4d')]};return db[_0x7ef1('0x51')][_0x7ef1('0x2c')](_0x2845d9)[_0x7ef1('0x1d')](function(_0x4f5696){_0x2da912[_0x7ef1('0x2c')]=_0x4f5696;if(_0x1433df['query'][_0x7ef1('0x52')]){_0x252176['include']=[{'all':!![]}];}return db[_0x7ef1('0x51')]['findAll'](_0x252176);})['then'](function(_0x832c5f){_0x2da912['rows']=_0x832c5f;return _0x2da912;})[_0x7ef1('0x1d')](respondWithFilteredResult(_0x2ec2b8,_0x252176))[_0x7ef1('0x26')](handleError(_0x2ec2b8,null));};exports['show']=function(_0xf2e252,_0x738ab6){var _0x2d996f={'raw':!![],'where':{'id':_0xf2e252[_0x7ef1('0x53')]['id']}},_0x50b4b9={};_0x50b4b9[_0x7ef1('0x43')]=_['keys'](db[_0x7ef1('0x51')][_0x7ef1('0x3f')]);_0x50b4b9[_0x7ef1('0x44')]=_[_0x7ef1('0x45')](_0xf2e252[_0x7ef1('0x44')]);_0x50b4b9[_0x7ef1('0x46')]=_[_0x7ef1('0x47')](_0x50b4b9['model'],_0x50b4b9['query']);_0x2d996f[_0x7ef1('0x48')]=_[_0x7ef1('0x47')](_0x50b4b9[_0x7ef1('0x43')],qs[_0x7ef1('0x49')](_0xf2e252[_0x7ef1('0x44')][_0x7ef1('0x49')]));_0x2d996f[_0x7ef1('0x48')]=_0x2d996f[_0x7ef1('0x48')][_0x7ef1('0x4a')]?_0x2d996f[_0x7ef1('0x48')]:_0x50b4b9[_0x7ef1('0x43')];if(_0xf2e252['query'][_0x7ef1('0x52')]){_0x2d996f[_0x7ef1('0x54')]=[{'all':!![]}];}_0x2d996f=_[_0x7ef1('0x37')]({},_0x2d996f,_0xf2e252[_0x7ef1('0x55')]);return db[_0x7ef1('0x51')]['find'](_0x2d996f)[_0x7ef1('0x1d')](handleEntityNotFound(_0x738ab6,null))[_0x7ef1('0x1d')](respondWithResult(_0x738ab6,null))[_0x7ef1('0x26')](handleError(_0x738ab6,null));};exports['create']=function(_0xfa8316,_0x3e054e){return db['ChatQueue'][_0x7ef1('0x56')](_0xfa8316[_0x7ef1('0x38')],{})[_0x7ef1('0x1d')](function(_0x2d285f){var _0x1510df=_0xfa8316[_0x7ef1('0x57')][_0x7ef1('0x58')]({'plain':!![]});if(!_0x1510df)throw new Error(_0x7ef1('0x59'));if(_0x1510df[_0x7ef1('0x5a')]===_0x7ef1('0x57')){var _0x210ff7=_0x2d285f['get']({'plain':!![]});var _0xd002d2=_0x7ef1('0x32');return db['UserProfileSection'][_0x7ef1('0x5b')]({'where':{'name':_0xd002d2,'userProfileId':_0x1510df[_0x7ef1('0x5c')]},'raw':!![]})[_0x7ef1('0x1d')](function(_0x592a11){if(_0x592a11&&_0x592a11[_0x7ef1('0x5d')]===0x0){return db[_0x7ef1('0x5e')]['create']({'name':_0x210ff7[_0x7ef1('0x35')],'resourceId':_0x210ff7['id'],'type':_0x592a11[_0x7ef1('0x35')],'sectionId':_0x592a11['id']},{})[_0x7ef1('0x1d')](function(){return _0x2d285f;});}else{return _0x2d285f;}})['catch'](function(_0x10648c){logger[_0x7ef1('0x21')](_0x7ef1('0x5f'),_0x10648c);throw _0x10648c;});}return _0x2d285f;})['then'](respondWithResult(_0x3e054e,0xc9))[_0x7ef1('0x26')](handleError(_0x3e054e,null));};exports[_0x7ef1('0x30')]=function(_0x3fe784,_0x499783){if(_0x3fe784[_0x7ef1('0x38')]['id']){delete _0x3fe784[_0x7ef1('0x38')]['id'];}return db['ChatQueue'][_0x7ef1('0x5b')]({'where':{'id':_0x3fe784[_0x7ef1('0x53')]['id']}})[_0x7ef1('0x1d')](handleEntityNotFound(_0x499783,null))[_0x7ef1('0x1d')](saveUpdates(_0x3fe784[_0x7ef1('0x38')],null))[_0x7ef1('0x1d')](respondWithResult(_0x499783,null))[_0x7ef1('0x26')](handleError(_0x499783,null));};exports[_0x7ef1('0x31')]=function(_0x19d380,_0x530bbe){return db[_0x7ef1('0x51')]['find']({'where':{'id':_0x19d380[_0x7ef1('0x53')]['id']}})['then'](handleEntityNotFound(_0x530bbe,null))[_0x7ef1('0x1d')](removeEntity(_0x530bbe,null))[_0x7ef1('0x26')](handleError(_0x530bbe,null));};exports[_0x7ef1('0x60')]=function(_0x6e6068,_0x4cdfa0){return db[_0x7ef1('0x51')][_0x7ef1('0x60')]()[_0x7ef1('0x1d')](respondWithResult(_0x4cdfa0,null))[_0x7ef1('0x26')](handleError(_0x4cdfa0,null));};exports[_0x7ef1('0x61')]=function(_0x5ce81e,_0x134399,_0x59d157){var _0x4876c7={'raw':!![],'where':{}},_0x3712f2={},_0xf91f9c;return db[_0x7ef1('0x51')][_0x7ef1('0x62')]({'where':{'id':_0x5ce81e[_0x7ef1('0x53')]['id']}})['then'](handleEntityNotFound(_0x134399,null))[_0x7ef1('0x1d')](function(_0x31e175){if(_0x31e175){_0xf91f9c=_0x31e175['get']({'plain':!![]});_0x3712f2[_0x7ef1('0x43')]=_[_0x7ef1('0x45')](db[_0x7ef1('0x63')][_0x7ef1('0x3f')]);_0x3712f2['query']=_[_0x7ef1('0x45')](_0x5ce81e[_0x7ef1('0x44')]);_0x3712f2[_0x7ef1('0x46')]=_[_0x7ef1('0x47')](_0x3712f2['model'],_0x3712f2['query']);_0x4876c7[_0x7ef1('0x48')]=_[_0x7ef1('0x47')](_0x3712f2[_0x7ef1('0x43')],qs[_0x7ef1('0x49')](_0x5ce81e[_0x7ef1('0x44')][_0x7ef1('0x49')]));_0x4876c7['attributes']=_0x4876c7['attributes']['length']?_0x4876c7[_0x7ef1('0x48')]:_0x3712f2['model'];if(!_0x5ce81e['query'][_0x7ef1('0x64')](_0x7ef1('0x4b'))){_0x4876c7['limit']=qs[_0x7ef1('0x2b')](_0x5ce81e[_0x7ef1('0x44')][_0x7ef1('0x2b')]);_0x4876c7[_0x7ef1('0x2d')]=qs[_0x7ef1('0x2d')](_0x5ce81e[_0x7ef1('0x44')][_0x7ef1('0x2d')]);}_0x4876c7[_0x7ef1('0x65')]=qs[_0x7ef1('0x4c')](_0x5ce81e[_0x7ef1('0x44')][_0x7ef1('0x4c')]);_0x4876c7[_0x7ef1('0x4d')]=qs['filters'](_[_0x7ef1('0x4e')](_0x5ce81e['query'],_0x3712f2[_0x7ef1('0x46')]));_0x4876c7['where']['ChatQueueId']=_0x31e175['id'];if(_0x5ce81e[_0x7ef1('0x44')][_0x7ef1('0x4f')]){_0x4876c7[_0x7ef1('0x4d')]=_[_0x7ef1('0x37')](_0x4876c7[_0x7ef1('0x4d')],{'$or':_[_0x7ef1('0x3e')](_0x4876c7['attributes'],function(_0xa904b8){var _0x3afee0={};_0x3afee0[_0xa904b8]={'$like':'%'+_0x5ce81e[_0x7ef1('0x44')][_0x7ef1('0x4f')]+'%'};return _0x3afee0;})});}_0x4876c7=_[_0x7ef1('0x37')]({},_0x4876c7,_0x5ce81e[_0x7ef1('0x55')]);return db[_0x7ef1('0x63')]['findAll'](_0x4876c7);}})['then'](function(_0x326eb3){if(_0x326eb3){return db[_0x7ef1('0x66')][_0x7ef1('0x67')]({'where':{'id':_[_0x7ef1('0x3e')](_0x326eb3,_0x7ef1('0x68')),'role':_0x7ef1('0x3a')},'attributes':['id',_0x7ef1('0x35'),'chatPause',_0x7ef1('0x69'),_0x7ef1('0x6a')]});}})[_0x7ef1('0x1d')](function(_0x5db8a0){if(_0x5db8a0){return{'count':_0x5db8a0['count'],'rows':_[_0x7ef1('0x3e')](_0x5db8a0[_0x7ef1('0x6b')],function(_0x163d5c){return{'membername':_0x163d5c[_0x7ef1('0x35')],'UserId':_0x163d5c['id'],'queue_name':_0xf91f9c['name'],'ChatQueueId':_0xf91f9c['id'],'interface':util[_0x7ef1('0x6c')](_0x7ef1('0x6d'),_0x7ef1('0x6e'),_0x163d5c['name']),'penalty':0x0,'paused':_0x163d5c['chatPause'],'createdAt':_0x163d5c['createdAt'],'updatedAt':_0x163d5c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7ef1('0x1d')](respondWithFilteredResult(_0x134399,_0x4876c7))[_0x7ef1('0x26')](handleError(_0x134399,null));};exports[_0x7ef1('0x6f')]=function(_0x3a21a1,_0x2be8aa,_0x3763ed){var _0x29462a={};var _0x50109c={};var _0x3190b7;var _0x3a1bcb;return db['ChatQueue']['findOne']({'where':{'id':_0x3a21a1[_0x7ef1('0x53')]['id']}})[_0x7ef1('0x1d')](handleEntityNotFound(_0x2be8aa,null))[_0x7ef1('0x1d')](function(_0x478d2a){if(_0x478d2a){_0x3190b7=_0x478d2a;_0x50109c[_0x7ef1('0x43')]=_[_0x7ef1('0x45')](db[_0x7ef1('0x70')][_0x7ef1('0x3f')]);_0x50109c[_0x7ef1('0x44')]=_[_0x7ef1('0x45')](_0x3a21a1['query']);_0x50109c['filters']=_[_0x7ef1('0x47')](_0x50109c[_0x7ef1('0x43')],_0x50109c[_0x7ef1('0x44')]);_0x29462a[_0x7ef1('0x48')]=_[_0x7ef1('0x47')](_0x50109c[_0x7ef1('0x43')],qs[_0x7ef1('0x49')](_0x3a21a1[_0x7ef1('0x44')][_0x7ef1('0x49')]));_0x29462a[_0x7ef1('0x48')]=_0x29462a[_0x7ef1('0x48')][_0x7ef1('0x4a')]?_0x29462a[_0x7ef1('0x48')]:_0x50109c['model'];_0x29462a[_0x7ef1('0x65')]=qs[_0x7ef1('0x4c')](_0x3a21a1[_0x7ef1('0x44')][_0x7ef1('0x4c')]);_0x29462a[_0x7ef1('0x4d')]=qs[_0x7ef1('0x46')](_[_0x7ef1('0x4e')](_0x3a21a1[_0x7ef1('0x44')],_0x50109c[_0x7ef1('0x46')]));if(_0x3a21a1[_0x7ef1('0x44')][_0x7ef1('0x4f')]){_0x29462a[_0x7ef1('0x4d')]=_[_0x7ef1('0x37')](_0x29462a['where'],{'$or':_[_0x7ef1('0x3e')](_0x29462a[_0x7ef1('0x48')],function(_0x373f6d){var _0x4aa8e1={};_0x4aa8e1[_0x373f6d]={'$like':'%'+_0x3a21a1[_0x7ef1('0x44')][_0x7ef1('0x4f')]+'%'};return _0x4aa8e1;})});}_0x29462a=_[_0x7ef1('0x37')]({},_0x29462a,_0x3a21a1[_0x7ef1('0x55')]);return _0x3190b7[_0x7ef1('0x6f')](_0x29462a);}})['then'](function(_0x42121d){if(_0x42121d){_0x3a1bcb=_0x42121d[_0x7ef1('0x4a')];if(!_0x3a21a1[_0x7ef1('0x44')][_0x7ef1('0x64')]('nolimit')){_0x29462a[_0x7ef1('0x2b')]=qs[_0x7ef1('0x2b')](_0x3a21a1[_0x7ef1('0x44')][_0x7ef1('0x2b')]);_0x29462a[_0x7ef1('0x2d')]=qs['offset'](_0x3a21a1[_0x7ef1('0x44')][_0x7ef1('0x2d')]);}return _0x3190b7[_0x7ef1('0x6f')](_0x29462a);}})[_0x7ef1('0x1d')](function(_0x55cd1f){if(_0x55cd1f){return _0x55cd1f?{'count':_0x3a1bcb,'rows':_0x55cd1f}:null;}})['then'](respondWithResult(_0x2be8aa,null))[_0x7ef1('0x26')](handleError(_0x2be8aa,null));};exports[_0x7ef1('0x71')]=function(_0x1b72cb,_0x1a0040,_0x2857da){var _0xbfeff8=_0x1b72cb[_0x7ef1('0x38')]['ids'];return db['Team'][_0x7ef1('0x72')]({'where':{'id':_0xbfeff8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7ef1('0x73'),'attributes':['id',_0x7ef1('0x35'),_0x7ef1('0x74'),'voicePause','interface'],'raw':!![]}]})[_0x7ef1('0x1d')](function(_0x51347e){if(_0x51347e){var _0x15cd23=_[_0x7ef1('0x75')](_0x51347e,function(_0x3db6a1){var _0x227dc4=_0x3db6a1[_0x7ef1('0x58')]({'plain':!![]});return _0x227dc4[_0x7ef1('0x73')];});return db[_0x7ef1('0x51')]['find']({'where':{'id':_0x1b72cb['params']['id']}})[_0x7ef1('0x1d')](function(_0x5b0110){return db[_0x7ef1('0x76')][_0x7ef1('0x77')](function(_0x4bb8aa){return _0x5b0110['addTeams'](_0xbfeff8,{'transaction':_0x4bb8aa})[_0x7ef1('0x1d')](function(){return BPromise[_0x7ef1('0x78')](_0x15cd23,function(_0x2be912){return db['UserChatQueue'][_0x7ef1('0x79')]({'where':{'UserId':_0x2be912['id'],'ChatQueueId':_0x1b72cb['params']['id']},'transaction':_0x4bb8aa});});})['then'](function(){_0x15cd23[_0x7ef1('0x7a')](function(_0x1f83d0){socket[_0x7ef1('0x7b')]('userChatQueue:save',{'UserId':_0x1f83d0['id'],'ChatQueueId':_0x5b0110['id']});});});});});}})['then'](respondWithStatusCode(_0x1a0040,null))['catch'](handleError(_0x1a0040,null));};exports[_0x7ef1('0x7c')]=function(_0x2dfa67,_0x3c4fd3,_0x4a70ed){return db[_0x7ef1('0x70')][_0x7ef1('0x72')]({'where':{'id':_0x2dfa67[_0x7ef1('0x44')][_0x7ef1('0x7d')]},'attributes':['id'],'include':[{'model':db[_0x7ef1('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7ef1('0x1d')](handleEntityNotFound(_0x3c4fd3,null))[_0x7ef1('0x1d')](function(_0x2f285e){var _0x9d2b2a=_[_0x7ef1('0x3e')](_0x2f285e,'id');var _0x1f0b79=[];var _0x253176=[];var _0x28515d=squel['select']();_0x28515d[_0x7ef1('0x7e')](_0x7ef1('0x7f'))[_0x7ef1('0x80')](_0x7ef1('0x81'),'tq')[_0x7ef1('0x82')](_0x7ef1('0x83'),'ut',_0x7ef1('0x84'))[_0x7ef1('0x4d')]('ChatQueueId\x20=\x20?',_0x2dfa67[_0x7ef1('0x53')]['id']);for(var _0x5a2fc0=0x0;_0x5a2fc0<_0x2f285e[_0x7ef1('0x4a')];_0x5a2fc0+=0x1){let _0x5b06b4=_0x2f285e[_0x5a2fc0];for(var _0xa2a0d5=0x0;_0xa2a0d5<_0x5b06b4[_0x7ef1('0x73')][_0x7ef1('0x4a')];_0xa2a0d5+=0x1){let _0xfb87bd=_0x5b06b4['Agents'][_0xa2a0d5];var _0x5b836e=_0x28515d['clone']();_0x5b836e[_0x7ef1('0x4d')]('ut.UserId\x20=\x20?',_0xfb87bd['id']);_0x253176[_0x7ef1('0x85')](db[_0x7ef1('0x76')][_0x7ef1('0x44')](_0x5b836e['toString'](),{'type':db[_0x7ef1('0x76')][_0x7ef1('0x86')][_0x7ef1('0x87')]})[_0x7ef1('0x1d')](function(_0xae57ee){if(_0xae57ee['length']===0x1){return _0xfb87bd['id'];}else{var _0x4c36f9=_['every'](_[_0x7ef1('0x3e')](_0xae57ee,_0x7ef1('0x88')),function(_0x2204f4){return _['includes'](_0x9d2b2a,_0x2204f4);});if(_0x4c36f9){return _0xfb87bd['id'];}}}));}}return BPromise[_0x7ef1('0x89')](_0x253176)[_0x7ef1('0x1d')](function(_0x1611b3){_0x1f0b79=_(_0x1f0b79)[_0x7ef1('0x8a')](_0x1611b3)[_0x7ef1('0x8b')]()[_0x7ef1('0x8c')]();return db[_0x7ef1('0x51')][_0x7ef1('0x5b')]({'where':{'id':_0x2dfa67[_0x7ef1('0x53')]['id']}})[_0x7ef1('0x1d')](function(_0x2b941a){return db[_0x7ef1('0x76')][_0x7ef1('0x77')](function(_0x27c165){return _0x2b941a[_0x7ef1('0x7c')](_0x2dfa67[_0x7ef1('0x44')]['ids'],{'transaction':_0x27c165})['then'](function(){if(!_[_0x7ef1('0x8d')](_0x1f0b79)){return _0x2b941a['removeAgents'](_0x1f0b79,{'transaction':_0x27c165});}})[_0x7ef1('0x1d')](function(){_0x1f0b79[_0x7ef1('0x7a')](function(_0x4da84e){socket[_0x7ef1('0x7b')](_0x7ef1('0x8e'),{'UserId':_0x4da84e,'ChatQueueId':_0x2b941a['id']});});});});});});})[_0x7ef1('0x1d')](respondWithStatusCode(_0x3c4fd3,null))['catch'](handleError(_0x3c4fd3,null));};exports[_0x7ef1('0x8f')]=function(_0x13092c,_0x13d51a,_0x473d55){return db[_0x7ef1('0x51')][_0x7ef1('0x5b')]({'where':{'id':_0x13092c[_0x7ef1('0x53')]['id']}})[_0x7ef1('0x1d')](handleEntityNotFound(_0x13d51a,null))[_0x7ef1('0x1d')](function(_0x34bdca){if(_0x34bdca){return _0x34bdca[_0x7ef1('0x8f')](_0x13092c['body']['ids'],_['omit'](_0x13092c[_0x7ef1('0x38')],['ids','id'])||{})['spread'](function(_0x4c193e){for(var _0x4552b1=0x0;_0x4552b1<_0x13092c[_0x7ef1('0x38')][_0x7ef1('0x7d')][_0x7ef1('0x4a')];_0x4552b1+=0x1){socket['emit'](_0x7ef1('0x90'),{'UserId':_0x13092c[_0x7ef1('0x38')]['ids'][_0x4552b1],'ChatQueueId':_0x13092c['params']['id']});}return _0x4c193e;});}})[_0x7ef1('0x1d')](respondWithResult(_0x13d51a,null))[_0x7ef1('0x26')](handleError(_0x13d51a,null));};exports[_0x7ef1('0x91')]=function(_0x45c152,_0x53ede0,_0x78b93d){return db[_0x7ef1('0x51')][_0x7ef1('0x5b')]({'where':{'id':_0x45c152[_0x7ef1('0x53')]['id']}})[_0x7ef1('0x1d')](handleEntityNotFound(_0x53ede0,null))[_0x7ef1('0x1d')](function(_0x15e058){if(_0x15e058){return _0x15e058[_0x7ef1('0x91')](_0x45c152[_0x7ef1('0x44')][_0x7ef1('0x7d')])[_0x7ef1('0x1d')](function(){if(_['isArray'](_0x45c152[_0x7ef1('0x44')][_0x7ef1('0x7d')])){for(var _0x49ef70=0x0;_0x49ef70<_0x45c152['query'][_0x7ef1('0x7d')][_0x7ef1('0x4a')];_0x49ef70+=0x1){socket['emit'](_0x7ef1('0x8e'),{'UserId':Number(_0x45c152[_0x7ef1('0x44')][_0x7ef1('0x7d')][_0x49ef70]),'ChatQueueId':Number(_0x45c152['params']['id'])});}}else{socket[_0x7ef1('0x7b')](_0x7ef1('0x8e'),{'UserId':Number(_0x45c152['query'][_0x7ef1('0x7d')]),'ChatQueueId':Number(_0x45c152[_0x7ef1('0x53')]['id'])});}});}})[_0x7ef1('0x1d')](respondWithStatusCode(_0x53ede0,null))[_0x7ef1('0x26')](handleError(_0x53ede0,null));};exports[_0x7ef1('0x92')]=function(_0x3be47d,_0x384cb3,_0xa7e21){var _0x1e5360={};var _0x127dcf={};var _0x25d6ea;var _0x1ab9d5;return db[_0x7ef1('0x51')][_0x7ef1('0x62')]({'where':{'id':_0x3be47d['params']['id']}})[_0x7ef1('0x1d')](handleEntityNotFound(_0x384cb3,null))[_0x7ef1('0x1d')](function(_0x5f0642){if(_0x5f0642){_0x25d6ea=_0x5f0642;_0x127dcf[_0x7ef1('0x43')]=_[_0x7ef1('0x45')](db[_0x7ef1('0x66')][_0x7ef1('0x3f')]);_0x127dcf[_0x7ef1('0x44')]=_['keys'](_0x3be47d[_0x7ef1('0x44')]);_0x127dcf[_0x7ef1('0x46')]=_[_0x7ef1('0x47')](_0x127dcf[_0x7ef1('0x43')],_0x127dcf[_0x7ef1('0x44')]);_0x1e5360[_0x7ef1('0x48')]=_[_0x7ef1('0x47')](_0x127dcf[_0x7ef1('0x43')],qs[_0x7ef1('0x49')](_0x3be47d[_0x7ef1('0x44')][_0x7ef1('0x49')]));_0x1e5360[_0x7ef1('0x48')]=_0x1e5360[_0x7ef1('0x48')][_0x7ef1('0x4a')]?_0x1e5360['attributes']:_0x127dcf[_0x7ef1('0x43')];_0x1e5360[_0x7ef1('0x65')]=qs[_0x7ef1('0x4c')](_0x3be47d[_0x7ef1('0x44')][_0x7ef1('0x4c')]);_0x1e5360[_0x7ef1('0x4d')]=qs['filters'](_[_0x7ef1('0x4e')](_0x3be47d['query'],_0x127dcf['filters']));if(_0x3be47d['query'][_0x7ef1('0x4f')]){_0x1e5360[_0x7ef1('0x4d')]=_[_0x7ef1('0x37')](_0x1e5360[_0x7ef1('0x4d')],{'$or':_['map'](_0x1e5360[_0x7ef1('0x48')],function(_0x2ef0d0){var _0x2b992a={};_0x2b992a[_0x2ef0d0]={'$like':'%'+_0x3be47d[_0x7ef1('0x44')][_0x7ef1('0x4f')]+'%'};return _0x2b992a;})});}_0x1e5360=_[_0x7ef1('0x37')]({},_0x1e5360,_0x3be47d[_0x7ef1('0x55')]);return _0x25d6ea[_0x7ef1('0x92')](_0x1e5360);}})['then'](function(_0x498673){if(_0x498673){_0x1ab9d5=_0x498673[_0x7ef1('0x4a')];if(!_0x3be47d[_0x7ef1('0x44')][_0x7ef1('0x64')](_0x7ef1('0x4b'))){_0x1e5360[_0x7ef1('0x2b')]=qs[_0x7ef1('0x2b')](_0x3be47d['query'][_0x7ef1('0x2b')]);_0x1e5360[_0x7ef1('0x2d')]=qs[_0x7ef1('0x2d')](_0x3be47d[_0x7ef1('0x44')][_0x7ef1('0x2d')]);}return _0x25d6ea[_0x7ef1('0x92')](_0x1e5360);}})[_0x7ef1('0x1d')](function(_0x4883fa){if(_0x4883fa){return _0x4883fa?{'count':_0x1ab9d5,'rows':_0x4883fa}:null;}})['then'](respondWithResult(_0x384cb3,null))[_0x7ef1('0x26')](handleError(_0x384cb3,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 034e46f..5d75073 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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x56435f,_0xbc6554){var _0x39c91e=function(_0x5c483b){while(--_0x5c483b){_0x56435f['push'](_0x56435f['shift']());}};_0x39c91e(++_0xbc6554);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d773f,_0x3462b3){_0x3d773f=_0x3d773f-0x0;var _0x22bf3a=_0xb10b[_0x3d773f];return _0x22bf3a;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x393cbc,_0x5d132c){var _0x10fd85=function(_0x4c0dd0){while(--_0x4c0dd0){_0x393cbc['push'](_0x393cbc['shift']());}};_0x10fd85(++_0x5d132c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x208ca0,_0xf46ead){_0x208ca0=_0x208ca0-0x0;var _0x313645=_0x5f2f[_0x208ca0];return _0x313645;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 0b55dee..085bb08 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 _0x19e9=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','request-promise'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x19e9,0x68));var _0x919e=function(_0x5d02c1,_0x429981){_0x5d02c1=_0x5d02c1-0x0;var _0x23d71a=_0x19e9[_0x5d02c1];return _0x23d71a;};'use strict';var _=require(_0x919e('0x0'));var util=require(_0x919e('0x1'));var logger=require(_0x919e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x919e('0x3'));var fs=require('fs');var path=require(_0x919e('0x4'));var rimraf=require(_0x919e('0x5'));var config=require(_0x919e('0x6'));var attributes=require(_0x919e('0x7'));module[_0x919e('0x8')]=function(_0x2ca965,_0x4cdac){return _0x2ca965[_0x919e('0x9')](_0x919e('0xa'),attributes,{'tableName':_0x919e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc887=['define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./chatQueue.attributes','exports'];(function(_0x70abd9,_0x6ae334){var _0x3a2e17=function(_0x599839){while(--_0x599839){_0x70abd9['push'](_0x70abd9['shift']());}};_0x3a2e17(++_0x6ae334);}(_0xc887,0x1e3));var _0x7c88=function(_0x544b14,_0x4d6d4b){_0x544b14=_0x544b14-0x0;var _0x14264e=_0xc887[_0x544b14];return _0x14264e;};'use strict';var _=require(_0x7c88('0x0'));var util=require(_0x7c88('0x1'));var logger=require(_0x7c88('0x2'))(_0x7c88('0x3'));var moment=require('moment');var BPromise=require(_0x7c88('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c88('0x5'));var rimraf=require('rimraf');var config=require(_0x7c88('0x6'));var attributes=require(_0x7c88('0x7'));module[_0x7c88('0x8')]=function(_0x3c8100,_0x1f03b0){return _0x3c8100[_0x7c88('0x9')](_0x7c88('0xa'),attributes,{'tableName':_0x7c88('0xb'),'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 d2a7c1c..4c621ba 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 _0x349f=['model','map','ChatQueue','ShowChatQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','catch','GetChatQueue','findAll','options','where','attributes','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x349f,0xa8));var _0xf349=function(_0x55b6cc,_0x33f45a){_0x55b6cc=_0x55b6cc-0x0;var _0xa7dee3=_0x349f[_0x55b6cc];return _0xa7dee3;};'use strict';var _=require(_0xf349('0x0'));var util=require(_0xf349('0x1'));var moment=require(_0xf349('0x2'));var BPromise=require('bluebird');var rs=require(_0xf349('0x3'));var fs=require('fs');var Redis=require(_0xf349('0x4'));var db=require(_0xf349('0x5'))['db'];var utils=require(_0xf349('0x6'));var logger=require(_0xf349('0x7'))(_0xf349('0x8'));var config=require(_0xf349('0x9'));var jayson=require(_0xf349('0xa'));var client=jayson[_0xf349('0xb')][_0xf349('0xc')]({'port':0x232a});config['redis']=_[_0xf349('0xd')](config[_0xf349('0xe')],{'host':_0xf349('0xf'),'port':0x18eb});var socket=require(_0xf349('0x10'))(new Redis(config[_0xf349('0xe')]));require(_0xf349('0x11'))[_0xf349('0x12')](socket);function respondWithRpcPromise(_0x5e30ef,_0x50652e,_0x1e2abf){return new BPromise(function(_0x2eb18e,_0x459747){return client[_0xf349('0x13')](_0x5e30ef,_0x1e2abf)[_0xf349('0x14')](function(_0x497611){logger['info']('ChatQueue,\x20%s,\x20%s',_0x50652e,_0xf349('0x15'));logger[_0xf349('0x16')](_0xf349('0x17'),_0x50652e,_0xf349('0x15'),JSON[_0xf349('0x18')](_0x497611));if(_0x497611['error']){if(_0x497611[_0xf349('0x19')][_0xf349('0x1a')]===0x1f4){logger['error'](_0xf349('0x1b'),_0x50652e,_0x497611[_0xf349('0x19')]['message']);return _0x459747(_0x497611[_0xf349('0x19')]['message']);}logger[_0xf349('0x19')](_0xf349('0x1b'),_0x50652e,_0x497611[_0xf349('0x19')][_0xf349('0x1c')]);return _0x2eb18e(_0x497611[_0xf349('0x19')][_0xf349('0x1c')]);}else{logger[_0xf349('0x1d')]('ChatQueue,\x20%s,\x20%s',_0x50652e,_0xf349('0x15'));_0x2eb18e(_0x497611['result'][_0xf349('0x1c')]);}})[_0xf349('0x1e')](function(_0x296894){logger[_0xf349('0x19')](_0xf349('0x1b'),_0x50652e,_0x296894);_0x459747(_0x296894);});});}exports[_0xf349('0x1f')]=function(_0x27c6de){var _0x104f9b=this;return new Promise(function(_0x5ccd87,_0x282cc8){return db['ChatQueue'][_0xf349('0x20')]({'raw':_0x27c6de[_0xf349('0x21')]?_0x27c6de[_0xf349('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x27c6de[_0xf349('0x21')]?_0x27c6de[_0xf349('0x21')][_0xf349('0x22')]||null:null,'attributes':_0x27c6de['options']?_0x27c6de[_0xf349('0x21')][_0xf349('0x23')]||null:null,'limit':_0x27c6de['options']?_0x27c6de['options']['limit']||null:null,'include':_0x27c6de[_0xf349('0x21')]?_0x27c6de[_0xf349('0x21')][_0xf349('0x24')]?_['map'](_0x27c6de[_0xf349('0x21')][_0xf349('0x24')],function(_0x11dc06){return{'model':db[_0x11dc06[_0xf349('0x25')]],'as':_0x11dc06['as'],'attributes':_0x11dc06[_0xf349('0x23')],'include':_0x11dc06[_0xf349('0x24')]?_[_0xf349('0x26')](_0x11dc06[_0xf349('0x24')],function(_0x439d32){return{'model':db[_0x439d32[_0xf349('0x25')]],'as':_0x439d32['as'],'attributes':_0x439d32[_0xf349('0x23')],'include':_0x439d32[_0xf349('0x24')]?_[_0xf349('0x26')](_0x439d32[_0xf349('0x24')],function(_0x53aa55){return{'model':db[_0x53aa55['model']],'as':_0x53aa55['as'],'attributes':_0x53aa55['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x38d1e5){logger['info'](_0xf349('0x1f'),_0x27c6de);logger['debug']('GetChatQueue',_0x27c6de,JSON['stringify'](_0x38d1e5));_0x5ccd87(_0x38d1e5);})['catch'](function(_0x1a3ec6){logger[_0xf349('0x19')](_0xf349('0x1f'),_0x1a3ec6[_0xf349('0x1c')],_0x27c6de);_0x282cc8(_0x104f9b[_0xf349('0x19')](0x1f4,_0x1a3ec6['message']));});});};exports['ShowChatQueue']=function(_0x2c0f9c){var _0x1b9b26=this;return new Promise(function(_0xa25152,_0x3c104a){return db[_0xf349('0x27')]['find']({'raw':_0x2c0f9c[_0xf349('0x21')]?_0x2c0f9c[_0xf349('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x2c0f9c['options']?_0x2c0f9c['options'][_0xf349('0x22')]||null:null,'attributes':_0x2c0f9c[_0xf349('0x21')]?_0x2c0f9c[_0xf349('0x21')]['attributes']||null:null,'include':_0x2c0f9c[_0xf349('0x21')]?_0x2c0f9c[_0xf349('0x21')][_0xf349('0x24')]?_[_0xf349('0x26')](_0x2c0f9c[_0xf349('0x21')]['include'],function(_0x6dea95){return{'model':db[_0x6dea95['model']],'as':_0x6dea95['as'],'attributes':_0x6dea95[_0xf349('0x23')],'include':_0x6dea95[_0xf349('0x24')]?_[_0xf349('0x26')](_0x6dea95[_0xf349('0x24')],function(_0x125de4){return{'model':db[_0x125de4[_0xf349('0x25')]],'as':_0x125de4['as'],'attributes':_0x125de4[_0xf349('0x23')],'include':_0x125de4['include']?_['map'](_0x125de4['include'],function(_0x3f7bc8){return{'model':db[_0x3f7bc8[_0xf349('0x25')]],'as':_0x3f7bc8['as'],'attributes':_0x3f7bc8['attributes']};}):[]};}):[]};}):[]:[]})[_0xf349('0x14')](function(_0x1159dc){logger['info'](_0xf349('0x28'),_0x2c0f9c);logger[_0xf349('0x16')](_0xf349('0x28'),_0x2c0f9c,JSON[_0xf349('0x18')](_0x1159dc));_0xa25152(_0x1159dc);})[_0xf349('0x1e')](function(_0x452249){logger['error'](_0xf349('0x28'),_0x452249['message'],_0x2c0f9c);_0x3c104a(_0x1b9b26['error'](0x1f4,_0x452249[_0xf349('0x1c')]));});});}; \ No newline at end of file +var _0x9f95=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','findAll','options','where','limit','map','include','model','attributes','GetChatQueue','ShowChatQueue','raw','lodash'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x9f95,0x97));var _0x59f9=function(_0x513dc3,_0x4fc984){_0x513dc3=_0x513dc3-0x0;var _0x2123f8=_0x9f95[_0x513dc3];return _0x2123f8;};'use strict';var _=require(_0x59f9('0x0'));var util=require('util');var moment=require(_0x59f9('0x1'));var BPromise=require(_0x59f9('0x2'));var rs=require(_0x59f9('0x3'));var fs=require('fs');var Redis=require(_0x59f9('0x4'));var db=require(_0x59f9('0x5'))['db'];var utils=require(_0x59f9('0x6'));var logger=require(_0x59f9('0x7'))('rpc');var config=require(_0x59f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x59f9('0x9')]['http']({'port':0x232a});config['redis']=_[_0x59f9('0xa')](config[_0x59f9('0xb')],{'host':_0x59f9('0xc'),'port':0x18eb});var socket=require(_0x59f9('0xd'))(new Redis(config[_0x59f9('0xb')]));require('./chatQueue.socket')[_0x59f9('0xe')](socket);function respondWithRpcPromise(_0x5289dd,_0x3376f5,_0x527bdf){return new BPromise(function(_0x41b875,_0x42dee0){return client['request'](_0x5289dd,_0x527bdf)[_0x59f9('0xf')](function(_0x3ce834){logger[_0x59f9('0x10')]('ChatQueue,\x20%s,\x20%s',_0x3376f5,_0x59f9('0x11'));logger[_0x59f9('0x12')](_0x59f9('0x13'),_0x3376f5,_0x59f9('0x11'),JSON[_0x59f9('0x14')](_0x3ce834));if(_0x3ce834['error']){if(_0x3ce834[_0x59f9('0x15')][_0x59f9('0x16')]===0x1f4){logger['error'](_0x59f9('0x17'),_0x3376f5,_0x3ce834['error'][_0x59f9('0x18')]);return _0x42dee0(_0x3ce834['error'][_0x59f9('0x18')]);}logger[_0x59f9('0x15')]('ChatQueue,\x20%s,\x20%s',_0x3376f5,_0x3ce834[_0x59f9('0x15')][_0x59f9('0x18')]);return _0x41b875(_0x3ce834[_0x59f9('0x15')][_0x59f9('0x18')]);}else{logger[_0x59f9('0x10')](_0x59f9('0x17'),_0x3376f5,_0x59f9('0x11'));_0x41b875(_0x3ce834[_0x59f9('0x19')]['message']);}})[_0x59f9('0x1a')](function(_0x2d9eec){logger[_0x59f9('0x15')](_0x59f9('0x17'),_0x3376f5,_0x2d9eec);_0x42dee0(_0x2d9eec);});});}exports['GetChatQueue']=function(_0x2ba943){var _0x53aecb=this;return new Promise(function(_0x5c2c85,_0x510159){return db['ChatQueue'][_0x59f9('0x1b')]({'raw':_0x2ba943[_0x59f9('0x1c')]?_0x2ba943[_0x59f9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2ba943['options']?_0x2ba943['options'][_0x59f9('0x1d')]||null:null,'attributes':_0x2ba943['options']?_0x2ba943[_0x59f9('0x1c')]['attributes']||null:null,'limit':_0x2ba943[_0x59f9('0x1c')]?_0x2ba943[_0x59f9('0x1c')][_0x59f9('0x1e')]||null:null,'include':_0x2ba943[_0x59f9('0x1c')]?_0x2ba943[_0x59f9('0x1c')]['include']?_[_0x59f9('0x1f')](_0x2ba943[_0x59f9('0x1c')][_0x59f9('0x20')],function(_0x5bd4f1){return{'model':db[_0x5bd4f1[_0x59f9('0x21')]],'as':_0x5bd4f1['as'],'attributes':_0x5bd4f1[_0x59f9('0x22')],'include':_0x5bd4f1['include']?_[_0x59f9('0x1f')](_0x5bd4f1[_0x59f9('0x20')],function(_0xb099e9){return{'model':db[_0xb099e9[_0x59f9('0x21')]],'as':_0xb099e9['as'],'attributes':_0xb099e9[_0x59f9('0x22')],'include':_0xb099e9[_0x59f9('0x20')]?_[_0x59f9('0x1f')](_0xb099e9[_0x59f9('0x20')],function(_0x459624){return{'model':db[_0x459624['model']],'as':_0x459624['as'],'attributes':_0x459624[_0x59f9('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x545e8e){logger['info'](_0x59f9('0x23'),_0x2ba943);logger[_0x59f9('0x12')](_0x59f9('0x23'),_0x2ba943,JSON[_0x59f9('0x14')](_0x545e8e));_0x5c2c85(_0x545e8e);})[_0x59f9('0x1a')](function(_0x5e7f10){logger[_0x59f9('0x15')](_0x59f9('0x23'),_0x5e7f10['message'],_0x2ba943);_0x510159(_0x53aecb[_0x59f9('0x15')](0x1f4,_0x5e7f10['message']));});});};exports[_0x59f9('0x24')]=function(_0x2bad87){var _0x2f935a=this;return new Promise(function(_0x87577b,_0x133d9a){return db['ChatQueue']['find']({'raw':_0x2bad87['options']?_0x2bad87['options'][_0x59f9('0x25')]===undefined?!![]:![]:!![],'where':_0x2bad87['options']?_0x2bad87[_0x59f9('0x1c')][_0x59f9('0x1d')]||null:null,'attributes':_0x2bad87[_0x59f9('0x1c')]?_0x2bad87['options'][_0x59f9('0x22')]||null:null,'include':_0x2bad87['options']?_0x2bad87[_0x59f9('0x1c')][_0x59f9('0x20')]?_[_0x59f9('0x1f')](_0x2bad87[_0x59f9('0x1c')][_0x59f9('0x20')],function(_0x54e19f){return{'model':db[_0x54e19f[_0x59f9('0x21')]],'as':_0x54e19f['as'],'attributes':_0x54e19f[_0x59f9('0x22')],'include':_0x54e19f[_0x59f9('0x20')]?_[_0x59f9('0x1f')](_0x54e19f[_0x59f9('0x20')],function(_0x1a8376){return{'model':db[_0x1a8376['model']],'as':_0x1a8376['as'],'attributes':_0x1a8376[_0x59f9('0x22')],'include':_0x1a8376[_0x59f9('0x20')]?_[_0x59f9('0x1f')](_0x1a8376[_0x59f9('0x20')],function(_0x1f42ba){return{'model':db[_0x1f42ba[_0x59f9('0x21')]],'as':_0x1f42ba['as'],'attributes':_0x1f42ba['attributes']};}):[]};}):[]};}):[]:[]})[_0x59f9('0xf')](function(_0x232275){logger[_0x59f9('0x10')](_0x59f9('0x24'),_0x2bad87);logger[_0x59f9('0x12')]('ShowChatQueue',_0x2bad87,JSON[_0x59f9('0x14')](_0x232275));_0x87577b(_0x232275);})['catch'](function(_0x4c7e8e){logger[_0x59f9('0x15')]('ShowChatQueue',_0x4c7e8e['message'],_0x2bad87);_0x133d9a(_0x2f935a[_0x59f9('0x15')](0x1f4,_0x4c7e8e[_0x59f9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index da77109..b2b2fb5 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x540687,_0x1f5277){var _0x53e71a=function(_0x2ea95a){while(--_0x2ea95a){_0x540687['push'](_0x540687['shift']());}};_0x53e71a(++_0x1f5277);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2ea5d0,_0x3e4cba){_0x2ea5d0=_0x2ea5d0-0x0;var _0x47d4b2=_0x5f2f[_0x2ea5d0];return _0x47d4b2;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x5f2f,0x73));var _0xf5f2=function(_0x68f005,_0x1c7f4f){_0x68f005=_0x68f005-0x0;var _0x23cc8d=_0x5f2f[_0x68f005];return _0x23cc8d;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 686e0ee..dd7d805 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 _0x8a34=['/:id/teams','post','/:id/users','addAgents','update','delete','destroy','removeTeams','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getTeams','getAgents'];(function(_0x784f8d,_0x1d61c9){var _0x59760e=function(_0x20c916){while(--_0x20c916){_0x784f8d['push'](_0x784f8d['shift']());}};_0x59760e(++_0x1d61c9);}(_0x8a34,0x127));var _0x48a3=function(_0x21c504,_0x3e00c6){_0x21c504=_0x21c504-0x0;var _0x51b5c3=_0x8a34[_0x21c504];return _0x51b5c3;};'use strict';var multer=require(_0x48a3('0x0'));var util=require(_0x48a3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x48a3('0x2'));var router=express[_0x48a3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x48a3('0x4'));var interaction=require(_0x48a3('0x5'));var config=require(_0x48a3('0x6'));var controller=require(_0x48a3('0x7'));router[_0x48a3('0x8')]('/',auth[_0x48a3('0x9')](),controller['index']);router[_0x48a3('0x8')](_0x48a3('0xa'),auth[_0x48a3('0x9')](),controller[_0x48a3('0xb')]);router[_0x48a3('0x8')](_0x48a3('0xc'),auth['isAuthenticated'](),controller[_0x48a3('0xd')]);router['get'](_0x48a3('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x48a3('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x48a3('0xf')]);router[_0x48a3('0x8')]('/:id/users',auth[_0x48a3('0x9')](),controller[_0x48a3('0x10')]);router['post']('/',auth[_0x48a3('0x9')](),controller['create']);router['post'](_0x48a3('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x48a3('0x12')](_0x48a3('0x13'),auth[_0x48a3('0x9')](),controller[_0x48a3('0x14')]);router['put'](_0x48a3('0xc'),auth[_0x48a3('0x9')](),controller[_0x48a3('0x15')]);router[_0x48a3('0x16')](_0x48a3('0xc'),auth[_0x48a3('0x9')](),controller[_0x48a3('0x17')]);router[_0x48a3('0x16')]('/:id/teams',auth[_0x48a3('0x9')](),controller[_0x48a3('0x18')]);router[_0x48a3('0x16')](_0x48a3('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x48a3('0x19')]=router; \ No newline at end of file +var _0x153c=['show','/:id/members','getMembers','getTeams','/:id/users','create','post','addTeams','addAgents','update','delete','/:id','destroy','/:id/teams','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x5e2bdb,_0x13ca36){var _0x350187=function(_0x3bfcaf){while(--_0x3bfcaf){_0x5e2bdb['push'](_0x5e2bdb['shift']());}};_0x350187(++_0x13ca36);}(_0x153c,0x8c));var _0xc153=function(_0x40269f,_0x57e378){_0x40269f=_0x40269f-0x0;var _0x58daa6=_0x153c[_0x40269f];return _0x58daa6;};'use strict';var multer=require(_0xc153('0x0'));var util=require(_0xc153('0x1'));var path=require(_0xc153('0x2'));var timeout=require(_0xc153('0x3'));var express=require('express');var router=express[_0xc153('0x4')]();var fs_extra=require(_0xc153('0x5'));var auth=require(_0xc153('0x6'));var interaction=require(_0xc153('0x7'));var config=require(_0xc153('0x8'));var controller=require(_0xc153('0x9'));router[_0xc153('0xa')]('/',auth['isAuthenticated'](),controller[_0xc153('0xb')]);router[_0xc153('0xa')](_0xc153('0xc'),auth[_0xc153('0xd')](),controller[_0xc153('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc153('0xf')]);router[_0xc153('0xa')](_0xc153('0x10'),auth[_0xc153('0xd')](),controller[_0xc153('0x11')]);router['get']('/:id/teams',auth[_0xc153('0xd')](),controller[_0xc153('0x12')]);router['get'](_0xc153('0x13'),auth[_0xc153('0xd')](),controller['getAgents']);router['post']('/',auth[_0xc153('0xd')](),controller[_0xc153('0x14')]);router[_0xc153('0x15')]('/:id/teams',auth[_0xc153('0xd')](),controller[_0xc153('0x16')]);router[_0xc153('0x15')]('/:id/users',auth[_0xc153('0xd')](),controller[_0xc153('0x17')]);router['put']('/:id',auth[_0xc153('0xd')](),controller[_0xc153('0x18')]);router[_0xc153('0x19')](_0xc153('0x1a'),auth[_0xc153('0xd')](),controller[_0xc153('0x1b')]);router[_0xc153('0x19')](_0xc153('0x1c'),auth['isAuthenticated'](),controller[_0xc153('0x1d')]);router[_0xc153('0x19')](_0xc153('0x13'),auth['isAuthenticated'](),controller[_0xc153('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 6db333f..3dbea7a 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 _0x2496=['exports','STRING','DATE','sequelize'];(function(_0x1a2a4a,_0x5e6b05){var _0x2ef0ab=function(_0x28bc78){while(--_0x28bc78){_0x1a2a4a['push'](_0x1a2a4a['shift']());}};_0x2ef0ab(++_0x5e6b05);}(_0x2496,0x1cf));var _0x6249=function(_0x4156d3,_0x1f399b){_0x4156d3=_0x4156d3-0x0;var _0x461a9b=_0x2496[_0x4156d3];return _0x461a9b;};'use strict';var moment=require('moment');var Sequelize=require(_0x6249('0x0'));module[_0x6249('0x1')]={'uniqueid':{'type':Sequelize[_0x6249('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6249('0x2')]},'joinAt':{'type':Sequelize[_0x6249('0x3')]},'leaveAt':{'type':Sequelize[_0x6249('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6249('0x3')]},'reason':{'type':Sequelize[_0x6249('0x2')]}}; \ No newline at end of file +var _0xd66d=['moment','exports','STRING','DATE'];(function(_0x32402d,_0x59f975){var _0x1a6368=function(_0x45bec9){while(--_0x45bec9){_0x32402d['push'](_0x32402d['shift']());}};_0x1a6368(++_0x59f975);}(_0xd66d,0xc8));var _0xdd66=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xd66d[_0x20a558];return _0x53d3f7;};'use strict';var moment=require(_0xdd66('0x0'));var Sequelize=require('sequelize');module[_0xdd66('0x1')]={'uniqueid':{'type':Sequelize[_0xdd66('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdd66('0x3')]},'leaveAt':{'type':Sequelize[_0xdd66('0x3')]},'acceptAt':{'type':Sequelize[_0xdd66('0x3')]},'exitAt':{'type':Sequelize[_0xdd66('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index e8ba717..ff18441 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 _0xeb8d=['length','nolimit','order','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','render','merge','contact','message','agent','index','ChatQueueReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields'];(function(_0x1470c0,_0x230b38){var _0x28a594=function(_0x4ea2d1){while(--_0x4ea2d1){_0x1470c0['push'](_0x1470c0['shift']());}};_0x28a594(++_0x230b38);}(_0xeb8d,0xfb));var _0xdeb8=function(_0x48180b,_0x4ace07){_0x48180b=_0x48180b-0x0;var _0x5b44a4=_0xeb8d[_0x48180b];return _0x5b44a4;};'use strict';var emlformat=require(_0xdeb8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdeb8('0x1'));var jsonpatch=require(_0xdeb8('0x2'));var rp=require('request-promise');var moment=require(_0xdeb8('0x3'));var BPromise=require(_0xdeb8('0x4'));var Mustache=require(_0xdeb8('0x5'));var util=require(_0xdeb8('0x6'));var path=require(_0xdeb8('0x7'));var sox=require('sox');var csv=require(_0xdeb8('0x8'));var ejs=require(_0xdeb8('0x9'));var fs=require('fs');var fs_extra=require(_0xdeb8('0xa'));var _=require(_0xdeb8('0xb'));var squel=require('squel');var crypto=require(_0xdeb8('0xc'));var jsforce=require(_0xdeb8('0xd'));var deskjs=require(_0xdeb8('0xe'));var toCsv=require(_0xdeb8('0x8'));var querystring=require(_0xdeb8('0xf'));var Papa=require(_0xdeb8('0x10'));var Redis=require(_0xdeb8('0x11'));var authService=require(_0xdeb8('0x12'));var qs=require(_0xdeb8('0x13'));var as=require(_0xdeb8('0x14'));var hardwareService=require(_0xdeb8('0x15'));var logger=require(_0xdeb8('0x16'))(_0xdeb8('0x17'));var utils=require('../../config/utils');var config=require(_0xdeb8('0x18'));var licenseUtil=require(_0xdeb8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f1ff3,_0x4d7ef0){_0x4d7ef0=_0x4d7ef0||0xcc;return function(_0x5ed24a){if(_0x5ed24a){return _0x1f1ff3[_0xdeb8('0x1a')](_0x4d7ef0);}return _0x1f1ff3[_0xdeb8('0x1b')](_0x4d7ef0)['end']();};}function respondWithResult(_0x1be6ab,_0x4614c9){_0x4614c9=_0x4614c9||0xc8;return function(_0x3987db){if(_0x3987db){return _0x1be6ab[_0xdeb8('0x1b')](_0x4614c9)[_0xdeb8('0x1c')](_0x3987db);}};}function respondWithFilteredResult(_0x5af056,_0x2e43e7){return function(_0x1172a1){if(_0x1172a1){var _0x51c4b2=typeof _0x2e43e7['offset']===_0xdeb8('0x1d')&&typeof _0x2e43e7[_0xdeb8('0x1e')]===_0xdeb8('0x1d');var _0x522eef=_0x1172a1[_0xdeb8('0x1f')];var _0x3990e9=_0x51c4b2?0x0:_0x2e43e7[_0xdeb8('0x20')];var _0x4f15f0=_0x51c4b2?_0x1172a1[_0xdeb8('0x1f')]:_0x2e43e7[_0xdeb8('0x20')]+_0x2e43e7[_0xdeb8('0x1e')];var _0xb3b0ed;if(_0x4f15f0>=_0x522eef){_0x4f15f0=_0x522eef;_0xb3b0ed=0xc8;}else{_0xb3b0ed=0xce;}_0x5af056[_0xdeb8('0x1b')](_0xb3b0ed);return _0x5af056[_0xdeb8('0x21')](_0xdeb8('0x22'),_0x3990e9+'-'+_0x4f15f0+'/'+_0x522eef)[_0xdeb8('0x1c')](_0x1172a1);}return null;};}function patchUpdates(_0x50e36d){return function(_0x15f013){try{jsonpatch[_0xdeb8('0x23')](_0x15f013,_0x50e36d,!![]);}catch(_0x27dc1a){return BPromise[_0xdeb8('0x24')](_0x27dc1a);}return _0x15f013[_0xdeb8('0x25')]();};}function saveUpdates(_0x5bf442,_0x545686){return function(_0xe274f5){if(_0xe274f5){return _0xe274f5[_0xdeb8('0x26')](_0x5bf442)[_0xdeb8('0x27')](function(_0x41bb1e){return _0x41bb1e;});}return null;};}function removeEntity(_0x4a071d,_0x4b662c){return function(_0x45874c){if(_0x45874c){return _0x45874c[_0xdeb8('0x28')]()['then'](function(){_0x4a071d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x298ce4,_0xd2a732){return function(_0x58ed15){if(!_0x58ed15){_0x298ce4[_0xdeb8('0x1a')](0x194);}return _0x58ed15;};}function handleError(_0x18e674,_0x47174a){_0x47174a=_0x47174a||0x1f4;return function(_0x32040a){logger[_0xdeb8('0x29')](_0x32040a[_0xdeb8('0x2a')]);if(_0x32040a[_0xdeb8('0x2b')]){delete _0x32040a[_0xdeb8('0x2b')];}_0x18e674[_0xdeb8('0x1b')](_0x47174a)['send'](_0x32040a);};}function getMustacheRender(_0x4fd753,_0x46e9d1){return Mustache[_0xdeb8('0x2c')](_0x4fd753,_[_0xdeb8('0x2d')](_0x46e9d1['body'],{'contact':_0x46e9d1[_0xdeb8('0x2e')],'message':_0x46e9d1[_0xdeb8('0x2f')],'agent':_0x46e9d1[_0xdeb8('0x30')],'interaction':_0x46e9d1['interaction'],'account':_0x46e9d1['account']}))||'';}exports[_0xdeb8('0x31')]=function(_0x323d8a,_0x409251){var _0x2a9b00={},_0x45d04d={},_0x1b22a2={'count':0x0,'rows':[]};var _0x5a7ea8=_['map'](db[_0xdeb8('0x32')][_0xdeb8('0x33')],function(_0x1173df){return{'name':_0x1173df[_0xdeb8('0x34')],'type':_0x1173df[_0xdeb8('0x35')]['key']};});_0x45d04d['model']=_['map'](_0x5a7ea8,_0xdeb8('0x2b'));_0x45d04d['query']=_[_0xdeb8('0x36')](_0x323d8a[_0xdeb8('0x37')]);_0x45d04d[_0xdeb8('0x38')]=_[_0xdeb8('0x39')](_0x45d04d[_0xdeb8('0x3a')],_0x45d04d[_0xdeb8('0x37')]);_0x2a9b00[_0xdeb8('0x3b')]=_[_0xdeb8('0x39')](_0x45d04d[_0xdeb8('0x3a')],qs[_0xdeb8('0x3c')](_0x323d8a['query'][_0xdeb8('0x3c')]));_0x2a9b00['attributes']=_0x2a9b00[_0xdeb8('0x3b')][_0xdeb8('0x3d')]?_0x2a9b00[_0xdeb8('0x3b')]:_0x45d04d[_0xdeb8('0x3a')];if(!_0x323d8a[_0xdeb8('0x37')]['hasOwnProperty'](_0xdeb8('0x3e'))){_0x2a9b00[_0xdeb8('0x1e')]=qs[_0xdeb8('0x1e')](_0x323d8a[_0xdeb8('0x37')][_0xdeb8('0x1e')]);_0x2a9b00[_0xdeb8('0x20')]=qs[_0xdeb8('0x20')](_0x323d8a[_0xdeb8('0x37')][_0xdeb8('0x20')]);}_0x2a9b00[_0xdeb8('0x3f')]=qs['sort'](_0x323d8a[_0xdeb8('0x37')]['sort']);_0x2a9b00['where']=qs[_0xdeb8('0x38')](_['pick'](_0x323d8a[_0xdeb8('0x37')],_0x45d04d['filters']),_0x5a7ea8);if(_0x323d8a[_0xdeb8('0x37')][_0xdeb8('0x40')]){_0x2a9b00[_0xdeb8('0x41')]=_[_0xdeb8('0x2d')](_0x2a9b00[_0xdeb8('0x41')],{'$or':_['map'](_0x5a7ea8,function(_0x4adae0){if(_0x4adae0[_0xdeb8('0x35')]!==_0xdeb8('0x42')){var _0x1430a7={};_0x1430a7[_0x4adae0[_0xdeb8('0x2b')]]={'$like':'%'+_0x323d8a[_0xdeb8('0x37')][_0xdeb8('0x40')]+'%'};return _0x1430a7;}})});}_0x2a9b00=_[_0xdeb8('0x2d')]({},_0x2a9b00,_0x323d8a[_0xdeb8('0x43')]);var _0x46da4a={'where':_0x2a9b00['where']};return db[_0xdeb8('0x32')][_0xdeb8('0x1f')](_0x46da4a)[_0xdeb8('0x27')](function(_0x1e8820){_0x1b22a2[_0xdeb8('0x1f')]=_0x1e8820;if(_0x323d8a[_0xdeb8('0x37')][_0xdeb8('0x44')]){_0x2a9b00[_0xdeb8('0x45')]=[{'all':!![]}];}return db[_0xdeb8('0x32')][_0xdeb8('0x46')](_0x2a9b00);})[_0xdeb8('0x27')](function(_0xdc6932){_0x1b22a2['rows']=_0xdc6932;return _0x1b22a2;})['then'](respondWithFilteredResult(_0x409251,_0x2a9b00))[_0xdeb8('0x47')](handleError(_0x409251,null));};exports[_0xdeb8('0x48')]=function(_0x4dde62,_0x584ddb){var _0x410cd7={'raw':!![],'where':{'id':_0x4dde62[_0xdeb8('0x49')]['id']}},_0x17112a={};_0x17112a[_0xdeb8('0x3a')]=_[_0xdeb8('0x36')](db[_0xdeb8('0x32')][_0xdeb8('0x33')]);_0x17112a[_0xdeb8('0x37')]=_[_0xdeb8('0x36')](_0x4dde62['query']);_0x17112a[_0xdeb8('0x38')]=_[_0xdeb8('0x39')](_0x17112a[_0xdeb8('0x3a')],_0x17112a[_0xdeb8('0x37')]);_0x410cd7['attributes']=_[_0xdeb8('0x39')](_0x17112a['model'],qs[_0xdeb8('0x3c')](_0x4dde62[_0xdeb8('0x37')]['fields']));_0x410cd7[_0xdeb8('0x3b')]=_0x410cd7[_0xdeb8('0x3b')][_0xdeb8('0x3d')]?_0x410cd7['attributes']:_0x17112a['model'];if(_0x4dde62[_0xdeb8('0x37')][_0xdeb8('0x44')]){_0x410cd7[_0xdeb8('0x45')]=[{'all':!![]}];}_0x410cd7=_[_0xdeb8('0x2d')]({},_0x410cd7,_0x4dde62['options']);return db['ChatQueueReport'][_0xdeb8('0x4a')](_0x410cd7)['then'](handleEntityNotFound(_0x584ddb,null))[_0xdeb8('0x27')](respondWithResult(_0x584ddb,null))['catch'](handleError(_0x584ddb,null));};exports['create']=function(_0xe18b5c,_0x3c5e2a){return db[_0xdeb8('0x32')][_0xdeb8('0x4b')](_0xe18b5c[_0xdeb8('0x4c')],{})[_0xdeb8('0x27')](respondWithResult(_0x3c5e2a,0xc9))['catch'](handleError(_0x3c5e2a,null));};exports[_0xdeb8('0x26')]=function(_0x159d4a,_0x38cd79){if(_0x159d4a['body']['id']){delete _0x159d4a['body']['id'];}return db[_0xdeb8('0x32')][_0xdeb8('0x4a')]({'where':{'id':_0x159d4a[_0xdeb8('0x49')]['id']}})['then'](handleEntityNotFound(_0x38cd79,null))[_0xdeb8('0x27')](saveUpdates(_0x159d4a['body'],null))['then'](respondWithResult(_0x38cd79,null))[_0xdeb8('0x47')](handleError(_0x38cd79,null));};exports[_0xdeb8('0x28')]=function(_0x34b7e2,_0x37c4d9){return db['ChatQueueReport']['find']({'where':{'id':_0x34b7e2[_0xdeb8('0x49')]['id']}})[_0xdeb8('0x27')](handleEntityNotFound(_0x37c4d9,null))['then'](removeEntity(_0x37c4d9,null))[_0xdeb8('0x47')](handleError(_0x37c4d9,null));};exports[_0xdeb8('0x4d')]=function(_0x1571cb,_0x407c14){return db['ChatQueueReport'][_0xdeb8('0x4d')]()['then'](respondWithResult(_0x407c14,null))[_0xdeb8('0x47')](handleError(_0x407c14,null));}; \ No newline at end of file +var _0xb9c9=['mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','merge','body','contact','agent','interaction','account','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','options','include','rows','params','keys','includeAll','find','catch','create','describe','eml-format','fast-json-patch','bluebird'];(function(_0x5f3f78,_0x214d16){var _0x9a71c0=function(_0xdd06c3){while(--_0xdd06c3){_0x5f3f78['push'](_0x5f3f78['shift']());}};_0x9a71c0(++_0x214d16);}(_0xb9c9,0x95));var _0x9b9c=function(_0x276b5e,_0x45a3d3){_0x276b5e=_0x276b5e-0x0;var _0x4aa2a1=_0xb9c9[_0x276b5e];return _0x4aa2a1;};'use strict';var emlformat=require(_0x9b9c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9b9c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9b9c('0x2'));var Mustache=require(_0x9b9c('0x3'));var util=require(_0x9b9c('0x4'));var path=require(_0x9b9c('0x5'));var sox=require(_0x9b9c('0x6'));var csv=require(_0x9b9c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9b9c('0x8'));var _=require(_0x9b9c('0x9'));var squel=require(_0x9b9c('0xa'));var crypto=require(_0x9b9c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9b9c('0xc'));var Papa=require(_0x9b9c('0xd'));var Redis=require(_0x9b9c('0xe'));var authService=require(_0x9b9c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b9c('0x10'));var logger=require('../../config/logger')(_0x9b9c('0x11'));var utils=require(_0x9b9c('0x12'));var config=require(_0x9b9c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b9c('0x14'))['db'];function respondWithStatusCode(_0x43164e,_0x3647f9){_0x3647f9=_0x3647f9||0xcc;return function(_0x24ae2f){if(_0x24ae2f){return _0x43164e[_0x9b9c('0x15')](_0x3647f9);}return _0x43164e[_0x9b9c('0x16')](_0x3647f9)[_0x9b9c('0x17')]();};}function respondWithResult(_0x1e9bcf,_0x3f6efb){_0x3f6efb=_0x3f6efb||0xc8;return function(_0x566d30){if(_0x566d30){return _0x1e9bcf['status'](_0x3f6efb)[_0x9b9c('0x18')](_0x566d30);}};}function respondWithFilteredResult(_0x3df1eb,_0x440573){return function(_0x58cb49){if(_0x58cb49){var _0x58ea24=typeof _0x440573['offset']===_0x9b9c('0x19')&&typeof _0x440573[_0x9b9c('0x1a')]===_0x9b9c('0x19');var _0x12e57f=_0x58cb49[_0x9b9c('0x1b')];var _0x519644=_0x58ea24?0x0:_0x440573['offset'];var _0x60dd08=_0x58ea24?_0x58cb49[_0x9b9c('0x1b')]:_0x440573['offset']+_0x440573[_0x9b9c('0x1a')];var _0x5d34dd;if(_0x60dd08>=_0x12e57f){_0x60dd08=_0x12e57f;_0x5d34dd=0xc8;}else{_0x5d34dd=0xce;}_0x3df1eb[_0x9b9c('0x16')](_0x5d34dd);return _0x3df1eb['set']('Content-Range',_0x519644+'-'+_0x60dd08+'/'+_0x12e57f)['json'](_0x58cb49);}return null;};}function patchUpdates(_0xdccd24){return function(_0x3f163a){try{jsonpatch[_0x9b9c('0x1c')](_0x3f163a,_0xdccd24,!![]);}catch(_0x29639e){return BPromise[_0x9b9c('0x1d')](_0x29639e);}return _0x3f163a['save']();};}function saveUpdates(_0x261f0d,_0x41645a){return function(_0x31f36c){if(_0x31f36c){return _0x31f36c[_0x9b9c('0x1e')](_0x261f0d)[_0x9b9c('0x1f')](function(_0x16737d){return _0x16737d;});}return null;};}function removeEntity(_0x27e484,_0x23e89f){return function(_0x1b89ff){if(_0x1b89ff){return _0x1b89ff[_0x9b9c('0x20')]()['then'](function(){_0x27e484[_0x9b9c('0x16')](0xcc)[_0x9b9c('0x17')]();});}};}function handleEntityNotFound(_0x487731,_0x3a5fc4){return function(_0x3cbafa){if(!_0x3cbafa){_0x487731['sendStatus'](0x194);}return _0x3cbafa;};}function handleError(_0x38fcd9,_0x50b33e){_0x50b33e=_0x50b33e||0x1f4;return function(_0x322b4c){logger[_0x9b9c('0x21')](_0x322b4c[_0x9b9c('0x22')]);if(_0x322b4c[_0x9b9c('0x23')]){delete _0x322b4c['name'];}_0x38fcd9[_0x9b9c('0x16')](_0x50b33e)[_0x9b9c('0x24')](_0x322b4c);};}function getMustacheRender(_0x3e21e9,_0x393f49){return Mustache['render'](_0x3e21e9,_[_0x9b9c('0x25')](_0x393f49[_0x9b9c('0x26')],{'contact':_0x393f49[_0x9b9c('0x27')],'message':_0x393f49['message'],'agent':_0x393f49[_0x9b9c('0x28')],'interaction':_0x393f49[_0x9b9c('0x29')],'account':_0x393f49[_0x9b9c('0x2a')]}))||'';}exports[_0x9b9c('0x2b')]=function(_0x35f5f4,_0x235272){var _0x38d46b={},_0x8b96c4={},_0x2dfde9={'count':0x0,'rows':[]};var _0xe7ef0c=_[_0x9b9c('0x2c')](db[_0x9b9c('0x2d')][_0x9b9c('0x2e')],function(_0x108e9e){return{'name':_0x108e9e[_0x9b9c('0x2f')],'type':_0x108e9e[_0x9b9c('0x30')][_0x9b9c('0x31')]};});_0x8b96c4[_0x9b9c('0x32')]=_[_0x9b9c('0x2c')](_0xe7ef0c,_0x9b9c('0x23'));_0x8b96c4[_0x9b9c('0x33')]=_['keys'](_0x35f5f4[_0x9b9c('0x33')]);_0x8b96c4[_0x9b9c('0x34')]=_['intersection'](_0x8b96c4[_0x9b9c('0x32')],_0x8b96c4[_0x9b9c('0x33')]);_0x38d46b[_0x9b9c('0x35')]=_[_0x9b9c('0x36')](_0x8b96c4[_0x9b9c('0x32')],qs[_0x9b9c('0x37')](_0x35f5f4[_0x9b9c('0x33')][_0x9b9c('0x37')]));_0x38d46b[_0x9b9c('0x35')]=_0x38d46b[_0x9b9c('0x35')][_0x9b9c('0x38')]?_0x38d46b['attributes']:_0x8b96c4['model'];if(!_0x35f5f4[_0x9b9c('0x33')][_0x9b9c('0x39')](_0x9b9c('0x3a'))){_0x38d46b['limit']=qs[_0x9b9c('0x1a')](_0x35f5f4[_0x9b9c('0x33')][_0x9b9c('0x1a')]);_0x38d46b[_0x9b9c('0x3b')]=qs['offset'](_0x35f5f4['query'][_0x9b9c('0x3b')]);}_0x38d46b[_0x9b9c('0x3c')]=qs[_0x9b9c('0x3d')](_0x35f5f4[_0x9b9c('0x33')][_0x9b9c('0x3d')]);_0x38d46b[_0x9b9c('0x3e')]=qs[_0x9b9c('0x34')](_[_0x9b9c('0x3f')](_0x35f5f4[_0x9b9c('0x33')],_0x8b96c4[_0x9b9c('0x34')]),_0xe7ef0c);if(_0x35f5f4[_0x9b9c('0x33')][_0x9b9c('0x40')]){_0x38d46b[_0x9b9c('0x3e')]=_[_0x9b9c('0x25')](_0x38d46b[_0x9b9c('0x3e')],{'$or':_[_0x9b9c('0x2c')](_0xe7ef0c,function(_0x430524){if(_0x430524[_0x9b9c('0x30')]!==_0x9b9c('0x41')){var _0x13f46f={};_0x13f46f[_0x430524[_0x9b9c('0x23')]]={'$like':'%'+_0x35f5f4[_0x9b9c('0x33')][_0x9b9c('0x40')]+'%'};return _0x13f46f;}})});}_0x38d46b=_[_0x9b9c('0x25')]({},_0x38d46b,_0x35f5f4[_0x9b9c('0x42')]);var _0x1b461e={'where':_0x38d46b[_0x9b9c('0x3e')]};return db['ChatQueueReport']['count'](_0x1b461e)[_0x9b9c('0x1f')](function(_0x3254d8){_0x2dfde9['count']=_0x3254d8;if(_0x35f5f4['query']['includeAll']){_0x38d46b[_0x9b9c('0x43')]=[{'all':!![]}];}return db[_0x9b9c('0x2d')]['findAll'](_0x38d46b);})[_0x9b9c('0x1f')](function(_0x49d16c){_0x2dfde9[_0x9b9c('0x44')]=_0x49d16c;return _0x2dfde9;})[_0x9b9c('0x1f')](respondWithFilteredResult(_0x235272,_0x38d46b))['catch'](handleError(_0x235272,null));};exports['show']=function(_0x1ddf5a,_0x515b99){var _0x506f8a={'raw':!![],'where':{'id':_0x1ddf5a[_0x9b9c('0x45')]['id']}},_0x3ed4a1={};_0x3ed4a1[_0x9b9c('0x32')]=_[_0x9b9c('0x46')](db[_0x9b9c('0x2d')][_0x9b9c('0x2e')]);_0x3ed4a1[_0x9b9c('0x33')]=_[_0x9b9c('0x46')](_0x1ddf5a[_0x9b9c('0x33')]);_0x3ed4a1[_0x9b9c('0x34')]=_[_0x9b9c('0x36')](_0x3ed4a1['model'],_0x3ed4a1['query']);_0x506f8a[_0x9b9c('0x35')]=_[_0x9b9c('0x36')](_0x3ed4a1[_0x9b9c('0x32')],qs[_0x9b9c('0x37')](_0x1ddf5a[_0x9b9c('0x33')][_0x9b9c('0x37')]));_0x506f8a['attributes']=_0x506f8a[_0x9b9c('0x35')][_0x9b9c('0x38')]?_0x506f8a[_0x9b9c('0x35')]:_0x3ed4a1[_0x9b9c('0x32')];if(_0x1ddf5a['query'][_0x9b9c('0x47')]){_0x506f8a[_0x9b9c('0x43')]=[{'all':!![]}];}_0x506f8a=_['merge']({},_0x506f8a,_0x1ddf5a[_0x9b9c('0x42')]);return db['ChatQueueReport'][_0x9b9c('0x48')](_0x506f8a)[_0x9b9c('0x1f')](handleEntityNotFound(_0x515b99,null))[_0x9b9c('0x1f')](respondWithResult(_0x515b99,null))[_0x9b9c('0x49')](handleError(_0x515b99,null));};exports[_0x9b9c('0x4a')]=function(_0x193260,_0x32f599){return db['ChatQueueReport'][_0x9b9c('0x4a')](_0x193260[_0x9b9c('0x26')],{})['then'](respondWithResult(_0x32f599,0xc9))['catch'](handleError(_0x32f599,null));};exports[_0x9b9c('0x1e')]=function(_0x1a214d,_0x2c880b){if(_0x1a214d[_0x9b9c('0x26')]['id']){delete _0x1a214d[_0x9b9c('0x26')]['id'];}return db[_0x9b9c('0x2d')][_0x9b9c('0x48')]({'where':{'id':_0x1a214d['params']['id']}})[_0x9b9c('0x1f')](handleEntityNotFound(_0x2c880b,null))[_0x9b9c('0x1f')](saveUpdates(_0x1a214d[_0x9b9c('0x26')],null))[_0x9b9c('0x1f')](respondWithResult(_0x2c880b,null))['catch'](handleError(_0x2c880b,null));};exports['destroy']=function(_0x2da7cc,_0x5df295){return db[_0x9b9c('0x2d')][_0x9b9c('0x48')]({'where':{'id':_0x2da7cc['params']['id']}})[_0x9b9c('0x1f')](handleEntityNotFound(_0x5df295,null))['then'](removeEntity(_0x5df295,null))[_0x9b9c('0x49')](handleError(_0x5df295,null));};exports[_0x9b9c('0x4b')]=function(_0x2b6f79,_0x27bfb6){return db[_0x9b9c('0x2d')][_0x9b9c('0x4b')]()[_0x9b9c('0x1f')](respondWithResult(_0x27bfb6,null))[_0x9b9c('0x49')](handleError(_0x27bfb6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 794df13..0715184 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 _0x5942=['exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x46e3af,_0x5bc4b7){var _0x2b002f=function(_0x107230){while(--_0x107230){_0x46e3af['push'](_0x46e3af['shift']());}};_0x2b002f(++_0x5bc4b7);}(_0x5942,0x19d));var _0x2594=function(_0x4bbec7,_0x25ecbc){_0x4bbec7=_0x4bbec7-0x0;var _0x4c52d1=_0x5942[_0x4bbec7];return _0x4c52d1;};'use strict';var _=require(_0x2594('0x0'));var util=require('util');var logger=require(_0x2594('0x1'))(_0x2594('0x2'));var moment=require('moment');var BPromise=require(_0x2594('0x3'));var rp=require(_0x2594('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2594('0x5'));var config=require(_0x2594('0x6'));var attributes=require('./chatQueueReport.attributes');module[_0x2594('0x7')]=function(_0x3f4555,_0x5be5cb){return _0x3f4555[_0x2594('0x8')](_0x2594('0x9'),attributes,{'tableName':_0x2594('0xa'),'paranoid':![],'indexes':[{'name':_0x2594('0xb'),'fields':[_0x2594('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4b5=['exports','ChatQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes'];(function(_0x36f241,_0x5e5e56){var _0x2dcf34=function(_0x3fec0b){while(--_0x3fec0b){_0x36f241['push'](_0x36f241['shift']());}};_0x2dcf34(++_0x5e5e56);}(_0xe4b5,0x121));var _0x5e4b=function(_0x1583d4,_0x5112e4){_0x1583d4=_0x1583d4-0x0;var _0x54b097=_0xe4b5[_0x1583d4];return _0x54b097;};'use strict';var _=require(_0x5e4b('0x0'));var util=require(_0x5e4b('0x1'));var logger=require('../../config/logger')(_0x5e4b('0x2'));var moment=require(_0x5e4b('0x3'));var BPromise=require(_0x5e4b('0x4'));var rp=require(_0x5e4b('0x5'));var fs=require('fs');var path=require(_0x5e4b('0x6'));var rimraf=require(_0x5e4b('0x7'));var config=require(_0x5e4b('0x8'));var attributes=require(_0x5e4b('0x9'));module[_0x5e4b('0xa')]=function(_0x361b87,_0x1e49bb){return _0x361b87['define'](_0x5e4b('0xb'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x5e4b('0xc'),'fields':[_0x5e4b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 940d3a7..39faaf5 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 _0xaa97=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','ChatQueueReport','create','body','options','raw','debug','CreateChatQueueReport','where','attributes','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4c245f,_0x2bb619){var _0x4a2b5a=function(_0x5b1279){while(--_0x5b1279){_0x4c245f['push'](_0x4c245f['shift']());}};_0x4a2b5a(++_0x2bb619);}(_0xaa97,0x126));var _0x7aa9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xaa97[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7aa9('0x0'));var util=require('util');var moment=require(_0x7aa9('0x1'));var BPromise=require(_0x7aa9('0x2'));var rs=require(_0x7aa9('0x3'));var fs=require('fs');var Redis=require(_0x7aa9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7aa9('0x5'));var logger=require(_0x7aa9('0x6'))(_0x7aa9('0x7'));var config=require(_0x7aa9('0x8'));var jayson=require(_0x7aa9('0x9'));var client=jayson[_0x7aa9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x281490,_0x5683ce,_0x22e8a8){return new BPromise(function(_0x25ab84,_0x459710){return client[_0x7aa9('0xb')](_0x281490,_0x22e8a8)[_0x7aa9('0xc')](function(_0x39043b){logger[_0x7aa9('0xd')](_0x7aa9('0xe'),_0x5683ce,_0x7aa9('0xf'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5683ce,'request\x20sent',JSON[_0x7aa9('0x10')](_0x39043b));if(_0x39043b[_0x7aa9('0x11')]){if(_0x39043b[_0x7aa9('0x11')]['code']===0x1f4){logger[_0x7aa9('0x11')](_0x7aa9('0xe'),_0x5683ce,_0x39043b[_0x7aa9('0x11')]['message']);return _0x459710(_0x39043b[_0x7aa9('0x11')][_0x7aa9('0x12')]);}logger[_0x7aa9('0x11')](_0x7aa9('0xe'),_0x5683ce,_0x39043b[_0x7aa9('0x11')]['message']);return _0x25ab84(_0x39043b[_0x7aa9('0x11')][_0x7aa9('0x12')]);}else{logger[_0x7aa9('0xd')](_0x7aa9('0xe'),_0x5683ce,_0x7aa9('0xf'));_0x25ab84(_0x39043b['result'][_0x7aa9('0x12')]);}})[_0x7aa9('0x13')](function(_0x1e4066){logger[_0x7aa9('0x11')](_0x7aa9('0xe'),_0x5683ce,_0x1e4066);_0x459710(_0x1e4066);});});}exports['CreateChatQueueReport']=function(_0x223773){var _0xcce176=this;return new Promise(function(_0x32c288,_0x7bc9cf){return db[_0x7aa9('0x14')][_0x7aa9('0x15')](_0x223773[_0x7aa9('0x16')],{'raw':_0x223773['options']?_0x223773[_0x7aa9('0x17')][_0x7aa9('0x18')]===undefined?!![]:![]:!![]})[_0x7aa9('0xc')](function(_0x33fdd3){logger['info']('CreateChatQueueReport',_0x223773);logger[_0x7aa9('0x19')](_0x7aa9('0x1a'),_0x223773,JSON[_0x7aa9('0x10')](_0x33fdd3));_0x32c288(_0x33fdd3);})[_0x7aa9('0x13')](function(_0x14dbbe){logger[_0x7aa9('0x11')]('CreateChatQueueReport',_0x14dbbe[_0x7aa9('0x12')],_0x223773);_0x7bc9cf(_0xcce176[_0x7aa9('0x11')](0x1f4,_0x14dbbe['message']));});});};exports['UpdateChatQueueReport']=function(_0x1084e8){var _0x31e1c3=this;return new Promise(function(_0x6f6b5e,_0x2be032){return db[_0x7aa9('0x14')]['update'](_0x1084e8['body'],{'raw':_0x1084e8['options']?_0x1084e8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1084e8[_0x7aa9('0x17')]?_0x1084e8['options'][_0x7aa9('0x1b')]||null:null,'attributes':_0x1084e8[_0x7aa9('0x17')]?_0x1084e8[_0x7aa9('0x17')][_0x7aa9('0x1c')]||null:null,'limit':_0x1084e8['options']?_0x1084e8['options']['limit']||null:null})[_0x7aa9('0xc')](function(_0x476325){logger[_0x7aa9('0xd')](_0x7aa9('0x1d'),_0x1084e8);logger[_0x7aa9('0x19')](_0x7aa9('0x1d'),_0x1084e8,JSON['stringify'](_0x476325));_0x6f6b5e(_0x476325);})[_0x7aa9('0x13')](function(_0x1b00fc){logger['error']('UpdateChatQueueReport',_0x1b00fc[_0x7aa9('0x12')],_0x1084e8);_0x2be032(_0x31e1c3[_0x7aa9('0x11')](0x1f4,_0x1b00fc[_0x7aa9('0x12')]));});});}; \ No newline at end of file +var _0x8100=['CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','update','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0xc5427d,_0x434d17){var _0x5184c1=function(_0x5c140f){while(--_0x5c140f){_0xc5427d['push'](_0xc5427d['shift']());}};_0x5184c1(++_0x434d17);}(_0x8100,0x19d));var _0x0810=function(_0x5119c4,_0x1b1dd7){_0x5119c4=_0x5119c4-0x0;var _0x3fc072=_0x8100[_0x5119c4];return _0x3fc072;};'use strict';var _=require(_0x0810('0x0'));var util=require('util');var moment=require(_0x0810('0x1'));var BPromise=require(_0x0810('0x2'));var rs=require(_0x0810('0x3'));var fs=require('fs');var Redis=require(_0x0810('0x4'));var db=require(_0x0810('0x5'))['db'];var utils=require(_0x0810('0x6'));var logger=require('../../config/logger')(_0x0810('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0810('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc3d55a,_0x1e9bd8,_0x13d2dd){return new BPromise(function(_0x3e95fb,_0x457ef0){return client[_0x0810('0x9')](_0xc3d55a,_0x13d2dd)[_0x0810('0xa')](function(_0x18b74d){logger[_0x0810('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x1e9bd8,_0x0810('0xc'));logger[_0x0810('0xd')](_0x0810('0xe'),_0x1e9bd8,'request\x20sent',JSON['stringify'](_0x18b74d));if(_0x18b74d[_0x0810('0xf')]){if(_0x18b74d[_0x0810('0xf')][_0x0810('0x10')]===0x1f4){logger[_0x0810('0xf')](_0x0810('0x11'),_0x1e9bd8,_0x18b74d[_0x0810('0xf')]['message']);return _0x457ef0(_0x18b74d[_0x0810('0xf')][_0x0810('0x12')]);}logger[_0x0810('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x1e9bd8,_0x18b74d['error'][_0x0810('0x12')]);return _0x3e95fb(_0x18b74d['error'][_0x0810('0x12')]);}else{logger[_0x0810('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x1e9bd8,_0x0810('0xc'));_0x3e95fb(_0x18b74d[_0x0810('0x13')][_0x0810('0x12')]);}})[_0x0810('0x14')](function(_0x1c2a11){logger[_0x0810('0xf')](_0x0810('0x11'),_0x1e9bd8,_0x1c2a11);_0x457ef0(_0x1c2a11);});});}exports[_0x0810('0x15')]=function(_0x5cf7f3){var _0x265ab1=this;return new Promise(function(_0x597194,_0x1adbc9){return db[_0x0810('0x16')][_0x0810('0x17')](_0x5cf7f3[_0x0810('0x18')],{'raw':_0x5cf7f3['options']?_0x5cf7f3[_0x0810('0x19')][_0x0810('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5a37f7){logger[_0x0810('0xb')](_0x0810('0x15'),_0x5cf7f3);logger[_0x0810('0xd')](_0x0810('0x15'),_0x5cf7f3,JSON[_0x0810('0x1b')](_0x5a37f7));_0x597194(_0x5a37f7);})[_0x0810('0x14')](function(_0x5b7d21){logger['error']('CreateChatQueueReport',_0x5b7d21[_0x0810('0x12')],_0x5cf7f3);_0x1adbc9(_0x265ab1[_0x0810('0xf')](0x1f4,_0x5b7d21[_0x0810('0x12')]));});});};exports[_0x0810('0x1c')]=function(_0x34b156){var _0x10f81c=this;return new Promise(function(_0x326b3c,_0x23565a){return db[_0x0810('0x16')][_0x0810('0x1d')](_0x34b156[_0x0810('0x18')],{'raw':_0x34b156[_0x0810('0x19')]?_0x34b156[_0x0810('0x19')][_0x0810('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34b156[_0x0810('0x19')]?_0x34b156[_0x0810('0x19')][_0x0810('0x1e')]||null:null,'attributes':_0x34b156[_0x0810('0x19')]?_0x34b156[_0x0810('0x19')]['attributes']||null:null,'limit':_0x34b156[_0x0810('0x19')]?_0x34b156[_0x0810('0x19')]['limit']||null:null})[_0x0810('0xa')](function(_0x4922e4){logger[_0x0810('0xb')](_0x0810('0x1c'),_0x34b156);logger[_0x0810('0xd')](_0x0810('0x1c'),_0x34b156,JSON['stringify'](_0x4922e4));_0x326b3c(_0x4922e4);})[_0x0810('0x14')](function(_0x1cf632){logger[_0x0810('0xf')](_0x0810('0x1c'),_0x1cf632['message'],_0x34b156);_0x23565a(_0x10f81c['error'](0x1f4,_0x1cf632[_0x0810('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 5e94a89..aed5c93 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 _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x2d82d4,_0x2338ae){var _0x9fb857=function(_0x31b0b2){while(--_0x31b0b2){_0x2d82d4['push'](_0x2d82d4['shift']());}};_0x9fb857(++_0x2338ae);}(_0x7a54,0x106));var _0x47a5=function(_0x39dd6e,_0x380a53){_0x39dd6e=_0x39dd6e-0x0;var _0x160178=_0x7a54[_0x39dd6e];return _0x160178;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0xbb8432,_0x3b9a00){var _0x5a1594=function(_0x3c9097){while(--_0x3c9097){_0xbb8432['push'](_0xbb8432['shift']());}};_0x5a1594(++_0x3b9a00);}(_0x2ef3,0xba));var _0x32ef=function(_0x24e17e,_0x22109a){_0x24e17e=_0x24e17e-0x0;var _0x136b32=_0x2ef3[_0x24e17e];return _0x136b32;};'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('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0bd5dc2..cd79a79 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 _0x8471=['sequelize','exports','ENUM','queue'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x8471,0x160));var _0x1847=function(_0x14a921,_0x5db732){_0x14a921=_0x14a921-0x0;var _0x17272b=_0x8471[_0x14a921];return _0x17272b;};'use strict';var moment=require('moment');var Sequelize=require(_0x1847('0x0'));module[_0x1847('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1847('0x2')]('account','agent','queue'),'allowNull':![],'defaultValue':_0x1847('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x4435=['ENUM','account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5b8bec,_0x127b5f){var _0x98a1c6=function(_0x42a2bc){while(--_0x42a2bc){_0x5b8bec['push'](_0x5b8bec['shift']());}};_0x98a1c6(++_0x127b5f);}(_0x4435,0x11e));var _0x5443=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x4435[_0x11ce46];return _0x368a1e;};'use strict';var moment=require(_0x5443('0x0'));var Sequelize=require(_0x5443('0x1'));module[_0x5443('0x2')]={'uniqueid':{'type':Sequelize[_0x5443('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5443('0x4')](_0x5443('0x5'),_0x5443('0x6'),_0x5443('0x7')),'allowNull':![],'defaultValue':_0x5443('0x7')},'transferredAt':{'type':Sequelize[_0x5443('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x5443('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 9bf22c2..7a0a2aa 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 _0xfe41=['body','contact','agent','interaction','account','index','rawAttributes','fieldName','type','map','query','keys','model','attributes','intersection','fields','length','nolimit','order','where','filters','pick','VIRTUAL','filter','ChatTransferReport','include','findAll','rows','catch','show','params','includeAll','create','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','render','merge'];(function(_0x3dbd50,_0x99ad82){var _0x1c1da0=function(_0x19a0bb){while(--_0x19a0bb){_0x3dbd50['push'](_0x3dbd50['shift']());}};_0x1c1da0(++_0x99ad82);}(_0xfe41,0x10a));var _0x1fe4=function(_0x49b14d,_0x578d07){_0x49b14d=_0x49b14d-0x0;var _0x3d2488=_0xfe41[_0x49b14d];return _0x3d2488;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fe4('0x0'));var zipdir=require(_0x1fe4('0x1'));var jsonpatch=require(_0x1fe4('0x2'));var rp=require(_0x1fe4('0x3'));var moment=require(_0x1fe4('0x4'));var BPromise=require(_0x1fe4('0x5'));var Mustache=require(_0x1fe4('0x6'));var util=require(_0x1fe4('0x7'));var path=require('path');var sox=require(_0x1fe4('0x8'));var csv=require(_0x1fe4('0x9'));var ejs=require(_0x1fe4('0xa'));var fs=require('fs');var fs_extra=require(_0x1fe4('0xb'));var _=require(_0x1fe4('0xc'));var squel=require(_0x1fe4('0xd'));var crypto=require(_0x1fe4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1fe4('0xf'));var toCsv=require(_0x1fe4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1fe4('0x10'));var authService=require(_0x1fe4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1fe4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fe4('0x13'))(_0x1fe4('0x14'));var utils=require('../../config/utils');var config=require(_0x1fe4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1fe4('0x16'))['db'];function respondWithStatusCode(_0x4414a2,_0x4e108c){_0x4e108c=_0x4e108c||0xcc;return function(_0x504263){if(_0x504263){return _0x4414a2['sendStatus'](_0x4e108c);}return _0x4414a2['status'](_0x4e108c)[_0x1fe4('0x17')]();};}function respondWithResult(_0x28f810,_0x26cab9){_0x26cab9=_0x26cab9||0xc8;return function(_0x462372){if(_0x462372){return _0x28f810[_0x1fe4('0x18')](_0x26cab9)[_0x1fe4('0x19')](_0x462372);}};}function respondWithFilteredResult(_0xedd23c,_0x3ece07){return function(_0x1484f3){if(_0x1484f3){var _0x57a8ea=typeof _0x3ece07[_0x1fe4('0x1a')]===_0x1fe4('0x1b')&&typeof _0x3ece07[_0x1fe4('0x1c')]===_0x1fe4('0x1b');var _0xa38ea3=_0x1484f3[_0x1fe4('0x1d')];var _0x20052a=_0x57a8ea?0x0:_0x3ece07[_0x1fe4('0x1a')];var _0x47f9ba=_0x57a8ea?_0x1484f3[_0x1fe4('0x1d')]:_0x3ece07[_0x1fe4('0x1a')]+_0x3ece07[_0x1fe4('0x1c')];var _0x4ba9ec;if(_0x47f9ba>=_0xa38ea3){_0x47f9ba=_0xa38ea3;_0x4ba9ec=0xc8;}else{_0x4ba9ec=0xce;}_0xedd23c[_0x1fe4('0x18')](_0x4ba9ec);return _0xedd23c['set'](_0x1fe4('0x1e'),_0x20052a+'-'+_0x47f9ba+'/'+_0xa38ea3)[_0x1fe4('0x19')](_0x1484f3);}return null;};}function patchUpdates(_0x4c590a){return function(_0xb41c98){try{jsonpatch[_0x1fe4('0x1f')](_0xb41c98,_0x4c590a,!![]);}catch(_0x1bfd8c){return BPromise[_0x1fe4('0x20')](_0x1bfd8c);}return _0xb41c98['save']();};}function saveUpdates(_0x240155,_0x41360c){return function(_0x9410fc){if(_0x9410fc){return _0x9410fc[_0x1fe4('0x21')](_0x240155)[_0x1fe4('0x22')](function(_0x472b5a){return _0x472b5a;});}return null;};}function removeEntity(_0x362284,_0x1c07f7){return function(_0x17ea79){if(_0x17ea79){return _0x17ea79[_0x1fe4('0x23')]()[_0x1fe4('0x22')](function(){_0x362284[_0x1fe4('0x18')](0xcc)[_0x1fe4('0x17')]();});}};}function handleEntityNotFound(_0x2966f6,_0x48b8cc){return function(_0x14bb41){if(!_0x14bb41){_0x2966f6['sendStatus'](0x194);}return _0x14bb41;};}function handleError(_0xefb67a,_0x595585){_0x595585=_0x595585||0x1f4;return function(_0x5d93eb){logger[_0x1fe4('0x24')](_0x5d93eb[_0x1fe4('0x25')]);if(_0x5d93eb[_0x1fe4('0x26')]){delete _0x5d93eb['name'];}_0xefb67a['status'](_0x595585)[_0x1fe4('0x27')](_0x5d93eb);};}function getMustacheRender(_0x51204f,_0x5a5ac6){return Mustache[_0x1fe4('0x28')](_0x51204f,_[_0x1fe4('0x29')](_0x5a5ac6[_0x1fe4('0x2a')],{'contact':_0x5a5ac6[_0x1fe4('0x2b')],'message':_0x5a5ac6['message'],'agent':_0x5a5ac6[_0x1fe4('0x2c')],'interaction':_0x5a5ac6[_0x1fe4('0x2d')],'account':_0x5a5ac6[_0x1fe4('0x2e')]}))||'';}exports[_0x1fe4('0x2f')]=function(_0x4f1579,_0xcd5a31){var _0x45d42b={},_0x4170ff={},_0x403b12={'count':0x0,'rows':[]};var _0x476c1f=_['map'](db['ChatTransferReport'][_0x1fe4('0x30')],function(_0x322b83){return{'name':_0x322b83[_0x1fe4('0x31')],'type':_0x322b83[_0x1fe4('0x32')]['key']};});_0x4170ff['model']=_[_0x1fe4('0x33')](_0x476c1f,_0x1fe4('0x26'));_0x4170ff[_0x1fe4('0x34')]=_[_0x1fe4('0x35')](_0x4f1579['query']);_0x4170ff['filters']=_['intersection'](_0x4170ff[_0x1fe4('0x36')],_0x4170ff[_0x1fe4('0x34')]);_0x45d42b[_0x1fe4('0x37')]=_[_0x1fe4('0x38')](_0x4170ff[_0x1fe4('0x36')],qs[_0x1fe4('0x39')](_0x4f1579[_0x1fe4('0x34')]['fields']));_0x45d42b[_0x1fe4('0x37')]=_0x45d42b[_0x1fe4('0x37')][_0x1fe4('0x3a')]?_0x45d42b[_0x1fe4('0x37')]:_0x4170ff[_0x1fe4('0x36')];if(!_0x4f1579[_0x1fe4('0x34')]['hasOwnProperty'](_0x1fe4('0x3b'))){_0x45d42b[_0x1fe4('0x1c')]=qs['limit'](_0x4f1579['query'][_0x1fe4('0x1c')]);_0x45d42b[_0x1fe4('0x1a')]=qs[_0x1fe4('0x1a')](_0x4f1579[_0x1fe4('0x34')][_0x1fe4('0x1a')]);}_0x45d42b[_0x1fe4('0x3c')]=qs['sort'](_0x4f1579[_0x1fe4('0x34')]['sort']);_0x45d42b[_0x1fe4('0x3d')]=qs[_0x1fe4('0x3e')](_[_0x1fe4('0x3f')](_0x4f1579['query'],_0x4170ff[_0x1fe4('0x3e')]),_0x476c1f);if(_0x4f1579[_0x1fe4('0x34')]['filter']){_0x45d42b[_0x1fe4('0x3d')]=_[_0x1fe4('0x29')](_0x45d42b[_0x1fe4('0x3d')],{'$or':_['map'](_0x476c1f,function(_0x11ed6f){if(_0x11ed6f[_0x1fe4('0x32')]!==_0x1fe4('0x40')){var _0x2c948e={};_0x2c948e[_0x11ed6f[_0x1fe4('0x26')]]={'$like':'%'+_0x4f1579[_0x1fe4('0x34')][_0x1fe4('0x41')]+'%'};return _0x2c948e;}})});}_0x45d42b=_[_0x1fe4('0x29')]({},_0x45d42b,_0x4f1579['options']);var _0x1429be={'where':_0x45d42b[_0x1fe4('0x3d')]};return db[_0x1fe4('0x42')][_0x1fe4('0x1d')](_0x1429be)[_0x1fe4('0x22')](function(_0x2f13d4){_0x403b12[_0x1fe4('0x1d')]=_0x2f13d4;if(_0x4f1579[_0x1fe4('0x34')]['includeAll']){_0x45d42b[_0x1fe4('0x43')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x1fe4('0x44')](_0x45d42b);})[_0x1fe4('0x22')](function(_0x5cf77c){_0x403b12[_0x1fe4('0x45')]=_0x5cf77c;return _0x403b12;})[_0x1fe4('0x22')](respondWithFilteredResult(_0xcd5a31,_0x45d42b))[_0x1fe4('0x46')](handleError(_0xcd5a31,null));};exports[_0x1fe4('0x47')]=function(_0x42c57d,_0x1e5610){var _0x327e6c={'raw':!![],'where':{'id':_0x42c57d[_0x1fe4('0x48')]['id']}},_0x528d92={};_0x528d92[_0x1fe4('0x36')]=_['keys'](db['ChatTransferReport']['rawAttributes']);_0x528d92[_0x1fe4('0x34')]=_[_0x1fe4('0x35')](_0x42c57d['query']);_0x528d92[_0x1fe4('0x3e')]=_['intersection'](_0x528d92[_0x1fe4('0x36')],_0x528d92['query']);_0x327e6c[_0x1fe4('0x37')]=_[_0x1fe4('0x38')](_0x528d92[_0x1fe4('0x36')],qs[_0x1fe4('0x39')](_0x42c57d[_0x1fe4('0x34')]['fields']));_0x327e6c[_0x1fe4('0x37')]=_0x327e6c[_0x1fe4('0x37')][_0x1fe4('0x3a')]?_0x327e6c[_0x1fe4('0x37')]:_0x528d92['model'];if(_0x42c57d[_0x1fe4('0x34')][_0x1fe4('0x49')]){_0x327e6c[_0x1fe4('0x43')]=[{'all':!![]}];}_0x327e6c=_[_0x1fe4('0x29')]({},_0x327e6c,_0x42c57d['options']);return db[_0x1fe4('0x42')]['find'](_0x327e6c)['then'](handleEntityNotFound(_0x1e5610,null))[_0x1fe4('0x22')](respondWithResult(_0x1e5610,null))[_0x1fe4('0x46')](handleError(_0x1e5610,null));};exports['create']=function(_0x56616c,_0x438e33){return db[_0x1fe4('0x42')][_0x1fe4('0x4a')](_0x56616c[_0x1fe4('0x2a')],{})[_0x1fe4('0x22')](respondWithResult(_0x438e33,0xc9))[_0x1fe4('0x46')](handleError(_0x438e33,null));};exports[_0x1fe4('0x21')]=function(_0x388d96,_0x29b54b){if(_0x388d96[_0x1fe4('0x2a')]['id']){delete _0x388d96[_0x1fe4('0x2a')]['id'];}return db[_0x1fe4('0x42')][_0x1fe4('0x4b')]({'where':{'id':_0x388d96[_0x1fe4('0x48')]['id']}})[_0x1fe4('0x22')](handleEntityNotFound(_0x29b54b,null))['then'](saveUpdates(_0x388d96[_0x1fe4('0x2a')],null))[_0x1fe4('0x22')](respondWithResult(_0x29b54b,null))[_0x1fe4('0x46')](handleError(_0x29b54b,null));};exports[_0x1fe4('0x23')]=function(_0x4d622c,_0x74615){return db[_0x1fe4('0x42')][_0x1fe4('0x4b')]({'where':{'id':_0x4d622c[_0x1fe4('0x48')]['id']}})[_0x1fe4('0x22')](handleEntityNotFound(_0x74615,null))['then'](removeEntity(_0x74615,null))[_0x1fe4('0x46')](handleError(_0x74615,null));};exports['describe']=function(_0x419088,_0x25195b){return db[_0x1fe4('0x42')][_0x1fe4('0x4c')]()['then'](respondWithResult(_0x25195b,null))[_0x1fe4('0x46')](handleError(_0x25195b,null));}; \ No newline at end of file +var _0xb417=['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/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','ejs'];(function(_0x3e828b,_0x4d6449){var _0x21dfe2=function(_0x28d024){while(--_0x28d024){_0x3e828b['push'](_0x3e828b['shift']());}};_0x21dfe2(++_0x4d6449);}(_0xb417,0x9b));var _0x7b41=function(_0x460b11,_0x13637f){_0x460b11=_0x460b11-0x0;var _0x2562a8=_0xb417[_0x460b11];return _0x2562a8;};'use strict';var emlformat=require(_0x7b41('0x0'));var rimraf=require(_0x7b41('0x1'));var zipdir=require(_0x7b41('0x2'));var jsonpatch=require(_0x7b41('0x3'));var rp=require(_0x7b41('0x4'));var moment=require(_0x7b41('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b41('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b41('0x7'));var squel=require(_0x7b41('0x8'));var crypto=require(_0x7b41('0x9'));var jsforce=require(_0x7b41('0xa'));var deskjs=require(_0x7b41('0xb'));var toCsv=require(_0x7b41('0xc'));var querystring=require(_0x7b41('0xd'));var Papa=require(_0x7b41('0xe'));var Redis=require(_0x7b41('0xf'));var authService=require(_0x7b41('0x10'));var qs=require(_0x7b41('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b41('0x12'));var logger=require(_0x7b41('0x13'))(_0x7b41('0x14'));var utils=require(_0x7b41('0x15'));var config=require(_0x7b41('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2326ee,_0x4f6438){_0x4f6438=_0x4f6438||0xcc;return function(_0x254628){if(_0x254628){return _0x2326ee[_0x7b41('0x17')](_0x4f6438);}return _0x2326ee['status'](_0x4f6438)[_0x7b41('0x18')]();};}function respondWithResult(_0xcc4470,_0x1b5e19){_0x1b5e19=_0x1b5e19||0xc8;return function(_0x378a02){if(_0x378a02){return _0xcc4470[_0x7b41('0x19')](_0x1b5e19)[_0x7b41('0x1a')](_0x378a02);}};}function respondWithFilteredResult(_0x2c2e40,_0x3b10fa){return function(_0x389a54){if(_0x389a54){var _0x1d3497=typeof _0x3b10fa[_0x7b41('0x1b')]===_0x7b41('0x1c')&&typeof _0x3b10fa[_0x7b41('0x1d')]===_0x7b41('0x1c');var _0x17b41f=_0x389a54[_0x7b41('0x1e')];var _0x1f2230=_0x1d3497?0x0:_0x3b10fa[_0x7b41('0x1b')];var _0x27afee=_0x1d3497?_0x389a54[_0x7b41('0x1e')]:_0x3b10fa[_0x7b41('0x1b')]+_0x3b10fa[_0x7b41('0x1d')];var _0x5bf03e;if(_0x27afee>=_0x17b41f){_0x27afee=_0x17b41f;_0x5bf03e=0xc8;}else{_0x5bf03e=0xce;}_0x2c2e40['status'](_0x5bf03e);return _0x2c2e40[_0x7b41('0x1f')]('Content-Range',_0x1f2230+'-'+_0x27afee+'/'+_0x17b41f)['json'](_0x389a54);}return null;};}function patchUpdates(_0x29370b){return function(_0x238dba){try{jsonpatch[_0x7b41('0x20')](_0x238dba,_0x29370b,!![]);}catch(_0x2b7caf){return BPromise[_0x7b41('0x21')](_0x2b7caf);}return _0x238dba[_0x7b41('0x22')]();};}function saveUpdates(_0x2bb73f,_0x2896c1){return function(_0x41ba3e){if(_0x41ba3e){return _0x41ba3e[_0x7b41('0x23')](_0x2bb73f)[_0x7b41('0x24')](function(_0xe4da44){return _0xe4da44;});}return null;};}function removeEntity(_0x1f967a,_0x43b4cc){return function(_0xb90a14){if(_0xb90a14){return _0xb90a14[_0x7b41('0x25')]()[_0x7b41('0x24')](function(){_0x1f967a['status'](0xcc)[_0x7b41('0x18')]();});}};}function handleEntityNotFound(_0x2ecc14,_0x4d9396){return function(_0xc8e5c7){if(!_0xc8e5c7){_0x2ecc14[_0x7b41('0x17')](0x194);}return _0xc8e5c7;};}function handleError(_0x8e6c24,_0x401144){_0x401144=_0x401144||0x1f4;return function(_0x3bf8fb){logger[_0x7b41('0x26')](_0x3bf8fb[_0x7b41('0x27')]);if(_0x3bf8fb['name']){delete _0x3bf8fb[_0x7b41('0x28')];}_0x8e6c24[_0x7b41('0x19')](_0x401144)[_0x7b41('0x29')](_0x3bf8fb);};}function getMustacheRender(_0x5a2d7f,_0x2fb2c1){return Mustache[_0x7b41('0x2a')](_0x5a2d7f,_[_0x7b41('0x2b')](_0x2fb2c1[_0x7b41('0x2c')],{'contact':_0x2fb2c1[_0x7b41('0x2d')],'message':_0x2fb2c1[_0x7b41('0x2e')],'agent':_0x2fb2c1[_0x7b41('0x2f')],'interaction':_0x2fb2c1[_0x7b41('0x30')],'account':_0x2fb2c1[_0x7b41('0x31')]}))||'';}exports['index']=function(_0x5a2331,_0x3369b6){var _0x1135be={},_0x33c3e5={},_0x1aa751={'count':0x0,'rows':[]};var _0x19a293=_[_0x7b41('0x32')](db[_0x7b41('0x33')][_0x7b41('0x34')],function(_0x135b9e){return{'name':_0x135b9e[_0x7b41('0x35')],'type':_0x135b9e[_0x7b41('0x36')][_0x7b41('0x37')]};});_0x33c3e5[_0x7b41('0x38')]=_[_0x7b41('0x32')](_0x19a293,_0x7b41('0x28'));_0x33c3e5['query']=_[_0x7b41('0x39')](_0x5a2331[_0x7b41('0x3a')]);_0x33c3e5[_0x7b41('0x3b')]=_['intersection'](_0x33c3e5[_0x7b41('0x38')],_0x33c3e5['query']);_0x1135be['attributes']=_[_0x7b41('0x3c')](_0x33c3e5['model'],qs[_0x7b41('0x3d')](_0x5a2331[_0x7b41('0x3a')][_0x7b41('0x3d')]));_0x1135be['attributes']=_0x1135be['attributes'][_0x7b41('0x3e')]?_0x1135be[_0x7b41('0x3f')]:_0x33c3e5[_0x7b41('0x38')];if(!_0x5a2331[_0x7b41('0x3a')][_0x7b41('0x40')]('nolimit')){_0x1135be['limit']=qs[_0x7b41('0x1d')](_0x5a2331[_0x7b41('0x3a')][_0x7b41('0x1d')]);_0x1135be['offset']=qs[_0x7b41('0x1b')](_0x5a2331[_0x7b41('0x3a')][_0x7b41('0x1b')]);}_0x1135be[_0x7b41('0x41')]=qs[_0x7b41('0x42')](_0x5a2331[_0x7b41('0x3a')][_0x7b41('0x42')]);_0x1135be[_0x7b41('0x43')]=qs['filters'](_[_0x7b41('0x44')](_0x5a2331[_0x7b41('0x3a')],_0x33c3e5[_0x7b41('0x3b')]),_0x19a293);if(_0x5a2331[_0x7b41('0x3a')][_0x7b41('0x45')]){_0x1135be[_0x7b41('0x43')]=_[_0x7b41('0x2b')](_0x1135be['where'],{'$or':_[_0x7b41('0x32')](_0x19a293,function(_0x364c34){if(_0x364c34['type']!==_0x7b41('0x46')){var _0xa11fc7={};_0xa11fc7[_0x364c34[_0x7b41('0x28')]]={'$like':'%'+_0x5a2331[_0x7b41('0x3a')][_0x7b41('0x45')]+'%'};return _0xa11fc7;}})});}_0x1135be=_[_0x7b41('0x2b')]({},_0x1135be,_0x5a2331[_0x7b41('0x47')]);var _0x222ce6={'where':_0x1135be['where']};return db['ChatTransferReport']['count'](_0x222ce6)[_0x7b41('0x24')](function(_0x4a5969){_0x1aa751['count']=_0x4a5969;if(_0x5a2331[_0x7b41('0x3a')]['includeAll']){_0x1135be[_0x7b41('0x48')]=[{'all':!![]}];}return db[_0x7b41('0x33')][_0x7b41('0x49')](_0x1135be);})['then'](function(_0x3caa71){_0x1aa751[_0x7b41('0x4a')]=_0x3caa71;return _0x1aa751;})['then'](respondWithFilteredResult(_0x3369b6,_0x1135be))[_0x7b41('0x4b')](handleError(_0x3369b6,null));};exports[_0x7b41('0x4c')]=function(_0x17d79c,_0xf98b3c){var _0x2a9a65={'raw':!![],'where':{'id':_0x17d79c[_0x7b41('0x4d')]['id']}},_0x4af61f={};_0x4af61f[_0x7b41('0x38')]=_[_0x7b41('0x39')](db[_0x7b41('0x33')][_0x7b41('0x34')]);_0x4af61f[_0x7b41('0x3a')]=_[_0x7b41('0x39')](_0x17d79c[_0x7b41('0x3a')]);_0x4af61f[_0x7b41('0x3b')]=_['intersection'](_0x4af61f[_0x7b41('0x38')],_0x4af61f['query']);_0x2a9a65['attributes']=_[_0x7b41('0x3c')](_0x4af61f[_0x7b41('0x38')],qs[_0x7b41('0x3d')](_0x17d79c[_0x7b41('0x3a')][_0x7b41('0x3d')]));_0x2a9a65[_0x7b41('0x3f')]=_0x2a9a65[_0x7b41('0x3f')][_0x7b41('0x3e')]?_0x2a9a65[_0x7b41('0x3f')]:_0x4af61f[_0x7b41('0x38')];if(_0x17d79c[_0x7b41('0x3a')]['includeAll']){_0x2a9a65[_0x7b41('0x48')]=[{'all':!![]}];}_0x2a9a65=_[_0x7b41('0x2b')]({},_0x2a9a65,_0x17d79c[_0x7b41('0x47')]);return db[_0x7b41('0x33')][_0x7b41('0x4e')](_0x2a9a65)['then'](handleEntityNotFound(_0xf98b3c,null))[_0x7b41('0x24')](respondWithResult(_0xf98b3c,null))['catch'](handleError(_0xf98b3c,null));};exports[_0x7b41('0x4f')]=function(_0x537d56,_0x4c5cfb){return db[_0x7b41('0x33')][_0x7b41('0x4f')](_0x537d56['body'],{})[_0x7b41('0x24')](respondWithResult(_0x4c5cfb,0xc9))['catch'](handleError(_0x4c5cfb,null));};exports[_0x7b41('0x23')]=function(_0x3347bd,_0x481806){if(_0x3347bd[_0x7b41('0x2c')]['id']){delete _0x3347bd[_0x7b41('0x2c')]['id'];}return db[_0x7b41('0x33')][_0x7b41('0x4e')]({'where':{'id':_0x3347bd['params']['id']}})[_0x7b41('0x24')](handleEntityNotFound(_0x481806,null))[_0x7b41('0x24')](saveUpdates(_0x3347bd['body'],null))[_0x7b41('0x24')](respondWithResult(_0x481806,null))[_0x7b41('0x4b')](handleError(_0x481806,null));};exports[_0x7b41('0x25')]=function(_0x17926e,_0x5afca5){return db[_0x7b41('0x33')]['find']({'where':{'id':_0x17926e[_0x7b41('0x4d')]['id']}})[_0x7b41('0x24')](handleEntityNotFound(_0x5afca5,null))[_0x7b41('0x24')](removeEntity(_0x5afca5,null))[_0x7b41('0x4b')](handleError(_0x5afca5,null));};exports[_0x7b41('0x50')]=function(_0x379c70,_0x11dc23){return db[_0x7b41('0x33')][_0x7b41('0x50')]()[_0x7b41('0x24')](respondWithResult(_0x11dc23,null))[_0x7b41('0x4b')](handleError(_0x11dc23,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3da747c..def7c23 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 _0x9c39=['define','report_chat_transfer','uniqueid','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x4f3095,_0x44de67){var _0x3c3159=function(_0x25f827){while(--_0x25f827){_0x4f3095['push'](_0x4f3095['shift']());}};_0x3c3159(++_0x44de67);}(_0x9c39,0xe7));var _0x99c3=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x9c39[_0x307086];return _0x699043;};'use strict';var _=require(_0x99c3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x99c3('0x1'));var moment=require(_0x99c3('0x2'));var BPromise=require(_0x99c3('0x3'));var rp=require(_0x99c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99c3('0x5'));var config=require(_0x99c3('0x6'));var attributes=require(_0x99c3('0x7'));module[_0x99c3('0x8')]=function(_0x1ebab8,_0x271f22){return _0x1ebab8[_0x99c3('0x9')]('ChatTransferReport',attributes,{'tableName':_0x99c3('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x99c3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x511e=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x435b6b,_0x34e4d4){var _0x233d51=function(_0x2c3787){while(--_0x2c3787){_0x435b6b['push'](_0x435b6b['shift']());}};_0x233d51(++_0x34e4d4);}(_0x511e,0xea));var _0xe511=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0x511e[_0x4e8401];return _0x17269f;};'use strict';var _=require(_0xe511('0x0'));var util=require(_0xe511('0x1'));var logger=require(_0xe511('0x2'))(_0xe511('0x3'));var moment=require(_0xe511('0x4'));var BPromise=require(_0xe511('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe511('0x6'));var rimraf=require(_0xe511('0x7'));var config=require(_0xe511('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0xe511('0x9')]=function(_0x2214d7,_0x54d587){return _0x2214d7['define'](_0xe511('0xa'),attributes,{'tableName':_0xe511('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe511('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index b1db6e6..0632362 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 _0x76af=['ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x36285a,_0xce9b4f){var _0x15a48e=function(_0xccf8e1){while(--_0xccf8e1){_0x36285a['push'](_0x36285a['shift']());}};_0x15a48e(++_0xce9b4f);}(_0x76af,0xb1));var _0xf76a=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x76af[_0xd2d54];return _0x78b113;};'use strict';var _=require(_0xf76a('0x0'));var util=require(_0xf76a('0x1'));var moment=require(_0xf76a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf76a('0x3'));var db=require(_0xf76a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf76a('0x5'))(_0xf76a('0x6'));var config=require(_0xf76a('0x7'));var jayson=require(_0xf76a('0x8'));var client=jayson['client'][_0xf76a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x196b3b,_0x41c55a,_0xe3f870){return new BPromise(function(_0x2eec67,_0x5d0cc2){return client[_0xf76a('0xa')](_0x196b3b,_0xe3f870)['then'](function(_0x487fb5){logger[_0xf76a('0xb')](_0xf76a('0xc'),_0x41c55a,'request\x20sent');logger[_0xf76a('0xd')](_0xf76a('0xe'),_0x41c55a,_0xf76a('0xf'),JSON['stringify'](_0x487fb5));if(_0x487fb5['error']){if(_0x487fb5[_0xf76a('0x10')][_0xf76a('0x11')]===0x1f4){logger[_0xf76a('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x41c55a,_0x487fb5[_0xf76a('0x10')][_0xf76a('0x12')]);return _0x5d0cc2(_0x487fb5[_0xf76a('0x10')][_0xf76a('0x12')]);}logger[_0xf76a('0x10')](_0xf76a('0xc'),_0x41c55a,_0x487fb5[_0xf76a('0x10')][_0xf76a('0x12')]);return _0x2eec67(_0x487fb5[_0xf76a('0x10')][_0xf76a('0x12')]);}else{logger['info'](_0xf76a('0xc'),_0x41c55a,_0xf76a('0xf'));_0x2eec67(_0x487fb5[_0xf76a('0x13')][_0xf76a('0x12')]);}})[_0xf76a('0x14')](function(_0x4797ea){logger[_0xf76a('0x10')](_0xf76a('0xc'),_0x41c55a,_0x4797ea);_0x5d0cc2(_0x4797ea);});});} \ No newline at end of file +var _0x0b9f=['error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x0b9f,0xa7));var _0xf0b9=function(_0x58e8dd,_0x1ef6ff){_0x58e8dd=_0x58e8dd-0x0;var _0x14989f=_0x0b9f[_0x58e8dd];return _0x14989f;};'use strict';var _=require(_0xf0b9('0x0'));var util=require(_0xf0b9('0x1'));var moment=require(_0xf0b9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0b9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0b9('0x5'))(_0xf0b9('0x6'));var config=require(_0xf0b9('0x7'));var jayson=require(_0xf0b9('0x8'));var client=jayson['client'][_0xf0b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a44cd,_0x5cef53,_0x3dbc8d){return new BPromise(function(_0x564223,_0x5e2200){return client[_0xf0b9('0xa')](_0x2a44cd,_0x3dbc8d)[_0xf0b9('0xb')](function(_0x429737){logger[_0xf0b9('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x5cef53,_0xf0b9('0xd'));logger[_0xf0b9('0xe')](_0xf0b9('0xf'),_0x5cef53,_0xf0b9('0xd'),JSON[_0xf0b9('0x10')](_0x429737));if(_0x429737[_0xf0b9('0x11')]){if(_0x429737[_0xf0b9('0x11')][_0xf0b9('0x12')]===0x1f4){logger['error'](_0xf0b9('0x13'),_0x5cef53,_0x429737[_0xf0b9('0x11')][_0xf0b9('0x14')]);return _0x5e2200(_0x429737[_0xf0b9('0x11')][_0xf0b9('0x14')]);}logger[_0xf0b9('0x11')](_0xf0b9('0x13'),_0x5cef53,_0x429737[_0xf0b9('0x11')]['message']);return _0x564223(_0x429737[_0xf0b9('0x11')][_0xf0b9('0x14')]);}else{logger[_0xf0b9('0xc')](_0xf0b9('0x13'),_0x5cef53,_0xf0b9('0xd'));_0x564223(_0x429737[_0xf0b9('0x15')][_0xf0b9('0x14')]);}})[_0xf0b9('0x16')](function(_0x42a877){logger['error'](_0xf0b9('0x13'),_0x5cef53,_0x42a877);_0x5e2200(_0x42a877);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index bc6e1d4..ca04581 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 _0x24a9=['/describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated'];(function(_0x1fcde8,_0x44c01d){var _0x5b3541=function(_0x577ef6){while(--_0x577ef6){_0x1fcde8['push'](_0x1fcde8['shift']());}};_0x5b3541(++_0x44c01d);}(_0x24a9,0xf9));var _0x924a=function(_0x514040,_0x3493b5){_0x514040=_0x514040-0x0;var _0x185acd=_0x24a9[_0x514040];return _0x185acd;};'use strict';var multer=require(_0x924a('0x0'));var util=require(_0x924a('0x1'));var path=require('path');var timeout=require(_0x924a('0x2'));var express=require(_0x924a('0x3'));var router=express[_0x924a('0x4')]();var fs_extra=require(_0x924a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x924a('0x6'));var config=require(_0x924a('0x7'));var controller=require(_0x924a('0x8'));router[_0x924a('0x9')]('/',auth[_0x924a('0xa')](),controller['index']);router[_0x924a('0x9')](_0x924a('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x924a('0xc'),auth['isAuthenticated'](),controller[_0x924a('0xd')]);router[_0x924a('0xe')]('/',auth[_0x924a('0xa')](),controller[_0x924a('0xf')]);router['put'](_0x924a('0xc'),auth[_0x924a('0xa')](),controller[_0x924a('0x10')]);router[_0x924a('0x11')](_0x924a('0xc'),auth['isAuthenticated'](),controller[_0x924a('0x12')]);module[_0x924a('0x13')]=router; \ No newline at end of file +var _0x4e34=['/:id','show','post','put','delete','destroy','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e34,0x19e));var _0x44e3=function(_0x319285,_0x5ebbd9){_0x319285=_0x319285-0x0;var _0x447dea=_0x4e34[_0x319285];return _0x447dea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x44e3('0x0'));var timeout=require(_0x44e3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x44e3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x44e3('0x3'));var config=require(_0x44e3('0x4'));var controller=require(_0x44e3('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x44e3('0x6')]);router[_0x44e3('0x7')](_0x44e3('0x8'),auth[_0x44e3('0x9')](),controller[_0x44e3('0xa')]);router[_0x44e3('0x7')](_0x44e3('0xb'),auth['isAuthenticated'](),controller[_0x44e3('0xc')]);router[_0x44e3('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x44e3('0xe')](_0x44e3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x44e3('0xf')](_0x44e3('0xb'),auth[_0x44e3('0x9')](),controller[_0x44e3('0x10')]);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 894e63b..d19ae0c 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 _0x26d8=['Leave\x20your\x20comments','offlineForm','generate','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:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','email','#011F6A','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','input','getDataValue','parse','onlineForm','setDataValue','textarea','Comments'];(function(_0x5d412b,_0x524f80){var _0x32cc6a=function(_0x3a0a27){while(--_0x3a0a27){_0x5d412b['push'](_0x5d412b['shift']());}};_0x32cc6a(++_0x524f80);}(_0x26d8,0xae));var _0x826d=function(_0x457dd5,_0x219753){_0x457dd5=_0x457dd5-0x0;var _0x913641=_0x26d8[_0x457dd5];return _0x913641;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x826d('0x0'));module[_0x826d('0x1')]={'name':{'type':Sequelize[_0x826d('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x826d('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x826d('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x826d('0x3')},'mapKeyOffline':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x3')},'key':{'type':Sequelize[_0x826d('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x826d('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x826d('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x826d('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x826d('0x2')],'allowNull':![],'defaultValue':_0x826d('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x826d('0x5')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x826d('0x2')]},'animation':{'type':Sequelize[_0x826d('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x826d('0x7')]('rounded',_0x826d('0x8')),'defaultValue':_0x826d('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x826d('0xa')},'start_chat_button':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0xb')},'offline_chat_button':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0xc')},'header_offline':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0xd')},'download_transcript':{'type':Sequelize[_0x826d('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x826d('0x5')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x826d('0xf')]},'closingQuestion':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x12')},'noteTitle':{'type':Sequelize[_0x826d('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x826d('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x15')},'conditionAgreement':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x826d('0x16')},'ratingType':{'type':Sequelize[_0x826d('0x7')](_0x826d('0x17'),_0x826d('0x18')),'defaultValue':_0x826d('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x826d('0xf')],'defaultValue':function(){return JSON[_0x826d('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x826d('0x1a'),'type':'text','required':!![]},'props':{'title':_0x826d('0x1a'),'helpText':''}},{'type':_0x826d('0x1b'),'props':{'title':_0x826d('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x826d('0x3'),'type':_0x826d('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x826d('0x1c')]('onlineForm')?JSON[_0x826d('0x1d')](this[_0x826d('0x1c')](_0x826d('0x1e'))):{};},'set':function(_0xffaea){return this[_0x826d('0x1f')]('onlineForm',JSON[_0x826d('0x19')](_0xffaea));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x826d('0x1b'),'props':{'title':_0x826d('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x826d('0x3'),'type':_0x826d('0x3')},'variable':null},{'type':_0x826d('0x20'),'config':{'placeholder':_0x826d('0x21')},'props':{'title':'Comments','helpText':_0x826d('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x826d('0x1c')](_0x826d('0x23'))?JSON[_0x826d('0x1d')](this[_0x826d('0x1c')]('offlineForm')):{};},'set':function(_0x5923e2){return this['setDataValue'](_0x826d('0x23'),JSON[_0x826d('0x19')](_0x5923e2));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x826d('0x24')]();}},'autoclose':{'type':Sequelize[_0x826d('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x826d('0x2')]},'forwardOffline':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x826d('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x826d('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x826d('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x15')},'sendUnmanaged':{'type':Sequelize[_0x826d('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x826d('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x826d('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x826d('0x28');}},'notificationSound':{'type':Sequelize[_0x826d('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x826d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x2a')},'verticalAlignment':{'type':Sequelize[_0x826d('0x5')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x2b')},'defaultTitle':{'type':Sequelize[_0x826d('0x2')]},'customerAvatar':{'type':Sequelize[_0x826d('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x826d('0x5')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x826d('0x2')],'allowNull':![],'defaultValue':_0x826d('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x826d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x826d('0x5')],'comment':_0x826d('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![],'comment':_0x826d('0x2f'),'set':function(_0x2fc6e6){if(!_0x2fc6e6)this[_0x826d('0x1f')](_0x826d('0x30'),null);this[_0x826d('0x1f')](_0x826d('0x31'),_0x2fc6e6);}},'vidaooEscalation':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]},'vidaooTopic':{'type':Sequelize[_0x826d('0x2')],'allowNull':![],'defaultValue':_0x826d('0x32')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x826d('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x826d('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x826d('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x826d('0xf')]}}; \ No newline at end of file +var _0xc690=['Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','input','name','text','getDataValue','parse','onlineForm','textarea','Comments','setDataValue','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'];(function(_0xa911d,_0x184eaa){var _0x2877ff=function(_0x2c648c){while(--_0x2c648c){_0xa911d['push'](_0xa911d['shift']());}};_0x2877ff(++_0x184eaa);}(_0xc690,0xea));var _0x0c69=function(_0x41d196,_0x169a6a){_0x41d196=_0x41d196-0x0;var _0xe6b8c8=_0xc690[_0x41d196];return _0xe6b8c8;};'use strict';var Sequelize=require(_0x0c69('0x0'));var rs=require(_0x0c69('0x1'));module[_0x0c69('0x2')]={'name':{'type':Sequelize[_0x0c69('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x0c69('0x3')],'allowNull':![],'unique':_0x0c69('0x4')},'description':{'type':Sequelize[_0x0c69('0x3')]},'mapKey':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x0c69('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0c69('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0c69('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0c69('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0c69('0x3')]},'animation':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0c69('0x9')](_0x0c69('0xa'),_0x0c69('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x0c69('0xc')},'header_offline':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0c69('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':_0x0c69('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0c69('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x0c69('0xf')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0c69('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0c69('0x11')},'placeholderMessage':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':_0x0c69('0x12')},'closingMessage':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':_0x0c69('0x13')},'closingMessageButton':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':_0x0c69('0x14')},'conditionAgreement':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x0c69('0x9')](_0x0c69('0x15'),_0x0c69('0x16')),'defaultValue':_0x0c69('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x0c69('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0c69('0xe')],'defaultValue':function(){return JSON[_0x0c69('0x17')]({'items':[{'type':_0x0c69('0x18'),'variable':null,'config':{'placeholder':_0x0c69('0x19'),'type':_0x0c69('0x1a'),'required':!![]},'props':{'title':_0x0c69('0x19'),'helpText':''}},{'type':_0x0c69('0x18'),'props':{'title':_0x0c69('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x0c69('0x5'),'type':_0x0c69('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0c69('0x1b')]('onlineForm')?JSON[_0x0c69('0x1c')](this[_0x0c69('0x1b')](_0x0c69('0x1d'))):{};},'set':function(_0x2b7c49){return this['setDataValue'](_0x0c69('0x1d'),JSON[_0x0c69('0x17')](_0x2b7c49));}},'offlineForm':{'type':Sequelize[_0x0c69('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x0c69('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x0c69('0x1e'),'config':{'placeholder':_0x0c69('0x1f')},'props':{'title':_0x0c69('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x0c69('0x1b')]('offlineForm')?JSON[_0x0c69('0x1c')](this[_0x0c69('0x1b')]('offlineForm')):{};},'set':function(_0x201f4a){return this[_0x0c69('0x20')](_0x0c69('0x21'),JSON[_0x0c69('0x17')](_0x201f4a));}},'token':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':function(){return rs[_0x0c69('0x22')]();}},'autoclose':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0c69('0x3')]},'forwardOffline':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0c69('0x3')]},'waitingTitle':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':_0x0c69('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0c69('0x24')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x0c69('0x25')},'offlineMessageBody':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':_0x0c69('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0c69('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0c69('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0c69('0xe')],'defaultValue':function(){return _0x0c69('0x26');}},'notificationSound':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':_0x0c69('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0c69('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':_0x0c69('0x28')},'verticalAlignment':{'type':Sequelize[_0x0c69('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x0c69('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0c69('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0c69('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0c69('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0c69('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':_0x0c69('0x29')},'systemAvatar':{'type':Sequelize[_0x0c69('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x0c69('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2fcad5){if(!_0x2fcad5)this[_0x0c69('0x20')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x0c69('0x2b'),_0x2fcad5);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':![]},'vidaooTopic':{'type':Sequelize[_0x0c69('0x3')],'allowNull':![],'defaultValue':_0x0c69('0x2c')},'vidaooNote':{'type':Sequelize[_0x0c69('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x0c69('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x0c69('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0c69('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 5c83eb1..b19e672 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 _0x3f40=['applications','list','orderBy','priority','asc','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','ContactId','spread','lastName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','offline','createdAt','CompanyId','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','Command','iftime\x20%s,%s','interval','timezone','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','inspect','getSnippet','Interval','Intervals','virtual','custom','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.js','remote','replace','verticalAlignment','textColor','color_button','backgroundColor','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','online','false','items','fromKey','getOfflineMessages','Attachment','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','send','render','merge','body','contact','interaction','account','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','options','includeAll','include','findAll','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','params','describe','addDisposition','ChatWebsiteId','Disposition','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','Applications'];(function(_0x20d54d,_0x1adc8e){var _0x516e8b=function(_0x2754e1){while(--_0x2754e1){_0x20d54d['push'](_0x20d54d['shift']());}};_0x516e8b(++_0x1adc8e);}(_0x3f40,0x1bb));var _0x03f4=function(_0x183c48,_0x406657){_0x183c48=_0x183c48-0x0;var _0x45dce8=_0x3f40[_0x183c48];return _0x45dce8;};'use strict';var emlformat=require(_0x03f4('0x0'));var rimraf=require(_0x03f4('0x1'));var zipdir=require(_0x03f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03f4('0x3'));var moment=require(_0x03f4('0x4'));var BPromise=require(_0x03f4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x03f4('0x6'));var sox=require(_0x03f4('0x7'));var csv=require('to-csv');var ejs=require(_0x03f4('0x8'));var fs=require('fs');var fs_extra=require(_0x03f4('0x9'));var _=require(_0x03f4('0xa'));var squel=require(_0x03f4('0xb'));var crypto=require(_0x03f4('0xc'));var jsforce=require(_0x03f4('0xd'));var deskjs=require(_0x03f4('0xe'));var toCsv=require(_0x03f4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x03f4('0x10'));var qs=require(_0x03f4('0x11'));var as=require(_0x03f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x03f4('0x13'));var utils=require('../../config/utils');var config=require(_0x03f4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x03f4('0x15'))['db'];config[_0x03f4('0x16')]=_[_0x03f4('0x17')](config[_0x03f4('0x16')],{'host':_0x03f4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03f4('0x16')]));require(_0x03f4('0x19'))[_0x03f4('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x03f4('0x1b')][_0x03f4('0x1c')]({'port':0x232c});var client9002=jayson[_0x03f4('0x1b')]['http']({'port':0x232a});var client9003=jayson[_0x03f4('0x1b')][_0x03f4('0x1c')]({'port':0x232b});var client9001=jayson[_0x03f4('0x1b')][_0x03f4('0x1c')]({'port':0x2329});function respondWithRpcPromise(_0x5a50f1,_0x367d34,_0x3c2b8d,_0x130258){return new BPromise(function(_0x4c183d,_0x27f437){var _0xd1827e=_0x130258||client;return _0xd1827e[_0x03f4('0x1d')](_0x5a50f1,_0x3c2b8d)[_0x03f4('0x1e')](function(_0x1d4f17){logger[_0x03f4('0x1f')](_0x03f4('0x20'),_0x367d34,'request\x20sent');logger['debug'](_0x03f4('0x21'),_0x367d34,_0x03f4('0x22'),JSON[_0x03f4('0x23')](_0x1d4f17));if(_0x1d4f17[_0x03f4('0x24')]){if(_0x1d4f17[_0x03f4('0x24')][_0x03f4('0x25')]===0x1f4){logger[_0x03f4('0x24')](_0x03f4('0x20'),_0x367d34,_0x1d4f17['error'][_0x03f4('0x26')]);return _0x27f437(_0x1d4f17['error'][_0x03f4('0x26')]);}logger['error'](_0x03f4('0x20'),_0x367d34,_0x1d4f17[_0x03f4('0x24')][_0x03f4('0x26')]);return _0x4c183d(_0x1d4f17[_0x03f4('0x24')][_0x03f4('0x26')]);}else{logger[_0x03f4('0x1f')](_0x03f4('0x20'),_0x367d34,_0x03f4('0x22'));_0x4c183d(_0x1d4f17['result'][_0x03f4('0x26')]);}})['catch'](function(_0x158329){logger['error'](_0x03f4('0x20'),_0x367d34,_0x158329);_0x27f437(_0x158329);});});}function respondWithStatusCode(_0x18f6ef,_0x13f842){_0x13f842=_0x13f842||0xcc;return function(_0x5853c0){if(_0x5853c0){return _0x18f6ef[_0x03f4('0x27')](_0x13f842);}return _0x18f6ef[_0x03f4('0x28')](_0x13f842)['end']();};}function respondWithResult(_0x194758,_0x5a5c29){_0x5a5c29=_0x5a5c29||0xc8;return function(_0x1ea018){if(_0x1ea018){return _0x194758[_0x03f4('0x28')](_0x5a5c29)[_0x03f4('0x29')](_0x1ea018);}};}function respondWithFilteredResult(_0x1b347c,_0x481e56){return function(_0x527f9d){if(_0x527f9d){var _0x528cd4=typeof _0x481e56['offset']===_0x03f4('0x2a')&&typeof _0x481e56[_0x03f4('0x2b')]===_0x03f4('0x2a');var _0x3b9745=_0x527f9d['count'];var _0x59a3cd=_0x528cd4?0x0:_0x481e56['offset'];var _0x5976c1=_0x528cd4?_0x527f9d[_0x03f4('0x2c')]:_0x481e56[_0x03f4('0x2d')]+_0x481e56[_0x03f4('0x2b')];var _0x4f0d50;if(_0x5976c1>=_0x3b9745){_0x5976c1=_0x3b9745;_0x4f0d50=0xc8;}else{_0x4f0d50=0xce;}_0x1b347c[_0x03f4('0x28')](_0x4f0d50);return _0x1b347c[_0x03f4('0x2e')](_0x03f4('0x2f'),_0x59a3cd+'-'+_0x5976c1+'/'+_0x3b9745)['json'](_0x527f9d);}return null;};}function patchUpdates(_0x357739){return function(_0x59234f){try{jsonpatch[_0x03f4('0x30')](_0x59234f,_0x357739,!![]);}catch(_0x45c790){return BPromise[_0x03f4('0x31')](_0x45c790);}return _0x59234f[_0x03f4('0x32')]();};}function saveUpdates(_0x4a5dbd,_0xa3043e){return function(_0x1850b8){if(_0x1850b8){return _0x1850b8[_0x03f4('0x33')](_0x4a5dbd)['then'](function(_0x479137){return _0x479137;});}return null;};}function removeEntity(_0x41a035,_0x5083e1){return function(_0x135194){if(_0x135194){return _0x135194[_0x03f4('0x34')]()[_0x03f4('0x1e')](function(){var _0x1178cf=_0x135194[_0x03f4('0x35')]({'plain':!![]});var _0x56aa1a=_0x03f4('0x36');return db[_0x03f4('0x37')][_0x03f4('0x34')]({'where':{'type':_0x56aa1a,'resourceId':_0x1178cf['id']}})[_0x03f4('0x1e')](function(){return _0x135194;});})[_0x03f4('0x1e')](function(){_0x41a035[_0x03f4('0x28')](0xcc)[_0x03f4('0x38')]();});}};}function handleEntityNotFound(_0x5e32ff,_0x1fbd10){return function(_0xde1d23){if(!_0xde1d23){_0x5e32ff[_0x03f4('0x27')](0x194);}return _0xde1d23;};}function handleError(_0x1967fc,_0xb9bf0b){_0xb9bf0b=_0xb9bf0b||0x1f4;return function(_0x39027c){logger[_0x03f4('0x24')](_0x39027c[_0x03f4('0x39')]);if(_0x39027c['name']){delete _0x39027c[_0x03f4('0x3a')];}_0x1967fc[_0x03f4('0x28')](_0xb9bf0b)[_0x03f4('0x3b')](_0x39027c);};}function getMustacheRender(_0x3fdfe6,_0x1ed72b){return Mustache[_0x03f4('0x3c')](_0x3fdfe6,_[_0x03f4('0x3d')](_0x1ed72b[_0x03f4('0x3e')],{'contact':_0x1ed72b[_0x03f4('0x3f')],'message':_0x1ed72b[_0x03f4('0x26')],'agent':_0x1ed72b['agent'],'interaction':_0x1ed72b[_0x03f4('0x40')],'account':_0x1ed72b[_0x03f4('0x41')]}))||'';}exports[_0x03f4('0x42')]=function(_0x36a7bb,_0x570325){var _0x2d8230={'include':[{'model':db[_0x03f4('0x43')],'as':_0x03f4('0x44')}]},_0x52eee9={},_0x23740b={'count':0x0,'rows':[]};var _0x115741=_['map'](db[_0x03f4('0x45')][_0x03f4('0x46')],function(_0x4fb76b){return{'name':_0x4fb76b[_0x03f4('0x47')],'type':_0x4fb76b['type']['key']};});_0x52eee9['model']=_[_0x03f4('0x48')](_0x115741,_0x03f4('0x3a'));_0x52eee9[_0x03f4('0x49')]=_[_0x03f4('0x4a')](_0x36a7bb[_0x03f4('0x49')]);_0x52eee9[_0x03f4('0x4b')]=_[_0x03f4('0x4c')](_0x52eee9[_0x03f4('0x4d')],_0x52eee9[_0x03f4('0x49')]);_0x2d8230['attributes']=_[_0x03f4('0x4c')](_0x52eee9[_0x03f4('0x4d')],qs[_0x03f4('0x4e')](_0x36a7bb['query'][_0x03f4('0x4e')]));_0x2d8230[_0x03f4('0x4f')]=_0x2d8230[_0x03f4('0x4f')][_0x03f4('0x50')]?_0x2d8230[_0x03f4('0x4f')]:_0x52eee9[_0x03f4('0x4d')];if(!_0x36a7bb[_0x03f4('0x49')]['hasOwnProperty'](_0x03f4('0x51'))){_0x2d8230['limit']=qs[_0x03f4('0x2b')](_0x36a7bb['query'][_0x03f4('0x2b')]);_0x2d8230[_0x03f4('0x2d')]=qs[_0x03f4('0x2d')](_0x36a7bb[_0x03f4('0x49')][_0x03f4('0x2d')]);}_0x2d8230[_0x03f4('0x52')]=qs[_0x03f4('0x53')](_0x36a7bb[_0x03f4('0x49')][_0x03f4('0x53')]);_0x2d8230['where']=qs[_0x03f4('0x4b')](_[_0x03f4('0x54')](_0x36a7bb[_0x03f4('0x49')],_0x52eee9['filters']),_0x115741);if(_0x36a7bb[_0x03f4('0x49')]['filter']){_0x2d8230['where']=_[_0x03f4('0x3d')](_0x2d8230[_0x03f4('0x55')],{'$or':_[_0x03f4('0x48')](_0x115741,function(_0x45c132){if(_0x45c132[_0x03f4('0x56')]!=='VIRTUAL'){var _0x290819={};_0x290819[_0x45c132['name']]={'$like':'%'+_0x36a7bb['query'][_0x03f4('0x57')]+'%'};return _0x290819;}})});}_0x2d8230=_[_0x03f4('0x3d')]({},_0x2d8230,_0x36a7bb[_0x03f4('0x58')]);var _0x4e03e0={'where':_0x2d8230['where']};return db['ChatWebsite'][_0x03f4('0x2c')](_0x4e03e0)[_0x03f4('0x1e')](function(_0x5841d6){_0x23740b[_0x03f4('0x2c')]=_0x5841d6;if(_0x36a7bb['query'][_0x03f4('0x59')]){_0x2d8230[_0x03f4('0x5a')]=[{'all':!![]}];}return db['ChatWebsite'][_0x03f4('0x5b')](_0x2d8230);})[_0x03f4('0x1e')](function(_0x2dd2a1){_0x23740b['rows']=_0x2dd2a1;return _0x23740b;})[_0x03f4('0x1e')](respondWithFilteredResult(_0x570325,_0x2d8230))[_0x03f4('0x5c')](handleError(_0x570325,null));};exports[_0x03f4('0x5d')]=function(_0xe4a2cc,_0x5955c4){var _0x5434f2={'raw':![],'where':{'id':_0xe4a2cc['params']['id']},'include':[{'model':db['Pause'],'as':_0x03f4('0x44')}]},_0x4a463b={};_0x4a463b[_0x03f4('0x4d')]=_['keys'](db[_0x03f4('0x45')][_0x03f4('0x46')]);_0x4a463b[_0x03f4('0x49')]=_['keys'](_0xe4a2cc[_0x03f4('0x49')]);_0x4a463b[_0x03f4('0x4b')]=_['intersection'](_0x4a463b[_0x03f4('0x4d')],_0x4a463b[_0x03f4('0x49')]);_0x5434f2[_0x03f4('0x4f')]=_[_0x03f4('0x4c')](_0x4a463b[_0x03f4('0x4d')],qs[_0x03f4('0x4e')](_0xe4a2cc[_0x03f4('0x49')][_0x03f4('0x4e')]));_0x5434f2[_0x03f4('0x4f')]=_0x5434f2[_0x03f4('0x4f')]['length']?_0x5434f2[_0x03f4('0x4f')]:_0x4a463b[_0x03f4('0x4d')];if(_0xe4a2cc[_0x03f4('0x49')][_0x03f4('0x59')]){_0x5434f2[_0x03f4('0x5a')]=[{'all':!![]}];}_0x5434f2=_[_0x03f4('0x3d')]({},_0x5434f2,_0xe4a2cc['options']);return db['ChatWebsite'][_0x03f4('0x5e')](_0x5434f2)['then'](handleEntityNotFound(_0x5955c4,null))[_0x03f4('0x1e')](respondWithResult(_0x5955c4,null))[_0x03f4('0x5c')](handleError(_0x5955c4,null));};exports[_0x03f4('0x5f')]=function(_0x262ee8,_0x671354){return db[_0x03f4('0x45')][_0x03f4('0x5f')](_0x262ee8[_0x03f4('0x3e')],{})[_0x03f4('0x1e')](function(_0x1e705b){var _0x3612f2=_0x262ee8[_0x03f4('0x60')][_0x03f4('0x35')]({'plain':!![]});if(!_0x3612f2)throw new Error(_0x03f4('0x61'));if(_0x3612f2['role']==='user'){var _0x305946=_0x1e705b[_0x03f4('0x35')]({'plain':!![]});var _0x32dfd5='ChatWebsites';return db[_0x03f4('0x62')][_0x03f4('0x5e')]({'where':{'name':_0x32dfd5,'userProfileId':_0x3612f2['userProfileId']},'raw':!![]})[_0x03f4('0x1e')](function(_0x89667a){if(_0x89667a&&_0x89667a[_0x03f4('0x63')]===0x0){return db[_0x03f4('0x37')]['create']({'name':_0x305946[_0x03f4('0x3a')],'resourceId':_0x305946['id'],'type':_0x89667a[_0x03f4('0x3a')],'sectionId':_0x89667a['id']},{})[_0x03f4('0x1e')](function(){return _0x1e705b;});}else{return _0x1e705b;}})[_0x03f4('0x5c')](function(_0x50cda6){logger[_0x03f4('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50cda6);throw _0x50cda6;});}return _0x1e705b;})[_0x03f4('0x1e')](respondWithResult(_0x671354,0xc9))[_0x03f4('0x5c')](handleError(_0x671354,null));};exports[_0x03f4('0x33')]=function(_0x511c0f,_0x1070de){if(_0x511c0f[_0x03f4('0x3e')]['id']){delete _0x511c0f[_0x03f4('0x3e')]['id'];}return db['ChatWebsite'][_0x03f4('0x5e')]({'where':{'id':_0x511c0f[_0x03f4('0x64')]['id']},'include':[{'model':db['Pause'],'as':_0x03f4('0x44')}]})[_0x03f4('0x1e')](handleEntityNotFound(_0x1070de,null))[_0x03f4('0x1e')](saveUpdates(_0x511c0f['body'],null))[_0x03f4('0x1e')](respondWithResult(_0x1070de,null))[_0x03f4('0x5c')](handleError(_0x1070de,null));};exports[_0x03f4('0x34')]=function(_0x11bbae,_0x250359){return db[_0x03f4('0x45')][_0x03f4('0x5e')]({'where':{'id':_0x11bbae[_0x03f4('0x64')]['id']}})['then'](handleEntityNotFound(_0x250359,null))['then'](removeEntity(_0x250359,null))[_0x03f4('0x5c')](handleError(_0x250359,null));};exports['describe']=function(_0x27538b,_0x495235){return db[_0x03f4('0x45')][_0x03f4('0x65')]()[_0x03f4('0x1e')](respondWithResult(_0x495235,null))[_0x03f4('0x5c')](handleError(_0x495235,null));};exports[_0x03f4('0x66')]=function(_0x2ffdbe,_0x4196e3,_0x38dde2){if(_0x2ffdbe[_0x03f4('0x3e')]['id']){delete _0x2ffdbe['body']['id'];}return db[_0x03f4('0x45')][_0x03f4('0x5e')]({'where':{'id':_0x2ffdbe[_0x03f4('0x64')]['id']}})['then'](handleEntityNotFound(_0x4196e3,null))['then'](function(_0x33d063){if(_0x33d063){_0x2ffdbe[_0x03f4('0x3e')][_0x03f4('0x67')]=_0x33d063['id'];return db[_0x03f4('0x68')][_0x03f4('0x5f')](_0x2ffdbe[_0x03f4('0x3e')]);}})[_0x03f4('0x1e')](respondWithResult(_0x4196e3,null))[_0x03f4('0x5c')](handleError(_0x4196e3,null));};exports['getDispositions']=function(_0x110571,_0x4e848c,_0x4fa801){var _0x5d3e1d={'raw':![],'where':{}};var _0x15d388={};var _0x56c398={'count':0x0,'rows':[]};return db[_0x03f4('0x45')]['findOne']({'where':{'id':_0x110571[_0x03f4('0x64')]['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x4e848c,null))[_0x03f4('0x1e')](function(_0x4d6c90){if(_0x4d6c90){_0x15d388['model']=_['keys'](db[_0x03f4('0x68')]['rawAttributes']);_0x15d388[_0x03f4('0x49')]=_[_0x03f4('0x4a')](_0x110571[_0x03f4('0x49')]);_0x15d388[_0x03f4('0x4b')]=_[_0x03f4('0x4c')](_0x15d388[_0x03f4('0x4d')],_0x15d388[_0x03f4('0x49')]);_0x5d3e1d['attributes']=_['intersection'](_0x15d388[_0x03f4('0x4d')],qs[_0x03f4('0x4e')](_0x110571[_0x03f4('0x49')]['fields']));_0x5d3e1d[_0x03f4('0x4f')]=_0x5d3e1d['attributes']['length']?_0x5d3e1d[_0x03f4('0x4f')]:_0x15d388[_0x03f4('0x4d')];if(!_0x110571[_0x03f4('0x49')][_0x03f4('0x69')](_0x03f4('0x51'))){_0x5d3e1d[_0x03f4('0x2b')]=qs['limit'](_0x110571[_0x03f4('0x49')]['limit']);_0x5d3e1d['offset']=qs['offset'](_0x110571[_0x03f4('0x49')][_0x03f4('0x2d')]);}_0x5d3e1d[_0x03f4('0x52')]=qs[_0x03f4('0x53')](_0x110571[_0x03f4('0x49')]['sort']);_0x5d3e1d[_0x03f4('0x55')]=qs[_0x03f4('0x4b')](_['pick'](_0x110571['query'],_0x15d388[_0x03f4('0x4b')]));_0x5d3e1d[_0x03f4('0x55')][_0x03f4('0x67')]=_0x4d6c90['id'];if(_0x110571['query'][_0x03f4('0x57')]){_0x5d3e1d['where']=_[_0x03f4('0x3d')](_0x5d3e1d[_0x03f4('0x55')],{'$or':_[_0x03f4('0x48')](_0x5d3e1d['attributes'],function(_0x99fe47){var _0x5bf66b={};_0x5bf66b[_0x99fe47]={'$like':'%'+_0x110571[_0x03f4('0x49')]['filter']+'%'};return _0x5bf66b;})});}_0x5d3e1d=_[_0x03f4('0x3d')]({},_0x5d3e1d,_0x110571[_0x03f4('0x58')]);return db[_0x03f4('0x68')][_0x03f4('0x2c')]({'where':_0x5d3e1d['where']})[_0x03f4('0x1e')](function(_0x113853){_0x56c398[_0x03f4('0x2c')]=_0x113853;if(_0x110571['query'][_0x03f4('0x59')]){_0x5d3e1d[_0x03f4('0x5a')]=[{'all':!![]}];}return db[_0x03f4('0x68')]['findAll'](_0x5d3e1d);})[_0x03f4('0x1e')](function(_0x2e8ee2){_0x56c398[_0x03f4('0x6a')]=_0x2e8ee2;return _0x56c398;});}})[_0x03f4('0x1e')](respondWithFilteredResult(_0x4e848c,_0x5d3e1d))[_0x03f4('0x5c')](handleError(_0x4e848c,null));};exports[_0x03f4('0x6b')]=function(_0x1f3fdf,_0x178449,_0x287e35){return db[_0x03f4('0x45')][_0x03f4('0x5e')]({'where':{'id':_0x1f3fdf[_0x03f4('0x64')]['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x178449,null))[_0x03f4('0x1e')](function(_0x2b5885){if(_0x2b5885){return _0x2b5885[_0x03f4('0x6b')](_0x1f3fdf['query'][_0x03f4('0x6c')]);}})['then'](respondWithStatusCode(_0x178449,null))['catch'](handleError(_0x178449,null));};exports[_0x03f4('0x6d')]=function(_0xcb51d1,_0xb78a54,_0x4b4b8c){if(_0xcb51d1[_0x03f4('0x3e')]['id']){delete _0xcb51d1[_0x03f4('0x3e')]['id'];}return db[_0x03f4('0x45')][_0x03f4('0x5e')]({'where':{'id':_0xcb51d1['params']['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0xb78a54,null))[_0x03f4('0x1e')](function(_0x57dce6){if(_0x57dce6){_0xcb51d1[_0x03f4('0x3e')]['ChatWebsiteId']=_0x57dce6['id'];return db[_0x03f4('0x6e')][_0x03f4('0x5f')](_0xcb51d1[_0x03f4('0x3e')]);}})[_0x03f4('0x1e')](respondWithResult(_0xb78a54,null))[_0x03f4('0x5c')](handleError(_0xb78a54,null));};exports[_0x03f4('0x6f')]=function(_0x4b04f2,_0x339858,_0x4b10e9){var _0x3773f8={'raw':![],'where':{}};var _0x45ee1c={};var _0x4720d8={'count':0x0,'rows':[]};return db[_0x03f4('0x45')][_0x03f4('0x70')]({'where':{'id':_0x4b04f2['params']['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x339858,null))[_0x03f4('0x1e')](function(_0xd4cb1c){if(_0xd4cb1c){_0x45ee1c['model']=_[_0x03f4('0x4a')](db[_0x03f4('0x6e')][_0x03f4('0x46')]);_0x45ee1c[_0x03f4('0x49')]=_[_0x03f4('0x4a')](_0x4b04f2[_0x03f4('0x49')]);_0x45ee1c[_0x03f4('0x4b')]=_[_0x03f4('0x4c')](_0x45ee1c['model'],_0x45ee1c['query']);_0x3773f8[_0x03f4('0x4f')]=_['intersection'](_0x45ee1c[_0x03f4('0x4d')],qs[_0x03f4('0x4e')](_0x4b04f2[_0x03f4('0x49')]['fields']));_0x3773f8[_0x03f4('0x4f')]=_0x3773f8[_0x03f4('0x4f')][_0x03f4('0x50')]?_0x3773f8[_0x03f4('0x4f')]:_0x45ee1c[_0x03f4('0x4d')];if(!_0x4b04f2[_0x03f4('0x49')][_0x03f4('0x69')](_0x03f4('0x51'))){_0x3773f8[_0x03f4('0x2b')]=qs['limit'](_0x4b04f2['query'][_0x03f4('0x2b')]);_0x3773f8[_0x03f4('0x2d')]=qs[_0x03f4('0x2d')](_0x4b04f2[_0x03f4('0x49')][_0x03f4('0x2d')]);}_0x3773f8[_0x03f4('0x52')]=qs[_0x03f4('0x53')](_0x4b04f2['query'][_0x03f4('0x53')]);_0x3773f8[_0x03f4('0x55')]=qs[_0x03f4('0x4b')](_['pick'](_0x4b04f2['query'],_0x45ee1c[_0x03f4('0x4b')]));_0x3773f8['where'][_0x03f4('0x67')]=_0xd4cb1c['id'];if(_0x4b04f2['query']['filter']){_0x3773f8[_0x03f4('0x55')]=_[_0x03f4('0x3d')](_0x3773f8['where'],{'$or':_['map'](_0x3773f8[_0x03f4('0x4f')],function(_0x5e14e7){var _0x1ac1c4={};_0x1ac1c4[_0x5e14e7]={'$like':'%'+_0x4b04f2['query'][_0x03f4('0x57')]+'%'};return _0x1ac1c4;})});}_0x3773f8=_['merge']({},_0x3773f8,_0x4b04f2['options']);return db['CannedAnswer']['count']({'where':_0x3773f8[_0x03f4('0x55')]})[_0x03f4('0x1e')](function(_0x1d78ea){_0x4720d8[_0x03f4('0x2c')]=_0x1d78ea;if(_0x4b04f2[_0x03f4('0x49')]['includeAll']){_0x3773f8[_0x03f4('0x5a')]=[{'all':!![]}];}return db[_0x03f4('0x6e')][_0x03f4('0x5b')](_0x3773f8);})[_0x03f4('0x1e')](function(_0x5a291d){_0x4720d8[_0x03f4('0x6a')]=_0x5a291d;return _0x4720d8;});}})['then'](respondWithFilteredResult(_0x339858,_0x3773f8))[_0x03f4('0x5c')](handleError(_0x339858,null));};exports[_0x03f4('0x71')]=function(_0x9a974f,_0x3ced47,_0x1dc581){return db['ChatWebsite'][_0x03f4('0x5e')]({'where':{'id':_0x9a974f[_0x03f4('0x64')]['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x3ced47,null))[_0x03f4('0x1e')](function(_0x3bb4f1){if(_0x3bb4f1){return _0x3bb4f1[_0x03f4('0x71')](_0x9a974f[_0x03f4('0x49')][_0x03f4('0x6c')]);}})['then'](respondWithStatusCode(_0x3ced47,null))['catch'](handleError(_0x3ced47,null));};exports['addLogo']=function(_0x350fbb,_0x861226,_0x153264){_0x350fbb[_0x03f4('0x3e')][_0x03f4('0x72')]=_0x350fbb[_0x03f4('0x73')][_0x03f4('0x74')];return db['ChatWebsite'][_0x03f4('0x5e')]({'where':{'id':_0x350fbb['params']['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x861226,null))['then'](saveUpdates(_0x350fbb[_0x03f4('0x3e')],null))[_0x03f4('0x1e')](respondWithResult(_0x861226,null))[_0x03f4('0x5c')](handleError(_0x861226,null));};exports[_0x03f4('0x75')]=function(_0x1a4b3c,_0x270867,_0x56cc79){_0x1a4b3c['body'][_0x03f4('0x76')]=_0x1a4b3c['file'][_0x03f4('0x74')];return db['ChatWebsite'][_0x03f4('0x5e')]({'where':{'id':_0x1a4b3c[_0x03f4('0x64')]['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x270867,null))['then'](saveUpdates(_0x1a4b3c[_0x03f4('0x3e')],null))[_0x03f4('0x1e')](respondWithResult(_0x270867,null))[_0x03f4('0x5c')](handleError(_0x270867,null));};exports[_0x03f4('0x77')]=function(_0x3f23b4,_0x4f7ce4,_0x2067f1){_0x3f23b4[_0x03f4('0x3e')][_0x03f4('0x78')]=_0x3f23b4[_0x03f4('0x73')]['filename'];return db[_0x03f4('0x45')][_0x03f4('0x5e')]({'where':{'id':_0x3f23b4['params']['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x4f7ce4,null))[_0x03f4('0x1e')](saveUpdates(_0x3f23b4[_0x03f4('0x3e')],null))[_0x03f4('0x1e')](respondWithResult(_0x4f7ce4,null))['catch'](handleError(_0x4f7ce4,null));};exports[_0x03f4('0x79')]=function(_0x4847c3,_0x257d2c,_0x22aae8){_0x4847c3[_0x03f4('0x3e')]['systemAvatar']=_0x4847c3[_0x03f4('0x73')]['filename'];return db[_0x03f4('0x45')][_0x03f4('0x5e')]({'where':{'id':_0x4847c3['params']['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x257d2c,null))[_0x03f4('0x1e')](saveUpdates(_0x4847c3[_0x03f4('0x3e')],null))[_0x03f4('0x1e')](respondWithResult(_0x257d2c,null))[_0x03f4('0x5c')](handleError(_0x257d2c,null));};exports[_0x03f4('0x7a')]=function(_0x9ba660,_0x3add8a,_0x3d36dd){var _0x41b5d6=path[_0x03f4('0x7b')](config[_0x03f4('0x7c')],'server/files/images/logos/default_logo.svg');var _0x4198bd={'where':{'id':_0x9ba660[_0x03f4('0x64')]['id']},'attributes':['id',_0x03f4('0x72')],'raw':!![]};var _0x2d63fd=![];return require(_0x03f4('0x7d'))[_0x03f4('0x7e')]()[_0x03f4('0x1e')](function(_0x656efe){if(_0x656efe){_0x2d63fd=_0x656efe['custom'];}})['then'](function(){return db[_0x03f4('0x45')][_0x03f4('0x5e')](_0x4198bd);})['then'](handleEntityNotFound(_0x3add8a,null))[_0x03f4('0x1e')](function(_0xd0b93d){if(_0xd0b93d){if(!_[_0x03f4('0x7f')](_0xd0b93d[_0x03f4('0x72')])){if(fs[_0x03f4('0x80')](path[_0x03f4('0x7b')](config[_0x03f4('0x7c')],_0x03f4('0x81'),_0xd0b93d[_0x03f4('0x72')]))&&_0x2d63fd){_0x41b5d6=path[_0x03f4('0x7b')](config['root'],'server/files/images/logos/',_0xd0b93d[_0x03f4('0x72')]);}}return _0x3add8a[_0x03f4('0x82')](_0x41b5d6);}})[_0x03f4('0x5c')](handleError(_0x3add8a,null));};exports[_0x03f4('0x83')]=function(_0xea2207,_0x12af53,_0x3966db){var _0x3fc9d4=path['join'](config[_0x03f4('0x7c')],_0x03f4('0x84'));var _0x3377f1={'where':{'id':_0xea2207[_0x03f4('0x64')]['id']},'attributes':['id',_0x03f4('0x76')],'raw':!![]};return db[_0x03f4('0x45')][_0x03f4('0x5e')](_0x3377f1)[_0x03f4('0x1e')](handleEntityNotFound(_0x12af53,null))[_0x03f4('0x1e')](function(_0x3a2161){if(_0x3a2161){if(!_[_0x03f4('0x7f')](_0x3a2161[_0x03f4('0x76')])){if(fs['existsSync'](path['join'](config['root'],_0x03f4('0x85'),_0x3a2161[_0x03f4('0x76')]))){_0x3fc9d4=path[_0x03f4('0x7b')](config['root'],'server/files/images/avatars/',_0x3a2161['agentAvatar']);}}return _0x12af53[_0x03f4('0x82')](_0x3fc9d4);}})['catch'](handleError(_0x12af53,null));};exports[_0x03f4('0x86')]=function(_0x5942ff,_0x3b7ab9,_0x3736f1){var _0x4225f7=path[_0x03f4('0x7b')](config[_0x03f4('0x7c')],_0x03f4('0x87'));var _0x211fa3={'where':{'id':_0x5942ff[_0x03f4('0x64')]['id']},'attributes':['id',_0x03f4('0x78'),_0x03f4('0x88')],'raw':!![]};return db[_0x03f4('0x45')]['find'](_0x211fa3)[_0x03f4('0x1e')](handleEntityNotFound(_0x3b7ab9,null))[_0x03f4('0x1e')](function(_0x304800){if(_0x304800){if(!_[_0x03f4('0x7f')](_0x304800[_0x03f4('0x78')])){if(fs[_0x03f4('0x80')](path[_0x03f4('0x7b')](config[_0x03f4('0x7c')],_0x03f4('0x85'),_0x304800[_0x03f4('0x78')]))&&_0x304800['showCustomerAvatar']){_0x4225f7=path['join'](config[_0x03f4('0x7c')],_0x03f4('0x85'),_0x304800[_0x03f4('0x78')]);}}return _0x3b7ab9[_0x03f4('0x82')](_0x4225f7);}})[_0x03f4('0x5c')](handleError(_0x3b7ab9,null));};exports[_0x03f4('0x89')]=function(_0xcbf157,_0x225c34,_0x231438){var _0xf91bf6=path[_0x03f4('0x7b')](config[_0x03f4('0x7c')],_0x03f4('0x8a'));var _0x3cf212={'where':{'id':_0xcbf157[_0x03f4('0x64')]['id']},'attributes':['id',_0x03f4('0x8b')],'raw':!![]};return db['ChatWebsite'][_0x03f4('0x5e')](_0x3cf212)[_0x03f4('0x1e')](handleEntityNotFound(_0x225c34,null))[_0x03f4('0x1e')](function(_0x2d8ece){if(_0x2d8ece){if(!_[_0x03f4('0x7f')](_0x2d8ece[_0x03f4('0x8b')])){if(fs['existsSync'](path['join'](config[_0x03f4('0x7c')],_0x03f4('0x85'),_0x2d8ece[_0x03f4('0x8b')]))){_0xf91bf6=path[_0x03f4('0x7b')](config[_0x03f4('0x7c')],_0x03f4('0x85'),_0x2d8ece[_0x03f4('0x8b')]);}}return _0x225c34[_0x03f4('0x82')](_0xf91bf6);}})['catch'](handleError(_0x225c34,null));};exports[_0x03f4('0x8c')]=function(_0x639336,_0x5a019e,_0x5d1461){var _0x561170=require(_0x03f4('0x8d'));var _0x248fc7=new _0x561170();var _0x595ccc=_0x248fc7[_0x03f4('0x8e')](_0x639336[_0x03f4('0x8f')][_0x03f4('0x90')])['getResult']();var _0x3bf50f={'body':_0x639336[_0x03f4('0x3e')],'channel':_0x03f4('0x91')};var _0xe59123=[];var _0x3b7ada=[];var _0x183740={};var _0x324fe0=![];return db[_0x03f4('0x92')][_0x03f4('0x65')]()['then'](function(_0x3770bc){if(!_0x3770bc){throw new db[(_0x03f4('0x93'))][(_0x03f4('0x94'))](_0x03f4('0x95'));}_0xe59123=_[_0x03f4('0x96')](_[_0x03f4('0x4a')](_0x3770bc),['createdAt','updatedAt']);_0x3b7ada=_['difference'](_[_0x03f4('0x4a')](_0x3770bc),['createdAt',_0x03f4('0x97'),'CompanyId',_0x03f4('0x98')]);if(_0x639336[_0x03f4('0x3e')]['id']){delete _0x639336[_0x03f4('0x3e')]['id'];}if(_['isNil'](_0x639336[_0x03f4('0x3e')][_0x03f4('0x99')])){throw new db['Sequelize'][(_0x03f4('0x94'))](_0x03f4('0x9a'));}if(_['isNil'](_0x639336[_0x03f4('0x3e')][_0x03f4('0x3e')])||_0x639336[_0x03f4('0x3e')][_0x03f4('0x3e')]===''){throw new db['Sequelize'][(_0x03f4('0x94'))](_0x03f4('0x9b'));}if(_[_0x03f4('0x7f')](_0x639336[_0x03f4('0x3e')][_0x03f4('0x9c')])){throw new db[(_0x03f4('0x93'))][(_0x03f4('0x94'))](_0x03f4('0x9d')+_0x3b7ada);}if(!_[_0x03f4('0x9e')](_0x3b7ada,_0x639336['body'][_0x03f4('0x9c')])){throw new db[(_0x03f4('0x93'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b7ada);}_0x183740[_0x639336[_0x03f4('0x3e')]['mapKey']]=_0x639336['body'][_0x03f4('0x99')];})[_0x03f4('0x1e')](function(){return db[_0x03f4('0x45')]['find']({'where':{'id':_0x639336[_0x03f4('0x64')]['id']},'include':[{'model':db[_0x03f4('0x9f')],'as':_0x03f4('0xa0'),'include':[{'model':db[_0x03f4('0x92')],'as':_0x03f4('0xa1'),'where':_0x183740,'limit':0x1,'order':[[_0x03f4('0x97'),_0x03f4('0xa2')]]}]},{'model':db[_0x03f4('0xa3')],'as':_0x03f4('0xa4')}]});})[_0x03f4('0x1e')](handleEntityNotFound(_0x5a019e,null))['then'](function(_0x4b2524){if(_0x4b2524&&_0x4b2524['List']){_0x3bf50f[_0x03f4('0x41')]=_0x4b2524;_0x3bf50f[_0x03f4('0xa5')]=_0x4b2524[_0x03f4('0xa4')];_0x3bf50f[_0x03f4('0xa6')]=_0x4b2524[_0x03f4('0xa0')];_0x3bf50f[_0x03f4('0xa5')]=_[_0x03f4('0xa7')](_0x3bf50f['applications'],[_0x03f4('0xa8')],[_0x03f4('0xa9')]);if(_0x3bf50f['account'][_0x03f4('0xa4')]){delete _0x3bf50f[_0x03f4('0x41')][_0x03f4('0xa4')];}if(_0x3bf50f[_0x03f4('0x41')][_0x03f4('0xa0')]&&_0x3bf50f[_0x03f4('0x41')][_0x03f4('0xa0')][_0x03f4('0xa1')]['length']){return _0x3bf50f['account']['List']['Contacts'][0x0];}var _0x2f9181=_[_0x03f4('0x17')](_0x639336['body'],{'firstName':_0x639336[_0x03f4('0x3e')][_0x03f4('0x99')],'ListId':_0x4b2524[_0x03f4('0x98')]});_0x2f9181[_0x639336[_0x03f4('0x3e')][_0x03f4('0x9c')]]=_0x639336['body'][_0x03f4('0x99')];return db[_0x03f4('0x92')][_0x03f4('0x5f')](_0x2f9181,{'fields':_0xe59123,'raw':!![]});}})[_0x03f4('0x1e')](handleEntityNotFound(_0x5a019e,null))[_0x03f4('0x1e')](function(_0x141b85){_0x3bf50f[_0x03f4('0x3f')]=_0x141b85;var _0x2fda67=_0x639336[_0x03f4('0x3e')][_0x03f4('0xaa')];if(_0x639336['headers'][_0x03f4('0xab')]){_0x2fda67=_0x639336[_0x03f4('0x8f')][_0x03f4('0xab')];}else if(_0x639336[_0x03f4('0x8f')][_0x03f4('0xac')]){_0x2fda67=_['first'](_0x639336[_0x03f4('0x8f')]['x-forwarded-for'][_0x03f4('0xad')](','));}if(_0x141b85){var _0x52c23f={'ContactId':_0x141b85['id'],'ChatWebsiteId':_0x639336[_0x03f4('0x64')]['id'],'from':(_0x141b85[_0x03f4('0xae')]||'')+'\x20'+(_0x141b85['lastName']||''),'customerIp':_0x2fda67,'customerPort':_0x639336[_0x03f4('0x8f')][_0x03f4('0xaf')]?_0x639336[_0x03f4('0x8f')][_0x03f4('0xaf')]:null,'referer':_0x639336[_0x03f4('0x3e')][_0x03f4('0xb0')],'browserName':_0x595ccc[_0x03f4('0xb1')][_0x03f4('0x3a')]&&_0x595ccc[_0x03f4('0xb1')][_0x03f4('0xb2')]?util[_0x03f4('0xb3')](_0x03f4('0xb4'),_0x595ccc[_0x03f4('0xb1')][_0x03f4('0x3a')],_0x595ccc[_0x03f4('0xb1')][_0x03f4('0xb2')]):_0x03f4('0xb5'),'browserVersion':_0x595ccc['browser'][_0x03f4('0xb2')]||_0x03f4('0xb5'),'osName':util[_0x03f4('0xb3')](_0x03f4('0xb4'),_0x595ccc['os'][_0x03f4('0x3a')],_0x595ccc['os'][_0x03f4('0xb2')]),'osVersion':_0x595ccc['os'][_0x03f4('0xb2')],'deviceModel':_0x595ccc[_0x03f4('0xb6')][_0x03f4('0x4d')]&&_0x595ccc[_0x03f4('0xb6')][_0x03f4('0xb7')]?util[_0x03f4('0xb3')](_0x03f4('0xb8'),_0x595ccc[_0x03f4('0xb6')][_0x03f4('0x4d')],_0x595ccc[_0x03f4('0xb6')][_0x03f4('0xb7')],_0x595ccc[_0x03f4('0xb6')][_0x03f4('0x56')]):null,'deviceVendor':_0x595ccc[_0x03f4('0xb6')][_0x03f4('0xb7')],'deviceType':_0x595ccc[_0x03f4('0xb6')][_0x03f4('0x56')],'formData':JSON['stringify'](_0x639336[_0x03f4('0x3e')])};var _0x127d62={'ChatWebsiteId':_0x639336['params']['id'],'closed':![]};if(_0x639336['body']['threadId']){_0x127d62['threadId']=_0x639336[_0x03f4('0x3e')][_0x03f4('0xb9')];return db[_0x03f4('0xba')][_0x03f4('0x5e')]({'where':_0x127d62})['then'](function(_0x1751b4){if(_0x1751b4){return[_0x1751b4,![]];}_0x52c23f[_0x03f4('0xb9')]=_0x639336['body'][_0x03f4('0xb9')];_0x52c23f['externalUrl']=_0x639336[_0x03f4('0x3e')]['externalUrl'];return db['ChatInteraction']['create'](_0x52c23f)[_0x03f4('0x1e')](function(_0x2932c4){return[_0x2932c4,!![]];});});}_0x127d62[_0x03f4('0xbb')]=_0x141b85['id'];if(_0x639336[_0x03f4('0x3e')]['interaction']&&_0x639336[_0x03f4('0x3e')][_0x03f4('0x40')]['id']){_0x127d62['id']=_0x639336[_0x03f4('0x3e')][_0x03f4('0x40')]['id'];return db[_0x03f4('0xba')][_0x03f4('0x5e')]({'where':_0x127d62})[_0x03f4('0x1e')](function(_0x2028b8){if(_0x2028b8){return[_0x2028b8,![]];}return db[_0x03f4('0xba')]['create'](_0x52c23f)[_0x03f4('0x1e')](function(_0x5e6703){return[_0x5e6703,!![]];});});}return db['ChatInteraction'][_0x03f4('0x5f')](_0x52c23f)['then'](function(_0x2a69e3){return[_0x2a69e3,!![]];});}})[_0x03f4('0xbc')](function(_0xfb3a0f,_0x49817d){if(_0xfb3a0f){_0x324fe0=_0x49817d;if(!_0x49817d){var _0x5e752b={'from':(_0x3bf50f[_0x03f4('0x3f')]['firstName']||'')+'\x20'+(_0x3bf50f['contact'][_0x03f4('0xbd')]||'')};if(_0x639336['body'][_0x03f4('0xb9')]&&_0x639336[_0x03f4('0x3e')][_0x03f4('0xbe')]&&_0x639336[_0x03f4('0x3e')]['threadId']!=_0x639336[_0x03f4('0x3e')]['messageId']){_0x5e752b[_0x03f4('0xb9')]=_0x639336['body'][_0x03f4('0xbe')];}return _0xfb3a0f['update'](_0x5e752b);}else{return _0xfb3a0f;}}})[_0x03f4('0x1e')](function(_0x165e51){_0x3bf50f[_0x03f4('0x40')]=_0x165e51['get']({'plain':!![]});_0x3bf50f[_0x03f4('0x40')][_0x03f4('0xbf')]=_0x324fe0;if(_0x3bf50f[_0x03f4('0x40')][_0x03f4('0xbf')]){if(_0x3bf50f[_0x03f4('0x41')][_0x03f4('0xc0')]){_0x3bf50f[_0x03f4('0xa5')][_0x03f4('0xc1')]({'id':0x0,'priority':_0x3bf50f[_0x03f4('0xa5')]['length']+0x1,'app':_0x03f4('0xc2'),'appdata':_0x03f4('0xc3'),'interval':'*,*,*,*'});}}return db[_0x03f4('0xc4')][_0x03f4('0x5f')]({'body':_0x639336[_0x03f4('0x3e')]['body'],'ChatWebsiteId':_0x639336[_0x03f4('0x64')]['id'],'ChatInteractionId':_0x165e51['id'],'direction':'in','ContactId':_0x3bf50f[_0x03f4('0x3f')]['id'],'AttachmentId':_0x639336[_0x03f4('0x3e')][_0x03f4('0xc5')]});})['then'](function(_0x5e135c){_0x3bf50f[_0x03f4('0x26')]=_0x5e135c;if(_0x3bf50f[_0x03f4('0x40')][_0x03f4('0xc6')]){return db[_0x03f4('0xc7')][_0x03f4('0x5e')]({'attributes':['id',_0x03f4('0x3a')],'where':{'id':_0x3bf50f['interaction'][_0x03f4('0xc6')]}})['then'](function(_0x2c1504){if(_0x2c1504){_0x3bf50f['applications'][_0x03f4('0xc8')]({'id':0x0,'priority':0x0,'app':_0x03f4('0xc9'),'appdata':_0x2c1504['name']+','+(_0x3bf50f['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x3bf50f[_0x03f4('0xca')]=!![];}return respondWithRpcPromise(_0x03f4('0xcb'),_0x03f4('0xcc'),_0x3bf50f);});}return respondWithRpcPromise(_0x03f4('0xcb'),'startRouting',_0x3bf50f);})[_0x03f4('0x1e')](function(_0x1234da){respondWithRpcPromise(_0x03f4('0xcd'),'EventManager',{'event':_0x03f4('0x8c'),'message':_0x1234da},client9002);return _0x1234da;})['then'](respondWithResult(_0x5a019e,null))[_0x03f4('0x5c')](handleError(_0x5a019e,null));};exports[_0x03f4('0xce')]=function(_0x2fb01e,_0x1cabb4,_0x455828){var _0x19f62e,_0x55517d,_0x4e01ae;var _0x4de400=[];var _0x3c3648=[];var _0xd96f25={};var _0x2b1935=_0x2fb01e['files']||[];var _0x2956ed=[];var _0xd32b80;return db[_0x03f4('0x92')][_0x03f4('0x65')]()[_0x03f4('0x1e')](function(_0x2bd15b){if(!_0x2bd15b){throw new db[(_0x03f4('0x93'))][(_0x03f4('0x94'))](_0x03f4('0x95'));}_0x3c3648=_[_0x03f4('0x96')](_[_0x03f4('0x4a')](_0x2bd15b),[_0x03f4('0xcf'),_0x03f4('0x97')]);_0x4de400=_['difference'](_['keys'](_0x2bd15b),[_0x03f4('0xcf'),_0x03f4('0x97'),_0x03f4('0xd0'),_0x03f4('0x98')]);if(_0x2fb01e[_0x03f4('0x3e')]['id']){delete _0x2fb01e[_0x03f4('0x3e')]['id'];}if(_[_0x03f4('0x7f')](_0x2fb01e['body'][_0x03f4('0x99')])){throw _0x1cabb4[_0x03f4('0x28')](0x1f4)[_0x03f4('0x3b')](new db['Sequelize'][(_0x03f4('0x94'))]('from\x20is\x20mandatory'));}if(_[_0x03f4('0x7f')](_0x2fb01e[_0x03f4('0x3e')][_0x03f4('0x3e')])||_0x2fb01e[_0x03f4('0x3e')][_0x03f4('0x3e')]===''){throw _0x1cabb4['status'](0x1f4)[_0x03f4('0x3b')](new db[(_0x03f4('0x93'))]['ValidationError'](_0x03f4('0x9b')));}if(_[_0x03f4('0x7f')](_0x2fb01e[_0x03f4('0x3e')]['mapKeyOffline'])){throw _0x1cabb4[_0x03f4('0x28')](0x1f4)['send'](new db[(_0x03f4('0x93'))][(_0x03f4('0x94'))](_0x03f4('0xd1')+_0x4de400));}if(!_['includes'](_0x4de400,_0x2fb01e[_0x03f4('0x3e')][_0x03f4('0xd2')])){throw _0x1cabb4[_0x03f4('0x28')](0x1f4)[_0x03f4('0x3b')](new db[(_0x03f4('0x93'))][(_0x03f4('0x94'))](_0x03f4('0xd3')+_0x4de400));}_0xd96f25[_0x2fb01e[_0x03f4('0x3e')]['mapKeyOffline']]=_0x2fb01e['body'][_0x03f4('0x99')];})[_0x03f4('0x1e')](function(){return db['ChatWebsite'][_0x03f4('0x5e')]({'where':{'id':_0x2fb01e[_0x03f4('0x64')]['id']},'include':[{'model':db[_0x03f4('0x9f')],'as':_0x03f4('0xa0')},{'model':db[_0x03f4('0xd4')],'as':_0x03f4('0xd4')}]});})[_0x03f4('0x1e')](handleEntityNotFound(_0x1cabb4,null))[_0x03f4('0x1e')](function(_0x5c8781){if(_0x5c8781&&_0x5c8781[_0x03f4('0xa0')]){_0x55517d=_0x5c8781;var _0x34821a=_['defaults'](_0x2fb01e[_0x03f4('0x3e')],{'firstName':_0x2fb01e[_0x03f4('0x3e')]['from'],'phone':_0x2fb01e[_0x03f4('0x3e')][_0x03f4('0x99')],'ListId':_0x5c8781['ListId']});_0x34821a[_0x2fb01e[_0x03f4('0x3e')][_0x03f4('0xd2')]]=_0x2fb01e[_0x03f4('0x3e')]['from'];return db[_0x03f4('0x92')][_0x03f4('0xd5')]({'where':_0xd96f25,'defaults':_0x34821a});}})['spread'](function(_0x45251e){if(_0x45251e){_0x4e01ae=_0x45251e;var _0x9262c4=fs['readFileSync'](path[_0x03f4('0x7b')](config[_0x03f4('0x7c')],_0x03f4('0xd6')),_0x03f4('0xd7'));var _0x4fa94a=ejs['render'](_0x9262c4,{'body':_[_0x03f4('0xd8')](_0x2fb01e[_0x03f4('0x3e')][_0x03f4('0x3e')]),'bodyTitle':_0x55517d[_0x03f4('0xd9')]});return db[_0x03f4('0xda')][_0x03f4('0x5f')]({'body':_0x4fa94a,'ContactId':_0x45251e['id'],'ChatWebsiteId':_0x55517d['id']});}})[_0x03f4('0x1e')](function(_0x10c92e){_0xd32b80=_0x10c92e;if(_0x2b1935[_0x03f4('0x50')]){var _0xeb24d=_0x2b1935[_0x03f4('0x48')](function(_0x43379e){return{'name':_0x43379e['originalname'],'basename':_0x43379e['filename'],'type':_0x43379e['mimetype'],'ChatOfflineMessageId':_0x10c92e['id']};});_0x2956ed=_0xeb24d[_0x03f4('0x48')](_0x40799b=>{var _0x3fbcf4={'filename':_0x40799b[_0x03f4('0x3a')],'path':path['join'](config['root'],_0x03f4('0xdb'),_0x03f4('0xdc'),_0x03f4('0xdd'),_0x03f4('0xde'),_0x40799b[_0x03f4('0xdf')])};return _0x3fbcf4;});if(!_0x55517d[_0x03f4('0xe0')]){return db[_0x03f4('0xe1')][_0x03f4('0xe2')](function(_0x1b9d16){return db['Attachment'][_0x03f4('0xe3')](_0xeb24d,{'transaction':_0x1b9d16});});}}})[_0x03f4('0x1e')](function(){if(_0xd32b80){_0x19f62e=_0xd32b80;return db['MailAccount'][_0x03f4('0x70')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x50b274){if(_0x50b274&&_0x50b274['Smtp']&&_0x55517d['forwardOffline']&&_0x55517d[_0x03f4('0xe4')]){var _0x540a14={'tls':{'rejectUnauthorized':![]}};if(_0x50b274[_0x03f4('0xe5')][_0x03f4('0xe6')]){_0x540a14[_0x03f4('0xe6')]=_0x50b274[_0x03f4('0xe5')]['service'];}else{_0x540a14[_0x03f4('0xe7')]=_0x50b274[_0x03f4('0xe5')][_0x03f4('0xe7')];_0x540a14[_0x03f4('0xe8')]=_0x50b274[_0x03f4('0xe5')][_0x03f4('0xe8')];_0x540a14[_0x03f4('0xe9')]=_0x50b274['Smtp']['secure'];}if(_0x50b274['Smtp'][_0x03f4('0xea')]){_0x540a14['auth']={'user':_0x50b274['Smtp'][_0x03f4('0x60')],'pass':_0x50b274[_0x03f4('0xe5')][_0x03f4('0xeb')]};}return respondWithRpcPromise(_0x03f4('0xec'),_0x03f4('0xed'),{'account':_0x540a14,'message':{'from':util['format'](_0x03f4('0xee'),_0x50b274[_0x03f4('0x3a')],_0x50b274[_0x03f4('0xef')]||_0x50b274[_0x03f4('0xe5')][_0x03f4('0x60')]),'to':_0x55517d[_0x03f4('0xe4')],'subject':_0x55517d[_0x03f4('0xf0')],'html':_0x19f62e[_0x03f4('0x3e')],'attachments':_0x2956ed}},client9003)[_0x03f4('0x1e')](function(){return _0x19f62e;})[_0x03f4('0x5c')](function(_0x2f8b95){console['error'](_0x2f8b95);});}})[_0x03f4('0x1e')](function(){if(_0x55517d&&_0x55517d[_0x03f4('0xe0')]&&_0x55517d['MailAccountId']){var _0x422f3e=[];if(_0x2b1935[_0x03f4('0x50')]){_0x422f3e=_0x2b1935[_0x03f4('0x48')](function(_0xe1a8c6){return{'name':_0xe1a8c6['originalname'],'basename':_0xe1a8c6[_0x03f4('0x74')],'type':_0xe1a8c6['mimetype'],'ChatOfflineMessageId':_0xd32b80['id']};});}var _0x350632;if(!_[_0x03f4('0x7f')](_0x55517d[_0x03f4('0xf1')])){var _0x207c57=_['map'](_0x2fb01e['body'],function(_0x3d026b){return _0x3d026b;});var _0x51afa0=_[_0x03f4('0xf2')](_0x207c57)[0x0];var _0x3d32fb=_[_0x03f4('0xf3')](_0x51afa0,function(_0x13b3a1){return _0x13b3a1;});_0x350632=_0x3d32fb[0x1][_0x55517d['subjectOffline']];}var _0x40254f={'from':_0x4e01ae[_0x03f4('0xef')],'firstName':_0x4e01ae[_0x03f4('0xae')],'lastName':_0x4e01ae['lastName'],'mapKey':_0x03f4('0xef'),'message':{'from':_0x4e01ae['email'],'to':_0x55517d['MailAccount']['email'],'cc':'','subject':_[_0x03f4('0x7f')](_0x350632)?_0x55517d['offlineMessageSubject']:_0x350632,'messageId':'','sentAt':new Date(),'attach':_0x422f3e['length'],'attachments':_0x422f3e,'originChannel':_0x03f4('0xf4'),'ChatWebsiteId':_0x55517d['id'],'ChatOfflineMessageId':_0x19f62e['id'],'originTo':_0x55517d[_0x03f4('0xd4')][_0x03f4('0xef')]},'body':_0x19f62e[_0x03f4('0x3e')]};var _0x3b8544={'account':{'id':_0x55517d[_0x03f4('0xf5')]},'body':_0x40254f,'log':_0x03f4('0xf6')};return respondWithRpcPromise(_0x03f4('0xf6'),_0x03f4('0xf7'),_0x3b8544,client9001)[_0x03f4('0x1e')](function(){return _0x19f62e;})[_0x03f4('0x5c')](function(_0x4b96ee){console['error'](_0x4b96ee);});}return;})[_0x03f4('0x1e')](function(){if(_0x19f62e){return _0x19f62e;}})[_0x03f4('0x1e')](respondWithResult(_0x1cabb4,null))[_0x03f4('0x5c')](function(_0x13b4b8){console[_0x03f4('0x24')](_0x03f4('0x5c'),_0x13b4b8);for(var _0x4d7576 of _0x2b1935){var _0x3ba128=path[_0x03f4('0x7b')](config[_0x03f4('0x7c')],_0x03f4('0xdb'),_0x03f4('0xdc'),_0x03f4('0xdd'),_0x03f4('0xde'),_0x4d7576[_0x03f4('0x74')]);fs_extra[_0x03f4('0xf8')](_0x3ba128)[_0x03f4('0x5c')](function(_0x18d092){console[_0x03f4('0x24')](_0x03f4('0xf9'),_0x3ba128,_0x18d092);});}});};exports[_0x03f4('0xfa')]=function(_0x52487c,_0x5eedfd,_0x2543cb){return db[_0x03f4('0xba')][_0x03f4('0x5e')]({'where':{'id':_0x52487c[_0x03f4('0x64')]['id']}})['then'](handleEntityNotFound(_0x5eedfd,null))['then'](function(_0x4759c4){if(_0x4759c4){return _0x4759c4[_0x03f4('0xfa')](_0x52487c[_0x03f4('0x3e')][_0x03f4('0x6c')],_[_0x03f4('0xfb')](_0x52487c[_0x03f4('0x3e')],[_0x03f4('0x6c'),'id'])||{});}})[_0x03f4('0x1e')](respondWithResult(_0x5eedfd,null))[_0x03f4('0x5c')](handleError(_0x5eedfd,null));};exports[_0x03f4('0xfc')]=function(_0x1538d1,_0x86c6a8,_0x54ab24){var _0x3288ac={'raw':![],'where':{}};var _0x5f156b={};var _0x2edcb5={'count':0x0,'rows':[]};return db[_0x03f4('0x45')]['findOne']({'where':{'id':_0x1538d1[_0x03f4('0x64')]['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x86c6a8,null))[_0x03f4('0x1e')](function(_0x12322a){if(_0x12322a){_0x5f156b['model']=_[_0x03f4('0x4a')](db[_0x03f4('0xba')][_0x03f4('0x46')]);_0x5f156b['query']=_[_0x03f4('0x4a')](_0x1538d1[_0x03f4('0x49')]);_0x5f156b[_0x03f4('0x4b')]=_[_0x03f4('0x4c')](_0x5f156b[_0x03f4('0x4d')],_0x5f156b[_0x03f4('0x49')]);_0x3288ac[_0x03f4('0x4f')]=_[_0x03f4('0x4c')](_0x5f156b[_0x03f4('0x4d')],qs[_0x03f4('0x4e')](_0x1538d1['query'][_0x03f4('0x4e')]));_0x3288ac[_0x03f4('0x4f')]=_0x3288ac['attributes'][_0x03f4('0x50')]?_0x3288ac[_0x03f4('0x4f')]:_0x5f156b[_0x03f4('0x4d')];if(!_0x1538d1['query'][_0x03f4('0x69')](_0x03f4('0x51'))){_0x3288ac['limit']=qs['limit'](_0x1538d1['query']['limit']);_0x3288ac[_0x03f4('0x2d')]=qs[_0x03f4('0x2d')](_0x1538d1[_0x03f4('0x49')][_0x03f4('0x2d')]);}_0x3288ac[_0x03f4('0x52')]=qs[_0x03f4('0x53')](_0x1538d1['query'][_0x03f4('0x53')]);_0x3288ac[_0x03f4('0x55')]=qs[_0x03f4('0x4b')](_[_0x03f4('0x54')](_0x1538d1[_0x03f4('0x49')],_0x5f156b[_0x03f4('0x4b')]));_0x3288ac['where'][_0x03f4('0x67')]=_0x12322a['id'];if(_0x1538d1['query']['filter']){_0x3288ac['where']=_['merge'](_0x3288ac[_0x03f4('0x55')],{'$or':_[_0x03f4('0x48')](_0x3288ac[_0x03f4('0x4f')],function(_0x5608c6){var _0x35517b={};_0x35517b[_0x5608c6]={'$like':'%'+_0x1538d1['query']['filter']+'%'};return _0x35517b;})});}_0x3288ac=_[_0x03f4('0x3d')]({},_0x3288ac,_0x1538d1[_0x03f4('0x58')]);return db[_0x03f4('0xba')][_0x03f4('0x2c')]({'where':_0x3288ac[_0x03f4('0x55')]})[_0x03f4('0x1e')](function(_0x35f036){_0x2edcb5['count']=_0x35f036;if(_0x1538d1[_0x03f4('0x49')]['includeAll']){_0x3288ac[_0x03f4('0x5a')]=[{'model':db[_0x03f4('0x92')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x03f4('0xfd'),'attributes':[_0x03f4('0x3a'),_0x03f4('0xfe'),_0x03f4('0xff')],'required':![]},{'model':db[_0x03f4('0x100')],'as':_0x03f4('0x101'),'attributes':['id','name',_0x03f4('0x102')],'where':_0x1538d1[_0x03f4('0x49')]['tag']?{'id':_0x1538d1[_0x03f4('0x49')][_0x03f4('0x103')]}:undefined,'required':_0x1538d1[_0x03f4('0x49')]['tag']?!![]:![]}];}return db[_0x03f4('0xba')]['findAll'](_0x3288ac);})[_0x03f4('0x1e')](function(_0x485f85){_0x2edcb5['rows']=_0x485f85;return _0x2edcb5;});}})[_0x03f4('0x1e')](respondWithFilteredResult(_0x86c6a8,_0x3288ac))[_0x03f4('0x5c')](handleError(_0x86c6a8,null));};function iftimePromise(_0x42aace,_0x2c20dc){return respondWithRpcPromise(_0x03f4('0x104'),'getSnippet',{'command':_0x2c20dc['timezone']?util[_0x03f4('0xb3')](_0x03f4('0x105'),_0x42aace[_0x03f4('0x106')],_0x2c20dc[_0x03f4('0x107')]):util[_0x03f4('0xb3')](_0x03f4('0x108'),_0x42aace[_0x03f4('0x106')])},client9002)[_0x03f4('0x1e')](function(_0x294c9e){var _0x21bba0=_0x294c9e&&_0x294c9e['indexOf'](_0x03f4('0x109'))>=0x0?!![]:![];logger[_0x03f4('0x1f')](_0x03f4('0x10a'),_0x2c20dc['id'],_0x42aace['id'],_0x42aace[_0x03f4('0x106')],_0x21bba0?'ONLINE':'OFFLINE',_0x2c20dc[_0x03f4('0x107')]?_0x2c20dc[_0x03f4('0x107')]:_0x03f4('0x10b'));return _0x21bba0;})[_0x03f4('0x5c')](function(_0x3df8d5){logger[_0x03f4('0x24')](_0x03f4('0x10a'),_0x2c20dc['id'],_0x42aace['id'],_0x42aace[_0x03f4('0x106')],util[_0x03f4('0x10c')](_0x3df8d5,{'showHidden':![],'depth':null}),_0x2c20dc[_0x03f4('0x107')]?_0x2c20dc['timezone']:_0x03f4('0x10b'));return![];});}exports[_0x03f4('0x10d')]=function(_0x2f9949,_0x111f5f,_0x2b8cea){var _0x2e0aa8=0x0;var _0x23d370=0x0;var _0x30ff0e=![];var _0x44451b;var _0x104cf2;return db[_0x03f4('0x45')]['find']({'where':{'id':_0x2f9949['params']['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x03f4('0x10e')],'as':_0x03f4('0x10f'),'attributes':['id',_0x03f4('0x106')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x111f5f,null))[_0x03f4('0x1e')](function(_0x1f7aa7){if(_0x1f7aa7){_0x44451b=_0x1f7aa7;return _0x1f7aa7['getProactiveActions']({'raw':!![]});}})[_0x03f4('0x1e')](function(_0x437212){if(_0x44451b){if(_0x437212){_0x104cf2=_0x437212;}}return require('../../config/license/util')['getLicense']();})[_0x03f4('0x1e')](function(_0x2fa960){if(_0x2fa960){_0x23d370=_0x2fa960[_0x03f4('0x110')];_0x30ff0e=_0x2fa960[_0x03f4('0x111')];}})[_0x03f4('0x1e')](function(){return db[_0x03f4('0xba')][_0x03f4('0x2c')]({'where':{'closed':![]}});})[_0x03f4('0x1e')](function(_0xbf88ef){_0x2e0aa8=_0xbf88ef;if(_0x23d370&&_0xbf88ef>_0x23d370){return db['License'][_0x03f4('0x70')]({'where':{'id':0x1}})[_0x03f4('0x1e')](function(_0x2d3100){if(_0x2d3100){_0x2d3100['increment'](_0x03f4('0x112'));}});}})[_0x03f4('0x1e')](function(){if(_0x44451b['Interval']&&_0x44451b['Interval']['Intervals']){var _0xd78f2b=[];for(var _0x4b5eb5=0x0;_0x4b5eb5<_0x44451b[_0x03f4('0x10e')]['Intervals'][_0x03f4('0x50')];_0x4b5eb5++){var _0x34428b=_0x44451b[_0x03f4('0x10e')][_0x03f4('0x10f')][_0x4b5eb5][_0x03f4('0x35')]({'plain':!![]});_0xd78f2b[_0x03f4('0xc1')](iftimePromise(_0x34428b,_0x44451b));}return BPromise[_0x03f4('0x113')](_0xd78f2b)[_0x03f4('0x1e')](function(_0x377073){return _[_0x03f4('0x114')](_0x377073);});}else{return!![];}})[_0x03f4('0x1e')](function(_0x456aa2){var _0x409135=fs[_0x03f4('0x115')](path[_0x03f4('0x7b')](config[_0x03f4('0x7c')],_0x03f4('0x116')),_0x03f4('0xd7'));var _0x4a902e={'remote':_0x44451b[_0x03f4('0x117')],'query':querystring[_0x03f4('0x23')](_[_0x03f4('0x3d')](_0x44451b[_0x03f4('0x35')]({'plain':!![]}),{'customerIp':_0x2f9949[_0x03f4('0x8f')][_0x03f4('0xac')]||_0x2f9949['headers']['x-real-ip']||_0x2f9949['connection']['remoteAddress']||_0x2f9949['ip'],'referer':_0x2f9949[_0x03f4('0x8f')][_0x03f4('0xb0')],'openedInteractions':_0x2e0aa8,'maxInteractions':_0x23d370,'virtual':_0x30ff0e[_0x03f4('0x110')],'online':_0x456aa2,'custom':_0x30ff0e}))[_0x03f4('0x118')](/'/g,'\x5c\x27')};_0x111f5f[_0x03f4('0x3b')](ejs['render'](Mustache[_0x03f4('0x3c')](_0x409135,_0x4a902e),{'proactiveActions':_0x104cf2,'alignment':_0x44451b['alignment'],'verticalAlignment':_0x44451b[_0x03f4('0x119')],'div_color':_0x44451b[_0x03f4('0x102')],'text_color':_0x44451b[_0x03f4('0x11a')],'button_color':_0x44451b[_0x03f4('0x11b')],'background_color':_0x44451b[_0x03f4('0x11c')]}));})['catch'](handleError(_0x111f5f,null));};exports['addApplications']=function(_0x47a1b9,_0x4d62e8,_0x115440){return db['ChatWebsite'][_0x03f4('0x70')]({'where':{'id':_0x47a1b9[_0x03f4('0x64')]['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x4d62e8,null))['then'](function(_0x3e5e42){if(_0x3e5e42){return db[_0x03f4('0xe1')]['transaction'](function(_0x23c287){return db['ChatApplication'][_0x03f4('0x34')]({'where':{'ChatWebsiteId':_0x47a1b9['params']['id']},'transaction':_0x23c287})[_0x03f4('0x1e')](function(_0x5f1e12){var _0x5cdd12=_[_0x03f4('0x48')](_0x47a1b9['body'],function(_0x1f68a4){_0x1f68a4['ChatWebsiteId']=_0x47a1b9['params']['id'];return _0x1f68a4;});return db[_0x03f4('0xa3')][_0x03f4('0xe3')](_0x5cdd12,{'transaction':_0x23c287});});})['then'](function(){return db['ChatApplication'][_0x03f4('0x11d')]({'where':{'ChatWebsiteId':_0x47a1b9[_0x03f4('0x64')]['id']},'order':_0x03f4('0xa8')});});}})[_0x03f4('0x1e')](respondWithResult(_0x4d62e8,null))[_0x03f4('0x5c')](handleError(_0x4d62e8,null));};exports[_0x03f4('0x11e')]=function(_0x616bc9,_0x158eed,_0x5f4544){var _0x4c4f1b={};var _0x57ecd2={};var _0x3721e8;var _0x16d902;return db['ChatWebsite']['findOne']({'where':{'id':_0x616bc9['params']['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x158eed,null))[_0x03f4('0x1e')](function(_0x2e18fb){if(_0x2e18fb){_0x3721e8=_0x2e18fb;_0x57ecd2[_0x03f4('0x4d')]=_[_0x03f4('0x4a')](db[_0x03f4('0xa3')][_0x03f4('0x46')]);_0x57ecd2[_0x03f4('0x49')]=_[_0x03f4('0x4a')](_0x616bc9[_0x03f4('0x49')]);_0x57ecd2[_0x03f4('0x4b')]=_[_0x03f4('0x4c')](_0x57ecd2['model'],_0x57ecd2[_0x03f4('0x49')]);_0x4c4f1b[_0x03f4('0x4f')]=_[_0x03f4('0x4c')](_0x57ecd2['model'],qs['fields'](_0x616bc9[_0x03f4('0x49')]['fields']));_0x4c4f1b['attributes']=_0x4c4f1b[_0x03f4('0x4f')][_0x03f4('0x50')]?_0x4c4f1b[_0x03f4('0x4f')]:_0x57ecd2['model'];_0x4c4f1b['order']=qs[_0x03f4('0x53')](_0x616bc9[_0x03f4('0x49')][_0x03f4('0x53')]);_0x4c4f1b[_0x03f4('0x55')]=qs['filters'](_[_0x03f4('0x54')](_0x616bc9[_0x03f4('0x49')],_0x57ecd2['filters']));if(_0x616bc9[_0x03f4('0x49')]['filter']){_0x4c4f1b[_0x03f4('0x55')]=_[_0x03f4('0x3d')](_0x4c4f1b[_0x03f4('0x55')],{'$or':_[_0x03f4('0x48')](_0x4c4f1b[_0x03f4('0x4f')],function(_0x2a4403){var _0x1b95f6={};_0x1b95f6[_0x2a4403]={'$like':'%'+_0x616bc9[_0x03f4('0x49')]['filter']+'%'};return _0x1b95f6;})});}_0x4c4f1b=_[_0x03f4('0x3d')]({},_0x4c4f1b,_0x616bc9[_0x03f4('0x58')]);return _0x3721e8[_0x03f4('0x11e')](_0x4c4f1b);}})[_0x03f4('0x1e')](function(_0x47b382){if(_0x47b382){_0x16d902=_0x47b382[_0x03f4('0x50')];if(!_0x616bc9[_0x03f4('0x49')][_0x03f4('0x69')](_0x03f4('0x51'))){_0x4c4f1b['limit']=qs['limit'](_0x616bc9[_0x03f4('0x49')]['limit']);_0x4c4f1b['offset']=qs[_0x03f4('0x2d')](_0x616bc9[_0x03f4('0x49')]['offset']);}return _0x3721e8['getApplications'](_0x4c4f1b);}})[_0x03f4('0x1e')](function(_0x400180){if(_0x400180){return _0x400180?{'count':_0x16d902,'rows':_0x400180}:null;}})[_0x03f4('0x1e')](respondWithResult(_0x158eed,null))['catch'](handleError(_0x158eed,null));};exports[_0x03f4('0x11f')]=function(_0x11bc83,_0x5ecdcd,_0x4e75f6){return db[_0x03f4('0x120')]['find']({'where':{'id':_0x11bc83['params']['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x5ecdcd,null))[_0x03f4('0x1e')](function(_0x1d974d){if(_0x1d974d){return _0x1d974d[_0x03f4('0x11f')](_0x11bc83[_0x03f4('0x3e')][_0x03f4('0x6c')],_['omit'](_0x11bc83[_0x03f4('0x3e')],['ids','id'])||{});}})[_0x03f4('0x1e')](respondWithResult(_0x5ecdcd,null))[_0x03f4('0x5c')](handleError(_0x5ecdcd,null));};exports[_0x03f4('0x121')]=function(_0x458119,_0x24b538,_0x18b29b){var _0x41caf1={};var _0x3a1b15={};var _0x11c69b;var _0x6b2bf;return db[_0x03f4('0x45')][_0x03f4('0x70')]({'where':{'id':_0x458119[_0x03f4('0x64')]['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x24b538,null))[_0x03f4('0x1e')](function(_0x4ea726){if(_0x4ea726){_0x11c69b=_0x4ea726;_0x3a1b15['model']=_['keys'](db[_0x03f4('0x122')][_0x03f4('0x46')]);_0x3a1b15[_0x03f4('0x49')]=_[_0x03f4('0x4a')](_0x458119[_0x03f4('0x49')]);_0x3a1b15['filters']=_[_0x03f4('0x4c')](_0x3a1b15['model'],_0x3a1b15[_0x03f4('0x49')]);_0x41caf1[_0x03f4('0x4f')]=_[_0x03f4('0x4c')](_0x3a1b15[_0x03f4('0x4d')],qs['fields'](_0x458119[_0x03f4('0x49')][_0x03f4('0x4e')]));_0x41caf1[_0x03f4('0x4f')]=_0x41caf1['attributes']['length']?_0x41caf1[_0x03f4('0x4f')]:_0x3a1b15['model'];_0x41caf1[_0x03f4('0x52')]=qs[_0x03f4('0x53')](_0x458119[_0x03f4('0x49')][_0x03f4('0x53')]);_0x41caf1[_0x03f4('0x55')]=qs[_0x03f4('0x4b')](_['pick'](_0x458119[_0x03f4('0x49')],_0x3a1b15[_0x03f4('0x4b')]));if(_0x458119[_0x03f4('0x49')][_0x03f4('0x57')]){_0x41caf1[_0x03f4('0x55')]=_[_0x03f4('0x3d')](_0x41caf1[_0x03f4('0x55')],{'$or':_['map'](_0x41caf1[_0x03f4('0x4f')],function(_0xeb9ebd){var _0x1b545a={};_0x1b545a[_0xeb9ebd]={'$like':'%'+_0x458119[_0x03f4('0x49')][_0x03f4('0x57')]+'%'};return _0x1b545a;})});}_0x41caf1=_[_0x03f4('0x3d')]({},_0x41caf1,_0x458119[_0x03f4('0x58')]);return _0x11c69b[_0x03f4('0x121')](_0x41caf1);}})[_0x03f4('0x1e')](function(_0x37c1e8){if(_0x37c1e8){_0x6b2bf=_0x37c1e8['length'];if(!_0x458119[_0x03f4('0x49')][_0x03f4('0x69')](_0x03f4('0x51'))){_0x41caf1[_0x03f4('0x2b')]=qs[_0x03f4('0x2b')](_0x458119[_0x03f4('0x49')][_0x03f4('0x2b')]);_0x41caf1[_0x03f4('0x2d')]=qs[_0x03f4('0x2d')](_0x458119[_0x03f4('0x49')][_0x03f4('0x2d')]);}return _0x11c69b['getProactiveActions'](_0x41caf1);}})[_0x03f4('0x1e')](function(_0x5c021b){if(_0x5c021b){return _0x5c021b?{'count':_0x6b2bf,'rows':_0x5c021b}:null;}})[_0x03f4('0x1e')](respondWithResult(_0x24b538,null))[_0x03f4('0x5c')](handleError(_0x24b538,null));};exports['getFields']=function(_0x39633e,_0x3afd11,_0x3211cd){var _0x545dd3=_0x39633e[_0x03f4('0x49')][_0x03f4('0x123')]===_0x03f4('0x124')?'offlineForm':'onlineForm';return db[_0x03f4('0x45')][_0x03f4('0x5e')]({'attributes':['id',_0x545dd3],'where':{'id':_0x39633e['params']['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x3afd11,null))[_0x03f4('0x1e')](function(_0x7381d2){if(_0x7381d2){var _0x265cba=_0x7381d2[_0x545dd3];var _0x5172bb=_0x265cba&&_0x265cba[_0x03f4('0x125')]?_0x265cba[_0x03f4('0x125')]:[];_0x3afd11['send']({'fromKey':_['isNil'](_0x265cba['fromKey'])?undefined:_0x265cba[_0x03f4('0x126')],'count':_0x5172bb['length'],'rows':_0x5172bb});}})[_0x03f4('0x5c')](handleError(_0x3afd11,null));};exports[_0x03f4('0x127')]=function(_0x2c1153,_0x448d56,_0x34531e){var _0x3cfd56={'raw':![],'where':{}};var _0x4e2d39={};var _0x1f4b35={'count':0x0,'rows':[]};return db[_0x03f4('0x45')][_0x03f4('0x70')]({'where':{'id':_0x2c1153[_0x03f4('0x64')]['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x448d56,null))[_0x03f4('0x1e')](function(_0x4ee1c7){if(_0x4ee1c7){_0x4e2d39[_0x03f4('0x4d')]=_['keys'](db[_0x03f4('0xda')][_0x03f4('0x46')]);_0x4e2d39['query']=_[_0x03f4('0x4a')](_0x2c1153[_0x03f4('0x49')]);_0x4e2d39[_0x03f4('0x4b')]=_[_0x03f4('0x4c')](_0x4e2d39[_0x03f4('0x4d')],_0x4e2d39[_0x03f4('0x49')]);_0x3cfd56[_0x03f4('0x4f')]=_['intersection'](_0x4e2d39['model'],qs[_0x03f4('0x4e')](_0x2c1153[_0x03f4('0x49')]['fields']));_0x3cfd56[_0x03f4('0x4f')]=_0x3cfd56['attributes']['length']?_0x3cfd56['attributes']:_0x4e2d39[_0x03f4('0x4d')];if(!_0x2c1153['query'][_0x03f4('0x69')](_0x03f4('0x51'))){_0x3cfd56[_0x03f4('0x2b')]=qs[_0x03f4('0x2b')](_0x2c1153['query'][_0x03f4('0x2b')]);_0x3cfd56[_0x03f4('0x2d')]=qs[_0x03f4('0x2d')](_0x2c1153[_0x03f4('0x49')][_0x03f4('0x2d')]);}_0x3cfd56[_0x03f4('0x52')]=qs[_0x03f4('0x53')](_0x2c1153[_0x03f4('0x49')][_0x03f4('0x53')]);_0x3cfd56['where']=qs[_0x03f4('0x4b')](_[_0x03f4('0x54')](_0x2c1153[_0x03f4('0x49')],_0x4e2d39[_0x03f4('0x4b')]));_0x3cfd56[_0x03f4('0x55')][_0x03f4('0x67')]=_0x4ee1c7['id'];if(_0x2c1153[_0x03f4('0x49')][_0x03f4('0x57')]){_0x3cfd56[_0x03f4('0x55')]=_[_0x03f4('0x3d')](_0x3cfd56[_0x03f4('0x55')],{'$or':_[_0x03f4('0x48')](_0x3cfd56['attributes'],function(_0x2b465d){var _0x3b9e69={};_0x3b9e69[_0x2b465d]={'$like':'%'+_0x2c1153[_0x03f4('0x49')][_0x03f4('0x57')]+'%'};return _0x3b9e69;})});}_0x3cfd56=_['merge']({},_0x3cfd56,_0x2c1153[_0x03f4('0x58')]);return db['ChatOfflineMessage']['count']({'where':_0x3cfd56[_0x03f4('0x55')]})[_0x03f4('0x1e')](function(_0x4186bc){_0x1f4b35['count']=_0x4186bc;if(_0x2c1153[_0x03f4('0x49')][_0x03f4('0x59')]){_0x3cfd56[_0x03f4('0x5a')]=[{'all':!![]}];}else{_0x3cfd56[_0x03f4('0x5a')]=[{'model':db[_0x03f4('0x92')],'as':'Contact','required':![]},{'model':db[_0x03f4('0x128')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x3cfd56);})[_0x03f4('0x1e')](function(_0x1bf109){_0x1f4b35[_0x03f4('0x6a')]=_0x1bf109;return _0x1f4b35;});}})[_0x03f4('0x1e')](respondWithFilteredResult(_0x448d56,_0x3cfd56))[_0x03f4('0x5c')](handleError(_0x448d56,null));};exports[_0x03f4('0x129')]=function(_0x76c722,_0x4dae7f,_0x29b23a){return db[_0x03f4('0x45')]['find']({'where':{'id':_0x76c722['params']['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x4dae7f,null))[_0x03f4('0x1e')](function(_0x2e4819){if(_0x2e4819){return _0x2e4819[_0x03f4('0x129')](_0x76c722[_0x03f4('0x3e')][_0x03f4('0x6c')],_[_0x03f4('0xfb')](_0x76c722[_0x03f4('0x3e')],['ids','id'])||{})[_0x03f4('0xbc')](function(_0x15d586){for(var _0x2e87e2=0x0;_0x2e87e2<_0x76c722[_0x03f4('0x3e')][_0x03f4('0x6c')]['length'];_0x2e87e2+=0x1){socket['emit'](_0x03f4('0x12a'),{'UserId':_0x76c722[_0x03f4('0x3e')][_0x03f4('0x6c')][_0x2e87e2],'ChatWebsiteId':_0x76c722[_0x03f4('0x64')]['id']});}return _0x15d586;});}})[_0x03f4('0x1e')](respondWithResult(_0x4dae7f,null))[_0x03f4('0x5c')](handleError(_0x4dae7f,null));};exports[_0x03f4('0x12b')]=function(_0x3f8882,_0x2ac22e,_0xfd01fd){return db[_0x03f4('0x45')]['find']({'where':{'id':_0x3f8882[_0x03f4('0x64')]['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x2ac22e,null))[_0x03f4('0x1e')](function(_0x1d8a40){if(_0x1d8a40){return _0x1d8a40[_0x03f4('0x12b')](_0x3f8882['query'][_0x03f4('0x6c')])[_0x03f4('0x1e')](function(){if(_[_0x03f4('0x12c')](_0x3f8882[_0x03f4('0x49')][_0x03f4('0x6c')])){for(var _0x29c76e=0x0;_0x29c76e<_0x3f8882['query']['ids']['length'];_0x29c76e+=0x1){socket[_0x03f4('0x12d')](_0x03f4('0x12e'),{'UserId':Number(_0x3f8882[_0x03f4('0x49')][_0x03f4('0x6c')][_0x29c76e]),'ChatWebsiteId':Number(_0x3f8882[_0x03f4('0x64')]['id'])});}}else{socket[_0x03f4('0x12d')](_0x03f4('0x12e'),{'UserId':Number(_0x3f8882[_0x03f4('0x49')][_0x03f4('0x6c')]),'ChatWebsiteId':Number(_0x3f8882[_0x03f4('0x64')]['id'])});}});}})[_0x03f4('0x1e')](respondWithStatusCode(_0x2ac22e,null))[_0x03f4('0x5c')](handleError(_0x2ac22e,null));};exports[_0x03f4('0x12f')]=function(_0x132026,_0x3cf7f8,_0xc67977){var _0x47c63b={};var _0x3b418f={};var _0x19c61f;var _0x562541;return db[_0x03f4('0x45')]['findOne']({'where':{'id':_0x132026['params']['id']}})[_0x03f4('0x1e')](handleEntityNotFound(_0x3cf7f8,null))['then'](function(_0x26741e){if(_0x26741e){_0x19c61f=_0x26741e;_0x3b418f[_0x03f4('0x4d')]=_['keys'](db['User'][_0x03f4('0x46')]);_0x3b418f[_0x03f4('0x49')]=_[_0x03f4('0x4a')](_0x132026[_0x03f4('0x49')]);_0x3b418f[_0x03f4('0x4b')]=_[_0x03f4('0x4c')](_0x3b418f['model'],_0x3b418f[_0x03f4('0x49')]);_0x47c63b['attributes']=_[_0x03f4('0x4c')](_0x3b418f['model'],qs[_0x03f4('0x4e')](_0x132026[_0x03f4('0x49')]['fields']));_0x47c63b[_0x03f4('0x4f')]=_0x47c63b[_0x03f4('0x4f')][_0x03f4('0x50')]?_0x47c63b[_0x03f4('0x4f')]:_0x3b418f[_0x03f4('0x4d')];_0x47c63b['order']=qs['sort'](_0x132026['query']['sort']);_0x47c63b[_0x03f4('0x55')]=qs[_0x03f4('0x4b')](_[_0x03f4('0x54')](_0x132026[_0x03f4('0x49')],_0x3b418f[_0x03f4('0x4b')]));if(_0x132026[_0x03f4('0x49')][_0x03f4('0x57')]){_0x47c63b[_0x03f4('0x55')]=_[_0x03f4('0x3d')](_0x47c63b['where'],{'$or':_[_0x03f4('0x48')](_0x47c63b[_0x03f4('0x4f')],function(_0x1b4eef){var _0x5b6c49={};_0x5b6c49[_0x1b4eef]={'$like':'%'+_0x132026[_0x03f4('0x49')]['filter']+'%'};return _0x5b6c49;})});}_0x47c63b=_[_0x03f4('0x3d')]({},_0x47c63b,_0x132026[_0x03f4('0x58')]);return _0x19c61f[_0x03f4('0x12f')](_0x47c63b);}})[_0x03f4('0x1e')](function(_0x948c31){if(_0x948c31){_0x562541=_0x948c31[_0x03f4('0x50')];if(!_0x132026['query'][_0x03f4('0x69')](_0x03f4('0x51'))){_0x47c63b['limit']=qs[_0x03f4('0x2b')](_0x132026[_0x03f4('0x49')][_0x03f4('0x2b')]);_0x47c63b[_0x03f4('0x2d')]=qs['offset'](_0x132026['query'][_0x03f4('0x2d')]);}return _0x19c61f[_0x03f4('0x12f')](_0x47c63b);}})['then'](function(_0x836e7b){if(_0x836e7b){return _0x836e7b?{'count':_0x562541,'rows':_0x836e7b}:null;}})[_0x03f4('0x1e')](respondWithResult(_0x3cf7f8,null))['catch'](handleError(_0x3cf7f8,null));}; \ No newline at end of file +var _0xf258=['getDispositions','findOne','order','ChatWebsiteId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','agentAvatar','filename','addCustomerAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','getLicense','isNil','existsSync','root','server/files/images/logos/','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','Applications','applications','list','orderBy','priority','asc','contact','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','format','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','CompanyId','ListId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','forwardOffline','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','email','Chat','NotifyMailAccount','remove','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','true','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Intervals','getProactiveActions','virtual','custom','License','increment','chatLicenseExceeded','Interval','all','some','server/files/chat/iframe.js','remote','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','textColor','color_button','backgroundColor','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','client','http','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','count','apply','reject','update','get','ChatWebsites','UserProfileResource','destroy','sendStatus','name','send','render','merge','body','agent','interaction','account','Pause','map','ChatWebsite','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','rows','show','params','mandatoryDispositionPause','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','addDisposition','Disposition'];(function(_0x53c281,_0x549f6a){var _0x3ab8c4=function(_0x5f0a13){while(--_0x5f0a13){_0x53c281['push'](_0x53c281['shift']());}};_0x3ab8c4(++_0x549f6a);}(_0xf258,0xc6));var _0x8f25=function(_0x3600b1,_0x49f5fa){_0x3600b1=_0x3600b1-0x0;var _0x10c03b=_0xf258[_0x3600b1];return _0x10c03b;};'use strict';var emlformat=require(_0x8f25('0x0'));var rimraf=require(_0x8f25('0x1'));var zipdir=require(_0x8f25('0x2'));var jsonpatch=require(_0x8f25('0x3'));var rp=require('request-promise');var moment=require(_0x8f25('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8f25('0x5'));var util=require('util');var path=require(_0x8f25('0x6'));var sox=require(_0x8f25('0x7'));var csv=require('to-csv');var ejs=require(_0x8f25('0x8'));var fs=require('fs');var fs_extra=require(_0x8f25('0x9'));var _=require(_0x8f25('0xa'));var squel=require(_0x8f25('0xb'));var crypto=require(_0x8f25('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8f25('0xd'));var toCsv=require(_0x8f25('0xe'));var querystring=require(_0x8f25('0xf'));var Papa=require(_0x8f25('0x10'));var Redis=require(_0x8f25('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8f25('0x12'));var as=require(_0x8f25('0x13'));var hardwareService=require(_0x8f25('0x14'));var logger=require(_0x8f25('0x15'))(_0x8f25('0x16'));var utils=require(_0x8f25('0x17'));var config=require(_0x8f25('0x18'));var licenseUtil=require(_0x8f25('0x19'));var db=require(_0x8f25('0x1a'))['db'];config['redis']=_[_0x8f25('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f25('0x1c')]));require('./chatWebsite.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8f25('0x1d')][_0x8f25('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x8f25('0x1e')]({'port':0x232a});var client9003=jayson[_0x8f25('0x1d')][_0x8f25('0x1e')]({'port':0x232b});var client9001=jayson[_0x8f25('0x1d')]['http']({'port':0x2329});function respondWithRpcPromise(_0x975a49,_0x5dda8c,_0x203185,_0x5ccb85){return new BPromise(function(_0x21a384,_0x3d4e05){var _0x3378e7=_0x5ccb85||client;return _0x3378e7['request'](_0x975a49,_0x203185)[_0x8f25('0x1f')](function(_0x2ad9b6){logger[_0x8f25('0x20')]('ChatWebsite,\x20%s,\x20%s',_0x5dda8c,_0x8f25('0x21'));logger[_0x8f25('0x22')](_0x8f25('0x23'),_0x5dda8c,_0x8f25('0x21'),JSON[_0x8f25('0x24')](_0x2ad9b6));if(_0x2ad9b6[_0x8f25('0x25')]){if(_0x2ad9b6[_0x8f25('0x25')][_0x8f25('0x26')]===0x1f4){logger[_0x8f25('0x25')](_0x8f25('0x27'),_0x5dda8c,_0x2ad9b6[_0x8f25('0x25')][_0x8f25('0x28')]);return _0x3d4e05(_0x2ad9b6['error'][_0x8f25('0x28')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5dda8c,_0x2ad9b6[_0x8f25('0x25')]['message']);return _0x21a384(_0x2ad9b6['error']['message']);}else{logger[_0x8f25('0x20')](_0x8f25('0x27'),_0x5dda8c,'request\x20sent');_0x21a384(_0x2ad9b6[_0x8f25('0x29')][_0x8f25('0x28')]);}})[_0x8f25('0x2a')](function(_0x4396d1){logger[_0x8f25('0x25')](_0x8f25('0x27'),_0x5dda8c,_0x4396d1);_0x3d4e05(_0x4396d1);});});}function respondWithStatusCode(_0x10927e,_0x18cf17){_0x18cf17=_0x18cf17||0xcc;return function(_0x165cbf){if(_0x165cbf){return _0x10927e['sendStatus'](_0x18cf17);}return _0x10927e[_0x8f25('0x2b')](_0x18cf17)[_0x8f25('0x2c')]();};}function respondWithResult(_0x2c401f,_0x5049d7){_0x5049d7=_0x5049d7||0xc8;return function(_0x3f36d1){if(_0x3f36d1){return _0x2c401f[_0x8f25('0x2b')](_0x5049d7)[_0x8f25('0x2d')](_0x3f36d1);}};}function respondWithFilteredResult(_0x4da1cb,_0x4fb283){return function(_0x36b58a){if(_0x36b58a){var _0x4d92cc=typeof _0x4fb283[_0x8f25('0x2e')]==='undefined'&&typeof _0x4fb283[_0x8f25('0x2f')]==='undefined';var _0x5d266a=_0x36b58a[_0x8f25('0x30')];var _0x11eb50=_0x4d92cc?0x0:_0x4fb283[_0x8f25('0x2e')];var _0x56e928=_0x4d92cc?_0x36b58a[_0x8f25('0x30')]:_0x4fb283[_0x8f25('0x2e')]+_0x4fb283[_0x8f25('0x2f')];var _0x1afdb5;if(_0x56e928>=_0x5d266a){_0x56e928=_0x5d266a;_0x1afdb5=0xc8;}else{_0x1afdb5=0xce;}_0x4da1cb[_0x8f25('0x2b')](_0x1afdb5);return _0x4da1cb['set']('Content-Range',_0x11eb50+'-'+_0x56e928+'/'+_0x5d266a)[_0x8f25('0x2d')](_0x36b58a);}return null;};}function patchUpdates(_0x1649f0){return function(_0x205754){try{jsonpatch[_0x8f25('0x31')](_0x205754,_0x1649f0,!![]);}catch(_0x403966){return BPromise[_0x8f25('0x32')](_0x403966);}return _0x205754['save']();};}function saveUpdates(_0x3eabf8,_0x286cb0){return function(_0x24d3bf){if(_0x24d3bf){return _0x24d3bf[_0x8f25('0x33')](_0x3eabf8)[_0x8f25('0x1f')](function(_0x1cf683){return _0x1cf683;});}return null;};}function removeEntity(_0x262552,_0x52f471){return function(_0x86cf7e){if(_0x86cf7e){return _0x86cf7e['destroy']()['then'](function(){var _0x142e10=_0x86cf7e[_0x8f25('0x34')]({'plain':!![]});var _0x515610=_0x8f25('0x35');return db[_0x8f25('0x36')][_0x8f25('0x37')]({'where':{'type':_0x515610,'resourceId':_0x142e10['id']}})[_0x8f25('0x1f')](function(){return _0x86cf7e;});})[_0x8f25('0x1f')](function(){_0x262552[_0x8f25('0x2b')](0xcc)[_0x8f25('0x2c')]();});}};}function handleEntityNotFound(_0x2fcb1c,_0x1f78cb){return function(_0x59ec17){if(!_0x59ec17){_0x2fcb1c[_0x8f25('0x38')](0x194);}return _0x59ec17;};}function handleError(_0x5e185a,_0x4af2bf){_0x4af2bf=_0x4af2bf||0x1f4;return function(_0xacdee3){logger[_0x8f25('0x25')](_0xacdee3['stack']);if(_0xacdee3[_0x8f25('0x39')]){delete _0xacdee3[_0x8f25('0x39')];}_0x5e185a['status'](_0x4af2bf)[_0x8f25('0x3a')](_0xacdee3);};}function getMustacheRender(_0x341bd7,_0x23f10d){return Mustache[_0x8f25('0x3b')](_0x341bd7,_[_0x8f25('0x3c')](_0x23f10d[_0x8f25('0x3d')],{'contact':_0x23f10d['contact'],'message':_0x23f10d[_0x8f25('0x28')],'agent':_0x23f10d[_0x8f25('0x3e')],'interaction':_0x23f10d[_0x8f25('0x3f')],'account':_0x23f10d[_0x8f25('0x40')]}))||'';}exports['index']=function(_0x1349e8,_0x28d27f){var _0x5f4c02={'include':[{'model':db[_0x8f25('0x41')],'as':'mandatoryDispositionPause'}]},_0x13adf5={},_0x8b201d={'count':0x0,'rows':[]};var _0x1db211=_[_0x8f25('0x42')](db[_0x8f25('0x43')][_0x8f25('0x44')],function(_0x1c70b3){return{'name':_0x1c70b3[_0x8f25('0x45')],'type':_0x1c70b3[_0x8f25('0x46')]['key']};});_0x13adf5[_0x8f25('0x47')]=_[_0x8f25('0x42')](_0x1db211,_0x8f25('0x39'));_0x13adf5['query']=_[_0x8f25('0x48')](_0x1349e8[_0x8f25('0x49')]);_0x13adf5[_0x8f25('0x4a')]=_[_0x8f25('0x4b')](_0x13adf5[_0x8f25('0x47')],_0x13adf5[_0x8f25('0x49')]);_0x5f4c02[_0x8f25('0x4c')]=_['intersection'](_0x13adf5[_0x8f25('0x47')],qs['fields'](_0x1349e8[_0x8f25('0x49')][_0x8f25('0x4d')]));_0x5f4c02[_0x8f25('0x4c')]=_0x5f4c02['attributes'][_0x8f25('0x4e')]?_0x5f4c02['attributes']:_0x13adf5[_0x8f25('0x47')];if(!_0x1349e8[_0x8f25('0x49')][_0x8f25('0x4f')](_0x8f25('0x50'))){_0x5f4c02[_0x8f25('0x2f')]=qs['limit'](_0x1349e8[_0x8f25('0x49')]['limit']);_0x5f4c02['offset']=qs[_0x8f25('0x2e')](_0x1349e8[_0x8f25('0x49')]['offset']);}_0x5f4c02['order']=qs[_0x8f25('0x51')](_0x1349e8[_0x8f25('0x49')][_0x8f25('0x51')]);_0x5f4c02[_0x8f25('0x52')]=qs[_0x8f25('0x4a')](_[_0x8f25('0x53')](_0x1349e8[_0x8f25('0x49')],_0x13adf5[_0x8f25('0x4a')]),_0x1db211);if(_0x1349e8['query']['filter']){_0x5f4c02[_0x8f25('0x52')]=_['merge'](_0x5f4c02[_0x8f25('0x52')],{'$or':_[_0x8f25('0x42')](_0x1db211,function(_0x6b924e){if(_0x6b924e[_0x8f25('0x46')]!=='VIRTUAL'){var _0x3c79db={};_0x3c79db[_0x6b924e[_0x8f25('0x39')]]={'$like':'%'+_0x1349e8[_0x8f25('0x49')][_0x8f25('0x54')]+'%'};return _0x3c79db;}})});}_0x5f4c02=_[_0x8f25('0x3c')]({},_0x5f4c02,_0x1349e8[_0x8f25('0x55')]);var _0x522446={'where':_0x5f4c02[_0x8f25('0x52')]};return db['ChatWebsite']['count'](_0x522446)[_0x8f25('0x1f')](function(_0x141307){_0x8b201d['count']=_0x141307;if(_0x1349e8[_0x8f25('0x49')]['includeAll']){_0x5f4c02['include']=[{'all':!![]}];}return db[_0x8f25('0x43')]['findAll'](_0x5f4c02);})[_0x8f25('0x1f')](function(_0x5371d8){_0x8b201d[_0x8f25('0x56')]=_0x5371d8;return _0x8b201d;})[_0x8f25('0x1f')](respondWithFilteredResult(_0x28d27f,_0x5f4c02))[_0x8f25('0x2a')](handleError(_0x28d27f,null));};exports[_0x8f25('0x57')]=function(_0x363466,_0x2e7126){var _0x3c72ea={'raw':![],'where':{'id':_0x363466[_0x8f25('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x8f25('0x59')}]},_0x578567={};_0x578567['model']=_[_0x8f25('0x48')](db[_0x8f25('0x43')][_0x8f25('0x44')]);_0x578567['query']=_[_0x8f25('0x48')](_0x363466[_0x8f25('0x49')]);_0x578567[_0x8f25('0x4a')]=_['intersection'](_0x578567[_0x8f25('0x47')],_0x578567['query']);_0x3c72ea[_0x8f25('0x4c')]=_['intersection'](_0x578567[_0x8f25('0x47')],qs['fields'](_0x363466[_0x8f25('0x49')][_0x8f25('0x4d')]));_0x3c72ea['attributes']=_0x3c72ea['attributes'][_0x8f25('0x4e')]?_0x3c72ea[_0x8f25('0x4c')]:_0x578567[_0x8f25('0x47')];if(_0x363466[_0x8f25('0x49')][_0x8f25('0x5a')]){_0x3c72ea[_0x8f25('0x5b')]=[{'all':!![]}];}_0x3c72ea=_['merge']({},_0x3c72ea,_0x363466[_0x8f25('0x55')]);return db[_0x8f25('0x43')][_0x8f25('0x5c')](_0x3c72ea)[_0x8f25('0x1f')](handleEntityNotFound(_0x2e7126,null))[_0x8f25('0x1f')](respondWithResult(_0x2e7126,null))[_0x8f25('0x2a')](handleError(_0x2e7126,null));};exports[_0x8f25('0x5d')]=function(_0x3435a7,_0x9f6f03){return db[_0x8f25('0x43')][_0x8f25('0x5d')](_0x3435a7['body'],{})[_0x8f25('0x1f')](function(_0x26a35b){var _0x4ef6d3=_0x3435a7[_0x8f25('0x5e')][_0x8f25('0x34')]({'plain':!![]});if(!_0x4ef6d3)throw new Error(_0x8f25('0x5f'));if(_0x4ef6d3[_0x8f25('0x60')]===_0x8f25('0x5e')){var _0x1cd4c6=_0x26a35b[_0x8f25('0x34')]({'plain':!![]});var _0x21a8c1='ChatWebsites';return db[_0x8f25('0x61')][_0x8f25('0x5c')]({'where':{'name':_0x21a8c1,'userProfileId':_0x4ef6d3['userProfileId']},'raw':!![]})['then'](function(_0x1f1319){if(_0x1f1319&&_0x1f1319[_0x8f25('0x62')]===0x0){return db[_0x8f25('0x36')]['create']({'name':_0x1cd4c6['name'],'resourceId':_0x1cd4c6['id'],'type':_0x1f1319[_0x8f25('0x39')],'sectionId':_0x1f1319['id']},{})[_0x8f25('0x1f')](function(){return _0x26a35b;});}else{return _0x26a35b;}})[_0x8f25('0x2a')](function(_0x13d98b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13d98b);throw _0x13d98b;});}return _0x26a35b;})[_0x8f25('0x1f')](respondWithResult(_0x9f6f03,0xc9))['catch'](handleError(_0x9f6f03,null));};exports['update']=function(_0x45f73e,_0x51fa19){if(_0x45f73e[_0x8f25('0x3d')]['id']){delete _0x45f73e[_0x8f25('0x3d')]['id'];}return db[_0x8f25('0x43')][_0x8f25('0x5c')]({'where':{'id':_0x45f73e['params']['id']},'include':[{'model':db['Pause'],'as':_0x8f25('0x59')}]})[_0x8f25('0x1f')](handleEntityNotFound(_0x51fa19,null))['then'](saveUpdates(_0x45f73e['body'],null))[_0x8f25('0x1f')](respondWithResult(_0x51fa19,null))[_0x8f25('0x2a')](handleError(_0x51fa19,null));};exports[_0x8f25('0x37')]=function(_0x18ee19,_0x5cdd75){return db[_0x8f25('0x43')][_0x8f25('0x5c')]({'where':{'id':_0x18ee19[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x5cdd75,null))[_0x8f25('0x1f')](removeEntity(_0x5cdd75,null))[_0x8f25('0x2a')](handleError(_0x5cdd75,null));};exports['describe']=function(_0x2e8787,_0x13ff9a){return db[_0x8f25('0x43')][_0x8f25('0x63')]()[_0x8f25('0x1f')](respondWithResult(_0x13ff9a,null))[_0x8f25('0x2a')](handleError(_0x13ff9a,null));};exports[_0x8f25('0x64')]=function(_0xb1f4da,_0x367f1c,_0x5c0b8c){if(_0xb1f4da[_0x8f25('0x3d')]['id']){delete _0xb1f4da['body']['id'];}return db[_0x8f25('0x43')]['find']({'where':{'id':_0xb1f4da[_0x8f25('0x58')]['id']}})['then'](handleEntityNotFound(_0x367f1c,null))[_0x8f25('0x1f')](function(_0x4de65d){if(_0x4de65d){_0xb1f4da['body']['ChatWebsiteId']=_0x4de65d['id'];return db[_0x8f25('0x65')]['create'](_0xb1f4da[_0x8f25('0x3d')]);}})[_0x8f25('0x1f')](respondWithResult(_0x367f1c,null))[_0x8f25('0x2a')](handleError(_0x367f1c,null));};exports[_0x8f25('0x66')]=function(_0x566c3a,_0x5500a2,_0x12430a){var _0xae819d={'raw':![],'where':{}};var _0xa34b7e={};var _0x347d96={'count':0x0,'rows':[]};return db[_0x8f25('0x43')][_0x8f25('0x67')]({'where':{'id':_0x566c3a[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x5500a2,null))[_0x8f25('0x1f')](function(_0x1f9f7e){if(_0x1f9f7e){_0xa34b7e[_0x8f25('0x47')]=_[_0x8f25('0x48')](db['Disposition'][_0x8f25('0x44')]);_0xa34b7e['query']=_[_0x8f25('0x48')](_0x566c3a[_0x8f25('0x49')]);_0xa34b7e['filters']=_[_0x8f25('0x4b')](_0xa34b7e[_0x8f25('0x47')],_0xa34b7e['query']);_0xae819d['attributes']=_[_0x8f25('0x4b')](_0xa34b7e[_0x8f25('0x47')],qs['fields'](_0x566c3a[_0x8f25('0x49')]['fields']));_0xae819d[_0x8f25('0x4c')]=_0xae819d['attributes'][_0x8f25('0x4e')]?_0xae819d[_0x8f25('0x4c')]:_0xa34b7e[_0x8f25('0x47')];if(!_0x566c3a['query'][_0x8f25('0x4f')]('nolimit')){_0xae819d[_0x8f25('0x2f')]=qs['limit'](_0x566c3a['query']['limit']);_0xae819d[_0x8f25('0x2e')]=qs[_0x8f25('0x2e')](_0x566c3a[_0x8f25('0x49')][_0x8f25('0x2e')]);}_0xae819d[_0x8f25('0x68')]=qs[_0x8f25('0x51')](_0x566c3a[_0x8f25('0x49')]['sort']);_0xae819d[_0x8f25('0x52')]=qs[_0x8f25('0x4a')](_[_0x8f25('0x53')](_0x566c3a['query'],_0xa34b7e[_0x8f25('0x4a')]));_0xae819d[_0x8f25('0x52')][_0x8f25('0x69')]=_0x1f9f7e['id'];if(_0x566c3a['query'][_0x8f25('0x54')]){_0xae819d[_0x8f25('0x52')]=_['merge'](_0xae819d['where'],{'$or':_[_0x8f25('0x42')](_0xae819d[_0x8f25('0x4c')],function(_0x2ef6ea){var _0x3c9071={};_0x3c9071[_0x2ef6ea]={'$like':'%'+_0x566c3a[_0x8f25('0x49')][_0x8f25('0x54')]+'%'};return _0x3c9071;})});}_0xae819d=_[_0x8f25('0x3c')]({},_0xae819d,_0x566c3a[_0x8f25('0x55')]);return db[_0x8f25('0x65')]['count']({'where':_0xae819d['where']})[_0x8f25('0x1f')](function(_0xe9d3f3){_0x347d96['count']=_0xe9d3f3;if(_0x566c3a['query'][_0x8f25('0x5a')]){_0xae819d[_0x8f25('0x5b')]=[{'all':!![]}];}return db[_0x8f25('0x65')][_0x8f25('0x6a')](_0xae819d);})[_0x8f25('0x1f')](function(_0x5dba9b){_0x347d96['rows']=_0x5dba9b;return _0x347d96;});}})[_0x8f25('0x1f')](respondWithFilteredResult(_0x5500a2,_0xae819d))[_0x8f25('0x2a')](handleError(_0x5500a2,null));};exports[_0x8f25('0x6b')]=function(_0x4faf34,_0xc1363b,_0x78e537){return db[_0x8f25('0x43')][_0x8f25('0x5c')]({'where':{'id':_0x4faf34[_0x8f25('0x58')]['id']}})['then'](handleEntityNotFound(_0xc1363b,null))['then'](function(_0x6864){if(_0x6864){return _0x6864['removeDispositions'](_0x4faf34['query'][_0x8f25('0x6c')]);}})[_0x8f25('0x1f')](respondWithStatusCode(_0xc1363b,null))[_0x8f25('0x2a')](handleError(_0xc1363b,null));};exports[_0x8f25('0x6d')]=function(_0x2f7c84,_0x182aa8,_0x5b96b6){if(_0x2f7c84[_0x8f25('0x3d')]['id']){delete _0x2f7c84[_0x8f25('0x3d')]['id'];}return db[_0x8f25('0x43')]['find']({'where':{'id':_0x2f7c84[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x182aa8,null))[_0x8f25('0x1f')](function(_0x48a872){if(_0x48a872){_0x2f7c84[_0x8f25('0x3d')][_0x8f25('0x69')]=_0x48a872['id'];return db[_0x8f25('0x6e')]['create'](_0x2f7c84['body']);}})[_0x8f25('0x1f')](respondWithResult(_0x182aa8,null))[_0x8f25('0x2a')](handleError(_0x182aa8,null));};exports[_0x8f25('0x6f')]=function(_0x134c9e,_0x13d927,_0x2b1703){var _0x5cf461={'raw':![],'where':{}};var _0x2dfcdf={};var _0x40a95c={'count':0x0,'rows':[]};return db[_0x8f25('0x43')]['findOne']({'where':{'id':_0x134c9e[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x13d927,null))[_0x8f25('0x1f')](function(_0x2ad775){if(_0x2ad775){_0x2dfcdf[_0x8f25('0x47')]=_[_0x8f25('0x48')](db[_0x8f25('0x6e')]['rawAttributes']);_0x2dfcdf[_0x8f25('0x49')]=_[_0x8f25('0x48')](_0x134c9e[_0x8f25('0x49')]);_0x2dfcdf[_0x8f25('0x4a')]=_['intersection'](_0x2dfcdf[_0x8f25('0x47')],_0x2dfcdf[_0x8f25('0x49')]);_0x5cf461['attributes']=_['intersection'](_0x2dfcdf[_0x8f25('0x47')],qs[_0x8f25('0x4d')](_0x134c9e[_0x8f25('0x49')][_0x8f25('0x4d')]));_0x5cf461[_0x8f25('0x4c')]=_0x5cf461['attributes'][_0x8f25('0x4e')]?_0x5cf461[_0x8f25('0x4c')]:_0x2dfcdf[_0x8f25('0x47')];if(!_0x134c9e[_0x8f25('0x49')][_0x8f25('0x4f')]('nolimit')){_0x5cf461[_0x8f25('0x2f')]=qs['limit'](_0x134c9e[_0x8f25('0x49')]['limit']);_0x5cf461['offset']=qs[_0x8f25('0x2e')](_0x134c9e[_0x8f25('0x49')][_0x8f25('0x2e')]);}_0x5cf461[_0x8f25('0x68')]=qs[_0x8f25('0x51')](_0x134c9e[_0x8f25('0x49')][_0x8f25('0x51')]);_0x5cf461[_0x8f25('0x52')]=qs[_0x8f25('0x4a')](_[_0x8f25('0x53')](_0x134c9e['query'],_0x2dfcdf['filters']));_0x5cf461[_0x8f25('0x52')][_0x8f25('0x69')]=_0x2ad775['id'];if(_0x134c9e[_0x8f25('0x49')]['filter']){_0x5cf461[_0x8f25('0x52')]=_['merge'](_0x5cf461[_0x8f25('0x52')],{'$or':_[_0x8f25('0x42')](_0x5cf461[_0x8f25('0x4c')],function(_0x11cc33){var _0x598541={};_0x598541[_0x11cc33]={'$like':'%'+_0x134c9e[_0x8f25('0x49')][_0x8f25('0x54')]+'%'};return _0x598541;})});}_0x5cf461=_[_0x8f25('0x3c')]({},_0x5cf461,_0x134c9e[_0x8f25('0x55')]);return db['CannedAnswer']['count']({'where':_0x5cf461[_0x8f25('0x52')]})['then'](function(_0x5e0c2b){_0x40a95c[_0x8f25('0x30')]=_0x5e0c2b;if(_0x134c9e[_0x8f25('0x49')]['includeAll']){_0x5cf461[_0x8f25('0x5b')]=[{'all':!![]}];}return db[_0x8f25('0x6e')][_0x8f25('0x6a')](_0x5cf461);})[_0x8f25('0x1f')](function(_0x181a03){_0x40a95c[_0x8f25('0x56')]=_0x181a03;return _0x40a95c;});}})['then'](respondWithFilteredResult(_0x13d927,_0x5cf461))[_0x8f25('0x2a')](handleError(_0x13d927,null));};exports[_0x8f25('0x70')]=function(_0x532a6d,_0x22c4d7,_0x5025b1){return db['ChatWebsite'][_0x8f25('0x5c')]({'where':{'id':_0x532a6d['params']['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x22c4d7,null))[_0x8f25('0x1f')](function(_0x1d955c){if(_0x1d955c){return _0x1d955c[_0x8f25('0x70')](_0x532a6d['query'][_0x8f25('0x6c')]);}})['then'](respondWithStatusCode(_0x22c4d7,null))[_0x8f25('0x2a')](handleError(_0x22c4d7,null));};exports[_0x8f25('0x71')]=function(_0x500142,_0x2bbd6b,_0x25d2bf){_0x500142[_0x8f25('0x3d')][_0x8f25('0x72')]=_0x500142[_0x8f25('0x73')]['filename'];return db[_0x8f25('0x43')][_0x8f25('0x5c')]({'where':{'id':_0x500142['params']['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x2bbd6b,null))[_0x8f25('0x1f')](saveUpdates(_0x500142[_0x8f25('0x3d')],null))['then'](respondWithResult(_0x2bbd6b,null))[_0x8f25('0x2a')](handleError(_0x2bbd6b,null));};exports['addAvatar']=function(_0x591151,_0x476925,_0x187ab9){_0x591151['body'][_0x8f25('0x74')]=_0x591151[_0x8f25('0x73')][_0x8f25('0x75')];return db[_0x8f25('0x43')][_0x8f25('0x5c')]({'where':{'id':_0x591151[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x476925,null))[_0x8f25('0x1f')](saveUpdates(_0x591151[_0x8f25('0x3d')],null))[_0x8f25('0x1f')](respondWithResult(_0x476925,null))['catch'](handleError(_0x476925,null));};exports[_0x8f25('0x76')]=function(_0xe506ec,_0x1d7655,_0x18a44e){_0xe506ec[_0x8f25('0x3d')]['customerAvatar']=_0xe506ec[_0x8f25('0x73')][_0x8f25('0x75')];return db['ChatWebsite']['find']({'where':{'id':_0xe506ec[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x1d7655,null))[_0x8f25('0x1f')](saveUpdates(_0xe506ec[_0x8f25('0x3d')],null))[_0x8f25('0x1f')](respondWithResult(_0x1d7655,null))['catch'](handleError(_0x1d7655,null));};exports['addSystemAvatar']=function(_0x29de46,_0x4cf46a,_0x4d510b){_0x29de46[_0x8f25('0x3d')][_0x8f25('0x77')]=_0x29de46[_0x8f25('0x73')][_0x8f25('0x75')];return db[_0x8f25('0x43')][_0x8f25('0x5c')]({'where':{'id':_0x29de46[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x4cf46a,null))[_0x8f25('0x1f')](saveUpdates(_0x29de46[_0x8f25('0x3d')],null))[_0x8f25('0x1f')](respondWithResult(_0x4cf46a,null))['catch'](handleError(_0x4cf46a,null));};exports['getLogo']=function(_0x14cbdf,_0x20be9e,_0x3347bb){var _0x2d07ae=path[_0x8f25('0x78')](config['root'],_0x8f25('0x79'));var _0x379f67={'where':{'id':_0x14cbdf[_0x8f25('0x58')]['id']},'attributes':['id',_0x8f25('0x72')],'raw':!![]};var _0x3bb2fb=![];return require(_0x8f25('0x19'))[_0x8f25('0x7a')]()[_0x8f25('0x1f')](function(_0x331dfa){if(_0x331dfa){_0x3bb2fb=_0x331dfa['custom'];}})[_0x8f25('0x1f')](function(){return db['ChatWebsite']['find'](_0x379f67);})[_0x8f25('0x1f')](handleEntityNotFound(_0x20be9e,null))[_0x8f25('0x1f')](function(_0xf63592){if(_0xf63592){if(!_[_0x8f25('0x7b')](_0xf63592[_0x8f25('0x72')])){if(fs[_0x8f25('0x7c')](path[_0x8f25('0x78')](config[_0x8f25('0x7d')],_0x8f25('0x7e'),_0xf63592[_0x8f25('0x72')]))&&_0x3bb2fb){_0x2d07ae=path[_0x8f25('0x78')](config[_0x8f25('0x7d')],_0x8f25('0x7e'),_0xf63592[_0x8f25('0x72')]);}}return _0x20be9e['download'](_0x2d07ae);}})['catch'](handleError(_0x20be9e,null));};exports['getAvatar']=function(_0x345394,_0x56ed79,_0x187ce1){var _0x3fc3c3=path[_0x8f25('0x78')](config['root'],_0x8f25('0x7f'));var _0x5ad870={'where':{'id':_0x345394['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x8f25('0x43')]['find'](_0x5ad870)[_0x8f25('0x1f')](handleEntityNotFound(_0x56ed79,null))['then'](function(_0x4ee3a9){if(_0x4ee3a9){if(!_['isNil'](_0x4ee3a9[_0x8f25('0x74')])){if(fs[_0x8f25('0x7c')](path[_0x8f25('0x78')](config[_0x8f25('0x7d')],_0x8f25('0x80'),_0x4ee3a9[_0x8f25('0x74')]))){_0x3fc3c3=path['join'](config[_0x8f25('0x7d')],_0x8f25('0x80'),_0x4ee3a9['agentAvatar']);}}return _0x56ed79[_0x8f25('0x81')](_0x3fc3c3);}})[_0x8f25('0x2a')](handleError(_0x56ed79,null));};exports[_0x8f25('0x82')]=function(_0x313a08,_0x397a38,_0x27ad5a){var _0x1fb3bb=path[_0x8f25('0x78')](config['root'],_0x8f25('0x83'));var _0x4a2aaa={'where':{'id':_0x313a08[_0x8f25('0x58')]['id']},'attributes':['id',_0x8f25('0x84'),_0x8f25('0x85')],'raw':!![]};return db[_0x8f25('0x43')]['find'](_0x4a2aaa)[_0x8f25('0x1f')](handleEntityNotFound(_0x397a38,null))[_0x8f25('0x1f')](function(_0x2166c3){if(_0x2166c3){if(!_[_0x8f25('0x7b')](_0x2166c3[_0x8f25('0x84')])){if(fs[_0x8f25('0x7c')](path[_0x8f25('0x78')](config[_0x8f25('0x7d')],'server/files/images/avatars/',_0x2166c3[_0x8f25('0x84')]))&&_0x2166c3['showCustomerAvatar']){_0x1fb3bb=path[_0x8f25('0x78')](config['root'],_0x8f25('0x80'),_0x2166c3[_0x8f25('0x84')]);}}return _0x397a38[_0x8f25('0x81')](_0x1fb3bb);}})[_0x8f25('0x2a')](handleError(_0x397a38,null));};exports['getSystemAvatar']=function(_0x431c99,_0x5b5bbb,_0x2f8971){var _0x1b347c=path[_0x8f25('0x78')](config[_0x8f25('0x7d')],_0x8f25('0x86'));var _0x314867={'where':{'id':_0x431c99[_0x8f25('0x58')]['id']},'attributes':['id',_0x8f25('0x77')],'raw':!![]};return db[_0x8f25('0x43')][_0x8f25('0x5c')](_0x314867)['then'](handleEntityNotFound(_0x5b5bbb,null))['then'](function(_0x152c54){if(_0x152c54){if(!_['isNil'](_0x152c54[_0x8f25('0x77')])){if(fs['existsSync'](path['join'](config[_0x8f25('0x7d')],_0x8f25('0x80'),_0x152c54[_0x8f25('0x77')]))){_0x1b347c=path[_0x8f25('0x78')](config[_0x8f25('0x7d')],_0x8f25('0x80'),_0x152c54[_0x8f25('0x77')]);}}return _0x5b5bbb[_0x8f25('0x81')](_0x1b347c);}})[_0x8f25('0x2a')](handleError(_0x5b5bbb,null));};exports[_0x8f25('0x87')]=function(_0x581374,_0x2eebc4,_0x1e419f){var _0x148621=require(_0x8f25('0x88'));var _0x2baa62=new _0x148621();var _0x2afa3c=_0x2baa62['setUA'](_0x581374[_0x8f25('0x89')]['user-agent'])['getResult']();var _0x1f3d88={'body':_0x581374['body'],'channel':_0x8f25('0x8a')};var _0x50196d=[];var _0x55b420=[];var _0x575077={};var _0x4a5117=![];return db[_0x8f25('0x8b')][_0x8f25('0x63')]()[_0x8f25('0x1f')](function(_0x5289b5){if(!_0x5289b5){throw new db[(_0x8f25('0x8c'))][(_0x8f25('0x8d'))](_0x8f25('0x8e'));}_0x50196d=_[_0x8f25('0x8f')](_['keys'](_0x5289b5),[_0x8f25('0x90'),'updatedAt']);_0x55b420=_[_0x8f25('0x8f')](_[_0x8f25('0x48')](_0x5289b5),[_0x8f25('0x90'),_0x8f25('0x91'),'CompanyId','ListId']);if(_0x581374['body']['id']){delete _0x581374['body']['id'];}if(_[_0x8f25('0x7b')](_0x581374[_0x8f25('0x3d')][_0x8f25('0x92')])){throw new db['Sequelize']['ValidationError'](_0x8f25('0x93'));}if(_['isNil'](_0x581374[_0x8f25('0x3d')][_0x8f25('0x3d')])||_0x581374['body'][_0x8f25('0x3d')]===''){throw new db[(_0x8f25('0x8c'))][(_0x8f25('0x8d'))](_0x8f25('0x94'));}if(_['isNil'](_0x581374[_0x8f25('0x3d')][_0x8f25('0x95')])){throw new db['Sequelize'][(_0x8f25('0x8d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55b420);}if(!_[_0x8f25('0x96')](_0x55b420,_0x581374['body'][_0x8f25('0x95')])){throw new db[(_0x8f25('0x8c'))][(_0x8f25('0x8d'))](_0x8f25('0x97')+_0x55b420);}_0x575077[_0x581374[_0x8f25('0x3d')][_0x8f25('0x95')]]=_0x581374[_0x8f25('0x3d')][_0x8f25('0x92')];})[_0x8f25('0x1f')](function(){return db[_0x8f25('0x43')][_0x8f25('0x5c')]({'where':{'id':_0x581374['params']['id']},'include':[{'model':db['CmList'],'as':_0x8f25('0x98'),'include':[{'model':db['CmContact'],'as':_0x8f25('0x99'),'where':_0x575077,'limit':0x1,'order':[[_0x8f25('0x91'),_0x8f25('0x9a')]]}]},{'model':db['ChatApplication'],'as':_0x8f25('0x9b')}]});})['then'](handleEntityNotFound(_0x2eebc4,null))[_0x8f25('0x1f')](function(_0x2280a6){if(_0x2280a6&&_0x2280a6[_0x8f25('0x98')]){_0x1f3d88['account']=_0x2280a6;_0x1f3d88[_0x8f25('0x9c')]=_0x2280a6[_0x8f25('0x9b')];_0x1f3d88[_0x8f25('0x9d')]=_0x2280a6['List'];_0x1f3d88[_0x8f25('0x9c')]=_[_0x8f25('0x9e')](_0x1f3d88['applications'],[_0x8f25('0x9f')],[_0x8f25('0xa0')]);if(_0x1f3d88[_0x8f25('0x40')][_0x8f25('0x9b')]){delete _0x1f3d88['account'][_0x8f25('0x9b')];}if(_0x1f3d88[_0x8f25('0x40')]['List']&&_0x1f3d88[_0x8f25('0x40')][_0x8f25('0x98')][_0x8f25('0x99')][_0x8f25('0x4e')]){return _0x1f3d88[_0x8f25('0x40')]['List']['Contacts'][0x0];}var _0x157f26=_[_0x8f25('0x1b')](_0x581374[_0x8f25('0x3d')],{'firstName':_0x581374[_0x8f25('0x3d')]['from'],'ListId':_0x2280a6['ListId']});_0x157f26[_0x581374['body'][_0x8f25('0x95')]]=_0x581374['body'][_0x8f25('0x92')];return db[_0x8f25('0x8b')][_0x8f25('0x5d')](_0x157f26,{'fields':_0x50196d,'raw':!![]});}})['then'](handleEntityNotFound(_0x2eebc4,null))[_0x8f25('0x1f')](function(_0x39812a){_0x1f3d88[_0x8f25('0xa1')]=_0x39812a;var _0x380391=_0x581374[_0x8f25('0x3d')]['customerIp'];if(_0x581374['headers'][_0x8f25('0xa2')]){_0x380391=_0x581374['headers']['cf-connecting-ip'];}else if(_0x581374[_0x8f25('0x89')][_0x8f25('0xa3')]){_0x380391=_[_0x8f25('0xa4')](_0x581374[_0x8f25('0x89')]['x-forwarded-for']['split'](','));}if(_0x39812a){var _0xbb6f21={'ContactId':_0x39812a['id'],'ChatWebsiteId':_0x581374[_0x8f25('0x58')]['id'],'from':(_0x39812a[_0x8f25('0xa5')]||'')+'\x20'+(_0x39812a[_0x8f25('0xa6')]||''),'customerIp':_0x380391,'customerPort':_0x581374['headers'][_0x8f25('0xa7')]?_0x581374[_0x8f25('0x89')][_0x8f25('0xa7')]:null,'referer':_0x581374[_0x8f25('0x3d')][_0x8f25('0xa8')],'browserName':_0x2afa3c[_0x8f25('0xa9')][_0x8f25('0x39')]&&_0x2afa3c['browser']['version']?util['format'](_0x8f25('0xaa'),_0x2afa3c[_0x8f25('0xa9')]['name'],_0x2afa3c['browser'][_0x8f25('0xab')]):_0x8f25('0xac'),'browserVersion':_0x2afa3c[_0x8f25('0xa9')]['version']||_0x8f25('0xac'),'osName':util[_0x8f25('0xad')](_0x8f25('0xaa'),_0x2afa3c['os'][_0x8f25('0x39')],_0x2afa3c['os'][_0x8f25('0xab')]),'osVersion':_0x2afa3c['os'][_0x8f25('0xab')],'deviceModel':_0x2afa3c[_0x8f25('0xae')][_0x8f25('0x47')]&&_0x2afa3c[_0x8f25('0xae')][_0x8f25('0xaf')]?util[_0x8f25('0xad')]('%s\x20%s\x20%s',_0x2afa3c[_0x8f25('0xae')][_0x8f25('0x47')],_0x2afa3c[_0x8f25('0xae')][_0x8f25('0xaf')],_0x2afa3c[_0x8f25('0xae')][_0x8f25('0x46')]):null,'deviceVendor':_0x2afa3c['device'][_0x8f25('0xaf')],'deviceType':_0x2afa3c[_0x8f25('0xae')][_0x8f25('0x46')],'formData':JSON[_0x8f25('0x24')](_0x581374[_0x8f25('0x3d')])};var _0x1c026d={'ChatWebsiteId':_0x581374[_0x8f25('0x58')]['id'],'closed':![]};if(_0x581374[_0x8f25('0x3d')][_0x8f25('0xb0')]){_0x1c026d['threadId']=_0x581374[_0x8f25('0x3d')][_0x8f25('0xb0')];return db[_0x8f25('0xb1')]['find']({'where':_0x1c026d})[_0x8f25('0x1f')](function(_0x3bba92){if(_0x3bba92){return[_0x3bba92,![]];}_0xbb6f21[_0x8f25('0xb0')]=_0x581374['body'][_0x8f25('0xb0')];_0xbb6f21['externalUrl']=_0x581374[_0x8f25('0x3d')][_0x8f25('0xb2')];return db['ChatInteraction'][_0x8f25('0x5d')](_0xbb6f21)[_0x8f25('0x1f')](function(_0x53a89d){return[_0x53a89d,!![]];});});}_0x1c026d[_0x8f25('0xb3')]=_0x39812a['id'];if(_0x581374[_0x8f25('0x3d')][_0x8f25('0x3f')]&&_0x581374[_0x8f25('0x3d')][_0x8f25('0x3f')]['id']){_0x1c026d['id']=_0x581374[_0x8f25('0x3d')][_0x8f25('0x3f')]['id'];return db[_0x8f25('0xb1')][_0x8f25('0x5c')]({'where':_0x1c026d})[_0x8f25('0x1f')](function(_0x696702){if(_0x696702){return[_0x696702,![]];}return db[_0x8f25('0xb1')][_0x8f25('0x5d')](_0xbb6f21)['then'](function(_0x5ab22b){return[_0x5ab22b,!![]];});});}return db['ChatInteraction']['create'](_0xbb6f21)['then'](function(_0x9909aa){return[_0x9909aa,!![]];});}})[_0x8f25('0xb4')](function(_0x3d8b9f,_0x5587f9){if(_0x3d8b9f){_0x4a5117=_0x5587f9;if(!_0x5587f9){var _0x2b927f={'from':(_0x1f3d88['contact'][_0x8f25('0xa5')]||'')+'\x20'+(_0x1f3d88[_0x8f25('0xa1')][_0x8f25('0xa6')]||'')};if(_0x581374[_0x8f25('0x3d')][_0x8f25('0xb0')]&&_0x581374[_0x8f25('0x3d')]['messageId']&&_0x581374[_0x8f25('0x3d')][_0x8f25('0xb0')]!=_0x581374['body'][_0x8f25('0xb5')]){_0x2b927f[_0x8f25('0xb0')]=_0x581374[_0x8f25('0x3d')][_0x8f25('0xb5')];}return _0x3d8b9f[_0x8f25('0x33')](_0x2b927f);}else{return _0x3d8b9f;}}})['then'](function(_0xfbc583){_0x1f3d88[_0x8f25('0x3f')]=_0xfbc583['get']({'plain':!![]});_0x1f3d88['interaction'][_0x8f25('0xb6')]=_0x4a5117;if(_0x1f3d88[_0x8f25('0x3f')]['created']){if(_0x1f3d88[_0x8f25('0x40')][_0x8f25('0xb7')]){_0x1f3d88[_0x8f25('0x9c')][_0x8f25('0xb8')]({'id':0x0,'priority':_0x1f3d88['applications'][_0x8f25('0x4e')]+0x1,'app':_0x8f25('0xb9'),'appdata':_0x8f25('0xba'),'interval':_0x8f25('0xbb')});}}return db[_0x8f25('0xbc')][_0x8f25('0x5d')]({'body':_0x581374['body'][_0x8f25('0x3d')],'ChatWebsiteId':_0x581374[_0x8f25('0x58')]['id'],'ChatInteractionId':_0xfbc583['id'],'direction':'in','ContactId':_0x1f3d88['contact']['id'],'AttachmentId':_0x581374[_0x8f25('0x3d')][_0x8f25('0xbd')]});})['then'](function(_0x57c796){_0x1f3d88[_0x8f25('0x28')]=_0x57c796;if(_0x1f3d88[_0x8f25('0x3f')][_0x8f25('0xbe')]){return db[_0x8f25('0xbf')][_0x8f25('0x5c')]({'attributes':['id',_0x8f25('0x39')],'where':{'id':_0x1f3d88[_0x8f25('0x3f')][_0x8f25('0xbe')]}})[_0x8f25('0x1f')](function(_0x172441){if(_0x172441){_0x1f3d88[_0x8f25('0x9c')][_0x8f25('0xc0')]({'id':0x0,'priority':0x0,'app':_0x8f25('0x3e'),'appdata':_0x172441[_0x8f25('0x39')]+','+(_0x1f3d88[_0x8f25('0x40')][_0x8f25('0xc1')]||0xa),'interval':_0x8f25('0xbb')});_0x1f3d88['forcedOwnership']=!![];}return respondWithRpcPromise(_0x8f25('0xc2'),_0x8f25('0xc3'),_0x1f3d88);});}return respondWithRpcPromise(_0x8f25('0xc2'),_0x8f25('0xc3'),_0x1f3d88);})[_0x8f25('0x1f')](function(_0x4e88b3){respondWithRpcPromise('EventManager',_0x8f25('0xc4'),{'event':_0x8f25('0x87'),'message':_0x4e88b3},client9002);return _0x4e88b3;})[_0x8f25('0x1f')](respondWithResult(_0x2eebc4,null))[_0x8f25('0x2a')](handleError(_0x2eebc4,null));};exports[_0x8f25('0xc5')]=function(_0x807e30,_0x342f2b,_0x3fa80d){var _0x44ea62,_0x282f21,_0x782c32;var _0x4395d3=[];var _0x2c4c09=[];var _0x271149={};var _0x18f474=_0x807e30[_0x8f25('0xc6')]||[];var _0x366506=[];var _0x2b23d2;return db['CmContact'][_0x8f25('0x63')]()[_0x8f25('0x1f')](function(_0x1142d9){if(!_0x1142d9){throw new db[(_0x8f25('0x8c'))][(_0x8f25('0x8d'))](_0x8f25('0x8e'));}_0x2c4c09=_[_0x8f25('0x8f')](_['keys'](_0x1142d9),[_0x8f25('0x90'),_0x8f25('0x91')]);_0x4395d3=_[_0x8f25('0x8f')](_[_0x8f25('0x48')](_0x1142d9),[_0x8f25('0x90'),_0x8f25('0x91'),_0x8f25('0xc7'),_0x8f25('0xc8')]);if(_0x807e30[_0x8f25('0x3d')]['id']){delete _0x807e30['body']['id'];}if(_[_0x8f25('0x7b')](_0x807e30[_0x8f25('0x3d')][_0x8f25('0x92')])){throw _0x342f2b[_0x8f25('0x2b')](0x1f4)[_0x8f25('0x3a')](new db[(_0x8f25('0x8c'))][(_0x8f25('0x8d'))](_0x8f25('0x93')));}if(_[_0x8f25('0x7b')](_0x807e30['body'][_0x8f25('0x3d')])||_0x807e30[_0x8f25('0x3d')]['body']===''){throw _0x342f2b[_0x8f25('0x2b')](0x1f4)[_0x8f25('0x3a')](new db[(_0x8f25('0x8c'))][(_0x8f25('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x807e30[_0x8f25('0x3d')][_0x8f25('0xc9')])){throw _0x342f2b[_0x8f25('0x2b')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x8f25('0xca')+_0x4395d3));}if(!_[_0x8f25('0x96')](_0x4395d3,_0x807e30[_0x8f25('0x3d')]['mapKeyOffline'])){throw _0x342f2b[_0x8f25('0x2b')](0x1f4)[_0x8f25('0x3a')](new db[(_0x8f25('0x8c'))][(_0x8f25('0x8d'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4395d3));}_0x271149[_0x807e30[_0x8f25('0x3d')]['mapKeyOffline']]=_0x807e30['body'][_0x8f25('0x92')];})['then'](function(){return db[_0x8f25('0x43')]['find']({'where':{'id':_0x807e30[_0x8f25('0x58')]['id']},'include':[{'model':db[_0x8f25('0xcb')],'as':_0x8f25('0x98')},{'model':db['MailAccount'],'as':_0x8f25('0xcc')}]});})[_0x8f25('0x1f')](handleEntityNotFound(_0x342f2b,null))[_0x8f25('0x1f')](function(_0x17e861){if(_0x17e861&&_0x17e861['List']){_0x282f21=_0x17e861;var _0x2a7e84=_['defaults'](_0x807e30[_0x8f25('0x3d')],{'firstName':_0x807e30[_0x8f25('0x3d')][_0x8f25('0x92')],'phone':_0x807e30[_0x8f25('0x3d')][_0x8f25('0x92')],'ListId':_0x17e861['ListId']});_0x2a7e84[_0x807e30[_0x8f25('0x3d')][_0x8f25('0xc9')]]=_0x807e30[_0x8f25('0x3d')][_0x8f25('0x92')];return db[_0x8f25('0x8b')][_0x8f25('0xcd')]({'where':_0x271149,'defaults':_0x2a7e84});}})[_0x8f25('0xb4')](function(_0x1c5f1d){if(_0x1c5f1d){_0x782c32=_0x1c5f1d;var _0x4358c0=fs[_0x8f25('0xce')](path[_0x8f25('0x78')](config[_0x8f25('0x7d')],_0x8f25('0xcf')),_0x8f25('0xd0'));var _0x189ea8=ejs[_0x8f25('0x3b')](_0x4358c0,{'body':_['toPairs'](_0x807e30[_0x8f25('0x3d')][_0x8f25('0x3d')]),'bodyTitle':_0x282f21[_0x8f25('0xd1')]});return db[_0x8f25('0xd2')][_0x8f25('0x5d')]({'body':_0x189ea8,'ContactId':_0x1c5f1d['id'],'ChatWebsiteId':_0x282f21['id']});}})[_0x8f25('0x1f')](function(_0x43cd02){_0x2b23d2=_0x43cd02;if(_0x18f474[_0x8f25('0x4e')]){var _0x3e76a3=_0x18f474['map'](function(_0x2367a0){return{'name':_0x2367a0[_0x8f25('0xd3')],'basename':_0x2367a0[_0x8f25('0x75')],'type':_0x2367a0[_0x8f25('0xd4')],'ChatOfflineMessageId':_0x43cd02['id']};});_0x366506=_0x3e76a3[_0x8f25('0x42')](_0x1e6cba=>{var _0x1f2269={'filename':_0x1e6cba['name'],'path':path[_0x8f25('0x78')](config['root'],_0x8f25('0xd5'),_0x8f25('0xc6'),'attachments','offline-chat',_0x1e6cba[_0x8f25('0xd6')])};return _0x1f2269;});if(!_0x282f21[_0x8f25('0xd7')]){return db[_0x8f25('0xd8')][_0x8f25('0xd9')](function(_0x43a536){return db[_0x8f25('0xda')][_0x8f25('0xdb')](_0x3e76a3,{'transaction':_0x43a536});});}}})[_0x8f25('0x1f')](function(){if(_0x2b23d2){_0x44ea62=_0x2b23d2;return db[_0x8f25('0xcc')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x8f25('0xdc')],'as':'Smtp','raw':!![]}]});}})[_0x8f25('0x1f')](function(_0x1b8e73){if(_0x1b8e73&&_0x1b8e73['Smtp']&&_0x282f21[_0x8f25('0xdd')]&&_0x282f21[_0x8f25('0xde')]){var _0x5d0689={'tls':{'rejectUnauthorized':![]}};if(_0x1b8e73[_0x8f25('0xdf')][_0x8f25('0xe0')]){_0x5d0689[_0x8f25('0xe0')]=_0x1b8e73[_0x8f25('0xdf')]['service'];}else{_0x5d0689['host']=_0x1b8e73[_0x8f25('0xdf')][_0x8f25('0xe1')];_0x5d0689[_0x8f25('0xe2')]=_0x1b8e73[_0x8f25('0xdf')][_0x8f25('0xe2')];_0x5d0689['secure']=_0x1b8e73[_0x8f25('0xdf')][_0x8f25('0xe3')];}if(_0x1b8e73[_0x8f25('0xdf')][_0x8f25('0xe4')]){_0x5d0689[_0x8f25('0xe5')]={'user':_0x1b8e73[_0x8f25('0xdf')][_0x8f25('0x5e')],'pass':_0x1b8e73[_0x8f25('0xdf')][_0x8f25('0xe6')]};}return respondWithRpcPromise('SendMail',_0x8f25('0xe7'),{'account':_0x5d0689,'message':{'from':util['format'](_0x8f25('0xe8'),_0x1b8e73[_0x8f25('0x39')],_0x1b8e73['email']||_0x1b8e73[_0x8f25('0xdf')][_0x8f25('0x5e')]),'to':_0x282f21[_0x8f25('0xde')],'subject':_0x282f21[_0x8f25('0xe9')],'html':_0x44ea62['body'],'attachments':_0x366506}},client9003)[_0x8f25('0x1f')](function(){return _0x44ea62;})[_0x8f25('0x2a')](function(_0x194604){console[_0x8f25('0x25')](_0x194604);});}})[_0x8f25('0x1f')](function(){if(_0x282f21&&_0x282f21[_0x8f25('0xd7')]&&_0x282f21[_0x8f25('0xea')]){var _0x871d0a=[];if(_0x18f474[_0x8f25('0x4e')]){_0x871d0a=_0x18f474[_0x8f25('0x42')](function(_0x3b6769){return{'name':_0x3b6769[_0x8f25('0xd3')],'basename':_0x3b6769['filename'],'type':_0x3b6769[_0x8f25('0xd4')],'ChatOfflineMessageId':_0x2b23d2['id']};});}var _0x2a9133;if(!_[_0x8f25('0x7b')](_0x282f21[_0x8f25('0xeb')])){var _0x7d97f6=_['map'](_0x807e30['body'],function(_0x5da4e6){return _0x5da4e6;});var _0x3ba503=_['toPairsIn'](_0x7d97f6)[0x0];var _0x1a4ba8=_[_0x8f25('0xec')](_0x3ba503,function(_0x31d311){return _0x31d311;});_0x2a9133=_0x1a4ba8[0x1][_0x282f21[_0x8f25('0xeb')]];}var _0x233cda={'from':_0x782c32['email'],'firstName':_0x782c32[_0x8f25('0xa5')],'lastName':_0x782c32['lastName'],'mapKey':_0x8f25('0xed'),'message':{'from':_0x782c32[_0x8f25('0xed')],'to':_0x282f21['MailAccount'][_0x8f25('0xed')],'cc':'','subject':_[_0x8f25('0x7b')](_0x2a9133)?_0x282f21[_0x8f25('0xe9')]:_0x2a9133,'messageId':'','sentAt':new Date(),'attach':_0x871d0a[_0x8f25('0x4e')],'attachments':_0x871d0a,'originChannel':_0x8f25('0xee'),'ChatWebsiteId':_0x282f21['id'],'ChatOfflineMessageId':_0x44ea62['id'],'originTo':_0x282f21[_0x8f25('0xcc')][_0x8f25('0xed')]},'body':_0x44ea62[_0x8f25('0x3d')]};var _0x354ef3={'account':{'id':_0x282f21[_0x8f25('0xea')]},'body':_0x233cda,'log':_0x8f25('0xef')};return respondWithRpcPromise(_0x8f25('0xef'),'notifyMail',_0x354ef3,client9001)[_0x8f25('0x1f')](function(){return _0x44ea62;})[_0x8f25('0x2a')](function(_0x4953cf){console[_0x8f25('0x25')](_0x4953cf);});}return;})[_0x8f25('0x1f')](function(){if(_0x44ea62){return _0x44ea62;}})[_0x8f25('0x1f')](respondWithResult(_0x342f2b,null))[_0x8f25('0x2a')](function(_0x22644d){console['error'](_0x8f25('0x2a'),_0x22644d);for(var _0x2a49f7 of _0x18f474){var _0x45c8c7=path[_0x8f25('0x78')](config[_0x8f25('0x7d')],_0x8f25('0xd5'),'files','attachments','offline-chat',_0x2a49f7[_0x8f25('0x75')]);fs_extra[_0x8f25('0xf0')](_0x45c8c7)[_0x8f25('0x2a')](function(_0x554f8c){console[_0x8f25('0x25')]('Could\x20not\x20remove\x20attachment\x20file',_0x45c8c7,_0x554f8c);});}});};exports['addInteraction']=function(_0x25020e,_0x38dfa7,_0xafa32c){return db[_0x8f25('0xb1')][_0x8f25('0x5c')]({'where':{'id':_0x25020e['params']['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x38dfa7,null))[_0x8f25('0x1f')](function(_0x5ed6de){if(_0x5ed6de){return _0x5ed6de[_0x8f25('0xf1')](_0x25020e[_0x8f25('0x3d')][_0x8f25('0x6c')],_[_0x8f25('0xf2')](_0x25020e['body'],[_0x8f25('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x38dfa7,null))[_0x8f25('0x2a')](handleError(_0x38dfa7,null));};exports[_0x8f25('0xf3')]=function(_0xb64585,_0x3da399,_0x123162){var _0x464c07={'raw':![],'where':{}};var _0x4f4bb2={};var _0x296497={'count':0x0,'rows':[]};return db[_0x8f25('0x43')][_0x8f25('0x67')]({'where':{'id':_0xb64585[_0x8f25('0x58')]['id']}})['then'](handleEntityNotFound(_0x3da399,null))['then'](function(_0x5e2604){if(_0x5e2604){_0x4f4bb2[_0x8f25('0x47')]=_[_0x8f25('0x48')](db['ChatInteraction'][_0x8f25('0x44')]);_0x4f4bb2[_0x8f25('0x49')]=_[_0x8f25('0x48')](_0xb64585[_0x8f25('0x49')]);_0x4f4bb2[_0x8f25('0x4a')]=_[_0x8f25('0x4b')](_0x4f4bb2[_0x8f25('0x47')],_0x4f4bb2['query']);_0x464c07[_0x8f25('0x4c')]=_['intersection'](_0x4f4bb2[_0x8f25('0x47')],qs[_0x8f25('0x4d')](_0xb64585['query']['fields']));_0x464c07[_0x8f25('0x4c')]=_0x464c07[_0x8f25('0x4c')][_0x8f25('0x4e')]?_0x464c07[_0x8f25('0x4c')]:_0x4f4bb2[_0x8f25('0x47')];if(!_0xb64585['query']['hasOwnProperty'](_0x8f25('0x50'))){_0x464c07[_0x8f25('0x2f')]=qs[_0x8f25('0x2f')](_0xb64585[_0x8f25('0x49')][_0x8f25('0x2f')]);_0x464c07['offset']=qs['offset'](_0xb64585[_0x8f25('0x49')][_0x8f25('0x2e')]);}_0x464c07['order']=qs['sort'](_0xb64585[_0x8f25('0x49')]['sort']);_0x464c07[_0x8f25('0x52')]=qs[_0x8f25('0x4a')](_[_0x8f25('0x53')](_0xb64585[_0x8f25('0x49')],_0x4f4bb2[_0x8f25('0x4a')]));_0x464c07[_0x8f25('0x52')][_0x8f25('0x69')]=_0x5e2604['id'];if(_0xb64585['query']['filter']){_0x464c07[_0x8f25('0x52')]=_[_0x8f25('0x3c')](_0x464c07[_0x8f25('0x52')],{'$or':_['map'](_0x464c07[_0x8f25('0x4c')],function(_0x33dce0){var _0xc6518={};_0xc6518[_0x33dce0]={'$like':'%'+_0xb64585[_0x8f25('0x49')]['filter']+'%'};return _0xc6518;})});}_0x464c07=_[_0x8f25('0x3c')]({},_0x464c07,_0xb64585[_0x8f25('0x55')]);return db[_0x8f25('0xb1')]['count']({'where':_0x464c07['where']})['then'](function(_0x2fa82f){_0x296497['count']=_0x2fa82f;if(_0xb64585[_0x8f25('0x49')][_0x8f25('0x5a')]){_0x464c07[_0x8f25('0x5b')]=[{'model':db['CmContact'],'as':_0x8f25('0xf4'),'required':![]},{'model':db[_0x8f25('0xbf')],'as':_0x8f25('0xf5'),'attributes':[_0x8f25('0x39'),_0x8f25('0xf6'),_0x8f25('0xf7')],'required':![]},{'model':db[_0x8f25('0xf8')],'as':_0x8f25('0xf9'),'attributes':['id','name',_0x8f25('0xfa')],'where':_0xb64585['query'][_0x8f25('0xfb')]?{'id':_0xb64585['query']['tag']}:undefined,'required':_0xb64585['query'][_0x8f25('0xfb')]?!![]:![]}];}return db[_0x8f25('0xb1')][_0x8f25('0x6a')](_0x464c07);})[_0x8f25('0x1f')](function(_0x46573e){_0x296497[_0x8f25('0x56')]=_0x46573e;return _0x296497;});}})[_0x8f25('0x1f')](respondWithFilteredResult(_0x3da399,_0x464c07))[_0x8f25('0x2a')](handleError(_0x3da399,null));};function iftimePromise(_0x7e5b28,_0x32659f){return respondWithRpcPromise(_0x8f25('0xfc'),_0x8f25('0xfd'),{'command':_0x32659f[_0x8f25('0xfe')]?util[_0x8f25('0xad')]('iftime\x20%s,%s',_0x7e5b28[_0x8f25('0xff')],_0x32659f[_0x8f25('0xfe')]):util[_0x8f25('0xad')](_0x8f25('0x100'),_0x7e5b28[_0x8f25('0xff')])},client9002)['then'](function(_0x4e3dd4){var _0x5fa412=_0x4e3dd4&&_0x4e3dd4['indexOf'](_0x8f25('0x101'))>=0x0?!![]:![];logger[_0x8f25('0x20')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x32659f['id'],_0x7e5b28['id'],_0x7e5b28[_0x8f25('0xff')],_0x5fa412?_0x8f25('0x102'):_0x8f25('0x103'),_0x32659f[_0x8f25('0xfe')]?_0x32659f[_0x8f25('0xfe')]:'No\x20timezone');return _0x5fa412;})[_0x8f25('0x2a')](function(_0x5db1b3){logger[_0x8f25('0x25')](_0x8f25('0x104'),_0x32659f['id'],_0x7e5b28['id'],_0x7e5b28['interval'],util[_0x8f25('0x105')](_0x5db1b3,{'showHidden':![],'depth':null}),_0x32659f[_0x8f25('0xfe')]?_0x32659f[_0x8f25('0xfe')]:_0x8f25('0x106'));return![];});}exports[_0x8f25('0xfd')]=function(_0x465238,_0x345ceb,_0x5cb447){var _0x41f38f=0x0;var _0xb876f=0x0;var _0xf50902=![];var _0x57e6d6;var _0x15df94;return db[_0x8f25('0x43')][_0x8f25('0x5c')]({'where':{'id':_0x465238[_0x8f25('0x58')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db['Interval'],'as':_0x8f25('0x107'),'attributes':['id',_0x8f25('0xff')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x345ceb,null))[_0x8f25('0x1f')](function(_0x425602){if(_0x425602){_0x57e6d6=_0x425602;return _0x425602[_0x8f25('0x108')]({'raw':!![]});}})[_0x8f25('0x1f')](function(_0x929e0d){if(_0x57e6d6){if(_0x929e0d){_0x15df94=_0x929e0d;}}return require('../../config/license/util')['getLicense']();})[_0x8f25('0x1f')](function(_0x150934){if(_0x150934){_0xb876f=_0x150934[_0x8f25('0x109')];_0xf50902=_0x150934[_0x8f25('0x10a')];}})[_0x8f25('0x1f')](function(){return db[_0x8f25('0xb1')]['count']({'where':{'closed':![]}});})['then'](function(_0xf75a33){_0x41f38f=_0xf75a33;if(_0xb876f&&_0xf75a33>_0xb876f){return db[_0x8f25('0x10b')][_0x8f25('0x67')]({'where':{'id':0x1}})[_0x8f25('0x1f')](function(_0xe7a991){if(_0xe7a991){_0xe7a991[_0x8f25('0x10c')](_0x8f25('0x10d'));}});}})[_0x8f25('0x1f')](function(){if(_0x57e6d6[_0x8f25('0x10e')]&&_0x57e6d6[_0x8f25('0x10e')]['Intervals']){var _0x222a73=[];for(var _0x482706=0x0;_0x482706<_0x57e6d6[_0x8f25('0x10e')][_0x8f25('0x107')][_0x8f25('0x4e')];_0x482706++){var _0x1eb4fa=_0x57e6d6[_0x8f25('0x10e')][_0x8f25('0x107')][_0x482706][_0x8f25('0x34')]({'plain':!![]});_0x222a73[_0x8f25('0xb8')](iftimePromise(_0x1eb4fa,_0x57e6d6));}return BPromise[_0x8f25('0x10f')](_0x222a73)[_0x8f25('0x1f')](function(_0xf3d973){return _[_0x8f25('0x110')](_0xf3d973);});}else{return!![];}})[_0x8f25('0x1f')](function(_0x2d960b){var _0x228866=fs[_0x8f25('0xce')](path['join'](config[_0x8f25('0x7d')],_0x8f25('0x111')),_0x8f25('0xd0'));var _0x2656ba={'remote':_0x57e6d6[_0x8f25('0x112')],'query':querystring[_0x8f25('0x24')](_[_0x8f25('0x3c')](_0x57e6d6['get']({'plain':!![]}),{'customerIp':_0x465238['headers']['x-forwarded-for']||_0x465238[_0x8f25('0x89')][_0x8f25('0x113')]||_0x465238['connection'][_0x8f25('0x114')]||_0x465238['ip'],'referer':_0x465238[_0x8f25('0x89')][_0x8f25('0xa8')],'openedInteractions':_0x41f38f,'maxInteractions':_0xb876f,'virtual':_0xf50902[_0x8f25('0x109')],'online':_0x2d960b,'custom':_0xf50902}))[_0x8f25('0x115')](/'/g,'\x5c\x27')};_0x345ceb['send'](ejs['render'](Mustache[_0x8f25('0x3b')](_0x228866,_0x2656ba),{'proactiveActions':_0x15df94,'alignment':_0x57e6d6[_0x8f25('0x116')],'verticalAlignment':_0x57e6d6[_0x8f25('0x117')],'div_color':_0x57e6d6[_0x8f25('0xfa')],'text_color':_0x57e6d6[_0x8f25('0x118')],'button_color':_0x57e6d6[_0x8f25('0x119')],'background_color':_0x57e6d6[_0x8f25('0x11a')]}));})[_0x8f25('0x2a')](handleError(_0x345ceb,null));};exports['addApplications']=function(_0x28b627,_0x15ef4d,_0x2b228c){return db[_0x8f25('0x43')][_0x8f25('0x67')]({'where':{'id':_0x28b627[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x15ef4d,null))[_0x8f25('0x1f')](function(_0x27707c){if(_0x27707c){return db[_0x8f25('0xd8')][_0x8f25('0xd9')](function(_0x5bb95b){return db[_0x8f25('0x11b')]['destroy']({'where':{'ChatWebsiteId':_0x28b627[_0x8f25('0x58')]['id']},'transaction':_0x5bb95b})[_0x8f25('0x1f')](function(_0x35c61e){var _0xea0153=_[_0x8f25('0x42')](_0x28b627[_0x8f25('0x3d')],function(_0x2c59a9){_0x2c59a9[_0x8f25('0x69')]=_0x28b627[_0x8f25('0x58')]['id'];return _0x2c59a9;});return db[_0x8f25('0x11b')]['bulkCreate'](_0xea0153,{'transaction':_0x5bb95b});});})[_0x8f25('0x1f')](function(){return db['ChatApplication'][_0x8f25('0x11c')]({'where':{'ChatWebsiteId':_0x28b627[_0x8f25('0x58')]['id']},'order':_0x8f25('0x9f')});});}})[_0x8f25('0x1f')](respondWithResult(_0x15ef4d,null))[_0x8f25('0x2a')](handleError(_0x15ef4d,null));};exports[_0x8f25('0x11d')]=function(_0x32c79c,_0x34932e,_0x10fce7){var _0x3dca9c={};var _0x428de6={};var _0x303fb9;var _0x5363e1;return db[_0x8f25('0x43')]['findOne']({'where':{'id':_0x32c79c[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x34932e,null))[_0x8f25('0x1f')](function(_0x615fee){if(_0x615fee){_0x303fb9=_0x615fee;_0x428de6[_0x8f25('0x47')]=_[_0x8f25('0x48')](db['ChatApplication'][_0x8f25('0x44')]);_0x428de6[_0x8f25('0x49')]=_[_0x8f25('0x48')](_0x32c79c[_0x8f25('0x49')]);_0x428de6[_0x8f25('0x4a')]=_[_0x8f25('0x4b')](_0x428de6[_0x8f25('0x47')],_0x428de6[_0x8f25('0x49')]);_0x3dca9c['attributes']=_[_0x8f25('0x4b')](_0x428de6[_0x8f25('0x47')],qs['fields'](_0x32c79c[_0x8f25('0x49')][_0x8f25('0x4d')]));_0x3dca9c[_0x8f25('0x4c')]=_0x3dca9c['attributes']['length']?_0x3dca9c[_0x8f25('0x4c')]:_0x428de6[_0x8f25('0x47')];_0x3dca9c[_0x8f25('0x68')]=qs['sort'](_0x32c79c['query'][_0x8f25('0x51')]);_0x3dca9c[_0x8f25('0x52')]=qs[_0x8f25('0x4a')](_[_0x8f25('0x53')](_0x32c79c['query'],_0x428de6[_0x8f25('0x4a')]));if(_0x32c79c[_0x8f25('0x49')]['filter']){_0x3dca9c[_0x8f25('0x52')]=_[_0x8f25('0x3c')](_0x3dca9c[_0x8f25('0x52')],{'$or':_[_0x8f25('0x42')](_0x3dca9c[_0x8f25('0x4c')],function(_0x2513c6){var _0x2db249={};_0x2db249[_0x2513c6]={'$like':'%'+_0x32c79c['query'][_0x8f25('0x54')]+'%'};return _0x2db249;})});}_0x3dca9c=_['merge']({},_0x3dca9c,_0x32c79c['options']);return _0x303fb9[_0x8f25('0x11d')](_0x3dca9c);}})[_0x8f25('0x1f')](function(_0x2d4ac8){if(_0x2d4ac8){_0x5363e1=_0x2d4ac8[_0x8f25('0x4e')];if(!_0x32c79c[_0x8f25('0x49')][_0x8f25('0x4f')](_0x8f25('0x50'))){_0x3dca9c['limit']=qs[_0x8f25('0x2f')](_0x32c79c[_0x8f25('0x49')][_0x8f25('0x2f')]);_0x3dca9c[_0x8f25('0x2e')]=qs[_0x8f25('0x2e')](_0x32c79c[_0x8f25('0x49')]['offset']);}return _0x303fb9[_0x8f25('0x11d')](_0x3dca9c);}})[_0x8f25('0x1f')](function(_0x304c4a){if(_0x304c4a){return _0x304c4a?{'count':_0x5363e1,'rows':_0x304c4a}:null;}})['then'](respondWithResult(_0x34932e,null))[_0x8f25('0x2a')](handleError(_0x34932e,null));};exports[_0x8f25('0x11e')]=function(_0x35b83a,_0x5d9a7c,_0x331206){return db[_0x8f25('0x11f')][_0x8f25('0x5c')]({'where':{'id':_0x35b83a[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x5d9a7c,null))['then'](function(_0x219a6e){if(_0x219a6e){return _0x219a6e[_0x8f25('0x11e')](_0x35b83a[_0x8f25('0x3d')][_0x8f25('0x6c')],_[_0x8f25('0xf2')](_0x35b83a[_0x8f25('0x3d')],[_0x8f25('0x6c'),'id'])||{});}})[_0x8f25('0x1f')](respondWithResult(_0x5d9a7c,null))['catch'](handleError(_0x5d9a7c,null));};exports['getProactiveActions']=function(_0x3c00e7,_0x5aff06,_0x1572cc){var _0x3aadf9={};var _0xc9f9b={};var _0x5203b3;var _0x2029d6;return db[_0x8f25('0x43')][_0x8f25('0x67')]({'where':{'id':_0x3c00e7['params']['id']}})['then'](handleEntityNotFound(_0x5aff06,null))[_0x8f25('0x1f')](function(_0x2bfc20){if(_0x2bfc20){_0x5203b3=_0x2bfc20;_0xc9f9b[_0x8f25('0x47')]=_['keys'](db['ChatProactiveAction'][_0x8f25('0x44')]);_0xc9f9b[_0x8f25('0x49')]=_[_0x8f25('0x48')](_0x3c00e7[_0x8f25('0x49')]);_0xc9f9b['filters']=_['intersection'](_0xc9f9b[_0x8f25('0x47')],_0xc9f9b[_0x8f25('0x49')]);_0x3aadf9[_0x8f25('0x4c')]=_[_0x8f25('0x4b')](_0xc9f9b[_0x8f25('0x47')],qs['fields'](_0x3c00e7[_0x8f25('0x49')][_0x8f25('0x4d')]));_0x3aadf9[_0x8f25('0x4c')]=_0x3aadf9[_0x8f25('0x4c')][_0x8f25('0x4e')]?_0x3aadf9[_0x8f25('0x4c')]:_0xc9f9b['model'];_0x3aadf9[_0x8f25('0x68')]=qs['sort'](_0x3c00e7[_0x8f25('0x49')][_0x8f25('0x51')]);_0x3aadf9[_0x8f25('0x52')]=qs[_0x8f25('0x4a')](_[_0x8f25('0x53')](_0x3c00e7[_0x8f25('0x49')],_0xc9f9b[_0x8f25('0x4a')]));if(_0x3c00e7[_0x8f25('0x49')][_0x8f25('0x54')]){_0x3aadf9[_0x8f25('0x52')]=_[_0x8f25('0x3c')](_0x3aadf9[_0x8f25('0x52')],{'$or':_[_0x8f25('0x42')](_0x3aadf9[_0x8f25('0x4c')],function(_0x3e8518){var _0x3cf0d5={};_0x3cf0d5[_0x3e8518]={'$like':'%'+_0x3c00e7[_0x8f25('0x49')]['filter']+'%'};return _0x3cf0d5;})});}_0x3aadf9=_[_0x8f25('0x3c')]({},_0x3aadf9,_0x3c00e7[_0x8f25('0x55')]);return _0x5203b3['getProactiveActions'](_0x3aadf9);}})[_0x8f25('0x1f')](function(_0xb98347){if(_0xb98347){_0x2029d6=_0xb98347[_0x8f25('0x4e')];if(!_0x3c00e7[_0x8f25('0x49')][_0x8f25('0x4f')]('nolimit')){_0x3aadf9[_0x8f25('0x2f')]=qs[_0x8f25('0x2f')](_0x3c00e7[_0x8f25('0x49')][_0x8f25('0x2f')]);_0x3aadf9['offset']=qs[_0x8f25('0x2e')](_0x3c00e7[_0x8f25('0x49')][_0x8f25('0x2e')]);}return _0x5203b3[_0x8f25('0x108')](_0x3aadf9);}})[_0x8f25('0x1f')](function(_0x36ff65){if(_0x36ff65){return _0x36ff65?{'count':_0x2029d6,'rows':_0x36ff65}:null;}})['then'](respondWithResult(_0x5aff06,null))[_0x8f25('0x2a')](handleError(_0x5aff06,null));};exports[_0x8f25('0x120')]=function(_0x24b06d,_0x57e562,_0x4cc21d){var _0x53fe36=_0x24b06d[_0x8f25('0x49')]['online']==='false'?_0x8f25('0x121'):_0x8f25('0x122');return db[_0x8f25('0x43')]['find']({'attributes':['id',_0x53fe36],'where':{'id':_0x24b06d[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x57e562,null))[_0x8f25('0x1f')](function(_0x145a8d){if(_0x145a8d){var _0x5971bd=_0x145a8d[_0x53fe36];var _0x4eec31=_0x5971bd&&_0x5971bd[_0x8f25('0x123')]?_0x5971bd[_0x8f25('0x123')]:[];_0x57e562[_0x8f25('0x3a')]({'fromKey':_[_0x8f25('0x7b')](_0x5971bd[_0x8f25('0x124')])?undefined:_0x5971bd['fromKey'],'count':_0x4eec31['length'],'rows':_0x4eec31});}})[_0x8f25('0x2a')](handleError(_0x57e562,null));};exports[_0x8f25('0x125')]=function(_0xaafce6,_0x2a6d42,_0x43fee6){var _0x50eb58={'raw':![],'where':{}};var _0x5637b2={};var _0x2c664c={'count':0x0,'rows':[]};return db[_0x8f25('0x43')][_0x8f25('0x67')]({'where':{'id':_0xaafce6[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x2a6d42,null))['then'](function(_0x1d3b2a){if(_0x1d3b2a){_0x5637b2['model']=_[_0x8f25('0x48')](db[_0x8f25('0xd2')][_0x8f25('0x44')]);_0x5637b2['query']=_[_0x8f25('0x48')](_0xaafce6[_0x8f25('0x49')]);_0x5637b2[_0x8f25('0x4a')]=_[_0x8f25('0x4b')](_0x5637b2[_0x8f25('0x47')],_0x5637b2[_0x8f25('0x49')]);_0x50eb58[_0x8f25('0x4c')]=_['intersection'](_0x5637b2[_0x8f25('0x47')],qs[_0x8f25('0x4d')](_0xaafce6[_0x8f25('0x49')][_0x8f25('0x4d')]));_0x50eb58[_0x8f25('0x4c')]=_0x50eb58['attributes']['length']?_0x50eb58[_0x8f25('0x4c')]:_0x5637b2[_0x8f25('0x47')];if(!_0xaafce6[_0x8f25('0x49')][_0x8f25('0x4f')](_0x8f25('0x50'))){_0x50eb58['limit']=qs[_0x8f25('0x2f')](_0xaafce6[_0x8f25('0x49')][_0x8f25('0x2f')]);_0x50eb58['offset']=qs[_0x8f25('0x2e')](_0xaafce6[_0x8f25('0x49')][_0x8f25('0x2e')]);}_0x50eb58['order']=qs[_0x8f25('0x51')](_0xaafce6[_0x8f25('0x49')][_0x8f25('0x51')]);_0x50eb58[_0x8f25('0x52')]=qs[_0x8f25('0x4a')](_['pick'](_0xaafce6[_0x8f25('0x49')],_0x5637b2[_0x8f25('0x4a')]));_0x50eb58[_0x8f25('0x52')][_0x8f25('0x69')]=_0x1d3b2a['id'];if(_0xaafce6[_0x8f25('0x49')]['filter']){_0x50eb58['where']=_['merge'](_0x50eb58['where'],{'$or':_[_0x8f25('0x42')](_0x50eb58[_0x8f25('0x4c')],function(_0x18313b){var _0x211a48={};_0x211a48[_0x18313b]={'$like':'%'+_0xaafce6[_0x8f25('0x49')]['filter']+'%'};return _0x211a48;})});}_0x50eb58=_['merge']({},_0x50eb58,_0xaafce6['options']);return db[_0x8f25('0xd2')]['count']({'where':_0x50eb58[_0x8f25('0x52')]})[_0x8f25('0x1f')](function(_0x5eab51){_0x2c664c[_0x8f25('0x30')]=_0x5eab51;if(_0xaafce6[_0x8f25('0x49')]['includeAll']){_0x50eb58[_0x8f25('0x5b')]=[{'all':!![]}];}else{_0x50eb58[_0x8f25('0x5b')]=[{'model':db[_0x8f25('0x8b')],'as':_0x8f25('0xf4'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x8f25('0x6a')](_0x50eb58);})['then'](function(_0x1a786a){_0x2c664c[_0x8f25('0x56')]=_0x1a786a;return _0x2c664c;});}})['then'](respondWithFilteredResult(_0x2a6d42,_0x50eb58))[_0x8f25('0x2a')](handleError(_0x2a6d42,null));};exports[_0x8f25('0x126')]=function(_0x4c1349,_0x4eea0d,_0x2d047f){return db[_0x8f25('0x43')]['find']({'where':{'id':_0x4c1349['params']['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x4eea0d,null))[_0x8f25('0x1f')](function(_0x331975){if(_0x331975){return _0x331975[_0x8f25('0x126')](_0x4c1349[_0x8f25('0x3d')]['ids'],_[_0x8f25('0xf2')](_0x4c1349['body'],[_0x8f25('0x6c'),'id'])||{})[_0x8f25('0xb4')](function(_0x1d014b){for(var _0x4aeb09=0x0;_0x4aeb09<_0x4c1349[_0x8f25('0x3d')][_0x8f25('0x6c')][_0x8f25('0x4e')];_0x4aeb09+=0x1){socket[_0x8f25('0x127')](_0x8f25('0x128'),{'UserId':_0x4c1349['body'][_0x8f25('0x6c')][_0x4aeb09],'ChatWebsiteId':_0x4c1349[_0x8f25('0x58')]['id']});}return _0x1d014b;});}})['then'](respondWithResult(_0x4eea0d,null))[_0x8f25('0x2a')](handleError(_0x4eea0d,null));};exports[_0x8f25('0x129')]=function(_0x3e1fed,_0x5b3ada,_0x3ca2f0){return db['ChatWebsite'][_0x8f25('0x5c')]({'where':{'id':_0x3e1fed[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x5b3ada,null))['then'](function(_0x4494eb){if(_0x4494eb){return _0x4494eb[_0x8f25('0x129')](_0x3e1fed[_0x8f25('0x49')][_0x8f25('0x6c')])[_0x8f25('0x1f')](function(){if(_['isArray'](_0x3e1fed[_0x8f25('0x49')][_0x8f25('0x6c')])){for(var _0x215553=0x0;_0x215553<_0x3e1fed[_0x8f25('0x49')][_0x8f25('0x6c')]['length'];_0x215553+=0x1){socket[_0x8f25('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x3e1fed[_0x8f25('0x49')][_0x8f25('0x6c')][_0x215553]),'ChatWebsiteId':Number(_0x3e1fed['params']['id'])});}}else{socket[_0x8f25('0x127')](_0x8f25('0x12a'),{'UserId':Number(_0x3e1fed[_0x8f25('0x49')][_0x8f25('0x6c')]),'ChatWebsiteId':Number(_0x3e1fed['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5b3ada,null))['catch'](handleError(_0x5b3ada,null));};exports[_0x8f25('0x12b')]=function(_0x5463c5,_0x46cb6c,_0x867fc8){var _0x5b29a8={};var _0x3928e4={};var _0x21ee90;var _0x2bd2f2;return db[_0x8f25('0x43')][_0x8f25('0x67')]({'where':{'id':_0x5463c5[_0x8f25('0x58')]['id']}})[_0x8f25('0x1f')](handleEntityNotFound(_0x46cb6c,null))[_0x8f25('0x1f')](function(_0x6ce54c){if(_0x6ce54c){_0x21ee90=_0x6ce54c;_0x3928e4[_0x8f25('0x47')]=_['keys'](db[_0x8f25('0xbf')][_0x8f25('0x44')]);_0x3928e4['query']=_[_0x8f25('0x48')](_0x5463c5[_0x8f25('0x49')]);_0x3928e4['filters']=_[_0x8f25('0x4b')](_0x3928e4[_0x8f25('0x47')],_0x3928e4[_0x8f25('0x49')]);_0x5b29a8[_0x8f25('0x4c')]=_['intersection'](_0x3928e4['model'],qs[_0x8f25('0x4d')](_0x5463c5[_0x8f25('0x49')][_0x8f25('0x4d')]));_0x5b29a8['attributes']=_0x5b29a8[_0x8f25('0x4c')][_0x8f25('0x4e')]?_0x5b29a8['attributes']:_0x3928e4['model'];_0x5b29a8[_0x8f25('0x68')]=qs['sort'](_0x5463c5[_0x8f25('0x49')]['sort']);_0x5b29a8[_0x8f25('0x52')]=qs[_0x8f25('0x4a')](_['pick'](_0x5463c5[_0x8f25('0x49')],_0x3928e4[_0x8f25('0x4a')]));if(_0x5463c5['query'][_0x8f25('0x54')]){_0x5b29a8['where']=_[_0x8f25('0x3c')](_0x5b29a8[_0x8f25('0x52')],{'$or':_[_0x8f25('0x42')](_0x5b29a8['attributes'],function(_0x4882e6){var _0x28b1a6={};_0x28b1a6[_0x4882e6]={'$like':'%'+_0x5463c5[_0x8f25('0x49')][_0x8f25('0x54')]+'%'};return _0x28b1a6;})});}_0x5b29a8=_[_0x8f25('0x3c')]({},_0x5b29a8,_0x5463c5[_0x8f25('0x55')]);return _0x21ee90['getAgents'](_0x5b29a8);}})[_0x8f25('0x1f')](function(_0x159af2){if(_0x159af2){_0x2bd2f2=_0x159af2[_0x8f25('0x4e')];if(!_0x5463c5[_0x8f25('0x49')]['hasOwnProperty'](_0x8f25('0x50'))){_0x5b29a8['limit']=qs[_0x8f25('0x2f')](_0x5463c5[_0x8f25('0x49')][_0x8f25('0x2f')]);_0x5b29a8[_0x8f25('0x2e')]=qs[_0x8f25('0x2e')](_0x5463c5[_0x8f25('0x49')][_0x8f25('0x2e')]);}return _0x21ee90['getAgents'](_0x5b29a8);}})[_0x8f25('0x1f')](function(_0x393380){if(_0x393380){return _0x393380?{'count':_0x2bd2f2,'rows':_0x393380}:null;}})['then'](respondWithResult(_0x46cb6c,null))[_0x8f25('0x2a')](handleError(_0x46cb6c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 21d6094..bc196b6 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 _0x3074=['save','remove','emit','hasOwnProperty','exports','events','ChatWebsite','setMaxListeners'];(function(_0x1ff4ec,_0xf218c){var _0x2b4634=function(_0x3dfec7){while(--_0x3dfec7){_0x1ff4ec['push'](_0x1ff4ec['shift']());}};_0x2b4634(++_0xf218c);}(_0x3074,0x1dd));var _0x4307=function(_0x51c5b7,_0x37cb6b){_0x51c5b7=_0x51c5b7-0x0;var _0x421479=_0x3074[_0x51c5b7];return _0x421479;};'use strict';var EventEmitter=require(_0x4307('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x4307('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4307('0x2')](0x0);var events={'afterCreate':_0x4307('0x3'),'afterUpdate':'update','afterDestroy':_0x4307('0x4')};function emitEvent(_0x5c5161){return function(_0x256692,_0x31bf86,_0x5a2543){ChatWebsiteEvents[_0x4307('0x5')](_0x5c5161+':'+_0x256692['id'],_0x256692);ChatWebsiteEvents[_0x4307('0x5')](_0x5c5161,_0x256692);_0x5a2543(null);};}for(var e in events){if(events[_0x4307('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x4307('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x3051=['remove','emit','hasOwnProperty','hook','exports','setMaxListeners','save','update'];(function(_0x744633,_0x4a120b){var _0x1965c7=function(_0x1c7ba3){while(--_0x1c7ba3){_0x744633['push'](_0x744633['shift']());}};_0x1965c7(++_0x4a120b);}(_0x3051,0x85));var _0x1305=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3051[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1305('0x0')](0x0);var events={'afterCreate':_0x1305('0x1'),'afterUpdate':_0x1305('0x2'),'afterDestroy':_0x1305('0x3')};function emitEvent(_0x57aaab){return function(_0x535fb7,_0x1fcf8f,_0x84b3ee){ChatWebsiteEvents[_0x1305('0x4')](_0x57aaab+':'+_0x535fb7['id'],_0x535fb7);ChatWebsiteEvents[_0x1305('0x4')](_0x57aaab,_0x535fb7);_0x84b3ee(null);};}for(var e in events){if(events[_0x1305('0x5')](e)){var event=events[e];ChatWebsite[_0x1305('0x6')](e,emitEvent(event));}}module[_0x1305('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d67bf8a..7a3271f 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 _0x3eec=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','bluebird'];(function(_0x55c00d,_0x520cb6){var _0x254a8f=function(_0x2b3378){while(--_0x2b3378){_0x55c00d['push'](_0x55c00d['shift']());}};_0x254a8f(++_0x520cb6);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x3718a3,_0x664e09){_0x3718a3=_0x3718a3-0x0;var _0xd538e6=_0x3eec[_0x3718a3];return _0xd538e6;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var logger=require(_0xc3ee('0x2'))(_0xc3ee('0x3'));var moment=require('moment');var BPromise=require(_0xc3ee('0x4'));var rp=require(_0xc3ee('0x5'));var fs=require('fs');var path=require(_0xc3ee('0x6'));var rimraf=require(_0xc3ee('0x7'));var config=require(_0xc3ee('0x8'));var attributes=require(_0xc3ee('0x9'));module['exports']=function(_0x471de7,_0xbd5b6){return _0x471de7[_0xc3ee('0xa')](_0xc3ee('0xb'),attributes,{'tableName':_0xc3ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde2c=['api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xde2c,0x7f));var _0xcde2=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0xde2c[_0x72a33d];return _0x2621d5;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var moment=require(_0xcde2('0x4'));var BPromise=require(_0xcde2('0x5'));var rp=require(_0xcde2('0x6'));var fs=require('fs');var path=require(_0xcde2('0x7'));var rimraf=require('rimraf');var config=require(_0xcde2('0x8'));var attributes=require(_0xcde2('0x9'));module[_0xcde2('0xa')]=function(_0x1398de,_0x401b16){return _0x1398de['define'](_0xcde2('0xb'),attributes,{'tableName':_0xcde2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index da0b708..f2a5e36 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 _0x187d=['stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x273f65,_0x3bb05d){var _0x1b8eae=function(_0x36ae2d){while(--_0x36ae2d){_0x273f65['push'](_0x273f65['shift']());}};_0x1b8eae(++_0x3bb05d);}(_0x187d,0x93));var _0xd187=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x187d[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});config[_0xd187('0xb')]=_[_0xd187('0xc')](config[_0xd187('0xb')],{'host':_0xd187('0xd'),'port':0x18eb});var socket=require(_0xd187('0xe'))(new Redis(config[_0xd187('0xb')]));require('./chatWebsite.socket')[_0xd187('0xf')](socket);function respondWithRpcPromise(_0x42848b,_0x4039f6,_0x473866){return new BPromise(function(_0x33ca45,_0x2a61a4){return client['request'](_0x42848b,_0x473866)[_0xd187('0x10')](function(_0x412ccf){logger[_0xd187('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x4039f6,_0xd187('0x12'));logger[_0xd187('0x13')](_0xd187('0x14'),_0x4039f6,'request\x20sent',JSON[_0xd187('0x15')](_0x412ccf));if(_0x412ccf[_0xd187('0x16')]){if(_0x412ccf[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger['error'](_0xd187('0x18'),_0x4039f6,_0x412ccf[_0xd187('0x16')][_0xd187('0x19')]);return _0x2a61a4(_0x412ccf[_0xd187('0x16')]['message']);}logger[_0xd187('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x4039f6,_0x412ccf['error'][_0xd187('0x19')]);return _0x33ca45(_0x412ccf['error']['message']);}else{logger[_0xd187('0x11')](_0xd187('0x18'),_0x4039f6,_0xd187('0x12'));_0x33ca45(_0x412ccf[_0xd187('0x1a')][_0xd187('0x19')]);}})[_0xd187('0x1b')](function(_0x12b388){logger[_0xd187('0x16')](_0xd187('0x18'),_0x4039f6,_0x12b388);_0x2a61a4(_0x12b388);});});} \ No newline at end of file +var _0x524e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment'];(function(_0x45319d,_0x5a0653){var _0x20f076=function(_0x3da82c){while(--_0x3da82c){_0x45319d['push'](_0x45319d['shift']());}};_0x20f076(++_0x5a0653);}(_0x524e,0x15e));var _0xe524=function(_0x1c1904,_0x429424){_0x1c1904=_0x1c1904-0x0;var _0x4a9de9=_0x524e[_0x1c1904];return _0x4a9de9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});config[_0xe524('0xb')]=_[_0xe524('0xc')](config['redis'],{'host':_0xe524('0xd'),'port':0x18eb});var socket=require(_0xe524('0xe'))(new Redis(config[_0xe524('0xb')]));require(_0xe524('0xf'))[_0xe524('0x10')](socket);function respondWithRpcPromise(_0x4082b1,_0x1a08e2,_0xb3eb9f){return new BPromise(function(_0x1b75bd,_0x1641ec){return client[_0xe524('0x11')](_0x4082b1,_0xb3eb9f)[_0xe524('0x12')](function(_0x1184df){logger[_0xe524('0x13')](_0xe524('0x14'),_0x1a08e2,_0xe524('0x15'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1a08e2,_0xe524('0x15'),JSON[_0xe524('0x16')](_0x1184df));if(_0x1184df[_0xe524('0x17')]){if(_0x1184df[_0xe524('0x17')][_0xe524('0x18')]===0x1f4){logger['error'](_0xe524('0x14'),_0x1a08e2,_0x1184df['error'][_0xe524('0x19')]);return _0x1641ec(_0x1184df[_0xe524('0x17')]['message']);}logger[_0xe524('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1a08e2,_0x1184df[_0xe524('0x17')]['message']);return _0x1b75bd(_0x1184df[_0xe524('0x17')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1a08e2,_0xe524('0x15'));_0x1b75bd(_0x1184df['result'][_0xe524('0x19')]);}})[_0xe524('0x1a')](function(_0x278de9){logger[_0xe524('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1a08e2,_0x278de9);_0x1641ec(_0x278de9);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 131511a..083de1d 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x1460ab,_0x74d06e){var _0x1eeb5c=function(_0x28de38){while(--_0x28de38){_0x1460ab['push'](_0x1460ab['shift']());}};_0x1eeb5c(++_0x74d06e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x446180,_0x1496bc){_0x446180=_0x446180-0x0;var _0x82d27f=_0x5f2f[_0x446180];return _0x82d27f;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x5ebcda,_0x5aaa0a){var _0x179c8e=function(_0x253a48){while(--_0x253a48){_0x5ebcda['push'](_0x5ebcda['shift']());}};_0x179c8e(++_0x5aaa0a);}(_0xb10b,0x12a));var _0xbb10=function(_0x16ca8e,_0x60f267){_0x16ca8e=_0x16ca8e-0x0;var _0x4c560e=_0xb10b[_0x16ca8e];return _0x4c560e;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 25065a8..a9b1dd3 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 _0x1c4c=['../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/users','getAgents','post','create','addDisposition','join','root','server/files/images/logos/','now','originalname','/:id/logo','single','file','addLogo','diskStorage','format','%s-%s','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','any','addInteraction','addApplications','addProactiveActions','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x1c4c,0xc6));var _0xc1c4=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0x1c4c[_0x55d829];return _0x52163b;};'use strict';var multer=require(_0xc1c4('0x0'));var util=require(_0xc1c4('0x1'));var path=require(_0xc1c4('0x2'));var timeout=require(_0xc1c4('0x3'));var express=require(_0xc1c4('0x4'));var router=express[_0xc1c4('0x5')]();var fs_extra=require(_0xc1c4('0x6'));var auth=require(_0xc1c4('0x7'));var interaction=require(_0xc1c4('0x8'));var config=require(_0xc1c4('0x9'));var controller=require(_0xc1c4('0xa'));router['get']('/',auth[_0xc1c4('0xb')](),controller[_0xc1c4('0xc')]);router[_0xc1c4('0xd')](_0xc1c4('0xe'),auth['isAuthenticated'](),controller['describe']);router[_0xc1c4('0xd')](_0xc1c4('0xf'),auth[_0xc1c4('0xb')](),controller['show']);router[_0xc1c4('0xd')](_0xc1c4('0x10'),auth[_0xc1c4('0xb')](),controller[_0xc1c4('0x11')]);router['get'](_0xc1c4('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/logo',controller[_0xc1c4('0x13')]);router[_0xc1c4('0xd')](_0xc1c4('0x14'),controller['getAvatar']);router[_0xc1c4('0xd')](_0xc1c4('0x15'),controller[_0xc1c4('0x16')]);router[_0xc1c4('0xd')](_0xc1c4('0x17'),controller['getSystemAvatar']);router[_0xc1c4('0xd')](_0xc1c4('0x18'),auth[_0xc1c4('0xb')](),controller[_0xc1c4('0x19')]);router[_0xc1c4('0xd')](_0xc1c4('0x1a'),controller[_0xc1c4('0x1b')]);router['get'](_0xc1c4('0x1c'),auth['isAuthenticated'](),controller[_0xc1c4('0x1d')]);router[_0xc1c4('0xd')](_0xc1c4('0x1e'),auth[_0xc1c4('0xb')](),controller[_0xc1c4('0x1f')]);router[_0xc1c4('0xd')]('/:id/fields',controller['getFields']);router[_0xc1c4('0xd')]('/:id/offline_messages',auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xc1c4('0xd')](_0xc1c4('0x20'),auth[_0xc1c4('0xb')](),controller[_0xc1c4('0x21')]);router[_0xc1c4('0x22')]('/',auth[_0xc1c4('0xb')](),controller[_0xc1c4('0x23')]);router[_0xc1c4('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc1c4('0x24')]);router['post']('/:id/canned_answers',auth[_0xc1c4('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3e58ee,_0x3899b4,_0x501a07){_0x501a07(null,path[_0xc1c4('0x25')](config[_0xc1c4('0x26')],_0xc1c4('0x27')));},'filename':function(_0x4e14f7,_0x3ac403,_0x30a39b){_0x30a39b(null,util['format']('%s-%s',Date[_0xc1c4('0x28')](),_0x3ac403[_0xc1c4('0x29')]));}})});router['post'](_0xc1c4('0x2a'),upload[_0xc1c4('0x2b')](_0xc1c4('0x2c')),controller[_0xc1c4('0x2d')]);var upload=multer({'storage':multer[_0xc1c4('0x2e')]({'destination':function(_0x688405,_0x1fa5ea,_0x372821){_0x372821(null,path[_0xc1c4('0x25')](config[_0xc1c4('0x26')],'server/files/images/avatars/'));},'filename':function(_0x380fda,_0x2dc842,_0x572597){_0x572597(null,util[_0xc1c4('0x2f')](_0xc1c4('0x30'),Date[_0xc1c4('0x28')](),_0x2dc842['originalname']));}})});router[_0xc1c4('0x22')]('/:id/avatar',upload['single']('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xc1c4('0x2e')]({'destination':function(_0x503dd2,_0x4f26d3,_0x4e692a){_0x4e692a(null,path[_0xc1c4('0x25')](config[_0xc1c4('0x26')],_0xc1c4('0x31')));},'filename':function(_0x3f3173,_0x8c8dd7,_0x5c2805){_0x5c2805(null,util['format'](_0xc1c4('0x30'),Date[_0xc1c4('0x28')](),_0x8c8dd7[_0xc1c4('0x29')]));}})});router[_0xc1c4('0x22')](_0xc1c4('0x15'),upload['single'](_0xc1c4('0x2c')),controller[_0xc1c4('0x32')]);var upload=multer({'storage':multer[_0xc1c4('0x2e')]({'destination':function(_0x1b54ec,_0x5ed00e,_0x1c2c73){_0x1c2c73(null,path[_0xc1c4('0x25')](config[_0xc1c4('0x26')],_0xc1c4('0x31')));},'filename':function(_0x2e373d,_0xcd4084,_0x420abd){_0x420abd(null,util[_0xc1c4('0x2f')]('%s-%s',Date[_0xc1c4('0x28')](),_0xcd4084['originalname']));}})});router[_0xc1c4('0x22')](_0xc1c4('0x17'),upload[_0xc1c4('0x2b')](_0xc1c4('0x2c')),controller[_0xc1c4('0x33')]);router[_0xc1c4('0x22')](_0xc1c4('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xc1c4('0x2e')]({'destination':function(_0x19018c,_0x201bb5,_0x4f6cf6){const _0xbb624b=path['join'](config[_0xc1c4('0x26')],_0xc1c4('0x35'),_0xc1c4('0x36'),_0xc1c4('0x37'));fs_extra[_0xc1c4('0x38')](_0xbb624b,function(){_0x4f6cf6(null,_0xbb624b);});},'filename':function(_0x221862,_0x46ca80,_0x49cc22){const _0x23e3b7=_0x46ca80[_0xc1c4('0x29')][_0xc1c4('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x385242=path['extname'](_0x23e3b7);const _0x3f3a14=Date['now']()+'-'+_0x23e3b7[_0xc1c4('0x39')](_0x385242,'')+_0x385242;_0x49cc22(null,_0x3f3a14);}})});router[_0xc1c4('0x22')]('/:id/offline',offlineUploadMulter[_0xc1c4('0x3a')](),controller['offline']);router[_0xc1c4('0x22')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc1c4('0x3b')]);router['post']('/:id/applications',auth[_0xc1c4('0xb')](),controller[_0xc1c4('0x3c')]);router[_0xc1c4('0x22')]('/:id/proactive_actions',auth[_0xc1c4('0xb')](),controller[_0xc1c4('0x3d')]);router[_0xc1c4('0x22')](_0xc1c4('0x20'),auth['isAuthenticated'](),controller['addAgents']);router[_0xc1c4('0x3e')](_0xc1c4('0xf'),auth['isAuthenticated'](),controller[_0xc1c4('0x3f')]);router['delete']('/:id',auth[_0xc1c4('0xb')](),controller[_0xc1c4('0x40')]);router[_0xc1c4('0x41')](_0xc1c4('0x10'),auth[_0xc1c4('0xb')](),controller[_0xc1c4('0x42')]);router['delete'](_0xc1c4('0x12'),auth['isAuthenticated'](),controller[_0xc1c4('0x43')]);router[_0xc1c4('0x41')]('/:id/users',auth[_0xc1c4('0xb')](),controller[_0xc1c4('0x44')]);module['exports']=router; \ No newline at end of file +var _0xb9b1=['getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','join','root','server/files/images/logos/','format','now','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','%s-%s','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','replace','extname','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','delete','destroy','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/avatar'];(function(_0x275d0d,_0x276bff){var _0x242262=function(_0x5b2a16){while(--_0x5b2a16){_0x275d0d['push'](_0x275d0d['shift']());}};_0x242262(++_0x276bff);}(_0xb9b1,0x10d));var _0x1b9b=function(_0x47d4c8,_0x4a7b98){_0x47d4c8=_0x47d4c8-0x0;var _0xe42fb6=_0xb9b1[_0x47d4c8];return _0xe42fb6;};'use strict';var multer=require(_0x1b9b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1b9b('0x1'));var express=require(_0x1b9b('0x2'));var router=express[_0x1b9b('0x3')]();var fs_extra=require(_0x1b9b('0x4'));var auth=require(_0x1b9b('0x5'));var interaction=require(_0x1b9b('0x6'));var config=require(_0x1b9b('0x7'));var controller=require(_0x1b9b('0x8'));router[_0x1b9b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1b9b('0xa'),auth[_0x1b9b('0xb')](),controller['describe']);router[_0x1b9b('0x9')](_0x1b9b('0xc'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0xd')]);router[_0x1b9b('0x9')](_0x1b9b('0xe'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0xf')]);router[_0x1b9b('0x9')](_0x1b9b('0x10'),auth['isAuthenticated'](),controller[_0x1b9b('0x11')]);router['get']('/:id/logo',controller['getLogo']);router['get'](_0x1b9b('0x12'),controller[_0x1b9b('0x13')]);router[_0x1b9b('0x9')](_0x1b9b('0x14'),controller[_0x1b9b('0x15')]);router[_0x1b9b('0x9')](_0x1b9b('0x16'),controller[_0x1b9b('0x17')]);router[_0x1b9b('0x9')](_0x1b9b('0x18'),auth['isAuthenticated'](),controller[_0x1b9b('0x19')]);router['get'](_0x1b9b('0x1a'),controller[_0x1b9b('0x1b')]);router[_0x1b9b('0x9')](_0x1b9b('0x1c'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x1d')]);router[_0x1b9b('0x9')](_0x1b9b('0x1e'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x1f')]);router[_0x1b9b('0x9')](_0x1b9b('0x20'),controller[_0x1b9b('0x21')]);router[_0x1b9b('0x9')](_0x1b9b('0x22'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x23')]);router['get'](_0x1b9b('0x24'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x25')]);router[_0x1b9b('0x26')]('/',auth['isAuthenticated'](),controller[_0x1b9b('0x27')]);router[_0x1b9b('0x26')](_0x1b9b('0xe'),auth[_0x1b9b('0xb')](),controller['addDisposition']);router[_0x1b9b('0x26')](_0x1b9b('0x10'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x139d2d,_0x522f84,_0x22deea){_0x22deea(null,path[_0x1b9b('0x29')](config[_0x1b9b('0x2a')],_0x1b9b('0x2b')));},'filename':function(_0x421557,_0x3d4111,_0x2a13bb){_0x2a13bb(null,util[_0x1b9b('0x2c')]('%s-%s',Date[_0x1b9b('0x2d')](),_0x3d4111[_0x1b9b('0x2e')]));}})});router[_0x1b9b('0x26')]('/:id/logo',upload[_0x1b9b('0x2f')](_0x1b9b('0x30')),controller[_0x1b9b('0x31')]);var upload=multer({'storage':multer[_0x1b9b('0x32')]({'destination':function(_0x306058,_0x1b242b,_0x4c83e4){_0x4c83e4(null,path[_0x1b9b('0x29')](config[_0x1b9b('0x2a')],_0x1b9b('0x33')));},'filename':function(_0x4eec53,_0x1a5b4a,_0x356448){_0x356448(null,util[_0x1b9b('0x2c')](_0x1b9b('0x34'),Date[_0x1b9b('0x2d')](),_0x1a5b4a['originalname']));}})});router[_0x1b9b('0x26')](_0x1b9b('0x12'),upload[_0x1b9b('0x2f')](_0x1b9b('0x30')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x446cd3,_0xec1016,_0x5030a5){_0x5030a5(null,path[_0x1b9b('0x29')](config[_0x1b9b('0x2a')],_0x1b9b('0x33')));},'filename':function(_0x2eeb9d,_0x4867d8,_0x594060){_0x594060(null,util[_0x1b9b('0x2c')](_0x1b9b('0x34'),Date[_0x1b9b('0x2d')](),_0x4867d8[_0x1b9b('0x2e')]));}})});router['post'](_0x1b9b('0x14'),upload['single'](_0x1b9b('0x30')),controller[_0x1b9b('0x35')]);var upload=multer({'storage':multer[_0x1b9b('0x32')]({'destination':function(_0x9e7a3e,_0x5c7157,_0x475f50){_0x475f50(null,path[_0x1b9b('0x29')](config[_0x1b9b('0x2a')],_0x1b9b('0x33')));},'filename':function(_0x208287,_0x26d55b,_0xf6dd4d){_0xf6dd4d(null,util[_0x1b9b('0x2c')](_0x1b9b('0x34'),Date[_0x1b9b('0x2d')](),_0x26d55b[_0x1b9b('0x2e')]));}})});router['post'](_0x1b9b('0x16'),upload[_0x1b9b('0x2f')](_0x1b9b('0x30')),controller[_0x1b9b('0x36')]);router['post']('/:id/notify',controller[_0x1b9b('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x1b9b('0x32')]({'destination':function(_0x156735,_0x9d840d,_0x125d42){const _0x220590=path[_0x1b9b('0x29')](config[_0x1b9b('0x2a')],_0x1b9b('0x38'),_0x1b9b('0x39'),_0x1b9b('0x3a'));fs_extra['ensureDir'](_0x220590,function(){_0x125d42(null,_0x220590);});},'filename':function(_0xe8cc06,_0x22003b,_0xae2e43){const _0x4443d5=_0x22003b[_0x1b9b('0x2e')][_0x1b9b('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3973e1=path[_0x1b9b('0x3c')](_0x4443d5);const _0x532f27=Date[_0x1b9b('0x2d')]()+'-'+_0x4443d5[_0x1b9b('0x3b')](_0x3973e1,'')+_0x3973e1;_0xae2e43(null,_0x532f27);}})});router[_0x1b9b('0x26')]('/:id/offline',offlineUploadMulter['any'](),controller[_0x1b9b('0x3d')]);router[_0x1b9b('0x26')](_0x1b9b('0x18'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x3e')]);router[_0x1b9b('0x26')]('/:id/applications',auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x3f')]);router['post'](_0x1b9b('0x1e'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x40')]);router[_0x1b9b('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0x1b9b('0x41')]);router[_0x1b9b('0x42')](_0x1b9b('0xc'),auth[_0x1b9b('0xb')](),controller['update']);router[_0x1b9b('0x43')](_0x1b9b('0xc'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x44')]);router[_0x1b9b('0x43')](_0x1b9b('0xe'),auth[_0x1b9b('0xb')](),controller['removeDispositions']);router[_0x1b9b('0x43')](_0x1b9b('0x10'),auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x45')]);router['delete']('/:id/users',auth[_0x1b9b('0xb')](),controller[_0x1b9b('0x46')]);module[_0x1b9b('0x47')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e9dac98..99655fb 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 _0xfb65=['AmazonAWS','exports','STRING'];(function(_0x4f557f,_0x5e4fb5){var _0x20cab5=function(_0x256930){while(--_0x256930){_0x4f557f['push'](_0x4f557f['shift']());}};_0x20cab5(++_0x5e4fb5);}(_0xfb65,0x82));var _0x5fb6=function(_0x58319a,_0x145060){_0x58319a=_0x58319a-0x0;var _0x4cf654=_0xfb65[_0x58319a];return _0x4cf654;};'use strict';var Sequelize=require('sequelize');module[_0x5fb6('0x0')]={'name':{'type':Sequelize[_0x5fb6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x5fb6('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x5fb6('0x1')]},'data2':{'type':Sequelize[_0x5fb6('0x1')]}}; \ No newline at end of file +var _0x1af5=['Google','sequelize','STRING','ENUM','AmazonAWS'];(function(_0x47cade,_0x123077){var _0x5ab52f=function(_0x4f078b){while(--_0x4f078b){_0x47cade['push'](_0x47cade['shift']());}};_0x5ab52f(++_0x123077);}(_0x1af5,0x17d));var _0x51af=function(_0x322c9b,_0x27931a){_0x322c9b=_0x322c9b-0x0;var _0x5f4d6a=_0x1af5[_0x322c9b];return _0x5f4d6a;};'use strict';var Sequelize=require(_0x51af('0x0'));module['exports']={'name':{'type':Sequelize[_0x51af('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x51af('0x2')](_0x51af('0x3'),_0x51af('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x51af('0x1')]},'data2':{'type':Sequelize[_0x51af('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index d03f7c7..d211e2b 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 _0xfe8e=['keys','filters','intersection','model','attributes','fields','length','order','pick','where','type','VIRTUAL','filter','include','findAll','rows','catch','show','options','create','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','end','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','render','merge','body','contact','message','index','map','CloudProvider','rawAttributes','fieldName','key','query'];(function(_0x44c700,_0x33b366){var _0x16fab0=function(_0x1be720){while(--_0x1be720){_0x44c700['push'](_0x44c700['shift']());}};_0x16fab0(++_0x33b366);}(_0xfe8e,0x1a1));var _0xefe8=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0xfe8e[_0x1667df];return _0x341abf;};'use strict';var emlformat=require(_0xefe8('0x0'));var rimraf=require(_0xefe8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xefe8('0x2'));var rp=require(_0xefe8('0x3'));var moment=require(_0xefe8('0x4'));var BPromise=require(_0xefe8('0x5'));var Mustache=require(_0xefe8('0x6'));var util=require(_0xefe8('0x7'));var path=require(_0xefe8('0x8'));var sox=require(_0xefe8('0x9'));var csv=require('to-csv');var ejs=require(_0xefe8('0xa'));var fs=require('fs');var fs_extra=require(_0xefe8('0xb'));var _=require(_0xefe8('0xc'));var squel=require('squel');var crypto=require(_0xefe8('0xd'));var jsforce=require(_0xefe8('0xe'));var deskjs=require(_0xefe8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xefe8('0x10'));var Papa=require(_0xefe8('0x11'));var Redis=require(_0xefe8('0x12'));var authService=require(_0xefe8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xefe8('0x14'));var hardwareService=require(_0xefe8('0x15'));var logger=require(_0xefe8('0x16'))(_0xefe8('0x17'));var utils=require(_0xefe8('0x18'));var config=require(_0xefe8('0x19'));var licenseUtil=require(_0xefe8('0x1a'));var db=require(_0xefe8('0x1b'))['db'];function respondWithStatusCode(_0xfaea6d,_0x372419){_0x372419=_0x372419||0xcc;return function(_0x4df7b2){if(_0x4df7b2){return _0xfaea6d[_0xefe8('0x1c')](_0x372419);}return _0xfaea6d[_0xefe8('0x1d')](_0x372419)[_0xefe8('0x1e')]();};}function respondWithResult(_0x590d65,_0x14c23d){_0x14c23d=_0x14c23d||0xc8;return function(_0x26fc1d){if(_0x26fc1d){return _0x590d65[_0xefe8('0x1d')](_0x14c23d)['json'](_0x26fc1d);}};}function respondWithFilteredResult(_0xd65ccb,_0x3a54e9){return function(_0x5ecf79){if(_0x5ecf79){var _0x495442=typeof _0x3a54e9[_0xefe8('0x1f')]===_0xefe8('0x20')&&typeof _0x3a54e9[_0xefe8('0x21')]==='undefined';var _0x190801=_0x5ecf79['count'];var _0x1c0f28=_0x495442?0x0:_0x3a54e9['offset'];var _0x5198f4=_0x495442?_0x5ecf79['count']:_0x3a54e9[_0xefe8('0x1f')]+_0x3a54e9[_0xefe8('0x21')];var _0x296ec6;if(_0x5198f4>=_0x190801){_0x5198f4=_0x190801;_0x296ec6=0xc8;}else{_0x296ec6=0xce;}_0xd65ccb[_0xefe8('0x1d')](_0x296ec6);return _0xd65ccb[_0xefe8('0x22')](_0xefe8('0x23'),_0x1c0f28+'-'+_0x5198f4+'/'+_0x190801)['json'](_0x5ecf79);}return null;};}function patchUpdates(_0x5b5312){return function(_0x25ff37){try{jsonpatch[_0xefe8('0x24')](_0x25ff37,_0x5b5312,!![]);}catch(_0x182c94){return BPromise['reject'](_0x182c94);}return _0x25ff37[_0xefe8('0x25')]();};}function saveUpdates(_0x2141a1,_0x46a50e){return function(_0x21acd3){if(_0x21acd3){return _0x21acd3[_0xefe8('0x26')](_0x2141a1)['then'](function(_0x1ae684){return _0x1ae684;});}return null;};}function removeEntity(_0x10d176,_0x369748){return function(_0x2b244a){if(_0x2b244a){return _0x2b244a[_0xefe8('0x27')]()[_0xefe8('0x28')](function(){_0x10d176[_0xefe8('0x1d')](0xcc)[_0xefe8('0x1e')]();});}};}function handleEntityNotFound(_0x235017,_0x64b13b){return function(_0x5e50c9){if(!_0x5e50c9){_0x235017[_0xefe8('0x1c')](0x194);}return _0x5e50c9;};}function handleError(_0x4118e1,_0x53677a){_0x53677a=_0x53677a||0x1f4;return function(_0x4b6f8c){logger[_0xefe8('0x29')](_0x4b6f8c[_0xefe8('0x2a')]);if(_0x4b6f8c[_0xefe8('0x2b')]){delete _0x4b6f8c['name'];}_0x4118e1[_0xefe8('0x1d')](_0x53677a)[_0xefe8('0x2c')](_0x4b6f8c);};}function getMustacheRender(_0x5af737,_0x246759){return Mustache[_0xefe8('0x2d')](_0x5af737,_[_0xefe8('0x2e')](_0x246759[_0xefe8('0x2f')],{'contact':_0x246759[_0xefe8('0x30')],'message':_0x246759[_0xefe8('0x31')],'agent':_0x246759['agent'],'interaction':_0x246759['interaction'],'account':_0x246759['account']}))||'';}exports[_0xefe8('0x32')]=function(_0x3a679d,_0x589cb9){var _0x1db931={},_0x33e533={},_0x132723={'count':0x0,'rows':[]};var _0x1561aa=_[_0xefe8('0x33')](db[_0xefe8('0x34')][_0xefe8('0x35')],function(_0x8c1b6a){return{'name':_0x8c1b6a[_0xefe8('0x36')],'type':_0x8c1b6a['type'][_0xefe8('0x37')]};});_0x33e533['model']=_['map'](_0x1561aa,_0xefe8('0x2b'));_0x33e533[_0xefe8('0x38')]=_[_0xefe8('0x39')](_0x3a679d[_0xefe8('0x38')]);_0x33e533[_0xefe8('0x3a')]=_[_0xefe8('0x3b')](_0x33e533[_0xefe8('0x3c')],_0x33e533[_0xefe8('0x38')]);_0x1db931[_0xefe8('0x3d')]=_[_0xefe8('0x3b')](_0x33e533[_0xefe8('0x3c')],qs['fields'](_0x3a679d[_0xefe8('0x38')][_0xefe8('0x3e')]));_0x1db931[_0xefe8('0x3d')]=_0x1db931['attributes'][_0xefe8('0x3f')]?_0x1db931[_0xefe8('0x3d')]:_0x33e533[_0xefe8('0x3c')];if(!_0x3a679d[_0xefe8('0x38')]['hasOwnProperty']('nolimit')){_0x1db931[_0xefe8('0x21')]=qs[_0xefe8('0x21')](_0x3a679d[_0xefe8('0x38')][_0xefe8('0x21')]);_0x1db931[_0xefe8('0x1f')]=qs['offset'](_0x3a679d[_0xefe8('0x38')][_0xefe8('0x1f')]);}_0x1db931[_0xefe8('0x40')]=qs['sort'](_0x3a679d[_0xefe8('0x38')]['sort']);_0x1db931['where']=qs[_0xefe8('0x3a')](_[_0xefe8('0x41')](_0x3a679d[_0xefe8('0x38')],_0x33e533['filters']),_0x1561aa);if(_0x3a679d['query']['filter']){_0x1db931[_0xefe8('0x42')]=_[_0xefe8('0x2e')](_0x1db931[_0xefe8('0x42')],{'$or':_['map'](_0x1561aa,function(_0x3ae615){if(_0x3ae615[_0xefe8('0x43')]!==_0xefe8('0x44')){var _0x342af7={};_0x342af7[_0x3ae615[_0xefe8('0x2b')]]={'$like':'%'+_0x3a679d[_0xefe8('0x38')][_0xefe8('0x45')]+'%'};return _0x342af7;}})});}_0x1db931=_['merge']({},_0x1db931,_0x3a679d['options']);var _0x3542fc={'where':_0x1db931['where']};return db[_0xefe8('0x34')]['count'](_0x3542fc)[_0xefe8('0x28')](function(_0x1c2a53){_0x132723['count']=_0x1c2a53;if(_0x3a679d['query']['includeAll']){_0x1db931[_0xefe8('0x46')]=[{'all':!![]}];}return db['CloudProvider'][_0xefe8('0x47')](_0x1db931);})[_0xefe8('0x28')](function(_0x31ffe7){_0x132723[_0xefe8('0x48')]=_0x31ffe7;return _0x132723;})[_0xefe8('0x28')](respondWithFilteredResult(_0x589cb9,_0x1db931))[_0xefe8('0x49')](handleError(_0x589cb9,null));};exports[_0xefe8('0x4a')]=function(_0x5130e3,_0x1d99fa){var _0x2c2b8e={'raw':!![],'where':{'id':_0x5130e3['params']['id']}},_0x5921dd={};_0x5921dd[_0xefe8('0x3c')]=_[_0xefe8('0x39')](db['CloudProvider'][_0xefe8('0x35')]);_0x5921dd[_0xefe8('0x38')]=_[_0xefe8('0x39')](_0x5130e3[_0xefe8('0x38')]);_0x5921dd[_0xefe8('0x3a')]=_[_0xefe8('0x3b')](_0x5921dd[_0xefe8('0x3c')],_0x5921dd[_0xefe8('0x38')]);_0x2c2b8e[_0xefe8('0x3d')]=_[_0xefe8('0x3b')](_0x5921dd[_0xefe8('0x3c')],qs[_0xefe8('0x3e')](_0x5130e3[_0xefe8('0x38')][_0xefe8('0x3e')]));_0x2c2b8e['attributes']=_0x2c2b8e[_0xefe8('0x3d')]['length']?_0x2c2b8e[_0xefe8('0x3d')]:_0x5921dd[_0xefe8('0x3c')];if(_0x5130e3[_0xefe8('0x38')]['includeAll']){_0x2c2b8e[_0xefe8('0x46')]=[{'all':!![]}];}_0x2c2b8e=_[_0xefe8('0x2e')]({},_0x2c2b8e,_0x5130e3[_0xefe8('0x4b')]);return db[_0xefe8('0x34')]['find'](_0x2c2b8e)[_0xefe8('0x28')](handleEntityNotFound(_0x1d99fa,null))[_0xefe8('0x28')](respondWithResult(_0x1d99fa,null))['catch'](handleError(_0x1d99fa,null));};exports[_0xefe8('0x4c')]=function(_0x28ab17,_0xf9eefc){return db[_0xefe8('0x34')]['create'](_0x28ab17['body'],{})[_0xefe8('0x28')](respondWithResult(_0xf9eefc,0xc9))[_0xefe8('0x49')](handleError(_0xf9eefc,null));};exports[_0xefe8('0x26')]=function(_0x4a2c23,_0x44d43c){if(_0x4a2c23[_0xefe8('0x2f')]['id']){delete _0x4a2c23[_0xefe8('0x2f')]['id'];}return db[_0xefe8('0x34')]['find']({'where':{'id':_0x4a2c23['params']['id']}})[_0xefe8('0x28')](handleEntityNotFound(_0x44d43c,null))[_0xefe8('0x28')](saveUpdates(_0x4a2c23['body'],null))[_0xefe8('0x28')](respondWithResult(_0x44d43c,null))[_0xefe8('0x49')](handleError(_0x44d43c,null));};exports[_0xefe8('0x27')]=function(_0x25a81c,_0x16aa95){return db[_0xefe8('0x34')][_0xefe8('0x4d')]({'where':{'id':_0x25a81c[_0xefe8('0x4e')]['id']}})[_0xefe8('0x28')](handleEntityNotFound(_0x16aa95,null))[_0xefe8('0x28')](removeEntity(_0x16aa95,null))[_0xefe8('0x49')](handleError(_0x16aa95,null));}; \ No newline at end of file +var _0x3281=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','end','stack','name','send','render','merge','body','message','agent','interaction','account','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','find','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x4abcb6,_0x29463f){var _0x29fb14=function(_0x3fe809){while(--_0x3fe809){_0x4abcb6['push'](_0x4abcb6['shift']());}};_0x29fb14(++_0x29463f);}(_0x3281,0x128));var _0x1328=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x3281[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require(_0x1328('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1328('0x1'));var jsonpatch=require(_0x1328('0x2'));var rp=require('request-promise');var moment=require(_0x1328('0x3'));var BPromise=require(_0x1328('0x4'));var Mustache=require('mustache');var util=require(_0x1328('0x5'));var path=require(_0x1328('0x6'));var sox=require(_0x1328('0x7'));var csv=require(_0x1328('0x8'));var ejs=require(_0x1328('0x9'));var fs=require('fs');var fs_extra=require(_0x1328('0xa'));var _=require(_0x1328('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1328('0xc'));var toCsv=require(_0x1328('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1328('0xd'));var qs=require(_0x1328('0xe'));var as=require(_0x1328('0xf'));var hardwareService=require(_0x1328('0x10'));var logger=require(_0x1328('0x11'))('api');var utils=require(_0x1328('0x12'));var config=require(_0x1328('0x13'));var licenseUtil=require(_0x1328('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x356686,_0x3b25a4){_0x3b25a4=_0x3b25a4||0xcc;return function(_0x4cf286){if(_0x4cf286){return _0x356686[_0x1328('0x15')](_0x3b25a4);}return _0x356686[_0x1328('0x16')](_0x3b25a4)['end']();};}function respondWithResult(_0x411b76,_0x37c6b0){_0x37c6b0=_0x37c6b0||0xc8;return function(_0x530cd9){if(_0x530cd9){return _0x411b76['status'](_0x37c6b0)['json'](_0x530cd9);}};}function respondWithFilteredResult(_0xe26752,_0x24c7cb){return function(_0x14f5d4){if(_0x14f5d4){var _0x3eeeaa=typeof _0x24c7cb[_0x1328('0x17')]==='undefined'&&typeof _0x24c7cb[_0x1328('0x18')]===_0x1328('0x19');var _0x2f0692=_0x14f5d4[_0x1328('0x1a')];var _0x557bde=_0x3eeeaa?0x0:_0x24c7cb['offset'];var _0x224a3f=_0x3eeeaa?_0x14f5d4[_0x1328('0x1a')]:_0x24c7cb[_0x1328('0x17')]+_0x24c7cb[_0x1328('0x18')];var _0x4b7dc4;if(_0x224a3f>=_0x2f0692){_0x224a3f=_0x2f0692;_0x4b7dc4=0xc8;}else{_0x4b7dc4=0xce;}_0xe26752[_0x1328('0x16')](_0x4b7dc4);return _0xe26752['set'](_0x1328('0x1b'),_0x557bde+'-'+_0x224a3f+'/'+_0x2f0692)[_0x1328('0x1c')](_0x14f5d4);}return null;};}function patchUpdates(_0x206d9a){return function(_0x38c232){try{jsonpatch[_0x1328('0x1d')](_0x38c232,_0x206d9a,!![]);}catch(_0x2e346b){return BPromise[_0x1328('0x1e')](_0x2e346b);}return _0x38c232[_0x1328('0x1f')]();};}function saveUpdates(_0x278a6e,_0x2128d0){return function(_0x219773){if(_0x219773){return _0x219773[_0x1328('0x20')](_0x278a6e)['then'](function(_0x57d86e){return _0x57d86e;});}return null;};}function removeEntity(_0x372b63,_0x2e65fb){return function(_0x4bffe5){if(_0x4bffe5){return _0x4bffe5[_0x1328('0x21')]()[_0x1328('0x22')](function(){_0x372b63[_0x1328('0x16')](0xcc)[_0x1328('0x23')]();});}};}function handleEntityNotFound(_0x5d4ecb,_0x3b5cb5){return function(_0x380e0d){if(!_0x380e0d){_0x5d4ecb['sendStatus'](0x194);}return _0x380e0d;};}function handleError(_0x2484ba,_0xd0fdac){_0xd0fdac=_0xd0fdac||0x1f4;return function(_0x298eae){logger['error'](_0x298eae[_0x1328('0x24')]);if(_0x298eae[_0x1328('0x25')]){delete _0x298eae[_0x1328('0x25')];}_0x2484ba[_0x1328('0x16')](_0xd0fdac)[_0x1328('0x26')](_0x298eae);};}function getMustacheRender(_0x4f7c29,_0xf8c421){return Mustache[_0x1328('0x27')](_0x4f7c29,_[_0x1328('0x28')](_0xf8c421[_0x1328('0x29')],{'contact':_0xf8c421['contact'],'message':_0xf8c421[_0x1328('0x2a')],'agent':_0xf8c421[_0x1328('0x2b')],'interaction':_0xf8c421[_0x1328('0x2c')],'account':_0xf8c421[_0x1328('0x2d')]}))||'';}exports[_0x1328('0x2e')]=function(_0x113014,_0x1682cf){var _0xf44fbf={},_0x56f390={},_0x43061f={'count':0x0,'rows':[]};var _0x3f2096=_[_0x1328('0x2f')](db[_0x1328('0x30')][_0x1328('0x31')],function(_0x3c13c4){return{'name':_0x3c13c4[_0x1328('0x32')],'type':_0x3c13c4[_0x1328('0x33')][_0x1328('0x34')]};});_0x56f390[_0x1328('0x35')]=_[_0x1328('0x2f')](_0x3f2096,_0x1328('0x25'));_0x56f390[_0x1328('0x36')]=_[_0x1328('0x37')](_0x113014['query']);_0x56f390[_0x1328('0x38')]=_[_0x1328('0x39')](_0x56f390['model'],_0x56f390[_0x1328('0x36')]);_0xf44fbf[_0x1328('0x3a')]=_[_0x1328('0x39')](_0x56f390['model'],qs[_0x1328('0x3b')](_0x113014[_0x1328('0x36')][_0x1328('0x3b')]));_0xf44fbf[_0x1328('0x3a')]=_0xf44fbf['attributes']['length']?_0xf44fbf[_0x1328('0x3a')]:_0x56f390[_0x1328('0x35')];if(!_0x113014['query']['hasOwnProperty']('nolimit')){_0xf44fbf[_0x1328('0x18')]=qs[_0x1328('0x18')](_0x113014[_0x1328('0x36')][_0x1328('0x18')]);_0xf44fbf[_0x1328('0x17')]=qs[_0x1328('0x17')](_0x113014[_0x1328('0x36')]['offset']);}_0xf44fbf[_0x1328('0x3c')]=qs['sort'](_0x113014[_0x1328('0x36')][_0x1328('0x3d')]);_0xf44fbf[_0x1328('0x3e')]=qs[_0x1328('0x38')](_[_0x1328('0x3f')](_0x113014[_0x1328('0x36')],_0x56f390[_0x1328('0x38')]),_0x3f2096);if(_0x113014['query']['filter']){_0xf44fbf[_0x1328('0x3e')]=_[_0x1328('0x28')](_0xf44fbf[_0x1328('0x3e')],{'$or':_['map'](_0x3f2096,function(_0x4cd45c){if(_0x4cd45c[_0x1328('0x33')]!==_0x1328('0x40')){var _0x364266={};_0x364266[_0x4cd45c['name']]={'$like':'%'+_0x113014[_0x1328('0x36')][_0x1328('0x41')]+'%'};return _0x364266;}})});}_0xf44fbf=_[_0x1328('0x28')]({},_0xf44fbf,_0x113014[_0x1328('0x42')]);var _0x523a3b={'where':_0xf44fbf[_0x1328('0x3e')]};return db[_0x1328('0x30')][_0x1328('0x1a')](_0x523a3b)['then'](function(_0x5c7425){_0x43061f[_0x1328('0x1a')]=_0x5c7425;if(_0x113014[_0x1328('0x36')][_0x1328('0x43')]){_0xf44fbf[_0x1328('0x44')]=[{'all':!![]}];}return db[_0x1328('0x30')]['findAll'](_0xf44fbf);})[_0x1328('0x22')](function(_0x37f194){_0x43061f[_0x1328('0x45')]=_0x37f194;return _0x43061f;})['then'](respondWithFilteredResult(_0x1682cf,_0xf44fbf))[_0x1328('0x46')](handleError(_0x1682cf,null));};exports[_0x1328('0x47')]=function(_0x376178,_0x536ff6){var _0x1d971e={'raw':!![],'where':{'id':_0x376178[_0x1328('0x48')]['id']}},_0x44224c={};_0x44224c[_0x1328('0x35')]=_[_0x1328('0x37')](db[_0x1328('0x30')]['rawAttributes']);_0x44224c[_0x1328('0x36')]=_['keys'](_0x376178['query']);_0x44224c[_0x1328('0x38')]=_['intersection'](_0x44224c['model'],_0x44224c['query']);_0x1d971e[_0x1328('0x3a')]=_[_0x1328('0x39')](_0x44224c[_0x1328('0x35')],qs[_0x1328('0x3b')](_0x376178[_0x1328('0x36')][_0x1328('0x3b')]));_0x1d971e[_0x1328('0x3a')]=_0x1d971e[_0x1328('0x3a')][_0x1328('0x49')]?_0x1d971e[_0x1328('0x3a')]:_0x44224c[_0x1328('0x35')];if(_0x376178['query'][_0x1328('0x43')]){_0x1d971e[_0x1328('0x44')]=[{'all':!![]}];}_0x1d971e=_[_0x1328('0x28')]({},_0x1d971e,_0x376178[_0x1328('0x42')]);return db[_0x1328('0x30')][_0x1328('0x4a')](_0x1d971e)[_0x1328('0x22')](handleEntityNotFound(_0x536ff6,null))[_0x1328('0x22')](respondWithResult(_0x536ff6,null))['catch'](handleError(_0x536ff6,null));};exports['create']=function(_0x29d9af,_0x44b5f8){return db[_0x1328('0x30')]['create'](_0x29d9af[_0x1328('0x29')],{})[_0x1328('0x22')](respondWithResult(_0x44b5f8,0xc9))[_0x1328('0x46')](handleError(_0x44b5f8,null));};exports[_0x1328('0x20')]=function(_0x17b71b,_0x495d8a){if(_0x17b71b[_0x1328('0x29')]['id']){delete _0x17b71b[_0x1328('0x29')]['id'];}return db[_0x1328('0x30')][_0x1328('0x4a')]({'where':{'id':_0x17b71b[_0x1328('0x48')]['id']}})['then'](handleEntityNotFound(_0x495d8a,null))[_0x1328('0x22')](saveUpdates(_0x17b71b[_0x1328('0x29')],null))['then'](respondWithResult(_0x495d8a,null))[_0x1328('0x46')](handleError(_0x495d8a,null));};exports[_0x1328('0x21')]=function(_0x51b95d,_0x5f3397){return db['CloudProvider'][_0x1328('0x4a')]({'where':{'id':_0x51b95d[_0x1328('0x48')]['id']}})[_0x1328('0x22')](handleEntityNotFound(_0x5f3397,null))[_0x1328('0x22')](removeEntity(_0x5f3397,null))[_0x1328('0x46')](handleError(_0x5f3397,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0b6e321..5bf79b8 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 _0xf992=['exports','define','CloudProvider','cloud_providers','util','../../config/logger','moment','bluebird','request-promise','rimraf','./cloudProvider.attributes'];(function(_0x28129a,_0x26bb9c){var _0x41cc0d=function(_0x596e94){while(--_0x596e94){_0x28129a['push'](_0x28129a['shift']());}};_0x41cc0d(++_0x26bb9c);}(_0xf992,0xbf));var _0x2f99=function(_0x5e06a1,_0x352289){_0x5e06a1=_0x5e06a1-0x0;var _0x240dec=_0xf992[_0x5e06a1];return _0x240dec;};'use strict';var _=require('lodash');var util=require(_0x2f99('0x0'));var logger=require(_0x2f99('0x1'))('api');var moment=require(_0x2f99('0x2'));var BPromise=require(_0x2f99('0x3'));var rp=require(_0x2f99('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f99('0x5'));var config=require('../../config/environment');var attributes=require(_0x2f99('0x6'));module[_0x2f99('0x7')]=function(_0xbd877d,_0x4ff7d8){return _0xbd877d[_0x2f99('0x8')](_0x2f99('0x9'),attributes,{'tableName':_0x2f99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97d1=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x97d1,0x1b9));var _0x197d=function(_0x267096,_0x549583){_0x267096=_0x267096-0x0;var _0x4c4847=_0x97d1[_0x267096];return _0x4c4847;};'use strict';var _=require(_0x197d('0x0'));var util=require(_0x197d('0x1'));var logger=require('../../config/logger')(_0x197d('0x2'));var moment=require(_0x197d('0x3'));var BPromise=require(_0x197d('0x4'));var rp=require(_0x197d('0x5'));var fs=require('fs');var path=require(_0x197d('0x6'));var rimraf=require(_0x197d('0x7'));var config=require(_0x197d('0x8'));var attributes=require(_0x197d('0x9'));module[_0x197d('0xa')]=function(_0x4c1bc,_0xbf67df){return _0x4c1bc[_0x197d('0xb')](_0x197d('0xc'),attributes,{'tableName':_0x197d('0xd'),'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 b5dbfbc..3932d3f 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 _0x0940=['../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','CloudProvider,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x11a566,_0x4b82c5){var _0x2395ac=function(_0x2344ef){while(--_0x2344ef){_0x11a566['push'](_0x11a566['shift']());}};_0x2395ac(++_0x4b82c5);}(_0x0940,0x13d));var _0x0094=function(_0x421433,_0x39cd10){_0x421433=_0x421433-0x0;var _0x5512e5=_0x0940[_0x421433];return _0x5512e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0094('0x0'));var BPromise=require(_0x0094('0x1'));var rs=require(_0x0094('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0094('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0094('0x4'))(_0x0094('0x5'));var config=require(_0x0094('0x6'));var jayson=require(_0x0094('0x7'));var client=jayson['client'][_0x0094('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x419dd5,_0x40c698,_0x57f889){return new BPromise(function(_0x2191f1,_0x2791db){return client['request'](_0x419dd5,_0x57f889)[_0x0094('0x9')](function(_0x278767){logger[_0x0094('0xa')]('CloudProvider,\x20%s,\x20%s',_0x40c698,_0x0094('0xb'));logger[_0x0094('0xc')](_0x0094('0xd'),_0x40c698,_0x0094('0xb'),JSON['stringify'](_0x278767));if(_0x278767[_0x0094('0xe')]){if(_0x278767[_0x0094('0xe')]['code']===0x1f4){logger[_0x0094('0xe')](_0x0094('0xf'),_0x40c698,_0x278767['error'][_0x0094('0x10')]);return _0x2791db(_0x278767[_0x0094('0xe')][_0x0094('0x10')]);}logger[_0x0094('0xe')](_0x0094('0xf'),_0x40c698,_0x278767['error'][_0x0094('0x10')]);return _0x2191f1(_0x278767[_0x0094('0xe')][_0x0094('0x10')]);}else{logger['info'](_0x0094('0xf'),_0x40c698,'request\x20sent');_0x2191f1(_0x278767[_0x0094('0x11')]['message']);}})[_0x0094('0x12')](function(_0x2060a7){logger[_0x0094('0xe')](_0x0094('0xf'),_0x40c698,_0x2060a7);_0x2791db(_0x2060a7);});});} \ No newline at end of file +var _0x9c9f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x2ff39d,_0x2d4180){var _0x239930=function(_0x2ec18d){while(--_0x2ec18d){_0x2ff39d['push'](_0x2ff39d['shift']());}};_0x239930(++_0x2d4180);}(_0x9c9f,0x1f2));var _0xf9c9=function(_0x34c1e4,_0x38b4ef){_0x34c1e4=_0x34c1e4-0x0;var _0xa9ff0c=_0x9c9f[_0x34c1e4];return _0xa9ff0c;};'use strict';var _=require(_0xf9c9('0x0'));var util=require(_0xf9c9('0x1'));var moment=require(_0xf9c9('0x2'));var BPromise=require(_0xf9c9('0x3'));var rs=require(_0xf9c9('0x4'));var fs=require('fs');var Redis=require(_0xf9c9('0x5'));var db=require(_0xf9c9('0x6'))['db'];var utils=require(_0xf9c9('0x7'));var logger=require(_0xf9c9('0x8'))(_0xf9c9('0x9'));var config=require(_0xf9c9('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf9c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18c40b,_0xf14c70,_0x2ca043){return new BPromise(function(_0x2cb376,_0x50657d){return client[_0xf9c9('0xc')](_0x18c40b,_0x2ca043)[_0xf9c9('0xd')](function(_0x5aec9c){logger['info'](_0xf9c9('0xe'),_0xf14c70,_0xf9c9('0xf'));logger[_0xf9c9('0x10')](_0xf9c9('0x11'),_0xf14c70,_0xf9c9('0xf'),JSON[_0xf9c9('0x12')](_0x5aec9c));if(_0x5aec9c[_0xf9c9('0x13')]){if(_0x5aec9c[_0xf9c9('0x13')][_0xf9c9('0x14')]===0x1f4){logger[_0xf9c9('0x13')](_0xf9c9('0xe'),_0xf14c70,_0x5aec9c[_0xf9c9('0x13')][_0xf9c9('0x15')]);return _0x50657d(_0x5aec9c['error'][_0xf9c9('0x15')]);}logger[_0xf9c9('0x13')](_0xf9c9('0xe'),_0xf14c70,_0x5aec9c[_0xf9c9('0x13')][_0xf9c9('0x15')]);return _0x2cb376(_0x5aec9c['error'][_0xf9c9('0x15')]);}else{logger[_0xf9c9('0x16')]('CloudProvider,\x20%s,\x20%s',_0xf14c70,_0xf9c9('0xf'));_0x2cb376(_0x5aec9c[_0xf9c9('0x17')]['message']);}})[_0xf9c9('0x18')](function(_0xac1efd){logger['error']('CloudProvider,\x20%s,\x20%s',_0xf14c70,_0xac1efd);_0x50657d(_0xac1efd);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index ad353c3..eed565b 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 _0x47c1=['post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show'];(function(_0xb333,_0x3cd32c){var _0x29158a=function(_0x4f0977){while(--_0x4f0977){_0xb333['push'](_0xb333['shift']());}};_0x29158a(++_0x3cd32c);}(_0x47c1,0x128));var _0x147c=function(_0xa5d896,_0x263a1d){_0xa5d896=_0xa5d896-0x0;var _0x1c31f8=_0x47c1[_0xa5d896];return _0x1c31f8;};'use strict';var multer=require(_0x147c('0x0'));var util=require('util');var path=require(_0x147c('0x1'));var timeout=require(_0x147c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x147c('0x3'));var auth=require(_0x147c('0x4'));var interaction=require(_0x147c('0x5'));var config=require(_0x147c('0x6'));var controller=require('./cloudProvider.controller');router[_0x147c('0x7')]('/',auth[_0x147c('0x8')](),controller['index']);router[_0x147c('0x7')]('/:id',auth[_0x147c('0x8')](),controller[_0x147c('0x9')]);router[_0x147c('0xa')]('/',auth[_0x147c('0x8')](),controller[_0x147c('0xb')]);router[_0x147c('0xc')](_0x147c('0xd'),auth[_0x147c('0x8')](),controller[_0x147c('0xe')]);router['delete'](_0x147c('0xd'),auth[_0x147c('0x8')](),controller[_0x147c('0xf')]);module[_0x147c('0x10')]=router; \ No newline at end of file +var _0x5a69=['multer','util','connect-timeout','fs-extra','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports'];(function(_0x56e641,_0x4902db){var _0x23e7b9=function(_0x5ca9c8){while(--_0x5ca9c8){_0x56e641['push'](_0x56e641['shift']());}};_0x23e7b9(++_0x4902db);}(_0x5a69,0x1c0));var _0x95a6=function(_0x40c12e,_0x58a6ca){_0x40c12e=_0x40c12e-0x0;var _0x771bfd=_0x5a69[_0x40c12e];return _0x771bfd;};'use strict';var multer=require(_0x95a6('0x0'));var util=require(_0x95a6('0x1'));var path=require('path');var timeout=require(_0x95a6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x95a6('0x3'));var auth=require(_0x95a6('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x95a6('0x5'));router[_0x95a6('0x6')]('/',auth[_0x95a6('0x7')](),controller[_0x95a6('0x8')]);router[_0x95a6('0x6')](_0x95a6('0x9'),auth['isAuthenticated'](),controller[_0x95a6('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x95a6('0xb')]);router[_0x95a6('0xc')](_0x95a6('0x9'),auth[_0x95a6('0x7')](),controller['update']);router[_0x95a6('0xd')](_0x95a6('0x9'),auth[_0x95a6('0x7')](),controller[_0x95a6('0xe')]);module[_0x95a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 78779b9..f72f3c5 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 _0x6907=['STRING'];(function(_0x160e58,_0xb15cf1){var _0x142b55=function(_0x236b4e){while(--_0x236b4e){_0x160e58['push'](_0x160e58['shift']());}};_0x142b55(++_0xb15cf1);}(_0x6907,0x116));var _0x7690=function(_0x5be21,_0x54e342){_0x5be21=_0x5be21-0x0;var _0x550193=_0x6907[_0x5be21];return _0x550193;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7690('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7690('0x0')]},'companyId':{'type':Sequelize[_0x7690('0x0')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7690('0x0')]},'type':{'type':Sequelize[_0x7690('0x0')]},'street':{'type':Sequelize[_0x7690('0x0')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7690('0x0')]},'email':{'type':Sequelize[_0x7690('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x7690('0x0')]},'sPostalCode':{'type':Sequelize[_0x7690('0x0')]},'sCity':{'type':Sequelize[_0x7690('0x0')]},'sCountry':{'type':Sequelize[_0x7690('0x0')]},'description':{'type':Sequelize[_0x7690('0x0')]}}; \ No newline at end of file +var _0xa8f1=['name','sequelize','exports','STRING'];(function(_0x3ee70c,_0x58e0d4){var _0x1fa06a=function(_0x178165){while(--_0x178165){_0x3ee70c['push'](_0x3ee70c['shift']());}};_0x1fa06a(++_0x58e0d4);}(_0xa8f1,0x99));var _0x1a8f=function(_0x135cf5,_0x5e4072){_0x135cf5=_0x135cf5-0x0;var _0x280981=_0xa8f1[_0x135cf5];return _0x280981;};'use strict';var Sequelize=require(_0x1a8f('0x0'));module[_0x1a8f('0x1')]={'name':{'type':Sequelize[_0x1a8f('0x2')],'unique':_0x1a8f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1a8f('0x2')]},'companyId':{'type':Sequelize[_0x1a8f('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1a8f('0x2')]},'fax':{'type':Sequelize[_0x1a8f('0x2')]},'type':{'type':Sequelize[_0x1a8f('0x2')]},'street':{'type':Sequelize[_0x1a8f('0x2')]},'postalCode':{'type':Sequelize[_0x1a8f('0x2')]},'city':{'type':Sequelize[_0x1a8f('0x2')]},'country':{'type':Sequelize[_0x1a8f('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1a8f('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x1a8f('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a8f('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2324160..306c68c 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 _0x5736=['filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','describe','addContacts','CmContact','ids','omit','getContacts','fields','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','Companies','UserProfileResource','end','error','name','send','render','merge','contact','interaction','account','index','CmCompany','query','keys'];(function(_0x1ad584,_0x42c84d){var _0x4af40f=function(_0x462f0a){while(--_0x462f0a){_0x1ad584['push'](_0x1ad584['shift']());}};_0x4af40f(++_0x42c84d);}(_0x5736,0x13c));var _0x6573=function(_0x393083,_0x42154f){_0x393083=_0x393083-0x0;var _0x5f2fc6=_0x5736[_0x393083];return _0x5f2fc6;};'use strict';var emlformat=require(_0x6573('0x0'));var rimraf=require(_0x6573('0x1'));var zipdir=require(_0x6573('0x2'));var jsonpatch=require(_0x6573('0x3'));var rp=require(_0x6573('0x4'));var moment=require(_0x6573('0x5'));var BPromise=require(_0x6573('0x6'));var Mustache=require(_0x6573('0x7'));var util=require(_0x6573('0x8'));var path=require(_0x6573('0x9'));var sox=require('sox');var csv=require(_0x6573('0xa'));var ejs=require(_0x6573('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6573('0xc'));var crypto=require('crypto');var jsforce=require(_0x6573('0xd'));var deskjs=require(_0x6573('0xe'));var toCsv=require(_0x6573('0xa'));var querystring=require(_0x6573('0xf'));var Papa=require(_0x6573('0x10'));var Redis=require('ioredis');var authService=require(_0x6573('0x11'));var qs=require(_0x6573('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6573('0x13'))('api');var utils=require(_0x6573('0x14'));var config=require(_0x6573('0x15'));var licenseUtil=require(_0x6573('0x16'));var db=require(_0x6573('0x17'))['db'];function respondWithStatusCode(_0x445862,_0x11ccfe){_0x11ccfe=_0x11ccfe||0xcc;return function(_0x2656be){if(_0x2656be){return _0x445862[_0x6573('0x18')](_0x11ccfe);}return _0x445862['status'](_0x11ccfe)['end']();};}function respondWithResult(_0xc232f2,_0x1d5246){_0x1d5246=_0x1d5246||0xc8;return function(_0x2045c2){if(_0x2045c2){return _0xc232f2[_0x6573('0x19')](_0x1d5246)[_0x6573('0x1a')](_0x2045c2);}};}function respondWithFilteredResult(_0x1b99c5,_0x18f530){return function(_0x283612){if(_0x283612){var _0x3a335a=typeof _0x18f530[_0x6573('0x1b')]===_0x6573('0x1c')&&typeof _0x18f530['limit']===_0x6573('0x1c');var _0x55b6fb=_0x283612[_0x6573('0x1d')];var _0x365355=_0x3a335a?0x0:_0x18f530[_0x6573('0x1b')];var _0x59b978=_0x3a335a?_0x283612[_0x6573('0x1d')]:_0x18f530[_0x6573('0x1b')]+_0x18f530[_0x6573('0x1e')];var _0x2801e2;if(_0x59b978>=_0x55b6fb){_0x59b978=_0x55b6fb;_0x2801e2=0xc8;}else{_0x2801e2=0xce;}_0x1b99c5[_0x6573('0x19')](_0x2801e2);return _0x1b99c5[_0x6573('0x1f')](_0x6573('0x20'),_0x365355+'-'+_0x59b978+'/'+_0x55b6fb)[_0x6573('0x1a')](_0x283612);}return null;};}function patchUpdates(_0x1b8681){return function(_0x5c43dd){try{jsonpatch[_0x6573('0x21')](_0x5c43dd,_0x1b8681,!![]);}catch(_0x87a880){return BPromise['reject'](_0x87a880);}return _0x5c43dd[_0x6573('0x22')]();};}function saveUpdates(_0x527926,_0x2de13d){return function(_0x49d6b7){if(_0x49d6b7){return _0x49d6b7['update'](_0x527926)[_0x6573('0x23')](function(_0x52e0b9){return _0x52e0b9;});}return null;};}function removeEntity(_0x560571,_0x23e5e7){return function(_0x4319bb){if(_0x4319bb){return _0x4319bb[_0x6573('0x24')]()[_0x6573('0x23')](function(){var _0x365c51=_0x4319bb['get']({'plain':!![]});var _0xf3074d=_0x6573('0x25');return db[_0x6573('0x26')][_0x6573('0x24')]({'where':{'type':_0xf3074d,'resourceId':_0x365c51['id']}})[_0x6573('0x23')](function(){return _0x4319bb;});})[_0x6573('0x23')](function(){_0x560571[_0x6573('0x19')](0xcc)[_0x6573('0x27')]();});}};}function handleEntityNotFound(_0x58accd,_0x392780){return function(_0x31ed39){if(!_0x31ed39){_0x58accd[_0x6573('0x18')](0x194);}return _0x31ed39;};}function handleError(_0x35cfc6,_0x545426){_0x545426=_0x545426||0x1f4;return function(_0x2d0c39){logger[_0x6573('0x28')](_0x2d0c39['stack']);if(_0x2d0c39[_0x6573('0x29')]){delete _0x2d0c39[_0x6573('0x29')];}_0x35cfc6[_0x6573('0x19')](_0x545426)[_0x6573('0x2a')](_0x2d0c39);};}function getMustacheRender(_0xb4900e,_0x2ee8e6){return Mustache[_0x6573('0x2b')](_0xb4900e,_[_0x6573('0x2c')](_0x2ee8e6['body'],{'contact':_0x2ee8e6[_0x6573('0x2d')],'message':_0x2ee8e6['message'],'agent':_0x2ee8e6['agent'],'interaction':_0x2ee8e6[_0x6573('0x2e')],'account':_0x2ee8e6[_0x6573('0x2f')]}))||'';}exports[_0x6573('0x30')]=function(_0x27fc5c,_0x30fdff){var _0x4db6fe={},_0xaaf790={},_0x5383d6={'count':0x0,'rows':[]};return db[_0x6573('0x31')]['describe']()[_0x6573('0x23')](function(_0x5caf2f){_0xaaf790['model']=_['keys'](_0x5caf2f);_0xaaf790[_0x6573('0x32')]=_[_0x6573('0x33')](_0x27fc5c[_0x6573('0x32')]);_0xaaf790[_0x6573('0x34')]=_[_0x6573('0x35')](_0xaaf790[_0x6573('0x36')],_0xaaf790['query']);_0x4db6fe['attributes']=_[_0x6573('0x35')](_0xaaf790[_0x6573('0x36')],qs['fields'](_0x27fc5c[_0x6573('0x32')]['fields']));_0x4db6fe[_0x6573('0x37')]=_0x4db6fe[_0x6573('0x37')]['length']?_0x4db6fe[_0x6573('0x37')]:_0xaaf790['model'];if(!_0x27fc5c[_0x6573('0x32')][_0x6573('0x38')](_0x6573('0x39'))){_0x4db6fe[_0x6573('0x1e')]=qs[_0x6573('0x1e')](_0x27fc5c['query'][_0x6573('0x1e')]);_0x4db6fe[_0x6573('0x1b')]=qs['offset'](_0x27fc5c[_0x6573('0x32')][_0x6573('0x1b')]);}_0x4db6fe[_0x6573('0x3a')]=qs['sort'](_0x27fc5c['query'][_0x6573('0x3b')]);_0x4db6fe[_0x6573('0x3c')]=qs['filters'](_[_0x6573('0x3d')](_0x27fc5c[_0x6573('0x32')],_0xaaf790['filters']),_0x5caf2f);if(_0x27fc5c[_0x6573('0x32')][_0x6573('0x3e')]){_0x4db6fe[_0x6573('0x3c')]=_['merge'](_0x4db6fe['where'],{'$or':_['map'](_0x4db6fe[_0x6573('0x37')],function(_0x3f062c){var _0x16a50c={};_0x16a50c[_0x3f062c]={'$like':'%'+_0x27fc5c[_0x6573('0x32')][_0x6573('0x3e')]+'%'};return _0x16a50c;})});}_0x4db6fe=_[_0x6573('0x2c')]({},_0x4db6fe,_0x27fc5c[_0x6573('0x3f')]);var _0x1bc30e={'where':_0x4db6fe[_0x6573('0x3c')]};return db['CmCompany'][_0x6573('0x1d')](_0x1bc30e)['then'](function(_0x4a739c){_0x5383d6['count']=_0x4a739c;if(_0x27fc5c[_0x6573('0x32')][_0x6573('0x40')]){_0x4db6fe[_0x6573('0x41')]=[{'all':!![]}];}return db['CmCompany'][_0x6573('0x42')](_0x4db6fe);})[_0x6573('0x23')](function(_0x5e1ff7){_0x5383d6[_0x6573('0x43')]=_0x5e1ff7;return _0x5383d6;})[_0x6573('0x23')](respondWithFilteredResult(_0x30fdff,_0x4db6fe))[_0x6573('0x44')](handleError(_0x30fdff,null));})[_0x6573('0x44')](handleError(_0x30fdff,null));};exports[_0x6573('0x45')]=function(_0x5e2115,_0x31a58d){var _0x363ef3={'raw':![],'where':{'id':_0x5e2115[_0x6573('0x46')]['id']}},_0x5d7651={};_0x5d7651[_0x6573('0x36')]=_['keys'](db[_0x6573('0x31')][_0x6573('0x47')]);_0x5d7651['query']=_[_0x6573('0x33')](_0x5e2115[_0x6573('0x32')]);_0x5d7651['filters']=_[_0x6573('0x35')](_0x5d7651[_0x6573('0x36')],_0x5d7651[_0x6573('0x32')]);_0x363ef3['attributes']=_[_0x6573('0x35')](_0x5d7651[_0x6573('0x36')],qs['fields'](_0x5e2115['query']['fields']));_0x363ef3[_0x6573('0x37')]=_0x363ef3['attributes'][_0x6573('0x48')]?_0x363ef3[_0x6573('0x37')]:_0x5d7651['model'];if(_0x5e2115[_0x6573('0x32')]['includeAll']){_0x363ef3[_0x6573('0x41')]=[{'all':!![]}];}_0x363ef3=_['merge']({},_0x363ef3,_0x5e2115['options']);return db[_0x6573('0x31')][_0x6573('0x49')](_0x363ef3)['then'](handleEntityNotFound(_0x31a58d,null))['then'](respondWithResult(_0x31a58d,null))[_0x6573('0x44')](handleError(_0x31a58d,null));};exports['create']=function(_0x5d3026,_0x3f858f){return db['CmCompany'][_0x6573('0x4a')](_0x5d3026[_0x6573('0x4b')],{})[_0x6573('0x23')](function(_0x4198ea){var _0x3bc348=_0x5d3026['user'][_0x6573('0x4c')]({'plain':!![]});if(!_0x3bc348)throw new Error(_0x6573('0x4d'));if(_0x3bc348[_0x6573('0x4e')]===_0x6573('0x4f')){var _0x2c87a8=_0x4198ea[_0x6573('0x4c')]({'plain':!![]});var _0x104575=_0x6573('0x25');return db[_0x6573('0x50')][_0x6573('0x49')]({'where':{'name':_0x104575,'userProfileId':_0x3bc348[_0x6573('0x51')]},'raw':!![]})[_0x6573('0x23')](function(_0x5cd70b){if(_0x5cd70b&&_0x5cd70b[_0x6573('0x52')]===0x0){return db[_0x6573('0x26')]['create']({'name':_0x2c87a8[_0x6573('0x29')],'resourceId':_0x2c87a8['id'],'type':_0x5cd70b['name'],'sectionId':_0x5cd70b['id']},{})[_0x6573('0x23')](function(){return _0x4198ea;});}else{return _0x4198ea;}})[_0x6573('0x44')](function(_0x3f9fba){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f9fba);throw _0x3f9fba;});}return _0x4198ea;})['then'](respondWithResult(_0x3f858f,0xc9))[_0x6573('0x44')](handleError(_0x3f858f,null));};exports[_0x6573('0x53')]=function(_0x1864bc,_0x4aa67d){if(_0x1864bc[_0x6573('0x4b')]['id']){delete _0x1864bc['body']['id'];}return db[_0x6573('0x31')][_0x6573('0x49')]({'where':{'id':_0x1864bc['params']['id']}})[_0x6573('0x23')](handleEntityNotFound(_0x4aa67d,null))[_0x6573('0x23')](saveUpdates(_0x1864bc[_0x6573('0x4b')],null))[_0x6573('0x23')](respondWithResult(_0x4aa67d,null))[_0x6573('0x44')](handleError(_0x4aa67d,null));};exports[_0x6573('0x24')]=function(_0x32043b,_0x7011){return db[_0x6573('0x31')]['find']({'where':{'id':_0x32043b[_0x6573('0x46')]['id']}})[_0x6573('0x23')](handleEntityNotFound(_0x7011,null))[_0x6573('0x23')](removeEntity(_0x7011,null))[_0x6573('0x44')](handleError(_0x7011,null));};exports[_0x6573('0x54')]=function(_0x4d5dcf,_0x5912f9){return db[_0x6573('0x31')][_0x6573('0x54')]()[_0x6573('0x23')](respondWithResult(_0x5912f9,null))[_0x6573('0x44')](handleError(_0x5912f9,null));};exports[_0x6573('0x55')]=function(_0x5de8e6,_0x3adf2b,_0xefc726){return db[_0x6573('0x56')][_0x6573('0x49')]({'where':{'id':_0x5de8e6[_0x6573('0x46')]['id']}})['then'](handleEntityNotFound(_0x3adf2b,null))['then'](function(_0x3608fc){if(_0x3608fc){return _0x3608fc[_0x6573('0x55')](_0x5de8e6[_0x6573('0x4b')][_0x6573('0x57')],_[_0x6573('0x58')](_0x5de8e6[_0x6573('0x4b')],[_0x6573('0x57'),'id'])||{});}})[_0x6573('0x23')](respondWithResult(_0x3adf2b,null))['catch'](handleError(_0x3adf2b,null));};exports[_0x6573('0x59')]=function(_0x20af89,_0x37e5b6,_0x4653a3){var _0x3dab66={};var _0x49b06e={};var _0x50d753;var _0x3310e5;return db[_0x6573('0x31')]['findOne']({'where':{'id':_0x20af89[_0x6573('0x46')]['id']}})[_0x6573('0x23')](handleEntityNotFound(_0x37e5b6,null))[_0x6573('0x23')](function(_0x52b3d6){if(_0x52b3d6){_0x50d753=_0x52b3d6;_0x49b06e[_0x6573('0x36')]=_['keys'](db[_0x6573('0x56')][_0x6573('0x47')]);_0x49b06e[_0x6573('0x32')]=_[_0x6573('0x33')](_0x20af89['query']);_0x49b06e[_0x6573('0x34')]=_[_0x6573('0x35')](_0x49b06e[_0x6573('0x36')],_0x49b06e['query']);_0x3dab66[_0x6573('0x37')]=_[_0x6573('0x35')](_0x49b06e['model'],qs[_0x6573('0x5a')](_0x20af89[_0x6573('0x32')]['fields']));_0x3dab66[_0x6573('0x37')]=_0x3dab66[_0x6573('0x37')][_0x6573('0x48')]?_0x3dab66['attributes']:_0x49b06e[_0x6573('0x36')];_0x3dab66[_0x6573('0x3a')]=qs[_0x6573('0x3b')](_0x20af89[_0x6573('0x32')][_0x6573('0x3b')]);_0x3dab66[_0x6573('0x3c')]=qs[_0x6573('0x34')](_[_0x6573('0x3d')](_0x20af89[_0x6573('0x32')],_0x49b06e[_0x6573('0x34')]));if(_0x20af89[_0x6573('0x32')][_0x6573('0x3e')]){_0x3dab66[_0x6573('0x3c')]=_[_0x6573('0x2c')](_0x3dab66[_0x6573('0x3c')],{'$or':_[_0x6573('0x5b')](_0x3dab66[_0x6573('0x37')],function(_0x522510){var _0x1c0adb={};_0x1c0adb[_0x522510]={'$like':'%'+_0x20af89['query']['filter']+'%'};return _0x1c0adb;})});}_0x3dab66=_['merge']({},_0x3dab66,_0x20af89[_0x6573('0x3f')]);return _0x50d753[_0x6573('0x59')](_0x3dab66);}})[_0x6573('0x23')](function(_0xe828f1){if(_0xe828f1){_0x3310e5=_0xe828f1[_0x6573('0x48')];if(!_0x20af89[_0x6573('0x32')]['hasOwnProperty'](_0x6573('0x39'))){_0x3dab66[_0x6573('0x1e')]=qs['limit'](_0x20af89['query'][_0x6573('0x1e')]);_0x3dab66[_0x6573('0x1b')]=qs['offset'](_0x20af89[_0x6573('0x32')][_0x6573('0x1b')]);}return _0x50d753['getContacts'](_0x3dab66);}})['then'](function(_0x5ee93a){if(_0x5ee93a){return _0x5ee93a?{'count':_0x3310e5,'rows':_0x5ee93a}:null;}})[_0x6573('0x23')](respondWithResult(_0x37e5b6,null))[_0x6573('0x44')](handleError(_0x37e5b6,null));}; \ No newline at end of file +var _0x033a=['desk.js','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','then','Companies','destroy','error','name','body','contact','message','interaction','account','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addContacts','CmContact','ids','omit','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto'];(function(_0x3edd9a,_0x1dddcc){var _0x258cd1=function(_0x2d9273){while(--_0x2d9273){_0x3edd9a['push'](_0x3edd9a['shift']());}};_0x258cd1(++_0x1dddcc);}(_0x033a,0x19d));var _0xa033=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x033a[_0x4a3898];return _0x25ceb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa033('0x0'));var zipdir=require(_0xa033('0x1'));var jsonpatch=require(_0xa033('0x2'));var rp=require(_0xa033('0x3'));var moment=require('moment');var BPromise=require(_0xa033('0x4'));var Mustache=require(_0xa033('0x5'));var util=require('util');var path=require(_0xa033('0x6'));var sox=require(_0xa033('0x7'));var csv=require(_0xa033('0x8'));var ejs=require(_0xa033('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa033('0xa'));var crypto=require(_0xa033('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa033('0xc'));var toCsv=require(_0xa033('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa033('0xd'));var authService=require(_0xa033('0xe'));var qs=require(_0xa033('0xf'));var as=require(_0xa033('0x10'));var hardwareService=require(_0xa033('0x11'));var logger=require('../../config/logger')(_0xa033('0x12'));var utils=require('../../config/utils');var config=require(_0xa033('0x13'));var licenseUtil=require(_0xa033('0x14'));var db=require(_0xa033('0x15'))['db'];function respondWithStatusCode(_0x23807f,_0x101777){_0x101777=_0x101777||0xcc;return function(_0x3eb052){if(_0x3eb052){return _0x23807f[_0xa033('0x16')](_0x101777);}return _0x23807f[_0xa033('0x17')](_0x101777)[_0xa033('0x18')]();};}function respondWithResult(_0x1af8a3,_0x5367ab){_0x5367ab=_0x5367ab||0xc8;return function(_0x1ae8a6){if(_0x1ae8a6){return _0x1af8a3['status'](_0x5367ab)[_0xa033('0x19')](_0x1ae8a6);}};}function respondWithFilteredResult(_0x353cfd,_0x2436cf){return function(_0x491151){if(_0x491151){var _0x184392=typeof _0x2436cf[_0xa033('0x1a')]===_0xa033('0x1b')&&typeof _0x2436cf[_0xa033('0x1c')]===_0xa033('0x1b');var _0x484548=_0x491151[_0xa033('0x1d')];var _0xb7fb3=_0x184392?0x0:_0x2436cf[_0xa033('0x1a')];var _0x3b172c=_0x184392?_0x491151[_0xa033('0x1d')]:_0x2436cf[_0xa033('0x1a')]+_0x2436cf[_0xa033('0x1c')];var _0x55e16a;if(_0x3b172c>=_0x484548){_0x3b172c=_0x484548;_0x55e16a=0xc8;}else{_0x55e16a=0xce;}_0x353cfd[_0xa033('0x17')](_0x55e16a);return _0x353cfd['set'](_0xa033('0x1e'),_0xb7fb3+'-'+_0x3b172c+'/'+_0x484548)[_0xa033('0x19')](_0x491151);}return null;};}function patchUpdates(_0xbdcab3){return function(_0x359d9b){try{jsonpatch[_0xa033('0x1f')](_0x359d9b,_0xbdcab3,!![]);}catch(_0x420245){return BPromise['reject'](_0x420245);}return _0x359d9b[_0xa033('0x20')]();};}function saveUpdates(_0x4440e3,_0x3f7111){return function(_0x4c8922){if(_0x4c8922){return _0x4c8922[_0xa033('0x21')](_0x4440e3)[_0xa033('0x22')](function(_0x581c89){return _0x581c89;});}return null;};}function removeEntity(_0x89d2ec,_0x3ceace){return function(_0x21d8f1){if(_0x21d8f1){return _0x21d8f1['destroy']()['then'](function(){var _0x30a6a3=_0x21d8f1['get']({'plain':!![]});var _0x2fcdbd=_0xa033('0x23');return db['UserProfileResource'][_0xa033('0x24')]({'where':{'type':_0x2fcdbd,'resourceId':_0x30a6a3['id']}})[_0xa033('0x22')](function(){return _0x21d8f1;});})[_0xa033('0x22')](function(){_0x89d2ec[_0xa033('0x17')](0xcc)[_0xa033('0x18')]();});}};}function handleEntityNotFound(_0xf51779,_0x16d9c1){return function(_0x59b93b){if(!_0x59b93b){_0xf51779['sendStatus'](0x194);}return _0x59b93b;};}function handleError(_0x491428,_0x122997){_0x122997=_0x122997||0x1f4;return function(_0x5aa7f9){logger[_0xa033('0x25')](_0x5aa7f9['stack']);if(_0x5aa7f9[_0xa033('0x26')]){delete _0x5aa7f9[_0xa033('0x26')];}_0x491428[_0xa033('0x17')](_0x122997)['send'](_0x5aa7f9);};}function getMustacheRender(_0xc49c69,_0x176255){return Mustache['render'](_0xc49c69,_['merge'](_0x176255[_0xa033('0x27')],{'contact':_0x176255[_0xa033('0x28')],'message':_0x176255[_0xa033('0x29')],'agent':_0x176255['agent'],'interaction':_0x176255[_0xa033('0x2a')],'account':_0x176255[_0xa033('0x2b')]}))||'';}exports[_0xa033('0x2c')]=function(_0x56aa8e,_0x302923){var _0x5a60e4={},_0x280cb8={},_0x2a6c8c={'count':0x0,'rows':[]};return db[_0xa033('0x2d')]['describe']()[_0xa033('0x22')](function(_0x1a6881){_0x280cb8[_0xa033('0x2e')]=_[_0xa033('0x2f')](_0x1a6881);_0x280cb8[_0xa033('0x30')]=_['keys'](_0x56aa8e['query']);_0x280cb8[_0xa033('0x31')]=_[_0xa033('0x32')](_0x280cb8[_0xa033('0x2e')],_0x280cb8[_0xa033('0x30')]);_0x5a60e4[_0xa033('0x33')]=_[_0xa033('0x32')](_0x280cb8['model'],qs['fields'](_0x56aa8e[_0xa033('0x30')][_0xa033('0x34')]));_0x5a60e4['attributes']=_0x5a60e4['attributes'][_0xa033('0x35')]?_0x5a60e4[_0xa033('0x33')]:_0x280cb8[_0xa033('0x2e')];if(!_0x56aa8e[_0xa033('0x30')][_0xa033('0x36')](_0xa033('0x37'))){_0x5a60e4[_0xa033('0x1c')]=qs['limit'](_0x56aa8e[_0xa033('0x30')][_0xa033('0x1c')]);_0x5a60e4['offset']=qs[_0xa033('0x1a')](_0x56aa8e['query']['offset']);}_0x5a60e4[_0xa033('0x38')]=qs[_0xa033('0x39')](_0x56aa8e['query'][_0xa033('0x39')]);_0x5a60e4[_0xa033('0x3a')]=qs['filters'](_[_0xa033('0x3b')](_0x56aa8e[_0xa033('0x30')],_0x280cb8[_0xa033('0x31')]),_0x1a6881);if(_0x56aa8e['query'][_0xa033('0x3c')]){_0x5a60e4[_0xa033('0x3a')]=_['merge'](_0x5a60e4[_0xa033('0x3a')],{'$or':_[_0xa033('0x3d')](_0x5a60e4['attributes'],function(_0x46e646){var _0x4d158b={};_0x4d158b[_0x46e646]={'$like':'%'+_0x56aa8e[_0xa033('0x30')][_0xa033('0x3c')]+'%'};return _0x4d158b;})});}_0x5a60e4=_[_0xa033('0x3e')]({},_0x5a60e4,_0x56aa8e[_0xa033('0x3f')]);var _0x487ecf={'where':_0x5a60e4[_0xa033('0x3a')]};return db[_0xa033('0x2d')]['count'](_0x487ecf)[_0xa033('0x22')](function(_0x11a4a5){_0x2a6c8c[_0xa033('0x1d')]=_0x11a4a5;if(_0x56aa8e['query'][_0xa033('0x40')]){_0x5a60e4[_0xa033('0x41')]=[{'all':!![]}];}return db[_0xa033('0x2d')]['findAll'](_0x5a60e4);})[_0xa033('0x22')](function(_0x37092a){_0x2a6c8c[_0xa033('0x42')]=_0x37092a;return _0x2a6c8c;})[_0xa033('0x22')](respondWithFilteredResult(_0x302923,_0x5a60e4))[_0xa033('0x43')](handleError(_0x302923,null));})[_0xa033('0x43')](handleError(_0x302923,null));};exports[_0xa033('0x44')]=function(_0x4c3b01,_0x9ceb16){var _0x42b9f8={'raw':![],'where':{'id':_0x4c3b01[_0xa033('0x45')]['id']}},_0xe2ebbb={};_0xe2ebbb[_0xa033('0x2e')]=_[_0xa033('0x2f')](db[_0xa033('0x2d')][_0xa033('0x46')]);_0xe2ebbb['query']=_[_0xa033('0x2f')](_0x4c3b01[_0xa033('0x30')]);_0xe2ebbb[_0xa033('0x31')]=_[_0xa033('0x32')](_0xe2ebbb[_0xa033('0x2e')],_0xe2ebbb['query']);_0x42b9f8[_0xa033('0x33')]=_[_0xa033('0x32')](_0xe2ebbb[_0xa033('0x2e')],qs[_0xa033('0x34')](_0x4c3b01['query']['fields']));_0x42b9f8['attributes']=_0x42b9f8['attributes'][_0xa033('0x35')]?_0x42b9f8[_0xa033('0x33')]:_0xe2ebbb[_0xa033('0x2e')];if(_0x4c3b01[_0xa033('0x30')][_0xa033('0x40')]){_0x42b9f8['include']=[{'all':!![]}];}_0x42b9f8=_[_0xa033('0x3e')]({},_0x42b9f8,_0x4c3b01[_0xa033('0x3f')]);return db[_0xa033('0x2d')]['find'](_0x42b9f8)[_0xa033('0x22')](handleEntityNotFound(_0x9ceb16,null))[_0xa033('0x22')](respondWithResult(_0x9ceb16,null))[_0xa033('0x43')](handleError(_0x9ceb16,null));};exports[_0xa033('0x47')]=function(_0x4f25e1,_0x236e53){return db[_0xa033('0x2d')][_0xa033('0x47')](_0x4f25e1['body'],{})[_0xa033('0x22')](function(_0x232b68){var _0x3bc6c3=_0x4f25e1[_0xa033('0x48')][_0xa033('0x49')]({'plain':!![]});if(!_0x3bc6c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bc6c3['role']===_0xa033('0x48')){var _0x5db3a4=_0x232b68[_0xa033('0x49')]({'plain':!![]});var _0x3cae07='Companies';return db[_0xa033('0x4a')]['find']({'where':{'name':_0x3cae07,'userProfileId':_0x3bc6c3['userProfileId']},'raw':!![]})['then'](function(_0x2d7957){if(_0x2d7957&&_0x2d7957[_0xa033('0x4b')]===0x0){return db[_0xa033('0x4c')][_0xa033('0x47')]({'name':_0x5db3a4[_0xa033('0x26')],'resourceId':_0x5db3a4['id'],'type':_0x2d7957[_0xa033('0x26')],'sectionId':_0x2d7957['id']},{})[_0xa033('0x22')](function(){return _0x232b68;});}else{return _0x232b68;}})[_0xa033('0x43')](function(_0x382cf1){logger[_0xa033('0x25')](_0xa033('0x4d'),_0x382cf1);throw _0x382cf1;});}return _0x232b68;})['then'](respondWithResult(_0x236e53,0xc9))[_0xa033('0x43')](handleError(_0x236e53,null));};exports['update']=function(_0x2f641e,_0xbf06a6){if(_0x2f641e[_0xa033('0x27')]['id']){delete _0x2f641e[_0xa033('0x27')]['id'];}return db[_0xa033('0x2d')][_0xa033('0x4e')]({'where':{'id':_0x2f641e[_0xa033('0x45')]['id']}})[_0xa033('0x22')](handleEntityNotFound(_0xbf06a6,null))['then'](saveUpdates(_0x2f641e[_0xa033('0x27')],null))['then'](respondWithResult(_0xbf06a6,null))[_0xa033('0x43')](handleError(_0xbf06a6,null));};exports['destroy']=function(_0x5d879e,_0x30db57){return db[_0xa033('0x2d')][_0xa033('0x4e')]({'where':{'id':_0x5d879e[_0xa033('0x45')]['id']}})[_0xa033('0x22')](handleEntityNotFound(_0x30db57,null))[_0xa033('0x22')](removeEntity(_0x30db57,null))[_0xa033('0x43')](handleError(_0x30db57,null));};exports[_0xa033('0x4f')]=function(_0x5dc8b5,_0x4f607a){return db[_0xa033('0x2d')]['describe']()[_0xa033('0x22')](respondWithResult(_0x4f607a,null))[_0xa033('0x43')](handleError(_0x4f607a,null));};exports[_0xa033('0x50')]=function(_0x3b61cc,_0x54536e,_0x535d49){return db[_0xa033('0x51')]['find']({'where':{'id':_0x3b61cc[_0xa033('0x45')]['id']}})[_0xa033('0x22')](handleEntityNotFound(_0x54536e,null))[_0xa033('0x22')](function(_0x264945){if(_0x264945){return _0x264945[_0xa033('0x50')](_0x3b61cc[_0xa033('0x27')][_0xa033('0x52')],_[_0xa033('0x53')](_0x3b61cc[_0xa033('0x27')],[_0xa033('0x52'),'id'])||{});}})[_0xa033('0x22')](respondWithResult(_0x54536e,null))['catch'](handleError(_0x54536e,null));};exports[_0xa033('0x54')]=function(_0x25b615,_0x37196f,_0x32daa4){var _0x2b4d22={};var _0x2cc738={};var _0x18e5a0;var _0xe930e8;return db['CmCompany']['findOne']({'where':{'id':_0x25b615[_0xa033('0x45')]['id']}})[_0xa033('0x22')](handleEntityNotFound(_0x37196f,null))['then'](function(_0x4806e9){if(_0x4806e9){_0x18e5a0=_0x4806e9;_0x2cc738[_0xa033('0x2e')]=_['keys'](db[_0xa033('0x51')][_0xa033('0x46')]);_0x2cc738[_0xa033('0x30')]=_['keys'](_0x25b615[_0xa033('0x30')]);_0x2cc738[_0xa033('0x31')]=_[_0xa033('0x32')](_0x2cc738[_0xa033('0x2e')],_0x2cc738[_0xa033('0x30')]);_0x2b4d22[_0xa033('0x33')]=_[_0xa033('0x32')](_0x2cc738[_0xa033('0x2e')],qs[_0xa033('0x34')](_0x25b615['query']['fields']));_0x2b4d22[_0xa033('0x33')]=_0x2b4d22[_0xa033('0x33')]['length']?_0x2b4d22[_0xa033('0x33')]:_0x2cc738[_0xa033('0x2e')];_0x2b4d22[_0xa033('0x38')]=qs[_0xa033('0x39')](_0x25b615[_0xa033('0x30')][_0xa033('0x39')]);_0x2b4d22[_0xa033('0x3a')]=qs['filters'](_[_0xa033('0x3b')](_0x25b615[_0xa033('0x30')],_0x2cc738[_0xa033('0x31')]));if(_0x25b615[_0xa033('0x30')][_0xa033('0x3c')]){_0x2b4d22[_0xa033('0x3a')]=_[_0xa033('0x3e')](_0x2b4d22[_0xa033('0x3a')],{'$or':_[_0xa033('0x3d')](_0x2b4d22[_0xa033('0x33')],function(_0x3a3ce9){var _0x341655={};_0x341655[_0x3a3ce9]={'$like':'%'+_0x25b615[_0xa033('0x30')][_0xa033('0x3c')]+'%'};return _0x341655;})});}_0x2b4d22=_[_0xa033('0x3e')]({},_0x2b4d22,_0x25b615['options']);return _0x18e5a0[_0xa033('0x54')](_0x2b4d22);}})[_0xa033('0x22')](function(_0x44d9bd){if(_0x44d9bd){_0xe930e8=_0x44d9bd[_0xa033('0x35')];if(!_0x25b615['query'][_0xa033('0x36')](_0xa033('0x37'))){_0x2b4d22[_0xa033('0x1c')]=qs[_0xa033('0x1c')](_0x25b615[_0xa033('0x30')][_0xa033('0x1c')]);_0x2b4d22[_0xa033('0x1a')]=qs[_0xa033('0x1a')](_0x25b615[_0xa033('0x30')][_0xa033('0x1a')]);}return _0x18e5a0[_0xa033('0x54')](_0x2b4d22);}})['then'](function(_0x5f6c7c){if(_0x5f6c7c){return _0x5f6c7c?{'count':_0xe930e8,'rows':_0x5f6c7c}:null;}})[_0xa033('0x22')](respondWithResult(_0x37196f,null))[_0xa033('0x43')](handleError(_0x37196f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a616217..f77280e 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 _0x448b=['path','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x448b,0x125));var _0xb448=function(_0x2f51bf,_0x12cb5a){_0x2f51bf=_0x2f51bf-0x0;var _0x3a4d09=_0x448b[_0x2f51bf];return _0x3a4d09;};'use strict';var _=require(_0xb448('0x0'));var util=require(_0xb448('0x1'));var logger=require(_0xb448('0x2'))(_0xb448('0x3'));var moment=require(_0xb448('0x4'));var BPromise=require(_0xb448('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb448('0x6'));var rimraf=require(_0xb448('0x7'));var config=require(_0xb448('0x8'));var attributes=require(_0xb448('0x9'));module[_0xb448('0xa')]=function(_0x276466,_0x3670cb){return _0x276466['define'](_0xb448('0xb'),attributes,{'tableName':_0xb448('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bc3=['./cmCompany.attributes','exports','define','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4735ff,_0x14f93e){var _0x3028d8=function(_0x48df83){while(--_0x48df83){_0x4735ff['push'](_0x4735ff['shift']());}};_0x3028d8(++_0x14f93e);}(_0x4bc3,0x16e));var _0x34bc=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x4bc3[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));module[_0x34bc('0x9')]=function(_0x2cc9c2,_0x4c63a1){return _0x2cc9c2[_0x34bc('0xa')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 89fe624..c65c473 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 _0xf0b9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','CmCompany,\x20%s,\x20%s','message','info','result','util','randomstring','ioredis'];(function(_0x386e88,_0x26ac2e){var _0x2b3208=function(_0x42b498){while(--_0x42b498){_0x386e88['push'](_0x386e88['shift']());}};_0x2b3208(++_0x26ac2e);}(_0xf0b9,0x140));var _0x9f0b=function(_0x304aa0,_0x48b6dd){_0x304aa0=_0x304aa0-0x0;var _0x23fa38=_0xf0b9[_0x304aa0];return _0x23fa38;};'use strict';var _=require('lodash');var util=require(_0x9f0b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f0b('0x1'));var fs=require('fs');var Redis=require(_0x9f0b('0x2'));var db=require(_0x9f0b('0x3'))['db'];var utils=require(_0x9f0b('0x4'));var logger=require(_0x9f0b('0x5'))(_0x9f0b('0x6'));var config=require(_0x9f0b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f0b('0x8')][_0x9f0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20625c,_0x3fa6b7,_0x35ef61){return new BPromise(function(_0x49d1ed,_0x453aa9){return client['request'](_0x20625c,_0x35ef61)['then'](function(_0x167379){logger['info']('CmCompany,\x20%s,\x20%s',_0x3fa6b7,_0x9f0b('0xa'));logger[_0x9f0b('0xb')](_0x9f0b('0xc'),_0x3fa6b7,'request\x20sent',JSON['stringify'](_0x167379));if(_0x167379[_0x9f0b('0xd')]){if(_0x167379['error'][_0x9f0b('0xe')]===0x1f4){logger[_0x9f0b('0xd')](_0x9f0b('0xf'),_0x3fa6b7,_0x167379['error'][_0x9f0b('0x10')]);return _0x453aa9(_0x167379[_0x9f0b('0xd')][_0x9f0b('0x10')]);}logger[_0x9f0b('0xd')](_0x9f0b('0xf'),_0x3fa6b7,_0x167379[_0x9f0b('0xd')]['message']);return _0x49d1ed(_0x167379[_0x9f0b('0xd')][_0x9f0b('0x10')]);}else{logger[_0x9f0b('0x11')](_0x9f0b('0xf'),_0x3fa6b7,'request\x20sent');_0x49d1ed(_0x167379[_0x9f0b('0x12')][_0x9f0b('0x10')]);}})['catch'](function(_0x57d182){logger[_0x9f0b('0xd')](_0x9f0b('0xf'),_0x3fa6b7,_0x57d182);_0x453aa9(_0x57d182);});});} \ No newline at end of file +var _0x7b5f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5944e9,_0xf3da60){var _0x1098b8=function(_0x265f4){while(--_0x265f4){_0x5944e9['push'](_0x5944e9['shift']());}};_0x1098b8(++_0xf3da60);}(_0x7b5f,0x92));var _0xf7b5=function(_0x523cef,_0x3f95e2){_0x523cef=_0x523cef-0x0;var _0x28def2=_0x7b5f[_0x523cef];return _0x28def2;};'use strict';var _=require(_0xf7b5('0x0'));var util=require(_0xf7b5('0x1'));var moment=require(_0xf7b5('0x2'));var BPromise=require(_0xf7b5('0x3'));var rs=require(_0xf7b5('0x4'));var fs=require('fs');var Redis=require(_0xf7b5('0x5'));var db=require(_0xf7b5('0x6'))['db'];var utils=require(_0xf7b5('0x7'));var logger=require(_0xf7b5('0x8'))(_0xf7b5('0x9'));var config=require(_0xf7b5('0xa'));var jayson=require(_0xf7b5('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30a203,_0x5edd90,_0x474a12){return new BPromise(function(_0x56ac37,_0xcc1409){return client[_0xf7b5('0xc')](_0x30a203,_0x474a12)[_0xf7b5('0xd')](function(_0x421a63){logger[_0xf7b5('0xe')](_0xf7b5('0xf'),_0x5edd90,_0xf7b5('0x10'));logger['debug'](_0xf7b5('0x11'),_0x5edd90,'request\x20sent',JSON['stringify'](_0x421a63));if(_0x421a63[_0xf7b5('0x12')]){if(_0x421a63[_0xf7b5('0x12')]['code']===0x1f4){logger[_0xf7b5('0x12')](_0xf7b5('0xf'),_0x5edd90,_0x421a63[_0xf7b5('0x12')][_0xf7b5('0x13')]);return _0xcc1409(_0x421a63[_0xf7b5('0x12')][_0xf7b5('0x13')]);}logger[_0xf7b5('0x12')]('CmCompany,\x20%s,\x20%s',_0x5edd90,_0x421a63['error'][_0xf7b5('0x13')]);return _0x56ac37(_0x421a63['error'][_0xf7b5('0x13')]);}else{logger[_0xf7b5('0xe')](_0xf7b5('0xf'),_0x5edd90,_0xf7b5('0x10'));_0x56ac37(_0x421a63[_0xf7b5('0x14')][_0xf7b5('0x13')]);}})[_0xf7b5('0x15')](function(_0x52d21a){logger[_0xf7b5('0x12')](_0xf7b5('0xf'),_0x5edd90,_0x52d21a);_0xcc1409(_0x52d21a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d260533..b7c5f63 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 _0x42b9=['update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','/:id','/:id/contacts','getContacts','create','post','put'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x42b9,0x17f));var _0x942b=function(_0x59987a,_0x399e11){_0x59987a=_0x59987a-0x0;var _0x460646=_0x42b9[_0x59987a];return _0x460646;};'use strict';var multer=require(_0x942b('0x0'));var util=require(_0x942b('0x1'));var path=require('path');var timeout=require(_0x942b('0x2'));var express=require(_0x942b('0x3'));var router=express[_0x942b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x942b('0x5'));var config=require(_0x942b('0x6'));var controller=require(_0x942b('0x7'));router[_0x942b('0x8')]('/',auth[_0x942b('0x9')](),controller['index']);router[_0x942b('0x8')](_0x942b('0xa'),auth[_0x942b('0x9')](),controller['describe']);router['get'](_0x942b('0xb'),auth[_0x942b('0x9')](),controller['show']);router['get'](_0x942b('0xc'),auth['isAuthenticated'](),controller[_0x942b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x942b('0xe')]);router[_0x942b('0xf')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x942b('0x10')](_0x942b('0xb'),auth[_0x942b('0x9')](),controller[_0x942b('0x11')]);router[_0x942b('0x12')](_0x942b('0xb'),auth['isAuthenticated'](),controller[_0x942b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe6c7=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','getContacts','create','post','addContacts','put','/:id','update','delete','destroy','exports','multer'];(function(_0x1a9c61,_0x4733b1){var _0x39183f=function(_0x4e23a1){while(--_0x4e23a1){_0x1a9c61['push'](_0x1a9c61['shift']());}};_0x39183f(++_0x4733b1);}(_0xe6c7,0x1af));var _0x7e6c=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xe6c7[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0x7e6c('0x0'));var util=require(_0x7e6c('0x1'));var path=require(_0x7e6c('0x2'));var timeout=require(_0x7e6c('0x3'));var express=require('express');var router=express[_0x7e6c('0x4')]();var fs_extra=require(_0x7e6c('0x5'));var auth=require(_0x7e6c('0x6'));var interaction=require(_0x7e6c('0x7'));var config=require(_0x7e6c('0x8'));var controller=require(_0x7e6c('0x9'));router[_0x7e6c('0xa')]('/',auth[_0x7e6c('0xb')](),controller[_0x7e6c('0xc')]);router['get'](_0x7e6c('0xd'),auth['isAuthenticated'](),controller[_0x7e6c('0xe')]);router[_0x7e6c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7e6c('0xf')]);router[_0x7e6c('0xa')](_0x7e6c('0x10'),auth[_0x7e6c('0xb')](),controller[_0x7e6c('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7e6c('0x12')]);router[_0x7e6c('0x13')](_0x7e6c('0x10'),auth[_0x7e6c('0xb')](),controller[_0x7e6c('0x14')]);router[_0x7e6c('0x15')](_0x7e6c('0x16'),auth[_0x7e6c('0xb')](),controller[_0x7e6c('0x17')]);router[_0x7e6c('0x18')](_0x7e6c('0x16'),auth['isAuthenticated'](),controller[_0x7e6c('0x19')]);module[_0x7e6c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 8937499..77217fb 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 _0xa94d=['UNSIGNED','NOW','lodash','sequelize','exports','STRING','INTEGER'];(function(_0x49dfcb,_0x241f6d){var _0x52761b=function(_0x5d007c){while(--_0x5d007c){_0x49dfcb['push'](_0x49dfcb['shift']());}};_0x52761b(++_0x241f6d);}(_0xa94d,0x80));var _0xda94=function(_0x2c5b54,_0x467a1c){_0x2c5b54=_0x2c5b54-0x0;var _0x29138a=_0xa94d[_0x2c5b54];return _0x29138a;};'use strict';var _=require(_0xda94('0x0'));var Sequelize=require(_0xda94('0x1'));module[_0xda94('0x2')]={'firstName':{'type':Sequelize[_0xda94('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xda94('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xda94('0x3')]},'country':{'type':Sequelize[_0xda94('0x3')]},'dateOfBirth':{'type':Sequelize[_0xda94('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xda94('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xda94('0x3')]},'email':{'type':Sequelize[_0xda94('0x3')]},'url':{'type':Sequelize[_0xda94('0x3')]},'facebook':{'type':Sequelize[_0xda94('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xda94('0x3')]},'skype':{'type':Sequelize[_0xda94('0x3')]},'teams':{'type':Sequelize[_0xda94('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xda94('0x3')]},'wechat':{'type':Sequelize[_0xda94('0x3')]},'telegram':{'type':Sequelize[_0xda94('0x3')]},'UserId':{'type':Sequelize[_0xda94('0x4')]},'priority':{'type':Sequelize[_0xda94('0x4')](0x2)[_0xda94('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xda94('0x6')]}}; \ No newline at end of file +var _0x73f8=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','exports'];(function(_0x4eb043,_0x55e8c2){var _0x3da0dc=function(_0x5314e9){while(--_0x5314e9){_0x4eb043['push'](_0x4eb043['shift']());}};_0x3da0dc(++_0x55e8c2);}(_0x73f8,0x156));var _0x873f=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x73f8[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x873f('0x0'));var Sequelize=require('sequelize');module[_0x873f('0x1')]={'firstName':{'type':Sequelize[_0x873f('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x873f('0x2')]},'street':{'type':Sequelize[_0x873f('0x2')]},'postalCode':{'type':Sequelize[_0x873f('0x2')]},'city':{'type':Sequelize[_0x873f('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x873f('0x2')]},'description':{'type':Sequelize[_0x873f('0x3')]},'phone':{'type':Sequelize[_0x873f('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x873f('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x873f('0x2')]},'teams':{'type':Sequelize[_0x873f('0x2')]},'viber':{'type':Sequelize[_0x873f('0x2')]},'line':{'type':Sequelize[_0x873f('0x2')]},'wechat':{'type':Sequelize[_0x873f('0x2')]},'telegram':{'type':Sequelize[_0x873f('0x2')]},'UserId':{'type':Sequelize[_0x873f('0x4')]},'priority':{'type':Sequelize[_0x873f('0x4')](0x2)[_0x873f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x873f('0x6')],'defaultValue':Sequelize[_0x873f('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 4e86049..0626b7a 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 _0x119f=['stack','name','send','body','contact','agent','interaction','account','CmContact','describe','keys','startsWith','cf_','push','CmCustomField','findOne','length','fieldType','type','query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','field','color','from','tools_tags','left_join','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','DATE','buildExpression','text','start','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','QueryTypes','clone','DESC','having','t.id\x20IN\x20?','user','role','some','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','c.firstName','c.lastName','c.phone','c.mobile','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','find','params','catch','tags','columnName','findAll','displayName','alias','values','hasOwnProperty','merge','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','bulkCreate','each','duplicates','$or','spread','show','$and','format','cf_%d','omit','pickBy','table','cm_contacts','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','setTags','ids','options','includeAll','getHopperHistories','getHopperFinals','ContactId','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','pid','upload','createReadStream','parse','binding','firstName','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','startCase','chat','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','osName','ratingType','referer','reverse','slice','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error'];(function(_0x5295d3,_0x3020e4){var _0x3404ca=function(_0x249ae5){while(--_0x249ae5){_0x5295d3['push'](_0x5295d3['shift']());}};_0x3404ca(++_0x3020e4);}(_0x119f,0xf5));var _0xf119=function(_0x4d01f9,_0x5d2388){_0x4d01f9=_0x4d01f9-0x0;var _0x34a38c=_0x119f[_0x4d01f9];return _0x34a38c;};'use strict';var emlformat=require(_0xf119('0x0'));var rimraf=require(_0xf119('0x1'));var zipdir=require(_0xf119('0x2'));var jsonpatch=require(_0xf119('0x3'));var rp=require(_0xf119('0x4'));var moment=require('moment');var BPromise=require(_0xf119('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf119('0x6'));var sox=require('sox');var csv=require(_0xf119('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf119('0x8'));var _=require('lodash');var squel=require(_0xf119('0x9'));var crypto=require(_0xf119('0xa'));var jsforce=require(_0xf119('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf119('0x7'));var querystring=require('querystring');var Papa=require(_0xf119('0xc'));var Redis=require(_0xf119('0xd'));var authService=require(_0xf119('0xe'));var qs=require(_0xf119('0xf'));var as=require(_0xf119('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf119('0x11'))('api');var utils=require(_0xf119('0x12'));var config=require(_0xf119('0x13'));var licenseUtil=require(_0xf119('0x14'));var db=require(_0xf119('0x15'))['db'];config[_0xf119('0x16')]=_[_0xf119('0x17')](config[_0xf119('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xf119('0x18'))(new Redis(config[_0xf119('0x16')]));require('./cmContact.socket')[_0xf119('0x19')](socket);function respondWithStatusCode(_0x42d515,_0x599ac7){_0x599ac7=_0x599ac7||0xcc;return function(_0x26239e){if(_0x26239e){return _0x42d515[_0xf119('0x1a')](_0x599ac7);}return _0x42d515[_0xf119('0x1b')](_0x599ac7)[_0xf119('0x1c')]();};}function respondWithResult(_0xeb20b6,_0x226b25){_0x226b25=_0x226b25||0xc8;return function(_0x274e42){if(_0x274e42){return _0xeb20b6[_0xf119('0x1b')](_0x226b25)['json'](_0x274e42);}};}function respondWithFilteredResult(_0xaf885e,_0x3f3946){return function(_0x145d78){if(_0x145d78){var _0x414eaf=typeof _0x3f3946[_0xf119('0x1d')]===_0xf119('0x1e')&&typeof _0x3f3946[_0xf119('0x1f')]==='undefined';var _0x2678ac=_0x145d78['count'];var _0x53a04d=_0x414eaf?0x0:_0x3f3946['offset'];var _0x53a77b=_0x414eaf?_0x145d78[_0xf119('0x20')]:_0x3f3946[_0xf119('0x1d')]+_0x3f3946['limit'];var _0x43304e;if(_0x53a77b>=_0x2678ac){_0x53a77b=_0x2678ac;_0x43304e=0xc8;}else{_0x43304e=0xce;}_0xaf885e['status'](_0x43304e);return _0xaf885e[_0xf119('0x21')]('Content-Range',_0x53a04d+'-'+_0x53a77b+'/'+_0x2678ac)[_0xf119('0x22')](_0x145d78);}return null;};}function patchUpdates(_0x1ff4e9){return function(_0xe24243){try{jsonpatch['apply'](_0xe24243,_0x1ff4e9,!![]);}catch(_0x371826){return BPromise[_0xf119('0x23')](_0x371826);}return _0xe24243[_0xf119('0x24')]();};}function saveUpdates(_0xb466e0,_0x2994f3){return function(_0x464eb1){if(_0x464eb1){return _0x464eb1[_0xf119('0x25')](_0xb466e0)[_0xf119('0x26')](function(_0x500dec){return _0x500dec;});}return null;};}function removeEntity(_0x460271,_0x2a67e9){return function(_0x557acf){if(_0x557acf){return _0x557acf[_0xf119('0x27')]()['then'](function(){_0x460271[_0xf119('0x1b')](0xcc)[_0xf119('0x1c')]();});}};}function handleEntityNotFound(_0x511a22,_0x599c87){return function(_0x3028a2){if(!_0x3028a2){_0x511a22[_0xf119('0x1a')](0x194);}return _0x3028a2;};}function handleError(_0x8748e9,_0x4f90d6){_0x4f90d6=_0x4f90d6||0x1f4;return function(_0x408b9a){logger[_0xf119('0x28')](_0x408b9a[_0xf119('0x29')]);if(_0x408b9a[_0xf119('0x2a')]){delete _0x408b9a[_0xf119('0x2a')];}_0x8748e9['status'](_0x4f90d6)[_0xf119('0x2b')](_0x408b9a);};}function getMustacheRender(_0x515775,_0x295f54){return Mustache['render'](_0x515775,_['merge'](_0x295f54[_0xf119('0x2c')],{'contact':_0x295f54[_0xf119('0x2d')],'message':_0x295f54['message'],'agent':_0x295f54[_0xf119('0x2e')],'interaction':_0x295f54[_0xf119('0x2f')],'account':_0x295f54[_0xf119('0x30')]}))||'';}exports['index']=function(_0x258894,_0x16d158){var _0x34ecfc={},_0x1c0b48={},_0x3b6ed0={'count':0x0,'rows':[]};return db[_0xf119('0x31')][_0xf119('0x32')]()[_0xf119('0x26')](function(_0x40df08){var _0x980f23=[];for(var _0x2e826c=0x0;_0x2e826c0x1){_0x11c552['or'](_0xf119('0x6e'),qs[_0xf119('0x6f')](_0x25c84d),null);}else{if(qs[_0xf119('0x70')](_0x25c84d)){_0x11c552['or'](_0xf119('0x71'),_0x25c84d+'%');_0x11c552['or'](_0xf119('0x72'),_0x25c84d+'%');_0x11c552['or'](_0xf119('0x73'),_0x25c84d+'%');_0x11c552['or']('c.fax\x20LIKE\x20?',_0x25c84d+'%');}else if(qs[_0xf119('0x74')](_0x25c84d)){_0x11c552['or'](_0xf119('0x75'),_0x25c84d+'%');}else{_0x11c552['or'](_0xf119('0x76'),'%'+_0x25c84d+'%');_0x11c552['or']('c.lastName\x20LIKE\x20?','%'+_0x25c84d+'%');_0x11c552['or'](_0xf119('0x75'),'%'+_0x25c84d+'%');}}}}_0x5e2eb6[_0xf119('0x45')](_0x11c552);_0x5e2eb6[_0xf119('0x77')](_0xf119('0x78'));var _0x1c5982={'type':db['Sequelize'][_0xf119('0x79')]['SELECT'],'raw':!![]};var _0x3836c1=_0x5e2eb6[_0xf119('0x7a')]()['field'](_0xf119('0x78'));if(_0x34ecfc['order']){_0x34ecfc[_0xf119('0x43')][_0xf119('0x56')](function(_0x546bfd){_0x5e2eb6['order']('c.'+_0x546bfd[0x0],_0x546bfd[0x1]===_0xf119('0x7b')?![]:!![]);});}if(!_[_0xf119('0x65')](_0x4bb445)){_0x5e2eb6[_0xf119('0x7c')](_0x1c734c);_0x3836c1[_0xf119('0x45')](_0xf119('0x7d'),_0x4bb445);}BPromise['resolve']()[_0xf119('0x26')](function(){if(!_0xbc6154)return;if(_0x258894[_0xf119('0x7e')][_0xf119('0x7f')]!==_0xf119('0x2e'))return;if(!_[_0xf119('0x80')](_0xbc6154[_0xf119('0x52')],[_0xf119('0x47'),'User'])){return _0x258894['user']['getLists']({'attributes':['id'],'raw':!![]})[_0xf119('0x26')](function(_0x2b91ce){if(_[_0xf119('0x65')](_0x2b91ce)){_0x3836c1[_0xf119('0x45')](_0xf119('0x81'));_0x5e2eb6[_0xf119('0x45')](_0xf119('0x81'));}else{_0x3836c1[_0xf119('0x45')](_0xf119('0x67'),_['map'](_0x2b91ce,'id'));_0x5e2eb6[_0xf119('0x45')]('c.ListId\x20IN\x20?',_['map'](_0x2b91ce,'id'));}});}})[_0xf119('0x26')](function(){if(_0x258894[_0xf119('0x7e')][_0xf119('0x7f')]===_0xf119('0x2e')&&!_0xbc6154&&!_0x258894[_0xf119('0x3c')][_0xf119('0x66')])return[];return db[_0xf119('0x82')]['query'](_0x3836c1[_0xf119('0x83')](),_0x1c5982);})[_0xf119('0x26')](function(_0x3ce88e){_0x3b6ed0[_0xf119('0x20')]=_0x3ce88e['length'];if(_0x3b6ed0['count']===0x0)return[];return db[_0xf119('0x82')][_0xf119('0x3c')](_0x44c3f4['toString'](),_0x1c5982)[_0xf119('0x26')](function(_0x4d52da){_0x227b91=_[_0xf119('0x84')](_0x4d52da,'id');_0x1c5982=_['merge'](_0x1c5982,{'model':db[_0xf119('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x258894[_0xf119('0x3c')][_0xf119('0x41')]){_0x34ecfc[_0xf119('0x3f')][_0xf119('0x56')](function(_0xfbac09){_0x5e2eb6[_0xf119('0x47')]('c.'+_0xfbac09);});}else{_0x5e2eb6[_0xf119('0x47')]('c.id');_0x5e2eb6[_0xf119('0x47')](_0xf119('0x85'));_0x5e2eb6[_0xf119('0x47')](_0xf119('0x86'));_0x5e2eb6['field'](_0xf119('0x87'));_0x5e2eb6[_0xf119('0x47')](_0xf119('0x88'));_0x5e2eb6[_0xf119('0x47')]('c.fax');_0x5e2eb6[_0xf119('0x47')]('c.email');_0x5e2eb6[_0xf119('0x47')](_0xf119('0x89'));_0x5e2eb6[_0xf119('0x47')]('c.createdAt');_0x5e2eb6[_0xf119('0x47')](_0xf119('0x8a'));_0x5e2eb6[_0xf119('0x47')]('c.CompanyId');_0x5e2eb6[_0xf119('0x47')](_0xf119('0x8b'),_0xf119('0x8c'));}if(_0x34ecfc[_0xf119('0x1f')])_0x5e2eb6[_0xf119('0x1f')](_0x34ecfc[_0xf119('0x1f')]);if(_0x34ecfc['offset'])_0x5e2eb6[_0xf119('0x1d')](_0x34ecfc[_0xf119('0x1d')]);return db[_0xf119('0x82')][_0xf119('0x3c')](_0x5e2eb6[_0xf119('0x83')](),_0x1c5982);});})['then'](function(_0x40f7db){_0x40f7db[_0xf119('0x56')](function(_0xeac9e9){if(_0xeac9e9[_0xf119('0x8c')]){_0xeac9e9[_0xf119('0x8d')]=[];_0xeac9e9[_0xf119('0x8c')]['split'](',')[_0xf119('0x56')](function(_0x275c95){_0xeac9e9['Tags'][_0xf119('0x36')](_0x227b91[_0x275c95]);});}delete _0xeac9e9[_0xf119('0x8c')];});_0x3b6ed0[_0xf119('0x8e')]=_0x40f7db;return _0x3b6ed0;})[_0xf119('0x26')](respondWithFilteredResult(_0x16d158,_0x34ecfc));})['catch'](handleError(_0x16d158,null));};exports['destroy']=function(_0x46209c,_0x383a9e){return db[_0xf119('0x31')][_0xf119('0x8f')]({'where':{'id':_0x46209c[_0xf119('0x90')]['id']}})['then'](handleEntityNotFound(_0x383a9e,null))['then'](removeEntity(_0x383a9e,null))[_0xf119('0x91')](handleError(_0x383a9e,null));};exports[_0xf119('0x32')]=function(_0x288a09,_0x4778c6){return db['CmContact']['describe']()[_0xf119('0x26')](function(_0x3514a8){delete _0x3514a8[_0xf119('0x92')];for(var _0x2c988c=0x0;_0x2c988c=_0x487e51){_0x216c65=_0x487e51;_0x4a2ff4=0xc8;}else{_0x4a2ff4=0xce;}_0x4cde9a[_0x19fe('0x1e')](_0x4a2ff4);return _0x4cde9a[_0x19fe('0x24')](_0x19fe('0x25'),_0x5dddd4+'-'+_0x216c65+'/'+_0x487e51)['json'](_0x30fad6);}return null;};}function patchUpdates(_0xe53ef9){return function(_0x4905d9){try{jsonpatch[_0x19fe('0x26')](_0x4905d9,_0xe53ef9,!![]);}catch(_0xbc7d52){return BPromise[_0x19fe('0x27')](_0xbc7d52);}return _0x4905d9[_0x19fe('0x28')]();};}function saveUpdates(_0x3d2079,_0x226742){return function(_0x4017fe){if(_0x4017fe){return _0x4017fe[_0x19fe('0x29')](_0x3d2079)['then'](function(_0x107a27){return _0x107a27;});}return null;};}function removeEntity(_0x143a06,_0x48ab11){return function(_0x43aa23){if(_0x43aa23){return _0x43aa23[_0x19fe('0x2a')]()[_0x19fe('0x2b')](function(){_0x143a06[_0x19fe('0x1e')](0xcc)[_0x19fe('0x2c')]();});}};}function handleEntityNotFound(_0x18ced3,_0x3229f8){return function(_0x38056d){if(!_0x38056d){_0x18ced3[_0x19fe('0x1d')](0x194);}return _0x38056d;};}function handleError(_0x741abe,_0x2b6efc){_0x2b6efc=_0x2b6efc||0x1f4;return function(_0xf3ca1b){logger[_0x19fe('0x2d')](_0xf3ca1b[_0x19fe('0x2e')]);if(_0xf3ca1b[_0x19fe('0x2f')]){delete _0xf3ca1b[_0x19fe('0x2f')];}_0x741abe[_0x19fe('0x1e')](_0x2b6efc)[_0x19fe('0x30')](_0xf3ca1b);};}function getMustacheRender(_0x33b2e2,_0x3162ca){return Mustache[_0x19fe('0x31')](_0x33b2e2,_[_0x19fe('0x32')](_0x3162ca['body'],{'contact':_0x3162ca[_0x19fe('0x33')],'message':_0x3162ca['message'],'agent':_0x3162ca[_0x19fe('0x34')],'interaction':_0x3162ca[_0x19fe('0x35')],'account':_0x3162ca[_0x19fe('0x36')]}))||'';}exports[_0x19fe('0x37')]=function(_0x3e35a4,_0x4fc7a5){var _0x43b5c9={},_0x2248c2={},_0x115c85={'count':0x0,'rows':[]};return db['CmContact'][_0x19fe('0x38')]()[_0x19fe('0x2b')](function(_0x3d31ed){var _0x1f35e8=[];for(var _0x165728=0x0;_0x1657280x1){_0x174410['or'](_0x19fe('0x79'),qs[_0x19fe('0x7a')](_0x358e35),null);}else{if(qs['isNumeric'](_0x358e35)){_0x174410['or'](_0x19fe('0x7b'),_0x358e35+'%');_0x174410['or'](_0x19fe('0x7c'),_0x358e35+'%');_0x174410['or'](_0x19fe('0x7d'),_0x358e35+'%');_0x174410['or']('c.fax\x20LIKE\x20?',_0x358e35+'%');}else if(qs[_0x19fe('0x7e')](_0x358e35)){_0x174410['or'](_0x19fe('0x7f'),_0x358e35+'%');}else{_0x174410['or'](_0x19fe('0x80'),'%'+_0x358e35+'%');_0x174410['or'](_0x19fe('0x81'),'%'+_0x358e35+'%');_0x174410['or'](_0x19fe('0x7f'),'%'+_0x358e35+'%');}}}}_0x4728cb[_0x19fe('0x59')](_0x174410);_0x4728cb['group'](_0x19fe('0x82'));var _0x300a2b={'type':db[_0x19fe('0x83')][_0x19fe('0x84')]['SELECT'],'raw':!![]};var _0x3ae558=_0x4728cb['clone']()[_0x19fe('0x4e')]('c.id');if(_0x43b5c9[_0x19fe('0x4b')]){_0x43b5c9[_0x19fe('0x4b')][_0x19fe('0x61')](function(_0x3b47b6){_0x4728cb['order']('c.'+_0x3b47b6[0x0],_0x3b47b6[0x1]===_0x19fe('0x85')?![]:!![]);});}if(!_[_0x19fe('0x71')](_0x2c9e6d)){_0x4728cb[_0x19fe('0x86')](_0x23c31e);_0x3ae558[_0x19fe('0x59')](_0x19fe('0x87'),_0x2c9e6d);}BPromise[_0x19fe('0x88')]()[_0x19fe('0x2b')](function(){if(!_0x193e03)return;if(_0x3e35a4[_0x19fe('0x89')]['role']!=='agent')return;if(!_[_0x19fe('0x8a')](_0x193e03[_0x19fe('0x5d')],[_0x19fe('0x4e'),'User'])){return _0x3e35a4[_0x19fe('0x89')][_0x19fe('0x8b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3d2fa4){if(_[_0x19fe('0x71')](_0x3d2fa4)){_0x3ae558[_0x19fe('0x59')](_0x19fe('0x8c'));_0x4728cb[_0x19fe('0x59')](_0x19fe('0x8c'));}else{_0x3ae558[_0x19fe('0x59')](_0x19fe('0x8d'),_[_0x19fe('0x60')](_0x3d2fa4,'id'));_0x4728cb['where']('c.ListId\x20IN\x20?',_['map'](_0x3d2fa4,'id'));}});}})['then'](function(){if(_0x3e35a4[_0x19fe('0x89')][_0x19fe('0x8e')]===_0x19fe('0x34')&&!_0x193e03&&!_0x3e35a4[_0x19fe('0x44')][_0x19fe('0x72')])return[];return db[_0x19fe('0x8f')][_0x19fe('0x44')](_0x3ae558[_0x19fe('0x90')](),_0x300a2b);})['then'](function(_0x56dec6){_0x115c85[_0x19fe('0x23')]=_0x56dec6['length'];if(_0x115c85[_0x19fe('0x23')]===0x0)return[];return db[_0x19fe('0x8f')][_0x19fe('0x44')](_0x481e4f[_0x19fe('0x90')](),_0x300a2b)[_0x19fe('0x2b')](function(_0xc11d){_0xfeb4f=_['keyBy'](_0xc11d,'id');_0x300a2b=_[_0x19fe('0x32')](_0x300a2b,{'model':db[_0x19fe('0x91')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3e35a4[_0x19fe('0x44')]['fields']){_0x43b5c9['attributes'][_0x19fe('0x61')](function(_0x156769){_0x4728cb['field']('c.'+_0x156769);});}else{_0x4728cb['field'](_0x19fe('0x82'));_0x4728cb[_0x19fe('0x4e')](_0x19fe('0x92'));_0x4728cb['field']('c.lastName');_0x4728cb[_0x19fe('0x4e')]('c.phone');_0x4728cb[_0x19fe('0x4e')]('c.mobile');_0x4728cb[_0x19fe('0x4e')](_0x19fe('0x93'));_0x4728cb['field'](_0x19fe('0x94'));_0x4728cb[_0x19fe('0x4e')]('c.ListId');_0x4728cb[_0x19fe('0x4e')]('c.createdAt');_0x4728cb[_0x19fe('0x4e')](_0x19fe('0x95'));_0x4728cb[_0x19fe('0x4e')](_0x19fe('0x96'));_0x4728cb['field'](_0x19fe('0x97'),'TagIds');}if(_0x43b5c9[_0x19fe('0x22')])_0x4728cb[_0x19fe('0x22')](_0x43b5c9['limit']);if(_0x43b5c9[_0x19fe('0x20')])_0x4728cb[_0x19fe('0x20')](_0x43b5c9[_0x19fe('0x20')]);return db['sequelize'][_0x19fe('0x44')](_0x4728cb[_0x19fe('0x90')](),_0x300a2b);});})[_0x19fe('0x2b')](function(_0x2d4293){_0x2d4293[_0x19fe('0x61')](function(_0x4c8593){if(_0x4c8593[_0x19fe('0x98')]){_0x4c8593[_0x19fe('0x99')]=[];_0x4c8593['TagIds'][_0x19fe('0x78')](',')[_0x19fe('0x61')](function(_0x384e9f){_0x4c8593[_0x19fe('0x99')]['push'](_0xfeb4f[_0x384e9f]);});}delete _0x4c8593[_0x19fe('0x98')];});_0x115c85['rows']=_0x2d4293;return _0x115c85;})[_0x19fe('0x2b')](respondWithFilteredResult(_0x4fc7a5,_0x43b5c9));})[_0x19fe('0x9a')](handleError(_0x4fc7a5,null));};exports[_0x19fe('0x2a')]=function(_0x1e36ca,_0x40f0b9){return db[_0x19fe('0x91')][_0x19fe('0x5e')]({'where':{'id':_0x1e36ca[_0x19fe('0x9b')]['id']}})['then'](handleEntityNotFound(_0x40f0b9,null))['then'](removeEntity(_0x40f0b9,null))[_0x19fe('0x9a')](handleError(_0x40f0b9,null));};exports[_0x19fe('0x38')]=function(_0x396018,_0x33b2f0){return db[_0x19fe('0x91')]['describe']()[_0x19fe('0x2b')](function(_0x1195e4){delete _0x1195e4[_0x19fe('0x9c')];for(var _0x4b84cf=0x0;_0x4b84cf{}\s\\|]/g,'-');_0x7bae7b(null,util[_0x97d0('0x1d')](_0x97d0('0x1e'),path[_0x97d0('0x1f')](_0x158011[_0x97d0('0x1b')],path['extname'](_0x158011['originalname'])),Date[_0x97d0('0x20')](),path[_0x97d0('0x21')](_0x158011[_0x97d0('0x1b')])));}})});router[_0x97d0('0x17')](_0x97d0('0x22'),upload[_0x97d0('0x23')](_0x97d0('0x24')),controller[_0x97d0('0x25')]);var upload=multer({'storage':multer[_0x97d0('0x1a')]({'destination':function(_0x11b23b,_0x24ae2b,_0x3f72fa){_0x3f72fa(null,path[_0x97d0('0x26')](config[_0x97d0('0x27')],'server/files/tmp'));},'filename':function(_0x134d01,_0x20bfca,_0x16f618){_0x20bfca['originalname']=_0x20bfca[_0x97d0('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x16f618(null,util[_0x97d0('0x1d')](_0x97d0('0x1e'),path[_0x97d0('0x1f')](_0x20bfca[_0x97d0('0x1b')],path[_0x97d0('0x21')](_0x20bfca[_0x97d0('0x1b')])),Date['now'](),path[_0x97d0('0x21')](_0x20bfca[_0x97d0('0x1b')])));}})});router[_0x97d0('0x17')](_0x97d0('0x28'),upload[_0x97d0('0x23')]('file'),controller[_0x97d0('0x29')]);router['post']('/upload/:id',auth[_0x97d0('0xa')](),controller['import']);router[_0x97d0('0x2a')](_0x97d0('0x2b'),auth['isAuthenticated'](),controller[_0x97d0('0x2c')]);router[_0x97d0('0x2d')]('/:id',auth[_0x97d0('0xa')](),controller[_0x97d0('0x2e')]);module[_0x97d0('0x2f')]=router; \ No newline at end of file +var _0x24ef=['replace','format','extname','now','/csv','file','uploadCsv','root','server/files/tmp','%s-%s%s','/upload','single','upload','import','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','setTags','diskStorage','join','originalname'];(function(_0x7188dc,_0x47b01f){var _0x250b31=function(_0x327876){while(--_0x327876){_0x7188dc['push'](_0x7188dc['shift']());}};_0x250b31(++_0x47b01f);}(_0x24ef,0x1ef));var _0xf24e=function(_0x5654ac,_0x2946e1){_0x5654ac=_0x5654ac-0x0;var _0x4914a2=_0x24ef[_0x5654ac];return _0x4914a2;};'use strict';var multer=require(_0xf24e('0x0'));var util=require(_0xf24e('0x1'));var path=require(_0xf24e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf24e('0x3'));var router=express[_0xf24e('0x4')]();var fs_extra=require(_0xf24e('0x5'));var auth=require(_0xf24e('0x6'));var interaction=require(_0xf24e('0x7'));var config=require(_0xf24e('0x8'));var controller=require(_0xf24e('0x9'));router[_0xf24e('0xa')]('/',auth[_0xf24e('0xb')](),controller[_0xf24e('0xc')]);router[_0xf24e('0xa')]('/describe',auth[_0xf24e('0xb')](),controller['describe']);router['get'](_0xf24e('0xd'),auth[_0xf24e('0xb')](),controller[_0xf24e('0xe')]);router[_0xf24e('0xa')](_0xf24e('0xf'),auth[_0xf24e('0xb')](),controller[_0xf24e('0x10')]);router[_0xf24e('0xa')](_0xf24e('0x11'),auth[_0xf24e('0xb')](),controller[_0xf24e('0x12')]);router[_0xf24e('0xa')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xf24e('0x13')]);router[_0xf24e('0xa')](_0xf24e('0x14'),auth[_0xf24e('0xb')](),controller[_0xf24e('0x15')]);router[_0xf24e('0xa')](_0xf24e('0x16'),auth[_0xf24e('0xb')](),controller[_0xf24e('0x17')]);router[_0xf24e('0xa')](_0xf24e('0x18'),auth[_0xf24e('0xb')](),controller[_0xf24e('0x19')]);router[_0xf24e('0x1a')](_0xf24e('0x1b'),auth[_0xf24e('0xb')](),controller[_0xf24e('0x1c')]);router[_0xf24e('0x1a')]('/',auth[_0xf24e('0xb')](),controller[_0xf24e('0x1d')]);router[_0xf24e('0x1a')](_0xf24e('0x1e'),auth[_0xf24e('0xb')](),controller['bulkCreate']);router[_0xf24e('0x1a')]('/:id/tags',auth[_0xf24e('0xb')](),controller[_0xf24e('0x1f')]);var upload=multer({'storage':multer[_0xf24e('0x20')]({'destination':function(_0x4a46d4,_0x4e0eac,_0x4d0715){_0x4d0715(null,path[_0xf24e('0x21')](config['root'],'server/files/tmp'));},'filename':function(_0x5b25e4,_0x2f2baf,_0x11d9c3){_0x2f2baf[_0xf24e('0x22')]=_0x2f2baf['originalname'][_0xf24e('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x11d9c3(null,util[_0xf24e('0x24')]('%s-%s%s',path['basename'](_0x2f2baf[_0xf24e('0x22')],path[_0xf24e('0x25')](_0x2f2baf['originalname'])),Date[_0xf24e('0x26')](),path[_0xf24e('0x25')](_0x2f2baf['originalname'])));}})});router[_0xf24e('0x1a')](_0xf24e('0x27'),upload['single'](_0xf24e('0x28')),controller[_0xf24e('0x29')]);var upload=multer({'storage':multer[_0xf24e('0x20')]({'destination':function(_0x56488f,_0x22bd8a,_0x4b82a3){_0x4b82a3(null,path[_0xf24e('0x21')](config[_0xf24e('0x2a')],_0xf24e('0x2b')));},'filename':function(_0x34687d,_0x7bcd21,_0x59c951){_0x7bcd21[_0xf24e('0x22')]=_0x7bcd21[_0xf24e('0x22')][_0xf24e('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59c951(null,util[_0xf24e('0x24')](_0xf24e('0x2c'),path['basename'](_0x7bcd21[_0xf24e('0x22')],path[_0xf24e('0x25')](_0x7bcd21[_0xf24e('0x22')])),Date[_0xf24e('0x26')](),path[_0xf24e('0x25')](_0x7bcd21[_0xf24e('0x22')])));}})});router[_0xf24e('0x1a')](_0xf24e('0x2d'),upload[_0xf24e('0x2e')](_0xf24e('0x28')),controller[_0xf24e('0x2f')]);router[_0xf24e('0x1a')]('/upload/:id',auth[_0xf24e('0xb')](),controller[_0xf24e('0x30')]);router[_0xf24e('0x31')]('/:id',auth['isAuthenticated'](),controller[_0xf24e('0x32')]);router[_0xf24e('0x33')](_0xf24e('0xd'),auth[_0xf24e('0xb')](),controller['destroy']);module[_0xf24e('0x34')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 4dc6b13..c975861 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4937=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4937,0x1c8));var _0x7493=function(_0xfc5b7f,_0x33cd5d){_0xfc5b7f=_0xfc5b7f-0x0;var _0x3a0227=_0x4937[_0xfc5b7f];return _0x3a0227;};'use strict';var Sequelize=require(_0x7493('0x0'));module[_0x7493('0x1')]={'CmContactId':{'type':Sequelize[_0x7493('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7493('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7493('0x3')],'defaultValue':_0x7493('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x7493('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x3533=['exports','STRING','INTEGER','PHONE','sequelize'];(function(_0xdee97f,_0x652bdb){var _0x95df96=function(_0x2163c7){while(--_0x2163c7){_0xdee97f['push'](_0xdee97f['shift']());}};_0x95df96(++_0x652bdb);}(_0x3533,0x1c6));var _0x3353=function(_0xc35bcc,_0x1716ba){_0xc35bcc=_0xc35bcc-0x0;var _0xb998ad=_0x3533[_0xc35bcc];return _0xb998ad;};'use strict';var Sequelize=require(_0x3353('0x0'));module[_0x3353('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x3353('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x3353('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3353('0x2')],'defaultValue':_0x3353('0x4')},'OrderBy':{'type':Sequelize[_0x3353('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x3353('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 809d17c..d010af4 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x657e=['../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','CmContactHasItems','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','include','findAll','rows','catch','show','params','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x657e,0x94));var _0xe657=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x657e[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xe657('0x0'));var rimraf=require(_0xe657('0x1'));var zipdir=require(_0xe657('0x2'));var jsonpatch=require(_0xe657('0x3'));var rp=require('request-promise');var moment=require(_0xe657('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe657('0x5'));var util=require(_0xe657('0x6'));var path=require(_0xe657('0x7'));var sox=require(_0xe657('0x8'));var csv=require('to-csv');var ejs=require(_0xe657('0x9'));var fs=require('fs');var fs_extra=require(_0xe657('0xa'));var _=require(_0xe657('0xb'));var squel=require(_0xe657('0xc'));var crypto=require(_0xe657('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe657('0xe'));var Papa=require(_0xe657('0xf'));var Redis=require(_0xe657('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe657('0x11'));var hardwareService=require(_0xe657('0x12'));var logger=require(_0xe657('0x13'))(_0xe657('0x14'));var utils=require(_0xe657('0x15'));var config=require(_0xe657('0x16'));var licenseUtil=require(_0xe657('0x17'));var db=require(_0xe657('0x18'))['db'];function respondWithStatusCode(_0x19ce9c,_0x17a1ed){_0x17a1ed=_0x17a1ed||0xcc;return function(_0x34f862){if(_0x34f862){return _0x19ce9c['sendStatus'](_0x17a1ed);}return _0x19ce9c[_0xe657('0x19')](_0x17a1ed)[_0xe657('0x1a')]();};}function respondWithResult(_0x3909f6,_0x553db7){_0x553db7=_0x553db7||0xc8;return function(_0x1b86e1){if(_0x1b86e1){return _0x3909f6[_0xe657('0x19')](_0x553db7)[_0xe657('0x1b')](_0x1b86e1);}};}function respondWithFilteredResult(_0x1a9d4a,_0x5dc4c8){return function(_0x67fcf3){if(_0x67fcf3){var _0x482ff7=typeof _0x5dc4c8[_0xe657('0x1c')]===_0xe657('0x1d')&&typeof _0x5dc4c8['limit']==='undefined';var _0x2be8ef=_0x67fcf3['count'];var _0xa72747=_0x482ff7?0x0:_0x5dc4c8[_0xe657('0x1c')];var _0x38bf14=_0x482ff7?_0x67fcf3[_0xe657('0x1e')]:_0x5dc4c8[_0xe657('0x1c')]+_0x5dc4c8[_0xe657('0x1f')];var _0x46631c;if(_0x38bf14>=_0x2be8ef){_0x38bf14=_0x2be8ef;_0x46631c=0xc8;}else{_0x46631c=0xce;}_0x1a9d4a[_0xe657('0x19')](_0x46631c);return _0x1a9d4a[_0xe657('0x20')](_0xe657('0x21'),_0xa72747+'-'+_0x38bf14+'/'+_0x2be8ef)[_0xe657('0x1b')](_0x67fcf3);}return null;};}function patchUpdates(_0x22592a){return function(_0x2a5b31){try{jsonpatch[_0xe657('0x22')](_0x2a5b31,_0x22592a,!![]);}catch(_0x2a6cdf){return BPromise[_0xe657('0x23')](_0x2a6cdf);}return _0x2a5b31['save']();};}function saveUpdates(_0x4ba6dd,_0x49e1f3){return function(_0x52ad58){if(_0x52ad58){return _0x52ad58[_0xe657('0x24')](_0x4ba6dd)[_0xe657('0x25')](function(_0x3af53c){return _0x3af53c;});}return null;};}function removeEntity(_0x5b1b28,_0xadbe7){return function(_0xfc0abd){if(_0xfc0abd){return _0xfc0abd[_0xe657('0x26')]()['then'](function(){var _0x54010d=_0xfc0abd[_0xe657('0x27')]({'plain':!![]});var _0x29c76a=_0xe657('0x28');return db['UserProfileResource'][_0xe657('0x26')]({'where':{'type':_0x29c76a,'resourceId':_0x54010d['id']}})[_0xe657('0x25')](function(){return _0xfc0abd;});})[_0xe657('0x25')](function(){_0x5b1b28[_0xe657('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8cccc,_0x4f71a0){return function(_0x18035d){if(!_0x18035d){_0x8cccc['sendStatus'](0x194);}return _0x18035d;};}function handleError(_0x55415a,_0x1fd14d){_0x1fd14d=_0x1fd14d||0x1f4;return function(_0x10db37){logger[_0xe657('0x29')](_0x10db37[_0xe657('0x2a')]);if(_0x10db37[_0xe657('0x2b')]){delete _0x10db37[_0xe657('0x2b')];}_0x55415a[_0xe657('0x19')](_0x1fd14d)[_0xe657('0x2c')](_0x10db37);};}function getMustacheRender(_0x53c0c8,_0x281c46){return Mustache[_0xe657('0x2d')](_0x53c0c8,_[_0xe657('0x2e')](_0x281c46[_0xe657('0x2f')],{'contact':_0x281c46[_0xe657('0x30')],'message':_0x281c46[_0xe657('0x31')],'agent':_0x281c46[_0xe657('0x32')],'interaction':_0x281c46[_0xe657('0x33')],'account':_0x281c46[_0xe657('0x34')]}))||'';}exports[_0xe657('0x35')]=function(_0x46b97a,_0x503bfc){var _0x315af4={},_0x13920e={},_0x2b2a4f={'count':0x0,'rows':[]};var _0x560df6=_[_0xe657('0x36')](db[_0xe657('0x37')][_0xe657('0x38')],function(_0x55de12){return{'name':_0x55de12[_0xe657('0x39')],'type':_0x55de12[_0xe657('0x3a')]['key']};});_0x13920e[_0xe657('0x3b')]=_[_0xe657('0x36')](_0x560df6,_0xe657('0x2b'));_0x13920e[_0xe657('0x3c')]=_[_0xe657('0x3d')](_0x46b97a[_0xe657('0x3c')]);_0x13920e[_0xe657('0x3e')]=_[_0xe657('0x3f')](_0x13920e[_0xe657('0x3b')],_0x13920e[_0xe657('0x3c')]);_0x315af4[_0xe657('0x40')]=_['intersection'](_0x13920e[_0xe657('0x3b')],qs[_0xe657('0x41')](_0x46b97a['query'][_0xe657('0x41')]));_0x315af4['attributes']=_0x315af4[_0xe657('0x40')][_0xe657('0x42')]?_0x315af4['attributes']:_0x13920e[_0xe657('0x3b')];if(!_0x46b97a[_0xe657('0x3c')][_0xe657('0x43')]('nolimit')){_0x315af4[_0xe657('0x1f')]=qs[_0xe657('0x1f')](_0x46b97a['query']['limit']);_0x315af4['offset']=qs[_0xe657('0x1c')](_0x46b97a[_0xe657('0x3c')][_0xe657('0x1c')]);}_0x315af4['order']=qs['sort'](_0x46b97a[_0xe657('0x3c')]['sort']);_0x315af4[_0xe657('0x44')]=qs[_0xe657('0x3e')](_[_0xe657('0x45')](_0x46b97a[_0xe657('0x3c')],_0x13920e[_0xe657('0x3e')]),_0x560df6);if(_0x46b97a['query']['filter']){_0x315af4[_0xe657('0x44')]=_[_0xe657('0x2e')](_0x315af4['where'],{'$or':_['map'](_0x560df6,function(_0x3810c0){if(_0x3810c0['type']!=='VIRTUAL'){var _0x6aed39={};_0x6aed39[_0x3810c0[_0xe657('0x2b')]]={'$like':'%'+_0x46b97a[_0xe657('0x3c')][_0xe657('0x46')]+'%'};return _0x6aed39;}})});}_0x315af4=_[_0xe657('0x2e')]({},_0x315af4,_0x46b97a['options']);var _0xd0c9c2={'where':_0x315af4[_0xe657('0x44')]};return db[_0xe657('0x37')][_0xe657('0x1e')](_0xd0c9c2)[_0xe657('0x25')](function(_0x5030d6){_0x2b2a4f[_0xe657('0x1e')]=_0x5030d6;if(_0x46b97a[_0xe657('0x3c')]['includeAll']){_0x315af4[_0xe657('0x47')]=[{'all':!![]}];}return db[_0xe657('0x37')][_0xe657('0x48')](_0x315af4);})[_0xe657('0x25')](function(_0x122d9f){_0x2b2a4f[_0xe657('0x49')]=_0x122d9f;return _0x2b2a4f;})[_0xe657('0x25')](respondWithFilteredResult(_0x503bfc,_0x315af4))[_0xe657('0x4a')](handleError(_0x503bfc,null));};exports[_0xe657('0x4b')]=function(_0x17b374,_0x2bb009){var _0x218c50={'raw':!![],'where':{'id':_0x17b374[_0xe657('0x4c')]['id']}},_0x209e93={};_0x209e93[_0xe657('0x3b')]=_[_0xe657('0x3d')](db[_0xe657('0x37')][_0xe657('0x38')]);_0x209e93[_0xe657('0x3c')]=_[_0xe657('0x3d')](_0x17b374[_0xe657('0x3c')]);_0x209e93['filters']=_[_0xe657('0x3f')](_0x209e93[_0xe657('0x3b')],_0x209e93[_0xe657('0x3c')]);_0x218c50[_0xe657('0x40')]=_['intersection'](_0x209e93[_0xe657('0x3b')],qs[_0xe657('0x41')](_0x17b374['query'][_0xe657('0x41')]));_0x218c50[_0xe657('0x40')]=_0x218c50['attributes'][_0xe657('0x42')]?_0x218c50[_0xe657('0x40')]:_0x209e93['model'];if(_0x17b374[_0xe657('0x3c')][_0xe657('0x4d')]){_0x218c50[_0xe657('0x47')]=[{'all':!![]}];}_0x218c50=_[_0xe657('0x2e')]({},_0x218c50,_0x17b374[_0xe657('0x4e')]);return db[_0xe657('0x37')]['find'](_0x218c50)[_0xe657('0x25')](handleEntityNotFound(_0x2bb009,null))[_0xe657('0x25')](respondWithResult(_0x2bb009,null))[_0xe657('0x4a')](handleError(_0x2bb009,null));};exports['create']=function(_0x4200db,_0x4c6f30){return db['CmContactHasItem'][_0xe657('0x4f')](_0x4200db[_0xe657('0x2f')],{})['then'](function(_0x1929ff){var _0x1da5f4=_0x4200db[_0xe657('0x50')][_0xe657('0x27')]({'plain':!![]});if(!_0x1da5f4)throw new Error(_0xe657('0x51'));if(_0x1da5f4['role']===_0xe657('0x50')){var _0x1ad5cf=_0x1929ff['get']({'plain':!![]});var _0x54c309=_0xe657('0x28');return db[_0xe657('0x52')][_0xe657('0x53')]({'where':{'name':_0x54c309,'userProfileId':_0x1da5f4[_0xe657('0x54')]},'raw':!![]})['then'](function(_0x4bd9e4){if(_0x4bd9e4&&_0x4bd9e4['autoAssociation']===0x0){return db[_0xe657('0x55')]['create']({'name':_0x1ad5cf[_0xe657('0x2b')],'resourceId':_0x1ad5cf['id'],'type':_0x4bd9e4[_0xe657('0x2b')],'sectionId':_0x4bd9e4['id']},{})['then'](function(){return _0x1929ff;});}else{return _0x1929ff;}})['catch'](function(_0x18ceb6){logger[_0xe657('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18ceb6);throw _0x18ceb6;});}return _0x1929ff;})[_0xe657('0x25')](respondWithResult(_0x4c6f30,0xc9))[_0xe657('0x4a')](handleError(_0x4c6f30,null));};exports['update']=function(_0x4b98b3,_0x17ef10){if(_0x4b98b3[_0xe657('0x2f')]['id']){delete _0x4b98b3[_0xe657('0x2f')]['id'];}return db[_0xe657('0x37')]['find']({'where':{'id':_0x4b98b3[_0xe657('0x4c')]['id']}})[_0xe657('0x25')](handleEntityNotFound(_0x17ef10,null))[_0xe657('0x25')](saveUpdates(_0x4b98b3[_0xe657('0x2f')],null))[_0xe657('0x25')](respondWithResult(_0x17ef10,null))['catch'](handleError(_0x17ef10,null));};exports['destroy']=function(_0x11fb1c,_0x2cd9e4){return db['CmContactHasItem'][_0xe657('0x53')]({'where':{'id':_0x11fb1c[_0xe657('0x4c')]['id']}})[_0xe657('0x25')](handleEntityNotFound(_0x2cd9e4,null))[_0xe657('0x25')](removeEntity(_0x2cd9e4,null))['catch'](handleError(_0x2cd9e4,null));}; \ No newline at end of file +var _0xb6b6=['error','stack','send','merge','contact','message','agent','interaction','account','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','options','CmContactHasItem','includeAll','include','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','Content-Range','save','update','destroy','get','CmContactHasItems','then'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0xb6b6,0xe6));var _0x6b6b=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xb6b6[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b6b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b6b('0x1'));var rp=require(_0x6b6b('0x2'));var moment=require(_0x6b6b('0x3'));var BPromise=require(_0x6b6b('0x4'));var Mustache=require('mustache');var util=require(_0x6b6b('0x5'));var path=require(_0x6b6b('0x6'));var sox=require(_0x6b6b('0x7'));var csv=require(_0x6b6b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b6b('0x9'));var _=require(_0x6b6b('0xa'));var squel=require(_0x6b6b('0xb'));var crypto=require(_0x6b6b('0xc'));var jsforce=require(_0x6b6b('0xd'));var deskjs=require(_0x6b6b('0xe'));var toCsv=require(_0x6b6b('0x8'));var querystring=require(_0x6b6b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6b6b('0x10'));var as=require(_0x6b6b('0x11'));var hardwareService=require(_0x6b6b('0x12'));var logger=require(_0x6b6b('0x13'))(_0x6b6b('0x14'));var utils=require(_0x6b6b('0x15'));var config=require(_0x6b6b('0x16'));var licenseUtil=require(_0x6b6b('0x17'));var db=require(_0x6b6b('0x18'))['db'];function respondWithStatusCode(_0x273d2d,_0x5c9484){_0x5c9484=_0x5c9484||0xcc;return function(_0x278bf7){if(_0x278bf7){return _0x273d2d[_0x6b6b('0x19')](_0x5c9484);}return _0x273d2d[_0x6b6b('0x1a')](_0x5c9484)[_0x6b6b('0x1b')]();};}function respondWithResult(_0x494ec3,_0x428243){_0x428243=_0x428243||0xc8;return function(_0x2c379a){if(_0x2c379a){return _0x494ec3[_0x6b6b('0x1a')](_0x428243)[_0x6b6b('0x1c')](_0x2c379a);}};}function respondWithFilteredResult(_0x5995af,_0x30cb48){return function(_0x17a1f4){if(_0x17a1f4){var _0x5605d9=typeof _0x30cb48[_0x6b6b('0x1d')]===_0x6b6b('0x1e')&&typeof _0x30cb48[_0x6b6b('0x1f')]===_0x6b6b('0x1e');var _0x247e8c=_0x17a1f4[_0x6b6b('0x20')];var _0x14e3ab=_0x5605d9?0x0:_0x30cb48[_0x6b6b('0x1d')];var _0x3daec4=_0x5605d9?_0x17a1f4['count']:_0x30cb48['offset']+_0x30cb48[_0x6b6b('0x1f')];var _0x204b57;if(_0x3daec4>=_0x247e8c){_0x3daec4=_0x247e8c;_0x204b57=0xc8;}else{_0x204b57=0xce;}_0x5995af[_0x6b6b('0x1a')](_0x204b57);return _0x5995af['set'](_0x6b6b('0x21'),_0x14e3ab+'-'+_0x3daec4+'/'+_0x247e8c)['json'](_0x17a1f4);}return null;};}function patchUpdates(_0x46e7fc){return function(_0x4d0635){try{jsonpatch['apply'](_0x4d0635,_0x46e7fc,!![]);}catch(_0x3005e3){return BPromise['reject'](_0x3005e3);}return _0x4d0635[_0x6b6b('0x22')]();};}function saveUpdates(_0x54c4f5,_0x1c9f0d){return function(_0xe93863){if(_0xe93863){return _0xe93863[_0x6b6b('0x23')](_0x54c4f5)['then'](function(_0x1e5f00){return _0x1e5f00;});}return null;};}function removeEntity(_0x4e99ad,_0x597016){return function(_0x21f5fd){if(_0x21f5fd){return _0x21f5fd[_0x6b6b('0x24')]()['then'](function(){var _0x2daa0c=_0x21f5fd[_0x6b6b('0x25')]({'plain':!![]});var _0x22d431=_0x6b6b('0x26');return db['UserProfileResource'][_0x6b6b('0x24')]({'where':{'type':_0x22d431,'resourceId':_0x2daa0c['id']}})['then'](function(){return _0x21f5fd;});})[_0x6b6b('0x27')](function(){_0x4e99ad[_0x6b6b('0x1a')](0xcc)[_0x6b6b('0x1b')]();});}};}function handleEntityNotFound(_0x388fc9,_0x4250b2){return function(_0x1106f2){if(!_0x1106f2){_0x388fc9[_0x6b6b('0x19')](0x194);}return _0x1106f2;};}function handleError(_0x56e24f,_0x4ca926){_0x4ca926=_0x4ca926||0x1f4;return function(_0x632db0){logger[_0x6b6b('0x28')](_0x632db0[_0x6b6b('0x29')]);if(_0x632db0['name']){delete _0x632db0['name'];}_0x56e24f['status'](_0x4ca926)[_0x6b6b('0x2a')](_0x632db0);};}function getMustacheRender(_0xef5cfa,_0x239f3f){return Mustache['render'](_0xef5cfa,_[_0x6b6b('0x2b')](_0x239f3f['body'],{'contact':_0x239f3f[_0x6b6b('0x2c')],'message':_0x239f3f[_0x6b6b('0x2d')],'agent':_0x239f3f[_0x6b6b('0x2e')],'interaction':_0x239f3f[_0x6b6b('0x2f')],'account':_0x239f3f[_0x6b6b('0x30')]}))||'';}exports[_0x6b6b('0x31')]=function(_0x2311ea,_0x6f4b8e){var _0x4b7713={},_0x527020={},_0x5110cb={'count':0x0,'rows':[]};var _0x21a2a9=_[_0x6b6b('0x32')](db['CmContactHasItem'][_0x6b6b('0x33')],function(_0x200082){return{'name':_0x200082[_0x6b6b('0x34')],'type':_0x200082['type'][_0x6b6b('0x35')]};});_0x527020[_0x6b6b('0x36')]=_[_0x6b6b('0x32')](_0x21a2a9,'name');_0x527020[_0x6b6b('0x37')]=_[_0x6b6b('0x38')](_0x2311ea['query']);_0x527020[_0x6b6b('0x39')]=_[_0x6b6b('0x3a')](_0x527020[_0x6b6b('0x36')],_0x527020['query']);_0x4b7713['attributes']=_[_0x6b6b('0x3a')](_0x527020[_0x6b6b('0x36')],qs[_0x6b6b('0x3b')](_0x2311ea['query'][_0x6b6b('0x3b')]));_0x4b7713['attributes']=_0x4b7713[_0x6b6b('0x3c')][_0x6b6b('0x3d')]?_0x4b7713[_0x6b6b('0x3c')]:_0x527020[_0x6b6b('0x36')];if(!_0x2311ea[_0x6b6b('0x37')][_0x6b6b('0x3e')](_0x6b6b('0x3f'))){_0x4b7713[_0x6b6b('0x1f')]=qs[_0x6b6b('0x1f')](_0x2311ea[_0x6b6b('0x37')][_0x6b6b('0x1f')]);_0x4b7713[_0x6b6b('0x1d')]=qs['offset'](_0x2311ea['query'][_0x6b6b('0x1d')]);}_0x4b7713[_0x6b6b('0x40')]=qs[_0x6b6b('0x41')](_0x2311ea[_0x6b6b('0x37')][_0x6b6b('0x41')]);_0x4b7713[_0x6b6b('0x42')]=qs['filters'](_[_0x6b6b('0x43')](_0x2311ea[_0x6b6b('0x37')],_0x527020['filters']),_0x21a2a9);if(_0x2311ea[_0x6b6b('0x37')][_0x6b6b('0x44')]){_0x4b7713[_0x6b6b('0x42')]=_['merge'](_0x4b7713['where'],{'$or':_[_0x6b6b('0x32')](_0x21a2a9,function(_0x189370){if(_0x189370[_0x6b6b('0x45')]!==_0x6b6b('0x46')){var _0x27fb97={};_0x27fb97[_0x189370[_0x6b6b('0x47')]]={'$like':'%'+_0x2311ea[_0x6b6b('0x37')][_0x6b6b('0x44')]+'%'};return _0x27fb97;}})});}_0x4b7713=_[_0x6b6b('0x2b')]({},_0x4b7713,_0x2311ea[_0x6b6b('0x48')]);var _0x2b17f4={'where':_0x4b7713[_0x6b6b('0x42')]};return db[_0x6b6b('0x49')]['count'](_0x2b17f4)[_0x6b6b('0x27')](function(_0x4830c5){_0x5110cb[_0x6b6b('0x20')]=_0x4830c5;if(_0x2311ea[_0x6b6b('0x37')][_0x6b6b('0x4a')]){_0x4b7713[_0x6b6b('0x4b')]=[{'all':!![]}];}return db[_0x6b6b('0x49')][_0x6b6b('0x4c')](_0x4b7713);})[_0x6b6b('0x27')](function(_0x3f7322){_0x5110cb[_0x6b6b('0x4d')]=_0x3f7322;return _0x5110cb;})['then'](respondWithFilteredResult(_0x6f4b8e,_0x4b7713))[_0x6b6b('0x4e')](handleError(_0x6f4b8e,null));};exports['show']=function(_0x532aed,_0x1dace9){var _0x2b7c02={'raw':!![],'where':{'id':_0x532aed[_0x6b6b('0x4f')]['id']}},_0x5837ee={};_0x5837ee[_0x6b6b('0x36')]=_[_0x6b6b('0x38')](db[_0x6b6b('0x49')][_0x6b6b('0x33')]);_0x5837ee[_0x6b6b('0x37')]=_[_0x6b6b('0x38')](_0x532aed[_0x6b6b('0x37')]);_0x5837ee[_0x6b6b('0x39')]=_[_0x6b6b('0x3a')](_0x5837ee[_0x6b6b('0x36')],_0x5837ee[_0x6b6b('0x37')]);_0x2b7c02[_0x6b6b('0x3c')]=_[_0x6b6b('0x3a')](_0x5837ee[_0x6b6b('0x36')],qs['fields'](_0x532aed[_0x6b6b('0x37')][_0x6b6b('0x3b')]));_0x2b7c02[_0x6b6b('0x3c')]=_0x2b7c02[_0x6b6b('0x3c')][_0x6b6b('0x3d')]?_0x2b7c02[_0x6b6b('0x3c')]:_0x5837ee['model'];if(_0x532aed['query']['includeAll']){_0x2b7c02[_0x6b6b('0x4b')]=[{'all':!![]}];}_0x2b7c02=_['merge']({},_0x2b7c02,_0x532aed[_0x6b6b('0x48')]);return db[_0x6b6b('0x49')][_0x6b6b('0x50')](_0x2b7c02)['then'](handleEntityNotFound(_0x1dace9,null))['then'](respondWithResult(_0x1dace9,null))['catch'](handleError(_0x1dace9,null));};exports[_0x6b6b('0x51')]=function(_0x543024,_0x2a6b17){return db['CmContactHasItem'][_0x6b6b('0x51')](_0x543024[_0x6b6b('0x52')],{})[_0x6b6b('0x27')](function(_0x5150e4){var _0x969c69=_0x543024['user'][_0x6b6b('0x25')]({'plain':!![]});if(!_0x969c69)throw new Error(_0x6b6b('0x53'));if(_0x969c69[_0x6b6b('0x54')]==='user'){var _0x358d95=_0x5150e4[_0x6b6b('0x25')]({'plain':!![]});var _0x20574c=_0x6b6b('0x26');return db[_0x6b6b('0x55')][_0x6b6b('0x50')]({'where':{'name':_0x20574c,'userProfileId':_0x969c69[_0x6b6b('0x56')]},'raw':!![]})['then'](function(_0xfd0596){if(_0xfd0596&&_0xfd0596[_0x6b6b('0x57')]===0x0){return db[_0x6b6b('0x58')][_0x6b6b('0x51')]({'name':_0x358d95['name'],'resourceId':_0x358d95['id'],'type':_0xfd0596[_0x6b6b('0x47')],'sectionId':_0xfd0596['id']},{})['then'](function(){return _0x5150e4;});}else{return _0x5150e4;}})[_0x6b6b('0x4e')](function(_0x48cd6a){logger[_0x6b6b('0x28')](_0x6b6b('0x59'),_0x48cd6a);throw _0x48cd6a;});}return _0x5150e4;})['then'](respondWithResult(_0x2a6b17,0xc9))[_0x6b6b('0x4e')](handleError(_0x2a6b17,null));};exports['update']=function(_0x49fe57,_0x6305c1){if(_0x49fe57[_0x6b6b('0x52')]['id']){delete _0x49fe57[_0x6b6b('0x52')]['id'];}return db[_0x6b6b('0x49')]['find']({'where':{'id':_0x49fe57[_0x6b6b('0x4f')]['id']}})[_0x6b6b('0x27')](handleEntityNotFound(_0x6305c1,null))[_0x6b6b('0x27')](saveUpdates(_0x49fe57[_0x6b6b('0x52')],null))['then'](respondWithResult(_0x6305c1,null))[_0x6b6b('0x4e')](handleError(_0x6305c1,null));};exports['destroy']=function(_0x35b49c,_0x3e4172){return db[_0x6b6b('0x49')][_0x6b6b('0x50')]({'where':{'id':_0x35b49c[_0x6b6b('0x4f')]['id']}})[_0x6b6b('0x27')](handleEntityNotFound(_0x3e4172,null))[_0x6b6b('0x27')](removeEntity(_0x3e4172,null))[_0x6b6b('0x4e')](handleError(_0x3e4172,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 3a7077a..934b43c 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ea297,_0x1bf117){var _0x49c138=function(_0x578013){while(--_0x578013){_0x3ea297['push'](_0x3ea297['shift']());}};_0x49c138(++_0x1bf117);}(_0x4975,0x86));var _0x5497=function(_0x551e28,_0x571f5e){_0x551e28=_0x551e28-0x0;var _0x52c958=_0x4975[_0x551e28];return _0x52c958;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index e0bb358..7f01eba 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce9b=['client','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1ae24f,_0x4d1a97){var _0x12573a=function(_0x4105e6){while(--_0x4105e6){_0x1ae24f['push'](_0x1ae24f['shift']());}};_0x12573a(++_0x4d1a97);}(_0xce9b,0xed));var _0xbce9=function(_0x380527,_0x388e56){_0x380527=_0x380527-0x0;var _0x2cc82e=_0xce9b[_0x380527];return _0x2cc82e;};'use strict';var _=require(_0xbce9('0x0'));var util=require(_0xbce9('0x1'));var moment=require(_0xbce9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbce9('0x3'));var fs=require('fs');var Redis=require(_0xbce9('0x4'));var db=require(_0xbce9('0x5'))['db'];var utils=require(_0xbce9('0x6'));var logger=require(_0xbce9('0x7'))('rpc');var config=require(_0xbce9('0x8'));var jayson=require(_0xbce9('0x9'));var client=jayson[_0xbce9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ee6f8,_0x113c0b,_0x5d2dc6){return new BPromise(function(_0x394a05,_0x4441d9){return client['request'](_0x2ee6f8,_0x5d2dc6)['then'](function(_0xfad0c7){logger[_0xbce9('0xb')](_0xbce9('0xc'),_0x113c0b,_0xbce9('0xd'));logger[_0xbce9('0xe')](_0xbce9('0xf'),_0x113c0b,_0xbce9('0xd'),JSON[_0xbce9('0x10')](_0xfad0c7));if(_0xfad0c7[_0xbce9('0x11')]){if(_0xfad0c7['error']['code']===0x1f4){logger[_0xbce9('0x11')](_0xbce9('0xc'),_0x113c0b,_0xfad0c7[_0xbce9('0x11')]['message']);return _0x4441d9(_0xfad0c7[_0xbce9('0x11')]['message']);}logger['error'](_0xbce9('0xc'),_0x113c0b,_0xfad0c7[_0xbce9('0x11')][_0xbce9('0x12')]);return _0x394a05(_0xfad0c7[_0xbce9('0x11')][_0xbce9('0x12')]);}else{logger[_0xbce9('0xb')](_0xbce9('0xc'),_0x113c0b,_0xbce9('0xd'));_0x394a05(_0xfad0c7['result']['message']);}})['catch'](function(_0x2d1cc3){logger[_0xbce9('0x11')](_0xbce9('0xc'),_0x113c0b,_0x2d1cc3);_0x4441d9(_0x2d1cc3);});});} \ No newline at end of file +var _0x497b=['client','http','request','then','info','request\x20sent','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x39ea10,_0x38a340){var _0x372b64=function(_0x4337bc){while(--_0x4337bc){_0x39ea10['push'](_0x39ea10['shift']());}};_0x372b64(++_0x38a340);}(_0x497b,0x8b));var _0xb497=function(_0x50504f,_0x56eba9){_0x50504f=_0x50504f-0x0;var _0x395d28=_0x497b[_0x50504f];return _0x395d28;};'use strict';var _=require('lodash');var util=require(_0xb497('0x0'));var moment=require('moment');var BPromise=require(_0xb497('0x1'));var rs=require(_0xb497('0x2'));var fs=require('fs');var Redis=require(_0xb497('0x3'));var db=require(_0xb497('0x4'))['db'];var utils=require(_0xb497('0x5'));var logger=require('../../config/logger')(_0xb497('0x6'));var config=require(_0xb497('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb497('0x8')][_0xb497('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x468ffd,_0x339473,_0x35da72){return new BPromise(function(_0x567de9,_0x4ff3cc){return client[_0xb497('0xa')](_0x468ffd,_0x35da72)[_0xb497('0xb')](function(_0x18bdf8){logger[_0xb497('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x339473,_0xb497('0xd'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x339473,_0xb497('0xd'),JSON[_0xb497('0xe')](_0x18bdf8));if(_0x18bdf8[_0xb497('0xf')]){if(_0x18bdf8[_0xb497('0xf')][_0xb497('0x10')]===0x1f4){logger[_0xb497('0xf')](_0xb497('0x11'),_0x339473,_0x18bdf8[_0xb497('0xf')][_0xb497('0x12')]);return _0x4ff3cc(_0x18bdf8['error'][_0xb497('0x12')]);}logger['error'](_0xb497('0x11'),_0x339473,_0x18bdf8[_0xb497('0xf')][_0xb497('0x12')]);return _0x567de9(_0x18bdf8[_0xb497('0xf')]['message']);}else{logger[_0xb497('0xc')](_0xb497('0x11'),_0x339473,_0xb497('0xd'));_0x567de9(_0x18bdf8[_0xb497('0x13')][_0xb497('0x12')]);}})[_0xb497('0x14')](function(_0x2c71d3){logger[_0xb497('0xf')](_0xb497('0x11'),_0x339473,_0x2c71d3);_0x4ff3cc(_0x2c71d3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index c25b2a0..280ff5a 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0902=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','post','isAuthenticated','create','put','update','delete','destroy'];(function(_0x10eaeb,_0x4b1afc){var _0x8a6676=function(_0x4cb84){while(--_0x4cb84){_0x10eaeb['push'](_0x10eaeb['shift']());}};_0x8a6676(++_0x4b1afc);}(_0x0902,0x1dc));var _0x2090=function(_0xf0d35,_0xce9c1c){_0xf0d35=_0xf0d35-0x0;var _0x5ba3bc=_0x0902[_0xf0d35];return _0x5ba3bc;};'use strict';var multer=require(_0x2090('0x0'));var util=require(_0x2090('0x1'));var path=require(_0x2090('0x2'));var timeout=require(_0x2090('0x3'));var express=require(_0x2090('0x4'));var router=express[_0x2090('0x5')]();var fs_extra=require(_0x2090('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2090('0x7'));var config=require(_0x2090('0x8'));var controller=require('./cmContactHasItem.controller');router[_0x2090('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2090('0x9')](_0x2090('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2090('0xb')]('/',auth[_0x2090('0xc')](),controller[_0x2090('0xd')]);router[_0x2090('0xe')](_0x2090('0xa'),auth[_0x2090('0xc')](),controller[_0x2090('0xf')]);router[_0x2090('0x10')](_0x2090('0xa'),auth[_0x2090('0xc')](),controller[_0x2090('0x11')]);module[_0x2090('0x12')]=router; \ No newline at end of file +var _0x22b3=['put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3f10b0,_0x53fe88){var _0x2bd6a0=function(_0x293ea1){while(--_0x293ea1){_0x3f10b0['push'](_0x3f10b0['shift']());}};_0x2bd6a0(++_0x53fe88);}(_0x22b3,0x11d));var _0x322b=function(_0x59573d,_0x14a961){_0x59573d=_0x59573d-0x0;var _0x2c2608=_0x22b3[_0x59573d];return _0x2c2608;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x322b('0x0'));var timeout=require(_0x322b('0x1'));var express=require(_0x322b('0x2'));var router=express[_0x322b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x322b('0x4'));var interaction=require(_0x322b('0x5'));var config=require(_0x322b('0x6'));var controller=require(_0x322b('0x7'));router[_0x322b('0x8')]('/',auth[_0x322b('0x9')](),controller[_0x322b('0xa')]);router[_0x322b('0x8')](_0x322b('0xb'),auth[_0x322b('0x9')](),controller[_0x322b('0xc')]);router[_0x322b('0xd')]('/',auth['isAuthenticated'](),controller[_0x322b('0xe')]);router[_0x322b('0xf')](_0x322b('0xb'),auth[_0x322b('0x9')](),controller[_0x322b('0x10')]);router[_0x322b('0x11')](_0x322b('0xb'),auth[_0x322b('0x9')](),controller[_0x322b('0x12')]);module[_0x322b('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 290214f..a1cec26 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4da6=['STRING'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x4da6,0xda));var _0x64da=function(_0x35fb7c,_0x4ee512){_0x35fb7c=_0x35fb7c-0x0;var _0x3b319e=_0x4da6[_0x35fb7c];return _0x3b319e;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0x64da('0x0')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xbc8d=['sequelize','INTEGER','STRING'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xbc8d,0xb4));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdbc8('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xdbc8('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xdbc8('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index b394e32..ab7ef3a 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x118d=['CmContactHasPhone','type','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x118d,0x11f));var _0xd118=function(_0x137e5a,_0x54c172){_0x137e5a=_0x137e5a-0x0;var _0x1e079f=_0x118d[_0x137e5a];return _0x1e079f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd118('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd118('0x1'));var rp=require('request-promise');var moment=require(_0xd118('0x2'));var BPromise=require(_0xd118('0x3'));var Mustache=require(_0xd118('0x4'));var util=require('util');var path=require(_0xd118('0x5'));var sox=require('sox');var csv=require(_0xd118('0x6'));var ejs=require(_0xd118('0x7'));var fs=require('fs');var fs_extra=require(_0xd118('0x8'));var _=require('lodash');var squel=require(_0xd118('0x9'));var crypto=require(_0xd118('0xa'));var jsforce=require(_0xd118('0xb'));var deskjs=require(_0xd118('0xc'));var toCsv=require(_0xd118('0x6'));var querystring=require(_0xd118('0xd'));var Papa=require(_0xd118('0xe'));var Redis=require('ioredis');var authService=require(_0xd118('0xf'));var qs=require(_0xd118('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd118('0x11'));var logger=require(_0xd118('0x12'))(_0xd118('0x13'));var utils=require(_0xd118('0x14'));var config=require(_0xd118('0x15'));var licenseUtil=require(_0xd118('0x16'));var db=require(_0xd118('0x17'))['db'];function respondWithStatusCode(_0x22b886,_0x6feece){_0x6feece=_0x6feece||0xcc;return function(_0x33a8ec){if(_0x33a8ec){return _0x22b886[_0xd118('0x18')](_0x6feece);}return _0x22b886['status'](_0x6feece)[_0xd118('0x19')]();};}function respondWithResult(_0x301fdd,_0x240019){_0x240019=_0x240019||0xc8;return function(_0x179e4b){if(_0x179e4b){return _0x301fdd[_0xd118('0x1a')](_0x240019)[_0xd118('0x1b')](_0x179e4b);}};}function respondWithFilteredResult(_0x2d9c2c,_0x22c71a){return function(_0x24681e){if(_0x24681e){var _0x4d9364=typeof _0x22c71a[_0xd118('0x1c')]===_0xd118('0x1d')&&typeof _0x22c71a['limit']===_0xd118('0x1d');var _0x33a740=_0x24681e[_0xd118('0x1e')];var _0x47cfc7=_0x4d9364?0x0:_0x22c71a[_0xd118('0x1c')];var _0x111b02=_0x4d9364?_0x24681e[_0xd118('0x1e')]:_0x22c71a[_0xd118('0x1c')]+_0x22c71a[_0xd118('0x1f')];var _0x8821ee;if(_0x111b02>=_0x33a740){_0x111b02=_0x33a740;_0x8821ee=0xc8;}else{_0x8821ee=0xce;}_0x2d9c2c[_0xd118('0x1a')](_0x8821ee);return _0x2d9c2c['set'](_0xd118('0x20'),_0x47cfc7+'-'+_0x111b02+'/'+_0x33a740)[_0xd118('0x1b')](_0x24681e);}return null;};}function patchUpdates(_0x25de81){return function(_0x28d624){try{jsonpatch[_0xd118('0x21')](_0x28d624,_0x25de81,!![]);}catch(_0x44ac8b){return BPromise[_0xd118('0x22')](_0x44ac8b);}return _0x28d624['save']();};}function saveUpdates(_0x19e765,_0x1baf7d){return function(_0x1b0c7e){if(_0x1b0c7e){return _0x1b0c7e[_0xd118('0x23')](_0x19e765)[_0xd118('0x24')](function(_0x52b7d5){return _0x52b7d5;});}return null;};}function removeEntity(_0x466f94,_0x5b07dd){return function(_0x359cdf){if(_0x359cdf){return _0x359cdf['destroy']()[_0xd118('0x24')](function(){var _0x2ef9a1=_0x359cdf[_0xd118('0x25')]({'plain':!![]});var _0x20a873='CmContactHasPhones';return db[_0xd118('0x26')][_0xd118('0x27')]({'where':{'type':_0x20a873,'resourceId':_0x2ef9a1['id']}})[_0xd118('0x24')](function(){return _0x359cdf;});})[_0xd118('0x24')](function(){_0x466f94[_0xd118('0x1a')](0xcc)[_0xd118('0x19')]();});}};}function handleEntityNotFound(_0x436d17,_0x304324){return function(_0x501658){if(!_0x501658){_0x436d17['sendStatus'](0x194);}return _0x501658;};}function handleError(_0xe16fe2,_0x3aabd2){_0x3aabd2=_0x3aabd2||0x1f4;return function(_0x38d4c7){logger[_0xd118('0x28')](_0x38d4c7[_0xd118('0x29')]);if(_0x38d4c7['name']){delete _0x38d4c7[_0xd118('0x2a')];}_0xe16fe2[_0xd118('0x1a')](_0x3aabd2)[_0xd118('0x2b')](_0x38d4c7);};}function getMustacheRender(_0x5cff60,_0x35df68){return Mustache[_0xd118('0x2c')](_0x5cff60,_[_0xd118('0x2d')](_0x35df68[_0xd118('0x2e')],{'contact':_0x35df68[_0xd118('0x2f')],'message':_0x35df68[_0xd118('0x30')],'agent':_0x35df68[_0xd118('0x31')],'interaction':_0x35df68[_0xd118('0x32')],'account':_0x35df68[_0xd118('0x33')]}))||'';}exports[_0xd118('0x34')]=function(_0x6adf6b,_0x3cf667){var _0x351656={},_0x4d885e={},_0x456106={'count':0x0,'rows':[]};var _0xaf12bd=_['map'](db[_0xd118('0x35')]['rawAttributes'],function(_0x2223ae){return{'name':_0x2223ae['fieldName'],'type':_0x2223ae[_0xd118('0x36')]['key']};});_0x4d885e[_0xd118('0x37')]=_[_0xd118('0x38')](_0xaf12bd,'name');_0x4d885e['query']=_['keys'](_0x6adf6b[_0xd118('0x39')]);_0x4d885e['filters']=_[_0xd118('0x3a')](_0x4d885e[_0xd118('0x37')],_0x4d885e['query']);_0x351656[_0xd118('0x3b')]=_[_0xd118('0x3a')](_0x4d885e['model'],qs[_0xd118('0x3c')](_0x6adf6b['query']['fields']));_0x351656['attributes']=_0x351656['attributes']['length']?_0x351656[_0xd118('0x3b')]:_0x4d885e['model'];if(!_0x6adf6b[_0xd118('0x39')][_0xd118('0x3d')](_0xd118('0x3e'))){_0x351656[_0xd118('0x1f')]=qs[_0xd118('0x1f')](_0x6adf6b['query'][_0xd118('0x1f')]);_0x351656['offset']=qs[_0xd118('0x1c')](_0x6adf6b[_0xd118('0x39')][_0xd118('0x1c')]);}_0x351656[_0xd118('0x3f')]=qs[_0xd118('0x40')](_0x6adf6b[_0xd118('0x39')][_0xd118('0x40')]);_0x351656[_0xd118('0x41')]=qs[_0xd118('0x42')](_['pick'](_0x6adf6b['query'],_0x4d885e[_0xd118('0x42')]),_0xaf12bd);if(_0x6adf6b[_0xd118('0x39')][_0xd118('0x43')]){_0x351656[_0xd118('0x41')]=_[_0xd118('0x2d')](_0x351656[_0xd118('0x41')],{'$or':_['map'](_0xaf12bd,function(_0xf7fb25){if(_0xf7fb25[_0xd118('0x36')]!==_0xd118('0x44')){var _0x23a884={};_0x23a884[_0xf7fb25[_0xd118('0x2a')]]={'$like':'%'+_0x6adf6b['query'][_0xd118('0x43')]+'%'};return _0x23a884;}})});}_0x351656=_[_0xd118('0x2d')]({},_0x351656,_0x6adf6b['options']);var _0x196967={'where':_0x351656[_0xd118('0x41')]};return db[_0xd118('0x35')]['count'](_0x196967)[_0xd118('0x24')](function(_0x3e56f5){_0x456106['count']=_0x3e56f5;if(_0x6adf6b[_0xd118('0x39')][_0xd118('0x45')]){_0x351656[_0xd118('0x46')]=[{'all':!![]}];}return db[_0xd118('0x35')][_0xd118('0x47')](_0x351656);})['then'](function(_0x45127a){_0x456106[_0xd118('0x48')]=_0x45127a;return _0x456106;})[_0xd118('0x24')](respondWithFilteredResult(_0x3cf667,_0x351656))[_0xd118('0x49')](handleError(_0x3cf667,null));};exports[_0xd118('0x4a')]=function(_0x3a21c6,_0x514b8c){var _0x5abb3d={'raw':!![],'where':{'id':_0x3a21c6[_0xd118('0x4b')]['id']}},_0x362709={};_0x362709[_0xd118('0x37')]=_[_0xd118('0x4c')](db[_0xd118('0x35')][_0xd118('0x4d')]);_0x362709[_0xd118('0x39')]=_[_0xd118('0x4c')](_0x3a21c6[_0xd118('0x39')]);_0x362709[_0xd118('0x42')]=_[_0xd118('0x3a')](_0x362709['model'],_0x362709['query']);_0x5abb3d['attributes']=_['intersection'](_0x362709['model'],qs[_0xd118('0x3c')](_0x3a21c6['query']['fields']));_0x5abb3d['attributes']=_0x5abb3d['attributes']['length']?_0x5abb3d[_0xd118('0x3b')]:_0x362709[_0xd118('0x37')];if(_0x3a21c6[_0xd118('0x39')][_0xd118('0x45')]){_0x5abb3d[_0xd118('0x46')]=[{'all':!![]}];}_0x5abb3d=_[_0xd118('0x2d')]({},_0x5abb3d,_0x3a21c6['options']);return db[_0xd118('0x35')][_0xd118('0x4e')](_0x5abb3d)[_0xd118('0x24')](handleEntityNotFound(_0x514b8c,null))[_0xd118('0x24')](respondWithResult(_0x514b8c,null))[_0xd118('0x49')](handleError(_0x514b8c,null));};exports[_0xd118('0x4f')]=function(_0x1f72e5,_0x1071c7){return db[_0xd118('0x35')]['create'](_0x1f72e5[_0xd118('0x2e')],{})[_0xd118('0x24')](function(_0xd9e1e0){var _0x3a93fc=_0x1f72e5['user'][_0xd118('0x25')]({'plain':!![]});if(!_0x3a93fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a93fc[_0xd118('0x50')]===_0xd118('0x51')){var _0x3daf6d=_0xd9e1e0[_0xd118('0x25')]({'plain':!![]});var _0x29e629='CmContactHasPhones';return db[_0xd118('0x52')]['find']({'where':{'name':_0x29e629,'userProfileId':_0x3a93fc[_0xd118('0x53')]},'raw':!![]})['then'](function(_0x2b88e3){if(_0x2b88e3&&_0x2b88e3[_0xd118('0x54')]===0x0){return db[_0xd118('0x26')][_0xd118('0x4f')]({'name':_0x3daf6d[_0xd118('0x2a')],'resourceId':_0x3daf6d['id'],'type':_0x2b88e3[_0xd118('0x2a')],'sectionId':_0x2b88e3['id']},{})[_0xd118('0x24')](function(){return _0xd9e1e0;});}else{return _0xd9e1e0;}})['catch'](function(_0x3b2e2f){logger[_0xd118('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b2e2f);throw _0x3b2e2f;});}return _0xd9e1e0;})[_0xd118('0x24')](respondWithResult(_0x1071c7,0xc9))[_0xd118('0x49')](handleError(_0x1071c7,null));};exports[_0xd118('0x23')]=function(_0x8628fb,_0x4eb810){if(_0x8628fb[_0xd118('0x2e')]['id']){delete _0x8628fb[_0xd118('0x2e')]['id'];}return db['CmContactHasPhone'][_0xd118('0x4e')]({'where':{'id':_0x8628fb[_0xd118('0x4b')]['id']}})[_0xd118('0x24')](handleEntityNotFound(_0x4eb810,null))[_0xd118('0x24')](saveUpdates(_0x8628fb[_0xd118('0x2e')],null))[_0xd118('0x24')](respondWithResult(_0x4eb810,null))[_0xd118('0x49')](handleError(_0x4eb810,null));};exports[_0xd118('0x27')]=function(_0x461c51,_0x2085a3){return db[_0xd118('0x35')][_0xd118('0x4e')]({'where':{'id':_0x461c51[_0xd118('0x4b')]['id']}})[_0xd118('0x24')](handleEntityNotFound(_0x2085a3,null))[_0xd118('0x24')](removeEntity(_0x2085a3,null))[_0xd118('0x49')](handleError(_0x2085a3,null));}; \ No newline at end of file +var _0xa1c1=['contact','message','agent','interaction','account','index','CmContactHasPhone','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','get','CmContactHasPhones','stack','name','send','render','merge','body'];(function(_0x49fcfb,_0x504dec){var _0x964926=function(_0x327977){while(--_0x327977){_0x49fcfb['push'](_0x49fcfb['shift']());}};_0x964926(++_0x504dec);}(_0xa1c1,0xd4));var _0x1a1c=function(_0x33aaf4,_0x3f9c4a){_0x33aaf4=_0x33aaf4-0x0;var _0x3a46a7=_0xa1c1[_0x33aaf4];return _0x3a46a7;};'use strict';var emlformat=require(_0x1a1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a1c('0x1'));var jsonpatch=require(_0x1a1c('0x2'));var rp=require(_0x1a1c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1a1c('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a1c('0x5'));var squel=require(_0x1a1c('0x6'));var crypto=require(_0x1a1c('0x7'));var jsforce=require(_0x1a1c('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a1c('0x9'));var Redis=require('ioredis');var authService=require(_0x1a1c('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x1a1c('0xb'));var hardwareService=require(_0x1a1c('0xc'));var logger=require('../../config/logger')(_0x1a1c('0xd'));var utils=require(_0x1a1c('0xe'));var config=require(_0x1a1c('0xf'));var licenseUtil=require(_0x1a1c('0x10'));var db=require(_0x1a1c('0x11'))['db'];function respondWithStatusCode(_0x173a97,_0x15355b){_0x15355b=_0x15355b||0xcc;return function(_0x52966b){if(_0x52966b){return _0x173a97[_0x1a1c('0x12')](_0x15355b);}return _0x173a97[_0x1a1c('0x13')](_0x15355b)[_0x1a1c('0x14')]();};}function respondWithResult(_0x2c6ae5,_0x1e61f4){_0x1e61f4=_0x1e61f4||0xc8;return function(_0x3f60aa){if(_0x3f60aa){return _0x2c6ae5[_0x1a1c('0x13')](_0x1e61f4)[_0x1a1c('0x15')](_0x3f60aa);}};}function respondWithFilteredResult(_0x38262,_0xbfe053){return function(_0x10df9c){if(_0x10df9c){var _0x23706c=typeof _0xbfe053['offset']===_0x1a1c('0x16')&&typeof _0xbfe053[_0x1a1c('0x17')]===_0x1a1c('0x16');var _0x54267c=_0x10df9c[_0x1a1c('0x18')];var _0x2f4f7d=_0x23706c?0x0:_0xbfe053['offset'];var _0x4d3a57=_0x23706c?_0x10df9c[_0x1a1c('0x18')]:_0xbfe053[_0x1a1c('0x19')]+_0xbfe053[_0x1a1c('0x17')];var _0x35553b;if(_0x4d3a57>=_0x54267c){_0x4d3a57=_0x54267c;_0x35553b=0xc8;}else{_0x35553b=0xce;}_0x38262[_0x1a1c('0x13')](_0x35553b);return _0x38262[_0x1a1c('0x1a')](_0x1a1c('0x1b'),_0x2f4f7d+'-'+_0x4d3a57+'/'+_0x54267c)['json'](_0x10df9c);}return null;};}function patchUpdates(_0x1d0114){return function(_0x1ae5fa){try{jsonpatch[_0x1a1c('0x1c')](_0x1ae5fa,_0x1d0114,!![]);}catch(_0x59e931){return BPromise['reject'](_0x59e931);}return _0x1ae5fa['save']();};}function saveUpdates(_0x1d0ba3,_0x1a19ff){return function(_0x30480b){if(_0x30480b){return _0x30480b[_0x1a1c('0x1d')](_0x1d0ba3)[_0x1a1c('0x1e')](function(_0xfe2866){return _0xfe2866;});}return null;};}function removeEntity(_0x221320,_0x3dc06e){return function(_0x4fc1cf){if(_0x4fc1cf){return _0x4fc1cf[_0x1a1c('0x1f')]()[_0x1a1c('0x1e')](function(){var _0x2843a6=_0x4fc1cf[_0x1a1c('0x20')]({'plain':!![]});var _0x421eb0=_0x1a1c('0x21');return db['UserProfileResource'][_0x1a1c('0x1f')]({'where':{'type':_0x421eb0,'resourceId':_0x2843a6['id']}})[_0x1a1c('0x1e')](function(){return _0x4fc1cf;});})['then'](function(){_0x221320['status'](0xcc)[_0x1a1c('0x14')]();});}};}function handleEntityNotFound(_0x2b58fa,_0x263215){return function(_0x6a56b5){if(!_0x6a56b5){_0x2b58fa['sendStatus'](0x194);}return _0x6a56b5;};}function handleError(_0x11909f,_0x1efc83){_0x1efc83=_0x1efc83||0x1f4;return function(_0x5bcc6d){logger['error'](_0x5bcc6d[_0x1a1c('0x22')]);if(_0x5bcc6d[_0x1a1c('0x23')]){delete _0x5bcc6d[_0x1a1c('0x23')];}_0x11909f[_0x1a1c('0x13')](_0x1efc83)[_0x1a1c('0x24')](_0x5bcc6d);};}function getMustacheRender(_0xd34ea4,_0x1e9ac5){return Mustache[_0x1a1c('0x25')](_0xd34ea4,_[_0x1a1c('0x26')](_0x1e9ac5[_0x1a1c('0x27')],{'contact':_0x1e9ac5[_0x1a1c('0x28')],'message':_0x1e9ac5[_0x1a1c('0x29')],'agent':_0x1e9ac5[_0x1a1c('0x2a')],'interaction':_0x1e9ac5[_0x1a1c('0x2b')],'account':_0x1e9ac5[_0x1a1c('0x2c')]}))||'';}exports[_0x1a1c('0x2d')]=function(_0x57a9fe,_0x1aa5b4){var _0x4805e3={},_0x2d0960={},_0x465db7={'count':0x0,'rows':[]};var _0x3dd4f0=_['map'](db[_0x1a1c('0x2e')][_0x1a1c('0x2f')],function(_0x4c8db8){return{'name':_0x4c8db8[_0x1a1c('0x30')],'type':_0x4c8db8[_0x1a1c('0x31')][_0x1a1c('0x32')]};});_0x2d0960[_0x1a1c('0x33')]=_[_0x1a1c('0x34')](_0x3dd4f0,_0x1a1c('0x23'));_0x2d0960[_0x1a1c('0x35')]=_[_0x1a1c('0x36')](_0x57a9fe['query']);_0x2d0960[_0x1a1c('0x37')]=_[_0x1a1c('0x38')](_0x2d0960[_0x1a1c('0x33')],_0x2d0960[_0x1a1c('0x35')]);_0x4805e3[_0x1a1c('0x39')]=_[_0x1a1c('0x38')](_0x2d0960['model'],qs['fields'](_0x57a9fe[_0x1a1c('0x35')][_0x1a1c('0x3a')]));_0x4805e3['attributes']=_0x4805e3[_0x1a1c('0x39')][_0x1a1c('0x3b')]?_0x4805e3[_0x1a1c('0x39')]:_0x2d0960[_0x1a1c('0x33')];if(!_0x57a9fe[_0x1a1c('0x35')][_0x1a1c('0x3c')](_0x1a1c('0x3d'))){_0x4805e3[_0x1a1c('0x17')]=qs[_0x1a1c('0x17')](_0x57a9fe[_0x1a1c('0x35')][_0x1a1c('0x17')]);_0x4805e3[_0x1a1c('0x19')]=qs[_0x1a1c('0x19')](_0x57a9fe[_0x1a1c('0x35')][_0x1a1c('0x19')]);}_0x4805e3[_0x1a1c('0x3e')]=qs['sort'](_0x57a9fe['query'][_0x1a1c('0x3f')]);_0x4805e3['where']=qs[_0x1a1c('0x37')](_['pick'](_0x57a9fe['query'],_0x2d0960[_0x1a1c('0x37')]),_0x3dd4f0);if(_0x57a9fe[_0x1a1c('0x35')][_0x1a1c('0x40')]){_0x4805e3['where']=_[_0x1a1c('0x26')](_0x4805e3[_0x1a1c('0x41')],{'$or':_['map'](_0x3dd4f0,function(_0x4550de){if(_0x4550de[_0x1a1c('0x31')]!==_0x1a1c('0x42')){var _0x43512b={};_0x43512b[_0x4550de[_0x1a1c('0x23')]]={'$like':'%'+_0x57a9fe[_0x1a1c('0x35')][_0x1a1c('0x40')]+'%'};return _0x43512b;}})});}_0x4805e3=_[_0x1a1c('0x26')]({},_0x4805e3,_0x57a9fe[_0x1a1c('0x43')]);var _0x23aa4e={'where':_0x4805e3[_0x1a1c('0x41')]};return db['CmContactHasPhone'][_0x1a1c('0x18')](_0x23aa4e)[_0x1a1c('0x1e')](function(_0x3917ad){_0x465db7[_0x1a1c('0x18')]=_0x3917ad;if(_0x57a9fe[_0x1a1c('0x35')][_0x1a1c('0x44')]){_0x4805e3[_0x1a1c('0x45')]=[{'all':!![]}];}return db[_0x1a1c('0x2e')][_0x1a1c('0x46')](_0x4805e3);})[_0x1a1c('0x1e')](function(_0x44ebec){_0x465db7[_0x1a1c('0x47')]=_0x44ebec;return _0x465db7;})[_0x1a1c('0x1e')](respondWithFilteredResult(_0x1aa5b4,_0x4805e3))[_0x1a1c('0x48')](handleError(_0x1aa5b4,null));};exports['show']=function(_0x30206f,_0x41763f){var _0x216fc0={'raw':!![],'where':{'id':_0x30206f[_0x1a1c('0x49')]['id']}},_0x2cd108={};_0x2cd108[_0x1a1c('0x33')]=_[_0x1a1c('0x36')](db[_0x1a1c('0x2e')][_0x1a1c('0x2f')]);_0x2cd108[_0x1a1c('0x35')]=_[_0x1a1c('0x36')](_0x30206f[_0x1a1c('0x35')]);_0x2cd108[_0x1a1c('0x37')]=_[_0x1a1c('0x38')](_0x2cd108[_0x1a1c('0x33')],_0x2cd108['query']);_0x216fc0['attributes']=_['intersection'](_0x2cd108['model'],qs['fields'](_0x30206f['query'][_0x1a1c('0x3a')]));_0x216fc0[_0x1a1c('0x39')]=_0x216fc0[_0x1a1c('0x39')][_0x1a1c('0x3b')]?_0x216fc0['attributes']:_0x2cd108[_0x1a1c('0x33')];if(_0x30206f[_0x1a1c('0x35')][_0x1a1c('0x44')]){_0x216fc0[_0x1a1c('0x45')]=[{'all':!![]}];}_0x216fc0=_[_0x1a1c('0x26')]({},_0x216fc0,_0x30206f[_0x1a1c('0x43')]);return db['CmContactHasPhone'][_0x1a1c('0x4a')](_0x216fc0)['then'](handleEntityNotFound(_0x41763f,null))[_0x1a1c('0x1e')](respondWithResult(_0x41763f,null))[_0x1a1c('0x48')](handleError(_0x41763f,null));};exports[_0x1a1c('0x4b')]=function(_0x412cd7,_0x293965){return db[_0x1a1c('0x2e')]['create'](_0x412cd7[_0x1a1c('0x27')],{})[_0x1a1c('0x1e')](function(_0x18e43b){var _0x2ca358=_0x412cd7[_0x1a1c('0x4c')][_0x1a1c('0x20')]({'plain':!![]});if(!_0x2ca358)throw new Error(_0x1a1c('0x4d'));if(_0x2ca358[_0x1a1c('0x4e')]===_0x1a1c('0x4c')){var _0x12e412=_0x18e43b['get']({'plain':!![]});var _0x430da6=_0x1a1c('0x21');return db[_0x1a1c('0x4f')]['find']({'where':{'name':_0x430da6,'userProfileId':_0x2ca358['userProfileId']},'raw':!![]})[_0x1a1c('0x1e')](function(_0x18bbc9){if(_0x18bbc9&&_0x18bbc9[_0x1a1c('0x50')]===0x0){return db[_0x1a1c('0x51')][_0x1a1c('0x4b')]({'name':_0x12e412[_0x1a1c('0x23')],'resourceId':_0x12e412['id'],'type':_0x18bbc9[_0x1a1c('0x23')],'sectionId':_0x18bbc9['id']},{})[_0x1a1c('0x1e')](function(){return _0x18e43b;});}else{return _0x18e43b;}})[_0x1a1c('0x48')](function(_0x2baebe){logger[_0x1a1c('0x52')](_0x1a1c('0x53'),_0x2baebe);throw _0x2baebe;});}return _0x18e43b;})[_0x1a1c('0x1e')](respondWithResult(_0x293965,0xc9))[_0x1a1c('0x48')](handleError(_0x293965,null));};exports['update']=function(_0x5cb5e4,_0x5b5973){if(_0x5cb5e4[_0x1a1c('0x27')]['id']){delete _0x5cb5e4[_0x1a1c('0x27')]['id'];}return db[_0x1a1c('0x2e')][_0x1a1c('0x4a')]({'where':{'id':_0x5cb5e4['params']['id']}})[_0x1a1c('0x1e')](handleEntityNotFound(_0x5b5973,null))['then'](saveUpdates(_0x5cb5e4[_0x1a1c('0x27')],null))['then'](respondWithResult(_0x5b5973,null))['catch'](handleError(_0x5b5973,null));};exports['destroy']=function(_0x5f16c9,_0x38767a){return db[_0x1a1c('0x2e')]['find']({'where':{'id':_0x5f16c9['params']['id']}})['then'](handleEntityNotFound(_0x38767a,null))[_0x1a1c('0x1e')](removeEntity(_0x38767a,null))[_0x1a1c('0x48')](handleError(_0x38767a,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 557da3a..f23b087 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac8b=['path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd822,_0x3b9fed){var _0x4f58d0=function(_0x41be33){while(--_0x41be33){_0x3dd822['push'](_0x3dd822['shift']());}};_0x4f58d0(++_0x3b9fed);}(_0xac8b,0x1c2));var _0xbac8=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xac8b[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0xbac8('0x0'));var logger=require(_0xbac8('0x1'))('api');var moment=require(_0xbac8('0x2'));var BPromise=require(_0xbac8('0x3'));var rp=require(_0xbac8('0x4'));var fs=require('fs');var path=require(_0xbac8('0x5'));var rimraf=require(_0xbac8('0x6'));var config=require(_0xbac8('0x7'));var attributes=require(_0xbac8('0x8'));module[_0xbac8('0x9')]=function(_0x329e46,_0x2c9733){return _0x329e46[_0xbac8('0xa')](_0xbac8('0xb'),attributes,{'tableName':_0xbac8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43e0=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmContactHasPhone.attributes','exports','CmContactHasPhone','cm_contact_has_phones','lodash'];(function(_0x2816f6,_0x37b423){var _0x276ccb=function(_0xcb7305){while(--_0xcb7305){_0x2816f6['push'](_0x2816f6['shift']());}};_0x276ccb(++_0x37b423);}(_0x43e0,0x197));var _0x043e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x43e0[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x043e('0x0'));var util=require(_0x043e('0x1'));var logger=require(_0x043e('0x2'))(_0x043e('0x3'));var moment=require('moment');var BPromise=require(_0x043e('0x4'));var rp=require(_0x043e('0x5'));var fs=require('fs');var path=require(_0x043e('0x6'));var rimraf=require('rimraf');var config=require(_0x043e('0x7'));var attributes=require(_0x043e('0x8'));module[_0x043e('0x9')]=function(_0x425510,_0x3c392e){return _0x425510['define'](_0x043e('0xa'),attributes,{'tableName':_0x043e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index ed4d079..3b37c43 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd7b=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasPhone,\x20%s,\x20%s','message','result','catch'];(function(_0x4d7c88,_0x1c76d5){var _0x3e99c8=function(_0x3d7bad){while(--_0x3d7bad){_0x4d7c88['push'](_0x4d7c88['shift']());}};_0x3e99c8(++_0x1c76d5);}(_0xdd7b,0x168));var _0xbdd7=function(_0x563e58,_0x5dcadb){_0x563e58=_0x563e58-0x0;var _0x26f800=_0xdd7b[_0x563e58];return _0x26f800;};'use strict';var _=require(_0xbdd7('0x0'));var util=require(_0xbdd7('0x1'));var moment=require(_0xbdd7('0x2'));var BPromise=require(_0xbdd7('0x3'));var rs=require(_0xbdd7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdd7('0x5'))['db'];var utils=require(_0xbdd7('0x6'));var logger=require('../../config/logger')(_0xbdd7('0x7'));var config=require(_0xbdd7('0x8'));var jayson=require(_0xbdd7('0x9'));var client=jayson[_0xbdd7('0xa')][_0xbdd7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d240c,_0x358b4a,_0x46b6b2){return new BPromise(function(_0x54e112,_0x3cf920){return client[_0xbdd7('0xc')](_0x2d240c,_0x46b6b2)[_0xbdd7('0xd')](function(_0x4e8494){logger[_0xbdd7('0xe')]('CmContactHasPhone,\x20%s,\x20%s',_0x358b4a,_0xbdd7('0xf'));logger['debug'](_0xbdd7('0x10'),_0x358b4a,'request\x20sent',JSON[_0xbdd7('0x11')](_0x4e8494));if(_0x4e8494[_0xbdd7('0x12')]){if(_0x4e8494[_0xbdd7('0x12')][_0xbdd7('0x13')]===0x1f4){logger[_0xbdd7('0x12')](_0xbdd7('0x14'),_0x358b4a,_0x4e8494['error']['message']);return _0x3cf920(_0x4e8494[_0xbdd7('0x12')][_0xbdd7('0x15')]);}logger[_0xbdd7('0x12')](_0xbdd7('0x14'),_0x358b4a,_0x4e8494[_0xbdd7('0x12')][_0xbdd7('0x15')]);return _0x54e112(_0x4e8494[_0xbdd7('0x12')][_0xbdd7('0x15')]);}else{logger[_0xbdd7('0xe')](_0xbdd7('0x14'),_0x358b4a,_0xbdd7('0xf'));_0x54e112(_0x4e8494[_0xbdd7('0x16')][_0xbdd7('0x15')]);}})[_0xbdd7('0x17')](function(_0x25a19e){logger[_0xbdd7('0x12')]('CmContactHasPhone,\x20%s,\x20%s',_0x358b4a,_0x25a19e);_0x3cf920(_0x25a19e);});});} \ No newline at end of file +var _0x0803=['../../config/environment','jayson/promise','http','then','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x32619d,_0x2c1b3d){var _0x44d06f=function(_0x1a8278){while(--_0x1a8278){_0x32619d['push'](_0x32619d['shift']());}};_0x44d06f(++_0x2c1b3d);}(_0x0803,0x125));var _0x3080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0803[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3080('0x0'));var util=require('util');var moment=require(_0x3080('0x1'));var BPromise=require('bluebird');var rs=require(_0x3080('0x2'));var fs=require('fs');var Redis=require(_0x3080('0x3'));var db=require(_0x3080('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3080('0x5'))(_0x3080('0x6'));var config=require(_0x3080('0x7'));var jayson=require(_0x3080('0x8'));var client=jayson['client'][_0x3080('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51b084,_0x3d238c,_0x3ab6ff){return new BPromise(function(_0x2b9cef,_0x42bdd3){return client['request'](_0x51b084,_0x3ab6ff)[_0x3080('0xa')](function(_0xac3761){logger[_0x3080('0xb')](_0x3080('0xc'),_0x3d238c,_0x3080('0xd'));logger[_0x3080('0xe')](_0x3080('0xf'),_0x3d238c,_0x3080('0xd'),JSON[_0x3080('0x10')](_0xac3761));if(_0xac3761[_0x3080('0x11')]){if(_0xac3761['error']['code']===0x1f4){logger[_0x3080('0x11')](_0x3080('0xc'),_0x3d238c,_0xac3761[_0x3080('0x11')][_0x3080('0x12')]);return _0x42bdd3(_0xac3761['error']['message']);}logger[_0x3080('0x11')](_0x3080('0xc'),_0x3d238c,_0xac3761[_0x3080('0x11')]['message']);return _0x2b9cef(_0xac3761[_0x3080('0x11')][_0x3080('0x12')]);}else{logger[_0x3080('0xb')](_0x3080('0xc'),_0x3d238c,_0x3080('0xd'));_0x2b9cef(_0xac3761[_0x3080('0x13')][_0x3080('0x12')]);}})['catch'](function(_0x155422){logger[_0x3080('0x11')](_0x3080('0xc'),_0x3d238c,_0x155422);_0x42bdd3(_0x155422);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index a483a35..d015b2f 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd61a=['show','create','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x3b68ee,_0x34793e){var _0x300829=function(_0x3b1281){while(--_0x3b1281){_0x3b68ee['push'](_0x3b68ee['shift']());}};_0x300829(++_0x34793e);}(_0xd61a,0x148));var _0xad61=function(_0x403db1,_0x59018e){_0x403db1=_0x403db1-0x0;var _0x47c48f=_0xd61a[_0x403db1];return _0x47c48f;};'use strict';var multer=require(_0xad61('0x0'));var util=require(_0xad61('0x1'));var path=require(_0xad61('0x2'));var timeout=require(_0xad61('0x3'));var express=require('express');var router=express[_0xad61('0x4')]();var fs_extra=require(_0xad61('0x5'));var auth=require(_0xad61('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xad61('0x7'));router[_0xad61('0x8')]('/',auth[_0xad61('0x9')](),controller[_0xad61('0xa')]);router[_0xad61('0x8')](_0xad61('0xb'),auth[_0xad61('0x9')](),controller[_0xad61('0xc')]);router['post']('/',auth[_0xad61('0x9')](),controller[_0xad61('0xd')]);router['put']('/:id',auth[_0xad61('0x9')](),controller[_0xad61('0xe')]);router[_0xad61('0xf')](_0xad61('0xb'),auth[_0xad61('0x9')](),controller[_0xad61('0x10')]);module['exports']=router; \ No newline at end of file +var _0x95a0=['util','path','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x2cad31,_0x4a3a07){var _0x3cde9e=function(_0x3e6524){while(--_0x3e6524){_0x2cad31['push'](_0x2cad31['shift']());}};_0x3cde9e(++_0x4a3a07);}(_0x95a0,0x7d));var _0x095a=function(_0x2365d3,_0x84eaec){_0x2365d3=_0x2365d3-0x0;var _0x1e110f=_0x95a0[_0x2365d3];return _0x1e110f;};'use strict';var multer=require(_0x095a('0x0'));var util=require(_0x095a('0x1'));var path=require(_0x095a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x095a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x095a('0x4'));var config=require(_0x095a('0x5'));var controller=require(_0x095a('0x6'));router['get']('/',auth[_0x095a('0x7')](),controller[_0x095a('0x8')]);router[_0x095a('0x9')](_0x095a('0xa'),auth[_0x095a('0x7')](),controller[_0x095a('0xb')]);router[_0x095a('0xc')]('/',auth[_0x095a('0x7')](),controller[_0x095a('0xd')]);router[_0x095a('0xe')](_0x095a('0xa'),auth[_0x095a('0x7')](),controller[_0x095a('0xf')]);router[_0x095a('0x10')](_0x095a('0xa'),auth[_0x095a('0x7')](),controller[_0x095a('0x11')]);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 760a297..11949b8 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 _0x3248=['long','select','parse','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT'];(function(_0x4a1fe9,_0x556021){var _0x393689=function(_0x1842e4){while(--_0x1842e4){_0x4a1fe9['push'](_0x4a1fe9['shift']());}};_0x393689(++_0x556021);}(_0x3248,0x1b0));var _0x8324=function(_0x189d90,_0x4afa41){_0x189d90=_0x189d90-0x0;var _0x1d26da=_0x3248[_0x189d90];return _0x1d26da;};'use strict';var Sequelize=require(_0x8324('0x0'));var _=require(_0x8324('0x1'));module[_0x8324('0x2')]={'name':{'type':Sequelize[_0x8324('0x3')],'get':function(_0x9b580){return this[_0x8324('0x4')](_0x8324('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4c565b){this[_0x8324('0x6')](_0x8324('0x5'),_0x4c565b?_0x4c565b:this['getDataValue'](_0x8324('0x7')));}},'type':{'type':Sequelize[_0x8324('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x8324('0x9')](_0x8324('0xa')),'get':function(){if(this[_0x8324('0x4')]('type')===_0x8324('0xb')){return JSON[_0x8324('0xc')](this[_0x8324('0x4')]('values'));}else{return this['getDataValue'](_0x8324('0xd'));}},'set':function(_0x3ad4e9){if(Array[_0x8324('0xe')](_0x3ad4e9)){this['setDataValue'](_0x8324('0xd'),JSON[_0x8324('0xf')](_0x3ad4e9));}else{this[_0x8324('0x6')](_0x8324('0xd'),_0x3ad4e9);}}},'required':{'type':Sequelize[_0x8324('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8324('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x50a6=['long','getDataValue','select','values','setDataValue','stringify','BOOLEAN','voice','sequelize','lodash','alias','STRING','TEXT'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x50a6,0xa4));var _0x650a=function(_0x317257,_0x1677dc){_0x317257=_0x317257-0x0;var _0x1f235d=_0x50a6[_0x317257];return _0x1f235d;};'use strict';var Sequelize=require(_0x650a('0x0'));var _=require(_0x650a('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x154e12){return this['getDataValue'](_0x650a('0x2'));}},'alias':{'type':Sequelize[_0x650a('0x3')],'allowNull':![],'set':function(_0x2c71ba){this['setDataValue'](_0x650a('0x2'),_0x2c71ba?_0x2c71ba:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x650a('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x650a('0x4')](_0x650a('0x5')),'get':function(){if(this[_0x650a('0x6')]('type')===_0x650a('0x7')){return JSON['parse'](this[_0x650a('0x6')](_0x650a('0x8')));}else{return this['getDataValue'](_0x650a('0x8'));}},'set':function(_0x3bbdca){if(Array['isArray'](_0x3bbdca)){this[_0x650a('0x9')]('values',JSON[_0x650a('0xa')](_0x3bbdca));}else{this['setDataValue'](_0x650a('0x8'),_0x3bbdca);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x650a('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x650a('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6540ddb..b7c0d22 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 _0x8958=['limit','count','offset','apply','reject','save','update','then','error','name','send','merge','body','contact','message','agent','index','CmCustomField','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','filter','options','includeAll','include','catch','show','rawAttributes','find','destroy','params','create','sequelize','transaction','Sequelize','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0xac1d22,_0xbf01e5){var _0x3a30cc=function(_0x46fb8a){while(--_0x46fb8a){_0xac1d22['push'](_0xac1d22['shift']());}};_0x3a30cc(++_0xbf01e5);}(_0x8958,0x93));var _0x8895=function(_0x2d8a76,_0x250ab4){_0x2d8a76=_0x2d8a76-0x0;var _0xb14acd=_0x8958[_0x2d8a76];return _0xb14acd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}function getMustacheRender(_0x153220,_0x5c03ea){return Mustache['render'](_0x153220,_[_0x8895('0x28')](_0x5c03ea[_0x8895('0x29')],{'contact':_0x5c03ea[_0x8895('0x2a')],'message':_0x5c03ea[_0x8895('0x2b')],'agent':_0x5c03ea[_0x8895('0x2c')],'interaction':_0x5c03ea['interaction'],'account':_0x5c03ea['account']}))||'';}exports[_0x8895('0x2d')]=function(_0x848a11,_0x1c16f6){var _0x29f565={},_0x1eabb6={},_0x52f2ac={'count':0x0,'rows':[]};var _0x1da939=_['map'](db[_0x8895('0x2e')]['rawAttributes'],function(_0x40ba14){return{'name':_0x40ba14[_0x8895('0x2f')],'type':_0x40ba14[_0x8895('0x30')][_0x8895('0x31')]};});_0x1eabb6[_0x8895('0x32')]=_['differenceBy'](_[_0x8895('0x33')](_0x1da939,_0x8895('0x26')),[_0x8895('0x26')]);_0x1eabb6[_0x8895('0x34')]=_[_0x8895('0x35')](_0x848a11['query']);_0x1eabb6[_0x8895('0x36')]=_['intersection'](_0x1eabb6[_0x8895('0x32')],_0x1eabb6['query']);_0x29f565[_0x8895('0x37')]=_[_0x8895('0x38')](_0x1eabb6[_0x8895('0x32')],qs[_0x8895('0x39')](_0x848a11[_0x8895('0x34')]['fields']));_0x29f565[_0x8895('0x37')]=_0x29f565['attributes'][_0x8895('0x3a')]?_0x29f565[_0x8895('0x37')]:_0x1eabb6[_0x8895('0x32')];if(!_0x848a11[_0x8895('0x34')][_0x8895('0x3b')](_0x8895('0x3c'))){_0x29f565['limit']=qs[_0x8895('0x1d')](_0x848a11[_0x8895('0x34')]['limit']);_0x29f565[_0x8895('0x1f')]=qs['offset'](_0x848a11[_0x8895('0x34')][_0x8895('0x1f')]);}_0x29f565['order']=qs[_0x8895('0x3d')](_0x848a11[_0x8895('0x34')]['sort']);_0x29f565['where']=qs[_0x8895('0x36')](_[_0x8895('0x3e')](_0x848a11[_0x8895('0x34')],_0x1eabb6[_0x8895('0x36')]),_0x1da939);if(_0x848a11[_0x8895('0x34')]['filter']){_0x29f565[_0x8895('0x3f')]=_[_0x8895('0x28')](_0x29f565[_0x8895('0x3f')],{'$or':_[_0x8895('0x33')](_0x1da939,function(_0x1d9e26){if(_0x1d9e26[_0x8895('0x30')]!=='VIRTUAL'){var _0x174be1={};_0x174be1[_0x1d9e26['name']]={'$like':'%'+_0x848a11[_0x8895('0x34')][_0x8895('0x40')]+'%'};return _0x174be1;}})});}_0x29f565=_['merge']({},_0x29f565,_0x848a11[_0x8895('0x41')]);var _0x4e8fbc={'where':_0x29f565[_0x8895('0x3f')]};return db['CmCustomField']['count'](_0x4e8fbc)['then'](function(_0x4cd625){_0x52f2ac['count']=_0x4cd625;if(_0x848a11['query'][_0x8895('0x42')]){_0x29f565[_0x8895('0x43')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x29f565);})[_0x8895('0x24')](function(_0x3d765d){_0x52f2ac['rows']=_0x3d765d;return _0x52f2ac;})[_0x8895('0x24')](respondWithFilteredResult(_0x1c16f6,_0x29f565))[_0x8895('0x44')](handleError(_0x1c16f6,null));};exports[_0x8895('0x45')]=function(_0x3b873b,_0x2d07d6){var _0x598ed5={'raw':!![],'where':{'id':_0x3b873b['params']['id']}},_0x549080={};_0x549080[_0x8895('0x32')]=_['keys'](db[_0x8895('0x2e')][_0x8895('0x46')]);_0x549080[_0x8895('0x34')]=_[_0x8895('0x35')](_0x3b873b['query']);_0x549080[_0x8895('0x36')]=_[_0x8895('0x38')](_0x549080[_0x8895('0x32')],_0x549080[_0x8895('0x34')]);_0x598ed5[_0x8895('0x37')]=_[_0x8895('0x38')](_0x549080[_0x8895('0x32')],qs[_0x8895('0x39')](_0x3b873b['query'][_0x8895('0x39')]));_0x598ed5[_0x8895('0x37')]=_0x598ed5['attributes'][_0x8895('0x3a')]?_0x598ed5['attributes']:_0x549080['model'];if(_0x3b873b[_0x8895('0x34')][_0x8895('0x42')]){_0x598ed5[_0x8895('0x43')]=[{'all':!![]}];}_0x598ed5=_['merge']({},_0x598ed5,_0x3b873b[_0x8895('0x41')]);return db['CmCustomField'][_0x8895('0x47')](_0x598ed5)[_0x8895('0x24')](handleEntityNotFound(_0x2d07d6,null))[_0x8895('0x24')](respondWithResult(_0x2d07d6,null))[_0x8895('0x44')](handleError(_0x2d07d6,null));};exports[_0x8895('0x23')]=function(_0x21c954,_0xebb0c4){if(_0x21c954['body']['id']){delete _0x21c954['body']['id'];}return db[_0x8895('0x2e')][_0x8895('0x47')]({'where':{'id':_0x21c954['params']['id']}})[_0x8895('0x24')](handleEntityNotFound(_0xebb0c4,null))['then'](saveUpdates(_0x21c954['body'],null))[_0x8895('0x24')](respondWithResult(_0xebb0c4,null))['catch'](handleError(_0xebb0c4,null));};exports[_0x8895('0x48')]=function(_0x2c2979,_0x43aada){return db[_0x8895('0x2e')][_0x8895('0x47')]({'where':{'id':_0x2c2979[_0x8895('0x49')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x43aada,null))[_0x8895('0x24')](removeEntity(_0x43aada,null))['catch'](handleError(_0x43aada,null));};exports[_0x8895('0x4a')]=function(_0x3e25e7,_0x2f81f7){var _0x5a5bc6;return db[_0x8895('0x4b')][_0x8895('0x4c')](function(_0xd7ffeb){return db[_0x8895('0x2e')][_0x8895('0x4a')](_0x3e25e7[_0x8895('0x29')],{'transaction':_0xd7ffeb})[_0x8895('0x24')](function(_0x216e6e){_0x5a5bc6=_0x216e6e;var _0x13488f={'type':db[_0x8895('0x4d')]['TEXT'],'transaction':_0xd7ffeb};switch(_0x3e25e7[_0x8895('0x29')][_0x8895('0x30')]){case _0x8895('0x4e'):_0x13488f[_0x8895('0x30')]=db[_0x8895('0x4d')]['TEXT'];break;case _0x8895('0x4f'):_0x13488f[_0x8895('0x30')]=db[_0x8895('0x4d')][_0x8895('0x50')];break;case _0x8895('0x51'):_0x13488f['type']=db[_0x8895('0x4d')][_0x8895('0x52')];_0x13488f[_0x8895('0x53')]=![];break;default:}return db['sequelize'][_0x8895('0x54')][_0x8895('0x55')](_0x8895('0x56'),util['format'](_0x8895('0x57'),_0x5a5bc6['id']),_0x13488f);})[_0x8895('0x24')](function(){return _0x5a5bc6;});})['then'](respondWithResult(_0x2f81f7,0xc9))[_0x8895('0x44')](handleError(_0x2f81f7,null));}; \ No newline at end of file +var _0xacf4=['stack','name','send','render','merge','contact','message','agent','interaction','account','index','map','CmCustomField','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','find','body','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error'];(function(_0x5c57ea,_0xb97b6d){var _0x57d853=function(_0x3c896b){while(--_0x3c896b){_0x5c57ea['push'](_0x5c57ea['shift']());}};_0x57d853(++_0xb97b6d);}(_0xacf4,0xe7));var _0x4acf=function(_0x96f3a3,_0x14ea73){_0x96f3a3=_0x96f3a3-0x0;var _0x5e0277=_0xacf4[_0x96f3a3];return _0x5e0277;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}function getMustacheRender(_0xb83274,_0x7a1e79){return Mustache[_0x4acf('0x27')](_0xb83274,_[_0x4acf('0x28')](_0x7a1e79['body'],{'contact':_0x7a1e79[_0x4acf('0x29')],'message':_0x7a1e79[_0x4acf('0x2a')],'agent':_0x7a1e79[_0x4acf('0x2b')],'interaction':_0x7a1e79[_0x4acf('0x2c')],'account':_0x7a1e79[_0x4acf('0x2d')]}))||'';}exports[_0x4acf('0x2e')]=function(_0x27384c,_0x5d862f){var _0x337b3c={},_0x1d221b={},_0x16a74e={'count':0x0,'rows':[]};var _0x50dced=_[_0x4acf('0x2f')](db[_0x4acf('0x30')][_0x4acf('0x31')],function(_0x28ce8a){return{'name':_0x28ce8a['fieldName'],'type':_0x28ce8a[_0x4acf('0x32')][_0x4acf('0x33')]};});_0x1d221b[_0x4acf('0x34')]=_['differenceBy'](_[_0x4acf('0x2f')](_0x50dced,_0x4acf('0x25')),[_0x4acf('0x25')]);_0x1d221b[_0x4acf('0x35')]=_[_0x4acf('0x36')](_0x27384c[_0x4acf('0x35')]);_0x1d221b['filters']=_[_0x4acf('0x37')](_0x1d221b[_0x4acf('0x34')],_0x1d221b['query']);_0x337b3c[_0x4acf('0x38')]=_['intersection'](_0x1d221b['model'],qs['fields'](_0x27384c['query']['fields']));_0x337b3c['attributes']=_0x337b3c['attributes'][_0x4acf('0x39')]?_0x337b3c[_0x4acf('0x38')]:_0x1d221b['model'];if(!_0x27384c[_0x4acf('0x35')][_0x4acf('0x3a')](_0x4acf('0x3b'))){_0x337b3c[_0x4acf('0x1c')]=qs[_0x4acf('0x1c')](_0x27384c[_0x4acf('0x35')][_0x4acf('0x1c')]);_0x337b3c[_0x4acf('0x19')]=qs[_0x4acf('0x19')](_0x27384c[_0x4acf('0x35')]['offset']);}_0x337b3c['order']=qs[_0x4acf('0x3c')](_0x27384c[_0x4acf('0x35')]['sort']);_0x337b3c[_0x4acf('0x3d')]=qs[_0x4acf('0x3e')](_[_0x4acf('0x3f')](_0x27384c[_0x4acf('0x35')],_0x1d221b['filters']),_0x50dced);if(_0x27384c['query'][_0x4acf('0x40')]){_0x337b3c[_0x4acf('0x3d')]=_[_0x4acf('0x28')](_0x337b3c[_0x4acf('0x3d')],{'$or':_['map'](_0x50dced,function(_0x1a1535){if(_0x1a1535[_0x4acf('0x32')]!=='VIRTUAL'){var _0x5ac6f7={};_0x5ac6f7[_0x1a1535['name']]={'$like':'%'+_0x27384c['query'][_0x4acf('0x40')]+'%'};return _0x5ac6f7;}})});}_0x337b3c=_[_0x4acf('0x28')]({},_0x337b3c,_0x27384c[_0x4acf('0x41')]);var _0x54e756={'where':_0x337b3c[_0x4acf('0x3d')]};return db[_0x4acf('0x30')][_0x4acf('0x1b')](_0x54e756)[_0x4acf('0x21')](function(_0x14d92b){_0x16a74e[_0x4acf('0x1b')]=_0x14d92b;if(_0x27384c[_0x4acf('0x35')][_0x4acf('0x42')]){_0x337b3c[_0x4acf('0x43')]=[{'all':!![]}];}return db[_0x4acf('0x30')][_0x4acf('0x44')](_0x337b3c);})['then'](function(_0x256145){_0x16a74e[_0x4acf('0x45')]=_0x256145;return _0x16a74e;})[_0x4acf('0x21')](respondWithFilteredResult(_0x5d862f,_0x337b3c))[_0x4acf('0x46')](handleError(_0x5d862f,null));};exports[_0x4acf('0x47')]=function(_0x58bc5d,_0x50434b){var _0x18b9d2={'raw':!![],'where':{'id':_0x58bc5d[_0x4acf('0x48')]['id']}},_0x2fc411={};_0x2fc411[_0x4acf('0x34')]=_[_0x4acf('0x36')](db[_0x4acf('0x30')]['rawAttributes']);_0x2fc411[_0x4acf('0x35')]=_['keys'](_0x58bc5d[_0x4acf('0x35')]);_0x2fc411[_0x4acf('0x3e')]=_['intersection'](_0x2fc411['model'],_0x2fc411[_0x4acf('0x35')]);_0x18b9d2[_0x4acf('0x38')]=_[_0x4acf('0x37')](_0x2fc411[_0x4acf('0x34')],qs['fields'](_0x58bc5d[_0x4acf('0x35')][_0x4acf('0x49')]));_0x18b9d2[_0x4acf('0x38')]=_0x18b9d2[_0x4acf('0x38')][_0x4acf('0x39')]?_0x18b9d2[_0x4acf('0x38')]:_0x2fc411[_0x4acf('0x34')];if(_0x58bc5d[_0x4acf('0x35')]['includeAll']){_0x18b9d2['include']=[{'all':!![]}];}_0x18b9d2=_[_0x4acf('0x28')]({},_0x18b9d2,_0x58bc5d[_0x4acf('0x41')]);return db[_0x4acf('0x30')][_0x4acf('0x4a')](_0x18b9d2)[_0x4acf('0x21')](handleEntityNotFound(_0x50434b,null))[_0x4acf('0x21')](respondWithResult(_0x50434b,null))[_0x4acf('0x46')](handleError(_0x50434b,null));};exports[_0x4acf('0x20')]=function(_0x34b447,_0xcca950){if(_0x34b447[_0x4acf('0x4b')]['id']){delete _0x34b447[_0x4acf('0x4b')]['id'];}return db['CmCustomField'][_0x4acf('0x4a')]({'where':{'id':_0x34b447[_0x4acf('0x48')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0xcca950,null))[_0x4acf('0x21')](saveUpdates(_0x34b447[_0x4acf('0x4b')],null))[_0x4acf('0x21')](respondWithResult(_0xcca950,null))[_0x4acf('0x46')](handleError(_0xcca950,null));};exports[_0x4acf('0x22')]=function(_0x3382ad,_0x13b588){return db[_0x4acf('0x30')][_0x4acf('0x4a')]({'where':{'id':_0x3382ad[_0x4acf('0x48')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x13b588,null))[_0x4acf('0x21')](removeEntity(_0x13b588,null))[_0x4acf('0x46')](handleError(_0x13b588,null));};exports['create']=function(_0x3878e4,_0x1f144d){var _0x43ad75;return db['sequelize'][_0x4acf('0x4c')](function(_0x3e8953){return db[_0x4acf('0x30')][_0x4acf('0x4d')](_0x3878e4['body'],{'transaction':_0x3e8953})['then'](function(_0x49a34c){_0x43ad75=_0x49a34c;var _0x131207={'type':db[_0x4acf('0x4e')][_0x4acf('0x4f')],'transaction':_0x3e8953};switch(_0x3878e4['body'][_0x4acf('0x32')]){case _0x4acf('0x50'):_0x131207['type']=db[_0x4acf('0x4e')][_0x4acf('0x4f')];break;case _0x4acf('0x51'):_0x131207[_0x4acf('0x32')]=db['Sequelize'][_0x4acf('0x52')];break;case _0x4acf('0x53'):_0x131207[_0x4acf('0x32')]=db[_0x4acf('0x4e')]['BOOLEAN'];_0x131207[_0x4acf('0x54')]=![];break;default:}return db['sequelize'][_0x4acf('0x55')]['addColumn'](_0x4acf('0x56'),util[_0x4acf('0x57')](_0x4acf('0x58'),_0x43ad75['id']),_0x131207);})[_0x4acf('0x21')](function(){return _0x43ad75;});})['then'](respondWithResult(_0x1f144d,0xc9))['catch'](handleError(_0x1f144d,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 191e773..a1345af 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 _0x5fc8=['../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x5fc8,0xae));var _0x85fc=function(_0x1ec1e4,_0x2c2a7f){_0x1ec1e4=_0x1ec1e4-0x0;var _0x3c8ea1=_0x5fc8[_0x1ec1e4];return _0x3c8ea1;};'use strict';var _=require(_0x85fc('0x0'));var util=require(_0x85fc('0x1'));var logger=require(_0x85fc('0x2'))(_0x85fc('0x3'));var moment=require(_0x85fc('0x4'));var BPromise=require(_0x85fc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85fc('0x6'));var rimraf=require(_0x85fc('0x7'));var config=require(_0x85fc('0x8'));var attributes=require(_0x85fc('0x9'));module[_0x85fc('0xa')]=function(_0x3ab97e,_0x359305){return _0x3ab97e[_0x85fc('0xb')]('CmCustomField',attributes,{'tableName':_0x85fc('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ad0=['cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x2640fe,_0x4a2a31){var _0xeb1ba0=function(_0x1a5f63){while(--_0x1a5f63){_0x2640fe['push'](_0x2640fe['shift']());}};_0xeb1ba0(++_0x4a2a31);}(_0x8ad0,0xb7));var _0x08ad=function(_0x2f91ab,_0x352187){_0x2f91ab=_0x2f91ab-0x0;var _0x300339=_0x8ad0[_0x2f91ab];return _0x300339;};'use strict';var _=require(_0x08ad('0x0'));var util=require(_0x08ad('0x1'));var logger=require(_0x08ad('0x2'))(_0x08ad('0x3'));var moment=require(_0x08ad('0x4'));var BPromise=require(_0x08ad('0x5'));var rp=require(_0x08ad('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x08ad('0x7'));var config=require(_0x08ad('0x8'));var attributes=require(_0x08ad('0x9'));module[_0x08ad('0xa')]=function(_0xcff46,_0x420a32){return _0xcff46[_0x08ad('0xb')](_0x08ad('0xc'),attributes,{'tableName':_0x08ad('0xd'),'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 4f01d34..9b360da 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 _0xf72b=['../../config/environment','jayson/promise','client','request','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1db36f,_0x2ecd35){var _0x1d0fa9=function(_0x78f4fa){while(--_0x78f4fa){_0x1db36f['push'](_0x1db36f['shift']());}};_0x1d0fa9(++_0x2ecd35);}(_0xf72b,0x1d9));var _0xbf72=function(_0xc5cbe0,_0x228cbc){_0xc5cbe0=_0xc5cbe0-0x0;var _0x29d91c=_0xf72b[_0xc5cbe0];return _0x29d91c;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var moment=require(_0xbf72('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf72('0x2'));var fs=require('fs');var Redis=require(_0xbf72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf72('0x4'));var logger=require(_0xbf72('0x5'))(_0xbf72('0x6'));var config=require(_0xbf72('0x7'));var jayson=require(_0xbf72('0x8'));var client=jayson[_0xbf72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c11d,_0xc0842b,_0x119807){return new BPromise(function(_0xd0402c,_0xdd6177){return client[_0xbf72('0xa')](_0x41c11d,_0x119807)['then'](function(_0x455891){logger['info'](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));logger['debug'](_0xbf72('0xd'),_0xc0842b,_0xbf72('0xc'),JSON[_0xbf72('0xe')](_0x455891));if(_0x455891[_0xbf72('0xf')]){if(_0x455891[_0xbf72('0xf')][_0xbf72('0x10')]===0x1f4){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x455891['error'][_0xbf72('0x11')]);return _0xdd6177(_0x455891[_0xbf72('0xf')][_0xbf72('0x11')]);}logger['error'](_0xbf72('0xb'),_0xc0842b,_0x455891['error']['message']);return _0xd0402c(_0x455891['error'][_0xbf72('0x11')]);}else{logger[_0xbf72('0x12')](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));_0xd0402c(_0x455891[_0xbf72('0x13')][_0xbf72('0x11')]);}})['catch'](function(_0x266ce2){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x266ce2);_0xdd6177(_0x266ce2);});});} \ No newline at end of file +var _0x5ad3=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x54ee20,_0x586161){var _0x40bf39=function(_0x25a7d8){while(--_0x25a7d8){_0x54ee20['push'](_0x54ee20['shift']());}};_0x40bf39(++_0x586161);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x5ad3[_0x5ba549];return _0x36e3a1;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var moment=require(_0x35ad('0x2'));var BPromise=require(_0x35ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ad('0x4'));var db=require(_0x35ad('0x5'))['db'];var utils=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var config=require(_0x35ad('0x9'));var jayson=require(_0x35ad('0xa'));var client=jayson[_0x35ad('0xb')][_0x35ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31cc6a,_0x4edc59,_0x292521){return new BPromise(function(_0x3cec3e,_0x3f1f55){return client['request'](_0x31cc6a,_0x292521)[_0x35ad('0xd')](function(_0x487107){logger['info'](_0x35ad('0xe'),_0x4edc59,_0x35ad('0xf'));logger['debug'](_0x35ad('0x10'),_0x4edc59,_0x35ad('0xf'),JSON['stringify'](_0x487107));if(_0x487107['error']){if(_0x487107[_0x35ad('0x11')][_0x35ad('0x12')]===0x1f4){logger['error'](_0x35ad('0xe'),_0x4edc59,_0x487107[_0x35ad('0x11')]['message']);return _0x3f1f55(_0x487107['error'][_0x35ad('0x13')]);}logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x487107['error'][_0x35ad('0x13')]);return _0x3cec3e(_0x487107[_0x35ad('0x11')]['message']);}else{logger[_0x35ad('0x14')]('CmCustomField,\x20%s,\x20%s',_0x4edc59,'request\x20sent');_0x3cec3e(_0x487107[_0x35ad('0x15')][_0x35ad('0x13')]);}})[_0x35ad('0x16')](function(_0x56cb8e){logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x56cb8e);_0x3f1f55(_0x56cb8e);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 780d5b2..cabb658 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 _0xbe6b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','create','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x57836e,_0x534ca8){var _0x2f28f3=function(_0xc1bfff){while(--_0xc1bfff){_0x57836e['push'](_0x57836e['shift']());}};_0x2f28f3(++_0x534ca8);}(_0xbe6b,0xa8));var _0xbbe6=function(_0x2e5052,_0x23bd92){_0x2e5052=_0x2e5052-0x0;var _0x1b2633=_0xbe6b[_0x2e5052];return _0x1b2633;};'use strict';var multer=require(_0xbbe6('0x0'));var util=require(_0xbbe6('0x1'));var path=require('path');var timeout=require(_0xbbe6('0x2'));var express=require(_0xbbe6('0x3'));var router=express['Router']();var fs_extra=require(_0xbbe6('0x4'));var auth=require(_0xbbe6('0x5'));var interaction=require(_0xbbe6('0x6'));var config=require(_0xbbe6('0x7'));var controller=require('./cmCustomField.controller');router[_0xbbe6('0x8')]('/',auth['isAuthenticated'](),controller[_0xbbe6('0x9')]);router['get'](_0xbbe6('0xa'),auth['isAuthenticated'](),controller[_0xbbe6('0xb')]);router[_0xbbe6('0xc')]('/',auth['isAuthenticated'](),controller[_0xbbe6('0xd')]);router['put'](_0xbbe6('0xa'),auth[_0xbbe6('0xe')](),controller[_0xbbe6('0xf')]);router[_0xbbe6('0x10')](_0xbbe6('0xa'),auth[_0xbbe6('0xe')](),controller[_0xbbe6('0x11')]);module[_0xbbe6('0x12')]=router; \ No newline at end of file +var _0xcd3d=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd3d,0x123));var _0xdcd3=function(_0x3c0891,_0x529920){_0x3c0891=_0x3c0891-0x0;var _0x216df9=_0xcd3d[_0x3c0891];return _0x216df9;};'use strict';var multer=require(_0xdcd3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdcd3('0x1'));var express=require(_0xdcd3('0x2'));var router=express[_0xdcd3('0x3')]();var fs_extra=require(_0xdcd3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdcd3('0x5'));var config=require(_0xdcd3('0x6'));var controller=require(_0xdcd3('0x7'));router[_0xdcd3('0x8')]('/',auth[_0xdcd3('0x9')](),controller[_0xdcd3('0xa')]);router[_0xdcd3('0x8')](_0xdcd3('0xb'),auth[_0xdcd3('0x9')](),controller['show']);router[_0xdcd3('0xc')]('/',auth['isAuthenticated'](),controller[_0xdcd3('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdcd3('0xe')](_0xdcd3('0xb'),auth['isAuthenticated'](),controller[_0xdcd3('0xf')]);module[_0xdcd3('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 2c32f2e..85c81ff 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 _0x9b67=['INTEGER','DATE','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x9b67,0xf6));var _0x79b6=function(_0x5d30c0,_0x187d07){_0x5d30c0=_0x5d30c0-0x0;var _0x49b8dd=_0x9b67[_0x5d30c0];return _0x49b8dd;};'use strict';var moment=require(_0x79b6('0x0'));var Sequelize=require(_0x79b6('0x1'));module[_0x79b6('0x2')]={'phone':{'type':Sequelize[_0x79b6('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x79b6('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x79b6('0x5')](_0x79b6('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x79b6('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x79b6('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x79b6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x79b6('0x8')]},'priority':{'type':Sequelize[_0x79b6('0x7')](0x2)[_0x79b6('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x79b6('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x79b6('0xa')},'ListId':{'type':Sequelize[_0x79b6('0x7')],'unique':_0x79b6('0xa')},'UserId':{'type':Sequelize[_0x79b6('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x79b6('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x79b6('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x79b6('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x79b6('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x79b6('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5ad3=['BOOLEAN','contactListQueue','moment','sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x5645ad,_0x580ea3){_0x5645ad=_0x5645ad-0x0;var _0x17d292=_0x5ad3[_0x5645ad];return _0x17d292;};'use strict';var moment=require(_0x35ad('0x0'));var Sequelize=require(_0x35ad('0x1'));module[_0x35ad('0x2')]={'phone':{'type':Sequelize[_0x35ad('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x35ad('0x4')],'defaultValue':moment()[_0x35ad('0x5')](_0x35ad('0x6'))},'countbusyretry':{'type':Sequelize[_0x35ad('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x35ad('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x35ad('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x35ad('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x35ad('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x35ad('0x4')]},'priority':{'type':Sequelize[_0x35ad('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x35ad('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x35ad('0x7')],'unique':_0x35ad('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x35ad('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x35ad('0x9')},'CampaignId':{'type':Sequelize[_0x35ad('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x35ad('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x35ad('0x7')],'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 5635a21..9bd569c 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 _0x01ef=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','merge','contact','agent','interaction','account','index','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$ne','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$contained','attributes','fields','length','order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','findAll','then','rows','catch','show','params','include','find','body','describe','VoiceQueueId','CampaignId','createdAt','updatedAt','state','statedesc','deleted','campaign','UserId','user','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','create','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getOpenContacts','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x01ef,0x1c3));var _0xf01e=function(_0x5c11d9,_0x1fa92a){_0x5c11d9=_0x5c11d9-0x0;var _0x49eb41=_0x01ef[_0x5c11d9];return _0x49eb41;};'use strict';var emlformat=require(_0xf01e('0x0'));var rimraf=require(_0xf01e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf01e('0x2'));var rp=require(_0xf01e('0x3'));var moment=require(_0xf01e('0x4'));var BPromise=require(_0xf01e('0x5'));var Mustache=require(_0xf01e('0x6'));var util=require(_0xf01e('0x7'));var path=require(_0xf01e('0x8'));var sox=require(_0xf01e('0x9'));var csv=require(_0xf01e('0xa'));var ejs=require(_0xf01e('0xb'));var fs=require('fs');var fs_extra=require(_0xf01e('0xc'));var _=require(_0xf01e('0xd'));var squel=require('squel');var crypto=require(_0xf01e('0xe'));var jsforce=require(_0xf01e('0xf'));var deskjs=require(_0xf01e('0x10'));var toCsv=require(_0xf01e('0xa'));var querystring=require(_0xf01e('0x11'));var Papa=require(_0xf01e('0x12'));var Redis=require(_0xf01e('0x13'));var authService=require(_0xf01e('0x14'));var qs=require(_0xf01e('0x15'));var as=require(_0xf01e('0x16'));var hardwareService=require(_0xf01e('0x17'));var logger=require(_0xf01e('0x18'))('api');var utils=require(_0xf01e('0x19'));var config=require(_0xf01e('0x1a'));var licenseUtil=require(_0xf01e('0x1b'));var db=require(_0xf01e('0x1c'))['db'];function respondWithStatusCode(_0x534c08,_0x199625){_0x199625=_0x199625||0xcc;return function(_0xfce042){if(_0xfce042){return _0x534c08[_0xf01e('0x1d')](_0x199625);}return _0x534c08['status'](_0x199625)[_0xf01e('0x1e')]();};}function respondWithResult(_0x1bf73c,_0x264e48){_0x264e48=_0x264e48||0xc8;return function(_0xb48987){if(_0xb48987){return _0x1bf73c[_0xf01e('0x1f')](_0x264e48)[_0xf01e('0x20')](_0xb48987);}};}function respondWithFilteredResult(_0x1794b3,_0x4219ba){return function(_0x340e29){if(_0x340e29){var _0x181a37=typeof _0x4219ba[_0xf01e('0x21')]===_0xf01e('0x22')&&typeof _0x4219ba[_0xf01e('0x23')]===_0xf01e('0x22');var _0x3c2531=_0x340e29[_0xf01e('0x24')];var _0x41d9f9=_0x181a37?0x0:_0x4219ba[_0xf01e('0x21')];var _0x49a632=_0x181a37?_0x340e29[_0xf01e('0x24')]:_0x4219ba[_0xf01e('0x21')]+_0x4219ba[_0xf01e('0x23')];var _0x48ec88;if(_0x49a632>=_0x3c2531){_0x49a632=_0x3c2531;_0x48ec88=0xc8;}else{_0x48ec88=0xce;}_0x1794b3[_0xf01e('0x1f')](_0x48ec88);return _0x1794b3['set'](_0xf01e('0x25'),_0x41d9f9+'-'+_0x49a632+'/'+_0x3c2531)[_0xf01e('0x20')](_0x340e29);}return null;};}function patchUpdates(_0x4766a9){return function(_0x29a4f1){try{jsonpatch[_0xf01e('0x26')](_0x29a4f1,_0x4766a9,!![]);}catch(_0x10a756){return BPromise[_0xf01e('0x27')](_0x10a756);}return _0x29a4f1[_0xf01e('0x28')]();};}function saveUpdates(_0x161b8a,_0x58a90e){return function(_0x33137a){if(_0x33137a){return _0x33137a[_0xf01e('0x29')](_0x161b8a)['then'](function(_0x3c0097){return _0x3c0097;});}return null;};}function removeEntity(_0x219395,_0x26a438){return function(_0x3d36b0){if(_0x3d36b0){return _0x3d36b0[_0xf01e('0x2a')]()['then'](function(){_0x219395[_0xf01e('0x1f')](0xcc)[_0xf01e('0x1e')]();});}};}function handleEntityNotFound(_0xf22475,_0x25f349){return function(_0x8e38de){if(!_0x8e38de){_0xf22475[_0xf01e('0x1d')](0x194);}return _0x8e38de;};}function handleError(_0x518d16,_0x5c087c){_0x5c087c=_0x5c087c||0x1f4;return function(_0x44360d){logger[_0xf01e('0x2b')](_0x44360d[_0xf01e('0x2c')]);if(_0x44360d['name']){delete _0x44360d[_0xf01e('0x2d')];}_0x518d16[_0xf01e('0x1f')](_0x5c087c)[_0xf01e('0x2e')](_0x44360d);};}function getMustacheRender(_0x458de6,_0x203aa8){return Mustache['render'](_0x458de6,_[_0xf01e('0x2f')](_0x203aa8['body'],{'contact':_0x203aa8[_0xf01e('0x30')],'message':_0x203aa8['message'],'agent':_0x203aa8[_0xf01e('0x31')],'interaction':_0x203aa8[_0xf01e('0x32')],'account':_0x203aa8[_0xf01e('0x33')]}))||'';}exports[_0xf01e('0x34')]=function(_0x5bdc2f,_0x3d6fd3){var _0xee2368={},_0x9cf392={},_0x4be227={'count':0x0,'rows':[]};var _0x2096b4=_['map'](db[_0xf01e('0x35')][_0xf01e('0x36')],function(_0x32cce1){return{'name':_0x32cce1[_0xf01e('0x37')],'type':_0x32cce1[_0xf01e('0x38')][_0xf01e('0x39')]};});_0x9cf392[_0xf01e('0x3a')]=_['map'](_0x2096b4,_0xf01e('0x2d'));_0x9cf392[_0xf01e('0x3b')]=_[_0xf01e('0x3c')](_0x5bdc2f[_0xf01e('0x3b')]);_0x9cf392[_0xf01e('0x3d')]=_[_0xf01e('0x3e')](_0x9cf392[_0xf01e('0x3a')],_0x9cf392[_0xf01e('0x3b')]);_0x9cf392[_0xf01e('0x3d')]=_[_0xf01e('0x3f')](_0x9cf392['filters'],[_0xf01e('0x40'),_0xf01e('0x41'),_0xf01e('0x42'),_0xf01e('0x43'),'$lt',_0xf01e('0x44'),_0xf01e('0x45'),'$eq','$not',_0xf01e('0x46'),_0xf01e('0x47'),_0xf01e('0x48'),_0xf01e('0x49'),_0xf01e('0x4a'),_0xf01e('0x4b'),'$iLike',_0xf01e('0x4c'),_0xf01e('0x4a'),'$overlap','$contains',_0xf01e('0x4d'),'$any']);_0xee2368[_0xf01e('0x4e')]=_['intersection'](_0x9cf392['model'],qs[_0xf01e('0x4f')](_0x5bdc2f[_0xf01e('0x3b')][_0xf01e('0x4f')]));_0xee2368[_0xf01e('0x4e')]=_0xee2368[_0xf01e('0x4e')][_0xf01e('0x50')]?_0xee2368['attributes']:_0x9cf392[_0xf01e('0x3a')];if(!_0x5bdc2f[_0xf01e('0x3b')]['hasOwnProperty']('nolimit')){_0xee2368['limit']=qs[_0xf01e('0x23')](_0x5bdc2f[_0xf01e('0x3b')]['limit']);_0xee2368[_0xf01e('0x21')]=qs['offset'](_0x5bdc2f[_0xf01e('0x3b')][_0xf01e('0x21')]);}_0xee2368[_0xf01e('0x51')]=qs[_0xf01e('0x52')](_0x5bdc2f[_0xf01e('0x3b')]['sort']);_0xee2368[_0xf01e('0x53')]=qs[_0xf01e('0x3d')](_[_0xf01e('0x54')](_0x5bdc2f['query'],_0x9cf392[_0xf01e('0x3d')]),_0x2096b4);if(_0x5bdc2f[_0xf01e('0x3b')][_0xf01e('0x55')]){_0xee2368[_0xf01e('0x53')]=_['merge'](_0xee2368[_0xf01e('0x53')],{'$or':_[_0xf01e('0x56')](_0x2096b4,function(_0x22b424){if(_0x22b424[_0xf01e('0x38')]!==_0xf01e('0x57')){var _0x18d55d={};_0x18d55d[_0x22b424[_0xf01e('0x2d')]]={'$like':'%'+_0x5bdc2f[_0xf01e('0x3b')]['filter']+'%'};return _0x18d55d;}})});}_0xee2368=_[_0xf01e('0x2f')]({},_0xee2368,_0x5bdc2f[_0xf01e('0x58')]);var _0x315bb9={'where':_0xee2368[_0xf01e('0x53')]};return db['CmHopper'][_0xf01e('0x24')](_0x315bb9)['then'](function(_0x2edcfd){_0x4be227['count']=_0x2edcfd;if(_0x5bdc2f[_0xf01e('0x3b')][_0xf01e('0x59')]){_0xee2368['include']=[{'all':!![]}];}return db[_0xf01e('0x35')][_0xf01e('0x5a')](_0xee2368);})[_0xf01e('0x5b')](function(_0x443152){_0x4be227[_0xf01e('0x5c')]=_0x443152;return _0x4be227;})['then'](respondWithFilteredResult(_0x3d6fd3,_0xee2368))[_0xf01e('0x5d')](handleError(_0x3d6fd3,null));};exports[_0xf01e('0x5e')]=function(_0x3d3e82,_0x21e5ed){var _0x57c68d={'raw':!![],'where':{'id':_0x3d3e82[_0xf01e('0x5f')]['id']}},_0x1e02d1={};_0x1e02d1['model']=_[_0xf01e('0x3c')](db[_0xf01e('0x35')][_0xf01e('0x36')]);_0x1e02d1[_0xf01e('0x3b')]=_[_0xf01e('0x3c')](_0x3d3e82[_0xf01e('0x3b')]);_0x1e02d1[_0xf01e('0x3d')]=_[_0xf01e('0x3e')](_0x1e02d1[_0xf01e('0x3a')],_0x1e02d1[_0xf01e('0x3b')]);_0x57c68d[_0xf01e('0x4e')]=_[_0xf01e('0x3e')](_0x1e02d1[_0xf01e('0x3a')],qs[_0xf01e('0x4f')](_0x3d3e82[_0xf01e('0x3b')][_0xf01e('0x4f')]));_0x57c68d[_0xf01e('0x4e')]=_0x57c68d[_0xf01e('0x4e')][_0xf01e('0x50')]?_0x57c68d[_0xf01e('0x4e')]:_0x1e02d1[_0xf01e('0x3a')];if(_0x3d3e82[_0xf01e('0x3b')][_0xf01e('0x59')]){_0x57c68d[_0xf01e('0x60')]=[{'all':!![]}];}_0x57c68d=_[_0xf01e('0x2f')]({},_0x57c68d,_0x3d3e82[_0xf01e('0x58')]);return db['CmHopper'][_0xf01e('0x61')](_0x57c68d)[_0xf01e('0x5b')](handleEntityNotFound(_0x21e5ed,null))[_0xf01e('0x5b')](respondWithResult(_0x21e5ed,null))['catch'](handleError(_0x21e5ed,null));};exports['create']=function(_0x1400bd,_0x32b89e){return db['CmHopper']['create'](_0x1400bd[_0xf01e('0x62')],{})['then'](respondWithResult(_0x32b89e,0xc9))[_0xf01e('0x5d')](handleError(_0x32b89e,null));};exports[_0xf01e('0x29')]=function(_0x2d2bf9,_0x9d3d0e){if(_0x2d2bf9[_0xf01e('0x62')]['id']){delete _0x2d2bf9[_0xf01e('0x62')]['id'];}return db[_0xf01e('0x35')][_0xf01e('0x61')]({'where':{'id':_0x2d2bf9[_0xf01e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x9d3d0e,null))[_0xf01e('0x5b')](saveUpdates(_0x2d2bf9['body'],null))[_0xf01e('0x5b')](respondWithResult(_0x9d3d0e,null))['catch'](handleError(_0x9d3d0e,null));};exports[_0xf01e('0x63')]=function(_0xa4d730,_0x2d20ac){return db[_0xf01e('0x35')][_0xf01e('0x63')]()[_0xf01e('0x5b')](respondWithResult(_0x2d20ac,null))['catch'](handleError(_0x2d20ac,null));};exports[_0xf01e('0x2a')]=function(_0x223929,_0x59c7da){var _0x562253;return db[_0xf01e('0x35')]['find']({'where':{'id':_0x223929['params']['id']}})[_0xf01e('0x5b')](handleEntityNotFound(_0x59c7da,null))['then'](function(_0x2390e0){if(_0x2390e0){return _0x2390e0[_0xf01e('0x2a')]()[_0xf01e('0x5b')](function(_0x370edd){return _0x370edd;});}})[_0xf01e('0x5b')](function(_0x32e6b7){_0x562253=_0x32e6b7;if(_0x32e6b7){if(_0x32e6b7[_0xf01e('0x64')]||_0x32e6b7['CampaignId']){return db[_0x32e6b7[_0xf01e('0x64')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x32e6b7['VoiceQueueId']?_0x32e6b7[_0xf01e('0x64')]:_0x32e6b7[_0xf01e('0x65')]},'attributes':['id','name'],'raw':!![]});}}})[_0xf01e('0x5b')](function(_0x13fe25){var _0x4af6e0={};if(_0x13fe25){_['merge'](_0x4af6e0,_['omit'](_0x562253['dataValues'],[_0xf01e('0x66'),_0xf01e('0x67'),'id']));_0x4af6e0[_0xf01e('0x68')]=0x15;_0x4af6e0[_0xf01e('0x69')]=_0xf01e('0x6a');_0x4af6e0[_0xf01e('0x6b')]=_0x13fe25[_0xf01e('0x2d')];_0x4af6e0['membername']=_0x223929['user']['name'];_0x4af6e0[_0xf01e('0x6c')]=_0x223929[_0xf01e('0x6d')]['id'];_0x4af6e0['deleted']=!![];_0x4af6e0['deletedat']=moment()[_0xf01e('0x6e')](_0xf01e('0x6f'));_0x4af6e0['calleridnum']=_0x562253['phone'];_0x4af6e0[_0xf01e('0x70')]=_0x562253[_0xf01e('0x64')]?_0xf01e('0x71'):'ivr';return db[_0xf01e('0x72')][_0xf01e('0x61')]({'where':{'id':_0x4af6e0[_0xf01e('0x73')]},'attributes':['firstName',_0xf01e('0x74')]})[_0xf01e('0x5b')](function(_0x5ea12d){if(!_['isNil'](_0x59c7da)&&!_[_0xf01e('0x75')](_0x5ea12d[_0xf01e('0x76')])){_0x4af6e0[_0xf01e('0x77')]=_0x5ea12d['firstName'];if(!_['isNil'](_0x5ea12d[_0xf01e('0x74')])){_0x4af6e0[_0xf01e('0x77')]+='\x20'+_0x5ea12d[_0xf01e('0x74')];}}})['finally'](function(){return db[_0xf01e('0x78')][_0xf01e('0x79')](_0x4af6e0);});}})[_0xf01e('0x5b')](function(){return _0x59c7da[_0xf01e('0x1f')](0xcc)[_0xf01e('0x1e')]();})[_0xf01e('0x5d')](handleError(_0x59c7da,null));};exports['getPreview']=function(_0x4d7c38,_0x4dae1c,_0x624af1){var _0x146430=[];return db[_0xf01e('0x72')][_0xf01e('0x63')]()[_0xf01e('0x5b')](function(_0x9b8ca2){_0x146430=_[_0xf01e('0x3c')](_0x9b8ca2);return _0x4d7c38['user'][_0xf01e('0x7a')]({'where':{'type':_0xf01e('0x7b'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xf01e('0x7c')],'raw':!![]});})[_0xf01e('0x5b')](function(_0x5f2258){if(_0x5f2258&&_0x5f2258[_0xf01e('0x50')]){return db[_0xf01e('0x7d')][_0xf01e('0x7e')](function(_0x90ddec){var _0x5d1429={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf01e('0x6e')](_0xf01e('0x6f'))},'VoiceQueueId':{'$in':_['map'](_0x5f2258,'id')},'$or':[{'UserId':null},{'UserId':_0x4d7c38[_0xf01e('0x6d')]['id']}]};var _0x446ec=[];if(_0x4d7c38['body'][_0xf01e('0x7f')]&&_0x4d7c38[_0xf01e('0x62')][_0xf01e('0x7f')]===_0xf01e('0x80')){if(!_[_0xf01e('0x81')](_0x4d7c38[_0xf01e('0x62')][_0xf01e('0x82')])){_0x5d1429['id']={'$in':_0x4d7c38[_0xf01e('0x62')][_0xf01e('0x82')]};}_0x446ec=[[_0xf01e('0x83'),_0xf01e('0x84')],['scheduledAt',_0x5f2258[0x0][_0xf01e('0x7c')]==='ASC'?'DESC':_0xf01e('0x84')],db[_0xf01e('0x7d')]['literal'](_0xf01e('0x85')),['id','DESC']];}else{if(!_[_0xf01e('0x81')](_0x4d7c38[_0xf01e('0x62')][_0xf01e('0x82')])){_0x5d1429['id']={'$notIn':_0x4d7c38['body'][_0xf01e('0x82')]};}_0x446ec=[[_0xf01e('0x83'),_0xf01e('0x86')],[_0xf01e('0x87'),_0x5f2258[0x0][_0xf01e('0x7c')]],db[_0xf01e('0x7d')][_0xf01e('0x88')](_0xf01e('0x89')),['id',_0xf01e('0x84')]];}return db[_0xf01e('0x35')]['findOne']({'attributes':['id',_0xf01e('0x8a')],'where':_0x5d1429,'order':_0x446ec,'transaction':_0x90ddec,'lock':_0x90ddec[_0xf01e('0x8b')][_0xf01e('0x8c')],'include':[{'model':db[_0xf01e('0x72')],'as':'Contact','attributes':_0x146430,'include':[{'model':db[_0xf01e('0x8d')],'as':_0xf01e('0x8e'),'attributes':['id',_0xf01e('0x2d')]}]},{'model':db[_0xf01e('0x8f')],'as':_0xf01e('0x90'),'attributes':['id','name']},{'model':db[_0xf01e('0x91')],'as':_0xf01e('0x92'),'attributes':['id',_0xf01e('0x2d'),_0xf01e('0x93')]}]})['then'](function(_0x5cca26){if(_0x5cca26){return _0x5cca26['update']({'UserId':_0x4d7c38[_0xf01e('0x6d')]['id']},{'transaction':_0x90ddec});}});});}})[_0xf01e('0x5b')](handleEntityNotFound(_0x4dae1c,null))[_0xf01e('0x5b')](respondWithResult(_0x4dae1c,null))[_0xf01e('0x5d')](handleError(_0x4dae1c,null));};exports[_0xf01e('0x94')]=function(_0x3363e7,_0x37ad61,_0x2e68d5){return _0x3363e7[_0xf01e('0x6d')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xf01e('0x95')},'attributes':['id'],'raw':!![]})[_0xf01e('0x5b')](function(_0xcc8a20){if(_0xcc8a20&&_0xcc8a20[_0xf01e('0x50')]){return db[_0xf01e('0x35')][_0xf01e('0x24')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf01e('0x6e')](_0xf01e('0x6f'))},'VoiceQueueId':{'$in':_['map'](_0xcc8a20,'id')},'$or':[{'UserId':null},{'UserId':_0x3363e7[_0xf01e('0x6d')]['id']}]}});}return 0x0;})['then'](function(_0x311404){if(!_[_0xf01e('0x75')](_0x311404)&&_['isNumber'](_0x311404)){return _0x37ad61[_0xf01e('0x1f')](0xc8)['json']({'contacts':_0x311404});}else{logger[_0xf01e('0x2b')](_0xf01e('0x96'),_0xf01e('0x94'),0x194,_0xf01e('0x97'));_0x37ad61['sendStatus'](0x194);}})[_0xf01e('0x5d')](handleError(_0x37ad61,null));}; \ No newline at end of file +var _0x7771=['scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','List','dialActive','preview','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','render','merge','body','message','agent','rawAttributes','type','key','map','query','keys','filters','intersection','model','concat','$and','$or','$gt','$gte','$lt','$lte','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contained','$any','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','CmHopper','includeAll','include','rows','catch','show','find','create','params','VoiceQueueId','VoiceQueue','CampaignId','omit','dataValues','createdAt','updatedAt','state','deleted','UserId','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','getPreview','describe','getVoiceQueues','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7771,0x1cf));var _0x1777=function(_0x3662b4,_0x503b4d){_0x3662b4=_0x3662b4-0x0;var _0x50928c=_0x7771[_0x3662b4];return _0x50928c;};'use strict';var emlformat=require(_0x1777('0x0'));var rimraf=require(_0x1777('0x1'));var zipdir=require(_0x1777('0x2'));var jsonpatch=require(_0x1777('0x3'));var rp=require('request-promise');var moment=require(_0x1777('0x4'));var BPromise=require(_0x1777('0x5'));var Mustache=require('mustache');var util=require(_0x1777('0x6'));var path=require(_0x1777('0x7'));var sox=require(_0x1777('0x8'));var csv=require(_0x1777('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1777('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1777('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1777('0xc'));var Papa=require('papaparse');var Redis=require(_0x1777('0xd'));var authService=require(_0x1777('0xe'));var qs=require(_0x1777('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1777('0x10'));var logger=require(_0x1777('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x1777('0x12'));var licenseUtil=require(_0x1777('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b4df3,_0x32af6f){_0x32af6f=_0x32af6f||0xcc;return function(_0x47c92e){if(_0x47c92e){return _0x5b4df3['sendStatus'](_0x32af6f);}return _0x5b4df3[_0x1777('0x14')](_0x32af6f)[_0x1777('0x15')]();};}function respondWithResult(_0xc6f364,_0x5b3bdb){_0x5b3bdb=_0x5b3bdb||0xc8;return function(_0x217cdd){if(_0x217cdd){return _0xc6f364[_0x1777('0x14')](_0x5b3bdb)[_0x1777('0x16')](_0x217cdd);}};}function respondWithFilteredResult(_0x58116f,_0x5d1a0c){return function(_0x35d8ca){if(_0x35d8ca){var _0x30399d=typeof _0x5d1a0c[_0x1777('0x17')]===_0x1777('0x18')&&typeof _0x5d1a0c[_0x1777('0x19')]==='undefined';var _0x1e50d3=_0x35d8ca[_0x1777('0x1a')];var _0xeca6fa=_0x30399d?0x0:_0x5d1a0c[_0x1777('0x17')];var _0x504d42=_0x30399d?_0x35d8ca['count']:_0x5d1a0c['offset']+_0x5d1a0c[_0x1777('0x19')];var _0x4cf63f;if(_0x504d42>=_0x1e50d3){_0x504d42=_0x1e50d3;_0x4cf63f=0xc8;}else{_0x4cf63f=0xce;}_0x58116f[_0x1777('0x14')](_0x4cf63f);return _0x58116f[_0x1777('0x1b')](_0x1777('0x1c'),_0xeca6fa+'-'+_0x504d42+'/'+_0x1e50d3)['json'](_0x35d8ca);}return null;};}function patchUpdates(_0x13e13b){return function(_0x4d1734){try{jsonpatch[_0x1777('0x1d')](_0x4d1734,_0x13e13b,!![]);}catch(_0x340ee7){return BPromise[_0x1777('0x1e')](_0x340ee7);}return _0x4d1734[_0x1777('0x1f')]();};}function saveUpdates(_0x3aa47f,_0x508888){return function(_0x333b18){if(_0x333b18){return _0x333b18[_0x1777('0x20')](_0x3aa47f)[_0x1777('0x21')](function(_0x3c9a25){return _0x3c9a25;});}return null;};}function removeEntity(_0x20164c,_0x1206aa){return function(_0x473c2f){if(_0x473c2f){return _0x473c2f[_0x1777('0x22')]()[_0x1777('0x21')](function(){_0x20164c[_0x1777('0x14')](0xcc)[_0x1777('0x15')]();});}};}function handleEntityNotFound(_0x2c0e57,_0x566567){return function(_0x539127){if(!_0x539127){_0x2c0e57['sendStatus'](0x194);}return _0x539127;};}function handleError(_0xc6fcbe,_0x49365c){_0x49365c=_0x49365c||0x1f4;return function(_0x4a0e11){logger[_0x1777('0x23')](_0x4a0e11['stack']);if(_0x4a0e11[_0x1777('0x24')]){delete _0x4a0e11[_0x1777('0x24')];}_0xc6fcbe[_0x1777('0x14')](_0x49365c)[_0x1777('0x25')](_0x4a0e11);};}function getMustacheRender(_0x4b31a9,_0xfdec69){return Mustache[_0x1777('0x26')](_0x4b31a9,_[_0x1777('0x27')](_0xfdec69[_0x1777('0x28')],{'contact':_0xfdec69['contact'],'message':_0xfdec69[_0x1777('0x29')],'agent':_0xfdec69[_0x1777('0x2a')],'interaction':_0xfdec69['interaction'],'account':_0xfdec69['account']}))||'';}exports['index']=function(_0x2bae74,_0x345fbb){var _0x371956={},_0x4658ca={},_0x36faef={'count':0x0,'rows':[]};var _0x3a566c=_['map'](db['CmHopper'][_0x1777('0x2b')],function(_0x20c006){return{'name':_0x20c006['fieldName'],'type':_0x20c006[_0x1777('0x2c')][_0x1777('0x2d')]};});_0x4658ca['model']=_[_0x1777('0x2e')](_0x3a566c,_0x1777('0x24'));_0x4658ca[_0x1777('0x2f')]=_[_0x1777('0x30')](_0x2bae74[_0x1777('0x2f')]);_0x4658ca[_0x1777('0x31')]=_[_0x1777('0x32')](_0x4658ca[_0x1777('0x33')],_0x4658ca[_0x1777('0x2f')]);_0x4658ca[_0x1777('0x31')]=_[_0x1777('0x34')](_0x4658ca[_0x1777('0x31')],[_0x1777('0x35'),_0x1777('0x36'),_0x1777('0x37'),_0x1777('0x38'),_0x1777('0x39'),_0x1777('0x3a'),'$ne','$eq',_0x1777('0x3b'),_0x1777('0x3c'),_0x1777('0x3d'),_0x1777('0x3e'),_0x1777('0x3f'),_0x1777('0x40'),_0x1777('0x41'),_0x1777('0x42'),'$notILike',_0x1777('0x40'),_0x1777('0x43'),'$contains',_0x1777('0x44'),_0x1777('0x45')]);_0x371956[_0x1777('0x46')]=_[_0x1777('0x32')](_0x4658ca['model'],qs['fields'](_0x2bae74['query'][_0x1777('0x47')]));_0x371956[_0x1777('0x46')]=_0x371956[_0x1777('0x46')][_0x1777('0x48')]?_0x371956[_0x1777('0x46')]:_0x4658ca[_0x1777('0x33')];if(!_0x2bae74[_0x1777('0x2f')]['hasOwnProperty'](_0x1777('0x49'))){_0x371956[_0x1777('0x19')]=qs['limit'](_0x2bae74['query']['limit']);_0x371956['offset']=qs[_0x1777('0x17')](_0x2bae74[_0x1777('0x2f')][_0x1777('0x17')]);}_0x371956[_0x1777('0x4a')]=qs[_0x1777('0x4b')](_0x2bae74[_0x1777('0x2f')][_0x1777('0x4b')]);_0x371956[_0x1777('0x4c')]=qs[_0x1777('0x31')](_[_0x1777('0x4d')](_0x2bae74[_0x1777('0x2f')],_0x4658ca['filters']),_0x3a566c);if(_0x2bae74[_0x1777('0x2f')][_0x1777('0x4e')]){_0x371956['where']=_['merge'](_0x371956[_0x1777('0x4c')],{'$or':_['map'](_0x3a566c,function(_0x4c1415){if(_0x4c1415[_0x1777('0x2c')]!==_0x1777('0x4f')){var _0xc88381={};_0xc88381[_0x4c1415[_0x1777('0x24')]]={'$like':'%'+_0x2bae74[_0x1777('0x2f')][_0x1777('0x4e')]+'%'};return _0xc88381;}})});}_0x371956=_[_0x1777('0x27')]({},_0x371956,_0x2bae74[_0x1777('0x50')]);var _0x2e5dae={'where':_0x371956[_0x1777('0x4c')]};return db[_0x1777('0x51')][_0x1777('0x1a')](_0x2e5dae)['then'](function(_0x38021e){_0x36faef[_0x1777('0x1a')]=_0x38021e;if(_0x2bae74['query'][_0x1777('0x52')]){_0x371956[_0x1777('0x53')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x371956);})[_0x1777('0x21')](function(_0x41bd09){_0x36faef[_0x1777('0x54')]=_0x41bd09;return _0x36faef;})['then'](respondWithFilteredResult(_0x345fbb,_0x371956))[_0x1777('0x55')](handleError(_0x345fbb,null));};exports[_0x1777('0x56')]=function(_0x5fcaff,_0x338a9e){var _0x402a28={'raw':!![],'where':{'id':_0x5fcaff['params']['id']}},_0xf3e34={};_0xf3e34[_0x1777('0x33')]=_[_0x1777('0x30')](db['CmHopper'][_0x1777('0x2b')]);_0xf3e34[_0x1777('0x2f')]=_[_0x1777('0x30')](_0x5fcaff[_0x1777('0x2f')]);_0xf3e34[_0x1777('0x31')]=_[_0x1777('0x32')](_0xf3e34['model'],_0xf3e34[_0x1777('0x2f')]);_0x402a28[_0x1777('0x46')]=_[_0x1777('0x32')](_0xf3e34['model'],qs['fields'](_0x5fcaff[_0x1777('0x2f')][_0x1777('0x47')]));_0x402a28[_0x1777('0x46')]=_0x402a28[_0x1777('0x46')]['length']?_0x402a28[_0x1777('0x46')]:_0xf3e34[_0x1777('0x33')];if(_0x5fcaff['query'][_0x1777('0x52')]){_0x402a28['include']=[{'all':!![]}];}_0x402a28=_[_0x1777('0x27')]({},_0x402a28,_0x5fcaff[_0x1777('0x50')]);return db[_0x1777('0x51')][_0x1777('0x57')](_0x402a28)[_0x1777('0x21')](handleEntityNotFound(_0x338a9e,null))[_0x1777('0x21')](respondWithResult(_0x338a9e,null))['catch'](handleError(_0x338a9e,null));};exports[_0x1777('0x58')]=function(_0x238221,_0x4ed704){return db['CmHopper'][_0x1777('0x58')](_0x238221[_0x1777('0x28')],{})[_0x1777('0x21')](respondWithResult(_0x4ed704,0xc9))[_0x1777('0x55')](handleError(_0x4ed704,null));};exports[_0x1777('0x20')]=function(_0x1b5931,_0x376be3){if(_0x1b5931['body']['id']){delete _0x1b5931[_0x1777('0x28')]['id'];}return db[_0x1777('0x51')][_0x1777('0x57')]({'where':{'id':_0x1b5931[_0x1777('0x59')]['id']}})['then'](handleEntityNotFound(_0x376be3,null))[_0x1777('0x21')](saveUpdates(_0x1b5931[_0x1777('0x28')],null))[_0x1777('0x21')](respondWithResult(_0x376be3,null))['catch'](handleError(_0x376be3,null));};exports['describe']=function(_0x5c97c6,_0x4d4fc1){return db['CmHopper']['describe']()[_0x1777('0x21')](respondWithResult(_0x4d4fc1,null))['catch'](handleError(_0x4d4fc1,null));};exports[_0x1777('0x22')]=function(_0x3703a9,_0x2a4683){var _0x24a847;return db[_0x1777('0x51')][_0x1777('0x57')]({'where':{'id':_0x3703a9[_0x1777('0x59')]['id']}})[_0x1777('0x21')](handleEntityNotFound(_0x2a4683,null))['then'](function(_0x50e8b4){if(_0x50e8b4){return _0x50e8b4[_0x1777('0x22')]()[_0x1777('0x21')](function(_0x27b10b){return _0x27b10b;});}})[_0x1777('0x21')](function(_0x3cc455){_0x24a847=_0x3cc455;if(_0x3cc455){if(_0x3cc455[_0x1777('0x5a')]||_0x3cc455['CampaignId']){return db[_0x3cc455['VoiceQueueId']?_0x1777('0x5b'):'Campaign'][_0x1777('0x57')]({'where':{'id':_0x3cc455['VoiceQueueId']?_0x3cc455['VoiceQueueId']:_0x3cc455[_0x1777('0x5c')]},'attributes':['id','name'],'raw':!![]});}}})[_0x1777('0x21')](function(_0x5f08bd){var _0xbe734f={};if(_0x5f08bd){_[_0x1777('0x27')](_0xbe734f,_[_0x1777('0x5d')](_0x24a847[_0x1777('0x5e')],[_0x1777('0x5f'),_0x1777('0x60'),'id']));_0xbe734f[_0x1777('0x61')]=0x15;_0xbe734f['statedesc']=_0x1777('0x62');_0xbe734f['campaign']=_0x5f08bd['name'];_0xbe734f['membername']=_0x3703a9['user'][_0x1777('0x24')];_0xbe734f[_0x1777('0x63')]=_0x3703a9[_0x1777('0x64')]['id'];_0xbe734f[_0x1777('0x62')]=!![];_0xbe734f[_0x1777('0x65')]=moment()['format'](_0x1777('0x66'));_0xbe734f[_0x1777('0x67')]=_0x24a847[_0x1777('0x68')];_0xbe734f[_0x1777('0x69')]=_0x24a847[_0x1777('0x5a')]?_0x1777('0x6a'):'ivr';return db[_0x1777('0x6b')][_0x1777('0x57')]({'where':{'id':_0xbe734f[_0x1777('0x6c')]},'attributes':[_0x1777('0x6d'),_0x1777('0x6e')]})[_0x1777('0x21')](function(_0x5f12d3){if(!_[_0x1777('0x6f')](_0x2a4683)&&!_['isNil'](_0x5f12d3['firstName'])){_0xbe734f[_0x1777('0x70')]=_0x5f12d3[_0x1777('0x6d')];if(!_[_0x1777('0x6f')](_0x5f12d3[_0x1777('0x6e')])){_0xbe734f[_0x1777('0x70')]+='\x20'+_0x5f12d3['lastName'];}}})[_0x1777('0x71')](function(){return db['CmHopperFinal']['create'](_0xbe734f);});}})[_0x1777('0x21')](function(){return _0x2a4683['status'](0xcc)['end']();})[_0x1777('0x55')](handleError(_0x2a4683,null));};exports[_0x1777('0x72')]=function(_0x2fbca7,_0x375c96,_0x426e6b){var _0x501423=[];return db[_0x1777('0x6b')][_0x1777('0x73')]()['then'](function(_0x4662a4){_0x501423=_['keys'](_0x4662a4);return _0x2fbca7['user'][_0x1777('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x435001){if(_0x435001&&_0x435001[_0x1777('0x48')]){return db[_0x1777('0x75')][_0x1777('0x76')](function(_0x3c1733){var _0x520e12={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x1777('0x66'))},'VoiceQueueId':{'$in':_['map'](_0x435001,'id')},'$or':[{'UserId':null},{'UserId':_0x2fbca7[_0x1777('0x64')]['id']}]};var _0x5a214a=[];if(_0x2fbca7['body']['direction']&&_0x2fbca7[_0x1777('0x28')][_0x1777('0x77')]===_0x1777('0x78')){if(!_[_0x1777('0x79')](_0x2fbca7[_0x1777('0x28')][_0x1777('0x7a')])){_0x520e12['id']={'$in':_0x2fbca7['body']['hopperIds']};}_0x5a214a=[[_0x1777('0x7b'),_0x1777('0x7c')],[_0x1777('0x7d'),_0x435001[0x0][_0x1777('0x7e')]===_0x1777('0x7c')?_0x1777('0x7f'):_0x1777('0x7c')],db[_0x1777('0x75')][_0x1777('0x80')](_0x1777('0x81')),['id',_0x1777('0x7f')]];}else{if(!_['isEmpty'](_0x2fbca7['body'][_0x1777('0x7a')])){_0x520e12['id']={'$notIn':_0x2fbca7['body'][_0x1777('0x7a')]};}_0x5a214a=[[_0x1777('0x7b'),_0x1777('0x7f')],[_0x1777('0x7d'),_0x435001[0x0][_0x1777('0x7e')]],db[_0x1777('0x75')][_0x1777('0x80')](_0x1777('0x82')),['id',_0x1777('0x7c')]];}return db[_0x1777('0x51')][_0x1777('0x83')]({'attributes':['id',_0x1777('0x84')],'where':_0x520e12,'order':_0x5a214a,'transaction':_0x3c1733,'lock':_0x3c1733[_0x1777('0x85')][_0x1777('0x86')],'include':[{'model':db[_0x1777('0x6b')],'as':'Contact','attributes':_0x501423,'include':[{'model':db[_0x1777('0x87')],'as':_0x1777('0x88'),'attributes':['id',_0x1777('0x24')]}]},{'model':db[_0x1777('0x89')],'as':_0x1777('0x8a'),'attributes':['id',_0x1777('0x24')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x1777('0x24'),_0x1777('0x8b')]}]})['then'](function(_0x1c5963){if(_0x1c5963){return _0x1c5963[_0x1777('0x20')]({'UserId':_0x2fbca7[_0x1777('0x64')]['id']},{'transaction':_0x3c1733});}});});}})[_0x1777('0x21')](handleEntityNotFound(_0x375c96,null))['then'](respondWithResult(_0x375c96,null))[_0x1777('0x55')](handleError(_0x375c96,null));};exports['getOpenContacts']=function(_0x109d4a,_0x35ba27,_0x4c435a){return _0x109d4a[_0x1777('0x64')][_0x1777('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x1777('0x8c')},'attributes':['id'],'raw':!![]})[_0x1777('0x21')](function(_0x50361d){if(_0x50361d&&_0x50361d[_0x1777('0x48')]){return db[_0x1777('0x51')][_0x1777('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1777('0x8d')](_0x1777('0x66'))},'VoiceQueueId':{'$in':_['map'](_0x50361d,'id')},'$or':[{'UserId':null},{'UserId':_0x109d4a[_0x1777('0x64')]['id']}]}});}return 0x0;})[_0x1777('0x21')](function(_0x168df5){if(!_[_0x1777('0x6f')](_0x168df5)&&_[_0x1777('0x8e')](_0x168df5)){return _0x35ba27[_0x1777('0x14')](0xc8)[_0x1777('0x16')]({'contacts':_0x168df5});}else{logger['error'](_0x1777('0x8f'),_0x1777('0x90'),0x194,_0x1777('0x91'));_0x35ba27[_0x1777('0x92')](0x194);}})[_0x1777('0x55')](handleError(_0x35ba27,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 5d32f01..0fc056a 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 _0x7c3c=['CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x372e70,_0x13e704){var _0xcb3479=function(_0x3be6c8){while(--_0x3be6c8){_0x372e70['push'](_0x372e70['shift']());}};_0xcb3479(++_0x13e704);}(_0x7c3c,0x1c5));var _0xc7c3=function(_0x348ea7,_0x591405){_0x348ea7=_0x348ea7-0x0;var _0x5eafdf=_0x7c3c[_0x348ea7];return _0x5eafdf;};'use strict';var _=require(_0xc7c3('0x0'));var util=require(_0xc7c3('0x1'));var logger=require(_0xc7c3('0x2'))('api');var moment=require(_0xc7c3('0x3'));var BPromise=require(_0xc7c3('0x4'));var rp=require(_0xc7c3('0x5'));var fs=require('fs');var path=require(_0xc7c3('0x6'));var rimraf=require('rimraf');var config=require(_0xc7c3('0x7'));var attributes=require(_0xc7c3('0x8'));module[_0xc7c3('0x9')]=function(_0x2d7619,_0x3469ab){return _0x2d7619[_0xc7c3('0xa')](_0xc7c3('0xb'),attributes,{'tableName':_0xc7c3('0xc'),'paranoid':![],'indexes':[{'name':_0xc7c3('0xd'),'fields':[_0xc7c3('0xd')]},{'name':'phone','fields':[_0xc7c3('0xe')]},{'name':_0xc7c3('0xf'),'fields':[_0xc7c3('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa824=['scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports','define','cm_hopper'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0xa824,0x1ca));var _0x4a82=function(_0x29d707,_0x29cffd){_0x29d707=_0x29d707-0x0;var _0x5518dd=_0xa824[_0x29d707];return _0x5518dd;};'use strict';var _=require(_0x4a82('0x0'));var util=require(_0x4a82('0x1'));var logger=require(_0x4a82('0x2'))(_0x4a82('0x3'));var moment=require(_0x4a82('0x4'));var BPromise=require(_0x4a82('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a82('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x4a82('0x7')]=function(_0x225e37,_0x2a72c5){return _0x225e37[_0x4a82('0x8')]('CmHopper',attributes,{'tableName':_0x4a82('0x9'),'paranoid':![],'indexes':[{'name':_0x4a82('0xa'),'fields':[_0x4a82('0xa')]},{'name':_0x4a82('0xb'),'fields':[_0x4a82('0xb')]},{'name':'priority','fields':[_0x4a82('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 24dd607..063d7db 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 _0x0ea2=['contactsRescheduled','CountReScheduled','GetContactRecallMe','LOCK','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','limit','include','model','attributes','map','then','ShowCmHopper','find','raw','where','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','describe','UPDATE','CmContact','Contact','keys','Agent','name','length','UserId','includes','push','all','transaction','MoveContactManagedDialer','sequelize','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x0ea2,0xd3));var _0x20ea=function(_0x4511e6,_0x2c3afe){_0x4511e6=_0x4511e6-0x0;var _0x573951=_0x0ea2[_0x4511e6];return _0x573951;};'use strict';var _=require(_0x20ea('0x0'));var util=require(_0x20ea('0x1'));var moment=require(_0x20ea('0x2'));var BPromise=require(_0x20ea('0x3'));var rs=require(_0x20ea('0x4'));var fs=require('fs');var Redis=require(_0x20ea('0x5'));var db=require(_0x20ea('0x6'))['db'];var utils=require(_0x20ea('0x7'));var logger=require(_0x20ea('0x8'))('rpc');var config=require(_0x20ea('0x9'));var jayson=require(_0x20ea('0xa'));var client=jayson[_0x20ea('0xb')][_0x20ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x61c106,_0x16ec1d,_0x2f0504){return new BPromise(function(_0x23d05a,_0x462f14){return client['request'](_0x61c106,_0x2f0504)['then'](function(_0x4aa404){logger[_0x20ea('0xd')](_0x20ea('0xe'),_0x16ec1d,_0x20ea('0xf'));logger[_0x20ea('0x10')](_0x20ea('0x11'),_0x16ec1d,_0x20ea('0xf'),JSON[_0x20ea('0x12')](_0x4aa404));if(_0x4aa404[_0x20ea('0x13')]){if(_0x4aa404[_0x20ea('0x13')][_0x20ea('0x14')]===0x1f4){logger['error'](_0x20ea('0xe'),_0x16ec1d,_0x4aa404[_0x20ea('0x13')][_0x20ea('0x15')]);return _0x462f14(_0x4aa404[_0x20ea('0x13')]['message']);}logger[_0x20ea('0x13')](_0x20ea('0xe'),_0x16ec1d,_0x4aa404['error'][_0x20ea('0x15')]);return _0x23d05a(_0x4aa404[_0x20ea('0x13')][_0x20ea('0x15')]);}else{logger['info'](_0x20ea('0xe'),_0x16ec1d,'request\x20sent');_0x23d05a(_0x4aa404[_0x20ea('0x16')][_0x20ea('0x15')]);}})[_0x20ea('0x17')](function(_0xa371c){logger[_0x20ea('0x13')]('CmHopper,\x20%s,\x20%s',_0x16ec1d,_0xa371c);_0x462f14(_0xa371c);});});}exports[_0x20ea('0x18')]=function(_0x35c784){var _0x3e1863=this;return new Promise(function(_0x142211,_0x212c83){return db[_0x20ea('0x19')][_0x20ea('0x1a')]({'raw':_0x35c784[_0x20ea('0x1b')]?_0x35c784[_0x20ea('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x35c784[_0x20ea('0x1b')]?_0x35c784['options']['where']||null:null,'attributes':_0x35c784[_0x20ea('0x1b')]?_0x35c784['options']['attributes']||null:null,'limit':_0x35c784['options']?_0x35c784['options'][_0x20ea('0x1c')]||null:null,'include':_0x35c784[_0x20ea('0x1b')]?_0x35c784[_0x20ea('0x1b')]['include']?_['map'](_0x35c784[_0x20ea('0x1b')][_0x20ea('0x1d')],function(_0x28c2ed){return{'model':db[_0x28c2ed[_0x20ea('0x1e')]],'as':_0x28c2ed['as'],'attributes':_0x28c2ed[_0x20ea('0x1f')],'include':_0x28c2ed[_0x20ea('0x1d')]?_[_0x20ea('0x20')](_0x28c2ed[_0x20ea('0x1d')],function(_0x38f24b){return{'model':db[_0x38f24b['model']],'as':_0x38f24b['as'],'attributes':_0x38f24b[_0x20ea('0x1f')],'include':_0x38f24b[_0x20ea('0x1d')]?_[_0x20ea('0x20')](_0x38f24b[_0x20ea('0x1d')],function(_0x6ad922){return{'model':db[_0x6ad922[_0x20ea('0x1e')]],'as':_0x6ad922['as'],'attributes':_0x6ad922[_0x20ea('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x20ea('0x21')](function(_0x30d1f3){logger[_0x20ea('0xd')](_0x20ea('0x18'),_0x35c784);logger[_0x20ea('0x10')](_0x20ea('0x18'),_0x35c784,JSON[_0x20ea('0x12')](_0x30d1f3));_0x142211(_0x30d1f3);})['catch'](function(_0x5d0543){logger['error'](_0x20ea('0x18'),_0x5d0543[_0x20ea('0x15')],_0x35c784);_0x212c83(_0x3e1863[_0x20ea('0x13')](0x1f4,_0x5d0543[_0x20ea('0x15')]));});});};exports[_0x20ea('0x22')]=function(_0x44a82e){var _0xfd0ef1=this;return new Promise(function(_0x3fa07d,_0x2188dc){return db[_0x20ea('0x19')][_0x20ea('0x23')]({'raw':_0x44a82e[_0x20ea('0x1b')]?_0x44a82e[_0x20ea('0x1b')][_0x20ea('0x24')]===undefined?!![]:![]:!![],'where':_0x44a82e['options']?_0x44a82e[_0x20ea('0x1b')][_0x20ea('0x25')]||null:null,'attributes':_0x44a82e[_0x20ea('0x1b')]?_0x44a82e['options'][_0x20ea('0x1f')]||null:null,'include':_0x44a82e[_0x20ea('0x1b')]?_0x44a82e['options']['include']?_[_0x20ea('0x20')](_0x44a82e['options'][_0x20ea('0x1d')],function(_0xaf143a){return{'model':db[_0xaf143a[_0x20ea('0x1e')]],'as':_0xaf143a['as'],'attributes':_0xaf143a[_0x20ea('0x1f')],'include':_0xaf143a[_0x20ea('0x1d')]?_[_0x20ea('0x20')](_0xaf143a[_0x20ea('0x1d')],function(_0x14b9cd){return{'model':db[_0x14b9cd['model']],'as':_0x14b9cd['as'],'attributes':_0x14b9cd[_0x20ea('0x1f')],'include':_0x14b9cd[_0x20ea('0x1d')]?_[_0x20ea('0x20')](_0x14b9cd[_0x20ea('0x1d')],function(_0x4bf540){return{'model':db[_0x4bf540[_0x20ea('0x1e')]],'as':_0x4bf540['as'],'attributes':_0x4bf540[_0x20ea('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x208976){logger['info']('ShowCmHopper',_0x44a82e);logger[_0x20ea('0x10')](_0x20ea('0x22'),_0x44a82e,JSON[_0x20ea('0x12')](_0x208976));_0x3fa07d(_0x208976);})[_0x20ea('0x17')](function(_0x4ab59a){logger[_0x20ea('0x13')](_0x20ea('0x22'),_0x4ab59a[_0x20ea('0x15')],_0x44a82e);_0x2188dc(_0xfd0ef1[_0x20ea('0x13')](0x1f4,_0x4ab59a[_0x20ea('0x15')]));});});};exports['CreateCmHopper']=function(_0x34b203){var _0x3cc3a3=this;return new Promise(function(_0x541484,_0x29d798){return db[_0x20ea('0x19')]['create'](_0x34b203[_0x20ea('0x26')],{'raw':_0x34b203['options']?_0x34b203[_0x20ea('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x20ea('0x21')](function(_0x3b9725){logger[_0x20ea('0xd')]('CreateCmHopper',_0x34b203);logger['debug'](_0x20ea('0x27'),_0x34b203,JSON[_0x20ea('0x12')](_0x3b9725));_0x541484(_0x3b9725);})[_0x20ea('0x17')](function(_0x5a3ff8){logger['error'](_0x20ea('0x27'),_0x5a3ff8[_0x20ea('0x15')],_0x34b203);_0x29d798(_0x3cc3a3[_0x20ea('0x13')](0x1f4,_0x5a3ff8[_0x20ea('0x15')]));});});};exports[_0x20ea('0x28')]=function(_0x59cd33){var _0x5ea258=this;return new Promise(function(_0x5968f7,_0x324ba5){return db[_0x20ea('0x19')][_0x20ea('0x29')](_0x59cd33['body'],{'raw':_0x59cd33[_0x20ea('0x1b')]?_0x59cd33[_0x20ea('0x1b')][_0x20ea('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59cd33['options']?_0x59cd33[_0x20ea('0x1b')]['where']||null:null,'attributes':_0x59cd33[_0x20ea('0x1b')]?_0x59cd33[_0x20ea('0x1b')][_0x20ea('0x1f')]||null:null,'limit':_0x59cd33['options']?_0x59cd33[_0x20ea('0x1b')][_0x20ea('0x1c')]||null:null})[_0x20ea('0x21')](function(_0xdb61f7){logger['info'](_0x20ea('0x28'),_0x59cd33);logger[_0x20ea('0x10')](_0x20ea('0x28'),_0x59cd33,JSON[_0x20ea('0x12')](_0xdb61f7));_0x5968f7(_0xdb61f7);})[_0x20ea('0x17')](function(_0x3f3e0c){logger[_0x20ea('0x13')]('UpdateCmHopper',_0x3f3e0c[_0x20ea('0x15')],_0x59cd33);_0x324ba5(_0x5ea258['error'](0x1f4,_0x3f3e0c[_0x20ea('0x15')]));});});};exports[_0x20ea('0x2a')]=function(_0x570993){var _0x1f81f3=this;return new Promise(function(_0x64d906,_0x51253d){return db[_0x20ea('0x19')][_0x20ea('0x2b')]({'where':_0x570993[_0x20ea('0x1b')]?_0x570993['options'][_0x20ea('0x25')]||null:null})[_0x20ea('0x21')](function(_0x4feaaf){logger[_0x20ea('0xd')](_0x20ea('0x2a'),_0x570993);logger[_0x20ea('0x10')](_0x20ea('0x2a'),_0x570993,JSON[_0x20ea('0x12')](_0x4feaaf));_0x64d906(_0x4feaaf);})['catch'](function(_0x59bbe1){logger[_0x20ea('0x13')]('DestroyCmHopper',_0x59bbe1[_0x20ea('0x15')],_0x570993);_0x51253d(_0x1f81f3[_0x20ea('0x13')](0x1f4,_0x59bbe1[_0x20ea('0x15')]));});});};exports[_0x20ea('0x2c')]=function(_0x1d1c02){var _0x405e63=this;return new Promise(function(_0x10e26c,_0x427fa3){return db['CmContact'][_0x20ea('0x2d')]()[_0x20ea('0x21')](function(_0x5d1953){return db['sequelize']['transaction'](function(_0x32ac05){return db[_0x20ea('0x19')]['findAll']({'where':_0x1d1c02[_0x20ea('0x1b')]?_0x1d1c02[_0x20ea('0x1b')][_0x20ea('0x25')]||null:null,'attributes':_0x1d1c02[_0x20ea('0x1b')]?_0x1d1c02[_0x20ea('0x1b')]['attributes']||null:null,'limit':_0x1d1c02[_0x20ea('0x1b')]?_0x1d1c02[_0x20ea('0x1b')][_0x20ea('0x1c')]||null:null,'order':_0x1d1c02[_0x20ea('0x1b')]?_0x1d1c02[_0x20ea('0x1b')]['order']||null:null,'transaction':_0x32ac05,'lock':_0x32ac05['LOCK'][_0x20ea('0x2e')],'include':[{'model':db[_0x20ea('0x2f')],'as':_0x20ea('0x30'),'attributes':_[_0x20ea('0x31')](_0x5d1953)},{'model':db['User'],'as':_0x20ea('0x32'),'attributes':['id',_0x20ea('0x33'),'voicePause']}]})[_0x20ea('0x21')](function(_0x54129b){var _0x4cbb3c=[];var _0x1b9373=[];for(var _0x2ec7b6=0x0;_0x2ec7b6<_0x54129b[_0x20ea('0x34')];_0x2ec7b6+=0x1){var _0x9f0b47=_0x54129b[_0x2ec7b6][_0x20ea('0x35')];if(_0x9f0b47===null){_0x4cbb3c['push'](_0x54129b[_0x2ec7b6]['update'](_0x1d1c02[_0x20ea('0x26')],{'transaction':_0x32ac05}));}else if(!_0x1b9373[_0x20ea('0x36')](_0x9f0b47)){_0x1b9373[_0x20ea('0x37')](_0x9f0b47);_0x4cbb3c[_0x20ea('0x37')](_0x54129b[_0x2ec7b6][_0x20ea('0x29')](_0x1d1c02[_0x20ea('0x26')],{'transaction':_0x32ac05}));}}return BPromise[_0x20ea('0x38')](_0x4cbb3c);});})[_0x20ea('0x21')](function(_0x2ec0d7){logger[_0x20ea('0xd')]('GetContactDialer',_0x1d1c02);logger[_0x20ea('0x10')]('GetContactDialer',_0x1d1c02,JSON[_0x20ea('0x12')](_0x2ec0d7));_0x10e26c(_0x2ec0d7);})['catch'](function(_0x34271a){logger['error'](_0x20ea('0x2c'),_0x34271a[_0x20ea('0x15')],_0x1d1c02);_0x427fa3(_0x405e63[_0x20ea('0x13')](0x1f4,_0x34271a[_0x20ea('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x248f0e){var _0x56d24b=this;return new Promise(function(_0x594c98,_0x160697){return db['sequelize'][_0x20ea('0x39')](function(_0x51472a){return db['CmHopperFinal']['create'](_0x248f0e['body'],{'raw':_0x248f0e[_0x20ea('0x1b')]?_0x248f0e[_0x20ea('0x1b')]['raw']===undefined?!![]:![]:!![],'transaction':_0x51472a})[_0x20ea('0x21')](function(){return db['CmHopper']['destroy']({'where':_0x248f0e[_0x20ea('0x1b')]?_0x248f0e[_0x20ea('0x1b')][_0x20ea('0x25')]||null:null,'transaction':_0x51472a});});})['then'](function(_0x359d2b){logger['info'](_0x20ea('0x3a'),_0x248f0e);logger['debug'](_0x20ea('0x3a'),_0x248f0e,JSON[_0x20ea('0x12')](_0x359d2b));_0x594c98(_0x359d2b);})['catch'](function(_0x2b84b6){logger['error'](_0x20ea('0x3a'),_0x2b84b6[_0x20ea('0x15')],_0x248f0e);_0x160697(_0x56d24b['error'](0x1f4,_0x2b84b6[_0x20ea('0x15')]));});});};exports['CountReScheduled']=function(_0x43746c){var _0x32811b=this;return new Promise(function(_0x217c16,_0x2f5e52){return db[_0x20ea('0x19')]['findAll']({'raw':_0x43746c[_0x20ea('0x1b')]?_0x43746c[_0x20ea('0x1b')][_0x20ea('0x24')]===undefined?!![]:![]:!![],'where':_0x43746c['options']?_0x43746c[_0x20ea('0x1b')]['where']||null:null,'attributes':[[db[_0x20ea('0x3b')]['fn']('COUNT',db[_0x20ea('0x3b')]['fn']('IF',db[_0x20ea('0x3b')][_0x20ea('0x3c')]('`scheduledat`\x20>=\x20'+util[_0x20ea('0x3d')](_0x20ea('0x3e'),moment()['format'](_0x20ea('0x3f')))+_0x20ea('0x40')))),_0x20ea('0x41')]]})['then'](function(_0x136bb8){logger['info'](_0x20ea('0x42'),_0x43746c);logger[_0x20ea('0x10')]('CountReScheduled',_0x43746c,JSON[_0x20ea('0x12')](_0x136bb8));_0x217c16(_0x136bb8);})[_0x20ea('0x17')](function(_0x2f218d){logger['error'](_0x20ea('0x42'),_0x2f218d[_0x20ea('0x15')],_0x43746c);_0x2f5e52(_0x32811b['error'](0x1f4,_0x2f218d['message']));});});};exports[_0x20ea('0x43')]=function(_0x2a5621){var _0x3fa3db=this;return new Promise(function(_0x48f524,_0x20958f){return db['CmContact'][_0x20ea('0x2d')]()['then'](function(_0x17a5f6){return db[_0x20ea('0x3b')]['transaction'](function(_0xf27e51){return db[_0x20ea('0x19')][_0x20ea('0x1a')]({'where':_0x2a5621['options']?_0x2a5621[_0x20ea('0x1b')]['where']||null:null,'attributes':_0x2a5621[_0x20ea('0x1b')]?_0x2a5621[_0x20ea('0x1b')][_0x20ea('0x1f')]||null:null,'limit':0x1,'order':_0x2a5621[_0x20ea('0x1b')]?_0x2a5621[_0x20ea('0x1b')]['order']||null:null,'group':db[_0x20ea('0x19')]['UserId'],'transaction':_0xf27e51,'lock':_0xf27e51[_0x20ea('0x44')]['UPDATE'],'include':_0x2a5621[_0x20ea('0x1b')]?_0x2a5621[_0x20ea('0x1b')][_0x20ea('0x1d')]?_['map'](_0x2a5621[_0x20ea('0x1b')][_0x20ea('0x1d')],function(_0x3c67f4){return{'model':db[_0x3c67f4['model']],'as':_0x3c67f4['as'],'attributes':_0x3c67f4[_0x20ea('0x1f')],'include':_0x3c67f4[_0x20ea('0x1d')]?_[_0x20ea('0x20')](_0x3c67f4[_0x20ea('0x1d')],function(_0x165dcb){return{'model':db[_0x165dcb[_0x20ea('0x1e')]],'as':_0x165dcb['as'],'attributes':_0x165dcb[_0x20ea('0x1f')],'include':_0x165dcb[_0x20ea('0x1d')]?_[_0x20ea('0x20')](_0x165dcb[_0x20ea('0x1d')],function(_0x2afe51){return{'model':db[_0x2afe51[_0x20ea('0x1e')]],'as':_0x2afe51['as'],'attributes':_0x2afe51[_0x20ea('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x20ea('0x21')](function(_0x33e403){var _0x1b8b7b=[];for(var _0x54d3b1=0x0;_0x54d3b1<_0x33e403['length'];_0x54d3b1+=0x1){_0x1b8b7b[_0x20ea('0x37')](_0x33e403[_0x54d3b1][_0x20ea('0x29')](_0x2a5621[_0x20ea('0x26')],{'transaction':_0xf27e51}));}return BPromise[_0x20ea('0x38')](_0x1b8b7b);});})[_0x20ea('0x21')](function(_0x52aa50){logger[_0x20ea('0xd')](_0x20ea('0x43'),_0x2a5621);logger[_0x20ea('0x10')](_0x20ea('0x43'),_0x2a5621,JSON[_0x20ea('0x12')](_0x52aa50));_0x48f524(_0x52aa50);})['catch'](function(_0x57617f){logger[_0x20ea('0x13')](_0x20ea('0x43'),_0x57617f[_0x20ea('0x15')],_0x2a5621);_0x20958f(_0x3fa3db[_0x20ea('0x13')](0x1f4,_0x57617f[_0x20ea('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x4a65ab){var _0x28661b=this;return new Promise(function(_0x4531a7,_0x2cb6eb){db[_0x20ea('0x2f')]['describe']()[_0x20ea('0x21')](function(_0x30d182){return db[_0x20ea('0x19')][_0x20ea('0x1a')]({'raw':_0x4a65ab['options']?_0x4a65ab[_0x20ea('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4a65ab[_0x20ea('0x1b')]?_0x4a65ab['options']['where']||null:null,'attributes':_0x4a65ab[_0x20ea('0x1b')]?_0x4a65ab[_0x20ea('0x1b')][_0x20ea('0x1f')]||null:null,'limit':_0x4a65ab[_0x20ea('0x1b')]?_0x4a65ab[_0x20ea('0x1b')][_0x20ea('0x1c')]||null:null,'include':_0x4a65ab[_0x20ea('0x1b')]?_0x4a65ab[_0x20ea('0x1b')][_0x20ea('0x1d')]?_['map'](_0x4a65ab[_0x20ea('0x1b')][_0x20ea('0x1d')],function(_0xda3f9e){return{'model':db[_0xda3f9e['model']],'as':_0xda3f9e['as'],'attributes':_0xda3f9e['as']===_0x20ea('0x30')?_[_0x20ea('0x31')](_0x30d182):_0xda3f9e['attributes'],'include':_0xda3f9e[_0x20ea('0x1d')]?_[_0x20ea('0x20')](_0xda3f9e[_0x20ea('0x1d')],function(_0xec0deb){return{'model':db[_0xec0deb[_0x20ea('0x1e')]],'as':_0xec0deb['as'],'attributes':_0xec0deb[_0x20ea('0x1f')],'include':_0xec0deb[_0x20ea('0x1d')]?_[_0x20ea('0x20')](_0xec0deb[_0x20ea('0x1d')],function(_0xb2f865){return{'model':db[_0xb2f865[_0x20ea('0x1e')]],'as':_0xb2f865['as'],'attributes':_0xb2f865[_0x20ea('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x20ea('0x21')](function(_0x323e2e){logger['info'](_0x20ea('0x18'),_0x4a65ab);logger[_0x20ea('0x10')](_0x20ea('0x18'),_0x4a65ab,JSON['stringify'](_0x323e2e));_0x4531a7(_0x323e2e);})['catch'](function(_0x242599){logger[_0x20ea('0x13')](_0x20ea('0x18'),_0x242599['message'],_0x4a65ab);_0x2cb6eb(_0x28661b[_0x20ea('0x13')](0x1f4,_0x242599[_0x20ea('0x15')]));});});});}; \ No newline at end of file +var _0xe0ce=['contactsRescheduled','GetContactRecallMe','describe','LOCK','length','GetCmHopperPreview','Contact','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetCmHopper','CmHopper','options','raw','where','map','model','attributes','include','then','ShowCmHopper','create','CreateCmHopper','update','body','limit','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','findAll','order','UPDATE','keys','User','Agent','voicePause','UserId','push','includes','all','CmHopperFinal','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null'];(function(_0x3df460,_0x4f9744){var _0x3d6f1f=function(_0x346306){while(--_0x346306){_0x3df460['push'](_0x3df460['shift']());}};_0x3d6f1f(++_0x4f9744);}(_0xe0ce,0x1ab));var _0xee0c=function(_0x5a433c,_0x423be6){_0x5a433c=_0x5a433c-0x0;var _0x310003=_0xe0ce[_0x5a433c];return _0x310003;};'use strict';var _=require(_0xee0c('0x0'));var util=require(_0xee0c('0x1'));var moment=require(_0xee0c('0x2'));var BPromise=require('bluebird');var rs=require(_0xee0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee0c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xee0c('0x5'))(_0xee0c('0x6'));var config=require(_0xee0c('0x7'));var jayson=require(_0xee0c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x480ca0,_0x45b631,_0x4027be){return new BPromise(function(_0x40f768,_0x33b872){return client[_0xee0c('0x9')](_0x480ca0,_0x4027be)['then'](function(_0x50019f){logger['info'](_0xee0c('0xa'),_0x45b631,_0xee0c('0xb'));logger[_0xee0c('0xc')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x45b631,'request\x20sent',JSON[_0xee0c('0xd')](_0x50019f));if(_0x50019f[_0xee0c('0xe')]){if(_0x50019f[_0xee0c('0xe')][_0xee0c('0xf')]===0x1f4){logger[_0xee0c('0xe')](_0xee0c('0xa'),_0x45b631,_0x50019f['error']['message']);return _0x33b872(_0x50019f['error'][_0xee0c('0x10')]);}logger[_0xee0c('0xe')](_0xee0c('0xa'),_0x45b631,_0x50019f['error'][_0xee0c('0x10')]);return _0x40f768(_0x50019f[_0xee0c('0xe')][_0xee0c('0x10')]);}else{logger[_0xee0c('0x11')](_0xee0c('0xa'),_0x45b631,_0xee0c('0xb'));_0x40f768(_0x50019f[_0xee0c('0x12')][_0xee0c('0x10')]);}})[_0xee0c('0x13')](function(_0x58e365){logger['error'](_0xee0c('0xa'),_0x45b631,_0x58e365);_0x33b872(_0x58e365);});});}exports[_0xee0c('0x14')]=function(_0x38108f){var _0xdf848b=this;return new Promise(function(_0x4bdf90,_0x4cd880){return db[_0xee0c('0x15')]['findAll']({'raw':_0x38108f[_0xee0c('0x16')]?_0x38108f[_0xee0c('0x16')][_0xee0c('0x17')]===undefined?!![]:![]:!![],'where':_0x38108f[_0xee0c('0x16')]?_0x38108f['options'][_0xee0c('0x18')]||null:null,'attributes':_0x38108f[_0xee0c('0x16')]?_0x38108f[_0xee0c('0x16')]['attributes']||null:null,'limit':_0x38108f[_0xee0c('0x16')]?_0x38108f[_0xee0c('0x16')]['limit']||null:null,'include':_0x38108f['options']?_0x38108f[_0xee0c('0x16')]['include']?_['map'](_0x38108f[_0xee0c('0x16')]['include'],function(_0x216634){return{'model':db[_0x216634['model']],'as':_0x216634['as'],'attributes':_0x216634['attributes'],'include':_0x216634['include']?_[_0xee0c('0x19')](_0x216634['include'],function(_0x57e851){return{'model':db[_0x57e851[_0xee0c('0x1a')]],'as':_0x57e851['as'],'attributes':_0x57e851[_0xee0c('0x1b')],'include':_0x57e851[_0xee0c('0x1c')]?_['map'](_0x57e851[_0xee0c('0x1c')],function(_0x45aebc){return{'model':db[_0x45aebc[_0xee0c('0x1a')]],'as':_0x45aebc['as'],'attributes':_0x45aebc[_0xee0c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xee0c('0x1d')](function(_0x2b6e2f){logger['info'](_0xee0c('0x14'),_0x38108f);logger[_0xee0c('0xc')](_0xee0c('0x14'),_0x38108f,JSON['stringify'](_0x2b6e2f));_0x4bdf90(_0x2b6e2f);})[_0xee0c('0x13')](function(_0x1ec78f){logger[_0xee0c('0xe')]('GetCmHopper',_0x1ec78f[_0xee0c('0x10')],_0x38108f);_0x4cd880(_0xdf848b[_0xee0c('0xe')](0x1f4,_0x1ec78f[_0xee0c('0x10')]));});});};exports[_0xee0c('0x1e')]=function(_0x42cd0a){var _0x2270dd=this;return new Promise(function(_0x276c7e,_0x3d5f67){return db[_0xee0c('0x15')]['find']({'raw':_0x42cd0a[_0xee0c('0x16')]?_0x42cd0a['options'][_0xee0c('0x17')]===undefined?!![]:![]:!![],'where':_0x42cd0a[_0xee0c('0x16')]?_0x42cd0a[_0xee0c('0x16')][_0xee0c('0x18')]||null:null,'attributes':_0x42cd0a['options']?_0x42cd0a[_0xee0c('0x16')][_0xee0c('0x1b')]||null:null,'include':_0x42cd0a['options']?_0x42cd0a[_0xee0c('0x16')][_0xee0c('0x1c')]?_['map'](_0x42cd0a[_0xee0c('0x16')][_0xee0c('0x1c')],function(_0x56c278){return{'model':db[_0x56c278[_0xee0c('0x1a')]],'as':_0x56c278['as'],'attributes':_0x56c278[_0xee0c('0x1b')],'include':_0x56c278[_0xee0c('0x1c')]?_[_0xee0c('0x19')](_0x56c278[_0xee0c('0x1c')],function(_0x503c85){return{'model':db[_0x503c85[_0xee0c('0x1a')]],'as':_0x503c85['as'],'attributes':_0x503c85['attributes'],'include':_0x503c85[_0xee0c('0x1c')]?_[_0xee0c('0x19')](_0x503c85[_0xee0c('0x1c')],function(_0x2625eb){return{'model':db[_0x2625eb[_0xee0c('0x1a')]],'as':_0x2625eb['as'],'attributes':_0x2625eb[_0xee0c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xee0c('0x1d')](function(_0x445462){logger[_0xee0c('0x11')](_0xee0c('0x1e'),_0x42cd0a);logger['debug'](_0xee0c('0x1e'),_0x42cd0a,JSON[_0xee0c('0xd')](_0x445462));_0x276c7e(_0x445462);})[_0xee0c('0x13')](function(_0x38d439){logger[_0xee0c('0xe')](_0xee0c('0x1e'),_0x38d439[_0xee0c('0x10')],_0x42cd0a);_0x3d5f67(_0x2270dd[_0xee0c('0xe')](0x1f4,_0x38d439[_0xee0c('0x10')]));});});};exports['CreateCmHopper']=function(_0x367141){var _0xf8994d=this;return new Promise(function(_0x1a1ca6,_0x1e7269){return db[_0xee0c('0x15')][_0xee0c('0x1f')](_0x367141['body'],{'raw':_0x367141[_0xee0c('0x16')]?_0x367141[_0xee0c('0x16')][_0xee0c('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x65b172){logger['info'](_0xee0c('0x20'),_0x367141);logger[_0xee0c('0xc')](_0xee0c('0x20'),_0x367141,JSON[_0xee0c('0xd')](_0x65b172));_0x1a1ca6(_0x65b172);})[_0xee0c('0x13')](function(_0x1dd431){logger[_0xee0c('0xe')](_0xee0c('0x20'),_0x1dd431[_0xee0c('0x10')],_0x367141);_0x1e7269(_0xf8994d['error'](0x1f4,_0x1dd431['message']));});});};exports['UpdateCmHopper']=function(_0x13ac1a){var _0x2d87b7=this;return new Promise(function(_0x42806d,_0x25939b){return db['CmHopper'][_0xee0c('0x21')](_0x13ac1a[_0xee0c('0x22')],{'raw':_0x13ac1a[_0xee0c('0x16')]?_0x13ac1a['options'][_0xee0c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13ac1a[_0xee0c('0x16')]?_0x13ac1a[_0xee0c('0x16')][_0xee0c('0x18')]||null:null,'attributes':_0x13ac1a[_0xee0c('0x16')]?_0x13ac1a['options']['attributes']||null:null,'limit':_0x13ac1a[_0xee0c('0x16')]?_0x13ac1a['options'][_0xee0c('0x23')]||null:null})[_0xee0c('0x1d')](function(_0x53a285){logger[_0xee0c('0x11')](_0xee0c('0x24'),_0x13ac1a);logger[_0xee0c('0xc')](_0xee0c('0x24'),_0x13ac1a,JSON[_0xee0c('0xd')](_0x53a285));_0x42806d(_0x53a285);})[_0xee0c('0x13')](function(_0x37bd74){logger['error']('UpdateCmHopper',_0x37bd74['message'],_0x13ac1a);_0x25939b(_0x2d87b7[_0xee0c('0xe')](0x1f4,_0x37bd74[_0xee0c('0x10')]));});});};exports['DestroyCmHopper']=function(_0x4d293e){var _0x44997b=this;return new Promise(function(_0x1256fd,_0x40a317){return db[_0xee0c('0x15')]['destroy']({'where':_0x4d293e[_0xee0c('0x16')]?_0x4d293e[_0xee0c('0x16')][_0xee0c('0x18')]||null:null})['then'](function(_0x445ad9){logger[_0xee0c('0x11')](_0xee0c('0x25'),_0x4d293e);logger[_0xee0c('0xc')](_0xee0c('0x25'),_0x4d293e,JSON[_0xee0c('0xd')](_0x445ad9));_0x1256fd(_0x445ad9);})[_0xee0c('0x13')](function(_0x41000a){logger['error'](_0xee0c('0x25'),_0x41000a[_0xee0c('0x10')],_0x4d293e);_0x40a317(_0x44997b[_0xee0c('0xe')](0x1f4,_0x41000a[_0xee0c('0x10')]));});});};exports[_0xee0c('0x26')]=function(_0xad8669){var _0x44ebde=this;return new Promise(function(_0x25300f,_0x4a20a0){return db[_0xee0c('0x27')]['describe']()['then'](function(_0x5a4189){return db[_0xee0c('0x28')][_0xee0c('0x29')](function(_0x64ba2f){return db[_0xee0c('0x15')][_0xee0c('0x2a')]({'where':_0xad8669[_0xee0c('0x16')]?_0xad8669[_0xee0c('0x16')]['where']||null:null,'attributes':_0xad8669[_0xee0c('0x16')]?_0xad8669[_0xee0c('0x16')][_0xee0c('0x1b')]||null:null,'limit':_0xad8669[_0xee0c('0x16')]?_0xad8669[_0xee0c('0x16')][_0xee0c('0x23')]||null:null,'order':_0xad8669[_0xee0c('0x16')]?_0xad8669['options'][_0xee0c('0x2b')]||null:null,'transaction':_0x64ba2f,'lock':_0x64ba2f['LOCK'][_0xee0c('0x2c')],'include':[{'model':db[_0xee0c('0x27')],'as':'Contact','attributes':_[_0xee0c('0x2d')](_0x5a4189)},{'model':db[_0xee0c('0x2e')],'as':_0xee0c('0x2f'),'attributes':['id','name',_0xee0c('0x30')]}]})[_0xee0c('0x1d')](function(_0x4b20eb){var _0x3b5d07=[];var _0x92b451=[];for(var _0x14a322=0x0;_0x14a322<_0x4b20eb['length'];_0x14a322+=0x1){var _0xb3c71e=_0x4b20eb[_0x14a322][_0xee0c('0x31')];if(_0xb3c71e===null){_0x3b5d07[_0xee0c('0x32')](_0x4b20eb[_0x14a322][_0xee0c('0x21')](_0xad8669[_0xee0c('0x22')],{'transaction':_0x64ba2f}));}else if(!_0x92b451[_0xee0c('0x33')](_0xb3c71e)){_0x92b451['push'](_0xb3c71e);_0x3b5d07['push'](_0x4b20eb[_0x14a322][_0xee0c('0x21')](_0xad8669[_0xee0c('0x22')],{'transaction':_0x64ba2f}));}}return BPromise[_0xee0c('0x34')](_0x3b5d07);});})[_0xee0c('0x1d')](function(_0x5d54ec){logger[_0xee0c('0x11')](_0xee0c('0x26'),_0xad8669);logger[_0xee0c('0xc')]('GetContactDialer',_0xad8669,JSON[_0xee0c('0xd')](_0x5d54ec));_0x25300f(_0x5d54ec);})[_0xee0c('0x13')](function(_0x337980){logger[_0xee0c('0xe')](_0xee0c('0x26'),_0x337980[_0xee0c('0x10')],_0xad8669);_0x4a20a0(_0x44ebde[_0xee0c('0xe')](0x1f4,_0x337980[_0xee0c('0x10')]));});});});};exports['MoveContactManagedDialer']=function(_0x2859d4){var _0x18a168=this;return new Promise(function(_0x5c5c1b,_0x249972){return db[_0xee0c('0x28')][_0xee0c('0x29')](function(_0x2bb360){return db[_0xee0c('0x35')][_0xee0c('0x1f')](_0x2859d4[_0xee0c('0x22')],{'raw':_0x2859d4['options']?_0x2859d4[_0xee0c('0x16')][_0xee0c('0x17')]===undefined?!![]:![]:!![],'transaction':_0x2bb360})['then'](function(){return db['CmHopper'][_0xee0c('0x36')]({'where':_0x2859d4[_0xee0c('0x16')]?_0x2859d4['options'][_0xee0c('0x18')]||null:null,'transaction':_0x2bb360});});})[_0xee0c('0x1d')](function(_0x42bbf1){logger[_0xee0c('0x11')]('MoveContactManagedDialer',_0x2859d4);logger[_0xee0c('0xc')](_0xee0c('0x37'),_0x2859d4,JSON['stringify'](_0x42bbf1));_0x5c5c1b(_0x42bbf1);})[_0xee0c('0x13')](function(_0x3a8361){logger[_0xee0c('0xe')](_0xee0c('0x37'),_0x3a8361[_0xee0c('0x10')],_0x2859d4);_0x249972(_0x18a168[_0xee0c('0xe')](0x1f4,_0x3a8361['message']));});});};exports[_0xee0c('0x38')]=function(_0x53eac1){var _0x9c8a8b=this;return new Promise(function(_0x25922c,_0xd61e85){return db[_0xee0c('0x15')][_0xee0c('0x2a')]({'raw':_0x53eac1[_0xee0c('0x16')]?_0x53eac1[_0xee0c('0x16')][_0xee0c('0x17')]===undefined?!![]:![]:!![],'where':_0x53eac1['options']?_0x53eac1[_0xee0c('0x16')][_0xee0c('0x18')]||null:null,'attributes':[[db[_0xee0c('0x28')]['fn'](_0xee0c('0x39'),db[_0xee0c('0x28')]['fn']('IF',db[_0xee0c('0x28')][_0xee0c('0x3a')](_0xee0c('0x3b')+util[_0xee0c('0x3c')](_0xee0c('0x3d'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0xee0c('0x3e')))),_0xee0c('0x3f')]]})[_0xee0c('0x1d')](function(_0x5abf54){logger['info'](_0xee0c('0x38'),_0x53eac1);logger[_0xee0c('0xc')](_0xee0c('0x38'),_0x53eac1,JSON[_0xee0c('0xd')](_0x5abf54));_0x25922c(_0x5abf54);})['catch'](function(_0x18c387){logger[_0xee0c('0xe')](_0xee0c('0x38'),_0x18c387['message'],_0x53eac1);_0xd61e85(_0x9c8a8b['error'](0x1f4,_0x18c387[_0xee0c('0x10')]));});});};exports[_0xee0c('0x40')]=function(_0x421efe){var _0x56b282=this;return new Promise(function(_0x183fb6,_0x43deb6){return db['CmContact'][_0xee0c('0x41')]()['then'](function(_0xe0e0c1){return db[_0xee0c('0x28')][_0xee0c('0x29')](function(_0x13be33){return db[_0xee0c('0x15')][_0xee0c('0x2a')]({'where':_0x421efe[_0xee0c('0x16')]?_0x421efe[_0xee0c('0x16')][_0xee0c('0x18')]||null:null,'attributes':_0x421efe[_0xee0c('0x16')]?_0x421efe['options'][_0xee0c('0x1b')]||null:null,'limit':0x1,'order':_0x421efe[_0xee0c('0x16')]?_0x421efe['options'][_0xee0c('0x2b')]||null:null,'group':db[_0xee0c('0x15')][_0xee0c('0x31')],'transaction':_0x13be33,'lock':_0x13be33[_0xee0c('0x42')][_0xee0c('0x2c')],'include':_0x421efe[_0xee0c('0x16')]?_0x421efe[_0xee0c('0x16')][_0xee0c('0x1c')]?_['map'](_0x421efe['options']['include'],function(_0x1b4d9c){return{'model':db[_0x1b4d9c[_0xee0c('0x1a')]],'as':_0x1b4d9c['as'],'attributes':_0x1b4d9c['attributes'],'include':_0x1b4d9c['include']?_[_0xee0c('0x19')](_0x1b4d9c[_0xee0c('0x1c')],function(_0x26a55a){return{'model':db[_0x26a55a[_0xee0c('0x1a')]],'as':_0x26a55a['as'],'attributes':_0x26a55a['attributes'],'include':_0x26a55a[_0xee0c('0x1c')]?_['map'](_0x26a55a['include'],function(_0x62ca06){return{'model':db[_0x62ca06[_0xee0c('0x1a')]],'as':_0x62ca06['as'],'attributes':_0x62ca06[_0xee0c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32d61a){var _0x15efc6=[];for(var _0x13947c=0x0;_0x13947c<_0x32d61a[_0xee0c('0x43')];_0x13947c+=0x1){_0x15efc6[_0xee0c('0x32')](_0x32d61a[_0x13947c][_0xee0c('0x21')](_0x421efe['body'],{'transaction':_0x13be33}));}return BPromise[_0xee0c('0x34')](_0x15efc6);});})[_0xee0c('0x1d')](function(_0xacd81c){logger[_0xee0c('0x11')](_0xee0c('0x40'),_0x421efe);logger['debug'](_0xee0c('0x40'),_0x421efe,JSON[_0xee0c('0xd')](_0xacd81c));_0x183fb6(_0xacd81c);})[_0xee0c('0x13')](function(_0x3705e3){logger['error'](_0xee0c('0x40'),_0x3705e3['message'],_0x421efe);_0x43deb6(_0x56b282['error'](0x1f4,_0x3705e3[_0xee0c('0x10')]));});});});};exports[_0xee0c('0x44')]=function(_0x55bdd9){var _0x3108e6=this;return new Promise(function(_0x2150f5,_0x4b0d03){db['CmContact'][_0xee0c('0x41')]()[_0xee0c('0x1d')](function(_0x32da61){return db[_0xee0c('0x15')][_0xee0c('0x2a')]({'raw':_0x55bdd9[_0xee0c('0x16')]?_0x55bdd9[_0xee0c('0x16')][_0xee0c('0x17')]===undefined?!![]:![]:!![],'where':_0x55bdd9[_0xee0c('0x16')]?_0x55bdd9[_0xee0c('0x16')][_0xee0c('0x18')]||null:null,'attributes':_0x55bdd9[_0xee0c('0x16')]?_0x55bdd9['options']['attributes']||null:null,'limit':_0x55bdd9[_0xee0c('0x16')]?_0x55bdd9[_0xee0c('0x16')][_0xee0c('0x23')]||null:null,'include':_0x55bdd9[_0xee0c('0x16')]?_0x55bdd9[_0xee0c('0x16')][_0xee0c('0x1c')]?_[_0xee0c('0x19')](_0x55bdd9[_0xee0c('0x16')]['include'],function(_0x4e18b7){return{'model':db[_0x4e18b7['model']],'as':_0x4e18b7['as'],'attributes':_0x4e18b7['as']===_0xee0c('0x45')?_[_0xee0c('0x2d')](_0x32da61):_0x4e18b7['attributes'],'include':_0x4e18b7[_0xee0c('0x1c')]?_['map'](_0x4e18b7[_0xee0c('0x1c')],function(_0x1582c1){return{'model':db[_0x1582c1['model']],'as':_0x1582c1['as'],'attributes':_0x1582c1[_0xee0c('0x1b')],'include':_0x1582c1[_0xee0c('0x1c')]?_[_0xee0c('0x19')](_0x1582c1[_0xee0c('0x1c')],function(_0x447a6a){return{'model':db[_0x447a6a['model']],'as':_0x447a6a['as'],'attributes':_0x447a6a[_0xee0c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xee0c('0x1d')](function(_0x2f163e){logger[_0xee0c('0x11')]('GetCmHopper',_0x55bdd9);logger['debug']('GetCmHopper',_0x55bdd9,JSON[_0xee0c('0xd')](_0x2f163e));_0x2150f5(_0x2f163e);})[_0xee0c('0x13')](function(_0x11f8c5){logger[_0xee0c('0xe')](_0xee0c('0x14'),_0x11f8c5['message'],_0x55bdd9);_0x4b0d03(_0x3108e6[_0xee0c('0xe')](0x1f4,_0x11f8c5[_0xee0c('0x10')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 206c555..05b041d 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 _0x9b9b=['getPreview','put','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','/:id','post','create','/preview'];(function(_0x300d0e,_0x4fcd1b){var _0x1903cb=function(_0x1d4721){while(--_0x1d4721){_0x300d0e['push'](_0x300d0e['shift']());}};_0x1903cb(++_0x4fcd1b);}(_0x9b9b,0x114));var _0xb9b9=function(_0x250b8b,_0x1d3b34){_0x250b8b=_0x250b8b-0x0;var _0x458585=_0x9b9b[_0x250b8b];return _0x458585;};'use strict';var multer=require('multer');var util=require(_0xb9b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9b9('0x1'));var router=express[_0xb9b9('0x2')]();var fs_extra=require(_0xb9b9('0x3'));var auth=require(_0xb9b9('0x4'));var interaction=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var controller=require(_0xb9b9('0x7'));router[_0xb9b9('0x8')]('/',auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xa')]);router[_0xb9b9('0x8')](_0xb9b9('0xb'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xc')]);router[_0xb9b9('0x8')](_0xb9b9('0xd'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xb9b9('0x8')](_0xb9b9('0xe'),auth[_0xb9b9('0x9')](),controller['show']);router[_0xb9b9('0xf')]('/',auth[_0xb9b9('0x9')](),controller[_0xb9b9('0x10')]);router['post'](_0xb9b9('0x11'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0x12')]);router[_0xb9b9('0x13')](_0xb9b9('0xe'),auth[_0xb9b9('0x9')](),controller['update']);router['delete'](_0xb9b9('0xe'),auth['isAuthenticated'](),controller[_0xb9b9('0x14')]);module['exports']=router; \ No newline at end of file +var _0x49fe=['getPreview','put','update','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','show','create','post','/preview'];(function(_0x221c07,_0x2682eb){var _0x382913=function(_0x249617){while(--_0x249617){_0x221c07['push'](_0x221c07['shift']());}};_0x382913(++_0x2682eb);}(_0x49fe,0x100));var _0xe49f=function(_0xff8ca0,_0x31cfcc){_0xff8ca0=_0xff8ca0-0x0;var _0x3dcee8=_0x49fe[_0xff8ca0];return _0x3dcee8;};'use strict';var multer=require(_0xe49f('0x0'));var util=require(_0xe49f('0x1'));var path=require(_0xe49f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe49f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe49f('0x4'));var interaction=require(_0xe49f('0x5'));var config=require(_0xe49f('0x6'));var controller=require(_0xe49f('0x7'));router['get']('/',auth[_0xe49f('0x8')](),controller[_0xe49f('0x9')]);router[_0xe49f('0xa')](_0xe49f('0xb'),auth['isAuthenticated'](),controller[_0xe49f('0xc')]);router[_0xe49f('0xa')](_0xe49f('0xd'),auth[_0xe49f('0x8')](),controller[_0xe49f('0xe')]);router['get']('/:id',auth[_0xe49f('0x8')](),controller[_0xe49f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe49f('0x10')]);router[_0xe49f('0x11')](_0xe49f('0x12'),auth[_0xe49f('0x8')](),controller[_0xe49f('0x13')]);router[_0xe49f('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe49f('0x15')]);router[_0xe49f('0x16')](_0xe49f('0x17'),auth[_0xe49f('0x8')](),controller[_0xe49f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 23071f6..7f7fc88 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d8f=['INTEGER','STRING','moment','sequelize','exports'];(function(_0x3f4838,_0x9ce1f4){var _0x5d4f58=function(_0x516e03){while(--_0x516e03){_0x3f4838['push'](_0x3f4838['shift']());}};_0x5d4f58(++_0x9ce1f4);}(_0x2d8f,0x1ce));var _0xf2d8=function(_0x47f07d,_0x195757){_0x47f07d=_0x47f07d-0x0;var _0x3fbb32=_0x2d8f[_0x47f07d];return _0x3fbb32;};'use strict';var moment=require(_0xf2d8('0x0'));var Sequelize=require(_0xf2d8('0x1'));module[_0xf2d8('0x2')]={'CmHopperId':{'type':Sequelize[_0xf2d8('0x3')]},'phone':{'type':Sequelize[_0xf2d8('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xf2d8('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xf2d8('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf2d8('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf2d8('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xf2d8('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf2d8('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf2d8('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf2d8('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6c5a=['exports','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x764874,_0x3ed544){var _0x29f9d5=function(_0x152dad){while(--_0x152dad){_0x764874['push'](_0x764874['shift']());}};_0x29f9d5(++_0x3ed544);}(_0x6c5a,0x1d3));var _0xa6c5=function(_0x132535,_0x5200ab){_0x132535=_0x132535-0x0;var _0x11b068=_0x6c5a[_0x132535];return _0x11b068;};'use strict';var moment=require(_0xa6c5('0x0'));var Sequelize=require(_0xa6c5('0x1'));module[_0xa6c5('0x2')]={'CmHopperId':{'type':Sequelize[_0xa6c5('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa6c5('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa6c5('0x4')],'defaultValue':moment()[_0xa6c5('0x5')](_0xa6c5('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa6c5('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa6c5('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa6c5('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa6c5('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 52dec57..5640be6 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf113=['moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','merge','body','contact','message','agent','interaction','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','length','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch'];(function(_0x1602fd,_0x847115){var _0x1eaf42=function(_0x2e09f1){while(--_0x2e09f1){_0x1602fd['push'](_0x1602fd['shift']());}};_0x1eaf42(++_0x847115);}(_0xf113,0x1bf));var _0x3f11=function(_0x3e718a,_0x2f6618){_0x3e718a=_0x3e718a-0x0;var _0x2fbe4d=_0xf113[_0x3e718a];return _0x2fbe4d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f11('0x0'));var zipdir=require(_0x3f11('0x1'));var jsonpatch=require(_0x3f11('0x2'));var rp=require('request-promise');var moment=require(_0x3f11('0x3'));var BPromise=require(_0x3f11('0x4'));var Mustache=require(_0x3f11('0x5'));var util=require('util');var path=require(_0x3f11('0x6'));var sox=require('sox');var csv=require(_0x3f11('0x7'));var ejs=require(_0x3f11('0x8'));var fs=require('fs');var fs_extra=require(_0x3f11('0x9'));var _=require('lodash');var squel=require(_0x3f11('0xa'));var crypto=require(_0x3f11('0xb'));var jsforce=require(_0x3f11('0xc'));var deskjs=require(_0x3f11('0xd'));var toCsv=require(_0x3f11('0x7'));var querystring=require(_0x3f11('0xe'));var Papa=require(_0x3f11('0xf'));var Redis=require('ioredis');var authService=require(_0x3f11('0x10'));var qs=require(_0x3f11('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f11('0x12'));var logger=require('../../config/logger')(_0x3f11('0x13'));var utils=require('../../config/utils');var config=require(_0x3f11('0x14'));var licenseUtil=require(_0x3f11('0x15'));var db=require(_0x3f11('0x16'))['db'];function respondWithStatusCode(_0x430a8a,_0x40796e){_0x40796e=_0x40796e||0xcc;return function(_0x1535c0){if(_0x1535c0){return _0x430a8a[_0x3f11('0x17')](_0x40796e);}return _0x430a8a[_0x3f11('0x18')](_0x40796e)[_0x3f11('0x19')]();};}function respondWithResult(_0x343dc0,_0x55b3bc){_0x55b3bc=_0x55b3bc||0xc8;return function(_0x292972){if(_0x292972){return _0x343dc0[_0x3f11('0x18')](_0x55b3bc)[_0x3f11('0x1a')](_0x292972);}};}function respondWithFilteredResult(_0x4958a6,_0x60279e){return function(_0x5af675){if(_0x5af675){var _0x3a0f47=typeof _0x60279e['offset']===_0x3f11('0x1b')&&typeof _0x60279e['limit']===_0x3f11('0x1b');var _0x32256e=_0x5af675[_0x3f11('0x1c')];var _0x15d30c=_0x3a0f47?0x0:_0x60279e[_0x3f11('0x1d')];var _0x455b0f=_0x3a0f47?_0x5af675[_0x3f11('0x1c')]:_0x60279e[_0x3f11('0x1d')]+_0x60279e[_0x3f11('0x1e')];var _0x4c2d00;if(_0x455b0f>=_0x32256e){_0x455b0f=_0x32256e;_0x4c2d00=0xc8;}else{_0x4c2d00=0xce;}_0x4958a6['status'](_0x4c2d00);return _0x4958a6[_0x3f11('0x1f')](_0x3f11('0x20'),_0x15d30c+'-'+_0x455b0f+'/'+_0x32256e)[_0x3f11('0x1a')](_0x5af675);}return null;};}function patchUpdates(_0x26c10b){return function(_0x2b80bd){try{jsonpatch[_0x3f11('0x21')](_0x2b80bd,_0x26c10b,!![]);}catch(_0x4b4545){return BPromise[_0x3f11('0x22')](_0x4b4545);}return _0x2b80bd[_0x3f11('0x23')]();};}function saveUpdates(_0x4c0850,_0x3498bd){return function(_0x192a3a){if(_0x192a3a){return _0x192a3a[_0x3f11('0x24')](_0x4c0850)['then'](function(_0x283531){return _0x283531;});}return null;};}function removeEntity(_0x577f13,_0x263d2c){return function(_0x55a71f){if(_0x55a71f){return _0x55a71f[_0x3f11('0x25')]()[_0x3f11('0x26')](function(){var _0x54bd32=_0x55a71f['get']({'plain':!![]});var _0x2b2569=_0x3f11('0x27');return db[_0x3f11('0x28')][_0x3f11('0x25')]({'where':{'type':_0x2b2569,'resourceId':_0x54bd32['id']}})[_0x3f11('0x26')](function(){return _0x55a71f;});})[_0x3f11('0x26')](function(){_0x577f13[_0x3f11('0x18')](0xcc)[_0x3f11('0x19')]();});}};}function handleEntityNotFound(_0x4e746f,_0x4f2705){return function(_0x3afa9d){if(!_0x3afa9d){_0x4e746f[_0x3f11('0x17')](0x194);}return _0x3afa9d;};}function handleError(_0x451943,_0x3c3abb){_0x3c3abb=_0x3c3abb||0x1f4;return function(_0x570867){logger[_0x3f11('0x29')](_0x570867[_0x3f11('0x2a')]);if(_0x570867[_0x3f11('0x2b')]){delete _0x570867[_0x3f11('0x2b')];}_0x451943[_0x3f11('0x18')](_0x3c3abb)['send'](_0x570867);};}function getMustacheRender(_0x179d1e,_0x3479cd){return Mustache['render'](_0x179d1e,_[_0x3f11('0x2c')](_0x3479cd[_0x3f11('0x2d')],{'contact':_0x3479cd[_0x3f11('0x2e')],'message':_0x3479cd[_0x3f11('0x2f')],'agent':_0x3479cd[_0x3f11('0x30')],'interaction':_0x3479cd[_0x3f11('0x31')],'account':_0x3479cd['account']}))||'';}exports[_0x3f11('0x32')]=function(_0x2071e2,_0x42bad9){var _0x2d168f={},_0x47a67c={},_0x425dbb={'count':0x0,'rows':[]};var _0x411819=_[_0x3f11('0x33')](db[_0x3f11('0x34')][_0x3f11('0x35')],function(_0x50cf2b){return{'name':_0x50cf2b[_0x3f11('0x36')],'type':_0x50cf2b[_0x3f11('0x37')][_0x3f11('0x38')]};});_0x47a67c[_0x3f11('0x39')]=_[_0x3f11('0x33')](_0x411819,'name');_0x47a67c[_0x3f11('0x3a')]=_[_0x3f11('0x3b')](_0x2071e2[_0x3f11('0x3a')]);_0x47a67c[_0x3f11('0x3c')]=_[_0x3f11('0x3d')](_0x47a67c['model'],_0x47a67c[_0x3f11('0x3a')]);_0x2d168f['attributes']=_[_0x3f11('0x3d')](_0x47a67c[_0x3f11('0x39')],qs[_0x3f11('0x3e')](_0x2071e2[_0x3f11('0x3a')][_0x3f11('0x3e')]));_0x2d168f['attributes']=_0x2d168f['attributes']['length']?_0x2d168f[_0x3f11('0x3f')]:_0x47a67c[_0x3f11('0x39')];if(!_0x2071e2[_0x3f11('0x3a')][_0x3f11('0x40')](_0x3f11('0x41'))){_0x2d168f[_0x3f11('0x1e')]=qs[_0x3f11('0x1e')](_0x2071e2[_0x3f11('0x3a')]['limit']);_0x2d168f[_0x3f11('0x1d')]=qs['offset'](_0x2071e2[_0x3f11('0x3a')][_0x3f11('0x1d')]);}_0x2d168f[_0x3f11('0x42')]=qs[_0x3f11('0x43')](_0x2071e2[_0x3f11('0x3a')][_0x3f11('0x43')]);_0x2d168f[_0x3f11('0x44')]=qs['filters'](_[_0x3f11('0x45')](_0x2071e2[_0x3f11('0x3a')],_0x47a67c[_0x3f11('0x3c')]),_0x411819);if(_0x2071e2[_0x3f11('0x3a')]['filter']){_0x2d168f[_0x3f11('0x44')]=_[_0x3f11('0x2c')](_0x2d168f['where'],{'$or':_[_0x3f11('0x33')](_0x411819,function(_0x34ec7b){if(_0x34ec7b[_0x3f11('0x37')]!==_0x3f11('0x46')){var _0x233265={};_0x233265[_0x34ec7b[_0x3f11('0x2b')]]={'$like':'%'+_0x2071e2[_0x3f11('0x3a')][_0x3f11('0x47')]+'%'};return _0x233265;}})});}_0x2d168f=_[_0x3f11('0x2c')]({},_0x2d168f,_0x2071e2[_0x3f11('0x48')]);var _0x45d49c={'where':_0x2d168f[_0x3f11('0x44')]};return db[_0x3f11('0x34')][_0x3f11('0x1c')](_0x45d49c)[_0x3f11('0x26')](function(_0x2f6e65){_0x425dbb['count']=_0x2f6e65;if(_0x2071e2[_0x3f11('0x3a')][_0x3f11('0x49')]){_0x2d168f['include']=[{'all':!![]}];}return db[_0x3f11('0x34')][_0x3f11('0x4a')](_0x2d168f);})[_0x3f11('0x26')](function(_0x3083b0){_0x425dbb[_0x3f11('0x4b')]=_0x3083b0;return _0x425dbb;})[_0x3f11('0x26')](respondWithFilteredResult(_0x42bad9,_0x2d168f))['catch'](handleError(_0x42bad9,null));};exports[_0x3f11('0x4c')]=function(_0x1a47ec,_0x1f270b){var _0x179029={'raw':!![],'where':{'id':_0x1a47ec[_0x3f11('0x4d')]['id']}},_0x11dc92={};_0x11dc92[_0x3f11('0x39')]=_[_0x3f11('0x3b')](db[_0x3f11('0x34')][_0x3f11('0x35')]);_0x11dc92['query']=_[_0x3f11('0x3b')](_0x1a47ec['query']);_0x11dc92[_0x3f11('0x3c')]=_[_0x3f11('0x3d')](_0x11dc92[_0x3f11('0x39')],_0x11dc92['query']);_0x179029[_0x3f11('0x3f')]=_[_0x3f11('0x3d')](_0x11dc92[_0x3f11('0x39')],qs['fields'](_0x1a47ec[_0x3f11('0x3a')][_0x3f11('0x3e')]));_0x179029[_0x3f11('0x3f')]=_0x179029['attributes'][_0x3f11('0x4e')]?_0x179029['attributes']:_0x11dc92[_0x3f11('0x39')];if(_0x1a47ec[_0x3f11('0x3a')][_0x3f11('0x49')]){_0x179029['include']=[{'all':!![]}];}_0x179029=_[_0x3f11('0x2c')]({},_0x179029,_0x1a47ec[_0x3f11('0x48')]);return db[_0x3f11('0x34')][_0x3f11('0x4f')](_0x179029)[_0x3f11('0x26')](handleEntityNotFound(_0x1f270b,null))[_0x3f11('0x26')](respondWithResult(_0x1f270b,null))[_0x3f11('0x50')](handleError(_0x1f270b,null));};exports[_0x3f11('0x51')]=function(_0x3e3d02,_0x2e0b18){return db[_0x3f11('0x34')]['create'](_0x3e3d02[_0x3f11('0x2d')],{})['then'](function(_0x15fd7d){var _0x3faf59=_0x3e3d02[_0x3f11('0x52')][_0x3f11('0x53')]({'plain':!![]});if(!_0x3faf59)throw new Error(_0x3f11('0x54'));if(_0x3faf59[_0x3f11('0x55')]==='user'){var _0x57792b=_0x15fd7d[_0x3f11('0x53')]({'plain':!![]});var _0x6fa2bf=_0x3f11('0x27');return db[_0x3f11('0x56')][_0x3f11('0x4f')]({'where':{'name':_0x6fa2bf,'userProfileId':_0x3faf59[_0x3f11('0x57')]},'raw':!![]})[_0x3f11('0x26')](function(_0x41ffaf){if(_0x41ffaf&&_0x41ffaf[_0x3f11('0x58')]===0x0){return db[_0x3f11('0x28')][_0x3f11('0x51')]({'name':_0x57792b[_0x3f11('0x2b')],'resourceId':_0x57792b['id'],'type':_0x41ffaf[_0x3f11('0x2b')],'sectionId':_0x41ffaf['id']},{})['then'](function(){return _0x15fd7d;});}else{return _0x15fd7d;}})[_0x3f11('0x50')](function(_0x51901a){logger['error'](_0x3f11('0x59'),_0x51901a);throw _0x51901a;});}return _0x15fd7d;})[_0x3f11('0x26')](respondWithResult(_0x2e0b18,0xc9))['catch'](handleError(_0x2e0b18,null));};exports[_0x3f11('0x24')]=function(_0x3b058f,_0x1c81d0){if(_0x3b058f['body']['id']){delete _0x3b058f[_0x3f11('0x2d')]['id'];}return db[_0x3f11('0x34')][_0x3f11('0x4f')]({'where':{'id':_0x3b058f['params']['id']}})[_0x3f11('0x26')](handleEntityNotFound(_0x1c81d0,null))[_0x3f11('0x26')](saveUpdates(_0x3b058f[_0x3f11('0x2d')],null))[_0x3f11('0x26')](respondWithResult(_0x1c81d0,null))[_0x3f11('0x50')](handleError(_0x1c81d0,null));};exports[_0x3f11('0x25')]=function(_0x478a92,_0x37e442){return db['CmHopperAdditionalPhone'][_0x3f11('0x4f')]({'where':{'id':_0x478a92[_0x3f11('0x4d')]['id']}})[_0x3f11('0x26')](handleEntityNotFound(_0x37e442,null))[_0x3f11('0x26')](removeEntity(_0x37e442,null))[_0x3f11('0x50')](handleError(_0x37e442,null));}; \ No newline at end of file +var _0x086e=['status','end','json','offset','undefined','count','limit','set','apply','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','name','send','render','merge','body','contact','agent','account','index','map','CmHopperAdditionalPhone','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','includeAll','show','params','include','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x086e,0x17b));var _0xe086=function(_0x514816,_0x57c091){_0x514816=_0x514816-0x0;var _0x5c3a43=_0x086e[_0x514816];return _0x5c3a43;};'use strict';var emlformat=require(_0xe086('0x0'));var rimraf=require(_0xe086('0x1'));var zipdir=require(_0xe086('0x2'));var jsonpatch=require(_0xe086('0x3'));var rp=require('request-promise');var moment=require(_0xe086('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe086('0x5'));var path=require(_0xe086('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe086('0x7'));var _=require(_0xe086('0x8'));var squel=require(_0xe086('0x9'));var crypto=require(_0xe086('0xa'));var jsforce=require(_0xe086('0xb'));var deskjs=require(_0xe086('0xc'));var toCsv=require(_0xe086('0xd'));var querystring=require(_0xe086('0xe'));var Papa=require('papaparse');var Redis=require(_0xe086('0xf'));var authService=require(_0xe086('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe086('0x11'))(_0xe086('0x12'));var utils=require('../../config/utils');var config=require(_0xe086('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe086('0x14'))['db'];function respondWithStatusCode(_0x7d656a,_0x3ec552){_0x3ec552=_0x3ec552||0xcc;return function(_0x36b549){if(_0x36b549){return _0x7d656a['sendStatus'](_0x3ec552);}return _0x7d656a[_0xe086('0x15')](_0x3ec552)[_0xe086('0x16')]();};}function respondWithResult(_0x5082b4,_0x216652){_0x216652=_0x216652||0xc8;return function(_0x2d49db){if(_0x2d49db){return _0x5082b4['status'](_0x216652)[_0xe086('0x17')](_0x2d49db);}};}function respondWithFilteredResult(_0x5a69b3,_0x1cbc6d){return function(_0x57d199){if(_0x57d199){var _0x10001c=typeof _0x1cbc6d[_0xe086('0x18')]===_0xe086('0x19')&&typeof _0x1cbc6d['limit']===_0xe086('0x19');var _0x570618=_0x57d199[_0xe086('0x1a')];var _0x1f7827=_0x10001c?0x0:_0x1cbc6d[_0xe086('0x18')];var _0xc60bcd=_0x10001c?_0x57d199['count']:_0x1cbc6d[_0xe086('0x18')]+_0x1cbc6d[_0xe086('0x1b')];var _0x3a7d1e;if(_0xc60bcd>=_0x570618){_0xc60bcd=_0x570618;_0x3a7d1e=0xc8;}else{_0x3a7d1e=0xce;}_0x5a69b3[_0xe086('0x15')](_0x3a7d1e);return _0x5a69b3[_0xe086('0x1c')]('Content-Range',_0x1f7827+'-'+_0xc60bcd+'/'+_0x570618)[_0xe086('0x17')](_0x57d199);}return null;};}function patchUpdates(_0x488177){return function(_0x520127){try{jsonpatch[_0xe086('0x1d')](_0x520127,_0x488177,!![]);}catch(_0x111d28){return BPromise['reject'](_0x111d28);}return _0x520127['save']();};}function saveUpdates(_0x55b805,_0x1d93f8){return function(_0xbbf44a){if(_0xbbf44a){return _0xbbf44a[_0xe086('0x1e')](_0x55b805)[_0xe086('0x1f')](function(_0x5198eb){return _0x5198eb;});}return null;};}function removeEntity(_0x50fcfd,_0x1f8457){return function(_0x443f0b){if(_0x443f0b){return _0x443f0b[_0xe086('0x20')]()[_0xe086('0x1f')](function(){var _0x48e7e2=_0x443f0b[_0xe086('0x21')]({'plain':!![]});var _0x166f40=_0xe086('0x22');return db[_0xe086('0x23')][_0xe086('0x20')]({'where':{'type':_0x166f40,'resourceId':_0x48e7e2['id']}})[_0xe086('0x1f')](function(){return _0x443f0b;});})[_0xe086('0x1f')](function(){_0x50fcfd[_0xe086('0x15')](0xcc)[_0xe086('0x16')]();});}};}function handleEntityNotFound(_0x579472,_0x210510){return function(_0x5ac4f6){if(!_0x5ac4f6){_0x579472[_0xe086('0x24')](0x194);}return _0x5ac4f6;};}function handleError(_0x36b494,_0x154916){_0x154916=_0x154916||0x1f4;return function(_0x1eaca7){logger[_0xe086('0x25')](_0x1eaca7['stack']);if(_0x1eaca7[_0xe086('0x26')]){delete _0x1eaca7[_0xe086('0x26')];}_0x36b494[_0xe086('0x15')](_0x154916)[_0xe086('0x27')](_0x1eaca7);};}function getMustacheRender(_0x29c4b7,_0x5296c8){return Mustache[_0xe086('0x28')](_0x29c4b7,_[_0xe086('0x29')](_0x5296c8[_0xe086('0x2a')],{'contact':_0x5296c8[_0xe086('0x2b')],'message':_0x5296c8['message'],'agent':_0x5296c8[_0xe086('0x2c')],'interaction':_0x5296c8['interaction'],'account':_0x5296c8[_0xe086('0x2d')]}))||'';}exports[_0xe086('0x2e')]=function(_0x41cc9a,_0x526799){var _0xfc41e1={},_0x150a97={},_0x298eca={'count':0x0,'rows':[]};var _0x43537a=_[_0xe086('0x2f')](db[_0xe086('0x30')][_0xe086('0x31')],function(_0x40f38f){return{'name':_0x40f38f['fieldName'],'type':_0x40f38f['type']['key']};});_0x150a97[_0xe086('0x32')]=_[_0xe086('0x2f')](_0x43537a,_0xe086('0x26'));_0x150a97['query']=_[_0xe086('0x33')](_0x41cc9a[_0xe086('0x34')]);_0x150a97[_0xe086('0x35')]=_[_0xe086('0x36')](_0x150a97[_0xe086('0x32')],_0x150a97[_0xe086('0x34')]);_0xfc41e1[_0xe086('0x37')]=_[_0xe086('0x36')](_0x150a97[_0xe086('0x32')],qs[_0xe086('0x38')](_0x41cc9a[_0xe086('0x34')][_0xe086('0x38')]));_0xfc41e1[_0xe086('0x37')]=_0xfc41e1['attributes'][_0xe086('0x39')]?_0xfc41e1[_0xe086('0x37')]:_0x150a97[_0xe086('0x32')];if(!_0x41cc9a[_0xe086('0x34')][_0xe086('0x3a')](_0xe086('0x3b'))){_0xfc41e1[_0xe086('0x1b')]=qs[_0xe086('0x1b')](_0x41cc9a[_0xe086('0x34')][_0xe086('0x1b')]);_0xfc41e1[_0xe086('0x18')]=qs['offset'](_0x41cc9a[_0xe086('0x34')][_0xe086('0x18')]);}_0xfc41e1[_0xe086('0x3c')]=qs[_0xe086('0x3d')](_0x41cc9a['query'][_0xe086('0x3d')]);_0xfc41e1[_0xe086('0x3e')]=qs['filters'](_[_0xe086('0x3f')](_0x41cc9a[_0xe086('0x34')],_0x150a97[_0xe086('0x35')]),_0x43537a);if(_0x41cc9a[_0xe086('0x34')]['filter']){_0xfc41e1[_0xe086('0x3e')]=_[_0xe086('0x29')](_0xfc41e1[_0xe086('0x3e')],{'$or':_['map'](_0x43537a,function(_0x495139){if(_0x495139[_0xe086('0x40')]!==_0xe086('0x41')){var _0x20820b={};_0x20820b[_0x495139['name']]={'$like':'%'+_0x41cc9a['query'][_0xe086('0x42')]+'%'};return _0x20820b;}})});}_0xfc41e1=_[_0xe086('0x29')]({},_0xfc41e1,_0x41cc9a['options']);var _0x5faa51={'where':_0xfc41e1[_0xe086('0x3e')]};return db[_0xe086('0x30')][_0xe086('0x1a')](_0x5faa51)[_0xe086('0x1f')](function(_0x191ea7){_0x298eca['count']=_0x191ea7;if(_0x41cc9a['query'][_0xe086('0x43')]){_0xfc41e1['include']=[{'all':!![]}];}return db[_0xe086('0x30')]['findAll'](_0xfc41e1);})['then'](function(_0x1ebff0){_0x298eca['rows']=_0x1ebff0;return _0x298eca;})[_0xe086('0x1f')](respondWithFilteredResult(_0x526799,_0xfc41e1))['catch'](handleError(_0x526799,null));};exports[_0xe086('0x44')]=function(_0x25dff6,_0x1ab6d7){var _0xf7ccae={'raw':!![],'where':{'id':_0x25dff6[_0xe086('0x45')]['id']}},_0x2d1d1d={};_0x2d1d1d[_0xe086('0x32')]=_['keys'](db[_0xe086('0x30')][_0xe086('0x31')]);_0x2d1d1d[_0xe086('0x34')]=_['keys'](_0x25dff6['query']);_0x2d1d1d[_0xe086('0x35')]=_[_0xe086('0x36')](_0x2d1d1d[_0xe086('0x32')],_0x2d1d1d[_0xe086('0x34')]);_0xf7ccae[_0xe086('0x37')]=_[_0xe086('0x36')](_0x2d1d1d['model'],qs[_0xe086('0x38')](_0x25dff6[_0xe086('0x34')]['fields']));_0xf7ccae[_0xe086('0x37')]=_0xf7ccae['attributes'][_0xe086('0x39')]?_0xf7ccae[_0xe086('0x37')]:_0x2d1d1d[_0xe086('0x32')];if(_0x25dff6[_0xe086('0x34')]['includeAll']){_0xf7ccae[_0xe086('0x46')]=[{'all':!![]}];}_0xf7ccae=_[_0xe086('0x29')]({},_0xf7ccae,_0x25dff6[_0xe086('0x47')]);return db[_0xe086('0x30')][_0xe086('0x48')](_0xf7ccae)[_0xe086('0x1f')](handleEntityNotFound(_0x1ab6d7,null))[_0xe086('0x1f')](respondWithResult(_0x1ab6d7,null))[_0xe086('0x49')](handleError(_0x1ab6d7,null));};exports[_0xe086('0x4a')]=function(_0x28a992,_0x5943ce){return db[_0xe086('0x30')][_0xe086('0x4a')](_0x28a992[_0xe086('0x2a')],{})['then'](function(_0x2f0c8d){var _0x52d82d=_0x28a992['user']['get']({'plain':!![]});if(!_0x52d82d)throw new Error(_0xe086('0x4b'));if(_0x52d82d[_0xe086('0x4c')]==='user'){var _0x3ab8fb=_0x2f0c8d[_0xe086('0x21')]({'plain':!![]});var _0x215e92=_0xe086('0x22');return db[_0xe086('0x4d')][_0xe086('0x48')]({'where':{'name':_0x215e92,'userProfileId':_0x52d82d[_0xe086('0x4e')]},'raw':!![]})[_0xe086('0x1f')](function(_0x387c58){if(_0x387c58&&_0x387c58['autoAssociation']===0x0){return db[_0xe086('0x23')][_0xe086('0x4a')]({'name':_0x3ab8fb[_0xe086('0x26')],'resourceId':_0x3ab8fb['id'],'type':_0x387c58[_0xe086('0x26')],'sectionId':_0x387c58['id']},{})[_0xe086('0x1f')](function(){return _0x2f0c8d;});}else{return _0x2f0c8d;}})[_0xe086('0x49')](function(_0x123fbe){logger[_0xe086('0x25')](_0xe086('0x4f'),_0x123fbe);throw _0x123fbe;});}return _0x2f0c8d;})[_0xe086('0x1f')](respondWithResult(_0x5943ce,0xc9))[_0xe086('0x49')](handleError(_0x5943ce,null));};exports[_0xe086('0x1e')]=function(_0x49645d,_0x2febcd){if(_0x49645d[_0xe086('0x2a')]['id']){delete _0x49645d[_0xe086('0x2a')]['id'];}return db['CmHopperAdditionalPhone'][_0xe086('0x48')]({'where':{'id':_0x49645d[_0xe086('0x45')]['id']}})['then'](handleEntityNotFound(_0x2febcd,null))[_0xe086('0x1f')](saveUpdates(_0x49645d[_0xe086('0x2a')],null))['then'](respondWithResult(_0x2febcd,null))[_0xe086('0x49')](handleError(_0x2febcd,null));};exports[_0xe086('0x20')]=function(_0x1cd8ad,_0x591bb3){return db[_0xe086('0x30')][_0xe086('0x48')]({'where':{'id':_0x1cd8ad[_0xe086('0x45')]['id']}})[_0xe086('0x1f')](handleEntityNotFound(_0x591bb3,null))[_0xe086('0x1f')](removeEntity(_0x591bb3,null))['catch'](handleError(_0x591bb3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 604bc70..0e0bd03 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe84=['cm_hopper_additional_phones','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone'];(function(_0x56aa58,_0x3e05e6){var _0x1a2410=function(_0x3e49a8){while(--_0x3e49a8){_0x56aa58['push'](_0x56aa58['shift']());}};_0x1a2410(++_0x3e05e6);}(_0xbe84,0xd9));var _0x4be8=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xbe84[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x4be8('0x0'));var util=require(_0x4be8('0x1'));var logger=require(_0x4be8('0x2'))('api');var moment=require(_0x4be8('0x3'));var BPromise=require('bluebird');var rp=require(_0x4be8('0x4'));var fs=require('fs');var path=require(_0x4be8('0x5'));var rimraf=require(_0x4be8('0x6'));var config=require('../../config/environment');var attributes=require(_0x4be8('0x7'));module[_0x4be8('0x8')]=function(_0x1dbed4,_0x5b22cf){return _0x1dbed4[_0x4be8('0x9')](_0x4be8('0xa'),attributes,{'tableName':_0x4be8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5981=['moment','bluebird','request-promise','rimraf','cm_hopper_additional_phones','lodash','../../config/logger','api'];(function(_0x11aebd,_0xa0f46e){var _0x59c9e3=function(_0x4e8595){while(--_0x4e8595){_0x11aebd['push'](_0x11aebd['shift']());}};_0x59c9e3(++_0xa0f46e);}(_0x5981,0x1cd));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1598('0x0'));var util=require('util');var logger=require(_0x1598('0x1'))(_0x1598('0x2'));var moment=require(_0x1598('0x3'));var BPromise=require(_0x1598('0x4'));var rp=require(_0x1598('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1598('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0xf63bda,_0x2753b2){return _0xf63bda['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0x1598('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index e1100dd..6205ed8 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b59=['request\x20sent','debug','stringify','code','error','message','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','catch','SwapAdditionalPhones','duration','scheduledat','minutes','phone','isNil','add','createdAt','updatedAt','hopperToAdd','sequelize','transaction','update','field','IncrementPreviewCounters','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s'];(function(_0x38b2d9,_0x19fd42){var _0x23a3e1=function(_0xd8192f){while(--_0xd8192f){_0x38b2d9['push'](_0x38b2d9['shift']());}};_0x23a3e1(++_0x19fd42);}(_0x0b59,0x9f));var _0x90b5=function(_0x5a811d,_0x45c185){_0x5a811d=_0x5a811d-0x0;var _0xa640a5=_0x0b59[_0x5a811d];return _0xa640a5;};'use strict';var _=require(_0x90b5('0x0'));var util=require(_0x90b5('0x1'));var moment=require(_0x90b5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90b5('0x3'));var db=require(_0x90b5('0x4'))['db'];var utils=require(_0x90b5('0x5'));var logger=require(_0x90b5('0x6'))(_0x90b5('0x7'));var config=require(_0x90b5('0x8'));var jayson=require(_0x90b5('0x9'));var client=jayson[_0x90b5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3afa29,_0x1f704f,_0x486948){return new BPromise(function(_0xd920d8,_0x3ab913){return client[_0x90b5('0xb')](_0x3afa29,_0x486948)[_0x90b5('0xc')](function(_0x3bfbef){logger[_0x90b5('0xd')](_0x90b5('0xe'),_0x1f704f,_0x90b5('0xf'));logger[_0x90b5('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x1f704f,_0x90b5('0xf'),JSON[_0x90b5('0x11')](_0x3bfbef));if(_0x3bfbef['error']){if(_0x3bfbef['error'][_0x90b5('0x12')]===0x1f4){logger[_0x90b5('0x13')](_0x90b5('0xe'),_0x1f704f,_0x3bfbef[_0x90b5('0x13')][_0x90b5('0x14')]);return _0x3ab913(_0x3bfbef['error']['message']);}logger[_0x90b5('0x13')](_0x90b5('0xe'),_0x1f704f,_0x3bfbef[_0x90b5('0x13')][_0x90b5('0x14')]);return _0xd920d8(_0x3bfbef[_0x90b5('0x13')]['message']);}else{logger[_0x90b5('0xd')](_0x90b5('0xe'),_0x1f704f,_0x90b5('0xf'));_0xd920d8(_0x3bfbef['result'][_0x90b5('0x14')]);}})['catch'](function(_0x2e59e3){logger[_0x90b5('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1f704f,_0x2e59e3);_0x3ab913(_0x2e59e3);});});}exports[_0x90b5('0x15')]=function(_0x1a4a29){var _0x5efba2=this;return new Promise(function(_0x56ba38,_0x128151){return db[_0x90b5('0x16')][_0x90b5('0x17')]({'raw':!![],'where':{'ContactId':_0x1a4a29[_0x90b5('0x18')][_0x90b5('0x19')],'ListId':_0x1a4a29[_0x90b5('0x18')][_0x90b5('0x1a')],'VoiceQueueId':_0x1a4a29[_0x90b5('0x18')][_0x90b5('0x1b')]===undefined?null:_0x1a4a29['body']['VoiceQueueId'],'CampaignId':_0x1a4a29['body']['CampaignId']===undefined?null:_0x1a4a29['body'][_0x90b5('0x1c')]}})[_0x90b5('0xc')](function(_0x261e3f){if(_0x261e3f!=null){return db['CmHopperAdditionalPhone'][_0x90b5('0x17')]({'raw':!![],'where':{'CmHopperId':_0x261e3f['id'],'OrderBy':{'$gt':_0x261e3f[_0x90b5('0x1d')]}},'order':[['OrderBy',_0x90b5('0x1e')]]})[_0x90b5('0xc')](function(_0x51cb6a){var _0x1b7cb1=0x0;if(_0x51cb6a){if(_0x51cb6a[_0x90b5('0x1f')]+_0x51cb6a[_0x90b5('0x20')]+_0x51cb6a[_0x90b5('0x21')]+_0x51cb6a[_0x90b5('0x22')]+_0x51cb6a[_0x90b5('0x23')]+_0x51cb6a[_0x90b5('0x24')]+_0x51cb6a[_0x90b5('0x25')]+_0x51cb6a[_0x90b5('0x26')]<_0x1a4a29[_0x90b5('0x27')][_0x90b5('0x28')])_0x1b7cb1=0x1;_0x56ba38({'additional':_0x1b7cb1});}else{return db[_0x90b5('0x29')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x261e3f['id']},'order':[[_0x90b5('0x1d'),_0x90b5('0x1e')]]})['then'](function(_0x5a0dcd){var _0x59c92d=0x0;if(_0x5a0dcd){if(_0x5a0dcd[_0x90b5('0x1f')]+_0x5a0dcd[_0x90b5('0x20')]+_0x5a0dcd[_0x90b5('0x21')]+_0x5a0dcd[_0x90b5('0x22')]+_0x5a0dcd['countdropretry']+_0x5a0dcd['countabandonedretry']+_0x5a0dcd['countmachineretry']+_0x5a0dcd[_0x90b5('0x26')]<_0x1a4a29[_0x90b5('0x27')]['dialGlobalMaxRetry'])_0x59c92d=0x1;_0x56ba38({'additional':_0x59c92d});}else{_0x56ba38({'additional':0x0});}})['catch'](function(_0x37193f){logger[_0x90b5('0x13')](_0x90b5('0x15'),_0x37193f[_0x90b5('0x14')],_0x1a4a29);_0x128151(_0x5efba2['error'](0x1f4,_0x37193f[_0x90b5('0x14')]));});}})[_0x90b5('0x2a')](function(_0x42b2ec){logger[_0x90b5('0x13')]('VerifyAdditionalPhones',_0x42b2ec[_0x90b5('0x14')],_0x1a4a29);_0x128151(_0x5efba2[_0x90b5('0x13')](0x1f4,_0x42b2ec[_0x90b5('0x14')]));});}else _0x56ba38({'additional':0x0});});});};exports[_0x90b5('0x2b')]=function(_0x5ed152){var _0x38c215=this;return new Promise(function(_0x385b83,_0x5bbc5c){return db['CmHopper'][_0x90b5('0x17')]({'raw':!![],'where':{'ContactId':_0x5ed152['body'][_0x90b5('0x19')],'ListId':_0x5ed152[_0x90b5('0x18')][_0x90b5('0x1a')],'VoiceQueueId':_0x5ed152[_0x90b5('0x18')][_0x90b5('0x1b')]===undefined?null:_0x5ed152[_0x90b5('0x18')][_0x90b5('0x1b')],'CampaignId':_0x5ed152[_0x90b5('0x18')]['CampaignId']===undefined?null:_0x5ed152['body'][_0x90b5('0x1c')]}})[_0x90b5('0xc')](function(_0x20a8b3){if(_0x20a8b3!=null){return db[_0x90b5('0x29')][_0x90b5('0x17')]({'raw':!![],'where':{'CmHopperId':_0x20a8b3['id'],'OrderBy':{'$gt':_0x20a8b3[_0x90b5('0x1d')]}},'order':[[_0x90b5('0x1d'),'ASC']]})[_0x90b5('0xc')](function(_0x1ec16d){if(_0x1ec16d)return activateAdditionalPhone(_0x20a8b3,_0x5ed152[_0x90b5('0x18')],_0x1ec16d,_0x5ed152[_0x90b5('0x2c')],_0x5ed152['waitTime'])['then'](function(_0xbf1c18){_0x385b83(_0xbf1c18);});else{return db[_0x90b5('0x29')][_0x90b5('0x17')]({'raw':!![],'where':{'CmHopperId':_0x20a8b3['id']},'order':[['OrderBy',_0x90b5('0x1e')]]})[_0x90b5('0xc')](function(_0x1784f2){if(_0x1784f2)return activateAdditionalPhone(_0x20a8b3,_0x5ed152['body'],_0x1784f2,_0x5ed152['duration'],_0x5ed152['waitTime'])['then'](function(_0x4a85bb){_0x385b83(_0x4a85bb);});else{_0x385b83({'id':_0x20a8b3['id'],'phone':''});}})[_0x90b5('0x2a')](function(_0x2e5a26){logger[_0x90b5('0x13')]('VerifyAdditionalPhones',_0x2e5a26['message'],_0x5ed152);_0x5bbc5c(_0x38c215[_0x90b5('0x13')](0x1f4,_0x2e5a26[_0x90b5('0x14')]));});}})[_0x90b5('0x2a')](function(_0x3f6238){logger['error']('VerifyAdditionalPhones',_0x3f6238[_0x90b5('0x14')],_0x5ed152);_0x5bbc5c(_0x38c215[_0x90b5('0x13')](0x1f4,_0x3f6238[_0x90b5('0x14')]));});}else _0x385b83(0x1);});});};function activateAdditionalPhone(_0x9dd74b,_0x2c3da2,_0xb5356d,_0x6cd007,_0x3205a3){return new Promise(function(_0x96d000,_0x3ade8f){logger[_0x90b5('0xd')]('VerifyAdditionalPhones',_0xb5356d);var _0x405c8a;if(moment()>moment(_0xb5356d[_0x90b5('0x2d')])){_0x405c8a=moment()['add'](_0x3205a3||0x3,_0x90b5('0x2e'));}else{if(_0xb5356d[_0x90b5('0x1d')]==0x0){_0x405c8a=moment(_0xb5356d[_0x90b5('0x2d')]);}else{_0x405c8a=moment()['add'](_0x3205a3||0x3,_0x90b5('0x2e'));}}var _0x2e3d10={'phone':_0x9dd74b[_0x90b5('0x2f')],'active':0x0,'OrderBy':_[_0x90b5('0x30')](_0x9dd74b[_0x90b5('0x1d')])?0x0:_0x9dd74b['OrderBy'],'scheduledat':moment()[_0x90b5('0x31')](_0x6cd007||0x1,_0x90b5('0x2e')),'countbusyretry':_0x2c3da2['countbusyretry'],'countcongestionretry':_0x2c3da2[_0x90b5('0x20')],'countnoanswerretry':_0x2c3da2[_0x90b5('0x21')],'countnosuchnumberretry':_0x2c3da2['countnosuchnumberretry'],'countdropretry':_0x2c3da2[_0x90b5('0x23')],'countabandonedretry':_0x2c3da2[_0x90b5('0x24')],'countmachineretry':_0x2c3da2[_0x90b5('0x25')],'countagentrejectretry':_0x2c3da2['countagentrejectretry'],'createdAt':_0x2c3da2[_0x90b5('0x32')],'updatedAt':_0x2c3da2[_0x90b5('0x33')]};var _0x370fdc={'CmHopperId':_0x9dd74b['id'],'phone':_0xb5356d['phone'],'active':0x0,'OrderBy':_['isNil'](_0xb5356d[_0x90b5('0x1d')])?0x0:_0xb5356d[_0x90b5('0x1d')],'scheduledat':_0x405c8a,'countbusyretry':_0xb5356d[_0x90b5('0x1f')],'countcongestionretry':_0xb5356d[_0x90b5('0x20')],'countnoanswerretry':_0xb5356d['countnoanswerretry'],'countnosuchnumberretry':_0x2c3da2[_0x90b5('0x22')],'countdropretry':_0x2c3da2[_0x90b5('0x23')],'countabandonedretry':_0x2c3da2['countabandonedretry'],'countmachineretry':_0x2c3da2[_0x90b5('0x25')],'countagentrejectretry':_0x2c3da2[_0x90b5('0x26')],'createdAt':_0xb5356d[_0x90b5('0x32')],'updatedAt':_0xb5356d[_0x90b5('0x33')]};logger['info'](_0x90b5('0x34'),_0x2e3d10);logger['info']('additionalToHop',_0x370fdc);return db[_0x90b5('0x35')][_0x90b5('0x36')](function(_0x447db0){return db[_0x90b5('0x29')][_0x90b5('0x37')](_0x2e3d10,{'where':{'id':_0xb5356d['id']}},{'transaction':_0x447db0})[_0x90b5('0xc')](function(){return db[_0x90b5('0x16')][_0x90b5('0x37')](_0x370fdc,{'where':{'id':_0x9dd74b['id']}},{'transaction':_0x447db0});});})[_0x90b5('0xc')](function(_0x26eac7){_0x96d000({'id':_0x9dd74b['id'],'phone':_0xb5356d[_0x90b5('0x2f')]});})[_0x90b5('0x2a')](function(_0x67e8a5){logger[_0x90b5('0x13')](_0x90b5('0x15'),_0x67e8a5['message'],req);_0x3ade8f(_this['error'](0x1f4,_0x67e8a5[_0x90b5('0x14')]));});});}exports['IncrementPreviewCounters']=function(_0x5af162){var _0x452353=this;return new Promise(function(_0xd55313,_0x146a34){return db['CmHopper'][_0x90b5('0x37')](_0x5af162['body'][_0x90b5('0x38')],{'where':{'id':_0x5af162[_0x90b5('0x18')]['id']}})[_0x90b5('0xc')](function(_0x3593dc){_0xd55313(_0x3593dc);})[_0x90b5('0x2a')](function(_0x1c0cd6){logger['error'](_0x90b5('0x39'),_0x1c0cd6[_0x90b5('0x14')],_0x5af162);_0x146a34(_0x452353[_0x90b5('0x13')](0x1f4,_0x1c0cd6[_0x90b5('0x14')]));});});}; \ No newline at end of file +var _0xd1c2=['update','field','IncrementPreviewCounters','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countabandonedretry','SwapAdditionalPhones','waitTime','duration','scheduledat','add','minutes','phone','updatedAt','isNil','hopperToAdd','additionalToHop','sequelize','transaction'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0xd1c2,0x120));var _0x2d1c=function(_0x14c4ba,_0x288b5c){_0x14c4ba=_0x14c4ba-0x0;var _0x28bd15=_0xd1c2[_0x14c4ba];return _0x28bd15;};'use strict';var _=require('lodash');var util=require(_0x2d1c('0x0'));var moment=require(_0x2d1c('0x1'));var BPromise=require(_0x2d1c('0x2'));var rs=require(_0x2d1c('0x3'));var fs=require('fs');var Redis=require(_0x2d1c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d1c('0x5'));var logger=require(_0x2d1c('0x6'))(_0x2d1c('0x7'));var config=require('../../config/environment');var jayson=require(_0x2d1c('0x8'));var client=jayson['client'][_0x2d1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f27ac,_0x1bf439,_0x22d01e){return new BPromise(function(_0x214b76,_0xd75f72){return client['request'](_0x4f27ac,_0x22d01e)[_0x2d1c('0xa')](function(_0x44541b){logger[_0x2d1c('0xb')](_0x2d1c('0xc'),_0x1bf439,_0x2d1c('0xd'));logger[_0x2d1c('0xe')](_0x2d1c('0xf'),_0x1bf439,_0x2d1c('0xd'),JSON['stringify'](_0x44541b));if(_0x44541b[_0x2d1c('0x10')]){if(_0x44541b[_0x2d1c('0x10')][_0x2d1c('0x11')]===0x1f4){logger[_0x2d1c('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1bf439,_0x44541b[_0x2d1c('0x10')][_0x2d1c('0x12')]);return _0xd75f72(_0x44541b[_0x2d1c('0x10')][_0x2d1c('0x12')]);}logger[_0x2d1c('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1bf439,_0x44541b[_0x2d1c('0x10')][_0x2d1c('0x12')]);return _0x214b76(_0x44541b[_0x2d1c('0x10')][_0x2d1c('0x12')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1bf439,'request\x20sent');_0x214b76(_0x44541b['result'][_0x2d1c('0x12')]);}})[_0x2d1c('0x13')](function(_0x1b5e0d){logger[_0x2d1c('0x10')](_0x2d1c('0xc'),_0x1bf439,_0x1b5e0d);_0xd75f72(_0x1b5e0d);});});}exports[_0x2d1c('0x14')]=function(_0x4aa33d){var _0x3c9083=this;return new Promise(function(_0x38c440,_0x3770f3){return db[_0x2d1c('0x15')][_0x2d1c('0x16')]({'raw':!![],'where':{'ContactId':_0x4aa33d[_0x2d1c('0x17')][_0x2d1c('0x18')],'ListId':_0x4aa33d[_0x2d1c('0x17')][_0x2d1c('0x19')],'VoiceQueueId':_0x4aa33d[_0x2d1c('0x17')][_0x2d1c('0x1a')]===undefined?null:_0x4aa33d['body'][_0x2d1c('0x1a')],'CampaignId':_0x4aa33d['body'][_0x2d1c('0x1b')]===undefined?null:_0x4aa33d['body']['CampaignId']}})[_0x2d1c('0xa')](function(_0x74b6dc){if(_0x74b6dc!=null){return db[_0x2d1c('0x1c')][_0x2d1c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x74b6dc['id'],'OrderBy':{'$gt':_0x74b6dc[_0x2d1c('0x1d')]}},'order':[[_0x2d1c('0x1d'),_0x2d1c('0x1e')]]})[_0x2d1c('0xa')](function(_0x5bb7bc){var _0x5f4ce2=0x0;if(_0x5bb7bc){if(_0x5bb7bc[_0x2d1c('0x1f')]+_0x5bb7bc[_0x2d1c('0x20')]+_0x5bb7bc[_0x2d1c('0x21')]+_0x5bb7bc[_0x2d1c('0x22')]+_0x5bb7bc[_0x2d1c('0x23')]+_0x5bb7bc['countabandonedretry']+_0x5bb7bc[_0x2d1c('0x24')]+_0x5bb7bc[_0x2d1c('0x25')]<_0x4aa33d[_0x2d1c('0x26')][_0x2d1c('0x27')])_0x5f4ce2=0x1;_0x38c440({'additional':_0x5f4ce2});}else{return db[_0x2d1c('0x1c')][_0x2d1c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x74b6dc['id']},'order':[[_0x2d1c('0x1d'),'ASC']]})[_0x2d1c('0xa')](function(_0x560285){var _0x86a725=0x0;if(_0x560285){if(_0x560285[_0x2d1c('0x1f')]+_0x560285[_0x2d1c('0x20')]+_0x560285[_0x2d1c('0x21')]+_0x560285[_0x2d1c('0x22')]+_0x560285[_0x2d1c('0x23')]+_0x560285[_0x2d1c('0x28')]+_0x560285[_0x2d1c('0x24')]+_0x560285[_0x2d1c('0x25')]<_0x4aa33d['entity']['dialGlobalMaxRetry'])_0x86a725=0x1;_0x38c440({'additional':_0x86a725});}else{_0x38c440({'additional':0x0});}})[_0x2d1c('0x13')](function(_0x1f961d){logger[_0x2d1c('0x10')](_0x2d1c('0x14'),_0x1f961d[_0x2d1c('0x12')],_0x4aa33d);_0x3770f3(_0x3c9083[_0x2d1c('0x10')](0x1f4,_0x1f961d[_0x2d1c('0x12')]));});}})[_0x2d1c('0x13')](function(_0x82b56b){logger['error'](_0x2d1c('0x14'),_0x82b56b[_0x2d1c('0x12')],_0x4aa33d);_0x3770f3(_0x3c9083[_0x2d1c('0x10')](0x1f4,_0x82b56b[_0x2d1c('0x12')]));});}else _0x38c440({'additional':0x0});});});};exports[_0x2d1c('0x29')]=function(_0x13d11a){var _0x2dcd82=this;return new Promise(function(_0x42fd65,_0x5b910c){return db[_0x2d1c('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x13d11a['body'][_0x2d1c('0x18')],'ListId':_0x13d11a[_0x2d1c('0x17')][_0x2d1c('0x19')],'VoiceQueueId':_0x13d11a[_0x2d1c('0x17')][_0x2d1c('0x1a')]===undefined?null:_0x13d11a[_0x2d1c('0x17')]['VoiceQueueId'],'CampaignId':_0x13d11a[_0x2d1c('0x17')][_0x2d1c('0x1b')]===undefined?null:_0x13d11a[_0x2d1c('0x17')][_0x2d1c('0x1b')]}})[_0x2d1c('0xa')](function(_0x6f5da3){if(_0x6f5da3!=null){return db['CmHopperAdditionalPhone'][_0x2d1c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x6f5da3['id'],'OrderBy':{'$gt':_0x6f5da3[_0x2d1c('0x1d')]}},'order':[[_0x2d1c('0x1d'),_0x2d1c('0x1e')]]})[_0x2d1c('0xa')](function(_0x2d626a){if(_0x2d626a)return activateAdditionalPhone(_0x6f5da3,_0x13d11a[_0x2d1c('0x17')],_0x2d626a,_0x13d11a['duration'],_0x13d11a[_0x2d1c('0x2a')])[_0x2d1c('0xa')](function(_0x1df00b){_0x42fd65(_0x1df00b);});else{return db[_0x2d1c('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x6f5da3['id']},'order':[['OrderBy',_0x2d1c('0x1e')]]})[_0x2d1c('0xa')](function(_0xdc7c80){if(_0xdc7c80)return activateAdditionalPhone(_0x6f5da3,_0x13d11a[_0x2d1c('0x17')],_0xdc7c80,_0x13d11a[_0x2d1c('0x2b')],_0x13d11a[_0x2d1c('0x2a')])[_0x2d1c('0xa')](function(_0x4fba90){_0x42fd65(_0x4fba90);});else{_0x42fd65({'id':_0x6f5da3['id'],'phone':''});}})[_0x2d1c('0x13')](function(_0x523da0){logger[_0x2d1c('0x10')](_0x2d1c('0x14'),_0x523da0[_0x2d1c('0x12')],_0x13d11a);_0x5b910c(_0x2dcd82['error'](0x1f4,_0x523da0[_0x2d1c('0x12')]));});}})[_0x2d1c('0x13')](function(_0x10b575){logger['error'](_0x2d1c('0x14'),_0x10b575['message'],_0x13d11a);_0x5b910c(_0x2dcd82[_0x2d1c('0x10')](0x1f4,_0x10b575[_0x2d1c('0x12')]));});}else _0x42fd65(0x1);});});};function activateAdditionalPhone(_0x520c28,_0x2a1816,_0x2ffcf6,_0x5e21c3,_0x557d89){return new Promise(function(_0x3ecaa6,_0x5db15f){logger[_0x2d1c('0xb')]('VerifyAdditionalPhones',_0x2ffcf6);var _0x1aaf93;if(moment()>moment(_0x2ffcf6[_0x2d1c('0x2c')])){_0x1aaf93=moment()[_0x2d1c('0x2d')](_0x557d89||0x3,'minutes');}else{if(_0x2ffcf6[_0x2d1c('0x1d')]==0x0){_0x1aaf93=moment(_0x2ffcf6[_0x2d1c('0x2c')]);}else{_0x1aaf93=moment()[_0x2d1c('0x2d')](_0x557d89||0x3,_0x2d1c('0x2e'));}}var _0x1eb33b={'phone':_0x520c28[_0x2d1c('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x520c28[_0x2d1c('0x1d')])?0x0:_0x520c28[_0x2d1c('0x1d')],'scheduledat':moment()[_0x2d1c('0x2d')](_0x5e21c3||0x1,_0x2d1c('0x2e')),'countbusyretry':_0x2a1816[_0x2d1c('0x1f')],'countcongestionretry':_0x2a1816['countcongestionretry'],'countnoanswerretry':_0x2a1816['countnoanswerretry'],'countnosuchnumberretry':_0x2a1816[_0x2d1c('0x22')],'countdropretry':_0x2a1816[_0x2d1c('0x23')],'countabandonedretry':_0x2a1816[_0x2d1c('0x28')],'countmachineretry':_0x2a1816[_0x2d1c('0x24')],'countagentrejectretry':_0x2a1816[_0x2d1c('0x25')],'createdAt':_0x2a1816['createdAt'],'updatedAt':_0x2a1816[_0x2d1c('0x30')]};var _0x455cb7={'CmHopperId':_0x520c28['id'],'phone':_0x2ffcf6['phone'],'active':0x0,'OrderBy':_[_0x2d1c('0x31')](_0x2ffcf6['OrderBy'])?0x0:_0x2ffcf6[_0x2d1c('0x1d')],'scheduledat':_0x1aaf93,'countbusyretry':_0x2ffcf6['countbusyretry'],'countcongestionretry':_0x2ffcf6[_0x2d1c('0x20')],'countnoanswerretry':_0x2ffcf6[_0x2d1c('0x21')],'countnosuchnumberretry':_0x2a1816[_0x2d1c('0x22')],'countdropretry':_0x2a1816[_0x2d1c('0x23')],'countabandonedretry':_0x2a1816[_0x2d1c('0x28')],'countmachineretry':_0x2a1816[_0x2d1c('0x24')],'countagentrejectretry':_0x2a1816[_0x2d1c('0x25')],'createdAt':_0x2ffcf6['createdAt'],'updatedAt':_0x2ffcf6[_0x2d1c('0x30')]};logger[_0x2d1c('0xb')](_0x2d1c('0x32'),_0x1eb33b);logger[_0x2d1c('0xb')](_0x2d1c('0x33'),_0x455cb7);return db[_0x2d1c('0x34')][_0x2d1c('0x35')](function(_0x4ed4f7){return db['CmHopperAdditionalPhone'][_0x2d1c('0x36')](_0x1eb33b,{'where':{'id':_0x2ffcf6['id']}},{'transaction':_0x4ed4f7})[_0x2d1c('0xa')](function(){return db['CmHopper'][_0x2d1c('0x36')](_0x455cb7,{'where':{'id':_0x520c28['id']}},{'transaction':_0x4ed4f7});});})[_0x2d1c('0xa')](function(_0x59c283){_0x3ecaa6({'id':_0x520c28['id'],'phone':_0x2ffcf6['phone']});})['catch'](function(_0x21335b){logger['error'](_0x2d1c('0x14'),_0x21335b[_0x2d1c('0x12')],req);_0x5db15f(_this[_0x2d1c('0x10')](0x1f4,_0x21335b[_0x2d1c('0x12')]));});});}exports['IncrementPreviewCounters']=function(_0x2f9e70){var _0x1fce4c=this;return new Promise(function(_0x4a7f57,_0x2a43a5){return db[_0x2d1c('0x15')][_0x2d1c('0x36')](_0x2f9e70[_0x2d1c('0x17')][_0x2d1c('0x37')],{'where':{'id':_0x2f9e70[_0x2d1c('0x17')]['id']}})['then'](function(_0x63426c){_0x4a7f57(_0x63426c);})[_0x2d1c('0x13')](function(_0x1e76e4){logger[_0x2d1c('0x10')](_0x2d1c('0x38'),_0x1e76e4[_0x2d1c('0x12')],_0x2f9e70);_0x2a43a5(_0x1fce4c[_0x2d1c('0x10')](0x1f4,_0x1e76e4[_0x2d1c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 65ccd70..4a70542 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3210=['create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0xdec795,_0x2d9a5f){var _0x3876db=function(_0x28f886){while(--_0x28f886){_0xdec795['push'](_0xdec795['shift']());}};_0x3876db(++_0x2d9a5f);}(_0x3210,0x19e));var _0x0321=function(_0x2d8cb8,_0xb26907){_0x2d8cb8=_0x2d8cb8-0x0;var _0x3af62d=_0x3210[_0x2d8cb8];return _0x3af62d;};'use strict';var multer=require(_0x0321('0x0'));var util=require('util');var path=require(_0x0321('0x1'));var timeout=require(_0x0321('0x2'));var express=require('express');var router=express[_0x0321('0x3')]();var fs_extra=require(_0x0321('0x4'));var auth=require(_0x0321('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0321('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x0321('0x7')]('/',auth[_0x0321('0x8')](),controller[_0x0321('0x9')]);router[_0x0321('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0321('0xa')]);router['post']('/',auth[_0x0321('0x8')](),controller[_0x0321('0xb')]);router[_0x0321('0xc')](_0x0321('0xd'),auth[_0x0321('0x8')](),controller['update']);router[_0x0321('0xe')](_0x0321('0xd'),auth[_0x0321('0x8')](),controller[_0x0321('0xf')]);module[_0x0321('0x10')]=router; \ No newline at end of file +var _0x8b38=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','get','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x6f5e05,_0x63afb7){var _0x4b4fb4=function(_0x1efac3){while(--_0x1efac3){_0x6f5e05['push'](_0x6f5e05['shift']());}};_0x4b4fb4(++_0x63afb7);}(_0x8b38,0x18a));var _0x88b3=function(_0x378752,_0x158b32){_0x378752=_0x378752-0x0;var _0xd5a262=_0x8b38[_0x378752];return _0xd5a262;};'use strict';var multer=require(_0x88b3('0x0'));var util=require(_0x88b3('0x1'));var path=require('path');var timeout=require(_0x88b3('0x2'));var express=require(_0x88b3('0x3'));var router=express[_0x88b3('0x4')]();var fs_extra=require(_0x88b3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x88b3('0x6'));var config=require(_0x88b3('0x7'));var controller=require(_0x88b3('0x8'));router['get']('/',auth[_0x88b3('0x9')](),controller['index']);router[_0x88b3('0xa')]('/:id',auth[_0x88b3('0x9')](),controller['show']);router[_0x88b3('0xb')]('/',auth[_0x88b3('0x9')](),controller[_0x88b3('0xc')]);router[_0x88b3('0xd')](_0x88b3('0xe'),auth['isAuthenticated'](),controller[_0x88b3('0xf')]);router['delete'](_0x88b3('0xe'),auth[_0x88b3('0x9')](),controller[_0x88b3('0x10')]);module[_0x88b3('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3a1edb0..bd0d5d1 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 _0xfc45=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x140744,_0x5c0487){var _0x51588d=function(_0xb1bd40){while(--_0xb1bd40){_0x140744['push'](_0x140744['shift']());}};_0x51588d(++_0x5c0487);}(_0xfc45,0x71));var _0x5fc4=function(_0x2b1196,_0x257531){_0x2b1196=_0x2b1196-0x0;var _0x39b04c=_0xfc45[_0x2b1196];return _0x39b04c;};'use strict';var moment=require(_0x5fc4('0x0'));var Sequelize=require(_0x5fc4('0x1'));module[_0x5fc4('0x2')]={'phone':{'type':Sequelize[_0x5fc4('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5fc4('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x5fc4('0x4')],'unique':_0x5fc4('0x5')},'VoiceQueueId':{'type':Sequelize[_0x5fc4('0x4')],'unique':_0x5fc4('0x5')}}; \ No newline at end of file +var _0x533b=['moment','sequelize','exports','STRING','INTEGER'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x533b,0x96));var _0xb533=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x533b[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xb533('0x0'));var Sequelize=require(_0xb533('0x1'));module[_0xb533('0x2')]={'phone':{'type':Sequelize[_0xb533('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb533('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xb533('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 93cb857..9475b52 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 _0xf22d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','render','message','agent','map','CmHopperBlack','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4e0a4f,_0x58396f){var _0x1ec76b=function(_0x5ab7e4){while(--_0x5ab7e4){_0x4e0a4f['push'](_0x4e0a4f['shift']());}};_0x1ec76b(++_0x58396f);}(_0xf22d,0xdb));var _0xdf22=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xf22d[_0x3f2a90];return _0xb46279;};'use strict';var emlformat=require(_0xdf22('0x0'));var rimraf=require(_0xdf22('0x1'));var zipdir=require(_0xdf22('0x2'));var jsonpatch=require(_0xdf22('0x3'));var rp=require(_0xdf22('0x4'));var moment=require('moment');var BPromise=require(_0xdf22('0x5'));var Mustache=require(_0xdf22('0x6'));var util=require('util');var path=require(_0xdf22('0x7'));var sox=require(_0xdf22('0x8'));var csv=require('to-csv');var ejs=require(_0xdf22('0x9'));var fs=require('fs');var fs_extra=require(_0xdf22('0xa'));var _=require(_0xdf22('0xb'));var squel=require(_0xdf22('0xc'));var crypto=require('crypto');var jsforce=require(_0xdf22('0xd'));var deskjs=require(_0xdf22('0xe'));var toCsv=require(_0xdf22('0xf'));var querystring=require(_0xdf22('0x10'));var Papa=require(_0xdf22('0x11'));var Redis=require(_0xdf22('0x12'));var authService=require(_0xdf22('0x13'));var qs=require(_0xdf22('0x14'));var as=require(_0xdf22('0x15'));var hardwareService=require(_0xdf22('0x16'));var logger=require(_0xdf22('0x17'))(_0xdf22('0x18'));var utils=require(_0xdf22('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xdf22('0x1a'));var db=require(_0xdf22('0x1b'))['db'];function respondWithStatusCode(_0x5be6c3,_0x538641){_0x538641=_0x538641||0xcc;return function(_0x33834e){if(_0x33834e){return _0x5be6c3[_0xdf22('0x1c')](_0x538641);}return _0x5be6c3['status'](_0x538641)[_0xdf22('0x1d')]();};}function respondWithResult(_0x574a1f,_0x410e4e){_0x410e4e=_0x410e4e||0xc8;return function(_0x1de9c6){if(_0x1de9c6){return _0x574a1f['status'](_0x410e4e)[_0xdf22('0x1e')](_0x1de9c6);}};}function respondWithFilteredResult(_0x232a6f,_0xd9e1fc){return function(_0x51b5b4){if(_0x51b5b4){var _0x3552e0=typeof _0xd9e1fc['offset']==='undefined'&&typeof _0xd9e1fc[_0xdf22('0x1f')]===_0xdf22('0x20');var _0x42c904=_0x51b5b4[_0xdf22('0x21')];var _0x50993c=_0x3552e0?0x0:_0xd9e1fc[_0xdf22('0x22')];var _0x25e52a=_0x3552e0?_0x51b5b4[_0xdf22('0x21')]:_0xd9e1fc[_0xdf22('0x22')]+_0xd9e1fc['limit'];var _0x2bfccc;if(_0x25e52a>=_0x42c904){_0x25e52a=_0x42c904;_0x2bfccc=0xc8;}else{_0x2bfccc=0xce;}_0x232a6f[_0xdf22('0x23')](_0x2bfccc);return _0x232a6f[_0xdf22('0x24')](_0xdf22('0x25'),_0x50993c+'-'+_0x25e52a+'/'+_0x42c904)['json'](_0x51b5b4);}return null;};}function patchUpdates(_0x455203){return function(_0x54a0c0){try{jsonpatch[_0xdf22('0x26')](_0x54a0c0,_0x455203,!![]);}catch(_0x1fb7e2){return BPromise[_0xdf22('0x27')](_0x1fb7e2);}return _0x54a0c0[_0xdf22('0x28')]();};}function saveUpdates(_0x2ae45c,_0x5bb9b1){return function(_0x2678a6){if(_0x2678a6){return _0x2678a6[_0xdf22('0x29')](_0x2ae45c)[_0xdf22('0x2a')](function(_0x3a0093){return _0x3a0093;});}return null;};}function removeEntity(_0x3677ca,_0x1ff5a4){return function(_0x105b7d){if(_0x105b7d){return _0x105b7d['destroy']()[_0xdf22('0x2a')](function(){_0x3677ca[_0xdf22('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5efc82,_0x16b04e){return function(_0xc10746){if(!_0xc10746){_0x5efc82[_0xdf22('0x1c')](0x194);}return _0xc10746;};}function handleError(_0x7fdf66,_0xa48ff7){_0xa48ff7=_0xa48ff7||0x1f4;return function(_0x47f23e){logger[_0xdf22('0x2b')](_0x47f23e[_0xdf22('0x2c')]);if(_0x47f23e[_0xdf22('0x2d')]){delete _0x47f23e['name'];}_0x7fdf66[_0xdf22('0x23')](_0xa48ff7)['send'](_0x47f23e);};}function getMustacheRender(_0x48be57,_0xb1c4d1){return Mustache[_0xdf22('0x2e')](_0x48be57,_['merge'](_0xb1c4d1['body'],{'contact':_0xb1c4d1['contact'],'message':_0xb1c4d1[_0xdf22('0x2f')],'agent':_0xb1c4d1[_0xdf22('0x30')],'interaction':_0xb1c4d1['interaction'],'account':_0xb1c4d1['account']}))||'';}exports['index']=function(_0x41997c,_0x96ded1){var _0x1f5147={},_0x449866={},_0x1fd3f8={'count':0x0,'rows':[]};var _0x128241=_[_0xdf22('0x31')](db[_0xdf22('0x32')]['rawAttributes'],function(_0x373a33){return{'name':_0x373a33[_0xdf22('0x33')],'type':_0x373a33['type'][_0xdf22('0x34')]};});_0x449866[_0xdf22('0x35')]=_[_0xdf22('0x31')](_0x128241,_0xdf22('0x2d'));_0x449866[_0xdf22('0x36')]=_[_0xdf22('0x37')](_0x41997c[_0xdf22('0x36')]);_0x449866[_0xdf22('0x38')]=_[_0xdf22('0x39')](_0x449866[_0xdf22('0x35')],_0x449866[_0xdf22('0x36')]);_0x1f5147[_0xdf22('0x3a')]=_[_0xdf22('0x39')](_0x449866[_0xdf22('0x35')],qs[_0xdf22('0x3b')](_0x41997c[_0xdf22('0x36')][_0xdf22('0x3b')]));_0x1f5147['attributes']=_0x1f5147[_0xdf22('0x3a')][_0xdf22('0x3c')]?_0x1f5147['attributes']:_0x449866[_0xdf22('0x35')];if(!_0x41997c[_0xdf22('0x36')]['hasOwnProperty'](_0xdf22('0x3d'))){_0x1f5147[_0xdf22('0x1f')]=qs[_0xdf22('0x1f')](_0x41997c[_0xdf22('0x36')]['limit']);_0x1f5147['offset']=qs[_0xdf22('0x22')](_0x41997c[_0xdf22('0x36')]['offset']);}_0x1f5147['order']=qs['sort'](_0x41997c[_0xdf22('0x36')]['sort']);_0x1f5147['where']=qs[_0xdf22('0x38')](_[_0xdf22('0x3e')](_0x41997c[_0xdf22('0x36')],_0x449866['filters']),_0x128241);if(_0x41997c['query'][_0xdf22('0x3f')]){_0x1f5147['where']=_[_0xdf22('0x40')](_0x1f5147[_0xdf22('0x41')],{'$or':_['map'](_0x128241,function(_0x1e3786){if(_0x1e3786[_0xdf22('0x42')]!==_0xdf22('0x43')){var _0x3884d0={};_0x3884d0[_0x1e3786['name']]={'$like':'%'+_0x41997c[_0xdf22('0x36')][_0xdf22('0x3f')]+'%'};return _0x3884d0;}})});}_0x1f5147=_[_0xdf22('0x40')]({},_0x1f5147,_0x41997c[_0xdf22('0x44')]);var _0x2bcdf5={'where':_0x1f5147[_0xdf22('0x41')]};return db[_0xdf22('0x32')][_0xdf22('0x21')](_0x2bcdf5)[_0xdf22('0x2a')](function(_0x52bd0c){_0x1fd3f8[_0xdf22('0x21')]=_0x52bd0c;if(_0x41997c[_0xdf22('0x36')][_0xdf22('0x45')]){_0x1f5147[_0xdf22('0x46')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x1f5147);})['then'](function(_0x22d47d){_0x1fd3f8[_0xdf22('0x47')]=_0x22d47d;return _0x1fd3f8;})[_0xdf22('0x2a')](respondWithFilteredResult(_0x96ded1,_0x1f5147))[_0xdf22('0x48')](handleError(_0x96ded1,null));};exports[_0xdf22('0x49')]=function(_0x3cb120,_0x23bd7c){var _0x5ded5a={'raw':!![],'where':{'id':_0x3cb120[_0xdf22('0x4a')]['id']}},_0x200632={};_0x200632[_0xdf22('0x35')]=_[_0xdf22('0x37')](db[_0xdf22('0x32')][_0xdf22('0x4b')]);_0x200632[_0xdf22('0x36')]=_[_0xdf22('0x37')](_0x3cb120[_0xdf22('0x36')]);_0x200632[_0xdf22('0x38')]=_['intersection'](_0x200632['model'],_0x200632['query']);_0x5ded5a[_0xdf22('0x3a')]=_[_0xdf22('0x39')](_0x200632[_0xdf22('0x35')],qs[_0xdf22('0x3b')](_0x3cb120[_0xdf22('0x36')][_0xdf22('0x3b')]));_0x5ded5a[_0xdf22('0x3a')]=_0x5ded5a[_0xdf22('0x3a')]['length']?_0x5ded5a[_0xdf22('0x3a')]:_0x200632[_0xdf22('0x35')];if(_0x3cb120[_0xdf22('0x36')][_0xdf22('0x45')]){_0x5ded5a[_0xdf22('0x46')]=[{'all':!![]}];}_0x5ded5a=_[_0xdf22('0x40')]({},_0x5ded5a,_0x3cb120[_0xdf22('0x44')]);return db[_0xdf22('0x32')][_0xdf22('0x4c')](_0x5ded5a)['then'](handleEntityNotFound(_0x23bd7c,null))[_0xdf22('0x2a')](respondWithResult(_0x23bd7c,null))[_0xdf22('0x48')](handleError(_0x23bd7c,null));};exports['update']=function(_0x41b411,_0x414358){if(_0x41b411['body']['id']){delete _0x41b411['body']['id'];}return db['CmHopperBlack'][_0xdf22('0x4c')]({'where':{'id':_0x41b411[_0xdf22('0x4a')]['id']}})[_0xdf22('0x2a')](handleEntityNotFound(_0x414358,null))[_0xdf22('0x2a')](saveUpdates(_0x41b411[_0xdf22('0x4d')],null))['then'](respondWithResult(_0x414358,null))[_0xdf22('0x48')](handleError(_0x414358,null));};exports[_0xdf22('0x4e')]=function(_0x46f96d,_0x53275f){return db[_0xdf22('0x32')][_0xdf22('0x4c')]({'where':{'id':_0x46f96d[_0xdf22('0x4a')]['id']}})[_0xdf22('0x2a')](handleEntityNotFound(_0x53275f,null))['then'](removeEntity(_0x53275f,null))[_0xdf22('0x48')](handleError(_0x53275f,null));};exports[_0xdf22('0x4f')]=function(_0x4d4f98,_0x3d438d){return db['CmHopperBlack'][_0xdf22('0x4f')]()[_0xdf22('0x2a')](respondWithResult(_0x3d438d,null))[_0xdf22('0x48')](handleError(_0x3d438d,null));}; \ No newline at end of file +var _0x844f=['squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','render','merge','contact','message','interaction','map','CmHopperBlack','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','rows','catch','fields','find','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash'];(function(_0x315c0c,_0x3846e9){var _0x293d13=function(_0x47cf04){while(--_0x47cf04){_0x315c0c['push'](_0x315c0c['shift']());}};_0x293d13(++_0x3846e9);}(_0x844f,0xd3));var _0xf844=function(_0x5c5b4d,_0x3b4781){_0x5c5b4d=_0x5c5b4d-0x0;var _0x448a9e=_0x844f[_0x5c5b4d];return _0x448a9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf844('0x0'));var zipdir=require(_0xf844('0x1'));var jsonpatch=require(_0xf844('0x2'));var rp=require('request-promise');var moment=require(_0xf844('0x3'));var BPromise=require(_0xf844('0x4'));var Mustache=require(_0xf844('0x5'));var util=require(_0xf844('0x6'));var path=require(_0xf844('0x7'));var sox=require(_0xf844('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf844('0x9'));var _=require(_0xf844('0xa'));var squel=require(_0xf844('0xb'));var crypto=require(_0xf844('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf844('0xd'));var toCsv=require(_0xf844('0xe'));var querystring=require(_0xf844('0xf'));var Papa=require(_0xf844('0x10'));var Redis=require(_0xf844('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf844('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf844('0x13'));var utils=require(_0xf844('0x14'));var config=require(_0xf844('0x15'));var licenseUtil=require(_0xf844('0x16'));var db=require(_0xf844('0x17'))['db'];function respondWithStatusCode(_0x4d955d,_0x5bc95a){_0x5bc95a=_0x5bc95a||0xcc;return function(_0x473b7e){if(_0x473b7e){return _0x4d955d[_0xf844('0x18')](_0x5bc95a);}return _0x4d955d[_0xf844('0x19')](_0x5bc95a)[_0xf844('0x1a')]();};}function respondWithResult(_0x3f6f8e,_0x1b038f){_0x1b038f=_0x1b038f||0xc8;return function(_0x490308){if(_0x490308){return _0x3f6f8e['status'](_0x1b038f)[_0xf844('0x1b')](_0x490308);}};}function respondWithFilteredResult(_0x5c7749,_0x154123){return function(_0x292cec){if(_0x292cec){var _0x89edba=typeof _0x154123[_0xf844('0x1c')]===_0xf844('0x1d')&&typeof _0x154123[_0xf844('0x1e')]==='undefined';var _0x44db5c=_0x292cec['count'];var _0x2ad25e=_0x89edba?0x0:_0x154123[_0xf844('0x1c')];var _0x19d53f=_0x89edba?_0x292cec['count']:_0x154123[_0xf844('0x1c')]+_0x154123[_0xf844('0x1e')];var _0x197169;if(_0x19d53f>=_0x44db5c){_0x19d53f=_0x44db5c;_0x197169=0xc8;}else{_0x197169=0xce;}_0x5c7749[_0xf844('0x19')](_0x197169);return _0x5c7749['set'](_0xf844('0x1f'),_0x2ad25e+'-'+_0x19d53f+'/'+_0x44db5c)[_0xf844('0x1b')](_0x292cec);}return null;};}function patchUpdates(_0x15d3ba){return function(_0x5e9ed9){try{jsonpatch[_0xf844('0x20')](_0x5e9ed9,_0x15d3ba,!![]);}catch(_0x28da7c){return BPromise[_0xf844('0x21')](_0x28da7c);}return _0x5e9ed9[_0xf844('0x22')]();};}function saveUpdates(_0x1c444a,_0x2b7f3e){return function(_0xf9c932){if(_0xf9c932){return _0xf9c932[_0xf844('0x23')](_0x1c444a)[_0xf844('0x24')](function(_0x1e97b2){return _0x1e97b2;});}return null;};}function removeEntity(_0x16e62f,_0x177b45){return function(_0x3dd616){if(_0x3dd616){return _0x3dd616[_0xf844('0x25')]()[_0xf844('0x24')](function(){_0x16e62f[_0xf844('0x19')](0xcc)[_0xf844('0x1a')]();});}};}function handleEntityNotFound(_0xafe6ff,_0x46ad6b){return function(_0x5d7dc9){if(!_0x5d7dc9){_0xafe6ff['sendStatus'](0x194);}return _0x5d7dc9;};}function handleError(_0x1fc2da,_0x69c224){_0x69c224=_0x69c224||0x1f4;return function(_0x5ee5f0){logger[_0xf844('0x26')](_0x5ee5f0['stack']);if(_0x5ee5f0[_0xf844('0x27')]){delete _0x5ee5f0['name'];}_0x1fc2da[_0xf844('0x19')](_0x69c224)['send'](_0x5ee5f0);};}function getMustacheRender(_0x33c28f,_0x496207){return Mustache[_0xf844('0x28')](_0x33c28f,_[_0xf844('0x29')](_0x496207['body'],{'contact':_0x496207[_0xf844('0x2a')],'message':_0x496207[_0xf844('0x2b')],'agent':_0x496207['agent'],'interaction':_0x496207[_0xf844('0x2c')],'account':_0x496207['account']}))||'';}exports['index']=function(_0x3d6773,_0x424510){var _0x26e7d8={},_0xc5aaf0={},_0xe3310={'count':0x0,'rows':[]};var _0x46e53d=_[_0xf844('0x2d')](db[_0xf844('0x2e')][_0xf844('0x2f')],function(_0x10d862){return{'name':_0x10d862['fieldName'],'type':_0x10d862[_0xf844('0x30')][_0xf844('0x31')]};});_0xc5aaf0[_0xf844('0x32')]=_[_0xf844('0x2d')](_0x46e53d,_0xf844('0x27'));_0xc5aaf0[_0xf844('0x33')]=_[_0xf844('0x34')](_0x3d6773[_0xf844('0x33')]);_0xc5aaf0[_0xf844('0x35')]=_[_0xf844('0x36')](_0xc5aaf0[_0xf844('0x32')],_0xc5aaf0[_0xf844('0x33')]);_0x26e7d8[_0xf844('0x37')]=_[_0xf844('0x36')](_0xc5aaf0[_0xf844('0x32')],qs['fields'](_0x3d6773['query']['fields']));_0x26e7d8[_0xf844('0x37')]=_0x26e7d8[_0xf844('0x37')]['length']?_0x26e7d8['attributes']:_0xc5aaf0[_0xf844('0x32')];if(!_0x3d6773[_0xf844('0x33')][_0xf844('0x38')](_0xf844('0x39'))){_0x26e7d8[_0xf844('0x1e')]=qs[_0xf844('0x1e')](_0x3d6773[_0xf844('0x33')]['limit']);_0x26e7d8['offset']=qs['offset'](_0x3d6773[_0xf844('0x33')][_0xf844('0x1c')]);}_0x26e7d8[_0xf844('0x3a')]=qs[_0xf844('0x3b')](_0x3d6773[_0xf844('0x33')][_0xf844('0x3b')]);_0x26e7d8['where']=qs[_0xf844('0x35')](_[_0xf844('0x3c')](_0x3d6773[_0xf844('0x33')],_0xc5aaf0['filters']),_0x46e53d);if(_0x3d6773[_0xf844('0x33')][_0xf844('0x3d')]){_0x26e7d8[_0xf844('0x3e')]=_[_0xf844('0x29')](_0x26e7d8[_0xf844('0x3e')],{'$or':_['map'](_0x46e53d,function(_0x2b725e){if(_0x2b725e[_0xf844('0x30')]!==_0xf844('0x3f')){var _0x3514ea={};_0x3514ea[_0x2b725e[_0xf844('0x27')]]={'$like':'%'+_0x3d6773[_0xf844('0x33')]['filter']+'%'};return _0x3514ea;}})});}_0x26e7d8=_[_0xf844('0x29')]({},_0x26e7d8,_0x3d6773[_0xf844('0x40')]);var _0x139af0={'where':_0x26e7d8[_0xf844('0x3e')]};return db['CmHopperBlack']['count'](_0x139af0)['then'](function(_0x289fa2){_0xe3310[_0xf844('0x41')]=_0x289fa2;if(_0x3d6773['query'][_0xf844('0x42')]){_0x26e7d8[_0xf844('0x43')]=[{'all':!![]}];}return db[_0xf844('0x2e')]['findAll'](_0x26e7d8);})[_0xf844('0x24')](function(_0x7ace5a){_0xe3310[_0xf844('0x44')]=_0x7ace5a;return _0xe3310;})['then'](respondWithFilteredResult(_0x424510,_0x26e7d8))[_0xf844('0x45')](handleError(_0x424510,null));};exports['show']=function(_0x407587,_0x2abd26){var _0x14e297={'raw':!![],'where':{'id':_0x407587['params']['id']}},_0x28400f={};_0x28400f[_0xf844('0x32')]=_[_0xf844('0x34')](db[_0xf844('0x2e')][_0xf844('0x2f')]);_0x28400f[_0xf844('0x33')]=_[_0xf844('0x34')](_0x407587['query']);_0x28400f[_0xf844('0x35')]=_['intersection'](_0x28400f['model'],_0x28400f[_0xf844('0x33')]);_0x14e297[_0xf844('0x37')]=_[_0xf844('0x36')](_0x28400f[_0xf844('0x32')],qs[_0xf844('0x46')](_0x407587[_0xf844('0x33')]['fields']));_0x14e297[_0xf844('0x37')]=_0x14e297[_0xf844('0x37')]['length']?_0x14e297[_0xf844('0x37')]:_0x28400f[_0xf844('0x32')];if(_0x407587[_0xf844('0x33')][_0xf844('0x42')]){_0x14e297[_0xf844('0x43')]=[{'all':!![]}];}_0x14e297=_[_0xf844('0x29')]({},_0x14e297,_0x407587[_0xf844('0x40')]);return db[_0xf844('0x2e')][_0xf844('0x47')](_0x14e297)['then'](handleEntityNotFound(_0x2abd26,null))[_0xf844('0x24')](respondWithResult(_0x2abd26,null))[_0xf844('0x45')](handleError(_0x2abd26,null));};exports['update']=function(_0x210427,_0x12c259){if(_0x210427[_0xf844('0x48')]['id']){delete _0x210427[_0xf844('0x48')]['id'];}return db[_0xf844('0x2e')][_0xf844('0x47')]({'where':{'id':_0x210427['params']['id']}})[_0xf844('0x24')](handleEntityNotFound(_0x12c259,null))[_0xf844('0x24')](saveUpdates(_0x210427[_0xf844('0x48')],null))[_0xf844('0x24')](respondWithResult(_0x12c259,null))['catch'](handleError(_0x12c259,null));};exports[_0xf844('0x25')]=function(_0x2a4566,_0x257884){return db[_0xf844('0x2e')][_0xf844('0x47')]({'where':{'id':_0x2a4566['params']['id']}})[_0xf844('0x24')](handleEntityNotFound(_0x257884,null))[_0xf844('0x24')](removeEntity(_0x257884,null))['catch'](handleError(_0x257884,null));};exports[_0xf844('0x49')]=function(_0x56a1e5,_0x5c1b74){return db[_0xf844('0x2e')][_0xf844('0x49')]()[_0xf844('0x24')](respondWithResult(_0x5c1b74,null))[_0xf844('0x45')](handleError(_0x5c1b74,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 85504d9..0f2dcaf 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 _0x25ed=['rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','lodash','util','../../config/logger','bluebird'];(function(_0x1a3c6a,_0x241d1e){var _0x325ae5=function(_0x452a8e){while(--_0x452a8e){_0x1a3c6a['push'](_0x1a3c6a['shift']());}};_0x325ae5(++_0x241d1e);}(_0x25ed,0xc4));var _0xd25e=function(_0x424ebf,_0x4c64d3){_0x424ebf=_0x424ebf-0x0;var _0x4c6aef=_0x25ed[_0x424ebf];return _0x4c6aef;};'use strict';var _=require(_0xd25e('0x0'));var util=require(_0xd25e('0x1'));var logger=require(_0xd25e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd25e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd25e('0x4'));var config=require('../../config/environment');var attributes=require(_0xd25e('0x5'));module[_0xd25e('0x6')]=function(_0x9b00d6,_0x14e6a7){return _0x9b00d6['define'](_0xd25e('0x7'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76f6=['cm_hopper_black','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','define','CmHopperBlack'];(function(_0x29e398,_0x890225){var _0xd799e2=function(_0x4fcf2f){while(--_0x4fcf2f){_0x29e398['push'](_0x29e398['shift']());}};_0xd799e2(++_0x890225);}(_0x76f6,0x12a));var _0x676f=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x76f6[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x676f('0x0'));var util=require('util');var logger=require(_0x676f('0x1'))(_0x676f('0x2'));var moment=require('moment');var BPromise=require(_0x676f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x676f('0x4'));var config=require(_0x676f('0x5'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x136991,_0x426fed){return _0x136991[_0x676f('0x6')](_0x676f('0x7'),attributes,{'tableName':_0x676f('0x8'),'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 c923b8e..7d3a82d 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 _0x60db=['CmHopperBlack','findAll','options','raw','where','limit','include','map','attributes','model','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetCmHopperBlack'];(function(_0x57bb3a,_0x237ede){var _0x5decaa=function(_0x262a8f){while(--_0x262a8f){_0x57bb3a['push'](_0x57bb3a['shift']());}};_0x5decaa(++_0x237ede);}(_0x60db,0x110));var _0xb60d=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x60db[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0xb60d('0x0'));var util=require(_0xb60d('0x1'));var moment=require(_0xb60d('0x2'));var BPromise=require('bluebird');var rs=require(_0xb60d('0x3'));var fs=require('fs');var Redis=require(_0xb60d('0x4'));var db=require(_0xb60d('0x5'))['db'];var utils=require(_0xb60d('0x6'));var logger=require(_0xb60d('0x7'))(_0xb60d('0x8'));var config=require('../../config/environment');var jayson=require(_0xb60d('0x9'));var client=jayson[_0xb60d('0xa')][_0xb60d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38c026,_0x58938b,_0x1f5deb){return new BPromise(function(_0x24a560,_0x326e18){return client['request'](_0x38c026,_0x1f5deb)[_0xb60d('0xc')](function(_0x191773){logger[_0xb60d('0xd')](_0xb60d('0xe'),_0x58938b,'request\x20sent');logger[_0xb60d('0xf')](_0xb60d('0x10'),_0x58938b,_0xb60d('0x11'),JSON[_0xb60d('0x12')](_0x191773));if(_0x191773[_0xb60d('0x13')]){if(_0x191773[_0xb60d('0x13')]['code']===0x1f4){logger[_0xb60d('0x13')](_0xb60d('0xe'),_0x58938b,_0x191773['error'][_0xb60d('0x14')]);return _0x326e18(_0x191773['error'][_0xb60d('0x14')]);}logger[_0xb60d('0x13')](_0xb60d('0xe'),_0x58938b,_0x191773[_0xb60d('0x13')][_0xb60d('0x14')]);return _0x24a560(_0x191773['error'][_0xb60d('0x14')]);}else{logger[_0xb60d('0xd')](_0xb60d('0xe'),_0x58938b,_0xb60d('0x11'));_0x24a560(_0x191773[_0xb60d('0x15')]['message']);}})[_0xb60d('0x16')](function(_0x154136){logger[_0xb60d('0x13')](_0xb60d('0xe'),_0x58938b,_0x154136);_0x326e18(_0x154136);});});}exports[_0xb60d('0x17')]=function(_0x5b2bb5){var _0x169140=this;return new Promise(function(_0x4c2bc4,_0x56ac7f){return db[_0xb60d('0x18')][_0xb60d('0x19')]({'raw':_0x5b2bb5[_0xb60d('0x1a')]?_0x5b2bb5[_0xb60d('0x1a')][_0xb60d('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b2bb5['options']?_0x5b2bb5[_0xb60d('0x1a')][_0xb60d('0x1c')]||null:null,'attributes':_0x5b2bb5[_0xb60d('0x1a')]?_0x5b2bb5[_0xb60d('0x1a')]['attributes']||null:null,'limit':_0x5b2bb5['options']?_0x5b2bb5['options'][_0xb60d('0x1d')]||null:null,'include':_0x5b2bb5[_0xb60d('0x1a')]?_0x5b2bb5[_0xb60d('0x1a')][_0xb60d('0x1e')]?_[_0xb60d('0x1f')](_0x5b2bb5['options'][_0xb60d('0x1e')],function(_0x293d14){return{'model':db[_0x293d14['model']],'as':_0x293d14['as'],'attributes':_0x293d14[_0xb60d('0x20')],'include':_0x293d14[_0xb60d('0x1e')]?_[_0xb60d('0x1f')](_0x293d14[_0xb60d('0x1e')],function(_0x2ac9d4){return{'model':db[_0x2ac9d4[_0xb60d('0x21')]],'as':_0x2ac9d4['as'],'attributes':_0x2ac9d4['attributes'],'include':_0x2ac9d4[_0xb60d('0x1e')]?_[_0xb60d('0x1f')](_0x2ac9d4[_0xb60d('0x1e')],function(_0x2ce2e6){return{'model':db[_0x2ce2e6[_0xb60d('0x21')]],'as':_0x2ce2e6['as'],'attributes':_0x2ce2e6[_0xb60d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ee805){logger[_0xb60d('0xd')](_0xb60d('0x17'),_0x5b2bb5);logger[_0xb60d('0xf')](_0xb60d('0x17'),_0x5b2bb5,JSON[_0xb60d('0x12')](_0x3ee805));_0x4c2bc4(_0x3ee805);})[_0xb60d('0x16')](function(_0x19ae82){logger[_0xb60d('0x13')](_0xb60d('0x17'),_0x19ae82[_0xb60d('0x14')],_0x5b2bb5);_0x56ac7f(_0x169140['error'](0x1f4,_0x19ae82[_0xb60d('0x14')]));});});};exports[_0xb60d('0x22')]=function(_0x965b2){var _0x18bddb=this;return new Promise(function(_0x219b1f,_0xe87f2f){return db[_0xb60d('0x18')]['update'](_0x965b2['body'],{'raw':_0x965b2[_0xb60d('0x1a')]?_0x965b2[_0xb60d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x965b2[_0xb60d('0x1a')]?_0x965b2[_0xb60d('0x1a')]['where']||null:null,'attributes':_0x965b2[_0xb60d('0x1a')]?_0x965b2[_0xb60d('0x1a')][_0xb60d('0x20')]||null:null,'limit':_0x965b2['options']?_0x965b2[_0xb60d('0x1a')]['limit']||null:null})[_0xb60d('0xc')](function(_0x4e41f4){logger[_0xb60d('0xd')](_0xb60d('0x22'),_0x965b2);logger['debug']('UpdateCmHopperBlack',_0x965b2,JSON[_0xb60d('0x12')](_0x4e41f4));_0x219b1f(_0x4e41f4);})[_0xb60d('0x16')](function(_0x4663f8){logger[_0xb60d('0x13')]('UpdateCmHopperBlack',_0x4663f8['message'],_0x965b2);_0xe87f2f(_0x18bddb[_0xb60d('0x13')](0x1f4,_0x4663f8[_0xb60d('0x14')]));});});};exports[_0xb60d('0x23')]=function(_0x1906cf){var _0x248e62=this;return new Promise(function(_0x461b97,_0x3773c9){return db[_0xb60d('0x18')][_0xb60d('0x24')]({'where':_0x1906cf[_0xb60d('0x1a')]?_0x1906cf[_0xb60d('0x1a')][_0xb60d('0x1c')]||null:null})[_0xb60d('0xc')](function(_0x2cd961){logger[_0xb60d('0xd')](_0xb60d('0x23'),_0x1906cf);logger[_0xb60d('0xf')](_0xb60d('0x23'),_0x1906cf,JSON[_0xb60d('0x12')](_0x2cd961));_0x461b97(_0x2cd961);})[_0xb60d('0x16')](function(_0xc1d7c3){logger[_0xb60d('0x13')](_0xb60d('0x23'),_0xc1d7c3[_0xb60d('0x14')],_0x1906cf);_0x3773c9(_0x248e62['error'](0x1f4,_0xc1d7c3[_0xb60d('0x14')]));});});}; \ No newline at end of file +var _0x8c3f=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','map','include','model','UpdateCmHopperBlack','CmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x8c3f,0x189));var _0xf8c3=function(_0x2946aa,_0x4c8fb0){_0x2946aa=_0x2946aa-0x0;var _0x2e8079=_0x8c3f[_0x2946aa];return _0x2e8079;};'use strict';var _=require(_0xf8c3('0x0'));var util=require(_0xf8c3('0x1'));var moment=require(_0xf8c3('0x2'));var BPromise=require(_0xf8c3('0x3'));var rs=require(_0xf8c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8c3('0x5'))['db'];var utils=require(_0xf8c3('0x6'));var logger=require(_0xf8c3('0x7'))(_0xf8c3('0x8'));var config=require('../../config/environment');var jayson=require(_0xf8c3('0x9'));var client=jayson[_0xf8c3('0xa')][_0xf8c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x298695,_0x2456f8,_0x5777b8){return new BPromise(function(_0x2b6c9b,_0x58eb93){return client[_0xf8c3('0xc')](_0x298695,_0x5777b8)[_0xf8c3('0xd')](function(_0x2f49a7){logger[_0xf8c3('0xe')](_0xf8c3('0xf'),_0x2456f8,_0xf8c3('0x10'));logger[_0xf8c3('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2456f8,_0xf8c3('0x10'),JSON[_0xf8c3('0x12')](_0x2f49a7));if(_0x2f49a7[_0xf8c3('0x13')]){if(_0x2f49a7[_0xf8c3('0x13')][_0xf8c3('0x14')]===0x1f4){logger['error'](_0xf8c3('0xf'),_0x2456f8,_0x2f49a7[_0xf8c3('0x13')][_0xf8c3('0x15')]);return _0x58eb93(_0x2f49a7[_0xf8c3('0x13')][_0xf8c3('0x15')]);}logger['error'](_0xf8c3('0xf'),_0x2456f8,_0x2f49a7[_0xf8c3('0x13')]['message']);return _0x2b6c9b(_0x2f49a7[_0xf8c3('0x13')][_0xf8c3('0x15')]);}else{logger['info'](_0xf8c3('0xf'),_0x2456f8,'request\x20sent');_0x2b6c9b(_0x2f49a7['result'][_0xf8c3('0x15')]);}})[_0xf8c3('0x16')](function(_0x11dff1){logger[_0xf8c3('0x13')](_0xf8c3('0xf'),_0x2456f8,_0x11dff1);_0x58eb93(_0x11dff1);});});}exports[_0xf8c3('0x17')]=function(_0x10abc4){var _0x23b72d=this;return new Promise(function(_0x448837,_0x34c853){return db['CmHopperBlack'][_0xf8c3('0x18')]({'raw':_0x10abc4[_0xf8c3('0x19')]?_0x10abc4[_0xf8c3('0x19')][_0xf8c3('0x1a')]===undefined?!![]:![]:!![],'where':_0x10abc4[_0xf8c3('0x19')]?_0x10abc4[_0xf8c3('0x19')][_0xf8c3('0x1b')]||null:null,'attributes':_0x10abc4[_0xf8c3('0x19')]?_0x10abc4[_0xf8c3('0x19')][_0xf8c3('0x1c')]||null:null,'limit':_0x10abc4['options']?_0x10abc4[_0xf8c3('0x19')][_0xf8c3('0x1d')]||null:null,'include':_0x10abc4[_0xf8c3('0x19')]?_0x10abc4[_0xf8c3('0x19')]['include']?_[_0xf8c3('0x1e')](_0x10abc4[_0xf8c3('0x19')][_0xf8c3('0x1f')],function(_0x331ae0){return{'model':db[_0x331ae0['model']],'as':_0x331ae0['as'],'attributes':_0x331ae0[_0xf8c3('0x1c')],'include':_0x331ae0['include']?_['map'](_0x331ae0['include'],function(_0x47a840){return{'model':db[_0x47a840['model']],'as':_0x47a840['as'],'attributes':_0x47a840[_0xf8c3('0x1c')],'include':_0x47a840[_0xf8c3('0x1f')]?_['map'](_0x47a840[_0xf8c3('0x1f')],function(_0x44b85f){return{'model':db[_0x44b85f[_0xf8c3('0x20')]],'as':_0x44b85f['as'],'attributes':_0x44b85f[_0xf8c3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4741db){logger[_0xf8c3('0xe')]('GetCmHopperBlack',_0x10abc4);logger[_0xf8c3('0x11')](_0xf8c3('0x17'),_0x10abc4,JSON[_0xf8c3('0x12')](_0x4741db));_0x448837(_0x4741db);})[_0xf8c3('0x16')](function(_0x400b6a){logger[_0xf8c3('0x13')](_0xf8c3('0x17'),_0x400b6a[_0xf8c3('0x15')],_0x10abc4);_0x34c853(_0x23b72d[_0xf8c3('0x13')](0x1f4,_0x400b6a[_0xf8c3('0x15')]));});});};exports[_0xf8c3('0x21')]=function(_0x28334e){var _0x4efbb4=this;return new Promise(function(_0x1eba0f,_0x3cc345){return db[_0xf8c3('0x22')]['update'](_0x28334e['body'],{'raw':_0x28334e[_0xf8c3('0x19')]?_0x28334e[_0xf8c3('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28334e[_0xf8c3('0x19')]?_0x28334e[_0xf8c3('0x19')][_0xf8c3('0x1b')]||null:null,'attributes':_0x28334e['options']?_0x28334e[_0xf8c3('0x19')][_0xf8c3('0x1c')]||null:null,'limit':_0x28334e[_0xf8c3('0x19')]?_0x28334e[_0xf8c3('0x19')]['limit']||null:null})['then'](function(_0x1c2fa9){logger['info'](_0xf8c3('0x21'),_0x28334e);logger[_0xf8c3('0x11')](_0xf8c3('0x21'),_0x28334e,JSON[_0xf8c3('0x12')](_0x1c2fa9));_0x1eba0f(_0x1c2fa9);})[_0xf8c3('0x16')](function(_0x120adc){logger['error']('UpdateCmHopperBlack',_0x120adc[_0xf8c3('0x15')],_0x28334e);_0x3cc345(_0x4efbb4['error'](0x1f4,_0x120adc[_0xf8c3('0x15')]));});});};exports[_0xf8c3('0x23')]=function(_0x2fb513){var _0x2d8902=this;return new Promise(function(_0x452a70,_0x590734){return db['CmHopperBlack'][_0xf8c3('0x24')]({'where':_0x2fb513[_0xf8c3('0x19')]?_0x2fb513[_0xf8c3('0x19')][_0xf8c3('0x1b')]||null:null})[_0xf8c3('0xd')](function(_0x50bbf5){logger[_0xf8c3('0xe')](_0xf8c3('0x23'),_0x2fb513);logger['debug'](_0xf8c3('0x23'),_0x2fb513,JSON[_0xf8c3('0x12')](_0x50bbf5));_0x452a70(_0x50bbf5);})[_0xf8c3('0x16')](function(_0x386ad3){logger['error'](_0xf8c3('0x23'),_0x386ad3['message'],_0x2fb513);_0x590734(_0x2d8902[_0xf8c3('0x13')](0x1f4,_0x386ad3[_0xf8c3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 67e8843..6ab7d2e 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 _0x292c=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0xc12430,_0x35fa44){var _0x405a81=function(_0x1181f8){while(--_0x1181f8){_0xc12430['push'](_0xc12430['shift']());}};_0x405a81(++_0x35fa44);}(_0x292c,0x66));var _0xc292=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x292c[_0x4de586];return _0x46baf5;};'use strict';var multer=require(_0xc292('0x0'));var util=require('util');var path=require(_0xc292('0x1'));var timeout=require(_0xc292('0x2'));var express=require(_0xc292('0x3'));var router=express[_0xc292('0x4')]();var fs_extra=require(_0xc292('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc292('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0xc292('0x7')]('/',auth[_0xc292('0x8')](),controller[_0xc292('0x9')]);router[_0xc292('0x7')](_0xc292('0xa'),auth[_0xc292('0x8')](),controller[_0xc292('0xb')]);router[_0xc292('0x7')](_0xc292('0xc'),auth[_0xc292('0x8')](),controller['show']);router[_0xc292('0xd')](_0xc292('0xc'),auth[_0xc292('0x8')](),controller[_0xc292('0xe')]);router[_0xc292('0xf')]('/:id',auth[_0xc292('0x8')](),controller[_0xc292('0x10')]);module[_0xc292('0x11')]=router; \ No newline at end of file +var _0x6691=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','put','update','delete','/:id','destroy','exports','multer','util','path'];(function(_0x1ee99d,_0x25aba5){var _0x2cee6b=function(_0x44ac00){while(--_0x44ac00){_0x1ee99d['push'](_0x1ee99d['shift']());}};_0x2cee6b(++_0x25aba5);}(_0x6691,0x12d));var _0x1669=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6691[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var path=require(_0x1669('0x2'));var timeout=require(_0x1669('0x3'));var express=require(_0x1669('0x4'));var router=express[_0x1669('0x5')]();var fs_extra=require(_0x1669('0x6'));var auth=require(_0x1669('0x7'));var interaction=require(_0x1669('0x8'));var config=require(_0x1669('0x9'));var controller=require('./cmHopperBlack.controller');router[_0x1669('0xa')]('/',auth[_0x1669('0xb')](),controller[_0x1669('0xc')]);router[_0x1669('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1669('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1669('0xd')]('/:id',auth[_0x1669('0xb')](),controller[_0x1669('0xe')]);router[_0x1669('0xf')](_0x1669('0x10'),auth[_0x1669('0xb')](),controller[_0x1669('0x11')]);module[_0x1669('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 31a5d8b..05c6f43 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 _0x58d0=['sequelize','moment','exports','DATE','INTEGER','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x7265b2,_0x14e524){var _0x48b19e=function(_0x475ac1){while(--_0x475ac1){_0x7265b2['push'](_0x7265b2['shift']());}};_0x48b19e(++_0x14e524);}(_0x58d0,0x1a4));var _0x058d=function(_0xdc0397,_0x20d1f1){_0xdc0397=_0xdc0397-0x0;var _0x553d02=_0x58d0[_0xdc0397];return _0x553d02;};'use strict';var Sequelize=require(_0x058d('0x0'));var moment=require(_0x058d('0x1'));module[_0x058d('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x058d('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x058d('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x058d('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x058d('0x5')]},'originatecalleridname':{'type':Sequelize[_0x058d('0x5')]},'calleridnum':{'type':Sequelize[_0x058d('0x5')]},'calleridname':{'type':Sequelize[_0x058d('0x5')]},'starttime':{'type':Sequelize[_0x058d('0x3')]},'responsetime':{'type':Sequelize[_0x058d('0x3')]},'answertime':{'type':Sequelize[_0x058d('0x3')]},'droptime':{'type':Sequelize[_0x058d('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x058d('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x058d('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x058d('0x5')]},'membername':{'type':Sequelize[_0x058d('0x5')]},'reason':{'type':Sequelize[_0x058d('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x058d('0x5')]},'thirdDisposition':{'type':Sequelize[_0x058d('0x5')]},'dispositionat':{'type':Sequelize[_0x058d('0x3')],'set':function(_0x14a8e4){var _0x3f959e=this[_0x058d('0x6')](_0x058d('0x7'));if(_0x3f959e&&_0x14a8e4){this[_0x058d('0x8')](_0x058d('0x9'),moment(_0x14a8e4)[_0x058d('0xa')](moment(_0x3f959e),_0x058d('0xb')));}return this[_0x058d('0x8')](_0x058d('0xc'),_0x14a8e4);}},'amd':{'type':Sequelize[_0x058d('0xd')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x058d('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x058d('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x058d('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x058d('0x3')]},'deleted':{'type':Sequelize[_0x058d('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x058d('0x3')]},'recallme':{'type':Sequelize[_0x058d('0xd')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x058d('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x058d('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x058d('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x058d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd6d6=['STRING','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','DATE'];(function(_0x547e20,_0x284545){var _0x359171=function(_0x590250){while(--_0x590250){_0x547e20['push'](_0x547e20['shift']());}};_0x359171(++_0x284545);}(_0xd6d6,0xbe));var _0x6d6d=function(_0xd0c4f,_0x177051){_0xd0c4f=_0xd0c4f-0x0;var _0x2069f5=_0xd6d6[_0xd0c4f];return _0x2069f5;};'use strict';var Sequelize=require(_0x6d6d('0x0'));var moment=require(_0x6d6d('0x1'));module[_0x6d6d('0x2')]={'state':{'type':Sequelize[_0x6d6d('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x6d6d('0x4')]},'countbusyretry':{'type':Sequelize[_0x6d6d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6d6d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6d6d('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6d6d('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6d6d('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x6d6d('0x5')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6d6d('0x5')]},'calleridname':{'type':Sequelize[_0x6d6d('0x5')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'responsetime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'droptime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6d6d('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6d6d('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6d6d('0x5')]},'campaign':{'type':Sequelize[_0x6d6d('0x5')]},'campaigntype':{'type':Sequelize[_0x6d6d('0x5')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6d6d('0x5')]},'disposition':{'type':Sequelize[_0x6d6d('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x6d6d('0x4')],'set':function(_0x32146d){var _0xe61c36=this[_0x6d6d('0x6')](_0x6d6d('0x7'));if(_0xe61c36&&_0x32146d){this[_0x6d6d('0x8')](_0x6d6d('0x9'),moment(_0x32146d)[_0x6d6d('0xa')](moment(_0xe61c36),'seconds'));}return this[_0x6d6d('0x8')](_0x6d6d('0xb'),_0x32146d);}},'amd':{'type':Sequelize[_0x6d6d('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6d6d('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6d6d('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6d6d('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6d6d('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6d6d('0x4')]},'deleted':{'type':Sequelize[_0x6d6d('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6d6d('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6d6d('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6d6d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6d6d('0x3')],'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/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index f56ee57..acf6da0 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 _0xb7a2=['update','body','uniqueid','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','NOW()','CampaignId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','checkContactHopper','findOne','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','error','stack','name','render','message','interaction','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','model','find','describe'];(function(_0x56e979,_0x1c66d9){var _0x2e856b=function(_0x452b2b){while(--_0x452b2b){_0x56e979['push'](_0x56e979['shift']());}};_0x2e856b(++_0x1c66d9);}(_0xb7a2,0x1c9));var _0x2b7a=function(_0x4b0547,_0x5aeed3){_0x4b0547=_0x4b0547-0x0;var _0xfa5c4=_0xb7a2[_0x4b0547];return _0xfa5c4;};'use strict';var emlformat=require(_0x2b7a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b7a('0x1'));var jsonpatch=require(_0x2b7a('0x2'));var rp=require('request-promise');var moment=require(_0x2b7a('0x3'));var BPromise=require(_0x2b7a('0x4'));var Mustache=require(_0x2b7a('0x5'));var util=require(_0x2b7a('0x6'));var path=require(_0x2b7a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2b7a('0x8'));var fs=require('fs');var fs_extra=require(_0x2b7a('0x9'));var _=require('lodash');var squel=require(_0x2b7a('0xa'));var crypto=require(_0x2b7a('0xb'));var jsforce=require(_0x2b7a('0xc'));var deskjs=require(_0x2b7a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2b7a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2b7a('0xf'));var qs=require(_0x2b7a('0x10'));var as=require(_0x2b7a('0x11'));var hardwareService=require(_0x2b7a('0x12'));var logger=require(_0x2b7a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2b7a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b7a('0x15'))['db'];function respondWithStatusCode(_0x5f4c1a,_0x37f63f){_0x37f63f=_0x37f63f||0xcc;return function(_0x1abee3){if(_0x1abee3){return _0x5f4c1a[_0x2b7a('0x16')](_0x37f63f);}return _0x5f4c1a[_0x2b7a('0x17')](_0x37f63f)[_0x2b7a('0x18')]();};}function respondWithResult(_0x5834c0,_0x38e501){_0x38e501=_0x38e501||0xc8;return function(_0x3d96cd){if(_0x3d96cd){return _0x5834c0[_0x2b7a('0x17')](_0x38e501)['json'](_0x3d96cd);}};}function respondWithFilteredResult(_0x11bbae,_0x3c5bb8){return function(_0x1a3b01){if(_0x1a3b01){var _0x164c70=typeof _0x3c5bb8[_0x2b7a('0x19')]===_0x2b7a('0x1a')&&typeof _0x3c5bb8[_0x2b7a('0x1b')]===_0x2b7a('0x1a');var _0x230449=_0x1a3b01[_0x2b7a('0x1c')];var _0x2dd853=_0x164c70?0x0:_0x3c5bb8['offset'];var _0xf78c3d=_0x164c70?_0x1a3b01[_0x2b7a('0x1c')]:_0x3c5bb8[_0x2b7a('0x19')]+_0x3c5bb8[_0x2b7a('0x1b')];var _0x5810a8;if(_0xf78c3d>=_0x230449){_0xf78c3d=_0x230449;_0x5810a8=0xc8;}else{_0x5810a8=0xce;}_0x11bbae[_0x2b7a('0x17')](_0x5810a8);return _0x11bbae['set'](_0x2b7a('0x1d'),_0x2dd853+'-'+_0xf78c3d+'/'+_0x230449)[_0x2b7a('0x1e')](_0x1a3b01);}return null;};}function patchUpdates(_0x2c9a4b){return function(_0x57493f){try{jsonpatch[_0x2b7a('0x1f')](_0x57493f,_0x2c9a4b,!![]);}catch(_0x158dc4){return BPromise[_0x2b7a('0x20')](_0x158dc4);}return _0x57493f['save']();};}function saveUpdates(_0xeaefb4,_0x5d3a6c){return function(_0x11bcfb){if(_0x11bcfb){return _0x11bcfb['update'](_0xeaefb4)[_0x2b7a('0x21')](function(_0x50ec6a){return _0x50ec6a;});}return null;};}function removeEntity(_0xb8fd6b,_0x5b28ac){return function(_0x549675){if(_0x549675){return _0x549675[_0x2b7a('0x22')]()[_0x2b7a('0x21')](function(){_0xb8fd6b['status'](0xcc)[_0x2b7a('0x18')]();});}};}function handleEntityNotFound(_0x311c02,_0xaf8995){return function(_0x374fea){if(!_0x374fea){_0x311c02[_0x2b7a('0x16')](0x194);}return _0x374fea;};}function handleError(_0x44fcc4,_0x15ce86){_0x15ce86=_0x15ce86||0x1f4;return function(_0x466a8e){logger[_0x2b7a('0x23')](_0x466a8e[_0x2b7a('0x24')]);if(_0x466a8e[_0x2b7a('0x25')]){delete _0x466a8e['name'];}_0x44fcc4['status'](_0x15ce86)['send'](_0x466a8e);};}function getMustacheRender(_0x9cb621,_0x254065){return Mustache[_0x2b7a('0x26')](_0x9cb621,_['merge'](_0x254065['body'],{'contact':_0x254065['contact'],'message':_0x254065[_0x2b7a('0x27')],'agent':_0x254065['agent'],'interaction':_0x254065[_0x2b7a('0x28')],'account':_0x254065['account']}))||'';}exports[_0x2b7a('0x29')]=function(_0xb3ef7e,_0x3ebe7b){var _0x49d816={},_0x10b8cc={},_0x4e45a5={'count':0x0,'rows':[]};var _0x57b49a=_[_0x2b7a('0x2a')](db[_0x2b7a('0x2b')][_0x2b7a('0x2c')],function(_0x358819){return{'name':_0x358819[_0x2b7a('0x2d')],'type':_0x358819[_0x2b7a('0x2e')][_0x2b7a('0x2f')]};});_0x10b8cc['model']=_[_0x2b7a('0x2a')](_0x57b49a,_0x2b7a('0x25'));_0x10b8cc[_0x2b7a('0x30')]=_[_0x2b7a('0x31')](_0xb3ef7e['query']);_0x10b8cc['filters']=_[_0x2b7a('0x32')](_0x10b8cc['model'],_0x10b8cc[_0x2b7a('0x30')]);_0x49d816[_0x2b7a('0x33')]=_['intersection'](_0x10b8cc['model'],qs[_0x2b7a('0x34')](_0xb3ef7e[_0x2b7a('0x30')][_0x2b7a('0x34')]));_0x49d816['attributes']=_0x49d816['attributes'][_0x2b7a('0x35')]?_0x49d816[_0x2b7a('0x33')]:_0x10b8cc['model'];if(!_0xb3ef7e[_0x2b7a('0x30')][_0x2b7a('0x36')](_0x2b7a('0x37'))){_0x49d816[_0x2b7a('0x1b')]=qs[_0x2b7a('0x1b')](_0xb3ef7e[_0x2b7a('0x30')][_0x2b7a('0x1b')]);_0x49d816[_0x2b7a('0x19')]=qs[_0x2b7a('0x19')](_0xb3ef7e['query']['offset']);}_0x49d816[_0x2b7a('0x38')]=qs[_0x2b7a('0x39')](_0xb3ef7e['query'][_0x2b7a('0x39')]);_0x49d816[_0x2b7a('0x3a')]=qs[_0x2b7a('0x3b')](_[_0x2b7a('0x3c')](_0xb3ef7e['query'],_0x10b8cc['filters']),_0x57b49a);if(_0xb3ef7e[_0x2b7a('0x30')]['filter']){_0x49d816[_0x2b7a('0x3a')]=_[_0x2b7a('0x3d')](_0x49d816[_0x2b7a('0x3a')],{'$or':_[_0x2b7a('0x2a')](_0x57b49a,function(_0x1ef828){if(_0x1ef828[_0x2b7a('0x2e')]!==_0x2b7a('0x3e')){var _0x4e6d5e={};_0x4e6d5e[_0x1ef828[_0x2b7a('0x25')]]={'$like':'%'+_0xb3ef7e[_0x2b7a('0x30')][_0x2b7a('0x3f')]+'%'};return _0x4e6d5e;}})});}_0x49d816=_[_0x2b7a('0x3d')]({},_0x49d816,_0xb3ef7e[_0x2b7a('0x40')]);var _0x262e36={'where':_0x49d816[_0x2b7a('0x3a')]};return db[_0x2b7a('0x2b')][_0x2b7a('0x1c')](_0x262e36)[_0x2b7a('0x21')](function(_0x26d76b){_0x4e45a5[_0x2b7a('0x1c')]=_0x26d76b;if(_0xb3ef7e[_0x2b7a('0x30')][_0x2b7a('0x41')]){_0x49d816[_0x2b7a('0x42')]=[{'all':!![]}];}return db[_0x2b7a('0x2b')][_0x2b7a('0x43')](_0x49d816);})[_0x2b7a('0x21')](function(_0x5d6f04){_0x4e45a5[_0x2b7a('0x44')]=_0x5d6f04;return _0x4e45a5;})['then'](respondWithFilteredResult(_0x3ebe7b,_0x49d816))[_0x2b7a('0x45')](handleError(_0x3ebe7b,null));};exports[_0x2b7a('0x46')]=function(_0x20aed4,_0x5a106b){var _0xd40794={'raw':!![],'where':{'id':_0x20aed4[_0x2b7a('0x47')]['id']}},_0x24ab5d={};_0x24ab5d['model']=_[_0x2b7a('0x31')](db[_0x2b7a('0x2b')][_0x2b7a('0x2c')]);_0x24ab5d[_0x2b7a('0x30')]=_['keys'](_0x20aed4[_0x2b7a('0x30')]);_0x24ab5d['filters']=_[_0x2b7a('0x32')](_0x24ab5d[_0x2b7a('0x48')],_0x24ab5d[_0x2b7a('0x30')]);_0xd40794[_0x2b7a('0x33')]=_[_0x2b7a('0x32')](_0x24ab5d[_0x2b7a('0x48')],qs['fields'](_0x20aed4[_0x2b7a('0x30')][_0x2b7a('0x34')]));_0xd40794['attributes']=_0xd40794[_0x2b7a('0x33')][_0x2b7a('0x35')]?_0xd40794['attributes']:_0x24ab5d[_0x2b7a('0x48')];if(_0x20aed4[_0x2b7a('0x30')][_0x2b7a('0x41')]){_0xd40794['include']=[{'all':!![]}];}_0xd40794=_['merge']({},_0xd40794,_0x20aed4['options']);return db[_0x2b7a('0x2b')][_0x2b7a('0x49')](_0xd40794)[_0x2b7a('0x21')](handleEntityNotFound(_0x5a106b,null))['then'](respondWithResult(_0x5a106b,null))[_0x2b7a('0x45')](handleError(_0x5a106b,null));};exports[_0x2b7a('0x4a')]=function(_0x49f7c9,_0x4fd254){return db[_0x2b7a('0x2b')][_0x2b7a('0x4a')]()['then'](respondWithResult(_0x4fd254,null))['catch'](handleError(_0x4fd254,null));};exports[_0x2b7a('0x4b')]=function(_0x4cf206,_0x470811){if(_0x4cf206[_0x2b7a('0x4c')][_0x2b7a('0x4d')]){delete _0x4cf206[_0x2b7a('0x4c')][_0x2b7a('0x4d')];}return db['CmHopperFinal'][_0x2b7a('0x49')]({'where':{'uniqueid':_0x4cf206[_0x2b7a('0x47')]['id']}})[_0x2b7a('0x21')](handleEntityNotFound(_0x470811,null))[_0x2b7a('0x21')](saveUpdates(_0x4cf206[_0x2b7a('0x4c')],null))['then'](respondWithResult(_0x470811,null))[_0x2b7a('0x45')](handleError(_0x470811,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x3ce028,_0x484ca1,_0x1d8b86){return db[_0x2b7a('0x2b')][_0x2b7a('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x3ce028['params']['id']},'attributes':[[db[_0x2b7a('0x4e')]['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db[_0x2b7a('0x4e')][_0x2b7a('0x50')](_0x2b7a('0x51')))),'noSuchContacts'],[db[_0x2b7a('0x4e')]['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db[_0x2b7a('0x4e')][_0x2b7a('0x50')](_0x2b7a('0x52')))),_0x2b7a('0x53')],[db[_0x2b7a('0x4e')]['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db[_0x2b7a('0x4e')][_0x2b7a('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x2b7a('0x54')],[db[_0x2b7a('0x4e')]['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db['sequelize'][_0x2b7a('0x50')](_0x2b7a('0x55')))),_0x2b7a('0x56')],[db[_0x2b7a('0x4e')]['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db[_0x2b7a('0x4e')][_0x2b7a('0x50')](_0x2b7a('0x57')))),_0x2b7a('0x58')],[db[_0x2b7a('0x4e')]['fn']('COUNT',db[_0x2b7a('0x4e')]['fn']('IF',db['sequelize'][_0x2b7a('0x50')](_0x2b7a('0x59')))),_0x2b7a('0x5a')],[db[_0x2b7a('0x4e')]['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db[_0x2b7a('0x4e')][_0x2b7a('0x50')](_0x2b7a('0x5b')))),_0x2b7a('0x5c')],[db[_0x2b7a('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2b7a('0x4e')][_0x2b7a('0x50')](_0x2b7a('0x5d')))),'answeringMachine']]})[_0x2b7a('0x21')](handleEntityNotFound(_0x484ca1,null))[_0x2b7a('0x21')](respondWithResult(_0x484ca1,null))[_0x2b7a('0x45')](handleError(_0x484ca1,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4f888a,_0x5170b2,_0x39c986){return db['CmHopperFinal'][_0x2b7a('0x43')]({'raw':![],'where':{'CampaignId':_0x4f888a[_0x2b7a('0x47')]['id']},'attributes':[[db[_0x2b7a('0x4e')]['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db['sequelize'][_0x2b7a('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0x2b7a('0x5e')],[db['sequelize']['fn'](_0x2b7a('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0x2b7a('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0x2b7a('0x53')],[db[_0x2b7a('0x4e')]['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db[_0x2b7a('0x4e')][_0x2b7a('0x50')](_0x2b7a('0x5f')))),'busyContacts'],[db[_0x2b7a('0x4e')]['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db[_0x2b7a('0x4e')][_0x2b7a('0x50')](_0x2b7a('0x55')))),_0x2b7a('0x56')],[db[_0x2b7a('0x4e')]['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db[_0x2b7a('0x4e')][_0x2b7a('0x50')](_0x2b7a('0x57')))),'dropContacts'],[db['sequelize']['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db['sequelize'][_0x2b7a('0x50')](_0x2b7a('0x59')))),'abandonedContacts'],[db[_0x2b7a('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2b7a('0x4e')]['literal'](_0x2b7a('0x5b')))),'reCallContacts'],[db['sequelize']['fn'](_0x2b7a('0x4f'),db[_0x2b7a('0x4e')]['fn']('IF',db[_0x2b7a('0x4e')][_0x2b7a('0x50')]('`state`\x20=\x2019,\x201,\x20null'))),_0x2b7a('0x60')]]})['then'](handleEntityNotFound(_0x5170b2,null))[_0x2b7a('0x21')](respondWithResult(_0x5170b2,null))[_0x2b7a('0x45')](handleError(_0x5170b2,null));};exports[_0x2b7a('0x61')]=function(_0x38a5f0,_0x35db46,_0x270133){return db[_0x2b7a('0x62')][_0x2b7a('0x49')]({'where':{'id':_0x38a5f0[_0x2b7a('0x47')]['id']}})['then'](handleEntityNotFound(_0x35db46,null))[_0x2b7a('0x21')](function(_0x1c0e7e){var _0x8edbd4;if(_0x1c0e7e){_0x8edbd4=squel[_0x2b7a('0x63')]()[_0x2b7a('0x64')](_0x2b7a('0x65'))[_0x2b7a('0x66')]([_0x2b7a('0x67'),_0x2b7a('0x68'),_0x2b7a('0x69'),_0x2b7a('0x6a'),'VoiceQueueId',_0x2b7a('0x6b'),_0x2b7a('0x6c')],squel[_0x2b7a('0x6d')]()['field'](_0x2b7a('0x6e'),_0x2b7a('0x67'))[_0x2b7a('0x6f')]('NOW()','scheduledAt')['field'](_0x2b7a('0x70'),_0x2b7a('0x69'))[_0x2b7a('0x6f')](_0x2b7a('0x71'),_0x2b7a('0x6a'))[_0x2b7a('0x6f')]('ANY_VALUE(VoiceQueueId)',_0x2b7a('0x72'))['field']('NOW()',_0x2b7a('0x6b'))[_0x2b7a('0x6f')]('NOW()',_0x2b7a('0x6c'))[_0x2b7a('0x73')](_0x2b7a('0x74'))[_0x2b7a('0x3a')](_0x2b7a('0x75'),_0x38a5f0[_0x2b7a('0x47')]['id'][_0x2b7a('0x76')]())[_0x2b7a('0x3a')](_0x2b7a('0x77'),_0x38a5f0[_0x2b7a('0x4c')][_0x2b7a('0x78')][_0x2b7a('0x76')]())[_0x2b7a('0x3a')](_0x2b7a('0x79'))[_0x2b7a('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x2b7a('0x67'))[_0x2b7a('0x73')](_0x2b7a('0x65'))['where']('VoiceQueueId\x20=\x20?',_0x38a5f0[_0x2b7a('0x47')]['id'][_0x2b7a('0x76')]()))[_0x2b7a('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x2b7a('0x6d')]()[_0x2b7a('0x6f')](_0x2b7a('0x7a'))[_0x2b7a('0x73')](_0x2b7a('0x74'))['where']('VoiceQueueId\x20=\x20?',_0x38a5f0[_0x2b7a('0x47')]['id']['toString']())[_0x2b7a('0x3a')]('state\x20=\x204'))[_0x2b7a('0x7b')](_0x2b7a('0x69')))[_0x2b7a('0x76')]();return db[_0x2b7a('0x4e')][_0x2b7a('0x30')](_0x8edbd4);}return[];})[_0x2b7a('0x21')](respondWithResult(_0x35db46,null))[_0x2b7a('0x45')](handleError(_0x35db46,null));};exports[_0x2b7a('0x7c')]=function(_0x480b28,_0x204de5,_0x2a2849){return db[_0x2b7a('0x7d')]['find']({'where':{'id':_0x480b28[_0x2b7a('0x47')]['id']}})['then'](handleEntityNotFound(_0x204de5,null))[_0x2b7a('0x21')](function(_0x3969d4){var _0xd53907;if(_0x3969d4){_0xd53907=squel[_0x2b7a('0x63')]()[_0x2b7a('0x64')]('cm_hopper')[_0x2b7a('0x66')]([_0x2b7a('0x67'),_0x2b7a('0x68'),'ContactId',_0x2b7a('0x6a'),_0x2b7a('0x7e'),_0x2b7a('0x6b'),'updatedAt'],squel[_0x2b7a('0x6d')]()[_0x2b7a('0x6f')](_0x2b7a('0x6e'),_0x2b7a('0x67'))[_0x2b7a('0x6f')]('NOW()',_0x2b7a('0x68'))[_0x2b7a('0x6f')]('ANY_VALUE(ContactId)',_0x2b7a('0x69'))['field']('ANY_VALUE(ListId)',_0x2b7a('0x6a'))[_0x2b7a('0x6f')](_0x2b7a('0x7f'),_0x2b7a('0x7e'))[_0x2b7a('0x6f')]('NOW()',_0x2b7a('0x6b'))[_0x2b7a('0x6f')](_0x2b7a('0x80'),_0x2b7a('0x6c'))['from'](_0x2b7a('0x74'))['where'](_0x2b7a('0x81'),_0x480b28[_0x2b7a('0x47')]['id'][_0x2b7a('0x76')]())[_0x2b7a('0x3a')](_0x2b7a('0x77'),_0x480b28['body'][_0x2b7a('0x78')][_0x2b7a('0x76')]())['where'](_0x2b7a('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x2b7a('0x6d')]()[_0x2b7a('0x6f')]('phone')[_0x2b7a('0x73')](_0x2b7a('0x65'))['where'](_0x2b7a('0x81'),_0x480b28[_0x2b7a('0x47')]['id'][_0x2b7a('0x76')]()))[_0x2b7a('0x3a')](_0x2b7a('0x82'),squel[_0x2b7a('0x6d')]()[_0x2b7a('0x6f')]('calleridnum')[_0x2b7a('0x73')](_0x2b7a('0x74'))[_0x2b7a('0x3a')](_0x2b7a('0x81'),_0x480b28[_0x2b7a('0x47')]['id'][_0x2b7a('0x76')]())[_0x2b7a('0x3a')]('state\x20=\x204'))[_0x2b7a('0x7b')]('ContactId'))[_0x2b7a('0x76')]();return db['sequelize'][_0x2b7a('0x30')](_0xd53907);}return[];})['then'](respondWithResult(_0x204de5,null))['catch'](handleError(_0x204de5,null));};exports[_0x2b7a('0x83')]=function(_0x251b8c,_0x90e48d,_0x21bc9d){return db['CmHopper'][_0x2b7a('0x84')]({'where':{'VoiceQueueId':_0x251b8c[_0x2b7a('0x4c')]['VoiceQueueId'],'CampaignId':_0x251b8c[_0x2b7a('0x4c')][_0x2b7a('0x7e')],'ContactId':_0x251b8c[_0x2b7a('0x4c')][_0x2b7a('0x69')]}})[_0x2b7a('0x21')](handleEntityNotFound(_0x90e48d,null))[_0x2b7a('0x21')](function(_0x3e7ddd){if(_0x3e7ddd){return _0x3e7ddd;}return null;})[_0x2b7a('0x21')](respondWithResult(_0x90e48d,null))[_0x2b7a('0x45')](handleError(_0x90e48d,null));}; \ No newline at end of file +var _0x2c77=['model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','intersection','find','describe','update','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','updatedAt','select','field','phone','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','scheduledAt','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','checkContactHopper','CmHopper','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','then','destroy','error','stack','name','send','render','body','contact','message','agent','interaction','account','index','map','CmHopperFinal','rawAttributes','fieldName','type'];(function(_0x26d848,_0xeaa307){var _0x187ba9=function(_0x1f28f4){while(--_0x1f28f4){_0x26d848['push'](_0x26d848['shift']());}};_0x187ba9(++_0xeaa307);}(_0x2c77,0x15f));var _0x72c7=function(_0x1f99b4,_0x640a41){_0x1f99b4=_0x1f99b4-0x0;var _0x574603=_0x2c77[_0x1f99b4];return _0x574603;};'use strict';var emlformat=require(_0x72c7('0x0'));var rimraf=require(_0x72c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72c7('0x2'));var rp=require(_0x72c7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x72c7('0x4'));var util=require('util');var path=require(_0x72c7('0x5'));var sox=require(_0x72c7('0x6'));var csv=require('to-csv');var ejs=require(_0x72c7('0x7'));var fs=require('fs');var fs_extra=require(_0x72c7('0x8'));var _=require(_0x72c7('0x9'));var squel=require(_0x72c7('0xa'));var crypto=require(_0x72c7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x72c7('0xc'));var querystring=require(_0x72c7('0xd'));var Papa=require(_0x72c7('0xe'));var Redis=require(_0x72c7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x72c7('0x10'));var as=require(_0x72c7('0x11'));var hardwareService=require(_0x72c7('0x12'));var logger=require(_0x72c7('0x13'))(_0x72c7('0x14'));var utils=require(_0x72c7('0x15'));var config=require(_0x72c7('0x16'));var licenseUtil=require(_0x72c7('0x17'));var db=require(_0x72c7('0x18'))['db'];function respondWithStatusCode(_0x32090f,_0x4e524e){_0x4e524e=_0x4e524e||0xcc;return function(_0x118dc0){if(_0x118dc0){return _0x32090f[_0x72c7('0x19')](_0x4e524e);}return _0x32090f[_0x72c7('0x1a')](_0x4e524e)[_0x72c7('0x1b')]();};}function respondWithResult(_0x5062bb,_0x23d543){_0x23d543=_0x23d543||0xc8;return function(_0x3c2bcf){if(_0x3c2bcf){return _0x5062bb[_0x72c7('0x1a')](_0x23d543)[_0x72c7('0x1c')](_0x3c2bcf);}};}function respondWithFilteredResult(_0x461970,_0x510102){return function(_0x15182f){if(_0x15182f){var _0x22c8b2=typeof _0x510102[_0x72c7('0x1d')]===_0x72c7('0x1e')&&typeof _0x510102[_0x72c7('0x1f')]===_0x72c7('0x1e');var _0x29c59c=_0x15182f['count'];var _0xe9488a=_0x22c8b2?0x0:_0x510102[_0x72c7('0x1d')];var _0x573a5a=_0x22c8b2?_0x15182f[_0x72c7('0x20')]:_0x510102[_0x72c7('0x1d')]+_0x510102['limit'];var _0x3d0ab1;if(_0x573a5a>=_0x29c59c){_0x573a5a=_0x29c59c;_0x3d0ab1=0xc8;}else{_0x3d0ab1=0xce;}_0x461970[_0x72c7('0x1a')](_0x3d0ab1);return _0x461970['set'](_0x72c7('0x21'),_0xe9488a+'-'+_0x573a5a+'/'+_0x29c59c)[_0x72c7('0x1c')](_0x15182f);}return null;};}function patchUpdates(_0x581e8e){return function(_0x13041f){try{jsonpatch[_0x72c7('0x22')](_0x13041f,_0x581e8e,!![]);}catch(_0x16d133){return BPromise['reject'](_0x16d133);}return _0x13041f['save']();};}function saveUpdates(_0x178789,_0x5c479a){return function(_0x579b80){if(_0x579b80){return _0x579b80['update'](_0x178789)[_0x72c7('0x23')](function(_0x2378ae){return _0x2378ae;});}return null;};}function removeEntity(_0x268a99,_0x53f575){return function(_0x752008){if(_0x752008){return _0x752008[_0x72c7('0x24')]()[_0x72c7('0x23')](function(){_0x268a99[_0x72c7('0x1a')](0xcc)[_0x72c7('0x1b')]();});}};}function handleEntityNotFound(_0x1ec224,_0x481f81){return function(_0x3f36d1){if(!_0x3f36d1){_0x1ec224[_0x72c7('0x19')](0x194);}return _0x3f36d1;};}function handleError(_0x482d9e,_0xe986af){_0xe986af=_0xe986af||0x1f4;return function(_0x553cc4){logger[_0x72c7('0x25')](_0x553cc4[_0x72c7('0x26')]);if(_0x553cc4['name']){delete _0x553cc4[_0x72c7('0x27')];}_0x482d9e[_0x72c7('0x1a')](_0xe986af)[_0x72c7('0x28')](_0x553cc4);};}function getMustacheRender(_0x35814e,_0x343af3){return Mustache[_0x72c7('0x29')](_0x35814e,_['merge'](_0x343af3[_0x72c7('0x2a')],{'contact':_0x343af3[_0x72c7('0x2b')],'message':_0x343af3[_0x72c7('0x2c')],'agent':_0x343af3[_0x72c7('0x2d')],'interaction':_0x343af3[_0x72c7('0x2e')],'account':_0x343af3[_0x72c7('0x2f')]}))||'';}exports[_0x72c7('0x30')]=function(_0x261306,_0x318ce8){var _0x58fa3={},_0x24c665={},_0x4a5fd4={'count':0x0,'rows':[]};var _0x34d304=_[_0x72c7('0x31')](db[_0x72c7('0x32')][_0x72c7('0x33')],function(_0x5322b5){return{'name':_0x5322b5[_0x72c7('0x34')],'type':_0x5322b5[_0x72c7('0x35')]['key']};});_0x24c665[_0x72c7('0x36')]=_[_0x72c7('0x31')](_0x34d304,'name');_0x24c665[_0x72c7('0x37')]=_[_0x72c7('0x38')](_0x261306['query']);_0x24c665[_0x72c7('0x39')]=_['intersection'](_0x24c665[_0x72c7('0x36')],_0x24c665[_0x72c7('0x37')]);_0x58fa3[_0x72c7('0x3a')]=_['intersection'](_0x24c665[_0x72c7('0x36')],qs[_0x72c7('0x3b')](_0x261306[_0x72c7('0x37')][_0x72c7('0x3b')]));_0x58fa3['attributes']=_0x58fa3[_0x72c7('0x3a')]['length']?_0x58fa3[_0x72c7('0x3a')]:_0x24c665['model'];if(!_0x261306['query'][_0x72c7('0x3c')](_0x72c7('0x3d'))){_0x58fa3['limit']=qs[_0x72c7('0x1f')](_0x261306[_0x72c7('0x37')][_0x72c7('0x1f')]);_0x58fa3[_0x72c7('0x1d')]=qs[_0x72c7('0x1d')](_0x261306[_0x72c7('0x37')]['offset']);}_0x58fa3[_0x72c7('0x3e')]=qs['sort'](_0x261306[_0x72c7('0x37')][_0x72c7('0x3f')]);_0x58fa3[_0x72c7('0x40')]=qs[_0x72c7('0x39')](_[_0x72c7('0x41')](_0x261306[_0x72c7('0x37')],_0x24c665['filters']),_0x34d304);if(_0x261306[_0x72c7('0x37')][_0x72c7('0x42')]){_0x58fa3[_0x72c7('0x40')]=_[_0x72c7('0x43')](_0x58fa3['where'],{'$or':_[_0x72c7('0x31')](_0x34d304,function(_0x114095){if(_0x114095['type']!==_0x72c7('0x44')){var _0x27fabd={};_0x27fabd[_0x114095['name']]={'$like':'%'+_0x261306[_0x72c7('0x37')]['filter']+'%'};return _0x27fabd;}})});}_0x58fa3=_[_0x72c7('0x43')]({},_0x58fa3,_0x261306[_0x72c7('0x45')]);var _0x1eaa32={'where':_0x58fa3[_0x72c7('0x40')]};return db[_0x72c7('0x32')][_0x72c7('0x20')](_0x1eaa32)['then'](function(_0xa464ce){_0x4a5fd4[_0x72c7('0x20')]=_0xa464ce;if(_0x261306['query']['includeAll']){_0x58fa3[_0x72c7('0x46')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x72c7('0x47')](_0x58fa3);})[_0x72c7('0x23')](function(_0xc9ce3b){_0x4a5fd4['rows']=_0xc9ce3b;return _0x4a5fd4;})[_0x72c7('0x23')](respondWithFilteredResult(_0x318ce8,_0x58fa3))[_0x72c7('0x48')](handleError(_0x318ce8,null));};exports['show']=function(_0x35e261,_0x31eb98){var _0x297a4c={'raw':!![],'where':{'id':_0x35e261[_0x72c7('0x49')]['id']}},_0x5df1cb={};_0x5df1cb['model']=_['keys'](db[_0x72c7('0x32')]['rawAttributes']);_0x5df1cb[_0x72c7('0x37')]=_[_0x72c7('0x38')](_0x35e261['query']);_0x5df1cb['filters']=_[_0x72c7('0x4a')](_0x5df1cb[_0x72c7('0x36')],_0x5df1cb[_0x72c7('0x37')]);_0x297a4c['attributes']=_[_0x72c7('0x4a')](_0x5df1cb[_0x72c7('0x36')],qs['fields'](_0x35e261['query']['fields']));_0x297a4c[_0x72c7('0x3a')]=_0x297a4c[_0x72c7('0x3a')]['length']?_0x297a4c['attributes']:_0x5df1cb[_0x72c7('0x36')];if(_0x35e261[_0x72c7('0x37')]['includeAll']){_0x297a4c[_0x72c7('0x46')]=[{'all':!![]}];}_0x297a4c=_[_0x72c7('0x43')]({},_0x297a4c,_0x35e261[_0x72c7('0x45')]);return db[_0x72c7('0x32')][_0x72c7('0x4b')](_0x297a4c)[_0x72c7('0x23')](handleEntityNotFound(_0x31eb98,null))[_0x72c7('0x23')](respondWithResult(_0x31eb98,null))[_0x72c7('0x48')](handleError(_0x31eb98,null));};exports[_0x72c7('0x4c')]=function(_0x247446,_0x1ee710){return db['CmHopperFinal'][_0x72c7('0x4c')]()[_0x72c7('0x23')](respondWithResult(_0x1ee710,null))['catch'](handleError(_0x1ee710,null));};exports[_0x72c7('0x4d')]=function(_0x60c64a,_0x81043e){if(_0x60c64a[_0x72c7('0x2a')][_0x72c7('0x4e')]){delete _0x60c64a['body'][_0x72c7('0x4e')];}return db[_0x72c7('0x32')][_0x72c7('0x4b')]({'where':{'uniqueid':_0x60c64a[_0x72c7('0x49')]['id']}})[_0x72c7('0x23')](handleEntityNotFound(_0x81043e,null))[_0x72c7('0x23')](saveUpdates(_0x60c64a[_0x72c7('0x2a')],null))['then'](respondWithResult(_0x81043e,null))[_0x72c7('0x48')](handleError(_0x81043e,null));};exports[_0x72c7('0x4f')]=function(_0x21e973,_0x229d49,_0x1822f3){return db[_0x72c7('0x32')][_0x72c7('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x21e973[_0x72c7('0x49')]['id']},'attributes':[[db[_0x72c7('0x50')]['fn'](_0x72c7('0x51'),db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')][_0x72c7('0x52')]('`state`\x20=\x200,\x201,\x20null'))),_0x72c7('0x53')],[db[_0x72c7('0x50')]['fn']('COUNT',db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')][_0x72c7('0x52')]('`state`\x20=\x203,\x201,\x20null'))),_0x72c7('0x54')],[db[_0x72c7('0x50')]['fn'](_0x72c7('0x51'),db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')]['literal'](_0x72c7('0x55')))),_0x72c7('0x56')],[db[_0x72c7('0x50')]['fn'](_0x72c7('0x51'),db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')][_0x72c7('0x52')](_0x72c7('0x57')))),_0x72c7('0x58')],[db['sequelize']['fn'](_0x72c7('0x51'),db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')]['literal'](_0x72c7('0x59')))),_0x72c7('0x5a')],[db['sequelize']['fn'](_0x72c7('0x51'),db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')][_0x72c7('0x52')](_0x72c7('0x5b')))),'abandonedContacts'],[db[_0x72c7('0x50')]['fn'](_0x72c7('0x51'),db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')][_0x72c7('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0x72c7('0x5c')],[db['sequelize']['fn'](_0x72c7('0x51'),db['sequelize']['fn']('IF',db[_0x72c7('0x50')][_0x72c7('0x52')](_0x72c7('0x5d')))),_0x72c7('0x5e')]]})[_0x72c7('0x23')](handleEntityNotFound(_0x229d49,null))['then'](respondWithResult(_0x229d49,null))['catch'](handleError(_0x229d49,null));};exports[_0x72c7('0x5f')]=function(_0x36d437,_0x19f400,_0x41f91f){return db[_0x72c7('0x32')][_0x72c7('0x47')]({'raw':![],'where':{'CampaignId':_0x36d437['params']['id']},'attributes':[[db[_0x72c7('0x50')]['fn'](_0x72c7('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x72c7('0x52')](_0x72c7('0x60')))),_0x72c7('0x53')],[db[_0x72c7('0x50')]['fn'](_0x72c7('0x51'),db[_0x72c7('0x50')]['fn']('IF',db['sequelize'][_0x72c7('0x52')](_0x72c7('0x61')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x72c7('0x51'),db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')][_0x72c7('0x52')](_0x72c7('0x55')))),'busyContacts'],[db[_0x72c7('0x50')]['fn'](_0x72c7('0x51'),db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')][_0x72c7('0x52')](_0x72c7('0x57')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')][_0x72c7('0x52')](_0x72c7('0x59')))),_0x72c7('0x5a')],[db[_0x72c7('0x50')]['fn']('COUNT',db[_0x72c7('0x50')]['fn']('IF',db[_0x72c7('0x50')]['literal'](_0x72c7('0x5b')))),_0x72c7('0x62')],[db[_0x72c7('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x72c7('0x50')][_0x72c7('0x52')](_0x72c7('0x63')))),'reCallContacts'],[db['sequelize']['fn'](_0x72c7('0x51'),db['sequelize']['fn']('IF',db[_0x72c7('0x50')]['literal'](_0x72c7('0x5d')))),_0x72c7('0x5e')]]})[_0x72c7('0x23')](handleEntityNotFound(_0x19f400,null))[_0x72c7('0x23')](respondWithResult(_0x19f400,null))['catch'](handleError(_0x19f400,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x86b6d3,_0x33ebd7,_0x5c9aa6){return db['VoiceQueue'][_0x72c7('0x4b')]({'where':{'id':_0x86b6d3[_0x72c7('0x49')]['id']}})['then'](handleEntityNotFound(_0x33ebd7,null))[_0x72c7('0x23')](function(_0x1b08f0){var _0x1ea1c7;if(_0x1b08f0){_0x1ea1c7=squel[_0x72c7('0x64')]()[_0x72c7('0x65')](_0x72c7('0x66'))[_0x72c7('0x67')](['phone','scheduledAt','ContactId',_0x72c7('0x68'),_0x72c7('0x69'),_0x72c7('0x6a'),_0x72c7('0x6b')],squel[_0x72c7('0x6c')]()[_0x72c7('0x6d')]('ANY_VALUE(calleridnum)',_0x72c7('0x6e'))['field'](_0x72c7('0x6f'),'scheduledAt')[_0x72c7('0x6d')](_0x72c7('0x70'),_0x72c7('0x71'))['field'](_0x72c7('0x72'),'ListId')[_0x72c7('0x6d')](_0x72c7('0x73'),_0x72c7('0x69'))[_0x72c7('0x6d')](_0x72c7('0x6f'),'createdAt')['field'](_0x72c7('0x6f'),'updatedAt')[_0x72c7('0x74')](_0x72c7('0x75'))[_0x72c7('0x40')](_0x72c7('0x76'),_0x86b6d3[_0x72c7('0x49')]['id']['toString']())[_0x72c7('0x40')]('state\x20=\x20?',_0x86b6d3[_0x72c7('0x2a')][_0x72c7('0x77')][_0x72c7('0x78')]())[_0x72c7('0x40')](_0x72c7('0x79'))[_0x72c7('0x40')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x72c7('0x6c')]()['field'](_0x72c7('0x6e'))['from'](_0x72c7('0x66'))['where'](_0x72c7('0x76'),_0x86b6d3[_0x72c7('0x49')]['id'][_0x72c7('0x78')]()))[_0x72c7('0x40')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x72c7('0x6c')]()[_0x72c7('0x6d')](_0x72c7('0x7a'))[_0x72c7('0x74')](_0x72c7('0x75'))[_0x72c7('0x40')](_0x72c7('0x76'),_0x86b6d3[_0x72c7('0x49')]['id']['toString']())[_0x72c7('0x40')]('state\x20=\x204'))[_0x72c7('0x7b')](_0x72c7('0x71')))[_0x72c7('0x78')]();return db[_0x72c7('0x50')]['query'](_0x1ea1c7);}return[];})[_0x72c7('0x23')](respondWithResult(_0x33ebd7,null))['catch'](handleError(_0x33ebd7,null));};exports[_0x72c7('0x7c')]=function(_0x122080,_0x3a1f06,_0x5a1309){return db[_0x72c7('0x7d')][_0x72c7('0x4b')]({'where':{'id':_0x122080[_0x72c7('0x49')]['id']}})[_0x72c7('0x23')](handleEntityNotFound(_0x3a1f06,null))[_0x72c7('0x23')](function(_0x550061){var _0x180b9e;if(_0x550061){_0x180b9e=squel['insert']()[_0x72c7('0x65')](_0x72c7('0x66'))[_0x72c7('0x67')]([_0x72c7('0x6e'),_0x72c7('0x7e'),_0x72c7('0x71'),'ListId',_0x72c7('0x7f'),_0x72c7('0x6a'),_0x72c7('0x6b')],squel[_0x72c7('0x6c')]()['field'](_0x72c7('0x80'),'phone')[_0x72c7('0x6d')](_0x72c7('0x6f'),'scheduledAt')[_0x72c7('0x6d')]('ANY_VALUE(ContactId)',_0x72c7('0x71'))['field'](_0x72c7('0x72'),_0x72c7('0x68'))['field']('ANY_VALUE(CampaignId)',_0x72c7('0x7f'))[_0x72c7('0x6d')](_0x72c7('0x6f'),_0x72c7('0x6a'))[_0x72c7('0x6d')]('NOW()',_0x72c7('0x6b'))[_0x72c7('0x74')]('cm_hopper_final')['where'](_0x72c7('0x81'),_0x122080[_0x72c7('0x49')]['id'][_0x72c7('0x78')]())['where'](_0x72c7('0x82'),_0x122080[_0x72c7('0x2a')][_0x72c7('0x77')][_0x72c7('0x78')]())[_0x72c7('0x40')](_0x72c7('0x79'))[_0x72c7('0x40')](_0x72c7('0x83'),squel['select']()[_0x72c7('0x6d')](_0x72c7('0x6e'))[_0x72c7('0x74')](_0x72c7('0x66'))[_0x72c7('0x40')](_0x72c7('0x81'),_0x122080[_0x72c7('0x49')]['id'][_0x72c7('0x78')]()))['where'](_0x72c7('0x83'),squel[_0x72c7('0x6c')]()[_0x72c7('0x6d')](_0x72c7('0x7a'))[_0x72c7('0x74')](_0x72c7('0x75'))[_0x72c7('0x40')](_0x72c7('0x81'),_0x122080[_0x72c7('0x49')]['id'][_0x72c7('0x78')]())[_0x72c7('0x40')](_0x72c7('0x84')))[_0x72c7('0x7b')](_0x72c7('0x71')))['toString']();return db['sequelize']['query'](_0x180b9e);}return[];})[_0x72c7('0x23')](respondWithResult(_0x3a1f06,null))[_0x72c7('0x48')](handleError(_0x3a1f06,null));};exports[_0x72c7('0x85')]=function(_0x3262f9,_0x4dd8a8,_0x4d055f){return db[_0x72c7('0x86')]['findOne']({'where':{'VoiceQueueId':_0x3262f9[_0x72c7('0x2a')]['VoiceQueueId'],'CampaignId':_0x3262f9[_0x72c7('0x2a')]['CampaignId'],'ContactId':_0x3262f9[_0x72c7('0x2a')]['ContactId']}})[_0x72c7('0x23')](handleEntityNotFound(_0x4dd8a8,null))['then'](function(_0x34047e){if(_0x34047e){return _0x34047e;}return null;})['then'](respondWithResult(_0x4dd8a8,null))[_0x72c7('0x48')](handleError(_0x4dd8a8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6e7da50..a7cd3fd 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 _0x8964=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0x8964,0x18b));var _0x4896=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x8964[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require(_0x4896('0x0'));var util=require('util');var logger=require(_0x4896('0x1'))(_0x4896('0x2'));var moment=require(_0x4896('0x3'));var BPromise=require(_0x4896('0x4'));var rp=require(_0x4896('0x5'));var fs=require('fs');var path=require(_0x4896('0x6'));var rimraf=require(_0x4896('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x4896('0x8')]=function(_0x46a308,_0x4c4e60){return _0x46a308['define'](_0x4896('0x9'),attributes,{'tableName':_0x4896('0xa'),'paranoid':![],'indexes':[{'name':_0x4896('0xb'),'fields':[_0x4896('0xb')]},{'name':_0x4896('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x989f=['define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','request-promise','path','rimraf','exports'];(function(_0x5c98f5,_0x193319){var _0x367b97=function(_0x5d80a0){while(--_0x5d80a0){_0x5c98f5['push'](_0x5c98f5['shift']());}};_0x367b97(++_0x193319);}(_0x989f,0x1c7));var _0xf989=function(_0x537807,_0x968846){_0x537807=_0x537807-0x0;var _0x3250a0=_0x989f[_0x537807];return _0x3250a0;};'use strict';var _=require(_0xf989('0x0'));var util=require(_0xf989('0x1'));var logger=require(_0xf989('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf989('0x3'));var fs=require('fs');var path=require(_0xf989('0x4'));var rimraf=require(_0xf989('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xf989('0x6')]=function(_0x2f03ae,_0x428c27){return _0x2f03ae[_0xf989('0x7')](_0xf989('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xf989('0x9'),'fields':['calleridnum']},{'name':_0xf989('0xa'),'fields':[_0xf989('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 b3e7a99..e44c58c 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 _0xe7d9=['CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','error','message','catch'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe7d9,0x1c1));var _0x9e7d=function(_0x34f9cf,_0x5d1273){_0x34f9cf=_0x34f9cf-0x0;var _0x2bfceb=_0xe7d9[_0x34f9cf];return _0x2bfceb;};'use strict';var _=require('lodash');var util=require(_0x9e7d('0x0'));var moment=require(_0x9e7d('0x1'));var BPromise=require(_0x9e7d('0x2'));var rs=require(_0x9e7d('0x3'));var fs=require('fs');var Redis=require(_0x9e7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e7d('0x5'))(_0x9e7d('0x6'));var config=require(_0x9e7d('0x7'));var jayson=require(_0x9e7d('0x8'));var client=jayson[_0x9e7d('0x9')][_0x9e7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e0ebd,_0x195fcd,_0x23096f){return new BPromise(function(_0x43063a,_0x58c461){return client[_0x9e7d('0xb')](_0x1e0ebd,_0x23096f)[_0x9e7d('0xc')](function(_0x5d1864){logger[_0x9e7d('0xd')](_0x9e7d('0xe'),_0x195fcd,_0x9e7d('0xf'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x195fcd,'request\x20sent',JSON['stringify'](_0x5d1864));if(_0x5d1864[_0x9e7d('0x10')]){if(_0x5d1864[_0x9e7d('0x10')]['code']===0x1f4){logger[_0x9e7d('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x195fcd,_0x5d1864[_0x9e7d('0x10')][_0x9e7d('0x11')]);return _0x58c461(_0x5d1864[_0x9e7d('0x10')][_0x9e7d('0x11')]);}logger[_0x9e7d('0x10')](_0x9e7d('0xe'),_0x195fcd,_0x5d1864[_0x9e7d('0x10')][_0x9e7d('0x11')]);return _0x43063a(_0x5d1864[_0x9e7d('0x10')][_0x9e7d('0x11')]);}else{logger['info'](_0x9e7d('0xe'),_0x195fcd,_0x9e7d('0xf'));_0x43063a(_0x5d1864['result'][_0x9e7d('0x11')]);}})[_0x9e7d('0x12')](function(_0x4e044c){logger['error'](_0x9e7d('0xe'),_0x195fcd,_0x4e044c);_0x58c461(_0x4e044c);});});}exports[_0x9e7d('0x13')]=function(_0x511237){var _0x3276b0=this;return new Promise(function(_0x2fb649,_0x34fda8){return db[_0x9e7d('0x14')][_0x9e7d('0x15')](_0x511237[_0x9e7d('0x16')],{'raw':_0x511237[_0x9e7d('0x17')]?_0x511237[_0x9e7d('0x17')][_0x9e7d('0x18')]===undefined?!![]:![]:!![]})[_0x9e7d('0xc')](function(_0x38463b){logger[_0x9e7d('0xd')](_0x9e7d('0x13'),_0x511237);logger['debug'](_0x9e7d('0x13'),_0x511237,JSON[_0x9e7d('0x19')](_0x38463b));_0x2fb649(_0x38463b);})['catch'](function(_0xe5e6cf){logger[_0x9e7d('0x10')](_0x9e7d('0x13'),_0xe5e6cf['message'],_0x511237);_0x34fda8(_0x3276b0[_0x9e7d('0x10')](0x1f4,_0xe5e6cf[_0x9e7d('0x11')]));});});}; \ No newline at end of file +var _0xdedf=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw','catch','lodash'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xdedf,0xf2));var _0xfded=function(_0x2feb24,_0x4ba759){_0x2feb24=_0x2feb24-0x0;var _0x50b1e4=_0xdedf[_0x2feb24];return _0x50b1e4;};'use strict';var _=require(_0xfded('0x0'));var util=require(_0xfded('0x1'));var moment=require(_0xfded('0x2'));var BPromise=require(_0xfded('0x3'));var rs=require(_0xfded('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfded('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfded('0x6'))(_0xfded('0x7'));var config=require('../../config/environment');var jayson=require(_0xfded('0x8'));var client=jayson[_0xfded('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18c0a9,_0xb196a3,_0x434dd0){return new BPromise(function(_0x34c426,_0x8621de){return client['request'](_0x18c0a9,_0x434dd0)[_0xfded('0xa')](function(_0x15b6e7){logger[_0xfded('0xb')](_0xfded('0xc'),_0xb196a3,_0xfded('0xd'));logger[_0xfded('0xe')](_0xfded('0xf'),_0xb196a3,_0xfded('0xd'),JSON[_0xfded('0x10')](_0x15b6e7));if(_0x15b6e7[_0xfded('0x11')]){if(_0x15b6e7[_0xfded('0x11')][_0xfded('0x12')]===0x1f4){logger['error'](_0xfded('0xc'),_0xb196a3,_0x15b6e7[_0xfded('0x11')]['message']);return _0x8621de(_0x15b6e7[_0xfded('0x11')][_0xfded('0x13')]);}logger[_0xfded('0x11')](_0xfded('0xc'),_0xb196a3,_0x15b6e7[_0xfded('0x11')][_0xfded('0x13')]);return _0x34c426(_0x15b6e7[_0xfded('0x11')]['message']);}else{logger['info'](_0xfded('0xc'),_0xb196a3,'request\x20sent');_0x34c426(_0x15b6e7[_0xfded('0x14')][_0xfded('0x13')]);}})['catch'](function(_0x53363f){logger[_0xfded('0x11')](_0xfded('0xc'),_0xb196a3,_0x53363f);_0x8621de(_0x53363f);});});}exports[_0xfded('0x15')]=function(_0x4bcde6){var _0x38583c=this;return new Promise(function(_0x5534cf,_0x26f5a4){return db[_0xfded('0x16')][_0xfded('0x17')](_0x4bcde6['body'],{'raw':_0x4bcde6['options']?_0x4bcde6[_0xfded('0x18')][_0xfded('0x19')]===undefined?!![]:![]:!![]})[_0xfded('0xa')](function(_0x18520c){logger[_0xfded('0xb')]('CreateCmHopperFinal',_0x4bcde6);logger[_0xfded('0xe')](_0xfded('0x15'),_0x4bcde6,JSON[_0xfded('0x10')](_0x18520c));_0x5534cf(_0x18520c);})[_0xfded('0x1a')](function(_0x1695cf){logger[_0xfded('0x11')]('CreateCmHopperFinal',_0x1695cf['message'],_0x4bcde6);_0x26f5a4(_0x38583c[_0xfded('0x11')](0x1f4,_0x1695cf[_0xfded('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index f413c5b..7a88859 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 _0x0df0=['/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','isAuthenticated','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperFinal.controller','get','index','/describe'];(function(_0x16dfa3,_0x118719){var _0x1209aa=function(_0x104df2){while(--_0x104df2){_0x16dfa3['push'](_0x16dfa3['shift']());}};_0x1209aa(++_0x118719);}(_0x0df0,0x1d0));var _0x00df=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0x0df0[_0x45b1ba];return _0x145ddb;};'use strict';var multer=require(_0x00df('0x0'));var util=require(_0x00df('0x1'));var path=require(_0x00df('0x2'));var timeout=require(_0x00df('0x3'));var express=require(_0x00df('0x4'));var router=express[_0x00df('0x5')]();var fs_extra=require(_0x00df('0x6'));var auth=require(_0x00df('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x00df('0x8'));router[_0x00df('0x9')]('/',auth['isAuthenticated'](),controller[_0x00df('0xa')]);router['get'](_0x00df('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x00df('0x9')](_0x00df('0xc'),auth['isAuthenticated'](),controller[_0x00df('0xd')]);router[_0x00df('0x9')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x00df('0xe')]);router[_0x00df('0x9')](_0x00df('0xf'),auth['isAuthenticated'](),controller[_0x00df('0x10')]);router[_0x00df('0x11')](_0x00df('0x12'),auth['isAuthenticated'](),controller[_0x00df('0x13')]);router[_0x00df('0x11')](_0x00df('0x14'),auth[_0x00df('0x15')](),controller[_0x00df('0x16')]);router[_0x00df('0x11')](_0x00df('0x17'),auth[_0x00df('0x15')](),controller[_0x00df('0x18')]);router[_0x00df('0x19')](_0x00df('0xc'),auth['isAuthenticated'](),controller[_0x00df('0x1a')]);module[_0x00df('0x1b')]=router; \ No newline at end of file +var _0xc8d1=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xc8d1,0x178));var _0x1c8d=function(_0x2e2857,_0x2c8066){_0x2e2857=_0x2e2857-0x0;var _0x294569=_0xc8d1[_0x2e2857];return _0x294569;};'use strict';var multer=require(_0x1c8d('0x0'));var util=require(_0x1c8d('0x1'));var path=require(_0x1c8d('0x2'));var timeout=require(_0x1c8d('0x3'));var express=require(_0x1c8d('0x4'));var router=express['Router']();var fs_extra=require(_0x1c8d('0x5'));var auth=require(_0x1c8d('0x6'));var interaction=require(_0x1c8d('0x7'));var config=require(_0x1c8d('0x8'));var controller=require(_0x1c8d('0x9'));router[_0x1c8d('0xa')]('/',auth[_0x1c8d('0xb')](),controller[_0x1c8d('0xc')]);router[_0x1c8d('0xa')](_0x1c8d('0xd'),auth[_0x1c8d('0xb')](),controller[_0x1c8d('0xe')]);router['get'](_0x1c8d('0xf'),auth[_0x1c8d('0xb')](),controller[_0x1c8d('0x10')]);router['get'](_0x1c8d('0x11'),auth[_0x1c8d('0xb')](),controller[_0x1c8d('0x12')]);router[_0x1c8d('0xa')](_0x1c8d('0x13'),auth[_0x1c8d('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x1c8d('0x14')]('/voice/queue/moveContacts/:id',auth[_0x1c8d('0xb')](),controller[_0x1c8d('0x15')]);router[_0x1c8d('0x14')](_0x1c8d('0x16'),auth[_0x1c8d('0xb')](),controller[_0x1c8d('0x17')]);router[_0x1c8d('0x14')](_0x1c8d('0x18'),auth['isAuthenticated'](),controller[_0x1c8d('0x19')]);router[_0x1c8d('0x1a')](_0x1c8d('0xf'),auth['isAuthenticated'](),controller[_0x1c8d('0x1b')]);module[_0x1c8d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index c793917..d0612dc 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 _0x4ff2=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x2dd46a,_0x414b6c){var _0x1440c4=function(_0x4bc9a6){while(--_0x4bc9a6){_0x2dd46a['push'](_0x2dd46a['shift']());}};_0x1440c4(++_0x414b6c);}(_0x4ff2,0x128));var _0x24ff=function(_0x4b9298,_0x40ddcf){_0x4b9298=_0x4b9298-0x0;var _0x369af0=_0x4ff2[_0x4b9298];return _0x369af0;};'use strict';var Sequelize=require(_0x24ff('0x0'));module[_0x24ff('0x1')]={'state':{'type':Sequelize[_0x24ff('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x24ff('0x3')]},'countbusyretry':{'type':Sequelize[_0x24ff('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x24ff('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x24ff('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x24ff('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x24ff('0x4')]},'originatecalleridname':{'type':Sequelize[_0x24ff('0x4')]},'calleridnum':{'type':Sequelize[_0x24ff('0x4')]},'calleridname':{'type':Sequelize[_0x24ff('0x4')]},'starttime':{'type':Sequelize[_0x24ff('0x3')]},'responsetime':{'type':Sequelize[_0x24ff('0x3')]},'answertime':{'type':Sequelize[_0x24ff('0x3')]},'droptime':{'type':Sequelize[_0x24ff('0x3')]},'endtime':{'type':Sequelize[_0x24ff('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x24ff('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x24ff('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x24ff('0x4')]},'campaign':{'type':Sequelize[_0x24ff('0x4')]},'campaigntype':{'type':Sequelize[_0x24ff('0x4')]},'membername':{'type':Sequelize[_0x24ff('0x4')]},'reason':{'type':Sequelize[_0x24ff('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x24ff('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x24ff('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x24ff('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x24ff('0x3')]},'recallme':{'type':Sequelize[_0x24ff('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x24ff('0x3')]},'edited':{'type':Sequelize[_0x24ff('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x24ff('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x24ff('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x24ff('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x24ff('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70c6=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0xb33bf1,_0x55f7d8){var _0x4d21d8=function(_0x10ffac){while(--_0x10ffac){_0xb33bf1['push'](_0xb33bf1['shift']());}};_0x4d21d8(++_0x55f7d8);}(_0x70c6,0x18d));var _0x670c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x70c6[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x670c('0x0'));module[_0x670c('0x1')]={'state':{'type':Sequelize[_0x670c('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x670c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x670c('0x3')]},'calleridnum':{'type':Sequelize[_0x670c('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x670c('0x4')]},'responsetime':{'type':Sequelize[_0x670c('0x4')]},'answertime':{'type':Sequelize[_0x670c('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x670c('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x670c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x670c('0x3')]},'campaign':{'type':Sequelize[_0x670c('0x3')]},'campaigntype':{'type':Sequelize[_0x670c('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x670c('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x670c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x670c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x670c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x670c('0x4')]},'recallme':{'type':Sequelize[_0x670c('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x670c('0x4')]},'edited':{'type':Sequelize[_0x670c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x670c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x670c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x670c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x670c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x670c('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 754aa0c..31cbf15 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 _0x0fda=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','CmHopperHistory','includeAll','include','rows','catch','show','rawAttributes','create','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','render','body','contact','message','agent','interaction','index','key','map','name','query','keys','filters'];(function(_0x4f57e6,_0x5dbcad){var _0x23f04b=function(_0x47523c){while(--_0x47523c){_0x4f57e6['push'](_0x4f57e6['shift']());}};_0x23f04b(++_0x5dbcad);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x22ce12,_0x175b5f){_0x22ce12=_0x22ce12-0x0;var _0x480ad1=_0x0fda[_0x22ce12];return _0x480ad1;};'use strict';var emlformat=require(_0xa0fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0fd('0x1'));var jsonpatch=require(_0xa0fd('0x2'));var rp=require(_0xa0fd('0x3'));var moment=require(_0xa0fd('0x4'));var BPromise=require(_0xa0fd('0x5'));var Mustache=require(_0xa0fd('0x6'));var util=require(_0xa0fd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa0fd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0fd('0x9'));var squel=require(_0xa0fd('0xa'));var crypto=require(_0xa0fd('0xb'));var jsforce=require(_0xa0fd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa0fd('0x8'));var querystring=require(_0xa0fd('0xd'));var Papa=require(_0xa0fd('0xe'));var Redis=require(_0xa0fd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa0fd('0x10'));var as=require(_0xa0fd('0x11'));var hardwareService=require(_0xa0fd('0x12'));var logger=require('../../config/logger')(_0xa0fd('0x13'));var utils=require(_0xa0fd('0x14'));var config=require(_0xa0fd('0x15'));var licenseUtil=require(_0xa0fd('0x16'));var db=require(_0xa0fd('0x17'))['db'];function respondWithStatusCode(_0x4d5c32,_0x490112){_0x490112=_0x490112||0xcc;return function(_0x32dcee){if(_0x32dcee){return _0x4d5c32[_0xa0fd('0x18')](_0x490112);}return _0x4d5c32['status'](_0x490112)[_0xa0fd('0x19')]();};}function respondWithResult(_0x8a67a5,_0x11e4eb){_0x11e4eb=_0x11e4eb||0xc8;return function(_0x1e4a48){if(_0x1e4a48){return _0x8a67a5[_0xa0fd('0x1a')](_0x11e4eb)[_0xa0fd('0x1b')](_0x1e4a48);}};}function respondWithFilteredResult(_0x2811c0,_0x4fe62c){return function(_0x1c6ffc){if(_0x1c6ffc){var _0x326ba8=typeof _0x4fe62c['offset']==='undefined'&&typeof _0x4fe62c[_0xa0fd('0x1c')]===_0xa0fd('0x1d');var _0x5d2d7b=_0x1c6ffc[_0xa0fd('0x1e')];var _0x22a876=_0x326ba8?0x0:_0x4fe62c[_0xa0fd('0x1f')];var _0x5073a8=_0x326ba8?_0x1c6ffc['count']:_0x4fe62c[_0xa0fd('0x1f')]+_0x4fe62c['limit'];var _0x40e288;if(_0x5073a8>=_0x5d2d7b){_0x5073a8=_0x5d2d7b;_0x40e288=0xc8;}else{_0x40e288=0xce;}_0x2811c0[_0xa0fd('0x1a')](_0x40e288);return _0x2811c0[_0xa0fd('0x20')](_0xa0fd('0x21'),_0x22a876+'-'+_0x5073a8+'/'+_0x5d2d7b)[_0xa0fd('0x1b')](_0x1c6ffc);}return null;};}function patchUpdates(_0x2273f4){return function(_0x113059){try{jsonpatch['apply'](_0x113059,_0x2273f4,!![]);}catch(_0x166934){return BPromise[_0xa0fd('0x22')](_0x166934);}return _0x113059[_0xa0fd('0x23')]();};}function saveUpdates(_0x18eaa8,_0x26e3a4){return function(_0x3af329){if(_0x3af329){return _0x3af329[_0xa0fd('0x24')](_0x18eaa8)[_0xa0fd('0x25')](function(_0xda6f53){return _0xda6f53;});}return null;};}function removeEntity(_0x13fc62,_0x28dbda){return function(_0x310279){if(_0x310279){return _0x310279[_0xa0fd('0x26')]()['then'](function(){_0x13fc62[_0xa0fd('0x1a')](0xcc)[_0xa0fd('0x19')]();});}};}function handleEntityNotFound(_0x541118,_0x197ae5){return function(_0x3cd5b0){if(!_0x3cd5b0){_0x541118['sendStatus'](0x194);}return _0x3cd5b0;};}function handleError(_0x5bb0ee,_0x2e9b0d){_0x2e9b0d=_0x2e9b0d||0x1f4;return function(_0x267899){logger['error'](_0x267899['stack']);if(_0x267899['name']){delete _0x267899['name'];}_0x5bb0ee[_0xa0fd('0x1a')](_0x2e9b0d)['send'](_0x267899);};}function getMustacheRender(_0x3212d5,_0x1db300){return Mustache[_0xa0fd('0x27')](_0x3212d5,_['merge'](_0x1db300[_0xa0fd('0x28')],{'contact':_0x1db300[_0xa0fd('0x29')],'message':_0x1db300[_0xa0fd('0x2a')],'agent':_0x1db300[_0xa0fd('0x2b')],'interaction':_0x1db300[_0xa0fd('0x2c')],'account':_0x1db300['account']}))||'';}exports[_0xa0fd('0x2d')]=function(_0xf69d1c,_0x72c222){var _0x2993aa={},_0x5b4581={},_0x33785f={'count':0x0,'rows':[]};var _0x2c5516=_['map'](db['CmHopperHistory']['rawAttributes'],function(_0x1fc249){return{'name':_0x1fc249['fieldName'],'type':_0x1fc249['type'][_0xa0fd('0x2e')]};});_0x5b4581['model']=_[_0xa0fd('0x2f')](_0x2c5516,_0xa0fd('0x30'));_0x5b4581[_0xa0fd('0x31')]=_[_0xa0fd('0x32')](_0xf69d1c[_0xa0fd('0x31')]);_0x5b4581[_0xa0fd('0x33')]=_[_0xa0fd('0x34')](_0x5b4581[_0xa0fd('0x35')],_0x5b4581['query']);_0x2993aa[_0xa0fd('0x36')]=_['intersection'](_0x5b4581[_0xa0fd('0x35')],qs['fields'](_0xf69d1c['query'][_0xa0fd('0x37')]));_0x2993aa['attributes']=_0x2993aa[_0xa0fd('0x36')][_0xa0fd('0x38')]?_0x2993aa[_0xa0fd('0x36')]:_0x5b4581[_0xa0fd('0x35')];if(!_0xf69d1c['query'][_0xa0fd('0x39')](_0xa0fd('0x3a'))){_0x2993aa[_0xa0fd('0x1c')]=qs[_0xa0fd('0x1c')](_0xf69d1c[_0xa0fd('0x31')][_0xa0fd('0x1c')]);_0x2993aa[_0xa0fd('0x1f')]=qs['offset'](_0xf69d1c['query'][_0xa0fd('0x1f')]);}_0x2993aa[_0xa0fd('0x3b')]=qs[_0xa0fd('0x3c')](_0xf69d1c[_0xa0fd('0x31')]['sort']);_0x2993aa[_0xa0fd('0x3d')]=qs[_0xa0fd('0x33')](_[_0xa0fd('0x3e')](_0xf69d1c[_0xa0fd('0x31')],_0x5b4581[_0xa0fd('0x33')]),_0x2c5516);if(_0xf69d1c['query'][_0xa0fd('0x3f')]){_0x2993aa[_0xa0fd('0x3d')]=_['merge'](_0x2993aa['where'],{'$or':_[_0xa0fd('0x2f')](_0x2c5516,function(_0x163023){if(_0x163023[_0xa0fd('0x40')]!==_0xa0fd('0x41')){var _0xaaf6c={};_0xaaf6c[_0x163023[_0xa0fd('0x30')]]={'$like':'%'+_0xf69d1c[_0xa0fd('0x31')][_0xa0fd('0x3f')]+'%'};return _0xaaf6c;}})});}_0x2993aa=_[_0xa0fd('0x42')]({},_0x2993aa,_0xf69d1c[_0xa0fd('0x43')]);var _0x12d66a={'where':_0x2993aa[_0xa0fd('0x3d')]};return db[_0xa0fd('0x44')][_0xa0fd('0x1e')](_0x12d66a)[_0xa0fd('0x25')](function(_0x515449){_0x33785f['count']=_0x515449;if(_0xf69d1c['query'][_0xa0fd('0x45')]){_0x2993aa[_0xa0fd('0x46')]=[{'all':!![]}];}return db[_0xa0fd('0x44')]['findAll'](_0x2993aa);})[_0xa0fd('0x25')](function(_0x43ade9){_0x33785f[_0xa0fd('0x47')]=_0x43ade9;return _0x33785f;})['then'](respondWithFilteredResult(_0x72c222,_0x2993aa))[_0xa0fd('0x48')](handleError(_0x72c222,null));};exports[_0xa0fd('0x49')]=function(_0x1ca905,_0x3b9e38){var _0x2a35fa={'raw':!![],'where':{'id':_0x1ca905['params']['id']}},_0x1a574d={};_0x1a574d[_0xa0fd('0x35')]=_[_0xa0fd('0x32')](db[_0xa0fd('0x44')][_0xa0fd('0x4a')]);_0x1a574d[_0xa0fd('0x31')]=_[_0xa0fd('0x32')](_0x1ca905['query']);_0x1a574d[_0xa0fd('0x33')]=_[_0xa0fd('0x34')](_0x1a574d[_0xa0fd('0x35')],_0x1a574d[_0xa0fd('0x31')]);_0x2a35fa[_0xa0fd('0x36')]=_['intersection'](_0x1a574d['model'],qs[_0xa0fd('0x37')](_0x1ca905[_0xa0fd('0x31')][_0xa0fd('0x37')]));_0x2a35fa[_0xa0fd('0x36')]=_0x2a35fa[_0xa0fd('0x36')]['length']?_0x2a35fa[_0xa0fd('0x36')]:_0x1a574d[_0xa0fd('0x35')];if(_0x1ca905[_0xa0fd('0x31')][_0xa0fd('0x45')]){_0x2a35fa[_0xa0fd('0x46')]=[{'all':!![]}];}_0x2a35fa=_[_0xa0fd('0x42')]({},_0x2a35fa,_0x1ca905['options']);return db['CmHopperHistory']['find'](_0x2a35fa)[_0xa0fd('0x25')](handleEntityNotFound(_0x3b9e38,null))['then'](respondWithResult(_0x3b9e38,null))['catch'](handleError(_0x3b9e38,null));};exports[_0xa0fd('0x4b')]=function(_0x504a0a,_0x357324){return db[_0xa0fd('0x44')]['create'](_0x504a0a['body'],{})[_0xa0fd('0x25')](respondWithResult(_0x357324,0xc9))[_0xa0fd('0x48')](handleError(_0x357324,null));};exports[_0xa0fd('0x4c')]=function(_0x167503,_0xdd9a85){return db[_0xa0fd('0x44')]['describe']()['then'](respondWithResult(_0xdd9a85,null))['catch'](handleError(_0xdd9a85,null));};exports['update']=function(_0x2f21d7,_0x43fc4a){if(_0x2f21d7[_0xa0fd('0x28')][_0xa0fd('0x4d')]){delete _0x2f21d7[_0xa0fd('0x28')]['uniqueid'];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x2f21d7['params']['id']}})['then'](handleEntityNotFound(_0x43fc4a,null))[_0xa0fd('0x25')](saveUpdates(_0x2f21d7[_0xa0fd('0x28')],null))[_0xa0fd('0x25')](respondWithResult(_0x43fc4a,null))[_0xa0fd('0x48')](handleError(_0x43fc4a,null));}; \ No newline at end of file +var _0x0bde=['map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','limit','order','sort','where','filter','options','include','findAll','rows','catch','params','includeAll','find','create','describe','update','uniqueid','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','stack','name','render','merge','body','contact','message','agent','account','index'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x0bde,0x110));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xe0bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0bd('0x1'));var jsonpatch=require(_0xe0bd('0x2'));var rp=require('request-promise');var moment=require(_0xe0bd('0x3'));var BPromise=require(_0xe0bd('0x4'));var Mustache=require(_0xe0bd('0x5'));var util=require('util');var path=require(_0xe0bd('0x6'));var sox=require(_0xe0bd('0x7'));var csv=require(_0xe0bd('0x8'));var ejs=require(_0xe0bd('0x9'));var fs=require('fs');var fs_extra=require(_0xe0bd('0xa'));var _=require(_0xe0bd('0xb'));var squel=require(_0xe0bd('0xc'));var crypto=require(_0xe0bd('0xd'));var jsforce=require(_0xe0bd('0xe'));var deskjs=require(_0xe0bd('0xf'));var toCsv=require(_0xe0bd('0x8'));var querystring=require(_0xe0bd('0x10'));var Papa=require(_0xe0bd('0x11'));var Redis=require('ioredis');var authService=require(_0xe0bd('0x12'));var qs=require(_0xe0bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0bd('0x14'));var logger=require('../../config/logger')(_0xe0bd('0x15'));var utils=require(_0xe0bd('0x16'));var config=require(_0xe0bd('0x17'));var licenseUtil=require(_0xe0bd('0x18'));var db=require(_0xe0bd('0x19'))['db'];function respondWithStatusCode(_0x16c3a9,_0x1905b2){_0x1905b2=_0x1905b2||0xcc;return function(_0x500a9e){if(_0x500a9e){return _0x16c3a9[_0xe0bd('0x1a')](_0x1905b2);}return _0x16c3a9[_0xe0bd('0x1b')](_0x1905b2)[_0xe0bd('0x1c')]();};}function respondWithResult(_0x5c76f1,_0x479438){_0x479438=_0x479438||0xc8;return function(_0x48afde){if(_0x48afde){return _0x5c76f1[_0xe0bd('0x1b')](_0x479438)[_0xe0bd('0x1d')](_0x48afde);}};}function respondWithFilteredResult(_0x3f5ef7,_0x3042e1){return function(_0x361429){if(_0x361429){var _0x302f5f=typeof _0x3042e1[_0xe0bd('0x1e')]===_0xe0bd('0x1f')&&typeof _0x3042e1['limit']==='undefined';var _0x2d2ba3=_0x361429[_0xe0bd('0x20')];var _0x1c4533=_0x302f5f?0x0:_0x3042e1[_0xe0bd('0x1e')];var _0xa6be32=_0x302f5f?_0x361429[_0xe0bd('0x20')]:_0x3042e1['offset']+_0x3042e1['limit'];var _0x29bd21;if(_0xa6be32>=_0x2d2ba3){_0xa6be32=_0x2d2ba3;_0x29bd21=0xc8;}else{_0x29bd21=0xce;}_0x3f5ef7[_0xe0bd('0x1b')](_0x29bd21);return _0x3f5ef7[_0xe0bd('0x21')](_0xe0bd('0x22'),_0x1c4533+'-'+_0xa6be32+'/'+_0x2d2ba3)[_0xe0bd('0x1d')](_0x361429);}return null;};}function patchUpdates(_0x154480){return function(_0x3dbd98){try{jsonpatch['apply'](_0x3dbd98,_0x154480,!![]);}catch(_0x5ad8bf){return BPromise[_0xe0bd('0x23')](_0x5ad8bf);}return _0x3dbd98[_0xe0bd('0x24')]();};}function saveUpdates(_0x3927ab,_0xdcb789){return function(_0x290c1e){if(_0x290c1e){return _0x290c1e['update'](_0x3927ab)[_0xe0bd('0x25')](function(_0x4795ac){return _0x4795ac;});}return null;};}function removeEntity(_0x242cbe,_0x296f64){return function(_0x3f24b6){if(_0x3f24b6){return _0x3f24b6['destroy']()[_0xe0bd('0x25')](function(){_0x242cbe[_0xe0bd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ca10,_0x5e6496){return function(_0x2debcb){if(!_0x2debcb){_0x41ca10['sendStatus'](0x194);}return _0x2debcb;};}function handleError(_0x198a1c,_0x72e284){_0x72e284=_0x72e284||0x1f4;return function(_0x3c851d){logger['error'](_0x3c851d[_0xe0bd('0x26')]);if(_0x3c851d['name']){delete _0x3c851d[_0xe0bd('0x27')];}_0x198a1c[_0xe0bd('0x1b')](_0x72e284)['send'](_0x3c851d);};}function getMustacheRender(_0x54bc12,_0x273b95){return Mustache[_0xe0bd('0x28')](_0x54bc12,_[_0xe0bd('0x29')](_0x273b95[_0xe0bd('0x2a')],{'contact':_0x273b95[_0xe0bd('0x2b')],'message':_0x273b95[_0xe0bd('0x2c')],'agent':_0x273b95[_0xe0bd('0x2d')],'interaction':_0x273b95['interaction'],'account':_0x273b95[_0xe0bd('0x2e')]}))||'';}exports[_0xe0bd('0x2f')]=function(_0x52329b,_0x3dba6a){var _0x2287ba={},_0x1aced9={},_0x553919={'count':0x0,'rows':[]};var _0x1c396f=_[_0xe0bd('0x30')](db[_0xe0bd('0x31')][_0xe0bd('0x32')],function(_0x3d8ec4){return{'name':_0x3d8ec4[_0xe0bd('0x33')],'type':_0x3d8ec4[_0xe0bd('0x34')][_0xe0bd('0x35')]};});_0x1aced9['model']=_['map'](_0x1c396f,_0xe0bd('0x27'));_0x1aced9[_0xe0bd('0x36')]=_[_0xe0bd('0x37')](_0x52329b[_0xe0bd('0x36')]);_0x1aced9[_0xe0bd('0x38')]=_['intersection'](_0x1aced9['model'],_0x1aced9['query']);_0x2287ba[_0xe0bd('0x39')]=_[_0xe0bd('0x3a')](_0x1aced9[_0xe0bd('0x3b')],qs[_0xe0bd('0x3c')](_0x52329b[_0xe0bd('0x36')][_0xe0bd('0x3c')]));_0x2287ba['attributes']=_0x2287ba[_0xe0bd('0x39')][_0xe0bd('0x3d')]?_0x2287ba[_0xe0bd('0x39')]:_0x1aced9['model'];if(!_0x52329b[_0xe0bd('0x36')][_0xe0bd('0x3e')]('nolimit')){_0x2287ba[_0xe0bd('0x3f')]=qs[_0xe0bd('0x3f')](_0x52329b[_0xe0bd('0x36')]['limit']);_0x2287ba[_0xe0bd('0x1e')]=qs['offset'](_0x52329b[_0xe0bd('0x36')][_0xe0bd('0x1e')]);}_0x2287ba[_0xe0bd('0x40')]=qs[_0xe0bd('0x41')](_0x52329b['query'][_0xe0bd('0x41')]);_0x2287ba[_0xe0bd('0x42')]=qs[_0xe0bd('0x38')](_['pick'](_0x52329b['query'],_0x1aced9[_0xe0bd('0x38')]),_0x1c396f);if(_0x52329b[_0xe0bd('0x36')][_0xe0bd('0x43')]){_0x2287ba['where']=_['merge'](_0x2287ba[_0xe0bd('0x42')],{'$or':_[_0xe0bd('0x30')](_0x1c396f,function(_0x324bb2){if(_0x324bb2[_0xe0bd('0x34')]!=='VIRTUAL'){var _0x276ed3={};_0x276ed3[_0x324bb2[_0xe0bd('0x27')]]={'$like':'%'+_0x52329b[_0xe0bd('0x36')]['filter']+'%'};return _0x276ed3;}})});}_0x2287ba=_['merge']({},_0x2287ba,_0x52329b[_0xe0bd('0x44')]);var _0x414bd2={'where':_0x2287ba[_0xe0bd('0x42')]};return db[_0xe0bd('0x31')]['count'](_0x414bd2)[_0xe0bd('0x25')](function(_0x41597a){_0x553919[_0xe0bd('0x20')]=_0x41597a;if(_0x52329b['query']['includeAll']){_0x2287ba[_0xe0bd('0x45')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe0bd('0x46')](_0x2287ba);})[_0xe0bd('0x25')](function(_0x4a5ecc){_0x553919[_0xe0bd('0x47')]=_0x4a5ecc;return _0x553919;})[_0xe0bd('0x25')](respondWithFilteredResult(_0x3dba6a,_0x2287ba))[_0xe0bd('0x48')](handleError(_0x3dba6a,null));};exports['show']=function(_0x340e81,_0x461be2){var _0x3eb213={'raw':!![],'where':{'id':_0x340e81[_0xe0bd('0x49')]['id']}},_0x3ba66c={};_0x3ba66c[_0xe0bd('0x3b')]=_[_0xe0bd('0x37')](db[_0xe0bd('0x31')]['rawAttributes']);_0x3ba66c[_0xe0bd('0x36')]=_[_0xe0bd('0x37')](_0x340e81[_0xe0bd('0x36')]);_0x3ba66c[_0xe0bd('0x38')]=_[_0xe0bd('0x3a')](_0x3ba66c[_0xe0bd('0x3b')],_0x3ba66c[_0xe0bd('0x36')]);_0x3eb213[_0xe0bd('0x39')]=_['intersection'](_0x3ba66c[_0xe0bd('0x3b')],qs[_0xe0bd('0x3c')](_0x340e81[_0xe0bd('0x36')][_0xe0bd('0x3c')]));_0x3eb213[_0xe0bd('0x39')]=_0x3eb213['attributes'][_0xe0bd('0x3d')]?_0x3eb213['attributes']:_0x3ba66c['model'];if(_0x340e81['query'][_0xe0bd('0x4a')]){_0x3eb213['include']=[{'all':!![]}];}_0x3eb213=_['merge']({},_0x3eb213,_0x340e81[_0xe0bd('0x44')]);return db[_0xe0bd('0x31')][_0xe0bd('0x4b')](_0x3eb213)[_0xe0bd('0x25')](handleEntityNotFound(_0x461be2,null))[_0xe0bd('0x25')](respondWithResult(_0x461be2,null))[_0xe0bd('0x48')](handleError(_0x461be2,null));};exports[_0xe0bd('0x4c')]=function(_0x1c4464,_0x137bed){return db[_0xe0bd('0x31')]['create'](_0x1c4464[_0xe0bd('0x2a')],{})['then'](respondWithResult(_0x137bed,0xc9))['catch'](handleError(_0x137bed,null));};exports[_0xe0bd('0x4d')]=function(_0x292296,_0xbe9db7){return db['CmHopperHistory'][_0xe0bd('0x4d')]()[_0xe0bd('0x25')](respondWithResult(_0xbe9db7,null))[_0xe0bd('0x48')](handleError(_0xbe9db7,null));};exports[_0xe0bd('0x4e')]=function(_0x1e4698,_0x3ae70c){if(_0x1e4698[_0xe0bd('0x2a')][_0xe0bd('0x4f')]){delete _0x1e4698[_0xe0bd('0x2a')][_0xe0bd('0x4f')];}return db[_0xe0bd('0x31')][_0xe0bd('0x4b')]({'where':{'uniqueid':_0x1e4698['params']['id']}})[_0xe0bd('0x25')](handleEntityNotFound(_0x3ae70c,null))[_0xe0bd('0x25')](saveUpdates(_0x1e4698['body'],null))['then'](respondWithResult(_0x3ae70c,null))['catch'](handleError(_0x3ae70c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index acd34cd..6577eb2 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 _0x81d3=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x17861c,_0x18818e){var _0x61bfe4=function(_0xecbe91){while(--_0xecbe91){_0x17861c['push'](_0x17861c['shift']());}};_0x61bfe4(++_0x18818e);}(_0x81d3,0xd9));var _0x381d=function(_0x5df789,_0x1800f6){_0x5df789=_0x5df789-0x0;var _0x27b992=_0x81d3[_0x5df789];return _0x27b992;};'use strict';var _=require(_0x381d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x381d('0x1'));var moment=require(_0x381d('0x2'));var BPromise=require(_0x381d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x381d('0x4'));var rimraf=require(_0x381d('0x5'));var config=require(_0x381d('0x6'));var attributes=require(_0x381d('0x7'));module[_0x381d('0x8')]=function(_0x223c6c,_0x395e47){return _0x223c6c[_0x381d('0x9')](_0x381d('0xa'),attributes,{'tableName':_0x381d('0xb'),'paranoid':![],'indexes':[{'name':_0x381d('0xc'),'fields':['endtime']},{'name':_0x381d('0xd'),'fields':[_0x381d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x228e=['moment','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x228e,0x107));var _0xe228=function(_0x3c3662,_0x39d5c7){_0x3c3662=_0x3c3662-0x0;var _0x32ef30=_0x228e[_0x3c3662];return _0x32ef30;};'use strict';var _=require('lodash');var util=require(_0xe228('0x0'));var logger=require(_0xe228('0x1'))(_0xe228('0x2'));var moment=require(_0xe228('0x3'));var BPromise=require('bluebird');var rp=require(_0xe228('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe228('0x5'));var config=require(_0xe228('0x6'));var attributes=require(_0xe228('0x7'));module[_0xe228('0x8')]=function(_0x57f754,_0x171a30){return _0x57f754[_0xe228('0x9')](_0xe228('0xa'),attributes,{'tableName':_0xe228('0xb'),'paranoid':![],'indexes':[{'name':_0xe228('0xc'),'fields':[_0xe228('0xc')]},{'name':_0xe228('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 1864869..e0681e3 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 _0x7503=['raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgTalktime','campaign','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options'];(function(_0x3588f0,_0x29d87e){var _0x30f95b=function(_0x3914f1){while(--_0x3914f1){_0x3588f0['push'](_0x3588f0['shift']());}};_0x30f95b(++_0x29d87e);}(_0x7503,0xb0));var _0x3750=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x7503[_0x5cc8b9];return _0x58892e;};'use strict';var _=require(_0x3750('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3750('0x1'));var rs=require(_0x3750('0x2'));var fs=require('fs');var Redis=require(_0x3750('0x3'));var db=require(_0x3750('0x4'))['db'];var utils=require(_0x3750('0x5'));var logger=require(_0x3750('0x6'))(_0x3750('0x7'));var config=require(_0x3750('0x8'));var jayson=require(_0x3750('0x9'));var client=jayson[_0x3750('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xba1cf3,_0x583e3f,_0x3085c7){return new BPromise(function(_0x3fd031,_0x4df5d2){return client[_0x3750('0xb')](_0xba1cf3,_0x3085c7)[_0x3750('0xc')](function(_0x37e4db){logger[_0x3750('0xd')](_0x3750('0xe'),_0x583e3f,_0x3750('0xf'));logger[_0x3750('0x10')](_0x3750('0x11'),_0x583e3f,'request\x20sent',JSON[_0x3750('0x12')](_0x37e4db));if(_0x37e4db[_0x3750('0x13')]){if(_0x37e4db[_0x3750('0x13')]['code']===0x1f4){logger[_0x3750('0x13')](_0x3750('0xe'),_0x583e3f,_0x37e4db[_0x3750('0x13')][_0x3750('0x14')]);return _0x4df5d2(_0x37e4db[_0x3750('0x13')][_0x3750('0x14')]);}logger[_0x3750('0x13')](_0x3750('0xe'),_0x583e3f,_0x37e4db[_0x3750('0x13')][_0x3750('0x14')]);return _0x3fd031(_0x37e4db['error']['message']);}else{logger[_0x3750('0xd')](_0x3750('0xe'),_0x583e3f,_0x3750('0xf'));_0x3fd031(_0x37e4db[_0x3750('0x15')]['message']);}})[_0x3750('0x16')](function(_0x124b1d){logger[_0x3750('0x13')](_0x3750('0xe'),_0x583e3f,_0x124b1d);_0x4df5d2(_0x124b1d);});});}exports[_0x3750('0x17')]=function(_0x23cd43){var _0x499393=this;return new Promise(function(_0x35b67a,_0x2e965f){return db[_0x3750('0x18')][_0x3750('0x19')](_0x23cd43[_0x3750('0x1a')],{'raw':_0x23cd43[_0x3750('0x1b')]?_0x23cd43[_0x3750('0x1b')][_0x3750('0x1c')]===undefined?!![]:![]:!![]})[_0x3750('0xc')](function(_0x200b13){logger['info'](_0x3750('0x17'),_0x23cd43);logger[_0x3750('0x10')]('CreateCmHopperHistory',_0x23cd43,JSON[_0x3750('0x12')](_0x200b13));_0x35b67a(_0x200b13);})[_0x3750('0x16')](function(_0x5d6f35){logger[_0x3750('0x13')](_0x3750('0x17'),_0x5d6f35[_0x3750('0x14')],_0x23cd43);_0x2e965f(_0x499393[_0x3750('0x13')](0x1f4,_0x5d6f35[_0x3750('0x14')]));});});};exports[_0x3750('0x1d')]=function(_0x50b3cb){var _0x4888e3=this;return new Promise(function(_0x4161e8,_0x3ea301){return db[_0x3750('0x18')][_0x3750('0x1e')]({'raw':_0x50b3cb['options']?_0x50b3cb[_0x3750('0x1b')][_0x3750('0x1c')]===undefined?!![]:![]:!![],'where':_0x50b3cb['options']?_0x50b3cb[_0x3750('0x1b')][_0x3750('0x1f')]||null:null,'attributes':[[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db['sequelize'][_0x3750('0x22')]('id')),_0x3750('0x23')],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db['sequelize']['fn']('IF',db[_0x3750('0x20')][_0x3750('0x24')](_0x3750('0x25')))),_0x3750('0x26')],[db['sequelize']['fn']('COUNT',db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')]['literal'](_0x3750('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')][_0x3750('0x24')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3750('0x28')],[db[_0x3750('0x20')]['fn'](_0x3750('0x29'),db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x3750('0x20')]['fn'](_0x3750('0x29'),db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')][_0x3750('0x24')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3750('0x2a')]]})[_0x3750('0xc')](function(_0x183c66){logger[_0x3750('0xd')](_0x3750('0x1d'),_0x50b3cb);logger[_0x3750('0x10')](_0x3750('0x1d'),_0x50b3cb,JSON[_0x3750('0x12')](_0x183c66));_0x4161e8(_0x183c66);})[_0x3750('0x16')](function(_0x5436e1){logger[_0x3750('0x13')](_0x3750('0x1d'),_0x5436e1[_0x3750('0x14')],_0x50b3cb);_0x3ea301(_0x4888e3[_0x3750('0x13')](0x1f4,_0x5436e1['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0xf6cd8b){var _0x4ef526=this;return new Promise(function(_0x2c9fc4,_0x459e8b){return db['CmHopperHistory']['findAll']({'raw':_0xf6cd8b[_0x3750('0x1b')]?_0xf6cd8b[_0x3750('0x1b')][_0x3750('0x1c')]===undefined?!![]:![]:!![],'where':_0xf6cd8b[_0x3750('0x1b')]?_0xf6cd8b[_0x3750('0x1b')][_0x3750('0x1f')]||null:null,'attributes':[[_0x3750('0x2b'),'name'],[db[_0x3750('0x20')]['fn']('COUNT',db[_0x3750('0x20')]['fn']('IF',db['sequelize'][_0x3750('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x3750('0x2c')],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')]['literal'](_0x3750('0x2d')))),_0x3750('0x2e')],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')][_0x3750('0x24')](_0x3750('0x25')))),'outboundAnswerCallsDay'],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db['sequelize']['fn']('IF',db[_0x3750('0x20')]['literal'](_0x3750('0x2f')))),_0x3750('0x30')],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')][_0x3750('0x24')](_0x3750('0x31')))),'outboundCongestionCallsDay'],[db[_0x3750('0x20')]['fn']('COUNT',db[_0x3750('0x20')]['fn']('IF',db['sequelize'][_0x3750('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3750('0x32')],[db['sequelize']['fn'](_0x3750('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3750('0x33')))),'outboundDropCallsDayCallersExit'],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')][_0x3750('0x24')](_0x3750('0x34')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x3750('0x21'),db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')][_0x3750('0x24')]('`state`\x20=\x2013,\x201,\x20null'))),_0x3750('0x35')],[db[_0x3750('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3750('0x20')][_0x3750('0x24')](_0x3750('0x36')))),_0x3750('0x37')],[db[_0x3750('0x20')]['fn']('COUNT',db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')][_0x3750('0x24')](_0x3750('0x38')))),'outboundRejectCallsDay'],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db[_0x3750('0x20')]['fn']('IF',db['sequelize'][_0x3750('0x24')](_0x3750('0x39')))),_0x3750('0x3a')],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db['sequelize']['fn']('IF',db[_0x3750('0x20')]['literal'](_0x3750('0x3b')))),_0x3750('0x3c')],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db['sequelize']['fn']('IF',db[_0x3750('0x20')][_0x3750('0x24')](_0x3750('0x3d')))),_0x3750('0x3e')]],'group':['campaign']})[_0x3750('0xc')](function(_0x38447a){logger[_0x3750('0xd')](_0x3750('0x3f'),_0xf6cd8b);logger[_0x3750('0x10')](_0x3750('0x3f'),_0xf6cd8b,JSON[_0x3750('0x12')](_0x38447a));_0x2c9fc4(_0x38447a);})[_0x3750('0x16')](function(_0x252176){logger[_0x3750('0x13')](_0x3750('0x3f'),_0x252176['message'],_0xf6cd8b);_0x459e8b(_0x4ef526['error'](0x1f4,_0x252176['message']));});});};exports[_0x3750('0x40')]=function(_0x2912a1){var _0x5bda5c=this;return new Promise(function(_0x310c37,_0x30dcfc){return db[_0x3750('0x18')][_0x3750('0x1e')]({'raw':_0x2912a1[_0x3750('0x1b')]?_0x2912a1['options'][_0x3750('0x1c')]===undefined?!![]:![]:!![],'where':_0x2912a1[_0x3750('0x1b')]?_0x2912a1['options'][_0x3750('0x1f')]||null:null,'attributes':[['campaign',_0x3750('0x41')],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db[_0x3750('0x20')]['col']('id')),_0x3750('0x42')],[db[_0x3750('0x20')]['fn'](_0x3750('0x21'),db[_0x3750('0x20')]['fn']('IF',db[_0x3750('0x20')]['literal'](_0x3750('0x25')))),_0x3750('0x43')]],'group':[_0x3750('0x2b')]})[_0x3750('0xc')](function(_0x5dd384){logger['info']('GetCampaignHopperHistory',_0x2912a1);logger[_0x3750('0x10')](_0x3750('0x40'),_0x2912a1,JSON[_0x3750('0x12')](_0x5dd384));_0x310c37(_0x5dd384);})[_0x3750('0x16')](function(_0xe4cff6){logger[_0x3750('0x13')](_0x3750('0x40'),_0xe4cff6[_0x3750('0x14')],_0x2912a1);_0x30dcfc(_0x5bda5c[_0x3750('0x13')](0x1f4,_0xe4cff6[_0x3750('0x14')]));});});}; \ No newline at end of file +var _0xb818=['findAll','where','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`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','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','CreateCmHopperHistory','CmHopperHistory','options','raw','AvgHandleTime','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','catch','GetVoiceQueueHopperHistory'];(function(_0x323ee1,_0x310eac){var _0x431c9b=function(_0x2571ba){while(--_0x2571ba){_0x323ee1['push'](_0x323ee1['shift']());}};_0x431c9b(++_0x310eac);}(_0xb818,0xa8));var _0x8b81=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb818[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x8b81('0x0'));var util=require(_0x8b81('0x1'));var moment=require(_0x8b81('0x2'));var BPromise=require(_0x8b81('0x3'));var rs=require(_0x8b81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8b81('0x5'));var logger=require(_0x8b81('0x6'))(_0x8b81('0x7'));var config=require(_0x8b81('0x8'));var jayson=require(_0x8b81('0x9'));var client=jayson[_0x8b81('0xa')][_0x8b81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16eba2,_0x58f219,_0x2bf666){return new BPromise(function(_0x79fbfd,_0x2ebc37){return client[_0x8b81('0xc')](_0x16eba2,_0x2bf666)[_0x8b81('0xd')](function(_0x1b0f0d){logger[_0x8b81('0xe')](_0x8b81('0xf'),_0x58f219,_0x8b81('0x10'));logger[_0x8b81('0x11')](_0x8b81('0x12'),_0x58f219,_0x8b81('0x10'),JSON['stringify'](_0x1b0f0d));if(_0x1b0f0d[_0x8b81('0x13')]){if(_0x1b0f0d[_0x8b81('0x13')]['code']===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x58f219,_0x1b0f0d['error']['message']);return _0x2ebc37(_0x1b0f0d[_0x8b81('0x13')][_0x8b81('0x14')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x58f219,_0x1b0f0d[_0x8b81('0x13')][_0x8b81('0x14')]);return _0x79fbfd(_0x1b0f0d[_0x8b81('0x13')]['message']);}else{logger[_0x8b81('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x58f219,'request\x20sent');_0x79fbfd(_0x1b0f0d[_0x8b81('0x15')][_0x8b81('0x14')]);}})['catch'](function(_0x59b698){logger[_0x8b81('0x13')](_0x8b81('0xf'),_0x58f219,_0x59b698);_0x2ebc37(_0x59b698);});});}exports[_0x8b81('0x16')]=function(_0x20d92a){var _0x46617d=this;return new Promise(function(_0x5c0d57,_0xc907f2){return db[_0x8b81('0x17')]['create'](_0x20d92a['body'],{'raw':_0x20d92a[_0x8b81('0x18')]?_0x20d92a['options'][_0x8b81('0x19')]===undefined?!![]:![]:!![]})[_0x8b81('0xd')](function(_0x4cc7b7){logger[_0x8b81('0xe')](_0x8b81('0x16'),_0x20d92a);logger[_0x8b81('0x11')](_0x8b81('0x16'),_0x20d92a,JSON['stringify'](_0x4cc7b7));_0x5c0d57(_0x4cc7b7);})['catch'](function(_0x3fef31){logger['error'](_0x8b81('0x16'),_0x3fef31[_0x8b81('0x14')],_0x20d92a);_0xc907f2(_0x46617d['error'](0x1f4,_0x3fef31[_0x8b81('0x14')]));});});};exports[_0x8b81('0x1a')]=function(_0x3aa7f1){var _0x307668=this;return new Promise(function(_0x5144db,_0x35ea75){return db['CmHopperHistory']['findAll']({'raw':_0x3aa7f1['options']?_0x3aa7f1['options'][_0x8b81('0x19')]===undefined?!![]:![]:!![],'where':_0x3aa7f1[_0x8b81('0x18')]?_0x3aa7f1[_0x8b81('0x18')]['where']||null:null,'attributes':[[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db['sequelize'][_0x8b81('0x1d')]('id')),_0x8b81('0x1e')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')][_0x8b81('0x1f')](_0x8b81('0x20')))),_0x8b81('0x21')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')][_0x8b81('0x1f')]('`state`\x20=\x2010,\x201,\x20null'))),_0x8b81('0x22')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db['sequelize']['fn']('IF',db[_0x8b81('0x1b')]['literal'](_0x8b81('0x23')))),_0x8b81('0x24')],[db[_0x8b81('0x1b')]['fn']('AVG',db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')]['literal'](_0x8b81('0x25')))),_0x8b81('0x26')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x27'),db['sequelize']['fn']('IF',db[_0x8b81('0x1b')][_0x8b81('0x1f')](_0x8b81('0x28')))),_0x8b81('0x29')]]})[_0x8b81('0xd')](function(_0x19d95d){logger[_0x8b81('0xe')]('AvgHandleTime',_0x3aa7f1);logger[_0x8b81('0x11')](_0x8b81('0x1a'),_0x3aa7f1,JSON[_0x8b81('0x2a')](_0x19d95d));_0x5144db(_0x19d95d);})[_0x8b81('0x2b')](function(_0x5eff0d){logger[_0x8b81('0x13')](_0x8b81('0x1a'),_0x5eff0d[_0x8b81('0x14')],_0x3aa7f1);_0x35ea75(_0x307668['error'](0x1f4,_0x5eff0d[_0x8b81('0x14')]));});});};exports[_0x8b81('0x2c')]=function(_0x42d1ee){var _0x17d25d=this;return new Promise(function(_0x4c381b,_0x49cc9a){return db[_0x8b81('0x17')][_0x8b81('0x2d')]({'raw':_0x42d1ee[_0x8b81('0x18')]?_0x42d1ee[_0x8b81('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x42d1ee[_0x8b81('0x18')]?_0x42d1ee['options'][_0x8b81('0x2e')]||null:null,'attributes':[['campaign',_0x8b81('0x2f')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')][_0x8b81('0x1f')](_0x8b81('0x30')))),'outboundNoSuchCallsDay'],[db[_0x8b81('0x1b')]['fn']('COUNT',db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')][_0x8b81('0x1f')](_0x8b81('0x31')))),_0x8b81('0x32')],[db[_0x8b81('0x1b')]['fn']('COUNT',db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')][_0x8b81('0x1f')](_0x8b81('0x20')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x8b81('0x33')))),_0x8b81('0x34')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db['sequelize']['fn']('IF',db[_0x8b81('0x1b')]['literal'](_0x8b81('0x35')))),'outboundCongestionCallsDay'],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')][_0x8b81('0x1f')](_0x8b81('0x36')))),_0x8b81('0x37')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')][_0x8b81('0x1f')](_0x8b81('0x38')))),_0x8b81('0x39')],[db[_0x8b81('0x1b')]['fn']('COUNT',db[_0x8b81('0x1b')]['fn']('IF',db['sequelize'][_0x8b81('0x1f')](_0x8b81('0x3a')))),_0x8b81('0x3b')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x8b81('0x3c')))),_0x8b81('0x3d')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x8b81('0x3e')))),'outboundOriginateFailureCallsDay'],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')][_0x8b81('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),_0x8b81('0x3f')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db['sequelize'][_0x8b81('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0x8b81('0x40')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db[_0x8b81('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x8b81('0x41')))),_0x8b81('0x42')]],'group':[_0x8b81('0x43')]})[_0x8b81('0xd')](function(_0x496d72){logger[_0x8b81('0xe')](_0x8b81('0x2c'),_0x42d1ee);logger[_0x8b81('0x11')](_0x8b81('0x2c'),_0x42d1ee,JSON['stringify'](_0x496d72));_0x4c381b(_0x496d72);})[_0x8b81('0x2b')](function(_0x4c2da6){logger[_0x8b81('0x13')](_0x8b81('0x2c'),_0x4c2da6['message'],_0x42d1ee);_0x49cc9a(_0x17d25d['error'](0x1f4,_0x4c2da6[_0x8b81('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x50ba40){var _0x23cfe7=this;return new Promise(function(_0xfe5165,_0x3d3766){return db[_0x8b81('0x17')]['findAll']({'raw':_0x50ba40[_0x8b81('0x18')]?_0x50ba40[_0x8b81('0x18')][_0x8b81('0x19')]===undefined?!![]:![]:!![],'where':_0x50ba40['options']?_0x50ba40[_0x8b81('0x18')][_0x8b81('0x2e')]||null:null,'attributes':[['campaign',_0x8b81('0x2f')],[db[_0x8b81('0x1b')]['fn'](_0x8b81('0x1c'),db['sequelize'][_0x8b81('0x1d')]('id')),_0x8b81('0x44')],[db[_0x8b81('0x1b')]['fn']('COUNT',db[_0x8b81('0x1b')]['fn']('IF',db[_0x8b81('0x1b')][_0x8b81('0x1f')](_0x8b81('0x20')))),_0x8b81('0x45')]],'group':[_0x8b81('0x43')]})[_0x8b81('0xd')](function(_0x5db47d){logger[_0x8b81('0xe')]('GetCampaignHopperHistory',_0x50ba40);logger[_0x8b81('0x11')](_0x8b81('0x46'),_0x50ba40,JSON[_0x8b81('0x2a')](_0x5db47d));_0xfe5165(_0x5db47d);})[_0x8b81('0x2b')](function(_0x382fd2){logger[_0x8b81('0x13')](_0x8b81('0x46'),_0x382fd2['message'],_0x50ba40);_0x3d3766(_0x23cfe7[_0x8b81('0x13')](0x1f4,_0x382fd2[_0x8b81('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 6fecab7..dda2b36 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 _0x7e9f=['index','/describe','describe','show','post','/:id','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x21b1fa,_0x640318){var _0x5dd9e0=function(_0x3c4082){while(--_0x3c4082){_0x21b1fa['push'](_0x21b1fa['shift']());}};_0x5dd9e0(++_0x640318);}(_0x7e9f,0xf6));var _0xf7e9=function(_0x5a32b8,_0x3e2d76){_0x5a32b8=_0x5a32b8-0x0;var _0x131f08=_0x7e9f[_0x5a32b8];return _0x131f08;};'use strict';var multer=require(_0xf7e9('0x0'));var util=require(_0xf7e9('0x1'));var path=require(_0xf7e9('0x2'));var timeout=require(_0xf7e9('0x3'));var express=require('express');var router=express[_0xf7e9('0x4')]();var fs_extra=require(_0xf7e9('0x5'));var auth=require(_0xf7e9('0x6'));var interaction=require(_0xf7e9('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0xf7e9('0x8')]('/',auth[_0xf7e9('0x9')](),controller[_0xf7e9('0xa')]);router['get'](_0xf7e9('0xb'),auth[_0xf7e9('0x9')](),controller[_0xf7e9('0xc')]);router[_0xf7e9('0x8')]('/:id',auth[_0xf7e9('0x9')](),controller[_0xf7e9('0xd')]);router[_0xf7e9('0xe')]('/',auth[_0xf7e9('0x9')](),controller['create']);router['put'](_0xf7e9('0xf'),auth[_0xf7e9('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x358f=['/describe','describe','/:id','create','put','update','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x1f5c10,_0x19bb2){var _0x46d04f=function(_0x590ad2){while(--_0x590ad2){_0x1f5c10['push'](_0x1f5c10['shift']());}};_0x46d04f(++_0x19bb2);}(_0x358f,0xe3));var _0xf358=function(_0x58f0a8,_0x51334f){_0x58f0a8=_0x58f0a8-0x0;var _0x2ac044=_0x358f[_0x58f0a8];return _0x2ac044;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf358('0x0'));var timeout=require(_0xf358('0x1'));var express=require(_0xf358('0x2'));var router=express[_0xf358('0x3')]();var fs_extra=require(_0xf358('0x4'));var auth=require(_0xf358('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf358('0x6'));var controller=require(_0xf358('0x7'));router[_0xf358('0x8')]('/',auth[_0xf358('0x9')](),controller[_0xf358('0xa')]);router[_0xf358('0x8')](_0xf358('0xb'),auth[_0xf358('0x9')](),controller[_0xf358('0xc')]);router[_0xf358('0x8')](_0xf358('0xd'),auth[_0xf358('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf358('0xe')]);router[_0xf358('0xf')](_0xf358('0xd'),auth[_0xf358('0x9')](),controller[_0xf358('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 1b026c8..8a38170 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 _0xacb8=['exports','STRING','sequelize'];(function(_0x3dc935,_0xf62e5){var _0x16619c=function(_0x1e8310){while(--_0x1e8310){_0x3dc935['push'](_0x3dc935['shift']());}};_0x16619c(++_0xf62e5);}(_0xacb8,0xf2));var _0x8acb=function(_0x5366ea,_0x11dcea){_0x5366ea=_0x5366ea-0x0;var _0x5e248a=_0xacb8[_0x5366ea];return _0x5e248a;};'use strict';var Sequelize=require(_0x8acb('0x0'));module[_0x8acb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8acb('0x2')]},'dialPrefix':{'type':Sequelize[_0x8acb('0x2')]}}; \ No newline at end of file +var _0xef51=['sequelize','exports','STRING','name'];(function(_0x4c0686,_0x549f0e){var _0x1727dd=function(_0x28d5d6){while(--_0x28d5d6){_0x4c0686['push'](_0x4c0686['shift']());}};_0x1727dd(++_0x549f0e);}(_0xef51,0x1f4));var _0x1ef5=function(_0x46cd97,_0x1d7f12){_0x46cd97=_0x46cd97-0x0;var _0x4eeb8a=_0xef51[_0x46cd97];return _0x4eeb8a;};'use strict';var Sequelize=require(_0x1ef5('0x0'));module[_0x1ef5('0x1')]={'name':{'type':Sequelize[_0x1ef5('0x2')],'unique':_0x1ef5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x1ef5('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 0caec92..e2f06f1 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 _0xa08b=['now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomFields','Sequelize','TEXT','number','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cf_%s','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','merge','body','contact','message','interaction','account','index','map','CmList','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','ListId','Disposition','getDispositions','findOne','sort','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','CmCustomField','rawAttributes','concat','CustomFields','cf_%d','raw','getContactsCsv','isEmpty'];(function(_0x39b52f,_0x27d443){var _0x53aa33=function(_0x18a80a){while(--_0x18a80a){_0x39b52f['push'](_0x39b52f['shift']());}};_0x53aa33(++_0x27d443);}(_0xa08b,0x1d4));var _0xba08=function(_0x28e673,_0x2b365a){_0x28e673=_0x28e673-0x0;var _0x45cf34=_0xa08b[_0x28e673];return _0x45cf34;};'use strict';var emlformat=require(_0xba08('0x0'));var rimraf=require(_0xba08('0x1'));var zipdir=require(_0xba08('0x2'));var jsonpatch=require(_0xba08('0x3'));var rp=require(_0xba08('0x4'));var moment=require(_0xba08('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xba08('0x6'));var util=require('util');var path=require(_0xba08('0x7'));var sox=require(_0xba08('0x8'));var csv=require(_0xba08('0x9'));var ejs=require(_0xba08('0xa'));var fs=require('fs');var fs_extra=require(_0xba08('0xb'));var _=require(_0xba08('0xc'));var squel=require(_0xba08('0xd'));var crypto=require(_0xba08('0xe'));var jsforce=require(_0xba08('0xf'));var deskjs=require(_0xba08('0x10'));var toCsv=require(_0xba08('0x9'));var querystring=require(_0xba08('0x11'));var Papa=require('papaparse');var Redis=require(_0xba08('0x12'));var authService=require(_0xba08('0x13'));var qs=require(_0xba08('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba08('0x15'));var logger=require(_0xba08('0x16'))(_0xba08('0x17'));var utils=require(_0xba08('0x18'));var config=require(_0xba08('0x19'));var licenseUtil=require(_0xba08('0x1a'));var db=require('../../mysqldb')['db'];config[_0xba08('0x1b')]=_[_0xba08('0x1c')](config[_0xba08('0x1b')],{'host':_0xba08('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba08('0x1b')]));require(_0xba08('0x1e'))[_0xba08('0x1f')](socket);function respondWithStatusCode(_0x43c21e,_0xcfb237){_0xcfb237=_0xcfb237||0xcc;return function(_0x5b1053){if(_0x5b1053){return _0x43c21e[_0xba08('0x20')](_0xcfb237);}return _0x43c21e[_0xba08('0x21')](_0xcfb237)[_0xba08('0x22')]();};}function respondWithResult(_0x128119,_0x15c6af){_0x15c6af=_0x15c6af||0xc8;return function(_0x4eefb3){if(_0x4eefb3){return _0x128119['status'](_0x15c6af)['json'](_0x4eefb3);}};}function respondWithFilteredResult(_0x202424,_0x38248b){return function(_0x556572){if(_0x556572){var _0x1a8eaf=typeof _0x38248b[_0xba08('0x23')]===_0xba08('0x24')&&typeof _0x38248b['limit']===_0xba08('0x24');var _0xc5c94e=_0x556572[_0xba08('0x25')];var _0x17a882=_0x1a8eaf?0x0:_0x38248b[_0xba08('0x23')];var _0x37636e=_0x1a8eaf?_0x556572['count']:_0x38248b[_0xba08('0x23')]+_0x38248b[_0xba08('0x26')];var _0x179c49;if(_0x37636e>=_0xc5c94e){_0x37636e=_0xc5c94e;_0x179c49=0xc8;}else{_0x179c49=0xce;}_0x202424[_0xba08('0x21')](_0x179c49);return _0x202424[_0xba08('0x27')](_0xba08('0x28'),_0x17a882+'-'+_0x37636e+'/'+_0xc5c94e)[_0xba08('0x29')](_0x556572);}return null;};}function patchUpdates(_0x4649ad){return function(_0x3ef59f){try{jsonpatch[_0xba08('0x2a')](_0x3ef59f,_0x4649ad,!![]);}catch(_0x1d83d6){return BPromise[_0xba08('0x2b')](_0x1d83d6);}return _0x3ef59f[_0xba08('0x2c')]();};}function saveUpdates(_0x48a71c,_0x3fd274){return function(_0x45c2f4){if(_0x45c2f4){return _0x45c2f4[_0xba08('0x2d')](_0x48a71c)[_0xba08('0x2e')](function(_0x5a5b6e){return _0x5a5b6e;});}return null;};}function removeEntity(_0x5c3b4c,_0xab2626){return function(_0xce190f){if(_0xce190f){return _0xce190f[_0xba08('0x2f')]()['then'](function(){var _0x4cf043=_0xce190f['get']({'plain':!![]});var _0x3ff56f='Lists';return db[_0xba08('0x30')][_0xba08('0x2f')]({'where':{'type':_0x3ff56f,'resourceId':_0x4cf043['id']}})['then'](function(){return _0xce190f;});})['then'](function(){_0x5c3b4c[_0xba08('0x21')](0xcc)[_0xba08('0x22')]();});}};}function handleEntityNotFound(_0x3fc16a,_0xba0d71){return function(_0xdad608){if(!_0xdad608){_0x3fc16a['sendStatus'](0x194);}return _0xdad608;};}function handleError(_0x548aa1,_0x49a32c){_0x49a32c=_0x49a32c||0x1f4;return function(_0x1f428f){logger[_0xba08('0x31')](_0x1f428f['stack']);if(_0x1f428f[_0xba08('0x32')]){delete _0x1f428f['name'];}_0x548aa1[_0xba08('0x21')](_0x49a32c)[_0xba08('0x33')](_0x1f428f);};}function getMustacheRender(_0x1f8b17,_0x3c4886){return Mustache['render'](_0x1f8b17,_[_0xba08('0x34')](_0x3c4886[_0xba08('0x35')],{'contact':_0x3c4886[_0xba08('0x36')],'message':_0x3c4886[_0xba08('0x37')],'agent':_0x3c4886['agent'],'interaction':_0x3c4886[_0xba08('0x38')],'account':_0x3c4886[_0xba08('0x39')]}))||'';}exports[_0xba08('0x3a')]=function(_0x289579,_0x59d935){var _0x531312={},_0x5a573d={},_0x5179d0={'count':0x0,'rows':[]};var _0x11d7b1=_[_0xba08('0x3b')](db[_0xba08('0x3c')]['rawAttributes'],function(_0x29fb85){return{'name':_0x29fb85[_0xba08('0x3d')],'type':_0x29fb85[_0xba08('0x3e')]['key']};});_0x5a573d[_0xba08('0x3f')]=_['map'](_0x11d7b1,_0xba08('0x32'));_0x5a573d[_0xba08('0x40')]=_['keys'](_0x289579[_0xba08('0x40')]);_0x5a573d[_0xba08('0x41')]=_['intersection'](_0x5a573d[_0xba08('0x3f')],_0x5a573d[_0xba08('0x40')]);_0x531312[_0xba08('0x42')]=_[_0xba08('0x43')](_0x5a573d[_0xba08('0x3f')],qs['fields'](_0x289579['query'][_0xba08('0x44')]));_0x531312['attributes']=_0x531312[_0xba08('0x42')][_0xba08('0x45')]?_0x531312['attributes']:_0x5a573d['model'];if(!_0x289579[_0xba08('0x40')][_0xba08('0x46')](_0xba08('0x47'))){_0x531312['limit']=qs[_0xba08('0x26')](_0x289579[_0xba08('0x40')][_0xba08('0x26')]);_0x531312[_0xba08('0x23')]=qs[_0xba08('0x23')](_0x289579['query']['offset']);}_0x531312[_0xba08('0x48')]=qs['sort'](_0x289579[_0xba08('0x40')]['sort']);_0x531312[_0xba08('0x49')]=qs[_0xba08('0x41')](_[_0xba08('0x4a')](_0x289579['query'],_0x5a573d[_0xba08('0x41')]),_0x11d7b1);if(_0x289579['query'][_0xba08('0x4b')]){_0x531312['where']=_[_0xba08('0x34')](_0x531312[_0xba08('0x49')],{'$or':_[_0xba08('0x3b')](_0x11d7b1,function(_0x408c4f){if(_0x408c4f[_0xba08('0x3e')]!==_0xba08('0x4c')){var _0x420132={};_0x420132[_0x408c4f[_0xba08('0x32')]]={'$like':'%'+_0x289579[_0xba08('0x40')][_0xba08('0x4b')]+'%'};return _0x420132;}})});}_0x531312=_[_0xba08('0x34')]({},_0x531312,_0x289579[_0xba08('0x4d')]);var _0x5241f4={'where':_0x531312['where']};return db[_0xba08('0x3c')][_0xba08('0x25')](_0x5241f4)[_0xba08('0x2e')](function(_0x1bb892){_0x5179d0['count']=_0x1bb892;if(_0x289579[_0xba08('0x40')][_0xba08('0x4e')]){_0x531312[_0xba08('0x4f')]=[{'all':!![]}];}return db[_0xba08('0x3c')][_0xba08('0x50')](_0x531312);})[_0xba08('0x2e')](function(_0x423610){_0x5179d0[_0xba08('0x51')]=_0x423610;return _0x5179d0;})[_0xba08('0x2e')](respondWithFilteredResult(_0x59d935,_0x531312))['catch'](handleError(_0x59d935,null));};exports['show']=function(_0x185316,_0x4e4b2b){var _0x114bfd={'raw':![],'where':{'id':_0x185316[_0xba08('0x52')]['id']}},_0x490090={};_0x490090['model']=_[_0xba08('0x53')](db[_0xba08('0x3c')]['rawAttributes']);_0x490090[_0xba08('0x40')]=_[_0xba08('0x53')](_0x185316[_0xba08('0x40')]);_0x490090[_0xba08('0x41')]=_[_0xba08('0x43')](_0x490090[_0xba08('0x3f')],_0x490090['query']);_0x114bfd[_0xba08('0x42')]=_[_0xba08('0x43')](_0x490090['model'],qs[_0xba08('0x44')](_0x185316[_0xba08('0x40')][_0xba08('0x44')]));_0x114bfd['attributes']=_0x114bfd[_0xba08('0x42')][_0xba08('0x45')]?_0x114bfd['attributes']:_0x490090[_0xba08('0x3f')];if(_0x185316[_0xba08('0x40')][_0xba08('0x4e')]){_0x114bfd['include']=[{'all':!![]}];}_0x114bfd=_['merge']({},_0x114bfd,_0x185316[_0xba08('0x4d')]);return db[_0xba08('0x3c')]['find'](_0x114bfd)['then'](handleEntityNotFound(_0x4e4b2b,null))[_0xba08('0x2e')](respondWithResult(_0x4e4b2b,null))[_0xba08('0x54')](handleError(_0x4e4b2b,null));};exports[_0xba08('0x55')]=function(_0x11c9d5,_0x1ef0e7){return db[_0xba08('0x3c')][_0xba08('0x55')](_0x11c9d5[_0xba08('0x35')],{})['then'](function(_0x388193){var _0x546b37=_0x11c9d5[_0xba08('0x56')][_0xba08('0x57')]({'plain':!![]});if(!_0x546b37)throw new Error(_0xba08('0x58'));if(_0x546b37['role']===_0xba08('0x56')){var _0x26248f=_0x388193[_0xba08('0x57')]({'plain':!![]});var _0x9e5878='Lists';return db[_0xba08('0x59')]['find']({'where':{'name':_0x9e5878,'userProfileId':_0x546b37[_0xba08('0x5a')]},'raw':!![]})[_0xba08('0x2e')](function(_0x47b318){if(_0x47b318&&_0x47b318['autoAssociation']===0x0){return db[_0xba08('0x30')]['create']({'name':_0x26248f[_0xba08('0x32')],'resourceId':_0x26248f['id'],'type':_0x47b318[_0xba08('0x32')],'sectionId':_0x47b318['id']},{})[_0xba08('0x2e')](function(){return _0x388193;});}else{return _0x388193;}})[_0xba08('0x54')](function(_0x577acd){logger['error'](_0xba08('0x5b'),_0x577acd);throw _0x577acd;});}return _0x388193;})['then'](respondWithResult(_0x1ef0e7,0xc9))[_0xba08('0x54')](handleError(_0x1ef0e7,null));};exports['update']=function(_0x3f1583,_0x2d507c){if(_0x3f1583[_0xba08('0x35')]['id']){delete _0x3f1583[_0xba08('0x35')]['id'];}return db[_0xba08('0x3c')][_0xba08('0x5c')]({'where':{'id':_0x3f1583[_0xba08('0x52')]['id']}})['then'](handleEntityNotFound(_0x2d507c,null))['then'](saveUpdates(_0x3f1583['body'],null))[_0xba08('0x2e')](respondWithResult(_0x2d507c,null))['catch'](handleError(_0x2d507c,null));};exports[_0xba08('0x2f')]=function(_0xf07e61,_0x11ac8d){return db[_0xba08('0x3c')][_0xba08('0x5c')]({'where':{'id':_0xf07e61[_0xba08('0x52')]['id']}})[_0xba08('0x2e')](handleEntityNotFound(_0x11ac8d,null))['then'](removeEntity(_0x11ac8d,null))['catch'](handleError(_0x11ac8d,null));};exports[_0xba08('0x5d')]=function(_0x3a999d,_0x203cfe){return db[_0xba08('0x3c')][_0xba08('0x5d')]()[_0xba08('0x2e')](respondWithResult(_0x203cfe,null))[_0xba08('0x54')](handleError(_0x203cfe,null));};exports['addDisposition']=function(_0x1c4e48,_0x2b8188,_0x50d623){if(_0x1c4e48['body']['id']){delete _0x1c4e48[_0xba08('0x35')]['id'];}return db[_0xba08('0x3c')][_0xba08('0x5c')]({'where':{'id':_0x1c4e48[_0xba08('0x52')]['id']}})[_0xba08('0x2e')](handleEntityNotFound(_0x2b8188,null))[_0xba08('0x2e')](function(_0x2bccfb){if(_0x2bccfb){_0x1c4e48['body'][_0xba08('0x5e')]=_0x2bccfb['id'];return db[_0xba08('0x5f')][_0xba08('0x55')](_0x1c4e48[_0xba08('0x35')]);}})[_0xba08('0x2e')](respondWithResult(_0x2b8188,null))[_0xba08('0x54')](handleError(_0x2b8188,null));};exports[_0xba08('0x60')]=function(_0xb13846,_0x3accec,_0x4033a7){var _0x76fb3a={'raw':![],'where':{}};var _0x1203af={};var _0x315d11={'count':0x0,'rows':[]};return db[_0xba08('0x3c')][_0xba08('0x61')]({'where':{'id':_0xb13846[_0xba08('0x52')]['id']}})['then'](handleEntityNotFound(_0x3accec,null))[_0xba08('0x2e')](function(_0x1ce662){if(_0x1ce662){_0x1203af[_0xba08('0x3f')]=_[_0xba08('0x53')](db[_0xba08('0x5f')]['rawAttributes']);_0x1203af[_0xba08('0x40')]=_['keys'](_0xb13846['query']);_0x1203af[_0xba08('0x41')]=_[_0xba08('0x43')](_0x1203af[_0xba08('0x3f')],_0x1203af['query']);_0x76fb3a['attributes']=_[_0xba08('0x43')](_0x1203af[_0xba08('0x3f')],qs[_0xba08('0x44')](_0xb13846[_0xba08('0x40')]['fields']));_0x76fb3a[_0xba08('0x42')]=_0x76fb3a['attributes'][_0xba08('0x45')]?_0x76fb3a[_0xba08('0x42')]:_0x1203af[_0xba08('0x3f')];if(!_0xb13846['query'][_0xba08('0x46')](_0xba08('0x47'))){_0x76fb3a[_0xba08('0x26')]=qs[_0xba08('0x26')](_0xb13846[_0xba08('0x40')][_0xba08('0x26')]);_0x76fb3a['offset']=qs[_0xba08('0x23')](_0xb13846['query'][_0xba08('0x23')]);}_0x76fb3a[_0xba08('0x48')]=qs['sort'](_0xb13846[_0xba08('0x40')][_0xba08('0x62')]);_0x76fb3a[_0xba08('0x49')]=qs[_0xba08('0x41')](_[_0xba08('0x4a')](_0xb13846['query'],_0x1203af[_0xba08('0x41')]));_0x76fb3a[_0xba08('0x49')][_0xba08('0x5e')]=_0x1ce662['id'];if(_0xb13846[_0xba08('0x40')][_0xba08('0x4b')]){_0x76fb3a[_0xba08('0x49')]=_[_0xba08('0x34')](_0x76fb3a[_0xba08('0x49')],{'$or':_['map'](_0x76fb3a[_0xba08('0x42')],function(_0x26aadd){var _0x1f6419={};_0x1f6419[_0x26aadd]={'$like':'%'+_0xb13846[_0xba08('0x40')][_0xba08('0x4b')]+'%'};return _0x1f6419;})});}_0x76fb3a=_[_0xba08('0x34')]({},_0x76fb3a,_0xb13846[_0xba08('0x4d')]);return db['Disposition'][_0xba08('0x25')]({'where':_0x76fb3a[_0xba08('0x49')]})['then'](function(_0x1697bf){_0x315d11[_0xba08('0x25')]=_0x1697bf;if(_0xb13846[_0xba08('0x40')]['includeAll']){_0x76fb3a[_0xba08('0x4f')]=[{'all':!![]}];}return db[_0xba08('0x5f')]['findAll'](_0x76fb3a);})[_0xba08('0x2e')](function(_0x192da3){_0x315d11[_0xba08('0x51')]=_0x192da3;return _0x315d11;});}})[_0xba08('0x2e')](respondWithFilteredResult(_0x3accec,_0x76fb3a))[_0xba08('0x54')](handleError(_0x3accec,null));};exports[_0xba08('0x63')]=function(_0x5b8c2b,_0x21edf9,_0x20a66e){return db['CmList']['find']({'where':{'id':_0x5b8c2b[_0xba08('0x52')]['id']}})[_0xba08('0x2e')](handleEntityNotFound(_0x21edf9,null))['then'](function(_0x2da793){if(_0x2da793){return _0x2da793['removeDispositions'](_0x5b8c2b[_0xba08('0x40')][_0xba08('0x64')]);}})[_0xba08('0x2e')](respondWithStatusCode(_0x21edf9,null))[_0xba08('0x54')](handleError(_0x21edf9,null));};exports[_0xba08('0x65')]=function(_0x377394,_0x6e8913,_0x9c8ab7){return db[_0xba08('0x3c')][_0xba08('0x5c')]({'where':{'id':_0x377394[_0xba08('0x52')]['id']}})[_0xba08('0x2e')](handleEntityNotFound(_0x6e8913,null))[_0xba08('0x2e')](function(_0x4500a7){if(_0x4500a7){var _0x57b517=[];var _0x494fd9={'success':[],'errors':[]};return db[_0xba08('0x66')]['describe']()[_0xba08('0x2e')](function(_0x199c59){if(_0x377394[_0xba08('0x35')][_0xba08('0x67')]&&_['isArray'](_0x377394[_0xba08('0x35')][_0xba08('0x67')])){if(_0x377394[_0xba08('0x35')][_0xba08('0x67')][_0xba08('0x45')]){_0x377394['body']['tags']=_0x377394['body']['tags']['join'](';')+';';}else{_0x377394[_0xba08('0x35')][_0xba08('0x67')]=null;}}else{_0x377394[_0xba08('0x35')][_0xba08('0x67')]=null;}if(_0x377394[_0xba08('0x35')]&&_[_0xba08('0x68')](_0x377394[_0xba08('0x35')])){for(var _0x205692=0x0;_0x205692<_0x377394['body'][_0xba08('0x45')];_0x205692+=0x1){_0x377394['body'][_0x205692][_0xba08('0x5e')]=_0x377394[_0xba08('0x52')]['id'];_0x57b517[_0xba08('0x69')](_0x377394[_0xba08('0x35')][_0x205692]);}return BPromise[_0xba08('0x6a')](_0x57b517,function(_0x518abf){return db['CmContact'][_0xba08('0x55')](_[_0xba08('0x6b')](_0x518abf,['ids','id'])||{},{'fields':_[_0xba08('0x53')](_0x199c59),'raw':!![]})['then'](function(_0x299d68){_0x494fd9[_0xba08('0x6c')][_0xba08('0x69')](_0x299d68[_0xba08('0x6d')]);})[_0xba08('0x54')](function(_0x5595e0){_0x494fd9[_0xba08('0x6e')][_0xba08('0x69')]({'data':_0x518abf,'error':_0x5595e0[_0xba08('0x37')]});});})[_0xba08('0x2e')](function(_0x3798fb){return _0x494fd9;})[_0xba08('0x54')](function(_0x2292b0){return _0x2292b0;});}else{_0x6e8913[_0xba08('0x21')](0x190)[_0xba08('0x29')]({'message':_0xba08('0x6f')});}});}})[_0xba08('0x2e')](respondWithResult(_0x6e8913,null))['catch'](handleError(_0x6e8913,null));};exports['getContacts']=function(_0xf25915,_0x5aef59,_0x592406){var _0xb0682;return db[_0xba08('0x3c')][_0xba08('0x5c')]({'where':{'id':_0xf25915[_0xba08('0x52')]['id']},'include':[{'model':db[_0xba08('0x70')],'as':'CustomFields'}]})[_0xba08('0x2e')](handleEntityNotFound(_0x5aef59,null))[_0xba08('0x2e')](function(_0x1316d4){if(_0x1316d4){_0xb0682=_0x1316d4;return db[_0xba08('0x66')][_0xba08('0x71')];}})[_0xba08('0x2e')](function(_0x165238){if(_0x165238){var _0x31561c={};var _0x5b72a7={};_0x5b72a7['model']=_[_0xba08('0x72')](_[_0xba08('0x53')](_0x165238),_[_0xba08('0x3b')](_0xb0682[_0xba08('0x73')],function(_0x45e7bd){return util['format'](_0xba08('0x74'),_0x45e7bd['id']);}));_0x5b72a7[_0xba08('0x40')]=_[_0xba08('0x53')](_0xf25915[_0xba08('0x40')]);_0x5b72a7[_0xba08('0x41')]=_[_0xba08('0x43')](_0x5b72a7['model'],_0x5b72a7[_0xba08('0x40')]);_0x31561c[_0xba08('0x42')]=_[_0xba08('0x43')](_0x5b72a7['model'],qs[_0xba08('0x44')](_0xf25915[_0xba08('0x40')][_0xba08('0x44')]));_0x31561c['attributes']=_0x31561c['attributes'][_0xba08('0x45')]?_0x31561c[_0xba08('0x42')]:_0x5b72a7['model'];if(!_0xf25915[_0xba08('0x40')][_0xba08('0x46')](_0xba08('0x47'))){_0x31561c['limit']=qs[_0xba08('0x26')](_0xf25915[_0xba08('0x40')][_0xba08('0x26')]);_0x31561c['offset']=qs[_0xba08('0x23')](_0xf25915[_0xba08('0x40')]['offset']);}_0x31561c[_0xba08('0x48')]=qs[_0xba08('0x62')](_0xf25915[_0xba08('0x40')][_0xba08('0x62')]);_0x31561c[_0xba08('0x49')]=qs[_0xba08('0x41')](_[_0xba08('0x4a')](_0xf25915[_0xba08('0x40')],_0x5b72a7[_0xba08('0x41')]));_0x31561c[_0xba08('0x75')]=!![];if(_0xf25915[_0xba08('0x40')]['filter']){_0x31561c[_0xba08('0x49')]=_[_0xba08('0x34')](_0x31561c[_0xba08('0x49')],{'$or':_[_0xba08('0x3b')](_0x31561c[_0xba08('0x42')],function(_0x2a2c9d){var _0x43b53b={};_0x43b53b[_0x2a2c9d]={'$like':'%'+_0xf25915[_0xba08('0x40')]['filter']+'%'};return _0x43b53b;})});}_0x31561c=_[_0xba08('0x34')]({},_0x31561c,_0xf25915['options']);return _0xb0682['getContacts'](_0x31561c);}})[_0xba08('0x2e')](respondWithResult(_0x5aef59,null))[_0xba08('0x54')](handleError(_0x5aef59,null));};exports[_0xba08('0x76')]=function(_0x1c2de5,_0x2d5d50,_0x471000){var _0x2dad2b;return db[_0xba08('0x3c')]['find']({'where':{'id':_0x1c2de5[_0xba08('0x52')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xba08('0x73')}]})[_0xba08('0x2e')](handleEntityNotFound(_0x2d5d50,null))[_0xba08('0x2e')](function(_0xe6dc28){if(_0xe6dc28){_0x2dad2b=_0xe6dc28;return db[_0xba08('0x66')][_0xba08('0x71')];}})[_0xba08('0x2e')](function(_0x574a00){if(_0x574a00){var _0x3dc4ce={};var _0x10ab93={};_0x10ab93[_0xba08('0x3f')]=_['concat'](_[_0xba08('0x53')](_0x574a00),_[_0xba08('0x3b')](_0x2dad2b[_0xba08('0x73')],function(_0x103cbb){return util['format'](_0xba08('0x74'),_0x103cbb['id']);}));_0x10ab93['query']=_[_0xba08('0x53')](_0x1c2de5[_0xba08('0x40')]);_0x10ab93['filters']=_[_0xba08('0x43')](_0x10ab93[_0xba08('0x3f')],_0x10ab93['query']);_0x3dc4ce[_0xba08('0x42')]=_['intersection'](_0x10ab93[_0xba08('0x3f')],qs[_0xba08('0x44')](_0x1c2de5[_0xba08('0x40')][_0xba08('0x44')]));_0x3dc4ce[_0xba08('0x42')]=_0x3dc4ce[_0xba08('0x42')][_0xba08('0x45')]?_0x3dc4ce[_0xba08('0x42')]:_0x10ab93['model'];if(!_0x1c2de5[_0xba08('0x40')]['hasOwnProperty'](_0xba08('0x47'))){_0x3dc4ce[_0xba08('0x26')]=qs[_0xba08('0x26')](_0x1c2de5['query'][_0xba08('0x26')]);_0x3dc4ce[_0xba08('0x23')]=qs[_0xba08('0x23')](_0x1c2de5[_0xba08('0x40')][_0xba08('0x23')]);}_0x3dc4ce[_0xba08('0x48')]=qs[_0xba08('0x62')](_0x1c2de5[_0xba08('0x40')][_0xba08('0x62')]);_0x3dc4ce[_0xba08('0x49')]=qs[_0xba08('0x41')](_['pick'](_0x1c2de5[_0xba08('0x40')],_0x10ab93[_0xba08('0x41')]));_0x3dc4ce['raw']=!![];if(_0x1c2de5[_0xba08('0x40')][_0xba08('0x4b')]){_0x3dc4ce[_0xba08('0x49')]=_[_0xba08('0x34')](_0x3dc4ce[_0xba08('0x49')],{'$or':_[_0xba08('0x3b')](_0x3dc4ce['attributes'],function(_0x5e4cdd){var _0x2ffac6={};_0x2ffac6[_0x5e4cdd]={'$like':'%'+_0x1c2de5[_0xba08('0x40')][_0xba08('0x4b')]+'%'};return _0x2ffac6;})});}_0x3dc4ce=_['merge']({},_0x3dc4ce,_0x1c2de5['options']);return _0x2dad2b['getContacts'](_0x3dc4ce);}})[_0xba08('0x2e')](function(_0x27b55b){if(!_[_0xba08('0x77')](_0x27b55b)){var _0x2b2ba0=toCsv(_0x27b55b);var _0x26fe83=Date[_0xba08('0x78')]();fs[_0xba08('0x79')](util[_0xba08('0x7a')](_0xba08('0x7b'),_0x2dad2b['id'],_0x26fe83),_0x2b2ba0);_0x2d5d50[_0xba08('0x7c')](_0xba08('0x7d'),_0xba08('0x7e')+util[_0xba08('0x7a')](_0xba08('0x7f'),_0x2dad2b['id'],_0x26fe83));_0x2d5d50[_0xba08('0x7c')]('Content-type',_0xba08('0x80'));return _0x2d5d50[_0xba08('0x81')](util[_0xba08('0x7a')](_0xba08('0x7b'),_0x2dad2b['id'],_0x26fe83));}else{return _0x2d5d50[_0xba08('0x20')](0xcc);}})[_0xba08('0x54')](handleError(_0x2d5d50,null));};exports['addCustomField']=function(_0x99c774,_0x14de45,_0x4b15e9){var _0x592b62;delete _0x99c774[_0xba08('0x35')]['id'];return db[_0xba08('0x3c')][_0xba08('0x61')]({'where':{'id':_0x99c774[_0xba08('0x52')]['id']}})[_0xba08('0x2e')](handleEntityNotFound(_0x14de45,null))[_0xba08('0x2e')](function(_0x56cc42){if(_0x56cc42){return db['sequelize']['transaction'](function(_0x582851){return db[_0xba08('0x70')][_0xba08('0x55')](_0x99c774[_0xba08('0x35')],{'transaction':_0x582851})['then'](function(_0x11dc3e){_0x592b62=_0x11dc3e;return _0x56cc42[_0xba08('0x82')](_0x11dc3e,{'transaction':_0x582851});})[_0xba08('0x2e')](function(){var _0x4152a1={'type':db[_0xba08('0x83')][_0xba08('0x84')],'transaction':_0x582851};switch(_0x99c774[_0xba08('0x35')][_0xba08('0x3e')]){case'text':_0x4152a1[_0xba08('0x3e')]=db['Sequelize']['TEXT'];break;case _0xba08('0x85'):_0x4152a1[_0xba08('0x3e')]=db[_0xba08('0x83')]['INTEGER'];break;case'switch':_0x4152a1[_0xba08('0x3e')]=db[_0xba08('0x83')][_0xba08('0x86')];_0x4152a1[_0xba08('0x87')]=![];break;default:}return db[_0xba08('0x88')][_0xba08('0x89')][_0xba08('0x8a')]('cm_contacts',util[_0xba08('0x7a')](_0xba08('0x8b'),_0x592b62['id']),_0x4152a1);})[_0xba08('0x2e')](function(){return _0x592b62;});});}})[_0xba08('0x2e')](respondWithResult(_0x14de45,null))[_0xba08('0x54')](handleError(_0x14de45,null));};exports['getCustomFields']=function(_0x4360d8,_0x33c60f,_0x99563){var _0x44d549={};var _0x2082f1={};var _0x49b76f;var _0x595955;return db[_0xba08('0x3c')][_0xba08('0x61')]({'where':{'id':_0x4360d8['params']['id']}})[_0xba08('0x2e')](handleEntityNotFound(_0x33c60f,null))[_0xba08('0x2e')](function(_0x680f3d){if(_0x680f3d){_0x49b76f=_0x680f3d;_0x2082f1[_0xba08('0x3f')]=_[_0xba08('0x53')](db[_0xba08('0x70')][_0xba08('0x71')]);_0x2082f1[_0xba08('0x40')]=_['keys'](_0x4360d8[_0xba08('0x40')]);_0x2082f1[_0xba08('0x41')]=_[_0xba08('0x43')](_0x2082f1[_0xba08('0x3f')],_0x2082f1[_0xba08('0x40')]);_0x44d549['attributes']=_['intersection'](_0x2082f1[_0xba08('0x3f')],qs[_0xba08('0x44')](_0x4360d8[_0xba08('0x40')]['fields']));_0x44d549[_0xba08('0x42')]=_0x44d549['attributes'][_0xba08('0x45')]?_0x44d549['attributes']:_0x2082f1[_0xba08('0x3f')];_0x44d549[_0xba08('0x48')]=qs[_0xba08('0x62')](_0x4360d8[_0xba08('0x40')][_0xba08('0x62')]);_0x44d549['where']=qs['filters'](_[_0xba08('0x4a')](_0x4360d8[_0xba08('0x40')],_0x2082f1[_0xba08('0x41')]));_0x44d549['where']=_[_0xba08('0x34')](_0x44d549[_0xba08('0x49')],{'$or':[{'ListId':_0x680f3d['id']},{'ListId':null}]});if(_0x4360d8[_0xba08('0x40')][_0xba08('0x4b')]){_0x44d549[_0xba08('0x49')]=_['merge'](_0x44d549['where'],{'$or':_['map'](_0x44d549['attributes'],function(_0x369aa0){var _0x2d4d16={};_0x2d4d16[_0x369aa0]={'$like':'%'+_0x4360d8['query'][_0xba08('0x4b')]+'%'};return _0x2d4d16;})});}_0x44d549=_[_0xba08('0x34')]({},_0x44d549,_0x4360d8['options']);return db[_0xba08('0x70')]['findAndCountAll'](_0x44d549);}})[_0xba08('0x2e')](respondWithResult(_0x33c60f,null))['catch'](handleError(_0x33c60f,null));};exports[_0xba08('0x8c')]=function(_0xacf9b5,_0x571c71,_0x3c5513){return db[_0xba08('0x3c')][_0xba08('0x5c')]({'where':{'id':_0xacf9b5[_0xba08('0x52')]['id']}})[_0xba08('0x2e')](handleEntityNotFound(_0x571c71,null))[_0xba08('0x2e')](function(_0x51b4c2){if(_0x51b4c2){return _0x51b4c2[_0xba08('0x8c')](_0xacf9b5[_0xba08('0x35')][_0xba08('0x64')],_[_0xba08('0x6b')](_0xacf9b5[_0xba08('0x35')],[_0xba08('0x64'),'id'])||{})['spread'](function(_0x3435cb){for(var _0x2236eb=0x0;_0x2236eb<_0xacf9b5['body']['ids'][_0xba08('0x45')];_0x2236eb+=0x1){socket[_0xba08('0x8d')](_0xba08('0x8e'),{'UserId':_0xacf9b5[_0xba08('0x35')][_0xba08('0x64')][_0x2236eb],'CmListId':_0xacf9b5[_0xba08('0x52')]['id']});}return _0x3435cb;});}})[_0xba08('0x2e')](respondWithResult(_0x571c71,null))['catch'](handleError(_0x571c71,null));};exports[_0xba08('0x8f')]=function(_0x55d9b2,_0x2b5415,_0x4364d0){return db[_0xba08('0x3c')][_0xba08('0x5c')]({'where':{'id':_0x55d9b2[_0xba08('0x52')]['id']}})['then'](handleEntityNotFound(_0x2b5415,null))[_0xba08('0x2e')](function(_0xa74a2f){if(_0xa74a2f){return _0xa74a2f['removeAgents'](_0x55d9b2[_0xba08('0x40')][_0xba08('0x64')])[_0xba08('0x2e')](function(){if(_[_0xba08('0x68')](_0x55d9b2['query'][_0xba08('0x64')])){for(var _0x56cdcd=0x0;_0x56cdcd<_0x55d9b2['query']['ids'][_0xba08('0x45')];_0x56cdcd+=0x1){socket['emit'](_0xba08('0x90'),{'UserId':Number(_0x55d9b2['query']['ids'][_0x56cdcd]),'CmListId':Number(_0x55d9b2[_0xba08('0x52')]['id'])});}}else{socket[_0xba08('0x8d')]('userCmList:remove',{'UserId':Number(_0x55d9b2[_0xba08('0x40')][_0xba08('0x64')]),'CmListId':Number(_0x55d9b2[_0xba08('0x52')]['id'])});}});}})[_0xba08('0x2e')](respondWithStatusCode(_0x2b5415,null))[_0xba08('0x54')](handleError(_0x2b5415,null));};exports[_0xba08('0x91')]=function(_0x20e2f4,_0x4b7aac,_0xe3c85a){var _0x2db771={};var _0x5649fc={};var _0x503d39;var _0x515208;return db[_0xba08('0x3c')][_0xba08('0x61')]({'where':{'id':_0x20e2f4[_0xba08('0x52')]['id']}})[_0xba08('0x2e')](handleEntityNotFound(_0x4b7aac,null))[_0xba08('0x2e')](function(_0x34f504){if(_0x34f504){_0x503d39=_0x34f504;_0x5649fc['model']=_[_0xba08('0x53')](db[_0xba08('0x92')]['rawAttributes']);_0x5649fc['query']=_[_0xba08('0x53')](_0x20e2f4['query']);_0x5649fc[_0xba08('0x41')]=_[_0xba08('0x43')](_0x5649fc['model'],_0x5649fc[_0xba08('0x40')]);_0x2db771['attributes']=_[_0xba08('0x43')](_0x5649fc[_0xba08('0x3f')],qs[_0xba08('0x44')](_0x20e2f4[_0xba08('0x40')][_0xba08('0x44')]));_0x2db771[_0xba08('0x42')]=_0x2db771[_0xba08('0x42')][_0xba08('0x45')]?_0x2db771[_0xba08('0x42')]:_0x5649fc[_0xba08('0x3f')];_0x2db771['order']=qs[_0xba08('0x62')](_0x20e2f4[_0xba08('0x40')]['sort']);_0x2db771[_0xba08('0x49')]=qs['filters'](_['pick'](_0x20e2f4[_0xba08('0x40')],_0x5649fc['filters']));if(_0x20e2f4['query'][_0xba08('0x4b')]){_0x2db771['where']=_[_0xba08('0x34')](_0x2db771[_0xba08('0x49')],{'$or':_[_0xba08('0x3b')](_0x2db771[_0xba08('0x42')],function(_0x581e28){var _0x3d1efa={};_0x3d1efa[_0x581e28]={'$like':'%'+_0x20e2f4[_0xba08('0x40')][_0xba08('0x4b')]+'%'};return _0x3d1efa;})});}_0x2db771=_[_0xba08('0x34')]({},_0x2db771,_0x20e2f4[_0xba08('0x4d')]);return _0x503d39[_0xba08('0x91')](_0x2db771);}})[_0xba08('0x2e')](function(_0xb291fb){if(_0xb291fb){_0x515208=_0xb291fb['length'];if(!_0x20e2f4[_0xba08('0x40')][_0xba08('0x46')](_0xba08('0x47'))){_0x2db771[_0xba08('0x26')]=qs[_0xba08('0x26')](_0x20e2f4['query'][_0xba08('0x26')]);_0x2db771[_0xba08('0x23')]=qs['offset'](_0x20e2f4['query'][_0xba08('0x23')]);}return _0x503d39[_0xba08('0x91')](_0x2db771);}})[_0xba08('0x2e')](function(_0x162d6d){if(_0x162d6d){return _0x162d6d?{'count':_0x515208,'rows':_0x162d6d}:null;}})[_0xba08('0x2e')](respondWithResult(_0x4b7aac,null))[_0xba08('0x54')](handleError(_0x4b7aac,null));}; \ No newline at end of file +var _0x91b4=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','error','stack','name','merge','contact','account','index','map','CmList','rawAttributes','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','rows','catch','params','filters','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','Disposition','ListId','removeDispositions','ids','CmContact','tags','isArray','join','push','success','errors','CmCustomField','CustomFields','concat','cf_%d','raw','getContacts','getContactsCsv','format','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','text/csv','download','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv'];(function(_0x426546,_0x378751){var _0x3b3f61=function(_0x4d4117){while(--_0x4d4117){_0x426546['push'](_0x426546['shift']());}};_0x3b3f61(++_0x378751);}(_0x91b4,0x199));var _0x491b=function(_0x472537,_0x3aae8e){_0x472537=_0x472537-0x0;var _0x820f1a=_0x91b4[_0x472537];return _0x820f1a;};'use strict';var emlformat=require(_0x491b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x491b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x491b('0x2'));var moment=require(_0x491b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x491b('0x4'));var path=require(_0x491b('0x5'));var sox=require(_0x491b('0x6'));var csv=require(_0x491b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x491b('0x8'));var _=require(_0x491b('0x9'));var squel=require('squel');var crypto=require(_0x491b('0xa'));var jsforce=require(_0x491b('0xb'));var deskjs=require(_0x491b('0xc'));var toCsv=require(_0x491b('0x7'));var querystring=require(_0x491b('0xd'));var Papa=require('papaparse');var Redis=require(_0x491b('0xe'));var authService=require(_0x491b('0xf'));var qs=require(_0x491b('0x10'));var as=require(_0x491b('0x11'));var hardwareService=require(_0x491b('0x12'));var logger=require(_0x491b('0x13'))(_0x491b('0x14'));var utils=require(_0x491b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x491b('0x16'));var db=require(_0x491b('0x17'))['db'];config[_0x491b('0x18')]=_['defaults'](config[_0x491b('0x18')],{'host':_0x491b('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x491b('0x18')]));require(_0x491b('0x1a'))[_0x491b('0x1b')](socket);function respondWithStatusCode(_0x1ff7c9,_0xdafb93){_0xdafb93=_0xdafb93||0xcc;return function(_0x4ad854){if(_0x4ad854){return _0x1ff7c9[_0x491b('0x1c')](_0xdafb93);}return _0x1ff7c9[_0x491b('0x1d')](_0xdafb93)[_0x491b('0x1e')]();};}function respondWithResult(_0x285c1c,_0x17ea3a){_0x17ea3a=_0x17ea3a||0xc8;return function(_0x4e2850){if(_0x4e2850){return _0x285c1c[_0x491b('0x1d')](_0x17ea3a)[_0x491b('0x1f')](_0x4e2850);}};}function respondWithFilteredResult(_0x2a588a,_0x814e5){return function(_0x26d1e4){if(_0x26d1e4){var _0x26b4ad=typeof _0x814e5[_0x491b('0x20')]===_0x491b('0x21')&&typeof _0x814e5[_0x491b('0x22')]===_0x491b('0x21');var _0x1e0c5b=_0x26d1e4[_0x491b('0x23')];var _0x38f53e=_0x26b4ad?0x0:_0x814e5[_0x491b('0x20')];var _0x3c6ed6=_0x26b4ad?_0x26d1e4[_0x491b('0x23')]:_0x814e5[_0x491b('0x20')]+_0x814e5['limit'];var _0x356209;if(_0x3c6ed6>=_0x1e0c5b){_0x3c6ed6=_0x1e0c5b;_0x356209=0xc8;}else{_0x356209=0xce;}_0x2a588a[_0x491b('0x1d')](_0x356209);return _0x2a588a[_0x491b('0x24')](_0x491b('0x25'),_0x38f53e+'-'+_0x3c6ed6+'/'+_0x1e0c5b)[_0x491b('0x1f')](_0x26d1e4);}return null;};}function patchUpdates(_0x26428a){return function(_0x3e8fe2){try{jsonpatch[_0x491b('0x26')](_0x3e8fe2,_0x26428a,!![]);}catch(_0x2ced8b){return BPromise[_0x491b('0x27')](_0x2ced8b);}return _0x3e8fe2[_0x491b('0x28')]();};}function saveUpdates(_0x5b5693,_0x5fda0a){return function(_0x1e8c34){if(_0x1e8c34){return _0x1e8c34[_0x491b('0x29')](_0x5b5693)[_0x491b('0x2a')](function(_0x547f6e){return _0x547f6e;});}return null;};}function removeEntity(_0x308fb6,_0x4dc525){return function(_0x12b75b){if(_0x12b75b){return _0x12b75b[_0x491b('0x2b')]()['then'](function(){var _0x12b5d9=_0x12b75b[_0x491b('0x2c')]({'plain':!![]});var _0x5ec90d=_0x491b('0x2d');return db['UserProfileResource'][_0x491b('0x2b')]({'where':{'type':_0x5ec90d,'resourceId':_0x12b5d9['id']}})[_0x491b('0x2a')](function(){return _0x12b75b;});})[_0x491b('0x2a')](function(){_0x308fb6[_0x491b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4930b3,_0x2e09fb){return function(_0x1a3f12){if(!_0x1a3f12){_0x4930b3[_0x491b('0x1c')](0x194);}return _0x1a3f12;};}function handleError(_0x211475,_0x2025f7){_0x2025f7=_0x2025f7||0x1f4;return function(_0x1c7288){logger[_0x491b('0x2e')](_0x1c7288[_0x491b('0x2f')]);if(_0x1c7288[_0x491b('0x30')]){delete _0x1c7288[_0x491b('0x30')];}_0x211475['status'](_0x2025f7)['send'](_0x1c7288);};}function getMustacheRender(_0x5a4930,_0x271b00){return Mustache['render'](_0x5a4930,_[_0x491b('0x31')](_0x271b00['body'],{'contact':_0x271b00[_0x491b('0x32')],'message':_0x271b00['message'],'agent':_0x271b00['agent'],'interaction':_0x271b00['interaction'],'account':_0x271b00[_0x491b('0x33')]}))||'';}exports[_0x491b('0x34')]=function(_0x1d1ad2,_0x1efd06){var _0x575c88={},_0xe9e119={},_0x5a9589={'count':0x0,'rows':[]};var _0x3d06f2=_[_0x491b('0x35')](db[_0x491b('0x36')][_0x491b('0x37')],function(_0x4ffc42){return{'name':_0x4ffc42['fieldName'],'type':_0x4ffc42[_0x491b('0x38')]['key']};});_0xe9e119['model']=_[_0x491b('0x35')](_0x3d06f2,_0x491b('0x30'));_0xe9e119['query']=_[_0x491b('0x39')](_0x1d1ad2[_0x491b('0x3a')]);_0xe9e119['filters']=_[_0x491b('0x3b')](_0xe9e119[_0x491b('0x3c')],_0xe9e119['query']);_0x575c88[_0x491b('0x3d')]=_[_0x491b('0x3b')](_0xe9e119['model'],qs['fields'](_0x1d1ad2[_0x491b('0x3a')][_0x491b('0x3e')]));_0x575c88[_0x491b('0x3d')]=_0x575c88['attributes'][_0x491b('0x3f')]?_0x575c88['attributes']:_0xe9e119[_0x491b('0x3c')];if(!_0x1d1ad2['query'][_0x491b('0x40')](_0x491b('0x41'))){_0x575c88[_0x491b('0x22')]=qs[_0x491b('0x22')](_0x1d1ad2[_0x491b('0x3a')]['limit']);_0x575c88[_0x491b('0x20')]=qs['offset'](_0x1d1ad2['query']['offset']);}_0x575c88[_0x491b('0x42')]=qs[_0x491b('0x43')](_0x1d1ad2['query']['sort']);_0x575c88[_0x491b('0x44')]=qs['filters'](_[_0x491b('0x45')](_0x1d1ad2[_0x491b('0x3a')],_0xe9e119['filters']),_0x3d06f2);if(_0x1d1ad2[_0x491b('0x3a')][_0x491b('0x46')]){_0x575c88[_0x491b('0x44')]=_[_0x491b('0x31')](_0x575c88[_0x491b('0x44')],{'$or':_[_0x491b('0x35')](_0x3d06f2,function(_0x276eac){if(_0x276eac[_0x491b('0x38')]!=='VIRTUAL'){var _0x502c50={};_0x502c50[_0x276eac[_0x491b('0x30')]]={'$like':'%'+_0x1d1ad2[_0x491b('0x3a')][_0x491b('0x46')]+'%'};return _0x502c50;}})});}_0x575c88=_[_0x491b('0x31')]({},_0x575c88,_0x1d1ad2[_0x491b('0x47')]);var _0x5003bb={'where':_0x575c88[_0x491b('0x44')]};return db[_0x491b('0x36')][_0x491b('0x23')](_0x5003bb)[_0x491b('0x2a')](function(_0x3cceae){_0x5a9589['count']=_0x3cceae;if(_0x1d1ad2[_0x491b('0x3a')]['includeAll']){_0x575c88['include']=[{'all':!![]}];}return db['CmList'][_0x491b('0x48')](_0x575c88);})[_0x491b('0x2a')](function(_0x32ad4e){_0x5a9589[_0x491b('0x49')]=_0x32ad4e;return _0x5a9589;})[_0x491b('0x2a')](respondWithFilteredResult(_0x1efd06,_0x575c88))[_0x491b('0x4a')](handleError(_0x1efd06,null));};exports['show']=function(_0x56b814,_0x1b2d56){var _0x532cd0={'raw':![],'where':{'id':_0x56b814[_0x491b('0x4b')]['id']}},_0x1a95d7={};_0x1a95d7[_0x491b('0x3c')]=_[_0x491b('0x39')](db['CmList'][_0x491b('0x37')]);_0x1a95d7[_0x491b('0x3a')]=_['keys'](_0x56b814[_0x491b('0x3a')]);_0x1a95d7[_0x491b('0x4c')]=_['intersection'](_0x1a95d7['model'],_0x1a95d7[_0x491b('0x3a')]);_0x532cd0[_0x491b('0x3d')]=_[_0x491b('0x3b')](_0x1a95d7[_0x491b('0x3c')],qs[_0x491b('0x3e')](_0x56b814[_0x491b('0x3a')]['fields']));_0x532cd0[_0x491b('0x3d')]=_0x532cd0[_0x491b('0x3d')][_0x491b('0x3f')]?_0x532cd0[_0x491b('0x3d')]:_0x1a95d7[_0x491b('0x3c')];if(_0x56b814[_0x491b('0x3a')][_0x491b('0x4d')]){_0x532cd0[_0x491b('0x4e')]=[{'all':!![]}];}_0x532cd0=_[_0x491b('0x31')]({},_0x532cd0,_0x56b814[_0x491b('0x47')]);return db[_0x491b('0x36')][_0x491b('0x4f')](_0x532cd0)[_0x491b('0x2a')](handleEntityNotFound(_0x1b2d56,null))[_0x491b('0x2a')](respondWithResult(_0x1b2d56,null))[_0x491b('0x4a')](handleError(_0x1b2d56,null));};exports[_0x491b('0x50')]=function(_0xd04a2d,_0x58a00a){return db[_0x491b('0x36')][_0x491b('0x50')](_0xd04a2d[_0x491b('0x51')],{})[_0x491b('0x2a')](function(_0x389a5c){var _0x5d59e2=_0xd04a2d['user']['get']({'plain':!![]});if(!_0x5d59e2)throw new Error(_0x491b('0x52'));if(_0x5d59e2[_0x491b('0x53')]==='user'){var _0x4da4ab=_0x389a5c[_0x491b('0x2c')]({'plain':!![]});var _0x1240e6=_0x491b('0x2d');return db[_0x491b('0x54')][_0x491b('0x4f')]({'where':{'name':_0x1240e6,'userProfileId':_0x5d59e2[_0x491b('0x55')]},'raw':!![]})[_0x491b('0x2a')](function(_0x12f231){if(_0x12f231&&_0x12f231[_0x491b('0x56')]===0x0){return db[_0x491b('0x57')][_0x491b('0x50')]({'name':_0x4da4ab[_0x491b('0x30')],'resourceId':_0x4da4ab['id'],'type':_0x12f231['name'],'sectionId':_0x12f231['id']},{})[_0x491b('0x2a')](function(){return _0x389a5c;});}else{return _0x389a5c;}})[_0x491b('0x4a')](function(_0x218991){logger[_0x491b('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x218991);throw _0x218991;});}return _0x389a5c;})['then'](respondWithResult(_0x58a00a,0xc9))[_0x491b('0x4a')](handleError(_0x58a00a,null));};exports[_0x491b('0x29')]=function(_0x2092f6,_0x27b9ef){if(_0x2092f6[_0x491b('0x51')]['id']){delete _0x2092f6['body']['id'];}return db[_0x491b('0x36')][_0x491b('0x4f')]({'where':{'id':_0x2092f6[_0x491b('0x4b')]['id']}})[_0x491b('0x2a')](handleEntityNotFound(_0x27b9ef,null))['then'](saveUpdates(_0x2092f6[_0x491b('0x51')],null))['then'](respondWithResult(_0x27b9ef,null))['catch'](handleError(_0x27b9ef,null));};exports[_0x491b('0x2b')]=function(_0xf7074f,_0x11bc23){return db[_0x491b('0x36')][_0x491b('0x4f')]({'where':{'id':_0xf7074f['params']['id']}})[_0x491b('0x2a')](handleEntityNotFound(_0x11bc23,null))[_0x491b('0x2a')](removeEntity(_0x11bc23,null))[_0x491b('0x4a')](handleError(_0x11bc23,null));};exports[_0x491b('0x58')]=function(_0x10c7f3,_0x1eef11){return db[_0x491b('0x36')][_0x491b('0x58')]()[_0x491b('0x2a')](respondWithResult(_0x1eef11,null))['catch'](handleError(_0x1eef11,null));};exports[_0x491b('0x59')]=function(_0x49960d,_0x375542,_0x21204a){if(_0x49960d[_0x491b('0x51')]['id']){delete _0x49960d[_0x491b('0x51')]['id'];}return db[_0x491b('0x36')][_0x491b('0x4f')]({'where':{'id':_0x49960d[_0x491b('0x4b')]['id']}})[_0x491b('0x2a')](handleEntityNotFound(_0x375542,null))[_0x491b('0x2a')](function(_0x1b4b98){if(_0x1b4b98){_0x49960d[_0x491b('0x51')]['ListId']=_0x1b4b98['id'];return db[_0x491b('0x5a')][_0x491b('0x50')](_0x49960d['body']);}})[_0x491b('0x2a')](respondWithResult(_0x375542,null))[_0x491b('0x4a')](handleError(_0x375542,null));};exports['getDispositions']=function(_0x45b85d,_0x374801,_0x2453e2){var _0x1ef344={'raw':![],'where':{}};var _0x27f9d7={};var _0x31868a={'count':0x0,'rows':[]};return db[_0x491b('0x36')]['findOne']({'where':{'id':_0x45b85d[_0x491b('0x4b')]['id']}})[_0x491b('0x2a')](handleEntityNotFound(_0x374801,null))[_0x491b('0x2a')](function(_0x5233fc){if(_0x5233fc){_0x27f9d7[_0x491b('0x3c')]=_['keys'](db['Disposition'][_0x491b('0x37')]);_0x27f9d7[_0x491b('0x3a')]=_['keys'](_0x45b85d[_0x491b('0x3a')]);_0x27f9d7['filters']=_['intersection'](_0x27f9d7['model'],_0x27f9d7[_0x491b('0x3a')]);_0x1ef344['attributes']=_[_0x491b('0x3b')](_0x27f9d7[_0x491b('0x3c')],qs[_0x491b('0x3e')](_0x45b85d[_0x491b('0x3a')][_0x491b('0x3e')]));_0x1ef344['attributes']=_0x1ef344[_0x491b('0x3d')][_0x491b('0x3f')]?_0x1ef344['attributes']:_0x27f9d7[_0x491b('0x3c')];if(!_0x45b85d[_0x491b('0x3a')][_0x491b('0x40')]('nolimit')){_0x1ef344[_0x491b('0x22')]=qs['limit'](_0x45b85d[_0x491b('0x3a')][_0x491b('0x22')]);_0x1ef344[_0x491b('0x20')]=qs[_0x491b('0x20')](_0x45b85d['query'][_0x491b('0x20')]);}_0x1ef344[_0x491b('0x42')]=qs[_0x491b('0x43')](_0x45b85d[_0x491b('0x3a')][_0x491b('0x43')]);_0x1ef344[_0x491b('0x44')]=qs['filters'](_[_0x491b('0x45')](_0x45b85d[_0x491b('0x3a')],_0x27f9d7[_0x491b('0x4c')]));_0x1ef344[_0x491b('0x44')][_0x491b('0x5b')]=_0x5233fc['id'];if(_0x45b85d[_0x491b('0x3a')][_0x491b('0x46')]){_0x1ef344[_0x491b('0x44')]=_['merge'](_0x1ef344[_0x491b('0x44')],{'$or':_['map'](_0x1ef344[_0x491b('0x3d')],function(_0x52147c){var _0x1a58b4={};_0x1a58b4[_0x52147c]={'$like':'%'+_0x45b85d[_0x491b('0x3a')]['filter']+'%'};return _0x1a58b4;})});}_0x1ef344=_[_0x491b('0x31')]({},_0x1ef344,_0x45b85d['options']);return db[_0x491b('0x5a')][_0x491b('0x23')]({'where':_0x1ef344[_0x491b('0x44')]})[_0x491b('0x2a')](function(_0x2e9eb9){_0x31868a[_0x491b('0x23')]=_0x2e9eb9;if(_0x45b85d[_0x491b('0x3a')][_0x491b('0x4d')]){_0x1ef344[_0x491b('0x4e')]=[{'all':!![]}];}return db[_0x491b('0x5a')][_0x491b('0x48')](_0x1ef344);})[_0x491b('0x2a')](function(_0x33a60c){_0x31868a[_0x491b('0x49')]=_0x33a60c;return _0x31868a;});}})[_0x491b('0x2a')](respondWithFilteredResult(_0x374801,_0x1ef344))[_0x491b('0x4a')](handleError(_0x374801,null));};exports[_0x491b('0x5c')]=function(_0x286cbc,_0x1416ad,_0x986cb8){return db[_0x491b('0x36')][_0x491b('0x4f')]({'where':{'id':_0x286cbc[_0x491b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1416ad,null))['then'](function(_0x297e26){if(_0x297e26){return _0x297e26[_0x491b('0x5c')](_0x286cbc[_0x491b('0x3a')][_0x491b('0x5d')]);}})[_0x491b('0x2a')](respondWithStatusCode(_0x1416ad,null))['catch'](handleError(_0x1416ad,null));};exports['addContacts']=function(_0x3ad06a,_0x172b66,_0x12a07f){return db['CmList'][_0x491b('0x4f')]({'where':{'id':_0x3ad06a['params']['id']}})[_0x491b('0x2a')](handleEntityNotFound(_0x172b66,null))[_0x491b('0x2a')](function(_0x399ac5){if(_0x399ac5){var _0x4cb10e=[];var _0x363bb0={'success':[],'errors':[]};return db[_0x491b('0x5e')]['describe']()[_0x491b('0x2a')](function(_0x588570){if(_0x3ad06a[_0x491b('0x51')][_0x491b('0x5f')]&&_[_0x491b('0x60')](_0x3ad06a[_0x491b('0x51')][_0x491b('0x5f')])){if(_0x3ad06a[_0x491b('0x51')][_0x491b('0x5f')][_0x491b('0x3f')]){_0x3ad06a[_0x491b('0x51')][_0x491b('0x5f')]=_0x3ad06a['body'][_0x491b('0x5f')][_0x491b('0x61')](';')+';';}else{_0x3ad06a[_0x491b('0x51')]['tags']=null;}}else{_0x3ad06a[_0x491b('0x51')][_0x491b('0x5f')]=null;}if(_0x3ad06a[_0x491b('0x51')]&&_[_0x491b('0x60')](_0x3ad06a[_0x491b('0x51')])){for(var _0x3838ec=0x0;_0x3838ec<_0x3ad06a[_0x491b('0x51')][_0x491b('0x3f')];_0x3838ec+=0x1){_0x3ad06a[_0x491b('0x51')][_0x3838ec][_0x491b('0x5b')]=_0x3ad06a[_0x491b('0x4b')]['id'];_0x4cb10e[_0x491b('0x62')](_0x3ad06a[_0x491b('0x51')][_0x3838ec]);}return BPromise['each'](_0x4cb10e,function(_0x1ea232){return db[_0x491b('0x5e')][_0x491b('0x50')](_['omit'](_0x1ea232,[_0x491b('0x5d'),'id'])||{},{'fields':_[_0x491b('0x39')](_0x588570),'raw':!![]})[_0x491b('0x2a')](function(_0x49260b){_0x363bb0[_0x491b('0x63')][_0x491b('0x62')](_0x49260b['dataValues']);})[_0x491b('0x4a')](function(_0x5c42f8){_0x363bb0[_0x491b('0x64')][_0x491b('0x62')]({'data':_0x1ea232,'error':_0x5c42f8['message']});});})[_0x491b('0x2a')](function(_0x36f76b){return _0x363bb0;})['catch'](function(_0x1289ff){return _0x1289ff;});}else{_0x172b66[_0x491b('0x1d')](0x190)[_0x491b('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x172b66,null))[_0x491b('0x4a')](handleError(_0x172b66,null));};exports['getContacts']=function(_0x2006da,_0x317ed8,_0x2c6bdc){var _0x20ca10;return db[_0x491b('0x36')][_0x491b('0x4f')]({'where':{'id':_0x2006da[_0x491b('0x4b')]['id']},'include':[{'model':db[_0x491b('0x65')],'as':_0x491b('0x66')}]})['then'](handleEntityNotFound(_0x317ed8,null))[_0x491b('0x2a')](function(_0xb5bb29){if(_0xb5bb29){_0x20ca10=_0xb5bb29;return db[_0x491b('0x5e')][_0x491b('0x37')];}})[_0x491b('0x2a')](function(_0x361e8d){if(_0x361e8d){var _0x172c10={};var _0x3a5541={};_0x3a5541[_0x491b('0x3c')]=_[_0x491b('0x67')](_[_0x491b('0x39')](_0x361e8d),_['map'](_0x20ca10[_0x491b('0x66')],function(_0x4ea7d5){return util['format'](_0x491b('0x68'),_0x4ea7d5['id']);}));_0x3a5541[_0x491b('0x3a')]=_[_0x491b('0x39')](_0x2006da[_0x491b('0x3a')]);_0x3a5541[_0x491b('0x4c')]=_[_0x491b('0x3b')](_0x3a5541[_0x491b('0x3c')],_0x3a5541[_0x491b('0x3a')]);_0x172c10[_0x491b('0x3d')]=_['intersection'](_0x3a5541[_0x491b('0x3c')],qs['fields'](_0x2006da[_0x491b('0x3a')]['fields']));_0x172c10[_0x491b('0x3d')]=_0x172c10[_0x491b('0x3d')]['length']?_0x172c10[_0x491b('0x3d')]:_0x3a5541['model'];if(!_0x2006da[_0x491b('0x3a')][_0x491b('0x40')]('nolimit')){_0x172c10[_0x491b('0x22')]=qs[_0x491b('0x22')](_0x2006da['query'][_0x491b('0x22')]);_0x172c10[_0x491b('0x20')]=qs[_0x491b('0x20')](_0x2006da[_0x491b('0x3a')][_0x491b('0x20')]);}_0x172c10[_0x491b('0x42')]=qs[_0x491b('0x43')](_0x2006da[_0x491b('0x3a')][_0x491b('0x43')]);_0x172c10[_0x491b('0x44')]=qs[_0x491b('0x4c')](_['pick'](_0x2006da['query'],_0x3a5541[_0x491b('0x4c')]));_0x172c10[_0x491b('0x69')]=!![];if(_0x2006da[_0x491b('0x3a')][_0x491b('0x46')]){_0x172c10[_0x491b('0x44')]=_['merge'](_0x172c10[_0x491b('0x44')],{'$or':_[_0x491b('0x35')](_0x172c10[_0x491b('0x3d')],function(_0x8a7936){var _0x54828e={};_0x54828e[_0x8a7936]={'$like':'%'+_0x2006da[_0x491b('0x3a')][_0x491b('0x46')]+'%'};return _0x54828e;})});}_0x172c10=_[_0x491b('0x31')]({},_0x172c10,_0x2006da[_0x491b('0x47')]);return _0x20ca10[_0x491b('0x6a')](_0x172c10);}})[_0x491b('0x2a')](respondWithResult(_0x317ed8,null))[_0x491b('0x4a')](handleError(_0x317ed8,null));};exports[_0x491b('0x6b')]=function(_0x5914d7,_0x170329,_0x412451){var _0x29f962;return db[_0x491b('0x36')][_0x491b('0x4f')]({'where':{'id':_0x5914d7[_0x491b('0x4b')]['id']},'include':[{'model':db[_0x491b('0x65')],'as':_0x491b('0x66')}]})[_0x491b('0x2a')](handleEntityNotFound(_0x170329,null))[_0x491b('0x2a')](function(_0x3c02c5){if(_0x3c02c5){_0x29f962=_0x3c02c5;return db[_0x491b('0x5e')][_0x491b('0x37')];}})['then'](function(_0x17c9b6){if(_0x17c9b6){var _0x244d5c={};var _0x43408f={};_0x43408f[_0x491b('0x3c')]=_[_0x491b('0x67')](_['keys'](_0x17c9b6),_['map'](_0x29f962[_0x491b('0x66')],function(_0x219df5){return util[_0x491b('0x6c')](_0x491b('0x68'),_0x219df5['id']);}));_0x43408f['query']=_[_0x491b('0x39')](_0x5914d7[_0x491b('0x3a')]);_0x43408f[_0x491b('0x4c')]=_[_0x491b('0x3b')](_0x43408f[_0x491b('0x3c')],_0x43408f[_0x491b('0x3a')]);_0x244d5c[_0x491b('0x3d')]=_[_0x491b('0x3b')](_0x43408f[_0x491b('0x3c')],qs[_0x491b('0x3e')](_0x5914d7['query'][_0x491b('0x3e')]));_0x244d5c[_0x491b('0x3d')]=_0x244d5c[_0x491b('0x3d')][_0x491b('0x3f')]?_0x244d5c[_0x491b('0x3d')]:_0x43408f[_0x491b('0x3c')];if(!_0x5914d7[_0x491b('0x3a')][_0x491b('0x40')](_0x491b('0x41'))){_0x244d5c['limit']=qs[_0x491b('0x22')](_0x5914d7[_0x491b('0x3a')][_0x491b('0x22')]);_0x244d5c['offset']=qs[_0x491b('0x20')](_0x5914d7[_0x491b('0x3a')][_0x491b('0x20')]);}_0x244d5c[_0x491b('0x42')]=qs[_0x491b('0x43')](_0x5914d7[_0x491b('0x3a')][_0x491b('0x43')]);_0x244d5c[_0x491b('0x44')]=qs[_0x491b('0x4c')](_['pick'](_0x5914d7['query'],_0x43408f[_0x491b('0x4c')]));_0x244d5c[_0x491b('0x69')]=!![];if(_0x5914d7[_0x491b('0x3a')]['filter']){_0x244d5c[_0x491b('0x44')]=_[_0x491b('0x31')](_0x244d5c[_0x491b('0x44')],{'$or':_['map'](_0x244d5c['attributes'],function(_0x58ab9b){var _0x1256dd={};_0x1256dd[_0x58ab9b]={'$like':'%'+_0x5914d7[_0x491b('0x3a')][_0x491b('0x46')]+'%'};return _0x1256dd;})});}_0x244d5c=_[_0x491b('0x31')]({},_0x244d5c,_0x5914d7[_0x491b('0x47')]);return _0x29f962[_0x491b('0x6a')](_0x244d5c);}})[_0x491b('0x2a')](function(_0x3aaa91){if(!_['isEmpty'](_0x3aaa91)){var _0x123e9b=toCsv(_0x3aaa91);var _0x51a0f8=Date['now']();fs[_0x491b('0x6d')](util[_0x491b('0x6c')](_0x491b('0x6e'),_0x29f962['id'],_0x51a0f8),_0x123e9b);_0x170329[_0x491b('0x6f')]('Content-disposition',_0x491b('0x70')+util[_0x491b('0x6c')]('list_%d_%s.csv',_0x29f962['id'],_0x51a0f8));_0x170329[_0x491b('0x6f')]('Content-type',_0x491b('0x71'));return _0x170329[_0x491b('0x72')](util['format'](_0x491b('0x6e'),_0x29f962['id'],_0x51a0f8));}else{return _0x170329[_0x491b('0x1c')](0xcc);}})[_0x491b('0x4a')](handleError(_0x170329,null));};exports['addCustomField']=function(_0x32dd0d,_0x11b6a0,_0x2dc56a){var _0x1be328;delete _0x32dd0d[_0x491b('0x51')]['id'];return db[_0x491b('0x36')][_0x491b('0x73')]({'where':{'id':_0x32dd0d[_0x491b('0x4b')]['id']}})[_0x491b('0x2a')](handleEntityNotFound(_0x11b6a0,null))['then'](function(_0x3edcdb){if(_0x3edcdb){return db[_0x491b('0x74')][_0x491b('0x75')](function(_0x1ee861){return db['CmCustomField']['create'](_0x32dd0d[_0x491b('0x51')],{'transaction':_0x1ee861})[_0x491b('0x2a')](function(_0x9c73c7){_0x1be328=_0x9c73c7;return _0x3edcdb[_0x491b('0x76')](_0x9c73c7,{'transaction':_0x1ee861});})['then'](function(){var _0x2f2014={'type':db['Sequelize']['TEXT'],'transaction':_0x1ee861};switch(_0x32dd0d[_0x491b('0x51')][_0x491b('0x38')]){case'text':_0x2f2014[_0x491b('0x38')]=db[_0x491b('0x77')][_0x491b('0x78')];break;case _0x491b('0x79'):_0x2f2014['type']=db[_0x491b('0x77')][_0x491b('0x7a')];break;case _0x491b('0x7b'):_0x2f2014[_0x491b('0x38')]=db[_0x491b('0x77')][_0x491b('0x7c')];_0x2f2014['defaultValue']=![];break;default:}return db['sequelize'][_0x491b('0x7d')]['addColumn'](_0x491b('0x7e'),util[_0x491b('0x6c')](_0x491b('0x7f'),_0x1be328['id']),_0x2f2014);})['then'](function(){return _0x1be328;});});}})['then'](respondWithResult(_0x11b6a0,null))['catch'](handleError(_0x11b6a0,null));};exports[_0x491b('0x80')]=function(_0x24efb9,_0x5545bb,_0x18518a){var _0x6f1ecb={};var _0x1a1cd4={};var _0x28cf51;var _0x42e643;return db['CmList']['findOne']({'where':{'id':_0x24efb9[_0x491b('0x4b')]['id']}})[_0x491b('0x2a')](handleEntityNotFound(_0x5545bb,null))[_0x491b('0x2a')](function(_0x4d742a){if(_0x4d742a){_0x28cf51=_0x4d742a;_0x1a1cd4[_0x491b('0x3c')]=_['keys'](db['CmCustomField'][_0x491b('0x37')]);_0x1a1cd4['query']=_['keys'](_0x24efb9['query']);_0x1a1cd4['filters']=_['intersection'](_0x1a1cd4['model'],_0x1a1cd4['query']);_0x6f1ecb['attributes']=_[_0x491b('0x3b')](_0x1a1cd4['model'],qs[_0x491b('0x3e')](_0x24efb9[_0x491b('0x3a')][_0x491b('0x3e')]));_0x6f1ecb[_0x491b('0x3d')]=_0x6f1ecb[_0x491b('0x3d')][_0x491b('0x3f')]?_0x6f1ecb[_0x491b('0x3d')]:_0x1a1cd4[_0x491b('0x3c')];_0x6f1ecb[_0x491b('0x42')]=qs[_0x491b('0x43')](_0x24efb9[_0x491b('0x3a')]['sort']);_0x6f1ecb[_0x491b('0x44')]=qs[_0x491b('0x4c')](_[_0x491b('0x45')](_0x24efb9['query'],_0x1a1cd4['filters']));_0x6f1ecb['where']=_[_0x491b('0x31')](_0x6f1ecb['where'],{'$or':[{'ListId':_0x4d742a['id']},{'ListId':null}]});if(_0x24efb9[_0x491b('0x3a')]['filter']){_0x6f1ecb[_0x491b('0x44')]=_[_0x491b('0x31')](_0x6f1ecb['where'],{'$or':_[_0x491b('0x35')](_0x6f1ecb[_0x491b('0x3d')],function(_0x87d36e){var _0x496bc2={};_0x496bc2[_0x87d36e]={'$like':'%'+_0x24efb9[_0x491b('0x3a')][_0x491b('0x46')]+'%'};return _0x496bc2;})});}_0x6f1ecb=_[_0x491b('0x31')]({},_0x6f1ecb,_0x24efb9[_0x491b('0x47')]);return db[_0x491b('0x65')][_0x491b('0x81')](_0x6f1ecb);}})[_0x491b('0x2a')](respondWithResult(_0x5545bb,null))[_0x491b('0x4a')](handleError(_0x5545bb,null));};exports['addAgents']=function(_0x5d245c,_0x49a8a5,_0x4cbb74){return db['CmList'][_0x491b('0x4f')]({'where':{'id':_0x5d245c['params']['id']}})[_0x491b('0x2a')](handleEntityNotFound(_0x49a8a5,null))[_0x491b('0x2a')](function(_0xce2a7a){if(_0xce2a7a){return _0xce2a7a[_0x491b('0x82')](_0x5d245c[_0x491b('0x51')][_0x491b('0x5d')],_[_0x491b('0x83')](_0x5d245c[_0x491b('0x51')],['ids','id'])||{})[_0x491b('0x84')](function(_0x17ad50){for(var _0xa3ee05=0x0;_0xa3ee05<_0x5d245c[_0x491b('0x51')][_0x491b('0x5d')]['length'];_0xa3ee05+=0x1){socket[_0x491b('0x85')](_0x491b('0x86'),{'UserId':_0x5d245c['body'][_0x491b('0x5d')][_0xa3ee05],'CmListId':_0x5d245c[_0x491b('0x4b')]['id']});}return _0x17ad50;});}})[_0x491b('0x2a')](respondWithResult(_0x49a8a5,null))[_0x491b('0x4a')](handleError(_0x49a8a5,null));};exports[_0x491b('0x87')]=function(_0x2cc20a,_0x1155a3,_0x3928e8){return db['CmList'][_0x491b('0x4f')]({'where':{'id':_0x2cc20a[_0x491b('0x4b')]['id']}})[_0x491b('0x2a')](handleEntityNotFound(_0x1155a3,null))[_0x491b('0x2a')](function(_0x506fdd){if(_0x506fdd){return _0x506fdd[_0x491b('0x87')](_0x2cc20a[_0x491b('0x3a')][_0x491b('0x5d')])[_0x491b('0x2a')](function(){if(_[_0x491b('0x60')](_0x2cc20a['query']['ids'])){for(var _0x171345=0x0;_0x171345<_0x2cc20a['query'][_0x491b('0x5d')][_0x491b('0x3f')];_0x171345+=0x1){socket[_0x491b('0x85')](_0x491b('0x88'),{'UserId':Number(_0x2cc20a[_0x491b('0x3a')][_0x491b('0x5d')][_0x171345]),'CmListId':Number(_0x2cc20a[_0x491b('0x4b')]['id'])});}}else{socket[_0x491b('0x85')](_0x491b('0x88'),{'UserId':Number(_0x2cc20a[_0x491b('0x3a')][_0x491b('0x5d')]),'CmListId':Number(_0x2cc20a[_0x491b('0x4b')]['id'])});}});}})[_0x491b('0x2a')](respondWithStatusCode(_0x1155a3,null))[_0x491b('0x4a')](handleError(_0x1155a3,null));};exports[_0x491b('0x89')]=function(_0x179752,_0x496a56,_0x3c626f){var _0x2186be={};var _0x5ff788={};var _0x4c6a23;var _0x238adc;return db[_0x491b('0x36')][_0x491b('0x73')]({'where':{'id':_0x179752[_0x491b('0x4b')]['id']}})[_0x491b('0x2a')](handleEntityNotFound(_0x496a56,null))['then'](function(_0x38e5a9){if(_0x38e5a9){_0x4c6a23=_0x38e5a9;_0x5ff788[_0x491b('0x3c')]=_[_0x491b('0x39')](db[_0x491b('0x8a')]['rawAttributes']);_0x5ff788[_0x491b('0x3a')]=_[_0x491b('0x39')](_0x179752[_0x491b('0x3a')]);_0x5ff788[_0x491b('0x4c')]=_[_0x491b('0x3b')](_0x5ff788['model'],_0x5ff788[_0x491b('0x3a')]);_0x2186be[_0x491b('0x3d')]=_['intersection'](_0x5ff788['model'],qs['fields'](_0x179752[_0x491b('0x3a')]['fields']));_0x2186be[_0x491b('0x3d')]=_0x2186be[_0x491b('0x3d')][_0x491b('0x3f')]?_0x2186be[_0x491b('0x3d')]:_0x5ff788['model'];_0x2186be[_0x491b('0x42')]=qs[_0x491b('0x43')](_0x179752[_0x491b('0x3a')][_0x491b('0x43')]);_0x2186be[_0x491b('0x44')]=qs['filters'](_[_0x491b('0x45')](_0x179752['query'],_0x5ff788[_0x491b('0x4c')]));if(_0x179752[_0x491b('0x3a')]['filter']){_0x2186be[_0x491b('0x44')]=_[_0x491b('0x31')](_0x2186be[_0x491b('0x44')],{'$or':_[_0x491b('0x35')](_0x2186be['attributes'],function(_0x592163){var _0x3ee061={};_0x3ee061[_0x592163]={'$like':'%'+_0x179752[_0x491b('0x3a')][_0x491b('0x46')]+'%'};return _0x3ee061;})});}_0x2186be=_[_0x491b('0x31')]({},_0x2186be,_0x179752[_0x491b('0x47')]);return _0x4c6a23[_0x491b('0x89')](_0x2186be);}})['then'](function(_0x15e9f7){if(_0x15e9f7){_0x238adc=_0x15e9f7[_0x491b('0x3f')];if(!_0x179752[_0x491b('0x3a')][_0x491b('0x40')](_0x491b('0x41'))){_0x2186be[_0x491b('0x22')]=qs[_0x491b('0x22')](_0x179752[_0x491b('0x3a')]['limit']);_0x2186be['offset']=qs['offset'](_0x179752[_0x491b('0x3a')][_0x491b('0x20')]);}return _0x4c6a23['getAgents'](_0x2186be);}})[_0x491b('0x2a')](function(_0x2eb8bd){if(_0x2eb8bd){return _0x2eb8bd?{'count':_0x238adc,'rows':_0x2eb8bd}:null;}})['then'](respondWithResult(_0x496a56,null))[_0x491b('0x4a')](handleError(_0x496a56,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 8ff5a1b..96c310b 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 _0xeaa2=['exports','../../mysqldb','CmList','update','remove','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaa2,0xa9));var _0x2eaa=function(_0x381cd5,_0x1f66dd){_0x381cd5=_0x381cd5-0x0;var _0x14b162=_0xeaa2[_0x381cd5];return _0x14b162;};'use strict';var EventEmitter=require('events');var CmList=require(_0x2eaa('0x0'))['db'][_0x2eaa('0x1')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2eaa('0x2'),'afterDestroy':_0x2eaa('0x3')};function emitEvent(_0x11333c){return function(_0x523e33,_0x364038,_0x3c13c4){CmListEvents[_0x2eaa('0x4')](_0x11333c+':'+_0x523e33['id'],_0x523e33);CmListEvents[_0x2eaa('0x4')](_0x11333c,_0x523e33);_0x3c13c4(null);};}for(var e in events){if(events[_0x2eaa('0x5')](e)){var event=events[e];CmList[_0x2eaa('0x6')](e,emitEvent(event));}}module[_0x2eaa('0x7')]=CmListEvents; \ No newline at end of file +var _0x99fd=['exports','setMaxListeners','update','remove','emit','hook'];(function(_0x4ef048,_0x244de2){var _0x2d58ac=function(_0x5cd657){while(--_0x5cd657){_0x4ef048['push'](_0x4ef048['shift']());}};_0x2d58ac(++_0x244de2);}(_0x99fd,0x127));var _0xd99f=function(_0x549141,_0x39adcb){_0x549141=_0x549141-0x0;var _0x2ec9ce=_0x99fd[_0x549141];return _0x2ec9ce;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xd99f('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd99f('0x1'),'afterDestroy':_0xd99f('0x2')};function emitEvent(_0x5f29a9){return function(_0x296348,_0x4d17e4,_0x19f30f){CmListEvents[_0xd99f('0x3')](_0x5f29a9+':'+_0x296348['id'],_0x296348);CmListEvents[_0xd99f('0x3')](_0x5f29a9,_0x296348);_0x19f30f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xd99f('0x4')](e,emitEvent(event));}}module[_0xd99f('0x5')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 124cc6c..aca5fa8 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 _0xb786=['moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','../../config/logger'];(function(_0x291b73,_0xbf6d73){var _0x20740d=function(_0x4c6d7d){while(--_0x4c6d7d){_0x291b73['push'](_0x291b73['shift']());}};_0x20740d(++_0xbf6d73);}(_0xb786,0xa5));var _0x6b78=function(_0x560434,_0x339ec1){_0x560434=_0x560434-0x0;var _0x24e61d=_0xb786[_0x560434];return _0x24e61d;};'use strict';var _=require(_0x6b78('0x0'));var util=require(_0x6b78('0x1'));var logger=require(_0x6b78('0x2'))('api');var moment=require(_0x6b78('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b78('0x4'));var fs=require('fs');var path=require(_0x6b78('0x5'));var rimraf=require(_0x6b78('0x6'));var config=require(_0x6b78('0x7'));var attributes=require(_0x6b78('0x8'));module[_0x6b78('0x9')]=function(_0x4f2397,_0x1ed934){return _0x4f2397[_0x6b78('0xa')](_0x6b78('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf64c=['api','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','CmList','cm_lists','lodash','util'];(function(_0x13e453,_0x4ab30c){var _0x26aad2=function(_0x3387a1){while(--_0x3387a1){_0x13e453['push'](_0x13e453['shift']());}};_0x26aad2(++_0x4ab30c);}(_0xf64c,0x148));var _0xcf64=function(_0x113765,_0x4c2698){_0x113765=_0x113765-0x0;var _0xdb473c=_0xf64c[_0x113765];return _0xdb473c;};'use strict';var _=require(_0xcf64('0x0'));var util=require(_0xcf64('0x1'));var logger=require('../../config/logger')(_0xcf64('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf64('0x3'));var fs=require('fs');var path=require(_0xcf64('0x4'));var rimraf=require(_0xcf64('0x5'));var config=require(_0xcf64('0x6'));var attributes=require(_0xcf64('0x7'));module[_0xcf64('0x8')]=function(_0x1dd823,_0x16a209){return _0x1dd823['define'](_0xcf64('0x9'),attributes,{'tableName':_0xcf64('0xa'),'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 5f6c5f8..6f16ccb 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 _0x180b=['localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis'];(function(_0x321df4,_0x3efec5){var _0x50d06c=function(_0x3ac0f4){while(--_0x3ac0f4){_0x321df4['push'](_0x321df4['shift']());}};_0x50d06c(++_0x3efec5);}(_0x180b,0x12d));var _0xb180=function(_0xb581a5,_0x2ccfd8){_0xb581a5=_0xb581a5-0x0;var _0x3213f2=_0x180b[_0xb581a5];return _0x3213f2;};'use strict';var _=require(_0xb180('0x0'));var util=require(_0xb180('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb180('0x2'));var fs=require('fs');var Redis=require(_0xb180('0x3'));var db=require(_0xb180('0x4'))['db'];var utils=require(_0xb180('0x5'));var logger=require(_0xb180('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb180('0x7'));var client=jayson[_0xb180('0x8')][_0xb180('0x9')]({'port':0x232a});config[_0xb180('0xa')]=_['defaults'](config[_0xb180('0xa')],{'host':_0xb180('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb180('0xa')]));require(_0xb180('0xc'))[_0xb180('0xd')](socket);function respondWithRpcPromise(_0x241f3e,_0x3ec594,_0x2bcf97){return new BPromise(function(_0x2b8235,_0x1834ae){return client[_0xb180('0xe')](_0x241f3e,_0x2bcf97)[_0xb180('0xf')](function(_0xde37b2){logger['info'](_0xb180('0x10'),_0x3ec594,_0xb180('0x11'));logger['debug'](_0xb180('0x12'),_0x3ec594,_0xb180('0x11'),JSON[_0xb180('0x13')](_0xde37b2));if(_0xde37b2[_0xb180('0x14')]){if(_0xde37b2[_0xb180('0x14')][_0xb180('0x15')]===0x1f4){logger[_0xb180('0x14')](_0xb180('0x10'),_0x3ec594,_0xde37b2[_0xb180('0x14')][_0xb180('0x16')]);return _0x1834ae(_0xde37b2[_0xb180('0x14')]['message']);}logger[_0xb180('0x14')](_0xb180('0x10'),_0x3ec594,_0xde37b2[_0xb180('0x14')][_0xb180('0x16')]);return _0x2b8235(_0xde37b2['error']['message']);}else{logger[_0xb180('0x17')](_0xb180('0x10'),_0x3ec594,_0xb180('0x11'));_0x2b8235(_0xde37b2[_0xb180('0x18')][_0xb180('0x16')]);}})[_0xb180('0x19')](function(_0x31e783){logger[_0xb180('0x14')]('CmList,\x20%s,\x20%s',_0x3ec594,_0x31e783);_0x1834ae(_0x31e783);});});} \ No newline at end of file +var _0x03f0=['redis','localhost','socket.io-emitter','./cmList.socket','register','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x440b56,_0x146230){var _0x4d1d13=function(_0xb98af2){while(--_0xb98af2){_0x440b56['push'](_0x440b56['shift']());}};_0x4d1d13(++_0x146230);}(_0x03f0,0xe9));var _0x003f=function(_0x9cd6f1,_0x29cbe0){_0x9cd6f1=_0x9cd6f1-0x0;var _0x22c381=_0x03f0[_0x9cd6f1];return _0x22c381;};'use strict';var _=require('lodash');var util=require(_0x003f('0x0'));var moment=require('moment');var BPromise=require(_0x003f('0x1'));var rs=require(_0x003f('0x2'));var fs=require('fs');var Redis=require(_0x003f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x003f('0x4'))(_0x003f('0x5'));var config=require(_0x003f('0x6'));var jayson=require(_0x003f('0x7'));var client=jayson[_0x003f('0x8')][_0x003f('0x9')]({'port':0x232a});config[_0x003f('0xa')]=_['defaults'](config[_0x003f('0xa')],{'host':_0x003f('0xb'),'port':0x18eb});var socket=require(_0x003f('0xc'))(new Redis(config[_0x003f('0xa')]));require(_0x003f('0xd'))[_0x003f('0xe')](socket);function respondWithRpcPromise(_0x11eea2,_0xb288df,_0x5d11e8){return new BPromise(function(_0x184620,_0x487bbd){return client['request'](_0x11eea2,_0x5d11e8)[_0x003f('0xf')](function(_0x40631f){logger[_0x003f('0x10')]('CmList,\x20%s,\x20%s',_0xb288df,_0x003f('0x11'));logger[_0x003f('0x12')](_0x003f('0x13'),_0xb288df,_0x003f('0x11'),JSON[_0x003f('0x14')](_0x40631f));if(_0x40631f['error']){if(_0x40631f[_0x003f('0x15')][_0x003f('0x16')]===0x1f4){logger[_0x003f('0x15')](_0x003f('0x17'),_0xb288df,_0x40631f[_0x003f('0x15')][_0x003f('0x18')]);return _0x487bbd(_0x40631f[_0x003f('0x15')][_0x003f('0x18')]);}logger['error'](_0x003f('0x17'),_0xb288df,_0x40631f['error'][_0x003f('0x18')]);return _0x184620(_0x40631f[_0x003f('0x15')][_0x003f('0x18')]);}else{logger[_0x003f('0x10')](_0x003f('0x17'),_0xb288df,_0x003f('0x11'));_0x184620(_0x40631f[_0x003f('0x19')][_0x003f('0x18')]);}})[_0x003f('0x1a')](function(_0x35ad3a){logger[_0x003f('0x15')](_0x003f('0x17'),_0xb288df,_0x35ad3a);_0x487bbd(_0x35ad3a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4c641d1..a7f1983 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 _0xbd51=['removeListener','register','length','cmList:','./cmList.events','remove','update'];(function(_0x37f177,_0x191577){var _0x28ac67=function(_0x3ce66f){while(--_0x3ce66f){_0x37f177['push'](_0x37f177['shift']());}};_0x28ac67(++_0x191577);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x356d60,_0x440d04){_0x356d60=_0x356d60-0x0;var _0x4412e6=_0xbd51[_0x356d60];return _0x4412e6;};'use strict';var CmListEvents=require(_0x1bd5('0x0'));var events=['save',_0x1bd5('0x1'),_0x1bd5('0x2')];function createListener(_0x3b9f71,_0x1a9dcc){return function(_0x545aac){_0x1a9dcc['emit'](_0x3b9f71,_0x545aac);};}function removeListener(_0x58af16,_0x531028){return function(){CmListEvents[_0x1bd5('0x3')](_0x58af16,_0x531028);};}exports[_0x1bd5('0x4')]=function(_0x43e6b6){for(var _0x59ddfb=0x0,_0x29abea=events[_0x1bd5('0x5')];_0x59ddfb<_0x29abea;_0x59ddfb++){var _0x19077c=events[_0x59ddfb];var _0x27d58f=createListener(_0x1bd5('0x6')+_0x19077c,_0x43e6b6);CmListEvents['on'](_0x19077c,_0x27d58f);}}; \ No newline at end of file +var _0x38d3=['save','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x38d3,0x1a7));var _0x338d=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x38d3[_0x487b0c];return _0x1adbdc;};'use strict';var CmListEvents=require(_0x338d('0x0'));var events=[_0x338d('0x1'),'remove',_0x338d('0x2')];function createListener(_0x338ef5,_0x22c076){return function(_0x43ebf7){_0x22c076[_0x338d('0x3')](_0x338ef5,_0x43ebf7);};}function removeListener(_0x1c47c6,_0x2b867){return function(){CmListEvents[_0x338d('0x4')](_0x1c47c6,_0x2b867);};}exports[_0x338d('0x5')]=function(_0x4e32b4){for(var _0x2a056d=0x0,_0x2012c3=events[_0x338d('0x6')];_0x2a056d<_0x2012c3;_0x2a056d++){var _0x2b7aab=events[_0x2a056d];var _0x60eaa1=createListener(_0x338d('0x7')+_0x2b7aab,_0x4e32b4);CmListEvents['on'](_0x2b7aab,_0x60eaa1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 957e7cc..63d43c5 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 _0xcd69=['/:id/contacts','/:id/contacts/csv','/:id/fields','/:id/users','getAgents','create','addDisposition','post','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0xf414f3,_0x51886d){var _0x54c5fd=function(_0x4d8bd2){while(--_0x4d8bd2){_0xf414f3['push'](_0xf414f3['shift']());}};_0x54c5fd(++_0x51886d);}(_0xcd69,0xdd));var _0x9cd6=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xcd69[_0x38537f];return _0x141e23;};'use strict';var multer=require(_0x9cd6('0x0'));var util=require(_0x9cd6('0x1'));var path=require(_0x9cd6('0x2'));var timeout=require(_0x9cd6('0x3'));var express=require(_0x9cd6('0x4'));var router=express[_0x9cd6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9cd6('0x7'));router[_0x9cd6('0x8')]('/',auth[_0x9cd6('0x9')](),controller[_0x9cd6('0xa')]);router[_0x9cd6('0x8')](_0x9cd6('0xb'),auth[_0x9cd6('0x9')](),controller[_0x9cd6('0xc')]);router[_0x9cd6('0x8')](_0x9cd6('0xd'),auth[_0x9cd6('0x9')](),controller[_0x9cd6('0xe')]);router[_0x9cd6('0x8')](_0x9cd6('0xf'),auth[_0x9cd6('0x9')](),controller[_0x9cd6('0x10')]);router[_0x9cd6('0x8')](_0x9cd6('0x11'),auth[_0x9cd6('0x9')](),controller['getContacts']);router[_0x9cd6('0x8')](_0x9cd6('0x12'),auth[_0x9cd6('0x9')](),controller['getContactsCsv']);router[_0x9cd6('0x8')](_0x9cd6('0x13'),auth[_0x9cd6('0x9')](),controller['getCustomFields']);router['get'](_0x9cd6('0x14'),auth[_0x9cd6('0x9')](),controller[_0x9cd6('0x15')]);router['post']('/',auth[_0x9cd6('0x9')](),controller[_0x9cd6('0x16')]);router['post'](_0x9cd6('0xf'),auth[_0x9cd6('0x9')](),controller[_0x9cd6('0x17')]);router[_0x9cd6('0x18')](_0x9cd6('0x11'),auth['isAuthenticated'](),controller[_0x9cd6('0x19')]);router[_0x9cd6('0x18')](_0x9cd6('0x13'),auth[_0x9cd6('0x9')](),controller[_0x9cd6('0x1a')]);router[_0x9cd6('0x18')](_0x9cd6('0x14'),auth[_0x9cd6('0x9')](),controller[_0x9cd6('0x1b')]);router[_0x9cd6('0x1c')](_0x9cd6('0xd'),auth[_0x9cd6('0x9')](),controller[_0x9cd6('0x1d')]);router[_0x9cd6('0x1e')](_0x9cd6('0xd'),auth['isAuthenticated'](),controller[_0x9cd6('0x1f')]);router[_0x9cd6('0x1e')](_0x9cd6('0xf'),auth[_0x9cd6('0x9')](),controller[_0x9cd6('0x20')]);router[_0x9cd6('0x1e')]('/:id/users',auth[_0x9cd6('0x9')](),controller[_0x9cd6('0x21')]);module['exports']=router; \ No newline at end of file +var _0xc6ad=['removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','getAgents','create','post','addDisposition','addContacts','/:id/users','addAgents','/:id','update','delete'];(function(_0x4baae3,_0x5f0235){var _0x454819=function(_0x4359ff){while(--_0x4359ff){_0x4baae3['push'](_0x4baae3['shift']());}};_0x454819(++_0x5f0235);}(_0xc6ad,0x1a6));var _0xdc6a=function(_0x3de823,_0x413206){_0x3de823=_0x3de823-0x0;var _0x3a4290=_0xc6ad[_0x3de823];return _0x3a4290;};'use strict';var multer=require(_0xdc6a('0x0'));var util=require('util');var path=require(_0xdc6a('0x1'));var timeout=require(_0xdc6a('0x2'));var express=require('express');var router=express[_0xdc6a('0x3')]();var fs_extra=require(_0xdc6a('0x4'));var auth=require(_0xdc6a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc6a('0x6'));var controller=require(_0xdc6a('0x7'));router[_0xdc6a('0x8')]('/',auth[_0xdc6a('0x9')](),controller[_0xdc6a('0xa')]);router[_0xdc6a('0x8')]('/describe',auth[_0xdc6a('0x9')](),controller['describe']);router[_0xdc6a('0x8')]('/:id',auth[_0xdc6a('0x9')](),controller['show']);router[_0xdc6a('0x8')](_0xdc6a('0xb'),auth[_0xdc6a('0x9')](),controller[_0xdc6a('0xc')]);router[_0xdc6a('0x8')](_0xdc6a('0xd'),auth[_0xdc6a('0x9')](),controller[_0xdc6a('0xe')]);router['get']('/:id/contacts/csv',auth[_0xdc6a('0x9')](),controller[_0xdc6a('0xf')]);router['get'](_0xdc6a('0x10'),auth[_0xdc6a('0x9')](),controller[_0xdc6a('0x11')]);router[_0xdc6a('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xdc6a('0x12')]);router['post']('/',auth[_0xdc6a('0x9')](),controller[_0xdc6a('0x13')]);router[_0xdc6a('0x14')](_0xdc6a('0xb'),auth[_0xdc6a('0x9')](),controller[_0xdc6a('0x15')]);router[_0xdc6a('0x14')](_0xdc6a('0xd'),auth[_0xdc6a('0x9')](),controller[_0xdc6a('0x16')]);router['post'](_0xdc6a('0x10'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xdc6a('0x14')](_0xdc6a('0x17'),auth[_0xdc6a('0x9')](),controller[_0xdc6a('0x18')]);router['put'](_0xdc6a('0x19'),auth['isAuthenticated'](),controller[_0xdc6a('0x1a')]);router['delete']('/:id',auth[_0xdc6a('0x9')](),controller['destroy']);router[_0xdc6a('0x1b')](_0xdc6a('0xb'),auth[_0xdc6a('0x9')](),controller['removeDispositions']);router[_0xdc6a('0x1b')]('/:id/users',auth[_0xdc6a('0x9')](),controller[_0xdc6a('0x1c')]);module[_0xdc6a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index dbb06cd..2927e2b 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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x4590c1,_0x5222d8){var _0x108205=function(_0x5985d9){while(--_0x5985d9){_0x4590c1['push'](_0x4590c1['shift']());}};_0x108205(++_0x5222d8);}(_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')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x27d7d1,_0x2148bc){var _0x1fd7c2=function(_0x44162b){while(--_0x44162b){_0x27d7d1['push'](_0x27d7d1['shift']());}};_0x1fd7c2(++_0x2148bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('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 6d493bc..0ed0a7b 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 _0x4f81=['stack','name','send','render','merge','contact','message','agent','interaction','account','update','body','find','catch','params','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','end','json','offset','undefined','limit','count','set','save','destroy','then','error'];(function(_0x139176,_0x3bb6a8){var _0x22ce6c=function(_0x4ba63c){while(--_0x4ba63c){_0x139176['push'](_0x139176['shift']());}};_0x22ce6c(++_0x3bb6a8);}(_0x4f81,0x1e3));var _0x14f8=function(_0x2994fe,_0x4b9d82){_0x2994fe=_0x2994fe-0x0;var _0x31454c=_0x4f81[_0x2994fe];return _0x31454c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x14f8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14f8('0x1'));var moment=require(_0x14f8('0x2'));var BPromise=require(_0x14f8('0x3'));var Mustache=require(_0x14f8('0x4'));var util=require(_0x14f8('0x5'));var path=require(_0x14f8('0x6'));var sox=require(_0x14f8('0x7'));var csv=require('to-csv');var ejs=require(_0x14f8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14f8('0x9'));var squel=require(_0x14f8('0xa'));var crypto=require('crypto');var jsforce=require(_0x14f8('0xb'));var deskjs=require(_0x14f8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x14f8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x14f8('0xe'));var qs=require(_0x14f8('0xf'));var as=require(_0x14f8('0x10'));var hardwareService=require(_0x14f8('0x11'));var logger=require(_0x14f8('0x12'))(_0x14f8('0x13'));var utils=require(_0x14f8('0x14'));var config=require(_0x14f8('0x15'));var licenseUtil=require(_0x14f8('0x16'));var db=require(_0x14f8('0x17'))['db'];function respondWithStatusCode(_0x228505,_0x29d50a){_0x29d50a=_0x29d50a||0xcc;return function(_0x5f2843){if(_0x5f2843){return _0x228505[_0x14f8('0x18')](_0x29d50a);}return _0x228505[_0x14f8('0x19')](_0x29d50a)[_0x14f8('0x1a')]();};}function respondWithResult(_0x422cb7,_0x1eae95){_0x1eae95=_0x1eae95||0xc8;return function(_0x4b3c32){if(_0x4b3c32){return _0x422cb7[_0x14f8('0x19')](_0x1eae95)[_0x14f8('0x1b')](_0x4b3c32);}};}function respondWithFilteredResult(_0x4022a3,_0x1216e8){return function(_0x57e917){if(_0x57e917){var _0x3481a1=typeof _0x1216e8[_0x14f8('0x1c')]===_0x14f8('0x1d')&&typeof _0x1216e8[_0x14f8('0x1e')]===_0x14f8('0x1d');var _0x1dfcc2=_0x57e917[_0x14f8('0x1f')];var _0x4a1a90=_0x3481a1?0x0:_0x1216e8[_0x14f8('0x1c')];var _0x4495de=_0x3481a1?_0x57e917['count']:_0x1216e8['offset']+_0x1216e8['limit'];var _0x3e62a1;if(_0x4495de>=_0x1dfcc2){_0x4495de=_0x1dfcc2;_0x3e62a1=0xc8;}else{_0x3e62a1=0xce;}_0x4022a3[_0x14f8('0x19')](_0x3e62a1);return _0x4022a3[_0x14f8('0x20')]('Content-Range',_0x4a1a90+'-'+_0x4495de+'/'+_0x1dfcc2)[_0x14f8('0x1b')](_0x57e917);}return null;};}function patchUpdates(_0x30c2cd){return function(_0x13b283){try{jsonpatch['apply'](_0x13b283,_0x30c2cd,!![]);}catch(_0x3526e5){return BPromise['reject'](_0x3526e5);}return _0x13b283[_0x14f8('0x21')]();};}function saveUpdates(_0x14fa31,_0x4bfacd){return function(_0x575a23){if(_0x575a23){return _0x575a23['update'](_0x14fa31)['then'](function(_0x32ebe5){return _0x32ebe5;});}return null;};}function removeEntity(_0x12f47f,_0x15995a){return function(_0x12443d){if(_0x12443d){return _0x12443d[_0x14f8('0x22')]()[_0x14f8('0x23')](function(){_0x12f47f['status'](0xcc)[_0x14f8('0x1a')]();});}};}function handleEntityNotFound(_0x504ac4,_0x16360d){return function(_0x26e370){if(!_0x26e370){_0x504ac4[_0x14f8('0x18')](0x194);}return _0x26e370;};}function handleError(_0x52fe4d,_0x45f4e9){_0x45f4e9=_0x45f4e9||0x1f4;return function(_0x5540ac){logger[_0x14f8('0x24')](_0x5540ac[_0x14f8('0x25')]);if(_0x5540ac['name']){delete _0x5540ac[_0x14f8('0x26')];}_0x52fe4d[_0x14f8('0x19')](_0x45f4e9)[_0x14f8('0x27')](_0x5540ac);};}function getMustacheRender(_0x4b319f,_0x408d99){return Mustache[_0x14f8('0x28')](_0x4b319f,_[_0x14f8('0x29')](_0x408d99['body'],{'contact':_0x408d99[_0x14f8('0x2a')],'message':_0x408d99[_0x14f8('0x2b')],'agent':_0x408d99[_0x14f8('0x2c')],'interaction':_0x408d99[_0x14f8('0x2d')],'account':_0x408d99[_0x14f8('0x2e')]}))||'';}exports[_0x14f8('0x2f')]=function(_0x21a482,_0x55b4b1){if(_0x21a482[_0x14f8('0x30')]['id']){delete _0x21a482['body']['id'];}return db['Condition'][_0x14f8('0x31')]({'where':{'id':_0x21a482['params']['id']}})[_0x14f8('0x23')](handleEntityNotFound(_0x55b4b1,null))[_0x14f8('0x23')](saveUpdates(_0x21a482[_0x14f8('0x30')],null))[_0x14f8('0x23')](respondWithResult(_0x55b4b1,null))[_0x14f8('0x32')](handleError(_0x55b4b1,null));};exports['destroy']=function(_0x24ddb6,_0xaa9b62){return db['Condition']['find']({'where':{'id':_0x24ddb6[_0x14f8('0x33')]['id']}})[_0x14f8('0x23')](handleEntityNotFound(_0xaa9b62,null))['then'](removeEntity(_0xaa9b62,null))[_0x14f8('0x32')](handleError(_0xaa9b62,null));}; \ No newline at end of file +var _0xbf44=['sendStatus','error','stack','name','send','merge','body','contact','message','agent','account','Condition','find','params','destroy','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','then'];(function(_0x89a001,_0x3a9a8c){var _0x5f3ec2=function(_0x3e849b){while(--_0x3e849b){_0x89a001['push'](_0x89a001['shift']());}};_0x5f3ec2(++_0x3a9a8c);}(_0xbf44,0xa0));var _0x4bf4=function(_0x29ee0a,_0x2e019b){_0x29ee0a=_0x29ee0a-0x0;var _0x54efbf=_0xbf44[_0x29ee0a];return _0x54efbf;};'use strict';var emlformat=require(_0x4bf4('0x0'));var rimraf=require(_0x4bf4('0x1'));var zipdir=require(_0x4bf4('0x2'));var jsonpatch=require(_0x4bf4('0x3'));var rp=require('request-promise');var moment=require(_0x4bf4('0x4'));var BPromise=require(_0x4bf4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4bf4('0x6'));var csv=require(_0x4bf4('0x7'));var ejs=require(_0x4bf4('0x8'));var fs=require('fs');var fs_extra=require(_0x4bf4('0x9'));var _=require(_0x4bf4('0xa'));var squel=require(_0x4bf4('0xb'));var crypto=require('crypto');var jsforce=require(_0x4bf4('0xc'));var deskjs=require(_0x4bf4('0xd'));var toCsv=require(_0x4bf4('0x7'));var querystring=require('querystring');var Papa=require(_0x4bf4('0xe'));var Redis=require(_0x4bf4('0xf'));var authService=require(_0x4bf4('0x10'));var qs=require(_0x4bf4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4bf4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4bf4('0x13'));var db=require(_0x4bf4('0x14'))['db'];function respondWithStatusCode(_0x5db4a3,_0x1fbaf7){_0x1fbaf7=_0x1fbaf7||0xcc;return function(_0xe283ae){if(_0xe283ae){return _0x5db4a3['sendStatus'](_0x1fbaf7);}return _0x5db4a3[_0x4bf4('0x15')](_0x1fbaf7)[_0x4bf4('0x16')]();};}function respondWithResult(_0x1f94a2,_0x12bf07){_0x12bf07=_0x12bf07||0xc8;return function(_0x8419ff){if(_0x8419ff){return _0x1f94a2[_0x4bf4('0x15')](_0x12bf07)['json'](_0x8419ff);}};}function respondWithFilteredResult(_0x27f8a4,_0x3404fa){return function(_0x3d7d6a){if(_0x3d7d6a){var _0x4e9c31=typeof _0x3404fa[_0x4bf4('0x17')]===_0x4bf4('0x18')&&typeof _0x3404fa[_0x4bf4('0x19')]===_0x4bf4('0x18');var _0x4f6319=_0x3d7d6a['count'];var _0x1cc14d=_0x4e9c31?0x0:_0x3404fa[_0x4bf4('0x17')];var _0x233e43=_0x4e9c31?_0x3d7d6a[_0x4bf4('0x1a')]:_0x3404fa[_0x4bf4('0x17')]+_0x3404fa['limit'];var _0x1c5ed8;if(_0x233e43>=_0x4f6319){_0x233e43=_0x4f6319;_0x1c5ed8=0xc8;}else{_0x1c5ed8=0xce;}_0x27f8a4[_0x4bf4('0x15')](_0x1c5ed8);return _0x27f8a4['set'](_0x4bf4('0x1b'),_0x1cc14d+'-'+_0x233e43+'/'+_0x4f6319)[_0x4bf4('0x1c')](_0x3d7d6a);}return null;};}function patchUpdates(_0xc39df2){return function(_0x2df888){try{jsonpatch[_0x4bf4('0x1d')](_0x2df888,_0xc39df2,!![]);}catch(_0x18bcb4){return BPromise['reject'](_0x18bcb4);}return _0x2df888[_0x4bf4('0x1e')]();};}function saveUpdates(_0x36972d,_0x593718){return function(_0x40b3e8){if(_0x40b3e8){return _0x40b3e8['update'](_0x36972d)[_0x4bf4('0x1f')](function(_0x4f0b8d){return _0x4f0b8d;});}return null;};}function removeEntity(_0x4aa129,_0x3d0cee){return function(_0x86d77f){if(_0x86d77f){return _0x86d77f['destroy']()[_0x4bf4('0x1f')](function(){_0x4aa129['status'](0xcc)[_0x4bf4('0x16')]();});}};}function handleEntityNotFound(_0x51fa77,_0x1a9bb7){return function(_0x9d0fb1){if(!_0x9d0fb1){_0x51fa77[_0x4bf4('0x20')](0x194);}return _0x9d0fb1;};}function handleError(_0x2ffc0e,_0x403670){_0x403670=_0x403670||0x1f4;return function(_0x13b45e){logger[_0x4bf4('0x21')](_0x13b45e[_0x4bf4('0x22')]);if(_0x13b45e[_0x4bf4('0x23')]){delete _0x13b45e[_0x4bf4('0x23')];}_0x2ffc0e[_0x4bf4('0x15')](_0x403670)[_0x4bf4('0x24')](_0x13b45e);};}function getMustacheRender(_0x48a2c0,_0x8584b5){return Mustache['render'](_0x48a2c0,_[_0x4bf4('0x25')](_0x8584b5[_0x4bf4('0x26')],{'contact':_0x8584b5[_0x4bf4('0x27')],'message':_0x8584b5[_0x4bf4('0x28')],'agent':_0x8584b5[_0x4bf4('0x29')],'interaction':_0x8584b5['interaction'],'account':_0x8584b5[_0x4bf4('0x2a')]}))||'';}exports['update']=function(_0x1d31a5,_0x2508ef){if(_0x1d31a5[_0x4bf4('0x26')]['id']){delete _0x1d31a5[_0x4bf4('0x26')]['id'];}return db[_0x4bf4('0x2b')][_0x4bf4('0x2c')]({'where':{'id':_0x1d31a5[_0x4bf4('0x2d')]['id']}})[_0x4bf4('0x1f')](handleEntityNotFound(_0x2508ef,null))[_0x4bf4('0x1f')](saveUpdates(_0x1d31a5[_0x4bf4('0x26')],null))[_0x4bf4('0x1f')](respondWithResult(_0x2508ef,null))['catch'](handleError(_0x2508ef,null));};exports[_0x4bf4('0x2e')]=function(_0x33aa1f,_0x1bdc42){return db[_0x4bf4('0x2b')][_0x4bf4('0x2c')]({'where':{'id':_0x33aa1f[_0x4bf4('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1bdc42,null))[_0x4bf4('0x1f')](removeEntity(_0x1bdc42,null))[_0x4bf4('0x2f')](handleError(_0x1bdc42,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 36dace1..1ce221e 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 _0x2479=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define'];(function(_0x39e775,_0x59ef48){var _0x3ac469=function(_0x2e240c){while(--_0x2e240c){_0x39e775['push'](_0x39e775['shift']());}};_0x3ac469(++_0x59ef48);}(_0x2479,0xc6));var _0x9247=function(_0x1bcabe,_0x1e7fe3){_0x1bcabe=_0x1bcabe-0x0;var _0x4f9815=_0x2479[_0x1bcabe];return _0x4f9815;};'use strict';var _=require(_0x9247('0x0'));var util=require(_0x9247('0x1'));var logger=require(_0x9247('0x2'))(_0x9247('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9247('0x4'));var fs=require('fs');var path=require(_0x9247('0x5'));var rimraf=require(_0x9247('0x6'));var config=require(_0x9247('0x7'));var attributes=require(_0x9247('0x8'));module[_0x9247('0x9')]=function(_0x36c8ed,_0x35c386){return _0x36c8ed[_0x9247('0xa')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb306=['api','bluebird','path','rimraf','../../config/environment','./condition.attributes','define','tools_conditions','lodash','util','../../config/logger'];(function(_0x2395d6,_0xfd37b9){var _0x4670fb=function(_0x3fea95){while(--_0x3fea95){_0x2395d6['push'](_0x2395d6['shift']());}};_0x4670fb(++_0xfd37b9);}(_0xb306,0x110));var _0x6b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb306[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6b30('0x0'));var util=require(_0x6b30('0x1'));var logger=require(_0x6b30('0x2'))(_0x6b30('0x3'));var moment=require('moment');var BPromise=require(_0x6b30('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b30('0x5'));var rimraf=require(_0x6b30('0x6'));var config=require(_0x6b30('0x7'));var attributes=require(_0x6b30('0x8'));module['exports']=function(_0x438f06,_0x55ae3b){return _0x438f06[_0x6b30('0x9')]('Condition',attributes,{'tableName':_0x6b30('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 50d3558..e26fc33 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 _0x35ee=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x1527f2,_0x3226b3){var _0x2bcb37=function(_0x236170){while(--_0x236170){_0x1527f2['push'](_0x1527f2['shift']());}};_0x2bcb37(++_0x3226b3);}(_0x35ee,0xf8));var _0xe35e=function(_0x549a8c,_0x4ba95f){_0x549a8c=_0x549a8c-0x0;var _0x1ccf40=_0x35ee[_0x549a8c];return _0x1ccf40;};'use strict';var _=require('lodash');var util=require(_0xe35e('0x0'));var moment=require('moment');var BPromise=require(_0xe35e('0x1'));var rs=require(_0xe35e('0x2'));var fs=require('fs');var Redis=require(_0xe35e('0x3'));var db=require(_0xe35e('0x4'))['db'];var utils=require(_0xe35e('0x5'));var logger=require(_0xe35e('0x6'))(_0xe35e('0x7'));var config=require(_0xe35e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe35e('0x9')][_0xe35e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x111f17,_0x5a04d1,_0x1dd814){return new BPromise(function(_0x52ea84,_0x510e7a){return client[_0xe35e('0xb')](_0x111f17,_0x1dd814)['then'](function(_0x4378a7){logger['info'](_0xe35e('0xc'),_0x5a04d1,'request\x20sent');logger['debug'](_0xe35e('0xd'),_0x5a04d1,'request\x20sent',JSON[_0xe35e('0xe')](_0x4378a7));if(_0x4378a7['error']){if(_0x4378a7[_0xe35e('0xf')][_0xe35e('0x10')]===0x1f4){logger[_0xe35e('0xf')](_0xe35e('0xc'),_0x5a04d1,_0x4378a7[_0xe35e('0xf')][_0xe35e('0x11')]);return _0x510e7a(_0x4378a7['error'][_0xe35e('0x11')]);}logger[_0xe35e('0xf')]('Condition,\x20%s,\x20%s',_0x5a04d1,_0x4378a7[_0xe35e('0xf')][_0xe35e('0x11')]);return _0x52ea84(_0x4378a7[_0xe35e('0xf')]['message']);}else{logger[_0xe35e('0x12')](_0xe35e('0xc'),_0x5a04d1,'request\x20sent');_0x52ea84(_0x4378a7[_0xe35e('0x13')][_0xe35e('0x11')]);}})[_0xe35e('0x14')](function(_0x331280){logger[_0xe35e('0xf')](_0xe35e('0xc'),_0x5a04d1,_0x331280);_0x510e7a(_0x331280);});});} \ No newline at end of file +var _0xd8a2=['catch','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x284998,_0x4c8733){var _0x1db6d6=function(_0x8718ac){while(--_0x8718ac){_0x284998['push'](_0x284998['shift']());}};_0x1db6d6(++_0x4c8733);}(_0xd8a2,0x1a3));var _0x2d8a=function(_0x15788a,_0xf1c230){_0x15788a=_0x15788a-0x0;var _0x8b6be3=_0xd8a2[_0x15788a];return _0x8b6be3;};'use strict';var _=require(_0x2d8a('0x0'));var util=require('util');var moment=require(_0x2d8a('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d8a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d8a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d8a('0x4'));var config=require(_0x2d8a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2d8a('0x6')][_0x2d8a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x504657,_0x33ac8b,_0x2c642e){return new BPromise(function(_0x5b4980,_0x24ad70){return client[_0x2d8a('0x8')](_0x504657,_0x2c642e)[_0x2d8a('0x9')](function(_0xb17c1a){logger[_0x2d8a('0xa')](_0x2d8a('0xb'),_0x33ac8b,_0x2d8a('0xc'));logger[_0x2d8a('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x33ac8b,'request\x20sent',JSON[_0x2d8a('0xe')](_0xb17c1a));if(_0xb17c1a[_0x2d8a('0xf')]){if(_0xb17c1a[_0x2d8a('0xf')]['code']===0x1f4){logger[_0x2d8a('0xf')](_0x2d8a('0xb'),_0x33ac8b,_0xb17c1a[_0x2d8a('0xf')][_0x2d8a('0x10')]);return _0x24ad70(_0xb17c1a[_0x2d8a('0xf')]['message']);}logger[_0x2d8a('0xf')](_0x2d8a('0xb'),_0x33ac8b,_0xb17c1a[_0x2d8a('0xf')][_0x2d8a('0x10')]);return _0x5b4980(_0xb17c1a['error'][_0x2d8a('0x10')]);}else{logger[_0x2d8a('0xa')](_0x2d8a('0xb'),_0x33ac8b,_0x2d8a('0xc'));_0x5b4980(_0xb17c1a[_0x2d8a('0x11')]['message']);}})[_0x2d8a('0x12')](function(_0x12b5c1){logger[_0x2d8a('0xf')](_0x2d8a('0xb'),_0x33ac8b,_0x12b5c1);_0x24ad70(_0x12b5c1);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 0621a71..27f6400 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 7e933a2..eb8b063 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02ef=['sequelize','STRING','INTEGER'];(function(_0x2b365f,_0x17aa37){var _0x26b060=function(_0x5e0a39){while(--_0x5e0a39){_0x2b365f['push'](_0x2b365f['shift']());}};_0x26b060(++_0x17aa37);}(_0x02ef,0x11a));var _0xf02e=function(_0x2678f6,_0x440272){_0x2678f6=_0x2678f6-0x0;var _0x309416=_0x02ef[_0x2678f6];return _0x309416;};'use strict';var Sequelize=require(_0xf02e('0x0'));module['exports']={'name':{'type':Sequelize[_0xf02e('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xf02e('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf02e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x0a52=['name','INTEGER','STRING','sequelize','exports'];(function(_0x5067db,_0xf8d2f2){var _0x2771e4=function(_0x3d5cb2){while(--_0x3d5cb2){_0x5067db['push'](_0x5067db['shift']());}};_0x2771e4(++_0xf8d2f2);}(_0x0a52,0xe4));var _0x20a5=function(_0x5be9b0,_0x155482){_0x5be9b0=_0x5be9b0-0x0;var _0x1279e9=_0x0a52[_0x5be9b0];return _0x1279e9;};'use strict';var Sequelize=require(_0x20a5('0x0'));module[_0x20a5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x20a5('0x2')},'OrderBy':{'type':Sequelize[_0x20a5('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x20a5('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1cfaec8..221b101 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7cb=['ContactItemTypes','UserProfileResource','stack','name','send','merge','body','contact','message','agent','interaction','account','index','ContactItemType','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xb7cb,0xec));var _0xbb7c=function(_0x197837,_0x439ae2){_0x197837=_0x197837-0x0;var _0x3eed5f=_0xb7cb[_0x197837];return _0x3eed5f;};'use strict';var emlformat=require(_0xbb7c('0x0'));var rimraf=require(_0xbb7c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb7c('0x2'));var rp=require(_0xbb7c('0x3'));var moment=require(_0xbb7c('0x4'));var BPromise=require(_0xbb7c('0x5'));var Mustache=require(_0xbb7c('0x6'));var util=require(_0xbb7c('0x7'));var path=require(_0xbb7c('0x8'));var sox=require(_0xbb7c('0x9'));var csv=require(_0xbb7c('0xa'));var ejs=require(_0xbb7c('0xb'));var fs=require('fs');var fs_extra=require(_0xbb7c('0xc'));var _=require(_0xbb7c('0xd'));var squel=require('squel');var crypto=require(_0xbb7c('0xe'));var jsforce=require(_0xbb7c('0xf'));var deskjs=require(_0xbb7c('0x10'));var toCsv=require(_0xbb7c('0xa'));var querystring=require(_0xbb7c('0x11'));var Papa=require('papaparse');var Redis=require(_0xbb7c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbb7c('0x13'));var as=require(_0xbb7c('0x14'));var hardwareService=require(_0xbb7c('0x15'));var logger=require(_0xbb7c('0x16'))('api');var utils=require(_0xbb7c('0x17'));var config=require(_0xbb7c('0x18'));var licenseUtil=require(_0xbb7c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x235a81,_0x47a880){_0x47a880=_0x47a880||0xcc;return function(_0x58457f){if(_0x58457f){return _0x235a81[_0xbb7c('0x1a')](_0x47a880);}return _0x235a81[_0xbb7c('0x1b')](_0x47a880)[_0xbb7c('0x1c')]();};}function respondWithResult(_0x272ea8,_0x29bfd6){_0x29bfd6=_0x29bfd6||0xc8;return function(_0x292147){if(_0x292147){return _0x272ea8[_0xbb7c('0x1b')](_0x29bfd6)[_0xbb7c('0x1d')](_0x292147);}};}function respondWithFilteredResult(_0x32d490,_0x3b0731){return function(_0x1bea3f){if(_0x1bea3f){var _0x554d69=typeof _0x3b0731[_0xbb7c('0x1e')]===_0xbb7c('0x1f')&&typeof _0x3b0731[_0xbb7c('0x20')]==='undefined';var _0x264ca5=_0x1bea3f[_0xbb7c('0x21')];var _0x55b2e5=_0x554d69?0x0:_0x3b0731[_0xbb7c('0x1e')];var _0x34e375=_0x554d69?_0x1bea3f[_0xbb7c('0x21')]:_0x3b0731[_0xbb7c('0x1e')]+_0x3b0731['limit'];var _0x555810;if(_0x34e375>=_0x264ca5){_0x34e375=_0x264ca5;_0x555810=0xc8;}else{_0x555810=0xce;}_0x32d490[_0xbb7c('0x1b')](_0x555810);return _0x32d490[_0xbb7c('0x22')](_0xbb7c('0x23'),_0x55b2e5+'-'+_0x34e375+'/'+_0x264ca5)[_0xbb7c('0x1d')](_0x1bea3f);}return null;};}function patchUpdates(_0x1a2cca){return function(_0x4cbd44){try{jsonpatch[_0xbb7c('0x24')](_0x4cbd44,_0x1a2cca,!![]);}catch(_0x15443d){return BPromise[_0xbb7c('0x25')](_0x15443d);}return _0x4cbd44[_0xbb7c('0x26')]();};}function saveUpdates(_0x43eae5,_0x5efb2e){return function(_0x31037c){if(_0x31037c){return _0x31037c[_0xbb7c('0x27')](_0x43eae5)[_0xbb7c('0x28')](function(_0x4c009d){return _0x4c009d;});}return null;};}function removeEntity(_0x44b89c,_0x18717c){return function(_0x5786da){if(_0x5786da){return _0x5786da[_0xbb7c('0x29')]()[_0xbb7c('0x28')](function(){var _0x1c3bc0=_0x5786da[_0xbb7c('0x2a')]({'plain':!![]});var _0x281c09=_0xbb7c('0x2b');return db[_0xbb7c('0x2c')]['destroy']({'where':{'type':_0x281c09,'resourceId':_0x1c3bc0['id']}})[_0xbb7c('0x28')](function(){return _0x5786da;});})[_0xbb7c('0x28')](function(){_0x44b89c['status'](0xcc)[_0xbb7c('0x1c')]();});}};}function handleEntityNotFound(_0x1b5d9c,_0x2f8b37){return function(_0x48676c){if(!_0x48676c){_0x1b5d9c[_0xbb7c('0x1a')](0x194);}return _0x48676c;};}function handleError(_0x212c1e,_0x3f4480){_0x3f4480=_0x3f4480||0x1f4;return function(_0x26216e){logger['error'](_0x26216e[_0xbb7c('0x2d')]);if(_0x26216e[_0xbb7c('0x2e')]){delete _0x26216e['name'];}_0x212c1e[_0xbb7c('0x1b')](_0x3f4480)[_0xbb7c('0x2f')](_0x26216e);};}function getMustacheRender(_0x2d3651,_0xff6b05){return Mustache['render'](_0x2d3651,_[_0xbb7c('0x30')](_0xff6b05[_0xbb7c('0x31')],{'contact':_0xff6b05[_0xbb7c('0x32')],'message':_0xff6b05[_0xbb7c('0x33')],'agent':_0xff6b05[_0xbb7c('0x34')],'interaction':_0xff6b05[_0xbb7c('0x35')],'account':_0xff6b05[_0xbb7c('0x36')]}))||'';}exports[_0xbb7c('0x37')]=function(_0x3136e6,_0x4231e0){var _0x208576={},_0x2580ab={},_0x54a7fe={'count':0x0,'rows':[]};var _0x39a8a7=_['map'](db[_0xbb7c('0x38')][_0xbb7c('0x39')],function(_0x1daa40){return{'name':_0x1daa40[_0xbb7c('0x3a')],'type':_0x1daa40[_0xbb7c('0x3b')]['key']};});_0x2580ab['model']=_['map'](_0x39a8a7,'name');_0x2580ab[_0xbb7c('0x3c')]=_['keys'](_0x3136e6['query']);_0x2580ab[_0xbb7c('0x3d')]=_[_0xbb7c('0x3e')](_0x2580ab[_0xbb7c('0x3f')],_0x2580ab[_0xbb7c('0x3c')]);_0x208576[_0xbb7c('0x40')]=_['intersection'](_0x2580ab[_0xbb7c('0x3f')],qs[_0xbb7c('0x41')](_0x3136e6[_0xbb7c('0x3c')][_0xbb7c('0x41')]));_0x208576[_0xbb7c('0x40')]=_0x208576[_0xbb7c('0x40')]['length']?_0x208576[_0xbb7c('0x40')]:_0x2580ab[_0xbb7c('0x3f')];if(!_0x3136e6[_0xbb7c('0x3c')][_0xbb7c('0x42')](_0xbb7c('0x43'))){_0x208576[_0xbb7c('0x20')]=qs[_0xbb7c('0x20')](_0x3136e6[_0xbb7c('0x3c')][_0xbb7c('0x20')]);_0x208576['offset']=qs[_0xbb7c('0x1e')](_0x3136e6['query'][_0xbb7c('0x1e')]);}_0x208576[_0xbb7c('0x44')]=qs[_0xbb7c('0x45')](_0x3136e6[_0xbb7c('0x3c')][_0xbb7c('0x45')]);_0x208576[_0xbb7c('0x46')]=qs[_0xbb7c('0x3d')](_[_0xbb7c('0x47')](_0x3136e6[_0xbb7c('0x3c')],_0x2580ab[_0xbb7c('0x3d')]),_0x39a8a7);if(_0x3136e6[_0xbb7c('0x3c')]['filter']){_0x208576[_0xbb7c('0x46')]=_[_0xbb7c('0x30')](_0x208576[_0xbb7c('0x46')],{'$or':_[_0xbb7c('0x48')](_0x39a8a7,function(_0x4c339b){if(_0x4c339b[_0xbb7c('0x3b')]!==_0xbb7c('0x49')){var _0x31e306={};_0x31e306[_0x4c339b[_0xbb7c('0x2e')]]={'$like':'%'+_0x3136e6[_0xbb7c('0x3c')][_0xbb7c('0x4a')]+'%'};return _0x31e306;}})});}_0x208576=_[_0xbb7c('0x30')]({},_0x208576,_0x3136e6[_0xbb7c('0x4b')]);var _0x5eb8f0={'where':_0x208576['where']};return db['ContactItemType']['count'](_0x5eb8f0)[_0xbb7c('0x28')](function(_0x4cdee0){_0x54a7fe['count']=_0x4cdee0;if(_0x3136e6[_0xbb7c('0x3c')][_0xbb7c('0x4c')]){_0x208576[_0xbb7c('0x4d')]=[{'all':!![]}];}return db['ContactItemType'][_0xbb7c('0x4e')](_0x208576);})[_0xbb7c('0x28')](function(_0x51e009){_0x54a7fe[_0xbb7c('0x4f')]=_0x51e009;return _0x54a7fe;})[_0xbb7c('0x28')](respondWithFilteredResult(_0x4231e0,_0x208576))[_0xbb7c('0x50')](handleError(_0x4231e0,null));};exports[_0xbb7c('0x51')]=function(_0x301506,_0x3c9f5b){var _0x37482f={'raw':!![],'where':{'id':_0x301506['params']['id']}},_0x5b9b0b={};_0x5b9b0b['model']=_[_0xbb7c('0x52')](db[_0xbb7c('0x38')][_0xbb7c('0x39')]);_0x5b9b0b[_0xbb7c('0x3c')]=_[_0xbb7c('0x52')](_0x301506[_0xbb7c('0x3c')]);_0x5b9b0b['filters']=_['intersection'](_0x5b9b0b['model'],_0x5b9b0b[_0xbb7c('0x3c')]);_0x37482f['attributes']=_[_0xbb7c('0x3e')](_0x5b9b0b[_0xbb7c('0x3f')],qs[_0xbb7c('0x41')](_0x301506[_0xbb7c('0x3c')][_0xbb7c('0x41')]));_0x37482f['attributes']=_0x37482f[_0xbb7c('0x40')][_0xbb7c('0x53')]?_0x37482f[_0xbb7c('0x40')]:_0x5b9b0b[_0xbb7c('0x3f')];if(_0x301506[_0xbb7c('0x3c')][_0xbb7c('0x4c')]){_0x37482f[_0xbb7c('0x4d')]=[{'all':!![]}];}_0x37482f=_['merge']({},_0x37482f,_0x301506[_0xbb7c('0x4b')]);return db['ContactItemType']['find'](_0x37482f)['then'](handleEntityNotFound(_0x3c9f5b,null))['then'](respondWithResult(_0x3c9f5b,null))[_0xbb7c('0x50')](handleError(_0x3c9f5b,null));};exports[_0xbb7c('0x54')]=function(_0x253e81,_0x577236){return db[_0xbb7c('0x38')][_0xbb7c('0x54')](_0x253e81['body'],{})[_0xbb7c('0x28')](function(_0xfe905c){var _0x5abc56=_0x253e81[_0xbb7c('0x55')][_0xbb7c('0x2a')]({'plain':!![]});if(!_0x5abc56)throw new Error(_0xbb7c('0x56'));if(_0x5abc56[_0xbb7c('0x57')]===_0xbb7c('0x55')){var _0x472eec=_0xfe905c['get']({'plain':!![]});var _0x1634a2=_0xbb7c('0x2b');return db[_0xbb7c('0x58')]['find']({'where':{'name':_0x1634a2,'userProfileId':_0x5abc56[_0xbb7c('0x59')]},'raw':!![]})[_0xbb7c('0x28')](function(_0x4e31a7){if(_0x4e31a7&&_0x4e31a7['autoAssociation']===0x0){return db['UserProfileResource'][_0xbb7c('0x54')]({'name':_0x472eec[_0xbb7c('0x2e')],'resourceId':_0x472eec['id'],'type':_0x4e31a7[_0xbb7c('0x2e')],'sectionId':_0x4e31a7['id']},{})[_0xbb7c('0x28')](function(){return _0xfe905c;});}else{return _0xfe905c;}})[_0xbb7c('0x50')](function(_0x2f124b){logger['error'](_0xbb7c('0x5a'),_0x2f124b);throw _0x2f124b;});}return _0xfe905c;})['then'](respondWithResult(_0x577236,0xc9))[_0xbb7c('0x50')](handleError(_0x577236,null));};exports['update']=function(_0x218438,_0x906332){if(_0x218438[_0xbb7c('0x31')]['id']){delete _0x218438['body']['id'];}return db[_0xbb7c('0x38')]['find']({'where':{'id':_0x218438[_0xbb7c('0x5b')]['id']}})[_0xbb7c('0x28')](handleEntityNotFound(_0x906332,null))[_0xbb7c('0x28')](saveUpdates(_0x218438[_0xbb7c('0x31')],null))[_0xbb7c('0x28')](respondWithResult(_0x906332,null))[_0xbb7c('0x50')](handleError(_0x906332,null));};exports['destroy']=function(_0x4b3a9d,_0x10225a){return db[_0xbb7c('0x38')][_0xbb7c('0x5c')]({'where':{'id':_0x4b3a9d['params']['id']}})['then'](handleEntityNotFound(_0x10225a,null))[_0xbb7c('0x28')](removeEntity(_0x10225a,null))[_0xbb7c('0x50')](handleError(_0x10225a,null));}; \ No newline at end of file +var _0xe76a=['then','get','UserProfileResource','stack','name','send','render','merge','body','contact','interaction','map','ContactItemType','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x263463,_0x1718e1){var _0x389e56=function(_0x5d6d21){while(--_0x5d6d21){_0x263463['push'](_0x263463['shift']());}};_0x389e56(++_0x1718e1);}(_0xe76a,0x1ed));var _0xae76=function(_0x169125,_0x26cf9e){_0x169125=_0x169125-0x0;var _0x1d29e0=_0xe76a[_0x169125];return _0x1d29e0;};'use strict';var emlformat=require(_0xae76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae76('0x1'));var jsonpatch=require(_0xae76('0x2'));var rp=require('request-promise');var moment=require(_0xae76('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xae76('0x4'));var util=require(_0xae76('0x5'));var path=require(_0xae76('0x6'));var sox=require(_0xae76('0x7'));var csv=require(_0xae76('0x8'));var ejs=require(_0xae76('0x9'));var fs=require('fs');var fs_extra=require(_0xae76('0xa'));var _=require(_0xae76('0xb'));var squel=require(_0xae76('0xc'));var crypto=require(_0xae76('0xd'));var jsforce=require(_0xae76('0xe'));var deskjs=require(_0xae76('0xf'));var toCsv=require(_0xae76('0x8'));var querystring=require(_0xae76('0x10'));var Papa=require('papaparse');var Redis=require(_0xae76('0x11'));var authService=require(_0xae76('0x12'));var qs=require(_0xae76('0x13'));var as=require(_0xae76('0x14'));var hardwareService=require(_0xae76('0x15'));var logger=require(_0xae76('0x16'))(_0xae76('0x17'));var utils=require(_0xae76('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xae76('0x19'));var db=require(_0xae76('0x1a'))['db'];function respondWithStatusCode(_0x4d435d,_0x25e86d){_0x25e86d=_0x25e86d||0xcc;return function(_0x594d9f){if(_0x594d9f){return _0x4d435d[_0xae76('0x1b')](_0x25e86d);}return _0x4d435d['status'](_0x25e86d)[_0xae76('0x1c')]();};}function respondWithResult(_0x41b6cc,_0x424fb3){_0x424fb3=_0x424fb3||0xc8;return function(_0x3a2f77){if(_0x3a2f77){return _0x41b6cc[_0xae76('0x1d')](_0x424fb3)[_0xae76('0x1e')](_0x3a2f77);}};}function respondWithFilteredResult(_0x28313f,_0x1a7a99){return function(_0x15700a){if(_0x15700a){var _0x5647f1=typeof _0x1a7a99[_0xae76('0x1f')]===_0xae76('0x20')&&typeof _0x1a7a99['limit']===_0xae76('0x20');var _0x3467f9=_0x15700a[_0xae76('0x21')];var _0xb41b90=_0x5647f1?0x0:_0x1a7a99[_0xae76('0x1f')];var _0x1116f4=_0x5647f1?_0x15700a['count']:_0x1a7a99[_0xae76('0x1f')]+_0x1a7a99['limit'];var _0x1e5d60;if(_0x1116f4>=_0x3467f9){_0x1116f4=_0x3467f9;_0x1e5d60=0xc8;}else{_0x1e5d60=0xce;}_0x28313f[_0xae76('0x1d')](_0x1e5d60);return _0x28313f[_0xae76('0x22')](_0xae76('0x23'),_0xb41b90+'-'+_0x1116f4+'/'+_0x3467f9)[_0xae76('0x1e')](_0x15700a);}return null;};}function patchUpdates(_0x15c175){return function(_0x15473c){try{jsonpatch[_0xae76('0x24')](_0x15473c,_0x15c175,!![]);}catch(_0xba4075){return BPromise[_0xae76('0x25')](_0xba4075);}return _0x15473c[_0xae76('0x26')]();};}function saveUpdates(_0x1e6cc2,_0x109c0e){return function(_0x43990c){if(_0x43990c){return _0x43990c[_0xae76('0x27')](_0x1e6cc2)['then'](function(_0x27567e){return _0x27567e;});}return null;};}function removeEntity(_0xeb8a28,_0x423d35){return function(_0x1cf18b){if(_0x1cf18b){return _0x1cf18b[_0xae76('0x28')]()[_0xae76('0x29')](function(){var _0x13efc5=_0x1cf18b[_0xae76('0x2a')]({'plain':!![]});var _0x135030='ContactItemTypes';return db[_0xae76('0x2b')][_0xae76('0x28')]({'where':{'type':_0x135030,'resourceId':_0x13efc5['id']}})[_0xae76('0x29')](function(){return _0x1cf18b;});})[_0xae76('0x29')](function(){_0xeb8a28[_0xae76('0x1d')](0xcc)[_0xae76('0x1c')]();});}};}function handleEntityNotFound(_0x46eec6,_0x14c7ea){return function(_0x370a63){if(!_0x370a63){_0x46eec6[_0xae76('0x1b')](0x194);}return _0x370a63;};}function handleError(_0xe37c06,_0x572fdf){_0x572fdf=_0x572fdf||0x1f4;return function(_0x4a401f){logger['error'](_0x4a401f[_0xae76('0x2c')]);if(_0x4a401f['name']){delete _0x4a401f[_0xae76('0x2d')];}_0xe37c06['status'](_0x572fdf)[_0xae76('0x2e')](_0x4a401f);};}function getMustacheRender(_0x5116cd,_0x440144){return Mustache[_0xae76('0x2f')](_0x5116cd,_[_0xae76('0x30')](_0x440144[_0xae76('0x31')],{'contact':_0x440144[_0xae76('0x32')],'message':_0x440144['message'],'agent':_0x440144['agent'],'interaction':_0x440144[_0xae76('0x33')],'account':_0x440144['account']}))||'';}exports['index']=function(_0x89fb24,_0x2e120f){var _0x549df9={},_0x331c76={},_0x122529={'count':0x0,'rows':[]};var _0x2583aa=_[_0xae76('0x34')](db[_0xae76('0x35')][_0xae76('0x36')],function(_0x5db461){return{'name':_0x5db461['fieldName'],'type':_0x5db461['type'][_0xae76('0x37')]};});_0x331c76[_0xae76('0x38')]=_[_0xae76('0x34')](_0x2583aa,_0xae76('0x2d'));_0x331c76[_0xae76('0x39')]=_[_0xae76('0x3a')](_0x89fb24[_0xae76('0x39')]);_0x331c76[_0xae76('0x3b')]=_['intersection'](_0x331c76[_0xae76('0x38')],_0x331c76[_0xae76('0x39')]);_0x549df9[_0xae76('0x3c')]=_[_0xae76('0x3d')](_0x331c76[_0xae76('0x38')],qs[_0xae76('0x3e')](_0x89fb24[_0xae76('0x39')][_0xae76('0x3e')]));_0x549df9[_0xae76('0x3c')]=_0x549df9[_0xae76('0x3c')][_0xae76('0x3f')]?_0x549df9[_0xae76('0x3c')]:_0x331c76['model'];if(!_0x89fb24[_0xae76('0x39')][_0xae76('0x40')](_0xae76('0x41'))){_0x549df9[_0xae76('0x42')]=qs['limit'](_0x89fb24[_0xae76('0x39')][_0xae76('0x42')]);_0x549df9[_0xae76('0x1f')]=qs[_0xae76('0x1f')](_0x89fb24[_0xae76('0x39')][_0xae76('0x1f')]);}_0x549df9[_0xae76('0x43')]=qs[_0xae76('0x44')](_0x89fb24[_0xae76('0x39')][_0xae76('0x44')]);_0x549df9['where']=qs[_0xae76('0x3b')](_[_0xae76('0x45')](_0x89fb24[_0xae76('0x39')],_0x331c76['filters']),_0x2583aa);if(_0x89fb24['query'][_0xae76('0x46')]){_0x549df9[_0xae76('0x47')]=_['merge'](_0x549df9[_0xae76('0x47')],{'$or':_[_0xae76('0x34')](_0x2583aa,function(_0x4c6710){if(_0x4c6710['type']!==_0xae76('0x48')){var _0x15d864={};_0x15d864[_0x4c6710[_0xae76('0x2d')]]={'$like':'%'+_0x89fb24[_0xae76('0x39')][_0xae76('0x46')]+'%'};return _0x15d864;}})});}_0x549df9=_[_0xae76('0x30')]({},_0x549df9,_0x89fb24['options']);var _0x192e0a={'where':_0x549df9[_0xae76('0x47')]};return db[_0xae76('0x35')][_0xae76('0x21')](_0x192e0a)[_0xae76('0x29')](function(_0x30abfd){_0x122529[_0xae76('0x21')]=_0x30abfd;if(_0x89fb24[_0xae76('0x39')][_0xae76('0x49')]){_0x549df9['include']=[{'all':!![]}];}return db[_0xae76('0x35')][_0xae76('0x4a')](_0x549df9);})[_0xae76('0x29')](function(_0x455330){_0x122529[_0xae76('0x4b')]=_0x455330;return _0x122529;})['then'](respondWithFilteredResult(_0x2e120f,_0x549df9))[_0xae76('0x4c')](handleError(_0x2e120f,null));};exports[_0xae76('0x4d')]=function(_0x452f29,_0x1fd6b8){var _0x19a396={'raw':!![],'where':{'id':_0x452f29[_0xae76('0x4e')]['id']}},_0x3e0138={};_0x3e0138[_0xae76('0x38')]=_['keys'](db['ContactItemType'][_0xae76('0x36')]);_0x3e0138[_0xae76('0x39')]=_[_0xae76('0x3a')](_0x452f29[_0xae76('0x39')]);_0x3e0138[_0xae76('0x3b')]=_[_0xae76('0x3d')](_0x3e0138[_0xae76('0x38')],_0x3e0138[_0xae76('0x39')]);_0x19a396['attributes']=_[_0xae76('0x3d')](_0x3e0138[_0xae76('0x38')],qs[_0xae76('0x3e')](_0x452f29[_0xae76('0x39')][_0xae76('0x3e')]));_0x19a396['attributes']=_0x19a396[_0xae76('0x3c')][_0xae76('0x3f')]?_0x19a396[_0xae76('0x3c')]:_0x3e0138[_0xae76('0x38')];if(_0x452f29['query']['includeAll']){_0x19a396[_0xae76('0x4f')]=[{'all':!![]}];}_0x19a396=_[_0xae76('0x30')]({},_0x19a396,_0x452f29['options']);return db[_0xae76('0x35')][_0xae76('0x50')](_0x19a396)[_0xae76('0x29')](handleEntityNotFound(_0x1fd6b8,null))[_0xae76('0x29')](respondWithResult(_0x1fd6b8,null))[_0xae76('0x4c')](handleError(_0x1fd6b8,null));};exports['create']=function(_0x168a81,_0xa939f7){return db[_0xae76('0x35')][_0xae76('0x51')](_0x168a81[_0xae76('0x31')],{})[_0xae76('0x29')](function(_0x45ac16){var _0x4f8e55=_0x168a81['user'][_0xae76('0x2a')]({'plain':!![]});if(!_0x4f8e55)throw new Error(_0xae76('0x52'));if(_0x4f8e55[_0xae76('0x53')]===_0xae76('0x54')){var _0x4b51d0=_0x45ac16[_0xae76('0x2a')]({'plain':!![]});var _0x46efb7='ContactItemTypes';return db['UserProfileSection'][_0xae76('0x50')]({'where':{'name':_0x46efb7,'userProfileId':_0x4f8e55[_0xae76('0x55')]},'raw':!![]})[_0xae76('0x29')](function(_0x490acb){if(_0x490acb&&_0x490acb[_0xae76('0x56')]===0x0){return db['UserProfileResource'][_0xae76('0x51')]({'name':_0x4b51d0['name'],'resourceId':_0x4b51d0['id'],'type':_0x490acb['name'],'sectionId':_0x490acb['id']},{})['then'](function(){return _0x45ac16;});}else{return _0x45ac16;}})[_0xae76('0x4c')](function(_0x1b3493){logger[_0xae76('0x57')](_0xae76('0x58'),_0x1b3493);throw _0x1b3493;});}return _0x45ac16;})[_0xae76('0x29')](respondWithResult(_0xa939f7,0xc9))[_0xae76('0x4c')](handleError(_0xa939f7,null));};exports['update']=function(_0x10579d,_0x5d076d){if(_0x10579d[_0xae76('0x31')]['id']){delete _0x10579d[_0xae76('0x31')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x10579d[_0xae76('0x4e')]['id']}})[_0xae76('0x29')](handleEntityNotFound(_0x5d076d,null))[_0xae76('0x29')](saveUpdates(_0x10579d['body'],null))[_0xae76('0x29')](respondWithResult(_0x5d076d,null))[_0xae76('0x4c')](handleError(_0x5d076d,null));};exports[_0xae76('0x28')]=function(_0x2da40b,_0xa852fd){return db[_0xae76('0x35')]['find']({'where':{'id':_0x2da40b[_0xae76('0x4e')]['id']}})[_0xae76('0x29')](handleEntityNotFound(_0xa852fd,null))[_0xae76('0x29')](removeEntity(_0xa852fd,null))[_0xae76('0x4c')](handleError(_0xa852fd,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 3878d8f..6741152 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc029=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash'];(function(_0x1c2313,_0x56bdf7){var _0x20f25f=function(_0x19cffd){while(--_0x19cffd){_0x1c2313['push'](_0x1c2313['shift']());}};_0x20f25f(++_0x56bdf7);}(_0xc029,0x1df));var _0x9c02=function(_0x324e58,_0x5667bf){_0x324e58=_0x324e58-0x0;var _0x41bda1=_0xc029[_0x324e58];return _0x41bda1;};'use strict';var _=require(_0x9c02('0x0'));var util=require(_0x9c02('0x1'));var logger=require(_0x9c02('0x2'))(_0x9c02('0x3'));var moment=require(_0x9c02('0x4'));var BPromise=require(_0x9c02('0x5'));var rp=require(_0x9c02('0x6'));var fs=require('fs');var path=require(_0x9c02('0x7'));var rimraf=require(_0x9c02('0x8'));var config=require(_0x9c02('0x9'));var attributes=require(_0x9c02('0xa'));module[_0x9c02('0xb')]=function(_0x18792d,_0x14c7f8){return _0x18792d[_0x9c02('0xc')](_0x9c02('0xd'),attributes,{'tableName':_0x9c02('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2f5=['../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x46e330,_0x19a9dc){var _0x19bb16=function(_0x54201a){while(--_0x54201a){_0x46e330['push'](_0x46e330['shift']());}};_0x19bb16(++_0x19a9dc);}(_0xd2f5,0x144));var _0x5d2f=function(_0x26c3e3,_0x44af0e){_0x26c3e3=_0x26c3e3-0x0;var _0x42c300=_0xd2f5[_0x26c3e3];return _0x42c300;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var logger=require(_0x5d2f('0x1'))('api');var moment=require(_0x5d2f('0x2'));var BPromise=require('bluebird');var rp=require(_0x5d2f('0x3'));var fs=require('fs');var path=require(_0x5d2f('0x4'));var rimraf=require(_0x5d2f('0x5'));var config=require(_0x5d2f('0x6'));var attributes=require(_0x5d2f('0x7'));module[_0x5d2f('0x8')]=function(_0x2392df,_0x16e9fa){return _0x2392df['define'](_0x5d2f('0x9'),attributes,{'tableName':_0x5d2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 230ed93..35a8064 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6fb=['client','http','request','then','info','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0xff0402,_0x26124f){var _0x55b6db=function(_0x3c5df1){while(--_0x3c5df1){_0xff0402['push'](_0xff0402['shift']());}};_0x55b6db(++_0x26124f);}(_0xf6fb,0x111));var _0xbf6f=function(_0x2d415d,_0x32ab0a){_0x2d415d=_0x2d415d-0x0;var _0x43873a=_0xf6fb[_0x2d415d];return _0x43873a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf6f('0x0'));var BPromise=require(_0xbf6f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf6f('0x2'));var db=require(_0xbf6f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf6f('0x4'))('rpc');var config=require(_0xbf6f('0x5'));var jayson=require(_0xbf6f('0x6'));var client=jayson[_0xbf6f('0x7')][_0xbf6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d8ecf,_0x26bc7b,_0x9d0c63){return new BPromise(function(_0x43d56b,_0x5948cf){return client[_0xbf6f('0x9')](_0x3d8ecf,_0x9d0c63)[_0xbf6f('0xa')](function(_0x2ac2f8){logger[_0xbf6f('0xb')](_0xbf6f('0xc'),_0x26bc7b,'request\x20sent');logger['debug'](_0xbf6f('0xd'),_0x26bc7b,_0xbf6f('0xe'),JSON[_0xbf6f('0xf')](_0x2ac2f8));if(_0x2ac2f8['error']){if(_0x2ac2f8[_0xbf6f('0x10')]['code']===0x1f4){logger[_0xbf6f('0x10')](_0xbf6f('0xc'),_0x26bc7b,_0x2ac2f8[_0xbf6f('0x10')]['message']);return _0x5948cf(_0x2ac2f8[_0xbf6f('0x10')][_0xbf6f('0x11')]);}logger[_0xbf6f('0x10')](_0xbf6f('0xc'),_0x26bc7b,_0x2ac2f8[_0xbf6f('0x10')][_0xbf6f('0x11')]);return _0x43d56b(_0x2ac2f8['error'][_0xbf6f('0x11')]);}else{logger[_0xbf6f('0xb')](_0xbf6f('0xc'),_0x26bc7b,_0xbf6f('0xe'));_0x43d56b(_0x2ac2f8[_0xbf6f('0x12')][_0xbf6f('0x11')]);}})[_0xbf6f('0x13')](function(_0x586f33){logger['error'](_0xbf6f('0xc'),_0x26bc7b,_0x586f33);_0x5948cf(_0x586f33);});});} \ No newline at end of file +var _0x1782=['info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then'];(function(_0x38be36,_0x2af10c){var _0x4b6eb6=function(_0x5f2498){while(--_0x5f2498){_0x38be36['push'](_0x38be36['shift']());}};_0x4b6eb6(++_0x2af10c);}(_0x1782,0x13e));var _0x2178=function(_0x4713aa,_0x41bfd2){_0x4713aa=_0x4713aa-0x0;var _0x251e4e=_0x1782[_0x4713aa];return _0x251e4e;};'use strict';var _=require(_0x2178('0x0'));var util=require('util');var moment=require(_0x2178('0x1'));var BPromise=require(_0x2178('0x2'));var rs=require(_0x2178('0x3'));var fs=require('fs');var Redis=require(_0x2178('0x4'));var db=require(_0x2178('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2178('0x6'))(_0x2178('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2178('0x8')][_0x2178('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad34,_0x53b9f9,_0x4cf22a){return new BPromise(function(_0x3b4115,_0x2b3991){return client[_0x2178('0xa')](_0x50ad34,_0x4cf22a)[_0x2178('0xb')](function(_0x1cb1e6){logger[_0x2178('0xc')]('ContactItemType,\x20%s,\x20%s',_0x53b9f9,_0x2178('0xd'));logger[_0x2178('0xe')](_0x2178('0xf'),_0x53b9f9,_0x2178('0xd'),JSON[_0x2178('0x10')](_0x1cb1e6));if(_0x1cb1e6[_0x2178('0x11')]){if(_0x1cb1e6[_0x2178('0x11')][_0x2178('0x12')]===0x1f4){logger[_0x2178('0x11')](_0x2178('0x13'),_0x53b9f9,_0x1cb1e6['error'][_0x2178('0x14')]);return _0x2b3991(_0x1cb1e6[_0x2178('0x11')]['message']);}logger[_0x2178('0x11')](_0x2178('0x13'),_0x53b9f9,_0x1cb1e6[_0x2178('0x11')][_0x2178('0x14')]);return _0x3b4115(_0x1cb1e6[_0x2178('0x11')]['message']);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x53b9f9,_0x2178('0xd'));_0x3b4115(_0x1cb1e6['result'][_0x2178('0x14')]);}})[_0x2178('0x15')](function(_0x5edc68){logger['error'](_0x2178('0x13'),_0x53b9f9,_0x5edc68);_0x2b3991(_0x5edc68);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 17a46df..dfc7e6f 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54a7=['../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','update','delete','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x36282d,_0x6a1a14){var _0x176af3=function(_0x1b754a){while(--_0x1b754a){_0x36282d['push'](_0x36282d['shift']());}};_0x176af3(++_0x6a1a14);}(_0x54a7,0x1db));var _0x754a=function(_0x43bb22,_0xc3d88c){_0x43bb22=_0x43bb22-0x0;var _0x448506=_0x54a7[_0x43bb22];return _0x448506;};'use strict';var multer=require(_0x754a('0x0'));var util=require(_0x754a('0x1'));var path=require(_0x754a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x754a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x754a('0x4'));var interaction=require(_0x754a('0x5'));var config=require('../../config/environment');var controller=require(_0x754a('0x6'));router[_0x754a('0x7')]('/',auth[_0x754a('0x8')](),controller['index']);router['get'](_0x754a('0x9'),auth[_0x754a('0x8')](),controller[_0x754a('0xa')]);router[_0x754a('0xb')]('/',auth[_0x754a('0x8')](),controller[_0x754a('0xc')]);router['put'](_0x754a('0x9'),auth[_0x754a('0x8')](),controller[_0x754a('0xd')]);router[_0x754a('0xe')](_0x754a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x754a('0xf')]=router; \ No newline at end of file +var _0xcea1=['multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x42d6c4,_0x18fa9a){var _0x26ff66=function(_0xf08c13){while(--_0xf08c13){_0x42d6c4['push'](_0x42d6c4['shift']());}};_0x26ff66(++_0x18fa9a);}(_0xcea1,0x6c));var _0x1cea=function(_0x5bdf15,_0x39f070){_0x5bdf15=_0x5bdf15-0x0;var _0x1c7939=_0xcea1[_0x5bdf15];return _0x1c7939;};'use strict';var multer=require(_0x1cea('0x0'));var util=require(_0x1cea('0x1'));var path=require('path');var timeout=require(_0x1cea('0x2'));var express=require('express');var router=express[_0x1cea('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cea('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1cea('0x5'));var controller=require(_0x1cea('0x6'));router[_0x1cea('0x7')]('/',auth[_0x1cea('0x8')](),controller[_0x1cea('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1cea('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cea('0xb')]);router[_0x1cea('0xc')](_0x1cea('0xd'),auth[_0x1cea('0x8')](),controller[_0x1cea('0xe')]);router[_0x1cea('0xf')](_0x1cea('0xd'),auth[_0x1cea('0x8')](),controller[_0x1cea('0x10')]);module[_0x1cea('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 8d05302..09507f5 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 _0xf9d5=['exports','STRING'];(function(_0x32eff1,_0x5eca26){var _0x2987d2=function(_0x3cfee7){while(--_0x3cfee7){_0x32eff1['push'](_0x32eff1['shift']());}};_0x2987d2(++_0x5eca26);}(_0xf9d5,0x122));var _0x5f9d=function(_0x1239c9,_0x31a03b){_0x1239c9=_0x1239c9-0x0;var _0x5544ac=_0xf9d5[_0x1239c9];return _0x5544ac;};'use strict';var Sequelize=require('sequelize');module[_0x5f9d('0x0')]={'name':{'type':Sequelize[_0x5f9d('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x5f9d('0x1')]}}; \ No newline at end of file +var _0xcf8c=['sequelize','exports','STRING','name'];(function(_0x53817b,_0x202ea3){var _0x597fec=function(_0x516c71){while(--_0x516c71){_0x53817b['push'](_0x53817b['shift']());}};_0x597fec(++_0x202ea3);}(_0xcf8c,0xf0));var _0xccf8=function(_0x226a9d,_0x2be896){_0x226a9d=_0x226a9d-0x0;var _0xeea775=_0xcf8c[_0x226a9d];return _0xeea775;};'use strict';var Sequelize=require(_0xccf8('0x0'));module[_0xccf8('0x1')]={'name':{'type':Sequelize[_0xccf8('0x2')],'allowNull':![],'unique':_0xccf8('0x3')},'description':{'type':Sequelize[_0xccf8('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 72abc60..50fd74f 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 _0xd378=['attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','json','offset','undefined','count','Content-Range','apply','reject','then','destroy','get','CustomDashboards','status','error','stack','name','merge','body','contact','message','interaction','account','index','map','Dashboard','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filters','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','update','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType'];(function(_0x4946e2,_0x4261a8){var _0x20facc=function(_0x136b93){while(--_0x136b93){_0x4946e2['push'](_0x4946e2['shift']());}};_0x20facc(++_0x4261a8);}(_0xd378,0x18b));var _0x8d37=function(_0x3f9983,_0x3c688c){_0x3f9983=_0x3f9983-0x0;var _0x3ff7a0=_0xd378[_0x3f9983];return _0x3ff7a0;};'use strict';var emlformat=require(_0x8d37('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d37('0x1'));var jsonpatch=require(_0x8d37('0x2'));var rp=require(_0x8d37('0x3'));var moment=require(_0x8d37('0x4'));var BPromise=require(_0x8d37('0x5'));var Mustache=require(_0x8d37('0x6'));var util=require(_0x8d37('0x7'));var path=require(_0x8d37('0x8'));var sox=require(_0x8d37('0x9'));var csv=require(_0x8d37('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d37('0xb'));var squel=require(_0x8d37('0xc'));var crypto=require(_0x8d37('0xd'));var jsforce=require(_0x8d37('0xe'));var deskjs=require(_0x8d37('0xf'));var toCsv=require(_0x8d37('0xa'));var querystring=require(_0x8d37('0x10'));var Papa=require(_0x8d37('0x11'));var Redis=require(_0x8d37('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8d37('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d37('0x14'));var logger=require(_0x8d37('0x15'))('api');var utils=require(_0x8d37('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8d37('0x17'));var db=require(_0x8d37('0x18'))['db'];config[_0x8d37('0x19')]=_[_0x8d37('0x1a')](config[_0x8d37('0x19')],{'host':_0x8d37('0x1b'),'port':0x18eb});var socket=require(_0x8d37('0x1c'))(new Redis(config[_0x8d37('0x19')]));require(_0x8d37('0x1d'))[_0x8d37('0x1e')](socket);function respondWithStatusCode(_0x1c6491,_0x1ab465){_0x1ab465=_0x1ab465||0xcc;return function(_0x3daedc){if(_0x3daedc){return _0x1c6491[_0x8d37('0x1f')](_0x1ab465);}return _0x1c6491['status'](_0x1ab465)[_0x8d37('0x20')]();};}function respondWithResult(_0x547a85,_0x39afb4){_0x39afb4=_0x39afb4||0xc8;return function(_0x4164d1){if(_0x4164d1){return _0x547a85['status'](_0x39afb4)[_0x8d37('0x21')](_0x4164d1);}};}function respondWithFilteredResult(_0xfdc3f,_0x2edc4b){return function(_0x18bc7a){if(_0x18bc7a){var _0x4aa5a5=typeof _0x2edc4b[_0x8d37('0x22')]===_0x8d37('0x23')&&typeof _0x2edc4b['limit']==='undefined';var _0x51ca35=_0x18bc7a['count'];var _0x232482=_0x4aa5a5?0x0:_0x2edc4b[_0x8d37('0x22')];var _0x244683=_0x4aa5a5?_0x18bc7a[_0x8d37('0x24')]:_0x2edc4b[_0x8d37('0x22')]+_0x2edc4b['limit'];var _0x5c7a57;if(_0x244683>=_0x51ca35){_0x244683=_0x51ca35;_0x5c7a57=0xc8;}else{_0x5c7a57=0xce;}_0xfdc3f['status'](_0x5c7a57);return _0xfdc3f['set'](_0x8d37('0x25'),_0x232482+'-'+_0x244683+'/'+_0x51ca35)[_0x8d37('0x21')](_0x18bc7a);}return null;};}function patchUpdates(_0xff30ad){return function(_0xe568bc){try{jsonpatch[_0x8d37('0x26')](_0xe568bc,_0xff30ad,!![]);}catch(_0x217cd5){return BPromise[_0x8d37('0x27')](_0x217cd5);}return _0xe568bc['save']();};}function saveUpdates(_0x34058d,_0x51e7bf){return function(_0x3253c3){if(_0x3253c3){return _0x3253c3['update'](_0x34058d)[_0x8d37('0x28')](function(_0x544227){return _0x544227;});}return null;};}function removeEntity(_0x37afe6,_0x75708c){return function(_0x3e62aa){if(_0x3e62aa){return _0x3e62aa[_0x8d37('0x29')]()['then'](function(){var _0x283c6b=_0x3e62aa[_0x8d37('0x2a')]({'plain':!![]});var _0x50cff2=_0x8d37('0x2b');return db['UserProfileResource'][_0x8d37('0x29')]({'where':{'type':_0x50cff2,'resourceId':_0x283c6b['id']}})[_0x8d37('0x28')](function(){return _0x3e62aa;});})[_0x8d37('0x28')](function(){_0x37afe6[_0x8d37('0x2c')](0xcc)[_0x8d37('0x20')]();});}};}function handleEntityNotFound(_0x18ee5c,_0x419a9a){return function(_0x4e5dd4){if(!_0x4e5dd4){_0x18ee5c[_0x8d37('0x1f')](0x194);}return _0x4e5dd4;};}function handleError(_0x4395d3,_0x5f7f0e){_0x5f7f0e=_0x5f7f0e||0x1f4;return function(_0x4baf4e){logger[_0x8d37('0x2d')](_0x4baf4e[_0x8d37('0x2e')]);if(_0x4baf4e[_0x8d37('0x2f')]){delete _0x4baf4e['name'];}_0x4395d3[_0x8d37('0x2c')](_0x5f7f0e)['send'](_0x4baf4e);};}function getMustacheRender(_0x1bdbea,_0x1a9294){return Mustache['render'](_0x1bdbea,_[_0x8d37('0x30')](_0x1a9294[_0x8d37('0x31')],{'contact':_0x1a9294[_0x8d37('0x32')],'message':_0x1a9294[_0x8d37('0x33')],'agent':_0x1a9294['agent'],'interaction':_0x1a9294[_0x8d37('0x34')],'account':_0x1a9294[_0x8d37('0x35')]}))||'';}exports[_0x8d37('0x36')]=function(_0x11f968,_0x34ba32){var _0x148466={},_0x497c5d={},_0x233f32={'count':0x0,'rows':[]};var _0x3ea510=_[_0x8d37('0x37')](db[_0x8d37('0x38')]['rawAttributes'],function(_0x4ab49c){return{'name':_0x4ab49c['fieldName'],'type':_0x4ab49c[_0x8d37('0x39')][_0x8d37('0x3a')]};});_0x497c5d['model']=_['map'](_0x3ea510,_0x8d37('0x2f'));_0x497c5d[_0x8d37('0x3b')]=_[_0x8d37('0x3c')](_0x11f968[_0x8d37('0x3b')]);_0x497c5d['filters']=_[_0x8d37('0x3d')](_0x497c5d[_0x8d37('0x3e')],_0x497c5d['query']);_0x148466[_0x8d37('0x3f')]=_[_0x8d37('0x3d')](_0x497c5d['model'],qs[_0x8d37('0x40')](_0x11f968[_0x8d37('0x3b')][_0x8d37('0x40')]));_0x148466['attributes']=_0x148466[_0x8d37('0x3f')][_0x8d37('0x41')]?_0x148466[_0x8d37('0x3f')]:_0x497c5d['model'];if(!_0x11f968['query'][_0x8d37('0x42')]('nolimit')){_0x148466[_0x8d37('0x43')]=qs[_0x8d37('0x43')](_0x11f968[_0x8d37('0x3b')][_0x8d37('0x43')]);_0x148466[_0x8d37('0x22')]=qs[_0x8d37('0x22')](_0x11f968['query'][_0x8d37('0x22')]);}_0x148466[_0x8d37('0x44')]=qs[_0x8d37('0x45')](_0x11f968[_0x8d37('0x3b')][_0x8d37('0x45')]);_0x148466['where']=qs['filters'](_[_0x8d37('0x46')](_0x11f968[_0x8d37('0x3b')],_0x497c5d[_0x8d37('0x47')]),_0x3ea510);if(_0x11f968[_0x8d37('0x3b')]['filter']){_0x148466[_0x8d37('0x48')]=_[_0x8d37('0x30')](_0x148466[_0x8d37('0x48')],{'$or':_[_0x8d37('0x37')](_0x3ea510,function(_0x112c2f){if(_0x112c2f['type']!==_0x8d37('0x49')){var _0x5c6301={};_0x5c6301[_0x112c2f[_0x8d37('0x2f')]]={'$like':'%'+_0x11f968[_0x8d37('0x3b')][_0x8d37('0x4a')]+'%'};return _0x5c6301;}})});}_0x148466=_[_0x8d37('0x30')]({},_0x148466,_0x11f968[_0x8d37('0x4b')]);var _0x493bc8={'where':_0x148466[_0x8d37('0x48')]};return db[_0x8d37('0x38')][_0x8d37('0x24')](_0x493bc8)[_0x8d37('0x28')](function(_0x5aa7f2){_0x233f32[_0x8d37('0x24')]=_0x5aa7f2;if(_0x11f968[_0x8d37('0x3b')][_0x8d37('0x4c')]){_0x148466[_0x8d37('0x4d')]=[{'all':!![]}];}return db['Dashboard'][_0x8d37('0x4e')](_0x148466);})['then'](function(_0x37d6cd){_0x233f32[_0x8d37('0x4f')]=_0x37d6cd;return _0x233f32;})[_0x8d37('0x28')](respondWithFilteredResult(_0x34ba32,_0x148466))['catch'](handleError(_0x34ba32,null));};exports[_0x8d37('0x50')]=function(_0x197e54,_0x364ac2){var _0x4b110a={'raw':![],'where':{'id':_0x197e54[_0x8d37('0x51')]['id']}},_0x249384={};_0x249384[_0x8d37('0x3e')]=_['keys'](db[_0x8d37('0x38')][_0x8d37('0x52')]);_0x249384[_0x8d37('0x3b')]=_[_0x8d37('0x3c')](_0x197e54[_0x8d37('0x3b')]);_0x249384[_0x8d37('0x47')]=_[_0x8d37('0x3d')](_0x249384['model'],_0x249384[_0x8d37('0x3b')]);_0x4b110a[_0x8d37('0x3f')]=_[_0x8d37('0x3d')](_0x249384[_0x8d37('0x3e')],qs[_0x8d37('0x40')](_0x197e54[_0x8d37('0x3b')][_0x8d37('0x40')]));_0x4b110a['attributes']=_0x4b110a['attributes']['length']?_0x4b110a['attributes']:_0x249384['model'];if(_0x197e54[_0x8d37('0x3b')][_0x8d37('0x4c')]){_0x4b110a[_0x8d37('0x4d')]=[{'all':!![]}];}_0x4b110a=_['merge']({},_0x4b110a,_0x197e54[_0x8d37('0x4b')]);return db[_0x8d37('0x38')][_0x8d37('0x53')](_0x4b110a)[_0x8d37('0x28')](handleEntityNotFound(_0x364ac2,null))[_0x8d37('0x28')](respondWithResult(_0x364ac2,null))['catch'](handleError(_0x364ac2,null));};exports[_0x8d37('0x54')]=function(_0x34ea41,_0x12ea5f){return db[_0x8d37('0x38')]['create'](_0x34ea41[_0x8d37('0x31')],{})[_0x8d37('0x28')](function(_0x51065b){var _0x434a48=_0x34ea41[_0x8d37('0x55')]['get']({'plain':!![]});if(!_0x434a48)throw new Error(_0x8d37('0x56'));if(_0x434a48['role']===_0x8d37('0x55')){var _0x21197b=_0x51065b[_0x8d37('0x2a')]({'plain':!![]});var _0x494085=_0x8d37('0x2b');return db[_0x8d37('0x57')][_0x8d37('0x53')]({'where':{'name':_0x494085,'userProfileId':_0x434a48[_0x8d37('0x58')]},'raw':!![]})[_0x8d37('0x28')](function(_0x1b1f54){if(_0x1b1f54&&_0x1b1f54[_0x8d37('0x59')]===0x0){return db[_0x8d37('0x5a')][_0x8d37('0x54')]({'name':_0x21197b[_0x8d37('0x2f')],'resourceId':_0x21197b['id'],'type':_0x1b1f54['name'],'sectionId':_0x1b1f54['id']},{})[_0x8d37('0x28')](function(){return _0x51065b;});}else{return _0x51065b;}})[_0x8d37('0x5b')](function(_0x1b3a7){logger[_0x8d37('0x2d')](_0x8d37('0x5c'),_0x1b3a7);throw _0x1b3a7;});}return _0x51065b;})[_0x8d37('0x28')](respondWithResult(_0x12ea5f,0xc9))[_0x8d37('0x5b')](handleError(_0x12ea5f,null));};exports[_0x8d37('0x5d')]=function(_0x190fce,_0x335da5){var _0x3882e6={'where':{'id':_0x190fce[_0x8d37('0x51')]['id']}},_0x431dce={};_0x431dce[_0x8d37('0x3e')]=_[_0x8d37('0x3c')](db['Dashboard'][_0x8d37('0x52')]);_0x3882e6[_0x8d37('0x3f')]=_[_0x8d37('0x3d')](_0x431dce[_0x8d37('0x3e')],qs[_0x8d37('0x40')](_0x190fce[_0x8d37('0x3b')][_0x8d37('0x40')]));_0x3882e6['attributes']=_0x3882e6['attributes'][_0x8d37('0x41')]?_0x3882e6[_0x8d37('0x3f')]:_0x431dce[_0x8d37('0x3e')];if(_0x190fce[_0x8d37('0x3b')]['includeAll']){_0x3882e6[_0x8d37('0x4d')]=[{'all':!![]}];}_0x3882e6=_[_0x8d37('0x30')]({},_0x3882e6,_0x190fce[_0x8d37('0x4b')]);return db[_0x8d37('0x38')][_0x8d37('0x53')](_0x3882e6)['then'](handleEntityNotFound(_0x335da5,null))[_0x8d37('0x28')](function(_0x3396e3){if(_0x3396e3){var _0x3f86c1=_0x3396e3[_0x8d37('0x2a')]({'plain':!![]});_0x3f86c1=qs[_0x8d37('0x5e')](_0x3f86c1,['id',_0x8d37('0x5f'),_0x8d37('0x60')]);_0x190fce[_0x8d37('0x31')]=_[_0x8d37('0x5e')](_0x190fce[_0x8d37('0x31')],['id',_0x8d37('0x5f'),_0x8d37('0x60')]);return db[_0x8d37('0x38')]['create'](_[_0x8d37('0x30')](_0x3f86c1,_0x190fce[_0x8d37('0x31')]),{'include':_0x190fce[_0x8d37('0x3b')][_0x8d37('0x4c')]?[{'all':!![]}]:undefined})[_0x8d37('0x28')](function(_0x52c8ff){var _0x3a6266=_0x190fce['user'][_0x8d37('0x2a')]({'plain':!![]});if(!_0x3a6266)throw new Error(_0x8d37('0x56'));if(_0x3a6266[_0x8d37('0x61')]===_0x8d37('0x55')){var _0x275d85=_0x52c8ff[_0x8d37('0x2a')]({'plain':!![]});var _0x3d2f86='CustomDashboards';return db[_0x8d37('0x57')][_0x8d37('0x53')]({'where':{'name':_0x3d2f86,'userProfileId':_0x3a6266[_0x8d37('0x58')]},'raw':!![]})[_0x8d37('0x28')](function(_0x406731){if(_0x406731&&_0x406731[_0x8d37('0x59')]===0x0){return db[_0x8d37('0x5a')][_0x8d37('0x54')]({'name':_0x275d85[_0x8d37('0x2f')],'resourceId':_0x275d85['id'],'type':_0x406731[_0x8d37('0x2f')],'sectionId':_0x406731['id']},{})['then'](function(){return _0x52c8ff;});}else{return _0x52c8ff;}})[_0x8d37('0x5b')](function(_0xf83f23){logger[_0x8d37('0x2d')](_0x8d37('0x5c'),_0xf83f23);throw _0xf83f23;});}return _0x52c8ff;});}})['then'](respondWithResult(_0x335da5,0xc9))['catch'](handleError(_0x335da5,null));};exports[_0x8d37('0x62')]=function(_0x4293ad,_0x250517){if(_0x4293ad[_0x8d37('0x31')]['id']){delete _0x4293ad[_0x8d37('0x31')]['id'];}return db[_0x8d37('0x38')][_0x8d37('0x53')]({'where':{'id':_0x4293ad[_0x8d37('0x51')]['id']}})[_0x8d37('0x28')](handleEntityNotFound(_0x250517,null))[_0x8d37('0x28')](saveUpdates(_0x4293ad['body'],null))[_0x8d37('0x28')](respondWithResult(_0x250517,null))['catch'](handleError(_0x250517,null));};exports[_0x8d37('0x29')]=function(_0x1db3a0,_0x57b1e2){return db[_0x8d37('0x38')][_0x8d37('0x53')]({'where':{'id':_0x1db3a0[_0x8d37('0x51')]['id']}})[_0x8d37('0x28')](handleEntityNotFound(_0x57b1e2,null))['then'](removeEntity(_0x57b1e2,null))[_0x8d37('0x5b')](handleError(_0x57b1e2,null));};function widgetAttributes(_0x19e4fe){try{switch(_0x19e4fe[_0x8d37('0x39')]){case'iframe':return[{'name':_0x8d37('0x63'),'value':_0x19e4fe[_0x8d37('0x63')]||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe[_0x8d37('0x64')][0x0]?_0x19e4fe[_0x8d37('0x64')][0x0][_0x8d37('0x65')]:undefined)||_0x8d37('0x66')}];case _0x8d37('0x67'):return[{'name':_0x8d37('0x68'),'value':_0x19e4fe[_0x8d37('0x68')]||(_0x19e4fe['attrs']&&_0x19e4fe[_0x8d37('0x64')][0x0]?_0x19e4fe['attrs'][0x0][_0x8d37('0x65')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x19e4fe[_0x8d37('0x69')]||(_0x19e4fe['attrs']&&_0x19e4fe[_0x8d37('0x64')][0x0]?_0x19e4fe['attrs'][0x0][_0x8d37('0x65')]:undefined)||_0x8d37('0x6a')},{'name':'attrTimezone','value':_0x19e4fe[_0x8d37('0x6b')]||(_0x19e4fe['attrs']&&_0x19e4fe[_0x8d37('0x64')][0x1]?_0x19e4fe[_0x8d37('0x64')][0x1][_0x8d37('0x65')]:undefined)||_0x8d37('0x6c')},{'name':_0x8d37('0x6d'),'value':_0x19e4fe['attrFontSize']||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe[_0x8d37('0x64')][0x2]?_0x19e4fe[_0x8d37('0x64')][0x2][_0x8d37('0x65')]:undefined)||0xc}];case _0x8d37('0x6e'):return[{'name':'attrMetric','value':_0x19e4fe['attrMetric']||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe['attrs'][0x0]?_0x19e4fe[_0x8d37('0x64')][0x0][_0x8d37('0x65')]:undefined)||_0x8d37('0x6f')},{'name':'attrVoiceQueues','value':_0x19e4fe[_0x8d37('0x70')]||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe[_0x8d37('0x64')][0x1]?_0x19e4fe[_0x8d37('0x64')][0x1][_0x8d37('0x65')]:undefined)||[]},{'name':_0x8d37('0x6d'),'value':_0x19e4fe[_0x8d37('0x6d')]||(_0x19e4fe['attrs']&&_0x19e4fe['attrs'][0x2]?_0x19e4fe['attrs'][0x2][_0x8d37('0x65')]:undefined)||0x14}];case _0x8d37('0x71'):case _0x8d37('0x72'):return[{'name':_0x8d37('0x73'),'value':_0x19e4fe[_0x8d37('0x73')]||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe[_0x8d37('0x64')][0x0]?_0x19e4fe[_0x8d37('0x64')][0x0][_0x8d37('0x65')]:undefined)||'total'},{'name':_0x8d37('0x74'),'value':_0x19e4fe[_0x8d37('0x74')]||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe[_0x8d37('0x64')][0x1]?_0x19e4fe[_0x8d37('0x64')][0x1][_0x8d37('0x65')]:undefined)||null},{'name':_0x8d37('0x75'),'value':_0x19e4fe[_0x8d37('0x75')]||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe[_0x8d37('0x64')][0x2]?_0x19e4fe[_0x8d37('0x64')][0x2][_0x8d37('0x65')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x19e4fe[_0x8d37('0x70')]||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe[_0x8d37('0x64')][0x3]?_0x19e4fe['attrs'][0x3][_0x8d37('0x65')]:undefined)||[]}];case _0x8d37('0x76'):return[{'name':_0x8d37('0x77'),'type':_0x19e4fe[_0x8d37('0x78')]||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe['attrs'][0x0]?_0x19e4fe[_0x8d37('0x64')][0x0][_0x8d37('0x39')]:undefined)||null,'value':_0x19e4fe['attrReport']||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe[_0x8d37('0x64')][0x0]?_0x19e4fe[_0x8d37('0x64')][0x0]['value']:undefined)||null},{'name':_0x8d37('0x79'),'value':_0x19e4fe['attrRefresh']||(_0x19e4fe[_0x8d37('0x64')]&&_0x19e4fe[_0x8d37('0x64')][0x1]?_0x19e4fe[_0x8d37('0x64')][0x1][_0x8d37('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x3e72a1){logger[_0x8d37('0x2d')](_0x8d37('0x7a'),JSON[_0x8d37('0x7b')](_0x3e72a1));return[];}}exports['addItem']=function(_0x52565e,_0x1b1800,_0x3863c5){if(_0x52565e['body']['id']){delete _0x52565e[_0x8d37('0x31')]['id'];}return db[_0x8d37('0x38')][_0x8d37('0x53')]({'where':{'id':_0x52565e[_0x8d37('0x51')]['id']}})[_0x8d37('0x28')](handleEntityNotFound(_0x1b1800,null))[_0x8d37('0x28')](function(_0x4a523f){if(_0x4a523f){_0x52565e['body'][_0x8d37('0x7c')]=_0x4a523f['id'];_0x52565e[_0x8d37('0x31')][_0x8d37('0x64')]=widgetAttributes(_0x52565e[_0x8d37('0x31')]);return db[_0x8d37('0x7d')][_0x8d37('0x54')](_0x52565e[_0x8d37('0x31')]);}})[_0x8d37('0x28')](respondWithResult(_0x1b1800,null))[_0x8d37('0x5b')](handleError(_0x1b1800,null));};exports[_0x8d37('0x7e')]=function(_0x14a750,_0x59b416,_0x626356){var _0x12dc8d={};var _0xbf8bc5={};var _0xd19c05;var _0x30ee4d;return db[_0x8d37('0x38')][_0x8d37('0x7f')]({'where':{'id':_0x14a750[_0x8d37('0x51')]['id']}})[_0x8d37('0x28')](handleEntityNotFound(_0x59b416,null))['then'](function(_0xfadbdc){if(_0xfadbdc){_0xd19c05=_0xfadbdc;_0xbf8bc5['model']=_[_0x8d37('0x3c')](db[_0x8d37('0x7d')][_0x8d37('0x52')]);_0xbf8bc5[_0x8d37('0x3b')]=_[_0x8d37('0x3c')](_0x14a750[_0x8d37('0x3b')]);_0xbf8bc5[_0x8d37('0x47')]=_['intersection'](_0xbf8bc5['model'],_0xbf8bc5[_0x8d37('0x3b')]);_0x12dc8d['attributes']=_[_0x8d37('0x3d')](_0xbf8bc5['model'],qs[_0x8d37('0x40')](_0x14a750[_0x8d37('0x3b')][_0x8d37('0x40')]));_0x12dc8d[_0x8d37('0x3f')]=_0x12dc8d[_0x8d37('0x3f')][_0x8d37('0x41')]?_0x12dc8d[_0x8d37('0x3f')]:_0xbf8bc5[_0x8d37('0x3e')];_0x12dc8d[_0x8d37('0x44')]=qs[_0x8d37('0x45')](_0x14a750[_0x8d37('0x3b')]['sort']);_0x12dc8d[_0x8d37('0x48')]=qs[_0x8d37('0x47')](_['pick'](_0x14a750[_0x8d37('0x3b')],_0xbf8bc5[_0x8d37('0x47')]));if(_0x14a750[_0x8d37('0x3b')]['filter']){_0x12dc8d[_0x8d37('0x48')]=_[_0x8d37('0x30')](_0x12dc8d[_0x8d37('0x48')],{'$or':_[_0x8d37('0x37')](_0x12dc8d[_0x8d37('0x3f')],function(_0x98888e){var _0xe1caa3={};_0xe1caa3[_0x98888e]={'$like':'%'+_0x14a750['query'][_0x8d37('0x4a')]+'%'};return _0xe1caa3;})});}_0x12dc8d=_[_0x8d37('0x30')]({},_0x12dc8d,_0x14a750[_0x8d37('0x4b')]);return _0xd19c05[_0x8d37('0x7e')](_0x12dc8d);}})[_0x8d37('0x28')](function(_0x3637b9){if(_0x3637b9){_0x30ee4d=_0x3637b9['length'];if(!_0x14a750[_0x8d37('0x3b')][_0x8d37('0x42')](_0x8d37('0x80'))){_0x12dc8d['limit']=qs[_0x8d37('0x43')](_0x14a750[_0x8d37('0x3b')][_0x8d37('0x43')]);_0x12dc8d[_0x8d37('0x22')]=qs[_0x8d37('0x22')](_0x14a750[_0x8d37('0x3b')][_0x8d37('0x22')]);}return _0xd19c05['getItems'](_0x12dc8d);}})[_0x8d37('0x28')](function(_0x1eb5c1){if(_0x1eb5c1){return _0x1eb5c1?{'count':_0x30ee4d,'rows':_0x1eb5c1}:null;}})[_0x8d37('0x28')](respondWithResult(_0x59b416,null))[_0x8d37('0x5b')](handleError(_0x59b416,null));}; \ No newline at end of file +var _0xbe0a=['getItems','findOne','pick','filter','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','error','stack','name','merge','body','contact','message','agent','account','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','autoAssociation','UserProfileResource','clone','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xbe0a,0x17e));var _0xabe0=function(_0x4cb393,_0x2489a7){_0x4cb393=_0x4cb393-0x0;var _0x1743c0=_0xbe0a[_0x4cb393];return _0x1743c0;};'use strict';var emlformat=require(_0xabe0('0x0'));var rimraf=require(_0xabe0('0x1'));var zipdir=require(_0xabe0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabe0('0x3'));var moment=require(_0xabe0('0x4'));var BPromise=require(_0xabe0('0x5'));var Mustache=require('mustache');var util=require(_0xabe0('0x6'));var path=require(_0xabe0('0x7'));var sox=require('sox');var csv=require(_0xabe0('0x8'));var ejs=require(_0xabe0('0x9'));var fs=require('fs');var fs_extra=require(_0xabe0('0xa'));var _=require(_0xabe0('0xb'));var squel=require('squel');var crypto=require(_0xabe0('0xc'));var jsforce=require(_0xabe0('0xd'));var deskjs=require(_0xabe0('0xe'));var toCsv=require(_0xabe0('0x8'));var querystring=require('querystring');var Papa=require(_0xabe0('0xf'));var Redis=require(_0xabe0('0x10'));var authService=require(_0xabe0('0x11'));var qs=require(_0xabe0('0x12'));var as=require(_0xabe0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xabe0('0x14'));var utils=require(_0xabe0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xabe0('0x16'));var db=require(_0xabe0('0x17'))['db'];config[_0xabe0('0x18')]=_['defaults'](config['redis'],{'host':_0xabe0('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabe0('0x18')]));require(_0xabe0('0x1a'))[_0xabe0('0x1b')](socket);function respondWithStatusCode(_0x48b892,_0x11f80b){_0x11f80b=_0x11f80b||0xcc;return function(_0x286c70){if(_0x286c70){return _0x48b892[_0xabe0('0x1c')](_0x11f80b);}return _0x48b892[_0xabe0('0x1d')](_0x11f80b)[_0xabe0('0x1e')]();};}function respondWithResult(_0x3e2c72,_0x344711){_0x344711=_0x344711||0xc8;return function(_0x1bb96c){if(_0x1bb96c){return _0x3e2c72[_0xabe0('0x1d')](_0x344711)['json'](_0x1bb96c);}};}function respondWithFilteredResult(_0x1c5da3,_0x39a1a6){return function(_0x29e9c4){if(_0x29e9c4){var _0x1916ce=typeof _0x39a1a6[_0xabe0('0x1f')]===_0xabe0('0x20')&&typeof _0x39a1a6[_0xabe0('0x21')]===_0xabe0('0x20');var _0x23c14c=_0x29e9c4[_0xabe0('0x22')];var _0xb6d0ab=_0x1916ce?0x0:_0x39a1a6['offset'];var _0x4ce0e8=_0x1916ce?_0x29e9c4['count']:_0x39a1a6[_0xabe0('0x1f')]+_0x39a1a6[_0xabe0('0x21')];var _0x40eb36;if(_0x4ce0e8>=_0x23c14c){_0x4ce0e8=_0x23c14c;_0x40eb36=0xc8;}else{_0x40eb36=0xce;}_0x1c5da3[_0xabe0('0x1d')](_0x40eb36);return _0x1c5da3[_0xabe0('0x23')](_0xabe0('0x24'),_0xb6d0ab+'-'+_0x4ce0e8+'/'+_0x23c14c)[_0xabe0('0x25')](_0x29e9c4);}return null;};}function patchUpdates(_0x1c895f){return function(_0x3ed926){try{jsonpatch[_0xabe0('0x26')](_0x3ed926,_0x1c895f,!![]);}catch(_0x3d4f8b){return BPromise[_0xabe0('0x27')](_0x3d4f8b);}return _0x3ed926[_0xabe0('0x28')]();};}function saveUpdates(_0xbabdd1,_0x17c7da){return function(_0x12bb21){if(_0x12bb21){return _0x12bb21[_0xabe0('0x29')](_0xbabdd1)[_0xabe0('0x2a')](function(_0x337272){return _0x337272;});}return null;};}function removeEntity(_0x33a691,_0x14ec2c){return function(_0x241620){if(_0x241620){return _0x241620[_0xabe0('0x2b')]()['then'](function(){var _0x514d7e=_0x241620[_0xabe0('0x2c')]({'plain':!![]});var _0x570ba8='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x570ba8,'resourceId':_0x514d7e['id']}})[_0xabe0('0x2a')](function(){return _0x241620;});})['then'](function(){_0x33a691[_0xabe0('0x1d')](0xcc)[_0xabe0('0x1e')]();});}};}function handleEntityNotFound(_0x37a30f,_0x5a2893){return function(_0x304cbe){if(!_0x304cbe){_0x37a30f[_0xabe0('0x1c')](0x194);}return _0x304cbe;};}function handleError(_0x7cff57,_0x4047d8){_0x4047d8=_0x4047d8||0x1f4;return function(_0x54e1db){logger[_0xabe0('0x2d')](_0x54e1db[_0xabe0('0x2e')]);if(_0x54e1db['name']){delete _0x54e1db[_0xabe0('0x2f')];}_0x7cff57[_0xabe0('0x1d')](_0x4047d8)['send'](_0x54e1db);};}function getMustacheRender(_0x524919,_0x667590){return Mustache['render'](_0x524919,_[_0xabe0('0x30')](_0x667590[_0xabe0('0x31')],{'contact':_0x667590[_0xabe0('0x32')],'message':_0x667590[_0xabe0('0x33')],'agent':_0x667590[_0xabe0('0x34')],'interaction':_0x667590['interaction'],'account':_0x667590[_0xabe0('0x35')]}))||'';}exports[_0xabe0('0x36')]=function(_0x3adca8,_0x3bd494){var _0x129d4f={},_0x367d53={},_0x3471fa={'count':0x0,'rows':[]};var _0x15050f=_[_0xabe0('0x37')](db[_0xabe0('0x38')][_0xabe0('0x39')],function(_0x5f25d){return{'name':_0x5f25d[_0xabe0('0x3a')],'type':_0x5f25d[_0xabe0('0x3b')][_0xabe0('0x3c')]};});_0x367d53[_0xabe0('0x3d')]=_[_0xabe0('0x37')](_0x15050f,_0xabe0('0x2f'));_0x367d53[_0xabe0('0x3e')]=_[_0xabe0('0x3f')](_0x3adca8[_0xabe0('0x3e')]);_0x367d53[_0xabe0('0x40')]=_[_0xabe0('0x41')](_0x367d53['model'],_0x367d53['query']);_0x129d4f['attributes']=_[_0xabe0('0x41')](_0x367d53[_0xabe0('0x3d')],qs[_0xabe0('0x42')](_0x3adca8[_0xabe0('0x3e')][_0xabe0('0x42')]));_0x129d4f[_0xabe0('0x43')]=_0x129d4f[_0xabe0('0x43')]['length']?_0x129d4f[_0xabe0('0x43')]:_0x367d53[_0xabe0('0x3d')];if(!_0x3adca8['query'][_0xabe0('0x44')](_0xabe0('0x45'))){_0x129d4f[_0xabe0('0x21')]=qs[_0xabe0('0x21')](_0x3adca8[_0xabe0('0x3e')]['limit']);_0x129d4f[_0xabe0('0x1f')]=qs['offset'](_0x3adca8[_0xabe0('0x3e')][_0xabe0('0x1f')]);}_0x129d4f[_0xabe0('0x46')]=qs[_0xabe0('0x47')](_0x3adca8[_0xabe0('0x3e')][_0xabe0('0x47')]);_0x129d4f[_0xabe0('0x48')]=qs['filters'](_['pick'](_0x3adca8[_0xabe0('0x3e')],_0x367d53[_0xabe0('0x40')]),_0x15050f);if(_0x3adca8['query']['filter']){_0x129d4f[_0xabe0('0x48')]=_[_0xabe0('0x30')](_0x129d4f['where'],{'$or':_['map'](_0x15050f,function(_0x1096c2){if(_0x1096c2[_0xabe0('0x3b')]!==_0xabe0('0x49')){var _0x2ac319={};_0x2ac319[_0x1096c2['name']]={'$like':'%'+_0x3adca8[_0xabe0('0x3e')]['filter']+'%'};return _0x2ac319;}})});}_0x129d4f=_[_0xabe0('0x30')]({},_0x129d4f,_0x3adca8[_0xabe0('0x4a')]);var _0x5ed166={'where':_0x129d4f[_0xabe0('0x48')]};return db[_0xabe0('0x38')][_0xabe0('0x22')](_0x5ed166)[_0xabe0('0x2a')](function(_0x405622){_0x3471fa['count']=_0x405622;if(_0x3adca8[_0xabe0('0x3e')][_0xabe0('0x4b')]){_0x129d4f[_0xabe0('0x4c')]=[{'all':!![]}];}return db[_0xabe0('0x38')][_0xabe0('0x4d')](_0x129d4f);})[_0xabe0('0x2a')](function(_0x5240f4){_0x3471fa['rows']=_0x5240f4;return _0x3471fa;})[_0xabe0('0x2a')](respondWithFilteredResult(_0x3bd494,_0x129d4f))[_0xabe0('0x4e')](handleError(_0x3bd494,null));};exports[_0xabe0('0x4f')]=function(_0x3ec45c,_0xc3b0e2){var _0x434416={'raw':![],'where':{'id':_0x3ec45c[_0xabe0('0x50')]['id']}},_0x6810f3={};_0x6810f3[_0xabe0('0x3d')]=_[_0xabe0('0x3f')](db[_0xabe0('0x38')][_0xabe0('0x39')]);_0x6810f3['query']=_[_0xabe0('0x3f')](_0x3ec45c[_0xabe0('0x3e')]);_0x6810f3[_0xabe0('0x40')]=_[_0xabe0('0x41')](_0x6810f3[_0xabe0('0x3d')],_0x6810f3[_0xabe0('0x3e')]);_0x434416['attributes']=_[_0xabe0('0x41')](_0x6810f3[_0xabe0('0x3d')],qs['fields'](_0x3ec45c[_0xabe0('0x3e')][_0xabe0('0x42')]));_0x434416[_0xabe0('0x43')]=_0x434416['attributes'][_0xabe0('0x51')]?_0x434416['attributes']:_0x6810f3[_0xabe0('0x3d')];if(_0x3ec45c[_0xabe0('0x3e')][_0xabe0('0x4b')]){_0x434416[_0xabe0('0x4c')]=[{'all':!![]}];}_0x434416=_['merge']({},_0x434416,_0x3ec45c[_0xabe0('0x4a')]);return db[_0xabe0('0x38')][_0xabe0('0x52')](_0x434416)[_0xabe0('0x2a')](handleEntityNotFound(_0xc3b0e2,null))[_0xabe0('0x2a')](respondWithResult(_0xc3b0e2,null))[_0xabe0('0x4e')](handleError(_0xc3b0e2,null));};exports[_0xabe0('0x53')]=function(_0x49c189,_0x3b8c1c){return db[_0xabe0('0x38')]['create'](_0x49c189['body'],{})[_0xabe0('0x2a')](function(_0x3893cd){var _0x5b089e=_0x49c189[_0xabe0('0x54')]['get']({'plain':!![]});if(!_0x5b089e)throw new Error(_0xabe0('0x55'));if(_0x5b089e['role']===_0xabe0('0x54')){var _0x37e4c5=_0x3893cd[_0xabe0('0x2c')]({'plain':!![]});var _0x33f4dc=_0xabe0('0x56');return db[_0xabe0('0x57')][_0xabe0('0x52')]({'where':{'name':_0x33f4dc,'userProfileId':_0x5b089e['userProfileId']},'raw':!![]})[_0xabe0('0x2a')](function(_0x4d068b){if(_0x4d068b&&_0x4d068b[_0xabe0('0x58')]===0x0){return db[_0xabe0('0x59')][_0xabe0('0x53')]({'name':_0x37e4c5['name'],'resourceId':_0x37e4c5['id'],'type':_0x4d068b['name'],'sectionId':_0x4d068b['id']},{})[_0xabe0('0x2a')](function(){return _0x3893cd;});}else{return _0x3893cd;}})[_0xabe0('0x4e')](function(_0x450b9e){logger[_0xabe0('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x450b9e);throw _0x450b9e;});}return _0x3893cd;})[_0xabe0('0x2a')](respondWithResult(_0x3b8c1c,0xc9))[_0xabe0('0x4e')](handleError(_0x3b8c1c,null));};exports[_0xabe0('0x5a')]=function(_0x4a7d9f,_0x101a94){var _0x42a56d={'where':{'id':_0x4a7d9f[_0xabe0('0x50')]['id']}},_0x5690bf={};_0x5690bf[_0xabe0('0x3d')]=_[_0xabe0('0x3f')](db[_0xabe0('0x38')][_0xabe0('0x39')]);_0x42a56d['attributes']=_[_0xabe0('0x41')](_0x5690bf[_0xabe0('0x3d')],qs['fields'](_0x4a7d9f[_0xabe0('0x3e')][_0xabe0('0x42')]));_0x42a56d[_0xabe0('0x43')]=_0x42a56d[_0xabe0('0x43')][_0xabe0('0x51')]?_0x42a56d[_0xabe0('0x43')]:_0x5690bf[_0xabe0('0x3d')];if(_0x4a7d9f[_0xabe0('0x3e')]['includeAll']){_0x42a56d['include']=[{'all':!![]}];}_0x42a56d=_['merge']({},_0x42a56d,_0x4a7d9f['options']);return db[_0xabe0('0x38')]['find'](_0x42a56d)['then'](handleEntityNotFound(_0x101a94,null))[_0xabe0('0x2a')](function(_0x47848f){if(_0x47848f){var _0x2328a6=_0x47848f['get']({'plain':!![]});_0x2328a6=qs['omit'](_0x2328a6,['id',_0xabe0('0x5b'),_0xabe0('0x5c')]);_0x4a7d9f['body']=_['omit'](_0x4a7d9f[_0xabe0('0x31')],['id',_0xabe0('0x5b'),'updatedAt']);return db[_0xabe0('0x38')][_0xabe0('0x53')](_[_0xabe0('0x30')](_0x2328a6,_0x4a7d9f[_0xabe0('0x31')]),{'include':_0x4a7d9f[_0xabe0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3897d7){var _0x5b985d=_0x4a7d9f['user'][_0xabe0('0x2c')]({'plain':!![]});if(!_0x5b985d)throw new Error(_0xabe0('0x55'));if(_0x5b985d['role']===_0xabe0('0x54')){var _0x1dfaa4=_0x3897d7[_0xabe0('0x2c')]({'plain':!![]});var _0x31fb54=_0xabe0('0x56');return db[_0xabe0('0x57')][_0xabe0('0x52')]({'where':{'name':_0x31fb54,'userProfileId':_0x5b985d[_0xabe0('0x5d')]},'raw':!![]})[_0xabe0('0x2a')](function(_0x349faf){if(_0x349faf&&_0x349faf[_0xabe0('0x58')]===0x0){return db[_0xabe0('0x59')][_0xabe0('0x53')]({'name':_0x1dfaa4[_0xabe0('0x2f')],'resourceId':_0x1dfaa4['id'],'type':_0x349faf[_0xabe0('0x2f')],'sectionId':_0x349faf['id']},{})[_0xabe0('0x2a')](function(){return _0x3897d7;});}else{return _0x3897d7;}})[_0xabe0('0x4e')](function(_0x16b1b7){logger[_0xabe0('0x2d')](_0xabe0('0x5e'),_0x16b1b7);throw _0x16b1b7;});}return _0x3897d7;});}})['then'](respondWithResult(_0x101a94,0xc9))[_0xabe0('0x4e')](handleError(_0x101a94,null));};exports[_0xabe0('0x29')]=function(_0x4db8cb,_0x5ed357){if(_0x4db8cb[_0xabe0('0x31')]['id']){delete _0x4db8cb[_0xabe0('0x31')]['id'];}return db[_0xabe0('0x38')][_0xabe0('0x52')]({'where':{'id':_0x4db8cb[_0xabe0('0x50')]['id']}})[_0xabe0('0x2a')](handleEntityNotFound(_0x5ed357,null))[_0xabe0('0x2a')](saveUpdates(_0x4db8cb[_0xabe0('0x31')],null))[_0xabe0('0x2a')](respondWithResult(_0x5ed357,null))['catch'](handleError(_0x5ed357,null));};exports[_0xabe0('0x2b')]=function(_0x148506,_0x15b389){return db[_0xabe0('0x38')][_0xabe0('0x52')]({'where':{'id':_0x148506[_0xabe0('0x50')]['id']}})[_0xabe0('0x2a')](handleEntityNotFound(_0x15b389,null))[_0xabe0('0x2a')](removeEntity(_0x15b389,null))[_0xabe0('0x4e')](handleError(_0x15b389,null));};function widgetAttributes(_0x3accf7){try{switch(_0x3accf7['type']){case _0xabe0('0x5f'):return[{'name':'attrUrl','value':_0x3accf7[_0xabe0('0x60')]||(_0x3accf7['attrs']&&_0x3accf7[_0xabe0('0x61')][0x0]?_0x3accf7[_0xabe0('0x61')][0x0][_0xabe0('0x62')]:undefined)||_0xabe0('0x63')}];case _0xabe0('0x64'):return[{'name':_0xabe0('0x65'),'value':_0x3accf7[_0xabe0('0x65')]||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7[_0xabe0('0x61')][0x0]?_0x3accf7['attrs'][0x0][_0xabe0('0x62')]:undefined)||''}];case'clock':return[{'name':_0xabe0('0x66'),'value':_0x3accf7[_0xabe0('0x66')]||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7['attrs'][0x0]?_0x3accf7[_0xabe0('0x61')][0x0][_0xabe0('0x62')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x3accf7[_0xabe0('0x67')]||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7['attrs'][0x1]?_0x3accf7[_0xabe0('0x61')][0x1][_0xabe0('0x62')]:undefined)||'0.00'},{'name':_0xabe0('0x68'),'value':_0x3accf7[_0xabe0('0x68')]||(_0x3accf7['attrs']&&_0x3accf7[_0xabe0('0x61')][0x2]?_0x3accf7[_0xabe0('0x61')][0x2]['value']:undefined)||0xc}];case _0xabe0('0x69'):return[{'name':_0xabe0('0x6a'),'value':_0x3accf7['attrMetric']||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7[_0xabe0('0x61')][0x0]?_0x3accf7[_0xabe0('0x61')][0x0]['value']:undefined)||_0xabe0('0x6b')},{'name':_0xabe0('0x6c'),'value':_0x3accf7[_0xabe0('0x6c')]||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7[_0xabe0('0x61')][0x1]?_0x3accf7['attrs'][0x1][_0xabe0('0x62')]:undefined)||[]},{'name':_0xabe0('0x68'),'value':_0x3accf7[_0xabe0('0x68')]||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7[_0xabe0('0x61')][0x2]?_0x3accf7['attrs'][0x2]['value']:undefined)||0x14}];case _0xabe0('0x6d'):case _0xabe0('0x6e'):return[{'name':_0xabe0('0x6f'),'value':_0x3accf7[_0xabe0('0x6f')]||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7[_0xabe0('0x61')][0x0]?_0x3accf7[_0xabe0('0x61')][0x0]['value']:undefined)||_0xabe0('0x6b')},{'name':_0xabe0('0x70'),'value':_0x3accf7['attrSerie2']||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7[_0xabe0('0x61')][0x1]?_0x3accf7[_0xabe0('0x61')][0x1][_0xabe0('0x62')]:undefined)||null},{'name':_0xabe0('0x71'),'value':_0x3accf7[_0xabe0('0x71')]||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7[_0xabe0('0x61')][0x2]?_0x3accf7[_0xabe0('0x61')][0x2][_0xabe0('0x62')]:undefined)||null},{'name':_0xabe0('0x6c'),'value':_0x3accf7[_0xabe0('0x6c')]||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7['attrs'][0x3]?_0x3accf7[_0xabe0('0x61')][0x3][_0xabe0('0x62')]:undefined)||[]}];case _0xabe0('0x72'):return[{'name':_0xabe0('0x73'),'type':_0x3accf7['reportType']||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7[_0xabe0('0x61')][0x0]?_0x3accf7[_0xabe0('0x61')][0x0]['type']:undefined)||null,'value':_0x3accf7[_0xabe0('0x73')]||(_0x3accf7['attrs']&&_0x3accf7[_0xabe0('0x61')][0x0]?_0x3accf7[_0xabe0('0x61')][0x0][_0xabe0('0x62')]:undefined)||null},{'name':_0xabe0('0x74'),'value':_0x3accf7[_0xabe0('0x74')]||(_0x3accf7[_0xabe0('0x61')]&&_0x3accf7[_0xabe0('0x61')][0x1]?_0x3accf7[_0xabe0('0x61')][0x1][_0xabe0('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x306968){logger[_0xabe0('0x2d')](_0xabe0('0x75'),JSON[_0xabe0('0x76')](_0x306968));return[];}}exports[_0xabe0('0x77')]=function(_0x437c91,_0xd1847d,_0x5812da){if(_0x437c91[_0xabe0('0x31')]['id']){delete _0x437c91[_0xabe0('0x31')]['id'];}return db[_0xabe0('0x38')][_0xabe0('0x52')]({'where':{'id':_0x437c91[_0xabe0('0x50')]['id']}})[_0xabe0('0x2a')](handleEntityNotFound(_0xd1847d,null))[_0xabe0('0x2a')](function(_0x35f209){if(_0x35f209){_0x437c91['body'][_0xabe0('0x78')]=_0x35f209['id'];_0x437c91['body'][_0xabe0('0x61')]=widgetAttributes(_0x437c91[_0xabe0('0x31')]);return db[_0xabe0('0x79')][_0xabe0('0x53')](_0x437c91[_0xabe0('0x31')]);}})[_0xabe0('0x2a')](respondWithResult(_0xd1847d,null))['catch'](handleError(_0xd1847d,null));};exports[_0xabe0('0x7a')]=function(_0x257ce6,_0x2475cf,_0x3f0b57){var _0x4048f9={};var _0x33bb9d={};var _0x446859;var _0x1d1f8a;return db[_0xabe0('0x38')][_0xabe0('0x7b')]({'where':{'id':_0x257ce6[_0xabe0('0x50')]['id']}})[_0xabe0('0x2a')](handleEntityNotFound(_0x2475cf,null))[_0xabe0('0x2a')](function(_0x5a56f8){if(_0x5a56f8){_0x446859=_0x5a56f8;_0x33bb9d[_0xabe0('0x3d')]=_[_0xabe0('0x3f')](db[_0xabe0('0x79')][_0xabe0('0x39')]);_0x33bb9d[_0xabe0('0x3e')]=_[_0xabe0('0x3f')](_0x257ce6['query']);_0x33bb9d['filters']=_[_0xabe0('0x41')](_0x33bb9d[_0xabe0('0x3d')],_0x33bb9d[_0xabe0('0x3e')]);_0x4048f9['attributes']=_[_0xabe0('0x41')](_0x33bb9d['model'],qs['fields'](_0x257ce6[_0xabe0('0x3e')][_0xabe0('0x42')]));_0x4048f9[_0xabe0('0x43')]=_0x4048f9[_0xabe0('0x43')][_0xabe0('0x51')]?_0x4048f9['attributes']:_0x33bb9d[_0xabe0('0x3d')];_0x4048f9[_0xabe0('0x46')]=qs['sort'](_0x257ce6[_0xabe0('0x3e')][_0xabe0('0x47')]);_0x4048f9[_0xabe0('0x48')]=qs[_0xabe0('0x40')](_[_0xabe0('0x7c')](_0x257ce6['query'],_0x33bb9d[_0xabe0('0x40')]));if(_0x257ce6[_0xabe0('0x3e')][_0xabe0('0x7d')]){_0x4048f9[_0xabe0('0x48')]=_[_0xabe0('0x30')](_0x4048f9[_0xabe0('0x48')],{'$or':_[_0xabe0('0x37')](_0x4048f9[_0xabe0('0x43')],function(_0x5723c0){var _0x2b8d13={};_0x2b8d13[_0x5723c0]={'$like':'%'+_0x257ce6[_0xabe0('0x3e')]['filter']+'%'};return _0x2b8d13;})});}_0x4048f9=_[_0xabe0('0x30')]({},_0x4048f9,_0x257ce6['options']);return _0x446859['getItems'](_0x4048f9);}})[_0xabe0('0x2a')](function(_0x4dca45){if(_0x4dca45){_0x1d1f8a=_0x4dca45[_0xabe0('0x51')];if(!_0x257ce6[_0xabe0('0x3e')][_0xabe0('0x44')]('nolimit')){_0x4048f9[_0xabe0('0x21')]=qs[_0xabe0('0x21')](_0x257ce6[_0xabe0('0x3e')]['limit']);_0x4048f9[_0xabe0('0x1f')]=qs[_0xabe0('0x1f')](_0x257ce6[_0xabe0('0x3e')][_0xabe0('0x1f')]);}return _0x446859[_0xabe0('0x7a')](_0x4048f9);}})['then'](function(_0x5bb5e7){if(_0x5bb5e7){return _0x5bb5e7?{'count':_0x1d1f8a,'rows':_0x5bb5e7}:null;}})[_0xabe0('0x2a')](respondWithResult(_0x2475cf,null))['catch'](handleError(_0x2475cf,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 15e0458..1724859 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 _0xba3a=['Dashboard','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3f3272,_0x4f7010){var _0x3343b7=function(_0x5f5a2e){while(--_0x5f5a2e){_0x3f3272['push'](_0x3f3272['shift']());}};_0x3343b7(++_0x4f7010);}(_0xba3a,0x17e));var _0xaba3=function(_0x36bfdd,_0x425a87){_0x36bfdd=_0x36bfdd-0x0;var _0x2f60c0=_0xba3a[_0x36bfdd];return _0x2f60c0;};'use strict';var EventEmitter=require(_0xaba3('0x0'));var Dashboard=require(_0xaba3('0x1'))['db'][_0xaba3('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaba3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4aa27f){return function(_0x2357fe,_0x3b7986,_0x24f0a3){DashboardEvents['emit'](_0x4aa27f+':'+_0x2357fe['id'],_0x2357fe);DashboardEvents[_0xaba3('0x4')](_0x4aa27f,_0x2357fe);_0x24f0a3(null);};}for(var e in events){if(events[_0xaba3('0x5')](e)){var event=events[e];Dashboard[_0xaba3('0x6')](e,emitEvent(event));}}module[_0xaba3('0x7')]=DashboardEvents; \ No newline at end of file +var _0x2092=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x27963e,_0x1fb021){var _0x2a19d2=function(_0x1f5da9){while(--_0x1f5da9){_0x27963e['push'](_0x27963e['shift']());}};_0x2a19d2(++_0x1fb021);}(_0x2092,0xb7));var _0x2209=function(_0x1a9350,_0x15b51d){_0x1a9350=_0x1a9350-0x0;var _0x3461f0=_0x2092[_0x1a9350];return _0x3461f0;};'use strict';var EventEmitter=require(_0x2209('0x0'));var Dashboard=require(_0x2209('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2209('0x2'),'afterUpdate':_0x2209('0x3'),'afterDestroy':_0x2209('0x4')};function emitEvent(_0x3f6389){return function(_0x5c501f,_0x52c364,_0x2b0f36){DashboardEvents[_0x2209('0x5')](_0x3f6389+':'+_0x5c501f['id'],_0x5c501f);DashboardEvents[_0x2209('0x5')](_0x3f6389,_0x5c501f);_0x2b0f36(null);};}for(var e in events){if(events[_0x2209('0x6')](e)){var event=events[e];Dashboard[_0x2209('0x7')](e,emitEvent(event));}}module[_0x2209('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 51afb64..035d283 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 _0xfa24=['../../config/environment','./dashboard.attributes','exports','dashboards','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3ad996,_0x2699a3){var _0x162c78=function(_0x16d18e){while(--_0x16d18e){_0x3ad996['push'](_0x3ad996['shift']());}};_0x162c78(++_0x2699a3);}(_0xfa24,0x130));var _0x4fa2=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0xfa24[_0x12b8ec];return _0x21af77;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4fa2('0x0'))(_0x4fa2('0x1'));var moment=require(_0x4fa2('0x2'));var BPromise=require('bluebird');var rp=require(_0x4fa2('0x3'));var fs=require('fs');var path=require(_0x4fa2('0x4'));var rimraf=require(_0x4fa2('0x5'));var config=require(_0x4fa2('0x6'));var attributes=require(_0x4fa2('0x7'));module[_0x4fa2('0x8')]=function(_0x418ce3,_0x14144b){return _0x418ce3['define']('Dashboard',attributes,{'tableName':_0x4fa2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba9d=['../../config/logger','api','bluebird','request-promise','path','./dashboard.attributes','exports','define','Dashboard','util'];(function(_0x1621dd,_0x172229){var _0x3b0046=function(_0x53ab32){while(--_0x53ab32){_0x1621dd['push'](_0x1621dd['shift']());}};_0x3b0046(++_0x172229);}(_0xba9d,0x153));var _0xdba9=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xba9d[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0xdba9('0x0'));var logger=require(_0xdba9('0x1'))(_0xdba9('0x2'));var moment=require('moment');var BPromise=require(_0xdba9('0x3'));var rp=require(_0xdba9('0x4'));var fs=require('fs');var path=require(_0xdba9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdba9('0x6'));module[_0xdba9('0x7')]=function(_0xb5685e,_0x50fd84){return _0xb5685e[_0xdba9('0x8')](_0xdba9('0x9'),attributes,{'tableName':'dashboards','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 868f324..ffc83ea 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 _0x9330=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','request\x20sent','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x32361a,_0x5d5206){var _0x5e452f=function(_0xb0276){while(--_0xb0276){_0x32361a['push'](_0x32361a['shift']());}};_0x5e452f(++_0x5d5206);}(_0x9330,0x14a));var _0x0933=function(_0x3176c7,_0x5ca8e8){_0x3176c7=_0x3176c7-0x0;var _0x1fca4f=_0x9330[_0x3176c7];return _0x1fca4f;};'use strict';var _=require(_0x0933('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0933('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0933('0x2'))['db'];var utils=require(_0x0933('0x3'));var logger=require(_0x0933('0x4'))(_0x0933('0x5'));var config=require(_0x0933('0x6'));var jayson=require(_0x0933('0x7'));var client=jayson[_0x0933('0x8')]['http']({'port':0x232a});config[_0x0933('0x9')]=_[_0x0933('0xa')](config[_0x0933('0x9')],{'host':_0x0933('0xb'),'port':0x18eb});var socket=require(_0x0933('0xc'))(new Redis(config[_0x0933('0x9')]));require(_0x0933('0xd'))[_0x0933('0xe')](socket);function respondWithRpcPromise(_0xa0678d,_0x5e6b9a,_0x2cb912){return new BPromise(function(_0x30bbf8,_0x73dca7){return client[_0x0933('0xf')](_0xa0678d,_0x2cb912)['then'](function(_0x583f7d){logger['info']('Dashboard,\x20%s,\x20%s',_0x5e6b9a,_0x0933('0x10'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x5e6b9a,'request\x20sent',JSON[_0x0933('0x11')](_0x583f7d));if(_0x583f7d[_0x0933('0x12')]){if(_0x583f7d['error'][_0x0933('0x13')]===0x1f4){logger[_0x0933('0x12')]('Dashboard,\x20%s,\x20%s',_0x5e6b9a,_0x583f7d['error'][_0x0933('0x14')]);return _0x73dca7(_0x583f7d[_0x0933('0x12')]['message']);}logger[_0x0933('0x12')](_0x0933('0x15'),_0x5e6b9a,_0x583f7d[_0x0933('0x12')][_0x0933('0x14')]);return _0x30bbf8(_0x583f7d[_0x0933('0x12')][_0x0933('0x14')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x5e6b9a,_0x0933('0x10'));_0x30bbf8(_0x583f7d[_0x0933('0x16')][_0x0933('0x14')]);}})[_0x0933('0x17')](function(_0x354863){logger[_0x0933('0x12')](_0x0933('0x15'),_0x5e6b9a,_0x354863);_0x73dca7(_0x354863);});});} \ No newline at end of file +var _0x3477=['jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x18e2b6,_0x5e188b){var _0x1b34b0=function(_0x207e53){while(--_0x207e53){_0x18e2b6['push'](_0x18e2b6['shift']());}};_0x1b34b0(++_0x5e188b);}(_0x3477,0x17d));var _0x7347=function(_0x125807,_0x32f084){_0x125807=_0x125807-0x0;var _0x5c57c2=_0x3477[_0x125807];return _0x5c57c2;};'use strict';var _=require('lodash');var util=require(_0x7347('0x0'));var moment=require(_0x7347('0x1'));var BPromise=require(_0x7347('0x2'));var rs=require(_0x7347('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7347('0x4'))['db'];var utils=require(_0x7347('0x5'));var logger=require(_0x7347('0x6'))(_0x7347('0x7'));var config=require(_0x7347('0x8'));var jayson=require(_0x7347('0x9'));var client=jayson[_0x7347('0xa')]['http']({'port':0x232a});config[_0x7347('0xb')]=_['defaults'](config[_0x7347('0xb')],{'host':_0x7347('0xc'),'port':0x18eb});var socket=require(_0x7347('0xd'))(new Redis(config[_0x7347('0xb')]));require('./dashboard.socket')[_0x7347('0xe')](socket);function respondWithRpcPromise(_0x734053,_0x2e365c,_0x43543e){return new BPromise(function(_0x20f232,_0x4d78c2){return client[_0x7347('0xf')](_0x734053,_0x43543e)[_0x7347('0x10')](function(_0x342b56){logger['info'](_0x7347('0x11'),_0x2e365c,_0x7347('0x12'));logger[_0x7347('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x2e365c,_0x7347('0x12'),JSON[_0x7347('0x14')](_0x342b56));if(_0x342b56[_0x7347('0x15')]){if(_0x342b56[_0x7347('0x15')][_0x7347('0x16')]===0x1f4){logger[_0x7347('0x15')]('Dashboard,\x20%s,\x20%s',_0x2e365c,_0x342b56[_0x7347('0x15')][_0x7347('0x17')]);return _0x4d78c2(_0x342b56[_0x7347('0x15')][_0x7347('0x17')]);}logger[_0x7347('0x15')](_0x7347('0x11'),_0x2e365c,_0x342b56['error']['message']);return _0x20f232(_0x342b56[_0x7347('0x15')][_0x7347('0x17')]);}else{logger[_0x7347('0x18')](_0x7347('0x11'),_0x2e365c,_0x7347('0x12'));_0x20f232(_0x342b56[_0x7347('0x19')]['message']);}})['catch'](function(_0x3fa49b){logger[_0x7347('0x15')](_0x7347('0x11'),_0x2e365c,_0x3fa49b);_0x4d78c2(_0x3fa49b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2685956..d351e09 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 _0xa624=['dashboard:','./dashboard.events','save','remove','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa624,0x181));var _0x4a62=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0xa624[_0x50a004];return _0x5e9992;};'use strict';var DashboardEvents=require(_0x4a62('0x0'));var events=[_0x4a62('0x1'),_0x4a62('0x2'),'update'];function createListener(_0x3ddd44,_0x109474){return function(_0x38b82b){_0x109474[_0x4a62('0x3')](_0x3ddd44,_0x38b82b);};}function removeListener(_0x534069,_0xc27f8){return function(){DashboardEvents[_0x4a62('0x4')](_0x534069,_0xc27f8);};}exports['register']=function(_0x3653f2){for(var _0x286ad6=0x0,_0x247660=events['length'];_0x286ad6<_0x247660;_0x286ad6++){var _0x4b4836=events[_0x286ad6];var _0x5c23ea=createListener(_0x4a62('0x5')+_0x4b4836,_0x3653f2);DashboardEvents['on'](_0x4b4836,_0x5c23ea);}}; \ No newline at end of file +var _0xc26f=['removeListener','register','length','dashboard:','./dashboard.events','remove','emit'];(function(_0x383055,_0x39bb10){var _0x32b04b=function(_0x2b4ca2){while(--_0x2b4ca2){_0x383055['push'](_0x383055['shift']());}};_0x32b04b(++_0x39bb10);}(_0xc26f,0x19a));var _0xfc26=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xc26f[_0x599f41];return _0x2e4d58;};'use strict';var DashboardEvents=require(_0xfc26('0x0'));var events=['save',_0xfc26('0x1'),'update'];function createListener(_0x510913,_0x1ae1d3){return function(_0x2e41db){_0x1ae1d3[_0xfc26('0x2')](_0x510913,_0x2e41db);};}function removeListener(_0x378213,_0x547cc6){return function(){DashboardEvents[_0xfc26('0x3')](_0x378213,_0x547cc6);};}exports[_0xfc26('0x4')]=function(_0x6dd05c){for(var _0x24974d=0x0,_0x4298f9=events[_0xfc26('0x5')];_0x24974d<_0x4298f9;_0x24974d++){var _0xb0d347=events[_0x24974d];var _0x5a3ac0=createListener(_0xfc26('0x6')+_0xb0d347,_0x6dd05c);DashboardEvents['on'](_0xb0d347,_0x5a3ac0);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 79e3ee0..39ef170 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 _0x34e8=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','clone','put','update','delete','exports'];(function(_0x338459,_0x2c3141){var _0x8f84c=function(_0x29c2e8){while(--_0x29c2e8){_0x338459['push'](_0x338459['shift']());}};_0x8f84c(++_0x2c3141);}(_0x34e8,0x12c));var _0x834e=function(_0x3d68f4,_0x4ef7b9){_0x3d68f4=_0x3d68f4-0x0;var _0x3d2593=_0x34e8[_0x3d68f4];return _0x3d2593;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x11')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller['addItem']);router[_0x834e('0x15')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x18')]=router; \ No newline at end of file +var _0xbec5=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','/:id/items','post','create','/:id/clone','clone','addItem','put'];(function(_0x308bfe,_0x23c73e){var _0x144063=function(_0x22b518){while(--_0x22b518){_0x308bfe['push'](_0x308bfe['shift']());}};_0x144063(++_0x23c73e);}(_0xbec5,0xe5));var _0x5bec=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xbec5[_0x616290];return _0x453879;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['getItems']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0xf')](_0x5bec('0x11'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0xf')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x13')]);router[_0x5bec('0x14')]('/:id',auth[_0x5bec('0xc')](),controller[_0x5bec('0x15')]);router[_0x5bec('0x16')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0x17')]);module[_0x5bec('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index cd44d82..659680e 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 _0xd748=['#2196f3','sequelize','squel','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x5cd3f8,_0x20e34b){var _0x390991=function(_0x2845bd){while(--_0x2845bd){_0x5cd3f8['push'](_0x5cd3f8['shift']());}};_0x390991(++_0x20e34b);}(_0xd748,0x1a5));var _0x8d74=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xd748[_0x456fb1];return _0x4083d6;};'use strict';var Sequelize=require(_0x8d74('0x0'));var squel=require(_0x8d74('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x8d74('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8d74('0x3')]('long'),'get':function(){try{return JSON[_0x8d74('0x4')](this[_0x8d74('0x5')](_0x8d74('0x6')));}catch(_0x33b362){return[];}},'set':function(_0xd4feed){try{this[_0x8d74('0x7')](_0x8d74('0x6'),JSON[_0x8d74('0x8')](_0xd4feed));}catch(_0x389ec2){this[_0x8d74('0x7')](_0x8d74('0x6'),JSON[_0x8d74('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x8d74('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x8d74('0x9')]},'col':{'type':Sequelize[_0x8d74('0x9')]},'background':{'type':Sequelize[_0x8d74('0x2')],'allowNull':![],'defaultValue':_0x8d74('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8d74('0x2')],'allowNull':![],'defaultValue':_0x8d74('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8d74('0x2')]},'titleFontSize':{'type':Sequelize[_0x8d74('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xd2e3=['squel','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x2d143d,_0x3aaf94){var _0x8332ef=function(_0x1af80c){while(--_0x1af80c){_0x2d143d['push'](_0x2d143d['shift']());}};_0x8332ef(++_0x3aaf94);}(_0xd2e3,0x6e));var _0x3d2e=function(_0x44da4f,_0x42dde2){_0x44da4f=_0x44da4f-0x0;var _0x2d6865=_0xd2e3[_0x44da4f];return _0x2d6865;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x3d2e('0x0'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x3d2e('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3d2e('0x2')](_0x3d2e('0x3')),'get':function(){try{return JSON['parse'](this[_0x3d2e('0x4')](_0x3d2e('0x5')));}catch(_0x359aba){return[];}},'set':function(_0xf504ab){try{this[_0x3d2e('0x6')](_0x3d2e('0x5'),JSON[_0x3d2e('0x7')](_0xf504ab));}catch(_0x5311ac){this[_0x3d2e('0x6')](_0x3d2e('0x5'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x3d2e('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x3d2e('0x8')]},'background':{'type':Sequelize[_0x3d2e('0x1')],'allowNull':![],'defaultValue':_0x3d2e('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3d2e('0x1')],'allowNull':![],'defaultValue':_0x3d2e('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x3d2e('0x8')],'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 7d20e6e..bd52bf3 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 _0x2086=['../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','update','then','error','stack','name','send','render','body','contact','message','agent','interaction','account','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','params','type','iframe','attrUrl','attrs','value','https://','custom','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1ad0d0,_0x3e4614){var _0xa5e9ae=function(_0x4f22dc){while(--_0x4f22dc){_0x1ad0d0['push'](_0x1ad0d0['shift']());}};_0xa5e9ae(++_0x3e4614);}(_0x2086,0x16b));var _0x6208=function(_0x19d0fc,_0x25c3cb){_0x19d0fc=_0x19d0fc-0x0;var _0x2bcddf=_0x2086[_0x19d0fc];return _0x2bcddf;};'use strict';var emlformat=require(_0x6208('0x0'));var rimraf=require(_0x6208('0x1'));var zipdir=require(_0x6208('0x2'));var jsonpatch=require(_0x6208('0x3'));var rp=require(_0x6208('0x4'));var moment=require(_0x6208('0x5'));var BPromise=require(_0x6208('0x6'));var Mustache=require('mustache');var util=require(_0x6208('0x7'));var path=require(_0x6208('0x8'));var sox=require(_0x6208('0x9'));var csv=require(_0x6208('0xa'));var ejs=require(_0x6208('0xb'));var fs=require('fs');var fs_extra=require(_0x6208('0xc'));var _=require(_0x6208('0xd'));var squel=require('squel');var crypto=require(_0x6208('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6208('0xa'));var querystring=require(_0x6208('0xf'));var Papa=require(_0x6208('0x10'));var Redis=require(_0x6208('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6208('0x12'));var as=require(_0x6208('0x13'));var hardwareService=require(_0x6208('0x14'));var logger=require(_0x6208('0x15'))(_0x6208('0x16'));var utils=require(_0x6208('0x17'));var config=require(_0x6208('0x18'));var licenseUtil=require(_0x6208('0x19'));var db=require(_0x6208('0x1a'))['db'];config[_0x6208('0x1b')]=_[_0x6208('0x1c')](config[_0x6208('0x1b')],{'host':_0x6208('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6208('0x1b')]));require('./dashboardItem.socket')[_0x6208('0x1e')](socket);function respondWithStatusCode(_0x2f3ff8,_0x376f74){_0x376f74=_0x376f74||0xcc;return function(_0x23da77){if(_0x23da77){return _0x2f3ff8[_0x6208('0x1f')](_0x376f74);}return _0x2f3ff8['status'](_0x376f74)[_0x6208('0x20')]();};}function respondWithResult(_0x3a689e,_0x169640){_0x169640=_0x169640||0xc8;return function(_0x57edae){if(_0x57edae){return _0x3a689e['status'](_0x169640)[_0x6208('0x21')](_0x57edae);}};}function respondWithFilteredResult(_0x60cfd,_0x38211e){return function(_0x1b8ffd){if(_0x1b8ffd){var _0x32ace1=typeof _0x38211e[_0x6208('0x22')]===_0x6208('0x23')&&typeof _0x38211e['limit']===_0x6208('0x23');var _0x1a373a=_0x1b8ffd[_0x6208('0x24')];var _0x2fef31=_0x32ace1?0x0:_0x38211e['offset'];var _0x2305ba=_0x32ace1?_0x1b8ffd[_0x6208('0x24')]:_0x38211e[_0x6208('0x22')]+_0x38211e[_0x6208('0x25')];var _0x290144;if(_0x2305ba>=_0x1a373a){_0x2305ba=_0x1a373a;_0x290144=0xc8;}else{_0x290144=0xce;}_0x60cfd[_0x6208('0x26')](_0x290144);return _0x60cfd[_0x6208('0x27')](_0x6208('0x28'),_0x2fef31+'-'+_0x2305ba+'/'+_0x1a373a)[_0x6208('0x21')](_0x1b8ffd);}return null;};}function patchUpdates(_0x21116e){return function(_0x2e1a6c){try{jsonpatch[_0x6208('0x29')](_0x2e1a6c,_0x21116e,!![]);}catch(_0x5520b2){return BPromise['reject'](_0x5520b2);}return _0x2e1a6c['save']();};}function saveUpdates(_0x221130,_0x5dad53){return function(_0x1be9ad){if(_0x1be9ad){return _0x1be9ad[_0x6208('0x2a')](_0x221130)[_0x6208('0x2b')](function(_0xf5d5cd){return _0xf5d5cd;});}return null;};}function removeEntity(_0x42b617,_0x88f3be){return function(_0x380aa0){if(_0x380aa0){return _0x380aa0['destroy']()[_0x6208('0x2b')](function(){_0x42b617[_0x6208('0x26')](0xcc)[_0x6208('0x20')]();});}};}function handleEntityNotFound(_0x3937cc,_0x366114){return function(_0x247f95){if(!_0x247f95){_0x3937cc[_0x6208('0x1f')](0x194);}return _0x247f95;};}function handleError(_0x1109e9,_0x3d4aa2){_0x3d4aa2=_0x3d4aa2||0x1f4;return function(_0x4b2b51){logger[_0x6208('0x2c')](_0x4b2b51[_0x6208('0x2d')]);if(_0x4b2b51[_0x6208('0x2e')]){delete _0x4b2b51['name'];}_0x1109e9[_0x6208('0x26')](_0x3d4aa2)[_0x6208('0x2f')](_0x4b2b51);};}function getMustacheRender(_0x4c2306,_0x3e9c22){return Mustache[_0x6208('0x30')](_0x4c2306,_['merge'](_0x3e9c22[_0x6208('0x31')],{'contact':_0x3e9c22[_0x6208('0x32')],'message':_0x3e9c22[_0x6208('0x33')],'agent':_0x3e9c22[_0x6208('0x34')],'interaction':_0x3e9c22[_0x6208('0x35')],'account':_0x3e9c22[_0x6208('0x36')]}))||'';}exports['show']=function(_0x1f81e4,_0x3a8438){var _0x3e45aa={'raw':![],'where':{'id':_0x1f81e4['params']['id']}},_0x5e9b72={};_0x5e9b72[_0x6208('0x37')]=_['keys'](db[_0x6208('0x38')][_0x6208('0x39')]);_0x5e9b72[_0x6208('0x3a')]=_[_0x6208('0x3b')](_0x1f81e4[_0x6208('0x3a')]);_0x5e9b72[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x5e9b72[_0x6208('0x37')],_0x5e9b72[_0x6208('0x3a')]);_0x3e45aa[_0x6208('0x3e')]=_[_0x6208('0x3d')](_0x5e9b72[_0x6208('0x37')],qs['fields'](_0x1f81e4[_0x6208('0x3a')][_0x6208('0x3f')]));_0x3e45aa['attributes']=_0x3e45aa[_0x6208('0x3e')][_0x6208('0x40')]?_0x3e45aa[_0x6208('0x3e')]:_0x5e9b72[_0x6208('0x37')];if(_0x1f81e4[_0x6208('0x3a')][_0x6208('0x41')]){_0x3e45aa[_0x6208('0x42')]=[{'all':!![]}];}_0x3e45aa=_['merge']({},_0x3e45aa,_0x1f81e4[_0x6208('0x43')]);return db[_0x6208('0x38')][_0x6208('0x44')](_0x3e45aa)[_0x6208('0x2b')](handleEntityNotFound(_0x3a8438,null))[_0x6208('0x2b')](respondWithResult(_0x3a8438,null))[_0x6208('0x45')](handleError(_0x3a8438,null));};exports['destroy']=function(_0x1ddafd,_0x55475a){return db[_0x6208('0x38')][_0x6208('0x44')]({'where':{'id':_0x1ddafd[_0x6208('0x46')]['id']}})[_0x6208('0x2b')](handleEntityNotFound(_0x55475a,null))[_0x6208('0x2b')](removeEntity(_0x55475a,null))[_0x6208('0x45')](handleError(_0x55475a,null));};function widgetAttributes(_0x414a67){try{switch(_0x414a67[_0x6208('0x47')]){case _0x6208('0x48'):return[{'name':_0x6208('0x49'),'value':_0x414a67['attrUrl']||(_0x414a67[_0x6208('0x4a')]&&_0x414a67[_0x6208('0x4a')][0x0]?_0x414a67[_0x6208('0x4a')][0x0][_0x6208('0x4b')]:undefined)||_0x6208('0x4c')}];case _0x6208('0x4d'):return[{'name':'attrPath','value':_0x414a67['attrPath']||(_0x414a67[_0x6208('0x4a')]&&_0x414a67['attrs'][0x0]?_0x414a67[_0x6208('0x4a')][0x0][_0x6208('0x4b')]:undefined)||''}];case'clock':return[{'name':_0x6208('0x4e'),'value':_0x414a67[_0x6208('0x4e')]||(_0x414a67[_0x6208('0x4a')]&&_0x414a67[_0x6208('0x4a')][0x0]?_0x414a67[_0x6208('0x4a')][0x0][_0x6208('0x4b')]:undefined)||_0x6208('0x4f')},{'name':_0x6208('0x50'),'value':_0x414a67[_0x6208('0x50')]||(_0x414a67[_0x6208('0x4a')]&&_0x414a67[_0x6208('0x4a')][0x1]?_0x414a67['attrs'][0x1][_0x6208('0x4b')]:undefined)||_0x6208('0x51')},{'name':'attrFontSize','value':_0x414a67[_0x6208('0x52')]||(_0x414a67['attrs']&&_0x414a67[_0x6208('0x4a')][0x2]?_0x414a67[_0x6208('0x4a')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x6208('0x53'),'value':_0x414a67[_0x6208('0x53')]||(_0x414a67[_0x6208('0x4a')]&&_0x414a67[_0x6208('0x4a')][0x0]?_0x414a67[_0x6208('0x4a')][0x0][_0x6208('0x4b')]:undefined)||_0x6208('0x54')},{'name':_0x6208('0x55'),'value':_0x414a67['attrVoiceQueues']||(_0x414a67['attrs']&&_0x414a67[_0x6208('0x4a')][0x1]?_0x414a67['attrs'][0x1]['value']:undefined)||[]},{'name':_0x6208('0x52'),'value':_0x414a67[_0x6208('0x52')]||(_0x414a67['attrs']&&_0x414a67['attrs'][0x2]?_0x414a67[_0x6208('0x4a')][0x2][_0x6208('0x4b')]:undefined)||0x14}];case _0x6208('0x56'):case _0x6208('0x57'):return[{'name':_0x6208('0x58'),'value':_0x414a67[_0x6208('0x58')]||(_0x414a67[_0x6208('0x4a')]&&_0x414a67[_0x6208('0x4a')][0x0]?_0x414a67[_0x6208('0x4a')][0x0]['value']:undefined)||_0x6208('0x54')},{'name':_0x6208('0x59'),'value':_0x414a67[_0x6208('0x59')]||(_0x414a67['attrs']&&_0x414a67[_0x6208('0x4a')][0x1]?_0x414a67[_0x6208('0x4a')][0x1][_0x6208('0x4b')]:undefined)||null},{'name':_0x6208('0x5a'),'value':_0x414a67[_0x6208('0x5a')]||(_0x414a67['attrs']&&_0x414a67[_0x6208('0x4a')][0x2]?_0x414a67[_0x6208('0x4a')][0x2]['value']:undefined)||null},{'name':_0x6208('0x55'),'value':_0x414a67['attrVoiceQueues']||(_0x414a67[_0x6208('0x4a')]&&_0x414a67[_0x6208('0x4a')][0x3]?_0x414a67[_0x6208('0x4a')][0x3][_0x6208('0x4b')]:undefined)||[]}];case'web-report':return[{'name':_0x6208('0x5b'),'type':_0x414a67[_0x6208('0x5c')]||(_0x414a67['attrs']&&_0x414a67[_0x6208('0x4a')][0x0]?_0x414a67[_0x6208('0x4a')][0x0][_0x6208('0x47')]:undefined)||null,'value':_0x414a67[_0x6208('0x5b')]||(_0x414a67['attrs']&&_0x414a67[_0x6208('0x4a')][0x0]?_0x414a67[_0x6208('0x4a')][0x0][_0x6208('0x4b')]:undefined)||null},{'name':_0x6208('0x5d'),'value':_0x414a67['attrRefresh']||(_0x414a67['attrs']&&_0x414a67[_0x6208('0x4a')][0x1]?_0x414a67[_0x6208('0x4a')][0x1][_0x6208('0x4b')]:undefined)||0x0}];default:return[];}}catch(_0x51f5eb){logger[_0x6208('0x2c')](_0x6208('0x5e'),JSON[_0x6208('0x5f')](_0x51f5eb));return[];}}exports[_0x6208('0x60')]=function(_0x3cdb08,_0x364b13){if(_0x3cdb08['body']){_0x3cdb08[_0x6208('0x31')][_0x6208('0x4a')]=widgetAttributes(_0x3cdb08[_0x6208('0x31')]);}return db[_0x6208('0x38')][_0x6208('0x60')](_0x3cdb08['body'],{})[_0x6208('0x2b')](respondWithResult(_0x364b13,0xc9))[_0x6208('0x45')](handleError(_0x364b13,null));};exports['update']=function(_0x12ebfb,_0x93f71a){if(_0x12ebfb['body']['id']){delete _0x12ebfb[_0x6208('0x31')]['id'];}_0x12ebfb['body']['attrs']=widgetAttributes(_0x12ebfb['body']);return db[_0x6208('0x38')][_0x6208('0x44')]({'where':{'id':_0x12ebfb['params']['id']}})[_0x6208('0x2b')](handleEntityNotFound(_0x93f71a,null))[_0x6208('0x2b')](saveUpdates(_0x12ebfb[_0x6208('0x31')],null))[_0x6208('0x2b')](respondWithResult(_0x93f71a,null))[_0x6208('0x45')](handleError(_0x93f71a,null));}; \ No newline at end of file +var _0xa07c=['undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','contact','message','agent','interaction','params','model','DashboardItem','rawAttributes','query','filters','fields','attributes','includeAll','merge','find','catch','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','body','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit'];(function(_0x38ae7f,_0x720574){var _0x484569=function(_0x156c5f){while(--_0x156c5f){_0x38ae7f['push'](_0x38ae7f['shift']());}};_0x484569(++_0x720574);}(_0xa07c,0xf6));var _0xca07=function(_0x601052,_0x574cc7){_0x601052=_0x601052-0x0;var _0x427520=_0xa07c[_0x601052];return _0x427520;};'use strict';var emlformat=require(_0xca07('0x0'));var rimraf=require(_0xca07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca07('0x2'));var moment=require(_0xca07('0x3'));var BPromise=require(_0xca07('0x4'));var Mustache=require('mustache');var util=require(_0xca07('0x5'));var path=require('path');var sox=require(_0xca07('0x6'));var csv=require(_0xca07('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca07('0x8'));var _=require(_0xca07('0x9'));var squel=require(_0xca07('0xa'));var crypto=require(_0xca07('0xb'));var jsforce=require(_0xca07('0xc'));var deskjs=require(_0xca07('0xd'));var toCsv=require('to-csv');var querystring=require(_0xca07('0xe'));var Papa=require(_0xca07('0xf'));var Redis=require(_0xca07('0x10'));var authService=require(_0xca07('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xca07('0x12'));var hardwareService=require(_0xca07('0x13'));var logger=require(_0xca07('0x14'))(_0xca07('0x15'));var utils=require(_0xca07('0x16'));var config=require(_0xca07('0x17'));var licenseUtil=require(_0xca07('0x18'));var db=require('../../mysqldb')['db'];config[_0xca07('0x19')]=_[_0xca07('0x1a')](config[_0xca07('0x19')],{'host':_0xca07('0x1b'),'port':0x18eb});var socket=require(_0xca07('0x1c'))(new Redis(config[_0xca07('0x19')]));require('./dashboardItem.socket')[_0xca07('0x1d')](socket);function respondWithStatusCode(_0x5ec730,_0x26c393){_0x26c393=_0x26c393||0xcc;return function(_0x4e4810){if(_0x4e4810){return _0x5ec730[_0xca07('0x1e')](_0x26c393);}return _0x5ec730[_0xca07('0x1f')](_0x26c393)[_0xca07('0x20')]();};}function respondWithResult(_0x43e32d,_0x3247d1){_0x3247d1=_0x3247d1||0xc8;return function(_0x1064b4){if(_0x1064b4){return _0x43e32d[_0xca07('0x1f')](_0x3247d1)[_0xca07('0x21')](_0x1064b4);}};}function respondWithFilteredResult(_0x1b65e0,_0x3b0c2){return function(_0x11a6f0){if(_0x11a6f0){var _0x8b2766=typeof _0x3b0c2[_0xca07('0x22')]==='undefined'&&typeof _0x3b0c2[_0xca07('0x23')]===_0xca07('0x24');var _0x21c135=_0x11a6f0[_0xca07('0x25')];var _0x47e372=_0x8b2766?0x0:_0x3b0c2[_0xca07('0x22')];var _0x199ae7=_0x8b2766?_0x11a6f0[_0xca07('0x25')]:_0x3b0c2[_0xca07('0x22')]+_0x3b0c2[_0xca07('0x23')];var _0x32379f;if(_0x199ae7>=_0x21c135){_0x199ae7=_0x21c135;_0x32379f=0xc8;}else{_0x32379f=0xce;}_0x1b65e0[_0xca07('0x1f')](_0x32379f);return _0x1b65e0[_0xca07('0x26')](_0xca07('0x27'),_0x47e372+'-'+_0x199ae7+'/'+_0x21c135)[_0xca07('0x21')](_0x11a6f0);}return null;};}function patchUpdates(_0x10b4de){return function(_0x2dfd0f){try{jsonpatch[_0xca07('0x28')](_0x2dfd0f,_0x10b4de,!![]);}catch(_0x1bb067){return BPromise[_0xca07('0x29')](_0x1bb067);}return _0x2dfd0f[_0xca07('0x2a')]();};}function saveUpdates(_0x2de9ee,_0x35228c){return function(_0x4d2708){if(_0x4d2708){return _0x4d2708[_0xca07('0x2b')](_0x2de9ee)[_0xca07('0x2c')](function(_0x4fde7d){return _0x4fde7d;});}return null;};}function removeEntity(_0x12fbbe,_0x35ee03){return function(_0x4a3198){if(_0x4a3198){return _0x4a3198[_0xca07('0x2d')]()[_0xca07('0x2c')](function(){_0x12fbbe[_0xca07('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a596c,_0x21ec27){return function(_0x39737e){if(!_0x39737e){_0x5a596c[_0xca07('0x1e')](0x194);}return _0x39737e;};}function handleError(_0x47ee9f,_0x5c94fb){_0x5c94fb=_0x5c94fb||0x1f4;return function(_0x520548){logger[_0xca07('0x2e')](_0x520548[_0xca07('0x2f')]);if(_0x520548[_0xca07('0x30')]){delete _0x520548[_0xca07('0x30')];}_0x47ee9f[_0xca07('0x1f')](_0x5c94fb)['send'](_0x520548);};}function getMustacheRender(_0x4adfb9,_0x516107){return Mustache['render'](_0x4adfb9,_['merge'](_0x516107['body'],{'contact':_0x516107[_0xca07('0x31')],'message':_0x516107[_0xca07('0x32')],'agent':_0x516107[_0xca07('0x33')],'interaction':_0x516107[_0xca07('0x34')],'account':_0x516107['account']}))||'';}exports['show']=function(_0x364d65,_0x414961){var _0x5d1fd3={'raw':![],'where':{'id':_0x364d65[_0xca07('0x35')]['id']}},_0x3fc278={};_0x3fc278[_0xca07('0x36')]=_['keys'](db[_0xca07('0x37')][_0xca07('0x38')]);_0x3fc278['query']=_['keys'](_0x364d65[_0xca07('0x39')]);_0x3fc278[_0xca07('0x3a')]=_['intersection'](_0x3fc278[_0xca07('0x36')],_0x3fc278['query']);_0x5d1fd3['attributes']=_['intersection'](_0x3fc278[_0xca07('0x36')],qs[_0xca07('0x3b')](_0x364d65[_0xca07('0x39')][_0xca07('0x3b')]));_0x5d1fd3['attributes']=_0x5d1fd3[_0xca07('0x3c')]['length']?_0x5d1fd3['attributes']:_0x3fc278[_0xca07('0x36')];if(_0x364d65['query'][_0xca07('0x3d')]){_0x5d1fd3['include']=[{'all':!![]}];}_0x5d1fd3=_[_0xca07('0x3e')]({},_0x5d1fd3,_0x364d65['options']);return db[_0xca07('0x37')][_0xca07('0x3f')](_0x5d1fd3)['then'](handleEntityNotFound(_0x414961,null))['then'](respondWithResult(_0x414961,null))[_0xca07('0x40')](handleError(_0x414961,null));};exports[_0xca07('0x2d')]=function(_0x477b0e,_0x376017){return db[_0xca07('0x37')][_0xca07('0x3f')]({'where':{'id':_0x477b0e[_0xca07('0x35')]['id']}})['then'](handleEntityNotFound(_0x376017,null))[_0xca07('0x2c')](removeEntity(_0x376017,null))[_0xca07('0x40')](handleError(_0x376017,null));};function widgetAttributes(_0x284f93){try{switch(_0x284f93['type']){case _0xca07('0x41'):return[{'name':_0xca07('0x42'),'value':_0x284f93['attrUrl']||(_0x284f93[_0xca07('0x43')]&&_0x284f93['attrs'][0x0]?_0x284f93[_0xca07('0x43')][0x0][_0xca07('0x44')]:undefined)||'https://'}];case _0xca07('0x45'):return[{'name':_0xca07('0x46'),'value':_0x284f93[_0xca07('0x46')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93[_0xca07('0x43')][0x0]?_0x284f93[_0xca07('0x43')][0x0][_0xca07('0x44')]:undefined)||''}];case _0xca07('0x47'):return[{'name':_0xca07('0x48'),'value':_0x284f93[_0xca07('0x48')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93[_0xca07('0x43')][0x0]?_0x284f93[_0xca07('0x43')][0x0]['value']:undefined)||_0xca07('0x49')},{'name':_0xca07('0x4a'),'value':_0x284f93[_0xca07('0x4a')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93[_0xca07('0x43')][0x1]?_0x284f93[_0xca07('0x43')][0x1]['value']:undefined)||_0xca07('0x4b')},{'name':_0xca07('0x4c'),'value':_0x284f93[_0xca07('0x4c')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93[_0xca07('0x43')][0x2]?_0x284f93[_0xca07('0x43')][0x2][_0xca07('0x44')]:undefined)||0xc}];case _0xca07('0x4d'):return[{'name':_0xca07('0x4e'),'value':_0x284f93[_0xca07('0x4e')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93[_0xca07('0x43')][0x0]?_0x284f93[_0xca07('0x43')][0x0]['value']:undefined)||_0xca07('0x4f')},{'name':_0xca07('0x50'),'value':_0x284f93[_0xca07('0x50')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93[_0xca07('0x43')][0x1]?_0x284f93[_0xca07('0x43')][0x1][_0xca07('0x44')]:undefined)||[]},{'name':'attrFontSize','value':_0x284f93[_0xca07('0x4c')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93['attrs'][0x2]?_0x284f93[_0xca07('0x43')][0x2][_0xca07('0x44')]:undefined)||0x14}];case _0xca07('0x51'):case _0xca07('0x52'):return[{'name':'attrSerie1','value':_0x284f93[_0xca07('0x53')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93['attrs'][0x0]?_0x284f93[_0xca07('0x43')][0x0][_0xca07('0x44')]:undefined)||'total'},{'name':'attrSerie2','value':_0x284f93[_0xca07('0x54')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93['attrs'][0x1]?_0x284f93[_0xca07('0x43')][0x1][_0xca07('0x44')]:undefined)||null},{'name':_0xca07('0x55'),'value':_0x284f93['attrSerie3']||(_0x284f93[_0xca07('0x43')]&&_0x284f93[_0xca07('0x43')][0x2]?_0x284f93[_0xca07('0x43')][0x2][_0xca07('0x44')]:undefined)||null},{'name':_0xca07('0x50'),'value':_0x284f93['attrVoiceQueues']||(_0x284f93['attrs']&&_0x284f93[_0xca07('0x43')][0x3]?_0x284f93[_0xca07('0x43')][0x3][_0xca07('0x44')]:undefined)||[]}];case _0xca07('0x56'):return[{'name':_0xca07('0x57'),'type':_0x284f93[_0xca07('0x58')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93[_0xca07('0x43')][0x0]?_0x284f93[_0xca07('0x43')][0x0][_0xca07('0x59')]:undefined)||null,'value':_0x284f93[_0xca07('0x57')]||(_0x284f93['attrs']&&_0x284f93['attrs'][0x0]?_0x284f93[_0xca07('0x43')][0x0][_0xca07('0x44')]:undefined)||null},{'name':_0xca07('0x5a'),'value':_0x284f93[_0xca07('0x5a')]||(_0x284f93[_0xca07('0x43')]&&_0x284f93[_0xca07('0x43')][0x1]?_0x284f93[_0xca07('0x43')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x29406a){logger[_0xca07('0x2e')](_0xca07('0x5b'),JSON[_0xca07('0x5c')](_0x29406a));return[];}}exports['create']=function(_0x2c9936,_0x10c296){if(_0x2c9936[_0xca07('0x5d')]){_0x2c9936['body']['attrs']=widgetAttributes(_0x2c9936[_0xca07('0x5d')]);}return db['DashboardItem']['create'](_0x2c9936['body'],{})['then'](respondWithResult(_0x10c296,0xc9))[_0xca07('0x40')](handleError(_0x10c296,null));};exports[_0xca07('0x2b')]=function(_0x5ead78,_0xd062b){if(_0x5ead78[_0xca07('0x5d')]['id']){delete _0x5ead78[_0xca07('0x5d')]['id'];}_0x5ead78[_0xca07('0x5d')][_0xca07('0x43')]=widgetAttributes(_0x5ead78[_0xca07('0x5d')]);return db['DashboardItem'][_0xca07('0x3f')]({'where':{'id':_0x5ead78[_0xca07('0x35')]['id']}})[_0xca07('0x2c')](handleEntityNotFound(_0xd062b,null))['then'](saveUpdates(_0x5ead78[_0xca07('0x5d')],null))['then'](respondWithResult(_0xd062b,null))[_0xca07('0x40')](handleError(_0xd062b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 4f04a40..516afb7 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 _0x17d0=['emit','hasOwnProperty','hook','exports','DashboardItem','save','remove'];(function(_0x2f4cb8,_0x5143b0){var _0x54b39a=function(_0x9f49cc){while(--_0x9f49cc){_0x2f4cb8['push'](_0x2f4cb8['shift']());}};_0x54b39a(++_0x5143b0);}(_0x17d0,0x1a8));var _0x017d=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x17d0[_0x23ec06];return _0x2831d4;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x017d('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x017d('0x1'),'afterUpdate':'update','afterDestroy':_0x017d('0x2')};function emitEvent(_0x496599){return function(_0x373824,_0x183de6,_0x8e4538){DashboardItemEvents[_0x017d('0x3')](_0x496599+':'+_0x373824['id'],_0x373824);DashboardItemEvents['emit'](_0x496599,_0x373824);_0x8e4538(null);};}for(var e in events){if(events[_0x017d('0x4')](e)){var event=events[e];DashboardItem[_0x017d('0x5')](e,emitEvent(event));}}module[_0x017d('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xf941=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','DashboardItem'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf941,0x135));var _0x1f94=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf941[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require(_0x1f94('0x0'));var DashboardItem=require(_0x1f94('0x1'))['db'][_0x1f94('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f94('0x3'),'afterUpdate':_0x1f94('0x4'),'afterDestroy':_0x1f94('0x5')};function emitEvent(_0x18782d){return function(_0x25aa14,_0x150d77,_0x45f0e9){DashboardItemEvents[_0x1f94('0x6')](_0x18782d+':'+_0x25aa14['id'],_0x25aa14);DashboardItemEvents[_0x1f94('0x6')](_0x18782d,_0x25aa14);_0x45f0e9(null);};}for(var e in events){if(events[_0x1f94('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index b72f46c..e1dc31a 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 _0x5564=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x1559e2,_0x31b4d5){var _0x125c20=function(_0x4f6eed){while(--_0x4f6eed){_0x1559e2['push'](_0x1559e2['shift']());}};_0x125c20(++_0x31b4d5);}(_0x5564,0x92));var _0x4556=function(_0x1f9a30,_0x1faf8b){_0x1f9a30=_0x1f9a30-0x0;var _0x13598c=_0x5564[_0x1f9a30];return _0x13598c;};'use strict';var _=require(_0x4556('0x0'));var util=require(_0x4556('0x1'));var logger=require(_0x4556('0x2'))(_0x4556('0x3'));var moment=require('moment');var BPromise=require(_0x4556('0x4'));var rp=require(_0x4556('0x5'));var fs=require('fs');var path=require(_0x4556('0x6'));var rimraf=require(_0x4556('0x7'));var config=require(_0x4556('0x8'));var attributes=require(_0x4556('0x9'));module['exports']=function(_0xa88bc7,_0x13be15){return _0xa88bc7[_0x4556('0xa')](_0x4556('0xb'),attributes,{'tableName':_0x4556('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4943=['define','DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x4943,0xfa));var _0x3494=function(_0x26395f,_0x5e1068){_0x26395f=_0x26395f-0x0;var _0x153ad1=_0x4943[_0x26395f];return _0x153ad1;};'use strict';var _=require(_0x3494('0x0'));var util=require('util');var logger=require(_0x3494('0x1'))(_0x3494('0x2'));var moment=require(_0x3494('0x3'));var BPromise=require('bluebird');var rp=require(_0x3494('0x4'));var fs=require('fs');var path=require(_0x3494('0x5'));var rimraf=require(_0x3494('0x6'));var config=require(_0x3494('0x7'));var attributes=require(_0x3494('0x8'));module[_0x3494('0x9')]=function(_0x557714,_0x487d4d){return _0x557714[_0x3494('0xa')](_0x3494('0xb'),attributes,{'tableName':_0x3494('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index d177832..d3b28de 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 _0xd7f6=['../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x459238,_0x4f7a1e){var _0x3a96d1=function(_0x247c58){while(--_0x247c58){_0x459238['push'](_0x459238['shift']());}};_0x3a96d1(++_0x4f7a1e);}(_0xd7f6,0x1af));var _0x6d7f=function(_0x2bc82d,_0x293fcf){_0x2bc82d=_0x2bc82d-0x0;var _0x154c91=_0xd7f6[_0x2bc82d];return _0x154c91;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d7f('0x0'));var BPromise=require('bluebird');var rs=require(_0x6d7f('0x1'));var fs=require('fs');var Redis=require(_0x6d7f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d7f('0x3'));var logger=require(_0x6d7f('0x4'))(_0x6d7f('0x5'));var config=require(_0x6d7f('0x6'));var jayson=require(_0x6d7f('0x7'));var client=jayson[_0x6d7f('0x8')][_0x6d7f('0x9')]({'port':0x232a});config[_0x6d7f('0xa')]=_['defaults'](config[_0x6d7f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d7f('0xb'))(new Redis(config[_0x6d7f('0xa')]));require('./dashboardItem.socket')[_0x6d7f('0xc')](socket);function respondWithRpcPromise(_0x397ed2,_0x2bdac3,_0x4b25e7){return new BPromise(function(_0x1e57c8,_0x414248){return client[_0x6d7f('0xd')](_0x397ed2,_0x4b25e7)['then'](function(_0x39cd4c){logger[_0x6d7f('0xe')](_0x6d7f('0xf'),_0x2bdac3,_0x6d7f('0x10'));logger['debug'](_0x6d7f('0x11'),_0x2bdac3,'request\x20sent',JSON[_0x6d7f('0x12')](_0x39cd4c));if(_0x39cd4c[_0x6d7f('0x13')]){if(_0x39cd4c[_0x6d7f('0x13')][_0x6d7f('0x14')]===0x1f4){logger[_0x6d7f('0x13')](_0x6d7f('0xf'),_0x2bdac3,_0x39cd4c['error']['message']);return _0x414248(_0x39cd4c[_0x6d7f('0x13')][_0x6d7f('0x15')]);}logger[_0x6d7f('0x13')](_0x6d7f('0xf'),_0x2bdac3,_0x39cd4c[_0x6d7f('0x13')]['message']);return _0x1e57c8(_0x39cd4c['error'][_0x6d7f('0x15')]);}else{logger[_0x6d7f('0xe')](_0x6d7f('0xf'),_0x2bdac3,'request\x20sent');_0x1e57c8(_0x39cd4c[_0x6d7f('0x16')]['message']);}})['catch'](function(_0x550658){logger['error'](_0x6d7f('0xf'),_0x2bdac3,_0x550658);_0x414248(_0x550658);});});} \ No newline at end of file +var _0x6e61=['http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x48e09b,_0x58fce0){var _0x36fa34=function(_0x367322){while(--_0x367322){_0x48e09b['push'](_0x48e09b['shift']());}};_0x36fa34(++_0x58fce0);}(_0x6e61,0x1f2));var _0x16e6=function(_0x6b6893,_0x5b502d){_0x6b6893=_0x6b6893-0x0;var _0x1e45c9=_0x6e61[_0x6b6893];return _0x1e45c9;};'use strict';var _=require(_0x16e6('0x0'));var util=require(_0x16e6('0x1'));var moment=require(_0x16e6('0x2'));var BPromise=require(_0x16e6('0x3'));var rs=require(_0x16e6('0x4'));var fs=require('fs');var Redis=require(_0x16e6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x16e6('0x6'));var logger=require(_0x16e6('0x7'))(_0x16e6('0x8'));var config=require(_0x16e6('0x9'));var jayson=require(_0x16e6('0xa'));var client=jayson[_0x16e6('0xb')][_0x16e6('0xc')]({'port':0x232a});config['redis']=_[_0x16e6('0xd')](config[_0x16e6('0xe')],{'host':_0x16e6('0xf'),'port':0x18eb});var socket=require(_0x16e6('0x10'))(new Redis(config[_0x16e6('0xe')]));require(_0x16e6('0x11'))[_0x16e6('0x12')](socket);function respondWithRpcPromise(_0x49ab81,_0x1b4ad8,_0x4e31c2){return new BPromise(function(_0x22ab10,_0x1341e0){return client[_0x16e6('0x13')](_0x49ab81,_0x4e31c2)['then'](function(_0x1a2de4){logger[_0x16e6('0x14')](_0x16e6('0x15'),_0x1b4ad8,'request\x20sent');logger[_0x16e6('0x16')](_0x16e6('0x17'),_0x1b4ad8,'request\x20sent',JSON[_0x16e6('0x18')](_0x1a2de4));if(_0x1a2de4[_0x16e6('0x19')]){if(_0x1a2de4['error'][_0x16e6('0x1a')]===0x1f4){logger[_0x16e6('0x19')](_0x16e6('0x15'),_0x1b4ad8,_0x1a2de4[_0x16e6('0x19')][_0x16e6('0x1b')]);return _0x1341e0(_0x1a2de4[_0x16e6('0x19')][_0x16e6('0x1b')]);}logger[_0x16e6('0x19')](_0x16e6('0x15'),_0x1b4ad8,_0x1a2de4['error'][_0x16e6('0x1b')]);return _0x22ab10(_0x1a2de4[_0x16e6('0x19')]['message']);}else{logger[_0x16e6('0x14')](_0x16e6('0x15'),_0x1b4ad8,_0x16e6('0x1c'));_0x22ab10(_0x1a2de4['result'][_0x16e6('0x1b')]);}})[_0x16e6('0x1d')](function(_0x593c9d){logger[_0x16e6('0x19')](_0x16e6('0x15'),_0x1b4ad8,_0x593c9d);_0x1341e0(_0x593c9d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b6b6557..26701d7 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 _0x5e39=['length','dashboardItem:','./dashboardItem.events','save','remove','update','removeListener'];(function(_0x18dd12,_0x2696c2){var _0x2ace46=function(_0x3cb33f){while(--_0x3cb33f){_0x18dd12['push'](_0x18dd12['shift']());}};_0x2ace46(++_0x2696c2);}(_0x5e39,0x1d0));var _0x95e3=function(_0x170f06,_0x45f2c9){_0x170f06=_0x170f06-0x0;var _0x22c873=_0x5e39[_0x170f06];return _0x22c873;};'use strict';var DashboardItemEvents=require(_0x95e3('0x0'));var events=[_0x95e3('0x1'),_0x95e3('0x2'),_0x95e3('0x3')];function createListener(_0x2d1d2d,_0x4f90c1){return function(_0x2c2186){_0x4f90c1['emit'](_0x2d1d2d,_0x2c2186);};}function removeListener(_0x53eff8,_0x4c521a){return function(){DashboardItemEvents[_0x95e3('0x4')](_0x53eff8,_0x4c521a);};}exports['register']=function(_0x30dfb1){for(var _0x5c6530=0x0,_0x41d665=events[_0x95e3('0x5')];_0x5c6530<_0x41d665;_0x5c6530++){var _0x12b091=events[_0x5c6530];var _0x482202=createListener(_0x95e3('0x6')+_0x12b091,_0x30dfb1);DashboardItemEvents['on'](_0x12b091,_0x482202);}}; \ No newline at end of file +var _0xe625=['save','update','emit','removeListener','length','./dashboardItem.events'];(function(_0x5aaf54,_0x116458){var _0xfad324=function(_0x4392e0){while(--_0x4392e0){_0x5aaf54['push'](_0x5aaf54['shift']());}};_0xfad324(++_0x116458);}(_0xe625,0x191));var _0x5e62=function(_0x1184e4,_0x27492e){_0x1184e4=_0x1184e4-0x0;var _0x55f2d0=_0xe625[_0x1184e4];return _0x55f2d0;};'use strict';var DashboardItemEvents=require(_0x5e62('0x0'));var events=[_0x5e62('0x1'),'remove',_0x5e62('0x2')];function createListener(_0x3026f5,_0x3ec15d){return function(_0x19ab63){_0x3ec15d[_0x5e62('0x3')](_0x3026f5,_0x19ab63);};}function removeListener(_0x13f959,_0x2cce77){return function(){DashboardItemEvents[_0x5e62('0x4')](_0x13f959,_0x2cce77);};}exports['register']=function(_0x3aa57e){for(var _0x204480=0x0,_0x3d2b72=events[_0x5e62('0x5')];_0x204480<_0x3d2b72;_0x204480++){var _0x5e1afc=events[_0x204480];var _0x2e9f7a=createListener('dashboardItem:'+_0x5e1afc,_0x3aa57e);DashboardItemEvents['on'](_0x5e1afc,_0x2e9f7a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 3e11415..c6c1c33 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 _0x22f9=['update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0x567daa,_0x4e9ab1){var _0x1186ef=function(_0x4029ff){while(--_0x4029ff){_0x567daa['push'](_0x567daa['shift']());}};_0x1186ef(++_0x4e9ab1);}(_0x22f9,0x16b));var _0x922f=function(_0x507303,_0x5bba97){_0x507303=_0x507303-0x0;var _0x57c49b=_0x22f9[_0x507303];return _0x57c49b;};'use strict';var multer=require(_0x922f('0x0'));var util=require('util');var path=require(_0x922f('0x1'));var timeout=require(_0x922f('0x2'));var express=require(_0x922f('0x3'));var router=express[_0x922f('0x4')]();var fs_extra=require(_0x922f('0x5'));var auth=require(_0x922f('0x6'));var interaction=require(_0x922f('0x7'));var config=require(_0x922f('0x8'));var controller=require(_0x922f('0x9'));router[_0x922f('0xa')](_0x922f('0xb'),auth[_0x922f('0xc')](),controller[_0x922f('0xd')]);router[_0x922f('0xe')]('/',auth[_0x922f('0xc')](),controller['create']);router['put'](_0x922f('0xb'),auth[_0x922f('0xc')](),controller[_0x922f('0xf')]);router[_0x922f('0x10')](_0x922f('0xb'),auth[_0x922f('0xc')](),controller[_0x922f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x916f=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','post','put','update','/:id','destroy','exports','multer','util'];(function(_0x451f72,_0x398108){var _0x5cad42=function(_0x2ad71e){while(--_0x2ad71e){_0x451f72['push'](_0x451f72['shift']());}};_0x5cad42(++_0x398108);}(_0x916f,0x10e));var _0xf916=function(_0x35a0cc,_0x530d6c){_0x35a0cc=_0x35a0cc-0x0;var _0x5dfda6=_0x916f[_0x35a0cc];return _0x5dfda6;};'use strict';var multer=require(_0xf916('0x0'));var util=require(_0xf916('0x1'));var path=require(_0xf916('0x2'));var timeout=require(_0xf916('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf916('0x4'));var auth=require(_0xf916('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf916('0x6'));var controller=require(_0xf916('0x7'));router[_0xf916('0x8')]('/:id',auth[_0xf916('0x9')](),controller['show']);router[_0xf916('0xa')]('/',auth[_0xf916('0x9')](),controller['create']);router[_0xf916('0xb')]('/:id',auth[_0xf916('0x9')](),controller[_0xf916('0xc')]);router['delete'](_0xf916('0xd'),auth[_0xf916('0x9')](),controller[_0xf916('0xe')]);module[_0xf916('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 7b6a177..9dcca3f 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 _0x527d=['STRING','sequelize'];(function(_0x5b95f7,_0xe5e90a){var _0x24db2f=function(_0x2a0a07){while(--_0x2a0a07){_0x5b95f7['push'](_0x5b95f7['shift']());}};_0x24db2f(++_0xe5e90a);}(_0x527d,0x7f));var _0xd527=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x527d[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require(_0xd527('0x0'));module['exports']={'name':{'type':Sequelize[_0xd527('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first','second','third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xd527('0x1')]}}; \ No newline at end of file +var _0xc0db=['STRING','exports','ENUM','first','second'];(function(_0xfcbac5,_0x29a7cb){var _0x5631dc=function(_0x68bea5){while(--_0x68bea5){_0xfcbac5['push'](_0xfcbac5['shift']());}};_0x5631dc(++_0x29a7cb);}(_0xc0db,0x1c8));var _0xbc0d=function(_0x104fe4,_0xc5d52e){_0x104fe4=_0x104fe4-0x0;var _0x5e916c=_0xc0db[_0x104fe4];return _0x5e916c;};'use strict';var Sequelize=require('sequelize');module[_0xbc0d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xbc0d('0x1')](_0xbc0d('0x2'),_0xbc0d('0x3'),'third'),'allowNull':![],'defaultValue':_0xbc0d('0x2')},'description':{'type':Sequelize[_0xbc0d('0x4')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 8a02396..0e81934 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 _0xb590=['bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','sendStatus','name','render','message','agent','interaction','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','Disposition','findAll','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','request-promise'];(function(_0x643369,_0x487db4){var _0x191f9f=function(_0x3b632b){while(--_0x3b632b){_0x643369['push'](_0x643369['shift']());}};_0x191f9f(++_0x487db4);}(_0xb590,0x1b5));var _0x0b59=function(_0x414812,_0x528523){_0x414812=_0x414812-0x0;var _0x3dcedd=_0xb590[_0x414812];return _0x3dcedd;};'use strict';var emlformat=require(_0x0b59('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b59('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b59('0x2'));var moment=require('moment');var BPromise=require(_0x0b59('0x3'));var Mustache=require(_0x0b59('0x4'));var util=require('util');var path=require(_0x0b59('0x5'));var sox=require('sox');var csv=require(_0x0b59('0x6'));var ejs=require(_0x0b59('0x7'));var fs=require('fs');var fs_extra=require(_0x0b59('0x8'));var _=require(_0x0b59('0x9'));var squel=require(_0x0b59('0xa'));var crypto=require(_0x0b59('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0b59('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0b59('0xd'));var Papa=require(_0x0b59('0xe'));var Redis=require(_0x0b59('0xf'));var authService=require(_0x0b59('0x10'));var qs=require(_0x0b59('0x11'));var as=require(_0x0b59('0x12'));var hardwareService=require(_0x0b59('0x13'));var logger=require(_0x0b59('0x14'))(_0x0b59('0x15'));var utils=require(_0x0b59('0x16'));var config=require(_0x0b59('0x17'));var licenseUtil=require(_0x0b59('0x18'));var db=require(_0x0b59('0x19'))['db'];function respondWithStatusCode(_0x33eef4,_0x1508b7){_0x1508b7=_0x1508b7||0xcc;return function(_0x2f4204){if(_0x2f4204){return _0x33eef4['sendStatus'](_0x1508b7);}return _0x33eef4['status'](_0x1508b7)[_0x0b59('0x1a')]();};}function respondWithResult(_0x58bf4a,_0x362347){_0x362347=_0x362347||0xc8;return function(_0x5d59e0){if(_0x5d59e0){return _0x58bf4a[_0x0b59('0x1b')](_0x362347)[_0x0b59('0x1c')](_0x5d59e0);}};}function respondWithFilteredResult(_0x175c1d,_0x30a23b){return function(_0x2b9a99){if(_0x2b9a99){var _0x31afb3=typeof _0x30a23b[_0x0b59('0x1d')]===_0x0b59('0x1e')&&typeof _0x30a23b[_0x0b59('0x1f')]===_0x0b59('0x1e');var _0x2bde0a=_0x2b9a99['count'];var _0x2a3fa0=_0x31afb3?0x0:_0x30a23b[_0x0b59('0x1d')];var _0x4d44d6=_0x31afb3?_0x2b9a99['count']:_0x30a23b[_0x0b59('0x1d')]+_0x30a23b[_0x0b59('0x1f')];var _0x1704fa;if(_0x4d44d6>=_0x2bde0a){_0x4d44d6=_0x2bde0a;_0x1704fa=0xc8;}else{_0x1704fa=0xce;}_0x175c1d[_0x0b59('0x1b')](_0x1704fa);return _0x175c1d[_0x0b59('0x20')](_0x0b59('0x21'),_0x2a3fa0+'-'+_0x4d44d6+'/'+_0x2bde0a)[_0x0b59('0x1c')](_0x2b9a99);}return null;};}function patchUpdates(_0x283634){return function(_0x5c46e8){try{jsonpatch[_0x0b59('0x22')](_0x5c46e8,_0x283634,!![]);}catch(_0x411a95){return BPromise[_0x0b59('0x23')](_0x411a95);}return _0x5c46e8[_0x0b59('0x24')]();};}function saveUpdates(_0x4a4510,_0x500fbc){return function(_0x51d267){if(_0x51d267){return _0x51d267['update'](_0x4a4510)[_0x0b59('0x25')](function(_0x5dacb5){return _0x5dacb5;});}return null;};}function removeEntity(_0x441ae1,_0xf8a733){return function(_0x59469d){if(_0x59469d){return _0x59469d[_0x0b59('0x26')]()[_0x0b59('0x25')](function(){var _0x4bc131=_0x59469d[_0x0b59('0x27')]({'plain':!![]});var _0x5312aa='Dispositions';return db['UserProfileResource'][_0x0b59('0x26')]({'where':{'type':_0x5312aa,'resourceId':_0x4bc131['id']}})[_0x0b59('0x25')](function(){return _0x59469d;});})['then'](function(){_0x441ae1[_0x0b59('0x1b')](0xcc)[_0x0b59('0x1a')]();});}};}function handleEntityNotFound(_0x38d090,_0x47765f){return function(_0x5e771d){if(!_0x5e771d){_0x38d090[_0x0b59('0x28')](0x194);}return _0x5e771d;};}function handleError(_0x2d56ea,_0x3268a8){_0x3268a8=_0x3268a8||0x1f4;return function(_0x5ee22d){logger['error'](_0x5ee22d['stack']);if(_0x5ee22d[_0x0b59('0x29')]){delete _0x5ee22d[_0x0b59('0x29')];}_0x2d56ea[_0x0b59('0x1b')](_0x3268a8)['send'](_0x5ee22d);};}function getMustacheRender(_0xaa1d2f,_0x4b504e){return Mustache[_0x0b59('0x2a')](_0xaa1d2f,_['merge'](_0x4b504e['body'],{'contact':_0x4b504e['contact'],'message':_0x4b504e[_0x0b59('0x2b')],'agent':_0x4b504e[_0x0b59('0x2c')],'interaction':_0x4b504e[_0x0b59('0x2d')],'account':_0x4b504e['account']}))||'';}exports[_0x0b59('0x2e')]=function(_0x327a33,_0x56bdd8){var _0x233cf6={},_0x542b94={},_0x12f72d={'count':0x0,'rows':[]};var _0x3e7595=_[_0x0b59('0x2f')](db['Disposition']['rawAttributes'],function(_0x50dcd){return{'name':_0x50dcd[_0x0b59('0x30')],'type':_0x50dcd[_0x0b59('0x31')][_0x0b59('0x32')]};});_0x542b94[_0x0b59('0x33')]=_['map'](_0x3e7595,'name');_0x542b94[_0x0b59('0x34')]=_[_0x0b59('0x35')](_0x327a33[_0x0b59('0x34')]);_0x542b94[_0x0b59('0x36')]=_[_0x0b59('0x37')](_0x542b94[_0x0b59('0x33')],_0x542b94['query']);_0x233cf6['attributes']=_[_0x0b59('0x37')](_0x542b94[_0x0b59('0x33')],qs[_0x0b59('0x38')](_0x327a33['query'][_0x0b59('0x38')]));_0x233cf6['attributes']=_0x233cf6[_0x0b59('0x39')][_0x0b59('0x3a')]?_0x233cf6[_0x0b59('0x39')]:_0x542b94[_0x0b59('0x33')];if(!_0x327a33['query'][_0x0b59('0x3b')](_0x0b59('0x3c'))){_0x233cf6[_0x0b59('0x1f')]=qs[_0x0b59('0x1f')](_0x327a33['query'][_0x0b59('0x1f')]);_0x233cf6[_0x0b59('0x1d')]=qs[_0x0b59('0x1d')](_0x327a33[_0x0b59('0x34')][_0x0b59('0x1d')]);}_0x233cf6[_0x0b59('0x3d')]=qs['sort'](_0x327a33[_0x0b59('0x34')][_0x0b59('0x3e')]);_0x233cf6[_0x0b59('0x3f')]=qs[_0x0b59('0x36')](_[_0x0b59('0x40')](_0x327a33[_0x0b59('0x34')],_0x542b94['filters']),_0x3e7595);if(_0x327a33['query'][_0x0b59('0x41')]){_0x233cf6[_0x0b59('0x3f')]=_['merge'](_0x233cf6[_0x0b59('0x3f')],{'$or':_[_0x0b59('0x2f')](_0x3e7595,function(_0x1f6e10){if(_0x1f6e10[_0x0b59('0x31')]!==_0x0b59('0x42')){var _0x2bcaaf={};_0x2bcaaf[_0x1f6e10['name']]={'$like':'%'+_0x327a33[_0x0b59('0x34')][_0x0b59('0x41')]+'%'};return _0x2bcaaf;}})});}_0x233cf6=_[_0x0b59('0x43')]({},_0x233cf6,_0x327a33[_0x0b59('0x44')]);var _0x1f712c={'where':_0x233cf6['where']};return db['Disposition'][_0x0b59('0x45')](_0x1f712c)[_0x0b59('0x25')](function(_0x2747fd){_0x12f72d['count']=_0x2747fd;if(_0x327a33['query']['includeAll']){_0x233cf6[_0x0b59('0x46')]=[{'all':!![]}];}return db[_0x0b59('0x47')][_0x0b59('0x48')](_0x233cf6);})[_0x0b59('0x25')](function(_0x3ac22a){_0x12f72d['rows']=_0x3ac22a;return _0x12f72d;})[_0x0b59('0x25')](respondWithFilteredResult(_0x56bdd8,_0x233cf6))['catch'](handleError(_0x56bdd8,null));};exports['show']=function(_0x58d73c,_0x517c44){var _0x184b5f={'raw':!![],'where':{'id':_0x58d73c['params']['id']}},_0x15acb8={};_0x15acb8['model']=_['keys'](db[_0x0b59('0x47')]['rawAttributes']);_0x15acb8[_0x0b59('0x34')]=_[_0x0b59('0x35')](_0x58d73c[_0x0b59('0x34')]);_0x15acb8[_0x0b59('0x36')]=_['intersection'](_0x15acb8[_0x0b59('0x33')],_0x15acb8['query']);_0x184b5f[_0x0b59('0x39')]=_[_0x0b59('0x37')](_0x15acb8['model'],qs['fields'](_0x58d73c[_0x0b59('0x34')][_0x0b59('0x38')]));_0x184b5f[_0x0b59('0x39')]=_0x184b5f[_0x0b59('0x39')][_0x0b59('0x3a')]?_0x184b5f[_0x0b59('0x39')]:_0x15acb8['model'];if(_0x58d73c[_0x0b59('0x34')][_0x0b59('0x49')]){_0x184b5f['include']=[{'all':!![]}];}_0x184b5f=_[_0x0b59('0x43')]({},_0x184b5f,_0x58d73c[_0x0b59('0x44')]);return db[_0x0b59('0x47')]['find'](_0x184b5f)[_0x0b59('0x25')](handleEntityNotFound(_0x517c44,null))['then'](respondWithResult(_0x517c44,null))[_0x0b59('0x4a')](handleError(_0x517c44,null));};exports[_0x0b59('0x4b')]=function(_0x4d4797,_0x55857d){return db[_0x0b59('0x47')][_0x0b59('0x4b')](_0x4d4797[_0x0b59('0x4c')],{})[_0x0b59('0x25')](function(_0xbacc22){var _0x1f8aa2=_0x4d4797[_0x0b59('0x4d')][_0x0b59('0x27')]({'plain':!![]});if(!_0x1f8aa2)throw new Error(_0x0b59('0x4e'));if(_0x1f8aa2[_0x0b59('0x4f')]===_0x0b59('0x4d')){var _0x4df153=_0xbacc22[_0x0b59('0x27')]({'plain':!![]});var _0x1ca98f='Dispositions';return db[_0x0b59('0x50')][_0x0b59('0x51')]({'where':{'name':_0x1ca98f,'userProfileId':_0x1f8aa2['userProfileId']},'raw':!![]})['then'](function(_0x562e29){if(_0x562e29&&_0x562e29[_0x0b59('0x52')]===0x0){return db[_0x0b59('0x53')][_0x0b59('0x4b')]({'name':_0x4df153[_0x0b59('0x29')],'resourceId':_0x4df153['id'],'type':_0x562e29['name'],'sectionId':_0x562e29['id']},{})[_0x0b59('0x25')](function(){return _0xbacc22;});}else{return _0xbacc22;}})[_0x0b59('0x4a')](function(_0x41f6bc){logger[_0x0b59('0x54')](_0x0b59('0x55'),_0x41f6bc);throw _0x41f6bc;});}return _0xbacc22;})[_0x0b59('0x25')](respondWithResult(_0x55857d,0xc9))[_0x0b59('0x4a')](handleError(_0x55857d,null));};exports[_0x0b59('0x56')]=function(_0x2bc37b,_0x4d4c26){if(_0x2bc37b['body']['id']){delete _0x2bc37b[_0x0b59('0x4c')]['id'];}return db['Disposition']['find']({'where':{'id':_0x2bc37b['params']['id']}})[_0x0b59('0x25')](handleEntityNotFound(_0x4d4c26,null))[_0x0b59('0x25')](saveUpdates(_0x2bc37b[_0x0b59('0x4c')],null))[_0x0b59('0x25')](respondWithResult(_0x4d4c26,null))[_0x0b59('0x4a')](handleError(_0x4d4c26,null));};exports[_0x0b59('0x26')]=function(_0x2f9262,_0x5a0cce){return db[_0x0b59('0x47')][_0x0b59('0x51')]({'where':{'id':_0x2f9262[_0x0b59('0x57')]['id']}})[_0x0b59('0x25')](handleEntityNotFound(_0x5a0cce,null))['then'](removeEntity(_0x5a0cce,null))[_0x0b59('0x4a')](handleError(_0x5a0cce,null));}; \ No newline at end of file +var _0x379a=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','error','stack','name','send','merge','contact','message','agent','interaction','account','index','map','Disposition','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','type','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x12d40b,_0x3366d3){var _0x4137f0=function(_0x3a24ca){while(--_0x3a24ca){_0x12d40b['push'](_0x12d40b['shift']());}};_0x4137f0(++_0x3366d3);}(_0x379a,0x167));var _0xa379=function(_0x2bf5bd,_0x120787){_0x2bf5bd=_0x2bf5bd-0x0;var _0xc810c0=_0x379a[_0x2bf5bd];return _0xc810c0;};'use strict';var emlformat=require(_0xa379('0x0'));var rimraf=require(_0xa379('0x1'));var zipdir=require(_0xa379('0x2'));var jsonpatch=require(_0xa379('0x3'));var rp=require(_0xa379('0x4'));var moment=require(_0xa379('0x5'));var BPromise=require(_0xa379('0x6'));var Mustache=require(_0xa379('0x7'));var util=require(_0xa379('0x8'));var path=require(_0xa379('0x9'));var sox=require(_0xa379('0xa'));var csv=require(_0xa379('0xb'));var ejs=require(_0xa379('0xc'));var fs=require('fs');var fs_extra=require(_0xa379('0xd'));var _=require(_0xa379('0xe'));var squel=require(_0xa379('0xf'));var crypto=require(_0xa379('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xa379('0x11'));var toCsv=require(_0xa379('0xb'));var querystring=require(_0xa379('0x12'));var Papa=require('papaparse');var Redis=require(_0xa379('0x13'));var authService=require(_0xa379('0x14'));var qs=require(_0xa379('0x15'));var as=require(_0xa379('0x16'));var hardwareService=require(_0xa379('0x17'));var logger=require('../../config/logger')(_0xa379('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa379('0x19'));var db=require(_0xa379('0x1a'))['db'];function respondWithStatusCode(_0xda74d3,_0x70927f){_0x70927f=_0x70927f||0xcc;return function(_0xec01d7){if(_0xec01d7){return _0xda74d3[_0xa379('0x1b')](_0x70927f);}return _0xda74d3['status'](_0x70927f)[_0xa379('0x1c')]();};}function respondWithResult(_0x1005d7,_0x1fa686){_0x1fa686=_0x1fa686||0xc8;return function(_0x5f0f85){if(_0x5f0f85){return _0x1005d7[_0xa379('0x1d')](_0x1fa686)[_0xa379('0x1e')](_0x5f0f85);}};}function respondWithFilteredResult(_0x5d531e,_0x3579a2){return function(_0x698fe3){if(_0x698fe3){var _0xd20e7b=typeof _0x3579a2['offset']===_0xa379('0x1f')&&typeof _0x3579a2['limit']===_0xa379('0x1f');var _0x5b975c=_0x698fe3[_0xa379('0x20')];var _0x5b3853=_0xd20e7b?0x0:_0x3579a2[_0xa379('0x21')];var _0x16b315=_0xd20e7b?_0x698fe3[_0xa379('0x20')]:_0x3579a2[_0xa379('0x21')]+_0x3579a2[_0xa379('0x22')];var _0x519b4d;if(_0x16b315>=_0x5b975c){_0x16b315=_0x5b975c;_0x519b4d=0xc8;}else{_0x519b4d=0xce;}_0x5d531e[_0xa379('0x1d')](_0x519b4d);return _0x5d531e[_0xa379('0x23')]('Content-Range',_0x5b3853+'-'+_0x16b315+'/'+_0x5b975c)[_0xa379('0x1e')](_0x698fe3);}return null;};}function patchUpdates(_0x5ead10){return function(_0x4eb2f5){try{jsonpatch[_0xa379('0x24')](_0x4eb2f5,_0x5ead10,!![]);}catch(_0x349d2e){return BPromise[_0xa379('0x25')](_0x349d2e);}return _0x4eb2f5[_0xa379('0x26')]();};}function saveUpdates(_0x42a380,_0x3259f0){return function(_0x58ba22){if(_0x58ba22){return _0x58ba22[_0xa379('0x27')](_0x42a380)['then'](function(_0xc8235f){return _0xc8235f;});}return null;};}function removeEntity(_0x38a497,_0x3a0028){return function(_0x21f4ea){if(_0x21f4ea){return _0x21f4ea[_0xa379('0x28')]()[_0xa379('0x29')](function(){var _0x477b87=_0x21f4ea[_0xa379('0x2a')]({'plain':!![]});var _0x11dafe=_0xa379('0x2b');return db[_0xa379('0x2c')][_0xa379('0x28')]({'where':{'type':_0x11dafe,'resourceId':_0x477b87['id']}})['then'](function(){return _0x21f4ea;});})[_0xa379('0x29')](function(){_0x38a497[_0xa379('0x1d')](0xcc)[_0xa379('0x1c')]();});}};}function handleEntityNotFound(_0x31a89e,_0x50c05b){return function(_0x527919){if(!_0x527919){_0x31a89e['sendStatus'](0x194);}return _0x527919;};}function handleError(_0x5e2478,_0x3a450a){_0x3a450a=_0x3a450a||0x1f4;return function(_0x4a154d){logger[_0xa379('0x2d')](_0x4a154d[_0xa379('0x2e')]);if(_0x4a154d[_0xa379('0x2f')]){delete _0x4a154d[_0xa379('0x2f')];}_0x5e2478['status'](_0x3a450a)[_0xa379('0x30')](_0x4a154d);};}function getMustacheRender(_0x3d9cb9,_0x4cad78){return Mustache['render'](_0x3d9cb9,_[_0xa379('0x31')](_0x4cad78['body'],{'contact':_0x4cad78[_0xa379('0x32')],'message':_0x4cad78[_0xa379('0x33')],'agent':_0x4cad78[_0xa379('0x34')],'interaction':_0x4cad78[_0xa379('0x35')],'account':_0x4cad78[_0xa379('0x36')]}))||'';}exports[_0xa379('0x37')]=function(_0x241586,_0x5dd37a){var _0x40b239={},_0x130b2f={},_0x329a5a={'count':0x0,'rows':[]};var _0x4488c=_[_0xa379('0x38')](db[_0xa379('0x39')]['rawAttributes'],function(_0x19e23c){return{'name':_0x19e23c['fieldName'],'type':_0x19e23c['type'][_0xa379('0x3a')]};});_0x130b2f[_0xa379('0x3b')]=_[_0xa379('0x38')](_0x4488c,_0xa379('0x2f'));_0x130b2f['query']=_[_0xa379('0x3c')](_0x241586[_0xa379('0x3d')]);_0x130b2f[_0xa379('0x3e')]=_[_0xa379('0x3f')](_0x130b2f[_0xa379('0x3b')],_0x130b2f[_0xa379('0x3d')]);_0x40b239[_0xa379('0x40')]=_[_0xa379('0x3f')](_0x130b2f[_0xa379('0x3b')],qs[_0xa379('0x41')](_0x241586[_0xa379('0x3d')][_0xa379('0x41')]));_0x40b239[_0xa379('0x40')]=_0x40b239[_0xa379('0x40')][_0xa379('0x42')]?_0x40b239['attributes']:_0x130b2f[_0xa379('0x3b')];if(!_0x241586['query'][_0xa379('0x43')](_0xa379('0x44'))){_0x40b239[_0xa379('0x22')]=qs['limit'](_0x241586['query'][_0xa379('0x22')]);_0x40b239['offset']=qs[_0xa379('0x21')](_0x241586[_0xa379('0x3d')]['offset']);}_0x40b239[_0xa379('0x45')]=qs['sort'](_0x241586[_0xa379('0x3d')]['sort']);_0x40b239[_0xa379('0x46')]=qs[_0xa379('0x3e')](_[_0xa379('0x47')](_0x241586['query'],_0x130b2f[_0xa379('0x3e')]),_0x4488c);if(_0x241586[_0xa379('0x3d')]['filter']){_0x40b239[_0xa379('0x46')]=_[_0xa379('0x31')](_0x40b239[_0xa379('0x46')],{'$or':_[_0xa379('0x38')](_0x4488c,function(_0x11c3da){if(_0x11c3da[_0xa379('0x48')]!==_0xa379('0x49')){var _0x147118={};_0x147118[_0x11c3da[_0xa379('0x2f')]]={'$like':'%'+_0x241586[_0xa379('0x3d')][_0xa379('0x4a')]+'%'};return _0x147118;}})});}_0x40b239=_[_0xa379('0x31')]({},_0x40b239,_0x241586[_0xa379('0x4b')]);var _0x3a60f8={'where':_0x40b239[_0xa379('0x46')]};return db[_0xa379('0x39')][_0xa379('0x20')](_0x3a60f8)[_0xa379('0x29')](function(_0x5cd7f8){_0x329a5a[_0xa379('0x20')]=_0x5cd7f8;if(_0x241586[_0xa379('0x3d')][_0xa379('0x4c')]){_0x40b239['include']=[{'all':!![]}];}return db[_0xa379('0x39')][_0xa379('0x4d')](_0x40b239);})[_0xa379('0x29')](function(_0x412792){_0x329a5a['rows']=_0x412792;return _0x329a5a;})[_0xa379('0x29')](respondWithFilteredResult(_0x5dd37a,_0x40b239))[_0xa379('0x4e')](handleError(_0x5dd37a,null));};exports[_0xa379('0x4f')]=function(_0x5ebb4b,_0x4b310d){var _0x51f3d6={'raw':!![],'where':{'id':_0x5ebb4b[_0xa379('0x50')]['id']}},_0xc88043={};_0xc88043[_0xa379('0x3b')]=_[_0xa379('0x3c')](db[_0xa379('0x39')][_0xa379('0x51')]);_0xc88043[_0xa379('0x3d')]=_[_0xa379('0x3c')](_0x5ebb4b['query']);_0xc88043[_0xa379('0x3e')]=_['intersection'](_0xc88043[_0xa379('0x3b')],_0xc88043[_0xa379('0x3d')]);_0x51f3d6['attributes']=_[_0xa379('0x3f')](_0xc88043['model'],qs[_0xa379('0x41')](_0x5ebb4b[_0xa379('0x3d')]['fields']));_0x51f3d6[_0xa379('0x40')]=_0x51f3d6['attributes'][_0xa379('0x42')]?_0x51f3d6[_0xa379('0x40')]:_0xc88043[_0xa379('0x3b')];if(_0x5ebb4b[_0xa379('0x3d')]['includeAll']){_0x51f3d6[_0xa379('0x52')]=[{'all':!![]}];}_0x51f3d6=_[_0xa379('0x31')]({},_0x51f3d6,_0x5ebb4b[_0xa379('0x4b')]);return db[_0xa379('0x39')][_0xa379('0x53')](_0x51f3d6)['then'](handleEntityNotFound(_0x4b310d,null))[_0xa379('0x29')](respondWithResult(_0x4b310d,null))[_0xa379('0x4e')](handleError(_0x4b310d,null));};exports['create']=function(_0x35d949,_0x4327c4){return db['Disposition'][_0xa379('0x54')](_0x35d949[_0xa379('0x55')],{})[_0xa379('0x29')](function(_0x158e5c){var _0x4bb86b=_0x35d949[_0xa379('0x56')][_0xa379('0x2a')]({'plain':!![]});if(!_0x4bb86b)throw new Error(_0xa379('0x57'));if(_0x4bb86b[_0xa379('0x58')]===_0xa379('0x56')){var _0x2c0d66=_0x158e5c[_0xa379('0x2a')]({'plain':!![]});var _0x1b373e=_0xa379('0x2b');return db[_0xa379('0x59')][_0xa379('0x53')]({'where':{'name':_0x1b373e,'userProfileId':_0x4bb86b['userProfileId']},'raw':!![]})[_0xa379('0x29')](function(_0x53b8eb){if(_0x53b8eb&&_0x53b8eb[_0xa379('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x2c0d66['name'],'resourceId':_0x2c0d66['id'],'type':_0x53b8eb[_0xa379('0x2f')],'sectionId':_0x53b8eb['id']},{})[_0xa379('0x29')](function(){return _0x158e5c;});}else{return _0x158e5c;}})[_0xa379('0x4e')](function(_0x2f4dbb){logger[_0xa379('0x2d')](_0xa379('0x5b'),_0x2f4dbb);throw _0x2f4dbb;});}return _0x158e5c;})[_0xa379('0x29')](respondWithResult(_0x4327c4,0xc9))['catch'](handleError(_0x4327c4,null));};exports[_0xa379('0x27')]=function(_0x445085,_0x52fa5b){if(_0x445085['body']['id']){delete _0x445085['body']['id'];}return db[_0xa379('0x39')][_0xa379('0x53')]({'where':{'id':_0x445085['params']['id']}})[_0xa379('0x29')](handleEntityNotFound(_0x52fa5b,null))[_0xa379('0x29')](saveUpdates(_0x445085[_0xa379('0x55')],null))[_0xa379('0x29')](respondWithResult(_0x52fa5b,null))['catch'](handleError(_0x52fa5b,null));};exports[_0xa379('0x28')]=function(_0x4eb314,_0x5937a3){return db[_0xa379('0x39')][_0xa379('0x53')]({'where':{'id':_0x4eb314[_0xa379('0x50')]['id']}})['then'](handleEntityNotFound(_0x5937a3,null))[_0xa379('0x29')](removeEntity(_0x5937a3,null))[_0xa379('0x4e')](handleError(_0x5937a3,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 932c345..1c2c9f0 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 _0x6aa7=['name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId'];(function(_0x5bda3b,_0x41160f){var _0x431bb9=function(_0x160122){while(--_0x160122){_0x5bda3b['push'](_0x5bda3b['shift']());}};_0x431bb9(++_0x41160f);}(_0x6aa7,0x178));var _0x76aa=function(_0x4141a0,_0x4d25b4){_0x4141a0=_0x4141a0-0x0;var _0xe95c94=_0x6aa7[_0x4141a0];return _0xe95c94;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x76aa('0xb'),_0x76aa('0xc')]},{'unique':!![],'name':_0x76aa('0xd'),'fields':['name',_0x76aa('0xe')]},{'unique':!![],'name':_0x76aa('0xf'),'fields':[_0x76aa('0xb'),_0x76aa('0x10')]},{'unique':!![],'name':_0x76aa('0x11'),'fields':[_0x76aa('0xb'),_0x76aa('0x12')]},{'unique':!![],'name':_0x76aa('0x13'),'fields':[_0x76aa('0xb'),_0x76aa('0x14')]},{'unique':!![],'name':'name_openchannel','fields':[_0x76aa('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0x76aa('0x15'),'fields':[_0x76aa('0xb'),_0x76aa('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x960c=['rimraf','../../config/environment','define','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xf34f52,_0x1e0ae4){var _0x1eb840=function(_0x3d56ca){while(--_0x3d56ca){_0xf34f52['push'](_0xf34f52['shift']());}};_0x1eb840(++_0x1e0ae4);}(_0x960c,0x113));var _0xc960=function(_0x333fdc,_0x5c2e81){_0x333fdc=_0x333fdc-0x0;var _0x2d174e=_0x960c[_0x333fdc];return _0x2d174e;};'use strict';var _=require(_0xc960('0x0'));var util=require('util');var logger=require(_0xc960('0x1'))('api');var moment=require(_0xc960('0x2'));var BPromise=require(_0xc960('0x3'));var rp=require(_0xc960('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc960('0x5'));var config=require(_0xc960('0x6'));var attributes=require('./disposition.attributes');module['exports']=function(_0x2bb9df,_0x2beb88){return _0x2bb9df[_0xc960('0x7')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xc960('0x8'),'fields':[_0xc960('0x9'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xc960('0x9'),_0xc960('0xa')]},{'unique':!![],'name':_0xc960('0xb'),'fields':[_0xc960('0x9'),_0xc960('0xc')]},{'unique':!![],'name':'name_sms','fields':[_0xc960('0x9'),_0xc960('0xd')]},{'unique':!![],'name':_0xc960('0xe'),'fields':[_0xc960('0x9'),_0xc960('0xf')]},{'unique':!![],'name':_0xc960('0x10'),'fields':[_0xc960('0x9'),_0xc960('0x11')]},{'unique':!![],'name':_0xc960('0x12'),'fields':[_0xc960('0x9'),_0xc960('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 2473a78..f3e47ec 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 _0xaea6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaea6,0x134));var _0x6aea=function(_0x40c5e7,_0x299819){_0x40c5e7=_0x40c5e7-0x0;var _0x264dac=_0xaea6[_0x40c5e7];return _0x264dac;};'use strict';var _=require(_0x6aea('0x0'));var util=require(_0x6aea('0x1'));var moment=require(_0x6aea('0x2'));var BPromise=require(_0x6aea('0x3'));var rs=require(_0x6aea('0x4'));var fs=require('fs');var Redis=require(_0x6aea('0x5'));var db=require(_0x6aea('0x6'))['db'];var utils=require(_0x6aea('0x7'));var logger=require(_0x6aea('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6aea('0x9'));var client=jayson[_0x6aea('0xa')][_0x6aea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d4d77,_0x4ac7fe,_0x40237b){return new BPromise(function(_0x1384a,_0x53ab45){return client[_0x6aea('0xc')](_0x2d4d77,_0x40237b)[_0x6aea('0xd')](function(_0x2bc1d4){logger[_0x6aea('0xe')](_0x6aea('0xf'),_0x4ac7fe,'request\x20sent');logger[_0x6aea('0x10')](_0x6aea('0x11'),_0x4ac7fe,_0x6aea('0x12'),JSON[_0x6aea('0x13')](_0x2bc1d4));if(_0x2bc1d4[_0x6aea('0x14')]){if(_0x2bc1d4[_0x6aea('0x14')]['code']===0x1f4){logger[_0x6aea('0x14')](_0x6aea('0xf'),_0x4ac7fe,_0x2bc1d4[_0x6aea('0x14')][_0x6aea('0x15')]);return _0x53ab45(_0x2bc1d4[_0x6aea('0x14')]['message']);}logger['error'](_0x6aea('0xf'),_0x4ac7fe,_0x2bc1d4[_0x6aea('0x14')][_0x6aea('0x15')]);return _0x1384a(_0x2bc1d4[_0x6aea('0x14')]['message']);}else{logger['info'](_0x6aea('0xf'),_0x4ac7fe,'request\x20sent');_0x1384a(_0x2bc1d4[_0x6aea('0x16')][_0x6aea('0x15')]);}})[_0x6aea('0x17')](function(_0x308b75){logger[_0x6aea('0x14')](_0x6aea('0xf'),_0x4ac7fe,_0x308b75);_0x53ab45(_0x308b75);});});} \ No newline at end of file +var _0x347e=['code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x411b68,_0x52e768){var _0x41ff90=function(_0x2ab602){while(--_0x2ab602){_0x411b68['push'](_0x411b68['shift']());}};_0x41ff90(++_0x52e768);}(_0x347e,0xa5));var _0xe347=function(_0x2a6f78,_0x57aee6){_0x2a6f78=_0x2a6f78-0x0;var _0x37f15e=_0x347e[_0x2a6f78];return _0x37f15e;};'use strict';var _=require(_0xe347('0x0'));var util=require(_0xe347('0x1'));var moment=require(_0xe347('0x2'));var BPromise=require(_0xe347('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe347('0x4'));var db=require(_0xe347('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe347('0x6'))(_0xe347('0x7'));var config=require(_0xe347('0x8'));var jayson=require(_0xe347('0x9'));var client=jayson[_0xe347('0xa')][_0xe347('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cb12b,_0x5a244a,_0x560e49){return new BPromise(function(_0x3d7c3b,_0x273754){return client[_0xe347('0xc')](_0x3cb12b,_0x560e49)[_0xe347('0xd')](function(_0x945a5f){logger['info'](_0xe347('0xe'),_0x5a244a,'request\x20sent');logger[_0xe347('0xf')](_0xe347('0x10'),_0x5a244a,_0xe347('0x11'),JSON['stringify'](_0x945a5f));if(_0x945a5f['error']){if(_0x945a5f[_0xe347('0x12')][_0xe347('0x13')]===0x1f4){logger[_0xe347('0x12')]('Disposition,\x20%s,\x20%s',_0x5a244a,_0x945a5f[_0xe347('0x12')][_0xe347('0x14')]);return _0x273754(_0x945a5f[_0xe347('0x12')][_0xe347('0x14')]);}logger['error']('Disposition,\x20%s,\x20%s',_0x5a244a,_0x945a5f[_0xe347('0x12')][_0xe347('0x14')]);return _0x3d7c3b(_0x945a5f['error'][_0xe347('0x14')]);}else{logger[_0xe347('0x15')](_0xe347('0xe'),_0x5a244a,'request\x20sent');_0x3d7c3b(_0x945a5f[_0xe347('0x16')][_0xe347('0x14')]);}})['catch'](function(_0x519300){logger[_0xe347('0x12')](_0xe347('0xe'),_0x5a244a,_0x519300);_0x273754(_0x519300);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 2b9f671..b127e5f 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 _0x68f6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express'];(function(_0x155523,_0xe1c6da){var _0x3d72f6=function(_0x1f7555){while(--_0x1f7555){_0x155523['push'](_0x155523['shift']());}};_0x3d72f6(++_0xe1c6da);}(_0x68f6,0x178));var _0x668f=function(_0x5716e1,_0x236dd3){_0x5716e1=_0x5716e1-0x0;var _0x99dba1=_0x68f6[_0x5716e1];return _0x99dba1;};'use strict';var multer=require(_0x668f('0x0'));var util=require(_0x668f('0x1'));var path=require(_0x668f('0x2'));var timeout=require('connect-timeout');var express=require(_0x668f('0x3'));var router=express[_0x668f('0x4')]();var fs_extra=require(_0x668f('0x5'));var auth=require(_0x668f('0x6'));var interaction=require(_0x668f('0x7'));var config=require(_0x668f('0x8'));var controller=require('./disposition.controller');router['get']('/',auth[_0x668f('0x9')](),controller[_0x668f('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x668f('0xb')]);router[_0x668f('0xc')]('/',auth[_0x668f('0x9')](),controller[_0x668f('0xd')]);router[_0x668f('0xe')](_0x668f('0xf'),auth['isAuthenticated'](),controller[_0x668f('0x10')]);router[_0x668f('0x11')](_0x668f('0xf'),auth['isAuthenticated'](),controller[_0x668f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x674f=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','show','post','create','put','/:id','delete','destroy'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x674f,0x121));var _0xf674=function(_0x114f80,_0x1dcf76){_0x114f80=_0x114f80-0x0;var _0xbb6a57=_0x674f[_0x114f80];return _0xbb6a57;};'use strict';var multer=require(_0xf674('0x0'));var util=require('util');var path=require(_0xf674('0x1'));var timeout=require(_0xf674('0x2'));var express=require('express');var router=express[_0xf674('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf674('0x4'));var interaction=require(_0xf674('0x5'));var config=require(_0xf674('0x6'));var controller=require(_0xf674('0x7'));router[_0xf674('0x8')]('/',auth[_0xf674('0x9')](),controller['index']);router[_0xf674('0x8')]('/:id',auth[_0xf674('0x9')](),controller[_0xf674('0xa')]);router[_0xf674('0xb')]('/',auth[_0xf674('0x9')](),controller[_0xf674('0xc')]);router[_0xf674('0xd')](_0xf674('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xf674('0xf')]('/:id',auth[_0xf674('0x9')](),controller[_0xf674('0x10')]);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 aac7118..e836e0b 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 _0x2b18=['14400','4800','v17,v27,v29','INTEGER','IAX','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','7200','9600','12000'];(function(_0x1f5dae,_0x50ca0c){var _0x45dcba=function(_0x58d125){while(--_0x58d125){_0x1f5dae['push'](_0x1f5dae['shift']());}};_0x45dcba(++_0x50ca0c);}(_0x2b18,0x120));var _0x82b1=function(_0x13044f,_0x3eefe1){_0x13044f=_0x13044f-0x0;var _0x526d36=_0x2b18[_0x13044f];return _0x526d36;};'use strict';var Sequelize=require(_0x82b1('0x0'));module[_0x82b1('0x1')]={'name':{'type':Sequelize[_0x82b1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x82b1('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x82b1('0x3'),'no'),'defaultValue':_0x82b1('0x3')},'headerinfo':{'type':Sequelize[_0x82b1('0x2')],'defaultValue':_0x82b1('0x4')},'localstationid':{'type':Sequelize[_0x82b1('0x2')],'unique':_0x82b1('0x5')},'minrate':{'type':Sequelize[_0x82b1('0x6')](_0x82b1('0x7'),'4800',_0x82b1('0x8'),_0x82b1('0x9'),_0x82b1('0xa'),_0x82b1('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x82b1('0x6')]('2400',_0x82b1('0xc'),'7200',_0x82b1('0x9'),_0x82b1('0xa'),_0x82b1('0xb')),'defaultValue':_0x82b1('0xb')},'modem':{'type':Sequelize[_0x82b1('0x2')],'defaultValue':_0x82b1('0xd')},'gateway':{'type':Sequelize[_0x82b1('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[_0x82b1('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x82b1('0x6')]('SIP',_0x82b1('0xf'),'DADHI',_0x82b1('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x82b1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x82b1('0x11');}},'notificationSound':{'type':Sequelize[_0x82b1('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x82b1('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x82b1('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x82b1('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x82b1('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x82b1('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x82b1('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x82b1('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x82b1('0x12')],'defaultValue':![],'comment':_0x82b1('0x13'),'set':function(_0x38cecd){if(!_0x38cecd)this[_0x82b1('0x14')](_0x82b1('0x15'),null);this['setDataValue'](_0x82b1('0x16'),_0x38cecd);}}}; \ No newline at end of file +var _0x8e00=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','yes','STRING','ENUM','2400','9600','12000','14400','4800','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP'];(function(_0x5e5f5a,_0x5cb19a){var _0x4141ae=function(_0x4bb2ea){while(--_0x4bb2ea){_0x5e5f5a['push'](_0x5e5f5a['shift']());}};_0x4141ae(++_0x5cb19a);}(_0x8e00,0x140));var _0x08e0=function(_0x1f42a2,_0x41c48f){_0x1f42a2=_0x1f42a2-0x0;var _0x43fe37=_0x8e00[_0x1f42a2];return _0x43fe37;};'use strict';var Sequelize=require('sequelize');module[_0x08e0('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x08e0('0x1'),'no'),'defaultValue':_0x08e0('0x1')},'headerinfo':{'type':Sequelize[_0x08e0('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x08e0('0x3')](_0x08e0('0x4'),'4800','7200',_0x08e0('0x5'),_0x08e0('0x6'),_0x08e0('0x7')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x08e0('0x4'),_0x08e0('0x8'),_0x08e0('0x9'),_0x08e0('0x5'),'12000','14400'),'defaultValue':_0x08e0('0x7')},'modem':{'type':Sequelize[_0x08e0('0x2')],'defaultValue':_0x08e0('0xa')},'gateway':{'type':Sequelize[_0x08e0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x08e0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x08e0('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x08e0('0x3')](_0x08e0('0xc'),_0x08e0('0xd'),_0x08e0('0xe'),_0x08e0('0xf')),'defaultValue':_0x08e0('0xc')},'key':{'type':Sequelize[_0x08e0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x08e0('0x10')],'defaultValue':function(){return _0x08e0('0x11');}},'notificationSound':{'type':Sequelize[_0x08e0('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x08e0('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x08e0('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x08e0('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x08e0('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x08e0('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x08e0('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x08e0('0x14'),'set':function(_0x5db422){if(!_0x5db422)this[_0x08e0('0x15')](_0x08e0('0x16'),null);this['setDataValue'](_0x08e0('0x17'),_0x5db422);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index a8cdf49..06f02da 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 _0x8b45=['info','request\x20sent','debug','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','render','merge','body','agent','account','Pause','map','FaxAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','findAll','rows','params','includeAll','find','create','user','UserProfileSection','userProfileId','autoAssociation','update','describe','FaxAccountId','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','app','system','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','headerinfo','maxrate','modem','t38timeout','FAXOPT(','addAccountApplications','sequelize','VoiceExtension','bulkCreate','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','format','fax','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then'];(function(_0x10c7e0,_0x1fd550){var _0x5f5b64=function(_0x2a269d){while(--_0x2a269d){_0x10c7e0['push'](_0x10c7e0['shift']());}};_0x5f5b64(++_0x1fd550);}(_0x8b45,0x97));var _0x58b4=function(_0x5c6389,_0x263d6b){_0x5c6389=_0x5c6389-0x0;var _0x27ff68=_0x8b45[_0x5c6389];return _0x27ff68;};'use strict';var emlformat=require(_0x58b4('0x0'));var rimraf=require(_0x58b4('0x1'));var zipdir=require(_0x58b4('0x2'));var jsonpatch=require(_0x58b4('0x3'));var rp=require(_0x58b4('0x4'));var moment=require('moment');var BPromise=require(_0x58b4('0x5'));var Mustache=require(_0x58b4('0x6'));var util=require('util');var path=require(_0x58b4('0x7'));var sox=require(_0x58b4('0x8'));var csv=require(_0x58b4('0x9'));var ejs=require(_0x58b4('0xa'));var fs=require('fs');var fs_extra=require(_0x58b4('0xb'));var _=require('lodash');var squel=require(_0x58b4('0xc'));var crypto=require(_0x58b4('0xd'));var jsforce=require(_0x58b4('0xe'));var deskjs=require(_0x58b4('0xf'));var toCsv=require(_0x58b4('0x9'));var querystring=require(_0x58b4('0x10'));var Papa=require(_0x58b4('0x11'));var Redis=require(_0x58b4('0x12'));var authService=require(_0x58b4('0x13'));var qs=require(_0x58b4('0x14'));var as=require(_0x58b4('0x15'));var hardwareService=require(_0x58b4('0x16'));var logger=require(_0x58b4('0x17'))(_0x58b4('0x18'));var utils=require('../../config/utils');var config=require(_0x58b4('0x19'));var licenseUtil=require(_0x58b4('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x58b4('0x1b')](config[_0x58b4('0x1c')],{'host':_0x58b4('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58b4('0x1c')]));require(_0x58b4('0x1e'))[_0x58b4('0x1f')](socket);var jayson=require(_0x58b4('0x20'));var client=jayson[_0x58b4('0x21')][_0x58b4('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x58b4('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x334404,_0x16cd84,_0x1b6338,_0x21cf0e){return new BPromise(function(_0x4ab854,_0x100ee4){var _0x4fd8bb=_0x21cf0e||client;return _0x4fd8bb[_0x58b4('0x23')](_0x334404,_0x1b6338)[_0x58b4('0x24')](function(_0x5b9cd9){logger[_0x58b4('0x25')]('FaxAccount,\x20%s,\x20%s',_0x16cd84,_0x58b4('0x26'));logger[_0x58b4('0x27')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x16cd84,_0x58b4('0x26'),JSON[_0x58b4('0x28')](_0x5b9cd9));if(_0x5b9cd9[_0x58b4('0x29')]){if(_0x5b9cd9[_0x58b4('0x29')][_0x58b4('0x2a')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x16cd84,_0x5b9cd9[_0x58b4('0x29')]['message']);return _0x100ee4(_0x5b9cd9['error'][_0x58b4('0x2b')]);}logger[_0x58b4('0x29')](_0x58b4('0x2c'),_0x16cd84,_0x5b9cd9[_0x58b4('0x29')][_0x58b4('0x2b')]);return _0x4ab854(_0x5b9cd9[_0x58b4('0x29')][_0x58b4('0x2b')]);}else{logger[_0x58b4('0x25')](_0x58b4('0x2c'),_0x16cd84,_0x58b4('0x26'));_0x4ab854(_0x5b9cd9[_0x58b4('0x2d')][_0x58b4('0x2b')]);}})[_0x58b4('0x2e')](function(_0x18376e){logger[_0x58b4('0x29')](_0x58b4('0x2c'),_0x16cd84,_0x18376e);_0x100ee4(_0x18376e);});});}function respondWithStatusCode(_0x2bd70c,_0x22b579){_0x22b579=_0x22b579||0xcc;return function(_0x5980cb){if(_0x5980cb){return _0x2bd70c[_0x58b4('0x2f')](_0x22b579);}return _0x2bd70c[_0x58b4('0x30')](_0x22b579)[_0x58b4('0x31')]();};}function respondWithResult(_0x20aebc,_0x4b6ef7){_0x4b6ef7=_0x4b6ef7||0xc8;return function(_0x266782){if(_0x266782){return _0x20aebc[_0x58b4('0x30')](_0x4b6ef7)['json'](_0x266782);}};}function respondWithFilteredResult(_0x38d408,_0x29f77d){return function(_0x2b54ea){if(_0x2b54ea){var _0x203eb2=typeof _0x29f77d[_0x58b4('0x32')]===_0x58b4('0x33')&&typeof _0x29f77d[_0x58b4('0x34')]==='undefined';var _0x101745=_0x2b54ea[_0x58b4('0x35')];var _0x9cd65a=_0x203eb2?0x0:_0x29f77d['offset'];var _0x9ad8eb=_0x203eb2?_0x2b54ea[_0x58b4('0x35')]:_0x29f77d['offset']+_0x29f77d[_0x58b4('0x34')];var _0x2195b7;if(_0x9ad8eb>=_0x101745){_0x9ad8eb=_0x101745;_0x2195b7=0xc8;}else{_0x2195b7=0xce;}_0x38d408[_0x58b4('0x30')](_0x2195b7);return _0x38d408[_0x58b4('0x36')](_0x58b4('0x37'),_0x9cd65a+'-'+_0x9ad8eb+'/'+_0x101745)['json'](_0x2b54ea);}return null;};}function patchUpdates(_0x251595){return function(_0x543d6b){try{jsonpatch[_0x58b4('0x38')](_0x543d6b,_0x251595,!![]);}catch(_0x34c15b){return BPromise['reject'](_0x34c15b);}return _0x543d6b[_0x58b4('0x39')]();};}function saveUpdates(_0x37ad85,_0x21510a){return function(_0x58d72f){if(_0x58d72f){return _0x58d72f['update'](_0x37ad85)['then'](function(_0x59e05e){return _0x59e05e;});}return null;};}function removeEntity(_0x234c10,_0x5eec09){return function(_0x362366){if(_0x362366){return _0x362366[_0x58b4('0x3a')]()['then'](function(){var _0x415f0e=_0x362366[_0x58b4('0x3b')]({'plain':!![]});var _0x574351=_0x58b4('0x3c');return db[_0x58b4('0x3d')][_0x58b4('0x3a')]({'where':{'type':_0x574351,'resourceId':_0x415f0e['id']}})[_0x58b4('0x24')](function(){return _0x362366;});})[_0x58b4('0x24')](function(){_0x234c10['status'](0xcc)[_0x58b4('0x31')]();});}};}function handleEntityNotFound(_0x5821a1,_0x10ffb6){return function(_0x3f225f){if(!_0x3f225f){_0x5821a1[_0x58b4('0x2f')](0x194);}return _0x3f225f;};}function handleError(_0x568e7e,_0x5ecab8){_0x5ecab8=_0x5ecab8||0x1f4;return function(_0x38cb05){logger[_0x58b4('0x29')](_0x38cb05[_0x58b4('0x3e')]);if(_0x38cb05[_0x58b4('0x3f')]){delete _0x38cb05['name'];}_0x568e7e['status'](_0x5ecab8)[_0x58b4('0x40')](_0x38cb05);};}function getMustacheRender(_0x370569,_0x5ecc8e){return Mustache[_0x58b4('0x41')](_0x370569,_[_0x58b4('0x42')](_0x5ecc8e[_0x58b4('0x43')],{'contact':_0x5ecc8e['contact'],'message':_0x5ecc8e['message'],'agent':_0x5ecc8e[_0x58b4('0x44')],'interaction':_0x5ecc8e['interaction'],'account':_0x5ecc8e[_0x58b4('0x45')]}))||'';}exports['index']=function(_0xfcb516,_0x4d8a1b){var _0x2538c8={'include':[{'model':db[_0x58b4('0x46')],'as':'mandatoryDispositionPause'}]},_0x577fa5={},_0x3314f4={'count':0x0,'rows':[]};var _0x48a95c=_[_0x58b4('0x47')](db[_0x58b4('0x48')][_0x58b4('0x49')],function(_0x5a6442){return{'name':_0x5a6442['fieldName'],'type':_0x5a6442[_0x58b4('0x4a')][_0x58b4('0x4b')]};});_0x577fa5[_0x58b4('0x4c')]=_['map'](_0x48a95c,_0x58b4('0x3f'));_0x577fa5[_0x58b4('0x4d')]=_[_0x58b4('0x4e')](_0xfcb516[_0x58b4('0x4d')]);_0x577fa5[_0x58b4('0x4f')]=_[_0x58b4('0x50')](_0x577fa5[_0x58b4('0x4c')],_0x577fa5[_0x58b4('0x4d')]);_0x2538c8[_0x58b4('0x51')]=_[_0x58b4('0x50')](_0x577fa5[_0x58b4('0x4c')],qs[_0x58b4('0x52')](_0xfcb516[_0x58b4('0x4d')]['fields']));_0x2538c8[_0x58b4('0x51')]=_0x2538c8['attributes'][_0x58b4('0x53')]?_0x2538c8[_0x58b4('0x51')]:_0x577fa5[_0x58b4('0x4c')];if(!_0xfcb516[_0x58b4('0x4d')][_0x58b4('0x54')](_0x58b4('0x55'))){_0x2538c8['limit']=qs['limit'](_0xfcb516['query']['limit']);_0x2538c8[_0x58b4('0x32')]=qs[_0x58b4('0x32')](_0xfcb516[_0x58b4('0x4d')]['offset']);}_0x2538c8[_0x58b4('0x56')]=qs['sort'](_0xfcb516[_0x58b4('0x4d')][_0x58b4('0x57')]);_0x2538c8[_0x58b4('0x58')]=qs[_0x58b4('0x4f')](_[_0x58b4('0x59')](_0xfcb516[_0x58b4('0x4d')],_0x577fa5[_0x58b4('0x4f')]),_0x48a95c);if(_0xfcb516['query'][_0x58b4('0x5a')]){_0x2538c8[_0x58b4('0x58')]=_[_0x58b4('0x42')](_0x2538c8[_0x58b4('0x58')],{'$or':_[_0x58b4('0x47')](_0x48a95c,function(_0x4500cb){if(_0x4500cb[_0x58b4('0x4a')]!=='VIRTUAL'){var _0x18a2a0={};_0x18a2a0[_0x4500cb[_0x58b4('0x3f')]]={'$like':'%'+_0xfcb516['query'][_0x58b4('0x5a')]+'%'};return _0x18a2a0;}})});}_0x2538c8=_[_0x58b4('0x42')]({},_0x2538c8,_0xfcb516[_0x58b4('0x5b')]);var _0x10b0cd={'where':_0x2538c8[_0x58b4('0x58')]};return db[_0x58b4('0x48')][_0x58b4('0x35')](_0x10b0cd)['then'](function(_0x515f63){_0x3314f4[_0x58b4('0x35')]=_0x515f63;if(_0xfcb516[_0x58b4('0x4d')]['includeAll']){_0x2538c8[_0x58b4('0x5c')]=[{'all':!![]}];}return db[_0x58b4('0x48')][_0x58b4('0x5d')](_0x2538c8);})[_0x58b4('0x24')](function(_0x51cceb){_0x3314f4[_0x58b4('0x5e')]=_0x51cceb;return _0x3314f4;})[_0x58b4('0x24')](respondWithFilteredResult(_0x4d8a1b,_0x2538c8))['catch'](handleError(_0x4d8a1b,null));};exports['show']=function(_0x291e58,_0x5d578b){var _0x8d0588={'raw':![],'where':{'id':_0x291e58[_0x58b4('0x5f')]['id']},'include':[{'model':db[_0x58b4('0x46')],'as':'mandatoryDispositionPause'}]},_0x4c4593={};_0x4c4593[_0x58b4('0x4c')]=_['keys'](db[_0x58b4('0x48')][_0x58b4('0x49')]);_0x4c4593['query']=_['keys'](_0x291e58['query']);_0x4c4593[_0x58b4('0x4f')]=_[_0x58b4('0x50')](_0x4c4593[_0x58b4('0x4c')],_0x4c4593['query']);_0x8d0588['attributes']=_[_0x58b4('0x50')](_0x4c4593[_0x58b4('0x4c')],qs[_0x58b4('0x52')](_0x291e58['query'][_0x58b4('0x52')]));_0x8d0588[_0x58b4('0x51')]=_0x8d0588[_0x58b4('0x51')][_0x58b4('0x53')]?_0x8d0588[_0x58b4('0x51')]:_0x4c4593[_0x58b4('0x4c')];if(_0x291e58[_0x58b4('0x4d')][_0x58b4('0x60')]){_0x8d0588[_0x58b4('0x5c')]=[{'all':!![]}];}_0x8d0588=_[_0x58b4('0x42')]({},_0x8d0588,_0x291e58[_0x58b4('0x5b')]);return db[_0x58b4('0x48')][_0x58b4('0x61')](_0x8d0588)[_0x58b4('0x24')](handleEntityNotFound(_0x5d578b,null))['then'](respondWithResult(_0x5d578b,null))[_0x58b4('0x2e')](handleError(_0x5d578b,null));};exports['create']=function(_0xba770d,_0x32b7be){return db[_0x58b4('0x48')][_0x58b4('0x62')](_0xba770d[_0x58b4('0x43')],{})['then'](function(_0x28acfc){var _0x118aef=_0xba770d[_0x58b4('0x63')][_0x58b4('0x3b')]({'plain':!![]});if(!_0x118aef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x118aef['role']===_0x58b4('0x63')){var _0x3cd05f=_0x28acfc[_0x58b4('0x3b')]({'plain':!![]});var _0x3b4316=_0x58b4('0x3c');return db[_0x58b4('0x64')]['find']({'where':{'name':_0x3b4316,'userProfileId':_0x118aef[_0x58b4('0x65')]},'raw':!![]})['then'](function(_0x3b99a4){if(_0x3b99a4&&_0x3b99a4[_0x58b4('0x66')]===0x0){return db['UserProfileResource']['create']({'name':_0x3cd05f[_0x58b4('0x3f')],'resourceId':_0x3cd05f['id'],'type':_0x3b99a4[_0x58b4('0x3f')],'sectionId':_0x3b99a4['id']},{})['then'](function(){return _0x28acfc;});}else{return _0x28acfc;}})[_0x58b4('0x2e')](function(_0x12837b){logger[_0x58b4('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12837b);throw _0x12837b;});}return _0x28acfc;})['then'](respondWithResult(_0x32b7be,0xc9))['catch'](handleError(_0x32b7be,null));};exports[_0x58b4('0x67')]=function(_0x376a9c,_0x1b5401){if(_0x376a9c['body']['id']){delete _0x376a9c[_0x58b4('0x43')]['id'];}return db[_0x58b4('0x48')][_0x58b4('0x61')]({'where':{'id':_0x376a9c[_0x58b4('0x5f')]['id']},'include':[{'model':db[_0x58b4('0x46')],'as':'mandatoryDispositionPause'}]})[_0x58b4('0x24')](handleEntityNotFound(_0x1b5401,null))[_0x58b4('0x24')](saveUpdates(_0x376a9c[_0x58b4('0x43')],null))[_0x58b4('0x24')](respondWithResult(_0x1b5401,null))[_0x58b4('0x2e')](handleError(_0x1b5401,null));};exports[_0x58b4('0x3a')]=function(_0x377b39,_0x243681){return db[_0x58b4('0x48')][_0x58b4('0x61')]({'where':{'id':_0x377b39[_0x58b4('0x5f')]['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x243681,null))[_0x58b4('0x24')](removeEntity(_0x243681,null))[_0x58b4('0x2e')](handleError(_0x243681,null));};exports['describe']=function(_0xa407f5,_0x58a1de){return db['FaxAccount'][_0x58b4('0x68')]()['then'](respondWithResult(_0x58a1de,null))[_0x58b4('0x2e')](handleError(_0x58a1de,null));};exports['addDisposition']=function(_0x46fa45,_0x301b18,_0x1bf178){if(_0x46fa45[_0x58b4('0x43')]['id']){delete _0x46fa45['body']['id'];}return db[_0x58b4('0x48')][_0x58b4('0x61')]({'where':{'id':_0x46fa45['params']['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x301b18,null))['then'](function(_0xa6c3e){if(_0xa6c3e){_0x46fa45[_0x58b4('0x43')][_0x58b4('0x69')]=_0xa6c3e['id'];return db['Disposition']['create'](_0x46fa45[_0x58b4('0x43')]);}})[_0x58b4('0x24')](respondWithResult(_0x301b18,null))[_0x58b4('0x2e')](handleError(_0x301b18,null));};exports['getDispositions']=function(_0x3b35a7,_0x493bf8,_0x24766e){var _0x2f0178={'raw':![],'where':{}};var _0x197aba={};var _0x391580={'count':0x0,'rows':[]};return db[_0x58b4('0x48')][_0x58b4('0x6a')]({'where':{'id':_0x3b35a7[_0x58b4('0x5f')]['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x493bf8,null))[_0x58b4('0x24')](function(_0x18f807){if(_0x18f807){_0x197aba[_0x58b4('0x4c')]=_['keys'](db[_0x58b4('0x6b')][_0x58b4('0x49')]);_0x197aba[_0x58b4('0x4d')]=_[_0x58b4('0x4e')](_0x3b35a7['query']);_0x197aba[_0x58b4('0x4f')]=_[_0x58b4('0x50')](_0x197aba['model'],_0x197aba[_0x58b4('0x4d')]);_0x2f0178[_0x58b4('0x51')]=_[_0x58b4('0x50')](_0x197aba[_0x58b4('0x4c')],qs[_0x58b4('0x52')](_0x3b35a7[_0x58b4('0x4d')]['fields']));_0x2f0178[_0x58b4('0x51')]=_0x2f0178[_0x58b4('0x51')][_0x58b4('0x53')]?_0x2f0178[_0x58b4('0x51')]:_0x197aba[_0x58b4('0x4c')];if(!_0x3b35a7[_0x58b4('0x4d')][_0x58b4('0x54')](_0x58b4('0x55'))){_0x2f0178[_0x58b4('0x34')]=qs[_0x58b4('0x34')](_0x3b35a7[_0x58b4('0x4d')][_0x58b4('0x34')]);_0x2f0178['offset']=qs[_0x58b4('0x32')](_0x3b35a7[_0x58b4('0x4d')]['offset']);}_0x2f0178[_0x58b4('0x56')]=qs[_0x58b4('0x57')](_0x3b35a7[_0x58b4('0x4d')][_0x58b4('0x57')]);_0x2f0178[_0x58b4('0x58')]=qs[_0x58b4('0x4f')](_[_0x58b4('0x59')](_0x3b35a7[_0x58b4('0x4d')],_0x197aba[_0x58b4('0x4f')]));_0x2f0178[_0x58b4('0x58')][_0x58b4('0x69')]=_0x18f807['id'];if(_0x3b35a7[_0x58b4('0x4d')][_0x58b4('0x5a')]){_0x2f0178['where']=_['merge'](_0x2f0178['where'],{'$or':_[_0x58b4('0x47')](_0x2f0178[_0x58b4('0x51')],function(_0x2b4370){var _0x3d1a67={};_0x3d1a67[_0x2b4370]={'$like':'%'+_0x3b35a7[_0x58b4('0x4d')]['filter']+'%'};return _0x3d1a67;})});}_0x2f0178=_[_0x58b4('0x42')]({},_0x2f0178,_0x3b35a7['options']);return db[_0x58b4('0x6b')][_0x58b4('0x35')]({'where':_0x2f0178['where']})[_0x58b4('0x24')](function(_0x299753){_0x391580[_0x58b4('0x35')]=_0x299753;if(_0x3b35a7[_0x58b4('0x4d')][_0x58b4('0x60')]){_0x2f0178[_0x58b4('0x5c')]=[{'all':!![]}];}return db[_0x58b4('0x6b')]['findAll'](_0x2f0178);})['then'](function(_0x23f7d5){_0x391580[_0x58b4('0x5e')]=_0x23f7d5;return _0x391580;});}})[_0x58b4('0x24')](respondWithFilteredResult(_0x493bf8,_0x2f0178))['catch'](handleError(_0x493bf8,null));};exports[_0x58b4('0x6c')]=function(_0xe91b58,_0x2b56e8,_0x1ba281){return db[_0x58b4('0x48')][_0x58b4('0x61')]({'where':{'id':_0xe91b58['params']['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x2b56e8,null))[_0x58b4('0x24')](function(_0x29ab8e){if(_0x29ab8e){return _0x29ab8e[_0x58b4('0x6c')](_0xe91b58[_0x58b4('0x4d')][_0x58b4('0x6d')]);}})['then'](respondWithStatusCode(_0x2b56e8,null))[_0x58b4('0x2e')](handleError(_0x2b56e8,null));};exports[_0x58b4('0x6e')]=function(_0x43e582,_0x2a45ca,_0x5439fb){if(_0x43e582[_0x58b4('0x43')]['id']){delete _0x43e582[_0x58b4('0x43')]['id'];}return db[_0x58b4('0x48')]['find']({'where':{'id':_0x43e582['params']['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x2a45ca,null))[_0x58b4('0x24')](function(_0xa777ce){if(_0xa777ce){_0x43e582[_0x58b4('0x43')][_0x58b4('0x69')]=_0xa777ce['id'];return db[_0x58b4('0x6f')][_0x58b4('0x62')](_0x43e582[_0x58b4('0x43')]);}})[_0x58b4('0x24')](respondWithResult(_0x2a45ca,null))[_0x58b4('0x2e')](handleError(_0x2a45ca,null));};exports[_0x58b4('0x70')]=function(_0x3bb0d4,_0x9dfa6a,_0x55974f){var _0x1784af={'raw':![],'where':{}};var _0x47e30f={};var _0x29d395={'count':0x0,'rows':[]};return db[_0x58b4('0x48')][_0x58b4('0x6a')]({'where':{'id':_0x3bb0d4['params']['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x9dfa6a,null))['then'](function(_0x498727){if(_0x498727){_0x47e30f[_0x58b4('0x4c')]=_['keys'](db['CannedAnswer'][_0x58b4('0x49')]);_0x47e30f[_0x58b4('0x4d')]=_[_0x58b4('0x4e')](_0x3bb0d4[_0x58b4('0x4d')]);_0x47e30f[_0x58b4('0x4f')]=_[_0x58b4('0x50')](_0x47e30f['model'],_0x47e30f[_0x58b4('0x4d')]);_0x1784af[_0x58b4('0x51')]=_[_0x58b4('0x50')](_0x47e30f[_0x58b4('0x4c')],qs[_0x58b4('0x52')](_0x3bb0d4['query'][_0x58b4('0x52')]));_0x1784af[_0x58b4('0x51')]=_0x1784af[_0x58b4('0x51')][_0x58b4('0x53')]?_0x1784af[_0x58b4('0x51')]:_0x47e30f[_0x58b4('0x4c')];if(!_0x3bb0d4['query'][_0x58b4('0x54')](_0x58b4('0x55'))){_0x1784af[_0x58b4('0x34')]=qs[_0x58b4('0x34')](_0x3bb0d4[_0x58b4('0x4d')]['limit']);_0x1784af[_0x58b4('0x32')]=qs[_0x58b4('0x32')](_0x3bb0d4[_0x58b4('0x4d')][_0x58b4('0x32')]);}_0x1784af['order']=qs[_0x58b4('0x57')](_0x3bb0d4[_0x58b4('0x4d')][_0x58b4('0x57')]);_0x1784af[_0x58b4('0x58')]=qs[_0x58b4('0x4f')](_[_0x58b4('0x59')](_0x3bb0d4[_0x58b4('0x4d')],_0x47e30f['filters']));_0x1784af[_0x58b4('0x58')]['FaxAccountId']=_0x498727['id'];if(_0x3bb0d4['query'][_0x58b4('0x5a')]){_0x1784af[_0x58b4('0x58')]=_[_0x58b4('0x42')](_0x1784af[_0x58b4('0x58')],{'$or':_[_0x58b4('0x47')](_0x1784af[_0x58b4('0x51')],function(_0x147cde){var _0xdb39b3={};_0xdb39b3[_0x147cde]={'$like':'%'+_0x3bb0d4[_0x58b4('0x4d')][_0x58b4('0x5a')]+'%'};return _0xdb39b3;})});}_0x1784af=_[_0x58b4('0x42')]({},_0x1784af,_0x3bb0d4[_0x58b4('0x5b')]);return db[_0x58b4('0x6f')][_0x58b4('0x35')]({'where':_0x1784af[_0x58b4('0x58')]})[_0x58b4('0x24')](function(_0x1709e2){_0x29d395[_0x58b4('0x35')]=_0x1709e2;if(_0x3bb0d4['query']['includeAll']){_0x1784af[_0x58b4('0x5c')]=[{'all':!![]}];}return db[_0x58b4('0x6f')][_0x58b4('0x5d')](_0x1784af);})[_0x58b4('0x24')](function(_0x132509){_0x29d395[_0x58b4('0x5e')]=_0x132509;return _0x29d395;});}})[_0x58b4('0x24')](respondWithFilteredResult(_0x9dfa6a,_0x1784af))[_0x58b4('0x2e')](handleError(_0x9dfa6a,null));};exports[_0x58b4('0x71')]=function(_0x13e112,_0x4cfff2,_0x5b0d8a){return db[_0x58b4('0x48')][_0x58b4('0x61')]({'where':{'id':_0x13e112[_0x58b4('0x5f')]['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x4cfff2,null))['then'](function(_0x3dad5e){if(_0x3dad5e){return _0x3dad5e[_0x58b4('0x71')](_0x13e112['query'][_0x58b4('0x6d')]);}})[_0x58b4('0x24')](respondWithStatusCode(_0x4cfff2,null))['catch'](handleError(_0x4cfff2,null));};exports[_0x58b4('0x72')]=function(_0x42bcaf,_0x252438,_0x462fda){return db['FaxInteraction'][_0x58b4('0x61')]({'where':{'id':_0x42bcaf[_0x58b4('0x5f')]['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x252438,null))['then'](function(_0x10aaae){if(_0x10aaae){return _0x10aaae[_0x58b4('0x72')](_0x42bcaf[_0x58b4('0x43')][_0x58b4('0x6d')],_[_0x58b4('0x73')](_0x42bcaf[_0x58b4('0x43')],[_0x58b4('0x6d'),'id'])||{});}})[_0x58b4('0x24')](respondWithResult(_0x252438,null))[_0x58b4('0x2e')](handleError(_0x252438,null));};exports[_0x58b4('0x74')]=function(_0x39ffc3,_0x2a2a3b,_0x22b1a9){var _0x4e7ce7={'raw':![],'where':{}};var _0x11a501={};var _0xb02d6={'count':0x0,'rows':[]};return db[_0x58b4('0x48')][_0x58b4('0x6a')]({'where':{'id':_0x39ffc3[_0x58b4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2a2a3b,null))[_0x58b4('0x24')](function(_0x51ea97){if(_0x51ea97){_0x11a501[_0x58b4('0x4c')]=_[_0x58b4('0x4e')](db[_0x58b4('0x75')][_0x58b4('0x49')]);_0x11a501[_0x58b4('0x4d')]=_['keys'](_0x39ffc3['query']);_0x11a501['filters']=_[_0x58b4('0x50')](_0x11a501[_0x58b4('0x4c')],_0x11a501[_0x58b4('0x4d')]);_0x4e7ce7[_0x58b4('0x51')]=_[_0x58b4('0x50')](_0x11a501[_0x58b4('0x4c')],qs[_0x58b4('0x52')](_0x39ffc3[_0x58b4('0x4d')]['fields']));_0x4e7ce7[_0x58b4('0x51')]=_0x4e7ce7[_0x58b4('0x51')][_0x58b4('0x53')]?_0x4e7ce7[_0x58b4('0x51')]:_0x11a501['model'];if(!_0x39ffc3[_0x58b4('0x4d')]['hasOwnProperty'](_0x58b4('0x55'))){_0x4e7ce7[_0x58b4('0x34')]=qs['limit'](_0x39ffc3[_0x58b4('0x4d')][_0x58b4('0x34')]);_0x4e7ce7[_0x58b4('0x32')]=qs['offset'](_0x39ffc3['query']['offset']);}_0x4e7ce7[_0x58b4('0x56')]=qs[_0x58b4('0x57')](_0x39ffc3[_0x58b4('0x4d')][_0x58b4('0x57')]);_0x4e7ce7[_0x58b4('0x58')]=qs[_0x58b4('0x4f')](_[_0x58b4('0x59')](_0x39ffc3[_0x58b4('0x4d')],_0x11a501[_0x58b4('0x4f')]));_0x4e7ce7[_0x58b4('0x58')][_0x58b4('0x69')]=_0x51ea97['id'];if(_0x39ffc3['query']['filter']){_0x4e7ce7[_0x58b4('0x58')]=_['merge'](_0x4e7ce7['where'],{'$or':_[_0x58b4('0x47')](_0x4e7ce7[_0x58b4('0x51')],function(_0x1d4ee2){var _0x2d2e7f={};_0x2d2e7f[_0x1d4ee2]={'$like':'%'+_0x39ffc3[_0x58b4('0x4d')][_0x58b4('0x5a')]+'%'};return _0x2d2e7f;})});}_0x4e7ce7=_[_0x58b4('0x42')]({},_0x4e7ce7,_0x39ffc3[_0x58b4('0x5b')]);return db[_0x58b4('0x75')][_0x58b4('0x35')]({'where':_0x4e7ce7[_0x58b4('0x58')]})['then'](function(_0x4be6e0){_0xb02d6[_0x58b4('0x35')]=_0x4be6e0;if(_0x39ffc3[_0x58b4('0x4d')][_0x58b4('0x60')]){_0x4e7ce7[_0x58b4('0x5c')]=[{'model':db[_0x58b4('0x76')],'as':'Contact','required':![]},{'model':db[_0x58b4('0x77')],'as':'Owner','attributes':[_0x58b4('0x3f'),_0x58b4('0x78'),_0x58b4('0x79')],'required':![]},{'model':db[_0x58b4('0x7a')],'as':_0x58b4('0x7b'),'attributes':['id',_0x58b4('0x3f'),_0x58b4('0x7c')],'where':_0x39ffc3['query'][_0x58b4('0x7d')]?{'id':_0x39ffc3[_0x58b4('0x4d')][_0x58b4('0x7d')]}:undefined,'required':_0x39ffc3[_0x58b4('0x4d')][_0x58b4('0x7d')]?!![]:![]}];}return db[_0x58b4('0x75')][_0x58b4('0x5d')](_0x4e7ce7);})[_0x58b4('0x24')](function(_0x4ac2d5){_0xb02d6[_0x58b4('0x5e')]=_0x4ac2d5;return _0xb02d6;});}})[_0x58b4('0x24')](respondWithFilteredResult(_0x2a2a3b,_0x4e7ce7))['catch'](handleError(_0x2a2a3b,null));};exports[_0x58b4('0x7e')]=function(_0x4e3612,_0x41f429,_0x711ffc){return db[_0x58b4('0x48')]['findOne']({'where':{'id':_0x4e3612[_0x58b4('0x5f')]['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x41f429,null))[_0x58b4('0x24')](function(_0x3ab1dc){if(_0x3ab1dc){return db['sequelize'][_0x58b4('0x7f')](function(_0x288f5b){return db[_0x58b4('0x80')][_0x58b4('0x3a')]({'where':{'FaxAccountId':_0x4e3612['params']['id']},'transaction':_0x288f5b})[_0x58b4('0x24')](function(_0x2c0367){var _0x5a3264=_[_0x58b4('0x47')](_0x4e3612[_0x58b4('0x43')],function(_0x12fdbb){_0x12fdbb['FaxAccountId']=_0x4e3612[_0x58b4('0x5f')]['id'];return _0x12fdbb;});return db[_0x58b4('0x80')]['bulkCreate'](_0x5a3264,{'transaction':_0x288f5b});});})[_0x58b4('0x24')](function(){return db[_0x58b4('0x80')][_0x58b4('0x81')]({'where':{'FaxAccountId':_0x4e3612[_0x58b4('0x5f')]['id']},'order':_0x58b4('0x82')});});}})['then'](respondWithResult(_0x41f429,null))[_0x58b4('0x2e')](handleError(_0x41f429,null));};exports[_0x58b4('0x83')]=function(_0x9eed53,_0x4dccaa,_0x2553c2){var _0x3eed24={};var _0x3e0daf={};var _0x1b026c;var _0x2fa90d;return db['FaxAccount']['findOne']({'where':{'id':_0x9eed53[_0x58b4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4dccaa,null))[_0x58b4('0x24')](function(_0x442f6c){if(_0x442f6c){_0x1b026c=_0x442f6c;_0x3e0daf[_0x58b4('0x4c')]=_[_0x58b4('0x4e')](db[_0x58b4('0x80')][_0x58b4('0x49')]);_0x3e0daf[_0x58b4('0x4d')]=_[_0x58b4('0x4e')](_0x9eed53[_0x58b4('0x4d')]);_0x3e0daf['filters']=_[_0x58b4('0x50')](_0x3e0daf[_0x58b4('0x4c')],_0x3e0daf['query']);_0x3eed24[_0x58b4('0x51')]=_[_0x58b4('0x50')](_0x3e0daf[_0x58b4('0x4c')],qs[_0x58b4('0x52')](_0x9eed53[_0x58b4('0x4d')]['fields']));_0x3eed24[_0x58b4('0x51')]=_0x3eed24[_0x58b4('0x51')][_0x58b4('0x53')]?_0x3eed24['attributes']:_0x3e0daf[_0x58b4('0x4c')];_0x3eed24[_0x58b4('0x56')]=qs[_0x58b4('0x57')](_0x9eed53[_0x58b4('0x4d')][_0x58b4('0x57')]);_0x3eed24['where']=qs[_0x58b4('0x4f')](_['pick'](_0x9eed53[_0x58b4('0x4d')],_0x3e0daf[_0x58b4('0x4f')]));if(_0x9eed53[_0x58b4('0x4d')][_0x58b4('0x5a')]){_0x3eed24['where']=_[_0x58b4('0x42')](_0x3eed24[_0x58b4('0x58')],{'$or':_['map'](_0x3eed24[_0x58b4('0x51')],function(_0xa933bd){var _0x1079b9={};_0x1079b9[_0xa933bd]={'$like':'%'+_0x9eed53[_0x58b4('0x4d')][_0x58b4('0x5a')]+'%'};return _0x1079b9;})});}_0x3eed24=_[_0x58b4('0x42')]({},_0x3eed24,_0x9eed53[_0x58b4('0x5b')]);return _0x1b026c[_0x58b4('0x83')](_0x3eed24);}})[_0x58b4('0x24')](function(_0x12c398){if(_0x12c398){_0x2fa90d=_0x12c398[_0x58b4('0x53')];if(!_0x9eed53[_0x58b4('0x4d')][_0x58b4('0x54')]('nolimit')){_0x3eed24[_0x58b4('0x34')]=qs[_0x58b4('0x34')](_0x9eed53[_0x58b4('0x4d')][_0x58b4('0x34')]);_0x3eed24['offset']=qs[_0x58b4('0x32')](_0x9eed53['query'][_0x58b4('0x32')]);}return _0x1b026c[_0x58b4('0x83')](_0x3eed24);}})[_0x58b4('0x24')](function(_0x304450){if(_0x304450){return _0x304450?{'count':_0x2fa90d,'rows':_0x304450}:null;}})[_0x58b4('0x24')](respondWithResult(_0x4dccaa,null))[_0x58b4('0x2e')](handleError(_0x4dccaa,null));};function Extension(_0x48d685,_0x1e7b1a,_0x280b31,_0x21c9f0){this[_0x58b4('0x84')]=_0x58b4('0x85');this['exten']=_0x48d685['localstationid'];this[_0x58b4('0x86')]=_0x21c9f0;this[_0x58b4('0x4a')]=_0x58b4('0x87');this['description']=_0x58b4('0x88');this[_0x58b4('0x69')]=_0x48d685['id'];this['priority']=_0x1e7b1a;this['appdata']=_0x280b31;}function createExtensionsReciveFax(_0x53cb2c){var _0x39536e=0x1;var _0x266361=[];_0x266361[_0x58b4('0x89')](new Extension(_0x53cb2c,_0x39536e,'',_0x58b4('0x8a')));_0x39536e+=0x1;_0x266361[_0x58b4('0x89')](new Extension(_0x53cb2c,_0x39536e,_0x58b4('0x8b'),_0x58b4('0x8c')));_0x39536e+=0x1;for(var _0x3783e3 in _0x53cb2c){if(_0x53cb2c[_0x58b4('0x54')](_0x3783e3)&&(_0x3783e3===_0x58b4('0x8d')||_0x3783e3===_0x58b4('0x8e')||_0x3783e3===_0x58b4('0x8f')||_0x3783e3==='faxdetect'||_0x3783e3===_0x58b4('0x90')||_0x3783e3===_0x58b4('0x91')||_0x3783e3==='minrate'||_0x3783e3===_0x58b4('0x92')||_0x3783e3===_0x58b4('0x93'))){_0x266361[_0x58b4('0x89')](new Extension(_0x53cb2c,_0x39536e,_0x58b4('0x94')+_0x3783e3+')='+_0x53cb2c[_0x3783e3],_0x58b4('0x8c')));_0x39536e+=0x1;}}_0x266361[_0x58b4('0x89')](new Extension(_0x53cb2c,_0x39536e,'6','Wait'));_0x39536e+=0x1;_0x266361[_0x58b4('0x89')](new Extension(_0x53cb2c,_0x39536e,'/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'));_0x39536e=0x0;return _0x266361;}exports[_0x58b4('0x95')]=function(_0x23264b,_0x302077,_0x1bf275){var _0x213ae3;return db[_0x58b4('0x96')]['transaction'](function(_0x50e31c){return db[_0x58b4('0x48')][_0x58b4('0x62')](_0x23264b[_0x58b4('0x43')],{'transaction':_0x50e31c})[_0x58b4('0x24')](function(_0x47ae73){_0x213ae3=_0x47ae73[_0x58b4('0x3b')]({'plain':!![]});return db[_0x58b4('0x97')][_0x58b4('0x98')](createExtensionsReciveFax(_0x213ae3),{'transaction':_0x50e31c});});})['then'](function(){return _0x213ae3;})[_0x58b4('0x24')](respondWithResult(_0x302077,null))['catch'](handleError(_0x302077,null));};exports[_0x58b4('0x99')]=function(_0x34bcb9,_0x58e21d,_0x953cee){var _0x3c6978;return db[_0x58b4('0x96')][_0x58b4('0x7f')](function(_0x395959){return db['FaxAccount']['update'](_0x34bcb9['body'],{'where':{'id':_0x34bcb9[_0x58b4('0x43')]['id']},'transaction':_0x395959})[_0x58b4('0x24')](function(_0x4f603d){return db['VoiceExtension'][_0x58b4('0x3a')]({'where':{'FaxAccountId':_0x34bcb9[_0x58b4('0x43')]['id']},'transaction':_0x395959})['then'](function(_0x5a4a05){return db[_0x58b4('0x97')][_0x58b4('0x98')](createExtensionsReciveFax(_[_0x58b4('0x73')](_0x34bcb9[_0x58b4('0x43')],['tech','key',_0x58b4('0x9a'),_0x58b4('0x9b'),_0x58b4('0x9c'),_0x58b4('0x9d')])),{'transaction':_0x395959});});});})['then'](function(){return db[_0x58b4('0x48')][_0x58b4('0x9e')](_0x34bcb9[_0x58b4('0x43')]['id']);})[_0x58b4('0x24')](respondWithResult(_0x58e21d,null))[_0x58b4('0x2e')](handleError(_0x58e21d,null));};exports['getMessages']=function(_0x66ca63,_0x1bdbe6,_0x6cb706){var _0x393914={'raw':!![],'where':{}};var _0x2c7ff8={};var _0x139562={'count':0x0,'rows':[]};return db[_0x58b4('0x48')]['findOne']({'where':{'id':_0x66ca63['params']['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x1bdbe6,null))[_0x58b4('0x24')](function(_0xc40705){if(_0xc40705){_0x2c7ff8[_0x58b4('0x4c')]=_[_0x58b4('0x4e')](db[_0x58b4('0x9f')][_0x58b4('0x49')]);_0x2c7ff8[_0x58b4('0x4d')]=_[_0x58b4('0x4e')](_0x66ca63[_0x58b4('0x4d')]);_0x2c7ff8['filters']=_[_0x58b4('0x50')](_0x2c7ff8[_0x58b4('0x4c')],_0x2c7ff8[_0x58b4('0x4d')]);_0x393914['attributes']=_[_0x58b4('0x50')](_0x2c7ff8[_0x58b4('0x4c')],qs[_0x58b4('0x52')](_0x66ca63['query'][_0x58b4('0x52')]));_0x393914[_0x58b4('0x51')]=_0x393914[_0x58b4('0x51')][_0x58b4('0x53')]?_0x393914[_0x58b4('0x51')]:_0x2c7ff8[_0x58b4('0x4c')];if(!_0x66ca63['query']['hasOwnProperty'](_0x58b4('0x55'))){_0x393914[_0x58b4('0x34')]=qs[_0x58b4('0x34')](_0x66ca63[_0x58b4('0x4d')]['limit']);_0x393914['offset']=qs['offset'](_0x66ca63[_0x58b4('0x4d')][_0x58b4('0x32')]);}_0x393914[_0x58b4('0x56')]=qs[_0x58b4('0x57')](_0x66ca63[_0x58b4('0x4d')][_0x58b4('0x57')]);_0x393914['where']=qs[_0x58b4('0x4f')](_[_0x58b4('0x59')](_0x66ca63[_0x58b4('0x4d')],_0x2c7ff8[_0x58b4('0x4f')]));_0x393914[_0x58b4('0x58')][_0x58b4('0x69')]=_0xc40705['id'];if(_0x66ca63[_0x58b4('0x4d')][_0x58b4('0x5a')]){_0x393914[_0x58b4('0x58')]=_[_0x58b4('0x42')](_0x393914[_0x58b4('0x58')],{'$or':_['map'](_0x393914[_0x58b4('0x51')],function(_0x528d3a){var _0x340c0a={};_0x340c0a[_0x528d3a]={'$like':'%'+_0x66ca63[_0x58b4('0x4d')][_0x58b4('0x5a')]+'%'};return _0x340c0a;})});}if(_0x66ca63[_0x58b4('0x4d')][_0x58b4('0xa0')]){var _0x51bf46=_0x66ca63[_0x58b4('0x4d')][_0x58b4('0xa0')][_0x58b4('0xa1')](',');var _0x1892dc={};_0x1892dc[_0x51bf46[0x0]]={'$gte':moment(_0x51bf46[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x393914[_0x58b4('0x58')]=_[_0x58b4('0x42')](_0x393914['where'],_0x1892dc);}_0x393914=_[_0x58b4('0x42')]({},_0x393914,_0x66ca63['options']);return db[_0x58b4('0x9f')][_0x58b4('0x35')]({'where':_0x393914[_0x58b4('0x58')]})['then'](function(_0xc7d7b8){_0x139562[_0x58b4('0x35')]=_0xc7d7b8;if(_0x66ca63[_0x58b4('0x4d')][_0x58b4('0x60')]){_0x393914[_0x58b4('0x5c')]=[{'all':!![]}];}return db[_0x58b4('0x9f')][_0x58b4('0x5d')](_0x393914);})[_0x58b4('0x24')](function(_0x2aa602){_0x139562['rows']=_0x2aa602;return _0x139562;});}})[_0x58b4('0x24')](respondWithFilteredResult(_0x1bdbe6,_0x393914))[_0x58b4('0x2e')](handleError(_0x1bdbe6,null));};exports[_0x58b4('0x40')]=function(_0x205a3b,_0x40735c,_0x709784){var _0x42839d,_0x166034={},_0x5d5c92;if(_0x205a3b[_0x58b4('0x43')]['to']){_0x5d5c92=_0x205a3b[_0x58b4('0x43')]['to'][0x0];}return db[_0x58b4('0x48')][_0x58b4('0x61')]({'where':{'id':_0x205a3b[_0x58b4('0x5f')]['id']},'include':[{'model':db[_0x58b4('0xa2')],'as':_0x58b4('0xa3'),'include':[{'model':db['CmContact'],'as':_0x58b4('0xa4'),'where':{'fax':_0x5d5c92},'limit':0x1,'order':[[_0x58b4('0x9b'),_0x58b4('0xa5')]]}]}]})[_0x58b4('0x24')](handleEntityNotFound(_0x40735c,null))[_0x58b4('0x24')](function(_0x2fa344){_0x42839d=_0x2fa344;if(_0x205a3b[_0x58b4('0x43')][_0x58b4('0xa6')]&&_0x205a3b['body'][_0x58b4('0xa6')]['length']){for(var _0x1214da=0x0;_0x1214da<_0x205a3b['body'][_0x58b4('0xa6')]['length'];_0x1214da+=0x1){_0x205a3b[_0x58b4('0x43')][_0x58b4('0xa6')][_0x1214da]={'filename':_0x205a3b[_0x58b4('0x43')][_0x58b4('0xa6')][_0x1214da][_0x58b4('0x3f')],'id':_0x205a3b[_0x58b4('0x43')][_0x58b4('0xa6')][_0x1214da]['id'],'path':path['join'](config[_0x58b4('0xa7')],_0x58b4('0xa8'),_0x205a3b[_0x58b4('0x43')][_0x58b4('0xa6')][_0x1214da][_0x58b4('0xa9')])};}}return respondWithRpcPromise(_0x58b4('0xaa'),_0x58b4('0xaa'),{'FaxAccountId':_[_0x58b4('0xab')](_0x205a3b[_0x58b4('0x5f')]['id'])?undefined:_0x205a3b[_0x58b4('0x5f')]['id'],'path':_[_0x58b4('0xab')](_0x205a3b[_0x58b4('0x43')]['attachments'][0x0][_0x58b4('0x7')])?undefined:_0x205a3b['body'][_0x58b4('0xa6')][0x0][_0x58b4('0x7')],'fax':_['isNil'](_0x205a3b[_0x58b4('0x43')]['to'][0x0])?undefined:_0x205a3b[_0x58b4('0x43')]['to'][0x0]},client9002);})['then'](function(){if(_0x42839d){if(_['isNil'](_0x205a3b['body']['from'])){_0x205a3b['body']['from']=util[_0x58b4('0xac')]('\x22%s\x22\x20<%s>',_0x42839d[_0x58b4('0x3f')],_0x42839d[_0x58b4('0xad')]);}if(_0x42839d[_0x58b4('0xa3')]){if(_0x42839d['List'][_0x58b4('0xa4')][_0x58b4('0x53')]){return _0x42839d[_0x58b4('0xa3')][_0x58b4('0xa4')][0x0];}else{return db[_0x58b4('0x76')][_0x58b4('0x62')](_['defaults'](_0x205a3b[_0x58b4('0x43')],{'firstName':_0x205a3b[_0x58b4('0x43')]['to'][0x0],'phone':_0x205a3b[_0x58b4('0x43')]['to'][0x0],'fax':_0x205a3b['body']['to'][0x0],'ListId':_0x42839d[_0x58b4('0x9d')]}));}}else{throw new Error(_0x58b4('0xae'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x58b4('0x24')](function(_0x10484a){if(_0x10484a){return db[_0x58b4('0x75')][_0x58b4('0x61')]({'where':{'ContactId':_0x10484a['id'],'closed':![],'FaxAccountId':_0x42839d['id']}})['then'](function(_0x4f2d00){if(_0x4f2d00){return[_0x4f2d00,![]];}return db['FaxInteraction']['create']({'UserId':_0x205a3b[_0x58b4('0x63')]['id'],'ContactId':_0x10484a['id'],'FaxAccountId':_0x42839d['id'],'fax':_0x205a3b[_0x58b4('0x43')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x58b4('0x42')](_0x205a3b[_0x58b4('0x43')],{'read':![],'body':_0x205a3b[_0x58b4('0x43')]['attachments'][0x0][_0x58b4('0xaf')],'FaxAccountId':_0x42839d['id'],'UserId':_0x205a3b[_0x58b4('0x63')]['id'],'ContactId':_0x10484a['id'],'AttachmentId':_0x205a3b[_0x58b4('0x43')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x58b4('0xb0')}]})[_0x58b4('0x24')](function(_0x542662){return[_0x542662,!![]];});});}else{throw new Error(_0x58b4('0xb1'));}})['spread'](function(_0xc53427,_0x423d05){if(_0x423d05){return _0xc53427;}return db[_0x58b4('0x9f')]['create']({'direction':_0x58b4('0xb2'),'read':![],'body':_0x205a3b[_0x58b4('0x43')]['attachments'][0x0][_0x58b4('0xaf')],'FaxAccountId':_0x42839d['id'],'FaxInteractionId':_0xc53427['id'],'UserId':_0x205a3b[_0x58b4('0x63')]['id'],'ContactId':_0xc53427[_0x58b4('0xb3')],'AttachmentId':_0x205a3b[_0x58b4('0x43')][_0x58b4('0xa6')][0x0]['id']})[_0x58b4('0x24')](function(_0x12a148){_0xc53427['dataValues']['Messages']=[];_0xc53427['dataValues'][_0x58b4('0xb0')][_0x58b4('0x89')](_0x12a148[_0x58b4('0xb4')]);return _0xc53427;});})[_0x58b4('0x24')](function(_0x1d79c1){respondWithRpcPromise(_0x58b4('0xb5'),'SendFax',{'FaxAccountId':_[_0x58b4('0xab')](_0x205a3b[_0x58b4('0x5f')]['id'])?undefined:_0x205a3b[_0x58b4('0x5f')]['id'],'path':_[_0x58b4('0xab')](_0x205a3b['body'][_0x58b4('0xa6')][0x0][_0x58b4('0x7')])?undefined:_0x205a3b['body'][_0x58b4('0xa6')][0x0][_0x58b4('0x7')],'fax':_['isNil'](_0x205a3b[_0x58b4('0x43')]['to'][0x0])?undefined:_0x205a3b[_0x58b4('0x43')]['to'][0x0],'AttachmentId':_0x205a3b[_0x58b4('0x43')]['attachments'][0x0]['id']},client9002)[_0x58b4('0x24')](function(_0x4c093d){logger[_0x58b4('0x25')]('SendFaxRpc,\x20%s',_0x4c093d);})[_0x58b4('0x2e')](function(_0x2c0587){logger[_0x58b4('0x25')](_0x58b4('0xb6'),_0x2c0587);});return _0x1d79c1;})[_0x58b4('0x24')](respondWithResult(_0x40735c,null))['catch'](handleError(_0x40735c,null));};exports[_0x58b4('0xb7')]=function(_0xcceb9,_0x7e8f79,_0x503b89){return db[_0x58b4('0x48')]['find']({'where':{'id':_0xcceb9['params']['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x7e8f79,null))[_0x58b4('0x24')](function(_0x4d1091){if(_0x4d1091){return _0x4d1091[_0x58b4('0xb7')](_0xcceb9[_0x58b4('0x43')][_0x58b4('0x6d')],_['omit'](_0xcceb9[_0x58b4('0x43')],['ids','id'])||{})['spread'](function(_0x15bee9){for(var _0x35f3c8=0x0;_0x35f3c8<_0xcceb9[_0x58b4('0x43')][_0x58b4('0x6d')][_0x58b4('0x53')];_0x35f3c8+=0x1){socket[_0x58b4('0xb8')]('userFaxAccount:save',{'UserId':_0xcceb9[_0x58b4('0x43')]['ids'][_0x35f3c8],'FaxAccountId':_0xcceb9[_0x58b4('0x5f')]['id']});}return _0x15bee9;});}})['then'](respondWithResult(_0x7e8f79,null))[_0x58b4('0x2e')](handleError(_0x7e8f79,null));};exports[_0x58b4('0xb9')]=function(_0x3b4492,_0x1214ba,_0x43df44){return db[_0x58b4('0x48')][_0x58b4('0x61')]({'where':{'id':_0x3b4492[_0x58b4('0x5f')]['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x1214ba,null))['then'](function(_0xe4f3e0){if(_0xe4f3e0){return _0xe4f3e0[_0x58b4('0xb9')](_0x3b4492[_0x58b4('0x4d')][_0x58b4('0x6d')])[_0x58b4('0x24')](function(){if(_['isArray'](_0x3b4492[_0x58b4('0x4d')][_0x58b4('0x6d')])){for(var _0x3f9b04=0x0;_0x3f9b04<_0x3b4492[_0x58b4('0x4d')][_0x58b4('0x6d')][_0x58b4('0x53')];_0x3f9b04+=0x1){socket[_0x58b4('0xb8')]('userFaxAccount:remove',{'UserId':Number(_0x3b4492['query'][_0x58b4('0x6d')][_0x3f9b04]),'FaxAccountId':Number(_0x3b4492[_0x58b4('0x5f')]['id'])});}}else{socket[_0x58b4('0xb8')](_0x58b4('0xba'),{'UserId':Number(_0x3b4492[_0x58b4('0x4d')]['ids']),'FaxAccountId':Number(_0x3b4492['params']['id'])});}});}})[_0x58b4('0x24')](respondWithStatusCode(_0x1214ba,null))[_0x58b4('0x2e')](handleError(_0x1214ba,null));};exports['getAgents']=function(_0x3be71a,_0x5dd556,_0x4262cf){var _0x11eb5e={};var _0x36c9c9={};var _0x12cdb3;var _0x5869ca;return db[_0x58b4('0x48')][_0x58b4('0x6a')]({'where':{'id':_0x3be71a[_0x58b4('0x5f')]['id']}})[_0x58b4('0x24')](handleEntityNotFound(_0x5dd556,null))['then'](function(_0x2aa0be){if(_0x2aa0be){_0x12cdb3=_0x2aa0be;_0x36c9c9[_0x58b4('0x4c')]=_[_0x58b4('0x4e')](db[_0x58b4('0x77')]['rawAttributes']);_0x36c9c9[_0x58b4('0x4d')]=_[_0x58b4('0x4e')](_0x3be71a[_0x58b4('0x4d')]);_0x36c9c9[_0x58b4('0x4f')]=_[_0x58b4('0x50')](_0x36c9c9[_0x58b4('0x4c')],_0x36c9c9[_0x58b4('0x4d')]);_0x11eb5e['attributes']=_[_0x58b4('0x50')](_0x36c9c9[_0x58b4('0x4c')],qs[_0x58b4('0x52')](_0x3be71a[_0x58b4('0x4d')][_0x58b4('0x52')]));_0x11eb5e[_0x58b4('0x51')]=_0x11eb5e['attributes'][_0x58b4('0x53')]?_0x11eb5e['attributes']:_0x36c9c9[_0x58b4('0x4c')];_0x11eb5e['order']=qs[_0x58b4('0x57')](_0x3be71a[_0x58b4('0x4d')][_0x58b4('0x57')]);_0x11eb5e[_0x58b4('0x58')]=qs['filters'](_['pick'](_0x3be71a['query'],_0x36c9c9[_0x58b4('0x4f')]));if(_0x3be71a[_0x58b4('0x4d')]['filter']){_0x11eb5e[_0x58b4('0x58')]=_['merge'](_0x11eb5e[_0x58b4('0x58')],{'$or':_[_0x58b4('0x47')](_0x11eb5e[_0x58b4('0x51')],function(_0x500d2a){var _0x1f97a9={};_0x1f97a9[_0x500d2a]={'$like':'%'+_0x3be71a['query'][_0x58b4('0x5a')]+'%'};return _0x1f97a9;})});}_0x11eb5e=_[_0x58b4('0x42')]({},_0x11eb5e,_0x3be71a[_0x58b4('0x5b')]);return _0x12cdb3[_0x58b4('0xbb')](_0x11eb5e);}})[_0x58b4('0x24')](function(_0x6f8c6a){if(_0x6f8c6a){_0x5869ca=_0x6f8c6a[_0x58b4('0x53')];if(!_0x3be71a['query'][_0x58b4('0x54')]('nolimit')){_0x11eb5e[_0x58b4('0x34')]=qs[_0x58b4('0x34')](_0x3be71a[_0x58b4('0x4d')]['limit']);_0x11eb5e[_0x58b4('0x32')]=qs[_0x58b4('0x32')](_0x3be71a[_0x58b4('0x4d')][_0x58b4('0x32')]);}return _0x12cdb3['getAgents'](_0x11eb5e);}})['then'](function(_0x5272df){if(_0x5272df){return _0x5272df?{'count':_0x5869ca,'rows':_0x5272df}:null;}})[_0x58b4('0x24')](respondWithResult(_0x5dd556,null))[_0x58b4('0x2e')](handleError(_0x5dd556,null));}; \ No newline at end of file +var _0x89a8=['hasOwnProperty','sort','where','pick','filter','VIRTUAL','findAll','rows','show','params','mandatoryDispositionPause','keys','FaxAccount','includeAll','include','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','addDisposition','FaxAccountId','Disposition','intersection','nolimit','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','FaxInteraction','ids','getInteractions','CmContact','Contact','User','internal','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','localstationid','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','omit','ListId','findById','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','List','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','register','jayson/promise','http','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then','destroy','FaxAccounts','UserProfileResource','stack','name','send','render','merge','body','contact','agent','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length'];(function(_0x2d3ce8,_0x3524ba){var _0x579bc4=function(_0x1aeea7){while(--_0x1aeea7){_0x2d3ce8['push'](_0x2d3ce8['shift']());}};_0x579bc4(++_0x3524ba);}(_0x89a8,0x78));var _0x889a=function(_0x138b7b,_0xe6121f){_0x138b7b=_0x138b7b-0x0;var _0x5d7261=_0x89a8[_0x138b7b];return _0x5d7261;};'use strict';var emlformat=require(_0x889a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x889a('0x1'));var rp=require(_0x889a('0x2'));var moment=require(_0x889a('0x3'));var BPromise=require(_0x889a('0x4'));var Mustache=require(_0x889a('0x5'));var util=require(_0x889a('0x6'));var path=require(_0x889a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x889a('0x8'));var fs=require('fs');var fs_extra=require(_0x889a('0x9'));var _=require(_0x889a('0xa'));var squel=require(_0x889a('0xb'));var crypto=require(_0x889a('0xc'));var jsforce=require(_0x889a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x889a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x889a('0xf'));var authService=require(_0x889a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x889a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x889a('0x12'))(_0x889a('0x13'));var utils=require(_0x889a('0x14'));var config=require(_0x889a('0x15'));var licenseUtil=require(_0x889a('0x16'));var db=require(_0x889a('0x17'))['db'];config['redis']=_[_0x889a('0x18')](config['redis'],{'host':_0x889a('0x19'),'port':0x18eb});var socket=require(_0x889a('0x1a'))(new Redis(config[_0x889a('0x1b')]));require(_0x889a('0x1c'))[_0x889a('0x1d')](socket);var jayson=require(_0x889a('0x1e'));var client=jayson['client'][_0x889a('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x889a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1143cd,_0x25082d,_0x11759a,_0x7a4805){return new BPromise(function(_0x220118,_0x10bfb6){var _0x5114fd=_0x7a4805||client;return _0x5114fd['request'](_0x1143cd,_0x11759a)['then'](function(_0x54f1bd){logger[_0x889a('0x20')]('FaxAccount,\x20%s,\x20%s',_0x25082d,_0x889a('0x21'));logger[_0x889a('0x22')](_0x889a('0x23'),_0x25082d,_0x889a('0x21'),JSON[_0x889a('0x24')](_0x54f1bd));if(_0x54f1bd['error']){if(_0x54f1bd[_0x889a('0x25')][_0x889a('0x26')]===0x1f4){logger[_0x889a('0x25')](_0x889a('0x27'),_0x25082d,_0x54f1bd[_0x889a('0x25')][_0x889a('0x28')]);return _0x10bfb6(_0x54f1bd[_0x889a('0x25')][_0x889a('0x28')]);}logger[_0x889a('0x25')](_0x889a('0x27'),_0x25082d,_0x54f1bd[_0x889a('0x25')]['message']);return _0x220118(_0x54f1bd[_0x889a('0x25')][_0x889a('0x28')]);}else{logger['info'](_0x889a('0x27'),_0x25082d,_0x889a('0x21'));_0x220118(_0x54f1bd[_0x889a('0x29')][_0x889a('0x28')]);}})[_0x889a('0x2a')](function(_0x17d0de){logger[_0x889a('0x25')](_0x889a('0x27'),_0x25082d,_0x17d0de);_0x10bfb6(_0x17d0de);});});}function respondWithStatusCode(_0x44ef81,_0x4c8622){_0x4c8622=_0x4c8622||0xcc;return function(_0x4b98b6){if(_0x4b98b6){return _0x44ef81[_0x889a('0x2b')](_0x4c8622);}return _0x44ef81[_0x889a('0x2c')](_0x4c8622)[_0x889a('0x2d')]();};}function respondWithResult(_0x59be61,_0x22b2cd){_0x22b2cd=_0x22b2cd||0xc8;return function(_0x38b654){if(_0x38b654){return _0x59be61[_0x889a('0x2c')](_0x22b2cd)[_0x889a('0x2e')](_0x38b654);}};}function respondWithFilteredResult(_0x5bea7a,_0xaca647){return function(_0x355dc6){if(_0x355dc6){var _0x1e7176=typeof _0xaca647[_0x889a('0x2f')]===_0x889a('0x30')&&typeof _0xaca647[_0x889a('0x31')]===_0x889a('0x30');var _0x5318c9=_0x355dc6['count'];var _0x41bf18=_0x1e7176?0x0:_0xaca647[_0x889a('0x2f')];var _0x1d1324=_0x1e7176?_0x355dc6[_0x889a('0x32')]:_0xaca647[_0x889a('0x2f')]+_0xaca647[_0x889a('0x31')];var _0x2a2458;if(_0x1d1324>=_0x5318c9){_0x1d1324=_0x5318c9;_0x2a2458=0xc8;}else{_0x2a2458=0xce;}_0x5bea7a['status'](_0x2a2458);return _0x5bea7a[_0x889a('0x33')]('Content-Range',_0x41bf18+'-'+_0x1d1324+'/'+_0x5318c9)[_0x889a('0x2e')](_0x355dc6);}return null;};}function patchUpdates(_0x46f416){return function(_0x4dff60){try{jsonpatch['apply'](_0x4dff60,_0x46f416,!![]);}catch(_0x3171be){return BPromise['reject'](_0x3171be);}return _0x4dff60[_0x889a('0x34')]();};}function saveUpdates(_0x4f9d49,_0x393f97){return function(_0x28c09e){if(_0x28c09e){return _0x28c09e['update'](_0x4f9d49)[_0x889a('0x35')](function(_0x21e8f0){return _0x21e8f0;});}return null;};}function removeEntity(_0xfb438,_0x574313){return function(_0x35504a){if(_0x35504a){return _0x35504a[_0x889a('0x36')]()['then'](function(){var _0x91465f=_0x35504a['get']({'plain':!![]});var _0x5aa576=_0x889a('0x37');return db[_0x889a('0x38')][_0x889a('0x36')]({'where':{'type':_0x5aa576,'resourceId':_0x91465f['id']}})[_0x889a('0x35')](function(){return _0x35504a;});})['then'](function(){_0xfb438[_0x889a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15f35d,_0x501e45){return function(_0x3e7335){if(!_0x3e7335){_0x15f35d['sendStatus'](0x194);}return _0x3e7335;};}function handleError(_0x131d82,_0x59a3b5){_0x59a3b5=_0x59a3b5||0x1f4;return function(_0x3ff927){logger['error'](_0x3ff927[_0x889a('0x39')]);if(_0x3ff927['name']){delete _0x3ff927[_0x889a('0x3a')];}_0x131d82[_0x889a('0x2c')](_0x59a3b5)[_0x889a('0x3b')](_0x3ff927);};}function getMustacheRender(_0x13215b,_0x51ae3a){return Mustache[_0x889a('0x3c')](_0x13215b,_[_0x889a('0x3d')](_0x51ae3a[_0x889a('0x3e')],{'contact':_0x51ae3a[_0x889a('0x3f')],'message':_0x51ae3a[_0x889a('0x28')],'agent':_0x51ae3a[_0x889a('0x40')],'interaction':_0x51ae3a['interaction'],'account':_0x51ae3a['account']}))||'';}exports[_0x889a('0x41')]=function(_0x7396fa,_0x55ebf4){var _0x1fac8f={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x29144b={},_0x56f492={'count':0x0,'rows':[]};var _0x2af443=_[_0x889a('0x42')](db['FaxAccount'][_0x889a('0x43')],function(_0x3ccaf1){return{'name':_0x3ccaf1[_0x889a('0x44')],'type':_0x3ccaf1[_0x889a('0x45')][_0x889a('0x46')]};});_0x29144b[_0x889a('0x47')]=_['map'](_0x2af443,'name');_0x29144b['query']=_['keys'](_0x7396fa[_0x889a('0x48')]);_0x29144b[_0x889a('0x49')]=_['intersection'](_0x29144b[_0x889a('0x47')],_0x29144b['query']);_0x1fac8f[_0x889a('0x4a')]=_['intersection'](_0x29144b['model'],qs[_0x889a('0x4b')](_0x7396fa[_0x889a('0x48')][_0x889a('0x4b')]));_0x1fac8f[_0x889a('0x4a')]=_0x1fac8f[_0x889a('0x4a')][_0x889a('0x4c')]?_0x1fac8f[_0x889a('0x4a')]:_0x29144b[_0x889a('0x47')];if(!_0x7396fa[_0x889a('0x48')][_0x889a('0x4d')]('nolimit')){_0x1fac8f['limit']=qs[_0x889a('0x31')](_0x7396fa[_0x889a('0x48')][_0x889a('0x31')]);_0x1fac8f[_0x889a('0x2f')]=qs[_0x889a('0x2f')](_0x7396fa[_0x889a('0x48')][_0x889a('0x2f')]);}_0x1fac8f['order']=qs['sort'](_0x7396fa[_0x889a('0x48')][_0x889a('0x4e')]);_0x1fac8f[_0x889a('0x4f')]=qs[_0x889a('0x49')](_[_0x889a('0x50')](_0x7396fa[_0x889a('0x48')],_0x29144b[_0x889a('0x49')]),_0x2af443);if(_0x7396fa[_0x889a('0x48')][_0x889a('0x51')]){_0x1fac8f[_0x889a('0x4f')]=_['merge'](_0x1fac8f[_0x889a('0x4f')],{'$or':_[_0x889a('0x42')](_0x2af443,function(_0x40db4c){if(_0x40db4c['type']!==_0x889a('0x52')){var _0x51e768={};_0x51e768[_0x40db4c[_0x889a('0x3a')]]={'$like':'%'+_0x7396fa[_0x889a('0x48')][_0x889a('0x51')]+'%'};return _0x51e768;}})});}_0x1fac8f=_['merge']({},_0x1fac8f,_0x7396fa['options']);var _0x1da175={'where':_0x1fac8f[_0x889a('0x4f')]};return db['FaxAccount']['count'](_0x1da175)[_0x889a('0x35')](function(_0x39957c){_0x56f492[_0x889a('0x32')]=_0x39957c;if(_0x7396fa[_0x889a('0x48')]['includeAll']){_0x1fac8f['include']=[{'all':!![]}];}return db['FaxAccount'][_0x889a('0x53')](_0x1fac8f);})[_0x889a('0x35')](function(_0x30f4ac){_0x56f492[_0x889a('0x54')]=_0x30f4ac;return _0x56f492;})['then'](respondWithFilteredResult(_0x55ebf4,_0x1fac8f))[_0x889a('0x2a')](handleError(_0x55ebf4,null));};exports[_0x889a('0x55')]=function(_0x4e0d64,_0x57f996){var _0x3e1d7d={'raw':![],'where':{'id':_0x4e0d64[_0x889a('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x889a('0x57')}]},_0x3990a3={};_0x3990a3[_0x889a('0x47')]=_[_0x889a('0x58')](db[_0x889a('0x59')][_0x889a('0x43')]);_0x3990a3[_0x889a('0x48')]=_['keys'](_0x4e0d64[_0x889a('0x48')]);_0x3990a3[_0x889a('0x49')]=_['intersection'](_0x3990a3[_0x889a('0x47')],_0x3990a3[_0x889a('0x48')]);_0x3e1d7d[_0x889a('0x4a')]=_['intersection'](_0x3990a3[_0x889a('0x47')],qs[_0x889a('0x4b')](_0x4e0d64['query'][_0x889a('0x4b')]));_0x3e1d7d[_0x889a('0x4a')]=_0x3e1d7d[_0x889a('0x4a')]['length']?_0x3e1d7d[_0x889a('0x4a')]:_0x3990a3[_0x889a('0x47')];if(_0x4e0d64[_0x889a('0x48')][_0x889a('0x5a')]){_0x3e1d7d[_0x889a('0x5b')]=[{'all':!![]}];}_0x3e1d7d=_['merge']({},_0x3e1d7d,_0x4e0d64[_0x889a('0x5c')]);return db['FaxAccount'][_0x889a('0x5d')](_0x3e1d7d)[_0x889a('0x35')](handleEntityNotFound(_0x57f996,null))[_0x889a('0x35')](respondWithResult(_0x57f996,null))[_0x889a('0x2a')](handleError(_0x57f996,null));};exports[_0x889a('0x5e')]=function(_0x58e1e9,_0x3d2a13){return db[_0x889a('0x59')]['create'](_0x58e1e9[_0x889a('0x3e')],{})[_0x889a('0x35')](function(_0x4417b3){var _0x17eda5=_0x58e1e9[_0x889a('0x5f')][_0x889a('0x60')]({'plain':!![]});if(!_0x17eda5)throw new Error(_0x889a('0x61'));if(_0x17eda5[_0x889a('0x62')]==='user'){var _0x498193=_0x4417b3['get']({'plain':!![]});var _0x5f1dea=_0x889a('0x37');return db[_0x889a('0x63')]['find']({'where':{'name':_0x5f1dea,'userProfileId':_0x17eda5[_0x889a('0x64')]},'raw':!![]})[_0x889a('0x35')](function(_0x3f05f7){if(_0x3f05f7&&_0x3f05f7[_0x889a('0x65')]===0x0){return db[_0x889a('0x38')][_0x889a('0x5e')]({'name':_0x498193[_0x889a('0x3a')],'resourceId':_0x498193['id'],'type':_0x3f05f7['name'],'sectionId':_0x3f05f7['id']},{})['then'](function(){return _0x4417b3;});}else{return _0x4417b3;}})[_0x889a('0x2a')](function(_0x5593b2){logger[_0x889a('0x25')](_0x889a('0x66'),_0x5593b2);throw _0x5593b2;});}return _0x4417b3;})[_0x889a('0x35')](respondWithResult(_0x3d2a13,0xc9))['catch'](handleError(_0x3d2a13,null));};exports[_0x889a('0x67')]=function(_0x2c3780,_0x3b6bb8){if(_0x2c3780[_0x889a('0x3e')]['id']){delete _0x2c3780[_0x889a('0x3e')]['id'];}return db[_0x889a('0x59')][_0x889a('0x5d')]({'where':{'id':_0x2c3780[_0x889a('0x56')]['id']},'include':[{'model':db[_0x889a('0x68')],'as':_0x889a('0x57')}]})[_0x889a('0x35')](handleEntityNotFound(_0x3b6bb8,null))[_0x889a('0x35')](saveUpdates(_0x2c3780['body'],null))[_0x889a('0x35')](respondWithResult(_0x3b6bb8,null))['catch'](handleError(_0x3b6bb8,null));};exports[_0x889a('0x36')]=function(_0x57880f,_0x49696d){return db[_0x889a('0x59')][_0x889a('0x5d')]({'where':{'id':_0x57880f[_0x889a('0x56')]['id']}})['then'](handleEntityNotFound(_0x49696d,null))['then'](removeEntity(_0x49696d,null))[_0x889a('0x2a')](handleError(_0x49696d,null));};exports[_0x889a('0x69')]=function(_0x5714f1,_0x10629d){return db[_0x889a('0x59')][_0x889a('0x69')]()[_0x889a('0x35')](respondWithResult(_0x10629d,null))['catch'](handleError(_0x10629d,null));};exports[_0x889a('0x6a')]=function(_0x5bd829,_0x136bfc,_0x541c73){if(_0x5bd829[_0x889a('0x3e')]['id']){delete _0x5bd829[_0x889a('0x3e')]['id'];}return db[_0x889a('0x59')][_0x889a('0x5d')]({'where':{'id':_0x5bd829[_0x889a('0x56')]['id']}})[_0x889a('0x35')](handleEntityNotFound(_0x136bfc,null))[_0x889a('0x35')](function(_0x36391d){if(_0x36391d){_0x5bd829[_0x889a('0x3e')][_0x889a('0x6b')]=_0x36391d['id'];return db[_0x889a('0x6c')][_0x889a('0x5e')](_0x5bd829['body']);}})['then'](respondWithResult(_0x136bfc,null))[_0x889a('0x2a')](handleError(_0x136bfc,null));};exports['getDispositions']=function(_0x1837e0,_0x2b70ea,_0x522a80){var _0x5c5360={'raw':![],'where':{}};var _0x43b299={};var _0x59a319={'count':0x0,'rows':[]};return db[_0x889a('0x59')]['findOne']({'where':{'id':_0x1837e0[_0x889a('0x56')]['id']}})[_0x889a('0x35')](handleEntityNotFound(_0x2b70ea,null))[_0x889a('0x35')](function(_0x2f831){if(_0x2f831){_0x43b299[_0x889a('0x47')]=_['keys'](db[_0x889a('0x6c')][_0x889a('0x43')]);_0x43b299[_0x889a('0x48')]=_[_0x889a('0x58')](_0x1837e0[_0x889a('0x48')]);_0x43b299['filters']=_[_0x889a('0x6d')](_0x43b299[_0x889a('0x47')],_0x43b299[_0x889a('0x48')]);_0x5c5360['attributes']=_[_0x889a('0x6d')](_0x43b299[_0x889a('0x47')],qs['fields'](_0x1837e0['query'][_0x889a('0x4b')]));_0x5c5360[_0x889a('0x4a')]=_0x5c5360['attributes']['length']?_0x5c5360['attributes']:_0x43b299[_0x889a('0x47')];if(!_0x1837e0[_0x889a('0x48')][_0x889a('0x4d')](_0x889a('0x6e'))){_0x5c5360[_0x889a('0x31')]=qs[_0x889a('0x31')](_0x1837e0[_0x889a('0x48')][_0x889a('0x31')]);_0x5c5360[_0x889a('0x2f')]=qs[_0x889a('0x2f')](_0x1837e0[_0x889a('0x48')][_0x889a('0x2f')]);}_0x5c5360[_0x889a('0x6f')]=qs['sort'](_0x1837e0[_0x889a('0x48')]['sort']);_0x5c5360['where']=qs[_0x889a('0x49')](_[_0x889a('0x50')](_0x1837e0['query'],_0x43b299['filters']));_0x5c5360[_0x889a('0x4f')]['FaxAccountId']=_0x2f831['id'];if(_0x1837e0[_0x889a('0x48')][_0x889a('0x51')]){_0x5c5360[_0x889a('0x4f')]=_['merge'](_0x5c5360[_0x889a('0x4f')],{'$or':_['map'](_0x5c5360[_0x889a('0x4a')],function(_0x1c1b25){var _0x1b40f8={};_0x1b40f8[_0x1c1b25]={'$like':'%'+_0x1837e0[_0x889a('0x48')]['filter']+'%'};return _0x1b40f8;})});}_0x5c5360=_[_0x889a('0x3d')]({},_0x5c5360,_0x1837e0[_0x889a('0x5c')]);return db['Disposition'][_0x889a('0x32')]({'where':_0x5c5360['where']})[_0x889a('0x35')](function(_0x1a7119){_0x59a319[_0x889a('0x32')]=_0x1a7119;if(_0x1837e0[_0x889a('0x48')][_0x889a('0x5a')]){_0x5c5360[_0x889a('0x5b')]=[{'all':!![]}];}return db[_0x889a('0x6c')]['findAll'](_0x5c5360);})[_0x889a('0x35')](function(_0x85ba08){_0x59a319[_0x889a('0x54')]=_0x85ba08;return _0x59a319;});}})[_0x889a('0x35')](respondWithFilteredResult(_0x2b70ea,_0x5c5360))['catch'](handleError(_0x2b70ea,null));};exports['removeDispositions']=function(_0x5e10fb,_0x104cb3,_0x4a6083){return db[_0x889a('0x59')]['find']({'where':{'id':_0x5e10fb['params']['id']}})[_0x889a('0x35')](handleEntityNotFound(_0x104cb3,null))['then'](function(_0x5c5a4e){if(_0x5c5a4e){return _0x5c5a4e[_0x889a('0x70')](_0x5e10fb[_0x889a('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x104cb3,null))[_0x889a('0x2a')](handleError(_0x104cb3,null));};exports[_0x889a('0x71')]=function(_0x537e70,_0x3b4011,_0x2158b3){if(_0x537e70[_0x889a('0x3e')]['id']){delete _0x537e70[_0x889a('0x3e')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x537e70[_0x889a('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b4011,null))['then'](function(_0x169ae5){if(_0x169ae5){_0x537e70[_0x889a('0x3e')][_0x889a('0x6b')]=_0x169ae5['id'];return db[_0x889a('0x72')]['create'](_0x537e70[_0x889a('0x3e')]);}})['then'](respondWithResult(_0x3b4011,null))[_0x889a('0x2a')](handleError(_0x3b4011,null));};exports[_0x889a('0x73')]=function(_0x52e88b,_0x56ebaa,_0x31f2cf){var _0x15b242={'raw':![],'where':{}};var _0x4adcd5={};var _0x5c3aa3={'count':0x0,'rows':[]};return db[_0x889a('0x59')][_0x889a('0x74')]({'where':{'id':_0x52e88b['params']['id']}})[_0x889a('0x35')](handleEntityNotFound(_0x56ebaa,null))[_0x889a('0x35')](function(_0x266e41){if(_0x266e41){_0x4adcd5['model']=_[_0x889a('0x58')](db[_0x889a('0x72')][_0x889a('0x43')]);_0x4adcd5[_0x889a('0x48')]=_[_0x889a('0x58')](_0x52e88b[_0x889a('0x48')]);_0x4adcd5[_0x889a('0x49')]=_[_0x889a('0x6d')](_0x4adcd5[_0x889a('0x47')],_0x4adcd5[_0x889a('0x48')]);_0x15b242[_0x889a('0x4a')]=_[_0x889a('0x6d')](_0x4adcd5[_0x889a('0x47')],qs[_0x889a('0x4b')](_0x52e88b[_0x889a('0x48')][_0x889a('0x4b')]));_0x15b242[_0x889a('0x4a')]=_0x15b242[_0x889a('0x4a')][_0x889a('0x4c')]?_0x15b242[_0x889a('0x4a')]:_0x4adcd5[_0x889a('0x47')];if(!_0x52e88b[_0x889a('0x48')][_0x889a('0x4d')](_0x889a('0x6e'))){_0x15b242[_0x889a('0x31')]=qs[_0x889a('0x31')](_0x52e88b[_0x889a('0x48')]['limit']);_0x15b242[_0x889a('0x2f')]=qs[_0x889a('0x2f')](_0x52e88b[_0x889a('0x48')]['offset']);}_0x15b242[_0x889a('0x6f')]=qs[_0x889a('0x4e')](_0x52e88b[_0x889a('0x48')][_0x889a('0x4e')]);_0x15b242['where']=qs['filters'](_['pick'](_0x52e88b[_0x889a('0x48')],_0x4adcd5[_0x889a('0x49')]));_0x15b242[_0x889a('0x4f')]['FaxAccountId']=_0x266e41['id'];if(_0x52e88b[_0x889a('0x48')][_0x889a('0x51')]){_0x15b242[_0x889a('0x4f')]=_[_0x889a('0x3d')](_0x15b242[_0x889a('0x4f')],{'$or':_[_0x889a('0x42')](_0x15b242['attributes'],function(_0x1e1a3d){var _0xa9242a={};_0xa9242a[_0x1e1a3d]={'$like':'%'+_0x52e88b[_0x889a('0x48')]['filter']+'%'};return _0xa9242a;})});}_0x15b242=_[_0x889a('0x3d')]({},_0x15b242,_0x52e88b[_0x889a('0x5c')]);return db[_0x889a('0x72')][_0x889a('0x32')]({'where':_0x15b242['where']})[_0x889a('0x35')](function(_0x1aaf5b){_0x5c3aa3[_0x889a('0x32')]=_0x1aaf5b;if(_0x52e88b[_0x889a('0x48')][_0x889a('0x5a')]){_0x15b242['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x15b242);})[_0x889a('0x35')](function(_0xa4f9c8){_0x5c3aa3[_0x889a('0x54')]=_0xa4f9c8;return _0x5c3aa3;});}})[_0x889a('0x35')](respondWithFilteredResult(_0x56ebaa,_0x15b242))[_0x889a('0x2a')](handleError(_0x56ebaa,null));};exports['removeAnswers']=function(_0x123034,_0x54d94c,_0x114b0e){return db[_0x889a('0x59')][_0x889a('0x5d')]({'where':{'id':_0x123034[_0x889a('0x56')]['id']}})['then'](handleEntityNotFound(_0x54d94c,null))[_0x889a('0x35')](function(_0x1547e6){if(_0x1547e6){return _0x1547e6[_0x889a('0x75')](_0x123034['query']['ids']);}})[_0x889a('0x35')](respondWithStatusCode(_0x54d94c,null))[_0x889a('0x2a')](handleError(_0x54d94c,null));};exports[_0x889a('0x76')]=function(_0x31615c,_0x3f6a27,_0x13dc3d){return db[_0x889a('0x77')][_0x889a('0x5d')]({'where':{'id':_0x31615c[_0x889a('0x56')]['id']}})[_0x889a('0x35')](handleEntityNotFound(_0x3f6a27,null))['then'](function(_0x1078c6){if(_0x1078c6){return _0x1078c6[_0x889a('0x76')](_0x31615c[_0x889a('0x3e')]['ids'],_['omit'](_0x31615c[_0x889a('0x3e')],[_0x889a('0x78'),'id'])||{});}})[_0x889a('0x35')](respondWithResult(_0x3f6a27,null))[_0x889a('0x2a')](handleError(_0x3f6a27,null));};exports[_0x889a('0x79')]=function(_0x343f70,_0xfe4de4,_0x1f4559){var _0x226bcd={'raw':![],'where':{}};var _0x7adb09={};var _0x46575c={'count':0x0,'rows':[]};return db[_0x889a('0x59')][_0x889a('0x74')]({'where':{'id':_0x343f70[_0x889a('0x56')]['id']}})[_0x889a('0x35')](handleEntityNotFound(_0xfe4de4,null))['then'](function(_0x3975b8){if(_0x3975b8){_0x7adb09[_0x889a('0x47')]=_['keys'](db['FaxInteraction'][_0x889a('0x43')]);_0x7adb09[_0x889a('0x48')]=_[_0x889a('0x58')](_0x343f70[_0x889a('0x48')]);_0x7adb09['filters']=_[_0x889a('0x6d')](_0x7adb09['model'],_0x7adb09['query']);_0x226bcd[_0x889a('0x4a')]=_['intersection'](_0x7adb09[_0x889a('0x47')],qs['fields'](_0x343f70[_0x889a('0x48')]['fields']));_0x226bcd[_0x889a('0x4a')]=_0x226bcd[_0x889a('0x4a')]['length']?_0x226bcd[_0x889a('0x4a')]:_0x7adb09[_0x889a('0x47')];if(!_0x343f70[_0x889a('0x48')][_0x889a('0x4d')]('nolimit')){_0x226bcd[_0x889a('0x31')]=qs['limit'](_0x343f70[_0x889a('0x48')]['limit']);_0x226bcd[_0x889a('0x2f')]=qs[_0x889a('0x2f')](_0x343f70[_0x889a('0x48')][_0x889a('0x2f')]);}_0x226bcd[_0x889a('0x6f')]=qs[_0x889a('0x4e')](_0x343f70[_0x889a('0x48')][_0x889a('0x4e')]);_0x226bcd[_0x889a('0x4f')]=qs[_0x889a('0x49')](_['pick'](_0x343f70['query'],_0x7adb09[_0x889a('0x49')]));_0x226bcd[_0x889a('0x4f')][_0x889a('0x6b')]=_0x3975b8['id'];if(_0x343f70[_0x889a('0x48')][_0x889a('0x51')]){_0x226bcd[_0x889a('0x4f')]=_[_0x889a('0x3d')](_0x226bcd[_0x889a('0x4f')],{'$or':_['map'](_0x226bcd[_0x889a('0x4a')],function(_0x2436b9){var _0x24964f={};_0x24964f[_0x2436b9]={'$like':'%'+_0x343f70['query']['filter']+'%'};return _0x24964f;})});}_0x226bcd=_['merge']({},_0x226bcd,_0x343f70[_0x889a('0x5c')]);return db['FaxInteraction']['count']({'where':_0x226bcd[_0x889a('0x4f')]})[_0x889a('0x35')](function(_0x355f58){_0x46575c[_0x889a('0x32')]=_0x355f58;if(_0x343f70['query']['includeAll']){_0x226bcd[_0x889a('0x5b')]=[{'model':db[_0x889a('0x7a')],'as':_0x889a('0x7b'),'required':![]},{'model':db[_0x889a('0x7c')],'as':'Owner','attributes':[_0x889a('0x3a'),'fullname',_0x889a('0x7d')],'required':![]},{'model':db['Tag'],'as':_0x889a('0x7e'),'attributes':['id','name',_0x889a('0x7f')],'where':_0x343f70[_0x889a('0x48')]['tag']?{'id':_0x343f70[_0x889a('0x48')][_0x889a('0x80')]}:undefined,'required':_0x343f70[_0x889a('0x48')][_0x889a('0x80')]?!![]:![]}];}return db[_0x889a('0x77')][_0x889a('0x53')](_0x226bcd);})[_0x889a('0x35')](function(_0x39d441){_0x46575c[_0x889a('0x54')]=_0x39d441;return _0x46575c;});}})['then'](respondWithFilteredResult(_0xfe4de4,_0x226bcd))[_0x889a('0x2a')](handleError(_0xfe4de4,null));};exports[_0x889a('0x81')]=function(_0x3a0515,_0x5a7b11,_0x156463){return db[_0x889a('0x59')]['findOne']({'where':{'id':_0x3a0515[_0x889a('0x56')]['id']}})[_0x889a('0x35')](handleEntityNotFound(_0x5a7b11,null))[_0x889a('0x35')](function(_0x123359){if(_0x123359){return db[_0x889a('0x82')][_0x889a('0x83')](function(_0x5203b7){return db[_0x889a('0x84')][_0x889a('0x36')]({'where':{'FaxAccountId':_0x3a0515[_0x889a('0x56')]['id']},'transaction':_0x5203b7})[_0x889a('0x35')](function(_0x4be030){var _0x31116c=_[_0x889a('0x42')](_0x3a0515['body'],function(_0x535bce){_0x535bce['FaxAccountId']=_0x3a0515[_0x889a('0x56')]['id'];return _0x535bce;});return db[_0x889a('0x84')][_0x889a('0x85')](_0x31116c,{'transaction':_0x5203b7});});})[_0x889a('0x35')](function(){return db[_0x889a('0x84')][_0x889a('0x86')]({'where':{'FaxAccountId':_0x3a0515[_0x889a('0x56')]['id']},'order':_0x889a('0x87')});});}})[_0x889a('0x35')](respondWithResult(_0x5a7b11,null))['catch'](handleError(_0x5a7b11,null));};exports[_0x889a('0x88')]=function(_0x50256a,_0x43eda9,_0x536d53){var _0x325c9f={};var _0x250bcb={};var _0x5b0dc0;var _0x128ffe;return db[_0x889a('0x59')][_0x889a('0x74')]({'where':{'id':_0x50256a['params']['id']}})[_0x889a('0x35')](handleEntityNotFound(_0x43eda9,null))[_0x889a('0x35')](function(_0x1e17d6){if(_0x1e17d6){_0x5b0dc0=_0x1e17d6;_0x250bcb['model']=_['keys'](db['FaxApplication']['rawAttributes']);_0x250bcb[_0x889a('0x48')]=_[_0x889a('0x58')](_0x50256a[_0x889a('0x48')]);_0x250bcb[_0x889a('0x49')]=_['intersection'](_0x250bcb[_0x889a('0x47')],_0x250bcb[_0x889a('0x48')]);_0x325c9f[_0x889a('0x4a')]=_[_0x889a('0x6d')](_0x250bcb[_0x889a('0x47')],qs[_0x889a('0x4b')](_0x50256a[_0x889a('0x48')]['fields']));_0x325c9f[_0x889a('0x4a')]=_0x325c9f['attributes'][_0x889a('0x4c')]?_0x325c9f[_0x889a('0x4a')]:_0x250bcb[_0x889a('0x47')];_0x325c9f[_0x889a('0x6f')]=qs['sort'](_0x50256a['query'][_0x889a('0x4e')]);_0x325c9f[_0x889a('0x4f')]=qs[_0x889a('0x49')](_[_0x889a('0x50')](_0x50256a[_0x889a('0x48')],_0x250bcb[_0x889a('0x49')]));if(_0x50256a[_0x889a('0x48')]['filter']){_0x325c9f[_0x889a('0x4f')]=_['merge'](_0x325c9f[_0x889a('0x4f')],{'$or':_['map'](_0x325c9f[_0x889a('0x4a')],function(_0x9600bf){var _0x2a6f29={};_0x2a6f29[_0x9600bf]={'$like':'%'+_0x50256a[_0x889a('0x48')]['filter']+'%'};return _0x2a6f29;})});}_0x325c9f=_[_0x889a('0x3d')]({},_0x325c9f,_0x50256a[_0x889a('0x5c')]);return _0x5b0dc0[_0x889a('0x88')](_0x325c9f);}})['then'](function(_0x151859){if(_0x151859){_0x128ffe=_0x151859[_0x889a('0x4c')];if(!_0x50256a[_0x889a('0x48')][_0x889a('0x4d')]('nolimit')){_0x325c9f['limit']=qs[_0x889a('0x31')](_0x50256a[_0x889a('0x48')]['limit']);_0x325c9f['offset']=qs[_0x889a('0x2f')](_0x50256a[_0x889a('0x48')][_0x889a('0x2f')]);}return _0x5b0dc0[_0x889a('0x88')](_0x325c9f);}})['then'](function(_0x26df8f){if(_0x26df8f){return _0x26df8f?{'count':_0x128ffe,'rows':_0x26df8f}:null;}})[_0x889a('0x35')](respondWithResult(_0x43eda9,null))[_0x889a('0x2a')](handleError(_0x43eda9,null));};function Extension(_0xc44317,_0x188410,_0x275e06,_0xbfd175){this[_0x889a('0x89')]=_0x889a('0x8a');this['exten']=_0xc44317[_0x889a('0x8b')];this[_0x889a('0x8c')]=_0xbfd175;this[_0x889a('0x45')]=_0x889a('0x8d');this[_0x889a('0x8e')]='Fax\x20Extension';this['FaxAccountId']=_0xc44317['id'];this['priority']=_0x188410;this[_0x889a('0x8f')]=_0x275e06;}function createExtensionsReciveFax(_0x422678){var _0x295d23=0x1;var _0x2721ef=[];_0x2721ef[_0x889a('0x90')](new Extension(_0x422678,_0x295d23,'',_0x889a('0x91')));_0x295d23+=0x1;_0x2721ef[_0x889a('0x90')](new Extension(_0x422678,_0x295d23,_0x889a('0x92'),_0x889a('0x93')));_0x295d23+=0x1;for(var _0xe2ab05 in _0x422678){if(_0x422678[_0x889a('0x4d')](_0xe2ab05)&&(_0xe2ab05===_0x889a('0x94')||_0xe2ab05===_0x889a('0x8b')||_0xe2ab05===_0x889a('0x95')||_0xe2ab05===_0x889a('0x96')||_0xe2ab05===_0x889a('0x97')||_0xe2ab05==='maxrate'||_0xe2ab05===_0x889a('0x98')||_0xe2ab05===_0x889a('0x99')||_0xe2ab05===_0x889a('0x9a'))){_0x2721ef[_0x889a('0x90')](new Extension(_0x422678,_0x295d23,_0x889a('0x9b')+_0xe2ab05+')='+_0x422678[_0xe2ab05],_0x889a('0x93')));_0x295d23+=0x1;}}_0x2721ef['push'](new Extension(_0x422678,_0x295d23,'6','Wait'));_0x295d23+=0x1;_0x2721ef[_0x889a('0x90')](new Extension(_0x422678,_0x295d23,_0x889a('0x9c'),'ReceiveFax'));_0x295d23=0x0;return _0x2721ef;}exports[_0x889a('0x9d')]=function(_0x118fa9,_0xfd8080,_0x179e09){var _0x3e91a1;return db[_0x889a('0x82')][_0x889a('0x83')](function(_0x513638){return db['FaxAccount']['create'](_0x118fa9[_0x889a('0x3e')],{'transaction':_0x513638})['then'](function(_0x3c5c18){_0x3e91a1=_0x3c5c18[_0x889a('0x60')]({'plain':!![]});return db[_0x889a('0x9e')][_0x889a('0x85')](createExtensionsReciveFax(_0x3e91a1),{'transaction':_0x513638});});})[_0x889a('0x35')](function(){return _0x3e91a1;})['then'](respondWithResult(_0xfd8080,null))[_0x889a('0x2a')](handleError(_0xfd8080,null));};exports['updateAccountApplications']=function(_0x32b04c,_0x48850b,_0x580aec){var _0x271da2;return db['sequelize'][_0x889a('0x83')](function(_0x3cb94b){return db['FaxAccount'][_0x889a('0x67')](_0x32b04c[_0x889a('0x3e')],{'where':{'id':_0x32b04c['body']['id']},'transaction':_0x3cb94b})[_0x889a('0x35')](function(_0x50af8c){return db[_0x889a('0x9e')][_0x889a('0x36')]({'where':{'FaxAccountId':_0x32b04c[_0x889a('0x3e')]['id']},'transaction':_0x3cb94b})['then'](function(_0x452131){return db[_0x889a('0x9e')][_0x889a('0x85')](createExtensionsReciveFax(_[_0x889a('0x9f')](_0x32b04c[_0x889a('0x3e')],['tech',_0x889a('0x46'),'createdAt','updatedAt','TrunkId',_0x889a('0xa0')])),{'transaction':_0x3cb94b});});});})[_0x889a('0x35')](function(){return db[_0x889a('0x59')][_0x889a('0xa1')](_0x32b04c['body']['id']);})[_0x889a('0x35')](respondWithResult(_0x48850b,null))[_0x889a('0x2a')](handleError(_0x48850b,null));};exports[_0x889a('0xa2')]=function(_0x449faf,_0x4bc71a,_0x11c743){var _0x41834e={'raw':!![],'where':{}};var _0xb26db={};var _0x32f47f={'count':0x0,'rows':[]};return db[_0x889a('0x59')][_0x889a('0x74')]({'where':{'id':_0x449faf[_0x889a('0x56')]['id']}})[_0x889a('0x35')](handleEntityNotFound(_0x4bc71a,null))['then'](function(_0xc6204c){if(_0xc6204c){_0xb26db[_0x889a('0x47')]=_[_0x889a('0x58')](db[_0x889a('0xa3')]['rawAttributes']);_0xb26db[_0x889a('0x48')]=_[_0x889a('0x58')](_0x449faf['query']);_0xb26db['filters']=_[_0x889a('0x6d')](_0xb26db['model'],_0xb26db[_0x889a('0x48')]);_0x41834e[_0x889a('0x4a')]=_[_0x889a('0x6d')](_0xb26db[_0x889a('0x47')],qs[_0x889a('0x4b')](_0x449faf[_0x889a('0x48')][_0x889a('0x4b')]));_0x41834e[_0x889a('0x4a')]=_0x41834e[_0x889a('0x4a')]['length']?_0x41834e['attributes']:_0xb26db[_0x889a('0x47')];if(!_0x449faf['query'][_0x889a('0x4d')](_0x889a('0x6e'))){_0x41834e['limit']=qs['limit'](_0x449faf[_0x889a('0x48')][_0x889a('0x31')]);_0x41834e['offset']=qs[_0x889a('0x2f')](_0x449faf['query']['offset']);}_0x41834e[_0x889a('0x6f')]=qs['sort'](_0x449faf[_0x889a('0x48')][_0x889a('0x4e')]);_0x41834e[_0x889a('0x4f')]=qs[_0x889a('0x49')](_[_0x889a('0x50')](_0x449faf['query'],_0xb26db[_0x889a('0x49')]));_0x41834e[_0x889a('0x4f')][_0x889a('0x6b')]=_0xc6204c['id'];if(_0x449faf[_0x889a('0x48')]['filter']){_0x41834e[_0x889a('0x4f')]=_[_0x889a('0x3d')](_0x41834e['where'],{'$or':_[_0x889a('0x42')](_0x41834e[_0x889a('0x4a')],function(_0x1b0b30){var _0x746fac={};_0x746fac[_0x1b0b30]={'$like':'%'+_0x449faf[_0x889a('0x48')][_0x889a('0x51')]+'%'};return _0x746fac;})});}if(_0x449faf[_0x889a('0x48')]['$gte']){var _0x29ac6b=_0x449faf[_0x889a('0x48')]['$gte'][_0x889a('0xa4')](',');var _0x17410e={};_0x17410e[_0x29ac6b[0x0]]={'$gte':moment(_0x29ac6b[0x1])[_0x889a('0xa5')](_0x889a('0xa6'))};_0x41834e[_0x889a('0x4f')]=_[_0x889a('0x3d')](_0x41834e[_0x889a('0x4f')],_0x17410e);}_0x41834e=_[_0x889a('0x3d')]({},_0x41834e,_0x449faf[_0x889a('0x5c')]);return db[_0x889a('0xa3')][_0x889a('0x32')]({'where':_0x41834e[_0x889a('0x4f')]})[_0x889a('0x35')](function(_0x3819db){_0x32f47f[_0x889a('0x32')]=_0x3819db;if(_0x449faf[_0x889a('0x48')]['includeAll']){_0x41834e[_0x889a('0x5b')]=[{'all':!![]}];}return db['FaxMessage'][_0x889a('0x53')](_0x41834e);})['then'](function(_0x7e1e63){_0x32f47f[_0x889a('0x54')]=_0x7e1e63;return _0x32f47f;});}})[_0x889a('0x35')](respondWithFilteredResult(_0x4bc71a,_0x41834e))['catch'](handleError(_0x4bc71a,null));};exports[_0x889a('0x3b')]=function(_0xda9ef2,_0x111f51,_0x2eb5c1){var _0x55dfa3,_0x1b6761={},_0x3481b2;if(_0xda9ef2['body']['to']){_0x3481b2=_0xda9ef2['body']['to'][0x0];}return db['FaxAccount'][_0x889a('0x5d')]({'where':{'id':_0xda9ef2['params']['id']},'include':[{'model':db['CmList'],'as':_0x889a('0xa7'),'include':[{'model':db[_0x889a('0x7a')],'as':'Contacts','where':{'fax':_0x3481b2},'limit':0x1,'order':[[_0x889a('0xa8'),_0x889a('0xa9')]]}]}]})[_0x889a('0x35')](handleEntityNotFound(_0x111f51,null))[_0x889a('0x35')](function(_0x2c2bc9){_0x55dfa3=_0x2c2bc9;if(_0xda9ef2['body'][_0x889a('0xaa')]&&_0xda9ef2['body'][_0x889a('0xaa')]['length']){for(var _0x34cdf5=0x0;_0x34cdf5<_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][_0x889a('0x4c')];_0x34cdf5+=0x1){_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][_0x34cdf5]={'filename':_0xda9ef2['body']['attachments'][_0x34cdf5][_0x889a('0x3a')],'id':_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][_0x34cdf5]['id'],'path':path[_0x889a('0xab')](config[_0x889a('0xac')],_0x889a('0xad'),_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][_0x34cdf5][_0x889a('0xae')])};}}return respondWithRpcPromise(_0x889a('0xaf'),_0x889a('0xaf'),{'FaxAccountId':_[_0x889a('0xb0')](_0xda9ef2[_0x889a('0x56')]['id'])?undefined:_0xda9ef2['params']['id'],'path':_['isNil'](_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][0x0][_0x889a('0x7')])?undefined:_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][0x0][_0x889a('0x7')],'fax':_['isNil'](_0xda9ef2[_0x889a('0x3e')]['to'][0x0])?undefined:_0xda9ef2[_0x889a('0x3e')]['to'][0x0]},client9002);})['then'](function(){if(_0x55dfa3){if(_[_0x889a('0xb0')](_0xda9ef2[_0x889a('0x3e')][_0x889a('0xb1')])){_0xda9ef2[_0x889a('0x3e')][_0x889a('0xb1')]=util[_0x889a('0xa5')]('\x22%s\x22\x20<%s>',_0x55dfa3[_0x889a('0x3a')],_0x55dfa3['fax']);}if(_0x55dfa3[_0x889a('0xa7')]){if(_0x55dfa3['List']['Contacts'][_0x889a('0x4c')]){return _0x55dfa3['List'][_0x889a('0xb2')][0x0];}else{return db[_0x889a('0x7a')][_0x889a('0x5e')](_[_0x889a('0x18')](_0xda9ef2[_0x889a('0x3e')],{'firstName':_0xda9ef2[_0x889a('0x3e')]['to'][0x0],'phone':_0xda9ef2[_0x889a('0x3e')]['to'][0x0],'fax':_0xda9ef2[_0x889a('0x3e')]['to'][0x0],'ListId':_0x55dfa3[_0x889a('0xa0')]}));}}else{throw new Error(_0x889a('0xb3'));}}else{throw new Error(_0x889a('0xb4'));}})[_0x889a('0x35')](function(_0x559787){if(_0x559787){return db[_0x889a('0x77')][_0x889a('0x5d')]({'where':{'ContactId':_0x559787['id'],'closed':![],'FaxAccountId':_0x55dfa3['id']}})[_0x889a('0x35')](function(_0x1d3c35){if(_0x1d3c35){return[_0x1d3c35,![]];}return db[_0x889a('0x77')][_0x889a('0x5e')]({'UserId':_0xda9ef2[_0x889a('0x5f')]['id'],'ContactId':_0x559787['id'],'FaxAccountId':_0x55dfa3['id'],'fax':_0xda9ef2[_0x889a('0x3e')]['to'][0x0],'firstMsgDirection':_0x889a('0xb5'),'Messages':[_[_0x889a('0x3d')](_0xda9ef2[_0x889a('0x3e')],{'read':![],'body':_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][0x0][_0x889a('0xb6')],'FaxAccountId':_0x55dfa3['id'],'UserId':_0xda9ef2[_0x889a('0x5f')]['id'],'ContactId':_0x559787['id'],'AttachmentId':_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x889a('0xa3')],'as':_0x889a('0xb7')}]})['then'](function(_0x7c199){return[_0x7c199,!![]];});});}else{throw new Error(_0x889a('0xb8'));}})[_0x889a('0xb9')](function(_0xc44263,_0x2217e9){if(_0x2217e9){return _0xc44263;}return db[_0x889a('0xa3')][_0x889a('0x5e')]({'direction':_0x889a('0xb5'),'read':![],'body':_0xda9ef2[_0x889a('0x3e')]['attachments'][0x0]['filename'],'FaxAccountId':_0x55dfa3['id'],'FaxInteractionId':_0xc44263['id'],'UserId':_0xda9ef2[_0x889a('0x5f')]['id'],'ContactId':_0xc44263[_0x889a('0xba')],'AttachmentId':_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][0x0]['id']})['then'](function(_0x34c6fa){_0xc44263[_0x889a('0xbb')]['Messages']=[];_0xc44263[_0x889a('0xbb')][_0x889a('0xb7')][_0x889a('0x90')](_0x34c6fa[_0x889a('0xbb')]);return _0xc44263;});})[_0x889a('0x35')](function(_0x145018){respondWithRpcPromise(_0x889a('0xbc'),_0x889a('0xbc'),{'FaxAccountId':_[_0x889a('0xb0')](_0xda9ef2['params']['id'])?undefined:_0xda9ef2[_0x889a('0x56')]['id'],'path':_[_0x889a('0xb0')](_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][0x0][_0x889a('0x7')])?undefined:_0xda9ef2[_0x889a('0x3e')][_0x889a('0xaa')][0x0]['path'],'fax':_[_0x889a('0xb0')](_0xda9ef2['body']['to'][0x0])?undefined:_0xda9ef2[_0x889a('0x3e')]['to'][0x0],'AttachmentId':_0xda9ef2['body']['attachments'][0x0]['id']},client9002)[_0x889a('0x35')](function(_0x18f9c3){logger['info'](_0x889a('0xbd'),_0x18f9c3);})[_0x889a('0x2a')](function(_0x483240){logger[_0x889a('0x20')](_0x889a('0xbd'),_0x483240);});return _0x145018;})[_0x889a('0x35')](respondWithResult(_0x111f51,null))[_0x889a('0x2a')](handleError(_0x111f51,null));};exports[_0x889a('0xbe')]=function(_0x4c0497,_0x336564,_0x4eee48){return db[_0x889a('0x59')][_0x889a('0x5d')]({'where':{'id':_0x4c0497[_0x889a('0x56')]['id']}})[_0x889a('0x35')](handleEntityNotFound(_0x336564,null))[_0x889a('0x35')](function(_0x307dc8){if(_0x307dc8){return _0x307dc8[_0x889a('0xbe')](_0x4c0497['body']['ids'],_[_0x889a('0x9f')](_0x4c0497['body'],[_0x889a('0x78'),'id'])||{})['spread'](function(_0x220c52){for(var _0x455c3f=0x0;_0x455c3f<_0x4c0497[_0x889a('0x3e')][_0x889a('0x78')][_0x889a('0x4c')];_0x455c3f+=0x1){socket['emit'](_0x889a('0xbf'),{'UserId':_0x4c0497[_0x889a('0x3e')][_0x889a('0x78')][_0x455c3f],'FaxAccountId':_0x4c0497[_0x889a('0x56')]['id']});}return _0x220c52;});}})[_0x889a('0x35')](respondWithResult(_0x336564,null))[_0x889a('0x2a')](handleError(_0x336564,null));};exports[_0x889a('0xc0')]=function(_0x3d4936,_0x3791f6,_0x5b5190){return db[_0x889a('0x59')]['find']({'where':{'id':_0x3d4936[_0x889a('0x56')]['id']}})[_0x889a('0x35')](handleEntityNotFound(_0x3791f6,null))[_0x889a('0x35')](function(_0x20a8fc){if(_0x20a8fc){return _0x20a8fc['removeAgents'](_0x3d4936[_0x889a('0x48')][_0x889a('0x78')])[_0x889a('0x35')](function(){if(_[_0x889a('0xc1')](_0x3d4936[_0x889a('0x48')][_0x889a('0x78')])){for(var _0x5d5e=0x0;_0x5d5e<_0x3d4936[_0x889a('0x48')]['ids'][_0x889a('0x4c')];_0x5d5e+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3d4936[_0x889a('0x48')][_0x889a('0x78')][_0x5d5e]),'FaxAccountId':Number(_0x3d4936[_0x889a('0x56')]['id'])});}}else{socket[_0x889a('0xc2')](_0x889a('0xc3'),{'UserId':Number(_0x3d4936[_0x889a('0x48')][_0x889a('0x78')]),'FaxAccountId':Number(_0x3d4936[_0x889a('0x56')]['id'])});}});}})[_0x889a('0x35')](respondWithStatusCode(_0x3791f6,null))[_0x889a('0x2a')](handleError(_0x3791f6,null));};exports[_0x889a('0xc4')]=function(_0x47f84b,_0xdbd27f,_0x168fa4){var _0x47d665={};var _0x50cabc={};var _0x5f1784;var _0x5c684f;return db['FaxAccount'][_0x889a('0x74')]({'where':{'id':_0x47f84b[_0x889a('0x56')]['id']}})[_0x889a('0x35')](handleEntityNotFound(_0xdbd27f,null))['then'](function(_0x4710bf){if(_0x4710bf){_0x5f1784=_0x4710bf;_0x50cabc[_0x889a('0x47')]=_['keys'](db['User'][_0x889a('0x43')]);_0x50cabc[_0x889a('0x48')]=_[_0x889a('0x58')](_0x47f84b['query']);_0x50cabc[_0x889a('0x49')]=_[_0x889a('0x6d')](_0x50cabc[_0x889a('0x47')],_0x50cabc[_0x889a('0x48')]);_0x47d665[_0x889a('0x4a')]=_[_0x889a('0x6d')](_0x50cabc[_0x889a('0x47')],qs[_0x889a('0x4b')](_0x47f84b['query'][_0x889a('0x4b')]));_0x47d665[_0x889a('0x4a')]=_0x47d665['attributes']['length']?_0x47d665[_0x889a('0x4a')]:_0x50cabc[_0x889a('0x47')];_0x47d665[_0x889a('0x6f')]=qs[_0x889a('0x4e')](_0x47f84b['query'][_0x889a('0x4e')]);_0x47d665[_0x889a('0x4f')]=qs['filters'](_[_0x889a('0x50')](_0x47f84b[_0x889a('0x48')],_0x50cabc['filters']));if(_0x47f84b[_0x889a('0x48')]['filter']){_0x47d665[_0x889a('0x4f')]=_[_0x889a('0x3d')](_0x47d665[_0x889a('0x4f')],{'$or':_[_0x889a('0x42')](_0x47d665[_0x889a('0x4a')],function(_0x12545d){var _0x23aa17={};_0x23aa17[_0x12545d]={'$like':'%'+_0x47f84b[_0x889a('0x48')][_0x889a('0x51')]+'%'};return _0x23aa17;})});}_0x47d665=_[_0x889a('0x3d')]({},_0x47d665,_0x47f84b[_0x889a('0x5c')]);return _0x5f1784[_0x889a('0xc4')](_0x47d665);}})[_0x889a('0x35')](function(_0x5ac0e2){if(_0x5ac0e2){_0x5c684f=_0x5ac0e2[_0x889a('0x4c')];if(!_0x47f84b[_0x889a('0x48')][_0x889a('0x4d')](_0x889a('0x6e'))){_0x47d665[_0x889a('0x31')]=qs[_0x889a('0x31')](_0x47f84b['query'][_0x889a('0x31')]);_0x47d665[_0x889a('0x2f')]=qs['offset'](_0x47f84b[_0x889a('0x48')][_0x889a('0x2f')]);}return _0x5f1784[_0x889a('0xc4')](_0x47d665);}})[_0x889a('0x35')](function(_0x4aceeb){if(_0x4aceeb){return _0x4aceeb?{'count':_0x5c684f,'rows':_0x4aceeb}:null;}})[_0x889a('0x35')](respondWithResult(_0xdbd27f,null))[_0x889a('0x2a')](handleError(_0xdbd27f,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index a867465..4711410 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 _0xe0c9=['hook','exports','events','../../mysqldb','FaxAccount','update','remove','emit'];(function(_0x5bccfc,_0x1f9ae5){var _0x1ec61b=function(_0x142581){while(--_0x142581){_0x5bccfc['push'](_0x5bccfc['shift']());}};_0x1ec61b(++_0x1f9ae5);}(_0xe0c9,0x1ba));var _0x9e0c=function(_0x4e52d6,_0x2b6f99){_0x4e52d6=_0x4e52d6-0x0;var _0x121aac=_0xe0c9[_0x4e52d6];return _0x121aac;};'use strict';var EventEmitter=require(_0x9e0c('0x0'));var FaxAccount=require(_0x9e0c('0x1'))['db'][_0x9e0c('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9e0c('0x3'),'afterDestroy':_0x9e0c('0x4')};function emitEvent(_0x1464fe){return function(_0x4351cf,_0x3b2a59,_0x34d32d){FaxAccountEvents[_0x9e0c('0x5')](_0x1464fe+':'+_0x4351cf['id'],_0x4351cf);FaxAccountEvents['emit'](_0x1464fe,_0x4351cf);_0x34d32d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x9e0c('0x6')](e,emitEvent(event));}}module[_0x9e0c('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x69cb=['emit','hasOwnProperty','hook','../../mysqldb','FaxAccount','setMaxListeners','update'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x69cb,0x10d));var _0xb69c=function(_0x27179a,_0x1583a3){_0x27179a=_0x27179a-0x0;var _0x355b44=_0x69cb[_0x27179a];return _0x355b44;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xb69c('0x0'))['db'][_0xb69c('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb69c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb69c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d06ce){return function(_0xfeca89,_0x2ab8fc,_0x36f52e){FaxAccountEvents[_0xb69c('0x4')](_0x2d06ce+':'+_0xfeca89['id'],_0xfeca89);FaxAccountEvents[_0xb69c('0x4')](_0x2d06ce,_0xfeca89);_0x36f52e(null);};}for(var e in events){if(events[_0xb69c('0x5')](e)){var event=events[e];FaxAccount[_0xb69c('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 3824c63..d5f81ae 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 _0x0957=['FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0957,0x9e));var _0x7095=function(_0x7dc666,_0x12727f){_0x7dc666=_0x7dc666-0x0;var _0x23242a=_0x0957[_0x7dc666];return _0x23242a;};'use strict';var _=require(_0x7095('0x0'));var util=require(_0x7095('0x1'));var logger=require(_0x7095('0x2'))(_0x7095('0x3'));var moment=require(_0x7095('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7095('0x5'));var rimraf=require(_0x7095('0x6'));var config=require(_0x7095('0x7'));var attributes=require(_0x7095('0x8'));module[_0x7095('0x9')]=function(_0x185561,_0x1fff7f){return _0x185561[_0x7095('0xa')](_0x7095('0xb'),attributes,{'tableName':_0x7095('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f4b=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x16a302,_0x3e6cf9){var _0x2209f7=function(_0x5a3eba){while(--_0x5a3eba){_0x16a302['push'](_0x16a302['shift']());}};_0x2209f7(++_0x3e6cf9);}(_0x4f4b,0x1de));var _0xb4f4=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x4f4b[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xb4f4('0x0'));var util=require(_0xb4f4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb4f4('0x2'));var BPromise=require(_0xb4f4('0x3'));var rp=require(_0xb4f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4f4('0x5'));var config=require(_0xb4f4('0x6'));var attributes=require(_0xb4f4('0x7'));module[_0xb4f4('0x8')]=function(_0x3abc26,_0x178a43){return _0x3abc26[_0xb4f4('0x9')](_0xb4f4('0xa'),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 e1129d9..5dc14db 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 _0x18c7=['CompanyId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','CmContact','Contacts','updatedAt','FaxApplication','Applications','List','get','applications','list','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','close','*,*,*,*','interaction','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','FaxAccount','findAll','options','raw','where','limit','include','model','attributes','map','GetFaxAccount','NotifyFaxAccount','body','fax','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x18c7,0x83));var _0x718c=function(_0x309279,_0x134a93){_0x309279=_0x309279-0x0;var _0x2ec8e8=_0x18c7[_0x309279];return _0x2ec8e8;};'use strict';var _=require(_0x718c('0x0'));var util=require('util');var moment=require(_0x718c('0x1'));var BPromise=require(_0x718c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x718c('0x3'))['db'];var utils=require(_0x718c('0x4'));var logger=require('../../config/logger')(_0x718c('0x5'));var config=require('../../config/environment');var jayson=require(_0x718c('0x6'));var client=jayson[_0x718c('0x7')][_0x718c('0x8')]({'port':0x232c});config[_0x718c('0x9')]=_[_0x718c('0xa')](config[_0x718c('0x9')],{'host':_0x718c('0xb'),'port':0x18eb});var socket=require(_0x718c('0xc'))(new Redis(config[_0x718c('0x9')]));require(_0x718c('0xd'))[_0x718c('0xe')](socket);function respondWithRpcPromise(_0x5920ed,_0x5a0e86,_0xc09454){return new BPromise(function(_0x3f9f77,_0x365c3e){return client['request'](_0x5920ed,_0xc09454)[_0x718c('0xf')](function(_0xc3338c){logger['info']('FaxAccount,\x20%s,\x20%s',_0x5a0e86,_0x718c('0x10'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5a0e86,_0x718c('0x10'),JSON[_0x718c('0x11')](_0xc3338c));if(_0xc3338c[_0x718c('0x12')]){if(_0xc3338c[_0x718c('0x12')][_0x718c('0x13')]===0x1f4){logger[_0x718c('0x12')](_0x718c('0x14'),_0x5a0e86,_0xc3338c['error'][_0x718c('0x15')]);return _0x365c3e(_0xc3338c[_0x718c('0x12')][_0x718c('0x15')]);}logger[_0x718c('0x12')](_0x718c('0x14'),_0x5a0e86,_0xc3338c[_0x718c('0x12')][_0x718c('0x15')]);return _0x3f9f77(_0xc3338c[_0x718c('0x12')][_0x718c('0x15')]);}else{logger[_0x718c('0x16')](_0x718c('0x14'),_0x5a0e86,'request\x20sent');_0x3f9f77(_0xc3338c[_0x718c('0x17')][_0x718c('0x15')]);}})[_0x718c('0x18')](function(_0x21769d){logger[_0x718c('0x12')](_0x718c('0x14'),_0x5a0e86,_0x21769d);_0x365c3e(_0x21769d);});});}exports['GetFaxAccount']=function(_0x5efb72){var _0x3f8fff=this;return new Promise(function(_0x399d5f,_0x1a67ac){return db[_0x718c('0x19')][_0x718c('0x1a')]({'raw':_0x5efb72[_0x718c('0x1b')]?_0x5efb72['options'][_0x718c('0x1c')]===undefined?!![]:![]:!![],'where':_0x5efb72['options']?_0x5efb72[_0x718c('0x1b')][_0x718c('0x1d')]||null:null,'attributes':_0x5efb72[_0x718c('0x1b')]?_0x5efb72[_0x718c('0x1b')]['attributes']||null:null,'limit':_0x5efb72[_0x718c('0x1b')]?_0x5efb72[_0x718c('0x1b')][_0x718c('0x1e')]||null:null,'include':_0x5efb72[_0x718c('0x1b')]?_0x5efb72[_0x718c('0x1b')][_0x718c('0x1f')]?_['map'](_0x5efb72['options']['include'],function(_0x1b8289){return{'model':db[_0x1b8289[_0x718c('0x20')]],'as':_0x1b8289['as'],'attributes':_0x1b8289[_0x718c('0x21')],'include':_0x1b8289[_0x718c('0x1f')]?_['map'](_0x1b8289[_0x718c('0x1f')],function(_0x56cd70){return{'model':db[_0x56cd70['model']],'as':_0x56cd70['as'],'attributes':_0x56cd70[_0x718c('0x21')],'include':_0x56cd70[_0x718c('0x1f')]?_[_0x718c('0x22')](_0x56cd70['include'],function(_0x4f5c5d){return{'model':db[_0x4f5c5d[_0x718c('0x20')]],'as':_0x4f5c5d['as'],'attributes':_0x4f5c5d[_0x718c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x718c('0xf')](function(_0xfb0f12){logger[_0x718c('0x16')](_0x718c('0x23'),_0x5efb72);logger['debug']('GetFaxAccount',_0x5efb72,JSON[_0x718c('0x11')](_0xfb0f12));_0x399d5f(_0xfb0f12);})[_0x718c('0x18')](function(_0x363c5d){logger[_0x718c('0x12')](_0x718c('0x23'),_0x363c5d[_0x718c('0x15')],_0x5efb72);_0x1a67ac(_0x3f8fff[_0x718c('0x12')](0x1f4,_0x363c5d[_0x718c('0x15')]));});});};exports[_0x718c('0x24')]=function(_0x34af4b,_0x28ee38,_0x3ee328){var _0x592389=this;return new Promise(function(_0x1f6b9e,_0x18d56b){var _0x450276={'body':_0x34af4b[_0x718c('0x25')],'channel':_0x718c('0x26')};var _0x1197c0=[];var _0x359c9b=[];var _0x344dff={};return db['CmContact'][_0x718c('0x27')]()[_0x718c('0xf')](function(_0x24338b){if(!_0x24338b){throw new db[(_0x718c('0x28'))]['ValidationError'](_0x718c('0x29'));}_0x1197c0=_[_0x718c('0x2a')](_[_0x718c('0x2b')](_0x24338b),[_0x718c('0x2c'),'updatedAt']);_0x359c9b=_[_0x718c('0x2a')](_['keys'](_0x24338b),['createdAt','updatedAt',_0x718c('0x2d'),'ListId']);if(_0x34af4b[_0x718c('0x25')]['id']){delete _0x34af4b[_0x718c('0x25')]['id'];}if(_[_0x718c('0x2e')](_0x34af4b['body']['from'])){throw new db['Sequelize'][(_0x718c('0x2f'))](_0x718c('0x30'));}if(_[_0x718c('0x2e')](_0x34af4b[_0x718c('0x25')][_0x718c('0x25')])||_0x34af4b['body']['body']===''){throw new db[(_0x718c('0x28'))]['ValidationError'](_0x718c('0x31'));}if(_['isNil'](_0x34af4b[_0x718c('0x25')][_0x718c('0x32')])){throw new db[(_0x718c('0x28'))]['ValidationError'](_0x718c('0x33')+_0x359c9b);}if(!_['includes'](_0x359c9b,_0x34af4b[_0x718c('0x25')][_0x718c('0x32')])){throw new db[(_0x718c('0x28'))]['ValidationError'](_0x718c('0x34')+_0x359c9b);}_0x344dff[_0x34af4b[_0x718c('0x25')][_0x718c('0x32')]]=_0x34af4b[_0x718c('0x25')][_0x718c('0x35')];})[_0x718c('0xf')](function(){return db[_0x718c('0x19')][_0x718c('0x36')]({'where':{'id':_0x34af4b[_0x718c('0x37')]['id']},'include':[{'model':db[_0x718c('0x38')],'as':'List','include':[{'model':db[_0x718c('0x39')],'as':_0x718c('0x3a'),'where':_0x344dff,'limit':0x1,'order':[[_0x718c('0x3b'),'DESC']]}]},{'model':db[_0x718c('0x3c')],'as':_0x718c('0x3d')}]});})['then'](function(_0x4b2fab){if(_0x4b2fab&&_0x4b2fab[_0x718c('0x3e')]){var _0x48ca58=_0x4b2fab[_0x718c('0x3f')]({'plain':!![]});_0x450276[_0x718c('0x37')]=_0x48ca58;_0x450276[_0x718c('0x40')]=_0x48ca58[_0x718c('0x3d')];_0x450276[_0x718c('0x41')]=_0x48ca58[_0x718c('0x3e')];_0x450276[_0x718c('0x40')]=_[_0x718c('0x42')](_0x450276[_0x718c('0x40')],[_0x718c('0x43')],[_0x718c('0x44')]);if(_0x450276['account'][_0x718c('0x3d')]){delete _0x450276[_0x718c('0x37')][_0x718c('0x3d')];}if(_0x450276[_0x718c('0x37')][_0x718c('0x3e')]&&_0x450276[_0x718c('0x37')][_0x718c('0x3e')][_0x718c('0x3a')][_0x718c('0x45')]){return _0x450276['account'][_0x718c('0x3e')][_0x718c('0x3a')][0x0];}var _0x1cefc5=_['defaults'](_0x34af4b[_0x718c('0x25')],{'firstName':_0x34af4b[_0x718c('0x25')]['from'],'ListId':_0x48ca58['ListId']});_0x1cefc5[_0x34af4b['body'][_0x718c('0x32')]]=_0x34af4b[_0x718c('0x25')][_0x718c('0x35')];return db['CmContact'][_0x718c('0x46')](_0x1cefc5,{'fields':_0x1197c0,'raw':!![]});}})[_0x718c('0xf')](function(_0x2e63e4){_0x450276[_0x718c('0x47')]=_0x2e63e4;if(_0x2e63e4){var _0x12ac3c={'ContactId':_0x2e63e4['id'],'FaxAccountId':_0x34af4b[_0x718c('0x37')]['id'],'fax':_0x2e63e4[_0x718c('0x26')]};return db[_0x718c('0x48')]['find']({'where':{'ContactId':_0x2e63e4['id'],'closed':![],'FaxAccountId':_0x34af4b[_0x718c('0x37')]['id']}})[_0x718c('0xf')](function(_0x4c7c54){if(_0x4c7c54){return[_0x4c7c54,![]];}return db['FaxInteraction'][_0x718c('0x46')](_0x12ac3c)[_0x718c('0xf')](function(_0x7d3ac2){return[_0x7d3ac2,!![]];});});}else{throw new Error(_0x718c('0x49'));}})['spread'](function(_0x3bdfa7,_0x3af7d2){var _0x46dfea=_0x3bdfa7['get']({'plain':!![]});if(_0x3af7d2){if(_0x450276[_0x718c('0x37')][_0x718c('0x4a')]){_0x450276[_0x718c('0x40')]['push']({'id':0x0,'priority':_0x450276[_0x718c('0x40')][_0x718c('0x45')]+0x1,'app':_0x718c('0x4b'),'appdata':'unmanaged','interval':_0x718c('0x4c')});}_0x46dfea['created']=!![];}else{_0x46dfea['created']=![];}_0x450276[_0x718c('0x4d')]=_0x46dfea;return db['FaxMessage'][_0x718c('0x46')]({'body':_0x34af4b[_0x718c('0x25')]['body'],'FaxAccountId':_0x34af4b[_0x718c('0x37')]['id'],'FaxInteractionId':_0x3bdfa7['id'],'direction':'in','ContactId':_0x3bdfa7[_0x718c('0x4e')],'AttachmentId':_0x34af4b['body'][_0x718c('0x4f')]});})[_0x718c('0xf')](function(_0x1b4951){_0x450276[_0x718c('0x15')]=_0x1b4951;if(_0x450276['interaction'][_0x718c('0x50')]){return db[_0x718c('0x51')]['find']({'attributes':['id',_0x718c('0x52')],'where':{'id':_0x450276[_0x718c('0x4d')][_0x718c('0x50')]}})['then'](function(_0x549b98){if(_0x549b98){_0x450276[_0x718c('0x40')][_0x718c('0x53')]({'id':0x0,'priority':0x0,'app':_0x718c('0x54'),'appdata':_0x549b98[_0x718c('0x52')]+','+(_0x450276['account'][_0x718c('0x55')]||0xa),'interval':_0x718c('0x4c')});}return respondWithRpcPromise('Start',_0x718c('0x56'),_0x450276);});}return respondWithRpcPromise(_0x718c('0x57'),_0x718c('0x56'),_0x450276);})['then'](function(_0x3692dc){_0x1f6b9e(_0x3692dc);})[_0x718c('0x18')](function(_0x12d25a){_0x18d56b(_0x592389['error'](0x1f4,_0x12d25a[_0x718c('0x15')]));});});}; \ No newline at end of file +var _0xacf4=['client','http','redis','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','catch','GetFaxAccount','findAll','options','raw','where','include','map','model','attributes','stringify','NotifyFaxAccount','body','fax','CmContact','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','applications','Applications','list','orderBy','asc','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xacf4,0xac));var _0x4acf=function(_0x1bd822,_0x1c8078){_0x1bd822=_0x1bd822-0x0;var _0x3c3a69=_0xacf4[_0x1bd822];return _0x3c3a69;};'use strict';var _=require(_0x4acf('0x0'));var util=require(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rs=require(_0x4acf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4acf('0x5'))['db'];var utils=require(_0x4acf('0x6'));var logger=require(_0x4acf('0x7'))('rpc');var config=require(_0x4acf('0x8'));var jayson=require(_0x4acf('0x9'));var client=jayson[_0x4acf('0xa')][_0x4acf('0xb')]({'port':0x232c});config[_0x4acf('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4acf('0xc')]));require('./faxAccount.socket')[_0x4acf('0xd')](socket);function respondWithRpcPromise(_0x467bc5,_0x2e4c95,_0x122e4a){return new BPromise(function(_0xc96b6b,_0x69c63c){return client[_0x4acf('0xe')](_0x467bc5,_0x122e4a)[_0x4acf('0xf')](function(_0x158f6f){logger['info'](_0x4acf('0x10'),_0x2e4c95,_0x4acf('0x11'));logger[_0x4acf('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2e4c95,_0x4acf('0x11'),JSON['stringify'](_0x158f6f));if(_0x158f6f[_0x4acf('0x13')]){if(_0x158f6f[_0x4acf('0x13')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2e4c95,_0x158f6f['error'][_0x4acf('0x14')]);return _0x69c63c(_0x158f6f[_0x4acf('0x13')][_0x4acf('0x14')]);}logger[_0x4acf('0x13')](_0x4acf('0x10'),_0x2e4c95,_0x158f6f[_0x4acf('0x13')][_0x4acf('0x14')]);return _0xc96b6b(_0x158f6f['error'][_0x4acf('0x14')]);}else{logger[_0x4acf('0x15')](_0x4acf('0x10'),_0x2e4c95,_0x4acf('0x11'));_0xc96b6b(_0x158f6f['result'][_0x4acf('0x14')]);}})[_0x4acf('0x16')](function(_0x49bda2){logger[_0x4acf('0x13')]('FaxAccount,\x20%s,\x20%s',_0x2e4c95,_0x49bda2);_0x69c63c(_0x49bda2);});});}exports[_0x4acf('0x17')]=function(_0xf73e79){var _0x2a5b8a=this;return new Promise(function(_0xd45a39,_0x561b1a){return db['FaxAccount'][_0x4acf('0x18')]({'raw':_0xf73e79[_0x4acf('0x19')]?_0xf73e79[_0x4acf('0x19')][_0x4acf('0x1a')]===undefined?!![]:![]:!![],'where':_0xf73e79[_0x4acf('0x19')]?_0xf73e79[_0x4acf('0x19')][_0x4acf('0x1b')]||null:null,'attributes':_0xf73e79[_0x4acf('0x19')]?_0xf73e79[_0x4acf('0x19')]['attributes']||null:null,'limit':_0xf73e79[_0x4acf('0x19')]?_0xf73e79['options']['limit']||null:null,'include':_0xf73e79[_0x4acf('0x19')]?_0xf73e79[_0x4acf('0x19')][_0x4acf('0x1c')]?_[_0x4acf('0x1d')](_0xf73e79[_0x4acf('0x19')]['include'],function(_0x2f7a48){return{'model':db[_0x2f7a48[_0x4acf('0x1e')]],'as':_0x2f7a48['as'],'attributes':_0x2f7a48[_0x4acf('0x1f')],'include':_0x2f7a48[_0x4acf('0x1c')]?_[_0x4acf('0x1d')](_0x2f7a48[_0x4acf('0x1c')],function(_0x108ef7){return{'model':db[_0x108ef7[_0x4acf('0x1e')]],'as':_0x108ef7['as'],'attributes':_0x108ef7['attributes'],'include':_0x108ef7[_0x4acf('0x1c')]?_[_0x4acf('0x1d')](_0x108ef7[_0x4acf('0x1c')],function(_0xedb78d){return{'model':db[_0xedb78d[_0x4acf('0x1e')]],'as':_0xedb78d['as'],'attributes':_0xedb78d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4acf('0xf')](function(_0x50302f){logger[_0x4acf('0x15')](_0x4acf('0x17'),_0xf73e79);logger[_0x4acf('0x12')](_0x4acf('0x17'),_0xf73e79,JSON[_0x4acf('0x20')](_0x50302f));_0xd45a39(_0x50302f);})['catch'](function(_0x2e3ec4){logger[_0x4acf('0x13')](_0x4acf('0x17'),_0x2e3ec4[_0x4acf('0x14')],_0xf73e79);_0x561b1a(_0x2a5b8a['error'](0x1f4,_0x2e3ec4[_0x4acf('0x14')]));});});};exports[_0x4acf('0x21')]=function(_0x16a237,_0x37464d,_0x4f6d6b){var _0x191cd1=this;return new Promise(function(_0x3d1744,_0x2b0198){var _0x78a9df={'body':_0x16a237[_0x4acf('0x22')],'channel':_0x4acf('0x23')};var _0x10bfac=[];var _0xf37d69=[];var _0x1cdb3b={};return db[_0x4acf('0x24')]['describe']()[_0x4acf('0xf')](function(_0x200f7){if(!_0x200f7){throw new db['Sequelize'][(_0x4acf('0x25'))]('no\x20available\x20attributes');}_0x10bfac=_[_0x4acf('0x26')](_[_0x4acf('0x27')](_0x200f7),[_0x4acf('0x28'),_0x4acf('0x29')]);_0xf37d69=_[_0x4acf('0x26')](_[_0x4acf('0x27')](_0x200f7),[_0x4acf('0x28'),_0x4acf('0x29'),_0x4acf('0x2a'),_0x4acf('0x2b')]);if(_0x16a237['body']['id']){delete _0x16a237[_0x4acf('0x22')]['id'];}if(_[_0x4acf('0x2c')](_0x16a237[_0x4acf('0x22')][_0x4acf('0x2d')])){throw new db[(_0x4acf('0x2e'))][(_0x4acf('0x25'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x16a237[_0x4acf('0x22')][_0x4acf('0x22')])||_0x16a237['body']['body']===''){throw new db['Sequelize'][(_0x4acf('0x25'))](_0x4acf('0x2f'));}if(_['isNil'](_0x16a237[_0x4acf('0x22')][_0x4acf('0x30')])){throw new db[(_0x4acf('0x2e'))]['ValidationError'](_0x4acf('0x31')+_0xf37d69);}if(!_[_0x4acf('0x32')](_0xf37d69,_0x16a237[_0x4acf('0x22')][_0x4acf('0x30')])){throw new db['Sequelize'][(_0x4acf('0x25'))](_0x4acf('0x33')+_0xf37d69);}_0x1cdb3b[_0x16a237[_0x4acf('0x22')][_0x4acf('0x30')]]=_0x16a237[_0x4acf('0x22')][_0x4acf('0x2d')];})[_0x4acf('0xf')](function(){return db[_0x4acf('0x34')][_0x4acf('0x35')]({'where':{'id':_0x16a237[_0x4acf('0x36')]['id']},'include':[{'model':db[_0x4acf('0x37')],'as':_0x4acf('0x38'),'include':[{'model':db['CmContact'],'as':_0x4acf('0x39'),'where':_0x1cdb3b,'limit':0x1,'order':[[_0x4acf('0x29'),_0x4acf('0x3a')]]}]},{'model':db[_0x4acf('0x3b')],'as':'Applications'}]});})['then'](function(_0x1aa003){if(_0x1aa003&&_0x1aa003['List']){var _0x2e828f=_0x1aa003['get']({'plain':!![]});_0x78a9df['account']=_0x2e828f;_0x78a9df[_0x4acf('0x3c')]=_0x2e828f[_0x4acf('0x3d')];_0x78a9df[_0x4acf('0x3e')]=_0x2e828f['List'];_0x78a9df[_0x4acf('0x3c')]=_[_0x4acf('0x3f')](_0x78a9df[_0x4acf('0x3c')],['priority'],[_0x4acf('0x40')]);if(_0x78a9df[_0x4acf('0x36')]['Applications']){delete _0x78a9df[_0x4acf('0x36')]['Applications'];}if(_0x78a9df[_0x4acf('0x36')][_0x4acf('0x38')]&&_0x78a9df[_0x4acf('0x36')][_0x4acf('0x38')][_0x4acf('0x39')][_0x4acf('0x41')]){return _0x78a9df[_0x4acf('0x36')][_0x4acf('0x38')][_0x4acf('0x39')][0x0];}var _0x5604c8=_[_0x4acf('0x42')](_0x16a237[_0x4acf('0x22')],{'firstName':_0x16a237[_0x4acf('0x22')]['from'],'ListId':_0x2e828f['ListId']});_0x5604c8[_0x16a237['body'][_0x4acf('0x30')]]=_0x16a237[_0x4acf('0x22')]['from'];return db[_0x4acf('0x24')][_0x4acf('0x43')](_0x5604c8,{'fields':_0x10bfac,'raw':!![]});}})[_0x4acf('0xf')](function(_0x203207){_0x78a9df[_0x4acf('0x44')]=_0x203207;if(_0x203207){var _0x49e150={'ContactId':_0x203207['id'],'FaxAccountId':_0x16a237[_0x4acf('0x36')]['id'],'fax':_0x203207[_0x4acf('0x23')]};return db[_0x4acf('0x45')]['find']({'where':{'ContactId':_0x203207['id'],'closed':![],'FaxAccountId':_0x16a237['account']['id']}})[_0x4acf('0xf')](function(_0x5ddea3){if(_0x5ddea3){return[_0x5ddea3,![]];}return db[_0x4acf('0x45')]['create'](_0x49e150)[_0x4acf('0xf')](function(_0x4258d0){return[_0x4258d0,!![]];});});}else{throw new Error(_0x4acf('0x46'));}})[_0x4acf('0x47')](function(_0x46b03f,_0x587a28){var _0x1656d0=_0x46b03f[_0x4acf('0x48')]({'plain':!![]});if(_0x587a28){if(_0x78a9df[_0x4acf('0x36')][_0x4acf('0x49')]){_0x78a9df[_0x4acf('0x3c')][_0x4acf('0x4a')]({'id':0x0,'priority':_0x78a9df[_0x4acf('0x3c')][_0x4acf('0x41')]+0x1,'app':_0x4acf('0x4b'),'appdata':_0x4acf('0x4c'),'interval':_0x4acf('0x4d')});}_0x1656d0[_0x4acf('0x4e')]=!![];}else{_0x1656d0[_0x4acf('0x4e')]=![];}_0x78a9df[_0x4acf('0x4f')]=_0x1656d0;return db[_0x4acf('0x50')][_0x4acf('0x43')]({'body':_0x16a237[_0x4acf('0x22')][_0x4acf('0x22')],'FaxAccountId':_0x16a237[_0x4acf('0x36')]['id'],'FaxInteractionId':_0x46b03f['id'],'direction':'in','ContactId':_0x46b03f[_0x4acf('0x51')],'AttachmentId':_0x16a237['body'][_0x4acf('0x52')]});})[_0x4acf('0xf')](function(_0x2c1019){_0x78a9df[_0x4acf('0x14')]=_0x2c1019;if(_0x78a9df[_0x4acf('0x4f')][_0x4acf('0x53')]){return db[_0x4acf('0x54')][_0x4acf('0x35')]({'attributes':['id',_0x4acf('0x55')],'where':{'id':_0x78a9df[_0x4acf('0x4f')][_0x4acf('0x53')]}})[_0x4acf('0xf')](function(_0x488b2b){if(_0x488b2b){_0x78a9df['applications'][_0x4acf('0x56')]({'id':0x0,'priority':0x0,'app':_0x4acf('0x57'),'appdata':_0x488b2b[_0x4acf('0x55')]+','+(_0x78a9df[_0x4acf('0x36')][_0x4acf('0x58')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4acf('0x59'),_0x4acf('0x5a'),_0x78a9df);});}return respondWithRpcPromise(_0x4acf('0x59'),_0x4acf('0x5a'),_0x78a9df);})[_0x4acf('0xf')](function(_0x2c6d4c){_0x3d1744(_0x2c6d4c);})['catch'](function(_0x2c7769){_0x2b0198(_0x191cd1[_0x4acf('0x13')](0x1f4,_0x2c7769['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e3594d0..5129dc2 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 _0x7b84=['removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x2b9cf5,_0x2a7804){var _0xd0cf15=function(_0x92a896){while(--_0x92a896){_0x2b9cf5['push'](_0x2b9cf5['shift']());}};_0xd0cf15(++_0x2a7804);}(_0x7b84,0x17c));var _0x47b8=function(_0x4674d2,_0x4023b9){_0x4674d2=_0x4674d2-0x0;var _0x12c9c8=_0x7b84[_0x4674d2];return _0x12c9c8;};'use strict';var FaxAccountEvents=require(_0x47b8('0x0'));var events=[_0x47b8('0x1'),_0x47b8('0x2'),_0x47b8('0x3')];function createListener(_0x6ead7f,_0x2b2f24){return function(_0x2d3031){_0x2b2f24['emit'](_0x6ead7f,_0x2d3031);};}function removeListener(_0x445a5f,_0x1fa41a){return function(){FaxAccountEvents[_0x47b8('0x4')](_0x445a5f,_0x1fa41a);};}exports[_0x47b8('0x5')]=function(_0x2e6853){for(var _0xafe88a=0x0,_0x53e656=events[_0x47b8('0x6')];_0xafe88a<_0x53e656;_0xafe88a++){var _0x3ce846=events[_0xafe88a];var _0x46245a=createListener(_0x47b8('0x7')+_0x3ce846,_0x2e6853);FaxAccountEvents['on'](_0x3ce846,_0x46245a);}}; \ No newline at end of file +var _0xb145=['register','length','faxAccount:','save','remove','update','emit','removeListener'];(function(_0x1f7420,_0x46922d){var _0x5574ac=function(_0x48f0e4){while(--_0x48f0e4){_0x1f7420['push'](_0x1f7420['shift']());}};_0x5574ac(++_0x46922d);}(_0xb145,0xa3));var _0x5b14=function(_0x4f1eb4,_0x273ef6){_0x4f1eb4=_0x4f1eb4-0x0;var _0x5315d8=_0xb145[_0x4f1eb4];return _0x5315d8;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x5b14('0x0'),_0x5b14('0x1'),_0x5b14('0x2')];function createListener(_0x1298e7,_0x40609d){return function(_0x3defa8){_0x40609d[_0x5b14('0x3')](_0x1298e7,_0x3defa8);};}function removeListener(_0x34b4cd,_0x5111cd){return function(){FaxAccountEvents[_0x5b14('0x4')](_0x34b4cd,_0x5111cd);};}exports[_0x5b14('0x5')]=function(_0x392425){for(var _0x4d82ad=0x0,_0x50fd91=events[_0x5b14('0x6')];_0x4d82ad<_0x50fd91;_0x4d82ad++){var _0x2a3921=events[_0x4d82ad];var _0x34530a=createListener(_0x5b14('0x7')+_0x2a3921,_0x392425);FaxAccountEvents['on'](_0x2a3921,_0x34530a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0dae5b7..6fbf772 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 _0x2eb5=['/:id/users','getAgents','create','post','addInteraction','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','/describe','describe','get','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','/:id/applications','getApplications','/:id/messages'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2eb5,0x153));var _0x52eb=function(_0x28e22f,_0x12ba1e){_0x28e22f=_0x28e22f-0x0;var _0x474e9a=_0x2eb5[_0x28e22f];return _0x474e9a;};'use strict';var multer=require('multer');var util=require(_0x52eb('0x0'));var path=require(_0x52eb('0x1'));var timeout=require(_0x52eb('0x2'));var express=require(_0x52eb('0x3'));var router=express['Router']();var fs_extra=require(_0x52eb('0x4'));var auth=require(_0x52eb('0x5'));var interaction=require(_0x52eb('0x6'));var config=require(_0x52eb('0x7'));var controller=require(_0x52eb('0x8'));router['get']('/',auth[_0x52eb('0x9')](),controller['index']);router['get'](_0x52eb('0xa'),auth['isAuthenticated'](),controller[_0x52eb('0xb')]);router[_0x52eb('0xc')](_0x52eb('0xd'),auth[_0x52eb('0x9')](),controller['show']);router['get'](_0x52eb('0xe'),auth[_0x52eb('0x9')](),controller[_0x52eb('0xf')]);router[_0x52eb('0xc')](_0x52eb('0x10'),auth[_0x52eb('0x9')](),controller['getAnswers']);router[_0x52eb('0xc')](_0x52eb('0x11'),auth[_0x52eb('0x9')](),controller['getInteractions']);router[_0x52eb('0xc')](_0x52eb('0x12'),auth[_0x52eb('0x9')](),controller[_0x52eb('0x13')]);router[_0x52eb('0xc')](_0x52eb('0x14'),auth[_0x52eb('0x9')](),controller['getMessages']);router[_0x52eb('0xc')](_0x52eb('0x15'),auth[_0x52eb('0x9')](),controller[_0x52eb('0x16')]);router['post']('/',auth[_0x52eb('0x9')](),controller[_0x52eb('0x17')]);router[_0x52eb('0x18')]('/:id/dispositions',auth[_0x52eb('0x9')](),controller['addDisposition']);router[_0x52eb('0x18')]('/:id/canned_answers',auth[_0x52eb('0x9')](),controller['addAnswer']);router[_0x52eb('0x18')]('/:id/interactions',auth[_0x52eb('0x9')](),controller[_0x52eb('0x19')]);router['post']('/:id/applications',auth[_0x52eb('0x9')](),controller['addApplications']);router[_0x52eb('0x18')](_0x52eb('0x1a'),auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x52eb('0x18')](_0x52eb('0x1b'),auth[_0x52eb('0x9')](),controller[_0x52eb('0x1c')]);router[_0x52eb('0x18')](_0x52eb('0x1d'),auth[_0x52eb('0x9')](),controller[_0x52eb('0x1e')]);router[_0x52eb('0x18')](_0x52eb('0x15'),auth[_0x52eb('0x9')](),controller[_0x52eb('0x1f')]);router[_0x52eb('0x20')](_0x52eb('0xd'),auth[_0x52eb('0x9')](),controller[_0x52eb('0x21')]);router[_0x52eb('0x22')](_0x52eb('0xd'),auth[_0x52eb('0x9')](),controller[_0x52eb('0x23')]);router[_0x52eb('0x22')](_0x52eb('0xe'),auth[_0x52eb('0x9')](),controller[_0x52eb('0x24')]);router['delete']('/:id/canned_answers',auth[_0x52eb('0x9')](),controller[_0x52eb('0x25')]);router[_0x52eb('0x22')](_0x52eb('0x15'),auth[_0x52eb('0x9')](),controller[_0x52eb('0x26')]);module[_0x52eb('0x27')]=router; \ No newline at end of file +var _0x88e1=['get','index','/describe','describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getInteractions','getApplications','/:id/messages','getMessages','getAgents','post','addAnswer','/:id/interactions','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','/:id/users','addAgents','put','update','destroy','removeAnswers','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller'];(function(_0x427fee,_0x80d84f){var _0x2c6a30=function(_0x546b81){while(--_0x546b81){_0x427fee['push'](_0x427fee['shift']());}};_0x2c6a30(++_0x80d84f);}(_0x88e1,0xb6));var _0x188e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x88e1[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x188e('0x0'));var util=require(_0x188e('0x1'));var path=require(_0x188e('0x2'));var timeout=require('connect-timeout');var express=require(_0x188e('0x3'));var router=express['Router']();var fs_extra=require(_0x188e('0x4'));var auth=require(_0x188e('0x5'));var interaction=require(_0x188e('0x6'));var config=require('../../config/environment');var controller=require(_0x188e('0x7'));router[_0x188e('0x8')]('/',auth['isAuthenticated'](),controller[_0x188e('0x9')]);router['get'](_0x188e('0xa'),auth['isAuthenticated'](),controller[_0x188e('0xb')]);router['get'](_0x188e('0xc'),auth[_0x188e('0xd')](),controller['show']);router[_0x188e('0x8')](_0x188e('0xe'),auth[_0x188e('0xd')](),controller[_0x188e('0xf')]);router[_0x188e('0x8')](_0x188e('0x10'),auth[_0x188e('0xd')](),controller['getAnswers']);router[_0x188e('0x8')]('/:id/interactions',auth[_0x188e('0xd')](),controller[_0x188e('0x11')]);router[_0x188e('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x188e('0x12')]);router[_0x188e('0x8')](_0x188e('0x13'),auth[_0x188e('0xd')](),controller[_0x188e('0x14')]);router[_0x188e('0x8')]('/:id/users',auth[_0x188e('0xd')](),controller[_0x188e('0x15')]);router[_0x188e('0x16')]('/',auth[_0x188e('0xd')](),controller['create']);router[_0x188e('0x16')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x188e('0x16')]('/:id/canned_answers',auth[_0x188e('0xd')](),controller[_0x188e('0x17')]);router[_0x188e('0x16')](_0x188e('0x18'),auth[_0x188e('0xd')](),controller[_0x188e('0x19')]);router[_0x188e('0x16')]('/:id/applications',auth[_0x188e('0xd')](),controller[_0x188e('0x1a')]);router[_0x188e('0x16')]('/addaccountapplications',auth[_0x188e('0xd')](),controller[_0x188e('0x1b')]);router[_0x188e('0x16')](_0x188e('0x1c'),auth[_0x188e('0xd')](),controller[_0x188e('0x1d')]);router[_0x188e('0x16')](_0x188e('0x1e'),auth['isAuthenticated'](),controller['send']);router[_0x188e('0x16')](_0x188e('0x1f'),auth[_0x188e('0xd')](),controller[_0x188e('0x20')]);router[_0x188e('0x21')](_0x188e('0xc'),auth[_0x188e('0xd')](),controller[_0x188e('0x22')]);router['delete'](_0x188e('0xc'),auth[_0x188e('0xd')](),controller[_0x188e('0x23')]);router['delete'](_0x188e('0xe'),auth[_0x188e('0xd')](),controller['removeDispositions']);router['delete'](_0x188e('0x10'),auth[_0x188e('0xd')](),controller[_0x188e('0x24')]);router['delete'](_0x188e('0x1f'),auth[_0x188e('0xd')](),controller['removeAgents']);module[_0x188e('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 5482e9c..0949882 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 _0x29f1=['exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x209302,_0x5826ac){var _0x1df8e9=function(_0x16ae49){while(--_0x16ae49){_0x209302['push'](_0x209302['shift']());}};_0x1df8e9(++_0x5826ac);}(_0x29f1,0x195));var _0x129f=function(_0x283f64,_0x4677bb){_0x283f64=_0x283f64-0x0;var _0x222989=_0x29f1[_0x283f64];return _0x222989;};'use strict';var Sequelize=require('sequelize');module[_0x129f('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x129f('0x1')],'allowNull':![],'defaultValue':_0x129f('0x2')},'appdata':{'type':Sequelize[_0x129f('0x3')]()},'description':{'type':Sequelize[_0x129f('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x129f('0x4')}}; \ No newline at end of file +var _0x9b09=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x57112d,_0x9ea573){var _0x3c32b9=function(_0x349dda){while(--_0x349dda){_0x57112d['push'](_0x57112d['shift']());}};_0x3c32b9(++_0x9ea573);}(_0x9b09,0x1ad));var _0x99b0=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0x9b09[_0x38c632];return _0x12737e;};'use strict';var Sequelize=require(_0x99b0('0x0'));module[_0x99b0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x99b0('0x2')],'allowNull':![],'defaultValue':_0x99b0('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x99b0('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x99b0('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6d5c22c..ef1e203 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 _0x0207=['end','stack','name','send','render','merge','body','contact','message','agent','interaction','account','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','includeAll','findAll','rows','catch','show','include','options','create','find','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy'];(function(_0x179d5e,_0x3a1da7){var _0x47d117=function(_0x18129d){while(--_0x18129d){_0x179d5e['push'](_0x179d5e['shift']());}};_0x47d117(++_0x3a1da7);}(_0x0207,0x162));var _0x7020=function(_0x4d3843,_0x29a84e){_0x4d3843=_0x4d3843-0x0;var _0x574e1f=_0x0207[_0x4d3843];return _0x574e1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7020('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7020('0x1'));var moment=require(_0x7020('0x2'));var BPromise=require(_0x7020('0x3'));var Mustache=require(_0x7020('0x4'));var util=require(_0x7020('0x5'));var path=require(_0x7020('0x6'));var sox=require(_0x7020('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7020('0x8'));var _=require(_0x7020('0x9'));var squel=require(_0x7020('0xa'));var crypto=require(_0x7020('0xb'));var jsforce=require(_0x7020('0xc'));var deskjs=require(_0x7020('0xd'));var toCsv=require(_0x7020('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7020('0xf'));var authService=require(_0x7020('0x10'));var qs=require(_0x7020('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7020('0x12'));var logger=require(_0x7020('0x13'))('api');var utils=require(_0x7020('0x14'));var config=require(_0x7020('0x15'));var licenseUtil=require(_0x7020('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d7d79,_0x598198){_0x598198=_0x598198||0xcc;return function(_0xd41aed){if(_0xd41aed){return _0x2d7d79[_0x7020('0x17')](_0x598198);}return _0x2d7d79[_0x7020('0x18')](_0x598198)['end']();};}function respondWithResult(_0x9403e5,_0x5f5872){_0x5f5872=_0x5f5872||0xc8;return function(_0x3b8d60){if(_0x3b8d60){return _0x9403e5[_0x7020('0x18')](_0x5f5872)[_0x7020('0x19')](_0x3b8d60);}};}function respondWithFilteredResult(_0x176190,_0x17260e){return function(_0x308324){if(_0x308324){var _0x55c8b9=typeof _0x17260e[_0x7020('0x1a')]==='undefined'&&typeof _0x17260e[_0x7020('0x1b')]===_0x7020('0x1c');var _0x1a3569=_0x308324[_0x7020('0x1d')];var _0x4fe6f1=_0x55c8b9?0x0:_0x17260e[_0x7020('0x1a')];var _0x3ac2f6=_0x55c8b9?_0x308324[_0x7020('0x1d')]:_0x17260e[_0x7020('0x1a')]+_0x17260e[_0x7020('0x1b')];var _0x1a79fb;if(_0x3ac2f6>=_0x1a3569){_0x3ac2f6=_0x1a3569;_0x1a79fb=0xc8;}else{_0x1a79fb=0xce;}_0x176190['status'](_0x1a79fb);return _0x176190['set'](_0x7020('0x1e'),_0x4fe6f1+'-'+_0x3ac2f6+'/'+_0x1a3569)[_0x7020('0x19')](_0x308324);}return null;};}function patchUpdates(_0x1d1986){return function(_0xb96d30){try{jsonpatch['apply'](_0xb96d30,_0x1d1986,!![]);}catch(_0x382e06){return BPromise[_0x7020('0x1f')](_0x382e06);}return _0xb96d30[_0x7020('0x20')]();};}function saveUpdates(_0x860099,_0x493cc7){return function(_0xcc48f){if(_0xcc48f){return _0xcc48f[_0x7020('0x21')](_0x860099)[_0x7020('0x22')](function(_0x362705){return _0x362705;});}return null;};}function removeEntity(_0x384fe9,_0xe3f4d2){return function(_0x147986){if(_0x147986){return _0x147986[_0x7020('0x23')]()['then'](function(){_0x384fe9[_0x7020('0x18')](0xcc)[_0x7020('0x24')]();});}};}function handleEntityNotFound(_0x35b539,_0x5586f8){return function(_0x28f9f0){if(!_0x28f9f0){_0x35b539['sendStatus'](0x194);}return _0x28f9f0;};}function handleError(_0x496471,_0x50aecb){_0x50aecb=_0x50aecb||0x1f4;return function(_0x178cbd){logger['error'](_0x178cbd[_0x7020('0x25')]);if(_0x178cbd['name']){delete _0x178cbd[_0x7020('0x26')];}_0x496471[_0x7020('0x18')](_0x50aecb)[_0x7020('0x27')](_0x178cbd);};}function getMustacheRender(_0x2fd58e,_0xb03bd6){return Mustache[_0x7020('0x28')](_0x2fd58e,_[_0x7020('0x29')](_0xb03bd6[_0x7020('0x2a')],{'contact':_0xb03bd6[_0x7020('0x2b')],'message':_0xb03bd6[_0x7020('0x2c')],'agent':_0xb03bd6[_0x7020('0x2d')],'interaction':_0xb03bd6[_0x7020('0x2e')],'account':_0xb03bd6[_0x7020('0x2f')]}))||'';}exports['index']=function(_0x18815e,_0x104459){var _0x351778={},_0x191eda={},_0x409d23={'count':0x0,'rows':[]};var _0x3a4e3d=_[_0x7020('0x30')](db[_0x7020('0x31')][_0x7020('0x32')],function(_0x39a568){return{'name':_0x39a568[_0x7020('0x33')],'type':_0x39a568[_0x7020('0x34')][_0x7020('0x35')]};});_0x191eda[_0x7020('0x36')]=_['map'](_0x3a4e3d,_0x7020('0x26'));_0x191eda[_0x7020('0x37')]=_[_0x7020('0x38')](_0x18815e[_0x7020('0x37')]);_0x191eda[_0x7020('0x39')]=_[_0x7020('0x3a')](_0x191eda[_0x7020('0x36')],_0x191eda[_0x7020('0x37')]);_0x351778[_0x7020('0x3b')]=_[_0x7020('0x3a')](_0x191eda[_0x7020('0x36')],qs[_0x7020('0x3c')](_0x18815e[_0x7020('0x37')][_0x7020('0x3c')]));_0x351778['attributes']=_0x351778[_0x7020('0x3b')][_0x7020('0x3d')]?_0x351778[_0x7020('0x3b')]:_0x191eda['model'];if(!_0x18815e[_0x7020('0x37')][_0x7020('0x3e')](_0x7020('0x3f'))){_0x351778[_0x7020('0x1b')]=qs[_0x7020('0x1b')](_0x18815e[_0x7020('0x37')]['limit']);_0x351778[_0x7020('0x1a')]=qs['offset'](_0x18815e['query']['offset']);}_0x351778[_0x7020('0x40')]=qs[_0x7020('0x41')](_0x18815e[_0x7020('0x37')][_0x7020('0x41')]);_0x351778[_0x7020('0x42')]=qs['filters'](_['pick'](_0x18815e[_0x7020('0x37')],_0x191eda[_0x7020('0x39')]),_0x3a4e3d);if(_0x18815e[_0x7020('0x37')][_0x7020('0x43')]){_0x351778['where']=_[_0x7020('0x29')](_0x351778['where'],{'$or':_[_0x7020('0x30')](_0x3a4e3d,function(_0x1aaa5e){if(_0x1aaa5e[_0x7020('0x34')]!=='VIRTUAL'){var _0x49d530={};_0x49d530[_0x1aaa5e[_0x7020('0x26')]]={'$like':'%'+_0x18815e['query'][_0x7020('0x43')]+'%'};return _0x49d530;}})});}_0x351778=_[_0x7020('0x29')]({},_0x351778,_0x18815e['options']);var _0x1fa049={'where':_0x351778[_0x7020('0x42')]};return db[_0x7020('0x31')]['count'](_0x1fa049)[_0x7020('0x22')](function(_0x5793be){_0x409d23[_0x7020('0x1d')]=_0x5793be;if(_0x18815e[_0x7020('0x37')][_0x7020('0x44')]){_0x351778['include']=[{'all':!![]}];}return db[_0x7020('0x31')][_0x7020('0x45')](_0x351778);})[_0x7020('0x22')](function(_0x254979){_0x409d23[_0x7020('0x46')]=_0x254979;return _0x409d23;})['then'](respondWithFilteredResult(_0x104459,_0x351778))[_0x7020('0x47')](handleError(_0x104459,null));};exports[_0x7020('0x48')]=function(_0x36461f,_0x41f303){var _0x5afd34={'raw':!![],'where':{'id':_0x36461f['params']['id']}},_0x27ba4c={};_0x27ba4c['model']=_['keys'](db[_0x7020('0x31')]['rawAttributes']);_0x27ba4c[_0x7020('0x37')]=_[_0x7020('0x38')](_0x36461f[_0x7020('0x37')]);_0x27ba4c['filters']=_[_0x7020('0x3a')](_0x27ba4c['model'],_0x27ba4c[_0x7020('0x37')]);_0x5afd34[_0x7020('0x3b')]=_[_0x7020('0x3a')](_0x27ba4c[_0x7020('0x36')],qs[_0x7020('0x3c')](_0x36461f[_0x7020('0x37')][_0x7020('0x3c')]));_0x5afd34[_0x7020('0x3b')]=_0x5afd34[_0x7020('0x3b')][_0x7020('0x3d')]?_0x5afd34[_0x7020('0x3b')]:_0x27ba4c[_0x7020('0x36')];if(_0x36461f[_0x7020('0x37')][_0x7020('0x44')]){_0x5afd34[_0x7020('0x49')]=[{'all':!![]}];}_0x5afd34=_[_0x7020('0x29')]({},_0x5afd34,_0x36461f[_0x7020('0x4a')]);return db[_0x7020('0x31')]['find'](_0x5afd34)[_0x7020('0x22')](handleEntityNotFound(_0x41f303,null))[_0x7020('0x22')](respondWithResult(_0x41f303,null))[_0x7020('0x47')](handleError(_0x41f303,null));};exports[_0x7020('0x4b')]=function(_0x41f642,_0x55a36a){return db['FaxApplication'][_0x7020('0x4b')](_0x41f642['body'],{})[_0x7020('0x22')](respondWithResult(_0x55a36a,0xc9))[_0x7020('0x47')](handleError(_0x55a36a,null));};exports[_0x7020('0x21')]=function(_0x470400,_0x5c0262){if(_0x470400['body']['id']){delete _0x470400[_0x7020('0x2a')]['id'];}return db[_0x7020('0x31')][_0x7020('0x4c')]({'where':{'id':_0x470400[_0x7020('0x4d')]['id']}})[_0x7020('0x22')](handleEntityNotFound(_0x5c0262,null))[_0x7020('0x22')](saveUpdates(_0x470400[_0x7020('0x2a')],null))[_0x7020('0x22')](respondWithResult(_0x5c0262,null))[_0x7020('0x47')](handleError(_0x5c0262,null));};exports[_0x7020('0x23')]=function(_0x3b583b,_0x1113a5){return db['FaxApplication']['find']({'where':{'id':_0x3b583b['params']['id']}})[_0x7020('0x22')](handleEntityNotFound(_0x1113a5,null))['then'](removeEntity(_0x1113a5,null))[_0x7020('0x47')](handleError(_0x1113a5,null));}; \ No newline at end of file +var _0x9179=['name','render','merge','body','contact','message','agent','interaction','account','index','map','FaxApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','lodash','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','stack'];(function(_0x458017,_0xf60a10){var _0x2df1bc=function(_0x260639){while(--_0x260639){_0x458017['push'](_0x458017['shift']());}};_0x2df1bc(++_0xf60a10);}(_0x9179,0x1d2));var _0x9917=function(_0xd050c6,_0x2101fd){_0xd050c6=_0xd050c6-0x0;var _0x1c887c=_0x9179[_0xd050c6];return _0x1c887c;};'use strict';var emlformat=require(_0x9917('0x0'));var rimraf=require(_0x9917('0x1'));var zipdir=require(_0x9917('0x2'));var jsonpatch=require(_0x9917('0x3'));var rp=require('request-promise');var moment=require(_0x9917('0x4'));var BPromise=require(_0x9917('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9917('0x6'));var ejs=require(_0x9917('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9917('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9917('0x9'));var Papa=require(_0x9917('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9917('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9917('0xc'))('api');var utils=require('../../config/utils');var config=require(_0x9917('0xd'));var licenseUtil=require(_0x9917('0xe'));var db=require(_0x9917('0xf'))['db'];function respondWithStatusCode(_0x513261,_0x54f79f){_0x54f79f=_0x54f79f||0xcc;return function(_0xcb0cb){if(_0xcb0cb){return _0x513261[_0x9917('0x10')](_0x54f79f);}return _0x513261[_0x9917('0x11')](_0x54f79f)[_0x9917('0x12')]();};}function respondWithResult(_0x4e7de9,_0x1f2bf1){_0x1f2bf1=_0x1f2bf1||0xc8;return function(_0x3fa6aa){if(_0x3fa6aa){return _0x4e7de9[_0x9917('0x11')](_0x1f2bf1)[_0x9917('0x13')](_0x3fa6aa);}};}function respondWithFilteredResult(_0x2e8803,_0x11bed1){return function(_0x335337){if(_0x335337){var _0x227296=typeof _0x11bed1['offset']===_0x9917('0x14')&&typeof _0x11bed1[_0x9917('0x15')]===_0x9917('0x14');var _0x3afe6c=_0x335337[_0x9917('0x16')];var _0x123184=_0x227296?0x0:_0x11bed1['offset'];var _0x3c79ac=_0x227296?_0x335337[_0x9917('0x16')]:_0x11bed1[_0x9917('0x17')]+_0x11bed1[_0x9917('0x15')];var _0x35eb53;if(_0x3c79ac>=_0x3afe6c){_0x3c79ac=_0x3afe6c;_0x35eb53=0xc8;}else{_0x35eb53=0xce;}_0x2e8803['status'](_0x35eb53);return _0x2e8803[_0x9917('0x18')](_0x9917('0x19'),_0x123184+'-'+_0x3c79ac+'/'+_0x3afe6c)['json'](_0x335337);}return null;};}function patchUpdates(_0x461201){return function(_0x210ceb){try{jsonpatch['apply'](_0x210ceb,_0x461201,!![]);}catch(_0x126016){return BPromise[_0x9917('0x1a')](_0x126016);}return _0x210ceb[_0x9917('0x1b')]();};}function saveUpdates(_0x1dab8c,_0x1a41d9){return function(_0x4ea609){if(_0x4ea609){return _0x4ea609[_0x9917('0x1c')](_0x1dab8c)[_0x9917('0x1d')](function(_0x1ff4c8){return _0x1ff4c8;});}return null;};}function removeEntity(_0x59c433,_0xa86758){return function(_0x3312da){if(_0x3312da){return _0x3312da['destroy']()['then'](function(){_0x59c433[_0x9917('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7d71,_0x468a03){return function(_0x24af68){if(!_0x24af68){_0x5e7d71['sendStatus'](0x194);}return _0x24af68;};}function handleError(_0x19303e,_0x535ee3){_0x535ee3=_0x535ee3||0x1f4;return function(_0x3c2023){logger['error'](_0x3c2023[_0x9917('0x1e')]);if(_0x3c2023[_0x9917('0x1f')]){delete _0x3c2023[_0x9917('0x1f')];}_0x19303e[_0x9917('0x11')](_0x535ee3)['send'](_0x3c2023);};}function getMustacheRender(_0xca6ba,_0x5c29e2){return Mustache[_0x9917('0x20')](_0xca6ba,_[_0x9917('0x21')](_0x5c29e2[_0x9917('0x22')],{'contact':_0x5c29e2[_0x9917('0x23')],'message':_0x5c29e2[_0x9917('0x24')],'agent':_0x5c29e2[_0x9917('0x25')],'interaction':_0x5c29e2[_0x9917('0x26')],'account':_0x5c29e2[_0x9917('0x27')]}))||'';}exports[_0x9917('0x28')]=function(_0x20ebb5,_0x14f56c){var _0x385dd9={},_0x1d05ad={},_0x5724b1={'count':0x0,'rows':[]};var _0xaec7e0=_[_0x9917('0x29')](db[_0x9917('0x2a')]['rawAttributes'],function(_0x2d1676){return{'name':_0x2d1676[_0x9917('0x2b')],'type':_0x2d1676['type'][_0x9917('0x2c')]};});_0x1d05ad[_0x9917('0x2d')]=_[_0x9917('0x29')](_0xaec7e0,_0x9917('0x1f'));_0x1d05ad[_0x9917('0x2e')]=_['keys'](_0x20ebb5[_0x9917('0x2e')]);_0x1d05ad[_0x9917('0x2f')]=_[_0x9917('0x30')](_0x1d05ad['model'],_0x1d05ad['query']);_0x385dd9[_0x9917('0x31')]=_[_0x9917('0x30')](_0x1d05ad['model'],qs[_0x9917('0x32')](_0x20ebb5[_0x9917('0x2e')]['fields']));_0x385dd9[_0x9917('0x31')]=_0x385dd9['attributes'][_0x9917('0x33')]?_0x385dd9[_0x9917('0x31')]:_0x1d05ad[_0x9917('0x2d')];if(!_0x20ebb5[_0x9917('0x2e')][_0x9917('0x34')]('nolimit')){_0x385dd9[_0x9917('0x15')]=qs[_0x9917('0x15')](_0x20ebb5['query'][_0x9917('0x15')]);_0x385dd9[_0x9917('0x17')]=qs[_0x9917('0x17')](_0x20ebb5['query']['offset']);}_0x385dd9['order']=qs['sort'](_0x20ebb5[_0x9917('0x2e')][_0x9917('0x35')]);_0x385dd9[_0x9917('0x36')]=qs['filters'](_[_0x9917('0x37')](_0x20ebb5[_0x9917('0x2e')],_0x1d05ad[_0x9917('0x2f')]),_0xaec7e0);if(_0x20ebb5['query'][_0x9917('0x38')]){_0x385dd9[_0x9917('0x36')]=_['merge'](_0x385dd9[_0x9917('0x36')],{'$or':_['map'](_0xaec7e0,function(_0x500c6e){if(_0x500c6e[_0x9917('0x39')]!==_0x9917('0x3a')){var _0x384a5b={};_0x384a5b[_0x500c6e[_0x9917('0x1f')]]={'$like':'%'+_0x20ebb5[_0x9917('0x2e')][_0x9917('0x38')]+'%'};return _0x384a5b;}})});}_0x385dd9=_['merge']({},_0x385dd9,_0x20ebb5[_0x9917('0x3b')]);var _0x36a806={'where':_0x385dd9[_0x9917('0x36')]};return db[_0x9917('0x2a')]['count'](_0x36a806)[_0x9917('0x1d')](function(_0xee5e12){_0x5724b1[_0x9917('0x16')]=_0xee5e12;if(_0x20ebb5['query'][_0x9917('0x3c')]){_0x385dd9[_0x9917('0x3d')]=[{'all':!![]}];}return db[_0x9917('0x2a')][_0x9917('0x3e')](_0x385dd9);})[_0x9917('0x1d')](function(_0x107ff2){_0x5724b1[_0x9917('0x3f')]=_0x107ff2;return _0x5724b1;})[_0x9917('0x1d')](respondWithFilteredResult(_0x14f56c,_0x385dd9))[_0x9917('0x40')](handleError(_0x14f56c,null));};exports[_0x9917('0x41')]=function(_0x23e63d,_0x1721bd){var _0x40c2cc={'raw':!![],'where':{'id':_0x23e63d[_0x9917('0x42')]['id']}},_0x6e8263={};_0x6e8263['model']=_[_0x9917('0x43')](db['FaxApplication']['rawAttributes']);_0x6e8263[_0x9917('0x2e')]=_[_0x9917('0x43')](_0x23e63d['query']);_0x6e8263[_0x9917('0x2f')]=_[_0x9917('0x30')](_0x6e8263[_0x9917('0x2d')],_0x6e8263['query']);_0x40c2cc[_0x9917('0x31')]=_[_0x9917('0x30')](_0x6e8263[_0x9917('0x2d')],qs[_0x9917('0x32')](_0x23e63d[_0x9917('0x2e')][_0x9917('0x32')]));_0x40c2cc[_0x9917('0x31')]=_0x40c2cc['attributes'][_0x9917('0x33')]?_0x40c2cc[_0x9917('0x31')]:_0x6e8263[_0x9917('0x2d')];if(_0x23e63d[_0x9917('0x2e')][_0x9917('0x3c')]){_0x40c2cc['include']=[{'all':!![]}];}_0x40c2cc=_[_0x9917('0x21')]({},_0x40c2cc,_0x23e63d[_0x9917('0x3b')]);return db[_0x9917('0x2a')][_0x9917('0x44')](_0x40c2cc)[_0x9917('0x1d')](handleEntityNotFound(_0x1721bd,null))[_0x9917('0x1d')](respondWithResult(_0x1721bd,null))[_0x9917('0x40')](handleError(_0x1721bd,null));};exports['create']=function(_0x151447,_0x45462c){return db[_0x9917('0x2a')][_0x9917('0x45')](_0x151447[_0x9917('0x22')],{})[_0x9917('0x1d')](respondWithResult(_0x45462c,0xc9))[_0x9917('0x40')](handleError(_0x45462c,null));};exports['update']=function(_0x1cbc58,_0x556319){if(_0x1cbc58[_0x9917('0x22')]['id']){delete _0x1cbc58[_0x9917('0x22')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x1cbc58['params']['id']}})[_0x9917('0x1d')](handleEntityNotFound(_0x556319,null))[_0x9917('0x1d')](saveUpdates(_0x1cbc58[_0x9917('0x22')],null))[_0x9917('0x1d')](respondWithResult(_0x556319,null))[_0x9917('0x40')](handleError(_0x556319,null));};exports[_0x9917('0x46')]=function(_0xe44de8,_0x3e9d97){return db[_0x9917('0x2a')][_0x9917('0x44')]({'where':{'id':_0xe44de8[_0x9917('0x42')]['id']}})[_0x9917('0x1d')](handleEntityNotFound(_0x3e9d97,null))['then'](removeEntity(_0x3e9d97,null))['catch'](handleError(_0x3e9d97,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index fee6b59..d4e41e7 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 _0x2ce3=['FaxApplication','utf8mb4','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','define'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x2ce3,0x1d6));var _0x32ce=function(_0x2daa17,_0x5b5ab6){_0x2daa17=_0x2daa17-0x0;var _0x2a831a=_0x2ce3[_0x2daa17];return _0x2a831a;};'use strict';var _=require(_0x32ce('0x0'));var util=require('util');var logger=require(_0x32ce('0x1'))(_0x32ce('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x32ce('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x32ce('0x4'));var config=require(_0x32ce('0x5'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x4aa0a6,_0xe12b9){return _0x4aa0a6[_0x32ce('0x6')](_0x32ce('0x7'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x32ce('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6857=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4c462c,_0x5cd916){var _0x2840bb=function(_0x4dd35d){while(--_0x4dd35d){_0x4c462c['push'](_0x4c462c['shift']());}};_0x2840bb(++_0x5cd916);}(_0x6857,0x98));var _0x7685=function(_0x4061e2,_0x4dd3d3){_0x4061e2=_0x4061e2-0x0;var _0x41b05e=_0x6857[_0x4061e2];return _0x41b05e;};'use strict';var _=require(_0x7685('0x0'));var util=require(_0x7685('0x1'));var logger=require(_0x7685('0x2'))(_0x7685('0x3'));var moment=require(_0x7685('0x4'));var BPromise=require(_0x7685('0x5'));var rp=require(_0x7685('0x6'));var fs=require('fs');var path=require(_0x7685('0x7'));var rimraf=require('rimraf');var config=require(_0x7685('0x8'));var attributes=require(_0x7685('0x9'));module['exports']=function(_0xe7b5b2,_0x5e68bd){return _0xe7b5b2['define'](_0x7685('0xa'),attributes,{'tableName':_0x7685('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7685('0xc'),'collate':_0x7685('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ff1a486..3f8c061 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 _0x43bb=['request','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','FaxApplication,\x20%s,\x20%s','result','catch','UpdateFaxApplication','update','body','options','raw','attributes','then','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x43bb,0x199));var _0xb43b=function(_0x45c15c,_0x14cf89){_0x45c15c=_0x45c15c-0x0;var _0xe12511=_0x43bb[_0x45c15c];return _0xe12511;};'use strict';var _=require(_0xb43b('0x0'));var util=require(_0xb43b('0x1'));var moment=require(_0xb43b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb43b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb43b('0x4'));var logger=require(_0xb43b('0x5'))(_0xb43b('0x6'));var config=require(_0xb43b('0x7'));var jayson=require(_0xb43b('0x8'));var client=jayson[_0xb43b('0x9')][_0xb43b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b5ba6,_0x2887ba,_0x10e152){return new BPromise(function(_0x1fd9f7,_0x38ea5f){return client[_0xb43b('0xb')](_0x3b5ba6,_0x10e152)['then'](function(_0x4dd85f){logger[_0xb43b('0xc')]('FaxApplication,\x20%s,\x20%s',_0x2887ba,'request\x20sent');logger[_0xb43b('0xd')](_0xb43b('0xe'),_0x2887ba,_0xb43b('0xf'),JSON['stringify'](_0x4dd85f));if(_0x4dd85f[_0xb43b('0x10')]){if(_0x4dd85f[_0xb43b('0x10')][_0xb43b('0x11')]===0x1f4){logger[_0xb43b('0x10')]('FaxApplication,\x20%s,\x20%s',_0x2887ba,_0x4dd85f[_0xb43b('0x10')][_0xb43b('0x12')]);return _0x38ea5f(_0x4dd85f['error'][_0xb43b('0x12')]);}logger['error'](_0xb43b('0x13'),_0x2887ba,_0x4dd85f[_0xb43b('0x10')][_0xb43b('0x12')]);return _0x1fd9f7(_0x4dd85f[_0xb43b('0x10')]['message']);}else{logger[_0xb43b('0xc')](_0xb43b('0x13'),_0x2887ba,_0xb43b('0xf'));_0x1fd9f7(_0x4dd85f[_0xb43b('0x14')][_0xb43b('0x12')]);}})[_0xb43b('0x15')](function(_0x2599c4){logger[_0xb43b('0x10')](_0xb43b('0x13'),_0x2887ba,_0x2599c4);_0x38ea5f(_0x2599c4);});});}exports[_0xb43b('0x16')]=function(_0x2a8cbd){var _0x2c7427=this;return new Promise(function(_0x35c021,_0xf44fae){return db['FaxApplication'][_0xb43b('0x17')](_0x2a8cbd[_0xb43b('0x18')],{'raw':_0x2a8cbd[_0xb43b('0x19')]?_0x2a8cbd['options'][_0xb43b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a8cbd[_0xb43b('0x19')]?_0x2a8cbd[_0xb43b('0x19')]['where']||null:null,'attributes':_0x2a8cbd['options']?_0x2a8cbd[_0xb43b('0x19')][_0xb43b('0x1b')]||null:null,'limit':_0x2a8cbd['options']?_0x2a8cbd['options']['limit']||null:null})[_0xb43b('0x1c')](function(_0x236b3b){logger[_0xb43b('0xc')](_0xb43b('0x16'),_0x2a8cbd);logger[_0xb43b('0xd')]('UpdateFaxApplication',_0x2a8cbd,JSON[_0xb43b('0x1d')](_0x236b3b));_0x35c021(_0x236b3b);})['catch'](function(_0x5d17d9){logger[_0xb43b('0x10')](_0xb43b('0x16'),_0x5d17d9[_0xb43b('0x12')],_0x2a8cbd);_0xf44fae(_0x2c7427[_0xb43b('0x10')](0x1f4,_0x5d17d9[_0xb43b('0x12')]));});});}; \ No newline at end of file +var _0x2e22=['body','options','raw','where','attributes','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','FaxApplication,\x20%s,\x20%s','catch','UpdateFaxApplication','FaxApplication','update'];(function(_0x2f0b66,_0x36d48a){var _0x25e4f7=function(_0xdd331b){while(--_0xdd331b){_0x2f0b66['push'](_0x2f0b66['shift']());}};_0x25e4f7(++_0x36d48a);}(_0x2e22,0x1c6));var _0x22e2=function(_0x3951ff,_0x4a06e0){_0x3951ff=_0x3951ff-0x0;var _0x487314=_0x2e22[_0x3951ff];return _0x487314;};'use strict';var _=require(_0x22e2('0x0'));var util=require(_0x22e2('0x1'));var moment=require(_0x22e2('0x2'));var BPromise=require(_0x22e2('0x3'));var rs=require(_0x22e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22e2('0x5'))['db'];var utils=require(_0x22e2('0x6'));var logger=require(_0x22e2('0x7'))(_0x22e2('0x8'));var config=require(_0x22e2('0x9'));var jayson=require(_0x22e2('0xa'));var client=jayson['client'][_0x22e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32a3ab,_0x54b1f4,_0x42396c){return new BPromise(function(_0x1b28d6,_0x11940a){return client[_0x22e2('0xc')](_0x32a3ab,_0x42396c)[_0x22e2('0xd')](function(_0x3f1f4d){logger[_0x22e2('0xe')]('FaxApplication,\x20%s,\x20%s',_0x54b1f4,'request\x20sent');logger[_0x22e2('0xf')](_0x22e2('0x10'),_0x54b1f4,_0x22e2('0x11'),JSON['stringify'](_0x3f1f4d));if(_0x3f1f4d[_0x22e2('0x12')]){if(_0x3f1f4d[_0x22e2('0x12')][_0x22e2('0x13')]===0x1f4){logger[_0x22e2('0x12')]('FaxApplication,\x20%s,\x20%s',_0x54b1f4,_0x3f1f4d[_0x22e2('0x12')][_0x22e2('0x14')]);return _0x11940a(_0x3f1f4d['error'][_0x22e2('0x14')]);}logger[_0x22e2('0x12')](_0x22e2('0x15'),_0x54b1f4,_0x3f1f4d['error']['message']);return _0x1b28d6(_0x3f1f4d['error'][_0x22e2('0x14')]);}else{logger[_0x22e2('0xe')](_0x22e2('0x15'),_0x54b1f4,_0x22e2('0x11'));_0x1b28d6(_0x3f1f4d['result'][_0x22e2('0x14')]);}})[_0x22e2('0x16')](function(_0x1104df){logger[_0x22e2('0x12')](_0x22e2('0x15'),_0x54b1f4,_0x1104df);_0x11940a(_0x1104df);});});}exports[_0x22e2('0x17')]=function(_0x4894bc){var _0x2d99df=this;return new Promise(function(_0x5db930,_0x2ca413){return db[_0x22e2('0x18')][_0x22e2('0x19')](_0x4894bc[_0x22e2('0x1a')],{'raw':_0x4894bc[_0x22e2('0x1b')]?_0x4894bc[_0x22e2('0x1b')][_0x22e2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4894bc[_0x22e2('0x1b')]?_0x4894bc[_0x22e2('0x1b')][_0x22e2('0x1d')]||null:null,'attributes':_0x4894bc[_0x22e2('0x1b')]?_0x4894bc[_0x22e2('0x1b')][_0x22e2('0x1e')]||null:null,'limit':_0x4894bc[_0x22e2('0x1b')]?_0x4894bc[_0x22e2('0x1b')]['limit']||null:null})['then'](function(_0x5b0acc){logger[_0x22e2('0xe')](_0x22e2('0x17'),_0x4894bc);logger[_0x22e2('0xf')](_0x22e2('0x17'),_0x4894bc,JSON[_0x22e2('0x1f')](_0x5b0acc));_0x5db930(_0x5b0acc);})[_0x22e2('0x16')](function(_0x107976){logger[_0x22e2('0x12')](_0x22e2('0x17'),_0x107976[_0x22e2('0x14')],_0x4894bc);_0x2ca413(_0x2d99df['error'](0x1f4,_0x107976['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 33ab6aa..c2edbf2 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 _0xfb9f=['isAuthenticated','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','show','create','put'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xfb9f,0x1ba));var _0xffb9=function(_0x1e5475,_0x461a97){_0x1e5475=_0x1e5475-0x0;var _0x27e0d1=_0xfb9f[_0x1e5475];return _0x27e0d1;};'use strict';var multer=require(_0xffb9('0x0'));var util=require(_0xffb9('0x1'));var path=require(_0xffb9('0x2'));var timeout=require('connect-timeout');var express=require(_0xffb9('0x3'));var router=express['Router']();var fs_extra=require(_0xffb9('0x4'));var auth=require(_0xffb9('0x5'));var interaction=require(_0xffb9('0x6'));var config=require(_0xffb9('0x7'));var controller=require(_0xffb9('0x8'));router[_0xffb9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xffb9('0x9')](_0xffb9('0xa'),auth['isAuthenticated'](),controller[_0xffb9('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xffb9('0xc')]);router[_0xffb9('0xd')](_0xffb9('0xa'),auth[_0xffb9('0xe')](),controller[_0xffb9('0xf')]);router[_0xffb9('0x10')](_0xffb9('0xa'),auth[_0xffb9('0xe')](),controller[_0xffb9('0x11')]);module[_0xffb9('0x12')]=router; \ No newline at end of file +var _0x82d1=['index','/:id','isAuthenticated','show','create','put','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x4e0bfc,_0x4cb5cc){var _0x5082fe=function(_0x194c23){while(--_0x194c23){_0x4e0bfc['push'](_0x4e0bfc['shift']());}};_0x5082fe(++_0x4cb5cc);}(_0x82d1,0x1c7));var _0x182d=function(_0x475845,_0x38a549){_0x475845=_0x475845-0x0;var _0x3ad3d8=_0x82d1[_0x475845];return _0x3ad3d8;};'use strict';var multer=require(_0x182d('0x0'));var util=require('util');var path=require(_0x182d('0x1'));var timeout=require(_0x182d('0x2'));var express=require(_0x182d('0x3'));var router=express['Router']();var fs_extra=require(_0x182d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x182d('0x5'));var config=require(_0x182d('0x6'));var controller=require(_0x182d('0x7'));router[_0x182d('0x8')]('/',auth['isAuthenticated'](),controller[_0x182d('0x9')]);router['get'](_0x182d('0xa'),auth[_0x182d('0xb')](),controller[_0x182d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x182d('0xd')]);router[_0x182d('0xe')](_0x182d('0xa'),auth[_0x182d('0xb')](),controller['update']);router['delete'](_0x182d('0xa'),auth[_0x182d('0xb')](),controller['destroy']);module[_0x182d('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e3cbd4a..f4e8591 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 _0x06bf=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x2b5d40,_0x641a8){var _0x22c128=function(_0x197ece){while(--_0x197ece){_0x2b5d40['push'](_0x2b5d40['shift']());}};_0x22c128(++_0x641a8);}(_0x06bf,0x105));var _0xf06b=function(_0x4e6766,_0x43c16a){_0x4e6766=_0x4e6766-0x0;var _0x13fc37=_0x06bf[_0x4e6766];return _0x13fc37;};'use strict';var Sequelize=require(_0xf06b('0x0'));module[_0xf06b('0x1')]={'closed':{'type':Sequelize[_0xf06b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf06b('0x3')]},'disposition':{'type':Sequelize[_0xf06b('0x4')]},'secondDisposition':{'type':Sequelize[_0xf06b('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf06b('0x4')]},'note':{'type':Sequelize[_0xf06b('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xf06b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf06b('0x5')]('in',_0xf06b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf06b('0x5')]('in',_0xf06b('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x689c=['STRING','ENUM','out','BOOLEAN','DATE'];(function(_0x5ba38a,_0x132834){var _0x28eebe=function(_0x56946a){while(--_0x56946a){_0x5ba38a['push'](_0x5ba38a['shift']());}};_0x28eebe(++_0x132834);}(_0x689c,0x9e));var _0xc689=function(_0x5f0899,_0x5d9074){_0x5f0899=_0x5f0899-0x0;var _0x2e8b2f=_0x689c[_0x5f0899];return _0x2e8b2f;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xc689('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc689('0x1')]},'disposition':{'type':Sequelize[_0xc689('0x2')]},'secondDisposition':{'type':Sequelize[_0xc689('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc689('0x2')]},'note':{'type':Sequelize[_0xc689('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xc689('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc689('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xc689('0x3')]('in',_0xc689('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 083d021..052b923 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 _0x46cf=['basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','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','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','then','destroy','error','stack','name','send','render','merge','body','contact','message','TagIds','forEach','Tags','push','catch','index','map','FaxInteraction','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','u.id','u.fullname','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','select','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','find','value','`\x20=\x200','having','Contact','$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','start','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','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.fax\x20LIKE\x20?','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)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','include','create','update','params','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','pick','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','emit','faxInteractionTags:save','removeTags','root','server','join','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync'];(function(_0x4ae758,_0x75ddcf){var _0x1ea654=function(_0x34e064){while(--_0x34e064){_0x4ae758['push'](_0x4ae758['shift']());}};_0x1ea654(++_0x75ddcf);}(_0x46cf,0xe0));var _0xf46c=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x46cf[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require(_0xf46c('0x0'));var rimraf=require(_0xf46c('0x1'));var zipdir=require(_0xf46c('0x2'));var jsonpatch=require(_0xf46c('0x3'));var rp=require(_0xf46c('0x4'));var moment=require('moment');var BPromise=require(_0xf46c('0x5'));var Mustache=require(_0xf46c('0x6'));var util=require('util');var path=require(_0xf46c('0x7'));var sox=require(_0xf46c('0x8'));var csv=require(_0xf46c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf46c('0xa'));var squel=require(_0xf46c('0xb'));var crypto=require('crypto');var jsforce=require(_0xf46c('0xc'));var deskjs=require(_0xf46c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf46c('0xe'));var Papa=require(_0xf46c('0xf'));var Redis=require(_0xf46c('0x10'));var authService=require(_0xf46c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf46c('0x12'));var hardwareService=require(_0xf46c('0x13'));var logger=require(_0xf46c('0x14'))(_0xf46c('0x15'));var utils=require(_0xf46c('0x16'));var config=require(_0xf46c('0x17'));var licenseUtil=require(_0xf46c('0x18'));var db=require(_0xf46c('0x19'))['db'];config[_0xf46c('0x1a')]=_[_0xf46c('0x1b')](config[_0xf46c('0x1a')],{'host':_0xf46c('0x1c'),'port':0x18eb});var socket=require(_0xf46c('0x1d'))(new Redis(config[_0xf46c('0x1a')]));require(_0xf46c('0x1e'))['register'](socket);function respondWithStatusCode(_0x5c952c,_0x34bf10){_0x34bf10=_0x34bf10||0xcc;return function(_0x4f5858){if(_0x4f5858){return _0x5c952c[_0xf46c('0x1f')](_0x34bf10);}return _0x5c952c[_0xf46c('0x20')](_0x34bf10)[_0xf46c('0x21')]();};}function respondWithResult(_0x56802c,_0x498256){_0x498256=_0x498256||0xc8;return function(_0x2ccad4){if(_0x2ccad4){return _0x56802c[_0xf46c('0x20')](_0x498256)[_0xf46c('0x22')](_0x2ccad4);}};}function respondWithFilteredResult(_0x350f8a,_0xc310e4){return function(_0x4e8452){if(_0x4e8452){var _0xfac45b=typeof _0xc310e4['offset']==='undefined'&&typeof _0xc310e4[_0xf46c('0x23')]===_0xf46c('0x24');var _0x3ff957=_0x4e8452[_0xf46c('0x25')];var _0x18d6d1=_0xfac45b?0x0:_0xc310e4[_0xf46c('0x26')];var _0x1a2ec5=_0xfac45b?_0x4e8452[_0xf46c('0x25')]:_0xc310e4['offset']+_0xc310e4[_0xf46c('0x23')];var _0x21f0ff;if(_0x1a2ec5>=_0x3ff957){_0x1a2ec5=_0x3ff957;_0x21f0ff=0xc8;}else{_0x21f0ff=0xce;}_0x350f8a[_0xf46c('0x20')](_0x21f0ff);return _0x350f8a[_0xf46c('0x27')]('Content-Range',_0x18d6d1+'-'+_0x1a2ec5+'/'+_0x3ff957)['json'](_0x4e8452);}return null;};}function patchUpdates(_0x1074f7){return function(_0x19b82a){try{jsonpatch[_0xf46c('0x28')](_0x19b82a,_0x1074f7,!![]);}catch(_0x51ee2f){return BPromise['reject'](_0x51ee2f);}return _0x19b82a[_0xf46c('0x29')]();};}function saveUpdates(_0x462091,_0x10060b){return function(_0xaef788){if(_0xaef788){return _0xaef788['update'](_0x462091)[_0xf46c('0x2a')](function(_0x14d100){return _0x14d100;});}return null;};}function removeEntity(_0x19ec2d,_0x206e45){return function(_0x32b5e3){if(_0x32b5e3){return _0x32b5e3[_0xf46c('0x2b')]()[_0xf46c('0x2a')](function(){_0x19ec2d[_0xf46c('0x20')](0xcc)[_0xf46c('0x21')]();});}};}function handleEntityNotFound(_0x195626,_0x5347e3){return function(_0x99ec17){if(!_0x99ec17){_0x195626['sendStatus'](0x194);}return _0x99ec17;};}function handleError(_0x3cd97f,_0x160230){_0x160230=_0x160230||0x1f4;return function(_0x1eb38c){logger[_0xf46c('0x2c')](_0x1eb38c[_0xf46c('0x2d')]);if(_0x1eb38c[_0xf46c('0x2e')]){delete _0x1eb38c[_0xf46c('0x2e')];}_0x3cd97f[_0xf46c('0x20')](_0x160230)[_0xf46c('0x2f')](_0x1eb38c);};}function getMustacheRender(_0x2d5535,_0x4d307b){return Mustache[_0xf46c('0x30')](_0x2d5535,_[_0xf46c('0x31')](_0x4d307b[_0xf46c('0x32')],{'contact':_0x4d307b[_0xf46c('0x33')],'message':_0x4d307b[_0xf46c('0x34')],'agent':_0x4d307b['agent'],'interaction':_0x4d307b['interaction'],'account':_0x4d307b['account']}))||'';}function getInteractionUsers(_0x24d9b3,_0x40f9e9){return new BPromise(function(_0x2c6251,_0xbcc253){try{if(_0x40f9e9[_0x24d9b3['id']]){_0x24d9b3['Users']=_['map'](_0x40f9e9[_0x24d9b3['id']],function(_0x41369c){return{'id':_0x41369c['id'],'fullname':_0x41369c['fullname']};});}}catch(_0x521542){_0xbcc253(_0x521542);}_0x2c6251(_0x24d9b3);});}function getInteractionTags(_0xcb320e,_0x39d290){return new BPromise(function(_0x44b9c7,_0x264e97){try{if(_0xcb320e[_0xf46c('0x35')]){_0xcb320e['Tags']=[];_0xcb320e[_0xf46c('0x35')]['split'](',')[_0xf46c('0x36')](function(_0xd7a6cf){_0xcb320e[_0xf46c('0x37')][_0xf46c('0x38')](_0x39d290[_0xd7a6cf]);});}delete _0xcb320e[_0xf46c('0x35')];}catch(_0x183fae){_0x264e97(_0x183fae);}_0x44b9c7(_0xcb320e);});}function updateFaxInteraction(_0x4f62bb,_0x364470,_0x344389){return new BPromise(function(_0x169abf,_0xbc7347){return getInteractionUsers(_0x4f62bb,_0x344389)[_0xf46c('0x2a')](function(_0x1424f8){return getInteractionTags(_0x1424f8,_0x364470);})['then'](function(_0x36bace){_0x169abf(_0x36bace);})[_0xf46c('0x39')](function(_0x26a8eb){_0xbc7347(_0x26a8eb);});});}exports[_0xf46c('0x3a')]=function(_0x3bc3cf,_0x1050d3){var _0x48e565={},_0x27bfa3={},_0x218788={'count':0x0,'rows':[]};var _0x4432fa=_[_0xf46c('0x3b')](db[_0xf46c('0x3c')][_0xf46c('0x3d')],function(_0xb19430){return{'name':_0xb19430[_0xf46c('0x3e')],'type':_0xb19430[_0xf46c('0x3f')]['key']};});_0x27bfa3[_0xf46c('0x40')]=_['map'](_0x4432fa,_0xf46c('0x2e'));_0x27bfa3[_0xf46c('0x41')]=_[_0xf46c('0x42')](_0x3bc3cf[_0xf46c('0x41')]);_0x27bfa3[_0xf46c('0x43')]=_['intersection'](_0x27bfa3[_0xf46c('0x40')],_0x27bfa3['query']);_0x48e565[_0xf46c('0x44')]=_[_0xf46c('0x45')](_0x27bfa3[_0xf46c('0x40')],qs[_0xf46c('0x46')](_0x3bc3cf['query']['fields']));_0x48e565[_0xf46c('0x44')]=_0x48e565[_0xf46c('0x44')][_0xf46c('0x47')]?_0x48e565[_0xf46c('0x44')]:_0x27bfa3[_0xf46c('0x40')];if(!_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x48')](_0xf46c('0x49'))){_0x48e565[_0xf46c('0x23')]=qs['limit'](_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x23')]);_0x48e565['offset']=qs[_0xf46c('0x26')](_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x26')]);}_0x48e565[_0xf46c('0x4a')]=qs[_0xf46c('0x4b')](_0x3bc3cf[_0xf46c('0x41')]['sort']);_0x48e565[_0xf46c('0x4c')]=qs['filters'](_['pick'](_0x3bc3cf[_0xf46c('0x41')],_0x27bfa3['filters']),_0x4432fa);var _0x58d702=[];var _0x23ac5a=squel['select']()[_0xf46c('0x4d')]('id')[_0xf46c('0x4d')](_0xf46c('0x2e'))[_0xf46c('0x4d')](_0xf46c('0x4e'))[_0xf46c('0x4f')](_0xf46c('0x50'));var _0x399c72=squel['select']()[_0xf46c('0x4d')](_0xf46c('0x51'))[_0xf46c('0x4d')](_0xf46c('0x52'))[_0xf46c('0x4d')]('ui.FaxInteractionId')[_0xf46c('0x4f')](_0xf46c('0x53'),'ui')['left_join'](_0xf46c('0x54'),'u',_0xf46c('0x55'));var _0x5b7e99=squel[_0xf46c('0x56')]()[_0xf46c('0x4f')](_0xf46c('0x57'),'i')[_0xf46c('0x58')](_0xf46c('0x59'),'c',_0xf46c('0x5a'))[_0xf46c('0x58')](_0xf46c('0x54'),'o',_0xf46c('0x5b'))[_0xf46c('0x58')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0xf46c('0x5c'),'me',_0xf46c('0x5d'))[_0xf46c('0x58')](_0xf46c('0x5e'),'it',_0xf46c('0x5f'))[_0xf46c('0x58')](_0xf46c('0x50'),'t',_0xf46c('0x60'));var _0x45decc=squel[_0xf46c('0x61')]();var _0x501dd3=[];var _0x3b2053=squel[_0xf46c('0x61')]();var _0x487675;if(_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x62')]){_0x487675=as[_0xf46c('0x63')](_0x3bc3cf['query'][_0xf46c('0x62')]);var _0x574372=_0x487675['sqlOperator'];for(var _0x3dcab8=0x0;_0x3dcab8<_0x487675['conditions'][_0xf46c('0x47')];_0x3dcab8++){var _0x5ec329=_0x487675['conditions'][_0x3dcab8];var _0x38e0bb='i';var _0xb2fdf6=_[_0xf46c('0x64')](_0x4432fa,['name',_0x5ec329[_0xf46c('0x4d')]]);if(!_0xb2fdf6){switch(_0x5ec329['field']){case'unreadMessages':if(_0x5ec329[_0xf46c('0x65')]==0x1){_0x5b7e99['having']('`'+_0x5ec329[_0xf46c('0x4d')]+_0xf46c('0x66'));}else{_0x5b7e99[_0xf46c('0x67')]('`'+_0x5ec329[_0xf46c('0x4d')]+'`\x20>\x200');}break;case _0xf46c('0x68'):if(_0x5ec329['operator']===_0xf46c('0x69')){if(_0x5ec329[_0xf46c('0x65')][_0xf46c('0x6a')]('\x20')[_0xf46c('0x47')]>0x1){_0x45decc[_0x574372](_0xf46c('0x6b'),qs[_0xf46c('0x6c')](_0x5ec329['value']),null);}else{var _0xe6868='%'+_0x5ec329[_0xf46c('0x65')]+'%';_0x45decc[_0x574372](_0xf46c('0x6d'),_0xe6868,_0xe6868,_0xe6868);}}else{_0xb2fdf6=_[_0xf46c('0x64')](_0x4432fa,[_0xf46c('0x2e'),'ContactId']);_0x5ec329[_0xf46c('0x4d')]=_0xf46c('0x6e');_0x40674b=as[_0xf46c('0x6f')](_0x38e0bb,_0xb2fdf6[_0xf46c('0x3f')],_0x5ec329);_0x45decc[_0x574372](_0x40674b[_0xf46c('0x70')],_0x40674b[_0xf46c('0x65')][_0xf46c('0x71')],_0x40674b[_0xf46c('0x65')]['end']);}break;case _0xf46c('0x72'):var _0x3d4eda=_0x5ec329[_0xf46c('0x65')][_0xf46c('0x6a')](',')[_0xf46c('0x3b')](function(_0x20ae7b){return Number(_0x20ae7b);});_0x3d4eda[_0xf46c('0x36')](function(_0x3d49d0){_0x3b2053['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3d49d0+',%');});_0x501dd3=_['union'](_0x501dd3,_0x3d4eda);break;case'User':if(_0x5ec329['operator']==='$substring'){_0x45decc[_0x574372](_0xf46c('0x73'),'%'+_0x5ec329[_0xf46c('0x65')]+'%',null);}else{_0xb2fdf6=_[_0xf46c('0x64')](_0x4432fa,[_0xf46c('0x2e'),_0xf46c('0x74')]);_0x5ec329[_0xf46c('0x4d')]=_0xf46c('0x74');_0x40674b=as[_0xf46c('0x6f')](_0x38e0bb,_0xb2fdf6[_0xf46c('0x3f')],_0x5ec329);_0x45decc[_0x574372](_0x40674b[_0xf46c('0x70')],_0x40674b[_0xf46c('0x65')][_0xf46c('0x71')],_0x40674b[_0xf46c('0x65')]['end']);}break;case _0xf46c('0x32'):_0x40674b=as[_0xf46c('0x6f')]('me',null,_0x5ec329);_0x45decc[_0x574372](_0x40674b[_0xf46c('0x70')],_0x40674b[_0xf46c('0x65')][_0xf46c('0x71')],_0x40674b[_0xf46c('0x65')][_0xf46c('0x21')]);break;}}else{var _0x40674b=as[_0xf46c('0x6f')](_0x38e0bb,_0xb2fdf6['type'],_0x5ec329);_0x45decc[_0x574372](_0x40674b[_0xf46c('0x70')],_0x40674b['value'][_0xf46c('0x71')],_0x40674b[_0xf46c('0x65')][_0xf46c('0x21')]);}}}else{var _0x490386=_(_0x3bc3cf[_0xf46c('0x41')])['keys']()[_0xf46c('0x3b')](function(_0x4c7c68){return _['some'](_0x4432fa,[_0xf46c('0x2e'),_0x4c7c68])?_0x4c7c68:undefined;})[_0xf46c('0x75')]()[_0xf46c('0x65')]();if(!_[_0xf46c('0x76')](_0x490386)){_0x490386[_0xf46c('0x36')](function(_0x8dce76){if(_0x8dce76===_0xf46c('0x77')){_0x5b7e99[_0xf46c('0x4c')](_0xf46c('0x78'),[][_0xf46c('0x79')](_0x3bc3cf[_0xf46c('0x41')][_0x8dce76]));}else if(_0x8dce76===_0xf46c('0x7a')){var _0x297db2=JSON[_0xf46c('0x7b')](_0x3bc3cf['query'][_0x8dce76])[_0xf46c('0x7c')];var _0xd6118e=JSON['parse'](_0x3bc3cf[_0xf46c('0x41')][_0x8dce76])['$lte'];_0x5b7e99[_0xf46c('0x4c')](_0xf46c('0x7d'),_0x297db2,_0xd6118e);}else{if(_0x3bc3cf[_0xf46c('0x41')][_0x8dce76]==='null'){_0x5b7e99[_0xf46c('0x4c')]('i.'+_0x8dce76+_0xf46c('0x7e'));}else{_0x5b7e99[_0xf46c('0x4c')]('i.'+_0x8dce76+'\x20=\x20?',_0x3bc3cf['query'][_0x8dce76]);}}});}if(_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x7f')]){if(_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x7f')]==0x1){_0x5b7e99['having'](_0xf46c('0x80'));}else{_0x5b7e99[_0xf46c('0x67')](_0xf46c('0x81'));}}if(_0x3bc3cf[_0xf46c('0x41')]['tag']){_0x501dd3=_[_0xf46c('0x82')](_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x83')])?_0x3bc3cf[_0xf46c('0x41')]['tag']:new Array(_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x83')]);_0x501dd3[_0xf46c('0x36')](function(_0x24cf1a){_0x3b2053['or'](_0xf46c('0x84'),'%,'+_0x24cf1a+',%');});}if(_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x85')]){var _0x362e29=_0x3bc3cf['query'][_0xf46c('0x85')][_0xf46c('0x86')]('\x5c','\x5c\x5c')[_0xf46c('0x86')](/'/g,'\x27\x27');if(qs[_0xf46c('0x87')](_0x362e29)){_0x45decc['or'](_0xf46c('0x88'),_0x362e29+'%')['or'](_0xf46c('0x89'),_0x362e29+'%');}_0x45decc['or'](_0xf46c('0x8a'),_0x362e29+'%');}}_0x5b7e99['where'](_0x45decc);_0x5b7e99[_0xf46c('0x8b')]('i.id');var _0x5affd7={'type':db[_0xf46c('0x8c')][_0xf46c('0x8d')][_0xf46c('0x8e')],'raw':!![]};var _0x27788e=_0x5b7e99[_0xf46c('0x8f')]();_0x27788e[_0xf46c('0x4d')]('i.id');_0x27788e['field'](_0xf46c('0x90'),_0xf46c('0x91'));if(_0x48e565[_0xf46c('0x4a')]){_0x48e565[_0xf46c('0x4a')][_0xf46c('0x36')](function(_0x552a4c){var _0x426f60=_0x552a4c[0x0]===_0xf46c('0x92')?_0x552a4c[0x0]:'i.'+_0x552a4c[0x0];_0x5b7e99['order'](_0x426f60,_0x552a4c[0x1]===_0xf46c('0x93')?![]:!![]);});}if(!_[_0xf46c('0x76')](_0x501dd3)){_0x5b7e99[_0xf46c('0x67')](_0x3b2053);_0x27788e[_0xf46c('0x4c')](_0xf46c('0x94'),_0x501dd3);}BPromise['resolve']()[_0xf46c('0x2a')](function(){if(!_0x487675){if(_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x77')])return;_0x27788e[_0xf46c('0x4c')](_0xf46c('0x95'));_0x5b7e99[_0xf46c('0x4c')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3bc3cf[_0xf46c('0x96')]['role']!=='agent')return;return _0x3bc3cf[_0xf46c('0x96')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xf46c('0x2a')](function(_0x4d807a){if(_['isEmpty'](_0x4d807a)){_0x27788e[_0xf46c('0x4c')](_0xf46c('0x97'));_0x5b7e99[_0xf46c('0x4c')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x27788e[_0xf46c('0x4c')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x4d807a,'id'));_0x5b7e99['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x4d807a,'id'));}});})['then'](function(){if(_0x3bc3cf['user'][_0xf46c('0x98')]==='agent'&&!_0x487675&&!_0x3bc3cf['query']['FaxAccountId'])return[];return db[_0xf46c('0x99')][_0xf46c('0x41')](_0x27788e[_0xf46c('0x9a')](),_0x5affd7);})[_0xf46c('0x2a')](function(_0x3f826f){_0x218788[_0xf46c('0x25')]=_0x3f826f[_0xf46c('0x47')];if(_0x218788[_0xf46c('0x25')]===0x0)return[];return db[_0xf46c('0x99')][_0xf46c('0x41')](_0x23ac5a[_0xf46c('0x9a')](),_0x5affd7)['then'](function(_0x11652a){_0x58d702=_[_0xf46c('0x9b')](_0x11652a,'id');_0x5affd7=_['merge'](_0x5affd7,{'model':db[_0xf46c('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3bc3cf[_0xf46c('0x41')][_0xf46c('0x46')]){_0x48e565[_0xf46c('0x44')][_0xf46c('0x36')](function(_0x122113){_0x5b7e99[_0xf46c('0x4d')]('i.'+_0x122113);});}else{_0x5b7e99['field'](_0xf46c('0x90'),_0xf46c('0x91'));_0x5b7e99[_0xf46c('0x4d')](_0xf46c('0x9c'),_0xf46c('0x9d'));_0x5b7e99[_0xf46c('0x4d')]('a.mandatoryDisposition',_0xf46c('0x9e'));_0x5b7e99['field'](_0xf46c('0x9f'),_0xf46c('0x92'));_0x5b7e99[_0xf46c('0x4d')](_0xf46c('0xa0'));_0x5b7e99['field'](_0xf46c('0xa1'),_0xf46c('0xa2'));_0x5b7e99[_0xf46c('0x4d')](_0xf46c('0xa3'),_0xf46c('0xa4'));_0x5b7e99['field'](_0xf46c('0xa5'),'Contact.email');_0x5b7e99[_0xf46c('0x4d')]('c.phone',_0xf46c('0xa6'));_0x5b7e99['field']('c.mobile',_0xf46c('0xa7'));_0x5b7e99[_0xf46c('0x4d')]('c.fax','Contact.fax');_0x5b7e99[_0xf46c('0x4d')](_0xf46c('0xa8'),_0xf46c('0xa9'));_0x5b7e99[_0xf46c('0x4d')](_0xf46c('0xaa'),'Owner.internal');_0x5b7e99['field'](_0xf46c('0xab'),_0xf46c('0x35'));}if(_0x48e565['limit'])_0x5b7e99[_0xf46c('0x23')](_0x48e565['limit']);if(_0x48e565['offset'])_0x5b7e99[_0xf46c('0x26')](_0x48e565[_0xf46c('0x26')]);return db[_0xf46c('0x99')][_0xf46c('0x41')](_0x5b7e99['toString'](),_0x5affd7);})[_0xf46c('0x2a')](function(_0x210d3b){if(_0x210d3b['length']>0x0)_0x399c72[_0xf46c('0x4c')](_0xf46c('0xac'),_['map'](_0x210d3b,'id'));return db[_0xf46c('0x99')][_0xf46c('0x41')](_0x399c72[_0xf46c('0x9a')](),_0x5affd7)[_0xf46c('0x2a')](function(_0x209a1f){var _0x9fd0a1=_['groupBy'](_0x209a1f,_0xf46c('0xad'));var _0x392c76=[];_0x210d3b[_0xf46c('0x36')](function(_0x91d227){_0x392c76[_0xf46c('0x38')](updateFaxInteraction(_0x91d227,_0x58d702,_0x9fd0a1));});return BPromise[_0xf46c('0xae')](_0x392c76);});});})['then'](function(_0x590a62){_0x218788[_0xf46c('0xaf')]=_0x590a62;return _0x218788;})[_0xf46c('0x2a')](respondWithFilteredResult(_0x1050d3,_0x48e565))['catch'](handleError(_0x1050d3,null));};exports['show']=function(_0x45ac4b,_0x36da4b){var _0x3cc6c4={'raw':![],'where':{'id':_0x45ac4b['params']['id']}},_0x38eaaa={};_0x38eaaa[_0xf46c('0x40')]=_['keys'](db[_0xf46c('0x3c')][_0xf46c('0x3d')]);_0x38eaaa[_0xf46c('0x41')]=_[_0xf46c('0x42')](_0x45ac4b[_0xf46c('0x41')]);_0x38eaaa[_0xf46c('0x43')]=_[_0xf46c('0x45')](_0x38eaaa[_0xf46c('0x40')],_0x38eaaa[_0xf46c('0x41')]);_0x3cc6c4[_0xf46c('0x44')]=_[_0xf46c('0x45')](_0x38eaaa[_0xf46c('0x40')],qs[_0xf46c('0x46')](_0x45ac4b['query'][_0xf46c('0x46')]));_0x3cc6c4[_0xf46c('0x44')]=_0x3cc6c4[_0xf46c('0x44')][_0xf46c('0x47')]?_0x3cc6c4[_0xf46c('0x44')]:_0x38eaaa['model'];if(_0x45ac4b[_0xf46c('0x41')]['includeAll']){_0x3cc6c4[_0xf46c('0xb0')]=[{'all':!![]}];}_0x3cc6c4=_[_0xf46c('0x31')]({},_0x3cc6c4,_0x45ac4b['options']);return db[_0xf46c('0x3c')][_0xf46c('0x64')](_0x3cc6c4)[_0xf46c('0x2a')](handleEntityNotFound(_0x36da4b,null))[_0xf46c('0x2a')](respondWithResult(_0x36da4b,null))[_0xf46c('0x39')](handleError(_0x36da4b,null));};exports[_0xf46c('0xb1')]=function(_0xe0765f,_0xae8295){return db[_0xf46c('0x3c')][_0xf46c('0xb1')](_0xe0765f['body'],{})[_0xf46c('0x2a')](respondWithResult(_0xae8295,0xc9))[_0xf46c('0x39')](handleError(_0xae8295,null));};exports[_0xf46c('0xb2')]=function(_0x51a64d,_0x4016bc){if(_0x51a64d[_0xf46c('0x32')]['id']){delete _0x51a64d['body']['id'];}return db[_0xf46c('0x3c')][_0xf46c('0x64')]({'where':{'id':_0x51a64d[_0xf46c('0xb3')]['id']}})[_0xf46c('0x2a')](handleEntityNotFound(_0x4016bc,null))[_0xf46c('0x2a')](saveUpdates(_0x51a64d['body'],null))[_0xf46c('0x2a')](respondWithResult(_0x4016bc,null))[_0xf46c('0x39')](handleError(_0x4016bc,null));};exports[_0xf46c('0x2b')]=function(_0xd9a74e,_0x1c52f3){return db['FaxInteraction']['find']({'where':{'id':_0xd9a74e[_0xf46c('0xb3')]['id']}})[_0xf46c('0x2a')](handleEntityNotFound(_0x1c52f3,null))[_0xf46c('0x2a')](removeEntity(_0x1c52f3,null))['catch'](handleError(_0x1c52f3,null));};exports[_0xf46c('0xb4')]=function(_0x6173c2,_0x4df0d4){return db[_0xf46c('0x3c')][_0xf46c('0xb4')]()[_0xf46c('0x2a')](respondWithResult(_0x4df0d4,null))[_0xf46c('0x39')](handleError(_0x4df0d4,null));};exports['addMessage']=function(_0x19fab6,_0x276225,_0x512148){return db['FaxMessage'][_0xf46c('0x64')]({'where':{'id':_0x19fab6[_0xf46c('0xb3')]['id']}})[_0xf46c('0x2a')](handleEntityNotFound(_0x276225,null))[_0xf46c('0x2a')](function(_0x2cf79){if(_0x2cf79){return _0x2cf79[_0xf46c('0xb5')](_0x19fab6[_0xf46c('0x32')][_0xf46c('0xb6')],_[_0xf46c('0xb7')](_0x19fab6[_0xf46c('0x32')],[_0xf46c('0xb6'),'id'])||{});}})['then'](respondWithResult(_0x276225,null))[_0xf46c('0x39')](handleError(_0x276225,null));};exports[_0xf46c('0xb8')]=function(_0x3edcfd,_0x2cc965,_0x3a8b22){var _0x497f9d={'raw':![],'where':{}};var _0xba6418={};var _0x482b1d={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xf46c('0xb9')]({'where':{'id':_0x3edcfd[_0xf46c('0xb3')]['id']}})['then'](handleEntityNotFound(_0x2cc965,null))[_0xf46c('0x2a')](function(_0x5228f2){if(_0x5228f2){_0xba6418[_0xf46c('0x40')]=_['keys'](db[_0xf46c('0xba')][_0xf46c('0x3d')]);_0xba6418['query']=_['keys'](_0x3edcfd['query']);_0xba6418['filters']=_[_0xf46c('0x45')](_0xba6418[_0xf46c('0x40')],_0xba6418[_0xf46c('0x41')]);_0x497f9d['attributes']=_[_0xf46c('0x45')](_0xba6418['model'],qs[_0xf46c('0x46')](_0x3edcfd[_0xf46c('0x41')][_0xf46c('0x46')]));_0x497f9d[_0xf46c('0x44')]=_0x497f9d[_0xf46c('0x44')][_0xf46c('0x47')]?_0x497f9d[_0xf46c('0x44')]:_0xba6418['model'];if(!_0x3edcfd[_0xf46c('0x41')][_0xf46c('0x48')]('nolimit')){_0x497f9d['limit']=qs[_0xf46c('0x23')](_0x3edcfd[_0xf46c('0x41')]['limit']);_0x497f9d[_0xf46c('0x26')]=qs[_0xf46c('0x26')](_0x3edcfd[_0xf46c('0x41')][_0xf46c('0x26')]);}_0x497f9d[_0xf46c('0x4a')]=qs[_0xf46c('0x4b')](_0x3edcfd[_0xf46c('0x41')][_0xf46c('0x4b')]);_0x497f9d[_0xf46c('0x4c')]=qs[_0xf46c('0x43')](_[_0xf46c('0xbb')](_0x3edcfd[_0xf46c('0x41')],_0xba6418[_0xf46c('0x43')]));_0x497f9d[_0xf46c('0x4c')][_0xf46c('0xad')]=_0x5228f2['id'];if(_0x3edcfd[_0xf46c('0x41')]['filter']){_0x497f9d[_0xf46c('0x4c')]=_[_0xf46c('0x31')](_0x497f9d[_0xf46c('0x4c')],{'$or':_['map'](_0x497f9d[_0xf46c('0x44')],function(_0x3cb067){var _0x2a7fa5={};_0x2a7fa5[_0x3cb067]={'$like':'%'+_0x3edcfd['query']['filter']+'%'};return _0x2a7fa5;})});}if(_0x3edcfd['query']['$gte']){var _0x3d49b2=_0x3edcfd[_0xf46c('0x41')]['$gte']['split'](',');var _0x26eb0e={};_0x26eb0e[_0x3d49b2[0x0]]={'$gte':moment(_0x3d49b2[0x1])['format'](_0xf46c('0xbc'))};_0x497f9d[_0xf46c('0x4c')]=_['merge'](_0x497f9d[_0xf46c('0x4c')],_0x26eb0e);}_0x497f9d=_[_0xf46c('0x31')]({},_0x497f9d,_0x3edcfd[_0xf46c('0xbd')]);return db[_0xf46c('0xba')][_0xf46c('0x25')]({'where':_0x497f9d[_0xf46c('0x4c')]})[_0xf46c('0x2a')](function(_0x559dee){_0x482b1d[_0xf46c('0x25')]=_0x559dee;if(_0x3edcfd[_0xf46c('0x41')][_0xf46c('0xbe')]){_0x497f9d['include']=[{'all':!![]}];}return db[_0xf46c('0xba')][_0xf46c('0xbf')](_0x497f9d);})['then'](function(_0x40dd0b){_0x482b1d['rows']=_0x40dd0b;return _0x482b1d;});}})[_0xf46c('0x2a')](respondWithFilteredResult(_0x2cc965,_0x497f9d))['catch'](handleError(_0x2cc965,null));};exports[_0xf46c('0xc0')]=function(_0x2b002a,_0xa6d869,_0x2361af){return db[_0xf46c('0x3c')][_0xf46c('0x64')]({'where':{'id':_0x2b002a[_0xf46c('0xb3')]['id']}})[_0xf46c('0x2a')](handleEntityNotFound(_0xa6d869,null))[_0xf46c('0x2a')](function(_0x1a13e5){if(_0x1a13e5){return _0x1a13e5[_0xf46c('0xc1')](_0x2b002a[_0xf46c('0x32')]['ids'],_[_0xf46c('0xb7')](_0x2b002a['body'],[_0xf46c('0xb6'),'id'])||{})['spread'](function(){return db[_0xf46c('0x72')][_0xf46c('0xbf')]({'attributes':['id','name',_0xf46c('0x4e')],'where':{'id':_0x2b002a[_0xf46c('0x32')][_0xf46c('0xb6')]}});})['then'](function(_0x65794){socket[_0xf46c('0xc2')](_0xf46c('0xc3'),{'id':Number(_0x2b002a[_0xf46c('0xb3')]['id']),'tags':_0x65794||[]});return{'id':Number(_0x2b002a[_0xf46c('0xb3')]['id']),'tags':_0x65794||[]};});}})[_0xf46c('0x2a')](respondWithResult(_0xa6d869,null))['catch'](handleError(_0xa6d869,null));};exports['removeTags']=function(_0x4db742,_0x2c8ac7,_0x579ca8){return db['FaxInteraction'][_0xf46c('0x64')]({'where':{'id':_0x4db742[_0xf46c('0xb3')]['id']}})['then'](handleEntityNotFound(_0x2c8ac7,null))[_0xf46c('0x2a')](function(_0x4ef2b0){if(_0x4ef2b0){return _0x4ef2b0[_0xf46c('0xc4')](_0x4db742['query']['ids']);}})['then'](respondWithStatusCode(_0x2c8ac7,null))[_0xf46c('0x39')](handleError(_0x2c8ac7,null));};exports['download']=function(_0x38e44c,_0x51a8ff){var _0x5dab31=moment()['unix']()[_0xf46c('0x9a')]();var _0x1cbaf6=path['join'](config[_0xf46c('0xc5')],_0xf46c('0xc6'),'files','tmp');var _0x323ae6=path[_0xf46c('0xc7')](config[_0xf46c('0xc5')],'server','files','attachments');var _0x3b9338=path['join'](_0x1cbaf6,_0x5dab31);var _0x55f99f=util[_0xf46c('0xc8')](_0xf46c('0xc9'),_0x38e44c['params']['id'],_0x5dab31);var _0x2ae6a1=path[_0xf46c('0xc7')](_0x1cbaf6,_0x55f99f);var _0x81d317=[];_0x81d317['push']({'model':db['Attachment'],'as':_0xf46c('0xca'),'raw':!![]});var _0x2624b9=[{'model':db[_0xf46c('0xba')],'as':'Messages','attributes':['id',_0xf46c('0x32'),_0xf46c('0x7a')],'include':_0x81d317}];return db[_0xf46c('0x3c')]['find']({'where':{'id':_0x38e44c['params']['id']},'include':_0x2624b9})['then'](handleEntityNotFound(_0x51a8ff,null))[_0xf46c('0x2a')](function(_0x4684a0){if(_0x4684a0&&_0x4684a0[_0xf46c('0xcb')]){var _0x3fcdec=_0x4684a0[_0xf46c('0xcc')]({'plain':!![]});fs[_0xf46c('0xcd')](_0x3b9338);for(var _0x252035=0x0;_0x252035<_0x3fcdec[_0xf46c('0xcb')][_0xf46c('0x47')];_0x252035++){var _0x4a5488=_0x3fcdec['Messages'][_0x252035][_0xf46c('0xca')];if(_0x4a5488){var _0x3db9ef=path[_0xf46c('0xc7')](_0x323ae6,_0x4a5488[_0xf46c('0xce')]);if(fs[_0xf46c('0xcf')](_0x3db9ef)){fs[_0xf46c('0xd0')](_0x3db9ef)[_0xf46c('0xd1')](fs[_0xf46c('0xd2')](path[_0xf46c('0xc7')](_0x3b9338,_0x4a5488[_0xf46c('0xce')])));}}}return BPromise['resolve']()[_0xf46c('0x2a')](function(){return new BPromise(function(_0x1a873c,_0x47ae4b){zipdir(_0x3b9338,{'saveTo':_0x2ae6a1},function(_0x4106ea,_0x5af022){if(_0x4106ea)return _0x47ae4b(_0x4106ea);return _0x1a873c(_0x5af022);});})[_0xf46c('0x2a')](function(){return new BPromise(function(_0x586835,_0x1db026){rimraf(_0x3b9338,function(_0x1a1af1){if(_0x1a1af1)_0x1db026(_0x1a1af1);return _0x586835();});});})[_0xf46c('0x2a')](function(){return _0x51a8ff[_0xf46c('0xd3')](_0x2ae6a1,_0x55f99f,function(_0x3038d6){if(_0x3038d6){console[_0xf46c('0xd4')](_0xf46c('0xd5'),_0x3038d6);}else{fs[_0xf46c('0xd6')](_0x2ae6a1);}});});});}else{return _0x51a8ff[_0xf46c('0x1f')](0xc8);}})['catch'](handleError(_0x51a8ff,null));}; \ No newline at end of file +var _0xa67b=['$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','end','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','push','all','rows','show','includeAll','include','options','create','params','describe','FaxMessage','addMessage','ids','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','addTags','omit','spread','findAll','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','merge','body','contact','message','agent','Users','map','fullname','Tags','TagIds','split','forEach','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','select','field','color','from','u.id','u.fullname','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','operator'];(function(_0x5dace7,_0x558ed9){var _0x5d854f=function(_0x3360fd){while(--_0x3360fd){_0x5dace7['push'](_0x5dace7['shift']());}};_0x5d854f(++_0x558ed9);}(_0xa67b,0x14a));var _0xba67=function(_0x41e8a1,_0x72264){_0x41e8a1=_0x41e8a1-0x0;var _0x53fd27=_0xa67b[_0x41e8a1];return _0x53fd27;};'use strict';var emlformat=require(_0xba67('0x0'));var rimraf=require(_0xba67('0x1'));var zipdir=require(_0xba67('0x2'));var jsonpatch=require(_0xba67('0x3'));var rp=require(_0xba67('0x4'));var moment=require(_0xba67('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xba67('0x6'));var util=require(_0xba67('0x7'));var path=require('path');var sox=require(_0xba67('0x8'));var csv=require('to-csv');var ejs=require(_0xba67('0x9'));var fs=require('fs');var fs_extra=require(_0xba67('0xa'));var _=require(_0xba67('0xb'));var squel=require(_0xba67('0xc'));var crypto=require(_0xba67('0xd'));var jsforce=require(_0xba67('0xe'));var deskjs=require(_0xba67('0xf'));var toCsv=require(_0xba67('0x10'));var querystring=require(_0xba67('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xba67('0x12'));var qs=require(_0xba67('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba67('0x14'));var logger=require(_0xba67('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xba67('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xba67('0x17'))['db'];config[_0xba67('0x18')]=_[_0xba67('0x19')](config[_0xba67('0x18')],{'host':_0xba67('0x1a'),'port':0x18eb});var socket=require(_0xba67('0x1b'))(new Redis(config['redis']));require(_0xba67('0x1c'))['register'](socket);function respondWithStatusCode(_0x3fd200,_0x4e660c){_0x4e660c=_0x4e660c||0xcc;return function(_0x5603ff){if(_0x5603ff){return _0x3fd200[_0xba67('0x1d')](_0x4e660c);}return _0x3fd200[_0xba67('0x1e')](_0x4e660c)['end']();};}function respondWithResult(_0x4a52c5,_0x1c6178){_0x1c6178=_0x1c6178||0xc8;return function(_0x487582){if(_0x487582){return _0x4a52c5[_0xba67('0x1e')](_0x1c6178)[_0xba67('0x1f')](_0x487582);}};}function respondWithFilteredResult(_0x58f656,_0x2b60e2){return function(_0x124cbe){if(_0x124cbe){var _0x106de7=typeof _0x2b60e2[_0xba67('0x20')]===_0xba67('0x21')&&typeof _0x2b60e2[_0xba67('0x22')]==='undefined';var _0x2b0a5b=_0x124cbe['count'];var _0x53c630=_0x106de7?0x0:_0x2b60e2[_0xba67('0x20')];var _0x4cc018=_0x106de7?_0x124cbe[_0xba67('0x23')]:_0x2b60e2[_0xba67('0x20')]+_0x2b60e2[_0xba67('0x22')];var _0x513a0a;if(_0x4cc018>=_0x2b0a5b){_0x4cc018=_0x2b0a5b;_0x513a0a=0xc8;}else{_0x513a0a=0xce;}_0x58f656['status'](_0x513a0a);return _0x58f656[_0xba67('0x24')]('Content-Range',_0x53c630+'-'+_0x4cc018+'/'+_0x2b0a5b)[_0xba67('0x1f')](_0x124cbe);}return null;};}function patchUpdates(_0x59ea6d){return function(_0x5094de){try{jsonpatch[_0xba67('0x25')](_0x5094de,_0x59ea6d,!![]);}catch(_0x17407d){return BPromise[_0xba67('0x26')](_0x17407d);}return _0x5094de[_0xba67('0x27')]();};}function saveUpdates(_0x3e2223,_0x272f6a){return function(_0x155371){if(_0x155371){return _0x155371[_0xba67('0x28')](_0x3e2223)['then'](function(_0x3a0988){return _0x3a0988;});}return null;};}function removeEntity(_0x21b6b1,_0x364d41){return function(_0xfa7027){if(_0xfa7027){return _0xfa7027[_0xba67('0x29')]()[_0xba67('0x2a')](function(){_0x21b6b1[_0xba67('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19c700,_0x2d6873){return function(_0x2e7b8c){if(!_0x2e7b8c){_0x19c700[_0xba67('0x1d')](0x194);}return _0x2e7b8c;};}function handleError(_0x2239ae,_0x2e9a62){_0x2e9a62=_0x2e9a62||0x1f4;return function(_0x33bb9d){logger[_0xba67('0x2b')](_0x33bb9d[_0xba67('0x2c')]);if(_0x33bb9d[_0xba67('0x2d')]){delete _0x33bb9d[_0xba67('0x2d')];}_0x2239ae[_0xba67('0x1e')](_0x2e9a62)[_0xba67('0x2e')](_0x33bb9d);};}function getMustacheRender(_0x1d0fb8,_0x2e9e8b){return Mustache['render'](_0x1d0fb8,_[_0xba67('0x2f')](_0x2e9e8b[_0xba67('0x30')],{'contact':_0x2e9e8b[_0xba67('0x31')],'message':_0x2e9e8b[_0xba67('0x32')],'agent':_0x2e9e8b[_0xba67('0x33')],'interaction':_0x2e9e8b['interaction'],'account':_0x2e9e8b['account']}))||'';}function getInteractionUsers(_0x53fce7,_0x3f95ed){return new BPromise(function(_0x179717,_0x14b4f3){try{if(_0x3f95ed[_0x53fce7['id']]){_0x53fce7[_0xba67('0x34')]=_[_0xba67('0x35')](_0x3f95ed[_0x53fce7['id']],function(_0xe259a7){return{'id':_0xe259a7['id'],'fullname':_0xe259a7[_0xba67('0x36')]};});}}catch(_0x3b1b73){_0x14b4f3(_0x3b1b73);}_0x179717(_0x53fce7);});}function getInteractionTags(_0x5050cb,_0x127cdc){return new BPromise(function(_0x17f259,_0x5d0e91){try{if(_0x5050cb['TagIds']){_0x5050cb[_0xba67('0x37')]=[];_0x5050cb[_0xba67('0x38')][_0xba67('0x39')](',')[_0xba67('0x3a')](function(_0x57f1d9){_0x5050cb[_0xba67('0x37')]['push'](_0x127cdc[_0x57f1d9]);});}delete _0x5050cb[_0xba67('0x38')];}catch(_0x4432f9){_0x5d0e91(_0x4432f9);}_0x17f259(_0x5050cb);});}function updateFaxInteraction(_0x34045c,_0xf08c73,_0x1f9eda){return new BPromise(function(_0x10d350,_0x2747a8){return getInteractionUsers(_0x34045c,_0x1f9eda)[_0xba67('0x2a')](function(_0x5e3339){return getInteractionTags(_0x5e3339,_0xf08c73);})[_0xba67('0x2a')](function(_0x1f9d22){_0x10d350(_0x1f9d22);})[_0xba67('0x3b')](function(_0x165105){_0x2747a8(_0x165105);});});}exports[_0xba67('0x3c')]=function(_0x10ab67,_0x5bfdf6){var _0x62679e={},_0x1ec7c5={},_0xbb9700={'count':0x0,'rows':[]};var _0x519b71=_['map'](db[_0xba67('0x3d')][_0xba67('0x3e')],function(_0x17ac79){return{'name':_0x17ac79[_0xba67('0x3f')],'type':_0x17ac79[_0xba67('0x40')][_0xba67('0x41')]};});_0x1ec7c5['model']=_[_0xba67('0x35')](_0x519b71,_0xba67('0x2d'));_0x1ec7c5[_0xba67('0x42')]=_[_0xba67('0x43')](_0x10ab67[_0xba67('0x42')]);_0x1ec7c5[_0xba67('0x44')]=_[_0xba67('0x45')](_0x1ec7c5[_0xba67('0x46')],_0x1ec7c5[_0xba67('0x42')]);_0x62679e['attributes']=_[_0xba67('0x45')](_0x1ec7c5[_0xba67('0x46')],qs[_0xba67('0x47')](_0x10ab67[_0xba67('0x42')][_0xba67('0x47')]));_0x62679e[_0xba67('0x48')]=_0x62679e[_0xba67('0x48')][_0xba67('0x49')]?_0x62679e[_0xba67('0x48')]:_0x1ec7c5[_0xba67('0x46')];if(!_0x10ab67[_0xba67('0x42')]['hasOwnProperty']('nolimit')){_0x62679e[_0xba67('0x22')]=qs[_0xba67('0x22')](_0x10ab67[_0xba67('0x42')]['limit']);_0x62679e[_0xba67('0x20')]=qs[_0xba67('0x20')](_0x10ab67[_0xba67('0x42')]['offset']);}_0x62679e[_0xba67('0x4a')]=qs[_0xba67('0x4b')](_0x10ab67[_0xba67('0x42')][_0xba67('0x4b')]);_0x62679e[_0xba67('0x4c')]=qs[_0xba67('0x44')](_[_0xba67('0x4d')](_0x10ab67[_0xba67('0x42')],_0x1ec7c5['filters']),_0x519b71);var _0x4fa17c=[];var _0x2f2cdd=squel[_0xba67('0x4e')]()[_0xba67('0x4f')]('id')[_0xba67('0x4f')](_0xba67('0x2d'))[_0xba67('0x4f')](_0xba67('0x50'))[_0xba67('0x51')]('tools_tags');var _0x68ee67=squel[_0xba67('0x4e')]()[_0xba67('0x4f')](_0xba67('0x52'))[_0xba67('0x4f')](_0xba67('0x53'))['field']('ui.FaxInteractionId')[_0xba67('0x51')](_0xba67('0x54'),'ui')[_0xba67('0x55')](_0xba67('0x56'),'u',_0xba67('0x57'));var _0x2daea8=squel[_0xba67('0x4e')]()[_0xba67('0x51')]('fax_interactions','i')[_0xba67('0x55')](_0xba67('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xba67('0x55')](_0xba67('0x56'),'o',_0xba67('0x59'))[_0xba67('0x55')](_0xba67('0x5a'),'a',_0xba67('0x5b'))[_0xba67('0x55')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0xba67('0x5c'),'it',_0xba67('0x5d'))[_0xba67('0x55')](_0xba67('0x5e'),'t',_0xba67('0x5f'));var _0x5689df=squel['expr']();var _0x1982f4=[];var _0xf2b255=squel['expr']();var _0x9a87cd;if(_0x10ab67[_0xba67('0x42')]['search']){_0x9a87cd=as[_0xba67('0x60')](_0x10ab67[_0xba67('0x42')][_0xba67('0x61')]);var _0x1393a7=_0x9a87cd[_0xba67('0x62')];for(var _0x169438=0x0;_0x169438<_0x9a87cd[_0xba67('0x63')][_0xba67('0x49')];_0x169438++){var _0x38bf1e=_0x9a87cd[_0xba67('0x63')][_0x169438];var _0x2f5a4a='i';var _0x3e2d03=_[_0xba67('0x64')](_0x519b71,[_0xba67('0x2d'),_0x38bf1e['field']]);if(!_0x3e2d03){switch(_0x38bf1e[_0xba67('0x4f')]){case'unreadMessages':if(_0x38bf1e[_0xba67('0x65')]==0x1){_0x2daea8[_0xba67('0x66')]('`'+_0x38bf1e[_0xba67('0x4f')]+'`\x20=\x200');}else{_0x2daea8[_0xba67('0x66')]('`'+_0x38bf1e[_0xba67('0x4f')]+_0xba67('0x67'));}break;case _0xba67('0x68'):if(_0x38bf1e[_0xba67('0x69')]===_0xba67('0x6a')){if(_0x38bf1e[_0xba67('0x65')][_0xba67('0x39')]('\x20')['length']>0x1){_0x5689df[_0x1393a7](_0xba67('0x6b'),qs[_0xba67('0x6c')](_0x38bf1e[_0xba67('0x65')]),null);}else{var _0x35fe93='%'+_0x38bf1e[_0xba67('0x65')]+'%';_0x5689df[_0x1393a7](_0xba67('0x6d'),_0x35fe93,_0x35fe93,_0x35fe93);}}else{_0x3e2d03=_[_0xba67('0x64')](_0x519b71,['name','ContactId']);_0x38bf1e['field']=_0xba67('0x6e');_0x54d7d7=as[_0xba67('0x6f')](_0x2f5a4a,_0x3e2d03['type'],_0x38bf1e);_0x5689df[_0x1393a7](_0x54d7d7[_0xba67('0x70')],_0x54d7d7[_0xba67('0x65')]['start'],_0x54d7d7['value'][_0xba67('0x71')]);}break;case _0xba67('0x72'):var _0x8cd6a5=_0x38bf1e['value'][_0xba67('0x39')](',')['map'](function(_0x2f366a){return Number(_0x2f366a);});_0x8cd6a5[_0xba67('0x3a')](function(_0x540bd0){_0xf2b255['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x540bd0+',%');});_0x1982f4=_[_0xba67('0x73')](_0x1982f4,_0x8cd6a5);break;case'User':if(_0x38bf1e[_0xba67('0x69')]==='$substring'){_0x5689df[_0x1393a7](_0xba67('0x74'),'%'+_0x38bf1e['value']+'%',null);}else{_0x3e2d03=_['find'](_0x519b71,[_0xba67('0x2d'),'UserId']);_0x38bf1e[_0xba67('0x4f')]=_0xba67('0x75');_0x54d7d7=as[_0xba67('0x6f')](_0x2f5a4a,_0x3e2d03[_0xba67('0x40')],_0x38bf1e);_0x5689df[_0x1393a7](_0x54d7d7[_0xba67('0x70')],_0x54d7d7[_0xba67('0x65')][_0xba67('0x76')],_0x54d7d7[_0xba67('0x65')][_0xba67('0x71')]);}break;case _0xba67('0x30'):_0x54d7d7=as[_0xba67('0x6f')]('me',null,_0x38bf1e);_0x5689df[_0x1393a7](_0x54d7d7['text'],_0x54d7d7[_0xba67('0x65')]['start'],_0x54d7d7['value']['end']);break;}}else{var _0x54d7d7=as[_0xba67('0x6f')](_0x2f5a4a,_0x3e2d03['type'],_0x38bf1e);_0x5689df[_0x1393a7](_0x54d7d7[_0xba67('0x70')],_0x54d7d7[_0xba67('0x65')]['start'],_0x54d7d7[_0xba67('0x65')][_0xba67('0x71')]);}}}else{var _0x173fbd=_(_0x10ab67[_0xba67('0x42')])[_0xba67('0x43')]()[_0xba67('0x35')](function(_0x5b4285){return _[_0xba67('0x77')](_0x519b71,['name',_0x5b4285])?_0x5b4285:undefined;})['compact']()[_0xba67('0x65')]();if(!_[_0xba67('0x78')](_0x173fbd)){_0x173fbd[_0xba67('0x3a')](function(_0x100c40){if(_0x100c40===_0xba67('0x79')){_0x2daea8[_0xba67('0x4c')](_0xba67('0x7a'),[][_0xba67('0x7b')](_0x10ab67[_0xba67('0x42')][_0x100c40]));}else if(_0x100c40===_0xba67('0x7c')){var _0x40c28c=JSON[_0xba67('0x7d')](_0x10ab67[_0xba67('0x42')][_0x100c40])[_0xba67('0x7e')];var _0x118964=JSON['parse'](_0x10ab67['query'][_0x100c40])[_0xba67('0x7f')];_0x2daea8[_0xba67('0x4c')](_0xba67('0x80'),_0x40c28c,_0x118964);}else{if(_0x10ab67[_0xba67('0x42')][_0x100c40]===_0xba67('0x81')){_0x2daea8['where']('i.'+_0x100c40+'\x20IS\x20NULL');}else{_0x2daea8['where']('i.'+_0x100c40+_0xba67('0x82'),_0x10ab67[_0xba67('0x42')][_0x100c40]);}}});}if(_0x10ab67[_0xba67('0x42')]['read']){if(_0x10ab67[_0xba67('0x42')][_0xba67('0x83')]==0x1){_0x2daea8[_0xba67('0x66')]('`unreadMessages`\x20=\x200');}else{_0x2daea8[_0xba67('0x66')]('`unreadMessages`\x20>\x200');}}if(_0x10ab67[_0xba67('0x42')][_0xba67('0x84')]){_0x1982f4=_[_0xba67('0x85')](_0x10ab67[_0xba67('0x42')][_0xba67('0x84')])?_0x10ab67[_0xba67('0x42')][_0xba67('0x84')]:new Array(_0x10ab67[_0xba67('0x42')]['tag']);_0x1982f4[_0xba67('0x3a')](function(_0x560d71){_0xf2b255['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x560d71+',%');});}if(_0x10ab67['query']['filter']){var _0x2dbd2a=_0x10ab67['query'][_0xba67('0x86')]['replace']('\x5c','\x5c\x5c')[_0xba67('0x87')](/'/g,'\x27\x27');if(qs[_0xba67('0x88')](_0x2dbd2a)){_0x5689df['or'](_0xba67('0x89'),_0x2dbd2a+'%')['or'](_0xba67('0x8a'),_0x2dbd2a+'%');}_0x5689df['or'](_0xba67('0x8b'),_0x2dbd2a+'%');}}_0x2daea8[_0xba67('0x4c')](_0x5689df);_0x2daea8['group']('i.id');var _0xebb60e={'type':db[_0xba67('0x8c')][_0xba67('0x8d')][_0xba67('0x8e')],'raw':!![]};var _0x1c3783=_0x2daea8[_0xba67('0x8f')]();_0x1c3783[_0xba67('0x4f')](_0xba67('0x90'));_0x1c3783[_0xba67('0x4f')](_0xba67('0x91'),_0xba67('0x92'));if(_0x62679e[_0xba67('0x4a')]){_0x62679e[_0xba67('0x4a')][_0xba67('0x3a')](function(_0x5ddde5){var _0x252c02=_0x5ddde5[0x0]==='contactName'?_0x5ddde5[0x0]:'i.'+_0x5ddde5[0x0];_0x2daea8[_0xba67('0x4a')](_0x252c02,_0x5ddde5[0x1]===_0xba67('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x1982f4)){_0x2daea8[_0xba67('0x66')](_0xf2b255);_0x1c3783[_0xba67('0x4c')]('t.id\x20IN\x20?',_0x1982f4);}BPromise[_0xba67('0x94')]()['then'](function(){if(!_0x9a87cd){if(_0x10ab67[_0xba67('0x42')][_0xba67('0x79')])return;_0x1c3783[_0xba67('0x4c')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x2daea8[_0xba67('0x4c')](_0xba67('0x95'));return;}if(_0x10ab67[_0xba67('0x96')][_0xba67('0x97')]!=='agent')return;return _0x10ab67[_0xba67('0x96')][_0xba67('0x98')]({'attributes':['id'],'raw':!![]})[_0xba67('0x2a')](function(_0x55c89d){if(_[_0xba67('0x78')](_0x55c89d)){_0x1c3783[_0xba67('0x4c')](_0xba67('0x99'));_0x2daea8['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x1c3783['where'](_0xba67('0x7a'),_['map'](_0x55c89d,'id'));_0x2daea8['where'](_0xba67('0x7a'),_[_0xba67('0x35')](_0x55c89d,'id'));}});})[_0xba67('0x2a')](function(){if(_0x10ab67[_0xba67('0x96')]['role']===_0xba67('0x33')&&!_0x9a87cd&&!_0x10ab67[_0xba67('0x42')][_0xba67('0x79')])return[];return db['sequelize'][_0xba67('0x42')](_0x1c3783['toString'](),_0xebb60e);})['then'](function(_0x3bd285){_0xbb9700['count']=_0x3bd285['length'];if(_0xbb9700[_0xba67('0x23')]===0x0)return[];return db[_0xba67('0x9a')][_0xba67('0x42')](_0x2f2cdd[_0xba67('0x9b')](),_0xebb60e)[_0xba67('0x2a')](function(_0x18fa10){_0x4fa17c=_['keyBy'](_0x18fa10,'id');_0xebb60e=_[_0xba67('0x2f')](_0xebb60e,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10ab67['query'][_0xba67('0x47')]){_0x62679e[_0xba67('0x48')][_0xba67('0x3a')](function(_0x55fc90){_0x2daea8[_0xba67('0x4f')]('i.'+_0x55fc90);});}else{_0x2daea8[_0xba67('0x4f')](_0xba67('0x91'),_0xba67('0x92'));_0x2daea8[_0xba67('0x4f')]('a.key',_0xba67('0x9c'));_0x2daea8[_0xba67('0x4f')](_0xba67('0x9d'),_0xba67('0x9e'));_0x2daea8[_0xba67('0x4f')]('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',_0xba67('0x9f'));_0x2daea8[_0xba67('0x4f')]('i.*');_0x2daea8[_0xba67('0x4f')]('c.firstName',_0xba67('0xa0'));_0x2daea8[_0xba67('0x4f')]('c.lastName',_0xba67('0xa1'));_0x2daea8[_0xba67('0x4f')]('c.email',_0xba67('0xa2'));_0x2daea8[_0xba67('0x4f')]('c.phone',_0xba67('0xa3'));_0x2daea8[_0xba67('0x4f')](_0xba67('0xa4'),'Contact.mobile');_0x2daea8[_0xba67('0x4f')](_0xba67('0xa5'),_0xba67('0xa6'));_0x2daea8[_0xba67('0x4f')](_0xba67('0xa7'),_0xba67('0xa8'));_0x2daea8[_0xba67('0x4f')](_0xba67('0xa9'),_0xba67('0xaa'));_0x2daea8[_0xba67('0x4f')](_0xba67('0xab'),_0xba67('0x38'));}if(_0x62679e['limit'])_0x2daea8[_0xba67('0x22')](_0x62679e[_0xba67('0x22')]);if(_0x62679e['offset'])_0x2daea8[_0xba67('0x20')](_0x62679e[_0xba67('0x20')]);return db[_0xba67('0x9a')][_0xba67('0x42')](_0x2daea8[_0xba67('0x9b')](),_0xebb60e);})[_0xba67('0x2a')](function(_0x156b21){if(_0x156b21[_0xba67('0x49')]>0x0)_0x68ee67[_0xba67('0x4c')]('ui.FaxInteractionId\x20IN\x20?',_[_0xba67('0x35')](_0x156b21,'id'));return db[_0xba67('0x9a')][_0xba67('0x42')](_0x68ee67['toString'](),_0xebb60e)['then'](function(_0x510d3f){var _0x429a2d=_[_0xba67('0xac')](_0x510d3f,_0xba67('0xad'));var _0x3777af=[];_0x156b21[_0xba67('0x3a')](function(_0x332eea){_0x3777af[_0xba67('0xae')](updateFaxInteraction(_0x332eea,_0x4fa17c,_0x429a2d));});return BPromise[_0xba67('0xaf')](_0x3777af);});});})[_0xba67('0x2a')](function(_0x260299){_0xbb9700[_0xba67('0xb0')]=_0x260299;return _0xbb9700;})[_0xba67('0x2a')](respondWithFilteredResult(_0x5bfdf6,_0x62679e))[_0xba67('0x3b')](handleError(_0x5bfdf6,null));};exports[_0xba67('0xb1')]=function(_0x87fa80,_0x46ae7a){var _0x3809ea={'raw':![],'where':{'id':_0x87fa80['params']['id']}},_0x2f8d79={};_0x2f8d79[_0xba67('0x46')]=_[_0xba67('0x43')](db['FaxInteraction'][_0xba67('0x3e')]);_0x2f8d79[_0xba67('0x42')]=_['keys'](_0x87fa80['query']);_0x2f8d79[_0xba67('0x44')]=_[_0xba67('0x45')](_0x2f8d79[_0xba67('0x46')],_0x2f8d79[_0xba67('0x42')]);_0x3809ea[_0xba67('0x48')]=_[_0xba67('0x45')](_0x2f8d79[_0xba67('0x46')],qs[_0xba67('0x47')](_0x87fa80['query'][_0xba67('0x47')]));_0x3809ea[_0xba67('0x48')]=_0x3809ea[_0xba67('0x48')][_0xba67('0x49')]?_0x3809ea[_0xba67('0x48')]:_0x2f8d79[_0xba67('0x46')];if(_0x87fa80[_0xba67('0x42')][_0xba67('0xb2')]){_0x3809ea[_0xba67('0xb3')]=[{'all':!![]}];}_0x3809ea=_[_0xba67('0x2f')]({},_0x3809ea,_0x87fa80[_0xba67('0xb4')]);return db[_0xba67('0x3d')][_0xba67('0x64')](_0x3809ea)[_0xba67('0x2a')](handleEntityNotFound(_0x46ae7a,null))['then'](respondWithResult(_0x46ae7a,null))[_0xba67('0x3b')](handleError(_0x46ae7a,null));};exports[_0xba67('0xb5')]=function(_0x1e4b6a,_0x3ed4c9){return db[_0xba67('0x3d')][_0xba67('0xb5')](_0x1e4b6a[_0xba67('0x30')],{})['then'](respondWithResult(_0x3ed4c9,0xc9))['catch'](handleError(_0x3ed4c9,null));};exports[_0xba67('0x28')]=function(_0x180652,_0x39d918){if(_0x180652[_0xba67('0x30')]['id']){delete _0x180652[_0xba67('0x30')]['id'];}return db[_0xba67('0x3d')][_0xba67('0x64')]({'where':{'id':_0x180652[_0xba67('0xb6')]['id']}})[_0xba67('0x2a')](handleEntityNotFound(_0x39d918,null))['then'](saveUpdates(_0x180652[_0xba67('0x30')],null))[_0xba67('0x2a')](respondWithResult(_0x39d918,null))['catch'](handleError(_0x39d918,null));};exports['destroy']=function(_0x26def6,_0x4aebff){return db['FaxInteraction']['find']({'where':{'id':_0x26def6['params']['id']}})[_0xba67('0x2a')](handleEntityNotFound(_0x4aebff,null))[_0xba67('0x2a')](removeEntity(_0x4aebff,null))[_0xba67('0x3b')](handleError(_0x4aebff,null));};exports[_0xba67('0xb7')]=function(_0x179d95,_0xa5fc1f){return db['FaxInteraction']['describe']()[_0xba67('0x2a')](respondWithResult(_0xa5fc1f,null))['catch'](handleError(_0xa5fc1f,null));};exports['addMessage']=function(_0x4b9be4,_0x5db533,_0x8b810){return db[_0xba67('0xb8')][_0xba67('0x64')]({'where':{'id':_0x4b9be4[_0xba67('0xb6')]['id']}})[_0xba67('0x2a')](handleEntityNotFound(_0x5db533,null))['then'](function(_0x5268ce){if(_0x5268ce){return _0x5268ce[_0xba67('0xb9')](_0x4b9be4[_0xba67('0x30')][_0xba67('0xba')],_['omit'](_0x4b9be4['body'],[_0xba67('0xba'),'id'])||{});}})[_0xba67('0x2a')](respondWithResult(_0x5db533,null))[_0xba67('0x3b')](handleError(_0x5db533,null));};exports[_0xba67('0xbb')]=function(_0x3bddb3,_0x22db23,_0x561862){var _0xfae6b={'raw':![],'where':{}};var _0x165d1f={};var _0x4b2bf2={'count':0x0,'rows':[]};return db[_0xba67('0x3d')][_0xba67('0xbc')]({'where':{'id':_0x3bddb3[_0xba67('0xb6')]['id']}})['then'](handleEntityNotFound(_0x22db23,null))[_0xba67('0x2a')](function(_0x24666d){if(_0x24666d){_0x165d1f[_0xba67('0x46')]=_[_0xba67('0x43')](db['FaxMessage']['rawAttributes']);_0x165d1f[_0xba67('0x42')]=_['keys'](_0x3bddb3[_0xba67('0x42')]);_0x165d1f['filters']=_[_0xba67('0x45')](_0x165d1f['model'],_0x165d1f[_0xba67('0x42')]);_0xfae6b[_0xba67('0x48')]=_[_0xba67('0x45')](_0x165d1f[_0xba67('0x46')],qs[_0xba67('0x47')](_0x3bddb3[_0xba67('0x42')][_0xba67('0x47')]));_0xfae6b[_0xba67('0x48')]=_0xfae6b[_0xba67('0x48')][_0xba67('0x49')]?_0xfae6b[_0xba67('0x48')]:_0x165d1f[_0xba67('0x46')];if(!_0x3bddb3['query'][_0xba67('0xbd')]('nolimit')){_0xfae6b['limit']=qs[_0xba67('0x22')](_0x3bddb3[_0xba67('0x42')][_0xba67('0x22')]);_0xfae6b[_0xba67('0x20')]=qs['offset'](_0x3bddb3['query'][_0xba67('0x20')]);}_0xfae6b[_0xba67('0x4a')]=qs[_0xba67('0x4b')](_0x3bddb3['query'][_0xba67('0x4b')]);_0xfae6b[_0xba67('0x4c')]=qs[_0xba67('0x44')](_[_0xba67('0x4d')](_0x3bddb3[_0xba67('0x42')],_0x165d1f[_0xba67('0x44')]));_0xfae6b[_0xba67('0x4c')][_0xba67('0xad')]=_0x24666d['id'];if(_0x3bddb3[_0xba67('0x42')]['filter']){_0xfae6b[_0xba67('0x4c')]=_['merge'](_0xfae6b['where'],{'$or':_[_0xba67('0x35')](_0xfae6b[_0xba67('0x48')],function(_0x4f096e){var _0x3bc1ff={};_0x3bc1ff[_0x4f096e]={'$like':'%'+_0x3bddb3[_0xba67('0x42')][_0xba67('0x86')]+'%'};return _0x3bc1ff;})});}if(_0x3bddb3[_0xba67('0x42')][_0xba67('0x7e')]){var _0x4fc5e6=_0x3bddb3[_0xba67('0x42')][_0xba67('0x7e')]['split'](',');var _0x2e610a={};_0x2e610a[_0x4fc5e6[0x0]]={'$gte':moment(_0x4fc5e6[0x1])['format'](_0xba67('0xbe'))};_0xfae6b['where']=_[_0xba67('0x2f')](_0xfae6b['where'],_0x2e610a);}_0xfae6b=_[_0xba67('0x2f')]({},_0xfae6b,_0x3bddb3[_0xba67('0xb4')]);return db[_0xba67('0xb8')][_0xba67('0x23')]({'where':_0xfae6b['where']})[_0xba67('0x2a')](function(_0x2b7905){_0x4b2bf2[_0xba67('0x23')]=_0x2b7905;if(_0x3bddb3[_0xba67('0x42')][_0xba67('0xb2')]){_0xfae6b['include']=[{'all':!![]}];}return db[_0xba67('0xb8')]['findAll'](_0xfae6b);})['then'](function(_0x220e21){_0x4b2bf2[_0xba67('0xb0')]=_0x220e21;return _0x4b2bf2;});}})[_0xba67('0x2a')](respondWithFilteredResult(_0x22db23,_0xfae6b))[_0xba67('0x3b')](handleError(_0x22db23,null));};exports[_0xba67('0xbf')]=function(_0x253997,_0x4f9c57,_0x235743){return db['FaxInteraction'][_0xba67('0x64')]({'where':{'id':_0x253997[_0xba67('0xb6')]['id']}})[_0xba67('0x2a')](handleEntityNotFound(_0x4f9c57,null))[_0xba67('0x2a')](function(_0x3820c9){if(_0x3820c9){return _0x3820c9['setTags'](_0x253997['body'][_0xba67('0xba')],_[_0xba67('0xc0')](_0x253997[_0xba67('0x30')],[_0xba67('0xba'),'id'])||{})[_0xba67('0xc1')](function(){return db[_0xba67('0x72')][_0xba67('0xc2')]({'attributes':['id',_0xba67('0x2d'),_0xba67('0x50')],'where':{'id':_0x253997[_0xba67('0x30')][_0xba67('0xba')]}});})['then'](function(_0x3c74f4){socket[_0xba67('0xc3')](_0xba67('0xc4'),{'id':Number(_0x253997['params']['id']),'tags':_0x3c74f4||[]});return{'id':Number(_0x253997[_0xba67('0xb6')]['id']),'tags':_0x3c74f4||[]};});}})[_0xba67('0x2a')](respondWithResult(_0x4f9c57,null))[_0xba67('0x3b')](handleError(_0x4f9c57,null));};exports[_0xba67('0xc5')]=function(_0x25bd14,_0x2515c4,_0x5794a6){return db['FaxInteraction'][_0xba67('0x64')]({'where':{'id':_0x25bd14[_0xba67('0xb6')]['id']}})[_0xba67('0x2a')](handleEntityNotFound(_0x2515c4,null))[_0xba67('0x2a')](function(_0x396ab7){if(_0x396ab7){return _0x396ab7['removeTags'](_0x25bd14[_0xba67('0x42')][_0xba67('0xba')]);}})[_0xba67('0x2a')](respondWithStatusCode(_0x2515c4,null))[_0xba67('0x3b')](handleError(_0x2515c4,null));};exports['download']=function(_0x1cb8a6,_0x4aa132){var _0x200365=moment()[_0xba67('0xc6')]()[_0xba67('0x9b')]();var _0x227f6b=path[_0xba67('0xc7')](config[_0xba67('0xc8')],_0xba67('0xc9'),_0xba67('0xca'),_0xba67('0xcb'));var _0x28ed97=path['join'](config[_0xba67('0xc8')],_0xba67('0xc9'),_0xba67('0xca'),_0xba67('0xcc'));var _0x586b85=path[_0xba67('0xc7')](_0x227f6b,_0x200365);var _0x51bff1=util[_0xba67('0xcd')](_0xba67('0xce'),_0x1cb8a6['params']['id'],_0x200365);var _0x3256b1=path[_0xba67('0xc7')](_0x227f6b,_0x51bff1);var _0x159b58=[];_0x159b58[_0xba67('0xae')]({'model':db[_0xba67('0xcf')],'as':_0xba67('0xcf'),'raw':!![]});var _0x4aeb0a=[{'model':db['FaxMessage'],'as':_0xba67('0xd0'),'attributes':['id','body','createdAt'],'include':_0x159b58}];return db[_0xba67('0x3d')]['find']({'where':{'id':_0x1cb8a6['params']['id']},'include':_0x4aeb0a})[_0xba67('0x2a')](handleEntityNotFound(_0x4aa132,null))['then'](function(_0x3cb3b7){if(_0x3cb3b7&&_0x3cb3b7['Messages']){var _0xbf56f5=_0x3cb3b7[_0xba67('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x586b85);for(var _0x2faf44=0x0;_0x2faf44<_0xbf56f5['Messages']['length'];_0x2faf44++){var _0x1cdedb=_0xbf56f5[_0xba67('0xd0')][_0x2faf44][_0xba67('0xcf')];if(_0x1cdedb){var _0x459443=path['join'](_0x28ed97,_0x1cdedb[_0xba67('0xd2')]);if(fs[_0xba67('0xd3')](_0x459443)){fs[_0xba67('0xd4')](_0x459443)[_0xba67('0xd5')](fs[_0xba67('0xd6')](path['join'](_0x586b85,_0x1cdedb['basename'])));}}}return BPromise['resolve']()[_0xba67('0x2a')](function(){return new BPromise(function(_0x308cdc,_0x326d0f){zipdir(_0x586b85,{'saveTo':_0x3256b1},function(_0xcfe5a9,_0x1f71b7){if(_0xcfe5a9)return _0x326d0f(_0xcfe5a9);return _0x308cdc(_0x1f71b7);});})[_0xba67('0x2a')](function(){return new BPromise(function(_0xac2d9a,_0x532745){rimraf(_0x586b85,function(_0x1bdcf4){if(_0x1bdcf4)_0x532745(_0x1bdcf4);return _0xac2d9a();});});})['then'](function(){return _0x4aa132[_0xba67('0xd7')](_0x3256b1,_0x51bff1,function(_0x14f324){if(_0x14f324){console[_0xba67('0xd8')]('err',_0x14f324);}else{fs[_0xba67('0xd9')](_0x3256b1);}});});});}else{return _0x4aa132[_0xba67('0x1d')](0xc8);}})[_0xba67('0x3b')](handleError(_0x4aa132,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index e4ec15f..c208932 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 _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc4aa[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x47d8d8,_0x1af6e7){var _0x5654e5=function(_0x234208){while(--_0x234208){_0x47d8d8['push'](_0x47d8d8['shift']());}};_0x5654e5(++_0x1af6e7);}(_0x1261,0x144));var _0x1126=function(_0xc298fe,_0x53be01){_0xc298fe=_0xc298fe-0x0;var _0x2096d3=_0x1261[_0xc298fe];return _0x2096d3;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 92c656c..3d4336a 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 _0x3424=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','define','FaxInteraction'];(function(_0x50c851,_0x2c5513){var _0x53d904=function(_0xf72b7a){while(--_0xf72b7a){_0x50c851['push'](_0x50c851['shift']());}};_0x53d904(++_0x2c5513);}(_0x3424,0x18c));var _0x4342=function(_0x54cbad,_0x266497){_0x54cbad=_0x54cbad-0x0;var _0x32fbe5=_0x3424[_0x54cbad];return _0x32fbe5;};'use strict';var _=require(_0x4342('0x0'));var util=require(_0x4342('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4342('0x2'));var BPromise=require(_0x4342('0x3'));var rp=require(_0x4342('0x4'));var fs=require('fs');var path=require(_0x4342('0x5'));var rimraf=require('rimraf');var config=require(_0x4342('0x6'));var attributes=require(_0x4342('0x7'));module['exports']=function(_0x37c525,_0x31f670){return _0x37c525[_0x4342('0x8')](_0x4342('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5daa31,_0x589e5e,_0x32a2e0){if(_0x5daa31[_0x4342('0xa')]('closed')){_0x5daa31[_0x4342('0xb')]=moment()[_0x4342('0xc')](_0x4342('0xd'));}_0x32a2e0(null,_0x5daa31);}}});}; \ No newline at end of file +var _0x6243=['closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','request-promise','path','rimraf','exports','FaxInteraction','fax_interactions','changed','closed'];(function(_0xf4237a,_0x1ac1e2){var _0x7b4c17=function(_0x3fd747){while(--_0x3fd747){_0xf4237a['push'](_0xf4237a['shift']());}};_0x7b4c17(++_0x1ac1e2);}(_0x6243,0x188));var _0x3624=function(_0x4c7516,_0x5e450e){_0x4c7516=_0x4c7516-0x0;var _0x4b9faf=_0x6243[_0x4c7516];return _0x4b9faf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3624('0x0'))(_0x3624('0x1'));var moment=require(_0x3624('0x2'));var BPromise=require('bluebird');var rp=require(_0x3624('0x3'));var fs=require('fs');var path=require(_0x3624('0x4'));var rimraf=require(_0x3624('0x5'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x3624('0x6')]=function(_0x1edf9d,_0x162b5f){return _0x1edf9d['define'](_0x3624('0x7'),attributes,{'tableName':_0x3624('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43dd46,_0x2c4c6f,_0x2c16df){if(_0x43dd46[_0x3624('0x9')](_0x3624('0xa'))){_0x43dd46[_0x3624('0xb')]=moment()['format'](_0x3624('0xc'));}_0x2c16df(null,_0x43dd46);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 42404b8..4e0ccf7 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 _0x97ac=['update','options','raw','where','attributes','limit','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxInteraction'];(function(_0x2b0a08,_0x322d00){var _0x412dcf=function(_0x3c9969){while(--_0x3c9969){_0x2b0a08['push'](_0x2b0a08['shift']());}};_0x412dcf(++_0x322d00);}(_0x97ac,0xf1));var _0xc97a=function(_0x572ef4,_0x4319ef){_0x572ef4=_0x572ef4-0x0;var _0x4f4da3=_0x97ac[_0x572ef4];return _0x4f4da3;};'use strict';var _=require(_0xc97a('0x0'));var util=require('util');var moment=require(_0xc97a('0x1'));var BPromise=require(_0xc97a('0x2'));var rs=require(_0xc97a('0x3'));var fs=require('fs');var Redis=require(_0xc97a('0x4'));var db=require(_0xc97a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc97a('0x6'))(_0xc97a('0x7'));var config=require(_0xc97a('0x8'));var jayson=require(_0xc97a('0x9'));var client=jayson[_0xc97a('0xa')][_0xc97a('0xb')]({'port':0x232a});config[_0xc97a('0xc')]=_[_0xc97a('0xd')](config[_0xc97a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc97a('0xe'))(new Redis(config[_0xc97a('0xc')]));require('./faxInteraction.socket')[_0xc97a('0xf')](socket);function respondWithRpcPromise(_0x2dee3b,_0x3c025f,_0x2bfbc4){return new BPromise(function(_0x49b4c2,_0xc61dab){return client[_0xc97a('0x10')](_0x2dee3b,_0x2bfbc4)[_0xc97a('0x11')](function(_0x218942){logger[_0xc97a('0x12')](_0xc97a('0x13'),_0x3c025f,_0xc97a('0x14'));logger[_0xc97a('0x15')](_0xc97a('0x16'),_0x3c025f,_0xc97a('0x14'),JSON[_0xc97a('0x17')](_0x218942));if(_0x218942[_0xc97a('0x18')]){if(_0x218942[_0xc97a('0x18')][_0xc97a('0x19')]===0x1f4){logger['error'](_0xc97a('0x13'),_0x3c025f,_0x218942[_0xc97a('0x18')]['message']);return _0xc61dab(_0x218942['error'][_0xc97a('0x1a')]);}logger['error'](_0xc97a('0x13'),_0x3c025f,_0x218942[_0xc97a('0x18')][_0xc97a('0x1a')]);return _0x49b4c2(_0x218942['error'][_0xc97a('0x1a')]);}else{logger[_0xc97a('0x12')](_0xc97a('0x13'),_0x3c025f,_0xc97a('0x14'));_0x49b4c2(_0x218942[_0xc97a('0x1b')][_0xc97a('0x1a')]);}})['catch'](function(_0x7b165b){logger[_0xc97a('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x3c025f,_0x7b165b);_0xc61dab(_0x7b165b);});});}exports['UpdateFaxInteraction']=function(_0x513c78){var _0xb36a17=this;return new Promise(function(_0xd75903,_0x2212f8){return db[_0xc97a('0x1c')][_0xc97a('0x1d')](_0x513c78['body'],{'raw':_0x513c78[_0xc97a('0x1e')]?_0x513c78[_0xc97a('0x1e')][_0xc97a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513c78['options']?_0x513c78['options'][_0xc97a('0x20')]||null:null,'attributes':_0x513c78[_0xc97a('0x1e')]?_0x513c78[_0xc97a('0x1e')][_0xc97a('0x21')]||null:null,'limit':_0x513c78[_0xc97a('0x1e')]?_0x513c78['options'][_0xc97a('0x22')]||null:null})[_0xc97a('0x11')](function(_0xcc4f28){logger['info']('UpdateFaxInteraction',_0x513c78);logger[_0xc97a('0x15')](_0xc97a('0x23'),_0x513c78,JSON[_0xc97a('0x17')](_0xcc4f28));_0xd75903(_0xcc4f28);})[_0xc97a('0x24')](function(_0x39ab67){logger[_0xc97a('0x18')](_0xc97a('0x23'),_0x39ab67['message'],_0x513c78);_0x2212f8(_0xb36a17['error'](0x1f4,_0x39ab67['message']));});});};exports[_0xc97a('0x25')]=function(_0x3bf692){return new Promise(function(_0x13424b,_0x44efbf){return db[_0xc97a('0x1c')][_0xc97a('0x26')]({'where':_0x3bf692[_0xc97a('0x1e')]?_0x3bf692[_0xc97a('0x1e')][_0xc97a('0x20')]||null:null})['then'](function(_0x54d396){if(_0x54d396){return _0x54d396[_0xc97a('0x27')](_0x3bf692[_0xc97a('0x28')]['ids'],_[_0xc97a('0x29')](_0x3bf692[_0xc97a('0x28')],[_0xc97a('0x2a'),'id'])||{});}})[_0xc97a('0x2b')](function(_0x596502){logger['info'](_0xc97a('0x2c'),_0x3bf692);logger[_0xc97a('0x15')](_0xc97a('0x2c'),_0x3bf692,JSON[_0xc97a('0x17')](_0x596502));_0x13424b(_0x596502);})['catch'](function(_0x5a43f2){logger[_0xc97a('0x18')](_0xc97a('0x2c'),_0x5a43f2[_0xc97a('0x1a')],_0x3bf692);_0x44efbf(_this['error'](0x1f4,_0x5a43f2[_0xc97a('0x1a')]));});});}; \ No newline at end of file +var _0xdac9=['./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','then','stringify','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','catch','lodash','util','moment','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xdac9,0xda));var _0x9dac=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xdac9[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x9dac('0x0'));var util=require(_0x9dac('0x1'));var moment=require(_0x9dac('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(_0x9dac('0x3'));var logger=require(_0x9dac('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9dac('0x5'));var client=jayson[_0x9dac('0x6')][_0x9dac('0x7')]({'port':0x232a});config[_0x9dac('0x8')]=_[_0x9dac('0x9')](config[_0x9dac('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9dac('0x8')]));require(_0x9dac('0xa'))[_0x9dac('0xb')](socket);function respondWithRpcPromise(_0x3b73b3,_0x39b9f5,_0x1eb158){return new BPromise(function(_0x44710d,_0x56d324){return client[_0x9dac('0xc')](_0x3b73b3,_0x1eb158)['then'](function(_0x2622d0){logger[_0x9dac('0xd')](_0x9dac('0xe'),_0x39b9f5,_0x9dac('0xf'));logger[_0x9dac('0x10')](_0x9dac('0x11'),_0x39b9f5,_0x9dac('0xf'),JSON['stringify'](_0x2622d0));if(_0x2622d0[_0x9dac('0x12')]){if(_0x2622d0[_0x9dac('0x12')][_0x9dac('0x13')]===0x1f4){logger[_0x9dac('0x12')](_0x9dac('0xe'),_0x39b9f5,_0x2622d0[_0x9dac('0x12')][_0x9dac('0x14')]);return _0x56d324(_0x2622d0['error'][_0x9dac('0x14')]);}logger[_0x9dac('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x39b9f5,_0x2622d0[_0x9dac('0x12')][_0x9dac('0x14')]);return _0x44710d(_0x2622d0[_0x9dac('0x12')][_0x9dac('0x14')]);}else{logger[_0x9dac('0xd')](_0x9dac('0xe'),_0x39b9f5,'request\x20sent');_0x44710d(_0x2622d0['result'][_0x9dac('0x14')]);}})['catch'](function(_0x3813bb){logger[_0x9dac('0x12')](_0x9dac('0xe'),_0x39b9f5,_0x3813bb);_0x56d324(_0x3813bb);});});}exports[_0x9dac('0x15')]=function(_0x164a15){var _0x6ac7a0=this;return new Promise(function(_0x28b7ae,_0x3611b2){return db[_0x9dac('0x16')]['update'](_0x164a15[_0x9dac('0x17')],{'raw':_0x164a15['options']?_0x164a15[_0x9dac('0x18')][_0x9dac('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x164a15[_0x9dac('0x18')]?_0x164a15[_0x9dac('0x18')][_0x9dac('0x1a')]||null:null,'attributes':_0x164a15[_0x9dac('0x18')]?_0x164a15[_0x9dac('0x18')][_0x9dac('0x1b')]||null:null,'limit':_0x164a15['options']?_0x164a15[_0x9dac('0x18')][_0x9dac('0x1c')]||null:null})[_0x9dac('0x1d')](function(_0x5f43e6){logger['info']('UpdateFaxInteraction',_0x164a15);logger['debug'](_0x9dac('0x15'),_0x164a15,JSON[_0x9dac('0x1e')](_0x5f43e6));_0x28b7ae(_0x5f43e6);})['catch'](function(_0x3fed4c){logger[_0x9dac('0x12')](_0x9dac('0x15'),_0x3fed4c[_0x9dac('0x14')],_0x164a15);_0x3611b2(_0x6ac7a0[_0x9dac('0x12')](0x1f4,_0x3fed4c[_0x9dac('0x14')]));});});};exports[_0x9dac('0x1f')]=function(_0x48974a){return new Promise(function(_0x4797e9,_0x93d108){return db['FaxInteraction'][_0x9dac('0x20')]({'where':_0x48974a[_0x9dac('0x18')]?_0x48974a['options']['where']||null:null})[_0x9dac('0x1d')](function(_0x4b34de){if(_0x4b34de){return _0x4b34de[_0x9dac('0x21')](_0x48974a[_0x9dac('0x17')][_0x9dac('0x22')],_['omit'](_0x48974a[_0x9dac('0x17')],[_0x9dac('0x22'),'id'])||{});}})[_0x9dac('0x23')](function(_0x57c53b){logger[_0x9dac('0xd')](_0x9dac('0x24'),_0x48974a);logger[_0x9dac('0x10')](_0x9dac('0x24'),_0x48974a,JSON[_0x9dac('0x1e')](_0x57c53b));_0x4797e9(_0x57c53b);})[_0x9dac('0x25')](function(_0x2fedc3){logger[_0x9dac('0x12')](_0x9dac('0x24'),_0x2fedc3[_0x9dac('0x14')],_0x48974a);_0x93d108(_this['error'](0x1f4,_0x2fedc3[_0x9dac('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d137de5..9cd15bb 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 _0x6599=['save','remove','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x6599,0x1e7));var _0x9659=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0x6599[_0x12d812];return _0x3711ab;};'use strict';var FaxInteractionEvents=require(_0x9659('0x0'));var events=[_0x9659('0x1'),_0x9659('0x2'),'update'];function createListener(_0x58511f,_0x3c9e97){return function(_0x39113c){_0x3c9e97[_0x9659('0x3')](_0x58511f,_0x39113c);};}function removeListener(_0x35cdc5,_0x45a3e4){return function(){FaxInteractionEvents[_0x9659('0x4')](_0x35cdc5,_0x45a3e4);};}exports[_0x9659('0x5')]=function(_0x4cfe17){for(var _0x4d00a0=0x0,_0x794634=events[_0x9659('0x6')];_0x4d00a0<_0x794634;_0x4d00a0++){var _0x308ae6=events[_0x4d00a0];var _0x9dda2e=createListener(_0x9659('0x7')+_0x308ae6,_0x4cfe17);FaxInteractionEvents['on'](_0x308ae6,_0x9dda2e);}}; \ No newline at end of file +var _0xc32d=['remove','emit','removeListener','register','./faxInteraction.events','save'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc32d,0x14e));var _0xdc32=function(_0x1054c3,_0x279e9f){_0x1054c3=_0x1054c3-0x0;var _0x34edbb=_0xc32d[_0x1054c3];return _0x34edbb;};'use strict';var FaxInteractionEvents=require(_0xdc32('0x0'));var events=[_0xdc32('0x1'),_0xdc32('0x2'),'update'];function createListener(_0x4a4647,_0x345028){return function(_0x5bbe62){_0x345028[_0xdc32('0x3')](_0x4a4647,_0x5bbe62);};}function removeListener(_0x45e7c5,_0x52ca5b){return function(){FaxInteractionEvents[_0xdc32('0x4')](_0x45e7c5,_0x52ca5b);};}exports[_0xdc32('0x5')]=function(_0x6d42dc){for(var _0x145c7d=0x0,_0x105316=events['length'];_0x145c7d<_0x105316;_0x145c7d++){var _0x415eb8=events[_0x145c7d];var _0x2361c4=createListener('faxInteraction:'+_0x415eb8,_0x6d42dc);FaxInteractionEvents['on'](_0x415eb8,_0x2361c4);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 907b1eb..d14eaf6 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 _0x0762=['./faxInteraction.controller','get','/describe','isAuthenticated','describe','/:id','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1f05d4,_0x4c1554){var _0x383cb9=function(_0x146030){while(--_0x146030){_0x1f05d4['push'](_0x1f05d4['shift']());}};_0x383cb9(++_0x4c1554);}(_0x0762,0x1e6));var _0x2076=function(_0x198a7b,_0x53475c){_0x198a7b=_0x198a7b-0x0;var _0x443281=_0x0762[_0x198a7b];return _0x443281;};'use strict';var multer=require(_0x2076('0x0'));var util=require(_0x2076('0x1'));var path=require(_0x2076('0x2'));var timeout=require('connect-timeout');var express=require(_0x2076('0x3'));var router=express[_0x2076('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2076('0x5'));var interaction=require(_0x2076('0x6'));var config=require('../../config/environment');var controller=require(_0x2076('0x7'));router[_0x2076('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2076('0x8')](_0x2076('0x9'),auth[_0x2076('0xa')](),controller[_0x2076('0xb')]);router[_0x2076('0x8')](_0x2076('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2076('0x8')]('/:id/messages',auth[_0x2076('0xa')](),controller['getMessages']);router[_0x2076('0x8')](_0x2076('0xd'),auth[_0x2076('0xa')](),controller[_0x2076('0xe')]);router[_0x2076('0xf')]('/',auth[_0x2076('0xa')](),controller[_0x2076('0x10')]);router[_0x2076('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2076('0x11')]);router[_0x2076('0xf')](_0x2076('0x12'),auth[_0x2076('0xa')](),interaction[_0x2076('0x13')](_0x2076('0x14'),_0x2076('0x15')),controller[_0x2076('0x16')]);router[_0x2076('0x17')](_0x2076('0xc'),auth[_0x2076('0xa')](),interaction[_0x2076('0x13')](_0x2076('0x14'),_0x2076('0x18')),controller['update']);router[_0x2076('0x19')](_0x2076('0xc'),auth['isAuthenticated'](),interaction[_0x2076('0x13')](_0x2076('0x14'),_0x2076('0x1a')),controller[_0x2076('0x1b')]);router[_0x2076('0x19')](_0x2076('0x12'),auth[_0x2076('0xa')](),controller[_0x2076('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xc8d9=['describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','removeTags','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe'];(function(_0x4634d4,_0x550bc4){var _0x23398e=function(_0x8b71d2){while(--_0x8b71d2){_0x4634d4['push'](_0x4634d4['shift']());}};_0x23398e(++_0x550bc4);}(_0xc8d9,0x8c));var _0x9c8d=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0xc8d9[_0x1ceb7b];return _0x57c016;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9c8d('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9c8d('0x1')]();var fs_extra=require(_0x9c8d('0x2'));var auth=require(_0x9c8d('0x3'));var interaction=require(_0x9c8d('0x4'));var config=require(_0x9c8d('0x5'));var controller=require(_0x9c8d('0x6'));router[_0x9c8d('0x7')]('/',auth[_0x9c8d('0x8')](),controller['index']);router[_0x9c8d('0x7')](_0x9c8d('0x9'),auth[_0x9c8d('0x8')](),controller[_0x9c8d('0xa')]);router[_0x9c8d('0x7')](_0x9c8d('0xb'),auth[_0x9c8d('0x8')](),controller[_0x9c8d('0xc')]);router[_0x9c8d('0x7')](_0x9c8d('0xd'),auth['isAuthenticated'](),controller[_0x9c8d('0xe')]);router['get'](_0x9c8d('0xf'),auth[_0x9c8d('0x8')](),controller[_0x9c8d('0x10')]);router[_0x9c8d('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9c8d('0x11')](_0x9c8d('0xd'),auth[_0x9c8d('0x8')](),controller['addMessage']);router['post'](_0x9c8d('0x12'),auth[_0x9c8d('0x8')](),interaction[_0x9c8d('0x13')](_0x9c8d('0x14'),_0x9c8d('0x15')),controller[_0x9c8d('0x16')]);router[_0x9c8d('0x17')](_0x9c8d('0xb'),auth[_0x9c8d('0x8')](),interaction[_0x9c8d('0x13')](_0x9c8d('0x14'),'faxinteraction:update'),controller[_0x9c8d('0x18')]);router[_0x9c8d('0x19')](_0x9c8d('0xb'),auth[_0x9c8d('0x8')](),interaction[_0x9c8d('0x13')](_0x9c8d('0x14'),_0x9c8d('0x1a')),controller[_0x9c8d('0x1b')]);router[_0x9c8d('0x19')]('/:id/tags',auth[_0x9c8d('0x8')](),controller[_0x9c8d('0x1c')]);module[_0x9c8d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c56aaa0..cfcdfb9 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 _0xf1cb=['exports','medium','ENUM','out','TEXT','DATE','sequelize'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xf1cb,0x1b8));var _0xbf1c=function(_0x3994f9,_0x51edba){_0x3994f9=_0x3994f9-0x0;var _0x22da92=_0xf1cb[_0x3994f9];return _0x22da92;};'use strict';var Sequelize=require(_0xbf1c('0x0'));module[_0xbf1c('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbf1c('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbf1c('0x3')]('in',_0xbf1c('0x4')),'defaultValue':_0xbf1c('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbf1c('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbf1c('0x6')]}}; \ No newline at end of file +var _0xdb3f=['BOOLEAN','ENUM','out','sequelize','exports','TEXT','medium'];(function(_0x3c93e8,_0x265580){var _0xdefb15=function(_0x1d01ca){while(--_0x1d01ca){_0x3c93e8['push'](_0x3c93e8['shift']());}};_0xdefb15(++_0x265580);}(_0xdb3f,0x17d));var _0xfdb3=function(_0x256910,_0x3f61c3){_0x256910=_0x256910-0x0;var _0x540331=_0xdb3f[_0x256910];return _0x540331;};'use strict';var Sequelize=require(_0xfdb3('0x0'));module[_0xfdb3('0x1')]={'body':{'type':Sequelize[_0xfdb3('0x2')](_0xfdb3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfdb3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfdb3('0x5')]('in',_0xfdb3('0x6')),'defaultValue':_0xfdb3('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfdb3('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 1137844..31ada4f 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 _0x105c=['findOne','ContactId','Attachment','AttachmentId','SendFax','isNil','basename','download','join','root','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','name','send','merge','body','contact','agent','interaction','account','FaxMessage','fieldName','key','map','query','intersection','model','attributes','fields','length','sort','filters','where','type','VIRTUAL','filter','options','include','show','params','rawAttributes','keys','includeAll','find','destroy','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','FaxInteraction','FaxInteractionId','read1stAt','get','user','role','stringify','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','fax-interactions','RejectMessage','event','create'];(function(_0x47df26,_0x330234){var _0x25ea54=function(_0x4e0ea0){while(--_0x4e0ea0){_0x47df26['push'](_0x47df26['shift']());}};_0x25ea54(++_0x330234);}(_0x105c,0x112));var _0xc105=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x105c[_0x188a93];return _0x23b40d;};'use strict';var emlformat=require(_0xc105('0x0'));var rimraf=require(_0xc105('0x1'));var zipdir=require(_0xc105('0x2'));var jsonpatch=require(_0xc105('0x3'));var rp=require(_0xc105('0x4'));var moment=require(_0xc105('0x5'));var BPromise=require(_0xc105('0x6'));var Mustache=require(_0xc105('0x7'));var util=require(_0xc105('0x8'));var path=require(_0xc105('0x9'));var sox=require(_0xc105('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc105('0xb'));var _=require('lodash');var squel=require(_0xc105('0xc'));var crypto=require(_0xc105('0xd'));var jsforce=require(_0xc105('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc105('0xf'));var querystring=require(_0xc105('0x10'));var Papa=require(_0xc105('0x11'));var Redis=require(_0xc105('0x12'));var authService=require(_0xc105('0x13'));var qs=require(_0xc105('0x14'));var as=require(_0xc105('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc105('0x16'))(_0xc105('0x17'));var utils=require(_0xc105('0x18'));var config=require(_0xc105('0x19'));var licenseUtil=require(_0xc105('0x1a'));var db=require(_0xc105('0x1b'))['db'];config['redis']=_[_0xc105('0x1c')](config[_0xc105('0x1d')],{'host':_0xc105('0x1e'),'port':0x18eb});var socket=require(_0xc105('0x1f'))(new Redis(config['redis']));require(_0xc105('0x20'))[_0xc105('0x21')](socket);var jayson=require(_0xc105('0x22'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xc105('0x23')]({'port':0x232a});function respondWithRpcPromise(_0xd329c0,_0x476a76,_0x339f3d,_0x5a00d8){return new BPromise(function(_0x568be4,_0xa4d39d){var _0x5c1f5b=_0x5a00d8||client;return _0x5c1f5b[_0xc105('0x24')](_0xd329c0,_0x339f3d)[_0xc105('0x25')](function(_0x3fcf40){logger[_0xc105('0x26')]('FaxMessage,\x20%s,\x20%s',_0x476a76,_0xc105('0x27'));logger[_0xc105('0x28')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x476a76,'request\x20sent',JSON['stringify'](_0x3fcf40));if(_0x3fcf40[_0xc105('0x29')]){if(_0x3fcf40['error'][_0xc105('0x2a')]===0x1f4){logger['error'](_0xc105('0x2b'),_0x476a76,_0x3fcf40['error'][_0xc105('0x2c')]);return _0xa4d39d(_0x3fcf40[_0xc105('0x29')][_0xc105('0x2c')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x476a76,_0x3fcf40[_0xc105('0x29')][_0xc105('0x2c')]);return _0x568be4(_0x3fcf40['error']['message']);}else{logger[_0xc105('0x26')](_0xc105('0x2b'),_0x476a76,_0xc105('0x27'));_0x568be4(_0x3fcf40[_0xc105('0x2d')][_0xc105('0x2c')]);}})[_0xc105('0x2e')](function(_0x24e373){logger[_0xc105('0x29')]('FaxMessage,\x20%s,\x20%s',_0x476a76,_0x24e373);_0xa4d39d(_0x24e373);});});}function respondWithStatusCode(_0x39caa0,_0x585a2a){_0x585a2a=_0x585a2a||0xcc;return function(_0x26656a){if(_0x26656a){return _0x39caa0['sendStatus'](_0x585a2a);}return _0x39caa0[_0xc105('0x2f')](_0x585a2a)[_0xc105('0x30')]();};}function respondWithResult(_0x4c691e,_0x1039d0){_0x1039d0=_0x1039d0||0xc8;return function(_0x5eb472){if(_0x5eb472){return _0x4c691e[_0xc105('0x2f')](_0x1039d0)[_0xc105('0x31')](_0x5eb472);}};}function respondWithFilteredResult(_0x51f5e4,_0x104352){return function(_0x181ee4){if(_0x181ee4){var _0x18ead7=typeof _0x104352[_0xc105('0x32')]==='undefined'&&typeof _0x104352[_0xc105('0x33')]===_0xc105('0x34');var _0x381c4f=_0x181ee4['count'];var _0x34d718=_0x18ead7?0x0:_0x104352[_0xc105('0x32')];var _0x2ecb03=_0x18ead7?_0x181ee4[_0xc105('0x35')]:_0x104352[_0xc105('0x32')]+_0x104352[_0xc105('0x33')];var _0x45f4cb;if(_0x2ecb03>=_0x381c4f){_0x2ecb03=_0x381c4f;_0x45f4cb=0xc8;}else{_0x45f4cb=0xce;}_0x51f5e4[_0xc105('0x2f')](_0x45f4cb);return _0x51f5e4[_0xc105('0x36')](_0xc105('0x37'),_0x34d718+'-'+_0x2ecb03+'/'+_0x381c4f)['json'](_0x181ee4);}return null;};}function patchUpdates(_0x2dcc63){return function(_0x2fb089){try{jsonpatch['apply'](_0x2fb089,_0x2dcc63,!![]);}catch(_0x338b9f){return BPromise[_0xc105('0x38')](_0x338b9f);}return _0x2fb089['save']();};}function saveUpdates(_0x4e1bed,_0x44e32b){return function(_0x627021){if(_0x627021){return _0x627021[_0xc105('0x39')](_0x4e1bed)[_0xc105('0x25')](function(_0x59e72a){return _0x59e72a;});}return null;};}function removeEntity(_0x3589cf,_0x295937){return function(_0x16a4e5){if(_0x16a4e5){return _0x16a4e5['destroy']()[_0xc105('0x25')](function(){_0x3589cf['status'](0xcc)[_0xc105('0x30')]();});}};}function handleEntityNotFound(_0x20bee5,_0x49fad3){return function(_0x1b897c){if(!_0x1b897c){_0x20bee5['sendStatus'](0x194);}return _0x1b897c;};}function handleError(_0x443ab3,_0x25f087){_0x25f087=_0x25f087||0x1f4;return function(_0x495eaa){logger[_0xc105('0x29')](_0x495eaa['stack']);if(_0x495eaa[_0xc105('0x3a')]){delete _0x495eaa[_0xc105('0x3a')];}_0x443ab3['status'](_0x25f087)[_0xc105('0x3b')](_0x495eaa);};}function getMustacheRender(_0x50f145,_0x18c6ee){return Mustache['render'](_0x50f145,_[_0xc105('0x3c')](_0x18c6ee[_0xc105('0x3d')],{'contact':_0x18c6ee[_0xc105('0x3e')],'message':_0x18c6ee[_0xc105('0x2c')],'agent':_0x18c6ee[_0xc105('0x3f')],'interaction':_0x18c6ee[_0xc105('0x40')],'account':_0x18c6ee[_0xc105('0x41')]}))||'';}exports['index']=function(_0x2e5b0e,_0x374fa5){var _0x736b5d={},_0x32c259={},_0x59d1a6={'count':0x0,'rows':[]};var _0x550d37=_['map'](db[_0xc105('0x42')]['rawAttributes'],function(_0xef8096){return{'name':_0xef8096[_0xc105('0x43')],'type':_0xef8096['type'][_0xc105('0x44')]};});_0x32c259['model']=_[_0xc105('0x45')](_0x550d37,_0xc105('0x3a'));_0x32c259['query']=_['keys'](_0x2e5b0e[_0xc105('0x46')]);_0x32c259['filters']=_[_0xc105('0x47')](_0x32c259[_0xc105('0x48')],_0x32c259[_0xc105('0x46')]);_0x736b5d[_0xc105('0x49')]=_[_0xc105('0x47')](_0x32c259['model'],qs[_0xc105('0x4a')](_0x2e5b0e[_0xc105('0x46')][_0xc105('0x4a')]));_0x736b5d[_0xc105('0x49')]=_0x736b5d[_0xc105('0x49')][_0xc105('0x4b')]?_0x736b5d['attributes']:_0x32c259['model'];if(!_0x2e5b0e['query']['hasOwnProperty']('nolimit')){_0x736b5d[_0xc105('0x33')]=qs[_0xc105('0x33')](_0x2e5b0e[_0xc105('0x46')][_0xc105('0x33')]);_0x736b5d[_0xc105('0x32')]=qs[_0xc105('0x32')](_0x2e5b0e['query'][_0xc105('0x32')]);}_0x736b5d['order']=qs[_0xc105('0x4c')](_0x2e5b0e['query'][_0xc105('0x4c')]);_0x736b5d['where']=qs[_0xc105('0x4d')](_['pick'](_0x2e5b0e[_0xc105('0x46')],_0x32c259['filters']),_0x550d37);if(_0x2e5b0e['query']['filter']){_0x736b5d[_0xc105('0x4e')]=_['merge'](_0x736b5d[_0xc105('0x4e')],{'$or':_[_0xc105('0x45')](_0x550d37,function(_0x106415){if(_0x106415[_0xc105('0x4f')]!==_0xc105('0x50')){var _0x15b089={};_0x15b089[_0x106415[_0xc105('0x3a')]]={'$like':'%'+_0x2e5b0e[_0xc105('0x46')][_0xc105('0x51')]+'%'};return _0x15b089;}})});}_0x736b5d=_[_0xc105('0x3c')]({},_0x736b5d,_0x2e5b0e[_0xc105('0x52')]);var _0x26cb29={'where':_0x736b5d[_0xc105('0x4e')]};return db[_0xc105('0x42')][_0xc105('0x35')](_0x26cb29)['then'](function(_0x1617cb){_0x59d1a6[_0xc105('0x35')]=_0x1617cb;if(_0x2e5b0e[_0xc105('0x46')]['includeAll']){_0x736b5d[_0xc105('0x53')]=[{'all':!![]}];}return db[_0xc105('0x42')]['findAll'](_0x736b5d);})[_0xc105('0x25')](function(_0x395e5d){_0x59d1a6['rows']=_0x395e5d;return _0x59d1a6;})[_0xc105('0x25')](respondWithFilteredResult(_0x374fa5,_0x736b5d))['catch'](handleError(_0x374fa5,null));};exports[_0xc105('0x54')]=function(_0xed3374,_0x3824fe){var _0x48f9d6={'raw':!![],'where':{'id':_0xed3374[_0xc105('0x55')]['id']}},_0xac005c={};_0xac005c[_0xc105('0x48')]=_['keys'](db[_0xc105('0x42')][_0xc105('0x56')]);_0xac005c['query']=_[_0xc105('0x57')](_0xed3374[_0xc105('0x46')]);_0xac005c[_0xc105('0x4d')]=_[_0xc105('0x47')](_0xac005c['model'],_0xac005c[_0xc105('0x46')]);_0x48f9d6[_0xc105('0x49')]=_[_0xc105('0x47')](_0xac005c[_0xc105('0x48')],qs[_0xc105('0x4a')](_0xed3374[_0xc105('0x46')][_0xc105('0x4a')]));_0x48f9d6[_0xc105('0x49')]=_0x48f9d6[_0xc105('0x49')]['length']?_0x48f9d6[_0xc105('0x49')]:_0xac005c['model'];if(_0xed3374[_0xc105('0x46')][_0xc105('0x58')]){_0x48f9d6[_0xc105('0x53')]=[{'all':!![]}];}_0x48f9d6=_['merge']({},_0x48f9d6,_0xed3374[_0xc105('0x52')]);return db[_0xc105('0x42')][_0xc105('0x59')](_0x48f9d6)['then'](handleEntityNotFound(_0x3824fe,null))['then'](respondWithResult(_0x3824fe,null))[_0xc105('0x2e')](handleError(_0x3824fe,null));};exports[_0xc105('0x39')]=function(_0x320e76,_0x487342){if(_0x320e76[_0xc105('0x3d')]['id']){delete _0x320e76[_0xc105('0x3d')]['id'];}return db[_0xc105('0x42')]['find']({'where':{'id':_0x320e76[_0xc105('0x55')]['id']}})['then'](handleEntityNotFound(_0x487342,null))[_0xc105('0x25')](saveUpdates(_0x320e76[_0xc105('0x3d')],null))[_0xc105('0x25')](respondWithResult(_0x487342,null))['catch'](handleError(_0x487342,null));};exports[_0xc105('0x5a')]=function(_0x4d27d3,_0xf15ec8){return db[_0xc105('0x42')][_0xc105('0x59')]({'where':{'id':_0x4d27d3[_0xc105('0x55')]['id']}})[_0xc105('0x25')](handleEntityNotFound(_0xf15ec8,null))['then'](removeEntity(_0xf15ec8,null))[_0xc105('0x2e')](handleError(_0xf15ec8,null));};exports['describe']=function(_0x1d1173,_0x2dc2b5){return db[_0xc105('0x42')][_0xc105('0x5b')]()[_0xc105('0x25')](respondWithResult(_0x2dc2b5,null))[_0xc105('0x2e')](handleError(_0x2dc2b5,null));};var interaction_log=require(_0xc105('0x16'))('fax-interactions');exports[_0xc105('0x5c')]=function(_0x4b649e,_0x5c1898,_0x3c14e1){var _0x4dc9c8={'agent':{},'channel':_0xc105('0x5d')};if(_0x4b649e[_0xc105('0x3d')]['id']){delete _0x4b649e['body']['id'];}_0x4b649e[_0xc105('0x3d')][_0xc105('0x5e')]=!![];_0x4b649e[_0xc105('0x3d')][_0xc105('0x5f')]=moment()[_0xc105('0x60')](_0xc105('0x61'));_0x4b649e[_0xc105('0x3d')][_0xc105('0x62')]=_0x4b649e['body'][_0xc105('0x62')]||_0x4b649e['user']['id'];_0x4dc9c8[_0xc105('0x3f')]['id']=_0x4b649e[_0xc105('0x3d')][_0xc105('0x62')];return db[_0xc105('0x42')]['find']({'where':{'id':_0x4b649e['params']['id'],'UserId':null},'include':[{'model':db[_0xc105('0x63')],'as':'Contact'}]})[_0xc105('0x25')](handleEntityNotFound(_0x5c1898,null))[_0xc105('0x25')](saveUpdates(_0x4b649e[_0xc105('0x3d')],null))['then'](function(_0x333d38){if(_0x333d38){_0x4dc9c8['message']=_0x333d38['get']({'plain':!![]});return db[_0xc105('0x64')]['find']({'where':{'id':_0x333d38[_0xc105('0x65')]}});}return null;})[_0xc105('0x25')](handleEntityNotFound(_0x5c1898,null))[_0xc105('0x25')](function(_0x4ca80d){if(_0x4ca80d){return _0x4ca80d['update']({'UserId':_0x4b649e['body'][_0xc105('0x62')],'read1stAt':_['isNil'](_0x4ca80d[_0xc105('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc105('0x25')](function(_0x10ecb7){if(_0x10ecb7){_0x4dc9c8[_0xc105('0x40')]=_0x10ecb7[_0xc105('0x67')]({'plain':!![]});interaction_log[_0xc105('0x26')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b649e[_0xc105('0x68')]['id'],_0x4b649e['user'][_0xc105('0x3a')],_0x4b649e[_0xc105('0x68')][_0xc105('0x69')],_0x4dc9c8[_0xc105('0x40')]['id'],_0x4b649e[_0xc105('0x3d')]?JSON[_0xc105('0x6a')](_0x4b649e[_0xc105('0x3d')]):_0xc105('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xc105('0x6c'),_0x4dc9c8);}return null;})[_0xc105('0x25')](function(_0x46ea76){if(_0x46ea76){if(_0x4b649e['body'][_0xc105('0x6d')]){_0x4dc9c8['message'][_0xc105('0x6e')]=util[_0xc105('0x60')](_0xc105('0x6f'),_0x4b649e['user'][_0xc105('0x3a')]);_0x4dc9c8[_0xc105('0x2c')][_0xc105('0x70')]=_0x4dc9c8['channel'];_0x4dc9c8[_0xc105('0x2c')]['event']='accept';return respondWithRpcPromise(_0xc105('0x71'),_0xc105('0x71'),{'event':_0xc105('0x72'),'message':_0x4dc9c8[_0xc105('0x2c')]},client9002)[_0xc105('0x25')](function(){return _0x4dc9c8;});}return _0x4dc9c8;}return null;})[_0xc105('0x25')](respondWithResult(_0x5c1898,null))[_0xc105('0x2e')](handleError(_0x5c1898,null));};var interaction_log=require('../../config/logger')(_0xc105('0x73'));exports[_0xc105('0x38')]=function(_0xed7fbc,_0x56eccb,_0xcb1fc8){var _0x2723c6={'agent':{},'channel':_0xc105('0x5d')};if(_0xed7fbc['body']['id']){delete _0xed7fbc[_0xc105('0x3d')]['id'];}_0xed7fbc[_0xc105('0x3d')][_0xc105('0x62')]=_0xed7fbc['body']['UserId']||_0xed7fbc[_0xc105('0x68')]['id'];_0x2723c6[_0xc105('0x3f')]['id']=_0xed7fbc[_0xc105('0x3d')][_0xc105('0x62')];return db[_0xc105('0x42')][_0xc105('0x59')]({'where':{'id':_0xed7fbc[_0xc105('0x55')]['id'],'UserId':null}})[_0xc105('0x25')](handleEntityNotFound(_0x56eccb,null))[_0xc105('0x25')](function(_0x1c5301){if(_0x1c5301){_0x2723c6['message']=_0x1c5301['get']({'plain':!![]});return db['FaxInteraction'][_0xc105('0x59')]({'where':{'id':_0x1c5301[_0xc105('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x56eccb,null))['then'](function(_0x155ce1){if(_0x155ce1){_0x2723c6[_0xc105('0x40')]=_0x155ce1[_0xc105('0x67')]({'plain':!![]});interaction_log[_0xc105('0x26')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xed7fbc['user']['id'],_0xed7fbc[_0xc105('0x68')][_0xc105('0x3a')],_0xed7fbc[_0xc105('0x68')][_0xc105('0x69')],_0x2723c6[_0xc105('0x40')]['id'],_0xed7fbc[_0xc105('0x3d')]?JSON[_0xc105('0x6a')](_0xed7fbc['body']):_0xc105('0x6b'));return respondWithRpcPromise(_0xc105('0x74'),'rejectMessage',_0x2723c6);}return null;})[_0xc105('0x25')](function(_0x57cdcf){if(_0x57cdcf){_0x57cdcf[_0xc105('0x2c')][_0xc105('0x6e')]=util[_0xc105('0x60')](_0xc105('0x6f'),_0xed7fbc[_0xc105('0x68')][_0xc105('0x3a')]);_0x57cdcf[_0xc105('0x2c')][_0xc105('0x70')]=_0x2723c6[_0xc105('0x70')];_0x57cdcf[_0xc105('0x2c')][_0xc105('0x75')]=_0xc105('0x38');respondWithRpcPromise(_0xc105('0x71'),_0xc105('0x71'),{'event':'rejectmessage','message':_0x57cdcf['message']},client9002);return _0x2723c6;}return null;})['then'](respondWithResult(_0x56eccb,null))['catch'](handleError(_0x56eccb,null));};exports[_0xc105('0x76')]=function(_0x1c4d7,_0x47a9a1){var _0x59ed04;return db['FaxMessage'][_0xc105('0x76')](_0x1c4d7['body'],{})[_0xc105('0x25')](function(_0x38ea47){_0x59ed04=_0x38ea47;return db['CmContact'][_0xc105('0x77')]({'where':{'id':_0x59ed04[_0xc105('0x78')]}});})[_0xc105('0x25')](function(_0x1a74f7){if(_['isNil'](_0x1a74f7)){return;}else{_0x59ed04[_0xc105('0x5d')]=_0x1a74f7[_0xc105('0x5d')];return db[_0xc105('0x79')][_0xc105('0x77')]({'where':{'id':_0x59ed04[_0xc105('0x7a')]}});}})[_0xc105('0x25')](function(_0x3474f1){return respondWithRpcPromise(_0xc105('0x7b'),_0xc105('0x7b'),{'FaxAccountId':_[_0xc105('0x7c')](_0x1c4d7[_0xc105('0x3d')])?undefined:_0x1c4d7[_0xc105('0x3d')]['FaxAccountId'],'path':_['isNil'](_0x3474f1)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x3474f1[_0xc105('0x7d')]),'fax':_[_0xc105('0x7c')](_0x59ed04[_0xc105('0x5d')])?undefined:_0x59ed04[_0xc105('0x5d')],'AttachmentId':_0x59ed04[_0xc105('0x7a')]},client9002);})[_0xc105('0x25')](respondWithResult(_0x47a9a1,0xc9))[_0xc105('0x2e')](handleError(_0x47a9a1,null));};exports[_0xc105('0x7e')]=function(_0x52e973,_0x19314d){var _0x90fc26=path[_0xc105('0x7f')](config[_0xc105('0x80')],'server',_0xc105('0x81'),_0xc105('0x82'));return db[_0xc105('0x42')][_0xc105('0x59')]({'where':{'id':_0x52e973[_0xc105('0x55')]['id']},'include':[{'model':db[_0xc105('0x79')],'as':'Attachment'}]})[_0xc105('0x25')](handleEntityNotFound(_0x19314d,null))[_0xc105('0x25')](function(_0x65f1ce){if(_0x65f1ce){return _0x19314d[_0xc105('0x7e')](path[_0xc105('0x7f')](_0x90fc26,_0x65f1ce[_0xc105('0x79')][_0xc105('0x7d')]));}})[_0xc105('0x2e')](handleError(_0x19314d,null));}; \ No newline at end of file +var _0x894b=['stack','name','render','merge','contact','agent','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','FaxMessage','includeAll','include','findAll','params','intersection','find','body','describe','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','manual','format','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','create','findOne','ContactId','AttachmentId','SendFax','basename','download','join','files','attachments','Attachment','eml-format','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x1dcac5,_0x46365e){var _0x26a0a5=function(_0x459da1){while(--_0x459da1){_0x1dcac5['push'](_0x1dcac5['shift']());}};_0x26a0a5(++_0x46365e);}(_0x894b,0x1c3));var _0xb894=function(_0x26bcf5,_0x139137){_0x26bcf5=_0x26bcf5-0x0;var _0x3eab51=_0x894b[_0x26bcf5];return _0x3eab51;};'use strict';var emlformat=require(_0xb894('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb894('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb894('0x2'));var util=require(_0xb894('0x3'));var path=require(_0xb894('0x4'));var sox=require('sox');var csv=require(_0xb894('0x5'));var ejs=require(_0xb894('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb894('0x7'));var squel=require('squel');var crypto=require(_0xb894('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb894('0x9'));var toCsv=require(_0xb894('0x5'));var querystring=require('querystring');var Papa=require(_0xb894('0xa'));var Redis=require('ioredis');var authService=require(_0xb894('0xb'));var qs=require(_0xb894('0xc'));var as=require(_0xb894('0xd'));var hardwareService=require(_0xb894('0xe'));var logger=require(_0xb894('0xf'))('api');var utils=require(_0xb894('0x10'));var config=require(_0xb894('0x11'));var licenseUtil=require(_0xb894('0x12'));var db=require(_0xb894('0x13'))['db'];config[_0xb894('0x14')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb894('0x15'))(new Redis(config[_0xb894('0x14')]));require(_0xb894('0x16'))[_0xb894('0x17')](socket);var jayson=require(_0xb894('0x18'));var client=jayson[_0xb894('0x19')][_0xb894('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x305aff,_0x4636e5,_0x307f62,_0x231cb5){return new BPromise(function(_0x3b8b97,_0x2dd870){var _0x4402b8=_0x231cb5||client;return _0x4402b8[_0xb894('0x1b')](_0x305aff,_0x307f62)[_0xb894('0x1c')](function(_0x4df6aa){logger[_0xb894('0x1d')](_0xb894('0x1e'),_0x4636e5,'request\x20sent');logger[_0xb894('0x1f')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4636e5,'request\x20sent',JSON[_0xb894('0x20')](_0x4df6aa));if(_0x4df6aa[_0xb894('0x21')]){if(_0x4df6aa['error'][_0xb894('0x22')]===0x1f4){logger[_0xb894('0x21')](_0xb894('0x1e'),_0x4636e5,_0x4df6aa[_0xb894('0x21')]['message']);return _0x2dd870(_0x4df6aa[_0xb894('0x21')][_0xb894('0x23')]);}logger[_0xb894('0x21')](_0xb894('0x1e'),_0x4636e5,_0x4df6aa[_0xb894('0x21')][_0xb894('0x23')]);return _0x3b8b97(_0x4df6aa['error']['message']);}else{logger[_0xb894('0x1d')](_0xb894('0x1e'),_0x4636e5,'request\x20sent');_0x3b8b97(_0x4df6aa[_0xb894('0x24')][_0xb894('0x23')]);}})[_0xb894('0x25')](function(_0x4206fc){logger[_0xb894('0x21')](_0xb894('0x1e'),_0x4636e5,_0x4206fc);_0x2dd870(_0x4206fc);});});}function respondWithStatusCode(_0x17412d,_0x546622){_0x546622=_0x546622||0xcc;return function(_0x4c9e2c){if(_0x4c9e2c){return _0x17412d[_0xb894('0x26')](_0x546622);}return _0x17412d['status'](_0x546622)[_0xb894('0x27')]();};}function respondWithResult(_0x1dfd05,_0x241331){_0x241331=_0x241331||0xc8;return function(_0x3ca16a){if(_0x3ca16a){return _0x1dfd05[_0xb894('0x28')](_0x241331)[_0xb894('0x29')](_0x3ca16a);}};}function respondWithFilteredResult(_0x1ea622,_0x5a31f2){return function(_0x12ed55){if(_0x12ed55){var _0x5dd296=typeof _0x5a31f2['offset']===_0xb894('0x2a')&&typeof _0x5a31f2[_0xb894('0x2b')]==='undefined';var _0x4b34bf=_0x12ed55[_0xb894('0x2c')];var _0x398f33=_0x5dd296?0x0:_0x5a31f2['offset'];var _0x284e1c=_0x5dd296?_0x12ed55['count']:_0x5a31f2[_0xb894('0x2d')]+_0x5a31f2[_0xb894('0x2b')];var _0x1ce363;if(_0x284e1c>=_0x4b34bf){_0x284e1c=_0x4b34bf;_0x1ce363=0xc8;}else{_0x1ce363=0xce;}_0x1ea622[_0xb894('0x28')](_0x1ce363);return _0x1ea622[_0xb894('0x2e')](_0xb894('0x2f'),_0x398f33+'-'+_0x284e1c+'/'+_0x4b34bf)[_0xb894('0x29')](_0x12ed55);}return null;};}function patchUpdates(_0x18b2a3){return function(_0x114041){try{jsonpatch[_0xb894('0x30')](_0x114041,_0x18b2a3,!![]);}catch(_0x563b19){return BPromise[_0xb894('0x31')](_0x563b19);}return _0x114041[_0xb894('0x32')]();};}function saveUpdates(_0x5a194b,_0x4956ee){return function(_0xe697aa){if(_0xe697aa){return _0xe697aa[_0xb894('0x33')](_0x5a194b)[_0xb894('0x1c')](function(_0x1b7e65){return _0x1b7e65;});}return null;};}function removeEntity(_0x2b6d6f,_0x3f389c){return function(_0x137728){if(_0x137728){return _0x137728[_0xb894('0x34')]()[_0xb894('0x1c')](function(){_0x2b6d6f[_0xb894('0x28')](0xcc)[_0xb894('0x27')]();});}};}function handleEntityNotFound(_0x2f5f1b,_0x35e15f){return function(_0x41bac4){if(!_0x41bac4){_0x2f5f1b[_0xb894('0x26')](0x194);}return _0x41bac4;};}function handleError(_0x15434e,_0x14070b){_0x14070b=_0x14070b||0x1f4;return function(_0x1143dd){logger['error'](_0x1143dd[_0xb894('0x35')]);if(_0x1143dd[_0xb894('0x36')]){delete _0x1143dd[_0xb894('0x36')];}_0x15434e[_0xb894('0x28')](_0x14070b)['send'](_0x1143dd);};}function getMustacheRender(_0x4e7421,_0x57fedf){return Mustache[_0xb894('0x37')](_0x4e7421,_[_0xb894('0x38')](_0x57fedf['body'],{'contact':_0x57fedf[_0xb894('0x39')],'message':_0x57fedf[_0xb894('0x23')],'agent':_0x57fedf[_0xb894('0x3a')],'interaction':_0x57fedf['interaction'],'account':_0x57fedf['account']}))||'';}exports[_0xb894('0x3b')]=function(_0x47f333,_0x3a9e40){var _0x1c6eff={},_0x422ae3={},_0x5d7cc8={'count':0x0,'rows':[]};var _0x14d485=_[_0xb894('0x3c')](db['FaxMessage'][_0xb894('0x3d')],function(_0x4c4d52){return{'name':_0x4c4d52['fieldName'],'type':_0x4c4d52[_0xb894('0x3e')][_0xb894('0x3f')]};});_0x422ae3[_0xb894('0x40')]=_[_0xb894('0x3c')](_0x14d485,'name');_0x422ae3[_0xb894('0x41')]=_[_0xb894('0x42')](_0x47f333['query']);_0x422ae3[_0xb894('0x43')]=_['intersection'](_0x422ae3[_0xb894('0x40')],_0x422ae3[_0xb894('0x41')]);_0x1c6eff[_0xb894('0x44')]=_['intersection'](_0x422ae3[_0xb894('0x40')],qs['fields'](_0x47f333[_0xb894('0x41')][_0xb894('0x45')]));_0x1c6eff[_0xb894('0x44')]=_0x1c6eff[_0xb894('0x44')][_0xb894('0x46')]?_0x1c6eff[_0xb894('0x44')]:_0x422ae3[_0xb894('0x40')];if(!_0x47f333[_0xb894('0x41')][_0xb894('0x47')](_0xb894('0x48'))){_0x1c6eff[_0xb894('0x2b')]=qs[_0xb894('0x2b')](_0x47f333['query'][_0xb894('0x2b')]);_0x1c6eff[_0xb894('0x2d')]=qs[_0xb894('0x2d')](_0x47f333[_0xb894('0x41')][_0xb894('0x2d')]);}_0x1c6eff[_0xb894('0x49')]=qs[_0xb894('0x4a')](_0x47f333['query']['sort']);_0x1c6eff[_0xb894('0x4b')]=qs[_0xb894('0x43')](_['pick'](_0x47f333[_0xb894('0x41')],_0x422ae3[_0xb894('0x43')]),_0x14d485);if(_0x47f333[_0xb894('0x41')][_0xb894('0x4c')]){_0x1c6eff['where']=_['merge'](_0x1c6eff[_0xb894('0x4b')],{'$or':_[_0xb894('0x3c')](_0x14d485,function(_0x25123d){if(_0x25123d[_0xb894('0x3e')]!==_0xb894('0x4d')){var _0xcbeda4={};_0xcbeda4[_0x25123d[_0xb894('0x36')]]={'$like':'%'+_0x47f333[_0xb894('0x41')]['filter']+'%'};return _0xcbeda4;}})});}_0x1c6eff=_[_0xb894('0x38')]({},_0x1c6eff,_0x47f333[_0xb894('0x4e')]);var _0x3900e9={'where':_0x1c6eff['where']};return db[_0xb894('0x4f')][_0xb894('0x2c')](_0x3900e9)[_0xb894('0x1c')](function(_0x5c5501){_0x5d7cc8['count']=_0x5c5501;if(_0x47f333[_0xb894('0x41')][_0xb894('0x50')]){_0x1c6eff[_0xb894('0x51')]=[{'all':!![]}];}return db[_0xb894('0x4f')][_0xb894('0x52')](_0x1c6eff);})[_0xb894('0x1c')](function(_0x2ae36d){_0x5d7cc8['rows']=_0x2ae36d;return _0x5d7cc8;})[_0xb894('0x1c')](respondWithFilteredResult(_0x3a9e40,_0x1c6eff))['catch'](handleError(_0x3a9e40,null));};exports['show']=function(_0x21b678,_0x412bc9){var _0x22bacc={'raw':!![],'where':{'id':_0x21b678[_0xb894('0x53')]['id']}},_0x594a36={};_0x594a36[_0xb894('0x40')]=_[_0xb894('0x42')](db[_0xb894('0x4f')]['rawAttributes']);_0x594a36[_0xb894('0x41')]=_[_0xb894('0x42')](_0x21b678['query']);_0x594a36[_0xb894('0x43')]=_[_0xb894('0x54')](_0x594a36[_0xb894('0x40')],_0x594a36[_0xb894('0x41')]);_0x22bacc[_0xb894('0x44')]=_[_0xb894('0x54')](_0x594a36[_0xb894('0x40')],qs[_0xb894('0x45')](_0x21b678['query'][_0xb894('0x45')]));_0x22bacc[_0xb894('0x44')]=_0x22bacc[_0xb894('0x44')][_0xb894('0x46')]?_0x22bacc['attributes']:_0x594a36[_0xb894('0x40')];if(_0x21b678[_0xb894('0x41')][_0xb894('0x50')]){_0x22bacc['include']=[{'all':!![]}];}_0x22bacc=_[_0xb894('0x38')]({},_0x22bacc,_0x21b678[_0xb894('0x4e')]);return db['FaxMessage']['find'](_0x22bacc)['then'](handleEntityNotFound(_0x412bc9,null))[_0xb894('0x1c')](respondWithResult(_0x412bc9,null))[_0xb894('0x25')](handleError(_0x412bc9,null));};exports[_0xb894('0x33')]=function(_0x9369e8,_0x148a6c){if(_0x9369e8['body']['id']){delete _0x9369e8['body']['id'];}return db['FaxMessage'][_0xb894('0x55')]({'where':{'id':_0x9369e8['params']['id']}})[_0xb894('0x1c')](handleEntityNotFound(_0x148a6c,null))[_0xb894('0x1c')](saveUpdates(_0x9369e8[_0xb894('0x56')],null))[_0xb894('0x1c')](respondWithResult(_0x148a6c,null))['catch'](handleError(_0x148a6c,null));};exports[_0xb894('0x34')]=function(_0x11fed3,_0x2bc108){return db['FaxMessage'][_0xb894('0x55')]({'where':{'id':_0x11fed3[_0xb894('0x53')]['id']}})[_0xb894('0x1c')](handleEntityNotFound(_0x2bc108,null))[_0xb894('0x1c')](removeEntity(_0x2bc108,null))['catch'](handleError(_0x2bc108,null));};exports[_0xb894('0x57')]=function(_0x531e48,_0x451398){return db['FaxMessage'][_0xb894('0x57')]()[_0xb894('0x1c')](respondWithResult(_0x451398,null))['catch'](handleError(_0x451398,null));};var interaction_log=require(_0xb894('0xf'))('fax-interactions');exports[_0xb894('0x58')]=function(_0x109b8c,_0x491f4e,_0x20dddd){var _0x5185d4={'agent':{},'channel':_0xb894('0x59')};if(_0x109b8c[_0xb894('0x56')]['id']){delete _0x109b8c['body']['id'];}_0x109b8c[_0xb894('0x56')][_0xb894('0x5a')]=!![];_0x109b8c[_0xb894('0x56')][_0xb894('0x5b')]=moment()['format'](_0xb894('0x5c'));_0x109b8c[_0xb894('0x56')][_0xb894('0x5d')]=_0x109b8c[_0xb894('0x56')]['UserId']||_0x109b8c[_0xb894('0x5e')]['id'];_0x5185d4[_0xb894('0x3a')]['id']=_0x109b8c[_0xb894('0x56')][_0xb894('0x5d')];return db[_0xb894('0x4f')][_0xb894('0x55')]({'where':{'id':_0x109b8c[_0xb894('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xb894('0x5f')],'as':_0xb894('0x60')}]})[_0xb894('0x1c')](handleEntityNotFound(_0x491f4e,null))[_0xb894('0x1c')](saveUpdates(_0x109b8c['body'],null))[_0xb894('0x1c')](function(_0x154d0b){if(_0x154d0b){_0x5185d4[_0xb894('0x23')]=_0x154d0b[_0xb894('0x61')]({'plain':!![]});return db[_0xb894('0x62')][_0xb894('0x55')]({'where':{'id':_0x154d0b[_0xb894('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x491f4e,null))[_0xb894('0x1c')](function(_0x4e4313){if(_0x4e4313){return _0x4e4313[_0xb894('0x33')]({'UserId':_0x109b8c[_0xb894('0x56')]['UserId'],'read1stAt':_[_0xb894('0x64')](_0x4e4313[_0xb894('0x65')])?moment()['format'](_0xb894('0x5c')):undefined});}return null;})[_0xb894('0x1c')](function(_0x1147b6){if(_0x1147b6){_0x5185d4['interaction']=_0x1147b6[_0xb894('0x61')]({'plain':!![]});interaction_log[_0xb894('0x1d')](_0xb894('0x66'),_0x109b8c[_0xb894('0x5e')]['id'],_0x109b8c[_0xb894('0x5e')][_0xb894('0x36')],_0x109b8c[_0xb894('0x5e')]['role'],_0x5185d4[_0xb894('0x67')]['id'],_0x109b8c[_0xb894('0x56')]?JSON['stringify'](_0x109b8c[_0xb894('0x56')]):_0xb894('0x68'));return respondWithRpcPromise(_0xb894('0x69'),_0xb894('0x6a'),_0x5185d4);}return null;})['then'](function(_0x46740c){if(_0x46740c){if(_0x109b8c[_0xb894('0x56')][_0xb894('0x6b')]){_0x5185d4[_0xb894('0x23')]['interface']=util[_0xb894('0x6c')]('SIP/%s',_0x109b8c['user'][_0xb894('0x36')]);_0x5185d4[_0xb894('0x23')]['channel']=_0x5185d4[_0xb894('0x6d')];_0x5185d4[_0xb894('0x23')][_0xb894('0x6e')]='accept';return respondWithRpcPromise(_0xb894('0x6f'),_0xb894('0x6f'),{'event':_0xb894('0x70'),'message':_0x5185d4[_0xb894('0x23')]},client9002)[_0xb894('0x1c')](function(){return _0x5185d4;});}return _0x5185d4;}return null;})[_0xb894('0x1c')](respondWithResult(_0x491f4e,null))[_0xb894('0x25')](handleError(_0x491f4e,null));};var interaction_log=require(_0xb894('0xf'))('fax-interactions');exports[_0xb894('0x31')]=function(_0x1a0df4,_0x167a12,_0x64c47e){var _0xa18fae={'agent':{},'channel':_0xb894('0x59')};if(_0x1a0df4['body']['id']){delete _0x1a0df4[_0xb894('0x56')]['id'];}_0x1a0df4['body'][_0xb894('0x5d')]=_0x1a0df4[_0xb894('0x56')]['UserId']||_0x1a0df4[_0xb894('0x5e')]['id'];_0xa18fae[_0xb894('0x3a')]['id']=_0x1a0df4[_0xb894('0x56')]['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x1a0df4[_0xb894('0x53')]['id'],'UserId':null}})[_0xb894('0x1c')](handleEntityNotFound(_0x167a12,null))[_0xb894('0x1c')](function(_0x5963e2){if(_0x5963e2){_0xa18fae[_0xb894('0x23')]=_0x5963e2[_0xb894('0x61')]({'plain':!![]});return db['FaxInteraction'][_0xb894('0x55')]({'where':{'id':_0x5963e2[_0xb894('0x63')]}});}return null;})[_0xb894('0x1c')](handleEntityNotFound(_0x167a12,null))[_0xb894('0x1c')](function(_0x327a7a){if(_0x327a7a){_0xa18fae['interaction']=_0x327a7a[_0xb894('0x61')]({'plain':!![]});interaction_log['info'](_0xb894('0x71'),_0x1a0df4['user']['id'],_0x1a0df4[_0xb894('0x5e')][_0xb894('0x36')],_0x1a0df4['user']['role'],_0xa18fae['interaction']['id'],_0x1a0df4[_0xb894('0x56')]?JSON['stringify'](_0x1a0df4[_0xb894('0x56')]):_0xb894('0x68'));return respondWithRpcPromise('RejectMessage',_0xb894('0x72'),_0xa18fae);}return null;})['then'](function(_0x44ee5d){if(_0x44ee5d){_0x44ee5d[_0xb894('0x23')]['interface']=util['format']('SIP/%s',_0x1a0df4['user']['name']);_0x44ee5d['message'][_0xb894('0x6d')]=_0xa18fae[_0xb894('0x6d')];_0x44ee5d['message']['event']='reject';respondWithRpcPromise(_0xb894('0x6f'),_0xb894('0x6f'),{'event':'rejectmessage','message':_0x44ee5d['message']},client9002);return _0xa18fae;}return null;})[_0xb894('0x1c')](respondWithResult(_0x167a12,null))[_0xb894('0x25')](handleError(_0x167a12,null));};exports[_0xb894('0x73')]=function(_0x4ce7f1,_0x35b19c){var _0x3c4c1d;return db[_0xb894('0x4f')][_0xb894('0x73')](_0x4ce7f1['body'],{})[_0xb894('0x1c')](function(_0x5734a2){_0x3c4c1d=_0x5734a2;return db[_0xb894('0x5f')][_0xb894('0x74')]({'where':{'id':_0x3c4c1d[_0xb894('0x75')]}});})['then'](function(_0x3ca1c6){if(_[_0xb894('0x64')](_0x3ca1c6)){return;}else{_0x3c4c1d[_0xb894('0x59')]=_0x3ca1c6[_0xb894('0x59')];return db['Attachment']['findOne']({'where':{'id':_0x3c4c1d[_0xb894('0x76')]}});}})[_0xb894('0x1c')](function(_0x53fd22){return respondWithRpcPromise('SendFax',_0xb894('0x77'),{'FaxAccountId':_[_0xb894('0x64')](_0x4ce7f1[_0xb894('0x56')])?undefined:_0x4ce7f1[_0xb894('0x56')]['FaxAccountId'],'path':_[_0xb894('0x64')](_0x53fd22)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x53fd22[_0xb894('0x78')]),'fax':_[_0xb894('0x64')](_0x3c4c1d[_0xb894('0x59')])?undefined:_0x3c4c1d[_0xb894('0x59')],'AttachmentId':_0x3c4c1d[_0xb894('0x76')]},client9002);})[_0xb894('0x1c')](respondWithResult(_0x35b19c,0xc9))['catch'](handleError(_0x35b19c,null));};exports[_0xb894('0x79')]=function(_0x398313,_0x4f2274){var _0x10d4ed=path[_0xb894('0x7a')](config['root'],'server',_0xb894('0x7b'),_0xb894('0x7c'));return db[_0xb894('0x4f')]['find']({'where':{'id':_0x398313[_0xb894('0x53')]['id']},'include':[{'model':db['Attachment'],'as':_0xb894('0x7d')}]})[_0xb894('0x1c')](handleEntityNotFound(_0x4f2274,null))[_0xb894('0x1c')](function(_0xa86466){if(_0xa86466){return _0x4f2274[_0xb894('0x79')](path[_0xb894('0x7a')](_0x10d4ed,_0xa86466['Attachment'][_0xb894('0x78')]));}})['catch'](handleError(_0x4f2274,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 75cf6e5..a47a5d0 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x1b784d,_0x1bdf09){var _0x146549=function(_0x37ff43){while(--_0x37ff43){_0x1b784d['push'](_0x1b784d['shift']());}};_0x146549(++_0x1bdf09);}(_0x008c,0x188));var _0xc008=function(_0x26d018,_0xedb83d){_0x26d018=_0x26d018-0x0;var _0x296c00=_0x008c[_0x26d018];return _0x296c00;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x34e8,0x12c));var _0x834e=function(_0x21404a,_0x52e18d){_0x21404a=_0x21404a-0x0;var _0x5939c8=_0x34e8[_0x21404a];return _0x5939c8;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index af6d1ac..7122b9f 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 _0x9b8e=['then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','fax_messages','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','FaxInteraction','findOne','FaxInteractionId'];(function(_0x27d369,_0x235f71){var _0x553e71=function(_0x49bb4e){while(--_0x49bb4e){_0x27d369['push'](_0x27d369['shift']());}};_0x553e71(++_0x235f71);}(_0x9b8e,0x165));var _0xe9b8=function(_0x308e81,_0x217890){_0x308e81=_0x308e81-0x0;var _0x112806=_0x9b8e[_0x308e81];return _0x112806;};'use strict';var _=require(_0xe9b8('0x0'));var util=require(_0xe9b8('0x1'));var logger=require(_0xe9b8('0x2'))('api');var moment=require(_0xe9b8('0x3'));var BPromise=require(_0xe9b8('0x4'));var rp=require(_0xe9b8('0x5'));var fs=require('fs');var path=require(_0xe9b8('0x6'));var rimraf=require('rimraf');var config=require(_0xe9b8('0x7'));var attributes=require('./faxMessage.attributes');module[_0xe9b8('0x8')]=function(_0x71f5d4,_0xc5a549){return _0x71f5d4[_0xe9b8('0x9')]('FaxMessage',attributes,{'tableName':_0xe9b8('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xe9b8('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xac2efb,_0x5ec898,_0x9ff4ab){var _0x42fceb=_0x71f5d4[_0xe9b8('0xc')];var _0x429b88=_0xac2efb[_0xe9b8('0xd')]({'plain':!![]});if(_0x429b88[_0xe9b8('0xe')][_0xe9b8('0xf')]()==='in'||_0x429b88['direction'][_0xe9b8('0xf')]()==='out'&&!_0x429b88[_0xe9b8('0x10')]&&!_['isNil'](_0x429b88[_0xe9b8('0x11')])){_0x42fceb[_0xe9b8('0x12')][_0xe9b8('0x13')]({'where':{'id':_0x429b88[_0xe9b8('0x14')]}})[_0xe9b8('0x15')](function(_0x45302c){if(_0x45302c){_0x45302c['update']({'lastMsgAt':_0x429b88[_0xe9b8('0x16')],'lastMsgDirection':_0x429b88[_0xe9b8('0xe')][_0xe9b8('0xf')]()});}})[_0xe9b8('0x17')](function(_0x502a10){console[_0xe9b8('0x18')](_0x502a10);});}_0x9ff4ab();}},'charset':_0xe9b8('0x19'),'collate':_0xe9b8('0x1a')});}; \ No newline at end of file +var _0x3fc3=['bluebird','request-promise','../../config/environment','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','findOne','FaxInteractionId','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x1dc280,_0x5df023){var _0x5a8680=function(_0x2f46e3){while(--_0x2f46e3){_0x1dc280['push'](_0x1dc280['shift']());}};_0x5a8680(++_0x5df023);}(_0x3fc3,0x15a));var _0x33fc=function(_0x494265,_0x3183d7){_0x494265=_0x494265-0x0;var _0x3a2800=_0x3fc3[_0x494265];return _0x3a2800;};'use strict';var _=require(_0x33fc('0x0'));var util=require(_0x33fc('0x1'));var logger=require(_0x33fc('0x2'))(_0x33fc('0x3'));var moment=require('moment');var BPromise=require(_0x33fc('0x4'));var rp=require(_0x33fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x33fc('0x6'));var attributes=require(_0x33fc('0x7'));module['exports']=function(_0x308119,_0x388f78){return _0x308119[_0x33fc('0x8')](_0x33fc('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x33fc('0xa'),'fields':[_0x33fc('0xb')],'type':_0x33fc('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x144f90,_0x2df0c7,_0x13bbc5){var _0x5ded1f=_0x308119[_0x33fc('0xd')];var _0x3ba8ee=_0x144f90[_0x33fc('0xe')]({'plain':!![]});if(_0x3ba8ee[_0x33fc('0xf')]['toLowerCase']()==='in'||_0x3ba8ee['direction'][_0x33fc('0x10')]()===_0x33fc('0x11')&&!_0x3ba8ee['secret']&&!_[_0x33fc('0x12')](_0x3ba8ee['UserId'])){_0x5ded1f['FaxInteraction'][_0x33fc('0x13')]({'where':{'id':_0x3ba8ee[_0x33fc('0x14')]}})['then'](function(_0x1ae46a){if(_0x1ae46a){_0x1ae46a[_0x33fc('0x15')]({'lastMsgAt':_0x3ba8ee[_0x33fc('0x16')],'lastMsgDirection':_0x3ba8ee[_0x33fc('0xf')]['toLowerCase']()});}})[_0x33fc('0x17')](function(_0x41e3a4){console['error'](_0x41e3a4);});}_0x13bbc5();}},'charset':_0x33fc('0x18'),'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 25c2c93..ef3a56d 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 _0x332b=['socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','FaxMessage','create','options','raw','CreateFaxMessage','stringify','UpdateFaxMessage','body','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x1b2f2b,_0x4b2c95){var _0x246693=function(_0x651789){while(--_0x651789){_0x1b2f2b['push'](_0x1b2f2b['shift']());}};_0x246693(++_0x4b2c95);}(_0x332b,0x1df));var _0xb332=function(_0x3ab030,_0x243dc5){_0x3ab030=_0x3ab030-0x0;var _0x50c7aa=_0x332b[_0x3ab030];return _0x50c7aa;};'use strict';var _=require(_0xb332('0x0'));var util=require(_0xb332('0x1'));var moment=require(_0xb332('0x2'));var BPromise=require(_0xb332('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb332('0x4'));var db=require(_0xb332('0x5'))['db'];var utils=require(_0xb332('0x6'));var logger=require(_0xb332('0x7'))(_0xb332('0x8'));var config=require(_0xb332('0x9'));var jayson=require(_0xb332('0xa'));var client=jayson[_0xb332('0xb')][_0xb332('0xc')]({'port':0x232a});config[_0xb332('0xd')]=_['defaults'](config[_0xb332('0xd')],{'host':_0xb332('0xe'),'port':0x18eb});var socket=require(_0xb332('0xf'))(new Redis(config[_0xb332('0xd')]));require(_0xb332('0x10'))['register'](socket);function respondWithRpcPromise(_0x55c2b2,_0x50bfca,_0xad5358){return new BPromise(function(_0x43ebc9,_0x3f7e21){return client[_0xb332('0x11')](_0x55c2b2,_0xad5358)[_0xb332('0x12')](function(_0x4be5ce){logger[_0xb332('0x13')](_0xb332('0x14'),_0x50bfca,'request\x20sent');logger[_0xb332('0x15')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x50bfca,_0xb332('0x16'),JSON['stringify'](_0x4be5ce));if(_0x4be5ce['error']){if(_0x4be5ce[_0xb332('0x17')][_0xb332('0x18')]===0x1f4){logger[_0xb332('0x17')](_0xb332('0x14'),_0x50bfca,_0x4be5ce[_0xb332('0x17')][_0xb332('0x19')]);return _0x3f7e21(_0x4be5ce['error'][_0xb332('0x19')]);}logger[_0xb332('0x17')]('FaxMessage,\x20%s,\x20%s',_0x50bfca,_0x4be5ce[_0xb332('0x17')]['message']);return _0x43ebc9(_0x4be5ce['error'][_0xb332('0x19')]);}else{logger[_0xb332('0x13')](_0xb332('0x14'),_0x50bfca,_0xb332('0x16'));_0x43ebc9(_0x4be5ce[_0xb332('0x1a')]['message']);}})[_0xb332('0x1b')](function(_0x95697b){logger[_0xb332('0x17')]('FaxMessage,\x20%s,\x20%s',_0x50bfca,_0x95697b);_0x3f7e21(_0x95697b);});});}exports['CreateFaxMessage']=function(_0x28d545){var _0x48daff=this;return new Promise(function(_0x2ae4da,_0x2b12d9){return db[_0xb332('0x1c')][_0xb332('0x1d')](_0x28d545['body'],{'raw':_0x28d545[_0xb332('0x1e')]?_0x28d545[_0xb332('0x1e')][_0xb332('0x1f')]===undefined?!![]:![]:!![]})[_0xb332('0x12')](function(_0xf49c38){logger[_0xb332('0x13')]('CreateFaxMessage',_0x28d545);logger[_0xb332('0x15')](_0xb332('0x20'),_0x28d545,JSON[_0xb332('0x21')](_0xf49c38));_0x2ae4da(_0xf49c38);})[_0xb332('0x1b')](function(_0x8b323){logger['error']('CreateFaxMessage',_0x8b323[_0xb332('0x19')],_0x28d545);_0x2b12d9(_0x48daff['error'](0x1f4,_0x8b323['message']));});});};exports[_0xb332('0x22')]=function(_0x36b9a2){var _0x9e8cef=this;return new Promise(function(_0x527be5,_0x142d05){return db['FaxMessage']['update'](_0x36b9a2[_0xb332('0x23')],{'raw':_0x36b9a2[_0xb332('0x1e')]?_0x36b9a2[_0xb332('0x1e')][_0xb332('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36b9a2[_0xb332('0x1e')]?_0x36b9a2['options']['where']||null:null,'attributes':_0x36b9a2[_0xb332('0x1e')]?_0x36b9a2['options'][_0xb332('0x24')]||null:null,'limit':_0x36b9a2['options']?_0x36b9a2[_0xb332('0x1e')][_0xb332('0x25')]||null:null})[_0xb332('0x12')](function(_0x40a2d4){logger[_0xb332('0x13')](_0xb332('0x22'),_0x36b9a2);logger[_0xb332('0x15')]('UpdateFaxMessage',_0x36b9a2,JSON[_0xb332('0x21')](_0x40a2d4));_0x527be5(_0x40a2d4);})['catch'](function(_0xad0547){logger[_0xb332('0x17')]('UpdateFaxMessage',_0xad0547[_0xb332('0x19')],_0x36b9a2);_0x142d05(_0x9e8cef[_0xb332('0x17')](0x1f4,_0xad0547[_0xb332('0x19')]));});});}; \ No newline at end of file +var _0x19a5=['socket.io-emitter','./faxMessage.socket','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','FaxMessage','body','options','raw','info','CreateFaxMessage','debug','UpdateFaxMessage','attributes','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x57c0ed,_0x578c52){var _0x14dab1=function(_0x53d7a9){while(--_0x53d7a9){_0x57c0ed['push'](_0x57c0ed['shift']());}};_0x14dab1(++_0x578c52);}(_0x19a5,0xf4));var _0x519a=function(_0x2d5382,_0x5d1c41){_0x2d5382=_0x2d5382-0x0;var _0x185a26=_0x19a5[_0x2d5382];return _0x185a26;};'use strict';var _=require(_0x519a('0x0'));var util=require('util');var moment=require(_0x519a('0x1'));var BPromise=require('bluebird');var rs=require(_0x519a('0x2'));var fs=require('fs');var Redis=require(_0x519a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x519a('0x4'))('rpc');var config=require(_0x519a('0x5'));var jayson=require(_0x519a('0x6'));var client=jayson[_0x519a('0x7')][_0x519a('0x8')]({'port':0x232a});config[_0x519a('0x9')]=_[_0x519a('0xa')](config[_0x519a('0x9')],{'host':_0x519a('0xb'),'port':0x18eb});var socket=require(_0x519a('0xc'))(new Redis(config[_0x519a('0x9')]));require(_0x519a('0xd'))[_0x519a('0xe')](socket);function respondWithRpcPromise(_0xb6d9fd,_0x2bc121,_0x4ca763){return new BPromise(function(_0x3dff0d,_0x176555){return client[_0x519a('0xf')](_0xb6d9fd,_0x4ca763)['then'](function(_0x356d3f){logger['info'](_0x519a('0x10'),_0x2bc121,_0x519a('0x11'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2bc121,_0x519a('0x11'),JSON[_0x519a('0x12')](_0x356d3f));if(_0x356d3f['error']){if(_0x356d3f[_0x519a('0x13')]['code']===0x1f4){logger[_0x519a('0x13')](_0x519a('0x10'),_0x2bc121,_0x356d3f[_0x519a('0x13')][_0x519a('0x14')]);return _0x176555(_0x356d3f[_0x519a('0x13')][_0x519a('0x14')]);}logger[_0x519a('0x13')](_0x519a('0x10'),_0x2bc121,_0x356d3f[_0x519a('0x13')]['message']);return _0x3dff0d(_0x356d3f[_0x519a('0x13')]['message']);}else{logger['info'](_0x519a('0x10'),_0x2bc121,'request\x20sent');_0x3dff0d(_0x356d3f[_0x519a('0x15')]['message']);}})[_0x519a('0x16')](function(_0x346844){logger[_0x519a('0x13')](_0x519a('0x10'),_0x2bc121,_0x346844);_0x176555(_0x346844);});});}exports['CreateFaxMessage']=function(_0x26d0c3){var _0x9e75b3=this;return new Promise(function(_0x3eca15,_0x3b5746){return db[_0x519a('0x17')]['create'](_0x26d0c3[_0x519a('0x18')],{'raw':_0x26d0c3[_0x519a('0x19')]?_0x26d0c3[_0x519a('0x19')][_0x519a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x73b1f4){logger[_0x519a('0x1b')](_0x519a('0x1c'),_0x26d0c3);logger[_0x519a('0x1d')](_0x519a('0x1c'),_0x26d0c3,JSON[_0x519a('0x12')](_0x73b1f4));_0x3eca15(_0x73b1f4);})['catch'](function(_0x46a23b){logger[_0x519a('0x13')](_0x519a('0x1c'),_0x46a23b[_0x519a('0x14')],_0x26d0c3);_0x3b5746(_0x9e75b3[_0x519a('0x13')](0x1f4,_0x46a23b[_0x519a('0x14')]));});});};exports[_0x519a('0x1e')]=function(_0x77163d){var _0x319309=this;return new Promise(function(_0x4e522c,_0x5f51b6){return db[_0x519a('0x17')]['update'](_0x77163d[_0x519a('0x18')],{'raw':_0x77163d[_0x519a('0x19')]?_0x77163d['options'][_0x519a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x77163d['options']?_0x77163d[_0x519a('0x19')]['where']||null:null,'attributes':_0x77163d[_0x519a('0x19')]?_0x77163d['options'][_0x519a('0x1f')]||null:null,'limit':_0x77163d['options']?_0x77163d[_0x519a('0x19')]['limit']||null:null})['then'](function(_0x56f5b1){logger['info'](_0x519a('0x1e'),_0x77163d);logger[_0x519a('0x1d')](_0x519a('0x1e'),_0x77163d,JSON[_0x519a('0x12')](_0x56f5b1));_0x4e522c(_0x56f5b1);})[_0x519a('0x16')](function(_0x32fe60){logger[_0x519a('0x13')](_0x519a('0x1e'),_0x32fe60[_0x519a('0x14')],_0x77163d);_0x5f51b6(_0x319309[_0x519a('0x13')](0x1f4,_0x32fe60['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c725fad..d6fe3ad 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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index cced0dc..97946be 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 _0xe96b=['/:id/reject','reject','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','fax','put','/:id/accept','accept'];(function(_0x3e16c4,_0x33678e){var _0x5e112b=function(_0x4624de){while(--_0x4624de){_0x3e16c4['push'](_0x3e16c4['shift']());}};_0x5e112b(++_0x33678e);}(_0xe96b,0xbb));var _0xbe96=function(_0x101201,_0x16482f){_0x101201=_0x101201-0x0;var _0x41173d=_0xe96b[_0x101201];return _0x41173d;};'use strict';var multer=require(_0xbe96('0x0'));var util=require(_0xbe96('0x1'));var path=require('path');var timeout=require(_0xbe96('0x2'));var express=require(_0xbe96('0x3'));var router=express[_0xbe96('0x4')]();var fs_extra=require(_0xbe96('0x5'));var auth=require(_0xbe96('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbe96('0x7'));var controller=require(_0xbe96('0x8'));router[_0xbe96('0x9')]('/',auth[_0xbe96('0xa')](),controller['index']);router[_0xbe96('0x9')](_0xbe96('0xb'),auth[_0xbe96('0xa')](),controller[_0xbe96('0xc')]);router[_0xbe96('0x9')](_0xbe96('0xd'),auth[_0xbe96('0xa')](),controller[_0xbe96('0xe')]);router[_0xbe96('0x9')](_0xbe96('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xbe96('0xa')](),interaction['tracked'](_0xbe96('0x10'),'faxmessage:create'),controller['create']);router['put']('/:id',auth[_0xbe96('0xa')](),controller['update']);router[_0xbe96('0x11')](_0xbe96('0x12'),auth[_0xbe96('0xa')](),controller[_0xbe96('0x13')]);router['put'](_0xbe96('0x14'),auth[_0xbe96('0xa')](),controller[_0xbe96('0x15')]);router[_0xbe96('0x16')](_0xbe96('0xd'),auth[_0xbe96('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8a05=['fax','faxmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','/describe','isAuthenticated','get','show','/:id/download','download','post','tracked'];(function(_0x3bc363,_0x3214e3){var _0xbf9fe4=function(_0xb49a7f){while(--_0xb49a7f){_0x3bc363['push'](_0x3bc363['shift']());}};_0xbf9fe4(++_0x3214e3);}(_0x8a05,0x1b0));var _0x58a0=function(_0x15768b,_0x4b78db){_0x15768b=_0x15768b-0x0;var _0x3180d8=_0x8a05[_0x15768b];return _0x3180d8;};'use strict';var multer=require(_0x58a0('0x0'));var util=require(_0x58a0('0x1'));var path=require(_0x58a0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x58a0('0x3')]();var fs_extra=require(_0x58a0('0x4'));var auth=require(_0x58a0('0x5'));var interaction=require(_0x58a0('0x6'));var config=require(_0x58a0('0x7'));var controller=require(_0x58a0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x58a0('0x9')]);router['get'](_0x58a0('0xa'),auth[_0x58a0('0xb')](),controller['describe']);router[_0x58a0('0xc')]('/:id',auth[_0x58a0('0xb')](),controller[_0x58a0('0xd')]);router[_0x58a0('0xc')](_0x58a0('0xe'),auth['isAuthenticated'](),controller[_0x58a0('0xf')]);router[_0x58a0('0x10')]('/',auth[_0x58a0('0xb')](),interaction[_0x58a0('0x11')](_0x58a0('0x12'),_0x58a0('0x13')),controller[_0x58a0('0x14')]);router[_0x58a0('0x15')](_0x58a0('0x16'),auth[_0x58a0('0xb')](),controller[_0x58a0('0x17')]);router[_0x58a0('0x15')](_0x58a0('0x18'),auth[_0x58a0('0xb')](),controller[_0x58a0('0x19')]);router['put'](_0x58a0('0x1a'),auth[_0x58a0('0xb')](),controller['reject']);router[_0x58a0('0x1b')](_0x58a0('0x16'),auth[_0x58a0('0xb')](),controller[_0x58a0('0x1c')]);module[_0x58a0('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 075cc43..06197f4 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 _0xec9a=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x25fe22,_0x7bdfb9){var _0x3966b9=function(_0x4fbf4a){while(--_0x4fbf4a){_0x25fe22['push'](_0x25fe22['shift']());}};_0x3966b9(++_0x7bdfb9);}(_0xec9a,0x196));var _0xaec9=function(_0x1528e8,_0x3c6a1c){_0x1528e8=_0x1528e8-0x0;var _0x3e53f1=_0xec9a[_0x1528e8];return _0x3e53f1;};'use strict';var Sequelize=require(_0xaec9('0x0'));module[_0xaec9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xaec9('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xaec9('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaec9('0x4')](_0xaec9('0x5'),_0xaec9('0x6'),_0xaec9('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xaec9('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd983=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd983,0x10b));var _0x3d98=function(_0x566678,_0x3f2484){_0x566678=_0x566678-0x0;var _0x148a22=_0xd983[_0x566678];return _0x148a22;};'use strict';var Sequelize=require(_0x3d98('0x0'));module[_0x3d98('0x1')]={'name':{'type':Sequelize[_0x3d98('0x2')],'unique':_0x3d98('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3d98('0x2')]},'timeout':{'type':Sequelize[_0x3d98('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3d98('0x5')](_0x3d98('0x6'),_0x3d98('0x7'),_0x3d98('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3d98('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 8d6be80..86755f4 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 _0xac9d=['Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxQueue.socket','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','get','FaxQueues','UserProfileResource','sendStatus','error','stack','name','send','render','merge','body','contact','message','agent','interaction','map','rawAttributes','type','query','keys','filters','model','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','VIRTUAL','options','FaxQueue','includeAll','include','findAll','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','User','UserId','faxPause','updatedAt','rows','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids'];(function(_0x46a751,_0x5b5e6f){var _0x3a69e6=function(_0xd281f7){while(--_0xd281f7){_0x46a751['push'](_0x46a751['shift']());}};_0x3a69e6(++_0x5b5e6f);}(_0xac9d,0x14d));var _0xdac9=function(_0x2f89c0,_0x455702){_0x2f89c0=_0x2f89c0-0x0;var _0x164223=_0xac9d[_0x2f89c0];return _0x164223;};'use strict';var emlformat=require(_0xdac9('0x0'));var rimraf=require(_0xdac9('0x1'));var zipdir=require(_0xdac9('0x2'));var jsonpatch=require(_0xdac9('0x3'));var rp=require(_0xdac9('0x4'));var moment=require(_0xdac9('0x5'));var BPromise=require(_0xdac9('0x6'));var Mustache=require(_0xdac9('0x7'));var util=require('util');var path=require(_0xdac9('0x8'));var sox=require('sox');var csv=require(_0xdac9('0x9'));var ejs=require(_0xdac9('0xa'));var fs=require('fs');var fs_extra=require(_0xdac9('0xb'));var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var licenseUtil=require(_0xdac9('0x1a'));var db=require('../../mysqldb')['db'];config[_0xdac9('0x1b')]=_[_0xdac9('0x1c')](config[_0xdac9('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0x1d'))(new Redis(config[_0xdac9('0x1b')]));require(_0xdac9('0x1e'))['register'](socket);function respondWithStatusCode(_0x5dd536,_0x52cbd4){_0x52cbd4=_0x52cbd4||0xcc;return function(_0x3d9fcf){if(_0x3d9fcf){return _0x5dd536['sendStatus'](_0x52cbd4);}return _0x5dd536[_0xdac9('0x1f')](_0x52cbd4)[_0xdac9('0x20')]();};}function respondWithResult(_0x152ea5,_0x5b2f1b){_0x5b2f1b=_0x5b2f1b||0xc8;return function(_0x2221f8){if(_0x2221f8){return _0x152ea5[_0xdac9('0x1f')](_0x5b2f1b)[_0xdac9('0x21')](_0x2221f8);}};}function respondWithFilteredResult(_0xec1016,_0x4fa7c4){return function(_0x283343){if(_0x283343){var _0x36b817=typeof _0x4fa7c4['offset']===_0xdac9('0x22')&&typeof _0x4fa7c4[_0xdac9('0x23')]===_0xdac9('0x22');var _0x181d11=_0x283343['count'];var _0x520369=_0x36b817?0x0:_0x4fa7c4[_0xdac9('0x24')];var _0x20ece3=_0x36b817?_0x283343[_0xdac9('0x25')]:_0x4fa7c4[_0xdac9('0x24')]+_0x4fa7c4['limit'];var _0x23ee5e;if(_0x20ece3>=_0x181d11){_0x20ece3=_0x181d11;_0x23ee5e=0xc8;}else{_0x23ee5e=0xce;}_0xec1016[_0xdac9('0x1f')](_0x23ee5e);return _0xec1016[_0xdac9('0x26')](_0xdac9('0x27'),_0x520369+'-'+_0x20ece3+'/'+_0x181d11)[_0xdac9('0x21')](_0x283343);}return null;};}function patchUpdates(_0x42317c){return function(_0x41335a){try{jsonpatch[_0xdac9('0x28')](_0x41335a,_0x42317c,!![]);}catch(_0x419f0c){return BPromise[_0xdac9('0x29')](_0x419f0c);}return _0x41335a['save']();};}function saveUpdates(_0x2943f5,_0x11f4fd){return function(_0x3c942c){if(_0x3c942c){return _0x3c942c[_0xdac9('0x2a')](_0x2943f5)['then'](function(_0x1e631a){return _0x1e631a;});}return null;};}function removeEntity(_0x5686db,_0x3ce475){return function(_0x2fce71){if(_0x2fce71){return _0x2fce71['destroy']()[_0xdac9('0x2b')](function(){var _0x5105f1=_0x2fce71[_0xdac9('0x2c')]({'plain':!![]});var _0x3743f7=_0xdac9('0x2d');return db[_0xdac9('0x2e')]['destroy']({'where':{'type':_0x3743f7,'resourceId':_0x5105f1['id']}})['then'](function(){return _0x2fce71;});})[_0xdac9('0x2b')](function(){_0x5686db[_0xdac9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c4e21,_0x3eed7a){return function(_0x3505c5){if(!_0x3505c5){_0x4c4e21[_0xdac9('0x2f')](0x194);}return _0x3505c5;};}function handleError(_0x2dbb7a,_0x41c2c5){_0x41c2c5=_0x41c2c5||0x1f4;return function(_0x2247f8){logger[_0xdac9('0x30')](_0x2247f8[_0xdac9('0x31')]);if(_0x2247f8[_0xdac9('0x32')]){delete _0x2247f8[_0xdac9('0x32')];}_0x2dbb7a[_0xdac9('0x1f')](_0x41c2c5)[_0xdac9('0x33')](_0x2247f8);};}function getMustacheRender(_0x3bdd9b,_0x336fd5){return Mustache[_0xdac9('0x34')](_0x3bdd9b,_[_0xdac9('0x35')](_0x336fd5[_0xdac9('0x36')],{'contact':_0x336fd5[_0xdac9('0x37')],'message':_0x336fd5[_0xdac9('0x38')],'agent':_0x336fd5[_0xdac9('0x39')],'interaction':_0x336fd5[_0xdac9('0x3a')],'account':_0x336fd5['account']}))||'';}exports['index']=function(_0x1e6832,_0x416501){var _0x1cf2c7={},_0x3ecff5={},_0x15dc5f={'count':0x0,'rows':[]};var _0x49d59f=_[_0xdac9('0x3b')](db['FaxQueue'][_0xdac9('0x3c')],function(_0x2a611e){return{'name':_0x2a611e['fieldName'],'type':_0x2a611e[_0xdac9('0x3d')]['key']};});_0x3ecff5['model']=_[_0xdac9('0x3b')](_0x49d59f,_0xdac9('0x32'));_0x3ecff5[_0xdac9('0x3e')]=_[_0xdac9('0x3f')](_0x1e6832[_0xdac9('0x3e')]);_0x3ecff5[_0xdac9('0x40')]=_['intersection'](_0x3ecff5[_0xdac9('0x41')],_0x3ecff5[_0xdac9('0x3e')]);_0x1cf2c7['attributes']=_[_0xdac9('0x42')](_0x3ecff5[_0xdac9('0x41')],qs[_0xdac9('0x43')](_0x1e6832[_0xdac9('0x3e')][_0xdac9('0x43')]));_0x1cf2c7[_0xdac9('0x44')]=_0x1cf2c7[_0xdac9('0x44')]['length']?_0x1cf2c7[_0xdac9('0x44')]:_0x3ecff5[_0xdac9('0x41')];if(!_0x1e6832[_0xdac9('0x3e')]['hasOwnProperty'](_0xdac9('0x45'))){_0x1cf2c7[_0xdac9('0x23')]=qs[_0xdac9('0x23')](_0x1e6832[_0xdac9('0x3e')]['limit']);_0x1cf2c7['offset']=qs[_0xdac9('0x24')](_0x1e6832[_0xdac9('0x3e')][_0xdac9('0x24')]);}_0x1cf2c7[_0xdac9('0x46')]=qs[_0xdac9('0x47')](_0x1e6832['query'][_0xdac9('0x47')]);_0x1cf2c7['where']=qs[_0xdac9('0x40')](_[_0xdac9('0x48')](_0x1e6832[_0xdac9('0x3e')],_0x3ecff5[_0xdac9('0x40')]),_0x49d59f);if(_0x1e6832[_0xdac9('0x3e')][_0xdac9('0x49')]){_0x1cf2c7[_0xdac9('0x4a')]=_[_0xdac9('0x35')](_0x1cf2c7[_0xdac9('0x4a')],{'$or':_[_0xdac9('0x3b')](_0x49d59f,function(_0x89240c){if(_0x89240c[_0xdac9('0x3d')]!==_0xdac9('0x4b')){var _0x441676={};_0x441676[_0x89240c['name']]={'$like':'%'+_0x1e6832[_0xdac9('0x3e')][_0xdac9('0x49')]+'%'};return _0x441676;}})});}_0x1cf2c7=_['merge']({},_0x1cf2c7,_0x1e6832[_0xdac9('0x4c')]);var _0x296a24={'where':_0x1cf2c7[_0xdac9('0x4a')]};return db[_0xdac9('0x4d')][_0xdac9('0x25')](_0x296a24)[_0xdac9('0x2b')](function(_0x4c334a){_0x15dc5f[_0xdac9('0x25')]=_0x4c334a;if(_0x1e6832['query'][_0xdac9('0x4e')]){_0x1cf2c7[_0xdac9('0x4f')]=[{'all':!![]}];}return db[_0xdac9('0x4d')][_0xdac9('0x50')](_0x1cf2c7);})['then'](function(_0x5ee81d){_0x15dc5f['rows']=_0x5ee81d;return _0x15dc5f;})[_0xdac9('0x2b')](respondWithFilteredResult(_0x416501,_0x1cf2c7))['catch'](handleError(_0x416501,null));};exports['show']=function(_0x4159fd,_0x15c332){var _0x49c948={'raw':!![],'where':{'id':_0x4159fd[_0xdac9('0x51')]['id']}},_0x5135df={};_0x5135df[_0xdac9('0x41')]=_[_0xdac9('0x3f')](db[_0xdac9('0x4d')][_0xdac9('0x3c')]);_0x5135df[_0xdac9('0x3e')]=_[_0xdac9('0x3f')](_0x4159fd[_0xdac9('0x3e')]);_0x5135df['filters']=_[_0xdac9('0x42')](_0x5135df[_0xdac9('0x41')],_0x5135df[_0xdac9('0x3e')]);_0x49c948[_0xdac9('0x44')]=_[_0xdac9('0x42')](_0x5135df[_0xdac9('0x41')],qs[_0xdac9('0x43')](_0x4159fd[_0xdac9('0x3e')][_0xdac9('0x43')]));_0x49c948[_0xdac9('0x44')]=_0x49c948[_0xdac9('0x44')][_0xdac9('0x52')]?_0x49c948[_0xdac9('0x44')]:_0x5135df[_0xdac9('0x41')];if(_0x4159fd['query']['includeAll']){_0x49c948['include']=[{'all':!![]}];}_0x49c948=_[_0xdac9('0x35')]({},_0x49c948,_0x4159fd[_0xdac9('0x4c')]);return db['FaxQueue'][_0xdac9('0x53')](_0x49c948)[_0xdac9('0x2b')](handleEntityNotFound(_0x15c332,null))[_0xdac9('0x2b')](respondWithResult(_0x15c332,null))['catch'](handleError(_0x15c332,null));};exports[_0xdac9('0x54')]=function(_0x9f6e4,_0x57902f){return db['FaxQueue'][_0xdac9('0x54')](_0x9f6e4[_0xdac9('0x36')],{})[_0xdac9('0x2b')](function(_0x370532){var _0x39df88=_0x9f6e4[_0xdac9('0x55')][_0xdac9('0x2c')]({'plain':!![]});if(!_0x39df88)throw new Error(_0xdac9('0x56'));if(_0x39df88[_0xdac9('0x57')]===_0xdac9('0x55')){var _0x10a2cc=_0x370532[_0xdac9('0x2c')]({'plain':!![]});var _0xecb50a=_0xdac9('0x2d');return db[_0xdac9('0x58')]['find']({'where':{'name':_0xecb50a,'userProfileId':_0x39df88[_0xdac9('0x59')]},'raw':!![]})[_0xdac9('0x2b')](function(_0x2951be){if(_0x2951be&&_0x2951be[_0xdac9('0x5a')]===0x0){return db[_0xdac9('0x2e')][_0xdac9('0x54')]({'name':_0x10a2cc['name'],'resourceId':_0x10a2cc['id'],'type':_0x2951be[_0xdac9('0x32')],'sectionId':_0x2951be['id']},{})[_0xdac9('0x2b')](function(){return _0x370532;});}else{return _0x370532;}})[_0xdac9('0x5b')](function(_0x2648c1){logger[_0xdac9('0x30')](_0xdac9('0x5c'),_0x2648c1);throw _0x2648c1;});}return _0x370532;})[_0xdac9('0x2b')](respondWithResult(_0x57902f,0xc9))[_0xdac9('0x5b')](handleError(_0x57902f,null));};exports[_0xdac9('0x2a')]=function(_0x5d5ec7,_0x7282f2){if(_0x5d5ec7[_0xdac9('0x36')]['id']){delete _0x5d5ec7[_0xdac9('0x36')]['id'];}return db[_0xdac9('0x4d')][_0xdac9('0x53')]({'where':{'id':_0x5d5ec7[_0xdac9('0x51')]['id']}})['then'](handleEntityNotFound(_0x7282f2,null))['then'](saveUpdates(_0x5d5ec7[_0xdac9('0x36')],null))[_0xdac9('0x2b')](respondWithResult(_0x7282f2,null))[_0xdac9('0x5b')](handleError(_0x7282f2,null));};exports[_0xdac9('0x5d')]=function(_0x1c1f5f,_0xc86e6a){return db['FaxQueue']['find']({'where':{'id':_0x1c1f5f['params']['id']}})[_0xdac9('0x2b')](handleEntityNotFound(_0xc86e6a,null))[_0xdac9('0x2b')](removeEntity(_0xc86e6a,null))[_0xdac9('0x5b')](handleError(_0xc86e6a,null));};exports[_0xdac9('0x5e')]=function(_0x52ad7b,_0xaef9e){return db[_0xdac9('0x4d')][_0xdac9('0x5e')]()[_0xdac9('0x2b')](respondWithResult(_0xaef9e,null))[_0xdac9('0x5b')](handleError(_0xaef9e,null));};exports['getMembers']=function(_0x19a46e,_0x5cb56f,_0x60b64e){var _0x571a8d={'raw':!![],'where':{}},_0x436a3f={},_0xe0b940;return db[_0xdac9('0x4d')][_0xdac9('0x5f')]({'where':{'id':_0x19a46e[_0xdac9('0x51')]['id']}})[_0xdac9('0x2b')](handleEntityNotFound(_0x5cb56f,null))[_0xdac9('0x2b')](function(_0x53d9ed){if(_0x53d9ed){_0xe0b940=_0x53d9ed['get']({'plain':!![]});_0x436a3f['model']=_[_0xdac9('0x3f')](db[_0xdac9('0x60')][_0xdac9('0x3c')]);_0x436a3f[_0xdac9('0x3e')]=_[_0xdac9('0x3f')](_0x19a46e[_0xdac9('0x3e')]);_0x436a3f[_0xdac9('0x40')]=_['intersection'](_0x436a3f[_0xdac9('0x41')],_0x436a3f['query']);_0x571a8d['attributes']=_[_0xdac9('0x42')](_0x436a3f['model'],qs['fields'](_0x19a46e[_0xdac9('0x3e')][_0xdac9('0x43')]));_0x571a8d[_0xdac9('0x44')]=_0x571a8d['attributes']['length']?_0x571a8d[_0xdac9('0x44')]:_0x436a3f[_0xdac9('0x41')];if(!_0x19a46e['query'][_0xdac9('0x61')](_0xdac9('0x45'))){_0x571a8d[_0xdac9('0x23')]=qs[_0xdac9('0x23')](_0x19a46e[_0xdac9('0x3e')][_0xdac9('0x23')]);_0x571a8d[_0xdac9('0x24')]=qs[_0xdac9('0x24')](_0x19a46e[_0xdac9('0x3e')][_0xdac9('0x24')]);}_0x571a8d[_0xdac9('0x46')]=qs[_0xdac9('0x47')](_0x19a46e['query'][_0xdac9('0x47')]);_0x571a8d['where']=qs[_0xdac9('0x40')](_[_0xdac9('0x48')](_0x19a46e['query'],_0x436a3f[_0xdac9('0x40')]));_0x571a8d[_0xdac9('0x4a')][_0xdac9('0x62')]=_0x53d9ed['id'];if(_0x19a46e[_0xdac9('0x3e')][_0xdac9('0x49')]){_0x571a8d[_0xdac9('0x4a')]=_[_0xdac9('0x35')](_0x571a8d[_0xdac9('0x4a')],{'$or':_[_0xdac9('0x3b')](_0x571a8d[_0xdac9('0x44')],function(_0x263b84){var _0x467fa5={};_0x467fa5[_0x263b84]={'$like':'%'+_0x19a46e[_0xdac9('0x3e')][_0xdac9('0x49')]+'%'};return _0x467fa5;})});}_0x571a8d=_[_0xdac9('0x35')]({},_0x571a8d,_0x19a46e[_0xdac9('0x4c')]);return db['UserFaxQueue'][_0xdac9('0x50')](_0x571a8d);}})[_0xdac9('0x2b')](function(_0x30bef0){if(_0x30bef0){return db[_0xdac9('0x63')]['findAndCountAll']({'where':{'id':_[_0xdac9('0x3b')](_0x30bef0,_0xdac9('0x64')),'role':_0xdac9('0x39')},'attributes':['id','name',_0xdac9('0x65'),_0xdac9('0x66'),'createdAt']});}})[_0xdac9('0x2b')](function(_0x1b8ad9){if(_0x1b8ad9){return{'count':_0x1b8ad9[_0xdac9('0x25')],'rows':_['map'](_0x1b8ad9[_0xdac9('0x67')],function(_0x1f5a48){return{'membername':_0x1f5a48[_0xdac9('0x32')],'UserId':_0x1f5a48['id'],'queue_name':_0xe0b940['name'],'FaxQueueId':_0xe0b940['id'],'interface':util['format'](_0xdac9('0x68'),_0xdac9('0x69'),_0x1f5a48[_0xdac9('0x32')]),'penalty':0x0,'paused':_0x1f5a48[_0xdac9('0x65')],'createdAt':_0x1f5a48[_0xdac9('0x6a')],'updatedAt':_0x1f5a48[_0xdac9('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdac9('0x2b')](respondWithFilteredResult(_0x5cb56f,_0x571a8d))[_0xdac9('0x5b')](handleError(_0x5cb56f,null));};exports[_0xdac9('0x6b')]=function(_0x13e8d8,_0x1c0d5c,_0x7fc1cd){var _0x3e5409={};var _0x58e77a={};var _0x5ea939;var _0xeb9e2e;return db['FaxQueue']['findOne']({'where':{'id':_0x13e8d8[_0xdac9('0x51')]['id']}})[_0xdac9('0x2b')](handleEntityNotFound(_0x1c0d5c,null))[_0xdac9('0x2b')](function(_0x2c889d){if(_0x2c889d){_0x5ea939=_0x2c889d;_0x58e77a['model']=_[_0xdac9('0x3f')](db[_0xdac9('0x6c')][_0xdac9('0x3c')]);_0x58e77a['query']=_[_0xdac9('0x3f')](_0x13e8d8[_0xdac9('0x3e')]);_0x58e77a['filters']=_[_0xdac9('0x42')](_0x58e77a['model'],_0x58e77a[_0xdac9('0x3e')]);_0x3e5409['attributes']=_[_0xdac9('0x42')](_0x58e77a[_0xdac9('0x41')],qs[_0xdac9('0x43')](_0x13e8d8[_0xdac9('0x3e')][_0xdac9('0x43')]));_0x3e5409['attributes']=_0x3e5409[_0xdac9('0x44')][_0xdac9('0x52')]?_0x3e5409[_0xdac9('0x44')]:_0x58e77a[_0xdac9('0x41')];_0x3e5409[_0xdac9('0x46')]=qs[_0xdac9('0x47')](_0x13e8d8[_0xdac9('0x3e')][_0xdac9('0x47')]);_0x3e5409[_0xdac9('0x4a')]=qs['filters'](_[_0xdac9('0x48')](_0x13e8d8[_0xdac9('0x3e')],_0x58e77a[_0xdac9('0x40')]));if(_0x13e8d8['query']['filter']){_0x3e5409['where']=_['merge'](_0x3e5409['where'],{'$or':_[_0xdac9('0x3b')](_0x3e5409[_0xdac9('0x44')],function(_0x19a1bb){var _0x3f9aec={};_0x3f9aec[_0x19a1bb]={'$like':'%'+_0x13e8d8['query'][_0xdac9('0x49')]+'%'};return _0x3f9aec;})});}_0x3e5409=_['merge']({},_0x3e5409,_0x13e8d8[_0xdac9('0x4c')]);return _0x5ea939[_0xdac9('0x6b')](_0x3e5409);}})[_0xdac9('0x2b')](function(_0x43f8e3){if(_0x43f8e3){_0xeb9e2e=_0x43f8e3['length'];if(!_0x13e8d8[_0xdac9('0x3e')][_0xdac9('0x61')](_0xdac9('0x45'))){_0x3e5409[_0xdac9('0x23')]=qs['limit'](_0x13e8d8['query'][_0xdac9('0x23')]);_0x3e5409[_0xdac9('0x24')]=qs[_0xdac9('0x24')](_0x13e8d8['query']['offset']);}return _0x5ea939[_0xdac9('0x6b')](_0x3e5409);}})[_0xdac9('0x2b')](function(_0x41cbdb){if(_0x41cbdb){return _0x41cbdb?{'count':_0xeb9e2e,'rows':_0x41cbdb}:null;}})[_0xdac9('0x2b')](respondWithResult(_0x1c0d5c,null))[_0xdac9('0x5b')](handleError(_0x1c0d5c,null));};exports[_0xdac9('0x6d')]=function(_0x3c907b,_0x2c6eae,_0x1ea32d){var _0x107f28=_0x3c907b[_0xdac9('0x36')][_0xdac9('0x6e')];return db[_0xdac9('0x6c')]['findAll']({'where':{'id':_0x107f28},'attributes':['id'],'include':[{'model':db[_0xdac9('0x63')],'as':_0xdac9('0x6f'),'attributes':['id','name',_0xdac9('0x70'),'voicePause',_0xdac9('0x71')],'raw':!![]}]})[_0xdac9('0x2b')](function(_0x3dac87){if(_0x3dac87){var _0x44af8c=_[_0xdac9('0x72')](_0x3dac87,function(_0xc4207f){var _0x232876=_0xc4207f[_0xdac9('0x2c')]({'plain':!![]});return _0x232876[_0xdac9('0x6f')];});return db[_0xdac9('0x4d')][_0xdac9('0x53')]({'where':{'id':_0x3c907b['params']['id']}})[_0xdac9('0x2b')](function(_0x2d55c5){return db[_0xdac9('0x73')][_0xdac9('0x74')](function(_0x228ecc){return _0x2d55c5['addTeams'](_0x107f28,{'transaction':_0x228ecc})['then'](function(){return BPromise[_0xdac9('0x75')](_0x44af8c,function(_0x591ded){return db['UserFaxQueue'][_0xdac9('0x76')]({'where':{'UserId':_0x591ded['id'],'FaxQueueId':_0x3c907b[_0xdac9('0x51')]['id']},'transaction':_0x228ecc});});})[_0xdac9('0x2b')](function(){_0x44af8c[_0xdac9('0x77')](function(_0x5f4cd3){socket[_0xdac9('0x78')](_0xdac9('0x79'),{'UserId':_0x5f4cd3['id'],'FaxQueueId':_0x2d55c5['id']});});});});});}})[_0xdac9('0x2b')](respondWithStatusCode(_0x2c6eae,null))['catch'](handleError(_0x2c6eae,null));};exports['removeTeams']=function(_0x353229,_0x12c338,_0x537bbb){return db['Team']['findAll']({'where':{'id':_0x353229[_0xdac9('0x3e')][_0xdac9('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xdac9('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xdac9('0x2b')](handleEntityNotFound(_0x12c338,null))[_0xdac9('0x2b')](function(_0x136c65){var _0x2ab89f=_[_0xdac9('0x3b')](_0x136c65,'id');var _0x4e860d=[];var _0x32849e=[];var _0x2b1d02=squel['select']();_0x2b1d02[_0xdac9('0x7a')](_0xdac9('0x7b'))[_0xdac9('0x7c')](_0xdac9('0x7d'),'tq')['join']('user_has_teams','ut',_0xdac9('0x7e'))[_0xdac9('0x4a')]('FaxQueueId\x20=\x20?',_0x353229['params']['id']);for(var _0x35b8d6=0x0;_0x35b8d6<_0x136c65['length'];_0x35b8d6+=0x1){let _0x208c4c=_0x136c65[_0x35b8d6];for(var _0x51824d=0x0;_0x51824d<_0x208c4c['Agents'][_0xdac9('0x52')];_0x51824d+=0x1){let _0x3e7218=_0x208c4c[_0xdac9('0x6f')][_0x51824d];var _0x13190d=_0x2b1d02[_0xdac9('0x7f')]();_0x13190d[_0xdac9('0x4a')](_0xdac9('0x80'),_0x3e7218['id']);_0x32849e[_0xdac9('0x81')](db[_0xdac9('0x73')][_0xdac9('0x3e')](_0x13190d[_0xdac9('0x82')](),{'type':db[_0xdac9('0x73')][_0xdac9('0x83')]['SELECT']})[_0xdac9('0x2b')](function(_0x475a19){if(_0x475a19[_0xdac9('0x52')]===0x1){return _0x3e7218['id'];}else{var _0x3f8edc=_[_0xdac9('0x84')](_[_0xdac9('0x3b')](_0x475a19,_0xdac9('0x85')),function(_0xdc056f){return _[_0xdac9('0x86')](_0x2ab89f,_0xdc056f);});if(_0x3f8edc){return _0x3e7218['id'];}}}));}}return BPromise[_0xdac9('0x87')](_0x32849e)[_0xdac9('0x2b')](function(_0x4f5c11){_0x4e860d=_(_0x4e860d)[_0xdac9('0x88')](_0x4f5c11)[_0xdac9('0x89')]()[_0xdac9('0x8a')]();return db[_0xdac9('0x4d')][_0xdac9('0x53')]({'where':{'id':_0x353229[_0xdac9('0x51')]['id']}})[_0xdac9('0x2b')](function(_0x17b954){return db[_0xdac9('0x73')][_0xdac9('0x74')](function(_0x5508dc){return _0x17b954[_0xdac9('0x8b')](_0x353229[_0xdac9('0x3e')][_0xdac9('0x6e')],{'transaction':_0x5508dc})[_0xdac9('0x2b')](function(){if(!_[_0xdac9('0x8c')](_0x4e860d)){return _0x17b954[_0xdac9('0x8d')](_0x4e860d,{'transaction':_0x5508dc});}})[_0xdac9('0x2b')](function(){_0x4e860d[_0xdac9('0x77')](function(_0x16bcee){socket[_0xdac9('0x78')]('userFaxQueue:remove',{'UserId':_0x16bcee,'FaxQueueId':_0x17b954['id']});});});});});});})[_0xdac9('0x2b')](respondWithStatusCode(_0x12c338,null))[_0xdac9('0x5b')](handleError(_0x12c338,null));};exports[_0xdac9('0x8e')]=function(_0xdc382f,_0x15b7bf,_0x39f037){return db[_0xdac9('0x4d')][_0xdac9('0x53')]({'where':{'id':_0xdc382f[_0xdac9('0x51')]['id']}})[_0xdac9('0x2b')](handleEntityNotFound(_0x15b7bf,null))['then'](function(_0x1f39a7){if(_0x1f39a7){return _0x1f39a7[_0xdac9('0x8e')](_0xdc382f[_0xdac9('0x36')][_0xdac9('0x6e')],_[_0xdac9('0x8f')](_0xdc382f[_0xdac9('0x36')],[_0xdac9('0x6e'),'id'])||{})[_0xdac9('0x90')](function(_0x401899){for(var _0x171e70=0x0;_0x171e70<_0xdc382f[_0xdac9('0x36')][_0xdac9('0x6e')]['length'];_0x171e70+=0x1){socket[_0xdac9('0x78')](_0xdac9('0x79'),{'UserId':_0xdc382f['body'][_0xdac9('0x6e')][_0x171e70],'FaxQueueId':_0xdc382f[_0xdac9('0x51')]['id']});}return _0x401899;});}})[_0xdac9('0x2b')](respondWithResult(_0x15b7bf,null))[_0xdac9('0x5b')](handleError(_0x15b7bf,null));};exports[_0xdac9('0x8d')]=function(_0x518bdf,_0x51b973,_0x4588c7){return db[_0xdac9('0x4d')]['find']({'where':{'id':_0x518bdf[_0xdac9('0x51')]['id']}})[_0xdac9('0x2b')](handleEntityNotFound(_0x51b973,null))[_0xdac9('0x2b')](function(_0x1146f7){if(_0x1146f7){return _0x1146f7['removeAgents'](_0x518bdf['query'][_0xdac9('0x6e')])['then'](function(){if(_[_0xdac9('0x91')](_0x518bdf[_0xdac9('0x3e')][_0xdac9('0x6e')])){for(var _0x55e556=0x0;_0x55e556<_0x518bdf[_0xdac9('0x3e')][_0xdac9('0x6e')][_0xdac9('0x52')];_0x55e556+=0x1){socket[_0xdac9('0x78')](_0xdac9('0x92'),{'UserId':Number(_0x518bdf[_0xdac9('0x3e')][_0xdac9('0x6e')][_0x55e556]),'FaxQueueId':Number(_0x518bdf[_0xdac9('0x51')]['id'])});}}else{socket[_0xdac9('0x78')](_0xdac9('0x92'),{'UserId':Number(_0x518bdf[_0xdac9('0x3e')][_0xdac9('0x6e')]),'FaxQueueId':Number(_0x518bdf[_0xdac9('0x51')]['id'])});}});}})[_0xdac9('0x2b')](respondWithStatusCode(_0x51b973,null))[_0xdac9('0x5b')](handleError(_0x51b973,null));};exports[_0xdac9('0x93')]=function(_0x25c20e,_0x375ee8,_0x123dec){var _0x1efe77={};var _0x279cf3={};var _0x1f6d8c;var _0x59b00c;return db['FaxQueue'][_0xdac9('0x5f')]({'where':{'id':_0x25c20e[_0xdac9('0x51')]['id']}})[_0xdac9('0x2b')](handleEntityNotFound(_0x375ee8,null))[_0xdac9('0x2b')](function(_0x28a177){if(_0x28a177){_0x1f6d8c=_0x28a177;_0x279cf3[_0xdac9('0x41')]=_[_0xdac9('0x3f')](db[_0xdac9('0x63')]['rawAttributes']);_0x279cf3[_0xdac9('0x3e')]=_[_0xdac9('0x3f')](_0x25c20e[_0xdac9('0x3e')]);_0x279cf3[_0xdac9('0x40')]=_[_0xdac9('0x42')](_0x279cf3[_0xdac9('0x41')],_0x279cf3[_0xdac9('0x3e')]);_0x1efe77[_0xdac9('0x44')]=_[_0xdac9('0x42')](_0x279cf3[_0xdac9('0x41')],qs[_0xdac9('0x43')](_0x25c20e[_0xdac9('0x3e')]['fields']));_0x1efe77[_0xdac9('0x44')]=_0x1efe77[_0xdac9('0x44')]['length']?_0x1efe77['attributes']:_0x279cf3[_0xdac9('0x41')];_0x1efe77[_0xdac9('0x46')]=qs[_0xdac9('0x47')](_0x25c20e[_0xdac9('0x3e')][_0xdac9('0x47')]);_0x1efe77[_0xdac9('0x4a')]=qs[_0xdac9('0x40')](_[_0xdac9('0x48')](_0x25c20e['query'],_0x279cf3[_0xdac9('0x40')]));if(_0x25c20e[_0xdac9('0x3e')]['filter']){_0x1efe77[_0xdac9('0x4a')]=_[_0xdac9('0x35')](_0x1efe77[_0xdac9('0x4a')],{'$or':_[_0xdac9('0x3b')](_0x1efe77['attributes'],function(_0x1c430a){var _0x68801b={};_0x68801b[_0x1c430a]={'$like':'%'+_0x25c20e[_0xdac9('0x3e')]['filter']+'%'};return _0x68801b;})});}_0x1efe77=_[_0xdac9('0x35')]({},_0x1efe77,_0x25c20e[_0xdac9('0x4c')]);return _0x1f6d8c['getAgents'](_0x1efe77);}})[_0xdac9('0x2b')](function(_0x306af6){if(_0x306af6){_0x59b00c=_0x306af6[_0xdac9('0x52')];if(!_0x25c20e[_0xdac9('0x3e')][_0xdac9('0x61')](_0xdac9('0x45'))){_0x1efe77[_0xdac9('0x23')]=qs['limit'](_0x25c20e[_0xdac9('0x3e')]['limit']);_0x1efe77[_0xdac9('0x24')]=qs[_0xdac9('0x24')](_0x25c20e['query'][_0xdac9('0x24')]);}return _0x1f6d8c[_0xdac9('0x93')](_0x1efe77);}})[_0xdac9('0x2b')](function(_0x11dfd8){if(_0x11dfd8){return _0x11dfd8?{'count':_0x59b00c,'rows':_0x11dfd8}:null;}})[_0xdac9('0x2b')](respondWithResult(_0x375ee8,null))['catch'](handleError(_0x375ee8,null));}; \ No newline at end of file +var _0xb458=['limit','count','apply','reject','save','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','interaction','FaxQueue','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined'];(function(_0x5dacf8,_0xb2de52){var _0x51ebee=function(_0xe1f498){while(--_0xe1f498){_0x5dacf8['push'](_0x5dacf8['shift']());}};_0x51ebee(++_0xb2de52);}(_0xb458,0x103));var _0x8b45=function(_0x43624a,_0x226995){_0x43624a=_0x43624a-0x0;var _0x4c34a0=_0xb458[_0x43624a];return _0x4c34a0;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b45('0x3'));var BPromise=require(_0x8b45('0x4'));var Mustache=require(_0x8b45('0x5'));var util=require(_0x8b45('0x6'));var path=require('path');var sox=require(_0x8b45('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b45('0x8'));var _=require(_0x8b45('0x9'));var squel=require(_0x8b45('0xa'));var crypto=require(_0x8b45('0xb'));var jsforce=require(_0x8b45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xd'));var querystring=require(_0x8b45('0xe'));var Papa=require(_0x8b45('0xf'));var Redis=require(_0x8b45('0x10'));var authService=require(_0x8b45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b45('0x12'));var hardwareService=require(_0x8b45('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b45('0x14'));var db=require(_0x8b45('0x15'))['db'];config[_0x8b45('0x16')]=_['defaults'](config[_0x8b45('0x16')],{'host':_0x8b45('0x17'),'port':0x18eb});var socket=require(_0x8b45('0x18'))(new Redis(config[_0x8b45('0x16')]));require(_0x8b45('0x19'))[_0x8b45('0x1a')](socket);function respondWithStatusCode(_0x5f0b20,_0x5a14c1){_0x5a14c1=_0x5a14c1||0xcc;return function(_0x45881c){if(_0x45881c){return _0x5f0b20[_0x8b45('0x1b')](_0x5a14c1);}return _0x5f0b20[_0x8b45('0x1c')](_0x5a14c1)[_0x8b45('0x1d')]();};}function respondWithResult(_0x4781d7,_0x27ebb3){_0x27ebb3=_0x27ebb3||0xc8;return function(_0x902c50){if(_0x902c50){return _0x4781d7[_0x8b45('0x1c')](_0x27ebb3)[_0x8b45('0x1e')](_0x902c50);}};}function respondWithFilteredResult(_0x391d1e,_0x287a3b){return function(_0x21d5b2){if(_0x21d5b2){var _0x1ed5ca=typeof _0x287a3b[_0x8b45('0x1f')]===_0x8b45('0x20')&&typeof _0x287a3b[_0x8b45('0x21')]===_0x8b45('0x20');var _0x309e23=_0x21d5b2['count'];var _0x25e8a1=_0x1ed5ca?0x0:_0x287a3b[_0x8b45('0x1f')];var _0x1767d5=_0x1ed5ca?_0x21d5b2[_0x8b45('0x22')]:_0x287a3b[_0x8b45('0x1f')]+_0x287a3b[_0x8b45('0x21')];var _0x2f4f1c;if(_0x1767d5>=_0x309e23){_0x1767d5=_0x309e23;_0x2f4f1c=0xc8;}else{_0x2f4f1c=0xce;}_0x391d1e[_0x8b45('0x1c')](_0x2f4f1c);return _0x391d1e['set']('Content-Range',_0x25e8a1+'-'+_0x1767d5+'/'+_0x309e23)[_0x8b45('0x1e')](_0x21d5b2);}return null;};}function patchUpdates(_0x580e17){return function(_0x1952fc){try{jsonpatch[_0x8b45('0x23')](_0x1952fc,_0x580e17,!![]);}catch(_0x30f405){return BPromise[_0x8b45('0x24')](_0x30f405);}return _0x1952fc[_0x8b45('0x25')]();};}function saveUpdates(_0x2b8526,_0x32b12b){return function(_0x5563eb){if(_0x5563eb){return _0x5563eb['update'](_0x2b8526)[_0x8b45('0x26')](function(_0x2c2c06){return _0x2c2c06;});}return null;};}function removeEntity(_0x500044,_0x5723a2){return function(_0x129c35){if(_0x129c35){return _0x129c35[_0x8b45('0x27')]()[_0x8b45('0x26')](function(){var _0x2f37bc=_0x129c35['get']({'plain':!![]});var _0x3df287=_0x8b45('0x28');return db[_0x8b45('0x29')][_0x8b45('0x27')]({'where':{'type':_0x3df287,'resourceId':_0x2f37bc['id']}})[_0x8b45('0x26')](function(){return _0x129c35;});})[_0x8b45('0x26')](function(){_0x500044[_0x8b45('0x1c')](0xcc)[_0x8b45('0x1d')]();});}};}function handleEntityNotFound(_0x1733a7,_0xf21bd1){return function(_0x339c73){if(!_0x339c73){_0x1733a7[_0x8b45('0x1b')](0x194);}return _0x339c73;};}function handleError(_0x5b6151,_0x4a7372){_0x4a7372=_0x4a7372||0x1f4;return function(_0x1d98c3){logger[_0x8b45('0x2a')](_0x1d98c3[_0x8b45('0x2b')]);if(_0x1d98c3[_0x8b45('0x2c')]){delete _0x1d98c3[_0x8b45('0x2c')];}_0x5b6151[_0x8b45('0x1c')](_0x4a7372)[_0x8b45('0x2d')](_0x1d98c3);};}function getMustacheRender(_0x4216bf,_0x5d8938){return Mustache[_0x8b45('0x2e')](_0x4216bf,_[_0x8b45('0x2f')](_0x5d8938[_0x8b45('0x30')],{'contact':_0x5d8938[_0x8b45('0x31')],'message':_0x5d8938[_0x8b45('0x32')],'agent':_0x5d8938['agent'],'interaction':_0x5d8938[_0x8b45('0x33')],'account':_0x5d8938['account']}))||'';}exports['index']=function(_0x1f8a11,_0x94e3b6){var _0xd3ba91={},_0x8d6790={},_0x1e72d2={'count':0x0,'rows':[]};var _0x8fd345=_['map'](db[_0x8b45('0x34')][_0x8b45('0x35')],function(_0x264be7){return{'name':_0x264be7[_0x8b45('0x36')],'type':_0x264be7['type'][_0x8b45('0x37')]};});_0x8d6790[_0x8b45('0x38')]=_[_0x8b45('0x39')](_0x8fd345,'name');_0x8d6790[_0x8b45('0x3a')]=_[_0x8b45('0x3b')](_0x1f8a11[_0x8b45('0x3a')]);_0x8d6790['filters']=_[_0x8b45('0x3c')](_0x8d6790[_0x8b45('0x38')],_0x8d6790[_0x8b45('0x3a')]);_0xd3ba91[_0x8b45('0x3d')]=_['intersection'](_0x8d6790[_0x8b45('0x38')],qs[_0x8b45('0x3e')](_0x1f8a11[_0x8b45('0x3a')][_0x8b45('0x3e')]));_0xd3ba91[_0x8b45('0x3d')]=_0xd3ba91[_0x8b45('0x3d')]['length']?_0xd3ba91['attributes']:_0x8d6790[_0x8b45('0x38')];if(!_0x1f8a11[_0x8b45('0x3a')][_0x8b45('0x3f')](_0x8b45('0x40'))){_0xd3ba91[_0x8b45('0x21')]=qs['limit'](_0x1f8a11[_0x8b45('0x3a')]['limit']);_0xd3ba91[_0x8b45('0x1f')]=qs[_0x8b45('0x1f')](_0x1f8a11[_0x8b45('0x3a')][_0x8b45('0x1f')]);}_0xd3ba91[_0x8b45('0x41')]=qs[_0x8b45('0x42')](_0x1f8a11[_0x8b45('0x3a')][_0x8b45('0x42')]);_0xd3ba91[_0x8b45('0x43')]=qs[_0x8b45('0x44')](_[_0x8b45('0x45')](_0x1f8a11['query'],_0x8d6790[_0x8b45('0x44')]),_0x8fd345);if(_0x1f8a11['query'][_0x8b45('0x46')]){_0xd3ba91['where']=_[_0x8b45('0x2f')](_0xd3ba91[_0x8b45('0x43')],{'$or':_[_0x8b45('0x39')](_0x8fd345,function(_0x7a284f){if(_0x7a284f[_0x8b45('0x47')]!==_0x8b45('0x48')){var _0x58e663={};_0x58e663[_0x7a284f[_0x8b45('0x2c')]]={'$like':'%'+_0x1f8a11['query']['filter']+'%'};return _0x58e663;}})});}_0xd3ba91=_[_0x8b45('0x2f')]({},_0xd3ba91,_0x1f8a11[_0x8b45('0x49')]);var _0x275eb0={'where':_0xd3ba91['where']};return db[_0x8b45('0x34')]['count'](_0x275eb0)[_0x8b45('0x26')](function(_0x1055db){_0x1e72d2[_0x8b45('0x22')]=_0x1055db;if(_0x1f8a11[_0x8b45('0x3a')][_0x8b45('0x4a')]){_0xd3ba91[_0x8b45('0x4b')]=[{'all':!![]}];}return db['FaxQueue'][_0x8b45('0x4c')](_0xd3ba91);})[_0x8b45('0x26')](function(_0x3ad9a4){_0x1e72d2[_0x8b45('0x4d')]=_0x3ad9a4;return _0x1e72d2;})[_0x8b45('0x26')](respondWithFilteredResult(_0x94e3b6,_0xd3ba91))[_0x8b45('0x4e')](handleError(_0x94e3b6,null));};exports[_0x8b45('0x4f')]=function(_0x3de3c2,_0x37b94a){var _0x462b51={'raw':!![],'where':{'id':_0x3de3c2[_0x8b45('0x50')]['id']}},_0x2a1999={};_0x2a1999[_0x8b45('0x38')]=_[_0x8b45('0x3b')](db[_0x8b45('0x34')][_0x8b45('0x35')]);_0x2a1999['query']=_['keys'](_0x3de3c2['query']);_0x2a1999[_0x8b45('0x44')]=_[_0x8b45('0x3c')](_0x2a1999[_0x8b45('0x38')],_0x2a1999[_0x8b45('0x3a')]);_0x462b51[_0x8b45('0x3d')]=_[_0x8b45('0x3c')](_0x2a1999[_0x8b45('0x38')],qs[_0x8b45('0x3e')](_0x3de3c2['query'][_0x8b45('0x3e')]));_0x462b51['attributes']=_0x462b51[_0x8b45('0x3d')][_0x8b45('0x51')]?_0x462b51[_0x8b45('0x3d')]:_0x2a1999[_0x8b45('0x38')];if(_0x3de3c2['query'][_0x8b45('0x4a')]){_0x462b51[_0x8b45('0x4b')]=[{'all':!![]}];}_0x462b51=_['merge']({},_0x462b51,_0x3de3c2[_0x8b45('0x49')]);return db[_0x8b45('0x34')]['find'](_0x462b51)[_0x8b45('0x26')](handleEntityNotFound(_0x37b94a,null))[_0x8b45('0x26')](respondWithResult(_0x37b94a,null))[_0x8b45('0x4e')](handleError(_0x37b94a,null));};exports[_0x8b45('0x52')]=function(_0x219cc0,_0x3d1bf1){return db['FaxQueue']['create'](_0x219cc0[_0x8b45('0x30')],{})[_0x8b45('0x26')](function(_0x2d5b31){var _0x5496cf=_0x219cc0[_0x8b45('0x53')][_0x8b45('0x54')]({'plain':!![]});if(!_0x5496cf)throw new Error(_0x8b45('0x55'));if(_0x5496cf[_0x8b45('0x56')]===_0x8b45('0x53')){var _0x597402=_0x2d5b31[_0x8b45('0x54')]({'plain':!![]});var _0xa92a05='FaxQueues';return db[_0x8b45('0x57')]['find']({'where':{'name':_0xa92a05,'userProfileId':_0x5496cf[_0x8b45('0x58')]},'raw':!![]})[_0x8b45('0x26')](function(_0xca6a73){if(_0xca6a73&&_0xca6a73[_0x8b45('0x59')]===0x0){return db['UserProfileResource'][_0x8b45('0x52')]({'name':_0x597402[_0x8b45('0x2c')],'resourceId':_0x597402['id'],'type':_0xca6a73[_0x8b45('0x2c')],'sectionId':_0xca6a73['id']},{})[_0x8b45('0x26')](function(){return _0x2d5b31;});}else{return _0x2d5b31;}})[_0x8b45('0x4e')](function(_0x20e536){logger[_0x8b45('0x2a')](_0x8b45('0x5a'),_0x20e536);throw _0x20e536;});}return _0x2d5b31;})[_0x8b45('0x26')](respondWithResult(_0x3d1bf1,0xc9))[_0x8b45('0x4e')](handleError(_0x3d1bf1,null));};exports[_0x8b45('0x5b')]=function(_0x274de8,_0x1405f3){if(_0x274de8[_0x8b45('0x30')]['id']){delete _0x274de8[_0x8b45('0x30')]['id'];}return db['FaxQueue'][_0x8b45('0x5c')]({'where':{'id':_0x274de8[_0x8b45('0x50')]['id']}})[_0x8b45('0x26')](handleEntityNotFound(_0x1405f3,null))['then'](saveUpdates(_0x274de8[_0x8b45('0x30')],null))[_0x8b45('0x26')](respondWithResult(_0x1405f3,null))[_0x8b45('0x4e')](handleError(_0x1405f3,null));};exports[_0x8b45('0x27')]=function(_0x5795ca,_0x456c0e){return db[_0x8b45('0x34')][_0x8b45('0x5c')]({'where':{'id':_0x5795ca[_0x8b45('0x50')]['id']}})['then'](handleEntityNotFound(_0x456c0e,null))[_0x8b45('0x26')](removeEntity(_0x456c0e,null))[_0x8b45('0x4e')](handleError(_0x456c0e,null));};exports[_0x8b45('0x5d')]=function(_0x27503f,_0x3488d1){return db['FaxQueue'][_0x8b45('0x5d')]()['then'](respondWithResult(_0x3488d1,null))[_0x8b45('0x4e')](handleError(_0x3488d1,null));};exports[_0x8b45('0x5e')]=function(_0x19152b,_0x19c80e,_0x6a77bd){var _0x3097c8={'raw':!![],'where':{}},_0x54df4d={},_0x5b8ebe;return db[_0x8b45('0x34')][_0x8b45('0x5f')]({'where':{'id':_0x19152b['params']['id']}})[_0x8b45('0x26')](handleEntityNotFound(_0x19c80e,null))[_0x8b45('0x26')](function(_0x3503cb){if(_0x3503cb){_0x5b8ebe=_0x3503cb['get']({'plain':!![]});_0x54df4d['model']=_[_0x8b45('0x3b')](db[_0x8b45('0x60')]['rawAttributes']);_0x54df4d[_0x8b45('0x3a')]=_['keys'](_0x19152b[_0x8b45('0x3a')]);_0x54df4d['filters']=_['intersection'](_0x54df4d[_0x8b45('0x38')],_0x54df4d[_0x8b45('0x3a')]);_0x3097c8['attributes']=_[_0x8b45('0x3c')](_0x54df4d[_0x8b45('0x38')],qs[_0x8b45('0x3e')](_0x19152b[_0x8b45('0x3a')][_0x8b45('0x3e')]));_0x3097c8['attributes']=_0x3097c8[_0x8b45('0x3d')][_0x8b45('0x51')]?_0x3097c8[_0x8b45('0x3d')]:_0x54df4d['model'];if(!_0x19152b['query'][_0x8b45('0x3f')]('nolimit')){_0x3097c8[_0x8b45('0x21')]=qs['limit'](_0x19152b['query']['limit']);_0x3097c8[_0x8b45('0x1f')]=qs['offset'](_0x19152b[_0x8b45('0x3a')][_0x8b45('0x1f')]);}_0x3097c8['order']=qs[_0x8b45('0x42')](_0x19152b[_0x8b45('0x3a')]['sort']);_0x3097c8[_0x8b45('0x43')]=qs[_0x8b45('0x44')](_[_0x8b45('0x45')](_0x19152b[_0x8b45('0x3a')],_0x54df4d[_0x8b45('0x44')]));_0x3097c8[_0x8b45('0x43')][_0x8b45('0x61')]=_0x3503cb['id'];if(_0x19152b[_0x8b45('0x3a')][_0x8b45('0x46')]){_0x3097c8[_0x8b45('0x43')]=_[_0x8b45('0x2f')](_0x3097c8[_0x8b45('0x43')],{'$or':_['map'](_0x3097c8[_0x8b45('0x3d')],function(_0x403ee2){var _0x283eb6={};_0x283eb6[_0x403ee2]={'$like':'%'+_0x19152b[_0x8b45('0x3a')][_0x8b45('0x46')]+'%'};return _0x283eb6;})});}_0x3097c8=_[_0x8b45('0x2f')]({},_0x3097c8,_0x19152b[_0x8b45('0x49')]);return db[_0x8b45('0x60')][_0x8b45('0x4c')](_0x3097c8);}})[_0x8b45('0x26')](function(_0x183c34){if(_0x183c34){return db[_0x8b45('0x62')][_0x8b45('0x63')]({'where':{'id':_[_0x8b45('0x39')](_0x183c34,_0x8b45('0x64')),'role':'agent'},'attributes':['id',_0x8b45('0x2c'),_0x8b45('0x65'),_0x8b45('0x66'),_0x8b45('0x67')]});}})[_0x8b45('0x26')](function(_0xd88538){if(_0xd88538){return{'count':_0xd88538[_0x8b45('0x22')],'rows':_[_0x8b45('0x39')](_0xd88538['rows'],function(_0xd59cf2){return{'membername':_0xd59cf2[_0x8b45('0x2c')],'UserId':_0xd59cf2['id'],'queue_name':_0x5b8ebe[_0x8b45('0x2c')],'FaxQueueId':_0x5b8ebe['id'],'interface':util[_0x8b45('0x68')](_0x8b45('0x69'),_0x8b45('0x6a'),_0xd59cf2[_0x8b45('0x2c')]),'penalty':0x0,'paused':_0xd59cf2[_0x8b45('0x65')],'createdAt':_0xd59cf2[_0x8b45('0x67')],'updatedAt':_0xd59cf2[_0x8b45('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8b45('0x26')](respondWithFilteredResult(_0x19c80e,_0x3097c8))['catch'](handleError(_0x19c80e,null));};exports['getTeams']=function(_0x3318a2,_0x28a909,_0x426a97){var _0x36e5e7={};var _0x6a235a={};var _0x19b851;var _0x6cdd2b;return db[_0x8b45('0x34')][_0x8b45('0x5f')]({'where':{'id':_0x3318a2['params']['id']}})['then'](handleEntityNotFound(_0x28a909,null))[_0x8b45('0x26')](function(_0x28b0b9){if(_0x28b0b9){_0x19b851=_0x28b0b9;_0x6a235a[_0x8b45('0x38')]=_[_0x8b45('0x3b')](db['Team'][_0x8b45('0x35')]);_0x6a235a[_0x8b45('0x3a')]=_[_0x8b45('0x3b')](_0x3318a2[_0x8b45('0x3a')]);_0x6a235a[_0x8b45('0x44')]=_[_0x8b45('0x3c')](_0x6a235a['model'],_0x6a235a['query']);_0x36e5e7[_0x8b45('0x3d')]=_['intersection'](_0x6a235a['model'],qs['fields'](_0x3318a2[_0x8b45('0x3a')][_0x8b45('0x3e')]));_0x36e5e7[_0x8b45('0x3d')]=_0x36e5e7[_0x8b45('0x3d')][_0x8b45('0x51')]?_0x36e5e7[_0x8b45('0x3d')]:_0x6a235a[_0x8b45('0x38')];_0x36e5e7[_0x8b45('0x41')]=qs[_0x8b45('0x42')](_0x3318a2[_0x8b45('0x3a')][_0x8b45('0x42')]);_0x36e5e7[_0x8b45('0x43')]=qs[_0x8b45('0x44')](_[_0x8b45('0x45')](_0x3318a2[_0x8b45('0x3a')],_0x6a235a['filters']));if(_0x3318a2[_0x8b45('0x3a')][_0x8b45('0x46')]){_0x36e5e7[_0x8b45('0x43')]=_[_0x8b45('0x2f')](_0x36e5e7[_0x8b45('0x43')],{'$or':_[_0x8b45('0x39')](_0x36e5e7[_0x8b45('0x3d')],function(_0x251584){var _0x31752d={};_0x31752d[_0x251584]={'$like':'%'+_0x3318a2[_0x8b45('0x3a')]['filter']+'%'};return _0x31752d;})});}_0x36e5e7=_[_0x8b45('0x2f')]({},_0x36e5e7,_0x3318a2[_0x8b45('0x49')]);return _0x19b851[_0x8b45('0x6b')](_0x36e5e7);}})[_0x8b45('0x26')](function(_0x4922e6){if(_0x4922e6){_0x6cdd2b=_0x4922e6[_0x8b45('0x51')];if(!_0x3318a2['query'][_0x8b45('0x3f')]('nolimit')){_0x36e5e7[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x3318a2[_0x8b45('0x3a')][_0x8b45('0x21')]);_0x36e5e7[_0x8b45('0x1f')]=qs[_0x8b45('0x1f')](_0x3318a2['query'][_0x8b45('0x1f')]);}return _0x19b851[_0x8b45('0x6b')](_0x36e5e7);}})[_0x8b45('0x26')](function(_0x6189ed){if(_0x6189ed){return _0x6189ed?{'count':_0x6cdd2b,'rows':_0x6189ed}:null;}})['then'](respondWithResult(_0x28a909,null))[_0x8b45('0x4e')](handleError(_0x28a909,null));};exports[_0x8b45('0x6c')]=function(_0x4adb06,_0x5c3dbd,_0x260b4e){var _0x24a570=_0x4adb06[_0x8b45('0x30')]['ids'];return db[_0x8b45('0x6d')]['findAll']({'where':{'id':_0x24a570},'attributes':['id'],'include':[{'model':db[_0x8b45('0x62')],'as':_0x8b45('0x6e'),'attributes':['id','name','online',_0x8b45('0x6f'),_0x8b45('0x70')],'raw':!![]}]})[_0x8b45('0x26')](function(_0x36e785){if(_0x36e785){var _0x5f2253=_[_0x8b45('0x71')](_0x36e785,function(_0x29760d){var _0x376416=_0x29760d[_0x8b45('0x54')]({'plain':!![]});return _0x376416[_0x8b45('0x6e')];});return db[_0x8b45('0x34')]['find']({'where':{'id':_0x4adb06[_0x8b45('0x50')]['id']}})[_0x8b45('0x26')](function(_0x5b8f1c){return db[_0x8b45('0x72')][_0x8b45('0x73')](function(_0x569f98){return _0x5b8f1c['addTeams'](_0x24a570,{'transaction':_0x569f98})['then'](function(){return BPromise[_0x8b45('0x74')](_0x5f2253,function(_0x31ab30){return db[_0x8b45('0x60')][_0x8b45('0x75')]({'where':{'UserId':_0x31ab30['id'],'FaxQueueId':_0x4adb06[_0x8b45('0x50')]['id']},'transaction':_0x569f98});});})[_0x8b45('0x26')](function(){_0x5f2253[_0x8b45('0x76')](function(_0x55831c){socket[_0x8b45('0x77')](_0x8b45('0x78'),{'UserId':_0x55831c['id'],'FaxQueueId':_0x5b8f1c['id']});});});});});}})[_0x8b45('0x26')](respondWithStatusCode(_0x5c3dbd,null))[_0x8b45('0x4e')](handleError(_0x5c3dbd,null));};exports[_0x8b45('0x79')]=function(_0x10136e,_0x599d5c,_0x1d9cd9){return db[_0x8b45('0x6d')][_0x8b45('0x4c')]({'where':{'id':_0x10136e[_0x8b45('0x3a')][_0x8b45('0x7a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8b45('0x26')](handleEntityNotFound(_0x599d5c,null))[_0x8b45('0x26')](function(_0xcd2b73){var _0x9993ce=_[_0x8b45('0x39')](_0xcd2b73,'id');var _0x5a4aaf=[];var _0x1f7f33=[];var _0x4b6455=squel[_0x8b45('0x7b')]();_0x4b6455['field'](_0x8b45('0x7c'))[_0x8b45('0x7d')](_0x8b45('0x7e'),'tq')[_0x8b45('0x7f')](_0x8b45('0x80'),'ut',_0x8b45('0x81'))[_0x8b45('0x43')](_0x8b45('0x82'),_0x10136e[_0x8b45('0x50')]['id']);for(var _0xfff1e=0x0;_0xfff1e<_0xcd2b73[_0x8b45('0x51')];_0xfff1e+=0x1){let _0x2f136d=_0xcd2b73[_0xfff1e];for(var _0x2eb241=0x0;_0x2eb241<_0x2f136d[_0x8b45('0x6e')]['length'];_0x2eb241+=0x1){let _0x3db51c=_0x2f136d[_0x8b45('0x6e')][_0x2eb241];var _0x1bcb0a=_0x4b6455['clone']();_0x1bcb0a[_0x8b45('0x43')]('ut.UserId\x20=\x20?',_0x3db51c['id']);_0x1f7f33[_0x8b45('0x83')](db[_0x8b45('0x72')]['query'](_0x1bcb0a[_0x8b45('0x84')](),{'type':db['sequelize'][_0x8b45('0x85')][_0x8b45('0x86')]})[_0x8b45('0x26')](function(_0xd524b7){if(_0xd524b7[_0x8b45('0x51')]===0x1){return _0x3db51c['id'];}else{var _0x3f920f=_['every'](_['map'](_0xd524b7,_0x8b45('0x87')),function(_0x2bbc85){return _['includes'](_0x9993ce,_0x2bbc85);});if(_0x3f920f){return _0x3db51c['id'];}}}));}}return BPromise['all'](_0x1f7f33)['then'](function(_0x430b95){_0x5a4aaf=_(_0x5a4aaf)['union'](_0x430b95)[_0x8b45('0x88')]()[_0x8b45('0x89')]();return db[_0x8b45('0x34')][_0x8b45('0x5c')]({'where':{'id':_0x10136e['params']['id']}})[_0x8b45('0x26')](function(_0x311be9){return db[_0x8b45('0x72')][_0x8b45('0x73')](function(_0x1afe71){return _0x311be9[_0x8b45('0x79')](_0x10136e[_0x8b45('0x3a')][_0x8b45('0x7a')],{'transaction':_0x1afe71})['then'](function(){if(!_[_0x8b45('0x8a')](_0x5a4aaf)){return _0x311be9['removeAgents'](_0x5a4aaf,{'transaction':_0x1afe71});}})[_0x8b45('0x26')](function(){_0x5a4aaf['forEach'](function(_0x4b8a95){socket['emit'](_0x8b45('0x8b'),{'UserId':_0x4b8a95,'FaxQueueId':_0x311be9['id']});});});});});});})[_0x8b45('0x26')](respondWithStatusCode(_0x599d5c,null))['catch'](handleError(_0x599d5c,null));};exports[_0x8b45('0x8c')]=function(_0x110eee,_0x36332e,_0x18a754){return db[_0x8b45('0x34')][_0x8b45('0x5c')]({'where':{'id':_0x110eee[_0x8b45('0x50')]['id']}})[_0x8b45('0x26')](handleEntityNotFound(_0x36332e,null))[_0x8b45('0x26')](function(_0x51121e){if(_0x51121e){return _0x51121e[_0x8b45('0x8c')](_0x110eee[_0x8b45('0x30')][_0x8b45('0x7a')],_[_0x8b45('0x8d')](_0x110eee['body'],[_0x8b45('0x7a'),'id'])||{})[_0x8b45('0x8e')](function(_0x3eedad){for(var _0x3d1590=0x0;_0x3d1590<_0x110eee[_0x8b45('0x30')]['ids'][_0x8b45('0x51')];_0x3d1590+=0x1){socket['emit'](_0x8b45('0x78'),{'UserId':_0x110eee[_0x8b45('0x30')]['ids'][_0x3d1590],'FaxQueueId':_0x110eee['params']['id']});}return _0x3eedad;});}})[_0x8b45('0x26')](respondWithResult(_0x36332e,null))['catch'](handleError(_0x36332e,null));};exports[_0x8b45('0x8f')]=function(_0x5006a6,_0x470d23,_0x2f7d4b){return db[_0x8b45('0x34')]['find']({'where':{'id':_0x5006a6[_0x8b45('0x50')]['id']}})['then'](handleEntityNotFound(_0x470d23,null))[_0x8b45('0x26')](function(_0xe5f7da){if(_0xe5f7da){return _0xe5f7da[_0x8b45('0x8f')](_0x5006a6[_0x8b45('0x3a')][_0x8b45('0x7a')])[_0x8b45('0x26')](function(){if(_[_0x8b45('0x90')](_0x5006a6[_0x8b45('0x3a')][_0x8b45('0x7a')])){for(var _0x1b8d9e=0x0;_0x1b8d9e<_0x5006a6[_0x8b45('0x3a')][_0x8b45('0x7a')][_0x8b45('0x51')];_0x1b8d9e+=0x1){socket[_0x8b45('0x77')](_0x8b45('0x8b'),{'UserId':Number(_0x5006a6['query'][_0x8b45('0x7a')][_0x1b8d9e]),'FaxQueueId':Number(_0x5006a6[_0x8b45('0x50')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x5006a6[_0x8b45('0x3a')][_0x8b45('0x7a')]),'FaxQueueId':Number(_0x5006a6[_0x8b45('0x50')]['id'])});}});}})[_0x8b45('0x26')](respondWithStatusCode(_0x470d23,null))[_0x8b45('0x4e')](handleError(_0x470d23,null));};exports[_0x8b45('0x91')]=function(_0x3f1aa6,_0x3ac89b,_0xc28f57){var _0x4ad1fe={};var _0x39626f={};var _0x401e93;var _0x4ca0f4;return db[_0x8b45('0x34')][_0x8b45('0x5f')]({'where':{'id':_0x3f1aa6[_0x8b45('0x50')]['id']}})[_0x8b45('0x26')](handleEntityNotFound(_0x3ac89b,null))[_0x8b45('0x26')](function(_0x1a281d){if(_0x1a281d){_0x401e93=_0x1a281d;_0x39626f[_0x8b45('0x38')]=_[_0x8b45('0x3b')](db[_0x8b45('0x62')][_0x8b45('0x35')]);_0x39626f[_0x8b45('0x3a')]=_[_0x8b45('0x3b')](_0x3f1aa6[_0x8b45('0x3a')]);_0x39626f['filters']=_[_0x8b45('0x3c')](_0x39626f['model'],_0x39626f[_0x8b45('0x3a')]);_0x4ad1fe[_0x8b45('0x3d')]=_[_0x8b45('0x3c')](_0x39626f['model'],qs[_0x8b45('0x3e')](_0x3f1aa6[_0x8b45('0x3a')][_0x8b45('0x3e')]));_0x4ad1fe[_0x8b45('0x3d')]=_0x4ad1fe[_0x8b45('0x3d')][_0x8b45('0x51')]?_0x4ad1fe['attributes']:_0x39626f[_0x8b45('0x38')];_0x4ad1fe[_0x8b45('0x41')]=qs[_0x8b45('0x42')](_0x3f1aa6[_0x8b45('0x3a')]['sort']);_0x4ad1fe[_0x8b45('0x43')]=qs[_0x8b45('0x44')](_[_0x8b45('0x45')](_0x3f1aa6[_0x8b45('0x3a')],_0x39626f['filters']));if(_0x3f1aa6[_0x8b45('0x3a')][_0x8b45('0x46')]){_0x4ad1fe[_0x8b45('0x43')]=_['merge'](_0x4ad1fe[_0x8b45('0x43')],{'$or':_[_0x8b45('0x39')](_0x4ad1fe[_0x8b45('0x3d')],function(_0x1d3a00){var _0x2783b2={};_0x2783b2[_0x1d3a00]={'$like':'%'+_0x3f1aa6[_0x8b45('0x3a')]['filter']+'%'};return _0x2783b2;})});}_0x4ad1fe=_[_0x8b45('0x2f')]({},_0x4ad1fe,_0x3f1aa6[_0x8b45('0x49')]);return _0x401e93['getAgents'](_0x4ad1fe);}})[_0x8b45('0x26')](function(_0x16d99a){if(_0x16d99a){_0x4ca0f4=_0x16d99a['length'];if(!_0x3f1aa6[_0x8b45('0x3a')][_0x8b45('0x3f')](_0x8b45('0x40'))){_0x4ad1fe[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x3f1aa6[_0x8b45('0x3a')][_0x8b45('0x21')]);_0x4ad1fe[_0x8b45('0x1f')]=qs['offset'](_0x3f1aa6[_0x8b45('0x3a')]['offset']);}return _0x401e93[_0x8b45('0x91')](_0x4ad1fe);}})[_0x8b45('0x26')](function(_0x192932){if(_0x192932){return _0x192932?{'count':_0x4ca0f4,'rows':_0x192932}:null;}})['then'](respondWithResult(_0x3ac89b,null))[_0x8b45('0x4e')](handleError(_0x3ac89b,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5ac4fff..3c716e5 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 _0xf6cc=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf6cc,0x188));var _0xcf6c=function(_0x4eed26,_0x33d9b4){_0x4eed26=_0x4eed26-0x0;var _0x43326f=_0xf6cc[_0x4eed26];return _0x43326f;};'use strict';var EventEmitter=require(_0xcf6c('0x0'));var FaxQueue=require(_0xcf6c('0x1'))['db'][_0xcf6c('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xcf6c('0x3')](0x0);var events={'afterCreate':_0xcf6c('0x4'),'afterUpdate':_0xcf6c('0x5'),'afterDestroy':_0xcf6c('0x6')};function emitEvent(_0x547e73){return function(_0x48f359,_0x2ba70d,_0x176b9f){FaxQueueEvents[_0xcf6c('0x7')](_0x547e73+':'+_0x48f359['id'],_0x48f359);FaxQueueEvents[_0xcf6c('0x7')](_0x547e73,_0x48f359);_0x176b9f(null);};}for(var e in events){if(events[_0xcf6c('0x8')](e)){var event=events[e];FaxQueue[_0xcf6c('0x9')](e,emitEvent(event));}}module[_0xcf6c('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0xf86f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','save','update'];(function(_0xa4044e,_0x397c38){var _0x1be1fc=function(_0x1251f6){while(--_0x1251f6){_0xa4044e['push'](_0xa4044e['shift']());}};_0x1be1fc(++_0x397c38);}(_0xf86f,0x177));var _0xff86=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0xf86f[_0x41b0a8];return _0x3a83d4;};'use strict';var EventEmitter=require(_0xff86('0x0'));var FaxQueue=require(_0xff86('0x1'))['db'][_0xff86('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xff86('0x3'),'afterUpdate':_0xff86('0x4'),'afterDestroy':_0xff86('0x5')};function emitEvent(_0xdaa0ac){return function(_0x338ba7,_0x522155,_0x3ddea3){FaxQueueEvents['emit'](_0xdaa0ac+':'+_0x338ba7['id'],_0x338ba7);FaxQueueEvents[_0xff86('0x6')](_0xdaa0ac,_0x338ba7);_0x3ddea3(null);};}for(var e in events){if(events[_0xff86('0x7')](e)){var event=events[e];FaxQueue[_0xff86('0x8')](e,emitEvent(event));}}module[_0xff86('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 31fb0d5..04336b7 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 _0xa60d=['./faxQueue.attributes','define','fax_queues','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4fc3bf,_0x18168a){var _0x771242=function(_0x509c0f){while(--_0x509c0f){_0x4fc3bf['push'](_0x4fc3bf['shift']());}};_0x771242(++_0x18168a);}(_0xa60d,0x71));var _0xda60=function(_0x3f9a64,_0x224930){_0x3f9a64=_0x3f9a64-0x0;var _0x353b88=_0xa60d[_0x3f9a64];return _0x353b88;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xda60('0x0'));var moment=require(_0xda60('0x1'));var BPromise=require(_0xda60('0x2'));var rp=require(_0xda60('0x3'));var fs=require('fs');var path=require(_0xda60('0x4'));var rimraf=require(_0xda60('0x5'));var config=require(_0xda60('0x6'));var attributes=require(_0xda60('0x7'));module['exports']=function(_0x162405,_0x2b0e71){return _0x162405[_0xda60('0x8')]('FaxQueue',attributes,{'tableName':_0xda60('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf45=['moment','bluebird','request-promise','path','rimraf','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger'];(function(_0x23ca3e,_0x2fff1b){var _0x1f0067=function(_0xa59bfb){while(--_0xa59bfb){_0x23ca3e['push'](_0x23ca3e['shift']());}};_0x1f0067(++_0x2fff1b);}(_0xdf45,0x1d1));var _0x5df4=function(_0x21bad5,_0x23a39d){_0x21bad5=_0x21bad5-0x0;var _0x235106=_0xdf45[_0x21bad5];return _0x235106;};'use strict';var _=require(_0x5df4('0x0'));var util=require(_0x5df4('0x1'));var logger=require(_0x5df4('0x2'))('api');var moment=require(_0x5df4('0x3'));var BPromise=require(_0x5df4('0x4'));var rp=require(_0x5df4('0x5'));var fs=require('fs');var path=require(_0x5df4('0x6'));var rimraf=require(_0x5df4('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x5df4('0x8')]=function(_0x26601e,_0x3a74b7){return _0x26601e[_0x5df4('0x9')](_0x5df4('0xa'),attributes,{'tableName':_0x5df4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ecb1e17..944a717 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 _0xbf07=['./faxQueue.socket','register','request','info','request\x20sent','debug','stringify','error','code','message','FaxQueue,\x20%s,\x20%s','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowFaxQueue','FaxQueue','find','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x15bbf0,_0x409476){var _0x349137=function(_0x1c23c2){while(--_0x1c23c2){_0x15bbf0['push'](_0x15bbf0['shift']());}};_0x349137(++_0x409476);}(_0xbf07,0x1bc));var _0x7bf0=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0xbf07[_0x10dbf6];return _0x452147;};'use strict';var _=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var moment=require('moment');var BPromise=require(_0x7bf0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bf0('0x3'))['db'];var utils=require(_0x7bf0('0x4'));var logger=require(_0x7bf0('0x5'))('rpc');var config=require(_0x7bf0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7bf0('0x7')]['http']({'port':0x232a});config[_0x7bf0('0x8')]=_[_0x7bf0('0x9')](config[_0x7bf0('0x8')],{'host':_0x7bf0('0xa'),'port':0x18eb});var socket=require(_0x7bf0('0xb'))(new Redis(config['redis']));require(_0x7bf0('0xc'))[_0x7bf0('0xd')](socket);function respondWithRpcPromise(_0x4f7d86,_0x1d11ec,_0x7c3dcd){return new BPromise(function(_0xebcd42,_0x7cec40){return client[_0x7bf0('0xe')](_0x4f7d86,_0x7c3dcd)['then'](function(_0x3b9bc5){logger[_0x7bf0('0xf')]('FaxQueue,\x20%s,\x20%s',_0x1d11ec,_0x7bf0('0x10'));logger[_0x7bf0('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1d11ec,'request\x20sent',JSON[_0x7bf0('0x12')](_0x3b9bc5));if(_0x3b9bc5[_0x7bf0('0x13')]){if(_0x3b9bc5[_0x7bf0('0x13')][_0x7bf0('0x14')]===0x1f4){logger[_0x7bf0('0x13')]('FaxQueue,\x20%s,\x20%s',_0x1d11ec,_0x3b9bc5[_0x7bf0('0x13')]['message']);return _0x7cec40(_0x3b9bc5[_0x7bf0('0x13')][_0x7bf0('0x15')]);}logger[_0x7bf0('0x13')](_0x7bf0('0x16'),_0x1d11ec,_0x3b9bc5['error'][_0x7bf0('0x15')]);return _0xebcd42(_0x3b9bc5[_0x7bf0('0x13')][_0x7bf0('0x15')]);}else{logger[_0x7bf0('0xf')]('FaxQueue,\x20%s,\x20%s',_0x1d11ec,'request\x20sent');_0xebcd42(_0x3b9bc5['result'][_0x7bf0('0x15')]);}})[_0x7bf0('0x17')](function(_0x5bb517){logger['error']('FaxQueue,\x20%s,\x20%s',_0x1d11ec,_0x5bb517);_0x7cec40(_0x5bb517);});});}exports[_0x7bf0('0x18')]=function(_0x35b633){var _0x14e2b4=this;return new Promise(function(_0x1f6901,_0x5a3e15){return db['FaxQueue'][_0x7bf0('0x19')]({'raw':_0x35b633[_0x7bf0('0x1a')]?_0x35b633[_0x7bf0('0x1a')][_0x7bf0('0x1b')]===undefined?!![]:![]:!![],'where':_0x35b633[_0x7bf0('0x1a')]?_0x35b633[_0x7bf0('0x1a')][_0x7bf0('0x1c')]||null:null,'attributes':_0x35b633[_0x7bf0('0x1a')]?_0x35b633['options'][_0x7bf0('0x1d')]||null:null,'limit':_0x35b633[_0x7bf0('0x1a')]?_0x35b633[_0x7bf0('0x1a')][_0x7bf0('0x1e')]||null:null,'include':_0x35b633[_0x7bf0('0x1a')]?_0x35b633['options']['include']?_[_0x7bf0('0x1f')](_0x35b633[_0x7bf0('0x1a')][_0x7bf0('0x20')],function(_0x5c450e){return{'model':db[_0x5c450e['model']],'as':_0x5c450e['as'],'attributes':_0x5c450e['attributes'],'include':_0x5c450e[_0x7bf0('0x20')]?_[_0x7bf0('0x1f')](_0x5c450e[_0x7bf0('0x20')],function(_0x70f468){return{'model':db[_0x70f468[_0x7bf0('0x21')]],'as':_0x70f468['as'],'attributes':_0x70f468[_0x7bf0('0x1d')],'include':_0x70f468[_0x7bf0('0x20')]?_[_0x7bf0('0x1f')](_0x70f468[_0x7bf0('0x20')],function(_0x40ab9a){return{'model':db[_0x40ab9a[_0x7bf0('0x21')]],'as':_0x40ab9a['as'],'attributes':_0x40ab9a[_0x7bf0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7bf0('0x22')](function(_0x57799c){logger[_0x7bf0('0xf')]('GetFaxQueue',_0x35b633);logger[_0x7bf0('0x11')]('GetFaxQueue',_0x35b633,JSON[_0x7bf0('0x12')](_0x57799c));_0x1f6901(_0x57799c);})[_0x7bf0('0x17')](function(_0x199565){logger[_0x7bf0('0x13')](_0x7bf0('0x18'),_0x199565[_0x7bf0('0x15')],_0x35b633);_0x5a3e15(_0x14e2b4[_0x7bf0('0x13')](0x1f4,_0x199565[_0x7bf0('0x15')]));});});};exports[_0x7bf0('0x23')]=function(_0x10920e){var _0x315754=this;return new Promise(function(_0x5c67af,_0x2fbbb1){return db[_0x7bf0('0x24')][_0x7bf0('0x25')]({'raw':_0x10920e[_0x7bf0('0x1a')]?_0x10920e[_0x7bf0('0x1a')][_0x7bf0('0x1b')]===undefined?!![]:![]:!![],'where':_0x10920e[_0x7bf0('0x1a')]?_0x10920e[_0x7bf0('0x1a')]['where']||null:null,'attributes':_0x10920e[_0x7bf0('0x1a')]?_0x10920e[_0x7bf0('0x1a')][_0x7bf0('0x1d')]||null:null,'include':_0x10920e['options']?_0x10920e[_0x7bf0('0x1a')][_0x7bf0('0x20')]?_[_0x7bf0('0x1f')](_0x10920e['options']['include'],function(_0x43da52){return{'model':db[_0x43da52[_0x7bf0('0x21')]],'as':_0x43da52['as'],'attributes':_0x43da52['attributes'],'include':_0x43da52['include']?_[_0x7bf0('0x1f')](_0x43da52['include'],function(_0x193879){return{'model':db[_0x193879[_0x7bf0('0x21')]],'as':_0x193879['as'],'attributes':_0x193879['attributes'],'include':_0x193879[_0x7bf0('0x20')]?_[_0x7bf0('0x1f')](_0x193879['include'],function(_0x1090f4){return{'model':db[_0x1090f4[_0x7bf0('0x21')]],'as':_0x1090f4['as'],'attributes':_0x1090f4[_0x7bf0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x307c13){logger[_0x7bf0('0xf')](_0x7bf0('0x23'),_0x10920e);logger[_0x7bf0('0x11')](_0x7bf0('0x23'),_0x10920e,JSON['stringify'](_0x307c13));_0x5c67af(_0x307c13);})[_0x7bf0('0x17')](function(_0x571f8a){logger['error'](_0x7bf0('0x23'),_0x571f8a[_0x7bf0('0x15')],_0x10920e);_0x2fbbb1(_0x315754[_0x7bf0('0x13')](0x1f4,_0x571f8a[_0x7bf0('0x15')]));});});}; \ No newline at end of file +var _0x680c=['socket.io-emitter','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','map','attributes','model','then','ShowFaxQueue','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x680c,0x13b));var _0xc680=function(_0x53dc56,_0x2b0c7d){_0x53dc56=_0x53dc56-0x0;var _0xb6e10a=_0x680c[_0x53dc56];return _0xb6e10a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc680('0x0'));var BPromise=require(_0xc680('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc680('0x2'));var db=require(_0xc680('0x3'))['db'];var utils=require(_0xc680('0x4'));var logger=require(_0xc680('0x5'))('rpc');var config=require(_0xc680('0x6'));var jayson=require(_0xc680('0x7'));var client=jayson[_0xc680('0x8')][_0xc680('0x9')]({'port':0x232a});config[_0xc680('0xa')]=_[_0xc680('0xb')](config[_0xc680('0xa')],{'host':_0xc680('0xc'),'port':0x18eb});var socket=require(_0xc680('0xd'))(new Redis(config[_0xc680('0xa')]));require(_0xc680('0xe'))['register'](socket);function respondWithRpcPromise(_0x5d192d,_0x4fe109,_0x2f2968){return new BPromise(function(_0x2cf7c0,_0x3ab253){return client[_0xc680('0xf')](_0x5d192d,_0x2f2968)['then'](function(_0x3c34d3){logger[_0xc680('0x10')](_0xc680('0x11'),_0x4fe109,_0xc680('0x12'));logger[_0xc680('0x13')](_0xc680('0x14'),_0x4fe109,_0xc680('0x12'),JSON[_0xc680('0x15')](_0x3c34d3));if(_0x3c34d3[_0xc680('0x16')]){if(_0x3c34d3[_0xc680('0x16')][_0xc680('0x17')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x4fe109,_0x3c34d3[_0xc680('0x16')][_0xc680('0x18')]);return _0x3ab253(_0x3c34d3[_0xc680('0x16')]['message']);}logger['error'](_0xc680('0x11'),_0x4fe109,_0x3c34d3[_0xc680('0x16')][_0xc680('0x18')]);return _0x2cf7c0(_0x3c34d3[_0xc680('0x16')][_0xc680('0x18')]);}else{logger['info'](_0xc680('0x11'),_0x4fe109,_0xc680('0x12'));_0x2cf7c0(_0x3c34d3[_0xc680('0x19')]['message']);}})[_0xc680('0x1a')](function(_0x33730e){logger['error'](_0xc680('0x11'),_0x4fe109,_0x33730e);_0x3ab253(_0x33730e);});});}exports[_0xc680('0x1b')]=function(_0x5abb2a){var _0x18e0f7=this;return new Promise(function(_0x5a4f1e,_0x1da760){return db[_0xc680('0x1c')][_0xc680('0x1d')]({'raw':_0x5abb2a[_0xc680('0x1e')]?_0x5abb2a['options'][_0xc680('0x1f')]===undefined?!![]:![]:!![],'where':_0x5abb2a[_0xc680('0x1e')]?_0x5abb2a[_0xc680('0x1e')][_0xc680('0x20')]||null:null,'attributes':_0x5abb2a[_0xc680('0x1e')]?_0x5abb2a['options']['attributes']||null:null,'limit':_0x5abb2a['options']?_0x5abb2a[_0xc680('0x1e')][_0xc680('0x21')]||null:null,'include':_0x5abb2a[_0xc680('0x1e')]?_0x5abb2a[_0xc680('0x1e')][_0xc680('0x22')]?_[_0xc680('0x23')](_0x5abb2a[_0xc680('0x1e')][_0xc680('0x22')],function(_0x40a368){return{'model':db[_0x40a368['model']],'as':_0x40a368['as'],'attributes':_0x40a368[_0xc680('0x24')],'include':_0x40a368[_0xc680('0x22')]?_['map'](_0x40a368[_0xc680('0x22')],function(_0x2a93a4){return{'model':db[_0x2a93a4[_0xc680('0x25')]],'as':_0x2a93a4['as'],'attributes':_0x2a93a4[_0xc680('0x24')],'include':_0x2a93a4['include']?_[_0xc680('0x23')](_0x2a93a4[_0xc680('0x22')],function(_0x369c80){return{'model':db[_0x369c80[_0xc680('0x25')]],'as':_0x369c80['as'],'attributes':_0x369c80[_0xc680('0x24')]};}):[]};}):[]};}):[]:[]})[_0xc680('0x26')](function(_0x488622){logger[_0xc680('0x10')]('GetFaxQueue',_0x5abb2a);logger[_0xc680('0x13')](_0xc680('0x1b'),_0x5abb2a,JSON[_0xc680('0x15')](_0x488622));_0x5a4f1e(_0x488622);})[_0xc680('0x1a')](function(_0x4835f9){logger[_0xc680('0x16')](_0xc680('0x1b'),_0x4835f9[_0xc680('0x18')],_0x5abb2a);_0x1da760(_0x18e0f7[_0xc680('0x16')](0x1f4,_0x4835f9[_0xc680('0x18')]));});});};exports[_0xc680('0x27')]=function(_0x102ec5){var _0x582e55=this;return new Promise(function(_0x22d0c0,_0x5e2375){return db['FaxQueue'][_0xc680('0x28')]({'raw':_0x102ec5[_0xc680('0x1e')]?_0x102ec5['options'][_0xc680('0x1f')]===undefined?!![]:![]:!![],'where':_0x102ec5[_0xc680('0x1e')]?_0x102ec5['options'][_0xc680('0x20')]||null:null,'attributes':_0x102ec5['options']?_0x102ec5[_0xc680('0x1e')][_0xc680('0x24')]||null:null,'include':_0x102ec5[_0xc680('0x1e')]?_0x102ec5['options'][_0xc680('0x22')]?_['map'](_0x102ec5[_0xc680('0x1e')][_0xc680('0x22')],function(_0x20d9de){return{'model':db[_0x20d9de['model']],'as':_0x20d9de['as'],'attributes':_0x20d9de['attributes'],'include':_0x20d9de[_0xc680('0x22')]?_['map'](_0x20d9de['include'],function(_0x13bf26){return{'model':db[_0x13bf26['model']],'as':_0x13bf26['as'],'attributes':_0x13bf26[_0xc680('0x24')],'include':_0x13bf26['include']?_['map'](_0x13bf26[_0xc680('0x22')],function(_0x1dcf80){return{'model':db[_0x1dcf80['model']],'as':_0x1dcf80['as'],'attributes':_0x1dcf80[_0xc680('0x24')]};}):[]};}):[]};}):[]:[]})[_0xc680('0x26')](function(_0x3e45c4){logger[_0xc680('0x10')](_0xc680('0x27'),_0x102ec5);logger['debug'](_0xc680('0x27'),_0x102ec5,JSON['stringify'](_0x3e45c4));_0x22d0c0(_0x3e45c4);})[_0xc680('0x1a')](function(_0x56cb88){logger[_0xc680('0x16')](_0xc680('0x27'),_0x56cb88[_0xc680('0x18')],_0x102ec5);_0x5e2375(_0x582e55[_0xc680('0x16')](0x1f4,_0x56cb88[_0xc680('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 014d6a8..3323e8b 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 _0x2c7f=['removeListener','register','faxQueue:','./faxQueue.events','emit'];(function(_0x27eda0,_0x42a3cf){var _0x2b63a5=function(_0x431084){while(--_0x431084){_0x27eda0['push'](_0x27eda0['shift']());}};_0x2b63a5(++_0x42a3cf);}(_0x2c7f,0x1e8));var _0xf2c7=function(_0x1d234f,_0x329a36){_0x1d234f=_0x1d234f-0x0;var _0x3a0aae=_0x2c7f[_0x1d234f];return _0x3a0aae;};'use strict';var FaxQueueEvents=require(_0xf2c7('0x0'));var events=['save','remove','update'];function createListener(_0xc0109a,_0x55f6d4){return function(_0x49deb7){_0x55f6d4[_0xf2c7('0x1')](_0xc0109a,_0x49deb7);};}function removeListener(_0x47529f,_0xa04338){return function(){FaxQueueEvents[_0xf2c7('0x2')](_0x47529f,_0xa04338);};}exports[_0xf2c7('0x3')]=function(_0x500d39){for(var _0x449703=0x0,_0x7a5028=events['length'];_0x449703<_0x7a5028;_0x449703++){var _0x8daf06=events[_0x449703];var _0x207aea=createListener(_0xf2c7('0x4')+_0x8daf06,_0x500d39);FaxQueueEvents['on'](_0x8daf06,_0x207aea);}}; \ No newline at end of file +var _0xcb01=['removeListener','register','length','update','emit'];(function(_0x53c52d,_0x207d70){var _0x4e6598=function(_0x46000e){while(--_0x46000e){_0x53c52d['push'](_0x53c52d['shift']());}};_0x4e6598(++_0x207d70);}(_0xcb01,0x1f2));var _0x1cb0=function(_0x56e7ab,_0x5250e6){_0x56e7ab=_0x56e7ab-0x0;var _0x74316a=_0xcb01[_0x56e7ab];return _0x74316a;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save','remove',_0x1cb0('0x0')];function createListener(_0x4d8c22,_0x4ed9ad){return function(_0x2c4945){_0x4ed9ad[_0x1cb0('0x1')](_0x4d8c22,_0x2c4945);};}function removeListener(_0xe67686,_0xcc127){return function(){FaxQueueEvents[_0x1cb0('0x2')](_0xe67686,_0xcc127);};}exports[_0x1cb0('0x3')]=function(_0x137eab){for(var _0x1da546=0x0,_0x4b7e70=events[_0x1cb0('0x4')];_0x1da546<_0x4b7e70;_0x1da546++){var _0x1f9995=events[_0x1da546];var _0x330ea7=createListener('faxQueue:'+_0x1f9995,_0x137eab);FaxQueueEvents['on'](_0x1f9995,_0x330ea7);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1d36472..647c119 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 _0x13c1=['addTeams','addAgents','update','delete','destroy','/:id/teams','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create'];(function(_0x45bf48,_0x5dd33e){var _0x5299a0=function(_0x7f8235){while(--_0x7f8235){_0x45bf48['push'](_0x45bf48['shift']());}};_0x5299a0(++_0x5dd33e);}(_0x13c1,0x188));var _0x113c=function(_0x2b2b54,_0x35eb09){_0x2b2b54=_0x2b2b54-0x0;var _0x5de0c1=_0x13c1[_0x2b2b54];return _0x5de0c1;};'use strict';var multer=require(_0x113c('0x0'));var util=require(_0x113c('0x1'));var path=require(_0x113c('0x2'));var timeout=require(_0x113c('0x3'));var express=require(_0x113c('0x4'));var router=express[_0x113c('0x5')]();var fs_extra=require(_0x113c('0x6'));var auth=require(_0x113c('0x7'));var interaction=require(_0x113c('0x8'));var config=require(_0x113c('0x9'));var controller=require(_0x113c('0xa'));router[_0x113c('0xb')]('/',auth[_0x113c('0xc')](),controller[_0x113c('0xd')]);router['get'](_0x113c('0xe'),auth['isAuthenticated'](),controller[_0x113c('0xf')]);router[_0x113c('0xb')](_0x113c('0x10'),auth[_0x113c('0xc')](),controller[_0x113c('0x11')]);router[_0x113c('0xb')](_0x113c('0x12'),auth[_0x113c('0xc')](),controller[_0x113c('0x13')]);router['get']('/:id/teams',auth[_0x113c('0xc')](),controller['getTeams']);router[_0x113c('0xb')](_0x113c('0x14'),auth['isAuthenticated'](),controller[_0x113c('0x15')]);router[_0x113c('0x16')]('/',auth[_0x113c('0xc')](),controller[_0x113c('0x17')]);router['post']('/:id/teams',auth[_0x113c('0xc')](),controller[_0x113c('0x18')]);router[_0x113c('0x16')](_0x113c('0x14'),auth[_0x113c('0xc')](),controller[_0x113c('0x19')]);router['put'](_0x113c('0x10'),auth[_0x113c('0xc')](),controller[_0x113c('0x1a')]);router[_0x113c('0x1b')](_0x113c('0x10'),auth[_0x113c('0xc')](),controller[_0x113c('0x1c')]);router['delete'](_0x113c('0x1d'),auth['isAuthenticated'](),controller[_0x113c('0x1e')]);router[_0x113c('0x1b')]('/:id/users',auth[_0x113c('0xc')](),controller[_0x113c('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x0f1d=['show','getMembers','/:id/users','post','/:id/teams','addTeams','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./faxQueue.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x4de8f9,_0xde3981){var _0x472379=function(_0x4f40ee){while(--_0x4f40ee){_0x4de8f9['push'](_0x4de8f9['shift']());}};_0x472379(++_0xde3981);}(_0x0f1d,0x192));var _0xd0f1=function(_0x2ae22a,_0x4fe753){_0x2ae22a=_0x2ae22a-0x0;var _0x286a82=_0x0f1d[_0x2ae22a];return _0x286a82;};'use strict';var multer=require(_0xd0f1('0x0'));var util=require('util');var path=require(_0xd0f1('0x1'));var timeout=require(_0xd0f1('0x2'));var express=require(_0xd0f1('0x3'));var router=express['Router']();var fs_extra=require(_0xd0f1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd0f1('0x5'));var config=require('../../config/environment');var controller=require(_0xd0f1('0x6'));router[_0xd0f1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd0f1('0x7')](_0xd0f1('0x8'),auth[_0xd0f1('0x9')](),controller[_0xd0f1('0xa')]);router[_0xd0f1('0x7')](_0xd0f1('0xb'),auth[_0xd0f1('0x9')](),controller[_0xd0f1('0xc')]);router['get']('/:id/members',auth[_0xd0f1('0x9')](),controller[_0xd0f1('0xd')]);router[_0xd0f1('0x7')]('/:id/teams',auth[_0xd0f1('0x9')](),controller['getTeams']);router[_0xd0f1('0x7')](_0xd0f1('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd0f1('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xd0f1('0x10'),auth[_0xd0f1('0x9')](),controller[_0xd0f1('0x11')]);router['post'](_0xd0f1('0xe'),auth[_0xd0f1('0x9')](),controller['addAgents']);router['put'](_0xd0f1('0xb'),auth[_0xd0f1('0x9')](),controller[_0xd0f1('0x12')]);router[_0xd0f1('0x13')](_0xd0f1('0xb'),auth[_0xd0f1('0x9')](),controller[_0xd0f1('0x14')]);router['delete'](_0xd0f1('0x10'),auth[_0xd0f1('0x9')](),controller[_0xd0f1('0x15')]);router[_0xd0f1('0x13')](_0xd0f1('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xd0f1('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5834496..44338e6 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 _0x22f5=['sequelize','exports','STRING','DATE','moment'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0x22f5,0xd6));var _0x522f=function(_0x11eb21,_0x2f09b5){_0x11eb21=_0x11eb21-0x0;var _0x355fde=_0x22f5[_0x11eb21];return _0x355fde;};'use strict';var moment=require(_0x522f('0x0'));var Sequelize=require(_0x522f('0x1'));module[_0x522f('0x2')]={'uniqueid':{'type':Sequelize[_0x522f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x522f('0x3')]},'joinAt':{'type':Sequelize[_0x522f('0x4')]},'leaveAt':{'type':Sequelize[_0x522f('0x4')]},'acceptAt':{'type':Sequelize[_0x522f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x522f('0x3')]}}; \ No newline at end of file +var _0x5283=['exports','STRING','DATE'];(function(_0x471da1,_0x1343c7){var _0x23b2a9=function(_0x90c834){while(--_0x90c834){_0x471da1['push'](_0x471da1['shift']());}};_0x23b2a9(++_0x1343c7);}(_0x5283,0xea));var _0x3528=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x5283[_0x184759];return _0xf26d5f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3528('0x0')]={'uniqueid':{'type':Sequelize[_0x3528('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x3528('0x1')]},'joinAt':{'type':Sequelize[_0x3528('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3528('0x2')]},'exitAt':{'type':Sequelize[_0x3528('0x2')]},'reason':{'type':Sequelize[_0x3528('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 9df1da6..4cc880d 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 _0xa74f=['keys','length','includeAll','find','create','body','update','describe','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','destroy','then','error','name','send','render','merge','message','agent','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','options','FaxQueueReport','findAll','rows','catch','params'];(function(_0x16476b,_0x15c3b4){var _0x4387b0=function(_0x265684){while(--_0x265684){_0x16476b['push'](_0x16476b['shift']());}};_0x4387b0(++_0x15c3b4);}(_0xa74f,0x9a));var _0xfa74=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xa74f[_0x2b5513];return _0x578fd2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa74('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa74('0x1'));var BPromise=require(_0xfa74('0x2'));var Mustache=require(_0xfa74('0x3'));var util=require(_0xfa74('0x4'));var path=require('path');var sox=require(_0xfa74('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa74('0x6'));var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var licenseUtil=require(_0xfa74('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23591a,_0x998585){_0x998585=_0x998585||0xcc;return function(_0x78173f){if(_0x78173f){return _0x23591a[_0xfa74('0x16')](_0x998585);}return _0x23591a['status'](_0x998585)[_0xfa74('0x17')]();};}function respondWithResult(_0x33cda3,_0x3eb49b){_0x3eb49b=_0x3eb49b||0xc8;return function(_0x3947ca){if(_0x3947ca){return _0x33cda3[_0xfa74('0x18')](_0x3eb49b)['json'](_0x3947ca);}};}function respondWithFilteredResult(_0x199d20,_0x13d911){return function(_0x947da6){if(_0x947da6){var _0x1f1de0=typeof _0x13d911[_0xfa74('0x19')]===_0xfa74('0x1a')&&typeof _0x13d911[_0xfa74('0x1b')]==='undefined';var _0x58a67a=_0x947da6[_0xfa74('0x1c')];var _0x51dda1=_0x1f1de0?0x0:_0x13d911['offset'];var _0x31d3c1=_0x1f1de0?_0x947da6[_0xfa74('0x1c')]:_0x13d911[_0xfa74('0x19')]+_0x13d911['limit'];var _0x3bede6;if(_0x31d3c1>=_0x58a67a){_0x31d3c1=_0x58a67a;_0x3bede6=0xc8;}else{_0x3bede6=0xce;}_0x199d20[_0xfa74('0x18')](_0x3bede6);return _0x199d20[_0xfa74('0x1d')]('Content-Range',_0x51dda1+'-'+_0x31d3c1+'/'+_0x58a67a)[_0xfa74('0x1e')](_0x947da6);}return null;};}function patchUpdates(_0x302eb4){return function(_0x2e6c33){try{jsonpatch['apply'](_0x2e6c33,_0x302eb4,!![]);}catch(_0x5466ca){return BPromise[_0xfa74('0x1f')](_0x5466ca);}return _0x2e6c33[_0xfa74('0x20')]();};}function saveUpdates(_0x9932db,_0xeaaa19){return function(_0x1a453d){if(_0x1a453d){return _0x1a453d['update'](_0x9932db)['then'](function(_0x3721bf){return _0x3721bf;});}return null;};}function removeEntity(_0x5aa8a7,_0x48cbd3){return function(_0x529810){if(_0x529810){return _0x529810[_0xfa74('0x21')]()[_0xfa74('0x22')](function(){_0x5aa8a7[_0xfa74('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530f99,_0x9eb68c){return function(_0xeb6c11){if(!_0xeb6c11){_0x530f99['sendStatus'](0x194);}return _0xeb6c11;};}function handleError(_0x62e1be,_0x5d3b26){_0x5d3b26=_0x5d3b26||0x1f4;return function(_0x1a8cf7){logger[_0xfa74('0x23')](_0x1a8cf7['stack']);if(_0x1a8cf7[_0xfa74('0x24')]){delete _0x1a8cf7[_0xfa74('0x24')];}_0x62e1be[_0xfa74('0x18')](_0x5d3b26)[_0xfa74('0x25')](_0x1a8cf7);};}function getMustacheRender(_0x4f7337,_0xd9c55d){return Mustache[_0xfa74('0x26')](_0x4f7337,_[_0xfa74('0x27')](_0xd9c55d['body'],{'contact':_0xd9c55d['contact'],'message':_0xd9c55d[_0xfa74('0x28')],'agent':_0xd9c55d[_0xfa74('0x29')],'interaction':_0xd9c55d['interaction'],'account':_0xd9c55d['account']}))||'';}exports[_0xfa74('0x2a')]=function(_0x564060,_0x2238d4){var _0x4d6d0a={},_0x363173={},_0x554f05={'count':0x0,'rows':[]};var _0x3c4cd1=_[_0xfa74('0x2b')](db['FaxQueueReport'][_0xfa74('0x2c')],function(_0x102d47){return{'name':_0x102d47[_0xfa74('0x2d')],'type':_0x102d47[_0xfa74('0x2e')][_0xfa74('0x2f')]};});_0x363173[_0xfa74('0x30')]=_[_0xfa74('0x2b')](_0x3c4cd1,'name');_0x363173[_0xfa74('0x31')]=_['keys'](_0x564060[_0xfa74('0x31')]);_0x363173[_0xfa74('0x32')]=_[_0xfa74('0x33')](_0x363173[_0xfa74('0x30')],_0x363173['query']);_0x4d6d0a['attributes']=_[_0xfa74('0x33')](_0x363173[_0xfa74('0x30')],qs[_0xfa74('0x34')](_0x564060[_0xfa74('0x31')]['fields']));_0x4d6d0a[_0xfa74('0x35')]=_0x4d6d0a[_0xfa74('0x35')]['length']?_0x4d6d0a['attributes']:_0x363173['model'];if(!_0x564060['query']['hasOwnProperty'](_0xfa74('0x36'))){_0x4d6d0a[_0xfa74('0x1b')]=qs[_0xfa74('0x1b')](_0x564060[_0xfa74('0x31')][_0xfa74('0x1b')]);_0x4d6d0a[_0xfa74('0x19')]=qs[_0xfa74('0x19')](_0x564060[_0xfa74('0x31')][_0xfa74('0x19')]);}_0x4d6d0a['order']=qs[_0xfa74('0x37')](_0x564060[_0xfa74('0x31')][_0xfa74('0x37')]);_0x4d6d0a[_0xfa74('0x38')]=qs[_0xfa74('0x32')](_[_0xfa74('0x39')](_0x564060['query'],_0x363173[_0xfa74('0x32')]),_0x3c4cd1);if(_0x564060[_0xfa74('0x31')][_0xfa74('0x3a')]){_0x4d6d0a[_0xfa74('0x38')]=_['merge'](_0x4d6d0a[_0xfa74('0x38')],{'$or':_[_0xfa74('0x2b')](_0x3c4cd1,function(_0xe8491b){if(_0xe8491b[_0xfa74('0x2e')]!=='VIRTUAL'){var _0x107101={};_0x107101[_0xe8491b[_0xfa74('0x24')]]={'$like':'%'+_0x564060[_0xfa74('0x31')]['filter']+'%'};return _0x107101;}})});}_0x4d6d0a=_['merge']({},_0x4d6d0a,_0x564060[_0xfa74('0x3b')]);var _0x3267f3={'where':_0x4d6d0a[_0xfa74('0x38')]};return db[_0xfa74('0x3c')]['count'](_0x3267f3)[_0xfa74('0x22')](function(_0x171923){_0x554f05['count']=_0x171923;if(_0x564060['query']['includeAll']){_0x4d6d0a['include']=[{'all':!![]}];}return db[_0xfa74('0x3c')][_0xfa74('0x3d')](_0x4d6d0a);})[_0xfa74('0x22')](function(_0x34a2e6){_0x554f05[_0xfa74('0x3e')]=_0x34a2e6;return _0x554f05;})[_0xfa74('0x22')](respondWithFilteredResult(_0x2238d4,_0x4d6d0a))[_0xfa74('0x3f')](handleError(_0x2238d4,null));};exports['show']=function(_0x274062,_0x3938c1){var _0xee50b7={'raw':!![],'where':{'id':_0x274062[_0xfa74('0x40')]['id']}},_0x417379={};_0x417379['model']=_[_0xfa74('0x41')](db[_0xfa74('0x3c')][_0xfa74('0x2c')]);_0x417379[_0xfa74('0x31')]=_[_0xfa74('0x41')](_0x274062[_0xfa74('0x31')]);_0x417379[_0xfa74('0x32')]=_[_0xfa74('0x33')](_0x417379[_0xfa74('0x30')],_0x417379[_0xfa74('0x31')]);_0xee50b7['attributes']=_[_0xfa74('0x33')](_0x417379['model'],qs[_0xfa74('0x34')](_0x274062[_0xfa74('0x31')][_0xfa74('0x34')]));_0xee50b7[_0xfa74('0x35')]=_0xee50b7['attributes'][_0xfa74('0x42')]?_0xee50b7[_0xfa74('0x35')]:_0x417379['model'];if(_0x274062[_0xfa74('0x31')][_0xfa74('0x43')]){_0xee50b7['include']=[{'all':!![]}];}_0xee50b7=_[_0xfa74('0x27')]({},_0xee50b7,_0x274062[_0xfa74('0x3b')]);return db[_0xfa74('0x3c')][_0xfa74('0x44')](_0xee50b7)[_0xfa74('0x22')](handleEntityNotFound(_0x3938c1,null))['then'](respondWithResult(_0x3938c1,null))['catch'](handleError(_0x3938c1,null));};exports[_0xfa74('0x45')]=function(_0x91df44,_0x5ef2ec){return db[_0xfa74('0x3c')][_0xfa74('0x45')](_0x91df44[_0xfa74('0x46')],{})['then'](respondWithResult(_0x5ef2ec,0xc9))['catch'](handleError(_0x5ef2ec,null));};exports[_0xfa74('0x47')]=function(_0x3cd48c,_0x2c56a8){if(_0x3cd48c[_0xfa74('0x46')]['id']){delete _0x3cd48c[_0xfa74('0x46')]['id'];}return db[_0xfa74('0x3c')][_0xfa74('0x44')]({'where':{'id':_0x3cd48c[_0xfa74('0x40')]['id']}})['then'](handleEntityNotFound(_0x2c56a8,null))[_0xfa74('0x22')](saveUpdates(_0x3cd48c[_0xfa74('0x46')],null))[_0xfa74('0x22')](respondWithResult(_0x2c56a8,null))[_0xfa74('0x3f')](handleError(_0x2c56a8,null));};exports['destroy']=function(_0x4ec218,_0x3146de){return db['FaxQueueReport'][_0xfa74('0x44')]({'where':{'id':_0x4ec218[_0xfa74('0x40')]['id']}})[_0xfa74('0x22')](handleEntityNotFound(_0x3146de,null))[_0xfa74('0x22')](removeEntity(_0x3146de,null))[_0xfa74('0x3f')](handleError(_0x3146de,null));};exports[_0xfa74('0x48')]=function(_0x253562,_0x48a0b6){return db[_0xfa74('0x3c')]['describe']()[_0xfa74('0x22')](respondWithResult(_0x48a0b6,null))['catch'](handleError(_0x48a0b6,null));}; \ No newline at end of file +var _0xb43b=['send','render','merge','contact','agent','interaction','account','index','FaxQueueReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','where','VIRTUAL','includeAll','findAll','then','rows','show','params','include','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus','name','status'];(function(_0x323a07,_0x56d37a){var _0x1fd1c9=function(_0x336635){while(--_0x336635){_0x323a07['push'](_0x323a07['shift']());}};_0x1fd1c9(++_0x56d37a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1f7275,_0x36322e){_0x1f7275=_0x1f7275-0x0;var _0x2007d5=_0xb43b[_0x1f7275];return _0x2007d5;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}function getMustacheRender(_0x510b05,_0x40b04b){return Mustache[_0xbb43('0x29')](_0x510b05,_[_0xbb43('0x2a')](_0x40b04b['body'],{'contact':_0x40b04b[_0xbb43('0x2b')],'message':_0x40b04b['message'],'agent':_0x40b04b[_0xbb43('0x2c')],'interaction':_0x40b04b[_0xbb43('0x2d')],'account':_0x40b04b[_0xbb43('0x2e')]}))||'';}exports[_0xbb43('0x2f')]=function(_0x555b99,_0x157d62){var _0x547a6f={},_0x5566cf={},_0x57d9d4={'count':0x0,'rows':[]};var _0x2af898=_['map'](db[_0xbb43('0x30')][_0xbb43('0x31')],function(_0xc577ac){return{'name':_0xc577ac['fieldName'],'type':_0xc577ac[_0xbb43('0x32')][_0xbb43('0x33')]};});_0x5566cf[_0xbb43('0x34')]=_[_0xbb43('0x35')](_0x2af898,_0xbb43('0x26'));_0x5566cf[_0xbb43('0x36')]=_[_0xbb43('0x37')](_0x555b99[_0xbb43('0x36')]);_0x5566cf['filters']=_[_0xbb43('0x38')](_0x5566cf[_0xbb43('0x34')],_0x5566cf[_0xbb43('0x36')]);_0x547a6f[_0xbb43('0x39')]=_[_0xbb43('0x38')](_0x5566cf[_0xbb43('0x34')],qs[_0xbb43('0x3a')](_0x555b99[_0xbb43('0x36')][_0xbb43('0x3a')]));_0x547a6f[_0xbb43('0x39')]=_0x547a6f[_0xbb43('0x39')][_0xbb43('0x3b')]?_0x547a6f[_0xbb43('0x39')]:_0x5566cf[_0xbb43('0x34')];if(!_0x555b99[_0xbb43('0x36')][_0xbb43('0x3c')]('nolimit')){_0x547a6f[_0xbb43('0x1d')]=qs[_0xbb43('0x1d')](_0x555b99['query'][_0xbb43('0x1d')]);_0x547a6f[_0xbb43('0x1c')]=qs[_0xbb43('0x1c')](_0x555b99['query']['offset']);}_0x547a6f['order']=qs[_0xbb43('0x3d')](_0x555b99[_0xbb43('0x36')]['sort']);_0x547a6f['where']=qs[_0xbb43('0x3e')](_[_0xbb43('0x3f')](_0x555b99[_0xbb43('0x36')],_0x5566cf[_0xbb43('0x3e')]),_0x2af898);if(_0x555b99[_0xbb43('0x36')]['filter']){_0x547a6f[_0xbb43('0x40')]=_[_0xbb43('0x2a')](_0x547a6f[_0xbb43('0x40')],{'$or':_[_0xbb43('0x35')](_0x2af898,function(_0x22fccc){if(_0x22fccc['type']!==_0xbb43('0x41')){var _0x4f0f13={};_0x4f0f13[_0x22fccc[_0xbb43('0x26')]]={'$like':'%'+_0x555b99[_0xbb43('0x36')]['filter']+'%'};return _0x4f0f13;}})});}_0x547a6f=_[_0xbb43('0x2a')]({},_0x547a6f,_0x555b99['options']);var _0x1fcf64={'where':_0x547a6f[_0xbb43('0x40')]};return db[_0xbb43('0x30')][_0xbb43('0x1b')](_0x1fcf64)['then'](function(_0x3e0871){_0x57d9d4[_0xbb43('0x1b')]=_0x3e0871;if(_0x555b99['query'][_0xbb43('0x42')]){_0x547a6f['include']=[{'all':!![]}];}return db[_0xbb43('0x30')][_0xbb43('0x43')](_0x547a6f);})[_0xbb43('0x44')](function(_0x14e57e){_0x57d9d4[_0xbb43('0x45')]=_0x14e57e;return _0x57d9d4;})[_0xbb43('0x44')](respondWithFilteredResult(_0x157d62,_0x547a6f))['catch'](handleError(_0x157d62,null));};exports[_0xbb43('0x46')]=function(_0x5686ee,_0x307f1e){var _0x166ab0={'raw':!![],'where':{'id':_0x5686ee[_0xbb43('0x47')]['id']}},_0x24d1ea={};_0x24d1ea['model']=_[_0xbb43('0x37')](db[_0xbb43('0x30')][_0xbb43('0x31')]);_0x24d1ea[_0xbb43('0x36')]=_[_0xbb43('0x37')](_0x5686ee[_0xbb43('0x36')]);_0x24d1ea[_0xbb43('0x3e')]=_[_0xbb43('0x38')](_0x24d1ea['model'],_0x24d1ea[_0xbb43('0x36')]);_0x166ab0[_0xbb43('0x39')]=_['intersection'](_0x24d1ea[_0xbb43('0x34')],qs['fields'](_0x5686ee['query']['fields']));_0x166ab0['attributes']=_0x166ab0[_0xbb43('0x39')]['length']?_0x166ab0[_0xbb43('0x39')]:_0x24d1ea['model'];if(_0x5686ee[_0xbb43('0x36')][_0xbb43('0x42')]){_0x166ab0[_0xbb43('0x48')]=[{'all':!![]}];}_0x166ab0=_['merge']({},_0x166ab0,_0x5686ee[_0xbb43('0x49')]);return db['FaxQueueReport'][_0xbb43('0x4a')](_0x166ab0)[_0xbb43('0x44')](handleEntityNotFound(_0x307f1e,null))[_0xbb43('0x44')](respondWithResult(_0x307f1e,null))[_0xbb43('0x4b')](handleError(_0x307f1e,null));};exports[_0xbb43('0x4c')]=function(_0x13d0a5,_0x37d8d3){return db['FaxQueueReport'][_0xbb43('0x4c')](_0x13d0a5[_0xbb43('0x4d')],{})[_0xbb43('0x44')](respondWithResult(_0x37d8d3,0xc9))[_0xbb43('0x4b')](handleError(_0x37d8d3,null));};exports['update']=function(_0x46a4af,_0x3233b7){if(_0x46a4af[_0xbb43('0x4d')]['id']){delete _0x46a4af[_0xbb43('0x4d')]['id'];}return db['FaxQueueReport'][_0xbb43('0x4a')]({'where':{'id':_0x46a4af[_0xbb43('0x47')]['id']}})[_0xbb43('0x44')](handleEntityNotFound(_0x3233b7,null))['then'](saveUpdates(_0x46a4af[_0xbb43('0x4d')],null))[_0xbb43('0x44')](respondWithResult(_0x3233b7,null))[_0xbb43('0x4b')](handleError(_0x3233b7,null));};exports[_0xbb43('0x24')]=function(_0x3402f2,_0x59c805){return db['FaxQueueReport'][_0xbb43('0x4a')]({'where':{'id':_0x3402f2['params']['id']}})[_0xbb43('0x44')](handleEntityNotFound(_0x59c805,null))[_0xbb43('0x44')](removeEntity(_0x59c805,null))['catch'](handleError(_0x59c805,null));};exports[_0xbb43('0x4e')]=function(_0x3719dc,_0x39dc59){return db[_0xbb43('0x30')][_0xbb43('0x4e')]()['then'](respondWithResult(_0x39dc59,null))[_0xbb43('0x4b')](handleError(_0x39dc59,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 32de68b..0b8ccdd 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 _0x0ab1=['bluebird','request-promise','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','util','../../config/logger','api'];(function(_0x2d4132,_0x16e982){var _0x4a0a1b=function(_0x5ed24d){while(--_0x5ed24d){_0x2d4132['push'](_0x2d4132['shift']());}};_0x4a0a1b(++_0x16e982);}(_0x0ab1,0x65));var _0x10ab=function(_0x3b448b,_0x3afe76){_0x3b448b=_0x3b448b-0x0;var _0x431f6f=_0x0ab1[_0x3b448b];return _0x431f6f;};'use strict';var _=require('lodash');var util=require(_0x10ab('0x0'));var logger=require(_0x10ab('0x1'))(_0x10ab('0x2'));var moment=require('moment');var BPromise=require(_0x10ab('0x3'));var rp=require(_0x10ab('0x4'));var fs=require('fs');var path=require(_0x10ab('0x5'));var rimraf=require(_0x10ab('0x6'));var config=require('../../config/environment');var attributes=require(_0x10ab('0x7'));module[_0x10ab('0x8')]=function(_0x59236b,_0x6f44cc){return _0x59236b[_0x10ab('0x9')](_0x10ab('0xa'),attributes,{'tableName':_0x10ab('0xb'),'paranoid':![],'indexes':[{'name':_0x10ab('0xc'),'fields':[_0x10ab('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6c8=['define','report_fax_queue','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxQueueReport.attributes','exports'];(function(_0x38831d,_0x17019c){var _0x3078d0=function(_0x253624){while(--_0x253624){_0x38831d['push'](_0x38831d['shift']());}};_0x3078d0(++_0x17019c);}(_0xc6c8,0x1cb));var _0x8c6c=function(_0x5e3934,_0xa6783b){_0x5e3934=_0x5e3934-0x0;var _0x127530=_0xc6c8[_0x5e3934];return _0x127530;};'use strict';var _=require(_0x8c6c('0x0'));var util=require('util');var logger=require(_0x8c6c('0x1'))(_0x8c6c('0x2'));var moment=require('moment');var BPromise=require(_0x8c6c('0x3'));var rp=require(_0x8c6c('0x4'));var fs=require('fs');var path=require(_0x8c6c('0x5'));var rimraf=require(_0x8c6c('0x6'));var config=require('../../config/environment');var attributes=require(_0x8c6c('0x7'));module[_0x8c6c('0x8')]=function(_0x37dc8e,_0x313320){return _0x37dc8e[_0x8c6c('0x9')]('FaxQueueReport',attributes,{'tableName':_0x8c6c('0xa'),'paranoid':![],'indexes':[{'name':_0x8c6c('0xb'),'fields':[_0x8c6c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 948ee23..793decc 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 _0x3db3=['raw','UpdateFaxQueueReport','update','body','options','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','FaxQueueReport,\x20%s,\x20%s','CreateFaxQueueReport','FaxQueueReport','create'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3db3,0x131));var _0x33db=function(_0x192739,_0x524bbc){_0x192739=_0x192739-0x0;var _0x478c95=_0x3db3[_0x192739];return _0x478c95;};'use strict';var _=require(_0x33db('0x0'));var util=require('util');var moment=require(_0x33db('0x1'));var BPromise=require(_0x33db('0x2'));var rs=require(_0x33db('0x3'));var fs=require('fs');var Redis=require(_0x33db('0x4'));var db=require(_0x33db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x33db('0x6'));var jayson=require(_0x33db('0x7'));var client=jayson[_0x33db('0x8')][_0x33db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a4268,_0x1a7cfd,_0x360d73){return new BPromise(function(_0x42cd52,_0x10ab13){return client[_0x33db('0xa')](_0x5a4268,_0x360d73)[_0x33db('0xb')](function(_0x4718fa){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1a7cfd,'request\x20sent');logger[_0x33db('0xc')](_0x33db('0xd'),_0x1a7cfd,'request\x20sent',JSON[_0x33db('0xe')](_0x4718fa));if(_0x4718fa[_0x33db('0xf')]){if(_0x4718fa['error'][_0x33db('0x10')]===0x1f4){logger[_0x33db('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x1a7cfd,_0x4718fa[_0x33db('0xf')][_0x33db('0x11')]);return _0x10ab13(_0x4718fa[_0x33db('0xf')][_0x33db('0x11')]);}logger[_0x33db('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x1a7cfd,_0x4718fa[_0x33db('0xf')][_0x33db('0x11')]);return _0x42cd52(_0x4718fa[_0x33db('0xf')][_0x33db('0x11')]);}else{logger[_0x33db('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x1a7cfd,_0x33db('0x13'));_0x42cd52(_0x4718fa['result'][_0x33db('0x11')]);}})[_0x33db('0x14')](function(_0x200318){logger[_0x33db('0xf')](_0x33db('0x15'),_0x1a7cfd,_0x200318);_0x10ab13(_0x200318);});});}exports[_0x33db('0x16')]=function(_0x4a47a0){var _0x1d30d3=this;return new Promise(function(_0x5328d0,_0x1ec2ea){return db[_0x33db('0x17')][_0x33db('0x18')](_0x4a47a0['body'],{'raw':_0x4a47a0['options']?_0x4a47a0['options'][_0x33db('0x19')]===undefined?!![]:![]:!![]})[_0x33db('0xb')](function(_0x177d25){logger['info'](_0x33db('0x16'),_0x4a47a0);logger[_0x33db('0xc')](_0x33db('0x16'),_0x4a47a0,JSON[_0x33db('0xe')](_0x177d25));_0x5328d0(_0x177d25);})[_0x33db('0x14')](function(_0x359a5f){logger['error'](_0x33db('0x16'),_0x359a5f[_0x33db('0x11')],_0x4a47a0);_0x1ec2ea(_0x1d30d3[_0x33db('0xf')](0x1f4,_0x359a5f['message']));});});};exports[_0x33db('0x1a')]=function(_0x557148){var _0x341476=this;return new Promise(function(_0x472469,_0x2efc2a){return db['FaxQueueReport'][_0x33db('0x1b')](_0x557148[_0x33db('0x1c')],{'raw':_0x557148['options']?_0x557148[_0x33db('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x557148[_0x33db('0x1d')]?_0x557148[_0x33db('0x1d')][_0x33db('0x1e')]||null:null,'attributes':_0x557148[_0x33db('0x1d')]?_0x557148[_0x33db('0x1d')][_0x33db('0x1f')]||null:null,'limit':_0x557148['options']?_0x557148[_0x33db('0x1d')][_0x33db('0x20')]||null:null})[_0x33db('0xb')](function(_0x3a50bc){logger['info'](_0x33db('0x1a'),_0x557148);logger['debug'](_0x33db('0x1a'),_0x557148,JSON[_0x33db('0xe')](_0x3a50bc));_0x472469(_0x3a50bc);})['catch'](function(_0x29d97a){logger[_0x33db('0xf')](_0x33db('0x1a'),_0x29d97a['message'],_0x557148);_0x2efc2a(_0x341476['error'](0x1f4,_0x29d97a[_0x33db('0x11')]));});});}; \ No newline at end of file +var _0x6bdb=['limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','attributes'];(function(_0x3ccdbe,_0xabd011){var _0x3d6e09=function(_0x28fac5){while(--_0x28fac5){_0x3ccdbe['push'](_0x3ccdbe['shift']());}};_0x3d6e09(++_0xabd011);}(_0x6bdb,0x8a));var _0xb6bd=function(_0x58f0d1,_0x3fefda){_0x58f0d1=_0x58f0d1-0x0;var _0x181a18=_0x6bdb[_0x58f0d1];return _0x181a18;};'use strict';var _=require(_0xb6bd('0x0'));var util=require(_0xb6bd('0x1'));var moment=require(_0xb6bd('0x2'));var BPromise=require(_0xb6bd('0x3'));var rs=require(_0xb6bd('0x4'));var fs=require('fs');var Redis=require(_0xb6bd('0x5'));var db=require(_0xb6bd('0x6'))['db'];var utils=require(_0xb6bd('0x7'));var logger=require(_0xb6bd('0x8'))('rpc');var config=require(_0xb6bd('0x9'));var jayson=require(_0xb6bd('0xa'));var client=jayson['client'][_0xb6bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x550dd0,_0x1061e1,_0x12bff2){return new BPromise(function(_0x4811b2,_0x17a8ab){return client['request'](_0x550dd0,_0x12bff2)[_0xb6bd('0xc')](function(_0x4a8ecb){logger[_0xb6bd('0xd')](_0xb6bd('0xe'),_0x1061e1,_0xb6bd('0xf'));logger['debug'](_0xb6bd('0x10'),_0x1061e1,_0xb6bd('0xf'),JSON[_0xb6bd('0x11')](_0x4a8ecb));if(_0x4a8ecb[_0xb6bd('0x12')]){if(_0x4a8ecb[_0xb6bd('0x12')][_0xb6bd('0x13')]===0x1f4){logger[_0xb6bd('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x1061e1,_0x4a8ecb[_0xb6bd('0x12')]['message']);return _0x17a8ab(_0x4a8ecb['error'][_0xb6bd('0x14')]);}logger[_0xb6bd('0x12')](_0xb6bd('0xe'),_0x1061e1,_0x4a8ecb[_0xb6bd('0x12')][_0xb6bd('0x14')]);return _0x4811b2(_0x4a8ecb[_0xb6bd('0x12')]['message']);}else{logger[_0xb6bd('0xd')](_0xb6bd('0xe'),_0x1061e1,'request\x20sent');_0x4811b2(_0x4a8ecb[_0xb6bd('0x15')][_0xb6bd('0x14')]);}})[_0xb6bd('0x16')](function(_0x44f79c){logger[_0xb6bd('0x12')](_0xb6bd('0xe'),_0x1061e1,_0x44f79c);_0x17a8ab(_0x44f79c);});});}exports[_0xb6bd('0x17')]=function(_0x44b128){var _0x8afd54=this;return new Promise(function(_0x1547bc,_0x300aa4){return db['FaxQueueReport'][_0xb6bd('0x18')](_0x44b128[_0xb6bd('0x19')],{'raw':_0x44b128[_0xb6bd('0x1a')]?_0x44b128[_0xb6bd('0x1a')][_0xb6bd('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1b2822){logger[_0xb6bd('0xd')](_0xb6bd('0x17'),_0x44b128);logger['debug'](_0xb6bd('0x17'),_0x44b128,JSON['stringify'](_0x1b2822));_0x1547bc(_0x1b2822);})[_0xb6bd('0x16')](function(_0x57ce9a){logger['error'](_0xb6bd('0x17'),_0x57ce9a[_0xb6bd('0x14')],_0x44b128);_0x300aa4(_0x8afd54[_0xb6bd('0x12')](0x1f4,_0x57ce9a[_0xb6bd('0x14')]));});});};exports[_0xb6bd('0x1c')]=function(_0x36d51b){var _0x12b356=this;return new Promise(function(_0x14b32e,_0x3349cf){return db['FaxQueueReport'][_0xb6bd('0x1d')](_0x36d51b[_0xb6bd('0x19')],{'raw':_0x36d51b[_0xb6bd('0x1a')]?_0x36d51b['options'][_0xb6bd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d51b[_0xb6bd('0x1a')]?_0x36d51b[_0xb6bd('0x1a')][_0xb6bd('0x1e')]||null:null,'attributes':_0x36d51b[_0xb6bd('0x1a')]?_0x36d51b[_0xb6bd('0x1a')][_0xb6bd('0x1f')]||null:null,'limit':_0x36d51b['options']?_0x36d51b[_0xb6bd('0x1a')][_0xb6bd('0x20')]||null:null})[_0xb6bd('0xc')](function(_0x11272a){logger['info'](_0xb6bd('0x1c'),_0x36d51b);logger[_0xb6bd('0x21')](_0xb6bd('0x1c'),_0x36d51b,JSON[_0xb6bd('0x11')](_0x11272a));_0x14b32e(_0x11272a);})[_0xb6bd('0x16')](function(_0x45b588){logger[_0xb6bd('0x12')]('UpdateFaxQueueReport',_0x45b588['message'],_0x36d51b);_0x3349cf(_0x12b356[_0xb6bd('0x12')](0x1f4,_0x45b588[_0xb6bd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ff6001f..b71ed55 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 _0x02dd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x373e40,_0x5ead8e){var _0x4a7b50=function(_0x44ce55){while(--_0x44ce55){_0x373e40['push'](_0x373e40['shift']());}};_0x4a7b50(++_0x5ead8e);}(_0x02dd,0x9e));var _0xd02d=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x02dd[_0x2dea24];return _0x309d58;};'use strict';var multer=require(_0xd02d('0x0'));var util=require(_0xd02d('0x1'));var path=require(_0xd02d('0x2'));var timeout=require(_0xd02d('0x3'));var express=require(_0xd02d('0x4'));var router=express[_0xd02d('0x5')]();var fs_extra=require(_0xd02d('0x6'));var auth=require(_0xd02d('0x7'));var interaction=require(_0xd02d('0x8'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0xd02d('0x9')]('/',auth[_0xd02d('0xa')](),controller['index']);router[_0xd02d('0x9')]('/describe',auth[_0xd02d('0xa')](),controller[_0xd02d('0xb')]);router['get']('/:id',auth[_0xd02d('0xa')](),controller[_0xd02d('0xc')]);router[_0xd02d('0xd')]('/',auth[_0xd02d('0xa')](),controller['create']);router[_0xd02d('0xe')](_0xd02d('0xf'),auth[_0xd02d('0xa')](),controller[_0xd02d('0x10')]);router[_0xd02d('0x11')](_0xd02d('0xf'),auth[_0xd02d('0xa')](),controller[_0xd02d('0x12')]);module[_0xd02d('0x13')]=router; \ No newline at end of file +var _0x4409=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x3a6eba,_0x7db8ac){var _0x531c0a=function(_0x349132){while(--_0x349132){_0x3a6eba['push'](_0x3a6eba['shift']());}};_0x531c0a(++_0x7db8ac);}(_0x4409,0x190));var _0x9440=function(_0x1c5613,_0x1e8c34){_0x1c5613=_0x1c5613-0x0;var _0x537079=_0x4409[_0x1c5613];return _0x537079;};'use strict';var multer=require('multer');var util=require(_0x9440('0x0'));var path=require(_0x9440('0x1'));var timeout=require('connect-timeout');var express=require(_0x9440('0x2'));var router=express[_0x9440('0x3')]();var fs_extra=require(_0x9440('0x4'));var auth=require(_0x9440('0x5'));var interaction=require(_0x9440('0x6'));var config=require(_0x9440('0x7'));var controller=require('./faxQueueReport.controller');router[_0x9440('0x8')]('/',auth[_0x9440('0x9')](),controller[_0x9440('0xa')]);router[_0x9440('0x8')](_0x9440('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x9440('0x8')](_0x9440('0xc'),auth['isAuthenticated'](),controller[_0x9440('0xd')]);router[_0x9440('0xe')]('/',auth[_0x9440('0x9')](),controller['create']);router[_0x9440('0xf')]('/:id',auth[_0x9440('0x9')](),controller[_0x9440('0x10')]);router[_0x9440('0x11')](_0x9440('0xc'),auth['isAuthenticated'](),controller[_0x9440('0x12')]);module[_0x9440('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 96bebec..37c1d9e 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 _0x1aa9=['agent','queue','NOW','moment','exports','STRING','ENUM'];(function(_0x23eacd,_0x90aac9){var _0x4adb96=function(_0x27c4d9){while(--_0x27c4d9){_0x23eacd['push'](_0x23eacd['shift']());}};_0x4adb96(++_0x90aac9);}(_0x1aa9,0x1a0));var _0x91aa=function(_0x5a3cd0,_0x40305f){_0x5a3cd0=_0x5a3cd0-0x0;var _0x1dc0f7=_0x1aa9[_0x5a3cd0];return _0x1dc0f7;};'use strict';var moment=require(_0x91aa('0x0'));var Sequelize=require('sequelize');module[_0x91aa('0x1')]={'uniqueid':{'type':Sequelize[_0x91aa('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x91aa('0x3')]('account',_0x91aa('0x4'),_0x91aa('0x5')),'allowNull':![],'defaultValue':_0x91aa('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x91aa('0x6')]}}; \ No newline at end of file +var _0xd606=['STRING','ENUM','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0xd606,0x19d));var _0x6d60=function(_0x9ddeb7,_0x281237){_0x9ddeb7=_0x9ddeb7-0x0;var _0x492447=_0xd606[_0x9ddeb7];return _0x492447;};'use strict';var moment=require(_0x6d60('0x0'));var Sequelize=require(_0x6d60('0x1'));module[_0x6d60('0x2')]={'uniqueid':{'type':Sequelize[_0x6d60('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6d60('0x4')]('account','agent','queue'),'allowNull':![],'defaultValue':_0x6d60('0x5')},'transferredAt':{'type':Sequelize[_0x6d60('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x6d60('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 11e4fe1..6e12727 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 _0x44d4=['../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','then','destroy','name','send','render','merge','body','message','interaction','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','findAll','rows','catch','show','params','length','includeAll','include','create','update','find','describe','eml-format','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x44d4,0x161));var _0x444d=function(_0x34c019,_0x2e7ab5){_0x34c019=_0x34c019-0x0;var _0x54eab2=_0x44d4[_0x34c019];return _0x54eab2;};'use strict';var emlformat=require(_0x444d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x444d('0x1'));var moment=require(_0x444d('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x444d('0x3'));var sox=require(_0x444d('0x4'));var csv=require(_0x444d('0x5'));var ejs=require(_0x444d('0x6'));var fs=require('fs');var fs_extra=require(_0x444d('0x7'));var _=require(_0x444d('0x8'));var squel=require(_0x444d('0x9'));var crypto=require('crypto');var jsforce=require(_0x444d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x444d('0x5'));var querystring=require(_0x444d('0xb'));var Papa=require(_0x444d('0xc'));var Redis=require(_0x444d('0xd'));var authService=require(_0x444d('0xe'));var qs=require(_0x444d('0xf'));var as=require(_0x444d('0x10'));var hardwareService=require(_0x444d('0x11'));var logger=require(_0x444d('0x12'))(_0x444d('0x13'));var utils=require(_0x444d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x444d('0x15'));var db=require(_0x444d('0x16'))['db'];function respondWithStatusCode(_0x4a997f,_0x11db08){_0x11db08=_0x11db08||0xcc;return function(_0x3a2d03){if(_0x3a2d03){return _0x4a997f[_0x444d('0x17')](_0x11db08);}return _0x4a997f['status'](_0x11db08)[_0x444d('0x18')]();};}function respondWithResult(_0x41b794,_0x390231){_0x390231=_0x390231||0xc8;return function(_0x545a4b){if(_0x545a4b){return _0x41b794[_0x444d('0x19')](_0x390231)['json'](_0x545a4b);}};}function respondWithFilteredResult(_0x40bdbb,_0x43210d){return function(_0x21cbb0){if(_0x21cbb0){var _0x1bd5db=typeof _0x43210d['offset']==='undefined'&&typeof _0x43210d['limit']==='undefined';var _0x1a0e21=_0x21cbb0[_0x444d('0x1a')];var _0x171c35=_0x1bd5db?0x0:_0x43210d['offset'];var _0x54e12a=_0x1bd5db?_0x21cbb0[_0x444d('0x1a')]:_0x43210d[_0x444d('0x1b')]+_0x43210d[_0x444d('0x1c')];var _0x42b26d;if(_0x54e12a>=_0x1a0e21){_0x54e12a=_0x1a0e21;_0x42b26d=0xc8;}else{_0x42b26d=0xce;}_0x40bdbb[_0x444d('0x19')](_0x42b26d);return _0x40bdbb['set'](_0x444d('0x1d'),_0x171c35+'-'+_0x54e12a+'/'+_0x1a0e21)[_0x444d('0x1e')](_0x21cbb0);}return null;};}function patchUpdates(_0x2c0e2a){return function(_0x3bac2f){try{jsonpatch[_0x444d('0x1f')](_0x3bac2f,_0x2c0e2a,!![]);}catch(_0x25e6ae){return BPromise[_0x444d('0x20')](_0x25e6ae);}return _0x3bac2f['save']();};}function saveUpdates(_0x5e071f,_0xe2cd4d){return function(_0x4ef57b){if(_0x4ef57b){return _0x4ef57b['update'](_0x5e071f)[_0x444d('0x21')](function(_0x11563d){return _0x11563d;});}return null;};}function removeEntity(_0x546a9f,_0x5bbc84){return function(_0x17cc83){if(_0x17cc83){return _0x17cc83[_0x444d('0x22')]()[_0x444d('0x21')](function(){_0x546a9f[_0x444d('0x19')](0xcc)[_0x444d('0x18')]();});}};}function handleEntityNotFound(_0x2faf9e,_0x4016b8){return function(_0x394d06){if(!_0x394d06){_0x2faf9e[_0x444d('0x17')](0x194);}return _0x394d06;};}function handleError(_0x49c2fd,_0x5b8f14){_0x5b8f14=_0x5b8f14||0x1f4;return function(_0x240c32){logger['error'](_0x240c32['stack']);if(_0x240c32[_0x444d('0x23')]){delete _0x240c32['name'];}_0x49c2fd[_0x444d('0x19')](_0x5b8f14)[_0x444d('0x24')](_0x240c32);};}function getMustacheRender(_0x5eaf02,_0x1f6a96){return Mustache[_0x444d('0x25')](_0x5eaf02,_[_0x444d('0x26')](_0x1f6a96[_0x444d('0x27')],{'contact':_0x1f6a96['contact'],'message':_0x1f6a96[_0x444d('0x28')],'agent':_0x1f6a96['agent'],'interaction':_0x1f6a96[_0x444d('0x29')],'account':_0x1f6a96['account']}))||'';}exports[_0x444d('0x2a')]=function(_0xa8aadc,_0x2dfad8){var _0x17c3b7={},_0x122516={},_0x54a841={'count':0x0,'rows':[]};var _0xe781aa=_[_0x444d('0x2b')](db[_0x444d('0x2c')][_0x444d('0x2d')],function(_0x418512){return{'name':_0x418512[_0x444d('0x2e')],'type':_0x418512[_0x444d('0x2f')][_0x444d('0x30')]};});_0x122516[_0x444d('0x31')]=_['map'](_0xe781aa,'name');_0x122516[_0x444d('0x32')]=_[_0x444d('0x33')](_0xa8aadc['query']);_0x122516[_0x444d('0x34')]=_[_0x444d('0x35')](_0x122516[_0x444d('0x31')],_0x122516[_0x444d('0x32')]);_0x17c3b7[_0x444d('0x36')]=_['intersection'](_0x122516['model'],qs['fields'](_0xa8aadc[_0x444d('0x32')][_0x444d('0x37')]));_0x17c3b7['attributes']=_0x17c3b7[_0x444d('0x36')]['length']?_0x17c3b7[_0x444d('0x36')]:_0x122516[_0x444d('0x31')];if(!_0xa8aadc[_0x444d('0x32')][_0x444d('0x38')](_0x444d('0x39'))){_0x17c3b7['limit']=qs['limit'](_0xa8aadc[_0x444d('0x32')][_0x444d('0x1c')]);_0x17c3b7[_0x444d('0x1b')]=qs[_0x444d('0x1b')](_0xa8aadc[_0x444d('0x32')][_0x444d('0x1b')]);}_0x17c3b7[_0x444d('0x3a')]=qs['sort'](_0xa8aadc[_0x444d('0x32')][_0x444d('0x3b')]);_0x17c3b7['where']=qs['filters'](_[_0x444d('0x3c')](_0xa8aadc[_0x444d('0x32')],_0x122516['filters']),_0xe781aa);if(_0xa8aadc[_0x444d('0x32')][_0x444d('0x3d')]){_0x17c3b7[_0x444d('0x3e')]=_[_0x444d('0x26')](_0x17c3b7['where'],{'$or':_['map'](_0xe781aa,function(_0x57d0b8){if(_0x57d0b8[_0x444d('0x2f')]!=='VIRTUAL'){var _0x136056={};_0x136056[_0x57d0b8[_0x444d('0x23')]]={'$like':'%'+_0xa8aadc['query'][_0x444d('0x3d')]+'%'};return _0x136056;}})});}_0x17c3b7=_[_0x444d('0x26')]({},_0x17c3b7,_0xa8aadc['options']);var _0x168b1d={'where':_0x17c3b7[_0x444d('0x3e')]};return db[_0x444d('0x2c')][_0x444d('0x1a')](_0x168b1d)[_0x444d('0x21')](function(_0xf6ae89){_0x54a841[_0x444d('0x1a')]=_0xf6ae89;if(_0xa8aadc[_0x444d('0x32')]['includeAll']){_0x17c3b7['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x444d('0x3f')](_0x17c3b7);})[_0x444d('0x21')](function(_0x2d8359){_0x54a841[_0x444d('0x40')]=_0x2d8359;return _0x54a841;})['then'](respondWithFilteredResult(_0x2dfad8,_0x17c3b7))[_0x444d('0x41')](handleError(_0x2dfad8,null));};exports[_0x444d('0x42')]=function(_0x852d09,_0x48b4ca){var _0x183f5b={'raw':!![],'where':{'id':_0x852d09[_0x444d('0x43')]['id']}},_0x4d86a5={};_0x4d86a5[_0x444d('0x31')]=_[_0x444d('0x33')](db[_0x444d('0x2c')]['rawAttributes']);_0x4d86a5[_0x444d('0x32')]=_[_0x444d('0x33')](_0x852d09[_0x444d('0x32')]);_0x4d86a5[_0x444d('0x34')]=_[_0x444d('0x35')](_0x4d86a5[_0x444d('0x31')],_0x4d86a5[_0x444d('0x32')]);_0x183f5b[_0x444d('0x36')]=_[_0x444d('0x35')](_0x4d86a5[_0x444d('0x31')],qs[_0x444d('0x37')](_0x852d09[_0x444d('0x32')][_0x444d('0x37')]));_0x183f5b[_0x444d('0x36')]=_0x183f5b[_0x444d('0x36')][_0x444d('0x44')]?_0x183f5b[_0x444d('0x36')]:_0x4d86a5['model'];if(_0x852d09['query'][_0x444d('0x45')]){_0x183f5b[_0x444d('0x46')]=[{'all':!![]}];}_0x183f5b=_[_0x444d('0x26')]({},_0x183f5b,_0x852d09['options']);return db['FaxTransferReport']['find'](_0x183f5b)[_0x444d('0x21')](handleEntityNotFound(_0x48b4ca,null))[_0x444d('0x21')](respondWithResult(_0x48b4ca,null))[_0x444d('0x41')](handleError(_0x48b4ca,null));};exports[_0x444d('0x47')]=function(_0x3af9b9,_0x2b0572){return db[_0x444d('0x2c')][_0x444d('0x47')](_0x3af9b9[_0x444d('0x27')],{})[_0x444d('0x21')](respondWithResult(_0x2b0572,0xc9))[_0x444d('0x41')](handleError(_0x2b0572,null));};exports[_0x444d('0x48')]=function(_0x5486a6,_0x5298b7){if(_0x5486a6['body']['id']){delete _0x5486a6[_0x444d('0x27')]['id'];}return db[_0x444d('0x2c')]['find']({'where':{'id':_0x5486a6[_0x444d('0x43')]['id']}})[_0x444d('0x21')](handleEntityNotFound(_0x5298b7,null))[_0x444d('0x21')](saveUpdates(_0x5486a6['body'],null))['then'](respondWithResult(_0x5298b7,null))[_0x444d('0x41')](handleError(_0x5298b7,null));};exports[_0x444d('0x22')]=function(_0x2b3525,_0x4c3962){return db[_0x444d('0x2c')][_0x444d('0x49')]({'where':{'id':_0x2b3525[_0x444d('0x43')]['id']}})[_0x444d('0x21')](handleEntityNotFound(_0x4c3962,null))[_0x444d('0x21')](removeEntity(_0x4c3962,null))[_0x444d('0x41')](handleError(_0x4c3962,null));};exports['describe']=function(_0x37a11a,_0x527474){return db['FaxTransferReport'][_0x444d('0x4a')]()['then'](respondWithResult(_0x527474,null))[_0x444d('0x41')](handleError(_0x527474,null));}; \ No newline at end of file +var _0x8ccb=['destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','save','update','then','error','stack','send','merge','body','contact','message','interaction','account','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','name','filter','FaxTransferReport','includeAll','include','findAll','rows','show','params','find','catch','create'];(function(_0x4127dc,_0x5558fe){var _0x310070=function(_0x190691){while(--_0x190691){_0x4127dc['push'](_0x4127dc['shift']());}};_0x310070(++_0x5558fe);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0x8ccb[_0x424357];return _0x29c68e;};'use strict';var emlformat=require(_0xb8cc('0x0'));var rimraf=require(_0xb8cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8cc('0x2'));var rp=require(_0xb8cc('0x3'));var moment=require(_0xb8cc('0x4'));var BPromise=require(_0xb8cc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb8cc('0x6'));var sox=require(_0xb8cc('0x7'));var csv=require(_0xb8cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb8cc('0x9'));var _=require(_0xb8cc('0xa'));var squel=require(_0xb8cc('0xb'));var crypto=require('crypto');var jsforce=require(_0xb8cc('0xc'));var deskjs=require(_0xb8cc('0xd'));var toCsv=require(_0xb8cc('0x8'));var querystring=require('querystring');var Papa=require(_0xb8cc('0xe'));var Redis=require(_0xb8cc('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb8cc('0x10'));var hardwareService=require(_0xb8cc('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb8cc('0x12'));var config=require(_0xb8cc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb8cc('0x14'))['db'];function respondWithStatusCode(_0x2c1cbc,_0xfd89e0){_0xfd89e0=_0xfd89e0||0xcc;return function(_0x2875e0){if(_0x2875e0){return _0x2c1cbc[_0xb8cc('0x15')](_0xfd89e0);}return _0x2c1cbc[_0xb8cc('0x16')](_0xfd89e0)[_0xb8cc('0x17')]();};}function respondWithResult(_0x4983ae,_0x11ecf2){_0x11ecf2=_0x11ecf2||0xc8;return function(_0x5ec8a7){if(_0x5ec8a7){return _0x4983ae[_0xb8cc('0x16')](_0x11ecf2)[_0xb8cc('0x18')](_0x5ec8a7);}};}function respondWithFilteredResult(_0x183056,_0x5f3b91){return function(_0x1f8b8d){if(_0x1f8b8d){var _0x274cab=typeof _0x5f3b91[_0xb8cc('0x19')]==='undefined'&&typeof _0x5f3b91[_0xb8cc('0x1a')]==='undefined';var _0x131c44=_0x1f8b8d['count'];var _0x2ac4cc=_0x274cab?0x0:_0x5f3b91[_0xb8cc('0x19')];var _0x2b7130=_0x274cab?_0x1f8b8d[_0xb8cc('0x1b')]:_0x5f3b91[_0xb8cc('0x19')]+_0x5f3b91['limit'];var _0x1c1022;if(_0x2b7130>=_0x131c44){_0x2b7130=_0x131c44;_0x1c1022=0xc8;}else{_0x1c1022=0xce;}_0x183056[_0xb8cc('0x16')](_0x1c1022);return _0x183056[_0xb8cc('0x1c')]('Content-Range',_0x2ac4cc+'-'+_0x2b7130+'/'+_0x131c44)[_0xb8cc('0x18')](_0x1f8b8d);}return null;};}function patchUpdates(_0x1a81b4){return function(_0x4a7aac){try{jsonpatch[_0xb8cc('0x1d')](_0x4a7aac,_0x1a81b4,!![]);}catch(_0xe5ad50){return BPromise['reject'](_0xe5ad50);}return _0x4a7aac[_0xb8cc('0x1e')]();};}function saveUpdates(_0xdcb33d,_0xd1c676){return function(_0x1d372c){if(_0x1d372c){return _0x1d372c[_0xb8cc('0x1f')](_0xdcb33d)[_0xb8cc('0x20')](function(_0x1a0467){return _0x1a0467;});}return null;};}function removeEntity(_0x59608c,_0x50aa38){return function(_0x8b6b21){if(_0x8b6b21){return _0x8b6b21['destroy']()[_0xb8cc('0x20')](function(){_0x59608c['status'](0xcc)[_0xb8cc('0x17')]();});}};}function handleEntityNotFound(_0xbb1918,_0x335f32){return function(_0x77a162){if(!_0x77a162){_0xbb1918['sendStatus'](0x194);}return _0x77a162;};}function handleError(_0x2c4aa0,_0x2cc7f3){_0x2cc7f3=_0x2cc7f3||0x1f4;return function(_0x400de6){logger[_0xb8cc('0x21')](_0x400de6[_0xb8cc('0x22')]);if(_0x400de6['name']){delete _0x400de6['name'];}_0x2c4aa0[_0xb8cc('0x16')](_0x2cc7f3)[_0xb8cc('0x23')](_0x400de6);};}function getMustacheRender(_0x58dd4c,_0x3e4a37){return Mustache['render'](_0x58dd4c,_[_0xb8cc('0x24')](_0x3e4a37[_0xb8cc('0x25')],{'contact':_0x3e4a37[_0xb8cc('0x26')],'message':_0x3e4a37[_0xb8cc('0x27')],'agent':_0x3e4a37['agent'],'interaction':_0x3e4a37[_0xb8cc('0x28')],'account':_0x3e4a37[_0xb8cc('0x29')]}))||'';}exports[_0xb8cc('0x2a')]=function(_0x52fbb1,_0x2430dd){var _0x59e850={},_0x359ce7={},_0x5c48f3={'count':0x0,'rows':[]};var _0x1716e9=_[_0xb8cc('0x2b')](db['FaxTransferReport'][_0xb8cc('0x2c')],function(_0x25c576){return{'name':_0x25c576[_0xb8cc('0x2d')],'type':_0x25c576[_0xb8cc('0x2e')][_0xb8cc('0x2f')]};});_0x359ce7[_0xb8cc('0x30')]=_[_0xb8cc('0x2b')](_0x1716e9,'name');_0x359ce7['query']=_[_0xb8cc('0x31')](_0x52fbb1['query']);_0x359ce7[_0xb8cc('0x32')]=_['intersection'](_0x359ce7['model'],_0x359ce7[_0xb8cc('0x33')]);_0x59e850[_0xb8cc('0x34')]=_[_0xb8cc('0x35')](_0x359ce7['model'],qs[_0xb8cc('0x36')](_0x52fbb1[_0xb8cc('0x33')][_0xb8cc('0x36')]));_0x59e850[_0xb8cc('0x34')]=_0x59e850[_0xb8cc('0x34')][_0xb8cc('0x37')]?_0x59e850[_0xb8cc('0x34')]:_0x359ce7[_0xb8cc('0x30')];if(!_0x52fbb1[_0xb8cc('0x33')][_0xb8cc('0x38')](_0xb8cc('0x39'))){_0x59e850[_0xb8cc('0x1a')]=qs[_0xb8cc('0x1a')](_0x52fbb1[_0xb8cc('0x33')][_0xb8cc('0x1a')]);_0x59e850[_0xb8cc('0x19')]=qs[_0xb8cc('0x19')](_0x52fbb1[_0xb8cc('0x33')]['offset']);}_0x59e850['order']=qs[_0xb8cc('0x3a')](_0x52fbb1[_0xb8cc('0x33')][_0xb8cc('0x3a')]);_0x59e850[_0xb8cc('0x3b')]=qs[_0xb8cc('0x32')](_[_0xb8cc('0x3c')](_0x52fbb1[_0xb8cc('0x33')],_0x359ce7[_0xb8cc('0x32')]),_0x1716e9);if(_0x52fbb1[_0xb8cc('0x33')]['filter']){_0x59e850['where']=_['merge'](_0x59e850['where'],{'$or':_[_0xb8cc('0x2b')](_0x1716e9,function(_0x5a89be){if(_0x5a89be[_0xb8cc('0x2e')]!=='VIRTUAL'){var _0x361ddf={};_0x361ddf[_0x5a89be[_0xb8cc('0x3d')]]={'$like':'%'+_0x52fbb1[_0xb8cc('0x33')][_0xb8cc('0x3e')]+'%'};return _0x361ddf;}})});}_0x59e850=_[_0xb8cc('0x24')]({},_0x59e850,_0x52fbb1['options']);var _0x323351={'where':_0x59e850[_0xb8cc('0x3b')]};return db[_0xb8cc('0x3f')]['count'](_0x323351)[_0xb8cc('0x20')](function(_0x5bfba3){_0x5c48f3['count']=_0x5bfba3;if(_0x52fbb1['query'][_0xb8cc('0x40')]){_0x59e850[_0xb8cc('0x41')]=[{'all':!![]}];}return db[_0xb8cc('0x3f')][_0xb8cc('0x42')](_0x59e850);})['then'](function(_0x4ba0ae){_0x5c48f3[_0xb8cc('0x43')]=_0x4ba0ae;return _0x5c48f3;})['then'](respondWithFilteredResult(_0x2430dd,_0x59e850))['catch'](handleError(_0x2430dd,null));};exports[_0xb8cc('0x44')]=function(_0xb5ed65,_0x2aab92){var _0xe622a1={'raw':!![],'where':{'id':_0xb5ed65[_0xb8cc('0x45')]['id']}},_0x4ff971={};_0x4ff971[_0xb8cc('0x30')]=_['keys'](db[_0xb8cc('0x3f')][_0xb8cc('0x2c')]);_0x4ff971[_0xb8cc('0x33')]=_[_0xb8cc('0x31')](_0xb5ed65[_0xb8cc('0x33')]);_0x4ff971[_0xb8cc('0x32')]=_[_0xb8cc('0x35')](_0x4ff971['model'],_0x4ff971[_0xb8cc('0x33')]);_0xe622a1[_0xb8cc('0x34')]=_[_0xb8cc('0x35')](_0x4ff971[_0xb8cc('0x30')],qs[_0xb8cc('0x36')](_0xb5ed65[_0xb8cc('0x33')][_0xb8cc('0x36')]));_0xe622a1['attributes']=_0xe622a1[_0xb8cc('0x34')]['length']?_0xe622a1['attributes']:_0x4ff971['model'];if(_0xb5ed65[_0xb8cc('0x33')][_0xb8cc('0x40')]){_0xe622a1[_0xb8cc('0x41')]=[{'all':!![]}];}_0xe622a1=_[_0xb8cc('0x24')]({},_0xe622a1,_0xb5ed65['options']);return db['FaxTransferReport'][_0xb8cc('0x46')](_0xe622a1)[_0xb8cc('0x20')](handleEntityNotFound(_0x2aab92,null))[_0xb8cc('0x20')](respondWithResult(_0x2aab92,null))[_0xb8cc('0x47')](handleError(_0x2aab92,null));};exports[_0xb8cc('0x48')]=function(_0x34a8a5,_0x326038){return db[_0xb8cc('0x3f')][_0xb8cc('0x48')](_0x34a8a5[_0xb8cc('0x25')],{})['then'](respondWithResult(_0x326038,0xc9))[_0xb8cc('0x47')](handleError(_0x326038,null));};exports[_0xb8cc('0x1f')]=function(_0x3b1e24,_0x43ce0d){if(_0x3b1e24['body']['id']){delete _0x3b1e24[_0xb8cc('0x25')]['id'];}return db[_0xb8cc('0x3f')][_0xb8cc('0x46')]({'where':{'id':_0x3b1e24['params']['id']}})[_0xb8cc('0x20')](handleEntityNotFound(_0x43ce0d,null))[_0xb8cc('0x20')](saveUpdates(_0x3b1e24[_0xb8cc('0x25')],null))['then'](respondWithResult(_0x43ce0d,null))[_0xb8cc('0x47')](handleError(_0x43ce0d,null));};exports[_0xb8cc('0x49')]=function(_0x563e4f,_0xaeb76){return db[_0xb8cc('0x3f')][_0xb8cc('0x46')]({'where':{'id':_0x563e4f['params']['id']}})[_0xb8cc('0x20')](handleEntityNotFound(_0xaeb76,null))[_0xb8cc('0x20')](removeEntity(_0xaeb76,null))[_0xb8cc('0x47')](handleError(_0xaeb76,null));};exports[_0xb8cc('0x4a')]=function(_0x5a4d5b,_0x9cb35d){return db[_0xb8cc('0x3f')][_0xb8cc('0x4a')]()['then'](respondWithResult(_0x9cb35d,null))[_0xb8cc('0x47')](handleError(_0x9cb35d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 9313184..2a51f67 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 _0x675f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x2dd905,_0x13e587){var _0x46e373=function(_0x549761){while(--_0x549761){_0x2dd905['push'](_0x2dd905['shift']());}};_0x46e373(++_0x13e587);}(_0x675f,0xcf));var _0xf675=function(_0x631302,_0x3ee48d){_0x631302=_0x631302-0x0;var _0x52305f=_0x675f[_0x631302];return _0x52305f;};'use strict';var _=require(_0xf675('0x0'));var util=require(_0xf675('0x1'));var logger=require(_0xf675('0x2'))(_0xf675('0x3'));var moment=require(_0xf675('0x4'));var BPromise=require(_0xf675('0x5'));var rp=require(_0xf675('0x6'));var fs=require('fs');var path=require(_0xf675('0x7'));var rimraf=require(_0xf675('0x8'));var config=require(_0xf675('0x9'));var attributes=require(_0xf675('0xa'));module[_0xf675('0xb')]=function(_0x3d9609,_0x5ab652){return _0x3d9609[_0xf675('0xc')](_0xf675('0xd'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xf675('0xe'),'fields':[_0xf675('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x310e=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x22b4df,_0x2971f3){var _0xb778a6=function(_0x355607){while(--_0x355607){_0x22b4df['push'](_0x22b4df['shift']());}};_0xb778a6(++_0x2971f3);}(_0x310e,0x1ea));var _0xe310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x310e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe310('0x0'));var util=require(_0xe310('0x1'));var logger=require('../../config/logger')(_0xe310('0x2'));var moment=require(_0xe310('0x3'));var BPromise=require(_0xe310('0x4'));var rp=require(_0xe310('0x5'));var fs=require('fs');var path=require(_0xe310('0x6'));var rimraf=require(_0xe310('0x7'));var config=require(_0xe310('0x8'));var attributes=require(_0xe310('0x9'));module[_0xe310('0xa')]=function(_0x10ac06,_0x5da55b){return _0x10ac06['define'](_0xe310('0xb'),attributes,{'tableName':_0xe310('0xc'),'paranoid':![],'indexes':[{'name':_0xe310('0xd'),'fields':[_0xe310('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 417e876..0629ce8 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 _0x6943=['message','info','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x31ef3d,_0x14cc22){var _0x593317=function(_0x12af4a){while(--_0x12af4a){_0x31ef3d['push'](_0x31ef3d['shift']());}};_0x593317(++_0x14cc22);}(_0x6943,0x192));var _0x3694=function(_0x2e2334,_0x8ffa8b){_0x2e2334=_0x2e2334-0x0;var _0x31991c=_0x6943[_0x2e2334];return _0x31991c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3694('0x0'));var BPromise=require(_0x3694('0x1'));var rs=require(_0x3694('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3694('0x3'))['db'];var utils=require(_0x3694('0x4'));var logger=require(_0x3694('0x5'))(_0x3694('0x6'));var config=require(_0x3694('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3694('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ee229,_0x73c189,_0x4e7996){return new BPromise(function(_0x2de3b1,_0x34aed3){return client[_0x3694('0x9')](_0x2ee229,_0x4e7996)[_0x3694('0xa')](function(_0xa2f6d9){logger['info'](_0x3694('0xb'),_0x73c189,_0x3694('0xc'));logger[_0x3694('0xd')](_0x3694('0xe'),_0x73c189,_0x3694('0xc'),JSON['stringify'](_0xa2f6d9));if(_0xa2f6d9[_0x3694('0xf')]){if(_0xa2f6d9[_0x3694('0xf')]['code']===0x1f4){logger[_0x3694('0xf')](_0x3694('0xb'),_0x73c189,_0xa2f6d9[_0x3694('0xf')][_0x3694('0x10')]);return _0x34aed3(_0xa2f6d9[_0x3694('0xf')][_0x3694('0x10')]);}logger['error'](_0x3694('0xb'),_0x73c189,_0xa2f6d9[_0x3694('0xf')]['message']);return _0x2de3b1(_0xa2f6d9['error'][_0x3694('0x10')]);}else{logger[_0x3694('0x11')](_0x3694('0xb'),_0x73c189,_0x3694('0xc'));_0x2de3b1(_0xa2f6d9[_0x3694('0x12')][_0x3694('0x10')]);}})['catch'](function(_0x5291c0){logger[_0x3694('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x73c189,_0x5291c0);_0x34aed3(_0x5291c0);});});} \ No newline at end of file +var _0xa554=['stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1ff664,_0x5499f1){var _0xf59c46=function(_0x3c0d72){while(--_0x3c0d72){_0x1ff664['push'](_0x1ff664['shift']());}};_0xf59c46(++_0x5499f1);}(_0xa554,0x8a));var _0x4a55=function(_0x4fa9a1,_0x316468){_0x4fa9a1=_0x4fa9a1-0x0;var _0x696430=_0xa554[_0x4fa9a1];return _0x696430;};'use strict';var _=require(_0x4a55('0x0'));var util=require(_0x4a55('0x1'));var moment=require(_0x4a55('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a55('0x3'))['db'];var utils=require(_0x4a55('0x4'));var logger=require(_0x4a55('0x5'))('rpc');var config=require(_0x4a55('0x6'));var jayson=require(_0x4a55('0x7'));var client=jayson[_0x4a55('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5610ce,_0x29bd70,_0x174aad){return new BPromise(function(_0x19e012,_0x28342d){return client[_0x4a55('0x9')](_0x5610ce,_0x174aad)[_0x4a55('0xa')](function(_0x37f374){logger[_0x4a55('0xb')](_0x4a55('0xc'),_0x29bd70,_0x4a55('0xd'));logger[_0x4a55('0xe')](_0x4a55('0xf'),_0x29bd70,'request\x20sent',JSON[_0x4a55('0x10')](_0x37f374));if(_0x37f374['error']){if(_0x37f374[_0x4a55('0x11')][_0x4a55('0x12')]===0x1f4){logger[_0x4a55('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x29bd70,_0x37f374[_0x4a55('0x11')][_0x4a55('0x13')]);return _0x28342d(_0x37f374[_0x4a55('0x11')]['message']);}logger[_0x4a55('0x11')](_0x4a55('0xc'),_0x29bd70,_0x37f374[_0x4a55('0x11')][_0x4a55('0x13')]);return _0x19e012(_0x37f374['error']['message']);}else{logger['info'](_0x4a55('0xc'),_0x29bd70,_0x4a55('0xd'));_0x19e012(_0x37f374[_0x4a55('0x14')][_0x4a55('0x13')]);}})[_0x4a55('0x15')](function(_0xa516e2){logger[_0x4a55('0x11')](_0x4a55('0xc'),_0x29bd70,_0xa516e2);_0x28342d(_0xa516e2);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index da009b9..f44b983 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 _0x1c72=['connect-timeout','Router','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','delete','destroy','multer','util','path'];(function(_0x26764,_0x4cd1c4){var _0x813712=function(_0x423f34){while(--_0x423f34){_0x26764['push'](_0x26764['shift']());}};_0x813712(++_0x4cd1c4);}(_0x1c72,0x153));var _0x21c7=function(_0x15615d,_0x3878e3){_0x15615d=_0x15615d-0x0;var _0xbb1987=_0x1c72[_0x15615d];return _0xbb1987;};'use strict';var multer=require(_0x21c7('0x0'));var util=require(_0x21c7('0x1'));var path=require(_0x21c7('0x2'));var timeout=require(_0x21c7('0x3'));var express=require('express');var router=express[_0x21c7('0x4')]();var fs_extra=require(_0x21c7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x21c7('0x6'));var controller=require('./faxTransferReport.controller');router[_0x21c7('0x7')]('/',auth['isAuthenticated'](),controller[_0x21c7('0x8')]);router['get'](_0x21c7('0x9'),auth[_0x21c7('0xa')](),controller[_0x21c7('0xb')]);router['get'](_0x21c7('0xc'),auth[_0x21c7('0xa')](),controller['show']);router['post']('/',auth[_0x21c7('0xa')](),controller[_0x21c7('0xd')]);router[_0x21c7('0xe')](_0x21c7('0xc'),auth[_0x21c7('0xa')](),controller[_0x21c7('0xf')]);router[_0x21c7('0x10')](_0x21c7('0xc'),auth[_0x21c7('0xa')](),controller[_0x21c7('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe485=['isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe485,0x64));var _0x5e48=function(_0x196fc8,_0x11f463){_0x196fc8=_0x196fc8-0x0;var _0x348a08=_0xe485[_0x196fc8];return _0x348a08;};'use strict';var multer=require(_0x5e48('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5e48('0x1'));var express=require(_0x5e48('0x2'));var router=express['Router']();var fs_extra=require(_0x5e48('0x3'));var auth=require(_0x5e48('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5e48('0x5'));var controller=require(_0x5e48('0x6'));router[_0x5e48('0x7')]('/',auth[_0x5e48('0x8')](),controller[_0x5e48('0x9')]);router[_0x5e48('0x7')](_0x5e48('0xa'),auth['isAuthenticated'](),controller[_0x5e48('0xb')]);router[_0x5e48('0x7')](_0x5e48('0xc'),auth[_0x5e48('0x8')](),controller[_0x5e48('0xd')]);router[_0x5e48('0xe')]('/',auth[_0x5e48('0x8')](),controller['create']);router['put'](_0x5e48('0xc'),auth[_0x5e48('0x8')](),controller[_0x5e48('0xf')]);router[_0x5e48('0x10')](_0x5e48('0xc'),auth[_0x5e48('0x8')](),controller[_0x5e48('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 428bb74..74f46dd 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 _0x3b5a=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x37bb47,_0x3f0d8b){var _0xa5e7f9=function(_0x370d09){while(--_0x370d09){_0x37bb47['push'](_0x37bb47['shift']());}};_0xa5e7f9(++_0x3f0d8b);}(_0x3b5a,0x7c));var _0xa3b5=function(_0x455afa,_0x235bfc){_0x455afa=_0x455afa-0x0;var _0x46ee43=_0x3b5a[_0x455afa];return _0x46ee43;};'use strict';var multer=require(_0xa3b5('0x0'));var util=require(_0xa3b5('0x1'));var path=require(_0xa3b5('0x2'));var timeout=require(_0xa3b5('0x3'));var express=require(_0xa3b5('0x4'));var router=express['Router']();var fs_extra=require(_0xa3b5('0x5'));var auth=require(_0xa3b5('0x6'));var interaction=require(_0xa3b5('0x7'));var config=require(_0xa3b5('0x8'));var controller=require(_0xa3b5('0x9'));router[_0xa3b5('0xa')]('/',auth[_0xa3b5('0xb')](),controller[_0xa3b5('0xc')]);router[_0xa3b5('0xa')](_0xa3b5('0xd'),auth['isAuthenticated'](),controller[_0xa3b5('0xe')]);router['get'](_0xa3b5('0xf'),auth[_0xa3b5('0xb')](),controller[_0xa3b5('0x10')]);router[_0xa3b5('0xa')](_0xa3b5('0x11'),auth[_0xa3b5('0xb')](),controller[_0xa3b5('0x12')]);router[_0xa3b5('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa3b5('0xf'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xa3b5('0xd'),auth[_0xa3b5('0xb')](),controller['update']);router[_0xa3b5('0x14')](_0xa3b5('0xd'),auth[_0xa3b5('0xb')](),controller[_0xa3b5('0x15')]);module[_0xa3b5('0x16')]=router; \ No newline at end of file +var _0x547a=['../../components/interaction/service','index','get','/:id','isAuthenticated','show','getConfigurations','getFields','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x547a,0x77));var _0xa547=function(_0x313afc,_0x55f9aa){_0x313afc=_0x313afc-0x0;var _0x288463=_0x547a[_0x313afc];return _0x288463;};'use strict';var multer=require(_0xa547('0x0'));var util=require(_0xa547('0x1'));var path=require(_0xa547('0x2'));var timeout=require('connect-timeout');var express=require(_0xa547('0x3'));var router=express[_0xa547('0x4')]();var fs_extra=require(_0xa547('0x5'));var auth=require(_0xa547('0x6'));var interaction=require(_0xa547('0x7'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa547('0x8')]);router[_0xa547('0x9')](_0xa547('0xa'),auth[_0xa547('0xb')](),controller[_0xa547('0xc')]);router[_0xa547('0x9')]('/:id/configurations',auth[_0xa547('0xb')](),controller[_0xa547('0xd')]);router[_0xa547('0x9')]('/:id/fields',auth[_0xa547('0xb')](),controller[_0xa547('0xe')]);router[_0xa547('0xf')]('/',auth['isAuthenticated'](),controller[_0xa547('0x10')]);router[_0xa547('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xa547('0x11')](_0xa547('0xa'),auth[_0xa547('0xb')](),controller['update']);router[_0xa547('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa547('0x13')]);module[_0xa547('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 5bbe339..d769d50 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 _0xd5fc=['STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x86337d,_0x2b57c3){var _0x22b2c6=function(_0x180d16){while(--_0x180d16){_0x86337d['push'](_0x86337d['shift']());}};_0x22b2c6(++_0x2b57c3);}(_0xd5fc,0xae));var _0xcd5f=function(_0x3b7060,_0x5b145d){_0x3b7060=_0x3b7060-0x0;var _0x23dbf1=_0xd5fc[_0x3b7060];return _0x23dbf1;};'use strict';var Sequelize=require(_0xcd5f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xcd5f('0x1')]},'remoteUri':{'type':Sequelize[_0xcd5f('0x1')]},'authType':{'type':Sequelize[_0xcd5f('0x2')](_0xcd5f('0x3')),'defaultValue':_0xcd5f('0x3')},'password':{'type':Sequelize[_0xcd5f('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xcd5f('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xcd5f('0x1')]},'serverUrl':{'type':Sequelize[_0xcd5f('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0xcd5f('0x4')}}; \ No newline at end of file +var _0xfaf2=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x4ed606,_0x70ca01){var _0xf958d9=function(_0x53ae13){while(--_0x53ae13){_0x4ed606['push'](_0x4ed606['shift']());}};_0xf958d9(++_0x70ca01);}(_0xfaf2,0x169));var _0x2faf=function(_0x2090b3,_0x2ac5b2){_0x2090b3=_0x2090b3-0x0;var _0x12b57b=_0xfaf2[_0x2090b3];return _0x12b57b;};'use strict';var Sequelize=require(_0x2faf('0x0'));module[_0x2faf('0x1')]={'name':{'type':Sequelize[_0x2faf('0x2')]},'description':{'type':Sequelize[_0x2faf('0x2')]},'username':{'type':Sequelize[_0x2faf('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x2faf('0x3')](_0x2faf('0x4')),'defaultValue':_0x2faf('0x4')},'password':{'type':Sequelize[_0x2faf('0x2')]},'consumerKey':{'type':Sequelize[_0x2faf('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2faf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2faf('0x3')](_0x2faf('0x5'),_0x2faf('0x6')),'defaultValue':_0x2faf('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index bfb2b69..07380fe 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 _0xe14b=['GET','format','application/json','headers','Authorization','Basic\x20%s','%s:%s','username','base64','_embedded','entries','active','label','test','statusCode','send','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','name','render','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','DeskAccount','includeAll','findAll','rows','show','params','keys','include','find','create','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','slice','substring'];(function(_0x4e3d5e,_0x30fd9f){var _0x2b55c9=function(_0xf775e){while(--_0xf775e){_0x4e3d5e['push'](_0x4e3d5e['shift']());}};_0x2b55c9(++_0x30fd9f);}(_0xe14b,0x93));var _0xbe14=function(_0x56ae28,_0x1d6f21){_0x56ae28=_0x56ae28-0x0;var _0x2fa8b7=_0xe14b[_0x56ae28];return _0x2fa8b7;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];var integrations=require(_0xbe14('0x16'));var jayson=require(_0xbe14('0x17'));var client=jayson[_0xbe14('0x18')][_0xbe14('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x16893f,_0xa2cf72,_0x1e4826,_0x33fd54){return new BPromise(function(_0x813399,_0x530538){var _0x55b3a7=_0x33fd54||client;return _0x55b3a7[_0xbe14('0x1a')](_0x16893f,_0x1e4826)[_0xbe14('0x1b')](function(_0xf4ac9){logger[_0xbe14('0x1c')]('DeskAccount,\x20%s,\x20%s',_0xa2cf72,_0xbe14('0x1d'));logger[_0xbe14('0x1e')](_0xbe14('0x1f'),_0xa2cf72,_0xbe14('0x1d'),JSON[_0xbe14('0x20')](_0xf4ac9));if(_0xf4ac9[_0xbe14('0x21')]){if(_0xf4ac9[_0xbe14('0x21')]['code']===0x1f4){logger[_0xbe14('0x21')](_0xbe14('0x22'),_0xa2cf72,_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);return _0x530538(_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);}logger['error'](_0xbe14('0x22'),_0xa2cf72,_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);return _0x813399(_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);}else{logger['info'](_0xbe14('0x22'),_0xa2cf72,'request\x20sent');_0x813399(_0xf4ac9[_0xbe14('0x24')]['message']);}})[_0xbe14('0x25')](function(_0x4a25fa){logger[_0xbe14('0x21')](_0xbe14('0x22'),_0xa2cf72,_0x4a25fa);_0x530538(_0x4a25fa);});});}function respondWithStatusCode(_0x505dbd,_0x2da350){_0x2da350=_0x2da350||0xcc;return function(_0x4d4190){if(_0x4d4190){return _0x505dbd[_0xbe14('0x26')](_0x2da350);}return _0x505dbd['status'](_0x2da350)[_0xbe14('0x27')]();};}function respondWithResult(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xc8;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x28')](_0x1ee9c1)[_0xbe14('0x29')](_0x39cc81);}};}function respondWithFilteredResult(_0x55d001,_0x1822e0){return function(_0x1ba46a){if(_0x1ba46a){var _0x391556=typeof _0x1822e0[_0xbe14('0x2a')]==='undefined'&&typeof _0x1822e0[_0xbe14('0x2b')]===_0xbe14('0x2c');var _0x59bf34=_0x1ba46a[_0xbe14('0x2d')];var _0x3b3e84=_0x391556?0x0:_0x1822e0[_0xbe14('0x2a')];var _0x19252f=_0x391556?_0x1ba46a[_0xbe14('0x2d')]:_0x1822e0[_0xbe14('0x2a')]+_0x1822e0[_0xbe14('0x2b')];var _0x2b05cb;if(_0x19252f>=_0x59bf34){_0x19252f=_0x59bf34;_0x2b05cb=0xc8;}else{_0x2b05cb=0xce;}_0x55d001[_0xbe14('0x28')](_0x2b05cb);return _0x55d001[_0xbe14('0x2e')](_0xbe14('0x2f'),_0x3b3e84+'-'+_0x19252f+'/'+_0x59bf34)[_0xbe14('0x29')](_0x1ba46a);}return null;};}function patchUpdates(_0x39dc0a){return function(_0x10ae36){try{jsonpatch[_0xbe14('0x30')](_0x10ae36,_0x39dc0a,!![]);}catch(_0xe6feb2){return BPromise[_0xbe14('0x31')](_0xe6feb2);}return _0x10ae36[_0xbe14('0x32')]();};}function saveUpdates(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x33')](_0x29e76a)['then'](function(_0x58f8de){return _0x58f8de;});}return null;};}function removeEntity(_0x46c2d1,_0x4c1e7e){return function(_0x243524){if(_0x243524){return _0x243524[_0xbe14('0x34')]()['then'](function(){_0x46c2d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x412ad5,_0xa3d24){return function(_0x5f27b6){if(!_0x5f27b6){_0x412ad5[_0xbe14('0x26')](0x194);}return _0x5f27b6;};}function handleError(_0x1faf3e,_0x452635){_0x452635=_0x452635||0x1f4;return function(_0x1aa849){logger[_0xbe14('0x21')](_0x1aa849['stack']);if(_0x1aa849['name']){delete _0x1aa849[_0xbe14('0x35')];}_0x1faf3e['status'](_0x452635)['send'](_0x1aa849);};}function getMustacheRender(_0x5c5e9f,_0x163ef7){return Mustache[_0xbe14('0x36')](_0x5c5e9f,_[_0xbe14('0x37')](_0x163ef7[_0xbe14('0x38')],{'contact':_0x163ef7[_0xbe14('0x39')],'message':_0x163ef7[_0xbe14('0x23')],'agent':_0x163ef7[_0xbe14('0x3a')],'interaction':_0x163ef7[_0xbe14('0x3b')],'account':_0x163ef7[_0xbe14('0x3c')]}))||'';}exports[_0xbe14('0x3d')]=function(_0x41652d,_0x32c59d){var _0x539c41={},_0x4f51f8={},_0x43cdaa={'count':0x0,'rows':[]};var _0x2951e1=_[_0xbe14('0x3e')](db['DeskAccount'][_0xbe14('0x3f')],function(_0x2aa453){return{'name':_0x2aa453[_0xbe14('0x40')],'type':_0x2aa453[_0xbe14('0x41')][_0xbe14('0x42')]};});_0x4f51f8[_0xbe14('0x43')]=_[_0xbe14('0x3e')](_0x2951e1,_0xbe14('0x35'));_0x4f51f8[_0xbe14('0x44')]=_['keys'](_0x41652d[_0xbe14('0x44')]);_0x4f51f8[_0xbe14('0x45')]=_[_0xbe14('0x46')](_0x4f51f8[_0xbe14('0x43')],_0x4f51f8[_0xbe14('0x44')]);_0x539c41[_0xbe14('0x47')]=_['intersection'](_0x4f51f8[_0xbe14('0x43')],qs[_0xbe14('0x48')](_0x41652d[_0xbe14('0x44')][_0xbe14('0x48')]));_0x539c41['attributes']=_0x539c41['attributes'][_0xbe14('0x49')]?_0x539c41[_0xbe14('0x47')]:_0x4f51f8[_0xbe14('0x43')];if(!_0x41652d['query']['hasOwnProperty'](_0xbe14('0x4a'))){_0x539c41['limit']=qs['limit'](_0x41652d[_0xbe14('0x44')][_0xbe14('0x2b')]);_0x539c41[_0xbe14('0x2a')]=qs['offset'](_0x41652d['query']['offset']);}_0x539c41[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x41652d[_0xbe14('0x44')]['sort']);_0x539c41[_0xbe14('0x4d')]=qs[_0xbe14('0x45')](_[_0xbe14('0x4e')](_0x41652d[_0xbe14('0x44')],_0x4f51f8['filters']),_0x2951e1);if(_0x41652d['query'][_0xbe14('0x4f')]){_0x539c41[_0xbe14('0x4d')]=_[_0xbe14('0x37')](_0x539c41[_0xbe14('0x4d')],{'$or':_[_0xbe14('0x3e')](_0x2951e1,function(_0x4f2d95){if(_0x4f2d95['type']!==_0xbe14('0x50')){var _0x2a3623={};_0x2a3623[_0x4f2d95[_0xbe14('0x35')]]={'$like':'%'+_0x41652d[_0xbe14('0x44')]['filter']+'%'};return _0x2a3623;}})});}_0x539c41=_[_0xbe14('0x37')]({},_0x539c41,_0x41652d[_0xbe14('0x51')]);var _0x53e8ab={'where':_0x539c41[_0xbe14('0x4d')]};return db[_0xbe14('0x52')][_0xbe14('0x2d')](_0x53e8ab)[_0xbe14('0x1b')](function(_0x589dac){_0x43cdaa['count']=_0x589dac;if(_0x41652d[_0xbe14('0x44')][_0xbe14('0x53')]){_0x539c41['include']=[{'all':!![]}];}return db['DeskAccount'][_0xbe14('0x54')](_0x539c41);})[_0xbe14('0x1b')](function(_0x3f7f5b){_0x43cdaa[_0xbe14('0x55')]=_0x3f7f5b;return _0x43cdaa;})[_0xbe14('0x1b')](respondWithFilteredResult(_0x32c59d,_0x539c41))[_0xbe14('0x25')](handleError(_0x32c59d,null));};exports[_0xbe14('0x56')]=function(_0x5a4068,_0xf32e93){var _0x5f22b2={'raw':![],'where':{'id':_0x5a4068[_0xbe14('0x57')]['id']}},_0x6928f2={};_0x6928f2[_0xbe14('0x43')]=_['keys'](db[_0xbe14('0x52')][_0xbe14('0x3f')]);_0x6928f2[_0xbe14('0x44')]=_[_0xbe14('0x58')](_0x5a4068[_0xbe14('0x44')]);_0x6928f2[_0xbe14('0x45')]=_['intersection'](_0x6928f2['model'],_0x6928f2[_0xbe14('0x44')]);_0x5f22b2[_0xbe14('0x47')]=_[_0xbe14('0x46')](_0x6928f2['model'],qs['fields'](_0x5a4068[_0xbe14('0x44')][_0xbe14('0x48')]));_0x5f22b2['attributes']=_0x5f22b2[_0xbe14('0x47')][_0xbe14('0x49')]?_0x5f22b2['attributes']:_0x6928f2[_0xbe14('0x43')];if(_0x5a4068['query'][_0xbe14('0x53')]){_0x5f22b2[_0xbe14('0x59')]=[{'all':!![]}];}_0x5f22b2=_[_0xbe14('0x37')]({},_0x5f22b2,_0x5a4068['options']);return db[_0xbe14('0x52')][_0xbe14('0x5a')](_0x5f22b2)['then'](handleEntityNotFound(_0xf32e93,null))[_0xbe14('0x1b')](respondWithResult(_0xf32e93,null))[_0xbe14('0x25')](handleError(_0xf32e93,null));};exports[_0xbe14('0x5b')]=function(_0x20c48d,_0x49322f){return db['DeskAccount'][_0xbe14('0x5b')](_0x20c48d[_0xbe14('0x38')],{})[_0xbe14('0x1b')](respondWithResult(_0x49322f,0xc9))[_0xbe14('0x25')](handleError(_0x49322f,null));};exports[_0xbe14('0x33')]=function(_0x44084c,_0x1dd6c7){if(_0x44084c['body']['id']){delete _0x44084c[_0xbe14('0x38')]['id'];}return db[_0xbe14('0x52')][_0xbe14('0x5a')]({'where':{'id':_0x44084c[_0xbe14('0x57')]['id']}})[_0xbe14('0x1b')](handleEntityNotFound(_0x1dd6c7,null))[_0xbe14('0x1b')](saveUpdates(_0x44084c[_0xbe14('0x38')],null))[_0xbe14('0x1b')](respondWithResult(_0x1dd6c7,null))[_0xbe14('0x25')](handleError(_0x1dd6c7,null));};exports[_0xbe14('0x34')]=function(_0x358950,_0x4bccfc){return db['DeskAccount']['find']({'where':{'id':_0x358950[_0xbe14('0x57')]['id']}})[_0xbe14('0x1b')](handleEntityNotFound(_0x4bccfc,null))[_0xbe14('0x1b')](removeEntity(_0x4bccfc,null))[_0xbe14('0x25')](handleError(_0x4bccfc,null));};exports[_0xbe14('0x5c')]=function(_0x66ddf,_0x16ee48,_0x22bf69){var _0x31d015={};var _0x451b0b={};var _0x603816;var _0x4346e8;return db[_0xbe14('0x52')][_0xbe14('0x5d')]({'where':{'id':_0x66ddf[_0xbe14('0x57')]['id']}})[_0xbe14('0x1b')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x1b')](function(_0x2225d9){if(_0x2225d9){_0x603816=_0x2225d9;_0x451b0b[_0xbe14('0x43')]=_[_0xbe14('0x58')](db['DeskConfiguration'][_0xbe14('0x3f')]);_0x451b0b[_0xbe14('0x44')]=_[_0xbe14('0x58')](_0x66ddf[_0xbe14('0x44')]);_0x451b0b[_0xbe14('0x45')]=_[_0xbe14('0x46')](_0x451b0b[_0xbe14('0x43')],_0x451b0b[_0xbe14('0x44')]);_0x31d015[_0xbe14('0x47')]=_[_0xbe14('0x46')](_0x451b0b['model'],qs[_0xbe14('0x48')](_0x66ddf[_0xbe14('0x44')][_0xbe14('0x48')]));_0x31d015[_0xbe14('0x47')]=_0x31d015[_0xbe14('0x47')]['length']?_0x31d015[_0xbe14('0x47')]:_0x451b0b[_0xbe14('0x43')];_0x31d015[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x66ddf[_0xbe14('0x44')]['sort']);_0x31d015[_0xbe14('0x4d')]=qs[_0xbe14('0x45')](_[_0xbe14('0x4e')](_0x66ddf[_0xbe14('0x44')],_0x451b0b[_0xbe14('0x45')]));if(_0x66ddf[_0xbe14('0x44')][_0xbe14('0x4f')]){_0x31d015[_0xbe14('0x4d')]=_['merge'](_0x31d015[_0xbe14('0x4d')],{'$or':_[_0xbe14('0x3e')](_0x31d015[_0xbe14('0x47')],function(_0x20b12e){var _0x5982b7={};_0x5982b7[_0x20b12e]={'$like':'%'+_0x66ddf[_0xbe14('0x44')][_0xbe14('0x4f')]+'%'};return _0x5982b7;})});}_0x31d015=_['merge']({},_0x31d015,_0x66ddf['options']);return _0x603816[_0xbe14('0x5c')](_0x31d015);}})[_0xbe14('0x1b')](function(_0x2d2643){if(_0x2d2643){_0x4346e8=_0x2d2643[_0xbe14('0x49')];if(!_0x66ddf[_0xbe14('0x44')][_0xbe14('0x5e')](_0xbe14('0x4a'))){_0x31d015[_0xbe14('0x2b')]=qs['limit'](_0x66ddf['query'][_0xbe14('0x2b')]);_0x31d015[_0xbe14('0x2a')]=qs[_0xbe14('0x2a')](_0x66ddf['query'][_0xbe14('0x2a')]);}return _0x603816[_0xbe14('0x5c')](_0x31d015);}})[_0xbe14('0x1b')](function(_0x1797dd){if(_0x1797dd){return _0x1797dd?{'count':_0x4346e8,'rows':_0x1797dd}:null;}})[_0xbe14('0x1b')](respondWithResult(_0x16ee48,null))[_0xbe14('0x25')](handleError(_0x16ee48,null));};exports[_0xbe14('0x5f')]=function(_0x5b5c37,_0x43b817,_0x3b6ef5){if(_0x5b5c37[_0xbe14('0x38')]['id']){delete _0x5b5c37[_0xbe14('0x38')]['id'];}return db[_0xbe14('0x52')][_0xbe14('0x5d')]({'where':{'id':_0x5b5c37[_0xbe14('0x57')]['id']}})['then'](handleEntityNotFound(_0x43b817,null))[_0xbe14('0x1b')](function(_0x16b046){if(_0x16b046){_0x5b5c37[_0xbe14('0x38')][_0xbe14('0x60')]=_0x16b046['id'];_0x5b5c37[_0xbe14('0x38')][_0xbe14('0x61')]=integrations[_0xbe14('0x62')](_0x5b5c37[_0xbe14('0x38')]['channel'],_0x5b5c37[_0xbe14('0x38')][_0xbe14('0x41')]);_0x5b5c37[_0xbe14('0x38')][_0xbe14('0x63')]=integrations[_0xbe14('0x64')](_0x5b5c37[_0xbe14('0x38')]['channel'],_0x5b5c37[_0xbe14('0x38')][_0xbe14('0x41')]);return db[_0xbe14('0x65')][_0xbe14('0x5b')](_0x5b5c37['body'],{'include':[{'model':db[_0xbe14('0x66')],'as':_0xbe14('0x61')},{'model':db[_0xbe14('0x66')],'as':_0xbe14('0x63')}]});}return null;})[_0xbe14('0x1b')](respondWithResult(_0x43b817,null))[_0xbe14('0x25')](handleError(_0x43b817,null));};exports[_0xbe14('0x67')]=function(_0x55e70f,_0x70ed08,_0x589197){var _0x1fc8db=[{'name':'priority','label':_0xbe14('0x68'),'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 _0x21837c='';return db[_0xbe14('0x52')]['findOne']({'where':{'id':_0x55e70f[_0xbe14('0x57')]['id']},'attributes':['id',_0xbe14('0x69'),_0xbe14('0x6a'),'username',_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),_0xbe14('0x6e'),'tokenSecret']})[_0xbe14('0x1b')](handleEntityNotFound(_0x70ed08,null))[_0xbe14('0x1b')](function(_0x34f90b){if(_0x34f90b){_0x21837c=_0x34f90b[_0xbe14('0x69')];var _0x1dd5c0=_0x21837c[_0xbe14('0x6f')](-0x1);if(_0x1dd5c0==='/'){_0x21837c=_0x21837c[_0xbe14('0x70')](0x0,_0x21837c['lastIndexOf'](_0x1dd5c0));}var _0x2ff94c={'method':_0xbe14('0x71'),'uri':util[_0xbe14('0x72')]('%s/custom_fields',_0x21837c),'headers':{'Content-Type':_0xbe14('0x73'),'Accept':_0xbe14('0x73')},'json':!![]};if(_0x34f90b[_0xbe14('0x6a')]==='basic'){_0x2ff94c[_0xbe14('0x74')][_0xbe14('0x75')]=util['format'](_0xbe14('0x76'),new Buffer(util['format'](_0xbe14('0x77'),_0x34f90b[_0xbe14('0x78')],_0x34f90b['password']))['toString'](_0xbe14('0x79')));}return rp(_0x2ff94c)[_0xbe14('0x1b')](function(_0x29287a){return _0x1fc8db['concat'](_[_0xbe14('0x3e')](_0x29287a[_0xbe14('0x7a')][_0xbe14('0x7b')],function(_0x32c92c){return{'id':_0x32c92c['name'],'name':_0x32c92c['name'],'type':_0x32c92c[_0xbe14('0x41')],'active':_0x32c92c[_0xbe14('0x7c')],'label':_0x32c92c[_0xbe14('0x7d')],'custom':!![]};}));});}})[_0xbe14('0x1b')](function(_0x435091){return{'count':_0x435091[_0xbe14('0x49')],'rows':_0x435091};})[_0xbe14('0x1b')](respondWithResult(_0x70ed08,null))['catch'](function(_0x359091){var _0x512f3a=_0x55e70f[_0xbe14('0x44')][_0xbe14('0x7e')]?0x1f4:_0x359091[_0xbe14('0x7f')]||0x1f4;logger[_0xbe14('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0xbe14('0x67'),_0x512f3a,JSON[_0xbe14('0x20')](_0x359091));delete _0x359091[_0xbe14('0x35')];if(_0x512f3a===0x191){_0x512f3a=0x190;}_0x70ed08['status'](_0x512f3a)[_0xbe14('0x80')](_0x55e70f[_0xbe14('0x44')][_0xbe14('0x7e')]?{'message':_0xbe14('0x81'),'statusCode':_0x359091[_0xbe14('0x7f')]}:_0x359091);});}; \ No newline at end of file +var _0x7217=['tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','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','jayson/promise','client','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','render','merge','body','contact','agent','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','DeskAccount','include','findAll','show','params','includeAll','options','find','create','findOne','DeskConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerSecret'];(function(_0x2408cc,_0x394561){var _0x22174d=function(_0x3c36de){while(--_0x3c36de){_0x2408cc['push'](_0x2408cc['shift']());}};_0x22174d(++_0x394561);}(_0x7217,0x19e));var _0x7721=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7217[_0x3b5250];return _0xc844a1;};'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'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7721('0x1c'));var client=jayson[_0x7721('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x109900,_0x30da54,_0x3f01c5,_0x2e9752){return new BPromise(function(_0x5069da,_0x3cbce8){var _0x25b1c0=_0x2e9752||client;return _0x25b1c0['request'](_0x109900,_0x3f01c5)['then'](function(_0x4b183e){logger[_0x7721('0x1e')](_0x7721('0x1f'),_0x30da54,_0x7721('0x20'));logger[_0x7721('0x21')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x30da54,_0x7721('0x20'),JSON['stringify'](_0x4b183e));if(_0x4b183e[_0x7721('0x22')]){if(_0x4b183e['error'][_0x7721('0x23')]===0x1f4){logger[_0x7721('0x22')](_0x7721('0x1f'),_0x30da54,_0x4b183e[_0x7721('0x22')][_0x7721('0x24')]);return _0x3cbce8(_0x4b183e[_0x7721('0x22')][_0x7721('0x24')]);}logger[_0x7721('0x22')](_0x7721('0x1f'),_0x30da54,_0x4b183e[_0x7721('0x22')]['message']);return _0x5069da(_0x4b183e[_0x7721('0x22')][_0x7721('0x24')]);}else{logger[_0x7721('0x1e')](_0x7721('0x1f'),_0x30da54,'request\x20sent');_0x5069da(_0x4b183e[_0x7721('0x25')]['message']);}})[_0x7721('0x26')](function(_0x288e3a){logger[_0x7721('0x22')](_0x7721('0x1f'),_0x30da54,_0x288e3a);_0x3cbce8(_0x288e3a);});});}function respondWithStatusCode(_0x121cc4,_0x395b15){_0x395b15=_0x395b15||0xcc;return function(_0x2c6b7b){if(_0x2c6b7b){return _0x121cc4['sendStatus'](_0x395b15);}return _0x121cc4[_0x7721('0x27')](_0x395b15)[_0x7721('0x28')]();};}function respondWithResult(_0x125564,_0x1f67c7){_0x1f67c7=_0x1f67c7||0xc8;return function(_0x40d550){if(_0x40d550){return _0x125564[_0x7721('0x27')](_0x1f67c7)[_0x7721('0x29')](_0x40d550);}};}function respondWithFilteredResult(_0xf753f1,_0x40f367){return function(_0x52316e){if(_0x52316e){var _0x258ddf=typeof _0x40f367['offset']==='undefined'&&typeof _0x40f367[_0x7721('0x2a')]===_0x7721('0x2b');var _0x53c904=_0x52316e[_0x7721('0x2c')];var _0x1ea4d=_0x258ddf?0x0:_0x40f367[_0x7721('0x2d')];var _0xd7d703=_0x258ddf?_0x52316e[_0x7721('0x2c')]:_0x40f367['offset']+_0x40f367[_0x7721('0x2a')];var _0x2871c5;if(_0xd7d703>=_0x53c904){_0xd7d703=_0x53c904;_0x2871c5=0xc8;}else{_0x2871c5=0xce;}_0xf753f1['status'](_0x2871c5);return _0xf753f1['set'](_0x7721('0x2e'),_0x1ea4d+'-'+_0xd7d703+'/'+_0x53c904)[_0x7721('0x29')](_0x52316e);}return null;};}function patchUpdates(_0x48f329){return function(_0x46f772){try{jsonpatch[_0x7721('0x2f')](_0x46f772,_0x48f329,!![]);}catch(_0x382821){return BPromise['reject'](_0x382821);}return _0x46f772[_0x7721('0x30')]();};}function saveUpdates(_0x1ff31b,_0x1492d4){return function(_0x3f15e2){if(_0x3f15e2){return _0x3f15e2[_0x7721('0x31')](_0x1ff31b)['then'](function(_0x195ffb){return _0x195ffb;});}return null;};}function removeEntity(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(_0x5c5b33){return _0x5c5b33[_0x7721('0x32')]()[_0x7721('0x33')](function(){_0x3e4e56['status'](0xcc)[_0x7721('0x28')]();});}};}function handleEntityNotFound(_0x5ce026,_0x2d6ba0){return function(_0x326c50){if(!_0x326c50){_0x5ce026[_0x7721('0x34')](0x194);}return _0x326c50;};}function handleError(_0x1d894b,_0x1c84c0){_0x1c84c0=_0x1c84c0||0x1f4;return function(_0x13c635){logger[_0x7721('0x22')](_0x13c635[_0x7721('0x35')]);if(_0x13c635[_0x7721('0x36')]){delete _0x13c635[_0x7721('0x36')];}_0x1d894b[_0x7721('0x27')](_0x1c84c0)['send'](_0x13c635);};}function getMustacheRender(_0xd1df68,_0x5e6663){return Mustache[_0x7721('0x37')](_0xd1df68,_[_0x7721('0x38')](_0x5e6663[_0x7721('0x39')],{'contact':_0x5e6663[_0x7721('0x3a')],'message':_0x5e6663[_0x7721('0x24')],'agent':_0x5e6663[_0x7721('0x3b')],'interaction':_0x5e6663['interaction'],'account':_0x5e6663['account']}))||'';}exports['index']=function(_0x539560,_0x18001c){var _0x1b3f8d={},_0x1acc72={},_0x22ef35={'count':0x0,'rows':[]};var _0x4a90ce=_[_0x7721('0x3c')](db['DeskAccount'][_0x7721('0x3d')],function(_0x11f356){return{'name':_0x11f356['fieldName'],'type':_0x11f356[_0x7721('0x3e')][_0x7721('0x3f')]};});_0x1acc72['model']=_['map'](_0x4a90ce,_0x7721('0x36'));_0x1acc72[_0x7721('0x40')]=_[_0x7721('0x41')](_0x539560[_0x7721('0x40')]);_0x1acc72['filters']=_[_0x7721('0x42')](_0x1acc72[_0x7721('0x43')],_0x1acc72[_0x7721('0x40')]);_0x1b3f8d[_0x7721('0x44')]=_[_0x7721('0x42')](_0x1acc72['model'],qs[_0x7721('0x45')](_0x539560['query'][_0x7721('0x45')]));_0x1b3f8d['attributes']=_0x1b3f8d[_0x7721('0x44')][_0x7721('0x46')]?_0x1b3f8d[_0x7721('0x44')]:_0x1acc72['model'];if(!_0x539560[_0x7721('0x40')][_0x7721('0x47')](_0x7721('0x48'))){_0x1b3f8d['limit']=qs[_0x7721('0x2a')](_0x539560[_0x7721('0x40')][_0x7721('0x2a')]);_0x1b3f8d[_0x7721('0x2d')]=qs[_0x7721('0x2d')](_0x539560[_0x7721('0x40')][_0x7721('0x2d')]);}_0x1b3f8d['order']=qs['sort'](_0x539560[_0x7721('0x40')][_0x7721('0x49')]);_0x1b3f8d[_0x7721('0x4a')]=qs[_0x7721('0x4b')](_[_0x7721('0x4c')](_0x539560[_0x7721('0x40')],_0x1acc72[_0x7721('0x4b')]),_0x4a90ce);if(_0x539560[_0x7721('0x40')][_0x7721('0x4d')]){_0x1b3f8d[_0x7721('0x4a')]=_['merge'](_0x1b3f8d['where'],{'$or':_[_0x7721('0x3c')](_0x4a90ce,function(_0x6a4664){if(_0x6a4664[_0x7721('0x3e')]!==_0x7721('0x4e')){var _0x589e95={};_0x589e95[_0x6a4664[_0x7721('0x36')]]={'$like':'%'+_0x539560[_0x7721('0x40')]['filter']+'%'};return _0x589e95;}})});}_0x1b3f8d=_[_0x7721('0x38')]({},_0x1b3f8d,_0x539560['options']);var _0x2682b1={'where':_0x1b3f8d['where']};return db[_0x7721('0x4f')][_0x7721('0x2c')](_0x2682b1)[_0x7721('0x33')](function(_0x4eda58){_0x22ef35[_0x7721('0x2c')]=_0x4eda58;if(_0x539560[_0x7721('0x40')]['includeAll']){_0x1b3f8d[_0x7721('0x50')]=[{'all':!![]}];}return db[_0x7721('0x4f')][_0x7721('0x51')](_0x1b3f8d);})['then'](function(_0x20ba21){_0x22ef35['rows']=_0x20ba21;return _0x22ef35;})[_0x7721('0x33')](respondWithFilteredResult(_0x18001c,_0x1b3f8d))[_0x7721('0x26')](handleError(_0x18001c,null));};exports[_0x7721('0x52')]=function(_0x443503,_0x1c95d8){var _0x7de310={'raw':![],'where':{'id':_0x443503[_0x7721('0x53')]['id']}},_0x163a23={};_0x163a23[_0x7721('0x43')]=_[_0x7721('0x41')](db[_0x7721('0x4f')][_0x7721('0x3d')]);_0x163a23[_0x7721('0x40')]=_[_0x7721('0x41')](_0x443503[_0x7721('0x40')]);_0x163a23['filters']=_[_0x7721('0x42')](_0x163a23[_0x7721('0x43')],_0x163a23[_0x7721('0x40')]);_0x7de310[_0x7721('0x44')]=_[_0x7721('0x42')](_0x163a23[_0x7721('0x43')],qs[_0x7721('0x45')](_0x443503['query'][_0x7721('0x45')]));_0x7de310[_0x7721('0x44')]=_0x7de310[_0x7721('0x44')][_0x7721('0x46')]?_0x7de310[_0x7721('0x44')]:_0x163a23[_0x7721('0x43')];if(_0x443503[_0x7721('0x40')][_0x7721('0x54')]){_0x7de310[_0x7721('0x50')]=[{'all':!![]}];}_0x7de310=_[_0x7721('0x38')]({},_0x7de310,_0x443503[_0x7721('0x55')]);return db['DeskAccount'][_0x7721('0x56')](_0x7de310)[_0x7721('0x33')](handleEntityNotFound(_0x1c95d8,null))[_0x7721('0x33')](respondWithResult(_0x1c95d8,null))[_0x7721('0x26')](handleError(_0x1c95d8,null));};exports[_0x7721('0x57')]=function(_0x3e7918,_0x41644f){return db[_0x7721('0x4f')][_0x7721('0x57')](_0x3e7918[_0x7721('0x39')],{})[_0x7721('0x33')](respondWithResult(_0x41644f,0xc9))[_0x7721('0x26')](handleError(_0x41644f,null));};exports[_0x7721('0x31')]=function(_0x18f7f6,_0x300ea4){if(_0x18f7f6['body']['id']){delete _0x18f7f6['body']['id'];}return db['DeskAccount'][_0x7721('0x56')]({'where':{'id':_0x18f7f6['params']['id']}})['then'](handleEntityNotFound(_0x300ea4,null))['then'](saveUpdates(_0x18f7f6['body'],null))[_0x7721('0x33')](respondWithResult(_0x300ea4,null))[_0x7721('0x26')](handleError(_0x300ea4,null));};exports[_0x7721('0x32')]=function(_0x5343a1,_0x5181d7){return db['DeskAccount']['find']({'where':{'id':_0x5343a1['params']['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x5181d7,null))['then'](removeEntity(_0x5181d7,null))['catch'](handleError(_0x5181d7,null));};exports['getConfigurations']=function(_0x160292,_0x2e9155,_0x1ff090){var _0x4a94c8={};var _0x2a025c={};var _0x1f1890;var _0x2c95d0;return db[_0x7721('0x4f')][_0x7721('0x58')]({'where':{'id':_0x160292[_0x7721('0x53')]['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x2e9155,null))[_0x7721('0x33')](function(_0x127f46){if(_0x127f46){_0x1f1890=_0x127f46;_0x2a025c[_0x7721('0x43')]=_[_0x7721('0x41')](db[_0x7721('0x59')][_0x7721('0x3d')]);_0x2a025c[_0x7721('0x40')]=_[_0x7721('0x41')](_0x160292['query']);_0x2a025c[_0x7721('0x4b')]=_[_0x7721('0x42')](_0x2a025c[_0x7721('0x43')],_0x2a025c[_0x7721('0x40')]);_0x4a94c8['attributes']=_[_0x7721('0x42')](_0x2a025c[_0x7721('0x43')],qs['fields'](_0x160292[_0x7721('0x40')]['fields']));_0x4a94c8[_0x7721('0x44')]=_0x4a94c8[_0x7721('0x44')][_0x7721('0x46')]?_0x4a94c8[_0x7721('0x44')]:_0x2a025c[_0x7721('0x43')];_0x4a94c8[_0x7721('0x5a')]=qs[_0x7721('0x49')](_0x160292[_0x7721('0x40')][_0x7721('0x49')]);_0x4a94c8['where']=qs[_0x7721('0x4b')](_[_0x7721('0x4c')](_0x160292[_0x7721('0x40')],_0x2a025c[_0x7721('0x4b')]));if(_0x160292[_0x7721('0x40')][_0x7721('0x4d')]){_0x4a94c8[_0x7721('0x4a')]=_['merge'](_0x4a94c8[_0x7721('0x4a')],{'$or':_[_0x7721('0x3c')](_0x4a94c8['attributes'],function(_0x192f2e){var _0x565c49={};_0x565c49[_0x192f2e]={'$like':'%'+_0x160292[_0x7721('0x40')][_0x7721('0x4d')]+'%'};return _0x565c49;})});}_0x4a94c8=_[_0x7721('0x38')]({},_0x4a94c8,_0x160292[_0x7721('0x55')]);return _0x1f1890[_0x7721('0x5b')](_0x4a94c8);}})[_0x7721('0x33')](function(_0x258c57){if(_0x258c57){_0x2c95d0=_0x258c57['length'];if(!_0x160292[_0x7721('0x40')][_0x7721('0x47')](_0x7721('0x48'))){_0x4a94c8['limit']=qs['limit'](_0x160292['query']['limit']);_0x4a94c8['offset']=qs[_0x7721('0x2d')](_0x160292[_0x7721('0x40')]['offset']);}return _0x1f1890[_0x7721('0x5b')](_0x4a94c8);}})[_0x7721('0x33')](function(_0xbbc86f){if(_0xbbc86f){return _0xbbc86f?{'count':_0x2c95d0,'rows':_0xbbc86f}:null;}})[_0x7721('0x33')](respondWithResult(_0x2e9155,null))['catch'](handleError(_0x2e9155,null));};exports[_0x7721('0x5c')]=function(_0xfe9fb8,_0x322afc,_0x1bea13){if(_0xfe9fb8[_0x7721('0x39')]['id']){delete _0xfe9fb8['body']['id'];}return db[_0x7721('0x4f')][_0x7721('0x58')]({'where':{'id':_0xfe9fb8[_0x7721('0x53')]['id']}})['then'](handleEntityNotFound(_0x322afc,null))['then'](function(_0x76d89e){if(_0x76d89e){_0xfe9fb8[_0x7721('0x39')][_0x7721('0x5d')]=_0x76d89e['id'];_0xfe9fb8[_0x7721('0x39')][_0x7721('0x5e')]=integrations['getSubjects'](_0xfe9fb8['body'][_0x7721('0x5f')],_0xfe9fb8[_0x7721('0x39')][_0x7721('0x3e')]);_0xfe9fb8[_0x7721('0x39')][_0x7721('0x60')]=integrations[_0x7721('0x61')](_0xfe9fb8[_0x7721('0x39')]['channel'],_0xfe9fb8[_0x7721('0x39')][_0x7721('0x3e')]);return db[_0x7721('0x59')]['create'](_0xfe9fb8[_0x7721('0x39')],{'include':[{'model':db[_0x7721('0x62')],'as':_0x7721('0x5e')},{'model':db[_0x7721('0x62')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x322afc,null))[_0x7721('0x26')](handleError(_0x322afc,null));};exports[_0x7721('0x63')]=function(_0x177fe3,_0x42c849,_0x3605cb){var _0x2581b3=[{'name':'priority','label':_0x7721('0x64'),'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 _0x42bb5a='';return db[_0x7721('0x4f')]['findOne']({'where':{'id':_0x177fe3[_0x7721('0x53')]['id']},'attributes':['id',_0x7721('0x65'),_0x7721('0x66'),_0x7721('0x67'),_0x7721('0x68'),'consumerKey',_0x7721('0x69'),'token',_0x7721('0x6a')]})[_0x7721('0x33')](handleEntityNotFound(_0x42c849,null))[_0x7721('0x33')](function(_0x7f0598){if(_0x7f0598){_0x42bb5a=_0x7f0598[_0x7721('0x65')];var _0x438b9f=_0x42bb5a[_0x7721('0x6b')](-0x1);if(_0x438b9f==='/'){_0x42bb5a=_0x42bb5a[_0x7721('0x6c')](0x0,_0x42bb5a[_0x7721('0x6d')](_0x438b9f));}var _0x3b78f5={'method':_0x7721('0x6e'),'uri':util['format'](_0x7721('0x6f'),_0x42bb5a),'headers':{'Content-Type':_0x7721('0x70'),'Accept':_0x7721('0x70')},'json':!![]};if(_0x7f0598['authType']===_0x7721('0x71')){_0x3b78f5[_0x7721('0x72')][_0x7721('0x73')]=util[_0x7721('0x74')](_0x7721('0x75'),new Buffer(util['format'](_0x7721('0x76'),_0x7f0598[_0x7721('0x67')],_0x7f0598[_0x7721('0x68')]))[_0x7721('0x77')](_0x7721('0x78')));}return rp(_0x3b78f5)[_0x7721('0x33')](function(_0x52270e){return _0x2581b3[_0x7721('0x79')](_[_0x7721('0x3c')](_0x52270e['_embedded'][_0x7721('0x7a')],function(_0x4c8fb9){return{'id':_0x4c8fb9[_0x7721('0x36')],'name':_0x4c8fb9[_0x7721('0x36')],'type':_0x4c8fb9['type'],'active':_0x4c8fb9[_0x7721('0x7b')],'label':_0x4c8fb9['label'],'custom':!![]};}));});}})['then'](function(_0x4c47fc){return{'count':_0x4c47fc[_0x7721('0x46')],'rows':_0x4c47fc};})[_0x7721('0x33')](respondWithResult(_0x42c849,null))[_0x7721('0x26')](function(_0x48b701){var _0x4916c2=_0x177fe3['query'][_0x7721('0x7c')]?0x1f4:_0x48b701[_0x7721('0x7d')]||0x1f4;logger[_0x7721('0x22')](_0x7721('0x7e'),_0x7721('0x63'),_0x4916c2,JSON[_0x7721('0x7f')](_0x48b701));delete _0x48b701['name'];if(_0x4916c2===0x191){_0x4916c2=0x190;}_0x42c849[_0x7721('0x27')](_0x4916c2)[_0x7721('0x80')](_0x177fe3[_0x7721('0x40')][_0x7721('0x7c')]?{'message':_0x7721('0x81'),'statusCode':_0x48b701[_0x7721('0x7d')]}:_0x48b701);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 15a6c76..4efa44a 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 _0xbd7f=['rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','lodash','api','moment','bluebird','path'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0xbd7f,0x95));var _0xfbd7=function(_0x4e08ca,_0x534755){_0x4e08ca=_0x4e08ca-0x0;var _0x30f940=_0xbd7f[_0x4e08ca];return _0x30f940;};'use strict';var _=require(_0xfbd7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfbd7('0x1'));var moment=require(_0xfbd7('0x2'));var BPromise=require(_0xfbd7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbd7('0x4'));var rimraf=require(_0xfbd7('0x5'));var config=require(_0xfbd7('0x6'));var attributes=require(_0xfbd7('0x7'));var integrations=require(_0xfbd7('0x8'));module['exports']=function(_0x53050d,_0x282849){return _0x53050d[_0xfbd7('0x9')]('DeskAccount',attributes,{'tableName':_0xfbd7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72ed=['lodash','util','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x330d37,_0x4f6415){var _0x3b6cdb=function(_0x30f40e){while(--_0x30f40e){_0x330d37['push'](_0x330d37['shift']());}};_0x3b6cdb(++_0x4f6415);}(_0x72ed,0xf0));var _0xd72e=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x72ed[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0xd72e('0x0'));var util=require(_0xd72e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd72e('0x2'));var BPromise=require(_0xd72e('0x3'));var rp=require(_0xd72e('0x4'));var fs=require('fs');var path=require(_0xd72e('0x5'));var rimraf=require('rimraf');var config=require(_0xd72e('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xd72e('0x7'));module[_0xd72e('0x8')]=function(_0x35bb8b,_0x160b30){return _0x35bb8b[_0xd72e('0x9')](_0xd72e('0xa'),attributes,{'tableName':_0xd72e('0xb'),'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 52966f0..01690bd 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 _0x866f=['catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowDeskAccount','find','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x866f,0x14c));var _0xf866=function(_0x3f295a,_0x3da3f9){_0x3f295a=_0x3f295a-0x0;var _0x3e0daf=_0x866f[_0x3f295a];return _0x3e0daf;};'use strict';var _=require(_0xf866('0x0'));var util=require(_0xf866('0x1'));var moment=require(_0xf866('0x2'));var BPromise=require(_0xf866('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf866('0x4'));var db=require(_0xf866('0x5'))['db'];var utils=require(_0xf866('0x6'));var logger=require(_0xf866('0x7'))(_0xf866('0x8'));var config=require('../../config/environment');var jayson=require(_0xf866('0x9'));var client=jayson['client'][_0xf866('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x645821,_0x21a26e,_0x4b503c){return new BPromise(function(_0x27ce6e,_0x23ae6a){return client['request'](_0x645821,_0x4b503c)['then'](function(_0x35c911){logger[_0xf866('0xb')](_0xf866('0xc'),_0x21a26e,_0xf866('0xd'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x21a26e,_0xf866('0xd'),JSON['stringify'](_0x35c911));if(_0x35c911[_0xf866('0xe')]){if(_0x35c911[_0xf866('0xe')][_0xf866('0xf')]===0x1f4){logger[_0xf866('0xe')](_0xf866('0xc'),_0x21a26e,_0x35c911[_0xf866('0xe')][_0xf866('0x10')]);return _0x23ae6a(_0x35c911[_0xf866('0xe')][_0xf866('0x10')]);}logger[_0xf866('0xe')]('DeskAccount,\x20%s,\x20%s',_0x21a26e,_0x35c911[_0xf866('0xe')][_0xf866('0x10')]);return _0x27ce6e(_0x35c911[_0xf866('0xe')]['message']);}else{logger[_0xf866('0xb')](_0xf866('0xc'),_0x21a26e,_0xf866('0xd'));_0x27ce6e(_0x35c911[_0xf866('0x11')][_0xf866('0x10')]);}})[_0xf866('0x12')](function(_0x453f18){logger[_0xf866('0xe')](_0xf866('0xc'),_0x21a26e,_0x453f18);_0x23ae6a(_0x453f18);});});}exports[_0xf866('0x13')]=function(_0xce3f66){var _0xc81fdf=this;return new Promise(function(_0x15f9b0,_0x34169b){return db[_0xf866('0x14')][_0xf866('0x15')]({'raw':_0xce3f66[_0xf866('0x16')]?_0xce3f66['options'][_0xf866('0x17')]===undefined?!![]:![]:!![],'where':_0xce3f66[_0xf866('0x16')]?_0xce3f66[_0xf866('0x16')][_0xf866('0x18')]||null:null,'attributes':_0xce3f66['options']?_0xce3f66[_0xf866('0x16')][_0xf866('0x19')]||null:null,'limit':_0xce3f66[_0xf866('0x16')]?_0xce3f66['options'][_0xf866('0x1a')]||null:null,'include':_0xce3f66[_0xf866('0x16')]?_0xce3f66['options'][_0xf866('0x1b')]?_[_0xf866('0x1c')](_0xce3f66['options'][_0xf866('0x1b')],function(_0x28251d){return{'model':db[_0x28251d[_0xf866('0x1d')]],'as':_0x28251d['as'],'attributes':_0x28251d[_0xf866('0x19')],'include':_0x28251d[_0xf866('0x1b')]?_[_0xf866('0x1c')](_0x28251d[_0xf866('0x1b')],function(_0x2d8b11){return{'model':db[_0x2d8b11['model']],'as':_0x2d8b11['as'],'attributes':_0x2d8b11['attributes'],'include':_0x2d8b11['include']?_[_0xf866('0x1c')](_0x2d8b11[_0xf866('0x1b')],function(_0x544ae2){return{'model':db[_0x544ae2[_0xf866('0x1d')]],'as':_0x544ae2['as'],'attributes':_0x544ae2[_0xf866('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf866('0x1e')](function(_0x55dcf5){logger[_0xf866('0xb')](_0xf866('0x13'),_0xce3f66);logger['debug']('GetDeskAccount',_0xce3f66,JSON['stringify'](_0x55dcf5));_0x15f9b0(_0x55dcf5);})[_0xf866('0x12')](function(_0x4e2325){logger[_0xf866('0xe')](_0xf866('0x13'),_0x4e2325['message'],_0xce3f66);_0x34169b(_0xc81fdf[_0xf866('0xe')](0x1f4,_0x4e2325[_0xf866('0x10')]));});});};exports[_0xf866('0x1f')]=function(_0x57bb0f){var _0x4d9cb9=this;return new Promise(function(_0x387155,_0x297384){return db[_0xf866('0x14')][_0xf866('0x20')]({'raw':_0x57bb0f['options']?_0x57bb0f[_0xf866('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x57bb0f[_0xf866('0x16')]?_0x57bb0f['options']['where']||null:null,'attributes':_0x57bb0f['options']?_0x57bb0f[_0xf866('0x16')]['attributes']||null:null,'include':_0x57bb0f[_0xf866('0x16')]?_0x57bb0f[_0xf866('0x16')][_0xf866('0x1b')]?_['map'](_0x57bb0f['options'][_0xf866('0x1b')],function(_0x3ab8ca){return{'model':db[_0x3ab8ca[_0xf866('0x1d')]],'as':_0x3ab8ca['as'],'attributes':_0x3ab8ca[_0xf866('0x19')],'include':_0x3ab8ca[_0xf866('0x1b')]?_[_0xf866('0x1c')](_0x3ab8ca[_0xf866('0x1b')],function(_0x2976bd){return{'model':db[_0x2976bd['model']],'as':_0x2976bd['as'],'attributes':_0x2976bd[_0xf866('0x19')],'include':_0x2976bd['include']?_['map'](_0x2976bd[_0xf866('0x1b')],function(_0x298f20){return{'model':db[_0x298f20[_0xf866('0x1d')]],'as':_0x298f20['as'],'attributes':_0x298f20[_0xf866('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf866('0x1e')](function(_0x147254){logger[_0xf866('0xb')](_0xf866('0x1f'),_0x57bb0f);logger[_0xf866('0x21')]('ShowDeskAccount',_0x57bb0f,JSON[_0xf866('0x22')](_0x147254));_0x387155(_0x147254);})['catch'](function(_0x31388e){logger['error'](_0xf866('0x1f'),_0x31388e['message'],_0x57bb0f);_0x297384(_0x4d9cb9[_0xf866('0xe')](0x1f4,_0x31388e[_0xf866('0x10')]));});});}; \ No newline at end of file +var _0x4229=['findAll','options','raw','where','attributes','limit','include','map','model','info','find','ShowDeskAccount','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','DeskAccount'];(function(_0x2a9f4,_0x25c14a){var _0x3c39e0=function(_0x3b8deb){while(--_0x3b8deb){_0x2a9f4['push'](_0x2a9f4['shift']());}};_0x3c39e0(++_0x25c14a);}(_0x4229,0xb2));var _0x9422=function(_0x5cd851,_0x44b9f4){_0x5cd851=_0x5cd851-0x0;var _0x3dcd34=_0x4229[_0x5cd851];return _0x3dcd34;};'use strict';var _=require(_0x9422('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9422('0x1'));var fs=require('fs');var Redis=require(_0x9422('0x2'));var db=require(_0x9422('0x3'))['db'];var utils=require(_0x9422('0x4'));var logger=require(_0x9422('0x5'))('rpc');var config=require(_0x9422('0x6'));var jayson=require(_0x9422('0x7'));var client=jayson[_0x9422('0x8')][_0x9422('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15a5ee,_0x110b9e,_0x45db9e){return new BPromise(function(_0x7de6c1,_0x3b48f0){return client[_0x9422('0xa')](_0x15a5ee,_0x45db9e)[_0x9422('0xb')](function(_0x1c74af){logger['info'](_0x9422('0xc'),_0x110b9e,_0x9422('0xd'));logger[_0x9422('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x110b9e,'request\x20sent',JSON[_0x9422('0xf')](_0x1c74af));if(_0x1c74af[_0x9422('0x10')]){if(_0x1c74af[_0x9422('0x10')][_0x9422('0x11')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x110b9e,_0x1c74af[_0x9422('0x10')][_0x9422('0x12')]);return _0x3b48f0(_0x1c74af[_0x9422('0x10')][_0x9422('0x12')]);}logger[_0x9422('0x10')](_0x9422('0xc'),_0x110b9e,_0x1c74af[_0x9422('0x10')]['message']);return _0x7de6c1(_0x1c74af[_0x9422('0x10')]['message']);}else{logger['info'](_0x9422('0xc'),_0x110b9e,'request\x20sent');_0x7de6c1(_0x1c74af['result']['message']);}})['catch'](function(_0x570dfc){logger[_0x9422('0x10')](_0x9422('0xc'),_0x110b9e,_0x570dfc);_0x3b48f0(_0x570dfc);});});}exports['GetDeskAccount']=function(_0xbb774b){var _0x187750=this;return new Promise(function(_0xf2257,_0xf98f8e){return db[_0x9422('0x13')][_0x9422('0x14')]({'raw':_0xbb774b[_0x9422('0x15')]?_0xbb774b[_0x9422('0x15')][_0x9422('0x16')]===undefined?!![]:![]:!![],'where':_0xbb774b[_0x9422('0x15')]?_0xbb774b[_0x9422('0x15')][_0x9422('0x17')]||null:null,'attributes':_0xbb774b[_0x9422('0x15')]?_0xbb774b[_0x9422('0x15')][_0x9422('0x18')]||null:null,'limit':_0xbb774b['options']?_0xbb774b[_0x9422('0x15')][_0x9422('0x19')]||null:null,'include':_0xbb774b[_0x9422('0x15')]?_0xbb774b['options'][_0x9422('0x1a')]?_[_0x9422('0x1b')](_0xbb774b[_0x9422('0x15')]['include'],function(_0xff547d){return{'model':db[_0xff547d[_0x9422('0x1c')]],'as':_0xff547d['as'],'attributes':_0xff547d[_0x9422('0x18')],'include':_0xff547d[_0x9422('0x1a')]?_[_0x9422('0x1b')](_0xff547d[_0x9422('0x1a')],function(_0x4ae546){return{'model':db[_0x4ae546[_0x9422('0x1c')]],'as':_0x4ae546['as'],'attributes':_0x4ae546[_0x9422('0x18')],'include':_0x4ae546[_0x9422('0x1a')]?_['map'](_0x4ae546[_0x9422('0x1a')],function(_0x475c5e){return{'model':db[_0x475c5e[_0x9422('0x1c')]],'as':_0x475c5e['as'],'attributes':_0x475c5e[_0x9422('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9422('0xb')](function(_0x3246f4){logger[_0x9422('0x1d')]('GetDeskAccount',_0xbb774b);logger[_0x9422('0xe')]('GetDeskAccount',_0xbb774b,JSON[_0x9422('0xf')](_0x3246f4));_0xf2257(_0x3246f4);})['catch'](function(_0x7ce82f){logger[_0x9422('0x10')]('GetDeskAccount',_0x7ce82f[_0x9422('0x12')],_0xbb774b);_0xf98f8e(_0x187750['error'](0x1f4,_0x7ce82f[_0x9422('0x12')]));});});};exports['ShowDeskAccount']=function(_0x5afc18){var _0x54c93f=this;return new Promise(function(_0x5f1822,_0x1756d2){return db[_0x9422('0x13')][_0x9422('0x1e')]({'raw':_0x5afc18[_0x9422('0x15')]?_0x5afc18['options'][_0x9422('0x16')]===undefined?!![]:![]:!![],'where':_0x5afc18[_0x9422('0x15')]?_0x5afc18['options'][_0x9422('0x17')]||null:null,'attributes':_0x5afc18[_0x9422('0x15')]?_0x5afc18['options'][_0x9422('0x18')]||null:null,'include':_0x5afc18['options']?_0x5afc18[_0x9422('0x15')][_0x9422('0x1a')]?_[_0x9422('0x1b')](_0x5afc18['options'][_0x9422('0x1a')],function(_0x3be3e2){return{'model':db[_0x3be3e2[_0x9422('0x1c')]],'as':_0x3be3e2['as'],'attributes':_0x3be3e2[_0x9422('0x18')],'include':_0x3be3e2['include']?_[_0x9422('0x1b')](_0x3be3e2[_0x9422('0x1a')],function(_0x4e9981){return{'model':db[_0x4e9981[_0x9422('0x1c')]],'as':_0x4e9981['as'],'attributes':_0x4e9981[_0x9422('0x18')],'include':_0x4e9981[_0x9422('0x1a')]?_[_0x9422('0x1b')](_0x4e9981[_0x9422('0x1a')],function(_0x5e4b25){return{'model':db[_0x5e4b25['model']],'as':_0x5e4b25['as'],'attributes':_0x5e4b25[_0x9422('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9422('0xb')](function(_0x5922d4){logger[_0x9422('0x1d')](_0x9422('0x1f'),_0x5afc18);logger[_0x9422('0xe')](_0x9422('0x1f'),_0x5afc18,JSON[_0x9422('0xf')](_0x5922d4));_0x5f1822(_0x5922d4);})[_0x9422('0x20')](function(_0x4a1d26){logger['error'](_0x9422('0x1f'),_0x4a1d26['message'],_0x5afc18);_0x1756d2(_0x54c93f[_0x9422('0x10')](0x1f4,_0x4a1d26[_0x9422('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e160eb9..4d7d112 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 _0x3a8c=['post','setTags','delete','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x4729c4,_0x5f391b){var _0xdafec7=function(_0x2b6364){while(--_0x2b6364){_0x4729c4['push'](_0x4729c4['shift']());}};_0xdafec7(++_0x5f391b);}(_0x3a8c,0xf6));var _0xc3a8=function(_0x1522e0,_0x1537cb){_0x1522e0=_0x1522e0-0x0;var _0x8ee52d=_0x3a8c[_0x1522e0];return _0x8ee52d;};'use strict';var multer=require(_0xc3a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc3a8('0x1'));var express=require(_0xc3a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc3a8('0x3'));var interaction=require(_0xc3a8('0x4'));var config=require(_0xc3a8('0x5'));var controller=require(_0xc3a8('0x6'));router['get']('/',auth[_0xc3a8('0x7')](),controller[_0xc3a8('0x8')]);router[_0xc3a8('0x9')](_0xc3a8('0xa'),auth[_0xc3a8('0x7')](),controller['show']);router[_0xc3a8('0x9')](_0xc3a8('0xb'),auth[_0xc3a8('0x7')](),controller['getFields']);router[_0xc3a8('0x9')](_0xc3a8('0xc'),auth[_0xc3a8('0x7')](),controller[_0xc3a8('0xd')]);router[_0xc3a8('0x9')](_0xc3a8('0xe'),auth['isAuthenticated'](),controller[_0xc3a8('0xf')]);router[_0xc3a8('0x9')](_0xc3a8('0x10'),auth[_0xc3a8('0x7')](),controller[_0xc3a8('0x11')]);router[_0xc3a8('0x12')]('/',auth[_0xc3a8('0x7')](),controller['create']);router[_0xc3a8('0x12')](_0xc3a8('0x10'),auth[_0xc3a8('0x7')](),controller[_0xc3a8('0x13')]);router['put'](_0xc3a8('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc3a8('0x14')](_0xc3a8('0xa'),auth[_0xc3a8('0x7')](),controller['destroy']);module[_0xc3a8('0x15')]=router; \ No newline at end of file +var _0x24e3=['./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','getDescriptions','getTags','create','post','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1f647d,_0x517668){var _0x3de573=function(_0x1cc9c9){while(--_0x1cc9c9){_0x1f647d['push'](_0x1f647d['shift']());}};_0x3de573(++_0x517668);}(_0x24e3,0x67));var _0x324e=function(_0x1f0e4f,_0x12be3b){_0x1f0e4f=_0x1f0e4f-0x0;var _0x26fad7=_0x24e3[_0x1f0e4f];return _0x26fad7;};'use strict';var multer=require(_0x324e('0x0'));var util=require(_0x324e('0x1'));var path=require(_0x324e('0x2'));var timeout=require('connect-timeout');var express=require(_0x324e('0x3'));var router=express[_0x324e('0x4')]();var fs_extra=require(_0x324e('0x5'));var auth=require(_0x324e('0x6'));var interaction=require(_0x324e('0x7'));var config=require(_0x324e('0x8'));var controller=require(_0x324e('0x9'));router[_0x324e('0xa')]('/',auth[_0x324e('0xb')](),controller[_0x324e('0xc')]);router[_0x324e('0xa')](_0x324e('0xd'),auth[_0x324e('0xb')](),controller[_0x324e('0xe')]);router[_0x324e('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x324e('0xf')]);router[_0x324e('0xa')]('/:id/subjects',auth[_0x324e('0xb')](),controller[_0x324e('0x10')]);router['get']('/:id/descriptions',auth[_0x324e('0xb')](),controller[_0x324e('0x11')]);router[_0x324e('0xa')]('/:id/tags',auth[_0x324e('0xb')](),controller[_0x324e('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x324e('0x13')]);router[_0x324e('0x14')](_0x324e('0x15'),auth[_0x324e('0xb')](),controller[_0x324e('0x16')]);router[_0x324e('0x17')](_0x324e('0xd'),auth[_0x324e('0xb')](),controller[_0x324e('0x18')]);router[_0x324e('0x19')](_0x324e('0xd'),auth['isAuthenticated'](),controller[_0x324e('0x1a')]);module[_0x324e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 8fdf8d6..3d7fdd9 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 _0x7cf4=['STRING','sequelize'];(function(_0x21fa73,_0x31344f){var _0x466c3e=function(_0x1e92f2){while(--_0x1e92f2){_0x21fa73['push'](_0x21fa73['shift']());}};_0x466c3e(++_0x31344f);}(_0x7cf4,0x14b));var _0x47cf=function(_0x224ee1,_0x3361bc){_0x224ee1=_0x224ee1-0x0;var _0xa84cef=_0x7cf4[_0x224ee1];return _0xa84cef;};'use strict';var Sequelize=require(_0x47cf('0x0'));module['exports']={'name':{'type':Sequelize[_0x47cf('0x1')]},'description':{'type':Sequelize[_0x47cf('0x1')]}}; \ No newline at end of file +var _0x3cf4=['STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3cf4,0x177));var _0x43cf=function(_0x3dd6d0,_0x428681){_0x3dd6d0=_0x3dd6d0-0x0;var _0x2b8d1a=_0x3cf4[_0x3dd6d0];return _0x2b8d1a;};'use strict';var Sequelize=require(_0x43cf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x43cf('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4116c4a..dc9ab91 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 _0xbec5=['query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','destroy','getFields','findOne','DeskField','sort','pick','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','stack','name','send','render','merge','body','agent','account','map','DeskConfiguration','rawAttributes','fieldName','key','model','keys'];(function(_0x18c66e,_0x3ea035){var _0x4d9841=function(_0x2c4736){while(--_0x2c4736){_0x18c66e['push'](_0x18c66e['shift']());}};_0x4d9841(++_0x3ea035);}(_0xbec5,0xe5));var _0x5bec=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0xbec5[_0x3815c2];return _0x271f88;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];var jayson=require(_0x5bec('0x19'));var client=jayson['client'][_0x5bec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xaa984d,_0x35393a,_0x6888a4,_0x3198e0){return new BPromise(function(_0xcd6d90,_0x24dcd6){var _0x43fd2a=_0x3198e0||client;return _0x43fd2a[_0x5bec('0x1b')](_0xaa984d,_0x6888a4)[_0x5bec('0x1c')](function(_0x31b9e4){logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,'request\x20sent');logger['debug'](_0x5bec('0x1f'),_0x35393a,_0x5bec('0x20'),JSON[_0x5bec('0x21')](_0x31b9e4));if(_0x31b9e4[_0x5bec('0x22')]){if(_0x31b9e4['error']['code']===0x1f4){logger[_0x5bec('0x22')](_0x5bec('0x1e'),_0x35393a,_0x31b9e4['error'][_0x5bec('0x23')]);return _0x24dcd6(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}logger[_0x5bec('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x35393a,_0x31b9e4[_0x5bec('0x22')]['message']);return _0xcd6d90(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}else{logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,_0x5bec('0x20'));_0xcd6d90(_0x31b9e4['result'][_0x5bec('0x23')]);}})['catch'](function(_0x2b2d26){logger[_0x5bec('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x35393a,_0x2b2d26);_0x24dcd6(_0x2b2d26);});});}function respondWithStatusCode(_0xa414f8,_0xbef70b){_0xbef70b=_0xbef70b||0xcc;return function(_0x4e0ca2){if(_0x4e0ca2){return _0xa414f8[_0x5bec('0x24')](_0xbef70b);}return _0xa414f8[_0x5bec('0x25')](_0xbef70b)[_0x5bec('0x26')]();};}function respondWithResult(_0x20da89,_0x226d55){_0x226d55=_0x226d55||0xc8;return function(_0x131143){if(_0x131143){return _0x20da89[_0x5bec('0x25')](_0x226d55)['json'](_0x131143);}};}function respondWithFilteredResult(_0x5b63ab,_0x5e44b3){return function(_0x2961bd){if(_0x2961bd){var _0x2cdd2f=typeof _0x5e44b3[_0x5bec('0x27')]==='undefined'&&typeof _0x5e44b3[_0x5bec('0x28')]===_0x5bec('0x29');var _0x57331b=_0x2961bd[_0x5bec('0x2a')];var _0x63ac8=_0x2cdd2f?0x0:_0x5e44b3['offset'];var _0x5336b3=_0x2cdd2f?_0x2961bd[_0x5bec('0x2a')]:_0x5e44b3[_0x5bec('0x27')]+_0x5e44b3[_0x5bec('0x28')];var _0x2c7a7b;if(_0x5336b3>=_0x57331b){_0x5336b3=_0x57331b;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x5b63ab[_0x5bec('0x25')](_0x2c7a7b);return _0x5b63ab[_0x5bec('0x2b')]('Content-Range',_0x63ac8+'-'+_0x5336b3+'/'+_0x57331b)[_0x5bec('0x2c')](_0x2961bd);}return null;};}function patchUpdates(_0x59b5b6){return function(_0x45863b){try{jsonpatch[_0x5bec('0x2d')](_0x45863b,_0x59b5b6,!![]);}catch(_0x3034c9){return BPromise[_0x5bec('0x2e')](_0x3034c9);}return _0x45863b['save']();};}function saveUpdates(_0x2b42c8,_0x1aba46){return function(_0xfc7d41){if(_0xfc7d41){return _0xfc7d41['update'](_0x2b42c8)[_0x5bec('0x1c')](function(_0x4cfb89){return _0x4cfb89;});}return null;};}function removeEntity(_0x14cdbf,_0x207192){return function(_0x29df14){if(_0x29df14){return _0x29df14['destroy']()[_0x5bec('0x1c')](function(){_0x14cdbf[_0x5bec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34b441,_0x2e5efc){return function(_0x24aa2f){if(!_0x24aa2f){_0x34b441[_0x5bec('0x24')](0x194);}return _0x24aa2f;};}function handleError(_0x1c85a,_0x56869f){_0x56869f=_0x56869f||0x1f4;return function(_0x7ebd9c){logger['error'](_0x7ebd9c[_0x5bec('0x2f')]);if(_0x7ebd9c[_0x5bec('0x30')]){delete _0x7ebd9c[_0x5bec('0x30')];}_0x1c85a[_0x5bec('0x25')](_0x56869f)[_0x5bec('0x31')](_0x7ebd9c);};}function getMustacheRender(_0x1923fc,_0x49c8ef){return Mustache[_0x5bec('0x32')](_0x1923fc,_[_0x5bec('0x33')](_0x49c8ef[_0x5bec('0x34')],{'contact':_0x49c8ef['contact'],'message':_0x49c8ef[_0x5bec('0x23')],'agent':_0x49c8ef[_0x5bec('0x35')],'interaction':_0x49c8ef['interaction'],'account':_0x49c8ef[_0x5bec('0x36')]}))||'';}exports['index']=function(_0x400e22,_0x2c0b08){var _0x402e5d={},_0x49cdfa={},_0xd7b727={'count':0x0,'rows':[]};var _0x213514=_[_0x5bec('0x37')](db[_0x5bec('0x38')][_0x5bec('0x39')],function(_0x1be7a7){return{'name':_0x1be7a7[_0x5bec('0x3a')],'type':_0x1be7a7['type'][_0x5bec('0x3b')]};});_0x49cdfa[_0x5bec('0x3c')]=_[_0x5bec('0x37')](_0x213514,_0x5bec('0x30'));_0x49cdfa['query']=_[_0x5bec('0x3d')](_0x400e22[_0x5bec('0x3e')]);_0x49cdfa[_0x5bec('0x3f')]=_['intersection'](_0x49cdfa['model'],_0x49cdfa[_0x5bec('0x3e')]);_0x402e5d[_0x5bec('0x40')]=_[_0x5bec('0x41')](_0x49cdfa[_0x5bec('0x3c')],qs[_0x5bec('0x42')](_0x400e22['query']['fields']));_0x402e5d[_0x5bec('0x40')]=_0x402e5d['attributes'][_0x5bec('0x43')]?_0x402e5d[_0x5bec('0x40')]:_0x49cdfa[_0x5bec('0x3c')];if(!_0x400e22['query'][_0x5bec('0x44')](_0x5bec('0x45'))){_0x402e5d['limit']=qs[_0x5bec('0x28')](_0x400e22[_0x5bec('0x3e')][_0x5bec('0x28')]);_0x402e5d[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0x400e22[_0x5bec('0x3e')][_0x5bec('0x27')]);}_0x402e5d['order']=qs['sort'](_0x400e22[_0x5bec('0x3e')]['sort']);_0x402e5d['where']=qs[_0x5bec('0x3f')](_['pick'](_0x400e22['query'],_0x49cdfa['filters']),_0x213514);if(_0x400e22[_0x5bec('0x3e')][_0x5bec('0x46')]){_0x402e5d[_0x5bec('0x47')]=_[_0x5bec('0x33')](_0x402e5d['where'],{'$or':_[_0x5bec('0x37')](_0x213514,function(_0x29fb50){if(_0x29fb50[_0x5bec('0x48')]!==_0x5bec('0x49')){var _0x56610b={};_0x56610b[_0x29fb50[_0x5bec('0x30')]]={'$like':'%'+_0x400e22[_0x5bec('0x3e')][_0x5bec('0x46')]+'%'};return _0x56610b;}})});}_0x402e5d=_['merge']({},_0x402e5d,_0x400e22[_0x5bec('0x4a')]);var _0x4c3c6c={'where':_0x402e5d[_0x5bec('0x47')]};return db[_0x5bec('0x38')][_0x5bec('0x2a')](_0x4c3c6c)[_0x5bec('0x1c')](function(_0x54b11a){_0xd7b727[_0x5bec('0x2a')]=_0x54b11a;if(_0x400e22[_0x5bec('0x3e')][_0x5bec('0x4b')]){_0x402e5d[_0x5bec('0x4c')]=[{'all':!![]}];}return db[_0x5bec('0x38')][_0x5bec('0x4d')](_0x402e5d);})[_0x5bec('0x1c')](function(_0x47deb1){_0xd7b727[_0x5bec('0x4e')]=_0x47deb1;return _0xd7b727;})[_0x5bec('0x1c')](respondWithFilteredResult(_0x2c0b08,_0x402e5d))['catch'](handleError(_0x2c0b08,null));};exports[_0x5bec('0x4f')]=function(_0x3e6180,_0x34ee24){var _0x43ddbf={'raw':![],'where':{'id':_0x3e6180[_0x5bec('0x50')]['id']}},_0x473081={};_0x473081[_0x5bec('0x3c')]=_['keys'](db[_0x5bec('0x38')]['rawAttributes']);_0x473081[_0x5bec('0x3e')]=_[_0x5bec('0x3d')](_0x3e6180[_0x5bec('0x3e')]);_0x473081[_0x5bec('0x3f')]=_[_0x5bec('0x41')](_0x473081[_0x5bec('0x3c')],_0x473081[_0x5bec('0x3e')]);_0x43ddbf[_0x5bec('0x40')]=_[_0x5bec('0x41')](_0x473081[_0x5bec('0x3c')],qs['fields'](_0x3e6180[_0x5bec('0x3e')]['fields']));_0x43ddbf['attributes']=_0x43ddbf[_0x5bec('0x40')]['length']?_0x43ddbf['attributes']:_0x473081[_0x5bec('0x3c')];if(_0x3e6180[_0x5bec('0x3e')][_0x5bec('0x4b')]){_0x43ddbf['include']=[{'all':!![]}];}_0x43ddbf=_[_0x5bec('0x33')]({},_0x43ddbf,_0x3e6180[_0x5bec('0x4a')]);return db[_0x5bec('0x38')][_0x5bec('0x51')](_0x43ddbf)['then'](handleEntityNotFound(_0x34ee24,null))[_0x5bec('0x1c')](respondWithResult(_0x34ee24,null))[_0x5bec('0x52')](handleError(_0x34ee24,null));};exports[_0x5bec('0x53')]=function(_0xc8563a,_0x2f736c){return db[_0x5bec('0x38')][_0x5bec('0x53')](_0xc8563a['body'],{})['then'](respondWithResult(_0x2f736c,0xc9))[_0x5bec('0x52')](handleError(_0x2f736c,null));};exports['update']=function(_0xee3844,_0x7ad053){if(_0xee3844['body']['id']){delete _0xee3844[_0x5bec('0x34')]['id'];}return db['DeskConfiguration'][_0x5bec('0x51')]({'where':{'id':_0xee3844[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x7ad053,null))[_0x5bec('0x1c')](saveUpdates(_0xee3844[_0x5bec('0x34')],null))[_0x5bec('0x1c')](respondWithResult(_0x7ad053,null))[_0x5bec('0x52')](handleError(_0x7ad053,null));};exports[_0x5bec('0x54')]=function(_0x11d928,_0x2984b0){return db[_0x5bec('0x38')][_0x5bec('0x51')]({'where':{'id':_0x11d928[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x2984b0,null))['then'](removeEntity(_0x2984b0,null))[_0x5bec('0x52')](handleError(_0x2984b0,null));};exports[_0x5bec('0x55')]=function(_0x432a26,_0x56a539,_0x3801e3){var _0x381cb8={};var _0xfc5d80={};var _0x340cd9;var _0x19a1c9;return db['DeskConfiguration'][_0x5bec('0x56')]({'where':{'id':_0x432a26[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x56a539,null))[_0x5bec('0x1c')](function(_0x4e6c68){if(_0x4e6c68){_0x340cd9=_0x4e6c68;_0xfc5d80[_0x5bec('0x3c')]=_['keys'](db[_0x5bec('0x57')][_0x5bec('0x39')]);_0xfc5d80[_0x5bec('0x3e')]=_[_0x5bec('0x3d')](_0x432a26['query']);_0xfc5d80[_0x5bec('0x3f')]=_[_0x5bec('0x41')](_0xfc5d80[_0x5bec('0x3c')],_0xfc5d80[_0x5bec('0x3e')]);_0x381cb8[_0x5bec('0x40')]=_[_0x5bec('0x41')](_0xfc5d80[_0x5bec('0x3c')],qs[_0x5bec('0x42')](_0x432a26[_0x5bec('0x3e')][_0x5bec('0x42')]));_0x381cb8[_0x5bec('0x40')]=_0x381cb8[_0x5bec('0x40')][_0x5bec('0x43')]?_0x381cb8[_0x5bec('0x40')]:_0xfc5d80[_0x5bec('0x3c')];_0x381cb8['order']=qs[_0x5bec('0x58')](_0x432a26[_0x5bec('0x3e')]['sort']);_0x381cb8[_0x5bec('0x47')]=qs['filters'](_[_0x5bec('0x59')](_0x432a26[_0x5bec('0x3e')],_0xfc5d80['filters']));if(_0x432a26['query'][_0x5bec('0x46')]){_0x381cb8[_0x5bec('0x47')]=_[_0x5bec('0x33')](_0x381cb8[_0x5bec('0x47')],{'$or':_[_0x5bec('0x37')](_0x381cb8['attributes'],function(_0x139146){var _0x39cb06={};_0x39cb06[_0x139146]={'$like':'%'+_0x432a26['query'][_0x5bec('0x46')]+'%'};return _0x39cb06;})});}_0x381cb8=_[_0x5bec('0x33')]({},_0x381cb8,_0x432a26[_0x5bec('0x4a')]);return _0x340cd9[_0x5bec('0x55')](_0x381cb8);}})['then'](function(_0x681503){if(_0x681503){_0x19a1c9=_0x681503['length'];if(!_0x432a26[_0x5bec('0x3e')][_0x5bec('0x44')](_0x5bec('0x45'))){_0x381cb8[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0x432a26[_0x5bec('0x3e')][_0x5bec('0x28')]);_0x381cb8[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0x432a26[_0x5bec('0x3e')][_0x5bec('0x27')]);}return _0x340cd9['getFields'](_0x381cb8);}})['then'](function(_0x3c305e){if(_0x3c305e){return _0x3c305e?{'count':_0x19a1c9,'rows':_0x3c305e}:null;}})[_0x5bec('0x1c')](respondWithResult(_0x56a539,null))[_0x5bec('0x52')](handleError(_0x56a539,null));};exports[_0x5bec('0x5a')]=function(_0x459a71,_0x4745a7,_0xbf8b50){var _0x52f358={};var _0x569829={};var _0xc81e8f;var _0x9070da;return db[_0x5bec('0x38')][_0x5bec('0x56')]({'where':{'id':_0x459a71[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x4745a7,null))[_0x5bec('0x1c')](function(_0x31f45b){if(_0x31f45b){_0xc81e8f=_0x31f45b;_0x569829[_0x5bec('0x3c')]=_[_0x5bec('0x3d')](db[_0x5bec('0x57')][_0x5bec('0x39')]);_0x569829[_0x5bec('0x3e')]=_[_0x5bec('0x3d')](_0x459a71[_0x5bec('0x3e')]);_0x569829[_0x5bec('0x3f')]=_[_0x5bec('0x41')](_0x569829[_0x5bec('0x3c')],_0x569829[_0x5bec('0x3e')]);_0x52f358[_0x5bec('0x40')]=_['intersection'](_0x569829[_0x5bec('0x3c')],qs['fields'](_0x459a71['query'][_0x5bec('0x42')]));_0x52f358['attributes']=_0x52f358[_0x5bec('0x40')]['length']?_0x52f358['attributes']:_0x569829[_0x5bec('0x3c')];_0x52f358[_0x5bec('0x5b')]=qs['sort'](_0x459a71[_0x5bec('0x3e')][_0x5bec('0x58')]);_0x52f358[_0x5bec('0x47')]=qs[_0x5bec('0x3f')](_[_0x5bec('0x59')](_0x459a71[_0x5bec('0x3e')],_0x569829[_0x5bec('0x3f')]));if(_0x459a71[_0x5bec('0x3e')]['filter']){_0x52f358['where']=_[_0x5bec('0x33')](_0x52f358[_0x5bec('0x47')],{'$or':_[_0x5bec('0x37')](_0x52f358[_0x5bec('0x40')],function(_0x5d8058){var _0xf03100={};_0xf03100[_0x5d8058]={'$like':'%'+_0x459a71['query'][_0x5bec('0x46')]+'%'};return _0xf03100;})});}_0x52f358=_[_0x5bec('0x33')]({},_0x52f358,_0x459a71[_0x5bec('0x4a')]);return _0xc81e8f[_0x5bec('0x5a')](_0x52f358);}})[_0x5bec('0x1c')](function(_0x3be924){if(_0x3be924){_0x9070da=_0x3be924[_0x5bec('0x43')];if(!_0x459a71[_0x5bec('0x3e')]['hasOwnProperty'](_0x5bec('0x45'))){_0x52f358[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0x459a71[_0x5bec('0x3e')][_0x5bec('0x28')]);_0x52f358['offset']=qs[_0x5bec('0x27')](_0x459a71[_0x5bec('0x3e')]['offset']);}return _0xc81e8f[_0x5bec('0x5a')](_0x52f358);}})['then'](function(_0xd93c70){if(_0xd93c70){return _0xd93c70?{'count':_0x9070da,'rows':_0xd93c70}:null;}})[_0x5bec('0x1c')](respondWithResult(_0x4745a7,null))[_0x5bec('0x52')](handleError(_0x4745a7,null));};exports[_0x5bec('0x5c')]=function(_0x437c3e,_0x3d7600,_0x11208b){var _0x3b6c12={};var _0x1b8633={};var _0xe32bff;var _0x1c44f5;return db[_0x5bec('0x38')][_0x5bec('0x56')]({'where':{'id':_0x437c3e[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x3d7600,null))[_0x5bec('0x1c')](function(_0x317e2a){if(_0x317e2a){_0xe32bff=_0x317e2a;_0x1b8633[_0x5bec('0x3c')]=_['keys'](db[_0x5bec('0x57')]['rawAttributes']);_0x1b8633[_0x5bec('0x3e')]=_[_0x5bec('0x3d')](_0x437c3e['query']);_0x1b8633['filters']=_[_0x5bec('0x41')](_0x1b8633['model'],_0x1b8633[_0x5bec('0x3e')]);_0x3b6c12['attributes']=_[_0x5bec('0x41')](_0x1b8633[_0x5bec('0x3c')],qs['fields'](_0x437c3e[_0x5bec('0x3e')]['fields']));_0x3b6c12[_0x5bec('0x40')]=_0x3b6c12['attributes'][_0x5bec('0x43')]?_0x3b6c12[_0x5bec('0x40')]:_0x1b8633['model'];_0x3b6c12[_0x5bec('0x5b')]=qs[_0x5bec('0x58')](_0x437c3e[_0x5bec('0x3e')][_0x5bec('0x58')]);_0x3b6c12[_0x5bec('0x47')]=qs[_0x5bec('0x3f')](_['pick'](_0x437c3e[_0x5bec('0x3e')],_0x1b8633['filters']));if(_0x437c3e[_0x5bec('0x3e')]['filter']){_0x3b6c12['where']=_[_0x5bec('0x33')](_0x3b6c12[_0x5bec('0x47')],{'$or':_[_0x5bec('0x37')](_0x3b6c12['attributes'],function(_0x4182c1){var _0x6914ac={};_0x6914ac[_0x4182c1]={'$like':'%'+_0x437c3e[_0x5bec('0x3e')][_0x5bec('0x46')]+'%'};return _0x6914ac;})});}_0x3b6c12=_['merge']({},_0x3b6c12,_0x437c3e[_0x5bec('0x4a')]);return _0xe32bff[_0x5bec('0x5c')](_0x3b6c12);}})[_0x5bec('0x1c')](function(_0xfc95c5){if(_0xfc95c5){_0x1c44f5=_0xfc95c5['length'];if(!_0x437c3e[_0x5bec('0x3e')][_0x5bec('0x44')](_0x5bec('0x45'))){_0x3b6c12[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0x437c3e[_0x5bec('0x3e')][_0x5bec('0x28')]);_0x3b6c12[_0x5bec('0x27')]=qs['offset'](_0x437c3e[_0x5bec('0x3e')][_0x5bec('0x27')]);}return _0xe32bff[_0x5bec('0x5c')](_0x3b6c12);}})[_0x5bec('0x1c')](function(_0x1c9af0){if(_0x1c9af0){return _0x1c9af0?{'count':_0x1c44f5,'rows':_0x1c9af0}:null;}})['then'](respondWithResult(_0x3d7600,null))[_0x5bec('0x52')](handleError(_0x3d7600,null));};exports[_0x5bec('0x5d')]=function(_0x4a3710,_0x18f07a,_0x528102){var _0x1ed963={};var _0x3e09e5={};var _0x3c25ff;var _0x229d13;return db[_0x5bec('0x38')]['findOne']({'where':{'id':_0x4a3710[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x18f07a,null))[_0x5bec('0x1c')](function(_0x98b146){if(_0x98b146){_0x3c25ff=_0x98b146;_0x3e09e5[_0x5bec('0x3c')]=_[_0x5bec('0x3d')](db[_0x5bec('0x5e')][_0x5bec('0x39')]);_0x3e09e5[_0x5bec('0x3e')]=_['keys'](_0x4a3710[_0x5bec('0x3e')]);_0x3e09e5[_0x5bec('0x3f')]=_[_0x5bec('0x41')](_0x3e09e5['model'],_0x3e09e5['query']);_0x1ed963[_0x5bec('0x40')]=_[_0x5bec('0x41')](_0x3e09e5['model'],qs[_0x5bec('0x42')](_0x4a3710['query'][_0x5bec('0x42')]));_0x1ed963['attributes']=_0x1ed963[_0x5bec('0x40')]['length']?_0x1ed963[_0x5bec('0x40')]:_0x3e09e5['model'];_0x1ed963[_0x5bec('0x5b')]=qs['sort'](_0x4a3710[_0x5bec('0x3e')][_0x5bec('0x58')]);_0x1ed963['where']=qs[_0x5bec('0x3f')](_[_0x5bec('0x59')](_0x4a3710['query'],_0x3e09e5[_0x5bec('0x3f')]));if(_0x4a3710[_0x5bec('0x3e')][_0x5bec('0x46')]){_0x1ed963[_0x5bec('0x47')]=_[_0x5bec('0x33')](_0x1ed963[_0x5bec('0x47')],{'$or':_[_0x5bec('0x37')](_0x1ed963[_0x5bec('0x40')],function(_0x1a6266){var _0x542458={};_0x542458[_0x1a6266]={'$like':'%'+_0x4a3710['query']['filter']+'%'};return _0x542458;})});}_0x1ed963=_['merge']({},_0x1ed963,_0x4a3710[_0x5bec('0x4a')]);return _0x3c25ff['getTags'](_0x1ed963);}})[_0x5bec('0x1c')](function(_0x54632b){if(_0x54632b){_0x229d13=_0x54632b[_0x5bec('0x43')];if(!_0x4a3710[_0x5bec('0x3e')][_0x5bec('0x44')]('nolimit')){_0x1ed963[_0x5bec('0x28')]=qs['limit'](_0x4a3710[_0x5bec('0x3e')][_0x5bec('0x28')]);_0x1ed963[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0x4a3710[_0x5bec('0x3e')][_0x5bec('0x27')]);}return _0x3c25ff[_0x5bec('0x5d')](_0x1ed963);}})['then'](function(_0x456510){if(_0x456510){return _0x456510?{'count':_0x229d13,'rows':_0x456510}:null;}})[_0x5bec('0x1c')](respondWithResult(_0x18f07a,null))[_0x5bec('0x52')](handleError(_0x18f07a,null));};exports[_0x5bec('0x5f')]=function(_0x5dc740,_0x175f7a,_0x91b3eb){if(_0x5dc740[_0x5bec('0x34')]['id']){delete _0x5dc740[_0x5bec('0x34')]['id'];}return db[_0x5bec('0x38')]['findOne']({'where':{'id':_0x5dc740['params']['id']}})['then'](handleEntityNotFound(_0x175f7a,null))['then'](function(_0x5eb127){if(_0x5eb127){return _0x5eb127[_0x5bec('0x5f')](_0x5dc740['body'][_0x5bec('0x60')]||[]);}return null;})[_0x5bec('0x1c')](respondWithResult(_0x175f7a,null))['catch'](handleError(_0x175f7a,null));}; \ No newline at end of file +var _0x9c44=['../../config/license/util','../../mysqldb','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','end','stack','name','send','render','merge','contact','agent','interaction','account','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','getFields','DeskField','findOne','getSubjects','getDescriptions','order','getTags','setTags','ids','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'];(function(_0x139643,_0x680b08){var _0x1c540b=function(_0x2fc6b6){while(--_0x2fc6b6){_0x139643['push'](_0x139643['shift']());}};_0x1c540b(++_0x680b08);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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'];var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x16')][_0x49c4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fd9,_0x1909fe,_0x280996,_0x21f15a){return new BPromise(function(_0x2decee,_0x12777c){var _0x18211c=_0x21f15a||client;return _0x18211c[_0x49c4('0x18')](_0x5f2fd9,_0x280996)[_0x49c4('0x19')](function(_0x58d177){logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));logger[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x1909fe,'request\x20sent',JSON[_0x49c4('0x1f')](_0x58d177));if(_0x58d177[_0x49c4('0x20')]){if(_0x58d177['error']['code']===0x1f4){logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')]['message']);return _0x12777c(_0x58d177[_0x49c4('0x20')]['message']);}logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);return _0x2decee(_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);}else{logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));_0x2decee(_0x58d177['result']['message']);}})['catch'](function(_0x1c99b1){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x1909fe,_0x1c99b1);_0x12777c(_0x1c99b1);});});}function respondWithStatusCode(_0x2263ae,_0x15581b){_0x15581b=_0x15581b||0xcc;return function(_0x26c640){if(_0x26c640){return _0x2263ae[_0x49c4('0x22')](_0x15581b);}return _0x2263ae['status'](_0x15581b)['end']();};}function respondWithResult(_0x180276,_0x9cb797){_0x9cb797=_0x9cb797||0xc8;return function(_0x565423){if(_0x565423){return _0x180276[_0x49c4('0x23')](_0x9cb797)[_0x49c4('0x24')](_0x565423);}};}function respondWithFilteredResult(_0x210159,_0xa7a826){return function(_0x531d92){if(_0x531d92){var _0x543ea2=typeof _0xa7a826[_0x49c4('0x25')]==='undefined'&&typeof _0xa7a826[_0x49c4('0x26')]===_0x49c4('0x27');var _0x3f1708=_0x531d92[_0x49c4('0x28')];var _0x5987ae=_0x543ea2?0x0:_0xa7a826[_0x49c4('0x25')];var _0x2b2793=_0x543ea2?_0x531d92[_0x49c4('0x28')]:_0xa7a826[_0x49c4('0x25')]+_0xa7a826[_0x49c4('0x26')];var _0x29f835;if(_0x2b2793>=_0x3f1708){_0x2b2793=_0x3f1708;_0x29f835=0xc8;}else{_0x29f835=0xce;}_0x210159[_0x49c4('0x23')](_0x29f835);return _0x210159[_0x49c4('0x29')](_0x49c4('0x2a'),_0x5987ae+'-'+_0x2b2793+'/'+_0x3f1708)[_0x49c4('0x24')](_0x531d92);}return null;};}function patchUpdates(_0x46f7ea){return function(_0x4ea6ea){try{jsonpatch['apply'](_0x4ea6ea,_0x46f7ea,!![]);}catch(_0x59eb84){return BPromise[_0x49c4('0x2b')](_0x59eb84);}return _0x4ea6ea[_0x49c4('0x2c')]();};}function saveUpdates(_0x1eb035,_0x27e467){return function(_0x28eb47){if(_0x28eb47){return _0x28eb47['update'](_0x1eb035)[_0x49c4('0x19')](function(_0x116eb4){return _0x116eb4;});}return null;};}function removeEntity(_0x2e7a69,_0x24bba9){return function(_0x58e252){if(_0x58e252){return _0x58e252['destroy']()[_0x49c4('0x19')](function(){_0x2e7a69[_0x49c4('0x23')](0xcc)[_0x49c4('0x2d')]();});}};}function handleEntityNotFound(_0x13b3b4,_0xd38540){return function(_0x4a0c7a){if(!_0x4a0c7a){_0x13b3b4[_0x49c4('0x22')](0x194);}return _0x4a0c7a;};}function handleError(_0x84c621,_0x1bfa0f){_0x1bfa0f=_0x1bfa0f||0x1f4;return function(_0x512d02){logger['error'](_0x512d02[_0x49c4('0x2e')]);if(_0x512d02[_0x49c4('0x2f')]){delete _0x512d02[_0x49c4('0x2f')];}_0x84c621[_0x49c4('0x23')](_0x1bfa0f)[_0x49c4('0x30')](_0x512d02);};}function getMustacheRender(_0x2cf897,_0x1d1557){return Mustache[_0x49c4('0x31')](_0x2cf897,_[_0x49c4('0x32')](_0x1d1557['body'],{'contact':_0x1d1557[_0x49c4('0x33')],'message':_0x1d1557['message'],'agent':_0x1d1557[_0x49c4('0x34')],'interaction':_0x1d1557[_0x49c4('0x35')],'account':_0x1d1557[_0x49c4('0x36')]}))||'';}exports[_0x49c4('0x37')]=function(_0x4ed4f8,_0x335f0c){var _0x31f3ff={},_0x1c910a={},_0x4e913a={'count':0x0,'rows':[]};var _0x3b4feb=_[_0x49c4('0x38')](db[_0x49c4('0x39')][_0x49c4('0x3a')],function(_0x1ba7a0){return{'name':_0x1ba7a0[_0x49c4('0x3b')],'type':_0x1ba7a0[_0x49c4('0x3c')][_0x49c4('0x3d')]};});_0x1c910a[_0x49c4('0x3e')]=_[_0x49c4('0x38')](_0x3b4feb,_0x49c4('0x2f'));_0x1c910a['query']=_[_0x49c4('0x3f')](_0x4ed4f8[_0x49c4('0x40')]);_0x1c910a[_0x49c4('0x41')]=_[_0x49c4('0x42')](_0x1c910a[_0x49c4('0x3e')],_0x1c910a[_0x49c4('0x40')]);_0x31f3ff[_0x49c4('0x43')]=_[_0x49c4('0x42')](_0x1c910a[_0x49c4('0x3e')],qs[_0x49c4('0x44')](_0x4ed4f8[_0x49c4('0x40')][_0x49c4('0x44')]));_0x31f3ff[_0x49c4('0x43')]=_0x31f3ff['attributes'][_0x49c4('0x45')]?_0x31f3ff['attributes']:_0x1c910a[_0x49c4('0x3e')];if(!_0x4ed4f8[_0x49c4('0x40')][_0x49c4('0x46')](_0x49c4('0x47'))){_0x31f3ff[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x4ed4f8['query']['limit']);_0x31f3ff[_0x49c4('0x25')]=qs[_0x49c4('0x25')](_0x4ed4f8[_0x49c4('0x40')][_0x49c4('0x25')]);}_0x31f3ff['order']=qs[_0x49c4('0x48')](_0x4ed4f8[_0x49c4('0x40')][_0x49c4('0x48')]);_0x31f3ff[_0x49c4('0x49')]=qs[_0x49c4('0x41')](_[_0x49c4('0x4a')](_0x4ed4f8[_0x49c4('0x40')],_0x1c910a[_0x49c4('0x41')]),_0x3b4feb);if(_0x4ed4f8[_0x49c4('0x40')]['filter']){_0x31f3ff[_0x49c4('0x49')]=_['merge'](_0x31f3ff[_0x49c4('0x49')],{'$or':_[_0x49c4('0x38')](_0x3b4feb,function(_0x301def){if(_0x301def[_0x49c4('0x3c')]!==_0x49c4('0x4b')){var _0x5b296d={};_0x5b296d[_0x301def[_0x49c4('0x2f')]]={'$like':'%'+_0x4ed4f8[_0x49c4('0x40')][_0x49c4('0x4c')]+'%'};return _0x5b296d;}})});}_0x31f3ff=_[_0x49c4('0x32')]({},_0x31f3ff,_0x4ed4f8[_0x49c4('0x4d')]);var _0x5d4790={'where':_0x31f3ff[_0x49c4('0x49')]};return db['DeskConfiguration'][_0x49c4('0x28')](_0x5d4790)['then'](function(_0x3f7379){_0x4e913a[_0x49c4('0x28')]=_0x3f7379;if(_0x4ed4f8[_0x49c4('0x40')][_0x49c4('0x4e')]){_0x31f3ff[_0x49c4('0x4f')]=[{'all':!![]}];}return db[_0x49c4('0x39')][_0x49c4('0x50')](_0x31f3ff);})['then'](function(_0x3b731f){_0x4e913a[_0x49c4('0x51')]=_0x3b731f;return _0x4e913a;})['then'](respondWithFilteredResult(_0x335f0c,_0x31f3ff))[_0x49c4('0x52')](handleError(_0x335f0c,null));};exports[_0x49c4('0x53')]=function(_0xfbe179,_0x242afc){var _0x52a8f7={'raw':![],'where':{'id':_0xfbe179[_0x49c4('0x54')]['id']}},_0x5d8bf0={};_0x5d8bf0['model']=_[_0x49c4('0x3f')](db[_0x49c4('0x39')][_0x49c4('0x3a')]);_0x5d8bf0[_0x49c4('0x40')]=_[_0x49c4('0x3f')](_0xfbe179[_0x49c4('0x40')]);_0x5d8bf0[_0x49c4('0x41')]=_['intersection'](_0x5d8bf0[_0x49c4('0x3e')],_0x5d8bf0[_0x49c4('0x40')]);_0x52a8f7[_0x49c4('0x43')]=_[_0x49c4('0x42')](_0x5d8bf0[_0x49c4('0x3e')],qs[_0x49c4('0x44')](_0xfbe179[_0x49c4('0x40')][_0x49c4('0x44')]));_0x52a8f7[_0x49c4('0x43')]=_0x52a8f7[_0x49c4('0x43')]['length']?_0x52a8f7['attributes']:_0x5d8bf0[_0x49c4('0x3e')];if(_0xfbe179[_0x49c4('0x40')]['includeAll']){_0x52a8f7['include']=[{'all':!![]}];}_0x52a8f7=_[_0x49c4('0x32')]({},_0x52a8f7,_0xfbe179['options']);return db['DeskConfiguration'][_0x49c4('0x55')](_0x52a8f7)[_0x49c4('0x19')](handleEntityNotFound(_0x242afc,null))[_0x49c4('0x19')](respondWithResult(_0x242afc,null))[_0x49c4('0x52')](handleError(_0x242afc,null));};exports[_0x49c4('0x56')]=function(_0x16949a,_0x35724e){return db['DeskConfiguration'][_0x49c4('0x56')](_0x16949a[_0x49c4('0x57')],{})[_0x49c4('0x19')](respondWithResult(_0x35724e,0xc9))[_0x49c4('0x52')](handleError(_0x35724e,null));};exports[_0x49c4('0x58')]=function(_0xa431d,_0x5d24f3){if(_0xa431d['body']['id']){delete _0xa431d[_0x49c4('0x57')]['id'];}return db[_0x49c4('0x39')][_0x49c4('0x55')]({'where':{'id':_0xa431d[_0x49c4('0x54')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x5d24f3,null))[_0x49c4('0x19')](saveUpdates(_0xa431d[_0x49c4('0x57')],null))['then'](respondWithResult(_0x5d24f3,null))[_0x49c4('0x52')](handleError(_0x5d24f3,null));};exports[_0x49c4('0x59')]=function(_0x4ba4eb,_0x42928c){return db['DeskConfiguration'][_0x49c4('0x55')]({'where':{'id':_0x4ba4eb[_0x49c4('0x54')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x42928c,null))[_0x49c4('0x19')](removeEntity(_0x42928c,null))[_0x49c4('0x52')](handleError(_0x42928c,null));};exports[_0x49c4('0x5a')]=function(_0x3eb66d,_0x2f520f,_0x483770){var _0x3894e0={};var _0x27b9c2={};var _0x59dc8d;var _0x10dec7;return db[_0x49c4('0x39')]['findOne']({'where':{'id':_0x3eb66d[_0x49c4('0x54')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x2f520f,null))['then'](function(_0x4dc54d){if(_0x4dc54d){_0x59dc8d=_0x4dc54d;_0x27b9c2['model']=_['keys'](db[_0x49c4('0x5b')]['rawAttributes']);_0x27b9c2[_0x49c4('0x40')]=_[_0x49c4('0x3f')](_0x3eb66d['query']);_0x27b9c2[_0x49c4('0x41')]=_[_0x49c4('0x42')](_0x27b9c2['model'],_0x27b9c2[_0x49c4('0x40')]);_0x3894e0[_0x49c4('0x43')]=_[_0x49c4('0x42')](_0x27b9c2[_0x49c4('0x3e')],qs['fields'](_0x3eb66d[_0x49c4('0x40')][_0x49c4('0x44')]));_0x3894e0[_0x49c4('0x43')]=_0x3894e0[_0x49c4('0x43')]['length']?_0x3894e0[_0x49c4('0x43')]:_0x27b9c2['model'];_0x3894e0['order']=qs['sort'](_0x3eb66d['query'][_0x49c4('0x48')]);_0x3894e0[_0x49c4('0x49')]=qs[_0x49c4('0x41')](_[_0x49c4('0x4a')](_0x3eb66d['query'],_0x27b9c2['filters']));if(_0x3eb66d[_0x49c4('0x40')][_0x49c4('0x4c')]){_0x3894e0[_0x49c4('0x49')]=_[_0x49c4('0x32')](_0x3894e0[_0x49c4('0x49')],{'$or':_[_0x49c4('0x38')](_0x3894e0[_0x49c4('0x43')],function(_0x3b949d){var _0x4d49e0={};_0x4d49e0[_0x3b949d]={'$like':'%'+_0x3eb66d[_0x49c4('0x40')]['filter']+'%'};return _0x4d49e0;})});}_0x3894e0=_[_0x49c4('0x32')]({},_0x3894e0,_0x3eb66d[_0x49c4('0x4d')]);return _0x59dc8d[_0x49c4('0x5a')](_0x3894e0);}})[_0x49c4('0x19')](function(_0x3a1c81){if(_0x3a1c81){_0x10dec7=_0x3a1c81[_0x49c4('0x45')];if(!_0x3eb66d[_0x49c4('0x40')][_0x49c4('0x46')](_0x49c4('0x47'))){_0x3894e0[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x3eb66d[_0x49c4('0x40')][_0x49c4('0x26')]);_0x3894e0[_0x49c4('0x25')]=qs[_0x49c4('0x25')](_0x3eb66d[_0x49c4('0x40')][_0x49c4('0x25')]);}return _0x59dc8d[_0x49c4('0x5a')](_0x3894e0);}})['then'](function(_0x5ec201){if(_0x5ec201){return _0x5ec201?{'count':_0x10dec7,'rows':_0x5ec201}:null;}})[_0x49c4('0x19')](respondWithResult(_0x2f520f,null))[_0x49c4('0x52')](handleError(_0x2f520f,null));};exports['getSubjects']=function(_0x1a15f3,_0x38ad50,_0x2939fd){var _0x16e7b1={};var _0x4d6aaa={};var _0x5a14a5;var _0x4a85d4;return db[_0x49c4('0x39')][_0x49c4('0x5c')]({'where':{'id':_0x1a15f3[_0x49c4('0x54')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x38ad50,null))[_0x49c4('0x19')](function(_0x146706){if(_0x146706){_0x5a14a5=_0x146706;_0x4d6aaa[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](db[_0x49c4('0x5b')]['rawAttributes']);_0x4d6aaa[_0x49c4('0x40')]=_[_0x49c4('0x3f')](_0x1a15f3[_0x49c4('0x40')]);_0x4d6aaa['filters']=_[_0x49c4('0x42')](_0x4d6aaa[_0x49c4('0x3e')],_0x4d6aaa[_0x49c4('0x40')]);_0x16e7b1[_0x49c4('0x43')]=_[_0x49c4('0x42')](_0x4d6aaa[_0x49c4('0x3e')],qs[_0x49c4('0x44')](_0x1a15f3[_0x49c4('0x40')]['fields']));_0x16e7b1[_0x49c4('0x43')]=_0x16e7b1[_0x49c4('0x43')][_0x49c4('0x45')]?_0x16e7b1[_0x49c4('0x43')]:_0x4d6aaa[_0x49c4('0x3e')];_0x16e7b1['order']=qs['sort'](_0x1a15f3[_0x49c4('0x40')]['sort']);_0x16e7b1[_0x49c4('0x49')]=qs['filters'](_[_0x49c4('0x4a')](_0x1a15f3[_0x49c4('0x40')],_0x4d6aaa[_0x49c4('0x41')]));if(_0x1a15f3[_0x49c4('0x40')]['filter']){_0x16e7b1[_0x49c4('0x49')]=_[_0x49c4('0x32')](_0x16e7b1[_0x49c4('0x49')],{'$or':_[_0x49c4('0x38')](_0x16e7b1[_0x49c4('0x43')],function(_0xbb7f42){var _0x38b291={};_0x38b291[_0xbb7f42]={'$like':'%'+_0x1a15f3[_0x49c4('0x40')][_0x49c4('0x4c')]+'%'};return _0x38b291;})});}_0x16e7b1=_[_0x49c4('0x32')]({},_0x16e7b1,_0x1a15f3['options']);return _0x5a14a5[_0x49c4('0x5d')](_0x16e7b1);}})[_0x49c4('0x19')](function(_0x549719){if(_0x549719){_0x4a85d4=_0x549719[_0x49c4('0x45')];if(!_0x1a15f3['query'][_0x49c4('0x46')](_0x49c4('0x47'))){_0x16e7b1[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x1a15f3[_0x49c4('0x40')]['limit']);_0x16e7b1[_0x49c4('0x25')]=qs[_0x49c4('0x25')](_0x1a15f3['query'][_0x49c4('0x25')]);}return _0x5a14a5[_0x49c4('0x5d')](_0x16e7b1);}})['then'](function(_0xbd12b9){if(_0xbd12b9){return _0xbd12b9?{'count':_0x4a85d4,'rows':_0xbd12b9}:null;}})[_0x49c4('0x19')](respondWithResult(_0x38ad50,null))['catch'](handleError(_0x38ad50,null));};exports[_0x49c4('0x5e')]=function(_0x993d00,_0x25989a,_0x33dc39){var _0x4e1364={};var _0x999ae2={};var _0x7212ce;var _0x4c2fed;return db[_0x49c4('0x39')]['findOne']({'where':{'id':_0x993d00['params']['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x25989a,null))['then'](function(_0x50fd24){if(_0x50fd24){_0x7212ce=_0x50fd24;_0x999ae2[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](db['DeskField'][_0x49c4('0x3a')]);_0x999ae2['query']=_['keys'](_0x993d00['query']);_0x999ae2[_0x49c4('0x41')]=_[_0x49c4('0x42')](_0x999ae2[_0x49c4('0x3e')],_0x999ae2[_0x49c4('0x40')]);_0x4e1364['attributes']=_['intersection'](_0x999ae2[_0x49c4('0x3e')],qs['fields'](_0x993d00[_0x49c4('0x40')]['fields']));_0x4e1364[_0x49c4('0x43')]=_0x4e1364[_0x49c4('0x43')][_0x49c4('0x45')]?_0x4e1364[_0x49c4('0x43')]:_0x999ae2[_0x49c4('0x3e')];_0x4e1364[_0x49c4('0x5f')]=qs[_0x49c4('0x48')](_0x993d00['query'][_0x49c4('0x48')]);_0x4e1364[_0x49c4('0x49')]=qs[_0x49c4('0x41')](_[_0x49c4('0x4a')](_0x993d00[_0x49c4('0x40')],_0x999ae2['filters']));if(_0x993d00[_0x49c4('0x40')][_0x49c4('0x4c')]){_0x4e1364[_0x49c4('0x49')]=_['merge'](_0x4e1364['where'],{'$or':_[_0x49c4('0x38')](_0x4e1364[_0x49c4('0x43')],function(_0xd30fb9){var _0xdab1ba={};_0xdab1ba[_0xd30fb9]={'$like':'%'+_0x993d00[_0x49c4('0x40')]['filter']+'%'};return _0xdab1ba;})});}_0x4e1364=_[_0x49c4('0x32')]({},_0x4e1364,_0x993d00[_0x49c4('0x4d')]);return _0x7212ce[_0x49c4('0x5e')](_0x4e1364);}})[_0x49c4('0x19')](function(_0x50cd4f){if(_0x50cd4f){_0x4c2fed=_0x50cd4f['length'];if(!_0x993d00[_0x49c4('0x40')][_0x49c4('0x46')](_0x49c4('0x47'))){_0x4e1364[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x993d00['query'][_0x49c4('0x26')]);_0x4e1364[_0x49c4('0x25')]=qs[_0x49c4('0x25')](_0x993d00[_0x49c4('0x40')][_0x49c4('0x25')]);}return _0x7212ce[_0x49c4('0x5e')](_0x4e1364);}})['then'](function(_0x21a4fb){if(_0x21a4fb){return _0x21a4fb?{'count':_0x4c2fed,'rows':_0x21a4fb}:null;}})[_0x49c4('0x19')](respondWithResult(_0x25989a,null))[_0x49c4('0x52')](handleError(_0x25989a,null));};exports[_0x49c4('0x60')]=function(_0x508ae9,_0x5be767,_0xa96f53){var _0x4933a7={};var _0x202b8a={};var _0x532ba5;var _0x303d49;return db[_0x49c4('0x39')][_0x49c4('0x5c')]({'where':{'id':_0x508ae9[_0x49c4('0x54')]['id']}})['then'](handleEntityNotFound(_0x5be767,null))['then'](function(_0x2e352e){if(_0x2e352e){_0x532ba5=_0x2e352e;_0x202b8a[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](db['Tag']['rawAttributes']);_0x202b8a[_0x49c4('0x40')]=_['keys'](_0x508ae9['query']);_0x202b8a[_0x49c4('0x41')]=_['intersection'](_0x202b8a[_0x49c4('0x3e')],_0x202b8a[_0x49c4('0x40')]);_0x4933a7['attributes']=_[_0x49c4('0x42')](_0x202b8a[_0x49c4('0x3e')],qs['fields'](_0x508ae9['query'][_0x49c4('0x44')]));_0x4933a7['attributes']=_0x4933a7[_0x49c4('0x43')][_0x49c4('0x45')]?_0x4933a7[_0x49c4('0x43')]:_0x202b8a[_0x49c4('0x3e')];_0x4933a7[_0x49c4('0x5f')]=qs[_0x49c4('0x48')](_0x508ae9[_0x49c4('0x40')]['sort']);_0x4933a7[_0x49c4('0x49')]=qs[_0x49c4('0x41')](_[_0x49c4('0x4a')](_0x508ae9[_0x49c4('0x40')],_0x202b8a[_0x49c4('0x41')]));if(_0x508ae9['query'][_0x49c4('0x4c')]){_0x4933a7['where']=_[_0x49c4('0x32')](_0x4933a7[_0x49c4('0x49')],{'$or':_[_0x49c4('0x38')](_0x4933a7[_0x49c4('0x43')],function(_0x5acbf7){var _0x293e47={};_0x293e47[_0x5acbf7]={'$like':'%'+_0x508ae9[_0x49c4('0x40')][_0x49c4('0x4c')]+'%'};return _0x293e47;})});}_0x4933a7=_[_0x49c4('0x32')]({},_0x4933a7,_0x508ae9[_0x49c4('0x4d')]);return _0x532ba5[_0x49c4('0x60')](_0x4933a7);}})['then'](function(_0x8c5de0){if(_0x8c5de0){_0x303d49=_0x8c5de0['length'];if(!_0x508ae9[_0x49c4('0x40')][_0x49c4('0x46')](_0x49c4('0x47'))){_0x4933a7[_0x49c4('0x26')]=qs['limit'](_0x508ae9[_0x49c4('0x40')][_0x49c4('0x26')]);_0x4933a7['offset']=qs[_0x49c4('0x25')](_0x508ae9[_0x49c4('0x40')]['offset']);}return _0x532ba5['getTags'](_0x4933a7);}})[_0x49c4('0x19')](function(_0x3e5915){if(_0x3e5915){return _0x3e5915?{'count':_0x303d49,'rows':_0x3e5915}:null;}})[_0x49c4('0x19')](respondWithResult(_0x5be767,null))[_0x49c4('0x52')](handleError(_0x5be767,null));};exports[_0x49c4('0x61')]=function(_0x15e403,_0x184d47,_0x450a38){if(_0x15e403[_0x49c4('0x57')]['id']){delete _0x15e403[_0x49c4('0x57')]['id'];}return db[_0x49c4('0x39')]['findOne']({'where':{'id':_0x15e403['params']['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x184d47,null))[_0x49c4('0x19')](function(_0xccdf6d){if(_0xccdf6d){return _0xccdf6d['setTags'](_0x15e403[_0x49c4('0x57')][_0x49c4('0x62')]||[]);}return null;})['then'](respondWithResult(_0x184d47,null))[_0x49c4('0x52')](handleError(_0x184d47,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index c66fe97..30b40e9 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 _0xe308=['exports','define','DeskConfiguration','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2cf2c5,_0x5eb664){var _0x549f6a=function(_0x5b9dd1){while(--_0x5b9dd1){_0x2cf2c5['push'](_0x2cf2c5['shift']());}};_0x549f6a(++_0x5eb664);}(_0xe308,0x12f));var _0x8e30=function(_0xee6c56,_0x40189a){_0xee6c56=_0xee6c56-0x0;var _0x2a8eb8=_0xe308[_0xee6c56];return _0x2a8eb8;};'use strict';var _=require(_0x8e30('0x0'));var util=require('util');var logger=require(_0x8e30('0x1'))(_0x8e30('0x2'));var moment=require(_0x8e30('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e30('0x4'));var fs=require('fs');var path=require(_0x8e30('0x5'));var rimraf=require(_0x8e30('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x8e30('0x7')]=function(_0xb14393,_0x24ff93){return _0xb14393[_0x8e30('0x8')](_0x8e30('0x9'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12e9=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x16166c,_0x197d7e){var _0x1719af=function(_0x21a8e3){while(--_0x21a8e3){_0x16166c['push'](_0x16166c['shift']());}};_0x1719af(++_0x197d7e);}(_0x12e9,0x1c1));var _0x912e=function(_0x31deb6,_0x2a7d72){_0x31deb6=_0x31deb6-0x0;var _0x5b7a70=_0x12e9[_0x31deb6];return _0x5b7a70;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x912e('0x0'))(_0x912e('0x1'));var moment=require(_0x912e('0x2'));var BPromise=require(_0x912e('0x3'));var rp=require(_0x912e('0x4'));var fs=require('fs');var path=require(_0x912e('0x5'));var rimraf=require(_0x912e('0x6'));var config=require('../../config/environment');var attributes=require(_0x912e('0x7'));module[_0x912e('0x8')]=function(_0x91a1e0,_0x1b4ced){return _0x91a1e0[_0x912e('0x9')](_0x912e('0xa'),attributes,{'tableName':_0x912e('0xb'),'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 18058fc..cfb2e99 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 _0x5127=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4f8d61,_0x29eff0){var _0x3bc078=function(_0x4c7203){while(--_0x4c7203){_0x4f8d61['push'](_0x4f8d61['shift']());}};_0x3bc078(++_0x29eff0);}(_0x5127,0x18f));var _0x7512=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0x5127[_0x17882c];return _0x355a59;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var moment=require(_0x7512('0x2'));var BPromise=require(_0x7512('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7512('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7512('0x5'))(_0x7512('0x6'));var config=require(_0x7512('0x7'));var jayson=require(_0x7512('0x8'));var client=jayson[_0x7512('0x9')][_0x7512('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e6779,_0x4d0765,_0x2d2e88){return new BPromise(function(_0x543586,_0x43ce62){return client['request'](_0x4e6779,_0x2d2e88)[_0x7512('0xb')](function(_0x1e41b5){logger[_0x7512('0xc')](_0x7512('0xd'),_0x4d0765,_0x7512('0xe'));logger[_0x7512('0xf')](_0x7512('0x10'),_0x4d0765,_0x7512('0xe'),JSON[_0x7512('0x11')](_0x1e41b5));if(_0x1e41b5[_0x7512('0x12')]){if(_0x1e41b5[_0x7512('0x12')][_0x7512('0x13')]===0x1f4){logger[_0x7512('0x12')](_0x7512('0xd'),_0x4d0765,_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);return _0x43ce62(_0x1e41b5[_0x7512('0x12')]['message']);}logger[_0x7512('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x4d0765,_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);return _0x543586(_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);}else{logger[_0x7512('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x4d0765,'request\x20sent');_0x543586(_0x1e41b5[_0x7512('0x15')][_0x7512('0x14')]);}})[_0x7512('0x16')](function(_0x3f8f8f){logger['error'](_0x7512('0xd'),_0x4d0765,_0x3f8f8f);_0x43ce62(_0x3f8f8f);});});} \ No newline at end of file +var _0x1df5=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x1df5,0xfd));var _0x51df=function(_0x2bb263,_0x50422c){_0x2bb263=_0x2bb263-0x0;var _0x422d00=_0x1df5[_0x2bb263];return _0x422d00;};'use strict';var _=require(_0x51df('0x0'));var util=require(_0x51df('0x1'));var moment=require(_0x51df('0x2'));var BPromise=require(_0x51df('0x3'));var rs=require(_0x51df('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51df('0x5'))['db'];var utils=require(_0x51df('0x6'));var logger=require(_0x51df('0x7'))(_0x51df('0x8'));var config=require(_0x51df('0x9'));var jayson=require(_0x51df('0xa'));var client=jayson[_0x51df('0xb')][_0x51df('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50961e,_0x1316c2,_0x53b879){return new BPromise(function(_0x42a74a,_0x3e7952){return client[_0x51df('0xd')](_0x50961e,_0x53b879)[_0x51df('0xe')](function(_0x7e1410){logger[_0x51df('0xf')](_0x51df('0x10'),_0x1316c2,_0x51df('0x11'));logger['debug'](_0x51df('0x12'),_0x1316c2,_0x51df('0x11'),JSON[_0x51df('0x13')](_0x7e1410));if(_0x7e1410[_0x51df('0x14')]){if(_0x7e1410[_0x51df('0x14')][_0x51df('0x15')]===0x1f4){logger[_0x51df('0x14')](_0x51df('0x10'),_0x1316c2,_0x7e1410[_0x51df('0x14')][_0x51df('0x16')]);return _0x3e7952(_0x7e1410[_0x51df('0x14')][_0x51df('0x16')]);}logger[_0x51df('0x14')](_0x51df('0x10'),_0x1316c2,_0x7e1410[_0x51df('0x14')]['message']);return _0x42a74a(_0x7e1410[_0x51df('0x14')][_0x51df('0x16')]);}else{logger['info'](_0x51df('0x10'),_0x1316c2,_0x51df('0x11'));_0x42a74a(_0x7e1410[_0x51df('0x17')]['message']);}})[_0x51df('0x18')](function(_0x353a81){logger[_0x51df('0x14')](_0x51df('0x10'),_0x1316c2,_0x353a81);_0x3e7952(_0x353a81);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 8909918..1bc08c8 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x7a54,0x106));var _0x47a5=function(_0x3d7980,_0x2255af){_0x3d7980=_0x3d7980-0x0;var _0x2429f4=_0x7a54[_0x3d7980];return _0x2429f4;};'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','./intDeskField.controller','get'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7a54,0x106));var _0x47a5=function(_0xe3228d,_0x24271d){_0xe3228d=_0xe3228d-0x0;var _0x3221bf=_0x7a54[_0xe3228d];return _0x3221bf;};'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/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index e02eb06..cec128f 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 _0x50fb=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x1bda8f,_0x2cbdcb){var _0x4b48a2=function(_0x57cc38){while(--_0x57cc38){_0x1bda8f['push'](_0x1bda8f['shift']());}};_0x4b48a2(++_0x2cbdcb);}(_0x50fb,0x98));var _0xb50f=function(_0x22c2cc,_0xc3d444){_0x22c2cc=_0x22c2cc-0x0;var _0x4f91c7=_0x50fb[_0x22c2cc];return _0x4f91c7;};'use strict';var Sequelize=require(_0xb50f('0x0'));module[_0xb50f('0x1')]={'type':{'type':Sequelize[_0xb50f('0x2')](_0xb50f('0x3'),'variable',_0xb50f('0x4'),_0xb50f('0x5'),_0xb50f('0x6')),'defaultValue':_0xb50f('0x3')},'content':{'type':Sequelize[_0xb50f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb50f('0x2')](_0xb50f('0x3'),'variable',_0xb50f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb50f('0x7')]},'nameField':{'type':Sequelize[_0xb50f('0x7')]},'customField':{'type':Sequelize[_0xb50f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb50f('0x7')]}}; \ No newline at end of file +var _0x011a=['customVariable','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x4d377d,_0x30998d){var _0x3174c5=function(_0x52b4ac){while(--_0x52b4ac){_0x4d377d['push'](_0x4d377d['shift']());}};_0x3174c5(++_0x30998d);}(_0x011a,0xbe));var _0xa011=function(_0x34053b,_0x9098d6){_0x34053b=_0x34053b-0x0;var _0x18970d=_0x011a[_0x34053b];return _0x18970d;};'use strict';var Sequelize=require(_0xa011('0x0'));module[_0xa011('0x1')]={'type':{'type':Sequelize[_0xa011('0x2')](_0xa011('0x3'),_0xa011('0x4'),'customVariable',_0xa011('0x5'),_0xa011('0x6')),'defaultValue':_0xa011('0x3')},'content':{'type':Sequelize[_0xa011('0x7')]},'key':{'type':Sequelize[_0xa011('0x7')]},'keyType':{'type':Sequelize[_0xa011('0x2')](_0xa011('0x3'),_0xa011('0x4'),_0xa011('0x8'))},'keyContent':{'type':Sequelize[_0xa011('0x7')]},'idField':{'type':Sequelize[_0xa011('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 53d2235..8f3e0f5 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 _0xd970=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','apply','reject','update','then','destroy','end','error','stack','name','send','render','merge','body','contact','agent','account','DeskField','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','include','find','create','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x477bb3,_0x1af649){var _0x3a2f31=function(_0x1ba1c4){while(--_0x1ba1c4){_0x477bb3['push'](_0x477bb3['shift']());}};_0x3a2f31(++_0x1af649);}(_0xd970,0x114));var _0x0d97=function(_0x136c99,_0x468cbd){_0x136c99=_0x136c99-0x0;var _0x38e6c1=_0xd970[_0x136c99];return _0x38e6c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d97('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d97('0x1'));var moment=require(_0x0d97('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0d97('0x3'));var util=require(_0x0d97('0x4'));var path=require(_0x0d97('0x5'));var sox=require(_0x0d97('0x6'));var csv=require(_0x0d97('0x7'));var ejs=require(_0x0d97('0x8'));var fs=require('fs');var fs_extra=require(_0x0d97('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0d97('0xa'));var jsforce=require(_0x0d97('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d97('0x7'));var querystring=require(_0x0d97('0xc'));var Papa=require(_0x0d97('0xd'));var Redis=require(_0x0d97('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0d97('0xf'));var as=require(_0x0d97('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d97('0x11'))(_0x0d97('0x12'));var utils=require(_0x0d97('0x13'));var config=require(_0x0d97('0x14'));var licenseUtil=require(_0x0d97('0x15'));var db=require(_0x0d97('0x16'))['db'];function respondWithStatusCode(_0x2985db,_0x3a6973){_0x3a6973=_0x3a6973||0xcc;return function(_0x92f912){if(_0x92f912){return _0x2985db[_0x0d97('0x17')](_0x3a6973);}return _0x2985db[_0x0d97('0x18')](_0x3a6973)['end']();};}function respondWithResult(_0x26739f,_0x14dedb){_0x14dedb=_0x14dedb||0xc8;return function(_0x5e01ca){if(_0x5e01ca){return _0x26739f[_0x0d97('0x18')](_0x14dedb)['json'](_0x5e01ca);}};}function respondWithFilteredResult(_0x138d5a,_0x466c88){return function(_0x347857){if(_0x347857){var _0x467cef=typeof _0x466c88[_0x0d97('0x19')]==='undefined'&&typeof _0x466c88[_0x0d97('0x1a')]===_0x0d97('0x1b');var _0x25e783=_0x347857[_0x0d97('0x1c')];var _0x4564d8=_0x467cef?0x0:_0x466c88['offset'];var _0x56a1a1=_0x467cef?_0x347857['count']:_0x466c88[_0x0d97('0x19')]+_0x466c88[_0x0d97('0x1a')];var _0x409a4f;if(_0x56a1a1>=_0x25e783){_0x56a1a1=_0x25e783;_0x409a4f=0xc8;}else{_0x409a4f=0xce;}_0x138d5a['status'](_0x409a4f);return _0x138d5a[_0x0d97('0x1d')]('Content-Range',_0x4564d8+'-'+_0x56a1a1+'/'+_0x25e783)['json'](_0x347857);}return null;};}function patchUpdates(_0x2ba41b){return function(_0x5db2c7){try{jsonpatch[_0x0d97('0x1e')](_0x5db2c7,_0x2ba41b,!![]);}catch(_0x4e13ed){return BPromise[_0x0d97('0x1f')](_0x4e13ed);}return _0x5db2c7['save']();};}function saveUpdates(_0x3ebfa4,_0x4e183e){return function(_0x32b2bc){if(_0x32b2bc){return _0x32b2bc[_0x0d97('0x20')](_0x3ebfa4)[_0x0d97('0x21')](function(_0x49c062){return _0x49c062;});}return null;};}function removeEntity(_0x4bfbb5,_0x5cb063){return function(_0x486f9e){if(_0x486f9e){return _0x486f9e[_0x0d97('0x22')]()[_0x0d97('0x21')](function(){_0x4bfbb5['status'](0xcc)[_0x0d97('0x23')]();});}};}function handleEntityNotFound(_0x4c51cf,_0x22eece){return function(_0x47ac48){if(!_0x47ac48){_0x4c51cf[_0x0d97('0x17')](0x194);}return _0x47ac48;};}function handleError(_0x39a3f9,_0x57be80){_0x57be80=_0x57be80||0x1f4;return function(_0x4ed90c){logger[_0x0d97('0x24')](_0x4ed90c[_0x0d97('0x25')]);if(_0x4ed90c[_0x0d97('0x26')]){delete _0x4ed90c['name'];}_0x39a3f9[_0x0d97('0x18')](_0x57be80)[_0x0d97('0x27')](_0x4ed90c);};}function getMustacheRender(_0x13745b,_0x3f0623){return Mustache[_0x0d97('0x28')](_0x13745b,_[_0x0d97('0x29')](_0x3f0623[_0x0d97('0x2a')],{'contact':_0x3f0623[_0x0d97('0x2b')],'message':_0x3f0623['message'],'agent':_0x3f0623[_0x0d97('0x2c')],'interaction':_0x3f0623['interaction'],'account':_0x3f0623[_0x0d97('0x2d')]}))||'';}exports['index']=function(_0x17910f,_0x5529c6){var _0x4c4331={},_0x4c9e69={},_0x35464e={'count':0x0,'rows':[]};var _0x3c68df=_['map'](db[_0x0d97('0x2e')][_0x0d97('0x2f')],function(_0x534ecc){return{'name':_0x534ecc[_0x0d97('0x30')],'type':_0x534ecc[_0x0d97('0x31')][_0x0d97('0x32')]};});_0x4c9e69[_0x0d97('0x33')]=_[_0x0d97('0x34')](_0x3c68df,_0x0d97('0x26'));_0x4c9e69[_0x0d97('0x35')]=_['keys'](_0x17910f['query']);_0x4c9e69['filters']=_[_0x0d97('0x36')](_0x4c9e69[_0x0d97('0x33')],_0x4c9e69[_0x0d97('0x35')]);_0x4c4331['attributes']=_[_0x0d97('0x36')](_0x4c9e69[_0x0d97('0x33')],qs[_0x0d97('0x37')](_0x17910f['query'][_0x0d97('0x37')]));_0x4c4331[_0x0d97('0x38')]=_0x4c4331['attributes'][_0x0d97('0x39')]?_0x4c4331[_0x0d97('0x38')]:_0x4c9e69['model'];if(!_0x17910f[_0x0d97('0x35')][_0x0d97('0x3a')]('nolimit')){_0x4c4331[_0x0d97('0x1a')]=qs[_0x0d97('0x1a')](_0x17910f[_0x0d97('0x35')]['limit']);_0x4c4331[_0x0d97('0x19')]=qs[_0x0d97('0x19')](_0x17910f[_0x0d97('0x35')]['offset']);}_0x4c4331['order']=qs['sort'](_0x17910f[_0x0d97('0x35')][_0x0d97('0x3b')]);_0x4c4331[_0x0d97('0x3c')]=qs['filters'](_['pick'](_0x17910f[_0x0d97('0x35')],_0x4c9e69[_0x0d97('0x3d')]),_0x3c68df);if(_0x17910f[_0x0d97('0x35')]['filter']){_0x4c4331['where']=_[_0x0d97('0x29')](_0x4c4331[_0x0d97('0x3c')],{'$or':_[_0x0d97('0x34')](_0x3c68df,function(_0x6778b4){if(_0x6778b4[_0x0d97('0x31')]!==_0x0d97('0x3e')){var _0x2836f8={};_0x2836f8[_0x6778b4[_0x0d97('0x26')]]={'$like':'%'+_0x17910f[_0x0d97('0x35')][_0x0d97('0x3f')]+'%'};return _0x2836f8;}})});}_0x4c4331=_[_0x0d97('0x29')]({},_0x4c4331,_0x17910f[_0x0d97('0x40')]);var _0x5e1507={'where':_0x4c4331[_0x0d97('0x3c')]};return db['DeskField']['count'](_0x5e1507)[_0x0d97('0x21')](function(_0x38058f){_0x35464e['count']=_0x38058f;if(_0x17910f[_0x0d97('0x35')]['includeAll']){_0x4c4331['include']=[{'all':!![]}];}return db['DeskField'][_0x0d97('0x41')](_0x4c4331);})[_0x0d97('0x21')](function(_0x1a6a0a){_0x35464e[_0x0d97('0x42')]=_0x1a6a0a;return _0x35464e;})[_0x0d97('0x21')](respondWithFilteredResult(_0x5529c6,_0x4c4331))[_0x0d97('0x43')](handleError(_0x5529c6,null));};exports[_0x0d97('0x44')]=function(_0x3d4610,_0x200642){var _0x47c2a5={'raw':!![],'where':{'id':_0x3d4610[_0x0d97('0x45')]['id']}},_0x257c70={};_0x257c70[_0x0d97('0x33')]=_[_0x0d97('0x46')](db['DeskField'][_0x0d97('0x2f')]);_0x257c70[_0x0d97('0x35')]=_[_0x0d97('0x46')](_0x3d4610[_0x0d97('0x35')]);_0x257c70['filters']=_[_0x0d97('0x36')](_0x257c70[_0x0d97('0x33')],_0x257c70['query']);_0x47c2a5[_0x0d97('0x38')]=_[_0x0d97('0x36')](_0x257c70[_0x0d97('0x33')],qs[_0x0d97('0x37')](_0x3d4610[_0x0d97('0x35')][_0x0d97('0x37')]));_0x47c2a5[_0x0d97('0x38')]=_0x47c2a5['attributes'][_0x0d97('0x39')]?_0x47c2a5[_0x0d97('0x38')]:_0x257c70[_0x0d97('0x33')];if(_0x3d4610[_0x0d97('0x35')]['includeAll']){_0x47c2a5[_0x0d97('0x47')]=[{'all':!![]}];}_0x47c2a5=_['merge']({},_0x47c2a5,_0x3d4610['options']);return db[_0x0d97('0x2e')][_0x0d97('0x48')](_0x47c2a5)['then'](handleEntityNotFound(_0x200642,null))['then'](respondWithResult(_0x200642,null))['catch'](handleError(_0x200642,null));};exports[_0x0d97('0x49')]=function(_0x1527d5,_0x218d14){return db[_0x0d97('0x2e')]['create'](_0x1527d5['body'],{})[_0x0d97('0x21')](respondWithResult(_0x218d14,0xc9))['catch'](handleError(_0x218d14,null));};exports['update']=function(_0x169bb5,_0x1924ad){if(_0x169bb5[_0x0d97('0x2a')]['id']){delete _0x169bb5[_0x0d97('0x2a')]['id'];}return db[_0x0d97('0x2e')][_0x0d97('0x48')]({'where':{'id':_0x169bb5[_0x0d97('0x45')]['id']}})[_0x0d97('0x21')](handleEntityNotFound(_0x1924ad,null))[_0x0d97('0x21')](saveUpdates(_0x169bb5['body'],null))[_0x0d97('0x21')](respondWithResult(_0x1924ad,null))[_0x0d97('0x43')](handleError(_0x1924ad,null));};exports['destroy']=function(_0x25c0af,_0x55577e){return db[_0x0d97('0x2e')][_0x0d97('0x48')]({'where':{'id':_0x25c0af['params']['id']}})[_0x0d97('0x21')](handleEntityNotFound(_0x55577e,null))['then'](removeEntity(_0x55577e,null))[_0x0d97('0x43')](handleError(_0x55577e,null));}; \ No newline at end of file +var _0xe6da=['rows','catch','show','params','rawAttributes','find','body','zip-dir','moment','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../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','Content-Range','apply','update','then','destroy','error','stack','name','send','merge','message','agent','interaction','account','index','DeskField','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll'];(function(_0x4ccbe2,_0x11eacf){var _0x134525=function(_0x5c9da9){while(--_0x5c9da9){_0x4ccbe2['push'](_0x4ccbe2['shift']());}};_0x134525(++_0x11eacf);}(_0xe6da,0x9d));var _0xae6d=function(_0x3dec4d,_0x4530d3){_0x3dec4d=_0x3dec4d-0x0;var _0x35cd0b=_0xe6da[_0x3dec4d];return _0x35cd0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae6d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae6d('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xae6d('0x2'));var path=require(_0xae6d('0x3'));var sox=require('sox');var csv=require(_0xae6d('0x4'));var ejs=require(_0xae6d('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae6d('0x6'));var squel=require(_0xae6d('0x7'));var crypto=require('crypto');var jsforce=require(_0xae6d('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xae6d('0x4'));var querystring=require(_0xae6d('0x9'));var Papa=require(_0xae6d('0xa'));var Redis=require(_0xae6d('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xae6d('0xc'));var as=require(_0xae6d('0xd'));var hardwareService=require(_0xae6d('0xe'));var logger=require(_0xae6d('0xf'))(_0xae6d('0x10'));var utils=require(_0xae6d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xae6d('0x12'));var db=require(_0xae6d('0x13'))['db'];function respondWithStatusCode(_0xfbee9a,_0x3ccf2c){_0x3ccf2c=_0x3ccf2c||0xcc;return function(_0x3476ca){if(_0x3476ca){return _0xfbee9a[_0xae6d('0x14')](_0x3ccf2c);}return _0xfbee9a[_0xae6d('0x15')](_0x3ccf2c)[_0xae6d('0x16')]();};}function respondWithResult(_0x483df0,_0x4c79ab){_0x4c79ab=_0x4c79ab||0xc8;return function(_0x3ca446){if(_0x3ca446){return _0x483df0[_0xae6d('0x15')](_0x4c79ab)[_0xae6d('0x17')](_0x3ca446);}};}function respondWithFilteredResult(_0x3c3a9d,_0x1179ea){return function(_0x58cf8f){if(_0x58cf8f){var _0x21e47b=typeof _0x1179ea[_0xae6d('0x18')]===_0xae6d('0x19')&&typeof _0x1179ea[_0xae6d('0x1a')]===_0xae6d('0x19');var _0x1ad84f=_0x58cf8f['count'];var _0x58ef10=_0x21e47b?0x0:_0x1179ea[_0xae6d('0x18')];var _0x85504e=_0x21e47b?_0x58cf8f['count']:_0x1179ea[_0xae6d('0x18')]+_0x1179ea[_0xae6d('0x1a')];var _0x127dc1;if(_0x85504e>=_0x1ad84f){_0x85504e=_0x1ad84f;_0x127dc1=0xc8;}else{_0x127dc1=0xce;}_0x3c3a9d[_0xae6d('0x15')](_0x127dc1);return _0x3c3a9d['set'](_0xae6d('0x1b'),_0x58ef10+'-'+_0x85504e+'/'+_0x1ad84f)[_0xae6d('0x17')](_0x58cf8f);}return null;};}function patchUpdates(_0x5c1083){return function(_0x501706){try{jsonpatch[_0xae6d('0x1c')](_0x501706,_0x5c1083,!![]);}catch(_0x1a46cd){return BPromise['reject'](_0x1a46cd);}return _0x501706['save']();};}function saveUpdates(_0x5afedd,_0x5b0689){return function(_0x30e783){if(_0x30e783){return _0x30e783[_0xae6d('0x1d')](_0x5afedd)[_0xae6d('0x1e')](function(_0x531d35){return _0x531d35;});}return null;};}function removeEntity(_0x169772,_0xcebfb7){return function(_0x4971d3){if(_0x4971d3){return _0x4971d3[_0xae6d('0x1f')]()[_0xae6d('0x1e')](function(){_0x169772[_0xae6d('0x15')](0xcc)[_0xae6d('0x16')]();});}};}function handleEntityNotFound(_0x498605,_0x1e5673){return function(_0x947a99){if(!_0x947a99){_0x498605[_0xae6d('0x14')](0x194);}return _0x947a99;};}function handleError(_0x3c3c2d,_0x180465){_0x180465=_0x180465||0x1f4;return function(_0x18481f){logger[_0xae6d('0x20')](_0x18481f[_0xae6d('0x21')]);if(_0x18481f['name']){delete _0x18481f[_0xae6d('0x22')];}_0x3c3c2d['status'](_0x180465)[_0xae6d('0x23')](_0x18481f);};}function getMustacheRender(_0x51d29e,_0x47ff45){return Mustache['render'](_0x51d29e,_[_0xae6d('0x24')](_0x47ff45['body'],{'contact':_0x47ff45['contact'],'message':_0x47ff45[_0xae6d('0x25')],'agent':_0x47ff45[_0xae6d('0x26')],'interaction':_0x47ff45[_0xae6d('0x27')],'account':_0x47ff45[_0xae6d('0x28')]}))||'';}exports[_0xae6d('0x29')]=function(_0x51180d,_0x3b3d06){var _0x34e16a={},_0xb06820={},_0x3f1f2b={'count':0x0,'rows':[]};var _0x3c016f=_['map'](db[_0xae6d('0x2a')]['rawAttributes'],function(_0xbd1903){return{'name':_0xbd1903[_0xae6d('0x2b')],'type':_0xbd1903[_0xae6d('0x2c')][_0xae6d('0x2d')]};});_0xb06820[_0xae6d('0x2e')]=_[_0xae6d('0x2f')](_0x3c016f,_0xae6d('0x22'));_0xb06820[_0xae6d('0x30')]=_[_0xae6d('0x31')](_0x51180d[_0xae6d('0x30')]);_0xb06820[_0xae6d('0x32')]=_['intersection'](_0xb06820[_0xae6d('0x2e')],_0xb06820[_0xae6d('0x30')]);_0x34e16a[_0xae6d('0x33')]=_[_0xae6d('0x34')](_0xb06820[_0xae6d('0x2e')],qs['fields'](_0x51180d[_0xae6d('0x30')][_0xae6d('0x35')]));_0x34e16a[_0xae6d('0x33')]=_0x34e16a[_0xae6d('0x33')][_0xae6d('0x36')]?_0x34e16a[_0xae6d('0x33')]:_0xb06820['model'];if(!_0x51180d[_0xae6d('0x30')][_0xae6d('0x37')](_0xae6d('0x38'))){_0x34e16a['limit']=qs[_0xae6d('0x1a')](_0x51180d[_0xae6d('0x30')][_0xae6d('0x1a')]);_0x34e16a[_0xae6d('0x18')]=qs['offset'](_0x51180d[_0xae6d('0x30')][_0xae6d('0x18')]);}_0x34e16a[_0xae6d('0x39')]=qs[_0xae6d('0x3a')](_0x51180d[_0xae6d('0x30')][_0xae6d('0x3a')]);_0x34e16a[_0xae6d('0x3b')]=qs[_0xae6d('0x32')](_[_0xae6d('0x3c')](_0x51180d[_0xae6d('0x30')],_0xb06820[_0xae6d('0x32')]),_0x3c016f);if(_0x51180d['query'][_0xae6d('0x3d')]){_0x34e16a[_0xae6d('0x3b')]=_[_0xae6d('0x24')](_0x34e16a[_0xae6d('0x3b')],{'$or':_[_0xae6d('0x2f')](_0x3c016f,function(_0x2e9809){if(_0x2e9809[_0xae6d('0x2c')]!==_0xae6d('0x3e')){var _0x2d66d4={};_0x2d66d4[_0x2e9809[_0xae6d('0x22')]]={'$like':'%'+_0x51180d[_0xae6d('0x30')]['filter']+'%'};return _0x2d66d4;}})});}_0x34e16a=_[_0xae6d('0x24')]({},_0x34e16a,_0x51180d[_0xae6d('0x3f')]);var _0x41952c={'where':_0x34e16a[_0xae6d('0x3b')]};return db[_0xae6d('0x2a')][_0xae6d('0x40')](_0x41952c)[_0xae6d('0x1e')](function(_0x55c359){_0x3f1f2b[_0xae6d('0x40')]=_0x55c359;if(_0x51180d['query'][_0xae6d('0x41')]){_0x34e16a[_0xae6d('0x42')]=[{'all':!![]}];}return db[_0xae6d('0x2a')][_0xae6d('0x43')](_0x34e16a);})['then'](function(_0x22ec4b){_0x3f1f2b[_0xae6d('0x44')]=_0x22ec4b;return _0x3f1f2b;})['then'](respondWithFilteredResult(_0x3b3d06,_0x34e16a))[_0xae6d('0x45')](handleError(_0x3b3d06,null));};exports[_0xae6d('0x46')]=function(_0x10065e,_0x14e941){var _0x4908b1={'raw':!![],'where':{'id':_0x10065e[_0xae6d('0x47')]['id']}},_0x1b3759={};_0x1b3759[_0xae6d('0x2e')]=_['keys'](db[_0xae6d('0x2a')][_0xae6d('0x48')]);_0x1b3759[_0xae6d('0x30')]=_[_0xae6d('0x31')](_0x10065e[_0xae6d('0x30')]);_0x1b3759['filters']=_[_0xae6d('0x34')](_0x1b3759[_0xae6d('0x2e')],_0x1b3759[_0xae6d('0x30')]);_0x4908b1['attributes']=_[_0xae6d('0x34')](_0x1b3759[_0xae6d('0x2e')],qs[_0xae6d('0x35')](_0x10065e[_0xae6d('0x30')][_0xae6d('0x35')]));_0x4908b1[_0xae6d('0x33')]=_0x4908b1[_0xae6d('0x33')][_0xae6d('0x36')]?_0x4908b1['attributes']:_0x1b3759[_0xae6d('0x2e')];if(_0x10065e[_0xae6d('0x30')][_0xae6d('0x41')]){_0x4908b1[_0xae6d('0x42')]=[{'all':!![]}];}_0x4908b1=_['merge']({},_0x4908b1,_0x10065e[_0xae6d('0x3f')]);return db[_0xae6d('0x2a')][_0xae6d('0x49')](_0x4908b1)[_0xae6d('0x1e')](handleEntityNotFound(_0x14e941,null))[_0xae6d('0x1e')](respondWithResult(_0x14e941,null))[_0xae6d('0x45')](handleError(_0x14e941,null));};exports['create']=function(_0x3465b2,_0xfe93a7){return db[_0xae6d('0x2a')]['create'](_0x3465b2[_0xae6d('0x4a')],{})['then'](respondWithResult(_0xfe93a7,0xc9))['catch'](handleError(_0xfe93a7,null));};exports[_0xae6d('0x1d')]=function(_0x1017c,_0x54857f){if(_0x1017c[_0xae6d('0x4a')]['id']){delete _0x1017c['body']['id'];}return db[_0xae6d('0x2a')][_0xae6d('0x49')]({'where':{'id':_0x1017c['params']['id']}})['then'](handleEntityNotFound(_0x54857f,null))[_0xae6d('0x1e')](saveUpdates(_0x1017c[_0xae6d('0x4a')],null))[_0xae6d('0x1e')](respondWithResult(_0x54857f,null))[_0xae6d('0x45')](handleError(_0x54857f,null));};exports[_0xae6d('0x1f')]=function(_0x46cee3,_0x1114dc){return db[_0xae6d('0x2a')][_0xae6d('0x49')]({'where':{'id':_0x46cee3[_0xae6d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1114dc,null))[_0xae6d('0x1e')](removeEntity(_0x1114dc,null))[_0xae6d('0x45')](handleError(_0x1114dc,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 3d09554..8984dcf 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 _0xd842=['bluebird','path','rimraf','./intDeskField.attributes','exports','define','DeskField','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x5c28fa,_0x3fdcdc){var _0x51d03f=function(_0x45cea3){while(--_0x45cea3){_0x5c28fa['push'](_0x5c28fa['shift']());}};_0x51d03f(++_0x3fdcdc);}(_0xd842,0xe6));var _0x2d84=function(_0x2e5a24,_0xf7ac98){_0x2e5a24=_0x2e5a24-0x0;var _0x25204a=_0xd842[_0x2e5a24];return _0x25204a;};'use strict';var _=require(_0x2d84('0x0'));var util=require('util');var logger=require(_0x2d84('0x1'))(_0x2d84('0x2'));var moment=require(_0x2d84('0x3'));var BPromise=require(_0x2d84('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d84('0x5'));var rimraf=require(_0x2d84('0x6'));var config=require('../../config/environment');var attributes=require(_0x2d84('0x7'));module[_0x2d84('0x8')]=function(_0x22460e,_0x3d6328){return _0x22460e[_0x2d84('0x9')](_0x2d84('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x2d84('0xb'),_0x2d84('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf861=['../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xf861,0x107));var _0x1f86=function(_0x35f1c3,_0x31bc84){_0x35f1c3=_0x35f1c3-0x0;var _0x5edf15=_0xf861[_0x35f1c3];return _0x5edf15;};'use strict';var _=require(_0x1f86('0x0'));var util=require('util');var logger=require(_0x1f86('0x1'))(_0x1f86('0x2'));var moment=require(_0x1f86('0x3'));var BPromise=require(_0x1f86('0x4'));var rp=require(_0x1f86('0x5'));var fs=require('fs');var path=require(_0x1f86('0x6'));var rimraf=require('rimraf');var config=require(_0x1f86('0x7'));var attributes=require(_0x1f86('0x8'));module[_0x1f86('0x9')]=function(_0x2e5026,_0x2c56d6){return _0x2e5026['define'](_0x1f86('0xa'),attributes,{'tableName':_0x1f86('0xb'),'paranoid':![],'indexes':[{'name':_0x1f86('0xc'),'fields':[_0x1f86('0xd'),_0x1f86('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 1cd5c7c..38e0a24 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 _0x2a79=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a79,0xc5));var _0x92a7=function(_0x5b6f7b,_0x385adc){_0x5b6f7b=_0x5b6f7b-0x0;var _0x402d08=_0x2a79[_0x5b6f7b];return _0x402d08;};'use strict';var _=require(_0x92a7('0x0'));var util=require(_0x92a7('0x1'));var moment=require(_0x92a7('0x2'));var BPromise=require(_0x92a7('0x3'));var rs=require(_0x92a7('0x4'));var fs=require('fs');var Redis=require(_0x92a7('0x5'));var db=require(_0x92a7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x92a7('0x7'))(_0x92a7('0x8'));var config=require(_0x92a7('0x9'));var jayson=require(_0x92a7('0xa'));var client=jayson['client'][_0x92a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a3b6d,_0x7c6f46,_0x47ee01){return new BPromise(function(_0x195b5f,_0x12aaae){return client['request'](_0x8a3b6d,_0x47ee01)[_0x92a7('0xc')](function(_0x210aac){logger[_0x92a7('0xd')](_0x92a7('0xe'),_0x7c6f46,_0x92a7('0xf'));logger[_0x92a7('0x10')](_0x92a7('0x11'),_0x7c6f46,'request\x20sent',JSON[_0x92a7('0x12')](_0x210aac));if(_0x210aac[_0x92a7('0x13')]){if(_0x210aac['error'][_0x92a7('0x14')]===0x1f4){logger[_0x92a7('0x13')](_0x92a7('0xe'),_0x7c6f46,_0x210aac['error'][_0x92a7('0x15')]);return _0x12aaae(_0x210aac['error'][_0x92a7('0x15')]);}logger[_0x92a7('0x13')]('DeskField,\x20%s,\x20%s',_0x7c6f46,_0x210aac[_0x92a7('0x13')][_0x92a7('0x15')]);return _0x195b5f(_0x210aac[_0x92a7('0x13')][_0x92a7('0x15')]);}else{logger[_0x92a7('0xd')](_0x92a7('0xe'),_0x7c6f46,_0x92a7('0xf'));_0x195b5f(_0x210aac[_0x92a7('0x16')]['message']);}})[_0x92a7('0x17')](function(_0x18fe96){logger[_0x92a7('0x13')]('DeskField,\x20%s,\x20%s',_0x7c6f46,_0x18fe96);_0x12aaae(_0x18fe96);});});} \ No newline at end of file +var _0x86ce=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4d2d31,_0x133773){var _0x5f195b=function(_0x58a74){while(--_0x58a74){_0x4d2d31['push'](_0x4d2d31['shift']());}};_0x5f195b(++_0x133773);}(_0x86ce,0xfe));var _0xe86c=function(_0xbd77c1,_0x50b969){_0xbd77c1=_0xbd77c1-0x0;var _0x47fa83=_0x86ce[_0xbd77c1];return _0x47fa83;};'use strict';var _=require(_0xe86c('0x0'));var util=require(_0xe86c('0x1'));var moment=require(_0xe86c('0x2'));var BPromise=require(_0xe86c('0x3'));var rs=require(_0xe86c('0x4'));var fs=require('fs');var Redis=require(_0xe86c('0x5'));var db=require(_0xe86c('0x6'))['db'];var utils=require(_0xe86c('0x7'));var logger=require(_0xe86c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe86c('0x9'));var client=jayson[_0xe86c('0xa')][_0xe86c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4189a0,_0x1927a0,_0x403e28){return new BPromise(function(_0x52e73b,_0x194707){return client[_0xe86c('0xc')](_0x4189a0,_0x403e28)[_0xe86c('0xd')](function(_0x3541a4){logger[_0xe86c('0xe')](_0xe86c('0xf'),_0x1927a0,'request\x20sent');logger[_0xe86c('0x10')](_0xe86c('0x11'),_0x1927a0,_0xe86c('0x12'),JSON[_0xe86c('0x13')](_0x3541a4));if(_0x3541a4[_0xe86c('0x14')]){if(_0x3541a4[_0xe86c('0x14')][_0xe86c('0x15')]===0x1f4){logger[_0xe86c('0x14')](_0xe86c('0xf'),_0x1927a0,_0x3541a4[_0xe86c('0x14')][_0xe86c('0x16')]);return _0x194707(_0x3541a4[_0xe86c('0x14')][_0xe86c('0x16')]);}logger['error'](_0xe86c('0xf'),_0x1927a0,_0x3541a4[_0xe86c('0x14')][_0xe86c('0x16')]);return _0x52e73b(_0x3541a4[_0xe86c('0x14')]['message']);}else{logger['info'](_0xe86c('0xf'),_0x1927a0,'request\x20sent');_0x52e73b(_0x3541a4[_0xe86c('0x17')][_0xe86c('0x16')]);}})[_0xe86c('0x18')](function(_0x293fde){logger[_0xe86c('0x14')](_0xe86c('0xf'),_0x1927a0,_0x293fde);_0x194707(_0x293fde);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 7d210c3..bfe6257 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 _0xb4e5=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','addConfiguration','put','/:id','update','delete'];(function(_0x328eb3,_0x1b2bd6){var _0x3d18c1=function(_0x4f7483){while(--_0x4f7483){_0x328eb3['push'](_0x328eb3['shift']());}};_0x3d18c1(++_0x1b2bd6);}(_0xb4e5,0xde));var _0x5b4e=function(_0x26137a,_0x2dab64){_0x26137a=_0x26137a-0x0;var _0x25ecdb=_0xb4e5[_0x26137a];return _0x25ecdb;};'use strict';var multer=require('multer');var util=require(_0x5b4e('0x0'));var path=require(_0x5b4e('0x1'));var timeout=require(_0x5b4e('0x2'));var express=require(_0x5b4e('0x3'));var router=express[_0x5b4e('0x4')]();var fs_extra=require(_0x5b4e('0x5'));var auth=require(_0x5b4e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b4e('0x7'));router[_0x5b4e('0x8')]('/',auth[_0x5b4e('0x9')](),controller[_0x5b4e('0xa')]);router[_0x5b4e('0x8')]('/:id',auth[_0x5b4e('0x9')](),controller[_0x5b4e('0xb')]);router['get'](_0x5b4e('0xc'),auth[_0x5b4e('0x9')](),controller[_0x5b4e('0xd')]);router['get'](_0x5b4e('0xe'),auth[_0x5b4e('0x9')](),controller['getFields']);router['post']('/',auth[_0x5b4e('0x9')](),controller['create']);router['post']('/:id/configurations',auth[_0x5b4e('0x9')](),controller[_0x5b4e('0xf')]);router[_0x5b4e('0x10')](_0x5b4e('0x11'),auth[_0x5b4e('0x9')](),controller[_0x5b4e('0x12')]);router[_0x5b4e('0x13')](_0x5b4e('0x11'),auth[_0x5b4e('0x9')](),controller[_0x5b4e('0x14')]);module[_0x5b4e('0x15')]=router; \ No newline at end of file +var _0x5c3a=['getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x287ddf,_0x1808c6){var _0x26a6ac=function(_0x3f3462){while(--_0x3f3462){_0x287ddf['push'](_0x287ddf['shift']());}};_0x26a6ac(++_0x1808c6);}(_0x5c3a,0x1ac));var _0xa5c3=function(_0x46ac43,_0x356e9d){_0x46ac43=_0x46ac43-0x0;var _0x1543b1=_0x5c3a[_0x46ac43];return _0x1543b1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa5c3('0x0'));var timeout=require(_0xa5c3('0x1'));var express=require(_0xa5c3('0x2'));var router=express['Router']();var fs_extra=require(_0xa5c3('0x3'));var auth=require(_0xa5c3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa5c3('0x5'));var controller=require(_0xa5c3('0x6'));router[_0xa5c3('0x7')]('/',auth[_0xa5c3('0x8')](),controller[_0xa5c3('0x9')]);router[_0xa5c3('0x7')]('/:id',auth[_0xa5c3('0x8')](),controller[_0xa5c3('0xa')]);router[_0xa5c3('0x7')]('/:id/configurations',auth[_0xa5c3('0x8')](),controller['getConfigurations']);router[_0xa5c3('0x7')](_0xa5c3('0xb'),auth[_0xa5c3('0x8')](),controller[_0xa5c3('0xc')]);router[_0xa5c3('0xd')]('/',auth['isAuthenticated'](),controller[_0xa5c3('0xe')]);router[_0xa5c3('0xd')](_0xa5c3('0xf'),auth['isAuthenticated'](),controller[_0xa5c3('0x10')]);router['put'](_0xa5c3('0x11'),auth[_0xa5c3('0x8')](),controller[_0xa5c3('0x12')]);router[_0xa5c3('0x13')](_0xa5c3('0x11'),auth[_0xa5c3('0x8')](),controller[_0xa5c3('0x14')]);module[_0xa5c3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index a29ceaf..f9cf5cf 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 _0x24e9=['sequelize','exports','STRING'];(function(_0x18f667,_0x5f59fc){var _0x3608b6=function(_0x5ce0bf){while(--_0x5ce0bf){_0x18f667['push'](_0x18f667['shift']());}};_0x3608b6(++_0x5f59fc);}(_0x24e9,0x66));var _0x924e=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0x24e9[_0x151721];return _0x2deaa7;};'use strict';var Sequelize=require(_0x924e('0x0'));module[_0x924e('0x1')]={'name':{'type':Sequelize[_0x924e('0x2')]},'username':{'type':Sequelize[_0x924e('0x2')]},'password':{'type':Sequelize[_0x924e('0x2')]},'remoteUri':{'type':Sequelize[_0x924e('0x2')]},'tenantId':{'type':Sequelize[_0x924e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x924e('0x2')]},'serverUrl':{'type':Sequelize[_0x924e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x924e('0x2')]}}; \ No newline at end of file +var _0x30a0=['exports','STRING','sequelize'];(function(_0x20abea,_0x48795e){var _0x1382f7=function(_0x355e90){while(--_0x355e90){_0x20abea['push'](_0x20abea['shift']());}};_0x1382f7(++_0x48795e);}(_0x30a0,0xda));var _0x030a=function(_0x436eec,_0x4dcdda){_0x436eec=_0x436eec-0x0;var _0x1b6eec=_0x30a0[_0x436eec];return _0x1b6eec;};'use strict';var Sequelize=require(_0x030a('0x0'));module[_0x030a('0x1')]={'name':{'type':Sequelize[_0x030a('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x030a('0x2')]},'remoteUri':{'type':Sequelize[_0x030a('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x030a('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 2dfbef4..209e86d 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 _0xbff7=['channel','Descriptions','Dynamics365Field','getFields','ticketType','incident','Incident','title','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','billedserviceunits','contactidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','password','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','username','access_token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false','DisplayName','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','request','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Account,\x20%s,\x20%s','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','render','body','contact','agent','account','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','show','params','merge','find','create','getConfigurations','findOne','Dynamics365Configuration','nolimit','AccountId','Subjects','getSubjects'];(function(_0x596f3f,_0x53c5bf){var _0x2c1225=function(_0x211f6d){while(--_0x211f6d){_0x596f3f['push'](_0x596f3f['shift']());}};_0x2c1225(++_0x53c5bf);}(_0xbff7,0x157));var _0x7bff=function(_0x2921b6,_0xf37d04){_0x2921b6=_0x2921b6-0x0;var _0x776fe1=_0xbff7[_0x2921b6];return _0x776fe1;};'use strict';var emlformat=require(_0x7bff('0x0'));var rimraf=require(_0x7bff('0x1'));var zipdir=require(_0x7bff('0x2'));var jsonpatch=require(_0x7bff('0x3'));var rp=require(_0x7bff('0x4'));var moment=require('moment');var BPromise=require(_0x7bff('0x5'));var Mustache=require(_0x7bff('0x6'));var util=require(_0x7bff('0x7'));var path=require('path');var sox=require(_0x7bff('0x8'));var csv=require(_0x7bff('0x9'));var ejs=require(_0x7bff('0xa'));var fs=require('fs');var fs_extra=require(_0x7bff('0xb'));var _=require(_0x7bff('0xc'));var squel=require(_0x7bff('0xd'));var crypto=require('crypto');var jsforce=require(_0x7bff('0xe'));var deskjs=require(_0x7bff('0xf'));var toCsv=require(_0x7bff('0x9'));var querystring=require(_0x7bff('0x10'));var Papa=require('papaparse');var Redis=require(_0x7bff('0x11'));var authService=require(_0x7bff('0x12'));var qs=require(_0x7bff('0x13'));var as=require(_0x7bff('0x14'));var hardwareService=require(_0x7bff('0x15'));var logger=require(_0x7bff('0x16'))(_0x7bff('0x17'));var utils=require('../../config/utils');var config=require(_0x7bff('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7bff('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7bff('0x1a'));var client=jayson[_0x7bff('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e98a2,_0x32654e,_0x1a3573,_0x1dc1db){return new BPromise(function(_0x283a1b,_0x522cce){var _0x171f18=_0x1dc1db||client;return _0x171f18[_0x7bff('0x1c')](_0x1e98a2,_0x1a3573)['then'](function(_0x4bbb5f){logger[_0x7bff('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0x32654e,_0x7bff('0x1e'));logger[_0x7bff('0x1f')](_0x7bff('0x20'),_0x32654e,_0x7bff('0x1e'),JSON[_0x7bff('0x21')](_0x4bbb5f));if(_0x4bbb5f[_0x7bff('0x22')]){if(_0x4bbb5f['error']['code']===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x32654e,_0x4bbb5f[_0x7bff('0x22')][_0x7bff('0x23')]);return _0x522cce(_0x4bbb5f[_0x7bff('0x22')][_0x7bff('0x23')]);}logger[_0x7bff('0x22')](_0x7bff('0x24'),_0x32654e,_0x4bbb5f['error'][_0x7bff('0x23')]);return _0x283a1b(_0x4bbb5f[_0x7bff('0x22')][_0x7bff('0x23')]);}else{logger[_0x7bff('0x1d')](_0x7bff('0x24'),_0x32654e,_0x7bff('0x1e'));_0x283a1b(_0x4bbb5f[_0x7bff('0x25')][_0x7bff('0x23')]);}})[_0x7bff('0x26')](function(_0x59da0d){logger[_0x7bff('0x22')](_0x7bff('0x24'),_0x32654e,_0x59da0d);_0x522cce(_0x59da0d);});});}function respondWithStatusCode(_0x5879ea,_0x51cd11){_0x51cd11=_0x51cd11||0xcc;return function(_0x39f09f){if(_0x39f09f){return _0x5879ea['sendStatus'](_0x51cd11);}return _0x5879ea['status'](_0x51cd11)['end']();};}function respondWithResult(_0x10d1d4,_0x50f1c2){_0x50f1c2=_0x50f1c2||0xc8;return function(_0x1ff5c2){if(_0x1ff5c2){return _0x10d1d4[_0x7bff('0x27')](_0x50f1c2)[_0x7bff('0x28')](_0x1ff5c2);}};}function respondWithFilteredResult(_0x3260df,_0x45d182){return function(_0x261152){if(_0x261152){var _0x3dc195=typeof _0x45d182['offset']===_0x7bff('0x29')&&typeof _0x45d182[_0x7bff('0x2a')]===_0x7bff('0x29');var _0x1b98ec=_0x261152[_0x7bff('0x2b')];var _0xbf2536=_0x3dc195?0x0:_0x45d182[_0x7bff('0x2c')];var _0x39988e=_0x3dc195?_0x261152[_0x7bff('0x2b')]:_0x45d182[_0x7bff('0x2c')]+_0x45d182['limit'];var _0x37dd80;if(_0x39988e>=_0x1b98ec){_0x39988e=_0x1b98ec;_0x37dd80=0xc8;}else{_0x37dd80=0xce;}_0x3260df[_0x7bff('0x27')](_0x37dd80);return _0x3260df[_0x7bff('0x2d')](_0x7bff('0x2e'),_0xbf2536+'-'+_0x39988e+'/'+_0x1b98ec)[_0x7bff('0x28')](_0x261152);}return null;};}function patchUpdates(_0x49eca2){return function(_0x2cbbe3){try{jsonpatch[_0x7bff('0x2f')](_0x2cbbe3,_0x49eca2,!![]);}catch(_0x113ee1){return BPromise['reject'](_0x113ee1);}return _0x2cbbe3['save']();};}function saveUpdates(_0x2ea72b,_0x8cf6b4){return function(_0x1d2ca1){if(_0x1d2ca1){return _0x1d2ca1[_0x7bff('0x30')](_0x2ea72b)[_0x7bff('0x31')](function(_0x42ba92){return _0x42ba92;});}return null;};}function removeEntity(_0x435ecf,_0x457e49){return function(_0x1cc7cb){if(_0x1cc7cb){return _0x1cc7cb[_0x7bff('0x32')]()[_0x7bff('0x31')](function(){_0x435ecf[_0x7bff('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36bb29,_0x3aee64){return function(_0x154bf9){if(!_0x154bf9){_0x36bb29['sendStatus'](0x194);}return _0x154bf9;};}function handleError(_0x491424,_0x19c46a){_0x19c46a=_0x19c46a||0x1f4;return function(_0xab2b67){logger[_0x7bff('0x22')](_0xab2b67[_0x7bff('0x33')]);if(_0xab2b67['name']){delete _0xab2b67[_0x7bff('0x34')];}_0x491424[_0x7bff('0x27')](_0x19c46a)[_0x7bff('0x35')](_0xab2b67);};}function getMustacheRender(_0x460463,_0x49f08d){return Mustache[_0x7bff('0x36')](_0x460463,_['merge'](_0x49f08d[_0x7bff('0x37')],{'contact':_0x49f08d[_0x7bff('0x38')],'message':_0x49f08d['message'],'agent':_0x49f08d[_0x7bff('0x39')],'interaction':_0x49f08d['interaction'],'account':_0x49f08d[_0x7bff('0x3a')]}))||'';}exports['index']=function(_0x1f5efb,_0x54398e){var _0x21f5a={},_0x3a087c={},_0x4b9186={'count':0x0,'rows':[]};var _0x555ea1=_[_0x7bff('0x3b')](db[_0x7bff('0x3c')][_0x7bff('0x3d')],function(_0x5318ca){return{'name':_0x5318ca[_0x7bff('0x3e')],'type':_0x5318ca[_0x7bff('0x3f')]['key']};});_0x3a087c[_0x7bff('0x40')]=_[_0x7bff('0x3b')](_0x555ea1,_0x7bff('0x34'));_0x3a087c[_0x7bff('0x41')]=_[_0x7bff('0x42')](_0x1f5efb[_0x7bff('0x41')]);_0x3a087c[_0x7bff('0x43')]=_[_0x7bff('0x44')](_0x3a087c[_0x7bff('0x40')],_0x3a087c['query']);_0x21f5a[_0x7bff('0x45')]=_[_0x7bff('0x44')](_0x3a087c[_0x7bff('0x40')],qs['fields'](_0x1f5efb['query'][_0x7bff('0x46')]));_0x21f5a['attributes']=_0x21f5a['attributes'][_0x7bff('0x47')]?_0x21f5a[_0x7bff('0x45')]:_0x3a087c[_0x7bff('0x40')];if(!_0x1f5efb[_0x7bff('0x41')][_0x7bff('0x48')]('nolimit')){_0x21f5a[_0x7bff('0x2a')]=qs[_0x7bff('0x2a')](_0x1f5efb[_0x7bff('0x41')]['limit']);_0x21f5a[_0x7bff('0x2c')]=qs[_0x7bff('0x2c')](_0x1f5efb[_0x7bff('0x41')][_0x7bff('0x2c')]);}_0x21f5a[_0x7bff('0x49')]=qs[_0x7bff('0x4a')](_0x1f5efb[_0x7bff('0x41')]['sort']);_0x21f5a[_0x7bff('0x4b')]=qs['filters'](_[_0x7bff('0x4c')](_0x1f5efb[_0x7bff('0x41')],_0x3a087c['filters']),_0x555ea1);if(_0x1f5efb['query']['filter']){_0x21f5a[_0x7bff('0x4b')]=_['merge'](_0x21f5a['where'],{'$or':_['map'](_0x555ea1,function(_0x3901df){if(_0x3901df[_0x7bff('0x3f')]!==_0x7bff('0x4d')){var _0x8bbe7b={};_0x8bbe7b[_0x3901df[_0x7bff('0x34')]]={'$like':'%'+_0x1f5efb[_0x7bff('0x41')][_0x7bff('0x4e')]+'%'};return _0x8bbe7b;}})});}_0x21f5a=_['merge']({},_0x21f5a,_0x1f5efb[_0x7bff('0x4f')]);var _0x2457ea={'where':_0x21f5a['where']};return db[_0x7bff('0x3c')][_0x7bff('0x2b')](_0x2457ea)[_0x7bff('0x31')](function(_0x4f4c2d){_0x4b9186[_0x7bff('0x2b')]=_0x4f4c2d;if(_0x1f5efb[_0x7bff('0x41')][_0x7bff('0x50')]){_0x21f5a[_0x7bff('0x51')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x21f5a);})[_0x7bff('0x31')](function(_0x139cd0){_0x4b9186[_0x7bff('0x52')]=_0x139cd0;return _0x4b9186;})['then'](respondWithFilteredResult(_0x54398e,_0x21f5a))[_0x7bff('0x26')](handleError(_0x54398e,null));};exports[_0x7bff('0x53')]=function(_0x2360bc,_0x31fde6){var _0x44adff={'raw':![],'where':{'id':_0x2360bc[_0x7bff('0x54')]['id']}},_0x5a146f={};_0x5a146f['model']=_['keys'](db[_0x7bff('0x3c')][_0x7bff('0x3d')]);_0x5a146f[_0x7bff('0x41')]=_[_0x7bff('0x42')](_0x2360bc[_0x7bff('0x41')]);_0x5a146f[_0x7bff('0x43')]=_[_0x7bff('0x44')](_0x5a146f[_0x7bff('0x40')],_0x5a146f['query']);_0x44adff['attributes']=_[_0x7bff('0x44')](_0x5a146f[_0x7bff('0x40')],qs[_0x7bff('0x46')](_0x2360bc[_0x7bff('0x41')][_0x7bff('0x46')]));_0x44adff[_0x7bff('0x45')]=_0x44adff['attributes'][_0x7bff('0x47')]?_0x44adff[_0x7bff('0x45')]:_0x5a146f['model'];if(_0x2360bc['query'][_0x7bff('0x50')]){_0x44adff['include']=[{'all':!![]}];}_0x44adff=_[_0x7bff('0x55')]({},_0x44adff,_0x2360bc[_0x7bff('0x4f')]);return db['Dynamics365Account'][_0x7bff('0x56')](_0x44adff)[_0x7bff('0x31')](handleEntityNotFound(_0x31fde6,null))[_0x7bff('0x31')](respondWithResult(_0x31fde6,null))[_0x7bff('0x26')](handleError(_0x31fde6,null));};exports['create']=function(_0x9812eb,_0x5e00e2){return db[_0x7bff('0x3c')][_0x7bff('0x57')](_0x9812eb['body'],{})[_0x7bff('0x31')](respondWithResult(_0x5e00e2,0xc9))[_0x7bff('0x26')](handleError(_0x5e00e2,null));};exports['update']=function(_0x9b6cb8,_0xc766b7){if(_0x9b6cb8[_0x7bff('0x37')]['id']){delete _0x9b6cb8['body']['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x9b6cb8[_0x7bff('0x54')]['id']}})['then'](handleEntityNotFound(_0xc766b7,null))[_0x7bff('0x31')](saveUpdates(_0x9b6cb8['body'],null))[_0x7bff('0x31')](respondWithResult(_0xc766b7,null))[_0x7bff('0x26')](handleError(_0xc766b7,null));};exports[_0x7bff('0x32')]=function(_0x2ae5ed,_0x33a0c3){return db[_0x7bff('0x3c')][_0x7bff('0x56')]({'where':{'id':_0x2ae5ed['params']['id']}})[_0x7bff('0x31')](handleEntityNotFound(_0x33a0c3,null))[_0x7bff('0x31')](removeEntity(_0x33a0c3,null))[_0x7bff('0x26')](handleError(_0x33a0c3,null));};exports[_0x7bff('0x58')]=function(_0x3026b2,_0x485987,_0x42232c){var _0x1e2599={};var _0x2642a={};var _0x24acbd;var _0x196582;return db[_0x7bff('0x3c')][_0x7bff('0x59')]({'where':{'id':_0x3026b2['params']['id']}})[_0x7bff('0x31')](handleEntityNotFound(_0x485987,null))[_0x7bff('0x31')](function(_0x2cec5c){if(_0x2cec5c){_0x24acbd=_0x2cec5c;_0x2642a[_0x7bff('0x40')]=_['keys'](db[_0x7bff('0x5a')][_0x7bff('0x3d')]);_0x2642a['query']=_[_0x7bff('0x42')](_0x3026b2[_0x7bff('0x41')]);_0x2642a[_0x7bff('0x43')]=_[_0x7bff('0x44')](_0x2642a[_0x7bff('0x40')],_0x2642a[_0x7bff('0x41')]);_0x1e2599[_0x7bff('0x45')]=_[_0x7bff('0x44')](_0x2642a[_0x7bff('0x40')],qs[_0x7bff('0x46')](_0x3026b2[_0x7bff('0x41')][_0x7bff('0x46')]));_0x1e2599['attributes']=_0x1e2599[_0x7bff('0x45')][_0x7bff('0x47')]?_0x1e2599['attributes']:_0x2642a['model'];_0x1e2599[_0x7bff('0x49')]=qs[_0x7bff('0x4a')](_0x3026b2['query']['sort']);_0x1e2599[_0x7bff('0x4b')]=qs[_0x7bff('0x43')](_[_0x7bff('0x4c')](_0x3026b2[_0x7bff('0x41')],_0x2642a[_0x7bff('0x43')]));if(_0x3026b2['query'][_0x7bff('0x4e')]){_0x1e2599[_0x7bff('0x4b')]=_[_0x7bff('0x55')](_0x1e2599[_0x7bff('0x4b')],{'$or':_[_0x7bff('0x3b')](_0x1e2599[_0x7bff('0x45')],function(_0x5cff83){var _0x14260e={};_0x14260e[_0x5cff83]={'$like':'%'+_0x3026b2[_0x7bff('0x41')][_0x7bff('0x4e')]+'%'};return _0x14260e;})});}_0x1e2599=_[_0x7bff('0x55')]({},_0x1e2599,_0x3026b2[_0x7bff('0x4f')]);return _0x24acbd[_0x7bff('0x58')](_0x1e2599);}})[_0x7bff('0x31')](function(_0x31a264){if(_0x31a264){_0x196582=_0x31a264[_0x7bff('0x47')];if(!_0x3026b2[_0x7bff('0x41')]['hasOwnProperty'](_0x7bff('0x5b'))){_0x1e2599[_0x7bff('0x2a')]=qs[_0x7bff('0x2a')](_0x3026b2[_0x7bff('0x41')][_0x7bff('0x2a')]);_0x1e2599[_0x7bff('0x2c')]=qs['offset'](_0x3026b2['query'][_0x7bff('0x2c')]);}return _0x24acbd[_0x7bff('0x58')](_0x1e2599);}})['then'](function(_0x2f0bca){if(_0x2f0bca){return _0x2f0bca?{'count':_0x196582,'rows':_0x2f0bca}:null;}})['then'](respondWithResult(_0x485987,null))[_0x7bff('0x26')](handleError(_0x485987,null));};exports['addConfiguration']=function(_0x317546,_0x342e00,_0x5b9ff5){if(_0x317546[_0x7bff('0x37')]['id']){delete _0x317546[_0x7bff('0x37')]['id'];}return db['Dynamics365Account'][_0x7bff('0x59')]({'where':{'id':_0x317546[_0x7bff('0x54')]['id']}})['then'](handleEntityNotFound(_0x342e00,null))[_0x7bff('0x31')](function(_0x226704){if(_0x226704){_0x317546[_0x7bff('0x37')][_0x7bff('0x5c')]=_0x226704['id'];_0x317546[_0x7bff('0x37')][_0x7bff('0x5d')]=integrations[_0x7bff('0x5e')](_0x317546[_0x7bff('0x37')][_0x7bff('0x5f')],_0x317546['body'][_0x7bff('0x3f')]);_0x317546[_0x7bff('0x37')][_0x7bff('0x60')]=integrations['getDescriptions'](_0x317546[_0x7bff('0x37')][_0x7bff('0x5f')],_0x317546[_0x7bff('0x37')]['type']);return db[_0x7bff('0x5a')][_0x7bff('0x57')](_0x317546[_0x7bff('0x37')],{'include':[{'model':db['Dynamics365Field'],'as':_0x7bff('0x5d')},{'model':db[_0x7bff('0x61')],'as':_0x7bff('0x60')}]});}return null;})[_0x7bff('0x31')](respondWithResult(_0x342e00,null))[_0x7bff('0x26')](handleError(_0x342e00,null));};exports[_0x7bff('0x62')]=function(_0x4cc45d,_0x47c0ee,_0x53873c){var _0x1ba103=_0x4cc45d[_0x7bff('0x41')][_0x7bff('0x63')];var _0x19ca84=_0x1ba103===_0x7bff('0x64')?_0x7bff('0x65'):'PhoneCall';var _0x1792a9='';var _0xd0c5b8='';var _0x423a15='';var _0x2bbe66='';var _0x2dced3='';var _0x3435b0='';var _0x447074='';var _0xa57daf='';var _0x2c2605=[_0x7bff('0x66'),'description',_0x7bff('0x67'),_0x7bff('0x68'),_0x7bff('0x69'),_0x7bff('0x6a'),'phonenumber',_0x7bff('0x6b'),_0x7bff('0x6c'),_0x7bff('0x6d')];var _0x22553b=[_0x7bff('0x6e'),'accountidyominame','actualserviceunits',_0x7bff('0x6f'),_0x7bff('0x70'),'contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname',_0x7bff('0x71'),_0x7bff('0x72'),_0x7bff('0x73'),_0x7bff('0x74'),_0x7bff('0x75'),_0x7bff('0x76'),_0x7bff('0x77'),_0x7bff('0x78'),_0x7bff('0x79'),_0x7bff('0x7a'),_0x7bff('0x7b'),'entityimage_timestamp',_0x7bff('0x7c'),'escalatedon',_0x7bff('0x7d'),_0x7bff('0x7e'),_0x7bff('0x7f'),_0x7bff('0x80'),_0x7bff('0x81'),_0x7bff('0x82'),'lastonholdtime',_0x7bff('0x83'),_0x7bff('0x84'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x7bff('0x85'),_0x7bff('0x86'),_0x7bff('0x87'),_0x7bff('0x88'),_0x7bff('0x89'),_0x7bff('0x8a'),_0x7bff('0x8b'),_0x7bff('0x8c'),_0x7bff('0x8d'),_0x7bff('0x8e'),_0x7bff('0x8f'),'owneridyominame','parentcaseidname',_0x7bff('0x90'),_0x7bff('0x91'),'prioritycodename',_0x7bff('0x92'),'productserialnumber',_0x7bff('0x93'),_0x7bff('0x94'),_0x7bff('0x95'),_0x7bff('0x96'),_0x7bff('0x97'),_0x7bff('0x98'),_0x7bff('0x99'),_0x7bff('0x9a'),_0x7bff('0x9b'),_0x7bff('0x9c'),_0x7bff('0x9d'),'subjectidname','ticketnumber',_0x7bff('0x9e'),_0x7bff('0x9f'),_0x7bff('0xa0'),'utcconversiontimezonecode','versionnumber'];var _0x2f0ff0=_0x2c2605[_0x7bff('0xa1')](_0x22553b);return db[_0x7bff('0x3c')]['findOne']({'where':{'id':_0x4cc45d['params']['id']},'attributes':['id','username',_0x7bff('0xa2'),_0x7bff('0xa3'),'tenantId',_0x7bff('0xa4'),_0x7bff('0xa5')]})[_0x7bff('0x31')](handleEntityNotFound(_0x47c0ee,null))[_0x7bff('0x31')](function(_0x5d4af){if(_0x5d4af){_0xa57daf=_0x5d4af[_0x7bff('0xa3')];var _0xce3ea8=_0xa57daf[_0x7bff('0xa6')](-0x1);if(_0xce3ea8==='/'){_0xa57daf=_0xa57daf[_0x7bff('0xa7')](0x0,_0xa57daf[_0x7bff('0xa8')](_0xce3ea8));}_0x447074=util[_0x7bff('0xa9')](_0x7bff('0xaa'),_0xa57daf);var _0x5ddee3={'method':_0x7bff('0xab'),'uri':_0x7bff('0xac')+_0x5d4af[_0x7bff('0xad')]+_0x7bff('0xae'),'form':{'client_id':_0x5d4af['clientId'],'resource':_0xa57daf,'username':_0x5d4af[_0x7bff('0xaf')],'password':_0x5d4af[_0x7bff('0xa2')],'grant_type':_0x7bff('0xa2'),'client_secret':_0x5d4af[_0x7bff('0xa5')]},'json':!![]};return rp(_0x5ddee3);}})[_0x7bff('0x31')](function(_0x4e5211){_0x3435b0=_0x4e5211[_0x7bff('0xb0')];var _0xce46bc={'method':_0x7bff('0xb1'),'uri':encodeURI(_0x447074+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x19ca84+'\x27'),'headers':{'Authorization':_0x7bff('0xb2')+_0x3435b0,'If-None-Match':null,'OData-Version':_0x7bff('0xb3')},'json':!![]};return rp(_0xce46bc);})[_0x7bff('0x31')](function(_0x3b429d){var _0x3e2802=_0x3b429d[_0x7bff('0xb4')][0x0];var _0x59adf4=_0x3e2802[_0x7bff('0xb5')];var _0xb47273={'method':_0x7bff('0xb1'),'uri':_0x447074+_0x7bff('0xb6')+_0x59adf4+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x7bff('0xb2')+_0x3435b0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xb47273);})[_0x7bff('0x31')](function(_0x2d917b){_0x1792a9=_0x2d917b;_0xd0c5b8=_0x1792a9[_0x7bff('0xb7')];_0xd0c5b8=_[_0x7bff('0xb8')](_0xd0c5b8,function(_0xede591){return!_0x2f0ff0[_0x7bff('0xb9')](_0xede591['LogicalName']);});var _0x4f3830=[];var _0x1f4a88=[];_0xd0c5b8[_0x7bff('0xba')](function(_0x2c6bd1){if(_0x2c6bd1[_0x7bff('0xbb')]){var _0x4305cb=_0x2c6bd1[_0x7bff('0xbb')][_0x7bff('0xa7')](_0x2c6bd1[_0x7bff('0xbb')]['lastIndexOf']('.')+0x1);if(_0x4305cb===_0x7bff('0xbc')){_0x4f3830[_0x7bff('0xbd')](getSelectList(_0x447074,_0x1ba103,_0x1f4a88,_0x1792a9[_0x7bff('0xb5')],_0x2c6bd1['MetadataId'],_0x3435b0));}}});return Promise['all'](_0x4f3830);})[_0x7bff('0x31')](function(_0xba945d){_0x423a15=_0xba945d[0x0];var _0x24b1d0=[];var _0x468f93=[];_0xd0c5b8[_0x7bff('0xba')](function(_0x512689){if(!_[_0x7bff('0xbe')](_0x512689[_0x7bff('0xbb')])){var _0x8a8bd1=_0x512689[_0x7bff('0xbb')]['substring'](_0x512689[_0x7bff('0xbb')][_0x7bff('0xa8')]('.')+0x1);if(_0x8a8bd1===_0x7bff('0xbf')){_0x24b1d0['push'](getBooleanList(_0x447074,_0x1ba103,_0x468f93,_0x1792a9[_0x7bff('0xb5')],_0x512689['MetadataId'],_0x3435b0));}}});return Promise[_0x7bff('0xc0')](_0x24b1d0);})[_0x7bff('0x31')](function(_0x42d5a0){_0x2bbe66=_0x42d5a0[0x0];var _0x5d8943=[];var _0x41b317=[];_0xd0c5b8['forEach'](function(_0xd31fff){if(_0xd31fff[_0x7bff('0xbb')]){var _0x5d05ba=_0xd31fff[_0x7bff('0xbb')]['substring'](_0xd31fff['@odata.type']['lastIndexOf']('.')+0x1);if(_0x5d05ba==='StringAttributeMetadata'||_0x5d05ba===_0x7bff('0xc1')||_0x5d05ba===_0x7bff('0xc2')||_0x5d05ba===_0x7bff('0xc3')||_0x5d05ba===_0x7bff('0xc4')||_0x5d05ba===_0x7bff('0xc5')||_0x5d05ba===_0x7bff('0xc6')||_0x5d05ba===_0x7bff('0xc7')||_0x5d05ba===_0x7bff('0xc8')||_0x5d05ba===_0x7bff('0xc9')){_0x5d8943[_0x7bff('0xbd')](getInputList(_0x447074,_0x1ba103,_0x5d05ba,_0x41b317,_0x1792a9['MetadataId'],_0xd31fff[_0x7bff('0xb5')],_0x3435b0));}}});return Promise['all'](_0x5d8943);})['then'](function(_0x4ee164){_0x2dced3=_0x4ee164[0x0];var _0x19c720=_0x423a15[_0x7bff('0xa1')](_0x2bbe66)[_0x7bff('0xa1')](_0x2dced3);var _0x3d177f={'count':_0x19c720['length'],'rows':_0x19c720};return _0x3d177f;})[_0x7bff('0x31')](respondWithResult(_0x47c0ee,null))[_0x7bff('0x26')](function(_0x571348){var _0x5a6c83=_0x4cc45d[_0x7bff('0x41')]['test']?0x1f4:_0x571348[_0x7bff('0xca')]||0x1f4;logger[_0x7bff('0x22')](_0x571348[_0x7bff('0x33')]);delete _0x571348[_0x7bff('0x34')];if(_0x5a6c83===0x191){_0x5a6c83=0x190;}_0x47c0ee[_0x7bff('0x27')](_0x5a6c83)[_0x7bff('0x35')](_0x4cc45d[_0x7bff('0x41')][_0x7bff('0xcb')]?{'message':_0x7bff('0xcc'),'statusCode':_0x571348[_0x7bff('0xca')]}:_0x571348);});};function getSelectList(_0x22d4fd,_0x300437,_0x1cbba2,_0x4e18ae,_0x2f2b53,_0x4f9c82){var _0x4ba2d6={'method':'GET','uri':_0x22d4fd+_0x7bff('0xb6')+_0x4e18ae+_0x7bff('0xcd')+_0x2f2b53+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x7bff('0xce'),'headers':{'Authorization':_0x7bff('0xb2')+_0x4f9c82,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4ba2d6)[_0x7bff('0x31')](function(_0x3f2d92){var _0x31f86b=[];var _0x1c1969=_0x3f2d92[_0x7bff('0xcf')][_0x7bff('0xd0')];_0x1c1969[_0x7bff('0xba')](function(_0x4b772a){_0x31f86b[_0x7bff('0xbd')]({'name':_0x4b772a[_0x7bff('0xd1')][_0x7bff('0xd2')]['Label'],'value':String(_0x4b772a[_0x7bff('0xd3')])});});var _0x1f7588={'id':_0x300437+'_'+_0x3f2d92[_0x7bff('0xd4')],'name':_0x3f2d92['DisplayName'][_0x7bff('0xd2')][_0x7bff('0xd1')],'custom':![],'options':_0x31f86b};_0x1cbba2['push'](_0x1f7588);return _0x1cbba2;});}function getBooleanList(_0x1b95dc,_0x15e336,_0x38f188,_0x436ccf,_0x57e6f0,_0x1e8b50){var _0x521d16={'method':_0x7bff('0xb1'),'uri':_0x1b95dc+_0x7bff('0xb6')+_0x436ccf+')/Attributes('+_0x57e6f0+_0x7bff('0xd5'),'headers':{'Authorization':_0x7bff('0xb2')+_0x1e8b50,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x521d16)['then'](function(_0x16e60c){var _0x4e3314=[];_0x4e3314[_0x7bff('0xbd')]({'name':_0x16e60c[_0x7bff('0xcf')][_0x7bff('0xd6')]['Label'][_0x7bff('0xd2')]['Label'],'value':_0x7bff('0xd7')},{'name':_0x16e60c['OptionSet']['FalseOption'][_0x7bff('0xd1')][_0x7bff('0xd2')][_0x7bff('0xd1')],'value':_0x7bff('0xd8')});var _0x12fc1b={'id':_0x15e336+'_'+_0x16e60c['LogicalName'],'name':_0x16e60c[_0x7bff('0xd9')][_0x7bff('0xd2')][_0x7bff('0xd1')],'custom':![],'options':_0x4e3314};_0x38f188[_0x7bff('0xbd')](_0x12fc1b);return _0x38f188;});}function getInputList(_0x23b7cc,_0x444981,_0x1adc5b,_0x409dfa,_0x1ad314,_0x53c8f3,_0x988923){var _0x570eb9={'method':'GET','uri':_0x23b7cc+_0x7bff('0xb6')+_0x1ad314+_0x7bff('0xcd')+_0x53c8f3+')/Microsoft.Dynamics.CRM.'+_0x1adc5b+_0x7bff('0xda'),'headers':{'Authorization':_0x7bff('0xb2')+_0x988923,'If-None-Match':null,'OData-Version':_0x7bff('0xb3')},'json':!![]};return rp(_0x570eb9)[_0x7bff('0x31')](function(_0xdc168b){var _0x15a9c5={'id':_0x444981+'_'+_0xdc168b[_0x7bff('0xd4')],'name':_0xdc168b[_0x7bff('0xd9')][_0x7bff('0xd2')]?_0xdc168b[_0x7bff('0xd9')]['UserLocalizedLabel'][_0x7bff('0xd1')]:_0xdc168b[_0x7bff('0xd4')],'custom':![],'options':[]};_0x409dfa[_0x7bff('0xbd')](_0x15a9c5);return _0x409dfa;});} \ No newline at end of file +var _0x50c0=['createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','access_token','GET','Bearer\x20','4.0','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Attributes(','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','count','limit','apply','reject','update','destroy','name','send','render','body','contact','agent','interaction','account','index','map','Dynamics365Account','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','Subjects','getSubjects','Descriptions','Dynamics365Field','getFields','incident','Incident','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x50c0,0x13f));var _0x050c=function(_0x5ca644,_0x3d2165){_0x5ca644=_0x5ca644-0x0;var _0x5c87a2=_0x50c0[_0x5ca644];return _0x5c87a2;};'use strict';var emlformat=require(_0x050c('0x0'));var rimraf=require(_0x050c('0x1'));var zipdir=require(_0x050c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x050c('0x3'));var moment=require(_0x050c('0x4'));var BPromise=require(_0x050c('0x5'));var Mustache=require(_0x050c('0x6'));var util=require(_0x050c('0x7'));var path=require(_0x050c('0x8'));var sox=require('sox');var csv=require(_0x050c('0x9'));var ejs=require(_0x050c('0xa'));var fs=require('fs');var fs_extra=require(_0x050c('0xb'));var _=require(_0x050c('0xc'));var squel=require('squel');var crypto=require(_0x050c('0xd'));var jsforce=require(_0x050c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x050c('0x9'));var querystring=require(_0x050c('0xf'));var Papa=require(_0x050c('0x10'));var Redis=require(_0x050c('0x11'));var authService=require(_0x050c('0x12'));var qs=require(_0x050c('0x13'));var as=require(_0x050c('0x14'));var hardwareService=require(_0x050c('0x15'));var logger=require(_0x050c('0x16'))('api');var utils=require(_0x050c('0x17'));var config=require(_0x050c('0x18'));var licenseUtil=require(_0x050c('0x19'));var db=require(_0x050c('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x590056,_0x3e7ded,_0x193810,_0x5346f2){return new BPromise(function(_0x5184b6,_0xb8f038){var _0x3315c7=_0x5346f2||client;return _0x3315c7[_0x050c('0x1b')](_0x590056,_0x193810)[_0x050c('0x1c')](function(_0x36cdd6){logger[_0x050c('0x1d')](_0x050c('0x1e'),_0x3e7ded,_0x050c('0x1f'));logger[_0x050c('0x20')](_0x050c('0x21'),_0x3e7ded,_0x050c('0x1f'),JSON[_0x050c('0x22')](_0x36cdd6));if(_0x36cdd6[_0x050c('0x23')]){if(_0x36cdd6[_0x050c('0x23')][_0x050c('0x24')]===0x1f4){logger[_0x050c('0x23')](_0x050c('0x1e'),_0x3e7ded,_0x36cdd6['error'][_0x050c('0x25')]);return _0xb8f038(_0x36cdd6[_0x050c('0x23')][_0x050c('0x25')]);}logger[_0x050c('0x23')](_0x050c('0x1e'),_0x3e7ded,_0x36cdd6[_0x050c('0x23')][_0x050c('0x25')]);return _0x5184b6(_0x36cdd6[_0x050c('0x23')][_0x050c('0x25')]);}else{logger['info'](_0x050c('0x1e'),_0x3e7ded,_0x050c('0x1f'));_0x5184b6(_0x36cdd6['result']['message']);}})[_0x050c('0x26')](function(_0x3351dc){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x3e7ded,_0x3351dc);_0xb8f038(_0x3351dc);});});}function respondWithStatusCode(_0x814370,_0x162c76){_0x162c76=_0x162c76||0xcc;return function(_0x58024d){if(_0x58024d){return _0x814370[_0x050c('0x27')](_0x162c76);}return _0x814370[_0x050c('0x28')](_0x162c76)['end']();};}function respondWithResult(_0x4ad2a0,_0x296a27){_0x296a27=_0x296a27||0xc8;return function(_0x531208){if(_0x531208){return _0x4ad2a0['status'](_0x296a27)[_0x050c('0x29')](_0x531208);}};}function respondWithFilteredResult(_0x2fa367,_0x3b9581){return function(_0x32ac5f){if(_0x32ac5f){var _0x187cca=typeof _0x3b9581[_0x050c('0x2a')]==='undefined'&&typeof _0x3b9581['limit']==='undefined';var _0xce0bf5=_0x32ac5f[_0x050c('0x2b')];var _0x1b8a1b=_0x187cca?0x0:_0x3b9581[_0x050c('0x2a')];var _0x39052b=_0x187cca?_0x32ac5f[_0x050c('0x2b')]:_0x3b9581[_0x050c('0x2a')]+_0x3b9581[_0x050c('0x2c')];var _0x5dab3e;if(_0x39052b>=_0xce0bf5){_0x39052b=_0xce0bf5;_0x5dab3e=0xc8;}else{_0x5dab3e=0xce;}_0x2fa367[_0x050c('0x28')](_0x5dab3e);return _0x2fa367['set']('Content-Range',_0x1b8a1b+'-'+_0x39052b+'/'+_0xce0bf5)[_0x050c('0x29')](_0x32ac5f);}return null;};}function patchUpdates(_0x4060e3){return function(_0x4140e6){try{jsonpatch[_0x050c('0x2d')](_0x4140e6,_0x4060e3,!![]);}catch(_0x1bdb90){return BPromise[_0x050c('0x2e')](_0x1bdb90);}return _0x4140e6['save']();};}function saveUpdates(_0x2bbb11,_0x24d3b9){return function(_0x2dddf5){if(_0x2dddf5){return _0x2dddf5[_0x050c('0x2f')](_0x2bbb11)[_0x050c('0x1c')](function(_0x1f3c02){return _0x1f3c02;});}return null;};}function removeEntity(_0x411098,_0x356560){return function(_0x51d3de){if(_0x51d3de){return _0x51d3de[_0x050c('0x30')]()[_0x050c('0x1c')](function(){_0x411098[_0x050c('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ecdd2,_0x2074ca){return function(_0xde535a){if(!_0xde535a){_0x2ecdd2[_0x050c('0x27')](0x194);}return _0xde535a;};}function handleError(_0x4b01af,_0x4b1c21){_0x4b1c21=_0x4b1c21||0x1f4;return function(_0x7ac91e){logger[_0x050c('0x23')](_0x7ac91e['stack']);if(_0x7ac91e['name']){delete _0x7ac91e[_0x050c('0x31')];}_0x4b01af[_0x050c('0x28')](_0x4b1c21)[_0x050c('0x32')](_0x7ac91e);};}function getMustacheRender(_0x1653ba,_0x36ca5b){return Mustache[_0x050c('0x33')](_0x1653ba,_['merge'](_0x36ca5b[_0x050c('0x34')],{'contact':_0x36ca5b[_0x050c('0x35')],'message':_0x36ca5b[_0x050c('0x25')],'agent':_0x36ca5b[_0x050c('0x36')],'interaction':_0x36ca5b[_0x050c('0x37')],'account':_0x36ca5b[_0x050c('0x38')]}))||'';}exports[_0x050c('0x39')]=function(_0x28ba40,_0x2566ad){var _0x5e09e8={},_0x1cc842={},_0x483175={'count':0x0,'rows':[]};var _0x4c3b05=_[_0x050c('0x3a')](db[_0x050c('0x3b')]['rawAttributes'],function(_0x44f919){return{'name':_0x44f919[_0x050c('0x3c')],'type':_0x44f919[_0x050c('0x3d')]['key']};});_0x1cc842[_0x050c('0x3e')]=_[_0x050c('0x3a')](_0x4c3b05,'name');_0x1cc842['query']=_[_0x050c('0x3f')](_0x28ba40['query']);_0x1cc842[_0x050c('0x40')]=_[_0x050c('0x41')](_0x1cc842[_0x050c('0x3e')],_0x1cc842[_0x050c('0x42')]);_0x5e09e8[_0x050c('0x43')]=_[_0x050c('0x41')](_0x1cc842['model'],qs[_0x050c('0x44')](_0x28ba40[_0x050c('0x42')][_0x050c('0x44')]));_0x5e09e8[_0x050c('0x43')]=_0x5e09e8[_0x050c('0x43')][_0x050c('0x45')]?_0x5e09e8[_0x050c('0x43')]:_0x1cc842[_0x050c('0x3e')];if(!_0x28ba40['query'][_0x050c('0x46')](_0x050c('0x47'))){_0x5e09e8[_0x050c('0x2c')]=qs['limit'](_0x28ba40[_0x050c('0x42')][_0x050c('0x2c')]);_0x5e09e8[_0x050c('0x2a')]=qs[_0x050c('0x2a')](_0x28ba40[_0x050c('0x42')][_0x050c('0x2a')]);}_0x5e09e8['order']=qs[_0x050c('0x48')](_0x28ba40['query'][_0x050c('0x48')]);_0x5e09e8[_0x050c('0x49')]=qs[_0x050c('0x40')](_[_0x050c('0x4a')](_0x28ba40[_0x050c('0x42')],_0x1cc842[_0x050c('0x40')]),_0x4c3b05);if(_0x28ba40[_0x050c('0x42')]['filter']){_0x5e09e8[_0x050c('0x49')]=_[_0x050c('0x4b')](_0x5e09e8[_0x050c('0x49')],{'$or':_[_0x050c('0x3a')](_0x4c3b05,function(_0x473ab1){if(_0x473ab1[_0x050c('0x3d')]!==_0x050c('0x4c')){var _0x311c94={};_0x311c94[_0x473ab1[_0x050c('0x31')]]={'$like':'%'+_0x28ba40['query'][_0x050c('0x4d')]+'%'};return _0x311c94;}})});}_0x5e09e8=_[_0x050c('0x4b')]({},_0x5e09e8,_0x28ba40[_0x050c('0x4e')]);var _0x4619fb={'where':_0x5e09e8[_0x050c('0x49')]};return db[_0x050c('0x3b')][_0x050c('0x2b')](_0x4619fb)[_0x050c('0x1c')](function(_0x9c3047){_0x483175['count']=_0x9c3047;if(_0x28ba40['query'][_0x050c('0x4f')]){_0x5e09e8[_0x050c('0x50')]=[{'all':!![]}];}return db[_0x050c('0x3b')][_0x050c('0x51')](_0x5e09e8);})[_0x050c('0x1c')](function(_0x28230d){_0x483175[_0x050c('0x52')]=_0x28230d;return _0x483175;})['then'](respondWithFilteredResult(_0x2566ad,_0x5e09e8))[_0x050c('0x26')](handleError(_0x2566ad,null));};exports[_0x050c('0x53')]=function(_0x2ffa07,_0x1d6b98){var _0x3163e8={'raw':![],'where':{'id':_0x2ffa07[_0x050c('0x54')]['id']}},_0x11fee8={};_0x11fee8[_0x050c('0x3e')]=_[_0x050c('0x3f')](db[_0x050c('0x3b')][_0x050c('0x55')]);_0x11fee8[_0x050c('0x42')]=_[_0x050c('0x3f')](_0x2ffa07[_0x050c('0x42')]);_0x11fee8['filters']=_['intersection'](_0x11fee8[_0x050c('0x3e')],_0x11fee8[_0x050c('0x42')]);_0x3163e8[_0x050c('0x43')]=_['intersection'](_0x11fee8['model'],qs[_0x050c('0x44')](_0x2ffa07['query'][_0x050c('0x44')]));_0x3163e8[_0x050c('0x43')]=_0x3163e8[_0x050c('0x43')][_0x050c('0x45')]?_0x3163e8['attributes']:_0x11fee8[_0x050c('0x3e')];if(_0x2ffa07[_0x050c('0x42')][_0x050c('0x4f')]){_0x3163e8['include']=[{'all':!![]}];}_0x3163e8=_[_0x050c('0x4b')]({},_0x3163e8,_0x2ffa07[_0x050c('0x4e')]);return db[_0x050c('0x3b')][_0x050c('0x56')](_0x3163e8)[_0x050c('0x1c')](handleEntityNotFound(_0x1d6b98,null))['then'](respondWithResult(_0x1d6b98,null))['catch'](handleError(_0x1d6b98,null));};exports[_0x050c('0x57')]=function(_0x5ac926,_0x1eacd7){return db[_0x050c('0x3b')][_0x050c('0x57')](_0x5ac926[_0x050c('0x34')],{})[_0x050c('0x1c')](respondWithResult(_0x1eacd7,0xc9))[_0x050c('0x26')](handleError(_0x1eacd7,null));};exports[_0x050c('0x2f')]=function(_0x27285b,_0x39e94c){if(_0x27285b[_0x050c('0x34')]['id']){delete _0x27285b[_0x050c('0x34')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x27285b[_0x050c('0x54')]['id']}})[_0x050c('0x1c')](handleEntityNotFound(_0x39e94c,null))[_0x050c('0x1c')](saveUpdates(_0x27285b[_0x050c('0x34')],null))[_0x050c('0x1c')](respondWithResult(_0x39e94c,null))[_0x050c('0x26')](handleError(_0x39e94c,null));};exports[_0x050c('0x30')]=function(_0x307fdf,_0x54af4f){return db['Dynamics365Account']['find']({'where':{'id':_0x307fdf['params']['id']}})['then'](handleEntityNotFound(_0x54af4f,null))[_0x050c('0x1c')](removeEntity(_0x54af4f,null))[_0x050c('0x26')](handleError(_0x54af4f,null));};exports[_0x050c('0x58')]=function(_0xcb8c1c,_0x15d0df,_0x2b3bff){var _0x3ec220={};var _0x192bf2={};var _0x199b7f;var _0xdb18c6;return db[_0x050c('0x3b')][_0x050c('0x59')]({'where':{'id':_0xcb8c1c[_0x050c('0x54')]['id']}})[_0x050c('0x1c')](handleEntityNotFound(_0x15d0df,null))['then'](function(_0x395180){if(_0x395180){_0x199b7f=_0x395180;_0x192bf2[_0x050c('0x3e')]=_[_0x050c('0x3f')](db[_0x050c('0x5a')]['rawAttributes']);_0x192bf2[_0x050c('0x42')]=_[_0x050c('0x3f')](_0xcb8c1c['query']);_0x192bf2[_0x050c('0x40')]=_[_0x050c('0x41')](_0x192bf2['model'],_0x192bf2['query']);_0x3ec220[_0x050c('0x43')]=_['intersection'](_0x192bf2[_0x050c('0x3e')],qs[_0x050c('0x44')](_0xcb8c1c[_0x050c('0x42')][_0x050c('0x44')]));_0x3ec220['attributes']=_0x3ec220[_0x050c('0x43')]['length']?_0x3ec220['attributes']:_0x192bf2[_0x050c('0x3e')];_0x3ec220[_0x050c('0x5b')]=qs[_0x050c('0x48')](_0xcb8c1c[_0x050c('0x42')][_0x050c('0x48')]);_0x3ec220[_0x050c('0x49')]=qs['filters'](_[_0x050c('0x4a')](_0xcb8c1c['query'],_0x192bf2[_0x050c('0x40')]));if(_0xcb8c1c[_0x050c('0x42')][_0x050c('0x4d')]){_0x3ec220[_0x050c('0x49')]=_['merge'](_0x3ec220[_0x050c('0x49')],{'$or':_['map'](_0x3ec220['attributes'],function(_0x304740){var _0x56523c={};_0x56523c[_0x304740]={'$like':'%'+_0xcb8c1c['query'][_0x050c('0x4d')]+'%'};return _0x56523c;})});}_0x3ec220=_[_0x050c('0x4b')]({},_0x3ec220,_0xcb8c1c[_0x050c('0x4e')]);return _0x199b7f[_0x050c('0x58')](_0x3ec220);}})[_0x050c('0x1c')](function(_0x1e3c72){if(_0x1e3c72){_0xdb18c6=_0x1e3c72[_0x050c('0x45')];if(!_0xcb8c1c['query'][_0x050c('0x46')](_0x050c('0x47'))){_0x3ec220[_0x050c('0x2c')]=qs[_0x050c('0x2c')](_0xcb8c1c[_0x050c('0x42')]['limit']);_0x3ec220['offset']=qs['offset'](_0xcb8c1c['query']['offset']);}return _0x199b7f['getConfigurations'](_0x3ec220);}})[_0x050c('0x1c')](function(_0x7ed466){if(_0x7ed466){return _0x7ed466?{'count':_0xdb18c6,'rows':_0x7ed466}:null;}})[_0x050c('0x1c')](respondWithResult(_0x15d0df,null))[_0x050c('0x26')](handleError(_0x15d0df,null));};exports[_0x050c('0x5c')]=function(_0x5f1f5d,_0x45bf57,_0x4d11a5){if(_0x5f1f5d[_0x050c('0x34')]['id']){delete _0x5f1f5d['body']['id'];}return db[_0x050c('0x3b')]['findOne']({'where':{'id':_0x5f1f5d[_0x050c('0x54')]['id']}})[_0x050c('0x1c')](handleEntityNotFound(_0x45bf57,null))[_0x050c('0x1c')](function(_0x336559){if(_0x336559){_0x5f1f5d[_0x050c('0x34')]['AccountId']=_0x336559['id'];_0x5f1f5d[_0x050c('0x34')][_0x050c('0x5d')]=integrations[_0x050c('0x5e')](_0x5f1f5d['body']['channel'],_0x5f1f5d[_0x050c('0x34')][_0x050c('0x3d')]);_0x5f1f5d[_0x050c('0x34')][_0x050c('0x5f')]=integrations['getDescriptions'](_0x5f1f5d[_0x050c('0x34')]['channel'],_0x5f1f5d[_0x050c('0x34')]['type']);return db[_0x050c('0x5a')][_0x050c('0x57')](_0x5f1f5d['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x050c('0x60')],'as':_0x050c('0x5f')}]});}return null;})[_0x050c('0x1c')](respondWithResult(_0x45bf57,null))[_0x050c('0x26')](handleError(_0x45bf57,null));};exports[_0x050c('0x61')]=function(_0x339ecc,_0x5b83be,_0x2edc0a){var _0x12aff8=_0x339ecc[_0x050c('0x42')]['ticketType'];var _0x2a9503=_0x12aff8===_0x050c('0x62')?_0x050c('0x63'):'PhoneCall';var _0x409ad3='';var _0x2fa446='';var _0x121f8d='';var _0x2eab39='';var _0x10e45a='';var _0xba33dc='';var _0x20859e='';var _0xad4a72='';var _0x213ba1=['title',_0x050c('0x64'),_0x050c('0x65'),_0x050c('0x66'),_0x050c('0x67'),_0x050c('0x68'),_0x050c('0x69'),_0x050c('0x6a'),_0x050c('0x6b'),_0x050c('0x6c')];var _0x216e5a=[_0x050c('0x6d'),_0x050c('0x6e'),_0x050c('0x6f'),_0x050c('0x70'),_0x050c('0x71'),_0x050c('0x72'),_0x050c('0x73'),_0x050c('0x74'),_0x050c('0x75'),_0x050c('0x76'),'createdbyname','createdbyyominame',_0x050c('0x77'),_0x050c('0x78'),_0x050c('0x79'),_0x050c('0x7a'),_0x050c('0x7b'),_0x050c('0x7c'),_0x050c('0x7d'),'entitlementidname',_0x050c('0x7e'),_0x050c('0x7f'),_0x050c('0x80'),_0x050c('0x81'),_0x050c('0x82'),_0x050c('0x83'),_0x050c('0x84'),_0x050c('0x85'),_0x050c('0x86'),_0x050c('0x87'),'masteridname',_0x050c('0x88'),'modifiedbyexternalpartyyominame',_0x050c('0x89'),_0x050c('0x8a'),'modifiedon',_0x050c('0x8b'),_0x050c('0x8c'),'msdyn_incidenttypename',_0x050c('0x8d'),'numberofchildincidents',_0x050c('0x8e'),_0x050c('0x8f'),'owneridname',_0x050c('0x90'),_0x050c('0x91'),_0x050c('0x92'),_0x050c('0x93'),_0x050c('0x94'),_0x050c('0x95'),_0x050c('0x96'),'productserialnumber',_0x050c('0x97'),_0x050c('0x98'),_0x050c('0x99'),_0x050c('0x9a'),_0x050c('0x9b'),'sentimentvalue',_0x050c('0x9c'),_0x050c('0x9d'),_0x050c('0x9e'),'statecode','statuscode',_0x050c('0x9f'),_0x050c('0xa0'),_0x050c('0xa1'),_0x050c('0xa2'),'traversedpath',_0x050c('0xa3'),_0x050c('0xa4')];var _0x40d7e8=_0x213ba1[_0x050c('0xa5')](_0x216e5a);return db[_0x050c('0x3b')][_0x050c('0x59')]({'where':{'id':_0x339ecc[_0x050c('0x54')]['id']},'attributes':['id',_0x050c('0xa6'),_0x050c('0xa7'),_0x050c('0xa8'),'tenantId','clientId',_0x050c('0xa9')]})[_0x050c('0x1c')](handleEntityNotFound(_0x5b83be,null))[_0x050c('0x1c')](function(_0x1314da){if(_0x1314da){_0xad4a72=_0x1314da[_0x050c('0xa8')];var _0x49aba5=_0xad4a72[_0x050c('0xaa')](-0x1);if(_0x49aba5==='/'){_0xad4a72=_0xad4a72[_0x050c('0xab')](0x0,_0xad4a72[_0x050c('0xac')](_0x49aba5));}_0x20859e=util[_0x050c('0xad')](_0x050c('0xae'),_0xad4a72);var _0x1e6380={'method':_0x050c('0xaf'),'uri':_0x050c('0xb0')+_0x1314da[_0x050c('0xb1')]+'/oauth2/token','form':{'client_id':_0x1314da['clientId'],'resource':_0xad4a72,'username':_0x1314da[_0x050c('0xa6')],'password':_0x1314da['password'],'grant_type':_0x050c('0xa7'),'client_secret':_0x1314da[_0x050c('0xa9')]},'json':!![]};return rp(_0x1e6380);}})[_0x050c('0x1c')](function(_0x3048f9){_0xba33dc=_0x3048f9[_0x050c('0xb2')];var _0x22a033={'method':_0x050c('0xb3'),'uri':encodeURI(_0x20859e+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x2a9503+'\x27'),'headers':{'Authorization':_0x050c('0xb4')+_0xba33dc,'If-None-Match':null,'OData-Version':_0x050c('0xb5')},'json':!![]};return rp(_0x22a033);})[_0x050c('0x1c')](function(_0x4fc88d){var _0x153b89=_0x4fc88d['value'][0x0];var _0x3ac51b=_0x153b89[_0x050c('0xb6')];var _0x36e891={'method':_0x050c('0xb3'),'uri':_0x20859e+_0x050c('0xb7')+_0x3ac51b+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0xba33dc,'If-None-Match':null,'OData-Version':_0x050c('0xb5')},'json':!![]};return rp(_0x36e891);})['then'](function(_0x21a653){_0x409ad3=_0x21a653;_0x2fa446=_0x409ad3[_0x050c('0xb8')];_0x2fa446=_[_0x050c('0xb9')](_0x2fa446,function(_0x54dc27){return!_0x40d7e8[_0x050c('0xba')](_0x54dc27[_0x050c('0xbb')]);});var _0x1f184d=[];var _0x243cce=[];_0x2fa446[_0x050c('0xbc')](function(_0x190d46){if(_0x190d46[_0x050c('0xbd')]){var _0x956b23=_0x190d46[_0x050c('0xbd')][_0x050c('0xab')](_0x190d46['@odata.type']['lastIndexOf']('.')+0x1);if(_0x956b23===_0x050c('0xbe')){_0x1f184d[_0x050c('0xbf')](getSelectList(_0x20859e,_0x12aff8,_0x243cce,_0x409ad3[_0x050c('0xb6')],_0x190d46[_0x050c('0xb6')],_0xba33dc));}}});return Promise[_0x050c('0xc0')](_0x1f184d);})['then'](function(_0x3416f7){_0x121f8d=_0x3416f7[0x0];var _0xb29565=[];var _0x87175f=[];_0x2fa446['forEach'](function(_0x5cc8bf){if(!_[_0x050c('0xc1')](_0x5cc8bf['@odata.type'])){var _0x5ea1cf=_0x5cc8bf['@odata.type'][_0x050c('0xab')](_0x5cc8bf[_0x050c('0xbd')][_0x050c('0xac')]('.')+0x1);if(_0x5ea1cf===_0x050c('0xc2')){_0xb29565[_0x050c('0xbf')](getBooleanList(_0x20859e,_0x12aff8,_0x87175f,_0x409ad3[_0x050c('0xb6')],_0x5cc8bf[_0x050c('0xb6')],_0xba33dc));}}});return Promise[_0x050c('0xc0')](_0xb29565);})[_0x050c('0x1c')](function(_0x1580a9){_0x2eab39=_0x1580a9[0x0];var _0x5320cc=[];var _0x26b38d=[];_0x2fa446['forEach'](function(_0x284fa6){if(_0x284fa6[_0x050c('0xbd')]){var _0x113600=_0x284fa6[_0x050c('0xbd')]['substring'](_0x284fa6['@odata.type']['lastIndexOf']('.')+0x1);if(_0x113600===_0x050c('0xc3')||_0x113600===_0x050c('0xc4')||_0x113600==='BigIntAttributeMetadata'||_0x113600===_0x050c('0xc5')||_0x113600===_0x050c('0xc6')||_0x113600==='DateTimeAttributeMetadata'||_0x113600==='StatusAttributeMetadata'||_0x113600===_0x050c('0xc7')||_0x113600===_0x050c('0xc8')||_0x113600===_0x050c('0xc9')){_0x5320cc['push'](getInputList(_0x20859e,_0x12aff8,_0x113600,_0x26b38d,_0x409ad3[_0x050c('0xb6')],_0x284fa6[_0x050c('0xb6')],_0xba33dc));}}});return Promise['all'](_0x5320cc);})[_0x050c('0x1c')](function(_0x3f1c31){_0x10e45a=_0x3f1c31[0x0];var _0x1c22d4=_0x121f8d['concat'](_0x2eab39)[_0x050c('0xa5')](_0x10e45a);var _0xe76396={'count':_0x1c22d4[_0x050c('0x45')],'rows':_0x1c22d4};return _0xe76396;})[_0x050c('0x1c')](respondWithResult(_0x5b83be,null))[_0x050c('0x26')](function(_0x3d26a2){var _0x2a1a87=_0x339ecc['query'][_0x050c('0xca')]?0x1f4:_0x3d26a2[_0x050c('0xcb')]||0x1f4;logger[_0x050c('0x23')](_0x3d26a2['stack']);delete _0x3d26a2[_0x050c('0x31')];if(_0x2a1a87===0x191){_0x2a1a87=0x190;}_0x5b83be['status'](_0x2a1a87)[_0x050c('0x32')](_0x339ecc[_0x050c('0x42')][_0x050c('0xca')]?{'message':_0x050c('0xcc'),'statusCode':_0x3d26a2['statusCode']}:_0x3d26a2);});};function getSelectList(_0x505991,_0x1b1cb4,_0x48c578,_0x401935,_0xd7526e,_0x5389bd){var _0x3a3aa7={'method':'GET','uri':_0x505991+_0x050c('0xb7')+_0x401935+')/Attributes('+_0xd7526e+_0x050c('0xcd')+_0x050c('0xce'),'headers':{'Authorization':_0x050c('0xb4')+_0x5389bd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3a3aa7)['then'](function(_0x37fc04){var _0xf0afc6=[];var _0x5e670e=_0x37fc04[_0x050c('0xcf')][_0x050c('0xd0')];_0x5e670e[_0x050c('0xbc')](function(_0x14abf8){_0xf0afc6[_0x050c('0xbf')]({'name':_0x14abf8[_0x050c('0xd1')][_0x050c('0xd2')]['Label'],'value':String(_0x14abf8[_0x050c('0xd3')])});});var _0x3cc7b0={'id':_0x1b1cb4+'_'+_0x37fc04[_0x050c('0xbb')],'name':_0x37fc04[_0x050c('0xd4')][_0x050c('0xd2')][_0x050c('0xd1')],'custom':![],'options':_0xf0afc6};_0x48c578[_0x050c('0xbf')](_0x3cc7b0);return _0x48c578;});}function getBooleanList(_0x4afe49,_0x2b35bb,_0x309967,_0x2723ce,_0xaacf0d,_0x10f58c){var _0x5a73ab={'method':'GET','uri':_0x4afe49+'EntityDefinitions('+_0x2723ce+')/Attributes('+_0xaacf0d+_0x050c('0xd5'),'headers':{'Authorization':'Bearer\x20'+_0x10f58c,'If-None-Match':null,'OData-Version':_0x050c('0xb5')},'json':!![]};return rp(_0x5a73ab)[_0x050c('0x1c')](function(_0x55bbae){var _0x5a0d0a=[];_0x5a0d0a[_0x050c('0xbf')]({'name':_0x55bbae[_0x050c('0xcf')][_0x050c('0xd6')][_0x050c('0xd1')]['UserLocalizedLabel']['Label'],'value':_0x050c('0xd7')},{'name':_0x55bbae['OptionSet'][_0x050c('0xd8')]['Label'][_0x050c('0xd2')]['Label'],'value':_0x050c('0xd9')});var _0x44fed9={'id':_0x2b35bb+'_'+_0x55bbae[_0x050c('0xbb')],'name':_0x55bbae[_0x050c('0xd4')][_0x050c('0xd2')]['Label'],'custom':![],'options':_0x5a0d0a};_0x309967['push'](_0x44fed9);return _0x309967;});}function getInputList(_0x4917ef,_0x4d1dbc,_0xbf7a52,_0x43afc9,_0x269e17,_0x130fc8,_0x214946){var _0x165e84={'method':_0x050c('0xb3'),'uri':_0x4917ef+_0x050c('0xb7')+_0x269e17+_0x050c('0xda')+_0x130fc8+')/Microsoft.Dynamics.CRM.'+_0xbf7a52+_0x050c('0xdb'),'headers':{'Authorization':_0x050c('0xb4')+_0x214946,'If-None-Match':null,'OData-Version':_0x050c('0xb5')},'json':!![]};return rp(_0x165e84)['then'](function(_0x283354){var _0x5198bf={'id':_0x4d1dbc+'_'+_0x283354[_0x050c('0xbb')],'name':_0x283354[_0x050c('0xd4')]['UserLocalizedLabel']?_0x283354['DisplayName']['UserLocalizedLabel'][_0x050c('0xd1')]:_0x283354[_0x050c('0xbb')],'custom':![],'options':[]};_0x43afc9[_0x050c('0xbf')](_0x5198bf);return _0x43afc9;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 87b37b6..50396e3 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 _0x7de0=['../../config/environment','./intDynamics365Account.attributes','define','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x7de0,0x19c));var _0x07de=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7de0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x07de('0x0'));var util=require(_0x07de('0x1'));var logger=require(_0x07de('0x2'))(_0x07de('0x3'));var moment=require(_0x07de('0x4'));var BPromise=require(_0x07de('0x5'));var rp=require(_0x07de('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07de('0x7'));var config=require(_0x07de('0x8'));var attributes=require(_0x07de('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4fe187,_0x165989){return _0x4fe187[_0x07de('0xa')]('Dynamics365Account',attributes,{'tableName':_0x07de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc55=['rimraf','../../components/integrations/configuration','int_dynamics365_accounts','util','../../config/logger','api','moment','bluebird','path'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xdc55,0x186));var _0x5dc5=function(_0x43dbd2,_0x5c0306){_0x43dbd2=_0x43dbd2-0x0;var _0x11af1b=_0xdc55[_0x43dbd2];return _0x11af1b;};'use strict';var _=require('lodash');var util=require(_0x5dc5('0x0'));var logger=require(_0x5dc5('0x1'))(_0x5dc5('0x2'));var moment=require(_0x5dc5('0x3'));var BPromise=require(_0x5dc5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dc5('0x5'));var rimraf=require(_0x5dc5('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x5dc5('0x7'));module['exports']=function(_0x20e473,_0x15c51f){return _0x20e473['define']('Dynamics365Account',attributes,{'tableName':_0x5dc5('0x8'),'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 712e37a..643b071 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 _0x3ca4=['model','attributes','include','info','GetDynamics365Account','ShowDynamics365Account','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','limit','map'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x3ca4,0x17d));var _0x43ca=function(_0x2c5882,_0x5a9dd6){_0x2c5882=_0x2c5882-0x0;var _0x400af3=_0x3ca4[_0x2c5882];return _0x400af3;};'use strict';var _=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var moment=require(_0x43ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ca('0x3'));var db=require(_0x43ca('0x4'))['db'];var utils=require(_0x43ca('0x5'));var logger=require(_0x43ca('0x6'))(_0x43ca('0x7'));var config=require(_0x43ca('0x8'));var jayson=require(_0x43ca('0x9'));var client=jayson['client'][_0x43ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ba987,_0x2e6edf,_0x609e75){return new BPromise(function(_0x3147b3,_0x4669f5){return client[_0x43ca('0xb')](_0x1ba987,_0x609e75)[_0x43ca('0xc')](function(_0x4cd9b6){logger['info'](_0x43ca('0xd'),_0x2e6edf,_0x43ca('0xe'));logger[_0x43ca('0xf')](_0x43ca('0x10'),_0x2e6edf,'request\x20sent',JSON[_0x43ca('0x11')](_0x4cd9b6));if(_0x4cd9b6[_0x43ca('0x12')]){if(_0x4cd9b6[_0x43ca('0x12')][_0x43ca('0x13')]===0x1f4){logger[_0x43ca('0x12')](_0x43ca('0xd'),_0x2e6edf,_0x4cd9b6[_0x43ca('0x12')][_0x43ca('0x14')]);return _0x4669f5(_0x4cd9b6[_0x43ca('0x12')]['message']);}logger[_0x43ca('0x12')](_0x43ca('0xd'),_0x2e6edf,_0x4cd9b6['error'][_0x43ca('0x14')]);return _0x3147b3(_0x4cd9b6['error'][_0x43ca('0x14')]);}else{logger['info'](_0x43ca('0xd'),_0x2e6edf,_0x43ca('0xe'));_0x3147b3(_0x4cd9b6['result'][_0x43ca('0x14')]);}})[_0x43ca('0x15')](function(_0x14f9af){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x2e6edf,_0x14f9af);_0x4669f5(_0x14f9af);});});}exports['GetDynamics365Account']=function(_0x5e50c9){var _0x2cb3e5=this;return new Promise(function(_0x268817,_0x1389ce){return db['Dynamics365Account'][_0x43ca('0x16')]({'raw':_0x5e50c9[_0x43ca('0x17')]?_0x5e50c9[_0x43ca('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5e50c9[_0x43ca('0x17')]?_0x5e50c9['options'][_0x43ca('0x18')]||null:null,'attributes':_0x5e50c9[_0x43ca('0x17')]?_0x5e50c9[_0x43ca('0x17')]['attributes']||null:null,'limit':_0x5e50c9[_0x43ca('0x17')]?_0x5e50c9[_0x43ca('0x17')][_0x43ca('0x19')]||null:null,'include':_0x5e50c9[_0x43ca('0x17')]?_0x5e50c9[_0x43ca('0x17')]['include']?_[_0x43ca('0x1a')](_0x5e50c9[_0x43ca('0x17')]['include'],function(_0x379902){return{'model':db[_0x379902[_0x43ca('0x1b')]],'as':_0x379902['as'],'attributes':_0x379902[_0x43ca('0x1c')],'include':_0x379902[_0x43ca('0x1d')]?_[_0x43ca('0x1a')](_0x379902['include'],function(_0x2da1ec){return{'model':db[_0x2da1ec[_0x43ca('0x1b')]],'as':_0x2da1ec['as'],'attributes':_0x2da1ec[_0x43ca('0x1c')],'include':_0x2da1ec[_0x43ca('0x1d')]?_[_0x43ca('0x1a')](_0x2da1ec[_0x43ca('0x1d')],function(_0x3b2078){return{'model':db[_0x3b2078[_0x43ca('0x1b')]],'as':_0x3b2078['as'],'attributes':_0x3b2078['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a75af){logger[_0x43ca('0x1e')](_0x43ca('0x1f'),_0x5e50c9);logger[_0x43ca('0xf')](_0x43ca('0x1f'),_0x5e50c9,JSON[_0x43ca('0x11')](_0x4a75af));_0x268817(_0x4a75af);})[_0x43ca('0x15')](function(_0xffad2d){logger[_0x43ca('0x12')]('GetDynamics365Account',_0xffad2d[_0x43ca('0x14')],_0x5e50c9);_0x1389ce(_0x2cb3e5['error'](0x1f4,_0xffad2d['message']));});});};exports[_0x43ca('0x20')]=function(_0x1f2814){var _0x313518=this;return new Promise(function(_0x359b7c,_0x248ec3){return db['Dynamics365Account'][_0x43ca('0x21')]({'raw':_0x1f2814['options']?_0x1f2814[_0x43ca('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1f2814[_0x43ca('0x17')]?_0x1f2814[_0x43ca('0x17')]['where']||null:null,'attributes':_0x1f2814[_0x43ca('0x17')]?_0x1f2814[_0x43ca('0x17')][_0x43ca('0x1c')]||null:null,'include':_0x1f2814[_0x43ca('0x17')]?_0x1f2814[_0x43ca('0x17')][_0x43ca('0x1d')]?_[_0x43ca('0x1a')](_0x1f2814['options'][_0x43ca('0x1d')],function(_0x5976a3){return{'model':db[_0x5976a3[_0x43ca('0x1b')]],'as':_0x5976a3['as'],'attributes':_0x5976a3[_0x43ca('0x1c')],'include':_0x5976a3['include']?_[_0x43ca('0x1a')](_0x5976a3['include'],function(_0x49ef94){return{'model':db[_0x49ef94[_0x43ca('0x1b')]],'as':_0x49ef94['as'],'attributes':_0x49ef94[_0x43ca('0x1c')],'include':_0x49ef94[_0x43ca('0x1d')]?_[_0x43ca('0x1a')](_0x49ef94[_0x43ca('0x1d')],function(_0x28d0a3){return{'model':db[_0x28d0a3[_0x43ca('0x1b')]],'as':_0x28d0a3['as'],'attributes':_0x28d0a3['attributes']};}):[]};}):[]};}):[]:[]})[_0x43ca('0xc')](function(_0x67b8b0){logger['info'](_0x43ca('0x20'),_0x1f2814);logger[_0x43ca('0xf')]('ShowDynamics365Account',_0x1f2814,JSON[_0x43ca('0x11')](_0x67b8b0));_0x359b7c(_0x67b8b0);})['catch'](function(_0x5a4224){logger[_0x43ca('0x12')](_0x43ca('0x20'),_0x5a4224[_0x43ca('0x14')],_0x1f2814);_0x248ec3(_0x313518[_0x43ca('0x12')](0x1f4,_0x5a4224[_0x43ca('0x14')]));});});}; \ No newline at end of file +var _0x3bd7=['where','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','map','include','model','then','ShowDynamics365Account','find'];(function(_0x2eb16e,_0x3fd65d){var _0x1f6368=function(_0x1e0449){while(--_0x1e0449){_0x2eb16e['push'](_0x2eb16e['shift']());}};_0x1f6368(++_0x3fd65d);}(_0x3bd7,0x199));var _0x73bd=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x3bd7[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73bd('0x0'));var BPromise=require(_0x73bd('0x1'));var rs=require(_0x73bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73bd('0x3'))['db'];var utils=require(_0x73bd('0x4'));var logger=require(_0x73bd('0x5'))('rpc');var config=require(_0x73bd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x73bd('0x7')][_0x73bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bca41,_0x38ffbb,_0x4c1254){return new BPromise(function(_0x569bef,_0x549abe){return client[_0x73bd('0x9')](_0x4bca41,_0x4c1254)['then'](function(_0x4f627c){logger[_0x73bd('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x38ffbb,_0x73bd('0xb'));logger[_0x73bd('0xc')](_0x73bd('0xd'),_0x38ffbb,_0x73bd('0xb'),JSON[_0x73bd('0xe')](_0x4f627c));if(_0x4f627c[_0x73bd('0xf')]){if(_0x4f627c['error'][_0x73bd('0x10')]===0x1f4){logger[_0x73bd('0xf')](_0x73bd('0x11'),_0x38ffbb,_0x4f627c[_0x73bd('0xf')][_0x73bd('0x12')]);return _0x549abe(_0x4f627c[_0x73bd('0xf')]['message']);}logger[_0x73bd('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x38ffbb,_0x4f627c[_0x73bd('0xf')][_0x73bd('0x12')]);return _0x569bef(_0x4f627c[_0x73bd('0xf')][_0x73bd('0x12')]);}else{logger[_0x73bd('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x38ffbb,_0x73bd('0xb'));_0x569bef(_0x4f627c[_0x73bd('0x13')][_0x73bd('0x12')]);}})[_0x73bd('0x14')](function(_0x411931){logger[_0x73bd('0xf')](_0x73bd('0x11'),_0x38ffbb,_0x411931);_0x549abe(_0x411931);});});}exports[_0x73bd('0x15')]=function(_0x21787b){var _0x482009=this;return new Promise(function(_0x1e559b,_0x35af6e){return db[_0x73bd('0x16')][_0x73bd('0x17')]({'raw':_0x21787b[_0x73bd('0x18')]?_0x21787b[_0x73bd('0x18')][_0x73bd('0x19')]===undefined?!![]:![]:!![],'where':_0x21787b[_0x73bd('0x18')]?_0x21787b[_0x73bd('0x18')]['where']||null:null,'attributes':_0x21787b[_0x73bd('0x18')]?_0x21787b[_0x73bd('0x18')][_0x73bd('0x1a')]||null:null,'limit':_0x21787b['options']?_0x21787b['options']['limit']||null:null,'include':_0x21787b[_0x73bd('0x18')]?_0x21787b[_0x73bd('0x18')]['include']?_[_0x73bd('0x1b')](_0x21787b[_0x73bd('0x18')][_0x73bd('0x1c')],function(_0x325cc1){return{'model':db[_0x325cc1[_0x73bd('0x1d')]],'as':_0x325cc1['as'],'attributes':_0x325cc1[_0x73bd('0x1a')],'include':_0x325cc1[_0x73bd('0x1c')]?_[_0x73bd('0x1b')](_0x325cc1[_0x73bd('0x1c')],function(_0x2dd70b){return{'model':db[_0x2dd70b[_0x73bd('0x1d')]],'as':_0x2dd70b['as'],'attributes':_0x2dd70b[_0x73bd('0x1a')],'include':_0x2dd70b[_0x73bd('0x1c')]?_[_0x73bd('0x1b')](_0x2dd70b[_0x73bd('0x1c')],function(_0x52e910){return{'model':db[_0x52e910['model']],'as':_0x52e910['as'],'attributes':_0x52e910[_0x73bd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x73bd('0x1e')](function(_0x5ebf3c){logger[_0x73bd('0xa')](_0x73bd('0x15'),_0x21787b);logger[_0x73bd('0xc')]('GetDynamics365Account',_0x21787b,JSON['stringify'](_0x5ebf3c));_0x1e559b(_0x5ebf3c);})[_0x73bd('0x14')](function(_0x3f15f8){logger[_0x73bd('0xf')]('GetDynamics365Account',_0x3f15f8[_0x73bd('0x12')],_0x21787b);_0x35af6e(_0x482009['error'](0x1f4,_0x3f15f8[_0x73bd('0x12')]));});});};exports[_0x73bd('0x1f')]=function(_0x5d914c){var _0x4c47d4=this;return new Promise(function(_0x2b13c3,_0x2a2144){return db[_0x73bd('0x16')][_0x73bd('0x20')]({'raw':_0x5d914c['options']?_0x5d914c[_0x73bd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d914c[_0x73bd('0x18')]?_0x5d914c[_0x73bd('0x18')][_0x73bd('0x21')]||null:null,'attributes':_0x5d914c[_0x73bd('0x18')]?_0x5d914c['options'][_0x73bd('0x1a')]||null:null,'include':_0x5d914c[_0x73bd('0x18')]?_0x5d914c[_0x73bd('0x18')][_0x73bd('0x1c')]?_[_0x73bd('0x1b')](_0x5d914c[_0x73bd('0x18')][_0x73bd('0x1c')],function(_0x2c4362){return{'model':db[_0x2c4362['model']],'as':_0x2c4362['as'],'attributes':_0x2c4362[_0x73bd('0x1a')],'include':_0x2c4362[_0x73bd('0x1c')]?_['map'](_0x2c4362[_0x73bd('0x1c')],function(_0x177c03){return{'model':db[_0x177c03['model']],'as':_0x177c03['as'],'attributes':_0x177c03[_0x73bd('0x1a')],'include':_0x177c03['include']?_[_0x73bd('0x1b')](_0x177c03['include'],function(_0x380fb1){return{'model':db[_0x380fb1[_0x73bd('0x1d')]],'as':_0x380fb1['as'],'attributes':_0x380fb1[_0x73bd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x73bd('0x1e')](function(_0x5db723){logger[_0x73bd('0xa')](_0x73bd('0x1f'),_0x5d914c);logger['debug'](_0x73bd('0x1f'),_0x5d914c,JSON[_0x73bd('0xe')](_0x5db723));_0x2b13c3(_0x5db723);})['catch'](function(_0x17041d){logger['error'](_0x73bd('0x1f'),_0x17041d[_0x73bd('0x12')],_0x5d914c);_0x2a2144(_0x4c47d4[_0x73bd('0xf')](0x1f4,_0x17041d[_0x73bd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b57ca59..081e706 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 _0x61fb=['show','/:id/fields','getFields','getDescriptions','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x51ef1b,_0x5984a1){var _0x5c5368=function(_0x561ddd){while(--_0x561ddd){_0x51ef1b['push'](_0x51ef1b['shift']());}};_0x5c5368(++_0x5984a1);}(_0x61fb,0x1a8));var _0xb61f=function(_0x399486,_0x5319d4){_0x399486=_0x399486-0x0;var _0x381361=_0x61fb[_0x399486];return _0x381361;};'use strict';var multer=require(_0xb61f('0x0'));var util=require(_0xb61f('0x1'));var path=require(_0xb61f('0x2'));var timeout=require(_0xb61f('0x3'));var express=require('express');var router=express[_0xb61f('0x4')]();var fs_extra=require(_0xb61f('0x5'));var auth=require(_0xb61f('0x6'));var interaction=require(_0xb61f('0x7'));var config=require(_0xb61f('0x8'));var controller=require(_0xb61f('0x9'));router[_0xb61f('0xa')]('/',auth[_0xb61f('0xb')](),controller[_0xb61f('0xc')]);router[_0xb61f('0xa')]('/:id',auth[_0xb61f('0xb')](),controller[_0xb61f('0xd')]);router[_0xb61f('0xa')](_0xb61f('0xe'),auth[_0xb61f('0xb')](),controller[_0xb61f('0xf')]);router[_0xb61f('0xa')]('/:id/subjects',auth[_0xb61f('0xb')](),controller['getSubjects']);router[_0xb61f('0xa')]('/:id/descriptions',auth[_0xb61f('0xb')](),controller[_0xb61f('0x10')]);router['post']('/',auth[_0xb61f('0xb')](),controller[_0xb61f('0x11')]);router[_0xb61f('0x12')]('/:id',auth[_0xb61f('0xb')](),controller[_0xb61f('0x13')]);router[_0xb61f('0x14')](_0xb61f('0x15'),auth[_0xb61f('0xb')](),controller[_0xb61f('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5799=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x5799,0x1f4));var _0x9579=function(_0x4b4da9,_0x28ae3b){_0x4b4da9=_0x4b4da9-0x0;var _0x2a01c9=_0x5799[_0x4b4da9];return _0x2a01c9;};'use strict';var multer=require(_0x9579('0x0'));var util=require('util');var path=require(_0x9579('0x1'));var timeout=require(_0x9579('0x2'));var express=require(_0x9579('0x3'));var router=express[_0x9579('0x4')]();var fs_extra=require(_0x9579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9579('0x6'));var config=require(_0x9579('0x7'));var controller=require(_0x9579('0x8'));router[_0x9579('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9579('0xa'),auth['isAuthenticated'](),controller[_0x9579('0xb')]);router['get'](_0x9579('0xc'),auth[_0x9579('0xd')](),controller[_0x9579('0xe')]);router['get'](_0x9579('0xf'),auth['isAuthenticated'](),controller[_0x9579('0x10')]);router[_0x9579('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9579('0x11')]);router[_0x9579('0x12')]('/',auth['isAuthenticated'](),controller[_0x9579('0x13')]);router[_0x9579('0x14')](_0x9579('0xa'),auth[_0x9579('0xd')](),controller[_0x9579('0x15')]);router[_0x9579('0x16')](_0x9579('0xa'),auth[_0x9579('0xd')](),controller['destroy']);module[_0x9579('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 09b7c9a..efd4649 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 _0xf6d8=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x1b16ba,_0xe1a8dc){var _0x30d703=function(_0x4b6f53){while(--_0x4b6f53){_0x1b16ba['push'](_0x1b16ba['shift']());}};_0x30d703(++_0xe1a8dc);}(_0xf6d8,0x1b9));var _0x8f6d=function(_0x1e160c,_0x379634){_0x1e160c=_0x1e160c-0x0;var _0x295f08=_0xf6d8[_0x1e160c];return _0x295f08;};'use strict';var Sequelize=require(_0x8f6d('0x0'));module[_0x8f6d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8f6d('0x2')]},'ticketType':{'type':Sequelize[_0x8f6d('0x3')](_0x8f6d('0x4'),_0x8f6d('0x5')),'defaultValue':_0x8f6d('0x4')}}; \ No newline at end of file +var _0xc193=['incident','sequelize','exports','STRING','ENUM','phonecall'];(function(_0x82f586,_0x382c19){var _0x591ec8=function(_0xe5a055){while(--_0xe5a055){_0x82f586['push'](_0x82f586['shift']());}};_0x591ec8(++_0x382c19);}(_0xc193,0x127));var _0x3c19=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc193[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x3c19('0x0'));module[_0x3c19('0x1')]={'name':{'type':Sequelize[_0x3c19('0x2')]},'description':{'type':Sequelize[_0x3c19('0x2')]},'ticketType':{'type':Sequelize[_0x3c19('0x3')]('incident',_0x3c19('0x4')),'defaultValue':_0x3c19('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index abebebd..1dd737c 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 _0xb10b=['type','options','Dynamics365Configuration','includeAll','findAll','rows','show','length','include','find','create','params','getFields','findOne','order','Dynamics365Field','getSubjects','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','stack','name','merge','body','contact','agent','interaction','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where'];(function(_0x205ef7,_0xbb1df5){var _0x42eb06=function(_0x26b1ce){while(--_0x26b1ce){_0x205ef7['push'](_0x205ef7['shift']());}};_0x42eb06(++_0xbb1df5);}(_0xb10b,0x12a));var _0xbb10=function(_0x19f00f,_0x181deb){_0x19f00f=_0x19f00f-0x0;var _0x332a97=_0xb10b[_0x19f00f];return _0x332a97;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];var jayson=require(_0xbb10('0x18'));var client=jayson[_0xbb10('0x19')][_0xbb10('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x442548,_0x147230,_0x58a612,_0x26e021){return new BPromise(function(_0x42d7e4,_0x45b9d6){var _0x17fd46=_0x26e021||client;return _0x17fd46[_0xbb10('0x1b')](_0x442548,_0x58a612)[_0xbb10('0x1c')](function(_0x24a57b){logger[_0xbb10('0x1d')](_0xbb10('0x1e'),_0x147230,_0xbb10('0x1f'));logger['debug'](_0xbb10('0x20'),_0x147230,_0xbb10('0x1f'),JSON[_0xbb10('0x21')](_0x24a57b));if(_0x24a57b[_0xbb10('0x22')]){if(_0x24a57b[_0xbb10('0x22')][_0xbb10('0x23')]===0x1f4){logger[_0xbb10('0x22')](_0xbb10('0x1e'),_0x147230,_0x24a57b[_0xbb10('0x22')][_0xbb10('0x24')]);return _0x45b9d6(_0x24a57b['error'][_0xbb10('0x24')]);}logger[_0xbb10('0x22')](_0xbb10('0x1e'),_0x147230,_0x24a57b[_0xbb10('0x22')][_0xbb10('0x24')]);return _0x42d7e4(_0x24a57b[_0xbb10('0x22')]['message']);}else{logger[_0xbb10('0x1d')](_0xbb10('0x1e'),_0x147230,'request\x20sent');_0x42d7e4(_0x24a57b['result'][_0xbb10('0x24')]);}})[_0xbb10('0x25')](function(_0x2e911d){logger[_0xbb10('0x22')](_0xbb10('0x1e'),_0x147230,_0x2e911d);_0x45b9d6(_0x2e911d);});});}function respondWithStatusCode(_0x1824b7,_0x407cb4){_0x407cb4=_0x407cb4||0xcc;return function(_0x436104){if(_0x436104){return _0x1824b7[_0xbb10('0x26')](_0x407cb4);}return _0x1824b7[_0xbb10('0x27')](_0x407cb4)[_0xbb10('0x28')]();};}function respondWithResult(_0x26ad93,_0x537898){_0x537898=_0x537898||0xc8;return function(_0x4fedac){if(_0x4fedac){return _0x26ad93['status'](_0x537898)[_0xbb10('0x29')](_0x4fedac);}};}function respondWithFilteredResult(_0x3c5ae7,_0x2c89b9){return function(_0x4e25ff){if(_0x4e25ff){var _0x2fdde9=typeof _0x2c89b9[_0xbb10('0x2a')]===_0xbb10('0x2b')&&typeof _0x2c89b9[_0xbb10('0x2c')]===_0xbb10('0x2b');var _0x20d946=_0x4e25ff[_0xbb10('0x2d')];var _0x4aabb9=_0x2fdde9?0x0:_0x2c89b9[_0xbb10('0x2a')];var _0x21ac54=_0x2fdde9?_0x4e25ff[_0xbb10('0x2d')]:_0x2c89b9[_0xbb10('0x2a')]+_0x2c89b9[_0xbb10('0x2c')];var _0x2ff4c1;if(_0x21ac54>=_0x20d946){_0x21ac54=_0x20d946;_0x2ff4c1=0xc8;}else{_0x2ff4c1=0xce;}_0x3c5ae7['status'](_0x2ff4c1);return _0x3c5ae7[_0xbb10('0x2e')]('Content-Range',_0x4aabb9+'-'+_0x21ac54+'/'+_0x20d946)[_0xbb10('0x29')](_0x4e25ff);}return null;};}function patchUpdates(_0x56f2da){return function(_0x16ad2a){try{jsonpatch[_0xbb10('0x2f')](_0x16ad2a,_0x56f2da,!![]);}catch(_0x1b59f9){return BPromise['reject'](_0x1b59f9);}return _0x16ad2a['save']();};}function saveUpdates(_0x4c3744,_0x34f65e){return function(_0x4f590d){if(_0x4f590d){return _0x4f590d[_0xbb10('0x30')](_0x4c3744)[_0xbb10('0x1c')](function(_0x2f653f){return _0x2f653f;});}return null;};}function removeEntity(_0x1c0b57,_0x37a83f){return function(_0x138bc6){if(_0x138bc6){return _0x138bc6[_0xbb10('0x31')]()['then'](function(){_0x1c0b57[_0xbb10('0x27')](0xcc)[_0xbb10('0x28')]();});}};}function handleEntityNotFound(_0x441d15,_0x8c1ce6){return function(_0xfb2c5e){if(!_0xfb2c5e){_0x441d15[_0xbb10('0x26')](0x194);}return _0xfb2c5e;};}function handleError(_0x188cbd,_0x10202c){_0x10202c=_0x10202c||0x1f4;return function(_0x3c8d7d){logger['error'](_0x3c8d7d[_0xbb10('0x32')]);if(_0x3c8d7d[_0xbb10('0x33')]){delete _0x3c8d7d[_0xbb10('0x33')];}_0x188cbd[_0xbb10('0x27')](_0x10202c)['send'](_0x3c8d7d);};}function getMustacheRender(_0x111762,_0x5de37b){return Mustache['render'](_0x111762,_[_0xbb10('0x34')](_0x5de37b[_0xbb10('0x35')],{'contact':_0x5de37b[_0xbb10('0x36')],'message':_0x5de37b[_0xbb10('0x24')],'agent':_0x5de37b[_0xbb10('0x37')],'interaction':_0x5de37b[_0xbb10('0x38')],'account':_0x5de37b['account']}))||'';}exports[_0xbb10('0x39')]=function(_0x25d72f,_0x52de31){var _0x5e3fbd={},_0x5cd55f={},_0x31bee3={'count':0x0,'rows':[]};var _0x2b0b45=_[_0xbb10('0x3a')](db['Dynamics365Configuration'][_0xbb10('0x3b')],function(_0x3e8538){return{'name':_0x3e8538[_0xbb10('0x3c')],'type':_0x3e8538['type'][_0xbb10('0x3d')]};});_0x5cd55f[_0xbb10('0x3e')]=_[_0xbb10('0x3a')](_0x2b0b45,_0xbb10('0x33'));_0x5cd55f['query']=_[_0xbb10('0x3f')](_0x25d72f[_0xbb10('0x40')]);_0x5cd55f['filters']=_[_0xbb10('0x41')](_0x5cd55f[_0xbb10('0x3e')],_0x5cd55f[_0xbb10('0x40')]);_0x5e3fbd[_0xbb10('0x42')]=_[_0xbb10('0x41')](_0x5cd55f[_0xbb10('0x3e')],qs['fields'](_0x25d72f[_0xbb10('0x40')][_0xbb10('0x43')]));_0x5e3fbd[_0xbb10('0x42')]=_0x5e3fbd[_0xbb10('0x42')]['length']?_0x5e3fbd[_0xbb10('0x42')]:_0x5cd55f[_0xbb10('0x3e')];if(!_0x25d72f[_0xbb10('0x40')][_0xbb10('0x44')]('nolimit')){_0x5e3fbd[_0xbb10('0x2c')]=qs[_0xbb10('0x2c')](_0x25d72f['query']['limit']);_0x5e3fbd[_0xbb10('0x2a')]=qs['offset'](_0x25d72f[_0xbb10('0x40')][_0xbb10('0x2a')]);}_0x5e3fbd['order']=qs[_0xbb10('0x45')](_0x25d72f[_0xbb10('0x40')][_0xbb10('0x45')]);_0x5e3fbd['where']=qs[_0xbb10('0x46')](_[_0xbb10('0x47')](_0x25d72f[_0xbb10('0x40')],_0x5cd55f[_0xbb10('0x46')]),_0x2b0b45);if(_0x25d72f[_0xbb10('0x40')][_0xbb10('0x48')]){_0x5e3fbd[_0xbb10('0x49')]=_[_0xbb10('0x34')](_0x5e3fbd[_0xbb10('0x49')],{'$or':_[_0xbb10('0x3a')](_0x2b0b45,function(_0x197871){if(_0x197871[_0xbb10('0x4a')]!=='VIRTUAL'){var _0x426b95={};_0x426b95[_0x197871[_0xbb10('0x33')]]={'$like':'%'+_0x25d72f['query'][_0xbb10('0x48')]+'%'};return _0x426b95;}})});}_0x5e3fbd=_[_0xbb10('0x34')]({},_0x5e3fbd,_0x25d72f[_0xbb10('0x4b')]);var _0x5a5226={'where':_0x5e3fbd[_0xbb10('0x49')]};return db[_0xbb10('0x4c')][_0xbb10('0x2d')](_0x5a5226)['then'](function(_0x4a9793){_0x31bee3[_0xbb10('0x2d')]=_0x4a9793;if(_0x25d72f[_0xbb10('0x40')][_0xbb10('0x4d')]){_0x5e3fbd['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xbb10('0x4e')](_0x5e3fbd);})[_0xbb10('0x1c')](function(_0x1bd054){_0x31bee3[_0xbb10('0x4f')]=_0x1bd054;return _0x31bee3;})[_0xbb10('0x1c')](respondWithFilteredResult(_0x52de31,_0x5e3fbd))[_0xbb10('0x25')](handleError(_0x52de31,null));};exports[_0xbb10('0x50')]=function(_0x460788,_0x2626d8){var _0x3d7e7e={'raw':![],'where':{'id':_0x460788['params']['id']}},_0x550111={};_0x550111[_0xbb10('0x3e')]=_[_0xbb10('0x3f')](db[_0xbb10('0x4c')][_0xbb10('0x3b')]);_0x550111[_0xbb10('0x40')]=_[_0xbb10('0x3f')](_0x460788[_0xbb10('0x40')]);_0x550111[_0xbb10('0x46')]=_[_0xbb10('0x41')](_0x550111[_0xbb10('0x3e')],_0x550111[_0xbb10('0x40')]);_0x3d7e7e[_0xbb10('0x42')]=_[_0xbb10('0x41')](_0x550111[_0xbb10('0x3e')],qs[_0xbb10('0x43')](_0x460788['query'][_0xbb10('0x43')]));_0x3d7e7e['attributes']=_0x3d7e7e[_0xbb10('0x42')][_0xbb10('0x51')]?_0x3d7e7e[_0xbb10('0x42')]:_0x550111[_0xbb10('0x3e')];if(_0x460788[_0xbb10('0x40')][_0xbb10('0x4d')]){_0x3d7e7e[_0xbb10('0x52')]=[{'all':!![]}];}_0x3d7e7e=_[_0xbb10('0x34')]({},_0x3d7e7e,_0x460788[_0xbb10('0x4b')]);return db[_0xbb10('0x4c')][_0xbb10('0x53')](_0x3d7e7e)[_0xbb10('0x1c')](handleEntityNotFound(_0x2626d8,null))[_0xbb10('0x1c')](respondWithResult(_0x2626d8,null))[_0xbb10('0x25')](handleError(_0x2626d8,null));};exports[_0xbb10('0x54')]=function(_0x5de0cc,_0x4571b6){return db[_0xbb10('0x4c')][_0xbb10('0x54')](_0x5de0cc[_0xbb10('0x35')],{})[_0xbb10('0x1c')](respondWithResult(_0x4571b6,0xc9))[_0xbb10('0x25')](handleError(_0x4571b6,null));};exports['update']=function(_0x120bda,_0x4731ce){if(_0x120bda[_0xbb10('0x35')]['id']){delete _0x120bda[_0xbb10('0x35')]['id'];}return db[_0xbb10('0x4c')][_0xbb10('0x53')]({'where':{'id':_0x120bda[_0xbb10('0x55')]['id']}})[_0xbb10('0x1c')](handleEntityNotFound(_0x4731ce,null))[_0xbb10('0x1c')](saveUpdates(_0x120bda[_0xbb10('0x35')],null))[_0xbb10('0x1c')](respondWithResult(_0x4731ce,null))[_0xbb10('0x25')](handleError(_0x4731ce,null));};exports[_0xbb10('0x31')]=function(_0x4e7fac,_0x4ea1a6){return db[_0xbb10('0x4c')][_0xbb10('0x53')]({'where':{'id':_0x4e7fac[_0xbb10('0x55')]['id']}})[_0xbb10('0x1c')](handleEntityNotFound(_0x4ea1a6,null))['then'](removeEntity(_0x4ea1a6,null))['catch'](handleError(_0x4ea1a6,null));};exports[_0xbb10('0x56')]=function(_0xaf2cc3,_0x410bef,_0x2dd150){var _0x412f13={};var _0x3e9753={};var _0x45c0dc;var _0x4a5fb9;return db[_0xbb10('0x4c')][_0xbb10('0x57')]({'where':{'id':_0xaf2cc3['params']['id']}})['then'](handleEntityNotFound(_0x410bef,null))['then'](function(_0x32c1e8){if(_0x32c1e8){_0x45c0dc=_0x32c1e8;_0x3e9753[_0xbb10('0x3e')]=_[_0xbb10('0x3f')](db['Dynamics365Field']['rawAttributes']);_0x3e9753['query']=_[_0xbb10('0x3f')](_0xaf2cc3[_0xbb10('0x40')]);_0x3e9753[_0xbb10('0x46')]=_['intersection'](_0x3e9753[_0xbb10('0x3e')],_0x3e9753[_0xbb10('0x40')]);_0x412f13['attributes']=_['intersection'](_0x3e9753[_0xbb10('0x3e')],qs[_0xbb10('0x43')](_0xaf2cc3[_0xbb10('0x40')][_0xbb10('0x43')]));_0x412f13['attributes']=_0x412f13[_0xbb10('0x42')][_0xbb10('0x51')]?_0x412f13[_0xbb10('0x42')]:_0x3e9753['model'];_0x412f13[_0xbb10('0x58')]=qs[_0xbb10('0x45')](_0xaf2cc3[_0xbb10('0x40')]['sort']);_0x412f13[_0xbb10('0x49')]=qs[_0xbb10('0x46')](_[_0xbb10('0x47')](_0xaf2cc3[_0xbb10('0x40')],_0x3e9753['filters']));if(_0xaf2cc3[_0xbb10('0x40')][_0xbb10('0x48')]){_0x412f13[_0xbb10('0x49')]=_[_0xbb10('0x34')](_0x412f13['where'],{'$or':_[_0xbb10('0x3a')](_0x412f13[_0xbb10('0x42')],function(_0x2a166e){var _0x2ceb3e={};_0x2ceb3e[_0x2a166e]={'$like':'%'+_0xaf2cc3[_0xbb10('0x40')][_0xbb10('0x48')]+'%'};return _0x2ceb3e;})});}_0x412f13=_[_0xbb10('0x34')]({},_0x412f13,_0xaf2cc3['options']);return _0x45c0dc['getFields'](_0x412f13);}})['then'](function(_0xdfbc0b){if(_0xdfbc0b){_0x4a5fb9=_0xdfbc0b[_0xbb10('0x51')];if(!_0xaf2cc3[_0xbb10('0x40')]['hasOwnProperty']('nolimit')){_0x412f13[_0xbb10('0x2c')]=qs[_0xbb10('0x2c')](_0xaf2cc3[_0xbb10('0x40')][_0xbb10('0x2c')]);_0x412f13[_0xbb10('0x2a')]=qs[_0xbb10('0x2a')](_0xaf2cc3['query'][_0xbb10('0x2a')]);}return _0x45c0dc[_0xbb10('0x56')](_0x412f13);}})[_0xbb10('0x1c')](function(_0x14f16b){if(_0x14f16b){return _0x14f16b?{'count':_0x4a5fb9,'rows':_0x14f16b}:null;}})[_0xbb10('0x1c')](respondWithResult(_0x410bef,null))['catch'](handleError(_0x410bef,null));};exports['getSubjects']=function(_0x5ad6ad,_0x329da7,_0x1e0569){var _0x36917f={};var _0x21459e={};var _0x2f7d2a;var _0x1d40b8;return db['Dynamics365Configuration'][_0xbb10('0x57')]({'where':{'id':_0x5ad6ad['params']['id']}})['then'](handleEntityNotFound(_0x329da7,null))['then'](function(_0xdf634f){if(_0xdf634f){_0x2f7d2a=_0xdf634f;_0x21459e[_0xbb10('0x3e')]=_[_0xbb10('0x3f')](db[_0xbb10('0x59')]['rawAttributes']);_0x21459e[_0xbb10('0x40')]=_['keys'](_0x5ad6ad['query']);_0x21459e[_0xbb10('0x46')]=_[_0xbb10('0x41')](_0x21459e[_0xbb10('0x3e')],_0x21459e[_0xbb10('0x40')]);_0x36917f[_0xbb10('0x42')]=_['intersection'](_0x21459e[_0xbb10('0x3e')],qs[_0xbb10('0x43')](_0x5ad6ad[_0xbb10('0x40')][_0xbb10('0x43')]));_0x36917f[_0xbb10('0x42')]=_0x36917f[_0xbb10('0x42')][_0xbb10('0x51')]?_0x36917f['attributes']:_0x21459e[_0xbb10('0x3e')];_0x36917f[_0xbb10('0x58')]=qs[_0xbb10('0x45')](_0x5ad6ad[_0xbb10('0x40')][_0xbb10('0x45')]);_0x36917f[_0xbb10('0x49')]=qs[_0xbb10('0x46')](_[_0xbb10('0x47')](_0x5ad6ad['query'],_0x21459e[_0xbb10('0x46')]));if(_0x5ad6ad[_0xbb10('0x40')][_0xbb10('0x48')]){_0x36917f['where']=_['merge'](_0x36917f['where'],{'$or':_[_0xbb10('0x3a')](_0x36917f['attributes'],function(_0x4e3d6a){var _0x1701c5={};_0x1701c5[_0x4e3d6a]={'$like':'%'+_0x5ad6ad[_0xbb10('0x40')][_0xbb10('0x48')]+'%'};return _0x1701c5;})});}_0x36917f=_[_0xbb10('0x34')]({},_0x36917f,_0x5ad6ad[_0xbb10('0x4b')]);return _0x2f7d2a[_0xbb10('0x5a')](_0x36917f);}})[_0xbb10('0x1c')](function(_0x417304){if(_0x417304){_0x1d40b8=_0x417304[_0xbb10('0x51')];if(!_0x5ad6ad['query'][_0xbb10('0x44')](_0xbb10('0x5b'))){_0x36917f[_0xbb10('0x2c')]=qs[_0xbb10('0x2c')](_0x5ad6ad['query']['limit']);_0x36917f[_0xbb10('0x2a')]=qs[_0xbb10('0x2a')](_0x5ad6ad[_0xbb10('0x40')][_0xbb10('0x2a')]);}return _0x2f7d2a['getSubjects'](_0x36917f);}})[_0xbb10('0x1c')](function(_0x275bce){if(_0x275bce){return _0x275bce?{'count':_0x1d40b8,'rows':_0x275bce}:null;}})[_0xbb10('0x1c')](respondWithResult(_0x329da7,null))[_0xbb10('0x25')](handleError(_0x329da7,null));};exports[_0xbb10('0x5c')]=function(_0x517185,_0x5f0691,_0x372636){var _0x53c698={};var _0x22c030={};var _0x5239da;var _0x256b35;return db[_0xbb10('0x4c')]['findOne']({'where':{'id':_0x517185['params']['id']}})[_0xbb10('0x1c')](handleEntityNotFound(_0x5f0691,null))[_0xbb10('0x1c')](function(_0x177f77){if(_0x177f77){_0x5239da=_0x177f77;_0x22c030['model']=_[_0xbb10('0x3f')](db[_0xbb10('0x59')][_0xbb10('0x3b')]);_0x22c030[_0xbb10('0x40')]=_[_0xbb10('0x3f')](_0x517185[_0xbb10('0x40')]);_0x22c030[_0xbb10('0x46')]=_[_0xbb10('0x41')](_0x22c030[_0xbb10('0x3e')],_0x22c030['query']);_0x53c698[_0xbb10('0x42')]=_[_0xbb10('0x41')](_0x22c030[_0xbb10('0x3e')],qs[_0xbb10('0x43')](_0x517185[_0xbb10('0x40')][_0xbb10('0x43')]));_0x53c698[_0xbb10('0x42')]=_0x53c698[_0xbb10('0x42')][_0xbb10('0x51')]?_0x53c698[_0xbb10('0x42')]:_0x22c030[_0xbb10('0x3e')];_0x53c698[_0xbb10('0x58')]=qs['sort'](_0x517185['query'][_0xbb10('0x45')]);_0x53c698[_0xbb10('0x49')]=qs[_0xbb10('0x46')](_[_0xbb10('0x47')](_0x517185[_0xbb10('0x40')],_0x22c030['filters']));if(_0x517185[_0xbb10('0x40')][_0xbb10('0x48')]){_0x53c698[_0xbb10('0x49')]=_[_0xbb10('0x34')](_0x53c698[_0xbb10('0x49')],{'$or':_[_0xbb10('0x3a')](_0x53c698['attributes'],function(_0xb25e71){var _0x742e10={};_0x742e10[_0xb25e71]={'$like':'%'+_0x517185['query'][_0xbb10('0x48')]+'%'};return _0x742e10;})});}_0x53c698=_['merge']({},_0x53c698,_0x517185[_0xbb10('0x4b')]);return _0x5239da[_0xbb10('0x5c')](_0x53c698);}})[_0xbb10('0x1c')](function(_0xa99bf5){if(_0xa99bf5){_0x256b35=_0xa99bf5[_0xbb10('0x51')];if(!_0x517185['query'][_0xbb10('0x44')]('nolimit')){_0x53c698[_0xbb10('0x2c')]=qs[_0xbb10('0x2c')](_0x517185['query']['limit']);_0x53c698[_0xbb10('0x2a')]=qs[_0xbb10('0x2a')](_0x517185[_0xbb10('0x40')][_0xbb10('0x2a')]);}return _0x5239da[_0xbb10('0x5c')](_0x53c698);}})[_0xbb10('0x1c')](function(_0x1b6ebc){if(_0x1b6ebc){return _0x1b6ebc?{'count':_0x256b35,'rows':_0x1b6ebc}:null;}})[_0xbb10('0x1c')](respondWithResult(_0x5f0691,null))[_0xbb10('0x25')](handleError(_0x5f0691,null));}; \ No newline at end of file +var _0x5f2f=['nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','Dynamics365Configuration','includeAll','findAll','rows','params','rawAttributes','include','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','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','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','sendStatus','stack','name','send','merge','body','contact','agent','account','map','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1dd034,_0x5f5a76){var _0x4ecb48=function(_0x18ee58){while(--_0x18ee58){_0x1dd034['push'](_0x1dd034['shift']());}};_0x4ecb48(++_0x5f5a76);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32938d,_0x4d6ae0){_0x32938d=_0x32938d-0x0;var _0x5b1b0c=_0x5f2f[_0x32938d];return _0x5b1b0c;};'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'];var jayson=require(_0xf5f2('0x18'));var client=jayson[_0xf5f2('0x19')][_0xf5f2('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3e5956,_0x5c01b8,_0x5850f4,_0xea612c){return new BPromise(function(_0x269909,_0x1c1a5c){var _0x422b55=_0xea612c||client;return _0x422b55['request'](_0x3e5956,_0x5850f4)[_0xf5f2('0x1b')](function(_0x286197){logger[_0xf5f2('0x1c')](_0xf5f2('0x1d'),_0x5c01b8,_0xf5f2('0x1e'));logger[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x5c01b8,_0xf5f2('0x1e'),JSON[_0xf5f2('0x21')](_0x286197));if(_0x286197[_0xf5f2('0x22')]){if(_0x286197[_0xf5f2('0x22')][_0xf5f2('0x23')]===0x1f4){logger[_0xf5f2('0x22')](_0xf5f2('0x1d'),_0x5c01b8,_0x286197[_0xf5f2('0x22')][_0xf5f2('0x24')]);return _0x1c1a5c(_0x286197[_0xf5f2('0x22')]['message']);}logger[_0xf5f2('0x22')](_0xf5f2('0x1d'),_0x5c01b8,_0x286197['error']['message']);return _0x269909(_0x286197[_0xf5f2('0x22')][_0xf5f2('0x24')]);}else{logger['info'](_0xf5f2('0x1d'),_0x5c01b8,_0xf5f2('0x1e'));_0x269909(_0x286197[_0xf5f2('0x25')][_0xf5f2('0x24')]);}})[_0xf5f2('0x26')](function(_0x4c691a){logger[_0xf5f2('0x22')](_0xf5f2('0x1d'),_0x5c01b8,_0x4c691a);_0x1c1a5c(_0x4c691a);});});}function respondWithStatusCode(_0x4e8bda,_0x2833fe){_0x2833fe=_0x2833fe||0xcc;return function(_0x287ad5){if(_0x287ad5){return _0x4e8bda['sendStatus'](_0x2833fe);}return _0x4e8bda['status'](_0x2833fe)[_0xf5f2('0x27')]();};}function respondWithResult(_0x3f79d5,_0x13da6f){_0x13da6f=_0x13da6f||0xc8;return function(_0x1a5bb3){if(_0x1a5bb3){return _0x3f79d5[_0xf5f2('0x28')](_0x13da6f)[_0xf5f2('0x29')](_0x1a5bb3);}};}function respondWithFilteredResult(_0x13a3be,_0x281ec8){return function(_0x294414){if(_0x294414){var _0x4ab014=typeof _0x281ec8[_0xf5f2('0x2a')]===_0xf5f2('0x2b')&&typeof _0x281ec8[_0xf5f2('0x2c')]===_0xf5f2('0x2b');var _0x198c73=_0x294414[_0xf5f2('0x2d')];var _0x5b6672=_0x4ab014?0x0:_0x281ec8['offset'];var _0x22c826=_0x4ab014?_0x294414[_0xf5f2('0x2d')]:_0x281ec8[_0xf5f2('0x2a')]+_0x281ec8['limit'];var _0x5a2c7e;if(_0x22c826>=_0x198c73){_0x22c826=_0x198c73;_0x5a2c7e=0xc8;}else{_0x5a2c7e=0xce;}_0x13a3be[_0xf5f2('0x28')](_0x5a2c7e);return _0x13a3be[_0xf5f2('0x2e')](_0xf5f2('0x2f'),_0x5b6672+'-'+_0x22c826+'/'+_0x198c73)[_0xf5f2('0x29')](_0x294414);}return null;};}function patchUpdates(_0x1b381e){return function(_0x54c0c8){try{jsonpatch['apply'](_0x54c0c8,_0x1b381e,!![]);}catch(_0x2f4778){return BPromise['reject'](_0x2f4778);}return _0x54c0c8[_0xf5f2('0x30')]();};}function saveUpdates(_0x58a4df,_0x45b643){return function(_0x31087c){if(_0x31087c){return _0x31087c[_0xf5f2('0x31')](_0x58a4df)[_0xf5f2('0x1b')](function(_0x256bd9){return _0x256bd9;});}return null;};}function removeEntity(_0x277eee,_0x2ac089){return function(_0x2c0e05){if(_0x2c0e05){return _0x2c0e05['destroy']()[_0xf5f2('0x1b')](function(){_0x277eee[_0xf5f2('0x28')](0xcc)[_0xf5f2('0x27')]();});}};}function handleEntityNotFound(_0x43c77d,_0x1408b9){return function(_0x27c0e7){if(!_0x27c0e7){_0x43c77d[_0xf5f2('0x32')](0x194);}return _0x27c0e7;};}function handleError(_0x48d64d,_0x144646){_0x144646=_0x144646||0x1f4;return function(_0xf503e8){logger['error'](_0xf503e8[_0xf5f2('0x33')]);if(_0xf503e8['name']){delete _0xf503e8[_0xf5f2('0x34')];}_0x48d64d[_0xf5f2('0x28')](_0x144646)[_0xf5f2('0x35')](_0xf503e8);};}function getMustacheRender(_0x2e3cca,_0x59a6dd){return Mustache['render'](_0x2e3cca,_[_0xf5f2('0x36')](_0x59a6dd[_0xf5f2('0x37')],{'contact':_0x59a6dd[_0xf5f2('0x38')],'message':_0x59a6dd['message'],'agent':_0x59a6dd[_0xf5f2('0x39')],'interaction':_0x59a6dd['interaction'],'account':_0x59a6dd[_0xf5f2('0x3a')]}))||'';}exports['index']=function(_0x46f464,_0x456764){var _0x5337a6={},_0x29694f={},_0x46eb22={'count':0x0,'rows':[]};var _0x5a4441=_[_0xf5f2('0x3b')](db['Dynamics365Configuration']['rawAttributes'],function(_0x3d328f){return{'name':_0x3d328f[_0xf5f2('0x3c')],'type':_0x3d328f[_0xf5f2('0x3d')][_0xf5f2('0x3e')]};});_0x29694f[_0xf5f2('0x3f')]=_[_0xf5f2('0x3b')](_0x5a4441,_0xf5f2('0x34'));_0x29694f['query']=_[_0xf5f2('0x40')](_0x46f464[_0xf5f2('0x41')]);_0x29694f['filters']=_[_0xf5f2('0x42')](_0x29694f[_0xf5f2('0x3f')],_0x29694f[_0xf5f2('0x41')]);_0x5337a6[_0xf5f2('0x43')]=_[_0xf5f2('0x42')](_0x29694f[_0xf5f2('0x3f')],qs[_0xf5f2('0x44')](_0x46f464[_0xf5f2('0x41')]['fields']));_0x5337a6[_0xf5f2('0x43')]=_0x5337a6[_0xf5f2('0x43')][_0xf5f2('0x45')]?_0x5337a6['attributes']:_0x29694f['model'];if(!_0x46f464['query'][_0xf5f2('0x46')](_0xf5f2('0x47'))){_0x5337a6['limit']=qs[_0xf5f2('0x2c')](_0x46f464[_0xf5f2('0x41')][_0xf5f2('0x2c')]);_0x5337a6[_0xf5f2('0x2a')]=qs[_0xf5f2('0x2a')](_0x46f464[_0xf5f2('0x41')][_0xf5f2('0x2a')]);}_0x5337a6[_0xf5f2('0x48')]=qs[_0xf5f2('0x49')](_0x46f464[_0xf5f2('0x41')][_0xf5f2('0x49')]);_0x5337a6[_0xf5f2('0x4a')]=qs[_0xf5f2('0x4b')](_[_0xf5f2('0x4c')](_0x46f464['query'],_0x29694f[_0xf5f2('0x4b')]),_0x5a4441);if(_0x46f464['query'][_0xf5f2('0x4d')]){_0x5337a6[_0xf5f2('0x4a')]=_[_0xf5f2('0x36')](_0x5337a6[_0xf5f2('0x4a')],{'$or':_[_0xf5f2('0x3b')](_0x5a4441,function(_0x3721c4){if(_0x3721c4['type']!==_0xf5f2('0x4e')){var _0x2e7193={};_0x2e7193[_0x3721c4[_0xf5f2('0x34')]]={'$like':'%'+_0x46f464[_0xf5f2('0x41')][_0xf5f2('0x4d')]+'%'};return _0x2e7193;}})});}_0x5337a6=_[_0xf5f2('0x36')]({},_0x5337a6,_0x46f464[_0xf5f2('0x4f')]);var _0x297f07={'where':_0x5337a6['where']};return db[_0xf5f2('0x50')][_0xf5f2('0x2d')](_0x297f07)[_0xf5f2('0x1b')](function(_0x492eea){_0x46eb22[_0xf5f2('0x2d')]=_0x492eea;if(_0x46f464[_0xf5f2('0x41')][_0xf5f2('0x51')]){_0x5337a6['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xf5f2('0x52')](_0x5337a6);})[_0xf5f2('0x1b')](function(_0x5db519){_0x46eb22[_0xf5f2('0x53')]=_0x5db519;return _0x46eb22;})['then'](respondWithFilteredResult(_0x456764,_0x5337a6))[_0xf5f2('0x26')](handleError(_0x456764,null));};exports['show']=function(_0x2cbd9d,_0x5d9120){var _0x2d9017={'raw':![],'where':{'id':_0x2cbd9d[_0xf5f2('0x54')]['id']}},_0xb8ea3a={};_0xb8ea3a[_0xf5f2('0x3f')]=_['keys'](db[_0xf5f2('0x50')][_0xf5f2('0x55')]);_0xb8ea3a['query']=_['keys'](_0x2cbd9d[_0xf5f2('0x41')]);_0xb8ea3a[_0xf5f2('0x4b')]=_['intersection'](_0xb8ea3a[_0xf5f2('0x3f')],_0xb8ea3a[_0xf5f2('0x41')]);_0x2d9017[_0xf5f2('0x43')]=_[_0xf5f2('0x42')](_0xb8ea3a['model'],qs['fields'](_0x2cbd9d[_0xf5f2('0x41')][_0xf5f2('0x44')]));_0x2d9017['attributes']=_0x2d9017[_0xf5f2('0x43')][_0xf5f2('0x45')]?_0x2d9017[_0xf5f2('0x43')]:_0xb8ea3a[_0xf5f2('0x3f')];if(_0x2cbd9d[_0xf5f2('0x41')][_0xf5f2('0x51')]){_0x2d9017[_0xf5f2('0x56')]=[{'all':!![]}];}_0x2d9017=_['merge']({},_0x2d9017,_0x2cbd9d['options']);return db[_0xf5f2('0x50')][_0xf5f2('0x57')](_0x2d9017)[_0xf5f2('0x1b')](handleEntityNotFound(_0x5d9120,null))[_0xf5f2('0x1b')](respondWithResult(_0x5d9120,null))[_0xf5f2('0x26')](handleError(_0x5d9120,null));};exports['create']=function(_0xdb1106,_0x20ba91){return db[_0xf5f2('0x50')]['create'](_0xdb1106[_0xf5f2('0x37')],{})['then'](respondWithResult(_0x20ba91,0xc9))[_0xf5f2('0x26')](handleError(_0x20ba91,null));};exports[_0xf5f2('0x31')]=function(_0x28cce5,_0x10f391){if(_0x28cce5['body']['id']){delete _0x28cce5['body']['id'];}return db[_0xf5f2('0x50')]['find']({'where':{'id':_0x28cce5[_0xf5f2('0x54')]['id']}})[_0xf5f2('0x1b')](handleEntityNotFound(_0x10f391,null))['then'](saveUpdates(_0x28cce5[_0xf5f2('0x37')],null))[_0xf5f2('0x1b')](respondWithResult(_0x10f391,null))[_0xf5f2('0x26')](handleError(_0x10f391,null));};exports['destroy']=function(_0x397b99,_0xcf7a50){return db[_0xf5f2('0x50')][_0xf5f2('0x57')]({'where':{'id':_0x397b99['params']['id']}})[_0xf5f2('0x1b')](handleEntityNotFound(_0xcf7a50,null))['then'](removeEntity(_0xcf7a50,null))[_0xf5f2('0x26')](handleError(_0xcf7a50,null));};exports[_0xf5f2('0x58')]=function(_0x2e6f5d,_0x380c08,_0x9f210e){var _0x5583c2={};var _0xda8dda={};var _0xacd80;var _0x3461e5;return db[_0xf5f2('0x50')][_0xf5f2('0x59')]({'where':{'id':_0x2e6f5d['params']['id']}})[_0xf5f2('0x1b')](handleEntityNotFound(_0x380c08,null))['then'](function(_0x4c96ee){if(_0x4c96ee){_0xacd80=_0x4c96ee;_0xda8dda[_0xf5f2('0x3f')]=_['keys'](db[_0xf5f2('0x5a')][_0xf5f2('0x55')]);_0xda8dda[_0xf5f2('0x41')]=_[_0xf5f2('0x40')](_0x2e6f5d['query']);_0xda8dda[_0xf5f2('0x4b')]=_[_0xf5f2('0x42')](_0xda8dda[_0xf5f2('0x3f')],_0xda8dda[_0xf5f2('0x41')]);_0x5583c2[_0xf5f2('0x43')]=_[_0xf5f2('0x42')](_0xda8dda[_0xf5f2('0x3f')],qs['fields'](_0x2e6f5d[_0xf5f2('0x41')][_0xf5f2('0x44')]));_0x5583c2[_0xf5f2('0x43')]=_0x5583c2[_0xf5f2('0x43')]['length']?_0x5583c2[_0xf5f2('0x43')]:_0xda8dda['model'];_0x5583c2[_0xf5f2('0x48')]=qs[_0xf5f2('0x49')](_0x2e6f5d['query'][_0xf5f2('0x49')]);_0x5583c2[_0xf5f2('0x4a')]=qs[_0xf5f2('0x4b')](_[_0xf5f2('0x4c')](_0x2e6f5d[_0xf5f2('0x41')],_0xda8dda['filters']));if(_0x2e6f5d[_0xf5f2('0x41')][_0xf5f2('0x4d')]){_0x5583c2[_0xf5f2('0x4a')]=_[_0xf5f2('0x36')](_0x5583c2[_0xf5f2('0x4a')],{'$or':_[_0xf5f2('0x3b')](_0x5583c2['attributes'],function(_0x321d4d){var _0x3f475e={};_0x3f475e[_0x321d4d]={'$like':'%'+_0x2e6f5d['query'][_0xf5f2('0x4d')]+'%'};return _0x3f475e;})});}_0x5583c2=_[_0xf5f2('0x36')]({},_0x5583c2,_0x2e6f5d[_0xf5f2('0x4f')]);return _0xacd80['getFields'](_0x5583c2);}})['then'](function(_0x4f3df6){if(_0x4f3df6){_0x3461e5=_0x4f3df6[_0xf5f2('0x45')];if(!_0x2e6f5d[_0xf5f2('0x41')][_0xf5f2('0x46')](_0xf5f2('0x47'))){_0x5583c2[_0xf5f2('0x2c')]=qs['limit'](_0x2e6f5d[_0xf5f2('0x41')][_0xf5f2('0x2c')]);_0x5583c2[_0xf5f2('0x2a')]=qs[_0xf5f2('0x2a')](_0x2e6f5d[_0xf5f2('0x41')][_0xf5f2('0x2a')]);}return _0xacd80[_0xf5f2('0x58')](_0x5583c2);}})[_0xf5f2('0x1b')](function(_0x155f45){if(_0x155f45){return _0x155f45?{'count':_0x3461e5,'rows':_0x155f45}:null;}})[_0xf5f2('0x1b')](respondWithResult(_0x380c08,null))[_0xf5f2('0x26')](handleError(_0x380c08,null));};exports['getSubjects']=function(_0x5e4e07,_0x5a143f,_0x40f362){var _0xafba8e={};var _0x3d3181={};var _0x878e8b;var _0x1bb752;return db['Dynamics365Configuration'][_0xf5f2('0x59')]({'where':{'id':_0x5e4e07[_0xf5f2('0x54')]['id']}})[_0xf5f2('0x1b')](handleEntityNotFound(_0x5a143f,null))[_0xf5f2('0x1b')](function(_0x44d119){if(_0x44d119){_0x878e8b=_0x44d119;_0x3d3181['model']=_[_0xf5f2('0x40')](db[_0xf5f2('0x5a')]['rawAttributes']);_0x3d3181[_0xf5f2('0x41')]=_[_0xf5f2('0x40')](_0x5e4e07[_0xf5f2('0x41')]);_0x3d3181[_0xf5f2('0x4b')]=_['intersection'](_0x3d3181[_0xf5f2('0x3f')],_0x3d3181[_0xf5f2('0x41')]);_0xafba8e[_0xf5f2('0x43')]=_[_0xf5f2('0x42')](_0x3d3181[_0xf5f2('0x3f')],qs['fields'](_0x5e4e07['query'][_0xf5f2('0x44')]));_0xafba8e[_0xf5f2('0x43')]=_0xafba8e[_0xf5f2('0x43')][_0xf5f2('0x45')]?_0xafba8e['attributes']:_0x3d3181['model'];_0xafba8e[_0xf5f2('0x48')]=qs['sort'](_0x5e4e07['query']['sort']);_0xafba8e['where']=qs[_0xf5f2('0x4b')](_[_0xf5f2('0x4c')](_0x5e4e07[_0xf5f2('0x41')],_0x3d3181[_0xf5f2('0x4b')]));if(_0x5e4e07[_0xf5f2('0x41')][_0xf5f2('0x4d')]){_0xafba8e[_0xf5f2('0x4a')]=_[_0xf5f2('0x36')](_0xafba8e[_0xf5f2('0x4a')],{'$or':_[_0xf5f2('0x3b')](_0xafba8e[_0xf5f2('0x43')],function(_0x2afeac){var _0x1ba503={};_0x1ba503[_0x2afeac]={'$like':'%'+_0x5e4e07[_0xf5f2('0x41')][_0xf5f2('0x4d')]+'%'};return _0x1ba503;})});}_0xafba8e=_[_0xf5f2('0x36')]({},_0xafba8e,_0x5e4e07[_0xf5f2('0x4f')]);return _0x878e8b[_0xf5f2('0x5b')](_0xafba8e);}})['then'](function(_0xe7ac8){if(_0xe7ac8){_0x1bb752=_0xe7ac8[_0xf5f2('0x45')];if(!_0x5e4e07[_0xf5f2('0x41')][_0xf5f2('0x46')](_0xf5f2('0x47'))){_0xafba8e[_0xf5f2('0x2c')]=qs[_0xf5f2('0x2c')](_0x5e4e07[_0xf5f2('0x41')]['limit']);_0xafba8e[_0xf5f2('0x2a')]=qs['offset'](_0x5e4e07['query']['offset']);}return _0x878e8b['getSubjects'](_0xafba8e);}})['then'](function(_0x4dc9d0){if(_0x4dc9d0){return _0x4dc9d0?{'count':_0x1bb752,'rows':_0x4dc9d0}:null;}})[_0xf5f2('0x1b')](respondWithResult(_0x5a143f,null))[_0xf5f2('0x26')](handleError(_0x5a143f,null));};exports[_0xf5f2('0x5c')]=function(_0x375bc9,_0x145d4d,_0x3cf857){var _0x5dc63f={};var _0x4a0005={};var _0x2fb1a6;var _0x578a22;return db[_0xf5f2('0x50')][_0xf5f2('0x59')]({'where':{'id':_0x375bc9['params']['id']}})['then'](handleEntityNotFound(_0x145d4d,null))[_0xf5f2('0x1b')](function(_0x274aa3){if(_0x274aa3){_0x2fb1a6=_0x274aa3;_0x4a0005['model']=_[_0xf5f2('0x40')](db[_0xf5f2('0x5a')]['rawAttributes']);_0x4a0005[_0xf5f2('0x41')]=_[_0xf5f2('0x40')](_0x375bc9[_0xf5f2('0x41')]);_0x4a0005['filters']=_[_0xf5f2('0x42')](_0x4a0005[_0xf5f2('0x3f')],_0x4a0005[_0xf5f2('0x41')]);_0x5dc63f[_0xf5f2('0x43')]=_[_0xf5f2('0x42')](_0x4a0005[_0xf5f2('0x3f')],qs[_0xf5f2('0x44')](_0x375bc9[_0xf5f2('0x41')][_0xf5f2('0x44')]));_0x5dc63f[_0xf5f2('0x43')]=_0x5dc63f[_0xf5f2('0x43')][_0xf5f2('0x45')]?_0x5dc63f[_0xf5f2('0x43')]:_0x4a0005[_0xf5f2('0x3f')];_0x5dc63f[_0xf5f2('0x48')]=qs[_0xf5f2('0x49')](_0x375bc9[_0xf5f2('0x41')][_0xf5f2('0x49')]);_0x5dc63f[_0xf5f2('0x4a')]=qs[_0xf5f2('0x4b')](_[_0xf5f2('0x4c')](_0x375bc9['query'],_0x4a0005[_0xf5f2('0x4b')]));if(_0x375bc9[_0xf5f2('0x41')]['filter']){_0x5dc63f[_0xf5f2('0x4a')]=_[_0xf5f2('0x36')](_0x5dc63f['where'],{'$or':_[_0xf5f2('0x3b')](_0x5dc63f[_0xf5f2('0x43')],function(_0x335d9b){var _0x50474a={};_0x50474a[_0x335d9b]={'$like':'%'+_0x375bc9['query'][_0xf5f2('0x4d')]+'%'};return _0x50474a;})});}_0x5dc63f=_[_0xf5f2('0x36')]({},_0x5dc63f,_0x375bc9[_0xf5f2('0x4f')]);return _0x2fb1a6['getDescriptions'](_0x5dc63f);}})['then'](function(_0x2572c0){if(_0x2572c0){_0x578a22=_0x2572c0[_0xf5f2('0x45')];if(!_0x375bc9[_0xf5f2('0x41')]['hasOwnProperty']('nolimit')){_0x5dc63f['limit']=qs['limit'](_0x375bc9['query'][_0xf5f2('0x2c')]);_0x5dc63f['offset']=qs[_0xf5f2('0x2a')](_0x375bc9[_0xf5f2('0x41')][_0xf5f2('0x2a')]);}return _0x2fb1a6[_0xf5f2('0x5c')](_0x5dc63f);}})[_0xf5f2('0x1b')](function(_0x398f2b){if(_0x398f2b){return _0x398f2b?{'count':_0x578a22,'rows':_0x398f2b}:null;}})[_0xf5f2('0x1b')](respondWithResult(_0x145d4d,null))[_0xf5f2('0x26')](handleError(_0x145d4d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f066728..1a02821 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 _0x681f=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x681f,0x8f));var _0xf681=function(_0x2cf15a,_0x3ef3da){_0x2cf15a=_0x2cf15a-0x0;var _0x266488=_0x681f[_0x2cf15a];return _0x266488;};'use strict';var _=require(_0xf681('0x0'));var util=require(_0xf681('0x1'));var logger=require(_0xf681('0x2'))(_0xf681('0x3'));var moment=require(_0xf681('0x4'));var BPromise=require(_0xf681('0x5'));var rp=require(_0xf681('0x6'));var fs=require('fs');var path=require(_0xf681('0x7'));var rimraf=require(_0xf681('0x8'));var config=require(_0xf681('0x9'));var attributes=require(_0xf681('0xa'));module[_0xf681('0xb')]=function(_0x589bfa,_0x3e00d0){return _0x589bfa['define'](_0xf681('0xc'),attributes,{'tableName':_0xf681('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x528b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x117713,_0x1b3f0c){var _0x310d68=function(_0x5c266a){while(--_0x5c266a){_0x117713['push'](_0x117713['shift']());}};_0x310d68(++_0x1b3f0c);}(_0x528b,0x181));var _0xb528=function(_0x5cd9fb,_0x47e950){_0x5cd9fb=_0x5cd9fb-0x0;var _0x231e27=_0x528b[_0x5cd9fb];return _0x231e27;};'use strict';var _=require(_0xb528('0x0'));var util=require(_0xb528('0x1'));var logger=require(_0xb528('0x2'))(_0xb528('0x3'));var moment=require('moment');var BPromise=require(_0xb528('0x4'));var rp=require(_0xb528('0x5'));var fs=require('fs');var path=require(_0xb528('0x6'));var rimraf=require(_0xb528('0x7'));var config=require(_0xb528('0x8'));var attributes=require(_0xb528('0x9'));module[_0xb528('0xa')]=function(_0x1ac1ae,_0x2d30f5){return _0x1ac1ae[_0xb528('0xb')](_0xb528('0xc'),attributes,{'tableName':_0xb528('0xd'),'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 a23ca42..b81158d 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 _0x47ca=['util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','debug','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x3c967b,_0x40098b){var _0x144b17=function(_0xb65dd2){while(--_0xb65dd2){_0x3c967b['push'](_0x3c967b['shift']());}};_0x144b17(++_0x40098b);}(_0x47ca,0x9f));var _0xa47c=function(_0x2e6687,_0x119c8f){_0x2e6687=_0x2e6687-0x0;var _0x36f878=_0x47ca[_0x2e6687];return _0x36f878;};'use strict';var _=require(_0xa47c('0x0'));var util=require(_0xa47c('0x1'));var moment=require('moment');var BPromise=require(_0xa47c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa47c('0x3'));var db=require(_0xa47c('0x4'))['db'];var utils=require(_0xa47c('0x5'));var logger=require('../../config/logger')(_0xa47c('0x6'));var config=require(_0xa47c('0x7'));var jayson=require(_0xa47c('0x8'));var client=jayson[_0xa47c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x176fe1,_0x490a6c,_0x25c081){return new BPromise(function(_0x5219f4,_0x240c3c){return client[_0xa47c('0xa')](_0x176fe1,_0x25c081)['then'](function(_0x20090){logger[_0xa47c('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x490a6c,'request\x20sent');logger[_0xa47c('0xc')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x490a6c,'request\x20sent',JSON[_0xa47c('0xd')](_0x20090));if(_0x20090[_0xa47c('0xe')]){if(_0x20090[_0xa47c('0xe')][_0xa47c('0xf')]===0x1f4){logger['error'](_0xa47c('0x10'),_0x490a6c,_0x20090[_0xa47c('0xe')][_0xa47c('0x11')]);return _0x240c3c(_0x20090[_0xa47c('0xe')]['message']);}logger[_0xa47c('0xe')](_0xa47c('0x10'),_0x490a6c,_0x20090[_0xa47c('0xe')][_0xa47c('0x11')]);return _0x5219f4(_0x20090[_0xa47c('0xe')][_0xa47c('0x11')]);}else{logger[_0xa47c('0xb')](_0xa47c('0x10'),_0x490a6c,'request\x20sent');_0x5219f4(_0x20090[_0xa47c('0x12')][_0xa47c('0x11')]);}})[_0xa47c('0x13')](function(_0x4e3999){logger[_0xa47c('0xe')](_0xa47c('0x10'),_0x490a6c,_0x4e3999);_0x240c3c(_0x4e3999);});});} \ No newline at end of file +var _0xc583=['code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xf6cd3c,_0x2e99bb){var _0x3d1aa4=function(_0x155f95){while(--_0x155f95){_0xf6cd3c['push'](_0xf6cd3c['shift']());}};_0x3d1aa4(++_0x2e99bb);}(_0xc583,0xd6));var _0x3c58=function(_0x452c14,_0xbc1c5c){_0x452c14=_0x452c14-0x0;var _0x485653=_0xc583[_0x452c14];return _0x485653;};'use strict';var _=require(_0x3c58('0x0'));var util=require(_0x3c58('0x1'));var moment=require(_0x3c58('0x2'));var BPromise=require(_0x3c58('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c58('0x4'));var db=require(_0x3c58('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c58('0x6'))(_0x3c58('0x7'));var config=require(_0x3c58('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3c58('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x193c00,_0x31e94c,_0x47b0ff){return new BPromise(function(_0x5ad69b,_0x5315be){return client['request'](_0x193c00,_0x47b0ff)[_0x3c58('0xa')](function(_0x3f0eb7){logger['info'](_0x3c58('0xb'),_0x31e94c,_0x3c58('0xc'));logger[_0x3c58('0xd')](_0x3c58('0xe'),_0x31e94c,_0x3c58('0xc'),JSON[_0x3c58('0xf')](_0x3f0eb7));if(_0x3f0eb7['error']){if(_0x3f0eb7[_0x3c58('0x10')][_0x3c58('0x11')]===0x1f4){logger[_0x3c58('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x31e94c,_0x3f0eb7[_0x3c58('0x10')]['message']);return _0x5315be(_0x3f0eb7[_0x3c58('0x10')][_0x3c58('0x12')]);}logger[_0x3c58('0x10')](_0x3c58('0xb'),_0x31e94c,_0x3f0eb7[_0x3c58('0x10')]['message']);return _0x5ad69b(_0x3f0eb7[_0x3c58('0x10')]['message']);}else{logger[_0x3c58('0x13')](_0x3c58('0xb'),_0x31e94c,_0x3c58('0xc'));_0x5ad69b(_0x3f0eb7[_0x3c58('0x14')][_0x3c58('0x12')]);}})['catch'](function(_0x57acd6){logger[_0x3c58('0x10')](_0x3c58('0xb'),_0x31e94c,_0x57acd6);_0x5315be(_0x57acd6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 93e72fc..9e98424 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 _0xe0e7=['../../config/environment','./intDynamics365Field.controller','get','index','/:id','show','isAuthenticated','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3b4fa6,_0x25da94){var _0x49e0b8=function(_0x9c19ae){while(--_0x9c19ae){_0x3b4fa6['push'](_0x3b4fa6['shift']());}};_0x49e0b8(++_0x25da94);}(_0xe0e7,0x1a2));var _0x7e0e=function(_0x16e0f5,_0x4ec0f3){_0x16e0f5=_0x16e0f5-0x0;var _0x4839d5=_0xe0e7[_0x16e0f5];return _0x4839d5;};'use strict';var multer=require('multer');var util=require(_0x7e0e('0x0'));var path=require(_0x7e0e('0x1'));var timeout=require(_0x7e0e('0x2'));var express=require(_0x7e0e('0x3'));var router=express[_0x7e0e('0x4')]();var fs_extra=require(_0x7e0e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e0e('0x6'));var config=require(_0x7e0e('0x7'));var controller=require(_0x7e0e('0x8'));router[_0x7e0e('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e0e('0xa')]);router[_0x7e0e('0x9')](_0x7e0e('0xb'),auth['isAuthenticated'](),controller[_0x7e0e('0xc')]);router['post']('/',auth[_0x7e0e('0xd')](),controller['create']);router[_0x7e0e('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7e0e('0xf')]);router[_0x7e0e('0x10')](_0x7e0e('0xb'),auth[_0x7e0e('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6a55=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','path'];(function(_0x320191,_0x393952){var _0x2a7869=function(_0x3d80eb){while(--_0x3d80eb){_0x320191['push'](_0x320191['shift']());}};_0x2a7869(++_0x393952);}(_0x6a55,0x154));var _0x56a5=function(_0x591db7,_0x150445){_0x591db7=_0x591db7-0x0;var _0x4ad760=_0x6a55[_0x591db7];return _0x4ad760;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require(_0x56a5('0x1'));var timeout=require(_0x56a5('0x2'));var express=require('express');var router=express[_0x56a5('0x3')]();var fs_extra=require(_0x56a5('0x4'));var auth=require(_0x56a5('0x5'));var interaction=require(_0x56a5('0x6'));var config=require(_0x56a5('0x7'));var controller=require(_0x56a5('0x8'));router[_0x56a5('0x9')]('/',auth[_0x56a5('0xa')](),controller[_0x56a5('0xb')]);router[_0x56a5('0x9')](_0x56a5('0xc'),auth[_0x56a5('0xa')](),controller[_0x56a5('0xd')]);router[_0x56a5('0xe')]('/',auth['isAuthenticated'](),controller[_0x56a5('0xf')]);router[_0x56a5('0x10')]('/:id',auth[_0x56a5('0xa')](),controller['update']);router['delete'](_0x56a5('0xc'),auth[_0x56a5('0xa')](),controller[_0x56a5('0x11')]);module[_0x56a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a77d87f..6d89073 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 _0x6f47=['ENUM','variable','keyValue','string','STRING','customVariable','BOOLEAN','exports'];(function(_0x13ce0f,_0x354d4c){var _0x1beae8=function(_0x25a40b){while(--_0x25a40b){_0x13ce0f['push'](_0x13ce0f['shift']());}};_0x1beae8(++_0x354d4c);}(_0x6f47,0xc7));var _0x76f4=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x6f47[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'type':{'type':Sequelize[_0x76f4('0x1')]('string',_0x76f4('0x2'),'customVariable',_0x76f4('0x3'),'picklist'),'defaultValue':_0x76f4('0x4')},'content':{'type':Sequelize[_0x76f4('0x5')]},'key':{'type':Sequelize[_0x76f4('0x5')]},'keyType':{'type':Sequelize[_0x76f4('0x1')]('string',_0x76f4('0x2'),_0x76f4('0x6'))},'keyContent':{'type':Sequelize[_0x76f4('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x76f4('0x5')]},'customField':{'type':Sequelize[_0x76f4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x76f4('0x5')]}}; \ No newline at end of file +var _0xe015=['sequelize','exports','ENUM','customVariable','picklist','string','STRING','variable','BOOLEAN'];(function(_0x2a07a5,_0x329e4b){var _0x158c06=function(_0x1a2c0c){while(--_0x1a2c0c){_0x2a07a5['push'](_0x2a07a5['shift']());}};_0x158c06(++_0x329e4b);}(_0xe015,0x13b));var _0x5e01=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe015[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x5e01('0x0'));module[_0x5e01('0x1')]={'type':{'type':Sequelize[_0x5e01('0x2')]('string','variable',_0x5e01('0x3'),'keyValue',_0x5e01('0x4')),'defaultValue':_0x5e01('0x5')},'content':{'type':Sequelize[_0x5e01('0x6')]},'key':{'type':Sequelize[_0x5e01('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x5e01('0x5'),_0x5e01('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5e01('0x6')]},'nameField':{'type':Sequelize[_0x5e01('0x6')]},'customField':{'type':Sequelize[_0x5e01('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5e01('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 8b2ea4b..fabf776 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 _0x5d67=['destroy','error','stack','name','send','merge','body','contact','message','agent','interaction','account','index','map','Dynamics365Field','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','update','then'];(function(_0x1db69c,_0x10db93){var _0x59bf8b=function(_0x4b9e23){while(--_0x4b9e23){_0x1db69c['push'](_0x1db69c['shift']());}};_0x59bf8b(++_0x10db93);}(_0x5d67,0x156));var _0x75d6=function(_0x2acec8,_0xb61ffe){_0x2acec8=_0x2acec8-0x0;var _0x513f2d=_0x5d67[_0x2acec8];return _0x513f2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x75d6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d6('0x1'));var moment=require(_0x75d6('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x75d6('0x3'));var path=require(_0x75d6('0x4'));var sox=require(_0x75d6('0x5'));var csv=require(_0x75d6('0x6'));var ejs=require(_0x75d6('0x7'));var fs=require('fs');var fs_extra=require(_0x75d6('0x8'));var _=require(_0x75d6('0x9'));var squel=require(_0x75d6('0xa'));var crypto=require('crypto');var jsforce=require(_0x75d6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x75d6('0x6'));var querystring=require(_0x75d6('0xc'));var Papa=require(_0x75d6('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d6('0xe'));var hardwareService=require(_0x75d6('0xf'));var logger=require(_0x75d6('0x10'))(_0x75d6('0x11'));var utils=require('../../config/utils');var config=require(_0x75d6('0x12'));var licenseUtil=require(_0x75d6('0x13'));var db=require(_0x75d6('0x14'))['db'];function respondWithStatusCode(_0x20f11c,_0x1c9764){_0x1c9764=_0x1c9764||0xcc;return function(_0x42158f){if(_0x42158f){return _0x20f11c[_0x75d6('0x15')](_0x1c9764);}return _0x20f11c[_0x75d6('0x16')](_0x1c9764)[_0x75d6('0x17')]();};}function respondWithResult(_0x256f5d,_0xe1ebf3){_0xe1ebf3=_0xe1ebf3||0xc8;return function(_0x590614){if(_0x590614){return _0x256f5d[_0x75d6('0x16')](_0xe1ebf3)['json'](_0x590614);}};}function respondWithFilteredResult(_0x26cdb9,_0x4adbe3){return function(_0xbc0d40){if(_0xbc0d40){var _0x596459=typeof _0x4adbe3['offset']===_0x75d6('0x18')&&typeof _0x4adbe3['limit']===_0x75d6('0x18');var _0x3e327e=_0xbc0d40[_0x75d6('0x19')];var _0xa45913=_0x596459?0x0:_0x4adbe3[_0x75d6('0x1a')];var _0x39f7b0=_0x596459?_0xbc0d40[_0x75d6('0x19')]:_0x4adbe3[_0x75d6('0x1a')]+_0x4adbe3[_0x75d6('0x1b')];var _0x532b2d;if(_0x39f7b0>=_0x3e327e){_0x39f7b0=_0x3e327e;_0x532b2d=0xc8;}else{_0x532b2d=0xce;}_0x26cdb9[_0x75d6('0x16')](_0x532b2d);return _0x26cdb9['set'](_0x75d6('0x1c'),_0xa45913+'-'+_0x39f7b0+'/'+_0x3e327e)[_0x75d6('0x1d')](_0xbc0d40);}return null;};}function patchUpdates(_0x2245ef){return function(_0x5cdb56){try{jsonpatch[_0x75d6('0x1e')](_0x5cdb56,_0x2245ef,!![]);}catch(_0x2ede4c){return BPromise['reject'](_0x2ede4c);}return _0x5cdb56['save']();};}function saveUpdates(_0x2b21b6,_0xd1fb9c){return function(_0x2589e5){if(_0x2589e5){return _0x2589e5[_0x75d6('0x1f')](_0x2b21b6)[_0x75d6('0x20')](function(_0x59afd9){return _0x59afd9;});}return null;};}function removeEntity(_0x277b3a,_0x2f3ef2){return function(_0x119973){if(_0x119973){return _0x119973[_0x75d6('0x21')]()['then'](function(){_0x277b3a[_0x75d6('0x16')](0xcc)[_0x75d6('0x17')]();});}};}function handleEntityNotFound(_0x33590c,_0x455a34){return function(_0x5adf37){if(!_0x5adf37){_0x33590c['sendStatus'](0x194);}return _0x5adf37;};}function handleError(_0x1428ba,_0xa91508){_0xa91508=_0xa91508||0x1f4;return function(_0x4f7698){logger[_0x75d6('0x22')](_0x4f7698[_0x75d6('0x23')]);if(_0x4f7698[_0x75d6('0x24')]){delete _0x4f7698[_0x75d6('0x24')];}_0x1428ba[_0x75d6('0x16')](_0xa91508)[_0x75d6('0x25')](_0x4f7698);};}function getMustacheRender(_0x221855,_0x5acb03){return Mustache['render'](_0x221855,_[_0x75d6('0x26')](_0x5acb03[_0x75d6('0x27')],{'contact':_0x5acb03[_0x75d6('0x28')],'message':_0x5acb03[_0x75d6('0x29')],'agent':_0x5acb03[_0x75d6('0x2a')],'interaction':_0x5acb03[_0x75d6('0x2b')],'account':_0x5acb03[_0x75d6('0x2c')]}))||'';}exports[_0x75d6('0x2d')]=function(_0xbc89cf,_0x5bd66f){var _0x1d7cbe={},_0x521c40={},_0x45169c={'count':0x0,'rows':[]};var _0x44bf8e=_[_0x75d6('0x2e')](db[_0x75d6('0x2f')]['rawAttributes'],function(_0x28911b){return{'name':_0x28911b[_0x75d6('0x30')],'type':_0x28911b[_0x75d6('0x31')][_0x75d6('0x32')]};});_0x521c40[_0x75d6('0x33')]=_[_0x75d6('0x2e')](_0x44bf8e,_0x75d6('0x24'));_0x521c40[_0x75d6('0x34')]=_[_0x75d6('0x35')](_0xbc89cf[_0x75d6('0x34')]);_0x521c40['filters']=_['intersection'](_0x521c40[_0x75d6('0x33')],_0x521c40[_0x75d6('0x34')]);_0x1d7cbe[_0x75d6('0x36')]=_[_0x75d6('0x37')](_0x521c40[_0x75d6('0x33')],qs[_0x75d6('0x38')](_0xbc89cf[_0x75d6('0x34')][_0x75d6('0x38')]));_0x1d7cbe[_0x75d6('0x36')]=_0x1d7cbe[_0x75d6('0x36')][_0x75d6('0x39')]?_0x1d7cbe['attributes']:_0x521c40['model'];if(!_0xbc89cf[_0x75d6('0x34')]['hasOwnProperty'](_0x75d6('0x3a'))){_0x1d7cbe[_0x75d6('0x1b')]=qs[_0x75d6('0x1b')](_0xbc89cf['query'][_0x75d6('0x1b')]);_0x1d7cbe[_0x75d6('0x1a')]=qs['offset'](_0xbc89cf[_0x75d6('0x34')][_0x75d6('0x1a')]);}_0x1d7cbe[_0x75d6('0x3b')]=qs[_0x75d6('0x3c')](_0xbc89cf[_0x75d6('0x34')][_0x75d6('0x3c')]);_0x1d7cbe[_0x75d6('0x3d')]=qs['filters'](_[_0x75d6('0x3e')](_0xbc89cf['query'],_0x521c40[_0x75d6('0x3f')]),_0x44bf8e);if(_0xbc89cf[_0x75d6('0x34')][_0x75d6('0x40')]){_0x1d7cbe[_0x75d6('0x3d')]=_['merge'](_0x1d7cbe[_0x75d6('0x3d')],{'$or':_[_0x75d6('0x2e')](_0x44bf8e,function(_0x2fc86e){if(_0x2fc86e[_0x75d6('0x31')]!==_0x75d6('0x41')){var _0x1ff937={};_0x1ff937[_0x2fc86e[_0x75d6('0x24')]]={'$like':'%'+_0xbc89cf[_0x75d6('0x34')][_0x75d6('0x40')]+'%'};return _0x1ff937;}})});}_0x1d7cbe=_['merge']({},_0x1d7cbe,_0xbc89cf[_0x75d6('0x42')]);var _0x19aa5c={'where':_0x1d7cbe[_0x75d6('0x3d')]};return db['Dynamics365Field'][_0x75d6('0x19')](_0x19aa5c)[_0x75d6('0x20')](function(_0x30059c){_0x45169c['count']=_0x30059c;if(_0xbc89cf['query']['includeAll']){_0x1d7cbe[_0x75d6('0x43')]=[{'all':!![]}];}return db[_0x75d6('0x2f')][_0x75d6('0x44')](_0x1d7cbe);})['then'](function(_0x1db337){_0x45169c[_0x75d6('0x45')]=_0x1db337;return _0x45169c;})['then'](respondWithFilteredResult(_0x5bd66f,_0x1d7cbe))['catch'](handleError(_0x5bd66f,null));};exports['show']=function(_0x58853d,_0x505774){var _0x2a2855={'raw':!![],'where':{'id':_0x58853d[_0x75d6('0x46')]['id']}},_0x230a4c={};_0x230a4c[_0x75d6('0x33')]=_[_0x75d6('0x35')](db[_0x75d6('0x2f')]['rawAttributes']);_0x230a4c[_0x75d6('0x34')]=_[_0x75d6('0x35')](_0x58853d[_0x75d6('0x34')]);_0x230a4c[_0x75d6('0x3f')]=_[_0x75d6('0x37')](_0x230a4c[_0x75d6('0x33')],_0x230a4c[_0x75d6('0x34')]);_0x2a2855['attributes']=_['intersection'](_0x230a4c['model'],qs['fields'](_0x58853d[_0x75d6('0x34')][_0x75d6('0x38')]));_0x2a2855[_0x75d6('0x36')]=_0x2a2855[_0x75d6('0x36')][_0x75d6('0x39')]?_0x2a2855[_0x75d6('0x36')]:_0x230a4c[_0x75d6('0x33')];if(_0x58853d[_0x75d6('0x34')][_0x75d6('0x47')]){_0x2a2855[_0x75d6('0x43')]=[{'all':!![]}];}_0x2a2855=_[_0x75d6('0x26')]({},_0x2a2855,_0x58853d[_0x75d6('0x42')]);return db[_0x75d6('0x2f')][_0x75d6('0x48')](_0x2a2855)[_0x75d6('0x20')](handleEntityNotFound(_0x505774,null))[_0x75d6('0x20')](respondWithResult(_0x505774,null))[_0x75d6('0x49')](handleError(_0x505774,null));};exports[_0x75d6('0x4a')]=function(_0x4a396a,_0x30cca5){return db[_0x75d6('0x2f')][_0x75d6('0x4a')](_0x4a396a[_0x75d6('0x27')],{})[_0x75d6('0x20')](respondWithResult(_0x30cca5,0xc9))[_0x75d6('0x49')](handleError(_0x30cca5,null));};exports[_0x75d6('0x1f')]=function(_0x52f650,_0x5280ae){if(_0x52f650[_0x75d6('0x27')]['id']){delete _0x52f650['body']['id'];}return db[_0x75d6('0x2f')][_0x75d6('0x48')]({'where':{'id':_0x52f650[_0x75d6('0x46')]['id']}})[_0x75d6('0x20')](handleEntityNotFound(_0x5280ae,null))['then'](saveUpdates(_0x52f650[_0x75d6('0x27')],null))[_0x75d6('0x20')](respondWithResult(_0x5280ae,null))[_0x75d6('0x49')](handleError(_0x5280ae,null));};exports['destroy']=function(_0x1f8485,_0x1429ad){return db[_0x75d6('0x2f')][_0x75d6('0x48')]({'where':{'id':_0x1f8485['params']['id']}})[_0x75d6('0x20')](handleEntityNotFound(_0x1429ad,null))[_0x75d6('0x20')](removeEntity(_0x1429ad,null))[_0x75d6('0x49')](handleError(_0x1429ad,null));}; \ No newline at end of file +var _0x2862=['name','render','body','account','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','params','find','create','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','update','destroy','then','error'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2862,0x1de));var _0x2286=function(_0x2bda4d,_0x139e16){_0x2bda4d=_0x2bda4d-0x0;var _0x8fec4c=_0x2862[_0x2bda4d];return _0x8fec4c;};'use strict';var emlformat=require(_0x2286('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2286('0x1'));var jsonpatch=require(_0x2286('0x2'));var rp=require('request-promise');var moment=require(_0x2286('0x3'));var BPromise=require(_0x2286('0x4'));var Mustache=require(_0x2286('0x5'));var util=require(_0x2286('0x6'));var path=require(_0x2286('0x7'));var sox=require(_0x2286('0x8'));var csv=require(_0x2286('0x9'));var ejs=require(_0x2286('0xa'));var fs=require('fs');var fs_extra=require(_0x2286('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2286('0xc'));var jsforce=require(_0x2286('0xd'));var deskjs=require(_0x2286('0xe'));var toCsv=require(_0x2286('0x9'));var querystring=require('querystring');var Papa=require(_0x2286('0xf'));var Redis=require(_0x2286('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2286('0x11'));var as=require(_0x2286('0x12'));var hardwareService=require(_0x2286('0x13'));var logger=require('../../config/logger')(_0x2286('0x14'));var utils=require(_0x2286('0x15'));var config=require(_0x2286('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2286('0x17'))['db'];function respondWithStatusCode(_0x3a943c,_0x596564){_0x596564=_0x596564||0xcc;return function(_0x493d5c){if(_0x493d5c){return _0x3a943c[_0x2286('0x18')](_0x596564);}return _0x3a943c['status'](_0x596564)[_0x2286('0x19')]();};}function respondWithResult(_0x27a6d7,_0x4257fe){_0x4257fe=_0x4257fe||0xc8;return function(_0x4e6f60){if(_0x4e6f60){return _0x27a6d7['status'](_0x4257fe)[_0x2286('0x1a')](_0x4e6f60);}};}function respondWithFilteredResult(_0xd8301a,_0x428a4b){return function(_0x3f9391){if(_0x3f9391){var _0x2a5715=typeof _0x428a4b['offset']===_0x2286('0x1b')&&typeof _0x428a4b[_0x2286('0x1c')]==='undefined';var _0x2008ec=_0x3f9391[_0x2286('0x1d')];var _0xb1b367=_0x2a5715?0x0:_0x428a4b['offset'];var _0x5992cc=_0x2a5715?_0x3f9391[_0x2286('0x1d')]:_0x428a4b[_0x2286('0x1e')]+_0x428a4b[_0x2286('0x1c')];var _0x480413;if(_0x5992cc>=_0x2008ec){_0x5992cc=_0x2008ec;_0x480413=0xc8;}else{_0x480413=0xce;}_0xd8301a[_0x2286('0x1f')](_0x480413);return _0xd8301a[_0x2286('0x20')]('Content-Range',_0xb1b367+'-'+_0x5992cc+'/'+_0x2008ec)['json'](_0x3f9391);}return null;};}function patchUpdates(_0x806592){return function(_0x469ade){try{jsonpatch[_0x2286('0x21')](_0x469ade,_0x806592,!![]);}catch(_0x5b894e){return BPromise[_0x2286('0x22')](_0x5b894e);}return _0x469ade[_0x2286('0x23')]();};}function saveUpdates(_0x5ddbd1,_0x4aa076){return function(_0x2b7857){if(_0x2b7857){return _0x2b7857[_0x2286('0x24')](_0x5ddbd1)['then'](function(_0x185aad){return _0x185aad;});}return null;};}function removeEntity(_0x3fec10,_0x390c08){return function(_0x2a50c9){if(_0x2a50c9){return _0x2a50c9[_0x2286('0x25')]()[_0x2286('0x26')](function(){_0x3fec10[_0x2286('0x1f')](0xcc)[_0x2286('0x19')]();});}};}function handleEntityNotFound(_0x3f4e1e,_0x4408e0){return function(_0x1f3e2b){if(!_0x1f3e2b){_0x3f4e1e[_0x2286('0x18')](0x194);}return _0x1f3e2b;};}function handleError(_0x5b59b1,_0x3e0e8a){_0x3e0e8a=_0x3e0e8a||0x1f4;return function(_0x5c3177){logger[_0x2286('0x27')](_0x5c3177['stack']);if(_0x5c3177[_0x2286('0x28')]){delete _0x5c3177[_0x2286('0x28')];}_0x5b59b1['status'](_0x3e0e8a)['send'](_0x5c3177);};}function getMustacheRender(_0x1f1752,_0x451a92){return Mustache[_0x2286('0x29')](_0x1f1752,_['merge'](_0x451a92[_0x2286('0x2a')],{'contact':_0x451a92['contact'],'message':_0x451a92['message'],'agent':_0x451a92['agent'],'interaction':_0x451a92['interaction'],'account':_0x451a92[_0x2286('0x2b')]}))||'';}exports[_0x2286('0x2c')]=function(_0x5bee30,_0x10cb27){var _0x48afa6={},_0x1cc740={},_0x92b84a={'count':0x0,'rows':[]};var _0x3d3b4d=_[_0x2286('0x2d')](db[_0x2286('0x2e')][_0x2286('0x2f')],function(_0xc5f2d4){return{'name':_0xc5f2d4[_0x2286('0x30')],'type':_0xc5f2d4[_0x2286('0x31')][_0x2286('0x32')]};});_0x1cc740[_0x2286('0x33')]=_[_0x2286('0x2d')](_0x3d3b4d,_0x2286('0x28'));_0x1cc740[_0x2286('0x34')]=_[_0x2286('0x35')](_0x5bee30[_0x2286('0x34')]);_0x1cc740[_0x2286('0x36')]=_['intersection'](_0x1cc740[_0x2286('0x33')],_0x1cc740[_0x2286('0x34')]);_0x48afa6['attributes']=_[_0x2286('0x37')](_0x1cc740[_0x2286('0x33')],qs[_0x2286('0x38')](_0x5bee30[_0x2286('0x34')][_0x2286('0x38')]));_0x48afa6[_0x2286('0x39')]=_0x48afa6[_0x2286('0x39')][_0x2286('0x3a')]?_0x48afa6[_0x2286('0x39')]:_0x1cc740[_0x2286('0x33')];if(!_0x5bee30[_0x2286('0x34')][_0x2286('0x3b')](_0x2286('0x3c'))){_0x48afa6['limit']=qs['limit'](_0x5bee30['query']['limit']);_0x48afa6['offset']=qs[_0x2286('0x1e')](_0x5bee30[_0x2286('0x34')][_0x2286('0x1e')]);}_0x48afa6[_0x2286('0x3d')]=qs['sort'](_0x5bee30['query']['sort']);_0x48afa6[_0x2286('0x3e')]=qs[_0x2286('0x36')](_[_0x2286('0x3f')](_0x5bee30[_0x2286('0x34')],_0x1cc740[_0x2286('0x36')]),_0x3d3b4d);if(_0x5bee30[_0x2286('0x34')][_0x2286('0x40')]){_0x48afa6['where']=_[_0x2286('0x41')](_0x48afa6['where'],{'$or':_[_0x2286('0x2d')](_0x3d3b4d,function(_0x1a7826){if(_0x1a7826[_0x2286('0x31')]!=='VIRTUAL'){var _0x54e606={};_0x54e606[_0x1a7826[_0x2286('0x28')]]={'$like':'%'+_0x5bee30[_0x2286('0x34')]['filter']+'%'};return _0x54e606;}})});}_0x48afa6=_[_0x2286('0x41')]({},_0x48afa6,_0x5bee30[_0x2286('0x42')]);var _0x300dad={'where':_0x48afa6[_0x2286('0x3e')]};return db[_0x2286('0x2e')][_0x2286('0x1d')](_0x300dad)[_0x2286('0x26')](function(_0x1b3afc){_0x92b84a[_0x2286('0x1d')]=_0x1b3afc;if(_0x5bee30[_0x2286('0x34')][_0x2286('0x43')]){_0x48afa6[_0x2286('0x44')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x2286('0x45')](_0x48afa6);})[_0x2286('0x26')](function(_0x532895){_0x92b84a['rows']=_0x532895;return _0x92b84a;})[_0x2286('0x26')](respondWithFilteredResult(_0x10cb27,_0x48afa6))['catch'](handleError(_0x10cb27,null));};exports['show']=function(_0x2c7ac3,_0x14486a){var _0x2cc02c={'raw':!![],'where':{'id':_0x2c7ac3[_0x2286('0x46')]['id']}},_0x46c443={};_0x46c443[_0x2286('0x33')]=_['keys'](db[_0x2286('0x2e')]['rawAttributes']);_0x46c443[_0x2286('0x34')]=_[_0x2286('0x35')](_0x2c7ac3[_0x2286('0x34')]);_0x46c443['filters']=_[_0x2286('0x37')](_0x46c443[_0x2286('0x33')],_0x46c443['query']);_0x2cc02c[_0x2286('0x39')]=_['intersection'](_0x46c443['model'],qs['fields'](_0x2c7ac3[_0x2286('0x34')]['fields']));_0x2cc02c[_0x2286('0x39')]=_0x2cc02c[_0x2286('0x39')][_0x2286('0x3a')]?_0x2cc02c['attributes']:_0x46c443[_0x2286('0x33')];if(_0x2c7ac3[_0x2286('0x34')]['includeAll']){_0x2cc02c[_0x2286('0x44')]=[{'all':!![]}];}_0x2cc02c=_[_0x2286('0x41')]({},_0x2cc02c,_0x2c7ac3[_0x2286('0x42')]);return db[_0x2286('0x2e')][_0x2286('0x47')](_0x2cc02c)[_0x2286('0x26')](handleEntityNotFound(_0x14486a,null))[_0x2286('0x26')](respondWithResult(_0x14486a,null))['catch'](handleError(_0x14486a,null));};exports[_0x2286('0x48')]=function(_0x24a80c,_0x20ba86){return db[_0x2286('0x2e')][_0x2286('0x48')](_0x24a80c[_0x2286('0x2a')],{})['then'](respondWithResult(_0x20ba86,0xc9))[_0x2286('0x49')](handleError(_0x20ba86,null));};exports[_0x2286('0x24')]=function(_0x2c1bc9,_0xfc2fde){if(_0x2c1bc9['body']['id']){delete _0x2c1bc9[_0x2286('0x2a')]['id'];}return db['Dynamics365Field'][_0x2286('0x47')]({'where':{'id':_0x2c1bc9[_0x2286('0x46')]['id']}})[_0x2286('0x26')](handleEntityNotFound(_0xfc2fde,null))['then'](saveUpdates(_0x2c1bc9['body'],null))[_0x2286('0x26')](respondWithResult(_0xfc2fde,null))[_0x2286('0x49')](handleError(_0xfc2fde,null));};exports[_0x2286('0x25')]=function(_0x11a83,_0x529997){return db['Dynamics365Field'][_0x2286('0x47')]({'where':{'id':_0x11a83[_0x2286('0x46')]['id']}})[_0x2286('0x26')](handleEntityNotFound(_0x529997,null))[_0x2286('0x26')](removeEntity(_0x529997,null))[_0x2286('0x49')](handleError(_0x529997,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 42927d9..45b34f2 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 _0x458f=['int_dynamics365_fields','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field'];(function(_0x2a4667,_0x550f42){var _0x2001b3=function(_0xd7e371){while(--_0xd7e371){_0x2a4667['push'](_0x2a4667['shift']());}};_0x2001b3(++_0x550f42);}(_0x458f,0xd2));var _0xf458=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x458f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf458('0x0'));var util=require(_0xf458('0x1'));var logger=require(_0xf458('0x2'))('api');var moment=require(_0xf458('0x3'));var BPromise=require(_0xf458('0x4'));var rp=require(_0xf458('0x5'));var fs=require('fs');var path=require(_0xf458('0x6'));var rimraf=require(_0xf458('0x7'));var config=require('../../config/environment');var attributes=require(_0xf458('0x8'));module[_0xf458('0x9')]=function(_0x3d59ab,_0x4ede47){return _0x3d59ab['define'](_0xf458('0xa'),attributes,{'tableName':_0xf458('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xf458('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4db1=['path','rimraf','../../config/environment','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise'];(function(_0x5549a6,_0x5e934c){var _0x36e769=function(_0x277388){while(--_0x277388){_0x5549a6['push'](_0x5549a6['shift']());}};_0x36e769(++_0x5e934c);}(_0x4db1,0xb1));var _0x14db=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x4db1[_0x3f6bcf];return _0x1c5350;};'use strict';var _=require(_0x14db('0x0'));var util=require(_0x14db('0x1'));var logger=require(_0x14db('0x2'))(_0x14db('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14db('0x4'));var fs=require('fs');var path=require(_0x14db('0x5'));var rimraf=require(_0x14db('0x6'));var config=require(_0x14db('0x7'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x1bd6a3,_0x349f2a){return _0x1bd6a3['define'](_0x14db('0x8'),attributes,{'tableName':_0x14db('0x9'),'paranoid':![],'indexes':[{'name':_0x14db('0xa'),'fields':[_0x14db('0xb'),_0x14db('0xc')],'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 4da6659..c194ffa 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 _0x6829=['http','then','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x37060c,_0xa4ef0a){var _0x5a52b8=function(_0xd186d8){while(--_0xd186d8){_0x37060c['push'](_0x37060c['shift']());}};_0x5a52b8(++_0xa4ef0a);}(_0x6829,0x14c));var _0x9682=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x6829[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9682('0x2'));var db=require(_0x9682('0x3'))['db'];var utils=require(_0x9682('0x4'));var logger=require(_0x9682('0x5'))(_0x9682('0x6'));var config=require(_0x9682('0x7'));var jayson=require(_0x9682('0x8'));var client=jayson[_0x9682('0x9')][_0x9682('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cec91,_0x37ab0a,_0x1cca2f){return new BPromise(function(_0x576a39,_0x519138){return client['request'](_0x4cec91,_0x1cca2f)[_0x9682('0xb')](function(_0x1b27c2){logger['info'](_0x9682('0xc'),_0x37ab0a,'request\x20sent');logger[_0x9682('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x37ab0a,_0x9682('0xe'),JSON[_0x9682('0xf')](_0x1b27c2));if(_0x1b27c2[_0x9682('0x10')]){if(_0x1b27c2['error']['code']===0x1f4){logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x1b27c2['error'][_0x9682('0x11')]);return _0x519138(_0x1b27c2['error'][_0x9682('0x11')]);}logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x1b27c2[_0x9682('0x10')][_0x9682('0x11')]);return _0x576a39(_0x1b27c2[_0x9682('0x10')][_0x9682('0x11')]);}else{logger[_0x9682('0x12')](_0x9682('0xc'),_0x37ab0a,_0x9682('0xe'));_0x576a39(_0x1b27c2['result'][_0x9682('0x11')]);}})['catch'](function(_0x23eef6){logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x23eef6);_0x519138(_0x23eef6);});});} \ No newline at end of file +var _0x5ff9=['debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x52d517,_0x25c086){var _0x105f33=function(_0x46341d){while(--_0x46341d){_0x52d517['push'](_0x52d517['shift']());}};_0x105f33(++_0x25c086);}(_0x5ff9,0xa0));var _0x95ff=function(_0x5be21,_0x54e342){_0x5be21=_0x5be21-0x0;var _0x550193=_0x5ff9[_0x5be21];return _0x550193;};'use strict';var _=require(_0x95ff('0x0'));var util=require(_0x95ff('0x1'));var moment=require('moment');var BPromise=require(_0x95ff('0x2'));var rs=require(_0x95ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95ff('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x95ff('0x5'));var jayson=require(_0x95ff('0x6'));var client=jayson['client'][_0x95ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fd45b,_0x34ace2,_0x384657){return new BPromise(function(_0x491610,_0x2fb3f5){return client['request'](_0x4fd45b,_0x384657)[_0x95ff('0x8')](function(_0x300166){logger['info'](_0x95ff('0x9'),_0x34ace2,_0x95ff('0xa'));logger[_0x95ff('0xb')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x34ace2,_0x95ff('0xa'),JSON[_0x95ff('0xc')](_0x300166));if(_0x300166[_0x95ff('0xd')]){if(_0x300166[_0x95ff('0xd')][_0x95ff('0xe')]===0x1f4){logger[_0x95ff('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x34ace2,_0x300166['error'][_0x95ff('0xf')]);return _0x2fb3f5(_0x300166[_0x95ff('0xd')][_0x95ff('0xf')]);}logger[_0x95ff('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x34ace2,_0x300166[_0x95ff('0xd')][_0x95ff('0xf')]);return _0x491610(_0x300166['error'][_0x95ff('0xf')]);}else{logger[_0x95ff('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x34ace2,'request\x20sent');_0x491610(_0x300166[_0x95ff('0x11')][_0x95ff('0xf')]);}})[_0x95ff('0x12')](function(_0x5d5350){logger[_0x95ff('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x34ace2,_0x5d5350);_0x2fb3f5(_0x5d5350);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2a9af54..484a31c 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 _0x9420=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9420,0x125));var _0x0942=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9420[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x0942('0x0'));var util=require(_0x0942('0x1'));var path=require(_0x0942('0x2'));var timeout=require(_0x0942('0x3'));var express=require(_0x0942('0x4'));var router=express[_0x0942('0x5')]();var fs_extra=require(_0x0942('0x6'));var auth=require(_0x0942('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0942('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0x0942('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x0942('0xa')](),controller[_0x0942('0xb')]);router[_0x0942('0x9')]('/:id/configurations',auth[_0x0942('0xa')](),controller[_0x0942('0xc')]);router[_0x0942('0x9')](_0x0942('0xd'),auth[_0x0942('0xa')](),controller[_0x0942('0xe')]);router[_0x0942('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0942('0xf')](_0x0942('0x10'),auth[_0x0942('0xa')](),controller[_0x0942('0x11')]);router[_0x0942('0x12')](_0x0942('0x13'),auth[_0x0942('0xa')](),controller[_0x0942('0x14')]);router[_0x0942('0x15')](_0x0942('0x13'),auth[_0x0942('0xa')](),controller[_0x0942('0x16')]);module[_0x0942('0x17')]=router; \ No newline at end of file +var _0xa08e=['post','create','addConfiguration','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','get','/:id/fields','getFields'];(function(_0x4cd440,_0x5acd39){var _0x2916fc=function(_0x5d9003){while(--_0x5d9003){_0x4cd440['push'](_0x4cd440['shift']());}};_0x2916fc(++_0x5acd39);}(_0xa08e,0x1a2));var _0xea08=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xa08e[_0x511bd1];return _0x4c48ec;};'use strict';var multer=require('multer');var util=require(_0xea08('0x0'));var path=require(_0xea08('0x1'));var timeout=require(_0xea08('0x2'));var express=require(_0xea08('0x3'));var router=express[_0xea08('0x4')]();var fs_extra=require(_0xea08('0x5'));var auth=require(_0xea08('0x6'));var interaction=require(_0xea08('0x7'));var config=require(_0xea08('0x8'));var controller=require(_0xea08('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xea08('0xa')]);router['get'](_0xea08('0xb'),auth[_0xea08('0xc')](),controller[_0xea08('0xd')]);router['get'](_0xea08('0xe'),auth[_0xea08('0xc')](),controller[_0xea08('0xf')]);router[_0xea08('0x10')](_0xea08('0x11'),auth[_0xea08('0xc')](),controller[_0xea08('0x12')]);router[_0xea08('0x13')]('/',auth[_0xea08('0xc')](),controller[_0xea08('0x14')]);router[_0xea08('0x13')]('/:id/configurations',auth[_0xea08('0xc')](),controller[_0xea08('0x15')]);router['put'](_0xea08('0xb'),auth[_0xea08('0xc')](),controller['update']);router['delete']('/:id',auth[_0xea08('0xc')](),controller['destroy']);module[_0xea08('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 5a16dcc..16bd5aa 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 _0x1fd4=['exports','STRING','username','remoteUri','sequelize'];(function(_0x452ac2,_0x45f034){var _0x5a589a=function(_0x3c3fe8){while(--_0x3c3fe8){_0x452ac2['push'](_0x452ac2['shift']());}};_0x5a589a(++_0x45f034);}(_0x1fd4,0x153));var _0x41fd=function(_0x4df787,_0x337596){_0x4df787=_0x4df787-0x0;var _0x20fe58=_0x1fd4[_0x4df787];return _0x20fe58;};'use strict';var Sequelize=require(_0x41fd('0x0'));module[_0x41fd('0x1')]={'name':{'type':Sequelize[_0x41fd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x41fd('0x2')],'unique':_0x41fd('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x41fd('0x2')],'unique':_0x41fd('0x4')},'serverUrl':{'type':Sequelize[_0x41fd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5664=['exports','STRING','username','remoteUri'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5664,0x108));var _0x4566=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x5664[_0xf48cce];return _0x2a5c38;};'use strict';var Sequelize=require('sequelize');module[_0x4566('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4566('0x1')]},'username':{'type':Sequelize[_0x4566('0x1')],'unique':_0x4566('0x2')},'apiKey':{'type':Sequelize[_0x4566('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4566('0x3')},'serverUrl':{'type':Sequelize[_0x4566('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f3841e3..7932cc6 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 _0x757a=['result','catch','sendStatus','end','status','undefined','count','limit','set','json','apply','reject','save','update','destroy','stack','name','render','merge','body','contact','agent','interaction','account','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','VIRTUAL','filter','include','findAll','rows','params','intersection','options','find','create','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','description','priority','source','ticket_type','group','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x757a,0xde));var _0xa757=function(_0x66b6d4,_0x27be17){_0x66b6d4=_0x66b6d4-0x0;var _0x46ac2f=_0x757a[_0x66b6d4];return _0x46ac2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xa757('0x15'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed0d2,_0x513b1f,_0x481508,_0x32112b){return new BPromise(function(_0x1b670e,_0x355f0a){var _0x4a0c38=_0x32112b||client;return _0x4a0c38[_0xa757('0x16')](_0x2ed0d2,_0x481508)[_0xa757('0x17')](function(_0xf12b68){logger[_0xa757('0x18')](_0xa757('0x19'),_0x513b1f,_0xa757('0x1a'));logger['debug'](_0xa757('0x1b'),_0x513b1f,_0xa757('0x1a'),JSON[_0xa757('0x1c')](_0xf12b68));if(_0xf12b68['error']){if(_0xf12b68['error'][_0xa757('0x1d')]===0x1f4){logger[_0xa757('0x1e')](_0xa757('0x19'),_0x513b1f,_0xf12b68[_0xa757('0x1e')][_0xa757('0x1f')]);return _0x355f0a(_0xf12b68[_0xa757('0x1e')]['message']);}logger[_0xa757('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x513b1f,_0xf12b68[_0xa757('0x1e')][_0xa757('0x1f')]);return _0x1b670e(_0xf12b68[_0xa757('0x1e')][_0xa757('0x1f')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x513b1f,_0xa757('0x1a'));_0x1b670e(_0xf12b68[_0xa757('0x20')][_0xa757('0x1f')]);}})[_0xa757('0x21')](function(_0x1d6e2){logger[_0xa757('0x1e')](_0xa757('0x19'),_0x513b1f,_0x1d6e2);_0x355f0a(_0x1d6e2);});});}function respondWithStatusCode(_0x21f1af,_0x2bf276){_0x2bf276=_0x2bf276||0xcc;return function(_0x59fae6){if(_0x59fae6){return _0x21f1af[_0xa757('0x22')](_0x2bf276);}return _0x21f1af['status'](_0x2bf276)[_0xa757('0x23')]();};}function respondWithResult(_0x47903b,_0x40551d){_0x40551d=_0x40551d||0xc8;return function(_0x3859ce){if(_0x3859ce){return _0x47903b[_0xa757('0x24')](_0x40551d)['json'](_0x3859ce);}};}function respondWithFilteredResult(_0x2b19d5,_0xcd98bd){return function(_0x471e84){if(_0x471e84){var _0x3bf7f3=typeof _0xcd98bd['offset']===_0xa757('0x25')&&typeof _0xcd98bd['limit']==='undefined';var _0x54b75e=_0x471e84['count'];var _0xfdf69d=_0x3bf7f3?0x0:_0xcd98bd['offset'];var _0x2208f9=_0x3bf7f3?_0x471e84[_0xa757('0x26')]:_0xcd98bd['offset']+_0xcd98bd[_0xa757('0x27')];var _0x5119ad;if(_0x2208f9>=_0x54b75e){_0x2208f9=_0x54b75e;_0x5119ad=0xc8;}else{_0x5119ad=0xce;}_0x2b19d5[_0xa757('0x24')](_0x5119ad);return _0x2b19d5[_0xa757('0x28')]('Content-Range',_0xfdf69d+'-'+_0x2208f9+'/'+_0x54b75e)[_0xa757('0x29')](_0x471e84);}return null;};}function patchUpdates(_0x5ade7b){return function(_0x3a4a66){try{jsonpatch[_0xa757('0x2a')](_0x3a4a66,_0x5ade7b,!![]);}catch(_0x458974){return BPromise[_0xa757('0x2b')](_0x458974);}return _0x3a4a66[_0xa757('0x2c')]();};}function saveUpdates(_0x2c1885,_0x1a44a9){return function(_0x2220df){if(_0x2220df){return _0x2220df[_0xa757('0x2d')](_0x2c1885)[_0xa757('0x17')](function(_0x1f5d5a){return _0x1f5d5a;});}return null;};}function removeEntity(_0x20735f,_0x25dfbb){return function(_0x2dfb33){if(_0x2dfb33){return _0x2dfb33[_0xa757('0x2e')]()[_0xa757('0x17')](function(){_0x20735f[_0xa757('0x24')](0xcc)[_0xa757('0x23')]();});}};}function handleEntityNotFound(_0x1eacde,_0x29a5ba){return function(_0x3de18f){if(!_0x3de18f){_0x1eacde[_0xa757('0x22')](0x194);}return _0x3de18f;};}function handleError(_0x379de7,_0x3aae1e){_0x3aae1e=_0x3aae1e||0x1f4;return function(_0x59700d){logger[_0xa757('0x1e')](_0x59700d[_0xa757('0x2f')]);if(_0x59700d[_0xa757('0x30')]){delete _0x59700d[_0xa757('0x30')];}_0x379de7[_0xa757('0x24')](_0x3aae1e)['send'](_0x59700d);};}function getMustacheRender(_0x1d4414,_0x2af470){return Mustache[_0xa757('0x31')](_0x1d4414,_[_0xa757('0x32')](_0x2af470[_0xa757('0x33')],{'contact':_0x2af470[_0xa757('0x34')],'message':_0x2af470['message'],'agent':_0x2af470[_0xa757('0x35')],'interaction':_0x2af470[_0xa757('0x36')],'account':_0x2af470[_0xa757('0x37')]}))||'';}exports[_0xa757('0x38')]=function(_0x3b5104,_0x111cfe){var _0x24e280={},_0x3e12a5={},_0x13b699={'count':0x0,'rows':[]};var _0x4f9d98=_[_0xa757('0x39')](db[_0xa757('0x3a')][_0xa757('0x3b')],function(_0x35c15a){return{'name':_0x35c15a[_0xa757('0x3c')],'type':_0x35c15a[_0xa757('0x3d')]['key']};});_0x3e12a5[_0xa757('0x3e')]=_[_0xa757('0x39')](_0x4f9d98,'name');_0x3e12a5['query']=_[_0xa757('0x3f')](_0x3b5104[_0xa757('0x40')]);_0x3e12a5['filters']=_['intersection'](_0x3e12a5[_0xa757('0x3e')],_0x3e12a5[_0xa757('0x40')]);_0x24e280[_0xa757('0x41')]=_['intersection'](_0x3e12a5[_0xa757('0x3e')],qs[_0xa757('0x42')](_0x3b5104[_0xa757('0x40')][_0xa757('0x42')]));_0x24e280[_0xa757('0x41')]=_0x24e280['attributes'][_0xa757('0x43')]?_0x24e280['attributes']:_0x3e12a5['model'];if(!_0x3b5104[_0xa757('0x40')][_0xa757('0x44')](_0xa757('0x45'))){_0x24e280[_0xa757('0x27')]=qs[_0xa757('0x27')](_0x3b5104['query']['limit']);_0x24e280[_0xa757('0x46')]=qs[_0xa757('0x46')](_0x3b5104[_0xa757('0x40')][_0xa757('0x46')]);}_0x24e280[_0xa757('0x47')]=qs[_0xa757('0x48')](_0x3b5104['query'][_0xa757('0x48')]);_0x24e280[_0xa757('0x49')]=qs['filters'](_[_0xa757('0x4a')](_0x3b5104['query'],_0x3e12a5[_0xa757('0x4b')]),_0x4f9d98);if(_0x3b5104[_0xa757('0x40')]['filter']){_0x24e280[_0xa757('0x49')]=_[_0xa757('0x32')](_0x24e280['where'],{'$or':_[_0xa757('0x39')](_0x4f9d98,function(_0x257bcd){if(_0x257bcd[_0xa757('0x3d')]!==_0xa757('0x4c')){var _0x543b5b={};_0x543b5b[_0x257bcd[_0xa757('0x30')]]={'$like':'%'+_0x3b5104[_0xa757('0x40')][_0xa757('0x4d')]+'%'};return _0x543b5b;}})});}_0x24e280=_[_0xa757('0x32')]({},_0x24e280,_0x3b5104['options']);var _0xd4c1b={'where':_0x24e280['where']};return db['FreshdeskAccount'][_0xa757('0x26')](_0xd4c1b)[_0xa757('0x17')](function(_0x1ae3ae){_0x13b699['count']=_0x1ae3ae;if(_0x3b5104[_0xa757('0x40')]['includeAll']){_0x24e280[_0xa757('0x4e')]=[{'all':!![]}];}return db[_0xa757('0x3a')][_0xa757('0x4f')](_0x24e280);})[_0xa757('0x17')](function(_0x18b0ca){_0x13b699[_0xa757('0x50')]=_0x18b0ca;return _0x13b699;})[_0xa757('0x17')](respondWithFilteredResult(_0x111cfe,_0x24e280))[_0xa757('0x21')](handleError(_0x111cfe,null));};exports['show']=function(_0x2de226,_0x7411a3){var _0x33347a={'raw':![],'where':{'id':_0x2de226[_0xa757('0x51')]['id']}},_0x29434d={};_0x29434d[_0xa757('0x3e')]=_[_0xa757('0x3f')](db[_0xa757('0x3a')][_0xa757('0x3b')]);_0x29434d[_0xa757('0x40')]=_[_0xa757('0x3f')](_0x2de226[_0xa757('0x40')]);_0x29434d[_0xa757('0x4b')]=_[_0xa757('0x52')](_0x29434d[_0xa757('0x3e')],_0x29434d[_0xa757('0x40')]);_0x33347a['attributes']=_[_0xa757('0x52')](_0x29434d['model'],qs[_0xa757('0x42')](_0x2de226[_0xa757('0x40')][_0xa757('0x42')]));_0x33347a[_0xa757('0x41')]=_0x33347a['attributes'][_0xa757('0x43')]?_0x33347a[_0xa757('0x41')]:_0x29434d[_0xa757('0x3e')];if(_0x2de226[_0xa757('0x40')]['includeAll']){_0x33347a[_0xa757('0x4e')]=[{'all':!![]}];}_0x33347a=_[_0xa757('0x32')]({},_0x33347a,_0x2de226[_0xa757('0x53')]);return db[_0xa757('0x3a')][_0xa757('0x54')](_0x33347a)[_0xa757('0x17')](handleEntityNotFound(_0x7411a3,null))['then'](respondWithResult(_0x7411a3,null))['catch'](handleError(_0x7411a3,null));};exports['create']=function(_0x5a49d0,_0x1d8742){return db[_0xa757('0x3a')][_0xa757('0x55')](_0x5a49d0[_0xa757('0x33')],{})[_0xa757('0x17')](respondWithResult(_0x1d8742,0xc9))[_0xa757('0x21')](handleError(_0x1d8742,null));};exports['update']=function(_0xe31752,_0x163d99){if(_0xe31752[_0xa757('0x33')]['id']){delete _0xe31752[_0xa757('0x33')]['id'];}return db['FreshdeskAccount'][_0xa757('0x54')]({'where':{'id':_0xe31752[_0xa757('0x51')]['id']}})['then'](handleEntityNotFound(_0x163d99,null))[_0xa757('0x17')](saveUpdates(_0xe31752['body'],null))[_0xa757('0x17')](respondWithResult(_0x163d99,null))['catch'](handleError(_0x163d99,null));};exports[_0xa757('0x2e')]=function(_0x58633a,_0x4badee){return db[_0xa757('0x3a')][_0xa757('0x54')]({'where':{'id':_0x58633a[_0xa757('0x51')]['id']}})[_0xa757('0x17')](handleEntityNotFound(_0x4badee,null))[_0xa757('0x17')](removeEntity(_0x4badee,null))[_0xa757('0x21')](handleError(_0x4badee,null));};exports['getConfigurations']=function(_0x4f0d7b,_0x201557,_0x3afa56){var _0x3ca1ef={};var _0x4a5ad5={};var _0x55a7d2;var _0x18dff7;return db[_0xa757('0x3a')][_0xa757('0x56')]({'where':{'id':_0x4f0d7b[_0xa757('0x51')]['id']}})[_0xa757('0x17')](handleEntityNotFound(_0x201557,null))[_0xa757('0x17')](function(_0x5b9844){if(_0x5b9844){_0x55a7d2=_0x5b9844;_0x4a5ad5[_0xa757('0x3e')]=_[_0xa757('0x3f')](db[_0xa757('0x57')][_0xa757('0x3b')]);_0x4a5ad5[_0xa757('0x40')]=_[_0xa757('0x3f')](_0x4f0d7b[_0xa757('0x40')]);_0x4a5ad5[_0xa757('0x4b')]=_[_0xa757('0x52')](_0x4a5ad5[_0xa757('0x3e')],_0x4a5ad5['query']);_0x3ca1ef[_0xa757('0x41')]=_['intersection'](_0x4a5ad5['model'],qs[_0xa757('0x42')](_0x4f0d7b[_0xa757('0x40')][_0xa757('0x42')]));_0x3ca1ef[_0xa757('0x41')]=_0x3ca1ef[_0xa757('0x41')][_0xa757('0x43')]?_0x3ca1ef[_0xa757('0x41')]:_0x4a5ad5[_0xa757('0x3e')];_0x3ca1ef[_0xa757('0x47')]=qs[_0xa757('0x48')](_0x4f0d7b[_0xa757('0x40')]['sort']);_0x3ca1ef[_0xa757('0x49')]=qs[_0xa757('0x4b')](_['pick'](_0x4f0d7b[_0xa757('0x40')],_0x4a5ad5[_0xa757('0x4b')]));if(_0x4f0d7b[_0xa757('0x40')][_0xa757('0x4d')]){_0x3ca1ef[_0xa757('0x49')]=_[_0xa757('0x32')](_0x3ca1ef['where'],{'$or':_[_0xa757('0x39')](_0x3ca1ef['attributes'],function(_0xee5b78){var _0x3250d0={};_0x3250d0[_0xee5b78]={'$like':'%'+_0x4f0d7b[_0xa757('0x40')][_0xa757('0x4d')]+'%'};return _0x3250d0;})});}_0x3ca1ef=_[_0xa757('0x32')]({},_0x3ca1ef,_0x4f0d7b['options']);return _0x55a7d2['getConfigurations'](_0x3ca1ef);}})[_0xa757('0x17')](function(_0x10a7cb){if(_0x10a7cb){_0x18dff7=_0x10a7cb[_0xa757('0x43')];if(!_0x4f0d7b['query'][_0xa757('0x44')]('nolimit')){_0x3ca1ef[_0xa757('0x27')]=qs[_0xa757('0x27')](_0x4f0d7b[_0xa757('0x40')][_0xa757('0x27')]);_0x3ca1ef[_0xa757('0x46')]=qs[_0xa757('0x46')](_0x4f0d7b['query'][_0xa757('0x46')]);}return _0x55a7d2[_0xa757('0x58')](_0x3ca1ef);}})[_0xa757('0x17')](function(_0x125bda){if(_0x125bda){return _0x125bda?{'count':_0x18dff7,'rows':_0x125bda}:null;}})[_0xa757('0x17')](respondWithResult(_0x201557,null))['catch'](handleError(_0x201557,null));};exports[_0xa757('0x59')]=function(_0x423f3a,_0x122ab2,_0x38724c){if(_0x423f3a[_0xa757('0x33')]['id']){delete _0x423f3a['body']['id'];}return db[_0xa757('0x3a')][_0xa757('0x56')]({'where':{'id':_0x423f3a[_0xa757('0x51')]['id']}})['then'](handleEntityNotFound(_0x122ab2,null))[_0xa757('0x17')](function(_0x233835){if(_0x233835){_0x423f3a[_0xa757('0x33')][_0xa757('0x5a')]=_0x233835['id'];_0x423f3a[_0xa757('0x33')][_0xa757('0x5b')]=integrations[_0xa757('0x5c')](_0x423f3a[_0xa757('0x33')][_0xa757('0x5d')],_0x423f3a[_0xa757('0x33')][_0xa757('0x3d')]);_0x423f3a[_0xa757('0x33')][_0xa757('0x5e')]=integrations[_0xa757('0x5f')](_0x423f3a['body'][_0xa757('0x5d')],_0x423f3a[_0xa757('0x33')]['type']);return db[_0xa757('0x57')][_0xa757('0x55')](_0x423f3a['body'],{'include':[{'model':db[_0xa757('0x60')],'as':_0xa757('0x5b')},{'model':db[_0xa757('0x60')],'as':_0xa757('0x5e')}]});}return null;})[_0xa757('0x17')](respondWithResult(_0x122ab2,null))[_0xa757('0x21')](handleError(_0x122ab2,null));};exports[_0xa757('0x61')]=function(_0x2b4b1e,_0x1f74af,_0x1bf42f){var _0x2649a2='';return db[_0xa757('0x3a')][_0xa757('0x56')]({'where':{'id':_0x2b4b1e[_0xa757('0x51')]['id']},'attributes':['id',_0xa757('0x62'),_0xa757('0x63')]})['then'](handleEntityNotFound(_0x1f74af,null))[_0xa757('0x17')](function(_0x56ba75){if(_0x56ba75){_0x2649a2=_0x56ba75[_0xa757('0x62')];var _0x20c444=_0x2649a2[_0xa757('0x64')](-0x1);if(_0x20c444==='/'){_0x2649a2=_0x2649a2[_0xa757('0x65')](0x0,_0x2649a2[_0xa757('0x66')](_0x20c444));}return rp({'method':'GET','uri':util[_0xa757('0x67')](_0xa757('0x68'),_0x2649a2,_0xa757('0x69')),'headers':{'Authorization':util['format'](_0xa757('0x6a'),new Buffer(util[_0xa757('0x67')](_0xa757('0x6b'),_0x56ba75['apiKey']))['toString'](_0xa757('0x6c')))},'json':!![]});}})[_0xa757('0x17')](function(_0x388e6d){if(_0x388e6d){var _0x542c55=[_0xa757('0x6d'),'subject','agent',_0xa757('0x6e'),_0xa757('0x24'),_0xa757('0x6f'),'group',_0xa757('0x70'),_0xa757('0x71'),_0xa757('0x72'),_0xa757('0x73')];_[_0xa757('0x74')](_0x388e6d,function(_0x2d0ce0){return _0x542c55[_0xa757('0x75')](_0x2d0ce0[_0xa757('0x30')])||!_0x2d0ce0[_0xa757('0x76')]&&_0x2d0ce0[_0xa757('0x3d')]!==_0xa757('0x77')&&_0x2d0ce0[_0xa757('0x3d')]!=='custom_dropdown';});return{'count':_0x388e6d[_0xa757('0x43')],'rows':_[_0xa757('0x39')](_0x388e6d,function(_0x20eabc){return{'id':_0x20eabc[_0xa757('0x30')],'name':_0x20eabc[_0xa757('0x78')],'custom':!_0x20eabc[_0xa757('0x76')],'options':_0x20eabc[_0xa757('0x79')]?_[_0xa757('0x39')](_0x20eabc[_0xa757('0x79')],function(_0x2d34b7){return{'name':_[_0xa757('0x7a')](_0x2d34b7),'value':_0x2d34b7};}):[]};})};}})[_0xa757('0x17')](respondWithResult(_0x1f74af,null))[_0xa757('0x21')](function(_0x3a258f){var _0x1b6adb=_0x2b4b1e[_0xa757('0x40')][_0xa757('0x7b')]?0x1f4:_0x3a258f[_0xa757('0x7c')]||0x1f4;logger[_0xa757('0x1e')](_0xa757('0x7d'),_0xa757('0x61'),_0x1b6adb,JSON[_0xa757('0x1c')](_0x3a258f));delete _0x3a258f['name'];if(_0x1b6adb===0x191){_0x1b6adb=0x190;}_0x1f74af[_0xa757('0x24')](_0x1b6adb)[_0xa757('0x7e')](_0x2b4b1e['query'][_0xa757('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x3a258f[_0xa757('0x7c')]}:_0x3a258f);});}; \ No newline at end of file +var _0x9c5e=['addConfiguration','AccountId','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','Subjects','getFields','remoteUri','substring','format','Basic\x20%s','%s:X','toString','base64','subject','description','priority','ticket_type','group','company','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','FreshdeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','includeAll','include','rows','show','params','find','create','getConfigurations','findOne','order','nolimit'];(function(_0x45bf96,_0xb93e52){var _0x4bb41e=function(_0x4b59bf){while(--_0x4b59bf){_0x45bf96['push'](_0x45bf96['shift']());}};_0x4bb41e(++_0xb93e52);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x2c9062,_0x525a88){_0x2c9062=_0x2c9062-0x0;var _0x48fa9f=_0x9c5e[_0x2c9062];return _0x48fa9f;};'use strict';var emlformat=require(_0xe9c5('0x0'));var rimraf=require(_0xe9c5('0x1'));var zipdir=require(_0xe9c5('0x2'));var jsonpatch=require(_0xe9c5('0x3'));var rp=require(_0xe9c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9c5('0x5'));var path=require(_0xe9c5('0x6'));var sox=require('sox');var csv=require(_0xe9c5('0x7'));var ejs=require(_0xe9c5('0x8'));var fs=require('fs');var fs_extra=require(_0xe9c5('0x9'));var _=require(_0xe9c5('0xa'));var squel=require('squel');var crypto=require(_0xe9c5('0xb'));var jsforce=require(_0xe9c5('0xc'));var deskjs=require(_0xe9c5('0xd'));var toCsv=require(_0xe9c5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9c5('0xe'));var authService=require(_0xe9c5('0xf'));var qs=require(_0xe9c5('0x10'));var as=require(_0xe9c5('0x11'));var hardwareService=require(_0xe9c5('0x12'));var logger=require(_0xe9c5('0x13'))(_0xe9c5('0x14'));var utils=require(_0xe9c5('0x15'));var config=require(_0xe9c5('0x16'));var licenseUtil=require(_0xe9c5('0x17'));var db=require(_0xe9c5('0x18'))['db'];var integrations=require(_0xe9c5('0x19'));var jayson=require(_0xe9c5('0x1a'));var client=jayson[_0xe9c5('0x1b')][_0xe9c5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x409f65,_0x509978,_0x3cce36,_0xe98b11){return new BPromise(function(_0x5eb474,_0x3bbd96){var _0x211eec=_0xe98b11||client;return _0x211eec[_0xe9c5('0x1d')](_0x409f65,_0x3cce36)['then'](function(_0x163253){logger[_0xe9c5('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x509978,_0xe9c5('0x1f'));logger[_0xe9c5('0x20')](_0xe9c5('0x21'),_0x509978,_0xe9c5('0x1f'),JSON[_0xe9c5('0x22')](_0x163253));if(_0x163253['error']){if(_0x163253[_0xe9c5('0x23')][_0xe9c5('0x24')]===0x1f4){logger[_0xe9c5('0x23')](_0xe9c5('0x25'),_0x509978,_0x163253['error'][_0xe9c5('0x26')]);return _0x3bbd96(_0x163253[_0xe9c5('0x23')][_0xe9c5('0x26')]);}logger[_0xe9c5('0x23')](_0xe9c5('0x25'),_0x509978,_0x163253['error']['message']);return _0x5eb474(_0x163253[_0xe9c5('0x23')]['message']);}else{logger[_0xe9c5('0x1e')](_0xe9c5('0x25'),_0x509978,_0xe9c5('0x1f'));_0x5eb474(_0x163253[_0xe9c5('0x27')]['message']);}})[_0xe9c5('0x28')](function(_0x3f8bb9){logger[_0xe9c5('0x23')](_0xe9c5('0x25'),_0x509978,_0x3f8bb9);_0x3bbd96(_0x3f8bb9);});});}function respondWithStatusCode(_0x34a7c8,_0x245161){_0x245161=_0x245161||0xcc;return function(_0x44ba59){if(_0x44ba59){return _0x34a7c8[_0xe9c5('0x29')](_0x245161);}return _0x34a7c8[_0xe9c5('0x2a')](_0x245161)[_0xe9c5('0x2b')]();};}function respondWithResult(_0x5a3caa,_0x5c8bb7){_0x5c8bb7=_0x5c8bb7||0xc8;return function(_0x250e1c){if(_0x250e1c){return _0x5a3caa[_0xe9c5('0x2a')](_0x5c8bb7)[_0xe9c5('0x2c')](_0x250e1c);}};}function respondWithFilteredResult(_0x3bf679,_0x33fe71){return function(_0x100eda){if(_0x100eda){var _0x493108=typeof _0x33fe71[_0xe9c5('0x2d')]==='undefined'&&typeof _0x33fe71[_0xe9c5('0x2e')]==='undefined';var _0x4fa0c2=_0x100eda[_0xe9c5('0x2f')];var _0x52d008=_0x493108?0x0:_0x33fe71[_0xe9c5('0x2d')];var _0x46d253=_0x493108?_0x100eda[_0xe9c5('0x2f')]:_0x33fe71[_0xe9c5('0x2d')]+_0x33fe71[_0xe9c5('0x2e')];var _0x5ca61c;if(_0x46d253>=_0x4fa0c2){_0x46d253=_0x4fa0c2;_0x5ca61c=0xc8;}else{_0x5ca61c=0xce;}_0x3bf679[_0xe9c5('0x2a')](_0x5ca61c);return _0x3bf679['set'](_0xe9c5('0x30'),_0x52d008+'-'+_0x46d253+'/'+_0x4fa0c2)['json'](_0x100eda);}return null;};}function patchUpdates(_0x348fee){return function(_0x32e267){try{jsonpatch[_0xe9c5('0x31')](_0x32e267,_0x348fee,!![]);}catch(_0x288d67){return BPromise[_0xe9c5('0x32')](_0x288d67);}return _0x32e267['save']();};}function saveUpdates(_0x23dc05,_0x12f47c){return function(_0x140adf){if(_0x140adf){return _0x140adf[_0xe9c5('0x33')](_0x23dc05)[_0xe9c5('0x34')](function(_0x50e9f1){return _0x50e9f1;});}return null;};}function removeEntity(_0x50749b,_0x35b318){return function(_0x213ac7){if(_0x213ac7){return _0x213ac7[_0xe9c5('0x35')]()[_0xe9c5('0x34')](function(){_0x50749b[_0xe9c5('0x2a')](0xcc)[_0xe9c5('0x2b')]();});}};}function handleEntityNotFound(_0x414738,_0x29b649){return function(_0x4feba2){if(!_0x4feba2){_0x414738[_0xe9c5('0x29')](0x194);}return _0x4feba2;};}function handleError(_0x3a2950,_0x558277){_0x558277=_0x558277||0x1f4;return function(_0x3ac925){logger['error'](_0x3ac925[_0xe9c5('0x36')]);if(_0x3ac925[_0xe9c5('0x37')]){delete _0x3ac925[_0xe9c5('0x37')];}_0x3a2950[_0xe9c5('0x2a')](_0x558277)[_0xe9c5('0x38')](_0x3ac925);};}function getMustacheRender(_0x18e617,_0x520a94){return Mustache[_0xe9c5('0x39')](_0x18e617,_[_0xe9c5('0x3a')](_0x520a94[_0xe9c5('0x3b')],{'contact':_0x520a94[_0xe9c5('0x3c')],'message':_0x520a94[_0xe9c5('0x26')],'agent':_0x520a94[_0xe9c5('0x3d')],'interaction':_0x520a94[_0xe9c5('0x3e')],'account':_0x520a94[_0xe9c5('0x3f')]}))||'';}exports[_0xe9c5('0x40')]=function(_0x10541f,_0x6a1a2e){var _0x1857f2={},_0x55cd00={},_0x2a1a28={'count':0x0,'rows':[]};var _0x2e3f15=_[_0xe9c5('0x41')](db[_0xe9c5('0x42')][_0xe9c5('0x43')],function(_0x3b85bf){return{'name':_0x3b85bf['fieldName'],'type':_0x3b85bf[_0xe9c5('0x44')][_0xe9c5('0x45')]};});_0x55cd00[_0xe9c5('0x46')]=_['map'](_0x2e3f15,_0xe9c5('0x37'));_0x55cd00[_0xe9c5('0x47')]=_[_0xe9c5('0x48')](_0x10541f[_0xe9c5('0x47')]);_0x55cd00[_0xe9c5('0x49')]=_[_0xe9c5('0x4a')](_0x55cd00[_0xe9c5('0x46')],_0x55cd00[_0xe9c5('0x47')]);_0x1857f2[_0xe9c5('0x4b')]=_[_0xe9c5('0x4a')](_0x55cd00[_0xe9c5('0x46')],qs['fields'](_0x10541f['query'][_0xe9c5('0x4c')]));_0x1857f2[_0xe9c5('0x4b')]=_0x1857f2[_0xe9c5('0x4b')][_0xe9c5('0x4d')]?_0x1857f2['attributes']:_0x55cd00['model'];if(!_0x10541f[_0xe9c5('0x47')][_0xe9c5('0x4e')]('nolimit')){_0x1857f2[_0xe9c5('0x2e')]=qs['limit'](_0x10541f['query']['limit']);_0x1857f2[_0xe9c5('0x2d')]=qs[_0xe9c5('0x2d')](_0x10541f[_0xe9c5('0x47')][_0xe9c5('0x2d')]);}_0x1857f2['order']=qs[_0xe9c5('0x4f')](_0x10541f[_0xe9c5('0x47')][_0xe9c5('0x4f')]);_0x1857f2[_0xe9c5('0x50')]=qs[_0xe9c5('0x49')](_[_0xe9c5('0x51')](_0x10541f[_0xe9c5('0x47')],_0x55cd00[_0xe9c5('0x49')]),_0x2e3f15);if(_0x10541f['query'][_0xe9c5('0x52')]){_0x1857f2[_0xe9c5('0x50')]=_[_0xe9c5('0x3a')](_0x1857f2[_0xe9c5('0x50')],{'$or':_[_0xe9c5('0x41')](_0x2e3f15,function(_0x537fcc){if(_0x537fcc['type']!=='VIRTUAL'){var _0x55f1d8={};_0x55f1d8[_0x537fcc['name']]={'$like':'%'+_0x10541f[_0xe9c5('0x47')][_0xe9c5('0x52')]+'%'};return _0x55f1d8;}})});}_0x1857f2=_[_0xe9c5('0x3a')]({},_0x1857f2,_0x10541f['options']);var _0x120d3d={'where':_0x1857f2[_0xe9c5('0x50')]};return db[_0xe9c5('0x42')][_0xe9c5('0x2f')](_0x120d3d)[_0xe9c5('0x34')](function(_0x27b8db){_0x2a1a28['count']=_0x27b8db;if(_0x10541f[_0xe9c5('0x47')][_0xe9c5('0x53')]){_0x1857f2[_0xe9c5('0x54')]=[{'all':!![]}];}return db[_0xe9c5('0x42')]['findAll'](_0x1857f2);})[_0xe9c5('0x34')](function(_0x2c8bd3){_0x2a1a28[_0xe9c5('0x55')]=_0x2c8bd3;return _0x2a1a28;})[_0xe9c5('0x34')](respondWithFilteredResult(_0x6a1a2e,_0x1857f2))[_0xe9c5('0x28')](handleError(_0x6a1a2e,null));};exports[_0xe9c5('0x56')]=function(_0x53311d,_0x38af95){var _0xe6a73f={'raw':![],'where':{'id':_0x53311d[_0xe9c5('0x57')]['id']}},_0x974438={};_0x974438['model']=_[_0xe9c5('0x48')](db[_0xe9c5('0x42')][_0xe9c5('0x43')]);_0x974438[_0xe9c5('0x47')]=_[_0xe9c5('0x48')](_0x53311d[_0xe9c5('0x47')]);_0x974438['filters']=_['intersection'](_0x974438[_0xe9c5('0x46')],_0x974438[_0xe9c5('0x47')]);_0xe6a73f[_0xe9c5('0x4b')]=_[_0xe9c5('0x4a')](_0x974438[_0xe9c5('0x46')],qs[_0xe9c5('0x4c')](_0x53311d[_0xe9c5('0x47')][_0xe9c5('0x4c')]));_0xe6a73f[_0xe9c5('0x4b')]=_0xe6a73f[_0xe9c5('0x4b')][_0xe9c5('0x4d')]?_0xe6a73f[_0xe9c5('0x4b')]:_0x974438[_0xe9c5('0x46')];if(_0x53311d[_0xe9c5('0x47')][_0xe9c5('0x53')]){_0xe6a73f[_0xe9c5('0x54')]=[{'all':!![]}];}_0xe6a73f=_['merge']({},_0xe6a73f,_0x53311d['options']);return db['FreshdeskAccount'][_0xe9c5('0x58')](_0xe6a73f)[_0xe9c5('0x34')](handleEntityNotFound(_0x38af95,null))[_0xe9c5('0x34')](respondWithResult(_0x38af95,null))['catch'](handleError(_0x38af95,null));};exports[_0xe9c5('0x59')]=function(_0x544684,_0x227370){return db[_0xe9c5('0x42')][_0xe9c5('0x59')](_0x544684[_0xe9c5('0x3b')],{})[_0xe9c5('0x34')](respondWithResult(_0x227370,0xc9))['catch'](handleError(_0x227370,null));};exports[_0xe9c5('0x33')]=function(_0x1b4515,_0x5974ee){if(_0x1b4515[_0xe9c5('0x3b')]['id']){delete _0x1b4515[_0xe9c5('0x3b')]['id'];}return db[_0xe9c5('0x42')][_0xe9c5('0x58')]({'where':{'id':_0x1b4515['params']['id']}})[_0xe9c5('0x34')](handleEntityNotFound(_0x5974ee,null))['then'](saveUpdates(_0x1b4515[_0xe9c5('0x3b')],null))[_0xe9c5('0x34')](respondWithResult(_0x5974ee,null))[_0xe9c5('0x28')](handleError(_0x5974ee,null));};exports[_0xe9c5('0x35')]=function(_0x5ab663,_0x4439cf){return db[_0xe9c5('0x42')][_0xe9c5('0x58')]({'where':{'id':_0x5ab663[_0xe9c5('0x57')]['id']}})[_0xe9c5('0x34')](handleEntityNotFound(_0x4439cf,null))[_0xe9c5('0x34')](removeEntity(_0x4439cf,null))['catch'](handleError(_0x4439cf,null));};exports[_0xe9c5('0x5a')]=function(_0x181a9c,_0x5c1736,_0x3533cb){var _0x591bc5={};var _0x1e5603={};var _0x227311;var _0x1d0c4e;return db[_0xe9c5('0x42')][_0xe9c5('0x5b')]({'where':{'id':_0x181a9c[_0xe9c5('0x57')]['id']}})[_0xe9c5('0x34')](handleEntityNotFound(_0x5c1736,null))['then'](function(_0x26b48b){if(_0x26b48b){_0x227311=_0x26b48b;_0x1e5603[_0xe9c5('0x46')]=_[_0xe9c5('0x48')](db['FreshdeskConfiguration'][_0xe9c5('0x43')]);_0x1e5603['query']=_['keys'](_0x181a9c[_0xe9c5('0x47')]);_0x1e5603[_0xe9c5('0x49')]=_[_0xe9c5('0x4a')](_0x1e5603[_0xe9c5('0x46')],_0x1e5603[_0xe9c5('0x47')]);_0x591bc5[_0xe9c5('0x4b')]=_[_0xe9c5('0x4a')](_0x1e5603[_0xe9c5('0x46')],qs[_0xe9c5('0x4c')](_0x181a9c[_0xe9c5('0x47')]['fields']));_0x591bc5[_0xe9c5('0x4b')]=_0x591bc5[_0xe9c5('0x4b')][_0xe9c5('0x4d')]?_0x591bc5[_0xe9c5('0x4b')]:_0x1e5603[_0xe9c5('0x46')];_0x591bc5[_0xe9c5('0x5c')]=qs[_0xe9c5('0x4f')](_0x181a9c[_0xe9c5('0x47')][_0xe9c5('0x4f')]);_0x591bc5['where']=qs[_0xe9c5('0x49')](_[_0xe9c5('0x51')](_0x181a9c[_0xe9c5('0x47')],_0x1e5603[_0xe9c5('0x49')]));if(_0x181a9c[_0xe9c5('0x47')][_0xe9c5('0x52')]){_0x591bc5[_0xe9c5('0x50')]=_['merge'](_0x591bc5[_0xe9c5('0x50')],{'$or':_[_0xe9c5('0x41')](_0x591bc5[_0xe9c5('0x4b')],function(_0xa4886e){var _0x25e994={};_0x25e994[_0xa4886e]={'$like':'%'+_0x181a9c['query'][_0xe9c5('0x52')]+'%'};return _0x25e994;})});}_0x591bc5=_['merge']({},_0x591bc5,_0x181a9c['options']);return _0x227311[_0xe9c5('0x5a')](_0x591bc5);}})[_0xe9c5('0x34')](function(_0x5560f8){if(_0x5560f8){_0x1d0c4e=_0x5560f8['length'];if(!_0x181a9c[_0xe9c5('0x47')]['hasOwnProperty'](_0xe9c5('0x5d'))){_0x591bc5[_0xe9c5('0x2e')]=qs['limit'](_0x181a9c[_0xe9c5('0x47')][_0xe9c5('0x2e')]);_0x591bc5[_0xe9c5('0x2d')]=qs[_0xe9c5('0x2d')](_0x181a9c[_0xe9c5('0x47')][_0xe9c5('0x2d')]);}return _0x227311['getConfigurations'](_0x591bc5);}})[_0xe9c5('0x34')](function(_0x12bf41){if(_0x12bf41){return _0x12bf41?{'count':_0x1d0c4e,'rows':_0x12bf41}:null;}})[_0xe9c5('0x34')](respondWithResult(_0x5c1736,null))[_0xe9c5('0x28')](handleError(_0x5c1736,null));};exports[_0xe9c5('0x5e')]=function(_0x141e25,_0x4e044f,_0x394295){if(_0x141e25[_0xe9c5('0x3b')]['id']){delete _0x141e25['body']['id'];}return db[_0xe9c5('0x42')][_0xe9c5('0x5b')]({'where':{'id':_0x141e25[_0xe9c5('0x57')]['id']}})[_0xe9c5('0x34')](handleEntityNotFound(_0x4e044f,null))[_0xe9c5('0x34')](function(_0x9115c8){if(_0x9115c8){_0x141e25['body'][_0xe9c5('0x5f')]=_0x9115c8['id'];_0x141e25['body']['Subjects']=integrations['getSubjects'](_0x141e25[_0xe9c5('0x3b')][_0xe9c5('0x60')],_0x141e25[_0xe9c5('0x3b')][_0xe9c5('0x44')]);_0x141e25[_0xe9c5('0x3b')][_0xe9c5('0x61')]=integrations['getDescriptions'](_0x141e25[_0xe9c5('0x3b')][_0xe9c5('0x60')],_0x141e25[_0xe9c5('0x3b')][_0xe9c5('0x44')]);return db[_0xe9c5('0x62')]['create'](_0x141e25['body'],{'include':[{'model':db[_0xe9c5('0x63')],'as':_0xe9c5('0x64')},{'model':db[_0xe9c5('0x63')],'as':_0xe9c5('0x61')}]});}return null;})[_0xe9c5('0x34')](respondWithResult(_0x4e044f,null))['catch'](handleError(_0x4e044f,null));};exports[_0xe9c5('0x65')]=function(_0x506f64,_0x1ed0bd,_0x1867ad){var _0x33eb1b='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x506f64['params']['id']},'attributes':['id','remoteUri','apiKey']})[_0xe9c5('0x34')](handleEntityNotFound(_0x1ed0bd,null))[_0xe9c5('0x34')](function(_0x100a33){if(_0x100a33){_0x33eb1b=_0x100a33[_0xe9c5('0x66')];var _0x12cb40=_0x33eb1b['slice'](-0x1);if(_0x12cb40==='/'){_0x33eb1b=_0x33eb1b[_0xe9c5('0x67')](0x0,_0x33eb1b['lastIndexOf'](_0x12cb40));}return rp({'method':'GET','uri':util[_0xe9c5('0x68')]('%s/%s',_0x33eb1b,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0xe9c5('0x69'),new Buffer(util['format'](_0xe9c5('0x6a'),_0x100a33['apiKey']))[_0xe9c5('0x6b')](_0xe9c5('0x6c')))},'json':!![]});}})[_0xe9c5('0x34')](function(_0x2160ff){if(_0x2160ff){var _0x48e440=['requester',_0xe9c5('0x6d'),_0xe9c5('0x3d'),_0xe9c5('0x6e'),'status',_0xe9c5('0x6f'),'group','source',_0xe9c5('0x70'),_0xe9c5('0x71'),_0xe9c5('0x72')];_['remove'](_0x2160ff,function(_0x3d2efb){return _0x48e440[_0xe9c5('0x73')](_0x3d2efb[_0xe9c5('0x37')])||!_0x3d2efb[_0xe9c5('0x74')]&&_0x3d2efb['type']!=='custom_text'&&_0x3d2efb[_0xe9c5('0x44')]!==_0xe9c5('0x75');});return{'count':_0x2160ff['length'],'rows':_[_0xe9c5('0x41')](_0x2160ff,function(_0x3f44cb){return{'id':_0x3f44cb[_0xe9c5('0x37')],'name':_0x3f44cb[_0xe9c5('0x76')],'custom':!_0x3f44cb['default'],'options':_0x3f44cb[_0xe9c5('0x77')]?_[_0xe9c5('0x41')](_0x3f44cb['choices'],function(_0x315855){return{'name':_[_0xe9c5('0x78')](_0x315855),'value':_0x315855};}):[]};})};}})[_0xe9c5('0x34')](respondWithResult(_0x1ed0bd,null))['catch'](function(_0x20386c){var _0x48e943=_0x506f64[_0xe9c5('0x47')]['test']?0x1f4:_0x20386c[_0xe9c5('0x79')]||0x1f4;logger[_0xe9c5('0x23')](_0xe9c5('0x7a'),_0xe9c5('0x65'),_0x48e943,JSON[_0xe9c5('0x22')](_0x20386c));delete _0x20386c[_0xe9c5('0x37')];if(_0x48e943===0x191){_0x48e943=0x190;}_0x1ed0bd[_0xe9c5('0x2a')](_0x48e943)[_0xe9c5('0x38')](_0x506f64['query'][_0xe9c5('0x7b')]?{'message':_0xe9c5('0x7c'),'statusCode':_0x20386c[_0xe9c5('0x79')]}:_0x20386c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ce1111d..ffc25e3 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 _0x2e1d=['exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x14520c,_0x25de6e){var _0x2fa128=function(_0x57b0ca){while(--_0x57b0ca){_0x14520c['push'](_0x14520c['shift']());}};_0x2fa128(++_0x25de6e);}(_0x2e1d,0xc7));var _0xd2e1=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x2e1d[_0x5e8eae];return _0xdd09cd;};'use strict';var _=require(_0xd2e1('0x0'));var util=require(_0xd2e1('0x1'));var logger=require(_0xd2e1('0x2'))(_0xd2e1('0x3'));var moment=require(_0xd2e1('0x4'));var BPromise=require(_0xd2e1('0x5'));var rp=require(_0xd2e1('0x6'));var fs=require('fs');var path=require(_0xd2e1('0x7'));var rimraf=require('rimraf');var config=require(_0xd2e1('0x8'));var attributes=require(_0xd2e1('0x9'));var integrations=require(_0xd2e1('0xa'));module[_0xd2e1('0xb')]=function(_0x5396a1,_0x34996e){return _0x5396a1[_0xd2e1('0xc')](_0xd2e1('0xd'),attributes,{'tableName':_0xd2e1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a44=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment'];(function(_0x7095ef,_0x5008d8){var _0x844bf4=function(_0x298bdd){while(--_0x298bdd){_0x7095ef['push'](_0x7095ef['shift']());}};_0x844bf4(++_0x5008d8);}(_0x6a44,0x74));var _0x46a4=function(_0x13df49,_0x52fedd){_0x13df49=_0x13df49-0x0;var _0x44cc47=_0x6a44[_0x13df49];return _0x44cc47;};'use strict';var _=require('lodash');var util=require(_0x46a4('0x0'));var logger=require(_0x46a4('0x1'))(_0x46a4('0x2'));var moment=require(_0x46a4('0x3'));var BPromise=require(_0x46a4('0x4'));var rp=require(_0x46a4('0x5'));var fs=require('fs');var path=require(_0x46a4('0x6'));var rimraf=require(_0x46a4('0x7'));var config=require(_0x46a4('0x8'));var attributes=require(_0x46a4('0x9'));var integrations=require(_0x46a4('0xa'));module[_0x46a4('0xb')]=function(_0x31090c,_0x3b3bdc){return _0x31090c[_0x46a4('0xc')](_0x46a4('0xd'),attributes,{'tableName':_0x46a4('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 5d39dbc..d8cfb34 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 _0xeb7b=['info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x40cb69,_0x37f2ba){var _0x55e036=function(_0x2f6d54){while(--_0x2f6d54){_0x40cb69['push'](_0x40cb69['shift']());}};_0x55e036(++_0x37f2ba);}(_0xeb7b,0x170));var _0xbeb7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb7b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xbeb7('0x0'));var moment=require('moment');var BPromise=require(_0xbeb7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbeb7('0x2'));var db=require(_0xbeb7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbeb7('0x4'))(_0xbeb7('0x5'));var config=require(_0xbeb7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbeb7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x442faa,_0x197243,_0x227abc){return new BPromise(function(_0x26e827,_0x22aca6){return client['request'](_0x442faa,_0x227abc)[_0xbeb7('0x8')](function(_0x2674d3){logger[_0xbeb7('0x9')]('FreshdeskAccount,\x20%s,\x20%s',_0x197243,_0xbeb7('0xa'));logger[_0xbeb7('0xb')](_0xbeb7('0xc'),_0x197243,_0xbeb7('0xa'),JSON[_0xbeb7('0xd')](_0x2674d3));if(_0x2674d3[_0xbeb7('0xe')]){if(_0x2674d3['error']['code']===0x1f4){logger['error'](_0xbeb7('0xf'),_0x197243,_0x2674d3[_0xbeb7('0xe')][_0xbeb7('0x10')]);return _0x22aca6(_0x2674d3[_0xbeb7('0xe')][_0xbeb7('0x10')]);}logger[_0xbeb7('0xe')](_0xbeb7('0xf'),_0x197243,_0x2674d3[_0xbeb7('0xe')]['message']);return _0x26e827(_0x2674d3['error'][_0xbeb7('0x10')]);}else{logger['info'](_0xbeb7('0xf'),_0x197243,_0xbeb7('0xa'));_0x26e827(_0x2674d3['result'][_0xbeb7('0x10')]);}})['catch'](function(_0x4bb6d7){logger[_0xbeb7('0xe')](_0xbeb7('0xf'),_0x197243,_0x4bb6d7);_0x22aca6(_0x4bb6d7);});});}exports[_0xbeb7('0x11')]=function(_0x445271){var _0x2750c1=this;return new Promise(function(_0xa702e0,_0x386a85){return db[_0xbeb7('0x12')]['findAll']({'raw':_0x445271[_0xbeb7('0x13')]?_0x445271[_0xbeb7('0x13')][_0xbeb7('0x14')]===undefined?!![]:![]:!![],'where':_0x445271[_0xbeb7('0x13')]?_0x445271[_0xbeb7('0x13')][_0xbeb7('0x15')]||null:null,'attributes':_0x445271[_0xbeb7('0x13')]?_0x445271[_0xbeb7('0x13')][_0xbeb7('0x16')]||null:null,'limit':_0x445271[_0xbeb7('0x13')]?_0x445271[_0xbeb7('0x13')][_0xbeb7('0x17')]||null:null,'include':_0x445271[_0xbeb7('0x13')]?_0x445271['options'][_0xbeb7('0x18')]?_[_0xbeb7('0x19')](_0x445271[_0xbeb7('0x13')][_0xbeb7('0x18')],function(_0x3e0723){return{'model':db[_0x3e0723['model']],'as':_0x3e0723['as'],'attributes':_0x3e0723[_0xbeb7('0x16')],'include':_0x3e0723[_0xbeb7('0x18')]?_['map'](_0x3e0723[_0xbeb7('0x18')],function(_0x178640){return{'model':db[_0x178640[_0xbeb7('0x1a')]],'as':_0x178640['as'],'attributes':_0x178640['attributes'],'include':_0x178640[_0xbeb7('0x18')]?_[_0xbeb7('0x19')](_0x178640[_0xbeb7('0x18')],function(_0x36eac5){return{'model':db[_0x36eac5['model']],'as':_0x36eac5['as'],'attributes':_0x36eac5[_0xbeb7('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbeb7('0x8')](function(_0x162e6e){logger['info'](_0xbeb7('0x11'),_0x445271);logger['debug'](_0xbeb7('0x11'),_0x445271,JSON[_0xbeb7('0xd')](_0x162e6e));_0xa702e0(_0x162e6e);})[_0xbeb7('0x1b')](function(_0xe44ba4){logger[_0xbeb7('0xe')]('GetFreshdeskAccount',_0xe44ba4[_0xbeb7('0x10')],_0x445271);_0x386a85(_0x2750c1[_0xbeb7('0xe')](0x1f4,_0xe44ba4[_0xbeb7('0x10')]));});});};exports[_0xbeb7('0x1c')]=function(_0x16e309){var _0x54b4cc=this;return new Promise(function(_0x3c395c,_0x3407b8){return db['FreshdeskAccount']['find']({'raw':_0x16e309[_0xbeb7('0x13')]?_0x16e309[_0xbeb7('0x13')][_0xbeb7('0x14')]===undefined?!![]:![]:!![],'where':_0x16e309[_0xbeb7('0x13')]?_0x16e309[_0xbeb7('0x13')][_0xbeb7('0x15')]||null:null,'attributes':_0x16e309[_0xbeb7('0x13')]?_0x16e309['options'][_0xbeb7('0x16')]||null:null,'include':_0x16e309[_0xbeb7('0x13')]?_0x16e309[_0xbeb7('0x13')][_0xbeb7('0x18')]?_[_0xbeb7('0x19')](_0x16e309[_0xbeb7('0x13')][_0xbeb7('0x18')],function(_0x4d2e41){return{'model':db[_0x4d2e41['model']],'as':_0x4d2e41['as'],'attributes':_0x4d2e41[_0xbeb7('0x16')],'include':_0x4d2e41[_0xbeb7('0x18')]?_[_0xbeb7('0x19')](_0x4d2e41[_0xbeb7('0x18')],function(_0x108316){return{'model':db[_0x108316[_0xbeb7('0x1a')]],'as':_0x108316['as'],'attributes':_0x108316[_0xbeb7('0x16')],'include':_0x108316['include']?_[_0xbeb7('0x19')](_0x108316[_0xbeb7('0x18')],function(_0x7aac5){return{'model':db[_0x7aac5[_0xbeb7('0x1a')]],'as':_0x7aac5['as'],'attributes':_0x7aac5[_0xbeb7('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1eb4ef){logger[_0xbeb7('0x9')]('ShowFreshdeskAccount',_0x16e309);logger[_0xbeb7('0xb')](_0xbeb7('0x1c'),_0x16e309,JSON[_0xbeb7('0xd')](_0x1eb4ef));_0x3c395c(_0x1eb4ef);})[_0xbeb7('0x1b')](function(_0x13d00f){logger[_0xbeb7('0xe')](_0xbeb7('0x1c'),_0x13d00f[_0xbeb7('0x10')],_0x16e309);_0x3407b8(_0x54b4cc[_0xbeb7('0xe')](0x1f4,_0x13d00f[_0xbeb7('0x10')]));});});}; \ No newline at end of file +var _0x53b1=['stringify','ShowFreshdeskAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','map','model','attributes','then'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0x53b1,0x6d));var _0x153b=function(_0x57fc7d,_0x445ce6){_0x57fc7d=_0x57fc7d-0x0;var _0xa2ad02=_0x53b1[_0x57fc7d];return _0xa2ad02;};'use strict';var _=require(_0x153b('0x0'));var util=require(_0x153b('0x1'));var moment=require(_0x153b('0x2'));var BPromise=require('bluebird');var rs=require(_0x153b('0x3'));var fs=require('fs');var Redis=require(_0x153b('0x4'));var db=require(_0x153b('0x5'))['db'];var utils=require(_0x153b('0x6'));var logger=require(_0x153b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x153b('0x8'));var client=jayson['client'][_0x153b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37e9ac,_0x573b72,_0x4b6c4b){return new BPromise(function(_0x2e0b2c,_0x5d5a9b){return client[_0x153b('0xa')](_0x37e9ac,_0x4b6c4b)['then'](function(_0x5359d5){logger[_0x153b('0xb')](_0x153b('0xc'),_0x573b72,_0x153b('0xd'));logger[_0x153b('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x573b72,'request\x20sent',JSON['stringify'](_0x5359d5));if(_0x5359d5[_0x153b('0xf')]){if(_0x5359d5[_0x153b('0xf')][_0x153b('0x10')]===0x1f4){logger['error'](_0x153b('0xc'),_0x573b72,_0x5359d5[_0x153b('0xf')]['message']);return _0x5d5a9b(_0x5359d5[_0x153b('0xf')][_0x153b('0x11')]);}logger[_0x153b('0xf')](_0x153b('0xc'),_0x573b72,_0x5359d5['error'][_0x153b('0x11')]);return _0x2e0b2c(_0x5359d5[_0x153b('0xf')][_0x153b('0x11')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x573b72,_0x153b('0xd'));_0x2e0b2c(_0x5359d5[_0x153b('0x12')][_0x153b('0x11')]);}})[_0x153b('0x13')](function(_0x2dec93){logger[_0x153b('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x573b72,_0x2dec93);_0x5d5a9b(_0x2dec93);});});}exports[_0x153b('0x14')]=function(_0x528744){var _0x45d009=this;return new Promise(function(_0x5b7248,_0x1a5002){return db[_0x153b('0x15')][_0x153b('0x16')]({'raw':_0x528744['options']?_0x528744[_0x153b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x528744[_0x153b('0x17')]?_0x528744[_0x153b('0x17')][_0x153b('0x18')]||null:null,'attributes':_0x528744['options']?_0x528744[_0x153b('0x17')]['attributes']||null:null,'limit':_0x528744[_0x153b('0x17')]?_0x528744[_0x153b('0x17')][_0x153b('0x19')]||null:null,'include':_0x528744[_0x153b('0x17')]?_0x528744[_0x153b('0x17')][_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x528744[_0x153b('0x17')][_0x153b('0x1a')],function(_0x3d8883){return{'model':db[_0x3d8883[_0x153b('0x1c')]],'as':_0x3d8883['as'],'attributes':_0x3d8883[_0x153b('0x1d')],'include':_0x3d8883[_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x3d8883[_0x153b('0x1a')],function(_0x45006d){return{'model':db[_0x45006d[_0x153b('0x1c')]],'as':_0x45006d['as'],'attributes':_0x45006d[_0x153b('0x1d')],'include':_0x45006d[_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x45006d['include'],function(_0x23a357){return{'model':db[_0x23a357[_0x153b('0x1c')]],'as':_0x23a357['as'],'attributes':_0x23a357[_0x153b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x153b('0x1e')](function(_0x505679){logger['info'](_0x153b('0x14'),_0x528744);logger[_0x153b('0xe')](_0x153b('0x14'),_0x528744,JSON[_0x153b('0x1f')](_0x505679));_0x5b7248(_0x505679);})[_0x153b('0x13')](function(_0x501093){logger[_0x153b('0xf')]('GetFreshdeskAccount',_0x501093['message'],_0x528744);_0x1a5002(_0x45d009[_0x153b('0xf')](0x1f4,_0x501093[_0x153b('0x11')]));});});};exports[_0x153b('0x20')]=function(_0x1bae24){var _0x5ef16e=this;return new Promise(function(_0x1520b3,_0x423305){return db[_0x153b('0x15')][_0x153b('0x21')]({'raw':_0x1bae24[_0x153b('0x17')]?_0x1bae24[_0x153b('0x17')][_0x153b('0x22')]===undefined?!![]:![]:!![],'where':_0x1bae24['options']?_0x1bae24[_0x153b('0x17')]['where']||null:null,'attributes':_0x1bae24['options']?_0x1bae24['options'][_0x153b('0x1d')]||null:null,'include':_0x1bae24[_0x153b('0x17')]?_0x1bae24[_0x153b('0x17')][_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x1bae24['options']['include'],function(_0x5e52d8){return{'model':db[_0x5e52d8['model']],'as':_0x5e52d8['as'],'attributes':_0x5e52d8[_0x153b('0x1d')],'include':_0x5e52d8[_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x5e52d8[_0x153b('0x1a')],function(_0x2e6b2a){return{'model':db[_0x2e6b2a['model']],'as':_0x2e6b2a['as'],'attributes':_0x2e6b2a[_0x153b('0x1d')],'include':_0x2e6b2a[_0x153b('0x1a')]?_[_0x153b('0x1b')](_0x2e6b2a[_0x153b('0x1a')],function(_0x3c01d3){return{'model':db[_0x3c01d3[_0x153b('0x1c')]],'as':_0x3c01d3['as'],'attributes':_0x3c01d3[_0x153b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x153b('0x1e')](function(_0x5ea6f2){logger[_0x153b('0xb')](_0x153b('0x20'),_0x1bae24);logger[_0x153b('0xe')](_0x153b('0x20'),_0x1bae24,JSON['stringify'](_0x5ea6f2));_0x1520b3(_0x5ea6f2);})[_0x153b('0x13')](function(_0x50d855){logger[_0x153b('0xf')](_0x153b('0x20'),_0x50d855[_0x153b('0x11')],_0x1bae24);_0x423305(_0x5ef16e['error'](0x1f4,_0x50d855['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 10a6a4a..96a2fa7 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 _0x1b0b=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags'];(function(_0x24de9f,_0x228cac){var _0x1de54b=function(_0x1e92c9){while(--_0x1e92c9){_0x24de9f['push'](_0x24de9f['shift']());}};_0x1de54b(++_0x228cac);}(_0x1b0b,0x173));var _0xb1b0=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x1b0b[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0xb1b0('0x0'));var util=require(_0xb1b0('0x1'));var path=require(_0xb1b0('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1b0('0x3'));var router=express[_0xb1b0('0x4')]();var fs_extra=require(_0xb1b0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb1b0('0x6'));router[_0xb1b0('0x7')]('/',auth[_0xb1b0('0x8')](),controller[_0xb1b0('0x9')]);router[_0xb1b0('0x7')](_0xb1b0('0xa'),auth[_0xb1b0('0x8')](),controller[_0xb1b0('0xb')]);router[_0xb1b0('0x7')]('/:id/fields',auth[_0xb1b0('0x8')](),controller['getFields']);router['get'](_0xb1b0('0xc'),auth[_0xb1b0('0x8')](),controller[_0xb1b0('0xd')]);router[_0xb1b0('0x7')](_0xb1b0('0xe'),auth[_0xb1b0('0x8')](),controller['getDescriptions']);router[_0xb1b0('0x7')](_0xb1b0('0xf'),auth[_0xb1b0('0x8')](),controller[_0xb1b0('0x10')]);router[_0xb1b0('0x11')]('/',auth[_0xb1b0('0x8')](),controller[_0xb1b0('0x12')]);router[_0xb1b0('0x11')](_0xb1b0('0xf'),auth[_0xb1b0('0x8')](),controller[_0xb1b0('0x13')]);router['put'](_0xb1b0('0xa'),auth[_0xb1b0('0x8')](),controller['update']);router[_0xb1b0('0x14')](_0xb1b0('0xa'),auth[_0xb1b0('0x8')](),controller[_0xb1b0('0x15')]);module[_0xb1b0('0x16')]=router; \ No newline at end of file +var _0xd750=['./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x300d56,_0x51f833){var _0x4fe16f=function(_0xef2484){while(--_0xef2484){_0x300d56['push'](_0x300d56['shift']());}};_0x4fe16f(++_0x51f833);}(_0xd750,0x1ed));var _0x0d75=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0xd750[_0x2ac5f8];return _0x3b8229;};'use strict';var multer=require(_0x0d75('0x0'));var util=require(_0x0d75('0x1'));var path=require(_0x0d75('0x2'));var timeout=require(_0x0d75('0x3'));var express=require(_0x0d75('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0d75('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0d75('0x6'));var controller=require(_0x0d75('0x7'));router[_0x0d75('0x8')]('/',auth[_0x0d75('0x9')](),controller['index']);router[_0x0d75('0x8')](_0x0d75('0xa'),auth['isAuthenticated'](),controller[_0x0d75('0xb')]);router[_0x0d75('0x8')](_0x0d75('0xc'),auth[_0x0d75('0x9')](),controller[_0x0d75('0xd')]);router[_0x0d75('0x8')](_0x0d75('0xe'),auth[_0x0d75('0x9')](),controller['getSubjects']);router[_0x0d75('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x0d75('0xf')]);router[_0x0d75('0x8')](_0x0d75('0x10'),auth[_0x0d75('0x9')](),controller[_0x0d75('0x11')]);router[_0x0d75('0x12')]('/',auth[_0x0d75('0x9')](),controller[_0x0d75('0x13')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0x0d75('0x14')]);router['put'](_0x0d75('0xa'),auth[_0x0d75('0x9')](),controller[_0x0d75('0x15')]);router[_0x0d75('0x16')]('/:id',auth[_0x0d75('0x9')](),controller[_0x0d75('0x17')]);module[_0x0d75('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d2d712d..93afbf9 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 _0x3106=['STRING','sequelize','exports'];(function(_0x706091,_0x5e07d9){var _0x4aee6f=function(_0xf8d0f6){while(--_0xf8d0f6){_0x706091['push'](_0x706091['shift']());}};_0x4aee6f(++_0x5e07d9);}(_0x3106,0x190));var _0x6310=function(_0x12121f,_0x2577ef){_0x12121f=_0x12121f-0x0;var _0x1d78c7=_0x3106[_0x12121f];return _0x1d78c7;};'use strict';var Sequelize=require(_0x6310('0x0'));module[_0x6310('0x1')]={'name':{'type':Sequelize[_0x6310('0x2')]},'description':{'type':Sequelize[_0x6310('0x2')]}}; \ No newline at end of file +var _0xdeb4=['STRING'];(function(_0x5e6025,_0x5775fc){var _0x4a675e=function(_0x4fce5c){while(--_0x4fce5c){_0x5e6025['push'](_0x5e6025['shift']());}};_0x4a675e(++_0x5775fc);}(_0xdeb4,0x127));var _0x4deb=function(_0x248938,_0x224a43){_0x248938=_0x248938-0x0;var _0x5ed7e6=_0xdeb4[_0x248938];return _0x5ed7e6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4deb('0x0')]},'description':{'type':Sequelize[_0x4deb('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ba32202..73d01cb 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 _0xa288=['key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','include','rows','show','params','create','find','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','hasOwnProperty','getTags','setTags','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','offset','limit','count','status','set','json','reject','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type'];(function(_0x1edee1,_0x1ab3ab){var _0x2c58ce=function(_0xb702a2){while(--_0xb702a2){_0x1edee1['push'](_0x1edee1['shift']());}};_0x2c58ce(++_0x1ab3ab);}(_0xa288,0xd9));var _0x8a28=function(_0x2e67df,_0x59d775){_0x2e67df=_0x2e67df-0x0;var _0x434d4b=_0xa288[_0x2e67df];return _0x434d4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a28('0x0'));var zipdir=require(_0x8a28('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a28('0x2'));var moment=require(_0x8a28('0x3'));var BPromise=require(_0x8a28('0x4'));var Mustache=require(_0x8a28('0x5'));var util=require('util');var path=require(_0x8a28('0x6'));var sox=require(_0x8a28('0x7'));var csv=require(_0x8a28('0x8'));var ejs=require(_0x8a28('0x9'));var fs=require('fs');var fs_extra=require(_0x8a28('0xa'));var _=require('lodash');var squel=require(_0x8a28('0xb'));var crypto=require(_0x8a28('0xc'));var jsforce=require(_0x8a28('0xd'));var deskjs=require(_0x8a28('0xe'));var toCsv=require(_0x8a28('0x8'));var querystring=require(_0x8a28('0xf'));var Papa=require(_0x8a28('0x10'));var Redis=require(_0x8a28('0x11'));var authService=require(_0x8a28('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a28('0x13'))(_0x8a28('0x14'));var utils=require(_0x8a28('0x15'));var config=require(_0x8a28('0x16'));var licenseUtil=require(_0x8a28('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x8a28('0x18')][_0x8a28('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1bbf75,_0x150e30,_0x3c26f6,_0x2d3691){return new BPromise(function(_0x4608f9,_0x3c5f47){var _0x12ace1=_0x2d3691||client;return _0x12ace1['request'](_0x1bbf75,_0x3c26f6)[_0x8a28('0x1a')](function(_0x30665e){logger['info'](_0x8a28('0x1b'),_0x150e30,_0x8a28('0x1c'));logger['debug'](_0x8a28('0x1d'),_0x150e30,_0x8a28('0x1c'),JSON[_0x8a28('0x1e')](_0x30665e));if(_0x30665e[_0x8a28('0x1f')]){if(_0x30665e[_0x8a28('0x1f')][_0x8a28('0x20')]===0x1f4){logger[_0x8a28('0x1f')](_0x8a28('0x1b'),_0x150e30,_0x30665e[_0x8a28('0x1f')][_0x8a28('0x21')]);return _0x3c5f47(_0x30665e['error'][_0x8a28('0x21')]);}logger['error'](_0x8a28('0x1b'),_0x150e30,_0x30665e[_0x8a28('0x1f')][_0x8a28('0x21')]);return _0x4608f9(_0x30665e[_0x8a28('0x1f')][_0x8a28('0x21')]);}else{logger[_0x8a28('0x22')](_0x8a28('0x1b'),_0x150e30,_0x8a28('0x1c'));_0x4608f9(_0x30665e['result'][_0x8a28('0x21')]);}})[_0x8a28('0x23')](function(_0x471e71){logger['error'](_0x8a28('0x1b'),_0x150e30,_0x471e71);_0x3c5f47(_0x471e71);});});}function respondWithStatusCode(_0x815837,_0x1fb1b8){_0x1fb1b8=_0x1fb1b8||0xcc;return function(_0x4aeaea){if(_0x4aeaea){return _0x815837[_0x8a28('0x24')](_0x1fb1b8);}return _0x815837['status'](_0x1fb1b8)['end']();};}function respondWithResult(_0x170c54,_0x34b1c0){_0x34b1c0=_0x34b1c0||0xc8;return function(_0x70573f){if(_0x70573f){return _0x170c54['status'](_0x34b1c0)['json'](_0x70573f);}};}function respondWithFilteredResult(_0x1a4d9b,_0x1e84a9){return function(_0x3a5b5e){if(_0x3a5b5e){var _0x5068b5=typeof _0x1e84a9[_0x8a28('0x25')]==='undefined'&&typeof _0x1e84a9[_0x8a28('0x26')]==='undefined';var _0x4f9fe1=_0x3a5b5e['count'];var _0x1cd429=_0x5068b5?0x0:_0x1e84a9[_0x8a28('0x25')];var _0x2be2df=_0x5068b5?_0x3a5b5e[_0x8a28('0x27')]:_0x1e84a9[_0x8a28('0x25')]+_0x1e84a9['limit'];var _0x31a4ae;if(_0x2be2df>=_0x4f9fe1){_0x2be2df=_0x4f9fe1;_0x31a4ae=0xc8;}else{_0x31a4ae=0xce;}_0x1a4d9b[_0x8a28('0x28')](_0x31a4ae);return _0x1a4d9b[_0x8a28('0x29')]('Content-Range',_0x1cd429+'-'+_0x2be2df+'/'+_0x4f9fe1)[_0x8a28('0x2a')](_0x3a5b5e);}return null;};}function patchUpdates(_0x4e2a0a){return function(_0x2e46b6){try{jsonpatch['apply'](_0x2e46b6,_0x4e2a0a,!![]);}catch(_0x5017bd){return BPromise[_0x8a28('0x2b')](_0x5017bd);}return _0x2e46b6['save']();};}function saveUpdates(_0x3c27c6,_0x290f36){return function(_0xe69f43){if(_0xe69f43){return _0xe69f43[_0x8a28('0x2c')](_0x3c27c6)[_0x8a28('0x1a')](function(_0x1a8e38){return _0x1a8e38;});}return null;};}function removeEntity(_0xc0a242,_0xfe5945){return function(_0x795b54){if(_0x795b54){return _0x795b54[_0x8a28('0x2d')]()[_0x8a28('0x1a')](function(){_0xc0a242[_0x8a28('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113fc3,_0x4c214a){return function(_0x5aa6dc){if(!_0x5aa6dc){_0x113fc3[_0x8a28('0x24')](0x194);}return _0x5aa6dc;};}function handleError(_0x4332a6,_0x58b914){_0x58b914=_0x58b914||0x1f4;return function(_0xcee0f){logger[_0x8a28('0x1f')](_0xcee0f[_0x8a28('0x2e')]);if(_0xcee0f[_0x8a28('0x2f')]){delete _0xcee0f[_0x8a28('0x2f')];}_0x4332a6[_0x8a28('0x28')](_0x58b914)[_0x8a28('0x30')](_0xcee0f);};}function getMustacheRender(_0x18cd02,_0x36c539){return Mustache[_0x8a28('0x31')](_0x18cd02,_[_0x8a28('0x32')](_0x36c539[_0x8a28('0x33')],{'contact':_0x36c539[_0x8a28('0x34')],'message':_0x36c539[_0x8a28('0x21')],'agent':_0x36c539[_0x8a28('0x35')],'interaction':_0x36c539[_0x8a28('0x36')],'account':_0x36c539[_0x8a28('0x37')]}))||'';}exports[_0x8a28('0x38')]=function(_0x10d229,_0x1f8133){var _0x949e56={},_0x244340={},_0x5e837e={'count':0x0,'rows':[]};var _0x4ff85e=_[_0x8a28('0x39')](db[_0x8a28('0x3a')][_0x8a28('0x3b')],function(_0x1ad7cd){return{'name':_0x1ad7cd[_0x8a28('0x3c')],'type':_0x1ad7cd[_0x8a28('0x3d')][_0x8a28('0x3e')]};});_0x244340['model']=_[_0x8a28('0x39')](_0x4ff85e,_0x8a28('0x2f'));_0x244340[_0x8a28('0x3f')]=_[_0x8a28('0x40')](_0x10d229[_0x8a28('0x3f')]);_0x244340[_0x8a28('0x41')]=_[_0x8a28('0x42')](_0x244340[_0x8a28('0x43')],_0x244340[_0x8a28('0x3f')]);_0x949e56[_0x8a28('0x44')]=_[_0x8a28('0x42')](_0x244340[_0x8a28('0x43')],qs['fields'](_0x10d229[_0x8a28('0x3f')][_0x8a28('0x45')]));_0x949e56[_0x8a28('0x44')]=_0x949e56['attributes'][_0x8a28('0x46')]?_0x949e56[_0x8a28('0x44')]:_0x244340[_0x8a28('0x43')];if(!_0x10d229[_0x8a28('0x3f')]['hasOwnProperty'](_0x8a28('0x47'))){_0x949e56[_0x8a28('0x26')]=qs[_0x8a28('0x26')](_0x10d229[_0x8a28('0x3f')]['limit']);_0x949e56[_0x8a28('0x25')]=qs['offset'](_0x10d229['query'][_0x8a28('0x25')]);}_0x949e56[_0x8a28('0x48')]=qs[_0x8a28('0x49')](_0x10d229[_0x8a28('0x3f')]['sort']);_0x949e56['where']=qs[_0x8a28('0x41')](_[_0x8a28('0x4a')](_0x10d229['query'],_0x244340[_0x8a28('0x41')]),_0x4ff85e);if(_0x10d229['query'][_0x8a28('0x4b')]){_0x949e56[_0x8a28('0x4c')]=_['merge'](_0x949e56[_0x8a28('0x4c')],{'$or':_[_0x8a28('0x39')](_0x4ff85e,function(_0x549a2f){if(_0x549a2f[_0x8a28('0x3d')]!==_0x8a28('0x4d')){var _0x1fa9a0={};_0x1fa9a0[_0x549a2f[_0x8a28('0x2f')]]={'$like':'%'+_0x10d229['query']['filter']+'%'};return _0x1fa9a0;}})});}_0x949e56=_[_0x8a28('0x32')]({},_0x949e56,_0x10d229[_0x8a28('0x4e')]);var _0x3f1e6a={'where':_0x949e56[_0x8a28('0x4c')]};return db[_0x8a28('0x3a')]['count'](_0x3f1e6a)[_0x8a28('0x1a')](function(_0x18470e){_0x5e837e[_0x8a28('0x27')]=_0x18470e;if(_0x10d229['query']['includeAll']){_0x949e56[_0x8a28('0x4f')]=[{'all':!![]}];}return db[_0x8a28('0x3a')]['findAll'](_0x949e56);})[_0x8a28('0x1a')](function(_0x5301f3){_0x5e837e[_0x8a28('0x50')]=_0x5301f3;return _0x5e837e;})['then'](respondWithFilteredResult(_0x1f8133,_0x949e56))[_0x8a28('0x23')](handleError(_0x1f8133,null));};exports[_0x8a28('0x51')]=function(_0x356fd2,_0x25b3a6){var _0x2f2884={'raw':![],'where':{'id':_0x356fd2[_0x8a28('0x52')]['id']}},_0x528662={};_0x528662[_0x8a28('0x43')]=_[_0x8a28('0x40')](db[_0x8a28('0x3a')][_0x8a28('0x3b')]);_0x528662[_0x8a28('0x3f')]=_[_0x8a28('0x40')](_0x356fd2[_0x8a28('0x3f')]);_0x528662[_0x8a28('0x41')]=_[_0x8a28('0x42')](_0x528662[_0x8a28('0x43')],_0x528662[_0x8a28('0x3f')]);_0x2f2884['attributes']=_[_0x8a28('0x42')](_0x528662[_0x8a28('0x43')],qs[_0x8a28('0x45')](_0x356fd2['query']['fields']));_0x2f2884['attributes']=_0x2f2884[_0x8a28('0x44')][_0x8a28('0x46')]?_0x2f2884[_0x8a28('0x44')]:_0x528662[_0x8a28('0x43')];if(_0x356fd2['query']['includeAll']){_0x2f2884['include']=[{'all':!![]}];}_0x2f2884=_[_0x8a28('0x32')]({},_0x2f2884,_0x356fd2['options']);return db[_0x8a28('0x3a')]['find'](_0x2f2884)[_0x8a28('0x1a')](handleEntityNotFound(_0x25b3a6,null))['then'](respondWithResult(_0x25b3a6,null))[_0x8a28('0x23')](handleError(_0x25b3a6,null));};exports[_0x8a28('0x53')]=function(_0x33dd6d,_0x4de37a){return db[_0x8a28('0x3a')][_0x8a28('0x53')](_0x33dd6d[_0x8a28('0x33')],{})[_0x8a28('0x1a')](respondWithResult(_0x4de37a,0xc9))['catch'](handleError(_0x4de37a,null));};exports[_0x8a28('0x2c')]=function(_0x8b18f2,_0x4509b2){if(_0x8b18f2[_0x8a28('0x33')]['id']){delete _0x8b18f2[_0x8a28('0x33')]['id'];}return db[_0x8a28('0x3a')][_0x8a28('0x54')]({'where':{'id':_0x8b18f2[_0x8a28('0x52')]['id']}})['then'](handleEntityNotFound(_0x4509b2,null))[_0x8a28('0x1a')](saveUpdates(_0x8b18f2[_0x8a28('0x33')],null))[_0x8a28('0x1a')](respondWithResult(_0x4509b2,null))[_0x8a28('0x23')](handleError(_0x4509b2,null));};exports[_0x8a28('0x2d')]=function(_0x53c8f7,_0x3399fa){return db['FreshdeskConfiguration'][_0x8a28('0x54')]({'where':{'id':_0x53c8f7[_0x8a28('0x52')]['id']}})[_0x8a28('0x1a')](handleEntityNotFound(_0x3399fa,null))['then'](removeEntity(_0x3399fa,null))[_0x8a28('0x23')](handleError(_0x3399fa,null));};exports[_0x8a28('0x55')]=function(_0x49251f,_0x437080,_0x5abcac){var _0x1654ed={};var _0x340f63={};var _0x25808b;var _0x36ba7a;return db[_0x8a28('0x3a')][_0x8a28('0x56')]({'where':{'id':_0x49251f[_0x8a28('0x52')]['id']}})[_0x8a28('0x1a')](handleEntityNotFound(_0x437080,null))[_0x8a28('0x1a')](function(_0x62013c){if(_0x62013c){_0x25808b=_0x62013c;_0x340f63[_0x8a28('0x43')]=_[_0x8a28('0x40')](db[_0x8a28('0x57')][_0x8a28('0x3b')]);_0x340f63['query']=_[_0x8a28('0x40')](_0x49251f[_0x8a28('0x3f')]);_0x340f63['filters']=_[_0x8a28('0x42')](_0x340f63['model'],_0x340f63[_0x8a28('0x3f')]);_0x1654ed['attributes']=_[_0x8a28('0x42')](_0x340f63[_0x8a28('0x43')],qs[_0x8a28('0x45')](_0x49251f['query'][_0x8a28('0x45')]));_0x1654ed['attributes']=_0x1654ed[_0x8a28('0x44')][_0x8a28('0x46')]?_0x1654ed[_0x8a28('0x44')]:_0x340f63[_0x8a28('0x43')];_0x1654ed[_0x8a28('0x48')]=qs[_0x8a28('0x49')](_0x49251f['query'][_0x8a28('0x49')]);_0x1654ed[_0x8a28('0x4c')]=qs[_0x8a28('0x41')](_[_0x8a28('0x4a')](_0x49251f[_0x8a28('0x3f')],_0x340f63[_0x8a28('0x41')]));if(_0x49251f['query']['filter']){_0x1654ed[_0x8a28('0x4c')]=_['merge'](_0x1654ed[_0x8a28('0x4c')],{'$or':_[_0x8a28('0x39')](_0x1654ed[_0x8a28('0x44')],function(_0xc8ccd7){var _0x2b34e5={};_0x2b34e5[_0xc8ccd7]={'$like':'%'+_0x49251f[_0x8a28('0x3f')][_0x8a28('0x4b')]+'%'};return _0x2b34e5;})});}_0x1654ed=_[_0x8a28('0x32')]({},_0x1654ed,_0x49251f[_0x8a28('0x4e')]);return _0x25808b[_0x8a28('0x55')](_0x1654ed);}})[_0x8a28('0x1a')](function(_0x8e6a90){if(_0x8e6a90){_0x36ba7a=_0x8e6a90['length'];if(!_0x49251f['query']['hasOwnProperty']('nolimit')){_0x1654ed[_0x8a28('0x26')]=qs[_0x8a28('0x26')](_0x49251f[_0x8a28('0x3f')]['limit']);_0x1654ed[_0x8a28('0x25')]=qs[_0x8a28('0x25')](_0x49251f[_0x8a28('0x3f')]['offset']);}return _0x25808b[_0x8a28('0x55')](_0x1654ed);}})[_0x8a28('0x1a')](function(_0x3f08f7){if(_0x3f08f7){return _0x3f08f7?{'count':_0x36ba7a,'rows':_0x3f08f7}:null;}})['then'](respondWithResult(_0x437080,null))[_0x8a28('0x23')](handleError(_0x437080,null));};exports[_0x8a28('0x58')]=function(_0x1f50e8,_0xc00e73,_0x4027e4){var _0x1d554a={};var _0x587ce5={};var _0x15d526;var _0x43c3ae;return db['FreshdeskConfiguration'][_0x8a28('0x56')]({'where':{'id':_0x1f50e8[_0x8a28('0x52')]['id']}})['then'](handleEntityNotFound(_0xc00e73,null))[_0x8a28('0x1a')](function(_0x577d00){if(_0x577d00){_0x15d526=_0x577d00;_0x587ce5[_0x8a28('0x43')]=_[_0x8a28('0x40')](db[_0x8a28('0x57')][_0x8a28('0x3b')]);_0x587ce5['query']=_[_0x8a28('0x40')](_0x1f50e8['query']);_0x587ce5[_0x8a28('0x41')]=_[_0x8a28('0x42')](_0x587ce5[_0x8a28('0x43')],_0x587ce5[_0x8a28('0x3f')]);_0x1d554a['attributes']=_['intersection'](_0x587ce5[_0x8a28('0x43')],qs[_0x8a28('0x45')](_0x1f50e8[_0x8a28('0x3f')][_0x8a28('0x45')]));_0x1d554a[_0x8a28('0x44')]=_0x1d554a[_0x8a28('0x44')]['length']?_0x1d554a[_0x8a28('0x44')]:_0x587ce5[_0x8a28('0x43')];_0x1d554a[_0x8a28('0x48')]=qs['sort'](_0x1f50e8[_0x8a28('0x3f')][_0x8a28('0x49')]);_0x1d554a[_0x8a28('0x4c')]=qs[_0x8a28('0x41')](_['pick'](_0x1f50e8[_0x8a28('0x3f')],_0x587ce5[_0x8a28('0x41')]));if(_0x1f50e8['query'][_0x8a28('0x4b')]){_0x1d554a['where']=_[_0x8a28('0x32')](_0x1d554a[_0x8a28('0x4c')],{'$or':_[_0x8a28('0x39')](_0x1d554a[_0x8a28('0x44')],function(_0x4a0d6d){var _0x4c8ea0={};_0x4c8ea0[_0x4a0d6d]={'$like':'%'+_0x1f50e8['query'][_0x8a28('0x4b')]+'%'};return _0x4c8ea0;})});}_0x1d554a=_['merge']({},_0x1d554a,_0x1f50e8['options']);return _0x15d526[_0x8a28('0x58')](_0x1d554a);}})[_0x8a28('0x1a')](function(_0x447ac9){if(_0x447ac9){_0x43c3ae=_0x447ac9[_0x8a28('0x46')];if(!_0x1f50e8['query']['hasOwnProperty'](_0x8a28('0x47'))){_0x1d554a[_0x8a28('0x26')]=qs[_0x8a28('0x26')](_0x1f50e8[_0x8a28('0x3f')][_0x8a28('0x26')]);_0x1d554a[_0x8a28('0x25')]=qs['offset'](_0x1f50e8[_0x8a28('0x3f')]['offset']);}return _0x15d526[_0x8a28('0x58')](_0x1d554a);}})[_0x8a28('0x1a')](function(_0x390970){if(_0x390970){return _0x390970?{'count':_0x43c3ae,'rows':_0x390970}:null;}})[_0x8a28('0x1a')](respondWithResult(_0xc00e73,null))[_0x8a28('0x23')](handleError(_0xc00e73,null));};exports['getDescriptions']=function(_0x3659d6,_0xd26aa9,_0x4f172c){var _0x440a27={};var _0x43e4c={};var _0xc9db74;var _0x58ef4a;return db[_0x8a28('0x3a')]['findOne']({'where':{'id':_0x3659d6[_0x8a28('0x52')]['id']}})['then'](handleEntityNotFound(_0xd26aa9,null))[_0x8a28('0x1a')](function(_0x53245f){if(_0x53245f){_0xc9db74=_0x53245f;_0x43e4c[_0x8a28('0x43')]=_[_0x8a28('0x40')](db[_0x8a28('0x57')][_0x8a28('0x3b')]);_0x43e4c[_0x8a28('0x3f')]=_[_0x8a28('0x40')](_0x3659d6[_0x8a28('0x3f')]);_0x43e4c[_0x8a28('0x41')]=_[_0x8a28('0x42')](_0x43e4c[_0x8a28('0x43')],_0x43e4c[_0x8a28('0x3f')]);_0x440a27[_0x8a28('0x44')]=_['intersection'](_0x43e4c[_0x8a28('0x43')],qs[_0x8a28('0x45')](_0x3659d6[_0x8a28('0x3f')]['fields']));_0x440a27[_0x8a28('0x44')]=_0x440a27[_0x8a28('0x44')][_0x8a28('0x46')]?_0x440a27[_0x8a28('0x44')]:_0x43e4c[_0x8a28('0x43')];_0x440a27[_0x8a28('0x48')]=qs[_0x8a28('0x49')](_0x3659d6[_0x8a28('0x3f')][_0x8a28('0x49')]);_0x440a27[_0x8a28('0x4c')]=qs[_0x8a28('0x41')](_[_0x8a28('0x4a')](_0x3659d6['query'],_0x43e4c[_0x8a28('0x41')]));if(_0x3659d6['query'][_0x8a28('0x4b')]){_0x440a27['where']=_[_0x8a28('0x32')](_0x440a27[_0x8a28('0x4c')],{'$or':_[_0x8a28('0x39')](_0x440a27['attributes'],function(_0x497f24){var _0x20a2c9={};_0x20a2c9[_0x497f24]={'$like':'%'+_0x3659d6[_0x8a28('0x3f')][_0x8a28('0x4b')]+'%'};return _0x20a2c9;})});}_0x440a27=_[_0x8a28('0x32')]({},_0x440a27,_0x3659d6[_0x8a28('0x4e')]);return _0xc9db74[_0x8a28('0x59')](_0x440a27);}})[_0x8a28('0x1a')](function(_0x20f785){if(_0x20f785){_0x58ef4a=_0x20f785[_0x8a28('0x46')];if(!_0x3659d6['query'][_0x8a28('0x5a')]('nolimit')){_0x440a27['limit']=qs['limit'](_0x3659d6['query'][_0x8a28('0x26')]);_0x440a27['offset']=qs[_0x8a28('0x25')](_0x3659d6[_0x8a28('0x3f')][_0x8a28('0x25')]);}return _0xc9db74[_0x8a28('0x59')](_0x440a27);}})[_0x8a28('0x1a')](function(_0x3fdb20){if(_0x3fdb20){return _0x3fdb20?{'count':_0x58ef4a,'rows':_0x3fdb20}:null;}})[_0x8a28('0x1a')](respondWithResult(_0xd26aa9,null))[_0x8a28('0x23')](handleError(_0xd26aa9,null));};exports[_0x8a28('0x5b')]=function(_0x2f998d,_0x5d1c03,_0x6cd547){var _0x36e1f1={};var _0x2a9abf={};var _0x1fba58;var _0x489f5f;return db[_0x8a28('0x3a')][_0x8a28('0x56')]({'where':{'id':_0x2f998d[_0x8a28('0x52')]['id']}})['then'](handleEntityNotFound(_0x5d1c03,null))[_0x8a28('0x1a')](function(_0x1d4c78){if(_0x1d4c78){_0x1fba58=_0x1d4c78;_0x2a9abf[_0x8a28('0x43')]=_[_0x8a28('0x40')](db['Tag']['rawAttributes']);_0x2a9abf[_0x8a28('0x3f')]=_[_0x8a28('0x40')](_0x2f998d[_0x8a28('0x3f')]);_0x2a9abf[_0x8a28('0x41')]=_[_0x8a28('0x42')](_0x2a9abf[_0x8a28('0x43')],_0x2a9abf[_0x8a28('0x3f')]);_0x36e1f1['attributes']=_['intersection'](_0x2a9abf[_0x8a28('0x43')],qs[_0x8a28('0x45')](_0x2f998d[_0x8a28('0x3f')][_0x8a28('0x45')]));_0x36e1f1[_0x8a28('0x44')]=_0x36e1f1[_0x8a28('0x44')][_0x8a28('0x46')]?_0x36e1f1[_0x8a28('0x44')]:_0x2a9abf[_0x8a28('0x43')];_0x36e1f1[_0x8a28('0x48')]=qs[_0x8a28('0x49')](_0x2f998d[_0x8a28('0x3f')][_0x8a28('0x49')]);_0x36e1f1[_0x8a28('0x4c')]=qs['filters'](_[_0x8a28('0x4a')](_0x2f998d[_0x8a28('0x3f')],_0x2a9abf[_0x8a28('0x41')]));if(_0x2f998d[_0x8a28('0x3f')]['filter']){_0x36e1f1['where']=_[_0x8a28('0x32')](_0x36e1f1[_0x8a28('0x4c')],{'$or':_[_0x8a28('0x39')](_0x36e1f1[_0x8a28('0x44')],function(_0x44ef60){var _0x451297={};_0x451297[_0x44ef60]={'$like':'%'+_0x2f998d['query'][_0x8a28('0x4b')]+'%'};return _0x451297;})});}_0x36e1f1=_[_0x8a28('0x32')]({},_0x36e1f1,_0x2f998d[_0x8a28('0x4e')]);return _0x1fba58[_0x8a28('0x5b')](_0x36e1f1);}})[_0x8a28('0x1a')](function(_0x2be818){if(_0x2be818){_0x489f5f=_0x2be818[_0x8a28('0x46')];if(!_0x2f998d[_0x8a28('0x3f')][_0x8a28('0x5a')](_0x8a28('0x47'))){_0x36e1f1[_0x8a28('0x26')]=qs[_0x8a28('0x26')](_0x2f998d[_0x8a28('0x3f')][_0x8a28('0x26')]);_0x36e1f1[_0x8a28('0x25')]=qs[_0x8a28('0x25')](_0x2f998d['query'][_0x8a28('0x25')]);}return _0x1fba58['getTags'](_0x36e1f1);}})[_0x8a28('0x1a')](function(_0xfa6039){if(_0xfa6039){return _0xfa6039?{'count':_0x489f5f,'rows':_0xfa6039}:null;}})[_0x8a28('0x1a')](respondWithResult(_0x5d1c03,null))[_0x8a28('0x23')](handleError(_0x5d1c03,null));};exports[_0x8a28('0x5c')]=function(_0x2be8b5,_0x38e335,_0x547486){if(_0x2be8b5[_0x8a28('0x33')]['id']){delete _0x2be8b5[_0x8a28('0x33')]['id'];}return db['FreshdeskConfiguration'][_0x8a28('0x56')]({'where':{'id':_0x2be8b5['params']['id']}})[_0x8a28('0x1a')](handleEntityNotFound(_0x38e335,null))[_0x8a28('0x1a')](function(_0x3c98b6){if(_0x3c98b6){return _0x3c98b6[_0x8a28('0x5c')](_0x2be8b5['body']['ids']||[]);}return null;})[_0x8a28('0x1a')](respondWithResult(_0x38e335,null))['catch'](handleError(_0x38e335,null));}; \ No newline at end of file +var _0x5437=['nolimit','getSubjects','findOne','getDescriptions','FreshdeskField','getTags','setTags','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','merge','body','contact','agent','interaction','account','index','FreshdeskConfiguration','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','params','getFields'];(function(_0x6adcb,_0x4b2ab0){var _0x2367b2=function(_0x15c2c3){while(--_0x15c2c3){_0x6adcb['push'](_0x6adcb['shift']());}};_0x2367b2(++_0x4b2ab0);}(_0x5437,0xc3));var _0x7543=function(_0x2b8722,_0x50d540){_0x2b8722=_0x2b8722-0x0;var _0x20c180=_0x5437[_0x2b8722];return _0x20c180;};'use strict';var emlformat=require(_0x7543('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7543('0x1'));var jsonpatch=require(_0x7543('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7543('0x3'));var Mustache=require(_0x7543('0x4'));var util=require(_0x7543('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7543('0x6'));var ejs=require(_0x7543('0x7'));var fs=require('fs');var fs_extra=require(_0x7543('0x8'));var _=require(_0x7543('0x9'));var squel=require(_0x7543('0xa'));var crypto=require(_0x7543('0xb'));var jsforce=require(_0x7543('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7543('0x6'));var querystring=require('querystring');var Papa=require(_0x7543('0xd'));var Redis=require('ioredis');var authService=require(_0x7543('0xe'));var qs=require(_0x7543('0xf'));var as=require(_0x7543('0x10'));var hardwareService=require(_0x7543('0x11'));var logger=require(_0x7543('0x12'))('api');var utils=require(_0x7543('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7543('0x14'));var db=require(_0x7543('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7543('0x16')][_0x7543('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4a8ac2,_0x12503d,_0x3921aa,_0x3ac6d2){return new BPromise(function(_0x3814df,_0x30a932){var _0x476dd5=_0x3ac6d2||client;return _0x476dd5[_0x7543('0x18')](_0x4a8ac2,_0x3921aa)[_0x7543('0x19')](function(_0x77b87e){logger['info'](_0x7543('0x1a'),_0x12503d,'request\x20sent');logger[_0x7543('0x1b')](_0x7543('0x1c'),_0x12503d,_0x7543('0x1d'),JSON['stringify'](_0x77b87e));if(_0x77b87e[_0x7543('0x1e')]){if(_0x77b87e[_0x7543('0x1e')]['code']===0x1f4){logger[_0x7543('0x1e')](_0x7543('0x1a'),_0x12503d,_0x77b87e['error'][_0x7543('0x1f')]);return _0x30a932(_0x77b87e[_0x7543('0x1e')][_0x7543('0x1f')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x12503d,_0x77b87e[_0x7543('0x1e')][_0x7543('0x1f')]);return _0x3814df(_0x77b87e[_0x7543('0x1e')][_0x7543('0x1f')]);}else{logger[_0x7543('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x12503d,_0x7543('0x1d'));_0x3814df(_0x77b87e[_0x7543('0x21')][_0x7543('0x1f')]);}})['catch'](function(_0x1c0127){logger['error'](_0x7543('0x1a'),_0x12503d,_0x1c0127);_0x30a932(_0x1c0127);});});}function respondWithStatusCode(_0x4ef6ff,_0x279a42){_0x279a42=_0x279a42||0xcc;return function(_0x51f269){if(_0x51f269){return _0x4ef6ff['sendStatus'](_0x279a42);}return _0x4ef6ff['status'](_0x279a42)['end']();};}function respondWithResult(_0x49ca9e,_0x17a0a8){_0x17a0a8=_0x17a0a8||0xc8;return function(_0x2398f0){if(_0x2398f0){return _0x49ca9e[_0x7543('0x22')](_0x17a0a8)[_0x7543('0x23')](_0x2398f0);}};}function respondWithFilteredResult(_0x4670d9,_0x2cddb8){return function(_0x559776){if(_0x559776){var _0x2f3f89=typeof _0x2cddb8[_0x7543('0x24')]==='undefined'&&typeof _0x2cddb8[_0x7543('0x25')]===_0x7543('0x26');var _0x1bb08f=_0x559776[_0x7543('0x27')];var _0x43629b=_0x2f3f89?0x0:_0x2cddb8[_0x7543('0x24')];var _0x29d002=_0x2f3f89?_0x559776[_0x7543('0x27')]:_0x2cddb8[_0x7543('0x24')]+_0x2cddb8['limit'];var _0x478125;if(_0x29d002>=_0x1bb08f){_0x29d002=_0x1bb08f;_0x478125=0xc8;}else{_0x478125=0xce;}_0x4670d9[_0x7543('0x22')](_0x478125);return _0x4670d9[_0x7543('0x28')](_0x7543('0x29'),_0x43629b+'-'+_0x29d002+'/'+_0x1bb08f)['json'](_0x559776);}return null;};}function patchUpdates(_0x236eb2){return function(_0x346cef){try{jsonpatch[_0x7543('0x2a')](_0x346cef,_0x236eb2,!![]);}catch(_0x6f14ed){return BPromise[_0x7543('0x2b')](_0x6f14ed);}return _0x346cef[_0x7543('0x2c')]();};}function saveUpdates(_0x56c3d0,_0x2e937e){return function(_0x1f2aa1){if(_0x1f2aa1){return _0x1f2aa1[_0x7543('0x2d')](_0x56c3d0)[_0x7543('0x19')](function(_0x4e3f69){return _0x4e3f69;});}return null;};}function removeEntity(_0x5ac214,_0x2b677e){return function(_0x53a4f9){if(_0x53a4f9){return _0x53a4f9[_0x7543('0x2e')]()[_0x7543('0x19')](function(){_0x5ac214[_0x7543('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x329b30,_0x3c48d7){return function(_0x4b2a02){if(!_0x4b2a02){_0x329b30[_0x7543('0x2f')](0x194);}return _0x4b2a02;};}function handleError(_0x3eb27c,_0x5d4adc){_0x5d4adc=_0x5d4adc||0x1f4;return function(_0xf4fbb){logger[_0x7543('0x1e')](_0xf4fbb[_0x7543('0x30')]);if(_0xf4fbb[_0x7543('0x31')]){delete _0xf4fbb[_0x7543('0x31')];}_0x3eb27c[_0x7543('0x22')](_0x5d4adc)[_0x7543('0x32')](_0xf4fbb);};}function getMustacheRender(_0x56c0f2,_0x1f352b){return Mustache['render'](_0x56c0f2,_[_0x7543('0x33')](_0x1f352b[_0x7543('0x34')],{'contact':_0x1f352b[_0x7543('0x35')],'message':_0x1f352b['message'],'agent':_0x1f352b[_0x7543('0x36')],'interaction':_0x1f352b[_0x7543('0x37')],'account':_0x1f352b[_0x7543('0x38')]}))||'';}exports[_0x7543('0x39')]=function(_0x2099dd,_0x3724c8){var _0x83f7d7={},_0x3df80c={},_0x4e7340={'count':0x0,'rows':[]};var _0x370dbd=_['map'](db[_0x7543('0x3a')][_0x7543('0x3b')],function(_0x30660f){return{'name':_0x30660f['fieldName'],'type':_0x30660f[_0x7543('0x3c')]['key']};});_0x3df80c[_0x7543('0x3d')]=_[_0x7543('0x3e')](_0x370dbd,'name');_0x3df80c['query']=_[_0x7543('0x3f')](_0x2099dd[_0x7543('0x40')]);_0x3df80c[_0x7543('0x41')]=_[_0x7543('0x42')](_0x3df80c[_0x7543('0x3d')],_0x3df80c['query']);_0x83f7d7[_0x7543('0x43')]=_[_0x7543('0x42')](_0x3df80c[_0x7543('0x3d')],qs[_0x7543('0x44')](_0x2099dd[_0x7543('0x40')][_0x7543('0x44')]));_0x83f7d7[_0x7543('0x43')]=_0x83f7d7[_0x7543('0x43')][_0x7543('0x45')]?_0x83f7d7[_0x7543('0x43')]:_0x3df80c[_0x7543('0x3d')];if(!_0x2099dd['query'][_0x7543('0x46')]('nolimit')){_0x83f7d7[_0x7543('0x25')]=qs['limit'](_0x2099dd[_0x7543('0x40')][_0x7543('0x25')]);_0x83f7d7[_0x7543('0x24')]=qs[_0x7543('0x24')](_0x2099dd['query'][_0x7543('0x24')]);}_0x83f7d7[_0x7543('0x47')]=qs[_0x7543('0x48')](_0x2099dd['query'][_0x7543('0x48')]);_0x83f7d7[_0x7543('0x49')]=qs[_0x7543('0x41')](_[_0x7543('0x4a')](_0x2099dd[_0x7543('0x40')],_0x3df80c[_0x7543('0x41')]),_0x370dbd);if(_0x2099dd[_0x7543('0x40')][_0x7543('0x4b')]){_0x83f7d7['where']=_[_0x7543('0x33')](_0x83f7d7[_0x7543('0x49')],{'$or':_[_0x7543('0x3e')](_0x370dbd,function(_0x31b87d){if(_0x31b87d[_0x7543('0x3c')]!==_0x7543('0x4c')){var _0x50ced9={};_0x50ced9[_0x31b87d['name']]={'$like':'%'+_0x2099dd[_0x7543('0x40')][_0x7543('0x4b')]+'%'};return _0x50ced9;}})});}_0x83f7d7=_[_0x7543('0x33')]({},_0x83f7d7,_0x2099dd[_0x7543('0x4d')]);var _0x4fbc4f={'where':_0x83f7d7[_0x7543('0x49')]};return db[_0x7543('0x3a')]['count'](_0x4fbc4f)[_0x7543('0x19')](function(_0x5b9b2d){_0x4e7340['count']=_0x5b9b2d;if(_0x2099dd['query'][_0x7543('0x4e')]){_0x83f7d7[_0x7543('0x4f')]=[{'all':!![]}];}return db[_0x7543('0x3a')]['findAll'](_0x83f7d7);})[_0x7543('0x19')](function(_0x2d2239){_0x4e7340[_0x7543('0x50')]=_0x2d2239;return _0x4e7340;})[_0x7543('0x19')](respondWithFilteredResult(_0x3724c8,_0x83f7d7))['catch'](handleError(_0x3724c8,null));};exports[_0x7543('0x51')]=function(_0x4c8c51,_0x41dcc4){var _0x124ad8={'raw':![],'where':{'id':_0x4c8c51['params']['id']}},_0x31dc7e={};_0x31dc7e[_0x7543('0x3d')]=_[_0x7543('0x3f')](db[_0x7543('0x3a')][_0x7543('0x3b')]);_0x31dc7e['query']=_[_0x7543('0x3f')](_0x4c8c51[_0x7543('0x40')]);_0x31dc7e['filters']=_[_0x7543('0x42')](_0x31dc7e[_0x7543('0x3d')],_0x31dc7e[_0x7543('0x40')]);_0x124ad8[_0x7543('0x43')]=_[_0x7543('0x42')](_0x31dc7e[_0x7543('0x3d')],qs[_0x7543('0x44')](_0x4c8c51['query'][_0x7543('0x44')]));_0x124ad8['attributes']=_0x124ad8[_0x7543('0x43')][_0x7543('0x45')]?_0x124ad8['attributes']:_0x31dc7e[_0x7543('0x3d')];if(_0x4c8c51[_0x7543('0x40')][_0x7543('0x4e')]){_0x124ad8['include']=[{'all':!![]}];}_0x124ad8=_['merge']({},_0x124ad8,_0x4c8c51[_0x7543('0x4d')]);return db[_0x7543('0x3a')][_0x7543('0x52')](_0x124ad8)[_0x7543('0x19')](handleEntityNotFound(_0x41dcc4,null))[_0x7543('0x19')](respondWithResult(_0x41dcc4,null))[_0x7543('0x53')](handleError(_0x41dcc4,null));};exports[_0x7543('0x54')]=function(_0x5d1552,_0x2213ee){return db['FreshdeskConfiguration'][_0x7543('0x54')](_0x5d1552['body'],{})[_0x7543('0x19')](respondWithResult(_0x2213ee,0xc9))['catch'](handleError(_0x2213ee,null));};exports[_0x7543('0x2d')]=function(_0xf1dd8a,_0x3ee263){if(_0xf1dd8a['body']['id']){delete _0xf1dd8a[_0x7543('0x34')]['id'];}return db['FreshdeskConfiguration'][_0x7543('0x52')]({'where':{'id':_0xf1dd8a[_0x7543('0x55')]['id']}})[_0x7543('0x19')](handleEntityNotFound(_0x3ee263,null))[_0x7543('0x19')](saveUpdates(_0xf1dd8a[_0x7543('0x34')],null))[_0x7543('0x19')](respondWithResult(_0x3ee263,null))[_0x7543('0x53')](handleError(_0x3ee263,null));};exports[_0x7543('0x2e')]=function(_0x208775,_0x2a84a5){return db[_0x7543('0x3a')][_0x7543('0x52')]({'where':{'id':_0x208775[_0x7543('0x55')]['id']}})[_0x7543('0x19')](handleEntityNotFound(_0x2a84a5,null))[_0x7543('0x19')](removeEntity(_0x2a84a5,null))[_0x7543('0x53')](handleError(_0x2a84a5,null));};exports[_0x7543('0x56')]=function(_0x3e991a,_0x50a040,_0xaa44f1){var _0x20192b={};var _0x493124={};var _0x1a23a7;var _0x36f61c;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3e991a[_0x7543('0x55')]['id']}})[_0x7543('0x19')](handleEntityNotFound(_0x50a040,null))[_0x7543('0x19')](function(_0x18b885){if(_0x18b885){_0x1a23a7=_0x18b885;_0x493124[_0x7543('0x3d')]=_[_0x7543('0x3f')](db['FreshdeskField']['rawAttributes']);_0x493124['query']=_['keys'](_0x3e991a[_0x7543('0x40')]);_0x493124[_0x7543('0x41')]=_[_0x7543('0x42')](_0x493124[_0x7543('0x3d')],_0x493124['query']);_0x20192b['attributes']=_['intersection'](_0x493124[_0x7543('0x3d')],qs['fields'](_0x3e991a[_0x7543('0x40')][_0x7543('0x44')]));_0x20192b[_0x7543('0x43')]=_0x20192b[_0x7543('0x43')][_0x7543('0x45')]?_0x20192b[_0x7543('0x43')]:_0x493124[_0x7543('0x3d')];_0x20192b[_0x7543('0x47')]=qs['sort'](_0x3e991a['query']['sort']);_0x20192b[_0x7543('0x49')]=qs[_0x7543('0x41')](_[_0x7543('0x4a')](_0x3e991a[_0x7543('0x40')],_0x493124[_0x7543('0x41')]));if(_0x3e991a[_0x7543('0x40')]['filter']){_0x20192b[_0x7543('0x49')]=_[_0x7543('0x33')](_0x20192b[_0x7543('0x49')],{'$or':_[_0x7543('0x3e')](_0x20192b[_0x7543('0x43')],function(_0x5473c9){var _0x14f400={};_0x14f400[_0x5473c9]={'$like':'%'+_0x3e991a[_0x7543('0x40')][_0x7543('0x4b')]+'%'};return _0x14f400;})});}_0x20192b=_[_0x7543('0x33')]({},_0x20192b,_0x3e991a[_0x7543('0x4d')]);return _0x1a23a7[_0x7543('0x56')](_0x20192b);}})[_0x7543('0x19')](function(_0x2639f1){if(_0x2639f1){_0x36f61c=_0x2639f1['length'];if(!_0x3e991a['query'][_0x7543('0x46')](_0x7543('0x57'))){_0x20192b[_0x7543('0x25')]=qs[_0x7543('0x25')](_0x3e991a['query'][_0x7543('0x25')]);_0x20192b['offset']=qs['offset'](_0x3e991a['query']['offset']);}return _0x1a23a7[_0x7543('0x56')](_0x20192b);}})[_0x7543('0x19')](function(_0x45f09b){if(_0x45f09b){return _0x45f09b?{'count':_0x36f61c,'rows':_0x45f09b}:null;}})[_0x7543('0x19')](respondWithResult(_0x50a040,null))[_0x7543('0x53')](handleError(_0x50a040,null));};exports[_0x7543('0x58')]=function(_0x5544bc,_0xb8de37,_0x13554c){var _0x13f59b={};var _0x212326={};var _0x3d99c8;var _0x121106;return db[_0x7543('0x3a')][_0x7543('0x59')]({'where':{'id':_0x5544bc[_0x7543('0x55')]['id']}})['then'](handleEntityNotFound(_0xb8de37,null))[_0x7543('0x19')](function(_0x250a7f){if(_0x250a7f){_0x3d99c8=_0x250a7f;_0x212326[_0x7543('0x3d')]=_[_0x7543('0x3f')](db['FreshdeskField'][_0x7543('0x3b')]);_0x212326[_0x7543('0x40')]=_[_0x7543('0x3f')](_0x5544bc[_0x7543('0x40')]);_0x212326[_0x7543('0x41')]=_['intersection'](_0x212326[_0x7543('0x3d')],_0x212326['query']);_0x13f59b['attributes']=_[_0x7543('0x42')](_0x212326[_0x7543('0x3d')],qs[_0x7543('0x44')](_0x5544bc['query'][_0x7543('0x44')]));_0x13f59b[_0x7543('0x43')]=_0x13f59b[_0x7543('0x43')]['length']?_0x13f59b[_0x7543('0x43')]:_0x212326[_0x7543('0x3d')];_0x13f59b[_0x7543('0x47')]=qs[_0x7543('0x48')](_0x5544bc['query'][_0x7543('0x48')]);_0x13f59b[_0x7543('0x49')]=qs[_0x7543('0x41')](_['pick'](_0x5544bc['query'],_0x212326[_0x7543('0x41')]));if(_0x5544bc['query'][_0x7543('0x4b')]){_0x13f59b['where']=_[_0x7543('0x33')](_0x13f59b['where'],{'$or':_[_0x7543('0x3e')](_0x13f59b[_0x7543('0x43')],function(_0xb5cdbb){var _0x4c8a50={};_0x4c8a50[_0xb5cdbb]={'$like':'%'+_0x5544bc[_0x7543('0x40')][_0x7543('0x4b')]+'%'};return _0x4c8a50;})});}_0x13f59b=_[_0x7543('0x33')]({},_0x13f59b,_0x5544bc['options']);return _0x3d99c8['getSubjects'](_0x13f59b);}})[_0x7543('0x19')](function(_0x5c638c){if(_0x5c638c){_0x121106=_0x5c638c[_0x7543('0x45')];if(!_0x5544bc[_0x7543('0x40')]['hasOwnProperty'](_0x7543('0x57'))){_0x13f59b[_0x7543('0x25')]=qs[_0x7543('0x25')](_0x5544bc[_0x7543('0x40')][_0x7543('0x25')]);_0x13f59b[_0x7543('0x24')]=qs['offset'](_0x5544bc[_0x7543('0x40')][_0x7543('0x24')]);}return _0x3d99c8['getSubjects'](_0x13f59b);}})['then'](function(_0x250005){if(_0x250005){return _0x250005?{'count':_0x121106,'rows':_0x250005}:null;}})[_0x7543('0x19')](respondWithResult(_0xb8de37,null))[_0x7543('0x53')](handleError(_0xb8de37,null));};exports[_0x7543('0x5a')]=function(_0x264c08,_0x237c6a,_0x649ba0){var _0x654589={};var _0x3f797c={};var _0xef2da8;var _0x4301c2;return db[_0x7543('0x3a')][_0x7543('0x59')]({'where':{'id':_0x264c08['params']['id']}})[_0x7543('0x19')](handleEntityNotFound(_0x237c6a,null))[_0x7543('0x19')](function(_0x146fcd){if(_0x146fcd){_0xef2da8=_0x146fcd;_0x3f797c['model']=_[_0x7543('0x3f')](db[_0x7543('0x5b')][_0x7543('0x3b')]);_0x3f797c[_0x7543('0x40')]=_[_0x7543('0x3f')](_0x264c08['query']);_0x3f797c[_0x7543('0x41')]=_[_0x7543('0x42')](_0x3f797c[_0x7543('0x3d')],_0x3f797c['query']);_0x654589[_0x7543('0x43')]=_['intersection'](_0x3f797c[_0x7543('0x3d')],qs[_0x7543('0x44')](_0x264c08['query'][_0x7543('0x44')]));_0x654589[_0x7543('0x43')]=_0x654589[_0x7543('0x43')]['length']?_0x654589[_0x7543('0x43')]:_0x3f797c[_0x7543('0x3d')];_0x654589[_0x7543('0x47')]=qs[_0x7543('0x48')](_0x264c08['query']['sort']);_0x654589[_0x7543('0x49')]=qs['filters'](_[_0x7543('0x4a')](_0x264c08[_0x7543('0x40')],_0x3f797c[_0x7543('0x41')]));if(_0x264c08[_0x7543('0x40')][_0x7543('0x4b')]){_0x654589[_0x7543('0x49')]=_[_0x7543('0x33')](_0x654589['where'],{'$or':_[_0x7543('0x3e')](_0x654589[_0x7543('0x43')],function(_0xfdd6c3){var _0x42ccac={};_0x42ccac[_0xfdd6c3]={'$like':'%'+_0x264c08[_0x7543('0x40')][_0x7543('0x4b')]+'%'};return _0x42ccac;})});}_0x654589=_[_0x7543('0x33')]({},_0x654589,_0x264c08[_0x7543('0x4d')]);return _0xef2da8[_0x7543('0x5a')](_0x654589);}})[_0x7543('0x19')](function(_0x32bed6){if(_0x32bed6){_0x4301c2=_0x32bed6['length'];if(!_0x264c08[_0x7543('0x40')][_0x7543('0x46')](_0x7543('0x57'))){_0x654589[_0x7543('0x25')]=qs['limit'](_0x264c08[_0x7543('0x40')][_0x7543('0x25')]);_0x654589[_0x7543('0x24')]=qs[_0x7543('0x24')](_0x264c08[_0x7543('0x40')]['offset']);}return _0xef2da8[_0x7543('0x5a')](_0x654589);}})['then'](function(_0x183f97){if(_0x183f97){return _0x183f97?{'count':_0x4301c2,'rows':_0x183f97}:null;}})[_0x7543('0x19')](respondWithResult(_0x237c6a,null))[_0x7543('0x53')](handleError(_0x237c6a,null));};exports[_0x7543('0x5c')]=function(_0x148f37,_0x3e3c56,_0x5c7c3e){var _0x9e83d7={};var _0x10b385={};var _0x291b3a;var _0x16195a;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x148f37['params']['id']}})['then'](handleEntityNotFound(_0x3e3c56,null))[_0x7543('0x19')](function(_0x5959b7){if(_0x5959b7){_0x291b3a=_0x5959b7;_0x10b385['model']=_[_0x7543('0x3f')](db['Tag'][_0x7543('0x3b')]);_0x10b385['query']=_[_0x7543('0x3f')](_0x148f37['query']);_0x10b385[_0x7543('0x41')]=_[_0x7543('0x42')](_0x10b385['model'],_0x10b385[_0x7543('0x40')]);_0x9e83d7[_0x7543('0x43')]=_[_0x7543('0x42')](_0x10b385[_0x7543('0x3d')],qs['fields'](_0x148f37[_0x7543('0x40')][_0x7543('0x44')]));_0x9e83d7[_0x7543('0x43')]=_0x9e83d7[_0x7543('0x43')][_0x7543('0x45')]?_0x9e83d7[_0x7543('0x43')]:_0x10b385[_0x7543('0x3d')];_0x9e83d7[_0x7543('0x47')]=qs[_0x7543('0x48')](_0x148f37[_0x7543('0x40')][_0x7543('0x48')]);_0x9e83d7[_0x7543('0x49')]=qs[_0x7543('0x41')](_[_0x7543('0x4a')](_0x148f37['query'],_0x10b385[_0x7543('0x41')]));if(_0x148f37[_0x7543('0x40')][_0x7543('0x4b')]){_0x9e83d7['where']=_[_0x7543('0x33')](_0x9e83d7[_0x7543('0x49')],{'$or':_[_0x7543('0x3e')](_0x9e83d7[_0x7543('0x43')],function(_0x4de8b2){var _0x360eb3={};_0x360eb3[_0x4de8b2]={'$like':'%'+_0x148f37[_0x7543('0x40')]['filter']+'%'};return _0x360eb3;})});}_0x9e83d7=_['merge']({},_0x9e83d7,_0x148f37['options']);return _0x291b3a[_0x7543('0x5c')](_0x9e83d7);}})[_0x7543('0x19')](function(_0x34ee23){if(_0x34ee23){_0x16195a=_0x34ee23[_0x7543('0x45')];if(!_0x148f37[_0x7543('0x40')][_0x7543('0x46')](_0x7543('0x57'))){_0x9e83d7['limit']=qs[_0x7543('0x25')](_0x148f37[_0x7543('0x40')][_0x7543('0x25')]);_0x9e83d7[_0x7543('0x24')]=qs[_0x7543('0x24')](_0x148f37[_0x7543('0x40')]['offset']);}return _0x291b3a[_0x7543('0x5c')](_0x9e83d7);}})[_0x7543('0x19')](function(_0x34b477){if(_0x34b477){return _0x34b477?{'count':_0x16195a,'rows':_0x34b477}:null;}})['then'](respondWithResult(_0x3e3c56,null))['catch'](handleError(_0x3e3c56,null));};exports['setTags']=function(_0x47d9f8,_0x203543,_0x225153){if(_0x47d9f8[_0x7543('0x34')]['id']){delete _0x47d9f8[_0x7543('0x34')]['id'];}return db[_0x7543('0x3a')][_0x7543('0x59')]({'where':{'id':_0x47d9f8[_0x7543('0x55')]['id']}})[_0x7543('0x19')](handleEntityNotFound(_0x203543,null))[_0x7543('0x19')](function(_0x23f221){if(_0x23f221){return _0x23f221[_0x7543('0x5d')](_0x47d9f8[_0x7543('0x34')]['ids']||[]);}return null;})[_0x7543('0x19')](respondWithResult(_0x203543,null))['catch'](handleError(_0x203543,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 81981c8..e3b6c56 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 _0x8b16=['define','FreshdeskConfiguration','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x8b16,0x9e));var _0x68b1=function(_0x47d95d,_0xe3f35a){_0x47d95d=_0x47d95d-0x0;var _0x154f04=_0x8b16[_0x47d95d];return _0x154f04;};'use strict';var _=require(_0x68b1('0x0'));var util=require(_0x68b1('0x1'));var logger=require('../../config/logger')(_0x68b1('0x2'));var moment=require(_0x68b1('0x3'));var BPromise=require(_0x68b1('0x4'));var rp=require(_0x68b1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68b1('0x6'));var config=require(_0x68b1('0x7'));var attributes=require(_0x68b1('0x8'));module[_0x68b1('0x9')]=function(_0x3de57e,_0xcb658e){return _0x3de57e[_0x68b1('0xa')](_0x68b1('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d91=['../../config/environment','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5d91,0x101));var _0x15d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d91[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x15d9('0x0'));var util=require(_0x15d9('0x1'));var logger=require(_0x15d9('0x2'))(_0x15d9('0x3'));var moment=require(_0x15d9('0x4'));var BPromise=require(_0x15d9('0x5'));var rp=require(_0x15d9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15d9('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x15d9('0x8')]=function(_0xc16f92,_0x1e70e6){return _0xc16f92[_0x15d9('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x15d9('0xa'),'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 b207f73..02c72d8 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 _0x9071=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x1f7ff7,_0x5dd628){var _0x14760c=function(_0x417364){while(--_0x417364){_0x1f7ff7['push'](_0x1f7ff7['shift']());}};_0x14760c(++_0x5dd628);}(_0x9071,0xab));var _0x1907=function(_0x199c16,_0x577ee8){_0x199c16=_0x199c16-0x0;var _0x490c09=_0x9071[_0x199c16];return _0x490c09;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1907('0x0'));var BPromise=require(_0x1907('0x1'));var rs=require(_0x1907('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1907('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1907('0x4'))(_0x1907('0x5'));var config=require(_0x1907('0x6'));var jayson=require(_0x1907('0x7'));var client=jayson[_0x1907('0x8')][_0x1907('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aaebf,_0x4f18c6,_0x3d294c){return new BPromise(function(_0x43f642,_0x4cb379){return client[_0x1907('0xa')](_0x1aaebf,_0x3d294c)[_0x1907('0xb')](function(_0x67298e){logger[_0x1907('0xc')](_0x1907('0xd'),_0x4f18c6,_0x1907('0xe'));logger[_0x1907('0xf')](_0x1907('0x10'),_0x4f18c6,_0x1907('0xe'),JSON[_0x1907('0x11')](_0x67298e));if(_0x67298e[_0x1907('0x12')]){if(_0x67298e[_0x1907('0x12')]['code']===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f18c6,_0x67298e[_0x1907('0x12')][_0x1907('0x13')]);return _0x4cb379(_0x67298e[_0x1907('0x12')][_0x1907('0x13')]);}logger[_0x1907('0x12')](_0x1907('0xd'),_0x4f18c6,_0x67298e[_0x1907('0x12')][_0x1907('0x13')]);return _0x43f642(_0x67298e[_0x1907('0x12')]['message']);}else{logger[_0x1907('0xc')](_0x1907('0xd'),_0x4f18c6,_0x1907('0xe'));_0x43f642(_0x67298e[_0x1907('0x14')]['message']);}})[_0x1907('0x15')](function(_0x144a51){logger[_0x1907('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f18c6,_0x144a51);_0x4cb379(_0x144a51);});});} \ No newline at end of file +var _0xdf78=['FreshdeskConfiguration,\x20%s,\x20%s','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x230a17,_0x46164f){var _0x347af9=function(_0x3c3d61){while(--_0x3c3d61){_0x230a17['push'](_0x230a17['shift']());}};_0x347af9(++_0x46164f);}(_0xdf78,0x145));var _0x8df7=function(_0x597d88,_0x32a231){_0x597d88=_0x597d88-0x0;var _0x567bfc=_0xdf78[_0x597d88];return _0x567bfc;};'use strict';var _=require('lodash');var util=require(_0x8df7('0x0'));var moment=require(_0x8df7('0x1'));var BPromise=require('bluebird');var rs=require(_0x8df7('0x2'));var fs=require('fs');var Redis=require(_0x8df7('0x3'));var db=require(_0x8df7('0x4'))['db'];var utils=require(_0x8df7('0x5'));var logger=require(_0x8df7('0x6'))(_0x8df7('0x7'));var config=require(_0x8df7('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fd6a2,_0x51838c,_0x4ec8a9){return new BPromise(function(_0x250985,_0x4aabb6){return client[_0x8df7('0x9')](_0x1fd6a2,_0x4ec8a9)[_0x8df7('0xa')](function(_0x43c83a){logger[_0x8df7('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x51838c,_0x8df7('0xc'));logger[_0x8df7('0xd')](_0x8df7('0xe'),_0x51838c,_0x8df7('0xc'),JSON[_0x8df7('0xf')](_0x43c83a));if(_0x43c83a[_0x8df7('0x10')]){if(_0x43c83a[_0x8df7('0x10')]['code']===0x1f4){logger[_0x8df7('0x10')](_0x8df7('0x11'),_0x51838c,_0x43c83a['error'][_0x8df7('0x12')]);return _0x4aabb6(_0x43c83a['error'][_0x8df7('0x12')]);}logger['error'](_0x8df7('0x11'),_0x51838c,_0x43c83a[_0x8df7('0x10')][_0x8df7('0x12')]);return _0x250985(_0x43c83a[_0x8df7('0x10')][_0x8df7('0x12')]);}else{logger[_0x8df7('0xb')](_0x8df7('0x11'),_0x51838c,'request\x20sent');_0x250985(_0x43c83a['result'][_0x8df7('0x12')]);}})['catch'](function(_0x1d549b){logger[_0x8df7('0x10')](_0x8df7('0x11'),_0x51838c,_0x1d549b);_0x4aabb6(_0x1d549b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ac6535d..1b0b1a2 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 _0xe5dd=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x43330e,_0x3ddaae){var _0x9fedf4=function(_0x3b0708){while(--_0x3b0708){_0x43330e['push'](_0x43330e['shift']());}};_0x9fedf4(++_0x3ddaae);}(_0xe5dd,0x150));var _0xde5d=function(_0xd5b654,_0x37bcaa){_0xd5b654=_0xd5b654-0x0;var _0x477ecc=_0xe5dd[_0xd5b654];return _0x477ecc;};'use strict';var multer=require(_0xde5d('0x0'));var util=require(_0xde5d('0x1'));var path=require(_0xde5d('0x2'));var timeout=require(_0xde5d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xde5d('0x4'));var auth=require(_0xde5d('0x5'));var interaction=require(_0xde5d('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xde5d('0x7')]('/',auth[_0xde5d('0x8')](),controller[_0xde5d('0x9')]);router[_0xde5d('0x7')](_0xde5d('0xa'),auth[_0xde5d('0x8')](),controller[_0xde5d('0xb')]);router['post']('/',auth[_0xde5d('0x8')](),controller[_0xde5d('0xc')]);router[_0xde5d('0xd')](_0xde5d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xde5d('0xe')](_0xde5d('0xa'),auth['isAuthenticated'](),controller[_0xde5d('0xf')]);module[_0xde5d('0x10')]=router; \ No newline at end of file +var _0x63ef=['update','delete','destroy','exports','multer','path','express','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x5df3ab,_0x4a0a7e){var _0x42cce5=function(_0x430d0a){while(--_0x430d0a){_0x5df3ab['push'](_0x5df3ab['shift']());}};_0x42cce5(++_0x4a0a7e);}(_0x63ef,0x84));var _0xf63e=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x63ef[_0x28e74e];return _0xb45ac1;};'use strict';var multer=require(_0xf63e('0x0'));var util=require('util');var path=require(_0xf63e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf63e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf63e('0x3'));var controller=require(_0xf63e('0x4'));router[_0xf63e('0x5')]('/',auth[_0xf63e('0x6')](),controller[_0xf63e('0x7')]);router[_0xf63e('0x5')](_0xf63e('0x8'),auth[_0xf63e('0x6')](),controller['show']);router[_0xf63e('0x9')]('/',auth[_0xf63e('0x6')](),controller[_0xf63e('0xa')]);router[_0xf63e('0xb')](_0xf63e('0x8'),auth[_0xf63e('0x6')](),controller[_0xf63e('0xc')]);router[_0xf63e('0xd')](_0xf63e('0x8'),auth[_0xf63e('0x6')](),controller[_0xf63e('0xe')]);module[_0xf63e('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 86889d4..8045a0f 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 _0xd2ea=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xd2ea,0x15f));var _0xad2e=function(_0x533d16,_0x2d7743){_0x533d16=_0x533d16-0x0;var _0x2d710d=_0xd2ea[_0x533d16];return _0x2d710d;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'type':{'type':Sequelize[_0xad2e('0x2')](_0xad2e('0x3'),_0xad2e('0x4'),'customVariable',_0xad2e('0x5'),_0xad2e('0x6')),'defaultValue':_0xad2e('0x3')},'content':{'type':Sequelize[_0xad2e('0x7')]},'key':{'type':Sequelize[_0xad2e('0x7')]},'keyType':{'type':Sequelize[_0xad2e('0x2')](_0xad2e('0x3'),'variable',_0xad2e('0x8'))},'keyContent':{'type':Sequelize[_0xad2e('0x7')]},'idField':{'type':Sequelize[_0xad2e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xad2e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xad2e('0x7')]}}; \ No newline at end of file +var _0x0bde=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','exports','string','variable'];(function(_0x55fbf9,_0x386b08){var _0x396ed0=function(_0xcf5afe){while(--_0xcf5afe){_0x55fbf9['push'](_0x55fbf9['shift']());}};_0x396ed0(++_0x386b08);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe0bd('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe0bd('0x1'),_0xe0bd('0x2'),_0xe0bd('0x3'),_0xe0bd('0x4'),_0xe0bd('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe0bd('0x6')]},'key':{'type':Sequelize[_0xe0bd('0x6')]},'keyType':{'type':Sequelize[_0xe0bd('0x7')](_0xe0bd('0x1'),_0xe0bd('0x2'),_0xe0bd('0x3'))},'keyContent':{'type':Sequelize[_0xe0bd('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe0bd('0x6')]},'customField':{'type':Sequelize[_0xe0bd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe0bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index d0ee41b..243ea34 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 _0x3f50=['ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','error','name','render','merge','body','contact','message','interaction','account','index','map','FreshdeskField','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','then','include','findAll','rows','catch','rawAttributes','includeAll','find','create','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x1c75de,_0x52c9b3){var _0x20a5e6=function(_0x5cbec1){while(--_0x5cbec1){_0x1c75de['push'](_0x1c75de['shift']());}};_0x20a5e6(++_0x52c9b3);}(_0x3f50,0x127));var _0x03f5=function(_0x9b6536,_0x56f83d){_0x9b6536=_0x9b6536-0x0;var _0x438675=_0x3f50[_0x9b6536];return _0x438675;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03f5('0x0'));var zipdir=require(_0x03f5('0x1'));var jsonpatch=require(_0x03f5('0x2'));var rp=require(_0x03f5('0x3'));var moment=require(_0x03f5('0x4'));var BPromise=require(_0x03f5('0x5'));var Mustache=require(_0x03f5('0x6'));var util=require(_0x03f5('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x03f5('0x8'));var ejs=require(_0x03f5('0x9'));var fs=require('fs');var fs_extra=require(_0x03f5('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x03f5('0xb'));var jsforce=require(_0x03f5('0xc'));var deskjs=require(_0x03f5('0xd'));var toCsv=require(_0x03f5('0x8'));var querystring=require('querystring');var Papa=require(_0x03f5('0xe'));var Redis=require(_0x03f5('0xf'));var authService=require(_0x03f5('0x10'));var qs=require(_0x03f5('0x11'));var as=require(_0x03f5('0x12'));var hardwareService=require(_0x03f5('0x13'));var logger=require('../../config/logger')(_0x03f5('0x14'));var utils=require(_0x03f5('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x03f5('0x16'))['db'];function respondWithStatusCode(_0x3eb838,_0x62a8cd){_0x62a8cd=_0x62a8cd||0xcc;return function(_0x129be1){if(_0x129be1){return _0x3eb838[_0x03f5('0x17')](_0x62a8cd);}return _0x3eb838['status'](_0x62a8cd)[_0x03f5('0x18')]();};}function respondWithResult(_0x3cfa91,_0x782759){_0x782759=_0x782759||0xc8;return function(_0x136ec0){if(_0x136ec0){return _0x3cfa91['status'](_0x782759)[_0x03f5('0x19')](_0x136ec0);}};}function respondWithFilteredResult(_0x5cbcef,_0x4f773d){return function(_0x222fe0){if(_0x222fe0){var _0x194e60=typeof _0x4f773d[_0x03f5('0x1a')]===_0x03f5('0x1b')&&typeof _0x4f773d[_0x03f5('0x1c')]===_0x03f5('0x1b');var _0x308fa3=_0x222fe0[_0x03f5('0x1d')];var _0x35fef5=_0x194e60?0x0:_0x4f773d[_0x03f5('0x1a')];var _0x3078e9=_0x194e60?_0x222fe0[_0x03f5('0x1d')]:_0x4f773d['offset']+_0x4f773d[_0x03f5('0x1c')];var _0x5e4878;if(_0x3078e9>=_0x308fa3){_0x3078e9=_0x308fa3;_0x5e4878=0xc8;}else{_0x5e4878=0xce;}_0x5cbcef[_0x03f5('0x1e')](_0x5e4878);return _0x5cbcef[_0x03f5('0x1f')](_0x03f5('0x20'),_0x35fef5+'-'+_0x3078e9+'/'+_0x308fa3)[_0x03f5('0x19')](_0x222fe0);}return null;};}function patchUpdates(_0x1cff08){return function(_0x2737b6){try{jsonpatch[_0x03f5('0x21')](_0x2737b6,_0x1cff08,!![]);}catch(_0x482cac){return BPromise[_0x03f5('0x22')](_0x482cac);}return _0x2737b6[_0x03f5('0x23')]();};}function saveUpdates(_0x2c813f,_0x4a6c65){return function(_0x32bf18){if(_0x32bf18){return _0x32bf18[_0x03f5('0x24')](_0x2c813f)['then'](function(_0x18ce88){return _0x18ce88;});}return null;};}function removeEntity(_0x1cfe64,_0x20acb0){return function(_0x2bd75d){if(_0x2bd75d){return _0x2bd75d[_0x03f5('0x25')]()['then'](function(){_0x1cfe64['status'](0xcc)[_0x03f5('0x18')]();});}};}function handleEntityNotFound(_0x433764,_0x41c675){return function(_0x3b0d09){if(!_0x3b0d09){_0x433764[_0x03f5('0x17')](0x194);}return _0x3b0d09;};}function handleError(_0x47d059,_0x345d4d){_0x345d4d=_0x345d4d||0x1f4;return function(_0x1f3a08){logger[_0x03f5('0x26')](_0x1f3a08['stack']);if(_0x1f3a08[_0x03f5('0x27')]){delete _0x1f3a08['name'];}_0x47d059[_0x03f5('0x1e')](_0x345d4d)['send'](_0x1f3a08);};}function getMustacheRender(_0x583f0f,_0x7416cb){return Mustache[_0x03f5('0x28')](_0x583f0f,_[_0x03f5('0x29')](_0x7416cb[_0x03f5('0x2a')],{'contact':_0x7416cb[_0x03f5('0x2b')],'message':_0x7416cb[_0x03f5('0x2c')],'agent':_0x7416cb['agent'],'interaction':_0x7416cb[_0x03f5('0x2d')],'account':_0x7416cb[_0x03f5('0x2e')]}))||'';}exports[_0x03f5('0x2f')]=function(_0x222fc9,_0x498f11){var _0x1a7420={},_0x2bf09a={},_0x1d55ef={'count':0x0,'rows':[]};var _0x10c22c=_[_0x03f5('0x30')](db[_0x03f5('0x31')]['rawAttributes'],function(_0x5eb8f5){return{'name':_0x5eb8f5[_0x03f5('0x32')],'type':_0x5eb8f5[_0x03f5('0x33')]['key']};});_0x2bf09a[_0x03f5('0x34')]=_[_0x03f5('0x30')](_0x10c22c,_0x03f5('0x27'));_0x2bf09a['query']=_[_0x03f5('0x35')](_0x222fc9[_0x03f5('0x36')]);_0x2bf09a[_0x03f5('0x37')]=_[_0x03f5('0x38')](_0x2bf09a[_0x03f5('0x34')],_0x2bf09a[_0x03f5('0x36')]);_0x1a7420[_0x03f5('0x39')]=_[_0x03f5('0x38')](_0x2bf09a[_0x03f5('0x34')],qs[_0x03f5('0x3a')](_0x222fc9[_0x03f5('0x36')][_0x03f5('0x3a')]));_0x1a7420[_0x03f5('0x39')]=_0x1a7420[_0x03f5('0x39')]['length']?_0x1a7420[_0x03f5('0x39')]:_0x2bf09a['model'];if(!_0x222fc9['query'][_0x03f5('0x3b')]('nolimit')){_0x1a7420[_0x03f5('0x1c')]=qs[_0x03f5('0x1c')](_0x222fc9[_0x03f5('0x36')][_0x03f5('0x1c')]);_0x1a7420[_0x03f5('0x1a')]=qs[_0x03f5('0x1a')](_0x222fc9['query'][_0x03f5('0x1a')]);}_0x1a7420[_0x03f5('0x3c')]=qs[_0x03f5('0x3d')](_0x222fc9[_0x03f5('0x36')][_0x03f5('0x3d')]);_0x1a7420['where']=qs[_0x03f5('0x37')](_['pick'](_0x222fc9['query'],_0x2bf09a['filters']),_0x10c22c);if(_0x222fc9[_0x03f5('0x36')][_0x03f5('0x3e')]){_0x1a7420[_0x03f5('0x3f')]=_[_0x03f5('0x29')](_0x1a7420[_0x03f5('0x3f')],{'$or':_[_0x03f5('0x30')](_0x10c22c,function(_0x2d6d30){if(_0x2d6d30[_0x03f5('0x33')]!==_0x03f5('0x40')){var _0x2c3926={};_0x2c3926[_0x2d6d30[_0x03f5('0x27')]]={'$like':'%'+_0x222fc9[_0x03f5('0x36')]['filter']+'%'};return _0x2c3926;}})});}_0x1a7420=_[_0x03f5('0x29')]({},_0x1a7420,_0x222fc9[_0x03f5('0x41')]);var _0x2e6ffc={'where':_0x1a7420[_0x03f5('0x3f')]};return db[_0x03f5('0x31')][_0x03f5('0x1d')](_0x2e6ffc)[_0x03f5('0x42')](function(_0x24bab5){_0x1d55ef[_0x03f5('0x1d')]=_0x24bab5;if(_0x222fc9[_0x03f5('0x36')]['includeAll']){_0x1a7420[_0x03f5('0x43')]=[{'all':!![]}];}return db[_0x03f5('0x31')][_0x03f5('0x44')](_0x1a7420);})[_0x03f5('0x42')](function(_0x2075ed){_0x1d55ef[_0x03f5('0x45')]=_0x2075ed;return _0x1d55ef;})[_0x03f5('0x42')](respondWithFilteredResult(_0x498f11,_0x1a7420))[_0x03f5('0x46')](handleError(_0x498f11,null));};exports['show']=function(_0x567b7f,_0x24c24d){var _0x504b69={'raw':!![],'where':{'id':_0x567b7f['params']['id']}},_0x464908={};_0x464908[_0x03f5('0x34')]=_['keys'](db[_0x03f5('0x31')][_0x03f5('0x47')]);_0x464908[_0x03f5('0x36')]=_[_0x03f5('0x35')](_0x567b7f[_0x03f5('0x36')]);_0x464908[_0x03f5('0x37')]=_[_0x03f5('0x38')](_0x464908[_0x03f5('0x34')],_0x464908['query']);_0x504b69[_0x03f5('0x39')]=_[_0x03f5('0x38')](_0x464908['model'],qs[_0x03f5('0x3a')](_0x567b7f['query'][_0x03f5('0x3a')]));_0x504b69[_0x03f5('0x39')]=_0x504b69[_0x03f5('0x39')]['length']?_0x504b69[_0x03f5('0x39')]:_0x464908[_0x03f5('0x34')];if(_0x567b7f[_0x03f5('0x36')][_0x03f5('0x48')]){_0x504b69[_0x03f5('0x43')]=[{'all':!![]}];}_0x504b69=_[_0x03f5('0x29')]({},_0x504b69,_0x567b7f[_0x03f5('0x41')]);return db[_0x03f5('0x31')][_0x03f5('0x49')](_0x504b69)[_0x03f5('0x42')](handleEntityNotFound(_0x24c24d,null))[_0x03f5('0x42')](respondWithResult(_0x24c24d,null))[_0x03f5('0x46')](handleError(_0x24c24d,null));};exports[_0x03f5('0x4a')]=function(_0x362166,_0xb6381){return db[_0x03f5('0x31')]['create'](_0x362166['body'],{})[_0x03f5('0x42')](respondWithResult(_0xb6381,0xc9))['catch'](handleError(_0xb6381,null));};exports['update']=function(_0x1e4fdf,_0x28eed7){if(_0x1e4fdf[_0x03f5('0x2a')]['id']){delete _0x1e4fdf[_0x03f5('0x2a')]['id'];}return db[_0x03f5('0x31')][_0x03f5('0x49')]({'where':{'id':_0x1e4fdf[_0x03f5('0x4b')]['id']}})[_0x03f5('0x42')](handleEntityNotFound(_0x28eed7,null))[_0x03f5('0x42')](saveUpdates(_0x1e4fdf[_0x03f5('0x2a')],null))[_0x03f5('0x42')](respondWithResult(_0x28eed7,null))[_0x03f5('0x46')](handleError(_0x28eed7,null));};exports[_0x03f5('0x25')]=function(_0x3c6ddc,_0x176138){return db[_0x03f5('0x31')]['find']({'where':{'id':_0x3c6ddc[_0x03f5('0x4b')]['id']}})[_0x03f5('0x42')](handleEntityNotFound(_0x176138,null))['then'](removeEntity(_0x176138,null))[_0x03f5('0x46')](handleError(_0x176138,null));}; \ No newline at end of file +var _0x62ba=['include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','then','destroy','stack','name','send','render','merge','contact','message','agent','interaction','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','VIRTUAL','includeAll'];(function(_0xb4e66e,_0x5e5af9){var _0x4cc6ac=function(_0x5d5dd4){while(--_0x5d5dd4){_0xb4e66e['push'](_0xb4e66e['shift']());}};_0x4cc6ac(++_0x5e5af9);}(_0x62ba,0xa8));var _0xa62b=function(_0x2fc581,_0x48ddcd){_0x2fc581=_0x2fc581-0x0;var _0x3e643f=_0x62ba[_0x2fc581];return _0x3e643f;};'use strict';var emlformat=require(_0xa62b('0x0'));var rimraf=require(_0xa62b('0x1'));var zipdir=require(_0xa62b('0x2'));var jsonpatch=require(_0xa62b('0x3'));var rp=require(_0xa62b('0x4'));var moment=require(_0xa62b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa62b('0x6'));var util=require(_0xa62b('0x7'));var path=require('path');var sox=require(_0xa62b('0x8'));var csv=require(_0xa62b('0x9'));var ejs=require(_0xa62b('0xa'));var fs=require('fs');var fs_extra=require(_0xa62b('0xb'));var _=require('lodash');var squel=require(_0xa62b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa62b('0xd'));var toCsv=require(_0xa62b('0x9'));var querystring=require(_0xa62b('0xe'));var Papa=require(_0xa62b('0xf'));var Redis=require(_0xa62b('0x10'));var authService=require(_0xa62b('0x11'));var qs=require(_0xa62b('0x12'));var as=require(_0xa62b('0x13'));var hardwareService=require(_0xa62b('0x14'));var logger=require(_0xa62b('0x15'))(_0xa62b('0x16'));var utils=require(_0xa62b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa62b('0x18'))['db'];function respondWithStatusCode(_0x6d7685,_0x4abbcc){_0x4abbcc=_0x4abbcc||0xcc;return function(_0x18ea85){if(_0x18ea85){return _0x6d7685[_0xa62b('0x19')](_0x4abbcc);}return _0x6d7685['status'](_0x4abbcc)[_0xa62b('0x1a')]();};}function respondWithResult(_0x3a5115,_0x565a7d){_0x565a7d=_0x565a7d||0xc8;return function(_0x2879dd){if(_0x2879dd){return _0x3a5115['status'](_0x565a7d)[_0xa62b('0x1b')](_0x2879dd);}};}function respondWithFilteredResult(_0x4f0ac6,_0x473a01){return function(_0xff6818){if(_0xff6818){var _0x5b4f0c=typeof _0x473a01[_0xa62b('0x1c')]===_0xa62b('0x1d')&&typeof _0x473a01['limit']===_0xa62b('0x1d');var _0x3b275b=_0xff6818[_0xa62b('0x1e')];var _0x5dee31=_0x5b4f0c?0x0:_0x473a01[_0xa62b('0x1c')];var _0x37ae3c=_0x5b4f0c?_0xff6818[_0xa62b('0x1e')]:_0x473a01[_0xa62b('0x1c')]+_0x473a01[_0xa62b('0x1f')];var _0x2feba6;if(_0x37ae3c>=_0x3b275b){_0x37ae3c=_0x3b275b;_0x2feba6=0xc8;}else{_0x2feba6=0xce;}_0x4f0ac6[_0xa62b('0x20')](_0x2feba6);return _0x4f0ac6['set'](_0xa62b('0x21'),_0x5dee31+'-'+_0x37ae3c+'/'+_0x3b275b)[_0xa62b('0x1b')](_0xff6818);}return null;};}function patchUpdates(_0x32973f){return function(_0x3fafa4){try{jsonpatch[_0xa62b('0x22')](_0x3fafa4,_0x32973f,!![]);}catch(_0x4cbc0d){return BPromise[_0xa62b('0x23')](_0x4cbc0d);}return _0x3fafa4[_0xa62b('0x24')]();};}function saveUpdates(_0x4bbfd1,_0x33d7aa){return function(_0x1e2bdb){if(_0x1e2bdb){return _0x1e2bdb['update'](_0x4bbfd1)[_0xa62b('0x25')](function(_0x551433){return _0x551433;});}return null;};}function removeEntity(_0x8f4021,_0x58afea){return function(_0x3def06){if(_0x3def06){return _0x3def06[_0xa62b('0x26')]()[_0xa62b('0x25')](function(){_0x8f4021[_0xa62b('0x20')](0xcc)[_0xa62b('0x1a')]();});}};}function handleEntityNotFound(_0xba3dd1,_0x1c82fb){return function(_0x25504e){if(!_0x25504e){_0xba3dd1[_0xa62b('0x19')](0x194);}return _0x25504e;};}function handleError(_0x22ef47,_0x51f281){_0x51f281=_0x51f281||0x1f4;return function(_0x47b5c1){logger['error'](_0x47b5c1[_0xa62b('0x27')]);if(_0x47b5c1[_0xa62b('0x28')]){delete _0x47b5c1[_0xa62b('0x28')];}_0x22ef47[_0xa62b('0x20')](_0x51f281)[_0xa62b('0x29')](_0x47b5c1);};}function getMustacheRender(_0x4efb17,_0x19d76f){return Mustache[_0xa62b('0x2a')](_0x4efb17,_[_0xa62b('0x2b')](_0x19d76f['body'],{'contact':_0x19d76f[_0xa62b('0x2c')],'message':_0x19d76f[_0xa62b('0x2d')],'agent':_0x19d76f[_0xa62b('0x2e')],'interaction':_0x19d76f[_0xa62b('0x2f')],'account':_0x19d76f['account']}))||'';}exports[_0xa62b('0x30')]=function(_0x4f971f,_0x39e380){var _0x4f3af9={},_0x4094e5={},_0x53515d={'count':0x0,'rows':[]};var _0x3d17cb=_[_0xa62b('0x31')](db[_0xa62b('0x32')][_0xa62b('0x33')],function(_0x5ac476){return{'name':_0x5ac476[_0xa62b('0x34')],'type':_0x5ac476[_0xa62b('0x35')][_0xa62b('0x36')]};});_0x4094e5[_0xa62b('0x37')]=_[_0xa62b('0x31')](_0x3d17cb,_0xa62b('0x28'));_0x4094e5[_0xa62b('0x38')]=_[_0xa62b('0x39')](_0x4f971f[_0xa62b('0x38')]);_0x4094e5['filters']=_[_0xa62b('0x3a')](_0x4094e5['model'],_0x4094e5[_0xa62b('0x38')]);_0x4f3af9[_0xa62b('0x3b')]=_[_0xa62b('0x3a')](_0x4094e5[_0xa62b('0x37')],qs['fields'](_0x4f971f[_0xa62b('0x38')][_0xa62b('0x3c')]));_0x4f3af9[_0xa62b('0x3b')]=_0x4f3af9[_0xa62b('0x3b')]['length']?_0x4f3af9[_0xa62b('0x3b')]:_0x4094e5['model'];if(!_0x4f971f[_0xa62b('0x38')]['hasOwnProperty']('nolimit')){_0x4f3af9[_0xa62b('0x1f')]=qs[_0xa62b('0x1f')](_0x4f971f[_0xa62b('0x38')][_0xa62b('0x1f')]);_0x4f3af9[_0xa62b('0x1c')]=qs[_0xa62b('0x1c')](_0x4f971f[_0xa62b('0x38')][_0xa62b('0x1c')]);}_0x4f3af9[_0xa62b('0x3d')]=qs[_0xa62b('0x3e')](_0x4f971f[_0xa62b('0x38')]['sort']);_0x4f3af9[_0xa62b('0x3f')]=qs[_0xa62b('0x40')](_[_0xa62b('0x41')](_0x4f971f[_0xa62b('0x38')],_0x4094e5[_0xa62b('0x40')]),_0x3d17cb);if(_0x4f971f[_0xa62b('0x38')][_0xa62b('0x42')]){_0x4f3af9['where']=_[_0xa62b('0x2b')](_0x4f3af9[_0xa62b('0x3f')],{'$or':_[_0xa62b('0x31')](_0x3d17cb,function(_0x32c8b0){if(_0x32c8b0[_0xa62b('0x35')]!==_0xa62b('0x43')){var _0x22426a={};_0x22426a[_0x32c8b0[_0xa62b('0x28')]]={'$like':'%'+_0x4f971f['query'][_0xa62b('0x42')]+'%'};return _0x22426a;}})});}_0x4f3af9=_[_0xa62b('0x2b')]({},_0x4f3af9,_0x4f971f['options']);var _0x8d14a4={'where':_0x4f3af9['where']};return db['FreshdeskField'][_0xa62b('0x1e')](_0x8d14a4)[_0xa62b('0x25')](function(_0x2ed115){_0x53515d[_0xa62b('0x1e')]=_0x2ed115;if(_0x4f971f[_0xa62b('0x38')][_0xa62b('0x44')]){_0x4f3af9[_0xa62b('0x45')]=[{'all':!![]}];}return db[_0xa62b('0x32')][_0xa62b('0x46')](_0x4f3af9);})[_0xa62b('0x25')](function(_0x16e170){_0x53515d[_0xa62b('0x47')]=_0x16e170;return _0x53515d;})[_0xa62b('0x25')](respondWithFilteredResult(_0x39e380,_0x4f3af9))[_0xa62b('0x48')](handleError(_0x39e380,null));};exports[_0xa62b('0x49')]=function(_0x395572,_0x6411a8){var _0x4d614b={'raw':!![],'where':{'id':_0x395572[_0xa62b('0x4a')]['id']}},_0x19f940={};_0x19f940[_0xa62b('0x37')]=_[_0xa62b('0x39')](db[_0xa62b('0x32')][_0xa62b('0x33')]);_0x19f940[_0xa62b('0x38')]=_['keys'](_0x395572[_0xa62b('0x38')]);_0x19f940[_0xa62b('0x40')]=_['intersection'](_0x19f940[_0xa62b('0x37')],_0x19f940['query']);_0x4d614b[_0xa62b('0x3b')]=_[_0xa62b('0x3a')](_0x19f940[_0xa62b('0x37')],qs[_0xa62b('0x3c')](_0x395572[_0xa62b('0x38')][_0xa62b('0x3c')]));_0x4d614b[_0xa62b('0x3b')]=_0x4d614b[_0xa62b('0x3b')]['length']?_0x4d614b['attributes']:_0x19f940['model'];if(_0x395572[_0xa62b('0x38')][_0xa62b('0x44')]){_0x4d614b[_0xa62b('0x45')]=[{'all':!![]}];}_0x4d614b=_['merge']({},_0x4d614b,_0x395572[_0xa62b('0x4b')]);return db[_0xa62b('0x32')][_0xa62b('0x4c')](_0x4d614b)[_0xa62b('0x25')](handleEntityNotFound(_0x6411a8,null))[_0xa62b('0x25')](respondWithResult(_0x6411a8,null))[_0xa62b('0x48')](handleError(_0x6411a8,null));};exports[_0xa62b('0x4d')]=function(_0x4d50bf,_0x270b3e){return db['FreshdeskField'][_0xa62b('0x4d')](_0x4d50bf[_0xa62b('0x4e')],{})[_0xa62b('0x25')](respondWithResult(_0x270b3e,0xc9))[_0xa62b('0x48')](handleError(_0x270b3e,null));};exports['update']=function(_0x1e0744,_0x133db7){if(_0x1e0744[_0xa62b('0x4e')]['id']){delete _0x1e0744['body']['id'];}return db[_0xa62b('0x32')]['find']({'where':{'id':_0x1e0744['params']['id']}})[_0xa62b('0x25')](handleEntityNotFound(_0x133db7,null))[_0xa62b('0x25')](saveUpdates(_0x1e0744['body'],null))['then'](respondWithResult(_0x133db7,null))[_0xa62b('0x48')](handleError(_0x133db7,null));};exports[_0xa62b('0x26')]=function(_0x20a92a,_0x1f97ad){return db['FreshdeskField'][_0xa62b('0x4c')]({'where':{'id':_0x20a92a[_0xa62b('0x4a')]['id']}})[_0xa62b('0x25')](handleEntityNotFound(_0x1f97ad,null))[_0xa62b('0x25')](removeEntity(_0x1f97ad,null))['catch'](handleError(_0x1f97ad,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f8e6cb5..3c18ef9 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 _0x9496=['idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index'];(function(_0x2b43ec,_0x1bed77){var _0x51e6dc=function(_0x56ea4f){while(--_0x56ea4f){_0x2b43ec['push'](_0x2b43ec['shift']());}};_0x51e6dc(++_0x1bed77);}(_0x9496,0xd4));var _0x6949=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x9496[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require('lodash');var util=require(_0x6949('0x0'));var logger=require(_0x6949('0x1'))(_0x6949('0x2'));var moment=require(_0x6949('0x3'));var BPromise=require(_0x6949('0x4'));var rp=require(_0x6949('0x5'));var fs=require('fs');var path=require(_0x6949('0x6'));var rimraf=require('rimraf');var config=require(_0x6949('0x7'));var attributes=require(_0x6949('0x8'));module[_0x6949('0x9')]=function(_0x455590,_0x170c60){return _0x455590[_0x6949('0xa')](_0x6949('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x6949('0xc'),'fields':[_0x6949('0xd'),_0x6949('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc7c9=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshdeskField.attributes'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc7c9,0x1b9));var _0x9c7c=function(_0x449578,_0x4fe8cd){_0x449578=_0x449578-0x0;var _0x67b334=_0xc7c9[_0x449578];return _0x67b334;};'use strict';var _=require(_0x9c7c('0x0'));var util=require(_0x9c7c('0x1'));var logger=require(_0x9c7c('0x2'))(_0x9c7c('0x3'));var moment=require(_0x9c7c('0x4'));var BPromise=require(_0x9c7c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c7c('0x6'));var rimraf=require(_0x9c7c('0x7'));var config=require('../../config/environment');var attributes=require(_0x9c7c('0x8'));module[_0x9c7c('0x9')]=function(_0x5a7c11,_0x508a22){return _0x5a7c11[_0x9c7c('0xa')](_0x9c7c('0xb'),attributes,{'tableName':_0x9c7c('0xc'),'paranoid':![],'indexes':[{'name':_0x9c7c('0xd'),'fields':['idField',_0x9c7c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index efe4a88..24ae79d 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 _0x7a54=['info','FreshdeskField,\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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x3512d0,_0x22ae8a){_0x3512d0=_0x3512d0-0x0;var _0x3f3cd6=_0x7a54[_0x3512d0];return _0x3f3cd6;};'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')]('FreshdeskField,\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','FreshdeskField,\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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x2ce9a7,_0x427c7e){_0x2ce9a7=_0x2ce9a7-0x0;var _0x200194=_0x7a54[_0x2ce9a7];return _0x200194;};'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')]('FreshdeskField,\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/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 985d816..cc3c3dc 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 _0xbd59=['index','/:id','show','/:id/configurations','getFields','post','addConfiguration','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x5bad8f,_0x3a51ef){var _0x2f643a=function(_0x23e4ed){while(--_0x23e4ed){_0x5bad8f['push'](_0x5bad8f['shift']());}};_0x2f643a(++_0x3a51ef);}(_0xbd59,0x173));var _0x9bd5=function(_0x20f39f,_0x1b6b7a){_0x20f39f=_0x20f39f-0x0;var _0x1f65cd=_0xbd59[_0x20f39f];return _0x1f65cd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9bd5('0x0'));var timeout=require(_0x9bd5('0x1'));var express=require(_0x9bd5('0x2'));var router=express['Router']();var fs_extra=require(_0x9bd5('0x3'));var auth=require(_0x9bd5('0x4'));var interaction=require(_0x9bd5('0x5'));var config=require('../../config/environment');var controller=require(_0x9bd5('0x6'));router[_0x9bd5('0x7')]('/',auth[_0x9bd5('0x8')](),controller[_0x9bd5('0x9')]);router[_0x9bd5('0x7')](_0x9bd5('0xa'),auth[_0x9bd5('0x8')](),controller[_0x9bd5('0xb')]);router[_0x9bd5('0x7')](_0x9bd5('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x9bd5('0x7')]('/:id/fields',auth[_0x9bd5('0x8')](),controller[_0x9bd5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9bd5('0xe')](_0x9bd5('0xc'),auth[_0x9bd5('0x8')](),controller[_0x9bd5('0xf')]);router['put'](_0x9bd5('0xa'),auth[_0x9bd5('0x8')](),controller['update']);router[_0x9bd5('0x10')](_0x9bd5('0xa'),auth[_0x9bd5('0x8')](),controller[_0x9bd5('0x11')]);module[_0x9bd5('0x12')]=router; \ No newline at end of file +var _0x5394=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','index','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','addConfiguration','put','/:id','delete','destroy','exports'];(function(_0x4e2d71,_0x383e4b){var _0x7a72d4=function(_0x46318a){while(--_0x46318a){_0x4e2d71['push'](_0x4e2d71['shift']());}};_0x7a72d4(++_0x383e4b);}(_0x5394,0x134));var _0x4539=function(_0x2b47ad,_0x55c7cc){_0x2b47ad=_0x2b47ad-0x0;var _0x1a2426=_0x5394[_0x2b47ad];return _0x1a2426;};'use strict';var multer=require(_0x4539('0x0'));var util=require(_0x4539('0x1'));var path=require('path');var timeout=require(_0x4539('0x2'));var express=require('express');var router=express[_0x4539('0x3')]();var fs_extra=require(_0x4539('0x4'));var auth=require(_0x4539('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4539('0x6'));var controller=require(_0x4539('0x7'));router[_0x4539('0x8')]('/',auth['isAuthenticated'](),controller[_0x4539('0x9')]);router[_0x4539('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4539('0xa')]);router[_0x4539('0x8')](_0x4539('0xb'),auth[_0x4539('0xc')](),controller[_0x4539('0xd')]);router[_0x4539('0x8')](_0x4539('0xe'),auth[_0x4539('0xc')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4539('0xf')](_0x4539('0xb'),auth[_0x4539('0xc')](),controller[_0x4539('0x10')]);router[_0x4539('0x11')](_0x4539('0x12'),auth[_0x4539('0xc')](),controller['update']);router[_0x4539('0x13')](_0x4539('0x12'),auth[_0x4539('0xc')](),controller[_0x4539('0x14')]);module[_0x4539('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9ce3ff4..3e945c6 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 _0xc3dd=['STRING','username','remoteUri','sequelize','exports'];(function(_0x3a3c17,_0x5b7b7e){var _0xd07f21=function(_0xeaad44){while(--_0xeaad44){_0x3a3c17['push'](_0x3a3c17['shift']());}};_0xd07f21(++_0x5b7b7e);}(_0xc3dd,0xa3));var _0xdc3d=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0xc3dd[_0x9a3e0f];return _0x3d2a9a;};'use strict';var Sequelize=require(_0xdc3d('0x0'));module[_0xdc3d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdc3d('0x2')],'unique':_0xdc3d('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xdc3d('0x2')],'unique':_0xdc3d('0x4')},'serverUrl':{'type':Sequelize[_0xdc3d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6d15=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1aea51,_0x414270){var _0x3aa499=function(_0x4eed37){while(--_0x4eed37){_0x1aea51['push'](_0x1aea51['shift']());}};_0x3aa499(++_0x414270);}(_0x6d15,0x16c));var _0x56d1=function(_0x2707e7,_0xa33061){_0x2707e7=_0x2707e7-0x0;var _0x40e457=_0x6d15[_0x2707e7];return _0x40e457;};'use strict';var Sequelize=require(_0x56d1('0x0'));module[_0x56d1('0x1')]={'name':{'type':Sequelize[_0x56d1('0x2')]},'description':{'type':Sequelize[_0x56d1('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x56d1('0x3')},'apiKey':{'type':Sequelize[_0x56d1('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x56d1('0x4')},'serverUrl':{'type':Sequelize[_0x56d1('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 7e76433..fbab018 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 _0xa9e0=['merge','body','contact','interaction','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','show','intersection','find','create','params','getConfigurations','FreshsalesConfiguration','order','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','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','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','render'];(function(_0x10abd7,_0x317c32){var _0x844bde=function(_0x1ee647){while(--_0x1ee647){_0x10abd7['push'](_0x10abd7['shift']());}};_0x844bde(++_0x317c32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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'];var integrations=require(_0x0a9e('0x15'));var jayson=require(_0x0a9e('0x16'));var client=jayson[_0x0a9e('0x17')][_0x0a9e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5db4b0,_0x4283ce,_0x239b12,_0x2b4227){return new BPromise(function(_0x281129,_0x44dcfd){var _0x4d5611=_0x2b4227||client;return _0x4d5611['request'](_0x5db4b0,_0x239b12)[_0x0a9e('0x19')](function(_0x5d0880){logger[_0x0a9e('0x1a')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'));logger[_0x0a9e('0x1c')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'),JSON['stringify'](_0x5d0880));if(_0x5d0880[_0x0a9e('0x1d')]){if(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);return _0x44dcfd(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')]['message']);return _0x281129(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}else{logger['info'](_0x0a9e('0x1f'),_0x4283ce,'request\x20sent');_0x281129(_0x5d0880['result'][_0x0a9e('0x20')]);}})[_0x0a9e('0x21')](function(_0x38e7c4){logger[_0x0a9e('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x38e7c4);_0x44dcfd(_0x38e7c4);});});}function respondWithStatusCode(_0xfb6e48,_0x2fb0e4){_0x2fb0e4=_0x2fb0e4||0xcc;return function(_0x3b45bc){if(_0x3b45bc){return _0xfb6e48[_0x0a9e('0x22')](_0x2fb0e4);}return _0xfb6e48[_0x0a9e('0x23')](_0x2fb0e4)[_0x0a9e('0x24')]();};}function respondWithResult(_0x16b1ca,_0x5ea472){_0x5ea472=_0x5ea472||0xc8;return function(_0x59181e){if(_0x59181e){return _0x16b1ca[_0x0a9e('0x23')](_0x5ea472)[_0x0a9e('0x25')](_0x59181e);}};}function respondWithFilteredResult(_0x40c424,_0x33161b){return function(_0x526cf3){if(_0x526cf3){var _0x384319=typeof _0x33161b['offset']===_0x0a9e('0x26')&&typeof _0x33161b['limit']===_0x0a9e('0x26');var _0x34dc65=_0x526cf3[_0x0a9e('0x27')];var _0x14433c=_0x384319?0x0:_0x33161b[_0x0a9e('0x28')];var _0x1538a4=_0x384319?_0x526cf3[_0x0a9e('0x27')]:_0x33161b[_0x0a9e('0x28')]+_0x33161b['limit'];var _0x3652a7;if(_0x1538a4>=_0x34dc65){_0x1538a4=_0x34dc65;_0x3652a7=0xc8;}else{_0x3652a7=0xce;}_0x40c424[_0x0a9e('0x23')](_0x3652a7);return _0x40c424[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x14433c+'-'+_0x1538a4+'/'+_0x34dc65)['json'](_0x526cf3);}return null;};}function patchUpdates(_0x15b200){return function(_0x40e7a3){try{jsonpatch[_0x0a9e('0x2b')](_0x40e7a3,_0x15b200,!![]);}catch(_0x824a4f){return BPromise[_0x0a9e('0x2c')](_0x824a4f);}return _0x40e7a3[_0x0a9e('0x2d')]();};}function saveUpdates(_0x296f41,_0x2e8759){return function(_0x1dbde2){if(_0x1dbde2){return _0x1dbde2['update'](_0x296f41)[_0x0a9e('0x19')](function(_0x5d1e0e){return _0x5d1e0e;});}return null;};}function removeEntity(_0x2407f9,_0x3ae878){return function(_0x1122db){if(_0x1122db){return _0x1122db[_0x0a9e('0x2e')]()[_0x0a9e('0x19')](function(){_0x2407f9['status'](0xcc)[_0x0a9e('0x24')]();});}};}function handleEntityNotFound(_0x46f0a5,_0x40cb85){return function(_0x2da5c0){if(!_0x2da5c0){_0x46f0a5[_0x0a9e('0x22')](0x194);}return _0x2da5c0;};}function handleError(_0x409319,_0x332d35){_0x332d35=_0x332d35||0x1f4;return function(_0x39e565){logger['error'](_0x39e565[_0x0a9e('0x2f')]);if(_0x39e565['name']){delete _0x39e565[_0x0a9e('0x30')];}_0x409319[_0x0a9e('0x23')](_0x332d35)[_0x0a9e('0x31')](_0x39e565);};}function getMustacheRender(_0x3f3d41,_0x567193){return Mustache[_0x0a9e('0x32')](_0x3f3d41,_[_0x0a9e('0x33')](_0x567193[_0x0a9e('0x34')],{'contact':_0x567193[_0x0a9e('0x35')],'message':_0x567193['message'],'agent':_0x567193['agent'],'interaction':_0x567193[_0x0a9e('0x36')],'account':_0x567193['account']}))||'';}exports[_0x0a9e('0x37')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x38')](db['FreshsalesAccount'][_0x0a9e('0x39')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3a')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x38')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x3c')]);_0x4f41ae[_0x0a9e('0x3e')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3c')]);_0x1ef87a[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x3d9717[_0x0a9e('0x3c')]['fields']));_0x1ef87a[_0x0a9e('0x3f')]=_0x1ef87a[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x1ef87a[_0x0a9e('0x3f')]:_0x4f41ae[_0x0a9e('0x3b')];if(!_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x1ef87a[_0x0a9e('0x44')]=qs[_0x0a9e('0x44')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x1ef87a[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x3d9717[_0x0a9e('0x3c')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3c')],_0x4f41ae[_0x0a9e('0x3e')]),_0x3bfce8);if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x33')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x38')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x49')]!==_0x0a9e('0x4a')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x30')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4b')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4c')][_0x0a9e('0x27')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x27')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x4d')]){_0x1ef87a[_0x0a9e('0x4e')]=[{'all':!![]}];}return db[_0x0a9e('0x4c')][_0x0a9e('0x4f')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x50')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x21')](handleError(_0x381c37,null));};exports[_0x0a9e('0x51')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db['FreshsalesAccount']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3d')](_0x992c77[_0x0a9e('0x3c')]);_0x34febd[_0x0a9e('0x3e')]=_[_0x0a9e('0x52')](_0x34febd[_0x0a9e('0x3b')],_0x34febd[_0x0a9e('0x3c')]);_0x19383e[_0x0a9e('0x3f')]=_[_0x0a9e('0x52')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x40')]));_0x19383e[_0x0a9e('0x3f')]=_0x19383e[_0x0a9e('0x3f')]['length']?_0x19383e[_0x0a9e('0x3f')]:_0x34febd[_0x0a9e('0x3b')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x4e')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4b')]);return db['FreshsalesAccount'][_0x0a9e('0x53')](_0x19383e)[_0x0a9e('0x19')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x19')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x54')]=function(_0x1bf38a,_0x508b47){return db['FreshsalesAccount'][_0x0a9e('0x54')](_0x1bf38a[_0x0a9e('0x34')],{})['then'](respondWithResult(_0x508b47,0xc9))[_0x0a9e('0x21')](handleError(_0x508b47,null));};exports['update']=function(_0x211ef9,_0x523cd2){if(_0x211ef9[_0x0a9e('0x34')]['id']){delete _0x211ef9['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x211ef9[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x19')](saveUpdates(_0x211ef9[_0x0a9e('0x34')],null))[_0x0a9e('0x19')](respondWithResult(_0x523cd2,null))[_0x0a9e('0x21')](handleError(_0x523cd2,null));};exports[_0x0a9e('0x2e')]=function(_0x272738,_0xd10662){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x272738[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0xd10662,null))[_0x0a9e('0x19')](removeEntity(_0xd10662,null))[_0x0a9e('0x21')](handleError(_0xd10662,null));};exports[_0x0a9e('0x56')]=function(_0x156662,_0x5d86e9,_0x956fbe){var _0x26bc80={};var _0x5239ef={};var _0x3649cc;var _0x5cc8fb;return db[_0x0a9e('0x4c')]['findOne']({'where':{'id':_0x156662['params']['id']}})['then'](handleEntityNotFound(_0x5d86e9,null))[_0x0a9e('0x19')](function(_0x49d231){if(_0x49d231){_0x3649cc=_0x49d231;_0x5239ef[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db[_0x0a9e('0x57')][_0x0a9e('0x39')]);_0x5239ef[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x156662['query']);_0x5239ef[_0x0a9e('0x3e')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],_0x5239ef[_0x0a9e('0x3c')]);_0x26bc80[_0x0a9e('0x3f')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x40')]));_0x26bc80['attributes']=_0x26bc80[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x26bc80['attributes']:_0x5239ef[_0x0a9e('0x3b')];_0x26bc80[_0x0a9e('0x58')]=qs[_0x0a9e('0x45')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x26bc80['where']=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x156662[_0x0a9e('0x3c')],_0x5239ef['filters']));if(_0x156662[_0x0a9e('0x3c')]['filter']){_0x26bc80['where']=_[_0x0a9e('0x33')](_0x26bc80[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x38')](_0x26bc80[_0x0a9e('0x3f')],function(_0x186f39){var _0xc8c264={};_0xc8c264[_0x186f39]={'$like':'%'+_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0xc8c264;})});}_0x26bc80=_[_0x0a9e('0x33')]({},_0x26bc80,_0x156662[_0x0a9e('0x4b')]);return _0x3649cc[_0x0a9e('0x56')](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x2bbb86){if(_0x2bbb86){_0x5cc8fb=_0x2bbb86[_0x0a9e('0x41')];if(!_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x26bc80[_0x0a9e('0x44')]=qs['limit'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x26bc80[_0x0a9e('0x28')]=qs['offset'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x28')]);}return _0x3649cc['getConfigurations'](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x56e31e){if(_0x56e31e){return _0x56e31e?{'count':_0x5cc8fb,'rows':_0x56e31e}:null;}})[_0x0a9e('0x19')](respondWithResult(_0x5d86e9,null))[_0x0a9e('0x21')](handleError(_0x5d86e9,null));};exports[_0x0a9e('0x59')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){if(_0x4a43a8[_0x0a9e('0x34')]['id']){delete _0x4a43a8[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x4a43a8[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x19')](function(_0x1a0677){if(_0x1a0677){_0x4a43a8['body'][_0x0a9e('0x5b')]=_0x1a0677['id'];_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5c')]=integrations['getSubjects'](_0x4a43a8[_0x0a9e('0x34')]['channel'],_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x49')]);_0x4a43a8['body'][_0x0a9e('0x5d')]=integrations[_0x0a9e('0x5e')](_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5f')],_0x4a43a8['body'][_0x0a9e('0x49')]);return db[_0x0a9e('0x57')][_0x0a9e('0x54')](_0x4a43a8[_0x0a9e('0x34')],{'include':[{'model':db['FreshsalesField'],'as':_0x0a9e('0x5c')},{'model':db[_0x0a9e('0x60')],'as':_0x0a9e('0x5d')}]});}return null;})[_0x0a9e('0x19')](respondWithResult(_0x50cdce,null))['catch'](handleError(_0x50cdce,null));};exports[_0x0a9e('0x61')]=function(_0x3511c9,_0x30a4c7,_0xf410e5){var _0x332367='';var _0xdb98ca='';return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x3511c9[_0x0a9e('0x55')]['id']},'attributes':['id',_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64')]})[_0x0a9e('0x19')](handleEntityNotFound(_0x30a4c7,null))[_0x0a9e('0x19')](function(_0x5b35db){if(_0x5b35db){_0xdb98ca=_0x5b35db[_0x0a9e('0x62')];_0x332367=_0x5b35db[_0x0a9e('0x63')];var _0xc599b3=_0x5b35db['remoteUri'][_0x0a9e('0x65')](-0x1);if(_0xc599b3==='/'){_0x332367=_0x332367[_0x0a9e('0x66')](0x0,_0x332367[_0x0a9e('0x67')](_0xc599b3));}return rp({'method':_0x0a9e('0x68'),'uri':util['format']('%s%s',_0x332367,_0x0a9e('0x69')),'headers':{'Authorization':_0x0a9e('0x6a')+_0x5b35db['apiKey']},'json':!![]});}})[_0x0a9e('0x19')](function(_0x53a6a1){if(_0x53a6a1){var _0x260f4b=_0x53a6a1[_0x0a9e('0x6b')];var _0x5637a1=![];var _0x28a942=null;for(_0x28a942=0x0;_0x28a942<_0x260f4b[_0x0a9e('0x41')];_0x28a942++){if(_0x260f4b[_0x28a942][_0x0a9e('0x6c')]===_0xdb98ca){_0x5637a1=!![];}}if(_0x5637a1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0a9e('0x6d')});}}})[_0x0a9e('0x19')](respondWithResult(_0x30a4c7,null))[_0x0a9e('0x21')](function(_0x444f1f){var _0x482ca2=_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?0x1f4:_0x444f1f[_0x0a9e('0x6f')]||0x1f4;logger[_0x0a9e('0x1d')]('getFields,\x20%s,\x20%s,\x20%s',_0x0a9e('0x61'),_0x482ca2,JSON[_0x0a9e('0x70')](_0x444f1f));delete _0x444f1f['name'];if(_0x482ca2===0x191){_0x482ca2=0x190;}_0x30a4c7[_0x0a9e('0x23')](_0x482ca2)['send'](_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?{'message':_0x0a9e('0x71'),'statusCode':_0x444f1f[_0x0a9e('0x6f')]}:_0x444f1f);});}; \ No newline at end of file +var _0xa9e0=['merge','body','contact','interaction','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','show','intersection','find','create','params','getConfigurations','FreshsalesConfiguration','order','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','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','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','render'];(function(_0x1353ab,_0x1051af){var _0x53b442=function(_0x2f68db){while(--_0x2f68db){_0x1353ab['push'](_0x1353ab['shift']());}};_0x53b442(++_0x1051af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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'];var integrations=require(_0x0a9e('0x15'));var jayson=require(_0x0a9e('0x16'));var client=jayson[_0x0a9e('0x17')][_0x0a9e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5db4b0,_0x4283ce,_0x239b12,_0x2b4227){return new BPromise(function(_0x281129,_0x44dcfd){var _0x4d5611=_0x2b4227||client;return _0x4d5611['request'](_0x5db4b0,_0x239b12)[_0x0a9e('0x19')](function(_0x5d0880){logger[_0x0a9e('0x1a')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'));logger[_0x0a9e('0x1c')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'),JSON['stringify'](_0x5d0880));if(_0x5d0880[_0x0a9e('0x1d')]){if(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);return _0x44dcfd(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')]['message']);return _0x281129(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}else{logger['info'](_0x0a9e('0x1f'),_0x4283ce,'request\x20sent');_0x281129(_0x5d0880['result'][_0x0a9e('0x20')]);}})[_0x0a9e('0x21')](function(_0x38e7c4){logger[_0x0a9e('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x38e7c4);_0x44dcfd(_0x38e7c4);});});}function respondWithStatusCode(_0xfb6e48,_0x2fb0e4){_0x2fb0e4=_0x2fb0e4||0xcc;return function(_0x3b45bc){if(_0x3b45bc){return _0xfb6e48[_0x0a9e('0x22')](_0x2fb0e4);}return _0xfb6e48[_0x0a9e('0x23')](_0x2fb0e4)[_0x0a9e('0x24')]();};}function respondWithResult(_0x16b1ca,_0x5ea472){_0x5ea472=_0x5ea472||0xc8;return function(_0x59181e){if(_0x59181e){return _0x16b1ca[_0x0a9e('0x23')](_0x5ea472)[_0x0a9e('0x25')](_0x59181e);}};}function respondWithFilteredResult(_0x40c424,_0x33161b){return function(_0x526cf3){if(_0x526cf3){var _0x384319=typeof _0x33161b['offset']===_0x0a9e('0x26')&&typeof _0x33161b['limit']===_0x0a9e('0x26');var _0x34dc65=_0x526cf3[_0x0a9e('0x27')];var _0x14433c=_0x384319?0x0:_0x33161b[_0x0a9e('0x28')];var _0x1538a4=_0x384319?_0x526cf3[_0x0a9e('0x27')]:_0x33161b[_0x0a9e('0x28')]+_0x33161b['limit'];var _0x3652a7;if(_0x1538a4>=_0x34dc65){_0x1538a4=_0x34dc65;_0x3652a7=0xc8;}else{_0x3652a7=0xce;}_0x40c424[_0x0a9e('0x23')](_0x3652a7);return _0x40c424[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x14433c+'-'+_0x1538a4+'/'+_0x34dc65)['json'](_0x526cf3);}return null;};}function patchUpdates(_0x15b200){return function(_0x40e7a3){try{jsonpatch[_0x0a9e('0x2b')](_0x40e7a3,_0x15b200,!![]);}catch(_0x824a4f){return BPromise[_0x0a9e('0x2c')](_0x824a4f);}return _0x40e7a3[_0x0a9e('0x2d')]();};}function saveUpdates(_0x296f41,_0x2e8759){return function(_0x1dbde2){if(_0x1dbde2){return _0x1dbde2['update'](_0x296f41)[_0x0a9e('0x19')](function(_0x5d1e0e){return _0x5d1e0e;});}return null;};}function removeEntity(_0x2407f9,_0x3ae878){return function(_0x1122db){if(_0x1122db){return _0x1122db[_0x0a9e('0x2e')]()[_0x0a9e('0x19')](function(){_0x2407f9['status'](0xcc)[_0x0a9e('0x24')]();});}};}function handleEntityNotFound(_0x46f0a5,_0x40cb85){return function(_0x2da5c0){if(!_0x2da5c0){_0x46f0a5[_0x0a9e('0x22')](0x194);}return _0x2da5c0;};}function handleError(_0x409319,_0x332d35){_0x332d35=_0x332d35||0x1f4;return function(_0x39e565){logger['error'](_0x39e565[_0x0a9e('0x2f')]);if(_0x39e565['name']){delete _0x39e565[_0x0a9e('0x30')];}_0x409319[_0x0a9e('0x23')](_0x332d35)[_0x0a9e('0x31')](_0x39e565);};}function getMustacheRender(_0x3f3d41,_0x567193){return Mustache[_0x0a9e('0x32')](_0x3f3d41,_[_0x0a9e('0x33')](_0x567193[_0x0a9e('0x34')],{'contact':_0x567193[_0x0a9e('0x35')],'message':_0x567193['message'],'agent':_0x567193['agent'],'interaction':_0x567193[_0x0a9e('0x36')],'account':_0x567193['account']}))||'';}exports[_0x0a9e('0x37')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x38')](db['FreshsalesAccount'][_0x0a9e('0x39')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3a')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x38')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x3c')]);_0x4f41ae[_0x0a9e('0x3e')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3c')]);_0x1ef87a[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x3d9717[_0x0a9e('0x3c')]['fields']));_0x1ef87a[_0x0a9e('0x3f')]=_0x1ef87a[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x1ef87a[_0x0a9e('0x3f')]:_0x4f41ae[_0x0a9e('0x3b')];if(!_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x1ef87a[_0x0a9e('0x44')]=qs[_0x0a9e('0x44')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x1ef87a[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x3d9717[_0x0a9e('0x3c')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3c')],_0x4f41ae[_0x0a9e('0x3e')]),_0x3bfce8);if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x33')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x38')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x49')]!==_0x0a9e('0x4a')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x30')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4b')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4c')][_0x0a9e('0x27')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x27')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x4d')]){_0x1ef87a[_0x0a9e('0x4e')]=[{'all':!![]}];}return db[_0x0a9e('0x4c')][_0x0a9e('0x4f')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x50')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x21')](handleError(_0x381c37,null));};exports[_0x0a9e('0x51')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db['FreshsalesAccount']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3d')](_0x992c77[_0x0a9e('0x3c')]);_0x34febd[_0x0a9e('0x3e')]=_[_0x0a9e('0x52')](_0x34febd[_0x0a9e('0x3b')],_0x34febd[_0x0a9e('0x3c')]);_0x19383e[_0x0a9e('0x3f')]=_[_0x0a9e('0x52')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x40')]));_0x19383e[_0x0a9e('0x3f')]=_0x19383e[_0x0a9e('0x3f')]['length']?_0x19383e[_0x0a9e('0x3f')]:_0x34febd[_0x0a9e('0x3b')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x4e')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4b')]);return db['FreshsalesAccount'][_0x0a9e('0x53')](_0x19383e)[_0x0a9e('0x19')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x19')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x54')]=function(_0x1bf38a,_0x508b47){return db['FreshsalesAccount'][_0x0a9e('0x54')](_0x1bf38a[_0x0a9e('0x34')],{})['then'](respondWithResult(_0x508b47,0xc9))[_0x0a9e('0x21')](handleError(_0x508b47,null));};exports['update']=function(_0x211ef9,_0x523cd2){if(_0x211ef9[_0x0a9e('0x34')]['id']){delete _0x211ef9['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x211ef9[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x19')](saveUpdates(_0x211ef9[_0x0a9e('0x34')],null))[_0x0a9e('0x19')](respondWithResult(_0x523cd2,null))[_0x0a9e('0x21')](handleError(_0x523cd2,null));};exports[_0x0a9e('0x2e')]=function(_0x272738,_0xd10662){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x272738[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0xd10662,null))[_0x0a9e('0x19')](removeEntity(_0xd10662,null))[_0x0a9e('0x21')](handleError(_0xd10662,null));};exports[_0x0a9e('0x56')]=function(_0x156662,_0x5d86e9,_0x956fbe){var _0x26bc80={};var _0x5239ef={};var _0x3649cc;var _0x5cc8fb;return db[_0x0a9e('0x4c')]['findOne']({'where':{'id':_0x156662['params']['id']}})['then'](handleEntityNotFound(_0x5d86e9,null))[_0x0a9e('0x19')](function(_0x49d231){if(_0x49d231){_0x3649cc=_0x49d231;_0x5239ef[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db[_0x0a9e('0x57')][_0x0a9e('0x39')]);_0x5239ef[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x156662['query']);_0x5239ef[_0x0a9e('0x3e')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],_0x5239ef[_0x0a9e('0x3c')]);_0x26bc80[_0x0a9e('0x3f')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x40')]));_0x26bc80['attributes']=_0x26bc80[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x26bc80['attributes']:_0x5239ef[_0x0a9e('0x3b')];_0x26bc80[_0x0a9e('0x58')]=qs[_0x0a9e('0x45')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x26bc80['where']=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x156662[_0x0a9e('0x3c')],_0x5239ef['filters']));if(_0x156662[_0x0a9e('0x3c')]['filter']){_0x26bc80['where']=_[_0x0a9e('0x33')](_0x26bc80[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x38')](_0x26bc80[_0x0a9e('0x3f')],function(_0x186f39){var _0xc8c264={};_0xc8c264[_0x186f39]={'$like':'%'+_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0xc8c264;})});}_0x26bc80=_[_0x0a9e('0x33')]({},_0x26bc80,_0x156662[_0x0a9e('0x4b')]);return _0x3649cc[_0x0a9e('0x56')](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x2bbb86){if(_0x2bbb86){_0x5cc8fb=_0x2bbb86[_0x0a9e('0x41')];if(!_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x26bc80[_0x0a9e('0x44')]=qs['limit'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x26bc80[_0x0a9e('0x28')]=qs['offset'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x28')]);}return _0x3649cc['getConfigurations'](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x56e31e){if(_0x56e31e){return _0x56e31e?{'count':_0x5cc8fb,'rows':_0x56e31e}:null;}})[_0x0a9e('0x19')](respondWithResult(_0x5d86e9,null))[_0x0a9e('0x21')](handleError(_0x5d86e9,null));};exports[_0x0a9e('0x59')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){if(_0x4a43a8[_0x0a9e('0x34')]['id']){delete _0x4a43a8[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x4a43a8[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x19')](function(_0x1a0677){if(_0x1a0677){_0x4a43a8['body'][_0x0a9e('0x5b')]=_0x1a0677['id'];_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5c')]=integrations['getSubjects'](_0x4a43a8[_0x0a9e('0x34')]['channel'],_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x49')]);_0x4a43a8['body'][_0x0a9e('0x5d')]=integrations[_0x0a9e('0x5e')](_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5f')],_0x4a43a8['body'][_0x0a9e('0x49')]);return db[_0x0a9e('0x57')][_0x0a9e('0x54')](_0x4a43a8[_0x0a9e('0x34')],{'include':[{'model':db['FreshsalesField'],'as':_0x0a9e('0x5c')},{'model':db[_0x0a9e('0x60')],'as':_0x0a9e('0x5d')}]});}return null;})[_0x0a9e('0x19')](respondWithResult(_0x50cdce,null))['catch'](handleError(_0x50cdce,null));};exports[_0x0a9e('0x61')]=function(_0x3511c9,_0x30a4c7,_0xf410e5){var _0x332367='';var _0xdb98ca='';return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x3511c9[_0x0a9e('0x55')]['id']},'attributes':['id',_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64')]})[_0x0a9e('0x19')](handleEntityNotFound(_0x30a4c7,null))[_0x0a9e('0x19')](function(_0x5b35db){if(_0x5b35db){_0xdb98ca=_0x5b35db[_0x0a9e('0x62')];_0x332367=_0x5b35db[_0x0a9e('0x63')];var _0xc599b3=_0x5b35db['remoteUri'][_0x0a9e('0x65')](-0x1);if(_0xc599b3==='/'){_0x332367=_0x332367[_0x0a9e('0x66')](0x0,_0x332367[_0x0a9e('0x67')](_0xc599b3));}return rp({'method':_0x0a9e('0x68'),'uri':util['format']('%s%s',_0x332367,_0x0a9e('0x69')),'headers':{'Authorization':_0x0a9e('0x6a')+_0x5b35db['apiKey']},'json':!![]});}})[_0x0a9e('0x19')](function(_0x53a6a1){if(_0x53a6a1){var _0x260f4b=_0x53a6a1[_0x0a9e('0x6b')];var _0x5637a1=![];var _0x28a942=null;for(_0x28a942=0x0;_0x28a942<_0x260f4b[_0x0a9e('0x41')];_0x28a942++){if(_0x260f4b[_0x28a942][_0x0a9e('0x6c')]===_0xdb98ca){_0x5637a1=!![];}}if(_0x5637a1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0a9e('0x6d')});}}})[_0x0a9e('0x19')](respondWithResult(_0x30a4c7,null))[_0x0a9e('0x21')](function(_0x444f1f){var _0x482ca2=_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?0x1f4:_0x444f1f[_0x0a9e('0x6f')]||0x1f4;logger[_0x0a9e('0x1d')]('getFields,\x20%s,\x20%s,\x20%s',_0x0a9e('0x61'),_0x482ca2,JSON[_0x0a9e('0x70')](_0x444f1f));delete _0x444f1f['name'];if(_0x482ca2===0x191){_0x482ca2=0x190;}_0x30a4c7[_0x0a9e('0x23')](_0x482ca2)['send'](_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?{'message':_0x0a9e('0x71'),'statusCode':_0x444f1f[_0x0a9e('0x6f')]}:_0x444f1f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2e83e45..10ee45b 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 _0x84ac=['FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x278b1b,_0x166d0a){var _0x527caa=function(_0x1067ac){while(--_0x1067ac){_0x278b1b['push'](_0x278b1b['shift']());}};_0x527caa(++_0x166d0a);}(_0x84ac,0x14c));var _0xc84a=function(_0x5f3562,_0x212f41){_0x5f3562=_0x5f3562-0x0;var _0x1b39b4=_0x84ac[_0x5f3562];return _0x1b39b4;};'use strict';var _=require(_0xc84a('0x0'));var util=require(_0xc84a('0x1'));var logger=require(_0xc84a('0x2'))(_0xc84a('0x3'));var moment=require(_0xc84a('0x4'));var BPromise=require(_0xc84a('0x5'));var rp=require(_0xc84a('0x6'));var fs=require('fs');var path=require(_0xc84a('0x7'));var rimraf=require('rimraf');var config=require(_0xc84a('0x8'));var attributes=require(_0xc84a('0x9'));var integrations=require(_0xc84a('0xa'));module[_0xc84a('0xb')]=function(_0x3193fc,_0x36496d){return _0x3193fc[_0xc84a('0xc')](_0xc84a('0xd'),attributes,{'tableName':_0xc84a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e3b=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x41d9e7,_0x33ef4a){var _0x282c36=function(_0x2bb2a5){while(--_0x2bb2a5){_0x41d9e7['push'](_0x41d9e7['shift']());}};_0x282c36(++_0x33ef4a);}(_0x7e3b,0xd8));var _0xb7e3=function(_0x43fbd1,_0x2f9e4d){_0x43fbd1=_0x43fbd1-0x0;var _0x2ec78a=_0x7e3b[_0x43fbd1];return _0x2ec78a;};'use strict';var _=require('lodash');var util=require(_0xb7e3('0x0'));var logger=require(_0xb7e3('0x1'))(_0xb7e3('0x2'));var moment=require(_0xb7e3('0x3'));var BPromise=require(_0xb7e3('0x4'));var rp=require(_0xb7e3('0x5'));var fs=require('fs');var path=require(_0xb7e3('0x6'));var rimraf=require(_0xb7e3('0x7'));var config=require(_0xb7e3('0x8'));var attributes=require(_0xb7e3('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xb7e3('0xa')]=function(_0x146c05,_0x5adf40){return _0x146c05[_0xb7e3('0xb')]('FreshsalesAccount',attributes,{'tableName':_0xb7e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 761bab2..5054951 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 _0x97e6=['info','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','map','include','model','stringify','find','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message'];(function(_0xb50f29,_0xbdf53f){var _0x1a629b=function(_0x4f2de3){while(--_0x4f2de3){_0xb50f29['push'](_0xb50f29['shift']());}};_0x1a629b(++_0xbdf53f);}(_0x97e6,0x159));var _0x697e=function(_0x4b0830,_0x2e3b0a){_0x4b0830=_0x4b0830-0x0;var _0x1f53a7=_0x97e6[_0x4b0830];return _0x1f53a7;};'use strict';var _=require(_0x697e('0x0'));var util=require('util');var moment=require(_0x697e('0x1'));var BPromise=require(_0x697e('0x2'));var rs=require(_0x697e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x697e('0x4'))['db'];var utils=require(_0x697e('0x5'));var logger=require('../../config/logger')(_0x697e('0x6'));var config=require('../../config/environment');var jayson=require(_0x697e('0x7'));var client=jayson[_0x697e('0x8')][_0x697e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x546438,_0x371e2f,_0x21b9d5){return new BPromise(function(_0x4cf39f,_0x5670e3){return client[_0x697e('0xa')](_0x546438,_0x21b9d5)[_0x697e('0xb')](function(_0x2499f6){logger['info'](_0x697e('0xc'),_0x371e2f,_0x697e('0xd'));logger[_0x697e('0xe')](_0x697e('0xf'),_0x371e2f,_0x697e('0xd'),JSON['stringify'](_0x2499f6));if(_0x2499f6[_0x697e('0x10')]){if(_0x2499f6['error']['code']===0x1f4){logger[_0x697e('0x10')](_0x697e('0xc'),_0x371e2f,_0x2499f6[_0x697e('0x10')]['message']);return _0x5670e3(_0x2499f6[_0x697e('0x10')][_0x697e('0x11')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x371e2f,_0x2499f6[_0x697e('0x10')][_0x697e('0x11')]);return _0x4cf39f(_0x2499f6[_0x697e('0x10')][_0x697e('0x11')]);}else{logger[_0x697e('0x12')](_0x697e('0xc'),_0x371e2f,_0x697e('0xd'));_0x4cf39f(_0x2499f6[_0x697e('0x13')][_0x697e('0x11')]);}})['catch'](function(_0x316bdb){logger[_0x697e('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x371e2f,_0x316bdb);_0x5670e3(_0x316bdb);});});}exports[_0x697e('0x14')]=function(_0x5edd20){var _0x233404=this;return new Promise(function(_0x281216,_0x50da1e){return db[_0x697e('0x15')][_0x697e('0x16')]({'raw':_0x5edd20[_0x697e('0x17')]?_0x5edd20[_0x697e('0x17')][_0x697e('0x18')]===undefined?!![]:![]:!![],'where':_0x5edd20[_0x697e('0x17')]?_0x5edd20[_0x697e('0x17')][_0x697e('0x19')]||null:null,'attributes':_0x5edd20[_0x697e('0x17')]?_0x5edd20[_0x697e('0x17')][_0x697e('0x1a')]||null:null,'limit':_0x5edd20['options']?_0x5edd20[_0x697e('0x17')]['limit']||null:null,'include':_0x5edd20[_0x697e('0x17')]?_0x5edd20[_0x697e('0x17')]['include']?_[_0x697e('0x1b')](_0x5edd20['options'][_0x697e('0x1c')],function(_0x1afb71){return{'model':db[_0x1afb71[_0x697e('0x1d')]],'as':_0x1afb71['as'],'attributes':_0x1afb71[_0x697e('0x1a')],'include':_0x1afb71[_0x697e('0x1c')]?_['map'](_0x1afb71['include'],function(_0xc3d9d0){return{'model':db[_0xc3d9d0[_0x697e('0x1d')]],'as':_0xc3d9d0['as'],'attributes':_0xc3d9d0[_0x697e('0x1a')],'include':_0xc3d9d0[_0x697e('0x1c')]?_[_0x697e('0x1b')](_0xc3d9d0[_0x697e('0x1c')],function(_0x3df903){return{'model':db[_0x3df903['model']],'as':_0x3df903['as'],'attributes':_0x3df903['attributes']};}):[]};}):[]};}):[]:[]})[_0x697e('0xb')](function(_0x2cc855){logger[_0x697e('0x12')](_0x697e('0x14'),_0x5edd20);logger[_0x697e('0xe')](_0x697e('0x14'),_0x5edd20,JSON[_0x697e('0x1e')](_0x2cc855));_0x281216(_0x2cc855);})['catch'](function(_0x492b6a){logger['error'](_0x697e('0x14'),_0x492b6a['message'],_0x5edd20);_0x50da1e(_0x233404['error'](0x1f4,_0x492b6a['message']));});});};exports['ShowFreshsalesAccount']=function(_0x367f74){var _0x27a2da=this;return new Promise(function(_0x164cef,_0x2ead8f){return db['FreshsalesAccount'][_0x697e('0x1f')]({'raw':_0x367f74[_0x697e('0x17')]?_0x367f74[_0x697e('0x17')][_0x697e('0x18')]===undefined?!![]:![]:!![],'where':_0x367f74[_0x697e('0x17')]?_0x367f74[_0x697e('0x17')]['where']||null:null,'attributes':_0x367f74['options']?_0x367f74[_0x697e('0x17')][_0x697e('0x1a')]||null:null,'include':_0x367f74['options']?_0x367f74[_0x697e('0x17')][_0x697e('0x1c')]?_['map'](_0x367f74[_0x697e('0x17')][_0x697e('0x1c')],function(_0x2e72c0){return{'model':db[_0x2e72c0[_0x697e('0x1d')]],'as':_0x2e72c0['as'],'attributes':_0x2e72c0[_0x697e('0x1a')],'include':_0x2e72c0[_0x697e('0x1c')]?_['map'](_0x2e72c0[_0x697e('0x1c')],function(_0x54ae43){return{'model':db[_0x54ae43['model']],'as':_0x54ae43['as'],'attributes':_0x54ae43[_0x697e('0x1a')],'include':_0x54ae43[_0x697e('0x1c')]?_[_0x697e('0x1b')](_0x54ae43['include'],function(_0x12e96b){return{'model':db[_0x12e96b[_0x697e('0x1d')]],'as':_0x12e96b['as'],'attributes':_0x12e96b[_0x697e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ea6fe){logger[_0x697e('0x12')](_0x697e('0x20'),_0x367f74);logger[_0x697e('0xe')](_0x697e('0x20'),_0x367f74,JSON['stringify'](_0x2ea6fe));_0x164cef(_0x2ea6fe);})['catch'](function(_0x2cb01e){logger[_0x697e('0x10')](_0x697e('0x20'),_0x2cb01e[_0x697e('0x11')],_0x367f74);_0x2ead8f(_0x27a2da[_0x697e('0x10')](0x1f4,_0x2cb01e[_0x697e('0x11')]));});});}; \ No newline at end of file +var _0x8fd4=['FreshsalesAccount,\x20%s,\x20%s','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x16d0de,_0x10cacd){var _0x1d3348=function(_0x1450eb){while(--_0x1450eb){_0x16d0de['push'](_0x16d0de['shift']());}};_0x1d3348(++_0x10cacd);}(_0x8fd4,0x178));var _0x48fd=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x8fd4[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var util=require(_0x48fd('0x0'));var moment=require(_0x48fd('0x1'));var BPromise=require(_0x48fd('0x2'));var rs=require(_0x48fd('0x3'));var fs=require('fs');var Redis=require(_0x48fd('0x4'));var db=require(_0x48fd('0x5'))['db'];var utils=require(_0x48fd('0x6'));var logger=require('../../config/logger')(_0x48fd('0x7'));var config=require(_0x48fd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x48fd('0x9')][_0x48fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x177a7f,_0x46f4a1,_0x25a8e6){return new BPromise(function(_0x344f0d,_0x46bd0b){return client[_0x48fd('0xb')](_0x177a7f,_0x25a8e6)[_0x48fd('0xc')](function(_0x4a3e64){logger[_0x48fd('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x46f4a1,_0x48fd('0xe'));logger[_0x48fd('0xf')](_0x48fd('0x10'),_0x46f4a1,_0x48fd('0xe'),JSON[_0x48fd('0x11')](_0x4a3e64));if(_0x4a3e64[_0x48fd('0x12')]){if(_0x4a3e64[_0x48fd('0x12')][_0x48fd('0x13')]===0x1f4){logger[_0x48fd('0x12')](_0x48fd('0x14'),_0x46f4a1,_0x4a3e64['error'][_0x48fd('0x15')]);return _0x46bd0b(_0x4a3e64[_0x48fd('0x12')][_0x48fd('0x15')]);}logger[_0x48fd('0x12')](_0x48fd('0x14'),_0x46f4a1,_0x4a3e64[_0x48fd('0x12')][_0x48fd('0x15')]);return _0x344f0d(_0x4a3e64[_0x48fd('0x12')][_0x48fd('0x15')]);}else{logger[_0x48fd('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x46f4a1,'request\x20sent');_0x344f0d(_0x4a3e64['result'][_0x48fd('0x15')]);}})[_0x48fd('0x16')](function(_0x39033f){logger[_0x48fd('0x12')](_0x48fd('0x14'),_0x46f4a1,_0x39033f);_0x46bd0b(_0x39033f);});});}exports[_0x48fd('0x17')]=function(_0x476fb0){var _0x219c77=this;return new Promise(function(_0x18fc29,_0x1efa97){return db[_0x48fd('0x18')][_0x48fd('0x19')]({'raw':_0x476fb0[_0x48fd('0x1a')]?_0x476fb0[_0x48fd('0x1a')][_0x48fd('0x1b')]===undefined?!![]:![]:!![],'where':_0x476fb0[_0x48fd('0x1a')]?_0x476fb0['options'][_0x48fd('0x1c')]||null:null,'attributes':_0x476fb0['options']?_0x476fb0[_0x48fd('0x1a')][_0x48fd('0x1d')]||null:null,'limit':_0x476fb0[_0x48fd('0x1a')]?_0x476fb0[_0x48fd('0x1a')][_0x48fd('0x1e')]||null:null,'include':_0x476fb0[_0x48fd('0x1a')]?_0x476fb0['options'][_0x48fd('0x1f')]?_[_0x48fd('0x20')](_0x476fb0[_0x48fd('0x1a')][_0x48fd('0x1f')],function(_0x44bbb3){return{'model':db[_0x44bbb3[_0x48fd('0x21')]],'as':_0x44bbb3['as'],'attributes':_0x44bbb3[_0x48fd('0x1d')],'include':_0x44bbb3['include']?_['map'](_0x44bbb3[_0x48fd('0x1f')],function(_0x2e3d6c){return{'model':db[_0x2e3d6c[_0x48fd('0x21')]],'as':_0x2e3d6c['as'],'attributes':_0x2e3d6c[_0x48fd('0x1d')],'include':_0x2e3d6c[_0x48fd('0x1f')]?_[_0x48fd('0x20')](_0x2e3d6c['include'],function(_0x5e3947){return{'model':db[_0x5e3947[_0x48fd('0x21')]],'as':_0x5e3947['as'],'attributes':_0x5e3947[_0x48fd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x48fd('0xc')](function(_0x20406c){logger[_0x48fd('0xd')](_0x48fd('0x17'),_0x476fb0);logger['debug'](_0x48fd('0x17'),_0x476fb0,JSON[_0x48fd('0x11')](_0x20406c));_0x18fc29(_0x20406c);})[_0x48fd('0x16')](function(_0x5b16d0){logger[_0x48fd('0x12')](_0x48fd('0x17'),_0x5b16d0[_0x48fd('0x15')],_0x476fb0);_0x1efa97(_0x219c77['error'](0x1f4,_0x5b16d0[_0x48fd('0x15')]));});});};exports[_0x48fd('0x22')]=function(_0x30ce8b){var _0x178a6c=this;return new Promise(function(_0x31b807,_0x45913d){return db[_0x48fd('0x18')][_0x48fd('0x23')]({'raw':_0x30ce8b[_0x48fd('0x1a')]?_0x30ce8b[_0x48fd('0x1a')][_0x48fd('0x1b')]===undefined?!![]:![]:!![],'where':_0x30ce8b[_0x48fd('0x1a')]?_0x30ce8b[_0x48fd('0x1a')][_0x48fd('0x1c')]||null:null,'attributes':_0x30ce8b[_0x48fd('0x1a')]?_0x30ce8b['options']['attributes']||null:null,'include':_0x30ce8b[_0x48fd('0x1a')]?_0x30ce8b[_0x48fd('0x1a')][_0x48fd('0x1f')]?_[_0x48fd('0x20')](_0x30ce8b[_0x48fd('0x1a')][_0x48fd('0x1f')],function(_0x1dee22){return{'model':db[_0x1dee22[_0x48fd('0x21')]],'as':_0x1dee22['as'],'attributes':_0x1dee22['attributes'],'include':_0x1dee22[_0x48fd('0x1f')]?_[_0x48fd('0x20')](_0x1dee22[_0x48fd('0x1f')],function(_0x7c3ee7){return{'model':db[_0x7c3ee7[_0x48fd('0x21')]],'as':_0x7c3ee7['as'],'attributes':_0x7c3ee7[_0x48fd('0x1d')],'include':_0x7c3ee7[_0x48fd('0x1f')]?_[_0x48fd('0x20')](_0x7c3ee7[_0x48fd('0x1f')],function(_0x51e3cc){return{'model':db[_0x51e3cc['model']],'as':_0x51e3cc['as'],'attributes':_0x51e3cc[_0x48fd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x48fd('0xc')](function(_0x3e385f){logger['info'](_0x48fd('0x22'),_0x30ce8b);logger[_0x48fd('0xf')]('ShowFreshsalesAccount',_0x30ce8b,JSON['stringify'](_0x3e385f));_0x31b807(_0x3e385f);})[_0x48fd('0x16')](function(_0x47f2aa){logger['error'](_0x48fd('0x22'),_0x47f2aa['message'],_0x30ce8b);_0x45913d(_0x178a6c['error'](0x1f4,_0x47f2aa[_0x48fd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index eee5378..556f1c5 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 _0x4727=['get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/fields','getFields','post','create','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x4727,0x83));var _0x7472=function(_0xd733c6,_0x42e67f){_0xd733c6=_0xd733c6-0x0;var _0x25ac50=_0x4727[_0xd733c6];return _0x25ac50;};'use strict';var multer=require(_0x7472('0x0'));var util=require(_0x7472('0x1'));var path=require(_0x7472('0x2'));var timeout=require(_0x7472('0x3'));var express=require(_0x7472('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7472('0x5'));var interaction=require(_0x7472('0x6'));var config=require(_0x7472('0x7'));var controller=require(_0x7472('0x8'));router[_0x7472('0x9')]('/',auth[_0x7472('0xa')](),controller[_0x7472('0xb')]);router[_0x7472('0x9')](_0x7472('0xc'),auth[_0x7472('0xa')](),controller[_0x7472('0xd')]);router[_0x7472('0x9')](_0x7472('0xe'),auth[_0x7472('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x7472('0xa')](),controller['getDescriptions']);router[_0x7472('0x9')](_0x7472('0xf'),auth['isAuthenticated'](),controller[_0x7472('0x10')]);router[_0x7472('0x11')]('/',auth[_0x7472('0xa')](),controller[_0x7472('0x12')]);router['put'](_0x7472('0xc'),auth[_0x7472('0xa')](),controller['update']);router['delete'](_0x7472('0xc'),auth['isAuthenticated'](),controller[_0x7472('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4961=['exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','/:id','update','destroy'];(function(_0x4e80c0,_0x484225){var _0x38f6e9=function(_0x48cf32){while(--_0x48cf32){_0x4e80c0['push'](_0x4e80c0['shift']());}};_0x38f6e9(++_0x484225);}(_0x4961,0x143));var _0x1496=function(_0x432b94,_0x1ba5bb){_0x432b94=_0x432b94-0x0;var _0x3fe9d3=_0x4961[_0x432b94];return _0x3fe9d3;};'use strict';var multer=require(_0x1496('0x0'));var util=require('util');var path=require(_0x1496('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1496('0x2')]();var fs_extra=require(_0x1496('0x3'));var auth=require(_0x1496('0x4'));var interaction=require(_0x1496('0x5'));var config=require('../../config/environment');var controller=require(_0x1496('0x6'));router['get']('/',auth[_0x1496('0x7')](),controller[_0x1496('0x8')]);router[_0x1496('0x9')]('/:id',auth[_0x1496('0x7')](),controller[_0x1496('0xa')]);router[_0x1496('0x9')](_0x1496('0xb'),auth[_0x1496('0x7')](),controller[_0x1496('0xc')]);router['get'](_0x1496('0xd'),auth[_0x1496('0x7')](),controller[_0x1496('0xe')]);router[_0x1496('0x9')](_0x1496('0xf'),auth[_0x1496('0x7')](),controller[_0x1496('0x10')]);router['post']('/',auth[_0x1496('0x7')](),controller[_0x1496('0x11')]);router[_0x1496('0x12')](_0x1496('0x13'),auth[_0x1496('0x7')](),controller[_0x1496('0x14')]);router['delete'](_0x1496('0x13'),auth[_0x1496('0x7')](),controller[_0x1496('0x15')]);module[_0x1496('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 658342b..7521fe0 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 _0x4e5d=['sequelize','STRING'];(function(_0x1ad68e,_0x16562f){var _0x82d21e=function(_0x755572){while(--_0x755572){_0x1ad68e['push'](_0x1ad68e['shift']());}};_0x82d21e(++_0x16562f);}(_0x4e5d,0x19a));var _0xd4e5=function(_0xca581e,_0x5975df){_0xca581e=_0xca581e-0x0;var _0x5ddecd=_0x4e5d[_0xca581e];return _0x5ddecd;};'use strict';var Sequelize=require(_0xd4e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xd4e5('0x1')]},'description':{'type':Sequelize[_0xd4e5('0x1')]}}; \ No newline at end of file +var _0x898d=['STRING','sequelize'];(function(_0x318243,_0x1eb46c){var _0x39c778=function(_0x38383d){while(--_0x38383d){_0x318243['push'](_0x318243['shift']());}};_0x39c778(++_0x1eb46c);}(_0x898d,0x6f));var _0xd898=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x898d[_0x2ade6c];return _0x2cb372;};'use strict';var Sequelize=require(_0xd898('0x0'));module['exports']={'name':{'type':Sequelize[_0xd898('0x1')]},'description':{'type':Sequelize[_0xd898('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 83dbfed..55c36e8 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 _0x177f=['model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','rawAttributes','length','find','create','catch','findOne','FreshsalesField','order','getSubjects','getDescriptions','getFields','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','destroy','stack','send','body','agent','index','map','FreshsalesConfiguration','fieldName','type','key'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x177f,0x1dd));var _0xf177=function(_0x7fdd52,_0x2f4498){_0x7fdd52=_0x7fdd52-0x0;var _0x369401=_0x177f[_0x7fdd52];return _0x369401;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf177('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf177('0x1'));var rp=require(_0xf177('0x2'));var moment=require(_0xf177('0x3'));var BPromise=require(_0xf177('0x4'));var Mustache=require(_0xf177('0x5'));var util=require('util');var path=require(_0xf177('0x6'));var sox=require(_0xf177('0x7'));var csv=require(_0xf177('0x8'));var ejs=require(_0xf177('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf177('0xa'));var squel=require(_0xf177('0xb'));var crypto=require(_0xf177('0xc'));var jsforce=require(_0xf177('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf177('0x8'));var querystring=require('querystring');var Papa=require(_0xf177('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf177('0xf'));var as=require(_0xf177('0x10'));var hardwareService=require(_0xf177('0x11'));var logger=require('../../config/logger')(_0xf177('0x12'));var utils=require(_0xf177('0x13'));var config=require(_0xf177('0x14'));var licenseUtil=require(_0xf177('0x15'));var db=require(_0xf177('0x16'))['db'];var jayson=require(_0xf177('0x17'));var client=jayson[_0xf177('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1aa907,_0x486337,_0x16e2bc,_0x5ec5f0){return new BPromise(function(_0x1c67ea,_0xad8e92){var _0x2bc6f6=_0x5ec5f0||client;return _0x2bc6f6[_0xf177('0x19')](_0x1aa907,_0x16e2bc)[_0xf177('0x1a')](function(_0x3ebb55){logger[_0xf177('0x1b')](_0xf177('0x1c'),_0x486337,'request\x20sent');logger['debug'](_0xf177('0x1d'),_0x486337,'request\x20sent',JSON[_0xf177('0x1e')](_0x3ebb55));if(_0x3ebb55[_0xf177('0x1f')]){if(_0x3ebb55[_0xf177('0x1f')][_0xf177('0x20')]===0x1f4){logger[_0xf177('0x1f')](_0xf177('0x1c'),_0x486337,_0x3ebb55[_0xf177('0x1f')][_0xf177('0x21')]);return _0xad8e92(_0x3ebb55[_0xf177('0x1f')][_0xf177('0x21')]);}logger[_0xf177('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x486337,_0x3ebb55[_0xf177('0x1f')][_0xf177('0x21')]);return _0x1c67ea(_0x3ebb55[_0xf177('0x1f')][_0xf177('0x21')]);}else{logger[_0xf177('0x1b')](_0xf177('0x1c'),_0x486337,'request\x20sent');_0x1c67ea(_0x3ebb55[_0xf177('0x22')][_0xf177('0x21')]);}})['catch'](function(_0x13398a){logger[_0xf177('0x1f')](_0xf177('0x1c'),_0x486337,_0x13398a);_0xad8e92(_0x13398a);});});}function respondWithStatusCode(_0x3da115,_0x510969){_0x510969=_0x510969||0xcc;return function(_0x361a90){if(_0x361a90){return _0x3da115[_0xf177('0x23')](_0x510969);}return _0x3da115[_0xf177('0x24')](_0x510969)[_0xf177('0x25')]();};}function respondWithResult(_0x14574a,_0x5319c2){_0x5319c2=_0x5319c2||0xc8;return function(_0x4cefc2){if(_0x4cefc2){return _0x14574a['status'](_0x5319c2)[_0xf177('0x26')](_0x4cefc2);}};}function respondWithFilteredResult(_0x2d99e9,_0x2953f8){return function(_0x54102e){if(_0x54102e){var _0x154232=typeof _0x2953f8['offset']==='undefined'&&typeof _0x2953f8[_0xf177('0x27')]==='undefined';var _0x24be1f=_0x54102e[_0xf177('0x28')];var _0x24f067=_0x154232?0x0:_0x2953f8[_0xf177('0x29')];var _0x13858f=_0x154232?_0x54102e[_0xf177('0x28')]:_0x2953f8[_0xf177('0x29')]+_0x2953f8[_0xf177('0x27')];var _0x336472;if(_0x13858f>=_0x24be1f){_0x13858f=_0x24be1f;_0x336472=0xc8;}else{_0x336472=0xce;}_0x2d99e9[_0xf177('0x24')](_0x336472);return _0x2d99e9[_0xf177('0x2a')](_0xf177('0x2b'),_0x24f067+'-'+_0x13858f+'/'+_0x24be1f)[_0xf177('0x26')](_0x54102e);}return null;};}function patchUpdates(_0x25ec67){return function(_0x26951a){try{jsonpatch[_0xf177('0x2c')](_0x26951a,_0x25ec67,!![]);}catch(_0x324d39){return BPromise[_0xf177('0x2d')](_0x324d39);}return _0x26951a['save']();};}function saveUpdates(_0x3be707,_0x102dda){return function(_0x1ad3ae){if(_0x1ad3ae){return _0x1ad3ae['update'](_0x3be707)[_0xf177('0x1a')](function(_0x58e41c){return _0x58e41c;});}return null;};}function removeEntity(_0x728a6d,_0x5c72ec){return function(_0x1d068b){if(_0x1d068b){return _0x1d068b[_0xf177('0x2e')]()[_0xf177('0x1a')](function(){_0x728a6d[_0xf177('0x24')](0xcc)[_0xf177('0x25')]();});}};}function handleEntityNotFound(_0x1e3491,_0x168def){return function(_0x2b17d3){if(!_0x2b17d3){_0x1e3491['sendStatus'](0x194);}return _0x2b17d3;};}function handleError(_0xb294f4,_0x300bec){_0x300bec=_0x300bec||0x1f4;return function(_0xf1762a){logger['error'](_0xf1762a[_0xf177('0x2f')]);if(_0xf1762a['name']){delete _0xf1762a['name'];}_0xb294f4[_0xf177('0x24')](_0x300bec)[_0xf177('0x30')](_0xf1762a);};}function getMustacheRender(_0xe9607,_0x4e6f55){return Mustache['render'](_0xe9607,_['merge'](_0x4e6f55[_0xf177('0x31')],{'contact':_0x4e6f55['contact'],'message':_0x4e6f55[_0xf177('0x21')],'agent':_0x4e6f55[_0xf177('0x32')],'interaction':_0x4e6f55['interaction'],'account':_0x4e6f55['account']}))||'';}exports[_0xf177('0x33')]=function(_0x59a819,_0x40bc85){var _0x4a811e={},_0x56f12a={},_0x1c8747={'count':0x0,'rows':[]};var _0x541840=_[_0xf177('0x34')](db[_0xf177('0x35')]['rawAttributes'],function(_0x2ad9c2){return{'name':_0x2ad9c2[_0xf177('0x36')],'type':_0x2ad9c2[_0xf177('0x37')][_0xf177('0x38')]};});_0x56f12a[_0xf177('0x39')]=_['map'](_0x541840,_0xf177('0x3a'));_0x56f12a[_0xf177('0x3b')]=_['keys'](_0x59a819[_0xf177('0x3b')]);_0x56f12a[_0xf177('0x3c')]=_[_0xf177('0x3d')](_0x56f12a[_0xf177('0x39')],_0x56f12a[_0xf177('0x3b')]);_0x4a811e[_0xf177('0x3e')]=_[_0xf177('0x3d')](_0x56f12a[_0xf177('0x39')],qs[_0xf177('0x3f')](_0x59a819[_0xf177('0x3b')][_0xf177('0x3f')]));_0x4a811e['attributes']=_0x4a811e['attributes']['length']?_0x4a811e[_0xf177('0x3e')]:_0x56f12a[_0xf177('0x39')];if(!_0x59a819[_0xf177('0x3b')][_0xf177('0x40')](_0xf177('0x41'))){_0x4a811e[_0xf177('0x27')]=qs[_0xf177('0x27')](_0x59a819[_0xf177('0x3b')]['limit']);_0x4a811e['offset']=qs[_0xf177('0x29')](_0x59a819[_0xf177('0x3b')][_0xf177('0x29')]);}_0x4a811e['order']=qs[_0xf177('0x42')](_0x59a819['query'][_0xf177('0x42')]);_0x4a811e[_0xf177('0x43')]=qs[_0xf177('0x3c')](_[_0xf177('0x44')](_0x59a819[_0xf177('0x3b')],_0x56f12a[_0xf177('0x3c')]),_0x541840);if(_0x59a819[_0xf177('0x3b')][_0xf177('0x45')]){_0x4a811e['where']=_[_0xf177('0x46')](_0x4a811e[_0xf177('0x43')],{'$or':_[_0xf177('0x34')](_0x541840,function(_0x49f409){if(_0x49f409[_0xf177('0x37')]!==_0xf177('0x47')){var _0x12d3e6={};_0x12d3e6[_0x49f409[_0xf177('0x3a')]]={'$like':'%'+_0x59a819[_0xf177('0x3b')][_0xf177('0x45')]+'%'};return _0x12d3e6;}})});}_0x4a811e=_[_0xf177('0x46')]({},_0x4a811e,_0x59a819[_0xf177('0x48')]);var _0x38468a={'where':_0x4a811e[_0xf177('0x43')]};return db[_0xf177('0x35')][_0xf177('0x28')](_0x38468a)[_0xf177('0x1a')](function(_0x4186b5){_0x1c8747[_0xf177('0x28')]=_0x4186b5;if(_0x59a819['query'][_0xf177('0x49')]){_0x4a811e['include']=[{'all':!![]}];}return db[_0xf177('0x35')][_0xf177('0x4a')](_0x4a811e);})[_0xf177('0x1a')](function(_0x407658){_0x1c8747[_0xf177('0x4b')]=_0x407658;return _0x1c8747;})[_0xf177('0x1a')](respondWithFilteredResult(_0x40bc85,_0x4a811e))['catch'](handleError(_0x40bc85,null));};exports['show']=function(_0x31f06f,_0x1fad37){var _0x2b8c92={'raw':![],'where':{'id':_0x31f06f[_0xf177('0x4c')]['id']}},_0x3194c2={};_0x3194c2[_0xf177('0x39')]=_[_0xf177('0x4d')](db[_0xf177('0x35')][_0xf177('0x4e')]);_0x3194c2['query']=_[_0xf177('0x4d')](_0x31f06f[_0xf177('0x3b')]);_0x3194c2['filters']=_['intersection'](_0x3194c2['model'],_0x3194c2[_0xf177('0x3b')]);_0x2b8c92['attributes']=_[_0xf177('0x3d')](_0x3194c2[_0xf177('0x39')],qs[_0xf177('0x3f')](_0x31f06f[_0xf177('0x3b')][_0xf177('0x3f')]));_0x2b8c92['attributes']=_0x2b8c92['attributes'][_0xf177('0x4f')]?_0x2b8c92['attributes']:_0x3194c2[_0xf177('0x39')];if(_0x31f06f[_0xf177('0x3b')][_0xf177('0x49')]){_0x2b8c92['include']=[{'all':!![]}];}_0x2b8c92=_['merge']({},_0x2b8c92,_0x31f06f['options']);return db[_0xf177('0x35')][_0xf177('0x50')](_0x2b8c92)[_0xf177('0x1a')](handleEntityNotFound(_0x1fad37,null))[_0xf177('0x1a')](respondWithResult(_0x1fad37,null))['catch'](handleError(_0x1fad37,null));};exports['create']=function(_0x3523cf,_0x3fb6c4){return db['FreshsalesConfiguration'][_0xf177('0x51')](_0x3523cf['body'],{})[_0xf177('0x1a')](respondWithResult(_0x3fb6c4,0xc9))[_0xf177('0x52')](handleError(_0x3fb6c4,null));};exports['update']=function(_0x3b324b,_0x80be1a){if(_0x3b324b[_0xf177('0x31')]['id']){delete _0x3b324b[_0xf177('0x31')]['id'];}return db[_0xf177('0x35')][_0xf177('0x50')]({'where':{'id':_0x3b324b[_0xf177('0x4c')]['id']}})['then'](handleEntityNotFound(_0x80be1a,null))[_0xf177('0x1a')](saveUpdates(_0x3b324b[_0xf177('0x31')],null))[_0xf177('0x1a')](respondWithResult(_0x80be1a,null))['catch'](handleError(_0x80be1a,null));};exports[_0xf177('0x2e')]=function(_0x4e4593,_0x3e1d85){return db[_0xf177('0x35')][_0xf177('0x50')]({'where':{'id':_0x4e4593[_0xf177('0x4c')]['id']}})[_0xf177('0x1a')](handleEntityNotFound(_0x3e1d85,null))[_0xf177('0x1a')](removeEntity(_0x3e1d85,null))['catch'](handleError(_0x3e1d85,null));};exports['getSubjects']=function(_0x5cabd9,_0x57673a,_0x261d60){var _0x40fe15={};var _0x578324={};var _0x352f91;var _0xe14096;return db['FreshsalesConfiguration'][_0xf177('0x53')]({'where':{'id':_0x5cabd9['params']['id']}})[_0xf177('0x1a')](handleEntityNotFound(_0x57673a,null))[_0xf177('0x1a')](function(_0x2da7ab){if(_0x2da7ab){_0x352f91=_0x2da7ab;_0x578324[_0xf177('0x39')]=_['keys'](db[_0xf177('0x54')][_0xf177('0x4e')]);_0x578324[_0xf177('0x3b')]=_[_0xf177('0x4d')](_0x5cabd9[_0xf177('0x3b')]);_0x578324[_0xf177('0x3c')]=_[_0xf177('0x3d')](_0x578324[_0xf177('0x39')],_0x578324[_0xf177('0x3b')]);_0x40fe15[_0xf177('0x3e')]=_['intersection'](_0x578324[_0xf177('0x39')],qs['fields'](_0x5cabd9[_0xf177('0x3b')]['fields']));_0x40fe15[_0xf177('0x3e')]=_0x40fe15[_0xf177('0x3e')][_0xf177('0x4f')]?_0x40fe15[_0xf177('0x3e')]:_0x578324[_0xf177('0x39')];_0x40fe15[_0xf177('0x55')]=qs[_0xf177('0x42')](_0x5cabd9[_0xf177('0x3b')][_0xf177('0x42')]);_0x40fe15[_0xf177('0x43')]=qs[_0xf177('0x3c')](_[_0xf177('0x44')](_0x5cabd9[_0xf177('0x3b')],_0x578324[_0xf177('0x3c')]));if(_0x5cabd9[_0xf177('0x3b')][_0xf177('0x45')]){_0x40fe15[_0xf177('0x43')]=_[_0xf177('0x46')](_0x40fe15[_0xf177('0x43')],{'$or':_[_0xf177('0x34')](_0x40fe15[_0xf177('0x3e')],function(_0x233370){var _0x39b089={};_0x39b089[_0x233370]={'$like':'%'+_0x5cabd9['query'][_0xf177('0x45')]+'%'};return _0x39b089;})});}_0x40fe15=_[_0xf177('0x46')]({},_0x40fe15,_0x5cabd9['options']);return _0x352f91[_0xf177('0x56')](_0x40fe15);}})[_0xf177('0x1a')](function(_0x209f9a){if(_0x209f9a){_0xe14096=_0x209f9a[_0xf177('0x4f')];if(!_0x5cabd9[_0xf177('0x3b')][_0xf177('0x40')]('nolimit')){_0x40fe15['limit']=qs['limit'](_0x5cabd9[_0xf177('0x3b')][_0xf177('0x27')]);_0x40fe15[_0xf177('0x29')]=qs[_0xf177('0x29')](_0x5cabd9[_0xf177('0x3b')][_0xf177('0x29')]);}return _0x352f91[_0xf177('0x56')](_0x40fe15);}})[_0xf177('0x1a')](function(_0x3c8dab){if(_0x3c8dab){return _0x3c8dab?{'count':_0xe14096,'rows':_0x3c8dab}:null;}})['then'](respondWithResult(_0x57673a,null))[_0xf177('0x52')](handleError(_0x57673a,null));};exports['getDescriptions']=function(_0x4e3153,_0x4019a7,_0x4bd09f){var _0x57bace={};var _0x101ee6={};var _0x23ce92;var _0x208a7e;return db[_0xf177('0x35')][_0xf177('0x53')]({'where':{'id':_0x4e3153[_0xf177('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4019a7,null))[_0xf177('0x1a')](function(_0xc1d6db){if(_0xc1d6db){_0x23ce92=_0xc1d6db;_0x101ee6[_0xf177('0x39')]=_[_0xf177('0x4d')](db[_0xf177('0x54')][_0xf177('0x4e')]);_0x101ee6[_0xf177('0x3b')]=_['keys'](_0x4e3153[_0xf177('0x3b')]);_0x101ee6['filters']=_[_0xf177('0x3d')](_0x101ee6[_0xf177('0x39')],_0x101ee6['query']);_0x57bace[_0xf177('0x3e')]=_[_0xf177('0x3d')](_0x101ee6['model'],qs['fields'](_0x4e3153[_0xf177('0x3b')]['fields']));_0x57bace[_0xf177('0x3e')]=_0x57bace[_0xf177('0x3e')]['length']?_0x57bace[_0xf177('0x3e')]:_0x101ee6['model'];_0x57bace[_0xf177('0x55')]=qs[_0xf177('0x42')](_0x4e3153[_0xf177('0x3b')][_0xf177('0x42')]);_0x57bace[_0xf177('0x43')]=qs[_0xf177('0x3c')](_[_0xf177('0x44')](_0x4e3153['query'],_0x101ee6['filters']));if(_0x4e3153[_0xf177('0x3b')][_0xf177('0x45')]){_0x57bace['where']=_[_0xf177('0x46')](_0x57bace[_0xf177('0x43')],{'$or':_['map'](_0x57bace['attributes'],function(_0x6213a0){var _0x3e417c={};_0x3e417c[_0x6213a0]={'$like':'%'+_0x4e3153[_0xf177('0x3b')]['filter']+'%'};return _0x3e417c;})});}_0x57bace=_['merge']({},_0x57bace,_0x4e3153[_0xf177('0x48')]);return _0x23ce92[_0xf177('0x57')](_0x57bace);}})[_0xf177('0x1a')](function(_0x1df9e9){if(_0x1df9e9){_0x208a7e=_0x1df9e9[_0xf177('0x4f')];if(!_0x4e3153[_0xf177('0x3b')]['hasOwnProperty'](_0xf177('0x41'))){_0x57bace[_0xf177('0x27')]=qs[_0xf177('0x27')](_0x4e3153[_0xf177('0x3b')][_0xf177('0x27')]);_0x57bace[_0xf177('0x29')]=qs[_0xf177('0x29')](_0x4e3153[_0xf177('0x3b')][_0xf177('0x29')]);}return _0x23ce92[_0xf177('0x57')](_0x57bace);}})[_0xf177('0x1a')](function(_0x200508){if(_0x200508){return _0x200508?{'count':_0x208a7e,'rows':_0x200508}:null;}})[_0xf177('0x1a')](respondWithResult(_0x4019a7,null))[_0xf177('0x52')](handleError(_0x4019a7,null));};exports[_0xf177('0x58')]=function(_0x3eedbd,_0xbd85f3,_0x3f3ff9){var _0x1b77a8={};var _0x2f43ae={};var _0x56ca8c;var _0x331841;return db[_0xf177('0x35')]['findOne']({'where':{'id':_0x3eedbd['params']['id']}})['then'](handleEntityNotFound(_0xbd85f3,null))[_0xf177('0x1a')](function(_0x3ea8ca){if(_0x3ea8ca){_0x56ca8c=_0x3ea8ca;_0x2f43ae[_0xf177('0x39')]=_[_0xf177('0x4d')](db[_0xf177('0x54')][_0xf177('0x4e')]);_0x2f43ae[_0xf177('0x3b')]=_[_0xf177('0x4d')](_0x3eedbd[_0xf177('0x3b')]);_0x2f43ae['filters']=_[_0xf177('0x3d')](_0x2f43ae[_0xf177('0x39')],_0x2f43ae[_0xf177('0x3b')]);_0x1b77a8[_0xf177('0x3e')]=_['intersection'](_0x2f43ae[_0xf177('0x39')],qs[_0xf177('0x3f')](_0x3eedbd['query'][_0xf177('0x3f')]));_0x1b77a8[_0xf177('0x3e')]=_0x1b77a8[_0xf177('0x3e')][_0xf177('0x4f')]?_0x1b77a8[_0xf177('0x3e')]:_0x2f43ae[_0xf177('0x39')];_0x1b77a8['order']=qs[_0xf177('0x42')](_0x3eedbd['query']['sort']);_0x1b77a8[_0xf177('0x43')]=qs[_0xf177('0x3c')](_['pick'](_0x3eedbd[_0xf177('0x3b')],_0x2f43ae[_0xf177('0x3c')]));if(_0x3eedbd[_0xf177('0x3b')][_0xf177('0x45')]){_0x1b77a8[_0xf177('0x43')]=_[_0xf177('0x46')](_0x1b77a8['where'],{'$or':_[_0xf177('0x34')](_0x1b77a8[_0xf177('0x3e')],function(_0x1e2033){var _0x417de4={};_0x417de4[_0x1e2033]={'$like':'%'+_0x3eedbd[_0xf177('0x3b')][_0xf177('0x45')]+'%'};return _0x417de4;})});}_0x1b77a8=_[_0xf177('0x46')]({},_0x1b77a8,_0x3eedbd['options']);return _0x56ca8c[_0xf177('0x58')](_0x1b77a8);}})['then'](function(_0x4b50c0){if(_0x4b50c0){_0x331841=_0x4b50c0[_0xf177('0x4f')];if(!_0x3eedbd['query']['hasOwnProperty'](_0xf177('0x41'))){_0x1b77a8[_0xf177('0x27')]=qs[_0xf177('0x27')](_0x3eedbd[_0xf177('0x3b')][_0xf177('0x27')]);_0x1b77a8[_0xf177('0x29')]=qs[_0xf177('0x29')](_0x3eedbd[_0xf177('0x3b')][_0xf177('0x29')]);}return _0x56ca8c[_0xf177('0x58')](_0x1b77a8);}})[_0xf177('0x1a')](function(_0x45e749){if(_0x45e749){return _0x45e749?{'count':_0x331841,'rows':_0x45e749}:null;}})[_0xf177('0x1a')](respondWithResult(_0xbd85f3,null))[_0xf177('0x52')](handleError(_0xbd85f3,null));}; \ No newline at end of file +var _0x6a94=['options','FreshsalesConfiguration','count','includeAll','findAll','rows','show','params','create','body','find','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','save','update','destroy','stack','name','send','render','merge','contact','interaction','account','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','fields','length','model','nolimit','order','sort','where','filters','pick','filter','VIRTUAL'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x6a94,0x1dd));var _0x46a9=function(_0x1236e5,_0xd3d1e9){_0x1236e5=_0x1236e5-0x0;var _0x2dfa5a=_0x6a94[_0x1236e5];return _0x2dfa5a;};'use strict';var emlformat=require(_0x46a9('0x0'));var rimraf=require(_0x46a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46a9('0x2'));var rp=require('request-promise');var moment=require(_0x46a9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x46a9('0x4'));var util=require('util');var path=require('path');var sox=require(_0x46a9('0x5'));var csv=require('to-csv');var ejs=require(_0x46a9('0x6'));var fs=require('fs');var fs_extra=require(_0x46a9('0x7'));var _=require(_0x46a9('0x8'));var squel=require(_0x46a9('0x9'));var crypto=require(_0x46a9('0xa'));var jsforce=require(_0x46a9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x46a9('0xc'));var Papa=require('papaparse');var Redis=require(_0x46a9('0xd'));var authService=require(_0x46a9('0xe'));var qs=require(_0x46a9('0xf'));var as=require(_0x46a9('0x10'));var hardwareService=require(_0x46a9('0x11'));var logger=require('../../config/logger')(_0x46a9('0x12'));var utils=require(_0x46a9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x46a9('0x14'));var db=require(_0x46a9('0x15'))['db'];var jayson=require(_0x46a9('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe78104,_0x2de39d,_0x57bb3e,_0x11dcdb){return new BPromise(function(_0x5c2dac,_0x37e6b7){var _0xf125f=_0x11dcdb||client;return _0xf125f[_0x46a9('0x17')](_0xe78104,_0x57bb3e)[_0x46a9('0x18')](function(_0x249275){logger[_0x46a9('0x19')](_0x46a9('0x1a'),_0x2de39d,_0x46a9('0x1b'));logger['debug'](_0x46a9('0x1c'),_0x2de39d,_0x46a9('0x1b'),JSON[_0x46a9('0x1d')](_0x249275));if(_0x249275[_0x46a9('0x1e')]){if(_0x249275[_0x46a9('0x1e')][_0x46a9('0x1f')]===0x1f4){logger[_0x46a9('0x1e')](_0x46a9('0x1a'),_0x2de39d,_0x249275[_0x46a9('0x1e')][_0x46a9('0x20')]);return _0x37e6b7(_0x249275[_0x46a9('0x1e')][_0x46a9('0x20')]);}logger[_0x46a9('0x1e')](_0x46a9('0x1a'),_0x2de39d,_0x249275['error'][_0x46a9('0x20')]);return _0x5c2dac(_0x249275[_0x46a9('0x1e')]['message']);}else{logger[_0x46a9('0x19')](_0x46a9('0x1a'),_0x2de39d,_0x46a9('0x1b'));_0x5c2dac(_0x249275[_0x46a9('0x21')][_0x46a9('0x20')]);}})[_0x46a9('0x22')](function(_0x2d2bac){logger[_0x46a9('0x1e')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2de39d,_0x2d2bac);_0x37e6b7(_0x2d2bac);});});}function respondWithStatusCode(_0x54ee37,_0x21e9fb){_0x21e9fb=_0x21e9fb||0xcc;return function(_0x54461d){if(_0x54461d){return _0x54ee37[_0x46a9('0x23')](_0x21e9fb);}return _0x54ee37[_0x46a9('0x24')](_0x21e9fb)[_0x46a9('0x25')]();};}function respondWithResult(_0x4e0909,_0x196265){_0x196265=_0x196265||0xc8;return function(_0x2c267b){if(_0x2c267b){return _0x4e0909[_0x46a9('0x24')](_0x196265)[_0x46a9('0x26')](_0x2c267b);}};}function respondWithFilteredResult(_0x5df33c,_0x278705){return function(_0x4bc6d1){if(_0x4bc6d1){var _0x42108d=typeof _0x278705[_0x46a9('0x27')]===_0x46a9('0x28')&&typeof _0x278705[_0x46a9('0x29')]===_0x46a9('0x28');var _0x5d96c0=_0x4bc6d1['count'];var _0x16748d=_0x42108d?0x0:_0x278705['offset'];var _0x5d0960=_0x42108d?_0x4bc6d1['count']:_0x278705[_0x46a9('0x27')]+_0x278705['limit'];var _0x55fe99;if(_0x5d0960>=_0x5d96c0){_0x5d0960=_0x5d96c0;_0x55fe99=0xc8;}else{_0x55fe99=0xce;}_0x5df33c['status'](_0x55fe99);return _0x5df33c[_0x46a9('0x2a')]('Content-Range',_0x16748d+'-'+_0x5d0960+'/'+_0x5d96c0)['json'](_0x4bc6d1);}return null;};}function patchUpdates(_0x54bca4){return function(_0x39604b){try{jsonpatch['apply'](_0x39604b,_0x54bca4,!![]);}catch(_0x9c1c4c){return BPromise['reject'](_0x9c1c4c);}return _0x39604b[_0x46a9('0x2b')]();};}function saveUpdates(_0x332271,_0xe52065){return function(_0x428b55){if(_0x428b55){return _0x428b55[_0x46a9('0x2c')](_0x332271)[_0x46a9('0x18')](function(_0xdb82aa){return _0xdb82aa;});}return null;};}function removeEntity(_0x453d8e,_0x4e0cd7){return function(_0x1c9ae9){if(_0x1c9ae9){return _0x1c9ae9[_0x46a9('0x2d')]()[_0x46a9('0x18')](function(){_0x453d8e[_0x46a9('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6cd437,_0x5d6203){return function(_0x347ecd){if(!_0x347ecd){_0x6cd437[_0x46a9('0x23')](0x194);}return _0x347ecd;};}function handleError(_0x2625bc,_0x347c3c){_0x347c3c=_0x347c3c||0x1f4;return function(_0x4e65cc){logger[_0x46a9('0x1e')](_0x4e65cc[_0x46a9('0x2e')]);if(_0x4e65cc[_0x46a9('0x2f')]){delete _0x4e65cc[_0x46a9('0x2f')];}_0x2625bc['status'](_0x347c3c)[_0x46a9('0x30')](_0x4e65cc);};}function getMustacheRender(_0x39e1a9,_0x110a63){return Mustache[_0x46a9('0x31')](_0x39e1a9,_[_0x46a9('0x32')](_0x110a63['body'],{'contact':_0x110a63[_0x46a9('0x33')],'message':_0x110a63[_0x46a9('0x20')],'agent':_0x110a63['agent'],'interaction':_0x110a63[_0x46a9('0x34')],'account':_0x110a63[_0x46a9('0x35')]}))||'';}exports[_0x46a9('0x36')]=function(_0x8d7742,_0x467c66){var _0x105919={},_0x42b14d={},_0xa7b3d2={'count':0x0,'rows':[]};var _0x376eaf=_['map'](db['FreshsalesConfiguration'][_0x46a9('0x37')],function(_0x5b3b75){return{'name':_0x5b3b75[_0x46a9('0x38')],'type':_0x5b3b75[_0x46a9('0x39')][_0x46a9('0x3a')]};});_0x42b14d['model']=_[_0x46a9('0x3b')](_0x376eaf,'name');_0x42b14d[_0x46a9('0x3c')]=_[_0x46a9('0x3d')](_0x8d7742['query']);_0x42b14d['filters']=_[_0x46a9('0x3e')](_0x42b14d['model'],_0x42b14d['query']);_0x105919[_0x46a9('0x3f')]=_[_0x46a9('0x3e')](_0x42b14d['model'],qs[_0x46a9('0x40')](_0x8d7742[_0x46a9('0x3c')][_0x46a9('0x40')]));_0x105919[_0x46a9('0x3f')]=_0x105919[_0x46a9('0x3f')][_0x46a9('0x41')]?_0x105919[_0x46a9('0x3f')]:_0x42b14d[_0x46a9('0x42')];if(!_0x8d7742[_0x46a9('0x3c')]['hasOwnProperty'](_0x46a9('0x43'))){_0x105919[_0x46a9('0x29')]=qs['limit'](_0x8d7742[_0x46a9('0x3c')][_0x46a9('0x29')]);_0x105919[_0x46a9('0x27')]=qs[_0x46a9('0x27')](_0x8d7742[_0x46a9('0x3c')]['offset']);}_0x105919[_0x46a9('0x44')]=qs[_0x46a9('0x45')](_0x8d7742['query'][_0x46a9('0x45')]);_0x105919[_0x46a9('0x46')]=qs[_0x46a9('0x47')](_[_0x46a9('0x48')](_0x8d7742[_0x46a9('0x3c')],_0x42b14d[_0x46a9('0x47')]),_0x376eaf);if(_0x8d7742[_0x46a9('0x3c')][_0x46a9('0x49')]){_0x105919[_0x46a9('0x46')]=_[_0x46a9('0x32')](_0x105919[_0x46a9('0x46')],{'$or':_[_0x46a9('0x3b')](_0x376eaf,function(_0xf40e88){if(_0xf40e88[_0x46a9('0x39')]!==_0x46a9('0x4a')){var _0x1d4890={};_0x1d4890[_0xf40e88[_0x46a9('0x2f')]]={'$like':'%'+_0x8d7742[_0x46a9('0x3c')][_0x46a9('0x49')]+'%'};return _0x1d4890;}})});}_0x105919=_[_0x46a9('0x32')]({},_0x105919,_0x8d7742[_0x46a9('0x4b')]);var _0xacf8a2={'where':_0x105919[_0x46a9('0x46')]};return db[_0x46a9('0x4c')][_0x46a9('0x4d')](_0xacf8a2)['then'](function(_0x1b4224){_0xa7b3d2[_0x46a9('0x4d')]=_0x1b4224;if(_0x8d7742[_0x46a9('0x3c')][_0x46a9('0x4e')]){_0x105919['include']=[{'all':!![]}];}return db[_0x46a9('0x4c')][_0x46a9('0x4f')](_0x105919);})[_0x46a9('0x18')](function(_0x5b42a0){_0xa7b3d2[_0x46a9('0x50')]=_0x5b42a0;return _0xa7b3d2;})[_0x46a9('0x18')](respondWithFilteredResult(_0x467c66,_0x105919))[_0x46a9('0x22')](handleError(_0x467c66,null));};exports[_0x46a9('0x51')]=function(_0x68a01,_0x352de7){var _0x42045e={'raw':![],'where':{'id':_0x68a01[_0x46a9('0x52')]['id']}},_0x148547={};_0x148547['model']=_[_0x46a9('0x3d')](db[_0x46a9('0x4c')]['rawAttributes']);_0x148547[_0x46a9('0x3c')]=_[_0x46a9('0x3d')](_0x68a01['query']);_0x148547['filters']=_['intersection'](_0x148547[_0x46a9('0x42')],_0x148547[_0x46a9('0x3c')]);_0x42045e[_0x46a9('0x3f')]=_[_0x46a9('0x3e')](_0x148547['model'],qs[_0x46a9('0x40')](_0x68a01['query'][_0x46a9('0x40')]));_0x42045e['attributes']=_0x42045e['attributes'][_0x46a9('0x41')]?_0x42045e[_0x46a9('0x3f')]:_0x148547[_0x46a9('0x42')];if(_0x68a01['query']['includeAll']){_0x42045e['include']=[{'all':!![]}];}_0x42045e=_['merge']({},_0x42045e,_0x68a01['options']);return db[_0x46a9('0x4c')]['find'](_0x42045e)['then'](handleEntityNotFound(_0x352de7,null))[_0x46a9('0x18')](respondWithResult(_0x352de7,null))[_0x46a9('0x22')](handleError(_0x352de7,null));};exports[_0x46a9('0x53')]=function(_0xe3be59,_0x4f6f58){return db[_0x46a9('0x4c')][_0x46a9('0x53')](_0xe3be59[_0x46a9('0x54')],{})['then'](respondWithResult(_0x4f6f58,0xc9))[_0x46a9('0x22')](handleError(_0x4f6f58,null));};exports[_0x46a9('0x2c')]=function(_0x5e962f,_0x2dfb01){if(_0x5e962f[_0x46a9('0x54')]['id']){delete _0x5e962f[_0x46a9('0x54')]['id'];}return db['FreshsalesConfiguration'][_0x46a9('0x55')]({'where':{'id':_0x5e962f['params']['id']}})[_0x46a9('0x18')](handleEntityNotFound(_0x2dfb01,null))['then'](saveUpdates(_0x5e962f[_0x46a9('0x54')],null))[_0x46a9('0x18')](respondWithResult(_0x2dfb01,null))[_0x46a9('0x22')](handleError(_0x2dfb01,null));};exports['destroy']=function(_0x2f9ec1,_0x4298ba){return db[_0x46a9('0x4c')][_0x46a9('0x55')]({'where':{'id':_0x2f9ec1['params']['id']}})[_0x46a9('0x18')](handleEntityNotFound(_0x4298ba,null))['then'](removeEntity(_0x4298ba,null))[_0x46a9('0x22')](handleError(_0x4298ba,null));};exports[_0x46a9('0x56')]=function(_0x54e9aa,_0x3ae1c1,_0x528bf8){var _0xc2cc13={};var _0xee1521={};var _0x5bf788;var _0x4c48a6;return db[_0x46a9('0x4c')][_0x46a9('0x57')]({'where':{'id':_0x54e9aa[_0x46a9('0x52')]['id']}})['then'](handleEntityNotFound(_0x3ae1c1,null))[_0x46a9('0x18')](function(_0x4fd8a6){if(_0x4fd8a6){_0x5bf788=_0x4fd8a6;_0xee1521[_0x46a9('0x42')]=_['keys'](db[_0x46a9('0x58')]['rawAttributes']);_0xee1521['query']=_[_0x46a9('0x3d')](_0x54e9aa[_0x46a9('0x3c')]);_0xee1521[_0x46a9('0x47')]=_[_0x46a9('0x3e')](_0xee1521[_0x46a9('0x42')],_0xee1521['query']);_0xc2cc13['attributes']=_[_0x46a9('0x3e')](_0xee1521[_0x46a9('0x42')],qs[_0x46a9('0x40')](_0x54e9aa['query']['fields']));_0xc2cc13[_0x46a9('0x3f')]=_0xc2cc13['attributes']['length']?_0xc2cc13[_0x46a9('0x3f')]:_0xee1521[_0x46a9('0x42')];_0xc2cc13['order']=qs['sort'](_0x54e9aa[_0x46a9('0x3c')]['sort']);_0xc2cc13[_0x46a9('0x46')]=qs['filters'](_[_0x46a9('0x48')](_0x54e9aa[_0x46a9('0x3c')],_0xee1521[_0x46a9('0x47')]));if(_0x54e9aa[_0x46a9('0x3c')][_0x46a9('0x49')]){_0xc2cc13[_0x46a9('0x46')]=_['merge'](_0xc2cc13['where'],{'$or':_[_0x46a9('0x3b')](_0xc2cc13['attributes'],function(_0x1e6c01){var _0x3d0667={};_0x3d0667[_0x1e6c01]={'$like':'%'+_0x54e9aa[_0x46a9('0x3c')][_0x46a9('0x49')]+'%'};return _0x3d0667;})});}_0xc2cc13=_[_0x46a9('0x32')]({},_0xc2cc13,_0x54e9aa['options']);return _0x5bf788[_0x46a9('0x56')](_0xc2cc13);}})['then'](function(_0x1e2180){if(_0x1e2180){_0x4c48a6=_0x1e2180[_0x46a9('0x41')];if(!_0x54e9aa[_0x46a9('0x3c')][_0x46a9('0x59')]('nolimit')){_0xc2cc13[_0x46a9('0x29')]=qs[_0x46a9('0x29')](_0x54e9aa[_0x46a9('0x3c')][_0x46a9('0x29')]);_0xc2cc13[_0x46a9('0x27')]=qs[_0x46a9('0x27')](_0x54e9aa[_0x46a9('0x3c')][_0x46a9('0x27')]);}return _0x5bf788[_0x46a9('0x56')](_0xc2cc13);}})[_0x46a9('0x18')](function(_0x258601){if(_0x258601){return _0x258601?{'count':_0x4c48a6,'rows':_0x258601}:null;}})['then'](respondWithResult(_0x3ae1c1,null))[_0x46a9('0x22')](handleError(_0x3ae1c1,null));};exports[_0x46a9('0x5a')]=function(_0x3b56c8,_0x59c77c,_0x27e9){var _0x7a248={};var _0x4cf0fb={};var _0x135ea6;var _0x486733;return db[_0x46a9('0x4c')][_0x46a9('0x57')]({'where':{'id':_0x3b56c8['params']['id']}})[_0x46a9('0x18')](handleEntityNotFound(_0x59c77c,null))[_0x46a9('0x18')](function(_0x5a4757){if(_0x5a4757){_0x135ea6=_0x5a4757;_0x4cf0fb[_0x46a9('0x42')]=_['keys'](db[_0x46a9('0x58')][_0x46a9('0x37')]);_0x4cf0fb[_0x46a9('0x3c')]=_['keys'](_0x3b56c8[_0x46a9('0x3c')]);_0x4cf0fb[_0x46a9('0x47')]=_[_0x46a9('0x3e')](_0x4cf0fb[_0x46a9('0x42')],_0x4cf0fb[_0x46a9('0x3c')]);_0x7a248[_0x46a9('0x3f')]=_[_0x46a9('0x3e')](_0x4cf0fb[_0x46a9('0x42')],qs[_0x46a9('0x40')](_0x3b56c8[_0x46a9('0x3c')][_0x46a9('0x40')]));_0x7a248[_0x46a9('0x3f')]=_0x7a248[_0x46a9('0x3f')][_0x46a9('0x41')]?_0x7a248['attributes']:_0x4cf0fb[_0x46a9('0x42')];_0x7a248[_0x46a9('0x44')]=qs[_0x46a9('0x45')](_0x3b56c8['query'][_0x46a9('0x45')]);_0x7a248[_0x46a9('0x46')]=qs[_0x46a9('0x47')](_[_0x46a9('0x48')](_0x3b56c8[_0x46a9('0x3c')],_0x4cf0fb[_0x46a9('0x47')]));if(_0x3b56c8[_0x46a9('0x3c')][_0x46a9('0x49')]){_0x7a248[_0x46a9('0x46')]=_['merge'](_0x7a248[_0x46a9('0x46')],{'$or':_['map'](_0x7a248['attributes'],function(_0x2a5b59){var _0xc5d6e5={};_0xc5d6e5[_0x2a5b59]={'$like':'%'+_0x3b56c8[_0x46a9('0x3c')][_0x46a9('0x49')]+'%'};return _0xc5d6e5;})});}_0x7a248=_[_0x46a9('0x32')]({},_0x7a248,_0x3b56c8[_0x46a9('0x4b')]);return _0x135ea6[_0x46a9('0x5a')](_0x7a248);}})[_0x46a9('0x18')](function(_0x1f9693){if(_0x1f9693){_0x486733=_0x1f9693[_0x46a9('0x41')];if(!_0x3b56c8[_0x46a9('0x3c')][_0x46a9('0x59')](_0x46a9('0x43'))){_0x7a248[_0x46a9('0x29')]=qs[_0x46a9('0x29')](_0x3b56c8['query'][_0x46a9('0x29')]);_0x7a248['offset']=qs[_0x46a9('0x27')](_0x3b56c8['query']['offset']);}return _0x135ea6[_0x46a9('0x5a')](_0x7a248);}})[_0x46a9('0x18')](function(_0x1ad924){if(_0x1ad924){return _0x1ad924?{'count':_0x486733,'rows':_0x1ad924}:null;}})['then'](respondWithResult(_0x59c77c,null))[_0x46a9('0x22')](handleError(_0x59c77c,null));};exports[_0x46a9('0x5b')]=function(_0x34fd29,_0x20ba4c,_0x1edb4f){var _0xaf41a6={};var _0x2aff36={};var _0x3debda;var _0x4e0dfd;return db['FreshsalesConfiguration'][_0x46a9('0x57')]({'where':{'id':_0x34fd29['params']['id']}})[_0x46a9('0x18')](handleEntityNotFound(_0x20ba4c,null))[_0x46a9('0x18')](function(_0x4c73a6){if(_0x4c73a6){_0x3debda=_0x4c73a6;_0x2aff36[_0x46a9('0x42')]=_[_0x46a9('0x3d')](db[_0x46a9('0x58')][_0x46a9('0x37')]);_0x2aff36[_0x46a9('0x3c')]=_[_0x46a9('0x3d')](_0x34fd29[_0x46a9('0x3c')]);_0x2aff36[_0x46a9('0x47')]=_[_0x46a9('0x3e')](_0x2aff36[_0x46a9('0x42')],_0x2aff36[_0x46a9('0x3c')]);_0xaf41a6[_0x46a9('0x3f')]=_[_0x46a9('0x3e')](_0x2aff36[_0x46a9('0x42')],qs['fields'](_0x34fd29[_0x46a9('0x3c')][_0x46a9('0x40')]));_0xaf41a6['attributes']=_0xaf41a6['attributes'][_0x46a9('0x41')]?_0xaf41a6[_0x46a9('0x3f')]:_0x2aff36['model'];_0xaf41a6[_0x46a9('0x44')]=qs['sort'](_0x34fd29[_0x46a9('0x3c')]['sort']);_0xaf41a6[_0x46a9('0x46')]=qs[_0x46a9('0x47')](_[_0x46a9('0x48')](_0x34fd29[_0x46a9('0x3c')],_0x2aff36['filters']));if(_0x34fd29[_0x46a9('0x3c')][_0x46a9('0x49')]){_0xaf41a6['where']=_[_0x46a9('0x32')](_0xaf41a6[_0x46a9('0x46')],{'$or':_['map'](_0xaf41a6[_0x46a9('0x3f')],function(_0x1d19db){var _0x115268={};_0x115268[_0x1d19db]={'$like':'%'+_0x34fd29[_0x46a9('0x3c')]['filter']+'%'};return _0x115268;})});}_0xaf41a6=_[_0x46a9('0x32')]({},_0xaf41a6,_0x34fd29['options']);return _0x3debda[_0x46a9('0x5b')](_0xaf41a6);}})[_0x46a9('0x18')](function(_0x15cd93){if(_0x15cd93){_0x4e0dfd=_0x15cd93[_0x46a9('0x41')];if(!_0x34fd29['query'][_0x46a9('0x59')]('nolimit')){_0xaf41a6[_0x46a9('0x29')]=qs[_0x46a9('0x29')](_0x34fd29[_0x46a9('0x3c')]['limit']);_0xaf41a6['offset']=qs[_0x46a9('0x27')](_0x34fd29['query'][_0x46a9('0x27')]);}return _0x3debda[_0x46a9('0x5b')](_0xaf41a6);}})[_0x46a9('0x18')](function(_0x1cb58e){if(_0x1cb58e){return _0x1cb58e?{'count':_0x4e0dfd,'rows':_0x1cb58e}:null;}})['then'](respondWithResult(_0x20ba4c,null))['catch'](handleError(_0x20ba4c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index bddd2a7..5de0e8c 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 _0x1af8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_freshsales_configurations','lodash','../../config/logger','api'];(function(_0xf92940,_0x5e2156){var _0x2f4b30=function(_0x34bd61){while(--_0x34bd61){_0xf92940['push'](_0xf92940['shift']());}};_0x2f4b30(++_0x5e2156);}(_0x1af8,0x99));var _0x81af=function(_0x3467c6,_0xec6efd){_0x3467c6=_0x3467c6-0x0;var _0x285f52=_0x1af8[_0x3467c6];return _0x285f52;};'use strict';var _=require(_0x81af('0x0'));var util=require('util');var logger=require(_0x81af('0x1'))(_0x81af('0x2'));var moment=require(_0x81af('0x3'));var BPromise=require(_0x81af('0x4'));var rp=require(_0x81af('0x5'));var fs=require('fs');var path=require(_0x81af('0x6'));var rimraf=require(_0x81af('0x7'));var config=require(_0x81af('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x81af('0x9')]=function(_0x342d04,_0x347966){return _0x342d04[_0x81af('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x81af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74f0=['define','FreshsalesConfiguration','int_freshsales_configurations','util','moment','bluebird','request-promise','path','./intFreshsalesConfiguration.attributes','exports'];(function(_0x401dca,_0x38909e){var _0x741553=function(_0x24cac2){while(--_0x24cac2){_0x401dca['push'](_0x401dca['shift']());}};_0x741553(++_0x38909e);}(_0x74f0,0xf3));var _0x074f=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0x74f0[_0x5f746f];return _0x198d15;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x074f('0x1'));var BPromise=require(_0x074f('0x2'));var rp=require(_0x074f('0x3'));var fs=require('fs');var path=require(_0x074f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x074f('0x5'));module[_0x074f('0x6')]=function(_0x203f47,_0x126607){return _0x203f47[_0x074f('0x7')](_0x074f('0x8'),attributes,{'tableName':_0x074f('0x9'),'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 e64171a..6e3f7e9 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 _0xc29b=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x15cb0a,_0x4ad520){var _0x5e9406=function(_0x480227){while(--_0x480227){_0x15cb0a['push'](_0x15cb0a['shift']());}};_0x5e9406(++_0x4ad520);}(_0xc29b,0x12d));var _0xbc29=function(_0x2e6349,_0x30c465){_0x2e6349=_0x2e6349-0x0;var _0x12c115=_0xc29b[_0x2e6349];return _0x12c115;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40f0c9,_0x463e2b,_0x37d9dd){return new BPromise(function(_0x2e5fb7,_0x29b188){return client[_0xbc29('0xc')](_0x40f0c9,_0x37d9dd)[_0xbc29('0xd')](function(_0x320cb4){logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,_0xbc29('0x10'));logger[_0xbc29('0x11')](_0xbc29('0x12'),_0x463e2b,'request\x20sent',JSON[_0xbc29('0x13')](_0x320cb4));if(_0x320cb4[_0xbc29('0x14')]){if(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x15')]===0x1f4){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x320cb4[_0xbc29('0x14')]['message']);return _0x29b188(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x16')]);}logger[_0xbc29('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x463e2b,_0x320cb4['error'][_0xbc29('0x16')]);return _0x2e5fb7(_0x320cb4['error'][_0xbc29('0x16')]);}else{logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,'request\x20sent');_0x2e5fb7(_0x320cb4[_0xbc29('0x17')]['message']);}})[_0xbc29('0x18')](function(_0x3b5bae){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x3b5bae);_0x29b188(_0x3b5bae);});});} \ No newline at end of file +var _0xc933=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x53beb1,_0x4a88ed){var _0x1e193c=function(_0x25848b){while(--_0x25848b){_0x53beb1['push'](_0x53beb1['shift']());}};_0x1e193c(++_0x4a88ed);}(_0xc933,0xf9));var _0x3c93=function(_0xffc050,_0x182f10){_0xffc050=_0xffc050-0x0;var _0x4d7ab6=_0xc933[_0xffc050];return _0x4d7ab6;};'use strict';var _=require(_0x3c93('0x0'));var util=require(_0x3c93('0x1'));var moment=require(_0x3c93('0x2'));var BPromise=require(_0x3c93('0x3'));var rs=require(_0x3c93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c93('0x5'))['db'];var utils=require(_0x3c93('0x6'));var logger=require(_0x3c93('0x7'))(_0x3c93('0x8'));var config=require(_0x3c93('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3c93('0xa')][_0x3c93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52c22c,_0x411bb7,_0x489139){return new BPromise(function(_0x1b505a,_0x2ead14){return client[_0x3c93('0xc')](_0x52c22c,_0x489139)[_0x3c93('0xd')](function(_0x46f9e8){logger[_0x3c93('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x411bb7,'request\x20sent');logger['debug'](_0x3c93('0xf'),_0x411bb7,_0x3c93('0x10'),JSON[_0x3c93('0x11')](_0x46f9e8));if(_0x46f9e8[_0x3c93('0x12')]){if(_0x46f9e8[_0x3c93('0x12')][_0x3c93('0x13')]===0x1f4){logger[_0x3c93('0x12')](_0x3c93('0x14'),_0x411bb7,_0x46f9e8[_0x3c93('0x12')][_0x3c93('0x15')]);return _0x2ead14(_0x46f9e8[_0x3c93('0x12')][_0x3c93('0x15')]);}logger[_0x3c93('0x12')](_0x3c93('0x14'),_0x411bb7,_0x46f9e8[_0x3c93('0x12')][_0x3c93('0x15')]);return _0x1b505a(_0x46f9e8[_0x3c93('0x12')]['message']);}else{logger['info'](_0x3c93('0x14'),_0x411bb7,_0x3c93('0x10'));_0x1b505a(_0x46f9e8[_0x3c93('0x16')][_0x3c93('0x15')]);}})[_0x3c93('0x17')](function(_0x8b3fdc){logger[_0x3c93('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x411bb7,_0x8b3fdc);_0x2ead14(_0x8b3fdc);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d220c50..4514d25 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 _0x0713=['create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x5a113,_0x4162a9){var _0x53c9f8=function(_0x1aff2f){while(--_0x1aff2f){_0x5a113['push'](_0x5a113['shift']());}};_0x53c9f8(++_0x4162a9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0xd')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xe')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')](_0x3071('0xb'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);module[_0x3071('0x12')]=router; \ No newline at end of file +var _0x1eba=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x272d8a,_0x45184b){var _0x26286e=function(_0x93beaa){while(--_0x93beaa){_0x272d8a['push'](_0x272d8a['shift']());}};_0x26286e(++_0x45184b);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1eba[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0xe')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0xf')]);router['put'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router['delete'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x11')]);module[_0xa1eb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 30065db..973ca5e 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 _0x27a0=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27a0,0xbf));var _0x027a=function(_0x41d3bb,_0x2867ac){_0x41d3bb=_0x41d3bb-0x0;var _0x5a0f9d=_0x27a0[_0x41d3bb];return _0x5a0f9d;};'use strict';var Sequelize=require('sequelize');module[_0x027a('0x0')]={'type':{'type':Sequelize[_0x027a('0x1')](_0x027a('0x2'),_0x027a('0x3'),_0x027a('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x027a('0x5')]},'keyType':{'type':Sequelize[_0x027a('0x1')](_0x027a('0x2'),_0x027a('0x3'),_0x027a('0x4'))},'keyContent':{'type':Sequelize[_0x027a('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x027a('0x5')]},'customField':{'type':Sequelize[_0x027a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x027a('0x5')]}}; \ No newline at end of file +var _0x98a8=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x2e33cd,_0x13b37c){var _0x53dce1=function(_0x1f96f5){while(--_0x1f96f5){_0x2e33cd['push'](_0x2e33cd['shift']());}};_0x53dce1(++_0x13b37c);}(_0x98a8,0x12c));var _0x898a=function(_0x24d43a,_0x29758c){_0x24d43a=_0x24d43a-0x0;var _0x2d8186=_0x98a8[_0x24d43a];return _0x2d8186;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'type':{'type':Sequelize[_0x898a('0x2')](_0x898a('0x3'),_0x898a('0x4'),_0x898a('0x5'),_0x898a('0x6'),'picklist'),'defaultValue':_0x898a('0x3')},'content':{'type':Sequelize[_0x898a('0x7')]},'key':{'type':Sequelize[_0x898a('0x7')]},'keyType':{'type':Sequelize[_0x898a('0x2')](_0x898a('0x3'),'variable',_0x898a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x898a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x898a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x898a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f3f4758..d7a81f3 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 _0xbc66=['util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','render','merge','body','message','agent','interaction','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','filter','VIRTUAL','options','FreshsalesField','includeAll','findAll','rows','show','params','length','include','find','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0xaf9246,_0x2cf3d7){var _0x537587=function(_0x7ec956){while(--_0x7ec956){_0xaf9246['push'](_0xaf9246['shift']());}};_0x537587(++_0x2cf3d7);}(_0xbc66,0x176));var _0x6bc6=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbc66[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x6bc6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6bc6('0x1'));var jsonpatch=require(_0x6bc6('0x2'));var rp=require('request-promise');var moment=require(_0x6bc6('0x3'));var BPromise=require(_0x6bc6('0x4'));var Mustache=require(_0x6bc6('0x5'));var util=require(_0x6bc6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6bc6('0x7'));var ejs=require(_0x6bc6('0x8'));var fs=require('fs');var fs_extra=require(_0x6bc6('0x9'));var _=require(_0x6bc6('0xa'));var squel=require('squel');var crypto=require(_0x6bc6('0xb'));var jsforce=require(_0x6bc6('0xc'));var deskjs=require(_0x6bc6('0xd'));var toCsv=require(_0x6bc6('0x7'));var querystring=require(_0x6bc6('0xe'));var Papa=require(_0x6bc6('0xf'));var Redis=require(_0x6bc6('0x10'));var authService=require(_0x6bc6('0x11'));var qs=require(_0x6bc6('0x12'));var as=require(_0x6bc6('0x13'));var hardwareService=require(_0x6bc6('0x14'));var logger=require(_0x6bc6('0x15'))(_0x6bc6('0x16'));var utils=require(_0x6bc6('0x17'));var config=require(_0x6bc6('0x18'));var licenseUtil=require(_0x6bc6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48e32a,_0x490102){_0x490102=_0x490102||0xcc;return function(_0x243633){if(_0x243633){return _0x48e32a[_0x6bc6('0x1a')](_0x490102);}return _0x48e32a[_0x6bc6('0x1b')](_0x490102)[_0x6bc6('0x1c')]();};}function respondWithResult(_0x47b28f,_0x1a2538){_0x1a2538=_0x1a2538||0xc8;return function(_0xf9c047){if(_0xf9c047){return _0x47b28f['status'](_0x1a2538)[_0x6bc6('0x1d')](_0xf9c047);}};}function respondWithFilteredResult(_0x583a5c,_0x2fbc42){return function(_0xeaa57e){if(_0xeaa57e){var _0x34e0ba=typeof _0x2fbc42[_0x6bc6('0x1e')]===_0x6bc6('0x1f')&&typeof _0x2fbc42[_0x6bc6('0x20')]===_0x6bc6('0x1f');var _0x5a6664=_0xeaa57e[_0x6bc6('0x21')];var _0x4f2d7d=_0x34e0ba?0x0:_0x2fbc42[_0x6bc6('0x1e')];var _0xc2d0b8=_0x34e0ba?_0xeaa57e[_0x6bc6('0x21')]:_0x2fbc42[_0x6bc6('0x1e')]+_0x2fbc42['limit'];var _0x34d9b8;if(_0xc2d0b8>=_0x5a6664){_0xc2d0b8=_0x5a6664;_0x34d9b8=0xc8;}else{_0x34d9b8=0xce;}_0x583a5c[_0x6bc6('0x1b')](_0x34d9b8);return _0x583a5c['set']('Content-Range',_0x4f2d7d+'-'+_0xc2d0b8+'/'+_0x5a6664)['json'](_0xeaa57e);}return null;};}function patchUpdates(_0x4d804f){return function(_0xb0b1e5){try{jsonpatch[_0x6bc6('0x22')](_0xb0b1e5,_0x4d804f,!![]);}catch(_0x44202d){return BPromise[_0x6bc6('0x23')](_0x44202d);}return _0xb0b1e5['save']();};}function saveUpdates(_0x4ee099,_0x147e0c){return function(_0x1d2b0c){if(_0x1d2b0c){return _0x1d2b0c[_0x6bc6('0x24')](_0x4ee099)[_0x6bc6('0x25')](function(_0x3be795){return _0x3be795;});}return null;};}function removeEntity(_0xdf99a3,_0x44fef6){return function(_0x45e900){if(_0x45e900){return _0x45e900[_0x6bc6('0x26')]()[_0x6bc6('0x25')](function(){_0xdf99a3[_0x6bc6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40d376,_0x5bac0e){return function(_0x57d1fb){if(!_0x57d1fb){_0x40d376[_0x6bc6('0x1a')](0x194);}return _0x57d1fb;};}function handleError(_0xf0a8f,_0x32ddf0){_0x32ddf0=_0x32ddf0||0x1f4;return function(_0x42e7b7){logger[_0x6bc6('0x27')](_0x42e7b7[_0x6bc6('0x28')]);if(_0x42e7b7[_0x6bc6('0x29')]){delete _0x42e7b7['name'];}_0xf0a8f[_0x6bc6('0x1b')](_0x32ddf0)[_0x6bc6('0x2a')](_0x42e7b7);};}function getMustacheRender(_0x2d869b,_0x124822){return Mustache[_0x6bc6('0x2b')](_0x2d869b,_[_0x6bc6('0x2c')](_0x124822[_0x6bc6('0x2d')],{'contact':_0x124822['contact'],'message':_0x124822[_0x6bc6('0x2e')],'agent':_0x124822[_0x6bc6('0x2f')],'interaction':_0x124822[_0x6bc6('0x30')],'account':_0x124822['account']}))||'';}exports['index']=function(_0x3ccd5d,_0x15aa3e){var _0xb9a36e={},_0x51e67c={},_0x39bf1a={'count':0x0,'rows':[]};var _0x8bcea=_[_0x6bc6('0x31')](db['FreshsalesField'][_0x6bc6('0x32')],function(_0x576ce0){return{'name':_0x576ce0[_0x6bc6('0x33')],'type':_0x576ce0[_0x6bc6('0x34')]['key']};});_0x51e67c[_0x6bc6('0x35')]=_[_0x6bc6('0x31')](_0x8bcea,_0x6bc6('0x29'));_0x51e67c[_0x6bc6('0x36')]=_[_0x6bc6('0x37')](_0x3ccd5d[_0x6bc6('0x36')]);_0x51e67c[_0x6bc6('0x38')]=_['intersection'](_0x51e67c[_0x6bc6('0x35')],_0x51e67c[_0x6bc6('0x36')]);_0xb9a36e[_0x6bc6('0x39')]=_[_0x6bc6('0x3a')](_0x51e67c['model'],qs['fields'](_0x3ccd5d[_0x6bc6('0x36')][_0x6bc6('0x3b')]));_0xb9a36e[_0x6bc6('0x39')]=_0xb9a36e[_0x6bc6('0x39')]['length']?_0xb9a36e['attributes']:_0x51e67c[_0x6bc6('0x35')];if(!_0x3ccd5d['query']['hasOwnProperty'](_0x6bc6('0x3c'))){_0xb9a36e['limit']=qs[_0x6bc6('0x20')](_0x3ccd5d[_0x6bc6('0x36')]['limit']);_0xb9a36e[_0x6bc6('0x1e')]=qs[_0x6bc6('0x1e')](_0x3ccd5d[_0x6bc6('0x36')]['offset']);}_0xb9a36e['order']=qs[_0x6bc6('0x3d')](_0x3ccd5d[_0x6bc6('0x36')]['sort']);_0xb9a36e[_0x6bc6('0x3e')]=qs['filters'](_['pick'](_0x3ccd5d[_0x6bc6('0x36')],_0x51e67c[_0x6bc6('0x38')]),_0x8bcea);if(_0x3ccd5d[_0x6bc6('0x36')][_0x6bc6('0x3f')]){_0xb9a36e[_0x6bc6('0x3e')]=_[_0x6bc6('0x2c')](_0xb9a36e[_0x6bc6('0x3e')],{'$or':_[_0x6bc6('0x31')](_0x8bcea,function(_0x5c3fd5){if(_0x5c3fd5[_0x6bc6('0x34')]!==_0x6bc6('0x40')){var _0x180511={};_0x180511[_0x5c3fd5[_0x6bc6('0x29')]]={'$like':'%'+_0x3ccd5d[_0x6bc6('0x36')][_0x6bc6('0x3f')]+'%'};return _0x180511;}})});}_0xb9a36e=_[_0x6bc6('0x2c')]({},_0xb9a36e,_0x3ccd5d[_0x6bc6('0x41')]);var _0x499419={'where':_0xb9a36e[_0x6bc6('0x3e')]};return db[_0x6bc6('0x42')]['count'](_0x499419)[_0x6bc6('0x25')](function(_0x46c1a8){_0x39bf1a[_0x6bc6('0x21')]=_0x46c1a8;if(_0x3ccd5d['query'][_0x6bc6('0x43')]){_0xb9a36e['include']=[{'all':!![]}];}return db[_0x6bc6('0x42')][_0x6bc6('0x44')](_0xb9a36e);})[_0x6bc6('0x25')](function(_0x2f1476){_0x39bf1a[_0x6bc6('0x45')]=_0x2f1476;return _0x39bf1a;})[_0x6bc6('0x25')](respondWithFilteredResult(_0x15aa3e,_0xb9a36e))['catch'](handleError(_0x15aa3e,null));};exports[_0x6bc6('0x46')]=function(_0x4bd1c1,_0x599561){var _0x17c8fb={'raw':!![],'where':{'id':_0x4bd1c1[_0x6bc6('0x47')]['id']}},_0x1b62ac={};_0x1b62ac['model']=_[_0x6bc6('0x37')](db[_0x6bc6('0x42')][_0x6bc6('0x32')]);_0x1b62ac[_0x6bc6('0x36')]=_[_0x6bc6('0x37')](_0x4bd1c1[_0x6bc6('0x36')]);_0x1b62ac[_0x6bc6('0x38')]=_[_0x6bc6('0x3a')](_0x1b62ac[_0x6bc6('0x35')],_0x1b62ac['query']);_0x17c8fb[_0x6bc6('0x39')]=_[_0x6bc6('0x3a')](_0x1b62ac[_0x6bc6('0x35')],qs[_0x6bc6('0x3b')](_0x4bd1c1[_0x6bc6('0x36')][_0x6bc6('0x3b')]));_0x17c8fb[_0x6bc6('0x39')]=_0x17c8fb['attributes'][_0x6bc6('0x48')]?_0x17c8fb[_0x6bc6('0x39')]:_0x1b62ac[_0x6bc6('0x35')];if(_0x4bd1c1[_0x6bc6('0x36')]['includeAll']){_0x17c8fb[_0x6bc6('0x49')]=[{'all':!![]}];}_0x17c8fb=_[_0x6bc6('0x2c')]({},_0x17c8fb,_0x4bd1c1['options']);return db[_0x6bc6('0x42')][_0x6bc6('0x4a')](_0x17c8fb)[_0x6bc6('0x25')](handleEntityNotFound(_0x599561,null))[_0x6bc6('0x25')](respondWithResult(_0x599561,null))[_0x6bc6('0x4b')](handleError(_0x599561,null));};exports['create']=function(_0x1b48ce,_0x411301){return db[_0x6bc6('0x42')]['create'](_0x1b48ce[_0x6bc6('0x2d')],{})[_0x6bc6('0x25')](respondWithResult(_0x411301,0xc9))[_0x6bc6('0x4b')](handleError(_0x411301,null));};exports[_0x6bc6('0x24')]=function(_0x35fd60,_0x601f57){if(_0x35fd60[_0x6bc6('0x2d')]['id']){delete _0x35fd60[_0x6bc6('0x2d')]['id'];}return db[_0x6bc6('0x42')][_0x6bc6('0x4a')]({'where':{'id':_0x35fd60[_0x6bc6('0x47')]['id']}})[_0x6bc6('0x25')](handleEntityNotFound(_0x601f57,null))[_0x6bc6('0x25')](saveUpdates(_0x35fd60[_0x6bc6('0x2d')],null))[_0x6bc6('0x25')](respondWithResult(_0x601f57,null))[_0x6bc6('0x4b')](handleError(_0x601f57,null));};exports[_0x6bc6('0x26')]=function(_0x311958,_0x575c83){return db[_0x6bc6('0x42')][_0x6bc6('0x4a')]({'where':{'id':_0x311958[_0x6bc6('0x47')]['id']}})[_0x6bc6('0x25')](handleEntityNotFound(_0x575c83,null))[_0x6bc6('0x25')](removeEntity(_0x575c83,null))['catch'](handleError(_0x575c83,null));}; \ No newline at end of file +var _0x41e4=['request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','render','merge','body','contact','message','interaction','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filters','type','VIRTUAL','filter','options','FreshsalesField','findAll','rows','catch','show','params','include','find','create','update','eml-format','zip-dir','fast-json-patch'];(function(_0x1d5842,_0x53d9f6){var _0x371cfc=function(_0x53ffd7){while(--_0x53ffd7){_0x1d5842['push'](_0x1d5842['shift']());}};_0x371cfc(++_0x53d9f6);}(_0x41e4,0x1dd));var _0x441e=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x41e4[_0xbf8ebe];return _0x1e25e8;};'use strict';var emlformat=require(_0x441e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x441e('0x1'));var jsonpatch=require(_0x441e('0x2'));var rp=require(_0x441e('0x3'));var moment=require(_0x441e('0x4'));var BPromise=require(_0x441e('0x5'));var Mustache=require(_0x441e('0x6'));var util=require('util');var path=require(_0x441e('0x7'));var sox=require(_0x441e('0x8'));var csv=require('to-csv');var ejs=require(_0x441e('0x9'));var fs=require('fs');var fs_extra=require(_0x441e('0xa'));var _=require(_0x441e('0xb'));var squel=require(_0x441e('0xc'));var crypto=require(_0x441e('0xd'));var jsforce=require(_0x441e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x441e('0xf'));var querystring=require('querystring');var Papa=require(_0x441e('0x10'));var Redis=require(_0x441e('0x11'));var authService=require(_0x441e('0x12'));var qs=require(_0x441e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x441e('0x14'))(_0x441e('0x15'));var utils=require(_0x441e('0x16'));var config=require(_0x441e('0x17'));var licenseUtil=require(_0x441e('0x18'));var db=require(_0x441e('0x19'))['db'];function respondWithStatusCode(_0x224196,_0x52af50){_0x52af50=_0x52af50||0xcc;return function(_0x2e64d3){if(_0x2e64d3){return _0x224196[_0x441e('0x1a')](_0x52af50);}return _0x224196[_0x441e('0x1b')](_0x52af50)[_0x441e('0x1c')]();};}function respondWithResult(_0x2e1309,_0x3d40c8){_0x3d40c8=_0x3d40c8||0xc8;return function(_0x4bc8ec){if(_0x4bc8ec){return _0x2e1309[_0x441e('0x1b')](_0x3d40c8)[_0x441e('0x1d')](_0x4bc8ec);}};}function respondWithFilteredResult(_0x607e44,_0x31d8b8){return function(_0x5f0532){if(_0x5f0532){var _0x5d6d9e=typeof _0x31d8b8[_0x441e('0x1e')]===_0x441e('0x1f')&&typeof _0x31d8b8[_0x441e('0x20')]===_0x441e('0x1f');var _0x3753cc=_0x5f0532[_0x441e('0x21')];var _0x4ce692=_0x5d6d9e?0x0:_0x31d8b8[_0x441e('0x1e')];var _0x35b2a5=_0x5d6d9e?_0x5f0532[_0x441e('0x21')]:_0x31d8b8[_0x441e('0x1e')]+_0x31d8b8['limit'];var _0x35bfa0;if(_0x35b2a5>=_0x3753cc){_0x35b2a5=_0x3753cc;_0x35bfa0=0xc8;}else{_0x35bfa0=0xce;}_0x607e44['status'](_0x35bfa0);return _0x607e44['set'](_0x441e('0x22'),_0x4ce692+'-'+_0x35b2a5+'/'+_0x3753cc)[_0x441e('0x1d')](_0x5f0532);}return null;};}function patchUpdates(_0x318a9f){return function(_0x5030ee){try{jsonpatch[_0x441e('0x23')](_0x5030ee,_0x318a9f,!![]);}catch(_0x2ece70){return BPromise[_0x441e('0x24')](_0x2ece70);}return _0x5030ee[_0x441e('0x25')]();};}function saveUpdates(_0x370061,_0x358be9){return function(_0x1aca1b){if(_0x1aca1b){return _0x1aca1b['update'](_0x370061)['then'](function(_0x2cfccc){return _0x2cfccc;});}return null;};}function removeEntity(_0xd86294,_0x1ce14c){return function(_0x170368){if(_0x170368){return _0x170368[_0x441e('0x26')]()[_0x441e('0x27')](function(){_0xd86294[_0x441e('0x1b')](0xcc)[_0x441e('0x1c')]();});}};}function handleEntityNotFound(_0xa8c3d4,_0x2fe762){return function(_0x2aea8c){if(!_0x2aea8c){_0xa8c3d4[_0x441e('0x1a')](0x194);}return _0x2aea8c;};}function handleError(_0x168d1d,_0x1716ed){_0x1716ed=_0x1716ed||0x1f4;return function(_0x3c9ee1){logger[_0x441e('0x28')](_0x3c9ee1[_0x441e('0x29')]);if(_0x3c9ee1[_0x441e('0x2a')]){delete _0x3c9ee1[_0x441e('0x2a')];}_0x168d1d[_0x441e('0x1b')](_0x1716ed)[_0x441e('0x2b')](_0x3c9ee1);};}function getMustacheRender(_0x2d865f,_0x45f0be){return Mustache[_0x441e('0x2c')](_0x2d865f,_[_0x441e('0x2d')](_0x45f0be[_0x441e('0x2e')],{'contact':_0x45f0be[_0x441e('0x2f')],'message':_0x45f0be[_0x441e('0x30')],'agent':_0x45f0be['agent'],'interaction':_0x45f0be[_0x441e('0x31')],'account':_0x45f0be['account']}))||'';}exports['index']=function(_0x21b302,_0x167aaf){var _0x42a862={},_0x2ab45c={},_0x420072={'count':0x0,'rows':[]};var _0xd62bed=_[_0x441e('0x32')](db['FreshsalesField'][_0x441e('0x33')],function(_0x35db16){return{'name':_0x35db16[_0x441e('0x34')],'type':_0x35db16['type'][_0x441e('0x35')]};});_0x2ab45c[_0x441e('0x36')]=_['map'](_0xd62bed,_0x441e('0x2a'));_0x2ab45c[_0x441e('0x37')]=_[_0x441e('0x38')](_0x21b302[_0x441e('0x37')]);_0x2ab45c['filters']=_[_0x441e('0x39')](_0x2ab45c['model'],_0x2ab45c[_0x441e('0x37')]);_0x42a862[_0x441e('0x3a')]=_[_0x441e('0x39')](_0x2ab45c[_0x441e('0x36')],qs[_0x441e('0x3b')](_0x21b302[_0x441e('0x37')][_0x441e('0x3b')]));_0x42a862[_0x441e('0x3a')]=_0x42a862['attributes'][_0x441e('0x3c')]?_0x42a862[_0x441e('0x3a')]:_0x2ab45c[_0x441e('0x36')];if(!_0x21b302[_0x441e('0x37')][_0x441e('0x3d')]('nolimit')){_0x42a862[_0x441e('0x20')]=qs[_0x441e('0x20')](_0x21b302['query'][_0x441e('0x20')]);_0x42a862[_0x441e('0x1e')]=qs[_0x441e('0x1e')](_0x21b302['query'][_0x441e('0x1e')]);}_0x42a862[_0x441e('0x3e')]=qs['sort'](_0x21b302[_0x441e('0x37')]['sort']);_0x42a862[_0x441e('0x3f')]=qs['filters'](_[_0x441e('0x40')](_0x21b302['query'],_0x2ab45c[_0x441e('0x41')]),_0xd62bed);if(_0x21b302['query']['filter']){_0x42a862[_0x441e('0x3f')]=_[_0x441e('0x2d')](_0x42a862['where'],{'$or':_[_0x441e('0x32')](_0xd62bed,function(_0xf7769){if(_0xf7769[_0x441e('0x42')]!==_0x441e('0x43')){var _0x1d7050={};_0x1d7050[_0xf7769[_0x441e('0x2a')]]={'$like':'%'+_0x21b302['query'][_0x441e('0x44')]+'%'};return _0x1d7050;}})});}_0x42a862=_[_0x441e('0x2d')]({},_0x42a862,_0x21b302[_0x441e('0x45')]);var _0x23790a={'where':_0x42a862[_0x441e('0x3f')]};return db[_0x441e('0x46')][_0x441e('0x21')](_0x23790a)[_0x441e('0x27')](function(_0x111884){_0x420072['count']=_0x111884;if(_0x21b302[_0x441e('0x37')]['includeAll']){_0x42a862['include']=[{'all':!![]}];}return db[_0x441e('0x46')][_0x441e('0x47')](_0x42a862);})['then'](function(_0x9f82a9){_0x420072[_0x441e('0x48')]=_0x9f82a9;return _0x420072;})[_0x441e('0x27')](respondWithFilteredResult(_0x167aaf,_0x42a862))[_0x441e('0x49')](handleError(_0x167aaf,null));};exports[_0x441e('0x4a')]=function(_0x30d43f,_0x946915){var _0x4f56fc={'raw':!![],'where':{'id':_0x30d43f[_0x441e('0x4b')]['id']}},_0x109250={};_0x109250['model']=_[_0x441e('0x38')](db['FreshsalesField'][_0x441e('0x33')]);_0x109250[_0x441e('0x37')]=_[_0x441e('0x38')](_0x30d43f['query']);_0x109250[_0x441e('0x41')]=_[_0x441e('0x39')](_0x109250[_0x441e('0x36')],_0x109250[_0x441e('0x37')]);_0x4f56fc[_0x441e('0x3a')]=_[_0x441e('0x39')](_0x109250[_0x441e('0x36')],qs[_0x441e('0x3b')](_0x30d43f[_0x441e('0x37')]['fields']));_0x4f56fc[_0x441e('0x3a')]=_0x4f56fc[_0x441e('0x3a')][_0x441e('0x3c')]?_0x4f56fc[_0x441e('0x3a')]:_0x109250['model'];if(_0x30d43f[_0x441e('0x37')]['includeAll']){_0x4f56fc[_0x441e('0x4c')]=[{'all':!![]}];}_0x4f56fc=_[_0x441e('0x2d')]({},_0x4f56fc,_0x30d43f[_0x441e('0x45')]);return db[_0x441e('0x46')][_0x441e('0x4d')](_0x4f56fc)[_0x441e('0x27')](handleEntityNotFound(_0x946915,null))[_0x441e('0x27')](respondWithResult(_0x946915,null))['catch'](handleError(_0x946915,null));};exports[_0x441e('0x4e')]=function(_0xace062,_0x4ea45d){return db[_0x441e('0x46')][_0x441e('0x4e')](_0xace062[_0x441e('0x2e')],{})[_0x441e('0x27')](respondWithResult(_0x4ea45d,0xc9))[_0x441e('0x49')](handleError(_0x4ea45d,null));};exports[_0x441e('0x4f')]=function(_0x453953,_0x53a2c6){if(_0x453953[_0x441e('0x2e')]['id']){delete _0x453953[_0x441e('0x2e')]['id'];}return db[_0x441e('0x46')]['find']({'where':{'id':_0x453953[_0x441e('0x4b')]['id']}})[_0x441e('0x27')](handleEntityNotFound(_0x53a2c6,null))[_0x441e('0x27')](saveUpdates(_0x453953[_0x441e('0x2e')],null))[_0x441e('0x27')](respondWithResult(_0x53a2c6,null))[_0x441e('0x49')](handleError(_0x53a2c6,null));};exports[_0x441e('0x26')]=function(_0x2567ab,_0x4d4592){return db[_0x441e('0x46')]['find']({'where':{'id':_0x2567ab['params']['id']}})[_0x441e('0x27')](handleEntityNotFound(_0x4d4592,null))[_0x441e('0x27')](removeEntity(_0x4d4592,null))[_0x441e('0x49')](handleError(_0x4d4592,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 65df628..e916d84 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 _0x6713=['freshsales_unique_index','idField','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','FreshsalesField','int_freshsales_fields'];(function(_0x5207a2,_0x316913){var _0x314716=function(_0x2ca663){while(--_0x2ca663){_0x5207a2['push'](_0x5207a2['shift']());}};_0x314716(++_0x316913);}(_0x6713,0x6a));var _0x3671=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x6713[_0x1044e5];return _0x5ad0dd;};'use strict';var _=require(_0x3671('0x0'));var util=require('util');var logger=require(_0x3671('0x1'))('api');var moment=require(_0x3671('0x2'));var BPromise=require(_0x3671('0x3'));var rp=require(_0x3671('0x4'));var fs=require('fs');var path=require(_0x3671('0x5'));var rimraf=require(_0x3671('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x3671('0x7')]=function(_0x228a9b,_0x5dff6a){return _0x228a9b[_0x3671('0x8')](_0x3671('0x9'),attributes,{'tableName':_0x3671('0xa'),'paranoid':![],'indexes':[{'name':_0x3671('0xb'),'fields':[_0x3671('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ce4=['FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define'];(function(_0x5d1807,_0x18a2e9){var _0x399db4=function(_0x5b5e28){while(--_0x5b5e28){_0x5d1807['push'](_0x5d1807['shift']());}};_0x399db4(++_0x18a2e9);}(_0x7ce4,0xa4));var _0x47ce=function(_0x4f18cf,_0x3d4e18){_0x4f18cf=_0x4f18cf-0x0;var _0x5dff1f=_0x7ce4[_0x4f18cf];return _0x5dff1f;};'use strict';var _=require(_0x47ce('0x0'));var util=require(_0x47ce('0x1'));var logger=require(_0x47ce('0x2'))(_0x47ce('0x3'));var moment=require(_0x47ce('0x4'));var BPromise=require('bluebird');var rp=require(_0x47ce('0x5'));var fs=require('fs');var path=require(_0x47ce('0x6'));var rimraf=require(_0x47ce('0x7'));var config=require(_0x47ce('0x8'));var attributes=require(_0x47ce('0x9'));module[_0x47ce('0xa')]=function(_0x401a3f,_0xf0685c){return _0x401a3f[_0x47ce('0xb')](_0x47ce('0xc'),attributes,{'tableName':_0x47ce('0xd'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x47ce('0xe'),_0x47ce('0xf')],'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 0c70d60..9c8bba4 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 _0xc94b=['FreshsalesField,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xc94b,0x17a));var _0xbc94=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xc94b[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xbc94('0x0'));var util=require(_0xbc94('0x1'));var moment=require(_0xbc94('0x2'));var BPromise=require(_0xbc94('0x3'));var rs=require(_0xbc94('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc94('0x5'))['db'];var utils=require(_0xbc94('0x6'));var logger=require(_0xbc94('0x7'))(_0xbc94('0x8'));var config=require(_0xbc94('0x9'));var jayson=require(_0xbc94('0xa'));var client=jayson['client'][_0xbc94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x324bd7,_0x58440e,_0x4e2536){return new BPromise(function(_0x38dc4f,_0x4d7929){return client[_0xbc94('0xc')](_0x324bd7,_0x4e2536)[_0xbc94('0xd')](function(_0x3065a7){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x58440e,'request\x20sent');logger['debug'](_0xbc94('0xe'),_0x58440e,'request\x20sent',JSON[_0xbc94('0xf')](_0x3065a7));if(_0x3065a7['error']){if(_0x3065a7[_0xbc94('0x10')][_0xbc94('0x11')]===0x1f4){logger[_0xbc94('0x10')](_0xbc94('0x12'),_0x58440e,_0x3065a7[_0xbc94('0x10')][_0xbc94('0x13')]);return _0x4d7929(_0x3065a7['error'][_0xbc94('0x13')]);}logger['error'](_0xbc94('0x12'),_0x58440e,_0x3065a7[_0xbc94('0x10')][_0xbc94('0x13')]);return _0x38dc4f(_0x3065a7[_0xbc94('0x10')][_0xbc94('0x13')]);}else{logger['info'](_0xbc94('0x12'),_0x58440e,_0xbc94('0x14'));_0x38dc4f(_0x3065a7[_0xbc94('0x15')][_0xbc94('0x13')]);}})['catch'](function(_0x3f7216){logger[_0xbc94('0x10')](_0xbc94('0x12'),_0x58440e,_0x3f7216);_0x4d7929(_0x3f7216);});});} \ No newline at end of file +var _0xd957=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring'];(function(_0x58d369,_0x2891ec){var _0x47f6fa=function(_0x5c45ae){while(--_0x5c45ae){_0x58d369['push'](_0x58d369['shift']());}};_0x47f6fa(++_0x2891ec);}(_0xd957,0x1b6));var _0x7d95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd957[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7d95('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7d95('0x1'));var rs=require(_0x7d95('0x2'));var fs=require('fs');var Redis=require(_0x7d95('0x3'));var db=require(_0x7d95('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d95('0x5'))(_0x7d95('0x6'));var config=require(_0x7d95('0x7'));var jayson=require(_0x7d95('0x8'));var client=jayson['client'][_0x7d95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a59e5,_0x104e3f,_0x4e4706){return new BPromise(function(_0x413172,_0x46868e){return client[_0x7d95('0xa')](_0x4a59e5,_0x4e4706)['then'](function(_0x310f49){logger[_0x7d95('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x104e3f,_0x7d95('0xc'));logger[_0x7d95('0xd')](_0x7d95('0xe'),_0x104e3f,_0x7d95('0xc'),JSON[_0x7d95('0xf')](_0x310f49));if(_0x310f49[_0x7d95('0x10')]){if(_0x310f49[_0x7d95('0x10')][_0x7d95('0x11')]===0x1f4){logger[_0x7d95('0x10')](_0x7d95('0x12'),_0x104e3f,_0x310f49[_0x7d95('0x10')][_0x7d95('0x13')]);return _0x46868e(_0x310f49[_0x7d95('0x10')]['message']);}logger[_0x7d95('0x10')](_0x7d95('0x12'),_0x104e3f,_0x310f49['error'][_0x7d95('0x13')]);return _0x413172(_0x310f49[_0x7d95('0x10')]['message']);}else{logger[_0x7d95('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x104e3f,'request\x20sent');_0x413172(_0x310f49[_0x7d95('0x14')][_0x7d95('0x13')]);}})['catch'](function(_0xee9de5){logger[_0x7d95('0x10')](_0x7d95('0x12'),_0x104e3f,_0xee9de5);_0x46868e(_0xee9de5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0f51dc2..40b4851 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 _0xfdb5=['/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','/:id'];(function(_0x311dca,_0xbbdf15){var _0x229161=function(_0x1b0ae8){while(--_0x1b0ae8){_0x311dca['push'](_0x311dca['shift']());}};_0x229161(++_0xbbdf15);}(_0xfdb5,0x112));var _0x5fdb=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xfdb5[_0x341e0f];return _0x59555a;};'use strict';var multer=require(_0x5fdb('0x0'));var util=require(_0x5fdb('0x1'));var path=require(_0x5fdb('0x2'));var timeout=require(_0x5fdb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5fdb('0x4'));var auth=require(_0x5fdb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5fdb('0x6'));var controller=require(_0x5fdb('0x7'));router['get']('/',auth[_0x5fdb('0x8')](),controller[_0x5fdb('0x9')]);router[_0x5fdb('0xa')](_0x5fdb('0xb'),auth[_0x5fdb('0x8')](),controller['show']);router['get'](_0x5fdb('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x5fdb('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x5fdb('0xd')]);router[_0x5fdb('0xe')]('/',auth['isAuthenticated'](),controller[_0x5fdb('0xf')]);router[_0x5fdb('0xe')](_0x5fdb('0xc'),auth[_0x5fdb('0x8')](),controller[_0x5fdb('0x10')]);router[_0x5fdb('0x11')](_0x5fdb('0xb'),auth[_0x5fdb('0x8')](),controller[_0x5fdb('0x12')]);router[_0x5fdb('0x13')](_0x5fdb('0xb'),auth[_0x5fdb('0x8')](),controller[_0x5fdb('0x14')]);module[_0x5fdb('0x15')]=router; \ No newline at end of file +var _0x827f=['post','create','/:id','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','getFields'];(function(_0xe9e6cf,_0x395f6d){var _0x2b8851=function(_0x4d6bd4){while(--_0x4d6bd4){_0xe9e6cf['push'](_0xe9e6cf['shift']());}};_0x2b8851(++_0x395f6d);}(_0x827f,0x91));var _0xf827=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x827f[_0x2aea9e];return _0x430b92;};'use strict';var multer=require(_0xf827('0x0'));var util=require('util');var path=require(_0xf827('0x1'));var timeout=require('connect-timeout');var express=require(_0xf827('0x2'));var router=express[_0xf827('0x3')]();var fs_extra=require(_0xf827('0x4'));var auth=require(_0xf827('0x5'));var interaction=require(_0xf827('0x6'));var config=require(_0xf827('0x7'));var controller=require(_0xf827('0x8'));router[_0xf827('0x9')]('/',auth[_0xf827('0xa')](),controller[_0xf827('0xb')]);router[_0xf827('0x9')]('/:id',auth[_0xf827('0xa')](),controller['show']);router[_0xf827('0x9')](_0xf827('0xc'),auth[_0xf827('0xa')](),controller[_0xf827('0xd')]);router['get']('/:id/fields',auth[_0xf827('0xa')](),controller[_0xf827('0xe')]);router[_0xf827('0xf')]('/',auth['isAuthenticated'](),controller[_0xf827('0x10')]);router[_0xf827('0xf')](_0xf827('0xc'),auth[_0xf827('0xa')](),controller['addConfiguration']);router['put'](_0xf827('0x11'),auth[_0xf827('0xa')](),controller['update']);router[_0xf827('0x12')](_0xf827('0x11'),auth[_0xf827('0xa')](),controller['destroy']);module[_0xf827('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e641a76..1018bb6 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 _0xaeed=['integrationTab','sequelize','exports','STRING','username','ENUM','newTab'];(function(_0x2818d3,_0x1c7d79){var _0x5de556=function(_0x2dc245){while(--_0x2dc245){_0x2818d3['push'](_0x2818d3['shift']());}};_0x5de556(++_0x1c7d79);}(_0xaeed,0x78));var _0xdaee=function(_0x18d4a7,_0x31c99d){_0x18d4a7=_0x18d4a7-0x0;var _0x364380=_0xaeed[_0x18d4a7];return _0x364380;};'use strict';var Sequelize=require(_0xdaee('0x0'));module[_0xdaee('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdaee('0x2')],'unique':_0xdaee('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xdaee('0x2')]},'clientSecret':{'type':Sequelize[_0xdaee('0x2')]},'securityToken':{'type':Sequelize[_0xdaee('0x2')]},'serverUrl':{'type':Sequelize[_0xdaee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdaee('0x4')]('integrationTab',_0xdaee('0x5')),'defaultValue':_0xdaee('0x6')}}; \ No newline at end of file +var _0xd651=['newTab','sequelize','exports','STRING','username','ENUM'];(function(_0x488612,_0x24627f){var _0x45b473=function(_0x513e7b){while(--_0x513e7b){_0x488612['push'](_0x488612['shift']());}};_0x45b473(++_0x24627f);}(_0xd651,0x1e1));var _0x1d65=function(_0x1caa2d,_0x4683e1){_0x1caa2d=_0x1caa2d-0x0;var _0x2569b7=_0xd651[_0x1caa2d];return _0x2569b7;};'use strict';var Sequelize=require(_0x1d65('0x0'));module[_0x1d65('0x1')]={'name':{'type':Sequelize[_0x1d65('0x2')]},'description':{'type':Sequelize[_0x1d65('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1d65('0x3')},'remoteUri':{'type':Sequelize[_0x1d65('0x2')]},'password':{'type':Sequelize[_0x1d65('0x2')]},'clientId':{'type':Sequelize[_0x1d65('0x2')]},'clientSecret':{'type':Sequelize[_0x1d65('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1d65('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1d65('0x4')]('integrationTab',_0x1d65('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9cf60db..0150371 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 _0x5204=['False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','render','merge','body','contact','agent','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','fields','options','find','create','getConfigurations','findOne','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','Subjects','getFields','Task','remoteUri','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','password','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','True','true'];(function(_0x3bb265,_0x4cd8b3){var _0x50c8d2=function(_0x1fe722){while(--_0x1fe722){_0x3bb265['push'](_0x3bb265['shift']());}};_0x50c8d2(++_0x4cd8b3);}(_0x5204,0x94));var _0x4520=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x5204[_0x589aee];return _0x2f5ed4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4520('0x0'));var zipdir=require(_0x4520('0x1'));var jsonpatch=require(_0x4520('0x2'));var rp=require(_0x4520('0x3'));var moment=require(_0x4520('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4520('0x5'));var util=require(_0x4520('0x6'));var path=require(_0x4520('0x7'));var sox=require(_0x4520('0x8'));var csv=require(_0x4520('0x9'));var ejs=require(_0x4520('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4520('0xb'));var squel=require('squel');var crypto=require(_0x4520('0xc'));var jsforce=require(_0x4520('0xd'));var deskjs=require(_0x4520('0xe'));var toCsv=require(_0x4520('0x9'));var querystring=require(_0x4520('0xf'));var Papa=require(_0x4520('0x10'));var Redis=require(_0x4520('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4520('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4520('0x13'))(_0x4520('0x14'));var utils=require(_0x4520('0x15'));var config=require(_0x4520('0x16'));var licenseUtil=require(_0x4520('0x17'));var db=require(_0x4520('0x18'))['db'];var integrations=require(_0x4520('0x19'));var jayson=require(_0x4520('0x1a'));var client=jayson[_0x4520('0x1b')][_0x4520('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3f07e0,_0x40936c,_0x5bc77a,_0x4236f4){return new BPromise(function(_0x139908,_0x5d5000){var _0x30b2b9=_0x4236f4||client;return _0x30b2b9[_0x4520('0x1d')](_0x3f07e0,_0x5bc77a)[_0x4520('0x1e')](function(_0x5c8034){logger['info'](_0x4520('0x1f'),_0x40936c,_0x4520('0x20'));logger[_0x4520('0x21')](_0x4520('0x22'),_0x40936c,_0x4520('0x20'),JSON[_0x4520('0x23')](_0x5c8034));if(_0x5c8034[_0x4520('0x24')]){if(_0x5c8034['error'][_0x4520('0x25')]===0x1f4){logger[_0x4520('0x24')]('SalesforceAccount,\x20%s,\x20%s',_0x40936c,_0x5c8034['error'][_0x4520('0x26')]);return _0x5d5000(_0x5c8034[_0x4520('0x24')][_0x4520('0x26')]);}logger[_0x4520('0x24')]('SalesforceAccount,\x20%s,\x20%s',_0x40936c,_0x5c8034['error'][_0x4520('0x26')]);return _0x139908(_0x5c8034[_0x4520('0x24')][_0x4520('0x26')]);}else{logger[_0x4520('0x27')](_0x4520('0x1f'),_0x40936c,_0x4520('0x20'));_0x139908(_0x5c8034['result'][_0x4520('0x26')]);}})[_0x4520('0x28')](function(_0x21aee5){logger['error'](_0x4520('0x1f'),_0x40936c,_0x21aee5);_0x5d5000(_0x21aee5);});});}function respondWithStatusCode(_0x2b9bf6,_0x5a111c){_0x5a111c=_0x5a111c||0xcc;return function(_0xcd2964){if(_0xcd2964){return _0x2b9bf6['sendStatus'](_0x5a111c);}return _0x2b9bf6[_0x4520('0x29')](_0x5a111c)[_0x4520('0x2a')]();};}function respondWithResult(_0x504d14,_0x1e19e5){_0x1e19e5=_0x1e19e5||0xc8;return function(_0x261b4d){if(_0x261b4d){return _0x504d14['status'](_0x1e19e5)[_0x4520('0x2b')](_0x261b4d);}};}function respondWithFilteredResult(_0x322a98,_0x199c28){return function(_0x567930){if(_0x567930){var _0x1d3fd0=typeof _0x199c28[_0x4520('0x2c')]==='undefined'&&typeof _0x199c28[_0x4520('0x2d')]===_0x4520('0x2e');var _0x46bb00=_0x567930[_0x4520('0x2f')];var _0x5e4902=_0x1d3fd0?0x0:_0x199c28[_0x4520('0x2c')];var _0x3d9b26=_0x1d3fd0?_0x567930[_0x4520('0x2f')]:_0x199c28[_0x4520('0x2c')]+_0x199c28[_0x4520('0x2d')];var _0x287c96;if(_0x3d9b26>=_0x46bb00){_0x3d9b26=_0x46bb00;_0x287c96=0xc8;}else{_0x287c96=0xce;}_0x322a98['status'](_0x287c96);return _0x322a98[_0x4520('0x30')](_0x4520('0x31'),_0x5e4902+'-'+_0x3d9b26+'/'+_0x46bb00)['json'](_0x567930);}return null;};}function patchUpdates(_0x32eb96){return function(_0x1f9ecd){try{jsonpatch[_0x4520('0x32')](_0x1f9ecd,_0x32eb96,!![]);}catch(_0x2ec374){return BPromise[_0x4520('0x33')](_0x2ec374);}return _0x1f9ecd[_0x4520('0x34')]();};}function saveUpdates(_0x55c6ea,_0x296e55){return function(_0x3cb1c6){if(_0x3cb1c6){return _0x3cb1c6[_0x4520('0x35')](_0x55c6ea)['then'](function(_0x8a308b){return _0x8a308b;});}return null;};}function removeEntity(_0x1bf680,_0x140117){return function(_0xcc80b9){if(_0xcc80b9){return _0xcc80b9[_0x4520('0x36')]()['then'](function(){_0x1bf680[_0x4520('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc7786c,_0xa941f6){return function(_0x4e0c67){if(!_0x4e0c67){_0xc7786c['sendStatus'](0x194);}return _0x4e0c67;};}function handleError(_0x1b7ff2,_0x3ddff2){_0x3ddff2=_0x3ddff2||0x1f4;return function(_0xd2fdff){logger[_0x4520('0x24')](_0xd2fdff[_0x4520('0x37')]);if(_0xd2fdff[_0x4520('0x38')]){delete _0xd2fdff[_0x4520('0x38')];}_0x1b7ff2['status'](_0x3ddff2)[_0x4520('0x39')](_0xd2fdff);};}function getMustacheRender(_0x968f6f,_0x5eeacc){return Mustache[_0x4520('0x3a')](_0x968f6f,_[_0x4520('0x3b')](_0x5eeacc[_0x4520('0x3c')],{'contact':_0x5eeacc[_0x4520('0x3d')],'message':_0x5eeacc[_0x4520('0x26')],'agent':_0x5eeacc[_0x4520('0x3e')],'interaction':_0x5eeacc['interaction'],'account':_0x5eeacc['account']}))||'';}exports[_0x4520('0x3f')]=function(_0x259d0c,_0x506418){var _0x1a08cf={},_0x48fe48={},_0x2e0260={'count':0x0,'rows':[]};var _0xf7f46d=_['map'](db[_0x4520('0x40')][_0x4520('0x41')],function(_0xf57a76){return{'name':_0xf57a76[_0x4520('0x42')],'type':_0xf57a76[_0x4520('0x43')][_0x4520('0x44')]};});_0x48fe48[_0x4520('0x45')]=_[_0x4520('0x46')](_0xf7f46d,_0x4520('0x38'));_0x48fe48['query']=_[_0x4520('0x47')](_0x259d0c[_0x4520('0x48')]);_0x48fe48['filters']=_[_0x4520('0x49')](_0x48fe48[_0x4520('0x45')],_0x48fe48['query']);_0x1a08cf[_0x4520('0x4a')]=_[_0x4520('0x49')](_0x48fe48[_0x4520('0x45')],qs['fields'](_0x259d0c['query']['fields']));_0x1a08cf['attributes']=_0x1a08cf[_0x4520('0x4a')][_0x4520('0x4b')]?_0x1a08cf['attributes']:_0x48fe48[_0x4520('0x45')];if(!_0x259d0c[_0x4520('0x48')][_0x4520('0x4c')]('nolimit')){_0x1a08cf[_0x4520('0x2d')]=qs[_0x4520('0x2d')](_0x259d0c[_0x4520('0x48')][_0x4520('0x2d')]);_0x1a08cf[_0x4520('0x2c')]=qs[_0x4520('0x2c')](_0x259d0c[_0x4520('0x48')][_0x4520('0x2c')]);}_0x1a08cf[_0x4520('0x4d')]=qs[_0x4520('0x4e')](_0x259d0c[_0x4520('0x48')][_0x4520('0x4e')]);_0x1a08cf[_0x4520('0x4f')]=qs[_0x4520('0x50')](_[_0x4520('0x51')](_0x259d0c[_0x4520('0x48')],_0x48fe48['filters']),_0xf7f46d);if(_0x259d0c[_0x4520('0x48')][_0x4520('0x52')]){_0x1a08cf['where']=_[_0x4520('0x3b')](_0x1a08cf[_0x4520('0x4f')],{'$or':_[_0x4520('0x46')](_0xf7f46d,function(_0xaaa162){if(_0xaaa162['type']!==_0x4520('0x53')){var _0x38e158={};_0x38e158[_0xaaa162[_0x4520('0x38')]]={'$like':'%'+_0x259d0c[_0x4520('0x48')][_0x4520('0x52')]+'%'};return _0x38e158;}})});}_0x1a08cf=_[_0x4520('0x3b')]({},_0x1a08cf,_0x259d0c['options']);var _0x376612={'where':_0x1a08cf[_0x4520('0x4f')]};return db[_0x4520('0x40')][_0x4520('0x2f')](_0x376612)[_0x4520('0x1e')](function(_0x3611f8){_0x2e0260['count']=_0x3611f8;if(_0x259d0c[_0x4520('0x48')][_0x4520('0x54')]){_0x1a08cf[_0x4520('0x55')]=[{'all':!![]}];}return db[_0x4520('0x40')][_0x4520('0x56')](_0x1a08cf);})[_0x4520('0x1e')](function(_0x337f2e){_0x2e0260['rows']=_0x337f2e;return _0x2e0260;})[_0x4520('0x1e')](respondWithFilteredResult(_0x506418,_0x1a08cf))[_0x4520('0x28')](handleError(_0x506418,null));};exports[_0x4520('0x57')]=function(_0x215c3d,_0x248f46){var _0x3c4dfb={'raw':![],'where':{'id':_0x215c3d[_0x4520('0x58')]['id']}},_0x2aaffc={};_0x2aaffc[_0x4520('0x45')]=_[_0x4520('0x47')](db['SalesforceAccount'][_0x4520('0x41')]);_0x2aaffc['query']=_['keys'](_0x215c3d[_0x4520('0x48')]);_0x2aaffc[_0x4520('0x50')]=_['intersection'](_0x2aaffc[_0x4520('0x45')],_0x2aaffc['query']);_0x3c4dfb[_0x4520('0x4a')]=_['intersection'](_0x2aaffc['model'],qs[_0x4520('0x59')](_0x215c3d['query']['fields']));_0x3c4dfb[_0x4520('0x4a')]=_0x3c4dfb[_0x4520('0x4a')][_0x4520('0x4b')]?_0x3c4dfb[_0x4520('0x4a')]:_0x2aaffc[_0x4520('0x45')];if(_0x215c3d[_0x4520('0x48')]['includeAll']){_0x3c4dfb[_0x4520('0x55')]=[{'all':!![]}];}_0x3c4dfb=_[_0x4520('0x3b')]({},_0x3c4dfb,_0x215c3d[_0x4520('0x5a')]);return db[_0x4520('0x40')][_0x4520('0x5b')](_0x3c4dfb)[_0x4520('0x1e')](handleEntityNotFound(_0x248f46,null))['then'](respondWithResult(_0x248f46,null))['catch'](handleError(_0x248f46,null));};exports[_0x4520('0x5c')]=function(_0x2b5ed1,_0x19edb9){return db['SalesforceAccount'][_0x4520('0x5c')](_0x2b5ed1['body'],{})['then'](respondWithResult(_0x19edb9,0xc9))[_0x4520('0x28')](handleError(_0x19edb9,null));};exports['update']=function(_0x4e966c,_0x92a58){if(_0x4e966c['body']['id']){delete _0x4e966c[_0x4520('0x3c')]['id'];}return db[_0x4520('0x40')]['find']({'where':{'id':_0x4e966c[_0x4520('0x58')]['id']}})[_0x4520('0x1e')](handleEntityNotFound(_0x92a58,null))[_0x4520('0x1e')](saveUpdates(_0x4e966c[_0x4520('0x3c')],null))[_0x4520('0x1e')](respondWithResult(_0x92a58,null))['catch'](handleError(_0x92a58,null));};exports[_0x4520('0x36')]=function(_0x155b92,_0x5780a4){return db[_0x4520('0x40')][_0x4520('0x5b')]({'where':{'id':_0x155b92[_0x4520('0x58')]['id']}})[_0x4520('0x1e')](handleEntityNotFound(_0x5780a4,null))[_0x4520('0x1e')](removeEntity(_0x5780a4,null))[_0x4520('0x28')](handleError(_0x5780a4,null));};exports[_0x4520('0x5d')]=function(_0x4dd13e,_0x3eb835,_0x59a188){var _0x9afcbc={};var _0x122f6f={};var _0x837e57;var _0x3bbab4;return db[_0x4520('0x40')][_0x4520('0x5e')]({'where':{'id':_0x4dd13e[_0x4520('0x58')]['id']}})[_0x4520('0x1e')](handleEntityNotFound(_0x3eb835,null))[_0x4520('0x1e')](function(_0x4d98c2){if(_0x4d98c2){_0x837e57=_0x4d98c2;_0x122f6f['model']=_[_0x4520('0x47')](db['SalesforceConfiguration'][_0x4520('0x41')]);_0x122f6f[_0x4520('0x48')]=_['keys'](_0x4dd13e[_0x4520('0x48')]);_0x122f6f[_0x4520('0x50')]=_[_0x4520('0x49')](_0x122f6f[_0x4520('0x45')],_0x122f6f[_0x4520('0x48')]);_0x9afcbc[_0x4520('0x4a')]=_[_0x4520('0x49')](_0x122f6f[_0x4520('0x45')],qs[_0x4520('0x59')](_0x4dd13e['query'][_0x4520('0x59')]));_0x9afcbc[_0x4520('0x4a')]=_0x9afcbc[_0x4520('0x4a')][_0x4520('0x4b')]?_0x9afcbc[_0x4520('0x4a')]:_0x122f6f['model'];_0x9afcbc['order']=qs[_0x4520('0x4e')](_0x4dd13e[_0x4520('0x48')][_0x4520('0x4e')]);_0x9afcbc['where']=qs[_0x4520('0x50')](_[_0x4520('0x51')](_0x4dd13e[_0x4520('0x48')],_0x122f6f[_0x4520('0x50')]));if(_0x4dd13e[_0x4520('0x48')][_0x4520('0x52')]){_0x9afcbc[_0x4520('0x4f')]=_[_0x4520('0x3b')](_0x9afcbc['where'],{'$or':_[_0x4520('0x46')](_0x9afcbc[_0x4520('0x4a')],function(_0x4a9e96){var _0x3ab36e={};_0x3ab36e[_0x4a9e96]={'$like':'%'+_0x4dd13e[_0x4520('0x48')][_0x4520('0x52')]+'%'};return _0x3ab36e;})});}_0x9afcbc=_['merge']({},_0x9afcbc,_0x4dd13e['options']);return _0x837e57[_0x4520('0x5d')](_0x9afcbc);}})[_0x4520('0x1e')](function(_0x1d5439){if(_0x1d5439){_0x3bbab4=_0x1d5439['length'];if(!_0x4dd13e[_0x4520('0x48')][_0x4520('0x4c')](_0x4520('0x5f'))){_0x9afcbc[_0x4520('0x2d')]=qs['limit'](_0x4dd13e['query'][_0x4520('0x2d')]);_0x9afcbc['offset']=qs[_0x4520('0x2c')](_0x4dd13e[_0x4520('0x48')][_0x4520('0x2c')]);}return _0x837e57[_0x4520('0x5d')](_0x9afcbc);}})['then'](function(_0x287f75){if(_0x287f75){return _0x287f75?{'count':_0x3bbab4,'rows':_0x287f75}:null;}})[_0x4520('0x1e')](respondWithResult(_0x3eb835,null))[_0x4520('0x28')](handleError(_0x3eb835,null));};exports[_0x4520('0x60')]=function(_0x47bd2c,_0x338db6,_0x48b2bf){if(_0x47bd2c['body']['id']){delete _0x47bd2c[_0x4520('0x3c')]['id'];}return db[_0x4520('0x40')][_0x4520('0x5e')]({'where':{'id':_0x47bd2c[_0x4520('0x58')]['id']}})['then'](handleEntityNotFound(_0x338db6,null))[_0x4520('0x1e')](function(_0x1bf8a0){if(_0x1bf8a0){_0x47bd2c[_0x4520('0x3c')][_0x4520('0x61')]=_0x1bf8a0['id'];_0x47bd2c[_0x4520('0x3c')]['Subjects']=integrations['getSubjects'](_0x47bd2c[_0x4520('0x3c')][_0x4520('0x62')],_0x47bd2c['body'][_0x4520('0x43')]);_0x47bd2c[_0x4520('0x3c')][_0x4520('0x63')]=integrations[_0x4520('0x64')](_0x47bd2c[_0x4520('0x3c')][_0x4520('0x62')],_0x47bd2c['body']['type']);return db[_0x4520('0x65')][_0x4520('0x5c')](_0x47bd2c[_0x4520('0x3c')],{'include':[{'model':db[_0x4520('0x66')],'as':_0x4520('0x67')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0x4520('0x1e')](respondWithResult(_0x338db6,null))[_0x4520('0x28')](handleError(_0x338db6,null));};exports[_0x4520('0x68')]=function(_0xe4b02,_0x3cb730,_0x2bfdd1){var _0x4a528a;var _0x4fadae='';var _0x4869db=_0x4520('0x69');return db['SalesforceAccount'][_0x4520('0x5e')]({'where':{'id':_0xe4b02[_0x4520('0x58')]['id']},'attributes':['id',_0x4520('0x6a'),'clientId',_0x4520('0x6b'),_0x4520('0x6c'),'password',_0x4520('0x6d')]})[_0x4520('0x1e')](handleEntityNotFound(_0x3cb730,null))[_0x4520('0x1e')](function(_0x5fb049){if(_0x5fb049){_0x4fadae=_0x5fb049[_0x4520('0x6a')];var _0x197f5b=_0x4fadae[_0x4520('0x6e')](-0x1);if(_0x197f5b==='/'){_0x4fadae=_0x4fadae[_0x4520('0x6f')](0x0,_0x4fadae[_0x4520('0x70')](_0x197f5b));}_0x4a528a=new jsforce[(_0x4520('0x71'))]({'oauth2':{'loginUrl':_0x4fadae,'clientId':_0x5fb049[_0x4520('0x72')],'clientSecret':_0x5fb049[_0x4520('0x6b')]}});return _0x4a528a[_0x4520('0x73')](_0x5fb049[_0x4520('0x6c')],_0x5fb049[_0x4520('0x74')][_0x4520('0x75')](_0x5fb049[_0x4520('0x6d')]));}})['then'](function(_0x3a2b3e){if(_0x3a2b3e){if(!_[_0x4520('0x76')](_0xe4b02[_0x4520('0x48')][_0x4520('0x77')])){_0x4869db=_0xe4b02[_0x4520('0x48')][_0x4520('0x77')];}return _0x4a528a['sobject'](_0x4869db)[_0x4520('0x78')]();}})[_0x4520('0x1e')](function(_0x460185){var _0x35c245=[_0x4520('0x79'),_0x4520('0x7a'),_0x4520('0x7b'),'IsRecurrence',_0x4520('0x7c'),'Description'];var _0x1206b4=[_0x4520('0x7d'),_0x4520('0x7e'),'picklist',_0x4520('0x7f'),_0x4520('0x80'),_0x4520('0x81'),_0x4520('0x82')];if(_0x460185){_[_0x4520('0x83')](_0x460185['fields'],function(_0x3d5d1c){return _0x35c245[_0x4520('0x84')](_0x3d5d1c[_0x4520('0x38')])||!_0x1206b4[_0x4520('0x84')](_0x3d5d1c[_0x4520('0x43')]);});return{'count':_0x460185[_0x4520('0x59')][_0x4520('0x4b')],'rows':_[_0x4520('0x46')](_0x460185[_0x4520('0x59')],function(_0x591152){return{'id':_0x591152[_0x4520('0x38')],'name':_0x591152['label'],'custom':_0x591152[_0x4520('0x85')],'options':_0x591152['picklistValues'][_0x4520('0x4b')]>0x0?_[_0x4520('0x46')](_0x591152[_0x4520('0x86')],function(_0x45570a){return{'name':_0x45570a[_0x4520('0x87')],'value':_0x45570a['value']};}):_0x591152[_0x4520('0x43')]==_0x4520('0x7f')?[{'name':_0x4520('0x88'),'value':_0x4520('0x89')},{'name':_0x4520('0x8a'),'value':'false'}]:[]};})};}})[_0x4520('0x1e')](respondWithResult(_0x3cb730,null))['catch'](function(_0x26864c){var _0x334f15=_0xe4b02[_0x4520('0x48')][_0x4520('0x8b')]?0x1f4:_0x26864c[_0x4520('0x8c')]||0x1f4;logger['error'](_0x4520('0x8d'),_0x4520('0x68'),_0x334f15,JSON[_0x4520('0x23')](_0x26864c));delete _0x26864c[_0x4520('0x38')];if(_0x334f15===0x191){_0x334f15=0x190;}_0x3cb730[_0x4520('0x29')](_0x334f15)[_0x4520('0x39')](_0xe4b02[_0x4520('0x48')][_0x4520('0x8b')]?{'message':_0x4520('0x8e'),'statusCode':_0x26864c[_0x4520('0x8c')]}:_0x26864c);});}; \ No newline at end of file +var _0xf7d9=['undefined','limit','count','apply','reject','save','update','stack','name','render','merge','body','contact','agent','interaction','account','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','SalesforceAccount','includeAll','include','rows','catch','show','params','options','find','create','destroy','getConfigurations','findOne','SalesforceConfiguration','pick','AccountId','Subjects','channel','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset'];(function(_0x5f3f60,_0x5623b3){var _0x3f0e96=function(_0x2cd826){while(--_0x2cd826){_0x5f3f60['push'](_0x5f3f60['shift']());}};_0x3f0e96(++_0x5623b3);}(_0xf7d9,0xea));var _0x9f7d=function(_0x4bc859,_0x5cd2e6){_0x4bc859=_0x4bc859-0x0;var _0x1021cd=_0xf7d9[_0x4bc859];return _0x1021cd;};'use strict';var emlformat=require(_0x9f7d('0x0'));var rimraf=require(_0x9f7d('0x1'));var zipdir=require(_0x9f7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f7d('0x3'));var moment=require('moment');var BPromise=require(_0x9f7d('0x4'));var Mustache=require(_0x9f7d('0x5'));var util=require('util');var path=require(_0x9f7d('0x6'));var sox=require(_0x9f7d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f7d('0x8'));var squel=require(_0x9f7d('0x9'));var crypto=require(_0x9f7d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9f7d('0xb'));var toCsv=require(_0x9f7d('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9f7d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9f7d('0xe'));var as=require(_0x9f7d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f7d('0x10'))('api');var utils=require(_0x9f7d('0x11'));var config=require(_0x9f7d('0x12'));var licenseUtil=require(_0x9f7d('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9f7d('0x14'));var jayson=require(_0x9f7d('0x15'));var client=jayson[_0x9f7d('0x16')][_0x9f7d('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x323f33,_0x30f2b2,_0x6f76e5,_0x2fa388){return new BPromise(function(_0x5f50e2,_0x56d323){var _0x2ff71b=_0x2fa388||client;return _0x2ff71b[_0x9f7d('0x18')](_0x323f33,_0x6f76e5)[_0x9f7d('0x19')](function(_0x271798){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x30f2b2,_0x9f7d('0x1a'));logger['debug'](_0x9f7d('0x1b'),_0x30f2b2,_0x9f7d('0x1a'),JSON[_0x9f7d('0x1c')](_0x271798));if(_0x271798[_0x9f7d('0x1d')]){if(_0x271798[_0x9f7d('0x1d')][_0x9f7d('0x1e')]===0x1f4){logger['error'](_0x9f7d('0x1f'),_0x30f2b2,_0x271798[_0x9f7d('0x1d')]['message']);return _0x56d323(_0x271798[_0x9f7d('0x1d')][_0x9f7d('0x20')]);}logger[_0x9f7d('0x1d')]('SalesforceAccount,\x20%s,\x20%s',_0x30f2b2,_0x271798[_0x9f7d('0x1d')][_0x9f7d('0x20')]);return _0x5f50e2(_0x271798[_0x9f7d('0x1d')][_0x9f7d('0x20')]);}else{logger[_0x9f7d('0x21')](_0x9f7d('0x1f'),_0x30f2b2,_0x9f7d('0x1a'));_0x5f50e2(_0x271798[_0x9f7d('0x22')]['message']);}})['catch'](function(_0x596d28){logger[_0x9f7d('0x1d')](_0x9f7d('0x1f'),_0x30f2b2,_0x596d28);_0x56d323(_0x596d28);});});}function respondWithStatusCode(_0x5cfb4b,_0x5d9e0d){_0x5d9e0d=_0x5d9e0d||0xcc;return function(_0x3915fb){if(_0x3915fb){return _0x5cfb4b[_0x9f7d('0x23')](_0x5d9e0d);}return _0x5cfb4b[_0x9f7d('0x24')](_0x5d9e0d)[_0x9f7d('0x25')]();};}function respondWithResult(_0x15744c,_0x157595){_0x157595=_0x157595||0xc8;return function(_0x4936a1){if(_0x4936a1){return _0x15744c[_0x9f7d('0x24')](_0x157595)[_0x9f7d('0x26')](_0x4936a1);}};}function respondWithFilteredResult(_0x4e5156,_0x4135e2){return function(_0x3c939b){if(_0x3c939b){var _0x435665=typeof _0x4135e2[_0x9f7d('0x27')]===_0x9f7d('0x28')&&typeof _0x4135e2[_0x9f7d('0x29')]==='undefined';var _0x4c3f8a=_0x3c939b[_0x9f7d('0x2a')];var _0x10c68c=_0x435665?0x0:_0x4135e2[_0x9f7d('0x27')];var _0x412c39=_0x435665?_0x3c939b['count']:_0x4135e2['offset']+_0x4135e2[_0x9f7d('0x29')];var _0x1e5be5;if(_0x412c39>=_0x4c3f8a){_0x412c39=_0x4c3f8a;_0x1e5be5=0xc8;}else{_0x1e5be5=0xce;}_0x4e5156['status'](_0x1e5be5);return _0x4e5156['set']('Content-Range',_0x10c68c+'-'+_0x412c39+'/'+_0x4c3f8a)[_0x9f7d('0x26')](_0x3c939b);}return null;};}function patchUpdates(_0x5a908c){return function(_0x382ac8){try{jsonpatch[_0x9f7d('0x2b')](_0x382ac8,_0x5a908c,!![]);}catch(_0x11e68c){return BPromise[_0x9f7d('0x2c')](_0x11e68c);}return _0x382ac8[_0x9f7d('0x2d')]();};}function saveUpdates(_0x366f6d,_0x560bef){return function(_0x10e3d4){if(_0x10e3d4){return _0x10e3d4[_0x9f7d('0x2e')](_0x366f6d)[_0x9f7d('0x19')](function(_0x14c820){return _0x14c820;});}return null;};}function removeEntity(_0x39ccc8,_0x904aac){return function(_0x4f8188){if(_0x4f8188){return _0x4f8188['destroy']()['then'](function(){_0x39ccc8[_0x9f7d('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0975,_0x2fa040){return function(_0x5cfcc1){if(!_0x5cfcc1){_0x3b0975[_0x9f7d('0x23')](0x194);}return _0x5cfcc1;};}function handleError(_0x5b2df5,_0x18968a){_0x18968a=_0x18968a||0x1f4;return function(_0x9885dc){logger['error'](_0x9885dc[_0x9f7d('0x2f')]);if(_0x9885dc[_0x9f7d('0x30')]){delete _0x9885dc[_0x9f7d('0x30')];}_0x5b2df5[_0x9f7d('0x24')](_0x18968a)['send'](_0x9885dc);};}function getMustacheRender(_0x4b3365,_0x1c40e8){return Mustache[_0x9f7d('0x31')](_0x4b3365,_[_0x9f7d('0x32')](_0x1c40e8[_0x9f7d('0x33')],{'contact':_0x1c40e8[_0x9f7d('0x34')],'message':_0x1c40e8[_0x9f7d('0x20')],'agent':_0x1c40e8[_0x9f7d('0x35')],'interaction':_0x1c40e8[_0x9f7d('0x36')],'account':_0x1c40e8[_0x9f7d('0x37')]}))||'';}exports['index']=function(_0x469e6a,_0x592606){var _0x5dcc08={},_0x5466d7={},_0x224e5e={'count':0x0,'rows':[]};var _0x3c0654=_[_0x9f7d('0x38')](db['SalesforceAccount'][_0x9f7d('0x39')],function(_0xfe119b){return{'name':_0xfe119b[_0x9f7d('0x3a')],'type':_0xfe119b[_0x9f7d('0x3b')][_0x9f7d('0x3c')]};});_0x5466d7[_0x9f7d('0x3d')]=_[_0x9f7d('0x38')](_0x3c0654,_0x9f7d('0x30'));_0x5466d7[_0x9f7d('0x3e')]=_[_0x9f7d('0x3f')](_0x469e6a['query']);_0x5466d7['filters']=_[_0x9f7d('0x40')](_0x5466d7[_0x9f7d('0x3d')],_0x5466d7[_0x9f7d('0x3e')]);_0x5dcc08[_0x9f7d('0x41')]=_['intersection'](_0x5466d7[_0x9f7d('0x3d')],qs['fields'](_0x469e6a['query'][_0x9f7d('0x42')]));_0x5dcc08[_0x9f7d('0x41')]=_0x5dcc08[_0x9f7d('0x41')][_0x9f7d('0x43')]?_0x5dcc08[_0x9f7d('0x41')]:_0x5466d7[_0x9f7d('0x3d')];if(!_0x469e6a[_0x9f7d('0x3e')][_0x9f7d('0x44')](_0x9f7d('0x45'))){_0x5dcc08[_0x9f7d('0x29')]=qs['limit'](_0x469e6a[_0x9f7d('0x3e')][_0x9f7d('0x29')]);_0x5dcc08[_0x9f7d('0x27')]=qs[_0x9f7d('0x27')](_0x469e6a[_0x9f7d('0x3e')][_0x9f7d('0x27')]);}_0x5dcc08[_0x9f7d('0x46')]=qs['sort'](_0x469e6a[_0x9f7d('0x3e')][_0x9f7d('0x47')]);_0x5dcc08[_0x9f7d('0x48')]=qs[_0x9f7d('0x49')](_['pick'](_0x469e6a[_0x9f7d('0x3e')],_0x5466d7[_0x9f7d('0x49')]),_0x3c0654);if(_0x469e6a[_0x9f7d('0x3e')][_0x9f7d('0x4a')]){_0x5dcc08['where']=_['merge'](_0x5dcc08[_0x9f7d('0x48')],{'$or':_[_0x9f7d('0x38')](_0x3c0654,function(_0x1e7300){if(_0x1e7300[_0x9f7d('0x3b')]!==_0x9f7d('0x4b')){var _0x2a5679={};_0x2a5679[_0x1e7300[_0x9f7d('0x30')]]={'$like':'%'+_0x469e6a['query'][_0x9f7d('0x4a')]+'%'};return _0x2a5679;}})});}_0x5dcc08=_['merge']({},_0x5dcc08,_0x469e6a['options']);var _0x22d38e={'where':_0x5dcc08['where']};return db[_0x9f7d('0x4c')][_0x9f7d('0x2a')](_0x22d38e)[_0x9f7d('0x19')](function(_0xc4fb99){_0x224e5e[_0x9f7d('0x2a')]=_0xc4fb99;if(_0x469e6a[_0x9f7d('0x3e')][_0x9f7d('0x4d')]){_0x5dcc08[_0x9f7d('0x4e')]=[{'all':!![]}];}return db[_0x9f7d('0x4c')]['findAll'](_0x5dcc08);})[_0x9f7d('0x19')](function(_0x3e55d6){_0x224e5e[_0x9f7d('0x4f')]=_0x3e55d6;return _0x224e5e;})[_0x9f7d('0x19')](respondWithFilteredResult(_0x592606,_0x5dcc08))[_0x9f7d('0x50')](handleError(_0x592606,null));};exports[_0x9f7d('0x51')]=function(_0x1c3801,_0x487a1e){var _0x48a8b7={'raw':![],'where':{'id':_0x1c3801[_0x9f7d('0x52')]['id']}},_0x2ab94b={};_0x2ab94b['model']=_[_0x9f7d('0x3f')](db[_0x9f7d('0x4c')][_0x9f7d('0x39')]);_0x2ab94b[_0x9f7d('0x3e')]=_[_0x9f7d('0x3f')](_0x1c3801['query']);_0x2ab94b[_0x9f7d('0x49')]=_['intersection'](_0x2ab94b[_0x9f7d('0x3d')],_0x2ab94b['query']);_0x48a8b7[_0x9f7d('0x41')]=_[_0x9f7d('0x40')](_0x2ab94b[_0x9f7d('0x3d')],qs[_0x9f7d('0x42')](_0x1c3801[_0x9f7d('0x3e')]['fields']));_0x48a8b7[_0x9f7d('0x41')]=_0x48a8b7[_0x9f7d('0x41')][_0x9f7d('0x43')]?_0x48a8b7[_0x9f7d('0x41')]:_0x2ab94b[_0x9f7d('0x3d')];if(_0x1c3801[_0x9f7d('0x3e')][_0x9f7d('0x4d')]){_0x48a8b7[_0x9f7d('0x4e')]=[{'all':!![]}];}_0x48a8b7=_[_0x9f7d('0x32')]({},_0x48a8b7,_0x1c3801[_0x9f7d('0x53')]);return db[_0x9f7d('0x4c')][_0x9f7d('0x54')](_0x48a8b7)[_0x9f7d('0x19')](handleEntityNotFound(_0x487a1e,null))[_0x9f7d('0x19')](respondWithResult(_0x487a1e,null))[_0x9f7d('0x50')](handleError(_0x487a1e,null));};exports['create']=function(_0x19348a,_0x24971c){return db[_0x9f7d('0x4c')][_0x9f7d('0x55')](_0x19348a['body'],{})[_0x9f7d('0x19')](respondWithResult(_0x24971c,0xc9))[_0x9f7d('0x50')](handleError(_0x24971c,null));};exports[_0x9f7d('0x2e')]=function(_0x32db36,_0x219a50){if(_0x32db36[_0x9f7d('0x33')]['id']){delete _0x32db36[_0x9f7d('0x33')]['id'];}return db[_0x9f7d('0x4c')][_0x9f7d('0x54')]({'where':{'id':_0x32db36[_0x9f7d('0x52')]['id']}})[_0x9f7d('0x19')](handleEntityNotFound(_0x219a50,null))[_0x9f7d('0x19')](saveUpdates(_0x32db36[_0x9f7d('0x33')],null))[_0x9f7d('0x19')](respondWithResult(_0x219a50,null))[_0x9f7d('0x50')](handleError(_0x219a50,null));};exports[_0x9f7d('0x56')]=function(_0x286cbe,_0x20062a){return db[_0x9f7d('0x4c')]['find']({'where':{'id':_0x286cbe[_0x9f7d('0x52')]['id']}})[_0x9f7d('0x19')](handleEntityNotFound(_0x20062a,null))['then'](removeEntity(_0x20062a,null))[_0x9f7d('0x50')](handleError(_0x20062a,null));};exports[_0x9f7d('0x57')]=function(_0x224a75,_0x501512,_0x4c93a5){var _0x2f1b75={};var _0x4ab581={};var _0x543935;var _0xbdea5;return db[_0x9f7d('0x4c')][_0x9f7d('0x58')]({'where':{'id':_0x224a75['params']['id']}})[_0x9f7d('0x19')](handleEntityNotFound(_0x501512,null))[_0x9f7d('0x19')](function(_0x44c027){if(_0x44c027){_0x543935=_0x44c027;_0x4ab581[_0x9f7d('0x3d')]=_[_0x9f7d('0x3f')](db[_0x9f7d('0x59')]['rawAttributes']);_0x4ab581[_0x9f7d('0x3e')]=_[_0x9f7d('0x3f')](_0x224a75[_0x9f7d('0x3e')]);_0x4ab581[_0x9f7d('0x49')]=_[_0x9f7d('0x40')](_0x4ab581[_0x9f7d('0x3d')],_0x4ab581[_0x9f7d('0x3e')]);_0x2f1b75['attributes']=_[_0x9f7d('0x40')](_0x4ab581[_0x9f7d('0x3d')],qs['fields'](_0x224a75[_0x9f7d('0x3e')][_0x9f7d('0x42')]));_0x2f1b75[_0x9f7d('0x41')]=_0x2f1b75[_0x9f7d('0x41')][_0x9f7d('0x43')]?_0x2f1b75[_0x9f7d('0x41')]:_0x4ab581['model'];_0x2f1b75[_0x9f7d('0x46')]=qs[_0x9f7d('0x47')](_0x224a75[_0x9f7d('0x3e')][_0x9f7d('0x47')]);_0x2f1b75['where']=qs['filters'](_[_0x9f7d('0x5a')](_0x224a75[_0x9f7d('0x3e')],_0x4ab581[_0x9f7d('0x49')]));if(_0x224a75[_0x9f7d('0x3e')][_0x9f7d('0x4a')]){_0x2f1b75[_0x9f7d('0x48')]=_['merge'](_0x2f1b75[_0x9f7d('0x48')],{'$or':_[_0x9f7d('0x38')](_0x2f1b75[_0x9f7d('0x41')],function(_0x585e20){var _0xb2c6cc={};_0xb2c6cc[_0x585e20]={'$like':'%'+_0x224a75[_0x9f7d('0x3e')]['filter']+'%'};return _0xb2c6cc;})});}_0x2f1b75=_['merge']({},_0x2f1b75,_0x224a75['options']);return _0x543935['getConfigurations'](_0x2f1b75);}})[_0x9f7d('0x19')](function(_0x3ff0fe){if(_0x3ff0fe){_0xbdea5=_0x3ff0fe[_0x9f7d('0x43')];if(!_0x224a75['query']['hasOwnProperty'](_0x9f7d('0x45'))){_0x2f1b75['limit']=qs[_0x9f7d('0x29')](_0x224a75['query'][_0x9f7d('0x29')]);_0x2f1b75[_0x9f7d('0x27')]=qs[_0x9f7d('0x27')](_0x224a75[_0x9f7d('0x3e')]['offset']);}return _0x543935[_0x9f7d('0x57')](_0x2f1b75);}})[_0x9f7d('0x19')](function(_0x123b8c){if(_0x123b8c){return _0x123b8c?{'count':_0xbdea5,'rows':_0x123b8c}:null;}})['then'](respondWithResult(_0x501512,null))[_0x9f7d('0x50')](handleError(_0x501512,null));};exports['addConfiguration']=function(_0x289850,_0x58d3e1,_0x114b35){if(_0x289850['body']['id']){delete _0x289850[_0x9f7d('0x33')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x289850[_0x9f7d('0x52')]['id']}})[_0x9f7d('0x19')](handleEntityNotFound(_0x58d3e1,null))[_0x9f7d('0x19')](function(_0x1b9b5d){if(_0x1b9b5d){_0x289850[_0x9f7d('0x33')][_0x9f7d('0x5b')]=_0x1b9b5d['id'];_0x289850['body'][_0x9f7d('0x5c')]=integrations['getSubjects'](_0x289850['body'][_0x9f7d('0x5d')],_0x289850[_0x9f7d('0x33')][_0x9f7d('0x3b')]);_0x289850[_0x9f7d('0x33')]['Descriptions']=integrations[_0x9f7d('0x5e')](_0x289850[_0x9f7d('0x33')][_0x9f7d('0x5d')],_0x289850['body'][_0x9f7d('0x3b')]);return db[_0x9f7d('0x59')][_0x9f7d('0x55')](_0x289850[_0x9f7d('0x33')],{'include':[{'model':db[_0x9f7d('0x5f')],'as':_0x9f7d('0x5c')},{'model':db[_0x9f7d('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x58d3e1,null))[_0x9f7d('0x50')](handleError(_0x58d3e1,null));};exports[_0x9f7d('0x60')]=function(_0x435b9d,_0x57b416,_0x3387db){var _0x42630a;var _0x479329='';var _0x1a916d=_0x9f7d('0x61');return db[_0x9f7d('0x4c')]['findOne']({'where':{'id':_0x435b9d[_0x9f7d('0x52')]['id']},'attributes':['id',_0x9f7d('0x62'),_0x9f7d('0x63'),_0x9f7d('0x64'),_0x9f7d('0x65'),_0x9f7d('0x66'),_0x9f7d('0x67')]})[_0x9f7d('0x19')](handleEntityNotFound(_0x57b416,null))[_0x9f7d('0x19')](function(_0x2a5341){if(_0x2a5341){_0x479329=_0x2a5341[_0x9f7d('0x62')];var _0x1d7cbe=_0x479329[_0x9f7d('0x68')](-0x1);if(_0x1d7cbe==='/'){_0x479329=_0x479329[_0x9f7d('0x69')](0x0,_0x479329[_0x9f7d('0x6a')](_0x1d7cbe));}_0x42630a=new jsforce[(_0x9f7d('0x6b'))]({'oauth2':{'loginUrl':_0x479329,'clientId':_0x2a5341['clientId'],'clientSecret':_0x2a5341['clientSecret']}});return _0x42630a[_0x9f7d('0x6c')](_0x2a5341[_0x9f7d('0x65')],_0x2a5341[_0x9f7d('0x66')][_0x9f7d('0x6d')](_0x2a5341[_0x9f7d('0x67')]));}})[_0x9f7d('0x19')](function(_0x54a899){if(_0x54a899){if(!_[_0x9f7d('0x6e')](_0x435b9d[_0x9f7d('0x3e')][_0x9f7d('0x6f')])){_0x1a916d=_0x435b9d[_0x9f7d('0x3e')]['ticketType'];}return _0x42630a[_0x9f7d('0x70')](_0x1a916d)[_0x9f7d('0x71')]();}})[_0x9f7d('0x19')](function(_0x384fc8){var _0x53d9d3=[_0x9f7d('0x72'),'ActivityDate',_0x9f7d('0x73'),_0x9f7d('0x74'),_0x9f7d('0x75'),_0x9f7d('0x76')];var _0x212cdf=[_0x9f7d('0x77'),_0x9f7d('0x78'),'picklist',_0x9f7d('0x79'),_0x9f7d('0x7a'),_0x9f7d('0x7b'),_0x9f7d('0x7c')];if(_0x384fc8){_[_0x9f7d('0x7d')](_0x384fc8[_0x9f7d('0x42')],function(_0x4faa9b){return _0x53d9d3[_0x9f7d('0x7e')](_0x4faa9b['name'])||!_0x212cdf[_0x9f7d('0x7e')](_0x4faa9b[_0x9f7d('0x3b')]);});return{'count':_0x384fc8[_0x9f7d('0x42')]['length'],'rows':_[_0x9f7d('0x38')](_0x384fc8[_0x9f7d('0x42')],function(_0x123dfd){return{'id':_0x123dfd['name'],'name':_0x123dfd[_0x9f7d('0x7f')],'custom':_0x123dfd[_0x9f7d('0x80')],'options':_0x123dfd[_0x9f7d('0x81')]['length']>0x0?_[_0x9f7d('0x38')](_0x123dfd['picklistValues'],function(_0x5819cb){return{'name':_0x5819cb[_0x9f7d('0x7f')],'value':_0x5819cb[_0x9f7d('0x82')]};}):_0x123dfd[_0x9f7d('0x3b')]==_0x9f7d('0x79')?[{'name':_0x9f7d('0x83'),'value':'true'},{'name':'False','value':'false'}]:[]};})};}})['then'](respondWithResult(_0x57b416,null))[_0x9f7d('0x50')](function(_0x2cb886){var _0x27c180=_0x435b9d['query'][_0x9f7d('0x84')]?0x1f4:_0x2cb886[_0x9f7d('0x85')]||0x1f4;logger[_0x9f7d('0x1d')](_0x9f7d('0x86'),_0x9f7d('0x60'),_0x27c180,JSON[_0x9f7d('0x1c')](_0x2cb886));delete _0x2cb886[_0x9f7d('0x30')];if(_0x27c180===0x191){_0x27c180=0x190;}_0x57b416[_0x9f7d('0x24')](_0x27c180)[_0x9f7d('0x87')](_0x435b9d[_0x9f7d('0x3e')][_0x9f7d('0x84')]?{'message':_0x9f7d('0x88'),'statusCode':_0x2cb886['statusCode']}:_0x2cb886);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a03572a..bd71a7d 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 _0xbb1e=['int_salesforce_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xbb1e,0xa9));var _0xebb1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbb1e[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xebb1('0x0'));var util=require(_0xebb1('0x1'));var logger=require('../../config/logger')(_0xebb1('0x2'));var moment=require(_0xebb1('0x3'));var BPromise=require(_0xebb1('0x4'));var rp=require(_0xebb1('0x5'));var fs=require('fs');var path=require(_0xebb1('0x6'));var rimraf=require(_0xebb1('0x7'));var config=require('../../config/environment');var attributes=require(_0xebb1('0x8'));var integrations=require(_0xebb1('0x9'));module[_0xebb1('0xa')]=function(_0x4479d2,_0x6a5fd7){return _0x4479d2[_0xebb1('0xb')](_0xebb1('0xc'),attributes,{'tableName':_0xebb1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15ad=['./intSalesforceAccount.attributes','define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1a7b60,_0x2c04f3){var _0x36c124=function(_0x1f53c3){while(--_0x1f53c3){_0x1a7b60['push'](_0x1a7b60['shift']());}};_0x36c124(++_0x2c04f3);}(_0x15ad,0x14f));var _0xd15a=function(_0x52a09b,_0x5b4fba){_0x52a09b=_0x52a09b-0x0;var _0x5ea655=_0x15ad[_0x52a09b];return _0x5ea655;};'use strict';var _=require('lodash');var util=require(_0xd15a('0x0'));var logger=require(_0xd15a('0x1'))('api');var moment=require(_0xd15a('0x2'));var BPromise=require(_0xd15a('0x3'));var rp=require(_0xd15a('0x4'));var fs=require('fs');var path=require(_0xd15a('0x5'));var rimraf=require(_0xd15a('0x6'));var config=require('../../config/environment');var attributes=require(_0xd15a('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x31b76c,_0x11fe50){return _0x31b76c[_0xd15a('0x8')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','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 1f985d5..7a161ec 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 _0xfd28=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','map','include','model','stringify','catch','ShowSalesforceAccount','raw','then','util','moment'];(function(_0x3f0154,_0x50ecc4){var _0x494ced=function(_0x190d82){while(--_0x190d82){_0x3f0154['push'](_0x3f0154['shift']());}};_0x494ced(++_0x50ecc4);}(_0xfd28,0x148));var _0x8fd2=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xfd28[_0x17406a];return _0x1501ff;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});}exports[_0x8fd2('0x13')]=function(_0x12e8a3){var _0x5c8b3c=this;return new Promise(function(_0xabbeb4,_0x708421){return db[_0x8fd2('0x14')][_0x8fd2('0x15')]({'raw':_0x12e8a3[_0x8fd2('0x16')]?_0x12e8a3['options']['raw']===undefined?!![]:![]:!![],'where':_0x12e8a3[_0x8fd2('0x16')]?_0x12e8a3['options'][_0x8fd2('0x17')]||null:null,'attributes':_0x12e8a3['options']?_0x12e8a3[_0x8fd2('0x16')][_0x8fd2('0x18')]||null:null,'limit':_0x12e8a3['options']?_0x12e8a3[_0x8fd2('0x16')]['limit']||null:null,'include':_0x12e8a3[_0x8fd2('0x16')]?_0x12e8a3[_0x8fd2('0x16')]['include']?_[_0x8fd2('0x19')](_0x12e8a3[_0x8fd2('0x16')][_0x8fd2('0x1a')],function(_0x490ea5){return{'model':db[_0x490ea5[_0x8fd2('0x1b')]],'as':_0x490ea5['as'],'attributes':_0x490ea5[_0x8fd2('0x18')],'include':_0x490ea5[_0x8fd2('0x1a')]?_[_0x8fd2('0x19')](_0x490ea5[_0x8fd2('0x1a')],function(_0x25db4e){return{'model':db[_0x25db4e[_0x8fd2('0x1b')]],'as':_0x25db4e['as'],'attributes':_0x25db4e[_0x8fd2('0x18')],'include':_0x25db4e[_0x8fd2('0x1a')]?_[_0x8fd2('0x19')](_0x25db4e[_0x8fd2('0x1a')],function(_0x1f3237){return{'model':db[_0x1f3237[_0x8fd2('0x1b')]],'as':_0x1f3237['as'],'attributes':_0x1f3237['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x345bc3){logger[_0x8fd2('0x11')](_0x8fd2('0x13'),_0x12e8a3);logger['debug'](_0x8fd2('0x13'),_0x12e8a3,JSON[_0x8fd2('0x1c')](_0x345bc3));_0xabbeb4(_0x345bc3);})[_0x8fd2('0x1d')](function(_0x960869){logger[_0x8fd2('0xe')](_0x8fd2('0x13'),_0x960869[_0x8fd2('0x10')],_0x12e8a3);_0x708421(_0x5c8b3c['error'](0x1f4,_0x960869[_0x8fd2('0x10')]));});});};exports[_0x8fd2('0x1e')]=function(_0x818f61){var _0x446c7a=this;return new Promise(function(_0x313902,_0x3ea575){return db[_0x8fd2('0x14')]['find']({'raw':_0x818f61['options']?_0x818f61['options'][_0x8fd2('0x1f')]===undefined?!![]:![]:!![],'where':_0x818f61[_0x8fd2('0x16')]?_0x818f61[_0x8fd2('0x16')][_0x8fd2('0x17')]||null:null,'attributes':_0x818f61['options']?_0x818f61['options'][_0x8fd2('0x18')]||null:null,'include':_0x818f61[_0x8fd2('0x16')]?_0x818f61[_0x8fd2('0x16')][_0x8fd2('0x1a')]?_[_0x8fd2('0x19')](_0x818f61['options'][_0x8fd2('0x1a')],function(_0x50fe44){return{'model':db[_0x50fe44[_0x8fd2('0x1b')]],'as':_0x50fe44['as'],'attributes':_0x50fe44['attributes'],'include':_0x50fe44[_0x8fd2('0x1a')]?_['map'](_0x50fe44[_0x8fd2('0x1a')],function(_0x3449b1){return{'model':db[_0x3449b1[_0x8fd2('0x1b')]],'as':_0x3449b1['as'],'attributes':_0x3449b1['attributes'],'include':_0x3449b1[_0x8fd2('0x1a')]?_['map'](_0x3449b1[_0x8fd2('0x1a')],function(_0x17c1f3){return{'model':db[_0x17c1f3[_0x8fd2('0x1b')]],'as':_0x17c1f3['as'],'attributes':_0x17c1f3['attributes']};}):[]};}):[]};}):[]:[]})[_0x8fd2('0x20')](function(_0x199a85){logger[_0x8fd2('0x11')]('ShowSalesforceAccount',_0x818f61);logger[_0x8fd2('0xc')](_0x8fd2('0x1e'),_0x818f61,JSON[_0x8fd2('0x1c')](_0x199a85));_0x313902(_0x199a85);})['catch'](function(_0x37a24b){logger[_0x8fd2('0xe')]('ShowSalesforceAccount',_0x37a24b[_0x8fd2('0x10')],_0x818f61);_0x3ea575(_0x446c7a[_0x8fd2('0xe')](0x1f4,_0x37a24b[_0x8fd2('0x10')]));});});}; \ No newline at end of file +var _0x76dc=['SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowSalesforceAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','request\x20sent'];(function(_0x385810,_0x3c55b7){var _0x2a5891=function(_0x5e298c){while(--_0x5e298c){_0x385810['push'](_0x385810['shift']());}};_0x2a5891(++_0x3c55b7);}(_0x76dc,0x1f2));var _0xc76d=function(_0x145784,_0x327632){_0x145784=_0x145784-0x0;var _0x3764f3=_0x76dc[_0x145784];return _0x3764f3;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var moment=require(_0xc76d('0x2'));var BPromise=require(_0xc76d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76d('0x4'));var db=require(_0xc76d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc76d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc76d('0x7'));var client=jayson[_0xc76d('0x8')][_0xc76d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4832bd,_0x4ce0bd,_0x119f38){return new BPromise(function(_0x114572,_0x18574f){return client['request'](_0x4832bd,_0x119f38)['then'](function(_0x1dc996){logger[_0xc76d('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x4ce0bd,_0xc76d('0xb'));logger['debug'](_0xc76d('0xc'),_0x4ce0bd,_0xc76d('0xb'),JSON[_0xc76d('0xd')](_0x1dc996));if(_0x1dc996[_0xc76d('0xe')]){if(_0x1dc996[_0xc76d('0xe')][_0xc76d('0xf')]===0x1f4){logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);return _0x18574f(_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);}logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996['error'][_0xc76d('0x11')]);return _0x114572(_0x1dc996[_0xc76d('0xe')]['message']);}else{logger[_0xc76d('0xa')](_0xc76d('0x10'),_0x4ce0bd,_0xc76d('0xb'));_0x114572(_0x1dc996[_0xc76d('0x12')]['message']);}})[_0xc76d('0x13')](function(_0x5d881c){logger['error'](_0xc76d('0x10'),_0x4ce0bd,_0x5d881c);_0x18574f(_0x5d881c);});});}exports[_0xc76d('0x14')]=function(_0x339623){var _0x23f3ca=this;return new Promise(function(_0xd1d16f,_0x4b0402){return db[_0xc76d('0x15')][_0xc76d('0x16')]({'raw':_0x339623[_0xc76d('0x17')]?_0x339623[_0xc76d('0x17')][_0xc76d('0x18')]===undefined?!![]:![]:!![],'where':_0x339623['options']?_0x339623[_0xc76d('0x17')][_0xc76d('0x19')]||null:null,'attributes':_0x339623['options']?_0x339623[_0xc76d('0x17')][_0xc76d('0x1a')]||null:null,'limit':_0x339623[_0xc76d('0x17')]?_0x339623[_0xc76d('0x17')][_0xc76d('0x1b')]||null:null,'include':_0x339623[_0xc76d('0x17')]?_0x339623[_0xc76d('0x17')][_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x339623[_0xc76d('0x17')][_0xc76d('0x1c')],function(_0x5de11f){return{'model':db[_0x5de11f[_0xc76d('0x1e')]],'as':_0x5de11f['as'],'attributes':_0x5de11f[_0xc76d('0x1a')],'include':_0x5de11f['include']?_[_0xc76d('0x1d')](_0x5de11f[_0xc76d('0x1c')],function(_0x55ca79){return{'model':db[_0x55ca79[_0xc76d('0x1e')]],'as':_0x55ca79['as'],'attributes':_0x55ca79[_0xc76d('0x1a')],'include':_0x55ca79[_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x55ca79[_0xc76d('0x1c')],function(_0x1949c4){return{'model':db[_0x1949c4[_0xc76d('0x1e')]],'as':_0x1949c4['as'],'attributes':_0x1949c4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x285430){logger[_0xc76d('0xa')]('GetSalesforceAccount',_0x339623);logger[_0xc76d('0x1f')](_0xc76d('0x14'),_0x339623,JSON[_0xc76d('0xd')](_0x285430));_0xd1d16f(_0x285430);})['catch'](function(_0x2039f4){logger['error'](_0xc76d('0x14'),_0x2039f4[_0xc76d('0x11')],_0x339623);_0x4b0402(_0x23f3ca['error'](0x1f4,_0x2039f4[_0xc76d('0x11')]));});});};exports[_0xc76d('0x20')]=function(_0x9ab96c){var _0x2cf501=this;return new Promise(function(_0x4feeda,_0x283e16){return db['SalesforceAccount'][_0xc76d('0x21')]({'raw':_0x9ab96c['options']?_0x9ab96c[_0xc76d('0x17')][_0xc76d('0x18')]===undefined?!![]:![]:!![],'where':_0x9ab96c['options']?_0x9ab96c['options']['where']||null:null,'attributes':_0x9ab96c['options']?_0x9ab96c[_0xc76d('0x17')][_0xc76d('0x1a')]||null:null,'include':_0x9ab96c[_0xc76d('0x17')]?_0x9ab96c[_0xc76d('0x17')][_0xc76d('0x1c')]?_['map'](_0x9ab96c[_0xc76d('0x17')]['include'],function(_0x854920){return{'model':db[_0x854920['model']],'as':_0x854920['as'],'attributes':_0x854920[_0xc76d('0x1a')],'include':_0x854920[_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x854920[_0xc76d('0x1c')],function(_0x2aa24d){return{'model':db[_0x2aa24d['model']],'as':_0x2aa24d['as'],'attributes':_0x2aa24d[_0xc76d('0x1a')],'include':_0x2aa24d[_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x2aa24d['include'],function(_0x2f69c1){return{'model':db[_0x2f69c1[_0xc76d('0x1e')]],'as':_0x2f69c1['as'],'attributes':_0x2f69c1[_0xc76d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9cbf1e){logger[_0xc76d('0xa')](_0xc76d('0x20'),_0x9ab96c);logger[_0xc76d('0x1f')](_0xc76d('0x20'),_0x9ab96c,JSON[_0xc76d('0xd')](_0x9cbf1e));_0x4feeda(_0x9cbf1e);})['catch'](function(_0x518945){logger[_0xc76d('0xe')]('ShowSalesforceAccount',_0x518945[_0xc76d('0x11')],_0x9ab96c);_0x283e16(_0x2cf501[_0xc76d('0xe')](0x1f4,_0x518945[_0xc76d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0b16091..9102154 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 _0xea05=['delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','post','create'];(function(_0x2d21e9,_0x35722b){var _0x475654=function(_0x138987){while(--_0x138987){_0x2d21e9['push'](_0x2d21e9['shift']());}};_0x475654(++_0x35722b);}(_0xea05,0x81));var _0x5ea0=function(_0x10f168,_0x28343e){_0x10f168=_0x10f168-0x0;var _0x55e5b4=_0xea05[_0x10f168];return _0x55e5b4;};'use strict';var multer=require(_0x5ea0('0x0'));var util=require('util');var path=require(_0x5ea0('0x1'));var timeout=require(_0x5ea0('0x2'));var express=require('express');var router=express[_0x5ea0('0x3')]();var fs_extra=require(_0x5ea0('0x4'));var auth=require(_0x5ea0('0x5'));var interaction=require(_0x5ea0('0x6'));var config=require(_0x5ea0('0x7'));var controller=require(_0x5ea0('0x8'));router[_0x5ea0('0x9')]('/',auth[_0x5ea0('0xa')](),controller[_0x5ea0('0xb')]);router['get'](_0x5ea0('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5ea0('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x5ea0('0x9')](_0x5ea0('0xe'),auth['isAuthenticated'](),controller[_0x5ea0('0xf')]);router[_0x5ea0('0x9')]('/:id/descriptions',auth[_0x5ea0('0xa')](),controller['getDescriptions']);router[_0x5ea0('0x10')]('/',auth['isAuthenticated'](),controller[_0x5ea0('0x11')]);router['put'](_0x5ea0('0xc'),auth[_0x5ea0('0xa')](),controller['update']);router[_0x5ea0('0x12')](_0x5ea0('0xc'),auth['isAuthenticated'](),controller[_0x5ea0('0x13')]);module[_0x5ea0('0x14')]=router; \ No newline at end of file +var _0xced2=['update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xced2,0x18b));var _0x2ced=function(_0x4e9454,_0x154206){_0x4e9454=_0x4e9454-0x0;var _0x2ca132=_0xced2[_0x4e9454];return _0x2ca132;};'use strict';var multer=require(_0x2ced('0x0'));var util=require('util');var path=require(_0x2ced('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ced('0x2')]();var fs_extra=require(_0x2ced('0x3'));var auth=require(_0x2ced('0x4'));var interaction=require(_0x2ced('0x5'));var config=require(_0x2ced('0x6'));var controller=require(_0x2ced('0x7'));router[_0x2ced('0x8')]('/',auth['isAuthenticated'](),controller[_0x2ced('0x9')]);router[_0x2ced('0x8')](_0x2ced('0xa'),auth[_0x2ced('0xb')](),controller['show']);router[_0x2ced('0x8')](_0x2ced('0xc'),auth[_0x2ced('0xb')](),controller[_0x2ced('0xd')]);router['get'](_0x2ced('0xe'),auth['isAuthenticated'](),controller[_0x2ced('0xf')]);router[_0x2ced('0x8')]('/:id/descriptions',auth[_0x2ced('0xb')](),controller[_0x2ced('0x10')]);router['post']('/',auth[_0x2ced('0xb')](),controller[_0x2ced('0x11')]);router[_0x2ced('0x12')](_0x2ced('0xa'),auth[_0x2ced('0xb')](),controller[_0x2ced('0x13')]);router[_0x2ced('0x14')]('/:id',auth[_0x2ced('0xb')](),controller[_0x2ced('0x15')]);module[_0x2ced('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index ee124ab..6116009 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 _0x9fb2=['ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','exports','STRING'];(function(_0x33a3b2,_0xf6ea31){var _0x228632=function(_0x415840){while(--_0x415840){_0x33a3b2['push'](_0x33a3b2['shift']());}};_0x228632(++_0xf6ea31);}(_0x9fb2,0xe5));var _0x29fb=function(_0x1839fe,_0x3e6c3f){_0x1839fe=_0x1839fe-0x0;var _0x4ade79=_0x9fb2[_0x1839fe];return _0x4ade79;};'use strict';var Sequelize=require('sequelize');module[_0x29fb('0x0')]={'name':{'type':Sequelize[_0x29fb('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x29fb('0x2')](_0x29fb('0x3'),_0x29fb('0x4')),'defaultValue':_0x29fb('0x3')},'moduleSearch':{'type':Sequelize[_0x29fb('0x2')](_0x29fb('0x5'),_0x29fb('0x6'),_0x29fb('0x7'),_0x29fb('0x8'),_0x29fb('0x9')),'defaultValue':_0x29fb('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x29fb('0xa'),_0x29fb('0x6'),'lead',_0x29fb('0x9')),'defaultValue':_0x29fb('0x7')},'leadId':{'type':Sequelize[_0x29fb('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x29fb('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfa69=['nothing','sequelize','exports','STRING','ENUM','Task','Case','contact','lead','account_contact_lead','account','contact_lead'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfa69,0x1ed));var _0x9fa6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfa69[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x9fa6('0x0'));module[_0x9fa6('0x1')]={'name':{'type':Sequelize[_0x9fa6('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9fa6('0x3')](_0x9fa6('0x4'),_0x9fa6('0x5')),'defaultValue':_0x9fa6('0x4')},'moduleSearch':{'type':Sequelize[_0x9fa6('0x3')]('contact_lead',_0x9fa6('0x6'),_0x9fa6('0x7'),_0x9fa6('0x8'),_0x9fa6('0x9')),'defaultValue':_0x9fa6('0xa')},'moduleCreate':{'type':Sequelize[_0x9fa6('0x3')](_0x9fa6('0xb'),'contact',_0x9fa6('0x7'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x9fa6('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x9fa6('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x9fa6('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x9fa6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4339667..5ff8110 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 _0x5df0=['offset','undefined','count','save','then','destroy','name','send','render','merge','contact','agent','interaction','account','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','hasOwnProperty','limit','sort','where','filters','pick','filter','options','includeAll','include','rows','params','length','create','body','update','find','getFields','findOne','order','nolimit','getSubjects','getDescriptions','SalesforceField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','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/license/util','../../mysqldb','request','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5df0,0x144));var _0x05df=function(_0x153ec2,_0x546ed6){_0x153ec2=_0x153ec2-0x0;var _0x68eebf=_0x5df0[_0x153ec2];return _0x68eebf;};'use strict';var emlformat=require(_0x05df('0x0'));var rimraf=require(_0x05df('0x1'));var zipdir=require(_0x05df('0x2'));var jsonpatch=require(_0x05df('0x3'));var rp=require(_0x05df('0x4'));var moment=require(_0x05df('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x05df('0x6'));var util=require('util');var path=require(_0x05df('0x7'));var sox=require('sox');var csv=require(_0x05df('0x8'));var ejs=require(_0x05df('0x9'));var fs=require('fs');var fs_extra=require(_0x05df('0xa'));var _=require(_0x05df('0xb'));var squel=require('squel');var crypto=require(_0x05df('0xc'));var jsforce=require(_0x05df('0xd'));var deskjs=require(_0x05df('0xe'));var toCsv=require(_0x05df('0x8'));var querystring=require(_0x05df('0xf'));var Papa=require(_0x05df('0x10'));var Redis=require(_0x05df('0x11'));var authService=require(_0x05df('0x12'));var qs=require(_0x05df('0x13'));var as=require(_0x05df('0x14'));var hardwareService=require(_0x05df('0x15'));var logger=require(_0x05df('0x16'))(_0x05df('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x05df('0x18'));var db=require(_0x05df('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x203817,_0x128db3,_0x30e0bf,_0x3f5de1){return new BPromise(function(_0xfddda4,_0x4f561c){var _0xdcc2e6=_0x3f5de1||client;return _0xdcc2e6[_0x05df('0x1a')](_0x203817,_0x30e0bf)['then'](function(_0x46555b){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x128db3,_0x05df('0x1b'));logger[_0x05df('0x1c')](_0x05df('0x1d'),_0x128db3,_0x05df('0x1b'),JSON['stringify'](_0x46555b));if(_0x46555b[_0x05df('0x1e')]){if(_0x46555b[_0x05df('0x1e')][_0x05df('0x1f')]===0x1f4){logger[_0x05df('0x1e')](_0x05df('0x20'),_0x128db3,_0x46555b['error'][_0x05df('0x21')]);return _0x4f561c(_0x46555b['error'][_0x05df('0x21')]);}logger[_0x05df('0x1e')](_0x05df('0x20'),_0x128db3,_0x46555b['error']['message']);return _0xfddda4(_0x46555b[_0x05df('0x1e')][_0x05df('0x21')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x128db3,'request\x20sent');_0xfddda4(_0x46555b[_0x05df('0x22')][_0x05df('0x21')]);}})[_0x05df('0x23')](function(_0x45cb73){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x128db3,_0x45cb73);_0x4f561c(_0x45cb73);});});}function respondWithStatusCode(_0x3a60d3,_0x27032d){_0x27032d=_0x27032d||0xcc;return function(_0x4eef9){if(_0x4eef9){return _0x3a60d3[_0x05df('0x24')](_0x27032d);}return _0x3a60d3[_0x05df('0x25')](_0x27032d)[_0x05df('0x26')]();};}function respondWithResult(_0x19819f,_0x143d10){_0x143d10=_0x143d10||0xc8;return function(_0x2444e8){if(_0x2444e8){return _0x19819f[_0x05df('0x25')](_0x143d10)[_0x05df('0x27')](_0x2444e8);}};}function respondWithFilteredResult(_0x12da9e,_0x8d469f){return function(_0x4fcad8){if(_0x4fcad8){var _0x4fdefb=typeof _0x8d469f[_0x05df('0x28')]===_0x05df('0x29')&&typeof _0x8d469f['limit']===_0x05df('0x29');var _0x47cf65=_0x4fcad8[_0x05df('0x2a')];var _0x4809f9=_0x4fdefb?0x0:_0x8d469f[_0x05df('0x28')];var _0x428d7a=_0x4fdefb?_0x4fcad8['count']:_0x8d469f[_0x05df('0x28')]+_0x8d469f['limit'];var _0x2cac3e;if(_0x428d7a>=_0x47cf65){_0x428d7a=_0x47cf65;_0x2cac3e=0xc8;}else{_0x2cac3e=0xce;}_0x12da9e['status'](_0x2cac3e);return _0x12da9e['set']('Content-Range',_0x4809f9+'-'+_0x428d7a+'/'+_0x47cf65)[_0x05df('0x27')](_0x4fcad8);}return null;};}function patchUpdates(_0x14c356){return function(_0xc8a713){try{jsonpatch['apply'](_0xc8a713,_0x14c356,!![]);}catch(_0x36f8f4){return BPromise['reject'](_0x36f8f4);}return _0xc8a713[_0x05df('0x2b')]();};}function saveUpdates(_0x9fb414,_0x2c9279){return function(_0x3d01f4){if(_0x3d01f4){return _0x3d01f4['update'](_0x9fb414)[_0x05df('0x2c')](function(_0xa898c5){return _0xa898c5;});}return null;};}function removeEntity(_0x1ce205,_0xe3a52e){return function(_0x3d774e){if(_0x3d774e){return _0x3d774e[_0x05df('0x2d')]()[_0x05df('0x2c')](function(){_0x1ce205[_0x05df('0x25')](0xcc)[_0x05df('0x26')]();});}};}function handleEntityNotFound(_0x2bf902,_0x33963a){return function(_0x316e9a){if(!_0x316e9a){_0x2bf902[_0x05df('0x24')](0x194);}return _0x316e9a;};}function handleError(_0x53f3e1,_0x972590){_0x972590=_0x972590||0x1f4;return function(_0x55ada7){logger[_0x05df('0x1e')](_0x55ada7['stack']);if(_0x55ada7[_0x05df('0x2e')]){delete _0x55ada7[_0x05df('0x2e')];}_0x53f3e1['status'](_0x972590)[_0x05df('0x2f')](_0x55ada7);};}function getMustacheRender(_0x34efb5,_0xc8014e){return Mustache[_0x05df('0x30')](_0x34efb5,_[_0x05df('0x31')](_0xc8014e['body'],{'contact':_0xc8014e[_0x05df('0x32')],'message':_0xc8014e[_0x05df('0x21')],'agent':_0xc8014e[_0x05df('0x33')],'interaction':_0xc8014e[_0x05df('0x34')],'account':_0xc8014e[_0x05df('0x35')]}))||'';}exports[_0x05df('0x36')]=function(_0x51d21b,_0x4d8a98){var _0x235de1={},_0x3ab84c={},_0x458f72={'count':0x0,'rows':[]};var _0x42d2ff=_[_0x05df('0x37')](db[_0x05df('0x38')][_0x05df('0x39')],function(_0x2f970f){return{'name':_0x2f970f[_0x05df('0x3a')],'type':_0x2f970f[_0x05df('0x3b')][_0x05df('0x3c')]};});_0x3ab84c[_0x05df('0x3d')]=_[_0x05df('0x37')](_0x42d2ff,_0x05df('0x2e'));_0x3ab84c['query']=_[_0x05df('0x3e')](_0x51d21b['query']);_0x3ab84c['filters']=_[_0x05df('0x3f')](_0x3ab84c['model'],_0x3ab84c[_0x05df('0x40')]);_0x235de1['attributes']=_['intersection'](_0x3ab84c[_0x05df('0x3d')],qs[_0x05df('0x41')](_0x51d21b[_0x05df('0x40')][_0x05df('0x41')]));_0x235de1[_0x05df('0x42')]=_0x235de1[_0x05df('0x42')]['length']?_0x235de1[_0x05df('0x42')]:_0x3ab84c[_0x05df('0x3d')];if(!_0x51d21b['query'][_0x05df('0x43')]('nolimit')){_0x235de1[_0x05df('0x44')]=qs['limit'](_0x51d21b['query'][_0x05df('0x44')]);_0x235de1[_0x05df('0x28')]=qs[_0x05df('0x28')](_0x51d21b[_0x05df('0x40')][_0x05df('0x28')]);}_0x235de1['order']=qs[_0x05df('0x45')](_0x51d21b[_0x05df('0x40')][_0x05df('0x45')]);_0x235de1[_0x05df('0x46')]=qs[_0x05df('0x47')](_[_0x05df('0x48')](_0x51d21b[_0x05df('0x40')],_0x3ab84c['filters']),_0x42d2ff);if(_0x51d21b['query'][_0x05df('0x49')]){_0x235de1['where']=_['merge'](_0x235de1['where'],{'$or':_[_0x05df('0x37')](_0x42d2ff,function(_0x3f5544){if(_0x3f5544[_0x05df('0x3b')]!=='VIRTUAL'){var _0x4afe4d={};_0x4afe4d[_0x3f5544[_0x05df('0x2e')]]={'$like':'%'+_0x51d21b[_0x05df('0x40')][_0x05df('0x49')]+'%'};return _0x4afe4d;}})});}_0x235de1=_[_0x05df('0x31')]({},_0x235de1,_0x51d21b[_0x05df('0x4a')]);var _0x3af6f2={'where':_0x235de1['where']};return db['SalesforceConfiguration'][_0x05df('0x2a')](_0x3af6f2)[_0x05df('0x2c')](function(_0x32dae8){_0x458f72[_0x05df('0x2a')]=_0x32dae8;if(_0x51d21b[_0x05df('0x40')][_0x05df('0x4b')]){_0x235de1[_0x05df('0x4c')]=[{'all':!![]}];}return db[_0x05df('0x38')]['findAll'](_0x235de1);})[_0x05df('0x2c')](function(_0x1f94bd){_0x458f72[_0x05df('0x4d')]=_0x1f94bd;return _0x458f72;})[_0x05df('0x2c')](respondWithFilteredResult(_0x4d8a98,_0x235de1))[_0x05df('0x23')](handleError(_0x4d8a98,null));};exports['show']=function(_0x3960c0,_0x180cc3){var _0x28871b={'raw':![],'where':{'id':_0x3960c0[_0x05df('0x4e')]['id']}},_0x1432af={};_0x1432af[_0x05df('0x3d')]=_['keys'](db['SalesforceConfiguration'][_0x05df('0x39')]);_0x1432af['query']=_[_0x05df('0x3e')](_0x3960c0[_0x05df('0x40')]);_0x1432af[_0x05df('0x47')]=_[_0x05df('0x3f')](_0x1432af[_0x05df('0x3d')],_0x1432af[_0x05df('0x40')]);_0x28871b[_0x05df('0x42')]=_[_0x05df('0x3f')](_0x1432af[_0x05df('0x3d')],qs['fields'](_0x3960c0[_0x05df('0x40')]['fields']));_0x28871b[_0x05df('0x42')]=_0x28871b['attributes'][_0x05df('0x4f')]?_0x28871b[_0x05df('0x42')]:_0x1432af[_0x05df('0x3d')];if(_0x3960c0[_0x05df('0x40')][_0x05df('0x4b')]){_0x28871b[_0x05df('0x4c')]=[{'all':!![]}];}_0x28871b=_[_0x05df('0x31')]({},_0x28871b,_0x3960c0['options']);return db['SalesforceConfiguration']['find'](_0x28871b)[_0x05df('0x2c')](handleEntityNotFound(_0x180cc3,null))[_0x05df('0x2c')](respondWithResult(_0x180cc3,null))[_0x05df('0x23')](handleError(_0x180cc3,null));};exports['create']=function(_0x372260,_0x12c59a){return db[_0x05df('0x38')][_0x05df('0x50')](_0x372260[_0x05df('0x51')],{})[_0x05df('0x2c')](respondWithResult(_0x12c59a,0xc9))[_0x05df('0x23')](handleError(_0x12c59a,null));};exports[_0x05df('0x52')]=function(_0x1b7fb5,_0x278536){if(_0x1b7fb5[_0x05df('0x51')]['id']){delete _0x1b7fb5[_0x05df('0x51')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x1b7fb5[_0x05df('0x4e')]['id']}})[_0x05df('0x2c')](handleEntityNotFound(_0x278536,null))['then'](saveUpdates(_0x1b7fb5['body'],null))[_0x05df('0x2c')](respondWithResult(_0x278536,null))['catch'](handleError(_0x278536,null));};exports[_0x05df('0x2d')]=function(_0x317456,_0x546f63){return db[_0x05df('0x38')][_0x05df('0x53')]({'where':{'id':_0x317456[_0x05df('0x4e')]['id']}})['then'](handleEntityNotFound(_0x546f63,null))[_0x05df('0x2c')](removeEntity(_0x546f63,null))[_0x05df('0x23')](handleError(_0x546f63,null));};exports[_0x05df('0x54')]=function(_0x86d07e,_0x3edb41,_0x25c0ce){var _0x70790c={};var _0x445c03={};var _0x1081f1;var _0x394cba;return db[_0x05df('0x38')][_0x05df('0x55')]({'where':{'id':_0x86d07e['params']['id']}})[_0x05df('0x2c')](handleEntityNotFound(_0x3edb41,null))[_0x05df('0x2c')](function(_0x2336ff){if(_0x2336ff){_0x1081f1=_0x2336ff;_0x445c03[_0x05df('0x3d')]=_[_0x05df('0x3e')](db['SalesforceField'][_0x05df('0x39')]);_0x445c03[_0x05df('0x40')]=_[_0x05df('0x3e')](_0x86d07e['query']);_0x445c03[_0x05df('0x47')]=_['intersection'](_0x445c03['model'],_0x445c03['query']);_0x70790c[_0x05df('0x42')]=_[_0x05df('0x3f')](_0x445c03[_0x05df('0x3d')],qs[_0x05df('0x41')](_0x86d07e['query']['fields']));_0x70790c['attributes']=_0x70790c[_0x05df('0x42')][_0x05df('0x4f')]?_0x70790c[_0x05df('0x42')]:_0x445c03[_0x05df('0x3d')];_0x70790c[_0x05df('0x56')]=qs[_0x05df('0x45')](_0x86d07e[_0x05df('0x40')][_0x05df('0x45')]);_0x70790c[_0x05df('0x46')]=qs['filters'](_['pick'](_0x86d07e[_0x05df('0x40')],_0x445c03['filters']));if(_0x86d07e[_0x05df('0x40')]['filter']){_0x70790c['where']=_[_0x05df('0x31')](_0x70790c['where'],{'$or':_['map'](_0x70790c[_0x05df('0x42')],function(_0x4fcece){var _0x131b78={};_0x131b78[_0x4fcece]={'$like':'%'+_0x86d07e[_0x05df('0x40')][_0x05df('0x49')]+'%'};return _0x131b78;})});}_0x70790c=_[_0x05df('0x31')]({},_0x70790c,_0x86d07e['options']);return _0x1081f1['getFields'](_0x70790c);}})[_0x05df('0x2c')](function(_0x120f05){if(_0x120f05){_0x394cba=_0x120f05[_0x05df('0x4f')];if(!_0x86d07e[_0x05df('0x40')][_0x05df('0x43')](_0x05df('0x57'))){_0x70790c[_0x05df('0x44')]=qs[_0x05df('0x44')](_0x86d07e[_0x05df('0x40')][_0x05df('0x44')]);_0x70790c[_0x05df('0x28')]=qs[_0x05df('0x28')](_0x86d07e[_0x05df('0x40')][_0x05df('0x28')]);}return _0x1081f1[_0x05df('0x54')](_0x70790c);}})['then'](function(_0x16eb06){if(_0x16eb06){return _0x16eb06?{'count':_0x394cba,'rows':_0x16eb06}:null;}})['then'](respondWithResult(_0x3edb41,null))['catch'](handleError(_0x3edb41,null));};exports[_0x05df('0x58')]=function(_0x388b50,_0x287888,_0x207cae){var _0x48cfb7={};var _0x27e252={};var _0x1daae0;var _0x53789f;return db[_0x05df('0x38')]['findOne']({'where':{'id':_0x388b50[_0x05df('0x4e')]['id']}})[_0x05df('0x2c')](handleEntityNotFound(_0x287888,null))[_0x05df('0x2c')](function(_0x36e2db){if(_0x36e2db){_0x1daae0=_0x36e2db;_0x27e252[_0x05df('0x3d')]=_[_0x05df('0x3e')](db['SalesforceField'][_0x05df('0x39')]);_0x27e252[_0x05df('0x40')]=_[_0x05df('0x3e')](_0x388b50['query']);_0x27e252[_0x05df('0x47')]=_[_0x05df('0x3f')](_0x27e252[_0x05df('0x3d')],_0x27e252[_0x05df('0x40')]);_0x48cfb7['attributes']=_['intersection'](_0x27e252[_0x05df('0x3d')],qs[_0x05df('0x41')](_0x388b50[_0x05df('0x40')][_0x05df('0x41')]));_0x48cfb7[_0x05df('0x42')]=_0x48cfb7[_0x05df('0x42')][_0x05df('0x4f')]?_0x48cfb7[_0x05df('0x42')]:_0x27e252['model'];_0x48cfb7[_0x05df('0x56')]=qs[_0x05df('0x45')](_0x388b50[_0x05df('0x40')][_0x05df('0x45')]);_0x48cfb7['where']=qs[_0x05df('0x47')](_[_0x05df('0x48')](_0x388b50['query'],_0x27e252[_0x05df('0x47')]));if(_0x388b50[_0x05df('0x40')][_0x05df('0x49')]){_0x48cfb7[_0x05df('0x46')]=_[_0x05df('0x31')](_0x48cfb7[_0x05df('0x46')],{'$or':_[_0x05df('0x37')](_0x48cfb7['attributes'],function(_0x5dc426){var _0x233e29={};_0x233e29[_0x5dc426]={'$like':'%'+_0x388b50[_0x05df('0x40')][_0x05df('0x49')]+'%'};return _0x233e29;})});}_0x48cfb7=_['merge']({},_0x48cfb7,_0x388b50[_0x05df('0x4a')]);return _0x1daae0[_0x05df('0x58')](_0x48cfb7);}})[_0x05df('0x2c')](function(_0x2079c3){if(_0x2079c3){_0x53789f=_0x2079c3[_0x05df('0x4f')];if(!_0x388b50[_0x05df('0x40')]['hasOwnProperty'](_0x05df('0x57'))){_0x48cfb7[_0x05df('0x44')]=qs[_0x05df('0x44')](_0x388b50[_0x05df('0x40')][_0x05df('0x44')]);_0x48cfb7[_0x05df('0x28')]=qs[_0x05df('0x28')](_0x388b50[_0x05df('0x40')][_0x05df('0x28')]);}return _0x1daae0[_0x05df('0x58')](_0x48cfb7);}})[_0x05df('0x2c')](function(_0x2be68a){if(_0x2be68a){return _0x2be68a?{'count':_0x53789f,'rows':_0x2be68a}:null;}})[_0x05df('0x2c')](respondWithResult(_0x287888,null))[_0x05df('0x23')](handleError(_0x287888,null));};exports[_0x05df('0x59')]=function(_0x4609ae,_0x5dfd14,_0x4f67fb){var _0x5c4692={};var _0x1e61c7={};var _0xda0601;var _0x35f703;return db[_0x05df('0x38')]['findOne']({'where':{'id':_0x4609ae[_0x05df('0x4e')]['id']}})[_0x05df('0x2c')](handleEntityNotFound(_0x5dfd14,null))[_0x05df('0x2c')](function(_0x80400){if(_0x80400){_0xda0601=_0x80400;_0x1e61c7[_0x05df('0x3d')]=_[_0x05df('0x3e')](db[_0x05df('0x5a')][_0x05df('0x39')]);_0x1e61c7[_0x05df('0x40')]=_[_0x05df('0x3e')](_0x4609ae[_0x05df('0x40')]);_0x1e61c7[_0x05df('0x47')]=_['intersection'](_0x1e61c7[_0x05df('0x3d')],_0x1e61c7[_0x05df('0x40')]);_0x5c4692[_0x05df('0x42')]=_['intersection'](_0x1e61c7[_0x05df('0x3d')],qs[_0x05df('0x41')](_0x4609ae['query'][_0x05df('0x41')]));_0x5c4692[_0x05df('0x42')]=_0x5c4692[_0x05df('0x42')][_0x05df('0x4f')]?_0x5c4692[_0x05df('0x42')]:_0x1e61c7[_0x05df('0x3d')];_0x5c4692[_0x05df('0x56')]=qs[_0x05df('0x45')](_0x4609ae['query'][_0x05df('0x45')]);_0x5c4692[_0x05df('0x46')]=qs['filters'](_[_0x05df('0x48')](_0x4609ae[_0x05df('0x40')],_0x1e61c7[_0x05df('0x47')]));if(_0x4609ae[_0x05df('0x40')][_0x05df('0x49')]){_0x5c4692[_0x05df('0x46')]=_[_0x05df('0x31')](_0x5c4692['where'],{'$or':_['map'](_0x5c4692[_0x05df('0x42')],function(_0x4900fb){var _0x24740a={};_0x24740a[_0x4900fb]={'$like':'%'+_0x4609ae['query']['filter']+'%'};return _0x24740a;})});}_0x5c4692=_[_0x05df('0x31')]({},_0x5c4692,_0x4609ae[_0x05df('0x4a')]);return _0xda0601[_0x05df('0x59')](_0x5c4692);}})[_0x05df('0x2c')](function(_0x38f1bd){if(_0x38f1bd){_0x35f703=_0x38f1bd[_0x05df('0x4f')];if(!_0x4609ae[_0x05df('0x40')]['hasOwnProperty'](_0x05df('0x57'))){_0x5c4692[_0x05df('0x44')]=qs['limit'](_0x4609ae[_0x05df('0x40')][_0x05df('0x44')]);_0x5c4692[_0x05df('0x28')]=qs[_0x05df('0x28')](_0x4609ae[_0x05df('0x40')][_0x05df('0x28')]);}return _0xda0601['getDescriptions'](_0x5c4692);}})['then'](function(_0x119720){if(_0x119720){return _0x119720?{'count':_0x35f703,'rows':_0x119720}:null;}})['then'](respondWithResult(_0x5dfd14,null))[_0x05df('0x23')](handleError(_0x5dfd14,null));}; \ No newline at end of file +var _0x0f63=['set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','render','merge','contact','agent','interaction','map','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','params','find','catch','create','body','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','getDescriptions','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0x0f63,0x1ab));var _0x30f6=function(_0x5370dc,_0x186839){_0x5370dc=_0x5370dc-0x0;var _0x338918=_0x0f63[_0x5370dc];return _0x338918;};'use strict';var emlformat=require(_0x30f6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x30f6('0x1'));var rp=require(_0x30f6('0x2'));var moment=require(_0x30f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x30f6('0x4'));var path=require(_0x30f6('0x5'));var sox=require('sox');var csv=require(_0x30f6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30f6('0x7'));var _=require(_0x30f6('0x8'));var squel=require(_0x30f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x30f6('0xa'));var toCsv=require(_0x30f6('0x6'));var querystring=require(_0x30f6('0xb'));var Papa=require(_0x30f6('0xc'));var Redis=require(_0x30f6('0xd'));var authService=require(_0x30f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x30f6('0xf'))(_0x30f6('0x10'));var utils=require(_0x30f6('0x11'));var config=require(_0x30f6('0x12'));var licenseUtil=require(_0x30f6('0x13'));var db=require(_0x30f6('0x14'))['db'];var jayson=require(_0x30f6('0x15'));var client=jayson[_0x30f6('0x16')][_0x30f6('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x203b3c,_0x203147,_0x28b447,_0x3c2c20){return new BPromise(function(_0x275987,_0x384de8){var _0x2eab50=_0x3c2c20||client;return _0x2eab50[_0x30f6('0x18')](_0x203b3c,_0x28b447)[_0x30f6('0x19')](function(_0x11dcca){logger[_0x30f6('0x1a')](_0x30f6('0x1b'),_0x203147,_0x30f6('0x1c'));logger[_0x30f6('0x1d')](_0x30f6('0x1e'),_0x203147,'request\x20sent',JSON[_0x30f6('0x1f')](_0x11dcca));if(_0x11dcca[_0x30f6('0x20')]){if(_0x11dcca[_0x30f6('0x20')][_0x30f6('0x21')]===0x1f4){logger[_0x30f6('0x20')](_0x30f6('0x1b'),_0x203147,_0x11dcca[_0x30f6('0x20')][_0x30f6('0x22')]);return _0x384de8(_0x11dcca[_0x30f6('0x20')][_0x30f6('0x22')]);}logger[_0x30f6('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x203147,_0x11dcca[_0x30f6('0x20')][_0x30f6('0x22')]);return _0x275987(_0x11dcca[_0x30f6('0x20')][_0x30f6('0x22')]);}else{logger[_0x30f6('0x1a')](_0x30f6('0x1b'),_0x203147,'request\x20sent');_0x275987(_0x11dcca[_0x30f6('0x23')][_0x30f6('0x22')]);}})['catch'](function(_0x546447){logger[_0x30f6('0x20')](_0x30f6('0x1b'),_0x203147,_0x546447);_0x384de8(_0x546447);});});}function respondWithStatusCode(_0x3a6a06,_0x234298){_0x234298=_0x234298||0xcc;return function(_0x604888){if(_0x604888){return _0x3a6a06[_0x30f6('0x24')](_0x234298);}return _0x3a6a06[_0x30f6('0x25')](_0x234298)[_0x30f6('0x26')]();};}function respondWithResult(_0x4a8ec7,_0x771660){_0x771660=_0x771660||0xc8;return function(_0x2d2217){if(_0x2d2217){return _0x4a8ec7['status'](_0x771660)['json'](_0x2d2217);}};}function respondWithFilteredResult(_0x1c894b,_0x647271){return function(_0x1a2db1){if(_0x1a2db1){var _0x1a8a26=typeof _0x647271[_0x30f6('0x27')]===_0x30f6('0x28')&&typeof _0x647271[_0x30f6('0x29')]==='undefined';var _0x453acb=_0x1a2db1[_0x30f6('0x2a')];var _0xb8cea7=_0x1a8a26?0x0:_0x647271['offset'];var _0x197286=_0x1a8a26?_0x1a2db1[_0x30f6('0x2a')]:_0x647271['offset']+_0x647271[_0x30f6('0x29')];var _0x27a08f;if(_0x197286>=_0x453acb){_0x197286=_0x453acb;_0x27a08f=0xc8;}else{_0x27a08f=0xce;}_0x1c894b[_0x30f6('0x25')](_0x27a08f);return _0x1c894b[_0x30f6('0x2b')](_0x30f6('0x2c'),_0xb8cea7+'-'+_0x197286+'/'+_0x453acb)[_0x30f6('0x2d')](_0x1a2db1);}return null;};}function patchUpdates(_0x37cade){return function(_0x1bf2ca){try{jsonpatch[_0x30f6('0x2e')](_0x1bf2ca,_0x37cade,!![]);}catch(_0x5cde23){return BPromise[_0x30f6('0x2f')](_0x5cde23);}return _0x1bf2ca[_0x30f6('0x30')]();};}function saveUpdates(_0x2e862e,_0x3d0697){return function(_0x167588){if(_0x167588){return _0x167588[_0x30f6('0x31')](_0x2e862e)[_0x30f6('0x19')](function(_0x1e5b41){return _0x1e5b41;});}return null;};}function removeEntity(_0x54973a,_0x43a508){return function(_0xf5b37){if(_0xf5b37){return _0xf5b37[_0x30f6('0x32')]()[_0x30f6('0x19')](function(){_0x54973a[_0x30f6('0x25')](0xcc)[_0x30f6('0x26')]();});}};}function handleEntityNotFound(_0x52c871,_0x2fd1bd){return function(_0x1f47e8){if(!_0x1f47e8){_0x52c871[_0x30f6('0x24')](0x194);}return _0x1f47e8;};}function handleError(_0x33857f,_0x29b9b2){_0x29b9b2=_0x29b9b2||0x1f4;return function(_0x396f0d){logger[_0x30f6('0x20')](_0x396f0d[_0x30f6('0x33')]);if(_0x396f0d['name']){delete _0x396f0d[_0x30f6('0x34')];}_0x33857f[_0x30f6('0x25')](_0x29b9b2)[_0x30f6('0x35')](_0x396f0d);};}function getMustacheRender(_0x575055,_0x535b24){return Mustache[_0x30f6('0x36')](_0x575055,_[_0x30f6('0x37')](_0x535b24['body'],{'contact':_0x535b24[_0x30f6('0x38')],'message':_0x535b24[_0x30f6('0x22')],'agent':_0x535b24[_0x30f6('0x39')],'interaction':_0x535b24[_0x30f6('0x3a')],'account':_0x535b24['account']}))||'';}exports['index']=function(_0x176b9d,_0x226dd2){var _0x13c99b={},_0x1a4aaa={},_0xc48f4a={'count':0x0,'rows':[]};var _0x1c1b6c=_[_0x30f6('0x3b')](db[_0x30f6('0x3c')][_0x30f6('0x3d')],function(_0x26a384){return{'name':_0x26a384['fieldName'],'type':_0x26a384[_0x30f6('0x3e')][_0x30f6('0x3f')]};});_0x1a4aaa[_0x30f6('0x40')]=_[_0x30f6('0x3b')](_0x1c1b6c,_0x30f6('0x34'));_0x1a4aaa[_0x30f6('0x41')]=_[_0x30f6('0x42')](_0x176b9d[_0x30f6('0x41')]);_0x1a4aaa[_0x30f6('0x43')]=_['intersection'](_0x1a4aaa[_0x30f6('0x40')],_0x1a4aaa[_0x30f6('0x41')]);_0x13c99b[_0x30f6('0x44')]=_[_0x30f6('0x45')](_0x1a4aaa[_0x30f6('0x40')],qs[_0x30f6('0x46')](_0x176b9d[_0x30f6('0x41')][_0x30f6('0x46')]));_0x13c99b[_0x30f6('0x44')]=_0x13c99b[_0x30f6('0x44')][_0x30f6('0x47')]?_0x13c99b['attributes']:_0x1a4aaa[_0x30f6('0x40')];if(!_0x176b9d[_0x30f6('0x41')]['hasOwnProperty'](_0x30f6('0x48'))){_0x13c99b[_0x30f6('0x29')]=qs['limit'](_0x176b9d[_0x30f6('0x41')][_0x30f6('0x29')]);_0x13c99b[_0x30f6('0x27')]=qs[_0x30f6('0x27')](_0x176b9d['query']['offset']);}_0x13c99b[_0x30f6('0x49')]=qs[_0x30f6('0x4a')](_0x176b9d[_0x30f6('0x41')][_0x30f6('0x4a')]);_0x13c99b[_0x30f6('0x4b')]=qs['filters'](_[_0x30f6('0x4c')](_0x176b9d[_0x30f6('0x41')],_0x1a4aaa[_0x30f6('0x43')]),_0x1c1b6c);if(_0x176b9d['query'][_0x30f6('0x4d')]){_0x13c99b[_0x30f6('0x4b')]=_[_0x30f6('0x37')](_0x13c99b[_0x30f6('0x4b')],{'$or':_[_0x30f6('0x3b')](_0x1c1b6c,function(_0x1d014c){if(_0x1d014c[_0x30f6('0x3e')]!==_0x30f6('0x4e')){var _0x14a6aa={};_0x14a6aa[_0x1d014c[_0x30f6('0x34')]]={'$like':'%'+_0x176b9d[_0x30f6('0x41')]['filter']+'%'};return _0x14a6aa;}})});}_0x13c99b=_[_0x30f6('0x37')]({},_0x13c99b,_0x176b9d[_0x30f6('0x4f')]);var _0x204638={'where':_0x13c99b['where']};return db[_0x30f6('0x3c')][_0x30f6('0x2a')](_0x204638)[_0x30f6('0x19')](function(_0x4cec46){_0xc48f4a[_0x30f6('0x2a')]=_0x4cec46;if(_0x176b9d[_0x30f6('0x41')]['includeAll']){_0x13c99b[_0x30f6('0x50')]=[{'all':!![]}];}return db[_0x30f6('0x3c')][_0x30f6('0x51')](_0x13c99b);})['then'](function(_0x477324){_0xc48f4a[_0x30f6('0x52')]=_0x477324;return _0xc48f4a;})['then'](respondWithFilteredResult(_0x226dd2,_0x13c99b))['catch'](handleError(_0x226dd2,null));};exports['show']=function(_0xcda4a9,_0x103b19){var _0x5c40c3={'raw':![],'where':{'id':_0xcda4a9[_0x30f6('0x53')]['id']}},_0x2724dd={};_0x2724dd[_0x30f6('0x40')]=_['keys'](db['SalesforceConfiguration'][_0x30f6('0x3d')]);_0x2724dd['query']=_[_0x30f6('0x42')](_0xcda4a9[_0x30f6('0x41')]);_0x2724dd[_0x30f6('0x43')]=_[_0x30f6('0x45')](_0x2724dd[_0x30f6('0x40')],_0x2724dd['query']);_0x5c40c3['attributes']=_[_0x30f6('0x45')](_0x2724dd[_0x30f6('0x40')],qs['fields'](_0xcda4a9[_0x30f6('0x41')][_0x30f6('0x46')]));_0x5c40c3[_0x30f6('0x44')]=_0x5c40c3[_0x30f6('0x44')][_0x30f6('0x47')]?_0x5c40c3['attributes']:_0x2724dd[_0x30f6('0x40')];if(_0xcda4a9[_0x30f6('0x41')]['includeAll']){_0x5c40c3[_0x30f6('0x50')]=[{'all':!![]}];}_0x5c40c3=_['merge']({},_0x5c40c3,_0xcda4a9[_0x30f6('0x4f')]);return db[_0x30f6('0x3c')][_0x30f6('0x54')](_0x5c40c3)[_0x30f6('0x19')](handleEntityNotFound(_0x103b19,null))[_0x30f6('0x19')](respondWithResult(_0x103b19,null))[_0x30f6('0x55')](handleError(_0x103b19,null));};exports[_0x30f6('0x56')]=function(_0x579fd3,_0x20e1a1){return db[_0x30f6('0x3c')][_0x30f6('0x56')](_0x579fd3[_0x30f6('0x57')],{})[_0x30f6('0x19')](respondWithResult(_0x20e1a1,0xc9))[_0x30f6('0x55')](handleError(_0x20e1a1,null));};exports[_0x30f6('0x31')]=function(_0x2179f6,_0x4dba58){if(_0x2179f6[_0x30f6('0x57')]['id']){delete _0x2179f6[_0x30f6('0x57')]['id'];}return db[_0x30f6('0x3c')][_0x30f6('0x54')]({'where':{'id':_0x2179f6[_0x30f6('0x53')]['id']}})[_0x30f6('0x19')](handleEntityNotFound(_0x4dba58,null))[_0x30f6('0x19')](saveUpdates(_0x2179f6['body'],null))[_0x30f6('0x19')](respondWithResult(_0x4dba58,null))[_0x30f6('0x55')](handleError(_0x4dba58,null));};exports[_0x30f6('0x32')]=function(_0x348700,_0xa4c87a){return db['SalesforceConfiguration'][_0x30f6('0x54')]({'where':{'id':_0x348700['params']['id']}})[_0x30f6('0x19')](handleEntityNotFound(_0xa4c87a,null))[_0x30f6('0x19')](removeEntity(_0xa4c87a,null))['catch'](handleError(_0xa4c87a,null));};exports[_0x30f6('0x58')]=function(_0x4b6b0a,_0x3715c5,_0x4c53a7){var _0x58ccdd={};var _0x55c409={};var _0x45e2fb;var _0x580959;return db[_0x30f6('0x3c')][_0x30f6('0x59')]({'where':{'id':_0x4b6b0a[_0x30f6('0x53')]['id']}})['then'](handleEntityNotFound(_0x3715c5,null))[_0x30f6('0x19')](function(_0x508749){if(_0x508749){_0x45e2fb=_0x508749;_0x55c409[_0x30f6('0x40')]=_[_0x30f6('0x42')](db['SalesforceField'][_0x30f6('0x3d')]);_0x55c409['query']=_[_0x30f6('0x42')](_0x4b6b0a[_0x30f6('0x41')]);_0x55c409[_0x30f6('0x43')]=_[_0x30f6('0x45')](_0x55c409[_0x30f6('0x40')],_0x55c409[_0x30f6('0x41')]);_0x58ccdd[_0x30f6('0x44')]=_['intersection'](_0x55c409['model'],qs[_0x30f6('0x46')](_0x4b6b0a['query']['fields']));_0x58ccdd[_0x30f6('0x44')]=_0x58ccdd[_0x30f6('0x44')][_0x30f6('0x47')]?_0x58ccdd[_0x30f6('0x44')]:_0x55c409['model'];_0x58ccdd[_0x30f6('0x49')]=qs[_0x30f6('0x4a')](_0x4b6b0a[_0x30f6('0x41')][_0x30f6('0x4a')]);_0x58ccdd[_0x30f6('0x4b')]=qs[_0x30f6('0x43')](_[_0x30f6('0x4c')](_0x4b6b0a[_0x30f6('0x41')],_0x55c409['filters']));if(_0x4b6b0a[_0x30f6('0x41')][_0x30f6('0x4d')]){_0x58ccdd[_0x30f6('0x4b')]=_[_0x30f6('0x37')](_0x58ccdd[_0x30f6('0x4b')],{'$or':_[_0x30f6('0x3b')](_0x58ccdd[_0x30f6('0x44')],function(_0x276f6c){var _0x2d71a7={};_0x2d71a7[_0x276f6c]={'$like':'%'+_0x4b6b0a[_0x30f6('0x41')][_0x30f6('0x4d')]+'%'};return _0x2d71a7;})});}_0x58ccdd=_[_0x30f6('0x37')]({},_0x58ccdd,_0x4b6b0a['options']);return _0x45e2fb['getFields'](_0x58ccdd);}})['then'](function(_0x309945){if(_0x309945){_0x580959=_0x309945[_0x30f6('0x47')];if(!_0x4b6b0a[_0x30f6('0x41')][_0x30f6('0x5a')](_0x30f6('0x48'))){_0x58ccdd[_0x30f6('0x29')]=qs[_0x30f6('0x29')](_0x4b6b0a[_0x30f6('0x41')][_0x30f6('0x29')]);_0x58ccdd['offset']=qs[_0x30f6('0x27')](_0x4b6b0a[_0x30f6('0x41')]['offset']);}return _0x45e2fb['getFields'](_0x58ccdd);}})[_0x30f6('0x19')](function(_0x35e37f){if(_0x35e37f){return _0x35e37f?{'count':_0x580959,'rows':_0x35e37f}:null;}})[_0x30f6('0x19')](respondWithResult(_0x3715c5,null))['catch'](handleError(_0x3715c5,null));};exports[_0x30f6('0x5b')]=function(_0xce726a,_0x5c6cf1,_0x924ab6){var _0x5686ca={};var _0x280feb={};var _0xcf93ad;var _0xdb3267;return db[_0x30f6('0x3c')][_0x30f6('0x59')]({'where':{'id':_0xce726a[_0x30f6('0x53')]['id']}})['then'](handleEntityNotFound(_0x5c6cf1,null))['then'](function(_0x49fa8d){if(_0x49fa8d){_0xcf93ad=_0x49fa8d;_0x280feb[_0x30f6('0x40')]=_[_0x30f6('0x42')](db[_0x30f6('0x5c')][_0x30f6('0x3d')]);_0x280feb[_0x30f6('0x41')]=_[_0x30f6('0x42')](_0xce726a[_0x30f6('0x41')]);_0x280feb[_0x30f6('0x43')]=_['intersection'](_0x280feb['model'],_0x280feb[_0x30f6('0x41')]);_0x5686ca[_0x30f6('0x44')]=_['intersection'](_0x280feb['model'],qs['fields'](_0xce726a[_0x30f6('0x41')][_0x30f6('0x46')]));_0x5686ca[_0x30f6('0x44')]=_0x5686ca['attributes'][_0x30f6('0x47')]?_0x5686ca[_0x30f6('0x44')]:_0x280feb[_0x30f6('0x40')];_0x5686ca[_0x30f6('0x49')]=qs[_0x30f6('0x4a')](_0xce726a['query'][_0x30f6('0x4a')]);_0x5686ca[_0x30f6('0x4b')]=qs['filters'](_[_0x30f6('0x4c')](_0xce726a['query'],_0x280feb[_0x30f6('0x43')]));if(_0xce726a['query']['filter']){_0x5686ca['where']=_[_0x30f6('0x37')](_0x5686ca[_0x30f6('0x4b')],{'$or':_[_0x30f6('0x3b')](_0x5686ca['attributes'],function(_0x42a7fb){var _0x421995={};_0x421995[_0x42a7fb]={'$like':'%'+_0xce726a['query'][_0x30f6('0x4d')]+'%'};return _0x421995;})});}_0x5686ca=_[_0x30f6('0x37')]({},_0x5686ca,_0xce726a[_0x30f6('0x4f')]);return _0xcf93ad[_0x30f6('0x5b')](_0x5686ca);}})[_0x30f6('0x19')](function(_0x539463){if(_0x539463){_0xdb3267=_0x539463[_0x30f6('0x47')];if(!_0xce726a[_0x30f6('0x41')][_0x30f6('0x5a')](_0x30f6('0x48'))){_0x5686ca[_0x30f6('0x29')]=qs[_0x30f6('0x29')](_0xce726a['query'][_0x30f6('0x29')]);_0x5686ca['offset']=qs[_0x30f6('0x27')](_0xce726a[_0x30f6('0x41')]['offset']);}return _0xcf93ad[_0x30f6('0x5b')](_0x5686ca);}})[_0x30f6('0x19')](function(_0x216268){if(_0x216268){return _0x216268?{'count':_0xdb3267,'rows':_0x216268}:null;}})[_0x30f6('0x19')](respondWithResult(_0x5c6cf1,null))[_0x30f6('0x55')](handleError(_0x5c6cf1,null));};exports[_0x30f6('0x5d')]=function(_0x524837,_0xe07b46,_0x34b510){var _0xabb333={};var _0x376494={};var _0x4ef924;var _0x17287f;return db['SalesforceConfiguration'][_0x30f6('0x59')]({'where':{'id':_0x524837[_0x30f6('0x53')]['id']}})['then'](handleEntityNotFound(_0xe07b46,null))[_0x30f6('0x19')](function(_0x56da89){if(_0x56da89){_0x4ef924=_0x56da89;_0x376494[_0x30f6('0x40')]=_['keys'](db[_0x30f6('0x5c')][_0x30f6('0x3d')]);_0x376494[_0x30f6('0x41')]=_[_0x30f6('0x42')](_0x524837[_0x30f6('0x41')]);_0x376494[_0x30f6('0x43')]=_[_0x30f6('0x45')](_0x376494[_0x30f6('0x40')],_0x376494[_0x30f6('0x41')]);_0xabb333[_0x30f6('0x44')]=_[_0x30f6('0x45')](_0x376494[_0x30f6('0x40')],qs[_0x30f6('0x46')](_0x524837[_0x30f6('0x41')][_0x30f6('0x46')]));_0xabb333[_0x30f6('0x44')]=_0xabb333[_0x30f6('0x44')]['length']?_0xabb333[_0x30f6('0x44')]:_0x376494[_0x30f6('0x40')];_0xabb333[_0x30f6('0x49')]=qs['sort'](_0x524837[_0x30f6('0x41')][_0x30f6('0x4a')]);_0xabb333[_0x30f6('0x4b')]=qs['filters'](_[_0x30f6('0x4c')](_0x524837[_0x30f6('0x41')],_0x376494[_0x30f6('0x43')]));if(_0x524837[_0x30f6('0x41')][_0x30f6('0x4d')]){_0xabb333['where']=_[_0x30f6('0x37')](_0xabb333[_0x30f6('0x4b')],{'$or':_[_0x30f6('0x3b')](_0xabb333[_0x30f6('0x44')],function(_0x23dd37){var _0xd184cd={};_0xd184cd[_0x23dd37]={'$like':'%'+_0x524837[_0x30f6('0x41')]['filter']+'%'};return _0xd184cd;})});}_0xabb333=_[_0x30f6('0x37')]({},_0xabb333,_0x524837[_0x30f6('0x4f')]);return _0x4ef924[_0x30f6('0x5d')](_0xabb333);}})['then'](function(_0x5973dc){if(_0x5973dc){_0x17287f=_0x5973dc[_0x30f6('0x47')];if(!_0x524837[_0x30f6('0x41')][_0x30f6('0x5a')](_0x30f6('0x48'))){_0xabb333[_0x30f6('0x29')]=qs[_0x30f6('0x29')](_0x524837['query']['limit']);_0xabb333['offset']=qs[_0x30f6('0x27')](_0x524837[_0x30f6('0x41')]['offset']);}return _0x4ef924[_0x30f6('0x5d')](_0xabb333);}})[_0x30f6('0x19')](function(_0x1158ac){if(_0x1158ac){return _0x1158ac?{'count':_0x17287f,'rows':_0x1158ac}:null;}})['then'](respondWithResult(_0xe07b46,null))[_0x30f6('0x55')](handleError(_0xe07b46,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4ab0b9d..1e13325 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 _0x7c2b=['define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x2debec,_0x583338){var _0x13358e=function(_0x1d96d3){while(--_0x1d96d3){_0x2debec['push'](_0x2debec['shift']());}};_0x13358e(++_0x583338);}(_0x7c2b,0x7b));var _0xb7c2=function(_0x3ed22d,_0x156fdb){_0x3ed22d=_0x3ed22d-0x0;var _0x57b03b=_0x7c2b[_0x3ed22d];return _0x57b03b;};'use strict';var _=require('lodash');var util=require(_0xb7c2('0x0'));var logger=require(_0xb7c2('0x1'))(_0xb7c2('0x2'));var moment=require(_0xb7c2('0x3'));var BPromise=require('bluebird');var rp=require(_0xb7c2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7c2('0x5'));var config=require(_0xb7c2('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x1b2656,_0x3e008e){return _0x1b2656[_0xb7c2('0x7')](_0xb7c2('0x8'),attributes,{'tableName':_0xb7c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2735=['moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2735,0x196));var _0x5273=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x2735[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require('lodash');var util=require(_0x5273('0x0'));var logger=require('../../config/logger')(_0x5273('0x1'));var moment=require(_0x5273('0x2'));var BPromise=require(_0x5273('0x3'));var rp=require(_0x5273('0x4'));var fs=require('fs');var path=require(_0x5273('0x5'));var rimraf=require(_0x5273('0x6'));var config=require('../../config/environment');var attributes=require(_0x5273('0x7'));module[_0x5273('0x8')]=function(_0x51d6be,_0xa0d33a){return _0x51d6be[_0x5273('0x9')](_0x5273('0xa'),attributes,{'tableName':_0x5273('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 3f87bbd..cb15cb3 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 _0xd0d0=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x57115a,_0x55558b){var _0x5f2d3b=function(_0x35f95b){while(--_0x35f95b){_0x57115a['push'](_0x57115a['shift']());}};_0x5f2d3b(++_0x55558b);}(_0xd0d0,0x155));var _0x0d0d=function(_0x1dbc8b,_0x4cde1c){_0x1dbc8b=_0x1dbc8b-0x0;var _0x1e039b=_0xd0d0[_0x1dbc8b];return _0x1e039b;};'use strict';var _=require(_0x0d0d('0x0'));var util=require(_0x0d0d('0x1'));var moment=require('moment');var BPromise=require(_0x0d0d('0x2'));var rs=require(_0x0d0d('0x3'));var fs=require('fs');var Redis=require(_0x0d0d('0x4'));var db=require(_0x0d0d('0x5'))['db'];var utils=require(_0x0d0d('0x6'));var logger=require(_0x0d0d('0x7'))(_0x0d0d('0x8'));var config=require(_0x0d0d('0x9'));var jayson=require(_0x0d0d('0xa'));var client=jayson[_0x0d0d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bf450,_0x1999c4,_0x4587f6){return new BPromise(function(_0x51e32c,_0x1aaa32){return client[_0x0d0d('0xc')](_0x4bf450,_0x4587f6)['then'](function(_0x4e3587){logger[_0x0d0d('0xd')](_0x0d0d('0xe'),_0x1999c4,'request\x20sent');logger[_0x0d0d('0xf')](_0x0d0d('0x10'),_0x1999c4,_0x0d0d('0x11'),JSON[_0x0d0d('0x12')](_0x4e3587));if(_0x4e3587[_0x0d0d('0x13')]){if(_0x4e3587[_0x0d0d('0x13')][_0x0d0d('0x14')]===0x1f4){logger[_0x0d0d('0x13')](_0x0d0d('0xe'),_0x1999c4,_0x4e3587[_0x0d0d('0x13')][_0x0d0d('0x15')]);return _0x1aaa32(_0x4e3587[_0x0d0d('0x13')][_0x0d0d('0x15')]);}logger[_0x0d0d('0x13')](_0x0d0d('0xe'),_0x1999c4,_0x4e3587['error'][_0x0d0d('0x15')]);return _0x51e32c(_0x4e3587['error'][_0x0d0d('0x15')]);}else{logger[_0x0d0d('0xd')](_0x0d0d('0xe'),_0x1999c4,_0x0d0d('0x11'));_0x51e32c(_0x4e3587[_0x0d0d('0x16')][_0x0d0d('0x15')]);}})[_0x0d0d('0x17')](function(_0x402548){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1999c4,_0x402548);_0x1aaa32(_0x402548);});});} \ No newline at end of file +var _0xd165=['info','request\x20sent','debug','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','lodash','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x7342e,_0x1c3fe7){var _0x524ece=function(_0x555b73){while(--_0x555b73){_0x7342e['push'](_0x7342e['shift']());}};_0x524ece(++_0x1c3fe7);}(_0xd165,0xe0));var _0x5d16=function(_0x4a6e3e,_0x847f61){_0x4a6e3e=_0x4a6e3e-0x0;var _0x459d23=_0xd165[_0x4a6e3e];return _0x459d23;};'use strict';var _=require(_0x5d16('0x0'));var util=require('util');var moment=require(_0x5d16('0x1'));var BPromise=require(_0x5d16('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d16('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5d16('0x4'));var jayson=require(_0x5d16('0x5'));var client=jayson[_0x5d16('0x6')][_0x5d16('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55af96,_0x3b270b,_0x2b0c6a){return new BPromise(function(_0x2f7616,_0xb46d91){return client[_0x5d16('0x8')](_0x55af96,_0x2b0c6a)[_0x5d16('0x9')](function(_0x2004be){logger[_0x5d16('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3b270b,_0x5d16('0xb'));logger[_0x5d16('0xc')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3b270b,_0x5d16('0xb'),JSON[_0x5d16('0xd')](_0x2004be));if(_0x2004be[_0x5d16('0xe')]){if(_0x2004be[_0x5d16('0xe')][_0x5d16('0xf')]===0x1f4){logger[_0x5d16('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3b270b,_0x2004be[_0x5d16('0xe')]['message']);return _0xb46d91(_0x2004be[_0x5d16('0xe')]['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x3b270b,_0x2004be[_0x5d16('0xe')][_0x5d16('0x10')]);return _0x2f7616(_0x2004be['error'][_0x5d16('0x10')]);}else{logger[_0x5d16('0xa')](_0x5d16('0x11'),_0x3b270b,_0x5d16('0xb'));_0x2f7616(_0x2004be['result'][_0x5d16('0x10')]);}})['catch'](function(_0x225027){logger['error'](_0x5d16('0x11'),_0x3b270b,_0x225027);_0xb46d91(_0x225027);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6fde422..0fea7fa 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 _0x056b=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','post','put','update'];(function(_0xf03cc1,_0x325bfa){var _0x37f6e7=function(_0x4a7a39){while(--_0x4a7a39){_0xf03cc1['push'](_0xf03cc1['shift']());}};_0x37f6e7(++_0x325bfa);}(_0x056b,0xb6));var _0xb056=function(_0x54d197,_0x5c5884){_0x54d197=_0x54d197-0x0;var _0x5aa343=_0x056b[_0x54d197];return _0x5aa343;};'use strict';var multer=require('multer');var util=require(_0xb056('0x0'));var path=require(_0xb056('0x1'));var timeout=require(_0xb056('0x2'));var express=require(_0xb056('0x3'));var router=express[_0xb056('0x4')]();var fs_extra=require(_0xb056('0x5'));var auth=require(_0xb056('0x6'));var interaction=require(_0xb056('0x7'));var config=require(_0xb056('0x8'));var controller=require(_0xb056('0x9'));router[_0xb056('0xa')]('/',auth['isAuthenticated'](),controller[_0xb056('0xb')]);router[_0xb056('0xa')](_0xb056('0xc'),auth[_0xb056('0xd')](),controller[_0xb056('0xe')]);router[_0xb056('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb056('0x10')](_0xb056('0xc'),auth[_0xb056('0xd')](),controller[_0xb056('0x11')]);router['delete'](_0xb056('0xc'),auth['isAuthenticated'](),controller[_0xb056('0x12')]);module[_0xb056('0x13')]=router; \ No newline at end of file +var _0x9303=['show','post','create','destroy','exports','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','isAuthenticated'];(function(_0x1ca66c,_0x3e3868){var _0x5a78ce=function(_0x5432ac){while(--_0x5432ac){_0x1ca66c['push'](_0x1ca66c['shift']());}};_0x5a78ce(++_0x3e3868);}(_0x9303,0xd7));var _0x3930=function(_0x7eadd1,_0x48a71b){_0x7eadd1=_0x7eadd1-0x0;var _0x51d796=_0x9303[_0x7eadd1];return _0x51d796;};'use strict';var multer=require(_0x3930('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3930('0x1'));var express=require('express');var router=express[_0x3930('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3930('0x3'));var config=require(_0x3930('0x4'));var controller=require(_0x3930('0x5'));router[_0x3930('0x6')]('/',auth['isAuthenticated'](),controller[_0x3930('0x7')]);router['get']('/:id',auth[_0x3930('0x8')](),controller[_0x3930('0x9')]);router[_0x3930('0xa')]('/',auth[_0x3930('0x8')](),controller[_0x3930('0xb')]);router['put']('/:id',auth[_0x3930('0x8')](),controller['update']);router['delete']('/:id',auth[_0x3930('0x8')](),controller[_0x3930('0xc')]);module[_0x3930('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index ed2a0b1..b9cd6c3 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 _0xcb91=['string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x4f8b76,_0xbbd440){var _0x461b11=function(_0x4b7a61){while(--_0x4b7a61){_0x4f8b76['push'](_0x4f8b76['shift']());}};_0x461b11(++_0xbbd440);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xcb91[_0xd4636c];return _0x5ee17d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),_0x1cb9('0x2'),_0x1cb9('0x3'),'keyValue',_0x1cb9('0x4')),'defaultValue':_0x1cb9('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1cb9('0x5')]},'keyType':{'type':Sequelize[_0x1cb9('0x0')]('string',_0x1cb9('0x2'),_0x1cb9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1cb9('0x5')]},'variableName':{'type':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xa9e0=['string','STRING','variable','sequelize','exports','ENUM','customVariable','picklist'];(function(_0x2c16a0,_0x23329a){var _0x56c6dd=function(_0x2f03d9){while(--_0x2f03d9){_0x2c16a0['push'](_0x2c16a0['shift']());}};_0x56c6dd(++_0x23329a);}(_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')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('string','variable',_0x0a9e('0x3'),'keyValue',_0x0a9e('0x4')),'defaultValue':_0x0a9e('0x5')},'content':{'type':Sequelize[_0x0a9e('0x6')]},'key':{'type':Sequelize[_0x0a9e('0x6')]},'keyType':{'type':Sequelize[_0x0a9e('0x2')]('string',_0x0a9e('0x7'),_0x0a9e('0x3'))},'keyContent':{'type':Sequelize[_0x0a9e('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index d461ee2..29012e9 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 _0x0ff6=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','SalesforceField','findAll','rows','catch','show','params','intersection','includeAll','find','create','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','stack','render','merge','body','contact','message','interaction','account','rawAttributes','type','key','model','name','keys','query','filters','attributes'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x0ff6,0xed));var _0x60ff=function(_0x2905c0,_0xf5cfaf){_0x2905c0=_0x2905c0-0x0;var _0x1ca05f=_0x0ff6[_0x2905c0];return _0x1ca05f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60ff('0x0'));var zipdir=require(_0x60ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60ff('0x2'));var moment=require(_0x60ff('0x3'));var BPromise=require(_0x60ff('0x4'));var Mustache=require(_0x60ff('0x5'));var util=require(_0x60ff('0x6'));var path=require('path');var sox=require(_0x60ff('0x7'));var csv=require(_0x60ff('0x8'));var ejs=require(_0x60ff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60ff('0xa'));var squel=require('squel');var crypto=require(_0x60ff('0xb'));var jsforce=require(_0x60ff('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x60ff('0x8'));var querystring=require(_0x60ff('0xd'));var Papa=require('papaparse');var Redis=require(_0x60ff('0xe'));var authService=require(_0x60ff('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60ff('0x10'));var logger=require(_0x60ff('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x60ff('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x60ff('0x13'))['db'];function respondWithStatusCode(_0x2de36d,_0x1288a8){_0x1288a8=_0x1288a8||0xcc;return function(_0x23b167){if(_0x23b167){return _0x2de36d[_0x60ff('0x14')](_0x1288a8);}return _0x2de36d[_0x60ff('0x15')](_0x1288a8)[_0x60ff('0x16')]();};}function respondWithResult(_0x1502d0,_0x32628c){_0x32628c=_0x32628c||0xc8;return function(_0xc37736){if(_0xc37736){return _0x1502d0[_0x60ff('0x15')](_0x32628c)[_0x60ff('0x17')](_0xc37736);}};}function respondWithFilteredResult(_0x3448a7,_0x2ad1b7){return function(_0xf80555){if(_0xf80555){var _0x2fe417=typeof _0x2ad1b7[_0x60ff('0x18')]==='undefined'&&typeof _0x2ad1b7[_0x60ff('0x19')]===_0x60ff('0x1a');var _0x31c44c=_0xf80555['count'];var _0xc5dad9=_0x2fe417?0x0:_0x2ad1b7['offset'];var _0x43716f=_0x2fe417?_0xf80555[_0x60ff('0x1b')]:_0x2ad1b7[_0x60ff('0x18')]+_0x2ad1b7['limit'];var _0x5e80aa;if(_0x43716f>=_0x31c44c){_0x43716f=_0x31c44c;_0x5e80aa=0xc8;}else{_0x5e80aa=0xce;}_0x3448a7[_0x60ff('0x15')](_0x5e80aa);return _0x3448a7[_0x60ff('0x1c')](_0x60ff('0x1d'),_0xc5dad9+'-'+_0x43716f+'/'+_0x31c44c)['json'](_0xf80555);}return null;};}function patchUpdates(_0x2d8e08){return function(_0x522bce){try{jsonpatch['apply'](_0x522bce,_0x2d8e08,!![]);}catch(_0x1f0448){return BPromise[_0x60ff('0x1e')](_0x1f0448);}return _0x522bce['save']();};}function saveUpdates(_0x467b6d,_0x4418d3){return function(_0x5acd58){if(_0x5acd58){return _0x5acd58[_0x60ff('0x1f')](_0x467b6d)[_0x60ff('0x20')](function(_0x48ea21){return _0x48ea21;});}return null;};}function removeEntity(_0x473208,_0x1247e8){return function(_0xa71789){if(_0xa71789){return _0xa71789[_0x60ff('0x21')]()[_0x60ff('0x20')](function(){_0x473208['status'](0xcc)[_0x60ff('0x16')]();});}};}function handleEntityNotFound(_0x423873,_0x334562){return function(_0xccf7ef){if(!_0xccf7ef){_0x423873[_0x60ff('0x14')](0x194);}return _0xccf7ef;};}function handleError(_0x579b07,_0x2f4f96){_0x2f4f96=_0x2f4f96||0x1f4;return function(_0xd146a4){logger['error'](_0xd146a4[_0x60ff('0x22')]);if(_0xd146a4['name']){delete _0xd146a4['name'];}_0x579b07[_0x60ff('0x15')](_0x2f4f96)['send'](_0xd146a4);};}function getMustacheRender(_0x481049,_0x4e44de){return Mustache[_0x60ff('0x23')](_0x481049,_[_0x60ff('0x24')](_0x4e44de[_0x60ff('0x25')],{'contact':_0x4e44de[_0x60ff('0x26')],'message':_0x4e44de[_0x60ff('0x27')],'agent':_0x4e44de['agent'],'interaction':_0x4e44de[_0x60ff('0x28')],'account':_0x4e44de[_0x60ff('0x29')]}))||'';}exports['index']=function(_0x327ed8,_0x7efac9){var _0x2e1834={},_0x179934={},_0x3f413a={'count':0x0,'rows':[]};var _0x568b3a=_['map'](db['SalesforceField'][_0x60ff('0x2a')],function(_0x5dad91){return{'name':_0x5dad91['fieldName'],'type':_0x5dad91[_0x60ff('0x2b')][_0x60ff('0x2c')]};});_0x179934[_0x60ff('0x2d')]=_['map'](_0x568b3a,_0x60ff('0x2e'));_0x179934['query']=_[_0x60ff('0x2f')](_0x327ed8[_0x60ff('0x30')]);_0x179934[_0x60ff('0x31')]=_['intersection'](_0x179934[_0x60ff('0x2d')],_0x179934['query']);_0x2e1834[_0x60ff('0x32')]=_['intersection'](_0x179934[_0x60ff('0x2d')],qs[_0x60ff('0x33')](_0x327ed8['query']['fields']));_0x2e1834[_0x60ff('0x32')]=_0x2e1834[_0x60ff('0x32')][_0x60ff('0x34')]?_0x2e1834['attributes']:_0x179934[_0x60ff('0x2d')];if(!_0x327ed8['query'][_0x60ff('0x35')](_0x60ff('0x36'))){_0x2e1834[_0x60ff('0x19')]=qs[_0x60ff('0x19')](_0x327ed8['query'][_0x60ff('0x19')]);_0x2e1834['offset']=qs[_0x60ff('0x18')](_0x327ed8[_0x60ff('0x30')][_0x60ff('0x18')]);}_0x2e1834['order']=qs['sort'](_0x327ed8[_0x60ff('0x30')][_0x60ff('0x37')]);_0x2e1834[_0x60ff('0x38')]=qs[_0x60ff('0x31')](_[_0x60ff('0x39')](_0x327ed8['query'],_0x179934['filters']),_0x568b3a);if(_0x327ed8[_0x60ff('0x30')][_0x60ff('0x3a')]){_0x2e1834[_0x60ff('0x38')]=_[_0x60ff('0x24')](_0x2e1834[_0x60ff('0x38')],{'$or':_['map'](_0x568b3a,function(_0x3e6c80){if(_0x3e6c80[_0x60ff('0x2b')]!==_0x60ff('0x3b')){var _0x1e4893={};_0x1e4893[_0x3e6c80[_0x60ff('0x2e')]]={'$like':'%'+_0x327ed8[_0x60ff('0x30')]['filter']+'%'};return _0x1e4893;}})});}_0x2e1834=_[_0x60ff('0x24')]({},_0x2e1834,_0x327ed8[_0x60ff('0x3c')]);var _0x4589c6={'where':_0x2e1834[_0x60ff('0x38')]};return db['SalesforceField'][_0x60ff('0x1b')](_0x4589c6)[_0x60ff('0x20')](function(_0x52104b){_0x3f413a[_0x60ff('0x1b')]=_0x52104b;if(_0x327ed8[_0x60ff('0x30')]['includeAll']){_0x2e1834[_0x60ff('0x3d')]=[{'all':!![]}];}return db[_0x60ff('0x3e')][_0x60ff('0x3f')](_0x2e1834);})[_0x60ff('0x20')](function(_0x363786){_0x3f413a[_0x60ff('0x40')]=_0x363786;return _0x3f413a;})['then'](respondWithFilteredResult(_0x7efac9,_0x2e1834))[_0x60ff('0x41')](handleError(_0x7efac9,null));};exports[_0x60ff('0x42')]=function(_0x19b913,_0x518ba2){var _0x39f3da={'raw':!![],'where':{'id':_0x19b913[_0x60ff('0x43')]['id']}},_0x2a32b6={};_0x2a32b6[_0x60ff('0x2d')]=_[_0x60ff('0x2f')](db[_0x60ff('0x3e')][_0x60ff('0x2a')]);_0x2a32b6['query']=_[_0x60ff('0x2f')](_0x19b913['query']);_0x2a32b6['filters']=_[_0x60ff('0x44')](_0x2a32b6[_0x60ff('0x2d')],_0x2a32b6[_0x60ff('0x30')]);_0x39f3da[_0x60ff('0x32')]=_[_0x60ff('0x44')](_0x2a32b6[_0x60ff('0x2d')],qs[_0x60ff('0x33')](_0x19b913[_0x60ff('0x30')]['fields']));_0x39f3da[_0x60ff('0x32')]=_0x39f3da[_0x60ff('0x32')][_0x60ff('0x34')]?_0x39f3da[_0x60ff('0x32')]:_0x2a32b6[_0x60ff('0x2d')];if(_0x19b913[_0x60ff('0x30')][_0x60ff('0x45')]){_0x39f3da['include']=[{'all':!![]}];}_0x39f3da=_[_0x60ff('0x24')]({},_0x39f3da,_0x19b913[_0x60ff('0x3c')]);return db[_0x60ff('0x3e')][_0x60ff('0x46')](_0x39f3da)['then'](handleEntityNotFound(_0x518ba2,null))[_0x60ff('0x20')](respondWithResult(_0x518ba2,null))[_0x60ff('0x41')](handleError(_0x518ba2,null));};exports[_0x60ff('0x47')]=function(_0x453b2b,_0x427653){return db[_0x60ff('0x3e')][_0x60ff('0x47')](_0x453b2b[_0x60ff('0x25')],{})['then'](respondWithResult(_0x427653,0xc9))[_0x60ff('0x41')](handleError(_0x427653,null));};exports[_0x60ff('0x1f')]=function(_0x396358,_0x121850){if(_0x396358['body']['id']){delete _0x396358['body']['id'];}return db[_0x60ff('0x3e')][_0x60ff('0x46')]({'where':{'id':_0x396358[_0x60ff('0x43')]['id']}})['then'](handleEntityNotFound(_0x121850,null))[_0x60ff('0x20')](saveUpdates(_0x396358['body'],null))['then'](respondWithResult(_0x121850,null))['catch'](handleError(_0x121850,null));};exports[_0x60ff('0x21')]=function(_0x4bb76d,_0x4b6495){return db[_0x60ff('0x3e')][_0x60ff('0x46')]({'where':{'id':_0x4bb76d[_0x60ff('0x43')]['id']}})[_0x60ff('0x20')](handleEntityNotFound(_0x4b6495,null))[_0x60ff('0x20')](removeEntity(_0x4b6495,null))[_0x60ff('0x41')](handleError(_0x4b6495,null));}; \ No newline at end of file +var _0x8b47=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','show','params','keys','options','create','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','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','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','error','stack','send','render','merge','body','contact','agent','account','index','SalesforceField','fieldName','type','key','model','map','name','query','filters','attributes'];(function(_0x1b0bae,_0x4b2ae2){var _0x27f0=function(_0x320263){while(--_0x320263){_0x1b0bae['push'](_0x1b0bae['shift']());}};_0x27f0(++_0x4b2ae2);}(_0x8b47,0x16f));var _0x78b4=function(_0x1de8f8,_0x16de71){_0x1de8f8=_0x1de8f8-0x0;var _0x5849e6=_0x8b47[_0x1de8f8];return _0x5849e6;};'use strict';var emlformat=require(_0x78b4('0x0'));var rimraf=require(_0x78b4('0x1'));var zipdir=require(_0x78b4('0x2'));var jsonpatch=require(_0x78b4('0x3'));var rp=require(_0x78b4('0x4'));var moment=require(_0x78b4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x78b4('0x6'));var util=require('util');var path=require(_0x78b4('0x7'));var sox=require(_0x78b4('0x8'));var csv=require(_0x78b4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78b4('0xa'));var _=require(_0x78b4('0xb'));var squel=require(_0x78b4('0xc'));var crypto=require(_0x78b4('0xd'));var jsforce=require(_0x78b4('0xe'));var deskjs=require(_0x78b4('0xf'));var toCsv=require(_0x78b4('0x9'));var querystring=require(_0x78b4('0x10'));var Papa=require(_0x78b4('0x11'));var Redis=require(_0x78b4('0x12'));var authService=require(_0x78b4('0x13'));var qs=require(_0x78b4('0x14'));var as=require(_0x78b4('0x15'));var hardwareService=require(_0x78b4('0x16'));var logger=require(_0x78b4('0x17'))(_0x78b4('0x18'));var utils=require(_0x78b4('0x19'));var config=require(_0x78b4('0x1a'));var licenseUtil=require(_0x78b4('0x1b'));var db=require(_0x78b4('0x1c'))['db'];function respondWithStatusCode(_0x5ac64f,_0xcc5417){_0xcc5417=_0xcc5417||0xcc;return function(_0x52d82e){if(_0x52d82e){return _0x5ac64f['sendStatus'](_0xcc5417);}return _0x5ac64f['status'](_0xcc5417)['end']();};}function respondWithResult(_0x3c98f9,_0x49b12d){_0x49b12d=_0x49b12d||0xc8;return function(_0x2bc283){if(_0x2bc283){return _0x3c98f9[_0x78b4('0x1d')](_0x49b12d)[_0x78b4('0x1e')](_0x2bc283);}};}function respondWithFilteredResult(_0x1f93f5,_0x5363d1){return function(_0x15b036){if(_0x15b036){var _0x213b9d=typeof _0x5363d1[_0x78b4('0x1f')]===_0x78b4('0x20')&&typeof _0x5363d1[_0x78b4('0x21')]===_0x78b4('0x20');var _0x4c0ae1=_0x15b036['count'];var _0x3bd988=_0x213b9d?0x0:_0x5363d1['offset'];var _0x3b0f9e=_0x213b9d?_0x15b036['count']:_0x5363d1['offset']+_0x5363d1[_0x78b4('0x21')];var _0x15b26c;if(_0x3b0f9e>=_0x4c0ae1){_0x3b0f9e=_0x4c0ae1;_0x15b26c=0xc8;}else{_0x15b26c=0xce;}_0x1f93f5[_0x78b4('0x1d')](_0x15b26c);return _0x1f93f5[_0x78b4('0x22')](_0x78b4('0x23'),_0x3bd988+'-'+_0x3b0f9e+'/'+_0x4c0ae1)[_0x78b4('0x1e')](_0x15b036);}return null;};}function patchUpdates(_0x2da104){return function(_0x1e6d53){try{jsonpatch[_0x78b4('0x24')](_0x1e6d53,_0x2da104,!![]);}catch(_0x4e0bf8){return BPromise[_0x78b4('0x25')](_0x4e0bf8);}return _0x1e6d53['save']();};}function saveUpdates(_0x27d772,_0x5529a6){return function(_0x38af65){if(_0x38af65){return _0x38af65[_0x78b4('0x26')](_0x27d772)['then'](function(_0x3a1516){return _0x3a1516;});}return null;};}function removeEntity(_0x4d0b64,_0x22cce2){return function(_0x5ce1e5){if(_0x5ce1e5){return _0x5ce1e5[_0x78b4('0x27')]()[_0x78b4('0x28')](function(){_0x4d0b64[_0x78b4('0x1d')](0xcc)[_0x78b4('0x29')]();});}};}function handleEntityNotFound(_0x5cffa9,_0x3d55ab){return function(_0x529001){if(!_0x529001){_0x5cffa9[_0x78b4('0x2a')](0x194);}return _0x529001;};}function handleError(_0x146474,_0x11dd0c){_0x11dd0c=_0x11dd0c||0x1f4;return function(_0x5c5385){logger[_0x78b4('0x2b')](_0x5c5385[_0x78b4('0x2c')]);if(_0x5c5385['name']){delete _0x5c5385['name'];}_0x146474[_0x78b4('0x1d')](_0x11dd0c)[_0x78b4('0x2d')](_0x5c5385);};}function getMustacheRender(_0x84aabc,_0x27fdf4){return Mustache[_0x78b4('0x2e')](_0x84aabc,_[_0x78b4('0x2f')](_0x27fdf4[_0x78b4('0x30')],{'contact':_0x27fdf4[_0x78b4('0x31')],'message':_0x27fdf4['message'],'agent':_0x27fdf4[_0x78b4('0x32')],'interaction':_0x27fdf4['interaction'],'account':_0x27fdf4[_0x78b4('0x33')]}))||'';}exports[_0x78b4('0x34')]=function(_0x20338f,_0x383d8e){var _0x3ccd30={},_0x490f64={},_0x337c94={'count':0x0,'rows':[]};var _0x59b7ef=_['map'](db[_0x78b4('0x35')]['rawAttributes'],function(_0x434467){return{'name':_0x434467[_0x78b4('0x36')],'type':_0x434467[_0x78b4('0x37')][_0x78b4('0x38')]};});_0x490f64[_0x78b4('0x39')]=_[_0x78b4('0x3a')](_0x59b7ef,_0x78b4('0x3b'));_0x490f64[_0x78b4('0x3c')]=_['keys'](_0x20338f[_0x78b4('0x3c')]);_0x490f64[_0x78b4('0x3d')]=_['intersection'](_0x490f64['model'],_0x490f64[_0x78b4('0x3c')]);_0x3ccd30[_0x78b4('0x3e')]=_[_0x78b4('0x3f')](_0x490f64['model'],qs[_0x78b4('0x40')](_0x20338f[_0x78b4('0x3c')][_0x78b4('0x40')]));_0x3ccd30['attributes']=_0x3ccd30[_0x78b4('0x3e')][_0x78b4('0x41')]?_0x3ccd30[_0x78b4('0x3e')]:_0x490f64[_0x78b4('0x39')];if(!_0x20338f['query'][_0x78b4('0x42')](_0x78b4('0x43'))){_0x3ccd30[_0x78b4('0x21')]=qs[_0x78b4('0x21')](_0x20338f[_0x78b4('0x3c')]['limit']);_0x3ccd30[_0x78b4('0x1f')]=qs[_0x78b4('0x1f')](_0x20338f[_0x78b4('0x3c')][_0x78b4('0x1f')]);}_0x3ccd30[_0x78b4('0x44')]=qs[_0x78b4('0x45')](_0x20338f[_0x78b4('0x3c')][_0x78b4('0x45')]);_0x3ccd30[_0x78b4('0x46')]=qs['filters'](_[_0x78b4('0x47')](_0x20338f[_0x78b4('0x3c')],_0x490f64[_0x78b4('0x3d')]),_0x59b7ef);if(_0x20338f[_0x78b4('0x3c')][_0x78b4('0x48')]){_0x3ccd30['where']=_[_0x78b4('0x2f')](_0x3ccd30[_0x78b4('0x46')],{'$or':_['map'](_0x59b7ef,function(_0x5ddc7d){if(_0x5ddc7d[_0x78b4('0x37')]!==_0x78b4('0x49')){var _0x326e6c={};_0x326e6c[_0x5ddc7d[_0x78b4('0x3b')]]={'$like':'%'+_0x20338f[_0x78b4('0x3c')]['filter']+'%'};return _0x326e6c;}})});}_0x3ccd30=_[_0x78b4('0x2f')]({},_0x3ccd30,_0x20338f['options']);var _0x3c1be={'where':_0x3ccd30['where']};return db['SalesforceField'][_0x78b4('0x4a')](_0x3c1be)[_0x78b4('0x28')](function(_0x298e27){_0x337c94[_0x78b4('0x4a')]=_0x298e27;if(_0x20338f[_0x78b4('0x3c')][_0x78b4('0x4b')]){_0x3ccd30[_0x78b4('0x4c')]=[{'all':!![]}];}return db[_0x78b4('0x35')][_0x78b4('0x4d')](_0x3ccd30);})[_0x78b4('0x28')](function(_0x1870f6){_0x337c94[_0x78b4('0x4e')]=_0x1870f6;return _0x337c94;})[_0x78b4('0x28')](respondWithFilteredResult(_0x383d8e,_0x3ccd30))['catch'](handleError(_0x383d8e,null));};exports[_0x78b4('0x4f')]=function(_0x3b2db8,_0x3a552b){var _0x347908={'raw':!![],'where':{'id':_0x3b2db8[_0x78b4('0x50')]['id']}},_0x4e024e={};_0x4e024e[_0x78b4('0x39')]=_[_0x78b4('0x51')](db['SalesforceField']['rawAttributes']);_0x4e024e['query']=_[_0x78b4('0x51')](_0x3b2db8['query']);_0x4e024e['filters']=_[_0x78b4('0x3f')](_0x4e024e[_0x78b4('0x39')],_0x4e024e[_0x78b4('0x3c')]);_0x347908['attributes']=_[_0x78b4('0x3f')](_0x4e024e[_0x78b4('0x39')],qs[_0x78b4('0x40')](_0x3b2db8[_0x78b4('0x3c')][_0x78b4('0x40')]));_0x347908['attributes']=_0x347908['attributes'][_0x78b4('0x41')]?_0x347908[_0x78b4('0x3e')]:_0x4e024e[_0x78b4('0x39')];if(_0x3b2db8[_0x78b4('0x3c')][_0x78b4('0x4b')]){_0x347908[_0x78b4('0x4c')]=[{'all':!![]}];}_0x347908=_['merge']({},_0x347908,_0x3b2db8[_0x78b4('0x52')]);return db[_0x78b4('0x35')]['find'](_0x347908)[_0x78b4('0x28')](handleEntityNotFound(_0x3a552b,null))[_0x78b4('0x28')](respondWithResult(_0x3a552b,null))['catch'](handleError(_0x3a552b,null));};exports[_0x78b4('0x53')]=function(_0x2ed11b,_0x266539){return db[_0x78b4('0x35')][_0x78b4('0x53')](_0x2ed11b[_0x78b4('0x30')],{})[_0x78b4('0x28')](respondWithResult(_0x266539,0xc9))['catch'](handleError(_0x266539,null));};exports['update']=function(_0x49c7c9,_0x4f2d6f){if(_0x49c7c9['body']['id']){delete _0x49c7c9[_0x78b4('0x30')]['id'];}return db[_0x78b4('0x35')][_0x78b4('0x54')]({'where':{'id':_0x49c7c9[_0x78b4('0x50')]['id']}})[_0x78b4('0x28')](handleEntityNotFound(_0x4f2d6f,null))[_0x78b4('0x28')](saveUpdates(_0x49c7c9[_0x78b4('0x30')],null))[_0x78b4('0x28')](respondWithResult(_0x4f2d6f,null))['catch'](handleError(_0x4f2d6f,null));};exports[_0x78b4('0x27')]=function(_0x45f295,_0x4746f1){return db[_0x78b4('0x35')][_0x78b4('0x54')]({'where':{'id':_0x45f295[_0x78b4('0x50')]['id']}})[_0x78b4('0x28')](handleEntityNotFound(_0x4746f1,null))['then'](removeEntity(_0x4746f1,null))[_0x78b4('0x55')](handleError(_0x4746f1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 4347822..300f9f1 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 _0xb761=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','define','SalesforceField','int_salesforce_fields','idField'];(function(_0x469341,_0x55d24c){var _0x41567d=function(_0x172667){while(--_0x172667){_0x469341['push'](_0x469341['shift']());}};_0x41567d(++_0x55d24c);}(_0xb761,0x113));var _0x1b76=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0xb761[_0x2f3ecd];return _0xffdc44;};'use strict';var _=require(_0x1b76('0x0'));var util=require(_0x1b76('0x1'));var logger=require(_0x1b76('0x2'))(_0x1b76('0x3'));var moment=require(_0x1b76('0x4'));var BPromise=require(_0x1b76('0x5'));var rp=require(_0x1b76('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x284ec8,_0x1acca9){return _0x284ec8[_0x1b76('0x7')](_0x1b76('0x8'),attributes,{'tableName':_0x1b76('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x1b76('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6548=['api','moment','bluebird','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x6548,0x133));var _0x8654=function(_0x500384,_0xe77914){_0x500384=_0x500384-0x0;var _0x3b16bd=_0x6548[_0x500384];return _0x3b16bd;};'use strict';var _=require(_0x8654('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8654('0x1'));var moment=require(_0x8654('0x2'));var BPromise=require(_0x8654('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8654('0x4'));var attributes=require('./intSalesforceField.attributes');module[_0x8654('0x5')]=function(_0x1b2d35,_0x3b6266){return _0x1b2d35[_0x8654('0x6')](_0x8654('0x7'),attributes,{'tableName':_0x8654('0x8'),'paranoid':![],'indexes':[{'name':_0x8654('0x9'),'fields':['idField',_0x8654('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 3823dca..198c9f2 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 _0x5b02=['client','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x187dfb,_0x33bfce){var _0x1116df=function(_0x5b5ae6){while(--_0x5b5ae6){_0x187dfb['push'](_0x187dfb['shift']());}};_0x1116df(++_0x33bfce);}(_0x5b02,0xe9));var _0x25b0=function(_0x140c38,_0x1ee647){_0x140c38=_0x140c38-0x0;var _0x4fe7ad=_0x5b02[_0x140c38];return _0x4fe7ad;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file +var _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0xe182dc,_0x143af4){var _0x527a62=function(_0x3393aa){while(--_0x3393aa){_0xe182dc['push'](_0xe182dc['shift']());}};_0x527a62(++_0x143af4);}(_0x153f,0x15b));var _0xf153=function(_0x2fc6d4,_0x1c5b83){_0x2fc6d4=_0x2fc6d4-0x0;var _0x461011=_0x153f[_0x2fc6d4];return _0x461011;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 254458e..1908a5f 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 _0x5204=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util'];(function(_0x1109eb,_0x68f359){var _0x120d4e=function(_0x570cff){while(--_0x570cff){_0x1109eb['push'](_0x1109eb['shift']());}};_0x120d4e(++_0x68f359);}(_0x5204,0xdf));var _0x4520=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x5204[_0x38622b];return _0x2c1a7a;};'use strict';var multer=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var path=require('path');var timeout=require(_0x4520('0x2'));var express=require(_0x4520('0x3'));var router=express[_0x4520('0x4')]();var fs_extra=require(_0x4520('0x5'));var auth=require(_0x4520('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4520('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x4520('0x8')]('/',auth[_0x4520('0x9')](),controller[_0x4520('0xa')]);router[_0x4520('0x8')](_0x4520('0xb'),auth[_0x4520('0x9')](),controller[_0x4520('0xc')]);router['get'](_0x4520('0xd'),auth['isAuthenticated'](),controller[_0x4520('0xe')]);router[_0x4520('0x8')](_0x4520('0xf'),auth[_0x4520('0x9')](),controller[_0x4520('0x10')]);router[_0x4520('0x11')]('/',auth[_0x4520('0x9')](),controller[_0x4520('0x12')]);router[_0x4520('0x11')](_0x4520('0xd'),auth[_0x4520('0x9')](),controller[_0x4520('0x13')]);router[_0x4520('0x14')](_0x4520('0xb'),auth[_0x4520('0x9')](),controller[_0x4520('0x15')]);router[_0x4520('0x16')](_0x4520('0xb'),auth[_0x4520('0x9')](),controller[_0x4520('0x17')]);module[_0x4520('0x18')]=router; \ No newline at end of file +var _0xefda=['update','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getFields','post','create','addConfiguration','put'];(function(_0x53125e,_0x11c6a5){var _0x3dfd9a=function(_0x23eb91){while(--_0x23eb91){_0x53125e['push'](_0x53125e['shift']());}};_0x3dfd9a(++_0x11c6a5);}(_0xefda,0x96));var _0xaefd=function(_0x51dd90,_0x2675e4){_0x51dd90=_0x51dd90-0x0;var _0x38afee=_0xefda[_0x51dd90];return _0x38afee;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['show']);router[_0xaefd('0x8')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router[_0xaefd('0xe')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0xf')]);router[_0xaefd('0xe')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x10')]);router[_0xaefd('0x11')](_0xaefd('0xa'),auth['isAuthenticated'](),controller[_0xaefd('0x12')]);router['delete'](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x13')]);module[_0xaefd('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 2c1a1e2..7c559f5 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 _0x7d84=['STRING','username','remoteUri','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7d84,0x1c5));var _0x47d8=function(_0x184cc6,_0x4961ee){_0x184cc6=_0x184cc6-0x0;var _0x3f7435=_0x7d84[_0x184cc6];return _0x3f7435;};'use strict';var Sequelize=require(_0x47d8('0x0'));module[_0x47d8('0x1')]={'name':{'type':Sequelize[_0x47d8('0x2')]},'description':{'type':Sequelize[_0x47d8('0x2')]},'username':{'type':Sequelize[_0x47d8('0x2')],'unique':_0x47d8('0x3')},'password':{'type':Sequelize[_0x47d8('0x2')]},'email':{'type':Sequelize[_0x47d8('0x2')]},'remoteUri':{'type':Sequelize[_0x47d8('0x2')],'unique':_0x47d8('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xcba0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4ec65f,_0x871c26){var _0x5d1143=function(_0x1ad8e5){while(--_0x1ad8e5){_0x4ec65f['push'](_0x4ec65f['shift']());}};_0x5d1143(++_0x871c26);}(_0xcba0,0x105));var _0x0cba=function(_0x304c4f,_0x26171c){_0x304c4f=_0x304c4f-0x0;var _0x1ab00a=_0xcba0[_0x304c4f];return _0x1ab00a;};'use strict';var Sequelize=require(_0x0cba('0x0'));module[_0x0cba('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0cba('0x2')]},'username':{'type':Sequelize[_0x0cba('0x2')],'unique':_0x0cba('0x3')},'password':{'type':Sequelize[_0x0cba('0x2')]},'email':{'type':Sequelize[_0x0cba('0x2')]},'remoteUri':{'type':Sequelize[_0x0cba('0x2')],'unique':_0x0cba('0x4')},'serverUrl':{'type':Sequelize[_0x0cba('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 669f6cf..95bade4 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 _0x3f62=['work_end','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','notify','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','assigned_to','severity','comments','sla_due','approval','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','includes','label','all','assign','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','push','ServiceNow\x20error:\x20','test','statusCode','stack','send','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','destroy','name','merge','body','agent','interaction','account','map','ServicenowAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','getConfigurations','findOne','pick','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','calendar_stc','closed_at','cmdb_ci','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','business_duration','group_list'];(function(_0x1b4943,_0x48bd8d){var _0x1e91f0=function(_0x1799f2){while(--_0x1799f2){_0x1b4943['push'](_0x1b4943['shift']());}};_0x1e91f0(++_0x48bd8d);}(_0x3f62,0x1c4));var _0x23f6=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x3f62[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0x23f6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x23f6('0x1'));var rp=require(_0x23f6('0x2'));var moment=require('moment');var BPromise=require(_0x23f6('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x23f6('0x4'));var sox=require(_0x23f6('0x5'));var csv=require(_0x23f6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23f6('0x7'));var squel=require('squel');var crypto=require(_0x23f6('0x8'));var jsforce=require(_0x23f6('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x23f6('0x6'));var querystring=require(_0x23f6('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x23f6('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x23f6('0xc'))(_0x23f6('0xd'));var utils=require(_0x23f6('0xe'));var config=require(_0x23f6('0xf'));var licenseUtil=require(_0x23f6('0x10'));var db=require(_0x23f6('0x11'))['db'];var integrations=require(_0x23f6('0x12'));var jayson=require('jayson/promise');var client=jayson[_0x23f6('0x13')][_0x23f6('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x4ec1ee,_0x1a64db,_0x23a857,_0x45532e){return new BPromise(function(_0x5bc828,_0x5e1dc9){var _0x11ac82=_0x45532e||client;return _0x11ac82[_0x23f6('0x15')](_0x4ec1ee,_0x23a857)[_0x23f6('0x16')](function(_0x177cb6){logger[_0x23f6('0x17')](_0x23f6('0x18'),_0x1a64db,_0x23f6('0x19'));logger[_0x23f6('0x1a')](_0x23f6('0x1b'),_0x1a64db,_0x23f6('0x19'),JSON['stringify'](_0x177cb6));if(_0x177cb6[_0x23f6('0x1c')]){if(_0x177cb6[_0x23f6('0x1c')][_0x23f6('0x1d')]===0x1f4){logger[_0x23f6('0x1c')](_0x23f6('0x18'),_0x1a64db,_0x177cb6[_0x23f6('0x1c')]['message']);return _0x5e1dc9(_0x177cb6[_0x23f6('0x1c')][_0x23f6('0x1e')]);}logger[_0x23f6('0x1c')]('ServicenowAccount,\x20%s,\x20%s',_0x1a64db,_0x177cb6['error'][_0x23f6('0x1e')]);return _0x5bc828(_0x177cb6[_0x23f6('0x1c')][_0x23f6('0x1e')]);}else{logger[_0x23f6('0x17')](_0x23f6('0x18'),_0x1a64db,_0x23f6('0x19'));_0x5bc828(_0x177cb6[_0x23f6('0x1f')][_0x23f6('0x1e')]);}})['catch'](function(_0x51d986){logger[_0x23f6('0x1c')](_0x23f6('0x18'),_0x1a64db,_0x51d986);_0x5e1dc9(_0x51d986);});});}function respondWithStatusCode(_0x232c54,_0xc86b21){_0xc86b21=_0xc86b21||0xcc;return function(_0x4a3e89){if(_0x4a3e89){return _0x232c54[_0x23f6('0x20')](_0xc86b21);}return _0x232c54[_0x23f6('0x21')](_0xc86b21)[_0x23f6('0x22')]();};}function respondWithResult(_0x5a5fdf,_0x3ce112){_0x3ce112=_0x3ce112||0xc8;return function(_0x561ca5){if(_0x561ca5){return _0x5a5fdf['status'](_0x3ce112)['json'](_0x561ca5);}};}function respondWithFilteredResult(_0x132b91,_0x2a1e8a){return function(_0x4f9de6){if(_0x4f9de6){var _0x261ed7=typeof _0x2a1e8a[_0x23f6('0x23')]===_0x23f6('0x24')&&typeof _0x2a1e8a[_0x23f6('0x25')]===_0x23f6('0x24');var _0xdda45c=_0x4f9de6[_0x23f6('0x26')];var _0x269e11=_0x261ed7?0x0:_0x2a1e8a['offset'];var _0x440734=_0x261ed7?_0x4f9de6['count']:_0x2a1e8a[_0x23f6('0x23')]+_0x2a1e8a[_0x23f6('0x25')];var _0x50137b;if(_0x440734>=_0xdda45c){_0x440734=_0xdda45c;_0x50137b=0xc8;}else{_0x50137b=0xce;}_0x132b91[_0x23f6('0x21')](_0x50137b);return _0x132b91[_0x23f6('0x27')]('Content-Range',_0x269e11+'-'+_0x440734+'/'+_0xdda45c)[_0x23f6('0x28')](_0x4f9de6);}return null;};}function patchUpdates(_0x893e6a){return function(_0x5dec50){try{jsonpatch[_0x23f6('0x29')](_0x5dec50,_0x893e6a,!![]);}catch(_0x379cf7){return BPromise['reject'](_0x379cf7);}return _0x5dec50[_0x23f6('0x2a')]();};}function saveUpdates(_0x4d7ce2,_0x9cd818){return function(_0x362c97){if(_0x362c97){return _0x362c97[_0x23f6('0x2b')](_0x4d7ce2)[_0x23f6('0x16')](function(_0x45c4af){return _0x45c4af;});}return null;};}function removeEntity(_0x4fc6a5,_0x559d6c){return function(_0x2182cd){if(_0x2182cd){return _0x2182cd[_0x23f6('0x2c')]()[_0x23f6('0x16')](function(){_0x4fc6a5[_0x23f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34fe6b,_0x1f4002){return function(_0x10aa09){if(!_0x10aa09){_0x34fe6b[_0x23f6('0x20')](0x194);}return _0x10aa09;};}function handleError(_0xf96453,_0x4aa37b){_0x4aa37b=_0x4aa37b||0x1f4;return function(_0x2a8d18){logger[_0x23f6('0x1c')](_0x2a8d18['stack']);if(_0x2a8d18[_0x23f6('0x2d')]){delete _0x2a8d18['name'];}_0xf96453[_0x23f6('0x21')](_0x4aa37b)['send'](_0x2a8d18);};}function getMustacheRender(_0x5c05bc,_0x2275fb){return Mustache['render'](_0x5c05bc,_[_0x23f6('0x2e')](_0x2275fb[_0x23f6('0x2f')],{'contact':_0x2275fb['contact'],'message':_0x2275fb['message'],'agent':_0x2275fb[_0x23f6('0x30')],'interaction':_0x2275fb[_0x23f6('0x31')],'account':_0x2275fb[_0x23f6('0x32')]}))||'';}exports['index']=function(_0x2d38ea,_0x2036d2){var _0x4c3e41={},_0x521092={},_0x577953={'count':0x0,'rows':[]};var _0x3bfde2=_[_0x23f6('0x33')](db[_0x23f6('0x34')][_0x23f6('0x35')],function(_0x4aeaf5){return{'name':_0x4aeaf5['fieldName'],'type':_0x4aeaf5[_0x23f6('0x36')]['key']};});_0x521092[_0x23f6('0x37')]=_['map'](_0x3bfde2,_0x23f6('0x2d'));_0x521092[_0x23f6('0x38')]=_[_0x23f6('0x39')](_0x2d38ea[_0x23f6('0x38')]);_0x521092[_0x23f6('0x3a')]=_[_0x23f6('0x3b')](_0x521092[_0x23f6('0x37')],_0x521092[_0x23f6('0x38')]);_0x4c3e41[_0x23f6('0x3c')]=_[_0x23f6('0x3b')](_0x521092[_0x23f6('0x37')],qs[_0x23f6('0x3d')](_0x2d38ea[_0x23f6('0x38')][_0x23f6('0x3d')]));_0x4c3e41['attributes']=_0x4c3e41[_0x23f6('0x3c')][_0x23f6('0x3e')]?_0x4c3e41['attributes']:_0x521092[_0x23f6('0x37')];if(!_0x2d38ea['query'][_0x23f6('0x3f')](_0x23f6('0x40'))){_0x4c3e41[_0x23f6('0x25')]=qs[_0x23f6('0x25')](_0x2d38ea[_0x23f6('0x38')][_0x23f6('0x25')]);_0x4c3e41[_0x23f6('0x23')]=qs[_0x23f6('0x23')](_0x2d38ea[_0x23f6('0x38')]['offset']);}_0x4c3e41[_0x23f6('0x41')]=qs[_0x23f6('0x42')](_0x2d38ea[_0x23f6('0x38')][_0x23f6('0x42')]);_0x4c3e41['where']=qs[_0x23f6('0x3a')](_['pick'](_0x2d38ea['query'],_0x521092[_0x23f6('0x3a')]),_0x3bfde2);if(_0x2d38ea['query'][_0x23f6('0x43')]){_0x4c3e41['where']=_[_0x23f6('0x2e')](_0x4c3e41[_0x23f6('0x44')],{'$or':_['map'](_0x3bfde2,function(_0x520477){if(_0x520477['type']!==_0x23f6('0x45')){var _0x16c766={};_0x16c766[_0x520477[_0x23f6('0x2d')]]={'$like':'%'+_0x2d38ea[_0x23f6('0x38')][_0x23f6('0x43')]+'%'};return _0x16c766;}})});}_0x4c3e41=_[_0x23f6('0x2e')]({},_0x4c3e41,_0x2d38ea[_0x23f6('0x46')]);var _0x164fa4={'where':_0x4c3e41[_0x23f6('0x44')]};return db[_0x23f6('0x34')][_0x23f6('0x26')](_0x164fa4)['then'](function(_0x4b1241){_0x577953[_0x23f6('0x26')]=_0x4b1241;if(_0x2d38ea[_0x23f6('0x38')][_0x23f6('0x47')]){_0x4c3e41[_0x23f6('0x48')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x23f6('0x49')](_0x4c3e41);})['then'](function(_0x20156e){_0x577953[_0x23f6('0x4a')]=_0x20156e;return _0x577953;})['then'](respondWithFilteredResult(_0x2036d2,_0x4c3e41))['catch'](handleError(_0x2036d2,null));};exports[_0x23f6('0x4b')]=function(_0x312db5,_0x45670c){var _0x6e9dff={'raw':![],'where':{'id':_0x312db5[_0x23f6('0x4c')]['id']}},_0x17fb75={};_0x17fb75[_0x23f6('0x37')]=_[_0x23f6('0x39')](db[_0x23f6('0x34')][_0x23f6('0x35')]);_0x17fb75['query']=_['keys'](_0x312db5[_0x23f6('0x38')]);_0x17fb75[_0x23f6('0x3a')]=_[_0x23f6('0x3b')](_0x17fb75['model'],_0x17fb75[_0x23f6('0x38')]);_0x6e9dff[_0x23f6('0x3c')]=_['intersection'](_0x17fb75[_0x23f6('0x37')],qs[_0x23f6('0x3d')](_0x312db5[_0x23f6('0x38')][_0x23f6('0x3d')]));_0x6e9dff[_0x23f6('0x3c')]=_0x6e9dff['attributes'][_0x23f6('0x3e')]?_0x6e9dff['attributes']:_0x17fb75[_0x23f6('0x37')];if(_0x312db5[_0x23f6('0x38')][_0x23f6('0x47')]){_0x6e9dff['include']=[{'all':!![]}];}_0x6e9dff=_[_0x23f6('0x2e')]({},_0x6e9dff,_0x312db5['options']);return db[_0x23f6('0x34')][_0x23f6('0x4d')](_0x6e9dff)[_0x23f6('0x16')](handleEntityNotFound(_0x45670c,null))[_0x23f6('0x16')](respondWithResult(_0x45670c,null))[_0x23f6('0x4e')](handleError(_0x45670c,null));};exports[_0x23f6('0x4f')]=function(_0x18161b,_0x332fa3){return db[_0x23f6('0x34')]['create'](_0x18161b['body'],{})['then'](respondWithResult(_0x332fa3,0xc9))[_0x23f6('0x4e')](handleError(_0x332fa3,null));};exports[_0x23f6('0x2b')]=function(_0x542da6,_0x28531a){if(_0x542da6['body']['id']){delete _0x542da6['body']['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x542da6[_0x23f6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x28531a,null))['then'](saveUpdates(_0x542da6['body'],null))[_0x23f6('0x16')](respondWithResult(_0x28531a,null))[_0x23f6('0x4e')](handleError(_0x28531a,null));};exports['destroy']=function(_0x23e602,_0x59798f){return db[_0x23f6('0x34')][_0x23f6('0x4d')]({'where':{'id':_0x23e602[_0x23f6('0x4c')]['id']}})[_0x23f6('0x16')](handleEntityNotFound(_0x59798f,null))[_0x23f6('0x16')](removeEntity(_0x59798f,null))[_0x23f6('0x4e')](handleError(_0x59798f,null));};exports[_0x23f6('0x50')]=function(_0x4faaa0,_0x4336ca,_0x2441b8){var _0x97ee70={};var _0x2b77c7={};var _0x9fd7ec;var _0x3c291e;return db[_0x23f6('0x34')][_0x23f6('0x51')]({'where':{'id':_0x4faaa0[_0x23f6('0x4c')]['id']}})[_0x23f6('0x16')](handleEntityNotFound(_0x4336ca,null))[_0x23f6('0x16')](function(_0x372caf){if(_0x372caf){_0x9fd7ec=_0x372caf;_0x2b77c7[_0x23f6('0x37')]=_[_0x23f6('0x39')](db['ServicenowConfiguration'][_0x23f6('0x35')]);_0x2b77c7[_0x23f6('0x38')]=_['keys'](_0x4faaa0[_0x23f6('0x38')]);_0x2b77c7['filters']=_['intersection'](_0x2b77c7['model'],_0x2b77c7[_0x23f6('0x38')]);_0x97ee70['attributes']=_[_0x23f6('0x3b')](_0x2b77c7['model'],qs[_0x23f6('0x3d')](_0x4faaa0['query'][_0x23f6('0x3d')]));_0x97ee70[_0x23f6('0x3c')]=_0x97ee70[_0x23f6('0x3c')][_0x23f6('0x3e')]?_0x97ee70['attributes']:_0x2b77c7[_0x23f6('0x37')];_0x97ee70['order']=qs['sort'](_0x4faaa0[_0x23f6('0x38')][_0x23f6('0x42')]);_0x97ee70['where']=qs[_0x23f6('0x3a')](_[_0x23f6('0x52')](_0x4faaa0['query'],_0x2b77c7[_0x23f6('0x3a')]));if(_0x4faaa0[_0x23f6('0x38')]['filter']){_0x97ee70[_0x23f6('0x44')]=_[_0x23f6('0x2e')](_0x97ee70[_0x23f6('0x44')],{'$or':_[_0x23f6('0x33')](_0x97ee70[_0x23f6('0x3c')],function(_0x3a13f4){var _0x434b4d={};_0x434b4d[_0x3a13f4]={'$like':'%'+_0x4faaa0[_0x23f6('0x38')][_0x23f6('0x43')]+'%'};return _0x434b4d;})});}_0x97ee70=_[_0x23f6('0x2e')]({},_0x97ee70,_0x4faaa0[_0x23f6('0x46')]);return _0x9fd7ec[_0x23f6('0x50')](_0x97ee70);}})[_0x23f6('0x16')](function(_0x10724d){if(_0x10724d){_0x3c291e=_0x10724d[_0x23f6('0x3e')];if(!_0x4faaa0[_0x23f6('0x38')][_0x23f6('0x3f')](_0x23f6('0x40'))){_0x97ee70[_0x23f6('0x25')]=qs[_0x23f6('0x25')](_0x4faaa0[_0x23f6('0x38')][_0x23f6('0x25')]);_0x97ee70[_0x23f6('0x23')]=qs[_0x23f6('0x23')](_0x4faaa0['query'][_0x23f6('0x23')]);}return _0x9fd7ec[_0x23f6('0x50')](_0x97ee70);}})[_0x23f6('0x16')](function(_0x5a6603){if(_0x5a6603){return _0x5a6603?{'count':_0x3c291e,'rows':_0x5a6603}:null;}})[_0x23f6('0x16')](respondWithResult(_0x4336ca,null))['catch'](handleError(_0x4336ca,null));};exports[_0x23f6('0x53')]=function(_0x38f2b9,_0x504859,_0x17ff53){if(_0x38f2b9[_0x23f6('0x2f')]['id']){delete _0x38f2b9['body']['id'];}return db[_0x23f6('0x34')]['findOne']({'where':{'id':_0x38f2b9[_0x23f6('0x4c')]['id']}})[_0x23f6('0x16')](handleEntityNotFound(_0x504859,null))[_0x23f6('0x16')](function(_0xc3bf6b){if(_0xc3bf6b){_0x38f2b9[_0x23f6('0x2f')]['AccountId']=_0xc3bf6b['id'];_0x38f2b9[_0x23f6('0x2f')][_0x23f6('0x54')]=integrations[_0x23f6('0x55')](_0x38f2b9[_0x23f6('0x2f')][_0x23f6('0x56')],_0x38f2b9[_0x23f6('0x2f')][_0x23f6('0x36')]);_0x38f2b9[_0x23f6('0x2f')]['Descriptions']=integrations[_0x23f6('0x57')](_0x38f2b9[_0x23f6('0x2f')][_0x23f6('0x56')],_0x38f2b9[_0x23f6('0x2f')][_0x23f6('0x36')]);return db[_0x23f6('0x58')][_0x23f6('0x4f')](_0x38f2b9[_0x23f6('0x2f')],{'include':[{'model':db['ServicenowField'],'as':_0x23f6('0x54')},{'model':db[_0x23f6('0x59')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x504859,null))[_0x23f6('0x4e')](handleError(_0x504859,null));};exports[_0x23f6('0x5a')]=function(_0x5090ae,_0x209fbd,_0x56be5c){var _0x3be38f=[_0x23f6('0x5b'),_0x23f6('0x5c'),_0x23f6('0x5d'),'subcategory',_0x23f6('0x5e'),'notify',_0x23f6('0x5f'),'severity',_0x23f6('0x60')];var _0x25e745=['parent','made_sla',_0x23f6('0x61'),_0x23f6('0x62'),_0x23f6('0x63'),_0x23f6('0x64'),_0x23f6('0x65'),_0x23f6('0x5c'),_0x23f6('0x66'),_0x23f6('0x67'),_0x23f6('0x68'),_0x23f6('0x69'),_0x23f6('0x6a'),_0x23f6('0x6b'),_0x23f6('0x6c'),'sys_domain',_0x23f6('0x6d'),'sys_created_by',_0x23f6('0x5d'),_0x23f6('0x41'),_0x23f6('0x6e'),_0x23f6('0x6f'),_0x23f6('0x70'),'delivery_plan','impact',_0x23f6('0x71'),_0x23f6('0x72'),_0x23f6('0x73'),_0x23f6('0x74'),_0x23f6('0x75'),'rfc',_0x23f6('0x76'),'expected_start','opened_at',_0x23f6('0x77'),_0x23f6('0x78'),_0x23f6('0x79'),'reopened_time',_0x23f6('0x7a'),_0x23f6('0x7b'),_0x23f6('0x7c'),_0x23f6('0x7d'),_0x23f6('0x7e'),_0x23f6('0x7f'),_0x23f6('0x5e'),_0x23f6('0x80'),_0x23f6('0x81'),_0x23f6('0x82'),_0x23f6('0x83'),_0x23f6('0x84'),'additional_assignee_list',_0x23f6('0x85'),_0x23f6('0x86'),_0x23f6('0x87'),_0x23f6('0x88'),'close_notes',_0x23f6('0x89'),_0x23f6('0x8a'),_0x23f6('0x8b'),_0x23f6('0x8c'),_0x23f6('0x8d'),_0x23f6('0x8e'),_0x23f6('0x5f'),_0x23f6('0x8f'),'problem_id',_0x23f6('0x90'),_0x23f6('0x91'),'activity_due',_0x23f6('0x92'),_0x23f6('0x93'),_0x23f6('0x94'),_0x23f6('0x95'),_0x23f6('0x96'),'comments_and_work_notes',_0x23f6('0x97'),_0x23f6('0x98'),'reopen_count',_0x23f6('0x99'),_0x23f6('0x9a'),_0x23f6('0x9b'),_0x23f6('0x9c'),'location',_0x23f6('0x60')];var _0x3ed786='';var _0x29ad2a='';var _0x2a2f9a=[];var _0x46bed3='';var _0x35516b='';var _0x47e08b=[];var _0x39508f='';var _0x1cb3c5='';var _0x1317f8={};var _0x378307='';return db['ServicenowAccount'][_0x23f6('0x51')]({'where':{'id':_0x5090ae[_0x23f6('0x4c')]['id']},'attributes':['id',_0x23f6('0x9d'),_0x23f6('0x9e'),_0x23f6('0x9f'),_0x23f6('0xa0'),_0x23f6('0xa1')]})[_0x23f6('0x16')](handleEntityNotFound(_0x209fbd,null))[_0x23f6('0x16')](function(_0x2f1037){if(_0x2f1037){_0x378307=_0x2f1037[_0x23f6('0xa0')];var _0xdb6154=_0x378307['slice'](-0x1);if(_0xdb6154==='/'){_0x378307=_0x378307['substring'](0x0,_0x378307['lastIndexOf'](_0xdb6154));}_0x1cb3c5=util[_0x23f6('0xa2')](_0x23f6('0xa3'),_0x378307);_0x39508f=util['format'](_0x23f6('0xa4'),_0x378307);_0x1317f8={'user':_0x2f1037[_0x23f6('0x9d')],'pass':_0x2f1037[_0x23f6('0x9e')]};var _0x3012cb={'method':_0x23f6('0xa5'),'uri':_0x1cb3c5+_0x23f6('0xa6'),'auth':_0x1317f8,'json':!![]};return rp(_0x3012cb);}})[_0x23f6('0x16')](function(_0x1c6474){if(_0x1c6474[_0x23f6('0x1f')][_0x23f6('0x3e')]>0x0){_0x3ed786=_0x1c6474['result'];}console[_0x23f6('0xa7')](_0x23f6('0xa8'),_0x3ed786);_0x47e08b=[];_0x29ad2a=Object['assign']([],_0x3ed786);_['remove'](_0x29ad2a,function(_0x40e5b7){return!_0x3be38f[_0x23f6('0xa9')](_0x40e5b7[_0x23f6('0x2d')]);});_0x29ad2a['forEach'](function(_0x489a33){var _0x642c51=createFieldObject(_0x39508f,_0x1317f8,_0x489a33['internalType'],_0x489a33[_0x23f6('0x2d')],_0x489a33[_0x23f6('0xaa')],![]);_0x47e08b['push'](_0x642c51);});return Promise[_0x23f6('0xab')](_0x47e08b);})[_0x23f6('0x16')](function(_0x39eec2){_0x2a2f9a=_0x39eec2;_0x46bed3=Object[_0x23f6('0xac')]([],_0x3ed786);console['log'](_0x23f6('0xad'),_0x3ed786);_[_0x23f6('0xae')](_0x46bed3,function(_0x240858){return _0x25e745['includes'](_0x240858['name']);});console[_0x23f6('0xa7')](_0x23f6('0xaf'),_0x46bed3);_0x47e08b=[];_0x46bed3[_0x23f6('0xb0')](function(_0x30df74){var _0x4d03d5=createFieldObject(_0x39508f,_0x1317f8,_0x30df74[_0x23f6('0xb1')],_0x30df74['name'],_0x30df74[_0x23f6('0xaa')],!![]);_0x47e08b[_0x23f6('0xb2')](_0x4d03d5);});return Promise[_0x23f6('0xab')](_0x47e08b);})['then'](function(_0x4d5c3d){_0x35516b=_0x4d5c3d;var _0x56a957=_0x2a2f9a['concat'](_0x35516b);return{'count':_0x56a957[_0x23f6('0x3e')],'rows':_0x56a957};})[_0x23f6('0x16')](respondWithResult(_0x209fbd,null))[_0x23f6('0x4e')](function(_0x11832d){console['log'](_0x23f6('0xb3')+_0x11832d);var _0x5de6be=_0x5090ae[_0x23f6('0x38')][_0x23f6('0xb4')]?0x1f4:_0x11832d[_0x23f6('0xb5')]||0x1f4;logger['error'](_0x11832d[_0x23f6('0xb6')]);delete _0x11832d['name'];if(_0x5de6be===0x191){_0x5de6be=0x190;}_0x209fbd[_0x23f6('0x21')](_0x5de6be)[_0x23f6('0xb7')](_0x5090ae['query']['test']?{'message':_0x23f6('0xb8'),'statusCode':_0x11832d['statusCode']}:_0x11832d);});};function createFieldObject(_0x331007,_0x4cd483,_0xfedfa9,_0x5e99b0,_0x477610,_0x25db24){return new Promise(function(_0x27c03b,_0x2019a9){var _0x305d9f={'id':_0x5e99b0,'name':_0x477610,'custom':_0x25db24};if(_0xfedfa9===_0x23f6('0xb9')){_0x305d9f[_0x23f6('0x46')]=[{'name':_0x23f6('0xba'),'value':_0x23f6('0xbb')},{'name':'False','value':_0x23f6('0xbc')}];_0x27c03b(_0x305d9f);}else{var _0x31f86f={'method':'GET','uri':_0x331007+_0x23f6('0xbd')+_0x5e99b0,'auth':_0x4cd483,'json':!![]};return rp(_0x31f86f)[_0x23f6('0x16')](function(_0x2d9964){var _0x282dec=[];if(_0x2d9964['result'][_0x23f6('0x3e')]>0x0){_0x2d9964[_0x23f6('0x1f')]['forEach'](function(_0x2c1704){if(_0x2c1704['inactive']==='false'){var _0x544cde={'name':_0x2c1704[_0x23f6('0xaa')],'value':_0x2c1704[_0x23f6('0xbe')]};_0x282dec[_0x23f6('0xb2')](_0x544cde);}});}_0x305d9f[_0x23f6('0x46')]=_0x282dec;if(_0x305d9f[_0x23f6('0x46')][_0x23f6('0x3e')]>0x0){_0x27c03b(_0x305d9f);}else{if(_0x25db24==![]){_0x27c03b();}else{_0x27c03b(_0x305d9f);}}});}});} \ No newline at end of file +var _0x7aa4=['incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','push','all','TCL:\x20_object','includes','label','concat','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','boolean','True','true','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','reject','save','update','destroy','name','send','render','merge','contact','agent','interaction','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','attributes','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','getSubjects','channel','Descriptions','Subjects','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','sys_created_by','delivery_plan','impact','active','priority','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','business_stc','additional_assignee_list','sys_class_name','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','category','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','password','GET'];(function(_0x1f2eb7,_0x50b624){var _0x42739e=function(_0x22ac72){while(--_0x22ac72){_0x1f2eb7['push'](_0x1f2eb7['shift']());}};_0x42739e(++_0x50b624);}(_0x7aa4,0x19b));var _0x47aa=function(_0x39bb3f,_0x177f91){_0x39bb3f=_0x39bb3f-0x0;var _0x16fcaf=_0x7aa4[_0x39bb3f];return _0x16fcaf;};'use strict';var emlformat=require(_0x47aa('0x0'));var rimraf=require(_0x47aa('0x1'));var zipdir=require(_0x47aa('0x2'));var jsonpatch=require(_0x47aa('0x3'));var rp=require(_0x47aa('0x4'));var moment=require('moment');var BPromise=require(_0x47aa('0x5'));var Mustache=require(_0x47aa('0x6'));var util=require(_0x47aa('0x7'));var path=require('path');var sox=require(_0x47aa('0x8'));var csv=require(_0x47aa('0x9'));var ejs=require(_0x47aa('0xa'));var fs=require('fs');var fs_extra=require(_0x47aa('0xb'));var _=require(_0x47aa('0xc'));var squel=require(_0x47aa('0xd'));var crypto=require(_0x47aa('0xe'));var jsforce=require(_0x47aa('0xf'));var deskjs=require(_0x47aa('0x10'));var toCsv=require(_0x47aa('0x9'));var querystring=require(_0x47aa('0x11'));var Papa=require('papaparse');var Redis=require(_0x47aa('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x47aa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47aa('0x14'))(_0x47aa('0x15'));var utils=require(_0x47aa('0x16'));var config=require(_0x47aa('0x17'));var licenseUtil=require(_0x47aa('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x47aa('0x19'));var client=jayson[_0x47aa('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cee51,_0x3c43df,_0x653b6,_0x54f7fb){return new BPromise(function(_0x3c8760,_0x117f95){var _0x595b94=_0x54f7fb||client;return _0x595b94[_0x47aa('0x1b')](_0x5cee51,_0x653b6)[_0x47aa('0x1c')](function(_0xa02447){logger[_0x47aa('0x1d')]('ServicenowAccount,\x20%s,\x20%s',_0x3c43df,_0x47aa('0x1e'));logger['debug'](_0x47aa('0x1f'),_0x3c43df,_0x47aa('0x1e'),JSON[_0x47aa('0x20')](_0xa02447));if(_0xa02447[_0x47aa('0x21')]){if(_0xa02447[_0x47aa('0x21')][_0x47aa('0x22')]===0x1f4){logger[_0x47aa('0x21')](_0x47aa('0x23'),_0x3c43df,_0xa02447[_0x47aa('0x21')]['message']);return _0x117f95(_0xa02447['error']['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3c43df,_0xa02447[_0x47aa('0x21')][_0x47aa('0x24')]);return _0x3c8760(_0xa02447[_0x47aa('0x21')]['message']);}else{logger['info'](_0x47aa('0x23'),_0x3c43df,_0x47aa('0x1e'));_0x3c8760(_0xa02447[_0x47aa('0x25')][_0x47aa('0x24')]);}})[_0x47aa('0x26')](function(_0x5eb91c){logger[_0x47aa('0x21')](_0x47aa('0x23'),_0x3c43df,_0x5eb91c);_0x117f95(_0x5eb91c);});});}function respondWithStatusCode(_0x4f9059,_0x563b6c){_0x563b6c=_0x563b6c||0xcc;return function(_0x24e9e0){if(_0x24e9e0){return _0x4f9059[_0x47aa('0x27')](_0x563b6c);}return _0x4f9059['status'](_0x563b6c)[_0x47aa('0x28')]();};}function respondWithResult(_0x3f6244,_0xe9f3a5){_0xe9f3a5=_0xe9f3a5||0xc8;return function(_0x4c5bda){if(_0x4c5bda){return _0x3f6244[_0x47aa('0x29')](_0xe9f3a5)[_0x47aa('0x2a')](_0x4c5bda);}};}function respondWithFilteredResult(_0x2d8b4b,_0x5b1d2f){return function(_0x52f904){if(_0x52f904){var _0x3cd711=typeof _0x5b1d2f[_0x47aa('0x2b')]===_0x47aa('0x2c')&&typeof _0x5b1d2f[_0x47aa('0x2d')]===_0x47aa('0x2c');var _0xd6fb76=_0x52f904['count'];var _0x41136f=_0x3cd711?0x0:_0x5b1d2f['offset'];var _0x40dcc1=_0x3cd711?_0x52f904['count']:_0x5b1d2f['offset']+_0x5b1d2f[_0x47aa('0x2d')];var _0x597d71;if(_0x40dcc1>=_0xd6fb76){_0x40dcc1=_0xd6fb76;_0x597d71=0xc8;}else{_0x597d71=0xce;}_0x2d8b4b[_0x47aa('0x29')](_0x597d71);return _0x2d8b4b[_0x47aa('0x2e')]('Content-Range',_0x41136f+'-'+_0x40dcc1+'/'+_0xd6fb76)[_0x47aa('0x2a')](_0x52f904);}return null;};}function patchUpdates(_0x2a1ba9){return function(_0x6bb021){try{jsonpatch['apply'](_0x6bb021,_0x2a1ba9,!![]);}catch(_0x31960a){return BPromise[_0x47aa('0x2f')](_0x31960a);}return _0x6bb021[_0x47aa('0x30')]();};}function saveUpdates(_0x2bcec2,_0x13368c){return function(_0x126f0c){if(_0x126f0c){return _0x126f0c[_0x47aa('0x31')](_0x2bcec2)[_0x47aa('0x1c')](function(_0x3342c1){return _0x3342c1;});}return null;};}function removeEntity(_0x81d64d,_0x25e9db){return function(_0x5c4f63){if(_0x5c4f63){return _0x5c4f63[_0x47aa('0x32')]()['then'](function(){_0x81d64d['status'](0xcc)[_0x47aa('0x28')]();});}};}function handleEntityNotFound(_0x39f9f0,_0x43d89){return function(_0x2e732b){if(!_0x2e732b){_0x39f9f0[_0x47aa('0x27')](0x194);}return _0x2e732b;};}function handleError(_0x4d886f,_0x19501e){_0x19501e=_0x19501e||0x1f4;return function(_0x4d1ab3){logger[_0x47aa('0x21')](_0x4d1ab3['stack']);if(_0x4d1ab3[_0x47aa('0x33')]){delete _0x4d1ab3[_0x47aa('0x33')];}_0x4d886f[_0x47aa('0x29')](_0x19501e)[_0x47aa('0x34')](_0x4d1ab3);};}function getMustacheRender(_0x41d2f5,_0x3b1869){return Mustache[_0x47aa('0x35')](_0x41d2f5,_[_0x47aa('0x36')](_0x3b1869['body'],{'contact':_0x3b1869[_0x47aa('0x37')],'message':_0x3b1869[_0x47aa('0x24')],'agent':_0x3b1869[_0x47aa('0x38')],'interaction':_0x3b1869[_0x47aa('0x39')],'account':_0x3b1869['account']}))||'';}exports[_0x47aa('0x3a')]=function(_0x344542,_0x3343dd){var _0x334d54={},_0x882a1b={},_0xfe33f1={'count':0x0,'rows':[]};var _0x395a9e=_[_0x47aa('0x3b')](db[_0x47aa('0x3c')][_0x47aa('0x3d')],function(_0x15bc1a){return{'name':_0x15bc1a[_0x47aa('0x3e')],'type':_0x15bc1a[_0x47aa('0x3f')][_0x47aa('0x40')]};});_0x882a1b[_0x47aa('0x41')]=_['map'](_0x395a9e,_0x47aa('0x33'));_0x882a1b[_0x47aa('0x42')]=_[_0x47aa('0x43')](_0x344542[_0x47aa('0x42')]);_0x882a1b['filters']=_[_0x47aa('0x44')](_0x882a1b['model'],_0x882a1b[_0x47aa('0x42')]);_0x334d54['attributes']=_['intersection'](_0x882a1b[_0x47aa('0x41')],qs[_0x47aa('0x45')](_0x344542[_0x47aa('0x42')][_0x47aa('0x45')]));_0x334d54['attributes']=_0x334d54['attributes'][_0x47aa('0x46')]?_0x334d54[_0x47aa('0x47')]:_0x882a1b['model'];if(!_0x344542['query']['hasOwnProperty'](_0x47aa('0x48'))){_0x334d54['limit']=qs[_0x47aa('0x2d')](_0x344542[_0x47aa('0x42')]['limit']);_0x334d54[_0x47aa('0x2b')]=qs[_0x47aa('0x2b')](_0x344542[_0x47aa('0x42')][_0x47aa('0x2b')]);}_0x334d54['order']=qs[_0x47aa('0x49')](_0x344542[_0x47aa('0x42')][_0x47aa('0x49')]);_0x334d54[_0x47aa('0x4a')]=qs[_0x47aa('0x4b')](_[_0x47aa('0x4c')](_0x344542['query'],_0x882a1b['filters']),_0x395a9e);if(_0x344542['query'][_0x47aa('0x4d')]){_0x334d54[_0x47aa('0x4a')]=_[_0x47aa('0x36')](_0x334d54[_0x47aa('0x4a')],{'$or':_[_0x47aa('0x3b')](_0x395a9e,function(_0x45bf92){if(_0x45bf92['type']!==_0x47aa('0x4e')){var _0x41c77a={};_0x41c77a[_0x45bf92[_0x47aa('0x33')]]={'$like':'%'+_0x344542[_0x47aa('0x42')][_0x47aa('0x4d')]+'%'};return _0x41c77a;}})});}_0x334d54=_[_0x47aa('0x36')]({},_0x334d54,_0x344542[_0x47aa('0x4f')]);var _0x3470e3={'where':_0x334d54[_0x47aa('0x4a')]};return db['ServicenowAccount'][_0x47aa('0x50')](_0x3470e3)[_0x47aa('0x1c')](function(_0x35ae66){_0xfe33f1[_0x47aa('0x50')]=_0x35ae66;if(_0x344542[_0x47aa('0x42')][_0x47aa('0x51')]){_0x334d54[_0x47aa('0x52')]=[{'all':!![]}];}return db[_0x47aa('0x3c')][_0x47aa('0x53')](_0x334d54);})['then'](function(_0x29ccc7){_0xfe33f1['rows']=_0x29ccc7;return _0xfe33f1;})['then'](respondWithFilteredResult(_0x3343dd,_0x334d54))['catch'](handleError(_0x3343dd,null));};exports['show']=function(_0x140277,_0x5aca2c){var _0x5698d0={'raw':![],'where':{'id':_0x140277[_0x47aa('0x54')]['id']}},_0xc13392={};_0xc13392[_0x47aa('0x41')]=_[_0x47aa('0x43')](db['ServicenowAccount'][_0x47aa('0x3d')]);_0xc13392[_0x47aa('0x42')]=_[_0x47aa('0x43')](_0x140277[_0x47aa('0x42')]);_0xc13392[_0x47aa('0x4b')]=_[_0x47aa('0x44')](_0xc13392[_0x47aa('0x41')],_0xc13392[_0x47aa('0x42')]);_0x5698d0['attributes']=_[_0x47aa('0x44')](_0xc13392['model'],qs[_0x47aa('0x45')](_0x140277[_0x47aa('0x42')][_0x47aa('0x45')]));_0x5698d0['attributes']=_0x5698d0[_0x47aa('0x47')][_0x47aa('0x46')]?_0x5698d0[_0x47aa('0x47')]:_0xc13392[_0x47aa('0x41')];if(_0x140277[_0x47aa('0x42')][_0x47aa('0x51')]){_0x5698d0[_0x47aa('0x52')]=[{'all':!![]}];}_0x5698d0=_[_0x47aa('0x36')]({},_0x5698d0,_0x140277[_0x47aa('0x4f')]);return db[_0x47aa('0x3c')][_0x47aa('0x55')](_0x5698d0)[_0x47aa('0x1c')](handleEntityNotFound(_0x5aca2c,null))[_0x47aa('0x1c')](respondWithResult(_0x5aca2c,null))[_0x47aa('0x26')](handleError(_0x5aca2c,null));};exports[_0x47aa('0x56')]=function(_0x343ce6,_0x1197a1){return db['ServicenowAccount'][_0x47aa('0x56')](_0x343ce6[_0x47aa('0x57')],{})[_0x47aa('0x1c')](respondWithResult(_0x1197a1,0xc9))[_0x47aa('0x26')](handleError(_0x1197a1,null));};exports[_0x47aa('0x31')]=function(_0x126389,_0x43c184){if(_0x126389[_0x47aa('0x57')]['id']){delete _0x126389[_0x47aa('0x57')]['id'];}return db[_0x47aa('0x3c')][_0x47aa('0x55')]({'where':{'id':_0x126389['params']['id']}})[_0x47aa('0x1c')](handleEntityNotFound(_0x43c184,null))[_0x47aa('0x1c')](saveUpdates(_0x126389[_0x47aa('0x57')],null))[_0x47aa('0x1c')](respondWithResult(_0x43c184,null))[_0x47aa('0x26')](handleError(_0x43c184,null));};exports[_0x47aa('0x32')]=function(_0x5518e4,_0x26578d){return db['ServicenowAccount'][_0x47aa('0x55')]({'where':{'id':_0x5518e4[_0x47aa('0x54')]['id']}})[_0x47aa('0x1c')](handleEntityNotFound(_0x26578d,null))[_0x47aa('0x1c')](removeEntity(_0x26578d,null))[_0x47aa('0x26')](handleError(_0x26578d,null));};exports[_0x47aa('0x58')]=function(_0x31b1d2,_0x11a248,_0x176d49){var _0x435154={};var _0x59bdd7={};var _0x11a452;var _0x3252a2;return db[_0x47aa('0x3c')][_0x47aa('0x59')]({'where':{'id':_0x31b1d2['params']['id']}})[_0x47aa('0x1c')](handleEntityNotFound(_0x11a248,null))[_0x47aa('0x1c')](function(_0x95e70a){if(_0x95e70a){_0x11a452=_0x95e70a;_0x59bdd7[_0x47aa('0x41')]=_[_0x47aa('0x43')](db[_0x47aa('0x5a')]['rawAttributes']);_0x59bdd7['query']=_[_0x47aa('0x43')](_0x31b1d2[_0x47aa('0x42')]);_0x59bdd7[_0x47aa('0x4b')]=_[_0x47aa('0x44')](_0x59bdd7[_0x47aa('0x41')],_0x59bdd7[_0x47aa('0x42')]);_0x435154[_0x47aa('0x47')]=_[_0x47aa('0x44')](_0x59bdd7['model'],qs[_0x47aa('0x45')](_0x31b1d2[_0x47aa('0x42')][_0x47aa('0x45')]));_0x435154[_0x47aa('0x47')]=_0x435154['attributes'][_0x47aa('0x46')]?_0x435154[_0x47aa('0x47')]:_0x59bdd7[_0x47aa('0x41')];_0x435154[_0x47aa('0x5b')]=qs[_0x47aa('0x49')](_0x31b1d2[_0x47aa('0x42')][_0x47aa('0x49')]);_0x435154['where']=qs[_0x47aa('0x4b')](_[_0x47aa('0x4c')](_0x31b1d2[_0x47aa('0x42')],_0x59bdd7[_0x47aa('0x4b')]));if(_0x31b1d2['query'][_0x47aa('0x4d')]){_0x435154[_0x47aa('0x4a')]=_[_0x47aa('0x36')](_0x435154[_0x47aa('0x4a')],{'$or':_[_0x47aa('0x3b')](_0x435154['attributes'],function(_0x384912){var _0x41794={};_0x41794[_0x384912]={'$like':'%'+_0x31b1d2['query'][_0x47aa('0x4d')]+'%'};return _0x41794;})});}_0x435154=_[_0x47aa('0x36')]({},_0x435154,_0x31b1d2[_0x47aa('0x4f')]);return _0x11a452[_0x47aa('0x58')](_0x435154);}})[_0x47aa('0x1c')](function(_0x5bb6d7){if(_0x5bb6d7){_0x3252a2=_0x5bb6d7[_0x47aa('0x46')];if(!_0x31b1d2[_0x47aa('0x42')]['hasOwnProperty']('nolimit')){_0x435154['limit']=qs[_0x47aa('0x2d')](_0x31b1d2[_0x47aa('0x42')][_0x47aa('0x2d')]);_0x435154['offset']=qs[_0x47aa('0x2b')](_0x31b1d2[_0x47aa('0x42')][_0x47aa('0x2b')]);}return _0x11a452[_0x47aa('0x58')](_0x435154);}})[_0x47aa('0x1c')](function(_0x3a70e1){if(_0x3a70e1){return _0x3a70e1?{'count':_0x3252a2,'rows':_0x3a70e1}:null;}})[_0x47aa('0x1c')](respondWithResult(_0x11a248,null))[_0x47aa('0x26')](handleError(_0x11a248,null));};exports[_0x47aa('0x5c')]=function(_0x4a9250,_0x538fb0,_0xa054f){if(_0x4a9250[_0x47aa('0x57')]['id']){delete _0x4a9250[_0x47aa('0x57')]['id'];}return db[_0x47aa('0x3c')][_0x47aa('0x59')]({'where':{'id':_0x4a9250[_0x47aa('0x54')]['id']}})['then'](handleEntityNotFound(_0x538fb0,null))[_0x47aa('0x1c')](function(_0x33dddb){if(_0x33dddb){_0x4a9250[_0x47aa('0x57')]['AccountId']=_0x33dddb['id'];_0x4a9250[_0x47aa('0x57')]['Subjects']=integrations[_0x47aa('0x5d')](_0x4a9250[_0x47aa('0x57')][_0x47aa('0x5e')],_0x4a9250[_0x47aa('0x57')][_0x47aa('0x3f')]);_0x4a9250[_0x47aa('0x57')][_0x47aa('0x5f')]=integrations['getDescriptions'](_0x4a9250[_0x47aa('0x57')]['channel'],_0x4a9250[_0x47aa('0x57')][_0x47aa('0x3f')]);return db[_0x47aa('0x5a')][_0x47aa('0x56')](_0x4a9250[_0x47aa('0x57')],{'include':[{'model':db['ServicenowField'],'as':_0x47aa('0x60')},{'model':db[_0x47aa('0x61')],'as':_0x47aa('0x5f')}]});}return null;})[_0x47aa('0x1c')](respondWithResult(_0x538fb0,null))[_0x47aa('0x26')](handleError(_0x538fb0,null));};exports[_0x47aa('0x62')]=function(_0x52af08,_0x91ee35,_0x449ef7){var _0x43f058=[_0x47aa('0x63'),'hold_reason',_0x47aa('0x64'),_0x47aa('0x65'),_0x47aa('0x66'),_0x47aa('0x67'),_0x47aa('0x68'),_0x47aa('0x69'),'category'];var _0xc6f650=['parent',_0x47aa('0x63'),'caused_by',_0x47aa('0x6a'),_0x47aa('0x6b'),_0x47aa('0x6c'),_0x47aa('0x6d'),_0x47aa('0x6e'),_0x47aa('0x6f'),_0x47aa('0x70'),_0x47aa('0x71'),_0x47aa('0x72'),'opened_by',_0x47aa('0x73'),_0x47aa('0x74'),_0x47aa('0x75'),'state',_0x47aa('0x76'),_0x47aa('0x64'),'order','calendar_stc','closed_at','cmdb_ci',_0x47aa('0x77'),_0x47aa('0x78'),_0x47aa('0x79'),'work_notes_list','business_service',_0x47aa('0x7a'),'sys_domain_path','rfc',_0x47aa('0x7b'),_0x47aa('0x7c'),_0x47aa('0x7d'),_0x47aa('0x7e'),_0x47aa('0x7f'),_0x47aa('0x80'),_0x47aa('0x81'),_0x47aa('0x82'),_0x47aa('0x83'),_0x47aa('0x84'),_0x47aa('0x65'),_0x47aa('0x85'),_0x47aa('0x86'),'close_code',_0x47aa('0x87'),_0x47aa('0x88'),'work_start','assignment_group',_0x47aa('0x89'),_0x47aa('0x8a'),'description','calendar_duration',_0x47aa('0x67'),_0x47aa('0x8b'),'close_notes','closed_by',_0x47aa('0x8c'),_0x47aa('0x8d'),_0x47aa('0x8e'),_0x47aa('0x8f'),_0x47aa('0x90'),_0x47aa('0x68'),_0x47aa('0x91'),_0x47aa('0x92'),_0x47aa('0x93'),_0x47aa('0x94'),'activity_due',_0x47aa('0x95'),_0x47aa('0x69'),_0x47aa('0x96'),_0x47aa('0x97'),_0x47aa('0x98'),'comments_and_work_notes',_0x47aa('0x99'),_0x47aa('0x9a'),'reopen_count',_0x47aa('0x9b'),_0x47aa('0x9c'),_0x47aa('0x9d'),_0x47aa('0x9e'),'location',_0x47aa('0x9f')];var _0x5cc97a='';var _0x242b3c='';var _0x2a7978=[];var _0x297688='';var _0x2d18e5='';var _0x17c42f=[];var _0x5c4ae5='';var _0x278564='';var _0x54af96={};var _0x1cd902='';return db[_0x47aa('0x3c')][_0x47aa('0x59')]({'where':{'id':_0x52af08[_0x47aa('0x54')]['id']},'attributes':['id',_0x47aa('0xa0'),'password',_0x47aa('0xa1'),_0x47aa('0xa2'),_0x47aa('0xa3')]})[_0x47aa('0x1c')](handleEntityNotFound(_0x91ee35,null))[_0x47aa('0x1c')](function(_0x473d7d){if(_0x473d7d){_0x1cd902=_0x473d7d[_0x47aa('0xa2')];var _0x140bf5=_0x1cd902[_0x47aa('0xa4')](-0x1);if(_0x140bf5==='/'){_0x1cd902=_0x1cd902[_0x47aa('0xa5')](0x0,_0x1cd902[_0x47aa('0xa6')](_0x140bf5));}_0x278564=util[_0x47aa('0xa7')](_0x47aa('0xa8'),_0x1cd902);_0x5c4ae5=util[_0x47aa('0xa7')]('%s/api/now/table/',_0x1cd902);_0x54af96={'user':_0x473d7d[_0x47aa('0xa0')],'pass':_0x473d7d[_0x47aa('0xa9')]};var _0x54113c={'method':_0x47aa('0xaa'),'uri':_0x278564+_0x47aa('0xab'),'auth':_0x54af96,'json':!![]};return rp(_0x54113c);}})['then'](function(_0x26a625){if(_0x26a625[_0x47aa('0x25')][_0x47aa('0x46')]>0x0){_0x5cc97a=_0x26a625[_0x47aa('0x25')];}console[_0x47aa('0xac')](_0x47aa('0xad'),_0x5cc97a);_0x17c42f=[];_0x242b3c=Object[_0x47aa('0xae')]([],_0x5cc97a);_[_0x47aa('0xaf')](_0x242b3c,function(_0x5f32b8){return!_0x43f058['includes'](_0x5f32b8[_0x47aa('0x33')]);});_0x242b3c[_0x47aa('0xb0')](function(_0x5df08f){var _0x4f21a3=createFieldObject(_0x5c4ae5,_0x54af96,_0x5df08f[_0x47aa('0xb1')],_0x5df08f['name'],_0x5df08f['label'],![]);_0x17c42f[_0x47aa('0xb2')](_0x4f21a3);});return Promise[_0x47aa('0xb3')](_0x17c42f);})[_0x47aa('0x1c')](function(_0x2f1c60){_0x2a7978=_0x2f1c60;_0x297688=Object[_0x47aa('0xae')]([],_0x5cc97a);console[_0x47aa('0xac')](_0x47aa('0xb4'),_0x5cc97a);_[_0x47aa('0xaf')](_0x297688,function(_0xf9b59){return _0xc6f650[_0x47aa('0xb5')](_0xf9b59[_0x47aa('0x33')]);});console[_0x47aa('0xac')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x297688);_0x17c42f=[];_0x297688[_0x47aa('0xb0')](function(_0x3852d9){var _0x2f4e6d=createFieldObject(_0x5c4ae5,_0x54af96,_0x3852d9[_0x47aa('0xb1')],_0x3852d9[_0x47aa('0x33')],_0x3852d9[_0x47aa('0xb6')],!![]);_0x17c42f[_0x47aa('0xb2')](_0x2f4e6d);});return Promise['all'](_0x17c42f);})[_0x47aa('0x1c')](function(_0x2515f0){_0x2d18e5=_0x2515f0;var _0x17a6d8=_0x2a7978[_0x47aa('0xb7')](_0x2d18e5);return{'count':_0x17a6d8['length'],'rows':_0x17a6d8};})[_0x47aa('0x1c')](respondWithResult(_0x91ee35,null))[_0x47aa('0x26')](function(_0xcb83b9){console['log'](_0x47aa('0xb8')+_0xcb83b9);var _0x558e96=_0x52af08[_0x47aa('0x42')][_0x47aa('0xb9')]?0x1f4:_0xcb83b9[_0x47aa('0xba')]||0x1f4;logger[_0x47aa('0x21')](_0xcb83b9[_0x47aa('0xbb')]);delete _0xcb83b9['name'];if(_0x558e96===0x191){_0x558e96=0x190;}_0x91ee35[_0x47aa('0x29')](_0x558e96)[_0x47aa('0x34')](_0x52af08[_0x47aa('0x42')][_0x47aa('0xb9')]?{'message':_0x47aa('0xbc'),'statusCode':_0xcb83b9[_0x47aa('0xba')]}:_0xcb83b9);});};function createFieldObject(_0x364f5c,_0x29de4a,_0x2d0ee6,_0x3f4f09,_0xfef088,_0x3c99b2){return new Promise(function(_0x4227bb,_0x510e39){var _0x5d760d={'id':_0x3f4f09,'name':_0xfef088,'custom':_0x3c99b2};if(_0x2d0ee6===_0x47aa('0xbd')){_0x5d760d[_0x47aa('0x4f')]=[{'name':_0x47aa('0xbe'),'value':_0x47aa('0xbf')},{'name':'False','value':'false'}];_0x4227bb(_0x5d760d);}else{var _0x569635={'method':'GET','uri':_0x364f5c+_0x47aa('0xc0')+_0x3f4f09,'auth':_0x29de4a,'json':!![]};return rp(_0x569635)['then'](function(_0x38f27c){var _0x4a672d=[];if(_0x38f27c['result'][_0x47aa('0x46')]>0x0){_0x38f27c['result'][_0x47aa('0xb0')](function(_0x5db614){if(_0x5db614['inactive']==='false'){var _0x2609e7={'name':_0x5db614[_0x47aa('0xb6')],'value':_0x5db614[_0x47aa('0xc1')]};_0x4a672d[_0x47aa('0xb2')](_0x2609e7);}});}_0x5d760d[_0x47aa('0x4f')]=_0x4a672d;if(_0x5d760d[_0x47aa('0x4f')]['length']>0x0){_0x4227bb(_0x5d760d);}else{if(_0x3c99b2==![]){_0x4227bb();}else{_0x4227bb(_0x5d760d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index d56d6f9..3832bcf 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 _0xac9d=['bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x53c33c,_0x27223d){var _0x277750=function(_0x3446fb){while(--_0x3446fb){_0x53c33c['push'](_0x53c33c['shift']());}};_0x277750(++_0x27223d);}(_0xac9d,0x14d));var _0xdac9=function(_0x40b66c,_0x5c1d58){_0x40b66c=_0x40b66c-0x0;var _0x159671=_0xac9d[_0x40b66c];return _0x159671;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var logger=require(_0xdac9('0x2'))(_0xdac9('0x3'));var moment=require(_0xdac9('0x4'));var BPromise=require(_0xdac9('0x5'));var rp=require(_0xdac9('0x6'));var fs=require('fs');var path=require(_0xdac9('0x7'));var rimraf=require('rimraf');var config=require(_0xdac9('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xdac9('0x9'));module[_0xdac9('0xa')]=function(_0x1222bb,_0x776b6c){return _0x1222bb[_0xdac9('0xb')](_0xdac9('0xc'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe015=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xe015,0x13b));var _0x5e01=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe015[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x5e01('0x8')]=function(_0x3d2da2,_0x4de678){return _0x3d2da2['define'](_0x5e01('0x9'),attributes,{'tableName':_0x5e01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index a5a6ae0..db05fdf 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 _0x764c=['map','model','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include'];(function(_0x2bf991,_0x5a7051){var _0x619ab4=function(_0x17e36b){while(--_0x17e36b){_0x2bf991['push'](_0x2bf991['shift']());}};_0x619ab4(++_0x5a7051);}(_0x764c,0x1cc));var _0xc764=function(_0x195d6e,_0xb8b68f){_0x195d6e=_0x195d6e-0x0;var _0x30f620=_0x764c[_0x195d6e];return _0x30f620;};'use strict';var _=require(_0xc764('0x0'));var util=require(_0xc764('0x1'));var moment=require(_0xc764('0x2'));var BPromise=require(_0xc764('0x3'));var rs=require(_0xc764('0x4'));var fs=require('fs');var Redis=require(_0xc764('0x5'));var db=require(_0xc764('0x6'))['db'];var utils=require(_0xc764('0x7'));var logger=require(_0xc764('0x8'))(_0xc764('0x9'));var config=require(_0xc764('0xa'));var jayson=require(_0xc764('0xb'));var client=jayson[_0xc764('0xc')][_0xc764('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3d9511,_0x4723e4,_0x2da161){return new BPromise(function(_0x26dd26,_0x558bbd){return client[_0xc764('0xe')](_0x3d9511,_0x2da161)[_0xc764('0xf')](function(_0x123347){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x4723e4,'request\x20sent');logger[_0xc764('0x10')](_0xc764('0x11'),_0x4723e4,_0xc764('0x12'),JSON[_0xc764('0x13')](_0x123347));if(_0x123347[_0xc764('0x14')]){if(_0x123347['error']['code']===0x1f4){logger['error'](_0xc764('0x15'),_0x4723e4,_0x123347['error'][_0xc764('0x16')]);return _0x558bbd(_0x123347['error'][_0xc764('0x16')]);}logger[_0xc764('0x14')](_0xc764('0x15'),_0x4723e4,_0x123347[_0xc764('0x14')][_0xc764('0x16')]);return _0x26dd26(_0x123347[_0xc764('0x14')][_0xc764('0x16')]);}else{logger[_0xc764('0x17')]('ServicenowAccount,\x20%s,\x20%s',_0x4723e4,_0xc764('0x12'));_0x26dd26(_0x123347[_0xc764('0x18')]['message']);}})[_0xc764('0x19')](function(_0xe8ea22){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x4723e4,_0xe8ea22);_0x558bbd(_0xe8ea22);});});}exports[_0xc764('0x1a')]=function(_0x474153){var _0x483daa=this;return new Promise(function(_0x532aff,_0x3b9e09){return db[_0xc764('0x1b')]['findAll']({'raw':_0x474153[_0xc764('0x1c')]?_0x474153['options'][_0xc764('0x1d')]===undefined?!![]:![]:!![],'where':_0x474153[_0xc764('0x1c')]?_0x474153[_0xc764('0x1c')][_0xc764('0x1e')]||null:null,'attributes':_0x474153['options']?_0x474153[_0xc764('0x1c')][_0xc764('0x1f')]||null:null,'limit':_0x474153[_0xc764('0x1c')]?_0x474153[_0xc764('0x1c')][_0xc764('0x20')]||null:null,'include':_0x474153['options']?_0x474153[_0xc764('0x1c')][_0xc764('0x21')]?_[_0xc764('0x22')](_0x474153[_0xc764('0x1c')][_0xc764('0x21')],function(_0x2791fd){return{'model':db[_0x2791fd[_0xc764('0x23')]],'as':_0x2791fd['as'],'attributes':_0x2791fd[_0xc764('0x1f')],'include':_0x2791fd[_0xc764('0x21')]?_[_0xc764('0x22')](_0x2791fd[_0xc764('0x21')],function(_0x40a069){return{'model':db[_0x40a069['model']],'as':_0x40a069['as'],'attributes':_0x40a069[_0xc764('0x1f')],'include':_0x40a069['include']?_['map'](_0x40a069['include'],function(_0x35b7ef){return{'model':db[_0x35b7ef[_0xc764('0x23')]],'as':_0x35b7ef['as'],'attributes':_0x35b7ef[_0xc764('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc764('0xf')](function(_0x70e6f8){logger[_0xc764('0x17')]('GetServicenowAccount',_0x474153);logger['debug'](_0xc764('0x1a'),_0x474153,JSON['stringify'](_0x70e6f8));_0x532aff(_0x70e6f8);})[_0xc764('0x19')](function(_0x13f2dc){logger['error']('GetServicenowAccount',_0x13f2dc['message'],_0x474153);_0x3b9e09(_0x483daa['error'](0x1f4,_0x13f2dc['message']));});});};exports[_0xc764('0x24')]=function(_0x180f52){var _0x22fcbe=this;return new Promise(function(_0x425587,_0x20d2e4){return db[_0xc764('0x1b')][_0xc764('0x25')]({'raw':_0x180f52[_0xc764('0x1c')]?_0x180f52[_0xc764('0x1c')][_0xc764('0x1d')]===undefined?!![]:![]:!![],'where':_0x180f52['options']?_0x180f52[_0xc764('0x1c')]['where']||null:null,'attributes':_0x180f52[_0xc764('0x1c')]?_0x180f52[_0xc764('0x1c')][_0xc764('0x1f')]||null:null,'include':_0x180f52['options']?_0x180f52[_0xc764('0x1c')]['include']?_[_0xc764('0x22')](_0x180f52[_0xc764('0x1c')][_0xc764('0x21')],function(_0x29564d){return{'model':db[_0x29564d[_0xc764('0x23')]],'as':_0x29564d['as'],'attributes':_0x29564d[_0xc764('0x1f')],'include':_0x29564d[_0xc764('0x21')]?_[_0xc764('0x22')](_0x29564d[_0xc764('0x21')],function(_0x292d41){return{'model':db[_0x292d41[_0xc764('0x23')]],'as':_0x292d41['as'],'attributes':_0x292d41[_0xc764('0x1f')],'include':_0x292d41[_0xc764('0x21')]?_[_0xc764('0x22')](_0x292d41[_0xc764('0x21')],function(_0x35c63f){return{'model':db[_0x35c63f['model']],'as':_0x35c63f['as'],'attributes':_0x35c63f[_0xc764('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc764('0xf')](function(_0x4d00f0){logger['info']('ShowServicenowAccount',_0x180f52);logger['debug'](_0xc764('0x24'),_0x180f52,JSON[_0xc764('0x13')](_0x4d00f0));_0x425587(_0x4d00f0);})[_0xc764('0x19')](function(_0x3a5e31){logger['error']('ShowServicenowAccount',_0x3a5e31[_0xc764('0x16')],_0x180f52);_0x20d2e4(_0x22fcbe['error'](0x1f4,_0x3a5e31[_0xc764('0x16')]));});});}; \ No newline at end of file +var _0x02f8=['../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ServicenowAccount','findAll','options','where','limit','include','map','attributes','model','GetServicenowAccount','catch','find','raw','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x350aeb,_0x3d265a){var _0x3c5273=function(_0x32b417){while(--_0x32b417){_0x350aeb['push'](_0x350aeb['shift']());}};_0x3c5273(++_0x3d265a);}(_0x02f8,0x1ca));var _0x802f=function(_0x1bdb82,_0x50e7a5){_0x1bdb82=_0x1bdb82-0x0;var _0x11a52b=_0x02f8[_0x1bdb82];return _0x11a52b;};'use strict';var _=require(_0x802f('0x0'));var util=require(_0x802f('0x1'));var moment=require(_0x802f('0x2'));var BPromise=require(_0x802f('0x3'));var rs=require(_0x802f('0x4'));var fs=require('fs');var Redis=require(_0x802f('0x5'));var db=require(_0x802f('0x6'))['db'];var utils=require(_0x802f('0x7'));var logger=require(_0x802f('0x8'))(_0x802f('0x9'));var config=require(_0x802f('0xa'));var jayson=require(_0x802f('0xb'));var client=jayson[_0x802f('0xc')][_0x802f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3dc258,_0x2c6610,_0xbff759){return new BPromise(function(_0x514a5f,_0x3dd5b3){return client[_0x802f('0xe')](_0x3dc258,_0xbff759)[_0x802f('0xf')](function(_0x464aaf){logger[_0x802f('0x10')](_0x802f('0x11'),_0x2c6610,_0x802f('0x12'));logger[_0x802f('0x13')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2c6610,'request\x20sent',JSON[_0x802f('0x14')](_0x464aaf));if(_0x464aaf[_0x802f('0x15')]){if(_0x464aaf['error'][_0x802f('0x16')]===0x1f4){logger['error'](_0x802f('0x11'),_0x2c6610,_0x464aaf[_0x802f('0x15')][_0x802f('0x17')]);return _0x3dd5b3(_0x464aaf[_0x802f('0x15')][_0x802f('0x17')]);}logger[_0x802f('0x15')](_0x802f('0x11'),_0x2c6610,_0x464aaf[_0x802f('0x15')]['message']);return _0x514a5f(_0x464aaf[_0x802f('0x15')][_0x802f('0x17')]);}else{logger[_0x802f('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2c6610,_0x802f('0x12'));_0x514a5f(_0x464aaf[_0x802f('0x18')][_0x802f('0x17')]);}})['catch'](function(_0xba6a66){logger[_0x802f('0x15')](_0x802f('0x11'),_0x2c6610,_0xba6a66);_0x3dd5b3(_0xba6a66);});});}exports['GetServicenowAccount']=function(_0x3e4625){var _0x431451=this;return new Promise(function(_0x5d732c,_0x369f9e){return db[_0x802f('0x19')][_0x802f('0x1a')]({'raw':_0x3e4625[_0x802f('0x1b')]?_0x3e4625[_0x802f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3e4625[_0x802f('0x1b')]?_0x3e4625[_0x802f('0x1b')][_0x802f('0x1c')]||null:null,'attributes':_0x3e4625[_0x802f('0x1b')]?_0x3e4625['options']['attributes']||null:null,'limit':_0x3e4625[_0x802f('0x1b')]?_0x3e4625['options'][_0x802f('0x1d')]||null:null,'include':_0x3e4625[_0x802f('0x1b')]?_0x3e4625['options'][_0x802f('0x1e')]?_[_0x802f('0x1f')](_0x3e4625['options'][_0x802f('0x1e')],function(_0x4e51d9){return{'model':db[_0x4e51d9['model']],'as':_0x4e51d9['as'],'attributes':_0x4e51d9[_0x802f('0x20')],'include':_0x4e51d9['include']?_[_0x802f('0x1f')](_0x4e51d9[_0x802f('0x1e')],function(_0x4dbe17){return{'model':db[_0x4dbe17[_0x802f('0x21')]],'as':_0x4dbe17['as'],'attributes':_0x4dbe17[_0x802f('0x20')],'include':_0x4dbe17[_0x802f('0x1e')]?_[_0x802f('0x1f')](_0x4dbe17[_0x802f('0x1e')],function(_0x50f487){return{'model':db[_0x50f487['model']],'as':_0x50f487['as'],'attributes':_0x50f487['attributes']};}):[]};}):[]};}):[]:[]})[_0x802f('0xf')](function(_0x47d5c8){logger[_0x802f('0x10')](_0x802f('0x22'),_0x3e4625);logger[_0x802f('0x13')](_0x802f('0x22'),_0x3e4625,JSON[_0x802f('0x14')](_0x47d5c8));_0x5d732c(_0x47d5c8);})[_0x802f('0x23')](function(_0x3ee5ec){logger['error']('GetServicenowAccount',_0x3ee5ec[_0x802f('0x17')],_0x3e4625);_0x369f9e(_0x431451[_0x802f('0x15')](0x1f4,_0x3ee5ec[_0x802f('0x17')]));});});};exports['ShowServicenowAccount']=function(_0x11638){var _0x1d2c81=this;return new Promise(function(_0xd63a06,_0x499d74){return db[_0x802f('0x19')][_0x802f('0x24')]({'raw':_0x11638[_0x802f('0x1b')]?_0x11638[_0x802f('0x1b')][_0x802f('0x25')]===undefined?!![]:![]:!![],'where':_0x11638[_0x802f('0x1b')]?_0x11638[_0x802f('0x1b')][_0x802f('0x1c')]||null:null,'attributes':_0x11638['options']?_0x11638[_0x802f('0x1b')]['attributes']||null:null,'include':_0x11638[_0x802f('0x1b')]?_0x11638['options']['include']?_['map'](_0x11638[_0x802f('0x1b')][_0x802f('0x1e')],function(_0x1f241e){return{'model':db[_0x1f241e[_0x802f('0x21')]],'as':_0x1f241e['as'],'attributes':_0x1f241e[_0x802f('0x20')],'include':_0x1f241e[_0x802f('0x1e')]?_[_0x802f('0x1f')](_0x1f241e[_0x802f('0x1e')],function(_0x5ddb14){return{'model':db[_0x5ddb14[_0x802f('0x21')]],'as':_0x5ddb14['as'],'attributes':_0x5ddb14['attributes'],'include':_0x5ddb14[_0x802f('0x1e')]?_['map'](_0x5ddb14[_0x802f('0x1e')],function(_0x1ff75b){return{'model':db[_0x1ff75b[_0x802f('0x21')]],'as':_0x1ff75b['as'],'attributes':_0x1ff75b[_0x802f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x802f('0xf')](function(_0x29185f){logger[_0x802f('0x10')]('ShowServicenowAccount',_0x11638);logger['debug']('ShowServicenowAccount',_0x11638,JSON[_0x802f('0x14')](_0x29185f));_0xd63a06(_0x29185f);})[_0x802f('0x23')](function(_0x4957ed){logger['error'](_0x802f('0x26'),_0x4957ed[_0x802f('0x17')],_0x11638);_0x499d74(_0x1d2c81[_0x802f('0x15')](0x1f4,_0x4957ed[_0x802f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 1fe157e..283f9a3 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 _0xee30=['show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intServicenowConfiguration.controller','get','isAuthenticated','/:id'];(function(_0xf449c5,_0x4361ae){var _0x3a768a=function(_0x9c7c02){while(--_0x9c7c02){_0xf449c5['push'](_0xf449c5['shift']());}};_0x3a768a(++_0x4361ae);}(_0xee30,0xc7));var _0x0ee3=function(_0x30c9f9,_0xc0919e){_0x30c9f9=_0x30c9f9-0x0;var _0x1dfeba=_0xee30[_0x30c9f9];return _0x1dfeba;};'use strict';var multer=require('multer');var util=require(_0x0ee3('0x0'));var path=require(_0x0ee3('0x1'));var timeout=require(_0x0ee3('0x2'));var express=require(_0x0ee3('0x3'));var router=express['Router']();var fs_extra=require(_0x0ee3('0x4'));var auth=require(_0x0ee3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0ee3('0x6'));router[_0x0ee3('0x7')]('/',auth[_0x0ee3('0x8')](),controller['index']);router['get'](_0x0ee3('0x9'),auth['isAuthenticated'](),controller[_0x0ee3('0xa')]);router[_0x0ee3('0x7')](_0x0ee3('0xb'),auth[_0x0ee3('0x8')](),controller['getFields']);router[_0x0ee3('0x7')](_0x0ee3('0xc'),auth[_0x0ee3('0x8')](),controller[_0x0ee3('0xd')]);router[_0x0ee3('0x7')](_0x0ee3('0xe'),auth[_0x0ee3('0x8')](),controller[_0x0ee3('0xf')]);router['post']('/',auth[_0x0ee3('0x8')](),controller[_0x0ee3('0x10')]);router[_0x0ee3('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x0ee3('0x9'),auth[_0x0ee3('0x8')](),controller['destroy']);module[_0x0ee3('0x12')]=router; \ No newline at end of file +var _0xfa46=['show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index'];(function(_0x3edc22,_0x243990){var _0x1ddf50=function(_0x6e175f){while(--_0x6e175f){_0x3edc22['push'](_0x3edc22['shift']());}};_0x1ddf50(++_0x243990);}(_0xfa46,0x12a));var _0x6fa4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfa46[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x6fa4('0x0'));var util=require(_0x6fa4('0x1'));var path=require(_0x6fa4('0x2'));var timeout=require(_0x6fa4('0x3'));var express=require(_0x6fa4('0x4'));var router=express[_0x6fa4('0x5')]();var fs_extra=require(_0x6fa4('0x6'));var auth=require(_0x6fa4('0x7'));var interaction=require(_0x6fa4('0x8'));var config=require(_0x6fa4('0x9'));var controller=require(_0x6fa4('0xa'));router[_0x6fa4('0xb')]('/',auth[_0x6fa4('0xc')](),controller[_0x6fa4('0xd')]);router[_0x6fa4('0xb')]('/:id',auth[_0x6fa4('0xc')](),controller[_0x6fa4('0xe')]);router['get'](_0x6fa4('0xf'),auth[_0x6fa4('0xc')](),controller[_0x6fa4('0x10')]);router['get'](_0x6fa4('0x11'),auth[_0x6fa4('0xc')](),controller['getSubjects']);router[_0x6fa4('0xb')](_0x6fa4('0x12'),auth[_0x6fa4('0xc')](),controller[_0x6fa4('0x13')]);router[_0x6fa4('0x14')]('/',auth[_0x6fa4('0xc')](),controller[_0x6fa4('0x15')]);router['put'](_0x6fa4('0x16'),auth[_0x6fa4('0xc')](),controller['update']);router['delete'](_0x6fa4('0x16'),auth[_0x6fa4('0xc')](),controller['destroy']);module[_0x6fa4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 5cbb3ff..d535a61 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 _0x9a70=['STRING','sequelize'];(function(_0x55d3d9,_0x2a3c6b){var _0xba2db2=function(_0x2060eb){while(--_0x2060eb){_0x55d3d9['push'](_0x55d3d9['shift']());}};_0xba2db2(++_0x2a3c6b);}(_0x9a70,0x16b));var _0x09a7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a70[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x09a7('0x0'));module['exports']={'name':{'type':Sequelize[_0x09a7('0x1')]},'description':{'type':Sequelize[_0x09a7('0x1')]}}; \ No newline at end of file +var _0xf7e8=['STRING','sequelize','exports'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xf7e8,0x7c));var _0x8f7e=function(_0x5019d4,_0x31493b){_0x5019d4=_0x5019d4-0x0;var _0x59093a=_0xf7e8[_0x5019d4];return _0x59093a;};'use strict';var Sequelize=require(_0x8f7e('0x0'));module[_0x8f7e('0x1')]={'name':{'type':Sequelize[_0x8f7e('0x2')]},'description':{'type':Sequelize[_0x8f7e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a9ccee3..394fdd5 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 _0x1635=['merge','body','agent','interaction','account','ServicenowConfiguration','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','rows','params','length','includeAll','include','create','find','destroy','getFields','ServicenowField','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','stack','name','send','render'];(function(_0x1230c1,_0x17107d){var _0x3d5298=function(_0x4414d3){while(--_0x4414d3){_0x1230c1['push'](_0x1230c1['shift']());}};_0x3d5298(++_0x17107d);}(_0x1635,0x83));var _0x5163=function(_0xb4fe14,_0x10c445){_0xb4fe14=_0xb4fe14-0x0;var _0xb8ec67=_0x1635[_0xb4fe14];return _0xb8ec67;};'use strict';var emlformat=require(_0x5163('0x0'));var rimraf=require(_0x5163('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5163('0x2'));var rp=require('request-promise');var moment=require(_0x5163('0x3'));var BPromise=require(_0x5163('0x4'));var Mustache=require(_0x5163('0x5'));var util=require(_0x5163('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5163('0x7'));var ejs=require(_0x5163('0x8'));var fs=require('fs');var fs_extra=require(_0x5163('0x9'));var _=require(_0x5163('0xa'));var squel=require(_0x5163('0xb'));var crypto=require(_0x5163('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5163('0xd'));var toCsv=require(_0x5163('0x7'));var querystring=require(_0x5163('0xe'));var Papa=require(_0x5163('0xf'));var Redis=require(_0x5163('0x10'));var authService=require(_0x5163('0x11'));var qs=require(_0x5163('0x12'));var as=require(_0x5163('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5163('0x14'));var utils=require(_0x5163('0x15'));var config=require(_0x5163('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x5163('0x17'));var client=jayson['client'][_0x5163('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4485fd,_0x5d18dd,_0x48319f,_0x369c0c){return new BPromise(function(_0x2c9d73,_0x440caa){var _0x63117a=_0x369c0c||client;return _0x63117a[_0x5163('0x19')](_0x4485fd,_0x48319f)[_0x5163('0x1a')](function(_0x25899b){logger[_0x5163('0x1b')](_0x5163('0x1c'),_0x5d18dd,_0x5163('0x1d'));logger[_0x5163('0x1e')](_0x5163('0x1f'),_0x5d18dd,_0x5163('0x1d'),JSON[_0x5163('0x20')](_0x25899b));if(_0x25899b[_0x5163('0x21')]){if(_0x25899b[_0x5163('0x21')][_0x5163('0x22')]===0x1f4){logger[_0x5163('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5d18dd,_0x25899b[_0x5163('0x21')][_0x5163('0x23')]);return _0x440caa(_0x25899b[_0x5163('0x21')][_0x5163('0x23')]);}logger[_0x5163('0x21')](_0x5163('0x1c'),_0x5d18dd,_0x25899b[_0x5163('0x21')][_0x5163('0x23')]);return _0x2c9d73(_0x25899b[_0x5163('0x21')][_0x5163('0x23')]);}else{logger[_0x5163('0x1b')](_0x5163('0x1c'),_0x5d18dd,_0x5163('0x1d'));_0x2c9d73(_0x25899b[_0x5163('0x24')][_0x5163('0x23')]);}})[_0x5163('0x25')](function(_0x313382){logger[_0x5163('0x21')](_0x5163('0x1c'),_0x5d18dd,_0x313382);_0x440caa(_0x313382);});});}function respondWithStatusCode(_0x1a59f2,_0x45ddf6){_0x45ddf6=_0x45ddf6||0xcc;return function(_0x4bdfef){if(_0x4bdfef){return _0x1a59f2[_0x5163('0x26')](_0x45ddf6);}return _0x1a59f2[_0x5163('0x27')](_0x45ddf6)[_0x5163('0x28')]();};}function respondWithResult(_0x3fda99,_0x20ee15){_0x20ee15=_0x20ee15||0xc8;return function(_0xcd1b32){if(_0xcd1b32){return _0x3fda99[_0x5163('0x27')](_0x20ee15)[_0x5163('0x29')](_0xcd1b32);}};}function respondWithFilteredResult(_0x221e7b,_0x269701){return function(_0x3fafdb){if(_0x3fafdb){var _0x16185c=typeof _0x269701[_0x5163('0x2a')]==='undefined'&&typeof _0x269701[_0x5163('0x2b')]===_0x5163('0x2c');var _0x274fd0=_0x3fafdb[_0x5163('0x2d')];var _0x21c463=_0x16185c?0x0:_0x269701[_0x5163('0x2a')];var _0x26c0cc=_0x16185c?_0x3fafdb[_0x5163('0x2d')]:_0x269701[_0x5163('0x2a')]+_0x269701[_0x5163('0x2b')];var _0x291d87;if(_0x26c0cc>=_0x274fd0){_0x26c0cc=_0x274fd0;_0x291d87=0xc8;}else{_0x291d87=0xce;}_0x221e7b[_0x5163('0x27')](_0x291d87);return _0x221e7b['set'](_0x5163('0x2e'),_0x21c463+'-'+_0x26c0cc+'/'+_0x274fd0)[_0x5163('0x29')](_0x3fafdb);}return null;};}function patchUpdates(_0x5c1aef){return function(_0x58712b){try{jsonpatch[_0x5163('0x2f')](_0x58712b,_0x5c1aef,!![]);}catch(_0x26f4e8){return BPromise[_0x5163('0x30')](_0x26f4e8);}return _0x58712b[_0x5163('0x31')]();};}function saveUpdates(_0x2a53b2,_0x286f23){return function(_0x1912bd){if(_0x1912bd){return _0x1912bd[_0x5163('0x32')](_0x2a53b2)['then'](function(_0x5bc01e){return _0x5bc01e;});}return null;};}function removeEntity(_0x35cd45,_0x285463){return function(_0x5bb5c3){if(_0x5bb5c3){return _0x5bb5c3['destroy']()['then'](function(){_0x35cd45[_0x5163('0x27')](0xcc)[_0x5163('0x28')]();});}};}function handleEntityNotFound(_0x29c4f0,_0x210480){return function(_0x442f90){if(!_0x442f90){_0x29c4f0['sendStatus'](0x194);}return _0x442f90;};}function handleError(_0x17cca2,_0xeeba1c){_0xeeba1c=_0xeeba1c||0x1f4;return function(_0x5c51f0){logger[_0x5163('0x21')](_0x5c51f0[_0x5163('0x33')]);if(_0x5c51f0[_0x5163('0x34')]){delete _0x5c51f0[_0x5163('0x34')];}_0x17cca2[_0x5163('0x27')](_0xeeba1c)[_0x5163('0x35')](_0x5c51f0);};}function getMustacheRender(_0x4f8f38,_0x24c696){return Mustache[_0x5163('0x36')](_0x4f8f38,_[_0x5163('0x37')](_0x24c696[_0x5163('0x38')],{'contact':_0x24c696['contact'],'message':_0x24c696[_0x5163('0x23')],'agent':_0x24c696[_0x5163('0x39')],'interaction':_0x24c696[_0x5163('0x3a')],'account':_0x24c696[_0x5163('0x3b')]}))||'';}exports['index']=function(_0x4ee10b,_0x1efa88){var _0x211a9f={},_0x43685a={},_0x350afe={'count':0x0,'rows':[]};var _0x3b6c8b=_['map'](db[_0x5163('0x3c')][_0x5163('0x3d')],function(_0xc1ac71){return{'name':_0xc1ac71['fieldName'],'type':_0xc1ac71['type'][_0x5163('0x3e')]};});_0x43685a[_0x5163('0x3f')]=_[_0x5163('0x40')](_0x3b6c8b,'name');_0x43685a[_0x5163('0x41')]=_[_0x5163('0x42')](_0x4ee10b[_0x5163('0x41')]);_0x43685a['filters']=_[_0x5163('0x43')](_0x43685a['model'],_0x43685a[_0x5163('0x41')]);_0x211a9f[_0x5163('0x44')]=_[_0x5163('0x43')](_0x43685a['model'],qs[_0x5163('0x45')](_0x4ee10b[_0x5163('0x41')][_0x5163('0x45')]));_0x211a9f[_0x5163('0x44')]=_0x211a9f[_0x5163('0x44')]['length']?_0x211a9f[_0x5163('0x44')]:_0x43685a[_0x5163('0x3f')];if(!_0x4ee10b['query']['hasOwnProperty'](_0x5163('0x46'))){_0x211a9f['limit']=qs['limit'](_0x4ee10b['query'][_0x5163('0x2b')]);_0x211a9f[_0x5163('0x2a')]=qs[_0x5163('0x2a')](_0x4ee10b[_0x5163('0x41')][_0x5163('0x2a')]);}_0x211a9f[_0x5163('0x47')]=qs[_0x5163('0x48')](_0x4ee10b[_0x5163('0x41')]['sort']);_0x211a9f[_0x5163('0x49')]=qs[_0x5163('0x4a')](_[_0x5163('0x4b')](_0x4ee10b[_0x5163('0x41')],_0x43685a[_0x5163('0x4a')]),_0x3b6c8b);if(_0x4ee10b[_0x5163('0x41')][_0x5163('0x4c')]){_0x211a9f[_0x5163('0x49')]=_[_0x5163('0x37')](_0x211a9f['where'],{'$or':_[_0x5163('0x40')](_0x3b6c8b,function(_0x352594){if(_0x352594['type']!==_0x5163('0x4d')){var _0x40baa5={};_0x40baa5[_0x352594[_0x5163('0x34')]]={'$like':'%'+_0x4ee10b[_0x5163('0x41')][_0x5163('0x4c')]+'%'};return _0x40baa5;}})});}_0x211a9f=_[_0x5163('0x37')]({},_0x211a9f,_0x4ee10b[_0x5163('0x4e')]);var _0x2576db={'where':_0x211a9f[_0x5163('0x49')]};return db[_0x5163('0x3c')][_0x5163('0x2d')](_0x2576db)[_0x5163('0x1a')](function(_0x1fa56a){_0x350afe['count']=_0x1fa56a;if(_0x4ee10b[_0x5163('0x41')]['includeAll']){_0x211a9f['include']=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x211a9f);})[_0x5163('0x1a')](function(_0x450048){_0x350afe[_0x5163('0x4f')]=_0x450048;return _0x350afe;})['then'](respondWithFilteredResult(_0x1efa88,_0x211a9f))[_0x5163('0x25')](handleError(_0x1efa88,null));};exports['show']=function(_0x31cc0b,_0x89ab8a){var _0x26ac29={'raw':![],'where':{'id':_0x31cc0b[_0x5163('0x50')]['id']}},_0x57befc={};_0x57befc[_0x5163('0x3f')]=_['keys'](db[_0x5163('0x3c')][_0x5163('0x3d')]);_0x57befc[_0x5163('0x41')]=_['keys'](_0x31cc0b[_0x5163('0x41')]);_0x57befc[_0x5163('0x4a')]=_['intersection'](_0x57befc['model'],_0x57befc['query']);_0x26ac29[_0x5163('0x44')]=_[_0x5163('0x43')](_0x57befc['model'],qs[_0x5163('0x45')](_0x31cc0b[_0x5163('0x41')]['fields']));_0x26ac29[_0x5163('0x44')]=_0x26ac29['attributes'][_0x5163('0x51')]?_0x26ac29[_0x5163('0x44')]:_0x57befc[_0x5163('0x3f')];if(_0x31cc0b[_0x5163('0x41')][_0x5163('0x52')]){_0x26ac29[_0x5163('0x53')]=[{'all':!![]}];}_0x26ac29=_['merge']({},_0x26ac29,_0x31cc0b['options']);return db[_0x5163('0x3c')]['find'](_0x26ac29)['then'](handleEntityNotFound(_0x89ab8a,null))['then'](respondWithResult(_0x89ab8a,null))['catch'](handleError(_0x89ab8a,null));};exports[_0x5163('0x54')]=function(_0xebb594,_0x2c9286){return db[_0x5163('0x3c')][_0x5163('0x54')](_0xebb594[_0x5163('0x38')],{})[_0x5163('0x1a')](respondWithResult(_0x2c9286,0xc9))['catch'](handleError(_0x2c9286,null));};exports[_0x5163('0x32')]=function(_0x456bd4,_0x4b1eaf){if(_0x456bd4['body']['id']){delete _0x456bd4[_0x5163('0x38')]['id'];}return db[_0x5163('0x3c')][_0x5163('0x55')]({'where':{'id':_0x456bd4[_0x5163('0x50')]['id']}})['then'](handleEntityNotFound(_0x4b1eaf,null))[_0x5163('0x1a')](saveUpdates(_0x456bd4[_0x5163('0x38')],null))[_0x5163('0x1a')](respondWithResult(_0x4b1eaf,null))[_0x5163('0x25')](handleError(_0x4b1eaf,null));};exports[_0x5163('0x56')]=function(_0x204984,_0x258246){return db[_0x5163('0x3c')][_0x5163('0x55')]({'where':{'id':_0x204984[_0x5163('0x50')]['id']}})[_0x5163('0x1a')](handleEntityNotFound(_0x258246,null))[_0x5163('0x1a')](removeEntity(_0x258246,null))[_0x5163('0x25')](handleError(_0x258246,null));};exports[_0x5163('0x57')]=function(_0x5d8776,_0x1c9ef5,_0x47aac9){var _0x4d78e4={};var _0x423926={};var _0x1490d5;var _0x18e9e5;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x5d8776[_0x5163('0x50')]['id']}})['then'](handleEntityNotFound(_0x1c9ef5,null))['then'](function(_0x3e469b){if(_0x3e469b){_0x1490d5=_0x3e469b;_0x423926[_0x5163('0x3f')]=_['keys'](db[_0x5163('0x58')][_0x5163('0x3d')]);_0x423926[_0x5163('0x41')]=_[_0x5163('0x42')](_0x5d8776[_0x5163('0x41')]);_0x423926['filters']=_[_0x5163('0x43')](_0x423926[_0x5163('0x3f')],_0x423926[_0x5163('0x41')]);_0x4d78e4[_0x5163('0x44')]=_[_0x5163('0x43')](_0x423926[_0x5163('0x3f')],qs[_0x5163('0x45')](_0x5d8776['query'][_0x5163('0x45')]));_0x4d78e4[_0x5163('0x44')]=_0x4d78e4[_0x5163('0x44')][_0x5163('0x51')]?_0x4d78e4['attributes']:_0x423926[_0x5163('0x3f')];_0x4d78e4[_0x5163('0x47')]=qs[_0x5163('0x48')](_0x5d8776['query'][_0x5163('0x48')]);_0x4d78e4[_0x5163('0x49')]=qs[_0x5163('0x4a')](_[_0x5163('0x4b')](_0x5d8776[_0x5163('0x41')],_0x423926[_0x5163('0x4a')]));if(_0x5d8776[_0x5163('0x41')][_0x5163('0x4c')]){_0x4d78e4[_0x5163('0x49')]=_[_0x5163('0x37')](_0x4d78e4[_0x5163('0x49')],{'$or':_[_0x5163('0x40')](_0x4d78e4['attributes'],function(_0x4472e1){var _0x57e29e={};_0x57e29e[_0x4472e1]={'$like':'%'+_0x5d8776[_0x5163('0x41')][_0x5163('0x4c')]+'%'};return _0x57e29e;})});}_0x4d78e4=_[_0x5163('0x37')]({},_0x4d78e4,_0x5d8776[_0x5163('0x4e')]);return _0x1490d5['getFields'](_0x4d78e4);}})[_0x5163('0x1a')](function(_0x29b727){if(_0x29b727){_0x18e9e5=_0x29b727[_0x5163('0x51')];if(!_0x5d8776['query'][_0x5163('0x59')](_0x5163('0x46'))){_0x4d78e4[_0x5163('0x2b')]=qs['limit'](_0x5d8776[_0x5163('0x41')][_0x5163('0x2b')]);_0x4d78e4[_0x5163('0x2a')]=qs['offset'](_0x5d8776[_0x5163('0x41')][_0x5163('0x2a')]);}return _0x1490d5[_0x5163('0x57')](_0x4d78e4);}})['then'](function(_0xccbc3a){if(_0xccbc3a){return _0xccbc3a?{'count':_0x18e9e5,'rows':_0xccbc3a}:null;}})['then'](respondWithResult(_0x1c9ef5,null))[_0x5163('0x25')](handleError(_0x1c9ef5,null));};exports[_0x5163('0x5a')]=function(_0x3dc18f,_0x276d1c,_0x19f66f){var _0xf82f4={};var _0x4c7622={};var _0x359b9c;var _0x58fd75;return db[_0x5163('0x3c')][_0x5163('0x5b')]({'where':{'id':_0x3dc18f[_0x5163('0x50')]['id']}})[_0x5163('0x1a')](handleEntityNotFound(_0x276d1c,null))[_0x5163('0x1a')](function(_0x401bff){if(_0x401bff){_0x359b9c=_0x401bff;_0x4c7622[_0x5163('0x3f')]=_[_0x5163('0x42')](db[_0x5163('0x58')][_0x5163('0x3d')]);_0x4c7622[_0x5163('0x41')]=_['keys'](_0x3dc18f[_0x5163('0x41')]);_0x4c7622['filters']=_[_0x5163('0x43')](_0x4c7622[_0x5163('0x3f')],_0x4c7622['query']);_0xf82f4[_0x5163('0x44')]=_[_0x5163('0x43')](_0x4c7622[_0x5163('0x3f')],qs[_0x5163('0x45')](_0x3dc18f['query'][_0x5163('0x45')]));_0xf82f4[_0x5163('0x44')]=_0xf82f4[_0x5163('0x44')][_0x5163('0x51')]?_0xf82f4[_0x5163('0x44')]:_0x4c7622[_0x5163('0x3f')];_0xf82f4[_0x5163('0x47')]=qs[_0x5163('0x48')](_0x3dc18f[_0x5163('0x41')][_0x5163('0x48')]);_0xf82f4[_0x5163('0x49')]=qs[_0x5163('0x4a')](_[_0x5163('0x4b')](_0x3dc18f[_0x5163('0x41')],_0x4c7622[_0x5163('0x4a')]));if(_0x3dc18f[_0x5163('0x41')][_0x5163('0x4c')]){_0xf82f4['where']=_['merge'](_0xf82f4[_0x5163('0x49')],{'$or':_[_0x5163('0x40')](_0xf82f4[_0x5163('0x44')],function(_0x274729){var _0x35175b={};_0x35175b[_0x274729]={'$like':'%'+_0x3dc18f[_0x5163('0x41')][_0x5163('0x4c')]+'%'};return _0x35175b;})});}_0xf82f4=_[_0x5163('0x37')]({},_0xf82f4,_0x3dc18f['options']);return _0x359b9c['getSubjects'](_0xf82f4);}})['then'](function(_0x25c766){if(_0x25c766){_0x58fd75=_0x25c766[_0x5163('0x51')];if(!_0x3dc18f[_0x5163('0x41')][_0x5163('0x59')]('nolimit')){_0xf82f4['limit']=qs[_0x5163('0x2b')](_0x3dc18f[_0x5163('0x41')][_0x5163('0x2b')]);_0xf82f4['offset']=qs[_0x5163('0x2a')](_0x3dc18f[_0x5163('0x41')][_0x5163('0x2a')]);}return _0x359b9c[_0x5163('0x5a')](_0xf82f4);}})['then'](function(_0x1162f3){if(_0x1162f3){return _0x1162f3?{'count':_0x58fd75,'rows':_0x1162f3}:null;}})['then'](respondWithResult(_0x276d1c,null))[_0x5163('0x25')](handleError(_0x276d1c,null));};exports[_0x5163('0x5c')]=function(_0x28f46a,_0x228032,_0x3a73d7){var _0x416724={};var _0x155987={};var _0x24040f;var _0x452e23;return db[_0x5163('0x3c')][_0x5163('0x5b')]({'where':{'id':_0x28f46a[_0x5163('0x50')]['id']}})[_0x5163('0x1a')](handleEntityNotFound(_0x228032,null))['then'](function(_0x18619c){if(_0x18619c){_0x24040f=_0x18619c;_0x155987['model']=_[_0x5163('0x42')](db[_0x5163('0x58')][_0x5163('0x3d')]);_0x155987['query']=_[_0x5163('0x42')](_0x28f46a['query']);_0x155987[_0x5163('0x4a')]=_[_0x5163('0x43')](_0x155987['model'],_0x155987['query']);_0x416724[_0x5163('0x44')]=_[_0x5163('0x43')](_0x155987[_0x5163('0x3f')],qs[_0x5163('0x45')](_0x28f46a[_0x5163('0x41')][_0x5163('0x45')]));_0x416724['attributes']=_0x416724['attributes']['length']?_0x416724[_0x5163('0x44')]:_0x155987[_0x5163('0x3f')];_0x416724[_0x5163('0x47')]=qs['sort'](_0x28f46a[_0x5163('0x41')][_0x5163('0x48')]);_0x416724[_0x5163('0x49')]=qs[_0x5163('0x4a')](_['pick'](_0x28f46a[_0x5163('0x41')],_0x155987[_0x5163('0x4a')]));if(_0x28f46a['query'][_0x5163('0x4c')]){_0x416724['where']=_['merge'](_0x416724['where'],{'$or':_[_0x5163('0x40')](_0x416724['attributes'],function(_0x3a14fc){var _0x5aea34={};_0x5aea34[_0x3a14fc]={'$like':'%'+_0x28f46a[_0x5163('0x41')]['filter']+'%'};return _0x5aea34;})});}_0x416724=_[_0x5163('0x37')]({},_0x416724,_0x28f46a[_0x5163('0x4e')]);return _0x24040f['getDescriptions'](_0x416724);}})['then'](function(_0x32fccd){if(_0x32fccd){_0x452e23=_0x32fccd[_0x5163('0x51')];if(!_0x28f46a['query'][_0x5163('0x59')](_0x5163('0x46'))){_0x416724[_0x5163('0x2b')]=qs[_0x5163('0x2b')](_0x28f46a['query'][_0x5163('0x2b')]);_0x416724[_0x5163('0x2a')]=qs['offset'](_0x28f46a['query'][_0x5163('0x2a')]);}return _0x24040f[_0x5163('0x5c')](_0x416724);}})[_0x5163('0x1a')](function(_0x356a4b){if(_0x356a4b){return _0x356a4b?{'count':_0x452e23,'rows':_0x356a4b}:null;}})[_0x5163('0x1a')](respondWithResult(_0x228032,null))[_0x5163('0x25')](handleError(_0x228032,null));}; \ No newline at end of file +var _0x914f=['update','stack','name','send','render','merge','body','contact','agent','account','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','destroy','getFields','findOne','ServicenowField','sort','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','error','message','request\x20sent','catch','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','save'];(function(_0x59e4f5,_0x3fd4ab){var _0x4ced86=function(_0x445545){while(--_0x445545){_0x59e4f5['push'](_0x59e4f5['shift']());}};_0x4ced86(++_0x3fd4ab);}(_0x914f,0x158));var _0xf914=function(_0x21cb83,_0x139b38){_0x21cb83=_0x21cb83-0x0;var _0x1b8591=_0x914f[_0x21cb83];return _0x1b8591;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf914('0x0'));var zipdir=require(_0xf914('0x1'));var jsonpatch=require(_0xf914('0x2'));var rp=require(_0xf914('0x3'));var moment=require(_0xf914('0x4'));var BPromise=require(_0xf914('0x5'));var Mustache=require(_0xf914('0x6'));var util=require(_0xf914('0x7'));var path=require(_0xf914('0x8'));var sox=require(_0xf914('0x9'));var csv=require(_0xf914('0xa'));var ejs=require(_0xf914('0xb'));var fs=require('fs');var fs_extra=require(_0xf914('0xc'));var _=require(_0xf914('0xd'));var squel=require(_0xf914('0xe'));var crypto=require(_0xf914('0xf'));var jsforce=require(_0xf914('0x10'));var deskjs=require(_0xf914('0x11'));var toCsv=require(_0xf914('0xa'));var querystring=require(_0xf914('0x12'));var Papa=require(_0xf914('0x13'));var Redis=require(_0xf914('0x14'));var authService=require(_0xf914('0x15'));var qs=require(_0xf914('0x16'));var as=require(_0xf914('0x17'));var hardwareService=require(_0xf914('0x18'));var logger=require(_0xf914('0x19'))('api');var utils=require('../../config/utils');var config=require(_0xf914('0x1a'));var licenseUtil=require(_0xf914('0x1b'));var db=require(_0xf914('0x1c'))['db'];var jayson=require(_0xf914('0x1d'));var client=jayson[_0xf914('0x1e')][_0xf914('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3c19dd,_0x57d8e5,_0x4602ea,_0x33c594){return new BPromise(function(_0x18b8d4,_0x4b7ee1){var _0x3d259d=_0x33c594||client;return _0x3d259d[_0xf914('0x20')](_0x3c19dd,_0x4602ea)[_0xf914('0x21')](function(_0x50cdfd){logger[_0xf914('0x22')](_0xf914('0x23'),_0x57d8e5,'request\x20sent');logger[_0xf914('0x24')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x57d8e5,'request\x20sent',JSON['stringify'](_0x50cdfd));if(_0x50cdfd[_0xf914('0x25')]){if(_0x50cdfd[_0xf914('0x25')]['code']===0x1f4){logger[_0xf914('0x25')](_0xf914('0x23'),_0x57d8e5,_0x50cdfd['error'][_0xf914('0x26')]);return _0x4b7ee1(_0x50cdfd[_0xf914('0x25')][_0xf914('0x26')]);}logger[_0xf914('0x25')](_0xf914('0x23'),_0x57d8e5,_0x50cdfd['error']['message']);return _0x18b8d4(_0x50cdfd[_0xf914('0x25')][_0xf914('0x26')]);}else{logger[_0xf914('0x22')](_0xf914('0x23'),_0x57d8e5,_0xf914('0x27'));_0x18b8d4(_0x50cdfd['result'][_0xf914('0x26')]);}})[_0xf914('0x28')](function(_0x357030){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x57d8e5,_0x357030);_0x4b7ee1(_0x357030);});});}function respondWithStatusCode(_0x39d191,_0x36109b){_0x36109b=_0x36109b||0xcc;return function(_0x2e8aae){if(_0x2e8aae){return _0x39d191[_0xf914('0x29')](_0x36109b);}return _0x39d191[_0xf914('0x2a')](_0x36109b)[_0xf914('0x2b')]();};}function respondWithResult(_0x28279d,_0x5f4884){_0x5f4884=_0x5f4884||0xc8;return function(_0x306f4a){if(_0x306f4a){return _0x28279d[_0xf914('0x2a')](_0x5f4884)['json'](_0x306f4a);}};}function respondWithFilteredResult(_0x4c5b51,_0x48791a){return function(_0x43abb6){if(_0x43abb6){var _0x38c9ca=typeof _0x48791a[_0xf914('0x2c')]==='undefined'&&typeof _0x48791a[_0xf914('0x2d')]==='undefined';var _0x367e54=_0x43abb6[_0xf914('0x2e')];var _0x3d13bb=_0x38c9ca?0x0:_0x48791a['offset'];var _0x319674=_0x38c9ca?_0x43abb6[_0xf914('0x2e')]:_0x48791a[_0xf914('0x2c')]+_0x48791a[_0xf914('0x2d')];var _0x1d2c54;if(_0x319674>=_0x367e54){_0x319674=_0x367e54;_0x1d2c54=0xc8;}else{_0x1d2c54=0xce;}_0x4c5b51[_0xf914('0x2a')](_0x1d2c54);return _0x4c5b51[_0xf914('0x2f')](_0xf914('0x30'),_0x3d13bb+'-'+_0x319674+'/'+_0x367e54)[_0xf914('0x31')](_0x43abb6);}return null;};}function patchUpdates(_0x3c4ef1){return function(_0x5ef4cb){try{jsonpatch[_0xf914('0x32')](_0x5ef4cb,_0x3c4ef1,!![]);}catch(_0x3e1301){return BPromise['reject'](_0x3e1301);}return _0x5ef4cb[_0xf914('0x33')]();};}function saveUpdates(_0x562704,_0x1b7db6){return function(_0x3d02c9){if(_0x3d02c9){return _0x3d02c9[_0xf914('0x34')](_0x562704)[_0xf914('0x21')](function(_0x2b7e21){return _0x2b7e21;});}return null;};}function removeEntity(_0x4dffe1,_0x7dc873){return function(_0x2d7642){if(_0x2d7642){return _0x2d7642['destroy']()['then'](function(){_0x4dffe1[_0xf914('0x2a')](0xcc)[_0xf914('0x2b')]();});}};}function handleEntityNotFound(_0x112a8f,_0x14da87){return function(_0x189a7b){if(!_0x189a7b){_0x112a8f[_0xf914('0x29')](0x194);}return _0x189a7b;};}function handleError(_0x208e11,_0x302544){_0x302544=_0x302544||0x1f4;return function(_0x22cb02){logger[_0xf914('0x25')](_0x22cb02[_0xf914('0x35')]);if(_0x22cb02[_0xf914('0x36')]){delete _0x22cb02[_0xf914('0x36')];}_0x208e11[_0xf914('0x2a')](_0x302544)[_0xf914('0x37')](_0x22cb02);};}function getMustacheRender(_0x1b9aad,_0x39e25d){return Mustache[_0xf914('0x38')](_0x1b9aad,_[_0xf914('0x39')](_0x39e25d[_0xf914('0x3a')],{'contact':_0x39e25d[_0xf914('0x3b')],'message':_0x39e25d[_0xf914('0x26')],'agent':_0x39e25d[_0xf914('0x3c')],'interaction':_0x39e25d['interaction'],'account':_0x39e25d[_0xf914('0x3d')]}))||'';}exports[_0xf914('0x3e')]=function(_0x50cefe,_0x19a2db){var _0x5b081c={},_0x22227d={},_0x413422={'count':0x0,'rows':[]};var _0x34e9cc=_[_0xf914('0x3f')](db[_0xf914('0x40')][_0xf914('0x41')],function(_0x48db2d){return{'name':_0x48db2d[_0xf914('0x42')],'type':_0x48db2d[_0xf914('0x43')][_0xf914('0x44')]};});_0x22227d[_0xf914('0x45')]=_[_0xf914('0x3f')](_0x34e9cc,_0xf914('0x36'));_0x22227d[_0xf914('0x46')]=_[_0xf914('0x47')](_0x50cefe['query']);_0x22227d[_0xf914('0x48')]=_['intersection'](_0x22227d[_0xf914('0x45')],_0x22227d[_0xf914('0x46')]);_0x5b081c[_0xf914('0x49')]=_[_0xf914('0x4a')](_0x22227d['model'],qs[_0xf914('0x4b')](_0x50cefe[_0xf914('0x46')][_0xf914('0x4b')]));_0x5b081c['attributes']=_0x5b081c[_0xf914('0x49')][_0xf914('0x4c')]?_0x5b081c['attributes']:_0x22227d['model'];if(!_0x50cefe['query'][_0xf914('0x4d')](_0xf914('0x4e'))){_0x5b081c['limit']=qs['limit'](_0x50cefe[_0xf914('0x46')][_0xf914('0x2d')]);_0x5b081c[_0xf914('0x2c')]=qs[_0xf914('0x2c')](_0x50cefe[_0xf914('0x46')][_0xf914('0x2c')]);}_0x5b081c[_0xf914('0x4f')]=qs['sort'](_0x50cefe[_0xf914('0x46')]['sort']);_0x5b081c[_0xf914('0x50')]=qs[_0xf914('0x48')](_[_0xf914('0x51')](_0x50cefe['query'],_0x22227d[_0xf914('0x48')]),_0x34e9cc);if(_0x50cefe[_0xf914('0x46')][_0xf914('0x52')]){_0x5b081c[_0xf914('0x50')]=_['merge'](_0x5b081c[_0xf914('0x50')],{'$or':_[_0xf914('0x3f')](_0x34e9cc,function(_0x4105c8){if(_0x4105c8['type']!==_0xf914('0x53')){var _0x5e9794={};_0x5e9794[_0x4105c8['name']]={'$like':'%'+_0x50cefe['query'][_0xf914('0x52')]+'%'};return _0x5e9794;}})});}_0x5b081c=_[_0xf914('0x39')]({},_0x5b081c,_0x50cefe[_0xf914('0x54')]);var _0x4d6c93={'where':_0x5b081c[_0xf914('0x50')]};return db[_0xf914('0x40')]['count'](_0x4d6c93)[_0xf914('0x21')](function(_0x425307){_0x413422['count']=_0x425307;if(_0x50cefe[_0xf914('0x46')]['includeAll']){_0x5b081c[_0xf914('0x55')]=[{'all':!![]}];}return db[_0xf914('0x40')][_0xf914('0x56')](_0x5b081c);})[_0xf914('0x21')](function(_0x5e8452){_0x413422[_0xf914('0x57')]=_0x5e8452;return _0x413422;})[_0xf914('0x21')](respondWithFilteredResult(_0x19a2db,_0x5b081c))[_0xf914('0x28')](handleError(_0x19a2db,null));};exports['show']=function(_0x42fb23,_0x130433){var _0x2bb077={'raw':![],'where':{'id':_0x42fb23[_0xf914('0x58')]['id']}},_0x583c71={};_0x583c71[_0xf914('0x45')]=_[_0xf914('0x47')](db[_0xf914('0x40')][_0xf914('0x41')]);_0x583c71[_0xf914('0x46')]=_[_0xf914('0x47')](_0x42fb23[_0xf914('0x46')]);_0x583c71[_0xf914('0x48')]=_['intersection'](_0x583c71[_0xf914('0x45')],_0x583c71['query']);_0x2bb077[_0xf914('0x49')]=_[_0xf914('0x4a')](_0x583c71[_0xf914('0x45')],qs[_0xf914('0x4b')](_0x42fb23[_0xf914('0x46')][_0xf914('0x4b')]));_0x2bb077[_0xf914('0x49')]=_0x2bb077[_0xf914('0x49')][_0xf914('0x4c')]?_0x2bb077[_0xf914('0x49')]:_0x583c71['model'];if(_0x42fb23[_0xf914('0x46')][_0xf914('0x59')]){_0x2bb077[_0xf914('0x55')]=[{'all':!![]}];}_0x2bb077=_[_0xf914('0x39')]({},_0x2bb077,_0x42fb23[_0xf914('0x54')]);return db[_0xf914('0x40')][_0xf914('0x5a')](_0x2bb077)[_0xf914('0x21')](handleEntityNotFound(_0x130433,null))[_0xf914('0x21')](respondWithResult(_0x130433,null))[_0xf914('0x28')](handleError(_0x130433,null));};exports[_0xf914('0x5b')]=function(_0x47efe1,_0x4410bd){return db['ServicenowConfiguration']['create'](_0x47efe1[_0xf914('0x3a')],{})['then'](respondWithResult(_0x4410bd,0xc9))['catch'](handleError(_0x4410bd,null));};exports['update']=function(_0x2fa423,_0x323350){if(_0x2fa423['body']['id']){delete _0x2fa423[_0xf914('0x3a')]['id'];}return db[_0xf914('0x40')][_0xf914('0x5a')]({'where':{'id':_0x2fa423[_0xf914('0x58')]['id']}})[_0xf914('0x21')](handleEntityNotFound(_0x323350,null))['then'](saveUpdates(_0x2fa423['body'],null))[_0xf914('0x21')](respondWithResult(_0x323350,null))[_0xf914('0x28')](handleError(_0x323350,null));};exports[_0xf914('0x5c')]=function(_0x516a1e,_0x6eb43f){return db[_0xf914('0x40')][_0xf914('0x5a')]({'where':{'id':_0x516a1e['params']['id']}})['then'](handleEntityNotFound(_0x6eb43f,null))[_0xf914('0x21')](removeEntity(_0x6eb43f,null))['catch'](handleError(_0x6eb43f,null));};exports[_0xf914('0x5d')]=function(_0x45cd95,_0x4ade51,_0x46cf39){var _0x10fa69={};var _0x2abda2={};var _0x115b7f;var _0x17cb03;return db['ServicenowConfiguration'][_0xf914('0x5e')]({'where':{'id':_0x45cd95[_0xf914('0x58')]['id']}})[_0xf914('0x21')](handleEntityNotFound(_0x4ade51,null))[_0xf914('0x21')](function(_0xa852c6){if(_0xa852c6){_0x115b7f=_0xa852c6;_0x2abda2[_0xf914('0x45')]=_[_0xf914('0x47')](db[_0xf914('0x5f')][_0xf914('0x41')]);_0x2abda2[_0xf914('0x46')]=_[_0xf914('0x47')](_0x45cd95[_0xf914('0x46')]);_0x2abda2['filters']=_['intersection'](_0x2abda2[_0xf914('0x45')],_0x2abda2[_0xf914('0x46')]);_0x10fa69['attributes']=_[_0xf914('0x4a')](_0x2abda2[_0xf914('0x45')],qs['fields'](_0x45cd95[_0xf914('0x46')][_0xf914('0x4b')]));_0x10fa69[_0xf914('0x49')]=_0x10fa69[_0xf914('0x49')][_0xf914('0x4c')]?_0x10fa69[_0xf914('0x49')]:_0x2abda2[_0xf914('0x45')];_0x10fa69[_0xf914('0x4f')]=qs[_0xf914('0x60')](_0x45cd95['query'][_0xf914('0x60')]);_0x10fa69[_0xf914('0x50')]=qs['filters'](_[_0xf914('0x51')](_0x45cd95[_0xf914('0x46')],_0x2abda2[_0xf914('0x48')]));if(_0x45cd95[_0xf914('0x46')]['filter']){_0x10fa69['where']=_[_0xf914('0x39')](_0x10fa69[_0xf914('0x50')],{'$or':_['map'](_0x10fa69[_0xf914('0x49')],function(_0x2a02ac){var _0x4dd9dd={};_0x4dd9dd[_0x2a02ac]={'$like':'%'+_0x45cd95[_0xf914('0x46')]['filter']+'%'};return _0x4dd9dd;})});}_0x10fa69=_[_0xf914('0x39')]({},_0x10fa69,_0x45cd95[_0xf914('0x54')]);return _0x115b7f[_0xf914('0x5d')](_0x10fa69);}})['then'](function(_0x1efed9){if(_0x1efed9){_0x17cb03=_0x1efed9['length'];if(!_0x45cd95['query'][_0xf914('0x4d')](_0xf914('0x4e'))){_0x10fa69[_0xf914('0x2d')]=qs[_0xf914('0x2d')](_0x45cd95['query'][_0xf914('0x2d')]);_0x10fa69['offset']=qs[_0xf914('0x2c')](_0x45cd95[_0xf914('0x46')]['offset']);}return _0x115b7f[_0xf914('0x5d')](_0x10fa69);}})[_0xf914('0x21')](function(_0x4d35b8){if(_0x4d35b8){return _0x4d35b8?{'count':_0x17cb03,'rows':_0x4d35b8}:null;}})[_0xf914('0x21')](respondWithResult(_0x4ade51,null))[_0xf914('0x28')](handleError(_0x4ade51,null));};exports[_0xf914('0x61')]=function(_0x17e92a,_0x2c361e,_0x2e1917){var _0x25678d={};var _0x2c0b37={};var _0x557746;var _0x3fe148;return db[_0xf914('0x40')][_0xf914('0x5e')]({'where':{'id':_0x17e92a[_0xf914('0x58')]['id']}})[_0xf914('0x21')](handleEntityNotFound(_0x2c361e,null))[_0xf914('0x21')](function(_0x3170ba){if(_0x3170ba){_0x557746=_0x3170ba;_0x2c0b37['model']=_[_0xf914('0x47')](db['ServicenowField'][_0xf914('0x41')]);_0x2c0b37['query']=_[_0xf914('0x47')](_0x17e92a[_0xf914('0x46')]);_0x2c0b37['filters']=_[_0xf914('0x4a')](_0x2c0b37[_0xf914('0x45')],_0x2c0b37[_0xf914('0x46')]);_0x25678d[_0xf914('0x49')]=_[_0xf914('0x4a')](_0x2c0b37[_0xf914('0x45')],qs[_0xf914('0x4b')](_0x17e92a['query'][_0xf914('0x4b')]));_0x25678d[_0xf914('0x49')]=_0x25678d[_0xf914('0x49')]['length']?_0x25678d[_0xf914('0x49')]:_0x2c0b37[_0xf914('0x45')];_0x25678d[_0xf914('0x4f')]=qs[_0xf914('0x60')](_0x17e92a[_0xf914('0x46')][_0xf914('0x60')]);_0x25678d[_0xf914('0x50')]=qs[_0xf914('0x48')](_[_0xf914('0x51')](_0x17e92a[_0xf914('0x46')],_0x2c0b37['filters']));if(_0x17e92a[_0xf914('0x46')][_0xf914('0x52')]){_0x25678d[_0xf914('0x50')]=_[_0xf914('0x39')](_0x25678d['where'],{'$or':_[_0xf914('0x3f')](_0x25678d['attributes'],function(_0x5432e3){var _0x2ab753={};_0x2ab753[_0x5432e3]={'$like':'%'+_0x17e92a[_0xf914('0x46')]['filter']+'%'};return _0x2ab753;})});}_0x25678d=_['merge']({},_0x25678d,_0x17e92a[_0xf914('0x54')]);return _0x557746[_0xf914('0x61')](_0x25678d);}})[_0xf914('0x21')](function(_0x2f8f62){if(_0x2f8f62){_0x3fe148=_0x2f8f62['length'];if(!_0x17e92a[_0xf914('0x46')][_0xf914('0x4d')]('nolimit')){_0x25678d[_0xf914('0x2d')]=qs[_0xf914('0x2d')](_0x17e92a[_0xf914('0x46')][_0xf914('0x2d')]);_0x25678d[_0xf914('0x2c')]=qs[_0xf914('0x2c')](_0x17e92a[_0xf914('0x46')][_0xf914('0x2c')]);}return _0x557746[_0xf914('0x61')](_0x25678d);}})[_0xf914('0x21')](function(_0x1ef441){if(_0x1ef441){return _0x1ef441?{'count':_0x3fe148,'rows':_0x1ef441}:null;}})[_0xf914('0x21')](respondWithResult(_0x2c361e,null))[_0xf914('0x28')](handleError(_0x2c361e,null));};exports['getDescriptions']=function(_0x297726,_0x1d65e8,_0x37e1b7){var _0x11c644={};var _0x2d761c={};var _0x11dd53;var _0x51f0a6;return db[_0xf914('0x40')][_0xf914('0x5e')]({'where':{'id':_0x297726['params']['id']}})['then'](handleEntityNotFound(_0x1d65e8,null))['then'](function(_0x56352b){if(_0x56352b){_0x11dd53=_0x56352b;_0x2d761c[_0xf914('0x45')]=_['keys'](db[_0xf914('0x5f')][_0xf914('0x41')]);_0x2d761c[_0xf914('0x46')]=_['keys'](_0x297726[_0xf914('0x46')]);_0x2d761c[_0xf914('0x48')]=_[_0xf914('0x4a')](_0x2d761c[_0xf914('0x45')],_0x2d761c[_0xf914('0x46')]);_0x11c644[_0xf914('0x49')]=_[_0xf914('0x4a')](_0x2d761c[_0xf914('0x45')],qs[_0xf914('0x4b')](_0x297726[_0xf914('0x46')]['fields']));_0x11c644['attributes']=_0x11c644[_0xf914('0x49')][_0xf914('0x4c')]?_0x11c644[_0xf914('0x49')]:_0x2d761c[_0xf914('0x45')];_0x11c644[_0xf914('0x4f')]=qs['sort'](_0x297726[_0xf914('0x46')][_0xf914('0x60')]);_0x11c644[_0xf914('0x50')]=qs['filters'](_[_0xf914('0x51')](_0x297726[_0xf914('0x46')],_0x2d761c[_0xf914('0x48')]));if(_0x297726[_0xf914('0x46')][_0xf914('0x52')]){_0x11c644[_0xf914('0x50')]=_[_0xf914('0x39')](_0x11c644['where'],{'$or':_[_0xf914('0x3f')](_0x11c644['attributes'],function(_0x22c2c2){var _0x2507aa={};_0x2507aa[_0x22c2c2]={'$like':'%'+_0x297726[_0xf914('0x46')][_0xf914('0x52')]+'%'};return _0x2507aa;})});}_0x11c644=_[_0xf914('0x39')]({},_0x11c644,_0x297726[_0xf914('0x54')]);return _0x11dd53[_0xf914('0x62')](_0x11c644);}})[_0xf914('0x21')](function(_0x14ce5c){if(_0x14ce5c){_0x51f0a6=_0x14ce5c[_0xf914('0x4c')];if(!_0x297726[_0xf914('0x46')]['hasOwnProperty'](_0xf914('0x4e'))){_0x11c644[_0xf914('0x2d')]=qs['limit'](_0x297726['query'][_0xf914('0x2d')]);_0x11c644[_0xf914('0x2c')]=qs[_0xf914('0x2c')](_0x297726[_0xf914('0x46')][_0xf914('0x2c')]);}return _0x11dd53[_0xf914('0x62')](_0x11c644);}})['then'](function(_0x159712){if(_0x159712){return _0x159712?{'count':_0x51f0a6,'rows':_0x159712}:null;}})[_0xf914('0x21')](respondWithResult(_0x1d65e8,null))[_0xf914('0x28')](handleError(_0x1d65e8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e7f59ef..c1813db 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 _0xd03b=['ServicenowConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x1df1a1,_0x378fe0){var _0x4b0ab7=function(_0xac0e46){while(--_0xac0e46){_0x1df1a1['push'](_0x1df1a1['shift']());}};_0x4b0ab7(++_0x378fe0);}(_0xd03b,0x97));var _0xbd03=function(_0x2fe61d,_0x3da57d){_0x2fe61d=_0x2fe61d-0x0;var _0x3c9b5c=_0xd03b[_0x2fe61d];return _0x3c9b5c;};'use strict';var _=require('lodash');var util=require(_0xbd03('0x0'));var logger=require(_0xbd03('0x1'))(_0xbd03('0x2'));var moment=require(_0xbd03('0x3'));var BPromise=require(_0xbd03('0x4'));var rp=require(_0xbd03('0x5'));var fs=require('fs');var path=require(_0xbd03('0x6'));var rimraf=require('rimraf');var config=require(_0xbd03('0x7'));var attributes=require(_0xbd03('0x8'));module['exports']=function(_0x5688b2,_0x12dcf7){return _0x5688b2['define'](_0xbd03('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b19=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api'];(function(_0x1eb450,_0x2a3376){var _0x333a71=function(_0x5b3e83){while(--_0x5b3e83){_0x1eb450['push'](_0x1eb450['shift']());}};_0x333a71(++_0x2a3376);}(_0x7b19,0x1b7));var _0x97b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x97b1('0x0'));var logger=require(_0x97b1('0x1'))(_0x97b1('0x2'));var moment=require('moment');var BPromise=require(_0x97b1('0x3'));var rp=require(_0x97b1('0x4'));var fs=require('fs');var path=require(_0x97b1('0x5'));var rimraf=require(_0x97b1('0x6'));var config=require(_0x97b1('0x7'));var attributes=require(_0x97b1('0x8'));module[_0x97b1('0x9')]=function(_0x1a6672,_0x4b675e){return _0x1a6672[_0x97b1('0xa')](_0x97b1('0xb'),attributes,{'tableName':_0x97b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index e4094a2..1c2ccac 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 _0x9d20=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x460165,_0x2507d0){var _0x43c247=function(_0x2d79a3){while(--_0x2d79a3){_0x460165['push'](_0x460165['shift']());}};_0x43c247(++_0x2507d0);}(_0x9d20,0xe3));var _0x09d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d20[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x09d2('0x0'));var util=require(_0x09d2('0x1'));var moment=require(_0x09d2('0x2'));var BPromise=require(_0x09d2('0x3'));var rs=require(_0x09d2('0x4'));var fs=require('fs');var Redis=require(_0x09d2('0x5'));var db=require(_0x09d2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x09d2('0x7'))(_0x09d2('0x8'));var config=require(_0x09d2('0x9'));var jayson=require(_0x09d2('0xa'));var client=jayson[_0x09d2('0xb')][_0x09d2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2680b3,_0x1f7cf3,_0x2e145a){return new BPromise(function(_0x1abdd7,_0x4694de){return client[_0x09d2('0xd')](_0x2680b3,_0x2e145a)['then'](function(_0x17dfc7){logger['info'](_0x09d2('0xe'),_0x1f7cf3,_0x09d2('0xf'));logger[_0x09d2('0x10')](_0x09d2('0x11'),_0x1f7cf3,_0x09d2('0xf'),JSON[_0x09d2('0x12')](_0x17dfc7));if(_0x17dfc7[_0x09d2('0x13')]){if(_0x17dfc7[_0x09d2('0x13')][_0x09d2('0x14')]===0x1f4){logger[_0x09d2('0x13')](_0x09d2('0xe'),_0x1f7cf3,_0x17dfc7['error']['message']);return _0x4694de(_0x17dfc7[_0x09d2('0x13')][_0x09d2('0x15')]);}logger[_0x09d2('0x13')](_0x09d2('0xe'),_0x1f7cf3,_0x17dfc7[_0x09d2('0x13')][_0x09d2('0x15')]);return _0x1abdd7(_0x17dfc7['error'][_0x09d2('0x15')]);}else{logger[_0x09d2('0x16')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1f7cf3,_0x09d2('0xf'));_0x1abdd7(_0x17dfc7[_0x09d2('0x17')][_0x09d2('0x15')]);}})[_0x09d2('0x18')](function(_0x3464a8){logger[_0x09d2('0x13')](_0x09d2('0xe'),_0x1f7cf3,_0x3464a8);_0x4694de(_0x3464a8);});});} \ No newline at end of file +var _0x2a8c=['code','message','info','catch','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x187b1c,_0x290cef){var _0x3b99ad=function(_0xc1b799){while(--_0xc1b799){_0x187b1c['push'](_0x187b1c['shift']());}};_0x3b99ad(++_0x290cef);}(_0x2a8c,0xdc));var _0xc2a8=function(_0x32a523,_0x1563b6){_0x32a523=_0x32a523-0x0;var _0x4a55bc=_0x2a8c[_0x32a523];return _0x4a55bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc2a8('0x0'));var BPromise=require('bluebird');var rs=require(_0xc2a8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc2a8('0x2'));var logger=require(_0xc2a8('0x3'))(_0xc2a8('0x4'));var config=require('../../config/environment');var jayson=require(_0xc2a8('0x5'));var client=jayson[_0xc2a8('0x6')][_0xc2a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xdecfc,_0xd4f467,_0x18d78d){return new BPromise(function(_0x455276,_0x54981d){return client[_0xc2a8('0x8')](_0xdecfc,_0x18d78d)[_0xc2a8('0x9')](function(_0x3ac8b7){logger['info'](_0xc2a8('0xa'),_0xd4f467,_0xc2a8('0xb'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0xd4f467,_0xc2a8('0xb'),JSON[_0xc2a8('0xc')](_0x3ac8b7));if(_0x3ac8b7[_0xc2a8('0xd')]){if(_0x3ac8b7['error'][_0xc2a8('0xe')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0xd4f467,_0x3ac8b7[_0xc2a8('0xd')][_0xc2a8('0xf')]);return _0x54981d(_0x3ac8b7[_0xc2a8('0xd')]['message']);}logger[_0xc2a8('0xd')](_0xc2a8('0xa'),_0xd4f467,_0x3ac8b7[_0xc2a8('0xd')]['message']);return _0x455276(_0x3ac8b7[_0xc2a8('0xd')][_0xc2a8('0xf')]);}else{logger[_0xc2a8('0x10')](_0xc2a8('0xa'),_0xd4f467,_0xc2a8('0xb'));_0x455276(_0x3ac8b7['result']['message']);}})[_0xc2a8('0x11')](function(_0x1787c){logger[_0xc2a8('0xd')](_0xc2a8('0xa'),_0xd4f467,_0x1787c);_0x54981d(_0x1787c);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 1d0d5db..283ebbd 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 _0xb4b8=['../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','put','update','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3002fa,_0x1aa9dc){var _0x2555dd=function(_0x5c3323){while(--_0x5c3323){_0x3002fa['push'](_0x3002fa['shift']());}};_0x2555dd(++_0x1aa9dc);}(_0xb4b8,0x73));var _0x8b4b=function(_0x294df7,_0x1e419f){_0x294df7=_0x294df7-0x0;var _0x4fa3c9=_0xb4b8[_0x294df7];return _0x4fa3c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8b4b('0x0'));var timeout=require(_0x8b4b('0x1'));var express=require(_0x8b4b('0x2'));var router=express['Router']();var fs_extra=require(_0x8b4b('0x3'));var auth=require(_0x8b4b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8b4b('0x5'));var controller=require(_0x8b4b('0x6'));router[_0x8b4b('0x7')]('/',auth[_0x8b4b('0x8')](),controller['index']);router['get'](_0x8b4b('0x9'),auth[_0x8b4b('0x8')](),controller[_0x8b4b('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8b4b('0xb')](_0x8b4b('0x9'),auth[_0x8b4b('0x8')](),controller[_0x8b4b('0xc')]);router['delete'](_0x8b4b('0x9'),auth[_0x8b4b('0x8')](),controller[_0x8b4b('0xd')]);module[_0x8b4b('0xe')]=router; \ No newline at end of file +var _0x1bf0=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','show','post','create','put','/:id','isAuthenticated','delete','destroy','exports','multer'];(function(_0x20f256,_0x2f58ec){var _0x5ced25=function(_0x15a4c4){while(--_0x15a4c4){_0x20f256['push'](_0x20f256['shift']());}};_0x5ced25(++_0x2f58ec);}(_0x1bf0,0x142));var _0x01bf=function(_0x232593,_0x12a00a){_0x232593=_0x232593-0x0;var _0x3e3662=_0x1bf0[_0x232593];return _0x3e3662;};'use strict';var multer=require(_0x01bf('0x0'));var util=require(_0x01bf('0x1'));var path=require('path');var timeout=require(_0x01bf('0x2'));var express=require(_0x01bf('0x3'));var router=express['Router']();var fs_extra=require(_0x01bf('0x4'));var auth=require(_0x01bf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x01bf('0x6'));var controller=require(_0x01bf('0x7'));router[_0x01bf('0x8')]('/',auth['isAuthenticated'](),controller[_0x01bf('0x9')]);router[_0x01bf('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x01bf('0xa')]);router[_0x01bf('0xb')]('/',auth['isAuthenticated'](),controller[_0x01bf('0xc')]);router[_0x01bf('0xd')](_0x01bf('0xe'),auth[_0x01bf('0xf')](),controller['update']);router[_0x01bf('0x10')](_0x01bf('0xe'),auth[_0x01bf('0xf')](),controller[_0x01bf('0x11')]);module[_0x01bf('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1b90ebb..f09f8c5 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 _0x3baf=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0xf06ef6,_0x508117){var _0x23d149=function(_0x4f5cc6){while(--_0x4f5cc6){_0xf06ef6['push'](_0xf06ef6['shift']());}};_0x23d149(++_0x508117);}(_0x3baf,0xf7));var _0xf3ba=function(_0x22ba1e,_0x4b25fd){_0x22ba1e=_0x22ba1e-0x0;var _0x3b42e4=_0x3baf[_0x22ba1e];return _0x3b42e4;};'use strict';var Sequelize=require(_0xf3ba('0x0'));module[_0xf3ba('0x1')]={'type':{'type':Sequelize[_0xf3ba('0x2')](_0xf3ba('0x3'),_0xf3ba('0x4'),_0xf3ba('0x5'),_0xf3ba('0x6'),_0xf3ba('0x7')),'defaultValue':_0xf3ba('0x3')},'content':{'type':Sequelize[_0xf3ba('0x8')]},'key':{'type':Sequelize[_0xf3ba('0x8')]},'keyType':{'type':Sequelize[_0xf3ba('0x2')](_0xf3ba('0x3'),_0xf3ba('0x4'),_0xf3ba('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf3ba('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5d58=['variable','customVariable','keyValue','string','STRING','ENUM'];(function(_0x1780e6,_0x4da461){var _0x5dadb1=function(_0x19c427){while(--_0x19c427){_0x1780e6['push'](_0x1780e6['shift']());}};_0x5dadb1(++_0x4da461);}(_0x5d58,0x187));var _0x85d5=function(_0x7146f7,_0x917142){_0x7146f7=_0x7146f7-0x0;var _0x4eae2f=_0x5d58[_0x7146f7];return _0x4eae2f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x85d5('0x0'),_0x85d5('0x1'),'picklist'),'defaultValue':_0x85d5('0x2')},'content':{'type':Sequelize[_0x85d5('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x85d5('0x4')](_0x85d5('0x2'),_0x85d5('0x5'),_0x85d5('0x0'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x85d5('0x3')]},'nameField':{'type':Sequelize[_0x85d5('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x85d5('0x3')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 25b3ad0..c884f71 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 _0x897d=['message','agent','interaction','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','find','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','render','merge','body','contact'];(function(_0x190acf,_0x4f2470){var _0x667ab9=function(_0x299e84){while(--_0x299e84){_0x190acf['push'](_0x190acf['shift']());}};_0x667ab9(++_0x4f2470);}(_0x897d,0x16a));var _0xd897=function(_0x35992d,_0x189c7f){_0x35992d=_0x35992d-0x0;var _0x797aef=_0x897d[_0x35992d];return _0x797aef;};'use strict';var emlformat=require(_0xd897('0x0'));var rimraf=require(_0xd897('0x1'));var zipdir=require(_0xd897('0x2'));var jsonpatch=require(_0xd897('0x3'));var rp=require('request-promise');var moment=require(_0xd897('0x4'));var BPromise=require(_0xd897('0x5'));var Mustache=require('mustache');var util=require(_0xd897('0x6'));var path=require(_0xd897('0x7'));var sox=require(_0xd897('0x8'));var csv=require('to-csv');var ejs=require(_0xd897('0x9'));var fs=require('fs');var fs_extra=require(_0xd897('0xa'));var _=require(_0xd897('0xb'));var squel=require(_0xd897('0xc'));var crypto=require('crypto');var jsforce=require(_0xd897('0xd'));var deskjs=require(_0xd897('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd897('0xf'));var Redis=require(_0xd897('0x10'));var authService=require(_0xd897('0x11'));var qs=require(_0xd897('0x12'));var as=require(_0xd897('0x13'));var hardwareService=require(_0xd897('0x14'));var logger=require(_0xd897('0x15'))(_0xd897('0x16'));var utils=require(_0xd897('0x17'));var config=require(_0xd897('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd897('0x19'))['db'];function respondWithStatusCode(_0x5069d9,_0x210933){_0x210933=_0x210933||0xcc;return function(_0x50b69f){if(_0x50b69f){return _0x5069d9[_0xd897('0x1a')](_0x210933);}return _0x5069d9[_0xd897('0x1b')](_0x210933)[_0xd897('0x1c')]();};}function respondWithResult(_0x4cfa11,_0x1bc459){_0x1bc459=_0x1bc459||0xc8;return function(_0x415dd2){if(_0x415dd2){return _0x4cfa11[_0xd897('0x1b')](_0x1bc459)[_0xd897('0x1d')](_0x415dd2);}};}function respondWithFilteredResult(_0x504cd9,_0x280131){return function(_0x225d83){if(_0x225d83){var _0x313505=typeof _0x280131[_0xd897('0x1e')]===_0xd897('0x1f')&&typeof _0x280131[_0xd897('0x20')]===_0xd897('0x1f');var _0x4eb1db=_0x225d83[_0xd897('0x21')];var _0x27d2e4=_0x313505?0x0:_0x280131['offset'];var _0x19c4ba=_0x313505?_0x225d83[_0xd897('0x21')]:_0x280131[_0xd897('0x1e')]+_0x280131[_0xd897('0x20')];var _0x4fe79e;if(_0x19c4ba>=_0x4eb1db){_0x19c4ba=_0x4eb1db;_0x4fe79e=0xc8;}else{_0x4fe79e=0xce;}_0x504cd9[_0xd897('0x1b')](_0x4fe79e);return _0x504cd9[_0xd897('0x22')](_0xd897('0x23'),_0x27d2e4+'-'+_0x19c4ba+'/'+_0x4eb1db)[_0xd897('0x1d')](_0x225d83);}return null;};}function patchUpdates(_0x115ae2){return function(_0xe3a5c5){try{jsonpatch[_0xd897('0x24')](_0xe3a5c5,_0x115ae2,!![]);}catch(_0x135083){return BPromise[_0xd897('0x25')](_0x135083);}return _0xe3a5c5['save']();};}function saveUpdates(_0x3c7e94,_0x366791){return function(_0x110e52){if(_0x110e52){return _0x110e52['update'](_0x3c7e94)[_0xd897('0x26')](function(_0x35d1f2){return _0x35d1f2;});}return null;};}function removeEntity(_0x5869ac,_0x1aded1){return function(_0x3b8a38){if(_0x3b8a38){return _0x3b8a38[_0xd897('0x27')]()[_0xd897('0x26')](function(){_0x5869ac[_0xd897('0x1b')](0xcc)[_0xd897('0x1c')]();});}};}function handleEntityNotFound(_0x5ab53c,_0x2bb0e9){return function(_0x2059d8){if(!_0x2059d8){_0x5ab53c[_0xd897('0x1a')](0x194);}return _0x2059d8;};}function handleError(_0x509310,_0x5bedd2){_0x5bedd2=_0x5bedd2||0x1f4;return function(_0x480860){logger[_0xd897('0x28')](_0x480860[_0xd897('0x29')]);if(_0x480860[_0xd897('0x2a')]){delete _0x480860[_0xd897('0x2a')];}_0x509310[_0xd897('0x1b')](_0x5bedd2)[_0xd897('0x2b')](_0x480860);};}function getMustacheRender(_0x510406,_0xe4b34b){return Mustache[_0xd897('0x2c')](_0x510406,_[_0xd897('0x2d')](_0xe4b34b[_0xd897('0x2e')],{'contact':_0xe4b34b[_0xd897('0x2f')],'message':_0xe4b34b[_0xd897('0x30')],'agent':_0xe4b34b[_0xd897('0x31')],'interaction':_0xe4b34b[_0xd897('0x32')],'account':_0xe4b34b['account']}))||'';}exports[_0xd897('0x33')]=function(_0x5ae04c,_0x466f1d){var _0x3ed0e3={},_0x346aa5={},_0x4d927b={'count':0x0,'rows':[]};var _0x203810=_[_0xd897('0x34')](db[_0xd897('0x35')][_0xd897('0x36')],function(_0x1bda80){return{'name':_0x1bda80[_0xd897('0x37')],'type':_0x1bda80[_0xd897('0x38')][_0xd897('0x39')]};});_0x346aa5[_0xd897('0x3a')]=_['map'](_0x203810,_0xd897('0x2a'));_0x346aa5[_0xd897('0x3b')]=_[_0xd897('0x3c')](_0x5ae04c[_0xd897('0x3b')]);_0x346aa5[_0xd897('0x3d')]=_['intersection'](_0x346aa5[_0xd897('0x3a')],_0x346aa5['query']);_0x3ed0e3[_0xd897('0x3e')]=_[_0xd897('0x3f')](_0x346aa5[_0xd897('0x3a')],qs[_0xd897('0x40')](_0x5ae04c[_0xd897('0x3b')][_0xd897('0x40')]));_0x3ed0e3[_0xd897('0x3e')]=_0x3ed0e3[_0xd897('0x3e')][_0xd897('0x41')]?_0x3ed0e3[_0xd897('0x3e')]:_0x346aa5[_0xd897('0x3a')];if(!_0x5ae04c[_0xd897('0x3b')][_0xd897('0x42')](_0xd897('0x43'))){_0x3ed0e3[_0xd897('0x20')]=qs['limit'](_0x5ae04c['query'][_0xd897('0x20')]);_0x3ed0e3[_0xd897('0x1e')]=qs[_0xd897('0x1e')](_0x5ae04c[_0xd897('0x3b')]['offset']);}_0x3ed0e3[_0xd897('0x44')]=qs['sort'](_0x5ae04c['query'][_0xd897('0x45')]);_0x3ed0e3[_0xd897('0x46')]=qs['filters'](_[_0xd897('0x47')](_0x5ae04c[_0xd897('0x3b')],_0x346aa5[_0xd897('0x3d')]),_0x203810);if(_0x5ae04c[_0xd897('0x3b')][_0xd897('0x48')]){_0x3ed0e3[_0xd897('0x46')]=_[_0xd897('0x2d')](_0x3ed0e3[_0xd897('0x46')],{'$or':_[_0xd897('0x34')](_0x203810,function(_0x28ebca){if(_0x28ebca[_0xd897('0x38')]!==_0xd897('0x49')){var _0x347ca5={};_0x347ca5[_0x28ebca[_0xd897('0x2a')]]={'$like':'%'+_0x5ae04c[_0xd897('0x3b')][_0xd897('0x48')]+'%'};return _0x347ca5;}})});}_0x3ed0e3=_[_0xd897('0x2d')]({},_0x3ed0e3,_0x5ae04c[_0xd897('0x4a')]);var _0x4e0359={'where':_0x3ed0e3[_0xd897('0x46')]};return db['ServicenowField'][_0xd897('0x21')](_0x4e0359)[_0xd897('0x26')](function(_0x275474){_0x4d927b['count']=_0x275474;if(_0x5ae04c[_0xd897('0x3b')][_0xd897('0x4b')]){_0x3ed0e3[_0xd897('0x4c')]=[{'all':!![]}];}return db[_0xd897('0x35')][_0xd897('0x4d')](_0x3ed0e3);})['then'](function(_0x30bf4c){_0x4d927b['rows']=_0x30bf4c;return _0x4d927b;})[_0xd897('0x26')](respondWithFilteredResult(_0x466f1d,_0x3ed0e3))[_0xd897('0x4e')](handleError(_0x466f1d,null));};exports['show']=function(_0x1dd550,_0x403314){var _0x419711={'raw':!![],'where':{'id':_0x1dd550['params']['id']}},_0x3e7248={};_0x3e7248['model']=_[_0xd897('0x3c')](db[_0xd897('0x35')][_0xd897('0x36')]);_0x3e7248[_0xd897('0x3b')]=_['keys'](_0x1dd550[_0xd897('0x3b')]);_0x3e7248[_0xd897('0x3d')]=_[_0xd897('0x3f')](_0x3e7248['model'],_0x3e7248[_0xd897('0x3b')]);_0x419711[_0xd897('0x3e')]=_[_0xd897('0x3f')](_0x3e7248[_0xd897('0x3a')],qs[_0xd897('0x40')](_0x1dd550[_0xd897('0x3b')][_0xd897('0x40')]));_0x419711[_0xd897('0x3e')]=_0x419711[_0xd897('0x3e')][_0xd897('0x41')]?_0x419711[_0xd897('0x3e')]:_0x3e7248[_0xd897('0x3a')];if(_0x1dd550[_0xd897('0x3b')][_0xd897('0x4b')]){_0x419711[_0xd897('0x4c')]=[{'all':!![]}];}_0x419711=_[_0xd897('0x2d')]({},_0x419711,_0x1dd550[_0xd897('0x4a')]);return db['ServicenowField'][_0xd897('0x4f')](_0x419711)[_0xd897('0x26')](handleEntityNotFound(_0x403314,null))['then'](respondWithResult(_0x403314,null))[_0xd897('0x4e')](handleError(_0x403314,null));};exports['create']=function(_0x113903,_0x549902){return db['ServicenowField']['create'](_0x113903[_0xd897('0x2e')],{})[_0xd897('0x26')](respondWithResult(_0x549902,0xc9))[_0xd897('0x4e')](handleError(_0x549902,null));};exports[_0xd897('0x50')]=function(_0x4cfb99,_0x3ba6aa){if(_0x4cfb99[_0xd897('0x2e')]['id']){delete _0x4cfb99['body']['id'];}return db[_0xd897('0x35')]['find']({'where':{'id':_0x4cfb99[_0xd897('0x51')]['id']}})['then'](handleEntityNotFound(_0x3ba6aa,null))[_0xd897('0x26')](saveUpdates(_0x4cfb99[_0xd897('0x2e')],null))['then'](respondWithResult(_0x3ba6aa,null))[_0xd897('0x4e')](handleError(_0x3ba6aa,null));};exports[_0xd897('0x27')]=function(_0x26c701,_0x32263f){return db[_0xd897('0x35')]['find']({'where':{'id':_0x26c701[_0xd897('0x51')]['id']}})[_0xd897('0x26')](handleEntityNotFound(_0x32263f,null))[_0xd897('0x26')](removeEntity(_0x32263f,null))[_0xd897('0x4e')](handleError(_0x32263f,null));}; \ No newline at end of file +var _0x5353=['then','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','../../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','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','name','render','merge','body','contact','message','agent','interaction','account','index','map','ServicenowField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options'];(function(_0x4edd60,_0x48e214){var _0x570167=function(_0x1a24b0){while(--_0x1a24b0){_0x4edd60['push'](_0x4edd60['shift']());}};_0x570167(++_0x48e214);}(_0x5353,0xaa));var _0x3535=function(_0x570542,_0x176e38){_0x570542=_0x570542-0x0;var _0x5343f2=_0x5353[_0x570542];return _0x5343f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3535('0x0'));var zipdir=require(_0x3535('0x1'));var jsonpatch=require(_0x3535('0x2'));var rp=require(_0x3535('0x3'));var moment=require('moment');var BPromise=require(_0x3535('0x4'));var Mustache=require('mustache');var util=require(_0x3535('0x5'));var path=require(_0x3535('0x6'));var sox=require(_0x3535('0x7'));var csv=require(_0x3535('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3535('0x9'));var _=require('lodash');var squel=require(_0x3535('0xa'));var crypto=require(_0x3535('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3535('0xc'));var toCsv=require(_0x3535('0x8'));var querystring=require('querystring');var Papa=require(_0x3535('0xd'));var Redis=require('ioredis');var authService=require(_0x3535('0xe'));var qs=require(_0x3535('0xf'));var as=require(_0x3535('0x10'));var hardwareService=require(_0x3535('0x11'));var logger=require(_0x3535('0x12'))('api');var utils=require(_0x3535('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3535('0x14'));var db=require(_0x3535('0x15'))['db'];function respondWithStatusCode(_0x24aeee,_0x524f56){_0x524f56=_0x524f56||0xcc;return function(_0x4399f4){if(_0x4399f4){return _0x24aeee[_0x3535('0x16')](_0x524f56);}return _0x24aeee[_0x3535('0x17')](_0x524f56)[_0x3535('0x18')]();};}function respondWithResult(_0x5c2ed5,_0x34f5e1){_0x34f5e1=_0x34f5e1||0xc8;return function(_0x2aa9ad){if(_0x2aa9ad){return _0x5c2ed5[_0x3535('0x17')](_0x34f5e1)[_0x3535('0x19')](_0x2aa9ad);}};}function respondWithFilteredResult(_0x12b305,_0x2684be){return function(_0x21c79b){if(_0x21c79b){var _0x38f7d1=typeof _0x2684be[_0x3535('0x1a')]==='undefined'&&typeof _0x2684be[_0x3535('0x1b')]===_0x3535('0x1c');var _0x1cc5cd=_0x21c79b['count'];var _0x48a1a7=_0x38f7d1?0x0:_0x2684be[_0x3535('0x1a')];var _0x4c0d4d=_0x38f7d1?_0x21c79b[_0x3535('0x1d')]:_0x2684be[_0x3535('0x1a')]+_0x2684be['limit'];var _0x3b0506;if(_0x4c0d4d>=_0x1cc5cd){_0x4c0d4d=_0x1cc5cd;_0x3b0506=0xc8;}else{_0x3b0506=0xce;}_0x12b305[_0x3535('0x17')](_0x3b0506);return _0x12b305[_0x3535('0x1e')](_0x3535('0x1f'),_0x48a1a7+'-'+_0x4c0d4d+'/'+_0x1cc5cd)['json'](_0x21c79b);}return null;};}function patchUpdates(_0x12bce8){return function(_0x543ea2){try{jsonpatch[_0x3535('0x20')](_0x543ea2,_0x12bce8,!![]);}catch(_0x5778bb){return BPromise[_0x3535('0x21')](_0x5778bb);}return _0x543ea2[_0x3535('0x22')]();};}function saveUpdates(_0x111c88,_0x194526){return function(_0x15a38d){if(_0x15a38d){return _0x15a38d[_0x3535('0x23')](_0x111c88)['then'](function(_0x5bdbdd){return _0x5bdbdd;});}return null;};}function removeEntity(_0x228f7c,_0x2fa78){return function(_0x3b944f){if(_0x3b944f){return _0x3b944f[_0x3535('0x24')]()['then'](function(){_0x228f7c[_0x3535('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57c189,_0x38e66b){return function(_0x29d3d7){if(!_0x29d3d7){_0x57c189[_0x3535('0x16')](0x194);}return _0x29d3d7;};}function handleError(_0x4bfb3f,_0x4a94bc){_0x4a94bc=_0x4a94bc||0x1f4;return function(_0x5915af){logger[_0x3535('0x25')](_0x5915af['stack']);if(_0x5915af[_0x3535('0x26')]){delete _0x5915af[_0x3535('0x26')];}_0x4bfb3f['status'](_0x4a94bc)['send'](_0x5915af);};}function getMustacheRender(_0x446cd9,_0x105578){return Mustache[_0x3535('0x27')](_0x446cd9,_[_0x3535('0x28')](_0x105578[_0x3535('0x29')],{'contact':_0x105578[_0x3535('0x2a')],'message':_0x105578[_0x3535('0x2b')],'agent':_0x105578[_0x3535('0x2c')],'interaction':_0x105578[_0x3535('0x2d')],'account':_0x105578[_0x3535('0x2e')]}))||'';}exports[_0x3535('0x2f')]=function(_0x3f81f5,_0x535511){var _0x5c27dc={},_0x1cc4a4={},_0x1b3330={'count':0x0,'rows':[]};var _0x47e813=_[_0x3535('0x30')](db[_0x3535('0x31')]['rawAttributes'],function(_0x5759d1){return{'name':_0x5759d1[_0x3535('0x32')],'type':_0x5759d1['type'][_0x3535('0x33')]};});_0x1cc4a4[_0x3535('0x34')]=_[_0x3535('0x30')](_0x47e813,_0x3535('0x26'));_0x1cc4a4[_0x3535('0x35')]=_[_0x3535('0x36')](_0x3f81f5[_0x3535('0x35')]);_0x1cc4a4[_0x3535('0x37')]=_[_0x3535('0x38')](_0x1cc4a4['model'],_0x1cc4a4['query']);_0x5c27dc[_0x3535('0x39')]=_[_0x3535('0x38')](_0x1cc4a4['model'],qs[_0x3535('0x3a')](_0x3f81f5[_0x3535('0x35')][_0x3535('0x3a')]));_0x5c27dc[_0x3535('0x39')]=_0x5c27dc[_0x3535('0x39')][_0x3535('0x3b')]?_0x5c27dc[_0x3535('0x39')]:_0x1cc4a4[_0x3535('0x34')];if(!_0x3f81f5[_0x3535('0x35')][_0x3535('0x3c')](_0x3535('0x3d'))){_0x5c27dc[_0x3535('0x1b')]=qs[_0x3535('0x1b')](_0x3f81f5[_0x3535('0x35')][_0x3535('0x1b')]);_0x5c27dc[_0x3535('0x1a')]=qs[_0x3535('0x1a')](_0x3f81f5[_0x3535('0x35')]['offset']);}_0x5c27dc[_0x3535('0x3e')]=qs[_0x3535('0x3f')](_0x3f81f5[_0x3535('0x35')]['sort']);_0x5c27dc[_0x3535('0x40')]=qs[_0x3535('0x37')](_[_0x3535('0x41')](_0x3f81f5[_0x3535('0x35')],_0x1cc4a4[_0x3535('0x37')]),_0x47e813);if(_0x3f81f5[_0x3535('0x35')][_0x3535('0x42')]){_0x5c27dc[_0x3535('0x40')]=_[_0x3535('0x28')](_0x5c27dc[_0x3535('0x40')],{'$or':_[_0x3535('0x30')](_0x47e813,function(_0xbf9cf1){if(_0xbf9cf1[_0x3535('0x43')]!==_0x3535('0x44')){var _0x57bda8={};_0x57bda8[_0xbf9cf1[_0x3535('0x26')]]={'$like':'%'+_0x3f81f5[_0x3535('0x35')][_0x3535('0x42')]+'%'};return _0x57bda8;}})});}_0x5c27dc=_[_0x3535('0x28')]({},_0x5c27dc,_0x3f81f5[_0x3535('0x45')]);var _0x53748b={'where':_0x5c27dc[_0x3535('0x40')]};return db[_0x3535('0x31')][_0x3535('0x1d')](_0x53748b)[_0x3535('0x46')](function(_0x3c881b){_0x1b3330[_0x3535('0x1d')]=_0x3c881b;if(_0x3f81f5[_0x3535('0x35')][_0x3535('0x47')]){_0x5c27dc[_0x3535('0x48')]=[{'all':!![]}];}return db[_0x3535('0x31')][_0x3535('0x49')](_0x5c27dc);})[_0x3535('0x46')](function(_0x281422){_0x1b3330['rows']=_0x281422;return _0x1b3330;})[_0x3535('0x46')](respondWithFilteredResult(_0x535511,_0x5c27dc))['catch'](handleError(_0x535511,null));};exports[_0x3535('0x4a')]=function(_0x32eec2,_0x3cca02){var _0x299671={'raw':!![],'where':{'id':_0x32eec2[_0x3535('0x4b')]['id']}},_0x2b79ca={};_0x2b79ca['model']=_[_0x3535('0x36')](db[_0x3535('0x31')][_0x3535('0x4c')]);_0x2b79ca['query']=_['keys'](_0x32eec2[_0x3535('0x35')]);_0x2b79ca[_0x3535('0x37')]=_[_0x3535('0x38')](_0x2b79ca[_0x3535('0x34')],_0x2b79ca['query']);_0x299671['attributes']=_[_0x3535('0x38')](_0x2b79ca[_0x3535('0x34')],qs['fields'](_0x32eec2['query'][_0x3535('0x3a')]));_0x299671['attributes']=_0x299671[_0x3535('0x39')][_0x3535('0x3b')]?_0x299671[_0x3535('0x39')]:_0x2b79ca[_0x3535('0x34')];if(_0x32eec2[_0x3535('0x35')]['includeAll']){_0x299671[_0x3535('0x48')]=[{'all':!![]}];}_0x299671=_[_0x3535('0x28')]({},_0x299671,_0x32eec2[_0x3535('0x45')]);return db[_0x3535('0x31')][_0x3535('0x4d')](_0x299671)[_0x3535('0x46')](handleEntityNotFound(_0x3cca02,null))[_0x3535('0x46')](respondWithResult(_0x3cca02,null))[_0x3535('0x4e')](handleError(_0x3cca02,null));};exports[_0x3535('0x4f')]=function(_0x552986,_0x284eca){return db[_0x3535('0x31')]['create'](_0x552986[_0x3535('0x29')],{})[_0x3535('0x46')](respondWithResult(_0x284eca,0xc9))['catch'](handleError(_0x284eca,null));};exports[_0x3535('0x23')]=function(_0x443b1a,_0x5a5281){if(_0x443b1a['body']['id']){delete _0x443b1a['body']['id'];}return db[_0x3535('0x31')][_0x3535('0x4d')]({'where':{'id':_0x443b1a[_0x3535('0x4b')]['id']}})[_0x3535('0x46')](handleEntityNotFound(_0x5a5281,null))[_0x3535('0x46')](saveUpdates(_0x443b1a[_0x3535('0x29')],null))[_0x3535('0x46')](respondWithResult(_0x5a5281,null))[_0x3535('0x4e')](handleError(_0x5a5281,null));};exports[_0x3535('0x24')]=function(_0x1ec4e9,_0x3db7a3){return db[_0x3535('0x31')][_0x3535('0x4d')]({'where':{'id':_0x1ec4e9['params']['id']}})[_0x3535('0x46')](handleEntityNotFound(_0x3db7a3,null))['then'](removeEntity(_0x3db7a3,null))['catch'](handleError(_0x3db7a3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4a0932d..4f0278d 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 _0xd80f=['../../config/logger','api','request-promise','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd80f,0x82));var _0xfd80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd80f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfd80('0x0'));var util=require(_0xfd80('0x1'));var logger=require(_0xfd80('0x2'))(_0xfd80('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfd80('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfd80('0x5'));var attributes=require('./intServicenowField.attributes');module[_0xfd80('0x6')]=function(_0x128a17,_0x590d7d){return _0x128a17[_0xfd80('0x7')](_0xfd80('0x8'),attributes,{'tableName':_0xfd80('0x9'),'paranoid':![],'indexes':[{'name':_0xfd80('0xa'),'fields':[_0xfd80('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf05e=['lodash','util','api','request-promise','path','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','FieldId'];(function(_0x33e7dc,_0x827a13){var _0x38c00a=function(_0x369e64){while(--_0x369e64){_0x33e7dc['push'](_0x33e7dc['shift']());}};_0x38c00a(++_0x827a13);}(_0xf05e,0x6e));var _0xef05=function(_0x213a17,_0x31e75f){_0x213a17=_0x213a17-0x0;var _0x8f769c=_0xf05e[_0x213a17];return _0x8f769c;};'use strict';var _=require(_0xef05('0x0'));var util=require(_0xef05('0x1'));var logger=require('../../config/logger')(_0xef05('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xef05('0x3'));var fs=require('fs');var path=require(_0xef05('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef05('0x5'));module[_0xef05('0x6')]=function(_0x1e8fc2,_0x1c2930){return _0x1e8fc2[_0xef05('0x7')]('ServicenowField',attributes,{'tableName':_0xef05('0x8'),'paranoid':![],'indexes':[{'name':_0xef05('0x9'),'fields':['idField',_0xef05('0xa')],'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 55e45bc..e9e16d8 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 _0x7a7b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3bb098,_0x23bfb7){var _0x40c8f7=function(_0x21ea90){while(--_0x21ea90){_0x3bb098['push'](_0x3bb098['shift']());}};_0x40c8f7(++_0x23bfb7);}(_0x7a7b,0xdc));var _0xb7a7=function(_0x37ce49,_0x3eb0bd){_0x37ce49=_0x37ce49-0x0;var _0x5a6f52=_0x7a7b[_0x37ce49];return _0x5a6f52;};'use strict';var _=require(_0xb7a7('0x0'));var util=require(_0xb7a7('0x1'));var moment=require('moment');var BPromise=require(_0xb7a7('0x2'));var rs=require(_0xb7a7('0x3'));var fs=require('fs');var Redis=require(_0xb7a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb7a7('0x5'));var logger=require(_0xb7a7('0x6'))(_0xb7a7('0x7'));var config=require(_0xb7a7('0x8'));var jayson=require(_0xb7a7('0x9'));var client=jayson[_0xb7a7('0xa')][_0xb7a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bb4ba,_0x27cca4,_0x530fba){return new BPromise(function(_0x41e190,_0x440b8b){return client[_0xb7a7('0xc')](_0x4bb4ba,_0x530fba)[_0xb7a7('0xd')](function(_0x3cd317){logger[_0xb7a7('0xe')](_0xb7a7('0xf'),_0x27cca4,_0xb7a7('0x10'));logger[_0xb7a7('0x11')](_0xb7a7('0x12'),_0x27cca4,'request\x20sent',JSON[_0xb7a7('0x13')](_0x3cd317));if(_0x3cd317[_0xb7a7('0x14')]){if(_0x3cd317[_0xb7a7('0x14')][_0xb7a7('0x15')]===0x1f4){logger['error'](_0xb7a7('0xf'),_0x27cca4,_0x3cd317[_0xb7a7('0x14')][_0xb7a7('0x16')]);return _0x440b8b(_0x3cd317[_0xb7a7('0x14')][_0xb7a7('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x27cca4,_0x3cd317[_0xb7a7('0x14')]['message']);return _0x41e190(_0x3cd317[_0xb7a7('0x14')][_0xb7a7('0x16')]);}else{logger[_0xb7a7('0xe')](_0xb7a7('0xf'),_0x27cca4,_0xb7a7('0x10'));_0x41e190(_0x3cd317[_0xb7a7('0x17')]['message']);}})[_0xb7a7('0x18')](function(_0x205e8c){logger[_0xb7a7('0x14')](_0xb7a7('0xf'),_0x27cca4,_0x205e8c);_0x440b8b(_0x205e8c);});});} \ No newline at end of file +var _0x4bb9=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','result'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x4bb9,0x188));var _0x94bb=function(_0xfca580,_0x2318fe){_0xfca580=_0xfca580-0x0;var _0x4d587b=_0x4bb9[_0xfca580];return _0x4d587b;};'use strict';var _=require(_0x94bb('0x0'));var util=require(_0x94bb('0x1'));var moment=require('moment');var BPromise=require(_0x94bb('0x2'));var rs=require(_0x94bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94bb('0x4'))['db'];var utils=require(_0x94bb('0x5'));var logger=require(_0x94bb('0x6'))(_0x94bb('0x7'));var config=require(_0x94bb('0x8'));var jayson=require(_0x94bb('0x9'));var client=jayson['client'][_0x94bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28d6bf,_0x100640,_0x2f127e){return new BPromise(function(_0x2e8be3,_0x1cb31b){return client[_0x94bb('0xb')](_0x28d6bf,_0x2f127e)[_0x94bb('0xc')](function(_0x1eed11){logger[_0x94bb('0xd')]('ServicenowField,\x20%s,\x20%s',_0x100640,_0x94bb('0xe'));logger['debug'](_0x94bb('0xf'),_0x100640,_0x94bb('0xe'),JSON[_0x94bb('0x10')](_0x1eed11));if(_0x1eed11['error']){if(_0x1eed11[_0x94bb('0x11')][_0x94bb('0x12')]===0x1f4){logger[_0x94bb('0x11')](_0x94bb('0x13'),_0x100640,_0x1eed11[_0x94bb('0x11')][_0x94bb('0x14')]);return _0x1cb31b(_0x1eed11[_0x94bb('0x11')]['message']);}logger[_0x94bb('0x11')](_0x94bb('0x13'),_0x100640,_0x1eed11[_0x94bb('0x11')][_0x94bb('0x14')]);return _0x2e8be3(_0x1eed11['error']['message']);}else{logger[_0x94bb('0xd')]('ServicenowField,\x20%s,\x20%s',_0x100640,_0x94bb('0xe'));_0x2e8be3(_0x1eed11[_0x94bb('0x15')][_0x94bb('0x14')]);}})[_0x94bb('0x16')](function(_0x26c2a5){logger[_0x94bb('0x11')](_0x94bb('0x13'),_0x100640,_0x26c2a5);_0x1cb31b(_0x26c2a5);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 47e567e..09e5402 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 _0x6fe6=['../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x584291,_0x24b5b3){var _0x4e7d08=function(_0x59e0b1){while(--_0x59e0b1){_0x584291['push'](_0x584291['shift']());}};_0x4e7d08(++_0x24b5b3);}(_0x6fe6,0x191));var _0x66fe=function(_0xff22a1,_0x516141){_0xff22a1=_0xff22a1-0x0;var _0x2f5a0f=_0x6fe6[_0xff22a1];return _0x2f5a0f;};'use strict';var multer=require(_0x66fe('0x0'));var util=require('util');var path=require(_0x66fe('0x1'));var timeout=require(_0x66fe('0x2'));var express=require(_0x66fe('0x3'));var router=express[_0x66fe('0x4')]();var fs_extra=require(_0x66fe('0x5'));var auth=require(_0x66fe('0x6'));var interaction=require(_0x66fe('0x7'));var config=require(_0x66fe('0x8'));var controller=require(_0x66fe('0x9'));router[_0x66fe('0xa')]('/',auth[_0x66fe('0xb')](),controller['index']);router[_0x66fe('0xa')]('/:id',auth[_0x66fe('0xb')](),controller[_0x66fe('0xc')]);router['get'](_0x66fe('0xd'),auth[_0x66fe('0xb')](),controller[_0x66fe('0xe')]);router['get'](_0x66fe('0xf'),auth['isAuthenticated'](),controller[_0x66fe('0x10')]);router[_0x66fe('0x11')]('/',auth[_0x66fe('0xb')](),controller[_0x66fe('0x12')]);router[_0x66fe('0x11')](_0x66fe('0xd'),auth[_0x66fe('0xb')](),controller['addConfiguration']);router[_0x66fe('0x13')]('/:id',auth[_0x66fe('0xb')](),controller[_0x66fe('0x14')]);router[_0x66fe('0x15')](_0x66fe('0x16'),auth[_0x66fe('0xb')](),controller['destroy']);module[_0x66fe('0x17')]=router; \ No newline at end of file +var _0x24d9=['/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getConfigurations'];(function(_0x1d414c,_0x2c856b){var _0x5e135a=function(_0x54547c){while(--_0x54547c){_0x1d414c['push'](_0x1d414c['shift']());}};_0x5e135a(++_0x2c856b);}(_0x24d9,0xf0));var _0x924d=function(_0xbc9525,_0x47234e){_0xbc9525=_0xbc9525-0x0;var _0x3c8897=_0x24d9[_0xbc9525];return _0x3c8897;};'use strict';var multer=require(_0x924d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x924d('0x1'));var express=require(_0x924d('0x2'));var router=express[_0x924d('0x3')]();var fs_extra=require(_0x924d('0x4'));var auth=require(_0x924d('0x5'));var interaction=require(_0x924d('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router[_0x924d('0x7')]('/',auth[_0x924d('0x8')](),controller[_0x924d('0x9')]);router[_0x924d('0x7')](_0x924d('0xa'),auth[_0x924d('0x8')](),controller[_0x924d('0xb')]);router['get']('/:id/configurations',auth[_0x924d('0x8')](),controller[_0x924d('0xc')]);router['get'](_0x924d('0xd'),auth[_0x924d('0x8')](),controller[_0x924d('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x924d('0xf')]);router[_0x924d('0x10')](_0x924d('0x11'),auth[_0x924d('0x8')](),controller[_0x924d('0x12')]);router[_0x924d('0x13')](_0x924d('0xa'),auth[_0x924d('0x8')](),controller[_0x924d('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x924d('0x15')]);module[_0x924d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 2be419e..291c12d 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 _0x9aaf=['STRING','username','remoteUri','exports'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x9aaf,0xdf));var _0xf9aa=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x9aaf[_0x2cef86];return _0x46dfd6;};'use strict';var Sequelize=require('sequelize');module[_0xf9aa('0x0')]={'name':{'type':Sequelize[_0xf9aa('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf9aa('0x1')],'unique':_0xf9aa('0x2')},'password':{'type':Sequelize[_0xf9aa('0x1')]},'remoteUri':{'type':Sequelize[_0xf9aa('0x1')],'unique':_0xf9aa('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9e0e=['remoteUri','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9e0e,0xd9));var _0xe9e0=function(_0x5c1713,_0x5d1c5a){_0x5c1713=_0x5c1713-0x0;var _0x1ff364=_0x9e0e[_0x5c1713];return _0x1ff364;};'use strict';var Sequelize=require('sequelize');module[_0xe9e0('0x0')]={'name':{'type':Sequelize[_0xe9e0('0x1')]},'description':{'type':Sequelize[_0xe9e0('0x1')]},'username':{'type':Sequelize[_0xe9e0('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xe9e0('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe9e0('0x2')},'serverUrl':{'type':Sequelize[_0xe9e0('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 98f6b54..577a055 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 _0x3647=['result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','merge','body','contact','agent','interaction','account','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','destroy','findOne','SugarcrmConfiguration','order','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','assigned_user_id','created_by','description','date_start','duration_hours','direction','username','password','remoteUri','substring','POST','%s%s','JSON','xCALLY\x20Motion\x20Integration','Password\x20Expired','Calls','values','module_fields','remove','label','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message'];(function(_0x4a86a5,_0x1021df){var _0xd2fe11=function(_0x2fd648){while(--_0x2fd648){_0x4a86a5['push'](_0x4a86a5['shift']());}};_0xd2fe11(++_0x1021df);}(_0x3647,0x163));var _0x7364=function(_0x53c308,_0x28e59e){_0x53c308=_0x53c308-0x0;var _0x1be8b1=_0x3647[_0x53c308];return _0x1be8b1;};'use strict';var emlformat=require(_0x7364('0x0'));var rimraf=require(_0x7364('0x1'));var zipdir=require(_0x7364('0x2'));var jsonpatch=require(_0x7364('0x3'));var rp=require('request-promise');var moment=require(_0x7364('0x4'));var BPromise=require(_0x7364('0x5'));var Mustache=require(_0x7364('0x6'));var util=require(_0x7364('0x7'));var path=require(_0x7364('0x8'));var sox=require(_0x7364('0x9'));var csv=require(_0x7364('0xa'));var ejs=require(_0x7364('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7364('0xc'));var squel=require(_0x7364('0xd'));var crypto=require(_0x7364('0xe'));var jsforce=require(_0x7364('0xf'));var deskjs=require(_0x7364('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7364('0x11'));var Papa=require(_0x7364('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7364('0x13'));var as=require(_0x7364('0x14'));var hardwareService=require(_0x7364('0x15'));var logger=require(_0x7364('0x16'))('api');var utils=require(_0x7364('0x17'));var config=require(_0x7364('0x18'));var licenseUtil=require(_0x7364('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7364('0x1a'));var client=jayson[_0x7364('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x290b4a,_0x4974c2,_0x3314d0,_0x27ec63){return new BPromise(function(_0x4e24b,_0x30b477){var _0x31af4d=_0x27ec63||client;return _0x31af4d[_0x7364('0x1c')](_0x290b4a,_0x3314d0)['then'](function(_0x26053b){logger[_0x7364('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x4974c2,_0x7364('0x1e'));logger[_0x7364('0x1f')](_0x7364('0x20'),_0x4974c2,'request\x20sent',JSON[_0x7364('0x21')](_0x26053b));if(_0x26053b[_0x7364('0x22')]){if(_0x26053b[_0x7364('0x22')][_0x7364('0x23')]===0x1f4){logger[_0x7364('0x22')](_0x7364('0x24'),_0x4974c2,_0x26053b[_0x7364('0x22')][_0x7364('0x25')]);return _0x30b477(_0x26053b[_0x7364('0x22')]['message']);}logger[_0x7364('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x4974c2,_0x26053b[_0x7364('0x22')][_0x7364('0x25')]);return _0x4e24b(_0x26053b[_0x7364('0x22')][_0x7364('0x25')]);}else{logger[_0x7364('0x1d')](_0x7364('0x24'),_0x4974c2,_0x7364('0x1e'));_0x4e24b(_0x26053b[_0x7364('0x26')][_0x7364('0x25')]);}})['catch'](function(_0x17a57d){logger[_0x7364('0x22')](_0x7364('0x24'),_0x4974c2,_0x17a57d);_0x30b477(_0x17a57d);});});}function respondWithStatusCode(_0x63df15,_0x230d1b){_0x230d1b=_0x230d1b||0xcc;return function(_0xa11e12){if(_0xa11e12){return _0x63df15[_0x7364('0x27')](_0x230d1b);}return _0x63df15['status'](_0x230d1b)[_0x7364('0x28')]();};}function respondWithResult(_0x353393,_0x52e603){_0x52e603=_0x52e603||0xc8;return function(_0x195573){if(_0x195573){return _0x353393[_0x7364('0x29')](_0x52e603)[_0x7364('0x2a')](_0x195573);}};}function respondWithFilteredResult(_0x2a8c64,_0x3d9a8){return function(_0x30507d){if(_0x30507d){var _0x4ee431=typeof _0x3d9a8[_0x7364('0x2b')]===_0x7364('0x2c')&&typeof _0x3d9a8[_0x7364('0x2d')]==='undefined';var _0x5736e8=_0x30507d[_0x7364('0x2e')];var _0x23cc9a=_0x4ee431?0x0:_0x3d9a8[_0x7364('0x2b')];var _0x963e8c=_0x4ee431?_0x30507d[_0x7364('0x2e')]:_0x3d9a8[_0x7364('0x2b')]+_0x3d9a8[_0x7364('0x2d')];var _0x266a68;if(_0x963e8c>=_0x5736e8){_0x963e8c=_0x5736e8;_0x266a68=0xc8;}else{_0x266a68=0xce;}_0x2a8c64['status'](_0x266a68);return _0x2a8c64[_0x7364('0x2f')](_0x7364('0x30'),_0x23cc9a+'-'+_0x963e8c+'/'+_0x5736e8)[_0x7364('0x2a')](_0x30507d);}return null;};}function patchUpdates(_0x1baccf){return function(_0x23dab1){try{jsonpatch[_0x7364('0x31')](_0x23dab1,_0x1baccf,!![]);}catch(_0x1fea3){return BPromise[_0x7364('0x32')](_0x1fea3);}return _0x23dab1[_0x7364('0x33')]();};}function saveUpdates(_0x40b4f3,_0x11c2cd){return function(_0xea7af){if(_0xea7af){return _0xea7af[_0x7364('0x34')](_0x40b4f3)[_0x7364('0x35')](function(_0x19f930){return _0x19f930;});}return null;};}function removeEntity(_0x549bbe,_0x449fa9){return function(_0x5b228e){if(_0x5b228e){return _0x5b228e['destroy']()[_0x7364('0x35')](function(){_0x549bbe['status'](0xcc)[_0x7364('0x28')]();});}};}function handleEntityNotFound(_0x454476,_0x21146d){return function(_0x323456){if(!_0x323456){_0x454476[_0x7364('0x27')](0x194);}return _0x323456;};}function handleError(_0x1423df,_0x147c66){_0x147c66=_0x147c66||0x1f4;return function(_0x329330){logger[_0x7364('0x22')](_0x329330[_0x7364('0x36')]);if(_0x329330['name']){delete _0x329330[_0x7364('0x37')];}_0x1423df[_0x7364('0x29')](_0x147c66)[_0x7364('0x38')](_0x329330);};}function getMustacheRender(_0x426221,_0x5396e5){return Mustache['render'](_0x426221,_[_0x7364('0x39')](_0x5396e5[_0x7364('0x3a')],{'contact':_0x5396e5[_0x7364('0x3b')],'message':_0x5396e5['message'],'agent':_0x5396e5[_0x7364('0x3c')],'interaction':_0x5396e5[_0x7364('0x3d')],'account':_0x5396e5[_0x7364('0x3e')]}))||'';}exports[_0x7364('0x3f')]=function(_0x42a3d5,_0x5c305d){var _0x2067d1={},_0x2986c5={},_0x1f7f98={'count':0x0,'rows':[]};var _0x38dd14=_[_0x7364('0x40')](db[_0x7364('0x41')][_0x7364('0x42')],function(_0x22ab2e){return{'name':_0x22ab2e[_0x7364('0x43')],'type':_0x22ab2e[_0x7364('0x44')][_0x7364('0x45')]};});_0x2986c5[_0x7364('0x46')]=_['map'](_0x38dd14,'name');_0x2986c5[_0x7364('0x47')]=_['keys'](_0x42a3d5[_0x7364('0x47')]);_0x2986c5['filters']=_[_0x7364('0x48')](_0x2986c5[_0x7364('0x46')],_0x2986c5[_0x7364('0x47')]);_0x2067d1[_0x7364('0x49')]=_[_0x7364('0x48')](_0x2986c5[_0x7364('0x46')],qs[_0x7364('0x4a')](_0x42a3d5[_0x7364('0x47')]['fields']));_0x2067d1[_0x7364('0x49')]=_0x2067d1[_0x7364('0x49')][_0x7364('0x4b')]?_0x2067d1[_0x7364('0x49')]:_0x2986c5[_0x7364('0x46')];if(!_0x42a3d5['query'][_0x7364('0x4c')](_0x7364('0x4d'))){_0x2067d1['limit']=qs[_0x7364('0x2d')](_0x42a3d5['query'][_0x7364('0x2d')]);_0x2067d1[_0x7364('0x2b')]=qs[_0x7364('0x2b')](_0x42a3d5['query'][_0x7364('0x2b')]);}_0x2067d1['order']=qs[_0x7364('0x4e')](_0x42a3d5[_0x7364('0x47')][_0x7364('0x4e')]);_0x2067d1[_0x7364('0x4f')]=qs[_0x7364('0x50')](_[_0x7364('0x51')](_0x42a3d5[_0x7364('0x47')],_0x2986c5['filters']),_0x38dd14);if(_0x42a3d5[_0x7364('0x47')][_0x7364('0x52')]){_0x2067d1[_0x7364('0x4f')]=_[_0x7364('0x39')](_0x2067d1[_0x7364('0x4f')],{'$or':_[_0x7364('0x40')](_0x38dd14,function(_0x304722){if(_0x304722[_0x7364('0x44')]!=='VIRTUAL'){var _0x234c67={};_0x234c67[_0x304722[_0x7364('0x37')]]={'$like':'%'+_0x42a3d5['query']['filter']+'%'};return _0x234c67;}})});}_0x2067d1=_[_0x7364('0x39')]({},_0x2067d1,_0x42a3d5[_0x7364('0x53')]);var _0x2ba966={'where':_0x2067d1[_0x7364('0x4f')]};return db[_0x7364('0x41')]['count'](_0x2ba966)[_0x7364('0x35')](function(_0x56d6e2){_0x1f7f98[_0x7364('0x2e')]=_0x56d6e2;if(_0x42a3d5[_0x7364('0x47')][_0x7364('0x54')]){_0x2067d1['include']=[{'all':!![]}];}return db[_0x7364('0x41')][_0x7364('0x55')](_0x2067d1);})[_0x7364('0x35')](function(_0x41f33c){_0x1f7f98[_0x7364('0x56')]=_0x41f33c;return _0x1f7f98;})[_0x7364('0x35')](respondWithFilteredResult(_0x5c305d,_0x2067d1))[_0x7364('0x57')](handleError(_0x5c305d,null));};exports[_0x7364('0x58')]=function(_0x15a8b0,_0x488606){var _0x5b6fd6={'raw':![],'where':{'id':_0x15a8b0[_0x7364('0x59')]['id']}},_0x325f8a={};_0x325f8a['model']=_['keys'](db['SugarcrmAccount'][_0x7364('0x42')]);_0x325f8a[_0x7364('0x47')]=_[_0x7364('0x5a')](_0x15a8b0[_0x7364('0x47')]);_0x325f8a[_0x7364('0x50')]=_[_0x7364('0x48')](_0x325f8a['model'],_0x325f8a['query']);_0x5b6fd6[_0x7364('0x49')]=_[_0x7364('0x48')](_0x325f8a[_0x7364('0x46')],qs[_0x7364('0x4a')](_0x15a8b0[_0x7364('0x47')][_0x7364('0x4a')]));_0x5b6fd6[_0x7364('0x49')]=_0x5b6fd6[_0x7364('0x49')]['length']?_0x5b6fd6[_0x7364('0x49')]:_0x325f8a['model'];if(_0x15a8b0[_0x7364('0x47')][_0x7364('0x54')]){_0x5b6fd6[_0x7364('0x5b')]=[{'all':!![]}];}_0x5b6fd6=_[_0x7364('0x39')]({},_0x5b6fd6,_0x15a8b0[_0x7364('0x53')]);return db['SugarcrmAccount'][_0x7364('0x5c')](_0x5b6fd6)[_0x7364('0x35')](handleEntityNotFound(_0x488606,null))[_0x7364('0x35')](respondWithResult(_0x488606,null))['catch'](handleError(_0x488606,null));};exports[_0x7364('0x5d')]=function(_0x2c6d96,_0x5c4185){return db[_0x7364('0x41')][_0x7364('0x5d')](_0x2c6d96['body'],{})[_0x7364('0x35')](respondWithResult(_0x5c4185,0xc9))['catch'](handleError(_0x5c4185,null));};exports[_0x7364('0x34')]=function(_0x49f6d4,_0x3df890){if(_0x49f6d4[_0x7364('0x3a')]['id']){delete _0x49f6d4['body']['id'];}return db[_0x7364('0x41')][_0x7364('0x5c')]({'where':{'id':_0x49f6d4[_0x7364('0x59')]['id']}})[_0x7364('0x35')](handleEntityNotFound(_0x3df890,null))[_0x7364('0x35')](saveUpdates(_0x49f6d4['body'],null))['then'](respondWithResult(_0x3df890,null))[_0x7364('0x57')](handleError(_0x3df890,null));};exports[_0x7364('0x5e')]=function(_0x56062f,_0x3c81f8){return db['SugarcrmAccount'][_0x7364('0x5c')]({'where':{'id':_0x56062f[_0x7364('0x59')]['id']}})[_0x7364('0x35')](handleEntityNotFound(_0x3c81f8,null))[_0x7364('0x35')](removeEntity(_0x3c81f8,null))[_0x7364('0x57')](handleError(_0x3c81f8,null));};exports['getConfigurations']=function(_0x5c5dcd,_0x5a931c,_0x4ef29f){var _0x532de3={};var _0x5ded67={};var _0x557210;var _0x504888;return db['SugarcrmAccount'][_0x7364('0x5f')]({'where':{'id':_0x5c5dcd[_0x7364('0x59')]['id']}})[_0x7364('0x35')](handleEntityNotFound(_0x5a931c,null))[_0x7364('0x35')](function(_0x255eaf){if(_0x255eaf){_0x557210=_0x255eaf;_0x5ded67[_0x7364('0x46')]=_[_0x7364('0x5a')](db[_0x7364('0x60')][_0x7364('0x42')]);_0x5ded67[_0x7364('0x47')]=_[_0x7364('0x5a')](_0x5c5dcd[_0x7364('0x47')]);_0x5ded67[_0x7364('0x50')]=_[_0x7364('0x48')](_0x5ded67[_0x7364('0x46')],_0x5ded67[_0x7364('0x47')]);_0x532de3[_0x7364('0x49')]=_[_0x7364('0x48')](_0x5ded67['model'],qs[_0x7364('0x4a')](_0x5c5dcd[_0x7364('0x47')]['fields']));_0x532de3['attributes']=_0x532de3[_0x7364('0x49')]['length']?_0x532de3[_0x7364('0x49')]:_0x5ded67['model'];_0x532de3[_0x7364('0x61')]=qs['sort'](_0x5c5dcd[_0x7364('0x47')][_0x7364('0x4e')]);_0x532de3[_0x7364('0x4f')]=qs['filters'](_[_0x7364('0x51')](_0x5c5dcd['query'],_0x5ded67['filters']));if(_0x5c5dcd[_0x7364('0x47')][_0x7364('0x52')]){_0x532de3[_0x7364('0x4f')]=_[_0x7364('0x39')](_0x532de3[_0x7364('0x4f')],{'$or':_[_0x7364('0x40')](_0x532de3[_0x7364('0x49')],function(_0x1fca91){var _0x22f9e6={};_0x22f9e6[_0x1fca91]={'$like':'%'+_0x5c5dcd[_0x7364('0x47')][_0x7364('0x52')]+'%'};return _0x22f9e6;})});}_0x532de3=_[_0x7364('0x39')]({},_0x532de3,_0x5c5dcd[_0x7364('0x53')]);return _0x557210[_0x7364('0x62')](_0x532de3);}})['then'](function(_0x186184){if(_0x186184){_0x504888=_0x186184[_0x7364('0x4b')];if(!_0x5c5dcd[_0x7364('0x47')][_0x7364('0x4c')](_0x7364('0x4d'))){_0x532de3[_0x7364('0x2d')]=qs[_0x7364('0x2d')](_0x5c5dcd[_0x7364('0x47')][_0x7364('0x2d')]);_0x532de3['offset']=qs[_0x7364('0x2b')](_0x5c5dcd[_0x7364('0x47')][_0x7364('0x2b')]);}return _0x557210['getConfigurations'](_0x532de3);}})['then'](function(_0x516cf3){if(_0x516cf3){return _0x516cf3?{'count':_0x504888,'rows':_0x516cf3}:null;}})['then'](respondWithResult(_0x5a931c,null))[_0x7364('0x57')](handleError(_0x5a931c,null));};exports[_0x7364('0x63')]=function(_0x5b9965,_0x5a667b,_0x5f6922){if(_0x5b9965[_0x7364('0x3a')]['id']){delete _0x5b9965['body']['id'];}return db['SugarcrmAccount'][_0x7364('0x5f')]({'where':{'id':_0x5b9965[_0x7364('0x59')]['id']}})[_0x7364('0x35')](handleEntityNotFound(_0x5a667b,null))[_0x7364('0x35')](function(_0x12332f){if(_0x12332f){_0x5b9965[_0x7364('0x3a')]['AccountId']=_0x12332f['id'];_0x5b9965[_0x7364('0x3a')]['Subjects']=integrations[_0x7364('0x64')](_0x5b9965['body'][_0x7364('0x65')],_0x5b9965[_0x7364('0x3a')][_0x7364('0x44')]);_0x5b9965[_0x7364('0x3a')][_0x7364('0x66')]=integrations[_0x7364('0x67')](_0x5b9965[_0x7364('0x3a')][_0x7364('0x65')],_0x5b9965[_0x7364('0x3a')][_0x7364('0x44')]);return db[_0x7364('0x60')][_0x7364('0x5d')](_0x5b9965[_0x7364('0x3a')],{'include':[{'model':db[_0x7364('0x68')],'as':_0x7364('0x69')},{'model':db[_0x7364('0x68')],'as':_0x7364('0x66')}]});}return null;})[_0x7364('0x35')](respondWithResult(_0x5a667b,null))[_0x7364('0x57')](handleError(_0x5a667b,null));};exports['getFields']=function(_0x3ea4b5,_0x288e80,_0x316c08){var _0x5411a1='';var _0x110020=['id',_0x7364('0x37'),_0x7364('0x6a'),_0x7364('0x6b'),_0x7364('0x6c'),_0x7364('0x6d'),_0x7364('0x6e'),'duration_minutes','parent_id','parent_type','parent_name',_0x7364('0x6f')];return db['SugarcrmAccount'][_0x7364('0x5f')]({'where':{'id':_0x3ea4b5[_0x7364('0x59')]['id']},'attributes':['id',_0x7364('0x70'),_0x7364('0x71'),'remoteUri']})['then'](handleEntityNotFound(_0x288e80,null))[_0x7364('0x35')](function(_0x1582bb){if(_0x1582bb){_0x5411a1=_0x1582bb[_0x7364('0x72')];var _0x539cea=_0x5411a1['slice'](-0x1);if(_0x539cea==='/'){_0x5411a1=_0x5411a1[_0x7364('0x73')](0x0,_0x5411a1['lastIndexOf'](_0x539cea));}return rp({'method':_0x7364('0x74'),'uri':util['format'](_0x7364('0x75'),_0x5411a1,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x7364('0x76'),'response_type':_0x7364('0x76'),'rest_data':JSON[_0x7364('0x21')]({'user_auth':{'user_name':_0x1582bb[_0x7364('0x70')],'password':_0x1582bb[_0x7364('0x71')],'encryption':'PLAIN'},'application':_0x7364('0x77')})}});}})[_0x7364('0x35')](function(_0x597718){if(_0x597718&&_0x597718['name']!=='Invalid\x20Login'&&_0x597718[_0x7364('0x37')]!==_0x7364('0x78')){return rp({'method':_0x7364('0x74'),'uri':util['format'](_0x7364('0x75'),_0x5411a1,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x7364('0x21')]({'session':_0x597718['id'],'module_name':_0x7364('0x79')})}})['then'](function(_0x59fa26){if(_0x59fa26){var _0x8316b9=_[_0x7364('0x7a')](_0x59fa26[_0x7364('0x7b')]);_[_0x7364('0x7c')](_0x8316b9,function(_0x3ee580){return _0x110020['includes'](_0x3ee580[_0x7364('0x37')]);});return{'count':_0x8316b9[_0x7364('0x4b')],'rows':_[_0x7364('0x40')](_0x8316b9,function(_0x534918){return{'id':_0x534918[_0x7364('0x37')],'name':_0x534918[_0x7364('0x7d')],'custom':_['endsWith'](_0x534918[_0x7364('0x37')],'_c')?!![]:![],'options':_0x534918[_0x7364('0x53')]?_[_0x7364('0x40')](_[_0x7364('0x7a')](_0x534918[_0x7364('0x53')]),function(_0x5a206d){return{'name':_0x5a206d[_0x7364('0x7e')],'value':_0x5a206d[_0x7364('0x37')]};}):[]};})};}})['then'](respondWithResult(_0x288e80,null))[_0x7364('0x57')](function(_0x381eca){var _0x29787b=_0x3ea4b5[_0x7364('0x47')][_0x7364('0x7f')]?0x1f4:_0x381eca['statusCode']||0x1f4;logger[_0x7364('0x22')](_0x7364('0x80'),_0x7364('0x81'),_0x29787b,JSON[_0x7364('0x21')](_0x381eca));delete _0x381eca[_0x7364('0x37')];if(_0x29787b===0x191){_0x29787b=0x190;}_0x288e80['status'](_0x29787b)[_0x7364('0x38')](_0x3ea4b5[_0x7364('0x47')][_0x7364('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x381eca[_0x7364('0x82')]}:_0x381eca);});}else{var _0x497964=0x1f4;_0x288e80[_0x7364('0x29')](_0x497964)[_0x7364('0x38')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x5274=['remove','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','then','request\x20sent','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','stack','name','send','render','merge','agent','interaction','account','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','show','keys','include','find','create','body','params','destroy','findOne','SugarcrmConfiguration','nolimit','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','Subjects','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5274,0x86));var _0x4527=function(_0x3eb4ae,_0x493c5b){_0x3eb4ae=_0x3eb4ae-0x0;var _0x1aa0d4=_0x5274[_0x3eb4ae];return _0x1aa0d4;};'use strict';var emlformat=require(_0x4527('0x0'));var rimraf=require(_0x4527('0x1'));var zipdir=require(_0x4527('0x2'));var jsonpatch=require(_0x4527('0x3'));var rp=require(_0x4527('0x4'));var moment=require(_0x4527('0x5'));var BPromise=require(_0x4527('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4527('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4527('0x8'));var fs=require('fs');var fs_extra=require(_0x4527('0x9'));var _=require(_0x4527('0xa'));var squel=require(_0x4527('0xb'));var crypto=require(_0x4527('0xc'));var jsforce=require(_0x4527('0xd'));var deskjs=require(_0x4527('0xe'));var toCsv=require(_0x4527('0xf'));var querystring=require(_0x4527('0x10'));var Papa=require(_0x4527('0x11'));var Redis=require(_0x4527('0x12'));var authService=require(_0x4527('0x13'));var qs=require(_0x4527('0x14'));var as=require(_0x4527('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4527('0x16'))('api');var utils=require(_0x4527('0x17'));var config=require(_0x4527('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4527('0x19'));var jayson=require(_0x4527('0x1a'));var client=jayson['client'][_0x4527('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1690ea,_0x2c9a3e,_0x3f92a2,_0x140c3f){return new BPromise(function(_0x2d3fd1,_0x108e5f){var _0x4b9bb9=_0x140c3f||client;return _0x4b9bb9['request'](_0x1690ea,_0x3f92a2)[_0x4527('0x1c')](function(_0x490da6){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x2c9a3e,_0x4527('0x1d'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2c9a3e,_0x4527('0x1d'),JSON['stringify'](_0x490da6));if(_0x490da6[_0x4527('0x1e')]){if(_0x490da6[_0x4527('0x1e')][_0x4527('0x1f')]===0x1f4){logger[_0x4527('0x1e')](_0x4527('0x20'),_0x2c9a3e,_0x490da6['error']['message']);return _0x108e5f(_0x490da6[_0x4527('0x1e')][_0x4527('0x21')]);}logger[_0x4527('0x1e')]('SugarcrmAccount,\x20%s,\x20%s',_0x2c9a3e,_0x490da6['error'][_0x4527('0x21')]);return _0x2d3fd1(_0x490da6[_0x4527('0x1e')]['message']);}else{logger[_0x4527('0x22')](_0x4527('0x20'),_0x2c9a3e,'request\x20sent');_0x2d3fd1(_0x490da6[_0x4527('0x23')][_0x4527('0x21')]);}})[_0x4527('0x24')](function(_0x4ef721){logger[_0x4527('0x1e')](_0x4527('0x20'),_0x2c9a3e,_0x4ef721);_0x108e5f(_0x4ef721);});});}function respondWithStatusCode(_0x549d17,_0x23acc4){_0x23acc4=_0x23acc4||0xcc;return function(_0x4c16ca){if(_0x4c16ca){return _0x549d17[_0x4527('0x25')](_0x23acc4);}return _0x549d17[_0x4527('0x26')](_0x23acc4)[_0x4527('0x27')]();};}function respondWithResult(_0xfe8cc5,_0x5cd68b){_0x5cd68b=_0x5cd68b||0xc8;return function(_0x241723){if(_0x241723){return _0xfe8cc5['status'](_0x5cd68b)['json'](_0x241723);}};}function respondWithFilteredResult(_0x4456ba,_0x3143d9){return function(_0x1f84f8){if(_0x1f84f8){var _0x62fb6f=typeof _0x3143d9[_0x4527('0x28')]===_0x4527('0x29')&&typeof _0x3143d9[_0x4527('0x2a')]===_0x4527('0x29');var _0x48aa99=_0x1f84f8[_0x4527('0x2b')];var _0x418033=_0x62fb6f?0x0:_0x3143d9[_0x4527('0x28')];var _0x44864c=_0x62fb6f?_0x1f84f8[_0x4527('0x2b')]:_0x3143d9[_0x4527('0x28')]+_0x3143d9[_0x4527('0x2a')];var _0x1617dc;if(_0x44864c>=_0x48aa99){_0x44864c=_0x48aa99;_0x1617dc=0xc8;}else{_0x1617dc=0xce;}_0x4456ba[_0x4527('0x26')](_0x1617dc);return _0x4456ba['set']('Content-Range',_0x418033+'-'+_0x44864c+'/'+_0x48aa99)[_0x4527('0x2c')](_0x1f84f8);}return null;};}function patchUpdates(_0x11d1c2){return function(_0x2b5e85){try{jsonpatch[_0x4527('0x2d')](_0x2b5e85,_0x11d1c2,!![]);}catch(_0x180e36){return BPromise['reject'](_0x180e36);}return _0x2b5e85[_0x4527('0x2e')]();};}function saveUpdates(_0xfd1711,_0x3bfd57){return function(_0x3cd747){if(_0x3cd747){return _0x3cd747['update'](_0xfd1711)[_0x4527('0x1c')](function(_0xd3b960){return _0xd3b960;});}return null;};}function removeEntity(_0x38ef44,_0x419de9){return function(_0x3e7638){if(_0x3e7638){return _0x3e7638['destroy']()[_0x4527('0x1c')](function(){_0x38ef44[_0x4527('0x26')](0xcc)[_0x4527('0x27')]();});}};}function handleEntityNotFound(_0x90d163,_0x5186a8){return function(_0x45365f){if(!_0x45365f){_0x90d163[_0x4527('0x25')](0x194);}return _0x45365f;};}function handleError(_0x55100c,_0x300c98){_0x300c98=_0x300c98||0x1f4;return function(_0x461833){logger[_0x4527('0x1e')](_0x461833[_0x4527('0x2f')]);if(_0x461833[_0x4527('0x30')]){delete _0x461833[_0x4527('0x30')];}_0x55100c[_0x4527('0x26')](_0x300c98)[_0x4527('0x31')](_0x461833);};}function getMustacheRender(_0x1e8044,_0x43db2d){return Mustache[_0x4527('0x32')](_0x1e8044,_[_0x4527('0x33')](_0x43db2d['body'],{'contact':_0x43db2d['contact'],'message':_0x43db2d[_0x4527('0x21')],'agent':_0x43db2d[_0x4527('0x34')],'interaction':_0x43db2d[_0x4527('0x35')],'account':_0x43db2d[_0x4527('0x36')]}))||'';}exports[_0x4527('0x37')]=function(_0x12a95b,_0x4d3c3d){var _0x13ed00={},_0x4f5e5d={},_0x4b3fa4={'count':0x0,'rows':[]};var _0x300714=_[_0x4527('0x38')](db[_0x4527('0x39')][_0x4527('0x3a')],function(_0xa1be81){return{'name':_0xa1be81[_0x4527('0x3b')],'type':_0xa1be81[_0x4527('0x3c')][_0x4527('0x3d')]};});_0x4f5e5d[_0x4527('0x3e')]=_[_0x4527('0x38')](_0x300714,_0x4527('0x30'));_0x4f5e5d['query']=_['keys'](_0x12a95b['query']);_0x4f5e5d[_0x4527('0x3f')]=_[_0x4527('0x40')](_0x4f5e5d[_0x4527('0x3e')],_0x4f5e5d[_0x4527('0x41')]);_0x13ed00[_0x4527('0x42')]=_[_0x4527('0x40')](_0x4f5e5d[_0x4527('0x3e')],qs[_0x4527('0x43')](_0x12a95b[_0x4527('0x41')][_0x4527('0x43')]));_0x13ed00['attributes']=_0x13ed00[_0x4527('0x42')][_0x4527('0x44')]?_0x13ed00[_0x4527('0x42')]:_0x4f5e5d['model'];if(!_0x12a95b[_0x4527('0x41')][_0x4527('0x45')]('nolimit')){_0x13ed00[_0x4527('0x2a')]=qs[_0x4527('0x2a')](_0x12a95b[_0x4527('0x41')][_0x4527('0x2a')]);_0x13ed00['offset']=qs[_0x4527('0x28')](_0x12a95b[_0x4527('0x41')][_0x4527('0x28')]);}_0x13ed00[_0x4527('0x46')]=qs[_0x4527('0x47')](_0x12a95b['query'][_0x4527('0x47')]);_0x13ed00[_0x4527('0x48')]=qs[_0x4527('0x3f')](_[_0x4527('0x49')](_0x12a95b[_0x4527('0x41')],_0x4f5e5d[_0x4527('0x3f')]),_0x300714);if(_0x12a95b[_0x4527('0x41')][_0x4527('0x4a')]){_0x13ed00[_0x4527('0x48')]=_[_0x4527('0x33')](_0x13ed00[_0x4527('0x48')],{'$or':_[_0x4527('0x38')](_0x300714,function(_0x2987ae){if(_0x2987ae['type']!==_0x4527('0x4b')){var _0x34492c={};_0x34492c[_0x2987ae[_0x4527('0x30')]]={'$like':'%'+_0x12a95b[_0x4527('0x41')]['filter']+'%'};return _0x34492c;}})});}_0x13ed00=_[_0x4527('0x33')]({},_0x13ed00,_0x12a95b[_0x4527('0x4c')]);var _0x55f65d={'where':_0x13ed00[_0x4527('0x48')]};return db[_0x4527('0x39')][_0x4527('0x2b')](_0x55f65d)['then'](function(_0x560a30){_0x4b3fa4[_0x4527('0x2b')]=_0x560a30;if(_0x12a95b[_0x4527('0x41')][_0x4527('0x4d')]){_0x13ed00['include']=[{'all':!![]}];}return db[_0x4527('0x39')]['findAll'](_0x13ed00);})['then'](function(_0x311745){_0x4b3fa4['rows']=_0x311745;return _0x4b3fa4;})[_0x4527('0x1c')](respondWithFilteredResult(_0x4d3c3d,_0x13ed00))[_0x4527('0x24')](handleError(_0x4d3c3d,null));};exports[_0x4527('0x4e')]=function(_0x521bf8,_0x5ec432){var _0x4ace6e={'raw':![],'where':{'id':_0x521bf8['params']['id']}},_0x12fa4d={};_0x12fa4d[_0x4527('0x3e')]=_[_0x4527('0x4f')](db[_0x4527('0x39')][_0x4527('0x3a')]);_0x12fa4d[_0x4527('0x41')]=_[_0x4527('0x4f')](_0x521bf8[_0x4527('0x41')]);_0x12fa4d[_0x4527('0x3f')]=_[_0x4527('0x40')](_0x12fa4d[_0x4527('0x3e')],_0x12fa4d[_0x4527('0x41')]);_0x4ace6e['attributes']=_[_0x4527('0x40')](_0x12fa4d[_0x4527('0x3e')],qs[_0x4527('0x43')](_0x521bf8[_0x4527('0x41')]['fields']));_0x4ace6e[_0x4527('0x42')]=_0x4ace6e[_0x4527('0x42')]['length']?_0x4ace6e['attributes']:_0x12fa4d['model'];if(_0x521bf8['query'][_0x4527('0x4d')]){_0x4ace6e[_0x4527('0x50')]=[{'all':!![]}];}_0x4ace6e=_[_0x4527('0x33')]({},_0x4ace6e,_0x521bf8[_0x4527('0x4c')]);return db[_0x4527('0x39')][_0x4527('0x51')](_0x4ace6e)['then'](handleEntityNotFound(_0x5ec432,null))[_0x4527('0x1c')](respondWithResult(_0x5ec432,null))[_0x4527('0x24')](handleError(_0x5ec432,null));};exports[_0x4527('0x52')]=function(_0x3f7e5a,_0x144ea8){return db['SugarcrmAccount'][_0x4527('0x52')](_0x3f7e5a[_0x4527('0x53')],{})['then'](respondWithResult(_0x144ea8,0xc9))[_0x4527('0x24')](handleError(_0x144ea8,null));};exports['update']=function(_0xcc2b1,_0xccc6d6){if(_0xcc2b1['body']['id']){delete _0xcc2b1[_0x4527('0x53')]['id'];}return db[_0x4527('0x39')][_0x4527('0x51')]({'where':{'id':_0xcc2b1[_0x4527('0x54')]['id']}})[_0x4527('0x1c')](handleEntityNotFound(_0xccc6d6,null))[_0x4527('0x1c')](saveUpdates(_0xcc2b1[_0x4527('0x53')],null))[_0x4527('0x1c')](respondWithResult(_0xccc6d6,null))['catch'](handleError(_0xccc6d6,null));};exports[_0x4527('0x55')]=function(_0x750aec,_0x3e1115){return db[_0x4527('0x39')]['find']({'where':{'id':_0x750aec[_0x4527('0x54')]['id']}})[_0x4527('0x1c')](handleEntityNotFound(_0x3e1115,null))[_0x4527('0x1c')](removeEntity(_0x3e1115,null))['catch'](handleError(_0x3e1115,null));};exports['getConfigurations']=function(_0x35130c,_0x4e006b,_0x502e23){var _0x10a778={};var _0x3440c1={};var _0x342cad;var _0xad9547;return db[_0x4527('0x39')][_0x4527('0x56')]({'where':{'id':_0x35130c[_0x4527('0x54')]['id']}})[_0x4527('0x1c')](handleEntityNotFound(_0x4e006b,null))[_0x4527('0x1c')](function(_0x23e42d){if(_0x23e42d){_0x342cad=_0x23e42d;_0x3440c1[_0x4527('0x3e')]=_['keys'](db[_0x4527('0x57')][_0x4527('0x3a')]);_0x3440c1[_0x4527('0x41')]=_[_0x4527('0x4f')](_0x35130c['query']);_0x3440c1['filters']=_[_0x4527('0x40')](_0x3440c1['model'],_0x3440c1[_0x4527('0x41')]);_0x10a778['attributes']=_['intersection'](_0x3440c1[_0x4527('0x3e')],qs[_0x4527('0x43')](_0x35130c['query'][_0x4527('0x43')]));_0x10a778['attributes']=_0x10a778['attributes']['length']?_0x10a778[_0x4527('0x42')]:_0x3440c1['model'];_0x10a778[_0x4527('0x46')]=qs[_0x4527('0x47')](_0x35130c['query'][_0x4527('0x47')]);_0x10a778[_0x4527('0x48')]=qs[_0x4527('0x3f')](_[_0x4527('0x49')](_0x35130c['query'],_0x3440c1[_0x4527('0x3f')]));if(_0x35130c[_0x4527('0x41')][_0x4527('0x4a')]){_0x10a778[_0x4527('0x48')]=_['merge'](_0x10a778[_0x4527('0x48')],{'$or':_['map'](_0x10a778[_0x4527('0x42')],function(_0xbbc771){var _0x4795de={};_0x4795de[_0xbbc771]={'$like':'%'+_0x35130c['query'][_0x4527('0x4a')]+'%'};return _0x4795de;})});}_0x10a778=_[_0x4527('0x33')]({},_0x10a778,_0x35130c[_0x4527('0x4c')]);return _0x342cad['getConfigurations'](_0x10a778);}})[_0x4527('0x1c')](function(_0x39696d){if(_0x39696d){_0xad9547=_0x39696d['length'];if(!_0x35130c[_0x4527('0x41')][_0x4527('0x45')](_0x4527('0x58'))){_0x10a778['limit']=qs['limit'](_0x35130c[_0x4527('0x41')][_0x4527('0x2a')]);_0x10a778['offset']=qs[_0x4527('0x28')](_0x35130c[_0x4527('0x41')][_0x4527('0x28')]);}return _0x342cad[_0x4527('0x59')](_0x10a778);}})['then'](function(_0x168e4d){if(_0x168e4d){return _0x168e4d?{'count':_0xad9547,'rows':_0x168e4d}:null;}})['then'](respondWithResult(_0x4e006b,null))[_0x4527('0x24')](handleError(_0x4e006b,null));};exports[_0x4527('0x5a')]=function(_0xfdd769,_0x27e2e4,_0x506c7d){if(_0xfdd769[_0x4527('0x53')]['id']){delete _0xfdd769[_0x4527('0x53')]['id'];}return db[_0x4527('0x39')]['findOne']({'where':{'id':_0xfdd769[_0x4527('0x54')]['id']}})['then'](handleEntityNotFound(_0x27e2e4,null))[_0x4527('0x1c')](function(_0x2c88c2){if(_0x2c88c2){_0xfdd769[_0x4527('0x53')]['AccountId']=_0x2c88c2['id'];_0xfdd769[_0x4527('0x53')]['Subjects']=integrations[_0x4527('0x5b')](_0xfdd769[_0x4527('0x53')][_0x4527('0x5c')],_0xfdd769[_0x4527('0x53')][_0x4527('0x3c')]);_0xfdd769[_0x4527('0x53')][_0x4527('0x5d')]=integrations['getDescriptions'](_0xfdd769['body'][_0x4527('0x5c')],_0xfdd769['body'][_0x4527('0x3c')]);return db[_0x4527('0x57')][_0x4527('0x52')](_0xfdd769[_0x4527('0x53')],{'include':[{'model':db['SugarcrmField'],'as':_0x4527('0x5e')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x4527('0x1c')](respondWithResult(_0x27e2e4,null))['catch'](handleError(_0x27e2e4,null));};exports[_0x4527('0x5f')]=function(_0x4dca84,_0x416c92,_0x32c1b5){var _0x2c0d64='';var _0xab842b=['id',_0x4527('0x30'),_0x4527('0x60'),'created_by',_0x4527('0x61'),_0x4527('0x62'),_0x4527('0x63'),_0x4527('0x64'),_0x4527('0x65'),_0x4527('0x66'),_0x4527('0x67'),_0x4527('0x68')];return db[_0x4527('0x39')][_0x4527('0x56')]({'where':{'id':_0x4dca84['params']['id']},'attributes':['id',_0x4527('0x69'),'password',_0x4527('0x6a')]})[_0x4527('0x1c')](handleEntityNotFound(_0x416c92,null))[_0x4527('0x1c')](function(_0x5fcbc9){if(_0x5fcbc9){_0x2c0d64=_0x5fcbc9[_0x4527('0x6a')];var _0x3d8a07=_0x2c0d64[_0x4527('0x6b')](-0x1);if(_0x3d8a07==='/'){_0x2c0d64=_0x2c0d64[_0x4527('0x6c')](0x0,_0x2c0d64[_0x4527('0x6d')](_0x3d8a07));}return rp({'method':_0x4527('0x6e'),'uri':util[_0x4527('0x6f')](_0x4527('0x70'),_0x2c0d64,_0x4527('0x71')),'json':!![],'form':{'method':_0x4527('0x72'),'input_type':_0x4527('0x73'),'response_type':_0x4527('0x73'),'rest_data':JSON[_0x4527('0x74')]({'user_auth':{'user_name':_0x5fcbc9[_0x4527('0x69')],'password':_0x5fcbc9[_0x4527('0x75')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x4eee5c){if(_0x4eee5c&&_0x4eee5c[_0x4527('0x30')]!==_0x4527('0x76')&&_0x4eee5c[_0x4527('0x30')]!==_0x4527('0x77')){return rp({'method':_0x4527('0x6e'),'uri':util[_0x4527('0x6f')](_0x4527('0x70'),_0x2c0d64,_0x4527('0x71')),'json':!![],'form':{'method':_0x4527('0x78'),'input_type':'JSON','response_type':_0x4527('0x73'),'rest_data':JSON['stringify']({'session':_0x4eee5c['id'],'module_name':_0x4527('0x79')})}})['then'](function(_0x75bf52){if(_0x75bf52){var _0x389d77=_[_0x4527('0x7a')](_0x75bf52[_0x4527('0x7b')]);_[_0x4527('0x7c')](_0x389d77,function(_0x5ad6a4){return _0xab842b['includes'](_0x5ad6a4[_0x4527('0x30')]);});return{'count':_0x389d77['length'],'rows':_[_0x4527('0x38')](_0x389d77,function(_0x249213){return{'id':_0x249213[_0x4527('0x30')],'name':_0x249213[_0x4527('0x7d')],'custom':_['endsWith'](_0x249213[_0x4527('0x30')],'_c')?!![]:![],'options':_0x249213[_0x4527('0x4c')]?_[_0x4527('0x38')](_[_0x4527('0x7a')](_0x249213['options']),function(_0x3daf7b){return{'name':_0x3daf7b['value'],'value':_0x3daf7b['name']};}):[]};})};}})['then'](respondWithResult(_0x416c92,null))['catch'](function(_0x374815){var _0x3a63a5=_0x4dca84['query']['test']?0x1f4:_0x374815[_0x4527('0x7e')]||0x1f4;logger[_0x4527('0x1e')](_0x4527('0x7f'),_0x4527('0x5f'),_0x3a63a5,JSON[_0x4527('0x74')](_0x374815));delete _0x374815[_0x4527('0x30')];if(_0x3a63a5===0x191){_0x3a63a5=0x190;}_0x416c92[_0x4527('0x26')](_0x3a63a5)['send'](_0x4dca84['query']['test']?{'message':_0x4527('0x80'),'statusCode':_0x374815[_0x4527('0x7e')]}:_0x374815);});}else{var _0x500b2c=0x1f4;_0x416c92['status'](_0x500b2c)[_0x4527('0x31')]({'message':_0x4527('0x80'),'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 b667f78..ed6f17d 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 _0xbf4f=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xbf4f,0x93));var _0xfbf4=function(_0x188650,_0xc40d8){_0x188650=_0x188650-0x0;var _0x4db216=_0xbf4f[_0x188650];return _0x4db216;};'use strict';var _=require(_0xfbf4('0x0'));var util=require(_0xfbf4('0x1'));var logger=require(_0xfbf4('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfbf4('0x3'));var fs=require('fs');var path=require(_0xfbf4('0x4'));var rimraf=require(_0xfbf4('0x5'));var config=require(_0xfbf4('0x6'));var attributes=require(_0xfbf4('0x7'));var integrations=require(_0xfbf4('0x8'));module['exports']=function(_0x372205,_0x53dda4){return _0x372205['define'](_0xfbf4('0x9'),attributes,{'tableName':_0xfbf4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28b2=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x28b2,0xb8));var _0x228b=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x28b2[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x228b('0x0'));var util=require(_0x228b('0x1'));var logger=require(_0x228b('0x2'))('api');var moment=require(_0x228b('0x3'));var BPromise=require(_0x228b('0x4'));var rp=require(_0x228b('0x5'));var fs=require('fs');var path=require(_0x228b('0x6'));var rimraf=require(_0x228b('0x7'));var config=require(_0x228b('0x8'));var attributes=require(_0x228b('0x9'));var integrations=require(_0x228b('0xa'));module[_0x228b('0xb')]=function(_0x224a05,_0x5e8e9a){return _0x224a05['define'](_0x228b('0xc'),attributes,{'tableName':_0x228b('0xd'),'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 fa2630f..5b6ee06 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 _0x5424=['SugarcrmAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount'];(function(_0x57f76b,_0xc96c29){var _0x33c4df=function(_0x48e85d){while(--_0x48e85d){_0x57f76b['push'](_0x57f76b['shift']());}};_0x33c4df(++_0xc96c29);}(_0x5424,0xc2));var _0x4542=function(_0x42fbdd,_0xbb21a3){_0x42fbdd=_0x42fbdd-0x0;var _0x525b95=_0x5424[_0x42fbdd];return _0x525b95;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4542('0x0'));var BPromise=require(_0x4542('0x1'));var rs=require(_0x4542('0x2'));var fs=require('fs');var Redis=require(_0x4542('0x3'));var db=require(_0x4542('0x4'))['db'];var utils=require(_0x4542('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4542('0x6'));var client=jayson[_0x4542('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b438e,_0x16c46c,_0x5a4f53){return new BPromise(function(_0x1b89ff,_0x596c2d){return client[_0x4542('0x8')](_0x4b438e,_0x5a4f53)[_0x4542('0x9')](function(_0x269cef){logger[_0x4542('0xa')](_0x4542('0xb'),_0x16c46c,_0x4542('0xc'));logger[_0x4542('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x16c46c,_0x4542('0xc'),JSON['stringify'](_0x269cef));if(_0x269cef['error']){if(_0x269cef['error'][_0x4542('0xe')]===0x1f4){logger[_0x4542('0xf')](_0x4542('0xb'),_0x16c46c,_0x269cef[_0x4542('0xf')][_0x4542('0x10')]);return _0x596c2d(_0x269cef[_0x4542('0xf')]['message']);}logger[_0x4542('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x16c46c,_0x269cef['error'][_0x4542('0x10')]);return _0x1b89ff(_0x269cef['error'][_0x4542('0x10')]);}else{logger[_0x4542('0xa')](_0x4542('0xb'),_0x16c46c,_0x4542('0xc'));_0x1b89ff(_0x269cef[_0x4542('0x11')][_0x4542('0x10')]);}})[_0x4542('0x12')](function(_0x1ae691){logger[_0x4542('0xf')](_0x4542('0xb'),_0x16c46c,_0x1ae691);_0x596c2d(_0x1ae691);});});}exports['GetSugarcrmAccount']=function(_0x51a58e){var _0x4253fc=this;return new Promise(function(_0x5a637f,_0xf1d9f5){return db['SugarcrmAccount'][_0x4542('0x13')]({'raw':_0x51a58e[_0x4542('0x14')]?_0x51a58e['options'][_0x4542('0x15')]===undefined?!![]:![]:!![],'where':_0x51a58e[_0x4542('0x14')]?_0x51a58e['options'][_0x4542('0x16')]||null:null,'attributes':_0x51a58e['options']?_0x51a58e[_0x4542('0x14')][_0x4542('0x17')]||null:null,'limit':_0x51a58e[_0x4542('0x14')]?_0x51a58e[_0x4542('0x14')][_0x4542('0x18')]||null:null,'include':_0x51a58e['options']?_0x51a58e[_0x4542('0x14')][_0x4542('0x19')]?_[_0x4542('0x1a')](_0x51a58e[_0x4542('0x14')][_0x4542('0x19')],function(_0x554818){return{'model':db[_0x554818[_0x4542('0x1b')]],'as':_0x554818['as'],'attributes':_0x554818[_0x4542('0x17')],'include':_0x554818['include']?_[_0x4542('0x1a')](_0x554818[_0x4542('0x19')],function(_0x4bae98){return{'model':db[_0x4bae98[_0x4542('0x1b')]],'as':_0x4bae98['as'],'attributes':_0x4bae98[_0x4542('0x17')],'include':_0x4bae98[_0x4542('0x19')]?_[_0x4542('0x1a')](_0x4bae98[_0x4542('0x19')],function(_0xfbdd1c){return{'model':db[_0xfbdd1c[_0x4542('0x1b')]],'as':_0xfbdd1c['as'],'attributes':_0xfbdd1c[_0x4542('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a71cb){logger['info'](_0x4542('0x1c'),_0x51a58e);logger[_0x4542('0xd')]('GetSugarcrmAccount',_0x51a58e,JSON['stringify'](_0x4a71cb));_0x5a637f(_0x4a71cb);})['catch'](function(_0xe88956){logger[_0x4542('0xf')](_0x4542('0x1c'),_0xe88956['message'],_0x51a58e);_0xf1d9f5(_0x4253fc[_0x4542('0xf')](0x1f4,_0xe88956[_0x4542('0x10')]));});});};exports[_0x4542('0x1d')]=function(_0x4e2876){var _0x2919fb=this;return new Promise(function(_0x209f36,_0x5c8bef){return db[_0x4542('0x1e')][_0x4542('0x1f')]({'raw':_0x4e2876['options']?_0x4e2876[_0x4542('0x14')][_0x4542('0x15')]===undefined?!![]:![]:!![],'where':_0x4e2876[_0x4542('0x14')]?_0x4e2876[_0x4542('0x14')]['where']||null:null,'attributes':_0x4e2876[_0x4542('0x14')]?_0x4e2876[_0x4542('0x14')][_0x4542('0x17')]||null:null,'include':_0x4e2876[_0x4542('0x14')]?_0x4e2876['options'][_0x4542('0x19')]?_['map'](_0x4e2876[_0x4542('0x14')][_0x4542('0x19')],function(_0x208203){return{'model':db[_0x208203[_0x4542('0x1b')]],'as':_0x208203['as'],'attributes':_0x208203[_0x4542('0x17')],'include':_0x208203['include']?_[_0x4542('0x1a')](_0x208203[_0x4542('0x19')],function(_0x2c398f){return{'model':db[_0x2c398f[_0x4542('0x1b')]],'as':_0x2c398f['as'],'attributes':_0x2c398f[_0x4542('0x17')],'include':_0x2c398f[_0x4542('0x19')]?_[_0x4542('0x1a')](_0x2c398f[_0x4542('0x19')],function(_0x562763){return{'model':db[_0x562763['model']],'as':_0x562763['as'],'attributes':_0x562763[_0x4542('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4542('0x9')](function(_0x39fc40){logger[_0x4542('0xa')]('ShowSugarcrmAccount',_0x4e2876);logger['debug'](_0x4542('0x1d'),_0x4e2876,JSON['stringify'](_0x39fc40));_0x209f36(_0x39fc40);})['catch'](function(_0x5c5b19){logger['error'](_0x4542('0x1d'),_0x5c5b19[_0x4542('0x10')],_0x4e2876);_0x5c8bef(_0x2919fb[_0x4542('0xf')](0x1f4,_0x5c5b19[_0x4542('0x10')]));});});}; \ No newline at end of file +var _0xcc06=['ShowSugarcrmAccount','find','stringify','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','model','attributes','map'];(function(_0xdde67b,_0x57b6cf){var _0x32f406=function(_0x35a26f){while(--_0x35a26f){_0xdde67b['push'](_0xdde67b['shift']());}};_0x32f406(++_0x57b6cf);}(_0xcc06,0xe3));var _0x6cc0=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xcc06[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6cc0('0x0'));var fs=require('fs');var Redis=require(_0x6cc0('0x1'));var db=require(_0x6cc0('0x2'))['db'];var utils=require(_0x6cc0('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6cc0('0x4'));var jayson=require(_0x6cc0('0x5'));var client=jayson[_0x6cc0('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x405b6c,_0x713af9,_0x2ff93a){return new BPromise(function(_0x275c93,_0x149e2d){return client[_0x6cc0('0x7')](_0x405b6c,_0x2ff93a)[_0x6cc0('0x8')](function(_0x46806d){logger[_0x6cc0('0x9')](_0x6cc0('0xa'),_0x713af9,_0x6cc0('0xb'));logger[_0x6cc0('0xc')](_0x6cc0('0xd'),_0x713af9,'request\x20sent',JSON['stringify'](_0x46806d));if(_0x46806d[_0x6cc0('0xe')]){if(_0x46806d['error'][_0x6cc0('0xf')]===0x1f4){logger['error'](_0x6cc0('0xa'),_0x713af9,_0x46806d[_0x6cc0('0xe')]['message']);return _0x149e2d(_0x46806d['error'][_0x6cc0('0x10')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x713af9,_0x46806d[_0x6cc0('0xe')]['message']);return _0x275c93(_0x46806d[_0x6cc0('0xe')][_0x6cc0('0x10')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x713af9,_0x6cc0('0xb'));_0x275c93(_0x46806d['result']['message']);}})[_0x6cc0('0x11')](function(_0x20d501){logger['error'](_0x6cc0('0xa'),_0x713af9,_0x20d501);_0x149e2d(_0x20d501);});});}exports[_0x6cc0('0x12')]=function(_0x2dde5b){var _0x4283eb=this;return new Promise(function(_0x38ea0e,_0x180ad4){return db[_0x6cc0('0x13')][_0x6cc0('0x14')]({'raw':_0x2dde5b[_0x6cc0('0x15')]?_0x2dde5b['options'][_0x6cc0('0x16')]===undefined?!![]:![]:!![],'where':_0x2dde5b[_0x6cc0('0x15')]?_0x2dde5b[_0x6cc0('0x15')][_0x6cc0('0x17')]||null:null,'attributes':_0x2dde5b[_0x6cc0('0x15')]?_0x2dde5b[_0x6cc0('0x15')]['attributes']||null:null,'limit':_0x2dde5b[_0x6cc0('0x15')]?_0x2dde5b[_0x6cc0('0x15')][_0x6cc0('0x18')]||null:null,'include':_0x2dde5b[_0x6cc0('0x15')]?_0x2dde5b[_0x6cc0('0x15')][_0x6cc0('0x19')]?_['map'](_0x2dde5b[_0x6cc0('0x15')][_0x6cc0('0x19')],function(_0x22d28f){return{'model':db[_0x22d28f[_0x6cc0('0x1a')]],'as':_0x22d28f['as'],'attributes':_0x22d28f[_0x6cc0('0x1b')],'include':_0x22d28f['include']?_[_0x6cc0('0x1c')](_0x22d28f['include'],function(_0x58327e){return{'model':db[_0x58327e[_0x6cc0('0x1a')]],'as':_0x58327e['as'],'attributes':_0x58327e['attributes'],'include':_0x58327e[_0x6cc0('0x19')]?_[_0x6cc0('0x1c')](_0x58327e['include'],function(_0x409d71){return{'model':db[_0x409d71['model']],'as':_0x409d71['as'],'attributes':_0x409d71['attributes']};}):[]};}):[]};}):[]:[]})[_0x6cc0('0x8')](function(_0x3d770d){logger['info'](_0x6cc0('0x12'),_0x2dde5b);logger[_0x6cc0('0xc')]('GetSugarcrmAccount',_0x2dde5b,JSON['stringify'](_0x3d770d));_0x38ea0e(_0x3d770d);})[_0x6cc0('0x11')](function(_0x27d9fd){logger['error'](_0x6cc0('0x12'),_0x27d9fd[_0x6cc0('0x10')],_0x2dde5b);_0x180ad4(_0x4283eb[_0x6cc0('0xe')](0x1f4,_0x27d9fd[_0x6cc0('0x10')]));});});};exports[_0x6cc0('0x1d')]=function(_0x3848d6){var _0x21f318=this;return new Promise(function(_0x3bd828,_0x14c640){return db[_0x6cc0('0x13')][_0x6cc0('0x1e')]({'raw':_0x3848d6['options']?_0x3848d6[_0x6cc0('0x15')][_0x6cc0('0x16')]===undefined?!![]:![]:!![],'where':_0x3848d6[_0x6cc0('0x15')]?_0x3848d6[_0x6cc0('0x15')][_0x6cc0('0x17')]||null:null,'attributes':_0x3848d6[_0x6cc0('0x15')]?_0x3848d6[_0x6cc0('0x15')][_0x6cc0('0x1b')]||null:null,'include':_0x3848d6[_0x6cc0('0x15')]?_0x3848d6['options'][_0x6cc0('0x19')]?_['map'](_0x3848d6['options']['include'],function(_0x4fdd9c){return{'model':db[_0x4fdd9c[_0x6cc0('0x1a')]],'as':_0x4fdd9c['as'],'attributes':_0x4fdd9c[_0x6cc0('0x1b')],'include':_0x4fdd9c[_0x6cc0('0x19')]?_[_0x6cc0('0x1c')](_0x4fdd9c[_0x6cc0('0x19')],function(_0x131243){return{'model':db[_0x131243[_0x6cc0('0x1a')]],'as':_0x131243['as'],'attributes':_0x131243[_0x6cc0('0x1b')],'include':_0x131243[_0x6cc0('0x19')]?_[_0x6cc0('0x1c')](_0x131243[_0x6cc0('0x19')],function(_0x4ff531){return{'model':db[_0x4ff531[_0x6cc0('0x1a')]],'as':_0x4ff531['as'],'attributes':_0x4ff531['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d1ddf){logger[_0x6cc0('0x9')](_0x6cc0('0x1d'),_0x3848d6);logger['debug'](_0x6cc0('0x1d'),_0x3848d6,JSON[_0x6cc0('0x1f')](_0x1d1ddf));_0x3bd828(_0x1d1ddf);})[_0x6cc0('0x11')](function(_0x58d064){logger['error'](_0x6cc0('0x1d'),_0x58d064[_0x6cc0('0x10')],_0x3848d6);_0x14c640(_0x21f318[_0x6cc0('0xe')](0x1f4,_0x58d064[_0x6cc0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index e416164..86b5368 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 _0x6849=['put','delete','destroy','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x36e10e,_0x19eb1c){var _0xc08087=function(_0x30572c){while(--_0x30572c){_0x36e10e['push'](_0x36e10e['shift']());}};_0xc08087(++_0x19eb1c);}(_0x6849,0x72));var _0x9684=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6849[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x9684('0x0'));var util=require(_0x9684('0x1'));var path=require('path');var timeout=require(_0x9684('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9684('0x3'));var config=require(_0x9684('0x4'));var controller=require(_0x9684('0x5'));router[_0x9684('0x6')]('/',auth[_0x9684('0x7')](),controller['index']);router[_0x9684('0x6')](_0x9684('0x8'),auth['isAuthenticated'](),controller[_0x9684('0x9')]);router[_0x9684('0x6')](_0x9684('0xa'),auth['isAuthenticated'](),controller[_0x9684('0xb')]);router[_0x9684('0x6')](_0x9684('0xc'),auth[_0x9684('0x7')](),controller[_0x9684('0xd')]);router[_0x9684('0x6')](_0x9684('0xe'),auth[_0x9684('0x7')](),controller[_0x9684('0xf')]);router[_0x9684('0x10')]('/',auth[_0x9684('0x7')](),controller[_0x9684('0x11')]);router[_0x9684('0x12')](_0x9684('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x9684('0x13')](_0x9684('0x8'),auth['isAuthenticated'](),controller[_0x9684('0x14')]);module[_0x9684('0x15')]=router; \ No newline at end of file +var _0xeb0e=['fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','path','connect-timeout','express','Router'];(function(_0x51f593,_0x38d2ec){var _0x4ccfbf=function(_0x4267c8){while(--_0x4267c8){_0x51f593['push'](_0x51f593['shift']());}};_0x4ccfbf(++_0x38d2ec);}(_0xeb0e,0x1c9));var _0xeeb0=function(_0x15e21c,_0x301d50){_0x15e21c=_0x15e21c-0x0;var _0x39d840=_0xeb0e[_0x15e21c];return _0x39d840;};'use strict';var multer=require(_0xeeb0('0x0'));var util=require('util');var path=require(_0xeeb0('0x1'));var timeout=require(_0xeeb0('0x2'));var express=require(_0xeeb0('0x3'));var router=express[_0xeeb0('0x4')]();var fs_extra=require(_0xeeb0('0x5'));var auth=require(_0xeeb0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeeb0('0x7'));router['get']('/',auth[_0xeeb0('0x8')](),controller[_0xeeb0('0x9')]);router[_0xeeb0('0xa')](_0xeeb0('0xb'),auth['isAuthenticated'](),controller[_0xeeb0('0xc')]);router[_0xeeb0('0xa')]('/:id/fields',auth[_0xeeb0('0x8')](),controller['getFields']);router[_0xeeb0('0xa')](_0xeeb0('0xd'),auth['isAuthenticated'](),controller[_0xeeb0('0xe')]);router[_0xeeb0('0xa')](_0xeeb0('0xf'),auth[_0xeeb0('0x8')](),controller[_0xeeb0('0x10')]);router[_0xeeb0('0x11')]('/',auth[_0xeeb0('0x8')](),controller[_0xeeb0('0x12')]);router[_0xeeb0('0x13')](_0xeeb0('0xb'),auth[_0xeeb0('0x8')](),controller[_0xeeb0('0x14')]);router[_0xeeb0('0x15')]('/:id',auth[_0xeeb0('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 2dacdc2..f84960c 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 _0x89a6=['STRING','sequelize'];(function(_0x3eca46,_0x28813b){var _0x58ebb0=function(_0x22b970){while(--_0x22b970){_0x3eca46['push'](_0x3eca46['shift']());}};_0x58ebb0(++_0x28813b);}(_0x89a6,0x7f));var _0x689a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x89a6[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x689a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x689a('0x1')]}}; \ No newline at end of file +var _0x5973=['STRING'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0x5973,0x1a2));var _0x3597=function(_0x2fa393,_0x57e26d){_0x2fa393=_0x2fa393-0x0;var _0x15a4fb=_0x5973[_0x2fa393];return _0x15a4fb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3597('0x0')]},'description':{'type':Sequelize[_0x3597('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 41c10eb..56a9b93 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 _0xa9e0=['fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','find','getFields','findOne','SugarcrmField','rawAttributes','order','options','getSubjects','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','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','merge','body','contact','account','map','SugarcrmConfiguration','fieldName','type','keys','query','filters','intersection','attributes'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=typeof _0x40c424[_0x0a9e('0x27')]==='undefined'&&typeof _0x40c424[_0x0a9e('0x28')]==='undefined';var _0x1dc186=_0x33161b[_0x0a9e('0x29')];var _0x25fba9=_0x526cf3?0x0:_0x40c424[_0x0a9e('0x27')];var _0x140511=_0x526cf3?_0x33161b[_0x0a9e('0x29')]:_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')];var _0x5a101a;if(_0x140511>=_0x1dc186){_0x140511=_0x1dc186;_0x5a101a=0xc8;}else{_0x5a101a=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x5a101a);return _0x3a8e58[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x25fba9+'-'+_0x140511+'/'+_0x1dc186)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x5c877d){return function(_0x15b200){try{jsonpatch[_0x0a9e('0x2c')](_0x15b200,_0x5c877d,!![]);}catch(_0x1843b2){return BPromise[_0x0a9e('0x2d')](_0x1843b2);}return _0x15b200[_0x0a9e('0x2e')]();};}function saveUpdates(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x2f')](_0x563b45)['then'](function(_0x426950){return _0x426950;});}return null;};}function removeEntity(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x30')]()[_0x0a9e('0x31')](function(){_0x5d1e0e[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x66c1d2,_0x46f0a5){return function(_0x40cb85){if(!_0x40cb85){_0x66c1d2[_0x0a9e('0x23')](0x194);}return _0x40cb85;};}function handleError(_0x2b45ea,_0x409319){_0x409319=_0x409319||0x1f4;return function(_0x332d35){logger[_0x0a9e('0x1d')](_0x332d35['stack']);if(_0x332d35[_0x0a9e('0x32')]){delete _0x332d35['name'];}_0x2b45ea[_0x0a9e('0x24')](_0x409319)[_0x0a9e('0x33')](_0x332d35);};}function getMustacheRender(_0x2b7e7f,_0x3f3d41){return Mustache['render'](_0x2b7e7f,_[_0x0a9e('0x34')](_0x3f3d41[_0x0a9e('0x35')],{'contact':_0x3f3d41[_0x0a9e('0x36')],'message':_0x3f3d41[_0x0a9e('0x1f')],'agent':_0x3f3d41['agent'],'interaction':_0x3f3d41['interaction'],'account':_0x3f3d41[_0x0a9e('0x37')]}))||'';}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x38')](db[_0x0a9e('0x39')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3a')],'type':_0x1dbf74[_0x0a9e('0x3b')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x38')](_0x31916f,_0x0a9e('0x32'));_0x1ef87a['query']=_[_0x0a9e('0x3c')](_0x24936a[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],qs[_0x0a9e('0x41')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x381c37[_0x0a9e('0x40')]:_0x1ef87a[_0x0a9e('0x43')];if(!_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x381c37[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x381c37[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x381c37[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x24936a[_0x0a9e('0x3d')],_0x1ef87a[_0x0a9e('0x3e')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x381c37[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x381c37[_0x0a9e('0x47')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3b')]!==_0x0a9e('0x4a')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x32')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x34')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x39')][_0x0a9e('0x29')](_0x2e9d90)[_0x0a9e('0x31')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x29')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x4c')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x4d')](_0x381c37);})[_0x0a9e('0x31')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x4e')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x31')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x22')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x4f')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':![],'where':{'id':_0x409789[_0x0a9e('0x50')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x39')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],_0x19383e[_0x0a9e('0x3d')]);_0x6054ee[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x40')]=_0x6054ee[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x43')];if(_0x409789[_0x0a9e('0x3d')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x34')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x39')]['find'](_0x6054ee)[_0x0a9e('0x31')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x31')](respondWithResult(_0x992c77,null))[_0x0a9e('0x22')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['SugarcrmConfiguration']['create'](_0x2f82da[_0x0a9e('0x35')],{})[_0x0a9e('0x31')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x2f')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x35')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x35')],null))[_0x0a9e('0x31')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x22')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x30')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x39')][_0x0a9e('0x51')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x31')](removeEntity(_0x272738,null))[_0x0a9e('0x22')](handleError(_0x272738,null));};exports[_0x0a9e('0x52')]=function(_0xb83dfd,_0x156662,_0x5d86e9){var _0x956fbe={};var _0x26bc80={};var _0x5239ef;var _0x3649cc;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0xb83dfd['params']['id']}})['then'](handleEntityNotFound(_0x156662,null))['then'](function(_0x273cb5){if(_0x273cb5){_0x5239ef=_0x273cb5;_0x26bc80['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')][_0x0a9e('0x55')]);_0x26bc80[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0xb83dfd[_0x0a9e('0x3d')]);_0x26bc80['filters']=_[_0x0a9e('0x3f')](_0x26bc80['model'],_0x26bc80[_0x0a9e('0x3d')]);_0x956fbe[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x26bc80['model'],qs[_0x0a9e('0x41')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x956fbe[_0x0a9e('0x40')]=_0x956fbe['attributes'][_0x0a9e('0x42')]?_0x956fbe[_0x0a9e('0x40')]:_0x26bc80['model'];_0x956fbe[_0x0a9e('0x56')]=qs[_0x0a9e('0x46')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x956fbe[_0x0a9e('0x47')]=qs['filters'](_[_0x0a9e('0x48')](_0xb83dfd[_0x0a9e('0x3d')],_0x26bc80[_0x0a9e('0x3e')]));if(_0xb83dfd['query'][_0x0a9e('0x49')]){_0x956fbe['where']=_['merge'](_0x956fbe[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x956fbe[_0x0a9e('0x40')],function(_0x19c995){var _0x186f39={};_0x186f39[_0x19c995]={'$like':'%'+_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x186f39;})});}_0x956fbe=_[_0x0a9e('0x34')]({},_0x956fbe,_0xb83dfd[_0x0a9e('0x57')]);return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})[_0x0a9e('0x31')](function(_0x19012b){if(_0x19012b){_0x3649cc=_0x19012b[_0x0a9e('0x42')];if(!_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x956fbe[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0xb83dfd['query'][_0x0a9e('0x28')]);_0x956fbe[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0xb83dfd['query'][_0x0a9e('0x27')]);}return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})['then'](function(_0x83f0b2){if(_0x83f0b2){return _0x83f0b2?{'count':_0x3649cc,'rows':_0x83f0b2}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x156662,null))[_0x0a9e('0x22')](handleError(_0x156662,null));};exports[_0x0a9e('0x58')]=function(_0x13b5c0,_0x4a43a8,_0x50cdce){var _0x4a2438={};var _0x40fb85={};var _0x18bf5d;var _0x1104ad;return db[_0x0a9e('0x39')][_0x0a9e('0x53')]({'where':{'id':_0x13b5c0[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x4a43a8,null))[_0x0a9e('0x31')](function(_0x5512d1){if(_0x5512d1){_0x18bf5d=_0x5512d1;_0x40fb85[_0x0a9e('0x43')]=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')]['rawAttributes']);_0x40fb85[_0x0a9e('0x3d')]=_['keys'](_0x13b5c0[_0x0a9e('0x3d')]);_0x40fb85[_0x0a9e('0x3e')]=_['intersection'](_0x40fb85[_0x0a9e('0x43')],_0x40fb85[_0x0a9e('0x3d')]);_0x4a2438[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x40fb85['model'],qs[_0x0a9e('0x41')](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x4a2438[_0x0a9e('0x40')]=_0x4a2438['attributes'][_0x0a9e('0x42')]?_0x4a2438[_0x0a9e('0x40')]:_0x40fb85[_0x0a9e('0x43')];_0x4a2438[_0x0a9e('0x56')]=qs['sort'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x4a2438[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x13b5c0[_0x0a9e('0x3d')],_0x40fb85[_0x0a9e('0x3e')]));if(_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x4a2438[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x4a2438[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x4a2438[_0x0a9e('0x40')],function(_0x5b35db){var _0xf4120f={};_0xf4120f[_0x5b35db]={'$like':'%'+_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xf4120f;})});}_0x4a2438=_['merge']({},_0x4a2438,_0x13b5c0[_0x0a9e('0x57')]);return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x2b9463){if(_0x2b9463){_0x1104ad=_0x2b9463['length'];if(!_0x13b5c0['query'][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x4a2438['limit']=qs[_0x0a9e('0x28')](_0x13b5c0['query'][_0x0a9e('0x28')]);_0x4a2438[_0x0a9e('0x27')]=qs['offset'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x3755fe){if(_0x3755fe){return _0x3755fe?{'count':_0x1104ad,'rows':_0x3755fe}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x4a43a8,null))[_0x0a9e('0x22')](handleError(_0x4a43a8,null));};exports['getDescriptions']=function(_0x2973d3,_0x3ca9b9,_0x45c109){var _0x16e5b9={};var _0x492543={};var _0xf51744;var _0xf0db1;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0x2973d3['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x3ca9b9,null))[_0x0a9e('0x31')](function(_0x3003eb){if(_0x3003eb){_0xf51744=_0x3003eb;_0x492543[_0x0a9e('0x43')]=_['keys'](db['SugarcrmField'][_0x0a9e('0x55')]);_0x492543[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0x2973d3['query']);_0x492543[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x492543['model'],_0x492543['query']);_0x16e5b9[_0x0a9e('0x40')]=_['intersection'](_0x492543['model'],qs['fields'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x16e5b9[_0x0a9e('0x40')]=_0x16e5b9[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x16e5b9[_0x0a9e('0x40')]:_0x492543['model'];_0x16e5b9[_0x0a9e('0x56')]=qs['sort'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x16e5b9[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_['pick'](_0x2973d3[_0x0a9e('0x3d')],_0x492543[_0x0a9e('0x3e')]));if(_0x2973d3[_0x0a9e('0x3d')]['filter']){_0x16e5b9[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x16e5b9[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x16e5b9[_0x0a9e('0x40')],function(_0x1910bf){var _0x32b9bd={};_0x32b9bd[_0x1910bf]={'$like':'%'+_0x2973d3[_0x0a9e('0x3d')]['filter']+'%'};return _0x32b9bd;})});}_0x16e5b9=_[_0x0a9e('0x34')]({},_0x16e5b9,_0x2973d3[_0x0a9e('0x57')]);return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x982340){if(_0x982340){_0xf0db1=_0x982340[_0x0a9e('0x42')];if(!_0x2973d3['query'][_0x0a9e('0x44')]('nolimit')){_0x16e5b9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x16e5b9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x31d25a){if(_0x31d25a){return _0x31d25a?{'count':_0xf0db1,'rows':_0x31d25a}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x3ca9b9,null))[_0x0a9e('0x22')](handleError(_0x3ca9b9,null));}; \ No newline at end of file +var _0xa9e0=['fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','find','getFields','findOne','SugarcrmField','rawAttributes','order','options','getSubjects','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','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','merge','body','contact','account','map','SugarcrmConfiguration','fieldName','type','keys','query','filters','intersection','attributes'];(function(_0x2c10fb,_0x380e1b){var _0x23e4c0=function(_0x4fdea5){while(--_0x4fdea5){_0x2c10fb['push'](_0x2c10fb['shift']());}};_0x23e4c0(++_0x380e1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=typeof _0x40c424[_0x0a9e('0x27')]==='undefined'&&typeof _0x40c424[_0x0a9e('0x28')]==='undefined';var _0x1dc186=_0x33161b[_0x0a9e('0x29')];var _0x25fba9=_0x526cf3?0x0:_0x40c424[_0x0a9e('0x27')];var _0x140511=_0x526cf3?_0x33161b[_0x0a9e('0x29')]:_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')];var _0x5a101a;if(_0x140511>=_0x1dc186){_0x140511=_0x1dc186;_0x5a101a=0xc8;}else{_0x5a101a=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x5a101a);return _0x3a8e58[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x25fba9+'-'+_0x140511+'/'+_0x1dc186)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x5c877d){return function(_0x15b200){try{jsonpatch[_0x0a9e('0x2c')](_0x15b200,_0x5c877d,!![]);}catch(_0x1843b2){return BPromise[_0x0a9e('0x2d')](_0x1843b2);}return _0x15b200[_0x0a9e('0x2e')]();};}function saveUpdates(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x2f')](_0x563b45)['then'](function(_0x426950){return _0x426950;});}return null;};}function removeEntity(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x30')]()[_0x0a9e('0x31')](function(){_0x5d1e0e[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x66c1d2,_0x46f0a5){return function(_0x40cb85){if(!_0x40cb85){_0x66c1d2[_0x0a9e('0x23')](0x194);}return _0x40cb85;};}function handleError(_0x2b45ea,_0x409319){_0x409319=_0x409319||0x1f4;return function(_0x332d35){logger[_0x0a9e('0x1d')](_0x332d35['stack']);if(_0x332d35[_0x0a9e('0x32')]){delete _0x332d35['name'];}_0x2b45ea[_0x0a9e('0x24')](_0x409319)[_0x0a9e('0x33')](_0x332d35);};}function getMustacheRender(_0x2b7e7f,_0x3f3d41){return Mustache['render'](_0x2b7e7f,_[_0x0a9e('0x34')](_0x3f3d41[_0x0a9e('0x35')],{'contact':_0x3f3d41[_0x0a9e('0x36')],'message':_0x3f3d41[_0x0a9e('0x1f')],'agent':_0x3f3d41['agent'],'interaction':_0x3f3d41['interaction'],'account':_0x3f3d41[_0x0a9e('0x37')]}))||'';}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x38')](db[_0x0a9e('0x39')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3a')],'type':_0x1dbf74[_0x0a9e('0x3b')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x38')](_0x31916f,_0x0a9e('0x32'));_0x1ef87a['query']=_[_0x0a9e('0x3c')](_0x24936a[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],qs[_0x0a9e('0x41')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x381c37[_0x0a9e('0x40')]:_0x1ef87a[_0x0a9e('0x43')];if(!_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x381c37[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x381c37[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x381c37[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x24936a[_0x0a9e('0x3d')],_0x1ef87a[_0x0a9e('0x3e')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x381c37[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x381c37[_0x0a9e('0x47')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3b')]!==_0x0a9e('0x4a')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x32')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x34')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x39')][_0x0a9e('0x29')](_0x2e9d90)[_0x0a9e('0x31')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x29')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x4c')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x4d')](_0x381c37);})[_0x0a9e('0x31')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x4e')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x31')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x22')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x4f')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':![],'where':{'id':_0x409789[_0x0a9e('0x50')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x39')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],_0x19383e[_0x0a9e('0x3d')]);_0x6054ee[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x40')]=_0x6054ee[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x43')];if(_0x409789[_0x0a9e('0x3d')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x34')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x39')]['find'](_0x6054ee)[_0x0a9e('0x31')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x31')](respondWithResult(_0x992c77,null))[_0x0a9e('0x22')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['SugarcrmConfiguration']['create'](_0x2f82da[_0x0a9e('0x35')],{})[_0x0a9e('0x31')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x2f')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x35')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x35')],null))[_0x0a9e('0x31')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x22')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x30')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x39')][_0x0a9e('0x51')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x31')](removeEntity(_0x272738,null))[_0x0a9e('0x22')](handleError(_0x272738,null));};exports[_0x0a9e('0x52')]=function(_0xb83dfd,_0x156662,_0x5d86e9){var _0x956fbe={};var _0x26bc80={};var _0x5239ef;var _0x3649cc;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0xb83dfd['params']['id']}})['then'](handleEntityNotFound(_0x156662,null))['then'](function(_0x273cb5){if(_0x273cb5){_0x5239ef=_0x273cb5;_0x26bc80['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')][_0x0a9e('0x55')]);_0x26bc80[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0xb83dfd[_0x0a9e('0x3d')]);_0x26bc80['filters']=_[_0x0a9e('0x3f')](_0x26bc80['model'],_0x26bc80[_0x0a9e('0x3d')]);_0x956fbe[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x26bc80['model'],qs[_0x0a9e('0x41')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x956fbe[_0x0a9e('0x40')]=_0x956fbe['attributes'][_0x0a9e('0x42')]?_0x956fbe[_0x0a9e('0x40')]:_0x26bc80['model'];_0x956fbe[_0x0a9e('0x56')]=qs[_0x0a9e('0x46')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x956fbe[_0x0a9e('0x47')]=qs['filters'](_[_0x0a9e('0x48')](_0xb83dfd[_0x0a9e('0x3d')],_0x26bc80[_0x0a9e('0x3e')]));if(_0xb83dfd['query'][_0x0a9e('0x49')]){_0x956fbe['where']=_['merge'](_0x956fbe[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x956fbe[_0x0a9e('0x40')],function(_0x19c995){var _0x186f39={};_0x186f39[_0x19c995]={'$like':'%'+_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x186f39;})});}_0x956fbe=_[_0x0a9e('0x34')]({},_0x956fbe,_0xb83dfd[_0x0a9e('0x57')]);return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})[_0x0a9e('0x31')](function(_0x19012b){if(_0x19012b){_0x3649cc=_0x19012b[_0x0a9e('0x42')];if(!_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x956fbe[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0xb83dfd['query'][_0x0a9e('0x28')]);_0x956fbe[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0xb83dfd['query'][_0x0a9e('0x27')]);}return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})['then'](function(_0x83f0b2){if(_0x83f0b2){return _0x83f0b2?{'count':_0x3649cc,'rows':_0x83f0b2}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x156662,null))[_0x0a9e('0x22')](handleError(_0x156662,null));};exports[_0x0a9e('0x58')]=function(_0x13b5c0,_0x4a43a8,_0x50cdce){var _0x4a2438={};var _0x40fb85={};var _0x18bf5d;var _0x1104ad;return db[_0x0a9e('0x39')][_0x0a9e('0x53')]({'where':{'id':_0x13b5c0[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x4a43a8,null))[_0x0a9e('0x31')](function(_0x5512d1){if(_0x5512d1){_0x18bf5d=_0x5512d1;_0x40fb85[_0x0a9e('0x43')]=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')]['rawAttributes']);_0x40fb85[_0x0a9e('0x3d')]=_['keys'](_0x13b5c0[_0x0a9e('0x3d')]);_0x40fb85[_0x0a9e('0x3e')]=_['intersection'](_0x40fb85[_0x0a9e('0x43')],_0x40fb85[_0x0a9e('0x3d')]);_0x4a2438[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x40fb85['model'],qs[_0x0a9e('0x41')](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x4a2438[_0x0a9e('0x40')]=_0x4a2438['attributes'][_0x0a9e('0x42')]?_0x4a2438[_0x0a9e('0x40')]:_0x40fb85[_0x0a9e('0x43')];_0x4a2438[_0x0a9e('0x56')]=qs['sort'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x4a2438[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x13b5c0[_0x0a9e('0x3d')],_0x40fb85[_0x0a9e('0x3e')]));if(_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x4a2438[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x4a2438[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x4a2438[_0x0a9e('0x40')],function(_0x5b35db){var _0xf4120f={};_0xf4120f[_0x5b35db]={'$like':'%'+_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xf4120f;})});}_0x4a2438=_['merge']({},_0x4a2438,_0x13b5c0[_0x0a9e('0x57')]);return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x2b9463){if(_0x2b9463){_0x1104ad=_0x2b9463['length'];if(!_0x13b5c0['query'][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x4a2438['limit']=qs[_0x0a9e('0x28')](_0x13b5c0['query'][_0x0a9e('0x28')]);_0x4a2438[_0x0a9e('0x27')]=qs['offset'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x3755fe){if(_0x3755fe){return _0x3755fe?{'count':_0x1104ad,'rows':_0x3755fe}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x4a43a8,null))[_0x0a9e('0x22')](handleError(_0x4a43a8,null));};exports['getDescriptions']=function(_0x2973d3,_0x3ca9b9,_0x45c109){var _0x16e5b9={};var _0x492543={};var _0xf51744;var _0xf0db1;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0x2973d3['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x3ca9b9,null))[_0x0a9e('0x31')](function(_0x3003eb){if(_0x3003eb){_0xf51744=_0x3003eb;_0x492543[_0x0a9e('0x43')]=_['keys'](db['SugarcrmField'][_0x0a9e('0x55')]);_0x492543[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0x2973d3['query']);_0x492543[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x492543['model'],_0x492543['query']);_0x16e5b9[_0x0a9e('0x40')]=_['intersection'](_0x492543['model'],qs['fields'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x16e5b9[_0x0a9e('0x40')]=_0x16e5b9[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x16e5b9[_0x0a9e('0x40')]:_0x492543['model'];_0x16e5b9[_0x0a9e('0x56')]=qs['sort'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x16e5b9[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_['pick'](_0x2973d3[_0x0a9e('0x3d')],_0x492543[_0x0a9e('0x3e')]));if(_0x2973d3[_0x0a9e('0x3d')]['filter']){_0x16e5b9[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x16e5b9[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x16e5b9[_0x0a9e('0x40')],function(_0x1910bf){var _0x32b9bd={};_0x32b9bd[_0x1910bf]={'$like':'%'+_0x2973d3[_0x0a9e('0x3d')]['filter']+'%'};return _0x32b9bd;})});}_0x16e5b9=_[_0x0a9e('0x34')]({},_0x16e5b9,_0x2973d3[_0x0a9e('0x57')]);return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x982340){if(_0x982340){_0xf0db1=_0x982340[_0x0a9e('0x42')];if(!_0x2973d3['query'][_0x0a9e('0x44')]('nolimit')){_0x16e5b9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x16e5b9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x31d25a){if(_0x31d25a){return _0x31d25a?{'count':_0xf0db1,'rows':_0x31d25a}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x3ca9b9,null))[_0x0a9e('0x22')](handleError(_0x3ca9b9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 420efee..f767468 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 _0xf49c=['moment','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','util','api'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xf49c,0x130));var _0xcf49=function(_0x1ff9cc,_0x105d6b){_0x1ff9cc=_0x1ff9cc-0x0;var _0x233604=_0xf49c[_0x1ff9cc];return _0x233604;};'use strict';var _=require('lodash');var util=require(_0xcf49('0x0'));var logger=require('../../config/logger')(_0xcf49('0x1'));var moment=require(_0xcf49('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf49('0x3'));var rimraf=require('rimraf');var config=require(_0xcf49('0x4'));var attributes=require(_0xcf49('0x5'));module[_0xcf49('0x6')]=function(_0x3b0c02,_0x1acc90){return _0x3b0c02[_0xcf49('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0xcf49('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x612f=['path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','../../config/logger','api','request-promise'];(function(_0x4f9ef1,_0x3cead7){var _0x3d3573=function(_0x188b68){while(--_0x188b68){_0x4f9ef1['push'](_0x4f9ef1['shift']());}};_0x3d3573(++_0x3cead7);}(_0x612f,0x105));var _0xf612=function(_0x156b2a,_0x157d97){_0x156b2a=_0x156b2a-0x0;var _0x953e01=_0x612f[_0x156b2a];return _0x953e01;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf612('0x0'))(_0xf612('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf612('0x2'));var fs=require('fs');var path=require(_0xf612('0x3'));var rimraf=require('rimraf');var config=require(_0xf612('0x4'));var attributes=require(_0xf612('0x5'));module[_0xf612('0x6')]=function(_0x111e2e,_0x4d8503){return _0x111e2e['define'](_0xf612('0x7'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 67570ff..046e811 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 _0xe5d6=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x4fd23d,_0x28d052){var _0x316f11=function(_0x2a1de6){while(--_0x2a1de6){_0x4fd23d['push'](_0x4fd23d['shift']());}};_0x316f11(++_0x28d052);}(_0xe5d6,0x189));var _0x6e5d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe5d6[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x6e5d('0x0'));var util=require(_0x6e5d('0x1'));var moment=require(_0x6e5d('0x2'));var BPromise=require(_0x6e5d('0x3'));var rs=require(_0x6e5d('0x4'));var fs=require('fs');var Redis=require(_0x6e5d('0x5'));var db=require(_0x6e5d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e5d('0x7'))(_0x6e5d('0x8'));var config=require(_0x6e5d('0x9'));var jayson=require(_0x6e5d('0xa'));var client=jayson[_0x6e5d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26cfb0,_0x505756,_0x428586){return new BPromise(function(_0x2e639f,_0xeb9e4e){return client['request'](_0x26cfb0,_0x428586)[_0x6e5d('0xc')](function(_0x5d0000){logger[_0x6e5d('0xd')](_0x6e5d('0xe'),_0x505756,_0x6e5d('0xf'));logger[_0x6e5d('0x10')](_0x6e5d('0x11'),_0x505756,_0x6e5d('0xf'),JSON[_0x6e5d('0x12')](_0x5d0000));if(_0x5d0000[_0x6e5d('0x13')]){if(_0x5d0000[_0x6e5d('0x13')][_0x6e5d('0x14')]===0x1f4){logger[_0x6e5d('0x13')](_0x6e5d('0xe'),_0x505756,_0x5d0000['error']['message']);return _0xeb9e4e(_0x5d0000[_0x6e5d('0x13')][_0x6e5d('0x15')]);}logger[_0x6e5d('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x505756,_0x5d0000[_0x6e5d('0x13')][_0x6e5d('0x15')]);return _0x2e639f(_0x5d0000[_0x6e5d('0x13')][_0x6e5d('0x15')]);}else{logger['info'](_0x6e5d('0xe'),_0x505756,_0x6e5d('0xf'));_0x2e639f(_0x5d0000[_0x6e5d('0x16')][_0x6e5d('0x15')]);}})[_0x6e5d('0x17')](function(_0x53c055){logger[_0x6e5d('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x505756,_0x53c055);_0xeb9e4e(_0x53c055);});});} \ No newline at end of file +var _0x6981=['../../config/environment','jayson/promise','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x589a22,_0x41f3a3){var _0x2cead6=function(_0x2d93cc){while(--_0x2d93cc){_0x589a22['push'](_0x589a22['shift']());}};_0x2cead6(++_0x41f3a3);}(_0x6981,0x19d));var _0x1698=function(_0x11114b,_0x4f372c){_0x11114b=_0x11114b-0x0;var _0x28fd49=_0x6981[_0x11114b];return _0x28fd49;};'use strict';var _=require(_0x1698('0x0'));var util=require('util');var moment=require(_0x1698('0x1'));var BPromise=require('bluebird');var rs=require(_0x1698('0x2'));var fs=require('fs');var Redis=require(_0x1698('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1698('0x4'));var logger=require(_0x1698('0x5'))(_0x1698('0x6'));var config=require(_0x1698('0x7'));var jayson=require(_0x1698('0x8'));var client=jayson['client'][_0x1698('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdbf0b2,_0x58a9ff,_0x382bb0){return new BPromise(function(_0x43fc9f,_0x34a01d){return client[_0x1698('0xa')](_0xdbf0b2,_0x382bb0)['then'](function(_0x21c4f9){logger['info'](_0x1698('0xb'),_0x58a9ff,_0x1698('0xc'));logger[_0x1698('0xd')](_0x1698('0xe'),_0x58a9ff,_0x1698('0xc'),JSON[_0x1698('0xf')](_0x21c4f9));if(_0x21c4f9[_0x1698('0x10')]){if(_0x21c4f9[_0x1698('0x10')][_0x1698('0x11')]===0x1f4){logger[_0x1698('0x10')](_0x1698('0xb'),_0x58a9ff,_0x21c4f9['error'][_0x1698('0x12')]);return _0x34a01d(_0x21c4f9[_0x1698('0x10')][_0x1698('0x12')]);}logger['error'](_0x1698('0xb'),_0x58a9ff,_0x21c4f9[_0x1698('0x10')][_0x1698('0x12')]);return _0x43fc9f(_0x21c4f9['error'][_0x1698('0x12')]);}else{logger['info'](_0x1698('0xb'),_0x58a9ff,_0x1698('0xc'));_0x43fc9f(_0x21c4f9[_0x1698('0x13')][_0x1698('0x12')]);}})[_0x1698('0x14')](function(_0x1fcb35){logger[_0x1698('0x10')](_0x1698('0xb'),_0x58a9ff,_0x1fcb35);_0x34a01d(_0x1fcb35);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 71b61fe..1c72583 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 _0x05ba=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','post','create','update','delete','destroy','multer','util'];(function(_0x43681e,_0x30a175){var _0xc218b6=function(_0x18f1f8){while(--_0x18f1f8){_0x43681e['push'](_0x43681e['shift']());}};_0xc218b6(++_0x30a175);}(_0x05ba,0x116));var _0xa05b=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0x05ba[_0x283127];return _0x43da5d;};'use strict';var multer=require(_0xa05b('0x0'));var util=require(_0xa05b('0x1'));var path=require(_0xa05b('0x2'));var timeout=require(_0xa05b('0x3'));var express=require(_0xa05b('0x4'));var router=express[_0xa05b('0x5')]();var fs_extra=require(_0xa05b('0x6'));var auth=require(_0xa05b('0x7'));var interaction=require(_0xa05b('0x8'));var config=require(_0xa05b('0x9'));var controller=require(_0xa05b('0xa'));router[_0xa05b('0xb')]('/',auth['isAuthenticated'](),controller[_0xa05b('0xc')]);router['get'](_0xa05b('0xd'),auth[_0xa05b('0xe')](),controller['show']);router[_0xa05b('0xf')]('/',auth['isAuthenticated'](),controller[_0xa05b('0x10')]);router['put'](_0xa05b('0xd'),auth[_0xa05b('0xe')](),controller[_0xa05b('0x11')]);router[_0xa05b('0x12')](_0xa05b('0xd'),auth[_0xa05b('0xe')](),controller[_0xa05b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x82ba=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','post','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x58c6f4,_0x201966){var _0x25e8b7=function(_0x264fae){while(--_0x264fae){_0x58c6f4['push'](_0x58c6f4['shift']());}};_0x25e8b7(++_0x201966);}(_0x82ba,0x1d9));var _0xa82b=function(_0x583b1b,_0x546631){_0x583b1b=_0x583b1b-0x0;var _0x43bf6c=_0x82ba[_0x583b1b];return _0x43bf6c;};'use strict';var multer=require(_0xa82b('0x0'));var util=require('util');var path=require(_0xa82b('0x1'));var timeout=require(_0xa82b('0x2'));var express=require(_0xa82b('0x3'));var router=express[_0xa82b('0x4')]();var fs_extra=require(_0xa82b('0x5'));var auth=require(_0xa82b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa82b('0x7'));var controller=require(_0xa82b('0x8'));router[_0xa82b('0x9')]('/',auth[_0xa82b('0xa')](),controller['index']);router['get'](_0xa82b('0xb'),auth[_0xa82b('0xa')](),controller['show']);router[_0xa82b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa82b('0xb'),auth[_0xa82b('0xa')](),controller[_0xa82b('0xd')]);router[_0xa82b('0xe')]('/:id',auth[_0xa82b('0xa')](),controller[_0xa82b('0xf')]);module[_0xa82b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index e51353c..818efcf 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 _0x9b9b=['keyValue','picklist','string','STRING','ENUM','BOOLEAN','exports','variable','customVariable'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x9b9b,0x114));var _0xb9b9=function(_0x597207,_0x3244c0){_0x597207=_0x597207-0x0;var _0x1b9743=_0x9b9b[_0x597207];return _0x1b9743;};'use strict';var Sequelize=require('sequelize');module[_0xb9b9('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xb9b9('0x1'),_0xb9b9('0x2'),_0xb9b9('0x3'),_0xb9b9('0x4')),'defaultValue':_0xb9b9('0x5')},'content':{'type':Sequelize[_0xb9b9('0x6')]},'key':{'type':Sequelize[_0xb9b9('0x6')]},'keyType':{'type':Sequelize[_0xb9b9('0x7')](_0xb9b9('0x5'),_0xb9b9('0x1'),_0xb9b9('0x2'))},'keyContent':{'type':Sequelize[_0xb9b9('0x6')]},'idField':{'type':Sequelize[_0xb9b9('0x6')]},'nameField':{'type':Sequelize[_0xb9b9('0x6')]},'customField':{'type':Sequelize[_0xb9b9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb9b9('0x6')]}}; \ No newline at end of file +var _0x2356=['ENUM','customVariable','keyValue','STRING','string','variable','BOOLEAN','exports'];(function(_0xf0c56a,_0x5a0beb){var _0x23b4ac=function(_0x27a33f){while(--_0x27a33f){_0xf0c56a['push'](_0xf0c56a['shift']());}};_0x23b4ac(++_0x5a0beb);}(_0x2356,0x14f));var _0x6235=function(_0x23cd6d,_0xe47cc7){_0x23cd6d=_0x23cd6d-0x0;var _0x4cae19=_0x2356[_0x23cd6d];return _0x4cae19;};'use strict';var Sequelize=require('sequelize');module[_0x6235('0x0')]={'type':{'type':Sequelize[_0x6235('0x1')]('string','variable',_0x6235('0x2'),_0x6235('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x6235('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6235('0x5'),_0x6235('0x6'),_0x6235('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6235('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 93c7bb9..3350532 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 _0x8238=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','error','stack','name','send','render','merge','contact','agent','account','index','map','SugarcrmField','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x220609,_0x40814b){var _0x230f3e=function(_0x2049a8){while(--_0x2049a8){_0x220609['push'](_0x220609['shift']());}};_0x230f3e(++_0x40814b);}(_0x8238,0x1e5));var _0x8823=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x8238[_0x1cb18a];return _0x22442e;};'use strict';var emlformat=require(_0x8823('0x0'));var rimraf=require(_0x8823('0x1'));var zipdir=require(_0x8823('0x2'));var jsonpatch=require(_0x8823('0x3'));var rp=require(_0x8823('0x4'));var moment=require('moment');var BPromise=require(_0x8823('0x5'));var Mustache=require(_0x8823('0x6'));var util=require('util');var path=require(_0x8823('0x7'));var sox=require(_0x8823('0x8'));var csv=require(_0x8823('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8823('0xa'));var _=require(_0x8823('0xb'));var squel=require('squel');var crypto=require(_0x8823('0xc'));var jsforce=require(_0x8823('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8823('0xe'));var Redis=require(_0x8823('0xf'));var authService=require(_0x8823('0x10'));var qs=require(_0x8823('0x11'));var as=require(_0x8823('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8823('0x13'))('api');var utils=require(_0x8823('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b0f9c,_0x2a2704){_0x2a2704=_0x2a2704||0xcc;return function(_0x2ec860){if(_0x2ec860){return _0x2b0f9c[_0x8823('0x15')](_0x2a2704);}return _0x2b0f9c[_0x8823('0x16')](_0x2a2704)[_0x8823('0x17')]();};}function respondWithResult(_0x44c197,_0x5fc316){_0x5fc316=_0x5fc316||0xc8;return function(_0x1e402a){if(_0x1e402a){return _0x44c197[_0x8823('0x16')](_0x5fc316)[_0x8823('0x18')](_0x1e402a);}};}function respondWithFilteredResult(_0x87ebd,_0x24b67f){return function(_0x48f2f6){if(_0x48f2f6){var _0xe2660f=typeof _0x24b67f['offset']===_0x8823('0x19')&&typeof _0x24b67f[_0x8823('0x1a')]===_0x8823('0x19');var _0x52d758=_0x48f2f6[_0x8823('0x1b')];var _0x1f3ed9=_0xe2660f?0x0:_0x24b67f[_0x8823('0x1c')];var _0x2d41f0=_0xe2660f?_0x48f2f6[_0x8823('0x1b')]:_0x24b67f['offset']+_0x24b67f[_0x8823('0x1a')];var _0x1cfb2f;if(_0x2d41f0>=_0x52d758){_0x2d41f0=_0x52d758;_0x1cfb2f=0xc8;}else{_0x1cfb2f=0xce;}_0x87ebd['status'](_0x1cfb2f);return _0x87ebd[_0x8823('0x1d')](_0x8823('0x1e'),_0x1f3ed9+'-'+_0x2d41f0+'/'+_0x52d758)[_0x8823('0x18')](_0x48f2f6);}return null;};}function patchUpdates(_0x53a356){return function(_0x3325ac){try{jsonpatch[_0x8823('0x1f')](_0x3325ac,_0x53a356,!![]);}catch(_0x37b31){return BPromise['reject'](_0x37b31);}return _0x3325ac['save']();};}function saveUpdates(_0x49e932,_0x315f3a){return function(_0x4efd33){if(_0x4efd33){return _0x4efd33[_0x8823('0x20')](_0x49e932)['then'](function(_0x407076){return _0x407076;});}return null;};}function removeEntity(_0x1f1752,_0x45fead){return function(_0x158ece){if(_0x158ece){return _0x158ece['destroy']()[_0x8823('0x21')](function(){_0x1f1752[_0x8823('0x16')](0xcc)[_0x8823('0x17')]();});}};}function handleEntityNotFound(_0x3ecc2e,_0x5d6dea){return function(_0x3be745){if(!_0x3be745){_0x3ecc2e['sendStatus'](0x194);}return _0x3be745;};}function handleError(_0x312dcd,_0x3160b1){_0x3160b1=_0x3160b1||0x1f4;return function(_0x1b585d){logger[_0x8823('0x22')](_0x1b585d[_0x8823('0x23')]);if(_0x1b585d[_0x8823('0x24')]){delete _0x1b585d[_0x8823('0x24')];}_0x312dcd[_0x8823('0x16')](_0x3160b1)[_0x8823('0x25')](_0x1b585d);};}function getMustacheRender(_0x9512e7,_0x140f0d){return Mustache[_0x8823('0x26')](_0x9512e7,_[_0x8823('0x27')](_0x140f0d['body'],{'contact':_0x140f0d[_0x8823('0x28')],'message':_0x140f0d['message'],'agent':_0x140f0d[_0x8823('0x29')],'interaction':_0x140f0d['interaction'],'account':_0x140f0d[_0x8823('0x2a')]}))||'';}exports[_0x8823('0x2b')]=function(_0x1481c5,_0xc7438d){var _0x37c192={},_0xcf24af={},_0x3e3db9={'count':0x0,'rows':[]};var _0x54aea0=_[_0x8823('0x2c')](db[_0x8823('0x2d')]['rawAttributes'],function(_0x58e8de){return{'name':_0x58e8de[_0x8823('0x2e')],'type':_0x58e8de[_0x8823('0x2f')][_0x8823('0x30')]};});_0xcf24af[_0x8823('0x31')]=_[_0x8823('0x2c')](_0x54aea0,_0x8823('0x24'));_0xcf24af[_0x8823('0x32')]=_[_0x8823('0x33')](_0x1481c5[_0x8823('0x32')]);_0xcf24af[_0x8823('0x34')]=_[_0x8823('0x35')](_0xcf24af[_0x8823('0x31')],_0xcf24af[_0x8823('0x32')]);_0x37c192[_0x8823('0x36')]=_[_0x8823('0x35')](_0xcf24af[_0x8823('0x31')],qs[_0x8823('0x37')](_0x1481c5[_0x8823('0x32')][_0x8823('0x37')]));_0x37c192[_0x8823('0x36')]=_0x37c192['attributes'][_0x8823('0x38')]?_0x37c192[_0x8823('0x36')]:_0xcf24af[_0x8823('0x31')];if(!_0x1481c5[_0x8823('0x32')][_0x8823('0x39')](_0x8823('0x3a'))){_0x37c192[_0x8823('0x1a')]=qs['limit'](_0x1481c5['query']['limit']);_0x37c192['offset']=qs['offset'](_0x1481c5[_0x8823('0x32')]['offset']);}_0x37c192['order']=qs[_0x8823('0x3b')](_0x1481c5[_0x8823('0x32')][_0x8823('0x3b')]);_0x37c192[_0x8823('0x3c')]=qs[_0x8823('0x34')](_[_0x8823('0x3d')](_0x1481c5[_0x8823('0x32')],_0xcf24af[_0x8823('0x34')]),_0x54aea0);if(_0x1481c5[_0x8823('0x32')][_0x8823('0x3e')]){_0x37c192[_0x8823('0x3c')]=_[_0x8823('0x27')](_0x37c192[_0x8823('0x3c')],{'$or':_['map'](_0x54aea0,function(_0x321aef){if(_0x321aef[_0x8823('0x2f')]!==_0x8823('0x3f')){var _0x544c1e={};_0x544c1e[_0x321aef['name']]={'$like':'%'+_0x1481c5[_0x8823('0x32')][_0x8823('0x3e')]+'%'};return _0x544c1e;}})});}_0x37c192=_['merge']({},_0x37c192,_0x1481c5[_0x8823('0x40')]);var _0x229834={'where':_0x37c192[_0x8823('0x3c')]};return db['SugarcrmField'][_0x8823('0x1b')](_0x229834)[_0x8823('0x21')](function(_0x4bfa5e){_0x3e3db9[_0x8823('0x1b')]=_0x4bfa5e;if(_0x1481c5['query'][_0x8823('0x41')]){_0x37c192[_0x8823('0x42')]=[{'all':!![]}];}return db[_0x8823('0x2d')][_0x8823('0x43')](_0x37c192);})[_0x8823('0x21')](function(_0x717d29){_0x3e3db9[_0x8823('0x44')]=_0x717d29;return _0x3e3db9;})[_0x8823('0x21')](respondWithFilteredResult(_0xc7438d,_0x37c192))[_0x8823('0x45')](handleError(_0xc7438d,null));};exports[_0x8823('0x46')]=function(_0x12bb1e,_0x28d7fa){var _0x25fd8a={'raw':!![],'where':{'id':_0x12bb1e['params']['id']}},_0x38ec11={};_0x38ec11[_0x8823('0x31')]=_['keys'](db['SugarcrmField'][_0x8823('0x47')]);_0x38ec11[_0x8823('0x32')]=_[_0x8823('0x33')](_0x12bb1e[_0x8823('0x32')]);_0x38ec11[_0x8823('0x34')]=_[_0x8823('0x35')](_0x38ec11[_0x8823('0x31')],_0x38ec11[_0x8823('0x32')]);_0x25fd8a['attributes']=_[_0x8823('0x35')](_0x38ec11[_0x8823('0x31')],qs[_0x8823('0x37')](_0x12bb1e['query'][_0x8823('0x37')]));_0x25fd8a[_0x8823('0x36')]=_0x25fd8a[_0x8823('0x36')][_0x8823('0x38')]?_0x25fd8a[_0x8823('0x36')]:_0x38ec11[_0x8823('0x31')];if(_0x12bb1e[_0x8823('0x32')][_0x8823('0x41')]){_0x25fd8a[_0x8823('0x42')]=[{'all':!![]}];}_0x25fd8a=_[_0x8823('0x27')]({},_0x25fd8a,_0x12bb1e['options']);return db['SugarcrmField'][_0x8823('0x48')](_0x25fd8a)['then'](handleEntityNotFound(_0x28d7fa,null))[_0x8823('0x21')](respondWithResult(_0x28d7fa,null))[_0x8823('0x45')](handleError(_0x28d7fa,null));};exports[_0x8823('0x49')]=function(_0x35f7e5,_0x19a024){return db[_0x8823('0x2d')]['create'](_0x35f7e5[_0x8823('0x4a')],{})[_0x8823('0x21')](respondWithResult(_0x19a024,0xc9))[_0x8823('0x45')](handleError(_0x19a024,null));};exports[_0x8823('0x20')]=function(_0xd22da3,_0x181218){if(_0xd22da3[_0x8823('0x4a')]['id']){delete _0xd22da3['body']['id'];}return db[_0x8823('0x2d')][_0x8823('0x48')]({'where':{'id':_0xd22da3[_0x8823('0x4b')]['id']}})['then'](handleEntityNotFound(_0x181218,null))[_0x8823('0x21')](saveUpdates(_0xd22da3[_0x8823('0x4a')],null))['then'](respondWithResult(_0x181218,null))[_0x8823('0x45')](handleError(_0x181218,null));};exports[_0x8823('0x4c')]=function(_0x57cc45,_0x35e9ab){return db[_0x8823('0x2d')][_0x8823('0x48')]({'where':{'id':_0x57cc45[_0x8823('0x4b')]['id']}})[_0x8823('0x21')](handleEntityNotFound(_0x35e9ab,null))[_0x8823('0x21')](removeEntity(_0x35e9ab,null))['catch'](handleError(_0x35e9ab,null));}; \ No newline at end of file +var _0xe560=['contact','agent','interaction','account','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','options','includeAll','include','catch','show','params','find','create','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','render','merge','body'];(function(_0x2db989,_0x52c7d0){var _0x4c591e=function(_0x2a4bcf){while(--_0x2a4bcf){_0x2db989['push'](_0x2db989['shift']());}};_0x4c591e(++_0x52c7d0);}(_0xe560,0x141));var _0x0e56=function(_0x158b34,_0x2a8fb1){_0x158b34=_0x158b34-0x0;var _0x2f5449=_0xe560[_0x158b34];return _0x2f5449;};'use strict';var emlformat=require(_0x0e56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e56('0x1'));var jsonpatch=require(_0x0e56('0x2'));var rp=require('request-promise');var moment=require(_0x0e56('0x3'));var BPromise=require(_0x0e56('0x4'));var Mustache=require(_0x0e56('0x5'));var util=require(_0x0e56('0x6'));var path=require(_0x0e56('0x7'));var sox=require(_0x0e56('0x8'));var csv=require(_0x0e56('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e56('0xa'));var _=require(_0x0e56('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e56('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0e56('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e56('0xd'));var qs=require(_0x0e56('0xe'));var as=require(_0x0e56('0xf'));var hardwareService=require(_0x0e56('0x10'));var logger=require('../../config/logger')(_0x0e56('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0e56('0x12'))['db'];function respondWithStatusCode(_0x12dc2b,_0x19add8){_0x19add8=_0x19add8||0xcc;return function(_0x58b5c7){if(_0x58b5c7){return _0x12dc2b[_0x0e56('0x13')](_0x19add8);}return _0x12dc2b[_0x0e56('0x14')](_0x19add8)['end']();};}function respondWithResult(_0x23af96,_0xbabdec){_0xbabdec=_0xbabdec||0xc8;return function(_0x4555cf){if(_0x4555cf){return _0x23af96['status'](_0xbabdec)[_0x0e56('0x15')](_0x4555cf);}};}function respondWithFilteredResult(_0x18816d,_0x511953){return function(_0x305733){if(_0x305733){var _0x4c0234=typeof _0x511953['offset']==='undefined'&&typeof _0x511953[_0x0e56('0x16')]===_0x0e56('0x17');var _0x32a025=_0x305733[_0x0e56('0x18')];var _0x34d152=_0x4c0234?0x0:_0x511953[_0x0e56('0x19')];var _0x5bab96=_0x4c0234?_0x305733[_0x0e56('0x18')]:_0x511953['offset']+_0x511953['limit'];var _0x773c71;if(_0x5bab96>=_0x32a025){_0x5bab96=_0x32a025;_0x773c71=0xc8;}else{_0x773c71=0xce;}_0x18816d[_0x0e56('0x14')](_0x773c71);return _0x18816d['set'](_0x0e56('0x1a'),_0x34d152+'-'+_0x5bab96+'/'+_0x32a025)[_0x0e56('0x15')](_0x305733);}return null;};}function patchUpdates(_0x150f2e){return function(_0x467826){try{jsonpatch[_0x0e56('0x1b')](_0x467826,_0x150f2e,!![]);}catch(_0xfa6a85){return BPromise[_0x0e56('0x1c')](_0xfa6a85);}return _0x467826['save']();};}function saveUpdates(_0x428b75,_0x214b68){return function(_0x2c4a2c){if(_0x2c4a2c){return _0x2c4a2c[_0x0e56('0x1d')](_0x428b75)[_0x0e56('0x1e')](function(_0x772347){return _0x772347;});}return null;};}function removeEntity(_0x37f9ad,_0x5d510d){return function(_0x27abbc){if(_0x27abbc){return _0x27abbc[_0x0e56('0x1f')]()['then'](function(){_0x37f9ad[_0x0e56('0x14')](0xcc)[_0x0e56('0x20')]();});}};}function handleEntityNotFound(_0x4921ca,_0x3495eb){return function(_0x53cccb){if(!_0x53cccb){_0x4921ca[_0x0e56('0x13')](0x194);}return _0x53cccb;};}function handleError(_0x3f188f,_0x1e0a44){_0x1e0a44=_0x1e0a44||0x1f4;return function(_0x548fb3){logger[_0x0e56('0x21')](_0x548fb3[_0x0e56('0x22')]);if(_0x548fb3['name']){delete _0x548fb3[_0x0e56('0x23')];}_0x3f188f[_0x0e56('0x14')](_0x1e0a44)['send'](_0x548fb3);};}function getMustacheRender(_0x1f31f4,_0x4d03b9){return Mustache[_0x0e56('0x24')](_0x1f31f4,_[_0x0e56('0x25')](_0x4d03b9[_0x0e56('0x26')],{'contact':_0x4d03b9[_0x0e56('0x27')],'message':_0x4d03b9['message'],'agent':_0x4d03b9[_0x0e56('0x28')],'interaction':_0x4d03b9[_0x0e56('0x29')],'account':_0x4d03b9[_0x0e56('0x2a')]}))||'';}exports[_0x0e56('0x2b')]=function(_0x32e7d0,_0x1566b4){var _0x1959dc={},_0x4ad922={},_0x1c37bc={'count':0x0,'rows':[]};var _0x4e7f2f=_[_0x0e56('0x2c')](db[_0x0e56('0x2d')][_0x0e56('0x2e')],function(_0x17ab18){return{'name':_0x17ab18[_0x0e56('0x2f')],'type':_0x17ab18['type'][_0x0e56('0x30')]};});_0x4ad922[_0x0e56('0x31')]=_[_0x0e56('0x2c')](_0x4e7f2f,_0x0e56('0x23'));_0x4ad922[_0x0e56('0x32')]=_[_0x0e56('0x33')](_0x32e7d0[_0x0e56('0x32')]);_0x4ad922[_0x0e56('0x34')]=_[_0x0e56('0x35')](_0x4ad922[_0x0e56('0x31')],_0x4ad922[_0x0e56('0x32')]);_0x1959dc['attributes']=_[_0x0e56('0x35')](_0x4ad922[_0x0e56('0x31')],qs[_0x0e56('0x36')](_0x32e7d0[_0x0e56('0x32')][_0x0e56('0x36')]));_0x1959dc[_0x0e56('0x37')]=_0x1959dc[_0x0e56('0x37')][_0x0e56('0x38')]?_0x1959dc[_0x0e56('0x37')]:_0x4ad922[_0x0e56('0x31')];if(!_0x32e7d0[_0x0e56('0x32')][_0x0e56('0x39')](_0x0e56('0x3a'))){_0x1959dc['limit']=qs[_0x0e56('0x16')](_0x32e7d0[_0x0e56('0x32')][_0x0e56('0x16')]);_0x1959dc[_0x0e56('0x19')]=qs[_0x0e56('0x19')](_0x32e7d0['query'][_0x0e56('0x19')]);}_0x1959dc[_0x0e56('0x3b')]=qs[_0x0e56('0x3c')](_0x32e7d0[_0x0e56('0x32')][_0x0e56('0x3c')]);_0x1959dc[_0x0e56('0x3d')]=qs['filters'](_['pick'](_0x32e7d0[_0x0e56('0x32')],_0x4ad922[_0x0e56('0x34')]),_0x4e7f2f);if(_0x32e7d0[_0x0e56('0x32')][_0x0e56('0x3e')]){_0x1959dc[_0x0e56('0x3d')]=_[_0x0e56('0x25')](_0x1959dc[_0x0e56('0x3d')],{'$or':_[_0x0e56('0x2c')](_0x4e7f2f,function(_0x1fe560){if(_0x1fe560[_0x0e56('0x3f')]!=='VIRTUAL'){var _0x2c6132={};_0x2c6132[_0x1fe560[_0x0e56('0x23')]]={'$like':'%'+_0x32e7d0['query'][_0x0e56('0x3e')]+'%'};return _0x2c6132;}})});}_0x1959dc=_[_0x0e56('0x25')]({},_0x1959dc,_0x32e7d0[_0x0e56('0x40')]);var _0x18c05b={'where':_0x1959dc['where']};return db['SugarcrmField'][_0x0e56('0x18')](_0x18c05b)[_0x0e56('0x1e')](function(_0x3f0301){_0x1c37bc[_0x0e56('0x18')]=_0x3f0301;if(_0x32e7d0[_0x0e56('0x32')][_0x0e56('0x41')]){_0x1959dc[_0x0e56('0x42')]=[{'all':!![]}];}return db[_0x0e56('0x2d')]['findAll'](_0x1959dc);})['then'](function(_0x3fe91a){_0x1c37bc['rows']=_0x3fe91a;return _0x1c37bc;})[_0x0e56('0x1e')](respondWithFilteredResult(_0x1566b4,_0x1959dc))[_0x0e56('0x43')](handleError(_0x1566b4,null));};exports[_0x0e56('0x44')]=function(_0x3669e8,_0x2a50a6){var _0x46850e={'raw':!![],'where':{'id':_0x3669e8[_0x0e56('0x45')]['id']}},_0x5a0d78={};_0x5a0d78['model']=_[_0x0e56('0x33')](db[_0x0e56('0x2d')][_0x0e56('0x2e')]);_0x5a0d78[_0x0e56('0x32')]=_['keys'](_0x3669e8[_0x0e56('0x32')]);_0x5a0d78[_0x0e56('0x34')]=_['intersection'](_0x5a0d78[_0x0e56('0x31')],_0x5a0d78[_0x0e56('0x32')]);_0x46850e[_0x0e56('0x37')]=_[_0x0e56('0x35')](_0x5a0d78[_0x0e56('0x31')],qs[_0x0e56('0x36')](_0x3669e8[_0x0e56('0x32')]['fields']));_0x46850e['attributes']=_0x46850e[_0x0e56('0x37')][_0x0e56('0x38')]?_0x46850e[_0x0e56('0x37')]:_0x5a0d78['model'];if(_0x3669e8[_0x0e56('0x32')][_0x0e56('0x41')]){_0x46850e[_0x0e56('0x42')]=[{'all':!![]}];}_0x46850e=_[_0x0e56('0x25')]({},_0x46850e,_0x3669e8[_0x0e56('0x40')]);return db[_0x0e56('0x2d')][_0x0e56('0x46')](_0x46850e)[_0x0e56('0x1e')](handleEntityNotFound(_0x2a50a6,null))[_0x0e56('0x1e')](respondWithResult(_0x2a50a6,null))[_0x0e56('0x43')](handleError(_0x2a50a6,null));};exports[_0x0e56('0x47')]=function(_0x20e4c1,_0x1fc37a){return db[_0x0e56('0x2d')][_0x0e56('0x47')](_0x20e4c1[_0x0e56('0x26')],{})['then'](respondWithResult(_0x1fc37a,0xc9))[_0x0e56('0x43')](handleError(_0x1fc37a,null));};exports['update']=function(_0x2b7751,_0x2ead71){if(_0x2b7751[_0x0e56('0x26')]['id']){delete _0x2b7751['body']['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x2b7751[_0x0e56('0x45')]['id']}})[_0x0e56('0x1e')](handleEntityNotFound(_0x2ead71,null))['then'](saveUpdates(_0x2b7751[_0x0e56('0x26')],null))[_0x0e56('0x1e')](respondWithResult(_0x2ead71,null))[_0x0e56('0x43')](handleError(_0x2ead71,null));};exports[_0x0e56('0x1f')]=function(_0x24d115,_0x27860f){return db[_0x0e56('0x2d')][_0x0e56('0x46')]({'where':{'id':_0x24d115['params']['id']}})[_0x0e56('0x1e')](handleEntityNotFound(_0x27860f,null))['then'](removeEntity(_0x27860f,null))[_0x0e56('0x43')](handleError(_0x27860f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index ef8ccf4..d0b98f2 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 _0x8c1a=['path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','moment'];(function(_0x138293,_0x197e7f){var _0x34c4a2=function(_0x20192b){while(--_0x20192b){_0x138293['push'](_0x138293['shift']());}};_0x34c4a2(++_0x197e7f);}(_0x8c1a,0x11d));var _0xa8c1=function(_0x54a28a,_0x1ba1fe){_0x54a28a=_0x54a28a-0x0;var _0x3da1f1=_0x8c1a[_0x54a28a];return _0x3da1f1;};'use strict';var _=require('lodash');var util=require(_0xa8c1('0x0'));var logger=require(_0xa8c1('0x1'))('api');var moment=require(_0xa8c1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8c1('0x3'));var rimraf=require(_0xa8c1('0x4'));var config=require('../../config/environment');var attributes=require(_0xa8c1('0x5'));module[_0xa8c1('0x6')]=function(_0x27fb94,_0xfd29ef){return _0x27fb94[_0xa8c1('0x7')](_0xa8c1('0x8'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xa8c1('0x9'),'fields':[_0xa8c1('0xa'),_0xa8c1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b46=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','idField','FieldId','lodash'];(function(_0x1f2fd5,_0x4c56e6){var _0x4c240e=function(_0x1a90db){while(--_0x1a90db){_0x1f2fd5['push'](_0x1f2fd5['shift']());}};_0x4c240e(++_0x4c56e6);}(_0x7b46,0x143));var _0x67b4=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x7b46[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0x67b4('0x0'));var util=require('util');var logger=require(_0x67b4('0x1'))(_0x67b4('0x2'));var moment=require('moment');var BPromise=require(_0x67b4('0x3'));var rp=require(_0x67b4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67b4('0x5'));var config=require(_0x67b4('0x6'));var attributes=require(_0x67b4('0x7'));module['exports']=function(_0x1c1ddc,_0x10993a){return _0x1c1ddc[_0x67b4('0x8')](_0x67b4('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x67b4('0xa'),_0x67b4('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 473ce2a..665dd29 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 _0xbaf0=['client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x4fc2,0x111));var _0x24fc=function(_0x857391,_0x3bdb77){_0x857391=_0x857391-0x0;var _0x4eee1d=_0x4fc2[_0x857391];return _0x4eee1d;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index d3e0d29..2380320 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 _0x3e51=['put','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration'];(function(_0x514b09,_0x3ca313){var _0x4579ec=function(_0x138a1d){while(--_0x138a1d){_0x514b09['push'](_0x514b09['shift']());}};_0x4579ec(++_0x3ca313);}(_0x3e51,0xa3));var _0x13e5=function(_0x3538ed,_0x221640){_0x3538ed=_0x3538ed-0x0;var _0x326f01=_0x3e51[_0x3538ed];return _0x326f01;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x13e5('0x0'));var timeout=require(_0x13e5('0x1'));var express=require(_0x13e5('0x2'));var router=express[_0x13e5('0x3')]();var fs_extra=require(_0x13e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x13e5('0x5'));var config=require(_0x13e5('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x13e5('0x7')]('/',auth[_0x13e5('0x8')](),controller['index']);router[_0x13e5('0x7')](_0x13e5('0x9'),auth[_0x13e5('0x8')](),controller[_0x13e5('0xa')]);router[_0x13e5('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x13e5('0xb')]);router['get'](_0x13e5('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x13e5('0xd')]('/',auth['isAuthenticated'](),controller[_0x13e5('0xe')]);router[_0x13e5('0xd')](_0x13e5('0xf'),auth['isAuthenticated'](),controller[_0x13e5('0x10')]);router[_0x13e5('0x11')](_0x13e5('0x9'),auth[_0x13e5('0x8')](),controller[_0x13e5('0x12')]);router[_0x13e5('0x13')](_0x13e5('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa921=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show'];(function(_0x3a9048,_0x548060){var _0x3be6e1=function(_0xb25b35){while(--_0xb25b35){_0x3a9048['push'](_0x3a9048['shift']());}};_0x3be6e1(++_0x548060);}(_0xa921,0x181));var _0x1a92=function(_0x22bf50,_0x1373aa){_0x22bf50=_0x22bf50-0x0;var _0x50cea7=_0xa921[_0x22bf50];return _0x50cea7;};'use strict';var multer=require(_0x1a92('0x0'));var util=require('util');var path=require(_0x1a92('0x1'));var timeout=require(_0x1a92('0x2'));var express=require(_0x1a92('0x3'));var router=express[_0x1a92('0x4')]();var fs_extra=require(_0x1a92('0x5'));var auth=require(_0x1a92('0x6'));var interaction=require(_0x1a92('0x7'));var config=require(_0x1a92('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x1a92('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1a92('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1a92('0xa')]);router[_0x1a92('0x9')]('/:id/configurations',auth[_0x1a92('0xb')](),controller[_0x1a92('0xc')]);router[_0x1a92('0x9')](_0x1a92('0xd'),auth[_0x1a92('0xb')](),controller[_0x1a92('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1a92('0xf')](_0x1a92('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1a92('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1a92('0x12')](_0x1a92('0x13'),auth[_0x1a92('0xb')](),controller[_0x1a92('0x14')]);module[_0x1a92('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9a9b79e..7d92a37 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 _0x6d5f=['exports','STRING','HelpDesk'];(function(_0xbdf091,_0x35a06c){var _0x129fd5=function(_0x529abd){while(--_0x529abd){_0xbdf091['push'](_0xbdf091['shift']());}};_0x129fd5(++_0x35a06c);}(_0x6d5f,0xcf));var _0xf6d5=function(_0x74c94d,_0x27bf5c){_0x74c94d=_0x74c94d-0x0;var _0x1b4202=_0x6d5f[_0x74c94d];return _0x1b4202;};'use strict';var Sequelize=require('sequelize');module[_0xf6d5('0x0')]={'name':{'type':Sequelize[_0xf6d5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf6d5('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf6d5('0x1')],'allowNull':![],'defaultValue':_0xf6d5('0x2')},'remoteUri':{'type':Sequelize[_0xf6d5('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf6d5('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf6d5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3761=['exports','STRING','HelpDesk'];(function(_0x1ce2aa,_0x373e09){var _0x375643=function(_0x31afb9){while(--_0x31afb9){_0x1ce2aa['push'](_0x1ce2aa['shift']());}};_0x375643(++_0x373e09);}(_0x3761,0x8a));var _0x1376=function(_0x46bbe7,_0x509588){_0x46bbe7=_0x46bbe7-0x0;var _0x1a7b42=_0x3761[_0x46bbe7];return _0x1a7b42;};'use strict';var Sequelize=require('sequelize');module[_0x1376('0x0')]={'name':{'type':Sequelize[_0x1376('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1376('0x1')]},'username':{'type':Sequelize[_0x1376('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x1376('0x1')],'allowNull':![],'defaultValue':_0x1376('0x2')},'remoteUri':{'type':Sequelize[_0x1376('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x1376('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 d62383b..867c83f 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 _0xda3f=['stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','name','send','render','merge','body','interaction','account','index','map','VtigerAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','update','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','GET','success','POST','login','token','describe','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x360bd0,_0x2ad1d5){var _0x1baaed=function(_0x3e025f){while(--_0x3e025f){_0x360bd0['push'](_0x360bd0['shift']());}};_0x1baaed(++_0x2ad1d5);}(_0xda3f,0xec));var _0xfda3=function(_0x36e958,_0x5122fb){_0x36e958=_0x36e958-0x0;var _0x27b132=_0xda3f[_0x36e958];return _0x27b132;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xfda3('0x17'));var client=jayson['client'][_0xfda3('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1e7a55,_0x4929fa,_0x501588,_0x587e9b){return new BPromise(function(_0x227d72,_0x477fc0){var _0x5ea793=_0x587e9b||client;return _0x5ea793['request'](_0x1e7a55,_0x501588)['then'](function(_0x80ea80){logger[_0xfda3('0x19')](_0xfda3('0x1a'),_0x4929fa,_0xfda3('0x1b'));logger[_0xfda3('0x1c')](_0xfda3('0x1d'),_0x4929fa,_0xfda3('0x1b'),JSON[_0xfda3('0x1e')](_0x80ea80));if(_0x80ea80[_0xfda3('0x1f')]){if(_0x80ea80[_0xfda3('0x1f')]['code']===0x1f4){logger[_0xfda3('0x1f')](_0xfda3('0x1a'),_0x4929fa,_0x80ea80[_0xfda3('0x1f')][_0xfda3('0x20')]);return _0x477fc0(_0x80ea80['error'][_0xfda3('0x20')]);}logger[_0xfda3('0x1f')](_0xfda3('0x1a'),_0x4929fa,_0x80ea80['error']['message']);return _0x227d72(_0x80ea80[_0xfda3('0x1f')][_0xfda3('0x20')]);}else{logger[_0xfda3('0x19')]('VtigerAccount,\x20%s,\x20%s',_0x4929fa,_0xfda3('0x1b'));_0x227d72(_0x80ea80[_0xfda3('0x21')][_0xfda3('0x20')]);}})[_0xfda3('0x22')](function(_0xfb4ee9){logger[_0xfda3('0x1f')](_0xfda3('0x1a'),_0x4929fa,_0xfb4ee9);_0x477fc0(_0xfb4ee9);});});}function respondWithStatusCode(_0xc6fb9a,_0x16eaa6){_0x16eaa6=_0x16eaa6||0xcc;return function(_0x5499f5){if(_0x5499f5){return _0xc6fb9a[_0xfda3('0x23')](_0x16eaa6);}return _0xc6fb9a[_0xfda3('0x24')](_0x16eaa6)[_0xfda3('0x25')]();};}function respondWithResult(_0x4ae9b9,_0x45a977){_0x45a977=_0x45a977||0xc8;return function(_0x39e246){if(_0x39e246){return _0x4ae9b9[_0xfda3('0x24')](_0x45a977)[_0xfda3('0x26')](_0x39e246);}};}function respondWithFilteredResult(_0x1cb831,_0xad9f7b){return function(_0x514d2a){if(_0x514d2a){var _0x3c6d7d=typeof _0xad9f7b[_0xfda3('0x27')]===_0xfda3('0x28')&&typeof _0xad9f7b[_0xfda3('0x29')]===_0xfda3('0x28');var _0x5704c7=_0x514d2a[_0xfda3('0x2a')];var _0x4101b1=_0x3c6d7d?0x0:_0xad9f7b[_0xfda3('0x27')];var _0x474992=_0x3c6d7d?_0x514d2a[_0xfda3('0x2a')]:_0xad9f7b[_0xfda3('0x27')]+_0xad9f7b[_0xfda3('0x29')];var _0x538902;if(_0x474992>=_0x5704c7){_0x474992=_0x5704c7;_0x538902=0xc8;}else{_0x538902=0xce;}_0x1cb831['status'](_0x538902);return _0x1cb831[_0xfda3('0x2b')]('Content-Range',_0x4101b1+'-'+_0x474992+'/'+_0x5704c7)['json'](_0x514d2a);}return null;};}function patchUpdates(_0x16b4a2){return function(_0x2a5971){try{jsonpatch[_0xfda3('0x2c')](_0x2a5971,_0x16b4a2,!![]);}catch(_0xd7e1d6){return BPromise[_0xfda3('0x2d')](_0xd7e1d6);}return _0x2a5971[_0xfda3('0x2e')]();};}function saveUpdates(_0x404531,_0xd6b6d7){return function(_0x261a81){if(_0x261a81){return _0x261a81['update'](_0x404531)[_0xfda3('0x2f')](function(_0x43b063){return _0x43b063;});}return null;};}function removeEntity(_0xacc8c,_0x227357){return function(_0x2b64a1){if(_0x2b64a1){return _0x2b64a1[_0xfda3('0x30')]()[_0xfda3('0x2f')](function(){_0xacc8c[_0xfda3('0x24')](0xcc)[_0xfda3('0x25')]();});}};}function handleEntityNotFound(_0x59a1c9,_0x51ecde){return function(_0x30e63e){if(!_0x30e63e){_0x59a1c9[_0xfda3('0x23')](0x194);}return _0x30e63e;};}function handleError(_0x58f805,_0x1ac6f2){_0x1ac6f2=_0x1ac6f2||0x1f4;return function(_0xc861d2){logger[_0xfda3('0x1f')](_0xc861d2['stack']);if(_0xc861d2[_0xfda3('0x31')]){delete _0xc861d2[_0xfda3('0x31')];}_0x58f805[_0xfda3('0x24')](_0x1ac6f2)[_0xfda3('0x32')](_0xc861d2);};}function getMustacheRender(_0x1ab9b1,_0x5ae650){return Mustache[_0xfda3('0x33')](_0x1ab9b1,_[_0xfda3('0x34')](_0x5ae650[_0xfda3('0x35')],{'contact':_0x5ae650['contact'],'message':_0x5ae650[_0xfda3('0x20')],'agent':_0x5ae650['agent'],'interaction':_0x5ae650[_0xfda3('0x36')],'account':_0x5ae650[_0xfda3('0x37')]}))||'';}exports[_0xfda3('0x38')]=function(_0x36a506,_0x21c5cc){var _0x2074e7={},_0x151f32={},_0x3d1cb2={'count':0x0,'rows':[]};var _0x577be8=_[_0xfda3('0x39')](db[_0xfda3('0x3a')][_0xfda3('0x3b')],function(_0x8ed2ba){return{'name':_0x8ed2ba['fieldName'],'type':_0x8ed2ba[_0xfda3('0x3c')][_0xfda3('0x3d')]};});_0x151f32[_0xfda3('0x3e')]=_['map'](_0x577be8,'name');_0x151f32[_0xfda3('0x3f')]=_[_0xfda3('0x40')](_0x36a506[_0xfda3('0x3f')]);_0x151f32[_0xfda3('0x41')]=_[_0xfda3('0x42')](_0x151f32[_0xfda3('0x3e')],_0x151f32[_0xfda3('0x3f')]);_0x2074e7[_0xfda3('0x43')]=_[_0xfda3('0x42')](_0x151f32[_0xfda3('0x3e')],qs['fields'](_0x36a506[_0xfda3('0x3f')][_0xfda3('0x44')]));_0x2074e7['attributes']=_0x2074e7[_0xfda3('0x43')]['length']?_0x2074e7['attributes']:_0x151f32['model'];if(!_0x36a506[_0xfda3('0x3f')][_0xfda3('0x45')](_0xfda3('0x46'))){_0x2074e7[_0xfda3('0x29')]=qs['limit'](_0x36a506[_0xfda3('0x3f')][_0xfda3('0x29')]);_0x2074e7[_0xfda3('0x27')]=qs[_0xfda3('0x27')](_0x36a506['query'][_0xfda3('0x27')]);}_0x2074e7[_0xfda3('0x47')]=qs[_0xfda3('0x48')](_0x36a506['query']['sort']);_0x2074e7[_0xfda3('0x49')]=qs[_0xfda3('0x41')](_[_0xfda3('0x4a')](_0x36a506[_0xfda3('0x3f')],_0x151f32[_0xfda3('0x41')]),_0x577be8);if(_0x36a506[_0xfda3('0x3f')][_0xfda3('0x4b')]){_0x2074e7[_0xfda3('0x49')]=_[_0xfda3('0x34')](_0x2074e7[_0xfda3('0x49')],{'$or':_[_0xfda3('0x39')](_0x577be8,function(_0x433088){if(_0x433088[_0xfda3('0x3c')]!==_0xfda3('0x4c')){var _0x57013b={};_0x57013b[_0x433088['name']]={'$like':'%'+_0x36a506[_0xfda3('0x3f')][_0xfda3('0x4b')]+'%'};return _0x57013b;}})});}_0x2074e7=_[_0xfda3('0x34')]({},_0x2074e7,_0x36a506[_0xfda3('0x4d')]);var _0x597e5a={'where':_0x2074e7[_0xfda3('0x49')]};return db[_0xfda3('0x3a')][_0xfda3('0x2a')](_0x597e5a)[_0xfda3('0x2f')](function(_0x161fda){_0x3d1cb2['count']=_0x161fda;if(_0x36a506[_0xfda3('0x3f')][_0xfda3('0x4e')]){_0x2074e7[_0xfda3('0x4f')]=[{'all':!![]}];}return db[_0xfda3('0x3a')][_0xfda3('0x50')](_0x2074e7);})['then'](function(_0x2105dc){_0x3d1cb2[_0xfda3('0x51')]=_0x2105dc;return _0x3d1cb2;})[_0xfda3('0x2f')](respondWithFilteredResult(_0x21c5cc,_0x2074e7))['catch'](handleError(_0x21c5cc,null));};exports[_0xfda3('0x52')]=function(_0x39c96f,_0x11addf){var _0x4cd5cb={'raw':![],'where':{'id':_0x39c96f[_0xfda3('0x53')]['id']}},_0x30c01c={};_0x30c01c[_0xfda3('0x3e')]=_[_0xfda3('0x40')](db[_0xfda3('0x3a')]['rawAttributes']);_0x30c01c[_0xfda3('0x3f')]=_['keys'](_0x39c96f[_0xfda3('0x3f')]);_0x30c01c['filters']=_[_0xfda3('0x42')](_0x30c01c[_0xfda3('0x3e')],_0x30c01c[_0xfda3('0x3f')]);_0x4cd5cb[_0xfda3('0x43')]=_['intersection'](_0x30c01c[_0xfda3('0x3e')],qs[_0xfda3('0x44')](_0x39c96f[_0xfda3('0x3f')][_0xfda3('0x44')]));_0x4cd5cb[_0xfda3('0x43')]=_0x4cd5cb[_0xfda3('0x43')][_0xfda3('0x54')]?_0x4cd5cb['attributes']:_0x30c01c['model'];if(_0x39c96f[_0xfda3('0x3f')][_0xfda3('0x4e')]){_0x4cd5cb[_0xfda3('0x4f')]=[{'all':!![]}];}_0x4cd5cb=_['merge']({},_0x4cd5cb,_0x39c96f['options']);return db[_0xfda3('0x3a')][_0xfda3('0x55')](_0x4cd5cb)[_0xfda3('0x2f')](handleEntityNotFound(_0x11addf,null))[_0xfda3('0x2f')](respondWithResult(_0x11addf,null))[_0xfda3('0x22')](handleError(_0x11addf,null));};exports['create']=function(_0xb3353b,_0x2a30e8){return db[_0xfda3('0x3a')][_0xfda3('0x56')](_0xb3353b[_0xfda3('0x35')],{})[_0xfda3('0x2f')](respondWithResult(_0x2a30e8,0xc9))[_0xfda3('0x22')](handleError(_0x2a30e8,null));};exports[_0xfda3('0x57')]=function(_0x3a8c51,_0x28b6dc){if(_0x3a8c51[_0xfda3('0x35')]['id']){delete _0x3a8c51[_0xfda3('0x35')]['id'];}return db['VtigerAccount'][_0xfda3('0x55')]({'where':{'id':_0x3a8c51[_0xfda3('0x53')]['id']}})[_0xfda3('0x2f')](handleEntityNotFound(_0x28b6dc,null))[_0xfda3('0x2f')](saveUpdates(_0x3a8c51[_0xfda3('0x35')],null))[_0xfda3('0x2f')](respondWithResult(_0x28b6dc,null))[_0xfda3('0x22')](handleError(_0x28b6dc,null));};exports['destroy']=function(_0x5a3a6f,_0x1401d8){return db[_0xfda3('0x3a')]['find']({'where':{'id':_0x5a3a6f[_0xfda3('0x53')]['id']}})[_0xfda3('0x2f')](handleEntityNotFound(_0x1401d8,null))[_0xfda3('0x2f')](removeEntity(_0x1401d8,null))[_0xfda3('0x22')](handleError(_0x1401d8,null));};exports['getConfigurations']=function(_0x524155,_0xb61f7c,_0x34b8f7){var _0x18e53e={};var _0x510f84={};var _0x23fd20;var _0x4b1216;return db[_0xfda3('0x3a')][_0xfda3('0x58')]({'where':{'id':_0x524155[_0xfda3('0x53')]['id']}})[_0xfda3('0x2f')](handleEntityNotFound(_0xb61f7c,null))[_0xfda3('0x2f')](function(_0x217490){if(_0x217490){_0x23fd20=_0x217490;_0x510f84['model']=_[_0xfda3('0x40')](db[_0xfda3('0x59')][_0xfda3('0x3b')]);_0x510f84[_0xfda3('0x3f')]=_[_0xfda3('0x40')](_0x524155['query']);_0x510f84['filters']=_[_0xfda3('0x42')](_0x510f84[_0xfda3('0x3e')],_0x510f84['query']);_0x18e53e['attributes']=_['intersection'](_0x510f84[_0xfda3('0x3e')],qs[_0xfda3('0x44')](_0x524155['query'][_0xfda3('0x44')]));_0x18e53e[_0xfda3('0x43')]=_0x18e53e[_0xfda3('0x43')][_0xfda3('0x54')]?_0x18e53e['attributes']:_0x510f84[_0xfda3('0x3e')];_0x18e53e[_0xfda3('0x47')]=qs[_0xfda3('0x48')](_0x524155[_0xfda3('0x3f')][_0xfda3('0x48')]);_0x18e53e[_0xfda3('0x49')]=qs['filters'](_['pick'](_0x524155[_0xfda3('0x3f')],_0x510f84['filters']));if(_0x524155[_0xfda3('0x3f')][_0xfda3('0x4b')]){_0x18e53e[_0xfda3('0x49')]=_[_0xfda3('0x34')](_0x18e53e[_0xfda3('0x49')],{'$or':_[_0xfda3('0x39')](_0x18e53e[_0xfda3('0x43')],function(_0x10a200){var _0x29b9fb={};_0x29b9fb[_0x10a200]={'$like':'%'+_0x524155[_0xfda3('0x3f')]['filter']+'%'};return _0x29b9fb;})});}_0x18e53e=_[_0xfda3('0x34')]({},_0x18e53e,_0x524155['options']);return _0x23fd20['getConfigurations'](_0x18e53e);}})[_0xfda3('0x2f')](function(_0x238762){if(_0x238762){_0x4b1216=_0x238762['length'];if(!_0x524155[_0xfda3('0x3f')][_0xfda3('0x45')](_0xfda3('0x46'))){_0x18e53e['limit']=qs[_0xfda3('0x29')](_0x524155[_0xfda3('0x3f')][_0xfda3('0x29')]);_0x18e53e[_0xfda3('0x27')]=qs[_0xfda3('0x27')](_0x524155['query']['offset']);}return _0x23fd20['getConfigurations'](_0x18e53e);}})[_0xfda3('0x2f')](function(_0xa032b5){if(_0xa032b5){return _0xa032b5?{'count':_0x4b1216,'rows':_0xa032b5}:null;}})[_0xfda3('0x2f')](respondWithResult(_0xb61f7c,null))[_0xfda3('0x22')](handleError(_0xb61f7c,null));};exports[_0xfda3('0x5a')]=function(_0x21f9ae,_0x47ebd6,_0x27c8dd){if(_0x21f9ae[_0xfda3('0x35')]['id']){delete _0x21f9ae[_0xfda3('0x35')]['id'];}return db[_0xfda3('0x3a')]['findOne']({'where':{'id':_0x21f9ae[_0xfda3('0x53')]['id']}})['then'](handleEntityNotFound(_0x47ebd6,null))[_0xfda3('0x2f')](function(_0x2672f0){if(_0x2672f0){_0x21f9ae[_0xfda3('0x35')][_0xfda3('0x5b')]=_0x2672f0['id'];_0x21f9ae[_0xfda3('0x35')][_0xfda3('0x5c')]=integrations[_0xfda3('0x5d')](_0x21f9ae['body'][_0xfda3('0x5e')],_0x21f9ae[_0xfda3('0x35')][_0xfda3('0x3c')]);_0x21f9ae[_0xfda3('0x35')][_0xfda3('0x5f')]=integrations[_0xfda3('0x60')](_0x21f9ae['body'][_0xfda3('0x5e')],_0x21f9ae[_0xfda3('0x35')][_0xfda3('0x3c')]);return db[_0xfda3('0x59')][_0xfda3('0x56')](_0x21f9ae['body'],{'include':[{'model':db[_0xfda3('0x61')],'as':_0xfda3('0x5c')},{'model':db[_0xfda3('0x61')],'as':_0xfda3('0x5f')}]});}return null;})[_0xfda3('0x2f')](respondWithResult(_0x47ebd6,null))[_0xfda3('0x22')](handleError(_0x47ebd6,null));};var md5=require(_0xfda3('0x62'));exports[_0xfda3('0x63')]=function(_0x3dad4a,_0x8b758f,_0x505f45){var _0x1c0e07=null;var _0x271403=null;var _0x46210d=null;var _0x1da0d8=null;var _0x213bb1='';return db['VtigerAccount']['findOne']({'where':{'id':_0x3dad4a[_0xfda3('0x53')]['id']},'attributes':['id',_0xfda3('0x31'),_0xfda3('0x64'),_0xfda3('0x65'),_0xfda3('0x66'),_0xfda3('0x67'),_0xfda3('0x68'),_0xfda3('0x69')]})[_0xfda3('0x2f')](handleEntityNotFound(_0x8b758f,null))[_0xfda3('0x2f')](function(_0x43fd8d){if(_0x43fd8d){_0x1c0e07=_0x43fd8d['username'];_0x271403=_0x43fd8d[_0xfda3('0x69')];_0x46210d=_0x43fd8d['moduleName'];_0x213bb1=_0x43fd8d['remoteUri'];var _0x59e6ae=_0x213bb1[_0xfda3('0x6a')](-0x1);if(_0x59e6ae==='/'){_0x213bb1=_0x213bb1['substring'](0x0,_0x213bb1[_0xfda3('0x6b')](_0x59e6ae));}_0x1da0d8=util[_0xfda3('0x6c')]('%s/webservice.php',_0x213bb1);var _0x2821c1={'method':_0xfda3('0x6d'),'uri':_0x1da0d8,'qs':{'operation':'getchallenge','username':_0x43fd8d[_0xfda3('0x64')]},'json':!![]};return rp(_0x2821c1);}})['then'](function(_0x35e986){if(_0x35e986[_0xfda3('0x6e')]){var _0x5ee695={'method':_0xfda3('0x6f'),'uri':_0x1da0d8,'form':{'operation':_0xfda3('0x70'),'username':_0x1c0e07,'accessKey':md5(_0x35e986[_0xfda3('0x21')][_0xfda3('0x71')]+_0x271403)},'json':!![]};return rp(_0x5ee695);}})[_0xfda3('0x2f')](function(_0x4e5791){if(_0x4e5791[_0xfda3('0x6e')]){var _0xda6b1a={'method':_0xfda3('0x6d'),'uri':_0x1da0d8,'qs':{'operation':_0xfda3('0x72'),'username':_0x1c0e07,'sessionName':_0x4e5791[_0xfda3('0x21')]['sessionName'],'elementType':_0x46210d},'json':!![]};return rp(_0xda6b1a);}})['then'](function(_0x53e829){if(_0x53e829[_0xfda3('0x6e')]){var _0x3158a7=[_0xfda3('0x73'),_0xfda3('0x74'),_0xfda3('0x75')];_[_0xfda3('0x76')](_0x53e829[_0xfda3('0x21')][_0xfda3('0x44')],function(_0x504ad3){return _0x3158a7[_0xfda3('0x77')](_0x504ad3[_0xfda3('0x3c')]['name']);});_[_0xfda3('0x76')](_0x53e829[_0xfda3('0x21')]['fields'],function(_0x4cd3bd){return _0x4cd3bd[_0xfda3('0x78')]===_0xfda3('0x79');});return{'count':_0x53e829[_0xfda3('0x21')][_0xfda3('0x44')]['length'],'rows':_[_0xfda3('0x39')](_0x53e829[_0xfda3('0x21')][_0xfda3('0x44')],function(_0x42057b){return{'id':_0x42057b['name'],'name':_0x42057b[_0xfda3('0x7a')],'custom':_[_0xfda3('0x7b')](_0x42057b[_0xfda3('0x31')],_0xfda3('0x7c'))?!![]:![],'options':_0x42057b[_0xfda3('0x3c')][_0xfda3('0x31')]===_0xfda3('0x7d')&&_0x42057b[_0xfda3('0x3c')][_0xfda3('0x7e')][_0xfda3('0x54')]>0x0?_[_0xfda3('0x39')](_0x42057b['type']['picklistValues'],function(_0x44d6d7){return{'name':_0x44d6d7['label'],'value':_0x44d6d7[_0xfda3('0x7f')]};}):[]};})};}})['then'](respondWithResult(_0x8b758f,null))['catch'](function(_0x55c165){console[_0xfda3('0x80')](_0xfda3('0x81')+_0x55c165);var _0x5d7718=_0x3dad4a['query']['test']?0x1f4:_0x55c165['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xfda3('0x63'),_0x5d7718,JSON['stringify'](_0x55c165));delete _0x55c165['name'];if(_0x5d7718===0x191){_0x5d7718=0x190;}_0x8b758f[_0xfda3('0x24')](_0x5d7718)['send'](_0x3dad4a['query'][_0xfda3('0x82')]?{'message':_0xfda3('0x83'),'statusCode':_0x55c165[_0xfda3('0x84')]}:_0x55c165);});}; \ No newline at end of file +var _0xf4eb=['info','result','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','stack','name','merge','body','contact','agent','interaction','account','index','VtigerAccount','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','create','find','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','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','../../components/integrations/configuration','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4baec4,_0x51e399){var _0x24d698=function(_0x8d54cd){while(--_0x8d54cd){_0x4baec4['push'](_0x4baec4['shift']());}};_0x24d698(++_0x51e399);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2e0715,_0x516428){_0x2e0715=_0x2e0715-0x0;var _0xaff549=_0xf4eb[_0x2e0715];return _0xaff549;};'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'];var integrations=require(_0xbf4e('0x13'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf4e('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x46c79c,_0x1e029b,_0x302841,_0x3b74bd){return new BPromise(function(_0x61bd54,_0x4984b4){var _0x59fb15=_0x3b74bd||client;return _0x59fb15[_0xbf4e('0x15')](_0x46c79c,_0x302841)[_0xbf4e('0x16')](function(_0x28fc6b){logger['info'](_0xbf4e('0x17'),_0x1e029b,_0xbf4e('0x18'));logger[_0xbf4e('0x19')](_0xbf4e('0x1a'),_0x1e029b,'request\x20sent',JSON[_0xbf4e('0x1b')](_0x28fc6b));if(_0x28fc6b['error']){if(_0x28fc6b['error']['code']===0x1f4){logger['error'](_0xbf4e('0x17'),_0x1e029b,_0x28fc6b[_0xbf4e('0x1c')][_0xbf4e('0x1d')]);return _0x4984b4(_0x28fc6b['error']['message']);}logger[_0xbf4e('0x1c')](_0xbf4e('0x17'),_0x1e029b,_0x28fc6b[_0xbf4e('0x1c')][_0xbf4e('0x1d')]);return _0x61bd54(_0x28fc6b[_0xbf4e('0x1c')][_0xbf4e('0x1d')]);}else{logger[_0xbf4e('0x1e')](_0xbf4e('0x17'),_0x1e029b,_0xbf4e('0x18'));_0x61bd54(_0x28fc6b[_0xbf4e('0x1f')][_0xbf4e('0x1d')]);}})['catch'](function(_0x1ff2ec){logger[_0xbf4e('0x1c')]('VtigerAccount,\x20%s,\x20%s',_0x1e029b,_0x1ff2ec);_0x4984b4(_0x1ff2ec);});});}function respondWithStatusCode(_0x31e3f5,_0x30994d){_0x30994d=_0x30994d||0xcc;return function(_0x114412){if(_0x114412){return _0x31e3f5[_0xbf4e('0x20')](_0x30994d);}return _0x31e3f5[_0xbf4e('0x21')](_0x30994d)['end']();};}function respondWithResult(_0x90635e,_0x36688a){_0x36688a=_0x36688a||0xc8;return function(_0x3d6863){if(_0x3d6863){return _0x90635e['status'](_0x36688a)[_0xbf4e('0x22')](_0x3d6863);}};}function respondWithFilteredResult(_0x5e08b1,_0x5bcf71){return function(_0x2bfccf){if(_0x2bfccf){var _0x5a0a9b=typeof _0x5bcf71[_0xbf4e('0x23')]===_0xbf4e('0x24')&&typeof _0x5bcf71[_0xbf4e('0x25')]===_0xbf4e('0x24');var _0x5c912f=_0x2bfccf[_0xbf4e('0x26')];var _0x8e0ab5=_0x5a0a9b?0x0:_0x5bcf71[_0xbf4e('0x23')];var _0x4cd4a1=_0x5a0a9b?_0x2bfccf[_0xbf4e('0x26')]:_0x5bcf71['offset']+_0x5bcf71[_0xbf4e('0x25')];var _0x1421e1;if(_0x4cd4a1>=_0x5c912f){_0x4cd4a1=_0x5c912f;_0x1421e1=0xc8;}else{_0x1421e1=0xce;}_0x5e08b1[_0xbf4e('0x21')](_0x1421e1);return _0x5e08b1['set'](_0xbf4e('0x27'),_0x8e0ab5+'-'+_0x4cd4a1+'/'+_0x5c912f)[_0xbf4e('0x22')](_0x2bfccf);}return null;};}function patchUpdates(_0x2f3cf8){return function(_0xc7ca87){try{jsonpatch[_0xbf4e('0x28')](_0xc7ca87,_0x2f3cf8,!![]);}catch(_0x3b5776){return BPromise['reject'](_0x3b5776);}return _0xc7ca87[_0xbf4e('0x29')]();};}function saveUpdates(_0x154576,_0x5e32c0){return function(_0x3d8959){if(_0x3d8959){return _0x3d8959[_0xbf4e('0x2a')](_0x154576)['then'](function(_0x23d769){return _0x23d769;});}return null;};}function removeEntity(_0x5d8285,_0x10722a){return function(_0x59b161){if(_0x59b161){return _0x59b161[_0xbf4e('0x2b')]()[_0xbf4e('0x16')](function(){_0x5d8285[_0xbf4e('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2716b7,_0x32996d){return function(_0x70c54f){if(!_0x70c54f){_0x2716b7[_0xbf4e('0x20')](0x194);}return _0x70c54f;};}function handleError(_0xb93672,_0x477873){_0x477873=_0x477873||0x1f4;return function(_0x5b8440){logger[_0xbf4e('0x1c')](_0x5b8440[_0xbf4e('0x2c')]);if(_0x5b8440[_0xbf4e('0x2d')]){delete _0x5b8440[_0xbf4e('0x2d')];}_0xb93672[_0xbf4e('0x21')](_0x477873)['send'](_0x5b8440);};}function getMustacheRender(_0x4864bd,_0x4b733d){return Mustache['render'](_0x4864bd,_[_0xbf4e('0x2e')](_0x4b733d[_0xbf4e('0x2f')],{'contact':_0x4b733d[_0xbf4e('0x30')],'message':_0x4b733d[_0xbf4e('0x1d')],'agent':_0x4b733d[_0xbf4e('0x31')],'interaction':_0x4b733d[_0xbf4e('0x32')],'account':_0x4b733d[_0xbf4e('0x33')]}))||'';}exports[_0xbf4e('0x34')]=function(_0x1f36aa,_0x54527d){var _0x4f6e93={},_0x303fd8={},_0x2b25d2={'count':0x0,'rows':[]};var _0x2cf1b0=_['map'](db[_0xbf4e('0x35')]['rawAttributes'],function(_0x370d90){return{'name':_0x370d90[_0xbf4e('0x36')],'type':_0x370d90[_0xbf4e('0x37')][_0xbf4e('0x38')]};});_0x303fd8['model']=_[_0xbf4e('0x39')](_0x2cf1b0,_0xbf4e('0x2d'));_0x303fd8[_0xbf4e('0x3a')]=_[_0xbf4e('0x3b')](_0x1f36aa['query']);_0x303fd8[_0xbf4e('0x3c')]=_[_0xbf4e('0x3d')](_0x303fd8[_0xbf4e('0x3e')],_0x303fd8[_0xbf4e('0x3a')]);_0x4f6e93[_0xbf4e('0x3f')]=_[_0xbf4e('0x3d')](_0x303fd8[_0xbf4e('0x3e')],qs['fields'](_0x1f36aa[_0xbf4e('0x3a')][_0xbf4e('0x40')]));_0x4f6e93['attributes']=_0x4f6e93['attributes'][_0xbf4e('0x41')]?_0x4f6e93[_0xbf4e('0x3f')]:_0x303fd8['model'];if(!_0x1f36aa['query'][_0xbf4e('0x42')](_0xbf4e('0x43'))){_0x4f6e93[_0xbf4e('0x25')]=qs[_0xbf4e('0x25')](_0x1f36aa[_0xbf4e('0x3a')][_0xbf4e('0x25')]);_0x4f6e93['offset']=qs[_0xbf4e('0x23')](_0x1f36aa[_0xbf4e('0x3a')]['offset']);}_0x4f6e93['order']=qs['sort'](_0x1f36aa['query'][_0xbf4e('0x44')]);_0x4f6e93['where']=qs[_0xbf4e('0x3c')](_[_0xbf4e('0x45')](_0x1f36aa['query'],_0x303fd8['filters']),_0x2cf1b0);if(_0x1f36aa[_0xbf4e('0x3a')][_0xbf4e('0x46')]){_0x4f6e93[_0xbf4e('0x47')]=_[_0xbf4e('0x2e')](_0x4f6e93[_0xbf4e('0x47')],{'$or':_['map'](_0x2cf1b0,function(_0x2b20d3){if(_0x2b20d3[_0xbf4e('0x37')]!==_0xbf4e('0x48')){var _0x39843e={};_0x39843e[_0x2b20d3[_0xbf4e('0x2d')]]={'$like':'%'+_0x1f36aa[_0xbf4e('0x3a')][_0xbf4e('0x46')]+'%'};return _0x39843e;}})});}_0x4f6e93=_[_0xbf4e('0x2e')]({},_0x4f6e93,_0x1f36aa['options']);var _0x43ebde={'where':_0x4f6e93[_0xbf4e('0x47')]};return db[_0xbf4e('0x35')][_0xbf4e('0x26')](_0x43ebde)[_0xbf4e('0x16')](function(_0x1198e8){_0x2b25d2[_0xbf4e('0x26')]=_0x1198e8;if(_0x1f36aa[_0xbf4e('0x3a')][_0xbf4e('0x49')]){_0x4f6e93[_0xbf4e('0x4a')]=[{'all':!![]}];}return db[_0xbf4e('0x35')][_0xbf4e('0x4b')](_0x4f6e93);})[_0xbf4e('0x16')](function(_0x2ea101){_0x2b25d2[_0xbf4e('0x4c')]=_0x2ea101;return _0x2b25d2;})[_0xbf4e('0x16')](respondWithFilteredResult(_0x54527d,_0x4f6e93))[_0xbf4e('0x4d')](handleError(_0x54527d,null));};exports['show']=function(_0x22d8ef,_0x17a7be){var _0x348fbd={'raw':![],'where':{'id':_0x22d8ef[_0xbf4e('0x4e')]['id']}},_0x4ac47b={};_0x4ac47b['model']=_['keys'](db[_0xbf4e('0x35')][_0xbf4e('0x4f')]);_0x4ac47b['query']=_[_0xbf4e('0x3b')](_0x22d8ef[_0xbf4e('0x3a')]);_0x4ac47b[_0xbf4e('0x3c')]=_[_0xbf4e('0x3d')](_0x4ac47b[_0xbf4e('0x3e')],_0x4ac47b[_0xbf4e('0x3a')]);_0x348fbd[_0xbf4e('0x3f')]=_[_0xbf4e('0x3d')](_0x4ac47b[_0xbf4e('0x3e')],qs[_0xbf4e('0x40')](_0x22d8ef[_0xbf4e('0x3a')]['fields']));_0x348fbd['attributes']=_0x348fbd[_0xbf4e('0x3f')][_0xbf4e('0x41')]?_0x348fbd[_0xbf4e('0x3f')]:_0x4ac47b['model'];if(_0x22d8ef[_0xbf4e('0x3a')][_0xbf4e('0x49')]){_0x348fbd['include']=[{'all':!![]}];}_0x348fbd=_['merge']({},_0x348fbd,_0x22d8ef[_0xbf4e('0x50')]);return db['VtigerAccount']['find'](_0x348fbd)[_0xbf4e('0x16')](handleEntityNotFound(_0x17a7be,null))[_0xbf4e('0x16')](respondWithResult(_0x17a7be,null))[_0xbf4e('0x4d')](handleError(_0x17a7be,null));};exports[_0xbf4e('0x51')]=function(_0x6ff233,_0x5ec2d9){return db[_0xbf4e('0x35')]['create'](_0x6ff233[_0xbf4e('0x2f')],{})['then'](respondWithResult(_0x5ec2d9,0xc9))[_0xbf4e('0x4d')](handleError(_0x5ec2d9,null));};exports['update']=function(_0xab6991,_0x6c593a){if(_0xab6991[_0xbf4e('0x2f')]['id']){delete _0xab6991[_0xbf4e('0x2f')]['id'];}return db[_0xbf4e('0x35')]['find']({'where':{'id':_0xab6991['params']['id']}})['then'](handleEntityNotFound(_0x6c593a,null))['then'](saveUpdates(_0xab6991[_0xbf4e('0x2f')],null))[_0xbf4e('0x16')](respondWithResult(_0x6c593a,null))['catch'](handleError(_0x6c593a,null));};exports[_0xbf4e('0x2b')]=function(_0x23c335,_0x458fea){return db[_0xbf4e('0x35')][_0xbf4e('0x52')]({'where':{'id':_0x23c335[_0xbf4e('0x4e')]['id']}})[_0xbf4e('0x16')](handleEntityNotFound(_0x458fea,null))['then'](removeEntity(_0x458fea,null))[_0xbf4e('0x4d')](handleError(_0x458fea,null));};exports[_0xbf4e('0x53')]=function(_0x42e117,_0x5e548a,_0x56338e){var _0x64d8ea={};var _0x301d66={};var _0x2e8a62;var _0x480fd2;return db[_0xbf4e('0x35')][_0xbf4e('0x54')]({'where':{'id':_0x42e117[_0xbf4e('0x4e')]['id']}})[_0xbf4e('0x16')](handleEntityNotFound(_0x5e548a,null))[_0xbf4e('0x16')](function(_0x5532df){if(_0x5532df){_0x2e8a62=_0x5532df;_0x301d66[_0xbf4e('0x3e')]=_[_0xbf4e('0x3b')](db[_0xbf4e('0x55')][_0xbf4e('0x4f')]);_0x301d66[_0xbf4e('0x3a')]=_[_0xbf4e('0x3b')](_0x42e117['query']);_0x301d66[_0xbf4e('0x3c')]=_['intersection'](_0x301d66[_0xbf4e('0x3e')],_0x301d66[_0xbf4e('0x3a')]);_0x64d8ea[_0xbf4e('0x3f')]=_[_0xbf4e('0x3d')](_0x301d66[_0xbf4e('0x3e')],qs[_0xbf4e('0x40')](_0x42e117[_0xbf4e('0x3a')][_0xbf4e('0x40')]));_0x64d8ea['attributes']=_0x64d8ea[_0xbf4e('0x3f')][_0xbf4e('0x41')]?_0x64d8ea[_0xbf4e('0x3f')]:_0x301d66[_0xbf4e('0x3e')];_0x64d8ea[_0xbf4e('0x56')]=qs['sort'](_0x42e117[_0xbf4e('0x3a')][_0xbf4e('0x44')]);_0x64d8ea[_0xbf4e('0x47')]=qs[_0xbf4e('0x3c')](_[_0xbf4e('0x45')](_0x42e117[_0xbf4e('0x3a')],_0x301d66['filters']));if(_0x42e117[_0xbf4e('0x3a')]['filter']){_0x64d8ea[_0xbf4e('0x47')]=_[_0xbf4e('0x2e')](_0x64d8ea[_0xbf4e('0x47')],{'$or':_[_0xbf4e('0x39')](_0x64d8ea['attributes'],function(_0x24fb65){var _0x5aee1d={};_0x5aee1d[_0x24fb65]={'$like':'%'+_0x42e117['query'][_0xbf4e('0x46')]+'%'};return _0x5aee1d;})});}_0x64d8ea=_[_0xbf4e('0x2e')]({},_0x64d8ea,_0x42e117[_0xbf4e('0x50')]);return _0x2e8a62['getConfigurations'](_0x64d8ea);}})[_0xbf4e('0x16')](function(_0x43bba9){if(_0x43bba9){_0x480fd2=_0x43bba9['length'];if(!_0x42e117[_0xbf4e('0x3a')][_0xbf4e('0x42')](_0xbf4e('0x43'))){_0x64d8ea[_0xbf4e('0x25')]=qs[_0xbf4e('0x25')](_0x42e117[_0xbf4e('0x3a')][_0xbf4e('0x25')]);_0x64d8ea[_0xbf4e('0x23')]=qs[_0xbf4e('0x23')](_0x42e117['query'][_0xbf4e('0x23')]);}return _0x2e8a62[_0xbf4e('0x53')](_0x64d8ea);}})[_0xbf4e('0x16')](function(_0x11008d){if(_0x11008d){return _0x11008d?{'count':_0x480fd2,'rows':_0x11008d}:null;}})['then'](respondWithResult(_0x5e548a,null))[_0xbf4e('0x4d')](handleError(_0x5e548a,null));};exports[_0xbf4e('0x57')]=function(_0x40e566,_0x25ce0d,_0x3067fb){if(_0x40e566[_0xbf4e('0x2f')]['id']){delete _0x40e566[_0xbf4e('0x2f')]['id'];}return db[_0xbf4e('0x35')][_0xbf4e('0x54')]({'where':{'id':_0x40e566['params']['id']}})[_0xbf4e('0x16')](handleEntityNotFound(_0x25ce0d,null))['then'](function(_0x11dcdb){if(_0x11dcdb){_0x40e566[_0xbf4e('0x2f')][_0xbf4e('0x58')]=_0x11dcdb['id'];_0x40e566[_0xbf4e('0x2f')][_0xbf4e('0x59')]=integrations['getSubjects'](_0x40e566[_0xbf4e('0x2f')][_0xbf4e('0x5a')],_0x40e566[_0xbf4e('0x2f')]['type']);_0x40e566[_0xbf4e('0x2f')][_0xbf4e('0x5b')]=integrations[_0xbf4e('0x5c')](_0x40e566['body'][_0xbf4e('0x5a')],_0x40e566[_0xbf4e('0x2f')][_0xbf4e('0x37')]);return db[_0xbf4e('0x55')][_0xbf4e('0x51')](_0x40e566['body'],{'include':[{'model':db[_0xbf4e('0x5d')],'as':'Subjects'},{'model':db[_0xbf4e('0x5d')],'as':'Descriptions'}]});}return null;})[_0xbf4e('0x16')](respondWithResult(_0x25ce0d,null))['catch'](handleError(_0x25ce0d,null));};var md5=require(_0xbf4e('0x5e'));exports['getFields']=function(_0x4405eb,_0x2227a9,_0xf3edea){var _0x23de82=null;var _0x272bf7=null;var _0xea3331=null;var _0x149af6=null;var _0x51b5b2='';return db[_0xbf4e('0x35')][_0xbf4e('0x54')]({'where':{'id':_0x4405eb[_0xbf4e('0x4e')]['id']},'attributes':['id',_0xbf4e('0x2d'),_0xbf4e('0x5f'),_0xbf4e('0x60'),'moduleName',_0xbf4e('0x61'),_0xbf4e('0x62'),'accessKey']})[_0xbf4e('0x16')](handleEntityNotFound(_0x2227a9,null))[_0xbf4e('0x16')](function(_0x2650d8){if(_0x2650d8){_0x23de82=_0x2650d8[_0xbf4e('0x5f')];_0x272bf7=_0x2650d8[_0xbf4e('0x63')];_0xea3331=_0x2650d8[_0xbf4e('0x64')];_0x51b5b2=_0x2650d8[_0xbf4e('0x61')];var _0x1e7b1a=_0x51b5b2[_0xbf4e('0x65')](-0x1);if(_0x1e7b1a==='/'){_0x51b5b2=_0x51b5b2['substring'](0x0,_0x51b5b2[_0xbf4e('0x66')](_0x1e7b1a));}_0x149af6=util[_0xbf4e('0x67')](_0xbf4e('0x68'),_0x51b5b2);var _0x4ee7ac={'method':_0xbf4e('0x69'),'uri':_0x149af6,'qs':{'operation':_0xbf4e('0x6a'),'username':_0x2650d8['username']},'json':!![]};return rp(_0x4ee7ac);}})[_0xbf4e('0x16')](function(_0x3ebab2){if(_0x3ebab2[_0xbf4e('0x6b')]){var _0xef121e={'method':_0xbf4e('0x6c'),'uri':_0x149af6,'form':{'operation':_0xbf4e('0x6d'),'username':_0x23de82,'accessKey':md5(_0x3ebab2[_0xbf4e('0x1f')][_0xbf4e('0x6e')]+_0x272bf7)},'json':!![]};return rp(_0xef121e);}})[_0xbf4e('0x16')](function(_0x1e113d){if(_0x1e113d['success']){var _0x57ca27={'method':_0xbf4e('0x69'),'uri':_0x149af6,'qs':{'operation':_0xbf4e('0x6f'),'username':_0x23de82,'sessionName':_0x1e113d[_0xbf4e('0x1f')][_0xbf4e('0x70')],'elementType':_0xea3331},'json':!![]};return rp(_0x57ca27);}})['then'](function(_0x19108b){if(_0x19108b[_0xbf4e('0x6b')]){var _0x299af9=[_0xbf4e('0x71'),_0xbf4e('0x72'),_0xbf4e('0x73')];_[_0xbf4e('0x74')](_0x19108b['result'][_0xbf4e('0x40')],function(_0x54d5ac){return _0x299af9[_0xbf4e('0x75')](_0x54d5ac[_0xbf4e('0x37')][_0xbf4e('0x2d')]);});_[_0xbf4e('0x74')](_0x19108b['result'][_0xbf4e('0x40')],function(_0x25ce6d){return _0x25ce6d[_0xbf4e('0x76')]===_0xbf4e('0x77');});return{'count':_0x19108b[_0xbf4e('0x1f')][_0xbf4e('0x40')][_0xbf4e('0x41')],'rows':_['map'](_0x19108b['result'][_0xbf4e('0x40')],function(_0x471235){return{'id':_0x471235[_0xbf4e('0x2d')],'name':_0x471235[_0xbf4e('0x78')],'custom':_[_0xbf4e('0x79')](_0x471235[_0xbf4e('0x2d')],_0xbf4e('0x7a'))?!![]:![],'options':_0x471235['type'][_0xbf4e('0x2d')]===_0xbf4e('0x7b')&&_0x471235[_0xbf4e('0x37')]['picklistValues']['length']>0x0?_[_0xbf4e('0x39')](_0x471235[_0xbf4e('0x37')][_0xbf4e('0x7c')],function(_0x5b0376){return{'name':_0x5b0376[_0xbf4e('0x78')],'value':_0x5b0376[_0xbf4e('0x7d')]};}):[]};})};}})[_0xbf4e('0x16')](respondWithResult(_0x2227a9,null))['catch'](function(_0x4649f4){console[_0xbf4e('0x7e')](_0xbf4e('0x7f')+_0x4649f4);var _0x43a285=_0x4405eb[_0xbf4e('0x3a')][_0xbf4e('0x80')]?0x1f4:_0x4649f4[_0xbf4e('0x81')]||0x1f4;logger[_0xbf4e('0x1c')](_0xbf4e('0x82'),_0xbf4e('0x83'),_0x43a285,JSON[_0xbf4e('0x1b')](_0x4649f4));delete _0x4649f4['name'];if(_0x43a285===0x191){_0x43a285=0x190;}_0x2227a9[_0xbf4e('0x21')](_0x43a285)['send'](_0x4405eb[_0xbf4e('0x3a')][_0xbf4e('0x80')]?{'message':_0xbf4e('0x84'),'statusCode':_0x4649f4[_0xbf4e('0x81')]}:_0x4649f4);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index ad40249..7c3f025 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 _0xffc6=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x4482b6,_0x58988d){var _0x257806=function(_0x5113b8){while(--_0x5113b8){_0x4482b6['push'](_0x4482b6['shift']());}};_0x257806(++_0x58988d);}(_0xffc6,0x1b0));var _0x6ffc=function(_0x20da4,_0x33a01e){_0x20da4=_0x20da4-0x0;var _0x10a2ea=_0xffc6[_0x20da4];return _0x10a2ea;};'use strict';var _=require(_0x6ffc('0x0'));var util=require(_0x6ffc('0x1'));var logger=require(_0x6ffc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ffc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ffc('0x4'));var rimraf=require(_0x6ffc('0x5'));var config=require(_0x6ffc('0x6'));var attributes=require(_0x6ffc('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x6ffc('0x8')]=function(_0x2ed43b,_0xfa228b){return _0x2ed43b[_0x6ffc('0x9')](_0x6ffc('0xa'),attributes,{'tableName':_0x6ffc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5484=['../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x405f8d,_0x3221ec){var _0x34e89=function(_0x1bdec1){while(--_0x1bdec1){_0x405f8d['push'](_0x405f8d['shift']());}};_0x34e89(++_0x3221ec);}(_0x5484,0x15e));var _0x4548=function(_0x4e5b34,_0x23c0e8){_0x4e5b34=_0x4e5b34-0x0;var _0x2551ec=_0x5484[_0x4e5b34];return _0x2551ec;};'use strict';var _=require('lodash');var util=require(_0x4548('0x0'));var logger=require(_0x4548('0x1'))(_0x4548('0x2'));var moment=require(_0x4548('0x3'));var BPromise=require(_0x4548('0x4'));var rp=require(_0x4548('0x5'));var fs=require('fs');var path=require(_0x4548('0x6'));var rimraf=require(_0x4548('0x7'));var config=require(_0x4548('0x8'));var attributes=require(_0x4548('0x9'));var integrations=require(_0x4548('0xa'));module[_0x4548('0xb')]=function(_0x3aefe1,_0x266185){return _0x3aefe1[_0x4548('0xc')](_0x4548('0xd'),attributes,{'tableName':_0x4548('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 6cae24c..7d352bf 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 _0xeff2=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','info','GetVtigerAccount','ShowVtigerAccount','find','raw','lodash','util'];(function(_0x5bd402,_0x86e6f){var _0xfa769f=function(_0xccc4c){while(--_0xccc4c){_0x5bd402['push'](_0x5bd402['shift']());}};_0xfa769f(++_0x86e6f);}(_0xeff2,0xd0));var _0x2eff=function(_0x38f151,_0x3c9640){_0x38f151=_0x38f151-0x0;var _0x31d3bd=_0xeff2[_0x38f151];return _0x31d3bd;};'use strict';var _=require(_0x2eff('0x0'));var util=require(_0x2eff('0x1'));var moment=require(_0x2eff('0x2'));var BPromise=require('bluebird');var rs=require(_0x2eff('0x3'));var fs=require('fs');var Redis=require(_0x2eff('0x4'));var db=require(_0x2eff('0x5'))['db'];var utils=require(_0x2eff('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2eff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2eff('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b0624,_0x215082,_0x4d314f){return new BPromise(function(_0x2041d2,_0x3f447f){return client[_0x2eff('0x9')](_0x1b0624,_0x4d314f)[_0x2eff('0xa')](function(_0x45b217){logger['info'](_0x2eff('0xb'),_0x215082,'request\x20sent');logger[_0x2eff('0xc')](_0x2eff('0xd'),_0x215082,_0x2eff('0xe'),JSON[_0x2eff('0xf')](_0x45b217));if(_0x45b217['error']){if(_0x45b217[_0x2eff('0x10')][_0x2eff('0x11')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x215082,_0x45b217['error'][_0x2eff('0x12')]);return _0x3f447f(_0x45b217['error'][_0x2eff('0x12')]);}logger[_0x2eff('0x10')](_0x2eff('0xb'),_0x215082,_0x45b217[_0x2eff('0x10')]['message']);return _0x2041d2(_0x45b217[_0x2eff('0x10')][_0x2eff('0x12')]);}else{logger['info'](_0x2eff('0xb'),_0x215082,_0x2eff('0xe'));_0x2041d2(_0x45b217[_0x2eff('0x13')]['message']);}})[_0x2eff('0x14')](function(_0x272ddd){logger[_0x2eff('0x10')](_0x2eff('0xb'),_0x215082,_0x272ddd);_0x3f447f(_0x272ddd);});});}exports['GetVtigerAccount']=function(_0x3f5b65){var _0x26c337=this;return new Promise(function(_0x57ac2e,_0x184f35){return db[_0x2eff('0x15')][_0x2eff('0x16')]({'raw':_0x3f5b65[_0x2eff('0x17')]?_0x3f5b65[_0x2eff('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3f5b65[_0x2eff('0x17')]?_0x3f5b65[_0x2eff('0x17')][_0x2eff('0x18')]||null:null,'attributes':_0x3f5b65[_0x2eff('0x17')]?_0x3f5b65[_0x2eff('0x17')][_0x2eff('0x19')]||null:null,'limit':_0x3f5b65[_0x2eff('0x17')]?_0x3f5b65[_0x2eff('0x17')][_0x2eff('0x1a')]||null:null,'include':_0x3f5b65[_0x2eff('0x17')]?_0x3f5b65[_0x2eff('0x17')]['include']?_['map'](_0x3f5b65[_0x2eff('0x17')][_0x2eff('0x1b')],function(_0x4de605){return{'model':db[_0x4de605[_0x2eff('0x1c')]],'as':_0x4de605['as'],'attributes':_0x4de605[_0x2eff('0x19')],'include':_0x4de605[_0x2eff('0x1b')]?_[_0x2eff('0x1d')](_0x4de605['include'],function(_0xb1341e){return{'model':db[_0xb1341e[_0x2eff('0x1c')]],'as':_0xb1341e['as'],'attributes':_0xb1341e[_0x2eff('0x19')],'include':_0xb1341e[_0x2eff('0x1b')]?_[_0x2eff('0x1d')](_0xb1341e[_0x2eff('0x1b')],function(_0x3ccc55){return{'model':db[_0x3ccc55[_0x2eff('0x1c')]],'as':_0x3ccc55['as'],'attributes':_0x3ccc55['attributes']};}):[]};}):[]};}):[]:[]})[_0x2eff('0xa')](function(_0x1ffc7c){logger[_0x2eff('0x1e')](_0x2eff('0x1f'),_0x3f5b65);logger[_0x2eff('0xc')](_0x2eff('0x1f'),_0x3f5b65,JSON[_0x2eff('0xf')](_0x1ffc7c));_0x57ac2e(_0x1ffc7c);})['catch'](function(_0x4ae659){logger['error'](_0x2eff('0x1f'),_0x4ae659[_0x2eff('0x12')],_0x3f5b65);_0x184f35(_0x26c337[_0x2eff('0x10')](0x1f4,_0x4ae659[_0x2eff('0x12')]));});});};exports[_0x2eff('0x20')]=function(_0x30bfb4){var _0x413c38=this;return new Promise(function(_0x5de5b0,_0x2d66ed){return db[_0x2eff('0x15')][_0x2eff('0x21')]({'raw':_0x30bfb4[_0x2eff('0x17')]?_0x30bfb4[_0x2eff('0x17')][_0x2eff('0x22')]===undefined?!![]:![]:!![],'where':_0x30bfb4['options']?_0x30bfb4[_0x2eff('0x17')][_0x2eff('0x18')]||null:null,'attributes':_0x30bfb4[_0x2eff('0x17')]?_0x30bfb4[_0x2eff('0x17')][_0x2eff('0x19')]||null:null,'include':_0x30bfb4['options']?_0x30bfb4[_0x2eff('0x17')][_0x2eff('0x1b')]?_['map'](_0x30bfb4[_0x2eff('0x17')][_0x2eff('0x1b')],function(_0x556e27){return{'model':db[_0x556e27[_0x2eff('0x1c')]],'as':_0x556e27['as'],'attributes':_0x556e27[_0x2eff('0x19')],'include':_0x556e27[_0x2eff('0x1b')]?_[_0x2eff('0x1d')](_0x556e27[_0x2eff('0x1b')],function(_0x27597f){return{'model':db[_0x27597f[_0x2eff('0x1c')]],'as':_0x27597f['as'],'attributes':_0x27597f['attributes'],'include':_0x27597f[_0x2eff('0x1b')]?_[_0x2eff('0x1d')](_0x27597f[_0x2eff('0x1b')],function(_0x2edf85){return{'model':db[_0x2edf85[_0x2eff('0x1c')]],'as':_0x2edf85['as'],'attributes':_0x2edf85[_0x2eff('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x213870){logger[_0x2eff('0x1e')](_0x2eff('0x20'),_0x30bfb4);logger[_0x2eff('0xc')](_0x2eff('0x20'),_0x30bfb4,JSON[_0x2eff('0xf')](_0x213870));_0x5de5b0(_0x213870);})[_0x2eff('0x14')](function(_0x4014b1){logger[_0x2eff('0x10')](_0x2eff('0x20'),_0x4014b1[_0x2eff('0x12')],_0x30bfb4);_0x2d66ed(_0x413c38['error'](0x1f4,_0x4014b1['message']));});});}; \ No newline at end of file +var _0x2c2c=['message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','find','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','VtigerAccount,\x20%s,\x20%s'];(function(_0x381cd7,_0x5cd931){var _0x42fb4d=function(_0x2ee505){while(--_0x2ee505){_0x381cd7['push'](_0x381cd7['shift']());}};_0x42fb4d(++_0x5cd931);}(_0x2c2c,0x14f));var _0xc2c2=function(_0x25c6a6,_0x5b530b){_0x25c6a6=_0x25c6a6-0x0;var _0x148594=_0x2c2c[_0x25c6a6];return _0x148594;};'use strict';var _=require(_0xc2c2('0x0'));var util=require('util');var moment=require(_0xc2c2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2c2('0x2'));var db=require(_0xc2c2('0x3'))['db'];var utils=require(_0xc2c2('0x4'));var logger=require(_0xc2c2('0x5'))(_0xc2c2('0x6'));var config=require(_0xc2c2('0x7'));var jayson=require(_0xc2c2('0x8'));var client=jayson[_0xc2c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53897f,_0x163805,_0x23523f){return new BPromise(function(_0x5aa6a9,_0x1d6c52){return client['request'](_0x53897f,_0x23523f)[_0xc2c2('0xa')](function(_0x2e56a6){logger[_0xc2c2('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x163805,_0xc2c2('0xc'));logger[_0xc2c2('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x163805,_0xc2c2('0xc'),JSON[_0xc2c2('0xe')](_0x2e56a6));if(_0x2e56a6[_0xc2c2('0xf')]){if(_0x2e56a6[_0xc2c2('0xf')]['code']===0x1f4){logger[_0xc2c2('0xf')](_0xc2c2('0x10'),_0x163805,_0x2e56a6[_0xc2c2('0xf')]['message']);return _0x1d6c52(_0x2e56a6[_0xc2c2('0xf')][_0xc2c2('0x11')]);}logger[_0xc2c2('0xf')](_0xc2c2('0x10'),_0x163805,_0x2e56a6[_0xc2c2('0xf')]['message']);return _0x5aa6a9(_0x2e56a6[_0xc2c2('0xf')][_0xc2c2('0x11')]);}else{logger[_0xc2c2('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x163805,_0xc2c2('0xc'));_0x5aa6a9(_0x2e56a6[_0xc2c2('0x12')][_0xc2c2('0x11')]);}})[_0xc2c2('0x13')](function(_0xa6a4eb){logger['error'](_0xc2c2('0x10'),_0x163805,_0xa6a4eb);_0x1d6c52(_0xa6a4eb);});});}exports[_0xc2c2('0x14')]=function(_0x2b12dc){var _0x28266b=this;return new Promise(function(_0x57e05e,_0x28794b){return db[_0xc2c2('0x15')][_0xc2c2('0x16')]({'raw':_0x2b12dc[_0xc2c2('0x17')]?_0x2b12dc['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b12dc[_0xc2c2('0x17')]?_0x2b12dc['options'][_0xc2c2('0x18')]||null:null,'attributes':_0x2b12dc['options']?_0x2b12dc['options'][_0xc2c2('0x19')]||null:null,'limit':_0x2b12dc[_0xc2c2('0x17')]?_0x2b12dc[_0xc2c2('0x17')][_0xc2c2('0x1a')]||null:null,'include':_0x2b12dc[_0xc2c2('0x17')]?_0x2b12dc[_0xc2c2('0x17')][_0xc2c2('0x1b')]?_[_0xc2c2('0x1c')](_0x2b12dc[_0xc2c2('0x17')][_0xc2c2('0x1b')],function(_0x9403ed){return{'model':db[_0x9403ed[_0xc2c2('0x1d')]],'as':_0x9403ed['as'],'attributes':_0x9403ed[_0xc2c2('0x19')],'include':_0x9403ed[_0xc2c2('0x1b')]?_[_0xc2c2('0x1c')](_0x9403ed[_0xc2c2('0x1b')],function(_0x5be563){return{'model':db[_0x5be563[_0xc2c2('0x1d')]],'as':_0x5be563['as'],'attributes':_0x5be563[_0xc2c2('0x19')],'include':_0x5be563[_0xc2c2('0x1b')]?_[_0xc2c2('0x1c')](_0x5be563[_0xc2c2('0x1b')],function(_0x2558c9){return{'model':db[_0x2558c9[_0xc2c2('0x1d')]],'as':_0x2558c9['as'],'attributes':_0x2558c9[_0xc2c2('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4410c8){logger[_0xc2c2('0xb')](_0xc2c2('0x14'),_0x2b12dc);logger['debug'](_0xc2c2('0x14'),_0x2b12dc,JSON[_0xc2c2('0xe')](_0x4410c8));_0x57e05e(_0x4410c8);})[_0xc2c2('0x13')](function(_0x35f5db){logger['error'](_0xc2c2('0x14'),_0x35f5db[_0xc2c2('0x11')],_0x2b12dc);_0x28794b(_0x28266b['error'](0x1f4,_0x35f5db[_0xc2c2('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x233bc5){var _0x3eed11=this;return new Promise(function(_0x196653,_0x18bba0){return db[_0xc2c2('0x15')][_0xc2c2('0x1e')]({'raw':_0x233bc5[_0xc2c2('0x17')]?_0x233bc5['options'][_0xc2c2('0x1f')]===undefined?!![]:![]:!![],'where':_0x233bc5[_0xc2c2('0x17')]?_0x233bc5[_0xc2c2('0x17')]['where']||null:null,'attributes':_0x233bc5['options']?_0x233bc5[_0xc2c2('0x17')]['attributes']||null:null,'include':_0x233bc5['options']?_0x233bc5[_0xc2c2('0x17')][_0xc2c2('0x1b')]?_[_0xc2c2('0x1c')](_0x233bc5[_0xc2c2('0x17')][_0xc2c2('0x1b')],function(_0x304746){return{'model':db[_0x304746[_0xc2c2('0x1d')]],'as':_0x304746['as'],'attributes':_0x304746['attributes'],'include':_0x304746[_0xc2c2('0x1b')]?_[_0xc2c2('0x1c')](_0x304746['include'],function(_0x53d4c5){return{'model':db[_0x53d4c5[_0xc2c2('0x1d')]],'as':_0x53d4c5['as'],'attributes':_0x53d4c5[_0xc2c2('0x19')],'include':_0x53d4c5[_0xc2c2('0x1b')]?_['map'](_0x53d4c5[_0xc2c2('0x1b')],function(_0x1ac321){return{'model':db[_0x1ac321['model']],'as':_0x1ac321['as'],'attributes':_0x1ac321[_0xc2c2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc2c2('0xa')](function(_0x376ae4){logger[_0xc2c2('0xb')]('ShowVtigerAccount',_0x233bc5);logger['debug']('ShowVtigerAccount',_0x233bc5,JSON[_0xc2c2('0xe')](_0x376ae4));_0x196653(_0x376ae4);})[_0xc2c2('0x13')](function(_0x27cd9f){logger[_0xc2c2('0xf')]('ShowVtigerAccount',_0x27cd9f[_0xc2c2('0x11')],_0x233bc5);_0x18bba0(_0x3eed11[_0xc2c2('0xf')](0x1f4,_0x27cd9f[_0xc2c2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c15901c..c868264 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4dd7d3,_0x289061){var _0x224660=function(_0x3d8fb6){while(--_0x3d8fb6){_0x4dd7d3['push'](_0x4dd7d3['shift']());}};_0x224660(++_0x289061);}(_0x5f2f,0x73));var _0xf5f2=function(_0x223394,_0x5aaca0){_0x223394=_0x223394-0x0;var _0x4e0278=_0x5f2f[_0x223394];return _0x4e0278;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xaad82e,_0x2accbc){var _0x5812ef=function(_0x5bac55){while(--_0x5bac55){_0xaad82e['push'](_0xaad82e['shift']());}};_0x5812ef(++_0x2accbc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57cebf,_0x327248){_0x57cebf=_0x57cebf-0x0;var _0x16f0a5=_0x5f2f[_0x57cebf];return _0x16f0a5;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 71639c4..401e854 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 _0xc4b7=['STRING','sequelize','exports'];(function(_0x1c635a,_0x40589f){var _0x4e4215=function(_0x5d1e07){while(--_0x5d1e07){_0x1c635a['push'](_0x1c635a['shift']());}};_0x4e4215(++_0x40589f);}(_0xc4b7,0x13f));var _0x7c4b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4b7[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x7c4b('0x0'));module[_0x7c4b('0x1')]={'name':{'type':Sequelize[_0x7c4b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x309a=['exports','STRING','sequelize'];(function(_0x4c2bdc,_0x5915d7){var _0x5a3222=function(_0x2262dd){while(--_0x2262dd){_0x4c2bdc['push'](_0x4c2bdc['shift']());}};_0x5a3222(++_0x5915d7);}(_0x309a,0x77));var _0xa309=function(_0x4562c0,_0x76f431){_0x4562c0=_0x4562c0-0x0;var _0x4f70f1=_0x309a[_0x4562c0];return _0x4f70f1;};'use strict';var Sequelize=require(_0xa309('0x0'));module[_0xa309('0x1')]={'name':{'type':Sequelize[_0xa309('0x2')]},'description':{'type':Sequelize[_0xa309('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index ef16833..f5fe7d5 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 _0x5fab=['sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','stack','name','send','render','merge','body','agent','interaction','account','VtigerConfiguration','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','filter','map','VIRTUAL','options','includeAll','include','params','keys','length','find','create','update','destroy','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','pick','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5fab,0x177));var _0xb5fa=function(_0x7642c,_0x2ec4b0){_0x7642c=_0x7642c-0x0;var _0x5412fd=_0x5fab[_0x7642c];return _0x5412fd;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb5fa('0x1a')][_0xb5fa('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x56e8b0,_0x116849,_0x577af0,_0x265992){return new BPromise(function(_0x3fc372,_0x40c914){var _0xca8d82=_0x265992||client;return _0xca8d82[_0xb5fa('0x1c')](_0x56e8b0,_0x577af0)['then'](function(_0x567f31){logger[_0xb5fa('0x1d')](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));logger[_0xb5fa('0x20')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x116849,'request\x20sent',JSON[_0xb5fa('0x21')](_0x567f31));if(_0x567f31[_0xb5fa('0x22')]){if(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x23')]===0x1f4){logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);return _0x40c914(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);}logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31['error'][_0xb5fa('0x24')]);return _0x3fc372(_0x567f31['error'][_0xb5fa('0x24')]);}else{logger['info'](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));_0x3fc372(_0x567f31['result'][_0xb5fa('0x24')]);}})[_0xb5fa('0x25')](function(_0x283a56){logger['error'](_0xb5fa('0x1e'),_0x116849,_0x283a56);_0x40c914(_0x283a56);});});}function respondWithStatusCode(_0xec108f,_0x444237){_0x444237=_0x444237||0xcc;return function(_0x542348){if(_0x542348){return _0xec108f[_0xb5fa('0x26')](_0x444237);}return _0xec108f['status'](_0x444237)[_0xb5fa('0x27')]();};}function respondWithResult(_0x264591,_0x11053a){_0x11053a=_0x11053a||0xc8;return function(_0x543edf){if(_0x543edf){return _0x264591[_0xb5fa('0x28')](_0x11053a)[_0xb5fa('0x29')](_0x543edf);}};}function respondWithFilteredResult(_0x6a455c,_0x20d649){return function(_0x568870){if(_0x568870){var _0x4ec294=typeof _0x20d649['offset']==='undefined'&&typeof _0x20d649[_0xb5fa('0x2a')]===_0xb5fa('0x2b');var _0x12c0d4=_0x568870[_0xb5fa('0x2c')];var _0x534884=_0x4ec294?0x0:_0x20d649[_0xb5fa('0x2d')];var _0x358549=_0x4ec294?_0x568870[_0xb5fa('0x2c')]:_0x20d649[_0xb5fa('0x2d')]+_0x20d649[_0xb5fa('0x2a')];var _0x142bfa;if(_0x358549>=_0x12c0d4){_0x358549=_0x12c0d4;_0x142bfa=0xc8;}else{_0x142bfa=0xce;}_0x6a455c[_0xb5fa('0x28')](_0x142bfa);return _0x6a455c[_0xb5fa('0x2e')](_0xb5fa('0x2f'),_0x534884+'-'+_0x358549+'/'+_0x12c0d4)[_0xb5fa('0x29')](_0x568870);}return null;};}function patchUpdates(_0x116773){return function(_0x5a0152){try{jsonpatch[_0xb5fa('0x30')](_0x5a0152,_0x116773,!![]);}catch(_0x21fc7e){return BPromise[_0xb5fa('0x31')](_0x21fc7e);}return _0x5a0152[_0xb5fa('0x32')]();};}function saveUpdates(_0x370d95,_0x10fb43){return function(_0x25fc7c){if(_0x25fc7c){return _0x25fc7c['update'](_0x370d95)[_0xb5fa('0x33')](function(_0x4d056c){return _0x4d056c;});}return null;};}function removeEntity(_0x5c7fdd,_0x558708){return function(_0x1e6ba0){if(_0x1e6ba0){return _0x1e6ba0['destroy']()[_0xb5fa('0x33')](function(){_0x5c7fdd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1847bc,_0x934b49){return function(_0x4a4bff){if(!_0x4a4bff){_0x1847bc['sendStatus'](0x194);}return _0x4a4bff;};}function handleError(_0x3d73c2,_0x9cf63d){_0x9cf63d=_0x9cf63d||0x1f4;return function(_0x252421){logger['error'](_0x252421[_0xb5fa('0x34')]);if(_0x252421[_0xb5fa('0x35')]){delete _0x252421['name'];}_0x3d73c2[_0xb5fa('0x28')](_0x9cf63d)[_0xb5fa('0x36')](_0x252421);};}function getMustacheRender(_0x204d6b,_0x5580f0){return Mustache[_0xb5fa('0x37')](_0x204d6b,_[_0xb5fa('0x38')](_0x5580f0[_0xb5fa('0x39')],{'contact':_0x5580f0['contact'],'message':_0x5580f0[_0xb5fa('0x24')],'agent':_0x5580f0[_0xb5fa('0x3a')],'interaction':_0x5580f0[_0xb5fa('0x3b')],'account':_0x5580f0[_0xb5fa('0x3c')]}))||'';}exports['index']=function(_0x4bba91,_0x4901ad){var _0x49e786={},_0x5989e1={},_0x4dff5d={'count':0x0,'rows':[]};var _0x908bc8=_['map'](db[_0xb5fa('0x3d')][_0xb5fa('0x3e')],function(_0x36db1a){return{'name':_0x36db1a[_0xb5fa('0x3f')],'type':_0x36db1a[_0xb5fa('0x40')][_0xb5fa('0x41')]};});_0x5989e1['model']=_['map'](_0x908bc8,'name');_0x5989e1[_0xb5fa('0x42')]=_['keys'](_0x4bba91[_0xb5fa('0x42')]);_0x5989e1['filters']=_['intersection'](_0x5989e1[_0xb5fa('0x43')],_0x5989e1[_0xb5fa('0x42')]);_0x49e786[_0xb5fa('0x44')]=_[_0xb5fa('0x45')](_0x5989e1[_0xb5fa('0x43')],qs[_0xb5fa('0x46')](_0x4bba91[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x49e786[_0xb5fa('0x44')]=_0x49e786[_0xb5fa('0x44')]['length']?_0x49e786[_0xb5fa('0x44')]:_0x5989e1['model'];if(!_0x4bba91[_0xb5fa('0x42')][_0xb5fa('0x47')](_0xb5fa('0x48'))){_0x49e786[_0xb5fa('0x2a')]=qs[_0xb5fa('0x2a')](_0x4bba91[_0xb5fa('0x42')][_0xb5fa('0x2a')]);_0x49e786[_0xb5fa('0x2d')]=qs['offset'](_0x4bba91[_0xb5fa('0x42')][_0xb5fa('0x2d')]);}_0x49e786['order']=qs[_0xb5fa('0x49')](_0x4bba91['query'][_0xb5fa('0x49')]);_0x49e786[_0xb5fa('0x4a')]=qs['filters'](_['pick'](_0x4bba91[_0xb5fa('0x42')],_0x5989e1[_0xb5fa('0x4b')]),_0x908bc8);if(_0x4bba91[_0xb5fa('0x42')][_0xb5fa('0x4c')]){_0x49e786[_0xb5fa('0x4a')]=_[_0xb5fa('0x38')](_0x49e786[_0xb5fa('0x4a')],{'$or':_[_0xb5fa('0x4d')](_0x908bc8,function(_0x499d36){if(_0x499d36[_0xb5fa('0x40')]!==_0xb5fa('0x4e')){var _0x4e0fe7={};_0x4e0fe7[_0x499d36[_0xb5fa('0x35')]]={'$like':'%'+_0x4bba91[_0xb5fa('0x42')][_0xb5fa('0x4c')]+'%'};return _0x4e0fe7;}})});}_0x49e786=_[_0xb5fa('0x38')]({},_0x49e786,_0x4bba91[_0xb5fa('0x4f')]);var _0x27d900={'where':_0x49e786[_0xb5fa('0x4a')]};return db[_0xb5fa('0x3d')][_0xb5fa('0x2c')](_0x27d900)[_0xb5fa('0x33')](function(_0xfe091){_0x4dff5d[_0xb5fa('0x2c')]=_0xfe091;if(_0x4bba91[_0xb5fa('0x42')][_0xb5fa('0x50')]){_0x49e786[_0xb5fa('0x51')]=[{'all':!![]}];}return db[_0xb5fa('0x3d')]['findAll'](_0x49e786);})['then'](function(_0x46194d){_0x4dff5d['rows']=_0x46194d;return _0x4dff5d;})[_0xb5fa('0x33')](respondWithFilteredResult(_0x4901ad,_0x49e786))[_0xb5fa('0x25')](handleError(_0x4901ad,null));};exports['show']=function(_0x4ef1d0,_0x2931a7){var _0x18b37c={'raw':![],'where':{'id':_0x4ef1d0[_0xb5fa('0x52')]['id']}},_0x3159e9={};_0x3159e9[_0xb5fa('0x43')]=_['keys'](db[_0xb5fa('0x3d')]['rawAttributes']);_0x3159e9[_0xb5fa('0x42')]=_[_0xb5fa('0x53')](_0x4ef1d0[_0xb5fa('0x42')]);_0x3159e9['filters']=_[_0xb5fa('0x45')](_0x3159e9[_0xb5fa('0x43')],_0x3159e9['query']);_0x18b37c['attributes']=_[_0xb5fa('0x45')](_0x3159e9[_0xb5fa('0x43')],qs[_0xb5fa('0x46')](_0x4ef1d0[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x18b37c[_0xb5fa('0x44')]=_0x18b37c[_0xb5fa('0x44')][_0xb5fa('0x54')]?_0x18b37c[_0xb5fa('0x44')]:_0x3159e9[_0xb5fa('0x43')];if(_0x4ef1d0[_0xb5fa('0x42')][_0xb5fa('0x50')]){_0x18b37c[_0xb5fa('0x51')]=[{'all':!![]}];}_0x18b37c=_[_0xb5fa('0x38')]({},_0x18b37c,_0x4ef1d0[_0xb5fa('0x4f')]);return db[_0xb5fa('0x3d')][_0xb5fa('0x55')](_0x18b37c)[_0xb5fa('0x33')](handleEntityNotFound(_0x2931a7,null))['then'](respondWithResult(_0x2931a7,null))[_0xb5fa('0x25')](handleError(_0x2931a7,null));};exports[_0xb5fa('0x56')]=function(_0x222016,_0xd8d0ab){return db[_0xb5fa('0x3d')][_0xb5fa('0x56')](_0x222016[_0xb5fa('0x39')],{})[_0xb5fa('0x33')](respondWithResult(_0xd8d0ab,0xc9))[_0xb5fa('0x25')](handleError(_0xd8d0ab,null));};exports[_0xb5fa('0x57')]=function(_0x4ea97d,_0x5750d0){if(_0x4ea97d[_0xb5fa('0x39')]['id']){delete _0x4ea97d[_0xb5fa('0x39')]['id'];}return db[_0xb5fa('0x3d')]['find']({'where':{'id':_0x4ea97d[_0xb5fa('0x52')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x5750d0,null))[_0xb5fa('0x33')](saveUpdates(_0x4ea97d[_0xb5fa('0x39')],null))[_0xb5fa('0x33')](respondWithResult(_0x5750d0,null))[_0xb5fa('0x25')](handleError(_0x5750d0,null));};exports[_0xb5fa('0x58')]=function(_0x4f82f0,_0x7bcd09){return db[_0xb5fa('0x3d')]['find']({'where':{'id':_0x4f82f0[_0xb5fa('0x52')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x7bcd09,null))['then'](removeEntity(_0x7bcd09,null))[_0xb5fa('0x25')](handleError(_0x7bcd09,null));};exports[_0xb5fa('0x59')]=function(_0x2d8b19,_0x2b9a45,_0x567d1c){var _0x435721={};var _0x18cde9={};var _0x40d7d5;var _0xd2ba4e;return db[_0xb5fa('0x3d')][_0xb5fa('0x5a')]({'where':{'id':_0x2d8b19[_0xb5fa('0x52')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x2b9a45,null))[_0xb5fa('0x33')](function(_0x1d6840){if(_0x1d6840){_0x40d7d5=_0x1d6840;_0x18cde9[_0xb5fa('0x43')]=_[_0xb5fa('0x53')](db[_0xb5fa('0x5b')][_0xb5fa('0x3e')]);_0x18cde9[_0xb5fa('0x42')]=_[_0xb5fa('0x53')](_0x2d8b19[_0xb5fa('0x42')]);_0x18cde9['filters']=_[_0xb5fa('0x45')](_0x18cde9[_0xb5fa('0x43')],_0x18cde9[_0xb5fa('0x42')]);_0x435721['attributes']=_[_0xb5fa('0x45')](_0x18cde9[_0xb5fa('0x43')],qs['fields'](_0x2d8b19[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x435721[_0xb5fa('0x44')]=_0x435721['attributes']['length']?_0x435721[_0xb5fa('0x44')]:_0x18cde9[_0xb5fa('0x43')];_0x435721[_0xb5fa('0x5c')]=qs['sort'](_0x2d8b19[_0xb5fa('0x42')][_0xb5fa('0x49')]);_0x435721[_0xb5fa('0x4a')]=qs[_0xb5fa('0x4b')](_['pick'](_0x2d8b19['query'],_0x18cde9['filters']));if(_0x2d8b19[_0xb5fa('0x42')][_0xb5fa('0x4c')]){_0x435721[_0xb5fa('0x4a')]=_['merge'](_0x435721[_0xb5fa('0x4a')],{'$or':_[_0xb5fa('0x4d')](_0x435721[_0xb5fa('0x44')],function(_0x42a763){var _0x2a1872={};_0x2a1872[_0x42a763]={'$like':'%'+_0x2d8b19[_0xb5fa('0x42')][_0xb5fa('0x4c')]+'%'};return _0x2a1872;})});}_0x435721=_[_0xb5fa('0x38')]({},_0x435721,_0x2d8b19[_0xb5fa('0x4f')]);return _0x40d7d5[_0xb5fa('0x59')](_0x435721);}})[_0xb5fa('0x33')](function(_0x1dc42e){if(_0x1dc42e){_0xd2ba4e=_0x1dc42e[_0xb5fa('0x54')];if(!_0x2d8b19[_0xb5fa('0x42')][_0xb5fa('0x47')]('nolimit')){_0x435721[_0xb5fa('0x2a')]=qs['limit'](_0x2d8b19[_0xb5fa('0x42')][_0xb5fa('0x2a')]);_0x435721[_0xb5fa('0x2d')]=qs[_0xb5fa('0x2d')](_0x2d8b19[_0xb5fa('0x42')]['offset']);}return _0x40d7d5[_0xb5fa('0x59')](_0x435721);}})['then'](function(_0x77a831){if(_0x77a831){return _0x77a831?{'count':_0xd2ba4e,'rows':_0x77a831}:null;}})[_0xb5fa('0x33')](respondWithResult(_0x2b9a45,null))[_0xb5fa('0x25')](handleError(_0x2b9a45,null));};exports[_0xb5fa('0x5d')]=function(_0x5e44d8,_0x4d1117,_0x59920c){var _0x78a34c={};var _0x885acb={};var _0x421dff;var _0x32e329;return db[_0xb5fa('0x3d')][_0xb5fa('0x5a')]({'where':{'id':_0x5e44d8['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x4d1117,null))['then'](function(_0x4ca73e){if(_0x4ca73e){_0x421dff=_0x4ca73e;_0x885acb[_0xb5fa('0x43')]=_['keys'](db['VtigerField']['rawAttributes']);_0x885acb[_0xb5fa('0x42')]=_['keys'](_0x5e44d8[_0xb5fa('0x42')]);_0x885acb[_0xb5fa('0x4b')]=_[_0xb5fa('0x45')](_0x885acb['model'],_0x885acb['query']);_0x78a34c[_0xb5fa('0x44')]=_[_0xb5fa('0x45')](_0x885acb['model'],qs[_0xb5fa('0x46')](_0x5e44d8[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x78a34c[_0xb5fa('0x44')]=_0x78a34c['attributes'][_0xb5fa('0x54')]?_0x78a34c[_0xb5fa('0x44')]:_0x885acb[_0xb5fa('0x43')];_0x78a34c[_0xb5fa('0x5c')]=qs[_0xb5fa('0x49')](_0x5e44d8[_0xb5fa('0x42')][_0xb5fa('0x49')]);_0x78a34c['where']=qs[_0xb5fa('0x4b')](_['pick'](_0x5e44d8[_0xb5fa('0x42')],_0x885acb[_0xb5fa('0x4b')]));if(_0x5e44d8['query'][_0xb5fa('0x4c')]){_0x78a34c[_0xb5fa('0x4a')]=_[_0xb5fa('0x38')](_0x78a34c[_0xb5fa('0x4a')],{'$or':_[_0xb5fa('0x4d')](_0x78a34c[_0xb5fa('0x44')],function(_0xcd2a27){var _0x1bac54={};_0x1bac54[_0xcd2a27]={'$like':'%'+_0x5e44d8['query'][_0xb5fa('0x4c')]+'%'};return _0x1bac54;})});}_0x78a34c=_[_0xb5fa('0x38')]({},_0x78a34c,_0x5e44d8[_0xb5fa('0x4f')]);return _0x421dff[_0xb5fa('0x5d')](_0x78a34c);}})['then'](function(_0x593386){if(_0x593386){_0x32e329=_0x593386['length'];if(!_0x5e44d8['query'][_0xb5fa('0x47')](_0xb5fa('0x48'))){_0x78a34c[_0xb5fa('0x2a')]=qs[_0xb5fa('0x2a')](_0x5e44d8['query']['limit']);_0x78a34c[_0xb5fa('0x2d')]=qs['offset'](_0x5e44d8[_0xb5fa('0x42')][_0xb5fa('0x2d')]);}return _0x421dff[_0xb5fa('0x5d')](_0x78a34c);}})[_0xb5fa('0x33')](function(_0x577aef){if(_0x577aef){return _0x577aef?{'count':_0x32e329,'rows':_0x577aef}:null;}})[_0xb5fa('0x33')](respondWithResult(_0x4d1117,null))['catch'](handleError(_0x4d1117,null));};exports[_0xb5fa('0x5e')]=function(_0x3b17cf,_0x524b10,_0x5e6852){var _0x391412={};var _0x3150ac={};var _0x64ab9e;var _0x1bcca7;return db[_0xb5fa('0x3d')][_0xb5fa('0x5a')]({'where':{'id':_0x3b17cf[_0xb5fa('0x52')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x524b10,null))[_0xb5fa('0x33')](function(_0x2c040a){if(_0x2c040a){_0x64ab9e=_0x2c040a;_0x3150ac[_0xb5fa('0x43')]=_[_0xb5fa('0x53')](db[_0xb5fa('0x5b')]['rawAttributes']);_0x3150ac['query']=_[_0xb5fa('0x53')](_0x3b17cf['query']);_0x3150ac[_0xb5fa('0x4b')]=_[_0xb5fa('0x45')](_0x3150ac['model'],_0x3150ac[_0xb5fa('0x42')]);_0x391412[_0xb5fa('0x44')]=_['intersection'](_0x3150ac[_0xb5fa('0x43')],qs[_0xb5fa('0x46')](_0x3b17cf['query'][_0xb5fa('0x46')]));_0x391412[_0xb5fa('0x44')]=_0x391412[_0xb5fa('0x44')]['length']?_0x391412['attributes']:_0x3150ac[_0xb5fa('0x43')];_0x391412[_0xb5fa('0x5c')]=qs[_0xb5fa('0x49')](_0x3b17cf[_0xb5fa('0x42')][_0xb5fa('0x49')]);_0x391412[_0xb5fa('0x4a')]=qs[_0xb5fa('0x4b')](_[_0xb5fa('0x5f')](_0x3b17cf[_0xb5fa('0x42')],_0x3150ac[_0xb5fa('0x4b')]));if(_0x3b17cf['query']['filter']){_0x391412[_0xb5fa('0x4a')]=_[_0xb5fa('0x38')](_0x391412[_0xb5fa('0x4a')],{'$or':_[_0xb5fa('0x4d')](_0x391412['attributes'],function(_0x2c93c7){var _0x2f2cef={};_0x2f2cef[_0x2c93c7]={'$like':'%'+_0x3b17cf[_0xb5fa('0x42')]['filter']+'%'};return _0x2f2cef;})});}_0x391412=_[_0xb5fa('0x38')]({},_0x391412,_0x3b17cf[_0xb5fa('0x4f')]);return _0x64ab9e[_0xb5fa('0x5e')](_0x391412);}})[_0xb5fa('0x33')](function(_0x5ba2e7){if(_0x5ba2e7){_0x1bcca7=_0x5ba2e7[_0xb5fa('0x54')];if(!_0x3b17cf[_0xb5fa('0x42')][_0xb5fa('0x47')](_0xb5fa('0x48'))){_0x391412[_0xb5fa('0x2a')]=qs[_0xb5fa('0x2a')](_0x3b17cf[_0xb5fa('0x42')][_0xb5fa('0x2a')]);_0x391412[_0xb5fa('0x2d')]=qs[_0xb5fa('0x2d')](_0x3b17cf[_0xb5fa('0x42')][_0xb5fa('0x2d')]);}return _0x64ab9e[_0xb5fa('0x5e')](_0x391412);}})[_0xb5fa('0x33')](function(_0x308533){if(_0x308533){return _0x308533?{'count':_0x1bcca7,'rows':_0x308533}:null;}})['then'](respondWithResult(_0x524b10,null))[_0xb5fa('0x25')](handleError(_0x524b10,null));}; \ No newline at end of file +var _0x3a6d=['merge','body','contact','interaction','account','index','map','VtigerConfiguration','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','findOne','getFields','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','end','sendStatus','stack','name','render'];(function(_0x206aff,_0x2a52c9){var _0x360411=function(_0x41a147){while(--_0x41a147){_0x206aff['push'](_0x206aff['shift']());}};_0x360411(++_0x2a52c9);}(_0x3a6d,0x143));var _0xd3a6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3a6d[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require(_0xd3a6('0x0'));var rimraf=require(_0xd3a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3a6('0x2'));var rp=require(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require(_0xd3a6('0x5'));var Mustache=require(_0xd3a6('0x6'));var util=require('util');var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require(_0xd3a6('0x9'));var ejs=require(_0xd3a6('0xa'));var fs=require('fs');var fs_extra=require(_0xd3a6('0xb'));var _=require(_0xd3a6('0xc'));var squel=require('squel');var crypto=require(_0xd3a6('0xd'));var jsforce=require(_0xd3a6('0xe'));var deskjs=require(_0xd3a6('0xf'));var toCsv=require(_0xd3a6('0x9'));var querystring=require(_0xd3a6('0x10'));var Papa=require(_0xd3a6('0x11'));var Redis=require(_0xd3a6('0x12'));var authService=require(_0xd3a6('0x13'));var qs=require(_0xd3a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3a6('0x15'));var logger=require(_0xd3a6('0x16'))(_0xd3a6('0x17'));var utils=require(_0xd3a6('0x18'));var config=require(_0xd3a6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xd3a6('0x1a')][_0xd3a6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xd7a20c,_0x41eca8,_0x3ef56f,_0x2911a0){return new BPromise(function(_0xa56452,_0x4e67fb){var _0x473a97=_0x2911a0||client;return _0x473a97[_0xd3a6('0x1c')](_0xd7a20c,_0x3ef56f)[_0xd3a6('0x1d')](function(_0x500a37){logger[_0xd3a6('0x1e')](_0xd3a6('0x1f'),_0x41eca8,_0xd3a6('0x20'));logger['debug'](_0xd3a6('0x21'),_0x41eca8,'request\x20sent',JSON['stringify'](_0x500a37));if(_0x500a37[_0xd3a6('0x22')]){if(_0x500a37[_0xd3a6('0x22')][_0xd3a6('0x23')]===0x1f4){logger[_0xd3a6('0x22')](_0xd3a6('0x1f'),_0x41eca8,_0x500a37[_0xd3a6('0x22')][_0xd3a6('0x24')]);return _0x4e67fb(_0x500a37['error'][_0xd3a6('0x24')]);}logger['error'](_0xd3a6('0x1f'),_0x41eca8,_0x500a37[_0xd3a6('0x22')][_0xd3a6('0x24')]);return _0xa56452(_0x500a37[_0xd3a6('0x22')][_0xd3a6('0x24')]);}else{logger[_0xd3a6('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0x41eca8,_0xd3a6('0x20'));_0xa56452(_0x500a37[_0xd3a6('0x25')]['message']);}})['catch'](function(_0x5846bc){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x41eca8,_0x5846bc);_0x4e67fb(_0x5846bc);});});}function respondWithStatusCode(_0x98a12a,_0x400982){_0x400982=_0x400982||0xcc;return function(_0x3d0b28){if(_0x3d0b28){return _0x98a12a['sendStatus'](_0x400982);}return _0x98a12a[_0xd3a6('0x26')](_0x400982)['end']();};}function respondWithResult(_0x350a11,_0x16afc8){_0x16afc8=_0x16afc8||0xc8;return function(_0x429079){if(_0x429079){return _0x350a11['status'](_0x16afc8)[_0xd3a6('0x27')](_0x429079);}};}function respondWithFilteredResult(_0x3bc8d1,_0x1b09ac){return function(_0x219e32){if(_0x219e32){var _0x169d11=typeof _0x1b09ac[_0xd3a6('0x28')]==='undefined'&&typeof _0x1b09ac[_0xd3a6('0x29')]===_0xd3a6('0x2a');var _0x24ff6d=_0x219e32[_0xd3a6('0x2b')];var _0x30abc2=_0x169d11?0x0:_0x1b09ac[_0xd3a6('0x28')];var _0x5c2186=_0x169d11?_0x219e32['count']:_0x1b09ac[_0xd3a6('0x28')]+_0x1b09ac[_0xd3a6('0x29')];var _0x35981c;if(_0x5c2186>=_0x24ff6d){_0x5c2186=_0x24ff6d;_0x35981c=0xc8;}else{_0x35981c=0xce;}_0x3bc8d1[_0xd3a6('0x26')](_0x35981c);return _0x3bc8d1['set'](_0xd3a6('0x2c'),_0x30abc2+'-'+_0x5c2186+'/'+_0x24ff6d)[_0xd3a6('0x27')](_0x219e32);}return null;};}function patchUpdates(_0x4d322a){return function(_0x14381c){try{jsonpatch['apply'](_0x14381c,_0x4d322a,!![]);}catch(_0x134337){return BPromise[_0xd3a6('0x2d')](_0x134337);}return _0x14381c[_0xd3a6('0x2e')]();};}function saveUpdates(_0x87b75a,_0x12cb03){return function(_0xe27818){if(_0xe27818){return _0xe27818[_0xd3a6('0x2f')](_0x87b75a)['then'](function(_0x4d7b56){return _0x4d7b56;});}return null;};}function removeEntity(_0x15b0cd,_0x155640){return function(_0xcf372e){if(_0xcf372e){return _0xcf372e['destroy']()[_0xd3a6('0x1d')](function(){_0x15b0cd[_0xd3a6('0x26')](0xcc)[_0xd3a6('0x30')]();});}};}function handleEntityNotFound(_0x1603d9,_0x3ebd0d){return function(_0x36b28a){if(!_0x36b28a){_0x1603d9[_0xd3a6('0x31')](0x194);}return _0x36b28a;};}function handleError(_0x10352a,_0x59428a){_0x59428a=_0x59428a||0x1f4;return function(_0x3a4a03){logger[_0xd3a6('0x22')](_0x3a4a03[_0xd3a6('0x32')]);if(_0x3a4a03[_0xd3a6('0x33')]){delete _0x3a4a03[_0xd3a6('0x33')];}_0x10352a[_0xd3a6('0x26')](_0x59428a)['send'](_0x3a4a03);};}function getMustacheRender(_0x16a30a,_0x5cc122){return Mustache[_0xd3a6('0x34')](_0x16a30a,_[_0xd3a6('0x35')](_0x5cc122[_0xd3a6('0x36')],{'contact':_0x5cc122[_0xd3a6('0x37')],'message':_0x5cc122['message'],'agent':_0x5cc122['agent'],'interaction':_0x5cc122[_0xd3a6('0x38')],'account':_0x5cc122[_0xd3a6('0x39')]}))||'';}exports[_0xd3a6('0x3a')]=function(_0x5188e1,_0x2bc0c7){var _0x114784={},_0x515b2c={},_0x2f8e33={'count':0x0,'rows':[]};var _0x4d8791=_[_0xd3a6('0x3b')](db[_0xd3a6('0x3c')]['rawAttributes'],function(_0x219ba5){return{'name':_0x219ba5['fieldName'],'type':_0x219ba5[_0xd3a6('0x3d')][_0xd3a6('0x3e')]};});_0x515b2c['model']=_[_0xd3a6('0x3b')](_0x4d8791,_0xd3a6('0x33'));_0x515b2c[_0xd3a6('0x3f')]=_[_0xd3a6('0x40')](_0x5188e1['query']);_0x515b2c[_0xd3a6('0x41')]=_[_0xd3a6('0x42')](_0x515b2c[_0xd3a6('0x43')],_0x515b2c[_0xd3a6('0x3f')]);_0x114784[_0xd3a6('0x44')]=_['intersection'](_0x515b2c[_0xd3a6('0x43')],qs['fields'](_0x5188e1[_0xd3a6('0x3f')][_0xd3a6('0x45')]));_0x114784[_0xd3a6('0x44')]=_0x114784['attributes'][_0xd3a6('0x46')]?_0x114784['attributes']:_0x515b2c[_0xd3a6('0x43')];if(!_0x5188e1['query'][_0xd3a6('0x47')](_0xd3a6('0x48'))){_0x114784[_0xd3a6('0x29')]=qs[_0xd3a6('0x29')](_0x5188e1[_0xd3a6('0x3f')][_0xd3a6('0x29')]);_0x114784[_0xd3a6('0x28')]=qs['offset'](_0x5188e1[_0xd3a6('0x3f')][_0xd3a6('0x28')]);}_0x114784[_0xd3a6('0x49')]=qs[_0xd3a6('0x4a')](_0x5188e1['query'][_0xd3a6('0x4a')]);_0x114784[_0xd3a6('0x4b')]=qs[_0xd3a6('0x41')](_[_0xd3a6('0x4c')](_0x5188e1[_0xd3a6('0x3f')],_0x515b2c[_0xd3a6('0x41')]),_0x4d8791);if(_0x5188e1[_0xd3a6('0x3f')][_0xd3a6('0x4d')]){_0x114784['where']=_[_0xd3a6('0x35')](_0x114784[_0xd3a6('0x4b')],{'$or':_[_0xd3a6('0x3b')](_0x4d8791,function(_0x339496){if(_0x339496[_0xd3a6('0x3d')]!=='VIRTUAL'){var _0x41b8c3={};_0x41b8c3[_0x339496[_0xd3a6('0x33')]]={'$like':'%'+_0x5188e1[_0xd3a6('0x3f')][_0xd3a6('0x4d')]+'%'};return _0x41b8c3;}})});}_0x114784=_[_0xd3a6('0x35')]({},_0x114784,_0x5188e1[_0xd3a6('0x4e')]);var _0x4310e0={'where':_0x114784[_0xd3a6('0x4b')]};return db['VtigerConfiguration'][_0xd3a6('0x2b')](_0x4310e0)['then'](function(_0x688186){_0x2f8e33[_0xd3a6('0x2b')]=_0x688186;if(_0x5188e1['query'][_0xd3a6('0x4f')]){_0x114784[_0xd3a6('0x50')]=[{'all':!![]}];}return db[_0xd3a6('0x3c')][_0xd3a6('0x51')](_0x114784);})[_0xd3a6('0x1d')](function(_0x35e091){_0x2f8e33[_0xd3a6('0x52')]=_0x35e091;return _0x2f8e33;})[_0xd3a6('0x1d')](respondWithFilteredResult(_0x2bc0c7,_0x114784))[_0xd3a6('0x53')](handleError(_0x2bc0c7,null));};exports[_0xd3a6('0x54')]=function(_0x4a2ad8,_0x287a48){var _0x2e18b6={'raw':![],'where':{'id':_0x4a2ad8[_0xd3a6('0x55')]['id']}},_0x470f5a={};_0x470f5a[_0xd3a6('0x43')]=_[_0xd3a6('0x40')](db[_0xd3a6('0x3c')][_0xd3a6('0x56')]);_0x470f5a[_0xd3a6('0x3f')]=_[_0xd3a6('0x40')](_0x4a2ad8['query']);_0x470f5a[_0xd3a6('0x41')]=_[_0xd3a6('0x42')](_0x470f5a[_0xd3a6('0x43')],_0x470f5a['query']);_0x2e18b6[_0xd3a6('0x44')]=_['intersection'](_0x470f5a['model'],qs['fields'](_0x4a2ad8['query'][_0xd3a6('0x45')]));_0x2e18b6[_0xd3a6('0x44')]=_0x2e18b6[_0xd3a6('0x44')][_0xd3a6('0x46')]?_0x2e18b6[_0xd3a6('0x44')]:_0x470f5a[_0xd3a6('0x43')];if(_0x4a2ad8[_0xd3a6('0x3f')][_0xd3a6('0x4f')]){_0x2e18b6[_0xd3a6('0x50')]=[{'all':!![]}];}_0x2e18b6=_[_0xd3a6('0x35')]({},_0x2e18b6,_0x4a2ad8['options']);return db['VtigerConfiguration'][_0xd3a6('0x57')](_0x2e18b6)[_0xd3a6('0x1d')](handleEntityNotFound(_0x287a48,null))[_0xd3a6('0x1d')](respondWithResult(_0x287a48,null))[_0xd3a6('0x53')](handleError(_0x287a48,null));};exports[_0xd3a6('0x58')]=function(_0x5a0817,_0x224483){return db[_0xd3a6('0x3c')][_0xd3a6('0x58')](_0x5a0817[_0xd3a6('0x36')],{})['then'](respondWithResult(_0x224483,0xc9))['catch'](handleError(_0x224483,null));};exports[_0xd3a6('0x2f')]=function(_0x4e8f31,_0x558689){if(_0x4e8f31[_0xd3a6('0x36')]['id']){delete _0x4e8f31[_0xd3a6('0x36')]['id'];}return db[_0xd3a6('0x3c')]['find']({'where':{'id':_0x4e8f31[_0xd3a6('0x55')]['id']}})[_0xd3a6('0x1d')](handleEntityNotFound(_0x558689,null))['then'](saveUpdates(_0x4e8f31[_0xd3a6('0x36')],null))[_0xd3a6('0x1d')](respondWithResult(_0x558689,null))['catch'](handleError(_0x558689,null));};exports['destroy']=function(_0x2f2957,_0xb76b22){return db['VtigerConfiguration']['find']({'where':{'id':_0x2f2957[_0xd3a6('0x55')]['id']}})['then'](handleEntityNotFound(_0xb76b22,null))[_0xd3a6('0x1d')](removeEntity(_0xb76b22,null))[_0xd3a6('0x53')](handleError(_0xb76b22,null));};exports['getFields']=function(_0x130f5d,_0x4b9a38,_0x59426d){var _0x19bba0={};var _0x536ca1={};var _0x34208c;var _0x1140e1;return db[_0xd3a6('0x3c')][_0xd3a6('0x59')]({'where':{'id':_0x130f5d[_0xd3a6('0x55')]['id']}})['then'](handleEntityNotFound(_0x4b9a38,null))[_0xd3a6('0x1d')](function(_0x88476a){if(_0x88476a){_0x34208c=_0x88476a;_0x536ca1[_0xd3a6('0x43')]=_[_0xd3a6('0x40')](db['VtigerField'][_0xd3a6('0x56')]);_0x536ca1[_0xd3a6('0x3f')]=_[_0xd3a6('0x40')](_0x130f5d[_0xd3a6('0x3f')]);_0x536ca1[_0xd3a6('0x41')]=_['intersection'](_0x536ca1['model'],_0x536ca1[_0xd3a6('0x3f')]);_0x19bba0['attributes']=_[_0xd3a6('0x42')](_0x536ca1[_0xd3a6('0x43')],qs[_0xd3a6('0x45')](_0x130f5d[_0xd3a6('0x3f')][_0xd3a6('0x45')]));_0x19bba0['attributes']=_0x19bba0['attributes'][_0xd3a6('0x46')]?_0x19bba0['attributes']:_0x536ca1['model'];_0x19bba0[_0xd3a6('0x49')]=qs[_0xd3a6('0x4a')](_0x130f5d[_0xd3a6('0x3f')][_0xd3a6('0x4a')]);_0x19bba0[_0xd3a6('0x4b')]=qs[_0xd3a6('0x41')](_['pick'](_0x130f5d[_0xd3a6('0x3f')],_0x536ca1[_0xd3a6('0x41')]));if(_0x130f5d[_0xd3a6('0x3f')]['filter']){_0x19bba0[_0xd3a6('0x4b')]=_[_0xd3a6('0x35')](_0x19bba0['where'],{'$or':_[_0xd3a6('0x3b')](_0x19bba0['attributes'],function(_0x37415f){var _0x2c3b55={};_0x2c3b55[_0x37415f]={'$like':'%'+_0x130f5d[_0xd3a6('0x3f')]['filter']+'%'};return _0x2c3b55;})});}_0x19bba0=_[_0xd3a6('0x35')]({},_0x19bba0,_0x130f5d['options']);return _0x34208c[_0xd3a6('0x5a')](_0x19bba0);}})[_0xd3a6('0x1d')](function(_0x3794cc){if(_0x3794cc){_0x1140e1=_0x3794cc['length'];if(!_0x130f5d[_0xd3a6('0x3f')][_0xd3a6('0x47')]('nolimit')){_0x19bba0[_0xd3a6('0x29')]=qs[_0xd3a6('0x29')](_0x130f5d[_0xd3a6('0x3f')][_0xd3a6('0x29')]);_0x19bba0[_0xd3a6('0x28')]=qs[_0xd3a6('0x28')](_0x130f5d['query']['offset']);}return _0x34208c[_0xd3a6('0x5a')](_0x19bba0);}})[_0xd3a6('0x1d')](function(_0x376fd6){if(_0x376fd6){return _0x376fd6?{'count':_0x1140e1,'rows':_0x376fd6}:null;}})[_0xd3a6('0x1d')](respondWithResult(_0x4b9a38,null))['catch'](handleError(_0x4b9a38,null));};exports[_0xd3a6('0x5b')]=function(_0x2a1495,_0x377f28,_0x477feb){var _0x5a04bf={};var _0x30815f={};var _0x555475;var _0xef36aa;return db[_0xd3a6('0x3c')][_0xd3a6('0x59')]({'where':{'id':_0x2a1495[_0xd3a6('0x55')]['id']}})[_0xd3a6('0x1d')](handleEntityNotFound(_0x377f28,null))[_0xd3a6('0x1d')](function(_0x2d02ee){if(_0x2d02ee){_0x555475=_0x2d02ee;_0x30815f[_0xd3a6('0x43')]=_[_0xd3a6('0x40')](db[_0xd3a6('0x5c')][_0xd3a6('0x56')]);_0x30815f[_0xd3a6('0x3f')]=_['keys'](_0x2a1495[_0xd3a6('0x3f')]);_0x30815f['filters']=_[_0xd3a6('0x42')](_0x30815f[_0xd3a6('0x43')],_0x30815f[_0xd3a6('0x3f')]);_0x5a04bf['attributes']=_[_0xd3a6('0x42')](_0x30815f[_0xd3a6('0x43')],qs['fields'](_0x2a1495[_0xd3a6('0x3f')][_0xd3a6('0x45')]));_0x5a04bf[_0xd3a6('0x44')]=_0x5a04bf[_0xd3a6('0x44')][_0xd3a6('0x46')]?_0x5a04bf[_0xd3a6('0x44')]:_0x30815f[_0xd3a6('0x43')];_0x5a04bf[_0xd3a6('0x49')]=qs['sort'](_0x2a1495[_0xd3a6('0x3f')][_0xd3a6('0x4a')]);_0x5a04bf[_0xd3a6('0x4b')]=qs[_0xd3a6('0x41')](_[_0xd3a6('0x4c')](_0x2a1495[_0xd3a6('0x3f')],_0x30815f[_0xd3a6('0x41')]));if(_0x2a1495[_0xd3a6('0x3f')][_0xd3a6('0x4d')]){_0x5a04bf[_0xd3a6('0x4b')]=_[_0xd3a6('0x35')](_0x5a04bf['where'],{'$or':_[_0xd3a6('0x3b')](_0x5a04bf['attributes'],function(_0x42a3b0){var _0x3d48e8={};_0x3d48e8[_0x42a3b0]={'$like':'%'+_0x2a1495['query'][_0xd3a6('0x4d')]+'%'};return _0x3d48e8;})});}_0x5a04bf=_[_0xd3a6('0x35')]({},_0x5a04bf,_0x2a1495[_0xd3a6('0x4e')]);return _0x555475[_0xd3a6('0x5b')](_0x5a04bf);}})[_0xd3a6('0x1d')](function(_0x19f573){if(_0x19f573){_0xef36aa=_0x19f573[_0xd3a6('0x46')];if(!_0x2a1495[_0xd3a6('0x3f')][_0xd3a6('0x47')](_0xd3a6('0x48'))){_0x5a04bf[_0xd3a6('0x29')]=qs['limit'](_0x2a1495[_0xd3a6('0x3f')][_0xd3a6('0x29')]);_0x5a04bf[_0xd3a6('0x28')]=qs[_0xd3a6('0x28')](_0x2a1495[_0xd3a6('0x3f')][_0xd3a6('0x28')]);}return _0x555475['getSubjects'](_0x5a04bf);}})[_0xd3a6('0x1d')](function(_0x1e47c7){if(_0x1e47c7){return _0x1e47c7?{'count':_0xef36aa,'rows':_0x1e47c7}:null;}})['then'](respondWithResult(_0x377f28,null))[_0xd3a6('0x53')](handleError(_0x377f28,null));};exports['getDescriptions']=function(_0x310a4f,_0x459219,_0x4ca0c3){var _0x2bc341={};var _0x7a94c3={};var _0x275688;var _0x3d1245;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x310a4f[_0xd3a6('0x55')]['id']}})[_0xd3a6('0x1d')](handleEntityNotFound(_0x459219,null))[_0xd3a6('0x1d')](function(_0x3d5017){if(_0x3d5017){_0x275688=_0x3d5017;_0x7a94c3[_0xd3a6('0x43')]=_['keys'](db[_0xd3a6('0x5c')][_0xd3a6('0x56')]);_0x7a94c3[_0xd3a6('0x3f')]=_[_0xd3a6('0x40')](_0x310a4f[_0xd3a6('0x3f')]);_0x7a94c3[_0xd3a6('0x41')]=_[_0xd3a6('0x42')](_0x7a94c3[_0xd3a6('0x43')],_0x7a94c3[_0xd3a6('0x3f')]);_0x2bc341[_0xd3a6('0x44')]=_[_0xd3a6('0x42')](_0x7a94c3[_0xd3a6('0x43')],qs['fields'](_0x310a4f['query']['fields']));_0x2bc341[_0xd3a6('0x44')]=_0x2bc341[_0xd3a6('0x44')]['length']?_0x2bc341[_0xd3a6('0x44')]:_0x7a94c3[_0xd3a6('0x43')];_0x2bc341[_0xd3a6('0x49')]=qs['sort'](_0x310a4f[_0xd3a6('0x3f')][_0xd3a6('0x4a')]);_0x2bc341[_0xd3a6('0x4b')]=qs[_0xd3a6('0x41')](_['pick'](_0x310a4f['query'],_0x7a94c3[_0xd3a6('0x41')]));if(_0x310a4f[_0xd3a6('0x3f')][_0xd3a6('0x4d')]){_0x2bc341['where']=_['merge'](_0x2bc341[_0xd3a6('0x4b')],{'$or':_[_0xd3a6('0x3b')](_0x2bc341[_0xd3a6('0x44')],function(_0x58099c){var _0x3e00f8={};_0x3e00f8[_0x58099c]={'$like':'%'+_0x310a4f[_0xd3a6('0x3f')]['filter']+'%'};return _0x3e00f8;})});}_0x2bc341=_[_0xd3a6('0x35')]({},_0x2bc341,_0x310a4f['options']);return _0x275688[_0xd3a6('0x5d')](_0x2bc341);}})[_0xd3a6('0x1d')](function(_0x3834ba){if(_0x3834ba){_0x3d1245=_0x3834ba[_0xd3a6('0x46')];if(!_0x310a4f['query']['hasOwnProperty'](_0xd3a6('0x48'))){_0x2bc341[_0xd3a6('0x29')]=qs[_0xd3a6('0x29')](_0x310a4f['query']['limit']);_0x2bc341[_0xd3a6('0x28')]=qs['offset'](_0x310a4f[_0xd3a6('0x3f')]['offset']);}return _0x275688[_0xd3a6('0x5d')](_0x2bc341);}})[_0xd3a6('0x1d')](function(_0xa70476){if(_0xa70476){return _0xa70476?{'count':_0x3d1245,'rows':_0xa70476}:null;}})[_0xd3a6('0x1d')](respondWithResult(_0x459219,null))[_0xd3a6('0x53')](handleError(_0x459219,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ed09096..27b329d 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 _0x12f5=['util','../../config/logger','api','request-promise','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x468800,_0x337562){var _0x14f9ff=function(_0x3963b8){while(--_0x3963b8){_0x468800['push'](_0x468800['shift']());}};_0x14f9ff(++_0x337562);}(_0x12f5,0x6d));var _0x512f=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x12f5[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x512f('0x0'));var util=require(_0x512f('0x1'));var logger=require(_0x512f('0x2'))(_0x512f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x512f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x512f('0x5'));var config=require('../../config/environment');var attributes=require(_0x512f('0x6'));module['exports']=function(_0x2b6ac3,_0x2879ba){return _0x2b6ac3[_0x512f('0x7')](_0x512f('0x8'),attributes,{'tableName':_0x512f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc45d=['moment','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0xc45d,0x105));var _0xdc45=function(_0x1cd65a,_0x29fa8f){_0x1cd65a=_0x1cd65a-0x0;var _0xf93849=_0xc45d[_0x1cd65a];return _0xf93849;};'use strict';var _=require(_0xdc45('0x0'));var util=require('util');var logger=require(_0xdc45('0x1'))(_0xdc45('0x2'));var moment=require(_0xdc45('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc45('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc45('0x5'));var config=require(_0xdc45('0x6'));var attributes=require(_0xdc45('0x7'));module[_0xdc45('0x8')]=function(_0x3d7cce,_0x3bec66){return _0x3d7cce[_0xdc45('0x9')](_0xdc45('0xa'),attributes,{'tableName':_0xdc45('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 d5346d9..4f7f689 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 _0x010a=['error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x10a0e5,_0x407d65){var _0x3cd4d0=function(_0x323e4f){while(--_0x323e4f){_0x10a0e5['push'](_0x10a0e5['shift']());}};_0x3cd4d0(++_0x407d65);}(_0x010a,0x164));var _0xa010=function(_0x527584,_0x13fb86){_0x527584=_0x527584-0x0;var _0x427220=_0x010a[_0x527584];return _0x427220;};'use strict';var _=require(_0xa010('0x0'));var util=require('util');var moment=require(_0xa010('0x1'));var BPromise=require(_0xa010('0x2'));var rs=require(_0xa010('0x3'));var fs=require('fs');var Redis=require(_0xa010('0x4'));var db=require(_0xa010('0x5'))['db'];var utils=require(_0xa010('0x6'));var logger=require(_0xa010('0x7'))(_0xa010('0x8'));var config=require('../../config/environment');var jayson=require(_0xa010('0x9'));var client=jayson[_0xa010('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22a91f,_0xaab80e,_0x50abfd){return new BPromise(function(_0x27f4e0,_0x4f1834){return client[_0xa010('0xb')](_0x22a91f,_0x50abfd)['then'](function(_0x4f24a1){logger[_0xa010('0xc')](_0xa010('0xd'),_0xaab80e,_0xa010('0xe'));logger[_0xa010('0xf')](_0xa010('0x10'),_0xaab80e,_0xa010('0xe'),JSON[_0xa010('0x11')](_0x4f24a1));if(_0x4f24a1[_0xa010('0x12')]){if(_0x4f24a1[_0xa010('0x12')][_0xa010('0x13')]===0x1f4){logger[_0xa010('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0xaab80e,_0x4f24a1[_0xa010('0x12')][_0xa010('0x14')]);return _0x4f1834(_0x4f24a1[_0xa010('0x12')][_0xa010('0x14')]);}logger[_0xa010('0x12')](_0xa010('0xd'),_0xaab80e,_0x4f24a1[_0xa010('0x12')][_0xa010('0x14')]);return _0x27f4e0(_0x4f24a1['error'][_0xa010('0x14')]);}else{logger[_0xa010('0xc')](_0xa010('0xd'),_0xaab80e,'request\x20sent');_0x27f4e0(_0x4f24a1['result'][_0xa010('0x14')]);}})[_0xa010('0x15')](function(_0x45dae8){logger[_0xa010('0x12')](_0xa010('0xd'),_0xaab80e,_0x45dae8);_0x4f1834(_0x45dae8);});});} \ No newline at end of file +var _0x8b2b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x209a2a,_0x11f9e1){var _0x44f59c=function(_0x14a3e4){while(--_0x14a3e4){_0x209a2a['push'](_0x209a2a['shift']());}};_0x44f59c(++_0x11f9e1);}(_0x8b2b,0x1e1));var _0xb8b2=function(_0xa6b9a1,_0x42f070){_0xa6b9a1=_0xa6b9a1-0x0;var _0x13140c=_0x8b2b[_0xa6b9a1];return _0x13140c;};'use strict';var _=require(_0xb8b2('0x0'));var util=require(_0xb8b2('0x1'));var moment=require(_0xb8b2('0x2'));var BPromise=require('bluebird');var rs=require(_0xb8b2('0x3'));var fs=require('fs');var Redis=require(_0xb8b2('0x4'));var db=require(_0xb8b2('0x5'))['db'];var utils=require(_0xb8b2('0x6'));var logger=require(_0xb8b2('0x7'))(_0xb8b2('0x8'));var config=require('../../config/environment');var jayson=require(_0xb8b2('0x9'));var client=jayson['client'][_0xb8b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21387f,_0x4f47e4,_0x33feca){return new BPromise(function(_0x5cf97f,_0x181b31){return client[_0xb8b2('0xb')](_0x21387f,_0x33feca)[_0xb8b2('0xc')](function(_0x4a2bd5){logger[_0xb8b2('0xd')](_0xb8b2('0xe'),_0x4f47e4,_0xb8b2('0xf'));logger['debug'](_0xb8b2('0x10'),_0x4f47e4,_0xb8b2('0xf'),JSON['stringify'](_0x4a2bd5));if(_0x4a2bd5['error']){if(_0x4a2bd5[_0xb8b2('0x11')][_0xb8b2('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4f47e4,_0x4a2bd5[_0xb8b2('0x11')]['message']);return _0x181b31(_0x4a2bd5['error'][_0xb8b2('0x13')]);}logger[_0xb8b2('0x11')](_0xb8b2('0xe'),_0x4f47e4,_0x4a2bd5['error'][_0xb8b2('0x13')]);return _0x5cf97f(_0x4a2bd5['error'][_0xb8b2('0x13')]);}else{logger[_0xb8b2('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x4f47e4,'request\x20sent');_0x5cf97f(_0x4a2bd5[_0xb8b2('0x14')]['message']);}})[_0xb8b2('0x15')](function(_0x3c1096){logger[_0xb8b2('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x4f47e4,_0x3c1096);_0x181b31(_0x3c1096);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index b235804..a678390 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 _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','index','get','isAuthenticated','show','post','create','/:id','update'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0x1261,0x144));var _0x1126=function(_0x4c825d,_0x10ec2b){_0x4c825d=_0x4c825d-0x0;var _0x43de87=_0x1261[_0x4c825d];return _0x43de87;};'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('0xe')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0xf')]);router['put'](_0x1126('0x10'),auth[_0x1126('0xc')](),controller[_0x1126('0x11')]);router['delete'](_0x1126('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x1126('0x12')]=router; \ No newline at end of file +var _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','index','get','isAuthenticated','show','post','create','/:id','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1261,0x144));var _0x1126=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x1261[_0xfd495c];return _0x561dd8;};'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('0xe')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0xf')]);router['put'](_0x1126('0x10'),auth[_0x1126('0xc')](),controller[_0x1126('0x11')]);router['delete'](_0x1126('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x1126('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 833bcac..e7bbe58 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 _0xd0bb=['BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','STRING','string','customVariable'];(function(_0x3e4584,_0x43afce){var _0x272f56=function(_0x5e2abf){while(--_0x5e2abf){_0x3e4584['push'](_0x3e4584['shift']());}};_0x272f56(++_0x43afce);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5245bc,_0x55e740){_0x5245bc=_0x5245bc-0x0;var _0x2acb9a=_0xd0bb[_0x5245bc];return _0x2acb9a;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'type':{'type':Sequelize[_0xbd0b('0x2')]('string',_0xbd0b('0x3'),'customVariable',_0xbd0b('0x4'),_0xbd0b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbd0b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbd0b('0x2')](_0xbd0b('0x7'),_0xbd0b('0x3'),_0xbd0b('0x8'))},'keyContent':{'type':Sequelize[_0xbd0b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbd0b('0x6')]},'customField':{'type':Sequelize[_0xbd0b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd0b('0x6')]}}; \ No newline at end of file +var _0x9335=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x4add39,_0x1c0836){var _0x5664dd=function(_0xbc88f){while(--_0xbc88f){_0x4add39['push'](_0x4add39['shift']());}};_0x5664dd(++_0x1c0836);}(_0x9335,0xab));var _0x5933=function(_0x3a474a,_0x571f99){_0x3a474a=_0x3a474a-0x0;var _0x348409=_0x9335[_0x3a474a];return _0x348409;};'use strict';var Sequelize=require(_0x5933('0x0'));module[_0x5933('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5933('0x2'),_0x5933('0x3'),_0x5933('0x4'),_0x5933('0x5'),_0x5933('0x6')),'defaultValue':_0x5933('0x2')},'content':{'type':Sequelize[_0x5933('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5933('0x8')]('string','variable',_0x5933('0x4'))},'keyContent':{'type':Sequelize[_0x5933('0x7')]},'idField':{'type':Sequelize[_0x5933('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5933('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5933('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f86c7b5..e00ad25 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 _0xc9a4=['json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','name','send','render','merge','body','message','agent','interaction','account','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','options','rows','catch','show','keys','includeAll','find','create','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status'];(function(_0x152aa1,_0x307718){var _0x1bc01a=function(_0xd3211e){while(--_0xd3211e){_0x152aa1['push'](_0x152aa1['shift']());}};_0x1bc01a(++_0x307718);}(_0xc9a4,0x10a));var _0x4c9a=function(_0x56ac50,_0x2df160){_0x56ac50=_0x56ac50-0x0;var _0x11d708=_0xc9a4[_0x56ac50];return _0x11d708;};'use strict';var emlformat=require(_0x4c9a('0x0'));var rimraf=require(_0x4c9a('0x1'));var zipdir=require(_0x4c9a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c9a('0x3'));var moment=require(_0x4c9a('0x4'));var BPromise=require(_0x4c9a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4c9a('0x6'));var sox=require(_0x4c9a('0x7'));var csv=require(_0x4c9a('0x8'));var ejs=require(_0x4c9a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c9a('0xa'));var squel=require(_0x4c9a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c9a('0xc'));var toCsv=require(_0x4c9a('0x8'));var querystring=require(_0x4c9a('0xd'));var Papa=require(_0x4c9a('0xe'));var Redis=require('ioredis');var authService=require(_0x4c9a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4c9a('0x10'));var hardwareService=require(_0x4c9a('0x11'));var logger=require(_0x4c9a('0x12'))(_0x4c9a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4c9a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35f4bb,_0x22193d){_0x22193d=_0x22193d||0xcc;return function(_0x266366){if(_0x266366){return _0x35f4bb['sendStatus'](_0x22193d);}return _0x35f4bb['status'](_0x22193d)['end']();};}function respondWithResult(_0x3b87f5,_0x338bbf){_0x338bbf=_0x338bbf||0xc8;return function(_0x30df85){if(_0x30df85){return _0x3b87f5[_0x4c9a('0x15')](_0x338bbf)[_0x4c9a('0x16')](_0x30df85);}};}function respondWithFilteredResult(_0x2c58a2,_0x328367){return function(_0x36df0c){if(_0x36df0c){var _0x34ced3=typeof _0x328367[_0x4c9a('0x17')]===_0x4c9a('0x18')&&typeof _0x328367[_0x4c9a('0x19')]===_0x4c9a('0x18');var _0x437c75=_0x36df0c[_0x4c9a('0x1a')];var _0x85eccb=_0x34ced3?0x0:_0x328367[_0x4c9a('0x17')];var _0x15fb16=_0x34ced3?_0x36df0c[_0x4c9a('0x1a')]:_0x328367[_0x4c9a('0x17')]+_0x328367['limit'];var _0x199b7f;if(_0x15fb16>=_0x437c75){_0x15fb16=_0x437c75;_0x199b7f=0xc8;}else{_0x199b7f=0xce;}_0x2c58a2[_0x4c9a('0x15')](_0x199b7f);return _0x2c58a2[_0x4c9a('0x1b')]('Content-Range',_0x85eccb+'-'+_0x15fb16+'/'+_0x437c75)['json'](_0x36df0c);}return null;};}function patchUpdates(_0x1b8b2c){return function(_0x3fc634){try{jsonpatch[_0x4c9a('0x1c')](_0x3fc634,_0x1b8b2c,!![]);}catch(_0x4f1dc0){return BPromise[_0x4c9a('0x1d')](_0x4f1dc0);}return _0x3fc634[_0x4c9a('0x1e')]();};}function saveUpdates(_0x3218c2,_0x4c552a){return function(_0x2f1cab){if(_0x2f1cab){return _0x2f1cab['update'](_0x3218c2)[_0x4c9a('0x1f')](function(_0xc78575){return _0xc78575;});}return null;};}function removeEntity(_0xe6e307,_0x55c8cc){return function(_0x52966c){if(_0x52966c){return _0x52966c[_0x4c9a('0x20')]()['then'](function(){_0xe6e307['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf6b151,_0xd7913d){return function(_0x232ab4){if(!_0x232ab4){_0xf6b151[_0x4c9a('0x21')](0x194);}return _0x232ab4;};}function handleError(_0x452e65,_0x1a15c6){_0x1a15c6=_0x1a15c6||0x1f4;return function(_0x46f1ae){logger[_0x4c9a('0x22')](_0x46f1ae['stack']);if(_0x46f1ae[_0x4c9a('0x23')]){delete _0x46f1ae[_0x4c9a('0x23')];}_0x452e65[_0x4c9a('0x15')](_0x1a15c6)[_0x4c9a('0x24')](_0x46f1ae);};}function getMustacheRender(_0x262384,_0x5cf9e3){return Mustache[_0x4c9a('0x25')](_0x262384,_[_0x4c9a('0x26')](_0x5cf9e3[_0x4c9a('0x27')],{'contact':_0x5cf9e3['contact'],'message':_0x5cf9e3[_0x4c9a('0x28')],'agent':_0x5cf9e3[_0x4c9a('0x29')],'interaction':_0x5cf9e3[_0x4c9a('0x2a')],'account':_0x5cf9e3[_0x4c9a('0x2b')]}))||'';}exports[_0x4c9a('0x2c')]=function(_0x4b355b,_0x58d813){var _0x28ccee={},_0x158aa1={},_0x370efe={'count':0x0,'rows':[]};var _0x411f37=_[_0x4c9a('0x2d')](db[_0x4c9a('0x2e')][_0x4c9a('0x2f')],function(_0x2a59b0){return{'name':_0x2a59b0[_0x4c9a('0x30')],'type':_0x2a59b0[_0x4c9a('0x31')][_0x4c9a('0x32')]};});_0x158aa1[_0x4c9a('0x33')]=_['map'](_0x411f37,_0x4c9a('0x23'));_0x158aa1[_0x4c9a('0x34')]=_['keys'](_0x4b355b[_0x4c9a('0x34')]);_0x158aa1['filters']=_[_0x4c9a('0x35')](_0x158aa1[_0x4c9a('0x33')],_0x158aa1[_0x4c9a('0x34')]);_0x28ccee[_0x4c9a('0x36')]=_[_0x4c9a('0x35')](_0x158aa1[_0x4c9a('0x33')],qs['fields'](_0x4b355b[_0x4c9a('0x34')][_0x4c9a('0x37')]));_0x28ccee[_0x4c9a('0x36')]=_0x28ccee[_0x4c9a('0x36')][_0x4c9a('0x38')]?_0x28ccee['attributes']:_0x158aa1[_0x4c9a('0x33')];if(!_0x4b355b[_0x4c9a('0x34')][_0x4c9a('0x39')](_0x4c9a('0x3a'))){_0x28ccee['limit']=qs[_0x4c9a('0x19')](_0x4b355b[_0x4c9a('0x34')][_0x4c9a('0x19')]);_0x28ccee[_0x4c9a('0x17')]=qs[_0x4c9a('0x17')](_0x4b355b[_0x4c9a('0x34')][_0x4c9a('0x17')]);}_0x28ccee[_0x4c9a('0x3b')]=qs[_0x4c9a('0x3c')](_0x4b355b[_0x4c9a('0x34')][_0x4c9a('0x3c')]);_0x28ccee['where']=qs['filters'](_['pick'](_0x4b355b[_0x4c9a('0x34')],_0x158aa1['filters']),_0x411f37);if(_0x4b355b[_0x4c9a('0x34')][_0x4c9a('0x3d')]){_0x28ccee[_0x4c9a('0x3e')]=_[_0x4c9a('0x26')](_0x28ccee[_0x4c9a('0x3e')],{'$or':_[_0x4c9a('0x2d')](_0x411f37,function(_0x20eb8a){if(_0x20eb8a['type']!=='VIRTUAL'){var _0x55a33c={};_0x55a33c[_0x20eb8a['name']]={'$like':'%'+_0x4b355b['query'][_0x4c9a('0x3d')]+'%'};return _0x55a33c;}})});}_0x28ccee=_['merge']({},_0x28ccee,_0x4b355b[_0x4c9a('0x3f')]);var _0x520e1e={'where':_0x28ccee[_0x4c9a('0x3e')]};return db[_0x4c9a('0x2e')]['count'](_0x520e1e)[_0x4c9a('0x1f')](function(_0x23c444){_0x370efe[_0x4c9a('0x1a')]=_0x23c444;if(_0x4b355b[_0x4c9a('0x34')]['includeAll']){_0x28ccee['include']=[{'all':!![]}];}return db[_0x4c9a('0x2e')]['findAll'](_0x28ccee);})[_0x4c9a('0x1f')](function(_0x1c9ef1){_0x370efe[_0x4c9a('0x40')]=_0x1c9ef1;return _0x370efe;})['then'](respondWithFilteredResult(_0x58d813,_0x28ccee))[_0x4c9a('0x41')](handleError(_0x58d813,null));};exports[_0x4c9a('0x42')]=function(_0x3eba54,_0x42e887){var _0x217b4c={'raw':!![],'where':{'id':_0x3eba54['params']['id']}},_0x51a828={};_0x51a828[_0x4c9a('0x33')]=_[_0x4c9a('0x43')](db[_0x4c9a('0x2e')][_0x4c9a('0x2f')]);_0x51a828[_0x4c9a('0x34')]=_[_0x4c9a('0x43')](_0x3eba54['query']);_0x51a828['filters']=_['intersection'](_0x51a828['model'],_0x51a828[_0x4c9a('0x34')]);_0x217b4c['attributes']=_[_0x4c9a('0x35')](_0x51a828['model'],qs[_0x4c9a('0x37')](_0x3eba54[_0x4c9a('0x34')][_0x4c9a('0x37')]));_0x217b4c[_0x4c9a('0x36')]=_0x217b4c[_0x4c9a('0x36')][_0x4c9a('0x38')]?_0x217b4c[_0x4c9a('0x36')]:_0x51a828[_0x4c9a('0x33')];if(_0x3eba54[_0x4c9a('0x34')][_0x4c9a('0x44')]){_0x217b4c['include']=[{'all':!![]}];}_0x217b4c=_['merge']({},_0x217b4c,_0x3eba54[_0x4c9a('0x3f')]);return db[_0x4c9a('0x2e')][_0x4c9a('0x45')](_0x217b4c)[_0x4c9a('0x1f')](handleEntityNotFound(_0x42e887,null))[_0x4c9a('0x1f')](respondWithResult(_0x42e887,null))[_0x4c9a('0x41')](handleError(_0x42e887,null));};exports[_0x4c9a('0x46')]=function(_0x138b3a,_0x334437){return db[_0x4c9a('0x2e')][_0x4c9a('0x46')](_0x138b3a[_0x4c9a('0x27')],{})[_0x4c9a('0x1f')](respondWithResult(_0x334437,0xc9))[_0x4c9a('0x41')](handleError(_0x334437,null));};exports['update']=function(_0x19710e,_0x5585ac){if(_0x19710e[_0x4c9a('0x27')]['id']){delete _0x19710e[_0x4c9a('0x27')]['id'];}return db[_0x4c9a('0x2e')]['find']({'where':{'id':_0x19710e['params']['id']}})['then'](handleEntityNotFound(_0x5585ac,null))['then'](saveUpdates(_0x19710e[_0x4c9a('0x27')],null))[_0x4c9a('0x1f')](respondWithResult(_0x5585ac,null))[_0x4c9a('0x41')](handleError(_0x5585ac,null));};exports['destroy']=function(_0x249a91,_0x56dd43){return db[_0x4c9a('0x2e')][_0x4c9a('0x45')]({'where':{'id':_0x249a91[_0x4c9a('0x47')]['id']}})[_0x4c9a('0x1f')](handleEntityNotFound(_0x56dd43,null))[_0x4c9a('0x1f')](removeEntity(_0x56dd43,null))[_0x4c9a('0x41')](handleError(_0x56dd43,null));}; \ No newline at end of file +var _0xd227=['sort','where','pick','merge','options','includeAll','include','catch','show','params','rawAttributes','create','update','find','eml-format','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','reject','then','destroy','end','sendStatus','error','stack','name','send','render','body','contact','message','agent','account','index','map','VtigerField','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order'];(function(_0x38161c,_0x161f54){var _0x2bf4a0=function(_0x50f178){while(--_0x50f178){_0x38161c['push'](_0x38161c['shift']());}};_0x2bf4a0(++_0x161f54);}(_0xd227,0x1ac));var _0x7d22=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xd227[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0x7d22('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d22('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7d22('0x2'));var util=require(_0x7d22('0x3'));var path=require('path');var sox=require(_0x7d22('0x4'));var csv=require(_0x7d22('0x5'));var ejs=require(_0x7d22('0x6'));var fs=require('fs');var fs_extra=require(_0x7d22('0x7'));var _=require(_0x7d22('0x8'));var squel=require(_0x7d22('0x9'));var crypto=require(_0x7d22('0xa'));var jsforce=require(_0x7d22('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7d22('0x5'));var querystring=require('querystring');var Papa=require(_0x7d22('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7d22('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d22('0xe'))(_0x7d22('0xf'));var utils=require('../../config/utils');var config=require(_0x7d22('0x10'));var licenseUtil=require(_0x7d22('0x11'));var db=require(_0x7d22('0x12'))['db'];function respondWithStatusCode(_0xb31139,_0x525bc6){_0x525bc6=_0x525bc6||0xcc;return function(_0x25e155){if(_0x25e155){return _0xb31139['sendStatus'](_0x525bc6);}return _0xb31139['status'](_0x525bc6)['end']();};}function respondWithResult(_0x219a84,_0x17d1ba){_0x17d1ba=_0x17d1ba||0xc8;return function(_0x34f2a2){if(_0x34f2a2){return _0x219a84[_0x7d22('0x13')](_0x17d1ba)[_0x7d22('0x14')](_0x34f2a2);}};}function respondWithFilteredResult(_0x10ed28,_0x5b917f){return function(_0x3ded27){if(_0x3ded27){var _0x4505fc=typeof _0x5b917f[_0x7d22('0x15')]==='undefined'&&typeof _0x5b917f[_0x7d22('0x16')]==='undefined';var _0x4dfa7f=_0x3ded27['count'];var _0x2890b2=_0x4505fc?0x0:_0x5b917f[_0x7d22('0x15')];var _0x4e7207=_0x4505fc?_0x3ded27[_0x7d22('0x17')]:_0x5b917f[_0x7d22('0x15')]+_0x5b917f['limit'];var _0x3aea24;if(_0x4e7207>=_0x4dfa7f){_0x4e7207=_0x4dfa7f;_0x3aea24=0xc8;}else{_0x3aea24=0xce;}_0x10ed28[_0x7d22('0x13')](_0x3aea24);return _0x10ed28[_0x7d22('0x18')]('Content-Range',_0x2890b2+'-'+_0x4e7207+'/'+_0x4dfa7f)['json'](_0x3ded27);}return null;};}function patchUpdates(_0x4617a5){return function(_0x1550d2){try{jsonpatch['apply'](_0x1550d2,_0x4617a5,!![]);}catch(_0x1ef801){return BPromise[_0x7d22('0x19')](_0x1ef801);}return _0x1550d2['save']();};}function saveUpdates(_0x46d9c3,_0x19f044){return function(_0x55ca5d){if(_0x55ca5d){return _0x55ca5d['update'](_0x46d9c3)[_0x7d22('0x1a')](function(_0x3b3407){return _0x3b3407;});}return null;};}function removeEntity(_0x127f94,_0x4a917a){return function(_0x2eca95){if(_0x2eca95){return _0x2eca95[_0x7d22('0x1b')]()['then'](function(){_0x127f94['status'](0xcc)[_0x7d22('0x1c')]();});}};}function handleEntityNotFound(_0x57ca56,_0x127948){return function(_0x4bbb61){if(!_0x4bbb61){_0x57ca56[_0x7d22('0x1d')](0x194);}return _0x4bbb61;};}function handleError(_0x5a9b98,_0xb4e690){_0xb4e690=_0xb4e690||0x1f4;return function(_0x1f2af2){logger[_0x7d22('0x1e')](_0x1f2af2[_0x7d22('0x1f')]);if(_0x1f2af2[_0x7d22('0x20')]){delete _0x1f2af2[_0x7d22('0x20')];}_0x5a9b98[_0x7d22('0x13')](_0xb4e690)[_0x7d22('0x21')](_0x1f2af2);};}function getMustacheRender(_0x38f605,_0x1f0d13){return Mustache[_0x7d22('0x22')](_0x38f605,_['merge'](_0x1f0d13[_0x7d22('0x23')],{'contact':_0x1f0d13[_0x7d22('0x24')],'message':_0x1f0d13[_0x7d22('0x25')],'agent':_0x1f0d13[_0x7d22('0x26')],'interaction':_0x1f0d13['interaction'],'account':_0x1f0d13[_0x7d22('0x27')]}))||'';}exports[_0x7d22('0x28')]=function(_0x4ddf65,_0x34c4c7){var _0x4c3aa7={},_0x5df6e3={},_0x3a3cb2={'count':0x0,'rows':[]};var _0x4f63e9=_[_0x7d22('0x29')](db[_0x7d22('0x2a')]['rawAttributes'],function(_0xe3be52){return{'name':_0xe3be52[_0x7d22('0x2b')],'type':_0xe3be52[_0x7d22('0x2c')]['key']};});_0x5df6e3['model']=_[_0x7d22('0x29')](_0x4f63e9,'name');_0x5df6e3[_0x7d22('0x2d')]=_[_0x7d22('0x2e')](_0x4ddf65[_0x7d22('0x2d')]);_0x5df6e3[_0x7d22('0x2f')]=_[_0x7d22('0x30')](_0x5df6e3[_0x7d22('0x31')],_0x5df6e3[_0x7d22('0x2d')]);_0x4c3aa7[_0x7d22('0x32')]=_['intersection'](_0x5df6e3[_0x7d22('0x31')],qs[_0x7d22('0x33')](_0x4ddf65[_0x7d22('0x2d')][_0x7d22('0x33')]));_0x4c3aa7['attributes']=_0x4c3aa7[_0x7d22('0x32')][_0x7d22('0x34')]?_0x4c3aa7[_0x7d22('0x32')]:_0x5df6e3[_0x7d22('0x31')];if(!_0x4ddf65['query'][_0x7d22('0x35')]('nolimit')){_0x4c3aa7['limit']=qs[_0x7d22('0x16')](_0x4ddf65[_0x7d22('0x2d')][_0x7d22('0x16')]);_0x4c3aa7[_0x7d22('0x15')]=qs[_0x7d22('0x15')](_0x4ddf65[_0x7d22('0x2d')][_0x7d22('0x15')]);}_0x4c3aa7[_0x7d22('0x36')]=qs[_0x7d22('0x37')](_0x4ddf65[_0x7d22('0x2d')][_0x7d22('0x37')]);_0x4c3aa7[_0x7d22('0x38')]=qs[_0x7d22('0x2f')](_[_0x7d22('0x39')](_0x4ddf65['query'],_0x5df6e3[_0x7d22('0x2f')]),_0x4f63e9);if(_0x4ddf65['query']['filter']){_0x4c3aa7['where']=_[_0x7d22('0x3a')](_0x4c3aa7['where'],{'$or':_['map'](_0x4f63e9,function(_0x2ebbd1){if(_0x2ebbd1['type']!=='VIRTUAL'){var _0x312e70={};_0x312e70[_0x2ebbd1[_0x7d22('0x20')]]={'$like':'%'+_0x4ddf65['query']['filter']+'%'};return _0x312e70;}})});}_0x4c3aa7=_[_0x7d22('0x3a')]({},_0x4c3aa7,_0x4ddf65[_0x7d22('0x3b')]);var _0x2446d5={'where':_0x4c3aa7[_0x7d22('0x38')]};return db[_0x7d22('0x2a')][_0x7d22('0x17')](_0x2446d5)[_0x7d22('0x1a')](function(_0x1fe6a6){_0x3a3cb2[_0x7d22('0x17')]=_0x1fe6a6;if(_0x4ddf65[_0x7d22('0x2d')][_0x7d22('0x3c')]){_0x4c3aa7[_0x7d22('0x3d')]=[{'all':!![]}];}return db[_0x7d22('0x2a')]['findAll'](_0x4c3aa7);})[_0x7d22('0x1a')](function(_0x1044c7){_0x3a3cb2['rows']=_0x1044c7;return _0x3a3cb2;})[_0x7d22('0x1a')](respondWithFilteredResult(_0x34c4c7,_0x4c3aa7))[_0x7d22('0x3e')](handleError(_0x34c4c7,null));};exports[_0x7d22('0x3f')]=function(_0x53f567,_0x5c59fe){var _0xf0e66={'raw':!![],'where':{'id':_0x53f567[_0x7d22('0x40')]['id']}},_0x2db010={};_0x2db010['model']=_[_0x7d22('0x2e')](db['VtigerField'][_0x7d22('0x41')]);_0x2db010[_0x7d22('0x2d')]=_['keys'](_0x53f567['query']);_0x2db010[_0x7d22('0x2f')]=_[_0x7d22('0x30')](_0x2db010['model'],_0x2db010[_0x7d22('0x2d')]);_0xf0e66[_0x7d22('0x32')]=_['intersection'](_0x2db010[_0x7d22('0x31')],qs[_0x7d22('0x33')](_0x53f567[_0x7d22('0x2d')][_0x7d22('0x33')]));_0xf0e66['attributes']=_0xf0e66[_0x7d22('0x32')]['length']?_0xf0e66[_0x7d22('0x32')]:_0x2db010[_0x7d22('0x31')];if(_0x53f567['query'][_0x7d22('0x3c')]){_0xf0e66[_0x7d22('0x3d')]=[{'all':!![]}];}_0xf0e66=_[_0x7d22('0x3a')]({},_0xf0e66,_0x53f567['options']);return db[_0x7d22('0x2a')]['find'](_0xf0e66)[_0x7d22('0x1a')](handleEntityNotFound(_0x5c59fe,null))[_0x7d22('0x1a')](respondWithResult(_0x5c59fe,null))[_0x7d22('0x3e')](handleError(_0x5c59fe,null));};exports[_0x7d22('0x42')]=function(_0x5a8d43,_0x45946e){return db['VtigerField'][_0x7d22('0x42')](_0x5a8d43[_0x7d22('0x23')],{})['then'](respondWithResult(_0x45946e,0xc9))[_0x7d22('0x3e')](handleError(_0x45946e,null));};exports[_0x7d22('0x43')]=function(_0x444c88,_0xc9efc4){if(_0x444c88['body']['id']){delete _0x444c88[_0x7d22('0x23')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x444c88[_0x7d22('0x40')]['id']}})[_0x7d22('0x1a')](handleEntityNotFound(_0xc9efc4,null))[_0x7d22('0x1a')](saveUpdates(_0x444c88['body'],null))['then'](respondWithResult(_0xc9efc4,null))[_0x7d22('0x3e')](handleError(_0xc9efc4,null));};exports[_0x7d22('0x1b')]=function(_0x5e987e,_0x18211b){return db['VtigerField'][_0x7d22('0x44')]({'where':{'id':_0x5e987e[_0x7d22('0x40')]['id']}})[_0x7d22('0x1a')](handleEntityNotFound(_0x18211b,null))[_0x7d22('0x1a')](removeEntity(_0x18211b,null))['catch'](handleError(_0x18211b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a6d881a..6b2abeb 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 _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'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 f7c5b7a..7bc89e5 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 _0x4fad=['info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xa5782b,_0x161e8f){var _0x377194=function(_0x50a468){while(--_0x50a468){_0xa5782b['push'](_0xa5782b['shift']());}};_0x377194(++_0x161e8f);}(_0x4fad,0xcb));var _0xd4fa=function(_0x5e2122,_0x442a20){_0x5e2122=_0x5e2122-0x0;var _0x1359e6=_0x4fad[_0x5e2122];return _0x1359e6;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var moment=require(_0xd4fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4fa('0x3'));var fs=require('fs');var Redis=require(_0xd4fa('0x4'));var db=require(_0xd4fa('0x5'))['db'];var utils=require(_0xd4fa('0x6'));var logger=require(_0xd4fa('0x7'))(_0xd4fa('0x8'));var config=require(_0xd4fa('0x9'));var jayson=require(_0xd4fa('0xa'));var client=jayson['client'][_0xd4fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b426,_0x2b9f6a,_0x19a910){return new BPromise(function(_0x155c09,_0x3fff99){return client[_0xd4fa('0xc')](_0x52b426,_0x19a910)['then'](function(_0x26a894){logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,'request\x20sent');logger[_0xd4fa('0xf')](_0xd4fa('0x10'),_0x2b9f6a,_0xd4fa('0x11'),JSON[_0xd4fa('0x12')](_0x26a894));if(_0x26a894['error']){if(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x14')]===0x1f4){logger[_0xd4fa('0x13')]('VtigerField,\x20%s,\x20%s',_0x2b9f6a,_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);return _0x3fff99(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}logger[_0xd4fa('0x13')](_0xd4fa('0xe'),_0x2b9f6a,_0x26a894['error'][_0xd4fa('0x15')]);return _0x155c09(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}else{logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,_0xd4fa('0x11'));_0x155c09(_0x26a894[_0xd4fa('0x16')]['message']);}})[_0xd4fa('0x17')](function(_0x3a3b8c){logger[_0xd4fa('0x13')]('VtigerField,\x20%s,\x20%s',_0x2b9f6a,_0x3a3b8c);_0x3fff99(_0x3a3b8c);});});} \ No newline at end of file +var _0x66d3=['request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0xdd9a5f,_0x3ced93){var _0x3464b7=function(_0x35b534){while(--_0x35b534){_0xdd9a5f['push'](_0xdd9a5f['shift']());}};_0x3464b7(++_0x3ced93);}(_0x66d3,0x10f));var _0x366d=function(_0x1cf0aa,_0x2900b8){_0x1cf0aa=_0x1cf0aa-0x0;var _0x182450=_0x66d3[_0x1cf0aa];return _0x182450;};'use strict';var _=require(_0x366d('0x0'));var util=require('util');var moment=require(_0x366d('0x1'));var BPromise=require('bluebird');var rs=require(_0x366d('0x2'));var fs=require('fs');var Redis=require(_0x366d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x366d('0x4'));var logger=require('../../config/logger')(_0x366d('0x5'));var config=require('../../config/environment');var jayson=require(_0x366d('0x6'));var client=jayson[_0x366d('0x7')][_0x366d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x454c54,_0x2e9573,_0x16907c){return new BPromise(function(_0x247d15,_0x12c7bb){return client[_0x366d('0x9')](_0x454c54,_0x16907c)[_0x366d('0xa')](function(_0x2adf49){logger['info'](_0x366d('0xb'),_0x2e9573,_0x366d('0xc'));logger[_0x366d('0xd')](_0x366d('0xe'),_0x2e9573,_0x366d('0xc'),JSON[_0x366d('0xf')](_0x2adf49));if(_0x2adf49[_0x366d('0x10')]){if(_0x2adf49[_0x366d('0x10')]['code']===0x1f4){logger['error'](_0x366d('0xb'),_0x2e9573,_0x2adf49[_0x366d('0x10')][_0x366d('0x11')]);return _0x12c7bb(_0x2adf49[_0x366d('0x10')][_0x366d('0x11')]);}logger[_0x366d('0x10')]('VtigerField,\x20%s,\x20%s',_0x2e9573,_0x2adf49[_0x366d('0x10')][_0x366d('0x11')]);return _0x247d15(_0x2adf49['error'][_0x366d('0x11')]);}else{logger[_0x366d('0x12')]('VtigerField,\x20%s,\x20%s',_0x2e9573,_0x366d('0xc'));_0x247d15(_0x2adf49[_0x366d('0x13')][_0x366d('0x11')]);}})['catch'](function(_0x10a27f){logger['error'](_0x366d('0xb'),_0x2e9573,_0x10a27f);_0x12c7bb(_0x10a27f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 4cdcdb1..7fab4aa 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 _0x6bac=['./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','post','create','/:id/configurations','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../config/environment'];(function(_0x16b467,_0x2ad735){var _0x31b48e=function(_0x1abfa6){while(--_0x1abfa6){_0x16b467['push'](_0x16b467['shift']());}};_0x31b48e(++_0x2ad735);}(_0x6bac,0xa5));var _0xc6ba=function(_0x3b4137,_0x3729ae){_0x3b4137=_0x3b4137-0x0;var _0x4606ab=_0x6bac[_0x3b4137];return _0x4606ab;};'use strict';var multer=require(_0xc6ba('0x0'));var util=require('util');var path=require(_0xc6ba('0x1'));var timeout=require(_0xc6ba('0x2'));var express=require(_0xc6ba('0x3'));var router=express[_0xc6ba('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc6ba('0x5'));var controller=require(_0xc6ba('0x6'));router['get']('/',auth[_0xc6ba('0x7')](),controller[_0xc6ba('0x8')]);router[_0xc6ba('0x9')](_0xc6ba('0xa'),auth[_0xc6ba('0x7')](),controller[_0xc6ba('0xb')]);router['get']('/:id/configurations',auth[_0xc6ba('0x7')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xc6ba('0xc')]('/',auth[_0xc6ba('0x7')](),controller[_0xc6ba('0xd')]);router[_0xc6ba('0xc')](_0xc6ba('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc6ba('0xf')](_0xc6ba('0xa'),auth[_0xc6ba('0x7')](),controller[_0xc6ba('0x10')]);router[_0xc6ba('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc6ba('0x12')]=router; \ No newline at end of file +var _0x6c45=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x272fa4,_0xf712d1){var _0x25ec85=function(_0x2be21c){while(--_0x2be21c){_0x272fa4['push'](_0x272fa4['shift']());}};_0x25ec85(++_0xf712d1);}(_0x6c45,0xb1));var _0x56c4=function(_0x2d4afa,_0x11496e){_0x2d4afa=_0x2d4afa-0x0;var _0x7b6a4c=_0x6c45[_0x2d4afa];return _0x7b6a4c;};'use strict';var multer=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var path=require('path');var timeout=require(_0x56c4('0x2'));var express=require(_0x56c4('0x3'));var router=express[_0x56c4('0x4')]();var fs_extra=require(_0x56c4('0x5'));var auth=require(_0x56c4('0x6'));var interaction=require(_0x56c4('0x7'));var config=require(_0x56c4('0x8'));var controller=require(_0x56c4('0x9'));router[_0x56c4('0xa')]('/',auth[_0x56c4('0xb')](),controller[_0x56c4('0xc')]);router[_0x56c4('0xa')](_0x56c4('0xd'),auth[_0x56c4('0xb')](),controller[_0x56c4('0xe')]);router[_0x56c4('0xa')](_0x56c4('0xf'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x10')]);router[_0x56c4('0xa')]('/:id/fields',auth[_0x56c4('0xb')](),controller[_0x56c4('0x11')]);router[_0x56c4('0x12')]('/',auth[_0x56c4('0xb')](),controller['create']);router[_0x56c4('0x12')](_0x56c4('0xf'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x13')]);router['put'](_0x56c4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x56c4('0x14')](_0x56c4('0xd'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x15')]);module[_0x56c4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 436e251..a3ab842 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 _0xb64e=['sequelize','exports','STRING','username','ENUM','password','token','integrationTab','newTab'];(function(_0xdf13c9,_0x5da43f){var _0x302aaa=function(_0x42cc73){while(--_0x42cc73){_0xdf13c9['push'](_0xdf13c9['shift']());}};_0x302aaa(++_0x5da43f);}(_0xb64e,0x156));var _0xeb64=function(_0x435e2f,_0x43f39d){_0x435e2f=_0x435e2f-0x0;var _0x4f128e=_0xb64e[_0x435e2f];return _0x4f128e;};'use strict';var Sequelize=require(_0xeb64('0x0'));module[_0xeb64('0x1')]={'name':{'type':Sequelize[_0xeb64('0x2')]},'description':{'type':Sequelize[_0xeb64('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xeb64('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xeb64('0x2')]},'remoteUri':{'type':Sequelize[_0xeb64('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xeb64('0x4')](_0xeb64('0x5'),_0xeb64('0x6')),'defaultValue':_0xeb64('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xeb64('0x4')](_0xeb64('0x7'),_0xeb64('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x7b73=['token','integrationTab','newTab','sequelize','STRING','remoteUri','ENUM','password'];(function(_0x5cdeb0,_0x42b299){var _0x410717=function(_0x28557b){while(--_0x28557b){_0x5cdeb0['push'](_0x5cdeb0['shift']());}};_0x410717(++_0x42b299);}(_0x7b73,0x153));var _0x37b7=function(_0x2e216d,_0x488e18){_0x2e216d=_0x2e216d-0x0;var _0x1fbac5=_0x7b73[_0x2e216d];return _0x1fbac5;};'use strict';var Sequelize=require(_0x37b7('0x0'));module['exports']={'name':{'type':Sequelize[_0x37b7('0x1')]},'description':{'type':Sequelize[_0x37b7('0x1')]},'username':{'type':Sequelize[_0x37b7('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x37b7('0x1')]},'remoteUri':{'type':Sequelize[_0x37b7('0x1')],'unique':_0x37b7('0x2')},'authType':{'type':Sequelize[_0x37b7('0x3')](_0x37b7('0x4'),_0x37b7('0x5')),'defaultValue':_0x37b7('0x4')},'serverUrl':{'type':Sequelize[_0x37b7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x37b7('0x3')](_0x37b7('0x6'),_0x37b7('0x7')),'defaultValue':_0x37b7('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 50b5bf7..fc79ad9 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 _0xd65f=['%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','ZendeskAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name','send','merge','body','contact','agent','interaction','index','ZendeskAccount','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','Basic\x20%s','%s:%s','toString','headers'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xd65f,0x11d));var _0xfd65=function(_0x7629e,_0x40c972){_0x7629e=_0x7629e-0x0;var _0x19569b=_0xd65f[_0x7629e];return _0x19569b;};'use strict';var emlformat=require(_0xfd65('0x0'));var rimraf=require(_0xfd65('0x1'));var zipdir=require(_0xfd65('0x2'));var jsonpatch=require(_0xfd65('0x3'));var rp=require(_0xfd65('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfd65('0x5'));var sox=require(_0xfd65('0x6'));var csv=require('to-csv');var ejs=require(_0xfd65('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd65('0x8'));var squel=require(_0xfd65('0x9'));var crypto=require(_0xfd65('0xa'));var jsforce=require(_0xfd65('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfd65('0xc'));var querystring=require('querystring');var Papa=require(_0xfd65('0xd'));var Redis=require('ioredis');var authService=require(_0xfd65('0xe'));var qs=require(_0xfd65('0xf'));var as=require(_0xfd65('0x10'));var hardwareService=require(_0xfd65('0x11'));var logger=require(_0xfd65('0x12'))(_0xfd65('0x13'));var utils=require('../../config/utils');var config=require(_0xfd65('0x14'));var licenseUtil=require(_0xfd65('0x15'));var db=require(_0xfd65('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xfd65('0x17'));var client=jayson[_0xfd65('0x18')][_0xfd65('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x70f798,_0x3f8bf7,_0x4b190a,_0x3927a5){return new BPromise(function(_0x4aab14,_0x4d6702){var _0x41465b=_0x3927a5||client;return _0x41465b[_0xfd65('0x1a')](_0x70f798,_0x4b190a)['then'](function(_0x28ea37){logger[_0xfd65('0x1b')]('ZendeskAccount,\x20%s,\x20%s',_0x3f8bf7,_0xfd65('0x1c'));logger[_0xfd65('0x1d')](_0xfd65('0x1e'),_0x3f8bf7,_0xfd65('0x1c'),JSON['stringify'](_0x28ea37));if(_0x28ea37['error']){if(_0x28ea37[_0xfd65('0x1f')][_0xfd65('0x20')]===0x1f4){logger[_0xfd65('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x3f8bf7,_0x28ea37[_0xfd65('0x1f')]['message']);return _0x4d6702(_0x28ea37[_0xfd65('0x1f')][_0xfd65('0x21')]);}logger[_0xfd65('0x1f')](_0xfd65('0x22'),_0x3f8bf7,_0x28ea37[_0xfd65('0x1f')]['message']);return _0x4aab14(_0x28ea37[_0xfd65('0x1f')]['message']);}else{logger[_0xfd65('0x1b')](_0xfd65('0x22'),_0x3f8bf7,_0xfd65('0x1c'));_0x4aab14(_0x28ea37[_0xfd65('0x23')][_0xfd65('0x21')]);}})[_0xfd65('0x24')](function(_0x174791){logger[_0xfd65('0x1f')](_0xfd65('0x22'),_0x3f8bf7,_0x174791);_0x4d6702(_0x174791);});});}function respondWithStatusCode(_0x9349ae,_0x17b69a){_0x17b69a=_0x17b69a||0xcc;return function(_0x6beb57){if(_0x6beb57){return _0x9349ae[_0xfd65('0x25')](_0x17b69a);}return _0x9349ae['status'](_0x17b69a)[_0xfd65('0x26')]();};}function respondWithResult(_0x1573cb,_0x3de682){_0x3de682=_0x3de682||0xc8;return function(_0x49d548){if(_0x49d548){return _0x1573cb[_0xfd65('0x27')](_0x3de682)['json'](_0x49d548);}};}function respondWithFilteredResult(_0xc11818,_0x27f9f5){return function(_0x9ee482){if(_0x9ee482){var _0x26e481=typeof _0x27f9f5[_0xfd65('0x28')]===_0xfd65('0x29')&&typeof _0x27f9f5[_0xfd65('0x2a')]==='undefined';var _0x28c1a7=_0x9ee482[_0xfd65('0x2b')];var _0x11d67c=_0x26e481?0x0:_0x27f9f5[_0xfd65('0x28')];var _0x455f8d=_0x26e481?_0x9ee482[_0xfd65('0x2b')]:_0x27f9f5[_0xfd65('0x28')]+_0x27f9f5[_0xfd65('0x2a')];var _0x277615;if(_0x455f8d>=_0x28c1a7){_0x455f8d=_0x28c1a7;_0x277615=0xc8;}else{_0x277615=0xce;}_0xc11818['status'](_0x277615);return _0xc11818[_0xfd65('0x2c')](_0xfd65('0x2d'),_0x11d67c+'-'+_0x455f8d+'/'+_0x28c1a7)['json'](_0x9ee482);}return null;};}function patchUpdates(_0x1edd26){return function(_0x4ca127){try{jsonpatch['apply'](_0x4ca127,_0x1edd26,!![]);}catch(_0x3d79c4){return BPromise[_0xfd65('0x2e')](_0x3d79c4);}return _0x4ca127[_0xfd65('0x2f')]();};}function saveUpdates(_0x545e10,_0x488e31){return function(_0x3bb62b){if(_0x3bb62b){return _0x3bb62b[_0xfd65('0x30')](_0x545e10)[_0xfd65('0x31')](function(_0x9cd101){return _0x9cd101;});}return null;};}function removeEntity(_0x163a84,_0x1b95c3){return function(_0x1608d4){if(_0x1608d4){return _0x1608d4[_0xfd65('0x32')]()[_0xfd65('0x31')](function(){_0x163a84[_0xfd65('0x27')](0xcc)[_0xfd65('0x26')]();});}};}function handleEntityNotFound(_0x37f163,_0x4b7f31){return function(_0x6f3ace){if(!_0x6f3ace){_0x37f163[_0xfd65('0x25')](0x194);}return _0x6f3ace;};}function handleError(_0x222ee2,_0x59b5b7){_0x59b5b7=_0x59b5b7||0x1f4;return function(_0x3cf4fa){logger['error'](_0x3cf4fa['stack']);if(_0x3cf4fa[_0xfd65('0x33')]){delete _0x3cf4fa[_0xfd65('0x33')];}_0x222ee2[_0xfd65('0x27')](_0x59b5b7)[_0xfd65('0x34')](_0x3cf4fa);};}function getMustacheRender(_0x2aab0b,_0x415bbb){return Mustache['render'](_0x2aab0b,_[_0xfd65('0x35')](_0x415bbb[_0xfd65('0x36')],{'contact':_0x415bbb[_0xfd65('0x37')],'message':_0x415bbb[_0xfd65('0x21')],'agent':_0x415bbb[_0xfd65('0x38')],'interaction':_0x415bbb[_0xfd65('0x39')],'account':_0x415bbb['account']}))||'';}exports[_0xfd65('0x3a')]=function(_0xacbdd4,_0x400d6a){var _0x302003={},_0x3996a1={},_0xfb80c3={'count':0x0,'rows':[]};var _0x57104f=_['map'](db[_0xfd65('0x3b')][_0xfd65('0x3c')],function(_0x16ad64){return{'name':_0x16ad64['fieldName'],'type':_0x16ad64[_0xfd65('0x3d')][_0xfd65('0x3e')]};});_0x3996a1['model']=_[_0xfd65('0x3f')](_0x57104f,_0xfd65('0x33'));_0x3996a1[_0xfd65('0x40')]=_['keys'](_0xacbdd4[_0xfd65('0x40')]);_0x3996a1[_0xfd65('0x41')]=_[_0xfd65('0x42')](_0x3996a1['model'],_0x3996a1['query']);_0x302003['attributes']=_[_0xfd65('0x42')](_0x3996a1[_0xfd65('0x43')],qs['fields'](_0xacbdd4['query'][_0xfd65('0x44')]));_0x302003[_0xfd65('0x45')]=_0x302003['attributes'][_0xfd65('0x46')]?_0x302003[_0xfd65('0x45')]:_0x3996a1[_0xfd65('0x43')];if(!_0xacbdd4[_0xfd65('0x40')][_0xfd65('0x47')](_0xfd65('0x48'))){_0x302003[_0xfd65('0x2a')]=qs[_0xfd65('0x2a')](_0xacbdd4[_0xfd65('0x40')][_0xfd65('0x2a')]);_0x302003[_0xfd65('0x28')]=qs['offset'](_0xacbdd4[_0xfd65('0x40')]['offset']);}_0x302003[_0xfd65('0x49')]=qs[_0xfd65('0x4a')](_0xacbdd4[_0xfd65('0x40')][_0xfd65('0x4a')]);_0x302003[_0xfd65('0x4b')]=qs[_0xfd65('0x41')](_[_0xfd65('0x4c')](_0xacbdd4[_0xfd65('0x40')],_0x3996a1[_0xfd65('0x41')]),_0x57104f);if(_0xacbdd4[_0xfd65('0x40')][_0xfd65('0x4d')]){_0x302003[_0xfd65('0x4b')]=_[_0xfd65('0x35')](_0x302003['where'],{'$or':_['map'](_0x57104f,function(_0x410539){if(_0x410539[_0xfd65('0x3d')]!==_0xfd65('0x4e')){var _0x56042f={};_0x56042f[_0x410539[_0xfd65('0x33')]]={'$like':'%'+_0xacbdd4[_0xfd65('0x40')][_0xfd65('0x4d')]+'%'};return _0x56042f;}})});}_0x302003=_[_0xfd65('0x35')]({},_0x302003,_0xacbdd4[_0xfd65('0x4f')]);var _0x552ae2={'where':_0x302003['where']};return db[_0xfd65('0x3b')]['count'](_0x552ae2)[_0xfd65('0x31')](function(_0x581c62){_0xfb80c3[_0xfd65('0x2b')]=_0x581c62;if(_0xacbdd4[_0xfd65('0x40')][_0xfd65('0x50')]){_0x302003['include']=[{'all':!![]}];}return db[_0xfd65('0x3b')][_0xfd65('0x51')](_0x302003);})[_0xfd65('0x31')](function(_0x1f08d8){_0xfb80c3[_0xfd65('0x52')]=_0x1f08d8;return _0xfb80c3;})['then'](respondWithFilteredResult(_0x400d6a,_0x302003))[_0xfd65('0x24')](handleError(_0x400d6a,null));};exports[_0xfd65('0x53')]=function(_0x1cf9c8,_0x349b8c){var _0x4b7f2f={'raw':![],'where':{'id':_0x1cf9c8[_0xfd65('0x54')]['id']}},_0x3803f5={};_0x3803f5[_0xfd65('0x43')]=_['keys'](db[_0xfd65('0x3b')]['rawAttributes']);_0x3803f5[_0xfd65('0x40')]=_[_0xfd65('0x55')](_0x1cf9c8['query']);_0x3803f5[_0xfd65('0x41')]=_['intersection'](_0x3803f5[_0xfd65('0x43')],_0x3803f5['query']);_0x4b7f2f[_0xfd65('0x45')]=_['intersection'](_0x3803f5[_0xfd65('0x43')],qs[_0xfd65('0x44')](_0x1cf9c8['query'][_0xfd65('0x44')]));_0x4b7f2f[_0xfd65('0x45')]=_0x4b7f2f['attributes']['length']?_0x4b7f2f[_0xfd65('0x45')]:_0x3803f5[_0xfd65('0x43')];if(_0x1cf9c8['query'][_0xfd65('0x50')]){_0x4b7f2f[_0xfd65('0x56')]=[{'all':!![]}];}_0x4b7f2f=_[_0xfd65('0x35')]({},_0x4b7f2f,_0x1cf9c8[_0xfd65('0x4f')]);return db[_0xfd65('0x3b')][_0xfd65('0x57')](_0x4b7f2f)[_0xfd65('0x31')](handleEntityNotFound(_0x349b8c,null))[_0xfd65('0x31')](respondWithResult(_0x349b8c,null))[_0xfd65('0x24')](handleError(_0x349b8c,null));};exports['create']=function(_0x3673b8,_0x581764){return db['ZendeskAccount'][_0xfd65('0x58')](_0x3673b8[_0xfd65('0x36')],{})[_0xfd65('0x31')](respondWithResult(_0x581764,0xc9))[_0xfd65('0x24')](handleError(_0x581764,null));};exports[_0xfd65('0x30')]=function(_0x1dd2be,_0xd37411){if(_0x1dd2be[_0xfd65('0x36')]['id']){delete _0x1dd2be[_0xfd65('0x36')]['id'];}return db[_0xfd65('0x3b')]['find']({'where':{'id':_0x1dd2be[_0xfd65('0x54')]['id']}})[_0xfd65('0x31')](handleEntityNotFound(_0xd37411,null))[_0xfd65('0x31')](saveUpdates(_0x1dd2be[_0xfd65('0x36')],null))[_0xfd65('0x31')](respondWithResult(_0xd37411,null))['catch'](handleError(_0xd37411,null));};exports[_0xfd65('0x32')]=function(_0x34f048,_0x488a66){return db[_0xfd65('0x3b')][_0xfd65('0x57')]({'where':{'id':_0x34f048[_0xfd65('0x54')]['id']}})[_0xfd65('0x31')](handleEntityNotFound(_0x488a66,null))['then'](removeEntity(_0x488a66,null))[_0xfd65('0x24')](handleError(_0x488a66,null));};exports['getConfigurations']=function(_0x2ac065,_0x46eda2,_0x2b4374){var _0x4b4674={};var _0x54edc4={};var _0x5e0cc0;var _0x5005a1;return db['ZendeskAccount'][_0xfd65('0x59')]({'where':{'id':_0x2ac065[_0xfd65('0x54')]['id']}})[_0xfd65('0x31')](handleEntityNotFound(_0x46eda2,null))[_0xfd65('0x31')](function(_0x2a3e83){if(_0x2a3e83){_0x5e0cc0=_0x2a3e83;_0x54edc4[_0xfd65('0x43')]=_[_0xfd65('0x55')](db[_0xfd65('0x5a')][_0xfd65('0x3c')]);_0x54edc4['query']=_[_0xfd65('0x55')](_0x2ac065[_0xfd65('0x40')]);_0x54edc4[_0xfd65('0x41')]=_[_0xfd65('0x42')](_0x54edc4[_0xfd65('0x43')],_0x54edc4[_0xfd65('0x40')]);_0x4b4674[_0xfd65('0x45')]=_[_0xfd65('0x42')](_0x54edc4[_0xfd65('0x43')],qs[_0xfd65('0x44')](_0x2ac065[_0xfd65('0x40')][_0xfd65('0x44')]));_0x4b4674['attributes']=_0x4b4674['attributes'][_0xfd65('0x46')]?_0x4b4674['attributes']:_0x54edc4[_0xfd65('0x43')];_0x4b4674[_0xfd65('0x49')]=qs[_0xfd65('0x4a')](_0x2ac065[_0xfd65('0x40')]['sort']);_0x4b4674['where']=qs['filters'](_[_0xfd65('0x4c')](_0x2ac065['query'],_0x54edc4[_0xfd65('0x41')]));if(_0x2ac065['query'][_0xfd65('0x4d')]){_0x4b4674[_0xfd65('0x4b')]=_[_0xfd65('0x35')](_0x4b4674[_0xfd65('0x4b')],{'$or':_[_0xfd65('0x3f')](_0x4b4674['attributes'],function(_0x3ca6dd){var _0x1700fb={};_0x1700fb[_0x3ca6dd]={'$like':'%'+_0x2ac065[_0xfd65('0x40')][_0xfd65('0x4d')]+'%'};return _0x1700fb;})});}_0x4b4674=_[_0xfd65('0x35')]({},_0x4b4674,_0x2ac065[_0xfd65('0x4f')]);return _0x5e0cc0[_0xfd65('0x5b')](_0x4b4674);}})[_0xfd65('0x31')](function(_0x25ed47){if(_0x25ed47){_0x5005a1=_0x25ed47[_0xfd65('0x46')];if(!_0x2ac065[_0xfd65('0x40')][_0xfd65('0x47')](_0xfd65('0x48'))){_0x4b4674[_0xfd65('0x2a')]=qs[_0xfd65('0x2a')](_0x2ac065[_0xfd65('0x40')][_0xfd65('0x2a')]);_0x4b4674['offset']=qs['offset'](_0x2ac065[_0xfd65('0x40')][_0xfd65('0x28')]);}return _0x5e0cc0[_0xfd65('0x5b')](_0x4b4674);}})[_0xfd65('0x31')](function(_0x1c1b8b){if(_0x1c1b8b){return _0x1c1b8b?{'count':_0x5005a1,'rows':_0x1c1b8b}:null;}})[_0xfd65('0x31')](respondWithResult(_0x46eda2,null))[_0xfd65('0x24')](handleError(_0x46eda2,null));};exports[_0xfd65('0x5c')]=function(_0xb967b5,_0x37f838,_0x7aecd6){if(_0xb967b5[_0xfd65('0x36')]['id']){delete _0xb967b5[_0xfd65('0x36')]['id'];}return db[_0xfd65('0x3b')][_0xfd65('0x59')]({'where':{'id':_0xb967b5[_0xfd65('0x54')]['id']}})[_0xfd65('0x31')](handleEntityNotFound(_0x37f838,null))['then'](function(_0x55ffb3){if(_0x55ffb3){_0xb967b5[_0xfd65('0x36')][_0xfd65('0x5d')]=_0x55ffb3['id'];_0xb967b5[_0xfd65('0x36')][_0xfd65('0x5e')]=integrations[_0xfd65('0x5f')](_0xb967b5[_0xfd65('0x36')][_0xfd65('0x60')],_0xb967b5[_0xfd65('0x36')][_0xfd65('0x3d')]);_0xb967b5[_0xfd65('0x36')]['Descriptions']=integrations[_0xfd65('0x61')](_0xb967b5['body'][_0xfd65('0x60')],_0xb967b5[_0xfd65('0x36')][_0xfd65('0x3d')]);return db[_0xfd65('0x5a')][_0xfd65('0x58')](_0xb967b5[_0xfd65('0x36')],{'include':[{'model':db['ZendeskField'],'as':_0xfd65('0x5e')},{'model':db[_0xfd65('0x62')],'as':_0xfd65('0x63')}]});}return null;})['then'](respondWithResult(_0x37f838,null))[_0xfd65('0x24')](handleError(_0x37f838,null));};exports[_0xfd65('0x64')]=function(_0x3527e9,_0x35dbf3,_0x15754a){var _0x366138='';return db[_0xfd65('0x3b')]['findOne']({'where':{'id':_0x3527e9[_0xfd65('0x54')]['id']},'attributes':['id',_0xfd65('0x65'),_0xfd65('0x66'),_0xfd65('0x67'),'authType',_0xfd65('0x68')]})[_0xfd65('0x31')](handleEntityNotFound(_0x35dbf3,null))['then'](function(_0x419ee7){if(_0x419ee7){_0x366138=_0x419ee7[_0xfd65('0x68')];var _0x5d1938=_0x366138[_0xfd65('0x69')](-0x1);if(_0x5d1938==='/'){_0x366138=_0x366138[_0xfd65('0x6a')](0x0,_0x366138[_0xfd65('0x6b')](_0x5d1938));}var _0x4a4bde={'method':_0xfd65('0x6c'),'uri':util[_0xfd65('0x6d')](_0xfd65('0x6e'),_0x366138,_0xfd65('0x6f')),'json':!![]};switch(_0x419ee7[_0xfd65('0x70')]){case _0xfd65('0x66'):_0x4a4bde['headers']={'Authorization':util[_0xfd65('0x6d')](_0xfd65('0x71'),new Buffer(util[_0xfd65('0x6d')](_0xfd65('0x72'),_0x419ee7[_0xfd65('0x65')],_0x419ee7['password']))[_0xfd65('0x73')]('base64'))};break;case _0xfd65('0x67'):_0x4a4bde[_0xfd65('0x74')]={'Authorization':util[_0xfd65('0x6d')](_0xfd65('0x71'),new Buffer(util[_0xfd65('0x6d')](_0xfd65('0x75'),_0x419ee7['username'],_0x419ee7['token']))[_0xfd65('0x73')]('base64'))};break;default:throw new db[(_0xfd65('0x76'))][(_0xfd65('0x77'))](_0xfd65('0x78'));}return rp(_0x4a4bde);}})[_0xfd65('0x31')](function(_0x335b39){if(_0x335b39){var _0x83ef38=[_0xfd65('0x79'),_0xfd65('0x7a'),_0xfd65('0x7b'),_0xfd65('0x7c')];_[_0xfd65('0x7d')](_0x335b39[_0xfd65('0x6f')],function(_0x43ddf9){return _0x83ef38[_0xfd65('0x7e')](_0x43ddf9['type']);});return{'count':_0x335b39[_0xfd65('0x6f')][_0xfd65('0x46')],'rows':_['map'](_0x335b39['ticket_fields'],function(_0x5a55d3){return{'id':_0x5a55d3['id'],'name':_0x5a55d3['position']>0x7?_0x5a55d3[_0xfd65('0x7f')]:_0x5a55d3[_0xfd65('0x3d')],'custom':_0x5a55d3['position']>0x7?!![]:![],'options':_0x5a55d3[_0xfd65('0x80')]?_0x5a55d3['system_field_options']:_0x5a55d3[_0xfd65('0x81')]?_0x5a55d3[_0xfd65('0x81')]:[]};})};}})[_0xfd65('0x31')](respondWithResult(_0x35dbf3,null))[_0xfd65('0x24')](function(_0x14677f){var _0x59ef86=_0x3527e9[_0xfd65('0x40')][_0xfd65('0x82')]?0x1f4:_0x14677f[_0xfd65('0x83')]||0x1f4;logger[_0xfd65('0x1f')](_0xfd65('0x84'),'getFields',_0x59ef86,JSON['stringify'](_0x14677f));delete _0x14677f[_0xfd65('0x33')];if(_0x59ef86===0x191){_0x59ef86=0x190;}_0x35dbf3[_0xfd65('0x27')](_0x59ef86)[_0xfd65('0x34')](_0x3527e9[_0xfd65('0x40')][_0xfd65('0x82')]?{'message':_0xfd65('0x85'),'statusCode':_0x14677f[_0xfd65('0x83')]}:_0x14677f);});}; \ No newline at end of file +var _0xa1db=['pick','length','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','authType','toString','Basic\x20%s','%s/token:%s','base64','Sequelize','ValidationError','subject','description','group','assignee','position','system_field_options','custom_field_options','statusCode','send','test','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','apply','reject','update','destroy','then','stack','name','render','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','ZendeskAccount','create','find','getConfigurations','findOne','ZendeskConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1db,0xb0));var _0xba1d=function(_0x1ebd10,_0x4914b4){_0x1ebd10=_0x1ebd10-0x0;var _0x1004d3=_0xa1db[_0x1ebd10];return _0x1004d3;};'use strict';var emlformat=require(_0xba1d('0x0'));var rimraf=require(_0xba1d('0x1'));var zipdir=require(_0xba1d('0x2'));var jsonpatch=require(_0xba1d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xba1d('0x4'));var Mustache=require(_0xba1d('0x5'));var util=require('util');var path=require(_0xba1d('0x6'));var sox=require(_0xba1d('0x7'));var csv=require(_0xba1d('0x8'));var ejs=require(_0xba1d('0x9'));var fs=require('fs');var fs_extra=require(_0xba1d('0xa'));var _=require(_0xba1d('0xb'));var squel=require(_0xba1d('0xc'));var crypto=require(_0xba1d('0xd'));var jsforce=require(_0xba1d('0xe'));var deskjs=require(_0xba1d('0xf'));var toCsv=require(_0xba1d('0x8'));var querystring=require(_0xba1d('0x10'));var Papa=require(_0xba1d('0x11'));var Redis=require('ioredis');var authService=require(_0xba1d('0x12'));var qs=require(_0xba1d('0x13'));var as=require(_0xba1d('0x14'));var hardwareService=require(_0xba1d('0x15'));var logger=require(_0xba1d('0x16'))(_0xba1d('0x17'));var utils=require(_0xba1d('0x18'));var config=require(_0xba1d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xba1d('0x1a'))['db'];var integrations=require(_0xba1d('0x1b'));var jayson=require(_0xba1d('0x1c'));var client=jayson[_0xba1d('0x1d')][_0xba1d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x539c61,_0x5780cf,_0x2db5ae,_0x36af42){return new BPromise(function(_0x1b2c83,_0xfce76d){var _0x6cb53f=_0x36af42||client;return _0x6cb53f[_0xba1d('0x1f')](_0x539c61,_0x2db5ae)['then'](function(_0x47f4d7){logger[_0xba1d('0x20')](_0xba1d('0x21'),_0x5780cf,_0xba1d('0x22'));logger['debug'](_0xba1d('0x23'),_0x5780cf,_0xba1d('0x22'),JSON[_0xba1d('0x24')](_0x47f4d7));if(_0x47f4d7[_0xba1d('0x25')]){if(_0x47f4d7[_0xba1d('0x25')][_0xba1d('0x26')]===0x1f4){logger['error'](_0xba1d('0x21'),_0x5780cf,_0x47f4d7[_0xba1d('0x25')][_0xba1d('0x27')]);return _0xfce76d(_0x47f4d7[_0xba1d('0x25')][_0xba1d('0x27')]);}logger[_0xba1d('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x5780cf,_0x47f4d7[_0xba1d('0x25')][_0xba1d('0x27')]);return _0x1b2c83(_0x47f4d7[_0xba1d('0x25')][_0xba1d('0x27')]);}else{logger[_0xba1d('0x20')](_0xba1d('0x21'),_0x5780cf,_0xba1d('0x22'));_0x1b2c83(_0x47f4d7[_0xba1d('0x28')][_0xba1d('0x27')]);}})['catch'](function(_0x35d4ba){logger[_0xba1d('0x25')](_0xba1d('0x21'),_0x5780cf,_0x35d4ba);_0xfce76d(_0x35d4ba);});});}function respondWithStatusCode(_0x588839,_0x383d61){_0x383d61=_0x383d61||0xcc;return function(_0x31511b){if(_0x31511b){return _0x588839[_0xba1d('0x29')](_0x383d61);}return _0x588839[_0xba1d('0x2a')](_0x383d61)[_0xba1d('0x2b')]();};}function respondWithResult(_0x8aae1c,_0x628825){_0x628825=_0x628825||0xc8;return function(_0x8e9606){if(_0x8e9606){return _0x8aae1c['status'](_0x628825)['json'](_0x8e9606);}};}function respondWithFilteredResult(_0x2c9b74,_0x5c0e7b){return function(_0x1bfd2d){if(_0x1bfd2d){var _0x479593=typeof _0x5c0e7b['offset']==='undefined'&&typeof _0x5c0e7b[_0xba1d('0x2c')]===_0xba1d('0x2d');var _0x105a78=_0x1bfd2d[_0xba1d('0x2e')];var _0x245f50=_0x479593?0x0:_0x5c0e7b[_0xba1d('0x2f')];var _0x45bc8d=_0x479593?_0x1bfd2d[_0xba1d('0x2e')]:_0x5c0e7b[_0xba1d('0x2f')]+_0x5c0e7b[_0xba1d('0x2c')];var _0x5290d;if(_0x45bc8d>=_0x105a78){_0x45bc8d=_0x105a78;_0x5290d=0xc8;}else{_0x5290d=0xce;}_0x2c9b74[_0xba1d('0x2a')](_0x5290d);return _0x2c9b74['set'](_0xba1d('0x30'),_0x245f50+'-'+_0x45bc8d+'/'+_0x105a78)[_0xba1d('0x31')](_0x1bfd2d);}return null;};}function patchUpdates(_0x4303e8){return function(_0x39b42c){try{jsonpatch[_0xba1d('0x32')](_0x39b42c,_0x4303e8,!![]);}catch(_0x3b5b7b){return BPromise[_0xba1d('0x33')](_0x3b5b7b);}return _0x39b42c['save']();};}function saveUpdates(_0x34b238,_0x4921f5){return function(_0x114956){if(_0x114956){return _0x114956[_0xba1d('0x34')](_0x34b238)['then'](function(_0x478eb8){return _0x478eb8;});}return null;};}function removeEntity(_0x5a402b,_0x21490e){return function(_0x1777c4){if(_0x1777c4){return _0x1777c4[_0xba1d('0x35')]()[_0xba1d('0x36')](function(){_0x5a402b[_0xba1d('0x2a')](0xcc)[_0xba1d('0x2b')]();});}};}function handleEntityNotFound(_0x2afb85,_0x525fd9){return function(_0x7e24cd){if(!_0x7e24cd){_0x2afb85[_0xba1d('0x29')](0x194);}return _0x7e24cd;};}function handleError(_0x51ded1,_0x1bac6c){_0x1bac6c=_0x1bac6c||0x1f4;return function(_0x1425bf){logger[_0xba1d('0x25')](_0x1425bf[_0xba1d('0x37')]);if(_0x1425bf['name']){delete _0x1425bf[_0xba1d('0x38')];}_0x51ded1[_0xba1d('0x2a')](_0x1bac6c)['send'](_0x1425bf);};}function getMustacheRender(_0x3692a7,_0x552c4c){return Mustache[_0xba1d('0x39')](_0x3692a7,_[_0xba1d('0x3a')](_0x552c4c[_0xba1d('0x3b')],{'contact':_0x552c4c[_0xba1d('0x3c')],'message':_0x552c4c['message'],'agent':_0x552c4c[_0xba1d('0x3d')],'interaction':_0x552c4c[_0xba1d('0x3e')],'account':_0x552c4c[_0xba1d('0x3f')]}))||'';}exports[_0xba1d('0x40')]=function(_0x171867,_0x1fe793){var _0x546e30={},_0x28b59d={},_0x5c8fa2={'count':0x0,'rows':[]};var _0x3f1c4a=_[_0xba1d('0x41')](db['ZendeskAccount'][_0xba1d('0x42')],function(_0x61d097){return{'name':_0x61d097[_0xba1d('0x43')],'type':_0x61d097['type'][_0xba1d('0x44')]};});_0x28b59d[_0xba1d('0x45')]=_[_0xba1d('0x41')](_0x3f1c4a,_0xba1d('0x38'));_0x28b59d['query']=_['keys'](_0x171867[_0xba1d('0x46')]);_0x28b59d['filters']=_[_0xba1d('0x47')](_0x28b59d['model'],_0x28b59d[_0xba1d('0x46')]);_0x546e30[_0xba1d('0x48')]=_[_0xba1d('0x47')](_0x28b59d['model'],qs['fields'](_0x171867[_0xba1d('0x46')][_0xba1d('0x49')]));_0x546e30[_0xba1d('0x48')]=_0x546e30[_0xba1d('0x48')]['length']?_0x546e30[_0xba1d('0x48')]:_0x28b59d[_0xba1d('0x45')];if(!_0x171867[_0xba1d('0x46')][_0xba1d('0x4a')]('nolimit')){_0x546e30[_0xba1d('0x2c')]=qs[_0xba1d('0x2c')](_0x171867[_0xba1d('0x46')][_0xba1d('0x2c')]);_0x546e30[_0xba1d('0x2f')]=qs['offset'](_0x171867['query'][_0xba1d('0x2f')]);}_0x546e30[_0xba1d('0x4b')]=qs[_0xba1d('0x4c')](_0x171867[_0xba1d('0x46')][_0xba1d('0x4c')]);_0x546e30[_0xba1d('0x4d')]=qs[_0xba1d('0x4e')](_['pick'](_0x171867[_0xba1d('0x46')],_0x28b59d[_0xba1d('0x4e')]),_0x3f1c4a);if(_0x171867['query'][_0xba1d('0x4f')]){_0x546e30[_0xba1d('0x4d')]=_[_0xba1d('0x3a')](_0x546e30[_0xba1d('0x4d')],{'$or':_[_0xba1d('0x41')](_0x3f1c4a,function(_0x5a0466){if(_0x5a0466['type']!==_0xba1d('0x50')){var _0x274135={};_0x274135[_0x5a0466['name']]={'$like':'%'+_0x171867['query']['filter']+'%'};return _0x274135;}})});}_0x546e30=_[_0xba1d('0x3a')]({},_0x546e30,_0x171867[_0xba1d('0x51')]);var _0x50d202={'where':_0x546e30['where']};return db['ZendeskAccount'][_0xba1d('0x2e')](_0x50d202)[_0xba1d('0x36')](function(_0x88198c){_0x5c8fa2[_0xba1d('0x2e')]=_0x88198c;if(_0x171867[_0xba1d('0x46')][_0xba1d('0x52')]){_0x546e30[_0xba1d('0x53')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xba1d('0x54')](_0x546e30);})[_0xba1d('0x36')](function(_0x413627){_0x5c8fa2[_0xba1d('0x55')]=_0x413627;return _0x5c8fa2;})[_0xba1d('0x36')](respondWithFilteredResult(_0x1fe793,_0x546e30))[_0xba1d('0x56')](handleError(_0x1fe793,null));};exports[_0xba1d('0x57')]=function(_0x4073ef,_0x580688){var _0x8fed14={'raw':![],'where':{'id':_0x4073ef[_0xba1d('0x58')]['id']}},_0x3daecf={};_0x3daecf['model']=_[_0xba1d('0x59')](db[_0xba1d('0x5a')]['rawAttributes']);_0x3daecf[_0xba1d('0x46')]=_['keys'](_0x4073ef[_0xba1d('0x46')]);_0x3daecf[_0xba1d('0x4e')]=_[_0xba1d('0x47')](_0x3daecf[_0xba1d('0x45')],_0x3daecf[_0xba1d('0x46')]);_0x8fed14[_0xba1d('0x48')]=_[_0xba1d('0x47')](_0x3daecf[_0xba1d('0x45')],qs['fields'](_0x4073ef[_0xba1d('0x46')][_0xba1d('0x49')]));_0x8fed14[_0xba1d('0x48')]=_0x8fed14[_0xba1d('0x48')]['length']?_0x8fed14['attributes']:_0x3daecf[_0xba1d('0x45')];if(_0x4073ef[_0xba1d('0x46')][_0xba1d('0x52')]){_0x8fed14[_0xba1d('0x53')]=[{'all':!![]}];}_0x8fed14=_[_0xba1d('0x3a')]({},_0x8fed14,_0x4073ef['options']);return db[_0xba1d('0x5a')]['find'](_0x8fed14)[_0xba1d('0x36')](handleEntityNotFound(_0x580688,null))[_0xba1d('0x36')](respondWithResult(_0x580688,null))[_0xba1d('0x56')](handleError(_0x580688,null));};exports[_0xba1d('0x5b')]=function(_0x2d9f07,_0x2550ca){return db[_0xba1d('0x5a')][_0xba1d('0x5b')](_0x2d9f07[_0xba1d('0x3b')],{})[_0xba1d('0x36')](respondWithResult(_0x2550ca,0xc9))['catch'](handleError(_0x2550ca,null));};exports['update']=function(_0x20aa5a,_0x164725){if(_0x20aa5a[_0xba1d('0x3b')]['id']){delete _0x20aa5a[_0xba1d('0x3b')]['id'];}return db[_0xba1d('0x5a')][_0xba1d('0x5c')]({'where':{'id':_0x20aa5a['params']['id']}})['then'](handleEntityNotFound(_0x164725,null))['then'](saveUpdates(_0x20aa5a[_0xba1d('0x3b')],null))[_0xba1d('0x36')](respondWithResult(_0x164725,null))[_0xba1d('0x56')](handleError(_0x164725,null));};exports[_0xba1d('0x35')]=function(_0x1ac77e,_0x2cc7db){return db[_0xba1d('0x5a')][_0xba1d('0x5c')]({'where':{'id':_0x1ac77e[_0xba1d('0x58')]['id']}})[_0xba1d('0x36')](handleEntityNotFound(_0x2cc7db,null))[_0xba1d('0x36')](removeEntity(_0x2cc7db,null))[_0xba1d('0x56')](handleError(_0x2cc7db,null));};exports[_0xba1d('0x5d')]=function(_0x51f08f,_0xa89a54,_0x2a2671){var _0x1ef726={};var _0x430819={};var _0x3e8086;var _0xaef0e0;return db[_0xba1d('0x5a')][_0xba1d('0x5e')]({'where':{'id':_0x51f08f[_0xba1d('0x58')]['id']}})[_0xba1d('0x36')](handleEntityNotFound(_0xa89a54,null))[_0xba1d('0x36')](function(_0x399083){if(_0x399083){_0x3e8086=_0x399083;_0x430819['model']=_['keys'](db[_0xba1d('0x5f')]['rawAttributes']);_0x430819[_0xba1d('0x46')]=_['keys'](_0x51f08f[_0xba1d('0x46')]);_0x430819[_0xba1d('0x4e')]=_[_0xba1d('0x47')](_0x430819[_0xba1d('0x45')],_0x430819[_0xba1d('0x46')]);_0x1ef726[_0xba1d('0x48')]=_[_0xba1d('0x47')](_0x430819[_0xba1d('0x45')],qs['fields'](_0x51f08f[_0xba1d('0x46')][_0xba1d('0x49')]));_0x1ef726['attributes']=_0x1ef726[_0xba1d('0x48')]['length']?_0x1ef726['attributes']:_0x430819['model'];_0x1ef726['order']=qs[_0xba1d('0x4c')](_0x51f08f[_0xba1d('0x46')][_0xba1d('0x4c')]);_0x1ef726[_0xba1d('0x4d')]=qs['filters'](_[_0xba1d('0x60')](_0x51f08f['query'],_0x430819[_0xba1d('0x4e')]));if(_0x51f08f['query']['filter']){_0x1ef726[_0xba1d('0x4d')]=_[_0xba1d('0x3a')](_0x1ef726[_0xba1d('0x4d')],{'$or':_['map'](_0x1ef726[_0xba1d('0x48')],function(_0x51b79b){var _0x19ac4c={};_0x19ac4c[_0x51b79b]={'$like':'%'+_0x51f08f[_0xba1d('0x46')]['filter']+'%'};return _0x19ac4c;})});}_0x1ef726=_[_0xba1d('0x3a')]({},_0x1ef726,_0x51f08f[_0xba1d('0x51')]);return _0x3e8086['getConfigurations'](_0x1ef726);}})['then'](function(_0x17603e){if(_0x17603e){_0xaef0e0=_0x17603e[_0xba1d('0x61')];if(!_0x51f08f[_0xba1d('0x46')][_0xba1d('0x4a')](_0xba1d('0x62'))){_0x1ef726[_0xba1d('0x2c')]=qs[_0xba1d('0x2c')](_0x51f08f[_0xba1d('0x46')]['limit']);_0x1ef726[_0xba1d('0x2f')]=qs[_0xba1d('0x2f')](_0x51f08f[_0xba1d('0x46')][_0xba1d('0x2f')]);}return _0x3e8086['getConfigurations'](_0x1ef726);}})[_0xba1d('0x36')](function(_0x2087f7){if(_0x2087f7){return _0x2087f7?{'count':_0xaef0e0,'rows':_0x2087f7}:null;}})['then'](respondWithResult(_0xa89a54,null))[_0xba1d('0x56')](handleError(_0xa89a54,null));};exports[_0xba1d('0x63')]=function(_0x51266f,_0x256dd4,_0xcd5756){if(_0x51266f[_0xba1d('0x3b')]['id']){delete _0x51266f[_0xba1d('0x3b')]['id'];}return db['ZendeskAccount'][_0xba1d('0x5e')]({'where':{'id':_0x51266f[_0xba1d('0x58')]['id']}})['then'](handleEntityNotFound(_0x256dd4,null))[_0xba1d('0x36')](function(_0x32d83f){if(_0x32d83f){_0x51266f[_0xba1d('0x3b')][_0xba1d('0x64')]=_0x32d83f['id'];_0x51266f[_0xba1d('0x3b')][_0xba1d('0x65')]=integrations[_0xba1d('0x66')](_0x51266f[_0xba1d('0x3b')][_0xba1d('0x67')],_0x51266f[_0xba1d('0x3b')]['type']);_0x51266f[_0xba1d('0x3b')][_0xba1d('0x68')]=integrations[_0xba1d('0x69')](_0x51266f['body'][_0xba1d('0x67')],_0x51266f[_0xba1d('0x3b')][_0xba1d('0x6a')]);return db[_0xba1d('0x5f')][_0xba1d('0x5b')](_0x51266f[_0xba1d('0x3b')],{'include':[{'model':db[_0xba1d('0x6b')],'as':_0xba1d('0x65')},{'model':db[_0xba1d('0x6b')],'as':_0xba1d('0x68')}]});}return null;})[_0xba1d('0x36')](respondWithResult(_0x256dd4,null))[_0xba1d('0x56')](handleError(_0x256dd4,null));};exports[_0xba1d('0x6c')]=function(_0x59ecdc,_0x43b4ff,_0x5dc9c5){var _0x4b5cc9='';return db[_0xba1d('0x5a')]['findOne']({'where':{'id':_0x59ecdc[_0xba1d('0x58')]['id']},'attributes':['id',_0xba1d('0x6d'),_0xba1d('0x6e'),_0xba1d('0x6f'),'authType',_0xba1d('0x70')]})['then'](handleEntityNotFound(_0x43b4ff,null))[_0xba1d('0x36')](function(_0x35bbbf){if(_0x35bbbf){_0x4b5cc9=_0x35bbbf['remoteUri'];var _0x17d958=_0x4b5cc9[_0xba1d('0x71')](-0x1);if(_0x17d958==='/'){_0x4b5cc9=_0x4b5cc9[_0xba1d('0x72')](0x0,_0x4b5cc9[_0xba1d('0x73')](_0x17d958));}var _0x5ad5d6={'method':_0xba1d('0x74'),'uri':util[_0xba1d('0x75')]('%s/%s',_0x4b5cc9,_0xba1d('0x76')),'json':!![]};switch(_0x35bbbf[_0xba1d('0x77')]){case _0xba1d('0x6e'):_0x5ad5d6['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xba1d('0x75')]('%s:%s',_0x35bbbf[_0xba1d('0x6d')],_0x35bbbf[_0xba1d('0x6e')]))[_0xba1d('0x78')]('base64'))};break;case'token':_0x5ad5d6['headers']={'Authorization':util['format'](_0xba1d('0x79'),new Buffer(util[_0xba1d('0x75')](_0xba1d('0x7a'),_0x35bbbf[_0xba1d('0x6d')],_0x35bbbf[_0xba1d('0x6f')]))['toString'](_0xba1d('0x7b')))};break;default:throw new db[(_0xba1d('0x7c'))][(_0xba1d('0x7d'))]('Unknown\x20authentication\x20type');}return rp(_0x5ad5d6);}})[_0xba1d('0x36')](function(_0x56b281){if(_0x56b281){var _0x5b6748=[_0xba1d('0x7e'),_0xba1d('0x7f'),_0xba1d('0x80'),_0xba1d('0x81')];_['remove'](_0x56b281[_0xba1d('0x76')],function(_0x4712d5){return _0x5b6748['includes'](_0x4712d5[_0xba1d('0x6a')]);});return{'count':_0x56b281[_0xba1d('0x76')]['length'],'rows':_[_0xba1d('0x41')](_0x56b281[_0xba1d('0x76')],function(_0x4be0f9){return{'id':_0x4be0f9['id'],'name':_0x4be0f9[_0xba1d('0x82')]>0x7?_0x4be0f9['title']:_0x4be0f9[_0xba1d('0x6a')],'custom':_0x4be0f9[_0xba1d('0x82')]>0x7?!![]:![],'options':_0x4be0f9['system_field_options']?_0x4be0f9[_0xba1d('0x83')]:_0x4be0f9['custom_field_options']?_0x4be0f9[_0xba1d('0x84')]:[]};})};}})[_0xba1d('0x36')](respondWithResult(_0x43b4ff,null))['catch'](function(_0x593308){var _0x4d0734=_0x59ecdc[_0xba1d('0x46')]['test']?0x1f4:_0x593308[_0xba1d('0x85')]||0x1f4;logger[_0xba1d('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xba1d('0x6c'),_0x4d0734,JSON[_0xba1d('0x24')](_0x593308));delete _0x593308['name'];if(_0x4d0734===0x191){_0x4d0734=0x190;}_0x43b4ff[_0xba1d('0x2a')](_0x4d0734)[_0xba1d('0x86')](_0x59ecdc[_0xba1d('0x46')][_0xba1d('0x87')]?{'message':'Wrong\x20credentials','statusCode':_0x593308[_0xba1d('0x85')]}:_0x593308);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5f29647..5d72f7e 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 _0x2ffc=['../../config/logger','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x2ffc,0xd1));var _0xc2ff=function(_0x27599b,_0x2b8eec){_0x27599b=_0x27599b-0x0;var _0x5be719=_0x2ffc[_0x27599b];return _0x5be719;};'use strict';var _=require(_0xc2ff('0x0'));var util=require('util');var logger=require(_0xc2ff('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc2ff('0x2'));var rp=require(_0xc2ff('0x3'));var fs=require('fs');var path=require(_0xc2ff('0x4'));var rimraf=require('rimraf');var config=require(_0xc2ff('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xc2ff('0x6'));module[_0xc2ff('0x7')]=function(_0x50466f,_0xaeb3b3){return _0x50466f[_0xc2ff('0x8')](_0xc2ff('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x730e=['path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x545231,_0xda8f03){var _0x29542d=function(_0x1d0de0){while(--_0x1d0de0){_0x545231['push'](_0x545231['shift']());}};_0x29542d(++_0xda8f03);}(_0x730e,0x1c3));var _0xe730=function(_0x2a2071,_0x477dfc){_0x2a2071=_0x2a2071-0x0;var _0x25bb7f=_0x730e[_0x2a2071];return _0x25bb7f;};'use strict';var _=require(_0xe730('0x0'));var util=require('util');var logger=require(_0xe730('0x1'))(_0xe730('0x2'));var moment=require(_0xe730('0x3'));var BPromise=require('bluebird');var rp=require(_0xe730('0x4'));var fs=require('fs');var path=require(_0xe730('0x5'));var rimraf=require('rimraf');var config=require(_0xe730('0x6'));var attributes=require(_0xe730('0x7'));var integrations=require(_0xe730('0x8'));module[_0xe730('0x9')]=function(_0x4134f4,_0x4e64e7){return _0x4134f4[_0xe730('0xa')]('ZendeskAccount',attributes,{'tableName':_0xe730('0xb'),'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 665fdb5..a0b3c0d 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 _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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['GetZendeskAccount']=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']('ShowZendeskAccount',_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 _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0xcb91[_0x358806];return _0x19fdcb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 5f2df0c..e5ccc84 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 _0x39dd=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39dd,0x138));var _0xd39d=function(_0x12bee7,_0x1d7e65){_0x12bee7=_0x12bee7-0x0;var _0x2da2db=_0x39dd[_0x12bee7];return _0x2da2db;};'use strict';var multer=require('multer');var util=require(_0xd39d('0x0'));var path=require(_0xd39d('0x1'));var timeout=require('connect-timeout');var express=require(_0xd39d('0x2'));var router=express[_0xd39d('0x3')]();var fs_extra=require(_0xd39d('0x4'));var auth=require(_0xd39d('0x5'));var interaction=require(_0xd39d('0x6'));var config=require(_0xd39d('0x7'));var controller=require(_0xd39d('0x8'));router[_0xd39d('0x9')]('/',auth[_0xd39d('0xa')](),controller[_0xd39d('0xb')]);router[_0xd39d('0x9')](_0xd39d('0xc'),auth[_0xd39d('0xa')](),controller[_0xd39d('0xd')]);router[_0xd39d('0x9')]('/:id/fields',auth[_0xd39d('0xa')](),controller['getFields']);router['get'](_0xd39d('0xe'),auth[_0xd39d('0xa')](),controller[_0xd39d('0xf')]);router[_0xd39d('0x9')](_0xd39d('0x10'),auth[_0xd39d('0xa')](),controller[_0xd39d('0x11')]);router[_0xd39d('0x9')](_0xd39d('0x12'),auth[_0xd39d('0xa')](),controller[_0xd39d('0x13')]);router['post']('/',auth[_0xd39d('0xa')](),controller['create']);router[_0xd39d('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd39d('0x15')]);router[_0xd39d('0x16')]('/:id',auth[_0xd39d('0xa')](),controller['update']);router[_0xd39d('0x17')](_0xd39d('0xc'),auth['isAuthenticated'](),controller[_0xd39d('0x18')]);module[_0xd39d('0x19')]=router; \ No newline at end of file +var _0xde75=['isAuthenticated','show','getSubjects','getDescriptions','getTags','post','create','/:id/tags','put','update','delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x4a4b80,_0x3f98da){var _0x521dba=function(_0x4b4e7e){while(--_0x4b4e7e){_0x4a4b80['push'](_0x4a4b80['shift']());}};_0x521dba(++_0x3f98da);}(_0xde75,0x161));var _0x5de7=function(_0x3c7f78,_0x3f1df0){_0x3c7f78=_0x3c7f78-0x0;var _0x31f960=_0xde75[_0x3c7f78];return _0x31f960;};'use strict';var multer=require(_0x5de7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5de7('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x5de7('0x2'));var interaction=require(_0x5de7('0x3'));var config=require('../../config/environment');var controller=require('./intZendeskConfiguration.controller');router[_0x5de7('0x4')]('/',auth['isAuthenticated'](),controller[_0x5de7('0x5')]);router[_0x5de7('0x4')](_0x5de7('0x6'),auth[_0x5de7('0x7')](),controller[_0x5de7('0x8')]);router['get']('/:id/fields',auth[_0x5de7('0x7')](),controller['getFields']);router[_0x5de7('0x4')]('/:id/subjects',auth[_0x5de7('0x7')](),controller[_0x5de7('0x9')]);router[_0x5de7('0x4')]('/:id/descriptions',auth[_0x5de7('0x7')](),controller[_0x5de7('0xa')]);router['get']('/:id/tags',auth[_0x5de7('0x7')](),controller[_0x5de7('0xb')]);router[_0x5de7('0xc')]('/',auth[_0x5de7('0x7')](),controller[_0x5de7('0xd')]);router[_0x5de7('0xc')](_0x5de7('0xe'),auth['isAuthenticated'](),controller['setTags']);router[_0x5de7('0xf')](_0x5de7('0x6'),auth[_0x5de7('0x7')](),controller[_0x5de7('0x10')]);router[_0x5de7('0x11')](_0x5de7('0x6'),auth['isAuthenticated'](),controller[_0x5de7('0x12')]);module[_0x5de7('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a747674..503784f 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 _0xb2a9=['exports','STRING','sequelize'];(function(_0x331c08,_0x516d1a){var _0x57363a=function(_0x4ad18f){while(--_0x4ad18f){_0x331c08['push'](_0x331c08['shift']());}};_0x57363a(++_0x516d1a);}(_0xb2a9,0x6e));var _0x9b2a=function(_0x19a007,_0x3d00e8){_0x19a007=_0x19a007-0x0;var _0x31499a=_0xb2a9[_0x19a007];return _0x31499a;};'use strict';var Sequelize=require(_0x9b2a('0x0'));module[_0x9b2a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9b2a('0x2')]}}; \ No newline at end of file +var _0xb519=['STRING'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xb519,0x16a));var _0x9b51=function(_0x5b989e,_0x4e28f9){_0x5b989e=_0x5b989e-0x0;var _0x36f054=_0xb519[_0x5b989e];return _0x36f054;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9b51('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 9c75908..45f2a04 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 _0xf57a=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','save','update','name','render','merge','contact','interaction','account','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','params','destroy','find','ZendeskField','getFields','hasOwnProperty','nolimit','getSubjects','getDescriptions','findOne','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x570f21,_0x3799cb){var _0x405e57=function(_0xecb72f){while(--_0xecb72f){_0x570f21['push'](_0x570f21['shift']());}};_0x405e57(++_0x3799cb);}(_0xf57a,0x179));var _0xaf57=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xf57a[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0xaf57('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf57('0x1'));var rp=require(_0xaf57('0x2'));var moment=require(_0xaf57('0x3'));var BPromise=require(_0xaf57('0x4'));var Mustache=require(_0xaf57('0x5'));var util=require(_0xaf57('0x6'));var path=require(_0xaf57('0x7'));var sox=require('sox');var csv=require(_0xaf57('0x8'));var ejs=require(_0xaf57('0x9'));var fs=require('fs');var fs_extra=require(_0xaf57('0xa'));var _=require('lodash');var squel=require(_0xaf57('0xb'));var crypto=require(_0xaf57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaf57('0xd'));var toCsv=require(_0xaf57('0x8'));var querystring=require(_0xaf57('0xe'));var Papa=require(_0xaf57('0xf'));var Redis=require(_0xaf57('0x10'));var authService=require(_0xaf57('0x11'));var qs=require(_0xaf57('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf57('0x13'))(_0xaf57('0x14'));var utils=require(_0xaf57('0x15'));var config=require(_0xaf57('0x16'));var licenseUtil=require(_0xaf57('0x17'));var db=require(_0xaf57('0x18'))['db'];var jayson=require(_0xaf57('0x19'));var client=jayson['client'][_0xaf57('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3c16c0,_0x26f797,_0x2ba719,_0x49db5e){return new BPromise(function(_0x53a133,_0x50c8db){var _0x5a19ed=_0x49db5e||client;return _0x5a19ed['request'](_0x3c16c0,_0x2ba719)[_0xaf57('0x1b')](function(_0x2cfd81){logger[_0xaf57('0x1c')](_0xaf57('0x1d'),_0x26f797,_0xaf57('0x1e'));logger['debug'](_0xaf57('0x1f'),_0x26f797,_0xaf57('0x1e'),JSON[_0xaf57('0x20')](_0x2cfd81));if(_0x2cfd81[_0xaf57('0x21')]){if(_0x2cfd81[_0xaf57('0x21')][_0xaf57('0x22')]===0x1f4){logger[_0xaf57('0x21')](_0xaf57('0x1d'),_0x26f797,_0x2cfd81['error'][_0xaf57('0x23')]);return _0x50c8db(_0x2cfd81[_0xaf57('0x21')][_0xaf57('0x23')]);}logger[_0xaf57('0x21')](_0xaf57('0x1d'),_0x26f797,_0x2cfd81[_0xaf57('0x21')][_0xaf57('0x23')]);return _0x53a133(_0x2cfd81['error'][_0xaf57('0x23')]);}else{logger[_0xaf57('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x26f797,_0xaf57('0x1e'));_0x53a133(_0x2cfd81[_0xaf57('0x24')]['message']);}})['catch'](function(_0x96991f){logger[_0xaf57('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x26f797,_0x96991f);_0x50c8db(_0x96991f);});});}function respondWithStatusCode(_0x17009e,_0x3bba64){_0x3bba64=_0x3bba64||0xcc;return function(_0x829713){if(_0x829713){return _0x17009e[_0xaf57('0x25')](_0x3bba64);}return _0x17009e[_0xaf57('0x26')](_0x3bba64)['end']();};}function respondWithResult(_0x25723b,_0x13396c){_0x13396c=_0x13396c||0xc8;return function(_0x4628e8){if(_0x4628e8){return _0x25723b[_0xaf57('0x26')](_0x13396c)['json'](_0x4628e8);}};}function respondWithFilteredResult(_0x2c1826,_0x3cd27e){return function(_0x407524){if(_0x407524){var _0x269c77=typeof _0x3cd27e[_0xaf57('0x27')]==='undefined'&&typeof _0x3cd27e[_0xaf57('0x28')]===_0xaf57('0x29');var _0x5b264f=_0x407524[_0xaf57('0x2a')];var _0x8d2ec1=_0x269c77?0x0:_0x3cd27e[_0xaf57('0x27')];var _0x30d37a=_0x269c77?_0x407524['count']:_0x3cd27e['offset']+_0x3cd27e['limit'];var _0x574f05;if(_0x30d37a>=_0x5b264f){_0x30d37a=_0x5b264f;_0x574f05=0xc8;}else{_0x574f05=0xce;}_0x2c1826[_0xaf57('0x26')](_0x574f05);return _0x2c1826[_0xaf57('0x2b')]('Content-Range',_0x8d2ec1+'-'+_0x30d37a+'/'+_0x5b264f)[_0xaf57('0x2c')](_0x407524);}return null;};}function patchUpdates(_0x4c1101){return function(_0x15b139){try{jsonpatch[_0xaf57('0x2d')](_0x15b139,_0x4c1101,!![]);}catch(_0x28174a){return BPromise[_0xaf57('0x2e')](_0x28174a);}return _0x15b139[_0xaf57('0x2f')]();};}function saveUpdates(_0x3c1fb5,_0x1e6af0){return function(_0x59b3e6){if(_0x59b3e6){return _0x59b3e6[_0xaf57('0x30')](_0x3c1fb5)['then'](function(_0x1a770b){return _0x1a770b;});}return null;};}function removeEntity(_0x7668fe,_0x108008){return function(_0x5238d2){if(_0x5238d2){return _0x5238d2['destroy']()[_0xaf57('0x1b')](function(){_0x7668fe[_0xaf57('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ebc3,_0x89e0f0){return function(_0x1d9439){if(!_0x1d9439){_0x55ebc3['sendStatus'](0x194);}return _0x1d9439;};}function handleError(_0x114611,_0x388986){_0x388986=_0x388986||0x1f4;return function(_0x58f2a1){logger[_0xaf57('0x21')](_0x58f2a1['stack']);if(_0x58f2a1[_0xaf57('0x31')]){delete _0x58f2a1[_0xaf57('0x31')];}_0x114611[_0xaf57('0x26')](_0x388986)['send'](_0x58f2a1);};}function getMustacheRender(_0x475d43,_0xbeaac){return Mustache[_0xaf57('0x32')](_0x475d43,_[_0xaf57('0x33')](_0xbeaac['body'],{'contact':_0xbeaac[_0xaf57('0x34')],'message':_0xbeaac[_0xaf57('0x23')],'agent':_0xbeaac['agent'],'interaction':_0xbeaac[_0xaf57('0x35')],'account':_0xbeaac[_0xaf57('0x36')]}))||'';}exports[_0xaf57('0x37')]=function(_0x48375e,_0x5aa470){var _0x3decba={},_0x5cfc49={},_0x83d5cf={'count':0x0,'rows':[]};var _0x58f11a=_[_0xaf57('0x38')](db[_0xaf57('0x39')][_0xaf57('0x3a')],function(_0xaaca88){return{'name':_0xaaca88['fieldName'],'type':_0xaaca88[_0xaf57('0x3b')][_0xaf57('0x3c')]};});_0x5cfc49[_0xaf57('0x3d')]=_[_0xaf57('0x38')](_0x58f11a,_0xaf57('0x31'));_0x5cfc49[_0xaf57('0x3e')]=_[_0xaf57('0x3f')](_0x48375e[_0xaf57('0x3e')]);_0x5cfc49[_0xaf57('0x40')]=_['intersection'](_0x5cfc49['model'],_0x5cfc49['query']);_0x3decba[_0xaf57('0x41')]=_[_0xaf57('0x42')](_0x5cfc49[_0xaf57('0x3d')],qs[_0xaf57('0x43')](_0x48375e['query'][_0xaf57('0x43')]));_0x3decba[_0xaf57('0x41')]=_0x3decba[_0xaf57('0x41')][_0xaf57('0x44')]?_0x3decba[_0xaf57('0x41')]:_0x5cfc49[_0xaf57('0x3d')];if(!_0x48375e['query']['hasOwnProperty']('nolimit')){_0x3decba[_0xaf57('0x28')]=qs['limit'](_0x48375e['query'][_0xaf57('0x28')]);_0x3decba[_0xaf57('0x27')]=qs['offset'](_0x48375e['query'][_0xaf57('0x27')]);}_0x3decba[_0xaf57('0x45')]=qs['sort'](_0x48375e['query'][_0xaf57('0x46')]);_0x3decba[_0xaf57('0x47')]=qs[_0xaf57('0x40')](_[_0xaf57('0x48')](_0x48375e[_0xaf57('0x3e')],_0x5cfc49[_0xaf57('0x40')]),_0x58f11a);if(_0x48375e[_0xaf57('0x3e')][_0xaf57('0x49')]){_0x3decba[_0xaf57('0x47')]=_[_0xaf57('0x33')](_0x3decba[_0xaf57('0x47')],{'$or':_[_0xaf57('0x38')](_0x58f11a,function(_0x74c3bd){if(_0x74c3bd[_0xaf57('0x3b')]!==_0xaf57('0x4a')){var _0x2575ac={};_0x2575ac[_0x74c3bd[_0xaf57('0x31')]]={'$like':'%'+_0x48375e['query']['filter']+'%'};return _0x2575ac;}})});}_0x3decba=_[_0xaf57('0x33')]({},_0x3decba,_0x48375e[_0xaf57('0x4b')]);var _0x27205a={'where':_0x3decba[_0xaf57('0x47')]};return db['ZendeskConfiguration'][_0xaf57('0x2a')](_0x27205a)[_0xaf57('0x1b')](function(_0x5277f1){_0x83d5cf['count']=_0x5277f1;if(_0x48375e[_0xaf57('0x3e')][_0xaf57('0x4c')]){_0x3decba[_0xaf57('0x4d')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xaf57('0x4e')](_0x3decba);})[_0xaf57('0x1b')](function(_0x5af57c){_0x83d5cf[_0xaf57('0x4f')]=_0x5af57c;return _0x83d5cf;})[_0xaf57('0x1b')](respondWithFilteredResult(_0x5aa470,_0x3decba))[_0xaf57('0x50')](handleError(_0x5aa470,null));};exports[_0xaf57('0x51')]=function(_0x2fbcc7,_0x3052e5){var _0x4dfa20={'raw':![],'where':{'id':_0x2fbcc7['params']['id']}},_0x27c78e={};_0x27c78e['model']=_[_0xaf57('0x3f')](db[_0xaf57('0x39')][_0xaf57('0x3a')]);_0x27c78e[_0xaf57('0x3e')]=_[_0xaf57('0x3f')](_0x2fbcc7[_0xaf57('0x3e')]);_0x27c78e[_0xaf57('0x40')]=_[_0xaf57('0x42')](_0x27c78e[_0xaf57('0x3d')],_0x27c78e[_0xaf57('0x3e')]);_0x4dfa20['attributes']=_['intersection'](_0x27c78e[_0xaf57('0x3d')],qs['fields'](_0x2fbcc7[_0xaf57('0x3e')]['fields']));_0x4dfa20[_0xaf57('0x41')]=_0x4dfa20[_0xaf57('0x41')][_0xaf57('0x44')]?_0x4dfa20[_0xaf57('0x41')]:_0x27c78e[_0xaf57('0x3d')];if(_0x2fbcc7[_0xaf57('0x3e')][_0xaf57('0x4c')]){_0x4dfa20['include']=[{'all':!![]}];}_0x4dfa20=_[_0xaf57('0x33')]({},_0x4dfa20,_0x2fbcc7[_0xaf57('0x4b')]);return db[_0xaf57('0x39')]['find'](_0x4dfa20)[_0xaf57('0x1b')](handleEntityNotFound(_0x3052e5,null))[_0xaf57('0x1b')](respondWithResult(_0x3052e5,null))['catch'](handleError(_0x3052e5,null));};exports[_0xaf57('0x52')]=function(_0xb8e8a4,_0x4d2d96){return db[_0xaf57('0x39')][_0xaf57('0x52')](_0xb8e8a4[_0xaf57('0x53')],{})[_0xaf57('0x1b')](respondWithResult(_0x4d2d96,0xc9))['catch'](handleError(_0x4d2d96,null));};exports[_0xaf57('0x30')]=function(_0x55b854,_0x1784de){if(_0x55b854[_0xaf57('0x53')]['id']){delete _0x55b854[_0xaf57('0x53')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x55b854[_0xaf57('0x54')]['id']}})[_0xaf57('0x1b')](handleEntityNotFound(_0x1784de,null))['then'](saveUpdates(_0x55b854[_0xaf57('0x53')],null))['then'](respondWithResult(_0x1784de,null))[_0xaf57('0x50')](handleError(_0x1784de,null));};exports[_0xaf57('0x55')]=function(_0x4d0f92,_0x2165b2){return db['ZendeskConfiguration'][_0xaf57('0x56')]({'where':{'id':_0x4d0f92['params']['id']}})['then'](handleEntityNotFound(_0x2165b2,null))[_0xaf57('0x1b')](removeEntity(_0x2165b2,null))[_0xaf57('0x50')](handleError(_0x2165b2,null));};exports['getFields']=function(_0x2aaa49,_0x19cf60,_0x3cebc5){var _0xdec9bf={};var _0x29dd70={};var _0x5bcd4b;var _0xcb5c26;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2aaa49[_0xaf57('0x54')]['id']}})['then'](handleEntityNotFound(_0x19cf60,null))['then'](function(_0x8d3e08){if(_0x8d3e08){_0x5bcd4b=_0x8d3e08;_0x29dd70[_0xaf57('0x3d')]=_['keys'](db[_0xaf57('0x57')]['rawAttributes']);_0x29dd70['query']=_[_0xaf57('0x3f')](_0x2aaa49[_0xaf57('0x3e')]);_0x29dd70[_0xaf57('0x40')]=_[_0xaf57('0x42')](_0x29dd70['model'],_0x29dd70['query']);_0xdec9bf[_0xaf57('0x41')]=_[_0xaf57('0x42')](_0x29dd70[_0xaf57('0x3d')],qs[_0xaf57('0x43')](_0x2aaa49[_0xaf57('0x3e')]['fields']));_0xdec9bf[_0xaf57('0x41')]=_0xdec9bf[_0xaf57('0x41')][_0xaf57('0x44')]?_0xdec9bf[_0xaf57('0x41')]:_0x29dd70[_0xaf57('0x3d')];_0xdec9bf[_0xaf57('0x45')]=qs[_0xaf57('0x46')](_0x2aaa49[_0xaf57('0x3e')]['sort']);_0xdec9bf[_0xaf57('0x47')]=qs['filters'](_[_0xaf57('0x48')](_0x2aaa49['query'],_0x29dd70['filters']));if(_0x2aaa49['query'][_0xaf57('0x49')]){_0xdec9bf['where']=_['merge'](_0xdec9bf[_0xaf57('0x47')],{'$or':_[_0xaf57('0x38')](_0xdec9bf['attributes'],function(_0x300d97){var _0x345e8f={};_0x345e8f[_0x300d97]={'$like':'%'+_0x2aaa49['query'][_0xaf57('0x49')]+'%'};return _0x345e8f;})});}_0xdec9bf=_['merge']({},_0xdec9bf,_0x2aaa49['options']);return _0x5bcd4b[_0xaf57('0x58')](_0xdec9bf);}})[_0xaf57('0x1b')](function(_0x5ee9d9){if(_0x5ee9d9){_0xcb5c26=_0x5ee9d9[_0xaf57('0x44')];if(!_0x2aaa49[_0xaf57('0x3e')][_0xaf57('0x59')](_0xaf57('0x5a'))){_0xdec9bf['limit']=qs[_0xaf57('0x28')](_0x2aaa49['query'][_0xaf57('0x28')]);_0xdec9bf['offset']=qs['offset'](_0x2aaa49[_0xaf57('0x3e')][_0xaf57('0x27')]);}return _0x5bcd4b[_0xaf57('0x58')](_0xdec9bf);}})[_0xaf57('0x1b')](function(_0x4102f6){if(_0x4102f6){return _0x4102f6?{'count':_0xcb5c26,'rows':_0x4102f6}:null;}})[_0xaf57('0x1b')](respondWithResult(_0x19cf60,null))[_0xaf57('0x50')](handleError(_0x19cf60,null));};exports['getSubjects']=function(_0x5404dc,_0x51831e,_0x5ae765){var _0x5e70fe={};var _0x2b9eda={};var _0x12f4de;var _0x59ec1f;return db[_0xaf57('0x39')]['findOne']({'where':{'id':_0x5404dc[_0xaf57('0x54')]['id']}})['then'](handleEntityNotFound(_0x51831e,null))[_0xaf57('0x1b')](function(_0x1c94db){if(_0x1c94db){_0x12f4de=_0x1c94db;_0x2b9eda[_0xaf57('0x3d')]=_[_0xaf57('0x3f')](db[_0xaf57('0x57')]['rawAttributes']);_0x2b9eda[_0xaf57('0x3e')]=_[_0xaf57('0x3f')](_0x5404dc[_0xaf57('0x3e')]);_0x2b9eda[_0xaf57('0x40')]=_[_0xaf57('0x42')](_0x2b9eda[_0xaf57('0x3d')],_0x2b9eda['query']);_0x5e70fe[_0xaf57('0x41')]=_[_0xaf57('0x42')](_0x2b9eda['model'],qs[_0xaf57('0x43')](_0x5404dc[_0xaf57('0x3e')][_0xaf57('0x43')]));_0x5e70fe[_0xaf57('0x41')]=_0x5e70fe[_0xaf57('0x41')][_0xaf57('0x44')]?_0x5e70fe[_0xaf57('0x41')]:_0x2b9eda[_0xaf57('0x3d')];_0x5e70fe[_0xaf57('0x45')]=qs['sort'](_0x5404dc[_0xaf57('0x3e')][_0xaf57('0x46')]);_0x5e70fe[_0xaf57('0x47')]=qs[_0xaf57('0x40')](_[_0xaf57('0x48')](_0x5404dc['query'],_0x2b9eda[_0xaf57('0x40')]));if(_0x5404dc[_0xaf57('0x3e')][_0xaf57('0x49')]){_0x5e70fe['where']=_[_0xaf57('0x33')](_0x5e70fe['where'],{'$or':_['map'](_0x5e70fe['attributes'],function(_0x3fab02){var _0x21d731={};_0x21d731[_0x3fab02]={'$like':'%'+_0x5404dc[_0xaf57('0x3e')][_0xaf57('0x49')]+'%'};return _0x21d731;})});}_0x5e70fe=_[_0xaf57('0x33')]({},_0x5e70fe,_0x5404dc[_0xaf57('0x4b')]);return _0x12f4de['getSubjects'](_0x5e70fe);}})[_0xaf57('0x1b')](function(_0x250996){if(_0x250996){_0x59ec1f=_0x250996['length'];if(!_0x5404dc[_0xaf57('0x3e')][_0xaf57('0x59')](_0xaf57('0x5a'))){_0x5e70fe[_0xaf57('0x28')]=qs[_0xaf57('0x28')](_0x5404dc[_0xaf57('0x3e')][_0xaf57('0x28')]);_0x5e70fe[_0xaf57('0x27')]=qs[_0xaf57('0x27')](_0x5404dc[_0xaf57('0x3e')][_0xaf57('0x27')]);}return _0x12f4de[_0xaf57('0x5b')](_0x5e70fe);}})['then'](function(_0x2f8154){if(_0x2f8154){return _0x2f8154?{'count':_0x59ec1f,'rows':_0x2f8154}:null;}})['then'](respondWithResult(_0x51831e,null))['catch'](handleError(_0x51831e,null));};exports[_0xaf57('0x5c')]=function(_0x47b2d8,_0x38d6bd,_0x41914b){var _0x139f1c={};var _0x379c48={};var _0x2924a8;var _0x182b49;return db[_0xaf57('0x39')][_0xaf57('0x5d')]({'where':{'id':_0x47b2d8[_0xaf57('0x54')]['id']}})[_0xaf57('0x1b')](handleEntityNotFound(_0x38d6bd,null))[_0xaf57('0x1b')](function(_0x2695ae){if(_0x2695ae){_0x2924a8=_0x2695ae;_0x379c48[_0xaf57('0x3d')]=_[_0xaf57('0x3f')](db['ZendeskField']['rawAttributes']);_0x379c48[_0xaf57('0x3e')]=_['keys'](_0x47b2d8[_0xaf57('0x3e')]);_0x379c48[_0xaf57('0x40')]=_['intersection'](_0x379c48['model'],_0x379c48[_0xaf57('0x3e')]);_0x139f1c[_0xaf57('0x41')]=_['intersection'](_0x379c48['model'],qs[_0xaf57('0x43')](_0x47b2d8[_0xaf57('0x3e')][_0xaf57('0x43')]));_0x139f1c['attributes']=_0x139f1c[_0xaf57('0x41')][_0xaf57('0x44')]?_0x139f1c[_0xaf57('0x41')]:_0x379c48[_0xaf57('0x3d')];_0x139f1c[_0xaf57('0x45')]=qs[_0xaf57('0x46')](_0x47b2d8[_0xaf57('0x3e')][_0xaf57('0x46')]);_0x139f1c['where']=qs[_0xaf57('0x40')](_['pick'](_0x47b2d8[_0xaf57('0x3e')],_0x379c48[_0xaf57('0x40')]));if(_0x47b2d8['query'][_0xaf57('0x49')]){_0x139f1c[_0xaf57('0x47')]=_[_0xaf57('0x33')](_0x139f1c[_0xaf57('0x47')],{'$or':_[_0xaf57('0x38')](_0x139f1c[_0xaf57('0x41')],function(_0x1aee05){var _0x6f141f={};_0x6f141f[_0x1aee05]={'$like':'%'+_0x47b2d8[_0xaf57('0x3e')]['filter']+'%'};return _0x6f141f;})});}_0x139f1c=_['merge']({},_0x139f1c,_0x47b2d8['options']);return _0x2924a8[_0xaf57('0x5c')](_0x139f1c);}})[_0xaf57('0x1b')](function(_0x4f75c5){if(_0x4f75c5){_0x182b49=_0x4f75c5[_0xaf57('0x44')];if(!_0x47b2d8[_0xaf57('0x3e')][_0xaf57('0x59')](_0xaf57('0x5a'))){_0x139f1c[_0xaf57('0x28')]=qs['limit'](_0x47b2d8['query'][_0xaf57('0x28')]);_0x139f1c[_0xaf57('0x27')]=qs[_0xaf57('0x27')](_0x47b2d8[_0xaf57('0x3e')][_0xaf57('0x27')]);}return _0x2924a8[_0xaf57('0x5c')](_0x139f1c);}})[_0xaf57('0x1b')](function(_0x14b5c1){if(_0x14b5c1){return _0x14b5c1?{'count':_0x182b49,'rows':_0x14b5c1}:null;}})['then'](respondWithResult(_0x38d6bd,null))['catch'](handleError(_0x38d6bd,null));};exports['getTags']=function(_0x4333eb,_0xd4186f,_0x20f15b){var _0x367d69={};var _0x3c3745={};var _0x313378;var _0x26d58d;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4333eb[_0xaf57('0x54')]['id']}})['then'](handleEntityNotFound(_0xd4186f,null))['then'](function(_0x1c1c8d){if(_0x1c1c8d){_0x313378=_0x1c1c8d;_0x3c3745[_0xaf57('0x3d')]=_[_0xaf57('0x3f')](db[_0xaf57('0x5e')][_0xaf57('0x3a')]);_0x3c3745[_0xaf57('0x3e')]=_['keys'](_0x4333eb['query']);_0x3c3745[_0xaf57('0x40')]=_[_0xaf57('0x42')](_0x3c3745[_0xaf57('0x3d')],_0x3c3745[_0xaf57('0x3e')]);_0x367d69[_0xaf57('0x41')]=_['intersection'](_0x3c3745['model'],qs[_0xaf57('0x43')](_0x4333eb[_0xaf57('0x3e')][_0xaf57('0x43')]));_0x367d69[_0xaf57('0x41')]=_0x367d69['attributes']['length']?_0x367d69[_0xaf57('0x41')]:_0x3c3745[_0xaf57('0x3d')];_0x367d69['order']=qs[_0xaf57('0x46')](_0x4333eb[_0xaf57('0x3e')]['sort']);_0x367d69[_0xaf57('0x47')]=qs[_0xaf57('0x40')](_[_0xaf57('0x48')](_0x4333eb[_0xaf57('0x3e')],_0x3c3745[_0xaf57('0x40')]));if(_0x4333eb[_0xaf57('0x3e')][_0xaf57('0x49')]){_0x367d69[_0xaf57('0x47')]=_[_0xaf57('0x33')](_0x367d69[_0xaf57('0x47')],{'$or':_[_0xaf57('0x38')](_0x367d69[_0xaf57('0x41')],function(_0x88044e){var _0x4f3901={};_0x4f3901[_0x88044e]={'$like':'%'+_0x4333eb[_0xaf57('0x3e')][_0xaf57('0x49')]+'%'};return _0x4f3901;})});}_0x367d69=_[_0xaf57('0x33')]({},_0x367d69,_0x4333eb[_0xaf57('0x4b')]);return _0x313378[_0xaf57('0x5f')](_0x367d69);}})['then'](function(_0x4aa316){if(_0x4aa316){_0x26d58d=_0x4aa316[_0xaf57('0x44')];if(!_0x4333eb['query']['hasOwnProperty'](_0xaf57('0x5a'))){_0x367d69['limit']=qs[_0xaf57('0x28')](_0x4333eb[_0xaf57('0x3e')][_0xaf57('0x28')]);_0x367d69['offset']=qs['offset'](_0x4333eb[_0xaf57('0x3e')][_0xaf57('0x27')]);}return _0x313378[_0xaf57('0x5f')](_0x367d69);}})[_0xaf57('0x1b')](function(_0x2ba2a3){if(_0x2ba2a3){return _0x2ba2a3?{'count':_0x26d58d,'rows':_0x2ba2a3}:null;}})[_0xaf57('0x1b')](respondWithResult(_0xd4186f,null))[_0xaf57('0x50')](handleError(_0xd4186f,null));};exports[_0xaf57('0x60')]=function(_0x2a4252,_0x78e91f,_0x2d931d){if(_0x2a4252[_0xaf57('0x53')]['id']){delete _0x2a4252['body']['id'];}return db[_0xaf57('0x39')][_0xaf57('0x5d')]({'where':{'id':_0x2a4252[_0xaf57('0x54')]['id']}})[_0xaf57('0x1b')](handleEntityNotFound(_0x78e91f,null))[_0xaf57('0x1b')](function(_0x4a7adf){if(_0x4a7adf){return _0x4a7adf[_0xaf57('0x60')](_0x2a4252['body'][_0xaf57('0x61')]||[]);}return null;})[_0xaf57('0x1b')](respondWithResult(_0x78e91f,null))['catch'](handleError(_0x78e91f,null));}; \ No newline at end of file +var _0x0e0d=['getSubjects','getDescriptions','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','body','agent','interaction','account','index','map','ZendeskConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','rawAttributes','keys','length','options','create','find','params','getFields','findOne','ZendeskField'];(function(_0x1c16d3,_0x118e14){var _0x2b300f=function(_0x28f839){while(--_0x28f839){_0x1c16d3['push'](_0x1c16d3['shift']());}};_0x2b300f(++_0x118e14);}(_0x0e0d,0x64));var _0xd0e0=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x0e0d[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xd0e0('0x0'));var rimraf=require(_0xd0e0('0x1'));var zipdir=require(_0xd0e0('0x2'));var jsonpatch=require(_0xd0e0('0x3'));var rp=require(_0xd0e0('0x4'));var moment=require(_0xd0e0('0x5'));var BPromise=require(_0xd0e0('0x6'));var Mustache=require(_0xd0e0('0x7'));var util=require(_0xd0e0('0x8'));var path=require(_0xd0e0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0e0('0xa'));var _=require('lodash');var squel=require(_0xd0e0('0xb'));var crypto=require('crypto');var jsforce=require(_0xd0e0('0xc'));var deskjs=require(_0xd0e0('0xd'));var toCsv=require(_0xd0e0('0xe'));var querystring=require('querystring');var Papa=require(_0xd0e0('0xf'));var Redis=require(_0xd0e0('0x10'));var authService=require(_0xd0e0('0x11'));var qs=require(_0xd0e0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0e0('0x13'));var logger=require(_0xd0e0('0x14'))(_0xd0e0('0x15'));var utils=require(_0xd0e0('0x16'));var config=require(_0xd0e0('0x17'));var licenseUtil=require(_0xd0e0('0x18'));var db=require(_0xd0e0('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd0e0('0x1a')][_0xd0e0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xdd430f,_0x268adf,_0x34ab58,_0x4867bc){return new BPromise(function(_0x45ec21,_0x1d8729){var _0x4f1836=_0x4867bc||client;return _0x4f1836['request'](_0xdd430f,_0x34ab58)['then'](function(_0x39c9e2){logger[_0xd0e0('0x1c')](_0xd0e0('0x1d'),_0x268adf,_0xd0e0('0x1e'));logger[_0xd0e0('0x1f')](_0xd0e0('0x20'),_0x268adf,_0xd0e0('0x1e'),JSON[_0xd0e0('0x21')](_0x39c9e2));if(_0x39c9e2[_0xd0e0('0x22')]){if(_0x39c9e2[_0xd0e0('0x22')]['code']===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x268adf,_0x39c9e2[_0xd0e0('0x22')][_0xd0e0('0x23')]);return _0x1d8729(_0x39c9e2[_0xd0e0('0x22')]['message']);}logger[_0xd0e0('0x22')](_0xd0e0('0x1d'),_0x268adf,_0x39c9e2['error']['message']);return _0x45ec21(_0x39c9e2[_0xd0e0('0x22')][_0xd0e0('0x23')]);}else{logger[_0xd0e0('0x1c')](_0xd0e0('0x1d'),_0x268adf,'request\x20sent');_0x45ec21(_0x39c9e2['result'][_0xd0e0('0x23')]);}})['catch'](function(_0x39062a){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x268adf,_0x39062a);_0x1d8729(_0x39062a);});});}function respondWithStatusCode(_0x12df24,_0xf89796){_0xf89796=_0xf89796||0xcc;return function(_0x2aa1be){if(_0x2aa1be){return _0x12df24[_0xd0e0('0x24')](_0xf89796);}return _0x12df24[_0xd0e0('0x25')](_0xf89796)[_0xd0e0('0x26')]();};}function respondWithResult(_0x79ea64,_0x8b70d1){_0x8b70d1=_0x8b70d1||0xc8;return function(_0x2addbc){if(_0x2addbc){return _0x79ea64['status'](_0x8b70d1)['json'](_0x2addbc);}};}function respondWithFilteredResult(_0x44cf20,_0x2fc67d){return function(_0x44db6e){if(_0x44db6e){var _0x269419=typeof _0x2fc67d['offset']===_0xd0e0('0x27')&&typeof _0x2fc67d['limit']===_0xd0e0('0x27');var _0x10e673=_0x44db6e[_0xd0e0('0x28')];var _0x101dc5=_0x269419?0x0:_0x2fc67d[_0xd0e0('0x29')];var _0x29f251=_0x269419?_0x44db6e[_0xd0e0('0x28')]:_0x2fc67d['offset']+_0x2fc67d[_0xd0e0('0x2a')];var _0x29aa5c;if(_0x29f251>=_0x10e673){_0x29f251=_0x10e673;_0x29aa5c=0xc8;}else{_0x29aa5c=0xce;}_0x44cf20[_0xd0e0('0x25')](_0x29aa5c);return _0x44cf20[_0xd0e0('0x2b')](_0xd0e0('0x2c'),_0x101dc5+'-'+_0x29f251+'/'+_0x10e673)['json'](_0x44db6e);}return null;};}function patchUpdates(_0x207330){return function(_0x28aed3){try{jsonpatch[_0xd0e0('0x2d')](_0x28aed3,_0x207330,!![]);}catch(_0x5b4ebd){return BPromise[_0xd0e0('0x2e')](_0x5b4ebd);}return _0x28aed3['save']();};}function saveUpdates(_0x56002b,_0x255322){return function(_0x50f446){if(_0x50f446){return _0x50f446[_0xd0e0('0x2f')](_0x56002b)[_0xd0e0('0x30')](function(_0x5bf156){return _0x5bf156;});}return null;};}function removeEntity(_0x426c73,_0x536deb){return function(_0x28577c){if(_0x28577c){return _0x28577c[_0xd0e0('0x31')]()['then'](function(){_0x426c73['status'](0xcc)[_0xd0e0('0x26')]();});}};}function handleEntityNotFound(_0x3571e4,_0x27cc8f){return function(_0x29b8c6){if(!_0x29b8c6){_0x3571e4[_0xd0e0('0x24')](0x194);}return _0x29b8c6;};}function handleError(_0x553f0d,_0x3125ca){_0x3125ca=_0x3125ca||0x1f4;return function(_0xd307e3){logger['error'](_0xd307e3['stack']);if(_0xd307e3['name']){delete _0xd307e3[_0xd0e0('0x32')];}_0x553f0d[_0xd0e0('0x25')](_0x3125ca)['send'](_0xd307e3);};}function getMustacheRender(_0x5ebdcf,_0x190857){return Mustache['render'](_0x5ebdcf,_['merge'](_0x190857[_0xd0e0('0x33')],{'contact':_0x190857['contact'],'message':_0x190857[_0xd0e0('0x23')],'agent':_0x190857[_0xd0e0('0x34')],'interaction':_0x190857[_0xd0e0('0x35')],'account':_0x190857[_0xd0e0('0x36')]}))||'';}exports[_0xd0e0('0x37')]=function(_0x36c419,_0x103a72){var _0x366027={},_0x3c4e81={},_0x28ded2={'count':0x0,'rows':[]};var _0x3eca85=_[_0xd0e0('0x38')](db[_0xd0e0('0x39')]['rawAttributes'],function(_0x379eee){return{'name':_0x379eee[_0xd0e0('0x3a')],'type':_0x379eee[_0xd0e0('0x3b')][_0xd0e0('0x3c')]};});_0x3c4e81[_0xd0e0('0x3d')]=_[_0xd0e0('0x38')](_0x3eca85,_0xd0e0('0x32'));_0x3c4e81[_0xd0e0('0x3e')]=_['keys'](_0x36c419['query']);_0x3c4e81[_0xd0e0('0x3f')]=_[_0xd0e0('0x40')](_0x3c4e81['model'],_0x3c4e81[_0xd0e0('0x3e')]);_0x366027[_0xd0e0('0x41')]=_[_0xd0e0('0x40')](_0x3c4e81[_0xd0e0('0x3d')],qs['fields'](_0x36c419['query'][_0xd0e0('0x42')]));_0x366027['attributes']=_0x366027['attributes']['length']?_0x366027[_0xd0e0('0x41')]:_0x3c4e81['model'];if(!_0x36c419[_0xd0e0('0x3e')][_0xd0e0('0x43')](_0xd0e0('0x44'))){_0x366027[_0xd0e0('0x2a')]=qs[_0xd0e0('0x2a')](_0x36c419[_0xd0e0('0x3e')][_0xd0e0('0x2a')]);_0x366027[_0xd0e0('0x29')]=qs['offset'](_0x36c419[_0xd0e0('0x3e')]['offset']);}_0x366027[_0xd0e0('0x45')]=qs[_0xd0e0('0x46')](_0x36c419[_0xd0e0('0x3e')][_0xd0e0('0x46')]);_0x366027[_0xd0e0('0x47')]=qs[_0xd0e0('0x3f')](_[_0xd0e0('0x48')](_0x36c419[_0xd0e0('0x3e')],_0x3c4e81[_0xd0e0('0x3f')]),_0x3eca85);if(_0x36c419[_0xd0e0('0x3e')][_0xd0e0('0x49')]){_0x366027[_0xd0e0('0x47')]=_['merge'](_0x366027['where'],{'$or':_[_0xd0e0('0x38')](_0x3eca85,function(_0x16c892){if(_0x16c892[_0xd0e0('0x3b')]!=='VIRTUAL'){var _0xc642a5={};_0xc642a5[_0x16c892['name']]={'$like':'%'+_0x36c419[_0xd0e0('0x3e')][_0xd0e0('0x49')]+'%'};return _0xc642a5;}})});}_0x366027=_[_0xd0e0('0x4a')]({},_0x366027,_0x36c419['options']);var _0x1cc3e2={'where':_0x366027['where']};return db[_0xd0e0('0x39')]['count'](_0x1cc3e2)[_0xd0e0('0x30')](function(_0x2c1dab){_0x28ded2[_0xd0e0('0x28')]=_0x2c1dab;if(_0x36c419[_0xd0e0('0x3e')][_0xd0e0('0x4b')]){_0x366027[_0xd0e0('0x4c')]=[{'all':!![]}];}return db[_0xd0e0('0x39')]['findAll'](_0x366027);})[_0xd0e0('0x30')](function(_0x5dcdab){_0x28ded2[_0xd0e0('0x4d')]=_0x5dcdab;return _0x28ded2;})['then'](respondWithFilteredResult(_0x103a72,_0x366027))[_0xd0e0('0x4e')](handleError(_0x103a72,null));};exports[_0xd0e0('0x4f')]=function(_0xee52e2,_0x199c78){var _0x223131={'raw':![],'where':{'id':_0xee52e2['params']['id']}},_0x33c4a0={};_0x33c4a0[_0xd0e0('0x3d')]=_['keys'](db['ZendeskConfiguration'][_0xd0e0('0x50')]);_0x33c4a0[_0xd0e0('0x3e')]=_[_0xd0e0('0x51')](_0xee52e2[_0xd0e0('0x3e')]);_0x33c4a0[_0xd0e0('0x3f')]=_[_0xd0e0('0x40')](_0x33c4a0[_0xd0e0('0x3d')],_0x33c4a0[_0xd0e0('0x3e')]);_0x223131[_0xd0e0('0x41')]=_[_0xd0e0('0x40')](_0x33c4a0['model'],qs[_0xd0e0('0x42')](_0xee52e2['query'][_0xd0e0('0x42')]));_0x223131[_0xd0e0('0x41')]=_0x223131['attributes'][_0xd0e0('0x52')]?_0x223131['attributes']:_0x33c4a0[_0xd0e0('0x3d')];if(_0xee52e2[_0xd0e0('0x3e')][_0xd0e0('0x4b')]){_0x223131['include']=[{'all':!![]}];}_0x223131=_[_0xd0e0('0x4a')]({},_0x223131,_0xee52e2[_0xd0e0('0x53')]);return db[_0xd0e0('0x39')]['find'](_0x223131)[_0xd0e0('0x30')](handleEntityNotFound(_0x199c78,null))[_0xd0e0('0x30')](respondWithResult(_0x199c78,null))[_0xd0e0('0x4e')](handleError(_0x199c78,null));};exports[_0xd0e0('0x54')]=function(_0x2297ff,_0x3a9dea){return db[_0xd0e0('0x39')]['create'](_0x2297ff[_0xd0e0('0x33')],{})[_0xd0e0('0x30')](respondWithResult(_0x3a9dea,0xc9))['catch'](handleError(_0x3a9dea,null));};exports[_0xd0e0('0x2f')]=function(_0x46bc93,_0x120039){if(_0x46bc93[_0xd0e0('0x33')]['id']){delete _0x46bc93[_0xd0e0('0x33')]['id'];}return db['ZendeskConfiguration'][_0xd0e0('0x55')]({'where':{'id':_0x46bc93[_0xd0e0('0x56')]['id']}})['then'](handleEntityNotFound(_0x120039,null))['then'](saveUpdates(_0x46bc93[_0xd0e0('0x33')],null))['then'](respondWithResult(_0x120039,null))[_0xd0e0('0x4e')](handleError(_0x120039,null));};exports[_0xd0e0('0x31')]=function(_0x4771ef,_0x557bc8){return db[_0xd0e0('0x39')][_0xd0e0('0x55')]({'where':{'id':_0x4771ef['params']['id']}})[_0xd0e0('0x30')](handleEntityNotFound(_0x557bc8,null))[_0xd0e0('0x30')](removeEntity(_0x557bc8,null))[_0xd0e0('0x4e')](handleError(_0x557bc8,null));};exports[_0xd0e0('0x57')]=function(_0x2de380,_0x1c0ff8,_0x5bc452){var _0x1d2d09={};var _0x27fefb={};var _0x1871cd;var _0x245146;return db[_0xd0e0('0x39')]['findOne']({'where':{'id':_0x2de380['params']['id']}})[_0xd0e0('0x30')](handleEntityNotFound(_0x1c0ff8,null))[_0xd0e0('0x30')](function(_0x28f1c8){if(_0x28f1c8){_0x1871cd=_0x28f1c8;_0x27fefb['model']=_[_0xd0e0('0x51')](db['ZendeskField']['rawAttributes']);_0x27fefb[_0xd0e0('0x3e')]=_[_0xd0e0('0x51')](_0x2de380[_0xd0e0('0x3e')]);_0x27fefb[_0xd0e0('0x3f')]=_[_0xd0e0('0x40')](_0x27fefb[_0xd0e0('0x3d')],_0x27fefb['query']);_0x1d2d09['attributes']=_[_0xd0e0('0x40')](_0x27fefb['model'],qs[_0xd0e0('0x42')](_0x2de380[_0xd0e0('0x3e')]['fields']));_0x1d2d09['attributes']=_0x1d2d09[_0xd0e0('0x41')][_0xd0e0('0x52')]?_0x1d2d09[_0xd0e0('0x41')]:_0x27fefb[_0xd0e0('0x3d')];_0x1d2d09['order']=qs[_0xd0e0('0x46')](_0x2de380[_0xd0e0('0x3e')][_0xd0e0('0x46')]);_0x1d2d09['where']=qs[_0xd0e0('0x3f')](_['pick'](_0x2de380[_0xd0e0('0x3e')],_0x27fefb[_0xd0e0('0x3f')]));if(_0x2de380[_0xd0e0('0x3e')][_0xd0e0('0x49')]){_0x1d2d09[_0xd0e0('0x47')]=_['merge'](_0x1d2d09[_0xd0e0('0x47')],{'$or':_[_0xd0e0('0x38')](_0x1d2d09[_0xd0e0('0x41')],function(_0x32c9f1){var _0x26fcbc={};_0x26fcbc[_0x32c9f1]={'$like':'%'+_0x2de380[_0xd0e0('0x3e')][_0xd0e0('0x49')]+'%'};return _0x26fcbc;})});}_0x1d2d09=_[_0xd0e0('0x4a')]({},_0x1d2d09,_0x2de380[_0xd0e0('0x53')]);return _0x1871cd[_0xd0e0('0x57')](_0x1d2d09);}})[_0xd0e0('0x30')](function(_0x5ebb39){if(_0x5ebb39){_0x245146=_0x5ebb39['length'];if(!_0x2de380[_0xd0e0('0x3e')][_0xd0e0('0x43')](_0xd0e0('0x44'))){_0x1d2d09[_0xd0e0('0x2a')]=qs['limit'](_0x2de380[_0xd0e0('0x3e')][_0xd0e0('0x2a')]);_0x1d2d09['offset']=qs[_0xd0e0('0x29')](_0x2de380[_0xd0e0('0x3e')]['offset']);}return _0x1871cd[_0xd0e0('0x57')](_0x1d2d09);}})['then'](function(_0x2fe331){if(_0x2fe331){return _0x2fe331?{'count':_0x245146,'rows':_0x2fe331}:null;}})['then'](respondWithResult(_0x1c0ff8,null))[_0xd0e0('0x4e')](handleError(_0x1c0ff8,null));};exports['getSubjects']=function(_0x377a3a,_0xd57151,_0x21773f){var _0x18677d={};var _0x378a5e={};var _0x5a40c3;var _0x3d0a6b;return db[_0xd0e0('0x39')][_0xd0e0('0x58')]({'where':{'id':_0x377a3a[_0xd0e0('0x56')]['id']}})[_0xd0e0('0x30')](handleEntityNotFound(_0xd57151,null))[_0xd0e0('0x30')](function(_0x19d1df){if(_0x19d1df){_0x5a40c3=_0x19d1df;_0x378a5e[_0xd0e0('0x3d')]=_[_0xd0e0('0x51')](db[_0xd0e0('0x59')][_0xd0e0('0x50')]);_0x378a5e[_0xd0e0('0x3e')]=_[_0xd0e0('0x51')](_0x377a3a[_0xd0e0('0x3e')]);_0x378a5e[_0xd0e0('0x3f')]=_['intersection'](_0x378a5e[_0xd0e0('0x3d')],_0x378a5e[_0xd0e0('0x3e')]);_0x18677d[_0xd0e0('0x41')]=_[_0xd0e0('0x40')](_0x378a5e[_0xd0e0('0x3d')],qs[_0xd0e0('0x42')](_0x377a3a['query']['fields']));_0x18677d[_0xd0e0('0x41')]=_0x18677d[_0xd0e0('0x41')]['length']?_0x18677d[_0xd0e0('0x41')]:_0x378a5e[_0xd0e0('0x3d')];_0x18677d['order']=qs[_0xd0e0('0x46')](_0x377a3a[_0xd0e0('0x3e')][_0xd0e0('0x46')]);_0x18677d[_0xd0e0('0x47')]=qs[_0xd0e0('0x3f')](_['pick'](_0x377a3a[_0xd0e0('0x3e')],_0x378a5e[_0xd0e0('0x3f')]));if(_0x377a3a[_0xd0e0('0x3e')][_0xd0e0('0x49')]){_0x18677d[_0xd0e0('0x47')]=_[_0xd0e0('0x4a')](_0x18677d[_0xd0e0('0x47')],{'$or':_['map'](_0x18677d['attributes'],function(_0x2d9344){var _0x335d34={};_0x335d34[_0x2d9344]={'$like':'%'+_0x377a3a[_0xd0e0('0x3e')][_0xd0e0('0x49')]+'%'};return _0x335d34;})});}_0x18677d=_[_0xd0e0('0x4a')]({},_0x18677d,_0x377a3a['options']);return _0x5a40c3['getSubjects'](_0x18677d);}})[_0xd0e0('0x30')](function(_0x4f3feb){if(_0x4f3feb){_0x3d0a6b=_0x4f3feb['length'];if(!_0x377a3a[_0xd0e0('0x3e')][_0xd0e0('0x43')](_0xd0e0('0x44'))){_0x18677d[_0xd0e0('0x2a')]=qs[_0xd0e0('0x2a')](_0x377a3a['query'][_0xd0e0('0x2a')]);_0x18677d[_0xd0e0('0x29')]=qs[_0xd0e0('0x29')](_0x377a3a[_0xd0e0('0x3e')][_0xd0e0('0x29')]);}return _0x5a40c3[_0xd0e0('0x5a')](_0x18677d);}})[_0xd0e0('0x30')](function(_0x1a0db2){if(_0x1a0db2){return _0x1a0db2?{'count':_0x3d0a6b,'rows':_0x1a0db2}:null;}})['then'](respondWithResult(_0xd57151,null))[_0xd0e0('0x4e')](handleError(_0xd57151,null));};exports[_0xd0e0('0x5b')]=function(_0x48a4ac,_0x4909f2,_0x58da0d){var _0x1364e4={};var _0x2de86c={};var _0x58d5f5;var _0x3c4750;return db['ZendeskConfiguration'][_0xd0e0('0x58')]({'where':{'id':_0x48a4ac['params']['id']}})[_0xd0e0('0x30')](handleEntityNotFound(_0x4909f2,null))[_0xd0e0('0x30')](function(_0x19dbf4){if(_0x19dbf4){_0x58d5f5=_0x19dbf4;_0x2de86c[_0xd0e0('0x3d')]=_[_0xd0e0('0x51')](db[_0xd0e0('0x59')][_0xd0e0('0x50')]);_0x2de86c['query']=_['keys'](_0x48a4ac['query']);_0x2de86c[_0xd0e0('0x3f')]=_[_0xd0e0('0x40')](_0x2de86c[_0xd0e0('0x3d')],_0x2de86c[_0xd0e0('0x3e')]);_0x1364e4['attributes']=_[_0xd0e0('0x40')](_0x2de86c['model'],qs[_0xd0e0('0x42')](_0x48a4ac['query'][_0xd0e0('0x42')]));_0x1364e4[_0xd0e0('0x41')]=_0x1364e4[_0xd0e0('0x41')][_0xd0e0('0x52')]?_0x1364e4['attributes']:_0x2de86c[_0xd0e0('0x3d')];_0x1364e4[_0xd0e0('0x45')]=qs[_0xd0e0('0x46')](_0x48a4ac[_0xd0e0('0x3e')][_0xd0e0('0x46')]);_0x1364e4[_0xd0e0('0x47')]=qs[_0xd0e0('0x3f')](_[_0xd0e0('0x48')](_0x48a4ac[_0xd0e0('0x3e')],_0x2de86c[_0xd0e0('0x3f')]));if(_0x48a4ac[_0xd0e0('0x3e')]['filter']){_0x1364e4[_0xd0e0('0x47')]=_[_0xd0e0('0x4a')](_0x1364e4[_0xd0e0('0x47')],{'$or':_['map'](_0x1364e4[_0xd0e0('0x41')],function(_0x40925e){var _0x113b4f={};_0x113b4f[_0x40925e]={'$like':'%'+_0x48a4ac[_0xd0e0('0x3e')][_0xd0e0('0x49')]+'%'};return _0x113b4f;})});}_0x1364e4=_[_0xd0e0('0x4a')]({},_0x1364e4,_0x48a4ac[_0xd0e0('0x53')]);return _0x58d5f5['getDescriptions'](_0x1364e4);}})[_0xd0e0('0x30')](function(_0x4570e8){if(_0x4570e8){_0x3c4750=_0x4570e8[_0xd0e0('0x52')];if(!_0x48a4ac[_0xd0e0('0x3e')][_0xd0e0('0x43')](_0xd0e0('0x44'))){_0x1364e4['limit']=qs[_0xd0e0('0x2a')](_0x48a4ac[_0xd0e0('0x3e')][_0xd0e0('0x2a')]);_0x1364e4[_0xd0e0('0x29')]=qs[_0xd0e0('0x29')](_0x48a4ac[_0xd0e0('0x3e')][_0xd0e0('0x29')]);}return _0x58d5f5['getDescriptions'](_0x1364e4);}})[_0xd0e0('0x30')](function(_0x3c3292){if(_0x3c3292){return _0x3c3292?{'count':_0x3c4750,'rows':_0x3c3292}:null;}})[_0xd0e0('0x30')](respondWithResult(_0x4909f2,null))[_0xd0e0('0x4e')](handleError(_0x4909f2,null));};exports['getTags']=function(_0x2e08a1,_0x5d5957,_0x45c30a){var _0x21620a={};var _0x1c0e4a={};var _0x4d9ea6;var _0x315e7a;return db[_0xd0e0('0x39')][_0xd0e0('0x58')]({'where':{'id':_0x2e08a1[_0xd0e0('0x56')]['id']}})[_0xd0e0('0x30')](handleEntityNotFound(_0x5d5957,null))[_0xd0e0('0x30')](function(_0x16c024){if(_0x16c024){_0x4d9ea6=_0x16c024;_0x1c0e4a[_0xd0e0('0x3d')]=_[_0xd0e0('0x51')](db[_0xd0e0('0x5c')][_0xd0e0('0x50')]);_0x1c0e4a['query']=_[_0xd0e0('0x51')](_0x2e08a1[_0xd0e0('0x3e')]);_0x1c0e4a[_0xd0e0('0x3f')]=_[_0xd0e0('0x40')](_0x1c0e4a[_0xd0e0('0x3d')],_0x1c0e4a[_0xd0e0('0x3e')]);_0x21620a['attributes']=_['intersection'](_0x1c0e4a[_0xd0e0('0x3d')],qs[_0xd0e0('0x42')](_0x2e08a1[_0xd0e0('0x3e')][_0xd0e0('0x42')]));_0x21620a['attributes']=_0x21620a[_0xd0e0('0x41')][_0xd0e0('0x52')]?_0x21620a[_0xd0e0('0x41')]:_0x1c0e4a['model'];_0x21620a[_0xd0e0('0x45')]=qs[_0xd0e0('0x46')](_0x2e08a1[_0xd0e0('0x3e')][_0xd0e0('0x46')]);_0x21620a['where']=qs['filters'](_['pick'](_0x2e08a1[_0xd0e0('0x3e')],_0x1c0e4a['filters']));if(_0x2e08a1[_0xd0e0('0x3e')]['filter']){_0x21620a[_0xd0e0('0x47')]=_['merge'](_0x21620a[_0xd0e0('0x47')],{'$or':_['map'](_0x21620a['attributes'],function(_0x6f23bd){var _0x155bdb={};_0x155bdb[_0x6f23bd]={'$like':'%'+_0x2e08a1[_0xd0e0('0x3e')]['filter']+'%'};return _0x155bdb;})});}_0x21620a=_[_0xd0e0('0x4a')]({},_0x21620a,_0x2e08a1[_0xd0e0('0x53')]);return _0x4d9ea6['getTags'](_0x21620a);}})[_0xd0e0('0x30')](function(_0x13aef0){if(_0x13aef0){_0x315e7a=_0x13aef0[_0xd0e0('0x52')];if(!_0x2e08a1[_0xd0e0('0x3e')]['hasOwnProperty'](_0xd0e0('0x44'))){_0x21620a[_0xd0e0('0x2a')]=qs[_0xd0e0('0x2a')](_0x2e08a1[_0xd0e0('0x3e')][_0xd0e0('0x2a')]);_0x21620a[_0xd0e0('0x29')]=qs[_0xd0e0('0x29')](_0x2e08a1['query'][_0xd0e0('0x29')]);}return _0x4d9ea6['getTags'](_0x21620a);}})[_0xd0e0('0x30')](function(_0x4c0a38){if(_0x4c0a38){return _0x4c0a38?{'count':_0x315e7a,'rows':_0x4c0a38}:null;}})[_0xd0e0('0x30')](respondWithResult(_0x5d5957,null))['catch'](handleError(_0x5d5957,null));};exports[_0xd0e0('0x5d')]=function(_0x5b3658,_0x6666b8,_0x45f0f8){if(_0x5b3658['body']['id']){delete _0x5b3658[_0xd0e0('0x33')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5b3658[_0xd0e0('0x56')]['id']}})['then'](handleEntityNotFound(_0x6666b8,null))['then'](function(_0x49db6c){if(_0x49db6c){return _0x49db6c[_0xd0e0('0x5d')](_0x5b3658[_0xd0e0('0x33')][_0xd0e0('0x5e')]||[]);}return null;})[_0xd0e0('0x30')](respondWithResult(_0x6666b8,null))[_0xd0e0('0x4e')](handleError(_0x6666b8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e1fdb5c..a7c74cb 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 _0x3204=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x35e67b,_0x5260ba){var _0x85cf5b=function(_0x40c292){while(--_0x40c292){_0x35e67b['push'](_0x35e67b['shift']());}};_0x85cf5b(++_0x5260ba);}(_0x3204,0x1ed));var _0x4320=function(_0x5472ee,_0x3ad01a){_0x5472ee=_0x5472ee-0x0;var _0xda38ad=_0x3204[_0x5472ee];return _0xda38ad;};'use strict';var _=require('lodash');var util=require(_0x4320('0x0'));var logger=require(_0x4320('0x1'))(_0x4320('0x2'));var moment=require(_0x4320('0x3'));var BPromise=require(_0x4320('0x4'));var rp=require(_0x4320('0x5'));var fs=require('fs');var path=require(_0x4320('0x6'));var rimraf=require(_0x4320('0x7'));var config=require(_0x4320('0x8'));var attributes=require(_0x4320('0x9'));module['exports']=function(_0x58c5bf,_0x4890d9){return _0x58c5bf[_0x4320('0xa')](_0x4320('0xb'),attributes,{'tableName':_0x4320('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc528=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x23531f,_0x262dd3){var _0x56b5d3=function(_0x12b1f4){while(--_0x12b1f4){_0x23531f['push'](_0x23531f['shift']());}};_0x56b5d3(++_0x262dd3);}(_0xc528,0x1f3));var _0x8c52=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc528[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c52('0x0'));var util=require('util');var logger=require(_0x8c52('0x1'))(_0x8c52('0x2'));var moment=require(_0x8c52('0x3'));var BPromise=require(_0x8c52('0x4'));var rp=require(_0x8c52('0x5'));var fs=require('fs');var path=require(_0x8c52('0x6'));var rimraf=require(_0x8c52('0x7'));var config=require(_0x8c52('0x8'));var attributes=require(_0x8c52('0x9'));module[_0x8c52('0xa')]=function(_0x71fc84,_0x3de155){return _0x71fc84[_0x8c52('0xb')](_0x8c52('0xc'),attributes,{'tableName':_0x8c52('0xd'),'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 b952d84..2056bbb 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 _0x5552=['catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x5552,0x79));var _0x2555=function(_0x59d4ae,_0x128737){_0x59d4ae=_0x59d4ae-0x0;var _0x168159=_0x5552[_0x59d4ae];return _0x168159;};'use strict';var _=require(_0x2555('0x0'));var util=require('util');var moment=require(_0x2555('0x1'));var BPromise=require(_0x2555('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2555('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2555('0x4'));var logger=require(_0x2555('0x5'))(_0x2555('0x6'));var config=require(_0x2555('0x7'));var jayson=require(_0x2555('0x8'));var client=jayson[_0x2555('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x423ee7,_0x14fe3d,_0x150687){return new BPromise(function(_0x549215,_0x55441b){return client[_0x2555('0xa')](_0x423ee7,_0x150687)[_0x2555('0xb')](function(_0xe8605){logger[_0x2555('0xc')](_0x2555('0xd'),_0x14fe3d,_0x2555('0xe'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x14fe3d,_0x2555('0xe'),JSON['stringify'](_0xe8605));if(_0xe8605[_0x2555('0xf')]){if(_0xe8605['error'][_0x2555('0x10')]===0x1f4){logger[_0x2555('0xf')](_0x2555('0xd'),_0x14fe3d,_0xe8605['error'][_0x2555('0x11')]);return _0x55441b(_0xe8605[_0x2555('0xf')][_0x2555('0x11')]);}logger['error'](_0x2555('0xd'),_0x14fe3d,_0xe8605[_0x2555('0xf')][_0x2555('0x11')]);return _0x549215(_0xe8605[_0x2555('0xf')][_0x2555('0x11')]);}else{logger[_0x2555('0xc')](_0x2555('0xd'),_0x14fe3d,_0x2555('0xe'));_0x549215(_0xe8605[_0x2555('0x12')][_0x2555('0x11')]);}})[_0x2555('0x13')](function(_0x418321){logger[_0x2555('0xf')](_0x2555('0xd'),_0x14fe3d,_0x418321);_0x55441b(_0x418321);});});} \ No newline at end of file +var _0x1d46=['http','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2f34e0,_0x3e73d0){var _0x35c4a4=function(_0x19a1fa){while(--_0x19a1fa){_0x2f34e0['push'](_0x2f34e0['shift']());}};_0x35c4a4(++_0x3e73d0);}(_0x1d46,0xf1));var _0x61d4=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1d46[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x61d4('0x0'));var util=require(_0x61d4('0x1'));var moment=require(_0x61d4('0x2'));var BPromise=require(_0x61d4('0x3'));var rs=require(_0x61d4('0x4'));var fs=require('fs');var Redis=require(_0x61d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x61d4('0x6'))(_0x61d4('0x7'));var config=require(_0x61d4('0x8'));var jayson=require(_0x61d4('0x9'));var client=jayson[_0x61d4('0xa')][_0x61d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x199cd3,_0x28b620,_0x20b47c){return new BPromise(function(_0x470a90,_0x9faf4f){return client['request'](_0x199cd3,_0x20b47c)[_0x61d4('0xc')](function(_0x3f0a27){logger[_0x61d4('0xd')](_0x61d4('0xe'),_0x28b620,'request\x20sent');logger[_0x61d4('0xf')](_0x61d4('0x10'),_0x28b620,'request\x20sent',JSON[_0x61d4('0x11')](_0x3f0a27));if(_0x3f0a27[_0x61d4('0x12')]){if(_0x3f0a27[_0x61d4('0x12')]['code']===0x1f4){logger['error'](_0x61d4('0xe'),_0x28b620,_0x3f0a27[_0x61d4('0x12')][_0x61d4('0x13')]);return _0x9faf4f(_0x3f0a27[_0x61d4('0x12')][_0x61d4('0x13')]);}logger['error'](_0x61d4('0xe'),_0x28b620,_0x3f0a27['error'][_0x61d4('0x13')]);return _0x470a90(_0x3f0a27[_0x61d4('0x12')][_0x61d4('0x13')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x28b620,'request\x20sent');_0x470a90(_0x3f0a27['result'][_0x61d4('0x13')]);}})[_0x61d4('0x14')](function(_0x378a41){logger[_0x61d4('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x28b620,_0x378a41);_0x9faf4f(_0x378a41);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index d15c9c1..44a0a36 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 _0x5104=['multer','util','connect-timeout','Router','fs-extra','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','post','create','delete','destroy','exports'];(function(_0x569fef,_0x49c37a){var _0x11f20b=function(_0x3721d8){while(--_0x3721d8){_0x569fef['push'](_0x569fef['shift']());}};_0x11f20b(++_0x49c37a);}(_0x5104,0x100));var _0x4510=function(_0x1e5980,_0x48089a){_0x1e5980=_0x1e5980-0x0;var _0x2a73c8=_0x5104[_0x1e5980];return _0x2a73c8;};'use strict';var multer=require(_0x4510('0x0'));var util=require(_0x4510('0x1'));var path=require('path');var timeout=require(_0x4510('0x2'));var express=require('express');var router=express[_0x4510('0x3')]();var fs_extra=require(_0x4510('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4510('0x5'));var controller=require(_0x4510('0x6'));router[_0x4510('0x7')]('/',auth['isAuthenticated'](),controller[_0x4510('0x8')]);router[_0x4510('0x7')](_0x4510('0x9'),auth[_0x4510('0xa')](),controller['show']);router[_0x4510('0xb')]('/',auth[_0x4510('0xa')](),controller[_0x4510('0xc')]);router['put'](_0x4510('0x9'),auth[_0x4510('0xa')](),controller['update']);router[_0x4510('0xd')]('/:id',auth[_0x4510('0xa')](),controller[_0x4510('0xe')]);module[_0x4510('0xf')]=router; \ No newline at end of file +var _0xfbf2=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','show','post','create','/:id','update','delete','multer','util','path'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfbf2,0x141));var _0x2fbf=function(_0x569998,_0x361b8d){_0x569998=_0x569998-0x0;var _0x2f8256=_0xfbf2[_0x569998];return _0x2f8256;};'use strict';var multer=require(_0x2fbf('0x0'));var util=require(_0x2fbf('0x1'));var path=require(_0x2fbf('0x2'));var timeout=require(_0x2fbf('0x3'));var express=require(_0x2fbf('0x4'));var router=express[_0x2fbf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2fbf('0x6'));var interaction=require(_0x2fbf('0x7'));var config=require(_0x2fbf('0x8'));var controller=require(_0x2fbf('0x9'));router[_0x2fbf('0xa')]('/',auth[_0x2fbf('0xb')](),controller['index']);router[_0x2fbf('0xa')]('/:id',auth[_0x2fbf('0xb')](),controller[_0x2fbf('0xc')]);router[_0x2fbf('0xd')]('/',auth['isAuthenticated'](),controller[_0x2fbf('0xe')]);router['put'](_0x2fbf('0xf'),auth['isAuthenticated'](),controller[_0x2fbf('0x10')]);router[_0x2fbf('0x11')](_0x2fbf('0xf'),auth['isAuthenticated'](),controller['destroy']);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 571a37f..4653602 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 _0xa41a=['keyValue','picklist','STRING','sequelize','exports','string','variable','customVariable'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa41a,0x6b));var _0xaa41=function(_0x335b85,_0x45cd3c){_0x335b85=_0x335b85-0x0;var _0x5debea=_0xa41a[_0x335b85];return _0x5debea;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'type':{'type':Sequelize['ENUM'](_0xaa41('0x2'),_0xaa41('0x3'),_0xaa41('0x4'),_0xaa41('0x5'),_0xaa41('0x6')),'defaultValue':_0xaa41('0x2')},'content':{'type':Sequelize[_0xaa41('0x7')]},'key':{'type':Sequelize[_0xaa41('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xaa41('0x2'),_0xaa41('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xaa41('0x7')]},'nameField':{'type':Sequelize[_0xaa41('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa41('0x7')]}}; \ No newline at end of file +var _0x9567=['variable','picklist','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x133ce8,_0x407f4f){var _0x58455e=function(_0x4ef4ac){while(--_0x4ef4ac){_0x133ce8['push'](_0x133ce8['shift']());}};_0x58455e(++_0x407f4f);}(_0x9567,0xdc));var _0x7956=function(_0xadbfee,_0x26ea7a){_0xadbfee=_0xadbfee-0x0;var _0x5a118e=_0x9567[_0xadbfee];return _0x5a118e;};'use strict';var Sequelize=require(_0x7956('0x0'));module[_0x7956('0x1')]={'type':{'type':Sequelize[_0x7956('0x2')](_0x7956('0x3'),_0x7956('0x4'),'customVariable','keyValue',_0x7956('0x5')),'defaultValue':_0x7956('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7956('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x7956('0x3'),'variable',_0x7956('0x7'))},'keyContent':{'type':Sequelize[_0x7956('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7956('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7956('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index cc1681d..e1a1aca 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 _0x4513=['find','catch','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','render','merge','body','message','agent','interaction','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','ZendeskField','includeAll','findAll','params','include'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x4513,0x92));var _0x3451=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4513[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x3451('0x0'));var rimraf=require(_0x3451('0x1'));var zipdir=require(_0x3451('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3451('0x3'));var Mustache=require(_0x3451('0x4'));var util=require(_0x3451('0x5'));var path=require(_0x3451('0x6'));var sox=require('sox');var csv=require(_0x3451('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3451('0x8'));var _=require(_0x3451('0x9'));var squel=require(_0x3451('0xa'));var crypto=require(_0x3451('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3451('0x7'));var querystring=require(_0x3451('0xc'));var Papa=require(_0x3451('0xd'));var Redis=require(_0x3451('0xe'));var authService=require(_0x3451('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3451('0x10'))(_0x3451('0x11'));var utils=require(_0x3451('0x12'));var config=require(_0x3451('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3451('0x14'))['db'];function respondWithStatusCode(_0x2be2ef,_0x467182){_0x467182=_0x467182||0xcc;return function(_0x59c2cf){if(_0x59c2cf){return _0x2be2ef[_0x3451('0x15')](_0x467182);}return _0x2be2ef['status'](_0x467182)[_0x3451('0x16')]();};}function respondWithResult(_0x23e0fc,_0x301101){_0x301101=_0x301101||0xc8;return function(_0x45089d){if(_0x45089d){return _0x23e0fc[_0x3451('0x17')](_0x301101)['json'](_0x45089d);}};}function respondWithFilteredResult(_0x36fcd8,_0x42d9a5){return function(_0x251532){if(_0x251532){var _0x5cb7d4=typeof _0x42d9a5[_0x3451('0x18')]===_0x3451('0x19')&&typeof _0x42d9a5['limit']==='undefined';var _0x547677=_0x251532[_0x3451('0x1a')];var _0xf9d66a=_0x5cb7d4?0x0:_0x42d9a5[_0x3451('0x18')];var _0x1f9102=_0x5cb7d4?_0x251532[_0x3451('0x1a')]:_0x42d9a5[_0x3451('0x18')]+_0x42d9a5[_0x3451('0x1b')];var _0x2d1fd6;if(_0x1f9102>=_0x547677){_0x1f9102=_0x547677;_0x2d1fd6=0xc8;}else{_0x2d1fd6=0xce;}_0x36fcd8[_0x3451('0x17')](_0x2d1fd6);return _0x36fcd8[_0x3451('0x1c')]('Content-Range',_0xf9d66a+'-'+_0x1f9102+'/'+_0x547677)['json'](_0x251532);}return null;};}function patchUpdates(_0x3dc450){return function(_0x22b243){try{jsonpatch[_0x3451('0x1d')](_0x22b243,_0x3dc450,!![]);}catch(_0x391576){return BPromise['reject'](_0x391576);}return _0x22b243[_0x3451('0x1e')]();};}function saveUpdates(_0x297eaf,_0x397c3c){return function(_0x54cb59){if(_0x54cb59){return _0x54cb59[_0x3451('0x1f')](_0x297eaf)[_0x3451('0x20')](function(_0xe41086){return _0xe41086;});}return null;};}function removeEntity(_0x54d80e,_0x3235c6){return function(_0x22294d){if(_0x22294d){return _0x22294d[_0x3451('0x21')]()[_0x3451('0x20')](function(){_0x54d80e[_0x3451('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0978,_0xa771ab){return function(_0x3e41ea){if(!_0x3e41ea){_0x4e0978[_0x3451('0x15')](0x194);}return _0x3e41ea;};}function handleError(_0x139e0f,_0x245d3c){_0x245d3c=_0x245d3c||0x1f4;return function(_0x5b6618){logger[_0x3451('0x22')](_0x5b6618[_0x3451('0x23')]);if(_0x5b6618[_0x3451('0x24')]){delete _0x5b6618['name'];}_0x139e0f['status'](_0x245d3c)[_0x3451('0x25')](_0x5b6618);};}function getMustacheRender(_0x2dee06,_0x3d01b3){return Mustache[_0x3451('0x26')](_0x2dee06,_[_0x3451('0x27')](_0x3d01b3[_0x3451('0x28')],{'contact':_0x3d01b3['contact'],'message':_0x3d01b3[_0x3451('0x29')],'agent':_0x3d01b3[_0x3451('0x2a')],'interaction':_0x3d01b3[_0x3451('0x2b')],'account':_0x3d01b3['account']}))||'';}exports[_0x3451('0x2c')]=function(_0x252ac0,_0x598a00){var _0x16ebd2={},_0x272978={},_0x27207b={'count':0x0,'rows':[]};var _0x23ba64=_['map'](db['ZendeskField'][_0x3451('0x2d')],function(_0x36d5ad){return{'name':_0x36d5ad[_0x3451('0x2e')],'type':_0x36d5ad[_0x3451('0x2f')][_0x3451('0x30')]};});_0x272978['model']=_[_0x3451('0x31')](_0x23ba64,_0x3451('0x24'));_0x272978[_0x3451('0x32')]=_[_0x3451('0x33')](_0x252ac0[_0x3451('0x32')]);_0x272978[_0x3451('0x34')]=_[_0x3451('0x35')](_0x272978[_0x3451('0x36')],_0x272978[_0x3451('0x32')]);_0x16ebd2[_0x3451('0x37')]=_[_0x3451('0x35')](_0x272978[_0x3451('0x36')],qs[_0x3451('0x38')](_0x252ac0[_0x3451('0x32')][_0x3451('0x38')]));_0x16ebd2[_0x3451('0x37')]=_0x16ebd2[_0x3451('0x37')]['length']?_0x16ebd2[_0x3451('0x37')]:_0x272978[_0x3451('0x36')];if(!_0x252ac0[_0x3451('0x32')][_0x3451('0x39')]('nolimit')){_0x16ebd2[_0x3451('0x1b')]=qs[_0x3451('0x1b')](_0x252ac0['query'][_0x3451('0x1b')]);_0x16ebd2[_0x3451('0x18')]=qs['offset'](_0x252ac0[_0x3451('0x32')]['offset']);}_0x16ebd2[_0x3451('0x3a')]=qs[_0x3451('0x3b')](_0x252ac0[_0x3451('0x32')]['sort']);_0x16ebd2[_0x3451('0x3c')]=qs[_0x3451('0x34')](_[_0x3451('0x3d')](_0x252ac0[_0x3451('0x32')],_0x272978[_0x3451('0x34')]),_0x23ba64);if(_0x252ac0['query'][_0x3451('0x3e')]){_0x16ebd2['where']=_['merge'](_0x16ebd2[_0x3451('0x3c')],{'$or':_[_0x3451('0x31')](_0x23ba64,function(_0x4023af){if(_0x4023af[_0x3451('0x2f')]!==_0x3451('0x3f')){var _0x39148a={};_0x39148a[_0x4023af[_0x3451('0x24')]]={'$like':'%'+_0x252ac0['query'][_0x3451('0x3e')]+'%'};return _0x39148a;}})});}_0x16ebd2=_[_0x3451('0x27')]({},_0x16ebd2,_0x252ac0[_0x3451('0x40')]);var _0x306169={'where':_0x16ebd2[_0x3451('0x3c')]};return db[_0x3451('0x41')][_0x3451('0x1a')](_0x306169)[_0x3451('0x20')](function(_0x2c2268){_0x27207b[_0x3451('0x1a')]=_0x2c2268;if(_0x252ac0[_0x3451('0x32')][_0x3451('0x42')]){_0x16ebd2['include']=[{'all':!![]}];}return db[_0x3451('0x41')][_0x3451('0x43')](_0x16ebd2);})[_0x3451('0x20')](function(_0x5ed72d){_0x27207b['rows']=_0x5ed72d;return _0x27207b;})[_0x3451('0x20')](respondWithFilteredResult(_0x598a00,_0x16ebd2))['catch'](handleError(_0x598a00,null));};exports['show']=function(_0x11ddcd,_0x5e033c){var _0x1d8f02={'raw':!![],'where':{'id':_0x11ddcd[_0x3451('0x44')]['id']}},_0x2bb161={};_0x2bb161[_0x3451('0x36')]=_['keys'](db[_0x3451('0x41')]['rawAttributes']);_0x2bb161['query']=_[_0x3451('0x33')](_0x11ddcd['query']);_0x2bb161[_0x3451('0x34')]=_[_0x3451('0x35')](_0x2bb161['model'],_0x2bb161[_0x3451('0x32')]);_0x1d8f02[_0x3451('0x37')]=_['intersection'](_0x2bb161[_0x3451('0x36')],qs['fields'](_0x11ddcd[_0x3451('0x32')]['fields']));_0x1d8f02[_0x3451('0x37')]=_0x1d8f02[_0x3451('0x37')]['length']?_0x1d8f02[_0x3451('0x37')]:_0x2bb161[_0x3451('0x36')];if(_0x11ddcd[_0x3451('0x32')][_0x3451('0x42')]){_0x1d8f02[_0x3451('0x45')]=[{'all':!![]}];}_0x1d8f02=_[_0x3451('0x27')]({},_0x1d8f02,_0x11ddcd[_0x3451('0x40')]);return db['ZendeskField'][_0x3451('0x46')](_0x1d8f02)[_0x3451('0x20')](handleEntityNotFound(_0x5e033c,null))[_0x3451('0x20')](respondWithResult(_0x5e033c,null))[_0x3451('0x47')](handleError(_0x5e033c,null));};exports['create']=function(_0x45396e,_0x3f0442){return db[_0x3451('0x41')]['create'](_0x45396e[_0x3451('0x28')],{})[_0x3451('0x20')](respondWithResult(_0x3f0442,0xc9))[_0x3451('0x47')](handleError(_0x3f0442,null));};exports[_0x3451('0x1f')]=function(_0x55fdf4,_0x3c9a56){if(_0x55fdf4[_0x3451('0x28')]['id']){delete _0x55fdf4[_0x3451('0x28')]['id'];}return db[_0x3451('0x41')][_0x3451('0x46')]({'where':{'id':_0x55fdf4[_0x3451('0x44')]['id']}})[_0x3451('0x20')](handleEntityNotFound(_0x3c9a56,null))['then'](saveUpdates(_0x55fdf4[_0x3451('0x28')],null))[_0x3451('0x20')](respondWithResult(_0x3c9a56,null))[_0x3451('0x47')](handleError(_0x3c9a56,null));};exports[_0x3451('0x21')]=function(_0x2b3920,_0x7516d1){return db[_0x3451('0x41')][_0x3451('0x46')]({'where':{'id':_0x2b3920['params']['id']}})[_0x3451('0x20')](handleEntityNotFound(_0x7516d1,null))['then'](removeEntity(_0x7516d1,null))[_0x3451('0x47')](handleError(_0x7516d1,null));}; \ No newline at end of file +var _0x9e22=['then','end','error','stack','name','render','merge','body','message','agent','interaction','account','index','map','ZendeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','rows','show','params','length','include','create','catch','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy'];(function(_0x83ec68,_0x2e279f){var _0x5fc645=function(_0x1fbe4a){while(--_0x1fbe4a){_0x83ec68['push'](_0x83ec68['shift']());}};_0x5fc645(++_0x2e279f);}(_0x9e22,0x121));var _0x29e2=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0x9e22[_0x3825a8];return _0xabc9bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29e2('0x0'));var zipdir=require(_0x29e2('0x1'));var jsonpatch=require(_0x29e2('0x2'));var rp=require(_0x29e2('0x3'));var moment=require(_0x29e2('0x4'));var BPromise=require(_0x29e2('0x5'));var Mustache=require(_0x29e2('0x6'));var util=require(_0x29e2('0x7'));var path=require(_0x29e2('0x8'));var sox=require(_0x29e2('0x9'));var csv=require(_0x29e2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29e2('0xb'));var _=require(_0x29e2('0xc'));var squel=require(_0x29e2('0xd'));var crypto=require(_0x29e2('0xe'));var jsforce=require(_0x29e2('0xf'));var deskjs=require(_0x29e2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x29e2('0x11'));var Papa=require(_0x29e2('0x12'));var Redis=require(_0x29e2('0x13'));var authService=require(_0x29e2('0x14'));var qs=require(_0x29e2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x29e2('0x16'))('api');var utils=require(_0x29e2('0x17'));var config=require(_0x29e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x29e2('0x19'))['db'];function respondWithStatusCode(_0x393fca,_0x61db06){_0x61db06=_0x61db06||0xcc;return function(_0x3b6c01){if(_0x3b6c01){return _0x393fca[_0x29e2('0x1a')](_0x61db06);}return _0x393fca['status'](_0x61db06)['end']();};}function respondWithResult(_0x3bdd2a,_0x151918){_0x151918=_0x151918||0xc8;return function(_0x27d218){if(_0x27d218){return _0x3bdd2a[_0x29e2('0x1b')](_0x151918)[_0x29e2('0x1c')](_0x27d218);}};}function respondWithFilteredResult(_0x25866d,_0x23a7c7){return function(_0x38115c){if(_0x38115c){var _0x57629d=typeof _0x23a7c7[_0x29e2('0x1d')]===_0x29e2('0x1e')&&typeof _0x23a7c7['limit']==='undefined';var _0xa30d0e=_0x38115c['count'];var _0x311ab4=_0x57629d?0x0:_0x23a7c7[_0x29e2('0x1d')];var _0x452c2=_0x57629d?_0x38115c[_0x29e2('0x1f')]:_0x23a7c7[_0x29e2('0x1d')]+_0x23a7c7[_0x29e2('0x20')];var _0x36413d;if(_0x452c2>=_0xa30d0e){_0x452c2=_0xa30d0e;_0x36413d=0xc8;}else{_0x36413d=0xce;}_0x25866d[_0x29e2('0x1b')](_0x36413d);return _0x25866d[_0x29e2('0x21')]('Content-Range',_0x311ab4+'-'+_0x452c2+'/'+_0xa30d0e)[_0x29e2('0x1c')](_0x38115c);}return null;};}function patchUpdates(_0x56a415){return function(_0x3f57df){try{jsonpatch[_0x29e2('0x22')](_0x3f57df,_0x56a415,!![]);}catch(_0x6299d2){return BPromise[_0x29e2('0x23')](_0x6299d2);}return _0x3f57df[_0x29e2('0x24')]();};}function saveUpdates(_0x14841e,_0x5031af){return function(_0x101a92){if(_0x101a92){return _0x101a92[_0x29e2('0x25')](_0x14841e)['then'](function(_0x3ad0af){return _0x3ad0af;});}return null;};}function removeEntity(_0x348934,_0x53ac21){return function(_0x51300f){if(_0x51300f){return _0x51300f[_0x29e2('0x26')]()[_0x29e2('0x27')](function(){_0x348934['status'](0xcc)[_0x29e2('0x28')]();});}};}function handleEntityNotFound(_0x2c0ff4,_0xeff3d4){return function(_0x185c66){if(!_0x185c66){_0x2c0ff4[_0x29e2('0x1a')](0x194);}return _0x185c66;};}function handleError(_0x2c844a,_0x30aea3){_0x30aea3=_0x30aea3||0x1f4;return function(_0x2969ac){logger[_0x29e2('0x29')](_0x2969ac[_0x29e2('0x2a')]);if(_0x2969ac[_0x29e2('0x2b')]){delete _0x2969ac['name'];}_0x2c844a[_0x29e2('0x1b')](_0x30aea3)['send'](_0x2969ac);};}function getMustacheRender(_0xddf5e9,_0xac7351){return Mustache[_0x29e2('0x2c')](_0xddf5e9,_[_0x29e2('0x2d')](_0xac7351[_0x29e2('0x2e')],{'contact':_0xac7351['contact'],'message':_0xac7351[_0x29e2('0x2f')],'agent':_0xac7351[_0x29e2('0x30')],'interaction':_0xac7351[_0x29e2('0x31')],'account':_0xac7351[_0x29e2('0x32')]}))||'';}exports[_0x29e2('0x33')]=function(_0x1c1868,_0x107afa){var _0x14d514={},_0x58096a={},_0x2c2823={'count':0x0,'rows':[]};var _0x44d7ab=_[_0x29e2('0x34')](db[_0x29e2('0x35')][_0x29e2('0x36')],function(_0x3c935){return{'name':_0x3c935[_0x29e2('0x37')],'type':_0x3c935[_0x29e2('0x38')][_0x29e2('0x39')]};});_0x58096a['model']=_[_0x29e2('0x34')](_0x44d7ab,_0x29e2('0x2b'));_0x58096a[_0x29e2('0x3a')]=_[_0x29e2('0x3b')](_0x1c1868['query']);_0x58096a[_0x29e2('0x3c')]=_[_0x29e2('0x3d')](_0x58096a[_0x29e2('0x3e')],_0x58096a[_0x29e2('0x3a')]);_0x14d514['attributes']=_[_0x29e2('0x3d')](_0x58096a[_0x29e2('0x3e')],qs[_0x29e2('0x3f')](_0x1c1868[_0x29e2('0x3a')][_0x29e2('0x3f')]));_0x14d514[_0x29e2('0x40')]=_0x14d514[_0x29e2('0x40')]['length']?_0x14d514[_0x29e2('0x40')]:_0x58096a[_0x29e2('0x3e')];if(!_0x1c1868[_0x29e2('0x3a')][_0x29e2('0x41')](_0x29e2('0x42'))){_0x14d514[_0x29e2('0x20')]=qs['limit'](_0x1c1868[_0x29e2('0x3a')][_0x29e2('0x20')]);_0x14d514[_0x29e2('0x1d')]=qs[_0x29e2('0x1d')](_0x1c1868[_0x29e2('0x3a')][_0x29e2('0x1d')]);}_0x14d514[_0x29e2('0x43')]=qs[_0x29e2('0x44')](_0x1c1868['query'][_0x29e2('0x44')]);_0x14d514[_0x29e2('0x45')]=qs['filters'](_[_0x29e2('0x46')](_0x1c1868[_0x29e2('0x3a')],_0x58096a['filters']),_0x44d7ab);if(_0x1c1868[_0x29e2('0x3a')][_0x29e2('0x47')]){_0x14d514[_0x29e2('0x45')]=_['merge'](_0x14d514[_0x29e2('0x45')],{'$or':_[_0x29e2('0x34')](_0x44d7ab,function(_0x1ad398){if(_0x1ad398[_0x29e2('0x38')]!=='VIRTUAL'){var _0x1be499={};_0x1be499[_0x1ad398[_0x29e2('0x2b')]]={'$like':'%'+_0x1c1868[_0x29e2('0x3a')][_0x29e2('0x47')]+'%'};return _0x1be499;}})});}_0x14d514=_[_0x29e2('0x2d')]({},_0x14d514,_0x1c1868[_0x29e2('0x48')]);var _0x2ab778={'where':_0x14d514['where']};return db[_0x29e2('0x35')]['count'](_0x2ab778)['then'](function(_0x37cb28){_0x2c2823[_0x29e2('0x1f')]=_0x37cb28;if(_0x1c1868[_0x29e2('0x3a')][_0x29e2('0x49')]){_0x14d514['include']=[{'all':!![]}];}return db[_0x29e2('0x35')]['findAll'](_0x14d514);})[_0x29e2('0x27')](function(_0x323cfb){_0x2c2823[_0x29e2('0x4a')]=_0x323cfb;return _0x2c2823;})[_0x29e2('0x27')](respondWithFilteredResult(_0x107afa,_0x14d514))['catch'](handleError(_0x107afa,null));};exports[_0x29e2('0x4b')]=function(_0x4942bd,_0x500cf1){var _0x4af3dd={'raw':!![],'where':{'id':_0x4942bd[_0x29e2('0x4c')]['id']}},_0x389846={};_0x389846[_0x29e2('0x3e')]=_[_0x29e2('0x3b')](db['ZendeskField'][_0x29e2('0x36')]);_0x389846[_0x29e2('0x3a')]=_['keys'](_0x4942bd['query']);_0x389846['filters']=_[_0x29e2('0x3d')](_0x389846[_0x29e2('0x3e')],_0x389846[_0x29e2('0x3a')]);_0x4af3dd[_0x29e2('0x40')]=_[_0x29e2('0x3d')](_0x389846['model'],qs[_0x29e2('0x3f')](_0x4942bd[_0x29e2('0x3a')][_0x29e2('0x3f')]));_0x4af3dd['attributes']=_0x4af3dd['attributes'][_0x29e2('0x4d')]?_0x4af3dd[_0x29e2('0x40')]:_0x389846[_0x29e2('0x3e')];if(_0x4942bd[_0x29e2('0x3a')][_0x29e2('0x49')]){_0x4af3dd[_0x29e2('0x4e')]=[{'all':!![]}];}_0x4af3dd=_[_0x29e2('0x2d')]({},_0x4af3dd,_0x4942bd[_0x29e2('0x48')]);return db[_0x29e2('0x35')]['find'](_0x4af3dd)[_0x29e2('0x27')](handleEntityNotFound(_0x500cf1,null))['then'](respondWithResult(_0x500cf1,null))['catch'](handleError(_0x500cf1,null));};exports[_0x29e2('0x4f')]=function(_0x1d6395,_0x41cf89){return db['ZendeskField']['create'](_0x1d6395[_0x29e2('0x2e')],{})[_0x29e2('0x27')](respondWithResult(_0x41cf89,0xc9))['catch'](handleError(_0x41cf89,null));};exports['update']=function(_0x22038b,_0x5c30d5){if(_0x22038b[_0x29e2('0x2e')]['id']){delete _0x22038b['body']['id'];}return db[_0x29e2('0x35')]['find']({'where':{'id':_0x22038b[_0x29e2('0x4c')]['id']}})[_0x29e2('0x27')](handleEntityNotFound(_0x5c30d5,null))[_0x29e2('0x27')](saveUpdates(_0x22038b['body'],null))[_0x29e2('0x27')](respondWithResult(_0x5c30d5,null))[_0x29e2('0x50')](handleError(_0x5c30d5,null));};exports[_0x29e2('0x26')]=function(_0x4b3280,_0x5c4e6b){return db[_0x29e2('0x35')][_0x29e2('0x51')]({'where':{'id':_0x4b3280['params']['id']}})[_0x29e2('0x27')](handleEntityNotFound(_0x5c4e6b,null))[_0x29e2('0x27')](removeEntity(_0x5c4e6b,null))['catch'](handleError(_0x5c4e6b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 9688e03..0bcd3e0 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 _0xb6b8=['FieldId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x3f4d72,_0x43fd25){var _0x60226b=function(_0x33b306){while(--_0x33b306){_0x3f4d72['push'](_0x3f4d72['shift']());}};_0x60226b(++_0x43fd25);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x49546e,_0x24e6be){_0x49546e=_0x49546e-0x0;var _0xd36569=_0xb6b8[_0x49546e];return _0xd36569;};'use strict';var _=require('lodash');var util=require(_0x8b6b('0x0'));var logger=require(_0x8b6b('0x1'))(_0x8b6b('0x2'));var moment=require(_0x8b6b('0x3'));var BPromise=require(_0x8b6b('0x4'));var rp=require(_0x8b6b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b6b('0x6'));var config=require(_0x8b6b('0x7'));var attributes=require(_0x8b6b('0x8'));module['exports']=function(_0x144451,_0x511688){return _0x144451['define'](_0x8b6b('0x9'),attributes,{'tableName':_0x8b6b('0xa'),'paranoid':![],'indexes':[{'name':_0x8b6b('0xb'),'fields':[_0x8b6b('0xc'),_0x8b6b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9ad=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index'];(function(_0x2772ac,_0x456670){var _0x56e564=function(_0x5c4d22){while(--_0x5c4d22){_0x2772ac['push'](_0x2772ac['shift']());}};_0x56e564(++_0x456670);}(_0xe9ad,0x82));var _0xde9a=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0xe9ad[_0x228641];return _0x5d5d78;};'use strict';var _=require(_0xde9a('0x0'));var util=require(_0xde9a('0x1'));var logger=require(_0xde9a('0x2'))(_0xde9a('0x3'));var moment=require(_0xde9a('0x4'));var BPromise=require(_0xde9a('0x5'));var rp=require(_0xde9a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde9a('0x7'));var config=require(_0xde9a('0x8'));var attributes=require(_0xde9a('0x9'));module[_0xde9a('0xa')]=function(_0x5290c5,_0x27b380){return _0x5290c5[_0xde9a('0xb')](_0xde9a('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xde9a('0xd'),'fields':[_0xde9a('0xe'),_0xde9a('0xf')],'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 1c98b97..69ca25e 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 _0xcb73=['message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcb73,0xaa));var _0x3cb7=function(_0x59ff82,_0x7e27d3){_0x59ff82=_0x59ff82-0x0;var _0x34d4df=_0xcb73[_0x59ff82];return _0x34d4df;};'use strict';var _=require(_0x3cb7('0x0'));var util=require(_0x3cb7('0x1'));var moment=require('moment');var BPromise=require(_0x3cb7('0x2'));var rs=require(_0x3cb7('0x3'));var fs=require('fs');var Redis=require(_0x3cb7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3cb7('0x5'))(_0x3cb7('0x6'));var config=require(_0x3cb7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3cb7('0x8')][_0x3cb7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11bec8,_0x3bdebf,_0x2cbe2b){return new BPromise(function(_0x1e7cbc,_0x93d9be){return client['request'](_0x11bec8,_0x2cbe2b)[_0x3cb7('0xa')](function(_0x43b4ec){logger[_0x3cb7('0xb')]('ZendeskField,\x20%s,\x20%s',_0x3bdebf,_0x3cb7('0xc'));logger[_0x3cb7('0xd')](_0x3cb7('0xe'),_0x3bdebf,_0x3cb7('0xc'),JSON[_0x3cb7('0xf')](_0x43b4ec));if(_0x43b4ec[_0x3cb7('0x10')]){if(_0x43b4ec[_0x3cb7('0x10')][_0x3cb7('0x11')]===0x1f4){logger['error'](_0x3cb7('0x12'),_0x3bdebf,_0x43b4ec['error'][_0x3cb7('0x13')]);return _0x93d9be(_0x43b4ec['error'][_0x3cb7('0x13')]);}logger['error'](_0x3cb7('0x12'),_0x3bdebf,_0x43b4ec[_0x3cb7('0x10')][_0x3cb7('0x13')]);return _0x1e7cbc(_0x43b4ec[_0x3cb7('0x10')][_0x3cb7('0x13')]);}else{logger[_0x3cb7('0xb')](_0x3cb7('0x12'),_0x3bdebf,_0x3cb7('0xc'));_0x1e7cbc(_0x43b4ec[_0x3cb7('0x14')][_0x3cb7('0x13')]);}})['catch'](function(_0x1b83ff){logger[_0x3cb7('0x10')](_0x3cb7('0x12'),_0x3bdebf,_0x1b83ff);_0x93d9be(_0x1b83ff);});});} \ No newline at end of file +var _0x21b9=['util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','catch','lodash'];(function(_0x58cae2,_0x552adb){var _0x4801d2=function(_0x196fd0){while(--_0x196fd0){_0x58cae2['push'](_0x58cae2['shift']());}};_0x4801d2(++_0x552adb);}(_0x21b9,0x18e));var _0x921b=function(_0x5625b5,_0x1dfcc0){_0x5625b5=_0x5625b5-0x0;var _0x91a58f=_0x21b9[_0x5625b5];return _0x91a58f;};'use strict';var _=require(_0x921b('0x0'));var util=require(_0x921b('0x1'));var moment=require(_0x921b('0x2'));var BPromise=require('bluebird');var rs=require(_0x921b('0x3'));var fs=require('fs');var Redis=require(_0x921b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x921b('0x5'))(_0x921b('0x6'));var config=require(_0x921b('0x7'));var jayson=require(_0x921b('0x8'));var client=jayson['client'][_0x921b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5637e2,_0xa646cd,_0x41b047){return new BPromise(function(_0x2b4adc,_0x221b3c){return client[_0x921b('0xa')](_0x5637e2,_0x41b047)['then'](function(_0x2a73d4){logger['info'](_0x921b('0xb'),_0xa646cd,'request\x20sent');logger[_0x921b('0xc')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xa646cd,_0x921b('0xd'),JSON['stringify'](_0x2a73d4));if(_0x2a73d4[_0x921b('0xe')]){if(_0x2a73d4[_0x921b('0xe')]['code']===0x1f4){logger[_0x921b('0xe')](_0x921b('0xb'),_0xa646cd,_0x2a73d4[_0x921b('0xe')][_0x921b('0xf')]);return _0x221b3c(_0x2a73d4[_0x921b('0xe')][_0x921b('0xf')]);}logger[_0x921b('0xe')](_0x921b('0xb'),_0xa646cd,_0x2a73d4[_0x921b('0xe')][_0x921b('0xf')]);return _0x2b4adc(_0x2a73d4[_0x921b('0xe')][_0x921b('0xf')]);}else{logger[_0x921b('0x10')](_0x921b('0xb'),_0xa646cd,_0x921b('0xd'));_0x2b4adc(_0x2a73d4[_0x921b('0x11')][_0x921b('0xf')]);}})[_0x921b('0x12')](function(_0x44460d){logger['error'](_0x921b('0xb'),_0xa646cd,_0x44460d);_0x221b3c(_0x44460d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ce4db7b..18b3cad 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 _0x5e58=['../../components/auth/service','../../config/environment','./intZohoAccount.controller','index','get','show','/:id/configurations','getConfigurations','isAuthenticated','getFields','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x2f4b73,_0x18c42b){var _0x5bb898=function(_0xeb5a0d){while(--_0xeb5a0d){_0x2f4b73['push'](_0x2f4b73['shift']());}};_0x5bb898(++_0x18c42b);}(_0x5e58,0xed));var _0x85e5=function(_0x3ddb6f,_0x254d4a){_0x3ddb6f=_0x3ddb6f-0x0;var _0x3d24a1=_0x5e58[_0x3ddb6f];return _0x3d24a1;};'use strict';var multer=require('multer');var util=require(_0x85e5('0x0'));var path=require(_0x85e5('0x1'));var timeout=require(_0x85e5('0x2'));var express=require(_0x85e5('0x3'));var router=express[_0x85e5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x85e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x85e5('0x6'));var controller=require(_0x85e5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x85e5('0x8')]);router[_0x85e5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x85e5('0xa')]);router[_0x85e5('0x9')](_0x85e5('0xb'),auth['isAuthenticated'](),controller[_0x85e5('0xc')]);router[_0x85e5('0x9')]('/:id/fields',auth[_0x85e5('0xd')](),controller[_0x85e5('0xe')]);router['post']('/',auth[_0x85e5('0xd')](),controller[_0x85e5('0xf')]);router['post']('/:id/configurations',auth[_0x85e5('0xd')](),controller['addConfiguration']);router[_0x85e5('0x10')](_0x85e5('0x11'),auth[_0x85e5('0xd')](),controller[_0x85e5('0x12')]);router[_0x85e5('0x13')](_0x85e5('0x11'),auth['isAuthenticated'](),controller[_0x85e5('0x14')]);module[_0x85e5('0x15')]=router; \ No newline at end of file +var _0x61fe=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x4d5c8b,_0x65031d){var _0x157059=function(_0x50032d){while(--_0x50032d){_0x4d5c8b['push'](_0x4d5c8b['shift']());}};_0x157059(++_0x65031d);}(_0x61fe,0x180));var _0xe61f=function(_0x54c627,_0x34b99c){_0x54c627=_0x54c627-0x0;var _0x48ad95=_0x61fe[_0x54c627];return _0x48ad95;};'use strict';var multer=require(_0xe61f('0x0'));var util=require(_0xe61f('0x1'));var path=require(_0xe61f('0x2'));var timeout=require(_0xe61f('0x3'));var express=require(_0xe61f('0x4'));var router=express[_0xe61f('0x5')]();var fs_extra=require(_0xe61f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe61f('0x7'));var config=require(_0xe61f('0x8'));var controller=require(_0xe61f('0x9'));router[_0xe61f('0xa')]('/',auth[_0xe61f('0xb')](),controller['index']);router[_0xe61f('0xa')](_0xe61f('0xc'),auth[_0xe61f('0xb')](),controller['show']);router[_0xe61f('0xa')](_0xe61f('0xd'),auth[_0xe61f('0xb')](),controller[_0xe61f('0xe')]);router[_0xe61f('0xa')]('/:id/fields',auth[_0xe61f('0xb')](),controller[_0xe61f('0xf')]);router[_0xe61f('0x10')]('/',auth['isAuthenticated'](),controller[_0xe61f('0x11')]);router['post'](_0xe61f('0xd'),auth[_0xe61f('0xb')](),controller[_0xe61f('0x12')]);router[_0xe61f('0x13')](_0xe61f('0xc'),auth[_0xe61f('0xb')](),controller[_0xe61f('0x14')]);router[_0xe61f('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe61f('0x16')]);module[_0xe61f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 740f79c..1c8008e 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 _0x3256=['exports','STRING','sequelize'];(function(_0x49c34e,_0x1b806c){var _0x5cf245=function(_0x441e4c){while(--_0x441e4c){_0x49c34e['push'](_0x49c34e['shift']());}};_0x5cf245(++_0x1b806c);}(_0x3256,0x131));var _0x6325=function(_0x531c73,_0x5190bf){_0x531c73=_0x531c73-0x0;var _0x8817fa=_0x3256[_0x531c73];return _0x8817fa;};'use strict';var Sequelize=require(_0x6325('0x0'));module[_0x6325('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6325('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x6325('0x2')]},'clientId':{'type':Sequelize[_0x6325('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6325('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x6325('0x2')]},'refreshToken':{'type':Sequelize[_0x6325('0x2')]}}; \ No newline at end of file +var _0x6ae6=['sequelize','exports','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6ae6,0x15c));var _0x66ae=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x6ae6[_0x1d6a82];return _0x5834ac;};'use strict';var Sequelize=require(_0x66ae('0x0'));module[_0x66ae('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x66ae('0x2')]},'host':{'type':Sequelize[_0x66ae('0x2')]},'zone':{'type':Sequelize[_0x66ae('0x2')]},'clientId':{'type':Sequelize[_0x66ae('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x66ae('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x66ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 189421f..e53f22a 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 _0x70a1=['order','sort','where','pick','filter','VIRTUAL','options','includeAll','rows','show','params','keys','include','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','getSubjects','type','Descriptions','getDescriptions','channel','ZohoField','Subjects','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientId','serverUrl','host','zoho.eu','slice','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','test','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../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','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','name','send','render','merge','contact','agent','interaction','index','map','ZohoAccount','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x1c4691,_0x158a43){var _0xc5f19f=function(_0x274d6d){while(--_0x274d6d){_0x1c4691['push'](_0x1c4691['shift']());}};_0xc5f19f(++_0x158a43);}(_0x70a1,0x154));var _0x170a=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x70a1[_0x71e493];return _0x3d40ab;};'use strict';var emlformat=require(_0x170a('0x0'));var rimraf=require(_0x170a('0x1'));var zipdir=require(_0x170a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x170a('0x3'));var Mustache=require(_0x170a('0x4'));var util=require(_0x170a('0x5'));var path=require('path');var sox=require(_0x170a('0x6'));var csv=require(_0x170a('0x7'));var ejs=require(_0x170a('0x8'));var fs=require('fs');var fs_extra=require(_0x170a('0x9'));var _=require(_0x170a('0xa'));var squel=require(_0x170a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x170a('0xc'));var toCsv=require(_0x170a('0x7'));var querystring=require(_0x170a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x170a('0xe'));var qs=require(_0x170a('0xf'));var as=require(_0x170a('0x10'));var hardwareService=require(_0x170a('0x11'));var logger=require(_0x170a('0x12'))('api');var utils=require(_0x170a('0x13'));var config=require(_0x170a('0x14'));var licenseUtil=require(_0x170a('0x15'));var db=require(_0x170a('0x16'))['db'];var integrations=require(_0x170a('0x17'));var jayson=require(_0x170a('0x18'));var client=jayson[_0x170a('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34c2b3,_0x240bbf,_0x4f5c79,_0x4384b6){return new BPromise(function(_0x40bcc6,_0x488137){var _0x133521=_0x4384b6||client;return _0x133521[_0x170a('0x1a')](_0x34c2b3,_0x4f5c79)[_0x170a('0x1b')](function(_0xd25462){logger[_0x170a('0x1c')](_0x170a('0x1d'),_0x240bbf,_0x170a('0x1e'));logger[_0x170a('0x1f')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x240bbf,_0x170a('0x1e'),JSON[_0x170a('0x20')](_0xd25462));if(_0xd25462[_0x170a('0x21')]){if(_0xd25462[_0x170a('0x21')][_0x170a('0x22')]===0x1f4){logger['error'](_0x170a('0x1d'),_0x240bbf,_0xd25462[_0x170a('0x21')]['message']);return _0x488137(_0xd25462[_0x170a('0x21')][_0x170a('0x23')]);}logger[_0x170a('0x21')](_0x170a('0x1d'),_0x240bbf,_0xd25462[_0x170a('0x21')][_0x170a('0x23')]);return _0x40bcc6(_0xd25462[_0x170a('0x21')][_0x170a('0x23')]);}else{logger[_0x170a('0x1c')](_0x170a('0x1d'),_0x240bbf,_0x170a('0x1e'));_0x40bcc6(_0xd25462[_0x170a('0x24')][_0x170a('0x23')]);}})[_0x170a('0x25')](function(_0x290330){logger[_0x170a('0x21')](_0x170a('0x1d'),_0x240bbf,_0x290330);_0x488137(_0x290330);});});}function respondWithStatusCode(_0x3d7008,_0x36c571){_0x36c571=_0x36c571||0xcc;return function(_0x459842){if(_0x459842){return _0x3d7008[_0x170a('0x26')](_0x36c571);}return _0x3d7008['status'](_0x36c571)[_0x170a('0x27')]();};}function respondWithResult(_0x485b7b,_0x2d9c8f){_0x2d9c8f=_0x2d9c8f||0xc8;return function(_0x3cada3){if(_0x3cada3){return _0x485b7b[_0x170a('0x28')](_0x2d9c8f)['json'](_0x3cada3);}};}function respondWithFilteredResult(_0x153edf,_0x3f540e){return function(_0x14b0f8){if(_0x14b0f8){var _0x2e14e5=typeof _0x3f540e[_0x170a('0x29')]===_0x170a('0x2a')&&typeof _0x3f540e[_0x170a('0x2b')]===_0x170a('0x2a');var _0xbf04bf=_0x14b0f8[_0x170a('0x2c')];var _0x5773be=_0x2e14e5?0x0:_0x3f540e['offset'];var _0x9a3ab2=_0x2e14e5?_0x14b0f8[_0x170a('0x2c')]:_0x3f540e['offset']+_0x3f540e['limit'];var _0x4a9b00;if(_0x9a3ab2>=_0xbf04bf){_0x9a3ab2=_0xbf04bf;_0x4a9b00=0xc8;}else{_0x4a9b00=0xce;}_0x153edf[_0x170a('0x28')](_0x4a9b00);return _0x153edf[_0x170a('0x2d')](_0x170a('0x2e'),_0x5773be+'-'+_0x9a3ab2+'/'+_0xbf04bf)[_0x170a('0x2f')](_0x14b0f8);}return null;};}function patchUpdates(_0x2c6681){return function(_0x4fde12){try{jsonpatch[_0x170a('0x30')](_0x4fde12,_0x2c6681,!![]);}catch(_0x5d8863){return BPromise[_0x170a('0x31')](_0x5d8863);}return _0x4fde12[_0x170a('0x32')]();};}function saveUpdates(_0x29f81b,_0xf2aa7b){return function(_0x959b51){if(_0x959b51){return _0x959b51[_0x170a('0x33')](_0x29f81b)['then'](function(_0x2c7001){return _0x2c7001;});}return null;};}function removeEntity(_0x2c75ad,_0x5d5b46){return function(_0x2964d9){if(_0x2964d9){return _0x2964d9[_0x170a('0x34')]()[_0x170a('0x1b')](function(){_0x2c75ad[_0x170a('0x28')](0xcc)[_0x170a('0x27')]();});}};}function handleEntityNotFound(_0x4f0bd7,_0x262459){return function(_0x12d396){if(!_0x12d396){_0x4f0bd7[_0x170a('0x26')](0x194);}return _0x12d396;};}function handleError(_0x1773e5,_0xcb33be){_0xcb33be=_0xcb33be||0x1f4;return function(_0x7c95c9){logger[_0x170a('0x21')](_0x7c95c9['stack']);if(_0x7c95c9[_0x170a('0x35')]){delete _0x7c95c9[_0x170a('0x35')];}_0x1773e5[_0x170a('0x28')](_0xcb33be)[_0x170a('0x36')](_0x7c95c9);};}function getMustacheRender(_0x5a7ef6,_0x5c4aed){return Mustache[_0x170a('0x37')](_0x5a7ef6,_[_0x170a('0x38')](_0x5c4aed['body'],{'contact':_0x5c4aed[_0x170a('0x39')],'message':_0x5c4aed[_0x170a('0x23')],'agent':_0x5c4aed[_0x170a('0x3a')],'interaction':_0x5c4aed[_0x170a('0x3b')],'account':_0x5c4aed['account']}))||'';}exports[_0x170a('0x3c')]=function(_0x1e2e3f,_0x15d267){var _0x2e087d={},_0x2852ae={},_0xda5555={'count':0x0,'rows':[]};var _0x3a5ed5=_[_0x170a('0x3d')](db[_0x170a('0x3e')][_0x170a('0x3f')],function(_0x15d9fe){return{'name':_0x15d9fe['fieldName'],'type':_0x15d9fe['type'][_0x170a('0x40')]};});_0x2852ae[_0x170a('0x41')]=_['map'](_0x3a5ed5,_0x170a('0x35'));_0x2852ae[_0x170a('0x42')]=_['keys'](_0x1e2e3f[_0x170a('0x42')]);_0x2852ae[_0x170a('0x43')]=_[_0x170a('0x44')](_0x2852ae[_0x170a('0x41')],_0x2852ae['query']);_0x2e087d['attributes']=_['intersection'](_0x2852ae[_0x170a('0x41')],qs[_0x170a('0x45')](_0x1e2e3f[_0x170a('0x42')][_0x170a('0x45')]));_0x2e087d[_0x170a('0x46')]=_0x2e087d[_0x170a('0x46')][_0x170a('0x47')]?_0x2e087d[_0x170a('0x46')]:_0x2852ae[_0x170a('0x41')];if(!_0x1e2e3f[_0x170a('0x42')][_0x170a('0x48')](_0x170a('0x49'))){_0x2e087d['limit']=qs[_0x170a('0x2b')](_0x1e2e3f['query'][_0x170a('0x2b')]);_0x2e087d[_0x170a('0x29')]=qs['offset'](_0x1e2e3f['query'][_0x170a('0x29')]);}_0x2e087d[_0x170a('0x4a')]=qs[_0x170a('0x4b')](_0x1e2e3f[_0x170a('0x42')][_0x170a('0x4b')]);_0x2e087d[_0x170a('0x4c')]=qs[_0x170a('0x43')](_[_0x170a('0x4d')](_0x1e2e3f[_0x170a('0x42')],_0x2852ae[_0x170a('0x43')]),_0x3a5ed5);if(_0x1e2e3f[_0x170a('0x42')][_0x170a('0x4e')]){_0x2e087d[_0x170a('0x4c')]=_[_0x170a('0x38')](_0x2e087d['where'],{'$or':_[_0x170a('0x3d')](_0x3a5ed5,function(_0x197c56){if(_0x197c56['type']!==_0x170a('0x4f')){var _0x33033c={};_0x33033c[_0x197c56[_0x170a('0x35')]]={'$like':'%'+_0x1e2e3f['query'][_0x170a('0x4e')]+'%'};return _0x33033c;}})});}_0x2e087d=_[_0x170a('0x38')]({},_0x2e087d,_0x1e2e3f[_0x170a('0x50')]);var _0x4d77e9={'where':_0x2e087d[_0x170a('0x4c')]};return db[_0x170a('0x3e')][_0x170a('0x2c')](_0x4d77e9)['then'](function(_0x2c1cdf){_0xda5555['count']=_0x2c1cdf;if(_0x1e2e3f[_0x170a('0x42')][_0x170a('0x51')]){_0x2e087d['include']=[{'all':!![]}];}return db[_0x170a('0x3e')]['findAll'](_0x2e087d);})['then'](function(_0x3fff1b){_0xda5555[_0x170a('0x52')]=_0x3fff1b;return _0xda5555;})[_0x170a('0x1b')](respondWithFilteredResult(_0x15d267,_0x2e087d))['catch'](handleError(_0x15d267,null));};exports[_0x170a('0x53')]=function(_0x33580e,_0x49670c){var _0x4a3df1={'raw':![],'where':{'id':_0x33580e[_0x170a('0x54')]['id']}},_0x2330c7={};_0x2330c7[_0x170a('0x41')]=_['keys'](db[_0x170a('0x3e')][_0x170a('0x3f')]);_0x2330c7[_0x170a('0x42')]=_[_0x170a('0x55')](_0x33580e['query']);_0x2330c7[_0x170a('0x43')]=_[_0x170a('0x44')](_0x2330c7['model'],_0x2330c7['query']);_0x4a3df1[_0x170a('0x46')]=_[_0x170a('0x44')](_0x2330c7['model'],qs[_0x170a('0x45')](_0x33580e['query'][_0x170a('0x45')]));_0x4a3df1['attributes']=_0x4a3df1[_0x170a('0x46')][_0x170a('0x47')]?_0x4a3df1['attributes']:_0x2330c7['model'];if(_0x33580e[_0x170a('0x42')][_0x170a('0x51')]){_0x4a3df1[_0x170a('0x56')]=[{'all':!![]}];}_0x4a3df1=_[_0x170a('0x38')]({},_0x4a3df1,_0x33580e[_0x170a('0x50')]);return db['ZohoAccount'][_0x170a('0x57')](_0x4a3df1)[_0x170a('0x1b')](handleEntityNotFound(_0x49670c,null))[_0x170a('0x1b')](respondWithResult(_0x49670c,null))['catch'](handleError(_0x49670c,null));};exports[_0x170a('0x58')]=function(_0x9f5ef3,_0x13c20a){return db['ZohoAccount'][_0x170a('0x58')](_0x9f5ef3[_0x170a('0x59')],{})[_0x170a('0x1b')](respondWithResult(_0x13c20a,0xc9))['catch'](handleError(_0x13c20a,null));};exports['update']=function(_0x2f017e,_0xbe4d){if(_0x2f017e['body']['id']){delete _0x2f017e[_0x170a('0x59')]['id'];}return db[_0x170a('0x3e')][_0x170a('0x57')]({'where':{'id':_0x2f017e['params']['id']}})[_0x170a('0x1b')](handleEntityNotFound(_0xbe4d,null))['then'](saveUpdates(_0x2f017e['body'],null))[_0x170a('0x1b')](respondWithResult(_0xbe4d,null))['catch'](handleError(_0xbe4d,null));};exports[_0x170a('0x34')]=function(_0x1c88ea,_0x52eb1b){return db[_0x170a('0x3e')][_0x170a('0x57')]({'where':{'id':_0x1c88ea[_0x170a('0x54')]['id']}})[_0x170a('0x1b')](handleEntityNotFound(_0x52eb1b,null))[_0x170a('0x1b')](removeEntity(_0x52eb1b,null))['catch'](handleError(_0x52eb1b,null));};exports[_0x170a('0x5a')]=function(_0x432996,_0x42e154,_0x22cfde){var _0x15e5be={};var _0xc93fe={};var _0x487b56;var _0x17d997;return db[_0x170a('0x3e')][_0x170a('0x5b')]({'where':{'id':_0x432996[_0x170a('0x54')]['id']}})['then'](handleEntityNotFound(_0x42e154,null))[_0x170a('0x1b')](function(_0x199d80){if(_0x199d80){_0x487b56=_0x199d80;_0xc93fe[_0x170a('0x41')]=_['keys'](db[_0x170a('0x5c')][_0x170a('0x3f')]);_0xc93fe[_0x170a('0x42')]=_['keys'](_0x432996['query']);_0xc93fe[_0x170a('0x43')]=_[_0x170a('0x44')](_0xc93fe[_0x170a('0x41')],_0xc93fe[_0x170a('0x42')]);_0x15e5be['attributes']=_[_0x170a('0x44')](_0xc93fe[_0x170a('0x41')],qs[_0x170a('0x45')](_0x432996[_0x170a('0x42')][_0x170a('0x45')]));_0x15e5be[_0x170a('0x46')]=_0x15e5be['attributes'][_0x170a('0x47')]?_0x15e5be['attributes']:_0xc93fe[_0x170a('0x41')];_0x15e5be[_0x170a('0x4a')]=qs[_0x170a('0x4b')](_0x432996[_0x170a('0x42')][_0x170a('0x4b')]);_0x15e5be['where']=qs['filters'](_[_0x170a('0x4d')](_0x432996[_0x170a('0x42')],_0xc93fe[_0x170a('0x43')]));if(_0x432996[_0x170a('0x42')][_0x170a('0x4e')]){_0x15e5be[_0x170a('0x4c')]=_[_0x170a('0x38')](_0x15e5be[_0x170a('0x4c')],{'$or':_[_0x170a('0x3d')](_0x15e5be[_0x170a('0x46')],function(_0xa8b4a8){var _0xa3f9cf={};_0xa3f9cf[_0xa8b4a8]={'$like':'%'+_0x432996[_0x170a('0x42')][_0x170a('0x4e')]+'%'};return _0xa3f9cf;})});}_0x15e5be=_['merge']({},_0x15e5be,_0x432996['options']);return _0x487b56[_0x170a('0x5a')](_0x15e5be);}})[_0x170a('0x1b')](function(_0x44e510){if(_0x44e510){_0x17d997=_0x44e510[_0x170a('0x47')];if(!_0x432996[_0x170a('0x42')][_0x170a('0x48')](_0x170a('0x49'))){_0x15e5be['limit']=qs['limit'](_0x432996[_0x170a('0x42')][_0x170a('0x2b')]);_0x15e5be[_0x170a('0x29')]=qs[_0x170a('0x29')](_0x432996[_0x170a('0x42')]['offset']);}return _0x487b56['getConfigurations'](_0x15e5be);}})[_0x170a('0x1b')](function(_0x3b1c08){if(_0x3b1c08){return _0x3b1c08?{'count':_0x17d997,'rows':_0x3b1c08}:null;}})[_0x170a('0x1b')](respondWithResult(_0x42e154,null))['catch'](handleError(_0x42e154,null));};exports[_0x170a('0x5d')]=function(_0x11ed64,_0x3eb616,_0x5a19ea){if(_0x11ed64[_0x170a('0x59')]['id']){delete _0x11ed64[_0x170a('0x59')]['id'];}return db[_0x170a('0x3e')][_0x170a('0x5b')]({'where':{'id':_0x11ed64['params']['id']}})['then'](handleEntityNotFound(_0x3eb616,null))['then'](function(_0x7b4e16){if(_0x7b4e16){_0x11ed64['body']['AccountId']=_0x7b4e16['id'];_0x11ed64[_0x170a('0x59')]['Subjects']=integrations[_0x170a('0x5e')](_0x11ed64[_0x170a('0x59')]['channel'],_0x11ed64['body'][_0x170a('0x5f')]);_0x11ed64['body'][_0x170a('0x60')]=integrations[_0x170a('0x61')](_0x11ed64[_0x170a('0x59')][_0x170a('0x62')],_0x11ed64[_0x170a('0x59')][_0x170a('0x5f')]);return db[_0x170a('0x5c')][_0x170a('0x58')](_0x11ed64['body'],{'include':[{'model':db[_0x170a('0x63')],'as':_0x170a('0x64')},{'model':db[_0x170a('0x63')],'as':_0x170a('0x60')}]});}return null;})[_0x170a('0x1b')](respondWithResult(_0x3eb616,null))[_0x170a('0x25')](handleError(_0x3eb616,null));};function getAccessToken(_0x5a8a7c){return new Promise(function(_0x513244,_0x178e8f){var _0x59dd71;switch(_0x5a8a7c['zone']){case'US':_0x59dd71='https://accounts.zoho.com';break;case'AU':_0x59dd71=_0x170a('0x65');break;case'EU':_0x59dd71=_0x170a('0x66');break;case'IN':_0x59dd71=_0x170a('0x67');break;case'CN':_0x59dd71='https://accounts.zoho.com.cn';break;default:_0x59dd71=_0x170a('0x66');break;}var _0x1282eb={'method':_0x170a('0x68'),'uri':_0x59dd71+_0x170a('0x69'),'qs':{'refresh_token':_0x5a8a7c[_0x170a('0x6a')],'client_id':_0x5a8a7c['clientId'],'client_secret':_0x5a8a7c[_0x170a('0x6b')],'grant_type':_0x170a('0x6c')},'json':!![]};return rp(_0x1282eb)[_0x170a('0x1b')](function(_0x32f6c3){if(_0x32f6c3[_0x170a('0x6d')]){_0x513244(_0x32f6c3['access_token']);}else{_0x178e8f(_0x170a('0x6e'));}})['catch'](function(_0x25ef0a){_0x178e8f(_0x25ef0a);});});}exports[_0x170a('0x6f')]=function(_0x149255,_0x1c8add,_0x43678e){var _0x3db890,_0x1f5c66,_0x5098e8,_0x3efc16,_0x32d6d4;return db[_0x170a('0x3e')][_0x170a('0x5b')]({'where':{'id':_0x149255[_0x170a('0x54')]['id']},'attributes':['id','host','zone',_0x170a('0x70'),_0x170a('0x6b'),_0x170a('0x71'),_0x170a('0x22'),_0x170a('0x6a')]})['then'](handleEntityNotFound(_0x1c8add,null))[_0x170a('0x1b')](function(_0x1cfe30){_0x32d6d4=_0x1cfe30;_0x3db890=_0x32d6d4[_0x170a('0x72')];_0x1f5c66=_0x3db890===_0x170a('0x73')?'eu':'com';_0x5098e8=_0x32d6d4[_0x170a('0x71')];var _0x2e67bd=_0x5098e8[_0x170a('0x74')](-0x1);if(_0x2e67bd==='/'||_0x2e67bd==='\x5c'||_0x2e67bd===':'){_0x5098e8=_0x5098e8['substring'](0x0,_0x5098e8[_0x170a('0x75')](_0x2e67bd));}if(!_0x32d6d4[_0x170a('0x6a')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x32d6d4);})[_0x170a('0x1b')](function(_0x54f2f0){if(_0x54f2f0){return rp({'method':_0x170a('0x76'),'uri':util['format'](_0x170a('0x77'),_0x1f5c66),'qs':{'module':_0x170a('0x78')},'headers':{'Authorization':_0x170a('0x79')+_0x54f2f0},'json':!![]});}})[_0x170a('0x1b')](function(_0x5ac621){if(_0x5ac621){if(_0x5ac621[_0x170a('0x7a')]&&_0x5ac621[_0x170a('0x7a')]['error']){throw new Error(_0x5ac621[_0x170a('0x7a')]['error'][_0x170a('0x23')]);}var _0x131494=[];var _0x1eb45d=[];var _0x3c604a=[_0x170a('0x7b'),_0x170a('0x7c'),_0x170a('0x7d'),_0x170a('0x7e'),_0x170a('0x7f'),_0x170a('0x80'),'Call_Start_Time',_0x170a('0x81')];_0x1eb45d=_['remove'](_0x5ac621[_0x170a('0x45')],function(_0x4f9b59){return _0x3c604a['includes'](_0x4f9b59['api_name']);});for(var _0x318aa2=0x0;_0x318aa2<_0x1eb45d['length'];_0x318aa2++){if(_0x1eb45d[_0x318aa2]['system_mandatory']===![]){_0x131494[_0x170a('0x82')]({'id':_0x1eb45d[_0x318aa2]['id'],'name':_0x1eb45d[_0x318aa2][_0x170a('0x83')],'custom':_0x1eb45d[_0x318aa2][_0x170a('0x84')],'options':_0x1eb45d[_0x318aa2][_0x170a('0x85')]===_0x170a('0x86')&&_0x1eb45d[_0x318aa2][_0x170a('0x87')][_0x170a('0x47')]>-0x1?_[_0x170a('0x3d')](_0x1eb45d[_0x318aa2][_0x170a('0x87')],function(_0x5161b9){return{'name':_0x5161b9,'value':_0x5161b9};}):[]});}}return{'count':_0x131494[_0x170a('0x47')],'rows':_0x131494};}else{return{'count':0x0,'rows':[]};}})[_0x170a('0x1b')](respondWithResult(_0x1c8add,null))[_0x170a('0x25')](function(_0x38a432){var _0x35459b=_0x149255[_0x170a('0x42')]['test']?0x1f4:_0x38a432[_0x170a('0x88')]||0x1f4;logger[_0x170a('0x21')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x35459b,JSON[_0x170a('0x20')](_0x38a432));delete _0x38a432['name'];if(_0x35459b===0x191){_0x35459b=0x190;}_0x1c8add[_0x170a('0x28')](_0x35459b)[_0x170a('0x36')](_0x149255['query'][_0x170a('0x89')]?{'message':'Wrong\x20credentials','statusCode':_0x38a432[_0x170a('0x88')]}:_0x38a432);});}; \ No newline at end of file +var _0x6315=['status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','end','sendStatus','stack','name','send','render','merge','contact','interaction','account','index','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','filter','map','VIRTUAL','ZohoAccount','includeAll','findAll','rows','show','length','options','find','create','body','update','params','findOne','ZohoConfiguration','sort','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','clientId','serverUrl','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','api_name','push','custom_field','data_type','picklist','pick_list_values','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch'];(function(_0x4fe01f,_0xa2709e){var _0x32943c=function(_0x2b1afd){while(--_0x2b1afd){_0x4fe01f['push'](_0x4fe01f['shift']());}};_0x32943c(++_0xa2709e);}(_0x6315,0x65));var _0x5631=function(_0x15adc1,_0x887aa2){_0x15adc1=_0x15adc1-0x0;var _0x17d6c9=_0x6315[_0x15adc1];return _0x17d6c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5631('0x0'));var zipdir=require(_0x5631('0x1'));var jsonpatch=require(_0x5631('0x2'));var rp=require(_0x5631('0x3'));var moment=require(_0x5631('0x4'));var BPromise=require(_0x5631('0x5'));var Mustache=require(_0x5631('0x6'));var util=require(_0x5631('0x7'));var path=require(_0x5631('0x8'));var sox=require(_0x5631('0x9'));var csv=require(_0x5631('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5631('0xb'));var _=require(_0x5631('0xc'));var squel=require('squel');var crypto=require(_0x5631('0xd'));var jsforce=require(_0x5631('0xe'));var deskjs=require(_0x5631('0xf'));var toCsv=require(_0x5631('0xa'));var querystring=require(_0x5631('0x10'));var Papa=require(_0x5631('0x11'));var Redis=require('ioredis');var authService=require(_0x5631('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5631('0x13'));var hardwareService=require(_0x5631('0x14'));var logger=require(_0x5631('0x15'))(_0x5631('0x16'));var utils=require('../../config/utils');var config=require(_0x5631('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x5631('0x18'));var jayson=require(_0x5631('0x19'));var client=jayson[_0x5631('0x1a')][_0x5631('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3470de,_0x3d68f5,_0x5b7114,_0xe651f2){return new BPromise(function(_0x1e7849,_0x1a1004){var _0x18b892=_0xe651f2||client;return _0x18b892[_0x5631('0x1c')](_0x3470de,_0x5b7114)[_0x5631('0x1d')](function(_0x349903){logger['info'](_0x5631('0x1e'),_0x3d68f5,'request\x20sent');logger[_0x5631('0x1f')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3d68f5,'request\x20sent',JSON[_0x5631('0x20')](_0x349903));if(_0x349903[_0x5631('0x21')]){if(_0x349903['error'][_0x5631('0x22')]===0x1f4){logger[_0x5631('0x21')](_0x5631('0x1e'),_0x3d68f5,_0x349903[_0x5631('0x21')][_0x5631('0x23')]);return _0x1a1004(_0x349903['error'][_0x5631('0x23')]);}logger[_0x5631('0x21')](_0x5631('0x1e'),_0x3d68f5,_0x349903[_0x5631('0x21')][_0x5631('0x23')]);return _0x1e7849(_0x349903[_0x5631('0x21')]['message']);}else{logger[_0x5631('0x24')](_0x5631('0x1e'),_0x3d68f5,_0x5631('0x25'));_0x1e7849(_0x349903[_0x5631('0x26')][_0x5631('0x23')]);}})[_0x5631('0x27')](function(_0x36c5f4){logger[_0x5631('0x21')](_0x5631('0x1e'),_0x3d68f5,_0x36c5f4);_0x1a1004(_0x36c5f4);});});}function respondWithStatusCode(_0x2403c9,_0x898b14){_0x898b14=_0x898b14||0xcc;return function(_0x2bd698){if(_0x2bd698){return _0x2403c9['sendStatus'](_0x898b14);}return _0x2403c9[_0x5631('0x28')](_0x898b14)['end']();};}function respondWithResult(_0x5671a8,_0x23bd22){_0x23bd22=_0x23bd22||0xc8;return function(_0x5dd1c1){if(_0x5dd1c1){return _0x5671a8['status'](_0x23bd22)[_0x5631('0x29')](_0x5dd1c1);}};}function respondWithFilteredResult(_0x472609,_0x179d15){return function(_0x599b9a){if(_0x599b9a){var _0x27f456=typeof _0x179d15[_0x5631('0x2a')]===_0x5631('0x2b')&&typeof _0x179d15[_0x5631('0x2c')]==='undefined';var _0x15e37c=_0x599b9a[_0x5631('0x2d')];var _0x234236=_0x27f456?0x0:_0x179d15['offset'];var _0x473234=_0x27f456?_0x599b9a[_0x5631('0x2d')]:_0x179d15[_0x5631('0x2a')]+_0x179d15[_0x5631('0x2c')];var _0x2a1661;if(_0x473234>=_0x15e37c){_0x473234=_0x15e37c;_0x2a1661=0xc8;}else{_0x2a1661=0xce;}_0x472609[_0x5631('0x28')](_0x2a1661);return _0x472609[_0x5631('0x2e')]('Content-Range',_0x234236+'-'+_0x473234+'/'+_0x15e37c)[_0x5631('0x29')](_0x599b9a);}return null;};}function patchUpdates(_0x1b5939){return function(_0x3aa2a1){try{jsonpatch[_0x5631('0x2f')](_0x3aa2a1,_0x1b5939,!![]);}catch(_0x3f40b4){return BPromise[_0x5631('0x30')](_0x3f40b4);}return _0x3aa2a1[_0x5631('0x31')]();};}function saveUpdates(_0x589510,_0xb330cd){return function(_0x36963c){if(_0x36963c){return _0x36963c['update'](_0x589510)[_0x5631('0x1d')](function(_0x5922e9){return _0x5922e9;});}return null;};}function removeEntity(_0x79d91,_0x42aa53){return function(_0x4b836d){if(_0x4b836d){return _0x4b836d[_0x5631('0x32')]()[_0x5631('0x1d')](function(){_0x79d91[_0x5631('0x28')](0xcc)[_0x5631('0x33')]();});}};}function handleEntityNotFound(_0x44482c,_0x2970a9){return function(_0x37aa41){if(!_0x37aa41){_0x44482c[_0x5631('0x34')](0x194);}return _0x37aa41;};}function handleError(_0x5b8ea6,_0x105e73){_0x105e73=_0x105e73||0x1f4;return function(_0x475965){logger[_0x5631('0x21')](_0x475965[_0x5631('0x35')]);if(_0x475965['name']){delete _0x475965[_0x5631('0x36')];}_0x5b8ea6[_0x5631('0x28')](_0x105e73)[_0x5631('0x37')](_0x475965);};}function getMustacheRender(_0x22d29e,_0x307e04){return Mustache[_0x5631('0x38')](_0x22d29e,_[_0x5631('0x39')](_0x307e04['body'],{'contact':_0x307e04[_0x5631('0x3a')],'message':_0x307e04['message'],'agent':_0x307e04['agent'],'interaction':_0x307e04[_0x5631('0x3b')],'account':_0x307e04[_0x5631('0x3c')]}))||'';}exports[_0x5631('0x3d')]=function(_0x4d7711,_0x34ebc4){var _0x2d69ce={},_0x5738c0={},_0x1ac75f={'count':0x0,'rows':[]};var _0xe3c03b=_['map'](db['ZohoAccount'][_0x5631('0x3e')],function(_0x4a6213){return{'name':_0x4a6213[_0x5631('0x3f')],'type':_0x4a6213[_0x5631('0x40')]['key']};});_0x5738c0[_0x5631('0x41')]=_['map'](_0xe3c03b,_0x5631('0x36'));_0x5738c0[_0x5631('0x42')]=_[_0x5631('0x43')](_0x4d7711[_0x5631('0x42')]);_0x5738c0['filters']=_[_0x5631('0x44')](_0x5738c0['model'],_0x5738c0[_0x5631('0x42')]);_0x2d69ce[_0x5631('0x45')]=_['intersection'](_0x5738c0[_0x5631('0x41')],qs[_0x5631('0x46')](_0x4d7711[_0x5631('0x42')][_0x5631('0x46')]));_0x2d69ce[_0x5631('0x45')]=_0x2d69ce[_0x5631('0x45')]['length']?_0x2d69ce[_0x5631('0x45')]:_0x5738c0['model'];if(!_0x4d7711[_0x5631('0x42')][_0x5631('0x47')](_0x5631('0x48'))){_0x2d69ce['limit']=qs['limit'](_0x4d7711['query']['limit']);_0x2d69ce[_0x5631('0x2a')]=qs[_0x5631('0x2a')](_0x4d7711['query']['offset']);}_0x2d69ce[_0x5631('0x49')]=qs['sort'](_0x4d7711[_0x5631('0x42')]['sort']);_0x2d69ce[_0x5631('0x4a')]=qs[_0x5631('0x4b')](_['pick'](_0x4d7711[_0x5631('0x42')],_0x5738c0[_0x5631('0x4b')]),_0xe3c03b);if(_0x4d7711[_0x5631('0x42')][_0x5631('0x4c')]){_0x2d69ce[_0x5631('0x4a')]=_[_0x5631('0x39')](_0x2d69ce['where'],{'$or':_[_0x5631('0x4d')](_0xe3c03b,function(_0xfb7ad6){if(_0xfb7ad6[_0x5631('0x40')]!==_0x5631('0x4e')){var _0x22e33a={};_0x22e33a[_0xfb7ad6[_0x5631('0x36')]]={'$like':'%'+_0x4d7711[_0x5631('0x42')]['filter']+'%'};return _0x22e33a;}})});}_0x2d69ce=_[_0x5631('0x39')]({},_0x2d69ce,_0x4d7711['options']);var _0x349d9a={'where':_0x2d69ce[_0x5631('0x4a')]};return db[_0x5631('0x4f')][_0x5631('0x2d')](_0x349d9a)[_0x5631('0x1d')](function(_0x2c0d39){_0x1ac75f[_0x5631('0x2d')]=_0x2c0d39;if(_0x4d7711[_0x5631('0x42')][_0x5631('0x50')]){_0x2d69ce['include']=[{'all':!![]}];}return db[_0x5631('0x4f')][_0x5631('0x51')](_0x2d69ce);})[_0x5631('0x1d')](function(_0x4ce65b){_0x1ac75f[_0x5631('0x52')]=_0x4ce65b;return _0x1ac75f;})['then'](respondWithFilteredResult(_0x34ebc4,_0x2d69ce))[_0x5631('0x27')](handleError(_0x34ebc4,null));};exports[_0x5631('0x53')]=function(_0x2db9cc,_0x4d6f00){var _0xf21b42={'raw':![],'where':{'id':_0x2db9cc['params']['id']}},_0x4f4aac={};_0x4f4aac['model']=_[_0x5631('0x43')](db[_0x5631('0x4f')][_0x5631('0x3e')]);_0x4f4aac[_0x5631('0x42')]=_[_0x5631('0x43')](_0x2db9cc[_0x5631('0x42')]);_0x4f4aac[_0x5631('0x4b')]=_[_0x5631('0x44')](_0x4f4aac[_0x5631('0x41')],_0x4f4aac[_0x5631('0x42')]);_0xf21b42['attributes']=_[_0x5631('0x44')](_0x4f4aac[_0x5631('0x41')],qs[_0x5631('0x46')](_0x2db9cc[_0x5631('0x42')][_0x5631('0x46')]));_0xf21b42[_0x5631('0x45')]=_0xf21b42[_0x5631('0x45')][_0x5631('0x54')]?_0xf21b42[_0x5631('0x45')]:_0x4f4aac['model'];if(_0x2db9cc[_0x5631('0x42')][_0x5631('0x50')]){_0xf21b42['include']=[{'all':!![]}];}_0xf21b42=_[_0x5631('0x39')]({},_0xf21b42,_0x2db9cc[_0x5631('0x55')]);return db[_0x5631('0x4f')][_0x5631('0x56')](_0xf21b42)['then'](handleEntityNotFound(_0x4d6f00,null))[_0x5631('0x1d')](respondWithResult(_0x4d6f00,null))[_0x5631('0x27')](handleError(_0x4d6f00,null));};exports[_0x5631('0x57')]=function(_0x3cd75f,_0x1ff38e){return db[_0x5631('0x4f')][_0x5631('0x57')](_0x3cd75f[_0x5631('0x58')],{})[_0x5631('0x1d')](respondWithResult(_0x1ff38e,0xc9))[_0x5631('0x27')](handleError(_0x1ff38e,null));};exports[_0x5631('0x59')]=function(_0x426732,_0x2c9712){if(_0x426732[_0x5631('0x58')]['id']){delete _0x426732['body']['id'];}return db[_0x5631('0x4f')][_0x5631('0x56')]({'where':{'id':_0x426732[_0x5631('0x5a')]['id']}})[_0x5631('0x1d')](handleEntityNotFound(_0x2c9712,null))[_0x5631('0x1d')](saveUpdates(_0x426732['body'],null))[_0x5631('0x1d')](respondWithResult(_0x2c9712,null))[_0x5631('0x27')](handleError(_0x2c9712,null));};exports[_0x5631('0x32')]=function(_0x2e2b9e,_0x1c1764){return db[_0x5631('0x4f')][_0x5631('0x56')]({'where':{'id':_0x2e2b9e[_0x5631('0x5a')]['id']}})[_0x5631('0x1d')](handleEntityNotFound(_0x1c1764,null))[_0x5631('0x1d')](removeEntity(_0x1c1764,null))[_0x5631('0x27')](handleError(_0x1c1764,null));};exports['getConfigurations']=function(_0x338159,_0x271e64,_0x19bd36){var _0x18bd42={};var _0x1ce1c4={};var _0x15068e;var _0x2aaeb1;return db[_0x5631('0x4f')][_0x5631('0x5b')]({'where':{'id':_0x338159[_0x5631('0x5a')]['id']}})['then'](handleEntityNotFound(_0x271e64,null))[_0x5631('0x1d')](function(_0x44fd49){if(_0x44fd49){_0x15068e=_0x44fd49;_0x1ce1c4[_0x5631('0x41')]=_[_0x5631('0x43')](db[_0x5631('0x5c')]['rawAttributes']);_0x1ce1c4[_0x5631('0x42')]=_[_0x5631('0x43')](_0x338159['query']);_0x1ce1c4['filters']=_['intersection'](_0x1ce1c4[_0x5631('0x41')],_0x1ce1c4[_0x5631('0x42')]);_0x18bd42[_0x5631('0x45')]=_[_0x5631('0x44')](_0x1ce1c4[_0x5631('0x41')],qs[_0x5631('0x46')](_0x338159[_0x5631('0x42')][_0x5631('0x46')]));_0x18bd42['attributes']=_0x18bd42[_0x5631('0x45')][_0x5631('0x54')]?_0x18bd42[_0x5631('0x45')]:_0x1ce1c4['model'];_0x18bd42['order']=qs[_0x5631('0x5d')](_0x338159['query'][_0x5631('0x5d')]);_0x18bd42[_0x5631('0x4a')]=qs[_0x5631('0x4b')](_['pick'](_0x338159[_0x5631('0x42')],_0x1ce1c4[_0x5631('0x4b')]));if(_0x338159[_0x5631('0x42')][_0x5631('0x4c')]){_0x18bd42[_0x5631('0x4a')]=_[_0x5631('0x39')](_0x18bd42[_0x5631('0x4a')],{'$or':_['map'](_0x18bd42[_0x5631('0x45')],function(_0x221250){var _0x3e38a2={};_0x3e38a2[_0x221250]={'$like':'%'+_0x338159[_0x5631('0x42')][_0x5631('0x4c')]+'%'};return _0x3e38a2;})});}_0x18bd42=_[_0x5631('0x39')]({},_0x18bd42,_0x338159[_0x5631('0x55')]);return _0x15068e[_0x5631('0x5e')](_0x18bd42);}})[_0x5631('0x1d')](function(_0x16860a){if(_0x16860a){_0x2aaeb1=_0x16860a[_0x5631('0x54')];if(!_0x338159[_0x5631('0x42')][_0x5631('0x47')](_0x5631('0x48'))){_0x18bd42['limit']=qs[_0x5631('0x2c')](_0x338159[_0x5631('0x42')][_0x5631('0x2c')]);_0x18bd42['offset']=qs[_0x5631('0x2a')](_0x338159['query']['offset']);}return _0x15068e['getConfigurations'](_0x18bd42);}})[_0x5631('0x1d')](function(_0x822be){if(_0x822be){return _0x822be?{'count':_0x2aaeb1,'rows':_0x822be}:null;}})[_0x5631('0x1d')](respondWithResult(_0x271e64,null))[_0x5631('0x27')](handleError(_0x271e64,null));};exports[_0x5631('0x5f')]=function(_0x143001,_0x4d179f,_0x20527d){if(_0x143001[_0x5631('0x58')]['id']){delete _0x143001['body']['id'];}return db[_0x5631('0x4f')][_0x5631('0x5b')]({'where':{'id':_0x143001[_0x5631('0x5a')]['id']}})[_0x5631('0x1d')](handleEntityNotFound(_0x4d179f,null))[_0x5631('0x1d')](function(_0x5e8f9a){if(_0x5e8f9a){_0x143001[_0x5631('0x58')][_0x5631('0x60')]=_0x5e8f9a['id'];_0x143001[_0x5631('0x58')]['Subjects']=integrations[_0x5631('0x61')](_0x143001[_0x5631('0x58')][_0x5631('0x62')],_0x143001[_0x5631('0x58')][_0x5631('0x40')]);_0x143001[_0x5631('0x58')][_0x5631('0x63')]=integrations[_0x5631('0x64')](_0x143001[_0x5631('0x58')][_0x5631('0x62')],_0x143001[_0x5631('0x58')][_0x5631('0x40')]);return db[_0x5631('0x5c')][_0x5631('0x57')](_0x143001[_0x5631('0x58')],{'include':[{'model':db['ZohoField'],'as':_0x5631('0x65')},{'model':db[_0x5631('0x66')],'as':'Descriptions'}]});}return null;})[_0x5631('0x1d')](respondWithResult(_0x4d179f,null))[_0x5631('0x27')](handleError(_0x4d179f,null));};function getAccessToken(_0x39a51f){return new Promise(function(_0x4029b8,_0x3f7c1a){var _0x18a00d;switch(_0x39a51f['zone']){case'US':_0x18a00d=_0x5631('0x67');break;case'AU':_0x18a00d=_0x5631('0x68');break;case'EU':_0x18a00d=_0x5631('0x69');break;case'IN':_0x18a00d='https://accounts.zoho.in';break;case'CN':_0x18a00d=_0x5631('0x6a');break;default:_0x18a00d=_0x5631('0x69');break;}var _0x2a0569={'method':_0x5631('0x6b'),'uri':_0x18a00d+'/oauth/v2/token','qs':{'refresh_token':_0x39a51f[_0x5631('0x6c')],'client_id':_0x39a51f['clientId'],'client_secret':_0x39a51f[_0x5631('0x6d')],'grant_type':_0x5631('0x6e')},'json':!![]};return rp(_0x2a0569)[_0x5631('0x1d')](function(_0x13988d){if(_0x13988d['access_token']){_0x4029b8(_0x13988d[_0x5631('0x6f')]);}else{_0x3f7c1a(_0x5631('0x70'));}})[_0x5631('0x27')](function(_0x2bc869){_0x3f7c1a(_0x2bc869);});});}exports[_0x5631('0x71')]=function(_0xee7751,_0x3b1ee3,_0x443c57){var _0x1d9a11,_0x2a9593,_0x15501d,_0xb79363,_0x25d9c1;return db['ZohoAccount'][_0x5631('0x5b')]({'where':{'id':_0xee7751[_0x5631('0x5a')]['id']},'attributes':['id',_0x5631('0x72'),_0x5631('0x73'),_0x5631('0x74'),'clientSecret',_0x5631('0x75'),_0x5631('0x22'),'refreshToken']})[_0x5631('0x1d')](handleEntityNotFound(_0x3b1ee3,null))[_0x5631('0x1d')](function(_0xf67325){_0x25d9c1=_0xf67325;_0x1d9a11=_0x25d9c1[_0x5631('0x72')];_0x2a9593=_0x1d9a11===_0x5631('0x76')?'eu':_0x5631('0x77');_0x15501d=_0x25d9c1[_0x5631('0x75')];var _0x3ce61e=_0x15501d[_0x5631('0x78')](-0x1);if(_0x3ce61e==='/'||_0x3ce61e==='\x5c'||_0x3ce61e===':'){_0x15501d=_0x15501d['substring'](0x0,_0x15501d[_0x5631('0x79')](_0x3ce61e));}if(!_0x25d9c1['refreshToken']){throw new Error(_0x5631('0x7a'));}return getAccessToken(_0x25d9c1);})[_0x5631('0x1d')](function(_0x38eca2){if(_0x38eca2){return rp({'method':'GET','uri':util[_0x5631('0x7b')](_0x5631('0x7c'),_0x2a9593),'qs':{'module':_0x5631('0x7d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x38eca2},'json':!![]});}})['then'](function(_0x38289e){if(_0x38289e){if(_0x38289e[_0x5631('0x7e')]&&_0x38289e[_0x5631('0x7e')][_0x5631('0x21')]){throw new Error(_0x38289e[_0x5631('0x7e')][_0x5631('0x21')][_0x5631('0x23')]);}var _0x110e7a=[];var _0x242a05=[];var _0x209c04=['Owner',_0x5631('0x7f'),_0x5631('0x80'),'WhoId',_0x5631('0x81'),_0x5631('0x82'),_0x5631('0x83'),_0x5631('0x84')];_0x242a05=_['remove'](_0x38289e[_0x5631('0x46')],function(_0x3ffa67){return _0x209c04['includes'](_0x3ffa67[_0x5631('0x85')]);});for(var _0x6f2fa7=0x0;_0x6f2fa7<_0x242a05[_0x5631('0x54')];_0x6f2fa7++){if(_0x242a05[_0x6f2fa7]['system_mandatory']===![]){_0x110e7a[_0x5631('0x86')]({'id':_0x242a05[_0x6f2fa7]['id'],'name':_0x242a05[_0x6f2fa7]['display_label'],'custom':_0x242a05[_0x6f2fa7][_0x5631('0x87')],'options':_0x242a05[_0x6f2fa7][_0x5631('0x88')]===_0x5631('0x89')&&_0x242a05[_0x6f2fa7][_0x5631('0x8a')][_0x5631('0x54')]>-0x1?_['map'](_0x242a05[_0x6f2fa7][_0x5631('0x8a')],function(_0x3f947c){return{'name':_0x3f947c,'value':_0x3f947c};}):[]});}}return{'count':_0x110e7a[_0x5631('0x54')],'rows':_0x110e7a};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3b1ee3,null))[_0x5631('0x27')](function(_0x317327){var _0x4aaf7b=_0xee7751[_0x5631('0x42')][_0x5631('0x8b')]?0x1f4:_0x317327['statusCode']||0x1f4;logger[_0x5631('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x5631('0x71'),_0x4aaf7b,JSON[_0x5631('0x20')](_0x317327));delete _0x317327[_0x5631('0x36')];if(_0x4aaf7b===0x191){_0x4aaf7b=0x190;}_0x3b1ee3[_0x5631('0x28')](_0x4aaf7b)[_0x5631('0x37')](_0xee7751[_0x5631('0x42')][_0x5631('0x8b')]?{'message':_0x5631('0x8c'),'statusCode':_0x317327['statusCode']}:_0x317327);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ffffb98..3047cd0 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 _0x43fa=['https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','serverUrl','application/x-www-form-urlencoded','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','error','lastIndexOf','https://accounts.zoho.eu','POST','then','parse','catch','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','clientId','clientSecret','code','host','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x43fa,0x1cc));var _0xa43f=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x43fa[_0x33554b];return _0x256954;};'use strict';var _=require(_0xa43f('0x0'));var util=require(_0xa43f('0x1'));var logger=require('../../config/logger')(_0xa43f('0x2'));var moment=require(_0xa43f('0x3'));var BPromise=require(_0xa43f('0x4'));var rp=require(_0xa43f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa43f('0x6'));var config=require(_0xa43f('0x7'));var attributes=require(_0xa43f('0x8'));var integrations=require(_0xa43f('0x9'));module[_0xa43f('0xa')]=function(_0x1bccaa,_0x262ccd){return _0x1bccaa[_0xa43f('0xb')](_0xa43f('0xc'),attributes,{'tableName':_0xa43f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4db5b7,_0x309d0f,_0x48944c){if(_0x4db5b7['changed'](_0xa43f('0xe'))||_0x4db5b7[_0xa43f('0xf')]('serverUrl')||_0x4db5b7['changed'](_0xa43f('0x10'))||_0x4db5b7[_0xa43f('0xf')](_0xa43f('0x11'))||_0x4db5b7[_0xa43f('0xf')](_0xa43f('0x12'))||_0x4db5b7[_0xa43f('0xf')](_0xa43f('0x13'))){var _0x218f62,_0x3b6347;_0x218f62=_0x4db5b7['serverUrl'];var _0x247bfa=_0x218f62['slice'](-0x1);if(_0x247bfa==='/'||_0x247bfa==='\x5c'||_0x247bfa===':'){_0x218f62=_0x218f62[_0xa43f('0x14')](0x0,_0x218f62['lastIndexOf'](_0x247bfa));}switch(_0x4db5b7[_0xa43f('0xe')]){case'US':_0x3b6347=_0xa43f('0x15');break;case'AU':_0x3b6347=_0xa43f('0x16');break;case'IN':_0x3b6347=_0xa43f('0x17');break;case'CN':_0x3b6347=_0xa43f('0x18');break;default:_0x3b6347='https://accounts.zoho.eu';break;}var _0x578f09={'method':'POST','uri':_0x3b6347+_0xa43f('0x19'),'form':{'grant_type':_0xa43f('0x1a'),'client_id':_0x4db5b7[_0xa43f('0x10')],'client_secret':_0x4db5b7[_0xa43f('0x11')],'redirect_uri':_0x4db5b7[_0xa43f('0x1b')],'code':_0x4db5b7[_0xa43f('0x12')]},'headers':{'Content-Type':_0xa43f('0x1c')}};return rp(_0x578f09)['then'](function(_0x453372){var _0x22804f=JSON['parse'](_0x453372);if(_0x22804f[_0xa43f('0x1d')]){_0x4db5b7[_0xa43f('0x1e')]=_0x22804f['refresh_token'];logger[_0xa43f('0x1f')](util[_0xa43f('0x20')](_0xa43f('0x21'),_0x4db5b7[_0xa43f('0x22')],_0x4db5b7['id']));}else{logger['error'](util[_0xa43f('0x20')](_0xa43f('0x23'),_0x4db5b7['name'],_0x4db5b7['id']),util[_0xa43f('0x24')](_0x22804f,{'showHidden':![],'depth':null}));}return _0x48944c(null,_0x309d0f);})['catch'](function(_0x36f01e){logger[_0xa43f('0x25')](util[_0xa43f('0x20')](_0xa43f('0x23'),_0x4db5b7[_0xa43f('0x22')],_0x4db5b7['id']),util[_0xa43f('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x48944c(_0x36f01e);});}else{return _0x48944c(null,_0x309d0f);}},'beforeUpdate':function(_0x1bd5a9,_0x5f11ab,_0x4d6290){if(_0x1bd5a9[_0xa43f('0xf')](_0xa43f('0xe'))||_0x1bd5a9[_0xa43f('0xf')]('serverUrl')||_0x1bd5a9[_0xa43f('0xf')](_0xa43f('0x10'))||_0x1bd5a9[_0xa43f('0xf')](_0xa43f('0x11'))||_0x1bd5a9['changed']('code')||_0x1bd5a9[_0xa43f('0xf')](_0xa43f('0x13'))){var _0x42470e,_0x7e6b5d;_0x42470e=_0x1bd5a9['serverUrl'];var _0x2ac8c6=_0x42470e['slice'](-0x1);if(_0x2ac8c6==='/'||_0x2ac8c6==='\x5c'||_0x2ac8c6===':'){_0x42470e=_0x42470e['substring'](0x0,_0x42470e[_0xa43f('0x26')](_0x2ac8c6));}switch(_0x1bd5a9[_0xa43f('0xe')]){case'US':_0x7e6b5d=_0xa43f('0x15');break;case'AU':_0x7e6b5d=_0xa43f('0x16');break;case'IN':_0x7e6b5d=_0xa43f('0x17');break;case'CN':_0x7e6b5d='https://accounts.zoho.com.cn';break;default:_0x7e6b5d=_0xa43f('0x27');break;}var _0x3ed032={'method':_0xa43f('0x28'),'uri':_0x7e6b5d+_0xa43f('0x19'),'form':{'grant_type':_0xa43f('0x1a'),'client_id':_0x1bd5a9['clientId'],'client_secret':_0x1bd5a9['clientSecret'],'redirect_uri':_0x1bd5a9[_0xa43f('0x1b')],'code':_0x1bd5a9[_0xa43f('0x12')]},'headers':{'Content-Type':_0xa43f('0x1c')}};return rp(_0x3ed032)[_0xa43f('0x29')](function(_0xabe3b9){var _0x42bfab=JSON[_0xa43f('0x2a')](_0xabe3b9);if(_0x42bfab[_0xa43f('0x1d')]){_0x1bd5a9[_0xa43f('0x1e')]=_0x42bfab[_0xa43f('0x1d')];logger[_0xa43f('0x1f')](util['format'](_0xa43f('0x21'),_0x1bd5a9['name'],_0x1bd5a9['id']));}else{logger[_0xa43f('0x25')](util['format'](_0xa43f('0x23'),_0x1bd5a9[_0xa43f('0x22')],_0x1bd5a9['id']),util['inspect'](_0x42bfab,{'showHidden':![],'depth':null}));}return _0x4d6290(null,_0x5f11ab);})[_0xa43f('0x2b')](function(_0x14836b){logger[_0xa43f('0x25')](util[_0xa43f('0x20')](_0xa43f('0x23'),_0x1bd5a9[_0xa43f('0x22')],_0x1bd5a9['id']),util[_0xa43f('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x4d6290(_0x14836b);});}else{return _0x4d6290(null,_0x5f11ab);}}}});}; \ No newline at end of file +var _0xa650=['ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','authorization_code','clientId','clientSecret','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','https://accounts.zoho.eu','application/x-www-form-urlencoded','then','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x62acd5,_0x4ddb49){var _0x227ab4=function(_0x24fb97){while(--_0x24fb97){_0x62acd5['push'](_0x62acd5['shift']());}};_0x227ab4(++_0x4ddb49);}(_0xa650,0x16f));var _0x0a65=function(_0x448491,_0x2a32ae){_0x448491=_0x448491-0x0;var _0x10f0d2=_0xa650[_0x448491];return _0x10f0d2;};'use strict';var _=require(_0x0a65('0x0'));var util=require(_0x0a65('0x1'));var logger=require(_0x0a65('0x2'))('api');var moment=require(_0x0a65('0x3'));var BPromise=require(_0x0a65('0x4'));var rp=require(_0x0a65('0x5'));var fs=require('fs');var path=require(_0x0a65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0a65('0x7'));var integrations=require(_0x0a65('0x8'));module[_0x0a65('0x9')]=function(_0x38b0a6,_0xa38c19){return _0x38b0a6[_0x0a65('0xa')](_0x0a65('0xb'),attributes,{'tableName':_0x0a65('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x33cc15,_0x4625d1,_0x58a0de){if(_0x33cc15[_0x0a65('0xd')](_0x0a65('0xe'))||_0x33cc15[_0x0a65('0xd')](_0x0a65('0xf'))||_0x33cc15[_0x0a65('0xd')]('clientId')||_0x33cc15[_0x0a65('0xd')]('clientSecret')||_0x33cc15[_0x0a65('0xd')](_0x0a65('0x10'))||_0x33cc15['changed'](_0x0a65('0x11'))){var _0xe0a8c4,_0x4bc1e6;_0xe0a8c4=_0x33cc15['serverUrl'];var _0x172538=_0xe0a8c4[_0x0a65('0x12')](-0x1);if(_0x172538==='/'||_0x172538==='\x5c'||_0x172538===':'){_0xe0a8c4=_0xe0a8c4[_0x0a65('0x13')](0x0,_0xe0a8c4[_0x0a65('0x14')](_0x172538));}switch(_0x33cc15['zone']){case'US':_0x4bc1e6=_0x0a65('0x15');break;case'AU':_0x4bc1e6=_0x0a65('0x16');break;case'IN':_0x4bc1e6=_0x0a65('0x17');break;case'CN':_0x4bc1e6='https://accounts.zoho.com.cn';break;default:_0x4bc1e6='https://accounts.zoho.eu';break;}var _0x22db30={'method':_0x0a65('0x18'),'uri':_0x4bc1e6+'/oauth/v2/token','form':{'grant_type':_0x0a65('0x19'),'client_id':_0x33cc15[_0x0a65('0x1a')],'client_secret':_0x33cc15[_0x0a65('0x1b')],'redirect_uri':_0x33cc15['serverUrl'],'code':_0x33cc15['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x22db30)['then'](function(_0x4b8d2c){var _0x7e93e3=JSON[_0x0a65('0x1c')](_0x4b8d2c);if(_0x7e93e3[_0x0a65('0x1d')]){_0x33cc15[_0x0a65('0x1e')]=_0x7e93e3[_0x0a65('0x1d')];logger[_0x0a65('0x1f')](util[_0x0a65('0x20')](_0x0a65('0x21'),_0x33cc15['name'],_0x33cc15['id']));}else{logger[_0x0a65('0x22')](util['format'](_0x0a65('0x23'),_0x33cc15[_0x0a65('0x24')],_0x33cc15['id']),util[_0x0a65('0x25')](_0x7e93e3,{'showHidden':![],'depth':null}));}return _0x58a0de(null,_0x4625d1);})[_0x0a65('0x26')](function(_0x4183d3){logger[_0x0a65('0x22')](util['format'](_0x0a65('0x23'),_0x33cc15[_0x0a65('0x24')],_0x33cc15['id']),util[_0x0a65('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x58a0de(_0x4183d3);});}else{return _0x58a0de(null,_0x4625d1);}},'beforeUpdate':function(_0x47cc36,_0x2524dc,_0x23cbf8){if(_0x47cc36['changed'](_0x0a65('0xe'))||_0x47cc36[_0x0a65('0xd')](_0x0a65('0xf'))||_0x47cc36['changed'](_0x0a65('0x1a'))||_0x47cc36[_0x0a65('0xd')](_0x0a65('0x1b'))||_0x47cc36['changed']('code')||_0x47cc36[_0x0a65('0xd')]('host')){var _0x57dbe6,_0x2bfbd0;_0x57dbe6=_0x47cc36['serverUrl'];var _0x8a5a2f=_0x57dbe6[_0x0a65('0x12')](-0x1);if(_0x8a5a2f==='/'||_0x8a5a2f==='\x5c'||_0x8a5a2f===':'){_0x57dbe6=_0x57dbe6[_0x0a65('0x13')](0x0,_0x57dbe6[_0x0a65('0x14')](_0x8a5a2f));}switch(_0x47cc36[_0x0a65('0xe')]){case'US':_0x2bfbd0=_0x0a65('0x15');break;case'AU':_0x2bfbd0=_0x0a65('0x16');break;case'IN':_0x2bfbd0=_0x0a65('0x17');break;case'CN':_0x2bfbd0='https://accounts.zoho.com.cn';break;default:_0x2bfbd0=_0x0a65('0x27');break;}var _0x220ff2={'method':'POST','uri':_0x2bfbd0+'/oauth/v2/token','form':{'grant_type':_0x0a65('0x19'),'client_id':_0x47cc36[_0x0a65('0x1a')],'client_secret':_0x47cc36['clientSecret'],'redirect_uri':_0x47cc36[_0x0a65('0xf')],'code':_0x47cc36[_0x0a65('0x10')]},'headers':{'Content-Type':_0x0a65('0x28')}};return rp(_0x220ff2)[_0x0a65('0x29')](function(_0x46e2b0){var _0x5a98ee=JSON[_0x0a65('0x1c')](_0x46e2b0);if(_0x5a98ee[_0x0a65('0x1d')]){_0x47cc36[_0x0a65('0x1e')]=_0x5a98ee[_0x0a65('0x1d')];logger[_0x0a65('0x1f')](util[_0x0a65('0x20')](_0x0a65('0x21'),_0x47cc36[_0x0a65('0x24')],_0x47cc36['id']));}else{logger[_0x0a65('0x22')](util[_0x0a65('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x47cc36[_0x0a65('0x24')],_0x47cc36['id']),util[_0x0a65('0x25')](_0x5a98ee,{'showHidden':![],'depth':null}));}return _0x23cbf8(null,_0x2524dc);})['catch'](function(_0x3da537){logger['error'](util[_0x0a65('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x47cc36[_0x0a65('0x24')],_0x47cc36['id']),util[_0x0a65('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x23cbf8(_0x3da537);});}else{return _0x23cbf8(null,_0x2524dc);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 609bed1..f8f8775 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 _0xce45=['include','map','model','then','stringify','ShowZohoAccount','find','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','client','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit'];(function(_0x17e15b,_0x3e7a8f){var _0x1f00ae=function(_0x5940f3){while(--_0x5940f3){_0x17e15b['push'](_0x17e15b['shift']());}};_0x1f00ae(++_0x3e7a8f);}(_0xce45,0x19d));var _0x5ce4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xce45[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5ce4('0x0'));var util=require(_0x5ce4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5ce4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ce4('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ce4('0x4'));var config=require(_0x5ce4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5ce4('0x6')][_0x5ce4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb09851,_0x53e2ff,_0x1e68dd){return new BPromise(function(_0x2547a3,_0x122baf){return client['request'](_0xb09851,_0x1e68dd)['then'](function(_0x3bb329){logger[_0x5ce4('0x8')](_0x5ce4('0x9'),_0x53e2ff,_0x5ce4('0xa'));logger[_0x5ce4('0xb')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x53e2ff,_0x5ce4('0xa'),JSON['stringify'](_0x3bb329));if(_0x3bb329[_0x5ce4('0xc')]){if(_0x3bb329['error'][_0x5ce4('0xd')]===0x1f4){logger[_0x5ce4('0xc')](_0x5ce4('0x9'),_0x53e2ff,_0x3bb329[_0x5ce4('0xc')][_0x5ce4('0xe')]);return _0x122baf(_0x3bb329[_0x5ce4('0xc')][_0x5ce4('0xe')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x53e2ff,_0x3bb329[_0x5ce4('0xc')][_0x5ce4('0xe')]);return _0x2547a3(_0x3bb329['error'][_0x5ce4('0xe')]);}else{logger[_0x5ce4('0x8')]('ZohoAccount,\x20%s,\x20%s',_0x53e2ff,_0x5ce4('0xa'));_0x2547a3(_0x3bb329['result'][_0x5ce4('0xe')]);}})['catch'](function(_0x3ff084){logger[_0x5ce4('0xc')](_0x5ce4('0x9'),_0x53e2ff,_0x3ff084);_0x122baf(_0x3ff084);});});}exports[_0x5ce4('0xf')]=function(_0x372707){var _0x5651eb=this;return new Promise(function(_0x4e9c1a,_0x744bf8){return db[_0x5ce4('0x10')]['findAll']({'raw':_0x372707[_0x5ce4('0x11')]?_0x372707[_0x5ce4('0x11')][_0x5ce4('0x12')]===undefined?!![]:![]:!![],'where':_0x372707['options']?_0x372707[_0x5ce4('0x11')][_0x5ce4('0x13')]||null:null,'attributes':_0x372707[_0x5ce4('0x11')]?_0x372707[_0x5ce4('0x11')][_0x5ce4('0x14')]||null:null,'limit':_0x372707['options']?_0x372707[_0x5ce4('0x11')][_0x5ce4('0x15')]||null:null,'include':_0x372707[_0x5ce4('0x11')]?_0x372707[_0x5ce4('0x11')][_0x5ce4('0x16')]?_[_0x5ce4('0x17')](_0x372707['options']['include'],function(_0x5ba3bd){return{'model':db[_0x5ba3bd[_0x5ce4('0x18')]],'as':_0x5ba3bd['as'],'attributes':_0x5ba3bd[_0x5ce4('0x14')],'include':_0x5ba3bd[_0x5ce4('0x16')]?_[_0x5ce4('0x17')](_0x5ba3bd[_0x5ce4('0x16')],function(_0x3413c2){return{'model':db[_0x3413c2['model']],'as':_0x3413c2['as'],'attributes':_0x3413c2[_0x5ce4('0x14')],'include':_0x3413c2[_0x5ce4('0x16')]?_[_0x5ce4('0x17')](_0x3413c2['include'],function(_0x541b19){return{'model':db[_0x541b19['model']],'as':_0x541b19['as'],'attributes':_0x541b19[_0x5ce4('0x14')]};}):[]};}):[]};}):[]:[]})[_0x5ce4('0x19')](function(_0x37c3bd){logger[_0x5ce4('0x8')](_0x5ce4('0xf'),_0x372707);logger[_0x5ce4('0xb')](_0x5ce4('0xf'),_0x372707,JSON[_0x5ce4('0x1a')](_0x37c3bd));_0x4e9c1a(_0x37c3bd);})['catch'](function(_0x315d3a){logger[_0x5ce4('0xc')](_0x5ce4('0xf'),_0x315d3a['message'],_0x372707);_0x744bf8(_0x5651eb[_0x5ce4('0xc')](0x1f4,_0x315d3a[_0x5ce4('0xe')]));});});};exports[_0x5ce4('0x1b')]=function(_0x215367){var _0x5d418b=this;return new Promise(function(_0x51a8d1,_0x1e9967){return db[_0x5ce4('0x10')][_0x5ce4('0x1c')]({'raw':_0x215367[_0x5ce4('0x11')]?_0x215367[_0x5ce4('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x215367[_0x5ce4('0x11')]?_0x215367[_0x5ce4('0x11')]['where']||null:null,'attributes':_0x215367['options']?_0x215367[_0x5ce4('0x11')]['attributes']||null:null,'include':_0x215367[_0x5ce4('0x11')]?_0x215367[_0x5ce4('0x11')][_0x5ce4('0x16')]?_[_0x5ce4('0x17')](_0x215367[_0x5ce4('0x11')]['include'],function(_0x350df1){return{'model':db[_0x350df1[_0x5ce4('0x18')]],'as':_0x350df1['as'],'attributes':_0x350df1[_0x5ce4('0x14')],'include':_0x350df1[_0x5ce4('0x16')]?_[_0x5ce4('0x17')](_0x350df1[_0x5ce4('0x16')],function(_0x45ea9d){return{'model':db[_0x45ea9d[_0x5ce4('0x18')]],'as':_0x45ea9d['as'],'attributes':_0x45ea9d[_0x5ce4('0x14')],'include':_0x45ea9d[_0x5ce4('0x16')]?_[_0x5ce4('0x17')](_0x45ea9d['include'],function(_0x5d7cf1){return{'model':db[_0x5d7cf1['model']],'as':_0x5d7cf1['as'],'attributes':_0x5d7cf1[_0x5ce4('0x14')]};}):[]};}):[]};}):[]:[]})[_0x5ce4('0x19')](function(_0x43e995){logger[_0x5ce4('0x8')](_0x5ce4('0x1b'),_0x215367);logger[_0x5ce4('0xb')]('ShowZohoAccount',_0x215367,JSON[_0x5ce4('0x1a')](_0x43e995));_0x51a8d1(_0x43e995);})['catch'](function(_0x44d35c){logger[_0x5ce4('0xc')](_0x5ce4('0x1b'),_0x44d35c[_0x5ce4('0xe')],_0x215367);_0x1e9967(_0x5d418b['error'](0x1f4,_0x44d35c['message']));});});}; \ No newline at end of file +var _0xeacd=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','ZohoAccount','ShowZohoAccount','lodash','bluebird'];(function(_0x1161fe,_0x32cdb4){var _0x359a3f=function(_0x1a10e6){while(--_0x1a10e6){_0x1161fe['push'](_0x1161fe['shift']());}};_0x359a3f(++_0x32cdb4);}(_0xeacd,0x17e));var _0xdeac=function(_0x9ae491,_0x14c9db){_0x9ae491=_0x9ae491-0x0;var _0xd0f4d7=_0xeacd[_0x9ae491];return _0xd0f4d7;};'use strict';var _=require(_0xdeac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdeac('0x1'));var rs=require(_0xdeac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdeac('0x3'))['db'];var utils=require(_0xdeac('0x4'));var logger=require(_0xdeac('0x5'))('rpc');var config=require(_0xdeac('0x6'));var jayson=require(_0xdeac('0x7'));var client=jayson[_0xdeac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x125082,_0x5962fd,_0x443e5e){return new BPromise(function(_0x4086d5,_0x3864ae){return client[_0xdeac('0x9')](_0x125082,_0x443e5e)[_0xdeac('0xa')](function(_0x3c443a){logger[_0xdeac('0xb')](_0xdeac('0xc'),_0x5962fd,_0xdeac('0xd'));logger[_0xdeac('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5962fd,_0xdeac('0xd'),JSON[_0xdeac('0xf')](_0x3c443a));if(_0x3c443a['error']){if(_0x3c443a['error'][_0xdeac('0x10')]===0x1f4){logger[_0xdeac('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x5962fd,_0x3c443a[_0xdeac('0x11')][_0xdeac('0x12')]);return _0x3864ae(_0x3c443a[_0xdeac('0x11')]['message']);}logger[_0xdeac('0x11')](_0xdeac('0xc'),_0x5962fd,_0x3c443a['error'][_0xdeac('0x12')]);return _0x4086d5(_0x3c443a[_0xdeac('0x11')]['message']);}else{logger[_0xdeac('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x5962fd,_0xdeac('0xd'));_0x4086d5(_0x3c443a['result'][_0xdeac('0x12')]);}})[_0xdeac('0x13')](function(_0x57271d){logger['error'](_0xdeac('0xc'),_0x5962fd,_0x57271d);_0x3864ae(_0x57271d);});});}exports['GetZohoAccount']=function(_0x1315fe){var _0x4af3df=this;return new Promise(function(_0x362791,_0x5193c3){return db['ZohoAccount'][_0xdeac('0x14')]({'raw':_0x1315fe['options']?_0x1315fe[_0xdeac('0x15')][_0xdeac('0x16')]===undefined?!![]:![]:!![],'where':_0x1315fe['options']?_0x1315fe[_0xdeac('0x15')][_0xdeac('0x17')]||null:null,'attributes':_0x1315fe['options']?_0x1315fe[_0xdeac('0x15')][_0xdeac('0x18')]||null:null,'limit':_0x1315fe[_0xdeac('0x15')]?_0x1315fe['options'][_0xdeac('0x19')]||null:null,'include':_0x1315fe[_0xdeac('0x15')]?_0x1315fe[_0xdeac('0x15')][_0xdeac('0x1a')]?_['map'](_0x1315fe[_0xdeac('0x15')][_0xdeac('0x1a')],function(_0x2e9207){return{'model':db[_0x2e9207['model']],'as':_0x2e9207['as'],'attributes':_0x2e9207[_0xdeac('0x18')],'include':_0x2e9207[_0xdeac('0x1a')]?_[_0xdeac('0x1b')](_0x2e9207['include'],function(_0x4d7389){return{'model':db[_0x4d7389[_0xdeac('0x1c')]],'as':_0x4d7389['as'],'attributes':_0x4d7389['attributes'],'include':_0x4d7389['include']?_[_0xdeac('0x1b')](_0x4d7389['include'],function(_0x519bab){return{'model':db[_0x519bab[_0xdeac('0x1c')]],'as':_0x519bab['as'],'attributes':_0x519bab[_0xdeac('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdeac('0xa')](function(_0x5799ae){logger[_0xdeac('0xb')](_0xdeac('0x1d'),_0x1315fe);logger[_0xdeac('0xe')](_0xdeac('0x1d'),_0x1315fe,JSON[_0xdeac('0xf')](_0x5799ae));_0x362791(_0x5799ae);})[_0xdeac('0x13')](function(_0x343954){logger[_0xdeac('0x11')]('GetZohoAccount',_0x343954[_0xdeac('0x12')],_0x1315fe);_0x5193c3(_0x4af3df[_0xdeac('0x11')](0x1f4,_0x343954[_0xdeac('0x12')]));});});};exports['ShowZohoAccount']=function(_0x26b6b0){var _0x1241d9=this;return new Promise(function(_0x449ba4,_0x1bc76e){return db[_0xdeac('0x1e')]['find']({'raw':_0x26b6b0['options']?_0x26b6b0[_0xdeac('0x15')][_0xdeac('0x16')]===undefined?!![]:![]:!![],'where':_0x26b6b0['options']?_0x26b6b0[_0xdeac('0x15')][_0xdeac('0x17')]||null:null,'attributes':_0x26b6b0[_0xdeac('0x15')]?_0x26b6b0[_0xdeac('0x15')][_0xdeac('0x18')]||null:null,'include':_0x26b6b0[_0xdeac('0x15')]?_0x26b6b0[_0xdeac('0x15')][_0xdeac('0x1a')]?_[_0xdeac('0x1b')](_0x26b6b0['options'][_0xdeac('0x1a')],function(_0x4d0f86){return{'model':db[_0x4d0f86[_0xdeac('0x1c')]],'as':_0x4d0f86['as'],'attributes':_0x4d0f86[_0xdeac('0x18')],'include':_0x4d0f86['include']?_[_0xdeac('0x1b')](_0x4d0f86['include'],function(_0x4fd278){return{'model':db[_0x4fd278[_0xdeac('0x1c')]],'as':_0x4fd278['as'],'attributes':_0x4fd278[_0xdeac('0x18')],'include':_0x4fd278[_0xdeac('0x1a')]?_[_0xdeac('0x1b')](_0x4fd278[_0xdeac('0x1a')],function(_0x409c74){return{'model':db[_0x409c74[_0xdeac('0x1c')]],'as':_0x409c74['as'],'attributes':_0x409c74['attributes']};}):[]};}):[]};}):[]:[]})[_0xdeac('0xa')](function(_0x30bb22){logger[_0xdeac('0xb')](_0xdeac('0x1f'),_0x26b6b0);logger[_0xdeac('0xe')](_0xdeac('0x1f'),_0x26b6b0,JSON[_0xdeac('0xf')](_0x30bb22));_0x449ba4(_0x30bb22);})[_0xdeac('0x13')](function(_0x3b47e5){logger['error'](_0xdeac('0x1f'),_0x3b47e5['message'],_0x26b6b0);_0x1bc76e(_0x1241d9[_0xdeac('0x11')](0x1f4,_0x3b47e5[_0xdeac('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 34ba42e..df0bf37 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 _0x80d5=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x22ab6f,_0xfa5f4b){var _0x432d82=function(_0x1c27f2){while(--_0x1c27f2){_0x22ab6f['push'](_0x22ab6f['shift']());}};_0x432d82(++_0xfa5f4b);}(_0x80d5,0xb2));var _0x580d=function(_0xee87f8,_0x40dd0b){_0xee87f8=_0xee87f8-0x0;var _0x255ce3=_0x80d5[_0xee87f8];return _0x255ce3;};'use strict';var multer=require(_0x580d('0x0'));var util=require(_0x580d('0x1'));var path=require(_0x580d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x580d('0x3')]();var fs_extra=require(_0x580d('0x4'));var auth=require(_0x580d('0x5'));var interaction=require(_0x580d('0x6'));var config=require(_0x580d('0x7'));var controller=require(_0x580d('0x8'));router[_0x580d('0x9')]('/',auth[_0x580d('0xa')](),controller['index']);router[_0x580d('0x9')](_0x580d('0xb'),auth[_0x580d('0xa')](),controller[_0x580d('0xc')]);router['get'](_0x580d('0xd'),auth[_0x580d('0xa')](),controller[_0x580d('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x580d('0xf')]);router['get'](_0x580d('0x10'),auth['isAuthenticated'](),controller[_0x580d('0x11')]);router[_0x580d('0x12')]('/',auth[_0x580d('0xa')](),controller['create']);router[_0x580d('0x13')](_0x580d('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x580d('0xa')](),controller[_0x580d('0x14')]);module[_0x580d('0x15')]=router; \ No newline at end of file +var _0x75b8=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy'];(function(_0x37ddf2,_0x36de3c){var _0x2d1ced=function(_0x29524f){while(--_0x29524f){_0x37ddf2['push'](_0x37ddf2['shift']());}};_0x2d1ced(++_0x36de3c);}(_0x75b8,0xd3));var _0x875b=function(_0x9dd37c,_0x3e255e){_0x9dd37c=_0x9dd37c-0x0;var _0x2a522c=_0x75b8[_0x9dd37c];return _0x2a522c;};'use strict';var multer=require(_0x875b('0x0'));var util=require(_0x875b('0x1'));var path=require('path');var timeout=require(_0x875b('0x2'));var express=require(_0x875b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x875b('0x4'));var interaction=require(_0x875b('0x5'));var config=require('../../config/environment');var controller=require(_0x875b('0x6'));router[_0x875b('0x7')]('/',auth[_0x875b('0x8')](),controller[_0x875b('0x9')]);router[_0x875b('0x7')](_0x875b('0xa'),auth[_0x875b('0x8')](),controller['show']);router['get'](_0x875b('0xb'),auth['isAuthenticated'](),controller[_0x875b('0xc')]);router[_0x875b('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x875b('0xd')]);router[_0x875b('0x7')](_0x875b('0xe'),auth['isAuthenticated'](),controller[_0x875b('0xf')]);router[_0x875b('0x10')]('/',auth[_0x875b('0x8')](),controller['create']);router[_0x875b('0x11')](_0x875b('0xa'),auth[_0x875b('0x8')](),controller['update']);router[_0x875b('0x12')](_0x875b('0xa'),auth[_0x875b('0x8')](),controller[_0x875b('0x13')]);module[_0x875b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index aa6e345..0561a4e 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 _0x28af=['sequelize','STRING','lead','contact','nothing','ENUM','contact_lead'];(function(_0x3ee9b0,_0x2365d3){var _0x99004d=function(_0x1739d5){while(--_0x1739d5){_0x3ee9b0['push'](_0x3ee9b0['shift']());}};_0x99004d(++_0x2365d3);}(_0x28af,0x18f));var _0xf28a=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x28af[_0x44268d];return _0x4be92d;};'use strict';var Sequelize=require(_0xf28a('0x0'));module['exports']={'name':{'type':Sequelize[_0xf28a('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xf28a('0x2'),_0xf28a('0x3'),_0xf28a('0x4')),'defaultValue':_0xf28a('0x2')},'moduleSearch':{'type':Sequelize[_0xf28a('0x5')](_0xf28a('0x6'),'contact',_0xf28a('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xf28a('0x1')]}}; \ No newline at end of file +var _0xabef=['STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xabef,0xfc));var _0xfabe=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xabef[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfabe('0x0')]},'moduleCreate':{'type':Sequelize[_0xfabe('0x1')](_0xfabe('0x2'),_0xfabe('0x3'),_0xfabe('0x4')),'defaultValue':_0xfabe('0x2')},'moduleSearch':{'type':Sequelize[_0xfabe('0x1')]('contact_lead',_0xfabe('0x3'),'lead'),'defaultValue':_0xfabe('0x5')},'description':{'type':Sequelize[_0xfabe('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9551b87..b93f8b8 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 _0xd7cc=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','type','VIRTUAL','where','ZohoConfiguration','includeAll','include','rows','show','params','rawAttributes','options','find','create','findOne','ZohoField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','render','merge','body','contact','agent','interaction','index','map','key','query','keys','filters'];(function(_0xddfe05,_0x57b987){var _0x42b95e=function(_0x30699b){while(--_0x30699b){_0xddfe05['push'](_0xddfe05['shift']());}};_0x42b95e(++_0x57b987);}(_0xd7cc,0xdd));var _0xcd7c=function(_0x422582,_0x3da8e9){_0x422582=_0x422582-0x0;var _0x5a3b6b=_0xd7cc[_0x422582];return _0x5a3b6b;};'use strict';var emlformat=require(_0xcd7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd7c('0x1'));var jsonpatch=require(_0xcd7c('0x2'));var rp=require(_0xcd7c('0x3'));var moment=require(_0xcd7c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd7c('0x5'));var util=require(_0xcd7c('0x6'));var path=require(_0xcd7c('0x7'));var sox=require(_0xcd7c('0x8'));var csv=require(_0xcd7c('0x9'));var ejs=require(_0xcd7c('0xa'));var fs=require('fs');var fs_extra=require(_0xcd7c('0xb'));var _=require(_0xcd7c('0xc'));var squel=require(_0xcd7c('0xd'));var crypto=require('crypto');var jsforce=require(_0xcd7c('0xe'));var deskjs=require(_0xcd7c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcd7c('0x10'));var Papa=require(_0xcd7c('0x11'));var Redis=require(_0xcd7c('0x12'));var authService=require(_0xcd7c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd7c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xcd7c('0x15'));var config=require(_0xcd7c('0x16'));var licenseUtil=require(_0xcd7c('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcd7c('0x18'));var client=jayson[_0xcd7c('0x19')][_0xcd7c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x37f506,_0x4bfd96,_0x4ca384,_0x1984ab){return new BPromise(function(_0x3d2922,_0x2ae768){var _0x468296=_0x1984ab||client;return _0x468296['request'](_0x37f506,_0x4ca384)[_0xcd7c('0x1b')](function(_0x2d6537){logger['info'](_0xcd7c('0x1c'),_0x4bfd96,_0xcd7c('0x1d'));logger[_0xcd7c('0x1e')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4bfd96,_0xcd7c('0x1d'),JSON[_0xcd7c('0x1f')](_0x2d6537));if(_0x2d6537[_0xcd7c('0x20')]){if(_0x2d6537[_0xcd7c('0x20')][_0xcd7c('0x21')]===0x1f4){logger[_0xcd7c('0x20')](_0xcd7c('0x1c'),_0x4bfd96,_0x2d6537[_0xcd7c('0x20')][_0xcd7c('0x22')]);return _0x2ae768(_0x2d6537['error']['message']);}logger[_0xcd7c('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x4bfd96,_0x2d6537[_0xcd7c('0x20')][_0xcd7c('0x22')]);return _0x3d2922(_0x2d6537[_0xcd7c('0x20')][_0xcd7c('0x22')]);}else{logger[_0xcd7c('0x23')]('ZohoConfiguration,\x20%s,\x20%s',_0x4bfd96,_0xcd7c('0x1d'));_0x3d2922(_0x2d6537[_0xcd7c('0x24')][_0xcd7c('0x22')]);}})[_0xcd7c('0x25')](function(_0x2150ca){logger[_0xcd7c('0x20')](_0xcd7c('0x1c'),_0x4bfd96,_0x2150ca);_0x2ae768(_0x2150ca);});});}function respondWithStatusCode(_0x38c22b,_0x5ca3c6){_0x5ca3c6=_0x5ca3c6||0xcc;return function(_0xdcc25d){if(_0xdcc25d){return _0x38c22b['sendStatus'](_0x5ca3c6);}return _0x38c22b[_0xcd7c('0x26')](_0x5ca3c6)[_0xcd7c('0x27')]();};}function respondWithResult(_0x1e9cad,_0x160dc8){_0x160dc8=_0x160dc8||0xc8;return function(_0x4fbb40){if(_0x4fbb40){return _0x1e9cad[_0xcd7c('0x26')](_0x160dc8)['json'](_0x4fbb40);}};}function respondWithFilteredResult(_0x88cbe6,_0x14628d){return function(_0x4c3f93){if(_0x4c3f93){var _0x27c1aa=typeof _0x14628d[_0xcd7c('0x28')]===_0xcd7c('0x29')&&typeof _0x14628d['limit']==='undefined';var _0x34e538=_0x4c3f93[_0xcd7c('0x2a')];var _0x48ca6d=_0x27c1aa?0x0:_0x14628d[_0xcd7c('0x28')];var _0x3a41c6=_0x27c1aa?_0x4c3f93['count']:_0x14628d[_0xcd7c('0x28')]+_0x14628d[_0xcd7c('0x2b')];var _0x543c87;if(_0x3a41c6>=_0x34e538){_0x3a41c6=_0x34e538;_0x543c87=0xc8;}else{_0x543c87=0xce;}_0x88cbe6[_0xcd7c('0x26')](_0x543c87);return _0x88cbe6[_0xcd7c('0x2c')](_0xcd7c('0x2d'),_0x48ca6d+'-'+_0x3a41c6+'/'+_0x34e538)[_0xcd7c('0x2e')](_0x4c3f93);}return null;};}function patchUpdates(_0x1d7353){return function(_0x1b756d){try{jsonpatch[_0xcd7c('0x2f')](_0x1b756d,_0x1d7353,!![]);}catch(_0x2d145b){return BPromise[_0xcd7c('0x30')](_0x2d145b);}return _0x1b756d[_0xcd7c('0x31')]();};}function saveUpdates(_0x5ef922,_0x19bc20){return function(_0x4a8f97){if(_0x4a8f97){return _0x4a8f97[_0xcd7c('0x32')](_0x5ef922)['then'](function(_0x45cb3f){return _0x45cb3f;});}return null;};}function removeEntity(_0x420053,_0x1293b6){return function(_0x3f075c){if(_0x3f075c){return _0x3f075c[_0xcd7c('0x33')]()['then'](function(){_0x420053[_0xcd7c('0x26')](0xcc)[_0xcd7c('0x27')]();});}};}function handleEntityNotFound(_0xbcf50f,_0x512eba){return function(_0x120891){if(!_0x120891){_0xbcf50f[_0xcd7c('0x34')](0x194);}return _0x120891;};}function handleError(_0x585ff7,_0xc0500a){_0xc0500a=_0xc0500a||0x1f4;return function(_0x1faac2){logger[_0xcd7c('0x20')](_0x1faac2[_0xcd7c('0x35')]);if(_0x1faac2[_0xcd7c('0x36')]){delete _0x1faac2['name'];}_0x585ff7[_0xcd7c('0x26')](_0xc0500a)['send'](_0x1faac2);};}function getMustacheRender(_0x3b6c92,_0x598eca){return Mustache[_0xcd7c('0x37')](_0x3b6c92,_[_0xcd7c('0x38')](_0x598eca[_0xcd7c('0x39')],{'contact':_0x598eca[_0xcd7c('0x3a')],'message':_0x598eca[_0xcd7c('0x22')],'agent':_0x598eca[_0xcd7c('0x3b')],'interaction':_0x598eca[_0xcd7c('0x3c')],'account':_0x598eca['account']}))||'';}exports[_0xcd7c('0x3d')]=function(_0x113f1b,_0x40ebef){var _0x57e220={},_0x33e735={},_0x5ace77={'count':0x0,'rows':[]};var _0x2aaff6=_[_0xcd7c('0x3e')](db['ZohoConfiguration']['rawAttributes'],function(_0x313c89){return{'name':_0x313c89['fieldName'],'type':_0x313c89['type'][_0xcd7c('0x3f')]};});_0x33e735['model']=_[_0xcd7c('0x3e')](_0x2aaff6,_0xcd7c('0x36'));_0x33e735[_0xcd7c('0x40')]=_[_0xcd7c('0x41')](_0x113f1b[_0xcd7c('0x40')]);_0x33e735[_0xcd7c('0x42')]=_[_0xcd7c('0x43')](_0x33e735[_0xcd7c('0x44')],_0x33e735[_0xcd7c('0x40')]);_0x57e220[_0xcd7c('0x45')]=_['intersection'](_0x33e735[_0xcd7c('0x44')],qs[_0xcd7c('0x46')](_0x113f1b[_0xcd7c('0x40')][_0xcd7c('0x46')]));_0x57e220[_0xcd7c('0x45')]=_0x57e220[_0xcd7c('0x45')][_0xcd7c('0x47')]?_0x57e220['attributes']:_0x33e735[_0xcd7c('0x44')];if(!_0x113f1b[_0xcd7c('0x40')][_0xcd7c('0x48')](_0xcd7c('0x49'))){_0x57e220['limit']=qs[_0xcd7c('0x2b')](_0x113f1b[_0xcd7c('0x40')][_0xcd7c('0x2b')]);_0x57e220[_0xcd7c('0x28')]=qs[_0xcd7c('0x28')](_0x113f1b[_0xcd7c('0x40')][_0xcd7c('0x28')]);}_0x57e220[_0xcd7c('0x4a')]=qs[_0xcd7c('0x4b')](_0x113f1b[_0xcd7c('0x40')][_0xcd7c('0x4b')]);_0x57e220['where']=qs['filters'](_[_0xcd7c('0x4c')](_0x113f1b['query'],_0x33e735[_0xcd7c('0x42')]),_0x2aaff6);if(_0x113f1b[_0xcd7c('0x40')][_0xcd7c('0x4d')]){_0x57e220['where']=_[_0xcd7c('0x38')](_0x57e220['where'],{'$or':_['map'](_0x2aaff6,function(_0x12a870){if(_0x12a870[_0xcd7c('0x4e')]!==_0xcd7c('0x4f')){var _0x4c2c7a={};_0x4c2c7a[_0x12a870[_0xcd7c('0x36')]]={'$like':'%'+_0x113f1b[_0xcd7c('0x40')][_0xcd7c('0x4d')]+'%'};return _0x4c2c7a;}})});}_0x57e220=_[_0xcd7c('0x38')]({},_0x57e220,_0x113f1b['options']);var _0x86de7d={'where':_0x57e220[_0xcd7c('0x50')]};return db[_0xcd7c('0x51')][_0xcd7c('0x2a')](_0x86de7d)[_0xcd7c('0x1b')](function(_0x28550d){_0x5ace77[_0xcd7c('0x2a')]=_0x28550d;if(_0x113f1b['query'][_0xcd7c('0x52')]){_0x57e220[_0xcd7c('0x53')]=[{'all':!![]}];}return db[_0xcd7c('0x51')]['findAll'](_0x57e220);})[_0xcd7c('0x1b')](function(_0x581840){_0x5ace77[_0xcd7c('0x54')]=_0x581840;return _0x5ace77;})[_0xcd7c('0x1b')](respondWithFilteredResult(_0x40ebef,_0x57e220))[_0xcd7c('0x25')](handleError(_0x40ebef,null));};exports[_0xcd7c('0x55')]=function(_0x1c60fc,_0x2d6448){var _0x9ea9f7={'raw':![],'where':{'id':_0x1c60fc[_0xcd7c('0x56')]['id']}},_0x35fca3={};_0x35fca3['model']=_[_0xcd7c('0x41')](db[_0xcd7c('0x51')][_0xcd7c('0x57')]);_0x35fca3['query']=_['keys'](_0x1c60fc[_0xcd7c('0x40')]);_0x35fca3[_0xcd7c('0x42')]=_['intersection'](_0x35fca3[_0xcd7c('0x44')],_0x35fca3[_0xcd7c('0x40')]);_0x9ea9f7[_0xcd7c('0x45')]=_[_0xcd7c('0x43')](_0x35fca3[_0xcd7c('0x44')],qs['fields'](_0x1c60fc[_0xcd7c('0x40')][_0xcd7c('0x46')]));_0x9ea9f7[_0xcd7c('0x45')]=_0x9ea9f7[_0xcd7c('0x45')]['length']?_0x9ea9f7[_0xcd7c('0x45')]:_0x35fca3['model'];if(_0x1c60fc['query']['includeAll']){_0x9ea9f7[_0xcd7c('0x53')]=[{'all':!![]}];}_0x9ea9f7=_[_0xcd7c('0x38')]({},_0x9ea9f7,_0x1c60fc[_0xcd7c('0x58')]);return db[_0xcd7c('0x51')][_0xcd7c('0x59')](_0x9ea9f7)[_0xcd7c('0x1b')](handleEntityNotFound(_0x2d6448,null))[_0xcd7c('0x1b')](respondWithResult(_0x2d6448,null))['catch'](handleError(_0x2d6448,null));};exports[_0xcd7c('0x5a')]=function(_0x3e18d4,_0xfabc6a){return db[_0xcd7c('0x51')][_0xcd7c('0x5a')](_0x3e18d4['body'],{})['then'](respondWithResult(_0xfabc6a,0xc9))[_0xcd7c('0x25')](handleError(_0xfabc6a,null));};exports[_0xcd7c('0x32')]=function(_0x3158af,_0x2056c3){if(_0x3158af[_0xcd7c('0x39')]['id']){delete _0x3158af['body']['id'];}return db[_0xcd7c('0x51')][_0xcd7c('0x59')]({'where':{'id':_0x3158af[_0xcd7c('0x56')]['id']}})[_0xcd7c('0x1b')](handleEntityNotFound(_0x2056c3,null))[_0xcd7c('0x1b')](saveUpdates(_0x3158af[_0xcd7c('0x39')],null))[_0xcd7c('0x1b')](respondWithResult(_0x2056c3,null))[_0xcd7c('0x25')](handleError(_0x2056c3,null));};exports['destroy']=function(_0x503107,_0xab535f){return db[_0xcd7c('0x51')][_0xcd7c('0x59')]({'where':{'id':_0x503107[_0xcd7c('0x56')]['id']}})[_0xcd7c('0x1b')](handleEntityNotFound(_0xab535f,null))[_0xcd7c('0x1b')](removeEntity(_0xab535f,null))['catch'](handleError(_0xab535f,null));};exports['getFields']=function(_0x3fe035,_0x46009e,_0x1b9aab){var _0x25f443={};var _0x4a99d7={};var _0x22db2;var _0x243f32;return db[_0xcd7c('0x51')][_0xcd7c('0x5b')]({'where':{'id':_0x3fe035['params']['id']}})['then'](handleEntityNotFound(_0x46009e,null))[_0xcd7c('0x1b')](function(_0x2224a2){if(_0x2224a2){_0x22db2=_0x2224a2;_0x4a99d7['model']=_[_0xcd7c('0x41')](db[_0xcd7c('0x5c')][_0xcd7c('0x57')]);_0x4a99d7[_0xcd7c('0x40')]=_[_0xcd7c('0x41')](_0x3fe035[_0xcd7c('0x40')]);_0x4a99d7[_0xcd7c('0x42')]=_['intersection'](_0x4a99d7[_0xcd7c('0x44')],_0x4a99d7[_0xcd7c('0x40')]);_0x25f443['attributes']=_[_0xcd7c('0x43')](_0x4a99d7[_0xcd7c('0x44')],qs[_0xcd7c('0x46')](_0x3fe035[_0xcd7c('0x40')]['fields']));_0x25f443[_0xcd7c('0x45')]=_0x25f443[_0xcd7c('0x45')][_0xcd7c('0x47')]?_0x25f443[_0xcd7c('0x45')]:_0x4a99d7['model'];_0x25f443[_0xcd7c('0x4a')]=qs[_0xcd7c('0x4b')](_0x3fe035['query'][_0xcd7c('0x4b')]);_0x25f443[_0xcd7c('0x50')]=qs[_0xcd7c('0x42')](_['pick'](_0x3fe035[_0xcd7c('0x40')],_0x4a99d7[_0xcd7c('0x42')]));if(_0x3fe035['query'][_0xcd7c('0x4d')]){_0x25f443['where']=_[_0xcd7c('0x38')](_0x25f443[_0xcd7c('0x50')],{'$or':_[_0xcd7c('0x3e')](_0x25f443[_0xcd7c('0x45')],function(_0x460871){var _0x344887={};_0x344887[_0x460871]={'$like':'%'+_0x3fe035['query']['filter']+'%'};return _0x344887;})});}_0x25f443=_[_0xcd7c('0x38')]({},_0x25f443,_0x3fe035['options']);return _0x22db2[_0xcd7c('0x5d')](_0x25f443);}})[_0xcd7c('0x1b')](function(_0x1a8962){if(_0x1a8962){_0x243f32=_0x1a8962[_0xcd7c('0x47')];if(!_0x3fe035[_0xcd7c('0x40')][_0xcd7c('0x48')]('nolimit')){_0x25f443['limit']=qs['limit'](_0x3fe035[_0xcd7c('0x40')]['limit']);_0x25f443[_0xcd7c('0x28')]=qs[_0xcd7c('0x28')](_0x3fe035['query'][_0xcd7c('0x28')]);}return _0x22db2[_0xcd7c('0x5d')](_0x25f443);}})[_0xcd7c('0x1b')](function(_0x293d31){if(_0x293d31){return _0x293d31?{'count':_0x243f32,'rows':_0x293d31}:null;}})[_0xcd7c('0x1b')](respondWithResult(_0x46009e,null))[_0xcd7c('0x25')](handleError(_0x46009e,null));};exports[_0xcd7c('0x5e')]=function(_0x40bc87,_0x2528b8,_0x140134){var _0x448377={};var _0x969f2b={};var _0x557f49;var _0x319ae0;return db[_0xcd7c('0x51')][_0xcd7c('0x5b')]({'where':{'id':_0x40bc87['params']['id']}})[_0xcd7c('0x1b')](handleEntityNotFound(_0x2528b8,null))[_0xcd7c('0x1b')](function(_0x2c9573){if(_0x2c9573){_0x557f49=_0x2c9573;_0x969f2b[_0xcd7c('0x44')]=_[_0xcd7c('0x41')](db[_0xcd7c('0x5c')]['rawAttributes']);_0x969f2b[_0xcd7c('0x40')]=_[_0xcd7c('0x41')](_0x40bc87['query']);_0x969f2b[_0xcd7c('0x42')]=_[_0xcd7c('0x43')](_0x969f2b[_0xcd7c('0x44')],_0x969f2b[_0xcd7c('0x40')]);_0x448377['attributes']=_[_0xcd7c('0x43')](_0x969f2b[_0xcd7c('0x44')],qs[_0xcd7c('0x46')](_0x40bc87[_0xcd7c('0x40')][_0xcd7c('0x46')]));_0x448377[_0xcd7c('0x45')]=_0x448377[_0xcd7c('0x45')][_0xcd7c('0x47')]?_0x448377[_0xcd7c('0x45')]:_0x969f2b['model'];_0x448377[_0xcd7c('0x4a')]=qs[_0xcd7c('0x4b')](_0x40bc87['query']['sort']);_0x448377[_0xcd7c('0x50')]=qs[_0xcd7c('0x42')](_[_0xcd7c('0x4c')](_0x40bc87[_0xcd7c('0x40')],_0x969f2b[_0xcd7c('0x42')]));if(_0x40bc87[_0xcd7c('0x40')]['filter']){_0x448377[_0xcd7c('0x50')]=_['merge'](_0x448377['where'],{'$or':_[_0xcd7c('0x3e')](_0x448377[_0xcd7c('0x45')],function(_0x1d56bc){var _0x5cf932={};_0x5cf932[_0x1d56bc]={'$like':'%'+_0x40bc87[_0xcd7c('0x40')][_0xcd7c('0x4d')]+'%'};return _0x5cf932;})});}_0x448377=_[_0xcd7c('0x38')]({},_0x448377,_0x40bc87[_0xcd7c('0x58')]);return _0x557f49['getSubjects'](_0x448377);}})[_0xcd7c('0x1b')](function(_0xbceab0){if(_0xbceab0){_0x319ae0=_0xbceab0['length'];if(!_0x40bc87[_0xcd7c('0x40')]['hasOwnProperty'](_0xcd7c('0x49'))){_0x448377[_0xcd7c('0x2b')]=qs['limit'](_0x40bc87[_0xcd7c('0x40')][_0xcd7c('0x2b')]);_0x448377[_0xcd7c('0x28')]=qs[_0xcd7c('0x28')](_0x40bc87['query'][_0xcd7c('0x28')]);}return _0x557f49[_0xcd7c('0x5e')](_0x448377);}})[_0xcd7c('0x1b')](function(_0x3faf67){if(_0x3faf67){return _0x3faf67?{'count':_0x319ae0,'rows':_0x3faf67}:null;}})[_0xcd7c('0x1b')](respondWithResult(_0x2528b8,null))['catch'](handleError(_0x2528b8,null));};exports[_0xcd7c('0x5f')]=function(_0x352079,_0x4b5989,_0x3899f6){var _0x209993={};var _0x128255={};var _0x3f7a24;var _0x2c8656;return db[_0xcd7c('0x51')]['findOne']({'where':{'id':_0x352079[_0xcd7c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4b5989,null))[_0xcd7c('0x1b')](function(_0xae9301){if(_0xae9301){_0x3f7a24=_0xae9301;_0x128255[_0xcd7c('0x44')]=_['keys'](db[_0xcd7c('0x5c')][_0xcd7c('0x57')]);_0x128255[_0xcd7c('0x40')]=_[_0xcd7c('0x41')](_0x352079['query']);_0x128255[_0xcd7c('0x42')]=_[_0xcd7c('0x43')](_0x128255[_0xcd7c('0x44')],_0x128255[_0xcd7c('0x40')]);_0x209993['attributes']=_['intersection'](_0x128255[_0xcd7c('0x44')],qs[_0xcd7c('0x46')](_0x352079[_0xcd7c('0x40')][_0xcd7c('0x46')]));_0x209993['attributes']=_0x209993[_0xcd7c('0x45')][_0xcd7c('0x47')]?_0x209993[_0xcd7c('0x45')]:_0x128255[_0xcd7c('0x44')];_0x209993[_0xcd7c('0x4a')]=qs[_0xcd7c('0x4b')](_0x352079[_0xcd7c('0x40')][_0xcd7c('0x4b')]);_0x209993[_0xcd7c('0x50')]=qs[_0xcd7c('0x42')](_[_0xcd7c('0x4c')](_0x352079[_0xcd7c('0x40')],_0x128255[_0xcd7c('0x42')]));if(_0x352079['query']['filter']){_0x209993['where']=_[_0xcd7c('0x38')](_0x209993[_0xcd7c('0x50')],{'$or':_[_0xcd7c('0x3e')](_0x209993[_0xcd7c('0x45')],function(_0x4b0dd2){var _0x21435f={};_0x21435f[_0x4b0dd2]={'$like':'%'+_0x352079[_0xcd7c('0x40')][_0xcd7c('0x4d')]+'%'};return _0x21435f;})});}_0x209993=_[_0xcd7c('0x38')]({},_0x209993,_0x352079[_0xcd7c('0x58')]);return _0x3f7a24[_0xcd7c('0x5f')](_0x209993);}})[_0xcd7c('0x1b')](function(_0x5ddf1e){if(_0x5ddf1e){_0x2c8656=_0x5ddf1e['length'];if(!_0x352079[_0xcd7c('0x40')][_0xcd7c('0x48')](_0xcd7c('0x49'))){_0x209993[_0xcd7c('0x2b')]=qs['limit'](_0x352079[_0xcd7c('0x40')][_0xcd7c('0x2b')]);_0x209993[_0xcd7c('0x28')]=qs[_0xcd7c('0x28')](_0x352079[_0xcd7c('0x40')]['offset']);}return _0x3f7a24[_0xcd7c('0x5f')](_0x209993);}})['then'](function(_0x31dcb8){if(_0x31dcb8){return _0x31dcb8?{'count':_0x2c8656,'rows':_0x31dcb8}:null;}})[_0xcd7c('0x1b')](respondWithResult(_0x4b5989,null))[_0xcd7c('0x25')](handleError(_0x4b5989,null));}; \ No newline at end of file +var _0xb90f=['info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','stack','name','send','render','merge','contact','agent','interaction','account','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','findOne','ZohoField','pick','getFields','getSubjects','getDescriptions','order','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise'];(function(_0x576097,_0x1215bf){var _0x20dc30=function(_0x1a8774){while(--_0x1a8774){_0x576097['push'](_0x576097['shift']());}};_0x20dc30(++_0x1215bf);}(_0xb90f,0x163));var _0xfb90=function(_0x2b53c1,_0x3408a4){_0x2b53c1=_0x2b53c1-0x0;var _0x4913ee=_0xb90f[_0x2b53c1];return _0x4913ee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb90('0x0'));var jsonpatch=require(_0xfb90('0x1'));var rp=require(_0xfb90('0x2'));var moment=require(_0xfb90('0x3'));var BPromise=require(_0xfb90('0x4'));var Mustache=require(_0xfb90('0x5'));var util=require(_0xfb90('0x6'));var path=require('path');var sox=require(_0xfb90('0x7'));var csv=require(_0xfb90('0x8'));var ejs=require(_0xfb90('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb90('0xa'));var squel=require('squel');var crypto=require(_0xfb90('0xb'));var jsforce=require(_0xfb90('0xc'));var deskjs=require(_0xfb90('0xd'));var toCsv=require(_0xfb90('0x8'));var querystring=require(_0xfb90('0xe'));var Papa=require('papaparse');var Redis=require(_0xfb90('0xf'));var authService=require(_0xfb90('0x10'));var qs=require(_0xfb90('0x11'));var as=require(_0xfb90('0x12'));var hardwareService=require(_0xfb90('0x13'));var logger=require('../../config/logger')(_0xfb90('0x14'));var utils=require(_0xfb90('0x15'));var config=require(_0xfb90('0x16'));var licenseUtil=require(_0xfb90('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xfb90('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c397f,_0x1fa668,_0x2c2cc5,_0x48c075){return new BPromise(function(_0x36497e,_0x3b4ba7){var _0x555971=_0x48c075||client;return _0x555971['request'](_0x1c397f,_0x2c2cc5)['then'](function(_0x275f23){logger[_0xfb90('0x19')]('ZohoConfiguration,\x20%s,\x20%s',_0x1fa668,'request\x20sent');logger[_0xfb90('0x1a')](_0xfb90('0x1b'),_0x1fa668,'request\x20sent',JSON['stringify'](_0x275f23));if(_0x275f23[_0xfb90('0x1c')]){if(_0x275f23['error'][_0xfb90('0x1d')]===0x1f4){logger[_0xfb90('0x1c')]('ZohoConfiguration,\x20%s,\x20%s',_0x1fa668,_0x275f23[_0xfb90('0x1c')][_0xfb90('0x1e')]);return _0x3b4ba7(_0x275f23[_0xfb90('0x1c')][_0xfb90('0x1e')]);}logger[_0xfb90('0x1c')](_0xfb90('0x1f'),_0x1fa668,_0x275f23[_0xfb90('0x1c')]['message']);return _0x36497e(_0x275f23[_0xfb90('0x1c')][_0xfb90('0x1e')]);}else{logger[_0xfb90('0x19')](_0xfb90('0x1f'),_0x1fa668,_0xfb90('0x20'));_0x36497e(_0x275f23[_0xfb90('0x21')][_0xfb90('0x1e')]);}})[_0xfb90('0x22')](function(_0x24a54a){logger[_0xfb90('0x1c')](_0xfb90('0x1f'),_0x1fa668,_0x24a54a);_0x3b4ba7(_0x24a54a);});});}function respondWithStatusCode(_0x4192bc,_0xefe9c7){_0xefe9c7=_0xefe9c7||0xcc;return function(_0x29648c){if(_0x29648c){return _0x4192bc[_0xfb90('0x23')](_0xefe9c7);}return _0x4192bc[_0xfb90('0x24')](_0xefe9c7)[_0xfb90('0x25')]();};}function respondWithResult(_0x380037,_0x40f349){_0x40f349=_0x40f349||0xc8;return function(_0x437cf3){if(_0x437cf3){return _0x380037['status'](_0x40f349)[_0xfb90('0x26')](_0x437cf3);}};}function respondWithFilteredResult(_0x6adcdf,_0x4a736c){return function(_0x5d4e68){if(_0x5d4e68){var _0x3789bc=typeof _0x4a736c[_0xfb90('0x27')]==='undefined'&&typeof _0x4a736c[_0xfb90('0x28')]===_0xfb90('0x29');var _0x242ad1=_0x5d4e68[_0xfb90('0x2a')];var _0x7131a2=_0x3789bc?0x0:_0x4a736c[_0xfb90('0x27')];var _0x1244d0=_0x3789bc?_0x5d4e68[_0xfb90('0x2a')]:_0x4a736c[_0xfb90('0x27')]+_0x4a736c['limit'];var _0x58925b;if(_0x1244d0>=_0x242ad1){_0x1244d0=_0x242ad1;_0x58925b=0xc8;}else{_0x58925b=0xce;}_0x6adcdf['status'](_0x58925b);return _0x6adcdf[_0xfb90('0x2b')](_0xfb90('0x2c'),_0x7131a2+'-'+_0x1244d0+'/'+_0x242ad1)[_0xfb90('0x26')](_0x5d4e68);}return null;};}function patchUpdates(_0x45873f){return function(_0x156db4){try{jsonpatch[_0xfb90('0x2d')](_0x156db4,_0x45873f,!![]);}catch(_0x57aae0){return BPromise['reject'](_0x57aae0);}return _0x156db4['save']();};}function saveUpdates(_0x305ede,_0x5001b9){return function(_0x3fa74f){if(_0x3fa74f){return _0x3fa74f[_0xfb90('0x2e')](_0x305ede)[_0xfb90('0x2f')](function(_0x1edb5a){return _0x1edb5a;});}return null;};}function removeEntity(_0x28ba1b,_0x352da6){return function(_0x47d00c){if(_0x47d00c){return _0x47d00c[_0xfb90('0x30')]()[_0xfb90('0x2f')](function(){_0x28ba1b['status'](0xcc)[_0xfb90('0x25')]();});}};}function handleEntityNotFound(_0x6ffe10,_0x1c17e4){return function(_0x56aa79){if(!_0x56aa79){_0x6ffe10['sendStatus'](0x194);}return _0x56aa79;};}function handleError(_0x334c98,_0x22f730){_0x22f730=_0x22f730||0x1f4;return function(_0x1ccccc){logger['error'](_0x1ccccc[_0xfb90('0x31')]);if(_0x1ccccc[_0xfb90('0x32')]){delete _0x1ccccc[_0xfb90('0x32')];}_0x334c98['status'](_0x22f730)[_0xfb90('0x33')](_0x1ccccc);};}function getMustacheRender(_0x30155a,_0x540f51){return Mustache[_0xfb90('0x34')](_0x30155a,_[_0xfb90('0x35')](_0x540f51['body'],{'contact':_0x540f51[_0xfb90('0x36')],'message':_0x540f51[_0xfb90('0x1e')],'agent':_0x540f51[_0xfb90('0x37')],'interaction':_0x540f51[_0xfb90('0x38')],'account':_0x540f51[_0xfb90('0x39')]}))||'';}exports[_0xfb90('0x3a')]=function(_0x40732f,_0x3852a4){var _0x374fa7={},_0x598c85={},_0x2e8da7={'count':0x0,'rows':[]};var _0x3dc28c=_[_0xfb90('0x3b')](db[_0xfb90('0x3c')][_0xfb90('0x3d')],function(_0xda738a){return{'name':_0xda738a[_0xfb90('0x3e')],'type':_0xda738a['type'][_0xfb90('0x3f')]};});_0x598c85[_0xfb90('0x40')]=_[_0xfb90('0x3b')](_0x3dc28c,_0xfb90('0x32'));_0x598c85[_0xfb90('0x41')]=_[_0xfb90('0x42')](_0x40732f[_0xfb90('0x41')]);_0x598c85[_0xfb90('0x43')]=_[_0xfb90('0x44')](_0x598c85[_0xfb90('0x40')],_0x598c85['query']);_0x374fa7[_0xfb90('0x45')]=_[_0xfb90('0x44')](_0x598c85[_0xfb90('0x40')],qs['fields'](_0x40732f['query'][_0xfb90('0x46')]));_0x374fa7[_0xfb90('0x45')]=_0x374fa7['attributes'][_0xfb90('0x47')]?_0x374fa7[_0xfb90('0x45')]:_0x598c85[_0xfb90('0x40')];if(!_0x40732f[_0xfb90('0x41')][_0xfb90('0x48')](_0xfb90('0x49'))){_0x374fa7[_0xfb90('0x28')]=qs[_0xfb90('0x28')](_0x40732f[_0xfb90('0x41')]['limit']);_0x374fa7[_0xfb90('0x27')]=qs[_0xfb90('0x27')](_0x40732f['query'][_0xfb90('0x27')]);}_0x374fa7['order']=qs[_0xfb90('0x4a')](_0x40732f[_0xfb90('0x41')][_0xfb90('0x4a')]);_0x374fa7[_0xfb90('0x4b')]=qs[_0xfb90('0x43')](_['pick'](_0x40732f['query'],_0x598c85['filters']),_0x3dc28c);if(_0x40732f['query'][_0xfb90('0x4c')]){_0x374fa7[_0xfb90('0x4b')]=_['merge'](_0x374fa7[_0xfb90('0x4b')],{'$or':_['map'](_0x3dc28c,function(_0x269bfe){if(_0x269bfe[_0xfb90('0x4d')]!==_0xfb90('0x4e')){var _0x35b2a2={};_0x35b2a2[_0x269bfe[_0xfb90('0x32')]]={'$like':'%'+_0x40732f[_0xfb90('0x41')][_0xfb90('0x4c')]+'%'};return _0x35b2a2;}})});}_0x374fa7=_[_0xfb90('0x35')]({},_0x374fa7,_0x40732f[_0xfb90('0x4f')]);var _0x2eef3b={'where':_0x374fa7[_0xfb90('0x4b')]};return db['ZohoConfiguration'][_0xfb90('0x2a')](_0x2eef3b)[_0xfb90('0x2f')](function(_0x220f10){_0x2e8da7[_0xfb90('0x2a')]=_0x220f10;if(_0x40732f[_0xfb90('0x41')][_0xfb90('0x50')]){_0x374fa7[_0xfb90('0x51')]=[{'all':!![]}];}return db[_0xfb90('0x3c')][_0xfb90('0x52')](_0x374fa7);})[_0xfb90('0x2f')](function(_0x2623ca){_0x2e8da7[_0xfb90('0x53')]=_0x2623ca;return _0x2e8da7;})[_0xfb90('0x2f')](respondWithFilteredResult(_0x3852a4,_0x374fa7))[_0xfb90('0x22')](handleError(_0x3852a4,null));};exports['show']=function(_0x13435c,_0x5e4d90){var _0x212a8e={'raw':![],'where':{'id':_0x13435c[_0xfb90('0x54')]['id']}},_0x4c7875={};_0x4c7875[_0xfb90('0x40')]=_[_0xfb90('0x42')](db[_0xfb90('0x3c')][_0xfb90('0x3d')]);_0x4c7875[_0xfb90('0x41')]=_[_0xfb90('0x42')](_0x13435c[_0xfb90('0x41')]);_0x4c7875['filters']=_[_0xfb90('0x44')](_0x4c7875[_0xfb90('0x40')],_0x4c7875[_0xfb90('0x41')]);_0x212a8e[_0xfb90('0x45')]=_[_0xfb90('0x44')](_0x4c7875['model'],qs[_0xfb90('0x46')](_0x13435c[_0xfb90('0x41')][_0xfb90('0x46')]));_0x212a8e[_0xfb90('0x45')]=_0x212a8e['attributes'][_0xfb90('0x47')]?_0x212a8e[_0xfb90('0x45')]:_0x4c7875['model'];if(_0x13435c[_0xfb90('0x41')]['includeAll']){_0x212a8e[_0xfb90('0x51')]=[{'all':!![]}];}_0x212a8e=_[_0xfb90('0x35')]({},_0x212a8e,_0x13435c[_0xfb90('0x4f')]);return db[_0xfb90('0x3c')][_0xfb90('0x55')](_0x212a8e)['then'](handleEntityNotFound(_0x5e4d90,null))[_0xfb90('0x2f')](respondWithResult(_0x5e4d90,null))['catch'](handleError(_0x5e4d90,null));};exports[_0xfb90('0x56')]=function(_0x2e12ff,_0x226709){return db['ZohoConfiguration'][_0xfb90('0x56')](_0x2e12ff[_0xfb90('0x57')],{})['then'](respondWithResult(_0x226709,0xc9))[_0xfb90('0x22')](handleError(_0x226709,null));};exports[_0xfb90('0x2e')]=function(_0x36472a,_0x27eee1){if(_0x36472a[_0xfb90('0x57')]['id']){delete _0x36472a[_0xfb90('0x57')]['id'];}return db[_0xfb90('0x3c')]['find']({'where':{'id':_0x36472a['params']['id']}})[_0xfb90('0x2f')](handleEntityNotFound(_0x27eee1,null))[_0xfb90('0x2f')](saveUpdates(_0x36472a['body'],null))[_0xfb90('0x2f')](respondWithResult(_0x27eee1,null))[_0xfb90('0x22')](handleError(_0x27eee1,null));};exports['destroy']=function(_0x1458ac,_0xc4367a){return db[_0xfb90('0x3c')][_0xfb90('0x55')]({'where':{'id':_0x1458ac['params']['id']}})['then'](handleEntityNotFound(_0xc4367a,null))['then'](removeEntity(_0xc4367a,null))['catch'](handleError(_0xc4367a,null));};exports['getFields']=function(_0x4afef5,_0x13aaa0,_0x162ee6){var _0xb8525d={};var _0x176a6a={};var _0x22d3a1;var _0x33aef0;return db['ZohoConfiguration'][_0xfb90('0x58')]({'where':{'id':_0x4afef5[_0xfb90('0x54')]['id']}})[_0xfb90('0x2f')](handleEntityNotFound(_0x13aaa0,null))[_0xfb90('0x2f')](function(_0x43255a){if(_0x43255a){_0x22d3a1=_0x43255a;_0x176a6a[_0xfb90('0x40')]=_['keys'](db[_0xfb90('0x59')][_0xfb90('0x3d')]);_0x176a6a['query']=_[_0xfb90('0x42')](_0x4afef5['query']);_0x176a6a[_0xfb90('0x43')]=_[_0xfb90('0x44')](_0x176a6a[_0xfb90('0x40')],_0x176a6a[_0xfb90('0x41')]);_0xb8525d['attributes']=_[_0xfb90('0x44')](_0x176a6a[_0xfb90('0x40')],qs[_0xfb90('0x46')](_0x4afef5['query'][_0xfb90('0x46')]));_0xb8525d[_0xfb90('0x45')]=_0xb8525d['attributes'][_0xfb90('0x47')]?_0xb8525d['attributes']:_0x176a6a[_0xfb90('0x40')];_0xb8525d['order']=qs[_0xfb90('0x4a')](_0x4afef5[_0xfb90('0x41')][_0xfb90('0x4a')]);_0xb8525d[_0xfb90('0x4b')]=qs[_0xfb90('0x43')](_[_0xfb90('0x5a')](_0x4afef5[_0xfb90('0x41')],_0x176a6a[_0xfb90('0x43')]));if(_0x4afef5['query'][_0xfb90('0x4c')]){_0xb8525d[_0xfb90('0x4b')]=_['merge'](_0xb8525d['where'],{'$or':_[_0xfb90('0x3b')](_0xb8525d[_0xfb90('0x45')],function(_0x88c55c){var _0x1a7c4b={};_0x1a7c4b[_0x88c55c]={'$like':'%'+_0x4afef5[_0xfb90('0x41')][_0xfb90('0x4c')]+'%'};return _0x1a7c4b;})});}_0xb8525d=_[_0xfb90('0x35')]({},_0xb8525d,_0x4afef5[_0xfb90('0x4f')]);return _0x22d3a1[_0xfb90('0x5b')](_0xb8525d);}})[_0xfb90('0x2f')](function(_0x23756b){if(_0x23756b){_0x33aef0=_0x23756b[_0xfb90('0x47')];if(!_0x4afef5[_0xfb90('0x41')]['hasOwnProperty'](_0xfb90('0x49'))){_0xb8525d['limit']=qs[_0xfb90('0x28')](_0x4afef5['query']['limit']);_0xb8525d['offset']=qs[_0xfb90('0x27')](_0x4afef5[_0xfb90('0x41')]['offset']);}return _0x22d3a1[_0xfb90('0x5b')](_0xb8525d);}})[_0xfb90('0x2f')](function(_0x65ee8e){if(_0x65ee8e){return _0x65ee8e?{'count':_0x33aef0,'rows':_0x65ee8e}:null;}})[_0xfb90('0x2f')](respondWithResult(_0x13aaa0,null))[_0xfb90('0x22')](handleError(_0x13aaa0,null));};exports[_0xfb90('0x5c')]=function(_0x542c91,_0x11aae5,_0xb07f8){var _0x58f81e={};var _0x5b0453={};var _0x13e3ab;var _0xe455d3;return db[_0xfb90('0x3c')]['findOne']({'where':{'id':_0x542c91[_0xfb90('0x54')]['id']}})[_0xfb90('0x2f')](handleEntityNotFound(_0x11aae5,null))[_0xfb90('0x2f')](function(_0x8c2342){if(_0x8c2342){_0x13e3ab=_0x8c2342;_0x5b0453[_0xfb90('0x40')]=_[_0xfb90('0x42')](db[_0xfb90('0x59')][_0xfb90('0x3d')]);_0x5b0453['query']=_[_0xfb90('0x42')](_0x542c91[_0xfb90('0x41')]);_0x5b0453[_0xfb90('0x43')]=_[_0xfb90('0x44')](_0x5b0453['model'],_0x5b0453[_0xfb90('0x41')]);_0x58f81e[_0xfb90('0x45')]=_[_0xfb90('0x44')](_0x5b0453[_0xfb90('0x40')],qs[_0xfb90('0x46')](_0x542c91['query']['fields']));_0x58f81e['attributes']=_0x58f81e[_0xfb90('0x45')][_0xfb90('0x47')]?_0x58f81e['attributes']:_0x5b0453['model'];_0x58f81e['order']=qs[_0xfb90('0x4a')](_0x542c91[_0xfb90('0x41')][_0xfb90('0x4a')]);_0x58f81e['where']=qs[_0xfb90('0x43')](_[_0xfb90('0x5a')](_0x542c91[_0xfb90('0x41')],_0x5b0453[_0xfb90('0x43')]));if(_0x542c91[_0xfb90('0x41')][_0xfb90('0x4c')]){_0x58f81e[_0xfb90('0x4b')]=_[_0xfb90('0x35')](_0x58f81e[_0xfb90('0x4b')],{'$or':_[_0xfb90('0x3b')](_0x58f81e[_0xfb90('0x45')],function(_0x2a481a){var _0x25e769={};_0x25e769[_0x2a481a]={'$like':'%'+_0x542c91[_0xfb90('0x41')][_0xfb90('0x4c')]+'%'};return _0x25e769;})});}_0x58f81e=_[_0xfb90('0x35')]({},_0x58f81e,_0x542c91['options']);return _0x13e3ab['getSubjects'](_0x58f81e);}})['then'](function(_0x50894f){if(_0x50894f){_0xe455d3=_0x50894f['length'];if(!_0x542c91[_0xfb90('0x41')][_0xfb90('0x48')](_0xfb90('0x49'))){_0x58f81e[_0xfb90('0x28')]=qs[_0xfb90('0x28')](_0x542c91[_0xfb90('0x41')][_0xfb90('0x28')]);_0x58f81e[_0xfb90('0x27')]=qs[_0xfb90('0x27')](_0x542c91['query'][_0xfb90('0x27')]);}return _0x13e3ab[_0xfb90('0x5c')](_0x58f81e);}})[_0xfb90('0x2f')](function(_0x443169){if(_0x443169){return _0x443169?{'count':_0xe455d3,'rows':_0x443169}:null;}})[_0xfb90('0x2f')](respondWithResult(_0x11aae5,null))[_0xfb90('0x22')](handleError(_0x11aae5,null));};exports[_0xfb90('0x5d')]=function(_0x4c0626,_0x4a3e32,_0x4835e2){var _0x5a1d93={};var _0x237ca3={};var _0x92a6ad;var _0x497d89;return db[_0xfb90('0x3c')][_0xfb90('0x58')]({'where':{'id':_0x4c0626[_0xfb90('0x54')]['id']}})[_0xfb90('0x2f')](handleEntityNotFound(_0x4a3e32,null))[_0xfb90('0x2f')](function(_0x4b7806){if(_0x4b7806){_0x92a6ad=_0x4b7806;_0x237ca3[_0xfb90('0x40')]=_[_0xfb90('0x42')](db[_0xfb90('0x59')][_0xfb90('0x3d')]);_0x237ca3['query']=_[_0xfb90('0x42')](_0x4c0626['query']);_0x237ca3[_0xfb90('0x43')]=_[_0xfb90('0x44')](_0x237ca3[_0xfb90('0x40')],_0x237ca3[_0xfb90('0x41')]);_0x5a1d93[_0xfb90('0x45')]=_[_0xfb90('0x44')](_0x237ca3[_0xfb90('0x40')],qs['fields'](_0x4c0626[_0xfb90('0x41')][_0xfb90('0x46')]));_0x5a1d93[_0xfb90('0x45')]=_0x5a1d93[_0xfb90('0x45')][_0xfb90('0x47')]?_0x5a1d93[_0xfb90('0x45')]:_0x237ca3['model'];_0x5a1d93[_0xfb90('0x5e')]=qs[_0xfb90('0x4a')](_0x4c0626['query']['sort']);_0x5a1d93[_0xfb90('0x4b')]=qs[_0xfb90('0x43')](_[_0xfb90('0x5a')](_0x4c0626[_0xfb90('0x41')],_0x237ca3['filters']));if(_0x4c0626['query']['filter']){_0x5a1d93[_0xfb90('0x4b')]=_[_0xfb90('0x35')](_0x5a1d93['where'],{'$or':_['map'](_0x5a1d93[_0xfb90('0x45')],function(_0x2ba569){var _0x43e192={};_0x43e192[_0x2ba569]={'$like':'%'+_0x4c0626['query'][_0xfb90('0x4c')]+'%'};return _0x43e192;})});}_0x5a1d93=_['merge']({},_0x5a1d93,_0x4c0626['options']);return _0x92a6ad[_0xfb90('0x5d')](_0x5a1d93);}})[_0xfb90('0x2f')](function(_0x3be384){if(_0x3be384){_0x497d89=_0x3be384['length'];if(!_0x4c0626[_0xfb90('0x41')][_0xfb90('0x48')](_0xfb90('0x49'))){_0x5a1d93[_0xfb90('0x28')]=qs[_0xfb90('0x28')](_0x4c0626['query']['limit']);_0x5a1d93[_0xfb90('0x27')]=qs[_0xfb90('0x27')](_0x4c0626[_0xfb90('0x41')][_0xfb90('0x27')]);}return _0x92a6ad[_0xfb90('0x5d')](_0x5a1d93);}})[_0xfb90('0x2f')](function(_0x42b0c6){if(_0x42b0c6){return _0x42b0c6?{'count':_0x497d89,'rows':_0x42b0c6}:null;}})[_0xfb90('0x2f')](respondWithResult(_0x4a3e32,null))['catch'](handleError(_0x4a3e32,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ecf181a..d5914ac 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 _0x2873=['./intZohoConfiguration.attributes','exports','define','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4ab916,_0x23d916){var _0x3e8c24=function(_0x317e20){while(--_0x317e20){_0x4ab916['push'](_0x4ab916['shift']());}};_0x3e8c24(++_0x23d916);}(_0x2873,0x99));var _0x3287=function(_0x3db85f,_0x1f7bb0){_0x3db85f=_0x3db85f-0x0;var _0x374f78=_0x2873[_0x3db85f];return _0x374f78;};'use strict';var _=require('lodash');var util=require(_0x3287('0x0'));var logger=require(_0x3287('0x1'))('api');var moment=require(_0x3287('0x2'));var BPromise=require(_0x3287('0x3'));var rp=require(_0x3287('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3287('0x5'));var config=require(_0x3287('0x6'));var attributes=require(_0x3287('0x7'));module[_0x3287('0x8')]=function(_0x368cdb,_0x2c2528){return _0x368cdb[_0x3287('0x9')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e95=['ZohoConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','define'];(function(_0x6d6b4c,_0x3ea378){var _0x5b3d20=function(_0x36519b){while(--_0x36519b){_0x6d6b4c['push'](_0x6d6b4c['shift']());}};_0x5b3d20(++_0x3ea378);}(_0x8e95,0x181));var _0x58e9=function(_0x1ced4e,_0x120e6a){_0x1ced4e=_0x1ced4e-0x0;var _0x557b8d=_0x8e95[_0x1ced4e];return _0x557b8d;};'use strict';var _=require(_0x58e9('0x0'));var util=require(_0x58e9('0x1'));var logger=require(_0x58e9('0x2'))(_0x58e9('0x3'));var moment=require(_0x58e9('0x4'));var BPromise=require(_0x58e9('0x5'));var rp=require(_0x58e9('0x6'));var fs=require('fs');var path=require(_0x58e9('0x7'));var rimraf=require(_0x58e9('0x8'));var config=require('../../config/environment');var attributes=require(_0x58e9('0x9'));module['exports']=function(_0x30af60,_0x58a539){return _0x30af60[_0x58e9('0xa')](_0x58e9('0xb'),attributes,{'tableName':'int_zoho_configurations','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 6c3df70..456987f 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 _0xac2f=['info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x5ca634,_0x4d2304){var _0x5d131d=function(_0x3f984a){while(--_0x3f984a){_0x5ca634['push'](_0x5ca634['shift']());}};_0x5d131d(++_0x4d2304);}(_0xac2f,0x17e));var _0xfac2=function(_0x31416e,_0x5023d4){_0x31416e=_0x31416e-0x0;var _0x29a492=_0xac2f[_0x31416e];return _0x29a492;};'use strict';var _=require('lodash');var util=require(_0xfac2('0x0'));var moment=require(_0xfac2('0x1'));var BPromise=require('bluebird');var rs=require(_0xfac2('0x2'));var fs=require('fs');var Redis=require(_0xfac2('0x3'));var db=require(_0xfac2('0x4'))['db'];var utils=require(_0xfac2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xfac2('0x6'));var jayson=require(_0xfac2('0x7'));var client=jayson[_0xfac2('0x8')][_0xfac2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41e4a3,_0x4bfcc6,_0x1dc926){return new BPromise(function(_0x3ca696,_0x4dcdaa){return client[_0xfac2('0xa')](_0x41e4a3,_0x1dc926)[_0xfac2('0xb')](function(_0x4295af){logger['info'](_0xfac2('0xc'),_0x4bfcc6,'request\x20sent');logger[_0xfac2('0xd')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4bfcc6,_0xfac2('0xe'),JSON['stringify'](_0x4295af));if(_0x4295af[_0xfac2('0xf')]){if(_0x4295af[_0xfac2('0xf')][_0xfac2('0x10')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x4bfcc6,_0x4295af[_0xfac2('0xf')]['message']);return _0x4dcdaa(_0x4295af[_0xfac2('0xf')]['message']);}logger['error'](_0xfac2('0xc'),_0x4bfcc6,_0x4295af['error'][_0xfac2('0x11')]);return _0x3ca696(_0x4295af[_0xfac2('0xf')][_0xfac2('0x11')]);}else{logger[_0xfac2('0x12')](_0xfac2('0xc'),_0x4bfcc6,'request\x20sent');_0x3ca696(_0x4295af['result'][_0xfac2('0x11')]);}})[_0xfac2('0x13')](function(_0x279b0e){logger[_0xfac2('0xf')](_0xfac2('0xc'),_0x4bfcc6,_0x279b0e);_0x4dcdaa(_0x279b0e);});});} \ No newline at end of file +var _0x0d18=['stringify','error','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x656bd3,_0x455abb){var _0x508710=function(_0xe9fd8){while(--_0xe9fd8){_0x656bd3['push'](_0x656bd3['shift']());}};_0x508710(++_0x455abb);}(_0x0d18,0x16d));var _0x80d1=function(_0x4fbe62,_0x3e3458){_0x4fbe62=_0x4fbe62-0x0;var _0x4a0e4c=_0x0d18[_0x4fbe62];return _0x4a0e4c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x80d1('0x0'));var rs=require(_0x80d1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80d1('0x2'))['db'];var utils=require(_0x80d1('0x3'));var logger=require(_0x80d1('0x4'))('rpc');var config=require(_0x80d1('0x5'));var jayson=require(_0x80d1('0x6'));var client=jayson[_0x80d1('0x7')][_0x80d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48bf87,_0x5b3ec9,_0xb82e24){return new BPromise(function(_0x4fefea,_0x5d2a92){return client[_0x80d1('0x9')](_0x48bf87,_0xb82e24)['then'](function(_0xe9d70d){logger[_0x80d1('0xa')](_0x80d1('0xb'),_0x5b3ec9,_0x80d1('0xc'));logger[_0x80d1('0xd')](_0x80d1('0xe'),_0x5b3ec9,_0x80d1('0xc'),JSON[_0x80d1('0xf')](_0xe9d70d));if(_0xe9d70d[_0x80d1('0x10')]){if(_0xe9d70d[_0x80d1('0x10')]['code']===0x1f4){logger['error'](_0x80d1('0xb'),_0x5b3ec9,_0xe9d70d[_0x80d1('0x10')][_0x80d1('0x11')]);return _0x5d2a92(_0xe9d70d[_0x80d1('0x10')][_0x80d1('0x11')]);}logger[_0x80d1('0x10')](_0x80d1('0xb'),_0x5b3ec9,_0xe9d70d[_0x80d1('0x10')][_0x80d1('0x11')]);return _0x4fefea(_0xe9d70d[_0x80d1('0x10')][_0x80d1('0x11')]);}else{logger[_0x80d1('0xa')](_0x80d1('0xb'),_0x5b3ec9,'request\x20sent');_0x4fefea(_0xe9d70d[_0x80d1('0x12')][_0x80d1('0x11')]);}})[_0x80d1('0x13')](function(_0x135ed8){logger[_0x80d1('0x10')](_0x80d1('0xb'),_0x5b3ec9,_0x135ed8);_0x5d2a92(_0x135ed8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index df62c31..fa01f34 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 _0x731b=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x731b,0xf7));var _0xb731=function(_0x336485,_0x2d1bc6){_0x336485=_0x336485-0x0;var _0x3bc344=_0x731b[_0x336485];return _0x3bc344;};'use strict';var multer=require(_0xb731('0x0'));var util=require(_0xb731('0x1'));var path=require('path');var timeout=require(_0xb731('0x2'));var express=require(_0xb731('0x3'));var router=express[_0xb731('0x4')]();var fs_extra=require(_0xb731('0x5'));var auth=require(_0xb731('0x6'));var interaction=require(_0xb731('0x7'));var config=require('../../config/environment');var controller=require(_0xb731('0x8'));router[_0xb731('0x9')]('/',auth[_0xb731('0xa')](),controller[_0xb731('0xb')]);router[_0xb731('0x9')](_0xb731('0xc'),auth[_0xb731('0xa')](),controller['show']);router[_0xb731('0xd')]('/',auth[_0xb731('0xa')](),controller[_0xb731('0xe')]);router[_0xb731('0xf')](_0xb731('0xc'),auth[_0xb731('0xa')](),controller[_0xb731('0x10')]);router[_0xb731('0x11')](_0xb731('0xc'),auth[_0xb731('0xa')](),controller[_0xb731('0x12')]);module[_0xb731('0x13')]=router; \ No newline at end of file +var _0xd5fc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','post','create','put','isAuthenticated','delete','destroy','exports','multer','express'];(function(_0xa0fd86,_0x174f23){var _0x50e5c6=function(_0x496d93){while(--_0x496d93){_0xa0fd86['push'](_0xa0fd86['shift']());}};_0x50e5c6(++_0x174f23);}(_0xd5fc,0xae));var _0xcd5f=function(_0x2915ce,_0x40272f){_0x2915ce=_0x2915ce-0x0;var _0x124764=_0xd5fc[_0x2915ce];return _0x124764;};'use strict';var multer=require(_0xcd5f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd5f('0x1'));var router=express[_0xcd5f('0x2')]();var fs_extra=require(_0xcd5f('0x3'));var auth=require(_0xcd5f('0x4'));var interaction=require(_0xcd5f('0x5'));var config=require(_0xcd5f('0x6'));var controller=require('./intZohoField.controller');router[_0xcd5f('0x7')]('/',auth['isAuthenticated'](),controller[_0xcd5f('0x8')]);router[_0xcd5f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcd5f('0x9')]('/',auth['isAuthenticated'](),controller[_0xcd5f('0xa')]);router[_0xcd5f('0xb')]('/:id',auth[_0xcd5f('0xc')](),controller['update']);router[_0xcd5f('0xd')]('/:id',auth[_0xcd5f('0xc')](),controller[_0xcd5f('0xe')]);module[_0xcd5f('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e399e4d..974bbec 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 _0x9221=['string','STRING','exports','ENUM','variable','customVariable','picklist'];(function(_0x186b59,_0x37ec80){var _0x483002=function(_0x5c4864){while(--_0x5c4864){_0x186b59['push'](_0x186b59['shift']());}};_0x483002(++_0x37ec80);}(_0x9221,0x64));var _0x1922=function(_0x4b3d12,_0x1d4133){_0x4b3d12=_0x4b3d12-0x0;var _0x104e8c=_0x9221[_0x4b3d12];return _0x104e8c;};'use strict';var Sequelize=require('sequelize');module[_0x1922('0x0')]={'type':{'type':Sequelize[_0x1922('0x1')]('string',_0x1922('0x2'),_0x1922('0x3'),'keyValue',_0x1922('0x4')),'defaultValue':_0x1922('0x5')},'content':{'type':Sequelize[_0x1922('0x6')]},'key':{'type':Sequelize[_0x1922('0x6')]},'keyType':{'type':Sequelize[_0x1922('0x1')](_0x1922('0x5'),_0x1922('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x1922('0x6')]},'idField':{'type':Sequelize[_0x1922('0x6')]},'nameField':{'type':Sequelize[_0x1922('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1922('0x6')]}}; \ No newline at end of file +var _0x99c9=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x54b2de,_0x99cdec){var _0x5b145f=function(_0x29ab66){while(--_0x29ab66){_0x54b2de['push'](_0x54b2de['shift']());}};_0x5b145f(++_0x99cdec);}(_0x99c9,0x13c));var _0x999c=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x99c9[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x999c('0x0'));module[_0x999c('0x1')]={'type':{'type':Sequelize[_0x999c('0x2')](_0x999c('0x3'),_0x999c('0x4'),_0x999c('0x5'),_0x999c('0x6'),'picklist'),'defaultValue':_0x999c('0x3')},'content':{'type':Sequelize[_0x999c('0x7')]},'key':{'type':Sequelize[_0x999c('0x7')]},'keyType':{'type':Sequelize[_0x999c('0x2')](_0x999c('0x3'),_0x999c('0x4'),_0x999c('0x5'))},'keyContent':{'type':Sequelize[_0x999c('0x7')]},'idField':{'type':Sequelize[_0x999c('0x7')]},'nameField':{'type':Sequelize[_0x999c('0x7')]},'customField':{'type':Sequelize[_0x999c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x999c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index d9c8999..9ddf6b9 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 _0x61ac=['create','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','merge','body','message','interaction','account','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','options','ZohoField','includeAll','findAll','catch','params','keys','include','find'];(function(_0x347844,_0x2741f6){var _0x577a7b=function(_0x3aaf18){while(--_0x3aaf18){_0x347844['push'](_0x347844['shift']());}};_0x577a7b(++_0x2741f6);}(_0x61ac,0x98));var _0xc61a=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0x61ac[_0x36bfe3];return _0x9b0436;};'use strict';var emlformat=require(_0xc61a('0x0'));var rimraf=require(_0xc61a('0x1'));var zipdir=require(_0xc61a('0x2'));var jsonpatch=require(_0xc61a('0x3'));var rp=require(_0xc61a('0x4'));var moment=require(_0xc61a('0x5'));var BPromise=require(_0xc61a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc61a('0x7'));var sox=require('sox');var csv=require(_0xc61a('0x8'));var ejs=require(_0xc61a('0x9'));var fs=require('fs');var fs_extra=require(_0xc61a('0xa'));var _=require(_0xc61a('0xb'));var squel=require(_0xc61a('0xc'));var crypto=require(_0xc61a('0xd'));var jsforce=require(_0xc61a('0xe'));var deskjs=require(_0xc61a('0xf'));var toCsv=require(_0xc61a('0x8'));var querystring=require(_0xc61a('0x10'));var Papa=require(_0xc61a('0x11'));var Redis=require('ioredis');var authService=require(_0xc61a('0x12'));var qs=require(_0xc61a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc61a('0x14'));var logger=require(_0xc61a('0x15'))(_0xc61a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53d4de,_0x4f6454){_0x4f6454=_0x4f6454||0xcc;return function(_0x5de255){if(_0x5de255){return _0x53d4de[_0xc61a('0x17')](_0x4f6454);}return _0x53d4de[_0xc61a('0x18')](_0x4f6454)[_0xc61a('0x19')]();};}function respondWithResult(_0x1fcc8b,_0x52a11b){_0x52a11b=_0x52a11b||0xc8;return function(_0x1ca993){if(_0x1ca993){return _0x1fcc8b[_0xc61a('0x18')](_0x52a11b)['json'](_0x1ca993);}};}function respondWithFilteredResult(_0x1c94de,_0x40f753){return function(_0x57cfa4){if(_0x57cfa4){var _0x47c106=typeof _0x40f753[_0xc61a('0x1a')]===_0xc61a('0x1b')&&typeof _0x40f753[_0xc61a('0x1c')]===_0xc61a('0x1b');var _0x5d3042=_0x57cfa4[_0xc61a('0x1d')];var _0x4a5b46=_0x47c106?0x0:_0x40f753[_0xc61a('0x1a')];var _0x25b5aa=_0x47c106?_0x57cfa4['count']:_0x40f753[_0xc61a('0x1a')]+_0x40f753['limit'];var _0x1bc14f;if(_0x25b5aa>=_0x5d3042){_0x25b5aa=_0x5d3042;_0x1bc14f=0xc8;}else{_0x1bc14f=0xce;}_0x1c94de[_0xc61a('0x18')](_0x1bc14f);return _0x1c94de[_0xc61a('0x1e')](_0xc61a('0x1f'),_0x4a5b46+'-'+_0x25b5aa+'/'+_0x5d3042)[_0xc61a('0x20')](_0x57cfa4);}return null;};}function patchUpdates(_0x437e80){return function(_0x1dd654){try{jsonpatch[_0xc61a('0x21')](_0x1dd654,_0x437e80,!![]);}catch(_0x4bfe4b){return BPromise['reject'](_0x4bfe4b);}return _0x1dd654[_0xc61a('0x22')]();};}function saveUpdates(_0x521c12,_0xc91d3){return function(_0x4bf540){if(_0x4bf540){return _0x4bf540['update'](_0x521c12)[_0xc61a('0x23')](function(_0x26ba14){return _0x26ba14;});}return null;};}function removeEntity(_0x33ddf2,_0x1f1d7b){return function(_0x556042){if(_0x556042){return _0x556042[_0xc61a('0x24')]()[_0xc61a('0x23')](function(){_0x33ddf2[_0xc61a('0x18')](0xcc)[_0xc61a('0x19')]();});}};}function handleEntityNotFound(_0x2d54e3,_0x13b71f){return function(_0x50cfe5){if(!_0x50cfe5){_0x2d54e3[_0xc61a('0x17')](0x194);}return _0x50cfe5;};}function handleError(_0x44c90f,_0x53c59b){_0x53c59b=_0x53c59b||0x1f4;return function(_0x5a0741){logger[_0xc61a('0x25')](_0x5a0741[_0xc61a('0x26')]);if(_0x5a0741['name']){delete _0x5a0741[_0xc61a('0x27')];}_0x44c90f[_0xc61a('0x18')](_0x53c59b)[_0xc61a('0x28')](_0x5a0741);};}function getMustacheRender(_0x4e1d0b,_0x311bf0){return Mustache['render'](_0x4e1d0b,_[_0xc61a('0x29')](_0x311bf0[_0xc61a('0x2a')],{'contact':_0x311bf0['contact'],'message':_0x311bf0[_0xc61a('0x2b')],'agent':_0x311bf0['agent'],'interaction':_0x311bf0[_0xc61a('0x2c')],'account':_0x311bf0[_0xc61a('0x2d')]}))||'';}exports[_0xc61a('0x2e')]=function(_0x4e870f,_0x53c98f){var _0x226ffc={},_0x23a762={},_0x5bf7df={'count':0x0,'rows':[]};var _0x5e139a=_[_0xc61a('0x2f')](db['ZohoField'][_0xc61a('0x30')],function(_0x5ba8c8){return{'name':_0x5ba8c8['fieldName'],'type':_0x5ba8c8[_0xc61a('0x31')][_0xc61a('0x32')]};});_0x23a762[_0xc61a('0x33')]=_[_0xc61a('0x2f')](_0x5e139a,_0xc61a('0x27'));_0x23a762[_0xc61a('0x34')]=_['keys'](_0x4e870f['query']);_0x23a762[_0xc61a('0x35')]=_[_0xc61a('0x36')](_0x23a762['model'],_0x23a762['query']);_0x226ffc[_0xc61a('0x37')]=_[_0xc61a('0x36')](_0x23a762['model'],qs[_0xc61a('0x38')](_0x4e870f[_0xc61a('0x34')][_0xc61a('0x38')]));_0x226ffc['attributes']=_0x226ffc[_0xc61a('0x37')][_0xc61a('0x39')]?_0x226ffc[_0xc61a('0x37')]:_0x23a762['model'];if(!_0x4e870f[_0xc61a('0x34')][_0xc61a('0x3a')](_0xc61a('0x3b'))){_0x226ffc[_0xc61a('0x1c')]=qs['limit'](_0x4e870f['query'][_0xc61a('0x1c')]);_0x226ffc[_0xc61a('0x1a')]=qs[_0xc61a('0x1a')](_0x4e870f[_0xc61a('0x34')][_0xc61a('0x1a')]);}_0x226ffc['order']=qs[_0xc61a('0x3c')](_0x4e870f[_0xc61a('0x34')][_0xc61a('0x3c')]);_0x226ffc['where']=qs['filters'](_[_0xc61a('0x3d')](_0x4e870f['query'],_0x23a762[_0xc61a('0x35')]),_0x5e139a);if(_0x4e870f['query'][_0xc61a('0x3e')]){_0x226ffc[_0xc61a('0x3f')]=_[_0xc61a('0x29')](_0x226ffc[_0xc61a('0x3f')],{'$or':_[_0xc61a('0x2f')](_0x5e139a,function(_0x18a0e7){if(_0x18a0e7[_0xc61a('0x31')]!=='VIRTUAL'){var _0xb1318c={};_0xb1318c[_0x18a0e7[_0xc61a('0x27')]]={'$like':'%'+_0x4e870f['query'][_0xc61a('0x3e')]+'%'};return _0xb1318c;}})});}_0x226ffc=_[_0xc61a('0x29')]({},_0x226ffc,_0x4e870f[_0xc61a('0x40')]);var _0x40c97e={'where':_0x226ffc['where']};return db[_0xc61a('0x41')][_0xc61a('0x1d')](_0x40c97e)['then'](function(_0x5d89f6){_0x5bf7df[_0xc61a('0x1d')]=_0x5d89f6;if(_0x4e870f[_0xc61a('0x34')][_0xc61a('0x42')]){_0x226ffc['include']=[{'all':!![]}];}return db[_0xc61a('0x41')][_0xc61a('0x43')](_0x226ffc);})[_0xc61a('0x23')](function(_0xce68db){_0x5bf7df['rows']=_0xce68db;return _0x5bf7df;})[_0xc61a('0x23')](respondWithFilteredResult(_0x53c98f,_0x226ffc))[_0xc61a('0x44')](handleError(_0x53c98f,null));};exports['show']=function(_0xf2bdea,_0x29d425){var _0x57d6a9={'raw':!![],'where':{'id':_0xf2bdea[_0xc61a('0x45')]['id']}},_0x1be658={};_0x1be658[_0xc61a('0x33')]=_[_0xc61a('0x46')](db[_0xc61a('0x41')]['rawAttributes']);_0x1be658[_0xc61a('0x34')]=_[_0xc61a('0x46')](_0xf2bdea[_0xc61a('0x34')]);_0x1be658[_0xc61a('0x35')]=_['intersection'](_0x1be658[_0xc61a('0x33')],_0x1be658['query']);_0x57d6a9[_0xc61a('0x37')]=_[_0xc61a('0x36')](_0x1be658['model'],qs['fields'](_0xf2bdea[_0xc61a('0x34')][_0xc61a('0x38')]));_0x57d6a9[_0xc61a('0x37')]=_0x57d6a9[_0xc61a('0x37')][_0xc61a('0x39')]?_0x57d6a9[_0xc61a('0x37')]:_0x1be658['model'];if(_0xf2bdea[_0xc61a('0x34')][_0xc61a('0x42')]){_0x57d6a9[_0xc61a('0x47')]=[{'all':!![]}];}_0x57d6a9=_[_0xc61a('0x29')]({},_0x57d6a9,_0xf2bdea[_0xc61a('0x40')]);return db[_0xc61a('0x41')][_0xc61a('0x48')](_0x57d6a9)['then'](handleEntityNotFound(_0x29d425,null))[_0xc61a('0x23')](respondWithResult(_0x29d425,null))['catch'](handleError(_0x29d425,null));};exports[_0xc61a('0x49')]=function(_0x3c58e2,_0x5568e0){return db[_0xc61a('0x41')][_0xc61a('0x49')](_0x3c58e2['body'],{})['then'](respondWithResult(_0x5568e0,0xc9))[_0xc61a('0x44')](handleError(_0x5568e0,null));};exports[_0xc61a('0x4a')]=function(_0x34a8e6,_0x88c926){if(_0x34a8e6[_0xc61a('0x2a')]['id']){delete _0x34a8e6[_0xc61a('0x2a')]['id'];}return db[_0xc61a('0x41')]['find']({'where':{'id':_0x34a8e6[_0xc61a('0x45')]['id']}})[_0xc61a('0x23')](handleEntityNotFound(_0x88c926,null))['then'](saveUpdates(_0x34a8e6[_0xc61a('0x2a')],null))[_0xc61a('0x23')](respondWithResult(_0x88c926,null))[_0xc61a('0x44')](handleError(_0x88c926,null));};exports['destroy']=function(_0x3f6eb9,_0x3eb69f){return db[_0xc61a('0x41')]['find']({'where':{'id':_0x3f6eb9[_0xc61a('0x45')]['id']}})[_0xc61a('0x23')](handleEntityNotFound(_0x3eb69f,null))[_0xc61a('0x23')](removeEntity(_0x3eb69f,null))[_0xc61a('0x44')](handleError(_0x3eb69f,null));}; \ No newline at end of file +var _0x0a12=['reject','save','update','then','destroy','name','send','merge','body','message','agent','interaction','account','index','map','ZohoField','fieldName','key','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','create','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0a12,0xc6));var _0x20a1=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0a12[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20a1('0x0'));var zipdir=require(_0x20a1('0x1'));var jsonpatch=require(_0x20a1('0x2'));var rp=require(_0x20a1('0x3'));var moment=require(_0x20a1('0x4'));var BPromise=require(_0x20a1('0x5'));var Mustache=require('mustache');var util=require(_0x20a1('0x6'));var path=require(_0x20a1('0x7'));var sox=require(_0x20a1('0x8'));var csv=require(_0x20a1('0x9'));var ejs=require(_0x20a1('0xa'));var fs=require('fs');var fs_extra=require(_0x20a1('0xb'));var _=require(_0x20a1('0xc'));var squel=require('squel');var crypto=require(_0x20a1('0xd'));var jsforce=require(_0x20a1('0xe'));var deskjs=require(_0x20a1('0xf'));var toCsv=require(_0x20a1('0x9'));var querystring=require(_0x20a1('0x10'));var Papa=require(_0x20a1('0x11'));var Redis=require('ioredis');var authService=require(_0x20a1('0x12'));var qs=require(_0x20a1('0x13'));var as=require(_0x20a1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x20a1('0x15'));var utils=require('../../config/utils');var config=require(_0x20a1('0x16'));var licenseUtil=require(_0x20a1('0x17'));var db=require(_0x20a1('0x18'))['db'];function respondWithStatusCode(_0x46e692,_0x28bc21){_0x28bc21=_0x28bc21||0xcc;return function(_0x1a3413){if(_0x1a3413){return _0x46e692[_0x20a1('0x19')](_0x28bc21);}return _0x46e692[_0x20a1('0x1a')](_0x28bc21)[_0x20a1('0x1b')]();};}function respondWithResult(_0x243781,_0x1b721c){_0x1b721c=_0x1b721c||0xc8;return function(_0x4bc67a){if(_0x4bc67a){return _0x243781[_0x20a1('0x1a')](_0x1b721c)[_0x20a1('0x1c')](_0x4bc67a);}};}function respondWithFilteredResult(_0xa218e6,_0xd9c2f5){return function(_0x37fef8){if(_0x37fef8){var _0x2a3e54=typeof _0xd9c2f5[_0x20a1('0x1d')]==='undefined'&&typeof _0xd9c2f5[_0x20a1('0x1e')]===_0x20a1('0x1f');var _0x523d1d=_0x37fef8[_0x20a1('0x20')];var _0x5c28b4=_0x2a3e54?0x0:_0xd9c2f5['offset'];var _0x26b43f=_0x2a3e54?_0x37fef8['count']:_0xd9c2f5[_0x20a1('0x1d')]+_0xd9c2f5[_0x20a1('0x1e')];var _0x132df4;if(_0x26b43f>=_0x523d1d){_0x26b43f=_0x523d1d;_0x132df4=0xc8;}else{_0x132df4=0xce;}_0xa218e6[_0x20a1('0x1a')](_0x132df4);return _0xa218e6['set']('Content-Range',_0x5c28b4+'-'+_0x26b43f+'/'+_0x523d1d)[_0x20a1('0x1c')](_0x37fef8);}return null;};}function patchUpdates(_0x4668a3){return function(_0x4acd1f){try{jsonpatch['apply'](_0x4acd1f,_0x4668a3,!![]);}catch(_0x2298ae){return BPromise[_0x20a1('0x21')](_0x2298ae);}return _0x4acd1f[_0x20a1('0x22')]();};}function saveUpdates(_0x13f2cf,_0x72e8bb){return function(_0x2288a3){if(_0x2288a3){return _0x2288a3[_0x20a1('0x23')](_0x13f2cf)[_0x20a1('0x24')](function(_0x46bd00){return _0x46bd00;});}return null;};}function removeEntity(_0x18b114,_0x1b1276){return function(_0x4dcc8e){if(_0x4dcc8e){return _0x4dcc8e[_0x20a1('0x25')]()[_0x20a1('0x24')](function(){_0x18b114['status'](0xcc)[_0x20a1('0x1b')]();});}};}function handleEntityNotFound(_0x26fb33,_0x3443e3){return function(_0x2049dd){if(!_0x2049dd){_0x26fb33[_0x20a1('0x19')](0x194);}return _0x2049dd;};}function handleError(_0x3f8d71,_0x5a01f3){_0x5a01f3=_0x5a01f3||0x1f4;return function(_0x1ac7d6){logger['error'](_0x1ac7d6['stack']);if(_0x1ac7d6[_0x20a1('0x26')]){delete _0x1ac7d6['name'];}_0x3f8d71[_0x20a1('0x1a')](_0x5a01f3)[_0x20a1('0x27')](_0x1ac7d6);};}function getMustacheRender(_0x3a631e,_0x470731){return Mustache['render'](_0x3a631e,_[_0x20a1('0x28')](_0x470731[_0x20a1('0x29')],{'contact':_0x470731['contact'],'message':_0x470731[_0x20a1('0x2a')],'agent':_0x470731[_0x20a1('0x2b')],'interaction':_0x470731[_0x20a1('0x2c')],'account':_0x470731[_0x20a1('0x2d')]}))||'';}exports[_0x20a1('0x2e')]=function(_0x2ce594,_0x516e2b){var _0x447562={},_0x4b175e={},_0x311b19={'count':0x0,'rows':[]};var _0x12b9b5=_[_0x20a1('0x2f')](db[_0x20a1('0x30')]['rawAttributes'],function(_0x5716fe){return{'name':_0x5716fe[_0x20a1('0x31')],'type':_0x5716fe['type'][_0x20a1('0x32')]};});_0x4b175e['model']=_[_0x20a1('0x2f')](_0x12b9b5,_0x20a1('0x26'));_0x4b175e['query']=_[_0x20a1('0x33')](_0x2ce594['query']);_0x4b175e[_0x20a1('0x34')]=_[_0x20a1('0x35')](_0x4b175e[_0x20a1('0x36')],_0x4b175e[_0x20a1('0x37')]);_0x447562['attributes']=_[_0x20a1('0x35')](_0x4b175e[_0x20a1('0x36')],qs[_0x20a1('0x38')](_0x2ce594['query'][_0x20a1('0x38')]));_0x447562[_0x20a1('0x39')]=_0x447562[_0x20a1('0x39')][_0x20a1('0x3a')]?_0x447562[_0x20a1('0x39')]:_0x4b175e[_0x20a1('0x36')];if(!_0x2ce594[_0x20a1('0x37')][_0x20a1('0x3b')](_0x20a1('0x3c'))){_0x447562[_0x20a1('0x1e')]=qs['limit'](_0x2ce594[_0x20a1('0x37')][_0x20a1('0x1e')]);_0x447562['offset']=qs[_0x20a1('0x1d')](_0x2ce594[_0x20a1('0x37')][_0x20a1('0x1d')]);}_0x447562[_0x20a1('0x3d')]=qs[_0x20a1('0x3e')](_0x2ce594[_0x20a1('0x37')][_0x20a1('0x3e')]);_0x447562[_0x20a1('0x3f')]=qs[_0x20a1('0x34')](_[_0x20a1('0x40')](_0x2ce594[_0x20a1('0x37')],_0x4b175e[_0x20a1('0x34')]),_0x12b9b5);if(_0x2ce594[_0x20a1('0x37')][_0x20a1('0x41')]){_0x447562[_0x20a1('0x3f')]=_['merge'](_0x447562['where'],{'$or':_['map'](_0x12b9b5,function(_0x49bb3b){if(_0x49bb3b['type']!==_0x20a1('0x42')){var _0x324f9c={};_0x324f9c[_0x49bb3b[_0x20a1('0x26')]]={'$like':'%'+_0x2ce594[_0x20a1('0x37')][_0x20a1('0x41')]+'%'};return _0x324f9c;}})});}_0x447562=_['merge']({},_0x447562,_0x2ce594[_0x20a1('0x43')]);var _0x4db3c5={'where':_0x447562['where']};return db[_0x20a1('0x30')][_0x20a1('0x20')](_0x4db3c5)[_0x20a1('0x24')](function(_0x80487a){_0x311b19['count']=_0x80487a;if(_0x2ce594[_0x20a1('0x37')][_0x20a1('0x44')]){_0x447562[_0x20a1('0x45')]=[{'all':!![]}];}return db[_0x20a1('0x30')]['findAll'](_0x447562);})[_0x20a1('0x24')](function(_0x2743f3){_0x311b19[_0x20a1('0x46')]=_0x2743f3;return _0x311b19;})['then'](respondWithFilteredResult(_0x516e2b,_0x447562))['catch'](handleError(_0x516e2b,null));};exports[_0x20a1('0x47')]=function(_0x2a5ad1,_0x574262){var _0x64429b={'raw':!![],'where':{'id':_0x2a5ad1[_0x20a1('0x48')]['id']}},_0x1f37d6={};_0x1f37d6['model']=_[_0x20a1('0x33')](db['ZohoField'][_0x20a1('0x49')]);_0x1f37d6[_0x20a1('0x37')]=_[_0x20a1('0x33')](_0x2a5ad1[_0x20a1('0x37')]);_0x1f37d6[_0x20a1('0x34')]=_[_0x20a1('0x35')](_0x1f37d6['model'],_0x1f37d6['query']);_0x64429b[_0x20a1('0x39')]=_['intersection'](_0x1f37d6[_0x20a1('0x36')],qs['fields'](_0x2a5ad1[_0x20a1('0x37')]['fields']));_0x64429b[_0x20a1('0x39')]=_0x64429b[_0x20a1('0x39')][_0x20a1('0x3a')]?_0x64429b[_0x20a1('0x39')]:_0x1f37d6[_0x20a1('0x36')];if(_0x2a5ad1[_0x20a1('0x37')]['includeAll']){_0x64429b['include']=[{'all':!![]}];}_0x64429b=_['merge']({},_0x64429b,_0x2a5ad1['options']);return db[_0x20a1('0x30')][_0x20a1('0x4a')](_0x64429b)['then'](handleEntityNotFound(_0x574262,null))[_0x20a1('0x24')](respondWithResult(_0x574262,null))['catch'](handleError(_0x574262,null));};exports['create']=function(_0x20f89b,_0xe70017){return db[_0x20a1('0x30')][_0x20a1('0x4b')](_0x20f89b[_0x20a1('0x29')],{})[_0x20a1('0x24')](respondWithResult(_0xe70017,0xc9))[_0x20a1('0x4c')](handleError(_0xe70017,null));};exports[_0x20a1('0x23')]=function(_0x55ba5c,_0x39a65b){if(_0x55ba5c['body']['id']){delete _0x55ba5c[_0x20a1('0x29')]['id'];}return db[_0x20a1('0x30')][_0x20a1('0x4a')]({'where':{'id':_0x55ba5c[_0x20a1('0x48')]['id']}})[_0x20a1('0x24')](handleEntityNotFound(_0x39a65b,null))['then'](saveUpdates(_0x55ba5c[_0x20a1('0x29')],null))[_0x20a1('0x24')](respondWithResult(_0x39a65b,null))['catch'](handleError(_0x39a65b,null));};exports[_0x20a1('0x25')]=function(_0x210a2a,_0x563bd6){return db[_0x20a1('0x30')][_0x20a1('0x4a')]({'where':{'id':_0x210a2a[_0x20a1('0x48')]['id']}})['then'](handleEntityNotFound(_0x563bd6,null))['then'](removeEntity(_0x563bd6,null))[_0x20a1('0x4c')](handleError(_0x563bd6,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 39074f9..c50e6ae 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 _0x8fb5=['int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField'];(function(_0x18af77,_0x19b67b){var _0x1d3101=function(_0xf4f541){while(--_0xf4f541){_0x18af77['push'](_0x18af77['shift']());}};_0x1d3101(++_0x19b67b);}(_0x8fb5,0x103));var _0x58fb=function(_0x59a3e9,_0x27fb38){_0x59a3e9=_0x59a3e9-0x0;var _0x5179ac=_0x8fb5[_0x59a3e9];return _0x5179ac;};'use strict';var _=require(_0x58fb('0x0'));var util=require(_0x58fb('0x1'));var logger=require(_0x58fb('0x2'))(_0x58fb('0x3'));var moment=require('moment');var BPromise=require(_0x58fb('0x4'));var rp=require(_0x58fb('0x5'));var fs=require('fs');var path=require(_0x58fb('0x6'));var rimraf=require(_0x58fb('0x7'));var config=require(_0x58fb('0x8'));var attributes=require(_0x58fb('0x9'));module[_0x58fb('0xa')]=function(_0x451706,_0x138c07){return _0x451706[_0x58fb('0xb')](_0x58fb('0xc'),attributes,{'tableName':_0x58fb('0xd'),'paranoid':![],'indexes':[{'name':_0x58fb('0xe'),'fields':['idField',_0x58fb('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd648=['path','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x18693e,_0x4677ef){var _0x43e973=function(_0x24a40e){while(--_0x24a40e){_0x18693e['push'](_0x18693e['shift']());}};_0x43e973(++_0x4677ef);}(_0xd648,0x171));var _0x8d64=function(_0x531855,_0x162693){_0x531855=_0x531855-0x0;var _0x44adfd=_0xd648[_0x531855];return _0x44adfd;};'use strict';var _=require(_0x8d64('0x0'));var util=require(_0x8d64('0x1'));var logger=require('../../config/logger')(_0x8d64('0x2'));var moment=require(_0x8d64('0x3'));var BPromise=require(_0x8d64('0x4'));var rp=require(_0x8d64('0x5'));var fs=require('fs');var path=require(_0x8d64('0x6'));var rimraf=require(_0x8d64('0x7'));var config=require(_0x8d64('0x8'));var attributes=require('./intZohoField.attributes');module[_0x8d64('0x9')]=function(_0x435130,_0xac8de8){return _0x435130[_0x8d64('0xa')](_0x8d64('0xb'),attributes,{'tableName':_0x8d64('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x8d64('0xd'),_0x8d64('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 60ac34a..fa80acd 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 _0x7da7=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x5a58b6,_0x76ca62){var _0x512da1=function(_0x27b575){while(--_0x27b575){_0x5a58b6['push'](_0x5a58b6['shift']());}};_0x512da1(++_0x76ca62);}(_0x7da7,0x10d));var _0x77da=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x7da7[_0x3c4062];return _0x3f5bf3;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77da('0x3'));var db=require(_0x77da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77da('0x5'))(_0x77da('0x6'));var config=require('../../config/environment');var jayson=require(_0x77da('0x7'));var client=jayson[_0x77da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30afe0,_0x47cf1d,_0x1191de){return new BPromise(function(_0x13992e,_0x37c5ab){return client[_0x77da('0x9')](_0x30afe0,_0x1191de)[_0x77da('0xa')](function(_0x58f3fe){logger[_0x77da('0xb')](_0x77da('0xc'),_0x47cf1d,_0x77da('0xd'));logger['debug'](_0x77da('0xe'),_0x47cf1d,_0x77da('0xd'),JSON[_0x77da('0xf')](_0x58f3fe));if(_0x58f3fe[_0x77da('0x10')]){if(_0x58f3fe['error'][_0x77da('0x11')]===0x1f4){logger[_0x77da('0x10')](_0x77da('0xc'),_0x47cf1d,_0x58f3fe['error']['message']);return _0x37c5ab(_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);}logger['error'](_0x77da('0xc'),_0x47cf1d,_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);return _0x13992e(_0x58f3fe[_0x77da('0x10')]['message']);}else{logger[_0x77da('0xb')]('ZohoField,\x20%s,\x20%s',_0x47cf1d,_0x77da('0xd'));_0x13992e(_0x58f3fe[_0x77da('0x13')][_0x77da('0x12')]);}})[_0x77da('0x14')](function(_0x4ecd98){logger['error']('ZohoField,\x20%s,\x20%s',_0x47cf1d,_0x4ecd98);_0x37c5ab(_0x4ecd98);});});} \ No newline at end of file +var _0xb458=['ZohoField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xb458,0x103));var _0x8b45=function(_0x5cb4f0,_0xb16665){_0x5cb4f0=_0x5cb4f0-0x0;var _0x22208=_0xb458[_0x5cb4f0];return _0x22208;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 74a1d04..2c7e6d8 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 _0x7072=['express','Router','../../components/interaction/service','exports','util','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7072,0x138));var _0x2707=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x7072[_0x1eda20];return _0x31b953;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');module[_0x2707('0x6')]=router; \ No newline at end of file +var _0x30fc=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x18e65e,_0x3eabc5){var _0x3101af=function(_0x54577f){while(--_0x54577f){_0x18e65e['push'](_0x18e65e['shift']());}};_0x3101af(++_0x3eabc5);}(_0x30fc,0x64));var _0xc30f=function(_0x57dff9,_0x37bd67){_0x57dff9=_0x57dff9-0x0;var _0x346ae6=_0x30fc[_0x57dff9];return _0x346ae6;};'use strict';var multer=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var path=require('path');var timeout=require(_0xc30f('0x2'));var express=require(_0xc30f('0x3'));var router=express[_0xc30f('0x4')]();var fs_extra=require(_0xc30f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc30f('0x6'));var config=require(_0xc30f('0x7'));module[_0xc30f('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 99c6f56..3b6af5b 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 _0xddf9=['STRING','app.js','INTEGER','BOOLEAN','state','sequelize','exports','unique_name_and_version'];(function(_0xc6d095,_0x3f52c4){var _0x39af69=function(_0x1c8e5e){while(--_0x1c8e5e){_0xc6d095['push'](_0xc6d095['shift']());}};_0x39af69(++_0x3f52c4);}(_0xddf9,0x8d));var _0x9ddf=function(_0x3de7ef,_0xd1063e){_0x3de7ef=_0x3de7ef-0x0;var _0x62a6b7=_0xddf9[_0x3de7ef];return _0x62a6b7;};'use strict';var Sequelize=require(_0x9ddf('0x0'));module[_0x9ddf('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9ddf('0x2')},'main':{'type':Sequelize[_0x9ddf('0x3')],'defaultValue':_0x9ddf('0x4')},'filename':{'type':Sequelize[_0x9ddf('0x3')]},'path':{'type':Sequelize[_0x9ddf('0x3')]},'type':{'type':Sequelize[_0x9ddf('0x3')]},'size':{'type':Sequelize[_0x9ddf('0x5')]},'active':{'type':Sequelize[_0x9ddf('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x9ddf('0x3')]},'state':{'type':Sequelize['STRING'],'unique':_0x9ddf('0x7')},'description':{'type':Sequelize[_0x9ddf('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9ddf('0x3')]},'link':{'type':Sequelize[_0x9ddf('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0xe087=['STRING','unique_name_and_version','app.js','INTEGER','state','sequelize','exports'];(function(_0x467f31,_0x52efd9){var _0x5ce4ca=function(_0x4a52f7){while(--_0x4a52f7){_0x467f31['push'](_0x467f31['shift']());}};_0x5ce4ca(++_0x52efd9);}(_0xe087,0x98));var _0x7e08=function(_0x235064,_0x2e3166){_0x235064=_0x235064-0x0;var _0x2c98f7=_0xe087[_0x235064];return _0x2c98f7;};'use strict';var Sequelize=require(_0x7e08('0x0'));module[_0x7e08('0x1')]={'name':{'type':Sequelize[_0x7e08('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7e08('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x7e08('0x4')},'filename':{'type':Sequelize[_0x7e08('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7e08('0x2')]},'size':{'type':Sequelize[_0x7e08('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x7e08('0x2')],'unique':_0x7e08('0x6')},'description':{'type':Sequelize[_0x7e08('0x2')]},'title':{'type':Sequelize[_0x7e08('0x2')]},'remoteUri':{'type':Sequelize[_0x7e08('0x2')]},'link':{'type':Sequelize[_0x7e08('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 6d0275e..36c044e 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 _0x3adb=['query','attributes','fields','length','nolimit','order','sort','filter','where','map','VIRTUAL','options','Integration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','stack','name','send','render','merge','body','contact','message','interaction','account','index','rawAttributes','type','key','model','filters','intersection'];(function(_0x19f49f,_0x357f51){var _0x2e9658=function(_0x37f2bc){while(--_0x37f2bc){_0x19f49f['push'](_0x19f49f['shift']());}};_0x2e9658(++_0x357f51);}(_0x3adb,0x159));var _0xb3ad=function(_0x1087b9,_0x412730){_0x1087b9=_0x1087b9-0x0;var _0x192d3a=_0x3adb[_0x1087b9];return _0x192d3a;};'use strict';var emlformat=require(_0xb3ad('0x0'));var rimraf=require(_0xb3ad('0x1'));var zipdir=require(_0xb3ad('0x2'));var jsonpatch=require(_0xb3ad('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb3ad('0x4'));var util=require(_0xb3ad('0x5'));var path=require(_0xb3ad('0x6'));var sox=require(_0xb3ad('0x7'));var csv=require(_0xb3ad('0x8'));var ejs=require(_0xb3ad('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3ad('0xa'));var squel=require(_0xb3ad('0xb'));var crypto=require('crypto');var jsforce=require(_0xb3ad('0xc'));var deskjs=require(_0xb3ad('0xd'));var toCsv=require(_0xb3ad('0x8'));var querystring=require(_0xb3ad('0xe'));var Papa=require(_0xb3ad('0xf'));var Redis=require(_0xb3ad('0x10'));var authService=require(_0xb3ad('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb3ad('0x12'));var hardwareService=require(_0xb3ad('0x13'));var logger=require(_0xb3ad('0x14'))(_0xb3ad('0x15'));var utils=require(_0xb3ad('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb3ad('0x17'));var db=require(_0xb3ad('0x18'))['db'];function respondWithStatusCode(_0x1624b6,_0x599ef7){_0x599ef7=_0x599ef7||0xcc;return function(_0x51f32a){if(_0x51f32a){return _0x1624b6[_0xb3ad('0x19')](_0x599ef7);}return _0x1624b6['status'](_0x599ef7)[_0xb3ad('0x1a')]();};}function respondWithResult(_0x377486,_0xe11a9c){_0xe11a9c=_0xe11a9c||0xc8;return function(_0x344bab){if(_0x344bab){return _0x377486[_0xb3ad('0x1b')](_0xe11a9c)[_0xb3ad('0x1c')](_0x344bab);}};}function respondWithFilteredResult(_0x1fa314,_0x522585){return function(_0x210ff9){if(_0x210ff9){var _0x38de6e=typeof _0x522585[_0xb3ad('0x1d')]==='undefined'&&typeof _0x522585[_0xb3ad('0x1e')]===_0xb3ad('0x1f');var _0x1a5cb4=_0x210ff9['count'];var _0xdda2e9=_0x38de6e?0x0:_0x522585[_0xb3ad('0x1d')];var _0x57a8d9=_0x38de6e?_0x210ff9[_0xb3ad('0x20')]:_0x522585[_0xb3ad('0x1d')]+_0x522585['limit'];var _0xe8118a;if(_0x57a8d9>=_0x1a5cb4){_0x57a8d9=_0x1a5cb4;_0xe8118a=0xc8;}else{_0xe8118a=0xce;}_0x1fa314[_0xb3ad('0x1b')](_0xe8118a);return _0x1fa314[_0xb3ad('0x21')](_0xb3ad('0x22'),_0xdda2e9+'-'+_0x57a8d9+'/'+_0x1a5cb4)[_0xb3ad('0x1c')](_0x210ff9);}return null;};}function patchUpdates(_0x285faa){return function(_0x38cebe){try{jsonpatch[_0xb3ad('0x23')](_0x38cebe,_0x285faa,!![]);}catch(_0x476c63){return BPromise['reject'](_0x476c63);}return _0x38cebe[_0xb3ad('0x24')]();};}function saveUpdates(_0x51a52a,_0x30d35b){return function(_0x2c8557){if(_0x2c8557){return _0x2c8557['update'](_0x51a52a)[_0xb3ad('0x25')](function(_0x349a5d){return _0x349a5d;});}return null;};}function removeEntity(_0xd7ddff,_0x2be9b7){return function(_0x1275f8){if(_0x1275f8){return _0x1275f8['destroy']()[_0xb3ad('0x25')](function(){_0xd7ddff['status'](0xcc)[_0xb3ad('0x1a')]();});}};}function handleEntityNotFound(_0x187581,_0x101249){return function(_0x19d87a){if(!_0x19d87a){_0x187581[_0xb3ad('0x19')](0x194);}return _0x19d87a;};}function handleError(_0x56ecfa,_0x37ac47){_0x37ac47=_0x37ac47||0x1f4;return function(_0x7a28ba){logger['error'](_0x7a28ba[_0xb3ad('0x26')]);if(_0x7a28ba['name']){delete _0x7a28ba[_0xb3ad('0x27')];}_0x56ecfa['status'](_0x37ac47)[_0xb3ad('0x28')](_0x7a28ba);};}function getMustacheRender(_0x2def4e,_0x14e92b){return Mustache[_0xb3ad('0x29')](_0x2def4e,_[_0xb3ad('0x2a')](_0x14e92b[_0xb3ad('0x2b')],{'contact':_0x14e92b[_0xb3ad('0x2c')],'message':_0x14e92b[_0xb3ad('0x2d')],'agent':_0x14e92b['agent'],'interaction':_0x14e92b[_0xb3ad('0x2e')],'account':_0x14e92b[_0xb3ad('0x2f')]}))||'';}exports[_0xb3ad('0x30')]=function(_0x42d620,_0x53dd26){var _0x1dc13f={},_0x3863ec={},_0x2de2a5={'count':0x0,'rows':[]};var _0x2bf09f=_['map'](db['Integration'][_0xb3ad('0x31')],function(_0x3ff629){return{'name':_0x3ff629['fieldName'],'type':_0x3ff629[_0xb3ad('0x32')][_0xb3ad('0x33')]};});_0x3863ec[_0xb3ad('0x34')]=_['map'](_0x2bf09f,_0xb3ad('0x27'));_0x3863ec['query']=_['keys'](_0x42d620['query']);_0x3863ec[_0xb3ad('0x35')]=_[_0xb3ad('0x36')](_0x3863ec[_0xb3ad('0x34')],_0x3863ec[_0xb3ad('0x37')]);_0x1dc13f[_0xb3ad('0x38')]=_[_0xb3ad('0x36')](_0x3863ec[_0xb3ad('0x34')],qs[_0xb3ad('0x39')](_0x42d620['query'][_0xb3ad('0x39')]));_0x1dc13f[_0xb3ad('0x38')]=_0x1dc13f['attributes'][_0xb3ad('0x3a')]?_0x1dc13f['attributes']:_0x3863ec[_0xb3ad('0x34')];if(!_0x42d620[_0xb3ad('0x37')]['hasOwnProperty'](_0xb3ad('0x3b'))){_0x1dc13f[_0xb3ad('0x1e')]=qs['limit'](_0x42d620['query'][_0xb3ad('0x1e')]);_0x1dc13f[_0xb3ad('0x1d')]=qs['offset'](_0x42d620[_0xb3ad('0x37')]['offset']);}_0x1dc13f[_0xb3ad('0x3c')]=qs[_0xb3ad('0x3d')](_0x42d620[_0xb3ad('0x37')][_0xb3ad('0x3d')]);_0x1dc13f['where']=qs[_0xb3ad('0x35')](_['pick'](_0x42d620[_0xb3ad('0x37')],_0x3863ec[_0xb3ad('0x35')]),_0x2bf09f);if(_0x42d620[_0xb3ad('0x37')][_0xb3ad('0x3e')]){_0x1dc13f[_0xb3ad('0x3f')]=_[_0xb3ad('0x2a')](_0x1dc13f['where'],{'$or':_[_0xb3ad('0x40')](_0x2bf09f,function(_0x5d8d40){if(_0x5d8d40[_0xb3ad('0x32')]!==_0xb3ad('0x41')){var _0x1605af={};_0x1605af[_0x5d8d40[_0xb3ad('0x27')]]={'$like':'%'+_0x42d620[_0xb3ad('0x37')][_0xb3ad('0x3e')]+'%'};return _0x1605af;}})});}_0x1dc13f=_[_0xb3ad('0x2a')]({},_0x1dc13f,_0x42d620[_0xb3ad('0x42')]);var _0x2ddcd0={'where':_0x1dc13f[_0xb3ad('0x3f')]};return db[_0xb3ad('0x43')]['count'](_0x2ddcd0)['then'](function(_0x14d87c){_0x2de2a5['count']=_0x14d87c;if(_0x42d620[_0xb3ad('0x37')][_0xb3ad('0x44')]){_0x1dc13f[_0xb3ad('0x45')]=[{'all':!![]}];}return db[_0xb3ad('0x43')][_0xb3ad('0x46')](_0x1dc13f);})[_0xb3ad('0x25')](function(_0x55881c){_0x2de2a5[_0xb3ad('0x47')]=_0x55881c;return _0x2de2a5;})['then'](respondWithFilteredResult(_0x53dd26,_0x1dc13f))[_0xb3ad('0x48')](handleError(_0x53dd26,null));};exports[_0xb3ad('0x49')]=function(_0x2dfab5,_0x16e368){var _0x36420b={'raw':![],'where':{'id':_0x2dfab5[_0xb3ad('0x4a')]['id']}},_0x16d4b1={};_0x16d4b1[_0xb3ad('0x34')]=_[_0xb3ad('0x4b')](db[_0xb3ad('0x43')][_0xb3ad('0x31')]);_0x16d4b1[_0xb3ad('0x37')]=_[_0xb3ad('0x4b')](_0x2dfab5[_0xb3ad('0x37')]);_0x16d4b1[_0xb3ad('0x35')]=_[_0xb3ad('0x36')](_0x16d4b1['model'],_0x16d4b1[_0xb3ad('0x37')]);_0x36420b[_0xb3ad('0x38')]=_[_0xb3ad('0x36')](_0x16d4b1[_0xb3ad('0x34')],qs[_0xb3ad('0x39')](_0x2dfab5[_0xb3ad('0x37')]['fields']));_0x36420b[_0xb3ad('0x38')]=_0x36420b[_0xb3ad('0x38')]['length']?_0x36420b[_0xb3ad('0x38')]:_0x16d4b1[_0xb3ad('0x34')];if(_0x2dfab5[_0xb3ad('0x37')][_0xb3ad('0x44')]){_0x36420b['include']=[{'all':!![]}];}_0x36420b=_[_0xb3ad('0x2a')]({},_0x36420b,_0x2dfab5[_0xb3ad('0x42')]);return db['Integration'][_0xb3ad('0x4c')](_0x36420b)['then'](handleEntityNotFound(_0x16e368,null))[_0xb3ad('0x25')](respondWithResult(_0x16e368,null))[_0xb3ad('0x48')](handleError(_0x16e368,null));};exports[_0xb3ad('0x4d')]=function(_0x149440,_0x26a586){return db[_0xb3ad('0x43')][_0xb3ad('0x4d')](_0x149440[_0xb3ad('0x2b')],{})[_0xb3ad('0x25')](respondWithResult(_0x26a586,0xc9))[_0xb3ad('0x48')](handleError(_0x26a586,null));};exports[_0xb3ad('0x4e')]=function(_0x3c9a40,_0x9399be){if(_0x3c9a40[_0xb3ad('0x2b')]['id']){delete _0x3c9a40[_0xb3ad('0x2b')]['id'];}return db['Integration'][_0xb3ad('0x4c')]({'where':{'id':_0x3c9a40[_0xb3ad('0x4a')]['id']}})[_0xb3ad('0x25')](handleEntityNotFound(_0x9399be,null))[_0xb3ad('0x25')](saveUpdates(_0x3c9a40[_0xb3ad('0x2b')],null))['then'](respondWithResult(_0x9399be,null))['catch'](handleError(_0x9399be,null));};exports[_0xb3ad('0x4f')]=function(_0xd82de3,_0x3c8b4a){return db['Integration']['find']({'where':{'id':_0xd82de3[_0xb3ad('0x4a')]['id']}})[_0xb3ad('0x25')](handleEntityNotFound(_0x3c8b4a,null))[_0xb3ad('0x25')](removeEntity(_0x3c8b4a,null))[_0xb3ad('0x48')](handleError(_0x3c8b4a,null));}; \ No newline at end of file +var _0xd19f=['status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','contact','message','agent','interaction','index','map','Integration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','catch','show','params','keys','fields','length','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x36bc58,_0x27f03c){var _0x4a547e=function(_0x6326c6){while(--_0x6326c6){_0x36bc58['push'](_0x36bc58['shift']());}};_0x4a547e(++_0x27f03c);}(_0xd19f,0x1cb));var _0xfd19=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0xd19f[_0x3a8dc1];return _0x4b3595;};'use strict';var emlformat=require(_0xfd19('0x0'));var rimraf=require(_0xfd19('0x1'));var zipdir=require(_0xfd19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd19('0x3'));var moment=require(_0xfd19('0x4'));var BPromise=require(_0xfd19('0x5'));var Mustache=require('mustache');var util=require(_0xfd19('0x6'));var path=require('path');var sox=require(_0xfd19('0x7'));var csv=require(_0xfd19('0x8'));var ejs=require(_0xfd19('0x9'));var fs=require('fs');var fs_extra=require(_0xfd19('0xa'));var _=require(_0xfd19('0xb'));var squel=require(_0xfd19('0xc'));var crypto=require(_0xfd19('0xd'));var jsforce=require(_0xfd19('0xe'));var deskjs=require(_0xfd19('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfd19('0x10'));var Redis=require(_0xfd19('0x11'));var authService=require(_0xfd19('0x12'));var qs=require(_0xfd19('0x13'));var as=require(_0xfd19('0x14'));var hardwareService=require(_0xfd19('0x15'));var logger=require('../../config/logger')(_0xfd19('0x16'));var utils=require(_0xfd19('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfd19('0x18'));var db=require(_0xfd19('0x19'))['db'];function respondWithStatusCode(_0x169b10,_0x19bbad){_0x19bbad=_0x19bbad||0xcc;return function(_0x2853be){if(_0x2853be){return _0x169b10[_0xfd19('0x1a')](_0x19bbad);}return _0x169b10[_0xfd19('0x1b')](_0x19bbad)[_0xfd19('0x1c')]();};}function respondWithResult(_0x404154,_0x34d9f2){_0x34d9f2=_0x34d9f2||0xc8;return function(_0x17214d){if(_0x17214d){return _0x404154[_0xfd19('0x1b')](_0x34d9f2)[_0xfd19('0x1d')](_0x17214d);}};}function respondWithFilteredResult(_0x35d7cb,_0x3e589e){return function(_0x15df01){if(_0x15df01){var _0x420fe3=typeof _0x3e589e[_0xfd19('0x1e')]==='undefined'&&typeof _0x3e589e['limit']===_0xfd19('0x1f');var _0x4f7fe5=_0x15df01[_0xfd19('0x20')];var _0x4ff2ca=_0x420fe3?0x0:_0x3e589e[_0xfd19('0x1e')];var _0x16a23d=_0x420fe3?_0x15df01['count']:_0x3e589e[_0xfd19('0x1e')]+_0x3e589e[_0xfd19('0x21')];var _0x3bee46;if(_0x16a23d>=_0x4f7fe5){_0x16a23d=_0x4f7fe5;_0x3bee46=0xc8;}else{_0x3bee46=0xce;}_0x35d7cb['status'](_0x3bee46);return _0x35d7cb['set'](_0xfd19('0x22'),_0x4ff2ca+'-'+_0x16a23d+'/'+_0x4f7fe5)['json'](_0x15df01);}return null;};}function patchUpdates(_0x293116){return function(_0x5111ed){try{jsonpatch[_0xfd19('0x23')](_0x5111ed,_0x293116,!![]);}catch(_0x4d51b3){return BPromise[_0xfd19('0x24')](_0x4d51b3);}return _0x5111ed[_0xfd19('0x25')]();};}function saveUpdates(_0x52f60b,_0x3c1a78){return function(_0x4fc3f2){if(_0x4fc3f2){return _0x4fc3f2[_0xfd19('0x26')](_0x52f60b)[_0xfd19('0x27')](function(_0x3be9f8){return _0x3be9f8;});}return null;};}function removeEntity(_0x402666,_0x51968e){return function(_0x5c1cce){if(_0x5c1cce){return _0x5c1cce[_0xfd19('0x28')]()[_0xfd19('0x27')](function(){_0x402666[_0xfd19('0x1b')](0xcc)[_0xfd19('0x1c')]();});}};}function handleEntityNotFound(_0x111d84,_0x389516){return function(_0x407a90){if(!_0x407a90){_0x111d84[_0xfd19('0x1a')](0x194);}return _0x407a90;};}function handleError(_0x49ef61,_0x376733){_0x376733=_0x376733||0x1f4;return function(_0x489410){logger[_0xfd19('0x29')](_0x489410[_0xfd19('0x2a')]);if(_0x489410[_0xfd19('0x2b')]){delete _0x489410['name'];}_0x49ef61[_0xfd19('0x1b')](_0x376733)[_0xfd19('0x2c')](_0x489410);};}function getMustacheRender(_0x1b2548,_0x11745f){return Mustache['render'](_0x1b2548,_['merge'](_0x11745f['body'],{'contact':_0x11745f[_0xfd19('0x2d')],'message':_0x11745f[_0xfd19('0x2e')],'agent':_0x11745f[_0xfd19('0x2f')],'interaction':_0x11745f[_0xfd19('0x30')],'account':_0x11745f['account']}))||'';}exports[_0xfd19('0x31')]=function(_0x5b9b9f,_0x514581){var _0x3cc0ee={},_0x11e3f4={},_0x19b62d={'count':0x0,'rows':[]};var _0x2f16cb=_[_0xfd19('0x32')](db[_0xfd19('0x33')][_0xfd19('0x34')],function(_0x31f7ff){return{'name':_0x31f7ff[_0xfd19('0x35')],'type':_0x31f7ff[_0xfd19('0x36')][_0xfd19('0x37')]};});_0x11e3f4[_0xfd19('0x38')]=_[_0xfd19('0x32')](_0x2f16cb,_0xfd19('0x2b'));_0x11e3f4[_0xfd19('0x39')]=_['keys'](_0x5b9b9f['query']);_0x11e3f4[_0xfd19('0x3a')]=_[_0xfd19('0x3b')](_0x11e3f4[_0xfd19('0x38')],_0x11e3f4[_0xfd19('0x39')]);_0x3cc0ee['attributes']=_[_0xfd19('0x3b')](_0x11e3f4[_0xfd19('0x38')],qs['fields'](_0x5b9b9f[_0xfd19('0x39')]['fields']));_0x3cc0ee['attributes']=_0x3cc0ee[_0xfd19('0x3c')]['length']?_0x3cc0ee[_0xfd19('0x3c')]:_0x11e3f4[_0xfd19('0x38')];if(!_0x5b9b9f[_0xfd19('0x39')][_0xfd19('0x3d')](_0xfd19('0x3e'))){_0x3cc0ee[_0xfd19('0x21')]=qs[_0xfd19('0x21')](_0x5b9b9f['query'][_0xfd19('0x21')]);_0x3cc0ee[_0xfd19('0x1e')]=qs[_0xfd19('0x1e')](_0x5b9b9f[_0xfd19('0x39')]['offset']);}_0x3cc0ee['order']=qs[_0xfd19('0x3f')](_0x5b9b9f[_0xfd19('0x39')][_0xfd19('0x3f')]);_0x3cc0ee[_0xfd19('0x40')]=qs[_0xfd19('0x3a')](_[_0xfd19('0x41')](_0x5b9b9f[_0xfd19('0x39')],_0x11e3f4[_0xfd19('0x3a')]),_0x2f16cb);if(_0x5b9b9f[_0xfd19('0x39')][_0xfd19('0x42')]){_0x3cc0ee[_0xfd19('0x40')]=_[_0xfd19('0x43')](_0x3cc0ee[_0xfd19('0x40')],{'$or':_[_0xfd19('0x32')](_0x2f16cb,function(_0x816655){if(_0x816655[_0xfd19('0x36')]!==_0xfd19('0x44')){var _0x4d6f12={};_0x4d6f12[_0x816655[_0xfd19('0x2b')]]={'$like':'%'+_0x5b9b9f[_0xfd19('0x39')][_0xfd19('0x42')]+'%'};return _0x4d6f12;}})});}_0x3cc0ee=_[_0xfd19('0x43')]({},_0x3cc0ee,_0x5b9b9f[_0xfd19('0x45')]);var _0x103966={'where':_0x3cc0ee['where']};return db[_0xfd19('0x33')][_0xfd19('0x20')](_0x103966)[_0xfd19('0x27')](function(_0x3eef5e){_0x19b62d['count']=_0x3eef5e;if(_0x5b9b9f[_0xfd19('0x39')]['includeAll']){_0x3cc0ee['include']=[{'all':!![]}];}return db[_0xfd19('0x33')]['findAll'](_0x3cc0ee);})[_0xfd19('0x27')](function(_0x1988ad){_0x19b62d['rows']=_0x1988ad;return _0x19b62d;})[_0xfd19('0x27')](respondWithFilteredResult(_0x514581,_0x3cc0ee))[_0xfd19('0x46')](handleError(_0x514581,null));};exports[_0xfd19('0x47')]=function(_0x3cdd09,_0x3e4a4d){var _0x2a47fa={'raw':![],'where':{'id':_0x3cdd09[_0xfd19('0x48')]['id']}},_0x5b157a={};_0x5b157a[_0xfd19('0x38')]=_[_0xfd19('0x49')](db[_0xfd19('0x33')][_0xfd19('0x34')]);_0x5b157a[_0xfd19('0x39')]=_[_0xfd19('0x49')](_0x3cdd09['query']);_0x5b157a[_0xfd19('0x3a')]=_[_0xfd19('0x3b')](_0x5b157a[_0xfd19('0x38')],_0x5b157a[_0xfd19('0x39')]);_0x2a47fa['attributes']=_[_0xfd19('0x3b')](_0x5b157a[_0xfd19('0x38')],qs[_0xfd19('0x4a')](_0x3cdd09['query'][_0xfd19('0x4a')]));_0x2a47fa['attributes']=_0x2a47fa[_0xfd19('0x3c')][_0xfd19('0x4b')]?_0x2a47fa[_0xfd19('0x3c')]:_0x5b157a['model'];if(_0x3cdd09[_0xfd19('0x39')][_0xfd19('0x4c')]){_0x2a47fa[_0xfd19('0x4d')]=[{'all':!![]}];}_0x2a47fa=_[_0xfd19('0x43')]({},_0x2a47fa,_0x3cdd09[_0xfd19('0x45')]);return db[_0xfd19('0x33')][_0xfd19('0x4e')](_0x2a47fa)[_0xfd19('0x27')](handleEntityNotFound(_0x3e4a4d,null))[_0xfd19('0x27')](respondWithResult(_0x3e4a4d,null))[_0xfd19('0x46')](handleError(_0x3e4a4d,null));};exports[_0xfd19('0x4f')]=function(_0x8e5d7d,_0x5b573d){return db[_0xfd19('0x33')][_0xfd19('0x4f')](_0x8e5d7d[_0xfd19('0x50')],{})[_0xfd19('0x27')](respondWithResult(_0x5b573d,0xc9))[_0xfd19('0x46')](handleError(_0x5b573d,null));};exports[_0xfd19('0x26')]=function(_0x285976,_0x2a3953){if(_0x285976[_0xfd19('0x50')]['id']){delete _0x285976[_0xfd19('0x50')]['id'];}return db['Integration'][_0xfd19('0x4e')]({'where':{'id':_0x285976[_0xfd19('0x48')]['id']}})[_0xfd19('0x27')](handleEntityNotFound(_0x2a3953,null))[_0xfd19('0x27')](saveUpdates(_0x285976[_0xfd19('0x50')],null))[_0xfd19('0x27')](respondWithResult(_0x2a3953,null))[_0xfd19('0x46')](handleError(_0x2a3953,null));};exports[_0xfd19('0x28')]=function(_0x42a4cd,_0x49df86){return db[_0xfd19('0x33')][_0xfd19('0x4e')]({'where':{'id':_0x42a4cd[_0xfd19('0x48')]['id']}})[_0xfd19('0x27')](handleEntityNotFound(_0x49df86,null))['then'](removeEntity(_0x49df86,null))['catch'](handleError(_0x49df86,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6022664..6045c45 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 _0x3b09=['Integration','lodash','util','../../config/logger','api','moment','../../config/environment','./integration.attributes','exports','define'];(function(_0x1f8184,_0x59e343){var _0x3e19d8=function(_0x1a2a68){while(--_0x1a2a68){_0x1f8184['push'](_0x1f8184['shift']());}};_0x3e19d8(++_0x59e343);}(_0x3b09,0xb5));var _0x93b0=function(_0x319cd8,_0x1fc6e4){_0x319cd8=_0x319cd8-0x0;var _0x5b2306=_0x3b09[_0x319cd8];return _0x5b2306;};'use strict';var _=require(_0x93b0('0x0'));var util=require(_0x93b0('0x1'));var logger=require(_0x93b0('0x2'))(_0x93b0('0x3'));var moment=require(_0x93b0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x93b0('0x5'));var attributes=require(_0x93b0('0x6'));module[_0x93b0('0x7')]=function(_0x4cf89f,_0x183eeb){return _0x4cf89f[_0x93b0('0x8')](_0x93b0('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa37e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Integration','integrations','util','../../config/logger'];(function(_0x41cc3f,_0x2678a2){var _0x47ff58=function(_0x190d53){while(--_0x190d53){_0x41cc3f['push'](_0x41cc3f['shift']());}};_0x47ff58(++_0x2678a2);}(_0xa37e,0x102));var _0xea37=function(_0x9c6fec,_0x1051a7){_0x9c6fec=_0x9c6fec-0x0;var _0x5a7db9=_0xa37e[_0x9c6fec];return _0x5a7db9;};'use strict';var _=require('lodash');var util=require(_0xea37('0x0'));var logger=require(_0xea37('0x1'))(_0xea37('0x2'));var moment=require(_0xea37('0x3'));var BPromise=require(_0xea37('0x4'));var rp=require(_0xea37('0x5'));var fs=require('fs');var path=require(_0xea37('0x6'));var rimraf=require(_0xea37('0x7'));var config=require(_0xea37('0x8'));var attributes=require('./integration.attributes');module[_0xea37('0x9')]=function(_0x3a27cf,_0x26d7d0){return _0x3a27cf[_0xea37('0xa')](_0xea37('0xb'),attributes,{'tableName':_0xea37('0xc'),'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 f70641d..6818673 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 _0x6d4f=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x596787,_0x25fa2c){var _0x4eb6a6=function(_0x2d987b){while(--_0x2d987b){_0x596787['push'](_0x596787['shift']());}};_0x4eb6a6(++_0x25fa2c);}(_0x6d4f,0x121));var _0xf6d4=function(_0x445dc4,_0x3764da){_0x445dc4=_0x445dc4-0x0;var _0x19f060=_0x6d4f[_0x445dc4];return _0x19f060;};'use strict';var _=require(_0xf6d4('0x0'));var util=require(_0xf6d4('0x1'));var moment=require(_0xf6d4('0x2'));var BPromise=require(_0xf6d4('0x3'));var rs=require(_0xf6d4('0x4'));var fs=require('fs');var Redis=require(_0xf6d4('0x5'));var db=require(_0xf6d4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6d4('0x7'))(_0xf6d4('0x8'));var config=require(_0xf6d4('0x9'));var jayson=require(_0xf6d4('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x79f756,_0x2c0a3b,_0x507bba){return new BPromise(function(_0xc170c2,_0x4c533a){return client['request'](_0x79f756,_0x507bba)[_0xf6d4('0xb')](function(_0x424121){logger[_0xf6d4('0xc')](_0xf6d4('0xd'),_0x2c0a3b,_0xf6d4('0xe'));logger['debug'](_0xf6d4('0xf'),_0x2c0a3b,'request\x20sent',JSON[_0xf6d4('0x10')](_0x424121));if(_0x424121[_0xf6d4('0x11')]){if(_0x424121['error'][_0xf6d4('0x12')]===0x1f4){logger[_0xf6d4('0x11')](_0xf6d4('0xd'),_0x2c0a3b,_0x424121[_0xf6d4('0x11')][_0xf6d4('0x13')]);return _0x4c533a(_0x424121[_0xf6d4('0x11')][_0xf6d4('0x13')]);}logger[_0xf6d4('0x11')](_0xf6d4('0xd'),_0x2c0a3b,_0x424121[_0xf6d4('0x11')][_0xf6d4('0x13')]);return _0xc170c2(_0x424121[_0xf6d4('0x11')][_0xf6d4('0x13')]);}else{logger[_0xf6d4('0xc')](_0xf6d4('0xd'),_0x2c0a3b,_0xf6d4('0xe'));_0xc170c2(_0x424121[_0xf6d4('0x14')][_0xf6d4('0x13')]);}})[_0xf6d4('0x15')](function(_0x20c93d){logger['error'](_0xf6d4('0xd'),_0x2c0a3b,_0x20c93d);_0x4c533a(_0x20c93d);});});} \ No newline at end of file +var _0x1b07=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1b07,0x1ca));var _0x71b0=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x1b07[_0x22e47a];return _0x15a12a;};'use strict';var _=require(_0x71b0('0x0'));var util=require(_0x71b0('0x1'));var moment=require(_0x71b0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71b0('0x3'));var db=require(_0x71b0('0x4'))['db'];var utils=require(_0x71b0('0x5'));var logger=require(_0x71b0('0x6'))(_0x71b0('0x7'));var config=require('../../config/environment');var jayson=require(_0x71b0('0x8'));var client=jayson['client'][_0x71b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10a911,_0x449f9b,_0x5d010a){return new BPromise(function(_0x1c7534,_0x3b6dc5){return client[_0x71b0('0xa')](_0x10a911,_0x5d010a)[_0x71b0('0xb')](function(_0x42d503){logger[_0x71b0('0xc')](_0x71b0('0xd'),_0x449f9b,_0x71b0('0xe'));logger[_0x71b0('0xf')](_0x71b0('0x10'),_0x449f9b,_0x71b0('0xe'),JSON[_0x71b0('0x11')](_0x42d503));if(_0x42d503[_0x71b0('0x12')]){if(_0x42d503[_0x71b0('0x12')][_0x71b0('0x13')]===0x1f4){logger[_0x71b0('0x12')](_0x71b0('0xd'),_0x449f9b,_0x42d503[_0x71b0('0x12')][_0x71b0('0x14')]);return _0x3b6dc5(_0x42d503[_0x71b0('0x12')][_0x71b0('0x14')]);}logger['error'](_0x71b0('0xd'),_0x449f9b,_0x42d503[_0x71b0('0x12')]['message']);return _0x1c7534(_0x42d503[_0x71b0('0x12')][_0x71b0('0x14')]);}else{logger[_0x71b0('0xc')](_0x71b0('0xd'),_0x449f9b,_0x71b0('0xe'));_0x1c7534(_0x42d503[_0x71b0('0x15')][_0x71b0('0x14')]);}})['catch'](function(_0x54dd04){logger[_0x71b0('0x12')]('Integration,\x20%s,\x20%s',_0x449f9b,_0x54dd04);_0x3b6dc5(_0x54dd04);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3c2ae83..572c7f2 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 _0x94e7=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x1aa0bd,_0x40d2ee){var _0x4874f7=function(_0x349a10){while(--_0x349a10){_0x1aa0bd['push'](_0x1aa0bd['shift']());}};_0x4874f7(++_0x40d2ee);}(_0x94e7,0xe2));var _0x794e=function(_0x593b74,_0x21ddfb){_0x593b74=_0x593b74-0x0;var _0x1679b9=_0x94e7[_0x593b74];return _0x1679b9;};'use strict';var multer=require(_0x794e('0x0'));var util=require(_0x794e('0x1'));var path=require('path');var timeout=require(_0x794e('0x2'));var express=require(_0x794e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x794e('0x4'));var interaction=require(_0x794e('0x5'));var config=require('../../config/environment');var controller=require(_0x794e('0x6'));router['get']('/',auth[_0x794e('0x7')](),controller[_0x794e('0x8')]);router['get'](_0x794e('0x9'),auth[_0x794e('0x7')](),controller[_0x794e('0xa')]);router['get'](_0x794e('0xb'),auth['isAuthenticated'](),controller[_0x794e('0xc')]);router[_0x794e('0xd')]('/',auth['isAuthenticated'](),controller[_0x794e('0xe')]);router['put'](_0x794e('0xb'),auth[_0x794e('0x7')](),controller[_0x794e('0xf')]);router[_0x794e('0x10')](_0x794e('0xb'),auth[_0x794e('0x7')](),controller[_0x794e('0x11')]);module[_0x794e('0x12')]=router; \ No newline at end of file +var _0xf8b0=['put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','/describe','/:id'];(function(_0x1d3357,_0x158219){var _0x42586d=function(_0x2ba130){while(--_0x2ba130){_0x1d3357['push'](_0x1d3357['shift']());}};_0x42586d(++_0x158219);}(_0xf8b0,0xf4));var _0x0f8b=function(_0x168667,_0x3b51bd){_0x168667=_0x168667-0x0;var _0x47b1b1=_0xf8b0[_0x168667];return _0x47b1b1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f8b('0x0'));var timeout=require(_0x0f8b('0x1'));var express=require(_0x0f8b('0x2'));var router=express[_0x0f8b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0f8b('0x4'));var interaction=require(_0x0f8b('0x5'));var config=require('../../config/environment');var controller=require(_0x0f8b('0x6'));router[_0x0f8b('0x7')]('/',auth[_0x0f8b('0x8')](),controller['index']);router[_0x0f8b('0x7')](_0x0f8b('0x9'),auth[_0x0f8b('0x8')](),controller['describe']);router[_0x0f8b('0x7')](_0x0f8b('0xa'),auth[_0x0f8b('0x8')](),controller['show']);router['post']('/',auth[_0x0f8b('0x8')](),controller['create']);router[_0x0f8b('0xb')](_0x0f8b('0xa'),auth[_0x0f8b('0x8')](),controller[_0x0f8b('0xc')]);router[_0x0f8b('0xd')]('/:id',auth[_0x0f8b('0x8')](),controller[_0x0f8b('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index d908cba..8dbba3c 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 _0x0597=['SENT','RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0597,0x84));var _0x7059=function(_0xb0effb,_0x1c6f68){_0xb0effb=_0xb0effb-0x0;var _0x597740=_0x0597[_0xb0effb];return _0x597740;};'use strict';var Sequelize=require(_0x7059('0x0'));module[_0x7059('0x1')]={'integration':{'type':Sequelize[_0x7059('0x2')]},'eventChannel':{'type':Sequelize[_0x7059('0x2')]},'exitStatus':{'type':Sequelize[_0x7059('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x7059('0x3')]},'contacts':{'type':Sequelize[_0x7059('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7059('0x2')]},'calleridname':{'type':Sequelize[_0x7059('0x2')]},'queue':{'type':Sequelize[_0x7059('0x2')]},'interface':{'type':Sequelize[_0x7059('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7059('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7059('0x4')]},'talktime':{'type':Sequelize[_0x7059('0x3')]},'agentacw':{'type':Sequelize[_0x7059('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x7059('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7059('0x4')]},'agentdump':{'type':Sequelize[_0x7059('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7059('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x7059('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7059('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7059('0x2')]},'connectedlinename':{'type':Sequelize[_0x7059('0x2')]},'language':{'type':Sequelize[_0x7059('0x2')]},'accountcode':{'type':Sequelize[_0x7059('0x2')]},'context':{'type':Sequelize[_0x7059('0x2')]},'exten':{'type':Sequelize[_0x7059('0x2')]},'priority':{'type':Sequelize[_0x7059('0x2')]},'destchannel':{'type':Sequelize[_0x7059('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x7059('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7059('0x2')]},'destcalleridname':{'type':Sequelize[_0x7059('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7059('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7059('0x2')]},'destlanguage':{'type':Sequelize[_0x7059('0x2')]},'destaccountcode':{'type':Sequelize[_0x7059('0x2')]},'destcontext':{'type':Sequelize[_0x7059('0x2')]},'destexten':{'type':Sequelize[_0x7059('0x2')]},'destpriority':{'type':Sequelize[_0x7059('0x2')]},'destuniqueid':{'type':Sequelize[_0x7059('0x2')]},'messageId':{'type':Sequelize[_0x7059('0x2')]},'inReplyTo':{'type':Sequelize[_0x7059('0x2')]},'subject':{'type':Sequelize[_0x7059('0x2')]},'from':{'type':Sequelize[_0x7059('0x2')]},'to':{'type':Sequelize[_0x7059('0x2')]},'cc':{'type':Sequelize[_0x7059('0x2')]},'attachment':{'type':Sequelize[_0x7059('0x6')]},'html':{'type':Sequelize[_0x7059('0x6')]},'text':{'type':Sequelize[_0x7059('0x6')]},'status':{'type':Sequelize[_0x7059('0x7')](_0x7059('0x8'),'SENDING',_0x7059('0x9'),'FAILED')},'url':{'type':Sequelize[_0x7059('0x2')]},'app':{'type':Sequelize[_0x7059('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x7059('0x3')]}}; \ No newline at end of file +var _0xd79c=['TEXT','ENUM','RECEIVED','FAILED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0xd79c,0xca));var _0xcd79=function(_0x380b05,_0x354001){_0x380b05=_0x380b05-0x0;var _0x1cda5e=_0xd79c[_0x380b05];return _0x1cda5e;};'use strict';var Sequelize=require('sequelize');module[_0xcd79('0x0')]={'integration':{'type':Sequelize[_0xcd79('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xcd79('0x1')]},'ticketId':{'type':Sequelize[_0xcd79('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xcd79('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcd79('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xcd79('0x1')]},'membername':{'type':Sequelize[_0xcd79('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xcd79('0x2')]},'holdtime':{'type':Sequelize[_0xcd79('0x3')]},'agentcomplete':{'type':Sequelize[_0xcd79('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xcd79('0x2')]},'talktime':{'type':Sequelize[_0xcd79('0x3')]},'agentacw':{'type':Sequelize[_0xcd79('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xcd79('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xcd79('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xcd79('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xcd79('0x2')]},'lastevent':{'type':Sequelize[_0xcd79('0x1')]},'channel':{'type':Sequelize[_0xcd79('0x1')]},'channelstate':{'type':Sequelize[_0xcd79('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xcd79('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xcd79('0x1')]},'accountcode':{'type':Sequelize[_0xcd79('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcd79('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xcd79('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xcd79('0x1')]},'destcalleridname':{'type':Sequelize[_0xcd79('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xcd79('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xcd79('0x1')]},'destlanguage':{'type':Sequelize[_0xcd79('0x1')]},'destaccountcode':{'type':Sequelize[_0xcd79('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xcd79('0x1')]},'destpriority':{'type':Sequelize[_0xcd79('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xcd79('0x1')]},'inReplyTo':{'type':Sequelize[_0xcd79('0x1')]},'subject':{'type':Sequelize[_0xcd79('0x1')]},'from':{'type':Sequelize[_0xcd79('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xcd79('0x1')]},'attachment':{'type':Sequelize[_0xcd79('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xcd79('0x6')]('SENT','SENDING',_0xcd79('0x7'),_0xcd79('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xcd79('0x1')]},'appdata':{'type':Sequelize[_0xcd79('0x1')]},'projectId':{'type':Sequelize[_0xcd79('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 2eaf82b..3c692ae 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 _0xe348=['find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','error','name','send','render','merge','body','contact','message','interaction','account','index','map','IntegrationReport','fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','options','count','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','include','create'];(function(_0x1a0655,_0xda3081){var _0x20ed2f=function(_0xc3717){while(--_0xc3717){_0x1a0655['push'](_0x1a0655['shift']());}};_0x20ed2f(++_0xda3081);}(_0xe348,0x15b));var _0x8e34=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xe348[_0x39e283];return _0x7de89f;};'use strict';var emlformat=require(_0x8e34('0x0'));var rimraf=require(_0x8e34('0x1'));var zipdir=require(_0x8e34('0x2'));var jsonpatch=require(_0x8e34('0x3'));var rp=require(_0x8e34('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e34('0x5'));var util=require(_0x8e34('0x6'));var path=require('path');var sox=require(_0x8e34('0x7'));var csv=require(_0x8e34('0x8'));var ejs=require(_0x8e34('0x9'));var fs=require('fs');var fs_extra=require(_0x8e34('0xa'));var _=require(_0x8e34('0xb'));var squel=require('squel');var crypto=require(_0x8e34('0xc'));var jsforce=require(_0x8e34('0xd'));var deskjs=require(_0x8e34('0xe'));var toCsv=require(_0x8e34('0x8'));var querystring=require(_0x8e34('0xf'));var Papa=require(_0x8e34('0x10'));var Redis=require(_0x8e34('0x11'));var authService=require(_0x8e34('0x12'));var qs=require(_0x8e34('0x13'));var as=require(_0x8e34('0x14'));var hardwareService=require(_0x8e34('0x15'));var logger=require(_0x8e34('0x16'))(_0x8e34('0x17'));var utils=require(_0x8e34('0x18'));var config=require(_0x8e34('0x19'));var licenseUtil=require(_0x8e34('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33459d,_0x27f560){_0x27f560=_0x27f560||0xcc;return function(_0x29747f){if(_0x29747f){return _0x33459d[_0x8e34('0x1b')](_0x27f560);}return _0x33459d['status'](_0x27f560)[_0x8e34('0x1c')]();};}function respondWithResult(_0x12515d,_0x2324d3){_0x2324d3=_0x2324d3||0xc8;return function(_0x2359f8){if(_0x2359f8){return _0x12515d[_0x8e34('0x1d')](_0x2324d3)[_0x8e34('0x1e')](_0x2359f8);}};}function respondWithFilteredResult(_0x396718,_0x174d44){return function(_0x4bda77){if(_0x4bda77){var _0x4d7f42=typeof _0x174d44[_0x8e34('0x1f')]===_0x8e34('0x20')&&typeof _0x174d44[_0x8e34('0x21')]==='undefined';var _0x4810a3=_0x4bda77['count'];var _0x20a717=_0x4d7f42?0x0:_0x174d44['offset'];var _0x5c463a=_0x4d7f42?_0x4bda77['count']:_0x174d44['offset']+_0x174d44[_0x8e34('0x21')];var _0x9a1ddb;if(_0x5c463a>=_0x4810a3){_0x5c463a=_0x4810a3;_0x9a1ddb=0xc8;}else{_0x9a1ddb=0xce;}_0x396718[_0x8e34('0x1d')](_0x9a1ddb);return _0x396718[_0x8e34('0x22')](_0x8e34('0x23'),_0x20a717+'-'+_0x5c463a+'/'+_0x4810a3)['json'](_0x4bda77);}return null;};}function patchUpdates(_0xbd5ec3){return function(_0x1d6478){try{jsonpatch['apply'](_0x1d6478,_0xbd5ec3,!![]);}catch(_0x48384e){return BPromise[_0x8e34('0x24')](_0x48384e);}return _0x1d6478[_0x8e34('0x25')]();};}function saveUpdates(_0x4ebf80,_0x18c459){return function(_0x5b43ea){if(_0x5b43ea){return _0x5b43ea[_0x8e34('0x26')](_0x4ebf80)[_0x8e34('0x27')](function(_0x2b943e){return _0x2b943e;});}return null;};}function removeEntity(_0x4375ee,_0x490cbf){return function(_0x8c48b7){if(_0x8c48b7){return _0x8c48b7['destroy']()[_0x8e34('0x27')](function(){_0x4375ee['status'](0xcc)[_0x8e34('0x1c')]();});}};}function handleEntityNotFound(_0x2c9de8,_0x10c3a1){return function(_0x5c9799){if(!_0x5c9799){_0x2c9de8[_0x8e34('0x1b')](0x194);}return _0x5c9799;};}function handleError(_0x488604,_0x16eea3){_0x16eea3=_0x16eea3||0x1f4;return function(_0x230baa){logger[_0x8e34('0x28')](_0x230baa['stack']);if(_0x230baa[_0x8e34('0x29')]){delete _0x230baa[_0x8e34('0x29')];}_0x488604[_0x8e34('0x1d')](_0x16eea3)[_0x8e34('0x2a')](_0x230baa);};}function getMustacheRender(_0x251870,_0x2308f1){return Mustache[_0x8e34('0x2b')](_0x251870,_[_0x8e34('0x2c')](_0x2308f1[_0x8e34('0x2d')],{'contact':_0x2308f1[_0x8e34('0x2e')],'message':_0x2308f1[_0x8e34('0x2f')],'agent':_0x2308f1['agent'],'interaction':_0x2308f1[_0x8e34('0x30')],'account':_0x2308f1[_0x8e34('0x31')]}))||'';}exports[_0x8e34('0x32')]=function(_0x284ff9,_0x405a79){var _0x1fca32={},_0x59fc38={},_0x1c7322={'count':0x0,'rows':[]};var _0x55b6fe=_[_0x8e34('0x33')](db[_0x8e34('0x34')]['rawAttributes'],function(_0x2a5c0c){return{'name':_0x2a5c0c[_0x8e34('0x35')],'type':_0x2a5c0c[_0x8e34('0x36')][_0x8e34('0x37')]};});_0x59fc38[_0x8e34('0x38')]=_['map'](_0x55b6fe,_0x8e34('0x29'));_0x59fc38[_0x8e34('0x39')]=_[_0x8e34('0x3a')](_0x284ff9['query']);_0x59fc38['filters']=_['intersection'](_0x59fc38[_0x8e34('0x38')],_0x59fc38[_0x8e34('0x39')]);_0x1fca32['attributes']=_['intersection'](_0x59fc38[_0x8e34('0x38')],qs[_0x8e34('0x3b')](_0x284ff9[_0x8e34('0x39')]['fields']));_0x1fca32[_0x8e34('0x3c')]=_0x1fca32[_0x8e34('0x3c')][_0x8e34('0x3d')]?_0x1fca32['attributes']:_0x59fc38[_0x8e34('0x38')];if(!_0x284ff9[_0x8e34('0x39')][_0x8e34('0x3e')](_0x8e34('0x3f'))){_0x1fca32[_0x8e34('0x21')]=qs[_0x8e34('0x21')](_0x284ff9[_0x8e34('0x39')]['limit']);_0x1fca32['offset']=qs[_0x8e34('0x1f')](_0x284ff9[_0x8e34('0x39')]['offset']);}_0x1fca32[_0x8e34('0x40')]=qs[_0x8e34('0x41')](_0x284ff9[_0x8e34('0x39')][_0x8e34('0x41')]);_0x1fca32[_0x8e34('0x42')]=qs['filters'](_[_0x8e34('0x43')](_0x284ff9['query'],_0x59fc38[_0x8e34('0x44')]),_0x55b6fe);if(_0x284ff9[_0x8e34('0x39')]['filter']){_0x1fca32[_0x8e34('0x42')]=_[_0x8e34('0x2c')](_0x1fca32[_0x8e34('0x42')],{'$or':_[_0x8e34('0x33')](_0x55b6fe,function(_0x3b3746){if(_0x3b3746['type']!==_0x8e34('0x45')){var _0xeac467={};_0xeac467[_0x3b3746[_0x8e34('0x29')]]={'$like':'%'+_0x284ff9['query'][_0x8e34('0x46')]+'%'};return _0xeac467;}})});}_0x1fca32=_[_0x8e34('0x2c')]({},_0x1fca32,_0x284ff9[_0x8e34('0x47')]);var _0x31288f={'where':_0x1fca32[_0x8e34('0x42')]};return db[_0x8e34('0x34')]['count'](_0x31288f)[_0x8e34('0x27')](function(_0x50154e){_0x1c7322[_0x8e34('0x48')]=_0x50154e;if(_0x284ff9[_0x8e34('0x39')]['includeAll']){_0x1fca32['include']=[{'all':!![]}];}return db[_0x8e34('0x34')][_0x8e34('0x49')](_0x1fca32);})['then'](function(_0x5f08d4){_0x1c7322[_0x8e34('0x4a')]=_0x5f08d4;return _0x1c7322;})[_0x8e34('0x27')](respondWithFilteredResult(_0x405a79,_0x1fca32))[_0x8e34('0x4b')](handleError(_0x405a79,null));};exports[_0x8e34('0x4c')]=function(_0x2686e2,_0x5250c3){var _0x3fa883={'raw':![],'where':{'id':_0x2686e2[_0x8e34('0x4d')]['id']}},_0x2196af={};_0x2196af[_0x8e34('0x38')]=_[_0x8e34('0x3a')](db[_0x8e34('0x34')][_0x8e34('0x4e')]);_0x2196af[_0x8e34('0x39')]=_[_0x8e34('0x3a')](_0x2686e2[_0x8e34('0x39')]);_0x2196af[_0x8e34('0x44')]=_[_0x8e34('0x4f')](_0x2196af['model'],_0x2196af['query']);_0x3fa883[_0x8e34('0x3c')]=_[_0x8e34('0x4f')](_0x2196af[_0x8e34('0x38')],qs[_0x8e34('0x3b')](_0x2686e2[_0x8e34('0x39')]['fields']));_0x3fa883['attributes']=_0x3fa883[_0x8e34('0x3c')]['length']?_0x3fa883[_0x8e34('0x3c')]:_0x2196af['model'];if(_0x2686e2['query'][_0x8e34('0x50')]){_0x3fa883[_0x8e34('0x51')]=[{'all':!![]}];}_0x3fa883=_[_0x8e34('0x2c')]({},_0x3fa883,_0x2686e2[_0x8e34('0x47')]);return db['IntegrationReport']['find'](_0x3fa883)['then'](handleEntityNotFound(_0x5250c3,null))[_0x8e34('0x27')](respondWithResult(_0x5250c3,null))[_0x8e34('0x4b')](handleError(_0x5250c3,null));};exports['create']=function(_0x3f5c02,_0x5d8fa7){return db['IntegrationReport'][_0x8e34('0x52')](_0x3f5c02[_0x8e34('0x2d')],{})[_0x8e34('0x27')](respondWithResult(_0x5d8fa7,0xc9))['catch'](handleError(_0x5d8fa7,null));};exports[_0x8e34('0x26')]=function(_0x12ca35,_0x2de886){if(_0x12ca35[_0x8e34('0x2d')]['id']){delete _0x12ca35[_0x8e34('0x2d')]['id'];}return db[_0x8e34('0x34')][_0x8e34('0x53')]({'where':{'id':_0x12ca35[_0x8e34('0x4d')]['id']}})[_0x8e34('0x27')](handleEntityNotFound(_0x2de886,null))[_0x8e34('0x27')](saveUpdates(_0x12ca35[_0x8e34('0x2d')],null))['then'](respondWithResult(_0x2de886,null))[_0x8e34('0x4b')](handleError(_0x2de886,null));};exports[_0x8e34('0x54')]=function(_0x4b4d66,_0xd9eae1){return db[_0x8e34('0x34')]['find']({'where':{'id':_0x4b4d66[_0x8e34('0x4d')]['id']}})[_0x8e34('0x27')](handleEntityNotFound(_0xd9eae1,null))[_0x8e34('0x27')](removeEntity(_0xd9eae1,null))[_0x8e34('0x4b')](handleError(_0xd9eae1,null));};exports[_0x8e34('0x55')]=function(_0x2bee0d,_0x540139){return db['IntegrationReport'][_0x8e34('0x55')]()[_0x8e34('0x27')](respondWithResult(_0x540139,null))[_0x8e34('0x4b')](handleError(_0x540139,null));}; \ No newline at end of file +var _0x3968=['where','pick','filters','filter','merge','options','then','includeAll','findAll','rows','catch','show','length','include','find','create','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','status','set','reject','save','update','destroy','end','stack','name','send','render','body','contact','message','agent','interaction','account','index','map','IntegrationReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort'];(function(_0x11eb54,_0x35c410){var _0x248fe0=function(_0xc2719a){while(--_0xc2719a){_0x11eb54['push'](_0x11eb54['shift']());}};_0x248fe0(++_0x35c410);}(_0x3968,0x1ec));var _0x8396=function(_0x4ebbf0,_0x3336de){_0x4ebbf0=_0x4ebbf0-0x0;var _0x578b39=_0x3968[_0x4ebbf0];return _0x578b39;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8396('0x0'));var zipdir=require(_0x8396('0x1'));var jsonpatch=require(_0x8396('0x2'));var rp=require(_0x8396('0x3'));var moment=require(_0x8396('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8396('0x5'));var util=require('util');var path=require(_0x8396('0x6'));var sox=require(_0x8396('0x7'));var csv=require(_0x8396('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8396('0x9'));var _=require(_0x8396('0xa'));var squel=require(_0x8396('0xb'));var crypto=require(_0x8396('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8396('0xd'));var toCsv=require(_0x8396('0x8'));var querystring=require(_0x8396('0xe'));var Papa=require(_0x8396('0xf'));var Redis=require(_0x8396('0x10'));var authService=require(_0x8396('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8396('0x12'))('api');var utils=require(_0x8396('0x13'));var config=require(_0x8396('0x14'));var licenseUtil=require(_0x8396('0x15'));var db=require(_0x8396('0x16'))['db'];function respondWithStatusCode(_0xf5a37b,_0x2f7002){_0x2f7002=_0x2f7002||0xcc;return function(_0xe8dae6){if(_0xe8dae6){return _0xf5a37b[_0x8396('0x17')](_0x2f7002);}return _0xf5a37b['status'](_0x2f7002)['end']();};}function respondWithResult(_0xce3801,_0x184006){_0x184006=_0x184006||0xc8;return function(_0x1d9752){if(_0x1d9752){return _0xce3801['status'](_0x184006)[_0x8396('0x18')](_0x1d9752);}};}function respondWithFilteredResult(_0x2e089d,_0x373946){return function(_0x1d314c){if(_0x1d314c){var _0x3ff8a4=typeof _0x373946['offset']===_0x8396('0x19')&&typeof _0x373946['limit']===_0x8396('0x19');var _0x982e3a=_0x1d314c[_0x8396('0x1a')];var _0x57601e=_0x3ff8a4?0x0:_0x373946[_0x8396('0x1b')];var _0x304119=_0x3ff8a4?_0x1d314c[_0x8396('0x1a')]:_0x373946[_0x8396('0x1b')]+_0x373946[_0x8396('0x1c')];var _0x1ef3b0;if(_0x304119>=_0x982e3a){_0x304119=_0x982e3a;_0x1ef3b0=0xc8;}else{_0x1ef3b0=0xce;}_0x2e089d[_0x8396('0x1d')](_0x1ef3b0);return _0x2e089d[_0x8396('0x1e')]('Content-Range',_0x57601e+'-'+_0x304119+'/'+_0x982e3a)[_0x8396('0x18')](_0x1d314c);}return null;};}function patchUpdates(_0x5b7008){return function(_0x193867){try{jsonpatch['apply'](_0x193867,_0x5b7008,!![]);}catch(_0x521d7e){return BPromise[_0x8396('0x1f')](_0x521d7e);}return _0x193867[_0x8396('0x20')]();};}function saveUpdates(_0x3c367e,_0x320a49){return function(_0x28c004){if(_0x28c004){return _0x28c004[_0x8396('0x21')](_0x3c367e)['then'](function(_0x320f5e){return _0x320f5e;});}return null;};}function removeEntity(_0x503065,_0x28a8fc){return function(_0x21d498){if(_0x21d498){return _0x21d498[_0x8396('0x22')]()['then'](function(){_0x503065['status'](0xcc)[_0x8396('0x23')]();});}};}function handleEntityNotFound(_0x1419b9,_0x2a9dad){return function(_0x37aac1){if(!_0x37aac1){_0x1419b9[_0x8396('0x17')](0x194);}return _0x37aac1;};}function handleError(_0x5c026d,_0x290c49){_0x290c49=_0x290c49||0x1f4;return function(_0xccd696){logger['error'](_0xccd696[_0x8396('0x24')]);if(_0xccd696[_0x8396('0x25')]){delete _0xccd696[_0x8396('0x25')];}_0x5c026d[_0x8396('0x1d')](_0x290c49)[_0x8396('0x26')](_0xccd696);};}function getMustacheRender(_0x51c145,_0x3ed936){return Mustache[_0x8396('0x27')](_0x51c145,_['merge'](_0x3ed936[_0x8396('0x28')],{'contact':_0x3ed936[_0x8396('0x29')],'message':_0x3ed936[_0x8396('0x2a')],'agent':_0x3ed936[_0x8396('0x2b')],'interaction':_0x3ed936[_0x8396('0x2c')],'account':_0x3ed936[_0x8396('0x2d')]}))||'';}exports[_0x8396('0x2e')]=function(_0xfeb396,_0x2924a5){var _0x2c9cba={},_0x40c092={},_0x359450={'count':0x0,'rows':[]};var _0x21922f=_[_0x8396('0x2f')](db[_0x8396('0x30')][_0x8396('0x31')],function(_0x509875){return{'name':_0x509875[_0x8396('0x32')],'type':_0x509875[_0x8396('0x33')][_0x8396('0x34')]};});_0x40c092['model']=_[_0x8396('0x2f')](_0x21922f,_0x8396('0x25'));_0x40c092[_0x8396('0x35')]=_[_0x8396('0x36')](_0xfeb396[_0x8396('0x35')]);_0x40c092['filters']=_[_0x8396('0x37')](_0x40c092[_0x8396('0x38')],_0x40c092[_0x8396('0x35')]);_0x2c9cba[_0x8396('0x39')]=_[_0x8396('0x37')](_0x40c092[_0x8396('0x38')],qs[_0x8396('0x3a')](_0xfeb396[_0x8396('0x35')]['fields']));_0x2c9cba[_0x8396('0x39')]=_0x2c9cba[_0x8396('0x39')]['length']?_0x2c9cba[_0x8396('0x39')]:_0x40c092[_0x8396('0x38')];if(!_0xfeb396[_0x8396('0x35')][_0x8396('0x3b')]('nolimit')){_0x2c9cba[_0x8396('0x1c')]=qs[_0x8396('0x1c')](_0xfeb396[_0x8396('0x35')][_0x8396('0x1c')]);_0x2c9cba['offset']=qs[_0x8396('0x1b')](_0xfeb396['query'][_0x8396('0x1b')]);}_0x2c9cba['order']=qs[_0x8396('0x3c')](_0xfeb396['query'][_0x8396('0x3c')]);_0x2c9cba[_0x8396('0x3d')]=qs['filters'](_[_0x8396('0x3e')](_0xfeb396[_0x8396('0x35')],_0x40c092[_0x8396('0x3f')]),_0x21922f);if(_0xfeb396[_0x8396('0x35')][_0x8396('0x40')]){_0x2c9cba[_0x8396('0x3d')]=_['merge'](_0x2c9cba[_0x8396('0x3d')],{'$or':_['map'](_0x21922f,function(_0x17548a){if(_0x17548a['type']!=='VIRTUAL'){var _0x26bee4={};_0x26bee4[_0x17548a[_0x8396('0x25')]]={'$like':'%'+_0xfeb396[_0x8396('0x35')][_0x8396('0x40')]+'%'};return _0x26bee4;}})});}_0x2c9cba=_[_0x8396('0x41')]({},_0x2c9cba,_0xfeb396[_0x8396('0x42')]);var _0x59b7f0={'where':_0x2c9cba[_0x8396('0x3d')]};return db[_0x8396('0x30')][_0x8396('0x1a')](_0x59b7f0)[_0x8396('0x43')](function(_0xeaac53){_0x359450[_0x8396('0x1a')]=_0xeaac53;if(_0xfeb396['query'][_0x8396('0x44')]){_0x2c9cba['include']=[{'all':!![]}];}return db[_0x8396('0x30')][_0x8396('0x45')](_0x2c9cba);})['then'](function(_0x7f605e){_0x359450[_0x8396('0x46')]=_0x7f605e;return _0x359450;})['then'](respondWithFilteredResult(_0x2924a5,_0x2c9cba))[_0x8396('0x47')](handleError(_0x2924a5,null));};exports[_0x8396('0x48')]=function(_0x43999d,_0x13e024){var _0x2552d4={'raw':![],'where':{'id':_0x43999d['params']['id']}},_0x59ad45={};_0x59ad45[_0x8396('0x38')]=_[_0x8396('0x36')](db[_0x8396('0x30')][_0x8396('0x31')]);_0x59ad45[_0x8396('0x35')]=_['keys'](_0x43999d[_0x8396('0x35')]);_0x59ad45['filters']=_[_0x8396('0x37')](_0x59ad45[_0x8396('0x38')],_0x59ad45[_0x8396('0x35')]);_0x2552d4[_0x8396('0x39')]=_['intersection'](_0x59ad45[_0x8396('0x38')],qs['fields'](_0x43999d[_0x8396('0x35')][_0x8396('0x3a')]));_0x2552d4[_0x8396('0x39')]=_0x2552d4[_0x8396('0x39')][_0x8396('0x49')]?_0x2552d4[_0x8396('0x39')]:_0x59ad45['model'];if(_0x43999d[_0x8396('0x35')][_0x8396('0x44')]){_0x2552d4[_0x8396('0x4a')]=[{'all':!![]}];}_0x2552d4=_[_0x8396('0x41')]({},_0x2552d4,_0x43999d[_0x8396('0x42')]);return db[_0x8396('0x30')][_0x8396('0x4b')](_0x2552d4)['then'](handleEntityNotFound(_0x13e024,null))['then'](respondWithResult(_0x13e024,null))[_0x8396('0x47')](handleError(_0x13e024,null));};exports['create']=function(_0x21ec8c,_0x5a2d8d){return db[_0x8396('0x30')][_0x8396('0x4c')](_0x21ec8c[_0x8396('0x28')],{})[_0x8396('0x43')](respondWithResult(_0x5a2d8d,0xc9))[_0x8396('0x47')](handleError(_0x5a2d8d,null));};exports['update']=function(_0x19e106,_0x455b05){if(_0x19e106[_0x8396('0x28')]['id']){delete _0x19e106['body']['id'];}return db[_0x8396('0x30')]['find']({'where':{'id':_0x19e106[_0x8396('0x4d')]['id']}})[_0x8396('0x43')](handleEntityNotFound(_0x455b05,null))[_0x8396('0x43')](saveUpdates(_0x19e106[_0x8396('0x28')],null))[_0x8396('0x43')](respondWithResult(_0x455b05,null))[_0x8396('0x47')](handleError(_0x455b05,null));};exports[_0x8396('0x22')]=function(_0x2d2bc8,_0x259ce7){return db[_0x8396('0x30')][_0x8396('0x4b')]({'where':{'id':_0x2d2bc8[_0x8396('0x4d')]['id']}})[_0x8396('0x43')](handleEntityNotFound(_0x259ce7,null))[_0x8396('0x43')](removeEntity(_0x259ce7,null))[_0x8396('0x47')](handleError(_0x259ce7,null));};exports[_0x8396('0x4e')]=function(_0x20fb17,_0x46f395){return db['IntegrationReport'][_0x8396('0x4e')]()[_0x8396('0x43')](respondWithResult(_0x46f395,null))[_0x8396('0x47')](handleError(_0x46f395,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 4cbb2d8..551eb7e 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 _0x1ed3=['util','api','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash'];(function(_0x12428f,_0x3ef72b){var _0x5bdbbf=function(_0x3402ab){while(--_0x3402ab){_0x12428f['push'](_0x12428f['shift']());}};_0x5bdbbf(++_0x3ef72b);}(_0x1ed3,0x11f));var _0x31ed=function(_0x1afa30,_0xc036d5){_0x1afa30=_0x1afa30-0x0;var _0x45e4e6=_0x1ed3[_0x1afa30];return _0x45e4e6;};'use strict';var _=require(_0x31ed('0x0'));var util=require(_0x31ed('0x1'));var logger=require('../../config/logger')(_0x31ed('0x2'));var moment=require('moment');var BPromise=require(_0x31ed('0x3'));var rp=require(_0x31ed('0x4'));var fs=require('fs');var path=require(_0x31ed('0x5'));var rimraf=require('rimraf');var config=require(_0x31ed('0x6'));var attributes=require(_0x31ed('0x7'));module[_0x31ed('0x8')]=function(_0x14e844,_0x74fa3d){return _0x14e844[_0x31ed('0x9')](_0x31ed('0xa'),attributes,{'tableName':_0x31ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a89=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api'];(function(_0x4fa4fd,_0x4c656b){var _0x3c50d0=function(_0x223600){while(--_0x223600){_0x4fa4fd['push'](_0x4fa4fd['shift']());}};_0x3c50d0(++_0x4c656b);}(_0x5a89,0x1a1));var _0x95a8=function(_0xc3cc89,_0x543134){_0xc3cc89=_0xc3cc89-0x0;var _0x24d5ed=_0x5a89[_0xc3cc89];return _0x24d5ed;};'use strict';var _=require(_0x95a8('0x0'));var util=require('util');var logger=require(_0x95a8('0x1'))(_0x95a8('0x2'));var moment=require(_0x95a8('0x3'));var BPromise=require(_0x95a8('0x4'));var rp=require(_0x95a8('0x5'));var fs=require('fs');var path=require(_0x95a8('0x6'));var rimraf=require(_0x95a8('0x7'));var config=require(_0x95a8('0x8'));var attributes=require(_0x95a8('0x9'));module[_0x95a8('0xa')]=function(_0x2b8e3e,_0x3d0525){return _0x2b8e3e[_0x95a8('0xb')](_0x95a8('0xc'),attributes,{'tableName':_0x95a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 4241783..98e12b6 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x3e1211,_0xdbc60e){var _0x4ae704=function(_0x518c6c){while(--_0x518c6c){_0x3e1211['push'](_0x3e1211['shift']());}};_0x4ae704(++_0xdbc60e);}(_0x2032,0xd9));var _0x2203=function(_0x2be4e9,_0x26d99b){_0x2be4e9=_0x2be4e9-0x0;var _0x5e32e6=_0x2032[_0x2be4e9];return _0x5e32e6;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file +var _0x5eb8=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x22ced5,_0x2739c5){var _0x430dd0=function(_0x2190f4){while(--_0x2190f4){_0x22ced5['push'](_0x22ced5['shift']());}};_0x430dd0(++_0x2739c5);}(_0x5eb8,0xb0));var _0x85eb=function(_0x27842c,_0x324fcb){_0x27842c=_0x27842c-0x0;var _0x493de8=_0x5eb8[_0x27842c];return _0x493de8;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d6ca0af..dd8a570 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 _0x1040=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','/:id/sub_intervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete'];(function(_0x4a4b2c,_0x5a8c71){var _0x458f8f=function(_0x521f7a){while(--_0x521f7a){_0x4a4b2c['push'](_0x4a4b2c['shift']());}};_0x458f8f(++_0x5a8c71);}(_0x1040,0x116));var _0x0104=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x1040[_0x2cc594];return _0x4abff7;};'use strict';var multer=require(_0x0104('0x0'));var util=require(_0x0104('0x1'));var path=require(_0x0104('0x2'));var timeout=require('connect-timeout');var express=require(_0x0104('0x3'));var router=express[_0x0104('0x4')]();var fs_extra=require(_0x0104('0x5'));var auth=require(_0x0104('0x6'));var interaction=require(_0x0104('0x7'));var config=require(_0x0104('0x8'));var controller=require('./interval.controller');router['get']('/',auth[_0x0104('0x9')](),controller['index']);router[_0x0104('0xa')]('/:id',auth[_0x0104('0x9')](),controller[_0x0104('0xb')]);router[_0x0104('0xa')](_0x0104('0xc'),auth[_0x0104('0x9')](),controller['getIntervals']);router[_0x0104('0xd')]('/',auth[_0x0104('0x9')](),controller[_0x0104('0xe')]);router[_0x0104('0xd')](_0x0104('0xc'),auth['isAuthenticated'](),controller['addInterval']);router[_0x0104('0xd')](_0x0104('0xf'),auth[_0x0104('0x9')](),controller[_0x0104('0x10')]);router[_0x0104('0x11')](_0x0104('0x12'),auth[_0x0104('0x9')](),controller[_0x0104('0x13')]);router[_0x0104('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0104('0x15')]);module[_0x0104('0x16')]=router; \ No newline at end of file +var _0xfec2=['/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','create'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0xfec2,0x17c));var _0x2fec=function(_0x5b2932,_0x2d1b79){_0x5b2932=_0x5b2932-0x0;var _0x48ce75=_0xfec2[_0x5b2932];return _0x48ce75;};'use strict';var multer=require('multer');var util=require(_0x2fec('0x0'));var path=require(_0x2fec('0x1'));var timeout=require('connect-timeout');var express=require(_0x2fec('0x2'));var router=express[_0x2fec('0x3')]();var fs_extra=require(_0x2fec('0x4'));var auth=require(_0x2fec('0x5'));var interaction=require(_0x2fec('0x6'));var config=require('../../config/environment');var controller=require(_0x2fec('0x7'));router[_0x2fec('0x8')]('/',auth[_0x2fec('0x9')](),controller[_0x2fec('0xa')]);router['get'](_0x2fec('0xb'),auth['isAuthenticated'](),controller[_0x2fec('0xc')]);router[_0x2fec('0x8')](_0x2fec('0xd'),auth['isAuthenticated'](),controller['getIntervals']);router[_0x2fec('0xe')]('/',auth[_0x2fec('0x9')](),controller[_0x2fec('0xf')]);router[_0x2fec('0xe')](_0x2fec('0xd'),auth[_0x2fec('0x9')](),controller['addInterval']);router[_0x2fec('0xe')](_0x2fec('0x10'),auth[_0x2fec('0x9')](),controller[_0x2fec('0x11')]);router[_0x2fec('0x12')]('/:id',auth[_0x2fec('0x9')](),controller[_0x2fec('0x13')]);router[_0x2fec('0x14')](_0x2fec('0xb'),auth[_0x2fec('0x9')](),controller['destroy']);module[_0x2fec('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e176bfc..7f853b7 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 _0x5dea=['sequelize','exports','STRING'];(function(_0x442ccd,_0x415d61){var _0x1a2c10=function(_0x4ddd45){while(--_0x4ddd45){_0x442ccd['push'](_0x442ccd['shift']());}};_0x1a2c10(++_0x415d61);}(_0x5dea,0x1bc));var _0xa5de=function(_0x5a8aa2,_0x3af319){_0x5a8aa2=_0x5a8aa2-0x0;var _0x3e6dcd=_0x5dea[_0x5a8aa2];return _0x3e6dcd;};'use strict';var Sequelize=require(_0xa5de('0x0'));module[_0xa5de('0x1')]={'name':{'type':Sequelize[_0xa5de('0x2')]},'description':{'type':Sequelize[_0xa5de('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8de7=['exports','STRING'];(function(_0x2a4ff9,_0x234b40){var _0xeaa485=function(_0x7d9f3){while(--_0x7d9f3){_0x2a4ff9['push'](_0x2a4ff9['shift']());}};_0xeaa485(++_0x234b40);}(_0x8de7,0x1ee));var _0x78de=function(_0x753a6,_0x2bd0d6){_0x753a6=_0x753a6-0x0;var _0x4819bb=_0x8de7[_0x753a6];return _0x4819bb;};'use strict';var Sequelize=require('sequelize');module[_0x78de('0x0')]={'name':{'type':Sequelize[_0x78de('0x1')]},'description':{'type':Sequelize[_0x78de('0x1')]},'interval':{'type':Sequelize[_0x78de('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 8368ad1..30ec3b7 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 _0xf84f=['Interval','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','IntervalId','findOne','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','get','Intervals','UserProfileResource','error','name','send','render','merge','contact','message','interaction','account','index','map'];(function(_0xc9191e,_0x17842f){var _0x32b242=function(_0xc1fd81){while(--_0xc1fd81){_0xc9191e['push'](_0xc9191e['shift']());}};_0x32b242(++_0x17842f);}(_0xf84f,0x149));var _0xff84=function(_0x481161,_0x38bc77){_0x481161=_0x481161-0x0;var _0x35a129=_0xf84f[_0x481161];return _0x35a129;};'use strict';var emlformat=require(_0xff84('0x0'));var rimraf=require(_0xff84('0x1'));var zipdir=require(_0xff84('0x2'));var jsonpatch=require(_0xff84('0x3'));var rp=require(_0xff84('0x4'));var moment=require(_0xff84('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xff84('0x6'));var util=require(_0xff84('0x7'));var path=require(_0xff84('0x8'));var sox=require(_0xff84('0x9'));var csv=require(_0xff84('0xa'));var ejs=require(_0xff84('0xb'));var fs=require('fs');var fs_extra=require(_0xff84('0xc'));var _=require(_0xff84('0xd'));var squel=require(_0xff84('0xe'));var crypto=require(_0xff84('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff84('0xa'));var querystring=require(_0xff84('0x10'));var Papa=require(_0xff84('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff84('0x12'));var logger=require('../../config/logger')(_0xff84('0x13'));var utils=require('../../config/utils');var config=require(_0xff84('0x14'));var licenseUtil=require(_0xff84('0x15'));var db=require('../../mysqldb')['db'];var extensions=require(_0xff84('0x16'));function respondWithStatusCode(_0xd67e57,_0x39720b){_0x39720b=_0x39720b||0xcc;return function(_0x80a2ad){if(_0x80a2ad){return _0xd67e57[_0xff84('0x17')](_0x39720b);}return _0xd67e57[_0xff84('0x18')](_0x39720b)[_0xff84('0x19')]();};}function respondWithResult(_0x69944a,_0x5e52b1){_0x5e52b1=_0x5e52b1||0xc8;return function(_0x418ba5){if(_0x418ba5){return _0x69944a[_0xff84('0x18')](_0x5e52b1)[_0xff84('0x1a')](_0x418ba5);}};}function respondWithFilteredResult(_0x4e1836,_0x5900e8){return function(_0x224992){if(_0x224992){var _0x382071=typeof _0x5900e8[_0xff84('0x1b')]===_0xff84('0x1c')&&typeof _0x5900e8['limit']==='undefined';var _0x1f252a=_0x224992[_0xff84('0x1d')];var _0x51143b=_0x382071?0x0:_0x5900e8['offset'];var _0x4b585d=_0x382071?_0x224992[_0xff84('0x1d')]:_0x5900e8['offset']+_0x5900e8['limit'];var _0x3b4d0a;if(_0x4b585d>=_0x1f252a){_0x4b585d=_0x1f252a;_0x3b4d0a=0xc8;}else{_0x3b4d0a=0xce;}_0x4e1836['status'](_0x3b4d0a);return _0x4e1836[_0xff84('0x1e')](_0xff84('0x1f'),_0x51143b+'-'+_0x4b585d+'/'+_0x1f252a)['json'](_0x224992);}return null;};}function patchUpdates(_0x4aa426){return function(_0x557391){try{jsonpatch['apply'](_0x557391,_0x4aa426,!![]);}catch(_0x4d06da){return BPromise[_0xff84('0x20')](_0x4d06da);}return _0x557391[_0xff84('0x21')]();};}function saveUpdates(_0x4643a5,_0x9a46b6){return function(_0x26e2a9){if(_0x26e2a9){return _0x26e2a9[_0xff84('0x22')](_0x4643a5)['then'](function(_0x369fd7){return _0x369fd7;});}return null;};}function removeEntity(_0x47ea96,_0x196d7a){return function(_0x18583e){if(_0x18583e){return _0x18583e[_0xff84('0x23')]()[_0xff84('0x24')](function(){var _0x2a0502=_0x18583e[_0xff84('0x25')]({'plain':!![]});var _0x548353=_0xff84('0x26');return db[_0xff84('0x27')][_0xff84('0x23')]({'where':{'type':_0x548353,'resourceId':_0x2a0502['id']}})[_0xff84('0x24')](function(){return _0x18583e;});})['then'](function(){_0x47ea96[_0xff84('0x18')](0xcc)[_0xff84('0x19')]();});}};}function handleEntityNotFound(_0x3e0af0,_0x4af6fb){return function(_0x34b48c){if(!_0x34b48c){_0x3e0af0[_0xff84('0x17')](0x194);}return _0x34b48c;};}function handleError(_0x189756,_0x56f1b5){_0x56f1b5=_0x56f1b5||0x1f4;return function(_0x3f90f6){logger[_0xff84('0x28')](_0x3f90f6['stack']);if(_0x3f90f6[_0xff84('0x29')]){delete _0x3f90f6[_0xff84('0x29')];}_0x189756[_0xff84('0x18')](_0x56f1b5)[_0xff84('0x2a')](_0x3f90f6);};}function getMustacheRender(_0x498915,_0x1889ab){return Mustache[_0xff84('0x2b')](_0x498915,_[_0xff84('0x2c')](_0x1889ab['body'],{'contact':_0x1889ab[_0xff84('0x2d')],'message':_0x1889ab[_0xff84('0x2e')],'agent':_0x1889ab['agent'],'interaction':_0x1889ab[_0xff84('0x2f')],'account':_0x1889ab[_0xff84('0x30')]}))||'';}exports[_0xff84('0x31')]=function(_0x3ca0ec,_0xac8c0e){var _0x2acb00={},_0x219c08={},_0x9410f8={'count':0x0,'rows':[]};var _0x36c943=_[_0xff84('0x32')](db[_0xff84('0x33')]['rawAttributes'],function(_0x2e7b15){return{'name':_0x2e7b15[_0xff84('0x34')],'type':_0x2e7b15[_0xff84('0x35')][_0xff84('0x36')]};});_0x219c08[_0xff84('0x37')]=_[_0xff84('0x32')](_0x36c943,_0xff84('0x29'));_0x219c08[_0xff84('0x38')]=_['keys'](_0x3ca0ec[_0xff84('0x38')]);_0x219c08['filters']=_['intersection'](_0x219c08[_0xff84('0x37')],_0x219c08[_0xff84('0x38')]);_0x2acb00['attributes']=_[_0xff84('0x39')](_0x219c08[_0xff84('0x37')],qs[_0xff84('0x3a')](_0x3ca0ec[_0xff84('0x38')]['fields']));_0x2acb00[_0xff84('0x3b')]=_0x2acb00[_0xff84('0x3b')][_0xff84('0x3c')]?_0x2acb00[_0xff84('0x3b')]:_0x219c08[_0xff84('0x37')];if(!_0x3ca0ec[_0xff84('0x38')][_0xff84('0x3d')](_0xff84('0x3e'))){_0x2acb00[_0xff84('0x3f')]=qs[_0xff84('0x3f')](_0x3ca0ec[_0xff84('0x38')][_0xff84('0x3f')]);_0x2acb00['offset']=qs[_0xff84('0x1b')](_0x3ca0ec['query']['offset']);}_0x2acb00[_0xff84('0x40')]=qs['sort'](_0x3ca0ec[_0xff84('0x38')][_0xff84('0x41')]);_0x2acb00[_0xff84('0x42')]=qs['filters'](_[_0xff84('0x43')](_0x3ca0ec[_0xff84('0x38')],_0x219c08[_0xff84('0x44')]),_0x36c943);if(_0x3ca0ec['query']['filter']){_0x2acb00[_0xff84('0x42')]=_['merge'](_0x2acb00[_0xff84('0x42')],{'$or':_[_0xff84('0x32')](_0x36c943,function(_0x4c3167){if(_0x4c3167[_0xff84('0x35')]!=='VIRTUAL'){var _0x3d8a30={};_0x3d8a30[_0x4c3167['name']]={'$like':'%'+_0x3ca0ec[_0xff84('0x38')][_0xff84('0x45')]+'%'};return _0x3d8a30;}})});}_0x2acb00=_[_0xff84('0x2c')]({},_0x2acb00,_0x3ca0ec[_0xff84('0x46')]);var _0x39714b={'where':_0x2acb00[_0xff84('0x42')]};return db[_0xff84('0x33')][_0xff84('0x1d')](_0x39714b)[_0xff84('0x24')](function(_0x2766ce){_0x9410f8[_0xff84('0x1d')]=_0x2766ce;if(_0x3ca0ec[_0xff84('0x38')][_0xff84('0x47')]){_0x2acb00[_0xff84('0x48')]=[{'all':!![]}];}return db[_0xff84('0x33')][_0xff84('0x49')](_0x2acb00);})['then'](function(_0x33c5d8){_0x9410f8[_0xff84('0x4a')]=_0x33c5d8;return _0x9410f8;})[_0xff84('0x24')](respondWithFilteredResult(_0xac8c0e,_0x2acb00))[_0xff84('0x4b')](handleError(_0xac8c0e,null));};exports['show']=function(_0x5f0229,_0x2117d5){var _0x5b9fbf={'raw':!![],'where':{'id':_0x5f0229[_0xff84('0x4c')]['id']}},_0x38bb2c={};_0x38bb2c[_0xff84('0x37')]=_[_0xff84('0x4d')](db['Interval'][_0xff84('0x4e')]);_0x38bb2c[_0xff84('0x38')]=_['keys'](_0x5f0229[_0xff84('0x38')]);_0x38bb2c[_0xff84('0x44')]=_['intersection'](_0x38bb2c[_0xff84('0x37')],_0x38bb2c['query']);_0x5b9fbf[_0xff84('0x3b')]=_[_0xff84('0x39')](_0x38bb2c[_0xff84('0x37')],qs[_0xff84('0x3a')](_0x5f0229[_0xff84('0x38')][_0xff84('0x3a')]));_0x5b9fbf[_0xff84('0x3b')]=_0x5b9fbf[_0xff84('0x3b')]['length']?_0x5b9fbf['attributes']:_0x38bb2c[_0xff84('0x37')];if(_0x5f0229[_0xff84('0x38')][_0xff84('0x47')]){_0x5b9fbf[_0xff84('0x48')]=[{'all':!![]}];}_0x5b9fbf=_[_0xff84('0x2c')]({},_0x5b9fbf,_0x5f0229[_0xff84('0x46')]);return db[_0xff84('0x33')]['find'](_0x5b9fbf)['then'](handleEntityNotFound(_0x2117d5,null))[_0xff84('0x24')](respondWithResult(_0x2117d5,null))[_0xff84('0x4b')](handleError(_0x2117d5,null));};exports['create']=function(_0x44878b,_0xf7db99){return db[_0xff84('0x33')]['create'](_0x44878b['body'],{})[_0xff84('0x24')](function(_0x299bcf){var _0x5d74ed=_0x44878b[_0xff84('0x4f')][_0xff84('0x25')]({'plain':!![]});if(!_0x5d74ed)throw new Error(_0xff84('0x50'));if(_0x5d74ed[_0xff84('0x51')]===_0xff84('0x4f')){var _0x22a7bd=_0x299bcf[_0xff84('0x25')]({'plain':!![]});var _0x2cc8f3=_0xff84('0x26');return db[_0xff84('0x52')][_0xff84('0x53')]({'where':{'name':_0x2cc8f3,'userProfileId':_0x5d74ed['userProfileId']},'raw':!![]})[_0xff84('0x24')](function(_0xd0a379){if(_0xd0a379&&_0xd0a379[_0xff84('0x54')]===0x0){return db[_0xff84('0x27')][_0xff84('0x55')]({'name':_0x22a7bd['name'],'resourceId':_0x22a7bd['id'],'type':_0xd0a379[_0xff84('0x29')],'sectionId':_0xd0a379['id']},{})[_0xff84('0x24')](function(){return _0x299bcf;});}else{return _0x299bcf;}})[_0xff84('0x4b')](function(_0x3f0665){logger[_0xff84('0x28')](_0xff84('0x56'),_0x3f0665);throw _0x3f0665;});}return _0x299bcf;})[_0xff84('0x24')](respondWithResult(_0xf7db99,0xc9))['catch'](handleError(_0xf7db99,null));};exports[_0xff84('0x22')]=function(_0x1014ed,_0x306364){if(_0x1014ed[_0xff84('0x57')]['id']){delete _0x1014ed[_0xff84('0x57')]['id'];}return db[_0xff84('0x33')][_0xff84('0x53')]({'where':{'id':_0x1014ed[_0xff84('0x4c')]['id']}})['then'](handleEntityNotFound(_0x306364,null))['then'](saveUpdates(_0x1014ed[_0xff84('0x57')],null))[_0xff84('0x24')](respondWithResult(_0x306364,null))[_0xff84('0x4b')](handleError(_0x306364,null));};exports[_0xff84('0x23')]=function(_0x21889e,_0x2081c4){return db[_0xff84('0x33')][_0xff84('0x53')]({'where':{'id':_0x21889e[_0xff84('0x4c')]['id']}})[_0xff84('0x24')](handleEntityNotFound(_0x2081c4,null))['then'](removeEntity(_0x2081c4,null))[_0xff84('0x4b')](handleError(_0x2081c4,null));};exports['addInterval']=function(_0xa27e71,_0x2ad035,_0x2ca19e){if(_0xa27e71[_0xff84('0x57')]['id']){delete _0xa27e71[_0xff84('0x57')]['id'];}return db[_0xff84('0x33')]['find']({'where':{'id':_0xa27e71[_0xff84('0x4c')]['id']}})[_0xff84('0x24')](handleEntityNotFound(_0x2ad035,null))['then'](function(_0x420bcd){if(_0x420bcd){_0xa27e71['body'][_0xff84('0x58')]=_0x420bcd['id'];return db[_0xff84('0x33')][_0xff84('0x55')](_0xa27e71[_0xff84('0x57')]);}})['then'](respondWithResult(_0x2ad035,null))[_0xff84('0x4b')](handleError(_0x2ad035,null));};exports['getIntervals']=function(_0x5bc0cb,_0x258040,_0x3e0b3f){var _0x57a6be={};var _0x223fd7={};var _0x474f1;var _0x50e1ac;return db[_0xff84('0x33')][_0xff84('0x59')]({'where':{'id':_0x5bc0cb[_0xff84('0x4c')]['id']}})[_0xff84('0x24')](handleEntityNotFound(_0x258040,null))[_0xff84('0x24')](function(_0x481bba){if(_0x481bba){_0x474f1=_0x481bba;_0x223fd7[_0xff84('0x37')]=_[_0xff84('0x4d')](db['Interval'][_0xff84('0x4e')]);_0x223fd7[_0xff84('0x38')]=_[_0xff84('0x4d')](_0x5bc0cb[_0xff84('0x38')]);_0x223fd7[_0xff84('0x44')]=_[_0xff84('0x39')](_0x223fd7[_0xff84('0x37')],_0x223fd7[_0xff84('0x38')]);_0x57a6be[_0xff84('0x3b')]=_[_0xff84('0x39')](_0x223fd7['model'],qs[_0xff84('0x3a')](_0x5bc0cb[_0xff84('0x38')]['fields']));_0x57a6be[_0xff84('0x3b')]=_0x57a6be[_0xff84('0x3b')][_0xff84('0x3c')]?_0x57a6be[_0xff84('0x3b')]:_0x223fd7[_0xff84('0x37')];_0x57a6be[_0xff84('0x40')]=qs['sort'](_0x5bc0cb[_0xff84('0x38')][_0xff84('0x41')]);_0x57a6be['where']=qs[_0xff84('0x44')](_[_0xff84('0x43')](_0x5bc0cb['query'],_0x223fd7[_0xff84('0x44')]));if(_0x5bc0cb['query'][_0xff84('0x45')]){_0x57a6be[_0xff84('0x42')]=_[_0xff84('0x2c')](_0x57a6be['where'],{'$or':_[_0xff84('0x32')](_0x57a6be[_0xff84('0x3b')],function(_0x140d69){var _0x2e8777={};_0x2e8777[_0x140d69]={'$like':'%'+_0x5bc0cb[_0xff84('0x38')][_0xff84('0x45')]+'%'};return _0x2e8777;})});}_0x57a6be=_[_0xff84('0x2c')]({},_0x57a6be,_0x5bc0cb[_0xff84('0x46')]);return _0x474f1[_0xff84('0x5a')](_0x57a6be);}})[_0xff84('0x24')](function(_0x268dd2){if(_0x268dd2){_0x50e1ac=_0x268dd2[_0xff84('0x3c')];if(!_0x5bc0cb['query'][_0xff84('0x3d')](_0xff84('0x3e'))){_0x57a6be[_0xff84('0x3f')]=qs[_0xff84('0x3f')](_0x5bc0cb['query'][_0xff84('0x3f')]);_0x57a6be[_0xff84('0x1b')]=qs['offset'](_0x5bc0cb[_0xff84('0x38')][_0xff84('0x1b')]);}return _0x474f1[_0xff84('0x5a')](_0x57a6be);}})[_0xff84('0x24')](function(_0x386a37){if(_0x386a37){return _0x386a37?{'count':_0x50e1ac,'rows':_0x386a37}:null;}})[_0xff84('0x24')](respondWithResult(_0x258040,null))[_0xff84('0x4b')](handleError(_0x258040,null));};exports[_0xff84('0x5b')]=function(_0x465ef2,_0x1ce581,_0x2b3d78){return db[_0xff84('0x33')]['findOne']({'where':{'id':_0x465ef2[_0xff84('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ce581,null))[_0xff84('0x24')](function(_0x54e220){if(_0x54e220){return db[_0xff84('0x5c')][_0xff84('0x5d')](function(_0x38152c){return db[_0xff84('0x33')][_0xff84('0x23')]({'where':{'IntervalId':_0x465ef2[_0xff84('0x4c')]['id']},'transaction':_0x38152c})[_0xff84('0x24')](function(_0x18b302){var _0xdbcc57=_['map'](_0x465ef2[_0xff84('0x57')],function(_0x143b30){delete _0x143b30['id'];_0x143b30[_0xff84('0x58')]=_0x465ef2[_0xff84('0x4c')]['id'];return _0x143b30;});return db[_0xff84('0x33')][_0xff84('0x5e')](_0xdbcc57,{'transaction':_0x38152c});});})[_0xff84('0x24')](function(){return db['Interval'][_0xff84('0x49')]({'where':{'IntervalId':_0x465ef2[_0xff84('0x4c')]['id']}});});}})[_0xff84('0x24')](respondWithResult(_0x1ce581,null))[_0xff84('0x4b')](handleError(_0x1ce581,null));}; \ No newline at end of file +var _0x4194=['sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','get','Intervals','destroy','error','stack','name','send','body','contact','message','agent','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','Interval','rows','catch','show','params','include','options','find','create','role','UserProfileSection','userProfileId','autoAssociation','update','addInterval','IntervalId','getIntervals','findOne','addIntervals','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x4194,0x112));var _0x4419=function(_0x57d3f3,_0x5db070){_0x57d3f3=_0x57d3f3-0x0;var _0x5d3d65=_0x4194[_0x57d3f3];return _0x5d3d65;};'use strict';var emlformat=require(_0x4419('0x0'));var rimraf=require(_0x4419('0x1'));var zipdir=require(_0x4419('0x2'));var jsonpatch=require(_0x4419('0x3'));var rp=require(_0x4419('0x4'));var moment=require(_0x4419('0x5'));var BPromise=require(_0x4419('0x6'));var Mustache=require('mustache');var util=require(_0x4419('0x7'));var path=require('path');var sox=require(_0x4419('0x8'));var csv=require(_0x4419('0x9'));var ejs=require(_0x4419('0xa'));var fs=require('fs');var fs_extra=require(_0x4419('0xb'));var _=require(_0x4419('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4419('0xd'));var deskjs=require(_0x4419('0xe'));var toCsv=require(_0x4419('0x9'));var querystring=require(_0x4419('0xf'));var Papa=require(_0x4419('0x10'));var Redis=require('ioredis');var authService=require(_0x4419('0x11'));var qs=require(_0x4419('0x12'));var as=require(_0x4419('0x13'));var hardwareService=require(_0x4419('0x14'));var logger=require(_0x4419('0x15'))(_0x4419('0x16'));var utils=require(_0x4419('0x17'));var config=require(_0x4419('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x4419('0x19'));function respondWithStatusCode(_0x3fc9d2,_0x43111d){_0x43111d=_0x43111d||0xcc;return function(_0x5164d5){if(_0x5164d5){return _0x3fc9d2[_0x4419('0x1a')](_0x43111d);}return _0x3fc9d2[_0x4419('0x1b')](_0x43111d)[_0x4419('0x1c')]();};}function respondWithResult(_0x47bca0,_0x296a7c){_0x296a7c=_0x296a7c||0xc8;return function(_0x29b27e){if(_0x29b27e){return _0x47bca0['status'](_0x296a7c)['json'](_0x29b27e);}};}function respondWithFilteredResult(_0x219a29,_0x16e9c2){return function(_0x2f8b88){if(_0x2f8b88){var _0x50568b=typeof _0x16e9c2[_0x4419('0x1d')]===_0x4419('0x1e')&&typeof _0x16e9c2[_0x4419('0x1f')]==='undefined';var _0x35db79=_0x2f8b88['count'];var _0x4f896c=_0x50568b?0x0:_0x16e9c2[_0x4419('0x1d')];var _0x584d1c=_0x50568b?_0x2f8b88[_0x4419('0x20')]:_0x16e9c2[_0x4419('0x1d')]+_0x16e9c2[_0x4419('0x1f')];var _0x4dc812;if(_0x584d1c>=_0x35db79){_0x584d1c=_0x35db79;_0x4dc812=0xc8;}else{_0x4dc812=0xce;}_0x219a29[_0x4419('0x1b')](_0x4dc812);return _0x219a29[_0x4419('0x21')]('Content-Range',_0x4f896c+'-'+_0x584d1c+'/'+_0x35db79)[_0x4419('0x22')](_0x2f8b88);}return null;};}function patchUpdates(_0x44ef81){return function(_0x445ef8){try{jsonpatch[_0x4419('0x23')](_0x445ef8,_0x44ef81,!![]);}catch(_0x48a81e){return BPromise[_0x4419('0x24')](_0x48a81e);}return _0x445ef8[_0x4419('0x25')]();};}function saveUpdates(_0x1410a2,_0x4c27c9){return function(_0x15861b){if(_0x15861b){return _0x15861b['update'](_0x1410a2)['then'](function(_0x27d2d4){return _0x27d2d4;});}return null;};}function removeEntity(_0x561b58,_0x299aa9){return function(_0xd7f6e5){if(_0xd7f6e5){return _0xd7f6e5['destroy']()[_0x4419('0x26')](function(){var _0x4e5c25=_0xd7f6e5[_0x4419('0x27')]({'plain':!![]});var _0x337019=_0x4419('0x28');return db['UserProfileResource'][_0x4419('0x29')]({'where':{'type':_0x337019,'resourceId':_0x4e5c25['id']}})[_0x4419('0x26')](function(){return _0xd7f6e5;});})[_0x4419('0x26')](function(){_0x561b58[_0x4419('0x1b')](0xcc)[_0x4419('0x1c')]();});}};}function handleEntityNotFound(_0x596234,_0x552f0f){return function(_0x310bbe){if(!_0x310bbe){_0x596234[_0x4419('0x1a')](0x194);}return _0x310bbe;};}function handleError(_0x195644,_0x1a3246){_0x1a3246=_0x1a3246||0x1f4;return function(_0x8dbae6){logger[_0x4419('0x2a')](_0x8dbae6[_0x4419('0x2b')]);if(_0x8dbae6[_0x4419('0x2c')]){delete _0x8dbae6[_0x4419('0x2c')];}_0x195644[_0x4419('0x1b')](_0x1a3246)[_0x4419('0x2d')](_0x8dbae6);};}function getMustacheRender(_0x3dd6d6,_0x4905a0){return Mustache['render'](_0x3dd6d6,_['merge'](_0x4905a0[_0x4419('0x2e')],{'contact':_0x4905a0[_0x4419('0x2f')],'message':_0x4905a0[_0x4419('0x30')],'agent':_0x4905a0[_0x4419('0x31')],'interaction':_0x4905a0['interaction'],'account':_0x4905a0['account']}))||'';}exports['index']=function(_0x3a5381,_0xcb2d76){var _0x2753cc={},_0x10cee4={},_0x3e29b8={'count':0x0,'rows':[]};var _0x5ae3b9=_[_0x4419('0x32')](db['Interval'][_0x4419('0x33')],function(_0xbee0c7){return{'name':_0xbee0c7[_0x4419('0x34')],'type':_0xbee0c7[_0x4419('0x35')][_0x4419('0x36')]};});_0x10cee4[_0x4419('0x37')]=_[_0x4419('0x32')](_0x5ae3b9,'name');_0x10cee4[_0x4419('0x38')]=_[_0x4419('0x39')](_0x3a5381[_0x4419('0x38')]);_0x10cee4[_0x4419('0x3a')]=_['intersection'](_0x10cee4['model'],_0x10cee4['query']);_0x2753cc[_0x4419('0x3b')]=_[_0x4419('0x3c')](_0x10cee4[_0x4419('0x37')],qs[_0x4419('0x3d')](_0x3a5381[_0x4419('0x38')][_0x4419('0x3d')]));_0x2753cc[_0x4419('0x3b')]=_0x2753cc[_0x4419('0x3b')][_0x4419('0x3e')]?_0x2753cc['attributes']:_0x10cee4[_0x4419('0x37')];if(!_0x3a5381['query'][_0x4419('0x3f')](_0x4419('0x40'))){_0x2753cc[_0x4419('0x1f')]=qs[_0x4419('0x1f')](_0x3a5381[_0x4419('0x38')][_0x4419('0x1f')]);_0x2753cc['offset']=qs[_0x4419('0x1d')](_0x3a5381[_0x4419('0x38')][_0x4419('0x1d')]);}_0x2753cc[_0x4419('0x41')]=qs[_0x4419('0x42')](_0x3a5381[_0x4419('0x38')][_0x4419('0x42')]);_0x2753cc['where']=qs[_0x4419('0x3a')](_[_0x4419('0x43')](_0x3a5381[_0x4419('0x38')],_0x10cee4['filters']),_0x5ae3b9);if(_0x3a5381[_0x4419('0x38')][_0x4419('0x44')]){_0x2753cc[_0x4419('0x45')]=_['merge'](_0x2753cc[_0x4419('0x45')],{'$or':_[_0x4419('0x32')](_0x5ae3b9,function(_0x4286d5){if(_0x4286d5[_0x4419('0x35')]!==_0x4419('0x46')){var _0xe7896e={};_0xe7896e[_0x4286d5['name']]={'$like':'%'+_0x3a5381[_0x4419('0x38')][_0x4419('0x44')]+'%'};return _0xe7896e;}})});}_0x2753cc=_[_0x4419('0x47')]({},_0x2753cc,_0x3a5381['options']);var _0xe22328={'where':_0x2753cc['where']};return db['Interval'][_0x4419('0x20')](_0xe22328)[_0x4419('0x26')](function(_0x5015da){_0x3e29b8[_0x4419('0x20')]=_0x5015da;if(_0x3a5381['query'][_0x4419('0x48')]){_0x2753cc['include']=[{'all':!![]}];}return db[_0x4419('0x49')]['findAll'](_0x2753cc);})[_0x4419('0x26')](function(_0x47015d){_0x3e29b8[_0x4419('0x4a')]=_0x47015d;return _0x3e29b8;})[_0x4419('0x26')](respondWithFilteredResult(_0xcb2d76,_0x2753cc))[_0x4419('0x4b')](handleError(_0xcb2d76,null));};exports[_0x4419('0x4c')]=function(_0x19fd3f,_0x186b60){var _0x4fbd00={'raw':!![],'where':{'id':_0x19fd3f[_0x4419('0x4d')]['id']}},_0x8be4fa={};_0x8be4fa['model']=_[_0x4419('0x39')](db[_0x4419('0x49')][_0x4419('0x33')]);_0x8be4fa[_0x4419('0x38')]=_[_0x4419('0x39')](_0x19fd3f[_0x4419('0x38')]);_0x8be4fa[_0x4419('0x3a')]=_[_0x4419('0x3c')](_0x8be4fa[_0x4419('0x37')],_0x8be4fa[_0x4419('0x38')]);_0x4fbd00['attributes']=_[_0x4419('0x3c')](_0x8be4fa[_0x4419('0x37')],qs[_0x4419('0x3d')](_0x19fd3f[_0x4419('0x38')][_0x4419('0x3d')]));_0x4fbd00[_0x4419('0x3b')]=_0x4fbd00[_0x4419('0x3b')][_0x4419('0x3e')]?_0x4fbd00[_0x4419('0x3b')]:_0x8be4fa['model'];if(_0x19fd3f[_0x4419('0x38')][_0x4419('0x48')]){_0x4fbd00[_0x4419('0x4e')]=[{'all':!![]}];}_0x4fbd00=_[_0x4419('0x47')]({},_0x4fbd00,_0x19fd3f[_0x4419('0x4f')]);return db[_0x4419('0x49')][_0x4419('0x50')](_0x4fbd00)[_0x4419('0x26')](handleEntityNotFound(_0x186b60,null))['then'](respondWithResult(_0x186b60,null))['catch'](handleError(_0x186b60,null));};exports[_0x4419('0x51')]=function(_0x3c1029,_0x5305b0){return db['Interval'][_0x4419('0x51')](_0x3c1029[_0x4419('0x2e')],{})['then'](function(_0x524d1e){var _0x48f00e=_0x3c1029['user']['get']({'plain':!![]});if(!_0x48f00e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48f00e[_0x4419('0x52')]==='user'){var _0x3df354=_0x524d1e[_0x4419('0x27')]({'plain':!![]});var _0x5807db=_0x4419('0x28');return db[_0x4419('0x53')][_0x4419('0x50')]({'where':{'name':_0x5807db,'userProfileId':_0x48f00e[_0x4419('0x54')]},'raw':!![]})[_0x4419('0x26')](function(_0x568cf4){if(_0x568cf4&&_0x568cf4[_0x4419('0x55')]===0x0){return db['UserProfileResource'][_0x4419('0x51')]({'name':_0x3df354[_0x4419('0x2c')],'resourceId':_0x3df354['id'],'type':_0x568cf4[_0x4419('0x2c')],'sectionId':_0x568cf4['id']},{})[_0x4419('0x26')](function(){return _0x524d1e;});}else{return _0x524d1e;}})[_0x4419('0x4b')](function(_0x26cb1f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26cb1f);throw _0x26cb1f;});}return _0x524d1e;})['then'](respondWithResult(_0x5305b0,0xc9))['catch'](handleError(_0x5305b0,null));};exports[_0x4419('0x56')]=function(_0x3f1282,_0x487499){if(_0x3f1282['body']['id']){delete _0x3f1282['body']['id'];}return db[_0x4419('0x49')][_0x4419('0x50')]({'where':{'id':_0x3f1282['params']['id']}})['then'](handleEntityNotFound(_0x487499,null))[_0x4419('0x26')](saveUpdates(_0x3f1282['body'],null))['then'](respondWithResult(_0x487499,null))[_0x4419('0x4b')](handleError(_0x487499,null));};exports['destroy']=function(_0x35e94d,_0x3d3697){return db['Interval'][_0x4419('0x50')]({'where':{'id':_0x35e94d[_0x4419('0x4d')]['id']}})[_0x4419('0x26')](handleEntityNotFound(_0x3d3697,null))[_0x4419('0x26')](removeEntity(_0x3d3697,null))[_0x4419('0x4b')](handleError(_0x3d3697,null));};exports[_0x4419('0x57')]=function(_0x5afb0a,_0x9ab8bd,_0x153d90){if(_0x5afb0a['body']['id']){delete _0x5afb0a[_0x4419('0x2e')]['id'];}return db['Interval'][_0x4419('0x50')]({'where':{'id':_0x5afb0a['params']['id']}})[_0x4419('0x26')](handleEntityNotFound(_0x9ab8bd,null))['then'](function(_0x2a3128){if(_0x2a3128){_0x5afb0a[_0x4419('0x2e')][_0x4419('0x58')]=_0x2a3128['id'];return db['Interval'][_0x4419('0x51')](_0x5afb0a['body']);}})[_0x4419('0x26')](respondWithResult(_0x9ab8bd,null))[_0x4419('0x4b')](handleError(_0x9ab8bd,null));};exports[_0x4419('0x59')]=function(_0x52fb21,_0x482bc9,_0x484ee2){var _0x3b0c8a={};var _0x3442ed={};var _0x236886;var _0x3208ce;return db[_0x4419('0x49')][_0x4419('0x5a')]({'where':{'id':_0x52fb21[_0x4419('0x4d')]['id']}})['then'](handleEntityNotFound(_0x482bc9,null))[_0x4419('0x26')](function(_0x1eb8dc){if(_0x1eb8dc){_0x236886=_0x1eb8dc;_0x3442ed[_0x4419('0x37')]=_[_0x4419('0x39')](db[_0x4419('0x49')][_0x4419('0x33')]);_0x3442ed[_0x4419('0x38')]=_[_0x4419('0x39')](_0x52fb21['query']);_0x3442ed[_0x4419('0x3a')]=_['intersection'](_0x3442ed[_0x4419('0x37')],_0x3442ed[_0x4419('0x38')]);_0x3b0c8a[_0x4419('0x3b')]=_[_0x4419('0x3c')](_0x3442ed[_0x4419('0x37')],qs[_0x4419('0x3d')](_0x52fb21[_0x4419('0x38')][_0x4419('0x3d')]));_0x3b0c8a[_0x4419('0x3b')]=_0x3b0c8a[_0x4419('0x3b')][_0x4419('0x3e')]?_0x3b0c8a[_0x4419('0x3b')]:_0x3442ed[_0x4419('0x37')];_0x3b0c8a[_0x4419('0x41')]=qs[_0x4419('0x42')](_0x52fb21[_0x4419('0x38')][_0x4419('0x42')]);_0x3b0c8a[_0x4419('0x45')]=qs[_0x4419('0x3a')](_['pick'](_0x52fb21[_0x4419('0x38')],_0x3442ed[_0x4419('0x3a')]));if(_0x52fb21['query']['filter']){_0x3b0c8a[_0x4419('0x45')]=_[_0x4419('0x47')](_0x3b0c8a[_0x4419('0x45')],{'$or':_[_0x4419('0x32')](_0x3b0c8a[_0x4419('0x3b')],function(_0x25d5c1){var _0x3d60b4={};_0x3d60b4[_0x25d5c1]={'$like':'%'+_0x52fb21['query'][_0x4419('0x44')]+'%'};return _0x3d60b4;})});}_0x3b0c8a=_[_0x4419('0x47')]({},_0x3b0c8a,_0x52fb21['options']);return _0x236886[_0x4419('0x59')](_0x3b0c8a);}})[_0x4419('0x26')](function(_0x300d34){if(_0x300d34){_0x3208ce=_0x300d34[_0x4419('0x3e')];if(!_0x52fb21['query'][_0x4419('0x3f')]('nolimit')){_0x3b0c8a[_0x4419('0x1f')]=qs['limit'](_0x52fb21[_0x4419('0x38')][_0x4419('0x1f')]);_0x3b0c8a[_0x4419('0x1d')]=qs[_0x4419('0x1d')](_0x52fb21[_0x4419('0x38')][_0x4419('0x1d')]);}return _0x236886[_0x4419('0x59')](_0x3b0c8a);}})[_0x4419('0x26')](function(_0x595c69){if(_0x595c69){return _0x595c69?{'count':_0x3208ce,'rows':_0x595c69}:null;}})[_0x4419('0x26')](respondWithResult(_0x482bc9,null))['catch'](handleError(_0x482bc9,null));};exports[_0x4419('0x5b')]=function(_0x42178b,_0x3c648c,_0x44d492){return db['Interval'][_0x4419('0x5a')]({'where':{'id':_0x42178b['params']['id']}})[_0x4419('0x26')](handleEntityNotFound(_0x3c648c,null))[_0x4419('0x26')](function(_0x6a30aa){if(_0x6a30aa){return db['sequelize']['transaction'](function(_0x32789c){return db[_0x4419('0x49')][_0x4419('0x29')]({'where':{'IntervalId':_0x42178b[_0x4419('0x4d')]['id']},'transaction':_0x32789c})[_0x4419('0x26')](function(_0x4edee4){var _0x372c0c=_[_0x4419('0x32')](_0x42178b[_0x4419('0x2e')],function(_0x926d4e){delete _0x926d4e['id'];_0x926d4e[_0x4419('0x58')]=_0x42178b[_0x4419('0x4d')]['id'];return _0x926d4e;});return db[_0x4419('0x49')][_0x4419('0x5c')](_0x372c0c,{'transaction':_0x32789c});});})[_0x4419('0x26')](function(){return db[_0x4419('0x49')][_0x4419('0x5d')]({'where':{'IntervalId':_0x42178b[_0x4419('0x4d')]['id']}});});}})[_0x4419('0x26')](respondWithResult(_0x3c648c,null))['catch'](handleError(_0x3c648c,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index eae3223..64c5a01 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 _0x95b9=['tools_intervals','rewrite','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define','Interval'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x95b9,0x10c));var _0x995b=function(_0x5b02d8,_0x27a696){_0x5b02d8=_0x5b02d8-0x0;var _0x316e41=_0x95b9[_0x5b02d8];return _0x316e41;};'use strict';var _=require(_0x995b('0x0'));var util=require(_0x995b('0x1'));var logger=require('../../config/logger')(_0x995b('0x2'));var moment=require('moment');var BPromise=require(_0x995b('0x3'));var rp=require(_0x995b('0x4'));var fs=require('fs');var path=require(_0x995b('0x5'));var rimraf=require(_0x995b('0x6'));var config=require(_0x995b('0x7'));var attributes=require('./interval.attributes');var extensions=require(_0x995b('0x8'));module[_0x995b('0x9')]=function(_0x473daf,_0x288eab){return _0x473daf[_0x995b('0xa')](_0x995b('0xb'),attributes,{'tableName':_0x995b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x409d1d,_0x422895){extensions[_0x995b('0xd')](_0x473daf,_0x409d1d);},'afterBulkCreate':function(_0x6893b0,_0x2a38eb,_0xd5f3df){_0xd5f3df();extensions[_0x995b('0xd')](_0x473daf,_0x6893b0[0x0]);},'afterUpdate':function(_0x51a538,_0x2fc37c){extensions[_0x995b('0xd')](_0x473daf,_0x51a538);},'afterDestroy':function(_0x2617c8,_0xd82621){extensions[_0x995b('0xd')](_0x473daf,_0x2617c8);}}});}; \ No newline at end of file +var _0xd4bd=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./interval.attributes','define','Interval','rewrite'];(function(_0x63488a,_0x5ca591){var _0x2ab9a0=function(_0x19bed6){while(--_0x19bed6){_0x63488a['push'](_0x63488a['shift']());}};_0x2ab9a0(++_0x5ca591);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x35d2ec,_0x30848c){_0x35d2ec=_0x35d2ec-0x0;var _0x1ca87d=_0xd4bd[_0x35d2ec];return _0x1ca87d;};'use strict';var _=require(_0xdd4b('0x0'));var util=require(_0xdd4b('0x1'));var logger=require(_0xdd4b('0x2'))(_0xdd4b('0x3'));var moment=require(_0xdd4b('0x4'));var BPromise=require('bluebird');var rp=require(_0xdd4b('0x5'));var fs=require('fs');var path=require(_0xdd4b('0x6'));var rimraf=require(_0xdd4b('0x7'));var config=require(_0xdd4b('0x8'));var attributes=require(_0xdd4b('0x9'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x1c72c7,_0x543281){return _0x1c72c7[_0xdd4b('0xa')](_0xdd4b('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x521de8,_0x295066){extensions[_0xdd4b('0xc')](_0x1c72c7,_0x521de8);},'afterBulkCreate':function(_0x5d2a80,_0x13918e,_0x14be78){_0x14be78();extensions[_0xdd4b('0xc')](_0x1c72c7,_0x5d2a80[0x0]);},'afterUpdate':function(_0x4803eb,_0x7e077e){extensions[_0xdd4b('0xc')](_0x1c72c7,_0x4803eb);},'afterDestroy':function(_0x3d1526,_0x16c146){extensions[_0xdd4b('0xc')](_0x1c72c7,_0x3d1526);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ac2e77d..86ad420 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 _0xdec4=['Interval,\x20%s,\x20%s,\x20%s','stringify','error','message','Interval,\x20%s,\x20%s','result','GetInterval','Interval','options','where','attributes','limit','include','model','map','catch','ShowInterval','find','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0xdec4,0x19f));var _0x4dec=function(_0xcab4db,_0x1df7c0){_0xcab4db=_0xcab4db-0x0;var _0x19b3b2=_0xdec4[_0xcab4db];return _0x19b3b2;};'use strict';var _=require('lodash');var util=require(_0x4dec('0x0'));var moment=require(_0x4dec('0x1'));var BPromise=require(_0x4dec('0x2'));var rs=require(_0x4dec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4dec('0x4'))['db'];var utils=require(_0x4dec('0x5'));var logger=require(_0x4dec('0x6'))(_0x4dec('0x7'));var config=require(_0x4dec('0x8'));var jayson=require(_0x4dec('0x9'));var client=jayson[_0x4dec('0xa')][_0x4dec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121dac,_0x34f299,_0x43de99){return new BPromise(function(_0x195dd8,_0x1e08de){return client[_0x4dec('0xc')](_0x121dac,_0x43de99)[_0x4dec('0xd')](function(_0x679c11){logger[_0x4dec('0xe')]('Interval,\x20%s,\x20%s',_0x34f299,_0x4dec('0xf'));logger[_0x4dec('0x10')](_0x4dec('0x11'),_0x34f299,_0x4dec('0xf'),JSON[_0x4dec('0x12')](_0x679c11));if(_0x679c11[_0x4dec('0x13')]){if(_0x679c11[_0x4dec('0x13')]['code']===0x1f4){logger[_0x4dec('0x13')]('Interval,\x20%s,\x20%s',_0x34f299,_0x679c11[_0x4dec('0x13')]['message']);return _0x1e08de(_0x679c11[_0x4dec('0x13')][_0x4dec('0x14')]);}logger[_0x4dec('0x13')]('Interval,\x20%s,\x20%s',_0x34f299,_0x679c11[_0x4dec('0x13')]['message']);return _0x195dd8(_0x679c11['error']['message']);}else{logger[_0x4dec('0xe')](_0x4dec('0x15'),_0x34f299,_0x4dec('0xf'));_0x195dd8(_0x679c11[_0x4dec('0x16')][_0x4dec('0x14')]);}})['catch'](function(_0x24c646){logger[_0x4dec('0x13')](_0x4dec('0x15'),_0x34f299,_0x24c646);_0x1e08de(_0x24c646);});});}exports[_0x4dec('0x17')]=function(_0x72c9f9){var _0x3e7d4c=this;return new Promise(function(_0x44a836,_0x531e2f){return db[_0x4dec('0x18')]['findAll']({'raw':_0x72c9f9[_0x4dec('0x19')]?_0x72c9f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x72c9f9[_0x4dec('0x19')]?_0x72c9f9[_0x4dec('0x19')][_0x4dec('0x1a')]||null:null,'attributes':_0x72c9f9[_0x4dec('0x19')]?_0x72c9f9[_0x4dec('0x19')][_0x4dec('0x1b')]||null:null,'limit':_0x72c9f9[_0x4dec('0x19')]?_0x72c9f9['options'][_0x4dec('0x1c')]||null:null,'include':_0x72c9f9[_0x4dec('0x19')]?_0x72c9f9[_0x4dec('0x19')]['include']?_['map'](_0x72c9f9[_0x4dec('0x19')][_0x4dec('0x1d')],function(_0x458ef4){return{'model':db[_0x458ef4[_0x4dec('0x1e')]],'as':_0x458ef4['as'],'attributes':_0x458ef4[_0x4dec('0x1b')],'include':_0x458ef4['include']?_[_0x4dec('0x1f')](_0x458ef4[_0x4dec('0x1d')],function(_0x1fa9c7){return{'model':db[_0x1fa9c7[_0x4dec('0x1e')]],'as':_0x1fa9c7['as'],'attributes':_0x1fa9c7[_0x4dec('0x1b')],'include':_0x1fa9c7[_0x4dec('0x1d')]?_['map'](_0x1fa9c7[_0x4dec('0x1d')],function(_0x45a955){return{'model':db[_0x45a955[_0x4dec('0x1e')]],'as':_0x45a955['as'],'attributes':_0x45a955[_0x4dec('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4dec('0xd')](function(_0x1ffa60){logger['info']('GetInterval',_0x72c9f9);logger[_0x4dec('0x10')](_0x4dec('0x17'),_0x72c9f9,JSON[_0x4dec('0x12')](_0x1ffa60));_0x44a836(_0x1ffa60);})[_0x4dec('0x20')](function(_0x275115){logger[_0x4dec('0x13')](_0x4dec('0x17'),_0x275115[_0x4dec('0x14')],_0x72c9f9);_0x531e2f(_0x3e7d4c[_0x4dec('0x13')](0x1f4,_0x275115['message']));});});};exports[_0x4dec('0x21')]=function(_0x5c8efe){var _0x2ea875=this;return new Promise(function(_0x4c2c87,_0xd47b86){return db[_0x4dec('0x18')][_0x4dec('0x22')]({'raw':_0x5c8efe['options']?_0x5c8efe['options'][_0x4dec('0x23')]===undefined?!![]:![]:!![],'where':_0x5c8efe['options']?_0x5c8efe[_0x4dec('0x19')][_0x4dec('0x1a')]||null:null,'attributes':_0x5c8efe[_0x4dec('0x19')]?_0x5c8efe[_0x4dec('0x19')][_0x4dec('0x1b')]||null:null,'include':_0x5c8efe[_0x4dec('0x19')]?_0x5c8efe[_0x4dec('0x19')][_0x4dec('0x1d')]?_[_0x4dec('0x1f')](_0x5c8efe[_0x4dec('0x19')][_0x4dec('0x1d')],function(_0x3e4b19){return{'model':db[_0x3e4b19['model']],'as':_0x3e4b19['as'],'attributes':_0x3e4b19[_0x4dec('0x1b')],'include':_0x3e4b19[_0x4dec('0x1d')]?_[_0x4dec('0x1f')](_0x3e4b19[_0x4dec('0x1d')],function(_0x453a35){return{'model':db[_0x453a35['model']],'as':_0x453a35['as'],'attributes':_0x453a35[_0x4dec('0x1b')],'include':_0x453a35[_0x4dec('0x1d')]?_[_0x4dec('0x1f')](_0x453a35[_0x4dec('0x1d')],function(_0x4bf6b7){return{'model':db[_0x4bf6b7[_0x4dec('0x1e')]],'as':_0x4bf6b7['as'],'attributes':_0x4bf6b7[_0x4dec('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4dec('0xd')](function(_0x1e2414){logger[_0x4dec('0xe')](_0x4dec('0x21'),_0x5c8efe);logger['debug']('ShowInterval',_0x5c8efe,JSON['stringify'](_0x1e2414));_0x4c2c87(_0x1e2414);})[_0x4dec('0x20')](function(_0x149ac5){logger[_0x4dec('0x13')](_0x4dec('0x21'),_0x149ac5[_0x4dec('0x14')],_0x5c8efe);_0xd47b86(_0x2ea875[_0x4dec('0x13')](0x1f4,_0x149ac5[_0x4dec('0x14')]));});});}; \ No newline at end of file +var _0x7c3e=['GetInterval','Interval','findAll','options','where','limit','include','model','map','attributes','debug','catch','ShowInterval','find','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x1a96ec,_0x56af28){var _0x6dd2db=function(_0xbaeb4d){while(--_0xbaeb4d){_0x1a96ec['push'](_0x1a96ec['shift']());}};_0x6dd2db(++_0x56af28);}(_0x7c3e,0x16d));var _0xe7c3=function(_0x28ef4e,_0x202aa3){_0x28ef4e=_0x28ef4e-0x0;var _0x1aa097=_0x7c3e[_0x28ef4e];return _0x1aa097;};'use strict';var _=require(_0xe7c3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe7c3('0x1'));var rs=require(_0xe7c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7c3('0x3'))['db'];var utils=require(_0xe7c3('0x4'));var logger=require(_0xe7c3('0x5'))(_0xe7c3('0x6'));var config=require(_0xe7c3('0x7'));var jayson=require(_0xe7c3('0x8'));var client=jayson[_0xe7c3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c30f1,_0x3f4d16,_0x3f675e){return new BPromise(function(_0x3b0041,_0x34188d){return client[_0xe7c3('0xa')](_0x3c30f1,_0x3f675e)[_0xe7c3('0xb')](function(_0x560b99){logger[_0xe7c3('0xc')](_0xe7c3('0xd'),_0x3f4d16,_0xe7c3('0xe'));logger['debug'](_0xe7c3('0xf'),_0x3f4d16,_0xe7c3('0xe'),JSON[_0xe7c3('0x10')](_0x560b99));if(_0x560b99['error']){if(_0x560b99['error'][_0xe7c3('0x11')]===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x3f4d16,_0x560b99['error']['message']);return _0x34188d(_0x560b99[_0xe7c3('0x12')][_0xe7c3('0x13')]);}logger[_0xe7c3('0x12')]('Interval,\x20%s,\x20%s',_0x3f4d16,_0x560b99['error']['message']);return _0x3b0041(_0x560b99['error'][_0xe7c3('0x13')]);}else{logger[_0xe7c3('0xc')](_0xe7c3('0xd'),_0x3f4d16,'request\x20sent');_0x3b0041(_0x560b99['result']['message']);}})['catch'](function(_0x40d560){logger[_0xe7c3('0x12')]('Interval,\x20%s,\x20%s',_0x3f4d16,_0x40d560);_0x34188d(_0x40d560);});});}exports[_0xe7c3('0x14')]=function(_0x46f382){var _0x4caff3=this;return new Promise(function(_0x7c226d,_0x3d7bf9){return db[_0xe7c3('0x15')][_0xe7c3('0x16')]({'raw':_0x46f382[_0xe7c3('0x17')]?_0x46f382[_0xe7c3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x46f382[_0xe7c3('0x17')]?_0x46f382['options'][_0xe7c3('0x18')]||null:null,'attributes':_0x46f382[_0xe7c3('0x17')]?_0x46f382[_0xe7c3('0x17')]['attributes']||null:null,'limit':_0x46f382[_0xe7c3('0x17')]?_0x46f382[_0xe7c3('0x17')][_0xe7c3('0x19')]||null:null,'include':_0x46f382[_0xe7c3('0x17')]?_0x46f382[_0xe7c3('0x17')]['include']?_['map'](_0x46f382['options'][_0xe7c3('0x1a')],function(_0x306f29){return{'model':db[_0x306f29[_0xe7c3('0x1b')]],'as':_0x306f29['as'],'attributes':_0x306f29['attributes'],'include':_0x306f29['include']?_[_0xe7c3('0x1c')](_0x306f29[_0xe7c3('0x1a')],function(_0x4e96ee){return{'model':db[_0x4e96ee[_0xe7c3('0x1b')]],'as':_0x4e96ee['as'],'attributes':_0x4e96ee[_0xe7c3('0x1d')],'include':_0x4e96ee['include']?_[_0xe7c3('0x1c')](_0x4e96ee[_0xe7c3('0x1a')],function(_0x53c24a){return{'model':db[_0x53c24a['model']],'as':_0x53c24a['as'],'attributes':_0x53c24a[_0xe7c3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41228f){logger['info'](_0xe7c3('0x14'),_0x46f382);logger[_0xe7c3('0x1e')](_0xe7c3('0x14'),_0x46f382,JSON[_0xe7c3('0x10')](_0x41228f));_0x7c226d(_0x41228f);})[_0xe7c3('0x1f')](function(_0x1e3cca){logger['error'](_0xe7c3('0x14'),_0x1e3cca[_0xe7c3('0x13')],_0x46f382);_0x3d7bf9(_0x4caff3[_0xe7c3('0x12')](0x1f4,_0x1e3cca['message']));});});};exports[_0xe7c3('0x20')]=function(_0x5dab2d){var _0x22ef3e=this;return new Promise(function(_0x5a04db,_0x3fd6d0){return db['Interval'][_0xe7c3('0x21')]({'raw':_0x5dab2d[_0xe7c3('0x17')]?_0x5dab2d['options'][_0xe7c3('0x22')]===undefined?!![]:![]:!![],'where':_0x5dab2d['options']?_0x5dab2d['options']['where']||null:null,'attributes':_0x5dab2d['options']?_0x5dab2d[_0xe7c3('0x17')]['attributes']||null:null,'include':_0x5dab2d[_0xe7c3('0x17')]?_0x5dab2d[_0xe7c3('0x17')][_0xe7c3('0x1a')]?_[_0xe7c3('0x1c')](_0x5dab2d[_0xe7c3('0x17')][_0xe7c3('0x1a')],function(_0x490ab5){return{'model':db[_0x490ab5['model']],'as':_0x490ab5['as'],'attributes':_0x490ab5[_0xe7c3('0x1d')],'include':_0x490ab5[_0xe7c3('0x1a')]?_[_0xe7c3('0x1c')](_0x490ab5[_0xe7c3('0x1a')],function(_0x3be119){return{'model':db[_0x3be119['model']],'as':_0x3be119['as'],'attributes':_0x3be119[_0xe7c3('0x1d')],'include':_0x3be119['include']?_[_0xe7c3('0x1c')](_0x3be119[_0xe7c3('0x1a')],function(_0x4c9b7b){return{'model':db[_0x4c9b7b[_0xe7c3('0x1b')]],'as':_0x4c9b7b['as'],'attributes':_0x4c9b7b[_0xe7c3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe7c3('0xb')](function(_0x461a16){logger['info'](_0xe7c3('0x20'),_0x5dab2d);logger[_0xe7c3('0x1e')](_0xe7c3('0x20'),_0x5dab2d,JSON[_0xe7c3('0x10')](_0x461a16));_0x5a04db(_0x461a16);})['catch'](function(_0x6d4cc3){logger[_0xe7c3('0x12')]('ShowInterval',_0x6d4cc3['message'],_0x5dab2d);_0x3fd6d0(_0x22ef3e[_0xe7c3('0x12')](0x1f4,_0x6d4cc3[_0xe7c3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e621eef..b86888b 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 _0xdd13=['isAuthenticated','send','exports','express','Router','../../components/auth/service','post'];(function(_0x5778d0,_0x160ab4){var _0x4b11a4=function(_0x437e5d){while(--_0x437e5d){_0x5778d0['push'](_0x5778d0['shift']());}};_0x4b11a4(++_0x160ab4);}(_0xdd13,0x81));var _0x3dd1=function(_0x376f47,_0xbde8bf){_0x376f47=_0x376f47-0x0;var _0x85eb88=_0xdd13[_0x376f47];return _0x85eb88;};'use strict';var express=require(_0x3dd1('0x0'));var router=express[_0x3dd1('0x1')]();var auth=require(_0x3dd1('0x2'));var controller=require('./jira.controller');router[_0x3dd1('0x3')]('/',auth[_0x3dd1('0x4')](),controller[_0x3dd1('0x5')]);module[_0x3dd1('0x6')]=router; \ No newline at end of file +var _0x5c24=['Router','./jira.controller','post','isAuthenticated','send','exports'];(function(_0x170af4,_0x67d14){var _0x143678=function(_0x10082a){while(--_0x10082a){_0x170af4['push'](_0x170af4['shift']());}};_0x143678(++_0x67d14);}(_0x5c24,0x186));var _0x45c2=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x5c24[_0x25e7cb];return _0x375d92;};'use strict';var express=require('express');var router=express[_0x45c2('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x45c2('0x1'));router[_0x45c2('0x2')]('/',auth[_0x45c2('0x3')](),controller[_0x45c2('0x4')]);module[_0x45c2('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 6e32983..4729f86 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 _0xce5e=['POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','headers','x-forwarded-for','connection','socket','remoteAddress','body','bluebird','https','api','support','3eAmWpBVP0','key','summary','Report','description','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0xa4b296,_0x490697){var _0x3329bc=function(_0x2bb3c5){while(--_0x2bb3c5){_0xa4b296['push'](_0xa4b296['shift']());}};_0x3329bc(++_0x490697);}(_0xce5e,0x198));var _0xece5=function(_0x5b5420,_0x39ffec){_0x5b5420=_0x5b5420-0x0;var _0x11a025=_0xce5e[_0x5b5420];return _0x11a025;};'use strict';var BPromise=require(_0xece5('0x0'));var https=require(_0xece5('0x1'));var logger=require('../../config/logger')(_0xece5('0x2'));var USERNAME=_0xece5('0x3');var PASSWORD=_0xece5('0x4');function openIssue(_0x42a9ab,_0x422808){var _0x488c59={'fields':{'project':{'key':_0x42a9ab[_0xece5('0x5')]||'MOTGUI'},'summary':(_0x42a9ab[_0xece5('0x6')]||_0xece5('0x7'))+'\x20from\x20'+_0x42a9ab['ip'],'description':_0x42a9ab[_0xece5('0x8')]||JSON['stringify'](_0x42a9ab),'issuetype':{'name':_0x42a9ab[_0xece5('0x9')]||_0xece5('0xa')}}};_0x488c59[_0xece5('0xb')]['customfield_11500']=_0x42a9ab['email'];_0x488c59[_0xece5('0xb')][_0xece5('0xc')]=_0x42a9ab[_0xece5('0xd')];_0x488c59['fields'][_0xece5('0xe')]=_0x42a9ab[_0xece5('0xf')];_0x488c59[_0xece5('0xb')]['customfield_11503']=_0x42a9ab[_0xece5('0x10')];_0x488c59['fields'][_0xece5('0x11')]=_0x42a9ab[_0xece5('0x12')];_0x488c59[_0xece5('0xb')][_0xece5('0x13')]=_0x42a9ab['ip'];var _0xe511a6={'host':_0xece5('0x14'),'port':0x1bb,'path':_0xece5('0x15'),'method':_0xece5('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xece5('0x17'),'Authorization':_0xece5('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xece5('0x19')](_0xece5('0x1a'))}};var _0x18b9c9=JSON['stringify'](_0x488c59);var _0x43a434=https['request'](_0xe511a6,function(_0x28bb9d){_0x28bb9d[_0xece5('0x1b')](_0xece5('0x1c'));var _0x7373f='';_0x28bb9d['on']('data',function(_0x22a2ca){_0x7373f+=_0x22a2ca;});_0x28bb9d['on']('end',function(){if(_0x422808){return _0x422808[_0xece5('0x1d')](_0x28bb9d[_0xece5('0x1e')])[_0xece5('0x1f')](JSON[_0xece5('0x20')](_0x7373f));}});});_0x43a434['on']('error',function(_0x1c2861){if(_0x422808){return _0x422808[_0xece5('0x1d')](0x1f4)[_0xece5('0x1f')]({'errors':[{'message':_0xece5('0x21'),'type':'api.jira'}]});}});_0x43a434[_0xece5('0x22')](_0x18b9c9);_0x43a434[_0xece5('0x23')]();}exports[_0xece5('0x24')]=openIssue;exports['send']=function(_0x594352,_0x2731f8){_0x594352['body']['ip']=_0x594352[_0xece5('0x25')][_0xece5('0x26')]||_0x594352[_0xece5('0x27')]['remoteAddress']||_0x594352[_0xece5('0x28')][_0xece5('0x29')]||_0x594352[_0xece5('0x27')]['socket']['remoteAddress'];return openIssue(_0x594352[_0xece5('0x2a')],_0x2731f8);}; \ No newline at end of file +var _0x3edd=['socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','customfield_11503','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','base64','stringify','utf8','data','status','json','parse','error','api.jira','end','openIssue','send','body','connection','remoteAddress'];(function(_0x4012b0,_0x1a6169){var _0x43ac67=function(_0x4c6094){while(--_0x4c6094){_0x4012b0['push'](_0x4012b0['shift']());}};_0x43ac67(++_0x1a6169);}(_0x3edd,0x187));var _0xd3ed=function(_0x164594,_0x468af9){_0x164594=_0x164594-0x0;var _0x5cd5bd=_0x3edd[_0x164594];return _0x5cd5bd;};'use strict';var BPromise=require(_0xd3ed('0x0'));var https=require('https');var logger=require(_0xd3ed('0x1'))(_0xd3ed('0x2'));var USERNAME=_0xd3ed('0x3');var PASSWORD=_0xd3ed('0x4');function openIssue(_0x13dac8,_0x440c8b){var _0x36f99c={'fields':{'project':{'key':_0x13dac8[_0xd3ed('0x5')]||'MOTGUI'},'summary':(_0x13dac8[_0xd3ed('0x6')]||_0xd3ed('0x7'))+_0xd3ed('0x8')+_0x13dac8['ip'],'description':_0x13dac8[_0xd3ed('0x9')]||JSON['stringify'](_0x13dac8),'issuetype':{'name':_0x13dac8[_0xd3ed('0xa')]||_0xd3ed('0xb')}}};_0x36f99c[_0xd3ed('0xc')][_0xd3ed('0xd')]=_0x13dac8['email'];_0x36f99c[_0xd3ed('0xc')][_0xd3ed('0xe')]=_0x13dac8[_0xd3ed('0xf')];_0x36f99c[_0xd3ed('0xc')][_0xd3ed('0x10')]=_0x13dac8['newToken'];_0x36f99c['fields'][_0xd3ed('0x11')]=_0x13dac8['name'];_0x36f99c['fields'][_0xd3ed('0x12')]=_0x13dac8[_0xd3ed('0x13')];_0x36f99c[_0xd3ed('0xc')]['customfield_10102']=_0x13dac8['ip'];var _0x2988a9={'host':_0xd3ed('0x14'),'port':0x1bb,'path':_0xd3ed('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xd3ed('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xd3ed('0x17'))}};var _0x1661c3=JSON[_0xd3ed('0x18')](_0x36f99c);var _0x198477=https['request'](_0x2988a9,function(_0x53da60){_0x53da60['setEncoding'](_0xd3ed('0x19'));var _0x1003b3='';_0x53da60['on'](_0xd3ed('0x1a'),function(_0x4757d8){_0x1003b3+=_0x4757d8;});_0x53da60['on']('end',function(){if(_0x440c8b){return _0x440c8b[_0xd3ed('0x1b')](_0x53da60['statusCode'])[_0xd3ed('0x1c')](JSON[_0xd3ed('0x1d')](_0x1003b3));}});});_0x198477['on'](_0xd3ed('0x1e'),function(_0x3e9e42){if(_0x440c8b){return _0x440c8b['status'](0x1f4)[_0xd3ed('0x1c')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xd3ed('0x1f')}]});}});_0x198477['write'](_0x1661c3);_0x198477[_0xd3ed('0x20')]();}exports[_0xd3ed('0x21')]=openIssue;exports[_0xd3ed('0x22')]=function(_0x45bc95,_0x447467){_0x45bc95[_0xd3ed('0x23')]['ip']=_0x45bc95['headers']['x-forwarded-for']||_0x45bc95[_0xd3ed('0x24')][_0xd3ed('0x25')]||_0x45bc95[_0xd3ed('0x26')]['remoteAddress']||_0x45bc95[_0xd3ed('0x24')]['socket'][_0xd3ed('0x25')];return openIssue(_0x45bc95['body'],_0x447467);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 55ee22d..509dac0 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 _0xc7cc=['update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','show','put'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xc7cc,0xdb));var _0xcc7c=function(_0x358a8d,_0x2a943f){_0x358a8d=_0x358a8d-0x0;var _0x4cde8b=_0xc7cc[_0x358a8d];return _0x4cde8b;};'use strict';var multer=require(_0xcc7c('0x0'));var util=require('util');var path=require(_0xcc7c('0x1'));var timeout=require(_0xcc7c('0x2'));var express=require(_0xcc7c('0x3'));var router=express[_0xcc7c('0x4')]();var fs_extra=require(_0xcc7c('0x5'));var auth=require(_0xcc7c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcc7c('0x7'));router[_0xcc7c('0x8')]('/',auth[_0xcc7c('0x9')](),controller[_0xcc7c('0xa')]);router[_0xcc7c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xcc7c('0xb')]);router[_0xcc7c('0x8')](_0xcc7c('0xc'),auth['isAuthenticated'](),controller[_0xcc7c('0xd')]);router['post']('/',auth[_0xcc7c('0x9')](),controller['create']);router[_0xcc7c('0xe')](_0xcc7c('0xc'),auth[_0xcc7c('0x9')](),controller[_0xcc7c('0xf')]);router['delete'](_0xcc7c('0xc'),auth[_0xcc7c('0x9')](),controller[_0xcc7c('0x10')]);module[_0xcc7c('0x11')]=router; \ No newline at end of file +var _0xffba=['index','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4618ec,_0x4afff8){var _0x3449c5=function(_0x459e21){while(--_0x459e21){_0x4618ec['push'](_0x4618ec['shift']());}};_0x3449c5(++_0x4afff8);}(_0xffba,0x82));var _0xaffb=function(_0x2d0640,_0x4dea9d){_0x2d0640=_0x2d0640-0x0;var _0x215568=_0xffba[_0x2d0640];return _0x215568;};'use strict';var multer=require('multer');var util=require(_0xaffb('0x0'));var path=require(_0xaffb('0x1'));var timeout=require(_0xaffb('0x2'));var express=require(_0xaffb('0x3'));var router=express[_0xaffb('0x4')]();var fs_extra=require(_0xaffb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaffb('0x6'));var config=require(_0xaffb('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0xaffb('0x8')]('/',auth[_0xaffb('0x9')](),controller[_0xaffb('0xa')]);router[_0xaffb('0x8')](_0xaffb('0xb'),auth[_0xaffb('0x9')](),controller[_0xaffb('0xc')]);router[_0xaffb('0x8')](_0xaffb('0xd'),auth['isAuthenticated'](),controller[_0xaffb('0xe')]);router[_0xaffb('0xf')]('/',auth[_0xaffb('0x9')](),controller['create']);router['put'](_0xaffb('0xd'),auth[_0xaffb('0x9')](),controller[_0xaffb('0x10')]);router[_0xaffb('0x11')](_0xaffb('0xd'),auth[_0xaffb('0x9')](),controller[_0xaffb('0x12')]);module[_0xaffb('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5b4b135..d29b717 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 _0x84a0=['TEXT','STRING','sequelize','exports'];(function(_0x36c6c1,_0x5d84ea){var _0x22990e=function(_0x140cb8){while(--_0x140cb8){_0x36c6c1['push'](_0x36c6c1['shift']());}};_0x22990e(++_0x5d84ea);}(_0x84a0,0x66));var _0x084a=function(_0x27ffdd,_0x33b829){_0x27ffdd=_0x27ffdd-0x0;var _0x3c0eb8=_0x84a0[_0x27ffdd];return _0x3c0eb8;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'question':{'type':Sequelize[_0x084a('0x2')]},'answer':{'type':Sequelize[_0x084a('0x2')]('long')},'membername':{'type':Sequelize[_0x084a('0x3')]},'projectname':{'type':Sequelize[_0x084a('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x084a('0x3')]},'calleridnum':{'type':Sequelize[_0x084a('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9348=['exports','TEXT','long','STRING','sequelize'];(function(_0x5360aa,_0x3bcf7d){var _0x336cc8=function(_0x165100){while(--_0x165100){_0x5360aa['push'](_0x5360aa['shift']());}};_0x336cc8(++_0x3bcf7d);}(_0x9348,0x10d));var _0x8934=function(_0x11de69,_0x46c7c6){_0x11de69=_0x11de69-0x0;var _0x211379=_0x9348[_0x11de69];return _0x211379;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'question':{'type':Sequelize[_0x8934('0x2')]},'answer':{'type':Sequelize[_0x8934('0x2')](_0x8934('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x8934('0x4')]},'queue':{'type':Sequelize[_0x8934('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8934('0x4')]},'calleridnum':{'type':Sequelize[_0x8934('0x4')]},'questionId':{'type':Sequelize[_0x8934('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index c2823ce..5aead94 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 _0x5ff3=['hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','rows','catch','show','params','keys','length','find','create','destroy','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','sendStatus','error','name','render','merge','body','contact','message','agent','interaction','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields'];(function(_0x178fd8,_0x29024b){var _0x4c41eb=function(_0x692e4e){while(--_0x692e4e){_0x178fd8['push'](_0x178fd8['shift']());}};_0x4c41eb(++_0x29024b);}(_0x5ff3,0x17d));var _0x35ff=function(_0x236b3a,_0x4e70c4){_0x236b3a=_0x236b3a-0x0;var _0x15525f=_0x5ff3[_0x236b3a];return _0x15525f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35ff('0x1'));var rp=require('request-promise');var moment=require(_0x35ff('0x2'));var BPromise=require(_0x35ff('0x3'));var Mustache=require(_0x35ff('0x4'));var util=require(_0x35ff('0x5'));var path=require('path');var sox=require(_0x35ff('0x6'));var csv=require(_0x35ff('0x7'));var ejs=require(_0x35ff('0x8'));var fs=require('fs');var fs_extra=require(_0x35ff('0x9'));var _=require(_0x35ff('0xa'));var squel=require('squel');var crypto=require(_0x35ff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x35ff('0xc'));var toCsv=require(_0x35ff('0x7'));var querystring=require(_0x35ff('0xd'));var Papa=require('papaparse');var Redis=require(_0x35ff('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x35ff('0xf'));var as=require(_0x35ff('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x35ff('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x35ff('0x12'))['db'];function respondWithStatusCode(_0x3c5f4b,_0x5bda40){_0x5bda40=_0x5bda40||0xcc;return function(_0x842930){if(_0x842930){return _0x3c5f4b['sendStatus'](_0x5bda40);}return _0x3c5f4b[_0x35ff('0x13')](_0x5bda40)[_0x35ff('0x14')]();};}function respondWithResult(_0x3db454,_0x4d1d41){_0x4d1d41=_0x4d1d41||0xc8;return function(_0xff8ac){if(_0xff8ac){return _0x3db454[_0x35ff('0x13')](_0x4d1d41)[_0x35ff('0x15')](_0xff8ac);}};}function respondWithFilteredResult(_0x3e24dd,_0x438199){return function(_0x3dff65){if(_0x3dff65){var _0x2d4a88=typeof _0x438199[_0x35ff('0x16')]===_0x35ff('0x17')&&typeof _0x438199[_0x35ff('0x18')]===_0x35ff('0x17');var _0x3430e2=_0x3dff65[_0x35ff('0x19')];var _0x16c803=_0x2d4a88?0x0:_0x438199[_0x35ff('0x16')];var _0x5f470e=_0x2d4a88?_0x3dff65[_0x35ff('0x19')]:_0x438199[_0x35ff('0x16')]+_0x438199[_0x35ff('0x18')];var _0x1c0d8c;if(_0x5f470e>=_0x3430e2){_0x5f470e=_0x3430e2;_0x1c0d8c=0xc8;}else{_0x1c0d8c=0xce;}_0x3e24dd['status'](_0x1c0d8c);return _0x3e24dd['set'](_0x35ff('0x1a'),_0x16c803+'-'+_0x5f470e+'/'+_0x3430e2)[_0x35ff('0x15')](_0x3dff65);}return null;};}function patchUpdates(_0x4c8dd4){return function(_0x238f65){try{jsonpatch[_0x35ff('0x1b')](_0x238f65,_0x4c8dd4,!![]);}catch(_0x3a87bc){return BPromise[_0x35ff('0x1c')](_0x3a87bc);}return _0x238f65['save']();};}function saveUpdates(_0x3d60b4,_0x55274b){return function(_0x7cc20a){if(_0x7cc20a){return _0x7cc20a[_0x35ff('0x1d')](_0x3d60b4)[_0x35ff('0x1e')](function(_0x16a5a0){return _0x16a5a0;});}return null;};}function removeEntity(_0x396cc2,_0x2b3782){return function(_0x347cec){if(_0x347cec){return _0x347cec['destroy']()[_0x35ff('0x1e')](function(){_0x396cc2[_0x35ff('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x426e4e,_0x5ad0c6){return function(_0x4c46b7){if(!_0x4c46b7){_0x426e4e[_0x35ff('0x1f')](0x194);}return _0x4c46b7;};}function handleError(_0x9e2789,_0x95b9e2){_0x95b9e2=_0x95b9e2||0x1f4;return function(_0x11a5eb){logger[_0x35ff('0x20')](_0x11a5eb['stack']);if(_0x11a5eb[_0x35ff('0x21')]){delete _0x11a5eb[_0x35ff('0x21')];}_0x9e2789[_0x35ff('0x13')](_0x95b9e2)['send'](_0x11a5eb);};}function getMustacheRender(_0x3357a,_0x1f51c5){return Mustache[_0x35ff('0x22')](_0x3357a,_[_0x35ff('0x23')](_0x1f51c5[_0x35ff('0x24')],{'contact':_0x1f51c5[_0x35ff('0x25')],'message':_0x1f51c5[_0x35ff('0x26')],'agent':_0x1f51c5[_0x35ff('0x27')],'interaction':_0x1f51c5[_0x35ff('0x28')],'account':_0x1f51c5['account']}))||'';}exports[_0x35ff('0x29')]=function(_0x57339d,_0x1cb370){var _0x257501={},_0x2bc118={},_0xad1246={'count':0x0,'rows':[]};var _0x5c8468=_[_0x35ff('0x2a')](db['JscriptyAnswerReport'][_0x35ff('0x2b')],function(_0xf88865){return{'name':_0xf88865['fieldName'],'type':_0xf88865['type'][_0x35ff('0x2c')]};});_0x2bc118[_0x35ff('0x2d')]=_['map'](_0x5c8468,_0x35ff('0x21'));_0x2bc118[_0x35ff('0x2e')]=_['keys'](_0x57339d[_0x35ff('0x2e')]);_0x2bc118[_0x35ff('0x2f')]=_[_0x35ff('0x30')](_0x2bc118[_0x35ff('0x2d')],_0x2bc118[_0x35ff('0x2e')]);_0x257501[_0x35ff('0x31')]=_[_0x35ff('0x30')](_0x2bc118[_0x35ff('0x2d')],qs[_0x35ff('0x32')](_0x57339d[_0x35ff('0x2e')][_0x35ff('0x32')]));_0x257501[_0x35ff('0x31')]=_0x257501[_0x35ff('0x31')]['length']?_0x257501[_0x35ff('0x31')]:_0x2bc118['model'];if(!_0x57339d[_0x35ff('0x2e')][_0x35ff('0x33')](_0x35ff('0x34'))){_0x257501[_0x35ff('0x18')]=qs[_0x35ff('0x18')](_0x57339d['query'][_0x35ff('0x18')]);_0x257501[_0x35ff('0x16')]=qs[_0x35ff('0x16')](_0x57339d[_0x35ff('0x2e')][_0x35ff('0x16')]);}_0x257501['order']=qs[_0x35ff('0x35')](_0x57339d[_0x35ff('0x2e')][_0x35ff('0x35')]);_0x257501['where']=qs['filters'](_[_0x35ff('0x36')](_0x57339d[_0x35ff('0x2e')],_0x2bc118[_0x35ff('0x2f')]),_0x5c8468);if(_0x57339d[_0x35ff('0x2e')][_0x35ff('0x37')]){_0x257501[_0x35ff('0x38')]=_[_0x35ff('0x23')](_0x257501[_0x35ff('0x38')],{'$or':_['map'](_0x5c8468,function(_0x5dcc7c){if(_0x5dcc7c['type']!==_0x35ff('0x39')){var _0x1eb8bd={};_0x1eb8bd[_0x5dcc7c[_0x35ff('0x21')]]={'$like':'%'+_0x57339d[_0x35ff('0x2e')][_0x35ff('0x37')]+'%'};return _0x1eb8bd;}})});}_0x257501=_['merge']({},_0x257501,_0x57339d[_0x35ff('0x3a')]);var _0x2ec957={'where':_0x257501[_0x35ff('0x38')]};return db[_0x35ff('0x3b')][_0x35ff('0x19')](_0x2ec957)[_0x35ff('0x1e')](function(_0x55efda){_0xad1246['count']=_0x55efda;if(_0x57339d[_0x35ff('0x2e')][_0x35ff('0x3c')]){_0x257501[_0x35ff('0x3d')]=[{'all':!![]}];}return db[_0x35ff('0x3b')]['findAll'](_0x257501);})['then'](function(_0x10bfb6){_0xad1246[_0x35ff('0x3e')]=_0x10bfb6;return _0xad1246;})[_0x35ff('0x1e')](respondWithFilteredResult(_0x1cb370,_0x257501))[_0x35ff('0x3f')](handleError(_0x1cb370,null));};exports[_0x35ff('0x40')]=function(_0x2ff794,_0x346758){var _0x51f7cd={'raw':!![],'where':{'id':_0x2ff794[_0x35ff('0x41')]['id']}},_0x52eeb8={};_0x52eeb8[_0x35ff('0x2d')]=_[_0x35ff('0x42')](db['JscriptyAnswerReport'][_0x35ff('0x2b')]);_0x52eeb8[_0x35ff('0x2e')]=_['keys'](_0x2ff794['query']);_0x52eeb8[_0x35ff('0x2f')]=_['intersection'](_0x52eeb8[_0x35ff('0x2d')],_0x52eeb8[_0x35ff('0x2e')]);_0x51f7cd['attributes']=_[_0x35ff('0x30')](_0x52eeb8['model'],qs['fields'](_0x2ff794[_0x35ff('0x2e')][_0x35ff('0x32')]));_0x51f7cd[_0x35ff('0x31')]=_0x51f7cd[_0x35ff('0x31')][_0x35ff('0x43')]?_0x51f7cd[_0x35ff('0x31')]:_0x52eeb8[_0x35ff('0x2d')];if(_0x2ff794[_0x35ff('0x2e')][_0x35ff('0x3c')]){_0x51f7cd[_0x35ff('0x3d')]=[{'all':!![]}];}_0x51f7cd=_[_0x35ff('0x23')]({},_0x51f7cd,_0x2ff794[_0x35ff('0x3a')]);return db['JscriptyAnswerReport'][_0x35ff('0x44')](_0x51f7cd)[_0x35ff('0x1e')](handleEntityNotFound(_0x346758,null))[_0x35ff('0x1e')](respondWithResult(_0x346758,null))[_0x35ff('0x3f')](handleError(_0x346758,null));};exports['create']=function(_0x59c5f7,_0x672938){return db['JscriptyAnswerReport'][_0x35ff('0x45')](_0x59c5f7[_0x35ff('0x24')],{})[_0x35ff('0x1e')](respondWithResult(_0x672938,0xc9))[_0x35ff('0x3f')](handleError(_0x672938,null));};exports[_0x35ff('0x1d')]=function(_0x1fdd5d,_0x2e7bac){if(_0x1fdd5d[_0x35ff('0x24')]['id']){delete _0x1fdd5d[_0x35ff('0x24')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x1fdd5d[_0x35ff('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e7bac,null))[_0x35ff('0x1e')](saveUpdates(_0x1fdd5d[_0x35ff('0x24')],null))[_0x35ff('0x1e')](respondWithResult(_0x2e7bac,null))[_0x35ff('0x3f')](handleError(_0x2e7bac,null));};exports[_0x35ff('0x46')]=function(_0x312913,_0x2db44c){return db[_0x35ff('0x3b')][_0x35ff('0x44')]({'where':{'id':_0x312913['params']['id']}})[_0x35ff('0x1e')](handleEntityNotFound(_0x2db44c,null))[_0x35ff('0x1e')](removeEntity(_0x2db44c,null))[_0x35ff('0x3f')](handleError(_0x2db44c,null));};exports[_0x35ff('0x47')]=function(_0x49e747,_0x540a7f){return db['JscriptyAnswerReport'][_0x35ff('0x47')]()[_0x35ff('0x1e')](respondWithResult(_0x540a7f,null))[_0x35ff('0x3f')](handleError(_0x540a7f,null));}; \ No newline at end of file +var _0x68fc=['create','params','describe','eml-format','rimraf','zip-dir','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','end','error','name','send','render','merge','body','contact','message','agent','interaction','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find'];(function(_0x348882,_0x5f5b30){var _0x3c39fd=function(_0x1781d8){while(--_0x1781d8){_0x348882['push'](_0x348882['shift']());}};_0x3c39fd(++_0x5f5b30);}(_0x68fc,0xa5));var _0xc68f=function(_0x34e3f8,_0x21861f){_0x34e3f8=_0x34e3f8-0x0;var _0x4d85e5=_0x68fc[_0x34e3f8];return _0x4d85e5;};'use strict';var emlformat=require(_0xc68f('0x0'));var rimraf=require(_0xc68f('0x1'));var zipdir=require(_0xc68f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc68f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc68f('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc68f('0x5'));var csv=require(_0xc68f('0x6'));var ejs=require(_0xc68f('0x7'));var fs=require('fs');var fs_extra=require(_0xc68f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc68f('0x9'));var jsforce=require(_0xc68f('0xa'));var deskjs=require(_0xc68f('0xb'));var toCsv=require(_0xc68f('0x6'));var querystring=require(_0xc68f('0xc'));var Papa=require(_0xc68f('0xd'));var Redis=require(_0xc68f('0xe'));var authService=require(_0xc68f('0xf'));var qs=require(_0xc68f('0x10'));var as=require(_0xc68f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc68f('0x12'))(_0xc68f('0x13'));var utils=require(_0xc68f('0x14'));var config=require(_0xc68f('0x15'));var licenseUtil=require(_0xc68f('0x16'));var db=require(_0xc68f('0x17'))['db'];function respondWithStatusCode(_0x3ccebe,_0x41aeb8){_0x41aeb8=_0x41aeb8||0xcc;return function(_0x151bde){if(_0x151bde){return _0x3ccebe[_0xc68f('0x18')](_0x41aeb8);}return _0x3ccebe[_0xc68f('0x19')](_0x41aeb8)['end']();};}function respondWithResult(_0x2ea1c4,_0x90ccbd){_0x90ccbd=_0x90ccbd||0xc8;return function(_0x2b1d30){if(_0x2b1d30){return _0x2ea1c4[_0xc68f('0x19')](_0x90ccbd)[_0xc68f('0x1a')](_0x2b1d30);}};}function respondWithFilteredResult(_0x2673b4,_0x3d1406){return function(_0x209d16){if(_0x209d16){var _0x4648c6=typeof _0x3d1406['offset']==='undefined'&&typeof _0x3d1406[_0xc68f('0x1b')]===_0xc68f('0x1c');var _0x171eea=_0x209d16[_0xc68f('0x1d')];var _0x2d9d85=_0x4648c6?0x0:_0x3d1406[_0xc68f('0x1e')];var _0x50fab4=_0x4648c6?_0x209d16[_0xc68f('0x1d')]:_0x3d1406[_0xc68f('0x1e')]+_0x3d1406[_0xc68f('0x1b')];var _0x2c058c;if(_0x50fab4>=_0x171eea){_0x50fab4=_0x171eea;_0x2c058c=0xc8;}else{_0x2c058c=0xce;}_0x2673b4[_0xc68f('0x19')](_0x2c058c);return _0x2673b4[_0xc68f('0x1f')](_0xc68f('0x20'),_0x2d9d85+'-'+_0x50fab4+'/'+_0x171eea)[_0xc68f('0x1a')](_0x209d16);}return null;};}function patchUpdates(_0x582301){return function(_0xcc11a3){try{jsonpatch[_0xc68f('0x21')](_0xcc11a3,_0x582301,!![]);}catch(_0x2e27b9){return BPromise['reject'](_0x2e27b9);}return _0xcc11a3[_0xc68f('0x22')]();};}function saveUpdates(_0x1daac5,_0x116203){return function(_0x2064db){if(_0x2064db){return _0x2064db[_0xc68f('0x23')](_0x1daac5)[_0xc68f('0x24')](function(_0x2412a9){return _0x2412a9;});}return null;};}function removeEntity(_0x547d46,_0x38c3a0){return function(_0x288957){if(_0x288957){return _0x288957['destroy']()[_0xc68f('0x24')](function(){_0x547d46[_0xc68f('0x19')](0xcc)[_0xc68f('0x25')]();});}};}function handleEntityNotFound(_0x44c4b2,_0x39419a){return function(_0x48d797){if(!_0x48d797){_0x44c4b2[_0xc68f('0x18')](0x194);}return _0x48d797;};}function handleError(_0x417de2,_0x5d4632){_0x5d4632=_0x5d4632||0x1f4;return function(_0x38b935){logger[_0xc68f('0x26')](_0x38b935['stack']);if(_0x38b935[_0xc68f('0x27')]){delete _0x38b935[_0xc68f('0x27')];}_0x417de2[_0xc68f('0x19')](_0x5d4632)[_0xc68f('0x28')](_0x38b935);};}function getMustacheRender(_0x58dd95,_0x477a1c){return Mustache[_0xc68f('0x29')](_0x58dd95,_[_0xc68f('0x2a')](_0x477a1c[_0xc68f('0x2b')],{'contact':_0x477a1c[_0xc68f('0x2c')],'message':_0x477a1c[_0xc68f('0x2d')],'agent':_0x477a1c[_0xc68f('0x2e')],'interaction':_0x477a1c[_0xc68f('0x2f')],'account':_0x477a1c['account']}))||'';}exports[_0xc68f('0x30')]=function(_0x352eb9,_0x4b64da){var _0x323677={},_0x6d2d34={},_0x1cb436={'count':0x0,'rows':[]};var _0x389132=_['map'](db[_0xc68f('0x31')][_0xc68f('0x32')],function(_0x56a82e){return{'name':_0x56a82e[_0xc68f('0x33')],'type':_0x56a82e[_0xc68f('0x34')][_0xc68f('0x35')]};});_0x6d2d34[_0xc68f('0x36')]=_[_0xc68f('0x37')](_0x389132,'name');_0x6d2d34['query']=_[_0xc68f('0x38')](_0x352eb9[_0xc68f('0x39')]);_0x6d2d34[_0xc68f('0x3a')]=_[_0xc68f('0x3b')](_0x6d2d34[_0xc68f('0x36')],_0x6d2d34['query']);_0x323677['attributes']=_[_0xc68f('0x3b')](_0x6d2d34['model'],qs[_0xc68f('0x3c')](_0x352eb9[_0xc68f('0x39')][_0xc68f('0x3c')]));_0x323677[_0xc68f('0x3d')]=_0x323677[_0xc68f('0x3d')][_0xc68f('0x3e')]?_0x323677[_0xc68f('0x3d')]:_0x6d2d34['model'];if(!_0x352eb9[_0xc68f('0x39')][_0xc68f('0x3f')](_0xc68f('0x40'))){_0x323677[_0xc68f('0x1b')]=qs[_0xc68f('0x1b')](_0x352eb9[_0xc68f('0x39')][_0xc68f('0x1b')]);_0x323677[_0xc68f('0x1e')]=qs[_0xc68f('0x1e')](_0x352eb9[_0xc68f('0x39')][_0xc68f('0x1e')]);}_0x323677['order']=qs['sort'](_0x352eb9['query'][_0xc68f('0x41')]);_0x323677[_0xc68f('0x42')]=qs[_0xc68f('0x3a')](_[_0xc68f('0x43')](_0x352eb9['query'],_0x6d2d34[_0xc68f('0x3a')]),_0x389132);if(_0x352eb9[_0xc68f('0x39')][_0xc68f('0x44')]){_0x323677['where']=_[_0xc68f('0x2a')](_0x323677[_0xc68f('0x42')],{'$or':_['map'](_0x389132,function(_0x148af5){if(_0x148af5[_0xc68f('0x34')]!==_0xc68f('0x45')){var _0x58c3d5={};_0x58c3d5[_0x148af5[_0xc68f('0x27')]]={'$like':'%'+_0x352eb9[_0xc68f('0x39')][_0xc68f('0x44')]+'%'};return _0x58c3d5;}})});}_0x323677=_[_0xc68f('0x2a')]({},_0x323677,_0x352eb9[_0xc68f('0x46')]);var _0x3e0b60={'where':_0x323677[_0xc68f('0x42')]};return db['JscriptyAnswerReport'][_0xc68f('0x1d')](_0x3e0b60)[_0xc68f('0x24')](function(_0xe0e0f5){_0x1cb436[_0xc68f('0x1d')]=_0xe0e0f5;if(_0x352eb9[_0xc68f('0x39')][_0xc68f('0x47')]){_0x323677[_0xc68f('0x48')]=[{'all':!![]}];}return db[_0xc68f('0x31')][_0xc68f('0x49')](_0x323677);})['then'](function(_0x1ae3b8){_0x1cb436[_0xc68f('0x4a')]=_0x1ae3b8;return _0x1cb436;})[_0xc68f('0x24')](respondWithFilteredResult(_0x4b64da,_0x323677))[_0xc68f('0x4b')](handleError(_0x4b64da,null));};exports[_0xc68f('0x4c')]=function(_0x3683c0,_0x3e7b43){var _0x58e0f8={'raw':!![],'where':{'id':_0x3683c0['params']['id']}},_0x43d804={};_0x43d804['model']=_[_0xc68f('0x38')](db[_0xc68f('0x31')]['rawAttributes']);_0x43d804['query']=_[_0xc68f('0x38')](_0x3683c0[_0xc68f('0x39')]);_0x43d804[_0xc68f('0x3a')]=_[_0xc68f('0x3b')](_0x43d804[_0xc68f('0x36')],_0x43d804[_0xc68f('0x39')]);_0x58e0f8[_0xc68f('0x3d')]=_[_0xc68f('0x3b')](_0x43d804[_0xc68f('0x36')],qs[_0xc68f('0x3c')](_0x3683c0[_0xc68f('0x39')]['fields']));_0x58e0f8[_0xc68f('0x3d')]=_0x58e0f8['attributes'][_0xc68f('0x3e')]?_0x58e0f8[_0xc68f('0x3d')]:_0x43d804['model'];if(_0x3683c0[_0xc68f('0x39')][_0xc68f('0x47')]){_0x58e0f8[_0xc68f('0x48')]=[{'all':!![]}];}_0x58e0f8=_[_0xc68f('0x2a')]({},_0x58e0f8,_0x3683c0[_0xc68f('0x46')]);return db[_0xc68f('0x31')][_0xc68f('0x4d')](_0x58e0f8)[_0xc68f('0x24')](handleEntityNotFound(_0x3e7b43,null))['then'](respondWithResult(_0x3e7b43,null))[_0xc68f('0x4b')](handleError(_0x3e7b43,null));};exports[_0xc68f('0x4e')]=function(_0x45861f,_0x57d99c){return db['JscriptyAnswerReport']['create'](_0x45861f[_0xc68f('0x2b')],{})[_0xc68f('0x24')](respondWithResult(_0x57d99c,0xc9))['catch'](handleError(_0x57d99c,null));};exports[_0xc68f('0x23')]=function(_0x53b98d,_0x2f0f86){if(_0x53b98d[_0xc68f('0x2b')]['id']){delete _0x53b98d[_0xc68f('0x2b')]['id'];}return db[_0xc68f('0x31')][_0xc68f('0x4d')]({'where':{'id':_0x53b98d[_0xc68f('0x4f')]['id']}})[_0xc68f('0x24')](handleEntityNotFound(_0x2f0f86,null))[_0xc68f('0x24')](saveUpdates(_0x53b98d[_0xc68f('0x2b')],null))[_0xc68f('0x24')](respondWithResult(_0x2f0f86,null))[_0xc68f('0x4b')](handleError(_0x2f0f86,null));};exports['destroy']=function(_0x2e4ebc,_0x27f249){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x2e4ebc[_0xc68f('0x4f')]['id']}})[_0xc68f('0x24')](handleEntityNotFound(_0x27f249,null))[_0xc68f('0x24')](removeEntity(_0x27f249,null))['catch'](handleError(_0x27f249,null));};exports[_0xc68f('0x50')]=function(_0x929873,_0x55f099){return db['JscriptyAnswerReport'][_0xc68f('0x50')]()[_0xc68f('0x24')](respondWithResult(_0x55f099,null))[_0xc68f('0x4b')](handleError(_0x55f099,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0c5571b..32675d5 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 _0xb06e=['JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb06e,0x1d8));var _0xeb06=function(_0x2cc80d,_0x496242){_0x2cc80d=_0x2cc80d-0x0;var _0x115a3c=_0xb06e[_0x2cc80d];return _0x115a3c;};'use strict';var _=require('lodash');var util=require(_0xeb06('0x0'));var logger=require(_0xeb06('0x1'))(_0xeb06('0x2'));var moment=require(_0xeb06('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb06('0x4'));var fs=require('fs');var path=require(_0xeb06('0x5'));var rimraf=require(_0xeb06('0x6'));var config=require(_0xeb06('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x3ba5a6,_0x7708ad){return _0x3ba5a6['define'](_0xeb06('0x8'),attributes,{'tableName':_0xeb06('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaec1=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers'];(function(_0x2dda4d,_0x46d702){var _0x4580f4=function(_0x2c1989){while(--_0x2c1989){_0x2dda4d['push'](_0x2dda4d['shift']());}};_0x4580f4(++_0x46d702);}(_0xaec1,0xc0));var _0x1aec=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xaec1[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1aec('0x0'));var fs=require('fs');var path=require(_0x1aec('0x1'));var rimraf=require(_0x1aec('0x2'));var config=require(_0x1aec('0x3'));var attributes=require(_0x1aec('0x4'));module[_0x1aec('0x5')]=function(_0x5cf6f7,_0x2769b7){return _0x5cf6f7[_0x1aec('0x6')]('JscriptyAnswerReport',attributes,{'tableName':_0x1aec('0x7'),'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 3bec966..49f162e 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 _0x9ced=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x12dbf6,_0x2c381c){var _0x3adcc6=function(_0x24b23d){while(--_0x24b23d){_0x12dbf6['push'](_0x12dbf6['shift']());}};_0x3adcc6(++_0x2c381c);}(_0x9ced,0x1ee));var _0xd9ce=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x9ced[_0x5471ec];return _0x121d4c;};'use strict';var _=require(_0xd9ce('0x0'));var util=require('util');var moment=require(_0xd9ce('0x1'));var BPromise=require(_0xd9ce('0x2'));var rs=require(_0xd9ce('0x3'));var fs=require('fs');var Redis=require(_0xd9ce('0x4'));var db=require(_0xd9ce('0x5'))['db'];var utils=require(_0xd9ce('0x6'));var logger=require(_0xd9ce('0x7'))('rpc');var config=require(_0xd9ce('0x8'));var jayson=require(_0xd9ce('0x9'));var client=jayson[_0xd9ce('0xa')][_0xd9ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cbc30,_0x57d976,_0x1abc86){return new BPromise(function(_0x42b480,_0x3daad6){return client[_0xd9ce('0xc')](_0x2cbc30,_0x1abc86)[_0xd9ce('0xd')](function(_0x1dbb5d){logger[_0xd9ce('0xe')](_0xd9ce('0xf'),_0x57d976,_0xd9ce('0x10'));logger[_0xd9ce('0x11')](_0xd9ce('0x12'),_0x57d976,_0xd9ce('0x10'),JSON[_0xd9ce('0x13')](_0x1dbb5d));if(_0x1dbb5d['error']){if(_0x1dbb5d['error'][_0xd9ce('0x14')]===0x1f4){logger['error'](_0xd9ce('0xf'),_0x57d976,_0x1dbb5d[_0xd9ce('0x15')][_0xd9ce('0x16')]);return _0x3daad6(_0x1dbb5d['error'][_0xd9ce('0x16')]);}logger['error'](_0xd9ce('0xf'),_0x57d976,_0x1dbb5d[_0xd9ce('0x15')]['message']);return _0x42b480(_0x1dbb5d['error'][_0xd9ce('0x16')]);}else{logger[_0xd9ce('0xe')](_0xd9ce('0xf'),_0x57d976,'request\x20sent');_0x42b480(_0x1dbb5d[_0xd9ce('0x17')][_0xd9ce('0x16')]);}})[_0xd9ce('0x18')](function(_0xc2a1f0){logger[_0xd9ce('0x15')](_0xd9ce('0xf'),_0x57d976,_0xc2a1f0);_0x3daad6(_0xc2a1f0);});});} \ No newline at end of file +var _0x5d44=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0x5d44,0xbd));var _0x45d4=function(_0x3551a0,_0x27ec7b){_0x3551a0=_0x3551a0-0x0;var _0x478f15=_0x5d44[_0x3551a0];return _0x478f15;};'use strict';var _=require('lodash');var util=require(_0x45d4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x45d4('0x1'));var fs=require('fs');var Redis=require(_0x45d4('0x2'));var db=require(_0x45d4('0x3'))['db'];var utils=require(_0x45d4('0x4'));var logger=require('../../config/logger')(_0x45d4('0x5'));var config=require(_0x45d4('0x6'));var jayson=require(_0x45d4('0x7'));var client=jayson['client'][_0x45d4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d6257,_0x26ebcd,_0x6749f5){return new BPromise(function(_0x3b7469,_0x334729){return client[_0x45d4('0x9')](_0x3d6257,_0x6749f5)['then'](function(_0x21a6a2){logger['info'](_0x45d4('0xa'),_0x26ebcd,_0x45d4('0xb'));logger[_0x45d4('0xc')](_0x45d4('0xd'),_0x26ebcd,'request\x20sent',JSON[_0x45d4('0xe')](_0x21a6a2));if(_0x21a6a2['error']){if(_0x21a6a2['error']['code']===0x1f4){logger[_0x45d4('0xf')](_0x45d4('0xa'),_0x26ebcd,_0x21a6a2['error'][_0x45d4('0x10')]);return _0x334729(_0x21a6a2[_0x45d4('0xf')]['message']);}logger['error'](_0x45d4('0xa'),_0x26ebcd,_0x21a6a2['error']['message']);return _0x3b7469(_0x21a6a2[_0x45d4('0xf')]['message']);}else{logger[_0x45d4('0x11')](_0x45d4('0xa'),_0x26ebcd,_0x45d4('0xb'));_0x3b7469(_0x21a6a2['result']['message']);}})[_0x45d4('0x12')](function(_0x5cd5c){logger['error'](_0x45d4('0xa'),_0x26ebcd,_0x5cd5c);_0x334729(_0x5cd5c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 19530d6..a4739e0 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 _0x687b=['./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','clone','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x195765,_0x28a3d6){var _0x2f647c=function(_0x17ecbc){while(--_0x17ecbc){_0x195765['push'](_0x195765['shift']());}};_0x2f647c(++_0x28a3d6);}(_0x687b,0x14a));var _0xb687=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x687b[_0x2c0dc0];return _0x4c0990;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id/sessions',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0x9')](_0xb687('0xf'),auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);router[_0xb687('0x9')](_0xb687('0x11'),auth[_0xb687('0xa')](),timeout('30s'),controller[_0xb687('0x12')]);router[_0xb687('0x13')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0x14')]);router['post']('/:id/clone',auth[_0xb687('0xa')](),controller[_0xb687('0x15')]);router['put'](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x16')]);router[_0xb687('0x17')](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x18')]);module[_0xb687('0x19')]=router; \ No newline at end of file +var _0x6b1b=['clone','put','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/summary','getSummary','create','post','/:id/clone'];(function(_0x5c2d6c,_0x35f1f3){var _0x42a61c=function(_0x383227){while(--_0x383227){_0x5c2d6c['push'](_0x5c2d6c['shift']());}};_0x42a61c(++_0x35f1f3);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x6b1b[_0x134c2e];return _0x2825db;};'use strict';var multer=require('multer');var util=require(_0xb6b1('0x0'));var path=require(_0xb6b1('0x1'));var timeout=require(_0xb6b1('0x2'));var express=require('express');var router=express[_0xb6b1('0x3')]();var fs_extra=require(_0xb6b1('0x4'));var auth=require(_0xb6b1('0x5'));var interaction=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var controller=require(_0xb6b1('0x8'));router[_0xb6b1('0x9')]('/',auth[_0xb6b1('0xa')](),controller[_0xb6b1('0xb')]);router[_0xb6b1('0x9')](_0xb6b1('0xc'),auth['isAuthenticated'](),controller[_0xb6b1('0xd')]);router['get']('/:id/sessions',auth[_0xb6b1('0xa')](),controller['getSessions']);router[_0xb6b1('0x9')]('/:id/answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xb6b1('0xe'),auth[_0xb6b1('0xa')](),timeout('30s'),controller[_0xb6b1('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb6b1('0x10')]);router[_0xb6b1('0x11')](_0xb6b1('0x12'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x13')]);router[_0xb6b1('0x14')](_0xb6b1('0xc'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x15')]);router[_0xb6b1('0x16')](_0xb6b1('0xc'),auth[_0xb6b1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 157cbac..29f8b02 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 _0xf119=['stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xf119,0x1c2));var _0x9f11=function(_0x30bcdf,_0x4ebba0){_0x30bcdf=_0x30bcdf-0x0;var _0x24873a=_0xf119[_0x30bcdf];return _0x24873a;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9f11('0x0'));var util=require(_0x9f11('0x1'));module[_0x9f11('0x2')]={'name':{'type':Sequelize[_0x9f11('0x3')],'unique':_0x9f11('0x4')},'description':{'type':Sequelize[_0x9f11('0x3')]},'formData':{'type':Sequelize[_0x9f11('0x5')](_0x9f11('0x6')),'set':function(_0x236958){if(_[_0x9f11('0x7')](_0x236958)){this[_0x9f11('0x8')]('formData',JSON[_0x9f11('0x9')](_0x236958));}else if(_[_0x9f11('0xa')](_0x236958)){this[_0x9f11('0x8')](_0x9f11('0xb'),_0x236958);}else{this[_0x9f11('0x8')](_0x9f11('0xb'),util[_0x9f11('0xc')](_0x9f11('0xd'),this['getDataValue'](_0x9f11('0x4'))||'',this[_0x9f11('0xe')](_0x9f11('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9f11('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9f11('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x14f0=['BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x4721c8,_0x1e8a61){var _0x531488=function(_0x7df030){while(--_0x7df030){_0x4721c8['push'](_0x4721c8['shift']());}};_0x531488(++_0x1e8a61);}(_0x14f0,0x79));var _0x014f=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x14f0[_0x1e4150];return _0x1ce3ee;};'use strict';var Sequelize=require(_0x014f('0x0'));var _=require(_0x014f('0x1'));var util=require('util');module[_0x014f('0x2')]={'name':{'type':Sequelize[_0x014f('0x3')],'unique':_0x014f('0x4')},'description':{'type':Sequelize[_0x014f('0x3')]},'formData':{'type':Sequelize[_0x014f('0x5')](_0x014f('0x6')),'set':function(_0x77386){if(_[_0x014f('0x7')](_0x77386)){this[_0x014f('0x8')](_0x014f('0x9'),JSON['stringify'](_0x77386));}else if(_['isString'](_0x77386)){this[_0x014f('0x8')](_0x014f('0x9'),_0x77386);}else{this[_0x014f('0x8')](_0x014f('0x9'),util[_0x014f('0xa')](_0x014f('0xb'),this[_0x014f('0xc')](_0x014f('0x4'))||'',this[_0x014f('0xc')](_0x014f('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x014f('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x014f('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d723f1a..3db07c1 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 _0x3dbd=['starttime','parse','-createdAt','questionId','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','request-promise','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','get','Projects','UserProfileResource','end','sendStatus','stack','name','send','render','merge','contact','interaction','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','options','include','rows','catch','show','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','update','getSessions','findOne','ProjectId','JscriptySessionReport','JscriptyAnswerReport','findAll','number','fromCharCode','apply','indexOf','toString','getSummary','startTime'];(function(_0x2d00d4,_0x3e7d3d){var _0x45f2b6=function(_0xed8fbf){while(--_0xed8fbf){_0x2d00d4['push'](_0x2d00d4['shift']());}};_0x45f2b6(++_0x3e7d3d);}(_0x3dbd,0x8a));var _0xd3db=function(_0x4711fc,_0x31742c){_0x4711fc=_0x4711fc-0x0;var _0x4c1eaf=_0x3dbd[_0x4711fc];return _0x4c1eaf;};'use strict';var emlformat=require(_0xd3db('0x0'));var rimraf=require(_0xd3db('0x1'));var zipdir=require(_0xd3db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3db('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd3db('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd3db('0x5'));var ejs=require(_0xd3db('0x6'));var fs=require('fs');var fs_extra=require(_0xd3db('0x7'));var _=require(_0xd3db('0x8'));var squel=require(_0xd3db('0x9'));var crypto=require(_0xd3db('0xa'));var jsforce=require(_0xd3db('0xb'));var deskjs=require(_0xd3db('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd3db('0xd'));var Papa=require('papaparse');var Redis=require(_0xd3db('0xe'));var authService=require(_0xd3db('0xf'));var qs=require(_0xd3db('0x10'));var as=require(_0xd3db('0x11'));var hardwareService=require(_0xd3db('0x12'));var logger=require(_0xd3db('0x13'))(_0xd3db('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50fbd8,_0x40122e){_0x40122e=_0x40122e||0xcc;return function(_0x4bf65c){if(_0x4bf65c){return _0x50fbd8['sendStatus'](_0x40122e);}return _0x50fbd8[_0xd3db('0x15')](_0x40122e)['end']();};}function respondWithResult(_0x271d31,_0x281892){_0x281892=_0x281892||0xc8;return function(_0x141fca){if(_0x141fca){return _0x271d31[_0xd3db('0x15')](_0x281892)[_0xd3db('0x16')](_0x141fca);}};}function respondWithFilteredResult(_0x5f1e78,_0x363d36){return function(_0x3b6ac9){if(_0x3b6ac9){var _0x654bb=typeof _0x363d36[_0xd3db('0x17')]===_0xd3db('0x18')&&typeof _0x363d36['limit']===_0xd3db('0x18');var _0x8e49c5=_0x3b6ac9[_0xd3db('0x19')];var _0x2845cf=_0x654bb?0x0:_0x363d36[_0xd3db('0x17')];var _0x5474a8=_0x654bb?_0x3b6ac9[_0xd3db('0x19')]:_0x363d36[_0xd3db('0x17')]+_0x363d36['limit'];var _0x2d23b9;if(_0x5474a8>=_0x8e49c5){_0x5474a8=_0x8e49c5;_0x2d23b9=0xc8;}else{_0x2d23b9=0xce;}_0x5f1e78[_0xd3db('0x15')](_0x2d23b9);return _0x5f1e78[_0xd3db('0x1a')](_0xd3db('0x1b'),_0x2845cf+'-'+_0x5474a8+'/'+_0x8e49c5)['json'](_0x3b6ac9);}return null;};}function patchUpdates(_0x2e328a){return function(_0x39e96c){try{jsonpatch['apply'](_0x39e96c,_0x2e328a,!![]);}catch(_0x44e848){return BPromise[_0xd3db('0x1c')](_0x44e848);}return _0x39e96c[_0xd3db('0x1d')]();};}function saveUpdates(_0x2afaa7,_0x201d3c){return function(_0x3acb3f){if(_0x3acb3f){return _0x3acb3f['update'](_0x2afaa7)[_0xd3db('0x1e')](function(_0x3f44cd){return _0x3f44cd;});}return null;};}function removeEntity(_0x3799a8,_0x4a8a80){return function(_0x4a3a29){if(_0x4a3a29){return _0x4a3a29[_0xd3db('0x1f')]()[_0xd3db('0x1e')](function(){var _0x8b4132=_0x4a3a29[_0xd3db('0x20')]({'plain':!![]});var _0xc72034=_0xd3db('0x21');return db[_0xd3db('0x22')][_0xd3db('0x1f')]({'where':{'type':_0xc72034,'resourceId':_0x8b4132['id']}})['then'](function(){return _0x4a3a29;});})['then'](function(){_0x3799a8[_0xd3db('0x15')](0xcc)[_0xd3db('0x23')]();});}};}function handleEntityNotFound(_0x499fed,_0x39e388){return function(_0x3697b3){if(!_0x3697b3){_0x499fed[_0xd3db('0x24')](0x194);}return _0x3697b3;};}function handleError(_0x5f5880,_0x876e25){_0x876e25=_0x876e25||0x1f4;return function(_0x3e661e){logger['error'](_0x3e661e[_0xd3db('0x25')]);if(_0x3e661e['name']){delete _0x3e661e[_0xd3db('0x26')];}_0x5f5880[_0xd3db('0x15')](_0x876e25)[_0xd3db('0x27')](_0x3e661e);};}function getMustacheRender(_0x3d4489,_0x4edbbe){return Mustache[_0xd3db('0x28')](_0x3d4489,_[_0xd3db('0x29')](_0x4edbbe['body'],{'contact':_0x4edbbe[_0xd3db('0x2a')],'message':_0x4edbbe['message'],'agent':_0x4edbbe['agent'],'interaction':_0x4edbbe[_0xd3db('0x2b')],'account':_0x4edbbe['account']}))||'';}exports[_0xd3db('0x2c')]=function(_0x2b18f5,_0x41087a){var _0x41a142={},_0x5d5ec7={},_0x458ed3={'count':0x0,'rows':[]};var _0x1e90ba=_[_0xd3db('0x2d')](db[_0xd3db('0x2e')][_0xd3db('0x2f')],function(_0x319393){return{'name':_0x319393[_0xd3db('0x30')],'type':_0x319393[_0xd3db('0x31')][_0xd3db('0x32')]};});_0x5d5ec7[_0xd3db('0x33')]=_[_0xd3db('0x2d')](_0x1e90ba,_0xd3db('0x26'));_0x5d5ec7[_0xd3db('0x34')]=_[_0xd3db('0x35')](_0x2b18f5[_0xd3db('0x34')]);_0x5d5ec7[_0xd3db('0x36')]=_[_0xd3db('0x37')](_0x5d5ec7[_0xd3db('0x33')],_0x5d5ec7['query']);_0x41a142[_0xd3db('0x38')]=_[_0xd3db('0x37')](_0x5d5ec7[_0xd3db('0x33')],qs[_0xd3db('0x39')](_0x2b18f5[_0xd3db('0x34')][_0xd3db('0x39')]));_0x41a142['attributes']=_0x41a142[_0xd3db('0x38')]['length']?_0x41a142[_0xd3db('0x38')]:_0x5d5ec7[_0xd3db('0x33')];if(!_0x2b18f5[_0xd3db('0x34')][_0xd3db('0x3a')]('nolimit')){_0x41a142[_0xd3db('0x3b')]=qs[_0xd3db('0x3b')](_0x2b18f5[_0xd3db('0x34')][_0xd3db('0x3b')]);_0x41a142['offset']=qs[_0xd3db('0x17')](_0x2b18f5[_0xd3db('0x34')][_0xd3db('0x17')]);}_0x41a142[_0xd3db('0x3c')]=qs[_0xd3db('0x3d')](_0x2b18f5[_0xd3db('0x34')][_0xd3db('0x3d')]);_0x41a142[_0xd3db('0x3e')]=qs[_0xd3db('0x36')](_[_0xd3db('0x3f')](_0x2b18f5[_0xd3db('0x34')],_0x5d5ec7[_0xd3db('0x36')]),_0x1e90ba);if(_0x2b18f5['query'][_0xd3db('0x40')]){_0x41a142['where']=_[_0xd3db('0x29')](_0x41a142[_0xd3db('0x3e')],{'$or':_[_0xd3db('0x2d')](_0x1e90ba,function(_0x7aff00){if(_0x7aff00[_0xd3db('0x31')]!=='VIRTUAL'){var _0x408cfa={};_0x408cfa[_0x7aff00[_0xd3db('0x26')]]={'$like':'%'+_0x2b18f5['query'][_0xd3db('0x40')]+'%'};return _0x408cfa;}})});}_0x41a142=_[_0xd3db('0x29')]({},_0x41a142,_0x2b18f5[_0xd3db('0x41')]);var _0x1bf0e6={'where':_0x41a142['where']};return db['JscriptyProject']['count'](_0x1bf0e6)[_0xd3db('0x1e')](function(_0xd4b6c0){_0x458ed3[_0xd3db('0x19')]=_0xd4b6c0;if(_0x2b18f5[_0xd3db('0x34')]['includeAll']){_0x41a142[_0xd3db('0x42')]=[{'all':!![]}];}return db[_0xd3db('0x2e')]['findAll'](_0x41a142);})['then'](function(_0x4e1782){_0x458ed3[_0xd3db('0x43')]=_0x4e1782;return _0x458ed3;})[_0xd3db('0x1e')](respondWithFilteredResult(_0x41087a,_0x41a142))[_0xd3db('0x44')](handleError(_0x41087a,null));};exports[_0xd3db('0x45')]=function(_0x1891d1,_0x58ba5c){var _0x4293b7={'raw':![],'where':{'id':_0x1891d1['params']['id']}},_0x334b84={};_0x334b84[_0xd3db('0x33')]=_[_0xd3db('0x35')](db[_0xd3db('0x2e')][_0xd3db('0x2f')]);_0x334b84[_0xd3db('0x34')]=_[_0xd3db('0x35')](_0x1891d1['query']);_0x334b84[_0xd3db('0x36')]=_[_0xd3db('0x37')](_0x334b84[_0xd3db('0x33')],_0x334b84[_0xd3db('0x34')]);_0x4293b7[_0xd3db('0x38')]=_[_0xd3db('0x37')](_0x334b84[_0xd3db('0x33')],qs[_0xd3db('0x39')](_0x1891d1[_0xd3db('0x34')][_0xd3db('0x39')]));_0x4293b7[_0xd3db('0x38')]=_0x4293b7[_0xd3db('0x38')][_0xd3db('0x46')]?_0x4293b7[_0xd3db('0x38')]:_0x334b84[_0xd3db('0x33')];if(_0x1891d1['query'][_0xd3db('0x47')]){_0x4293b7[_0xd3db('0x42')]=[{'all':!![]}];}_0x4293b7=_[_0xd3db('0x29')]({},_0x4293b7,_0x1891d1['options']);return db[_0xd3db('0x2e')][_0xd3db('0x48')](_0x4293b7)[_0xd3db('0x1e')](handleEntityNotFound(_0x58ba5c,null))[_0xd3db('0x1e')](respondWithResult(_0x58ba5c,null))[_0xd3db('0x44')](handleError(_0x58ba5c,null));};exports[_0xd3db('0x49')]=function(_0x334901,_0x1ce106){return db[_0xd3db('0x2e')][_0xd3db('0x49')](_0x334901[_0xd3db('0x4a')],{})[_0xd3db('0x1e')](function(_0x230f7e){var _0x109d55=_0x334901[_0xd3db('0x4b')][_0xd3db('0x20')]({'plain':!![]});if(!_0x109d55)throw new Error(_0xd3db('0x4c'));if(_0x109d55[_0xd3db('0x4d')]===_0xd3db('0x4b')){var _0x5c862e=_0x230f7e[_0xd3db('0x20')]({'plain':!![]});var _0x466630=_0xd3db('0x21');return db[_0xd3db('0x4e')][_0xd3db('0x48')]({'where':{'name':_0x466630,'userProfileId':_0x109d55[_0xd3db('0x4f')]},'raw':!![]})['then'](function(_0x52be95){if(_0x52be95&&_0x52be95[_0xd3db('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5c862e['name'],'resourceId':_0x5c862e['id'],'type':_0x52be95[_0xd3db('0x26')],'sectionId':_0x52be95['id']},{})[_0xd3db('0x1e')](function(){return _0x230f7e;});}else{return _0x230f7e;}})[_0xd3db('0x44')](function(_0x1a31d1){logger[_0xd3db('0x51')](_0xd3db('0x52'),_0x1a31d1);throw _0x1a31d1;});}return _0x230f7e;})[_0xd3db('0x1e')](respondWithResult(_0x1ce106,0xc9))['catch'](handleError(_0x1ce106,null));};exports[_0xd3db('0x53')]=function(_0x135f01,_0x1afd63){var _0x385a74={'where':{'id':_0x135f01[_0xd3db('0x54')]['id']}},_0x15aaf0={};_0x15aaf0[_0xd3db('0x33')]=_[_0xd3db('0x35')](db[_0xd3db('0x2e')][_0xd3db('0x2f')]);_0x385a74['attributes']=_['intersection'](_0x15aaf0[_0xd3db('0x33')],qs['fields'](_0x135f01[_0xd3db('0x34')][_0xd3db('0x39')]));_0x385a74[_0xd3db('0x38')]=_0x385a74[_0xd3db('0x38')][_0xd3db('0x46')]?_0x385a74[_0xd3db('0x38')]:_0x15aaf0[_0xd3db('0x33')];if(_0x135f01[_0xd3db('0x34')]['includeAll']){_0x385a74[_0xd3db('0x42')]=[{'all':!![]}];}_0x385a74=_['merge']({},_0x385a74,_0x135f01[_0xd3db('0x41')]);return db[_0xd3db('0x2e')]['find'](_0x385a74)[_0xd3db('0x1e')](handleEntityNotFound(_0x1afd63,null))['then'](function(_0x2936d5){if(_0x2936d5){var _0x180a61=_0x2936d5['get']({'plain':!![]});_0x180a61=qs[_0xd3db('0x55')](_0x180a61,['id',_0xd3db('0x56'),'updatedAt']);_0x135f01[_0xd3db('0x4a')]=_[_0xd3db('0x55')](_0x135f01[_0xd3db('0x4a')],['id',_0xd3db('0x56'),_0xd3db('0x57')]);return db[_0xd3db('0x2e')]['create'](_['merge'](_0x180a61,_0x135f01[_0xd3db('0x4a')]),{'include':_0x135f01[_0xd3db('0x34')][_0xd3db('0x47')]?[{'all':!![]}]:undefined})[_0xd3db('0x1e')](function(_0x2285bb){var _0x26a85b=_0x135f01[_0xd3db('0x4b')][_0xd3db('0x20')]({'plain':!![]});if(!_0x26a85b)throw new Error(_0xd3db('0x4c'));if(_0x26a85b['role']===_0xd3db('0x4b')){var _0x48c650=_0x2285bb[_0xd3db('0x20')]({'plain':!![]});var _0x5aa5f9=_0xd3db('0x21');return db['UserProfileSection'][_0xd3db('0x48')]({'where':{'name':_0x5aa5f9,'userProfileId':_0x26a85b[_0xd3db('0x4f')]},'raw':!![]})['then'](function(_0x3dfad8){if(_0x3dfad8&&_0x3dfad8[_0xd3db('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x48c650['name'],'resourceId':_0x48c650['id'],'type':_0x3dfad8[_0xd3db('0x26')],'sectionId':_0x3dfad8['id']},{})['then'](function(){return _0x2285bb;});}else{return _0x2285bb;}})[_0xd3db('0x44')](function(_0x30c01c){logger['error'](_0xd3db('0x52'),_0x30c01c);throw _0x30c01c;});}return _0x2285bb;});}})[_0xd3db('0x1e')](respondWithResult(_0x1afd63,0xc9))['catch'](handleError(_0x1afd63,null));};exports[_0xd3db('0x58')]=function(_0xbfabaf,_0x5ed874){if(_0xbfabaf[_0xd3db('0x4a')]['id']){delete _0xbfabaf[_0xd3db('0x4a')]['id'];}return db['JscriptyProject'][_0xd3db('0x48')]({'where':{'id':_0xbfabaf[_0xd3db('0x54')]['id']}})[_0xd3db('0x1e')](handleEntityNotFound(_0x5ed874,null))[_0xd3db('0x1e')](saveUpdates(_0xbfabaf['body'],null))['then'](respondWithResult(_0x5ed874,null))['catch'](handleError(_0x5ed874,null));};exports[_0xd3db('0x1f')]=function(_0x3ebe1d,_0x4d1f95){return db['JscriptyProject']['find']({'where':{'id':_0x3ebe1d['params']['id']}})[_0xd3db('0x1e')](handleEntityNotFound(_0x4d1f95,null))[_0xd3db('0x1e')](removeEntity(_0x4d1f95,null))[_0xd3db('0x44')](handleError(_0x4d1f95,null));};exports[_0xd3db('0x59')]=function(_0x31ce01,_0x47d876,_0x163845){var _0x504eea={'raw':!![],'where':{}};var _0xa75590={};var _0x391c90={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd3db('0x5a')]({'where':{'id':_0x31ce01['params']['id']}})[_0xd3db('0x1e')](handleEntityNotFound(_0x47d876,null))[_0xd3db('0x1e')](function(_0x255705){if(_0x255705){_0xa75590[_0xd3db('0x33')]=_[_0xd3db('0x35')](db['JscriptySessionReport'][_0xd3db('0x2f')]);_0xa75590[_0xd3db('0x34')]=_[_0xd3db('0x35')](_0x31ce01[_0xd3db('0x34')]);_0xa75590[_0xd3db('0x36')]=_[_0xd3db('0x37')](_0xa75590[_0xd3db('0x33')],_0xa75590['query']);_0x504eea[_0xd3db('0x38')]=_[_0xd3db('0x37')](_0xa75590[_0xd3db('0x33')],qs[_0xd3db('0x39')](_0x31ce01[_0xd3db('0x34')][_0xd3db('0x39')]));_0x504eea[_0xd3db('0x38')]=_0x504eea['attributes'][_0xd3db('0x46')]?_0x504eea['attributes']:_0xa75590[_0xd3db('0x33')];if(!_0x31ce01['query'][_0xd3db('0x3a')]('nolimit')){_0x504eea[_0xd3db('0x3b')]=qs[_0xd3db('0x3b')](_0x31ce01[_0xd3db('0x34')][_0xd3db('0x3b')]);_0x504eea['offset']=qs[_0xd3db('0x17')](_0x31ce01[_0xd3db('0x34')][_0xd3db('0x17')]);}_0x504eea[_0xd3db('0x3c')]=qs[_0xd3db('0x3d')](_0x31ce01[_0xd3db('0x34')]['sort']);_0x504eea[_0xd3db('0x3e')]=qs['filters'](_[_0xd3db('0x3f')](_0x31ce01[_0xd3db('0x34')],_0xa75590['filters']));_0x504eea[_0xd3db('0x3e')][_0xd3db('0x5b')]=_0x255705['id'];if(_0x31ce01[_0xd3db('0x34')]['filter']){_0x504eea[_0xd3db('0x3e')]=_[_0xd3db('0x29')](_0x504eea[_0xd3db('0x3e')],{'$or':_['map'](_0x504eea[_0xd3db('0x38')],function(_0x488311){var _0x55ef72={};_0x55ef72[_0x488311]={'$like':'%'+_0x31ce01['query'][_0xd3db('0x40')]+'%'};return _0x55ef72;})});}_0x504eea=_['merge']({},_0x504eea,_0x31ce01[_0xd3db('0x41')]);return db[_0xd3db('0x5c')][_0xd3db('0x19')]({'where':_0x504eea['where']})['then'](function(_0x3fb7a7){_0x391c90[_0xd3db('0x19')]=_0x3fb7a7;if(_0x31ce01[_0xd3db('0x34')]['includeAll']){_0x504eea[_0xd3db('0x42')]=[{'all':!![]}];}return db[_0xd3db('0x5c')]['findAll'](_0x504eea);})[_0xd3db('0x1e')](function(_0x47286f){_0x391c90[_0xd3db('0x43')]=_0x47286f;return _0x391c90;});}})[_0xd3db('0x1e')](respondWithFilteredResult(_0x47d876,_0x504eea))['catch'](handleError(_0x47d876,null));};exports['getAnswers']=function(_0x32a0b9,_0x172be8,_0x2f7c4e){var _0x1b4efb={'raw':!![],'where':{}};var _0x3aa7cc={};var _0x48b6b0={'count':0x0,'rows':[]};return db[_0xd3db('0x2e')][_0xd3db('0x5a')]({'where':{'id':_0x32a0b9[_0xd3db('0x54')]['id']}})[_0xd3db('0x1e')](handleEntityNotFound(_0x172be8,null))[_0xd3db('0x1e')](function(_0xe266fa){if(_0xe266fa){_0x3aa7cc['model']=_[_0xd3db('0x35')](db[_0xd3db('0x5d')][_0xd3db('0x2f')]);_0x3aa7cc['query']=_[_0xd3db('0x35')](_0x32a0b9[_0xd3db('0x34')]);_0x3aa7cc['filters']=_[_0xd3db('0x37')](_0x3aa7cc[_0xd3db('0x33')],_0x3aa7cc[_0xd3db('0x34')]);_0x1b4efb[_0xd3db('0x38')]=_['intersection'](_0x3aa7cc[_0xd3db('0x33')],qs[_0xd3db('0x39')](_0x32a0b9[_0xd3db('0x34')][_0xd3db('0x39')]));_0x1b4efb[_0xd3db('0x38')]=_0x1b4efb[_0xd3db('0x38')][_0xd3db('0x46')]?_0x1b4efb['attributes']:_0x3aa7cc[_0xd3db('0x33')];if(!_0x32a0b9[_0xd3db('0x34')][_0xd3db('0x3a')]('nolimit')){_0x1b4efb[_0xd3db('0x3b')]=qs['limit'](_0x32a0b9[_0xd3db('0x34')][_0xd3db('0x3b')]);_0x1b4efb[_0xd3db('0x17')]=qs[_0xd3db('0x17')](_0x32a0b9['query'][_0xd3db('0x17')]);}_0x1b4efb[_0xd3db('0x3c')]=qs[_0xd3db('0x3d')](_0x32a0b9['query'][_0xd3db('0x3d')]);_0x1b4efb[_0xd3db('0x3e')]=qs[_0xd3db('0x36')](_[_0xd3db('0x3f')](_0x32a0b9[_0xd3db('0x34')],_0x3aa7cc[_0xd3db('0x36')]));_0x1b4efb[_0xd3db('0x3e')][_0xd3db('0x5b')]=_0xe266fa['id'];if(_0x32a0b9[_0xd3db('0x34')][_0xd3db('0x40')]){_0x1b4efb['where']=_['merge'](_0x1b4efb[_0xd3db('0x3e')],{'$or':_[_0xd3db('0x2d')](_0x1b4efb[_0xd3db('0x38')],function(_0x496f1b){var _0x54d5fa={};_0x54d5fa[_0x496f1b]={'$like':'%'+_0x32a0b9['query'][_0xd3db('0x40')]+'%'};return _0x54d5fa;})});}_0x1b4efb=_[_0xd3db('0x29')]({},_0x1b4efb,_0x32a0b9[_0xd3db('0x41')]);return db[_0xd3db('0x5d')][_0xd3db('0x19')]({'where':_0x1b4efb[_0xd3db('0x3e')]})['then'](function(_0x2fb834){_0x48b6b0[_0xd3db('0x19')]=_0x2fb834;if(_0x32a0b9['query'][_0xd3db('0x47')]){_0x1b4efb['include']=[{'all':!![]}];}return db[_0xd3db('0x5d')][_0xd3db('0x5e')](_0x1b4efb);})[_0xd3db('0x1e')](function(_0x5ec19b){_0x48b6b0['rows']=_0x5ec19b;return _0x48b6b0;});}})[_0xd3db('0x1e')](respondWithFilteredResult(_0x172be8,_0x1b4efb))[_0xd3db('0x44')](handleError(_0x172be8,null));};function char(_0x447ab2){return _0xd3db('0x5f')===typeof _0x447ab2?String[_0xd3db('0x60')][_0xd3db('0x61')](null,arguments):_0x447ab2;}function needsEncapsulation(_0x56b68f){return!!_0x56b68f&&(_0x56b68f['toString']()[_0xd3db('0x62')](char(0xd))>=0x0||_0x56b68f[_0xd3db('0x63')]()[_0xd3db('0x62')](char(0xa))>=0x0||_0x56b68f[_0xd3db('0x63')]()[_0xd3db('0x62')](char(0x2c))>=0x0||_0x56b68f[_0xd3db('0x63')]()[_0xd3db('0x62')](char(0x22))>=0x0);}function encapsulate(_0x4c2a9b){var _0x59687a=char(0x22),_0x40b582='\x5c'+char(0x22),_0x4bc87b=_0x4c2a9b[_0xd3db('0x63')]()['replace'](new RegExp(_0x59687a,'g'),_0x40b582);return _0x59687a+_0x4bc87b+_0x59687a;}exports[_0xd3db('0x64')]=function(_0x144db4,_0x1b1b0f,_0x254b09){var _0x12a671,_0x830e10;var _0x1b622e={'where':{'ProjectId':_0x144db4[_0xd3db('0x54')]['id']}};if(_0x144db4['query'][_0xd3db('0x65')]){_0x1b622e[_0xd3db('0x3e')][_0xd3db('0x66')]=JSON[_0xd3db('0x67')](_0x144db4[_0xd3db('0x34')][_0xd3db('0x65')]);}return db[_0xd3db('0x5c')][_0xd3db('0x5e')](_0x1b622e)[_0xd3db('0x1e')](handleEntityNotFound(_0x1b1b0f,null))[_0xd3db('0x1e')](function(_0x542506){if(_0x542506){_0x12a671=_0x542506;return db['JscriptyQuestionReport'][_0xd3db('0x5e')]({'where':{'SessionId':{'$in':_[_0xd3db('0x2d')](_0x12a671,'id')},'ProjectId':_0x144db4[_0xd3db('0x54')]['id']},'order':_0xd3db('0x68')});}})['then'](handleEntityNotFound(_0x1b1b0f,null))[_0xd3db('0x1e')](function(_0x5be3c4){if(_0x5be3c4){_0x830e10=_0x5be3c4;var _0x1fced4={};for(var _0x4fe302=0x0,_0x2ebe9b=_0x830e10[_0xd3db('0x46')];_0x4fe302<_0x2ebe9b;_0x4fe302++){if(!_0x1fced4[_0xd3db('0x3a')](_0x830e10[_0x4fe302]['questionId'])){_0x1fced4[_0x830e10[_0x4fe302][_0xd3db('0x69')]]=needsEncapsulation(_0x830e10[_0x4fe302]['question'])?encapsulate(_0x830e10[_0x4fe302]['question']):_0x830e10[_0x4fe302]['question'];}}var _0x25f3a0=[],_0x49598b={};for(var _0xb22c55=0x0,_0x53eada=_0x12a671[_0xd3db('0x46')];_0xb22c55<_0x53eada;_0xb22c55++){_0x49598b={'ProjectId':_0x144db4['params']['id'],'SessionId':_0x12a671[_0xb22c55]['id'],'StartTime':moment(_0x12a671[_0xb22c55]['starttime'])[_0xd3db('0x6a')](_0xd3db('0x6b'))};for(var _0x4e4f7e=0x0,_0x3709c6=_0x830e10[_0xd3db('0x46')];_0x4e4f7e<_0x3709c6;_0x4e4f7e++){if(_0x830e10[_0x4e4f7e]['SessionId']==_0x12a671[_0xb22c55]['id']&&_0x1fced4[_0xd3db('0x3a')](_0x830e10[_0x4e4f7e][_0xd3db('0x69')])){_0x49598b[_0x1fced4[_0x830e10[_0x4e4f7e][_0xd3db('0x69')]]]=_0x830e10[_0x4e4f7e][_0xd3db('0x6c')];}}for(var _0x1850f7 in _0x1fced4){if(!_0x49598b[_0xd3db('0x3a')](_0x1fced4[_0x1850f7])){_0x49598b[_0x1fced4[_0x1850f7]]=null;}}_0x25f3a0[_0xd3db('0x6d')](_0x49598b);}return _0x25f3a0;}})[_0xd3db('0x1e')](function(_0x15e645){if(!_[_0xd3db('0x6e')](_0x15e645)){var _0xe97622=toCsv(_0x15e645);var _0x28d3d9=Date[_0xd3db('0x6f')]();fs[_0xd3db('0x70')](util[_0xd3db('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x144db4[_0xd3db('0x54')]['id'],_0x28d3d9),_0xe97622);_0x1b1b0f[_0xd3db('0x71')](_0xd3db('0x72'),_0xd3db('0x73')+util[_0xd3db('0x6a')](_0xd3db('0x74'),_0x144db4[_0xd3db('0x54')]['id'],_0x28d3d9));_0x1b1b0f[_0xd3db('0x71')](_0xd3db('0x75'),'text/csv');return _0x1b1b0f[_0xd3db('0x76')](util['format'](_0xd3db('0x77'),_0x144db4[_0xd3db('0x54')]['id'],_0x28d3d9));}else{return _0x1b1b0f['sendStatus'](0xcc);}})[_0xd3db('0x44')](handleError(_0x1b1b0f,null));}; \ No newline at end of file +var _0x5fcf=['fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','body','message','interaction','account','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','JscriptyProject','includeAll','include','findAll','catch','show','params','find','create','user','role','Projects','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','omit','updatedAt','getSessions','JscriptySessionReport','rawAttributes','ProjectId','rows','getAnswers','findOne','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs'];(function(_0x178a9c,_0x562a28){var _0x3fd933=function(_0x37a0e2){while(--_0x37a0e2){_0x178a9c['push'](_0x178a9c['shift']());}};_0x3fd933(++_0x562a28);}(_0x5fcf,0x163));var _0xf5fc=function(_0x5ab6fd,_0x3e6659){_0x5ab6fd=_0x5ab6fd-0x0;var _0x591311=_0x5fcf[_0x5ab6fd];return _0x591311;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf5fc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf5fc('0x1'));var moment=require(_0xf5fc('0x2'));var BPromise=require(_0xf5fc('0x3'));var Mustache=require(_0xf5fc('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf5fc('0x5'));var csv=require(_0xf5fc('0x6'));var ejs=require(_0xf5fc('0x7'));var fs=require('fs');var fs_extra=require(_0xf5fc('0x8'));var _=require('lodash');var squel=require(_0xf5fc('0x9'));var crypto=require(_0xf5fc('0xa'));var jsforce=require(_0xf5fc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf5fc('0x6'));var querystring=require(_0xf5fc('0xc'));var Papa=require(_0xf5fc('0xd'));var Redis=require(_0xf5fc('0xe'));var authService=require(_0xf5fc('0xf'));var qs=require(_0xf5fc('0x10'));var as=require(_0xf5fc('0x11'));var hardwareService=require(_0xf5fc('0x12'));var logger=require(_0xf5fc('0x13'))(_0xf5fc('0x14'));var utils=require(_0xf5fc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5fc('0x16'));var db=require(_0xf5fc('0x17'))['db'];function respondWithStatusCode(_0x17fb3d,_0x4eae69){_0x4eae69=_0x4eae69||0xcc;return function(_0x225610){if(_0x225610){return _0x17fb3d['sendStatus'](_0x4eae69);}return _0x17fb3d['status'](_0x4eae69)[_0xf5fc('0x18')]();};}function respondWithResult(_0x37bd17,_0x475111){_0x475111=_0x475111||0xc8;return function(_0x7ab91){if(_0x7ab91){return _0x37bd17[_0xf5fc('0x19')](_0x475111)[_0xf5fc('0x1a')](_0x7ab91);}};}function respondWithFilteredResult(_0x26d0a8,_0x38f12d){return function(_0x5f5229){if(_0x5f5229){var _0x49a11e=typeof _0x38f12d[_0xf5fc('0x1b')]==='undefined'&&typeof _0x38f12d[_0xf5fc('0x1c')]===_0xf5fc('0x1d');var _0x8e5ff=_0x5f5229['count'];var _0x46e3b2=_0x49a11e?0x0:_0x38f12d[_0xf5fc('0x1b')];var _0x272503=_0x49a11e?_0x5f5229[_0xf5fc('0x1e')]:_0x38f12d[_0xf5fc('0x1b')]+_0x38f12d['limit'];var _0x4e1d0e;if(_0x272503>=_0x8e5ff){_0x272503=_0x8e5ff;_0x4e1d0e=0xc8;}else{_0x4e1d0e=0xce;}_0x26d0a8[_0xf5fc('0x19')](_0x4e1d0e);return _0x26d0a8[_0xf5fc('0x1f')](_0xf5fc('0x20'),_0x46e3b2+'-'+_0x272503+'/'+_0x8e5ff)[_0xf5fc('0x1a')](_0x5f5229);}return null;};}function patchUpdates(_0x2ae803){return function(_0x50ed94){try{jsonpatch[_0xf5fc('0x21')](_0x50ed94,_0x2ae803,!![]);}catch(_0xe03953){return BPromise[_0xf5fc('0x22')](_0xe03953);}return _0x50ed94[_0xf5fc('0x23')]();};}function saveUpdates(_0x25c91d,_0x513dae){return function(_0x2a396e){if(_0x2a396e){return _0x2a396e['update'](_0x25c91d)['then'](function(_0x84dc74){return _0x84dc74;});}return null;};}function removeEntity(_0x5e565e,_0x440e01){return function(_0x576da8){if(_0x576da8){return _0x576da8[_0xf5fc('0x24')]()[_0xf5fc('0x25')](function(){var _0x5e0cde=_0x576da8[_0xf5fc('0x26')]({'plain':!![]});var _0x1b6b1b='Projects';return db[_0xf5fc('0x27')]['destroy']({'where':{'type':_0x1b6b1b,'resourceId':_0x5e0cde['id']}})[_0xf5fc('0x25')](function(){return _0x576da8;});})['then'](function(){_0x5e565e[_0xf5fc('0x19')](0xcc)[_0xf5fc('0x18')]();});}};}function handleEntityNotFound(_0x160edd,_0x18fe30){return function(_0x564d4d){if(!_0x564d4d){_0x160edd[_0xf5fc('0x28')](0x194);}return _0x564d4d;};}function handleError(_0x3889da,_0x542212){_0x542212=_0x542212||0x1f4;return function(_0x5d7603){logger[_0xf5fc('0x29')](_0x5d7603[_0xf5fc('0x2a')]);if(_0x5d7603['name']){delete _0x5d7603[_0xf5fc('0x2b')];}_0x3889da[_0xf5fc('0x19')](_0x542212)['send'](_0x5d7603);};}function getMustacheRender(_0x50b42e,_0x27aed4){return Mustache['render'](_0x50b42e,_['merge'](_0x27aed4[_0xf5fc('0x2c')],{'contact':_0x27aed4['contact'],'message':_0x27aed4[_0xf5fc('0x2d')],'agent':_0x27aed4['agent'],'interaction':_0x27aed4[_0xf5fc('0x2e')],'account':_0x27aed4[_0xf5fc('0x2f')]}))||'';}exports[_0xf5fc('0x30')]=function(_0x2f3dde,_0x26023a){var _0x342c87={},_0x302c9f={},_0x594dc8={'count':0x0,'rows':[]};var _0x1460be=_[_0xf5fc('0x31')](db['JscriptyProject']['rawAttributes'],function(_0x1ea278){return{'name':_0x1ea278[_0xf5fc('0x32')],'type':_0x1ea278[_0xf5fc('0x33')]['key']};});_0x302c9f[_0xf5fc('0x34')]=_[_0xf5fc('0x31')](_0x1460be,_0xf5fc('0x2b'));_0x302c9f[_0xf5fc('0x35')]=_[_0xf5fc('0x36')](_0x2f3dde[_0xf5fc('0x35')]);_0x302c9f[_0xf5fc('0x37')]=_[_0xf5fc('0x38')](_0x302c9f[_0xf5fc('0x34')],_0x302c9f[_0xf5fc('0x35')]);_0x342c87[_0xf5fc('0x39')]=_[_0xf5fc('0x38')](_0x302c9f['model'],qs[_0xf5fc('0x3a')](_0x2f3dde[_0xf5fc('0x35')]['fields']));_0x342c87[_0xf5fc('0x39')]=_0x342c87['attributes'][_0xf5fc('0x3b')]?_0x342c87['attributes']:_0x302c9f[_0xf5fc('0x34')];if(!_0x2f3dde['query'][_0xf5fc('0x3c')](_0xf5fc('0x3d'))){_0x342c87[_0xf5fc('0x1c')]=qs[_0xf5fc('0x1c')](_0x2f3dde[_0xf5fc('0x35')]['limit']);_0x342c87[_0xf5fc('0x1b')]=qs[_0xf5fc('0x1b')](_0x2f3dde[_0xf5fc('0x35')]['offset']);}_0x342c87[_0xf5fc('0x3e')]=qs[_0xf5fc('0x3f')](_0x2f3dde['query'][_0xf5fc('0x3f')]);_0x342c87[_0xf5fc('0x40')]=qs['filters'](_[_0xf5fc('0x41')](_0x2f3dde['query'],_0x302c9f['filters']),_0x1460be);if(_0x2f3dde[_0xf5fc('0x35')][_0xf5fc('0x42')]){_0x342c87[_0xf5fc('0x40')]=_[_0xf5fc('0x43')](_0x342c87['where'],{'$or':_[_0xf5fc('0x31')](_0x1460be,function(_0xac0e7b){if(_0xac0e7b['type']!=='VIRTUAL'){var _0x57a61c={};_0x57a61c[_0xac0e7b[_0xf5fc('0x2b')]]={'$like':'%'+_0x2f3dde[_0xf5fc('0x35')][_0xf5fc('0x42')]+'%'};return _0x57a61c;}})});}_0x342c87=_['merge']({},_0x342c87,_0x2f3dde[_0xf5fc('0x44')]);var _0x537b37={'where':_0x342c87[_0xf5fc('0x40')]};return db[_0xf5fc('0x45')]['count'](_0x537b37)['then'](function(_0x332a84){_0x594dc8[_0xf5fc('0x1e')]=_0x332a84;if(_0x2f3dde[_0xf5fc('0x35')][_0xf5fc('0x46')]){_0x342c87[_0xf5fc('0x47')]=[{'all':!![]}];}return db[_0xf5fc('0x45')][_0xf5fc('0x48')](_0x342c87);})[_0xf5fc('0x25')](function(_0x3f823a){_0x594dc8['rows']=_0x3f823a;return _0x594dc8;})['then'](respondWithFilteredResult(_0x26023a,_0x342c87))[_0xf5fc('0x49')](handleError(_0x26023a,null));};exports[_0xf5fc('0x4a')]=function(_0x2c488b,_0x3bd864){var _0x23c953={'raw':![],'where':{'id':_0x2c488b[_0xf5fc('0x4b')]['id']}},_0x3feebf={};_0x3feebf[_0xf5fc('0x34')]=_[_0xf5fc('0x36')](db[_0xf5fc('0x45')]['rawAttributes']);_0x3feebf[_0xf5fc('0x35')]=_[_0xf5fc('0x36')](_0x2c488b[_0xf5fc('0x35')]);_0x3feebf[_0xf5fc('0x37')]=_[_0xf5fc('0x38')](_0x3feebf['model'],_0x3feebf[_0xf5fc('0x35')]);_0x23c953[_0xf5fc('0x39')]=_[_0xf5fc('0x38')](_0x3feebf[_0xf5fc('0x34')],qs[_0xf5fc('0x3a')](_0x2c488b[_0xf5fc('0x35')][_0xf5fc('0x3a')]));_0x23c953['attributes']=_0x23c953['attributes'][_0xf5fc('0x3b')]?_0x23c953[_0xf5fc('0x39')]:_0x3feebf[_0xf5fc('0x34')];if(_0x2c488b[_0xf5fc('0x35')][_0xf5fc('0x46')]){_0x23c953[_0xf5fc('0x47')]=[{'all':!![]}];}_0x23c953=_[_0xf5fc('0x43')]({},_0x23c953,_0x2c488b['options']);return db[_0xf5fc('0x45')][_0xf5fc('0x4c')](_0x23c953)['then'](handleEntityNotFound(_0x3bd864,null))['then'](respondWithResult(_0x3bd864,null))[_0xf5fc('0x49')](handleError(_0x3bd864,null));};exports[_0xf5fc('0x4d')]=function(_0xb62e93,_0x40c42f){return db['JscriptyProject']['create'](_0xb62e93['body'],{})[_0xf5fc('0x25')](function(_0x5bddc0){var _0x428ea8=_0xb62e93[_0xf5fc('0x4e')]['get']({'plain':!![]});if(!_0x428ea8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x428ea8[_0xf5fc('0x4f')]===_0xf5fc('0x4e')){var _0x3d70c7=_0x5bddc0[_0xf5fc('0x26')]({'plain':!![]});var _0x157e11=_0xf5fc('0x50');return db[_0xf5fc('0x51')][_0xf5fc('0x4c')]({'where':{'name':_0x157e11,'userProfileId':_0x428ea8[_0xf5fc('0x52')]},'raw':!![]})[_0xf5fc('0x25')](function(_0x2d5f8a){if(_0x2d5f8a&&_0x2d5f8a[_0xf5fc('0x53')]===0x0){return db[_0xf5fc('0x27')][_0xf5fc('0x4d')]({'name':_0x3d70c7['name'],'resourceId':_0x3d70c7['id'],'type':_0x2d5f8a['name'],'sectionId':_0x2d5f8a['id']},{})[_0xf5fc('0x25')](function(){return _0x5bddc0;});}else{return _0x5bddc0;}})[_0xf5fc('0x49')](function(_0x58b0ee){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58b0ee);throw _0x58b0ee;});}return _0x5bddc0;})['then'](respondWithResult(_0x40c42f,0xc9))['catch'](handleError(_0x40c42f,null));};exports[_0xf5fc('0x54')]=function(_0x490a95,_0x1eec06){var _0x2f583b={'where':{'id':_0x490a95['params']['id']}},_0x3607e8={};_0x3607e8[_0xf5fc('0x34')]=_[_0xf5fc('0x36')](db[_0xf5fc('0x45')]['rawAttributes']);_0x2f583b[_0xf5fc('0x39')]=_[_0xf5fc('0x38')](_0x3607e8[_0xf5fc('0x34')],qs[_0xf5fc('0x3a')](_0x490a95[_0xf5fc('0x35')][_0xf5fc('0x3a')]));_0x2f583b[_0xf5fc('0x39')]=_0x2f583b[_0xf5fc('0x39')]['length']?_0x2f583b[_0xf5fc('0x39')]:_0x3607e8[_0xf5fc('0x34')];if(_0x490a95[_0xf5fc('0x35')]['includeAll']){_0x2f583b[_0xf5fc('0x47')]=[{'all':!![]}];}_0x2f583b=_[_0xf5fc('0x43')]({},_0x2f583b,_0x490a95['options']);return db[_0xf5fc('0x45')][_0xf5fc('0x4c')](_0x2f583b)[_0xf5fc('0x25')](handleEntityNotFound(_0x1eec06,null))['then'](function(_0xb1aee5){if(_0xb1aee5){var _0x22626c=_0xb1aee5[_0xf5fc('0x26')]({'plain':!![]});_0x22626c=qs['omit'](_0x22626c,['id',_0xf5fc('0x55'),'updatedAt']);_0x490a95['body']=_[_0xf5fc('0x56')](_0x490a95[_0xf5fc('0x2c')],['id',_0xf5fc('0x55'),_0xf5fc('0x57')]);return db[_0xf5fc('0x45')][_0xf5fc('0x4d')](_[_0xf5fc('0x43')](_0x22626c,_0x490a95['body']),{'include':_0x490a95['query'][_0xf5fc('0x46')]?[{'all':!![]}]:undefined})[_0xf5fc('0x25')](function(_0x1dd821){var _0x50ddcc=_0x490a95[_0xf5fc('0x4e')][_0xf5fc('0x26')]({'plain':!![]});if(!_0x50ddcc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50ddcc[_0xf5fc('0x4f')]==='user'){var _0x4d2080=_0x1dd821['get']({'plain':!![]});var _0xe7b3a9='Projects';return db[_0xf5fc('0x51')][_0xf5fc('0x4c')]({'where':{'name':_0xe7b3a9,'userProfileId':_0x50ddcc['userProfileId']},'raw':!![]})['then'](function(_0x39b80e){if(_0x39b80e&&_0x39b80e[_0xf5fc('0x53')]===0x0){return db[_0xf5fc('0x27')][_0xf5fc('0x4d')]({'name':_0x4d2080[_0xf5fc('0x2b')],'resourceId':_0x4d2080['id'],'type':_0x39b80e[_0xf5fc('0x2b')],'sectionId':_0x39b80e['id']},{})['then'](function(){return _0x1dd821;});}else{return _0x1dd821;}})[_0xf5fc('0x49')](function(_0xfae034){logger[_0xf5fc('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfae034);throw _0xfae034;});}return _0x1dd821;});}})[_0xf5fc('0x25')](respondWithResult(_0x1eec06,0xc9))[_0xf5fc('0x49')](handleError(_0x1eec06,null));};exports['update']=function(_0x4886c2,_0x2dde05){if(_0x4886c2[_0xf5fc('0x2c')]['id']){delete _0x4886c2[_0xf5fc('0x2c')]['id'];}return db[_0xf5fc('0x45')][_0xf5fc('0x4c')]({'where':{'id':_0x4886c2[_0xf5fc('0x4b')]['id']}})[_0xf5fc('0x25')](handleEntityNotFound(_0x2dde05,null))[_0xf5fc('0x25')](saveUpdates(_0x4886c2[_0xf5fc('0x2c')],null))[_0xf5fc('0x25')](respondWithResult(_0x2dde05,null))['catch'](handleError(_0x2dde05,null));};exports[_0xf5fc('0x24')]=function(_0x57c0c6,_0xc14678){return db[_0xf5fc('0x45')][_0xf5fc('0x4c')]({'where':{'id':_0x57c0c6[_0xf5fc('0x4b')]['id']}})['then'](handleEntityNotFound(_0xc14678,null))[_0xf5fc('0x25')](removeEntity(_0xc14678,null))['catch'](handleError(_0xc14678,null));};exports[_0xf5fc('0x58')]=function(_0x35b101,_0x5200df,_0x32d2b0){var _0x408544={'raw':!![],'where':{}};var _0x4f6740={};var _0x596b59={'count':0x0,'rows':[]};return db[_0xf5fc('0x45')]['findOne']({'where':{'id':_0x35b101['params']['id']}})['then'](handleEntityNotFound(_0x5200df,null))['then'](function(_0x11abe0){if(_0x11abe0){_0x4f6740['model']=_['keys'](db[_0xf5fc('0x59')][_0xf5fc('0x5a')]);_0x4f6740[_0xf5fc('0x35')]=_[_0xf5fc('0x36')](_0x35b101[_0xf5fc('0x35')]);_0x4f6740[_0xf5fc('0x37')]=_[_0xf5fc('0x38')](_0x4f6740[_0xf5fc('0x34')],_0x4f6740[_0xf5fc('0x35')]);_0x408544[_0xf5fc('0x39')]=_['intersection'](_0x4f6740[_0xf5fc('0x34')],qs[_0xf5fc('0x3a')](_0x35b101[_0xf5fc('0x35')][_0xf5fc('0x3a')]));_0x408544[_0xf5fc('0x39')]=_0x408544[_0xf5fc('0x39')][_0xf5fc('0x3b')]?_0x408544['attributes']:_0x4f6740[_0xf5fc('0x34')];if(!_0x35b101[_0xf5fc('0x35')][_0xf5fc('0x3c')](_0xf5fc('0x3d'))){_0x408544[_0xf5fc('0x1c')]=qs['limit'](_0x35b101[_0xf5fc('0x35')][_0xf5fc('0x1c')]);_0x408544[_0xf5fc('0x1b')]=qs['offset'](_0x35b101[_0xf5fc('0x35')]['offset']);}_0x408544['order']=qs['sort'](_0x35b101[_0xf5fc('0x35')][_0xf5fc('0x3f')]);_0x408544[_0xf5fc('0x40')]=qs['filters'](_['pick'](_0x35b101['query'],_0x4f6740['filters']));_0x408544[_0xf5fc('0x40')][_0xf5fc('0x5b')]=_0x11abe0['id'];if(_0x35b101[_0xf5fc('0x35')]['filter']){_0x408544[_0xf5fc('0x40')]=_[_0xf5fc('0x43')](_0x408544[_0xf5fc('0x40')],{'$or':_['map'](_0x408544[_0xf5fc('0x39')],function(_0x49046b){var _0x566d6d={};_0x566d6d[_0x49046b]={'$like':'%'+_0x35b101[_0xf5fc('0x35')][_0xf5fc('0x42')]+'%'};return _0x566d6d;})});}_0x408544=_[_0xf5fc('0x43')]({},_0x408544,_0x35b101[_0xf5fc('0x44')]);return db[_0xf5fc('0x59')][_0xf5fc('0x1e')]({'where':_0x408544[_0xf5fc('0x40')]})[_0xf5fc('0x25')](function(_0xcdebf8){_0x596b59[_0xf5fc('0x1e')]=_0xcdebf8;if(_0x35b101[_0xf5fc('0x35')][_0xf5fc('0x46')]){_0x408544[_0xf5fc('0x47')]=[{'all':!![]}];}return db[_0xf5fc('0x59')][_0xf5fc('0x48')](_0x408544);})[_0xf5fc('0x25')](function(_0x147ada){_0x596b59[_0xf5fc('0x5c')]=_0x147ada;return _0x596b59;});}})[_0xf5fc('0x25')](respondWithFilteredResult(_0x5200df,_0x408544))['catch'](handleError(_0x5200df,null));};exports[_0xf5fc('0x5d')]=function(_0x1f6d0e,_0x2e8976,_0xf85fd1){var _0x2e8d2d={'raw':!![],'where':{}};var _0x1d7f79={};var _0x415de5={'count':0x0,'rows':[]};return db[_0xf5fc('0x45')][_0xf5fc('0x5e')]({'where':{'id':_0x1f6d0e[_0xf5fc('0x4b')]['id']}})[_0xf5fc('0x25')](handleEntityNotFound(_0x2e8976,null))[_0xf5fc('0x25')](function(_0x57883e){if(_0x57883e){_0x1d7f79[_0xf5fc('0x34')]=_[_0xf5fc('0x36')](db[_0xf5fc('0x5f')][_0xf5fc('0x5a')]);_0x1d7f79[_0xf5fc('0x35')]=_[_0xf5fc('0x36')](_0x1f6d0e['query']);_0x1d7f79[_0xf5fc('0x37')]=_['intersection'](_0x1d7f79['model'],_0x1d7f79['query']);_0x2e8d2d['attributes']=_['intersection'](_0x1d7f79[_0xf5fc('0x34')],qs[_0xf5fc('0x3a')](_0x1f6d0e[_0xf5fc('0x35')][_0xf5fc('0x3a')]));_0x2e8d2d[_0xf5fc('0x39')]=_0x2e8d2d[_0xf5fc('0x39')][_0xf5fc('0x3b')]?_0x2e8d2d[_0xf5fc('0x39')]:_0x1d7f79[_0xf5fc('0x34')];if(!_0x1f6d0e[_0xf5fc('0x35')][_0xf5fc('0x3c')]('nolimit')){_0x2e8d2d[_0xf5fc('0x1c')]=qs[_0xf5fc('0x1c')](_0x1f6d0e[_0xf5fc('0x35')]['limit']);_0x2e8d2d[_0xf5fc('0x1b')]=qs[_0xf5fc('0x1b')](_0x1f6d0e[_0xf5fc('0x35')]['offset']);}_0x2e8d2d[_0xf5fc('0x3e')]=qs[_0xf5fc('0x3f')](_0x1f6d0e['query'][_0xf5fc('0x3f')]);_0x2e8d2d[_0xf5fc('0x40')]=qs[_0xf5fc('0x37')](_[_0xf5fc('0x41')](_0x1f6d0e[_0xf5fc('0x35')],_0x1d7f79[_0xf5fc('0x37')]));_0x2e8d2d['where'][_0xf5fc('0x5b')]=_0x57883e['id'];if(_0x1f6d0e[_0xf5fc('0x35')][_0xf5fc('0x42')]){_0x2e8d2d[_0xf5fc('0x40')]=_[_0xf5fc('0x43')](_0x2e8d2d[_0xf5fc('0x40')],{'$or':_[_0xf5fc('0x31')](_0x2e8d2d[_0xf5fc('0x39')],function(_0xbae29c){var _0x1d7268={};_0x1d7268[_0xbae29c]={'$like':'%'+_0x1f6d0e[_0xf5fc('0x35')][_0xf5fc('0x42')]+'%'};return _0x1d7268;})});}_0x2e8d2d=_['merge']({},_0x2e8d2d,_0x1f6d0e[_0xf5fc('0x44')]);return db[_0xf5fc('0x5f')]['count']({'where':_0x2e8d2d[_0xf5fc('0x40')]})[_0xf5fc('0x25')](function(_0x1e82b0){_0x415de5[_0xf5fc('0x1e')]=_0x1e82b0;if(_0x1f6d0e[_0xf5fc('0x35')][_0xf5fc('0x46')]){_0x2e8d2d[_0xf5fc('0x47')]=[{'all':!![]}];}return db[_0xf5fc('0x5f')][_0xf5fc('0x48')](_0x2e8d2d);})['then'](function(_0x48f403){_0x415de5[_0xf5fc('0x5c')]=_0x48f403;return _0x415de5;});}})['then'](respondWithFilteredResult(_0x2e8976,_0x2e8d2d))[_0xf5fc('0x49')](handleError(_0x2e8976,null));};function char(_0x5d963b){return _0xf5fc('0x60')===typeof _0x5d963b?String['fromCharCode'][_0xf5fc('0x21')](null,arguments):_0x5d963b;}function needsEncapsulation(_0x43c59c){return!!_0x43c59c&&(_0x43c59c[_0xf5fc('0x61')]()[_0xf5fc('0x62')](char(0xd))>=0x0||_0x43c59c[_0xf5fc('0x61')]()[_0xf5fc('0x62')](char(0xa))>=0x0||_0x43c59c['toString']()['indexOf'](char(0x2c))>=0x0||_0x43c59c[_0xf5fc('0x61')]()[_0xf5fc('0x62')](char(0x22))>=0x0);}function encapsulate(_0x43a941){var _0x4d1bdc=char(0x22),_0x411a5b='\x5c'+char(0x22),_0xcba764=_0x43a941[_0xf5fc('0x61')]()[_0xf5fc('0x63')](new RegExp(_0x4d1bdc,'g'),_0x411a5b);return _0x4d1bdc+_0xcba764+_0x4d1bdc;}exports[_0xf5fc('0x64')]=function(_0x45b029,_0xe31e2c,_0x534619){var _0x3a1884,_0x1a648f;var _0x124a2e={'where':{'ProjectId':_0x45b029[_0xf5fc('0x4b')]['id']}};if(_0x45b029[_0xf5fc('0x35')]['startTime']){_0x124a2e[_0xf5fc('0x40')][_0xf5fc('0x65')]=JSON[_0xf5fc('0x66')](_0x45b029['query']['startTime']);}return db[_0xf5fc('0x59')][_0xf5fc('0x48')](_0x124a2e)[_0xf5fc('0x25')](handleEntityNotFound(_0xe31e2c,null))[_0xf5fc('0x25')](function(_0x127b8f){if(_0x127b8f){_0x3a1884=_0x127b8f;return db[_0xf5fc('0x67')][_0xf5fc('0x48')]({'where':{'SessionId':{'$in':_[_0xf5fc('0x31')](_0x3a1884,'id')},'ProjectId':_0x45b029[_0xf5fc('0x4b')]['id']},'order':_0xf5fc('0x68')});}})[_0xf5fc('0x25')](handleEntityNotFound(_0xe31e2c,null))['then'](function(_0x3a263d){if(_0x3a263d){_0x1a648f=_0x3a263d;var _0x499465={};for(var _0x314d1=0x0,_0x802d61=_0x1a648f[_0xf5fc('0x3b')];_0x314d1<_0x802d61;_0x314d1++){if(!_0x499465['hasOwnProperty'](_0x1a648f[_0x314d1][_0xf5fc('0x69')])){_0x499465[_0x1a648f[_0x314d1][_0xf5fc('0x69')]]=needsEncapsulation(_0x1a648f[_0x314d1][_0xf5fc('0x6a')])?encapsulate(_0x1a648f[_0x314d1][_0xf5fc('0x6a')]):_0x1a648f[_0x314d1][_0xf5fc('0x6a')];}}var _0xf0815f=[],_0x4dce45={};for(var _0x28ddb3=0x0,_0x117c94=_0x3a1884['length'];_0x28ddb3<_0x117c94;_0x28ddb3++){_0x4dce45={'ProjectId':_0x45b029['params']['id'],'SessionId':_0x3a1884[_0x28ddb3]['id'],'StartTime':moment(_0x3a1884[_0x28ddb3][_0xf5fc('0x65')])['format'](_0xf5fc('0x6b'))};for(var _0x1e2175=0x0,_0x2dafcb=_0x1a648f[_0xf5fc('0x3b')];_0x1e2175<_0x2dafcb;_0x1e2175++){if(_0x1a648f[_0x1e2175]['SessionId']==_0x3a1884[_0x28ddb3]['id']&&_0x499465['hasOwnProperty'](_0x1a648f[_0x1e2175]['questionId'])){_0x4dce45[_0x499465[_0x1a648f[_0x1e2175][_0xf5fc('0x69')]]]=_0x1a648f[_0x1e2175][_0xf5fc('0x6c')];}}for(var _0x397bc2 in _0x499465){if(!_0x4dce45[_0xf5fc('0x3c')](_0x499465[_0x397bc2])){_0x4dce45[_0x499465[_0x397bc2]]=null;}}_0xf0815f[_0xf5fc('0x6d')](_0x4dce45);}return _0xf0815f;}})[_0xf5fc('0x25')](function(_0x4b02e3){if(!_[_0xf5fc('0x6e')](_0x4b02e3)){var _0xbfdc59=toCsv(_0x4b02e3);var _0x542b61=Date[_0xf5fc('0x6f')]();fs[_0xf5fc('0x70')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x45b029[_0xf5fc('0x4b')]['id'],_0x542b61),_0xbfdc59);_0xe31e2c[_0xf5fc('0x71')](_0xf5fc('0x72'),_0xf5fc('0x73')+util[_0xf5fc('0x74')](_0xf5fc('0x75'),_0x45b029[_0xf5fc('0x4b')]['id'],_0x542b61));_0xe31e2c[_0xf5fc('0x71')](_0xf5fc('0x76'),'text/csv');return _0xe31e2c[_0xf5fc('0x77')](util[_0xf5fc('0x74')](_0xf5fc('0x78'),_0x45b029[_0xf5fc('0x4b')]['id'],_0x542b61));}else{return _0xe31e2c[_0xf5fc('0x28')](0xcc);}})[_0xf5fc('0x49')](handleError(_0xe31e2c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index f3f1f14..279023a 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 _0x7925=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','exports','jscripty_projects'];(function(_0x1543fb,_0x26c0f6){var _0x3fe930=function(_0x3237ad){while(--_0x3237ad){_0x1543fb['push'](_0x1543fb['shift']());}};_0x3fe930(++_0x26c0f6);}(_0x7925,0x105));var _0x5792=function(_0x149ae4,_0x2d4bc8){_0x149ae4=_0x149ae4-0x0;var _0x2d9733=_0x7925[_0x149ae4];return _0x2d9733;};'use strict';var _=require(_0x5792('0x0'));var util=require('util');var logger=require(_0x5792('0x1'))(_0x5792('0x2'));var moment=require(_0x5792('0x3'));var BPromise=require(_0x5792('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5792('0x5'));var rimraf=require(_0x5792('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x5792('0x7')]=function(_0x38c1af,_0x16597a){return _0x38c1af['define']('JscriptyProject',attributes,{'tableName':_0x5792('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33c9=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects'];(function(_0x614991,_0x25c638){var _0x4c787c=function(_0x3b2ee1){while(--_0x3b2ee1){_0x614991['push'](_0x614991['shift']());}};_0x4c787c(++_0x25c638);}(_0x33c9,0x104));var _0x933c=function(_0x57bfed,_0x489bad){_0x57bfed=_0x57bfed-0x0;var _0x4a8306=_0x33c9[_0x57bfed];return _0x4a8306;};'use strict';var _=require(_0x933c('0x0'));var util=require('util');var logger=require(_0x933c('0x1'))(_0x933c('0x2'));var moment=require(_0x933c('0x3'));var BPromise=require(_0x933c('0x4'));var rp=require(_0x933c('0x5'));var fs=require('fs');var path=require(_0x933c('0x6'));var rimraf=require(_0x933c('0x7'));var config=require('../../config/environment');var attributes=require(_0x933c('0x8'));module[_0x933c('0x9')]=function(_0x186431,_0x57efc7){return _0x186431[_0x933c('0xa')](_0x933c('0xb'),attributes,{'tableName':_0x933c('0xc'),'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 bbcb9f5..6fb4974 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 _0x3bc1=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3bc1,0x1c4));var _0x13bc=function(_0x2739ea,_0x40ffa6){_0x2739ea=_0x2739ea-0x0;var _0x4790cb=_0x3bc1[_0x2739ea];return _0x4790cb;};'use strict';var _=require(_0x13bc('0x0'));var util=require('util');var moment=require(_0x13bc('0x1'));var BPromise=require(_0x13bc('0x2'));var rs=require(_0x13bc('0x3'));var fs=require('fs');var Redis=require(_0x13bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x13bc('0x5'));var logger=require(_0x13bc('0x6'))(_0x13bc('0x7'));var config=require(_0x13bc('0x8'));var jayson=require(_0x13bc('0x9'));var client=jayson[_0x13bc('0xa')][_0x13bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ce1bf,_0x3325c3,_0x2db3e0){return new BPromise(function(_0x5a1efb,_0x4e66eb){return client[_0x13bc('0xc')](_0x4ce1bf,_0x2db3e0)[_0x13bc('0xd')](function(_0x1030bd){logger[_0x13bc('0xe')](_0x13bc('0xf'),_0x3325c3,_0x13bc('0x10'));logger[_0x13bc('0x11')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x3325c3,_0x13bc('0x10'),JSON[_0x13bc('0x12')](_0x1030bd));if(_0x1030bd['error']){if(_0x1030bd[_0x13bc('0x13')][_0x13bc('0x14')]===0x1f4){logger[_0x13bc('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x3325c3,_0x1030bd[_0x13bc('0x13')][_0x13bc('0x15')]);return _0x4e66eb(_0x1030bd[_0x13bc('0x13')][_0x13bc('0x15')]);}logger[_0x13bc('0x13')](_0x13bc('0xf'),_0x3325c3,_0x1030bd['error']['message']);return _0x5a1efb(_0x1030bd[_0x13bc('0x13')]['message']);}else{logger[_0x13bc('0xe')](_0x13bc('0xf'),_0x3325c3,_0x13bc('0x10'));_0x5a1efb(_0x1030bd[_0x13bc('0x16')]['message']);}})[_0x13bc('0x17')](function(_0x387352){logger['error'](_0x13bc('0xf'),_0x3325c3,_0x387352);_0x4e66eb(_0x387352);});});} \ No newline at end of file +var _0x376a=['jayson/promise','client','http','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x54d6b5,_0x1007ef){var _0x4576b8=function(_0x8243d0){while(--_0x8243d0){_0x54d6b5['push'](_0x54d6b5['shift']());}};_0x4576b8(++_0x1007ef);}(_0x376a,0x1bf));var _0xa376=function(_0x416959,_0x1f34e2){_0x416959=_0x416959-0x0;var _0x3c849a=_0x376a[_0x416959];return _0x3c849a;};'use strict';var _=require(_0xa376('0x0'));var util=require(_0xa376('0x1'));var moment=require(_0xa376('0x2'));var BPromise=require(_0xa376('0x3'));var rs=require(_0xa376('0x4'));var fs=require('fs');var Redis=require(_0xa376('0x5'));var db=require(_0xa376('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa376('0x7'))('rpc');var config=require(_0xa376('0x8'));var jayson=require(_0xa376('0x9'));var client=jayson[_0xa376('0xa')][_0xa376('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d64c9,_0xbc0d51,_0x398bd6){return new BPromise(function(_0xa25204,_0x24292d){return client['request'](_0x1d64c9,_0x398bd6)[_0xa376('0xc')](function(_0x4a891d){logger[_0xa376('0xd')](_0xa376('0xe'),_0xbc0d51,_0xa376('0xf'));logger[_0xa376('0x10')](_0xa376('0x11'),_0xbc0d51,_0xa376('0xf'),JSON[_0xa376('0x12')](_0x4a891d));if(_0x4a891d['error']){if(_0x4a891d[_0xa376('0x13')][_0xa376('0x14')]===0x1f4){logger[_0xa376('0x13')]('JscriptyProject,\x20%s,\x20%s',_0xbc0d51,_0x4a891d['error']['message']);return _0x24292d(_0x4a891d[_0xa376('0x13')][_0xa376('0x15')]);}logger[_0xa376('0x13')](_0xa376('0xe'),_0xbc0d51,_0x4a891d['error'][_0xa376('0x15')]);return _0xa25204(_0x4a891d[_0xa376('0x13')][_0xa376('0x15')]);}else{logger[_0xa376('0xd')](_0xa376('0xe'),_0xbc0d51,'request\x20sent');_0xa25204(_0x4a891d[_0xa376('0x16')][_0xa376('0x15')]);}})[_0xa376('0x17')](function(_0x1e8782){logger['error'](_0xa376('0xe'),_0xbc0d51,_0x1e8782);_0x24292d(_0x1e8782);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7d52ea5..5f16c04 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 _0x5145=['describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x5baa25,_0x1cab73){var _0x4b72f0=function(_0x417de9){while(--_0x417de9){_0x5baa25['push'](_0x5baa25['shift']());}};_0x4b72f0(++_0x1cab73);}(_0x5145,0x1bf));var _0x5514=function(_0x67c572,_0x4f2566){_0x67c572=_0x67c572-0x0;var _0x2df830=_0x5145[_0x67c572];return _0x2df830;};'use strict';var multer=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var path=require(_0x5514('0x2'));var timeout=require(_0x5514('0x3'));var express=require(_0x5514('0x4'));var router=express[_0x5514('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5514('0x6'));var interaction=require(_0x5514('0x7'));var config=require(_0x5514('0x8'));var controller=require(_0x5514('0x9'));router[_0x5514('0xa')]('/',auth[_0x5514('0xb')](),controller[_0x5514('0xc')]);router['get']('/describe',auth[_0x5514('0xb')](),controller[_0x5514('0xd')]);router[_0x5514('0xa')](_0x5514('0xe'),auth[_0x5514('0xb')](),controller[_0x5514('0xf')]);router[_0x5514('0x10')]('/',auth[_0x5514('0xb')](),controller['create']);router[_0x5514('0x11')](_0x5514('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5514('0xe'),auth['isAuthenticated'](),controller[_0x5514('0x12')]);module[_0x5514('0x13')]=router; \ No newline at end of file +var _0x0454=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x2a97de,_0xe55400){var _0x2194b8=function(_0x522042){while(--_0x522042){_0x2a97de['push'](_0x2a97de['shift']());}};_0x2194b8(++_0xe55400);}(_0x0454,0x10b));var _0x4045=function(_0x425289,_0x1accb5){_0x425289=_0x425289-0x0;var _0x364dee=_0x0454[_0x425289];return _0x364dee;};'use strict';var multer=require(_0x4045('0x0'));var util=require(_0x4045('0x1'));var path=require('path');var timeout=require(_0x4045('0x2'));var express=require(_0x4045('0x3'));var router=express[_0x4045('0x4')]();var fs_extra=require(_0x4045('0x5'));var auth=require(_0x4045('0x6'));var interaction=require(_0x4045('0x7'));var config=require(_0x4045('0x8'));var controller=require(_0x4045('0x9'));router[_0x4045('0xa')]('/',auth[_0x4045('0xb')](),controller[_0x4045('0xc')]);router[_0x4045('0xa')](_0x4045('0xd'),auth[_0x4045('0xb')](),controller[_0x4045('0xe')]);router[_0x4045('0xa')](_0x4045('0xf'),auth['isAuthenticated'](),controller[_0x4045('0x10')]);router[_0x4045('0x11')]('/',auth[_0x4045('0xb')](),controller[_0x4045('0x12')]);router['put'](_0x4045('0xf'),auth[_0x4045('0xb')](),controller['update']);router[_0x4045('0x13')](_0x4045('0xf'),auth[_0x4045('0xb')](),controller[_0x4045('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 17c35d0..635c649 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 _0xa478=['sequelize','exports','TEXT','long','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa478,0x136));var _0x8a47=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0xa478[_0x5401ae];return _0x286068;};'use strict';var Sequelize=require(_0x8a47('0x0'));module[_0x8a47('0x1')]={'question':{'type':Sequelize[_0x8a47('0x2')]},'answer':{'type':Sequelize[_0x8a47('0x2')](_0x8a47('0x3'))},'membername':{'type':Sequelize[_0x8a47('0x4')]},'projectname':{'type':Sequelize[_0x8a47('0x4')]},'queue':{'type':Sequelize[_0x8a47('0x4')]},'uniqueid':{'type':Sequelize[_0x8a47('0x4')]},'calleridname':{'type':Sequelize[_0x8a47('0x4')]},'calleridnum':{'type':Sequelize[_0x8a47('0x4')]},'questionId':{'type':Sequelize[_0x8a47('0x4')]}}; \ No newline at end of file +var _0x84a0=['TEXT','STRING','sequelize','exports'];(function(_0x231388,_0x26f1e0){var _0x481007=function(_0x4704c0){while(--_0x4704c0){_0x231388['push'](_0x231388['shift']());}};_0x481007(++_0x26f1e0);}(_0x84a0,0x66));var _0x084a=function(_0x43cf19,_0x56ebde){_0x43cf19=_0x43cf19-0x0;var _0x560994=_0x84a0[_0x43cf19];return _0x560994;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'question':{'type':Sequelize[_0x084a('0x2')]},'answer':{'type':Sequelize[_0x084a('0x2')]('long')},'membername':{'type':Sequelize[_0x084a('0x3')]},'projectname':{'type':Sequelize[_0x084a('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x084a('0x3')]},'calleridnum':{'type':Sequelize[_0x084a('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index d4ab34a..4ef3641 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 _0x50ed=['keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter','merge','VIRTUAL','where','include','findAll','rows','show','params','length','find','create','catch','describe','eml-format','rimraf','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/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','stack','name','render','body','contact','agent','interaction','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query'];(function(_0x3051f4,_0x207b3a){var _0x2006ad=function(_0xb0dda7){while(--_0xb0dda7){_0x3051f4['push'](_0x3051f4['shift']());}};_0x2006ad(++_0x207b3a);}(_0x50ed,0x14a));var _0xd50e=function(_0x5147d5,_0x346811){_0x5147d5=_0x5147d5-0x0;var _0x40a0f3=_0x50ed[_0x5147d5];return _0x40a0f3;};'use strict';var emlformat=require(_0xd50e('0x0'));var rimraf=require(_0xd50e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd50e('0x2'));var rp=require(_0xd50e('0x3'));var moment=require(_0xd50e('0x4'));var BPromise=require(_0xd50e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd50e('0x6'));var sox=require(_0xd50e('0x7'));var csv=require(_0xd50e('0x8'));var ejs=require(_0xd50e('0x9'));var fs=require('fs');var fs_extra=require(_0xd50e('0xa'));var _=require(_0xd50e('0xb'));var squel=require(_0xd50e('0xc'));var crypto=require(_0xd50e('0xd'));var jsforce=require(_0xd50e('0xe'));var deskjs=require(_0xd50e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd50e('0x10'));var Papa=require(_0xd50e('0x11'));var Redis=require(_0xd50e('0x12'));var authService=require(_0xd50e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd50e('0x14'));var hardwareService=require(_0xd50e('0x15'));var logger=require(_0xd50e('0x16'))(_0xd50e('0x17'));var utils=require(_0xd50e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd50e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x69bf72,_0x46573c){_0x46573c=_0x46573c||0xcc;return function(_0x2f4544){if(_0x2f4544){return _0x69bf72['sendStatus'](_0x46573c);}return _0x69bf72['status'](_0x46573c)[_0xd50e('0x1a')]();};}function respondWithResult(_0x4f4a17,_0x177bd9){_0x177bd9=_0x177bd9||0xc8;return function(_0x418a51){if(_0x418a51){return _0x4f4a17[_0xd50e('0x1b')](_0x177bd9)[_0xd50e('0x1c')](_0x418a51);}};}function respondWithFilteredResult(_0x4cbf4e,_0x577189){return function(_0x5d8637){if(_0x5d8637){var _0x22ecd1=typeof _0x577189[_0xd50e('0x1d')]===_0xd50e('0x1e')&&typeof _0x577189[_0xd50e('0x1f')]===_0xd50e('0x1e');var _0x2664ac=_0x5d8637[_0xd50e('0x20')];var _0x113453=_0x22ecd1?0x0:_0x577189[_0xd50e('0x1d')];var _0x598a40=_0x22ecd1?_0x5d8637[_0xd50e('0x20')]:_0x577189[_0xd50e('0x1d')]+_0x577189[_0xd50e('0x1f')];var _0x34d91d;if(_0x598a40>=_0x2664ac){_0x598a40=_0x2664ac;_0x34d91d=0xc8;}else{_0x34d91d=0xce;}_0x4cbf4e['status'](_0x34d91d);return _0x4cbf4e[_0xd50e('0x21')](_0xd50e('0x22'),_0x113453+'-'+_0x598a40+'/'+_0x2664ac)[_0xd50e('0x1c')](_0x5d8637);}return null;};}function patchUpdates(_0x32561b){return function(_0x1a4d7a){try{jsonpatch[_0xd50e('0x23')](_0x1a4d7a,_0x32561b,!![]);}catch(_0x482a0c){return BPromise['reject'](_0x482a0c);}return _0x1a4d7a['save']();};}function saveUpdates(_0x2fb517,_0x19543c){return function(_0x4c474a){if(_0x4c474a){return _0x4c474a[_0xd50e('0x24')](_0x2fb517)[_0xd50e('0x25')](function(_0x2089b0){return _0x2089b0;});}return null;};}function removeEntity(_0x55fb3c,_0x469e65){return function(_0x5b794d){if(_0x5b794d){return _0x5b794d[_0xd50e('0x26')]()[_0xd50e('0x25')](function(){_0x55fb3c[_0xd50e('0x1b')](0xcc)[_0xd50e('0x1a')]();});}};}function handleEntityNotFound(_0x2512b3,_0x249159){return function(_0x4be400){if(!_0x4be400){_0x2512b3[_0xd50e('0x27')](0x194);}return _0x4be400;};}function handleError(_0x4309d0,_0x39e091){_0x39e091=_0x39e091||0x1f4;return function(_0x3eb6e1){logger['error'](_0x3eb6e1[_0xd50e('0x28')]);if(_0x3eb6e1[_0xd50e('0x29')]){delete _0x3eb6e1[_0xd50e('0x29')];}_0x4309d0[_0xd50e('0x1b')](_0x39e091)['send'](_0x3eb6e1);};}function getMustacheRender(_0x36e940,_0x238acc){return Mustache[_0xd50e('0x2a')](_0x36e940,_['merge'](_0x238acc[_0xd50e('0x2b')],{'contact':_0x238acc[_0xd50e('0x2c')],'message':_0x238acc['message'],'agent':_0x238acc[_0xd50e('0x2d')],'interaction':_0x238acc[_0xd50e('0x2e')],'account':_0x238acc['account']}))||'';}exports[_0xd50e('0x2f')]=function(_0x44baf6,_0x156578){var _0x66025b={},_0x57228f={},_0x27e393={'count':0x0,'rows':[]};var _0x558a78=_[_0xd50e('0x30')](db[_0xd50e('0x31')][_0xd50e('0x32')],function(_0x189327){return{'name':_0x189327[_0xd50e('0x33')],'type':_0x189327[_0xd50e('0x34')]['key']};});_0x57228f[_0xd50e('0x35')]=_[_0xd50e('0x30')](_0x558a78,_0xd50e('0x29'));_0x57228f[_0xd50e('0x36')]=_[_0xd50e('0x37')](_0x44baf6[_0xd50e('0x36')]);_0x57228f[_0xd50e('0x38')]=_[_0xd50e('0x39')](_0x57228f[_0xd50e('0x35')],_0x57228f[_0xd50e('0x36')]);_0x66025b[_0xd50e('0x3a')]=_[_0xd50e('0x39')](_0x57228f[_0xd50e('0x35')],qs[_0xd50e('0x3b')](_0x44baf6[_0xd50e('0x36')]['fields']));_0x66025b[_0xd50e('0x3a')]=_0x66025b[_0xd50e('0x3a')]['length']?_0x66025b[_0xd50e('0x3a')]:_0x57228f[_0xd50e('0x35')];if(!_0x44baf6[_0xd50e('0x36')]['hasOwnProperty'](_0xd50e('0x3c'))){_0x66025b[_0xd50e('0x1f')]=qs[_0xd50e('0x1f')](_0x44baf6[_0xd50e('0x36')]['limit']);_0x66025b['offset']=qs[_0xd50e('0x1d')](_0x44baf6[_0xd50e('0x36')]['offset']);}_0x66025b['order']=qs[_0xd50e('0x3d')](_0x44baf6[_0xd50e('0x36')][_0xd50e('0x3d')]);_0x66025b['where']=qs[_0xd50e('0x38')](_[_0xd50e('0x3e')](_0x44baf6['query'],_0x57228f['filters']),_0x558a78);if(_0x44baf6[_0xd50e('0x36')][_0xd50e('0x3f')]){_0x66025b['where']=_[_0xd50e('0x40')](_0x66025b['where'],{'$or':_[_0xd50e('0x30')](_0x558a78,function(_0x942bec){if(_0x942bec['type']!==_0xd50e('0x41')){var _0x3b4d94={};_0x3b4d94[_0x942bec[_0xd50e('0x29')]]={'$like':'%'+_0x44baf6[_0xd50e('0x36')][_0xd50e('0x3f')]+'%'};return _0x3b4d94;}})});}_0x66025b=_['merge']({},_0x66025b,_0x44baf6['options']);var _0x23c631={'where':_0x66025b[_0xd50e('0x42')]};return db[_0xd50e('0x31')][_0xd50e('0x20')](_0x23c631)['then'](function(_0x183107){_0x27e393[_0xd50e('0x20')]=_0x183107;if(_0x44baf6[_0xd50e('0x36')]['includeAll']){_0x66025b[_0xd50e('0x43')]=[{'all':!![]}];}return db[_0xd50e('0x31')][_0xd50e('0x44')](_0x66025b);})[_0xd50e('0x25')](function(_0x950374){_0x27e393[_0xd50e('0x45')]=_0x950374;return _0x27e393;})[_0xd50e('0x25')](respondWithFilteredResult(_0x156578,_0x66025b))['catch'](handleError(_0x156578,null));};exports[_0xd50e('0x46')]=function(_0x4b12e3,_0x3ae8ad){var _0x473230={'raw':!![],'where':{'id':_0x4b12e3[_0xd50e('0x47')]['id']}},_0x23e61e={};_0x23e61e[_0xd50e('0x35')]=_['keys'](db[_0xd50e('0x31')][_0xd50e('0x32')]);_0x23e61e['query']=_['keys'](_0x4b12e3['query']);_0x23e61e[_0xd50e('0x38')]=_[_0xd50e('0x39')](_0x23e61e[_0xd50e('0x35')],_0x23e61e['query']);_0x473230[_0xd50e('0x3a')]=_['intersection'](_0x23e61e[_0xd50e('0x35')],qs[_0xd50e('0x3b')](_0x4b12e3[_0xd50e('0x36')]['fields']));_0x473230['attributes']=_0x473230['attributes'][_0xd50e('0x48')]?_0x473230['attributes']:_0x23e61e[_0xd50e('0x35')];if(_0x4b12e3[_0xd50e('0x36')]['includeAll']){_0x473230[_0xd50e('0x43')]=[{'all':!![]}];}_0x473230=_[_0xd50e('0x40')]({},_0x473230,_0x4b12e3['options']);return db['JscriptyQuestionReport'][_0xd50e('0x49')](_0x473230)['then'](handleEntityNotFound(_0x3ae8ad,null))[_0xd50e('0x25')](respondWithResult(_0x3ae8ad,null))['catch'](handleError(_0x3ae8ad,null));};exports[_0xd50e('0x4a')]=function(_0x125361,_0x553e9a){return db['JscriptyQuestionReport'][_0xd50e('0x4a')](_0x125361[_0xd50e('0x2b')],{})[_0xd50e('0x25')](respondWithResult(_0x553e9a,0xc9))[_0xd50e('0x4b')](handleError(_0x553e9a,null));};exports[_0xd50e('0x24')]=function(_0x58fe77,_0x3967c4){if(_0x58fe77[_0xd50e('0x2b')]['id']){delete _0x58fe77['body']['id'];}return db['JscriptyQuestionReport'][_0xd50e('0x49')]({'where':{'id':_0x58fe77[_0xd50e('0x47')]['id']}})[_0xd50e('0x25')](handleEntityNotFound(_0x3967c4,null))[_0xd50e('0x25')](saveUpdates(_0x58fe77[_0xd50e('0x2b')],null))[_0xd50e('0x25')](respondWithResult(_0x3967c4,null))[_0xd50e('0x4b')](handleError(_0x3967c4,null));};exports['destroy']=function(_0x320f51,_0x4afbed){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x320f51[_0xd50e('0x47')]['id']}})[_0xd50e('0x25')](handleEntityNotFound(_0x4afbed,null))[_0xd50e('0x25')](removeEntity(_0x4afbed,null))[_0xd50e('0x4b')](handleError(_0x4afbed,null));};exports[_0xd50e('0x4c')]=function(_0x14b459,_0x192958){return db['JscriptyQuestionReport'][_0xd50e('0x4c')]()[_0xd50e('0x25')](respondWithResult(_0x192958,null))[_0xd50e('0x4b')](handleError(_0x192958,null));}; \ No newline at end of file +var _0x03a1=['fields','length','nolimit','order','sort','filters','filter','where','merge','options','count','includeAll','findAll','catch','show','params','find','create','body','update','destroy','describe','rimraf','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','then','error','name','send','contact','message','agent','account','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x03a1,0xa4));var _0x103a=function(_0x11dd6f,_0x2c626e){_0x11dd6f=_0x11dd6f-0x0;var _0x5a4ba5=_0x03a1[_0x11dd6f];return _0x5a4ba5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x103a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x103a('0x1'));var Mustache=require(_0x103a('0x2'));var util=require('util');var path=require(_0x103a('0x3'));var sox=require('sox');var csv=require(_0x103a('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x103a('0x5'));var _=require(_0x103a('0x6'));var squel=require(_0x103a('0x7'));var crypto=require(_0x103a('0x8'));var jsforce=require(_0x103a('0x9'));var deskjs=require(_0x103a('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x103a('0xb'));var Redis=require('ioredis');var authService=require(_0x103a('0xc'));var qs=require(_0x103a('0xd'));var as=require(_0x103a('0xe'));var hardwareService=require(_0x103a('0xf'));var logger=require(_0x103a('0x10'))(_0x103a('0x11'));var utils=require('../../config/utils');var config=require(_0x103a('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x560bf3,_0x35d2ee){_0x35d2ee=_0x35d2ee||0xcc;return function(_0x3f429c){if(_0x3f429c){return _0x560bf3[_0x103a('0x13')](_0x35d2ee);}return _0x560bf3[_0x103a('0x14')](_0x35d2ee)[_0x103a('0x15')]();};}function respondWithResult(_0x87f219,_0x101fb7){_0x101fb7=_0x101fb7||0xc8;return function(_0x1afe0d){if(_0x1afe0d){return _0x87f219[_0x103a('0x14')](_0x101fb7)[_0x103a('0x16')](_0x1afe0d);}};}function respondWithFilteredResult(_0xb86302,_0x5c64b6){return function(_0x413ee8){if(_0x413ee8){var _0x54c2fb=typeof _0x5c64b6[_0x103a('0x17')]===_0x103a('0x18')&&typeof _0x5c64b6[_0x103a('0x19')]==='undefined';var _0x2809d0=_0x413ee8['count'];var _0x4a0c12=_0x54c2fb?0x0:_0x5c64b6[_0x103a('0x17')];var _0x56ddca=_0x54c2fb?_0x413ee8['count']:_0x5c64b6[_0x103a('0x17')]+_0x5c64b6['limit'];var _0x59c0e7;if(_0x56ddca>=_0x2809d0){_0x56ddca=_0x2809d0;_0x59c0e7=0xc8;}else{_0x59c0e7=0xce;}_0xb86302[_0x103a('0x14')](_0x59c0e7);return _0xb86302[_0x103a('0x1a')](_0x103a('0x1b'),_0x4a0c12+'-'+_0x56ddca+'/'+_0x2809d0)[_0x103a('0x16')](_0x413ee8);}return null;};}function patchUpdates(_0x55493a){return function(_0x3d46af){try{jsonpatch['apply'](_0x3d46af,_0x55493a,!![]);}catch(_0x91081){return BPromise[_0x103a('0x1c')](_0x91081);}return _0x3d46af[_0x103a('0x1d')]();};}function saveUpdates(_0x6c485,_0x61b2e5){return function(_0x51511a){if(_0x51511a){return _0x51511a['update'](_0x6c485)[_0x103a('0x1e')](function(_0x5660c4){return _0x5660c4;});}return null;};}function removeEntity(_0xa636da,_0x3a0437){return function(_0x10ee91){if(_0x10ee91){return _0x10ee91['destroy']()[_0x103a('0x1e')](function(){_0xa636da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc29b16,_0x5c67f1){return function(_0x64ebf){if(!_0x64ebf){_0xc29b16['sendStatus'](0x194);}return _0x64ebf;};}function handleError(_0x20b63d,_0x4e8713){_0x4e8713=_0x4e8713||0x1f4;return function(_0x224825){logger[_0x103a('0x1f')](_0x224825['stack']);if(_0x224825[_0x103a('0x20')]){delete _0x224825['name'];}_0x20b63d[_0x103a('0x14')](_0x4e8713)[_0x103a('0x21')](_0x224825);};}function getMustacheRender(_0x413f9e,_0x414bfd){return Mustache['render'](_0x413f9e,_['merge'](_0x414bfd['body'],{'contact':_0x414bfd[_0x103a('0x22')],'message':_0x414bfd[_0x103a('0x23')],'agent':_0x414bfd[_0x103a('0x24')],'interaction':_0x414bfd['interaction'],'account':_0x414bfd[_0x103a('0x25')]}))||'';}exports['index']=function(_0x5ba7bd,_0x1503d9){var _0xb6de35={},_0x6b5306={},_0x4a787e={'count':0x0,'rows':[]};var _0x20549c=_[_0x103a('0x26')](db[_0x103a('0x27')][_0x103a('0x28')],function(_0x4e17a3){return{'name':_0x4e17a3[_0x103a('0x29')],'type':_0x4e17a3[_0x103a('0x2a')][_0x103a('0x2b')]};});_0x6b5306[_0x103a('0x2c')]=_[_0x103a('0x26')](_0x20549c,_0x103a('0x20'));_0x6b5306['query']=_[_0x103a('0x2d')](_0x5ba7bd[_0x103a('0x2e')]);_0x6b5306['filters']=_[_0x103a('0x2f')](_0x6b5306[_0x103a('0x2c')],_0x6b5306['query']);_0xb6de35[_0x103a('0x30')]=_['intersection'](_0x6b5306[_0x103a('0x2c')],qs['fields'](_0x5ba7bd['query'][_0x103a('0x31')]));_0xb6de35[_0x103a('0x30')]=_0xb6de35[_0x103a('0x30')][_0x103a('0x32')]?_0xb6de35['attributes']:_0x6b5306['model'];if(!_0x5ba7bd[_0x103a('0x2e')]['hasOwnProperty'](_0x103a('0x33'))){_0xb6de35[_0x103a('0x19')]=qs[_0x103a('0x19')](_0x5ba7bd[_0x103a('0x2e')]['limit']);_0xb6de35['offset']=qs[_0x103a('0x17')](_0x5ba7bd[_0x103a('0x2e')][_0x103a('0x17')]);}_0xb6de35[_0x103a('0x34')]=qs[_0x103a('0x35')](_0x5ba7bd[_0x103a('0x2e')]['sort']);_0xb6de35['where']=qs[_0x103a('0x36')](_['pick'](_0x5ba7bd[_0x103a('0x2e')],_0x6b5306['filters']),_0x20549c);if(_0x5ba7bd[_0x103a('0x2e')][_0x103a('0x37')]){_0xb6de35[_0x103a('0x38')]=_['merge'](_0xb6de35[_0x103a('0x38')],{'$or':_[_0x103a('0x26')](_0x20549c,function(_0xa592b7){if(_0xa592b7[_0x103a('0x2a')]!=='VIRTUAL'){var _0x1eb89c={};_0x1eb89c[_0xa592b7[_0x103a('0x20')]]={'$like':'%'+_0x5ba7bd[_0x103a('0x2e')]['filter']+'%'};return _0x1eb89c;}})});}_0xb6de35=_[_0x103a('0x39')]({},_0xb6de35,_0x5ba7bd[_0x103a('0x3a')]);var _0x1fffc8={'where':_0xb6de35[_0x103a('0x38')]};return db[_0x103a('0x27')][_0x103a('0x3b')](_0x1fffc8)['then'](function(_0x40a33a){_0x4a787e[_0x103a('0x3b')]=_0x40a33a;if(_0x5ba7bd['query'][_0x103a('0x3c')]){_0xb6de35['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x103a('0x3d')](_0xb6de35);})[_0x103a('0x1e')](function(_0x3fbcef){_0x4a787e['rows']=_0x3fbcef;return _0x4a787e;})['then'](respondWithFilteredResult(_0x1503d9,_0xb6de35))[_0x103a('0x3e')](handleError(_0x1503d9,null));};exports[_0x103a('0x3f')]=function(_0x334aeb,_0x247ca4){var _0xf807a8={'raw':!![],'where':{'id':_0x334aeb[_0x103a('0x40')]['id']}},_0x30a0ef={};_0x30a0ef[_0x103a('0x2c')]=_[_0x103a('0x2d')](db[_0x103a('0x27')][_0x103a('0x28')]);_0x30a0ef['query']=_['keys'](_0x334aeb[_0x103a('0x2e')]);_0x30a0ef[_0x103a('0x36')]=_[_0x103a('0x2f')](_0x30a0ef[_0x103a('0x2c')],_0x30a0ef[_0x103a('0x2e')]);_0xf807a8['attributes']=_[_0x103a('0x2f')](_0x30a0ef[_0x103a('0x2c')],qs[_0x103a('0x31')](_0x334aeb[_0x103a('0x2e')][_0x103a('0x31')]));_0xf807a8[_0x103a('0x30')]=_0xf807a8[_0x103a('0x30')]['length']?_0xf807a8[_0x103a('0x30')]:_0x30a0ef[_0x103a('0x2c')];if(_0x334aeb['query'][_0x103a('0x3c')]){_0xf807a8['include']=[{'all':!![]}];}_0xf807a8=_[_0x103a('0x39')]({},_0xf807a8,_0x334aeb[_0x103a('0x3a')]);return db[_0x103a('0x27')][_0x103a('0x41')](_0xf807a8)[_0x103a('0x1e')](handleEntityNotFound(_0x247ca4,null))[_0x103a('0x1e')](respondWithResult(_0x247ca4,null))[_0x103a('0x3e')](handleError(_0x247ca4,null));};exports[_0x103a('0x42')]=function(_0x382427,_0x538d38){return db[_0x103a('0x27')][_0x103a('0x42')](_0x382427[_0x103a('0x43')],{})[_0x103a('0x1e')](respondWithResult(_0x538d38,0xc9))[_0x103a('0x3e')](handleError(_0x538d38,null));};exports[_0x103a('0x44')]=function(_0x509bb9,_0x3a1bdf){if(_0x509bb9[_0x103a('0x43')]['id']){delete _0x509bb9[_0x103a('0x43')]['id'];}return db[_0x103a('0x27')][_0x103a('0x41')]({'where':{'id':_0x509bb9[_0x103a('0x40')]['id']}})[_0x103a('0x1e')](handleEntityNotFound(_0x3a1bdf,null))[_0x103a('0x1e')](saveUpdates(_0x509bb9[_0x103a('0x43')],null))[_0x103a('0x1e')](respondWithResult(_0x3a1bdf,null))['catch'](handleError(_0x3a1bdf,null));};exports[_0x103a('0x45')]=function(_0x87f7bd,_0x4e6f02){return db[_0x103a('0x27')][_0x103a('0x41')]({'where':{'id':_0x87f7bd[_0x103a('0x40')]['id']}})[_0x103a('0x1e')](handleEntityNotFound(_0x4e6f02,null))[_0x103a('0x1e')](removeEntity(_0x4e6f02,null))[_0x103a('0x3e')](handleError(_0x4e6f02,null));};exports[_0x103a('0x46')]=function(_0x510ec4,_0x15dc57){return db[_0x103a('0x27')][_0x103a('0x46')]()[_0x103a('0x1e')](respondWithResult(_0x15dc57,null))[_0x103a('0x3e')](handleError(_0x15dc57,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index e97099a..af7d454 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 _0x4739=['report_jscripty_questions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x21e4c5,_0x5a7050){var _0x216c92=function(_0x1c6ddd){while(--_0x1c6ddd){_0x21e4c5['push'](_0x21e4c5['shift']());}};_0x216c92(++_0x5a7050);}(_0x4739,0x1eb));var _0x9473=function(_0x4346cd,_0x44948c){_0x4346cd=_0x4346cd-0x0;var _0x42eabf=_0x4739[_0x4346cd];return _0x42eabf;};'use strict';var _=require(_0x9473('0x0'));var util=require(_0x9473('0x1'));var logger=require('../../config/logger')(_0x9473('0x2'));var moment=require(_0x9473('0x3'));var BPromise=require(_0x9473('0x4'));var rp=require(_0x9473('0x5'));var fs=require('fs');var path=require(_0x9473('0x6'));var rimraf=require(_0x9473('0x7'));var config=require(_0x9473('0x8'));var attributes=require(_0x9473('0x9'));module[_0x9473('0xa')]=function(_0x999072,_0x2ac08a){return _0x999072[_0x9473('0xb')](_0x9473('0xc'),attributes,{'tableName':_0x9473('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e3f=['../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x376a19,_0x1eab71){var _0x2c117e=function(_0x35ee76){while(--_0x35ee76){_0x376a19['push'](_0x376a19['shift']());}};_0x2c117e(++_0x1eab71);}(_0x6e3f,0x19d));var _0xf6e3=function(_0x169f71,_0x14e7bd){_0x169f71=_0x169f71-0x0;var _0x3661a7=_0x6e3f[_0x169f71];return _0x3661a7;};'use strict';var _=require(_0xf6e3('0x0'));var util=require(_0xf6e3('0x1'));var logger=require(_0xf6e3('0x2'))(_0xf6e3('0x3'));var moment=require(_0xf6e3('0x4'));var BPromise=require(_0xf6e3('0x5'));var rp=require(_0xf6e3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf6e3('0x7'));var attributes=require(_0xf6e3('0x8'));module[_0xf6e3('0x9')]=function(_0x10aaf5,_0x103ea3){return _0x10aaf5['define'](_0xf6e3('0xa'),attributes,{'tableName':_0xf6e3('0xb'),'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 b9bed6c..c5ef63d 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 _0x7ef8=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x142cc0,_0x4ca2d0){var _0xabe71f=function(_0x1efc4e){while(--_0x1efc4e){_0x142cc0['push'](_0x142cc0['shift']());}};_0xabe71f(++_0x4ca2d0);}(_0x7ef8,0xf7));var _0x87ef=function(_0x54db45,_0x494dfb){_0x54db45=_0x54db45-0x0;var _0x24c231=_0x7ef8[_0x54db45];return _0x24c231;};'use strict';var _=require(_0x87ef('0x0'));var util=require(_0x87ef('0x1'));var moment=require(_0x87ef('0x2'));var BPromise=require('bluebird');var rs=require(_0x87ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87ef('0x4'))['db'];var utils=require(_0x87ef('0x5'));var logger=require(_0x87ef('0x6'))('rpc');var config=require(_0x87ef('0x7'));var jayson=require(_0x87ef('0x8'));var client=jayson[_0x87ef('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb0bfb9,_0x3677ae,_0x688301){return new BPromise(function(_0x1f443a,_0x5c2c93){return client[_0x87ef('0xa')](_0xb0bfb9,_0x688301)[_0x87ef('0xb')](function(_0x4d63b0){logger[_0x87ef('0xc')](_0x87ef('0xd'),_0x3677ae,_0x87ef('0xe'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3677ae,_0x87ef('0xe'),JSON[_0x87ef('0xf')](_0x4d63b0));if(_0x4d63b0[_0x87ef('0x10')]){if(_0x4d63b0[_0x87ef('0x10')][_0x87ef('0x11')]===0x1f4){logger[_0x87ef('0x10')](_0x87ef('0xd'),_0x3677ae,_0x4d63b0[_0x87ef('0x10')][_0x87ef('0x12')]);return _0x5c2c93(_0x4d63b0[_0x87ef('0x10')][_0x87ef('0x12')]);}logger[_0x87ef('0x10')](_0x87ef('0xd'),_0x3677ae,_0x4d63b0[_0x87ef('0x10')][_0x87ef('0x12')]);return _0x1f443a(_0x4d63b0[_0x87ef('0x10')][_0x87ef('0x12')]);}else{logger[_0x87ef('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3677ae,'request\x20sent');_0x1f443a(_0x4d63b0['result'][_0x87ef('0x12')]);}})['catch'](function(_0x5109c5){logger['error'](_0x87ef('0xd'),_0x3677ae,_0x5109c5);_0x5c2c93(_0x5109c5);});});} \ No newline at end of file +var _0x069c=['../../config/environment','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x069c,0x183));var _0xc069=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x069c[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0xc069('0x0'));var util=require(_0xc069('0x1'));var moment=require(_0xc069('0x2'));var BPromise=require(_0xc069('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc069('0x4'));var db=require(_0xc069('0x5'))['db'];var utils=require(_0xc069('0x6'));var logger=require(_0xc069('0x7'))(_0xc069('0x8'));var config=require(_0xc069('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc069('0xa')][_0xc069('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25dc70,_0xd27277,_0x24dda3){return new BPromise(function(_0x3b867f,_0x52273c){return client[_0xc069('0xc')](_0x25dc70,_0x24dda3)['then'](function(_0x109871){logger[_0xc069('0xd')](_0xc069('0xe'),_0xd27277,'request\x20sent');logger[_0xc069('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xd27277,_0xc069('0x10'),JSON[_0xc069('0x11')](_0x109871));if(_0x109871['error']){if(_0x109871[_0xc069('0x12')][_0xc069('0x13')]===0x1f4){logger['error'](_0xc069('0xe'),_0xd27277,_0x109871['error'][_0xc069('0x14')]);return _0x52273c(_0x109871['error'][_0xc069('0x14')]);}logger[_0xc069('0x12')](_0xc069('0xe'),_0xd27277,_0x109871[_0xc069('0x12')]['message']);return _0x3b867f(_0x109871['error'][_0xc069('0x14')]);}else{logger[_0xc069('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xd27277,'request\x20sent');_0x3b867f(_0x109871[_0xc069('0x15')]['message']);}})['catch'](function(_0x98847b){logger['error'](_0xc069('0xe'),_0xd27277,_0x98847b);_0x52273c(_0x98847b);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8e9eb23..3d492d5 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 _0x6f47=['path','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getQuestions','create','put','update','delete','destroy','util'];(function(_0x442e1e,_0x4fa8dc){var _0x288764=function(_0x5bbfbc){while(--_0x5bbfbc){_0x442e1e['push'](_0x442e1e['shift']());}};_0x288764(++_0x4fa8dc);}(_0x6f47,0xc7));var _0x76f4=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6f47[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var fs_extra=require(_0x76f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var controller=require(_0x76f4('0x6'));router[_0x76f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x76f4('0x8')]);router[_0x76f4('0x7')](_0x76f4('0x9'),auth['isAuthenticated'](),controller[_0x76f4('0xa')]);router[_0x76f4('0x7')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0xd')]);router['get']('/:id/questions',auth[_0x76f4('0xc')](),controller[_0x76f4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x76f4('0xf')]);router[_0x76f4('0x10')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x11')]);router[_0x76f4('0x12')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8958=['isAuthenticated','index','get','/describe','/:id','show','/:id/questions','getQuestions','post','put','update','delete','destroy','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x8958,0x93));var _0x8895=function(_0x583fc5,_0x302d7b){_0x583fc5=_0x583fc5-0x0;var _0x5e9b67=_0x8958[_0x583fc5];return _0x5e9b67;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8895('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var controller=require(_0x8895('0x4'));router['get']('/',auth[_0x8895('0x5')](),controller[_0x8895('0x6')]);router[_0x8895('0x7')](_0x8895('0x8'),auth[_0x8895('0x5')](),controller['describe']);router[_0x8895('0x7')](_0x8895('0x9'),auth[_0x8895('0x5')](),controller[_0x8895('0xa')]);router[_0x8895('0x7')](_0x8895('0xb'),auth[_0x8895('0x5')](),controller[_0x8895('0xc')]);router[_0x8895('0xd')]('/',auth[_0x8895('0x5')](),controller['create']);router[_0x8895('0xe')](_0x8895('0x9'),auth[_0x8895('0x5')](),controller[_0x8895('0xf')]);router[_0x8895('0x10')](_0x8895('0x9'),auth['isAuthenticated'](),controller[_0x8895('0x11')]);module[_0x8895('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 0498bfe..cf8bdc1 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 _0x4092=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','exports','DATE','setDataValue','starttime','endtime'];(function(_0x80582a,_0x31d6f0){var _0x1a6e2d=function(_0x264f10){while(--_0x264f10){_0x80582a['push'](_0x80582a['shift']());}};_0x1a6e2d(++_0x31d6f0);}(_0x4092,0xd3));var _0x2409=function(_0xf6bb7d,_0x8af4f5){_0xf6bb7d=_0xf6bb7d-0x0;var _0x132764=_0x4092[_0xf6bb7d];return _0x132764;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x2409('0x0')]={'starttime':{'type':Sequelize[_0x2409('0x1')],'set':function(_0xe6a976){this[_0x2409('0x2')](_0x2409('0x3'),_0xe6a976);this[_0x2409('0x2')](_0x2409('0x4'),moment()[_0x2409('0x5')](_0x2409('0x6')));}},'endtime':{'type':Sequelize[_0x2409('0x1')]},'membername':{'type':Sequelize[_0x2409('0x7')]},'projectname':{'type':Sequelize[_0x2409('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2409('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2409('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6049=['BOOLEAN','moment','sequelize','exports','starttime','setDataValue','endtime','format','DATE','STRING'];(function(_0x59fbcf,_0x1ee617){var _0x39093d=function(_0x38b553){while(--_0x38b553){_0x59fbcf['push'](_0x59fbcf['shift']());}};_0x39093d(++_0x1ee617);}(_0x6049,0x1cd));var _0x9604=function(_0x12de8c,_0x1cd0ee){_0x12de8c=_0x12de8c-0x0;var _0x26849a=_0x6049[_0x12de8c];return _0x26849a;};'use strict';var moment=require(_0x9604('0x0'));var Sequelize=require(_0x9604('0x1'));module[_0x9604('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x41e6d1){this['setDataValue'](_0x9604('0x3'),_0x41e6d1);this[_0x9604('0x4')](_0x9604('0x5'),moment()[_0x9604('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x9604('0x7')]},'membername':{'type':Sequelize[_0x9604('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9604('0x8')]},'calleridname':{'type':Sequelize[_0x9604('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x9604('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 9147cb7..c7ceb98 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 _0xedcb=['nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','find','create','params','destroy','describe','findOne','JscriptyQuestionReport','rawAttributes','SessionId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','render','merge','body','contact','message','agent','account','index','map','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xedcb,0x1c2));var _0xbedc=function(_0x8ae996,_0x520674){_0x8ae996=_0x8ae996-0x0;var _0x1e0e68=_0xedcb[_0x8ae996];return _0x1e0e68;};'use strict';var emlformat=require(_0xbedc('0x0'));var rimraf=require(_0xbedc('0x1'));var zipdir=require(_0xbedc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbedc('0x3'));var moment=require(_0xbedc('0x4'));var BPromise=require(_0xbedc('0x5'));var Mustache=require(_0xbedc('0x6'));var util=require('util');var path=require(_0xbedc('0x7'));var sox=require('sox');var csv=require(_0xbedc('0x8'));var ejs=require(_0xbedc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbedc('0xa'));var squel=require(_0xbedc('0xb'));var crypto=require(_0xbedc('0xc'));var jsforce=require(_0xbedc('0xd'));var deskjs=require(_0xbedc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbedc('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbedc('0x10'));var as=require(_0xbedc('0x11'));var hardwareService=require(_0xbedc('0x12'));var logger=require(_0xbedc('0x13'))(_0xbedc('0x14'));var utils=require(_0xbedc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbedc('0x16'));var db=require(_0xbedc('0x17'))['db'];function respondWithStatusCode(_0x3b7ebd,_0x3c322d){_0x3c322d=_0x3c322d||0xcc;return function(_0x14bc25){if(_0x14bc25){return _0x3b7ebd[_0xbedc('0x18')](_0x3c322d);}return _0x3b7ebd[_0xbedc('0x19')](_0x3c322d)[_0xbedc('0x1a')]();};}function respondWithResult(_0x5d50fa,_0x37f55f){_0x37f55f=_0x37f55f||0xc8;return function(_0x5a33d5){if(_0x5a33d5){return _0x5d50fa[_0xbedc('0x19')](_0x37f55f)[_0xbedc('0x1b')](_0x5a33d5);}};}function respondWithFilteredResult(_0xd2cfe2,_0x135eee){return function(_0x275f48){if(_0x275f48){var _0x51c6d7=typeof _0x135eee[_0xbedc('0x1c')]===_0xbedc('0x1d')&&typeof _0x135eee[_0xbedc('0x1e')]===_0xbedc('0x1d');var _0x37c0e0=_0x275f48['count'];var _0x5f31a4=_0x51c6d7?0x0:_0x135eee['offset'];var _0x2011e1=_0x51c6d7?_0x275f48[_0xbedc('0x1f')]:_0x135eee[_0xbedc('0x1c')]+_0x135eee[_0xbedc('0x1e')];var _0x1aac00;if(_0x2011e1>=_0x37c0e0){_0x2011e1=_0x37c0e0;_0x1aac00=0xc8;}else{_0x1aac00=0xce;}_0xd2cfe2[_0xbedc('0x19')](_0x1aac00);return _0xd2cfe2[_0xbedc('0x20')]('Content-Range',_0x5f31a4+'-'+_0x2011e1+'/'+_0x37c0e0)[_0xbedc('0x1b')](_0x275f48);}return null;};}function patchUpdates(_0x2fc884){return function(_0xd26c03){try{jsonpatch[_0xbedc('0x21')](_0xd26c03,_0x2fc884,!![]);}catch(_0x4873a4){return BPromise['reject'](_0x4873a4);}return _0xd26c03[_0xbedc('0x22')]();};}function saveUpdates(_0x577b54,_0x2f9160){return function(_0x317c67){if(_0x317c67){return _0x317c67[_0xbedc('0x23')](_0x577b54)['then'](function(_0x432b84){return _0x432b84;});}return null;};}function removeEntity(_0x565286,_0x5b0369){return function(_0x4725a7){if(_0x4725a7){return _0x4725a7['destroy']()[_0xbedc('0x24')](function(){_0x565286[_0xbedc('0x19')](0xcc)[_0xbedc('0x1a')]();});}};}function handleEntityNotFound(_0x439978,_0x170b10){return function(_0x3f11d0){if(!_0x3f11d0){_0x439978[_0xbedc('0x18')](0x194);}return _0x3f11d0;};}function handleError(_0x1069e0,_0x1b50be){_0x1b50be=_0x1b50be||0x1f4;return function(_0x3623a4){logger[_0xbedc('0x25')](_0x3623a4[_0xbedc('0x26')]);if(_0x3623a4['name']){delete _0x3623a4[_0xbedc('0x27')];}_0x1069e0[_0xbedc('0x19')](_0x1b50be)[_0xbedc('0x28')](_0x3623a4);};}function getMustacheRender(_0x46d02f,_0x24bb70){return Mustache[_0xbedc('0x29')](_0x46d02f,_[_0xbedc('0x2a')](_0x24bb70[_0xbedc('0x2b')],{'contact':_0x24bb70[_0xbedc('0x2c')],'message':_0x24bb70[_0xbedc('0x2d')],'agent':_0x24bb70[_0xbedc('0x2e')],'interaction':_0x24bb70['interaction'],'account':_0x24bb70[_0xbedc('0x2f')]}))||'';}exports[_0xbedc('0x30')]=function(_0x5815b1,_0x37a20e){var _0x2cd9dc={},_0x461cd0={},_0x38753b={'count':0x0,'rows':[]};var _0x367a87=_[_0xbedc('0x31')](db['JscriptySessionReport']['rawAttributes'],function(_0x6db44d){return{'name':_0x6db44d[_0xbedc('0x32')],'type':_0x6db44d[_0xbedc('0x33')]['key']};});_0x461cd0[_0xbedc('0x34')]=_[_0xbedc('0x31')](_0x367a87,_0xbedc('0x27'));_0x461cd0['query']=_[_0xbedc('0x35')](_0x5815b1[_0xbedc('0x36')]);_0x461cd0['filters']=_['intersection'](_0x461cd0['model'],_0x461cd0[_0xbedc('0x36')]);_0x2cd9dc[_0xbedc('0x37')]=_[_0xbedc('0x38')](_0x461cd0[_0xbedc('0x34')],qs[_0xbedc('0x39')](_0x5815b1[_0xbedc('0x36')][_0xbedc('0x39')]));_0x2cd9dc[_0xbedc('0x37')]=_0x2cd9dc['attributes'][_0xbedc('0x3a')]?_0x2cd9dc[_0xbedc('0x37')]:_0x461cd0[_0xbedc('0x34')];if(!_0x5815b1['query'][_0xbedc('0x3b')](_0xbedc('0x3c'))){_0x2cd9dc[_0xbedc('0x1e')]=qs['limit'](_0x5815b1[_0xbedc('0x36')][_0xbedc('0x1e')]);_0x2cd9dc['offset']=qs[_0xbedc('0x1c')](_0x5815b1[_0xbedc('0x36')]['offset']);}_0x2cd9dc[_0xbedc('0x3d')]=qs[_0xbedc('0x3e')](_0x5815b1['query']['sort']);_0x2cd9dc[_0xbedc('0x3f')]=qs[_0xbedc('0x40')](_[_0xbedc('0x41')](_0x5815b1[_0xbedc('0x36')],_0x461cd0[_0xbedc('0x40')]),_0x367a87);if(_0x5815b1[_0xbedc('0x36')][_0xbedc('0x42')]){_0x2cd9dc[_0xbedc('0x3f')]=_[_0xbedc('0x2a')](_0x2cd9dc[_0xbedc('0x3f')],{'$or':_[_0xbedc('0x31')](_0x367a87,function(_0x3d1ff3){if(_0x3d1ff3[_0xbedc('0x33')]!==_0xbedc('0x43')){var _0x5568b9={};_0x5568b9[_0x3d1ff3[_0xbedc('0x27')]]={'$like':'%'+_0x5815b1['query']['filter']+'%'};return _0x5568b9;}})});}_0x2cd9dc=_['merge']({},_0x2cd9dc,_0x5815b1[_0xbedc('0x44')]);var _0xebacfd={'where':_0x2cd9dc[_0xbedc('0x3f')]};return db[_0xbedc('0x45')][_0xbedc('0x1f')](_0xebacfd)['then'](function(_0x8f59d4){_0x38753b[_0xbedc('0x1f')]=_0x8f59d4;if(_0x5815b1['query'][_0xbedc('0x46')]){_0x2cd9dc[_0xbedc('0x47')]=[{'all':!![]}];}return db[_0xbedc('0x45')][_0xbedc('0x48')](_0x2cd9dc);})[_0xbedc('0x24')](function(_0xcdce58){_0x38753b[_0xbedc('0x49')]=_0xcdce58;return _0x38753b;})[_0xbedc('0x24')](respondWithFilteredResult(_0x37a20e,_0x2cd9dc))[_0xbedc('0x4a')](handleError(_0x37a20e,null));};exports[_0xbedc('0x4b')]=function(_0x1f6ccb,_0x77674f){var _0xd363de={'raw':!![],'where':{'id':_0x1f6ccb['params']['id']}},_0x59906b={};_0x59906b[_0xbedc('0x34')]=_[_0xbedc('0x35')](db[_0xbedc('0x45')]['rawAttributes']);_0x59906b[_0xbedc('0x36')]=_['keys'](_0x1f6ccb[_0xbedc('0x36')]);_0x59906b[_0xbedc('0x40')]=_[_0xbedc('0x38')](_0x59906b[_0xbedc('0x34')],_0x59906b['query']);_0xd363de[_0xbedc('0x37')]=_[_0xbedc('0x38')](_0x59906b[_0xbedc('0x34')],qs[_0xbedc('0x39')](_0x1f6ccb['query']['fields']));_0xd363de[_0xbedc('0x37')]=_0xd363de[_0xbedc('0x37')][_0xbedc('0x3a')]?_0xd363de['attributes']:_0x59906b[_0xbedc('0x34')];if(_0x1f6ccb[_0xbedc('0x36')][_0xbedc('0x46')]){_0xd363de[_0xbedc('0x47')]=[{'all':!![]}];}_0xd363de=_[_0xbedc('0x2a')]({},_0xd363de,_0x1f6ccb[_0xbedc('0x44')]);return db['JscriptySessionReport'][_0xbedc('0x4c')](_0xd363de)[_0xbedc('0x24')](handleEntityNotFound(_0x77674f,null))['then'](respondWithResult(_0x77674f,null))['catch'](handleError(_0x77674f,null));};exports[_0xbedc('0x4d')]=function(_0x5f7ba2,_0x1b5117){return db[_0xbedc('0x45')][_0xbedc('0x4d')](_0x5f7ba2[_0xbedc('0x2b')],{})['then'](respondWithResult(_0x1b5117,0xc9))['catch'](handleError(_0x1b5117,null));};exports[_0xbedc('0x23')]=function(_0x39fbff,_0x562e5b){if(_0x39fbff[_0xbedc('0x2b')]['id']){delete _0x39fbff[_0xbedc('0x2b')]['id'];}return db[_0xbedc('0x45')]['find']({'where':{'id':_0x39fbff[_0xbedc('0x4e')]['id']}})[_0xbedc('0x24')](handleEntityNotFound(_0x562e5b,null))[_0xbedc('0x24')](saveUpdates(_0x39fbff[_0xbedc('0x2b')],null))['then'](respondWithResult(_0x562e5b,null))['catch'](handleError(_0x562e5b,null));};exports[_0xbedc('0x4f')]=function(_0x526d3f,_0x4a528f){return db[_0xbedc('0x45')][_0xbedc('0x4c')]({'where':{'id':_0x526d3f[_0xbedc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4a528f,null))[_0xbedc('0x24')](removeEntity(_0x4a528f,null))[_0xbedc('0x4a')](handleError(_0x4a528f,null));};exports[_0xbedc('0x50')]=function(_0x3b078a,_0x19afbf){return db['JscriptySessionReport'][_0xbedc('0x50')]()[_0xbedc('0x24')](respondWithResult(_0x19afbf,null))[_0xbedc('0x4a')](handleError(_0x19afbf,null));};exports['getQuestions']=function(_0x2af901,_0x13c003,_0x1cbb6a){var _0x46ea70={'raw':!![],'where':{}};var _0x39024d={};var _0x345830={'count':0x0,'rows':[]};return db[_0xbedc('0x45')][_0xbedc('0x51')]({'where':{'id':_0x2af901[_0xbedc('0x4e')]['id']}})[_0xbedc('0x24')](handleEntityNotFound(_0x13c003,null))['then'](function(_0x4ee4c4){if(_0x4ee4c4){_0x39024d['model']=_[_0xbedc('0x35')](db[_0xbedc('0x52')][_0xbedc('0x53')]);_0x39024d[_0xbedc('0x36')]=_[_0xbedc('0x35')](_0x2af901[_0xbedc('0x36')]);_0x39024d[_0xbedc('0x40')]=_[_0xbedc('0x38')](_0x39024d['model'],_0x39024d['query']);_0x46ea70[_0xbedc('0x37')]=_[_0xbedc('0x38')](_0x39024d['model'],qs[_0xbedc('0x39')](_0x2af901[_0xbedc('0x36')][_0xbedc('0x39')]));_0x46ea70['attributes']=_0x46ea70[_0xbedc('0x37')][_0xbedc('0x3a')]?_0x46ea70[_0xbedc('0x37')]:_0x39024d[_0xbedc('0x34')];if(!_0x2af901['query'][_0xbedc('0x3b')](_0xbedc('0x3c'))){_0x46ea70[_0xbedc('0x1e')]=qs[_0xbedc('0x1e')](_0x2af901[_0xbedc('0x36')][_0xbedc('0x1e')]);_0x46ea70[_0xbedc('0x1c')]=qs[_0xbedc('0x1c')](_0x2af901[_0xbedc('0x36')][_0xbedc('0x1c')]);}_0x46ea70[_0xbedc('0x3d')]=qs['sort'](_0x2af901[_0xbedc('0x36')]['sort']);_0x46ea70['where']=qs[_0xbedc('0x40')](_[_0xbedc('0x41')](_0x2af901['query'],_0x39024d[_0xbedc('0x40')]));_0x46ea70[_0xbedc('0x3f')][_0xbedc('0x54')]=_0x4ee4c4['id'];if(_0x2af901['query']['filter']){_0x46ea70['where']=_[_0xbedc('0x2a')](_0x46ea70[_0xbedc('0x3f')],{'$or':_[_0xbedc('0x31')](_0x46ea70[_0xbedc('0x37')],function(_0x436572){var _0x3a5385={};_0x3a5385[_0x436572]={'$like':'%'+_0x2af901['query']['filter']+'%'};return _0x3a5385;})});}_0x46ea70=_['merge']({},_0x46ea70,_0x2af901[_0xbedc('0x44')]);return db['JscriptyQuestionReport'][_0xbedc('0x1f')]({'where':_0x46ea70[_0xbedc('0x3f')]})[_0xbedc('0x24')](function(_0x79f170){_0x345830['count']=_0x79f170;if(_0x2af901[_0xbedc('0x36')][_0xbedc('0x46')]){_0x46ea70['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xbedc('0x48')](_0x46ea70);})[_0xbedc('0x24')](function(_0x395efb){_0x345830[_0xbedc('0x49')]=_0x395efb;return _0x345830;});}})[_0xbedc('0x24')](respondWithFilteredResult(_0x13c003,_0x46ea70))[_0xbedc('0x4a')](handleError(_0x13c003,null));}; \ No newline at end of file +var _0xece5=['JscriptySessionReport','include','findAll','catch','params','rawAttributes','keys','includeAll','create','find','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','name','render','merge','body','contact','message','interaction','account','index','map','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options'];(function(_0x4baa60,_0x249c67){var _0xe468b1=function(_0x3e2617){while(--_0x3e2617){_0x4baa60['push'](_0x4baa60['shift']());}};_0xe468b1(++_0x249c67);}(_0xece5,0x164));var _0x5ece=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xece5[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require(_0x5ece('0x0'));var rimraf=require(_0x5ece('0x1'));var zipdir=require(_0x5ece('0x2'));var jsonpatch=require(_0x5ece('0x3'));var rp=require(_0x5ece('0x4'));var moment=require('moment');var BPromise=require(_0x5ece('0x5'));var Mustache=require('mustache');var util=require(_0x5ece('0x6'));var path=require('path');var sox=require(_0x5ece('0x7'));var csv=require(_0x5ece('0x8'));var ejs=require(_0x5ece('0x9'));var fs=require('fs');var fs_extra=require(_0x5ece('0xa'));var _=require(_0x5ece('0xb'));var squel=require(_0x5ece('0xc'));var crypto=require('crypto');var jsforce=require(_0x5ece('0xd'));var deskjs=require(_0x5ece('0xe'));var toCsv=require(_0x5ece('0x8'));var querystring=require(_0x5ece('0xf'));var Papa=require(_0x5ece('0x10'));var Redis=require(_0x5ece('0x11'));var authService=require(_0x5ece('0x12'));var qs=require(_0x5ece('0x13'));var as=require(_0x5ece('0x14'));var hardwareService=require(_0x5ece('0x15'));var logger=require(_0x5ece('0x16'))(_0x5ece('0x17'));var utils=require('../../config/utils');var config=require(_0x5ece('0x18'));var licenseUtil=require(_0x5ece('0x19'));var db=require(_0x5ece('0x1a'))['db'];function respondWithStatusCode(_0x2bae03,_0x4d97c5){_0x4d97c5=_0x4d97c5||0xcc;return function(_0x3ec859){if(_0x3ec859){return _0x2bae03[_0x5ece('0x1b')](_0x4d97c5);}return _0x2bae03[_0x5ece('0x1c')](_0x4d97c5)[_0x5ece('0x1d')]();};}function respondWithResult(_0xba0fc1,_0x36e502){_0x36e502=_0x36e502||0xc8;return function(_0x523e91){if(_0x523e91){return _0xba0fc1[_0x5ece('0x1c')](_0x36e502)['json'](_0x523e91);}};}function respondWithFilteredResult(_0x575e4b,_0x698980){return function(_0x5aef54){if(_0x5aef54){var _0x541cbe=typeof _0x698980[_0x5ece('0x1e')]===_0x5ece('0x1f')&&typeof _0x698980[_0x5ece('0x20')]===_0x5ece('0x1f');var _0x5a16d5=_0x5aef54[_0x5ece('0x21')];var _0x44b75b=_0x541cbe?0x0:_0x698980[_0x5ece('0x1e')];var _0x4e755f=_0x541cbe?_0x5aef54['count']:_0x698980['offset']+_0x698980[_0x5ece('0x20')];var _0x2333c2;if(_0x4e755f>=_0x5a16d5){_0x4e755f=_0x5a16d5;_0x2333c2=0xc8;}else{_0x2333c2=0xce;}_0x575e4b[_0x5ece('0x1c')](_0x2333c2);return _0x575e4b[_0x5ece('0x22')](_0x5ece('0x23'),_0x44b75b+'-'+_0x4e755f+'/'+_0x5a16d5)[_0x5ece('0x24')](_0x5aef54);}return null;};}function patchUpdates(_0x338474){return function(_0x325294){try{jsonpatch[_0x5ece('0x25')](_0x325294,_0x338474,!![]);}catch(_0x4969b7){return BPromise['reject'](_0x4969b7);}return _0x325294[_0x5ece('0x26')]();};}function saveUpdates(_0x36fe69,_0x1cda9c){return function(_0x376491){if(_0x376491){return _0x376491[_0x5ece('0x27')](_0x36fe69)[_0x5ece('0x28')](function(_0x30b453){return _0x30b453;});}return null;};}function removeEntity(_0xfaf9b2,_0x2b6a59){return function(_0x2054eb){if(_0x2054eb){return _0x2054eb[_0x5ece('0x29')]()[_0x5ece('0x28')](function(){_0xfaf9b2[_0x5ece('0x1c')](0xcc)[_0x5ece('0x1d')]();});}};}function handleEntityNotFound(_0x98dc59,_0x445355){return function(_0x21dbe1){if(!_0x21dbe1){_0x98dc59['sendStatus'](0x194);}return _0x21dbe1;};}function handleError(_0x1ac285,_0x28f226){_0x28f226=_0x28f226||0x1f4;return function(_0x17fdb7){logger['error'](_0x17fdb7['stack']);if(_0x17fdb7['name']){delete _0x17fdb7[_0x5ece('0x2a')];}_0x1ac285[_0x5ece('0x1c')](_0x28f226)['send'](_0x17fdb7);};}function getMustacheRender(_0x39b8f0,_0xa84fae){return Mustache[_0x5ece('0x2b')](_0x39b8f0,_[_0x5ece('0x2c')](_0xa84fae[_0x5ece('0x2d')],{'contact':_0xa84fae[_0x5ece('0x2e')],'message':_0xa84fae[_0x5ece('0x2f')],'agent':_0xa84fae['agent'],'interaction':_0xa84fae[_0x5ece('0x30')],'account':_0xa84fae[_0x5ece('0x31')]}))||'';}exports[_0x5ece('0x32')]=function(_0x55097e,_0x4f9759){var _0x1bad8a={},_0x1e1cec={},_0x591ed7={'count':0x0,'rows':[]};var _0x1c662c=_[_0x5ece('0x33')](db['JscriptySessionReport']['rawAttributes'],function(_0x542b92){return{'name':_0x542b92['fieldName'],'type':_0x542b92[_0x5ece('0x34')][_0x5ece('0x35')]};});_0x1e1cec[_0x5ece('0x36')]=_[_0x5ece('0x33')](_0x1c662c,'name');_0x1e1cec[_0x5ece('0x37')]=_['keys'](_0x55097e[_0x5ece('0x37')]);_0x1e1cec[_0x5ece('0x38')]=_['intersection'](_0x1e1cec['model'],_0x1e1cec['query']);_0x1bad8a['attributes']=_[_0x5ece('0x39')](_0x1e1cec[_0x5ece('0x36')],qs['fields'](_0x55097e[_0x5ece('0x37')][_0x5ece('0x3a')]));_0x1bad8a[_0x5ece('0x3b')]=_0x1bad8a[_0x5ece('0x3b')][_0x5ece('0x3c')]?_0x1bad8a[_0x5ece('0x3b')]:_0x1e1cec['model'];if(!_0x55097e['query']['hasOwnProperty'](_0x5ece('0x3d'))){_0x1bad8a[_0x5ece('0x20')]=qs[_0x5ece('0x20')](_0x55097e['query'][_0x5ece('0x20')]);_0x1bad8a[_0x5ece('0x1e')]=qs[_0x5ece('0x1e')](_0x55097e[_0x5ece('0x37')][_0x5ece('0x1e')]);}_0x1bad8a[_0x5ece('0x3e')]=qs['sort'](_0x55097e[_0x5ece('0x37')][_0x5ece('0x3f')]);_0x1bad8a[_0x5ece('0x40')]=qs['filters'](_[_0x5ece('0x41')](_0x55097e[_0x5ece('0x37')],_0x1e1cec[_0x5ece('0x38')]),_0x1c662c);if(_0x55097e[_0x5ece('0x37')]['filter']){_0x1bad8a[_0x5ece('0x40')]=_[_0x5ece('0x2c')](_0x1bad8a[_0x5ece('0x40')],{'$or':_[_0x5ece('0x33')](_0x1c662c,function(_0x2d0876){if(_0x2d0876[_0x5ece('0x34')]!==_0x5ece('0x42')){var _0x292c83={};_0x292c83[_0x2d0876[_0x5ece('0x2a')]]={'$like':'%'+_0x55097e[_0x5ece('0x37')][_0x5ece('0x43')]+'%'};return _0x292c83;}})});}_0x1bad8a=_['merge']({},_0x1bad8a,_0x55097e[_0x5ece('0x44')]);var _0x4e7be7={'where':_0x1bad8a['where']};return db[_0x5ece('0x45')][_0x5ece('0x21')](_0x4e7be7)[_0x5ece('0x28')](function(_0x4d1a25){_0x591ed7[_0x5ece('0x21')]=_0x4d1a25;if(_0x55097e['query']['includeAll']){_0x1bad8a[_0x5ece('0x46')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x5ece('0x47')](_0x1bad8a);})[_0x5ece('0x28')](function(_0x514815){_0x591ed7['rows']=_0x514815;return _0x591ed7;})[_0x5ece('0x28')](respondWithFilteredResult(_0x4f9759,_0x1bad8a))[_0x5ece('0x48')](handleError(_0x4f9759,null));};exports['show']=function(_0x2ab1df,_0x5d4e39){var _0x73450d={'raw':!![],'where':{'id':_0x2ab1df[_0x5ece('0x49')]['id']}},_0xde355b={};_0xde355b[_0x5ece('0x36')]=_['keys'](db['JscriptySessionReport'][_0x5ece('0x4a')]);_0xde355b['query']=_[_0x5ece('0x4b')](_0x2ab1df['query']);_0xde355b[_0x5ece('0x38')]=_[_0x5ece('0x39')](_0xde355b['model'],_0xde355b[_0x5ece('0x37')]);_0x73450d[_0x5ece('0x3b')]=_[_0x5ece('0x39')](_0xde355b[_0x5ece('0x36')],qs['fields'](_0x2ab1df[_0x5ece('0x37')][_0x5ece('0x3a')]));_0x73450d[_0x5ece('0x3b')]=_0x73450d[_0x5ece('0x3b')][_0x5ece('0x3c')]?_0x73450d[_0x5ece('0x3b')]:_0xde355b[_0x5ece('0x36')];if(_0x2ab1df[_0x5ece('0x37')][_0x5ece('0x4c')]){_0x73450d[_0x5ece('0x46')]=[{'all':!![]}];}_0x73450d=_[_0x5ece('0x2c')]({},_0x73450d,_0x2ab1df[_0x5ece('0x44')]);return db['JscriptySessionReport']['find'](_0x73450d)[_0x5ece('0x28')](handleEntityNotFound(_0x5d4e39,null))[_0x5ece('0x28')](respondWithResult(_0x5d4e39,null))[_0x5ece('0x48')](handleError(_0x5d4e39,null));};exports[_0x5ece('0x4d')]=function(_0x2d15aa,_0x147b73){return db['JscriptySessionReport'][_0x5ece('0x4d')](_0x2d15aa['body'],{})[_0x5ece('0x28')](respondWithResult(_0x147b73,0xc9))[_0x5ece('0x48')](handleError(_0x147b73,null));};exports[_0x5ece('0x27')]=function(_0x251705,_0x36851d){if(_0x251705[_0x5ece('0x2d')]['id']){delete _0x251705[_0x5ece('0x2d')]['id'];}return db[_0x5ece('0x45')][_0x5ece('0x4e')]({'where':{'id':_0x251705['params']['id']}})[_0x5ece('0x28')](handleEntityNotFound(_0x36851d,null))['then'](saveUpdates(_0x251705['body'],null))[_0x5ece('0x28')](respondWithResult(_0x36851d,null))[_0x5ece('0x48')](handleError(_0x36851d,null));};exports[_0x5ece('0x29')]=function(_0x552821,_0x57d95b){return db[_0x5ece('0x45')][_0x5ece('0x4e')]({'where':{'id':_0x552821[_0x5ece('0x49')]['id']}})['then'](handleEntityNotFound(_0x57d95b,null))[_0x5ece('0x28')](removeEntity(_0x57d95b,null))['catch'](handleError(_0x57d95b,null));};exports['describe']=function(_0x21add8,_0x24e739){return db[_0x5ece('0x45')][_0x5ece('0x4f')]()['then'](respondWithResult(_0x24e739,null))[_0x5ece('0x48')](handleError(_0x24e739,null));};exports[_0x5ece('0x50')]=function(_0x518f20,_0x46e30b,_0x4b6fbf){var _0x164e16={'raw':!![],'where':{}};var _0xeedb8={};var _0x4d1456={'count':0x0,'rows':[]};return db[_0x5ece('0x45')][_0x5ece('0x51')]({'where':{'id':_0x518f20[_0x5ece('0x49')]['id']}})[_0x5ece('0x28')](handleEntityNotFound(_0x46e30b,null))[_0x5ece('0x28')](function(_0x357ddd){if(_0x357ddd){_0xeedb8[_0x5ece('0x36')]=_[_0x5ece('0x4b')](db[_0x5ece('0x52')][_0x5ece('0x4a')]);_0xeedb8[_0x5ece('0x37')]=_[_0x5ece('0x4b')](_0x518f20[_0x5ece('0x37')]);_0xeedb8['filters']=_[_0x5ece('0x39')](_0xeedb8[_0x5ece('0x36')],_0xeedb8['query']);_0x164e16[_0x5ece('0x3b')]=_[_0x5ece('0x39')](_0xeedb8[_0x5ece('0x36')],qs[_0x5ece('0x3a')](_0x518f20[_0x5ece('0x37')][_0x5ece('0x3a')]));_0x164e16[_0x5ece('0x3b')]=_0x164e16[_0x5ece('0x3b')][_0x5ece('0x3c')]?_0x164e16[_0x5ece('0x3b')]:_0xeedb8['model'];if(!_0x518f20[_0x5ece('0x37')][_0x5ece('0x53')](_0x5ece('0x3d'))){_0x164e16['limit']=qs[_0x5ece('0x20')](_0x518f20['query'][_0x5ece('0x20')]);_0x164e16[_0x5ece('0x1e')]=qs[_0x5ece('0x1e')](_0x518f20[_0x5ece('0x37')][_0x5ece('0x1e')]);}_0x164e16[_0x5ece('0x3e')]=qs['sort'](_0x518f20['query'][_0x5ece('0x3f')]);_0x164e16[_0x5ece('0x40')]=qs[_0x5ece('0x38')](_['pick'](_0x518f20[_0x5ece('0x37')],_0xeedb8[_0x5ece('0x38')]));_0x164e16[_0x5ece('0x40')][_0x5ece('0x54')]=_0x357ddd['id'];if(_0x518f20[_0x5ece('0x37')][_0x5ece('0x43')]){_0x164e16['where']=_[_0x5ece('0x2c')](_0x164e16[_0x5ece('0x40')],{'$or':_[_0x5ece('0x33')](_0x164e16[_0x5ece('0x3b')],function(_0x49b3ba){var _0x87e344={};_0x87e344[_0x49b3ba]={'$like':'%'+_0x518f20[_0x5ece('0x37')]['filter']+'%'};return _0x87e344;})});}_0x164e16=_[_0x5ece('0x2c')]({},_0x164e16,_0x518f20[_0x5ece('0x44')]);return db[_0x5ece('0x52')][_0x5ece('0x21')]({'where':_0x164e16['where']})['then'](function(_0x5dbfb9){_0x4d1456[_0x5ece('0x21')]=_0x5dbfb9;if(_0x518f20[_0x5ece('0x37')][_0x5ece('0x4c')]){_0x164e16[_0x5ece('0x46')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x5ece('0x47')](_0x164e16);})['then'](function(_0x5b270f){_0x4d1456['rows']=_0x5b270f;return _0x4d1456;});}})['then'](respondWithFilteredResult(_0x46e30b,_0x164e16))['catch'](handleError(_0x46e30b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ad11508..e8b07c4 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 _0xd260=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x4fa710,_0x51815d){var _0x1a0fca=function(_0x340f5c){while(--_0x340f5c){_0x4fa710['push'](_0x4fa710['shift']());}};_0x1a0fca(++_0x51815d);}(_0xd260,0xa4));var _0x0d26=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0xd260[_0x2085f3];return _0x384e3c;};'use strict';var _=require(_0x0d26('0x0'));var util=require('util');var logger=require(_0x0d26('0x1'))(_0x0d26('0x2'));var moment=require(_0x0d26('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0d26('0x4'));var config=require(_0x0d26('0x5'));var attributes=require(_0x0d26('0x6'));module[_0x0d26('0x7')]=function(_0xa9c0d,_0x362596){return _0xa9c0d[_0x0d26('0x8')](_0x0d26('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73ed=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','util','../../config/logger','api'];(function(_0x1eaa6b,_0x153d06){var _0x25f4fd=function(_0x29c84c){while(--_0x29c84c){_0x1eaa6b['push'](_0x1eaa6b['shift']());}};_0x25f4fd(++_0x153d06);}(_0x73ed,0x17d));var _0xd73e=function(_0x27eac1,_0x131e47){_0x27eac1=_0x27eac1-0x0;var _0xe99099=_0x73ed[_0x27eac1];return _0xe99099;};'use strict';var _=require('lodash');var util=require(_0xd73e('0x0'));var logger=require(_0xd73e('0x1'))(_0xd73e('0x2'));var moment=require(_0xd73e('0x3'));var BPromise=require(_0xd73e('0x4'));var rp=require(_0xd73e('0x5'));var fs=require('fs');var path=require(_0xd73e('0x6'));var rimraf=require(_0xd73e('0x7'));var config=require(_0xd73e('0x8'));var attributes=require(_0xd73e('0x9'));module[_0xd73e('0xa')]=function(_0x3113fd,_0x294916){return _0x3113fd['define'](_0xd73e('0xb'),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 e05aad4..10f6560 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 _0xae60=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x1cb74b,_0x215b2f){var _0x4cf377=function(_0x1f14f0){while(--_0x1f14f0){_0x1cb74b['push'](_0x1cb74b['shift']());}};_0x4cf377(++_0x215b2f);}(_0xae60,0x1c7));var _0x0ae6=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xae60[_0x3fba9f];return _0x192cf1;};'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')]('JscriptySessionReport,\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);});});} \ No newline at end of file +var _0x5fec=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x12e5c1,_0x385711){var _0x438476=function(_0x276dd1){while(--_0x276dd1){_0x12e5c1['push'](_0x12e5c1['shift']());}};_0x438476(++_0x385711);}(_0x5fec,0x6b));var _0xc5fe=function(_0x409fc5,_0x2eef80){_0x409fc5=_0x409fc5-0x0;var _0x4b2648=_0x5fec[_0x409fc5];return _0x4b2648;};'use strict';var _=require(_0xc5fe('0x0'));var util=require('util');var moment=require(_0xc5fe('0x1'));var BPromise=require(_0xc5fe('0x2'));var rs=require(_0xc5fe('0x3'));var fs=require('fs');var Redis=require(_0xc5fe('0x4'));var db=require(_0xc5fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5fe('0x6'))(_0xc5fe('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc5fe('0x8')][_0xc5fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x371c17,_0x45cfd0,_0x50e949){return new BPromise(function(_0x198c78,_0x4e9e80){return client[_0xc5fe('0xa')](_0x371c17,_0x50e949)[_0xc5fe('0xb')](function(_0x3a912b){logger[_0xc5fe('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x45cfd0,_0xc5fe('0xd'));logger[_0xc5fe('0xe')](_0xc5fe('0xf'),_0x45cfd0,_0xc5fe('0xd'),JSON['stringify'](_0x3a912b));if(_0x3a912b[_0xc5fe('0x10')]){if(_0x3a912b[_0xc5fe('0x10')][_0xc5fe('0x11')]===0x1f4){logger[_0xc5fe('0x10')](_0xc5fe('0x12'),_0x45cfd0,_0x3a912b[_0xc5fe('0x10')][_0xc5fe('0x13')]);return _0x4e9e80(_0x3a912b[_0xc5fe('0x10')]['message']);}logger['error'](_0xc5fe('0x12'),_0x45cfd0,_0x3a912b['error']['message']);return _0x198c78(_0x3a912b[_0xc5fe('0x10')][_0xc5fe('0x13')]);}else{logger[_0xc5fe('0xc')](_0xc5fe('0x12'),_0x45cfd0,_0xc5fe('0xd'));_0x198c78(_0x3a912b[_0xc5fe('0x14')][_0xc5fe('0x13')]);}})[_0xc5fe('0x15')](function(_0x3a6666){logger[_0xc5fe('0x10')](_0xc5fe('0x12'),_0x45cfd0,_0x3a6666);_0x4e9e80(_0x3a6666);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 8e34fd5..6573bfd 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 _0x8853=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','isAuthenticated','exports','multer'];(function(_0x215048,_0x359d01){var _0x527f32=function(_0x53be39){while(--_0x53be39){_0x215048['push'](_0x215048['shift']());}};_0x527f32(++_0x359d01);}(_0x8853,0x103));var _0x3885=function(_0x469348,_0x39af3d){_0x469348=_0x469348-0x0;var _0x5a13a1=_0x8853[_0x469348];return _0x5a13a1;};'use strict';var multer=require(_0x3885('0x0'));var util=require('util');var path=require(_0x3885('0x1'));var timeout=require(_0x3885('0x2'));var express=require(_0x3885('0x3'));var router=express['Router']();var fs_extra=require(_0x3885('0x4'));var auth=require(_0x3885('0x5'));var interaction=require(_0x3885('0x6'));var config=require(_0x3885('0x7'));var controller=require(_0x3885('0x8'));router[_0x3885('0x9')]('/',controller[_0x3885('0xa')]);router['put']('/:id',auth[_0x3885('0xb')](),controller['update']);module[_0x3885('0xc')]=router; \ No newline at end of file +var _0xd95b=['index','put','/:id','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xd95b,0x13c));var _0xbd95=function(_0x3f4eee,_0x19f87e){_0x3f4eee=_0x3f4eee-0x0;var _0x590dc9=_0xd95b[_0x3f4eee];return _0x590dc9;};'use strict';var multer=require(_0xbd95('0x0'));var util=require('util');var path=require(_0xbd95('0x1'));var timeout=require(_0xbd95('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd95('0x3'));var auth=require(_0xbd95('0x4'));var interaction=require(_0xbd95('0x5'));var config=require(_0xbd95('0x6'));var controller=require(_0xbd95('0x7'));router[_0xbd95('0x8')]('/',controller[_0xbd95('0x9')]);router[_0xbd95('0xa')](_0xbd95('0xb'),auth['isAuthenticated'](),controller['update']);module[_0xbd95('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 93c4066..0bdf9a6 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 _0x5fc3=['sequelize','exports','STRING','INTEGER'];(function(_0x5a8628,_0x3c3a74){var _0x36e8c9=function(_0x548467){while(--_0x548467){_0x5a8628['push'](_0x5a8628['shift']());}};_0x36e8c9(++_0x3c3a74);}(_0x5fc3,0xa8));var _0x35fc=function(_0x200aa5,_0x197802){_0x200aa5=_0x200aa5-0x0;var _0x458200=_0x5fc3[_0x200aa5];return _0x458200;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x35fc('0x2')]},'data2':{'type':Sequelize[_0x35fc('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x524e=['STRING','INTEGER','TEXT'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0x524e,0x15e));var _0xe524=function(_0x2bef45,_0x2432ba){_0x2bef45=_0x2bef45-0x0;var _0x263901=_0x524e[_0x2bef45];return _0x263901;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0xe524('0x0')]},'data1':{'type':Sequelize[_0xe524('0x1')]},'data2':{'type':Sequelize[_0xe524('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xe524('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 4cd9de4..b934a76 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 _0x33d2=['render','merge','contact','message','agent','model','keys','query','filters','intersection','attributes','fields','options','getLicense','catch','body','License','params','checkLicense','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name'];(function(_0x3f2a76,_0x265891){var _0x270142=function(_0x4c021b){while(--_0x4c021b){_0x3f2a76['push'](_0x3f2a76['shift']());}};_0x270142(++_0x265891);}(_0x33d2,0x1d3));var _0x233d=function(_0x58da8a,_0x1c0584){_0x58da8a=_0x58da8a-0x0;var _0x5ba3a3=_0x33d2[_0x58da8a];return _0x5ba3a3;};'use strict';var emlformat=require(_0x233d('0x0'));var rimraf=require(_0x233d('0x1'));var zipdir=require(_0x233d('0x2'));var jsonpatch=require(_0x233d('0x3'));var rp=require(_0x233d('0x4'));var moment=require(_0x233d('0x5'));var BPromise=require(_0x233d('0x6'));var Mustache=require(_0x233d('0x7'));var util=require(_0x233d('0x8'));var path=require(_0x233d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x233d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x233d('0xb'));var squel=require(_0x233d('0xc'));var crypto=require(_0x233d('0xd'));var jsforce=require(_0x233d('0xe'));var deskjs=require(_0x233d('0xf'));var toCsv=require(_0x233d('0x10'));var querystring=require(_0x233d('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x233d('0x12'));var qs=require(_0x233d('0x13'));var as=require(_0x233d('0x14'));var hardwareService=require(_0x233d('0x15'));var logger=require(_0x233d('0x16'))('api');var utils=require(_0x233d('0x17'));var config=require(_0x233d('0x18'));var licenseUtil=require(_0x233d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10cdbe,_0x406627){_0x406627=_0x406627||0xcc;return function(_0x45c723){if(_0x45c723){return _0x10cdbe[_0x233d('0x1a')](_0x406627);}return _0x10cdbe[_0x233d('0x1b')](_0x406627)[_0x233d('0x1c')]();};}function respondWithResult(_0x56d474,_0x1188d3){_0x1188d3=_0x1188d3||0xc8;return function(_0x2c9ef8){if(_0x2c9ef8){return _0x56d474[_0x233d('0x1b')](_0x1188d3)['json'](_0x2c9ef8);}};}function respondWithFilteredResult(_0x1af3ab,_0x591e94){return function(_0x34ecd4){if(_0x34ecd4){var _0x5f2b1e=typeof _0x591e94[_0x233d('0x1d')]===_0x233d('0x1e')&&typeof _0x591e94[_0x233d('0x1f')]===_0x233d('0x1e');var _0x244754=_0x34ecd4[_0x233d('0x20')];var _0x140b86=_0x5f2b1e?0x0:_0x591e94[_0x233d('0x1d')];var _0x17fe3b=_0x5f2b1e?_0x34ecd4[_0x233d('0x20')]:_0x591e94[_0x233d('0x1d')]+_0x591e94[_0x233d('0x1f')];var _0x1c8ebc;if(_0x17fe3b>=_0x244754){_0x17fe3b=_0x244754;_0x1c8ebc=0xc8;}else{_0x1c8ebc=0xce;}_0x1af3ab[_0x233d('0x1b')](_0x1c8ebc);return _0x1af3ab[_0x233d('0x21')](_0x233d('0x22'),_0x140b86+'-'+_0x17fe3b+'/'+_0x244754)[_0x233d('0x23')](_0x34ecd4);}return null;};}function patchUpdates(_0x4223dc){return function(_0x440a24){try{jsonpatch[_0x233d('0x24')](_0x440a24,_0x4223dc,!![]);}catch(_0x2613e3){return BPromise[_0x233d('0x25')](_0x2613e3);}return _0x440a24[_0x233d('0x26')]();};}function saveUpdates(_0x4d8b69,_0x29463b){return function(_0x3fd489){if(_0x3fd489){return _0x3fd489[_0x233d('0x27')](_0x4d8b69)['then'](function(_0x19d492){return _0x19d492;});}return null;};}function removeEntity(_0x3d8d2e,_0x33581a){return function(_0x388a0c){if(_0x388a0c){return _0x388a0c[_0x233d('0x28')]()[_0x233d('0x29')](function(){_0x3d8d2e[_0x233d('0x1b')](0xcc)[_0x233d('0x1c')]();});}};}function handleEntityNotFound(_0x4947d0,_0x539ca6){return function(_0x1b1df){if(!_0x1b1df){_0x4947d0[_0x233d('0x1a')](0x194);}return _0x1b1df;};}function handleError(_0xc3b268,_0x377b9c){_0x377b9c=_0x377b9c||0x1f4;return function(_0x30614d){logger[_0x233d('0x2a')](_0x30614d[_0x233d('0x2b')]);if(_0x30614d[_0x233d('0x2c')]){delete _0x30614d[_0x233d('0x2c')];}_0xc3b268[_0x233d('0x1b')](_0x377b9c)['send'](_0x30614d);};}function getMustacheRender(_0x34e383,_0x447a8d){return Mustache[_0x233d('0x2d')](_0x34e383,_[_0x233d('0x2e')](_0x447a8d['body'],{'contact':_0x447a8d[_0x233d('0x2f')],'message':_0x447a8d[_0x233d('0x30')],'agent':_0x447a8d[_0x233d('0x31')],'interaction':_0x447a8d['interaction'],'account':_0x447a8d['account']}))||'';}var utilLicense=require(_0x233d('0x19'));exports['index']=function(_0x3e5847,_0x74705e){var _0x489f71={'raw':!![],'where':{'id':0x1}},_0x1de452={};_0x1de452[_0x233d('0x32')]=_[_0x233d('0x33')](db['License']['rawAttributes']);_0x1de452[_0x233d('0x34')]=_[_0x233d('0x33')](_0x3e5847[_0x233d('0x34')]);_0x1de452[_0x233d('0x35')]=_[_0x233d('0x36')](_0x1de452['model'],_0x1de452['query']);_0x489f71[_0x233d('0x37')]=_[_0x233d('0x36')](_0x1de452[_0x233d('0x32')],qs[_0x233d('0x38')](_0x3e5847[_0x233d('0x34')][_0x233d('0x38')]));_0x489f71[_0x233d('0x37')]=_0x489f71[_0x233d('0x37')]['length']?_0x489f71[_0x233d('0x37')]:_0x1de452[_0x233d('0x32')];_0x489f71=_['merge']({},_0x489f71,_0x3e5847[_0x233d('0x39')]);return utilLicense[_0x233d('0x3a')](_0x489f71)[_0x233d('0x29')](respondWithResult(_0x74705e,null))[_0x233d('0x3b')](handleError(_0x74705e,null));};exports['update']=function(_0x395c6e,_0x1098c8){if(_0x395c6e[_0x233d('0x3c')]['id']){delete _0x395c6e[_0x233d('0x3c')]['id'];}return db[_0x233d('0x3d')]['find']({'where':{'id':_0x395c6e[_0x233d('0x3e')]['id']}})[_0x233d('0x29')](handleEntityNotFound(_0x1098c8,null))['then'](function(_0x58c85a){var _0x956e0c=_0x58c85a['get']({'plain':!![]});return utilLicense[_0x233d('0x3f')](_0x956e0c,_0x395c6e[_0x233d('0x3c')]['key']);})['then'](function(_0x1f2635){if(!_0x1f2635['demo']){return saveUpdates(_0x395c6e[_0x233d('0x3c')],null);}return _0x1f2635;})['then'](respondWithResult(_0x1098c8,null))[_0x233d('0x3b')](handleError(_0x1098c8,null));}; \ No newline at end of file +var _0xc29d=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','stack','name','send','merge','body','contact','message','interaction','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','getLicense','update','params','checkLicense','key','demo','catch'];(function(_0x107578,_0x191c1f){var _0x5013f5=function(_0x57bf7e){while(--_0x57bf7e){_0x107578['push'](_0x107578['shift']());}};_0x5013f5(++_0x191c1f);}(_0xc29d,0xb7));var _0xdc29=function(_0x3e8f10,_0x568521){_0x3e8f10=_0x3e8f10-0x0;var _0x30813a=_0xc29d[_0x3e8f10];return _0x30813a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc29('0x0'));var zipdir=require(_0xdc29('0x1'));var jsonpatch=require(_0xdc29('0x2'));var rp=require(_0xdc29('0x3'));var moment=require(_0xdc29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdc29('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdc29('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc29('0x7'));var _=require(_0xdc29('0x8'));var squel=require('squel');var crypto=require(_0xdc29('0x9'));var jsforce=require(_0xdc29('0xa'));var deskjs=require(_0xdc29('0xb'));var toCsv=require(_0xdc29('0xc'));var querystring=require(_0xdc29('0xd'));var Papa=require(_0xdc29('0xe'));var Redis=require(_0xdc29('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc29('0x10'));var logger=require('../../config/logger')(_0xdc29('0x11'));var utils=require(_0xdc29('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xdc29('0x13'));var db=require(_0xdc29('0x14'))['db'];function respondWithStatusCode(_0x50c3ac,_0x3249fc){_0x3249fc=_0x3249fc||0xcc;return function(_0x33bf3d){if(_0x33bf3d){return _0x50c3ac[_0xdc29('0x15')](_0x3249fc);}return _0x50c3ac['status'](_0x3249fc)[_0xdc29('0x16')]();};}function respondWithResult(_0x380005,_0xcc29a8){_0xcc29a8=_0xcc29a8||0xc8;return function(_0x4d2810){if(_0x4d2810){return _0x380005[_0xdc29('0x17')](_0xcc29a8)[_0xdc29('0x18')](_0x4d2810);}};}function respondWithFilteredResult(_0x25d553,_0x5868c5){return function(_0x4ee85a){if(_0x4ee85a){var _0x471147=typeof _0x5868c5[_0xdc29('0x19')]===_0xdc29('0x1a')&&typeof _0x5868c5['limit']===_0xdc29('0x1a');var _0x1cff3d=_0x4ee85a[_0xdc29('0x1b')];var _0x15451b=_0x471147?0x0:_0x5868c5['offset'];var _0x40c827=_0x471147?_0x4ee85a[_0xdc29('0x1b')]:_0x5868c5[_0xdc29('0x19')]+_0x5868c5[_0xdc29('0x1c')];var _0x85e036;if(_0x40c827>=_0x1cff3d){_0x40c827=_0x1cff3d;_0x85e036=0xc8;}else{_0x85e036=0xce;}_0x25d553['status'](_0x85e036);return _0x25d553[_0xdc29('0x1d')]('Content-Range',_0x15451b+'-'+_0x40c827+'/'+_0x1cff3d)[_0xdc29('0x18')](_0x4ee85a);}return null;};}function patchUpdates(_0xbb8606){return function(_0x2bd8be){try{jsonpatch[_0xdc29('0x1e')](_0x2bd8be,_0xbb8606,!![]);}catch(_0x59d027){return BPromise[_0xdc29('0x1f')](_0x59d027);}return _0x2bd8be[_0xdc29('0x20')]();};}function saveUpdates(_0x2ac980,_0x591472){return function(_0x1bd702){if(_0x1bd702){return _0x1bd702['update'](_0x2ac980)[_0xdc29('0x21')](function(_0x320770){return _0x320770;});}return null;};}function removeEntity(_0x465d67,_0x16ffad){return function(_0x31af67){if(_0x31af67){return _0x31af67[_0xdc29('0x22')]()[_0xdc29('0x21')](function(){_0x465d67[_0xdc29('0x17')](0xcc)[_0xdc29('0x16')]();});}};}function handleEntityNotFound(_0x3f405b,_0x32131c){return function(_0x4f7a15){if(!_0x4f7a15){_0x3f405b['sendStatus'](0x194);}return _0x4f7a15;};}function handleError(_0x20eca0,_0x2985b1){_0x2985b1=_0x2985b1||0x1f4;return function(_0x5e2d63){logger[_0xdc29('0x23')](_0x5e2d63[_0xdc29('0x24')]);if(_0x5e2d63[_0xdc29('0x25')]){delete _0x5e2d63[_0xdc29('0x25')];}_0x20eca0[_0xdc29('0x17')](_0x2985b1)[_0xdc29('0x26')](_0x5e2d63);};}function getMustacheRender(_0x5150fb,_0x3749d6){return Mustache['render'](_0x5150fb,_[_0xdc29('0x27')](_0x3749d6[_0xdc29('0x28')],{'contact':_0x3749d6[_0xdc29('0x29')],'message':_0x3749d6[_0xdc29('0x2a')],'agent':_0x3749d6['agent'],'interaction':_0x3749d6[_0xdc29('0x2b')],'account':_0x3749d6['account']}))||'';}var utilLicense=require('../../config/license/util');exports['index']=function(_0x5385a4,_0x3f6858){var _0x370593={'raw':!![],'where':{'id':0x1}},_0x299d59={};_0x299d59[_0xdc29('0x2c')]=_[_0xdc29('0x2d')](db['License'][_0xdc29('0x2e')]);_0x299d59['query']=_[_0xdc29('0x2d')](_0x5385a4[_0xdc29('0x2f')]);_0x299d59[_0xdc29('0x30')]=_[_0xdc29('0x31')](_0x299d59['model'],_0x299d59[_0xdc29('0x2f')]);_0x370593[_0xdc29('0x32')]=_[_0xdc29('0x31')](_0x299d59[_0xdc29('0x2c')],qs['fields'](_0x5385a4[_0xdc29('0x2f')][_0xdc29('0x33')]));_0x370593[_0xdc29('0x32')]=_0x370593[_0xdc29('0x32')][_0xdc29('0x34')]?_0x370593['attributes']:_0x299d59[_0xdc29('0x2c')];_0x370593=_[_0xdc29('0x27')]({},_0x370593,_0x5385a4[_0xdc29('0x35')]);return utilLicense[_0xdc29('0x36')](_0x370593)[_0xdc29('0x21')](respondWithResult(_0x3f6858,null))['catch'](handleError(_0x3f6858,null));};exports[_0xdc29('0x37')]=function(_0x4431a2,_0x5dc466){if(_0x4431a2[_0xdc29('0x28')]['id']){delete _0x4431a2[_0xdc29('0x28')]['id'];}return db['License']['find']({'where':{'id':_0x4431a2[_0xdc29('0x38')]['id']}})['then'](handleEntityNotFound(_0x5dc466,null))[_0xdc29('0x21')](function(_0x12337c){var _0x1a906b=_0x12337c['get']({'plain':!![]});return utilLicense[_0xdc29('0x39')](_0x1a906b,_0x4431a2['body'][_0xdc29('0x3a')]);})[_0xdc29('0x21')](function(_0x3d0d6d){if(!_0x3d0d6d[_0xdc29('0x3b')]){return saveUpdates(_0x4431a2[_0xdc29('0x28')],null);}return _0x3d0d6d;})[_0xdc29('0x21')](respondWithResult(_0x5dc466,null))[_0xdc29('0x3c')](handleError(_0x5dc466,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index a04dc69..bec7580 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 _0x385a=['../../config/environment','define','License','license','util','../../config/logger','api','moment','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x385a,0xa4));var _0xa385=function(_0x4e880e,_0x25c4f8){_0x4e880e=_0x4e880e-0x0;var _0x3f6005=_0x385a[_0x4e880e];return _0x3f6005;};'use strict';var _=require('lodash');var util=require(_0xa385('0x0'));var logger=require(_0xa385('0x1'))(_0xa385('0x2'));var moment=require(_0xa385('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa385('0x4'));var rimraf=require(_0xa385('0x5'));var config=require(_0xa385('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x4da2d5,_0x3e4c26){return _0x4da2d5[_0xa385('0x7')](_0xa385('0x8'),attributes,{'tableName':_0xa385('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb85=['exports','License','license','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xbb85,0x92));var _0x5bb8=function(_0xe1ac66,_0x199e1d){_0xe1ac66=_0xe1ac66-0x0;var _0x4a2f94=_0xbb85[_0xe1ac66];return _0x4a2f94;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 89881b0..f9d6966 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 _0x8130=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s'];(function(_0x985cf2,_0x7edfd0){var _0x278eb5=function(_0x5d8ef5){while(--_0x5d8ef5){_0x985cf2['push'](_0x985cf2['shift']());}};_0x278eb5(++_0x7edfd0);}(_0x8130,0x146));var _0x0813=function(_0x8e4cbb,_0x5ccf8a){_0x8e4cbb=_0x8e4cbb-0x0;var _0xdc6160=_0x8130[_0x8e4cbb];return _0xdc6160;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var moment=require('moment');var BPromise=require(_0x0813('0x2'));var rs=require(_0x0813('0x3'));var fs=require('fs');var Redis=require(_0x0813('0x4'));var db=require(_0x0813('0x5'))['db'];var utils=require(_0x0813('0x6'));var logger=require(_0x0813('0x7'))('rpc');var config=require(_0x0813('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0813('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2df45a,_0x2bbdfd,_0x19a508){return new BPromise(function(_0x2ab8f0,_0x115a90){return client[_0x0813('0xa')](_0x2df45a,_0x19a508)['then'](function(_0x44ec2c){logger[_0x0813('0xb')](_0x0813('0xc'),_0x2bbdfd,'request\x20sent');logger['debug'](_0x0813('0xd'),_0x2bbdfd,'request\x20sent',JSON[_0x0813('0xe')](_0x44ec2c));if(_0x44ec2c['error']){if(_0x44ec2c[_0x0813('0xf')][_0x0813('0x10')]===0x1f4){logger[_0x0813('0xf')](_0x0813('0xc'),_0x2bbdfd,_0x44ec2c['error']['message']);return _0x115a90(_0x44ec2c[_0x0813('0xf')][_0x0813('0x11')]);}logger['error'](_0x0813('0xc'),_0x2bbdfd,_0x44ec2c['error']['message']);return _0x2ab8f0(_0x44ec2c[_0x0813('0xf')][_0x0813('0x11')]);}else{logger['info'](_0x0813('0xc'),_0x2bbdfd,'request\x20sent');_0x2ab8f0(_0x44ec2c[_0x0813('0x12')][_0x0813('0x11')]);}})[_0x0813('0x13')](function(_0xee126d){logger[_0x0813('0xf')](_0x0813('0xc'),_0x2bbdfd,_0xee126d);_0x115a90(_0xee126d);});});} \ No newline at end of file +var _0x9a62=['../../config/environment','jayson/promise','client','http','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9a62,0x1bc));var _0x29a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9a62[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x29a6('0x0'));var moment=require(_0x29a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x29a6('0x2'));var fs=require('fs');var Redis=require(_0x29a6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29a6('0x4'))(_0x29a6('0x5'));var config=require(_0x29a6('0x6'));var jayson=require(_0x29a6('0x7'));var client=jayson[_0x29a6('0x8')][_0x29a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x316d9e,_0x4a1ea8,_0x5b325a){return new BPromise(function(_0x72dde2,_0x2e1272){return client['request'](_0x316d9e,_0x5b325a)['then'](function(_0x437647){logger[_0x29a6('0xa')](_0x29a6('0xb'),_0x4a1ea8,_0x29a6('0xc'));logger[_0x29a6('0xd')](_0x29a6('0xe'),_0x4a1ea8,_0x29a6('0xc'),JSON['stringify'](_0x437647));if(_0x437647[_0x29a6('0xf')]){if(_0x437647[_0x29a6('0xf')]['code']===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x4a1ea8,_0x437647[_0x29a6('0xf')][_0x29a6('0x10')]);return _0x2e1272(_0x437647['error'][_0x29a6('0x10')]);}logger[_0x29a6('0xf')]('License,\x20%s,\x20%s',_0x4a1ea8,_0x437647['error'][_0x29a6('0x10')]);return _0x72dde2(_0x437647[_0x29a6('0xf')]['message']);}else{logger[_0x29a6('0xa')](_0x29a6('0xb'),_0x4a1ea8,_0x29a6('0xc'));_0x72dde2(_0x437647['result'][_0x29a6('0x10')]);}})[_0x29a6('0x11')](function(_0x695718){logger[_0x29a6('0xf')](_0x29a6('0xb'),_0x4a1ea8,_0x695718);_0x2e1272(_0x695718);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 80f0e56..525b04b 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 _0x28a3=['getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions'];(function(_0x1530bf,_0x14bd16){var _0x1da684=function(_0x380f93){while(--_0x380f93){_0x1530bf['push'](_0x1530bf['shift']());}};_0x1da684(++_0x14bd16);}(_0x28a3,0x79));var _0x328a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x28a3[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x328a('0x0'));var util=require(_0x328a('0x1'));var path=require(_0x328a('0x2'));var timeout=require(_0x328a('0x3'));var express=require(_0x328a('0x4'));var router=express[_0x328a('0x5')]();var fs_extra=require(_0x328a('0x6'));var auth=require(_0x328a('0x7'));var interaction=require(_0x328a('0x8'));var config=require(_0x328a('0x9'));var controller=require(_0x328a('0xa'));router['get']('/',auth[_0x328a('0xb')](),controller[_0x328a('0xc')]);router[_0x328a('0xd')](_0x328a('0xe'),auth[_0x328a('0xb')](),controller[_0x328a('0xf')]);router['get']('/:id',auth[_0x328a('0xb')](),controller[_0x328a('0x10')]);router[_0x328a('0xd')](_0x328a('0x11'),auth[_0x328a('0xb')](),controller[_0x328a('0x12')]);router[_0x328a('0xd')](_0x328a('0x13'),auth[_0x328a('0xb')](),controller[_0x328a('0x14')]);router['get'](_0x328a('0x15'),auth[_0x328a('0xb')](),controller[_0x328a('0x16')]);router[_0x328a('0xd')](_0x328a('0x17'),auth['isAuthenticated'](),controller[_0x328a('0x18')]);router[_0x328a('0xd')](_0x328a('0x19'),auth['isAuthenticated'](),controller[_0x328a('0x1a')]);router[_0x328a('0xd')](_0x328a('0x1b'),auth[_0x328a('0xb')](),controller['getApplications']);router[_0x328a('0xd')](_0x328a('0x1c'),auth['isAuthenticated'](),controller[_0x328a('0x1d')]);router[_0x328a('0xd')](_0x328a('0x1e'),auth[_0x328a('0xb')](),controller[_0x328a('0x1f')]);router[_0x328a('0xd')](_0x328a('0x20'),auth[_0x328a('0xb')](),controller[_0x328a('0x21')]);router[_0x328a('0x22')]('/:id/dispositions',auth[_0x328a('0xb')](),controller[_0x328a('0x23')]);router['post'](_0x328a('0x13'),auth[_0x328a('0xb')](),controller[_0x328a('0x24')]);router[_0x328a('0x22')]('/',auth[_0x328a('0xb')](),controller[_0x328a('0x25')]);router[_0x328a('0x22')](_0x328a('0x15'),auth[_0x328a('0xb')](),controller[_0x328a('0x26')]);router[_0x328a('0x22')]('/:id/out_servers',auth[_0x328a('0xb')](),controller[_0x328a('0x27')]);router[_0x328a('0x22')](_0x328a('0x19'),auth[_0x328a('0xb')](),controller['addInteraction']);router[_0x328a('0x22')](_0x328a('0x1b'),auth[_0x328a('0xb')](),controller['addApplications']);router['post'](_0x328a('0x28'),auth[_0x328a('0xb')](),controller[_0x328a('0x29')]);router[_0x328a('0x22')](_0x328a('0x20'),auth[_0x328a('0xb')](),controller['addAgents']);router[_0x328a('0x2a')]('/:id',auth[_0x328a('0xb')](),controller[_0x328a('0x2b')]);router[_0x328a('0x2c')](_0x328a('0x11'),auth[_0x328a('0xb')](),controller[_0x328a('0x2d')]);router['delete'](_0x328a('0x13'),auth[_0x328a('0xb')](),controller[_0x328a('0x2e')]);router['delete'](_0x328a('0x15'),auth[_0x328a('0xb')](),controller['removeImap']);router[_0x328a('0x2c')](_0x328a('0x17'),auth[_0x328a('0xb')](),controller['removeSmtp']);router[_0x328a('0x2c')](_0x328a('0x2f'),auth['isAuthenticated'](),controller['destroy']);router[_0x328a('0x2c')](_0x328a('0x20'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x328a('0x30')]=router; \ No newline at end of file +var _0x1e3b=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','delete','removeAnswers','removeImap','/:id/out_servers','destroy','removeAgents','exports'];(function(_0x1bec9a,_0x54c8dd){var _0x146b22=function(_0x27a6cf){while(--_0x27a6cf){_0x1bec9a['push'](_0x1bec9a['shift']());}};_0x146b22(++_0x54c8dd);}(_0x1e3b,0xc0));var _0xb1e3=function(_0x3734fb,_0x5c54c9){_0x3734fb=_0x3734fb-0x0;var _0x42e609=_0x1e3b[_0x3734fb];return _0x42e609;};'use strict';var multer=require('multer');var util=require(_0xb1e3('0x0'));var path=require(_0xb1e3('0x1'));var timeout=require(_0xb1e3('0x2'));var express=require('express');var router=express[_0xb1e3('0x3')]();var fs_extra=require(_0xb1e3('0x4'));var auth=require(_0xb1e3('0x5'));var interaction=require(_0xb1e3('0x6'));var config=require(_0xb1e3('0x7'));var controller=require(_0xb1e3('0x8'));router[_0xb1e3('0x9')]('/',auth['isAuthenticated'](),controller[_0xb1e3('0xa')]);router[_0xb1e3('0x9')](_0xb1e3('0xb'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0xd')]);router['get'](_0xb1e3('0xe'),auth[_0xb1e3('0xc')](),controller['show']);router[_0xb1e3('0x9')](_0xb1e3('0xf'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x10')]);router['get'](_0xb1e3('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xb1e3('0x9')](_0xb1e3('0x12'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x13')]);router[_0xb1e3('0x9')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router[_0xb1e3('0x9')]('/:id/interactions',auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x14')]);router[_0xb1e3('0x9')](_0xb1e3('0x15'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x16')]);router[_0xb1e3('0x9')]('/:id/messages',auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x17')]);router[_0xb1e3('0x9')](_0xb1e3('0x18'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x19')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xb1e3('0x1a')]);router[_0xb1e3('0x1b')](_0xb1e3('0xf'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x1c')]);router[_0xb1e3('0x1b')]('/:id/canned_answers',auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x1d')]);router[_0xb1e3('0x1b')]('/',auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x1e')]);router['post'](_0xb1e3('0x12'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x1f')]);router[_0xb1e3('0x1b')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xb1e3('0x20')]);router[_0xb1e3('0x1b')](_0xb1e3('0x21'),auth['isAuthenticated'](),controller[_0xb1e3('0x22')]);router[_0xb1e3('0x1b')](_0xb1e3('0x15'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x23')]);router[_0xb1e3('0x1b')](_0xb1e3('0x24'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x25')]);router[_0xb1e3('0x1b')](_0xb1e3('0x26'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x27')]);router[_0xb1e3('0x28')](_0xb1e3('0xe'),auth[_0xb1e3('0xc')](),controller['update']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xb1e3('0x29')]('/:id/canned_answers',auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x2a')]);router['delete'](_0xb1e3('0x12'),auth['isAuthenticated'](),controller[_0xb1e3('0x2b')]);router[_0xb1e3('0x29')](_0xb1e3('0x2c'),auth[_0xb1e3('0xc')](),controller['removeSmtp']);router[_0xb1e3('0x29')](_0xb1e3('0xe'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x2d')]);router['delete'](_0xb1e3('0x26'),auth[_0xb1e3('0xc')](),controller[_0xb1e3('0x2e')]);module[_0xb1e3('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 5d04595..53ea5f6 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 _0x20f9=['BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','STRING'];(function(_0x48a2c2,_0x22daf7){var _0x140663=function(_0x2d7aaa){while(--_0x2d7aaa){_0x48a2c2['push'](_0x48a2c2['shift']());}};_0x140663(++_0x22daf7);}(_0x20f9,0x1b6));var _0x920f=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x20f9[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0x920f('0x0'));module['exports']={'description':{'type':Sequelize[_0x920f('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x920f('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x920f('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x920f('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x920f('0x4')](0x2)[_0x920f('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x920f('0x6');}},'notificationSound':{'type':Sequelize[_0x920f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x920f('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x920f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x920f('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x920f('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x920f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x920f('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x920f('0x2')],'defaultValue':![],'comment':_0x920f('0x7'),'set':function(_0x1be17e){if(!_0x1be17e)this['setDataValue'](_0x920f('0x8'),null);this[_0x920f('0x9')]('mandatoryDisposition',_0x1be17e);}}}; \ No newline at end of file +var _0xdada=['UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER'];(function(_0x512ac5,_0x11a03c){var _0x48c045=function(_0x513b48){while(--_0x513b48){_0x512ac5['push'](_0x512ac5['shift']());}};_0x48c045(++_0x11a03c);}(_0xdada,0xf6));var _0xadad=function(_0x4fa36a,_0x4d8713){_0x4fa36a=_0x4fa36a-0x0;var _0x57e4a7=_0xdada[_0x4fa36a];return _0x57e4a7;};'use strict';var Sequelize=require(_0xadad('0x0'));module[_0xadad('0x1')]={'description':{'type':Sequelize[_0xadad('0x2')]},'name':{'type':Sequelize[_0xadad('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xadad('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xadad('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xadad('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xadad('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xadad('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xadad('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xadad('0x5')](0x2)[_0xadad('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xadad('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xadad('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xadad('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xadad('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xadad('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xadad('0x8'),'set':function(_0x17409d){if(!_0x17409d)this['setDataValue'](_0xadad('0x9'),null);this[_0xadad('0xa')](_0xadad('0xb'),_0x17409d);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 32c866a..0c3a34f 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 _0x3d3c=['account','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','keys','intersection','model','attributes','fields','query','length','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','options','includeAll','include','rows','show','Pause','find','body','describe','params','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','email','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','send','List','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','sendMail','ListId','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','addAgents','spread','emit','isArray','userMailAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','html-to-text','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','register','jayson/promise','http','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','render','merge','contact','interaction'];(function(_0x4ee3e1,_0x5aa0d4){var _0x567a64=function(_0x3056fb){while(--_0x3056fb){_0x4ee3e1['push'](_0x4ee3e1['shift']());}};_0x567a64(++_0x5aa0d4);}(_0x3d3c,0x8a));var _0xc3d3=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x3d3c[_0x29b609];return _0x54c952;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3d3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc3d3('0x1'));var rp=require(_0xc3d3('0x2'));var moment=require(_0xc3d3('0x3'));var BPromise=require(_0xc3d3('0x4'));var Mustache=require(_0xc3d3('0x5'));var util=require(_0xc3d3('0x6'));var path=require(_0xc3d3('0x7'));var sox=require(_0xc3d3('0x8'));var csv=require('to-csv');var ejs=require(_0xc3d3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3d3('0xa'));var squel=require(_0xc3d3('0xb'));var crypto=require(_0xc3d3('0xc'));var jsforce=require(_0xc3d3('0xd'));var deskjs=require(_0xc3d3('0xe'));var toCsv=require(_0xc3d3('0xf'));var querystring=require('querystring');var Papa=require(_0xc3d3('0x10'));var htmlToText=require(_0xc3d3('0x11'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0xc3d3('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3d3('0x13'));var logger=require(_0xc3d3('0x14'))(_0xc3d3('0x15'));var utils=require(_0xc3d3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc3d3('0x17'));var db=require(_0xc3d3('0x18'))['db'];config['redis']=_[_0xc3d3('0x19')](config['redis'],{'host':_0xc3d3('0x1a'),'port':0x18eb});var socket=require(_0xc3d3('0x1b'))(new Redis(config[_0xc3d3('0x1c')]));require(_0xc3d3('0x1d'))[_0xc3d3('0x1e')](socket);var jayson=require(_0xc3d3('0x1f'));var client=jayson['client'][_0xc3d3('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x1354fd,_0x330e7a,_0x5efd4a,_0x7a541d){return new BPromise(function(_0x26aa55,_0x50e5d3){var _0xf20197=_0x7a541d||client;return _0xf20197['request'](_0x1354fd,_0x5efd4a)[_0xc3d3('0x21')](function(_0x3295dc){logger[_0xc3d3('0x22')](_0xc3d3('0x23'),_0x330e7a,'request\x20sent');logger[_0xc3d3('0x24')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x330e7a,_0xc3d3('0x25'),JSON[_0xc3d3('0x26')](_0x3295dc));if(_0x3295dc[_0xc3d3('0x27')]){if(_0x3295dc[_0xc3d3('0x27')][_0xc3d3('0x28')]===0x1f4){logger[_0xc3d3('0x27')](_0xc3d3('0x23'),_0x330e7a,_0x3295dc[_0xc3d3('0x27')][_0xc3d3('0x29')]);return _0x50e5d3(_0x3295dc['error']['message']);}logger[_0xc3d3('0x27')](_0xc3d3('0x23'),_0x330e7a,_0x3295dc['error']['message']);return _0x26aa55(_0x3295dc[_0xc3d3('0x27')][_0xc3d3('0x29')]);}else{logger[_0xc3d3('0x22')](_0xc3d3('0x23'),_0x330e7a,_0xc3d3('0x25'));_0x26aa55(_0x3295dc[_0xc3d3('0x2a')]['message']);}})[_0xc3d3('0x2b')](function(_0x2eb76e){logger[_0xc3d3('0x27')](_0xc3d3('0x23'),_0x330e7a,_0x2eb76e);_0x50e5d3(_0x2eb76e);});});}function respondWithStatusCode(_0x99f436,_0x364c2f){_0x364c2f=_0x364c2f||0xcc;return function(_0x52848f){if(_0x52848f){return _0x99f436[_0xc3d3('0x2c')](_0x364c2f);}return _0x99f436[_0xc3d3('0x2d')](_0x364c2f)[_0xc3d3('0x2e')]();};}function respondWithResult(_0xb76da6,_0x569578){_0x569578=_0x569578||0xc8;return function(_0x3a5768){if(_0x3a5768){return _0xb76da6['status'](_0x569578)[_0xc3d3('0x2f')](_0x3a5768);}};}function respondWithFilteredResult(_0x297a47,_0x4b1244){return function(_0x26df6d){if(_0x26df6d){var _0x397035=typeof _0x4b1244[_0xc3d3('0x30')]===_0xc3d3('0x31')&&typeof _0x4b1244[_0xc3d3('0x32')]===_0xc3d3('0x31');var _0x1542b1=_0x26df6d[_0xc3d3('0x33')];var _0x546520=_0x397035?0x0:_0x4b1244[_0xc3d3('0x30')];var _0x58ec32=_0x397035?_0x26df6d[_0xc3d3('0x33')]:_0x4b1244[_0xc3d3('0x30')]+_0x4b1244[_0xc3d3('0x32')];var _0x4cb13d;if(_0x58ec32>=_0x1542b1){_0x58ec32=_0x1542b1;_0x4cb13d=0xc8;}else{_0x4cb13d=0xce;}_0x297a47[_0xc3d3('0x2d')](_0x4cb13d);return _0x297a47[_0xc3d3('0x34')](_0xc3d3('0x35'),_0x546520+'-'+_0x58ec32+'/'+_0x1542b1)[_0xc3d3('0x2f')](_0x26df6d);}return null;};}function patchUpdates(_0x375620){return function(_0x252ffb){try{jsonpatch['apply'](_0x252ffb,_0x375620,!![]);}catch(_0x3f4ac3){return BPromise[_0xc3d3('0x36')](_0x3f4ac3);}return _0x252ffb[_0xc3d3('0x37')]();};}function saveUpdates(_0x131661,_0x2010ee){return function(_0x219424){if(_0x219424){return _0x219424[_0xc3d3('0x38')](_0x131661)['then'](function(_0x4a9b19){return _0x4a9b19;});}return null;};}function removeEntity(_0x1da8b4,_0x32cb80){return function(_0x160923){if(_0x160923){return _0x160923[_0xc3d3('0x39')]()[_0xc3d3('0x21')](function(){var _0xb81205=_0x160923[_0xc3d3('0x3a')]({'plain':!![]});var _0xfbac44=_0xc3d3('0x3b');return db[_0xc3d3('0x3c')][_0xc3d3('0x39')]({'where':{'type':_0xfbac44,'resourceId':_0xb81205['id']}})[_0xc3d3('0x21')](function(){return _0x160923;});})[_0xc3d3('0x21')](function(){_0x1da8b4['status'](0xcc)[_0xc3d3('0x2e')]();});}};}function handleEntityNotFound(_0x3c398d,_0x400abe){return function(_0x34878d){if(!_0x34878d){_0x3c398d['sendStatus'](0x194);}return _0x34878d;};}function handleError(_0xbfc196,_0x30a6a4){_0x30a6a4=_0x30a6a4||0x1f4;return function(_0x2ea828){logger['error'](_0x2ea828[_0xc3d3('0x3d')]);if(_0x2ea828['name']){delete _0x2ea828[_0xc3d3('0x3e')];}_0xbfc196[_0xc3d3('0x2d')](_0x30a6a4)['send'](_0x2ea828);};}function getMustacheRender(_0x23fa64,_0x41837c){return Mustache[_0xc3d3('0x3f')](_0x23fa64,_[_0xc3d3('0x40')](_0x41837c['body'],{'contact':_0x41837c[_0xc3d3('0x41')],'message':_0x41837c[_0xc3d3('0x29')],'agent':_0x41837c['agent'],'interaction':_0x41837c[_0xc3d3('0x42')],'account':_0x41837c[_0xc3d3('0x43')]}))||'';}exports[_0xc3d3('0x44')]=function(_0x480b9f,_0x16e9d1){var _0x483f81={'include':[{'model':db[_0xc3d3('0x45')],'as':_0xc3d3('0x46')},{'model':db[_0xc3d3('0x47')],'as':_0xc3d3('0x48')},{'model':db['Pause'],'as':_0xc3d3('0x49')}]},_0x5d9a39={},_0x1bfa52={'count':0x0,'rows':[]};var _0x5a36d2=_[_0xc3d3('0x4a')](db[_0xc3d3('0x4b')][_0xc3d3('0x4c')],function(_0x328180){return{'name':_0x328180[_0xc3d3('0x4d')],'type':_0x328180[_0xc3d3('0x4e')][_0xc3d3('0x4f')]};});_0x5d9a39['model']=_[_0xc3d3('0x4a')](_0x5a36d2,_0xc3d3('0x3e'));_0x5d9a39['query']=_[_0xc3d3('0x50')](_0x480b9f['query']);_0x5d9a39['filters']=_[_0xc3d3('0x51')](_0x5d9a39[_0xc3d3('0x52')],_0x5d9a39['query']);_0x483f81[_0xc3d3('0x53')]=_['intersection'](_0x5d9a39['model'],qs[_0xc3d3('0x54')](_0x480b9f[_0xc3d3('0x55')][_0xc3d3('0x54')]));_0x483f81[_0xc3d3('0x53')]=_0x483f81[_0xc3d3('0x53')][_0xc3d3('0x56')]?_0x483f81[_0xc3d3('0x53')]:_0x5d9a39['model'];if(!_0x480b9f[_0xc3d3('0x55')]['hasOwnProperty'](_0xc3d3('0x57'))){_0x483f81['limit']=qs[_0xc3d3('0x32')](_0x480b9f[_0xc3d3('0x55')][_0xc3d3('0x32')]);_0x483f81[_0xc3d3('0x30')]=qs[_0xc3d3('0x30')](_0x480b9f[_0xc3d3('0x55')]['offset']);}_0x483f81[_0xc3d3('0x58')]=qs[_0xc3d3('0x59')](_0x480b9f[_0xc3d3('0x55')][_0xc3d3('0x59')]);_0x483f81['where']=qs[_0xc3d3('0x5a')](_[_0xc3d3('0x5b')](_0x480b9f['query'],_0x5d9a39[_0xc3d3('0x5a')]),_0x5a36d2);if(_0x480b9f[_0xc3d3('0x55')]['filter']){_0x483f81['where']=_['merge'](_0x483f81[_0xc3d3('0x5c')],{'$or':_['map'](_0x5a36d2,function(_0x49e44c){if(_0x49e44c[_0xc3d3('0x4e')]!==_0xc3d3('0x5d')){var _0xd8dd9c={};_0xd8dd9c[_0x49e44c[_0xc3d3('0x3e')]]={'$like':'%'+_0x480b9f[_0xc3d3('0x55')][_0xc3d3('0x5e')]+'%'};return _0xd8dd9c;}})});}_0x483f81=_[_0xc3d3('0x40')]({},_0x483f81,_0x480b9f[_0xc3d3('0x5f')]);var _0x2dc881={'where':_0x483f81['where']};return db['MailAccount'][_0xc3d3('0x33')](_0x2dc881)[_0xc3d3('0x21')](function(_0x47b249){_0x1bfa52[_0xc3d3('0x33')]=_0x47b249;if(_0x480b9f[_0xc3d3('0x55')][_0xc3d3('0x60')]){_0x483f81[_0xc3d3('0x61')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x483f81);})[_0xc3d3('0x21')](function(_0x402040){_0x1bfa52[_0xc3d3('0x62')]=_0x402040;return _0x1bfa52;})[_0xc3d3('0x21')](respondWithFilteredResult(_0x16e9d1,_0x483f81))['catch'](handleError(_0x16e9d1,null));};exports[_0xc3d3('0x63')]=function(_0x30604c,_0x1128e9){var _0x5a63ca={'raw':![],'where':{'id':_0x30604c['params']['id']},'include':[{'model':db[_0xc3d3('0x45')],'as':_0xc3d3('0x46')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xc3d3('0x64')],'as':_0xc3d3('0x49')}]},_0x43b097={};_0x43b097[_0xc3d3('0x52')]=_['keys'](db[_0xc3d3('0x4b')]['rawAttributes']);_0x43b097[_0xc3d3('0x55')]=_[_0xc3d3('0x50')](_0x30604c['query']);_0x43b097[_0xc3d3('0x5a')]=_[_0xc3d3('0x51')](_0x43b097['model'],_0x43b097[_0xc3d3('0x55')]);_0x5a63ca[_0xc3d3('0x53')]=_[_0xc3d3('0x51')](_0x43b097['model'],qs['fields'](_0x30604c['query'][_0xc3d3('0x54')]));_0x5a63ca['attributes']=_0x5a63ca[_0xc3d3('0x53')]['length']?_0x5a63ca['attributes']:_0x43b097[_0xc3d3('0x52')];if(_0x30604c[_0xc3d3('0x55')][_0xc3d3('0x60')]){_0x5a63ca[_0xc3d3('0x61')]=[{'all':!![]}];}_0x5a63ca=_[_0xc3d3('0x40')]({},_0x5a63ca,_0x30604c['options']);return db[_0xc3d3('0x4b')][_0xc3d3('0x65')](_0x5a63ca)[_0xc3d3('0x21')](handleEntityNotFound(_0x1128e9,null))['then'](respondWithResult(_0x1128e9,null))[_0xc3d3('0x2b')](handleError(_0x1128e9,null));};exports['update']=function(_0x51cd51,_0x2d2298){if(_0x51cd51[_0xc3d3('0x66')]['id']){delete _0x51cd51[_0xc3d3('0x66')]['id'];}return db[_0xc3d3('0x4b')][_0xc3d3('0x65')]({'where':{'id':_0x51cd51['params']['id']},'include':[{'model':db[_0xc3d3('0x45')],'as':_0xc3d3('0x46')},{'model':db[_0xc3d3('0x47')],'as':_0xc3d3('0x48')},{'model':db[_0xc3d3('0x64')],'as':_0xc3d3('0x49')}]})[_0xc3d3('0x21')](handleEntityNotFound(_0x2d2298,null))[_0xc3d3('0x21')](saveUpdates(_0x51cd51[_0xc3d3('0x66')],null))[_0xc3d3('0x21')](function(_0x1e722c){if(_0x1e722c&&_0x51cd51[_0xc3d3('0x66')][_0xc3d3('0x46')]){return db[_0xc3d3('0x45')][_0xc3d3('0x38')](_0x51cd51[_0xc3d3('0x66')][_0xc3d3('0x46')],{'where':{'MailAccountId':_0x1e722c['id']}})[_0xc3d3('0x21')](function(){return _0x1e722c;});}return _0x1e722c;})[_0xc3d3('0x21')](function(_0x48d974){if(_0x48d974&&_0x51cd51[_0xc3d3('0x66')]['Smtp']){return db[_0xc3d3('0x47')][_0xc3d3('0x38')](_0x51cd51['body'][_0xc3d3('0x48')],{'where':{'MailAccountId':_0x48d974['id']}})[_0xc3d3('0x21')](function(){return _0x48d974;});}return _0x48d974;})[_0xc3d3('0x21')](respondWithResult(_0x2d2298,null))[_0xc3d3('0x2b')](handleError(_0x2d2298,null));};exports[_0xc3d3('0x67')]=function(_0x2ce36e,_0xe15952){return db[_0xc3d3('0x4b')][_0xc3d3('0x67')]()[_0xc3d3('0x21')](respondWithResult(_0xe15952,null))[_0xc3d3('0x2b')](handleError(_0xe15952,null));};exports['addDisposition']=function(_0x3672b9,_0x4c2570,_0xdae8b7){if(_0x3672b9['body']['id']){delete _0x3672b9[_0xc3d3('0x66')]['id'];}return db[_0xc3d3('0x4b')][_0xc3d3('0x65')]({'where':{'id':_0x3672b9[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x4c2570,null))[_0xc3d3('0x21')](function(_0x1cf97e){if(_0x1cf97e){_0x3672b9[_0xc3d3('0x66')][_0xc3d3('0x69')]=_0x1cf97e['id'];return db[_0xc3d3('0x6a')][_0xc3d3('0x6b')](_0x3672b9[_0xc3d3('0x66')]);}})[_0xc3d3('0x21')](respondWithResult(_0x4c2570,null))[_0xc3d3('0x2b')](handleError(_0x4c2570,null));};exports[_0xc3d3('0x6c')]=function(_0x36d989,_0x4e5fe5,_0x50ddc8){var _0x3993fb={'raw':![],'where':{}};var _0x36765e={};var _0x50a073={'count':0x0,'rows':[]};return db[_0xc3d3('0x4b')][_0xc3d3('0x6d')]({'where':{'id':_0x36d989[_0xc3d3('0x68')]['id']}})['then'](handleEntityNotFound(_0x4e5fe5,null))[_0xc3d3('0x21')](function(_0x269495){if(_0x269495){_0x36765e[_0xc3d3('0x52')]=_['keys'](db[_0xc3d3('0x6a')][_0xc3d3('0x4c')]);_0x36765e[_0xc3d3('0x55')]=_[_0xc3d3('0x50')](_0x36d989[_0xc3d3('0x55')]);_0x36765e[_0xc3d3('0x5a')]=_[_0xc3d3('0x51')](_0x36765e[_0xc3d3('0x52')],_0x36765e[_0xc3d3('0x55')]);_0x3993fb[_0xc3d3('0x53')]=_[_0xc3d3('0x51')](_0x36765e[_0xc3d3('0x52')],qs['fields'](_0x36d989[_0xc3d3('0x55')][_0xc3d3('0x54')]));_0x3993fb[_0xc3d3('0x53')]=_0x3993fb[_0xc3d3('0x53')][_0xc3d3('0x56')]?_0x3993fb[_0xc3d3('0x53')]:_0x36765e[_0xc3d3('0x52')];if(!_0x36d989[_0xc3d3('0x55')][_0xc3d3('0x6e')]('nolimit')){_0x3993fb[_0xc3d3('0x32')]=qs[_0xc3d3('0x32')](_0x36d989['query'][_0xc3d3('0x32')]);_0x3993fb['offset']=qs['offset'](_0x36d989['query'][_0xc3d3('0x30')]);}_0x3993fb[_0xc3d3('0x58')]=qs[_0xc3d3('0x59')](_0x36d989[_0xc3d3('0x55')][_0xc3d3('0x59')]);_0x3993fb[_0xc3d3('0x5c')]=qs[_0xc3d3('0x5a')](_['pick'](_0x36d989[_0xc3d3('0x55')],_0x36765e['filters']));_0x3993fb[_0xc3d3('0x5c')][_0xc3d3('0x69')]=_0x269495['id'];if(_0x36d989['query'][_0xc3d3('0x5e')]){_0x3993fb[_0xc3d3('0x5c')]=_[_0xc3d3('0x40')](_0x3993fb[_0xc3d3('0x5c')],{'$or':_['map'](_0x3993fb[_0xc3d3('0x53')],function(_0x3f52df){var _0x2e2f23={};_0x2e2f23[_0x3f52df]={'$like':'%'+_0x36d989['query']['filter']+'%'};return _0x2e2f23;})});}_0x3993fb=_[_0xc3d3('0x40')]({},_0x3993fb,_0x36d989['options']);return db['Disposition'][_0xc3d3('0x33')]({'where':_0x3993fb[_0xc3d3('0x5c')]})[_0xc3d3('0x21')](function(_0x1135d0){_0x50a073[_0xc3d3('0x33')]=_0x1135d0;if(_0x36d989['query']['includeAll']){_0x3993fb[_0xc3d3('0x61')]=[{'all':!![]}];}return db[_0xc3d3('0x6a')][_0xc3d3('0x6f')](_0x3993fb);})['then'](function(_0x5b2ec2){_0x50a073[_0xc3d3('0x62')]=_0x5b2ec2;return _0x50a073;});}})[_0xc3d3('0x21')](respondWithFilteredResult(_0x4e5fe5,_0x3993fb))[_0xc3d3('0x2b')](handleError(_0x4e5fe5,null));};exports[_0xc3d3('0x70')]=function(_0x12a26a,_0x9fa36d,_0x315762){return db['MailAccount'][_0xc3d3('0x65')]({'where':{'id':_0x12a26a[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x9fa36d,null))[_0xc3d3('0x21')](function(_0x4c626a){if(_0x4c626a){return _0x4c626a[_0xc3d3('0x70')](_0x12a26a[_0xc3d3('0x55')]['ids']);}})[_0xc3d3('0x21')](respondWithStatusCode(_0x9fa36d,null))[_0xc3d3('0x2b')](handleError(_0x9fa36d,null));};exports[_0xc3d3('0x71')]=function(_0x507729,_0x99fbd3,_0x4b577c){if(_0x507729[_0xc3d3('0x66')]['id']){delete _0x507729['body']['id'];}return db[_0xc3d3('0x4b')][_0xc3d3('0x65')]({'where':{'id':_0x507729[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x99fbd3,null))[_0xc3d3('0x21')](function(_0x3d11ad){if(_0x3d11ad){_0x507729[_0xc3d3('0x66')][_0xc3d3('0x69')]=_0x3d11ad['id'];return db[_0xc3d3('0x72')][_0xc3d3('0x6b')](_0x507729[_0xc3d3('0x66')]);}})[_0xc3d3('0x21')](respondWithResult(_0x99fbd3,null))['catch'](handleError(_0x99fbd3,null));};exports[_0xc3d3('0x73')]=function(_0x5d6f9a,_0x5513d8,_0x1017e1){var _0xce4668={'raw':![],'where':{}};var _0xd3a90e={};var _0x536f78={'count':0x0,'rows':[]};return db[_0xc3d3('0x4b')][_0xc3d3('0x6d')]({'where':{'id':_0x5d6f9a[_0xc3d3('0x68')]['id']}})['then'](handleEntityNotFound(_0x5513d8,null))[_0xc3d3('0x21')](function(_0x2437e2){if(_0x2437e2){_0xd3a90e[_0xc3d3('0x52')]=_['keys'](db[_0xc3d3('0x72')][_0xc3d3('0x4c')]);_0xd3a90e['query']=_[_0xc3d3('0x50')](_0x5d6f9a[_0xc3d3('0x55')]);_0xd3a90e[_0xc3d3('0x5a')]=_[_0xc3d3('0x51')](_0xd3a90e['model'],_0xd3a90e[_0xc3d3('0x55')]);_0xce4668['attributes']=_[_0xc3d3('0x51')](_0xd3a90e[_0xc3d3('0x52')],qs[_0xc3d3('0x54')](_0x5d6f9a[_0xc3d3('0x55')]['fields']));_0xce4668[_0xc3d3('0x53')]=_0xce4668[_0xc3d3('0x53')][_0xc3d3('0x56')]?_0xce4668[_0xc3d3('0x53')]:_0xd3a90e['model'];if(!_0x5d6f9a[_0xc3d3('0x55')][_0xc3d3('0x6e')](_0xc3d3('0x57'))){_0xce4668[_0xc3d3('0x32')]=qs[_0xc3d3('0x32')](_0x5d6f9a[_0xc3d3('0x55')][_0xc3d3('0x32')]);_0xce4668['offset']=qs[_0xc3d3('0x30')](_0x5d6f9a[_0xc3d3('0x55')]['offset']);}_0xce4668[_0xc3d3('0x58')]=qs[_0xc3d3('0x59')](_0x5d6f9a['query']['sort']);_0xce4668[_0xc3d3('0x5c')]=qs[_0xc3d3('0x5a')](_[_0xc3d3('0x5b')](_0x5d6f9a['query'],_0xd3a90e[_0xc3d3('0x5a')]));_0xce4668[_0xc3d3('0x5c')][_0xc3d3('0x69')]=_0x2437e2['id'];if(_0x5d6f9a[_0xc3d3('0x55')][_0xc3d3('0x5e')]){_0xce4668[_0xc3d3('0x5c')]=_[_0xc3d3('0x40')](_0xce4668[_0xc3d3('0x5c')],{'$or':_[_0xc3d3('0x4a')](_0xce4668[_0xc3d3('0x53')],function(_0x30ffb2){var _0x40cd57={};_0x40cd57[_0x30ffb2]={'$like':'%'+_0x5d6f9a[_0xc3d3('0x55')]['filter']+'%'};return _0x40cd57;})});}_0xce4668=_[_0xc3d3('0x40')]({},_0xce4668,_0x5d6f9a[_0xc3d3('0x5f')]);return db[_0xc3d3('0x72')][_0xc3d3('0x33')]({'where':_0xce4668[_0xc3d3('0x5c')]})[_0xc3d3('0x21')](function(_0x9a841b){_0x536f78[_0xc3d3('0x33')]=_0x9a841b;if(_0x5d6f9a['query'][_0xc3d3('0x60')]){_0xce4668['include']=[{'all':!![]}];}return db[_0xc3d3('0x72')][_0xc3d3('0x6f')](_0xce4668);})[_0xc3d3('0x21')](function(_0x372ed5){_0x536f78[_0xc3d3('0x62')]=_0x372ed5;return _0x536f78;});}})[_0xc3d3('0x21')](respondWithFilteredResult(_0x5513d8,_0xce4668))[_0xc3d3('0x2b')](handleError(_0x5513d8,null));};exports[_0xc3d3('0x74')]=function(_0x333700,_0x138bd1,_0x3344ce){return db[_0xc3d3('0x4b')][_0xc3d3('0x65')]({'where':{'id':_0x333700['params']['id']}})['then'](handleEntityNotFound(_0x138bd1,null))[_0xc3d3('0x21')](function(_0x19c77f){if(_0x19c77f){return _0x19c77f[_0xc3d3('0x74')](_0x333700['query'][_0xc3d3('0x75')]);}})[_0xc3d3('0x21')](respondWithStatusCode(_0x138bd1,null))[_0xc3d3('0x2b')](handleError(_0x138bd1,null));};exports[_0xc3d3('0x6b')]=function(_0xc1e5d6,_0x275e82){var _0x97bdf2={'name':_0xc1e5d6['body'][_0xc3d3('0x3e')],'key':_0xc1e5d6['body'][_0xc3d3('0x4f')],'email':_0xc1e5d6[_0xc3d3('0x66')][_0xc3d3('0x76')],'ListId':_0xc1e5d6[_0xc3d3('0x66')]['ListId'],'active':!_[_0xc3d3('0x77')](_0xc1e5d6['body'][_0xc3d3('0x78')])?_0xc1e5d6['body'][_0xc3d3('0x78')]:!![],'description':_0xc1e5d6['body'][_0xc3d3('0x79')]||null,'Imap':{},'Smtp':{}};if(_[_0xc3d3('0x77')](_0xc1e5d6[_0xc3d3('0x66')][_0xc3d3('0x7a')])){if(_0xc1e5d6[_0xc3d3('0x66')][_0xc3d3('0x7b')]){_0x97bdf2[_0xc3d3('0x46')][_0xc3d3('0x7c')]=_0x97bdf2[_0xc3d3('0x48')][_0xc3d3('0x7c')]=_0xc1e5d6['body'][_0xc3d3('0x7d')];_0x97bdf2['Imap'][_0xc3d3('0x7e')]=_0x97bdf2[_0xc3d3('0x48')][_0xc3d3('0x7f')]=_0xc1e5d6['body'][_0xc3d3('0x80')];}else{_0x97bdf2['Imap'][_0xc3d3('0x81')]=_0x97bdf2[_0xc3d3('0x48')][_0xc3d3('0x81')]=![];}_0x97bdf2['Imap']['host']=_0xc1e5d6['body']['Imap'][_0xc3d3('0x82')];_0x97bdf2['Imap']['port']=_0xc1e5d6[_0xc3d3('0x66')][_0xc3d3('0x46')][_0xc3d3('0x83')];_0x97bdf2['Smtp'][_0xc3d3('0x82')]=_0xc1e5d6[_0xc3d3('0x66')][_0xc3d3('0x48')]['host'];_0x97bdf2[_0xc3d3('0x48')][_0xc3d3('0x83')]=_0xc1e5d6[_0xc3d3('0x66')]['Smtp'][_0xc3d3('0x83')];}else{_0x97bdf2[_0xc3d3('0x46')][_0xc3d3('0x84')]=_0x97bdf2[_0xc3d3('0x48')][_0xc3d3('0x84')]=_0xc1e5d6[_0xc3d3('0x66')]['cservice'];_0x97bdf2[_0xc3d3('0x46')][_0xc3d3('0x7c')]=_0x97bdf2[_0xc3d3('0x48')][_0xc3d3('0x7c')]=_0xc1e5d6[_0xc3d3('0x66')][_0xc3d3('0x7d')];_0x97bdf2[_0xc3d3('0x46')][_0xc3d3('0x7e')]=_0x97bdf2[_0xc3d3('0x48')][_0xc3d3('0x7f')]=_0xc1e5d6['body'][_0xc3d3('0x80')];}return db[_0xc3d3('0x4b')][_0xc3d3('0x6b')](_0x97bdf2,{'include':[{'model':db[_0xc3d3('0x47')],'as':_0xc3d3('0x48')},{'model':db['MailServerIn'],'as':_0xc3d3('0x46')}]})[_0xc3d3('0x21')](function(_0x2325d4){var _0xfa71f3=_0xc1e5d6[_0xc3d3('0x7c')][_0xc3d3('0x3a')]({'plain':!![]});if(!_0xfa71f3)throw new Error(_0xc3d3('0x85'));if(_0xfa71f3[_0xc3d3('0x86')]==='user'){var _0x38ec73=_0x2325d4['get']({'plain':!![]});return db[_0xc3d3('0x87')][_0xc3d3('0x65')]({'where':{'name':_0xc3d3('0x3b'),'userProfileId':_0xfa71f3[_0xc3d3('0x88')]},'raw':!![]})[_0xc3d3('0x21')](function(_0x12791c){if(_0x12791c&&_0x12791c[_0xc3d3('0x89')]===0x0){return db['UserProfileResource'][_0xc3d3('0x6b')]({'name':_0x38ec73[_0xc3d3('0x3e')],'resourceId':_0x38ec73['id'],'type':_0x12791c[_0xc3d3('0x3e')],'sectionId':_0x12791c['id']},{})[_0xc3d3('0x21')](function(){return _0x2325d4;});}else{return _0x2325d4;}})['catch'](function(_0x343c14){logger[_0xc3d3('0x27')](_0xc3d3('0x8a'),_0x343c14);throw _0x343c14;});}return _0x2325d4;})[_0xc3d3('0x21')](respondWithResult(_0x275e82,0xc9))['catch'](handleError(_0x275e82,null));};exports['getImap']=function(_0x366d95,_0xdb44d8,_0xcd6e1a){return db[_0xc3d3('0x4b')][_0xc3d3('0x6d')]({'where':{'id':_0x366d95[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0xdb44d8,null))['then'](function(_0x2143a0){if(_0x2143a0){return _0x2143a0[_0xc3d3('0x8b')]();}return null;})[_0xc3d3('0x21')](respondWithResult(_0xdb44d8,null))['catch'](handleError(_0xdb44d8,null));};exports[_0xc3d3('0x8c')]=function(_0x40f13c,_0x23ac17,_0x457b81){if(_0x40f13c['body']['id']){delete _0x40f13c[_0xc3d3('0x66')]['id'];}return db[_0xc3d3('0x4b')][_0xc3d3('0x65')]({'where':{'id':_0x40f13c['params']['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x23ac17,null))[_0xc3d3('0x21')](function(_0x459350){if(_0x459350){_0x40f13c[_0xc3d3('0x66')][_0xc3d3('0x69')]=_0x459350['id'];return db['MailServerIn']['create'](_0x40f13c['body']);}})[_0xc3d3('0x21')](respondWithResult(_0x23ac17,null))['catch'](handleError(_0x23ac17,null));};exports[_0xc3d3('0x8d')]=function(_0x3276d9,_0x2231ab,_0x24b48b){return db[_0xc3d3('0x4b')][_0xc3d3('0x6d')]({'where':{'id':_0x3276d9[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x2231ab,null))['then'](function(_0x13b6c6){if(_0x13b6c6){return _0x13b6c6[_0xc3d3('0x8e')](null);}return null;})[_0xc3d3('0x21')](respondWithStatusCode(_0x2231ab,null))[_0xc3d3('0x2b')](handleError(_0x2231ab,null));};exports[_0xc3d3('0x8f')]=function(_0x22c597,_0x3e0b06,_0x6669bd){return db[_0xc3d3('0x4b')][_0xc3d3('0x6d')]({'where':{'id':_0x22c597[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x3e0b06,null))[_0xc3d3('0x21')](function(_0x261c17){if(_0x261c17){return _0x261c17[_0xc3d3('0x8f')]();}return null;})[_0xc3d3('0x21')](respondWithResult(_0x3e0b06,null))['catch'](handleError(_0x3e0b06,null));};exports[_0xc3d3('0x90')]=function(_0x53acf5,_0x447aff,_0x2fe6bc){if(_0x53acf5[_0xc3d3('0x66')]['id']){delete _0x53acf5[_0xc3d3('0x66')]['id'];}return db[_0xc3d3('0x4b')][_0xc3d3('0x65')]({'where':{'id':_0x53acf5['params']['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x447aff,null))[_0xc3d3('0x21')](function(_0xd90462){if(_0xd90462){_0x53acf5[_0xc3d3('0x66')][_0xc3d3('0x69')]=_0xd90462['id'];return db[_0xc3d3('0x47')][_0xc3d3('0x6b')](_0x53acf5[_0xc3d3('0x66')]);}})[_0xc3d3('0x21')](respondWithResult(_0x447aff,null))[_0xc3d3('0x2b')](handleError(_0x447aff,null));};exports[_0xc3d3('0x91')]=function(_0x36bddd,_0x45c0cc,_0x4067f4){return db['MailAccount'][_0xc3d3('0x6d')]({'where':{'id':_0x36bddd[_0xc3d3('0x68')]['id']}})['then'](handleEntityNotFound(_0x45c0cc,null))[_0xc3d3('0x21')](function(_0x33bc65){if(_0x33bc65){return _0x33bc65[_0xc3d3('0x92')](null);}return null;})[_0xc3d3('0x21')](respondWithStatusCode(_0x45c0cc,null))[_0xc3d3('0x2b')](handleError(_0x45c0cc,null));};exports['addInteraction']=function(_0x26a354,_0x20cc5e,_0x485072){return db[_0xc3d3('0x93')]['find']({'where':{'id':_0x26a354[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x20cc5e,null))['then'](function(_0x4a8f5f){if(_0x4a8f5f){return _0x4a8f5f[_0xc3d3('0x94')](_0x26a354[_0xc3d3('0x66')][_0xc3d3('0x75')],_[_0xc3d3('0x95')](_0x26a354[_0xc3d3('0x66')],[_0xc3d3('0x75'),'id'])||{});}})[_0xc3d3('0x21')](respondWithResult(_0x20cc5e,null))[_0xc3d3('0x2b')](handleError(_0x20cc5e,null));};exports['getInteractions']=function(_0x46179b,_0x11dd68,_0x327887){var _0x49cb52={'raw':![],'where':{}};var _0x137ce6={};var _0x2f5f86={'count':0x0,'rows':[]};return db['MailAccount'][_0xc3d3('0x6d')]({'where':{'id':_0x46179b[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x11dd68,null))[_0xc3d3('0x21')](function(_0x4f3857){if(_0x4f3857){_0x137ce6['model']=_[_0xc3d3('0x50')](db['MailInteraction'][_0xc3d3('0x4c')]);_0x137ce6[_0xc3d3('0x55')]=_[_0xc3d3('0x50')](_0x46179b[_0xc3d3('0x55')]);_0x137ce6['filters']=_['intersection'](_0x137ce6[_0xc3d3('0x52')],_0x137ce6[_0xc3d3('0x55')]);_0x49cb52['attributes']=_['intersection'](_0x137ce6['model'],qs['fields'](_0x46179b[_0xc3d3('0x55')][_0xc3d3('0x54')]));_0x49cb52[_0xc3d3('0x53')]=_0x49cb52[_0xc3d3('0x53')][_0xc3d3('0x56')]?_0x49cb52['attributes']:_0x137ce6[_0xc3d3('0x52')];if(!_0x46179b[_0xc3d3('0x55')][_0xc3d3('0x6e')](_0xc3d3('0x57'))){_0x49cb52[_0xc3d3('0x32')]=qs[_0xc3d3('0x32')](_0x46179b[_0xc3d3('0x55')][_0xc3d3('0x32')]);_0x49cb52['offset']=qs['offset'](_0x46179b[_0xc3d3('0x55')][_0xc3d3('0x30')]);}_0x49cb52['order']=qs[_0xc3d3('0x59')](_0x46179b[_0xc3d3('0x55')][_0xc3d3('0x59')]);_0x49cb52['where']=qs[_0xc3d3('0x5a')](_['pick'](_0x46179b['query'],_0x137ce6['filters']));_0x49cb52[_0xc3d3('0x5c')][_0xc3d3('0x69')]=_0x4f3857['id'];if(_0x46179b[_0xc3d3('0x55')][_0xc3d3('0x5e')]){_0x49cb52[_0xc3d3('0x5c')]=_[_0xc3d3('0x40')](_0x49cb52[_0xc3d3('0x5c')],{'$or':_[_0xc3d3('0x4a')](_0x49cb52[_0xc3d3('0x53')],function(_0x2a1dec){var _0x3796c7={};_0x3796c7[_0x2a1dec]={'$like':'%'+_0x46179b['query'][_0xc3d3('0x5e')]+'%'};return _0x3796c7;})});}_0x49cb52=_['merge']({},_0x49cb52,_0x46179b['options']);return db[_0xc3d3('0x93')][_0xc3d3('0x33')]({'where':_0x49cb52[_0xc3d3('0x5c')]})[_0xc3d3('0x21')](function(_0x51bca2){_0x2f5f86[_0xc3d3('0x33')]=_0x51bca2;if(_0x46179b[_0xc3d3('0x55')]['includeAll']){_0x49cb52['include']=[{'model':db[_0xc3d3('0x96')],'as':'Contact','required':![]},{'model':db[_0xc3d3('0x97')],'as':_0xc3d3('0x98'),'attributes':['name',_0xc3d3('0x99'),_0xc3d3('0x9a')],'required':![]},{'model':db[_0xc3d3('0x9b')],'as':_0xc3d3('0x9c'),'attributes':['id',_0xc3d3('0x3e'),_0xc3d3('0x9d')],'where':_0x46179b['query']['tag']?{'id':_0x46179b['query'][_0xc3d3('0x9e')]}:undefined,'required':_0x46179b['query'][_0xc3d3('0x9e')]?!![]:![]}];}return db[_0xc3d3('0x93')][_0xc3d3('0x6f')](_0x49cb52);})[_0xc3d3('0x21')](function(_0x2b8b96){_0x2f5f86['rows']=_0x2b8b96;return _0x2f5f86;});}})[_0xc3d3('0x21')](respondWithFilteredResult(_0x11dd68,_0x49cb52))[_0xc3d3('0x2b')](handleError(_0x11dd68,null));};exports['addApplications']=function(_0x43e5e4,_0x2d82ae,_0x1ece80){return db['MailAccount'][_0xc3d3('0x6d')]({'where':{'id':_0x43e5e4[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x2d82ae,null))[_0xc3d3('0x21')](function(_0x223283){if(_0x223283){return db[_0xc3d3('0x9f')][_0xc3d3('0xa0')](function(_0x173b64){return db[_0xc3d3('0xa1')][_0xc3d3('0x39')]({'where':{'MailAccountId':_0x43e5e4['params']['id']},'transaction':_0x173b64})[_0xc3d3('0x21')](function(_0x39719b){var _0x470c7a=_[_0xc3d3('0x4a')](_0x43e5e4['body'],function(_0xfdb8){_0xfdb8[_0xc3d3('0x69')]=_0x43e5e4[_0xc3d3('0x68')]['id'];return _0xfdb8;});return db[_0xc3d3('0xa1')][_0xc3d3('0xa2')](_0x470c7a,{'transaction':_0x173b64});});})[_0xc3d3('0x21')](function(){return db['MailApplication'][_0xc3d3('0xa3')]({'where':{'MailAccountId':_0x43e5e4['params']['id']},'order':_0xc3d3('0xa4')});});}})[_0xc3d3('0x21')](respondWithResult(_0x2d82ae,null))[_0xc3d3('0x2b')](handleError(_0x2d82ae,null));};exports[_0xc3d3('0xa5')]=function(_0x21adf5,_0x3a53a2,_0x20addc){var _0x34233f={};var _0x15fae0={};var _0x27ffa3;var _0x20a94a;return db[_0xc3d3('0x4b')][_0xc3d3('0x6d')]({'where':{'id':_0x21adf5[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x3a53a2,null))[_0xc3d3('0x21')](function(_0x345b0d){if(_0x345b0d){_0x27ffa3=_0x345b0d;_0x15fae0['model']=_['keys'](db['MailApplication']['rawAttributes']);_0x15fae0[_0xc3d3('0x55')]=_[_0xc3d3('0x50')](_0x21adf5[_0xc3d3('0x55')]);_0x15fae0[_0xc3d3('0x5a')]=_[_0xc3d3('0x51')](_0x15fae0[_0xc3d3('0x52')],_0x15fae0[_0xc3d3('0x55')]);_0x34233f['attributes']=_[_0xc3d3('0x51')](_0x15fae0[_0xc3d3('0x52')],qs[_0xc3d3('0x54')](_0x21adf5[_0xc3d3('0x55')][_0xc3d3('0x54')]));_0x34233f['attributes']=_0x34233f[_0xc3d3('0x53')][_0xc3d3('0x56')]?_0x34233f['attributes']:_0x15fae0['model'];_0x34233f[_0xc3d3('0x58')]=qs[_0xc3d3('0x59')](_0x21adf5[_0xc3d3('0x55')][_0xc3d3('0x59')]);_0x34233f[_0xc3d3('0x5c')]=qs[_0xc3d3('0x5a')](_[_0xc3d3('0x5b')](_0x21adf5[_0xc3d3('0x55')],_0x15fae0[_0xc3d3('0x5a')]));if(_0x21adf5[_0xc3d3('0x55')][_0xc3d3('0x5e')]){_0x34233f['where']=_[_0xc3d3('0x40')](_0x34233f[_0xc3d3('0x5c')],{'$or':_['map'](_0x34233f[_0xc3d3('0x53')],function(_0x279fe0){var _0x26475a={};_0x26475a[_0x279fe0]={'$like':'%'+_0x21adf5[_0xc3d3('0x55')]['filter']+'%'};return _0x26475a;})});}_0x34233f=_[_0xc3d3('0x40')]({},_0x34233f,_0x21adf5[_0xc3d3('0x5f')]);return _0x27ffa3['getApplications'](_0x34233f);}})[_0xc3d3('0x21')](function(_0x59eb65){if(_0x59eb65){_0x20a94a=_0x59eb65[_0xc3d3('0x56')];if(!_0x21adf5[_0xc3d3('0x55')]['hasOwnProperty']('nolimit')){_0x34233f[_0xc3d3('0x32')]=qs[_0xc3d3('0x32')](_0x21adf5[_0xc3d3('0x55')][_0xc3d3('0x32')]);_0x34233f[_0xc3d3('0x30')]=qs['offset'](_0x21adf5['query']['offset']);}return _0x27ffa3[_0xc3d3('0xa5')](_0x34233f);}})[_0xc3d3('0x21')](function(_0x43161b){if(_0x43161b){return _0x43161b?{'count':_0x20a94a,'rows':_0x43161b}:null;}})[_0xc3d3('0x21')](respondWithResult(_0x3a53a2,null))[_0xc3d3('0x2b')](handleError(_0x3a53a2,null));};exports[_0xc3d3('0xa6')]=function(_0x22d84e,_0x495bd5,_0x53ba44){var _0x4b69b9={'raw':!![],'where':{}};var _0x56d084={};var _0x4cdc04={'count':0x0,'rows':[]};return db[_0xc3d3('0x4b')][_0xc3d3('0x6d')]({'where':{'id':_0x22d84e[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x495bd5,null))[_0xc3d3('0x21')](function(_0x23b660){if(_0x23b660){_0x56d084[_0xc3d3('0x52')]=_[_0xc3d3('0x50')](db['MailMessage']['rawAttributes']);_0x56d084[_0xc3d3('0x55')]=_['keys'](_0x22d84e[_0xc3d3('0x55')]);_0x56d084[_0xc3d3('0x5a')]=_[_0xc3d3('0x51')](_0x56d084[_0xc3d3('0x52')],_0x56d084[_0xc3d3('0x55')]);_0x4b69b9['attributes']=_[_0xc3d3('0x51')](_0x56d084[_0xc3d3('0x52')],qs[_0xc3d3('0x54')](_0x22d84e[_0xc3d3('0x55')][_0xc3d3('0x54')]));_0x4b69b9[_0xc3d3('0x53')]=_0x4b69b9[_0xc3d3('0x53')][_0xc3d3('0x56')]?_0x4b69b9[_0xc3d3('0x53')]:_0x56d084[_0xc3d3('0x52')];if(!_0x22d84e[_0xc3d3('0x55')][_0xc3d3('0x6e')]('nolimit')){_0x4b69b9['limit']=qs[_0xc3d3('0x32')](_0x22d84e[_0xc3d3('0x55')][_0xc3d3('0x32')]);_0x4b69b9[_0xc3d3('0x30')]=qs[_0xc3d3('0x30')](_0x22d84e[_0xc3d3('0x55')][_0xc3d3('0x30')]);}_0x4b69b9[_0xc3d3('0x58')]=qs['sort'](_0x22d84e[_0xc3d3('0x55')][_0xc3d3('0x59')]);_0x4b69b9[_0xc3d3('0x5c')]=qs[_0xc3d3('0x5a')](_[_0xc3d3('0x5b')](_0x22d84e[_0xc3d3('0x55')],_0x56d084['filters']));_0x4b69b9[_0xc3d3('0x5c')]['MailAccountId']=_0x23b660['id'];if(_0x22d84e['query'][_0xc3d3('0x5e')]){_0x4b69b9['where']=_[_0xc3d3('0x40')](_0x4b69b9['where'],{'$or':_['map'](_0x4b69b9[_0xc3d3('0x53')],function(_0x20239c){var _0x1c017d={};_0x1c017d[_0x20239c]={'$like':'%'+_0x22d84e[_0xc3d3('0x55')][_0xc3d3('0x5e')]+'%'};return _0x1c017d;})});}if(_0x22d84e['query']['$gte']){var _0x1bef39=_0x22d84e[_0xc3d3('0x55')][_0xc3d3('0xa7')][_0xc3d3('0xa8')](',');var _0x19f41c={};_0x19f41c[_0x1bef39[0x0]]={'$gte':moment(_0x1bef39[0x1])['format'](_0xc3d3('0xa9'))};_0x4b69b9[_0xc3d3('0x5c')]=_[_0xc3d3('0x40')](_0x4b69b9[_0xc3d3('0x5c')],_0x19f41c);}_0x4b69b9=_[_0xc3d3('0x40')]({},_0x4b69b9,_0x22d84e[_0xc3d3('0x5f')]);return db[_0xc3d3('0xaa')]['count']({'where':_0x4b69b9[_0xc3d3('0x5c')]})[_0xc3d3('0x21')](function(_0x19b5fc){_0x4cdc04[_0xc3d3('0x33')]=_0x19b5fc;if(_0x22d84e[_0xc3d3('0x55')][_0xc3d3('0x60')]){_0x4b69b9[_0xc3d3('0x61')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x4b69b9);})[_0xc3d3('0x21')](function(_0x53f1a9){if(_0x22d84e['query'][_0xc3d3('0xab')]==='true'){for(var _0x41a358=0x0;_0x41a358<_0x53f1a9[_0xc3d3('0x56')];_0x41a358++){_0x53f1a9[_0x41a358][_0xc3d3('0x66')]=juice(_0x53f1a9[_0x41a358][_0xc3d3('0x66')]);}}_0x4cdc04['rows']=_0x53f1a9;return _0x4cdc04;});}})[_0xc3d3('0x21')](respondWithFilteredResult(_0x495bd5,_0x4b69b9))[_0xc3d3('0x2b')](handleError(_0x495bd5,null));};exports[_0xc3d3('0xac')]=function(_0x2e7e47,_0x3183db,_0x57ef2a){var _0xc017f,_0x2f7e03={},_0x2e891a;if(_0x2e7e47[_0xc3d3('0x66')]['to']){_0x2e891a=_0x2e7e47['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0xc3d3('0x65')]({'where':{'id':_0x2e7e47[_0xc3d3('0x68')]['id']},'include':[{'model':db['CmList'],'as':_0xc3d3('0xad'),'include':[{'model':db[_0xc3d3('0x96')],'as':_0xc3d3('0xae'),'where':{'email':_0x2e891a},'limit':0x1,'order':[[_0xc3d3('0xaf'),_0xc3d3('0xb0')]]}]},{'model':db[_0xc3d3('0x47')],'as':'Smtp','raw':!![]}]})[_0xc3d3('0x21')](handleEntityNotFound(_0x3183db,null))['then'](function(_0x4e8005){if(_0x4e8005){_0xc017f=_0x4e8005;if(_0x4e8005[_0xc3d3('0x48')]){if(_[_0xc3d3('0x77')](_0x2e7e47[_0xc3d3('0x66')][_0xc3d3('0xb1')])){_0x2e7e47['body'][_0xc3d3('0xb1')]=util[_0xc3d3('0xb2')](_0xc3d3('0xb3'),_0x4e8005['name'],_0x4e8005[_0xc3d3('0x76')]||_0x4e8005['Smtp']['user']);}if(_0x2e7e47[_0xc3d3('0x66')][_0xc3d3('0xb4')]&&_0x2e7e47['body'][_0xc3d3('0xb4')][_0xc3d3('0x56')]){for(var _0xf125d1=0x0;_0xf125d1<_0x2e7e47[_0xc3d3('0x66')][_0xc3d3('0xb4')][_0xc3d3('0x56')];_0xf125d1+=0x1){_0x2e7e47['body'][_0xc3d3('0xb4')][_0xf125d1]={'filename':_0x2e7e47['body'][_0xc3d3('0xb4')][_0xf125d1][_0xc3d3('0x3e')],'path':path[_0xc3d3('0xb5')](config[_0xc3d3('0xb6')],'server/files/attachments',_0x2e7e47[_0xc3d3('0x66')][_0xc3d3('0xb4')][_0xf125d1][_0xc3d3('0xb7')])};}}var _0x275753={'tls':{'rejectUnauthorized':![]}};if(_[_0xc3d3('0x77')](_0x4e8005[_0xc3d3('0x48')][_0xc3d3('0x84')])){if(_0x4e8005[_0xc3d3('0x48')][_0xc3d3('0x81')]){_0x275753[_0xc3d3('0xb8')]={'user':_0x4e8005[_0xc3d3('0x48')][_0xc3d3('0x7c')],'pass':_0x4e8005[_0xc3d3('0x48')][_0xc3d3('0x7f')]};}_0x275753[_0xc3d3('0x82')]=_0x4e8005[_0xc3d3('0x48')]['host'];_0x275753[_0xc3d3('0x83')]=_0x4e8005[_0xc3d3('0x48')][_0xc3d3('0x83')];_0x275753['secure']=_0x4e8005[_0xc3d3('0x48')][_0xc3d3('0xb9')];}else{_0x275753[_0xc3d3('0x84')]=_0x4e8005[_0xc3d3('0x48')]['service'];_0x275753[_0xc3d3('0xb8')]={'user':_0x4e8005[_0xc3d3('0x48')][_0xc3d3('0x7c')],'pass':_0x4e8005[_0xc3d3('0x48')][_0xc3d3('0x7f')]};}return respondWithRpcPromise(_0xc3d3('0xba'),_0xc3d3('0xbb'),{'account':_0x275753,'message':_0x2e7e47['body']});}else{throw new Error('List\x20not\x20found');}}})[_0xc3d3('0x21')](function(_0x4dd91f){if(_0x4dd91f){_0x2f7e03=_0x4dd91f;if(_0xc017f['List']){if(_0xc017f[_0xc3d3('0xad')][_0xc3d3('0xae')]['length']){return _0xc017f[_0xc3d3('0xad')][_0xc3d3('0xae')][0x0];}else{return db[_0xc3d3('0x96')][_0xc3d3('0x6b')](_[_0xc3d3('0x19')](_0x2e7e47[_0xc3d3('0x66')],{'firstName':_0x2e7e47[_0xc3d3('0x66')]['to'],'email':_0x2e7e47['body']['to'],'phone':_0x2e7e47['body']['to'],'ListId':_0xc017f[_0xc3d3('0xbc')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xc3d3('0x21')](function(_0x4cf4b1){if(_0x4cf4b1){var _0x544b0c={'UserId':_0x2e7e47['user']['id'],'ContactId':_0x4cf4b1['id'],'MailAccountId':_0xc017f['id'],'inReplyTo':_0x2f7e03[_0xc3d3('0xbd')],'to':_0x2e7e47[_0xc3d3('0x66')]['from'],'cc':_0x2e7e47['body']['cc'],'subject':_0x2e7e47['body'][_0xc3d3('0xbe')],'attach':_0x2e7e47['body'][_0xc3d3('0xbf')],'firstMsgDirection':_0xc3d3('0xc0'),'lastMsgAt':moment()['format'](_0xc3d3('0xa9')),'lastMsgDirection':_0xc3d3('0xc0'),'Messages':[_[_0xc3d3('0x40')](_0x2e7e47[_0xc3d3('0x66')],{'messageId':_0x2f7e03[_0xc3d3('0xbd')],'sentAt':moment()[_0xc3d3('0xb2')](_0xc3d3('0xa9')),'read':!![],'MailAccountId':_0xc017f['id'],'UserId':_0x2e7e47['user']['id'],'ContactId':_0x4cf4b1['id']})]};if(_0x2e7e47['body'][_0xc3d3('0xc1')]){_0x544b0c=_['merge'](_0x544b0c,_0x2e7e47[_0xc3d3('0x66')][_0xc3d3('0xc1')]);}return db[_0xc3d3('0x93')][_0xc3d3('0x6b')](_0x544b0c,{'include':[{'model':db[_0xc3d3('0xaa')],'as':_0xc3d3('0xc2')}]});}})[_0xc3d3('0x21')](respondWithResult(_0x3183db,null))[_0xc3d3('0x2b')](handleError(_0x3183db,null));};exports['verifySmtp']=function(_0x4b9f18,_0x25eac,_0x36fd57){return db[_0xc3d3('0x4b')]['find']({'where':{'id':_0x4b9f18['params']['id']},'include':[{'model':db[_0xc3d3('0x47')],'as':_0xc3d3('0x48'),'raw':!![]}]})[_0xc3d3('0x21')](handleEntityNotFound(_0x25eac,null))[_0xc3d3('0x21')](function(_0x47fd71){if(_0x47fd71&&_0x47fd71[_0xc3d3('0x48')]){var _0x5b07af={'id':_0x47fd71['id'],'tls':{'rejectUnauthorized':![]}};if(_0x47fd71[_0xc3d3('0x48')]['service']){_0x5b07af['service']=_0x47fd71['Smtp'][_0xc3d3('0x84')];}else{_0x5b07af[_0xc3d3('0x82')]=_0x47fd71[_0xc3d3('0x48')]['host'];_0x5b07af[_0xc3d3('0x83')]=_0x47fd71['Smtp']['port'];_0x5b07af[_0xc3d3('0xb9')]=_0x47fd71['Smtp'][_0xc3d3('0xb9')];}if(_0x47fd71[_0xc3d3('0x48')][_0xc3d3('0x81')]){_0x5b07af[_0xc3d3('0xb8')]={'user':_0x47fd71['Smtp'][_0xc3d3('0x7c')],'pass':_0x47fd71['Smtp'][_0xc3d3('0x7f')]};}return respondWithRpcPromise(_0xc3d3('0xc3'),_0xc3d3('0xc4'),{'account':_0x5b07af});}})[_0xc3d3('0x21')](respondWithResult(_0x25eac,null))[_0xc3d3('0x2b')](handleError(_0x25eac,null));};exports[_0xc3d3('0x39')]=function(_0x2bb502,_0xcf8424){return db['MailAccount']['find']({'where':{'id':_0x2bb502[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0xcf8424,null))[_0xc3d3('0x21')](function(_0x57234d){if(_0x57234d&&_0x57234d['service']){throw new db[(_0xc3d3('0xc5'))][(_0xc3d3('0xc6'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x57234d;})[_0xc3d3('0x21')](removeEntity(_0xcf8424,null))['catch'](handleError(_0xcf8424,null));};exports[_0xc3d3('0xc7')]=function(_0x541782,_0x2ad5ce,_0x55143c){return db[_0xc3d3('0x4b')][_0xc3d3('0x65')]({'where':{'id':_0x541782[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x2ad5ce,null))[_0xc3d3('0x21')](function(_0x415501){if(_0x415501){return _0x415501[_0xc3d3('0xc7')](_0x541782[_0xc3d3('0x66')][_0xc3d3('0x75')],_[_0xc3d3('0x95')](_0x541782[_0xc3d3('0x66')],[_0xc3d3('0x75'),'id'])||{})[_0xc3d3('0xc8')](function(_0x9177c1){for(var _0x3007b5=0x0;_0x3007b5<_0x541782['body'][_0xc3d3('0x75')][_0xc3d3('0x56')];_0x3007b5+=0x1){socket[_0xc3d3('0xc9')]('userMailAccount:save',{'UserId':_0x541782['body']['ids'][_0x3007b5],'MailAccountId':_0x541782[_0xc3d3('0x68')]['id']});}return _0x9177c1;});}})[_0xc3d3('0x21')](respondWithResult(_0x2ad5ce,null))['catch'](handleError(_0x2ad5ce,null));};exports['removeAgents']=function(_0x110ff1,_0x2ccc24,_0xba518b){return db[_0xc3d3('0x4b')][_0xc3d3('0x65')]({'where':{'id':_0x110ff1[_0xc3d3('0x68')]['id']}})[_0xc3d3('0x21')](handleEntityNotFound(_0x2ccc24,null))[_0xc3d3('0x21')](function(_0x4cde49){if(_0x4cde49){return _0x4cde49['removeAgents'](_0x110ff1[_0xc3d3('0x55')][_0xc3d3('0x75')])[_0xc3d3('0x21')](function(){if(_[_0xc3d3('0xca')](_0x110ff1[_0xc3d3('0x55')][_0xc3d3('0x75')])){for(var _0x487f98=0x0;_0x487f98<_0x110ff1[_0xc3d3('0x55')]['ids'][_0xc3d3('0x56')];_0x487f98+=0x1){socket[_0xc3d3('0xc9')](_0xc3d3('0xcb'),{'UserId':Number(_0x110ff1[_0xc3d3('0x55')]['ids'][_0x487f98]),'MailAccountId':Number(_0x110ff1[_0xc3d3('0x68')]['id'])});}}else{socket[_0xc3d3('0xc9')](_0xc3d3('0xcb'),{'UserId':Number(_0x110ff1[_0xc3d3('0x55')][_0xc3d3('0x75')]),'MailAccountId':Number(_0x110ff1[_0xc3d3('0x68')]['id'])});}});}})[_0xc3d3('0x21')](respondWithStatusCode(_0x2ccc24,null))[_0xc3d3('0x2b')](handleError(_0x2ccc24,null));};exports[_0xc3d3('0xcc')]=function(_0x10bcc9,_0x3ad33a,_0x24cd8e){var _0x56f400={};var _0x2de828={};var _0x292011;var _0x100904;return db[_0xc3d3('0x4b')][_0xc3d3('0x6d')]({'where':{'id':_0x10bcc9[_0xc3d3('0x68')]['id']}})['then'](handleEntityNotFound(_0x3ad33a,null))[_0xc3d3('0x21')](function(_0x5d4757){if(_0x5d4757){_0x292011=_0x5d4757;_0x2de828[_0xc3d3('0x52')]=_['keys'](db[_0xc3d3('0x97')][_0xc3d3('0x4c')]);_0x2de828[_0xc3d3('0x55')]=_[_0xc3d3('0x50')](_0x10bcc9[_0xc3d3('0x55')]);_0x2de828[_0xc3d3('0x5a')]=_['intersection'](_0x2de828[_0xc3d3('0x52')],_0x2de828[_0xc3d3('0x55')]);_0x56f400[_0xc3d3('0x53')]=_['intersection'](_0x2de828[_0xc3d3('0x52')],qs['fields'](_0x10bcc9[_0xc3d3('0x55')][_0xc3d3('0x54')]));_0x56f400[_0xc3d3('0x53')]=_0x56f400[_0xc3d3('0x53')][_0xc3d3('0x56')]?_0x56f400[_0xc3d3('0x53')]:_0x2de828[_0xc3d3('0x52')];_0x56f400['order']=qs[_0xc3d3('0x59')](_0x10bcc9['query'][_0xc3d3('0x59')]);_0x56f400[_0xc3d3('0x5c')]=qs['filters'](_[_0xc3d3('0x5b')](_0x10bcc9[_0xc3d3('0x55')],_0x2de828[_0xc3d3('0x5a')]));if(_0x10bcc9[_0xc3d3('0x55')][_0xc3d3('0x5e')]){_0x56f400['where']=_[_0xc3d3('0x40')](_0x56f400[_0xc3d3('0x5c')],{'$or':_[_0xc3d3('0x4a')](_0x56f400[_0xc3d3('0x53')],function(_0x235ee4){var _0x19e96d={};_0x19e96d[_0x235ee4]={'$like':'%'+_0x10bcc9[_0xc3d3('0x55')]['filter']+'%'};return _0x19e96d;})});}_0x56f400=_[_0xc3d3('0x40')]({},_0x56f400,_0x10bcc9['options']);return _0x292011[_0xc3d3('0xcc')](_0x56f400);}})[_0xc3d3('0x21')](function(_0x2697df){if(_0x2697df){_0x100904=_0x2697df[_0xc3d3('0x56')];if(!_0x10bcc9[_0xc3d3('0x55')][_0xc3d3('0x6e')](_0xc3d3('0x57'))){_0x56f400[_0xc3d3('0x32')]=qs['limit'](_0x10bcc9[_0xc3d3('0x55')][_0xc3d3('0x32')]);_0x56f400[_0xc3d3('0x30')]=qs[_0xc3d3('0x30')](_0x10bcc9[_0xc3d3('0x55')][_0xc3d3('0x30')]);}return _0x292011[_0xc3d3('0xcc')](_0x56f400);}})[_0xc3d3('0x21')](function(_0x1701ae){if(_0x1701ae){return _0x1701ae?{'count':_0x100904,'rows':_0x1701ae}:null;}})[_0xc3d3('0x21')](respondWithResult(_0x3ad33a,null))['catch'](handleError(_0x3ad33a,null));}; \ No newline at end of file +var _0x5e7c=['../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','get','UserProfileResource','end','name','render','body','agent','account','index','MailServerIn','Imap','Smtp','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','include','findAll','rows','MailServerOut','includeAll','find','update','params','mandatoryDispositionPause','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','email','isNil','active','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','findAndCountAll','priority','getApplications','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','ListId','subject','attach','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','path','ejs','fs-extra','lodash','desk.js','to-csv','querystring','html-to-text','juice','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5e7c,0x175));var _0xc5e7=function(_0x45ed96,_0x1318e2){_0x45ed96=_0x45ed96-0x0;var _0x38327e=_0x5e7c[_0x45ed96];return _0x38327e;};'use strict';var emlformat=require(_0xc5e7('0x0'));var rimraf=require(_0xc5e7('0x1'));var zipdir=require(_0xc5e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc5e7('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc5e7('0x5'));var fs=require('fs');var fs_extra=require(_0xc5e7('0x6'));var _=require(_0xc5e7('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5e7('0x8'));var toCsv=require(_0xc5e7('0x9'));var querystring=require(_0xc5e7('0xa'));var Papa=require('papaparse');var htmlToText=require(_0xc5e7('0xb'));var juice=require(_0xc5e7('0xc'));var Redis=require('ioredis');var authService=require(_0xc5e7('0xd'));var qs=require(_0xc5e7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5e7('0xf'));var logger=require('../../config/logger')(_0xc5e7('0x10'));var utils=require(_0xc5e7('0x11'));var config=require(_0xc5e7('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc5e7('0x13'))['db'];config[_0xc5e7('0x14')]=_[_0xc5e7('0x15')](config['redis'],{'host':_0xc5e7('0x16'),'port':0x18eb});var socket=require(_0xc5e7('0x17'))(new Redis(config[_0xc5e7('0x14')]));require(_0xc5e7('0x18'))[_0xc5e7('0x19')](socket);var jayson=require(_0xc5e7('0x1a'));var client=jayson['client'][_0xc5e7('0x1b')]({'port':0x232b});function respondWithRpcPromise(_0x23ea74,_0x380c90,_0x2ad61d,_0x1cecdb){return new BPromise(function(_0x36bc82,_0x8785f4){var _0x524f30=_0x1cecdb||client;return _0x524f30[_0xc5e7('0x1c')](_0x23ea74,_0x2ad61d)['then'](function(_0x31646d){logger[_0xc5e7('0x1d')](_0xc5e7('0x1e'),_0x380c90,_0xc5e7('0x1f'));logger[_0xc5e7('0x20')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x380c90,_0xc5e7('0x1f'),JSON[_0xc5e7('0x21')](_0x31646d));if(_0x31646d[_0xc5e7('0x22')]){if(_0x31646d[_0xc5e7('0x22')][_0xc5e7('0x23')]===0x1f4){logger['error'](_0xc5e7('0x1e'),_0x380c90,_0x31646d[_0xc5e7('0x22')]['message']);return _0x8785f4(_0x31646d[_0xc5e7('0x22')][_0xc5e7('0x24')]);}logger['error'](_0xc5e7('0x1e'),_0x380c90,_0x31646d[_0xc5e7('0x22')][_0xc5e7('0x24')]);return _0x36bc82(_0x31646d[_0xc5e7('0x22')]['message']);}else{logger[_0xc5e7('0x1d')](_0xc5e7('0x1e'),_0x380c90,'request\x20sent');_0x36bc82(_0x31646d[_0xc5e7('0x25')][_0xc5e7('0x24')]);}})[_0xc5e7('0x26')](function(_0xe9b0e5){logger[_0xc5e7('0x22')](_0xc5e7('0x1e'),_0x380c90,_0xe9b0e5);_0x8785f4(_0xe9b0e5);});});}function respondWithStatusCode(_0x5ca00b,_0x4a089f){_0x4a089f=_0x4a089f||0xcc;return function(_0x919867){if(_0x919867){return _0x5ca00b[_0xc5e7('0x27')](_0x4a089f);}return _0x5ca00b[_0xc5e7('0x28')](_0x4a089f)['end']();};}function respondWithResult(_0x5b171a,_0x1e28eb){_0x1e28eb=_0x1e28eb||0xc8;return function(_0x54e3c4){if(_0x54e3c4){return _0x5b171a[_0xc5e7('0x28')](_0x1e28eb)[_0xc5e7('0x29')](_0x54e3c4);}};}function respondWithFilteredResult(_0x42fb47,_0x5a8b0d){return function(_0x1c2f50){if(_0x1c2f50){var _0x35a193=typeof _0x5a8b0d[_0xc5e7('0x2a')]==='undefined'&&typeof _0x5a8b0d[_0xc5e7('0x2b')]===_0xc5e7('0x2c');var _0x48648d=_0x1c2f50[_0xc5e7('0x2d')];var _0x36421d=_0x35a193?0x0:_0x5a8b0d[_0xc5e7('0x2a')];var _0x37a5f1=_0x35a193?_0x1c2f50[_0xc5e7('0x2d')]:_0x5a8b0d[_0xc5e7('0x2a')]+_0x5a8b0d[_0xc5e7('0x2b')];var _0x392fc5;if(_0x37a5f1>=_0x48648d){_0x37a5f1=_0x48648d;_0x392fc5=0xc8;}else{_0x392fc5=0xce;}_0x42fb47[_0xc5e7('0x28')](_0x392fc5);return _0x42fb47[_0xc5e7('0x2e')](_0xc5e7('0x2f'),_0x36421d+'-'+_0x37a5f1+'/'+_0x48648d)[_0xc5e7('0x29')](_0x1c2f50);}return null;};}function patchUpdates(_0x1e633f){return function(_0x31341b){try{jsonpatch['apply'](_0x31341b,_0x1e633f,!![]);}catch(_0x50499a){return BPromise[_0xc5e7('0x30')](_0x50499a);}return _0x31341b['save']();};}function saveUpdates(_0x3def2d,_0x71554){return function(_0x5ecc94){if(_0x5ecc94){return _0x5ecc94['update'](_0x3def2d)[_0xc5e7('0x31')](function(_0x3fa08b){return _0x3fa08b;});}return null;};}function removeEntity(_0x1d15d2,_0x1269d5){return function(_0x183cd8){if(_0x183cd8){return _0x183cd8[_0xc5e7('0x32')]()['then'](function(){var _0x51929c=_0x183cd8[_0xc5e7('0x33')]({'plain':!![]});var _0x192134='MailAccounts';return db[_0xc5e7('0x34')][_0xc5e7('0x32')]({'where':{'type':_0x192134,'resourceId':_0x51929c['id']}})['then'](function(){return _0x183cd8;});})[_0xc5e7('0x31')](function(){_0x1d15d2[_0xc5e7('0x28')](0xcc)[_0xc5e7('0x35')]();});}};}function handleEntityNotFound(_0xf4b913,_0x3afc53){return function(_0x1c059d){if(!_0x1c059d){_0xf4b913[_0xc5e7('0x27')](0x194);}return _0x1c059d;};}function handleError(_0x5a53cc,_0x355bcc){_0x355bcc=_0x355bcc||0x1f4;return function(_0x24296a){logger[_0xc5e7('0x22')](_0x24296a['stack']);if(_0x24296a[_0xc5e7('0x36')]){delete _0x24296a[_0xc5e7('0x36')];}_0x5a53cc['status'](_0x355bcc)['send'](_0x24296a);};}function getMustacheRender(_0xa5d8a0,_0x3ec16b){return Mustache[_0xc5e7('0x37')](_0xa5d8a0,_['merge'](_0x3ec16b[_0xc5e7('0x38')],{'contact':_0x3ec16b['contact'],'message':_0x3ec16b[_0xc5e7('0x24')],'agent':_0x3ec16b[_0xc5e7('0x39')],'interaction':_0x3ec16b['interaction'],'account':_0x3ec16b[_0xc5e7('0x3a')]}))||'';}exports[_0xc5e7('0x3b')]=function(_0x5d5635,_0x1fd5c8){var _0xe037b0={'include':[{'model':db[_0xc5e7('0x3c')],'as':_0xc5e7('0x3d')},{'model':db['MailServerOut'],'as':_0xc5e7('0x3e')},{'model':db[_0xc5e7('0x3f')],'as':'mandatoryDispositionPause'}]},_0x440d05={},_0x5ae96f={'count':0x0,'rows':[]};var _0x3dbf62=_[_0xc5e7('0x40')](db['MailAccount'][_0xc5e7('0x41')],function(_0x311bac){return{'name':_0x311bac[_0xc5e7('0x42')],'type':_0x311bac[_0xc5e7('0x43')][_0xc5e7('0x44')]};});_0x440d05[_0xc5e7('0x45')]=_[_0xc5e7('0x40')](_0x3dbf62,_0xc5e7('0x36'));_0x440d05[_0xc5e7('0x46')]=_[_0xc5e7('0x47')](_0x5d5635[_0xc5e7('0x46')]);_0x440d05[_0xc5e7('0x48')]=_['intersection'](_0x440d05[_0xc5e7('0x45')],_0x440d05[_0xc5e7('0x46')]);_0xe037b0['attributes']=_[_0xc5e7('0x49')](_0x440d05['model'],qs['fields'](_0x5d5635[_0xc5e7('0x46')][_0xc5e7('0x4a')]));_0xe037b0[_0xc5e7('0x4b')]=_0xe037b0[_0xc5e7('0x4b')][_0xc5e7('0x4c')]?_0xe037b0[_0xc5e7('0x4b')]:_0x440d05[_0xc5e7('0x45')];if(!_0x5d5635[_0xc5e7('0x46')][_0xc5e7('0x4d')](_0xc5e7('0x4e'))){_0xe037b0[_0xc5e7('0x2b')]=qs[_0xc5e7('0x2b')](_0x5d5635[_0xc5e7('0x46')][_0xc5e7('0x2b')]);_0xe037b0[_0xc5e7('0x2a')]=qs[_0xc5e7('0x2a')](_0x5d5635[_0xc5e7('0x46')][_0xc5e7('0x2a')]);}_0xe037b0['order']=qs['sort'](_0x5d5635[_0xc5e7('0x46')][_0xc5e7('0x4f')]);_0xe037b0[_0xc5e7('0x50')]=qs['filters'](_[_0xc5e7('0x51')](_0x5d5635[_0xc5e7('0x46')],_0x440d05[_0xc5e7('0x48')]),_0x3dbf62);if(_0x5d5635[_0xc5e7('0x46')][_0xc5e7('0x52')]){_0xe037b0[_0xc5e7('0x50')]=_[_0xc5e7('0x53')](_0xe037b0['where'],{'$or':_[_0xc5e7('0x40')](_0x3dbf62,function(_0x548f5d){if(_0x548f5d[_0xc5e7('0x43')]!==_0xc5e7('0x54')){var _0x46d095={};_0x46d095[_0x548f5d['name']]={'$like':'%'+_0x5d5635[_0xc5e7('0x46')]['filter']+'%'};return _0x46d095;}})});}_0xe037b0=_[_0xc5e7('0x53')]({},_0xe037b0,_0x5d5635[_0xc5e7('0x55')]);var _0x323a08={'where':_0xe037b0[_0xc5e7('0x50')]};return db[_0xc5e7('0x56')][_0xc5e7('0x2d')](_0x323a08)['then'](function(_0x1bd767){_0x5ae96f['count']=_0x1bd767;if(_0x5d5635[_0xc5e7('0x46')]['includeAll']){_0xe037b0[_0xc5e7('0x57')]=[{'all':!![]}];}return db[_0xc5e7('0x56')][_0xc5e7('0x58')](_0xe037b0);})[_0xc5e7('0x31')](function(_0xed2b96){_0x5ae96f[_0xc5e7('0x59')]=_0xed2b96;return _0x5ae96f;})[_0xc5e7('0x31')](respondWithFilteredResult(_0x1fd5c8,_0xe037b0))['catch'](handleError(_0x1fd5c8,null));};exports['show']=function(_0x4e10b2,_0x4953f4){var _0x16d961={'raw':![],'where':{'id':_0x4e10b2['params']['id']},'include':[{'model':db[_0xc5e7('0x3c')],'as':_0xc5e7('0x3d')},{'model':db[_0xc5e7('0x5a')],'as':_0xc5e7('0x3e')},{'model':db[_0xc5e7('0x3f')],'as':'mandatoryDispositionPause'}]},_0x2851f6={};_0x2851f6[_0xc5e7('0x45')]=_[_0xc5e7('0x47')](db[_0xc5e7('0x56')][_0xc5e7('0x41')]);_0x2851f6[_0xc5e7('0x46')]=_[_0xc5e7('0x47')](_0x4e10b2[_0xc5e7('0x46')]);_0x2851f6[_0xc5e7('0x48')]=_['intersection'](_0x2851f6['model'],_0x2851f6['query']);_0x16d961[_0xc5e7('0x4b')]=_['intersection'](_0x2851f6[_0xc5e7('0x45')],qs[_0xc5e7('0x4a')](_0x4e10b2[_0xc5e7('0x46')]['fields']));_0x16d961[_0xc5e7('0x4b')]=_0x16d961[_0xc5e7('0x4b')][_0xc5e7('0x4c')]?_0x16d961[_0xc5e7('0x4b')]:_0x2851f6[_0xc5e7('0x45')];if(_0x4e10b2['query'][_0xc5e7('0x5b')]){_0x16d961[_0xc5e7('0x57')]=[{'all':!![]}];}_0x16d961=_[_0xc5e7('0x53')]({},_0x16d961,_0x4e10b2[_0xc5e7('0x55')]);return db[_0xc5e7('0x56')][_0xc5e7('0x5c')](_0x16d961)[_0xc5e7('0x31')](handleEntityNotFound(_0x4953f4,null))[_0xc5e7('0x31')](respondWithResult(_0x4953f4,null))[_0xc5e7('0x26')](handleError(_0x4953f4,null));};exports[_0xc5e7('0x5d')]=function(_0x10d65b,_0x35e5f7){if(_0x10d65b[_0xc5e7('0x38')]['id']){delete _0x10d65b['body']['id'];}return db[_0xc5e7('0x56')][_0xc5e7('0x5c')]({'where':{'id':_0x10d65b[_0xc5e7('0x5e')]['id']},'include':[{'model':db[_0xc5e7('0x3c')],'as':_0xc5e7('0x3d')},{'model':db[_0xc5e7('0x5a')],'as':_0xc5e7('0x3e')},{'model':db[_0xc5e7('0x3f')],'as':_0xc5e7('0x5f')}]})[_0xc5e7('0x31')](handleEntityNotFound(_0x35e5f7,null))[_0xc5e7('0x31')](saveUpdates(_0x10d65b[_0xc5e7('0x38')],null))['then'](function(_0xa512c2){if(_0xa512c2&&_0x10d65b['body'][_0xc5e7('0x3d')]){return db[_0xc5e7('0x3c')][_0xc5e7('0x5d')](_0x10d65b[_0xc5e7('0x38')][_0xc5e7('0x3d')],{'where':{'MailAccountId':_0xa512c2['id']}})[_0xc5e7('0x31')](function(){return _0xa512c2;});}return _0xa512c2;})['then'](function(_0x520468){if(_0x520468&&_0x10d65b[_0xc5e7('0x38')]['Smtp']){return db['MailServerOut'][_0xc5e7('0x5d')](_0x10d65b[_0xc5e7('0x38')][_0xc5e7('0x3e')],{'where':{'MailAccountId':_0x520468['id']}})[_0xc5e7('0x31')](function(){return _0x520468;});}return _0x520468;})['then'](respondWithResult(_0x35e5f7,null))[_0xc5e7('0x26')](handleError(_0x35e5f7,null));};exports['describe']=function(_0x43479e,_0x2371f1){return db[_0xc5e7('0x56')][_0xc5e7('0x60')]()['then'](respondWithResult(_0x2371f1,null))[_0xc5e7('0x26')](handleError(_0x2371f1,null));};exports[_0xc5e7('0x61')]=function(_0x17a887,_0x398d47,_0x258aae){if(_0x17a887['body']['id']){delete _0x17a887[_0xc5e7('0x38')]['id'];}return db[_0xc5e7('0x56')][_0xc5e7('0x5c')]({'where':{'id':_0x17a887[_0xc5e7('0x5e')]['id']}})['then'](handleEntityNotFound(_0x398d47,null))['then'](function(_0x3f3cef){if(_0x3f3cef){_0x17a887['body'][_0xc5e7('0x62')]=_0x3f3cef['id'];return db['Disposition'][_0xc5e7('0x63')](_0x17a887['body']);}})['then'](respondWithResult(_0x398d47,null))[_0xc5e7('0x26')](handleError(_0x398d47,null));};exports[_0xc5e7('0x64')]=function(_0x1a5cbc,_0x116902,_0x4680ad){var _0x35ee84={'raw':![],'where':{}};var _0x525f9e={};var _0x3f3962={'count':0x0,'rows':[]};return db[_0xc5e7('0x56')][_0xc5e7('0x65')]({'where':{'id':_0x1a5cbc['params']['id']}})['then'](handleEntityNotFound(_0x116902,null))[_0xc5e7('0x31')](function(_0x48c44b){if(_0x48c44b){_0x525f9e[_0xc5e7('0x45')]=_[_0xc5e7('0x47')](db[_0xc5e7('0x66')]['rawAttributes']);_0x525f9e['query']=_[_0xc5e7('0x47')](_0x1a5cbc[_0xc5e7('0x46')]);_0x525f9e[_0xc5e7('0x48')]=_[_0xc5e7('0x49')](_0x525f9e['model'],_0x525f9e[_0xc5e7('0x46')]);_0x35ee84[_0xc5e7('0x4b')]=_[_0xc5e7('0x49')](_0x525f9e[_0xc5e7('0x45')],qs['fields'](_0x1a5cbc[_0xc5e7('0x46')][_0xc5e7('0x4a')]));_0x35ee84['attributes']=_0x35ee84[_0xc5e7('0x4b')][_0xc5e7('0x4c')]?_0x35ee84['attributes']:_0x525f9e[_0xc5e7('0x45')];if(!_0x1a5cbc[_0xc5e7('0x46')][_0xc5e7('0x4d')](_0xc5e7('0x4e'))){_0x35ee84[_0xc5e7('0x2b')]=qs['limit'](_0x1a5cbc[_0xc5e7('0x46')][_0xc5e7('0x2b')]);_0x35ee84[_0xc5e7('0x2a')]=qs[_0xc5e7('0x2a')](_0x1a5cbc['query'][_0xc5e7('0x2a')]);}_0x35ee84[_0xc5e7('0x67')]=qs['sort'](_0x1a5cbc[_0xc5e7('0x46')]['sort']);_0x35ee84[_0xc5e7('0x50')]=qs[_0xc5e7('0x48')](_['pick'](_0x1a5cbc[_0xc5e7('0x46')],_0x525f9e[_0xc5e7('0x48')]));_0x35ee84[_0xc5e7('0x50')][_0xc5e7('0x62')]=_0x48c44b['id'];if(_0x1a5cbc[_0xc5e7('0x46')][_0xc5e7('0x52')]){_0x35ee84['where']=_['merge'](_0x35ee84[_0xc5e7('0x50')],{'$or':_[_0xc5e7('0x40')](_0x35ee84[_0xc5e7('0x4b')],function(_0x26f211){var _0x14ed12={};_0x14ed12[_0x26f211]={'$like':'%'+_0x1a5cbc[_0xc5e7('0x46')][_0xc5e7('0x52')]+'%'};return _0x14ed12;})});}_0x35ee84=_[_0xc5e7('0x53')]({},_0x35ee84,_0x1a5cbc[_0xc5e7('0x55')]);return db['Disposition'][_0xc5e7('0x2d')]({'where':_0x35ee84[_0xc5e7('0x50')]})['then'](function(_0x1fbf2f){_0x3f3962[_0xc5e7('0x2d')]=_0x1fbf2f;if(_0x1a5cbc[_0xc5e7('0x46')][_0xc5e7('0x5b')]){_0x35ee84[_0xc5e7('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xc5e7('0x58')](_0x35ee84);})[_0xc5e7('0x31')](function(_0x1de74b){_0x3f3962['rows']=_0x1de74b;return _0x3f3962;});}})[_0xc5e7('0x31')](respondWithFilteredResult(_0x116902,_0x35ee84))[_0xc5e7('0x26')](handleError(_0x116902,null));};exports['removeDispositions']=function(_0x23a7d2,_0x1e42c8,_0x2e7704){return db['MailAccount'][_0xc5e7('0x5c')]({'where':{'id':_0x23a7d2[_0xc5e7('0x5e')]['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x1e42c8,null))[_0xc5e7('0x31')](function(_0x3ec4cd){if(_0x3ec4cd){return _0x3ec4cd[_0xc5e7('0x68')](_0x23a7d2[_0xc5e7('0x46')]['ids']);}})[_0xc5e7('0x31')](respondWithStatusCode(_0x1e42c8,null))[_0xc5e7('0x26')](handleError(_0x1e42c8,null));};exports[_0xc5e7('0x69')]=function(_0x5ec76d,_0x38ac9f,_0x4d8917){if(_0x5ec76d['body']['id']){delete _0x5ec76d[_0xc5e7('0x38')]['id'];}return db[_0xc5e7('0x56')]['find']({'where':{'id':_0x5ec76d['params']['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x38ac9f,null))[_0xc5e7('0x31')](function(_0xe45365){if(_0xe45365){_0x5ec76d[_0xc5e7('0x38')][_0xc5e7('0x62')]=_0xe45365['id'];return db[_0xc5e7('0x6a')][_0xc5e7('0x63')](_0x5ec76d[_0xc5e7('0x38')]);}})['then'](respondWithResult(_0x38ac9f,null))[_0xc5e7('0x26')](handleError(_0x38ac9f,null));};exports[_0xc5e7('0x6b')]=function(_0x9bc154,_0x4eb504,_0x4ac457){var _0x8afd83={'raw':![],'where':{}};var _0x240e02={};var _0x2b82b4={'count':0x0,'rows':[]};return db['MailAccount'][_0xc5e7('0x65')]({'where':{'id':_0x9bc154[_0xc5e7('0x5e')]['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x4eb504,null))['then'](function(_0x3103d1){if(_0x3103d1){_0x240e02[_0xc5e7('0x45')]=_['keys'](db[_0xc5e7('0x6a')][_0xc5e7('0x41')]);_0x240e02[_0xc5e7('0x46')]=_[_0xc5e7('0x47')](_0x9bc154['query']);_0x240e02[_0xc5e7('0x48')]=_['intersection'](_0x240e02['model'],_0x240e02['query']);_0x8afd83[_0xc5e7('0x4b')]=_[_0xc5e7('0x49')](_0x240e02['model'],qs['fields'](_0x9bc154['query'][_0xc5e7('0x4a')]));_0x8afd83['attributes']=_0x8afd83[_0xc5e7('0x4b')][_0xc5e7('0x4c')]?_0x8afd83[_0xc5e7('0x4b')]:_0x240e02[_0xc5e7('0x45')];if(!_0x9bc154[_0xc5e7('0x46')]['hasOwnProperty'](_0xc5e7('0x4e'))){_0x8afd83[_0xc5e7('0x2b')]=qs[_0xc5e7('0x2b')](_0x9bc154[_0xc5e7('0x46')]['limit']);_0x8afd83['offset']=qs['offset'](_0x9bc154['query'][_0xc5e7('0x2a')]);}_0x8afd83[_0xc5e7('0x67')]=qs[_0xc5e7('0x4f')](_0x9bc154[_0xc5e7('0x46')][_0xc5e7('0x4f')]);_0x8afd83['where']=qs['filters'](_[_0xc5e7('0x51')](_0x9bc154[_0xc5e7('0x46')],_0x240e02['filters']));_0x8afd83['where'][_0xc5e7('0x62')]=_0x3103d1['id'];if(_0x9bc154[_0xc5e7('0x46')][_0xc5e7('0x52')]){_0x8afd83[_0xc5e7('0x50')]=_[_0xc5e7('0x53')](_0x8afd83[_0xc5e7('0x50')],{'$or':_[_0xc5e7('0x40')](_0x8afd83[_0xc5e7('0x4b')],function(_0x23b946){var _0x1f4703={};_0x1f4703[_0x23b946]={'$like':'%'+_0x9bc154[_0xc5e7('0x46')][_0xc5e7('0x52')]+'%'};return _0x1f4703;})});}_0x8afd83=_[_0xc5e7('0x53')]({},_0x8afd83,_0x9bc154[_0xc5e7('0x55')]);return db[_0xc5e7('0x6a')]['count']({'where':_0x8afd83[_0xc5e7('0x50')]})['then'](function(_0x23fbf2){_0x2b82b4[_0xc5e7('0x2d')]=_0x23fbf2;if(_0x9bc154['query'][_0xc5e7('0x5b')]){_0x8afd83[_0xc5e7('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc5e7('0x58')](_0x8afd83);})['then'](function(_0x45ae24){_0x2b82b4[_0xc5e7('0x59')]=_0x45ae24;return _0x2b82b4;});}})[_0xc5e7('0x31')](respondWithFilteredResult(_0x4eb504,_0x8afd83))[_0xc5e7('0x26')](handleError(_0x4eb504,null));};exports[_0xc5e7('0x6c')]=function(_0x55a99f,_0xf194b9,_0x13b30f){return db['MailAccount'][_0xc5e7('0x5c')]({'where':{'id':_0x55a99f[_0xc5e7('0x5e')]['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0xf194b9,null))[_0xc5e7('0x31')](function(_0x260ee0){if(_0x260ee0){return _0x260ee0['removeAnswers'](_0x55a99f[_0xc5e7('0x46')][_0xc5e7('0x6d')]);}})[_0xc5e7('0x31')](respondWithStatusCode(_0xf194b9,null))[_0xc5e7('0x26')](handleError(_0xf194b9,null));};exports['create']=function(_0x1e4882,_0x3004b0){var _0x296139={'name':_0x1e4882['body'][_0xc5e7('0x36')],'key':_0x1e4882['body'][_0xc5e7('0x44')],'email':_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x6e')],'ListId':_0x1e4882[_0xc5e7('0x38')]['ListId'],'active':!_[_0xc5e7('0x6f')](_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x70')])?_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x70')]:!![],'description':_0x1e4882[_0xc5e7('0x38')]['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x71')])){if(_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x72')]){_0x296139[_0xc5e7('0x3d')][_0xc5e7('0x73')]=_0x296139[_0xc5e7('0x3e')][_0xc5e7('0x73')]=_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x74')];_0x296139['Imap'][_0xc5e7('0x75')]=_0x296139['Smtp'][_0xc5e7('0x76')]=_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x77')];}else{_0x296139['Imap']['authentication']=_0x296139[_0xc5e7('0x3e')][_0xc5e7('0x78')]=![];}_0x296139[_0xc5e7('0x3d')][_0xc5e7('0x79')]=_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x3d')][_0xc5e7('0x79')];_0x296139[_0xc5e7('0x3d')]['port']=_0x1e4882[_0xc5e7('0x38')]['Imap'][_0xc5e7('0x7a')];_0x296139['Smtp']['host']=_0x1e4882['body'][_0xc5e7('0x3e')][_0xc5e7('0x79')];_0x296139[_0xc5e7('0x3e')][_0xc5e7('0x7a')]=_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x3e')][_0xc5e7('0x7a')];}else{_0x296139[_0xc5e7('0x3d')][_0xc5e7('0x7b')]=_0x296139[_0xc5e7('0x3e')][_0xc5e7('0x7b')]=_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x71')];_0x296139[_0xc5e7('0x3d')]['user']=_0x296139[_0xc5e7('0x3e')][_0xc5e7('0x73')]=_0x1e4882[_0xc5e7('0x38')][_0xc5e7('0x74')];_0x296139[_0xc5e7('0x3d')][_0xc5e7('0x75')]=_0x296139[_0xc5e7('0x3e')][_0xc5e7('0x76')]=_0x1e4882['body'][_0xc5e7('0x77')];}return db[_0xc5e7('0x56')][_0xc5e7('0x63')](_0x296139,{'include':[{'model':db[_0xc5e7('0x5a')],'as':_0xc5e7('0x3e')},{'model':db['MailServerIn'],'as':_0xc5e7('0x3d')}]})[_0xc5e7('0x31')](function(_0x33014e){var _0x442d8d=_0x1e4882[_0xc5e7('0x73')]['get']({'plain':!![]});if(!_0x442d8d)throw new Error(_0xc5e7('0x7c'));if(_0x442d8d[_0xc5e7('0x7d')]==='user'){var _0x4aced2=_0x33014e['get']({'plain':!![]});return db[_0xc5e7('0x7e')][_0xc5e7('0x5c')]({'where':{'name':_0xc5e7('0x7f'),'userProfileId':_0x442d8d[_0xc5e7('0x80')]},'raw':!![]})[_0xc5e7('0x31')](function(_0xaf868){if(_0xaf868&&_0xaf868[_0xc5e7('0x81')]===0x0){return db[_0xc5e7('0x34')]['create']({'name':_0x4aced2[_0xc5e7('0x36')],'resourceId':_0x4aced2['id'],'type':_0xaf868[_0xc5e7('0x36')],'sectionId':_0xaf868['id']},{})['then'](function(){return _0x33014e;});}else{return _0x33014e;}})[_0xc5e7('0x26')](function(_0x2f4f85){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f4f85);throw _0x2f4f85;});}return _0x33014e;})[_0xc5e7('0x31')](respondWithResult(_0x3004b0,0xc9))[_0xc5e7('0x26')](handleError(_0x3004b0,null));};exports[_0xc5e7('0x82')]=function(_0x4d3a0a,_0x1fa313,_0x37ebec){return db[_0xc5e7('0x56')]['findOne']({'where':{'id':_0x4d3a0a['params']['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x1fa313,null))[_0xc5e7('0x31')](function(_0x3e1254){if(_0x3e1254){return _0x3e1254[_0xc5e7('0x82')]();}return null;})[_0xc5e7('0x31')](respondWithResult(_0x1fa313,null))[_0xc5e7('0x26')](handleError(_0x1fa313,null));};exports[_0xc5e7('0x83')]=function(_0x52e301,_0x5f21ce,_0x46de8b){if(_0x52e301[_0xc5e7('0x38')]['id']){delete _0x52e301[_0xc5e7('0x38')]['id'];}return db['MailAccount'][_0xc5e7('0x5c')]({'where':{'id':_0x52e301[_0xc5e7('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5f21ce,null))[_0xc5e7('0x31')](function(_0x39b964){if(_0x39b964){_0x52e301[_0xc5e7('0x38')]['MailAccountId']=_0x39b964['id'];return db[_0xc5e7('0x3c')][_0xc5e7('0x63')](_0x52e301['body']);}})[_0xc5e7('0x31')](respondWithResult(_0x5f21ce,null))[_0xc5e7('0x26')](handleError(_0x5f21ce,null));};exports[_0xc5e7('0x84')]=function(_0x108b35,_0x2bf6d3,_0x1f22d2){return db[_0xc5e7('0x56')][_0xc5e7('0x65')]({'where':{'id':_0x108b35[_0xc5e7('0x5e')]['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x2bf6d3,null))[_0xc5e7('0x31')](function(_0x2c0d0f){if(_0x2c0d0f){return _0x2c0d0f[_0xc5e7('0x85')](null);}return null;})[_0xc5e7('0x31')](respondWithStatusCode(_0x2bf6d3,null))[_0xc5e7('0x26')](handleError(_0x2bf6d3,null));};exports[_0xc5e7('0x86')]=function(_0x24f679,_0xf6f8ec,_0x25f148){return db[_0xc5e7('0x56')]['findOne']({'where':{'id':_0x24f679[_0xc5e7('0x5e')]['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0xf6f8ec,null))['then'](function(_0x1cb831){if(_0x1cb831){return _0x1cb831[_0xc5e7('0x86')]();}return null;})[_0xc5e7('0x31')](respondWithResult(_0xf6f8ec,null))['catch'](handleError(_0xf6f8ec,null));};exports[_0xc5e7('0x87')]=function(_0x4c8582,_0x415edf,_0x291e0a){if(_0x4c8582[_0xc5e7('0x38')]['id']){delete _0x4c8582[_0xc5e7('0x38')]['id'];}return db['MailAccount'][_0xc5e7('0x5c')]({'where':{'id':_0x4c8582['params']['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x415edf,null))[_0xc5e7('0x31')](function(_0x3d930b){if(_0x3d930b){_0x4c8582['body'][_0xc5e7('0x62')]=_0x3d930b['id'];return db[_0xc5e7('0x5a')]['create'](_0x4c8582[_0xc5e7('0x38')]);}})['then'](respondWithResult(_0x415edf,null))[_0xc5e7('0x26')](handleError(_0x415edf,null));};exports[_0xc5e7('0x88')]=function(_0x395d60,_0x3e5d20,_0x195122){return db['MailAccount'][_0xc5e7('0x65')]({'where':{'id':_0x395d60['params']['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x3e5d20,null))[_0xc5e7('0x31')](function(_0x5899c3){if(_0x5899c3){return _0x5899c3[_0xc5e7('0x89')](null);}return null;})[_0xc5e7('0x31')](respondWithStatusCode(_0x3e5d20,null))[_0xc5e7('0x26')](handleError(_0x3e5d20,null));};exports[_0xc5e7('0x8a')]=function(_0x4b1fb8,_0x2c9953,_0xb12e6f){return db['MailInteraction'][_0xc5e7('0x5c')]({'where':{'id':_0x4b1fb8['params']['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x2c9953,null))['then'](function(_0x15c120){if(_0x15c120){return _0x15c120[_0xc5e7('0x8a')](_0x4b1fb8[_0xc5e7('0x38')][_0xc5e7('0x6d')],_['omit'](_0x4b1fb8['body'],['ids','id'])||{});}})[_0xc5e7('0x31')](respondWithResult(_0x2c9953,null))['catch'](handleError(_0x2c9953,null));};exports[_0xc5e7('0x8b')]=function(_0x1f3422,_0xc7068b,_0x5f040e){var _0x5c4dc0={'raw':![],'where':{}};var _0x35e8a8={};var _0x2dfe6a={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1f3422[_0xc5e7('0x5e')]['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0xc7068b,null))[_0xc5e7('0x31')](function(_0x241b23){if(_0x241b23){_0x35e8a8[_0xc5e7('0x45')]=_[_0xc5e7('0x47')](db[_0xc5e7('0x8c')][_0xc5e7('0x41')]);_0x35e8a8['query']=_['keys'](_0x1f3422['query']);_0x35e8a8[_0xc5e7('0x48')]=_[_0xc5e7('0x49')](_0x35e8a8[_0xc5e7('0x45')],_0x35e8a8[_0xc5e7('0x46')]);_0x5c4dc0[_0xc5e7('0x4b')]=_[_0xc5e7('0x49')](_0x35e8a8[_0xc5e7('0x45')],qs[_0xc5e7('0x4a')](_0x1f3422['query'][_0xc5e7('0x4a')]));_0x5c4dc0[_0xc5e7('0x4b')]=_0x5c4dc0[_0xc5e7('0x4b')][_0xc5e7('0x4c')]?_0x5c4dc0[_0xc5e7('0x4b')]:_0x35e8a8[_0xc5e7('0x45')];if(!_0x1f3422[_0xc5e7('0x46')][_0xc5e7('0x4d')](_0xc5e7('0x4e'))){_0x5c4dc0['limit']=qs['limit'](_0x1f3422[_0xc5e7('0x46')][_0xc5e7('0x2b')]);_0x5c4dc0['offset']=qs[_0xc5e7('0x2a')](_0x1f3422['query'][_0xc5e7('0x2a')]);}_0x5c4dc0['order']=qs[_0xc5e7('0x4f')](_0x1f3422[_0xc5e7('0x46')][_0xc5e7('0x4f')]);_0x5c4dc0['where']=qs[_0xc5e7('0x48')](_['pick'](_0x1f3422[_0xc5e7('0x46')],_0x35e8a8[_0xc5e7('0x48')]));_0x5c4dc0[_0xc5e7('0x50')][_0xc5e7('0x62')]=_0x241b23['id'];if(_0x1f3422['query'][_0xc5e7('0x52')]){_0x5c4dc0[_0xc5e7('0x50')]=_[_0xc5e7('0x53')](_0x5c4dc0[_0xc5e7('0x50')],{'$or':_['map'](_0x5c4dc0[_0xc5e7('0x4b')],function(_0x440a4b){var _0x3f2250={};_0x3f2250[_0x440a4b]={'$like':'%'+_0x1f3422[_0xc5e7('0x46')]['filter']+'%'};return _0x3f2250;})});}_0x5c4dc0=_['merge']({},_0x5c4dc0,_0x1f3422[_0xc5e7('0x55')]);return db[_0xc5e7('0x8c')][_0xc5e7('0x2d')]({'where':_0x5c4dc0[_0xc5e7('0x50')]})[_0xc5e7('0x31')](function(_0x335464){_0x2dfe6a[_0xc5e7('0x2d')]=_0x335464;if(_0x1f3422['query'][_0xc5e7('0x5b')]){_0x5c4dc0[_0xc5e7('0x57')]=[{'model':db[_0xc5e7('0x8d')],'as':_0xc5e7('0x8e'),'required':![]},{'model':db[_0xc5e7('0x8f')],'as':_0xc5e7('0x90'),'attributes':[_0xc5e7('0x36'),_0xc5e7('0x91'),'internal'],'required':![]},{'model':db[_0xc5e7('0x92')],'as':_0xc5e7('0x93'),'attributes':['id',_0xc5e7('0x36'),_0xc5e7('0x94')],'where':_0x1f3422['query'][_0xc5e7('0x95')]?{'id':_0x1f3422['query']['tag']}:undefined,'required':_0x1f3422[_0xc5e7('0x46')]['tag']?!![]:![]}];}return db[_0xc5e7('0x8c')]['findAll'](_0x5c4dc0);})[_0xc5e7('0x31')](function(_0x1055c5){_0x2dfe6a[_0xc5e7('0x59')]=_0x1055c5;return _0x2dfe6a;});}})['then'](respondWithFilteredResult(_0xc7068b,_0x5c4dc0))[_0xc5e7('0x26')](handleError(_0xc7068b,null));};exports[_0xc5e7('0x96')]=function(_0x4763b3,_0xae89d7,_0x1d0a1d){return db[_0xc5e7('0x56')]['findOne']({'where':{'id':_0x4763b3['params']['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0xae89d7,null))[_0xc5e7('0x31')](function(_0x391ead){if(_0x391ead){return db[_0xc5e7('0x97')]['transaction'](function(_0x4893b5){return db[_0xc5e7('0x98')][_0xc5e7('0x32')]({'where':{'MailAccountId':_0x4763b3[_0xc5e7('0x5e')]['id']},'transaction':_0x4893b5})[_0xc5e7('0x31')](function(_0xade9e8){var _0x14b9b5=_[_0xc5e7('0x40')](_0x4763b3['body'],function(_0x115d2a){_0x115d2a[_0xc5e7('0x62')]=_0x4763b3['params']['id'];return _0x115d2a;});return db['MailApplication']['bulkCreate'](_0x14b9b5,{'transaction':_0x4893b5});});})['then'](function(){return db['MailApplication'][_0xc5e7('0x99')]({'where':{'MailAccountId':_0x4763b3['params']['id']},'order':_0xc5e7('0x9a')});});}})[_0xc5e7('0x31')](respondWithResult(_0xae89d7,null))[_0xc5e7('0x26')](handleError(_0xae89d7,null));};exports[_0xc5e7('0x9b')]=function(_0x594c20,_0x1e3246,_0x33aa65){var _0xa427={};var _0x4ea8e9={};var _0x1a602c;var _0xfa5a29;return db[_0xc5e7('0x56')][_0xc5e7('0x65')]({'where':{'id':_0x594c20['params']['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x1e3246,null))[_0xc5e7('0x31')](function(_0x5cb974){if(_0x5cb974){_0x1a602c=_0x5cb974;_0x4ea8e9[_0xc5e7('0x45')]=_['keys'](db[_0xc5e7('0x98')]['rawAttributes']);_0x4ea8e9['query']=_[_0xc5e7('0x47')](_0x594c20['query']);_0x4ea8e9['filters']=_['intersection'](_0x4ea8e9[_0xc5e7('0x45')],_0x4ea8e9[_0xc5e7('0x46')]);_0xa427[_0xc5e7('0x4b')]=_['intersection'](_0x4ea8e9[_0xc5e7('0x45')],qs[_0xc5e7('0x4a')](_0x594c20[_0xc5e7('0x46')][_0xc5e7('0x4a')]));_0xa427[_0xc5e7('0x4b')]=_0xa427[_0xc5e7('0x4b')]['length']?_0xa427['attributes']:_0x4ea8e9['model'];_0xa427['order']=qs['sort'](_0x594c20[_0xc5e7('0x46')]['sort']);_0xa427[_0xc5e7('0x50')]=qs[_0xc5e7('0x48')](_[_0xc5e7('0x51')](_0x594c20['query'],_0x4ea8e9[_0xc5e7('0x48')]));if(_0x594c20[_0xc5e7('0x46')]['filter']){_0xa427['where']=_[_0xc5e7('0x53')](_0xa427[_0xc5e7('0x50')],{'$or':_[_0xc5e7('0x40')](_0xa427[_0xc5e7('0x4b')],function(_0x502cf7){var _0x5f58ad={};_0x5f58ad[_0x502cf7]={'$like':'%'+_0x594c20['query'][_0xc5e7('0x52')]+'%'};return _0x5f58ad;})});}_0xa427=_[_0xc5e7('0x53')]({},_0xa427,_0x594c20[_0xc5e7('0x55')]);return _0x1a602c[_0xc5e7('0x9b')](_0xa427);}})['then'](function(_0x56e6f1){if(_0x56e6f1){_0xfa5a29=_0x56e6f1[_0xc5e7('0x4c')];if(!_0x594c20[_0xc5e7('0x46')][_0xc5e7('0x4d')](_0xc5e7('0x4e'))){_0xa427[_0xc5e7('0x2b')]=qs[_0xc5e7('0x2b')](_0x594c20['query'][_0xc5e7('0x2b')]);_0xa427[_0xc5e7('0x2a')]=qs[_0xc5e7('0x2a')](_0x594c20[_0xc5e7('0x46')][_0xc5e7('0x2a')]);}return _0x1a602c[_0xc5e7('0x9b')](_0xa427);}})[_0xc5e7('0x31')](function(_0x2c2cca){if(_0x2c2cca){return _0x2c2cca?{'count':_0xfa5a29,'rows':_0x2c2cca}:null;}})[_0xc5e7('0x31')](respondWithResult(_0x1e3246,null))['catch'](handleError(_0x1e3246,null));};exports['getMessages']=function(_0x398f8b,_0x4b7da3,_0x1b4156){var _0x10bfd4={'raw':!![],'where':{}};var _0x36906b={};var _0x3c6529={'count':0x0,'rows':[]};return db[_0xc5e7('0x56')][_0xc5e7('0x65')]({'where':{'id':_0x398f8b[_0xc5e7('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4b7da3,null))['then'](function(_0x1eea84){if(_0x1eea84){_0x36906b['model']=_[_0xc5e7('0x47')](db[_0xc5e7('0x9c')][_0xc5e7('0x41')]);_0x36906b['query']=_[_0xc5e7('0x47')](_0x398f8b[_0xc5e7('0x46')]);_0x36906b[_0xc5e7('0x48')]=_[_0xc5e7('0x49')](_0x36906b[_0xc5e7('0x45')],_0x36906b['query']);_0x10bfd4['attributes']=_[_0xc5e7('0x49')](_0x36906b[_0xc5e7('0x45')],qs['fields'](_0x398f8b[_0xc5e7('0x46')][_0xc5e7('0x4a')]));_0x10bfd4[_0xc5e7('0x4b')]=_0x10bfd4[_0xc5e7('0x4b')][_0xc5e7('0x4c')]?_0x10bfd4[_0xc5e7('0x4b')]:_0x36906b[_0xc5e7('0x45')];if(!_0x398f8b[_0xc5e7('0x46')][_0xc5e7('0x4d')](_0xc5e7('0x4e'))){_0x10bfd4[_0xc5e7('0x2b')]=qs['limit'](_0x398f8b[_0xc5e7('0x46')][_0xc5e7('0x2b')]);_0x10bfd4[_0xc5e7('0x2a')]=qs[_0xc5e7('0x2a')](_0x398f8b[_0xc5e7('0x46')][_0xc5e7('0x2a')]);}_0x10bfd4[_0xc5e7('0x67')]=qs[_0xc5e7('0x4f')](_0x398f8b['query'][_0xc5e7('0x4f')]);_0x10bfd4['where']=qs['filters'](_[_0xc5e7('0x51')](_0x398f8b[_0xc5e7('0x46')],_0x36906b[_0xc5e7('0x48')]));_0x10bfd4[_0xc5e7('0x50')][_0xc5e7('0x62')]=_0x1eea84['id'];if(_0x398f8b[_0xc5e7('0x46')][_0xc5e7('0x52')]){_0x10bfd4[_0xc5e7('0x50')]=_[_0xc5e7('0x53')](_0x10bfd4['where'],{'$or':_[_0xc5e7('0x40')](_0x10bfd4[_0xc5e7('0x4b')],function(_0x3049bb){var _0x21bff3={};_0x21bff3[_0x3049bb]={'$like':'%'+_0x398f8b['query'][_0xc5e7('0x52')]+'%'};return _0x21bff3;})});}if(_0x398f8b[_0xc5e7('0x46')]['$gte']){var _0x5e21e5=_0x398f8b[_0xc5e7('0x46')]['$gte'][_0xc5e7('0x9d')](',');var _0x3d5230={};_0x3d5230[_0x5e21e5[0x0]]={'$gte':moment(_0x5e21e5[0x1])[_0xc5e7('0x9e')](_0xc5e7('0x9f'))};_0x10bfd4[_0xc5e7('0x50')]=_[_0xc5e7('0x53')](_0x10bfd4[_0xc5e7('0x50')],_0x3d5230);}_0x10bfd4=_[_0xc5e7('0x53')]({},_0x10bfd4,_0x398f8b[_0xc5e7('0x55')]);return db[_0xc5e7('0x9c')][_0xc5e7('0x2d')]({'where':_0x10bfd4[_0xc5e7('0x50')]})[_0xc5e7('0x31')](function(_0x59948c){_0x3c6529['count']=_0x59948c;if(_0x398f8b[_0xc5e7('0x46')][_0xc5e7('0x5b')]){_0x10bfd4[_0xc5e7('0x57')]=[{'all':!![]}];}return db['MailMessage'][_0xc5e7('0x58')](_0x10bfd4);})[_0xc5e7('0x31')](function(_0x3808b2){if(_0x398f8b[_0xc5e7('0x46')][_0xc5e7('0xa0')]===_0xc5e7('0xa1')){for(var _0x1f63ff=0x0;_0x1f63ff<_0x3808b2['length'];_0x1f63ff++){_0x3808b2[_0x1f63ff][_0xc5e7('0x38')]=juice(_0x3808b2[_0x1f63ff][_0xc5e7('0x38')]);}}_0x3c6529[_0xc5e7('0x59')]=_0x3808b2;return _0x3c6529;});}})[_0xc5e7('0x31')](respondWithFilteredResult(_0x4b7da3,_0x10bfd4))[_0xc5e7('0x26')](handleError(_0x4b7da3,null));};exports['send']=function(_0x1a4059,_0x557d8a,_0x9bada8){var _0x78330f,_0x3dcd67={},_0x2b6097;if(_0x1a4059[_0xc5e7('0x38')]['to']){_0x2b6097=_0x1a4059[_0xc5e7('0x38')]['to']['split'](',')[0x0];}return db[_0xc5e7('0x56')][_0xc5e7('0x5c')]({'where':{'id':_0x1a4059[_0xc5e7('0x5e')]['id']},'include':[{'model':db[_0xc5e7('0xa2')],'as':_0xc5e7('0xa3'),'include':[{'model':db['CmContact'],'as':_0xc5e7('0xa4'),'where':{'email':_0x2b6097},'limit':0x1,'order':[[_0xc5e7('0xa5'),'DESC']]}]},{'model':db[_0xc5e7('0x5a')],'as':_0xc5e7('0x3e'),'raw':!![]}]})[_0xc5e7('0x31')](handleEntityNotFound(_0x557d8a,null))[_0xc5e7('0x31')](function(_0x373668){if(_0x373668){_0x78330f=_0x373668;if(_0x373668[_0xc5e7('0x3e')]){if(_[_0xc5e7('0x6f')](_0x1a4059[_0xc5e7('0x38')][_0xc5e7('0xa6')])){_0x1a4059[_0xc5e7('0x38')][_0xc5e7('0xa6')]=util[_0xc5e7('0x9e')](_0xc5e7('0xa7'),_0x373668[_0xc5e7('0x36')],_0x373668[_0xc5e7('0x6e')]||_0x373668[_0xc5e7('0x3e')][_0xc5e7('0x73')]);}if(_0x1a4059[_0xc5e7('0x38')][_0xc5e7('0xa8')]&&_0x1a4059['body']['attachments'][_0xc5e7('0x4c')]){for(var _0x4058a6=0x0;_0x4058a6<_0x1a4059['body'][_0xc5e7('0xa8')][_0xc5e7('0x4c')];_0x4058a6+=0x1){_0x1a4059[_0xc5e7('0x38')][_0xc5e7('0xa8')][_0x4058a6]={'filename':_0x1a4059[_0xc5e7('0x38')][_0xc5e7('0xa8')][_0x4058a6][_0xc5e7('0x36')],'path':path[_0xc5e7('0xa9')](config[_0xc5e7('0xaa')],_0xc5e7('0xab'),_0x1a4059[_0xc5e7('0x38')][_0xc5e7('0xa8')][_0x4058a6][_0xc5e7('0xac')])};}}var _0x3051f4={'tls':{'rejectUnauthorized':![]}};if(_[_0xc5e7('0x6f')](_0x373668['Smtp'][_0xc5e7('0x7b')])){if(_0x373668[_0xc5e7('0x3e')][_0xc5e7('0x78')]){_0x3051f4[_0xc5e7('0xad')]={'user':_0x373668['Smtp'][_0xc5e7('0x73')],'pass':_0x373668[_0xc5e7('0x3e')][_0xc5e7('0x76')]};}_0x3051f4[_0xc5e7('0x79')]=_0x373668[_0xc5e7('0x3e')][_0xc5e7('0x79')];_0x3051f4[_0xc5e7('0x7a')]=_0x373668[_0xc5e7('0x3e')][_0xc5e7('0x7a')];_0x3051f4[_0xc5e7('0xae')]=_0x373668[_0xc5e7('0x3e')][_0xc5e7('0xae')];}else{_0x3051f4[_0xc5e7('0x7b')]=_0x373668[_0xc5e7('0x3e')][_0xc5e7('0x7b')];_0x3051f4[_0xc5e7('0xad')]={'user':_0x373668[_0xc5e7('0x3e')][_0xc5e7('0x73')],'pass':_0x373668['Smtp'][_0xc5e7('0x76')]};}return respondWithRpcPromise('SendMail',_0xc5e7('0xaf'),{'account':_0x3051f4,'message':_0x1a4059[_0xc5e7('0x38')]});}else{throw new Error(_0xc5e7('0xb0'));}}})['then'](function(_0x30984f){if(_0x30984f){_0x3dcd67=_0x30984f;if(_0x78330f['List']){if(_0x78330f[_0xc5e7('0xa3')][_0xc5e7('0xa4')]['length']){return _0x78330f['List'][_0xc5e7('0xa4')][0x0];}else{return db[_0xc5e7('0x8d')]['create'](_[_0xc5e7('0x15')](_0x1a4059['body'],{'firstName':_0x1a4059[_0xc5e7('0x38')]['to'],'email':_0x1a4059[_0xc5e7('0x38')]['to'],'phone':_0x1a4059[_0xc5e7('0x38')]['to'],'ListId':_0x78330f[_0xc5e7('0xb1')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xc5e7('0x31')](function(_0x15e6ee){if(_0x15e6ee){var _0x5db2d4={'UserId':_0x1a4059['user']['id'],'ContactId':_0x15e6ee['id'],'MailAccountId':_0x78330f['id'],'inReplyTo':_0x3dcd67['messageId'],'to':_0x1a4059[_0xc5e7('0x38')]['from'],'cc':_0x1a4059[_0xc5e7('0x38')]['cc'],'subject':_0x1a4059[_0xc5e7('0x38')][_0xc5e7('0xb2')],'attach':_0x1a4059[_0xc5e7('0x38')][_0xc5e7('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xc5e7('0x9e')](_0xc5e7('0x9f')),'lastMsgDirection':'out','Messages':[_['merge'](_0x1a4059[_0xc5e7('0x38')],{'messageId':_0x3dcd67[_0xc5e7('0xb4')],'sentAt':moment()[_0xc5e7('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x78330f['id'],'UserId':_0x1a4059[_0xc5e7('0x73')]['id'],'ContactId':_0x15e6ee['id']})]};if(_0x1a4059[_0xc5e7('0x38')][_0xc5e7('0xb5')]){_0x5db2d4=_['merge'](_0x5db2d4,_0x1a4059[_0xc5e7('0x38')][_0xc5e7('0xb5')]);}return db[_0xc5e7('0x8c')]['create'](_0x5db2d4,{'include':[{'model':db[_0xc5e7('0x9c')],'as':'Messages'}]});}})[_0xc5e7('0x31')](respondWithResult(_0x557d8a,null))['catch'](handleError(_0x557d8a,null));};exports[_0xc5e7('0xb6')]=function(_0x84c761,_0x595ae3,_0x42da0c){return db[_0xc5e7('0x56')]['find']({'where':{'id':_0x84c761[_0xc5e7('0x5e')]['id']},'include':[{'model':db[_0xc5e7('0x5a')],'as':_0xc5e7('0x3e'),'raw':!![]}]})[_0xc5e7('0x31')](handleEntityNotFound(_0x595ae3,null))[_0xc5e7('0x31')](function(_0x5c4d84){if(_0x5c4d84&&_0x5c4d84[_0xc5e7('0x3e')]){var _0x1a7558={'id':_0x5c4d84['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5c4d84['Smtp']['service']){_0x1a7558[_0xc5e7('0x7b')]=_0x5c4d84[_0xc5e7('0x3e')]['service'];}else{_0x1a7558[_0xc5e7('0x79')]=_0x5c4d84[_0xc5e7('0x3e')]['host'];_0x1a7558[_0xc5e7('0x7a')]=_0x5c4d84[_0xc5e7('0x3e')][_0xc5e7('0x7a')];_0x1a7558[_0xc5e7('0xae')]=_0x5c4d84[_0xc5e7('0x3e')][_0xc5e7('0xae')];}if(_0x5c4d84['Smtp'][_0xc5e7('0x78')]){_0x1a7558[_0xc5e7('0xad')]={'user':_0x5c4d84[_0xc5e7('0x3e')][_0xc5e7('0x73')],'pass':_0x5c4d84[_0xc5e7('0x3e')][_0xc5e7('0x76')]};}return respondWithRpcPromise(_0xc5e7('0xb7'),'verifySmtp',{'account':_0x1a7558});}})['then'](respondWithResult(_0x595ae3,null))[_0xc5e7('0x26')](handleError(_0x595ae3,null));};exports[_0xc5e7('0x32')]=function(_0x41a4d6,_0x55180e){return db[_0xc5e7('0x56')][_0xc5e7('0x5c')]({'where':{'id':_0x41a4d6['params']['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x55180e,null))[_0xc5e7('0x31')](function(_0x11e4e7){if(_0x11e4e7&&_0x11e4e7[_0xc5e7('0x7b')]){throw new db[(_0xc5e7('0xb8'))]['ValidationError'](_0xc5e7('0xb9'));}return _0x11e4e7;})[_0xc5e7('0x31')](removeEntity(_0x55180e,null))[_0xc5e7('0x26')](handleError(_0x55180e,null));};exports[_0xc5e7('0xba')]=function(_0x10b8ef,_0x1b5db1,_0x56deb7){return db[_0xc5e7('0x56')][_0xc5e7('0x5c')]({'where':{'id':_0x10b8ef[_0xc5e7('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1b5db1,null))[_0xc5e7('0x31')](function(_0x2ac017){if(_0x2ac017){return _0x2ac017[_0xc5e7('0xba')](_0x10b8ef['body']['ids'],_[_0xc5e7('0xbb')](_0x10b8ef[_0xc5e7('0x38')],['ids','id'])||{})[_0xc5e7('0xbc')](function(_0x515797){for(var _0x5ca1f9=0x0;_0x5ca1f9<_0x10b8ef['body'][_0xc5e7('0x6d')][_0xc5e7('0x4c')];_0x5ca1f9+=0x1){socket['emit'](_0xc5e7('0xbd'),{'UserId':_0x10b8ef[_0xc5e7('0x38')]['ids'][_0x5ca1f9],'MailAccountId':_0x10b8ef['params']['id']});}return _0x515797;});}})[_0xc5e7('0x31')](respondWithResult(_0x1b5db1,null))[_0xc5e7('0x26')](handleError(_0x1b5db1,null));};exports[_0xc5e7('0xbe')]=function(_0x18ca42,_0x174bb1,_0x386bf5){return db[_0xc5e7('0x56')][_0xc5e7('0x5c')]({'where':{'id':_0x18ca42[_0xc5e7('0x5e')]['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x174bb1,null))['then'](function(_0xfe3e){if(_0xfe3e){return _0xfe3e[_0xc5e7('0xbe')](_0x18ca42[_0xc5e7('0x46')][_0xc5e7('0x6d')])[_0xc5e7('0x31')](function(){if(_[_0xc5e7('0xbf')](_0x18ca42[_0xc5e7('0x46')][_0xc5e7('0x6d')])){for(var _0x3f193f=0x0;_0x3f193f<_0x18ca42[_0xc5e7('0x46')]['ids'][_0xc5e7('0x4c')];_0x3f193f+=0x1){socket[_0xc5e7('0xc0')](_0xc5e7('0xc1'),{'UserId':Number(_0x18ca42[_0xc5e7('0x46')][_0xc5e7('0x6d')][_0x3f193f]),'MailAccountId':Number(_0x18ca42[_0xc5e7('0x5e')]['id'])});}}else{socket[_0xc5e7('0xc0')](_0xc5e7('0xc1'),{'UserId':Number(_0x18ca42['query'][_0xc5e7('0x6d')]),'MailAccountId':Number(_0x18ca42[_0xc5e7('0x5e')]['id'])});}});}})[_0xc5e7('0x31')](respondWithStatusCode(_0x174bb1,null))[_0xc5e7('0x26')](handleError(_0x174bb1,null));};exports[_0xc5e7('0xc2')]=function(_0xd3acd3,_0x25f65a,_0x3a1d75){var _0x4b6901={};var _0x5ddb64={};var _0x22c0a8;var _0x187641;return db[_0xc5e7('0x56')]['findOne']({'where':{'id':_0xd3acd3[_0xc5e7('0x5e')]['id']}})[_0xc5e7('0x31')](handleEntityNotFound(_0x25f65a,null))['then'](function(_0x46d618){if(_0x46d618){_0x22c0a8=_0x46d618;_0x5ddb64[_0xc5e7('0x45')]=_[_0xc5e7('0x47')](db[_0xc5e7('0x8f')][_0xc5e7('0x41')]);_0x5ddb64[_0xc5e7('0x46')]=_[_0xc5e7('0x47')](_0xd3acd3['query']);_0x5ddb64['filters']=_['intersection'](_0x5ddb64[_0xc5e7('0x45')],_0x5ddb64[_0xc5e7('0x46')]);_0x4b6901[_0xc5e7('0x4b')]=_[_0xc5e7('0x49')](_0x5ddb64[_0xc5e7('0x45')],qs[_0xc5e7('0x4a')](_0xd3acd3[_0xc5e7('0x46')][_0xc5e7('0x4a')]));_0x4b6901[_0xc5e7('0x4b')]=_0x4b6901['attributes']['length']?_0x4b6901['attributes']:_0x5ddb64[_0xc5e7('0x45')];_0x4b6901[_0xc5e7('0x67')]=qs[_0xc5e7('0x4f')](_0xd3acd3[_0xc5e7('0x46')][_0xc5e7('0x4f')]);_0x4b6901[_0xc5e7('0x50')]=qs['filters'](_[_0xc5e7('0x51')](_0xd3acd3[_0xc5e7('0x46')],_0x5ddb64[_0xc5e7('0x48')]));if(_0xd3acd3[_0xc5e7('0x46')][_0xc5e7('0x52')]){_0x4b6901[_0xc5e7('0x50')]=_[_0xc5e7('0x53')](_0x4b6901['where'],{'$or':_[_0xc5e7('0x40')](_0x4b6901[_0xc5e7('0x4b')],function(_0x55b785){var _0x5034f1={};_0x5034f1[_0x55b785]={'$like':'%'+_0xd3acd3[_0xc5e7('0x46')][_0xc5e7('0x52')]+'%'};return _0x5034f1;})});}_0x4b6901=_['merge']({},_0x4b6901,_0xd3acd3[_0xc5e7('0x55')]);return _0x22c0a8['getAgents'](_0x4b6901);}})[_0xc5e7('0x31')](function(_0x401485){if(_0x401485){_0x187641=_0x401485['length'];if(!_0xd3acd3[_0xc5e7('0x46')][_0xc5e7('0x4d')]('nolimit')){_0x4b6901['limit']=qs['limit'](_0xd3acd3[_0xc5e7('0x46')]['limit']);_0x4b6901[_0xc5e7('0x2a')]=qs[_0xc5e7('0x2a')](_0xd3acd3[_0xc5e7('0x46')][_0xc5e7('0x2a')]);}return _0x22c0a8[_0xc5e7('0xc2')](_0x4b6901);}})['then'](function(_0x58bdec){if(_0x58bdec){return _0x58bdec?{'count':_0x187641,'rows':_0x58bdec}:null;}})[_0xc5e7('0x31')](respondWithResult(_0x25f65a,null))[_0xc5e7('0x26')](handleError(_0x25f65a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 171af4e..bd2a7c8 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 _0xdbc1=['hook','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x150a69,_0x1b9494){var _0x12b4c0=function(_0x466df7){while(--_0x466df7){_0x150a69['push'](_0x150a69['shift']());}};_0x12b4c0(++_0x1b9494);}(_0xdbc1,0xa3));var _0x1dbc=function(_0x1b3e32,_0x49ad74){_0x1b3e32=_0x1b3e32-0x0;var _0x4796e3=_0xdbc1[_0x1b3e32];return _0x4796e3;};'use strict';var EventEmitter=require(_0x1dbc('0x0'));var MailAccount=require(_0x1dbc('0x1'))['db'][_0x1dbc('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1dbc('0x3')](0x0);var events={'afterCreate':_0x1dbc('0x4'),'afterUpdate':_0x1dbc('0x5'),'afterDestroy':_0x1dbc('0x6')};function emitEvent(_0x53011e){return function(_0x5a00af,_0x218468,_0x37b6e5){MailAccountEvents[_0x1dbc('0x7')](_0x53011e+':'+_0x5a00af['id'],_0x5a00af);MailAccountEvents['emit'](_0x53011e,_0x5a00af);_0x37b6e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x1dbc('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x2cef=['hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0x2cef,0x1a6));var _0xf2ce=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2cef[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0xf2ce('0x0'));var MailAccount=require(_0xf2ce('0x1'))['db'][_0xf2ce('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf2ce('0x3')](0x0);var events={'afterCreate':_0xf2ce('0x4'),'afterUpdate':_0xf2ce('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41d08c){return function(_0x127b69,_0x432a9e,_0x11d07c){MailAccountEvents[_0xf2ce('0x6')](_0x41d08c+':'+_0x127b69['id'],_0x127b69);MailAccountEvents[_0xf2ce('0x6')](_0x41d08c,_0x127b69);_0x11d07c(null);};}for(var e in events){if(events[_0xf2ce('0x7')](e)){var event=events[e];MailAccount[_0xf2ce('0x8')](e,emitEvent(event));}}module[_0xf2ce('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index b101bde..bb0c764 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 _0xb73b=['../../config/environment','./mailAccount.attributes','exports','define','MailAccount','lodash','api','bluebird','request-promise'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xb73b,0x1eb));var _0xbb73=function(_0xa49617,_0x9ac95b){_0xa49617=_0xa49617-0x0;var _0x2c8c3b=_0xb73b[_0xa49617];return _0x2c8c3b;};'use strict';var _=require(_0xbb73('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbb73('0x1'));var moment=require('moment');var BPromise=require(_0xbb73('0x2'));var rp=require(_0xbb73('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbb73('0x4'));var attributes=require(_0xbb73('0x5'));module[_0xbb73('0x6')]=function(_0x2ae3c3,_0x48dc47){return _0x2ae3c3[_0xbb73('0x7')](_0xbb73('0x8'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdddf=['path','rimraf','../../config/environment','exports','define','lodash','util','api','moment','request-promise'];(function(_0x14691c,_0xe1c878){var _0xbec98=function(_0x100b9e){while(--_0x100b9e){_0x14691c['push'](_0x14691c['shift']());}};_0xbec98(++_0xe1c878);}(_0xdddf,0x9b));var _0xfddd=function(_0xef264c,_0xa47f45){_0xef264c=_0xef264c-0x0;var _0xc12342=_0xdddf[_0xef264c];return _0xc12342;};'use strict';var _=require(_0xfddd('0x0'));var util=require(_0xfddd('0x1'));var logger=require('../../config/logger')(_0xfddd('0x2'));var moment=require(_0xfddd('0x3'));var BPromise=require('bluebird');var rp=require(_0xfddd('0x4'));var fs=require('fs');var path=require(_0xfddd('0x5'));var rimraf=require(_0xfddd('0x6'));var config=require(_0xfddd('0x7'));var attributes=require('./mailAccount.attributes');module[_0xfddd('0x8')]=function(_0x5c50bd,_0x86a8a4){return _0x5c50bd[_0xfddd('0x9')]('MailAccount',attributes,{'tableName':'mail_accounts','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 773d2eb..71ddd96 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 _0xe21f=['redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailAccount','raw','options','where','limit','include','model','attributes','map','then','GetMailAccount','ShowMailAccount','find','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','account','CmList','DESC','MailApplication','Applications','MailServerOut','Smtp','get','applications','list','List','orderBy','priority','asc','autoclose','length','close','*,*,*,*','Contacts','ListId','create','List\x20not\x20found','messageId','generate','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','subject','attachments','originTo','bcc','originChannel','Email','Attachment','Attachments','UserId','User','interaction','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x396a75,_0x1f40f6){var _0x32140e=function(_0xa316ee){while(--_0xa316ee){_0x396a75['push'](_0x396a75['shift']());}};_0x32140e(++_0x1f40f6);}(_0xe21f,0x1a0));var _0xfe21=function(_0xc9ee2e,_0x21ca3d){_0xc9ee2e=_0xc9ee2e-0x0;var _0x1e8c91=_0xe21f[_0xc9ee2e];return _0x1e8c91;};'use strict';var _=require('lodash');var util=require(_0xfe21('0x0'));var moment=require(_0xfe21('0x1'));var BPromise=require(_0xfe21('0x2'));var rs=require(_0xfe21('0x3'));var fs=require('fs');var Redis=require(_0xfe21('0x4'));var db=require(_0xfe21('0x5'))['db'];var utils=require(_0xfe21('0x6'));var logger=require('../../config/logger')(_0xfe21('0x7'));var config=require(_0xfe21('0x8'));var jayson=require(_0xfe21('0x9'));var client=jayson[_0xfe21('0xa')][_0xfe21('0xb')]({'port':0x232c});config[_0xfe21('0xc')]=_[_0xfe21('0xd')](config[_0xfe21('0xc')],{'host':_0xfe21('0xe'),'port':0x18eb});var socket=require(_0xfe21('0xf'))(new Redis(config['redis']));require(_0xfe21('0x10'))[_0xfe21('0x11')](socket);function respondWithRpcPromise(_0x5e590f,_0x51cc75,_0x30f603){return new BPromise(function(_0x46c79c,_0x35f99e){return client[_0xfe21('0x12')](_0x5e590f,_0x30f603)['then'](function(_0xfef3aa){logger['info'](_0xfe21('0x13'),_0x51cc75,_0xfe21('0x14'));logger[_0xfe21('0x15')](_0xfe21('0x16'),_0x51cc75,_0xfe21('0x14'),JSON[_0xfe21('0x17')](_0xfef3aa));if(_0xfef3aa[_0xfe21('0x18')]){if(_0xfef3aa[_0xfe21('0x18')][_0xfe21('0x19')]===0x1f4){logger[_0xfe21('0x18')]('MailAccount,\x20%s,\x20%s',_0x51cc75,_0xfef3aa['error'][_0xfe21('0x1a')]);return _0x35f99e(_0xfef3aa[_0xfe21('0x18')][_0xfe21('0x1a')]);}logger[_0xfe21('0x18')](_0xfe21('0x13'),_0x51cc75,_0xfef3aa['error'][_0xfe21('0x1a')]);return _0x46c79c(_0xfef3aa[_0xfe21('0x18')]['message']);}else{logger[_0xfe21('0x1b')]('MailAccount,\x20%s,\x20%s',_0x51cc75,'request\x20sent');_0x46c79c(_0xfef3aa[_0xfe21('0x1c')][_0xfe21('0x1a')]);}})[_0xfe21('0x1d')](function(_0x1076ab){logger['error'](_0xfe21('0x13'),_0x51cc75,_0x1076ab);_0x35f99e(_0x1076ab);});});}exports['GetMailAccount']=function(_0x402bea){var _0x389f9c=this;return new Promise(function(_0x42f080,_0x2116cd){return db[_0xfe21('0x1e')]['findAll']({'raw':_0x402bea['options']?_0x402bea['options'][_0xfe21('0x1f')]===undefined?!![]:![]:!![],'where':_0x402bea['options']?_0x402bea[_0xfe21('0x20')][_0xfe21('0x21')]||null:null,'attributes':_0x402bea[_0xfe21('0x20')]?_0x402bea[_0xfe21('0x20')]['attributes']||null:null,'limit':_0x402bea[_0xfe21('0x20')]?_0x402bea[_0xfe21('0x20')][_0xfe21('0x22')]||null:null,'include':_0x402bea[_0xfe21('0x20')]?_0x402bea[_0xfe21('0x20')][_0xfe21('0x23')]?_['map'](_0x402bea[_0xfe21('0x20')][_0xfe21('0x23')],function(_0x2c36bd){return{'model':db[_0x2c36bd[_0xfe21('0x24')]],'as':_0x2c36bd['as'],'attributes':_0x2c36bd[_0xfe21('0x25')],'include':_0x2c36bd['include']?_[_0xfe21('0x26')](_0x2c36bd['include'],function(_0x2f1aab){return{'model':db[_0x2f1aab[_0xfe21('0x24')]],'as':_0x2f1aab['as'],'attributes':_0x2f1aab[_0xfe21('0x25')],'include':_0x2f1aab[_0xfe21('0x23')]?_['map'](_0x2f1aab[_0xfe21('0x23')],function(_0x58d5c2){return{'model':db[_0x58d5c2[_0xfe21('0x24')]],'as':_0x58d5c2['as'],'attributes':_0x58d5c2['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe21('0x27')](function(_0x1d50fa){logger['info'](_0xfe21('0x28'),_0x402bea);logger['debug'](_0xfe21('0x28'),_0x402bea,JSON['stringify'](_0x1d50fa));_0x42f080(_0x1d50fa);})[_0xfe21('0x1d')](function(_0x263c5b){logger[_0xfe21('0x18')](_0xfe21('0x28'),_0x263c5b[_0xfe21('0x1a')],_0x402bea);_0x2116cd(_0x389f9c['error'](0x1f4,_0x263c5b[_0xfe21('0x1a')]));});});};exports[_0xfe21('0x29')]=function(_0xdf04ef){var _0x26fbb7=this;return new Promise(function(_0xecfbc6,_0x3bf091){return db[_0xfe21('0x1e')][_0xfe21('0x2a')]({'raw':_0xdf04ef[_0xfe21('0x20')]?_0xdf04ef[_0xfe21('0x20')][_0xfe21('0x1f')]===undefined?!![]:![]:!![],'where':_0xdf04ef[_0xfe21('0x20')]?_0xdf04ef[_0xfe21('0x20')]['where']||null:null,'attributes':_0xdf04ef[_0xfe21('0x20')]?_0xdf04ef[_0xfe21('0x20')]['attributes']||null:null,'include':_0xdf04ef['options']?_0xdf04ef[_0xfe21('0x20')][_0xfe21('0x23')]?_[_0xfe21('0x26')](_0xdf04ef[_0xfe21('0x20')][_0xfe21('0x23')],function(_0x12b42d){return{'model':db[_0x12b42d[_0xfe21('0x24')]],'as':_0x12b42d['as'],'attributes':_0x12b42d['attributes'],'include':_0x12b42d[_0xfe21('0x23')]?_['map'](_0x12b42d[_0xfe21('0x23')],function(_0x498731){return{'model':db[_0x498731[_0xfe21('0x24')]],'as':_0x498731['as'],'attributes':_0x498731[_0xfe21('0x25')],'include':_0x498731[_0xfe21('0x23')]?_[_0xfe21('0x26')](_0x498731[_0xfe21('0x23')],function(_0x109261){return{'model':db[_0x109261['model']],'as':_0x109261['as'],'attributes':_0x109261['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe21('0x27')](function(_0x6bcaba){logger[_0xfe21('0x1b')](_0xfe21('0x29'),_0xdf04ef);logger[_0xfe21('0x15')](_0xfe21('0x29'),_0xdf04ef,JSON['stringify'](_0x6bcaba));_0xecfbc6(_0x6bcaba);})[_0xfe21('0x1d')](function(_0x5db410){logger[_0xfe21('0x18')](_0xfe21('0x29'),_0x5db410['message'],_0xdf04ef);_0x3bf091(_0x26fbb7[_0xfe21('0x18')](0x1f4,_0x5db410[_0xfe21('0x1a')]));});});};exports['NotifyMailAccount']=function(_0x5920d8){var _0x350be7=this;return new Promise(function(_0x9ac19a,_0x203b90){var _0x17ac5c={'body':_0x5920d8[_0xfe21('0x2b')],'channel':_0xfe21('0x2c')};var _0x3b5a7a=_[_0xfe21('0x2d')](_[_0xfe21('0x2e')](db[_0xfe21('0x2f')]['rawAttributes']),[_0xfe21('0x30'),_0xfe21('0x31'),_0xfe21('0x32'),'ListId']);var _0x2fe414=![];if(_0x5920d8[_0xfe21('0x2b')]['id']){delete _0x5920d8[_0xfe21('0x2b')]['id'];}if(_[_0xfe21('0x33')](_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x34')])){return _0x203b90(_0x350be7[_0xfe21('0x18')](0x1f4,_0xfe21('0x35')));}if(_['isNil'](_0x5920d8['body']['body'])||_0x5920d8['body'][_0xfe21('0x2b')]===''){return _0x203b90(_0x350be7[_0xfe21('0x18')](0x1f4,_0xfe21('0x36')));}if(_[_0xfe21('0x33')](_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x37')])){return _0x203b90(_0x350be7['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b5a7a));}if(!_['includes'](_0x3b5a7a,_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x37')])){return _0x203b90(_0x350be7['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b5a7a));}var _0x10f3b6={};_0x10f3b6[_0x5920d8['body']['mapKey']]=_0x5920d8['body'][_0xfe21('0x34')];return db[_0xfe21('0x1e')]['find']({'where':{'id':_0x5920d8[_0xfe21('0x38')]['id']},'include':[{'model':db[_0xfe21('0x39')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x10f3b6,'limit':0x1,'order':[['updatedAt',_0xfe21('0x3a')]]}]},{'model':db[_0xfe21('0x3b')],'as':_0xfe21('0x3c')},{'model':db[_0xfe21('0x3d')],'as':_0xfe21('0x3e')}]})[_0xfe21('0x27')](function(_0x3aab0e){if(_0x3aab0e&&_0x3aab0e['List']){var _0x462333=_0x3aab0e[_0xfe21('0x3f')]({'plain':!![]});_0x17ac5c[_0xfe21('0x38')]=_['omit'](_0x462333,[_0xfe21('0x3c'),'List']);_0x17ac5c[_0xfe21('0x40')]=_0x462333[_0xfe21('0x3c')];_0x17ac5c[_0xfe21('0x41')]=_0x462333[_0xfe21('0x42')];_0x17ac5c['applications']=_[_0xfe21('0x43')](_0x17ac5c[_0xfe21('0x40')],[_0xfe21('0x44')],[_0xfe21('0x45')]);if(_0x17ac5c[_0xfe21('0x38')]&&_0x17ac5c[_0xfe21('0x38')][_0xfe21('0x46')]){_0x17ac5c[_0xfe21('0x40')]['push']({'id':0x0,'priority':_0x17ac5c['applications'][_0xfe21('0x47')]+0x1,'app':_0xfe21('0x48'),'appdata':'autoclose','interval':_0xfe21('0x49')});}if(_0x17ac5c[_0xfe21('0x38')][_0xfe21('0x3c')]){delete _0x17ac5c[_0xfe21('0x38')]['Applications'];}if(_0x17ac5c[_0xfe21('0x38')][_0xfe21('0x42')]){delete _0x17ac5c['account'][_0xfe21('0x42')];}if(_0x462333['List'][_0xfe21('0x4a')][_0xfe21('0x47')]){return _0x462333[_0xfe21('0x42')]['Contacts'][0x0];}var _0x4bbce9=_[_0xfe21('0xd')](_0x5920d8[_0xfe21('0x2b')],{'firstName':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x34')],'ListId':_0x462333[_0xfe21('0x4b')]});_0x4bbce9[_0x5920d8['body'][_0xfe21('0x37')]]=_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x34')];return db['CmContact'][_0xfe21('0x4c')](_0x4bbce9);}else{throw new Error(_0xfe21('0x4d'));}})[_0xfe21('0x27')](function(_0x5501c3){_0x17ac5c['contact']=_0x5501c3;if(_0x5501c3){if(!_0x5920d8[_0xfe21('0x2b')]['message'][_0xfe21('0x4e')]){_0x5920d8['body'][_0xfe21('0x1a')][_0xfe21('0x4e')]=rs[_0xfe21('0x4f')]()+'\x20'+_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x34')];}var _0x4652dd={'ContactId':_0x5501c3['id'],'MailAccountId':_0x5920d8[_0xfe21('0x38')]['id'],'inReplyTo':_0x5920d8['body']['message'][_0xfe21('0x4e')],'to':_0x5920d8[_0xfe21('0x2b')]['message']['from'],'cc':_0x5920d8['body'][_0xfe21('0x1a')]['cc'],'subject':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')]['subject'],'attach':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x50')],'lastMsgAt':moment()[_0xfe21('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xfe21('0x52')]['find']({'where':{'closed':![],'MailAccountId':_0x5920d8[_0xfe21('0x38')]['id']},'include':[{'model':db[_0xfe21('0x53')],'as':_0xfe21('0x54'),'attributes':[_0xfe21('0x4e')],'where':{'messageId':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x55')]}}]})[_0xfe21('0x27')](function(_0x5e9c28){if(_0x5e9c28){return[_0x5e9c28,![]];}return db['MailInteraction'][_0xfe21('0x4c')](_0x4652dd)[_0xfe21('0x27')](function(_0x3acc9e){return[_0x3acc9e,!![]];});});}else{throw new Error(_0xfe21('0x56'));}})[_0xfe21('0x57')](function(_0x278eb1,_0x2c4915){if(_0x278eb1){_0x2fe414=_0x2c4915;if(!_0x2c4915){return _0x278eb1[_0xfe21('0x58')]({'inReplyTo':_0x5920d8['body'][_0xfe21('0x1a')][_0xfe21('0x4e')],'to':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x34')],'cc':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')]['cc'],'subject':_0x5920d8[_0xfe21('0x2b')]['message']['subject'],'attach':_0x278eb1[_0xfe21('0x50')]?_0x278eb1[_0xfe21('0x50')]:_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x50')],'substatus':null,'substatusAt':moment()[_0xfe21('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0xfe21('0x59')),'lastMsgDirection':'in'});}else{return _0x278eb1;}}})[_0xfe21('0x27')](function(_0x16645b){_0x17ac5c['interaction']=_0x16645b[_0xfe21('0x3f')]({'plain':!![]});_0x17ac5c['interaction']['created']=_0x2fe414;return db[_0xfe21('0x53')]['create']({'body':_0x5920d8['body'][_0xfe21('0x2b')],'MailAccountId':_0x5920d8[_0xfe21('0x38')]['id'],'MailInteractionId':_0x16645b['id'],'direction':'in','ContactId':_0x17ac5c['contact']['id'],'messageId':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x4e')],'from':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x34')],'to':_0x5920d8['body'][_0xfe21('0x1a')]['to'],'cc':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')]['cc'],'subject':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x5a')],'attach':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x50')],'Attachments':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x5b')],'originTo':_0x5920d8[_0xfe21('0x2b')]['message'][_0xfe21('0x5c')],'originCc':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')]['originCc'],'bcc':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')][_0xfe21('0x5d')],'ChatWebsiteId':_0x5920d8[_0xfe21('0x2b')][_0xfe21('0x1a')]['ChatWebsiteId']||null,'originChannel':_0x5920d8['body'][_0xfe21('0x1a')][_0xfe21('0x5e')]||_0xfe21('0x5f'),'ChatOfflineMessageId':_0x5920d8[_0xfe21('0x2b')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xfe21('0x60')],'as':_0xfe21('0x61')}]});})['then'](function(_0x1b4060){_0x17ac5c['message']=_0x1b4060;if(_0x17ac5c['interaction'][_0xfe21('0x62')]){return db[_0xfe21('0x63')][_0xfe21('0x2a')]({'attributes':['id','name'],'where':{'id':_0x17ac5c[_0xfe21('0x64')][_0xfe21('0x62')]}})['then'](function(_0x1f9881){if(_0x1f9881){_0x17ac5c[_0xfe21('0x40')][_0xfe21('0x65')]({'id':0x0,'priority':0x0,'app':_0xfe21('0x66'),'appdata':_0x1f9881[_0xfe21('0x67')]+','+(_0x17ac5c[_0xfe21('0x38')][_0xfe21('0x68')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xfe21('0x69'),_0xfe21('0x6a'),_0x17ac5c);});}return respondWithRpcPromise('Start',_0xfe21('0x6a'),_0x17ac5c);})[_0xfe21('0x27')](function(_0x5b929d){_0x9ac19a(_0x5b929d);})[_0xfe21('0x1d')](function(_0x38a269){_0x203b90(_0x350be7['error'](0x1f4,_0x38a269[_0xfe21('0x1a')]));});});}; \ No newline at end of file +var _0xb42e=['List\x20not\x20found','messageId','generate','subject','attach','format','MailInteraction','MailMessage','inReplyTo','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','unshift','agent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','model','attributes','map','ShowMailAccount','find','NotifyMailAccount','mail','difference','keys','CmContact','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','List','updatedAt','DESC','Applications','MailServerOut','then','account','omit','list','applications','orderBy','asc','autoclose','push','close','*,*,*,*','create'];(function(_0x20d536,_0x467185){var _0x37c3a6=function(_0x367657){while(--_0x367657){_0x20d536['push'](_0x20d536['shift']());}};_0x37c3a6(++_0x467185);}(_0xb42e,0x86));var _0xeb42=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb42e[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xeb42('0x0'));var util=require('util');var moment=require(_0xeb42('0x1'));var BPromise=require(_0xeb42('0x2'));var rs=require(_0xeb42('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb42('0x4'))['db'];var utils=require(_0xeb42('0x5'));var logger=require(_0xeb42('0x6'))(_0xeb42('0x7'));var config=require(_0xeb42('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb42('0x9')][_0xeb42('0xa')]({'port':0x232c});config[_0xeb42('0xb')]=_[_0xeb42('0xc')](config[_0xeb42('0xb')],{'host':_0xeb42('0xd'),'port':0x18eb});var socket=require(_0xeb42('0xe'))(new Redis(config['redis']));require(_0xeb42('0xf'))[_0xeb42('0x10')](socket);function respondWithRpcPromise(_0xcdc2f1,_0x51da60,_0x47238e){return new BPromise(function(_0x17d9ea,_0x17f38e){return client[_0xeb42('0x11')](_0xcdc2f1,_0x47238e)['then'](function(_0x3b00ad){logger[_0xeb42('0x12')](_0xeb42('0x13'),_0x51da60,'request\x20sent');logger[_0xeb42('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x51da60,'request\x20sent',JSON[_0xeb42('0x15')](_0x3b00ad));if(_0x3b00ad[_0xeb42('0x16')]){if(_0x3b00ad[_0xeb42('0x16')][_0xeb42('0x17')]===0x1f4){logger[_0xeb42('0x16')](_0xeb42('0x13'),_0x51da60,_0x3b00ad[_0xeb42('0x16')][_0xeb42('0x18')]);return _0x17f38e(_0x3b00ad['error'][_0xeb42('0x18')]);}logger[_0xeb42('0x16')](_0xeb42('0x13'),_0x51da60,_0x3b00ad[_0xeb42('0x16')][_0xeb42('0x18')]);return _0x17d9ea(_0x3b00ad['error'][_0xeb42('0x18')]);}else{logger[_0xeb42('0x12')]('MailAccount,\x20%s,\x20%s',_0x51da60,'request\x20sent');_0x17d9ea(_0x3b00ad[_0xeb42('0x19')][_0xeb42('0x18')]);}})[_0xeb42('0x1a')](function(_0xd4a44e){logger[_0xeb42('0x16')](_0xeb42('0x13'),_0x51da60,_0xd4a44e);_0x17f38e(_0xd4a44e);});});}exports[_0xeb42('0x1b')]=function(_0x3b1d85){var _0x2957a3=this;return new Promise(function(_0x1ec1ab,_0x917248){return db[_0xeb42('0x1c')][_0xeb42('0x1d')]({'raw':_0x3b1d85[_0xeb42('0x1e')]?_0x3b1d85[_0xeb42('0x1e')][_0xeb42('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b1d85[_0xeb42('0x1e')]?_0x3b1d85[_0xeb42('0x1e')][_0xeb42('0x20')]||null:null,'attributes':_0x3b1d85[_0xeb42('0x1e')]?_0x3b1d85[_0xeb42('0x1e')]['attributes']||null:null,'limit':_0x3b1d85[_0xeb42('0x1e')]?_0x3b1d85['options'][_0xeb42('0x21')]||null:null,'include':_0x3b1d85[_0xeb42('0x1e')]?_0x3b1d85['options'][_0xeb42('0x22')]?_['map'](_0x3b1d85[_0xeb42('0x1e')][_0xeb42('0x22')],function(_0x382074){return{'model':db[_0x382074[_0xeb42('0x23')]],'as':_0x382074['as'],'attributes':_0x382074[_0xeb42('0x24')],'include':_0x382074[_0xeb42('0x22')]?_[_0xeb42('0x25')](_0x382074[_0xeb42('0x22')],function(_0x1c9207){return{'model':db[_0x1c9207[_0xeb42('0x23')]],'as':_0x1c9207['as'],'attributes':_0x1c9207[_0xeb42('0x24')],'include':_0x1c9207[_0xeb42('0x22')]?_[_0xeb42('0x25')](_0x1c9207[_0xeb42('0x22')],function(_0x2868d4){return{'model':db[_0x2868d4[_0xeb42('0x23')]],'as':_0x2868d4['as'],'attributes':_0x2868d4[_0xeb42('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x557d3b){logger[_0xeb42('0x12')](_0xeb42('0x1b'),_0x3b1d85);logger[_0xeb42('0x14')](_0xeb42('0x1b'),_0x3b1d85,JSON[_0xeb42('0x15')](_0x557d3b));_0x1ec1ab(_0x557d3b);})[_0xeb42('0x1a')](function(_0x36e520){logger[_0xeb42('0x16')](_0xeb42('0x1b'),_0x36e520['message'],_0x3b1d85);_0x917248(_0x2957a3[_0xeb42('0x16')](0x1f4,_0x36e520['message']));});});};exports[_0xeb42('0x26')]=function(_0x4b20e4){var _0x42b6c1=this;return new Promise(function(_0x5de303,_0x266d38){return db['MailAccount'][_0xeb42('0x27')]({'raw':_0x4b20e4['options']?_0x4b20e4[_0xeb42('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4b20e4[_0xeb42('0x1e')]?_0x4b20e4[_0xeb42('0x1e')][_0xeb42('0x20')]||null:null,'attributes':_0x4b20e4[_0xeb42('0x1e')]?_0x4b20e4['options'][_0xeb42('0x24')]||null:null,'include':_0x4b20e4[_0xeb42('0x1e')]?_0x4b20e4[_0xeb42('0x1e')][_0xeb42('0x22')]?_[_0xeb42('0x25')](_0x4b20e4[_0xeb42('0x1e')][_0xeb42('0x22')],function(_0x3f73cd){return{'model':db[_0x3f73cd[_0xeb42('0x23')]],'as':_0x3f73cd['as'],'attributes':_0x3f73cd[_0xeb42('0x24')],'include':_0x3f73cd[_0xeb42('0x22')]?_[_0xeb42('0x25')](_0x3f73cd[_0xeb42('0x22')],function(_0x2af7c8){return{'model':db[_0x2af7c8[_0xeb42('0x23')]],'as':_0x2af7c8['as'],'attributes':_0x2af7c8['attributes'],'include':_0x2af7c8[_0xeb42('0x22')]?_[_0xeb42('0x25')](_0x2af7c8[_0xeb42('0x22')],function(_0x4d7450){return{'model':db[_0x4d7450[_0xeb42('0x23')]],'as':_0x4d7450['as'],'attributes':_0x4d7450[_0xeb42('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11f2d4){logger[_0xeb42('0x12')](_0xeb42('0x26'),_0x4b20e4);logger['debug']('ShowMailAccount',_0x4b20e4,JSON[_0xeb42('0x15')](_0x11f2d4));_0x5de303(_0x11f2d4);})[_0xeb42('0x1a')](function(_0x405174){logger['error'](_0xeb42('0x26'),_0x405174[_0xeb42('0x18')],_0x4b20e4);_0x266d38(_0x42b6c1[_0xeb42('0x16')](0x1f4,_0x405174[_0xeb42('0x18')]));});});};exports[_0xeb42('0x28')]=function(_0x217563){var _0x12b85e=this;return new Promise(function(_0x4838c3,_0x2272cf){var _0x64bd8c={'body':_0x217563['body'],'channel':_0xeb42('0x29')};var _0x5ea6e9=_[_0xeb42('0x2a')](_[_0xeb42('0x2b')](db[_0xeb42('0x2c')]['rawAttributes']),[_0xeb42('0x2d'),'updatedAt',_0xeb42('0x2e'),_0xeb42('0x2f')]);var _0x4ef87e=![];if(_0x217563[_0xeb42('0x30')]['id']){delete _0x217563[_0xeb42('0x30')]['id'];}if(_[_0xeb42('0x31')](_0x217563[_0xeb42('0x30')][_0xeb42('0x32')])){return _0x2272cf(_0x12b85e[_0xeb42('0x16')](0x1f4,_0xeb42('0x33')));}if(_['isNil'](_0x217563['body']['body'])||_0x217563[_0xeb42('0x30')][_0xeb42('0x30')]===''){return _0x2272cf(_0x12b85e[_0xeb42('0x16')](0x1f4,_0xeb42('0x34')));}if(_['isNil'](_0x217563[_0xeb42('0x30')][_0xeb42('0x35')])){return _0x2272cf(_0x12b85e[_0xeb42('0x16')](0x1f4,_0xeb42('0x36')+_0x5ea6e9));}if(!_['includes'](_0x5ea6e9,_0x217563[_0xeb42('0x30')][_0xeb42('0x35')])){return _0x2272cf(_0x12b85e[_0xeb42('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ea6e9));}var _0x15667f={};_0x15667f[_0x217563[_0xeb42('0x30')][_0xeb42('0x35')]]=_0x217563['body'][_0xeb42('0x32')];return db[_0xeb42('0x1c')][_0xeb42('0x27')]({'where':{'id':_0x217563['account']['id']},'include':[{'model':db['CmList'],'as':_0xeb42('0x37'),'include':[{'model':db[_0xeb42('0x2c')],'as':'Contacts','where':_0x15667f,'limit':0x1,'order':[[_0xeb42('0x38'),_0xeb42('0x39')]]}]},{'model':db['MailApplication'],'as':_0xeb42('0x3a')},{'model':db[_0xeb42('0x3b')],'as':'Smtp'}]})[_0xeb42('0x3c')](function(_0x14b788){if(_0x14b788&&_0x14b788[_0xeb42('0x37')]){var _0x39aa7c=_0x14b788['get']({'plain':!![]});_0x64bd8c[_0xeb42('0x3d')]=_[_0xeb42('0x3e')](_0x39aa7c,[_0xeb42('0x3a'),_0xeb42('0x37')]);_0x64bd8c['applications']=_0x39aa7c[_0xeb42('0x3a')];_0x64bd8c[_0xeb42('0x3f')]=_0x39aa7c[_0xeb42('0x37')];_0x64bd8c[_0xeb42('0x40')]=_[_0xeb42('0x41')](_0x64bd8c[_0xeb42('0x40')],['priority'],[_0xeb42('0x42')]);if(_0x64bd8c[_0xeb42('0x3d')]&&_0x64bd8c[_0xeb42('0x3d')][_0xeb42('0x43')]){_0x64bd8c['applications'][_0xeb42('0x44')]({'id':0x0,'priority':_0x64bd8c[_0xeb42('0x40')]['length']+0x1,'app':_0xeb42('0x45'),'appdata':'autoclose','interval':_0xeb42('0x46')});}if(_0x64bd8c[_0xeb42('0x3d')][_0xeb42('0x3a')]){delete _0x64bd8c[_0xeb42('0x3d')][_0xeb42('0x3a')];}if(_0x64bd8c[_0xeb42('0x3d')][_0xeb42('0x37')]){delete _0x64bd8c['account'][_0xeb42('0x37')];}if(_0x39aa7c[_0xeb42('0x37')]['Contacts']['length']){return _0x39aa7c[_0xeb42('0x37')]['Contacts'][0x0];}var _0x153812=_[_0xeb42('0xc')](_0x217563[_0xeb42('0x30')],{'firstName':_0x217563[_0xeb42('0x30')][_0xeb42('0x32')],'ListId':_0x39aa7c[_0xeb42('0x2f')]});_0x153812[_0x217563[_0xeb42('0x30')][_0xeb42('0x35')]]=_0x217563[_0xeb42('0x30')][_0xeb42('0x32')];return db[_0xeb42('0x2c')][_0xeb42('0x47')](_0x153812);}else{throw new Error(_0xeb42('0x48'));}})[_0xeb42('0x3c')](function(_0x4ef95b){_0x64bd8c['contact']=_0x4ef95b;if(_0x4ef95b){if(!_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x49')]){_0x217563['body'][_0xeb42('0x18')]['messageId']=rs[_0xeb42('0x4a')]()+'\x20'+_0x217563[_0xeb42('0x30')][_0xeb42('0x18')]['from'];}var _0x3e3040={'ContactId':_0x4ef95b['id'],'MailAccountId':_0x217563['account']['id'],'inReplyTo':_0x217563[_0xeb42('0x30')]['message'][_0xeb42('0x49')],'to':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x32')],'cc':_0x217563[_0xeb42('0x30')]['message']['cc'],'subject':_0x217563[_0xeb42('0x30')]['message'][_0xeb42('0x4b')],'attach':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x4c')],'lastMsgAt':moment()[_0xeb42('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xeb42('0x4e')][_0xeb42('0x27')]({'where':{'closed':![],'MailAccountId':_0x217563[_0xeb42('0x3d')]['id']},'include':[{'model':db[_0xeb42('0x4f')],'as':'Messages','attributes':[_0xeb42('0x49')],'where':{'messageId':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x50')]}}]})[_0xeb42('0x3c')](function(_0x50525c){if(_0x50525c){return[_0x50525c,![]];}return db[_0xeb42('0x4e')][_0xeb42('0x47')](_0x3e3040)[_0xeb42('0x3c')](function(_0x2a2ea9){return[_0x2a2ea9,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xeb42('0x51')](function(_0x3c0a91,_0x1cbee3){if(_0x3c0a91){_0x4ef87e=_0x1cbee3;if(!_0x1cbee3){return _0x3c0a91['update']({'inReplyTo':_0x217563['body'][_0xeb42('0x18')][_0xeb42('0x49')],'to':_0x217563['body'][_0xeb42('0x18')][_0xeb42('0x32')],'cc':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')]['cc'],'subject':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x4b')],'attach':_0x3c0a91['attach']?_0x3c0a91[_0xeb42('0x4c')]:_0x217563['body'][_0xeb42('0x18')][_0xeb42('0x4c')],'substatus':null,'substatusAt':moment()[_0xeb42('0x4d')](_0xeb42('0x52')),'lastMsgAt':moment()['format'](_0xeb42('0x52')),'lastMsgDirection':'in'});}else{return _0x3c0a91;}}})[_0xeb42('0x3c')](function(_0x3fd9dc){_0x64bd8c[_0xeb42('0x53')]=_0x3fd9dc[_0xeb42('0x54')]({'plain':!![]});_0x64bd8c['interaction'][_0xeb42('0x55')]=_0x4ef87e;return db[_0xeb42('0x4f')][_0xeb42('0x47')]({'body':_0x217563['body'][_0xeb42('0x30')],'MailAccountId':_0x217563[_0xeb42('0x3d')]['id'],'MailInteractionId':_0x3fd9dc['id'],'direction':'in','ContactId':_0x64bd8c[_0xeb42('0x56')]['id'],'messageId':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')]['messageId'],'from':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x32')],'to':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')]['to'],'cc':_0x217563['body'][_0xeb42('0x18')]['cc'],'subject':_0x217563['body'][_0xeb42('0x18')][_0xeb42('0x4b')],'attach':_0x217563['body']['message']['attach'],'Attachments':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x57')],'originTo':_0x217563['body'][_0xeb42('0x18')][_0xeb42('0x58')],'originCc':_0x217563[_0xeb42('0x30')]['message'][_0xeb42('0x59')],'bcc':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x5a')],'ChatWebsiteId':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x5b')]||null,'originChannel':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x5c')]||'Email','ChatOfflineMessageId':_0x217563[_0xeb42('0x30')][_0xeb42('0x18')][_0xeb42('0x5d')]||null},{'include':[{'model':db[_0xeb42('0x5e')],'as':_0xeb42('0x5f')}]});})[_0xeb42('0x3c')](function(_0x1c79c4){_0x64bd8c['message']=_0x1c79c4;if(_0x64bd8c['interaction']['UserId']){return db[_0xeb42('0x60')]['find']({'attributes':['id',_0xeb42('0x61')],'where':{'id':_0x64bd8c[_0xeb42('0x53')][_0xeb42('0x62')]}})['then'](function(_0x443690){if(_0x443690){_0x64bd8c[_0xeb42('0x40')][_0xeb42('0x63')]({'id':0x0,'priority':0x0,'app':_0xeb42('0x64'),'appdata':_0x443690[_0xeb42('0x61')]+','+(_0x64bd8c[_0xeb42('0x3d')]['waitForTheAssignedAgent']||0xa),'interval':_0xeb42('0x46')});}return respondWithRpcPromise('Start','startRouting',_0x64bd8c);});}return respondWithRpcPromise(_0xeb42('0x65'),_0xeb42('0x66'),_0x64bd8c);})[_0xeb42('0x3c')](function(_0x459710){_0x4838c3(_0x459710);})[_0xeb42('0x1a')](function(_0x22e90d){_0x2272cf(_0x12b85e[_0xeb42('0x16')](0x1f4,_0x22e90d[_0xeb42('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 3a14f9d..3f9db46 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 _0xb138=['update','removeListener','length','./mailAccount.events','save','remove'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb138,0x1dd));var _0x8b13=function(_0x42db0a,_0x8dc677){_0x42db0a=_0x42db0a-0x0;var _0x338510=_0xb138[_0x42db0a];return _0x338510;};'use strict';var MailAccountEvents=require(_0x8b13('0x0'));var events=[_0x8b13('0x1'),_0x8b13('0x2'),_0x8b13('0x3')];function createListener(_0xadad70,_0x185752){return function(_0x20c65c){_0x185752['emit'](_0xadad70,_0x20c65c);};}function removeListener(_0x4411a0,_0x241acb){return function(){MailAccountEvents[_0x8b13('0x4')](_0x4411a0,_0x241acb);};}exports['register']=function(_0xd19a0f){for(var _0x13f7bd=0x0,_0x5d51b1=events[_0x8b13('0x5')];_0x13f7bd<_0x5d51b1;_0x13f7bd++){var _0x33d1a7=events[_0x13f7bd];var _0x22e157=createListener('mailAccount:'+_0x33d1a7,_0xd19a0f);MailAccountEvents['on'](_0x33d1a7,_0x22e157);}}; \ No newline at end of file +var _0x251b=['update','emit','removeListener','register','length','./mailAccount.events','save','remove'];(function(_0x51de8d,_0x43e19f){var _0x11a928=function(_0x474925){while(--_0x474925){_0x51de8d['push'](_0x51de8d['shift']());}};_0x11a928(++_0x43e19f);}(_0x251b,0x185));var _0xb251=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0x251b[_0x2c1114];return _0x2b877c;};'use strict';var MailAccountEvents=require(_0xb251('0x0'));var events=[_0xb251('0x1'),_0xb251('0x2'),_0xb251('0x3')];function createListener(_0x2ddbc3,_0x4317d4){return function(_0x39d5bf){_0x4317d4[_0xb251('0x4')](_0x2ddbc3,_0x39d5bf);};}function removeListener(_0x304446,_0x334010){return function(){MailAccountEvents[_0xb251('0x5')](_0x304446,_0x334010);};}exports[_0xb251('0x6')]=function(_0x5e96a7){for(var _0x30797a=0x0,_0x594a1b=events[_0xb251('0x7')];_0x30797a<_0x594a1b;_0x30797a++){var _0x3cf251=events[_0x30797a];var _0x923bc0=createListener('mailAccount:'+_0x3cf251,_0x5e96a7);MailAccountEvents['on'](_0x3cf251,_0x923bc0);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 529b65b..aeb252b 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 _0x2ef3=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','show','put'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2ef3,0xba));var _0x32ef=function(_0x495532,_0x545acb){_0x495532=_0x495532-0x0;var _0x3b3a03=_0x2ef3[_0x495532];return _0x3b3a03;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0xc'),auth[_0x32ef('0xd')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')](_0x32ef('0xc'),auth[_0x32ef('0xd')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file +var _0x326f=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','isAuthenticated','destroy'];(function(_0x5d9102,_0x3a0e41){var _0x16ec17=function(_0xe0aa95){while(--_0xe0aa95){_0x5d9102['push'](_0x5d9102['shift']());}};_0x16ec17(++_0x3a0e41);}(_0x326f,0xd1));var _0xf326=function(_0x2e5f42,_0x43e35d){_0x2e5f42=_0x2e5f42-0x0;var _0x11d305=_0x326f[_0x2e5f42];return _0x11d305;};'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')](_0xf326('0xa'),auth['isAuthenticated'](),controller[_0xf326('0xb')]);router[_0xf326('0xc')](_0xf326('0xa'),auth[_0xf326('0xd')](),controller['update']);router['delete']('/:id',auth[_0xf326('0xd')](),controller[_0xf326('0xe')]);module[_0xf326('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 6a14d2e..a4a25e6 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 _0xfae4=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2b71e0,_0x313267){var _0x36ca99=function(_0x3bf6ee){while(--_0x3bf6ee){_0x2b71e0['push'](_0x2b71e0['shift']());}};_0x36ca99(++_0x313267);}(_0xfae4,0x1be));var _0x4fae=function(_0x30ed90,_0x20bc5c){_0x30ed90=_0x30ed90-0x0;var _0x3ddb34=_0xfae4[_0x30ed90];return _0x3ddb34;};'use strict';var Sequelize=require(_0x4fae('0x0'));module[_0x4fae('0x1')]={'priority':{'type':Sequelize[_0x4fae('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4fae('0x3')],'allowNull':![],'defaultValue':_0x4fae('0x4')},'appdata':{'type':Sequelize[_0x4fae('0x5')]()},'description':{'type':Sequelize[_0x4fae('0x3')]},'interval':{'type':Sequelize[_0x4fae('0x3')],'defaultValue':_0x4fae('0x6')}}; \ No newline at end of file +var _0xa6e0=['INTEGER','STRING','noop','*,*,*,*','exports'];(function(_0x55cd97,_0x1ba7cb){var _0x8d7f3c=function(_0x549071){while(--_0x549071){_0x55cd97['push'](_0x55cd97['shift']());}};_0x8d7f3c(++_0x1ba7cb);}(_0xa6e0,0xb8));var _0x0a6e=function(_0x2ce4b7,_0xcc913e){_0x2ce4b7=_0x2ce4b7-0x0;var _0x45d6cf=_0xa6e0[_0x2ce4b7];return _0x45d6cf;};'use strict';var Sequelize=require('sequelize');module[_0x0a6e('0x0')]={'priority':{'type':Sequelize[_0x0a6e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0a6e('0x2')],'allowNull':![],'defaultValue':_0x0a6e('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a6e('0x2')],'defaultValue':_0x0a6e('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 3ef0888..25a08fd 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 _0xb75d=['fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','set','Content-Range','json','apply','save','update','destroy','end','error','stack','name','send','render','merge','body','contact','message','agent','account','show','model','keys','MailApplication','query','filters','intersection','attributes','fields','includeAll','options','then','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs'];(function(_0x574a32,_0x4b9abf){var _0x3c1730=function(_0x112aa4){while(--_0x112aa4){_0x574a32['push'](_0x574a32['shift']());}};_0x3c1730(++_0x4b9abf);}(_0xb75d,0x129));var _0xdb75=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xb75d[_0x22b68a];return _0x1ac67a;};'use strict';var emlformat=require(_0xdb75('0x0'));var rimraf=require(_0xdb75('0x1'));var zipdir=require(_0xdb75('0x2'));var jsonpatch=require(_0xdb75('0x3'));var rp=require(_0xdb75('0x4'));var moment=require(_0xdb75('0x5'));var BPromise=require(_0xdb75('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdb75('0x7'));var fs=require('fs');var fs_extra=require(_0xdb75('0x8'));var _=require(_0xdb75('0x9'));var squel=require('squel');var crypto=require(_0xdb75('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdb75('0xb'));var querystring=require(_0xdb75('0xc'));var Papa=require(_0xdb75('0xd'));var Redis=require(_0xdb75('0xe'));var authService=require(_0xdb75('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb75('0x10'));var logger=require(_0xdb75('0x11'))(_0xdb75('0x12'));var utils=require(_0xdb75('0x13'));var config=require(_0xdb75('0x14'));var licenseUtil=require(_0xdb75('0x15'));var db=require(_0xdb75('0x16'))['db'];function respondWithStatusCode(_0x2356e2,_0x9d3b4d){_0x9d3b4d=_0x9d3b4d||0xcc;return function(_0x409c30){if(_0x409c30){return _0x2356e2[_0xdb75('0x17')](_0x9d3b4d);}return _0x2356e2[_0xdb75('0x18')](_0x9d3b4d)['end']();};}function respondWithResult(_0x179cd2,_0x1df6c8){_0x1df6c8=_0x1df6c8||0xc8;return function(_0x5a9c32){if(_0x5a9c32){return _0x179cd2['status'](_0x1df6c8)['json'](_0x5a9c32);}};}function respondWithFilteredResult(_0xa1be38,_0x2d7616){return function(_0x93ec8){if(_0x93ec8){var _0x41e6ee=typeof _0x2d7616['offset']===_0xdb75('0x19')&&typeof _0x2d7616[_0xdb75('0x1a')]===_0xdb75('0x19');var _0x583117=_0x93ec8['count'];var _0x317385=_0x41e6ee?0x0:_0x2d7616['offset'];var _0x6e3421=_0x41e6ee?_0x93ec8['count']:_0x2d7616[_0xdb75('0x1b')]+_0x2d7616['limit'];var _0x11657e;if(_0x6e3421>=_0x583117){_0x6e3421=_0x583117;_0x11657e=0xc8;}else{_0x11657e=0xce;}_0xa1be38['status'](_0x11657e);return _0xa1be38[_0xdb75('0x1c')](_0xdb75('0x1d'),_0x317385+'-'+_0x6e3421+'/'+_0x583117)[_0xdb75('0x1e')](_0x93ec8);}return null;};}function patchUpdates(_0x5a77c0){return function(_0x124bb5){try{jsonpatch[_0xdb75('0x1f')](_0x124bb5,_0x5a77c0,!![]);}catch(_0x57a23d){return BPromise['reject'](_0x57a23d);}return _0x124bb5[_0xdb75('0x20')]();};}function saveUpdates(_0x2e3f1e,_0x3c9d77){return function(_0x1b48f3){if(_0x1b48f3){return _0x1b48f3[_0xdb75('0x21')](_0x2e3f1e)['then'](function(_0x117635){return _0x117635;});}return null;};}function removeEntity(_0x1ef537,_0x123bbf){return function(_0x3bbe2b){if(_0x3bbe2b){return _0x3bbe2b[_0xdb75('0x22')]()['then'](function(){_0x1ef537[_0xdb75('0x18')](0xcc)[_0xdb75('0x23')]();});}};}function handleEntityNotFound(_0x10b50e,_0x32f9e6){return function(_0x3f9a92){if(!_0x3f9a92){_0x10b50e[_0xdb75('0x17')](0x194);}return _0x3f9a92;};}function handleError(_0x2a0ca3,_0x19f69d){_0x19f69d=_0x19f69d||0x1f4;return function(_0x331a00){logger[_0xdb75('0x24')](_0x331a00[_0xdb75('0x25')]);if(_0x331a00['name']){delete _0x331a00[_0xdb75('0x26')];}_0x2a0ca3['status'](_0x19f69d)[_0xdb75('0x27')](_0x331a00);};}function getMustacheRender(_0x325415,_0x26d14c){return Mustache[_0xdb75('0x28')](_0x325415,_[_0xdb75('0x29')](_0x26d14c[_0xdb75('0x2a')],{'contact':_0x26d14c[_0xdb75('0x2b')],'message':_0x26d14c[_0xdb75('0x2c')],'agent':_0x26d14c[_0xdb75('0x2d')],'interaction':_0x26d14c['interaction'],'account':_0x26d14c[_0xdb75('0x2e')]}))||'';}exports[_0xdb75('0x2f')]=function(_0x4b549b,_0x5a263e){var _0x437ab3={'raw':!![],'where':{'id':_0x4b549b['params']['id']}},_0x234322={};_0x234322[_0xdb75('0x30')]=_[_0xdb75('0x31')](db[_0xdb75('0x32')]['rawAttributes']);_0x234322[_0xdb75('0x33')]=_[_0xdb75('0x31')](_0x4b549b[_0xdb75('0x33')]);_0x234322[_0xdb75('0x34')]=_[_0xdb75('0x35')](_0x234322[_0xdb75('0x30')],_0x234322[_0xdb75('0x33')]);_0x437ab3[_0xdb75('0x36')]=_[_0xdb75('0x35')](_0x234322[_0xdb75('0x30')],qs[_0xdb75('0x37')](_0x4b549b[_0xdb75('0x33')][_0xdb75('0x37')]));_0x437ab3[_0xdb75('0x36')]=_0x437ab3[_0xdb75('0x36')]['length']?_0x437ab3['attributes']:_0x234322[_0xdb75('0x30')];if(_0x4b549b['query'][_0xdb75('0x38')]){_0x437ab3['include']=[{'all':!![]}];}_0x437ab3=_[_0xdb75('0x29')]({},_0x437ab3,_0x4b549b[_0xdb75('0x39')]);return db['MailApplication']['find'](_0x437ab3)['then'](handleEntityNotFound(_0x5a263e,null))[_0xdb75('0x3a')](respondWithResult(_0x5a263e,null))['catch'](handleError(_0x5a263e,null));};exports[_0xdb75('0x21')]=function(_0x57fa93,_0x4343f8){if(_0x57fa93[_0xdb75('0x2a')]['id']){delete _0x57fa93[_0xdb75('0x2a')]['id'];}return db['MailApplication'][_0xdb75('0x3b')]({'where':{'id':_0x57fa93['params']['id']}})[_0xdb75('0x3a')](handleEntityNotFound(_0x4343f8,null))['then'](saveUpdates(_0x57fa93[_0xdb75('0x2a')],null))['then'](respondWithResult(_0x4343f8,null))[_0xdb75('0x3c')](handleError(_0x4343f8,null));};exports[_0xdb75('0x22')]=function(_0x1ee194,_0x5758d1){return db['MailApplication'][_0xdb75('0x3b')]({'where':{'id':_0x1ee194['params']['id']}})[_0xdb75('0x3a')](handleEntityNotFound(_0x5758d1,null))['then'](removeEntity(_0x5758d1,null))[_0xdb75('0x3c')](handleError(_0x5758d1,null));}; \ No newline at end of file +var _0x5d1f=['json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','render','merge','body','interaction','account','show','keys','query','intersection','model','attributes','fields','include','MailApplication','find','catch','params','eml-format','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status'];(function(_0x150a49,_0x47b070){var _0xe8c345=function(_0x4c4b73){while(--_0x4c4b73){_0x150a49['push'](_0x150a49['shift']());}};_0xe8c345(++_0x47b070);}(_0x5d1f,0x17c));var _0xf5d1=function(_0x39a120,_0x4a171d){_0x39a120=_0x39a120-0x0;var _0x11be13=_0x5d1f[_0x39a120];return _0x11be13;};'use strict';var emlformat=require(_0xf5d1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf5d1('0x1'));var BPromise=require(_0xf5d1('0x2'));var Mustache=require(_0xf5d1('0x3'));var util=require('util');var path=require(_0xf5d1('0x4'));var sox=require(_0xf5d1('0x5'));var csv=require(_0xf5d1('0x6'));var ejs=require(_0xf5d1('0x7'));var fs=require('fs');var fs_extra=require(_0xf5d1('0x8'));var _=require(_0xf5d1('0x9'));var squel=require(_0xf5d1('0xa'));var crypto=require(_0xf5d1('0xb'));var jsforce=require(_0xf5d1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf5d1('0x6'));var querystring=require(_0xf5d1('0xd'));var Papa=require(_0xf5d1('0xe'));var Redis=require(_0xf5d1('0xf'));var authService=require(_0xf5d1('0x10'));var qs=require(_0xf5d1('0x11'));var as=require(_0xf5d1('0x12'));var hardwareService=require(_0xf5d1('0x13'));var logger=require('../../config/logger')(_0xf5d1('0x14'));var utils=require(_0xf5d1('0x15'));var config=require(_0xf5d1('0x16'));var licenseUtil=require(_0xf5d1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20d656,_0x2fc63b){_0x2fc63b=_0x2fc63b||0xcc;return function(_0x391f92){if(_0x391f92){return _0x20d656['sendStatus'](_0x2fc63b);}return _0x20d656['status'](_0x2fc63b)[_0xf5d1('0x18')]();};}function respondWithResult(_0x37803d,_0x4e64e5){_0x4e64e5=_0x4e64e5||0xc8;return function(_0x395a2e){if(_0x395a2e){return _0x37803d[_0xf5d1('0x19')](_0x4e64e5)[_0xf5d1('0x1a')](_0x395a2e);}};}function respondWithFilteredResult(_0x2e7551,_0x361e31){return function(_0x3b25d6){if(_0x3b25d6){var _0x1c2b61=typeof _0x361e31[_0xf5d1('0x1b')]==='undefined'&&typeof _0x361e31[_0xf5d1('0x1c')]==='undefined';var _0x2f5a18=_0x3b25d6[_0xf5d1('0x1d')];var _0xc1d022=_0x1c2b61?0x0:_0x361e31['offset'];var _0x4e9b40=_0x1c2b61?_0x3b25d6[_0xf5d1('0x1d')]:_0x361e31['offset']+_0x361e31[_0xf5d1('0x1c')];var _0x53c053;if(_0x4e9b40>=_0x2f5a18){_0x4e9b40=_0x2f5a18;_0x53c053=0xc8;}else{_0x53c053=0xce;}_0x2e7551[_0xf5d1('0x19')](_0x53c053);return _0x2e7551[_0xf5d1('0x1e')](_0xf5d1('0x1f'),_0xc1d022+'-'+_0x4e9b40+'/'+_0x2f5a18)[_0xf5d1('0x1a')](_0x3b25d6);}return null;};}function patchUpdates(_0x2b9dee){return function(_0x4bdf58){try{jsonpatch[_0xf5d1('0x20')](_0x4bdf58,_0x2b9dee,!![]);}catch(_0x5c25aa){return BPromise[_0xf5d1('0x21')](_0x5c25aa);}return _0x4bdf58[_0xf5d1('0x22')]();};}function saveUpdates(_0x1b186d,_0xcd5431){return function(_0x811022){if(_0x811022){return _0x811022[_0xf5d1('0x23')](_0x1b186d)[_0xf5d1('0x24')](function(_0x9de25a){return _0x9de25a;});}return null;};}function removeEntity(_0x541863,_0x4f86aa){return function(_0x301a7d){if(_0x301a7d){return _0x301a7d[_0xf5d1('0x25')]()[_0xf5d1('0x24')](function(){_0x541863[_0xf5d1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d9ed,_0x3a55a5){return function(_0xe1e142){if(!_0xe1e142){_0x7d9ed[_0xf5d1('0x26')](0x194);}return _0xe1e142;};}function handleError(_0x95a0b3,_0x1fe3d1){_0x1fe3d1=_0x1fe3d1||0x1f4;return function(_0x2a9c6f){logger['error'](_0x2a9c6f[_0xf5d1('0x27')]);if(_0x2a9c6f['name']){delete _0x2a9c6f[_0xf5d1('0x28')];}_0x95a0b3['status'](_0x1fe3d1)['send'](_0x2a9c6f);};}function getMustacheRender(_0x339837,_0xc4356a){return Mustache[_0xf5d1('0x29')](_0x339837,_[_0xf5d1('0x2a')](_0xc4356a[_0xf5d1('0x2b')],{'contact':_0xc4356a['contact'],'message':_0xc4356a['message'],'agent':_0xc4356a['agent'],'interaction':_0xc4356a[_0xf5d1('0x2c')],'account':_0xc4356a[_0xf5d1('0x2d')]}))||'';}exports[_0xf5d1('0x2e')]=function(_0x551993,_0x2e6dd2){var _0x4c48bc={'raw':!![],'where':{'id':_0x551993['params']['id']}},_0x805653={};_0x805653['model']=_[_0xf5d1('0x2f')](db['MailApplication']['rawAttributes']);_0x805653[_0xf5d1('0x30')]=_[_0xf5d1('0x2f')](_0x551993[_0xf5d1('0x30')]);_0x805653['filters']=_[_0xf5d1('0x31')](_0x805653[_0xf5d1('0x32')],_0x805653[_0xf5d1('0x30')]);_0x4c48bc[_0xf5d1('0x33')]=_[_0xf5d1('0x31')](_0x805653['model'],qs[_0xf5d1('0x34')](_0x551993['query'][_0xf5d1('0x34')]));_0x4c48bc[_0xf5d1('0x33')]=_0x4c48bc[_0xf5d1('0x33')]['length']?_0x4c48bc[_0xf5d1('0x33')]:_0x805653[_0xf5d1('0x32')];if(_0x551993[_0xf5d1('0x30')]['includeAll']){_0x4c48bc[_0xf5d1('0x35')]=[{'all':!![]}];}_0x4c48bc=_[_0xf5d1('0x2a')]({},_0x4c48bc,_0x551993['options']);return db[_0xf5d1('0x36')][_0xf5d1('0x37')](_0x4c48bc)[_0xf5d1('0x24')](handleEntityNotFound(_0x2e6dd2,null))['then'](respondWithResult(_0x2e6dd2,null))[_0xf5d1('0x38')](handleError(_0x2e6dd2,null));};exports['update']=function(_0x31ff66,_0x136510){if(_0x31ff66[_0xf5d1('0x2b')]['id']){delete _0x31ff66[_0xf5d1('0x2b')]['id'];}return db['MailApplication'][_0xf5d1('0x37')]({'where':{'id':_0x31ff66['params']['id']}})[_0xf5d1('0x24')](handleEntityNotFound(_0x136510,null))[_0xf5d1('0x24')](saveUpdates(_0x31ff66[_0xf5d1('0x2b')],null))[_0xf5d1('0x24')](respondWithResult(_0x136510,null))['catch'](handleError(_0x136510,null));};exports['destroy']=function(_0x5aaf9b,_0x4380a2){return db['MailApplication']['find']({'where':{'id':_0x5aaf9b[_0xf5d1('0x39')]['id']}})[_0xf5d1('0x24')](handleEntityNotFound(_0x4380a2,null))['then'](removeEntity(_0x4380a2,null))[_0xf5d1('0x38')](handleError(_0x4380a2,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 4b7c84c..f2f4640 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 _0xb6a6=['lodash','util','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5810ba,_0x2c10dc){var _0x4931d6=function(_0x25b36d){while(--_0x25b36d){_0x5810ba['push'](_0x5810ba['shift']());}};_0x4931d6(++_0x2c10dc);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x21c3e0,_0x3ab34c){_0x21c3e0=_0x21c3e0-0x0;var _0x3f92de=_0xb6a6[_0x21c3e0];return _0x3f92de;};'use strict';var _=require(_0x6b6a('0x0'));var util=require(_0x6b6a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b6a('0x2'));var BPromise=require(_0x6b6a('0x3'));var rp=require(_0x6b6a('0x4'));var fs=require('fs');var path=require(_0x6b6a('0x5'));var rimraf=require(_0x6b6a('0x6'));var config=require('../../config/environment');var attributes=require(_0x6b6a('0x7'));module[_0x6b6a('0x8')]=function(_0xeb6021,_0x5f4e11){return _0xeb6021[_0x6b6a('0x9')](_0x6b6a('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b6a('0xb'),'collate':_0x6b6a('0xc')});}; \ No newline at end of file +var _0x8a9a=['rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d3867,_0x4faf88){var _0xc76525=function(_0x595e6e){while(--_0x595e6e){_0x2d3867['push'](_0x2d3867['shift']());}};_0xc76525(++_0x4faf88);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x8a9a[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var logger=require(_0xa8a9('0x1'))(_0xa8a9('0x2'));var moment=require(_0xa8a9('0x3'));var BPromise=require(_0xa8a9('0x4'));var rp=require(_0xa8a9('0x5'));var fs=require('fs');var path=require(_0xa8a9('0x6'));var rimraf=require(_0xa8a9('0x7'));var config=require(_0xa8a9('0x8'));var attributes=require(_0xa8a9('0x9'));module[_0xa8a9('0xa')]=function(_0x1de1c6,_0x4ac303){return _0x1de1c6[_0xa8a9('0xb')]('MailApplication',attributes,{'tableName':_0xa8a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa8a9('0xd'),'collate':_0xa8a9('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a52757c..29927c4 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 _0xbfd9=['options','where','attributes','lodash','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailApplication','MailApplication','update','body'];(function(_0x5e0dc4,_0x52eb7d){var _0x1aae47=function(_0x3588ab){while(--_0x3588ab){_0x5e0dc4['push'](_0x5e0dc4['shift']());}};_0x1aae47(++_0x52eb7d);}(_0xbfd9,0x1bd));var _0x9bfd=function(_0x2a82bb,_0x1aa9aa){_0x2a82bb=_0x2a82bb-0x0;var _0x29f4b0=_0xbfd9[_0x2a82bb];return _0x29f4b0;};'use strict';var _=require(_0x9bfd('0x0'));var util=require('util');var moment=require(_0x9bfd('0x1'));var BPromise=require(_0x9bfd('0x2'));var rs=require(_0x9bfd('0x3'));var fs=require('fs');var Redis=require(_0x9bfd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9bfd('0x5'));var config=require('../../config/environment');var jayson=require(_0x9bfd('0x6'));var client=jayson['client'][_0x9bfd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x498f7b,_0x122e4f,_0x368401){return new BPromise(function(_0x9e617a,_0x5e04f0){return client[_0x9bfd('0x8')](_0x498f7b,_0x368401)['then'](function(_0x332d06){logger[_0x9bfd('0x9')](_0x9bfd('0xa'),_0x122e4f,_0x9bfd('0xb'));logger[_0x9bfd('0xc')](_0x9bfd('0xd'),_0x122e4f,_0x9bfd('0xb'),JSON[_0x9bfd('0xe')](_0x332d06));if(_0x332d06['error']){if(_0x332d06[_0x9bfd('0xf')][_0x9bfd('0x10')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x122e4f,_0x332d06[_0x9bfd('0xf')]['message']);return _0x5e04f0(_0x332d06[_0x9bfd('0xf')][_0x9bfd('0x11')]);}logger[_0x9bfd('0xf')](_0x9bfd('0xa'),_0x122e4f,_0x332d06[_0x9bfd('0xf')][_0x9bfd('0x11')]);return _0x9e617a(_0x332d06[_0x9bfd('0xf')]['message']);}else{logger[_0x9bfd('0x9')](_0x9bfd('0xa'),_0x122e4f,_0x9bfd('0xb'));_0x9e617a(_0x332d06['result'][_0x9bfd('0x11')]);}})[_0x9bfd('0x12')](function(_0x3d1db9){logger[_0x9bfd('0xf')]('MailApplication,\x20%s,\x20%s',_0x122e4f,_0x3d1db9);_0x5e04f0(_0x3d1db9);});});}exports[_0x9bfd('0x13')]=function(_0x3b9981){var _0x11654e=this;return new Promise(function(_0x3333c4,_0x251a3c){return db[_0x9bfd('0x14')][_0x9bfd('0x15')](_0x3b9981[_0x9bfd('0x16')],{'raw':_0x3b9981['options']?_0x3b9981[_0x9bfd('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b9981[_0x9bfd('0x17')]?_0x3b9981['options'][_0x9bfd('0x18')]||null:null,'attributes':_0x3b9981[_0x9bfd('0x17')]?_0x3b9981['options'][_0x9bfd('0x19')]||null:null,'limit':_0x3b9981[_0x9bfd('0x17')]?_0x3b9981[_0x9bfd('0x17')]['limit']||null:null})['then'](function(_0x2e385e){logger[_0x9bfd('0x9')](_0x9bfd('0x13'),_0x3b9981);logger[_0x9bfd('0xc')]('UpdateMailApplication',_0x3b9981,JSON[_0x9bfd('0xe')](_0x2e385e));_0x3333c4(_0x2e385e);})['catch'](function(_0x3e4fd4){logger[_0x9bfd('0xf')]('UpdateMailApplication',_0x3e4fd4[_0x9bfd('0x11')],_0x3b9981);_0x251a3c(_0x11654e[_0x9bfd('0xf')](0x1f4,_0x3e4fd4['message']));});});}; \ No newline at end of file +var _0x1610=['http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateMailApplication','MailApplication','options','raw','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5a7c14,_0xfe838a){var _0x28ed61=function(_0x406c1d){while(--_0x406c1d){_0x5a7c14['push'](_0x5a7c14['shift']());}};_0x28ed61(++_0xfe838a);}(_0x1610,0x9a));var _0x0161=function(_0x921bf5,_0x4699d0){_0x921bf5=_0x921bf5-0x0;var _0x41506d=_0x1610[_0x921bf5];return _0x41506d;};'use strict';var _=require(_0x0161('0x0'));var util=require(_0x0161('0x1'));var moment=require(_0x0161('0x2'));var BPromise=require(_0x0161('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0161('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0161('0x5'));var logger=require(_0x0161('0x6'))('rpc');var config=require(_0x0161('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0161('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ddeac,_0x53cd0d,_0xc2ddce){return new BPromise(function(_0x160e68,_0xa3b95c){return client[_0x0161('0x9')](_0x1ddeac,_0xc2ddce)[_0x0161('0xa')](function(_0x40ba25){logger[_0x0161('0xb')](_0x0161('0xc'),_0x53cd0d,_0x0161('0xd'));logger['debug'](_0x0161('0xe'),_0x53cd0d,'request\x20sent',JSON[_0x0161('0xf')](_0x40ba25));if(_0x40ba25[_0x0161('0x10')]){if(_0x40ba25[_0x0161('0x10')]['code']===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x53cd0d,_0x40ba25[_0x0161('0x10')][_0x0161('0x11')]);return _0xa3b95c(_0x40ba25['error'][_0x0161('0x11')]);}logger[_0x0161('0x10')](_0x0161('0xc'),_0x53cd0d,_0x40ba25['error'][_0x0161('0x11')]);return _0x160e68(_0x40ba25['error'][_0x0161('0x11')]);}else{logger[_0x0161('0xb')](_0x0161('0xc'),_0x53cd0d,'request\x20sent');_0x160e68(_0x40ba25['result'][_0x0161('0x11')]);}})[_0x0161('0x12')](function(_0x31358a){logger['error']('MailApplication,\x20%s,\x20%s',_0x53cd0d,_0x31358a);_0xa3b95c(_0x31358a);});});}exports[_0x0161('0x13')]=function(_0x116bea){var _0x54eac3=this;return new Promise(function(_0x161abc,_0x3a2763){return db[_0x0161('0x14')]['update'](_0x116bea['body'],{'raw':_0x116bea['options']?_0x116bea[_0x0161('0x15')][_0x0161('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x116bea[_0x0161('0x15')]?_0x116bea[_0x0161('0x15')][_0x0161('0x17')]||null:null,'attributes':_0x116bea['options']?_0x116bea[_0x0161('0x15')][_0x0161('0x18')]||null:null,'limit':_0x116bea['options']?_0x116bea['options'][_0x0161('0x19')]||null:null})[_0x0161('0xa')](function(_0x3f479e){logger[_0x0161('0xb')](_0x0161('0x13'),_0x116bea);logger[_0x0161('0x1a')](_0x0161('0x13'),_0x116bea,JSON[_0x0161('0xf')](_0x3f479e));_0x161abc(_0x3f479e);})[_0x0161('0x12')](function(_0x54ba65){logger[_0x0161('0x10')](_0x0161('0x13'),_0x54ba65[_0x0161('0x11')],_0x116bea);_0x3a2763(_0x54eac3[_0x0161('0x10')](0x1f4,_0x54ba65['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index c8f96f7..e491020 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 _0x5e97=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','put','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x152aa1,_0x307718){var _0x1bc01a=function(_0xd3211e){while(--_0xd3211e){_0x152aa1['push'](_0x152aa1['shift']());}};_0x1bc01a(++_0x307718);}(_0x5e97,0x1e9));var _0x75e9=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5e97[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x75e9('0x0'));var util=require(_0x75e9('0x1'));var path=require(_0x75e9('0x2'));var timeout=require(_0x75e9('0x3'));var express=require(_0x75e9('0x4'));var router=express[_0x75e9('0x5')]();var fs_extra=require(_0x75e9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x75e9('0x7'));var config=require(_0x75e9('0x8'));var controller=require('./mailInteraction.controller');router[_0x75e9('0x9')]('/',auth[_0x75e9('0xa')](),controller['index']);router['get'](_0x75e9('0xb'),auth[_0x75e9('0xa')](),controller[_0x75e9('0xc')]);router[_0x75e9('0x9')](_0x75e9('0xd'),auth[_0x75e9('0xa')](),controller[_0x75e9('0xe')]);router[_0x75e9('0x9')](_0x75e9('0xf'),auth[_0x75e9('0xa')](),controller[_0x75e9('0x10')]);router[_0x75e9('0x9')](_0x75e9('0x11'),auth[_0x75e9('0xa')](),controller[_0x75e9('0x12')]);router[_0x75e9('0x13')]('/',auth[_0x75e9('0xa')](),controller[_0x75e9('0x14')]);router[_0x75e9('0x13')]('/:id/messages',auth[_0x75e9('0xa')](),controller[_0x75e9('0x15')]);router[_0x75e9('0x13')](_0x75e9('0x16'),auth['isAuthenticated'](),interaction[_0x75e9('0x17')]('mail',_0x75e9('0x18')),controller['addTags']);router[_0x75e9('0x19')](_0x75e9('0xd'),auth[_0x75e9('0xa')](),interaction['tracked'](_0x75e9('0x1a'),_0x75e9('0x1b')),controller['update']);router[_0x75e9('0x1c')](_0x75e9('0xd'),auth[_0x75e9('0xa')](),interaction[_0x75e9('0x17')](_0x75e9('0x1a'),_0x75e9('0x1d')),controller[_0x75e9('0x1e')]);router[_0x75e9('0x1c')](_0x75e9('0x16'),auth[_0x75e9('0xa')](),controller[_0x75e9('0x1f')]);module[_0x75e9('0x20')]=router; \ No newline at end of file +var _0x86b4=['/:id','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','mailinteraction:destroy','destroy','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','describe'];(function(_0x48431f,_0x26773e){var _0x1e5386=function(_0x325c6f){while(--_0x325c6f){_0x48431f['push'](_0x48431f['shift']());}};_0x1e5386(++_0x26773e);}(_0x86b4,0x1f3));var _0x486b=function(_0x403576,_0xec3609){_0x403576=_0x403576-0x0;var _0x5be8fd=_0x86b4[_0x403576];return _0x5be8fd;};'use strict';var multer=require(_0x486b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x486b('0x1'));var express=require(_0x486b('0x2'));var router=express[_0x486b('0x3')]();var fs_extra=require(_0x486b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x486b('0x5'));var config=require(_0x486b('0x6'));var controller=require(_0x486b('0x7'));router[_0x486b('0x8')]('/',auth[_0x486b('0x9')](),controller['index']);router[_0x486b('0x8')]('/describe',auth[_0x486b('0x9')](),controller[_0x486b('0xa')]);router[_0x486b('0x8')](_0x486b('0xb'),auth[_0x486b('0x9')](),controller[_0x486b('0xc')]);router[_0x486b('0x8')]('/:id/messages',auth[_0x486b('0x9')](),controller[_0x486b('0xd')]);router[_0x486b('0x8')](_0x486b('0xe'),auth['isAuthenticated'](),controller[_0x486b('0xf')]);router[_0x486b('0x10')]('/',auth[_0x486b('0x9')](),controller['create']);router['post'](_0x486b('0x11'),auth[_0x486b('0x9')](),controller[_0x486b('0x12')]);router['post'](_0x486b('0x13'),auth[_0x486b('0x9')](),interaction[_0x486b('0x14')]('mail',_0x486b('0x15')),controller[_0x486b('0x16')]);router[_0x486b('0x17')](_0x486b('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x486b('0x18'),_0x486b('0x19')),controller['update']);router['delete'](_0x486b('0xb'),auth[_0x486b('0x9')](),interaction['tracked']('mail',_0x486b('0x1a')),controller[_0x486b('0x1b')]);router[_0x486b('0x1c')](_0x486b('0x13'),auth[_0x486b('0x9')](),controller['removeTags']);module[_0x486b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 82c2168..d5c18f8 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 _0x7a02=['STRING','TEXT','DATE','ENUM','out','sequelize','iconv','BOOLEAN'];(function(_0x16edd1,_0x4c21e2){var _0x6be6b3=function(_0x1287ac){while(--_0x1287ac){_0x16edd1['push'](_0x16edd1['shift']());}};_0x6be6b3(++_0x4c21e2);}(_0x7a02,0x14d));var _0x27a0=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x7a02[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0x27a0('0x0'));var iconv=require(_0x27a0('0x1'));module['exports']={'closed':{'type':Sequelize[_0x27a0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x27a0('0x3')]},'secondDisposition':{'type':Sequelize[_0x27a0('0x3')]},'thirdDisposition':{'type':Sequelize[_0x27a0('0x3')]},'note':{'type':Sequelize[_0x27a0('0x3')]},'inReplyTo':{'type':Sequelize[_0x27a0('0x3')](0x1fe)},'to':{'type':Sequelize[_0x27a0('0x3')]},'cc':{'type':Sequelize[_0x27a0('0x4')]('long')},'subject':{'type':Sequelize[_0x27a0('0x4')]()},'attach':{'type':Sequelize[_0x27a0('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x27a0('0x5')]},'substatus':{'type':Sequelize[_0x27a0('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x27a0('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x27a0('0x6')]('in',_0x27a0('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x27a0('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x27a0('0x6')]('in',_0x27a0('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xf6a9=['long','ENUM','out','sequelize','BOOLEAN','DATE','STRING','TEXT'];(function(_0x2c77e9,_0x55a579){var _0x495989=function(_0x38c994){while(--_0x38c994){_0x2c77e9['push'](_0x2c77e9['shift']());}};_0x495989(++_0x55a579);}(_0xf6a9,0xab));var _0x9f6a=function(_0x1f263a,_0x45063e){_0x1f263a=_0x1f263a-0x0;var _0x1993c8=_0xf6a9[_0x1f263a];return _0x1993c8;};'use strict';var Sequelize=require(_0x9f6a('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x9f6a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9f6a('0x2')]},'disposition':{'type':Sequelize[_0x9f6a('0x3')]},'secondDisposition':{'type':Sequelize[_0x9f6a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9f6a('0x3')]},'note':{'type':Sequelize[_0x9f6a('0x3')]},'inReplyTo':{'type':Sequelize[_0x9f6a('0x3')](0x1fe)},'to':{'type':Sequelize[_0x9f6a('0x3')]},'cc':{'type':Sequelize[_0x9f6a('0x4')](_0x9f6a('0x5'))},'subject':{'type':Sequelize[_0x9f6a('0x4')]()},'attach':{'type':Sequelize[_0x9f6a('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9f6a('0x2')]},'substatus':{'type':Sequelize[_0x9f6a('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9f6a('0x6')]('in',_0x9f6a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9f6a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9f6a('0x6')]('in',_0x9f6a('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3015160..7c77a47 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 _0x6319=['User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','compact','isEmpty','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','findOne','enableEmailPreview','all','rows','options','create','params','destroy','describe','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','inlineCss','true','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','join','server','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','writeFileSync','message%d.eml','download','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','end','undefined','limit','count','offset','set','Content-Range','json','save','update','then','sendStatus','stack','name','send','merge','body','message','agent','interaction','account','map','fullname','TagIds','forEach','Tags','push','MailMessage','out','plainBody','-id','catch','index','MailInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','operator','$substring','split','value','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union'];(function(_0x1345be,_0x5e6847){var _0x5736af=function(_0x35c1ec){while(--_0x35c1ec){_0x1345be['push'](_0x1345be['shift']());}};_0x5736af(++_0x5e6847);}(_0x6319,0x79));var _0x9631=function(_0x2471a0,_0x159595){_0x2471a0=_0x2471a0-0x0;var _0x42231b=_0x6319[_0x2471a0];return _0x42231b;};'use strict';var emlformat=require(_0x9631('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9631('0x1'));var rp=require(_0x9631('0x2'));var moment=require(_0x9631('0x3'));var BPromise=require(_0x9631('0x4'));var Mustache=require(_0x9631('0x5'));var util=require(_0x9631('0x6'));var path=require(_0x9631('0x7'));var sox=require('sox');var csv=require(_0x9631('0x8'));var ejs=require(_0x9631('0x9'));var fs=require('fs');var fs_extra=require(_0x9631('0xa'));var _=require(_0x9631('0xb'));var squel=require(_0x9631('0xc'));var crypto=require(_0x9631('0xd'));var jsforce=require(_0x9631('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9631('0x8'));var querystring=require(_0x9631('0xf'));var Papa=require(_0x9631('0x10'));var htmlToText=require(_0x9631('0x11'));var juice=require(_0x9631('0x12'));var Redis=require(_0x9631('0x13'));var authService=require(_0x9631('0x14'));var qs=require(_0x9631('0x15'));var as=require(_0x9631('0x16'));var hardwareService=require(_0x9631('0x17'));var logger=require(_0x9631('0x18'))(_0x9631('0x19'));var utils=require(_0x9631('0x1a'));var config=require(_0x9631('0x1b'));var licenseUtil=require(_0x9631('0x1c'));var db=require(_0x9631('0x1d'))['db'];config[_0x9631('0x1e')]=_[_0x9631('0x1f')](config[_0x9631('0x1e')],{'host':_0x9631('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9631('0x1e')]));require(_0x9631('0x21'))[_0x9631('0x22')](socket);function respondWithStatusCode(_0x304245,_0x1598b7){_0x1598b7=_0x1598b7||0xcc;return function(_0x41ab52){if(_0x41ab52){return _0x304245['sendStatus'](_0x1598b7);}return _0x304245[_0x9631('0x23')](_0x1598b7)[_0x9631('0x24')]();};}function respondWithResult(_0x34cd20,_0x3626d4){_0x3626d4=_0x3626d4||0xc8;return function(_0x2561b5){if(_0x2561b5){return _0x34cd20[_0x9631('0x23')](_0x3626d4)['json'](_0x2561b5);}};}function respondWithFilteredResult(_0x1d9e72,_0x47d1e6){return function(_0x19c7e5){if(_0x19c7e5){var _0x216885=typeof _0x47d1e6['offset']===_0x9631('0x25')&&typeof _0x47d1e6[_0x9631('0x26')]===_0x9631('0x25');var _0x4e556e=_0x19c7e5[_0x9631('0x27')];var _0x9a86fc=_0x216885?0x0:_0x47d1e6[_0x9631('0x28')];var _0x4916b2=_0x216885?_0x19c7e5[_0x9631('0x27')]:_0x47d1e6[_0x9631('0x28')]+_0x47d1e6[_0x9631('0x26')];var _0x334f9b;if(_0x4916b2>=_0x4e556e){_0x4916b2=_0x4e556e;_0x334f9b=0xc8;}else{_0x334f9b=0xce;}_0x1d9e72[_0x9631('0x23')](_0x334f9b);return _0x1d9e72[_0x9631('0x29')](_0x9631('0x2a'),_0x9a86fc+'-'+_0x4916b2+'/'+_0x4e556e)[_0x9631('0x2b')](_0x19c7e5);}return null;};}function patchUpdates(_0x3cf8b1){return function(_0x5e96e9){try{jsonpatch['apply'](_0x5e96e9,_0x3cf8b1,!![]);}catch(_0x340c20){return BPromise['reject'](_0x340c20);}return _0x5e96e9[_0x9631('0x2c')]();};}function saveUpdates(_0x592ab2,_0x31dbd6){return function(_0x7ba21f){if(_0x7ba21f){return _0x7ba21f[_0x9631('0x2d')](_0x592ab2)[_0x9631('0x2e')](function(_0x59284d){return _0x59284d;});}return null;};}function removeEntity(_0x262607,_0x286c89){return function(_0x4d0e7c){if(_0x4d0e7c){return _0x4d0e7c['destroy']()[_0x9631('0x2e')](function(){_0x262607['status'](0xcc)[_0x9631('0x24')]();});}};}function handleEntityNotFound(_0x6c5640,_0x40d0e0){return function(_0x4eaad5){if(!_0x4eaad5){_0x6c5640[_0x9631('0x2f')](0x194);}return _0x4eaad5;};}function handleError(_0x3846b4,_0x1ab608){_0x1ab608=_0x1ab608||0x1f4;return function(_0x511d4e){logger['error'](_0x511d4e[_0x9631('0x30')]);if(_0x511d4e['name']){delete _0x511d4e[_0x9631('0x31')];}_0x3846b4[_0x9631('0x23')](_0x1ab608)[_0x9631('0x32')](_0x511d4e);};}function getMustacheRender(_0x5caf8c,_0x5e10c8){return Mustache['render'](_0x5caf8c,_[_0x9631('0x33')](_0x5e10c8[_0x9631('0x34')],{'contact':_0x5e10c8['contact'],'message':_0x5e10c8[_0x9631('0x35')],'agent':_0x5e10c8[_0x9631('0x36')],'interaction':_0x5e10c8[_0x9631('0x37')],'account':_0x5e10c8[_0x9631('0x38')]}))||'';}function getInteractionUsers(_0x5c98ff,_0x5e3a8c){return new BPromise(function(_0x2ba787,_0x2fe5cb){try{if(_0x5e3a8c[_0x5c98ff['id']]){_0x5c98ff['Users']=_[_0x9631('0x39')](_0x5e3a8c[_0x5c98ff['id']],function(_0x5e53f7){return{'id':_0x5e53f7['id'],'fullname':_0x5e53f7[_0x9631('0x3a')]};});}}catch(_0x36372e){_0x2fe5cb(_0x36372e);}_0x2ba787(_0x5c98ff);});}function getInteractionTags(_0x232b6c,_0x176ec2){return new BPromise(function(_0x227605,_0x416c43){try{if(_0x232b6c[_0x9631('0x3b')]){_0x232b6c['Tags']=[];_0x232b6c[_0x9631('0x3b')]['split'](',')[_0x9631('0x3c')](function(_0x53f3e4){_0x232b6c[_0x9631('0x3d')][_0x9631('0x3e')](_0x176ec2[_0x53f3e4]);});}delete _0x232b6c['TagIds'];}catch(_0x4eeeb4){_0x416c43(_0x4eeeb4);}_0x227605(_0x232b6c);});}function getLastMessageText(_0x2ade0b){return new BPromise(function(_0x5ef08e,_0x242e9d){return db[_0x9631('0x3f')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x2ade0b['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x9631('0x40')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x9631('0x41')],'order':_0x9631('0x42'),'raw':!![]})[_0x9631('0x2e')](function(_0x37ae9a){if(_0x37ae9a&&_0x37ae9a[_0x9631('0x41')]){_0x2ade0b['lastMsgText']=_['trimStart'](_0x37ae9a[_0x9631('0x41')]);}_0x5ef08e(_0x2ade0b);})['catch'](function(_0x18e5d3){_0x242e9d(_0x18e5d3);});});}function updateMailInteraction(_0x48c22e,_0x3dbe4e,_0x552e33,_0x1e2f2c){return new BPromise(function(_0xfcf8e3,_0x2425b6){return getInteractionUsers(_0x48c22e,_0x552e33)[_0x9631('0x2e')](function(_0x779e33){return getInteractionTags(_0x779e33,_0x3dbe4e);})[_0x9631('0x2e')](function(_0x5679fb){if(_0x1e2f2c){_0xfcf8e3(getLastMessageText(_0x5679fb));}else{_0xfcf8e3(_0x5679fb);}})[_0x9631('0x43')](function(_0x3a4556){_0x2425b6(_0x3a4556);});});}exports[_0x9631('0x44')]=function(_0x59434c,_0x171431){var _0x4c6462={},_0x32af00={},_0x18befa={'count':0x0,'rows':[]};var _0x2f52c0=_['map'](db[_0x9631('0x45')][_0x9631('0x46')],function(_0x163228){return{'name':_0x163228[_0x9631('0x47')],'type':_0x163228[_0x9631('0x48')][_0x9631('0x49')]};});_0x32af00[_0x9631('0x4a')]=_[_0x9631('0x39')](_0x2f52c0,_0x9631('0x31'));_0x32af00[_0x9631('0x4b')]=_[_0x9631('0x4c')](_0x59434c[_0x9631('0x4b')]);_0x32af00[_0x9631('0x4d')]=_[_0x9631('0x4e')](_0x32af00['model'],_0x32af00['query']);_0x4c6462[_0x9631('0x4f')]=_[_0x9631('0x4e')](_0x32af00[_0x9631('0x4a')],qs[_0x9631('0x50')](_0x59434c['query'][_0x9631('0x50')]));_0x4c6462[_0x9631('0x4f')]=_0x4c6462[_0x9631('0x4f')][_0x9631('0x51')]?_0x4c6462['attributes']:_0x32af00['model'];if(!_0x59434c[_0x9631('0x4b')][_0x9631('0x52')](_0x9631('0x53'))){_0x4c6462['limit']=qs[_0x9631('0x26')](_0x59434c[_0x9631('0x4b')]['limit']);_0x4c6462[_0x9631('0x28')]=qs[_0x9631('0x28')](_0x59434c['query'][_0x9631('0x28')]);}_0x4c6462[_0x9631('0x54')]=qs['sort'](_0x59434c[_0x9631('0x4b')][_0x9631('0x55')]);_0x4c6462['where']=qs[_0x9631('0x4d')](_[_0x9631('0x56')](_0x59434c['query'],_0x32af00[_0x9631('0x4d')]),_0x2f52c0);var _0x363045=[];var _0x5bc250=squel[_0x9631('0x57')]()[_0x9631('0x58')]('id')[_0x9631('0x58')](_0x9631('0x31'))['field'](_0x9631('0x59'))[_0x9631('0x5a')]('tools_tags');var _0x5ed41c=squel[_0x9631('0x57')]()['field'](_0x9631('0x5b'))[_0x9631('0x58')](_0x9631('0x5c'))[_0x9631('0x58')](_0x9631('0x5d'))[_0x9631('0x5a')](_0x9631('0x5e'),'ui')[_0x9631('0x5f')](_0x9631('0x60'),'u',_0x9631('0x61'));var _0x13471a=squel[_0x9631('0x57')]()['from'](_0x9631('0x62'),'i')['left_join'](_0x9631('0x63'),'c',_0x9631('0x64'))[_0x9631('0x5f')]('users','o','o.id\x20=\x20i.UserId')[_0x9631('0x5f')](_0x9631('0x65'),'a','a.id\x20=\x20i.MailAccountId')[_0x9631('0x5f')]('mail_messages','me',_0x9631('0x66'))[_0x9631('0x5f')](_0x9631('0x67'),'it',_0x9631('0x68'))[_0x9631('0x5f')](_0x9631('0x69'),'t',_0x9631('0x6a'));var _0x5bb2b9=squel[_0x9631('0x6b')]();var _0xa71dcc=[];var _0x5bb5e6=squel[_0x9631('0x6b')]();var _0x4e4a29;if(_0x59434c['query'][_0x9631('0x6c')]){_0x4e4a29=as[_0x9631('0x6d')](_0x59434c[_0x9631('0x4b')][_0x9631('0x6c')]);var _0x28c692=_0x4e4a29[_0x9631('0x6e')];for(var _0x2a8c82=0x0;_0x2a8c82<_0x4e4a29[_0x9631('0x6f')][_0x9631('0x51')];_0x2a8c82++){var _0x37fdc3=_0x4e4a29['conditions'][_0x2a8c82];var _0x30b9ac='i';var _0x3063e3=_['find'](_0x2f52c0,[_0x9631('0x31'),_0x37fdc3['field']]);if(!_0x3063e3){switch(_0x37fdc3['field']){case _0x9631('0x70'):if(_0x37fdc3['value']==0x1){_0x13471a[_0x9631('0x71')]('`'+_0x37fdc3[_0x9631('0x58')]+'`\x20=\x200');}else{_0x13471a[_0x9631('0x71')]('`'+_0x37fdc3['field']+'`\x20>\x200');}break;case'Contact':if(_0x37fdc3[_0x9631('0x72')]===_0x9631('0x73')){if(_0x37fdc3['value'][_0x9631('0x74')]('\x20')[_0x9631('0x51')]>0x1){_0x5bb2b9[_0x28c692]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x37fdc3[_0x9631('0x75')]),null);}else{var _0x342192='%'+_0x37fdc3['value']+'%';_0x5bb2b9[_0x28c692]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x342192,_0x342192,_0x342192);}}else{_0x3063e3=_[_0x9631('0x76')](_0x2f52c0,['name','ContactId']);_0x37fdc3[_0x9631('0x58')]=_0x9631('0x77');_0x4458f3=as[_0x9631('0x78')](_0x30b9ac,_0x3063e3['type'],_0x37fdc3);_0x5bb2b9[_0x28c692](_0x4458f3[_0x9631('0x79')],_0x4458f3[_0x9631('0x75')][_0x9631('0x7a')],_0x4458f3[_0x9631('0x75')]['end']);}break;case _0x9631('0x7b'):var _0x1969f1=_0x37fdc3[_0x9631('0x75')][_0x9631('0x74')](',')[_0x9631('0x39')](function(_0x4b459f){return Number(_0x4b459f);});_0x1969f1[_0x9631('0x3c')](function(_0x35963c){_0x5bb5e6['or'](_0x9631('0x7c'),'%,'+_0x35963c+',%');});_0xa71dcc=_[_0x9631('0x7d')](_0xa71dcc,_0x1969f1);break;case _0x9631('0x7e'):if(_0x37fdc3[_0x9631('0x72')]===_0x9631('0x73')){_0x5bb2b9[_0x28c692](_0x9631('0x7f'),'%'+_0x37fdc3[_0x9631('0x75')]+'%',null);}else{_0x3063e3=_[_0x9631('0x76')](_0x2f52c0,[_0x9631('0x31'),_0x9631('0x80')]);_0x37fdc3[_0x9631('0x58')]=_0x9631('0x80');_0x4458f3=as[_0x9631('0x78')](_0x30b9ac,_0x3063e3[_0x9631('0x48')],_0x37fdc3);_0x5bb2b9[_0x28c692](_0x4458f3[_0x9631('0x79')],_0x4458f3['value'][_0x9631('0x7a')],_0x4458f3[_0x9631('0x75')][_0x9631('0x24')]);}break;case'plainBody':_0x4458f3=as[_0x9631('0x78')]('me',null,_0x37fdc3);_0x5bb2b9[_0x28c692](_0x4458f3['text'],_0x4458f3[_0x9631('0x75')][_0x9631('0x7a')],_0x4458f3[_0x9631('0x75')][_0x9631('0x24')]);break;}}else{var _0x4458f3=as[_0x9631('0x78')](_0x30b9ac,_0x3063e3[_0x9631('0x48')],_0x37fdc3);_0x5bb2b9[_0x28c692](_0x4458f3[_0x9631('0x79')],_0x4458f3[_0x9631('0x75')]['start'],_0x4458f3[_0x9631('0x75')][_0x9631('0x24')]);}}}else{var _0x38a0f2=_(_0x59434c[_0x9631('0x4b')])[_0x9631('0x4c')]()[_0x9631('0x39')](function(_0x3a81de){return _['some'](_0x2f52c0,[_0x9631('0x31'),_0x3a81de])?_0x3a81de:undefined;})[_0x9631('0x81')]()['value']();if(!_[_0x9631('0x82')](_0x38a0f2)){_0x38a0f2[_0x9631('0x3c')](function(_0x5e8544){if(_0x5e8544===_0x9631('0x83')){_0x13471a[_0x9631('0x84')](_0x9631('0x85'),[][_0x9631('0x86')](_0x59434c[_0x9631('0x4b')][_0x5e8544]));}else if(_0x5e8544===_0x9631('0x87')){var _0x35c5b6=JSON[_0x9631('0x88')](_0x59434c[_0x9631('0x4b')][_0x5e8544])[_0x9631('0x89')];var _0x5cbc8d=JSON[_0x9631('0x88')](_0x59434c[_0x9631('0x4b')][_0x5e8544])[_0x9631('0x8a')];_0x13471a[_0x9631('0x84')](_0x9631('0x8b'),_0x35c5b6,_0x5cbc8d);}else{if(_0x59434c[_0x9631('0x4b')][_0x5e8544]===_0x9631('0x8c')){_0x13471a[_0x9631('0x84')]('i.'+_0x5e8544+'\x20IS\x20NULL');}else{_0x13471a[_0x9631('0x84')]('i.'+_0x5e8544+_0x9631('0x8d'),_0x59434c[_0x9631('0x4b')][_0x5e8544]);}}});}if(_0x59434c[_0x9631('0x4b')]['read']){if(_0x59434c['query'][_0x9631('0x8e')]==0x1){_0x13471a[_0x9631('0x71')](_0x9631('0x8f'));}else{_0x13471a['having'](_0x9631('0x90'));}}if(_0x59434c[_0x9631('0x4b')][_0x9631('0x91')]){_0xa71dcc=_[_0x9631('0x92')](_0x59434c[_0x9631('0x4b')][_0x9631('0x91')])?_0x59434c[_0x9631('0x4b')][_0x9631('0x91')]:new Array(_0x59434c[_0x9631('0x4b')][_0x9631('0x91')]);_0xa71dcc[_0x9631('0x3c')](function(_0x260998){_0x5bb5e6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x260998+',%');});}if(_0x59434c[_0x9631('0x4b')][_0x9631('0x93')]){var _0x4f28bc=_0x59434c['query'][_0x9631('0x93')][_0x9631('0x94')]('\x5c','\x5c\x5c')[_0x9631('0x94')](/'/g,'\x27\x27');if(qs[_0x9631('0x95')](_0x4f28bc)){_0x5bb2b9['or'](_0x9631('0x96'),_0x4f28bc+'%');}else if(qs['isEmail'](_0x4f28bc)){_0x5bb2b9['or']('c.email\x20LIKE\x20?',_0x4f28bc+'%');}else{_0x5bb2b9['or'](_0x9631('0x97'),qs[_0x9631('0x98')](_0x4f28bc))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4f28bc));}}}_0x13471a[_0x9631('0x84')](_0x5bb2b9);_0x13471a[_0x9631('0x99')]('i.id');var _0x2e3592={'type':db['Sequelize'][_0x9631('0x9a')][_0x9631('0x9b')],'raw':!![]};var _0x552e13=_0x13471a['clone']();_0x552e13['field']('i.id');_0x552e13[_0x9631('0x58')](_0x9631('0x9c'),_0x9631('0x70'));if(_0x4c6462[_0x9631('0x54')]){_0x4c6462[_0x9631('0x54')]['forEach'](function(_0xa8320a){var _0x298eec=_0xa8320a[0x0]===_0x9631('0x9d')?_0xa8320a[0x0]:'i.'+_0xa8320a[0x0];_0x13471a['order'](_0x298eec,_0xa8320a[0x1]===_0x9631('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0xa71dcc)){_0x13471a[_0x9631('0x71')](_0x5bb5e6);_0x552e13[_0x9631('0x84')](_0x9631('0x9f'),_0xa71dcc);}BPromise[_0x9631('0xa0')]()[_0x9631('0x2e')](function(){if(!_0x4e4a29){if(_0x59434c[_0x9631('0x4b')][_0x9631('0x83')])return;_0x552e13[_0x9631('0x84')](_0x9631('0xa1'));_0x13471a[_0x9631('0x84')](_0x9631('0xa1'));return;}if(_0x59434c['user']['role']!==_0x9631('0x36'))return;return _0x59434c[_0x9631('0xa2')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x9631('0x2e')](function(_0x35c0e5){if(_[_0x9631('0x82')](_0x35c0e5)){_0x552e13['where'](_0x9631('0xa3'));_0x13471a[_0x9631('0x84')](_0x9631('0xa3'));}else{_0x552e13[_0x9631('0x84')](_0x9631('0x85'),_['map'](_0x35c0e5,'id'));_0x13471a['where'](_0x9631('0x85'),_[_0x9631('0x39')](_0x35c0e5,'id'));}});})['then'](function(){if(_0x59434c[_0x9631('0xa2')][_0x9631('0xa4')]===_0x9631('0x36')&&!_0x4e4a29&&!_0x59434c[_0x9631('0x4b')]['MailAccountId'])return[];return db[_0x9631('0xa5')][_0x9631('0x4b')](_0x552e13[_0x9631('0xa6')](),_0x2e3592);})[_0x9631('0x2e')](function(_0x362884){_0x18befa[_0x9631('0x27')]=_0x362884['length'];if(_0x18befa[_0x9631('0x27')]===0x0)return[];return db[_0x9631('0xa5')][_0x9631('0x4b')](_0x5bc250['toString'](),_0x2e3592)[_0x9631('0x2e')](function(_0x3e8994){_0x363045=_[_0x9631('0xa7')](_0x3e8994,'id');_0x2e3592=_['merge'](_0x2e3592,{'model':db[_0x9631('0x45')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59434c[_0x9631('0x4b')]['fields']){_0x4c6462[_0x9631('0x4f')][_0x9631('0x3c')](function(_0xd58c4c){_0x13471a[_0x9631('0x58')]('i.'+_0xd58c4c);});}else{_0x13471a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x13471a[_0x9631('0x58')](_0x9631('0xa8'),'Account.key');_0x13471a[_0x9631('0x58')](_0x9631('0xa9'),_0x9631('0xaa'));_0x13471a[_0x9631('0x58')](_0x9631('0xab'),_0x9631('0x9d'));_0x13471a[_0x9631('0x58')](_0x9631('0xac'));_0x13471a['field']('i.createdAt');_0x13471a[_0x9631('0x58')](_0x9631('0xad'));_0x13471a[_0x9631('0x58')](_0x9631('0xae'));_0x13471a[_0x9631('0x58')](_0x9631('0xaf'));_0x13471a[_0x9631('0x58')]('i.attach');_0x13471a[_0x9631('0x58')](_0x9631('0xb0'));_0x13471a[_0x9631('0x58')](_0x9631('0xb1'));_0x13471a[_0x9631('0x58')](_0x9631('0xb2'));_0x13471a['field'](_0x9631('0xb3'));_0x13471a[_0x9631('0x58')]('i.secondDisposition');_0x13471a[_0x9631('0x58')](_0x9631('0xb4'));_0x13471a[_0x9631('0x58')]('i.substatus');_0x13471a['field'](_0x9631('0xb5'));_0x13471a[_0x9631('0x58')](_0x9631('0xb6'));_0x13471a[_0x9631('0x58')](_0x9631('0xb7'));_0x13471a[_0x9631('0x58')](_0x9631('0xb8'));_0x13471a[_0x9631('0x58')](_0x9631('0xb9'),_0x9631('0xba'));_0x13471a['field'](_0x9631('0xbb'),_0x9631('0xbc'));_0x13471a[_0x9631('0x58')](_0x9631('0xbd'),'Contact.email');_0x13471a[_0x9631('0x58')](_0x9631('0xbe'),'Contact.phone');_0x13471a[_0x9631('0x58')](_0x9631('0xbf'),_0x9631('0xc0'));_0x13471a[_0x9631('0x58')](_0x9631('0xc1'),_0x9631('0xc2'));_0x13471a[_0x9631('0x58')](_0x9631('0xc3'),_0x9631('0xc4'));_0x13471a[_0x9631('0x58')](_0x9631('0xc5'),_0x9631('0xc6'));_0x13471a[_0x9631('0x58')](_0x9631('0xc7'),_0x9631('0x3b'));}if(_0x4c6462['limit'])_0x13471a[_0x9631('0x26')](_0x4c6462['limit']);if(_0x4c6462[_0x9631('0x28')])_0x13471a[_0x9631('0x28')](_0x4c6462['offset']);return db[_0x9631('0xa5')]['query'](_0x13471a[_0x9631('0xa6')](),_0x2e3592);})[_0x9631('0x2e')](function(_0x217f52){if(_0x217f52[_0x9631('0x51')]>0x0)_0x5ed41c[_0x9631('0x84')](_0x9631('0xc8'),_[_0x9631('0x39')](_0x217f52,'id'));return db[_0x9631('0xa5')][_0x9631('0x4b')](_0x5ed41c['toString'](),_0x2e3592)['then'](function(_0x57c33e){var _0x449d11=_['groupBy'](_0x57c33e,_0x9631('0xc9'));var _0x526c2f=[];return db['Setting'][_0x9631('0xca')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x1c2657){var _0x5b21b9=_0x1c2657[_0x9631('0xcb')];_0x217f52['forEach'](function(_0x21ba57){_0x526c2f['push'](updateMailInteraction(_0x21ba57,_0x363045,_0x449d11,_0x5b21b9));});return BPromise[_0x9631('0xcc')](_0x526c2f);});});});})[_0x9631('0x2e')](function(_0x3f2627){_0x18befa[_0x9631('0xcd')]=_0x3f2627;return _0x18befa;})[_0x9631('0x2e')](respondWithFilteredResult(_0x171431,_0x4c6462))['catch'](handleError(_0x171431,null));};exports['show']=function(_0x47e302,_0x1318f7){var _0x1af304={'raw':![],'where':{'id':_0x47e302['params']['id']}},_0x6097e1={};_0x6097e1[_0x9631('0x4a')]=_[_0x9631('0x4c')](db[_0x9631('0x45')]['rawAttributes']);_0x6097e1[_0x9631('0x4b')]=_['keys'](_0x47e302[_0x9631('0x4b')]);_0x6097e1[_0x9631('0x4d')]=_['intersection'](_0x6097e1[_0x9631('0x4a')],_0x6097e1['query']);_0x1af304[_0x9631('0x4f')]=_[_0x9631('0x4e')](_0x6097e1[_0x9631('0x4a')],qs['fields'](_0x47e302[_0x9631('0x4b')]['fields']));_0x1af304[_0x9631('0x4f')]=_0x1af304[_0x9631('0x4f')][_0x9631('0x51')]?_0x1af304['attributes']:_0x6097e1[_0x9631('0x4a')];if(_0x47e302[_0x9631('0x4b')]['includeAll']){_0x1af304['include']=[{'all':!![]}];}_0x1af304=_[_0x9631('0x33')]({},_0x1af304,_0x47e302[_0x9631('0xce')]);return db['MailInteraction'][_0x9631('0x76')](_0x1af304)[_0x9631('0x2e')](handleEntityNotFound(_0x1318f7,null))['then'](respondWithResult(_0x1318f7,null))[_0x9631('0x43')](handleError(_0x1318f7,null));};exports[_0x9631('0xcf')]=function(_0x30f490,_0x6d557){return db['MailInteraction'][_0x9631('0xcf')](_0x30f490[_0x9631('0x34')],{})[_0x9631('0x2e')](respondWithResult(_0x6d557,0xc9))['catch'](handleError(_0x6d557,null));};exports[_0x9631('0x2d')]=function(_0x1e086b,_0xc525d){if(_0x1e086b['body']['id']){delete _0x1e086b[_0x9631('0x34')]['id'];}return db[_0x9631('0x45')][_0x9631('0x76')]({'where':{'id':_0x1e086b[_0x9631('0xd0')]['id']}})['then'](handleEntityNotFound(_0xc525d,null))[_0x9631('0x2e')](saveUpdates(_0x1e086b[_0x9631('0x34')],null))[_0x9631('0x2e')](respondWithResult(_0xc525d,null))[_0x9631('0x43')](handleError(_0xc525d,null));};exports[_0x9631('0xd1')]=function(_0x1e0613,_0x11c2bf){return db[_0x9631('0x45')][_0x9631('0x76')]({'where':{'id':_0x1e0613[_0x9631('0xd0')]['id']}})[_0x9631('0x2e')](handleEntityNotFound(_0x11c2bf,null))[_0x9631('0x2e')](removeEntity(_0x11c2bf,null))[_0x9631('0x43')](handleError(_0x11c2bf,null));};exports[_0x9631('0xd2')]=function(_0x49a60d,_0x61672a){return db['MailInteraction'][_0x9631('0xd2')]()['then'](respondWithResult(_0x61672a,null))['catch'](handleError(_0x61672a,null));};exports['addMessage']=function(_0x2b1830,_0x30de37,_0x1d198b){return db[_0x9631('0x3f')][_0x9631('0x76')]({'where':{'id':_0x2b1830[_0x9631('0xd0')]['id']}})['then'](handleEntityNotFound(_0x30de37,null))[_0x9631('0x2e')](function(_0x1c7dba){if(_0x1c7dba){return _0x1c7dba['addMessage'](_0x2b1830[_0x9631('0x34')][_0x9631('0xd3')],_['omit'](_0x2b1830[_0x9631('0x34')],[_0x9631('0xd3'),'id'])||{});}})[_0x9631('0x2e')](respondWithResult(_0x30de37,null))['catch'](handleError(_0x30de37,null));};exports[_0x9631('0xd4')]=function(_0x590598,_0x48c8e4,_0xea993){var _0x24a206={'raw':![],'where':{}};var _0x2d2f9a={};var _0xd46458={'count':0x0,'rows':[]};return db[_0x9631('0x45')][_0x9631('0xca')]({'where':{'id':_0x590598[_0x9631('0xd0')]['id']}})[_0x9631('0x2e')](handleEntityNotFound(_0x48c8e4,null))[_0x9631('0x2e')](function(_0x2fc091){if(_0x2fc091){_0x2d2f9a['model']=_[_0x9631('0x4c')](db[_0x9631('0x3f')][_0x9631('0x46')]);_0x2d2f9a['query']=_['keys'](_0x590598[_0x9631('0x4b')]);_0x2d2f9a[_0x9631('0x4d')]=_[_0x9631('0x4e')](_0x2d2f9a['model'],_0x2d2f9a['query']);_0x24a206['attributes']=_[_0x9631('0x4e')](_0x2d2f9a[_0x9631('0x4a')],qs[_0x9631('0x50')](_0x590598[_0x9631('0x4b')][_0x9631('0x50')]));_0x24a206[_0x9631('0x4f')]=_0x24a206['attributes'][_0x9631('0x51')]?_0x24a206['attributes']:_0x2d2f9a['model'];if(!_0x590598[_0x9631('0x4b')][_0x9631('0x52')](_0x9631('0x53'))){_0x24a206[_0x9631('0x26')]=qs[_0x9631('0x26')](_0x590598[_0x9631('0x4b')][_0x9631('0x26')]);_0x24a206[_0x9631('0x28')]=qs[_0x9631('0x28')](_0x590598[_0x9631('0x4b')][_0x9631('0x28')]);}_0x24a206['order']=qs['sort'](_0x590598[_0x9631('0x4b')][_0x9631('0x55')]);_0x24a206[_0x9631('0x84')]=qs[_0x9631('0x4d')](_[_0x9631('0x56')](_0x590598[_0x9631('0x4b')],_0x2d2f9a[_0x9631('0x4d')]));_0x24a206[_0x9631('0x84')][_0x9631('0xc9')]=_0x2fc091['id'];if(_0x590598[_0x9631('0x4b')]['filter']){_0x24a206[_0x9631('0x84')]=_[_0x9631('0x33')](_0x24a206[_0x9631('0x84')],{'$or':_[_0x9631('0x39')](_0x24a206[_0x9631('0x4f')],function(_0x1083f1){var _0x4f8fa9={};_0x4f8fa9[_0x1083f1]={'$like':'%'+_0x590598['query'][_0x9631('0x93')]+'%'};return _0x4f8fa9;})});}if(_0x590598[_0x9631('0x4b')][_0x9631('0x89')]){var _0x2058c2=_0x590598['query'][_0x9631('0x89')][_0x9631('0x74')](',');var _0x397379={};_0x397379[_0x2058c2[0x0]]={'$gte':moment(_0x2058c2[0x1])[_0x9631('0xd5')](_0x9631('0xd6'))};_0x24a206[_0x9631('0x84')]=_[_0x9631('0x33')](_0x24a206[_0x9631('0x84')],_0x397379);}_0x24a206=_[_0x9631('0x33')]({},_0x24a206,_0x590598[_0x9631('0xce')]);return db['MailMessage'][_0x9631('0x27')]({'where':_0x24a206['where']})[_0x9631('0x2e')](function(_0x50f983){_0xd46458[_0x9631('0x27')]=_0x50f983;if(_0x590598[_0x9631('0x4b')][_0x9631('0xd7')]){_0x24a206[_0x9631('0xd8')]=[{'all':!![]}];}return db[_0x9631('0x3f')]['findAll'](_0x24a206);})[_0x9631('0x2e')](function(_0x328893){if(_0x590598[_0x9631('0x4b')][_0x9631('0xd9')]===_0x9631('0xda')){for(var _0x45ca94=0x0;_0x45ca94<_0x328893[_0x9631('0x51')];_0x45ca94++){_0x328893[_0x45ca94][_0x9631('0x34')]=juice(_0x328893[_0x45ca94][_0x9631('0x34')]);}}_0xd46458['rows']=_0x328893;return _0xd46458;});}})['then'](respondWithFilteredResult(_0x48c8e4,_0x24a206))[_0x9631('0x43')](handleError(_0x48c8e4,null));};exports[_0x9631('0xdb')]=function(_0x1e24a3,_0x1a0929,_0x2c4080){return db[_0x9631('0x45')][_0x9631('0x76')]({'where':{'id':_0x1e24a3['params']['id']}})['then'](handleEntityNotFound(_0x1a0929,null))['then'](function(_0x5d5790){if(_0x5d5790){return _0x5d5790[_0x9631('0xdc')](_0x1e24a3[_0x9631('0x34')]['ids'],_['omit'](_0x1e24a3[_0x9631('0x34')],[_0x9631('0xd3'),'id'])||{})['spread'](function(){return db[_0x9631('0x7b')]['findAll']({'attributes':['id',_0x9631('0x31'),_0x9631('0x59')],'where':{'id':_0x1e24a3['body'][_0x9631('0xd3')]}});})['then'](function(_0x2e8aa9){socket[_0x9631('0xdd')](_0x9631('0xde'),{'id':Number(_0x1e24a3['params']['id']),'tags':_0x2e8aa9||[]});return{'id':Number(_0x1e24a3[_0x9631('0xd0')]['id']),'tags':_0x2e8aa9||[]};});}})[_0x9631('0x2e')](respondWithResult(_0x1a0929,null))['catch'](handleError(_0x1a0929,null));};exports[_0x9631('0xdf')]=function(_0x258181,_0x21121d,_0xb4ccd3){return db['MailInteraction']['find']({'where':{'id':_0x258181[_0x9631('0xd0')]['id']}})[_0x9631('0x2e')](handleEntityNotFound(_0x21121d,null))['then'](function(_0x2a1475){if(_0x2a1475){return _0x2a1475[_0x9631('0xdf')](_0x258181[_0x9631('0x4b')][_0x9631('0xd3')]);}})[_0x9631('0x2e')](respondWithStatusCode(_0x21121d,null))['catch'](handleError(_0x21121d,null));};exports['download']=function(_0x5e275b,_0x42a667){var _0x389b8f=moment()[_0x9631('0xe0')]()[_0x9631('0xa6')]();var _0x3e738c=path['join'](config[_0x9631('0xe1')],'server',_0x9631('0xe2'),'tmp');var _0x205fea=path[_0x9631('0xe3')](config[_0x9631('0xe1')],_0x9631('0xe4'),'files','attachments');var _0x3cc257=path[_0x9631('0xe3')](_0x3e738c,_0x389b8f);var _0x1783df=util[_0x9631('0xd5')](_0x9631('0xe5'),_0x5e275b['params']['id'],_0x389b8f);var _0x1e6e52=path[_0x9631('0xe3')](_0x3e738c,_0x1783df);var _0x4fc8a2=[];if(_0x5e275b[_0x9631('0x4b')][_0x9631('0xe6')]){_0x4fc8a2[_0x9631('0x3e')]({'model':db[_0x9631('0xe7')],'as':_0x9631('0xe8'),'raw':!![]});}var _0x2e70a5=[{'model':db[_0x9631('0x3f')],'as':_0x9631('0xe9'),'attributes':['id','body',_0x9631('0x5a'),'to','cc',_0x9631('0xea'),_0x9631('0xeb'),_0x9631('0x87')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x4fc8a2}];return db[_0x9631('0x45')][_0x9631('0x76')]({'where':{'id':_0x5e275b[_0x9631('0xd0')]['id']},'include':_0x2e70a5})['then'](handleEntityNotFound(_0x42a667,null))[_0x9631('0x2e')](function(_0x1faa60){if(_0x1faa60&&_0x1faa60[_0x9631('0xe9')]){var _0x466b22=_0x1faa60[_0x9631('0xec')]({'plain':!![]});fs['mkdirSync'](_0x3cc257);return BPromise[_0x9631('0xed')](_0x466b22[_0x9631('0xe9')],function(_0x55edbc,_0x19e69c){var _0x260614={'from':_0x55edbc[_0x9631('0x5a')],'to':_0x55edbc['to'],'subject':_0x55edbc[_0x9631('0xeb')],'html':_0x55edbc[_0x9631('0x34')],'headers':{'Date':moment(_0x55edbc['createdAt'])[_0x9631('0xd5')](_0x9631('0xee'))},'attachments':[]};if(_0x55edbc['cc']){_0x260614[_0x9631('0xef')]['Cc']=_0x55edbc['cc'];}if(_0x55edbc['bcc']){_0x260614['headers'][_0x9631('0xf0')]=_0x55edbc[_0x9631('0xea')];}return new BPromise(function(_0x1d4f11,_0x216cfb){if(_0x55edbc[_0x9631('0xe8')]){for(var _0x2ec601=0x0;_0x2ec601<_0x55edbc['Attachments']['length'];_0x2ec601++){var _0x3e7167=_0x55edbc[_0x9631('0xe8')][_0x2ec601];var _0x3c391c=path[_0x9631('0xe3')](_0x205fea,_0x3e7167[_0x9631('0xf1')]);if(fs[_0x9631('0xf2')](_0x3c391c)){_0x260614[_0x9631('0xe6')][_0x9631('0x3e')]({'name':_0x3e7167['name'],'contentType':_0x3e7167[_0x9631('0x48')],'data':fs['readFileSync'](_0x3c391c)});}}}emlformat['build'](_0x260614,function(_0x21a6d6,_0x12a350){if(_0x21a6d6)return _0x216cfb(_0x21a6d6);fs[_0x9631('0xf3')](path[_0x9631('0xe3')](_0x3cc257,util['format'](_0x9631('0xf4'),_0x19e69c)),_0x12a350);return _0x1d4f11(_0x12a350);});});})[_0x9631('0x2e')](function(){return new BPromise(function(_0x1c2d74,_0x39f03f){zipdir(_0x3cc257,{'saveTo':_0x1e6e52},function(_0x4dc851,_0x431e13){if(_0x4dc851)return _0x39f03f(_0x4dc851);return _0x1c2d74(_0x431e13);});})[_0x9631('0x2e')](function(){return new BPromise(function(_0x294daf,_0x4be2d6){rimraf(_0x3cc257,function(_0x10077d){if(_0x10077d)_0x4be2d6(_0x10077d);return _0x294daf();});});})[_0x9631('0x2e')](function(){return _0x42a667[_0x9631('0xf5')](_0x1e6e52,_0x1783df,function(_0x410e4d){if(_0x410e4d){console['log']('err',_0x410e4d);}else{fs[_0x9631('0xf6')](_0x1e6e52);}});});});}else{return _0x42a667['sendStatus'](0xc8);}})[_0x9631('0x43')](handleError(_0x42a667,null));}; \ No newline at end of file +var _0x10fc=['expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','$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','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','getMailAccounts','user','role','count','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','push','all','show','includeAll','include','options','create','params','describe','addMessage','ids','getMessages','hasOwnProperty','nolimit','pick','format','findAll','addTags','setTags','omit','spread','color','emit','removeTags','download','join','root','server','files','attachments','Attachment','Attachments','Messages','subject','createdAt','mkdirSync','headers','bcc','Bcc','basename','existsSync','build','writeFileSync','log','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','merge','body','agent','interaction','account','map','fullname','TagIds','split','forEach','Tags','MailMessage','findOne','plainBody','-id','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','order','sort','select','field','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId'];(function(_0xcf439f,_0x10519f){var _0x107d20=function(_0x4472b1){while(--_0x4472b1){_0xcf439f['push'](_0xcf439f['shift']());}};_0x107d20(++_0x10519f);}(_0x10fc,0x91));var _0xc10f=function(_0x4f6835,_0x2d0e5e){_0x4f6835=_0x4f6835-0x0;var _0x47cf5a=_0x10fc[_0x4f6835];return _0x47cf5a;};'use strict';var emlformat=require(_0xc10f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc10f('0x1'));var jsonpatch=require(_0xc10f('0x2'));var rp=require(_0xc10f('0x3'));var moment=require(_0xc10f('0x4'));var BPromise=require(_0xc10f('0x5'));var Mustache=require(_0xc10f('0x6'));var util=require('util');var path=require(_0xc10f('0x7'));var sox=require(_0xc10f('0x8'));var csv=require(_0xc10f('0x9'));var ejs=require(_0xc10f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc10f('0xb'));var squel=require(_0xc10f('0xc'));var crypto=require('crypto');var jsforce=require(_0xc10f('0xd'));var deskjs=require(_0xc10f('0xe'));var toCsv=require(_0xc10f('0x9'));var querystring=require(_0xc10f('0xf'));var Papa=require(_0xc10f('0x10'));var htmlToText=require('html-to-text');var juice=require(_0xc10f('0x11'));var Redis=require(_0xc10f('0x12'));var authService=require(_0xc10f('0x13'));var qs=require(_0xc10f('0x14'));var as=require(_0xc10f('0x15'));var hardwareService=require(_0xc10f('0x16'));var logger=require(_0xc10f('0x17'))(_0xc10f('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc10f('0x19'));var db=require(_0xc10f('0x1a'))['db'];config[_0xc10f('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc10f('0x1b')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x121437,_0x2a1b72){_0x2a1b72=_0x2a1b72||0xcc;return function(_0x251921){if(_0x251921){return _0x121437[_0xc10f('0x1c')](_0x2a1b72);}return _0x121437[_0xc10f('0x1d')](_0x2a1b72)['end']();};}function respondWithResult(_0x2e929a,_0x2838f7){_0x2838f7=_0x2838f7||0xc8;return function(_0x5e11cc){if(_0x5e11cc){return _0x2e929a['status'](_0x2838f7)[_0xc10f('0x1e')](_0x5e11cc);}};}function respondWithFilteredResult(_0x1d1285,_0x28e34c){return function(_0x4fbc15){if(_0x4fbc15){var _0x25d5fb=typeof _0x28e34c[_0xc10f('0x1f')]===_0xc10f('0x20')&&typeof _0x28e34c['limit']===_0xc10f('0x20');var _0x20b559=_0x4fbc15['count'];var _0x46c710=_0x25d5fb?0x0:_0x28e34c[_0xc10f('0x1f')];var _0x54da27=_0x25d5fb?_0x4fbc15['count']:_0x28e34c['offset']+_0x28e34c[_0xc10f('0x21')];var _0x1bba82;if(_0x54da27>=_0x20b559){_0x54da27=_0x20b559;_0x1bba82=0xc8;}else{_0x1bba82=0xce;}_0x1d1285[_0xc10f('0x1d')](_0x1bba82);return _0x1d1285[_0xc10f('0x22')](_0xc10f('0x23'),_0x46c710+'-'+_0x54da27+'/'+_0x20b559)['json'](_0x4fbc15);}return null;};}function patchUpdates(_0x221707){return function(_0x2bad26){try{jsonpatch[_0xc10f('0x24')](_0x2bad26,_0x221707,!![]);}catch(_0x4befa7){return BPromise[_0xc10f('0x25')](_0x4befa7);}return _0x2bad26[_0xc10f('0x26')]();};}function saveUpdates(_0x4bfeb2,_0x4c3fae){return function(_0x1cf7ff){if(_0x1cf7ff){return _0x1cf7ff[_0xc10f('0x27')](_0x4bfeb2)[_0xc10f('0x28')](function(_0x413330){return _0x413330;});}return null;};}function removeEntity(_0x1d8aec,_0x42372a){return function(_0x22c939){if(_0x22c939){return _0x22c939[_0xc10f('0x29')]()[_0xc10f('0x28')](function(){_0x1d8aec[_0xc10f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26313a,_0x3310e8){return function(_0x309955){if(!_0x309955){_0x26313a[_0xc10f('0x1c')](0x194);}return _0x309955;};}function handleError(_0x341e47,_0x475044){_0x475044=_0x475044||0x1f4;return function(_0x46d32c){logger[_0xc10f('0x2a')](_0x46d32c[_0xc10f('0x2b')]);if(_0x46d32c[_0xc10f('0x2c')]){delete _0x46d32c[_0xc10f('0x2c')];}_0x341e47['status'](_0x475044)['send'](_0x46d32c);};}function getMustacheRender(_0x34e04c,_0x58bef5){return Mustache['render'](_0x34e04c,_[_0xc10f('0x2d')](_0x58bef5[_0xc10f('0x2e')],{'contact':_0x58bef5['contact'],'message':_0x58bef5['message'],'agent':_0x58bef5[_0xc10f('0x2f')],'interaction':_0x58bef5[_0xc10f('0x30')],'account':_0x58bef5[_0xc10f('0x31')]}))||'';}function getInteractionUsers(_0x3441ae,_0x13f44e){return new BPromise(function(_0x19d0c1,_0xab6ee3){try{if(_0x13f44e[_0x3441ae['id']]){_0x3441ae['Users']=_[_0xc10f('0x32')](_0x13f44e[_0x3441ae['id']],function(_0x18b257){return{'id':_0x18b257['id'],'fullname':_0x18b257[_0xc10f('0x33')]};});}}catch(_0x18b00c){_0xab6ee3(_0x18b00c);}_0x19d0c1(_0x3441ae);});}function getInteractionTags(_0x3e6121,_0x4ec098){return new BPromise(function(_0x1a4a4d,_0x51c9b2){try{if(_0x3e6121[_0xc10f('0x34')]){_0x3e6121['Tags']=[];_0x3e6121['TagIds'][_0xc10f('0x35')](',')[_0xc10f('0x36')](function(_0x5ba0ad){_0x3e6121[_0xc10f('0x37')]['push'](_0x4ec098[_0x5ba0ad]);});}delete _0x3e6121['TagIds'];}catch(_0x5de48e){_0x51c9b2(_0x5de48e);}_0x1a4a4d(_0x3e6121);});}function getLastMessageText(_0x366dfa){return new BPromise(function(_0x22f944,_0x5f4923){return db[_0xc10f('0x38')][_0xc10f('0x39')]({'where':{'$and':[{'MailInteractionId':_0x366dfa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xc10f('0x3a')],'order':_0xc10f('0x3b'),'raw':!![]})[_0xc10f('0x28')](function(_0x2c1348){if(_0x2c1348&&_0x2c1348['plainBody']){_0x366dfa[_0xc10f('0x3c')]=_[_0xc10f('0x3d')](_0x2c1348[_0xc10f('0x3a')]);}_0x22f944(_0x366dfa);})[_0xc10f('0x3e')](function(_0x527414){_0x5f4923(_0x527414);});});}function updateMailInteraction(_0x77cc6b,_0x54ad04,_0x33bc61,_0x3889fc){return new BPromise(function(_0xf55437,_0x422edb){return getInteractionUsers(_0x77cc6b,_0x33bc61)[_0xc10f('0x28')](function(_0x3081aa){return getInteractionTags(_0x3081aa,_0x54ad04);})[_0xc10f('0x28')](function(_0x5699f6){if(_0x3889fc){_0xf55437(getLastMessageText(_0x5699f6));}else{_0xf55437(_0x5699f6);}})[_0xc10f('0x3e')](function(_0x43bf08){_0x422edb(_0x43bf08);});});}exports[_0xc10f('0x3f')]=function(_0x14ed4a,_0x585c2c){var _0x1d5d3e={},_0x34d87e={},_0x4e0b1c={'count':0x0,'rows':[]};var _0x1dd769=_['map'](db[_0xc10f('0x40')][_0xc10f('0x41')],function(_0x426d0e){return{'name':_0x426d0e['fieldName'],'type':_0x426d0e[_0xc10f('0x42')][_0xc10f('0x43')]};});_0x34d87e[_0xc10f('0x44')]=_[_0xc10f('0x32')](_0x1dd769,_0xc10f('0x2c'));_0x34d87e['query']=_[_0xc10f('0x45')](_0x14ed4a['query']);_0x34d87e[_0xc10f('0x46')]=_[_0xc10f('0x47')](_0x34d87e['model'],_0x34d87e[_0xc10f('0x48')]);_0x1d5d3e[_0xc10f('0x49')]=_[_0xc10f('0x47')](_0x34d87e[_0xc10f('0x44')],qs['fields'](_0x14ed4a[_0xc10f('0x48')][_0xc10f('0x4a')]));_0x1d5d3e['attributes']=_0x1d5d3e[_0xc10f('0x49')][_0xc10f('0x4b')]?_0x1d5d3e[_0xc10f('0x49')]:_0x34d87e[_0xc10f('0x44')];if(!_0x14ed4a[_0xc10f('0x48')]['hasOwnProperty']('nolimit')){_0x1d5d3e[_0xc10f('0x21')]=qs[_0xc10f('0x21')](_0x14ed4a[_0xc10f('0x48')]['limit']);_0x1d5d3e[_0xc10f('0x1f')]=qs[_0xc10f('0x1f')](_0x14ed4a[_0xc10f('0x48')][_0xc10f('0x1f')]);}_0x1d5d3e[_0xc10f('0x4c')]=qs[_0xc10f('0x4d')](_0x14ed4a['query'][_0xc10f('0x4d')]);_0x1d5d3e['where']=qs[_0xc10f('0x46')](_['pick'](_0x14ed4a[_0xc10f('0x48')],_0x34d87e['filters']),_0x1dd769);var _0x48aed0=[];var _0xd8c1a2=squel[_0xc10f('0x4e')]()[_0xc10f('0x4f')]('id')['field']('name')[_0xc10f('0x4f')]('color')[_0xc10f('0x50')](_0xc10f('0x51'));var _0x42ce09=squel['select']()[_0xc10f('0x4f')](_0xc10f('0x52'))[_0xc10f('0x4f')](_0xc10f('0x53'))[_0xc10f('0x4f')](_0xc10f('0x54'))[_0xc10f('0x50')](_0xc10f('0x55'),'ui')[_0xc10f('0x56')]('users','u',_0xc10f('0x57'));var _0x117bef=squel['select']()[_0xc10f('0x50')](_0xc10f('0x58'),'i')[_0xc10f('0x56')](_0xc10f('0x59'),'c',_0xc10f('0x5a'))[_0xc10f('0x56')](_0xc10f('0x5b'),'o',_0xc10f('0x5c'))[_0xc10f('0x56')](_0xc10f('0x5d'),'a','a.id\x20=\x20i.MailAccountId')['left_join'](_0xc10f('0x5e'),'me',_0xc10f('0x5f'))[_0xc10f('0x56')](_0xc10f('0x60'),'it','it.MailInteractionId\x20=\x20i.id')[_0xc10f('0x56')](_0xc10f('0x51'),'t',_0xc10f('0x61'));var _0x3f1f3b=squel[_0xc10f('0x62')]();var _0x178dcc=[];var _0xaa1c82=squel[_0xc10f('0x62')]();var _0x1d1d87;if(_0x14ed4a[_0xc10f('0x48')]['search']){_0x1d1d87=as[_0xc10f('0x63')](_0x14ed4a[_0xc10f('0x48')][_0xc10f('0x64')]);var _0x3f880f=_0x1d1d87[_0xc10f('0x65')];for(var _0x55ff8c=0x0;_0x55ff8c<_0x1d1d87[_0xc10f('0x66')][_0xc10f('0x4b')];_0x55ff8c++){var _0x4b76ac=_0x1d1d87[_0xc10f('0x66')][_0x55ff8c];var _0x3346e5='i';var _0x6eaea9=_[_0xc10f('0x67')](_0x1dd769,[_0xc10f('0x2c'),_0x4b76ac[_0xc10f('0x4f')]]);if(!_0x6eaea9){switch(_0x4b76ac[_0xc10f('0x4f')]){case _0xc10f('0x68'):if(_0x4b76ac[_0xc10f('0x69')]==0x1){_0x117bef[_0xc10f('0x6a')]('`'+_0x4b76ac[_0xc10f('0x4f')]+_0xc10f('0x6b'));}else{_0x117bef[_0xc10f('0x6a')]('`'+_0x4b76ac[_0xc10f('0x4f')]+'`\x20>\x200');}break;case _0xc10f('0x6c'):if(_0x4b76ac['operator']===_0xc10f('0x6d')){if(_0x4b76ac[_0xc10f('0x69')][_0xc10f('0x35')]('\x20')['length']>0x1){_0x3f1f3b[_0x3f880f](_0xc10f('0x6e'),qs[_0xc10f('0x6f')](_0x4b76ac['value']),null);}else{var _0x272c10='%'+_0x4b76ac[_0xc10f('0x69')]+'%';_0x3f1f3b[_0x3f880f](_0xc10f('0x70'),_0x272c10,_0x272c10,_0x272c10);}}else{_0x6eaea9=_[_0xc10f('0x67')](_0x1dd769,['name',_0xc10f('0x71')]);_0x4b76ac['field']=_0xc10f('0x71');_0x5551be=as[_0xc10f('0x72')](_0x3346e5,_0x6eaea9[_0xc10f('0x42')],_0x4b76ac);_0x3f1f3b[_0x3f880f](_0x5551be['text'],_0x5551be[_0xc10f('0x69')][_0xc10f('0x73')],_0x5551be[_0xc10f('0x69')][_0xc10f('0x74')]);}break;case _0xc10f('0x75'):var _0x73f400=_0x4b76ac[_0xc10f('0x69')]['split'](',')[_0xc10f('0x32')](function(_0xb9ba86){return Number(_0xb9ba86);});_0x73f400[_0xc10f('0x36')](function(_0x122329){_0xaa1c82['or'](_0xc10f('0x76'),'%,'+_0x122329+',%');});_0x178dcc=_[_0xc10f('0x77')](_0x178dcc,_0x73f400);break;case _0xc10f('0x78'):if(_0x4b76ac[_0xc10f('0x79')]===_0xc10f('0x6d')){_0x3f1f3b[_0x3f880f](_0xc10f('0x7a'),'%'+_0x4b76ac[_0xc10f('0x69')]+'%',null);}else{_0x6eaea9=_['find'](_0x1dd769,['name','UserId']);_0x4b76ac[_0xc10f('0x4f')]='UserId';_0x5551be=as[_0xc10f('0x72')](_0x3346e5,_0x6eaea9[_0xc10f('0x42')],_0x4b76ac);_0x3f1f3b[_0x3f880f](_0x5551be[_0xc10f('0x7b')],_0x5551be[_0xc10f('0x69')][_0xc10f('0x73')],_0x5551be[_0xc10f('0x69')]['end']);}break;case _0xc10f('0x3a'):_0x5551be=as['buildExpression']('me',null,_0x4b76ac);_0x3f1f3b[_0x3f880f](_0x5551be[_0xc10f('0x7b')],_0x5551be[_0xc10f('0x69')][_0xc10f('0x73')],_0x5551be['value']['end']);break;}}else{var _0x5551be=as[_0xc10f('0x72')](_0x3346e5,_0x6eaea9['type'],_0x4b76ac);_0x3f1f3b[_0x3f880f](_0x5551be[_0xc10f('0x7b')],_0x5551be[_0xc10f('0x69')][_0xc10f('0x73')],_0x5551be[_0xc10f('0x69')][_0xc10f('0x74')]);}}}else{var _0x9767f2=_(_0x14ed4a[_0xc10f('0x48')])[_0xc10f('0x45')]()[_0xc10f('0x32')](function(_0x8344fb){return _[_0xc10f('0x7c')](_0x1dd769,[_0xc10f('0x2c'),_0x8344fb])?_0x8344fb:undefined;})[_0xc10f('0x7d')]()[_0xc10f('0x69')]();if(!_[_0xc10f('0x7e')](_0x9767f2)){_0x9767f2[_0xc10f('0x36')](function(_0x1adf5b){if(_0x1adf5b===_0xc10f('0x7f')){_0x117bef[_0xc10f('0x80')](_0xc10f('0x81'),[][_0xc10f('0x82')](_0x14ed4a[_0xc10f('0x48')][_0x1adf5b]));}else if(_0x1adf5b==='createdAt'){var _0x5949f9=JSON[_0xc10f('0x83')](_0x14ed4a[_0xc10f('0x48')][_0x1adf5b])[_0xc10f('0x84')];var _0x47b71f=JSON['parse'](_0x14ed4a[_0xc10f('0x48')][_0x1adf5b])['$lte'];_0x117bef[_0xc10f('0x80')](_0xc10f('0x85'),_0x5949f9,_0x47b71f);}else{if(_0x14ed4a[_0xc10f('0x48')][_0x1adf5b]===_0xc10f('0x86')){_0x117bef['where']('i.'+_0x1adf5b+_0xc10f('0x87'));}else{_0x117bef[_0xc10f('0x80')]('i.'+_0x1adf5b+'\x20=\x20?',_0x14ed4a[_0xc10f('0x48')][_0x1adf5b]);}}});}if(_0x14ed4a[_0xc10f('0x48')]['read']){if(_0x14ed4a[_0xc10f('0x48')][_0xc10f('0x88')]==0x1){_0x117bef[_0xc10f('0x6a')](_0xc10f('0x89'));}else{_0x117bef[_0xc10f('0x6a')](_0xc10f('0x8a'));}}if(_0x14ed4a[_0xc10f('0x48')][_0xc10f('0x8b')]){_0x178dcc=_[_0xc10f('0x8c')](_0x14ed4a['query'][_0xc10f('0x8b')])?_0x14ed4a[_0xc10f('0x48')][_0xc10f('0x8b')]:new Array(_0x14ed4a[_0xc10f('0x48')][_0xc10f('0x8b')]);_0x178dcc['forEach'](function(_0x575531){_0xaa1c82['or'](_0xc10f('0x76'),'%,'+_0x575531+',%');});}if(_0x14ed4a[_0xc10f('0x48')][_0xc10f('0x8d')]){var _0x310f91=_0x14ed4a['query'][_0xc10f('0x8d')][_0xc10f('0x8e')]('\x5c','\x5c\x5c')[_0xc10f('0x8e')](/'/g,'\x27\x27');if(qs[_0xc10f('0x8f')](_0x310f91)){_0x3f1f3b['or'](_0xc10f('0x90'),_0x310f91+'%');}else if(qs[_0xc10f('0x91')](_0x310f91)){_0x3f1f3b['or']('c.email\x20LIKE\x20?',_0x310f91+'%');}else{_0x3f1f3b['or'](_0xc10f('0x92'),qs[_0xc10f('0x6f')](_0x310f91))['or'](_0xc10f('0x93'),qs[_0xc10f('0x6f')](_0x310f91));}}}_0x117bef[_0xc10f('0x80')](_0x3f1f3b);_0x117bef['group']('i.id');var _0x3a09b6={'type':db['Sequelize'][_0xc10f('0x94')]['SELECT'],'raw':!![]};var _0x1ee185=_0x117bef[_0xc10f('0x95')]();_0x1ee185[_0xc10f('0x4f')](_0xc10f('0x96'));_0x1ee185['field'](_0xc10f('0x97'),_0xc10f('0x68'));if(_0x1d5d3e[_0xc10f('0x4c')]){_0x1d5d3e[_0xc10f('0x4c')][_0xc10f('0x36')](function(_0x1ea8a4){var _0x53c94a=_0x1ea8a4[0x0]===_0xc10f('0x98')?_0x1ea8a4[0x0]:'i.'+_0x1ea8a4[0x0];_0x117bef[_0xc10f('0x4c')](_0x53c94a,_0x1ea8a4[0x1]===_0xc10f('0x99')?![]:!![]);});}if(!_[_0xc10f('0x7e')](_0x178dcc)){_0x117bef[_0xc10f('0x6a')](_0xaa1c82);_0x1ee185[_0xc10f('0x80')]('t.id\x20IN\x20?',_0x178dcc);}BPromise[_0xc10f('0x9a')]()[_0xc10f('0x28')](function(){if(!_0x1d1d87){if(_0x14ed4a[_0xc10f('0x48')][_0xc10f('0x7f')])return;_0x1ee185[_0xc10f('0x80')](_0xc10f('0x9b'));_0x117bef['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x14ed4a['user']['role']!==_0xc10f('0x2f'))return;return _0x14ed4a['user'][_0xc10f('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x32f6c6){if(_[_0xc10f('0x7e')](_0x32f6c6)){_0x1ee185[_0xc10f('0x80')]('i.MailAccountId\x20IS\x20NULL');_0x117bef[_0xc10f('0x80')]('i.MailAccountId\x20IS\x20NULL');}else{_0x1ee185[_0xc10f('0x80')](_0xc10f('0x81'),_['map'](_0x32f6c6,'id'));_0x117bef[_0xc10f('0x80')]('i.MailAccountId\x20IN\x20?',_[_0xc10f('0x32')](_0x32f6c6,'id'));}});})['then'](function(){if(_0x14ed4a[_0xc10f('0x9d')][_0xc10f('0x9e')]===_0xc10f('0x2f')&&!_0x1d1d87&&!_0x14ed4a['query']['MailAccountId'])return[];return db['sequelize'][_0xc10f('0x48')](_0x1ee185['toString'](),_0x3a09b6);})['then'](function(_0x20ecd7){_0x4e0b1c['count']=_0x20ecd7['length'];if(_0x4e0b1c[_0xc10f('0x9f')]===0x0)return[];return db[_0xc10f('0xa0')][_0xc10f('0x48')](_0xd8c1a2[_0xc10f('0xa1')](),_0x3a09b6)[_0xc10f('0x28')](function(_0x10d7e5){_0x48aed0=_[_0xc10f('0xa2')](_0x10d7e5,'id');_0x3a09b6=_[_0xc10f('0x2d')](_0x3a09b6,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14ed4a[_0xc10f('0x48')]['fields']){_0x1d5d3e[_0xc10f('0x49')][_0xc10f('0x36')](function(_0x2272db){_0x117bef[_0xc10f('0x4f')]('i.'+_0x2272db);});}else{_0x117bef[_0xc10f('0x4f')](_0xc10f('0x97'),_0xc10f('0x68'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xa3'),'Account.key');_0x117bef[_0xc10f('0x4f')](_0xc10f('0xa4'),_0xc10f('0xa5'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xa6'),_0xc10f('0x98'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0x96'));_0x117bef['field'](_0xc10f('0xa7'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xa8'));_0x117bef['field'](_0xc10f('0xa9'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xaa'));_0x117bef[_0xc10f('0x4f')]('i.attach');_0x117bef[_0xc10f('0x4f')](_0xc10f('0xab'));_0x117bef['field'](_0xc10f('0xac'));_0x117bef['field'](_0xc10f('0xad'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xae'));_0x117bef[_0xc10f('0x4f')]('i.secondDisposition');_0x117bef[_0xc10f('0x4f')](_0xc10f('0xaf'));_0x117bef['field'](_0xc10f('0xb0'));_0x117bef['field'](_0xc10f('0xb1'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xb2'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xb3'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xb4'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xb5'),_0xc10f('0xb6'));_0x117bef['field'](_0xc10f('0xb7'),_0xc10f('0xb8'));_0x117bef['field'](_0xc10f('0xb9'),_0xc10f('0xba'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xbb'),_0xc10f('0xbc'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xbd'),'Contact.mobile');_0x117bef[_0xc10f('0x4f')](_0xc10f('0xbe'),_0xc10f('0xbf'));_0x117bef['field']('o.fullname',_0xc10f('0xc0'));_0x117bef[_0xc10f('0x4f')]('o.internal',_0xc10f('0xc1'));_0x117bef[_0xc10f('0x4f')](_0xc10f('0xc2'),_0xc10f('0x34'));}if(_0x1d5d3e[_0xc10f('0x21')])_0x117bef[_0xc10f('0x21')](_0x1d5d3e[_0xc10f('0x21')]);if(_0x1d5d3e['offset'])_0x117bef[_0xc10f('0x1f')](_0x1d5d3e[_0xc10f('0x1f')]);return db[_0xc10f('0xa0')][_0xc10f('0x48')](_0x117bef[_0xc10f('0xa1')](),_0x3a09b6);})[_0xc10f('0x28')](function(_0x2cc29e){if(_0x2cc29e[_0xc10f('0x4b')]>0x0)_0x42ce09[_0xc10f('0x80')](_0xc10f('0xc3'),_[_0xc10f('0x32')](_0x2cc29e,'id'));return db[_0xc10f('0xa0')][_0xc10f('0x48')](_0x42ce09['toString'](),_0x3a09b6)[_0xc10f('0x28')](function(_0x5d2a25){var _0x45d32c=_['groupBy'](_0x5d2a25,_0xc10f('0xc4'));var _0x40710=[];return db[_0xc10f('0xc5')][_0xc10f('0x39')]({'attributes':[_0xc10f('0xc6')],'raw':!![]})[_0xc10f('0x28')](function(_0x4ed0f7){var _0x37253f=_0x4ed0f7[_0xc10f('0xc6')];_0x2cc29e[_0xc10f('0x36')](function(_0x4b7663){_0x40710[_0xc10f('0xc7')](updateMailInteraction(_0x4b7663,_0x48aed0,_0x45d32c,_0x37253f));});return BPromise[_0xc10f('0xc8')](_0x40710);});});});})[_0xc10f('0x28')](function(_0xc4f3c6){_0x4e0b1c['rows']=_0xc4f3c6;return _0x4e0b1c;})[_0xc10f('0x28')](respondWithFilteredResult(_0x585c2c,_0x1d5d3e))[_0xc10f('0x3e')](handleError(_0x585c2c,null));};exports[_0xc10f('0xc9')]=function(_0x25686b,_0x3881ec){var _0xc8f120={'raw':![],'where':{'id':_0x25686b['params']['id']}},_0x499ab1={};_0x499ab1[_0xc10f('0x44')]=_[_0xc10f('0x45')](db[_0xc10f('0x40')][_0xc10f('0x41')]);_0x499ab1[_0xc10f('0x48')]=_[_0xc10f('0x45')](_0x25686b[_0xc10f('0x48')]);_0x499ab1[_0xc10f('0x46')]=_['intersection'](_0x499ab1['model'],_0x499ab1[_0xc10f('0x48')]);_0xc8f120[_0xc10f('0x49')]=_[_0xc10f('0x47')](_0x499ab1['model'],qs[_0xc10f('0x4a')](_0x25686b['query'][_0xc10f('0x4a')]));_0xc8f120['attributes']=_0xc8f120[_0xc10f('0x49')][_0xc10f('0x4b')]?_0xc8f120[_0xc10f('0x49')]:_0x499ab1[_0xc10f('0x44')];if(_0x25686b[_0xc10f('0x48')][_0xc10f('0xca')]){_0xc8f120[_0xc10f('0xcb')]=[{'all':!![]}];}_0xc8f120=_[_0xc10f('0x2d')]({},_0xc8f120,_0x25686b[_0xc10f('0xcc')]);return db['MailInteraction'][_0xc10f('0x67')](_0xc8f120)[_0xc10f('0x28')](handleEntityNotFound(_0x3881ec,null))[_0xc10f('0x28')](respondWithResult(_0x3881ec,null))[_0xc10f('0x3e')](handleError(_0x3881ec,null));};exports['create']=function(_0x253943,_0x23a443){return db[_0xc10f('0x40')][_0xc10f('0xcd')](_0x253943[_0xc10f('0x2e')],{})[_0xc10f('0x28')](respondWithResult(_0x23a443,0xc9))[_0xc10f('0x3e')](handleError(_0x23a443,null));};exports['update']=function(_0x16b002,_0x1eaee7){if(_0x16b002[_0xc10f('0x2e')]['id']){delete _0x16b002[_0xc10f('0x2e')]['id'];}return db[_0xc10f('0x40')]['find']({'where':{'id':_0x16b002[_0xc10f('0xce')]['id']}})[_0xc10f('0x28')](handleEntityNotFound(_0x1eaee7,null))[_0xc10f('0x28')](saveUpdates(_0x16b002[_0xc10f('0x2e')],null))[_0xc10f('0x28')](respondWithResult(_0x1eaee7,null))[_0xc10f('0x3e')](handleError(_0x1eaee7,null));};exports[_0xc10f('0x29')]=function(_0x4bba55,_0x2f5d43){return db[_0xc10f('0x40')][_0xc10f('0x67')]({'where':{'id':_0x4bba55[_0xc10f('0xce')]['id']}})['then'](handleEntityNotFound(_0x2f5d43,null))[_0xc10f('0x28')](removeEntity(_0x2f5d43,null))[_0xc10f('0x3e')](handleError(_0x2f5d43,null));};exports[_0xc10f('0xcf')]=function(_0xdadabd,_0x49a7e4){return db['MailInteraction']['describe']()[_0xc10f('0x28')](respondWithResult(_0x49a7e4,null))[_0xc10f('0x3e')](handleError(_0x49a7e4,null));};exports[_0xc10f('0xd0')]=function(_0x31b503,_0x58f494,_0x6a2079){return db['MailMessage'][_0xc10f('0x67')]({'where':{'id':_0x31b503[_0xc10f('0xce')]['id']}})[_0xc10f('0x28')](handleEntityNotFound(_0x58f494,null))[_0xc10f('0x28')](function(_0x5b2d0f){if(_0x5b2d0f){return _0x5b2d0f[_0xc10f('0xd0')](_0x31b503[_0xc10f('0x2e')][_0xc10f('0xd1')],_['omit'](_0x31b503[_0xc10f('0x2e')],[_0xc10f('0xd1'),'id'])||{});}})[_0xc10f('0x28')](respondWithResult(_0x58f494,null))['catch'](handleError(_0x58f494,null));};exports[_0xc10f('0xd2')]=function(_0x27c1e2,_0x2b1b00,_0x2fcb39){var _0x39620d={'raw':![],'where':{}};var _0x2e9ed8={};var _0x480ea4={'count':0x0,'rows':[]};return db['MailInteraction'][_0xc10f('0x39')]({'where':{'id':_0x27c1e2[_0xc10f('0xce')]['id']}})[_0xc10f('0x28')](handleEntityNotFound(_0x2b1b00,null))['then'](function(_0x112e7c){if(_0x112e7c){_0x2e9ed8[_0xc10f('0x44')]=_[_0xc10f('0x45')](db[_0xc10f('0x38')][_0xc10f('0x41')]);_0x2e9ed8[_0xc10f('0x48')]=_[_0xc10f('0x45')](_0x27c1e2[_0xc10f('0x48')]);_0x2e9ed8[_0xc10f('0x46')]=_['intersection'](_0x2e9ed8[_0xc10f('0x44')],_0x2e9ed8[_0xc10f('0x48')]);_0x39620d[_0xc10f('0x49')]=_[_0xc10f('0x47')](_0x2e9ed8['model'],qs['fields'](_0x27c1e2[_0xc10f('0x48')][_0xc10f('0x4a')]));_0x39620d[_0xc10f('0x49')]=_0x39620d[_0xc10f('0x49')][_0xc10f('0x4b')]?_0x39620d[_0xc10f('0x49')]:_0x2e9ed8[_0xc10f('0x44')];if(!_0x27c1e2[_0xc10f('0x48')][_0xc10f('0xd3')](_0xc10f('0xd4'))){_0x39620d[_0xc10f('0x21')]=qs[_0xc10f('0x21')](_0x27c1e2[_0xc10f('0x48')][_0xc10f('0x21')]);_0x39620d[_0xc10f('0x1f')]=qs[_0xc10f('0x1f')](_0x27c1e2[_0xc10f('0x48')][_0xc10f('0x1f')]);}_0x39620d[_0xc10f('0x4c')]=qs[_0xc10f('0x4d')](_0x27c1e2['query'][_0xc10f('0x4d')]);_0x39620d['where']=qs[_0xc10f('0x46')](_[_0xc10f('0xd5')](_0x27c1e2['query'],_0x2e9ed8[_0xc10f('0x46')]));_0x39620d[_0xc10f('0x80')]['MailInteractionId']=_0x112e7c['id'];if(_0x27c1e2[_0xc10f('0x48')]['filter']){_0x39620d[_0xc10f('0x80')]=_[_0xc10f('0x2d')](_0x39620d[_0xc10f('0x80')],{'$or':_['map'](_0x39620d['attributes'],function(_0x2c16f3){var _0x213399={};_0x213399[_0x2c16f3]={'$like':'%'+_0x27c1e2[_0xc10f('0x48')][_0xc10f('0x8d')]+'%'};return _0x213399;})});}if(_0x27c1e2[_0xc10f('0x48')][_0xc10f('0x84')]){var _0xe91c6c=_0x27c1e2[_0xc10f('0x48')][_0xc10f('0x84')]['split'](',');var _0x19b12a={};_0x19b12a[_0xe91c6c[0x0]]={'$gte':moment(_0xe91c6c[0x1])[_0xc10f('0xd6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x39620d[_0xc10f('0x80')]=_['merge'](_0x39620d[_0xc10f('0x80')],_0x19b12a);}_0x39620d=_[_0xc10f('0x2d')]({},_0x39620d,_0x27c1e2[_0xc10f('0xcc')]);return db['MailMessage'][_0xc10f('0x9f')]({'where':_0x39620d[_0xc10f('0x80')]})[_0xc10f('0x28')](function(_0x439541){_0x480ea4['count']=_0x439541;if(_0x27c1e2['query'][_0xc10f('0xca')]){_0x39620d[_0xc10f('0xcb')]=[{'all':!![]}];}return db[_0xc10f('0x38')][_0xc10f('0xd7')](_0x39620d);})[_0xc10f('0x28')](function(_0x4bd2ef){if(_0x27c1e2[_0xc10f('0x48')]['inlineCss']==='true'){for(var _0x153384=0x0;_0x153384<_0x4bd2ef['length'];_0x153384++){_0x4bd2ef[_0x153384][_0xc10f('0x2e')]=juice(_0x4bd2ef[_0x153384][_0xc10f('0x2e')]);}}_0x480ea4['rows']=_0x4bd2ef;return _0x480ea4;});}})[_0xc10f('0x28')](respondWithFilteredResult(_0x2b1b00,_0x39620d))[_0xc10f('0x3e')](handleError(_0x2b1b00,null));};exports[_0xc10f('0xd8')]=function(_0x153a06,_0x1a97bf,_0x1a0550){return db[_0xc10f('0x40')]['find']({'where':{'id':_0x153a06[_0xc10f('0xce')]['id']}})[_0xc10f('0x28')](handleEntityNotFound(_0x1a97bf,null))[_0xc10f('0x28')](function(_0x34d8d3){if(_0x34d8d3){return _0x34d8d3[_0xc10f('0xd9')](_0x153a06['body'][_0xc10f('0xd1')],_[_0xc10f('0xda')](_0x153a06[_0xc10f('0x2e')],[_0xc10f('0xd1'),'id'])||{})[_0xc10f('0xdb')](function(){return db['Tag'][_0xc10f('0xd7')]({'attributes':['id',_0xc10f('0x2c'),_0xc10f('0xdc')],'where':{'id':_0x153a06[_0xc10f('0x2e')][_0xc10f('0xd1')]}});})[_0xc10f('0x28')](function(_0x2a5968){socket[_0xc10f('0xdd')]('mailInteractionTags:save',{'id':Number(_0x153a06[_0xc10f('0xce')]['id']),'tags':_0x2a5968||[]});return{'id':Number(_0x153a06['params']['id']),'tags':_0x2a5968||[]};});}})[_0xc10f('0x28')](respondWithResult(_0x1a97bf,null))['catch'](handleError(_0x1a97bf,null));};exports[_0xc10f('0xde')]=function(_0x4811ea,_0x34bf3b,_0x159900){return db[_0xc10f('0x40')][_0xc10f('0x67')]({'where':{'id':_0x4811ea[_0xc10f('0xce')]['id']}})[_0xc10f('0x28')](handleEntityNotFound(_0x34bf3b,null))[_0xc10f('0x28')](function(_0x1d230e){if(_0x1d230e){return _0x1d230e[_0xc10f('0xde')](_0x4811ea[_0xc10f('0x48')][_0xc10f('0xd1')]);}})[_0xc10f('0x28')](respondWithStatusCode(_0x34bf3b,null))['catch'](handleError(_0x34bf3b,null));};exports[_0xc10f('0xdf')]=function(_0x4242b1,_0x2f7f20){var _0x52f8fb=moment()['unix']()[_0xc10f('0xa1')]();var _0x389e85=path[_0xc10f('0xe0')](config[_0xc10f('0xe1')],_0xc10f('0xe2'),_0xc10f('0xe3'),'tmp');var _0x42db97=path[_0xc10f('0xe0')](config[_0xc10f('0xe1')],'server',_0xc10f('0xe3'),_0xc10f('0xe4'));var _0x59daeb=path[_0xc10f('0xe0')](_0x389e85,_0x52f8fb);var _0x3f6888=util['format']('transcript-%d-%s.zip',_0x4242b1['params']['id'],_0x52f8fb);var _0x31b4bc=path['join'](_0x389e85,_0x3f6888);var _0x32690c=[];if(_0x4242b1['query'][_0xc10f('0xe4')]){_0x32690c[_0xc10f('0xc7')]({'model':db[_0xc10f('0xe5')],'as':_0xc10f('0xe6'),'raw':!![]});}var _0x226055=[{'model':db[_0xc10f('0x38')],'as':_0xc10f('0xe7'),'attributes':['id',_0xc10f('0x2e'),'from','to','cc','bcc',_0xc10f('0xe8'),_0xc10f('0xe9')],'where':{'secret':![]},'order':qs[_0xc10f('0x4d')]('id'),'include':_0x32690c}];return db[_0xc10f('0x40')][_0xc10f('0x67')]({'where':{'id':_0x4242b1[_0xc10f('0xce')]['id']},'include':_0x226055})['then'](handleEntityNotFound(_0x2f7f20,null))[_0xc10f('0x28')](function(_0x3dc85c){if(_0x3dc85c&&_0x3dc85c[_0xc10f('0xe7')]){var _0x2e9ebe=_0x3dc85c['get']({'plain':!![]});fs[_0xc10f('0xea')](_0x59daeb);return BPromise['each'](_0x2e9ebe[_0xc10f('0xe7')],function(_0x32a154,_0x1bbae0){var _0x9d2c3a={'from':_0x32a154[_0xc10f('0x50')],'to':_0x32a154['to'],'subject':_0x32a154[_0xc10f('0xe8')],'html':_0x32a154[_0xc10f('0x2e')],'headers':{'Date':moment(_0x32a154['createdAt'])[_0xc10f('0xd6')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x32a154['cc']){_0x9d2c3a[_0xc10f('0xeb')]['Cc']=_0x32a154['cc'];}if(_0x32a154[_0xc10f('0xec')]){_0x9d2c3a['headers'][_0xc10f('0xed')]=_0x32a154[_0xc10f('0xec')];}return new BPromise(function(_0x2f75fe,_0x2fa6f5){if(_0x32a154[_0xc10f('0xe6')]){for(var _0x329500=0x0;_0x329500<_0x32a154['Attachments'][_0xc10f('0x4b')];_0x329500++){var _0x45fe4b=_0x32a154['Attachments'][_0x329500];var _0x5bba2a=path[_0xc10f('0xe0')](_0x42db97,_0x45fe4b[_0xc10f('0xee')]);if(fs[_0xc10f('0xef')](_0x5bba2a)){_0x9d2c3a[_0xc10f('0xe4')]['push']({'name':_0x45fe4b['name'],'contentType':_0x45fe4b['type'],'data':fs['readFileSync'](_0x5bba2a)});}}}emlformat[_0xc10f('0xf0')](_0x9d2c3a,function(_0x3e67b5,_0x2cbf98){if(_0x3e67b5)return _0x2fa6f5(_0x3e67b5);fs[_0xc10f('0xf1')](path['join'](_0x59daeb,util[_0xc10f('0xd6')]('message%d.eml',_0x1bbae0)),_0x2cbf98);return _0x2f75fe(_0x2cbf98);});});})['then'](function(){return new BPromise(function(_0x455dd2,_0x36daed){zipdir(_0x59daeb,{'saveTo':_0x31b4bc},function(_0xfff037,_0xad6eca){if(_0xfff037)return _0x36daed(_0xfff037);return _0x455dd2(_0xad6eca);});})[_0xc10f('0x28')](function(){return new BPromise(function(_0x46c222,_0x3932b7){rimraf(_0x59daeb,function(_0x7bdff3){if(_0x7bdff3)_0x3932b7(_0x7bdff3);return _0x46c222();});});})['then'](function(){return _0x2f7f20[_0xc10f('0xdf')](_0x31b4bc,_0x3f6888,function(_0x5e0bc8){if(_0x5e0bc8){console[_0xc10f('0xf2')]('err',_0x5e0bc8);}else{fs['unlinkSync'](_0x31b4bc);}});});});}else{return _0x2f7f20[_0xc10f('0x1c')](0xc8);}})[_0xc10f('0x3e')](handleError(_0x2f7f20,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 5b93f49..f5b68e3 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 _0x59f2=['emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x252505,_0x3a926c){var _0xe089db=function(_0x2e515d){while(--_0x2e515d){_0x252505['push'](_0x252505['shift']());}};_0xe089db(++_0x3a926c);}(_0x59f2,0x1bd));var _0x259f=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x59f2[_0x487b0c];return _0x1adbdc;};'use strict';var EventEmitter=require(_0x259f('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x259f('0x1')];var MailMessage=require(_0x259f('0x2'))['db'][_0x259f('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x259f('0x4')](0x0);var events={'afterCreate':_0x259f('0x5'),'afterUpdate':_0x259f('0x6'),'afterDestroy':_0x259f('0x7')};function emitEvent(_0x38aa9a){return function(_0x5eed32,_0x354031,_0x14fc8b){_0x5eed32[_0x259f('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3279fd){_0x5eed32[_0x259f('0x9')](_0x259f('0xa'),_0x3279fd[_0x259f('0xb')](function(_0x3f0521){return{'id':_0x3f0521['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5eed32['id'],'direction':'in','read':![]},'raw':!![]});})[_0x259f('0xc')](function(_0x3aee58){_0x5eed32[_0x259f('0x9')](_0x259f('0xd'),_0x3aee58[_0x259f('0xe')]);MailInteractionEvents[_0x259f('0xf')](_0x38aa9a+':'+_0x5eed32['id'],_0x5eed32);MailInteractionEvents['emit'](_0x38aa9a,_0x5eed32);_0x14fc8b(null);})[_0x259f('0x10')](_0x14fc8b(null));};}for(var e in events){if(events[_0x259f('0x11')](e)){var event=events[e];MailInteraction[_0x259f('0x12')](e,emitEvent(event));}}module[_0x259f('0x13')]=MailInteractionEvents; \ No newline at end of file +var _0xb7ef=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch'];(function(_0xbaeba7,_0x578dfa){var _0x4b42e7=function(_0x23bd26){while(--_0x23bd26){_0xbaeba7['push'](_0xbaeba7['shift']());}};_0x4b42e7(++_0x578dfa);}(_0xb7ef,0x151));var _0xfb7e=function(_0x1bf3c1,_0x184195){_0x1bf3c1=_0x1bf3c1-0x0;var _0x1960b3=_0xb7ef[_0x1bf3c1];return _0x1960b3;};'use strict';var EventEmitter=require(_0xfb7e('0x0'));var MailInteraction=require(_0xfb7e('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xfb7e('0x1'))['db'][_0xfb7e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xfb7e('0x3')](0x0);var events={'afterCreate':_0xfb7e('0x4'),'afterUpdate':_0xfb7e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x59ff92){return function(_0x3c2ad1,_0x30799f,_0x23f0b0){_0x3c2ad1[_0xfb7e('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x189d55){_0x3c2ad1[_0xfb7e('0x7')]('Users',_0x189d55[_0xfb7e('0x8')](function(_0x4fdb07){return{'id':_0x4fdb07['id']};}));return MailMessage[_0xfb7e('0x9')]({'where':{'MailInteractionId':_0x3c2ad1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfb7e('0xa')](function(_0x2e4068){_0x3c2ad1[_0xfb7e('0x7')](_0xfb7e('0xb'),_0x2e4068[_0xfb7e('0xc')]);MailInteractionEvents[_0xfb7e('0xd')](_0x59ff92+':'+_0x3c2ad1['id'],_0x3c2ad1);MailInteractionEvents[_0xfb7e('0xd')](_0x59ff92,_0x3c2ad1);_0x23f0b0(null);})[_0xfb7e('0xe')](_0x23f0b0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xfb7e('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 60b8aae..d8d45ec 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 _0x702d=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','MailMessage','then'];(function(_0x1c46c5,_0x41bc70){var _0x4e403c=function(_0x8cf318){while(--_0x8cf318){_0x1c46c5['push'](_0x1c46c5['shift']());}};_0x4e403c(++_0x41bc70);}(_0x702d,0x147));var _0xd702=function(_0x30c946,_0x1ebd0e){_0x30c946=_0x30c946-0x0;var _0xaf0992=_0x702d[_0x30c946];return _0xaf0992;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./mailInteraction.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xd702('0xc'),'fields':['subject','to'],'type':_0xd702('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x25423f,_0x907a9f,_0x365a0b){if(_0x25423f[_0xd702('0xe')]){_0x25423f[_0xd702('0xf')]=moment()[_0xd702('0x10')](_0xd702('0x11'));}if(_0x25423f[_0xd702('0x12')]){_0x25423f[_0xd702('0x13')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x365a0b(null,_0x907a9f);},'beforeUpdate':function(_0x3e9439,_0x42e1ad,_0x273577){if(_0x3e9439['changed'](_0xd702('0xe'))){_0x3e9439[_0xd702('0xf')]=_0x3e9439[_0xd702('0xe')]?moment()[_0xd702('0x10')](_0xd702('0x11')):null;}if(_0x3e9439[_0xd702('0x14')]('closed')){_0x3e9439[_0xd702('0x13')]=moment()[_0xd702('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e9439[_0xd702('0xe')]=null;_0x3e9439['substatusAt']=null;}_0x273577(null,_0x3e9439);},'afterUpdate':function(_0x268c66,_0x210c32,_0x55b93e){var _0x2ba791=_0x544e94[_0xd702('0x15')];var _0x2a87f2=_0x268c66['get']({'plain':!![]});if(_0x2a87f2['closed']){return _0x2ba791[_0xd702('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x2a87f2['id']}})[_0xd702('0x17')](function(){_0x55b93e();})[_0xd702('0x18')](function(_0x37267c){_0x55b93e(_0x37267c);});}else{_0x55b93e();}}},'charset':_0xd702('0x19'),'collate':_0xd702('0x1a')});}; \ No newline at end of file +var _0x6ff6=['moment','bluebird','request-promise','path','rimraf','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x6ff6,0x115));var _0x66ff=function(_0x16bb9c,_0x13aa94){_0x16bb9c=_0x16bb9c-0x0;var _0x51e822=_0x6ff6[_0x16bb9c];return _0x51e822;};'use strict';var _=require(_0x66ff('0x0'));var util=require(_0x66ff('0x1'));var logger=require('../../config/logger')(_0x66ff('0x2'));var moment=require(_0x66ff('0x3'));var BPromise=require(_0x66ff('0x4'));var rp=require(_0x66ff('0x5'));var fs=require('fs');var path=require(_0x66ff('0x6'));var rimraf=require(_0x66ff('0x7'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x66ff('0x8')]=function(_0x13db5e,_0x33f9f5){return _0x13db5e['define'](_0x66ff('0x9'),attributes,{'tableName':_0x66ff('0xa'),'paranoid':![],'indexes':[{'name':_0x66ff('0xb'),'fields':[_0x66ff('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5448a0,_0x44044a,_0x1c42aa){if(_0x5448a0[_0x66ff('0xd')]){_0x5448a0[_0x66ff('0xe')]=moment()[_0x66ff('0xf')](_0x66ff('0x10'));}if(_0x5448a0[_0x66ff('0x11')]){_0x5448a0[_0x66ff('0x12')]=moment()[_0x66ff('0xf')](_0x66ff('0x10'));}_0x1c42aa(null,_0x44044a);},'beforeUpdate':function(_0x5273af,_0x2d83e6,_0x2d11a3){if(_0x5273af['changed'](_0x66ff('0xd'))){_0x5273af['substatusAt']=_0x5273af['substatus']?moment()[_0x66ff('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x5273af[_0x66ff('0x13')]('closed')){_0x5273af[_0x66ff('0x12')]=moment()[_0x66ff('0xf')](_0x66ff('0x10'));_0x5273af['substatus']=null;_0x5273af[_0x66ff('0xe')]=null;}_0x2d11a3(null,_0x5273af);},'afterUpdate':function(_0x2d1393,_0x4958bf,_0x175b5f){var _0x112551=_0x13db5e[_0x66ff('0x14')];var _0x420d83=_0x2d1393[_0x66ff('0x15')]({'plain':!![]});if(_0x420d83[_0x66ff('0x11')]){return _0x112551[_0x66ff('0x16')][_0x66ff('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x420d83['id']}})[_0x66ff('0x18')](function(){_0x175b5f();})[_0x66ff('0x19')](function(_0x85d8b9){_0x175b5f(_0x85d8b9);});}else{_0x175b5f();}}},'charset':_0x66ff('0x1a'),'collate':_0x66ff('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index c812a9d..6068e6a 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 _0xeffd=['MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','UpdateMailInteraction','options','raw','where','limit','catch','MailInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info'];(function(_0x4fb699,_0x36ba45){var _0x1c97e8=function(_0x1e0449){while(--_0x1e0449){_0x4fb699['push'](_0x4fb699['shift']());}};_0x1c97e8(++_0x36ba45);}(_0xeffd,0x6b));var _0xdeff=function(_0x4511f0,_0x365662){_0x4511f0=_0x4511f0-0x0;var _0x5b71ef=_0xeffd[_0x4511f0];return _0x5b71ef;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});config[_0xdeff('0xd')]=_[_0xdeff('0xe')](config[_0xdeff('0xd')],{'host':_0xdeff('0xf'),'port':0x18eb});var socket=require(_0xdeff('0x10'))(new Redis(config['redis']));require(_0xdeff('0x11'))[_0xdeff('0x12')](socket);function respondWithRpcPromise(_0xf6d58d,_0x51fcb7,_0x1ff265){return new BPromise(function(_0x4423e9,_0x3c1482){return client[_0xdeff('0x13')](_0xf6d58d,_0x1ff265)[_0xdeff('0x14')](function(_0x256b73){logger[_0xdeff('0x15')](_0xdeff('0x16'),_0x51fcb7,'request\x20sent');logger[_0xdeff('0x17')](_0xdeff('0x18'),_0x51fcb7,'request\x20sent',JSON[_0xdeff('0x19')](_0x256b73));if(_0x256b73['error']){if(_0x256b73['error'][_0xdeff('0x1a')]===0x1f4){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')]['message']);return _0x3c1482(_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);}logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);return _0x4423e9(_0x256b73['error']['message']);}else{logger[_0xdeff('0x15')]('MailInteraction,\x20%s,\x20%s',_0x51fcb7,'request\x20sent');_0x4423e9(_0x256b73[_0xdeff('0x1d')][_0xdeff('0x1c')]);}})['catch'](function(_0x2de203){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x2de203);_0x3c1482(_0x2de203);});});}exports[_0xdeff('0x1e')]=function(_0x18f2e2){var _0x299cc5=this;return new Promise(function(_0x3ccce3,_0x919c93){return db['MailInteraction']['update'](_0x18f2e2['body'],{'raw':_0x18f2e2[_0xdeff('0x1f')]?_0x18f2e2['options'][_0xdeff('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18f2e2[_0xdeff('0x1f')]?_0x18f2e2['options'][_0xdeff('0x21')]||null:null,'attributes':_0x18f2e2[_0xdeff('0x1f')]?_0x18f2e2['options']['attributes']||null:null,'limit':_0x18f2e2[_0xdeff('0x1f')]?_0x18f2e2[_0xdeff('0x1f')][_0xdeff('0x22')]||null:null})[_0xdeff('0x14')](function(_0x32add9){logger['info'](_0xdeff('0x1e'),_0x18f2e2);logger[_0xdeff('0x17')](_0xdeff('0x1e'),_0x18f2e2,JSON[_0xdeff('0x19')](_0x32add9));_0x3ccce3(_0x32add9);})[_0xdeff('0x23')](function(_0x35823c){logger[_0xdeff('0x1b')]('UpdateMailInteraction',_0x35823c[_0xdeff('0x1c')],_0x18f2e2);_0x919c93(_0x299cc5[_0xdeff('0x1b')](0x1f4,_0x35823c['message']));});});};exports['AddTagsToMailInteraction']=function(_0x830be4){return new Promise(function(_0x2ea8e9,_0x16b2d0){return db[_0xdeff('0x24')][_0xdeff('0x25')]({'where':_0x830be4[_0xdeff('0x1f')]?_0x830be4[_0xdeff('0x1f')]['where']||null:null})[_0xdeff('0x14')](function(_0x167e07){if(_0x167e07){return _0x167e07[_0xdeff('0x26')](_0x830be4['body']['ids'],_[_0xdeff('0x27')](_0x830be4['body'],[_0xdeff('0x28'),'id'])||{});}})[_0xdeff('0x29')](function(_0x44a8b3){logger['info'](_0xdeff('0x2a'),_0x830be4);logger['debug']('AddTags',_0x830be4,JSON[_0xdeff('0x19')](_0x44a8b3));_0x2ea8e9(_0x44a8b3);})[_0xdeff('0x23')](function(_0x4764c0){logger[_0xdeff('0x1b')]('AddTags',_0x4764c0[_0xdeff('0x1c')],_0x830be4);_0x16b2d0(_this[_0xdeff('0x1b')](0x1f4,_0x4764c0[_0xdeff('0x1c')]));});});}; \ No newline at end of file +var _0x5e30=['spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','AddTagsToMailInteraction','find','ids','omit'];(function(_0x257f14,_0x2b6053){var _0x4d81b4=function(_0x443251){while(--_0x443251){_0x257f14['push'](_0x257f14['shift']());}};_0x4d81b4(++_0x2b6053);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05e3('0x0'));var util=require(_0x05e3('0x1'));var moment=require(_0x05e3('0x2'));var BPromise=require(_0x05e3('0x3'));var rs=require(_0x05e3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x05e3('0x5'))(_0x05e3('0x6'));var config=require(_0x05e3('0x7'));var jayson=require(_0x05e3('0x8'));var client=jayson[_0x05e3('0x9')][_0x05e3('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x05e3('0xb')],{'host':_0x05e3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05e3('0xb')]));require(_0x05e3('0xd'))[_0x05e3('0xe')](socket);function respondWithRpcPromise(_0x2afc34,_0x57ad6d,_0x5a98f8){return new BPromise(function(_0xb9bc1e,_0x54cda5){return client[_0x05e3('0xf')](_0x2afc34,_0x5a98f8)[_0x05e3('0x10')](function(_0x20851e){logger['info'](_0x05e3('0x11'),_0x57ad6d,_0x05e3('0x12'));logger['debug'](_0x05e3('0x13'),_0x57ad6d,'request\x20sent',JSON[_0x05e3('0x14')](_0x20851e));if(_0x20851e[_0x05e3('0x15')]){if(_0x20851e[_0x05e3('0x15')][_0x05e3('0x16')]===0x1f4){logger['error'](_0x05e3('0x11'),_0x57ad6d,_0x20851e['error'][_0x05e3('0x17')]);return _0x54cda5(_0x20851e['error']['message']);}logger[_0x05e3('0x15')](_0x05e3('0x11'),_0x57ad6d,_0x20851e[_0x05e3('0x15')]['message']);return _0xb9bc1e(_0x20851e[_0x05e3('0x15')][_0x05e3('0x17')]);}else{logger[_0x05e3('0x18')](_0x05e3('0x11'),_0x57ad6d,_0x05e3('0x12'));_0xb9bc1e(_0x20851e['result'][_0x05e3('0x17')]);}})[_0x05e3('0x19')](function(_0x1bcac9){logger[_0x05e3('0x15')](_0x05e3('0x11'),_0x57ad6d,_0x1bcac9);_0x54cda5(_0x1bcac9);});});}exports[_0x05e3('0x1a')]=function(_0x57c59f){var _0x493237=this;return new Promise(function(_0x53e346,_0x26242d){return db[_0x05e3('0x1b')]['update'](_0x57c59f[_0x05e3('0x1c')],{'raw':_0x57c59f[_0x05e3('0x1d')]?_0x57c59f['options'][_0x05e3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57c59f[_0x05e3('0x1d')]?_0x57c59f[_0x05e3('0x1d')][_0x05e3('0x1f')]||null:null,'attributes':_0x57c59f[_0x05e3('0x1d')]?_0x57c59f[_0x05e3('0x1d')][_0x05e3('0x20')]||null:null,'limit':_0x57c59f[_0x05e3('0x1d')]?_0x57c59f['options']['limit']||null:null})[_0x05e3('0x10')](function(_0x3426be){logger[_0x05e3('0x18')](_0x05e3('0x1a'),_0x57c59f);logger['debug']('UpdateMailInteraction',_0x57c59f,JSON[_0x05e3('0x14')](_0x3426be));_0x53e346(_0x3426be);})[_0x05e3('0x19')](function(_0x7f7d26){logger['error']('UpdateMailInteraction',_0x7f7d26[_0x05e3('0x17')],_0x57c59f);_0x26242d(_0x493237[_0x05e3('0x15')](0x1f4,_0x7f7d26[_0x05e3('0x17')]));});});};exports[_0x05e3('0x21')]=function(_0x2d5d25){return new Promise(function(_0x5ec676,_0x27d7e7){return db[_0x05e3('0x1b')][_0x05e3('0x22')]({'where':_0x2d5d25['options']?_0x2d5d25[_0x05e3('0x1d')]['where']||null:null})[_0x05e3('0x10')](function(_0xc8cc7b){if(_0xc8cc7b){return _0xc8cc7b['addTags'](_0x2d5d25[_0x05e3('0x1c')][_0x05e3('0x23')],_[_0x05e3('0x24')](_0x2d5d25[_0x05e3('0x1c')],[_0x05e3('0x23'),'id'])||{});}})[_0x05e3('0x25')](function(_0x3d9260){logger[_0x05e3('0x18')]('AddTags',_0x2d5d25);logger[_0x05e3('0x26')](_0x05e3('0x27'),_0x2d5d25,JSON[_0x05e3('0x14')](_0x3d9260));_0x5ec676(_0x3d9260);})['catch'](function(_0x1ceb52){logger[_0x05e3('0x15')]('AddTags',_0x1ceb52[_0x05e3('0x17')],_0x2d5d25);_0x27d7e7(_this['error'](0x1f4,_0x1ceb52['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 928eb8c..6d42971 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 _0xfa88=['update','emit','removeListener','mailInteraction:','./mailInteraction.events','remove'];(function(_0x2bc393,_0x140b81){var _0x479648=function(_0x27c589){while(--_0x27c589){_0x2bc393['push'](_0x2bc393['shift']());}};_0x479648(++_0x140b81);}(_0xfa88,0x1b4));var _0x8fa8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xfa88[_0x3bf83f];return _0x22c4a9;};'use strict';var MailInteractionEvents=require(_0x8fa8('0x0'));var events=['save',_0x8fa8('0x1'),_0x8fa8('0x2')];function createListener(_0x28ef8a,_0x40a725){return function(_0x7057c6){_0x40a725[_0x8fa8('0x3')](_0x28ef8a,_0x7057c6);};}function removeListener(_0x5b07a6,_0x4a3b20){return function(){MailInteractionEvents[_0x8fa8('0x4')](_0x5b07a6,_0x4a3b20);};}exports['register']=function(_0x2e0e2a){for(var _0x382dd4=0x0,_0x1ff8a1=events['length'];_0x382dd4<_0x1ff8a1;_0x382dd4++){var _0x428e45=events[_0x382dd4];var _0x24db87=createListener(_0x8fa8('0x5')+_0x428e45,_0x2e0e2a);MailInteractionEvents['on'](_0x428e45,_0x24db87);}}; \ No newline at end of file +var _0xd857=['update','emit','register','length','save','remove'];(function(_0x9e8d76,_0x15fcb5){var _0x9329ca=function(_0x4838ff){while(--_0x4838ff){_0x9e8d76['push'](_0x9e8d76['shift']());}};_0x9329ca(++_0x15fcb5);}(_0xd857,0x166));var _0x7d85=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd857[_0x397e5f];return _0x5302b8;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x7d85('0x0'),_0x7d85('0x1'),_0x7d85('0x2')];function createListener(_0x7ba832,_0x4aacb3){return function(_0xb42bf2){_0x4aacb3[_0x7d85('0x3')](_0x7ba832,_0xb42bf2);};}function removeListener(_0x18eaa1,_0xad4a){return function(){MailInteractionEvents['removeListener'](_0x18eaa1,_0xad4a);};}exports[_0x7d85('0x4')]=function(_0x1f1521){for(var _0x3ba935=0x0,_0x2821db=events[_0x7d85('0x5')];_0x3ba935<_0x2821db;_0x3ba935++){var _0x2a894c=events[_0x3ba935];var _0x246ba1=createListener('mailInteraction:'+_0x2a894c,_0x1f1521);MailInteractionEvents['on'](_0x2a894c,_0x246ba1);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index cf92be6..5db8ca2 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 _0x01da=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','show','/:id/download','download','post','tracked','mailmessage:create','create','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x582d5a,_0x3b57c0){var _0x5625ef=function(_0x509d83){while(--_0x509d83){_0x582d5a['push'](_0x582d5a['shift']());}};_0x5625ef(++_0x3b57c0);}(_0x01da,0x151));var _0xa01d=function(_0xaf8cc5,_0x1e745a){_0xaf8cc5=_0xaf8cc5-0x0;var _0x21698a=_0x01da[_0xaf8cc5];return _0x21698a;};'use strict';var multer=require(_0xa01d('0x0'));var util=require(_0xa01d('0x1'));var path=require('path');var timeout=require(_0xa01d('0x2'));var express=require(_0xa01d('0x3'));var router=express[_0xa01d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa01d('0x5'));var config=require(_0xa01d('0x6'));var controller=require('./mailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa01d('0x7')](_0xa01d('0x8'),auth[_0xa01d('0x9')](),controller['describe']);router['get']('/:id',auth[_0xa01d('0x9')](),controller[_0xa01d('0xa')]);router[_0xa01d('0x7')](_0xa01d('0xb'),auth[_0xa01d('0x9')](),controller[_0xa01d('0xc')]);router[_0xa01d('0xd')]('/',auth[_0xa01d('0x9')](),interaction[_0xa01d('0xe')]('mail',_0xa01d('0xf')),controller[_0xa01d('0x10')]);router[_0xa01d('0x11')](_0xa01d('0x12'),auth[_0xa01d('0x9')](),controller[_0xa01d('0x13')]);router[_0xa01d('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0xa01d('0x14')]);router[_0xa01d('0x11')](_0xa01d('0x15'),auth['isAuthenticated'](),controller[_0xa01d('0x16')]);router[_0xa01d('0x17')](_0xa01d('0x12'),auth[_0xa01d('0x9')](),controller[_0xa01d('0x18')]);module[_0xa01d('0x19')]=router; \ No newline at end of file +var _0xd399=['../../config/environment','./mailMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','put','update','/:id/accept','/:id/reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x46d14b,_0x147907){var _0x367dfd=function(_0x117d8e){while(--_0x117d8e){_0x46d14b['push'](_0x46d14b['shift']());}};_0x367dfd(++_0x147907);}(_0xd399,0x1d5));var _0x9d39=function(_0x4b0e44,_0x22dd55){_0x4b0e44=_0x4b0e44-0x0;var _0x1cb57e=_0xd399[_0x4b0e44];return _0x1cb57e;};'use strict';var multer=require('multer');var util=require(_0x9d39('0x0'));var path=require(_0x9d39('0x1'));var timeout=require(_0x9d39('0x2'));var express=require(_0x9d39('0x3'));var router=express[_0x9d39('0x4')]();var fs_extra=require(_0x9d39('0x5'));var auth=require(_0x9d39('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d39('0x7'));var controller=require(_0x9d39('0x8'));router['get']('/',auth[_0x9d39('0x9')](),controller[_0x9d39('0xa')]);router['get'](_0x9d39('0xb'),auth['isAuthenticated'](),controller[_0x9d39('0xc')]);router[_0x9d39('0xd')](_0x9d39('0xe'),auth[_0x9d39('0x9')](),controller[_0x9d39('0xf')]);router[_0x9d39('0xd')](_0x9d39('0x10'),auth[_0x9d39('0x9')](),controller[_0x9d39('0x11')]);router[_0x9d39('0x12')]('/',auth[_0x9d39('0x9')](),interaction[_0x9d39('0x13')](_0x9d39('0x14'),_0x9d39('0x15')),controller['create']);router[_0x9d39('0x16')](_0x9d39('0xe'),auth[_0x9d39('0x9')](),controller[_0x9d39('0x17')]);router[_0x9d39('0x16')](_0x9d39('0x18'),auth[_0x9d39('0x9')](),controller['accept']);router['put'](_0x9d39('0x19'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x9d39('0xe'),auth[_0x9d39('0x9')](),controller[_0x9d39('0x1a')]);module[_0x9d39('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 4aeac7d..cb0413a 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 _0x3c00=['BOOLEAN','out','STRING','DATE','INTEGER','ENUM','Email','Chat','lodash','exports','TEXT','long'];(function(_0x3c7601,_0x5eb803){var _0x254f65=function(_0x1a65ad){while(--_0x1a65ad){_0x3c7601['push'](_0x3c7601['shift']());}};_0x254f65(++_0x5eb803);}(_0x3c00,0xf8));var _0x03c0=function(_0x2dab2b,_0x424660){_0x2dab2b=_0x2dab2b-0x0;var _0x3730cc=_0x3c00[_0x2dab2b];return _0x3730cc;};'use strict';var Sequelize=require('sequelize');var _=require(_0x03c0('0x0'));module[_0x03c0('0x1')]={'body':{'type':Sequelize[_0x03c0('0x2')](_0x03c0('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x03c0('0x2')]('medium')},'read':{'type':Sequelize[_0x03c0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x03c0('0x5')),'defaultValue':_0x03c0('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x03c0('0x6')](0x1fe)},'from':{'type':Sequelize[_0x03c0('0x6')]},'to':{'type':Sequelize[_0x03c0('0x2')]('long')},'cc':{'type':Sequelize[_0x03c0('0x2')](_0x03c0('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x03c0('0x7')]},'attach':{'type':Sequelize[_0x03c0('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x03c0('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x03c0('0x7')]},'originTo':{'type':Sequelize[_0x03c0('0x2')](_0x03c0('0x3'))},'originCc':{'type':Sequelize[_0x03c0('0x2')](_0x03c0('0x3'))},'originChannel':{'type':Sequelize[_0x03c0('0x9')](_0x03c0('0xa'),_0x03c0('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x32cb=['out','STRING','long','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','BOOLEAN','ENUM'];(function(_0x24e19c,_0x1eec14){var _0x188fac=function(_0xeac31d){while(--_0xeac31d){_0x24e19c['push'](_0x24e19c['shift']());}};_0x188fac(++_0x1eec14);}(_0x32cb,0x96));var _0xb32c=function(_0x508c95,_0x2d31f3){_0x508c95=_0x508c95-0x0;var _0x25586e=_0x32cb[_0x508c95];return _0x25586e;};'use strict';var Sequelize=require(_0xb32c('0x0'));var _=require(_0xb32c('0x1'));module[_0xb32c('0x2')]={'body':{'type':Sequelize[_0xb32c('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0xb32c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb32c('0x5')]('in',_0xb32c('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xb32c('0x7')]},'to':{'type':Sequelize[_0xb32c('0x3')](_0xb32c('0x8'))},'cc':{'type':Sequelize[_0xb32c('0x3')](_0xb32c('0x8'))},'bcc':{'type':Sequelize[_0xb32c('0x3')](_0xb32c('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xb32c('0x9')]},'attach':{'type':Sequelize[_0xb32c('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb32c('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb32c('0x9')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0xb32c('0x3')](_0xb32c('0x8'))},'originChannel':{'type':Sequelize[_0xb32c('0x5')](_0xb32c('0xb'),_0xb32c('0xc')),'defaultValue':_0xb32c('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index ca2755b..0e304a1 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 _0xfe2b=['mail-interactions','accept','mail','read','readAt','UserId','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','manual','interface','channel','event','EventManager','acceptmessage','null','RejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','render','merge','body','contact','agent','account','index','map','MailMessage','rawAttributes','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','options','includeAll','include','findAll','rows','params','find','describe','create','direction','out','split','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','Smtp','isNil','host','port','secure','authentication','auth','pass','service','user','attachments','length','root','server/files/attachments','basename','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify'];(function(_0x4cc360,_0x54a84e){var _0x4186d0=function(_0x55d870){while(--_0x55d870){_0x4cc360['push'](_0x4cc360['shift']());}};_0x4186d0(++_0x54a84e);}(_0xfe2b,0x186));var _0xbfe2=function(_0x41eccd,_0x2052f4){_0x41eccd=_0x41eccd-0x0;var _0x4ebf84=_0xfe2b[_0x41eccd];return _0x4ebf84;};'use strict';var emlformat=require(_0xbfe2('0x0'));var rimraf=require(_0xbfe2('0x1'));var zipdir=require(_0xbfe2('0x2'));var jsonpatch=require(_0xbfe2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbfe2('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbfe2('0x5'));var csv=require(_0xbfe2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfe2('0x7'));var _=require(_0xbfe2('0x8'));var squel=require(_0xbfe2('0x9'));var crypto=require(_0xbfe2('0xa'));var jsforce=require(_0xbfe2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbfe2('0x6'));var querystring=require(_0xbfe2('0xc'));var Papa=require(_0xbfe2('0xd'));var Redis=require('ioredis');var authService=require(_0xbfe2('0xe'));var qs=require(_0xbfe2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfe2('0x10'));var logger=require(_0xbfe2('0x11'))(_0xbfe2('0x12'));var utils=require(_0xbfe2('0x13'));var config=require(_0xbfe2('0x14'));var licenseUtil=require(_0xbfe2('0x15'));var db=require(_0xbfe2('0x16'))['db'];config[_0xbfe2('0x17')]=_[_0xbfe2('0x18')](config[_0xbfe2('0x17')],{'host':_0xbfe2('0x19'),'port':0x18eb});var socket=require(_0xbfe2('0x1a'))(new Redis(config['redis']));require('./mailMessage.socket')[_0xbfe2('0x1b')](socket);var jayson=require(_0xbfe2('0x1c'));var client=jayson[_0xbfe2('0x1d')][_0xbfe2('0x1e')]({'port':0x232c});var client9003=jayson[_0xbfe2('0x1d')][_0xbfe2('0x1e')]({'port':0x232b});var client9002=jayson[_0xbfe2('0x1d')][_0xbfe2('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3302b6,_0x169376,_0x33cef4,_0x3dd46d){return new BPromise(function(_0x50f84e,_0x449c61){var _0x3516cd=_0x3dd46d||client;return _0x3516cd[_0xbfe2('0x1f')](_0x3302b6,_0x33cef4)[_0xbfe2('0x20')](function(_0x805d95){logger['info'](_0xbfe2('0x21'),_0x169376,_0xbfe2('0x22'));logger[_0xbfe2('0x23')](_0xbfe2('0x24'),_0x169376,'request\x20sent',JSON['stringify'](_0x805d95));if(_0x805d95['error']){if(_0x805d95['error'][_0xbfe2('0x25')]===0x1f4){logger[_0xbfe2('0x26')](_0xbfe2('0x21'),_0x169376,_0x805d95[_0xbfe2('0x26')][_0xbfe2('0x27')]);return _0x449c61(_0x805d95['error'][_0xbfe2('0x27')]);}logger[_0xbfe2('0x26')]('MailMessage,\x20%s,\x20%s',_0x169376,_0x805d95[_0xbfe2('0x26')][_0xbfe2('0x27')]);return _0x50f84e(_0x805d95[_0xbfe2('0x26')]['message']);}else{logger[_0xbfe2('0x28')](_0xbfe2('0x21'),_0x169376,_0xbfe2('0x22'));_0x50f84e(_0x805d95[_0xbfe2('0x29')][_0xbfe2('0x27')]);}})[_0xbfe2('0x2a')](function(_0x234190){logger[_0xbfe2('0x26')](_0xbfe2('0x21'),_0x169376,_0x234190);_0x449c61(_0x234190);});});}function respondWithStatusCode(_0x2cf35e,_0x4097b0){_0x4097b0=_0x4097b0||0xcc;return function(_0x3e838e){if(_0x3e838e){return _0x2cf35e[_0xbfe2('0x2b')](_0x4097b0);}return _0x2cf35e[_0xbfe2('0x2c')](_0x4097b0)[_0xbfe2('0x2d')]();};}function respondWithResult(_0x4425a8,_0x1afdd6){_0x1afdd6=_0x1afdd6||0xc8;return function(_0x352d6a){if(_0x352d6a){return _0x4425a8[_0xbfe2('0x2c')](_0x1afdd6)[_0xbfe2('0x2e')](_0x352d6a);}};}function respondWithFilteredResult(_0x3f63ec,_0x34dbfe){return function(_0x47af8b){if(_0x47af8b){var _0x44fa83=typeof _0x34dbfe['offset']===_0xbfe2('0x2f')&&typeof _0x34dbfe[_0xbfe2('0x30')]===_0xbfe2('0x2f');var _0x3f2437=_0x47af8b[_0xbfe2('0x31')];var _0x533bb5=_0x44fa83?0x0:_0x34dbfe[_0xbfe2('0x32')];var _0x578fbb=_0x44fa83?_0x47af8b[_0xbfe2('0x31')]:_0x34dbfe[_0xbfe2('0x32')]+_0x34dbfe[_0xbfe2('0x30')];var _0x1fb427;if(_0x578fbb>=_0x3f2437){_0x578fbb=_0x3f2437;_0x1fb427=0xc8;}else{_0x1fb427=0xce;}_0x3f63ec['status'](_0x1fb427);return _0x3f63ec[_0xbfe2('0x33')](_0xbfe2('0x34'),_0x533bb5+'-'+_0x578fbb+'/'+_0x3f2437)[_0xbfe2('0x2e')](_0x47af8b);}return null;};}function patchUpdates(_0x3980e1){return function(_0x155f52){try{jsonpatch[_0xbfe2('0x35')](_0x155f52,_0x3980e1,!![]);}catch(_0x3831d1){return BPromise[_0xbfe2('0x36')](_0x3831d1);}return _0x155f52[_0xbfe2('0x37')]();};}function saveUpdates(_0x59bb49,_0x32b7a4){return function(_0x1cb023){if(_0x1cb023){return _0x1cb023[_0xbfe2('0x38')](_0x59bb49)[_0xbfe2('0x20')](function(_0x4d870d){return _0x4d870d;});}return null;};}function removeEntity(_0x40686f,_0x5f3c46){return function(_0x5b4e9){if(_0x5b4e9){return _0x5b4e9[_0xbfe2('0x39')]()[_0xbfe2('0x20')](function(){_0x40686f[_0xbfe2('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe0045f,_0x1a23eb){return function(_0xb02af3){if(!_0xb02af3){_0xe0045f['sendStatus'](0x194);}return _0xb02af3;};}function handleError(_0x29752e,_0x49c72b){_0x49c72b=_0x49c72b||0x1f4;return function(_0x33370f){logger['error'](_0x33370f['stack']);if(_0x33370f[_0xbfe2('0x3a')]){delete _0x33370f['name'];}_0x29752e[_0xbfe2('0x2c')](_0x49c72b)[_0xbfe2('0x3b')](_0x33370f);};}function getMustacheRender(_0x14c05b,_0x13ae18){return Mustache[_0xbfe2('0x3c')](_0x14c05b,_[_0xbfe2('0x3d')](_0x13ae18[_0xbfe2('0x3e')],{'contact':_0x13ae18[_0xbfe2('0x3f')],'message':_0x13ae18[_0xbfe2('0x27')],'agent':_0x13ae18[_0xbfe2('0x40')],'interaction':_0x13ae18['interaction'],'account':_0x13ae18[_0xbfe2('0x41')]}))||'';}exports[_0xbfe2('0x42')]=function(_0x27571a,_0x3697bf){var _0x1f8014={},_0x5ed5b3={},_0x5dd780={'count':0x0,'rows':[]};var _0x23551d=_[_0xbfe2('0x43')](db[_0xbfe2('0x44')][_0xbfe2('0x45')],function(_0x1b3fc5){return{'name':_0x1b3fc5['fieldName'],'type':_0x1b3fc5['type'][_0xbfe2('0x46')]};});_0x5ed5b3[_0xbfe2('0x47')]=_[_0xbfe2('0x43')](_0x23551d,_0xbfe2('0x3a'));_0x5ed5b3['query']=_[_0xbfe2('0x48')](_0x27571a['query']);_0x5ed5b3['filters']=_[_0xbfe2('0x49')](_0x5ed5b3[_0xbfe2('0x47')],_0x5ed5b3[_0xbfe2('0x4a')]);_0x1f8014[_0xbfe2('0x4b')]=_[_0xbfe2('0x49')](_0x5ed5b3[_0xbfe2('0x47')],qs[_0xbfe2('0x4c')](_0x27571a['query'][_0xbfe2('0x4c')]));_0x1f8014[_0xbfe2('0x4b')]=_0x1f8014['attributes']['length']?_0x1f8014[_0xbfe2('0x4b')]:_0x5ed5b3[_0xbfe2('0x47')];if(!_0x27571a[_0xbfe2('0x4a')][_0xbfe2('0x4d')](_0xbfe2('0x4e'))){_0x1f8014[_0xbfe2('0x30')]=qs[_0xbfe2('0x30')](_0x27571a[_0xbfe2('0x4a')]['limit']);_0x1f8014['offset']=qs['offset'](_0x27571a[_0xbfe2('0x4a')][_0xbfe2('0x32')]);}_0x1f8014[_0xbfe2('0x4f')]=qs[_0xbfe2('0x50')](_0x27571a['query']['sort']);_0x1f8014[_0xbfe2('0x51')]=qs['filters'](_[_0xbfe2('0x52')](_0x27571a[_0xbfe2('0x4a')],_0x5ed5b3[_0xbfe2('0x53')]),_0x23551d);if(_0x27571a[_0xbfe2('0x4a')][_0xbfe2('0x54')]){_0x1f8014[_0xbfe2('0x51')]=_[_0xbfe2('0x3d')](_0x1f8014[_0xbfe2('0x51')],{'$or':_[_0xbfe2('0x43')](_0x23551d,function(_0x349ebb){if(_0x349ebb[_0xbfe2('0x55')]!=='VIRTUAL'){var _0x466a27={};_0x466a27[_0x349ebb[_0xbfe2('0x3a')]]={'$like':'%'+_0x27571a[_0xbfe2('0x4a')][_0xbfe2('0x54')]+'%'};return _0x466a27;}})});}_0x1f8014=_[_0xbfe2('0x3d')]({},_0x1f8014,_0x27571a[_0xbfe2('0x56')]);var _0x1778f2={'where':_0x1f8014[_0xbfe2('0x51')]};return db[_0xbfe2('0x44')][_0xbfe2('0x31')](_0x1778f2)[_0xbfe2('0x20')](function(_0xba0bdc){_0x5dd780[_0xbfe2('0x31')]=_0xba0bdc;if(_0x27571a[_0xbfe2('0x4a')][_0xbfe2('0x57')]){_0x1f8014[_0xbfe2('0x58')]=[{'all':!![]}];}return db[_0xbfe2('0x44')][_0xbfe2('0x59')](_0x1f8014);})[_0xbfe2('0x20')](function(_0xdc0fa8){_0x5dd780[_0xbfe2('0x5a')]=_0xdc0fa8;return _0x5dd780;})[_0xbfe2('0x20')](respondWithFilteredResult(_0x3697bf,_0x1f8014))[_0xbfe2('0x2a')](handleError(_0x3697bf,null));};exports['show']=function(_0xd66be1,_0x39459c){var _0x3362d0={'raw':!![],'where':{'id':_0xd66be1[_0xbfe2('0x5b')]['id']}},_0x56492e={};_0x56492e[_0xbfe2('0x47')]=_['keys'](db[_0xbfe2('0x44')][_0xbfe2('0x45')]);_0x56492e[_0xbfe2('0x4a')]=_['keys'](_0xd66be1[_0xbfe2('0x4a')]);_0x56492e[_0xbfe2('0x53')]=_[_0xbfe2('0x49')](_0x56492e[_0xbfe2('0x47')],_0x56492e[_0xbfe2('0x4a')]);_0x3362d0[_0xbfe2('0x4b')]=_[_0xbfe2('0x49')](_0x56492e['model'],qs[_0xbfe2('0x4c')](_0xd66be1['query']['fields']));_0x3362d0[_0xbfe2('0x4b')]=_0x3362d0[_0xbfe2('0x4b')]['length']?_0x3362d0[_0xbfe2('0x4b')]:_0x56492e['model'];if(_0xd66be1[_0xbfe2('0x4a')][_0xbfe2('0x57')]){_0x3362d0[_0xbfe2('0x58')]=[{'all':!![]}];}_0x3362d0=_[_0xbfe2('0x3d')]({},_0x3362d0,_0xd66be1[_0xbfe2('0x56')]);return db[_0xbfe2('0x44')][_0xbfe2('0x5c')](_0x3362d0)[_0xbfe2('0x20')](handleEntityNotFound(_0x39459c,null))['then'](respondWithResult(_0x39459c,null))[_0xbfe2('0x2a')](handleError(_0x39459c,null));};exports[_0xbfe2('0x38')]=function(_0x2dde49,_0x54acde){if(_0x2dde49[_0xbfe2('0x3e')]['id']){delete _0x2dde49[_0xbfe2('0x3e')]['id'];}return db[_0xbfe2('0x44')][_0xbfe2('0x5c')]({'where':{'id':_0x2dde49[_0xbfe2('0x5b')]['id']}})[_0xbfe2('0x20')](handleEntityNotFound(_0x54acde,null))[_0xbfe2('0x20')](saveUpdates(_0x2dde49[_0xbfe2('0x3e')],null))[_0xbfe2('0x20')](respondWithResult(_0x54acde,null))['catch'](handleError(_0x54acde,null));};exports['destroy']=function(_0x6b8469,_0x3e2614){return db[_0xbfe2('0x44')][_0xbfe2('0x5c')]({'where':{'id':_0x6b8469[_0xbfe2('0x5b')]['id']}})[_0xbfe2('0x20')](handleEntityNotFound(_0x3e2614,null))[_0xbfe2('0x20')](removeEntity(_0x3e2614,null))[_0xbfe2('0x2a')](handleError(_0x3e2614,null));};exports[_0xbfe2('0x5d')]=function(_0x5b8bac,_0x302ce8){return db[_0xbfe2('0x44')]['describe']()[_0xbfe2('0x20')](respondWithResult(_0x302ce8,null))['catch'](handleError(_0x302ce8,null));};exports[_0xbfe2('0x5e')]=function(_0x1c3069,_0xd7c1e9){return db[_0xbfe2('0x44')]['create'](_0x1c3069[_0xbfe2('0x3e')])[_0xbfe2('0x20')](function(_0x469d09){if(_0x469d09){if(_0x469d09[_0xbfe2('0x5f')]===_0xbfe2('0x60')&&!_0x469d09['secret']){var _0x3715d8,_0x175a8a,_0xa37c83;if(_0x1c3069[_0xbfe2('0x3e')]['to']){_0x175a8a=_0x1c3069['body']['to'][_0xbfe2('0x61')](',')[0x0];}return db[_0xbfe2('0x62')][_0xbfe2('0x63')]({'where':{'id':_0x469d09['MailAccountId']},'include':[{'model':db[_0xbfe2('0x64')],'as':_0xbfe2('0x65'),'include':[{'model':db[_0xbfe2('0x66')],'as':_0xbfe2('0x67'),'where':{'email':_0x175a8a},'limit':0x1,'order':[[_0xbfe2('0x68'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xbfe2('0x69'),'raw':!![]}]})[_0xbfe2('0x20')](function(_0x10146c){_0x3715d8=_0x10146c;if(_0x3715d8&&_0x3715d8[_0xbfe2('0x69')]){var _0x42ed8c={'tls':{'rejectUnauthorized':![]}};if(_[_0xbfe2('0x6a')](_0x3715d8['Smtp']['service'])){_0x42ed8c[_0xbfe2('0x6b')]=_0x3715d8[_0xbfe2('0x69')][_0xbfe2('0x6b')];_0x42ed8c[_0xbfe2('0x6c')]=_0x3715d8[_0xbfe2('0x69')][_0xbfe2('0x6c')];_0x42ed8c[_0xbfe2('0x6d')]=_0x3715d8['Smtp'][_0xbfe2('0x6d')];if(_0x3715d8[_0xbfe2('0x69')][_0xbfe2('0x6e')]){_0x42ed8c[_0xbfe2('0x6f')]={'user':_0x3715d8[_0xbfe2('0x69')]['user'],'pass':_0x3715d8[_0xbfe2('0x69')][_0xbfe2('0x70')]};}}else{_0x42ed8c[_0xbfe2('0x71')]=_0x3715d8[_0xbfe2('0x69')][_0xbfe2('0x71')];_0x42ed8c['auth']={'user':_0x3715d8[_0xbfe2('0x69')][_0xbfe2('0x72')],'pass':_0x3715d8[_0xbfe2('0x69')][_0xbfe2('0x70')]};_0x42ed8c[_0xbfe2('0x6d')]=_0x3715d8[_0xbfe2('0x69')][_0xbfe2('0x6d')];}if(_0x1c3069[_0xbfe2('0x3e')][_0xbfe2('0x73')]&&_0x1c3069[_0xbfe2('0x3e')][_0xbfe2('0x73')]['length']){for(var _0x5dec28=0x0;_0x5dec28<_0x1c3069[_0xbfe2('0x3e')][_0xbfe2('0x73')][_0xbfe2('0x74')];_0x5dec28+=0x1){_0x1c3069[_0xbfe2('0x3e')][_0xbfe2('0x73')][_0x5dec28]={'filename':_0x1c3069['body'][_0xbfe2('0x73')][_0x5dec28][_0xbfe2('0x3a')],'path':path['join'](config[_0xbfe2('0x75')],_0xbfe2('0x76'),_0x1c3069[_0xbfe2('0x3e')][_0xbfe2('0x73')][_0x5dec28][_0xbfe2('0x77')])};}}_0xa37c83={'account':_0x42ed8c,'message':_0x1c3069[_0xbfe2('0x3e')]};return;}})[_0xbfe2('0x20')](function(){if(_0x3715d8[_0xbfe2('0x65')]){if(_0x3715d8[_0xbfe2('0x65')][_0xbfe2('0x67')][_0xbfe2('0x74')]){return _0x3715d8[_0xbfe2('0x65')][_0xbfe2('0x67')][0x0];}else{return db[_0xbfe2('0x66')][_0xbfe2('0x5e')](_[_0xbfe2('0x18')](_0x1c3069[_0xbfe2('0x3e')],{'firstName':_0x1c3069[_0xbfe2('0x3e')]['to'],'email':_0x1c3069[_0xbfe2('0x3e')]['to'],'phone':_0x1c3069[_0xbfe2('0x3e')]['to'],'ListId':_0x3715d8['ListId']}));}}else{throw new Error(_0xbfe2('0x78'));}})[_0xbfe2('0x20')](function(){if(_0xa37c83){return respondWithRpcPromise('SendMail',_0xbfe2('0x79'),_0xa37c83,client9003)[_0xbfe2('0x20')](function(_0x2383b9){return _0x469d09[_0xbfe2('0x38')]({'read':!![],'messageId':_0x2383b9[_0xbfe2('0x7a')],'sentAt':moment()[_0xbfe2('0x7b')](_0xbfe2('0x7c'))});})[_0xbfe2('0x2a')](function(_0xb3041e){logger['error']('%s',JSON[_0xbfe2('0x7d')](_0xb3041e));return _0x469d09;});}return _0x469d09;});}return _0x469d09;}})['then'](respondWithResult(_0xd7c1e9,0xc9))[_0xbfe2('0x2a')](handleError(_0xd7c1e9,null));};var interaction_log=require('../../config/logger')(_0xbfe2('0x7e'));exports[_0xbfe2('0x7f')]=function(_0x1d1ccf,_0x4b55db,_0x9ec14f){var _0x2d02ff={'agent':{},'channel':_0xbfe2('0x80')};if(_0x1d1ccf[_0xbfe2('0x3e')]['id']){delete _0x1d1ccf[_0xbfe2('0x3e')]['id'];}_0x1d1ccf['body'][_0xbfe2('0x81')]=!![];_0x1d1ccf[_0xbfe2('0x3e')][_0xbfe2('0x82')]=moment()[_0xbfe2('0x7b')](_0xbfe2('0x7c'));_0x1d1ccf['body'][_0xbfe2('0x83')]=_0x1d1ccf[_0xbfe2('0x3e')][_0xbfe2('0x83')]||_0x1d1ccf[_0xbfe2('0x72')]['id'];_0x2d02ff[_0xbfe2('0x40')]['id']=_0x1d1ccf[_0xbfe2('0x3e')][_0xbfe2('0x83')];return db[_0xbfe2('0x44')][_0xbfe2('0x5c')]({'where':{'id':_0x1d1ccf[_0xbfe2('0x5b')]['id'],'UserId':null},'include':[{'model':db[_0xbfe2('0x66')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x4b55db,null))['then'](saveUpdates(_0x1d1ccf[_0xbfe2('0x3e')],null))[_0xbfe2('0x20')](function(_0x503adb){if(_0x503adb){_0x2d02ff[_0xbfe2('0x27')]=_0x503adb[_0xbfe2('0x84')]({'plain':!![]});return db['MailInteraction'][_0xbfe2('0x5c')]({'where':{'id':_0x503adb[_0xbfe2('0x85')]}});}return null;})['then'](handleEntityNotFound(_0x4b55db,null))[_0xbfe2('0x20')](function(_0x47f8cf){if(_0x47f8cf){return _0x47f8cf[_0xbfe2('0x38')]({'UserId':_0x1d1ccf['body'][_0xbfe2('0x83')],'read1stAt':_[_0xbfe2('0x6a')](_0x47f8cf[_0xbfe2('0x86')])?moment()[_0xbfe2('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbfe2('0x20')](function(_0x51b674){if(_0x51b674){_0x2d02ff[_0xbfe2('0x87')]=_0x51b674['get']({'plain':!![]});interaction_log[_0xbfe2('0x28')](_0xbfe2('0x88'),_0x1d1ccf[_0xbfe2('0x72')]['id'],_0x1d1ccf['user'][_0xbfe2('0x3a')],_0x1d1ccf[_0xbfe2('0x72')][_0xbfe2('0x89')],_0x2d02ff[_0xbfe2('0x87')]['id'],_0x1d1ccf[_0xbfe2('0x3e')]?JSON[_0xbfe2('0x7d')](_0x1d1ccf[_0xbfe2('0x3e')]):'null');return respondWithRpcPromise(_0xbfe2('0x8a'),'acceptMessage',_0x2d02ff);}return null;})['then'](function(_0x2ebe0d){if(_0x2ebe0d){if(_0x1d1ccf[_0xbfe2('0x3e')][_0xbfe2('0x8b')]){_0x2d02ff['message'][_0xbfe2('0x8c')]=util[_0xbfe2('0x7b')]('SIP/%s',_0x1d1ccf['user'][_0xbfe2('0x3a')]);_0x2d02ff[_0xbfe2('0x27')][_0xbfe2('0x8d')]=_0x2d02ff[_0xbfe2('0x8d')];_0x2d02ff[_0xbfe2('0x27')][_0xbfe2('0x8e')]=_0xbfe2('0x7f');return respondWithRpcPromise(_0xbfe2('0x8f'),_0xbfe2('0x8f'),{'event':_0xbfe2('0x90'),'message':_0x2d02ff[_0xbfe2('0x27')]},client9002)[_0xbfe2('0x20')](function(){return _0x2d02ff;});}return _0x2d02ff;}return null;})[_0xbfe2('0x20')](respondWithResult(_0x4b55db,null))[_0xbfe2('0x2a')](handleError(_0x4b55db,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0xbfe2('0x36')]=function(_0x54c184,_0xcde7ee,_0xf5863){var _0x1fb2fd={'agent':{},'channel':_0xbfe2('0x80')};if(_0x54c184[_0xbfe2('0x3e')]['id']){delete _0x54c184[_0xbfe2('0x3e')]['id'];}_0x54c184['body']['UserId']=_0x54c184['body'][_0xbfe2('0x83')]||_0x54c184[_0xbfe2('0x72')]['id'];_0x1fb2fd[_0xbfe2('0x40')]['id']=_0x54c184['body'][_0xbfe2('0x83')];return db[_0xbfe2('0x44')][_0xbfe2('0x5c')]({'where':{'id':_0x54c184[_0xbfe2('0x5b')]['id'],'UserId':null}})[_0xbfe2('0x20')](handleEntityNotFound(_0xcde7ee,null))['then'](function(_0xefd137){if(_0xefd137){_0x1fb2fd[_0xbfe2('0x27')]=_0xefd137[_0xbfe2('0x84')]({'plain':!![]});return db['MailInteraction'][_0xbfe2('0x5c')]({'where':{'id':_0xefd137[_0xbfe2('0x85')]}});}return null;})['then'](handleEntityNotFound(_0xcde7ee,null))['then'](function(_0xbc0d93){if(_0xbc0d93){_0x1fb2fd[_0xbfe2('0x87')]=_0xbc0d93[_0xbfe2('0x84')]({'plain':!![]});interaction_log[_0xbfe2('0x28')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54c184['user']['id'],_0x54c184[_0xbfe2('0x72')][_0xbfe2('0x3a')],_0x54c184[_0xbfe2('0x72')]['role'],_0x1fb2fd[_0xbfe2('0x87')]['id'],_0x54c184[_0xbfe2('0x3e')]?JSON[_0xbfe2('0x7d')](_0x54c184[_0xbfe2('0x3e')]):_0xbfe2('0x91'));return respondWithRpcPromise(_0xbfe2('0x92'),'rejectMessage',_0x1fb2fd);}return null;})[_0xbfe2('0x20')](function(_0x4db26f){if(_0x4db26f){_0x4db26f[_0xbfe2('0x27')][_0xbfe2('0x8c')]=util['format']('SIP/%s',_0x54c184['user'][_0xbfe2('0x3a')]);_0x4db26f[_0xbfe2('0x27')][_0xbfe2('0x8d')]=_0x1fb2fd[_0xbfe2('0x8d')];_0x4db26f[_0xbfe2('0x27')][_0xbfe2('0x8e')]=_0xbfe2('0x36');respondWithRpcPromise(_0xbfe2('0x8f'),'EventManager',{'event':_0xbfe2('0x93'),'message':_0x4db26f[_0xbfe2('0x27')]},client9002);return _0x1fb2fd;}return null;})[_0xbfe2('0x20')](respondWithResult(_0xcde7ee,null))[_0xbfe2('0x2a')](handleError(_0xcde7ee,null));};exports[_0xbfe2('0x94')]=function(_0x598399,_0x13a41b){var _0x2a2055=moment()[_0xbfe2('0x95')]()[_0xbfe2('0x96')]();var _0x16632e=path[_0xbfe2('0x97')](config[_0xbfe2('0x75')],_0xbfe2('0x98'),_0xbfe2('0x99'),_0xbfe2('0x9a'));var _0x49d097=path[_0xbfe2('0x97')](config[_0xbfe2('0x75')],_0xbfe2('0x98'),_0xbfe2('0x99'),_0xbfe2('0x73'));var _0x575e55=util[_0xbfe2('0x7b')](_0xbfe2('0x9b'),_0x2a2055);return db[_0xbfe2('0x44')][_0xbfe2('0x5c')]({'where':{'id':_0x598399['params']['id']},'attributes':['id',_0xbfe2('0x3e'),_0xbfe2('0x9c'),'to','cc',_0xbfe2('0x9d'),_0xbfe2('0x9e'),_0xbfe2('0x9f')],'include':_0x598399[_0xbfe2('0x4a')][_0xbfe2('0x73')]?[{'model':db[_0xbfe2('0xa0')],'as':_0xbfe2('0xa1')}]:undefined})['then'](handleEntityNotFound(_0x13a41b,null))[_0xbfe2('0x20')](function(_0x59795a){if(_0x59795a){var _0x52ea9c=_0x59795a;var _0x213638={'from':_0x52ea9c[_0xbfe2('0x9c')],'to':_0x52ea9c['to'],'subject':_0x52ea9c[_0xbfe2('0x9e')],'html':_0x52ea9c[_0xbfe2('0x3e')],'headers':{'Date':moment(_0x52ea9c[_0xbfe2('0x9f')])['format'](_0xbfe2('0xa2'))},'attachments':[]};if(_0x59795a['cc']){_0x213638[_0xbfe2('0xa3')]['Cc']=_0x59795a['cc'];}if(_0x59795a[_0xbfe2('0x9d')]){_0x213638[_0xbfe2('0xa3')][_0xbfe2('0xa4')]=_0x59795a[_0xbfe2('0x9d')];}return new BPromise(function(_0x4dae83,_0x4529b0){if(_0x59795a[_0xbfe2('0xa1')]){for(var _0x11e44c=0x0;_0x11e44c<_0x59795a[_0xbfe2('0xa1')]['length'];_0x11e44c++){var _0x35d26c=_0x59795a['Attachments'][_0x11e44c];var _0x11ce73=path[_0xbfe2('0x97')](_0x49d097,_0x35d26c[_0xbfe2('0x77')]);if(fs[_0xbfe2('0xa5')](_0x11ce73)){_0x213638[_0xbfe2('0x73')][_0xbfe2('0xa6')]({'name':_0x35d26c[_0xbfe2('0x3a')],'contentType':_0x35d26c['type'],'data':fs['readFileSync'](_0x11ce73)});}}}emlformat[_0xbfe2('0xa7')](_0x213638,function(_0x12c8ea,_0x489e02){if(_0x12c8ea)return _0x4529b0(_0x12c8ea);fs[_0xbfe2('0xa8')](path[_0xbfe2('0x97')](_0x16632e,_0x575e55),_0x489e02);return _0x4dae83(_0x489e02);});});}})[_0xbfe2('0x20')](function(_0x3a2a4e){if(_0x3a2a4e){return _0x13a41b['download'](path[_0xbfe2('0x97')](_0x16632e,_0x575e55),_0x575e55,function(_0x4492a0){if(_0x4492a0){console[_0xbfe2('0xa9')](_0xbfe2('0xaa'),_0x4492a0);}else{fs[_0xbfe2('0xab')](path[_0xbfe2('0x97')](_0x16632e,_0x575e55));}});}})[_0xbfe2('0x2a')](handleError(_0x13a41b,null));}; \ No newline at end of file +var _0xc882=['from','bcc','subject','createdAt','Attachment','Attachments','headers','existsSync','push','readFileSync','build','writeFileSync','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','body','contact','agent','interaction','account','map','MailMessage','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','filters','include','find','params','describe','create','direction','secret','MailAccount','findOne','MailAccountId','CmList','List','updatedAt','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','CmContact','ListId','SendMail','messageId','format','mail-interactions','accept','mail','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','../../config/logger','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','rejectmessage','download','toString','server','files','message-%s.eml'];(function(_0x5947e2,_0x1abef5){var _0x295a86=function(_0x3020ba){while(--_0x3020ba){_0x5947e2['push'](_0x5947e2['shift']());}};_0x295a86(++_0x1abef5);}(_0xc882,0x167));var _0x2c88=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xc882[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0x2c88('0x0'));var rimraf=require(_0x2c88('0x1'));var zipdir=require(_0x2c88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c88('0x3'));var moment=require(_0x2c88('0x4'));var BPromise=require(_0x2c88('0x5'));var Mustache=require(_0x2c88('0x6'));var util=require(_0x2c88('0x7'));var path=require('path');var sox=require(_0x2c88('0x8'));var csv=require(_0x2c88('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c88('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c88('0xb'));var jsforce=require(_0x2c88('0xc'));var deskjs=require(_0x2c88('0xd'));var toCsv=require(_0x2c88('0x9'));var querystring=require(_0x2c88('0xe'));var Papa=require(_0x2c88('0xf'));var Redis=require(_0x2c88('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2c88('0x11'));var as=require(_0x2c88('0x12'));var hardwareService=require(_0x2c88('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2c88('0x14'));var config=require(_0x2c88('0x15'));var licenseUtil=require(_0x2c88('0x16'));var db=require('../../mysqldb')['db'];config[_0x2c88('0x17')]=_[_0x2c88('0x18')](config['redis'],{'host':_0x2c88('0x19'),'port':0x18eb});var socket=require(_0x2c88('0x1a'))(new Redis(config['redis']));require(_0x2c88('0x1b'))[_0x2c88('0x1c')](socket);var jayson=require(_0x2c88('0x1d'));var client=jayson[_0x2c88('0x1e')][_0x2c88('0x1f')]({'port':0x232c});var client9003=jayson['client'][_0x2c88('0x1f')]({'port':0x232b});var client9002=jayson[_0x2c88('0x1e')][_0x2c88('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x41ccb8,_0x21c0d7,_0x283ea3,_0x1d70b4){return new BPromise(function(_0x38bb69,_0x22d8a4){var _0x4c30f=_0x1d70b4||client;return _0x4c30f[_0x2c88('0x20')](_0x41ccb8,_0x283ea3)['then'](function(_0xd73daf){logger['info'](_0x2c88('0x21'),_0x21c0d7,_0x2c88('0x22'));logger[_0x2c88('0x23')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x21c0d7,'request\x20sent',JSON[_0x2c88('0x24')](_0xd73daf));if(_0xd73daf[_0x2c88('0x25')]){if(_0xd73daf['error'][_0x2c88('0x26')]===0x1f4){logger[_0x2c88('0x25')](_0x2c88('0x21'),_0x21c0d7,_0xd73daf[_0x2c88('0x25')]['message']);return _0x22d8a4(_0xd73daf[_0x2c88('0x25')][_0x2c88('0x27')]);}logger[_0x2c88('0x25')](_0x2c88('0x21'),_0x21c0d7,_0xd73daf[_0x2c88('0x25')][_0x2c88('0x27')]);return _0x38bb69(_0xd73daf[_0x2c88('0x25')][_0x2c88('0x27')]);}else{logger[_0x2c88('0x28')](_0x2c88('0x21'),_0x21c0d7,_0x2c88('0x22'));_0x38bb69(_0xd73daf[_0x2c88('0x29')]['message']);}})['catch'](function(_0x42d031){logger[_0x2c88('0x25')](_0x2c88('0x21'),_0x21c0d7,_0x42d031);_0x22d8a4(_0x42d031);});});}function respondWithStatusCode(_0x85cd2a,_0x260b88){_0x260b88=_0x260b88||0xcc;return function(_0x331113){if(_0x331113){return _0x85cd2a[_0x2c88('0x2a')](_0x260b88);}return _0x85cd2a[_0x2c88('0x2b')](_0x260b88)['end']();};}function respondWithResult(_0x3d033b,_0xbcf57a){_0xbcf57a=_0xbcf57a||0xc8;return function(_0x5a2b19){if(_0x5a2b19){return _0x3d033b[_0x2c88('0x2b')](_0xbcf57a)[_0x2c88('0x2c')](_0x5a2b19);}};}function respondWithFilteredResult(_0x49d6b0,_0x57cca0){return function(_0x23648b){if(_0x23648b){var _0x575264=typeof _0x57cca0['offset']==='undefined'&&typeof _0x57cca0[_0x2c88('0x2d')]===_0x2c88('0x2e');var _0x12322e=_0x23648b['count'];var _0x4744e2=_0x575264?0x0:_0x57cca0['offset'];var _0x1f0484=_0x575264?_0x23648b[_0x2c88('0x2f')]:_0x57cca0[_0x2c88('0x30')]+_0x57cca0[_0x2c88('0x2d')];var _0x581548;if(_0x1f0484>=_0x12322e){_0x1f0484=_0x12322e;_0x581548=0xc8;}else{_0x581548=0xce;}_0x49d6b0[_0x2c88('0x2b')](_0x581548);return _0x49d6b0[_0x2c88('0x31')](_0x2c88('0x32'),_0x4744e2+'-'+_0x1f0484+'/'+_0x12322e)[_0x2c88('0x2c')](_0x23648b);}return null;};}function patchUpdates(_0x12930e){return function(_0x14fcbe){try{jsonpatch[_0x2c88('0x33')](_0x14fcbe,_0x12930e,!![]);}catch(_0x4b9caf){return BPromise['reject'](_0x4b9caf);}return _0x14fcbe[_0x2c88('0x34')]();};}function saveUpdates(_0x2caa25,_0x1a1489){return function(_0x22f698){if(_0x22f698){return _0x22f698[_0x2c88('0x35')](_0x2caa25)[_0x2c88('0x36')](function(_0x467a4f){return _0x467a4f;});}return null;};}function removeEntity(_0x38e549,_0x254f30){return function(_0x4c859b){if(_0x4c859b){return _0x4c859b[_0x2c88('0x37')]()['then'](function(){_0x38e549[_0x2c88('0x2b')](0xcc)[_0x2c88('0x38')]();});}};}function handleEntityNotFound(_0x2b74e3,_0x10d560){return function(_0x3ed0d8){if(!_0x3ed0d8){_0x2b74e3['sendStatus'](0x194);}return _0x3ed0d8;};}function handleError(_0x3b1e71,_0x373d12){_0x373d12=_0x373d12||0x1f4;return function(_0x3c85d9){logger[_0x2c88('0x25')](_0x3c85d9[_0x2c88('0x39')]);if(_0x3c85d9[_0x2c88('0x3a')]){delete _0x3c85d9['name'];}_0x3b1e71[_0x2c88('0x2b')](_0x373d12)[_0x2c88('0x3b')](_0x3c85d9);};}function getMustacheRender(_0x559eed,_0x14af4b){return Mustache['render'](_0x559eed,_['merge'](_0x14af4b[_0x2c88('0x3c')],{'contact':_0x14af4b[_0x2c88('0x3d')],'message':_0x14af4b[_0x2c88('0x27')],'agent':_0x14af4b[_0x2c88('0x3e')],'interaction':_0x14af4b[_0x2c88('0x3f')],'account':_0x14af4b[_0x2c88('0x40')]}))||'';}exports['index']=function(_0x4b6bac,_0x7f5cb0){var _0xb6877e={},_0x20c425={},_0x3b444b={'count':0x0,'rows':[]};var _0x53a9de=_[_0x2c88('0x41')](db[_0x2c88('0x42')][_0x2c88('0x43')],function(_0x37309c){return{'name':_0x37309c[_0x2c88('0x44')],'type':_0x37309c['type'][_0x2c88('0x45')]};});_0x20c425['model']=_[_0x2c88('0x41')](_0x53a9de,_0x2c88('0x3a'));_0x20c425[_0x2c88('0x46')]=_[_0x2c88('0x47')](_0x4b6bac[_0x2c88('0x46')]);_0x20c425['filters']=_['intersection'](_0x20c425[_0x2c88('0x48')],_0x20c425['query']);_0xb6877e[_0x2c88('0x49')]=_[_0x2c88('0x4a')](_0x20c425['model'],qs[_0x2c88('0x4b')](_0x4b6bac['query'][_0x2c88('0x4b')]));_0xb6877e['attributes']=_0xb6877e['attributes'][_0x2c88('0x4c')]?_0xb6877e[_0x2c88('0x49')]:_0x20c425['model'];if(!_0x4b6bac[_0x2c88('0x46')]['hasOwnProperty'](_0x2c88('0x4d'))){_0xb6877e[_0x2c88('0x2d')]=qs[_0x2c88('0x2d')](_0x4b6bac[_0x2c88('0x46')][_0x2c88('0x2d')]);_0xb6877e[_0x2c88('0x30')]=qs['offset'](_0x4b6bac[_0x2c88('0x46')]['offset']);}_0xb6877e[_0x2c88('0x4e')]=qs[_0x2c88('0x4f')](_0x4b6bac[_0x2c88('0x46')]['sort']);_0xb6877e[_0x2c88('0x50')]=qs['filters'](_[_0x2c88('0x51')](_0x4b6bac[_0x2c88('0x46')],_0x20c425['filters']),_0x53a9de);if(_0x4b6bac[_0x2c88('0x46')][_0x2c88('0x52')]){_0xb6877e[_0x2c88('0x50')]=_[_0x2c88('0x53')](_0xb6877e[_0x2c88('0x50')],{'$or':_['map'](_0x53a9de,function(_0x70a060){if(_0x70a060['type']!==_0x2c88('0x54')){var _0x50785b={};_0x50785b[_0x70a060[_0x2c88('0x3a')]]={'$like':'%'+_0x4b6bac[_0x2c88('0x46')]['filter']+'%'};return _0x50785b;}})});}_0xb6877e=_[_0x2c88('0x53')]({},_0xb6877e,_0x4b6bac[_0x2c88('0x55')]);var _0x438b38={'where':_0xb6877e[_0x2c88('0x50')]};return db['MailMessage'][_0x2c88('0x2f')](_0x438b38)[_0x2c88('0x36')](function(_0x2195d3){_0x3b444b[_0x2c88('0x2f')]=_0x2195d3;if(_0x4b6bac['query'][_0x2c88('0x56')]){_0xb6877e['include']=[{'all':!![]}];}return db[_0x2c88('0x42')][_0x2c88('0x57')](_0xb6877e);})[_0x2c88('0x36')](function(_0x42a645){_0x3b444b[_0x2c88('0x58')]=_0x42a645;return _0x3b444b;})['then'](respondWithFilteredResult(_0x7f5cb0,_0xb6877e))[_0x2c88('0x59')](handleError(_0x7f5cb0,null));};exports[_0x2c88('0x5a')]=function(_0x6869fb,_0xafc26d){var _0x97ce4a={'raw':!![],'where':{'id':_0x6869fb['params']['id']}},_0x48f598={};_0x48f598[_0x2c88('0x48')]=_[_0x2c88('0x47')](db[_0x2c88('0x42')][_0x2c88('0x43')]);_0x48f598[_0x2c88('0x46')]=_[_0x2c88('0x47')](_0x6869fb['query']);_0x48f598[_0x2c88('0x5b')]=_[_0x2c88('0x4a')](_0x48f598['model'],_0x48f598[_0x2c88('0x46')]);_0x97ce4a[_0x2c88('0x49')]=_[_0x2c88('0x4a')](_0x48f598[_0x2c88('0x48')],qs[_0x2c88('0x4b')](_0x6869fb[_0x2c88('0x46')][_0x2c88('0x4b')]));_0x97ce4a[_0x2c88('0x49')]=_0x97ce4a[_0x2c88('0x49')]['length']?_0x97ce4a[_0x2c88('0x49')]:_0x48f598['model'];if(_0x6869fb[_0x2c88('0x46')][_0x2c88('0x56')]){_0x97ce4a[_0x2c88('0x5c')]=[{'all':!![]}];}_0x97ce4a=_['merge']({},_0x97ce4a,_0x6869fb['options']);return db[_0x2c88('0x42')][_0x2c88('0x5d')](_0x97ce4a)[_0x2c88('0x36')](handleEntityNotFound(_0xafc26d,null))[_0x2c88('0x36')](respondWithResult(_0xafc26d,null))['catch'](handleError(_0xafc26d,null));};exports[_0x2c88('0x35')]=function(_0x56a3eb,_0x22408f){if(_0x56a3eb[_0x2c88('0x3c')]['id']){delete _0x56a3eb[_0x2c88('0x3c')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x56a3eb[_0x2c88('0x5e')]['id']}})[_0x2c88('0x36')](handleEntityNotFound(_0x22408f,null))[_0x2c88('0x36')](saveUpdates(_0x56a3eb[_0x2c88('0x3c')],null))[_0x2c88('0x36')](respondWithResult(_0x22408f,null))[_0x2c88('0x59')](handleError(_0x22408f,null));};exports['destroy']=function(_0x5ec48d,_0x805cd1){return db[_0x2c88('0x42')]['find']({'where':{'id':_0x5ec48d['params']['id']}})[_0x2c88('0x36')](handleEntityNotFound(_0x805cd1,null))[_0x2c88('0x36')](removeEntity(_0x805cd1,null))[_0x2c88('0x59')](handleError(_0x805cd1,null));};exports[_0x2c88('0x5f')]=function(_0x542873,_0x54b44b){return db[_0x2c88('0x42')][_0x2c88('0x5f')]()[_0x2c88('0x36')](respondWithResult(_0x54b44b,null))[_0x2c88('0x59')](handleError(_0x54b44b,null));};exports[_0x2c88('0x60')]=function(_0x14333c,_0x501da9){return db['MailMessage'][_0x2c88('0x60')](_0x14333c[_0x2c88('0x3c')])[_0x2c88('0x36')](function(_0x3586f6){if(_0x3586f6){if(_0x3586f6[_0x2c88('0x61')]==='out'&&!_0x3586f6[_0x2c88('0x62')]){var _0x2a22c9,_0x1d0bab,_0x501166;if(_0x14333c[_0x2c88('0x3c')]['to']){_0x1d0bab=_0x14333c['body']['to']['split'](',')[0x0];}return db[_0x2c88('0x63')][_0x2c88('0x64')]({'where':{'id':_0x3586f6[_0x2c88('0x65')]},'include':[{'model':db[_0x2c88('0x66')],'as':_0x2c88('0x67'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x1d0bab},'limit':0x1,'order':[[_0x2c88('0x68'),'DESC']]}]},{'model':db[_0x2c88('0x69')],'as':_0x2c88('0x6a'),'raw':!![]}]})['then'](function(_0x1dbe32){_0x2a22c9=_0x1dbe32;if(_0x2a22c9&&_0x2a22c9[_0x2c88('0x6a')]){var _0x3f41c2={'tls':{'rejectUnauthorized':![]}};if(_[_0x2c88('0x6b')](_0x2a22c9[_0x2c88('0x6a')][_0x2c88('0x6c')])){_0x3f41c2[_0x2c88('0x6d')]=_0x2a22c9['Smtp'][_0x2c88('0x6d')];_0x3f41c2[_0x2c88('0x6e')]=_0x2a22c9[_0x2c88('0x6a')]['port'];_0x3f41c2[_0x2c88('0x6f')]=_0x2a22c9[_0x2c88('0x6a')][_0x2c88('0x6f')];if(_0x2a22c9['Smtp'][_0x2c88('0x70')]){_0x3f41c2[_0x2c88('0x71')]={'user':_0x2a22c9[_0x2c88('0x6a')][_0x2c88('0x72')],'pass':_0x2a22c9[_0x2c88('0x6a')][_0x2c88('0x73')]};}}else{_0x3f41c2['service']=_0x2a22c9[_0x2c88('0x6a')]['service'];_0x3f41c2[_0x2c88('0x71')]={'user':_0x2a22c9[_0x2c88('0x6a')][_0x2c88('0x72')],'pass':_0x2a22c9[_0x2c88('0x6a')][_0x2c88('0x73')]};_0x3f41c2[_0x2c88('0x6f')]=_0x2a22c9[_0x2c88('0x6a')][_0x2c88('0x6f')];}if(_0x14333c[_0x2c88('0x3c')][_0x2c88('0x74')]&&_0x14333c[_0x2c88('0x3c')][_0x2c88('0x74')][_0x2c88('0x4c')]){for(var _0xd7dc5c=0x0;_0xd7dc5c<_0x14333c[_0x2c88('0x3c')]['attachments'][_0x2c88('0x4c')];_0xd7dc5c+=0x1){_0x14333c[_0x2c88('0x3c')][_0x2c88('0x74')][_0xd7dc5c]={'filename':_0x14333c[_0x2c88('0x3c')][_0x2c88('0x74')][_0xd7dc5c]['name'],'path':path[_0x2c88('0x75')](config[_0x2c88('0x76')],_0x2c88('0x77'),_0x14333c['body']['attachments'][_0xd7dc5c][_0x2c88('0x78')])};}}_0x501166={'account':_0x3f41c2,'message':_0x14333c[_0x2c88('0x3c')]};return;}})[_0x2c88('0x36')](function(){if(_0x2a22c9[_0x2c88('0x67')]){if(_0x2a22c9['List']['Contacts'][_0x2c88('0x4c')]){return _0x2a22c9[_0x2c88('0x67')]['Contacts'][0x0];}else{return db[_0x2c88('0x79')][_0x2c88('0x60')](_[_0x2c88('0x18')](_0x14333c['body'],{'firstName':_0x14333c[_0x2c88('0x3c')]['to'],'email':_0x14333c['body']['to'],'phone':_0x14333c['body']['to'],'ListId':_0x2a22c9[_0x2c88('0x7a')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x501166){return respondWithRpcPromise(_0x2c88('0x7b'),'sendMail',_0x501166,client9003)['then'](function(_0x24f636){return _0x3586f6[_0x2c88('0x35')]({'read':!![],'messageId':_0x24f636[_0x2c88('0x7c')],'sentAt':moment()[_0x2c88('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2c88('0x59')](function(_0x2e307a){logger['error']('%s',JSON[_0x2c88('0x24')](_0x2e307a));return _0x3586f6;});}return _0x3586f6;});}return _0x3586f6;}})[_0x2c88('0x36')](respondWithResult(_0x501da9,0xc9))[_0x2c88('0x59')](handleError(_0x501da9,null));};var interaction_log=require('../../config/logger')(_0x2c88('0x7e'));exports[_0x2c88('0x7f')]=function(_0x590868,_0x10fa9a,_0x38e807){var _0x516119={'agent':{},'channel':_0x2c88('0x80')};if(_0x590868['body']['id']){delete _0x590868[_0x2c88('0x3c')]['id'];}_0x590868[_0x2c88('0x3c')]['read']=!![];_0x590868[_0x2c88('0x3c')][_0x2c88('0x81')]=moment()[_0x2c88('0x7d')](_0x2c88('0x82'));_0x590868[_0x2c88('0x3c')][_0x2c88('0x83')]=_0x590868[_0x2c88('0x3c')][_0x2c88('0x83')]||_0x590868[_0x2c88('0x72')]['id'];_0x516119['agent']['id']=_0x590868[_0x2c88('0x3c')][_0x2c88('0x83')];return db[_0x2c88('0x42')][_0x2c88('0x5d')]({'where':{'id':_0x590868[_0x2c88('0x5e')]['id'],'UserId':null},'include':[{'model':db[_0x2c88('0x79')],'as':_0x2c88('0x84')}]})['then'](handleEntityNotFound(_0x10fa9a,null))[_0x2c88('0x36')](saveUpdates(_0x590868[_0x2c88('0x3c')],null))[_0x2c88('0x36')](function(_0x128b99){if(_0x128b99){_0x516119['message']=_0x128b99[_0x2c88('0x85')]({'plain':!![]});return db[_0x2c88('0x86')][_0x2c88('0x5d')]({'where':{'id':_0x128b99[_0x2c88('0x87')]}});}return null;})[_0x2c88('0x36')](handleEntityNotFound(_0x10fa9a,null))[_0x2c88('0x36')](function(_0x51405a){if(_0x51405a){return _0x51405a[_0x2c88('0x35')]({'UserId':_0x590868['body'][_0x2c88('0x83')],'read1stAt':_[_0x2c88('0x6b')](_0x51405a[_0x2c88('0x88')])?moment()[_0x2c88('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2c88('0x36')](function(_0x480a2c){if(_0x480a2c){_0x516119[_0x2c88('0x3f')]=_0x480a2c[_0x2c88('0x85')]({'plain':!![]});interaction_log[_0x2c88('0x28')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x590868[_0x2c88('0x72')]['id'],_0x590868['user']['name'],_0x590868[_0x2c88('0x72')][_0x2c88('0x89')],_0x516119['interaction']['id'],_0x590868['body']?JSON['stringify'](_0x590868[_0x2c88('0x3c')]):_0x2c88('0x8a'));return respondWithRpcPromise(_0x2c88('0x8b'),_0x2c88('0x8c'),_0x516119);}return null;})[_0x2c88('0x36')](function(_0x2f44fe){if(_0x2f44fe){if(_0x590868[_0x2c88('0x3c')][_0x2c88('0x8d')]){_0x516119['message'][_0x2c88('0x8e')]=util[_0x2c88('0x7d')]('SIP/%s',_0x590868[_0x2c88('0x72')][_0x2c88('0x3a')]);_0x516119[_0x2c88('0x27')][_0x2c88('0x8f')]=_0x516119[_0x2c88('0x8f')];_0x516119['message'][_0x2c88('0x90')]=_0x2c88('0x7f');return respondWithRpcPromise(_0x2c88('0x91'),_0x2c88('0x91'),{'event':'acceptmessage','message':_0x516119[_0x2c88('0x27')]},client9002)[_0x2c88('0x36')](function(){return _0x516119;});}return _0x516119;}return null;})[_0x2c88('0x36')](respondWithResult(_0x10fa9a,null))[_0x2c88('0x59')](handleError(_0x10fa9a,null));};var interaction_log=require(_0x2c88('0x92'))(_0x2c88('0x7e'));exports[_0x2c88('0x93')]=function(_0x1b5845,_0x388277,_0x812759){var _0x5c4fb9={'agent':{},'channel':'mail'};if(_0x1b5845[_0x2c88('0x3c')]['id']){delete _0x1b5845[_0x2c88('0x3c')]['id'];}_0x1b5845[_0x2c88('0x3c')][_0x2c88('0x83')]=_0x1b5845['body'][_0x2c88('0x83')]||_0x1b5845['user']['id'];_0x5c4fb9[_0x2c88('0x3e')]['id']=_0x1b5845[_0x2c88('0x3c')][_0x2c88('0x83')];return db[_0x2c88('0x42')]['find']({'where':{'id':_0x1b5845[_0x2c88('0x5e')]['id'],'UserId':null}})[_0x2c88('0x36')](handleEntityNotFound(_0x388277,null))[_0x2c88('0x36')](function(_0x2a6185){if(_0x2a6185){_0x5c4fb9[_0x2c88('0x27')]=_0x2a6185[_0x2c88('0x85')]({'plain':!![]});return db[_0x2c88('0x86')][_0x2c88('0x5d')]({'where':{'id':_0x2a6185[_0x2c88('0x87')]}});}return null;})[_0x2c88('0x36')](handleEntityNotFound(_0x388277,null))[_0x2c88('0x36')](function(_0x1d943d){if(_0x1d943d){_0x5c4fb9[_0x2c88('0x3f')]=_0x1d943d[_0x2c88('0x85')]({'plain':!![]});interaction_log['info'](_0x2c88('0x94'),_0x1b5845[_0x2c88('0x72')]['id'],_0x1b5845[_0x2c88('0x72')][_0x2c88('0x3a')],_0x1b5845['user'][_0x2c88('0x89')],_0x5c4fb9[_0x2c88('0x3f')]['id'],_0x1b5845[_0x2c88('0x3c')]?JSON[_0x2c88('0x24')](_0x1b5845[_0x2c88('0x3c')]):'null');return respondWithRpcPromise('RejectMessage',_0x2c88('0x95'),_0x5c4fb9);}return null;})[_0x2c88('0x36')](function(_0xa7e4e6){if(_0xa7e4e6){_0xa7e4e6[_0x2c88('0x27')]['interface']=util[_0x2c88('0x7d')](_0x2c88('0x96'),_0x1b5845[_0x2c88('0x72')][_0x2c88('0x3a')]);_0xa7e4e6[_0x2c88('0x27')]['channel']=_0x5c4fb9['channel'];_0xa7e4e6['message']['event']='reject';respondWithRpcPromise(_0x2c88('0x91'),_0x2c88('0x91'),{'event':_0x2c88('0x97'),'message':_0xa7e4e6[_0x2c88('0x27')]},client9002);return _0x5c4fb9;}return null;})[_0x2c88('0x36')](respondWithResult(_0x388277,null))[_0x2c88('0x59')](handleError(_0x388277,null));};exports[_0x2c88('0x98')]=function(_0x4ed7eb,_0xd1f1db){var _0x204743=moment()['unix']()[_0x2c88('0x99')]();var _0x2fd842=path[_0x2c88('0x75')](config['root'],_0x2c88('0x9a'),_0x2c88('0x9b'),'tmp');var _0x2821db=path[_0x2c88('0x75')](config['root'],'server',_0x2c88('0x9b'),_0x2c88('0x74'));var _0x43584b=util[_0x2c88('0x7d')](_0x2c88('0x9c'),_0x204743);return db[_0x2c88('0x42')][_0x2c88('0x5d')]({'where':{'id':_0x4ed7eb[_0x2c88('0x5e')]['id']},'attributes':['id',_0x2c88('0x3c'),_0x2c88('0x9d'),'to','cc',_0x2c88('0x9e'),_0x2c88('0x9f'),_0x2c88('0xa0')],'include':_0x4ed7eb[_0x2c88('0x46')][_0x2c88('0x74')]?[{'model':db[_0x2c88('0xa1')],'as':_0x2c88('0xa2')}]:undefined})[_0x2c88('0x36')](handleEntityNotFound(_0xd1f1db,null))[_0x2c88('0x36')](function(_0x44b365){if(_0x44b365){var _0x290047=_0x44b365;var _0x126d1c={'from':_0x290047[_0x2c88('0x9d')],'to':_0x290047['to'],'subject':_0x290047[_0x2c88('0x9f')],'html':_0x290047['body'],'headers':{'Date':moment(_0x290047['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x44b365['cc']){_0x126d1c[_0x2c88('0xa3')]['Cc']=_0x44b365['cc'];}if(_0x44b365[_0x2c88('0x9e')]){_0x126d1c[_0x2c88('0xa3')]['Bcc']=_0x44b365[_0x2c88('0x9e')];}return new BPromise(function(_0x288551,_0x12e085){if(_0x44b365[_0x2c88('0xa2')]){for(var _0x5bc82f=0x0;_0x5bc82f<_0x44b365[_0x2c88('0xa2')][_0x2c88('0x4c')];_0x5bc82f++){var _0x5937c6=_0x44b365[_0x2c88('0xa2')][_0x5bc82f];var _0x440da8=path[_0x2c88('0x75')](_0x2821db,_0x5937c6[_0x2c88('0x78')]);if(fs[_0x2c88('0xa4')](_0x440da8)){_0x126d1c[_0x2c88('0x74')][_0x2c88('0xa5')]({'name':_0x5937c6[_0x2c88('0x3a')],'contentType':_0x5937c6['type'],'data':fs[_0x2c88('0xa6')](_0x440da8)});}}}emlformat[_0x2c88('0xa7')](_0x126d1c,function(_0x39de5b,_0x1118f6){if(_0x39de5b)return _0x12e085(_0x39de5b);fs[_0x2c88('0xa8')](path[_0x2c88('0x75')](_0x2fd842,_0x43584b),_0x1118f6);return _0x288551(_0x1118f6);});});}})[_0x2c88('0x36')](function(_0x5c3220){if(_0x5c3220){return _0xd1f1db['download'](path['join'](_0x2fd842,_0x43584b),_0x43584b,function(_0x18c51f){if(_0x18c51f){console[_0x2c88('0xa9')](_0x2c88('0xaa'),_0x18c51f);}else{fs[_0x2c88('0xab')](path[_0x2c88('0x75')](_0x2fd842,_0x43584b));}});}})[_0x2c88('0x59')](handleError(_0xd1f1db,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 67bc62a..0d9fe4b 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 _0x5bf0=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x5bf0,0x107));var _0x05bf=function(_0xc74dad,_0x2a7676){_0xc74dad=_0xc74dad-0x0;var _0x535eb7=_0x5bf0[_0xc74dad];return _0x535eb7;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x05bf('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x05bf('0x1')](0x0);var events={'afterCreate':_0x05bf('0x2'),'afterUpdate':_0x05bf('0x3'),'afterDestroy':_0x05bf('0x4')};function emitEvent(_0x63ccb2){return function(_0x9dc2bd,_0x47b3fa,_0x1b227f){MailMessageEvents[_0x05bf('0x5')](_0x63ccb2+':'+_0x9dc2bd['id'],_0x9dc2bd);MailMessageEvents[_0x05bf('0x5')](_0x63ccb2,_0x9dc2bd);_0x1b227f(null);};}for(var e in events){if(events[_0x05bf('0x6')](e)){var event=events[e];MailMessage[_0x05bf('0x7')](e,emitEvent(event));}}module[_0x05bf('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x2eed=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2eed,0x9f));var _0xd2ee=function(_0x4ac94f,_0x5197f0){_0x4ac94f=_0x4ac94f-0x0;var _0x2620d9=_0x2eed[_0x4ac94f];return _0x2620d9;};'use strict';var EventEmitter=require(_0xd2ee('0x0'));var MailMessage=require(_0xd2ee('0x1'))['db'][_0xd2ee('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd2ee('0x3')](0x0);var events={'afterCreate':_0xd2ee('0x4'),'afterUpdate':_0xd2ee('0x5'),'afterDestroy':_0xd2ee('0x6')};function emitEvent(_0x1610cf){return function(_0x2ff867,_0x155e4,_0x2369a4){MailMessageEvents[_0xd2ee('0x7')](_0x1610cf+':'+_0x2ff867['id'],_0x2ff867);MailMessageEvents['emit'](_0x1610cf,_0x2ff867);_0x2369a4(null);};}for(var e in events){if(events[_0xd2ee('0x8')](e)){var event=events[e];MailMessage[_0xd2ee('0x9')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index edbf744..d103a9b 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 _0x94bf=['MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','messageId','fti_mail_messages','subject','FULLTEXT','plainBody','fromString','body','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94bf,0x1c2));var _0xf94b=function(_0x204183,_0x358f9d){_0x204183=_0x204183-0x0;var _0x435940=_0x94bf[_0x204183];return _0x435940;};'use strict';var _=require('lodash');var util=require(_0xf94b('0x0'));var logger=require('../../config/logger')(_0xf94b('0x1'));var moment=require(_0xf94b('0x2'));var BPromise=require(_0xf94b('0x3'));var rp=require(_0xf94b('0x4'));var htmlToText=require(_0xf94b('0x5'));var fs=require('fs');var path=require(_0xf94b('0x6'));var rimraf=require(_0xf94b('0x7'));var config=require(_0xf94b('0x8'));var attributes=require(_0xf94b('0x9'));module['exports']=function(_0x26390b,_0x9a8ae7){return _0x26390b[_0xf94b('0xa')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xf94b('0xb'),'fields':[_0xf94b('0xb')]},{'name':_0xf94b('0xc'),'fields':['plainBody',_0xf94b('0xd')],'type':_0xf94b('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x218373,_0x2e4e59,_0x3aa7d3){if(_0x218373['body']){_0x218373[_0xf94b('0xf')]=htmlToText[_0xf94b('0x10')](_0x218373[_0xf94b('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3aa7d3(null,_0x2e4e59);},'afterCreate':function(_0x483099,_0x15f3c6,_0x4572dc){var _0x80b4d1=_0x26390b[_0xf94b('0x12')];var _0x10fd2c=_0x483099[_0xf94b('0x13')]({'plain':!![]});if(_0x10fd2c[_0xf94b('0x14')]['toLowerCase']()==='in'||_0x10fd2c[_0xf94b('0x14')][_0xf94b('0x15')]()===_0xf94b('0x16')&&!_0x10fd2c[_0xf94b('0x17')]&&!_[_0xf94b('0x18')](_0x10fd2c[_0xf94b('0x19')])){_0x80b4d1[_0xf94b('0x1a')][_0xf94b('0x1b')]({'where':{'id':_0x10fd2c[_0xf94b('0x1c')]}})[_0xf94b('0x1d')](function(_0xe5a61b){if(_0xe5a61b){_0xe5a61b['update']({'lastMsgAt':_0x10fd2c[_0xf94b('0x1e')],'lastMsgDirection':_0x10fd2c['direction'][_0xf94b('0x15')]()});}})['catch'](function(_0x340097){console[_0xf94b('0x1f')](_0x340097);});}_0x4572dc();}},'charset':_0xf94b('0x20'),'collate':_0xf94b('0x21')});}; \ No newline at end of file +var _0x5e2c=['MailInteractionId','then','update','createdAt','error','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./mailMessage.attributes','define','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne'];(function(_0x3114bc,_0x3f9505){var _0x4c2245=function(_0x3ec3c7){while(--_0x3ec3c7){_0x3114bc['push'](_0x3114bc['shift']());}};_0x4c2245(++_0x3f9505);}(_0x5e2c,0x18d));var _0xc5e2=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0x5e2c[_0xc0d9bc];return _0x32ff73;};'use strict';var _=require(_0xc5e2('0x0'));var util=require(_0xc5e2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc5e2('0x2'));var BPromise=require(_0xc5e2('0x3'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xc5e2('0x4'));var rimraf=require(_0xc5e2('0x5'));var config=require(_0xc5e2('0x6'));var attributes=require(_0xc5e2('0x7'));module['exports']=function(_0x5a9663,_0x619443){return _0x5a9663[_0xc5e2('0x8')]('MailMessage',attributes,{'tableName':_0xc5e2('0x9'),'paranoid':![],'indexes':[{'name':_0xc5e2('0xa'),'fields':[_0xc5e2('0xa')]},{'name':_0xc5e2('0xb'),'fields':['plainBody','subject'],'type':_0xc5e2('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x9d0a43,_0x2d6ee5,_0x1bc7db){if(_0x9d0a43[_0xc5e2('0xd')]){_0x9d0a43[_0xc5e2('0xe')]=htmlToText['fromString'](_0x9d0a43[_0xc5e2('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1bc7db(null,_0x2d6ee5);},'afterCreate':function(_0x3a7bd6,_0x843458,_0x399c04){var _0x15aae9=_0x5a9663['models'];var _0x445089=_0x3a7bd6[_0xc5e2('0xf')]({'plain':!![]});if(_0x445089['direction']['toLowerCase']()==='in'||_0x445089[_0xc5e2('0x10')][_0xc5e2('0x11')]()==='out'&&!_0x445089[_0xc5e2('0x12')]&&!_[_0xc5e2('0x13')](_0x445089[_0xc5e2('0x14')])){_0x15aae9[_0xc5e2('0x15')][_0xc5e2('0x16')]({'where':{'id':_0x445089[_0xc5e2('0x17')]}})[_0xc5e2('0x18')](function(_0x307080){if(_0x307080){_0x307080[_0xc5e2('0x19')]({'lastMsgAt':_0x445089[_0xc5e2('0x1a')],'lastMsgDirection':_0x445089['direction'][_0xc5e2('0x11')]()});}})['catch'](function(_0x5857f2){console[_0xc5e2('0x1b')](_0x5857f2);});}_0x399c04();}},'charset':'utf8mb4','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 a14613a..02f36fa 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 _0xb335=['http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x3315e4,_0x4d50c5){var _0x5d5f34=function(_0x2aa8ba){while(--_0x2aa8ba){_0x3315e4['push'](_0x3315e4['shift']());}};_0x5d5f34(++_0x4d50c5);}(_0xb335,0x16d));var _0x5b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb335[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5b33('0x0'));var util=require(_0x5b33('0x1'));var moment=require('moment');var BPromise=require(_0x5b33('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b33('0x3'));var db=require(_0x5b33('0x4'))['db'];var utils=require(_0x5b33('0x5'));var logger=require(_0x5b33('0x6'))('rpc');var config=require(_0x5b33('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b33('0x8')][_0x5b33('0x9')]({'port':0x232a});config['redis']=_[_0x5b33('0xa')](config[_0x5b33('0xb')],{'host':_0x5b33('0xc'),'port':0x18eb});var socket=require(_0x5b33('0xd'))(new Redis(config[_0x5b33('0xb')]));require(_0x5b33('0xe'))[_0x5b33('0xf')](socket);function respondWithRpcPromise(_0x3cabcd,_0x2a638c,_0x4e6aff){return new BPromise(function(_0x33d537,_0x3e6a4c){return client[_0x5b33('0x10')](_0x3cabcd,_0x4e6aff)[_0x5b33('0x11')](function(_0x5a906e){logger[_0x5b33('0x12')](_0x5b33('0x13'),_0x2a638c,'request\x20sent');logger[_0x5b33('0x14')](_0x5b33('0x15'),_0x2a638c,'request\x20sent',JSON[_0x5b33('0x16')](_0x5a906e));if(_0x5a906e[_0x5b33('0x17')]){if(_0x5a906e[_0x5b33('0x17')][_0x5b33('0x18')]===0x1f4){logger[_0x5b33('0x17')](_0x5b33('0x13'),_0x2a638c,_0x5a906e[_0x5b33('0x17')][_0x5b33('0x19')]);return _0x3e6a4c(_0x5a906e[_0x5b33('0x17')][_0x5b33('0x19')]);}logger[_0x5b33('0x17')](_0x5b33('0x13'),_0x2a638c,_0x5a906e[_0x5b33('0x17')][_0x5b33('0x19')]);return _0x33d537(_0x5a906e[_0x5b33('0x17')]['message']);}else{logger[_0x5b33('0x12')](_0x5b33('0x13'),_0x2a638c,_0x5b33('0x1a'));_0x33d537(_0x5a906e[_0x5b33('0x1b')][_0x5b33('0x19')]);}})[_0x5b33('0x1c')](function(_0x47d223){logger['error'](_0x5b33('0x13'),_0x2a638c,_0x47d223);_0x3e6a4c(_0x47d223);});});}exports[_0x5b33('0x1d')]=function(_0x42747d){var _0x2dfb5b=this;return new Promise(function(_0x2ce022,_0x35d809){return db[_0x5b33('0x1e')][_0x5b33('0x1f')](_0x42747d[_0x5b33('0x20')],{'raw':_0x42747d[_0x5b33('0x21')]?_0x42747d[_0x5b33('0x21')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x504885){logger[_0x5b33('0x12')](_0x5b33('0x1d'),_0x42747d);logger['debug']('CreateMailMessage',_0x42747d,JSON[_0x5b33('0x16')](_0x504885));_0x2ce022(_0x504885);})[_0x5b33('0x1c')](function(_0x22db14){logger['error']('CreateMailMessage',_0x22db14[_0x5b33('0x19')],_0x42747d);_0x35d809(_0x2dfb5b['error'](0x1f4,_0x22db14[_0x5b33('0x19')]));});});}; \ No newline at end of file +var _0x194c=['info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then'];(function(_0x6bbb39,_0x5a6ef9){var _0x2ead1a=function(_0x503285){while(--_0x503285){_0x6bbb39['push'](_0x6bbb39['shift']());}};_0x2ead1a(++_0x5a6ef9);}(_0x194c,0x19b));var _0xc194=function(_0x5d479a,_0x31efb7){_0x5d479a=_0x5d479a-0x0;var _0x3038e7=_0x194c[_0x5d479a];return _0x3038e7;};'use strict';var _=require(_0xc194('0x0'));var util=require(_0xc194('0x1'));var moment=require(_0xc194('0x2'));var BPromise=require(_0xc194('0x3'));var rs=require(_0xc194('0x4'));var fs=require('fs');var Redis=require(_0xc194('0x5'));var db=require(_0xc194('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc194('0x7'))(_0xc194('0x8'));var config=require(_0xc194('0x9'));var jayson=require(_0xc194('0xa'));var client=jayson[_0xc194('0xb')][_0xc194('0xc')]({'port':0x232a});config[_0xc194('0xd')]=_[_0xc194('0xe')](config[_0xc194('0xd')],{'host':_0xc194('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc194('0xd')]));require('./mailMessage.socket')[_0xc194('0x10')](socket);function respondWithRpcPromise(_0xe7c255,_0x7a75b9,_0x5bdc73){return new BPromise(function(_0x3f547c,_0x5608d8){return client['request'](_0xe7c255,_0x5bdc73)[_0xc194('0x11')](function(_0x1e5a93){logger[_0xc194('0x12')]('MailMessage,\x20%s,\x20%s',_0x7a75b9,_0xc194('0x13'));logger[_0xc194('0x14')](_0xc194('0x15'),_0x7a75b9,_0xc194('0x13'),JSON['stringify'](_0x1e5a93));if(_0x1e5a93[_0xc194('0x16')]){if(_0x1e5a93['error'][_0xc194('0x17')]===0x1f4){logger[_0xc194('0x16')](_0xc194('0x18'),_0x7a75b9,_0x1e5a93['error'][_0xc194('0x19')]);return _0x5608d8(_0x1e5a93[_0xc194('0x16')]['message']);}logger[_0xc194('0x16')](_0xc194('0x18'),_0x7a75b9,_0x1e5a93[_0xc194('0x16')]['message']);return _0x3f547c(_0x1e5a93[_0xc194('0x16')][_0xc194('0x19')]);}else{logger[_0xc194('0x12')](_0xc194('0x18'),_0x7a75b9,_0xc194('0x13'));_0x3f547c(_0x1e5a93[_0xc194('0x1a')]['message']);}})[_0xc194('0x1b')](function(_0x4b2b6d){logger[_0xc194('0x16')](_0xc194('0x18'),_0x7a75b9,_0x4b2b6d);_0x5608d8(_0x4b2b6d);});});}exports[_0xc194('0x1c')]=function(_0xc42ba1){var _0x392501=this;return new Promise(function(_0x47547e,_0xea3fbc){return db[_0xc194('0x1d')][_0xc194('0x1e')](_0xc42ba1['body'],{'raw':_0xc42ba1[_0xc194('0x1f')]?_0xc42ba1[_0xc194('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xc194('0x11')](function(_0x1b9f3b){logger[_0xc194('0x12')](_0xc194('0x1c'),_0xc42ba1);logger['debug'](_0xc194('0x1c'),_0xc42ba1,JSON[_0xc194('0x20')](_0x1b9f3b));_0x47547e(_0x1b9f3b);})[_0xc194('0x1b')](function(_0x1a57ef){logger[_0xc194('0x16')]('CreateMailMessage',_0x1a57ef['message'],_0xc42ba1);_0xea3fbc(_0x392501[_0xc194('0x16')](0x1f4,_0x1a57ef[_0xc194('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 33b3ba0..4a34661 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 _0x12fd=['register','length','mailMessage:','save','update','emit'];(function(_0x4f272d,_0x5eb6a9){var _0x55ddb7=function(_0x2f0fad){while(--_0x2f0fad){_0x4f272d['push'](_0x4f272d['shift']());}};_0x55ddb7(++_0x5eb6a9);}(_0x12fd,0x15f));var _0xd12f=function(_0xbec8c6,_0x127f38){_0xbec8c6=_0xbec8c6-0x0;var _0x23a4e1=_0x12fd[_0xbec8c6];return _0x23a4e1;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xd12f('0x0'),'remove',_0xd12f('0x1')];function createListener(_0x3b9c32,_0x3ee529){return function(_0x1ade14){_0x3ee529[_0xd12f('0x2')](_0x3b9c32,_0x1ade14);};}function removeListener(_0x1a2a5b,_0x38cb45){return function(){MailMessageEvents['removeListener'](_0x1a2a5b,_0x38cb45);};}exports[_0xd12f('0x3')]=function(_0x3b03fb){for(var _0x453e00=0x0,_0x5c860a=events[_0xd12f('0x4')];_0x453e00<_0x5c860a;_0x453e00++){var _0x3ab83c=events[_0x453e00];var _0x1c73b2=createListener(_0xd12f('0x5')+_0x3ab83c,_0x3b03fb);MailMessageEvents['on'](_0x3ab83c,_0x1c73b2);}}; \ No newline at end of file +var _0xc55d=['mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x5bad8f,_0x3a51ef){var _0x2f643a=function(_0x23e4ed){while(--_0x23e4ed){_0x5bad8f['push'](_0x5bad8f['shift']());}};_0x2f643a(++_0x3a51ef);}(_0xc55d,0x1d9));var _0xdc55=function(_0x4689e5,_0x32f1cb){_0x4689e5=_0x4689e5-0x0;var _0x497b0b=_0xc55d[_0x4689e5];return _0x497b0b;};'use strict';var MailMessageEvents=require(_0xdc55('0x0'));var events=[_0xdc55('0x1'),_0xdc55('0x2'),_0xdc55('0x3')];function createListener(_0x596855,_0x14d966){return function(_0x492b44){_0x14d966[_0xdc55('0x4')](_0x596855,_0x492b44);};}function removeListener(_0x2bd660,_0x270450){return function(){MailMessageEvents[_0xdc55('0x5')](_0x2bd660,_0x270450);};}exports[_0xdc55('0x6')]=function(_0x29809d){for(var _0x19df86=0x0,_0x456903=events['length'];_0x19df86<_0x456903;_0x19df86++){var _0x42c02a=events[_0x19df86];var _0x27c1c8=createListener(_0xdc55('0x7')+_0x42c02a,_0x29809d);MailMessageEvents['on'](_0x42c02a,_0x27c1c8);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e382ebb..b018455 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 _0x52cb=['./mailQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getTeams','getAgents','create','/:id/teams','addTeams','post','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x3c1670,_0x448f80){var _0x37c9ad=function(_0x3c7f92){while(--_0x3c7f92){_0x3c1670['push'](_0x3c1670['shift']());}};_0x37c9ad(++_0x448f80);}(_0x52cb,0xae));var _0xb52c=function(_0x4a361f,_0x96165d){_0x4a361f=_0x4a361f-0x0;var _0x15e6d7=_0x52cb[_0x4a361f];return _0x15e6d7;};'use strict';var multer=require(_0xb52c('0x0'));var util=require(_0xb52c('0x1'));var path=require(_0xb52c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb52c('0x3')]();var fs_extra=require(_0xb52c('0x4'));var auth=require(_0xb52c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb52c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb52c('0x7')]);router[_0xb52c('0x8')](_0xb52c('0x9'),auth[_0xb52c('0xa')](),controller[_0xb52c('0xb')]);router[_0xb52c('0x8')](_0xb52c('0xc'),auth['isAuthenticated'](),controller[_0xb52c('0xd')]);router[_0xb52c('0x8')](_0xb52c('0xe'),auth[_0xb52c('0xa')](),controller['getMembers']);router[_0xb52c('0x8')]('/:id/teams',auth[_0xb52c('0xa')](),controller[_0xb52c('0xf')]);router[_0xb52c('0x8')]('/:id/users',auth[_0xb52c('0xa')](),controller[_0xb52c('0x10')]);router['post']('/',auth[_0xb52c('0xa')](),controller[_0xb52c('0x11')]);router['post'](_0xb52c('0x12'),auth[_0xb52c('0xa')](),controller[_0xb52c('0x13')]);router[_0xb52c('0x14')](_0xb52c('0x15'),auth[_0xb52c('0xa')](),controller[_0xb52c('0x16')]);router[_0xb52c('0x17')](_0xb52c('0xc'),auth[_0xb52c('0xa')](),controller[_0xb52c('0x18')]);router[_0xb52c('0x19')](_0xb52c('0xc'),auth[_0xb52c('0xa')](),controller[_0xb52c('0x1a')]);router[_0xb52c('0x19')](_0xb52c('0x12'),auth[_0xb52c('0xa')](),controller[_0xb52c('0x1b')]);router['delete'](_0xb52c('0x15'),auth[_0xb52c('0xa')](),controller[_0xb52c('0x1c')]);module[_0xb52c('0x1d')]=router; \ No newline at end of file +var _0x103e=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','update','delete','removeTeams','removeAgents','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x45c61f,_0x3537d0){var _0xce8339=function(_0x54071d){while(--_0x54071d){_0x45c61f['push'](_0x45c61f['shift']());}};_0xce8339(++_0x3537d0);}(_0x103e,0x6b));var _0xe103=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x103e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xe103('0x0'));var path=require('path');var timeout=require(_0xe103('0x1'));var express=require('express');var router=express[_0xe103('0x2')]();var fs_extra=require(_0xe103('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe103('0x4'));var config=require(_0xe103('0x5'));var controller=require(_0xe103('0x6'));router[_0xe103('0x7')]('/',auth[_0xe103('0x8')](),controller[_0xe103('0x9')]);router[_0xe103('0x7')](_0xe103('0xa'),auth[_0xe103('0x8')](),controller[_0xe103('0xb')]);router['get'](_0xe103('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe103('0xd'),auth[_0xe103('0x8')](),controller[_0xe103('0xe')]);router['get'](_0xe103('0xf'),auth[_0xe103('0x8')](),controller[_0xe103('0x10')]);router[_0xe103('0x7')](_0xe103('0x11'),auth[_0xe103('0x8')](),controller[_0xe103('0x12')]);router[_0xe103('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe103('0x13')](_0xe103('0xf'),auth[_0xe103('0x8')](),controller['addTeams']);router[_0xe103('0x13')](_0xe103('0x11'),auth[_0xe103('0x8')](),controller['addAgents']);router['put'](_0xe103('0xc'),auth[_0xe103('0x8')](),controller[_0xe103('0x14')]);router[_0xe103('0x15')](_0xe103('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0xe103('0x15')]('/:id/teams',auth[_0xe103('0x8')](),controller[_0xe103('0x16')]);router[_0xe103('0x15')](_0xe103('0x11'),auth[_0xe103('0x8')](),controller[_0xe103('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index a94b6a2..705e64d 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 _0xa99b=['roundrobin','sequelize','STRING','INTEGER','rrmemory','beepall'];(function(_0x3126f8,_0x3f5af9){var _0x33b810=function(_0x34c6e2){while(--_0x34c6e2){_0x3126f8['push'](_0x3126f8['shift']());}};_0x33b810(++_0x3f5af9);}(_0xa99b,0x1f3));var _0xba99=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa99b[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0xba99('0x0'));module['exports']={'name':{'type':Sequelize[_0xba99('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xba99('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xba99('0x3'),_0xba99('0x4'),_0xba99('0x5'))}}; \ No newline at end of file +var _0xf987=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x3e73f1,_0x1022a6){var _0x364d8f=function(_0x5d9189){while(--_0x5d9189){_0x3e73f1['push'](_0x3e73f1['shift']());}};_0x364d8f(++_0x1022a6);}(_0xf987,0x1cc));var _0x7f98=function(_0xc1de47,_0x2a18d3){_0xc1de47=_0xc1de47-0x0;var _0x282c73=_0xf987[_0xc1de47];return _0x282c73;};'use strict';var Sequelize=require(_0x7f98('0x0'));module[_0x7f98('0x1')]={'name':{'type':Sequelize[_0x7f98('0x2')],'unique':_0x7f98('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7f98('0x2')]},'timeout':{'type':Sequelize[_0x7f98('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7f98('0x5')](_0x7f98('0x6'),'beepall',_0x7f98('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 3a44422..c88a08a 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 _0x7f2b=['value','transaction','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','MailQueues','UserProfileResource','error','name','render','merge','contact','message','agent','account','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','MailQueue','catch','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','order','MailQueueId','UserMailQueue','findAll','User','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','ids','Agents','online','sequelize','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact'];(function(_0x45ed90,_0x111e0b){var _0x47a846=function(_0x1c7aaa){while(--_0x1c7aaa){_0x45ed90['push'](_0x45ed90['shift']());}};_0x47a846(++_0x111e0b);}(_0x7f2b,0x11d));var _0xb7f2=function(_0x325856,_0x5e0fcc){_0x325856=_0x325856-0x0;var _0x17e262=_0x7f2b[_0x325856];return _0x17e262;};'use strict';var emlformat=require(_0xb7f2('0x0'));var rimraf=require(_0xb7f2('0x1'));var zipdir=require(_0xb7f2('0x2'));var jsonpatch=require(_0xb7f2('0x3'));var rp=require(_0xb7f2('0x4'));var moment=require(_0xb7f2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb7f2('0x6'));var util=require('util');var path=require(_0xb7f2('0x7'));var sox=require(_0xb7f2('0x8'));var csv=require(_0xb7f2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7f2('0xa'));var _=require(_0xb7f2('0xb'));var squel=require(_0xb7f2('0xc'));var crypto=require(_0xb7f2('0xd'));var jsforce=require(_0xb7f2('0xe'));var deskjs=require(_0xb7f2('0xf'));var toCsv=require(_0xb7f2('0x9'));var querystring=require('querystring');var Papa=require(_0xb7f2('0x10'));var Redis=require(_0xb7f2('0x11'));var authService=require(_0xb7f2('0x12'));var qs=require(_0xb7f2('0x13'));var as=require(_0xb7f2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7f2('0x15'))(_0xb7f2('0x16'));var utils=require('../../config/utils');var config=require(_0xb7f2('0x17'));var licenseUtil=require(_0xb7f2('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb7f2('0x19')](config[_0xb7f2('0x1a')],{'host':_0xb7f2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb7f2('0x1a')]));require(_0xb7f2('0x1c'))['register'](socket);function respondWithStatusCode(_0x4af5f2,_0x28d421){_0x28d421=_0x28d421||0xcc;return function(_0x10a377){if(_0x10a377){return _0x4af5f2[_0xb7f2('0x1d')](_0x28d421);}return _0x4af5f2[_0xb7f2('0x1e')](_0x28d421)[_0xb7f2('0x1f')]();};}function respondWithResult(_0xcca430,_0x9ccb9b){_0x9ccb9b=_0x9ccb9b||0xc8;return function(_0x250e49){if(_0x250e49){return _0xcca430[_0xb7f2('0x1e')](_0x9ccb9b)[_0xb7f2('0x20')](_0x250e49);}};}function respondWithFilteredResult(_0x35214f,_0x4625f4){return function(_0x171039){if(_0x171039){var _0xc3590e=typeof _0x4625f4[_0xb7f2('0x21')]===_0xb7f2('0x22')&&typeof _0x4625f4[_0xb7f2('0x23')]===_0xb7f2('0x22');var _0x467b7e=_0x171039[_0xb7f2('0x24')];var _0x344dce=_0xc3590e?0x0:_0x4625f4[_0xb7f2('0x21')];var _0x55b776=_0xc3590e?_0x171039[_0xb7f2('0x24')]:_0x4625f4['offset']+_0x4625f4['limit'];var _0x14cb8f;if(_0x55b776>=_0x467b7e){_0x55b776=_0x467b7e;_0x14cb8f=0xc8;}else{_0x14cb8f=0xce;}_0x35214f[_0xb7f2('0x1e')](_0x14cb8f);return _0x35214f[_0xb7f2('0x25')](_0xb7f2('0x26'),_0x344dce+'-'+_0x55b776+'/'+_0x467b7e)[_0xb7f2('0x20')](_0x171039);}return null;};}function patchUpdates(_0x169f41){return function(_0x638508){try{jsonpatch[_0xb7f2('0x27')](_0x638508,_0x169f41,!![]);}catch(_0x213074){return BPromise['reject'](_0x213074);}return _0x638508[_0xb7f2('0x28')]();};}function saveUpdates(_0x3ef4d3,_0x8a5e93){return function(_0x4af04d){if(_0x4af04d){return _0x4af04d['update'](_0x3ef4d3)[_0xb7f2('0x29')](function(_0x5e5296){return _0x5e5296;});}return null;};}function removeEntity(_0x36fed0,_0x7fe04b){return function(_0x3021de){if(_0x3021de){return _0x3021de[_0xb7f2('0x2a')]()[_0xb7f2('0x29')](function(){var _0x3b5cde=_0x3021de['get']({'plain':!![]});var _0x121118=_0xb7f2('0x2b');return db[_0xb7f2('0x2c')][_0xb7f2('0x2a')]({'where':{'type':_0x121118,'resourceId':_0x3b5cde['id']}})[_0xb7f2('0x29')](function(){return _0x3021de;});})['then'](function(){_0x36fed0[_0xb7f2('0x1e')](0xcc)[_0xb7f2('0x1f')]();});}};}function handleEntityNotFound(_0x5eb63c,_0x173367){return function(_0x6e6654){if(!_0x6e6654){_0x5eb63c[_0xb7f2('0x1d')](0x194);}return _0x6e6654;};}function handleError(_0x56eeb2,_0x5f22dd){_0x5f22dd=_0x5f22dd||0x1f4;return function(_0x4b12bb){logger[_0xb7f2('0x2d')](_0x4b12bb['stack']);if(_0x4b12bb[_0xb7f2('0x2e')]){delete _0x4b12bb[_0xb7f2('0x2e')];}_0x56eeb2[_0xb7f2('0x1e')](_0x5f22dd)['send'](_0x4b12bb);};}function getMustacheRender(_0x3b6a54,_0x4df33f){return Mustache[_0xb7f2('0x2f')](_0x3b6a54,_[_0xb7f2('0x30')](_0x4df33f['body'],{'contact':_0x4df33f[_0xb7f2('0x31')],'message':_0x4df33f[_0xb7f2('0x32')],'agent':_0x4df33f[_0xb7f2('0x33')],'interaction':_0x4df33f['interaction'],'account':_0x4df33f[_0xb7f2('0x34')]}))||'';}exports[_0xb7f2('0x35')]=function(_0x216c64,_0x1502f2){var _0x181acb={},_0x271dea={},_0xb0b708={'count':0x0,'rows':[]};var _0x356628=_[_0xb7f2('0x36')](db['MailQueue'][_0xb7f2('0x37')],function(_0x33a301){return{'name':_0x33a301[_0xb7f2('0x38')],'type':_0x33a301[_0xb7f2('0x39')][_0xb7f2('0x3a')]};});_0x271dea[_0xb7f2('0x3b')]=_['map'](_0x356628,_0xb7f2('0x2e'));_0x271dea[_0xb7f2('0x3c')]=_[_0xb7f2('0x3d')](_0x216c64[_0xb7f2('0x3c')]);_0x271dea[_0xb7f2('0x3e')]=_['intersection'](_0x271dea['model'],_0x271dea[_0xb7f2('0x3c')]);_0x181acb[_0xb7f2('0x3f')]=_[_0xb7f2('0x40')](_0x271dea[_0xb7f2('0x3b')],qs[_0xb7f2('0x41')](_0x216c64[_0xb7f2('0x3c')][_0xb7f2('0x41')]));_0x181acb['attributes']=_0x181acb[_0xb7f2('0x3f')]['length']?_0x181acb[_0xb7f2('0x3f')]:_0x271dea['model'];if(!_0x216c64[_0xb7f2('0x3c')][_0xb7f2('0x42')](_0xb7f2('0x43'))){_0x181acb[_0xb7f2('0x23')]=qs['limit'](_0x216c64['query']['limit']);_0x181acb[_0xb7f2('0x21')]=qs[_0xb7f2('0x21')](_0x216c64[_0xb7f2('0x3c')][_0xb7f2('0x21')]);}_0x181acb['order']=qs[_0xb7f2('0x44')](_0x216c64['query'][_0xb7f2('0x44')]);_0x181acb[_0xb7f2('0x45')]=qs['filters'](_[_0xb7f2('0x46')](_0x216c64[_0xb7f2('0x3c')],_0x271dea['filters']),_0x356628);if(_0x216c64[_0xb7f2('0x3c')][_0xb7f2('0x47')]){_0x181acb[_0xb7f2('0x45')]=_['merge'](_0x181acb[_0xb7f2('0x45')],{'$or':_[_0xb7f2('0x36')](_0x356628,function(_0x383b09){if(_0x383b09[_0xb7f2('0x39')]!=='VIRTUAL'){var _0xeebf12={};_0xeebf12[_0x383b09[_0xb7f2('0x2e')]]={'$like':'%'+_0x216c64[_0xb7f2('0x3c')][_0xb7f2('0x47')]+'%'};return _0xeebf12;}})});}_0x181acb=_['merge']({},_0x181acb,_0x216c64[_0xb7f2('0x48')]);var _0x33e363={'where':_0x181acb['where']};return db['MailQueue'][_0xb7f2('0x24')](_0x33e363)[_0xb7f2('0x29')](function(_0x455234){_0xb0b708[_0xb7f2('0x24')]=_0x455234;if(_0x216c64[_0xb7f2('0x3c')][_0xb7f2('0x49')]){_0x181acb[_0xb7f2('0x4a')]=[{'all':!![]}];}return db[_0xb7f2('0x4b')]['findAll'](_0x181acb);})['then'](function(_0x264448){_0xb0b708['rows']=_0x264448;return _0xb0b708;})[_0xb7f2('0x29')](respondWithFilteredResult(_0x1502f2,_0x181acb))[_0xb7f2('0x4c')](handleError(_0x1502f2,null));};exports['show']=function(_0x4c9662,_0x38f4fa){var _0x5dbce3={'raw':!![],'where':{'id':_0x4c9662[_0xb7f2('0x4d')]['id']}},_0x191291={};_0x191291[_0xb7f2('0x3b')]=_[_0xb7f2('0x3d')](db[_0xb7f2('0x4b')]['rawAttributes']);_0x191291[_0xb7f2('0x3c')]=_[_0xb7f2('0x3d')](_0x4c9662[_0xb7f2('0x3c')]);_0x191291[_0xb7f2('0x3e')]=_[_0xb7f2('0x40')](_0x191291['model'],_0x191291['query']);_0x5dbce3[_0xb7f2('0x3f')]=_[_0xb7f2('0x40')](_0x191291['model'],qs['fields'](_0x4c9662[_0xb7f2('0x3c')][_0xb7f2('0x41')]));_0x5dbce3[_0xb7f2('0x3f')]=_0x5dbce3[_0xb7f2('0x3f')][_0xb7f2('0x4e')]?_0x5dbce3['attributes']:_0x191291[_0xb7f2('0x3b')];if(_0x4c9662[_0xb7f2('0x3c')][_0xb7f2('0x49')]){_0x5dbce3['include']=[{'all':!![]}];}_0x5dbce3=_[_0xb7f2('0x30')]({},_0x5dbce3,_0x4c9662[_0xb7f2('0x48')]);return db['MailQueue']['find'](_0x5dbce3)[_0xb7f2('0x29')](handleEntityNotFound(_0x38f4fa,null))['then'](respondWithResult(_0x38f4fa,null))[_0xb7f2('0x4c')](handleError(_0x38f4fa,null));};exports['create']=function(_0x41d2f0,_0x3dacba){return db[_0xb7f2('0x4b')][_0xb7f2('0x4f')](_0x41d2f0[_0xb7f2('0x50')],{})['then'](function(_0x5431c5){var _0x3d92a6=_0x41d2f0[_0xb7f2('0x51')][_0xb7f2('0x52')]({'plain':!![]});if(!_0x3d92a6)throw new Error(_0xb7f2('0x53'));if(_0x3d92a6['role']===_0xb7f2('0x51')){var _0x1e1fef=_0x5431c5[_0xb7f2('0x52')]({'plain':!![]});var _0x2b38df=_0xb7f2('0x2b');return db['UserProfileSection'][_0xb7f2('0x54')]({'where':{'name':_0x2b38df,'userProfileId':_0x3d92a6[_0xb7f2('0x55')]},'raw':!![]})[_0xb7f2('0x29')](function(_0x59682b){if(_0x59682b&&_0x59682b[_0xb7f2('0x56')]===0x0){return db[_0xb7f2('0x2c')][_0xb7f2('0x4f')]({'name':_0x1e1fef[_0xb7f2('0x2e')],'resourceId':_0x1e1fef['id'],'type':_0x59682b['name'],'sectionId':_0x59682b['id']},{})[_0xb7f2('0x29')](function(){return _0x5431c5;});}else{return _0x5431c5;}})['catch'](function(_0x1faddb){logger[_0xb7f2('0x2d')](_0xb7f2('0x57'),_0x1faddb);throw _0x1faddb;});}return _0x5431c5;})[_0xb7f2('0x29')](respondWithResult(_0x3dacba,0xc9))['catch'](handleError(_0x3dacba,null));};exports[_0xb7f2('0x58')]=function(_0x3fe3ce,_0x3b46d3){if(_0x3fe3ce[_0xb7f2('0x50')]['id']){delete _0x3fe3ce[_0xb7f2('0x50')]['id'];}return db['MailQueue'][_0xb7f2('0x54')]({'where':{'id':_0x3fe3ce[_0xb7f2('0x4d')]['id']}})[_0xb7f2('0x29')](handleEntityNotFound(_0x3b46d3,null))['then'](saveUpdates(_0x3fe3ce['body'],null))[_0xb7f2('0x29')](respondWithResult(_0x3b46d3,null))['catch'](handleError(_0x3b46d3,null));};exports[_0xb7f2('0x2a')]=function(_0x88a055,_0x5a85fa){return db[_0xb7f2('0x4b')]['find']({'where':{'id':_0x88a055[_0xb7f2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5a85fa,null))[_0xb7f2('0x29')](removeEntity(_0x5a85fa,null))['catch'](handleError(_0x5a85fa,null));};exports[_0xb7f2('0x59')]=function(_0x3fba7d,_0x570593){return db[_0xb7f2('0x4b')][_0xb7f2('0x59')]()[_0xb7f2('0x29')](respondWithResult(_0x570593,null))[_0xb7f2('0x4c')](handleError(_0x570593,null));};exports[_0xb7f2('0x5a')]=function(_0x195e4a,_0x181b2a,_0x548747){var _0x2aca86={'raw':!![],'where':{}},_0x40f48f={},_0x4dc2b9;return db[_0xb7f2('0x4b')][_0xb7f2('0x5b')]({'where':{'id':_0x195e4a[_0xb7f2('0x4d')]['id']}})[_0xb7f2('0x29')](handleEntityNotFound(_0x181b2a,null))[_0xb7f2('0x29')](function(_0x44cc7f){if(_0x44cc7f){_0x4dc2b9=_0x44cc7f['get']({'plain':!![]});_0x40f48f[_0xb7f2('0x3b')]=_[_0xb7f2('0x3d')](db['UserMailQueue']['rawAttributes']);_0x40f48f[_0xb7f2('0x3c')]=_[_0xb7f2('0x3d')](_0x195e4a[_0xb7f2('0x3c')]);_0x40f48f['filters']=_[_0xb7f2('0x40')](_0x40f48f['model'],_0x40f48f[_0xb7f2('0x3c')]);_0x2aca86[_0xb7f2('0x3f')]=_[_0xb7f2('0x40')](_0x40f48f[_0xb7f2('0x3b')],qs['fields'](_0x195e4a[_0xb7f2('0x3c')][_0xb7f2('0x41')]));_0x2aca86[_0xb7f2('0x3f')]=_0x2aca86[_0xb7f2('0x3f')][_0xb7f2('0x4e')]?_0x2aca86[_0xb7f2('0x3f')]:_0x40f48f[_0xb7f2('0x3b')];if(!_0x195e4a[_0xb7f2('0x3c')]['hasOwnProperty'](_0xb7f2('0x43'))){_0x2aca86[_0xb7f2('0x23')]=qs[_0xb7f2('0x23')](_0x195e4a['query']['limit']);_0x2aca86[_0xb7f2('0x21')]=qs[_0xb7f2('0x21')](_0x195e4a['query'][_0xb7f2('0x21')]);}_0x2aca86[_0xb7f2('0x5c')]=qs[_0xb7f2('0x44')](_0x195e4a[_0xb7f2('0x3c')][_0xb7f2('0x44')]);_0x2aca86['where']=qs[_0xb7f2('0x3e')](_[_0xb7f2('0x46')](_0x195e4a[_0xb7f2('0x3c')],_0x40f48f['filters']));_0x2aca86[_0xb7f2('0x45')][_0xb7f2('0x5d')]=_0x44cc7f['id'];if(_0x195e4a[_0xb7f2('0x3c')]['filter']){_0x2aca86['where']=_[_0xb7f2('0x30')](_0x2aca86[_0xb7f2('0x45')],{'$or':_[_0xb7f2('0x36')](_0x2aca86[_0xb7f2('0x3f')],function(_0x248c4e){var _0x576c2e={};_0x576c2e[_0x248c4e]={'$like':'%'+_0x195e4a[_0xb7f2('0x3c')][_0xb7f2('0x47')]+'%'};return _0x576c2e;})});}_0x2aca86=_[_0xb7f2('0x30')]({},_0x2aca86,_0x195e4a[_0xb7f2('0x48')]);return db[_0xb7f2('0x5e')][_0xb7f2('0x5f')](_0x2aca86);}})[_0xb7f2('0x29')](function(_0x32dc03){if(_0x32dc03){return db[_0xb7f2('0x60')]['findAndCountAll']({'where':{'id':_[_0xb7f2('0x36')](_0x32dc03,'UserId'),'role':_0xb7f2('0x33')},'attributes':['id',_0xb7f2('0x2e'),_0xb7f2('0x61'),_0xb7f2('0x62'),_0xb7f2('0x63')]});}})[_0xb7f2('0x29')](function(_0x1a926d){if(_0x1a926d){return{'count':_0x1a926d[_0xb7f2('0x24')],'rows':_[_0xb7f2('0x36')](_0x1a926d[_0xb7f2('0x64')],function(_0x181782){return{'membername':_0x181782[_0xb7f2('0x2e')],'UserId':_0x181782['id'],'queue_name':_0x4dc2b9[_0xb7f2('0x2e')],'MailQueueId':_0x4dc2b9['id'],'interface':util[_0xb7f2('0x65')](_0xb7f2('0x66'),_0xb7f2('0x67'),_0x181782[_0xb7f2('0x2e')]),'penalty':0x0,'paused':_0x181782[_0xb7f2('0x61')],'createdAt':_0x181782[_0xb7f2('0x63')],'updatedAt':_0x181782['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x181b2a,_0x2aca86))[_0xb7f2('0x4c')](handleError(_0x181b2a,null));};exports['getTeams']=function(_0x513e6f,_0x999862,_0x4e5b66){var _0x2cf199={};var _0x38c1e2={};var _0x3dbe59;var _0x20dc1b;return db[_0xb7f2('0x4b')]['findOne']({'where':{'id':_0x513e6f[_0xb7f2('0x4d')]['id']}})[_0xb7f2('0x29')](handleEntityNotFound(_0x999862,null))[_0xb7f2('0x29')](function(_0x507b99){if(_0x507b99){_0x3dbe59=_0x507b99;_0x38c1e2['model']=_[_0xb7f2('0x3d')](db[_0xb7f2('0x68')][_0xb7f2('0x37')]);_0x38c1e2[_0xb7f2('0x3c')]=_['keys'](_0x513e6f[_0xb7f2('0x3c')]);_0x38c1e2[_0xb7f2('0x3e')]=_[_0xb7f2('0x40')](_0x38c1e2[_0xb7f2('0x3b')],_0x38c1e2['query']);_0x2cf199['attributes']=_[_0xb7f2('0x40')](_0x38c1e2[_0xb7f2('0x3b')],qs[_0xb7f2('0x41')](_0x513e6f[_0xb7f2('0x3c')]['fields']));_0x2cf199[_0xb7f2('0x3f')]=_0x2cf199['attributes'][_0xb7f2('0x4e')]?_0x2cf199[_0xb7f2('0x3f')]:_0x38c1e2[_0xb7f2('0x3b')];_0x2cf199[_0xb7f2('0x5c')]=qs[_0xb7f2('0x44')](_0x513e6f[_0xb7f2('0x3c')][_0xb7f2('0x44')]);_0x2cf199[_0xb7f2('0x45')]=qs[_0xb7f2('0x3e')](_[_0xb7f2('0x46')](_0x513e6f['query'],_0x38c1e2['filters']));if(_0x513e6f[_0xb7f2('0x3c')][_0xb7f2('0x47')]){_0x2cf199['where']=_[_0xb7f2('0x30')](_0x2cf199[_0xb7f2('0x45')],{'$or':_[_0xb7f2('0x36')](_0x2cf199['attributes'],function(_0x2de69b){var _0x5568bb={};_0x5568bb[_0x2de69b]={'$like':'%'+_0x513e6f['query'][_0xb7f2('0x47')]+'%'};return _0x5568bb;})});}_0x2cf199=_[_0xb7f2('0x30')]({},_0x2cf199,_0x513e6f['options']);return _0x3dbe59['getTeams'](_0x2cf199);}})['then'](function(_0x25dfe6){if(_0x25dfe6){_0x20dc1b=_0x25dfe6[_0xb7f2('0x4e')];if(!_0x513e6f[_0xb7f2('0x3c')][_0xb7f2('0x42')]('nolimit')){_0x2cf199[_0xb7f2('0x23')]=qs['limit'](_0x513e6f[_0xb7f2('0x3c')]['limit']);_0x2cf199[_0xb7f2('0x21')]=qs[_0xb7f2('0x21')](_0x513e6f[_0xb7f2('0x3c')][_0xb7f2('0x21')]);}return _0x3dbe59['getTeams'](_0x2cf199);}})[_0xb7f2('0x29')](function(_0x18d56e){if(_0x18d56e){return _0x18d56e?{'count':_0x20dc1b,'rows':_0x18d56e}:null;}})['then'](respondWithResult(_0x999862,null))['catch'](handleError(_0x999862,null));};exports['addTeams']=function(_0x5b373f,_0x260f1f,_0x4f94a9){var _0x35a4ce=_0x5b373f[_0xb7f2('0x50')][_0xb7f2('0x69')];return db[_0xb7f2('0x68')][_0xb7f2('0x5f')]({'where':{'id':_0x35a4ce},'attributes':['id'],'include':[{'model':db[_0xb7f2('0x60')],'as':_0xb7f2('0x6a'),'attributes':['id',_0xb7f2('0x2e'),_0xb7f2('0x6b'),'voicePause','interface'],'raw':!![]}]})[_0xb7f2('0x29')](function(_0x14f00f){if(_0x14f00f){var _0x537240=_['flatMap'](_0x14f00f,function(_0x38d4dd){var _0x433f70=_0x38d4dd[_0xb7f2('0x52')]({'plain':!![]});return _0x433f70[_0xb7f2('0x6a')];});return db[_0xb7f2('0x4b')]['find']({'where':{'id':_0x5b373f[_0xb7f2('0x4d')]['id']}})[_0xb7f2('0x29')](function(_0x29f04e){return db[_0xb7f2('0x6c')]['transaction'](function(_0x51e324){return _0x29f04e['addTeams'](_0x35a4ce,{'transaction':_0x51e324})[_0xb7f2('0x29')](function(){return BPromise['each'](_0x537240,function(_0x23faba){return db[_0xb7f2('0x5e')][_0xb7f2('0x6d')]({'where':{'UserId':_0x23faba['id'],'MailQueueId':_0x5b373f[_0xb7f2('0x4d')]['id']},'transaction':_0x51e324});});})['then'](function(){_0x537240[_0xb7f2('0x6e')](function(_0x3af8c6){socket[_0xb7f2('0x6f')](_0xb7f2('0x70'),{'UserId':_0x3af8c6['id'],'MailQueueId':_0x29f04e['id']});});});});});}})[_0xb7f2('0x29')](respondWithStatusCode(_0x260f1f,null))['catch'](handleError(_0x260f1f,null));};exports[_0xb7f2('0x71')]=function(_0x4be002,_0x4fd112,_0x15b7ea){return db['Team'][_0xb7f2('0x5f')]({'where':{'id':_0x4be002['query'][_0xb7f2('0x69')]},'attributes':['id'],'include':[{'model':db[_0xb7f2('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb7f2('0x29')](handleEntityNotFound(_0x4fd112,null))[_0xb7f2('0x29')](function(_0x4a966d){var _0x29e7da=_['map'](_0x4a966d,'id');var _0x3db962=[];var _0x52f038=[];var _0x3d7b86=squel['select']();_0x3d7b86[_0xb7f2('0x72')](_0xb7f2('0x73'))[_0xb7f2('0x74')](_0xb7f2('0x75'),'tq')['join'](_0xb7f2('0x76'),'ut',_0xb7f2('0x77'))[_0xb7f2('0x45')](_0xb7f2('0x78'),_0x4be002[_0xb7f2('0x4d')]['id']);for(var _0x3cec8f=0x0;_0x3cec8f<_0x4a966d[_0xb7f2('0x4e')];_0x3cec8f+=0x1){let _0xf3784b=_0x4a966d[_0x3cec8f];for(var _0x341e04=0x0;_0x341e04<_0xf3784b['Agents'][_0xb7f2('0x4e')];_0x341e04+=0x1){let _0x1ae164=_0xf3784b['Agents'][_0x341e04];var _0x59b5dc=_0x3d7b86[_0xb7f2('0x79')]();_0x59b5dc[_0xb7f2('0x45')](_0xb7f2('0x7a'),_0x1ae164['id']);_0x52f038[_0xb7f2('0x7b')](db[_0xb7f2('0x6c')][_0xb7f2('0x3c')](_0x59b5dc[_0xb7f2('0x7c')](),{'type':db['sequelize'][_0xb7f2('0x7d')][_0xb7f2('0x7e')]})[_0xb7f2('0x29')](function(_0x54226b){if(_0x54226b['length']===0x1){return _0x1ae164['id'];}else{var _0x3ed2dd=_[_0xb7f2('0x7f')](_['map'](_0x54226b,'TeamId'),function(_0x2fde99){return _[_0xb7f2('0x80')](_0x29e7da,_0x2fde99);});if(_0x3ed2dd){return _0x1ae164['id'];}}}));}}return BPromise[_0xb7f2('0x81')](_0x52f038)[_0xb7f2('0x29')](function(_0x5bdb12){_0x3db962=_(_0x3db962)[_0xb7f2('0x82')](_0x5bdb12)[_0xb7f2('0x83')]()[_0xb7f2('0x84')]();return db[_0xb7f2('0x4b')]['find']({'where':{'id':_0x4be002[_0xb7f2('0x4d')]['id']}})[_0xb7f2('0x29')](function(_0x5c6bf2){return db[_0xb7f2('0x6c')][_0xb7f2('0x85')](function(_0x30c506){return _0x5c6bf2[_0xb7f2('0x71')](_0x4be002[_0xb7f2('0x3c')]['ids'],{'transaction':_0x30c506})[_0xb7f2('0x29')](function(){if(!_['isEmpty'](_0x3db962)){return _0x5c6bf2['removeAgents'](_0x3db962,{'transaction':_0x30c506});}})[_0xb7f2('0x29')](function(){_0x3db962['forEach'](function(_0x95e4e6){socket[_0xb7f2('0x6f')]('userMailQueue:remove',{'UserId':_0x95e4e6,'MailQueueId':_0x5c6bf2['id']});});});});});});})[_0xb7f2('0x29')](respondWithStatusCode(_0x4fd112,null))[_0xb7f2('0x4c')](handleError(_0x4fd112,null));};exports[_0xb7f2('0x86')]=function(_0x3fc10d,_0xfce383,_0x1de2f2){return db['MailQueue'][_0xb7f2('0x54')]({'where':{'id':_0x3fc10d[_0xb7f2('0x4d')]['id']}})[_0xb7f2('0x29')](handleEntityNotFound(_0xfce383,null))[_0xb7f2('0x29')](function(_0x52ce9a){if(_0x52ce9a){return _0x52ce9a[_0xb7f2('0x86')](_0x3fc10d[_0xb7f2('0x50')][_0xb7f2('0x69')],_[_0xb7f2('0x87')](_0x3fc10d['body'],[_0xb7f2('0x69'),'id'])||{})[_0xb7f2('0x88')](function(_0x1ec76c){for(var _0x2262a6=0x0;_0x2262a6<_0x3fc10d['body'][_0xb7f2('0x69')]['length'];_0x2262a6+=0x1){socket['emit'](_0xb7f2('0x70'),{'UserId':_0x3fc10d[_0xb7f2('0x50')][_0xb7f2('0x69')][_0x2262a6],'MailQueueId':_0x3fc10d['params']['id']});}return _0x1ec76c;});}})[_0xb7f2('0x29')](respondWithResult(_0xfce383,null))[_0xb7f2('0x4c')](handleError(_0xfce383,null));};exports['removeAgents']=function(_0x3c643c,_0x20d090,_0x4b7d9b){return db[_0xb7f2('0x4b')][_0xb7f2('0x54')]({'where':{'id':_0x3c643c[_0xb7f2('0x4d')]['id']}})[_0xb7f2('0x29')](handleEntityNotFound(_0x20d090,null))['then'](function(_0x23fc9f){if(_0x23fc9f){return _0x23fc9f[_0xb7f2('0x89')](_0x3c643c[_0xb7f2('0x3c')][_0xb7f2('0x69')])[_0xb7f2('0x29')](function(){if(_['isArray'](_0x3c643c[_0xb7f2('0x3c')][_0xb7f2('0x69')])){for(var _0x2d2206=0x0;_0x2d2206<_0x3c643c[_0xb7f2('0x3c')][_0xb7f2('0x69')]['length'];_0x2d2206+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x3c643c[_0xb7f2('0x3c')][_0xb7f2('0x69')][_0x2d2206]),'MailQueueId':Number(_0x3c643c[_0xb7f2('0x4d')]['id'])});}}else{socket[_0xb7f2('0x6f')]('userMailQueue:remove',{'UserId':Number(_0x3c643c[_0xb7f2('0x3c')][_0xb7f2('0x69')]),'MailQueueId':Number(_0x3c643c[_0xb7f2('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x20d090,null))[_0xb7f2('0x4c')](handleError(_0x20d090,null));};exports[_0xb7f2('0x8a')]=function(_0x38888d,_0x29a0c4,_0x2e0932){var _0x4f02c3={};var _0x361b50={};var _0x851011;var _0x1ad2ba;return db['MailQueue'][_0xb7f2('0x5b')]({'where':{'id':_0x38888d[_0xb7f2('0x4d')]['id']}})[_0xb7f2('0x29')](handleEntityNotFound(_0x29a0c4,null))[_0xb7f2('0x29')](function(_0x358fac){if(_0x358fac){_0x851011=_0x358fac;_0x361b50[_0xb7f2('0x3b')]=_['keys'](db[_0xb7f2('0x60')][_0xb7f2('0x37')]);_0x361b50[_0xb7f2('0x3c')]=_[_0xb7f2('0x3d')](_0x38888d[_0xb7f2('0x3c')]);_0x361b50[_0xb7f2('0x3e')]=_[_0xb7f2('0x40')](_0x361b50['model'],_0x361b50[_0xb7f2('0x3c')]);_0x4f02c3[_0xb7f2('0x3f')]=_['intersection'](_0x361b50[_0xb7f2('0x3b')],qs[_0xb7f2('0x41')](_0x38888d['query']['fields']));_0x4f02c3['attributes']=_0x4f02c3[_0xb7f2('0x3f')][_0xb7f2('0x4e')]?_0x4f02c3[_0xb7f2('0x3f')]:_0x361b50[_0xb7f2('0x3b')];_0x4f02c3[_0xb7f2('0x5c')]=qs[_0xb7f2('0x44')](_0x38888d[_0xb7f2('0x3c')][_0xb7f2('0x44')]);_0x4f02c3[_0xb7f2('0x45')]=qs[_0xb7f2('0x3e')](_[_0xb7f2('0x46')](_0x38888d[_0xb7f2('0x3c')],_0x361b50[_0xb7f2('0x3e')]));if(_0x38888d[_0xb7f2('0x3c')][_0xb7f2('0x47')]){_0x4f02c3[_0xb7f2('0x45')]=_[_0xb7f2('0x30')](_0x4f02c3['where'],{'$or':_[_0xb7f2('0x36')](_0x4f02c3[_0xb7f2('0x3f')],function(_0x5a88ac){var _0xb3e419={};_0xb3e419[_0x5a88ac]={'$like':'%'+_0x38888d[_0xb7f2('0x3c')][_0xb7f2('0x47')]+'%'};return _0xb3e419;})});}_0x4f02c3=_[_0xb7f2('0x30')]({},_0x4f02c3,_0x38888d['options']);return _0x851011[_0xb7f2('0x8a')](_0x4f02c3);}})[_0xb7f2('0x29')](function(_0x50f828){if(_0x50f828){_0x1ad2ba=_0x50f828[_0xb7f2('0x4e')];if(!_0x38888d[_0xb7f2('0x3c')][_0xb7f2('0x42')](_0xb7f2('0x43'))){_0x4f02c3['limit']=qs['limit'](_0x38888d['query'][_0xb7f2('0x23')]);_0x4f02c3[_0xb7f2('0x21')]=qs[_0xb7f2('0x21')](_0x38888d['query'][_0xb7f2('0x21')]);}return _0x851011[_0xb7f2('0x8a')](_0x4f02c3);}})[_0xb7f2('0x29')](function(_0x525830){if(_0x525830){return _0x525830?{'count':_0x1ad2ba,'rows':_0x525830}:null;}})[_0xb7f2('0x29')](respondWithResult(_0x29a0c4,null))['catch'](handleError(_0x29a0c4,null));}; \ No newline at end of file +var _0x10c4=['VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','nolimit','MailQueueId','findAll','User','mailPause','updatedAt','format','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','value','isEmpty','userMailQueue:remove','addAgents','userMailQueue:save','removeAgents','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','MailQueues','error','name','send','render','merge','body','contact','message','agent','interaction','account','MailQueue','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x401f2a,_0x49d7d3){var _0x387856=function(_0x1b7a5d){while(--_0x1b7a5d){_0x401f2a['push'](_0x401f2a['shift']());}};_0x387856(++_0x49d7d3);}(_0x10c4,0x16b));var _0x410c=function(_0x149920,_0x68a484){_0x149920=_0x149920-0x0;var _0x319ffc=_0x10c4[_0x149920];return _0x319ffc;};'use strict';var emlformat=require(_0x410c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x410c('0x1'));var jsonpatch=require(_0x410c('0x2'));var rp=require(_0x410c('0x3'));var moment=require(_0x410c('0x4'));var BPromise=require(_0x410c('0x5'));var Mustache=require(_0x410c('0x6'));var util=require('util');var path=require(_0x410c('0x7'));var sox=require(_0x410c('0x8'));var csv=require(_0x410c('0x9'));var ejs=require(_0x410c('0xa'));var fs=require('fs');var fs_extra=require(_0x410c('0xb'));var _=require(_0x410c('0xc'));var squel=require(_0x410c('0xd'));var crypto=require(_0x410c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x410c('0xf'));var toCsv=require(_0x410c('0x9'));var querystring=require(_0x410c('0x10'));var Papa=require(_0x410c('0x11'));var Redis=require(_0x410c('0x12'));var authService=require(_0x410c('0x13'));var qs=require(_0x410c('0x14'));var as=require(_0x410c('0x15'));var hardwareService=require(_0x410c('0x16'));var logger=require(_0x410c('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x410c('0x18'));var licenseUtil=require(_0x410c('0x19'));var db=require(_0x410c('0x1a'))['db'];config[_0x410c('0x1b')]=_[_0x410c('0x1c')](config['redis'],{'host':_0x410c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x410c('0x1b')]));require(_0x410c('0x1e'))['register'](socket);function respondWithStatusCode(_0x285424,_0x3a803f){_0x3a803f=_0x3a803f||0xcc;return function(_0x2eece1){if(_0x2eece1){return _0x285424[_0x410c('0x1f')](_0x3a803f);}return _0x285424['status'](_0x3a803f)[_0x410c('0x20')]();};}function respondWithResult(_0x15b1f1,_0x3e0f4f){_0x3e0f4f=_0x3e0f4f||0xc8;return function(_0x663c75){if(_0x663c75){return _0x15b1f1[_0x410c('0x21')](_0x3e0f4f)[_0x410c('0x22')](_0x663c75);}};}function respondWithFilteredResult(_0x3e7428,_0x4aaf1b){return function(_0x454353){if(_0x454353){var _0x478dc5=typeof _0x4aaf1b[_0x410c('0x23')]===_0x410c('0x24')&&typeof _0x4aaf1b[_0x410c('0x25')]===_0x410c('0x24');var _0x1ef9ee=_0x454353['count'];var _0x6e689d=_0x478dc5?0x0:_0x4aaf1b[_0x410c('0x23')];var _0x4bed2c=_0x478dc5?_0x454353[_0x410c('0x26')]:_0x4aaf1b[_0x410c('0x23')]+_0x4aaf1b[_0x410c('0x25')];var _0x4d2889;if(_0x4bed2c>=_0x1ef9ee){_0x4bed2c=_0x1ef9ee;_0x4d2889=0xc8;}else{_0x4d2889=0xce;}_0x3e7428['status'](_0x4d2889);return _0x3e7428[_0x410c('0x27')](_0x410c('0x28'),_0x6e689d+'-'+_0x4bed2c+'/'+_0x1ef9ee)[_0x410c('0x22')](_0x454353);}return null;};}function patchUpdates(_0x4a1aaa){return function(_0x3b4da2){try{jsonpatch['apply'](_0x3b4da2,_0x4a1aaa,!![]);}catch(_0x29b346){return BPromise['reject'](_0x29b346);}return _0x3b4da2[_0x410c('0x29')]();};}function saveUpdates(_0x1c4fe2,_0x4f2f34){return function(_0x61b8ef){if(_0x61b8ef){return _0x61b8ef[_0x410c('0x2a')](_0x1c4fe2)[_0x410c('0x2b')](function(_0x16caaf){return _0x16caaf;});}return null;};}function removeEntity(_0x36ce8d,_0x347db1){return function(_0x2af156){if(_0x2af156){return _0x2af156[_0x410c('0x2c')]()[_0x410c('0x2b')](function(){var _0x351841=_0x2af156['get']({'plain':!![]});var _0x37ae90=_0x410c('0x2d');return db['UserProfileResource'][_0x410c('0x2c')]({'where':{'type':_0x37ae90,'resourceId':_0x351841['id']}})[_0x410c('0x2b')](function(){return _0x2af156;});})[_0x410c('0x2b')](function(){_0x36ce8d['status'](0xcc)[_0x410c('0x20')]();});}};}function handleEntityNotFound(_0x49e3ca,_0x14bd2b){return function(_0x3efbef){if(!_0x3efbef){_0x49e3ca[_0x410c('0x1f')](0x194);}return _0x3efbef;};}function handleError(_0x5d79f5,_0x1b467c){_0x1b467c=_0x1b467c||0x1f4;return function(_0x2d99b9){logger[_0x410c('0x2e')](_0x2d99b9['stack']);if(_0x2d99b9['name']){delete _0x2d99b9[_0x410c('0x2f')];}_0x5d79f5['status'](_0x1b467c)[_0x410c('0x30')](_0x2d99b9);};}function getMustacheRender(_0x478b15,_0x4c9eee){return Mustache[_0x410c('0x31')](_0x478b15,_[_0x410c('0x32')](_0x4c9eee[_0x410c('0x33')],{'contact':_0x4c9eee[_0x410c('0x34')],'message':_0x4c9eee[_0x410c('0x35')],'agent':_0x4c9eee[_0x410c('0x36')],'interaction':_0x4c9eee[_0x410c('0x37')],'account':_0x4c9eee[_0x410c('0x38')]}))||'';}exports['index']=function(_0x32b0ed,_0x27c314){var _0x582e24={},_0x475a43={},_0x2fe303={'count':0x0,'rows':[]};var _0xc1e7f9=_['map'](db[_0x410c('0x39')][_0x410c('0x3a')],function(_0x4cd183){return{'name':_0x4cd183[_0x410c('0x3b')],'type':_0x4cd183[_0x410c('0x3c')]['key']};});_0x475a43[_0x410c('0x3d')]=_[_0x410c('0x3e')](_0xc1e7f9,_0x410c('0x2f'));_0x475a43[_0x410c('0x3f')]=_['keys'](_0x32b0ed[_0x410c('0x3f')]);_0x475a43[_0x410c('0x40')]=_[_0x410c('0x41')](_0x475a43[_0x410c('0x3d')],_0x475a43[_0x410c('0x3f')]);_0x582e24[_0x410c('0x42')]=_[_0x410c('0x41')](_0x475a43[_0x410c('0x3d')],qs[_0x410c('0x43')](_0x32b0ed[_0x410c('0x3f')]['fields']));_0x582e24[_0x410c('0x42')]=_0x582e24[_0x410c('0x42')][_0x410c('0x44')]?_0x582e24[_0x410c('0x42')]:_0x475a43['model'];if(!_0x32b0ed['query'][_0x410c('0x45')]('nolimit')){_0x582e24[_0x410c('0x25')]=qs[_0x410c('0x25')](_0x32b0ed['query'][_0x410c('0x25')]);_0x582e24['offset']=qs[_0x410c('0x23')](_0x32b0ed['query'][_0x410c('0x23')]);}_0x582e24[_0x410c('0x46')]=qs[_0x410c('0x47')](_0x32b0ed[_0x410c('0x3f')][_0x410c('0x47')]);_0x582e24[_0x410c('0x48')]=qs[_0x410c('0x40')](_[_0x410c('0x49')](_0x32b0ed[_0x410c('0x3f')],_0x475a43[_0x410c('0x40')]),_0xc1e7f9);if(_0x32b0ed[_0x410c('0x3f')][_0x410c('0x4a')]){_0x582e24[_0x410c('0x48')]=_[_0x410c('0x32')](_0x582e24[_0x410c('0x48')],{'$or':_[_0x410c('0x3e')](_0xc1e7f9,function(_0x1ca12b){if(_0x1ca12b['type']!==_0x410c('0x4b')){var _0x20e120={};_0x20e120[_0x1ca12b[_0x410c('0x2f')]]={'$like':'%'+_0x32b0ed['query'][_0x410c('0x4a')]+'%'};return _0x20e120;}})});}_0x582e24=_[_0x410c('0x32')]({},_0x582e24,_0x32b0ed['options']);var _0x604eb={'where':_0x582e24[_0x410c('0x48')]};return db['MailQueue'][_0x410c('0x26')](_0x604eb)[_0x410c('0x2b')](function(_0x487684){_0x2fe303[_0x410c('0x26')]=_0x487684;if(_0x32b0ed[_0x410c('0x3f')][_0x410c('0x4c')]){_0x582e24[_0x410c('0x4d')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x582e24);})['then'](function(_0x3e578c){_0x2fe303[_0x410c('0x4e')]=_0x3e578c;return _0x2fe303;})[_0x410c('0x2b')](respondWithFilteredResult(_0x27c314,_0x582e24))[_0x410c('0x4f')](handleError(_0x27c314,null));};exports[_0x410c('0x50')]=function(_0x1fe2cd,_0x1819f9){var _0x1d013e={'raw':!![],'where':{'id':_0x1fe2cd[_0x410c('0x51')]['id']}},_0x586d7c={};_0x586d7c[_0x410c('0x3d')]=_[_0x410c('0x52')](db[_0x410c('0x39')][_0x410c('0x3a')]);_0x586d7c['query']=_[_0x410c('0x52')](_0x1fe2cd['query']);_0x586d7c[_0x410c('0x40')]=_[_0x410c('0x41')](_0x586d7c[_0x410c('0x3d')],_0x586d7c['query']);_0x1d013e[_0x410c('0x42')]=_[_0x410c('0x41')](_0x586d7c[_0x410c('0x3d')],qs[_0x410c('0x43')](_0x1fe2cd['query'][_0x410c('0x43')]));_0x1d013e[_0x410c('0x42')]=_0x1d013e[_0x410c('0x42')][_0x410c('0x44')]?_0x1d013e[_0x410c('0x42')]:_0x586d7c[_0x410c('0x3d')];if(_0x1fe2cd[_0x410c('0x3f')]['includeAll']){_0x1d013e[_0x410c('0x4d')]=[{'all':!![]}];}_0x1d013e=_[_0x410c('0x32')]({},_0x1d013e,_0x1fe2cd[_0x410c('0x53')]);return db[_0x410c('0x39')][_0x410c('0x54')](_0x1d013e)[_0x410c('0x2b')](handleEntityNotFound(_0x1819f9,null))['then'](respondWithResult(_0x1819f9,null))[_0x410c('0x4f')](handleError(_0x1819f9,null));};exports['create']=function(_0x3821ba,_0x47b2b5){return db['MailQueue'][_0x410c('0x55')](_0x3821ba['body'],{})[_0x410c('0x2b')](function(_0x396855){var _0x1701a9=_0x3821ba[_0x410c('0x56')][_0x410c('0x57')]({'plain':!![]});if(!_0x1701a9)throw new Error(_0x410c('0x58'));if(_0x1701a9['role']===_0x410c('0x56')){var _0x15c60a=_0x396855['get']({'plain':!![]});var _0x16edcb=_0x410c('0x2d');return db[_0x410c('0x59')][_0x410c('0x54')]({'where':{'name':_0x16edcb,'userProfileId':_0x1701a9[_0x410c('0x5a')]},'raw':!![]})[_0x410c('0x2b')](function(_0x40df76){if(_0x40df76&&_0x40df76[_0x410c('0x5b')]===0x0){return db[_0x410c('0x5c')][_0x410c('0x55')]({'name':_0x15c60a[_0x410c('0x2f')],'resourceId':_0x15c60a['id'],'type':_0x40df76[_0x410c('0x2f')],'sectionId':_0x40df76['id']},{})[_0x410c('0x2b')](function(){return _0x396855;});}else{return _0x396855;}})['catch'](function(_0x2f96e9){logger[_0x410c('0x2e')](_0x410c('0x5d'),_0x2f96e9);throw _0x2f96e9;});}return _0x396855;})[_0x410c('0x2b')](respondWithResult(_0x47b2b5,0xc9))[_0x410c('0x4f')](handleError(_0x47b2b5,null));};exports[_0x410c('0x2a')]=function(_0x47276a,_0x38c828){if(_0x47276a[_0x410c('0x33')]['id']){delete _0x47276a[_0x410c('0x33')]['id'];}return db[_0x410c('0x39')][_0x410c('0x54')]({'where':{'id':_0x47276a[_0x410c('0x51')]['id']}})[_0x410c('0x2b')](handleEntityNotFound(_0x38c828,null))['then'](saveUpdates(_0x47276a[_0x410c('0x33')],null))[_0x410c('0x2b')](respondWithResult(_0x38c828,null))['catch'](handleError(_0x38c828,null));};exports[_0x410c('0x2c')]=function(_0x3972ac,_0xefb940){return db['MailQueue'][_0x410c('0x54')]({'where':{'id':_0x3972ac['params']['id']}})[_0x410c('0x2b')](handleEntityNotFound(_0xefb940,null))['then'](removeEntity(_0xefb940,null))[_0x410c('0x4f')](handleError(_0xefb940,null));};exports[_0x410c('0x5e')]=function(_0x24f090,_0x1d9672){return db[_0x410c('0x39')][_0x410c('0x5e')]()[_0x410c('0x2b')](respondWithResult(_0x1d9672,null))[_0x410c('0x4f')](handleError(_0x1d9672,null));};exports[_0x410c('0x5f')]=function(_0x1b1c4d,_0x5e9535,_0x1b2dc4){var _0x259cfa={'raw':!![],'where':{}},_0x1cc34e={},_0x3e5e76;return db['MailQueue']['findOne']({'where':{'id':_0x1b1c4d[_0x410c('0x51')]['id']}})[_0x410c('0x2b')](handleEntityNotFound(_0x5e9535,null))[_0x410c('0x2b')](function(_0x2a95f2){if(_0x2a95f2){_0x3e5e76=_0x2a95f2['get']({'plain':!![]});_0x1cc34e[_0x410c('0x3d')]=_['keys'](db[_0x410c('0x60')][_0x410c('0x3a')]);_0x1cc34e[_0x410c('0x3f')]=_['keys'](_0x1b1c4d[_0x410c('0x3f')]);_0x1cc34e[_0x410c('0x40')]=_[_0x410c('0x41')](_0x1cc34e[_0x410c('0x3d')],_0x1cc34e['query']);_0x259cfa[_0x410c('0x42')]=_[_0x410c('0x41')](_0x1cc34e[_0x410c('0x3d')],qs['fields'](_0x1b1c4d[_0x410c('0x3f')][_0x410c('0x43')]));_0x259cfa[_0x410c('0x42')]=_0x259cfa['attributes'][_0x410c('0x44')]?_0x259cfa[_0x410c('0x42')]:_0x1cc34e['model'];if(!_0x1b1c4d[_0x410c('0x3f')][_0x410c('0x45')](_0x410c('0x61'))){_0x259cfa[_0x410c('0x25')]=qs[_0x410c('0x25')](_0x1b1c4d[_0x410c('0x3f')][_0x410c('0x25')]);_0x259cfa[_0x410c('0x23')]=qs[_0x410c('0x23')](_0x1b1c4d[_0x410c('0x3f')][_0x410c('0x23')]);}_0x259cfa['order']=qs[_0x410c('0x47')](_0x1b1c4d[_0x410c('0x3f')][_0x410c('0x47')]);_0x259cfa['where']=qs[_0x410c('0x40')](_['pick'](_0x1b1c4d[_0x410c('0x3f')],_0x1cc34e['filters']));_0x259cfa[_0x410c('0x48')][_0x410c('0x62')]=_0x2a95f2['id'];if(_0x1b1c4d[_0x410c('0x3f')][_0x410c('0x4a')]){_0x259cfa[_0x410c('0x48')]=_[_0x410c('0x32')](_0x259cfa[_0x410c('0x48')],{'$or':_['map'](_0x259cfa['attributes'],function(_0x59f530){var _0x1aea69={};_0x1aea69[_0x59f530]={'$like':'%'+_0x1b1c4d['query'][_0x410c('0x4a')]+'%'};return _0x1aea69;})});}_0x259cfa=_['merge']({},_0x259cfa,_0x1b1c4d['options']);return db['UserMailQueue'][_0x410c('0x63')](_0x259cfa);}})[_0x410c('0x2b')](function(_0x1fcb04){if(_0x1fcb04){return db[_0x410c('0x64')]['findAndCountAll']({'where':{'id':_[_0x410c('0x3e')](_0x1fcb04,'UserId'),'role':_0x410c('0x36')},'attributes':['id','name',_0x410c('0x65'),_0x410c('0x66'),'createdAt']});}})[_0x410c('0x2b')](function(_0x10649d){if(_0x10649d){return{'count':_0x10649d[_0x410c('0x26')],'rows':_[_0x410c('0x3e')](_0x10649d[_0x410c('0x4e')],function(_0x34de25){return{'membername':_0x34de25[_0x410c('0x2f')],'UserId':_0x34de25['id'],'queue_name':_0x3e5e76[_0x410c('0x2f')],'MailQueueId':_0x3e5e76['id'],'interface':util[_0x410c('0x67')]('%s/%s',_0x410c('0x68'),_0x34de25[_0x410c('0x2f')]),'penalty':0x0,'paused':_0x34de25[_0x410c('0x65')],'createdAt':_0x34de25[_0x410c('0x69')],'updatedAt':_0x34de25['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5e9535,_0x259cfa))[_0x410c('0x4f')](handleError(_0x5e9535,null));};exports[_0x410c('0x6a')]=function(_0x4d028e,_0x138a0f,_0x42027d){var _0x15730d={};var _0x75c859={};var _0x57a269;var _0x100cf1;return db['MailQueue'][_0x410c('0x6b')]({'where':{'id':_0x4d028e[_0x410c('0x51')]['id']}})[_0x410c('0x2b')](handleEntityNotFound(_0x138a0f,null))['then'](function(_0x11819a){if(_0x11819a){_0x57a269=_0x11819a;_0x75c859['model']=_[_0x410c('0x52')](db[_0x410c('0x6c')][_0x410c('0x3a')]);_0x75c859['query']=_['keys'](_0x4d028e[_0x410c('0x3f')]);_0x75c859[_0x410c('0x40')]=_[_0x410c('0x41')](_0x75c859[_0x410c('0x3d')],_0x75c859[_0x410c('0x3f')]);_0x15730d['attributes']=_['intersection'](_0x75c859[_0x410c('0x3d')],qs['fields'](_0x4d028e[_0x410c('0x3f')][_0x410c('0x43')]));_0x15730d['attributes']=_0x15730d[_0x410c('0x42')]['length']?_0x15730d[_0x410c('0x42')]:_0x75c859[_0x410c('0x3d')];_0x15730d[_0x410c('0x46')]=qs[_0x410c('0x47')](_0x4d028e[_0x410c('0x3f')][_0x410c('0x47')]);_0x15730d[_0x410c('0x48')]=qs[_0x410c('0x40')](_[_0x410c('0x49')](_0x4d028e[_0x410c('0x3f')],_0x75c859['filters']));if(_0x4d028e['query']['filter']){_0x15730d[_0x410c('0x48')]=_[_0x410c('0x32')](_0x15730d[_0x410c('0x48')],{'$or':_['map'](_0x15730d[_0x410c('0x42')],function(_0x10876b){var _0x2d24cf={};_0x2d24cf[_0x10876b]={'$like':'%'+_0x4d028e['query']['filter']+'%'};return _0x2d24cf;})});}_0x15730d=_[_0x410c('0x32')]({},_0x15730d,_0x4d028e[_0x410c('0x53')]);return _0x57a269['getTeams'](_0x15730d);}})[_0x410c('0x2b')](function(_0x5a37cb){if(_0x5a37cb){_0x100cf1=_0x5a37cb[_0x410c('0x44')];if(!_0x4d028e[_0x410c('0x3f')][_0x410c('0x45')](_0x410c('0x61'))){_0x15730d[_0x410c('0x25')]=qs['limit'](_0x4d028e[_0x410c('0x3f')]['limit']);_0x15730d[_0x410c('0x23')]=qs[_0x410c('0x23')](_0x4d028e[_0x410c('0x3f')][_0x410c('0x23')]);}return _0x57a269[_0x410c('0x6a')](_0x15730d);}})[_0x410c('0x2b')](function(_0xaf8ef0){if(_0xaf8ef0){return _0xaf8ef0?{'count':_0x100cf1,'rows':_0xaf8ef0}:null;}})[_0x410c('0x2b')](respondWithResult(_0x138a0f,null))[_0x410c('0x4f')](handleError(_0x138a0f,null));};exports[_0x410c('0x6d')]=function(_0x31908c,_0x28619c,_0x31e492){var _0x17e02a=_0x31908c['body'][_0x410c('0x6e')];return db[_0x410c('0x6c')]['findAll']({'where':{'id':_0x17e02a},'attributes':['id'],'include':[{'model':db[_0x410c('0x64')],'as':_0x410c('0x6f'),'attributes':['id','name',_0x410c('0x70'),_0x410c('0x71'),_0x410c('0x72')],'raw':!![]}]})[_0x410c('0x2b')](function(_0x4d2354){if(_0x4d2354){var _0x1a5a0e=_[_0x410c('0x73')](_0x4d2354,function(_0x2b2c2f){var _0x3e25b0=_0x2b2c2f[_0x410c('0x57')]({'plain':!![]});return _0x3e25b0[_0x410c('0x6f')];});return db['MailQueue'][_0x410c('0x54')]({'where':{'id':_0x31908c['params']['id']}})[_0x410c('0x2b')](function(_0x2b9419){return db[_0x410c('0x74')][_0x410c('0x75')](function(_0x43528c){return _0x2b9419[_0x410c('0x6d')](_0x17e02a,{'transaction':_0x43528c})[_0x410c('0x2b')](function(){return BPromise['each'](_0x1a5a0e,function(_0x38e292){return db[_0x410c('0x60')][_0x410c('0x76')]({'where':{'UserId':_0x38e292['id'],'MailQueueId':_0x31908c[_0x410c('0x51')]['id']},'transaction':_0x43528c});});})[_0x410c('0x2b')](function(){_0x1a5a0e[_0x410c('0x77')](function(_0x5bde04){socket[_0x410c('0x78')]('userMailQueue:save',{'UserId':_0x5bde04['id'],'MailQueueId':_0x2b9419['id']});});});});});}})['then'](respondWithStatusCode(_0x28619c,null))[_0x410c('0x4f')](handleError(_0x28619c,null));};exports[_0x410c('0x79')]=function(_0x888d6d,_0x5e14e0,_0x360e9e){return db[_0x410c('0x6c')][_0x410c('0x63')]({'where':{'id':_0x888d6d[_0x410c('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x410c('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x410c('0x2b')](handleEntityNotFound(_0x5e14e0,null))['then'](function(_0x336a7a){var _0x245ae5=_[_0x410c('0x3e')](_0x336a7a,'id');var _0x27f0ee=[];var _0x34d791=[];var _0x48c51f=squel[_0x410c('0x7a')]();_0x48c51f[_0x410c('0x7b')](_0x410c('0x7c'))[_0x410c('0x7d')](_0x410c('0x7e'),'tq')['join'](_0x410c('0x7f'),'ut',_0x410c('0x80'))['where'](_0x410c('0x81'),_0x888d6d[_0x410c('0x51')]['id']);for(var _0x5615be=0x0;_0x5615be<_0x336a7a[_0x410c('0x44')];_0x5615be+=0x1){let _0x23413d=_0x336a7a[_0x5615be];for(var _0x1d2930=0x0;_0x1d2930<_0x23413d[_0x410c('0x6f')]['length'];_0x1d2930+=0x1){let _0x27d4b2=_0x23413d[_0x410c('0x6f')][_0x1d2930];var _0x18f9cf=_0x48c51f[_0x410c('0x82')]();_0x18f9cf[_0x410c('0x48')](_0x410c('0x83'),_0x27d4b2['id']);_0x34d791[_0x410c('0x84')](db[_0x410c('0x74')]['query'](_0x18f9cf['toString'](),{'type':db[_0x410c('0x74')][_0x410c('0x85')][_0x410c('0x86')]})['then'](function(_0x4d51a5){if(_0x4d51a5[_0x410c('0x44')]===0x1){return _0x27d4b2['id'];}else{var _0x1d036a=_[_0x410c('0x87')](_[_0x410c('0x3e')](_0x4d51a5,_0x410c('0x88')),function(_0x56cdcd){return _[_0x410c('0x89')](_0x245ae5,_0x56cdcd);});if(_0x1d036a){return _0x27d4b2['id'];}}}));}}return BPromise[_0x410c('0x8a')](_0x34d791)[_0x410c('0x2b')](function(_0x237d7e){_0x27f0ee=_(_0x27f0ee)['union'](_0x237d7e)['compact']()[_0x410c('0x8b')]();return db[_0x410c('0x39')][_0x410c('0x54')]({'where':{'id':_0x888d6d['params']['id']}})[_0x410c('0x2b')](function(_0x7981f){return db[_0x410c('0x74')]['transaction'](function(_0xe6cdb4){return _0x7981f[_0x410c('0x79')](_0x888d6d[_0x410c('0x3f')][_0x410c('0x6e')],{'transaction':_0xe6cdb4})['then'](function(){if(!_[_0x410c('0x8c')](_0x27f0ee)){return _0x7981f['removeAgents'](_0x27f0ee,{'transaction':_0xe6cdb4});}})[_0x410c('0x2b')](function(){_0x27f0ee[_0x410c('0x77')](function(_0x195796){socket[_0x410c('0x78')](_0x410c('0x8d'),{'UserId':_0x195796,'MailQueueId':_0x7981f['id']});});});});});});})[_0x410c('0x2b')](respondWithStatusCode(_0x5e14e0,null))['catch'](handleError(_0x5e14e0,null));};exports[_0x410c('0x8e')]=function(_0x1d8605,_0x3d2f7d,_0x3db3fe){return db[_0x410c('0x39')][_0x410c('0x54')]({'where':{'id':_0x1d8605[_0x410c('0x51')]['id']}})[_0x410c('0x2b')](handleEntityNotFound(_0x3d2f7d,null))[_0x410c('0x2b')](function(_0x2b089c){if(_0x2b089c){return _0x2b089c[_0x410c('0x8e')](_0x1d8605['body'][_0x410c('0x6e')],_['omit'](_0x1d8605[_0x410c('0x33')],[_0x410c('0x6e'),'id'])||{})['spread'](function(_0x2c30c1){for(var _0x35cac5=0x0;_0x35cac5<_0x1d8605['body'][_0x410c('0x6e')][_0x410c('0x44')];_0x35cac5+=0x1){socket[_0x410c('0x78')](_0x410c('0x8f'),{'UserId':_0x1d8605[_0x410c('0x33')]['ids'][_0x35cac5],'MailQueueId':_0x1d8605[_0x410c('0x51')]['id']});}return _0x2c30c1;});}})[_0x410c('0x2b')](respondWithResult(_0x3d2f7d,null))[_0x410c('0x4f')](handleError(_0x3d2f7d,null));};exports['removeAgents']=function(_0x3f01c4,_0x4ded94,_0x2580b1){return db['MailQueue'][_0x410c('0x54')]({'where':{'id':_0x3f01c4['params']['id']}})[_0x410c('0x2b')](handleEntityNotFound(_0x4ded94,null))[_0x410c('0x2b')](function(_0x503366){if(_0x503366){return _0x503366[_0x410c('0x90')](_0x3f01c4[_0x410c('0x3f')][_0x410c('0x6e')])['then'](function(){if(_['isArray'](_0x3f01c4[_0x410c('0x3f')][_0x410c('0x6e')])){for(var _0x22a57b=0x0;_0x22a57b<_0x3f01c4[_0x410c('0x3f')][_0x410c('0x6e')][_0x410c('0x44')];_0x22a57b+=0x1){socket[_0x410c('0x78')]('userMailQueue:remove',{'UserId':Number(_0x3f01c4[_0x410c('0x3f')][_0x410c('0x6e')][_0x22a57b]),'MailQueueId':Number(_0x3f01c4['params']['id'])});}}else{socket['emit'](_0x410c('0x8d'),{'UserId':Number(_0x3f01c4['query'][_0x410c('0x6e')]),'MailQueueId':Number(_0x3f01c4[_0x410c('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x4ded94,null))[_0x410c('0x4f')](handleError(_0x4ded94,null));};exports[_0x410c('0x91')]=function(_0x52ab39,_0x53ecc7,_0x3cd569){var _0x2d3bde={};var _0x4ab1ef={};var _0x37e13f;var _0x7d24e6;return db[_0x410c('0x39')][_0x410c('0x6b')]({'where':{'id':_0x52ab39[_0x410c('0x51')]['id']}})[_0x410c('0x2b')](handleEntityNotFound(_0x53ecc7,null))['then'](function(_0x5ea4b8){if(_0x5ea4b8){_0x37e13f=_0x5ea4b8;_0x4ab1ef[_0x410c('0x3d')]=_[_0x410c('0x52')](db[_0x410c('0x64')][_0x410c('0x3a')]);_0x4ab1ef[_0x410c('0x3f')]=_[_0x410c('0x52')](_0x52ab39[_0x410c('0x3f')]);_0x4ab1ef[_0x410c('0x40')]=_[_0x410c('0x41')](_0x4ab1ef[_0x410c('0x3d')],_0x4ab1ef[_0x410c('0x3f')]);_0x2d3bde[_0x410c('0x42')]=_['intersection'](_0x4ab1ef[_0x410c('0x3d')],qs['fields'](_0x52ab39[_0x410c('0x3f')][_0x410c('0x43')]));_0x2d3bde[_0x410c('0x42')]=_0x2d3bde[_0x410c('0x42')][_0x410c('0x44')]?_0x2d3bde[_0x410c('0x42')]:_0x4ab1ef[_0x410c('0x3d')];_0x2d3bde['order']=qs[_0x410c('0x47')](_0x52ab39['query']['sort']);_0x2d3bde[_0x410c('0x48')]=qs[_0x410c('0x40')](_[_0x410c('0x49')](_0x52ab39[_0x410c('0x3f')],_0x4ab1ef[_0x410c('0x40')]));if(_0x52ab39['query'][_0x410c('0x4a')]){_0x2d3bde[_0x410c('0x48')]=_[_0x410c('0x32')](_0x2d3bde[_0x410c('0x48')],{'$or':_[_0x410c('0x3e')](_0x2d3bde['attributes'],function(_0x54bea9){var _0x299371={};_0x299371[_0x54bea9]={'$like':'%'+_0x52ab39[_0x410c('0x3f')][_0x410c('0x4a')]+'%'};return _0x299371;})});}_0x2d3bde=_[_0x410c('0x32')]({},_0x2d3bde,_0x52ab39[_0x410c('0x53')]);return _0x37e13f['getAgents'](_0x2d3bde);}})[_0x410c('0x2b')](function(_0x3b30c7){if(_0x3b30c7){_0x7d24e6=_0x3b30c7[_0x410c('0x44')];if(!_0x52ab39['query'][_0x410c('0x45')](_0x410c('0x61'))){_0x2d3bde[_0x410c('0x25')]=qs[_0x410c('0x25')](_0x52ab39[_0x410c('0x3f')][_0x410c('0x25')]);_0x2d3bde['offset']=qs[_0x410c('0x23')](_0x52ab39['query']['offset']);}return _0x37e13f[_0x410c('0x91')](_0x2d3bde);}})[_0x410c('0x2b')](function(_0x2d8cae){if(_0x2d8cae){return _0x2d8cae?{'count':_0x7d24e6,'rows':_0x2d8cae}:null;}})['then'](respondWithResult(_0x53ecc7,null))[_0x410c('0x4f')](handleError(_0x53ecc7,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 0041c03..4a6d1cb 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 _0x0280=['update','remove','emit','hook','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x16ddf5,_0x453cb9){var _0x1581ef=function(_0x3296a3){while(--_0x3296a3){_0x16ddf5['push'](_0x16ddf5['shift']());}};_0x1581ef(++_0x453cb9);}(_0x0280,0xdc));var _0x0028=function(_0x1ce738,_0x412b40){_0x1ce738=_0x1ce738-0x0;var _0xe54c5c=_0x0280[_0x1ce738];return _0xe54c5c;};'use strict';var EventEmitter=require(_0x0028('0x0'));var MailQueue=require(_0x0028('0x1'))['db'][_0x0028('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0028('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0028('0x4'),'afterDestroy':_0x0028('0x5')};function emitEvent(_0x492249){return function(_0xa71a10,_0x3de642,_0x390566){MailQueueEvents['emit'](_0x492249+':'+_0xa71a10['id'],_0xa71a10);MailQueueEvents[_0x0028('0x6')](_0x492249,_0xa71a10);_0x390566(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x0028('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xa2cb=['hasOwnProperty','hook','events','MailQueue','setMaxListeners','save','remove','emit'];(function(_0x3d8ae0,_0x418c95){var _0x2119fa=function(_0x574c28){while(--_0x574c28){_0x3d8ae0['push'](_0x3d8ae0['shift']());}};_0x2119fa(++_0x418c95);}(_0xa2cb,0x11a));var _0xba2c=function(_0x2ba638,_0x3235eb){_0x2ba638=_0x2ba638-0x0;var _0x250506=_0xa2cb[_0x2ba638];return _0x250506;};'use strict';var EventEmitter=require(_0xba2c('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xba2c('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xba2c('0x2')](0x0);var events={'afterCreate':_0xba2c('0x3'),'afterUpdate':'update','afterDestroy':_0xba2c('0x4')};function emitEvent(_0x5bdd03){return function(_0x4581e8,_0x432aba,_0x3a7224){MailQueueEvents['emit'](_0x5bdd03+':'+_0x4581e8['id'],_0x4581e8);MailQueueEvents[_0xba2c('0x5')](_0x5bdd03,_0x4581e8);_0x3a7224(null);};}for(var e in events){if(events[_0xba2c('0x6')](e)){var event=events[e];MailQueue[_0xba2c('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 68c76f3..7714a20 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 _0x5d20=['MailQueue','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x5d20,0x121));var _0x05d2=function(_0x2fe47b,_0x3e7419){_0x2fe47b=_0x2fe47b-0x0;var _0x536cd6=_0x5d20[_0x2fe47b];return _0x536cd6;};'use strict';var _=require(_0x05d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x05d2('0x1'));var moment=require(_0x05d2('0x2'));var BPromise=require(_0x05d2('0x3'));var rp=require(_0x05d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05d2('0x5'));var config=require(_0x05d2('0x6'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x4706b2,_0x36fef7){return _0x4706b2[_0x05d2('0x7')](_0x05d2('0x8'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e5e=['./mailQueue.attributes','exports','mail_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x1e5e,0x137));var _0xe1e5=function(_0x25e65e,_0x2039aa){_0x25e65e=_0x25e65e-0x0;var _0x5c69a6=_0x1e5e[_0x25e65e];return _0x5c69a6;};'use strict';var _=require(_0xe1e5('0x0'));var util=require(_0xe1e5('0x1'));var logger=require(_0xe1e5('0x2'))(_0xe1e5('0x3'));var moment=require(_0xe1e5('0x4'));var BPromise=require('bluebird');var rp=require(_0xe1e5('0x5'));var fs=require('fs');var path=require(_0xe1e5('0x6'));var rimraf=require('rimraf');var config=require(_0xe1e5('0x7'));var attributes=require(_0xe1e5('0x8'));module[_0xe1e5('0x9')]=function(_0x13357f,_0xd6d8ab){return _0x13357f['define']('MailQueue',attributes,{'tableName':_0xe1e5('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 fe0ae82..c9146e5 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 _0x9a29=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','include','map','model','find','where','ShowMailQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1b5e1f,_0x21d078){var _0x4d945c=function(_0x423192){while(--_0x423192){_0x1b5e1f['push'](_0x1b5e1f['shift']());}};_0x4d945c(++_0x21d078);}(_0x9a29,0x75));var _0x99a2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a29[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x99a2('0x0'));var util=require('util');var moment=require(_0x99a2('0x1'));var BPromise=require('bluebird');var rs=require(_0x99a2('0x2'));var fs=require('fs');var Redis=require(_0x99a2('0x3'));var db=require(_0x99a2('0x4'))['db'];var utils=require(_0x99a2('0x5'));var logger=require(_0x99a2('0x6'))(_0x99a2('0x7'));var config=require(_0x99a2('0x8'));var jayson=require(_0x99a2('0x9'));var client=jayson[_0x99a2('0xa')][_0x99a2('0xb')]({'port':0x232a});config[_0x99a2('0xc')]=_[_0x99a2('0xd')](config['redis'],{'host':_0x99a2('0xe'),'port':0x18eb});var socket=require(_0x99a2('0xf'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x99a2('0x10')](socket);function respondWithRpcPromise(_0x294538,_0x4ff276,_0x158771){return new BPromise(function(_0x1bb780,_0x26d4e3){return client[_0x99a2('0x11')](_0x294538,_0x158771)[_0x99a2('0x12')](function(_0x393f25){logger[_0x99a2('0x13')](_0x99a2('0x14'),_0x4ff276,'request\x20sent');logger[_0x99a2('0x15')](_0x99a2('0x16'),_0x4ff276,_0x99a2('0x17'),JSON[_0x99a2('0x18')](_0x393f25));if(_0x393f25[_0x99a2('0x19')]){if(_0x393f25[_0x99a2('0x19')][_0x99a2('0x1a')]===0x1f4){logger[_0x99a2('0x19')]('MailQueue,\x20%s,\x20%s',_0x4ff276,_0x393f25[_0x99a2('0x19')][_0x99a2('0x1b')]);return _0x26d4e3(_0x393f25[_0x99a2('0x19')][_0x99a2('0x1b')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x4ff276,_0x393f25['error'][_0x99a2('0x1b')]);return _0x1bb780(_0x393f25[_0x99a2('0x19')]['message']);}else{logger[_0x99a2('0x13')](_0x99a2('0x14'),_0x4ff276,'request\x20sent');_0x1bb780(_0x393f25['result'][_0x99a2('0x1b')]);}})[_0x99a2('0x1c')](function(_0x2de217){logger[_0x99a2('0x19')](_0x99a2('0x14'),_0x4ff276,_0x2de217);_0x26d4e3(_0x2de217);});});}exports[_0x99a2('0x1d')]=function(_0x4e45d9){var _0x686efb=this;return new Promise(function(_0x3b92,_0x45fbd3){return db[_0x99a2('0x1e')][_0x99a2('0x1f')]({'raw':_0x4e45d9[_0x99a2('0x20')]?_0x4e45d9[_0x99a2('0x20')][_0x99a2('0x21')]===undefined?!![]:![]:!![],'where':_0x4e45d9[_0x99a2('0x20')]?_0x4e45d9[_0x99a2('0x20')]['where']||null:null,'attributes':_0x4e45d9[_0x99a2('0x20')]?_0x4e45d9[_0x99a2('0x20')][_0x99a2('0x22')]||null:null,'limit':_0x4e45d9[_0x99a2('0x20')]?_0x4e45d9[_0x99a2('0x20')]['limit']||null:null,'include':_0x4e45d9[_0x99a2('0x20')]?_0x4e45d9[_0x99a2('0x20')][_0x99a2('0x23')]?_[_0x99a2('0x24')](_0x4e45d9['options'][_0x99a2('0x23')],function(_0x4045bf){return{'model':db[_0x4045bf[_0x99a2('0x25')]],'as':_0x4045bf['as'],'attributes':_0x4045bf['attributes'],'include':_0x4045bf[_0x99a2('0x23')]?_['map'](_0x4045bf[_0x99a2('0x23')],function(_0x2c9b25){return{'model':db[_0x2c9b25[_0x99a2('0x25')]],'as':_0x2c9b25['as'],'attributes':_0x2c9b25[_0x99a2('0x22')],'include':_0x2c9b25[_0x99a2('0x23')]?_['map'](_0x2c9b25[_0x99a2('0x23')],function(_0x13e5ef){return{'model':db[_0x13e5ef[_0x99a2('0x25')]],'as':_0x13e5ef['as'],'attributes':_0x13e5ef['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ee76a){logger['info'](_0x99a2('0x1d'),_0x4e45d9);logger['debug'](_0x99a2('0x1d'),_0x4e45d9,JSON['stringify'](_0x5ee76a));_0x3b92(_0x5ee76a);})[_0x99a2('0x1c')](function(_0x5def2f){logger[_0x99a2('0x19')]('GetMailQueue',_0x5def2f[_0x99a2('0x1b')],_0x4e45d9);_0x45fbd3(_0x686efb[_0x99a2('0x19')](0x1f4,_0x5def2f['message']));});});};exports['ShowMailQueue']=function(_0x5d28d7){var _0x250d07=this;return new Promise(function(_0x2a4114,_0x1f2777){return db[_0x99a2('0x1e')][_0x99a2('0x26')]({'raw':_0x5d28d7[_0x99a2('0x20')]?_0x5d28d7[_0x99a2('0x20')][_0x99a2('0x21')]===undefined?!![]:![]:!![],'where':_0x5d28d7[_0x99a2('0x20')]?_0x5d28d7['options'][_0x99a2('0x27')]||null:null,'attributes':_0x5d28d7[_0x99a2('0x20')]?_0x5d28d7[_0x99a2('0x20')]['attributes']||null:null,'include':_0x5d28d7[_0x99a2('0x20')]?_0x5d28d7[_0x99a2('0x20')][_0x99a2('0x23')]?_[_0x99a2('0x24')](_0x5d28d7[_0x99a2('0x20')][_0x99a2('0x23')],function(_0x3c1bf0){return{'model':db[_0x3c1bf0['model']],'as':_0x3c1bf0['as'],'attributes':_0x3c1bf0[_0x99a2('0x22')],'include':_0x3c1bf0[_0x99a2('0x23')]?_['map'](_0x3c1bf0[_0x99a2('0x23')],function(_0x25a068){return{'model':db[_0x25a068[_0x99a2('0x25')]],'as':_0x25a068['as'],'attributes':_0x25a068[_0x99a2('0x22')],'include':_0x25a068[_0x99a2('0x23')]?_[_0x99a2('0x24')](_0x25a068[_0x99a2('0x23')],function(_0x54306f){return{'model':db[_0x54306f[_0x99a2('0x25')]],'as':_0x54306f['as'],'attributes':_0x54306f['attributes']};}):[]};}):[]};}):[]:[]})[_0x99a2('0x12')](function(_0x57f80d){logger[_0x99a2('0x13')]('ShowMailQueue',_0x5d28d7);logger[_0x99a2('0x15')](_0x99a2('0x28'),_0x5d28d7,JSON[_0x99a2('0x18')](_0x57f80d));_0x2a4114(_0x57f80d);})[_0x99a2('0x1c')](function(_0x45ebbb){logger[_0x99a2('0x19')]('ShowMailQueue',_0x45ebbb[_0x99a2('0x1b')],_0x5d28d7);_0x1f2777(_0x250d07[_0x99a2('0x19')](0x1f4,_0x45ebbb[_0x99a2('0x1b')]));});});}; \ No newline at end of file +var _0xec44=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailQueue.socket','register','then','info','request\x20sent','debug','stringify','error','MailQueue,\x20%s,\x20%s','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowMailQueue','find'];(function(_0xd46033,_0xa8f11f){var _0x2c64d9=function(_0x54475c){while(--_0x54475c){_0xd46033['push'](_0xd46033['shift']());}};_0x2c64d9(++_0xa8f11f);}(_0xec44,0x18c));var _0x4ec4=function(_0x2a40b3,_0xe1c253){_0x2a40b3=_0x2a40b3-0x0;var _0x4ac6cb=_0xec44[_0x2a40b3];return _0x4ac6cb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ec4('0x0'));var db=require(_0x4ec4('0x1'))['db'];var utils=require(_0x4ec4('0x2'));var logger=require(_0x4ec4('0x3'))(_0x4ec4('0x4'));var config=require(_0x4ec4('0x5'));var jayson=require(_0x4ec4('0x6'));var client=jayson[_0x4ec4('0x7')][_0x4ec4('0x8')]({'port':0x232a});config[_0x4ec4('0x9')]=_[_0x4ec4('0xa')](config[_0x4ec4('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ec4('0x9')]));require(_0x4ec4('0xb'))[_0x4ec4('0xc')](socket);function respondWithRpcPromise(_0x196ecc,_0x3cc647,_0x516135){return new BPromise(function(_0x5658b2,_0x106972){return client['request'](_0x196ecc,_0x516135)[_0x4ec4('0xd')](function(_0x3e2d7f){logger[_0x4ec4('0xe')]('MailQueue,\x20%s,\x20%s',_0x3cc647,_0x4ec4('0xf'));logger[_0x4ec4('0x10')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x3cc647,_0x4ec4('0xf'),JSON[_0x4ec4('0x11')](_0x3e2d7f));if(_0x3e2d7f[_0x4ec4('0x12')]){if(_0x3e2d7f['error']['code']===0x1f4){logger['error'](_0x4ec4('0x13'),_0x3cc647,_0x3e2d7f['error'][_0x4ec4('0x14')]);return _0x106972(_0x3e2d7f[_0x4ec4('0x12')]['message']);}logger[_0x4ec4('0x12')](_0x4ec4('0x13'),_0x3cc647,_0x3e2d7f[_0x4ec4('0x12')][_0x4ec4('0x14')]);return _0x5658b2(_0x3e2d7f['error']['message']);}else{logger[_0x4ec4('0xe')](_0x4ec4('0x13'),_0x3cc647,_0x4ec4('0xf'));_0x5658b2(_0x3e2d7f[_0x4ec4('0x15')][_0x4ec4('0x14')]);}})['catch'](function(_0x2e6a74){logger[_0x4ec4('0x12')](_0x4ec4('0x13'),_0x3cc647,_0x2e6a74);_0x106972(_0x2e6a74);});});}exports[_0x4ec4('0x16')]=function(_0x5096aa){var _0x17fd31=this;return new Promise(function(_0x5dcaca,_0x22e401){return db[_0x4ec4('0x17')][_0x4ec4('0x18')]({'raw':_0x5096aa[_0x4ec4('0x19')]?_0x5096aa[_0x4ec4('0x19')][_0x4ec4('0x1a')]===undefined?!![]:![]:!![],'where':_0x5096aa[_0x4ec4('0x19')]?_0x5096aa[_0x4ec4('0x19')][_0x4ec4('0x1b')]||null:null,'attributes':_0x5096aa[_0x4ec4('0x19')]?_0x5096aa['options'][_0x4ec4('0x1c')]||null:null,'limit':_0x5096aa['options']?_0x5096aa[_0x4ec4('0x19')][_0x4ec4('0x1d')]||null:null,'include':_0x5096aa[_0x4ec4('0x19')]?_0x5096aa[_0x4ec4('0x19')][_0x4ec4('0x1e')]?_[_0x4ec4('0x1f')](_0x5096aa[_0x4ec4('0x19')][_0x4ec4('0x1e')],function(_0x203213){return{'model':db[_0x203213[_0x4ec4('0x20')]],'as':_0x203213['as'],'attributes':_0x203213[_0x4ec4('0x1c')],'include':_0x203213[_0x4ec4('0x1e')]?_[_0x4ec4('0x1f')](_0x203213['include'],function(_0x3ccd6a){return{'model':db[_0x3ccd6a['model']],'as':_0x3ccd6a['as'],'attributes':_0x3ccd6a['attributes'],'include':_0x3ccd6a[_0x4ec4('0x1e')]?_['map'](_0x3ccd6a[_0x4ec4('0x1e')],function(_0x4e65fd){return{'model':db[_0x4e65fd[_0x4ec4('0x20')]],'as':_0x4e65fd['as'],'attributes':_0x4e65fd['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ec4('0xd')](function(_0x3a8c36){logger[_0x4ec4('0xe')](_0x4ec4('0x16'),_0x5096aa);logger[_0x4ec4('0x10')]('GetMailQueue',_0x5096aa,JSON[_0x4ec4('0x11')](_0x3a8c36));_0x5dcaca(_0x3a8c36);})[_0x4ec4('0x21')](function(_0x11d9d5){logger['error'](_0x4ec4('0x16'),_0x11d9d5[_0x4ec4('0x14')],_0x5096aa);_0x22e401(_0x17fd31[_0x4ec4('0x12')](0x1f4,_0x11d9d5['message']));});});};exports[_0x4ec4('0x22')]=function(_0x52024f){var _0x428209=this;return new Promise(function(_0x214d66,_0x5f35a9){return db[_0x4ec4('0x17')][_0x4ec4('0x23')]({'raw':_0x52024f[_0x4ec4('0x19')]?_0x52024f[_0x4ec4('0x19')][_0x4ec4('0x1a')]===undefined?!![]:![]:!![],'where':_0x52024f[_0x4ec4('0x19')]?_0x52024f[_0x4ec4('0x19')]['where']||null:null,'attributes':_0x52024f['options']?_0x52024f[_0x4ec4('0x19')][_0x4ec4('0x1c')]||null:null,'include':_0x52024f['options']?_0x52024f['options']['include']?_[_0x4ec4('0x1f')](_0x52024f['options']['include'],function(_0x3178d4){return{'model':db[_0x3178d4[_0x4ec4('0x20')]],'as':_0x3178d4['as'],'attributes':_0x3178d4[_0x4ec4('0x1c')],'include':_0x3178d4['include']?_[_0x4ec4('0x1f')](_0x3178d4[_0x4ec4('0x1e')],function(_0x1b8db3){return{'model':db[_0x1b8db3[_0x4ec4('0x20')]],'as':_0x1b8db3['as'],'attributes':_0x1b8db3[_0x4ec4('0x1c')],'include':_0x1b8db3[_0x4ec4('0x1e')]?_['map'](_0x1b8db3[_0x4ec4('0x1e')],function(_0x3fb3bd){return{'model':db[_0x3fb3bd[_0x4ec4('0x20')]],'as':_0x3fb3bd['as'],'attributes':_0x3fb3bd[_0x4ec4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b8ade){logger[_0x4ec4('0xe')](_0x4ec4('0x22'),_0x52024f);logger[_0x4ec4('0x10')]('ShowMailQueue',_0x52024f,JSON[_0x4ec4('0x11')](_0x1b8ade));_0x214d66(_0x1b8ade);})[_0x4ec4('0x21')](function(_0x32445c){logger[_0x4ec4('0x12')](_0x4ec4('0x22'),_0x32445c[_0x4ec4('0x14')],_0x52024f);_0x5f35a9(_0x428209[_0x4ec4('0x12')](0x1f4,_0x32445c[_0x4ec4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index c3f1a8d..4f09dff 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 _0xc5dd=['update','emit','removeListener','register','mailQueue:','./mailQueue.events','save','remove'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc5dd,0xa5));var _0xdc5d=function(_0x13630b,_0x4624b8){_0x13630b=_0x13630b-0x0;var _0xdeea95=_0xc5dd[_0x13630b];return _0xdeea95;};'use strict';var MailQueueEvents=require(_0xdc5d('0x0'));var events=[_0xdc5d('0x1'),_0xdc5d('0x2'),_0xdc5d('0x3')];function createListener(_0x1d97a4,_0x3b3c98){return function(_0x31f3d0){_0x3b3c98[_0xdc5d('0x4')](_0x1d97a4,_0x31f3d0);};}function removeListener(_0x5a4564,_0x3439e7){return function(){MailQueueEvents[_0xdc5d('0x5')](_0x5a4564,_0x3439e7);};}exports[_0xdc5d('0x6')]=function(_0x49c019){for(var _0x581c32=0x0,_0x30e5a9=events['length'];_0x581c32<_0x30e5a9;_0x581c32++){var _0x2e289a=events[_0x581c32];var _0x1bf628=createListener(_0xdc5d('0x7')+_0x2e289a,_0x49c019);MailQueueEvents['on'](_0x2e289a,_0x1bf628);}}; \ No newline at end of file +var _0x1ad4=['register','length','mailQueue:','./mailQueue.events','remove','update','emit','removeListener'];(function(_0x468dec,_0x1ad0b4){var _0x16d1b4=function(_0x29522f){while(--_0x29522f){_0x468dec['push'](_0x468dec['shift']());}};_0x16d1b4(++_0x1ad0b4);}(_0x1ad4,0x133));var _0x41ad=function(_0x1539f5,_0x13f63d){_0x1539f5=_0x1539f5-0x0;var _0x163ab2=_0x1ad4[_0x1539f5];return _0x163ab2;};'use strict';var MailQueueEvents=require(_0x41ad('0x0'));var events=['save',_0x41ad('0x1'),_0x41ad('0x2')];function createListener(_0x3755a4,_0x46d72e){return function(_0x1fe7b5){_0x46d72e[_0x41ad('0x3')](_0x3755a4,_0x1fe7b5);};}function removeListener(_0x167b11,_0x5e4b28){return function(){MailQueueEvents[_0x41ad('0x4')](_0x167b11,_0x5e4b28);};}exports[_0x41ad('0x5')]=function(_0x500db3){for(var _0x3d8758=0x0,_0x108ca0=events[_0x41ad('0x6')];_0x3d8758<_0x108ca0;_0x3d8758++){var _0x9c9dbe=events[_0x3d8758];var _0x3d636f=createListener(_0x41ad('0x7')+_0x9c9dbe,_0x500db3);MailQueueEvents['on'](_0x9c9dbe,_0x3d636f);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6aee647..e58a7e1 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 _0x1ea1=['get','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1ea1,0xce));var _0x11ea=function(_0x26a12e,_0x25d1b5){_0x26a12e=_0x26a12e-0x0;var _0x4a09d1=_0x1ea1[_0x26a12e];return _0x4a09d1;};'use strict';var multer=require(_0x11ea('0x0'));var util=require(_0x11ea('0x1'));var path=require('path');var timeout=require(_0x11ea('0x2'));var express=require(_0x11ea('0x3'));var router=express['Router']();var fs_extra=require(_0x11ea('0x4'));var auth=require(_0x11ea('0x5'));var interaction=require(_0x11ea('0x6'));var config=require(_0x11ea('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x11ea('0x8')](),controller['index']);router['get'](_0x11ea('0x9'),auth[_0x11ea('0x8')](),controller['describe']);router[_0x11ea('0xa')]('/:id',auth[_0x11ea('0x8')](),controller['show']);router[_0x11ea('0xb')]('/',auth[_0x11ea('0x8')](),controller[_0x11ea('0xc')]);router[_0x11ea('0xd')](_0x11ea('0xe'),auth[_0x11ea('0x8')](),controller[_0x11ea('0xf')]);router['delete'](_0x11ea('0xe'),auth[_0x11ea('0x8')](),controller[_0x11ea('0x10')]);module[_0x11ea('0x11')]=router; \ No newline at end of file +var _0xabd8=['post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x1da0cf,_0x3a8657){var _0x378f4=function(_0x57921c){while(--_0x57921c){_0x1da0cf['push'](_0x1da0cf['shift']());}};_0x378f4(++_0x3a8657);}(_0xabd8,0x142));var _0x8abd=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xabd8[_0x519756];return _0x37047e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8abd('0x0'));var express=require(_0x8abd('0x1'));var router=express[_0x8abd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8abd('0x3'));var interaction=require(_0x8abd('0x4'));var config=require(_0x8abd('0x5'));var controller=require(_0x8abd('0x6'));router[_0x8abd('0x7')]('/',auth[_0x8abd('0x8')](),controller[_0x8abd('0x9')]);router[_0x8abd('0x7')](_0x8abd('0xa'),auth[_0x8abd('0x8')](),controller[_0x8abd('0xb')]);router[_0x8abd('0x7')](_0x8abd('0xc'),auth['isAuthenticated'](),controller[_0x8abd('0xd')]);router[_0x8abd('0xe')]('/',auth[_0x8abd('0x8')](),controller[_0x8abd('0xf')]);router[_0x8abd('0x10')](_0x8abd('0xc'),auth[_0x8abd('0x8')](),controller[_0x8abd('0x11')]);router[_0x8abd('0x12')](_0x8abd('0xc'),auth['isAuthenticated'](),controller[_0x8abd('0x13')]);module[_0x8abd('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index b51a72b..a69f479 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 _0x0452=['exports','STRING','DATE'];(function(_0x4a4417,_0x2dc57b){var _0x4c1c8e=function(_0x5bb8ff){while(--_0x5bb8ff){_0x4a4417['push'](_0x4a4417['shift']());}};_0x4c1c8e(++_0x2dc57b);}(_0x0452,0xa8));var _0x2045=function(_0x22420c,_0x2d1f90){_0x22420c=_0x22420c-0x0;var _0x5e59b6=_0x0452[_0x22420c];return _0x5e59b6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x2045('0x0')]={'uniqueid':{'type':Sequelize[_0x2045('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x2045('0x1')]},'joinAt':{'type':Sequelize[_0x2045('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2045('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2045('0x1')]}}; \ No newline at end of file +var _0xb357=['DATE','moment','sequelize','exports','STRING'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0xb357,0xd3));var _0x7b35=function(_0x31646a,_0x272005){_0x31646a=_0x31646a-0x0;var _0x5c6608=_0xb357[_0x31646a];return _0x5c6608;};'use strict';var moment=require(_0x7b35('0x0'));var Sequelize=require(_0x7b35('0x1'));module[_0x7b35('0x2')]={'uniqueid':{'type':Sequelize[_0x7b35('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7b35('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7b35('0x4')]},'acceptAt':{'type':Sequelize[_0x7b35('0x4')]},'exitAt':{'type':Sequelize[_0x7b35('0x4')]},'reason':{'type':Sequelize[_0x7b35('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c753110..7435090 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 _0x5530=['length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','options','include','findAll','catch','show','includeAll','create','update','params','destroy','find','describe','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','MailQueueReport','rawAttributes','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x47b0fe,_0xa33bd4){var _0x5d5d0d=function(_0x27dd52){while(--_0x27dd52){_0x47b0fe['push'](_0x47b0fe['shift']());}};_0x5d5d0d(++_0xa33bd4);}(_0x5530,0x1ab));var _0x0553=function(_0x28e8a8,_0x4718ed){_0x28e8a8=_0x28e8a8-0x0;var _0xf1c7d6=_0x5530[_0x28e8a8];return _0xf1c7d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0553('0x0'));var jsonpatch=require(_0x0553('0x1'));var rp=require(_0x0553('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0553('0x3'));var util=require(_0x0553('0x4'));var path=require(_0x0553('0x5'));var sox=require(_0x0553('0x6'));var csv=require(_0x0553('0x7'));var ejs=require(_0x0553('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0553('0x9'));var squel=require('squel');var crypto=require(_0x0553('0xa'));var jsforce=require(_0x0553('0xb'));var deskjs=require(_0x0553('0xc'));var toCsv=require(_0x0553('0x7'));var querystring=require(_0x0553('0xd'));var Papa=require(_0x0553('0xe'));var Redis=require('ioredis');var authService=require(_0x0553('0xf'));var qs=require(_0x0553('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0553('0x11'));var logger=require('../../config/logger')(_0x0553('0x12'));var utils=require(_0x0553('0x13'));var config=require(_0x0553('0x14'));var licenseUtil=require(_0x0553('0x15'));var db=require(_0x0553('0x16'))['db'];function respondWithStatusCode(_0x54bf6a,_0x2ec7a4){_0x2ec7a4=_0x2ec7a4||0xcc;return function(_0x437bd1){if(_0x437bd1){return _0x54bf6a[_0x0553('0x17')](_0x2ec7a4);}return _0x54bf6a['status'](_0x2ec7a4)[_0x0553('0x18')]();};}function respondWithResult(_0x2b0b54,_0x5e6c08){_0x5e6c08=_0x5e6c08||0xc8;return function(_0x3d69c1){if(_0x3d69c1){return _0x2b0b54[_0x0553('0x19')](_0x5e6c08)[_0x0553('0x1a')](_0x3d69c1);}};}function respondWithFilteredResult(_0x310155,_0x3e52a7){return function(_0x1ad510){if(_0x1ad510){var _0x645463=typeof _0x3e52a7[_0x0553('0x1b')]==='undefined'&&typeof _0x3e52a7[_0x0553('0x1c')]===_0x0553('0x1d');var _0x4a01f=_0x1ad510[_0x0553('0x1e')];var _0x5114f4=_0x645463?0x0:_0x3e52a7[_0x0553('0x1b')];var _0xf1bb6f=_0x645463?_0x1ad510[_0x0553('0x1e')]:_0x3e52a7['offset']+_0x3e52a7[_0x0553('0x1c')];var _0x279e86;if(_0xf1bb6f>=_0x4a01f){_0xf1bb6f=_0x4a01f;_0x279e86=0xc8;}else{_0x279e86=0xce;}_0x310155[_0x0553('0x19')](_0x279e86);return _0x310155[_0x0553('0x1f')](_0x0553('0x20'),_0x5114f4+'-'+_0xf1bb6f+'/'+_0x4a01f)['json'](_0x1ad510);}return null;};}function patchUpdates(_0x88eee0){return function(_0x13b28d){try{jsonpatch[_0x0553('0x21')](_0x13b28d,_0x88eee0,!![]);}catch(_0x181fb0){return BPromise['reject'](_0x181fb0);}return _0x13b28d[_0x0553('0x22')]();};}function saveUpdates(_0x37b595,_0x5138e6){return function(_0x520e3a){if(_0x520e3a){return _0x520e3a['update'](_0x37b595)[_0x0553('0x23')](function(_0x949528){return _0x949528;});}return null;};}function removeEntity(_0xfb773b,_0x235408){return function(_0x3d1020){if(_0x3d1020){return _0x3d1020['destroy']()['then'](function(){_0xfb773b[_0x0553('0x19')](0xcc)[_0x0553('0x18')]();});}};}function handleEntityNotFound(_0x4d8620,_0x203427){return function(_0x272eef){if(!_0x272eef){_0x4d8620[_0x0553('0x17')](0x194);}return _0x272eef;};}function handleError(_0x3116e6,_0x16d002){_0x16d002=_0x16d002||0x1f4;return function(_0x2e6413){logger[_0x0553('0x24')](_0x2e6413[_0x0553('0x25')]);if(_0x2e6413[_0x0553('0x26')]){delete _0x2e6413['name'];}_0x3116e6[_0x0553('0x19')](_0x16d002)[_0x0553('0x27')](_0x2e6413);};}function getMustacheRender(_0x23df20,_0x2ae36b){return Mustache[_0x0553('0x28')](_0x23df20,_[_0x0553('0x29')](_0x2ae36b[_0x0553('0x2a')],{'contact':_0x2ae36b[_0x0553('0x2b')],'message':_0x2ae36b[_0x0553('0x2c')],'agent':_0x2ae36b[_0x0553('0x2d')],'interaction':_0x2ae36b[_0x0553('0x2e')],'account':_0x2ae36b[_0x0553('0x2f')]}))||'';}exports[_0x0553('0x30')]=function(_0x805283,_0x4ca10b){var _0x16cad7={},_0x1b2790={},_0x5f330f={'count':0x0,'rows':[]};var _0x4b2c19=_['map'](db[_0x0553('0x31')][_0x0553('0x32')],function(_0x83fe99){return{'name':_0x83fe99['fieldName'],'type':_0x83fe99['type']['key']};});_0x1b2790[_0x0553('0x33')]=_[_0x0553('0x34')](_0x4b2c19,'name');_0x1b2790[_0x0553('0x35')]=_[_0x0553('0x36')](_0x805283[_0x0553('0x35')]);_0x1b2790[_0x0553('0x37')]=_[_0x0553('0x38')](_0x1b2790['model'],_0x1b2790['query']);_0x16cad7['attributes']=_[_0x0553('0x38')](_0x1b2790[_0x0553('0x33')],qs[_0x0553('0x39')](_0x805283[_0x0553('0x35')][_0x0553('0x39')]));_0x16cad7[_0x0553('0x3a')]=_0x16cad7[_0x0553('0x3a')][_0x0553('0x3b')]?_0x16cad7['attributes']:_0x1b2790['model'];if(!_0x805283[_0x0553('0x35')][_0x0553('0x3c')](_0x0553('0x3d'))){_0x16cad7[_0x0553('0x1c')]=qs[_0x0553('0x1c')](_0x805283[_0x0553('0x35')]['limit']);_0x16cad7['offset']=qs[_0x0553('0x1b')](_0x805283[_0x0553('0x35')][_0x0553('0x1b')]);}_0x16cad7[_0x0553('0x3e')]=qs[_0x0553('0x3f')](_0x805283[_0x0553('0x35')][_0x0553('0x3f')]);_0x16cad7['where']=qs[_0x0553('0x37')](_[_0x0553('0x40')](_0x805283[_0x0553('0x35')],_0x1b2790[_0x0553('0x37')]),_0x4b2c19);if(_0x805283[_0x0553('0x35')]['filter']){_0x16cad7[_0x0553('0x41')]=_[_0x0553('0x29')](_0x16cad7[_0x0553('0x41')],{'$or':_[_0x0553('0x34')](_0x4b2c19,function(_0xbfabfb){if(_0xbfabfb[_0x0553('0x42')]!==_0x0553('0x43')){var _0x33b753={};_0x33b753[_0xbfabfb[_0x0553('0x26')]]={'$like':'%'+_0x805283['query'][_0x0553('0x44')]+'%'};return _0x33b753;}})});}_0x16cad7=_[_0x0553('0x29')]({},_0x16cad7,_0x805283[_0x0553('0x45')]);var _0x1db4f1={'where':_0x16cad7[_0x0553('0x41')]};return db[_0x0553('0x31')][_0x0553('0x1e')](_0x1db4f1)[_0x0553('0x23')](function(_0x43d04e){_0x5f330f['count']=_0x43d04e;if(_0x805283[_0x0553('0x35')]['includeAll']){_0x16cad7[_0x0553('0x46')]=[{'all':!![]}];}return db[_0x0553('0x31')][_0x0553('0x47')](_0x16cad7);})[_0x0553('0x23')](function(_0x349bfe){_0x5f330f['rows']=_0x349bfe;return _0x5f330f;})[_0x0553('0x23')](respondWithFilteredResult(_0x4ca10b,_0x16cad7))[_0x0553('0x48')](handleError(_0x4ca10b,null));};exports[_0x0553('0x49')]=function(_0x17933b,_0x4c3e44){var _0x446ede={'raw':!![],'where':{'id':_0x17933b['params']['id']}},_0x1702b8={};_0x1702b8['model']=_[_0x0553('0x36')](db[_0x0553('0x31')][_0x0553('0x32')]);_0x1702b8[_0x0553('0x35')]=_['keys'](_0x17933b[_0x0553('0x35')]);_0x1702b8['filters']=_[_0x0553('0x38')](_0x1702b8[_0x0553('0x33')],_0x1702b8[_0x0553('0x35')]);_0x446ede[_0x0553('0x3a')]=_['intersection'](_0x1702b8[_0x0553('0x33')],qs['fields'](_0x17933b[_0x0553('0x35')][_0x0553('0x39')]));_0x446ede['attributes']=_0x446ede[_0x0553('0x3a')]['length']?_0x446ede[_0x0553('0x3a')]:_0x1702b8[_0x0553('0x33')];if(_0x17933b[_0x0553('0x35')][_0x0553('0x4a')]){_0x446ede[_0x0553('0x46')]=[{'all':!![]}];}_0x446ede=_[_0x0553('0x29')]({},_0x446ede,_0x17933b[_0x0553('0x45')]);return db[_0x0553('0x31')]['find'](_0x446ede)[_0x0553('0x23')](handleEntityNotFound(_0x4c3e44,null))[_0x0553('0x23')](respondWithResult(_0x4c3e44,null))[_0x0553('0x48')](handleError(_0x4c3e44,null));};exports['create']=function(_0xde47cd,_0x21eead){return db[_0x0553('0x31')][_0x0553('0x4b')](_0xde47cd[_0x0553('0x2a')],{})[_0x0553('0x23')](respondWithResult(_0x21eead,0xc9))['catch'](handleError(_0x21eead,null));};exports[_0x0553('0x4c')]=function(_0x235052,_0x5c848d){if(_0x235052[_0x0553('0x2a')]['id']){delete _0x235052['body']['id'];}return db[_0x0553('0x31')]['find']({'where':{'id':_0x235052[_0x0553('0x4d')]['id']}})[_0x0553('0x23')](handleEntityNotFound(_0x5c848d,null))[_0x0553('0x23')](saveUpdates(_0x235052[_0x0553('0x2a')],null))[_0x0553('0x23')](respondWithResult(_0x5c848d,null))[_0x0553('0x48')](handleError(_0x5c848d,null));};exports[_0x0553('0x4e')]=function(_0x1fea1b,_0xab7c44){return db['MailQueueReport'][_0x0553('0x4f')]({'where':{'id':_0x1fea1b['params']['id']}})[_0x0553('0x23')](handleEntityNotFound(_0xab7c44,null))['then'](removeEntity(_0xab7c44,null))['catch'](handleError(_0xab7c44,null));};exports[_0x0553('0x50')]=function(_0x3ce4a9,_0x188fa5){return db[_0x0553('0x31')][_0x0553('0x50')]()[_0x0553('0x23')](respondWithResult(_0x188fa5,null))[_0x0553('0x48')](handleError(_0x188fa5,null));}; \ No newline at end of file +var _0xed65=['account','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','name','includeAll','include','MailQueueReport','findAll','rows','show','params','keys','options','find','create','catch','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','set','Content-Range','update','destroy','then','status','stack','render','merge','body','contact','agent','interaction'];(function(_0x29fc87,_0x5b1228){var _0x1741b6=function(_0x1c958e){while(--_0x1c958e){_0x29fc87['push'](_0x29fc87['shift']());}};_0x1741b6(++_0x5b1228);}(_0xed65,0x1ef));var _0x5ed6=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0xed65[_0x1ebeea];return _0x576465;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ed6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ed6('0x1'));var rp=require(_0x5ed6('0x2'));var moment=require(_0x5ed6('0x3'));var BPromise=require(_0x5ed6('0x4'));var Mustache=require('mustache');var util=require(_0x5ed6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5ed6('0x6'));var ejs=require(_0x5ed6('0x7'));var fs=require('fs');var fs_extra=require(_0x5ed6('0x8'));var _=require(_0x5ed6('0x9'));var squel=require(_0x5ed6('0xa'));var crypto=require(_0x5ed6('0xb'));var jsforce=require(_0x5ed6('0xc'));var deskjs=require(_0x5ed6('0xd'));var toCsv=require(_0x5ed6('0x6'));var querystring=require('querystring');var Papa=require(_0x5ed6('0xe'));var Redis=require(_0x5ed6('0xf'));var authService=require(_0x5ed6('0x10'));var qs=require(_0x5ed6('0x11'));var as=require(_0x5ed6('0x12'));var hardwareService=require(_0x5ed6('0x13'));var logger=require(_0x5ed6('0x14'))(_0x5ed6('0x15'));var utils=require('../../config/utils');var config=require(_0x5ed6('0x16'));var licenseUtil=require(_0x5ed6('0x17'));var db=require(_0x5ed6('0x18'))['db'];function respondWithStatusCode(_0x164dd5,_0x48a171){_0x48a171=_0x48a171||0xcc;return function(_0x2ec89e){if(_0x2ec89e){return _0x164dd5[_0x5ed6('0x19')](_0x48a171);}return _0x164dd5['status'](_0x48a171)[_0x5ed6('0x1a')]();};}function respondWithResult(_0x9e9222,_0xe983e1){_0xe983e1=_0xe983e1||0xc8;return function(_0x1b64da){if(_0x1b64da){return _0x9e9222['status'](_0xe983e1)[_0x5ed6('0x1b')](_0x1b64da);}};}function respondWithFilteredResult(_0x3746cd,_0x5a96d7){return function(_0x3503a2){if(_0x3503a2){var _0xe9ac0f=typeof _0x5a96d7[_0x5ed6('0x1c')]==='undefined'&&typeof _0x5a96d7[_0x5ed6('0x1d')]==='undefined';var _0x4c2d39=_0x3503a2[_0x5ed6('0x1e')];var _0x11c185=_0xe9ac0f?0x0:_0x5a96d7[_0x5ed6('0x1c')];var _0xd4db61=_0xe9ac0f?_0x3503a2['count']:_0x5a96d7[_0x5ed6('0x1c')]+_0x5a96d7[_0x5ed6('0x1d')];var _0x25216a;if(_0xd4db61>=_0x4c2d39){_0xd4db61=_0x4c2d39;_0x25216a=0xc8;}else{_0x25216a=0xce;}_0x3746cd['status'](_0x25216a);return _0x3746cd[_0x5ed6('0x1f')](_0x5ed6('0x20'),_0x11c185+'-'+_0xd4db61+'/'+_0x4c2d39)[_0x5ed6('0x1b')](_0x3503a2);}return null;};}function patchUpdates(_0x57531b){return function(_0x37f508){try{jsonpatch['apply'](_0x37f508,_0x57531b,!![]);}catch(_0x5ac440){return BPromise['reject'](_0x5ac440);}return _0x37f508['save']();};}function saveUpdates(_0xeac00e,_0x557106){return function(_0x3b8ad3){if(_0x3b8ad3){return _0x3b8ad3[_0x5ed6('0x21')](_0xeac00e)['then'](function(_0x486d14){return _0x486d14;});}return null;};}function removeEntity(_0x1c9592,_0x12962d){return function(_0x1e54e1){if(_0x1e54e1){return _0x1e54e1[_0x5ed6('0x22')]()[_0x5ed6('0x23')](function(){_0x1c9592[_0x5ed6('0x24')](0xcc)[_0x5ed6('0x1a')]();});}};}function handleEntityNotFound(_0x32a1b2,_0xad6692){return function(_0x359644){if(!_0x359644){_0x32a1b2[_0x5ed6('0x19')](0x194);}return _0x359644;};}function handleError(_0x5e3074,_0x48344d){_0x48344d=_0x48344d||0x1f4;return function(_0x49fa24){logger['error'](_0x49fa24[_0x5ed6('0x25')]);if(_0x49fa24['name']){delete _0x49fa24['name'];}_0x5e3074[_0x5ed6('0x24')](_0x48344d)['send'](_0x49fa24);};}function getMustacheRender(_0x2b8f4a,_0x1d617e){return Mustache[_0x5ed6('0x26')](_0x2b8f4a,_[_0x5ed6('0x27')](_0x1d617e[_0x5ed6('0x28')],{'contact':_0x1d617e[_0x5ed6('0x29')],'message':_0x1d617e['message'],'agent':_0x1d617e[_0x5ed6('0x2a')],'interaction':_0x1d617e[_0x5ed6('0x2b')],'account':_0x1d617e[_0x5ed6('0x2c')]}))||'';}exports['index']=function(_0xad5245,_0x327124){var _0x41ffa4={},_0x1eb5fc={},_0x28c782={'count':0x0,'rows':[]};var _0x3c2231=_['map'](db['MailQueueReport'][_0x5ed6('0x2d')],function(_0x1a3446){return{'name':_0x1a3446[_0x5ed6('0x2e')],'type':_0x1a3446[_0x5ed6('0x2f')][_0x5ed6('0x30')]};});_0x1eb5fc[_0x5ed6('0x31')]=_['map'](_0x3c2231,'name');_0x1eb5fc[_0x5ed6('0x32')]=_['keys'](_0xad5245[_0x5ed6('0x32')]);_0x1eb5fc['filters']=_[_0x5ed6('0x33')](_0x1eb5fc[_0x5ed6('0x31')],_0x1eb5fc[_0x5ed6('0x32')]);_0x41ffa4[_0x5ed6('0x34')]=_['intersection'](_0x1eb5fc[_0x5ed6('0x31')],qs[_0x5ed6('0x35')](_0xad5245['query'][_0x5ed6('0x35')]));_0x41ffa4[_0x5ed6('0x34')]=_0x41ffa4['attributes'][_0x5ed6('0x36')]?_0x41ffa4[_0x5ed6('0x34')]:_0x1eb5fc[_0x5ed6('0x31')];if(!_0xad5245[_0x5ed6('0x32')][_0x5ed6('0x37')]('nolimit')){_0x41ffa4[_0x5ed6('0x1d')]=qs[_0x5ed6('0x1d')](_0xad5245[_0x5ed6('0x32')][_0x5ed6('0x1d')]);_0x41ffa4[_0x5ed6('0x1c')]=qs[_0x5ed6('0x1c')](_0xad5245['query']['offset']);}_0x41ffa4[_0x5ed6('0x38')]=qs[_0x5ed6('0x39')](_0xad5245[_0x5ed6('0x32')][_0x5ed6('0x39')]);_0x41ffa4[_0x5ed6('0x3a')]=qs[_0x5ed6('0x3b')](_[_0x5ed6('0x3c')](_0xad5245[_0x5ed6('0x32')],_0x1eb5fc[_0x5ed6('0x3b')]),_0x3c2231);if(_0xad5245[_0x5ed6('0x32')][_0x5ed6('0x3d')]){_0x41ffa4['where']=_[_0x5ed6('0x27')](_0x41ffa4['where'],{'$or':_['map'](_0x3c2231,function(_0x4556a4){if(_0x4556a4['type']!==_0x5ed6('0x3e')){var _0x29b556={};_0x29b556[_0x4556a4[_0x5ed6('0x3f')]]={'$like':'%'+_0xad5245[_0x5ed6('0x32')]['filter']+'%'};return _0x29b556;}})});}_0x41ffa4=_['merge']({},_0x41ffa4,_0xad5245['options']);var _0x488148={'where':_0x41ffa4[_0x5ed6('0x3a')]};return db['MailQueueReport'][_0x5ed6('0x1e')](_0x488148)['then'](function(_0xb72b3){_0x28c782[_0x5ed6('0x1e')]=_0xb72b3;if(_0xad5245[_0x5ed6('0x32')][_0x5ed6('0x40')]){_0x41ffa4[_0x5ed6('0x41')]=[{'all':!![]}];}return db[_0x5ed6('0x42')][_0x5ed6('0x43')](_0x41ffa4);})['then'](function(_0x490d1f){_0x28c782[_0x5ed6('0x44')]=_0x490d1f;return _0x28c782;})[_0x5ed6('0x23')](respondWithFilteredResult(_0x327124,_0x41ffa4))['catch'](handleError(_0x327124,null));};exports[_0x5ed6('0x45')]=function(_0x12598a,_0x44404c){var _0x2bdcdc={'raw':!![],'where':{'id':_0x12598a[_0x5ed6('0x46')]['id']}},_0xaeb607={};_0xaeb607[_0x5ed6('0x31')]=_[_0x5ed6('0x47')](db[_0x5ed6('0x42')][_0x5ed6('0x2d')]);_0xaeb607[_0x5ed6('0x32')]=_[_0x5ed6('0x47')](_0x12598a[_0x5ed6('0x32')]);_0xaeb607[_0x5ed6('0x3b')]=_[_0x5ed6('0x33')](_0xaeb607[_0x5ed6('0x31')],_0xaeb607[_0x5ed6('0x32')]);_0x2bdcdc['attributes']=_[_0x5ed6('0x33')](_0xaeb607[_0x5ed6('0x31')],qs['fields'](_0x12598a[_0x5ed6('0x32')]['fields']));_0x2bdcdc['attributes']=_0x2bdcdc[_0x5ed6('0x34')][_0x5ed6('0x36')]?_0x2bdcdc[_0x5ed6('0x34')]:_0xaeb607['model'];if(_0x12598a[_0x5ed6('0x32')][_0x5ed6('0x40')]){_0x2bdcdc[_0x5ed6('0x41')]=[{'all':!![]}];}_0x2bdcdc=_[_0x5ed6('0x27')]({},_0x2bdcdc,_0x12598a[_0x5ed6('0x48')]);return db[_0x5ed6('0x42')][_0x5ed6('0x49')](_0x2bdcdc)[_0x5ed6('0x23')](handleEntityNotFound(_0x44404c,null))[_0x5ed6('0x23')](respondWithResult(_0x44404c,null))['catch'](handleError(_0x44404c,null));};exports[_0x5ed6('0x4a')]=function(_0x13d589,_0x1935c4){return db[_0x5ed6('0x42')][_0x5ed6('0x4a')](_0x13d589[_0x5ed6('0x28')],{})['then'](respondWithResult(_0x1935c4,0xc9))[_0x5ed6('0x4b')](handleError(_0x1935c4,null));};exports[_0x5ed6('0x21')]=function(_0x52dcbf,_0x2ef17f){if(_0x52dcbf[_0x5ed6('0x28')]['id']){delete _0x52dcbf[_0x5ed6('0x28')]['id'];}return db['MailQueueReport'][_0x5ed6('0x49')]({'where':{'id':_0x52dcbf[_0x5ed6('0x46')]['id']}})[_0x5ed6('0x23')](handleEntityNotFound(_0x2ef17f,null))[_0x5ed6('0x23')](saveUpdates(_0x52dcbf[_0x5ed6('0x28')],null))[_0x5ed6('0x23')](respondWithResult(_0x2ef17f,null))[_0x5ed6('0x4b')](handleError(_0x2ef17f,null));};exports[_0x5ed6('0x22')]=function(_0x556085,_0x297381){return db[_0x5ed6('0x42')]['find']({'where':{'id':_0x556085[_0x5ed6('0x46')]['id']}})['then'](handleEntityNotFound(_0x297381,null))[_0x5ed6('0x23')](removeEntity(_0x297381,null))[_0x5ed6('0x4b')](handleError(_0x297381,null));};exports['describe']=function(_0x54abd6,_0x3aa4ab){return db[_0x5ed6('0x42')][_0x5ed6('0x4c')]()[_0x5ed6('0x23')](respondWithResult(_0x3aa4ab,null))[_0x5ed6('0x4b')](handleError(_0x3aa4ab,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index ec79577..5704877 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 _0x50d0=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x50d0,0x101));var _0x050d=function(_0x3e9739,_0x4a9f0f){_0x3e9739=_0x3e9739-0x0;var _0x28c9b3=_0x50d0[_0x3e9739];return _0x28c9b3;};'use strict';var _=require(_0x050d('0x0'));var util=require('util');var logger=require(_0x050d('0x1'))(_0x050d('0x2'));var moment=require(_0x050d('0x3'));var BPromise=require(_0x050d('0x4'));var rp=require(_0x050d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x050d('0x6'));var config=require(_0x050d('0x7'));var attributes=require(_0x050d('0x8'));module[_0x050d('0x9')]=function(_0x3c2dbe,_0x20bede){return _0x3c2dbe[_0x050d('0xa')](_0x050d('0xb'),attributes,{'tableName':_0x050d('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x050d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x677b=['define','uniqueid','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x8fd6f5,_0x473312){var _0x458096=function(_0x315948){while(--_0x315948){_0x8fd6f5['push'](_0x8fd6f5['shift']());}};_0x458096(++_0x473312);}(_0x677b,0xc8));var _0xb677=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x677b[_0x602ca8];return _0x26e8ab;};'use strict';var _=require(_0xb677('0x0'));var util=require(_0xb677('0x1'));var logger=require(_0xb677('0x2'))(_0xb677('0x3'));var moment=require('moment');var BPromise=require(_0xb677('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb677('0x5'));var config=require(_0xb677('0x6'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x1810ec,_0x1cb5f9){return _0x1810ec[_0xb677('0x7')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xb677('0x8'),'fields':[_0xb677('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d607e18..473fdb5 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 _0x74df=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateMailQueueReport','body','options','raw','UpdateMailQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x74df,0xaa));var _0xf74d=function(_0x92cb0c,_0x2911a1){_0x92cb0c=_0x92cb0c-0x0;var _0x3e36d1=_0x74df[_0x92cb0c];return _0x3e36d1;};'use strict';var _=require(_0xf74d('0x0'));var util=require(_0xf74d('0x1'));var moment=require(_0xf74d('0x2'));var BPromise=require(_0xf74d('0x3'));var rs=require(_0xf74d('0x4'));var fs=require('fs');var Redis=require(_0xf74d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf74d('0x6'));var logger=require(_0xf74d('0x7'))(_0xf74d('0x8'));var config=require(_0xf74d('0x9'));var jayson=require(_0xf74d('0xa'));var client=jayson[_0xf74d('0xb')][_0xf74d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f18e2,_0x3526dc,_0x463dcc){return new BPromise(function(_0x190f45,_0x1324b4){return client[_0xf74d('0xd')](_0x1f18e2,_0x463dcc)[_0xf74d('0xe')](function(_0xcb0939){logger['info']('MailQueueReport,\x20%s,\x20%s',_0x3526dc,_0xf74d('0xf'));logger[_0xf74d('0x10')](_0xf74d('0x11'),_0x3526dc,_0xf74d('0xf'),JSON[_0xf74d('0x12')](_0xcb0939));if(_0xcb0939['error']){if(_0xcb0939[_0xf74d('0x13')][_0xf74d('0x14')]===0x1f4){logger[_0xf74d('0x13')](_0xf74d('0x15'),_0x3526dc,_0xcb0939[_0xf74d('0x13')][_0xf74d('0x16')]);return _0x1324b4(_0xcb0939[_0xf74d('0x13')]['message']);}logger['error'](_0xf74d('0x15'),_0x3526dc,_0xcb0939[_0xf74d('0x13')]['message']);return _0x190f45(_0xcb0939['error'][_0xf74d('0x16')]);}else{logger[_0xf74d('0x17')](_0xf74d('0x15'),_0x3526dc,_0xf74d('0xf'));_0x190f45(_0xcb0939[_0xf74d('0x18')][_0xf74d('0x16')]);}})[_0xf74d('0x19')](function(_0x1ae81b){logger[_0xf74d('0x13')](_0xf74d('0x15'),_0x3526dc,_0x1ae81b);_0x1324b4(_0x1ae81b);});});}exports[_0xf74d('0x1a')]=function(_0xead69e){var _0x33539e=this;return new Promise(function(_0x3d6b7f,_0x18809e){return db['MailQueueReport']['create'](_0xead69e[_0xf74d('0x1b')],{'raw':_0xead69e[_0xf74d('0x1c')]?_0xead69e[_0xf74d('0x1c')][_0xf74d('0x1d')]===undefined?!![]:![]:!![]})[_0xf74d('0xe')](function(_0x40cf9e){logger[_0xf74d('0x17')](_0xf74d('0x1a'),_0xead69e);logger[_0xf74d('0x10')](_0xf74d('0x1a'),_0xead69e,JSON[_0xf74d('0x12')](_0x40cf9e));_0x3d6b7f(_0x40cf9e);})[_0xf74d('0x19')](function(_0x34f96f){logger[_0xf74d('0x13')](_0xf74d('0x1a'),_0x34f96f['message'],_0xead69e);_0x18809e(_0x33539e[_0xf74d('0x13')](0x1f4,_0x34f96f[_0xf74d('0x16')]));});});};exports[_0xf74d('0x1e')]=function(_0x2154b7){var _0x3e1ca6=this;return new Promise(function(_0x3394f3,_0x4e2ef9){return db['MailQueueReport'][_0xf74d('0x1f')](_0x2154b7[_0xf74d('0x1b')],{'raw':_0x2154b7['options']?_0x2154b7['options'][_0xf74d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2154b7[_0xf74d('0x1c')]?_0x2154b7[_0xf74d('0x1c')][_0xf74d('0x20')]||null:null,'attributes':_0x2154b7[_0xf74d('0x1c')]?_0x2154b7[_0xf74d('0x1c')][_0xf74d('0x21')]||null:null,'limit':_0x2154b7[_0xf74d('0x1c')]?_0x2154b7[_0xf74d('0x1c')][_0xf74d('0x22')]||null:null})[_0xf74d('0xe')](function(_0x5a90b8){logger[_0xf74d('0x17')](_0xf74d('0x1e'),_0x2154b7);logger[_0xf74d('0x10')]('UpdateMailQueueReport',_0x2154b7,JSON[_0xf74d('0x12')](_0x5a90b8));_0x3394f3(_0x5a90b8);})[_0xf74d('0x19')](function(_0xbb216d){logger['error'](_0xf74d('0x1e'),_0xbb216d[_0xf74d('0x16')],_0x2154b7);_0x4e2ef9(_0x3e1ca6['error'](0x1f4,_0xbb216d[_0xf74d('0x16')]));});});}; \ No newline at end of file +var _0xdbfa=['raw','debug','stringify','catch','UpdateMailQueueReport','MailQueueReport','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','MailQueueReport,\x20%s,\x20%s','message','CreateMailQueueReport','create','body','options'];(function(_0x49968b,_0x3ff9f2){var _0x55a99b=function(_0x4e44f4){while(--_0x4e44f4){_0x49968b['push'](_0x49968b['shift']());}};_0x55a99b(++_0x3ff9f2);}(_0xdbfa,0xe9));var _0xadbf=function(_0x53c610,_0x123152){_0x53c610=_0x53c610-0x0;var _0x10fe56=_0xdbfa[_0x53c610];return _0x10fe56;};'use strict';var _=require(_0xadbf('0x0'));var util=require('util');var moment=require(_0xadbf('0x1'));var BPromise=require(_0xadbf('0x2'));var rs=require(_0xadbf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadbf('0x4'))['db'];var utils=require(_0xadbf('0x5'));var logger=require(_0xadbf('0x6'))(_0xadbf('0x7'));var config=require(_0xadbf('0x8'));var jayson=require(_0xadbf('0x9'));var client=jayson[_0xadbf('0xa')][_0xadbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dbc0b,_0x3edc50,_0x4ee5bf){return new BPromise(function(_0x44480a,_0xc4acd0){return client['request'](_0x3dbc0b,_0x4ee5bf)[_0xadbf('0xc')](function(_0x386597){logger[_0xadbf('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x3edc50,_0xadbf('0xe'));logger['debug'](_0xadbf('0xf'),_0x3edc50,'request\x20sent',JSON['stringify'](_0x386597));if(_0x386597['error']){if(_0x386597[_0xadbf('0x10')]['code']===0x1f4){logger['error'](_0xadbf('0x11'),_0x3edc50,_0x386597[_0xadbf('0x10')][_0xadbf('0x12')]);return _0xc4acd0(_0x386597[_0xadbf('0x10')][_0xadbf('0x12')]);}logger[_0xadbf('0x10')]('MailQueueReport,\x20%s,\x20%s',_0x3edc50,_0x386597[_0xadbf('0x10')][_0xadbf('0x12')]);return _0x44480a(_0x386597[_0xadbf('0x10')][_0xadbf('0x12')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x3edc50,_0xadbf('0xe'));_0x44480a(_0x386597['result'][_0xadbf('0x12')]);}})['catch'](function(_0x3f0a96){logger['error'](_0xadbf('0x11'),_0x3edc50,_0x3f0a96);_0xc4acd0(_0x3f0a96);});});}exports[_0xadbf('0x13')]=function(_0x1c53f2){var _0x47c87a=this;return new Promise(function(_0xa2a901,_0x396f7f){return db['MailQueueReport'][_0xadbf('0x14')](_0x1c53f2[_0xadbf('0x15')],{'raw':_0x1c53f2[_0xadbf('0x16')]?_0x1c53f2['options'][_0xadbf('0x17')]===undefined?!![]:![]:!![]})[_0xadbf('0xc')](function(_0x883675){logger[_0xadbf('0xd')](_0xadbf('0x13'),_0x1c53f2);logger[_0xadbf('0x18')](_0xadbf('0x13'),_0x1c53f2,JSON[_0xadbf('0x19')](_0x883675));_0xa2a901(_0x883675);})[_0xadbf('0x1a')](function(_0x2ffc41){logger[_0xadbf('0x10')](_0xadbf('0x13'),_0x2ffc41[_0xadbf('0x12')],_0x1c53f2);_0x396f7f(_0x47c87a['error'](0x1f4,_0x2ffc41[_0xadbf('0x12')]));});});};exports[_0xadbf('0x1b')]=function(_0x47918a){var _0x1fe047=this;return new Promise(function(_0x2f1a6c,_0x422bf6){return db[_0xadbf('0x1c')]['update'](_0x47918a[_0xadbf('0x15')],{'raw':_0x47918a[_0xadbf('0x16')]?_0x47918a[_0xadbf('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47918a['options']?_0x47918a[_0xadbf('0x16')][_0xadbf('0x1d')]||null:null,'attributes':_0x47918a[_0xadbf('0x16')]?_0x47918a['options'][_0xadbf('0x1e')]||null:null,'limit':_0x47918a[_0xadbf('0x16')]?_0x47918a['options'][_0xadbf('0x1f')]||null:null})[_0xadbf('0xc')](function(_0x132237){logger[_0xadbf('0xd')]('UpdateMailQueueReport',_0x47918a);logger[_0xadbf('0x18')](_0xadbf('0x1b'),_0x47918a,JSON[_0xadbf('0x19')](_0x132237));_0x2f1a6c(_0x132237);})[_0xadbf('0x1a')](function(_0x722110){logger['error']('UpdateMailQueueReport',_0x722110['message'],_0x47918a);_0x422bf6(_0x1fe047[_0xadbf('0x10')](0x1f4,_0x722110[_0xadbf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d90e1fe..c1f110c 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 _0xfa28=['fs-extra','../../components/auth/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4b7a20,_0x470a22){var _0x302aa4=function(_0x23d637){while(--_0x23d637){_0x4b7a20['push'](_0x4b7a20['shift']());}};_0x302aa4(++_0x470a22);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xfa28[_0x59c301];return _0x3866b9;};'use strict';var multer=require(_0x8fa2('0x0'));var util=require(_0x8fa2('0x1'));var path=require(_0x8fa2('0x2'));var timeout=require(_0x8fa2('0x3'));var express=require(_0x8fa2('0x4'));var router=express[_0x8fa2('0x5')]();var fs_extra=require(_0x8fa2('0x6'));var auth=require(_0x8fa2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8fa2('0x8'));module[_0x8fa2('0x9')]=router; \ No newline at end of file +var _0x28f2=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x17f049,_0x5e1adc){var _0x1f431d=function(_0x185fe9){while(--_0x185fe9){_0x17f049['push'](_0x17f049['shift']());}};_0x1f431d(++_0x5e1adc);}(_0x28f2,0x193));var _0x228f=function(_0x142d8b,_0x31151b){_0x142d8b=_0x142d8b-0x0;var _0x500efe=_0x28f2[_0x142d8b];return _0x500efe;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require(_0x228f('0x2'));var timeout=require(_0x228f('0x3'));var express=require(_0x228f('0x4'));var router=express['Router']();var fs_extra=require(_0x228f('0x5'));var auth=require(_0x228f('0x6'));var interaction=require(_0x228f('0x7'));var config=require(_0x228f('0x8'));module[_0x228f('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 128b84b..27392c7 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 _0x4f3d=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x25c590,_0x3cf294){var _0x1b6268=function(_0x3a334c){while(--_0x3a334c){_0x25c590['push'](_0x25c590['shift']());}};_0x1b6268(++_0x3cf294);}(_0x4f3d,0x1c3));var _0xd4f3=function(_0x1f976b,_0x233764){_0x1f976b=_0x1f976b-0x0;var _0x1b52bc=_0x4f3d[_0x1f976b];return _0x1b52bc;};'use strict';var Sequelize=require(_0xd4f3('0x0'));module['exports']={'description':{'type':Sequelize[_0xd4f3('0x1')]},'host':{'type':Sequelize[_0xd4f3('0x1')]},'authentication':{'type':Sequelize[_0xd4f3('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd4f3('0x1')]},'password':{'type':Sequelize[_0xd4f3('0x1')]},'port':{'type':Sequelize[_0xd4f3('0x3')]},'tls':{'type':Sequelize[_0xd4f3('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd4f3('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xd4f3('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd4f3('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x83c9=['exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83c9,0x1b8));var _0x983c=function(_0x12c3d1,_0x3c6ae7){_0x12c3d1=_0x12c3d1-0x0;var _0x282840=_0x83c9[_0x12c3d1];return _0x282840;};'use strict';var Sequelize=require('sequelize');module[_0x983c('0x0')]={'description':{'type':Sequelize[_0x983c('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x983c('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x983c('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x983c('0x3')]},'tls':{'type':Sequelize[_0x983c('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x983c('0x4')},'connTimeout':{'type':Sequelize[_0x983c('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x983c('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x983c('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index c864b42..8d4e97d 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 _0xd824=['rimraf','../../config/environment','MailServerIn','mail_servers_in','lodash','util','moment','bluebird','request-promise','path'];(function(_0x13842d,_0x4e95e5){var _0x2a9468=function(_0x46efd0){while(--_0x46efd0){_0x13842d['push'](_0x13842d['shift']());}};_0x2a9468(++_0x4e95e5);}(_0xd824,0xc2));var _0x4d82=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd824[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4d82('0x2'));var BPromise=require(_0x4d82('0x3'));var rp=require(_0x4d82('0x4'));var fs=require('fs');var path=require(_0x4d82('0x5'));var rimraf=require(_0x4d82('0x6'));var config=require(_0x4d82('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0xd00023,_0x583c7c){return _0xd00023['define'](_0x4d82('0x8'),attributes,{'tableName':_0x4d82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f2f=['mail_servers_in','lodash','util','bluebird','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn'];(function(_0x3159c0,_0x592776){var _0x12411f=function(_0x3b7d17){while(--_0x3b7d17){_0x3159c0['push'](_0x3159c0['shift']());}};_0x12411f(++_0x592776);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x6f2f[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf6f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf6f2('0x3'));var config=require(_0xf6f2('0x4'));var attributes=require(_0xf6f2('0x5'));module['exports']=function(_0x5c540a,_0x1123bb){return _0x5c540a[_0xf6f2('0x6')](_0xf6f2('0x7'),attributes,{'tableName':_0xf6f2('0x8'),'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 532f8fc..f0be767 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 _0x5707=['attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where'];(function(_0x23c02b,_0x411b4d){var _0x25efc5=function(_0x50e9e4){while(--_0x50e9e4){_0x23c02b['push'](_0x23c02b['shift']());}};_0x25efc5(++_0x411b4d);}(_0x5707,0x12d));var _0x7570=function(_0x1bf8cc,_0x118778){_0x1bf8cc=_0x1bf8cc-0x0;var _0x322d20=_0x5707[_0x1bf8cc];return _0x322d20;};'use strict';var _=require(_0x7570('0x0'));var util=require(_0x7570('0x1'));var moment=require('moment');var BPromise=require(_0x7570('0x2'));var rs=require(_0x7570('0x3'));var fs=require('fs');var Redis=require(_0x7570('0x4'));var db=require(_0x7570('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7570('0x6'))(_0x7570('0x7'));var config=require('../../config/environment');var jayson=require(_0x7570('0x8'));var client=jayson[_0x7570('0x9')][_0x7570('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a7de3,_0x5cd76c,_0x5a3440){return new BPromise(function(_0x81027b,_0x2c9855){return client[_0x7570('0xb')](_0x4a7de3,_0x5a3440)[_0x7570('0xc')](function(_0x1f81d5){logger[_0x7570('0xd')](_0x7570('0xe'),_0x5cd76c,_0x7570('0xf'));logger[_0x7570('0x10')](_0x7570('0x11'),_0x5cd76c,'request\x20sent',JSON[_0x7570('0x12')](_0x1f81d5));if(_0x1f81d5[_0x7570('0x13')]){if(_0x1f81d5[_0x7570('0x13')][_0x7570('0x14')]===0x1f4){logger[_0x7570('0x13')]('MailServerIn,\x20%s,\x20%s',_0x5cd76c,_0x1f81d5[_0x7570('0x13')][_0x7570('0x15')]);return _0x2c9855(_0x1f81d5[_0x7570('0x13')][_0x7570('0x15')]);}logger['error'](_0x7570('0xe'),_0x5cd76c,_0x1f81d5[_0x7570('0x13')][_0x7570('0x15')]);return _0x81027b(_0x1f81d5[_0x7570('0x13')]['message']);}else{logger[_0x7570('0xd')](_0x7570('0xe'),_0x5cd76c,'request\x20sent');_0x81027b(_0x1f81d5[_0x7570('0x16')][_0x7570('0x15')]);}})[_0x7570('0x17')](function(_0x1c87da){logger[_0x7570('0x13')](_0x7570('0xe'),_0x5cd76c,_0x1c87da);_0x2c9855(_0x1c87da);});});}exports[_0x7570('0x18')]=function(_0x549379){var _0x277356=this;return new Promise(function(_0x465b7a,_0x1490a0){return db[_0x7570('0x19')]['findAll']({'raw':_0x549379[_0x7570('0x1a')]?_0x549379[_0x7570('0x1a')][_0x7570('0x1b')]===undefined?!![]:![]:!![],'where':_0x549379[_0x7570('0x1a')]?_0x549379['options'][_0x7570('0x1c')]||null:null,'attributes':_0x549379['options']?_0x549379[_0x7570('0x1a')][_0x7570('0x1d')]||null:null,'limit':_0x549379[_0x7570('0x1a')]?_0x549379[_0x7570('0x1a')]['limit']||null:null,'include':_0x549379[_0x7570('0x1a')]?_0x549379[_0x7570('0x1a')][_0x7570('0x1e')]?_[_0x7570('0x1f')](_0x549379[_0x7570('0x1a')]['include'],function(_0x292711){return{'model':db[_0x292711[_0x7570('0x20')]],'as':_0x292711['as'],'attributes':_0x292711[_0x7570('0x1d')],'include':_0x292711[_0x7570('0x1e')]?_[_0x7570('0x1f')](_0x292711[_0x7570('0x1e')],function(_0x190ef8){return{'model':db[_0x190ef8[_0x7570('0x20')]],'as':_0x190ef8['as'],'attributes':_0x190ef8['attributes'],'include':_0x190ef8[_0x7570('0x1e')]?_['map'](_0x190ef8[_0x7570('0x1e')],function(_0x8d59fb){return{'model':db[_0x8d59fb['model']],'as':_0x8d59fb['as'],'attributes':_0x8d59fb[_0x7570('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a6ea0){logger['info']('GetMailServerIn',_0x549379);logger[_0x7570('0x10')](_0x7570('0x18'),_0x549379,JSON['stringify'](_0x1a6ea0));_0x465b7a(_0x1a6ea0);})[_0x7570('0x17')](function(_0x58a14b){logger['error']('GetMailServerIn',_0x58a14b[_0x7570('0x15')],_0x549379);_0x1490a0(_0x277356[_0x7570('0x13')](0x1f4,_0x58a14b[_0x7570('0x15')]));});});}; \ No newline at end of file +var _0x10d5=['client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','findAll','options','raw','map','model','attributes','include','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5c85e0,_0x3b75a7){var _0x41b60f=function(_0x4ae680){while(--_0x4ae680){_0x5c85e0['push'](_0x5c85e0['shift']());}};_0x41b60f(++_0x3b75a7);}(_0x10d5,0x105));var _0x510d=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x10d5[_0x1df7b8];return _0x29d911;};'use strict';var _=require(_0x510d('0x0'));var util=require(_0x510d('0x1'));var moment=require(_0x510d('0x2'));var BPromise=require(_0x510d('0x3'));var rs=require(_0x510d('0x4'));var fs=require('fs');var Redis=require(_0x510d('0x5'));var db=require(_0x510d('0x6'))['db'];var utils=require(_0x510d('0x7'));var logger=require(_0x510d('0x8'))(_0x510d('0x9'));var config=require('../../config/environment');var jayson=require(_0x510d('0xa'));var client=jayson[_0x510d('0xb')][_0x510d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3089b8,_0x385822,_0xb00e5f){return new BPromise(function(_0x929e5c,_0x1d816f){return client[_0x510d('0xd')](_0x3089b8,_0xb00e5f)[_0x510d('0xe')](function(_0x276a48){logger[_0x510d('0xf')]('MailServerIn,\x20%s,\x20%s',_0x385822,_0x510d('0x10'));logger[_0x510d('0x11')](_0x510d('0x12'),_0x385822,'request\x20sent',JSON[_0x510d('0x13')](_0x276a48));if(_0x276a48['error']){if(_0x276a48['error'][_0x510d('0x14')]===0x1f4){logger[_0x510d('0x15')](_0x510d('0x16'),_0x385822,_0x276a48[_0x510d('0x15')][_0x510d('0x17')]);return _0x1d816f(_0x276a48['error'][_0x510d('0x17')]);}logger[_0x510d('0x15')](_0x510d('0x16'),_0x385822,_0x276a48[_0x510d('0x15')][_0x510d('0x17')]);return _0x929e5c(_0x276a48[_0x510d('0x15')][_0x510d('0x17')]);}else{logger['info'](_0x510d('0x16'),_0x385822,_0x510d('0x10'));_0x929e5c(_0x276a48[_0x510d('0x18')][_0x510d('0x17')]);}})[_0x510d('0x19')](function(_0x59e952){logger['error'](_0x510d('0x16'),_0x385822,_0x59e952);_0x1d816f(_0x59e952);});});}exports[_0x510d('0x1a')]=function(_0xe6d45e){var _0x1e9e76=this;return new Promise(function(_0x305482,_0xf85a74){return db['MailServerIn'][_0x510d('0x1b')]({'raw':_0xe6d45e[_0x510d('0x1c')]?_0xe6d45e[_0x510d('0x1c')][_0x510d('0x1d')]===undefined?!![]:![]:!![],'where':_0xe6d45e[_0x510d('0x1c')]?_0xe6d45e[_0x510d('0x1c')]['where']||null:null,'attributes':_0xe6d45e['options']?_0xe6d45e['options']['attributes']||null:null,'limit':_0xe6d45e['options']?_0xe6d45e['options']['limit']||null:null,'include':_0xe6d45e[_0x510d('0x1c')]?_0xe6d45e[_0x510d('0x1c')]['include']?_[_0x510d('0x1e')](_0xe6d45e['options']['include'],function(_0x3fd319){return{'model':db[_0x3fd319[_0x510d('0x1f')]],'as':_0x3fd319['as'],'attributes':_0x3fd319[_0x510d('0x20')],'include':_0x3fd319[_0x510d('0x21')]?_['map'](_0x3fd319[_0x510d('0x21')],function(_0x5c5c83){return{'model':db[_0x5c5c83[_0x510d('0x1f')]],'as':_0x5c5c83['as'],'attributes':_0x5c5c83[_0x510d('0x20')],'include':_0x5c5c83[_0x510d('0x21')]?_[_0x510d('0x1e')](_0x5c5c83[_0x510d('0x21')],function(_0x24e589){return{'model':db[_0x24e589[_0x510d('0x1f')]],'as':_0x24e589['as'],'attributes':_0x24e589[_0x510d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xaa39af){logger[_0x510d('0xf')](_0x510d('0x1a'),_0xe6d45e);logger['debug'](_0x510d('0x1a'),_0xe6d45e,JSON[_0x510d('0x13')](_0xaa39af));_0x305482(_0xaa39af);})[_0x510d('0x19')](function(_0x320f38){logger[_0x510d('0x15')](_0x510d('0x1a'),_0x320f38['message'],_0xe6d45e);_0xf85a74(_0x1e9e76['error'](0x1f4,_0x320f38[_0x510d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ac1f00c..ae23529 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 _0x34e8=['../../config/environment','./mailServerOut.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x34e8,0x12c));var _0x834e=function(_0x34008a,_0x3f1d93){_0x34008a=_0x34008a-0x0;var _0xfdd30e=_0x34e8[_0x34008a];return _0xfdd30e;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0xdace=['show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0xdace,0xc5));var _0xedac=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xdace[_0x2d8d69];return _0x39ae22;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./mailServerOut.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['post']('/',auth[_0xedac('0x9')](),controller[_0xedac('0xd')]);router[_0xedac('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xedac('0xf')]);router[_0xedac('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xedac('0x11')]);module[_0xedac('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index ee10121..4fe16dc 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 _0x4ccb=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3b4f5c,_0x2a6efe){var _0x27decb=function(_0x4b4b4b){while(--_0x4b4b4b){_0x3b4f5c['push'](_0x3b4f5c['shift']());}};_0x27decb(++_0x2a6efe);}(_0x4ccb,0x196));var _0xb4cc=function(_0x24cceb,_0x1a40f5){_0x24cceb=_0x24cceb-0x0;var _0x188826=_0x4ccb[_0x24cceb];return _0x188826;};'use strict';var Sequelize=require(_0xb4cc('0x0'));module[_0xb4cc('0x1')]={'description':{'type':Sequelize[_0xb4cc('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xb4cc('0x2')]},'pass':{'type':Sequelize[_0xb4cc('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xb4cc('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xb4cc('0x2')]},'authentication':{'type':Sequelize[_0xb4cc('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaa3f=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x3d86fd,_0x2d6100){_0x3d86fd=_0x3d86fd-0x0;var _0x521563=_0xaa3f[_0x3d86fd];return _0x521563;};'use strict';var Sequelize=require(_0xfaa3('0x0'));module[_0xfaa3('0x1')]={'description':{'type':Sequelize[_0xfaa3('0x2')]},'host':{'type':Sequelize[_0xfaa3('0x2')]},'user':{'type':Sequelize[_0xfaa3('0x2')]},'pass':{'type':Sequelize[_0xfaa3('0x2')]},'port':{'type':Sequelize[_0xfaa3('0x3')]},'secure':{'type':Sequelize[_0xfaa3('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xfaa3('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 e957c77..cbde486 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 _0xb10b=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','render','merge','body','contact','message','agent','account','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','VIRTUAL','filter','options','includeAll','include','catch','params','keys','find','create','eml-format','zip-dir'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xb10b,0x12a));var _0xbb10=function(_0x5aba4f,_0x1afb63){_0x5aba4f=_0x5aba4f-0x0;var _0x10cf5c=_0xb10b[_0x5aba4f];return _0x10cf5c;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}function getMustacheRender(_0x2a0e8b,_0x4aabb9){return Mustache[_0xbb10('0x2a')](_0x2a0e8b,_[_0xbb10('0x2b')](_0x4aabb9[_0xbb10('0x2c')],{'contact':_0x4aabb9[_0xbb10('0x2d')],'message':_0x4aabb9[_0xbb10('0x2e')],'agent':_0x4aabb9[_0xbb10('0x2f')],'interaction':_0x4aabb9['interaction'],'account':_0x4aabb9[_0xbb10('0x30')]}))||'';}exports['index']=function(_0x448d5c,_0x56f2da){var _0x16ad2a={},_0x1dcc9c={},_0x1b59f9={'count':0x0,'rows':[]};var _0x491db4=_['map'](db[_0xbb10('0x31')][_0xbb10('0x32')],function(_0x4f590d){return{'name':_0x4f590d[_0xbb10('0x33')],'type':_0x4f590d[_0xbb10('0x34')][_0xbb10('0x35')]};});_0x1dcc9c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x491db4,_0xbb10('0x28'));_0x1dcc9c[_0xbb10('0x38')]=_['keys'](_0x448d5c[_0xbb10('0x38')]);_0x1dcc9c[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x1dcc9c[_0xbb10('0x36')],_0x1dcc9c[_0xbb10('0x38')]);_0x16ad2a[_0xbb10('0x3b')]=_[_0xbb10('0x3a')](_0x1dcc9c[_0xbb10('0x36')],qs[_0xbb10('0x3c')](_0x448d5c['query'][_0xbb10('0x3c')]));_0x16ad2a[_0xbb10('0x3b')]=_0x16ad2a[_0xbb10('0x3b')][_0xbb10('0x3d')]?_0x16ad2a['attributes']:_0x1dcc9c[_0xbb10('0x36')];if(!_0x448d5c['query']['hasOwnProperty'](_0xbb10('0x3e'))){_0x16ad2a[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x448d5c[_0xbb10('0x38')][_0xbb10('0x1c')]);_0x16ad2a[_0xbb10('0x1b')]=qs['offset'](_0x448d5c[_0xbb10('0x38')][_0xbb10('0x1b')]);}_0x16ad2a['order']=qs['sort'](_0x448d5c['query'][_0xbb10('0x3f')]);_0x16ad2a[_0xbb10('0x40')]=qs[_0xbb10('0x39')](_['pick'](_0x448d5c[_0xbb10('0x38')],_0x1dcc9c[_0xbb10('0x39')]),_0x491db4);if(_0x448d5c[_0xbb10('0x38')]['filter']){_0x16ad2a[_0xbb10('0x40')]=_[_0xbb10('0x2b')](_0x16ad2a[_0xbb10('0x40')],{'$or':_[_0xbb10('0x37')](_0x491db4,function(_0x4f1cdd){if(_0x4f1cdd[_0xbb10('0x34')]!==_0xbb10('0x41')){var _0x5835fd={};_0x5835fd[_0x4f1cdd[_0xbb10('0x28')]]={'$like':'%'+_0x448d5c[_0xbb10('0x38')][_0xbb10('0x42')]+'%'};return _0x5835fd;}})});}_0x16ad2a=_[_0xbb10('0x2b')]({},_0x16ad2a,_0x448d5c[_0xbb10('0x43')]);var _0x185a52={'where':_0x16ad2a['where']};return db[_0xbb10('0x31')][_0xbb10('0x1e')](_0x185a52)[_0xbb10('0x23')](function(_0x3d3c41){_0x1b59f9['count']=_0x3d3c41;if(_0x448d5c[_0xbb10('0x38')][_0xbb10('0x44')]){_0x16ad2a[_0xbb10('0x45')]=[{'all':!![]}];}return db[_0xbb10('0x31')]['findAll'](_0x16ad2a);})[_0xbb10('0x23')](function(_0x202c60){_0x1b59f9['rows']=_0x202c60;return _0x1b59f9;})['then'](respondWithFilteredResult(_0x56f2da,_0x16ad2a))[_0xbb10('0x46')](handleError(_0x56f2da,null));};exports['show']=function(_0x318984,_0x180933){var _0x4c66d8={'raw':!![],'where':{'id':_0x318984[_0xbb10('0x47')]['id']}},_0x366608={};_0x366608[_0xbb10('0x36')]=_['keys'](db[_0xbb10('0x31')][_0xbb10('0x32')]);_0x366608[_0xbb10('0x38')]=_[_0xbb10('0x48')](_0x318984[_0xbb10('0x38')]);_0x366608[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x366608[_0xbb10('0x36')],_0x366608[_0xbb10('0x38')]);_0x4c66d8[_0xbb10('0x3b')]=_[_0xbb10('0x3a')](_0x366608[_0xbb10('0x36')],qs['fields'](_0x318984[_0xbb10('0x38')][_0xbb10('0x3c')]));_0x4c66d8['attributes']=_0x4c66d8[_0xbb10('0x3b')][_0xbb10('0x3d')]?_0x4c66d8[_0xbb10('0x3b')]:_0x366608[_0xbb10('0x36')];if(_0x318984[_0xbb10('0x38')][_0xbb10('0x44')]){_0x4c66d8[_0xbb10('0x45')]=[{'all':!![]}];}_0x4c66d8=_['merge']({},_0x4c66d8,_0x318984['options']);return db[_0xbb10('0x31')][_0xbb10('0x49')](_0x4c66d8)[_0xbb10('0x23')](handleEntityNotFound(_0x180933,null))['then'](respondWithResult(_0x180933,null))['catch'](handleError(_0x180933,null));};exports[_0xbb10('0x4a')]=function(_0x34cf4e,_0x1bd054){return db[_0xbb10('0x31')][_0xbb10('0x4a')](_0x34cf4e[_0xbb10('0x2c')],{})[_0xbb10('0x23')](respondWithResult(_0x1bd054,0xc9))[_0xbb10('0x46')](handleError(_0x1bd054,null));};exports[_0xbb10('0x22')]=function(_0x3d7e7e,_0x550111){if(_0x3d7e7e['body']['id']){delete _0x3d7e7e[_0xbb10('0x2c')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x49')]({'where':{'id':_0x3d7e7e[_0xbb10('0x47')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x550111,null))[_0xbb10('0x23')](saveUpdates(_0x3d7e7e[_0xbb10('0x2c')],null))[_0xbb10('0x23')](respondWithResult(_0x550111,null))[_0xbb10('0x46')](handleError(_0x550111,null));};exports[_0xbb10('0x24')]=function(_0x19ca3e,_0x20e18a){return db[_0xbb10('0x31')][_0xbb10('0x49')]({'where':{'id':_0x19ca3e[_0xbb10('0x47')]['id']}})['then'](handleEntityNotFound(_0x20e18a,null))[_0xbb10('0x23')](removeEntity(_0x20e18a,null))['catch'](handleError(_0x20e18a,null));}; \ No newline at end of file +var _0xb10b=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','render','merge','body','contact','message','agent','account','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','VIRTUAL','filter','options','includeAll','include','catch','params','keys','find','create','eml-format','zip-dir'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xb10b,0x12a));var _0xbb10=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb10b[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}function getMustacheRender(_0x2a0e8b,_0x4aabb9){return Mustache[_0xbb10('0x2a')](_0x2a0e8b,_[_0xbb10('0x2b')](_0x4aabb9[_0xbb10('0x2c')],{'contact':_0x4aabb9[_0xbb10('0x2d')],'message':_0x4aabb9[_0xbb10('0x2e')],'agent':_0x4aabb9[_0xbb10('0x2f')],'interaction':_0x4aabb9['interaction'],'account':_0x4aabb9[_0xbb10('0x30')]}))||'';}exports['index']=function(_0x448d5c,_0x56f2da){var _0x16ad2a={},_0x1dcc9c={},_0x1b59f9={'count':0x0,'rows':[]};var _0x491db4=_['map'](db[_0xbb10('0x31')][_0xbb10('0x32')],function(_0x4f590d){return{'name':_0x4f590d[_0xbb10('0x33')],'type':_0x4f590d[_0xbb10('0x34')][_0xbb10('0x35')]};});_0x1dcc9c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x491db4,_0xbb10('0x28'));_0x1dcc9c[_0xbb10('0x38')]=_['keys'](_0x448d5c[_0xbb10('0x38')]);_0x1dcc9c[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x1dcc9c[_0xbb10('0x36')],_0x1dcc9c[_0xbb10('0x38')]);_0x16ad2a[_0xbb10('0x3b')]=_[_0xbb10('0x3a')](_0x1dcc9c[_0xbb10('0x36')],qs[_0xbb10('0x3c')](_0x448d5c['query'][_0xbb10('0x3c')]));_0x16ad2a[_0xbb10('0x3b')]=_0x16ad2a[_0xbb10('0x3b')][_0xbb10('0x3d')]?_0x16ad2a['attributes']:_0x1dcc9c[_0xbb10('0x36')];if(!_0x448d5c['query']['hasOwnProperty'](_0xbb10('0x3e'))){_0x16ad2a[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x448d5c[_0xbb10('0x38')][_0xbb10('0x1c')]);_0x16ad2a[_0xbb10('0x1b')]=qs['offset'](_0x448d5c[_0xbb10('0x38')][_0xbb10('0x1b')]);}_0x16ad2a['order']=qs['sort'](_0x448d5c['query'][_0xbb10('0x3f')]);_0x16ad2a[_0xbb10('0x40')]=qs[_0xbb10('0x39')](_['pick'](_0x448d5c[_0xbb10('0x38')],_0x1dcc9c[_0xbb10('0x39')]),_0x491db4);if(_0x448d5c[_0xbb10('0x38')]['filter']){_0x16ad2a[_0xbb10('0x40')]=_[_0xbb10('0x2b')](_0x16ad2a[_0xbb10('0x40')],{'$or':_[_0xbb10('0x37')](_0x491db4,function(_0x4f1cdd){if(_0x4f1cdd[_0xbb10('0x34')]!==_0xbb10('0x41')){var _0x5835fd={};_0x5835fd[_0x4f1cdd[_0xbb10('0x28')]]={'$like':'%'+_0x448d5c[_0xbb10('0x38')][_0xbb10('0x42')]+'%'};return _0x5835fd;}})});}_0x16ad2a=_[_0xbb10('0x2b')]({},_0x16ad2a,_0x448d5c[_0xbb10('0x43')]);var _0x185a52={'where':_0x16ad2a['where']};return db[_0xbb10('0x31')][_0xbb10('0x1e')](_0x185a52)[_0xbb10('0x23')](function(_0x3d3c41){_0x1b59f9['count']=_0x3d3c41;if(_0x448d5c[_0xbb10('0x38')][_0xbb10('0x44')]){_0x16ad2a[_0xbb10('0x45')]=[{'all':!![]}];}return db[_0xbb10('0x31')]['findAll'](_0x16ad2a);})[_0xbb10('0x23')](function(_0x202c60){_0x1b59f9['rows']=_0x202c60;return _0x1b59f9;})['then'](respondWithFilteredResult(_0x56f2da,_0x16ad2a))[_0xbb10('0x46')](handleError(_0x56f2da,null));};exports['show']=function(_0x318984,_0x180933){var _0x4c66d8={'raw':!![],'where':{'id':_0x318984[_0xbb10('0x47')]['id']}},_0x366608={};_0x366608[_0xbb10('0x36')]=_['keys'](db[_0xbb10('0x31')][_0xbb10('0x32')]);_0x366608[_0xbb10('0x38')]=_[_0xbb10('0x48')](_0x318984[_0xbb10('0x38')]);_0x366608[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x366608[_0xbb10('0x36')],_0x366608[_0xbb10('0x38')]);_0x4c66d8[_0xbb10('0x3b')]=_[_0xbb10('0x3a')](_0x366608[_0xbb10('0x36')],qs['fields'](_0x318984[_0xbb10('0x38')][_0xbb10('0x3c')]));_0x4c66d8['attributes']=_0x4c66d8[_0xbb10('0x3b')][_0xbb10('0x3d')]?_0x4c66d8[_0xbb10('0x3b')]:_0x366608[_0xbb10('0x36')];if(_0x318984[_0xbb10('0x38')][_0xbb10('0x44')]){_0x4c66d8[_0xbb10('0x45')]=[{'all':!![]}];}_0x4c66d8=_['merge']({},_0x4c66d8,_0x318984['options']);return db[_0xbb10('0x31')][_0xbb10('0x49')](_0x4c66d8)[_0xbb10('0x23')](handleEntityNotFound(_0x180933,null))['then'](respondWithResult(_0x180933,null))['catch'](handleError(_0x180933,null));};exports[_0xbb10('0x4a')]=function(_0x34cf4e,_0x1bd054){return db[_0xbb10('0x31')][_0xbb10('0x4a')](_0x34cf4e[_0xbb10('0x2c')],{})[_0xbb10('0x23')](respondWithResult(_0x1bd054,0xc9))[_0xbb10('0x46')](handleError(_0x1bd054,null));};exports[_0xbb10('0x22')]=function(_0x3d7e7e,_0x550111){if(_0x3d7e7e['body']['id']){delete _0x3d7e7e[_0xbb10('0x2c')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x49')]({'where':{'id':_0x3d7e7e[_0xbb10('0x47')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x550111,null))[_0xbb10('0x23')](saveUpdates(_0x3d7e7e[_0xbb10('0x2c')],null))[_0xbb10('0x23')](respondWithResult(_0x550111,null))[_0xbb10('0x46')](handleError(_0x550111,null));};exports[_0xbb10('0x24')]=function(_0x19ca3e,_0x20e18a){return db[_0xbb10('0x31')][_0xbb10('0x49')]({'where':{'id':_0x19ca3e[_0xbb10('0x47')]['id']}})['then'](handleEntityNotFound(_0x20e18a,null))[_0xbb10('0x23')](removeEntity(_0x20e18a,null))['catch'](handleError(_0x20e18a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7b204d0..bc7b642 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 _0x4975=['./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1c4b16,_0x279f7d){var _0x53baac=function(_0x323400){while(--_0x323400){_0x1c4b16['push'](_0x1c4b16['shift']());}};_0x53baac(++_0x279f7d);}(_0x4975,0x86));var _0x5497=function(_0x503f58,_0x3b6df4){_0x503f58=_0x503f58-0x0;var _0x5fd3dd=_0x4975[_0x503f58];return _0x5fd3dd;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x1e20f4,_0x103413){var _0x7d34cd=function(_0x51f50f){while(--_0x51f50f){_0x1e20f4['push'](_0x1e20f4['shift']());}};_0x7d34cd(++_0x103413);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x3ee3b5,_0x17b688){_0x3ee3b5=_0x3ee3b5-0x0;var _0x465da7=_0xdbf5[_0x3ee3b5];return _0x465da7;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 8f18b3c..00742b3 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 _0x39ca=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','catch','lodash'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x39ca,0x11d));var _0xa39c=function(_0x3c3313,_0x1ea90d){_0x3c3313=_0x3c3313-0x0;var _0xb947aa=_0x39ca[_0x3c3313];return _0xb947aa;};'use strict';var _=require(_0xa39c('0x0'));var util=require(_0xa39c('0x1'));var moment=require(_0xa39c('0x2'));var BPromise=require(_0xa39c('0x3'));var rs=require(_0xa39c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa39c('0x5'))['db'];var utils=require(_0xa39c('0x6'));var logger=require(_0xa39c('0x7'))('rpc');var config=require(_0xa39c('0x8'));var jayson=require(_0xa39c('0x9'));var client=jayson[_0xa39c('0xa')][_0xa39c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cb022,_0x2d992f,_0x2f69f6){return new BPromise(function(_0x1c6c54,_0x33d393){return client[_0xa39c('0xc')](_0x5cb022,_0x2f69f6)['then'](function(_0x4b1e85){logger['info']('MailServerOut,\x20%s,\x20%s',_0x2d992f,'request\x20sent');logger[_0xa39c('0xd')](_0xa39c('0xe'),_0x2d992f,_0xa39c('0xf'),JSON[_0xa39c('0x10')](_0x4b1e85));if(_0x4b1e85[_0xa39c('0x11')]){if(_0x4b1e85[_0xa39c('0x11')][_0xa39c('0x12')]===0x1f4){logger[_0xa39c('0x11')](_0xa39c('0x13'),_0x2d992f,_0x4b1e85[_0xa39c('0x11')][_0xa39c('0x14')]);return _0x33d393(_0x4b1e85[_0xa39c('0x11')][_0xa39c('0x14')]);}logger[_0xa39c('0x11')](_0xa39c('0x13'),_0x2d992f,_0x4b1e85[_0xa39c('0x11')][_0xa39c('0x14')]);return _0x1c6c54(_0x4b1e85[_0xa39c('0x11')][_0xa39c('0x14')]);}else{logger['info'](_0xa39c('0x13'),_0x2d992f,_0xa39c('0xf'));_0x1c6c54(_0x4b1e85['result'][_0xa39c('0x14')]);}})[_0xa39c('0x15')](function(_0x1a6e72){logger[_0xa39c('0x11')]('MailServerOut,\x20%s,\x20%s',_0x2d992f,_0x1a6e72);_0x33d393(_0x1a6e72);});});} \ No newline at end of file +var _0xeee6=['../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x313ec0,_0x3743d0){var _0x433d69=function(_0x219690){while(--_0x219690){_0x313ec0['push'](_0x313ec0['shift']());}};_0x433d69(++_0x3743d0);}(_0xeee6,0xc0));var _0x6eee=function(_0xf6e7eb,_0x134918){_0xf6e7eb=_0xf6e7eb-0x0;var _0x21134d=_0xeee6[_0xf6e7eb];return _0x21134d;};'use strict';var _=require(_0x6eee('0x0'));var util=require('util');var moment=require(_0x6eee('0x1'));var BPromise=require(_0x6eee('0x2'));var rs=require(_0x6eee('0x3'));var fs=require('fs');var Redis=require(_0x6eee('0x4'));var db=require(_0x6eee('0x5'))['db'];var utils=require(_0x6eee('0x6'));var logger=require('../../config/logger')(_0x6eee('0x7'));var config=require(_0x6eee('0x8'));var jayson=require(_0x6eee('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2771a9,_0x29f2b2,_0x27eba3){return new BPromise(function(_0x3de7ad,_0x11f9d9){return client[_0x6eee('0xa')](_0x2771a9,_0x27eba3)[_0x6eee('0xb')](function(_0x3e7952){logger[_0x6eee('0xc')](_0x6eee('0xd'),_0x29f2b2,'request\x20sent');logger[_0x6eee('0xe')](_0x6eee('0xf'),_0x29f2b2,_0x6eee('0x10'),JSON[_0x6eee('0x11')](_0x3e7952));if(_0x3e7952[_0x6eee('0x12')]){if(_0x3e7952['error'][_0x6eee('0x13')]===0x1f4){logger['error'](_0x6eee('0xd'),_0x29f2b2,_0x3e7952['error'][_0x6eee('0x14')]);return _0x11f9d9(_0x3e7952['error'][_0x6eee('0x14')]);}logger[_0x6eee('0x12')]('MailServerOut,\x20%s,\x20%s',_0x29f2b2,_0x3e7952['error'][_0x6eee('0x14')]);return _0x3de7ad(_0x3e7952[_0x6eee('0x12')][_0x6eee('0x14')]);}else{logger[_0x6eee('0xc')](_0x6eee('0xd'),_0x29f2b2,_0x6eee('0x10'));_0x3de7ad(_0x3e7952[_0x6eee('0x15')][_0x6eee('0x14')]);}})['catch'](function(_0x294769){logger[_0x6eee('0x12')](_0x6eee('0xd'),_0x29f2b2,_0x294769);_0x11f9d9(_0x294769);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 8a4edb0..f1bb54f 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 _0x0c6b=['update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','describe','show','post','create','put','/:id'];(function(_0x568ed1,_0x4b6ee4){var _0x562c02=function(_0x1ebf57){while(--_0x1ebf57){_0x568ed1['push'](_0x568ed1['shift']());}};_0x562c02(++_0x4b6ee4);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x413dbf,_0x2ea2bc){_0x413dbf=_0x413dbf-0x0;var _0x2a6efe=_0x0c6b[_0x413dbf];return _0x2a6efe;};'use strict';var multer=require(_0xb0c6('0x0'));var util=require('util');var path=require(_0xb0c6('0x1'));var timeout=require(_0xb0c6('0x2'));var express=require(_0xb0c6('0x3'));var router=express[_0xb0c6('0x4')]();var fs_extra=require(_0xb0c6('0x5'));var auth=require(_0xb0c6('0x6'));var interaction=require(_0xb0c6('0x7'));var config=require(_0xb0c6('0x8'));var controller=require(_0xb0c6('0x9'));router[_0xb0c6('0xa')]('/',auth[_0xb0c6('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb0c6('0xc')]);router[_0xb0c6('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb0c6('0xd')]);router[_0xb0c6('0xe')]('/',auth[_0xb0c6('0xb')](),controller[_0xb0c6('0xf')]);router[_0xb0c6('0x10')](_0xb0c6('0x11'),auth[_0xb0c6('0xb')](),controller[_0xb0c6('0x12')]);router['delete'](_0xb0c6('0x11'),auth['isAuthenticated'](),controller[_0xb0c6('0x13')]);module[_0xb0c6('0x14')]=router; \ No newline at end of file +var _0x8721=['../../config/environment','./mailSubstatus.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','Router'];(function(_0x533dd0,_0x107b7f){var _0x4ab215=function(_0x4271d8){while(--_0x4271d8){_0x533dd0['push'](_0x533dd0['shift']());}};_0x4ab215(++_0x107b7f);}(_0x8721,0xd9));var _0x1872=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x8721[_0x35a274];return _0x40d905;};'use strict';var multer=require(_0x1872('0x0'));var util=require(_0x1872('0x1'));var path=require(_0x1872('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1872('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1872('0x4'));var controller=require(_0x1872('0x5'));router[_0x1872('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1872('0x6')](_0x1872('0x7'),auth[_0x1872('0x8')](),controller['describe']);router[_0x1872('0x6')](_0x1872('0x9'),auth[_0x1872('0x8')](),controller[_0x1872('0xa')]);router[_0x1872('0xb')]('/',auth[_0x1872('0x8')](),controller[_0x1872('0xc')]);router[_0x1872('0xd')](_0x1872('0x9'),auth[_0x1872('0x8')](),controller[_0x1872('0xe')]);router['delete'](_0x1872('0x9'),auth[_0x1872('0x8')](),controller[_0x1872('0xf')]);module[_0x1872('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 612edf1..39fbb7c 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 _0x3a6d=['exports','name','STRING','sequelize'];(function(_0x38e5ee,_0x3cd0cb){var _0x85812d=function(_0x3715a7){while(--_0x3715a7){_0x38e5ee['push'](_0x38e5ee['shift']());}};_0x85812d(++_0x3cd0cb);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x3a6d[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0xd3a6('0x0'));module[_0xd3a6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd3a6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd3a6('0x3')]}}; \ No newline at end of file +var _0x0adf=['STRING','sequelize','exports'];(function(_0x15f53f,_0x2f7eae){var _0x3da398=function(_0x45fe12){while(--_0x45fe12){_0x15f53f['push'](_0x15f53f['shift']());}};_0x3da398(++_0x2f7eae);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x5e6f96,_0x6ce66d){_0x5e6f96=_0x5e6f96-0x0;var _0x466478=_0x0adf[_0x5e6f96];return _0x466478;};'use strict';var Sequelize=require(_0xf0ad('0x0'));module[_0xf0ad('0x1')]={'name':{'type':Sequelize[_0xf0ad('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf0ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 6eddc1d..1cea48b 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 _0xf4ab=['status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','stack','name','send','merge','body','contact','agent','account','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','includeAll','include','MailSubstatus','findAll','rows','catch','show','params','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x34f741,_0x19221f){var _0x48bc42=function(_0x294d07){while(--_0x294d07){_0x34f741['push'](_0x34f741['shift']());}};_0x48bc42(++_0x19221f);}(_0xf4ab,0xd2));var _0xbf4a=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0xf4ab[_0x406696];return _0x10e35c;};'use strict';var emlformat=require(_0xbf4a('0x0'));var rimraf=require(_0xbf4a('0x1'));var zipdir=require(_0xbf4a('0x2'));var jsonpatch=require(_0xbf4a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf4a('0x4'));var util=require(_0xbf4a('0x5'));var path=require(_0xbf4a('0x6'));var sox=require(_0xbf4a('0x7'));var csv=require(_0xbf4a('0x8'));var ejs=require(_0xbf4a('0x9'));var fs=require('fs');var fs_extra=require(_0xbf4a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbf4a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbf4a('0xc'));var toCsv=require(_0xbf4a('0x8'));var querystring=require(_0xbf4a('0xd'));var Papa=require(_0xbf4a('0xe'));var Redis=require(_0xbf4a('0xf'));var authService=require(_0xbf4a('0x10'));var qs=require(_0xbf4a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf4a('0x12'));var logger=require(_0xbf4a('0x13'))(_0xbf4a('0x14'));var utils=require(_0xbf4a('0x15'));var config=require(_0xbf4a('0x16'));var licenseUtil=require(_0xbf4a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29cd4f,_0x15afa1){_0x15afa1=_0x15afa1||0xcc;return function(_0x84fa7b){if(_0x84fa7b){return _0x29cd4f['sendStatus'](_0x15afa1);}return _0x29cd4f[_0xbf4a('0x18')](_0x15afa1)[_0xbf4a('0x19')]();};}function respondWithResult(_0x2a92aa,_0x3d8687){_0x3d8687=_0x3d8687||0xc8;return function(_0xeb75e1){if(_0xeb75e1){return _0x2a92aa['status'](_0x3d8687)[_0xbf4a('0x1a')](_0xeb75e1);}};}function respondWithFilteredResult(_0xe9c0b1,_0x17c21f){return function(_0x1add2d){if(_0x1add2d){var _0x1ad19b=typeof _0x17c21f[_0xbf4a('0x1b')]===_0xbf4a('0x1c')&&typeof _0x17c21f[_0xbf4a('0x1d')]===_0xbf4a('0x1c');var _0x4c0c0d=_0x1add2d[_0xbf4a('0x1e')];var _0x14b75a=_0x1ad19b?0x0:_0x17c21f['offset'];var _0x2f072a=_0x1ad19b?_0x1add2d['count']:_0x17c21f[_0xbf4a('0x1b')]+_0x17c21f[_0xbf4a('0x1d')];var _0x3aa327;if(_0x2f072a>=_0x4c0c0d){_0x2f072a=_0x4c0c0d;_0x3aa327=0xc8;}else{_0x3aa327=0xce;}_0xe9c0b1[_0xbf4a('0x18')](_0x3aa327);return _0xe9c0b1[_0xbf4a('0x1f')]('Content-Range',_0x14b75a+'-'+_0x2f072a+'/'+_0x4c0c0d)['json'](_0x1add2d);}return null;};}function patchUpdates(_0x2205b4){return function(_0x3a6bb8){try{jsonpatch['apply'](_0x3a6bb8,_0x2205b4,!![]);}catch(_0x469205){return BPromise[_0xbf4a('0x20')](_0x469205);}return _0x3a6bb8[_0xbf4a('0x21')]();};}function saveUpdates(_0x300532,_0x528112){return function(_0x24dac1){if(_0x24dac1){return _0x24dac1[_0xbf4a('0x22')](_0x300532)[_0xbf4a('0x23')](function(_0x47ee12){return _0x47ee12;});}return null;};}function removeEntity(_0x250351,_0x2d6331){return function(_0x4cf010){if(_0x4cf010){return _0x4cf010[_0xbf4a('0x24')]()[_0xbf4a('0x23')](function(){_0x250351['status'](0xcc)[_0xbf4a('0x19')]();});}};}function handleEntityNotFound(_0x474e3a,_0x54f11d){return function(_0x84a5fb){if(!_0x84a5fb){_0x474e3a[_0xbf4a('0x25')](0x194);}return _0x84a5fb;};}function handleError(_0xcd0a12,_0x212ad5){_0x212ad5=_0x212ad5||0x1f4;return function(_0x283af6){logger['error'](_0x283af6[_0xbf4a('0x26')]);if(_0x283af6[_0xbf4a('0x27')]){delete _0x283af6[_0xbf4a('0x27')];}_0xcd0a12[_0xbf4a('0x18')](_0x212ad5)[_0xbf4a('0x28')](_0x283af6);};}function getMustacheRender(_0x293f9b,_0x494edc){return Mustache['render'](_0x293f9b,_[_0xbf4a('0x29')](_0x494edc[_0xbf4a('0x2a')],{'contact':_0x494edc[_0xbf4a('0x2b')],'message':_0x494edc['message'],'agent':_0x494edc[_0xbf4a('0x2c')],'interaction':_0x494edc['interaction'],'account':_0x494edc[_0xbf4a('0x2d')]}))||'';}exports[_0xbf4a('0x2e')]=function(_0x56f9ba,_0x274abe){var _0x514f54={},_0x1b0c6a={},_0x5bddc1={'count':0x0,'rows':[]};var _0x2d75c1=_[_0xbf4a('0x2f')](db['MailSubstatus'][_0xbf4a('0x30')],function(_0x31619b){return{'name':_0x31619b[_0xbf4a('0x31')],'type':_0x31619b[_0xbf4a('0x32')][_0xbf4a('0x33')]};});_0x1b0c6a[_0xbf4a('0x34')]=_[_0xbf4a('0x2f')](_0x2d75c1,'name');_0x1b0c6a[_0xbf4a('0x35')]=_[_0xbf4a('0x36')](_0x56f9ba[_0xbf4a('0x35')]);_0x1b0c6a[_0xbf4a('0x37')]=_[_0xbf4a('0x38')](_0x1b0c6a[_0xbf4a('0x34')],_0x1b0c6a[_0xbf4a('0x35')]);_0x514f54[_0xbf4a('0x39')]=_[_0xbf4a('0x38')](_0x1b0c6a[_0xbf4a('0x34')],qs[_0xbf4a('0x3a')](_0x56f9ba[_0xbf4a('0x35')]['fields']));_0x514f54[_0xbf4a('0x39')]=_0x514f54[_0xbf4a('0x39')][_0xbf4a('0x3b')]?_0x514f54[_0xbf4a('0x39')]:_0x1b0c6a['model'];if(!_0x56f9ba['query'][_0xbf4a('0x3c')](_0xbf4a('0x3d'))){_0x514f54['limit']=qs[_0xbf4a('0x1d')](_0x56f9ba['query'][_0xbf4a('0x1d')]);_0x514f54['offset']=qs[_0xbf4a('0x1b')](_0x56f9ba[_0xbf4a('0x35')][_0xbf4a('0x1b')]);}_0x514f54[_0xbf4a('0x3e')]=qs['sort'](_0x56f9ba[_0xbf4a('0x35')][_0xbf4a('0x3f')]);_0x514f54['where']=qs[_0xbf4a('0x37')](_[_0xbf4a('0x40')](_0x56f9ba[_0xbf4a('0x35')],_0x1b0c6a['filters']),_0x2d75c1);if(_0x56f9ba[_0xbf4a('0x35')][_0xbf4a('0x41')]){_0x514f54[_0xbf4a('0x42')]=_['merge'](_0x514f54[_0xbf4a('0x42')],{'$or':_[_0xbf4a('0x2f')](_0x2d75c1,function(_0x14b134){if(_0x14b134[_0xbf4a('0x32')]!==_0xbf4a('0x43')){var _0x905a89={};_0x905a89[_0x14b134['name']]={'$like':'%'+_0x56f9ba['query'][_0xbf4a('0x41')]+'%'};return _0x905a89;}})});}_0x514f54=_[_0xbf4a('0x29')]({},_0x514f54,_0x56f9ba['options']);var _0x2ffe39={'where':_0x514f54[_0xbf4a('0x42')]};return db['MailSubstatus'][_0xbf4a('0x1e')](_0x2ffe39)[_0xbf4a('0x23')](function(_0x5b42c5){_0x5bddc1['count']=_0x5b42c5;if(_0x56f9ba[_0xbf4a('0x35')][_0xbf4a('0x44')]){_0x514f54[_0xbf4a('0x45')]=[{'all':!![]}];}return db[_0xbf4a('0x46')][_0xbf4a('0x47')](_0x514f54);})[_0xbf4a('0x23')](function(_0x3a5fe0){_0x5bddc1[_0xbf4a('0x48')]=_0x3a5fe0;return _0x5bddc1;})[_0xbf4a('0x23')](respondWithFilteredResult(_0x274abe,_0x514f54))[_0xbf4a('0x49')](handleError(_0x274abe,null));};exports[_0xbf4a('0x4a')]=function(_0x3fec45,_0x4fb3d1){var _0x1e35a6={'raw':!![],'where':{'id':_0x3fec45[_0xbf4a('0x4b')]['id']}},_0x366592={};_0x366592[_0xbf4a('0x34')]=_[_0xbf4a('0x36')](db[_0xbf4a('0x46')][_0xbf4a('0x30')]);_0x366592[_0xbf4a('0x35')]=_[_0xbf4a('0x36')](_0x3fec45[_0xbf4a('0x35')]);_0x366592[_0xbf4a('0x37')]=_[_0xbf4a('0x38')](_0x366592['model'],_0x366592['query']);_0x1e35a6[_0xbf4a('0x39')]=_[_0xbf4a('0x38')](_0x366592[_0xbf4a('0x34')],qs[_0xbf4a('0x3a')](_0x3fec45[_0xbf4a('0x35')][_0xbf4a('0x3a')]));_0x1e35a6[_0xbf4a('0x39')]=_0x1e35a6['attributes']['length']?_0x1e35a6[_0xbf4a('0x39')]:_0x366592['model'];if(_0x3fec45[_0xbf4a('0x35')][_0xbf4a('0x44')]){_0x1e35a6[_0xbf4a('0x45')]=[{'all':!![]}];}_0x1e35a6=_['merge']({},_0x1e35a6,_0x3fec45['options']);return db[_0xbf4a('0x46')][_0xbf4a('0x4c')](_0x1e35a6)[_0xbf4a('0x23')](handleEntityNotFound(_0x4fb3d1,null))[_0xbf4a('0x23')](respondWithResult(_0x4fb3d1,null))[_0xbf4a('0x49')](handleError(_0x4fb3d1,null));};exports['create']=function(_0x31d186,_0x178470){return db[_0xbf4a('0x46')]['create'](_0x31d186[_0xbf4a('0x2a')],{})[_0xbf4a('0x23')](respondWithResult(_0x178470,0xc9))[_0xbf4a('0x49')](handleError(_0x178470,null));};exports['update']=function(_0x5a38f8,_0x2868a2){if(_0x5a38f8[_0xbf4a('0x2a')]['id']){delete _0x5a38f8[_0xbf4a('0x2a')]['id'];}return db[_0xbf4a('0x46')][_0xbf4a('0x4c')]({'where':{'id':_0x5a38f8[_0xbf4a('0x4b')]['id']}})[_0xbf4a('0x23')](handleEntityNotFound(_0x2868a2,null))['then'](saveUpdates(_0x5a38f8[_0xbf4a('0x2a')],null))['then'](respondWithResult(_0x2868a2,null))[_0xbf4a('0x49')](handleError(_0x2868a2,null));};exports['destroy']=function(_0x4df70a,_0x259553){return db[_0xbf4a('0x46')][_0xbf4a('0x4c')]({'where':{'id':_0x4df70a[_0xbf4a('0x4b')]['id']}})[_0xbf4a('0x23')](handleEntityNotFound(_0x259553,null))[_0xbf4a('0x23')](removeEntity(_0x259553,null))['catch'](handleError(_0x259553,null));};exports[_0xbf4a('0x4d')]=function(_0x466aa6,_0x539529){return db['MailSubstatus'][_0xbf4a('0x4d')]()[_0xbf4a('0x23')](respondWithResult(_0x539529,null))[_0xbf4a('0x49')](handleError(_0x539529,null));}; \ No newline at end of file +var _0xd5d7=['includeAll','findAll','catch','show','params','length','include','find','create','describe','eml-format','rimraf','request-promise','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','merge','body','contact','message','interaction','map','MailSubstatus','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','options'];(function(_0x2e1cc1,_0x5ad85c){var _0x1b2263=function(_0x504ebf){while(--_0x504ebf){_0x2e1cc1['push'](_0x2e1cc1['shift']());}};_0x1b2263(++_0x5ad85c);}(_0xd5d7,0xa0));var _0x7d5d=function(_0x166648,_0x972613){_0x166648=_0x166648-0x0;var _0x547409=_0xd5d7[_0x166648];return _0x547409;};'use strict';var emlformat=require(_0x7d5d('0x0'));var rimraf=require(_0x7d5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7d5d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d5d('0x3'));var path=require(_0x7d5d('0x4'));var sox=require(_0x7d5d('0x5'));var csv=require('to-csv');var ejs=require(_0x7d5d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d5d('0x7'));var squel=require(_0x7d5d('0x8'));var crypto=require(_0x7d5d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7d5d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7d5d('0xb'));var Papa=require(_0x7d5d('0xc'));var Redis=require(_0x7d5d('0xd'));var authService=require(_0x7d5d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7d5d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d5d('0x10'))('api');var utils=require(_0x7d5d('0x11'));var config=require(_0x7d5d('0x12'));var licenseUtil=require(_0x7d5d('0x13'));var db=require(_0x7d5d('0x14'))['db'];function respondWithStatusCode(_0x116da2,_0x5d6472){_0x5d6472=_0x5d6472||0xcc;return function(_0x5b358d){if(_0x5b358d){return _0x116da2[_0x7d5d('0x15')](_0x5d6472);}return _0x116da2[_0x7d5d('0x16')](_0x5d6472)[_0x7d5d('0x17')]();};}function respondWithResult(_0x11dd93,_0x3bd11f){_0x3bd11f=_0x3bd11f||0xc8;return function(_0x8018e){if(_0x8018e){return _0x11dd93[_0x7d5d('0x16')](_0x3bd11f)[_0x7d5d('0x18')](_0x8018e);}};}function respondWithFilteredResult(_0x18e8eb,_0xc5c35){return function(_0x14a093){if(_0x14a093){var _0x4b04c1=typeof _0xc5c35[_0x7d5d('0x19')]===_0x7d5d('0x1a')&&typeof _0xc5c35[_0x7d5d('0x1b')]===_0x7d5d('0x1a');var _0x3424d3=_0x14a093[_0x7d5d('0x1c')];var _0x440d01=_0x4b04c1?0x0:_0xc5c35[_0x7d5d('0x19')];var _0x707515=_0x4b04c1?_0x14a093[_0x7d5d('0x1c')]:_0xc5c35[_0x7d5d('0x19')]+_0xc5c35['limit'];var _0x5aef87;if(_0x707515>=_0x3424d3){_0x707515=_0x3424d3;_0x5aef87=0xc8;}else{_0x5aef87=0xce;}_0x18e8eb[_0x7d5d('0x16')](_0x5aef87);return _0x18e8eb[_0x7d5d('0x1d')]('Content-Range',_0x440d01+'-'+_0x707515+'/'+_0x3424d3)[_0x7d5d('0x18')](_0x14a093);}return null;};}function patchUpdates(_0x1920da){return function(_0x3cb1a6){try{jsonpatch[_0x7d5d('0x1e')](_0x3cb1a6,_0x1920da,!![]);}catch(_0x4c5b14){return BPromise['reject'](_0x4c5b14);}return _0x3cb1a6[_0x7d5d('0x1f')]();};}function saveUpdates(_0x15f3bd,_0x21b6dc){return function(_0x5abd65){if(_0x5abd65){return _0x5abd65[_0x7d5d('0x20')](_0x15f3bd)[_0x7d5d('0x21')](function(_0x49a25a){return _0x49a25a;});}return null;};}function removeEntity(_0x160ce2,_0x3bccf9){return function(_0x560eba){if(_0x560eba){return _0x560eba[_0x7d5d('0x22')]()['then'](function(){_0x160ce2['status'](0xcc)[_0x7d5d('0x17')]();});}};}function handleEntityNotFound(_0xee420,_0xc66cdb){return function(_0x71642f){if(!_0x71642f){_0xee420[_0x7d5d('0x15')](0x194);}return _0x71642f;};}function handleError(_0x55e834,_0x4d155b){_0x4d155b=_0x4d155b||0x1f4;return function(_0x1310b5){logger[_0x7d5d('0x23')](_0x1310b5[_0x7d5d('0x24')]);if(_0x1310b5[_0x7d5d('0x25')]){delete _0x1310b5[_0x7d5d('0x25')];}_0x55e834[_0x7d5d('0x16')](_0x4d155b)[_0x7d5d('0x26')](_0x1310b5);};}function getMustacheRender(_0x49dc50,_0x1baf30){return Mustache['render'](_0x49dc50,_[_0x7d5d('0x27')](_0x1baf30[_0x7d5d('0x28')],{'contact':_0x1baf30[_0x7d5d('0x29')],'message':_0x1baf30[_0x7d5d('0x2a')],'agent':_0x1baf30['agent'],'interaction':_0x1baf30[_0x7d5d('0x2b')],'account':_0x1baf30['account']}))||'';}exports['index']=function(_0x2d03fc,_0x531312){var _0x4e68fc={},_0x14b777={},_0x1fec5b={'count':0x0,'rows':[]};var _0x101791=_[_0x7d5d('0x2c')](db[_0x7d5d('0x2d')][_0x7d5d('0x2e')],function(_0x38dfe4){return{'name':_0x38dfe4[_0x7d5d('0x2f')],'type':_0x38dfe4['type'][_0x7d5d('0x30')]};});_0x14b777['model']=_[_0x7d5d('0x2c')](_0x101791,_0x7d5d('0x25'));_0x14b777['query']=_[_0x7d5d('0x31')](_0x2d03fc[_0x7d5d('0x32')]);_0x14b777[_0x7d5d('0x33')]=_[_0x7d5d('0x34')](_0x14b777[_0x7d5d('0x35')],_0x14b777['query']);_0x4e68fc[_0x7d5d('0x36')]=_[_0x7d5d('0x34')](_0x14b777[_0x7d5d('0x35')],qs['fields'](_0x2d03fc[_0x7d5d('0x32')][_0x7d5d('0x37')]));_0x4e68fc[_0x7d5d('0x36')]=_0x4e68fc['attributes']['length']?_0x4e68fc['attributes']:_0x14b777[_0x7d5d('0x35')];if(!_0x2d03fc[_0x7d5d('0x32')][_0x7d5d('0x38')]('nolimit')){_0x4e68fc[_0x7d5d('0x1b')]=qs[_0x7d5d('0x1b')](_0x2d03fc[_0x7d5d('0x32')][_0x7d5d('0x1b')]);_0x4e68fc[_0x7d5d('0x19')]=qs['offset'](_0x2d03fc[_0x7d5d('0x32')][_0x7d5d('0x19')]);}_0x4e68fc[_0x7d5d('0x39')]=qs[_0x7d5d('0x3a')](_0x2d03fc[_0x7d5d('0x32')]['sort']);_0x4e68fc[_0x7d5d('0x3b')]=qs[_0x7d5d('0x33')](_[_0x7d5d('0x3c')](_0x2d03fc['query'],_0x14b777[_0x7d5d('0x33')]),_0x101791);if(_0x2d03fc['query']['filter']){_0x4e68fc[_0x7d5d('0x3b')]=_[_0x7d5d('0x27')](_0x4e68fc[_0x7d5d('0x3b')],{'$or':_[_0x7d5d('0x2c')](_0x101791,function(_0x1d87cc){if(_0x1d87cc[_0x7d5d('0x3d')]!==_0x7d5d('0x3e')){var _0x31c1f7={};_0x31c1f7[_0x1d87cc[_0x7d5d('0x25')]]={'$like':'%'+_0x2d03fc[_0x7d5d('0x32')][_0x7d5d('0x3f')]+'%'};return _0x31c1f7;}})});}_0x4e68fc=_[_0x7d5d('0x27')]({},_0x4e68fc,_0x2d03fc[_0x7d5d('0x40')]);var _0xd8f870={'where':_0x4e68fc['where']};return db[_0x7d5d('0x2d')]['count'](_0xd8f870)[_0x7d5d('0x21')](function(_0x45901b){_0x1fec5b[_0x7d5d('0x1c')]=_0x45901b;if(_0x2d03fc[_0x7d5d('0x32')][_0x7d5d('0x41')]){_0x4e68fc['include']=[{'all':!![]}];}return db[_0x7d5d('0x2d')][_0x7d5d('0x42')](_0x4e68fc);})[_0x7d5d('0x21')](function(_0x38bcca){_0x1fec5b['rows']=_0x38bcca;return _0x1fec5b;})[_0x7d5d('0x21')](respondWithFilteredResult(_0x531312,_0x4e68fc))[_0x7d5d('0x43')](handleError(_0x531312,null));};exports[_0x7d5d('0x44')]=function(_0x1c3f8d,_0x548fa5){var _0x439134={'raw':!![],'where':{'id':_0x1c3f8d[_0x7d5d('0x45')]['id']}},_0x269c9c={};_0x269c9c[_0x7d5d('0x35')]=_['keys'](db[_0x7d5d('0x2d')][_0x7d5d('0x2e')]);_0x269c9c[_0x7d5d('0x32')]=_[_0x7d5d('0x31')](_0x1c3f8d[_0x7d5d('0x32')]);_0x269c9c[_0x7d5d('0x33')]=_[_0x7d5d('0x34')](_0x269c9c['model'],_0x269c9c['query']);_0x439134[_0x7d5d('0x36')]=_[_0x7d5d('0x34')](_0x269c9c[_0x7d5d('0x35')],qs[_0x7d5d('0x37')](_0x1c3f8d[_0x7d5d('0x32')]['fields']));_0x439134[_0x7d5d('0x36')]=_0x439134['attributes'][_0x7d5d('0x46')]?_0x439134[_0x7d5d('0x36')]:_0x269c9c[_0x7d5d('0x35')];if(_0x1c3f8d['query'][_0x7d5d('0x41')]){_0x439134[_0x7d5d('0x47')]=[{'all':!![]}];}_0x439134=_[_0x7d5d('0x27')]({},_0x439134,_0x1c3f8d[_0x7d5d('0x40')]);return db['MailSubstatus'][_0x7d5d('0x48')](_0x439134)[_0x7d5d('0x21')](handleEntityNotFound(_0x548fa5,null))[_0x7d5d('0x21')](respondWithResult(_0x548fa5,null))[_0x7d5d('0x43')](handleError(_0x548fa5,null));};exports[_0x7d5d('0x49')]=function(_0x156a7b,_0xe6ff29){return db['MailSubstatus'][_0x7d5d('0x49')](_0x156a7b[_0x7d5d('0x28')],{})[_0x7d5d('0x21')](respondWithResult(_0xe6ff29,0xc9))['catch'](handleError(_0xe6ff29,null));};exports['update']=function(_0x1fbb8d,_0x2ba3fc){if(_0x1fbb8d[_0x7d5d('0x28')]['id']){delete _0x1fbb8d['body']['id'];}return db[_0x7d5d('0x2d')][_0x7d5d('0x48')]({'where':{'id':_0x1fbb8d['params']['id']}})['then'](handleEntityNotFound(_0x2ba3fc,null))[_0x7d5d('0x21')](saveUpdates(_0x1fbb8d[_0x7d5d('0x28')],null))[_0x7d5d('0x21')](respondWithResult(_0x2ba3fc,null))[_0x7d5d('0x43')](handleError(_0x2ba3fc,null));};exports[_0x7d5d('0x22')]=function(_0x3cbf69,_0x308988){return db['MailSubstatus'][_0x7d5d('0x48')]({'where':{'id':_0x3cbf69[_0x7d5d('0x45')]['id']}})[_0x7d5d('0x21')](handleEntityNotFound(_0x308988,null))[_0x7d5d('0x21')](removeEntity(_0x308988,null))[_0x7d5d('0x43')](handleError(_0x308988,null));};exports[_0x7d5d('0x4a')]=function(_0x3c3375,_0x2f6ef4){return db[_0x7d5d('0x2d')]['describe']()[_0x7d5d('0x21')](respondWithResult(_0x2f6ef4,null))['catch'](handleError(_0x2f6ef4,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 41e4392..f94bf5f 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 _0x79a3=['./mailSubstatus.attributes','exports','lodash','../../config/logger','api','bluebird','../../config/environment'];(function(_0x31666a,_0x3b2517){var _0x323377=function(_0x1833ad){while(--_0x1833ad){_0x31666a['push'](_0x31666a['shift']());}};_0x323377(++_0x3b2517);}(_0x79a3,0x80));var _0x379a=function(_0x155b2f,_0x927966){_0x155b2f=_0x155b2f-0x0;var _0x14f331=_0x79a3[_0x155b2f];return _0x14f331;};'use strict';var _=require(_0x379a('0x0'));var util=require('util');var logger=require(_0x379a('0x1'))(_0x379a('0x2'));var moment=require('moment');var BPromise=require(_0x379a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x379a('0x4'));var attributes=require(_0x379a('0x5'));module[_0x379a('0x6')]=function(_0x14907a,_0x9e6da6){return _0x14907a['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d5b=['exports','MailSubstatus','mail_substatuses','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailSubstatus.attributes'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x9d5b,0x14d));var _0xb9d5=function(_0xbf9f31,_0x30e7b7){_0xbf9f31=_0xbf9f31-0x0;var _0x29240c=_0x9d5b[_0xbf9f31];return _0x29240c;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var logger=require(_0xb9d5('0x1'))(_0xb9d5('0x2'));var moment=require(_0xb9d5('0x3'));var BPromise=require(_0xb9d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9d5('0x5'));var rimraf=require('rimraf');var config=require(_0xb9d5('0x6'));var attributes=require(_0xb9d5('0x7'));module[_0xb9d5('0x8')]=function(_0x39d8fe,_0x422a92){return _0x39d8fe['define'](_0xb9d5('0x9'),attributes,{'tableName':_0xb9d5('0xa'),'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 a9653da..e35767b 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 _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x1b857f,_0x286e31){var _0x5582e9=function(_0x643a90){while(--_0x643a90){_0x1b857f['push'](_0x1b857f['shift']());}};_0x5582e9(++_0x286e31);}(_0xb821,0xa7));var _0x1b82=function(_0x94ec65,_0x3100e3){_0x94ec65=_0x94ec65-0x0;var _0x5d8c43=_0xb821[_0x94ec65];return _0x5d8c43;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +var _0xf4eb=['MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x43907c,_0x4ab831){var _0x42b194=function(_0x3e6552){while(--_0x3e6552){_0x43907c['push'](_0x43907c['shift']());}};_0x42b194(++_0x4ab831);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4d7949,_0x2fe176){_0x4d7949=_0x4d7949-0x0;var _0x28f47e=_0xf4eb[_0x4d7949];return _0x28f47e;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d31a91a..758d3b7 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 _0x2285=['../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x44f48e,_0x547f78){var _0x58a61c=function(_0xd641bc){while(--_0xd641bc){_0x44f48e['push'](_0x44f48e['shift']());}};_0x58a61c(++_0x547f78);}(_0x2285,0x177));var _0x5228=function(_0x6a8e70,_0x5ee57a){_0x6a8e70=_0x6a8e70-0x0;var _0x21b74f=_0x2285[_0x6a8e70];return _0x21b74f;};'use strict';var multer=require('multer');var util=require(_0x5228('0x0'));var path=require(_0x5228('0x1'));var timeout=require(_0x5228('0x2'));var express=require(_0x5228('0x3'));var router=express[_0x5228('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5228('0x5'));var interaction=require(_0x5228('0x6'));var config=require('../../config/environment');var controller=require(_0x5228('0x7'));router[_0x5228('0x8')]('/',auth[_0x5228('0x9')](),controller['index']);router[_0x5228('0x8')](_0x5228('0xa'),auth[_0x5228('0x9')](),controller[_0x5228('0xb')]);router[_0x5228('0x8')](_0x5228('0xc'),auth[_0x5228('0x9')](),controller[_0x5228('0xd')]);router[_0x5228('0xe')]('/',auth[_0x5228('0x9')](),controller['create']);router[_0x5228('0xf')](_0x5228('0xc'),auth[_0x5228('0x9')](),controller[_0x5228('0x10')]);router['delete'](_0x5228('0xc'),auth[_0x5228('0x9')](),controller[_0x5228('0x11')]);module[_0x5228('0x12')]=router; \ No newline at end of file +var _0x8f7d=['put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x1af0ad,_0x48a7e8){var _0x58c867=function(_0x438504){while(--_0x438504){_0x1af0ad['push'](_0x1af0ad['shift']());}};_0x58c867(++_0x48a7e8);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x4ca5ee,_0x2819ea){_0x4ca5ee=_0x4ca5ee-0x0;var _0x429e5d=_0x8f7d[_0x4ca5ee];return _0x429e5d;};'use strict';var multer=require(_0xd8f7('0x0'));var util=require(_0xd8f7('0x1'));var path=require('path');var timeout=require(_0xd8f7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd8f7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd8f7('0x4'));var config=require(_0xd8f7('0x5'));var controller=require(_0xd8f7('0x6'));router[_0xd8f7('0x7')]('/',auth['isAuthenticated'](),controller[_0xd8f7('0x8')]);router[_0xd8f7('0x7')](_0xd8f7('0x9'),auth[_0xd8f7('0xa')](),controller[_0xd8f7('0xb')]);router[_0xd8f7('0x7')](_0xd8f7('0xc'),auth[_0xd8f7('0xa')](),controller['show']);router[_0xd8f7('0xd')]('/',auth['isAuthenticated'](),controller[_0xd8f7('0xe')]);router[_0xd8f7('0xf')](_0xd8f7('0xc'),auth[_0xd8f7('0xa')](),controller[_0xd8f7('0x10')]);router[_0xd8f7('0x11')](_0xd8f7('0xc'),auth[_0xd8f7('0xa')](),controller[_0xd8f7('0x12')]);module[_0xd8f7('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 9061b1e..51840a3 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 _0x07af=['queue','NOW','moment','exports','STRING','ENUM','account'];(function(_0x1133c7,_0x1a05ec){var _0x413d68=function(_0x17f263){while(--_0x17f263){_0x1133c7['push'](_0x1133c7['shift']());}};_0x413d68(++_0x1a05ec);}(_0x07af,0xfe));var _0xf07a=function(_0x48c41f,_0x59ebd3){_0x48c41f=_0x48c41f-0x0;var _0xdf9920=_0x07af[_0x48c41f];return _0xdf9920;};'use strict';var moment=require(_0xf07a('0x0'));var Sequelize=require('sequelize');module[_0xf07a('0x1')]={'uniqueid':{'type':Sequelize[_0xf07a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf07a('0x3')](_0xf07a('0x4'),'agent',_0xf07a('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf07a('0x6')]}}; \ No newline at end of file +var _0xf267=['account','agent','queue','DATE','NOW','sequelize','exports','STRING'];(function(_0x46bcdb,_0x4747d3){var _0xb45fb8=function(_0x105651){while(--_0x105651){_0x46bcdb['push'](_0x46bcdb['shift']());}};_0xb45fb8(++_0x4747d3);}(_0xf267,0x115));var _0x7f26=function(_0x5566f6,_0x10a8a4){_0x5566f6=_0x5566f6-0x0;var _0xdefa24=_0xf267[_0x5566f6];return _0xdefa24;};'use strict';var moment=require('moment');var Sequelize=require(_0x7f26('0x0'));module[_0x7f26('0x1')]={'uniqueid':{'type':Sequelize[_0x7f26('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7f26('0x3'),_0x7f26('0x4'),_0x7f26('0x5')),'allowNull':![],'defaultValue':_0x7f26('0x5')},'transferredAt':{'type':Sequelize[_0x7f26('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x7f26('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index cc3738a..1121e21 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 _0x5829=['../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','set','Content-Range','reject','update','then','destroy','end','sendStatus','error','stack','name','send','merge','contact','message','agent','interaction','account','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x21c814,_0x1d7537){var _0x2ad3d7=function(_0x1829fd){while(--_0x1829fd){_0x21c814['push'](_0x21c814['shift']());}};_0x2ad3d7(++_0x1d7537);}(_0x5829,0xe0));var _0x9582=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x5829[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require(_0x9582('0x0'));var rimraf=require(_0x9582('0x1'));var zipdir=require(_0x9582('0x2'));var jsonpatch=require(_0x9582('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9582('0x4'));var Mustache=require('mustache');var util=require(_0x9582('0x5'));var path=require(_0x9582('0x6'));var sox=require(_0x9582('0x7'));var csv=require(_0x9582('0x8'));var ejs=require(_0x9582('0x9'));var fs=require('fs');var fs_extra=require(_0x9582('0xa'));var _=require(_0x9582('0xb'));var squel=require(_0x9582('0xc'));var crypto=require(_0x9582('0xd'));var jsforce=require(_0x9582('0xe'));var deskjs=require(_0x9582('0xf'));var toCsv=require(_0x9582('0x8'));var querystring=require(_0x9582('0x10'));var Papa=require(_0x9582('0x11'));var Redis=require(_0x9582('0x12'));var authService=require(_0x9582('0x13'));var qs=require(_0x9582('0x14'));var as=require(_0x9582('0x15'));var hardwareService=require(_0x9582('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x9582('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9582('0x18'));var db=require(_0x9582('0x19'))['db'];function respondWithStatusCode(_0x2ade93,_0x4fe4ce){_0x4fe4ce=_0x4fe4ce||0xcc;return function(_0x479d75){if(_0x479d75){return _0x2ade93['sendStatus'](_0x4fe4ce);}return _0x2ade93[_0x9582('0x1a')](_0x4fe4ce)['end']();};}function respondWithResult(_0x3b2ea6,_0x40f999){_0x40f999=_0x40f999||0xc8;return function(_0x572d60){if(_0x572d60){return _0x3b2ea6['status'](_0x40f999)[_0x9582('0x1b')](_0x572d60);}};}function respondWithFilteredResult(_0x4ac0cb,_0x50af60){return function(_0x168db3){if(_0x168db3){var _0x4396a6=typeof _0x50af60['offset']===_0x9582('0x1c')&&typeof _0x50af60['limit']==='undefined';var _0x2845e6=_0x168db3[_0x9582('0x1d')];var _0x3d1d1=_0x4396a6?0x0:_0x50af60[_0x9582('0x1e')];var _0x1713a9=_0x4396a6?_0x168db3['count']:_0x50af60[_0x9582('0x1e')]+_0x50af60['limit'];var _0x19326c;if(_0x1713a9>=_0x2845e6){_0x1713a9=_0x2845e6;_0x19326c=0xc8;}else{_0x19326c=0xce;}_0x4ac0cb[_0x9582('0x1a')](_0x19326c);return _0x4ac0cb[_0x9582('0x1f')](_0x9582('0x20'),_0x3d1d1+'-'+_0x1713a9+'/'+_0x2845e6)[_0x9582('0x1b')](_0x168db3);}return null;};}function patchUpdates(_0x5b9655){return function(_0x23827d){try{jsonpatch['apply'](_0x23827d,_0x5b9655,!![]);}catch(_0x12877b){return BPromise[_0x9582('0x21')](_0x12877b);}return _0x23827d['save']();};}function saveUpdates(_0x38850d,_0x5bf5ab){return function(_0x5a4d0d){if(_0x5a4d0d){return _0x5a4d0d[_0x9582('0x22')](_0x38850d)[_0x9582('0x23')](function(_0x56a5d3){return _0x56a5d3;});}return null;};}function removeEntity(_0x36ced5,_0x11525f){return function(_0xd50b98){if(_0xd50b98){return _0xd50b98[_0x9582('0x24')]()[_0x9582('0x23')](function(){_0x36ced5[_0x9582('0x1a')](0xcc)[_0x9582('0x25')]();});}};}function handleEntityNotFound(_0x28ed53,_0x1e60da){return function(_0x2e4c22){if(!_0x2e4c22){_0x28ed53[_0x9582('0x26')](0x194);}return _0x2e4c22;};}function handleError(_0x2e4880,_0x2bdf28){_0x2bdf28=_0x2bdf28||0x1f4;return function(_0xeabd8a){logger[_0x9582('0x27')](_0xeabd8a[_0x9582('0x28')]);if(_0xeabd8a['name']){delete _0xeabd8a[_0x9582('0x29')];}_0x2e4880[_0x9582('0x1a')](_0x2bdf28)[_0x9582('0x2a')](_0xeabd8a);};}function getMustacheRender(_0x29839f,_0x4a3810){return Mustache['render'](_0x29839f,_[_0x9582('0x2b')](_0x4a3810['body'],{'contact':_0x4a3810[_0x9582('0x2c')],'message':_0x4a3810[_0x9582('0x2d')],'agent':_0x4a3810[_0x9582('0x2e')],'interaction':_0x4a3810[_0x9582('0x2f')],'account':_0x4a3810[_0x9582('0x30')]}))||'';}exports[_0x9582('0x31')]=function(_0x127272,_0x177c74){var _0xc2eabf={},_0x13048f={},_0x4d1542={'count':0x0,'rows':[]};var _0x208c92=_[_0x9582('0x32')](db[_0x9582('0x33')][_0x9582('0x34')],function(_0x1f00e4){return{'name':_0x1f00e4[_0x9582('0x35')],'type':_0x1f00e4[_0x9582('0x36')]['key']};});_0x13048f[_0x9582('0x37')]=_[_0x9582('0x32')](_0x208c92,_0x9582('0x29'));_0x13048f[_0x9582('0x38')]=_[_0x9582('0x39')](_0x127272[_0x9582('0x38')]);_0x13048f[_0x9582('0x3a')]=_[_0x9582('0x3b')](_0x13048f[_0x9582('0x37')],_0x13048f[_0x9582('0x38')]);_0xc2eabf[_0x9582('0x3c')]=_['intersection'](_0x13048f['model'],qs[_0x9582('0x3d')](_0x127272[_0x9582('0x38')][_0x9582('0x3d')]));_0xc2eabf[_0x9582('0x3c')]=_0xc2eabf[_0x9582('0x3c')][_0x9582('0x3e')]?_0xc2eabf[_0x9582('0x3c')]:_0x13048f[_0x9582('0x37')];if(!_0x127272[_0x9582('0x38')][_0x9582('0x3f')](_0x9582('0x40'))){_0xc2eabf[_0x9582('0x41')]=qs[_0x9582('0x41')](_0x127272[_0x9582('0x38')][_0x9582('0x41')]);_0xc2eabf[_0x9582('0x1e')]=qs[_0x9582('0x1e')](_0x127272['query'][_0x9582('0x1e')]);}_0xc2eabf[_0x9582('0x42')]=qs[_0x9582('0x43')](_0x127272[_0x9582('0x38')][_0x9582('0x43')]);_0xc2eabf[_0x9582('0x44')]=qs[_0x9582('0x3a')](_['pick'](_0x127272[_0x9582('0x38')],_0x13048f['filters']),_0x208c92);if(_0x127272[_0x9582('0x38')][_0x9582('0x45')]){_0xc2eabf[_0x9582('0x44')]=_[_0x9582('0x2b')](_0xc2eabf['where'],{'$or':_[_0x9582('0x32')](_0x208c92,function(_0x358d8d){if(_0x358d8d[_0x9582('0x36')]!=='VIRTUAL'){var _0x41ff5f={};_0x41ff5f[_0x358d8d[_0x9582('0x29')]]={'$like':'%'+_0x127272['query'][_0x9582('0x45')]+'%'};return _0x41ff5f;}})});}_0xc2eabf=_['merge']({},_0xc2eabf,_0x127272[_0x9582('0x46')]);var _0x105f48={'where':_0xc2eabf[_0x9582('0x44')]};return db[_0x9582('0x33')][_0x9582('0x1d')](_0x105f48)['then'](function(_0x48ad10){_0x4d1542[_0x9582('0x1d')]=_0x48ad10;if(_0x127272[_0x9582('0x38')][_0x9582('0x47')]){_0xc2eabf[_0x9582('0x48')]=[{'all':!![]}];}return db[_0x9582('0x33')][_0x9582('0x49')](_0xc2eabf);})['then'](function(_0x3ffc76){_0x4d1542[_0x9582('0x4a')]=_0x3ffc76;return _0x4d1542;})['then'](respondWithFilteredResult(_0x177c74,_0xc2eabf))[_0x9582('0x4b')](handleError(_0x177c74,null));};exports[_0x9582('0x4c')]=function(_0x5767dd,_0x3f0997){var _0x51dc23={'raw':!![],'where':{'id':_0x5767dd[_0x9582('0x4d')]['id']}},_0x534523={};_0x534523[_0x9582('0x37')]=_['keys'](db['MailTransferReport'][_0x9582('0x34')]);_0x534523[_0x9582('0x38')]=_[_0x9582('0x39')](_0x5767dd[_0x9582('0x38')]);_0x534523[_0x9582('0x3a')]=_['intersection'](_0x534523[_0x9582('0x37')],_0x534523[_0x9582('0x38')]);_0x51dc23[_0x9582('0x3c')]=_[_0x9582('0x3b')](_0x534523[_0x9582('0x37')],qs[_0x9582('0x3d')](_0x5767dd[_0x9582('0x38')][_0x9582('0x3d')]));_0x51dc23[_0x9582('0x3c')]=_0x51dc23[_0x9582('0x3c')][_0x9582('0x3e')]?_0x51dc23[_0x9582('0x3c')]:_0x534523[_0x9582('0x37')];if(_0x5767dd['query'][_0x9582('0x47')]){_0x51dc23[_0x9582('0x48')]=[{'all':!![]}];}_0x51dc23=_[_0x9582('0x2b')]({},_0x51dc23,_0x5767dd[_0x9582('0x46')]);return db[_0x9582('0x33')][_0x9582('0x4e')](_0x51dc23)['then'](handleEntityNotFound(_0x3f0997,null))[_0x9582('0x23')](respondWithResult(_0x3f0997,null))[_0x9582('0x4b')](handleError(_0x3f0997,null));};exports[_0x9582('0x4f')]=function(_0x33d6f7,_0x1912c1){return db[_0x9582('0x33')]['create'](_0x33d6f7[_0x9582('0x50')],{})[_0x9582('0x23')](respondWithResult(_0x1912c1,0xc9))['catch'](handleError(_0x1912c1,null));};exports[_0x9582('0x22')]=function(_0x13857c,_0x55b3a0){if(_0x13857c['body']['id']){delete _0x13857c['body']['id'];}return db[_0x9582('0x33')]['find']({'where':{'id':_0x13857c[_0x9582('0x4d')]['id']}})['then'](handleEntityNotFound(_0x55b3a0,null))[_0x9582('0x23')](saveUpdates(_0x13857c[_0x9582('0x50')],null))[_0x9582('0x23')](respondWithResult(_0x55b3a0,null))[_0x9582('0x4b')](handleError(_0x55b3a0,null));};exports[_0x9582('0x24')]=function(_0x120bfe,_0x600f4e){return db[_0x9582('0x33')][_0x9582('0x4e')]({'where':{'id':_0x120bfe[_0x9582('0x4d')]['id']}})[_0x9582('0x23')](handleEntityNotFound(_0x600f4e,null))[_0x9582('0x23')](removeEntity(_0x600f4e,null))['catch'](handleError(_0x600f4e,null));};exports[_0x9582('0x51')]=function(_0xe0814a,_0x371d0a){return db[_0x9582('0x33')]['describe']()[_0x9582('0x23')](respondWithResult(_0x371d0a,null))[_0x9582('0x4b')](handleError(_0x371d0a,null));}; \ No newline at end of file +var _0x65ee=['contact','message','agent','interaction','account','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','include','rows','catch','show','params','options','find','create','update','describe','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','render','merge','body'];(function(_0x35d1df,_0x23db2f){var _0x29ca4b=function(_0x5a1ee9){while(--_0x5a1ee9){_0x35d1df['push'](_0x35d1df['shift']());}};_0x29ca4b(++_0x23db2f);}(_0x65ee,0xc4));var _0xe65e=function(_0x323661,_0x2cf425){_0x323661=_0x323661-0x0;var _0x369f43=_0x65ee[_0x323661];return _0x369f43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe65e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe65e('0x1'));var Mustache=require(_0xe65e('0x2'));var util=require(_0xe65e('0x3'));var path=require(_0xe65e('0x4'));var sox=require(_0xe65e('0x5'));var csv=require(_0xe65e('0x6'));var ejs=require(_0xe65e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe65e('0x8'));var crypto=require(_0xe65e('0x9'));var jsforce=require(_0xe65e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe65e('0x6'));var querystring=require(_0xe65e('0xb'));var Papa=require(_0xe65e('0xc'));var Redis=require(_0xe65e('0xd'));var authService=require(_0xe65e('0xe'));var qs=require(_0xe65e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe65e('0x10'));var logger=require(_0xe65e('0x11'))(_0xe65e('0x12'));var utils=require('../../config/utils');var config=require(_0xe65e('0x13'));var licenseUtil=require(_0xe65e('0x14'));var db=require(_0xe65e('0x15'))['db'];function respondWithStatusCode(_0x3ad701,_0x1188dc){_0x1188dc=_0x1188dc||0xcc;return function(_0x26b9a2){if(_0x26b9a2){return _0x3ad701['sendStatus'](_0x1188dc);}return _0x3ad701['status'](_0x1188dc)[_0xe65e('0x16')]();};}function respondWithResult(_0x584f55,_0x2e26fa){_0x2e26fa=_0x2e26fa||0xc8;return function(_0x3a8e04){if(_0x3a8e04){return _0x584f55[_0xe65e('0x17')](_0x2e26fa)[_0xe65e('0x18')](_0x3a8e04);}};}function respondWithFilteredResult(_0x1197d6,_0x59638e){return function(_0x5aa071){if(_0x5aa071){var _0x17f922=typeof _0x59638e[_0xe65e('0x19')]===_0xe65e('0x1a')&&typeof _0x59638e['limit']===_0xe65e('0x1a');var _0xedbb1b=_0x5aa071[_0xe65e('0x1b')];var _0x5de867=_0x17f922?0x0:_0x59638e['offset'];var _0x346382=_0x17f922?_0x5aa071['count']:_0x59638e[_0xe65e('0x19')]+_0x59638e[_0xe65e('0x1c')];var _0x669174;if(_0x346382>=_0xedbb1b){_0x346382=_0xedbb1b;_0x669174=0xc8;}else{_0x669174=0xce;}_0x1197d6[_0xe65e('0x17')](_0x669174);return _0x1197d6['set'](_0xe65e('0x1d'),_0x5de867+'-'+_0x346382+'/'+_0xedbb1b)[_0xe65e('0x18')](_0x5aa071);}return null;};}function patchUpdates(_0x424a5d){return function(_0x47f1d8){try{jsonpatch[_0xe65e('0x1e')](_0x47f1d8,_0x424a5d,!![]);}catch(_0x5f4373){return BPromise[_0xe65e('0x1f')](_0x5f4373);}return _0x47f1d8[_0xe65e('0x20')]();};}function saveUpdates(_0x4c035c,_0xa68f48){return function(_0x1dd686){if(_0x1dd686){return _0x1dd686['update'](_0x4c035c)[_0xe65e('0x21')](function(_0x4a802c){return _0x4a802c;});}return null;};}function removeEntity(_0xfcc964,_0x228507){return function(_0x42948a){if(_0x42948a){return _0x42948a[_0xe65e('0x22')]()[_0xe65e('0x21')](function(){_0xfcc964['status'](0xcc)[_0xe65e('0x16')]();});}};}function handleEntityNotFound(_0x1f026a,_0x476162){return function(_0x224e1a){if(!_0x224e1a){_0x1f026a['sendStatus'](0x194);}return _0x224e1a;};}function handleError(_0x3871f7,_0x3910f6){_0x3910f6=_0x3910f6||0x1f4;return function(_0x5b0a50){logger['error'](_0x5b0a50[_0xe65e('0x23')]);if(_0x5b0a50['name']){delete _0x5b0a50[_0xe65e('0x24')];}_0x3871f7['status'](_0x3910f6)[_0xe65e('0x25')](_0x5b0a50);};}function getMustacheRender(_0x22dd02,_0x3b461c){return Mustache[_0xe65e('0x26')](_0x22dd02,_[_0xe65e('0x27')](_0x3b461c[_0xe65e('0x28')],{'contact':_0x3b461c[_0xe65e('0x29')],'message':_0x3b461c[_0xe65e('0x2a')],'agent':_0x3b461c[_0xe65e('0x2b')],'interaction':_0x3b461c[_0xe65e('0x2c')],'account':_0x3b461c[_0xe65e('0x2d')]}))||'';}exports[_0xe65e('0x2e')]=function(_0x1827e9,_0x1faa28){var _0x3af807={},_0x599de8={},_0x4eebaa={'count':0x0,'rows':[]};var _0x2a1314=_[_0xe65e('0x2f')](db[_0xe65e('0x30')][_0xe65e('0x31')],function(_0x1bda6f){return{'name':_0x1bda6f[_0xe65e('0x32')],'type':_0x1bda6f[_0xe65e('0x33')][_0xe65e('0x34')]};});_0x599de8[_0xe65e('0x35')]=_[_0xe65e('0x2f')](_0x2a1314,_0xe65e('0x24'));_0x599de8['query']=_[_0xe65e('0x36')](_0x1827e9[_0xe65e('0x37')]);_0x599de8['filters']=_[_0xe65e('0x38')](_0x599de8[_0xe65e('0x35')],_0x599de8['query']);_0x3af807[_0xe65e('0x39')]=_['intersection'](_0x599de8[_0xe65e('0x35')],qs[_0xe65e('0x3a')](_0x1827e9[_0xe65e('0x37')][_0xe65e('0x3a')]));_0x3af807['attributes']=_0x3af807[_0xe65e('0x39')][_0xe65e('0x3b')]?_0x3af807[_0xe65e('0x39')]:_0x599de8[_0xe65e('0x35')];if(!_0x1827e9[_0xe65e('0x37')][_0xe65e('0x3c')](_0xe65e('0x3d'))){_0x3af807[_0xe65e('0x1c')]=qs[_0xe65e('0x1c')](_0x1827e9['query'][_0xe65e('0x1c')]);_0x3af807['offset']=qs[_0xe65e('0x19')](_0x1827e9[_0xe65e('0x37')]['offset']);}_0x3af807[_0xe65e('0x3e')]=qs[_0xe65e('0x3f')](_0x1827e9[_0xe65e('0x37')][_0xe65e('0x3f')]);_0x3af807[_0xe65e('0x40')]=qs[_0xe65e('0x41')](_[_0xe65e('0x42')](_0x1827e9[_0xe65e('0x37')],_0x599de8['filters']),_0x2a1314);if(_0x1827e9[_0xe65e('0x37')][_0xe65e('0x43')]){_0x3af807[_0xe65e('0x40')]=_[_0xe65e('0x27')](_0x3af807[_0xe65e('0x40')],{'$or':_[_0xe65e('0x2f')](_0x2a1314,function(_0x18ff10){if(_0x18ff10['type']!==_0xe65e('0x44')){var _0x3c033a={};_0x3c033a[_0x18ff10[_0xe65e('0x24')]]={'$like':'%'+_0x1827e9[_0xe65e('0x37')][_0xe65e('0x43')]+'%'};return _0x3c033a;}})});}_0x3af807=_['merge']({},_0x3af807,_0x1827e9['options']);var _0x59d959={'where':_0x3af807['where']};return db['MailTransferReport']['count'](_0x59d959)[_0xe65e('0x21')](function(_0x41e4a1){_0x4eebaa['count']=_0x41e4a1;if(_0x1827e9[_0xe65e('0x37')]['includeAll']){_0x3af807[_0xe65e('0x45')]=[{'all':!![]}];}return db[_0xe65e('0x30')]['findAll'](_0x3af807);})[_0xe65e('0x21')](function(_0x1c03bd){_0x4eebaa[_0xe65e('0x46')]=_0x1c03bd;return _0x4eebaa;})['then'](respondWithFilteredResult(_0x1faa28,_0x3af807))[_0xe65e('0x47')](handleError(_0x1faa28,null));};exports[_0xe65e('0x48')]=function(_0x106eaf,_0x4dab1f){var _0x53c33b={'raw':!![],'where':{'id':_0x106eaf[_0xe65e('0x49')]['id']}},_0xa609e3={};_0xa609e3[_0xe65e('0x35')]=_[_0xe65e('0x36')](db[_0xe65e('0x30')][_0xe65e('0x31')]);_0xa609e3[_0xe65e('0x37')]=_[_0xe65e('0x36')](_0x106eaf['query']);_0xa609e3[_0xe65e('0x41')]=_[_0xe65e('0x38')](_0xa609e3['model'],_0xa609e3[_0xe65e('0x37')]);_0x53c33b[_0xe65e('0x39')]=_[_0xe65e('0x38')](_0xa609e3['model'],qs[_0xe65e('0x3a')](_0x106eaf[_0xe65e('0x37')][_0xe65e('0x3a')]));_0x53c33b[_0xe65e('0x39')]=_0x53c33b['attributes'][_0xe65e('0x3b')]?_0x53c33b['attributes']:_0xa609e3[_0xe65e('0x35')];if(_0x106eaf[_0xe65e('0x37')]['includeAll']){_0x53c33b['include']=[{'all':!![]}];}_0x53c33b=_[_0xe65e('0x27')]({},_0x53c33b,_0x106eaf[_0xe65e('0x4a')]);return db['MailTransferReport'][_0xe65e('0x4b')](_0x53c33b)['then'](handleEntityNotFound(_0x4dab1f,null))[_0xe65e('0x21')](respondWithResult(_0x4dab1f,null))[_0xe65e('0x47')](handleError(_0x4dab1f,null));};exports[_0xe65e('0x4c')]=function(_0x25c9cd,_0x1c13b6){return db[_0xe65e('0x30')][_0xe65e('0x4c')](_0x25c9cd['body'],{})[_0xe65e('0x21')](respondWithResult(_0x1c13b6,0xc9))['catch'](handleError(_0x1c13b6,null));};exports[_0xe65e('0x4d')]=function(_0x2ca132,_0xd18af2){if(_0x2ca132[_0xe65e('0x28')]['id']){delete _0x2ca132[_0xe65e('0x28')]['id'];}return db[_0xe65e('0x30')][_0xe65e('0x4b')]({'where':{'id':_0x2ca132[_0xe65e('0x49')]['id']}})[_0xe65e('0x21')](handleEntityNotFound(_0xd18af2,null))[_0xe65e('0x21')](saveUpdates(_0x2ca132['body'],null))[_0xe65e('0x21')](respondWithResult(_0xd18af2,null))[_0xe65e('0x47')](handleError(_0xd18af2,null));};exports[_0xe65e('0x22')]=function(_0x200baf,_0x4deedf){return db[_0xe65e('0x30')][_0xe65e('0x4b')]({'where':{'id':_0x200baf[_0xe65e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4deedf,null))[_0xe65e('0x21')](removeEntity(_0x4deedf,null))[_0xe65e('0x47')](handleError(_0x4deedf,null));};exports[_0xe65e('0x4e')]=function(_0x5a00b9,_0x4acea1){return db['MailTransferReport'][_0xe65e('0x4e')]()[_0xe65e('0x21')](respondWithResult(_0x4acea1,null))[_0xe65e('0x47')](handleError(_0x4acea1,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 0dc3237..09652f1 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 _0x255a=['request-promise','path','rimraf','exports','define','MailTransferReport','report_mail_transfer','lodash','util','api','moment','bluebird'];(function(_0xc1ff,_0x79ae14){var _0x3c1f29=function(_0x439196){while(--_0x439196){_0xc1ff['push'](_0xc1ff['shift']());}};_0x3c1f29(++_0x79ae14);}(_0x255a,0xdf));var _0xa255=function(_0x3c3081,_0x21d87d){_0x3c3081=_0x3c3081-0x0;var _0x3e86f2=_0x255a[_0x3c3081];return _0x3e86f2;};'use strict';var _=require(_0xa255('0x0'));var util=require(_0xa255('0x1'));var logger=require('../../config/logger')(_0xa255('0x2'));var moment=require(_0xa255('0x3'));var BPromise=require(_0xa255('0x4'));var rp=require(_0xa255('0x5'));var fs=require('fs');var path=require(_0xa255('0x6'));var rimraf=require(_0xa255('0x7'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0xa255('0x8')]=function(_0x5d8cc6,_0x40db73){return _0x5d8cc6[_0xa255('0x9')](_0xa255('0xa'),attributes,{'tableName':_0xa255('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xff2e=['../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x16baeb,_0x4044c9){var _0x92b6ed=function(_0x2ca248){while(--_0x2ca248){_0x16baeb['push'](_0x16baeb['shift']());}};_0x92b6ed(++_0x4044c9);}(_0xff2e,0xf6));var _0xeff2=function(_0x2f76bc,_0x7e23dd){_0x2f76bc=_0x2f76bc-0x0;var _0xe5bd31=_0xff2e[_0x2f76bc];return _0xe5bd31;};'use strict';var _=require(_0xeff2('0x0'));var util=require(_0xeff2('0x1'));var logger=require(_0xeff2('0x2'))(_0xeff2('0x3'));var moment=require(_0xeff2('0x4'));var BPromise=require(_0xeff2('0x5'));var rp=require(_0xeff2('0x6'));var fs=require('fs');var path=require(_0xeff2('0x7'));var rimraf=require(_0xeff2('0x8'));var config=require(_0xeff2('0x9'));var attributes=require(_0xeff2('0xa'));module[_0xeff2('0xb')]=function(_0x33f86a,_0x1fa7fb){return _0x33f86a[_0xeff2('0xc')]('MailTransferReport',attributes,{'tableName':_0xeff2('0xd'),'paranoid':![],'indexes':[{'name':_0xeff2('0xe'),'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 e4467da..edd8fee 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 _0xd21b=['jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x464704,_0x39f6be){var _0x1da600=function(_0x3b4379){while(--_0x3b4379){_0x464704['push'](_0x464704['shift']());}};_0x1da600(++_0x39f6be);}(_0xd21b,0x9e));var _0xbd21=function(_0x97d6d5,_0x4453e7){_0x97d6d5=_0x97d6d5-0x0;var _0x3baaa2=_0xd21b[_0x97d6d5];return _0x3baaa2;};'use strict';var _=require(_0xbd21('0x0'));var util=require(_0xbd21('0x1'));var moment=require(_0xbd21('0x2'));var BPromise=require(_0xbd21('0x3'));var rs=require(_0xbd21('0x4'));var fs=require('fs');var Redis=require(_0xbd21('0x5'));var db=require(_0xbd21('0x6'))['db'];var utils=require(_0xbd21('0x7'));var logger=require(_0xbd21('0x8'))(_0xbd21('0x9'));var config=require('../../config/environment');var jayson=require(_0xbd21('0xa'));var client=jayson[_0xbd21('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x70018,_0x1dab9e,_0x245fe7){return new BPromise(function(_0x5e2226,_0x2022e2){return client[_0xbd21('0xc')](_0x70018,_0x245fe7)[_0xbd21('0xd')](function(_0x5b953f){logger[_0xbd21('0xe')](_0xbd21('0xf'),_0x1dab9e,_0xbd21('0x10'));logger[_0xbd21('0x11')](_0xbd21('0x12'),_0x1dab9e,'request\x20sent',JSON[_0xbd21('0x13')](_0x5b953f));if(_0x5b953f['error']){if(_0x5b953f[_0xbd21('0x14')]['code']===0x1f4){logger[_0xbd21('0x14')](_0xbd21('0xf'),_0x1dab9e,_0x5b953f['error'][_0xbd21('0x15')]);return _0x2022e2(_0x5b953f[_0xbd21('0x14')][_0xbd21('0x15')]);}logger[_0xbd21('0x14')](_0xbd21('0xf'),_0x1dab9e,_0x5b953f[_0xbd21('0x14')][_0xbd21('0x15')]);return _0x5e2226(_0x5b953f[_0xbd21('0x14')]['message']);}else{logger[_0xbd21('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1dab9e,_0xbd21('0x10'));_0x5e2226(_0x5b953f[_0xbd21('0x16')]['message']);}})[_0xbd21('0x17')](function(_0x1d8722){logger[_0xbd21('0x14')](_0xbd21('0xf'),_0x1dab9e,_0x1d8722);_0x2022e2(_0x1d8722);});});} \ No newline at end of file +var _0x9893=['result','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2dd628,_0x3c22e4){var _0x2e138c=function(_0x12c4d){while(--_0x12c4d){_0x2dd628['push'](_0x2dd628['shift']());}};_0x2e138c(++_0x3c22e4);}(_0x9893,0xa9));var _0x3989=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9893[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x3989('0x0'));var moment=require(_0x3989('0x1'));var BPromise=require(_0x3989('0x2'));var rs=require(_0x3989('0x3'));var fs=require('fs');var Redis=require(_0x3989('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3989('0x5'))('rpc');var config=require(_0x3989('0x6'));var jayson=require(_0x3989('0x7'));var client=jayson['client'][_0x3989('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32e04e,_0x1d7c20,_0x9b352c){return new BPromise(function(_0x159faf,_0x422737){return client[_0x3989('0x9')](_0x32e04e,_0x9b352c)[_0x3989('0xa')](function(_0x6ac37b){logger[_0x3989('0xb')](_0x3989('0xc'),_0x1d7c20,_0x3989('0xd'));logger[_0x3989('0xe')](_0x3989('0xf'),_0x1d7c20,_0x3989('0xd'),JSON[_0x3989('0x10')](_0x6ac37b));if(_0x6ac37b['error']){if(_0x6ac37b[_0x3989('0x11')][_0x3989('0x12')]===0x1f4){logger['error'](_0x3989('0xc'),_0x1d7c20,_0x6ac37b[_0x3989('0x11')][_0x3989('0x13')]);return _0x422737(_0x6ac37b[_0x3989('0x11')][_0x3989('0x13')]);}logger[_0x3989('0x11')](_0x3989('0xc'),_0x1d7c20,_0x6ac37b[_0x3989('0x11')]['message']);return _0x159faf(_0x6ac37b[_0x3989('0x11')][_0x3989('0x13')]);}else{logger[_0x3989('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x1d7c20,_0x3989('0xd'));_0x159faf(_0x6ac37b[_0x3989('0x14')]['message']);}})['catch'](function(_0x2beada){logger['error'](_0x3989('0xc'),_0x1d7c20,_0x2beada);_0x422737(_0x2beada);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1afbc6b..503d519 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 _0x2371=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated','get','/describe','describe','/:id','show','put','delete','exports','multer','util','path'];(function(_0x5d94f7,_0x2f5057){var _0x30c1e9=function(_0x5907b0){while(--_0x5907b0){_0x5d94f7['push'](_0x5d94f7['shift']());}};_0x30c1e9(++_0x2f5057);}(_0x2371,0x140));var _0x1237=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x2371[_0x43444b];return _0x392fe5;};'use strict';var multer=require(_0x1237('0x0'));var util=require(_0x1237('0x1'));var path=require(_0x1237('0x2'));var timeout=require(_0x1237('0x3'));var express=require(_0x1237('0x4'));var router=express[_0x1237('0x5')]();var fs_extra=require(_0x1237('0x6'));var auth=require(_0x1237('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1237('0x8'));var controller=require(_0x1237('0x9'));router['get']('/',auth[_0x1237('0xa')](),controller['index']);router[_0x1237('0xb')](_0x1237('0xc'),auth[_0x1237('0xa')](),controller[_0x1237('0xd')]);router['get'](_0x1237('0xe'),auth[_0x1237('0xa')](),controller[_0x1237('0xf')]);router['post']('/',auth[_0x1237('0xa')](),controller['create']);router[_0x1237('0x10')](_0x1237('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1237('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1237('0x12')]=router; \ No newline at end of file +var _0x2e6d=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x31312c,_0x5b8f59){var _0x2c6b95=function(_0x3c708f){while(--_0x3c708f){_0x31312c['push'](_0x31312c['shift']());}};_0x2c6b95(++_0x5b8f59);}(_0x2e6d,0x12b));var _0xd2e6=function(_0x4b4d45,_0x523933){_0x4b4d45=_0x4b4d45-0x0;var _0x3be28e=_0x2e6d[_0x4b4d45];return _0x3be28e;};'use strict';var multer=require(_0xd2e6('0x0'));var util=require(_0xd2e6('0x1'));var path=require(_0xd2e6('0x2'));var timeout=require(_0xd2e6('0x3'));var express=require(_0xd2e6('0x4'));var router=express[_0xd2e6('0x5')]();var fs_extra=require(_0xd2e6('0x6'));var auth=require(_0xd2e6('0x7'));var interaction=require(_0xd2e6('0x8'));var config=require(_0xd2e6('0x9'));var controller=require(_0xd2e6('0xa'));router[_0xd2e6('0xb')]('/',auth[_0xd2e6('0xc')](),controller[_0xd2e6('0xd')]);router[_0xd2e6('0xb')]('/describe',auth[_0xd2e6('0xc')](),controller[_0xd2e6('0xe')]);router[_0xd2e6('0xb')](_0xd2e6('0xf'),auth[_0xd2e6('0xc')](),controller['show']);router[_0xd2e6('0x10')]('/',auth[_0xd2e6('0xc')](),controller[_0xd2e6('0x11')]);router[_0xd2e6('0x12')](_0xd2e6('0xf'),auth[_0xd2e6('0xc')](),controller[_0xd2e6('0x13')]);router[_0xd2e6('0x14')]('/:id',auth[_0xd2e6('0xc')](),controller[_0xd2e6('0x15')]);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 69dbd78..406b89d 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 _0xf809=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x1db88f,_0x34a8d3){var _0x1dc802=function(_0x2d7335){while(--_0x2d7335){_0x1db88f['push'](_0x1db88f['shift']());}};_0x1dc802(++_0x34a8d3);}(_0xf809,0x19a));var _0x9f80=function(_0x3da795,_0x1f32ed){_0x3da795=_0x3da795-0x0;var _0x47cde2=_0xf809[_0x3da795];return _0x47cde2;};'use strict';var Sequelize=require(_0x9f80('0x0'));var moment=require(_0x9f80('0x1'));module[_0x9f80('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9f80('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x9f80('0x4')},'duration':{'type':Sequelize[_0x9f80('0x5')]},'enterAt':{'type':Sequelize[_0x9f80('0x6')]},'exitAt':{'type':Sequelize[_0x9f80('0x6')],'set':function(_0xe62a87){var _0x2dc233=moment(_0xe62a87);var _0x2cf870=moment(this[_0x9f80('0x7')](_0x9f80('0x8')));var _0x24f99c=_0x2dc233[_0x9f80('0x9')](_0x2cf870,_0x9f80('0xa'));this[_0x9f80('0xb')]('exitAt',_0xe62a87);this[_0x9f80('0xb')](_0x9f80('0xc'),_0x24f99c||null);}},'data1':{'type':Sequelize[_0x9f80('0x3')],'comment':_0x9f80('0xd')},'data2':{'type':Sequelize[_0x9f80('0x3')],'comment':_0x9f80('0xe')},'data3':{'type':Sequelize[_0x9f80('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x9f80('0x3')],'comment':_0x9f80('0xf')},'data5':{'type':Sequelize[_0x9f80('0x3')],'comment':_0x9f80('0x10')},'role':{'type':Sequelize[_0x9f80('0x3')]},'internal':{'type':Sequelize[_0x9f80('0x5')]},'uniqueid':{'type':Sequelize[_0x9f80('0x3')]}}; \ No newline at end of file +var _0x8258=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds'];(function(_0x304c0b,_0x4263bb){var _0x470ea8=function(_0x5c919d){while(--_0x5c919d){_0x304c0b['push'](_0x304c0b['shift']());}};_0x470ea8(++_0x4263bb);}(_0x8258,0x16b));var _0x8825=function(_0x4aa9ca,_0x47003b){_0x4aa9ca=_0x4aa9ca-0x0;var _0x24fcfd=_0x8258[_0x4aa9ca];return _0x24fcfd;};'use strict';var Sequelize=require(_0x8825('0x0'));var moment=require(_0x8825('0x1'));module[_0x8825('0x2')]={'channel':{'type':Sequelize[_0x8825('0x3')]},'membername':{'type':Sequelize[_0x8825('0x3')]},'interface':{'type':Sequelize[_0x8825('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x8825('0x4'),'comment':_0x8825('0x5')},'duration':{'type':Sequelize[_0x8825('0x6')]},'enterAt':{'type':Sequelize[_0x8825('0x7')]},'exitAt':{'type':Sequelize[_0x8825('0x7')],'set':function(_0x273ca9){var _0x4b5ee1=moment(_0x273ca9);var _0x50e8c8=moment(this[_0x8825('0x8')](_0x8825('0x9')));var _0x1323fb=_0x4b5ee1['diff'](_0x50e8c8,_0x8825('0xa'));this['setDataValue'](_0x8825('0xb'),_0x273ca9);this['setDataValue'](_0x8825('0xc'),_0x1323fb||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x8825('0xd')},'data2':{'type':Sequelize[_0x8825('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x8825('0x3')],'comment':_0x8825('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0x8825('0xf')},'data5':{'type':Sequelize[_0x8825('0x3')],'comment':_0x8825('0x10')},'role':{'type':Sequelize[_0x8825('0x3')]},'internal':{'type':Sequelize[_0x8825('0x6')]},'uniqueid':{'type':Sequelize[_0x8825('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 50bf070..8767954 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 _0xf08f=['type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','VIRTUAL','filter','options','includeAll','rows','catch','include','find','create','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent','index','map','MemberReport','rawAttributes','fieldName'];(function(_0x3d67b6,_0x3a4255){var _0x3d2fef=function(_0x51aa68){while(--_0x51aa68){_0x3d67b6['push'](_0x3d67b6['shift']());}};_0x3d2fef(++_0x3a4255);}(_0xf08f,0xfc));var _0xff08=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xf08f[_0x34bc30];return _0x5706de;};'use strict';var emlformat=require(_0xff08('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xff08('0x1'));var rp=require(_0xff08('0x2'));var moment=require(_0xff08('0x3'));var BPromise=require(_0xff08('0x4'));var Mustache=require(_0xff08('0x5'));var util=require(_0xff08('0x6'));var path=require(_0xff08('0x7'));var sox=require(_0xff08('0x8'));var csv=require('to-csv');var ejs=require(_0xff08('0x9'));var fs=require('fs');var fs_extra=require(_0xff08('0xa'));var _=require(_0xff08('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xff08('0xc'));var deskjs=require(_0xff08('0xd'));var toCsv=require('to-csv');var querystring=require(_0xff08('0xe'));var Papa=require(_0xff08('0xf'));var Redis=require(_0xff08('0x10'));var authService=require(_0xff08('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xff08('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xff08('0x13'));var utils=require(_0xff08('0x14'));var config=require(_0xff08('0x15'));var licenseUtil=require(_0xff08('0x16'));var db=require(_0xff08('0x17'))['db'];function respondWithStatusCode(_0x36b1ab,_0x81631e){_0x81631e=_0x81631e||0xcc;return function(_0x240c7c){if(_0x240c7c){return _0x36b1ab[_0xff08('0x18')](_0x81631e);}return _0x36b1ab[_0xff08('0x19')](_0x81631e)['end']();};}function respondWithResult(_0x7698ed,_0xd803d4){_0xd803d4=_0xd803d4||0xc8;return function(_0x5c05b9){if(_0x5c05b9){return _0x7698ed[_0xff08('0x19')](_0xd803d4)['json'](_0x5c05b9);}};}function respondWithFilteredResult(_0x165442,_0x4edd55){return function(_0x8c0958){if(_0x8c0958){var _0x250d00=typeof _0x4edd55[_0xff08('0x1a')]===_0xff08('0x1b')&&typeof _0x4edd55[_0xff08('0x1c')]==='undefined';var _0xa5d9cc=_0x8c0958[_0xff08('0x1d')];var _0x4dcfcf=_0x250d00?0x0:_0x4edd55[_0xff08('0x1a')];var _0x4e626f=_0x250d00?_0x8c0958[_0xff08('0x1d')]:_0x4edd55[_0xff08('0x1a')]+_0x4edd55[_0xff08('0x1c')];var _0x5c56e5;if(_0x4e626f>=_0xa5d9cc){_0x4e626f=_0xa5d9cc;_0x5c56e5=0xc8;}else{_0x5c56e5=0xce;}_0x165442[_0xff08('0x19')](_0x5c56e5);return _0x165442['set']('Content-Range',_0x4dcfcf+'-'+_0x4e626f+'/'+_0xa5d9cc)[_0xff08('0x1e')](_0x8c0958);}return null;};}function patchUpdates(_0x4426b9){return function(_0x107e62){try{jsonpatch[_0xff08('0x1f')](_0x107e62,_0x4426b9,!![]);}catch(_0x3f8307){return BPromise[_0xff08('0x20')](_0x3f8307);}return _0x107e62[_0xff08('0x21')]();};}function saveUpdates(_0xfd7673,_0xbaeb6e){return function(_0x5648d7){if(_0x5648d7){return _0x5648d7[_0xff08('0x22')](_0xfd7673)[_0xff08('0x23')](function(_0x5097ff){return _0x5097ff;});}return null;};}function removeEntity(_0x3571c8,_0x311df6){return function(_0x2d3fb2){if(_0x2d3fb2){return _0x2d3fb2[_0xff08('0x24')]()[_0xff08('0x23')](function(){_0x3571c8[_0xff08('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4534bb,_0x567e31){return function(_0xff8a84){if(!_0xff8a84){_0x4534bb[_0xff08('0x18')](0x194);}return _0xff8a84;};}function handleError(_0x5d022f,_0x3d9cf1){_0x3d9cf1=_0x3d9cf1||0x1f4;return function(_0x4b652f){logger[_0xff08('0x25')](_0x4b652f[_0xff08('0x26')]);if(_0x4b652f[_0xff08('0x27')]){delete _0x4b652f[_0xff08('0x27')];}_0x5d022f[_0xff08('0x19')](_0x3d9cf1)[_0xff08('0x28')](_0x4b652f);};}function getMustacheRender(_0x43ec4a,_0x2305a9){return Mustache[_0xff08('0x29')](_0x43ec4a,_[_0xff08('0x2a')](_0x2305a9[_0xff08('0x2b')],{'contact':_0x2305a9[_0xff08('0x2c')],'message':_0x2305a9[_0xff08('0x2d')],'agent':_0x2305a9[_0xff08('0x2e')],'interaction':_0x2305a9['interaction'],'account':_0x2305a9['account']}))||'';}exports[_0xff08('0x2f')]=function(_0x5ea2ae,_0x3c84d4){var _0x61ce38={},_0x145359={},_0x1863c4={'count':0x0,'rows':[]};var _0x2b91e5=_[_0xff08('0x30')](db[_0xff08('0x31')][_0xff08('0x32')],function(_0x228226){return{'name':_0x228226[_0xff08('0x33')],'type':_0x228226[_0xff08('0x34')][_0xff08('0x35')]};});_0x145359[_0xff08('0x36')]=_[_0xff08('0x30')](_0x2b91e5,_0xff08('0x27'));_0x145359[_0xff08('0x37')]=_[_0xff08('0x38')](_0x5ea2ae[_0xff08('0x37')]);_0x145359[_0xff08('0x39')]=_[_0xff08('0x3a')](_0x145359[_0xff08('0x36')],_0x145359[_0xff08('0x37')]);_0x61ce38[_0xff08('0x3b')]=_[_0xff08('0x3a')](_0x145359[_0xff08('0x36')],qs[_0xff08('0x3c')](_0x5ea2ae[_0xff08('0x37')]['fields']));_0x61ce38[_0xff08('0x3b')]=_0x61ce38[_0xff08('0x3b')][_0xff08('0x3d')]?_0x61ce38[_0xff08('0x3b')]:_0x145359[_0xff08('0x36')];if(!_0x5ea2ae['query']['hasOwnProperty']('nolimit')){_0x61ce38[_0xff08('0x1c')]=qs[_0xff08('0x1c')](_0x5ea2ae[_0xff08('0x37')][_0xff08('0x1c')]);_0x61ce38[_0xff08('0x1a')]=qs[_0xff08('0x1a')](_0x5ea2ae['query'][_0xff08('0x1a')]);}_0x61ce38['order']=qs[_0xff08('0x3e')](_0x5ea2ae['query'][_0xff08('0x3e')]);_0x61ce38[_0xff08('0x3f')]=qs[_0xff08('0x39')](_[_0xff08('0x40')](_0x5ea2ae['query'],_0x145359['filters']),_0x2b91e5);if(_0x5ea2ae[_0xff08('0x37')]['filter']){_0x61ce38[_0xff08('0x3f')]=_[_0xff08('0x2a')](_0x61ce38[_0xff08('0x3f')],{'$or':_[_0xff08('0x30')](_0x2b91e5,function(_0x3a49b6){if(_0x3a49b6[_0xff08('0x34')]!==_0xff08('0x41')){var _0x4e2be4={};_0x4e2be4[_0x3a49b6[_0xff08('0x27')]]={'$like':'%'+_0x5ea2ae[_0xff08('0x37')][_0xff08('0x42')]+'%'};return _0x4e2be4;}})});}_0x61ce38=_['merge']({},_0x61ce38,_0x5ea2ae[_0xff08('0x43')]);var _0x298ae3={'where':_0x61ce38[_0xff08('0x3f')]};return db[_0xff08('0x31')][_0xff08('0x1d')](_0x298ae3)[_0xff08('0x23')](function(_0x1a5005){_0x1863c4[_0xff08('0x1d')]=_0x1a5005;if(_0x5ea2ae[_0xff08('0x37')][_0xff08('0x44')]){_0x61ce38['include']=[{'all':!![]}];}return db[_0xff08('0x31')]['findAll'](_0x61ce38);})[_0xff08('0x23')](function(_0x2dac3e){_0x1863c4[_0xff08('0x45')]=_0x2dac3e;return _0x1863c4;})[_0xff08('0x23')](respondWithFilteredResult(_0x3c84d4,_0x61ce38))[_0xff08('0x46')](handleError(_0x3c84d4,null));};exports['show']=function(_0x3e72e0,_0xb9ba36){var _0x3f0631={'raw':!![],'where':{'id':_0x3e72e0['params']['id']}},_0x5c4c75={};_0x5c4c75[_0xff08('0x36')]=_['keys'](db[_0xff08('0x31')][_0xff08('0x32')]);_0x5c4c75[_0xff08('0x37')]=_['keys'](_0x3e72e0[_0xff08('0x37')]);_0x5c4c75[_0xff08('0x39')]=_[_0xff08('0x3a')](_0x5c4c75[_0xff08('0x36')],_0x5c4c75[_0xff08('0x37')]);_0x3f0631[_0xff08('0x3b')]=_[_0xff08('0x3a')](_0x5c4c75['model'],qs[_0xff08('0x3c')](_0x3e72e0['query'][_0xff08('0x3c')]));_0x3f0631[_0xff08('0x3b')]=_0x3f0631[_0xff08('0x3b')][_0xff08('0x3d')]?_0x3f0631['attributes']:_0x5c4c75['model'];if(_0x3e72e0['query'][_0xff08('0x44')]){_0x3f0631[_0xff08('0x47')]=[{'all':!![]}];}_0x3f0631=_['merge']({},_0x3f0631,_0x3e72e0[_0xff08('0x43')]);return db[_0xff08('0x31')][_0xff08('0x48')](_0x3f0631)[_0xff08('0x23')](handleEntityNotFound(_0xb9ba36,null))['then'](respondWithResult(_0xb9ba36,null))[_0xff08('0x46')](handleError(_0xb9ba36,null));};exports[_0xff08('0x49')]=function(_0x1365a7,_0x263f35){return db['MemberReport'][_0xff08('0x49')](_0x1365a7[_0xff08('0x2b')],{})[_0xff08('0x23')](respondWithResult(_0x263f35,0xc9))[_0xff08('0x46')](handleError(_0x263f35,null));};exports[_0xff08('0x22')]=function(_0x120fbd,_0x4f19c6){if(_0x120fbd[_0xff08('0x2b')]['id']){delete _0x120fbd[_0xff08('0x2b')]['id'];}return db[_0xff08('0x31')][_0xff08('0x48')]({'where':{'id':_0x120fbd[_0xff08('0x4a')]['id']}})[_0xff08('0x23')](handleEntityNotFound(_0x4f19c6,null))[_0xff08('0x23')](saveUpdates(_0x120fbd['body'],null))['then'](respondWithResult(_0x4f19c6,null))[_0xff08('0x46')](handleError(_0x4f19c6,null));};exports['destroy']=function(_0x1b587f,_0x208f77){return db[_0xff08('0x31')][_0xff08('0x48')]({'where':{'id':_0x1b587f[_0xff08('0x4a')]['id']}})['then'](handleEntityNotFound(_0x208f77,null))[_0xff08('0x23')](removeEntity(_0x208f77,null))[_0xff08('0x46')](handleError(_0x208f77,null));};exports[_0xff08('0x4b')]=function(_0x10f5fe,_0x388d7c){return db[_0xff08('0x31')]['describe']()[_0xff08('0x23')](respondWithResult(_0x388d7c,null))['catch'](handleError(_0x388d7c,null));}; \ No newline at end of file +var _0xf945=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','sendStatus','name','send','merge','body','agent','interaction','account','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','MemberReport','includeAll','findAll','rows','catch','show','params','keys','include','find','create','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse'];(function(_0x189642,_0x8d7e88){var _0x5330af=function(_0x78aaec){while(--_0x78aaec){_0x189642['push'](_0x189642['shift']());}};_0x5330af(++_0x8d7e88);}(_0xf945,0x11b));var _0x5f94=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf945[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x5f94('0x0'));var rimraf=require(_0x5f94('0x1'));var zipdir=require(_0x5f94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f94('0x3'));var moment=require(_0x5f94('0x4'));var BPromise=require(_0x5f94('0x5'));var Mustache=require('mustache');var util=require(_0x5f94('0x6'));var path=require(_0x5f94('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5f94('0x8'));var fs=require('fs');var fs_extra=require(_0x5f94('0x9'));var _=require(_0x5f94('0xa'));var squel=require(_0x5f94('0xb'));var crypto=require(_0x5f94('0xc'));var jsforce=require(_0x5f94('0xd'));var deskjs=require(_0x5f94('0xe'));var toCsv=require(_0x5f94('0xf'));var querystring=require('querystring');var Papa=require(_0x5f94('0x10'));var Redis=require('ioredis');var authService=require(_0x5f94('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5f94('0x12'));var hardwareService=require(_0x5f94('0x13'));var logger=require(_0x5f94('0x14'))(_0x5f94('0x15'));var utils=require(_0x5f94('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1471d0,_0x28f4c5){_0x28f4c5=_0x28f4c5||0xcc;return function(_0x5c70ca){if(_0x5c70ca){return _0x1471d0['sendStatus'](_0x28f4c5);}return _0x1471d0[_0x5f94('0x17')](_0x28f4c5)[_0x5f94('0x18')]();};}function respondWithResult(_0x1dcab5,_0x3c5d51){_0x3c5d51=_0x3c5d51||0xc8;return function(_0x30e6e2){if(_0x30e6e2){return _0x1dcab5[_0x5f94('0x17')](_0x3c5d51)['json'](_0x30e6e2);}};}function respondWithFilteredResult(_0x258091,_0x3ea316){return function(_0x5035c8){if(_0x5035c8){var _0x21c0d3=typeof _0x3ea316[_0x5f94('0x19')]===_0x5f94('0x1a')&&typeof _0x3ea316[_0x5f94('0x1b')]===_0x5f94('0x1a');var _0x18ed81=_0x5035c8['count'];var _0x204e90=_0x21c0d3?0x0:_0x3ea316[_0x5f94('0x19')];var _0x3ea3bb=_0x21c0d3?_0x5035c8[_0x5f94('0x1c')]:_0x3ea316[_0x5f94('0x19')]+_0x3ea316['limit'];var _0x1003ed;if(_0x3ea3bb>=_0x18ed81){_0x3ea3bb=_0x18ed81;_0x1003ed=0xc8;}else{_0x1003ed=0xce;}_0x258091[_0x5f94('0x17')](_0x1003ed);return _0x258091[_0x5f94('0x1d')](_0x5f94('0x1e'),_0x204e90+'-'+_0x3ea3bb+'/'+_0x18ed81)[_0x5f94('0x1f')](_0x5035c8);}return null;};}function patchUpdates(_0x13a2d3){return function(_0x1b2a1e){try{jsonpatch['apply'](_0x1b2a1e,_0x13a2d3,!![]);}catch(_0xdbf701){return BPromise['reject'](_0xdbf701);}return _0x1b2a1e[_0x5f94('0x20')]();};}function saveUpdates(_0x3aaa9d,_0x88768d){return function(_0x3a6b18){if(_0x3a6b18){return _0x3a6b18[_0x5f94('0x21')](_0x3aaa9d)[_0x5f94('0x22')](function(_0x3d12c8){return _0x3d12c8;});}return null;};}function removeEntity(_0x1c56fe,_0x1f9aa6){return function(_0x2082ba){if(_0x2082ba){return _0x2082ba['destroy']()[_0x5f94('0x22')](function(){_0x1c56fe[_0x5f94('0x17')](0xcc)[_0x5f94('0x18')]();});}};}function handleEntityNotFound(_0x34603e,_0xae8969){return function(_0x257c16){if(!_0x257c16){_0x34603e[_0x5f94('0x23')](0x194);}return _0x257c16;};}function handleError(_0x232f89,_0x51b46b){_0x51b46b=_0x51b46b||0x1f4;return function(_0x47f6e2){logger['error'](_0x47f6e2['stack']);if(_0x47f6e2[_0x5f94('0x24')]){delete _0x47f6e2[_0x5f94('0x24')];}_0x232f89[_0x5f94('0x17')](_0x51b46b)[_0x5f94('0x25')](_0x47f6e2);};}function getMustacheRender(_0x3e32e0,_0x315dd8){return Mustache['render'](_0x3e32e0,_[_0x5f94('0x26')](_0x315dd8[_0x5f94('0x27')],{'contact':_0x315dd8['contact'],'message':_0x315dd8['message'],'agent':_0x315dd8[_0x5f94('0x28')],'interaction':_0x315dd8[_0x5f94('0x29')],'account':_0x315dd8[_0x5f94('0x2a')]}))||'';}exports[_0x5f94('0x2b')]=function(_0x17cac5,_0x3678e9){var _0x21807e={},_0x3743c1={},_0x4cf1ff={'count':0x0,'rows':[]};var _0x7e6b85=_[_0x5f94('0x2c')](db['MemberReport'][_0x5f94('0x2d')],function(_0x33a574){return{'name':_0x33a574[_0x5f94('0x2e')],'type':_0x33a574[_0x5f94('0x2f')]['key']};});_0x3743c1[_0x5f94('0x30')]=_['map'](_0x7e6b85,_0x5f94('0x24'));_0x3743c1[_0x5f94('0x31')]=_['keys'](_0x17cac5[_0x5f94('0x31')]);_0x3743c1[_0x5f94('0x32')]=_[_0x5f94('0x33')](_0x3743c1['model'],_0x3743c1[_0x5f94('0x31')]);_0x21807e[_0x5f94('0x34')]=_[_0x5f94('0x33')](_0x3743c1[_0x5f94('0x30')],qs[_0x5f94('0x35')](_0x17cac5['query']['fields']));_0x21807e['attributes']=_0x21807e['attributes'][_0x5f94('0x36')]?_0x21807e[_0x5f94('0x34')]:_0x3743c1['model'];if(!_0x17cac5[_0x5f94('0x31')]['hasOwnProperty'](_0x5f94('0x37'))){_0x21807e['limit']=qs['limit'](_0x17cac5['query']['limit']);_0x21807e[_0x5f94('0x19')]=qs['offset'](_0x17cac5[_0x5f94('0x31')]['offset']);}_0x21807e[_0x5f94('0x38')]=qs['sort'](_0x17cac5[_0x5f94('0x31')][_0x5f94('0x39')]);_0x21807e[_0x5f94('0x3a')]=qs['filters'](_['pick'](_0x17cac5[_0x5f94('0x31')],_0x3743c1[_0x5f94('0x32')]),_0x7e6b85);if(_0x17cac5['query'][_0x5f94('0x3b')]){_0x21807e['where']=_[_0x5f94('0x26')](_0x21807e['where'],{'$or':_[_0x5f94('0x2c')](_0x7e6b85,function(_0x5320fc){if(_0x5320fc[_0x5f94('0x2f')]!==_0x5f94('0x3c')){var _0x31bbb7={};_0x31bbb7[_0x5320fc[_0x5f94('0x24')]]={'$like':'%'+_0x17cac5[_0x5f94('0x31')][_0x5f94('0x3b')]+'%'};return _0x31bbb7;}})});}_0x21807e=_[_0x5f94('0x26')]({},_0x21807e,_0x17cac5[_0x5f94('0x3d')]);var _0x31a167={'where':_0x21807e[_0x5f94('0x3a')]};return db[_0x5f94('0x3e')][_0x5f94('0x1c')](_0x31a167)[_0x5f94('0x22')](function(_0x5d0264){_0x4cf1ff[_0x5f94('0x1c')]=_0x5d0264;if(_0x17cac5[_0x5f94('0x31')][_0x5f94('0x3f')]){_0x21807e['include']=[{'all':!![]}];}return db[_0x5f94('0x3e')][_0x5f94('0x40')](_0x21807e);})[_0x5f94('0x22')](function(_0x403166){_0x4cf1ff[_0x5f94('0x41')]=_0x403166;return _0x4cf1ff;})[_0x5f94('0x22')](respondWithFilteredResult(_0x3678e9,_0x21807e))[_0x5f94('0x42')](handleError(_0x3678e9,null));};exports[_0x5f94('0x43')]=function(_0x2883bc,_0x3f39e9){var _0x4149dc={'raw':!![],'where':{'id':_0x2883bc[_0x5f94('0x44')]['id']}},_0x11fb97={};_0x11fb97[_0x5f94('0x30')]=_[_0x5f94('0x45')](db[_0x5f94('0x3e')][_0x5f94('0x2d')]);_0x11fb97['query']=_['keys'](_0x2883bc[_0x5f94('0x31')]);_0x11fb97[_0x5f94('0x32')]=_['intersection'](_0x11fb97['model'],_0x11fb97[_0x5f94('0x31')]);_0x4149dc[_0x5f94('0x34')]=_['intersection'](_0x11fb97['model'],qs[_0x5f94('0x35')](_0x2883bc['query'][_0x5f94('0x35')]));_0x4149dc[_0x5f94('0x34')]=_0x4149dc[_0x5f94('0x34')]['length']?_0x4149dc[_0x5f94('0x34')]:_0x11fb97['model'];if(_0x2883bc['query'][_0x5f94('0x3f')]){_0x4149dc[_0x5f94('0x46')]=[{'all':!![]}];}_0x4149dc=_[_0x5f94('0x26')]({},_0x4149dc,_0x2883bc['options']);return db[_0x5f94('0x3e')][_0x5f94('0x47')](_0x4149dc)[_0x5f94('0x22')](handleEntityNotFound(_0x3f39e9,null))[_0x5f94('0x22')](respondWithResult(_0x3f39e9,null))[_0x5f94('0x42')](handleError(_0x3f39e9,null));};exports[_0x5f94('0x48')]=function(_0x2f6b1e,_0x1b817f){return db['MemberReport']['create'](_0x2f6b1e[_0x5f94('0x27')],{})['then'](respondWithResult(_0x1b817f,0xc9))[_0x5f94('0x42')](handleError(_0x1b817f,null));};exports[_0x5f94('0x21')]=function(_0x5b056d,_0x45df2c){if(_0x5b056d['body']['id']){delete _0x5b056d['body']['id'];}return db['MemberReport'][_0x5f94('0x47')]({'where':{'id':_0x5b056d[_0x5f94('0x44')]['id']}})[_0x5f94('0x22')](handleEntityNotFound(_0x45df2c,null))['then'](saveUpdates(_0x5b056d['body'],null))[_0x5f94('0x22')](respondWithResult(_0x45df2c,null))[_0x5f94('0x42')](handleError(_0x45df2c,null));};exports[_0x5f94('0x49')]=function(_0x554a42,_0x494fdd){return db[_0x5f94('0x3e')]['find']({'where':{'id':_0x554a42['params']['id']}})[_0x5f94('0x22')](handleEntityNotFound(_0x494fdd,null))[_0x5f94('0x22')](removeEntity(_0x494fdd,null))['catch'](handleError(_0x494fdd,null));};exports[_0x5f94('0x4a')]=function(_0x4e1d0f,_0x4c576a){return db[_0x5f94('0x3e')][_0x5f94('0x4a')]()[_0x5f94('0x22')](respondWithResult(_0x4c576a,null))[_0x5f94('0x42')](handleError(_0x4c576a,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 7f28b10..64b33ba 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 _0x73c1=['request-promise','path','rimraf','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','util','api','moment','bluebird'];(function(_0x5b2731,_0x289f80){var _0x36e36f=function(_0x2a3881){while(--_0x2a3881){_0x5b2731['push'](_0x5b2731['shift']());}};_0x36e36f(++_0x289f80);}(_0x73c1,0x106));var _0x173c=function(_0x4b11bc,_0xae3495){_0x4b11bc=_0x4b11bc-0x0;var _0x40a0c6=_0x73c1[_0x4b11bc];return _0x40a0c6;};'use strict';var _=require('lodash');var util=require(_0x173c('0x0'));var logger=require('../../config/logger')(_0x173c('0x1'));var moment=require(_0x173c('0x2'));var BPromise=require(_0x173c('0x3'));var rp=require(_0x173c('0x4'));var fs=require('fs');var path=require(_0x173c('0x5'));var rimraf=require(_0x173c('0x6'));var config=require('../../config/environment');var attributes=require(_0x173c('0x7'));module[_0x173c('0x8')]=function(_0x1b96b5,_0xa54726){return _0x1b96b5['define'](_0x173c('0x9'),attributes,{'tableName':_0x173c('0xa'),'paranoid':![],'indexes':[{'name':_0x173c('0xb'),'fields':[_0x173c('0xc'),_0x173c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x148d=['./memberReport.attributes','MemberReport','report_member','membername_interface','membername','interface','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1fb94f,_0x2812e7){var _0x2a1bd0=function(_0x591ce1){while(--_0x591ce1){_0x1fb94f['push'](_0x1fb94f['shift']());}};_0x2a1bd0(++_0x2812e7);}(_0x148d,0x13a));var _0xd148=function(_0x325ef1,_0x4b1507){_0x325ef1=_0x325ef1-0x0;var _0x5eb73d=_0x148d[_0x325ef1];return _0x5eb73d;};'use strict';var _=require('lodash');var util=require(_0xd148('0x0'));var logger=require(_0xd148('0x1'))(_0xd148('0x2'));var moment=require('moment');var BPromise=require(_0xd148('0x3'));var rp=require(_0xd148('0x4'));var fs=require('fs');var path=require(_0xd148('0x5'));var rimraf=require(_0xd148('0x6'));var config=require(_0xd148('0x7'));var attributes=require(_0xd148('0x8'));module['exports']=function(_0x1a57eb,_0xcf6846){return _0x1a57eb['define'](_0xd148('0x9'),attributes,{'tableName':_0xd148('0xa'),'paranoid':![],'indexes':[{'name':_0xd148('0xb'),'fields':[_0xd148('0xc'),_0xd148('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 0826838..b41dc77 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 _0x13bd=['attributes','limit','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','options','raw'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x13bd,0xd3));var _0xd13b=function(_0x2e81c9,_0x15a07c){_0x2e81c9=_0x2e81c9-0x0;var _0x217cf2=_0x13bd[_0x2e81c9];return _0x217cf2;};'use strict';var _=require(_0xd13b('0x0'));var util=require(_0xd13b('0x1'));var moment=require(_0xd13b('0x2'));var BPromise=require(_0xd13b('0x3'));var rs=require(_0xd13b('0x4'));var fs=require('fs');var Redis=require(_0xd13b('0x5'));var db=require(_0xd13b('0x6'))['db'];var utils=require(_0xd13b('0x7'));var logger=require('../../config/logger')(_0xd13b('0x8'));var config=require(_0xd13b('0x9'));var jayson=require(_0xd13b('0xa'));var client=jayson[_0xd13b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d6fef,_0x4498a2,_0x1452fb){return new BPromise(function(_0x116f87,_0x1be1df){return client[_0xd13b('0xc')](_0x2d6fef,_0x1452fb)[_0xd13b('0xd')](function(_0x3a0203){logger['info'](_0xd13b('0xe'),_0x4498a2,_0xd13b('0xf'));logger[_0xd13b('0x10')](_0xd13b('0x11'),_0x4498a2,_0xd13b('0xf'),JSON[_0xd13b('0x12')](_0x3a0203));if(_0x3a0203[_0xd13b('0x13')]){if(_0x3a0203[_0xd13b('0x13')][_0xd13b('0x14')]===0x1f4){logger[_0xd13b('0x13')](_0xd13b('0xe'),_0x4498a2,_0x3a0203[_0xd13b('0x13')][_0xd13b('0x15')]);return _0x1be1df(_0x3a0203[_0xd13b('0x13')]['message']);}logger['error'](_0xd13b('0xe'),_0x4498a2,_0x3a0203[_0xd13b('0x13')][_0xd13b('0x15')]);return _0x116f87(_0x3a0203[_0xd13b('0x13')]['message']);}else{logger[_0xd13b('0x16')]('MemberReport,\x20%s,\x20%s',_0x4498a2,_0xd13b('0xf'));_0x116f87(_0x3a0203[_0xd13b('0x17')][_0xd13b('0x15')]);}})[_0xd13b('0x18')](function(_0x2ad407){logger['error'](_0xd13b('0xe'),_0x4498a2,_0x2ad407);_0x1be1df(_0x2ad407);});});}exports[_0xd13b('0x19')]=function(_0x53a507){var _0xc49fc4=this;return new Promise(function(_0x93817e,_0x47d89b){return db[_0xd13b('0x1a')]['findAll']({'raw':_0x53a507[_0xd13b('0x1b')]?_0x53a507[_0xd13b('0x1b')][_0xd13b('0x1c')]===undefined?!![]:![]:!![],'where':_0x53a507[_0xd13b('0x1b')]?_0x53a507[_0xd13b('0x1b')]['where']||null:null,'attributes':_0x53a507[_0xd13b('0x1b')]?_0x53a507[_0xd13b('0x1b')][_0xd13b('0x1d')]||null:null,'limit':_0x53a507[_0xd13b('0x1b')]?_0x53a507[_0xd13b('0x1b')][_0xd13b('0x1e')]||null:null,'include':_0x53a507[_0xd13b('0x1b')]?_0x53a507['options'][_0xd13b('0x1f')]?_[_0xd13b('0x20')](_0x53a507[_0xd13b('0x1b')]['include'],function(_0x5eceed){return{'model':db[_0x5eceed['model']],'as':_0x5eceed['as'],'attributes':_0x5eceed[_0xd13b('0x1d')],'include':_0x5eceed['include']?_[_0xd13b('0x20')](_0x5eceed['include'],function(_0x2ce0c3){return{'model':db[_0x2ce0c3[_0xd13b('0x21')]],'as':_0x2ce0c3['as'],'attributes':_0x2ce0c3[_0xd13b('0x1d')],'include':_0x2ce0c3[_0xd13b('0x1f')]?_[_0xd13b('0x20')](_0x2ce0c3['include'],function(_0x4e959d){return{'model':db[_0x4e959d[_0xd13b('0x21')]],'as':_0x4e959d['as'],'attributes':_0x4e959d[_0xd13b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4efb12){logger[_0xd13b('0x16')]('GetMemberReport',_0x53a507);logger[_0xd13b('0x10')]('GetMemberReport',_0x53a507,JSON['stringify'](_0x4efb12));_0x93817e(_0x4efb12);})[_0xd13b('0x18')](function(_0x4ca26e){logger[_0xd13b('0x13')](_0xd13b('0x19'),_0x4ca26e['message'],_0x53a507);_0x47d89b(_0xc49fc4['error'](0x1f4,_0x4ca26e['message']));});});};exports[_0xd13b('0x22')]=function(_0x22008b){var _0x499b15=this;return new Promise(function(_0x14575e,_0x3c0378){return db[_0xd13b('0x1a')][_0xd13b('0x23')](_0x22008b[_0xd13b('0x24')],{'raw':_0x22008b[_0xd13b('0x1b')]?_0x22008b[_0xd13b('0x1b')][_0xd13b('0x1c')]===undefined?!![]:![]:!![]})[_0xd13b('0xd')](function(_0x1dd8af){logger['info'](_0xd13b('0x22'),_0x22008b);logger[_0xd13b('0x10')](_0xd13b('0x22'),_0x22008b,JSON['stringify'](_0x1dd8af));_0x14575e(_0x1dd8af);})[_0xd13b('0x18')](function(_0x1cecf9){logger[_0xd13b('0x13')](_0xd13b('0x22'),_0x1cecf9[_0xd13b('0x15')],_0x22008b);_0x3c0378(_0x499b15[_0xd13b('0x13')](0x1f4,_0x1cecf9[_0xd13b('0x15')]));});});};exports[_0xd13b('0x25')]=function(_0x4e83a7){var _0x1ea267=this;return new Promise(function(_0x11448b,_0x34336d){return db[_0xd13b('0x1a')][_0xd13b('0x26')](_0x4e83a7['body'],{'raw':_0x4e83a7[_0xd13b('0x1b')]?_0x4e83a7[_0xd13b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e83a7['options']?_0x4e83a7[_0xd13b('0x1b')][_0xd13b('0x27')]||null:null,'attributes':_0x4e83a7[_0xd13b('0x1b')]?_0x4e83a7['options'][_0xd13b('0x1d')]||null:null,'limit':_0x4e83a7[_0xd13b('0x1b')]?_0x4e83a7['options']['limit']||null:null})[_0xd13b('0xd')](function(_0x40cba6){logger['info'](_0xd13b('0x25'),_0x4e83a7);logger[_0xd13b('0x10')](_0xd13b('0x25'),_0x4e83a7,JSON['stringify'](_0x40cba6));_0x11448b(_0x40cba6);})[_0xd13b('0x18')](function(_0x434e12){logger[_0xd13b('0x13')](_0xd13b('0x25'),_0x434e12['message'],_0x4e83a7);_0x34336d(_0x1ea267[_0xd13b('0x13')](0x1f4,_0x434e12[_0xd13b('0x15')]));});});}; \ No newline at end of file +var _0x07a0=['then','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','map','model','catch','CreateMemberReport','body','UpdateMemberReport','where','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','client','http','request'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0x07a0,0x16c));var _0x007a=function(_0x14b890,_0x54f95f){_0x14b890=_0x14b890-0x0;var _0x50b17c=_0x07a0[_0x14b890];return _0x50b17c;};'use strict';var _=require(_0x007a('0x0'));var util=require(_0x007a('0x1'));var moment=require(_0x007a('0x2'));var BPromise=require(_0x007a('0x3'));var rs=require(_0x007a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x007a('0x5'))('rpc');var config=require(_0x007a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x007a('0x7')][_0x007a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c54a7,_0x16edc3,_0x2aefb4){return new BPromise(function(_0x14aad7,_0x237148){return client[_0x007a('0x9')](_0x2c54a7,_0x2aefb4)[_0x007a('0xa')](function(_0x543848){logger[_0x007a('0xb')](_0x007a('0xc'),_0x16edc3,'request\x20sent');logger[_0x007a('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x16edc3,_0x007a('0xe'),JSON[_0x007a('0xf')](_0x543848));if(_0x543848['error']){if(_0x543848['error']['code']===0x1f4){logger[_0x007a('0x10')](_0x007a('0xc'),_0x16edc3,_0x543848['error']['message']);return _0x237148(_0x543848[_0x007a('0x10')]['message']);}logger['error'](_0x007a('0xc'),_0x16edc3,_0x543848[_0x007a('0x10')][_0x007a('0x11')]);return _0x14aad7(_0x543848['error']['message']);}else{logger[_0x007a('0xb')](_0x007a('0xc'),_0x16edc3,_0x007a('0xe'));_0x14aad7(_0x543848[_0x007a('0x12')]['message']);}})['catch'](function(_0x1ba581){logger[_0x007a('0x10')](_0x007a('0xc'),_0x16edc3,_0x1ba581);_0x237148(_0x1ba581);});});}exports[_0x007a('0x13')]=function(_0x31b5b2){var _0x416a80=this;return new Promise(function(_0x3915e3,_0x3392e8){return db[_0x007a('0x14')][_0x007a('0x15')]({'raw':_0x31b5b2[_0x007a('0x16')]?_0x31b5b2['options'][_0x007a('0x17')]===undefined?!![]:![]:!![],'where':_0x31b5b2[_0x007a('0x16')]?_0x31b5b2[_0x007a('0x16')]['where']||null:null,'attributes':_0x31b5b2[_0x007a('0x16')]?_0x31b5b2[_0x007a('0x16')][_0x007a('0x18')]||null:null,'limit':_0x31b5b2[_0x007a('0x16')]?_0x31b5b2[_0x007a('0x16')][_0x007a('0x19')]||null:null,'include':_0x31b5b2['options']?_0x31b5b2[_0x007a('0x16')][_0x007a('0x1a')]?_[_0x007a('0x1b')](_0x31b5b2['options'][_0x007a('0x1a')],function(_0x49db43){return{'model':db[_0x49db43[_0x007a('0x1c')]],'as':_0x49db43['as'],'attributes':_0x49db43[_0x007a('0x18')],'include':_0x49db43['include']?_[_0x007a('0x1b')](_0x49db43[_0x007a('0x1a')],function(_0x3dad69){return{'model':db[_0x3dad69[_0x007a('0x1c')]],'as':_0x3dad69['as'],'attributes':_0x3dad69[_0x007a('0x18')],'include':_0x3dad69['include']?_[_0x007a('0x1b')](_0x3dad69['include'],function(_0x19e71a){return{'model':db[_0x19e71a[_0x007a('0x1c')]],'as':_0x19e71a['as'],'attributes':_0x19e71a[_0x007a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x007a('0xa')](function(_0x862387){logger['info'](_0x007a('0x13'),_0x31b5b2);logger[_0x007a('0xd')](_0x007a('0x13'),_0x31b5b2,JSON[_0x007a('0xf')](_0x862387));_0x3915e3(_0x862387);})[_0x007a('0x1d')](function(_0x23c165){logger[_0x007a('0x10')](_0x007a('0x13'),_0x23c165[_0x007a('0x11')],_0x31b5b2);_0x3392e8(_0x416a80[_0x007a('0x10')](0x1f4,_0x23c165[_0x007a('0x11')]));});});};exports[_0x007a('0x1e')]=function(_0x4712df){var _0xa3d087=this;return new Promise(function(_0x520563,_0x5a8ed2){return db[_0x007a('0x14')]['create'](_0x4712df[_0x007a('0x1f')],{'raw':_0x4712df['options']?_0x4712df[_0x007a('0x16')][_0x007a('0x17')]===undefined?!![]:![]:!![]})[_0x007a('0xa')](function(_0x1e1658){logger['info']('CreateMemberReport',_0x4712df);logger['debug'](_0x007a('0x1e'),_0x4712df,JSON[_0x007a('0xf')](_0x1e1658));_0x520563(_0x1e1658);})[_0x007a('0x1d')](function(_0x49564e){logger[_0x007a('0x10')](_0x007a('0x1e'),_0x49564e[_0x007a('0x11')],_0x4712df);_0x5a8ed2(_0xa3d087[_0x007a('0x10')](0x1f4,_0x49564e[_0x007a('0x11')]));});});};exports[_0x007a('0x20')]=function(_0x5b9e91){var _0x45415c=this;return new Promise(function(_0x3c3030,_0x29bb75){return db[_0x007a('0x14')]['update'](_0x5b9e91[_0x007a('0x1f')],{'raw':_0x5b9e91[_0x007a('0x16')]?_0x5b9e91[_0x007a('0x16')][_0x007a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b9e91[_0x007a('0x16')]?_0x5b9e91[_0x007a('0x16')][_0x007a('0x21')]||null:null,'attributes':_0x5b9e91['options']?_0x5b9e91['options']['attributes']||null:null,'limit':_0x5b9e91[_0x007a('0x16')]?_0x5b9e91[_0x007a('0x16')][_0x007a('0x19')]||null:null})['then'](function(_0x2b07f5){logger[_0x007a('0xb')](_0x007a('0x20'),_0x5b9e91);logger['debug'](_0x007a('0x20'),_0x5b9e91,JSON['stringify'](_0x2b07f5));_0x3c3030(_0x2b07f5);})['catch'](function(_0x27c580){logger[_0x007a('0x10')](_0x007a('0x20'),_0x27c580['message'],_0x5b9e91);_0x29bb75(_0x45415c[_0x007a('0x10')](0x1f4,_0x27c580[_0x007a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 61a9269..d6e3103 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 _0x008c=['index','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x4a9676,_0x216236){var _0x264e06=function(_0x155b45){while(--_0x155b45){_0x4a9676['push'](_0x4a9676['shift']());}};_0x264e06(++_0x216236);}(_0x008c,0x188));var _0xc008=function(_0x3c7ae2,_0x5504e3){_0x3c7ae2=_0x3c7ae2-0x0;var _0x39f0d7=_0x008c[_0x3c7ae2];return _0x39f0d7;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',controller[_0xc008('0xb')]);module[_0xc008('0xc')]=router; \ No newline at end of file +var _0x84ab=['../../config/environment','./migration.controller','get','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2f05bf,_0xf38d90){var _0x2e2d8f=function(_0x5b9ef3){while(--_0x5b9ef3){_0x2f05bf['push'](_0x2f05bf['shift']());}};_0x2e2d8f(++_0xf38d90);}(_0x84ab,0x12f));var _0xb84a=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x84ab[_0x30faec];return _0x29484f;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',controller['index']);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 90577fa..a32e7a0 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 _0x841a=['STRING','sequelize','exports'];(function(_0x5a9893,_0x3d973f){var _0x4ecc0a=function(_0x349a94){while(--_0x349a94){_0x5a9893['push'](_0x5a9893['shift']());}};_0x4ecc0a(++_0x3d973f);}(_0x841a,0x1b4));var _0xa841=function(_0x6466df,_0x371b40){_0x6466df=_0x6466df-0x0;var _0x4395e4=_0x841a[_0x6466df];return _0x4395e4;};'use strict';var Sequelize=require(_0xa841('0x0'));module[_0xa841('0x1')]={'version':{'type':Sequelize[_0xa841('0x2')],'unique':'version'}}; \ No newline at end of file +var _0x41f5=['exports','STRING'];(function(_0x18d0cd,_0x22a08a){var _0x1d5903=function(_0x409dea){while(--_0x409dea){_0x18d0cd['push'](_0x18d0cd['shift']());}};_0x1d5903(++_0x22a08a);}(_0x41f5,0x12a));var _0x541f=function(_0x2dbd5e,_0x202f18){_0x2dbd5e=_0x2dbd5e-0x0;var _0x41855f=_0x41f5[_0x2dbd5e];return _0x41855f;};'use strict';var Sequelize=require('sequelize');module[_0x541f('0x0')]={'version':{'type':Sequelize[_0x541f('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 829f31a..1352b10 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 _0x9b8f=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','json','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','name','send','merge','body','contact','agent','interaction','account','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','options','includeAll','Migration','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x14cb58,_0x214d62){var _0x5f097e=function(_0x5b8666){while(--_0x5b8666){_0x14cb58['push'](_0x14cb58['shift']());}};_0x5f097e(++_0x214d62);}(_0x9b8f,0x83));var _0xf9b8=function(_0x2a7d03,_0x521632){_0x2a7d03=_0x2a7d03-0x0;var _0x3bbc99=_0x9b8f[_0x2a7d03];return _0x3bbc99;};'use strict';var emlformat=require(_0xf9b8('0x0'));var rimraf=require(_0xf9b8('0x1'));var zipdir=require(_0xf9b8('0x2'));var jsonpatch=require(_0xf9b8('0x3'));var rp=require('request-promise');var moment=require(_0xf9b8('0x4'));var BPromise=require(_0xf9b8('0x5'));var Mustache=require('mustache');var util=require(_0xf9b8('0x6'));var path=require('path');var sox=require(_0xf9b8('0x7'));var csv=require(_0xf9b8('0x8'));var ejs=require(_0xf9b8('0x9'));var fs=require('fs');var fs_extra=require(_0xf9b8('0xa'));var _=require(_0xf9b8('0xb'));var squel=require(_0xf9b8('0xc'));var crypto=require(_0xf9b8('0xd'));var jsforce=require(_0xf9b8('0xe'));var deskjs=require(_0xf9b8('0xf'));var toCsv=require(_0xf9b8('0x8'));var querystring=require(_0xf9b8('0x10'));var Papa=require(_0xf9b8('0x11'));var Redis=require(_0xf9b8('0x12'));var authService=require(_0xf9b8('0x13'));var qs=require(_0xf9b8('0x14'));var as=require(_0xf9b8('0x15'));var hardwareService=require(_0xf9b8('0x16'));var logger=require('../../config/logger')(_0xf9b8('0x17'));var utils=require(_0xf9b8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf9b8('0x19'))['db'];function respondWithStatusCode(_0x445d9b,_0x397d55){_0x397d55=_0x397d55||0xcc;return function(_0x4fc941){if(_0x4fc941){return _0x445d9b['sendStatus'](_0x397d55);}return _0x445d9b[_0xf9b8('0x1a')](_0x397d55)['end']();};}function respondWithResult(_0x3d4840,_0x41f07d){_0x41f07d=_0x41f07d||0xc8;return function(_0x3b4fb4){if(_0x3b4fb4){return _0x3d4840[_0xf9b8('0x1a')](_0x41f07d)[_0xf9b8('0x1b')](_0x3b4fb4);}};}function respondWithFilteredResult(_0x5b7ef8,_0x4ef2a2){return function(_0x702671){if(_0x702671){var _0x3c417=typeof _0x4ef2a2['offset']===_0xf9b8('0x1c')&&typeof _0x4ef2a2[_0xf9b8('0x1d')]===_0xf9b8('0x1c');var _0x5a7f7f=_0x702671[_0xf9b8('0x1e')];var _0x253e6f=_0x3c417?0x0:_0x4ef2a2['offset'];var _0x208427=_0x3c417?_0x702671['count']:_0x4ef2a2['offset']+_0x4ef2a2[_0xf9b8('0x1d')];var _0x2d6476;if(_0x208427>=_0x5a7f7f){_0x208427=_0x5a7f7f;_0x2d6476=0xc8;}else{_0x2d6476=0xce;}_0x5b7ef8[_0xf9b8('0x1a')](_0x2d6476);return _0x5b7ef8[_0xf9b8('0x1f')](_0xf9b8('0x20'),_0x253e6f+'-'+_0x208427+'/'+_0x5a7f7f)[_0xf9b8('0x1b')](_0x702671);}return null;};}function patchUpdates(_0x414eb6){return function(_0x27ad42){try{jsonpatch['apply'](_0x27ad42,_0x414eb6,!![]);}catch(_0x49498a){return BPromise[_0xf9b8('0x21')](_0x49498a);}return _0x27ad42[_0xf9b8('0x22')]();};}function saveUpdates(_0x291748,_0x13452f){return function(_0x31be9e){if(_0x31be9e){return _0x31be9e[_0xf9b8('0x23')](_0x291748)[_0xf9b8('0x24')](function(_0x10b086){return _0x10b086;});}return null;};}function removeEntity(_0x34c1fc,_0x3376fe){return function(_0x3f1aef){if(_0x3f1aef){return _0x3f1aef[_0xf9b8('0x25')]()[_0xf9b8('0x24')](function(){_0x34c1fc['status'](0xcc)[_0xf9b8('0x26')]();});}};}function handleEntityNotFound(_0x64c3b5,_0x26d1c6){return function(_0x46de13){if(!_0x46de13){_0x64c3b5[_0xf9b8('0x27')](0x194);}return _0x46de13;};}function handleError(_0xc58127,_0x493d05){_0x493d05=_0x493d05||0x1f4;return function(_0x524eeb){logger[_0xf9b8('0x28')](_0x524eeb['stack']);if(_0x524eeb[_0xf9b8('0x29')]){delete _0x524eeb['name'];}_0xc58127[_0xf9b8('0x1a')](_0x493d05)[_0xf9b8('0x2a')](_0x524eeb);};}function getMustacheRender(_0x110862,_0x490937){return Mustache['render'](_0x110862,_[_0xf9b8('0x2b')](_0x490937[_0xf9b8('0x2c')],{'contact':_0x490937[_0xf9b8('0x2d')],'message':_0x490937['message'],'agent':_0x490937[_0xf9b8('0x2e')],'interaction':_0x490937[_0xf9b8('0x2f')],'account':_0x490937[_0xf9b8('0x30')]}))||'';}exports['index']=function(_0x5294a4,_0x37e512){var _0x46480c={},_0x3cd99b={},_0x30360c={'count':0x0,'rows':[]};var _0xd52098=_[_0xf9b8('0x31')](db['Migration']['rawAttributes'],function(_0x1a8421){return{'name':_0x1a8421[_0xf9b8('0x32')],'type':_0x1a8421[_0xf9b8('0x33')][_0xf9b8('0x34')]};});_0x3cd99b['model']=_['map'](_0xd52098,_0xf9b8('0x29'));_0x3cd99b[_0xf9b8('0x35')]=_[_0xf9b8('0x36')](_0x5294a4[_0xf9b8('0x35')]);_0x3cd99b[_0xf9b8('0x37')]=_['intersection'](_0x3cd99b[_0xf9b8('0x38')],_0x3cd99b['query']);_0x46480c[_0xf9b8('0x39')]=_[_0xf9b8('0x3a')](_0x3cd99b[_0xf9b8('0x38')],qs[_0xf9b8('0x3b')](_0x5294a4[_0xf9b8('0x35')][_0xf9b8('0x3b')]));_0x46480c[_0xf9b8('0x39')]=_0x46480c[_0xf9b8('0x39')][_0xf9b8('0x3c')]?_0x46480c['attributes']:_0x3cd99b['model'];if(!_0x5294a4[_0xf9b8('0x35')][_0xf9b8('0x3d')](_0xf9b8('0x3e'))){_0x46480c[_0xf9b8('0x1d')]=qs['limit'](_0x5294a4[_0xf9b8('0x35')][_0xf9b8('0x1d')]);_0x46480c[_0xf9b8('0x3f')]=qs['offset'](_0x5294a4[_0xf9b8('0x35')][_0xf9b8('0x3f')]);}_0x46480c[_0xf9b8('0x40')]=qs[_0xf9b8('0x41')](_0x5294a4['query']['sort']);_0x46480c[_0xf9b8('0x42')]=qs['filters'](_[_0xf9b8('0x43')](_0x5294a4[_0xf9b8('0x35')],_0x3cd99b[_0xf9b8('0x37')]),_0xd52098);if(_0x5294a4[_0xf9b8('0x35')][_0xf9b8('0x44')]){_0x46480c['where']=_[_0xf9b8('0x2b')](_0x46480c[_0xf9b8('0x42')],{'$or':_['map'](_0xd52098,function(_0x1e8e43){if(_0x1e8e43[_0xf9b8('0x33')]!==_0xf9b8('0x45')){var _0x3f394c={};_0x3f394c[_0x1e8e43['name']]={'$like':'%'+_0x5294a4[_0xf9b8('0x35')][_0xf9b8('0x44')]+'%'};return _0x3f394c;}})});}_0x46480c=_[_0xf9b8('0x2b')]({},_0x46480c,_0x5294a4[_0xf9b8('0x46')]);var _0x633571={'where':_0x46480c[_0xf9b8('0x42')]};return db['Migration'][_0xf9b8('0x1e')](_0x633571)['then'](function(_0x11c8e0){_0x30360c[_0xf9b8('0x1e')]=_0x11c8e0;if(_0x5294a4[_0xf9b8('0x35')][_0xf9b8('0x47')]){_0x46480c['include']=[{'all':!![]}];}return db[_0xf9b8('0x48')]['findAll'](_0x46480c);})[_0xf9b8('0x24')](function(_0x35ed08){_0x30360c['rows']=_0x35ed08;return _0x30360c;})[_0xf9b8('0x24')](respondWithFilteredResult(_0x37e512,_0x46480c))[_0xf9b8('0x49')](handleError(_0x37e512,null));}; \ No newline at end of file +var _0x34d2=['model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','rimraf','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','name','send','merge','body','contact','message','agent','interaction','index','map','Migration','rawAttributes','fieldName','key'];(function(_0x358b62,_0x3adcf1){var _0x5525d3=function(_0x577028){while(--_0x577028){_0x358b62['push'](_0x358b62['shift']());}};_0x5525d3(++_0x3adcf1);}(_0x34d2,0x12a));var _0x234d=function(_0x5aeaf5,_0x10c19a){_0x5aeaf5=_0x5aeaf5-0x0;var _0x4195ad=_0x34d2[_0x5aeaf5];return _0x4195ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x234d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x234d('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x234d('0x2'));var util=require(_0x234d('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x234d('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x234d('0x5'));var squel=require(_0x234d('0x6'));var crypto=require(_0x234d('0x7'));var jsforce=require(_0x234d('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x234d('0x4'));var querystring=require(_0x234d('0x9'));var Papa=require(_0x234d('0xa'));var Redis=require(_0x234d('0xb'));var authService=require(_0x234d('0xc'));var qs=require(_0x234d('0xd'));var as=require(_0x234d('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x234d('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x234d('0x10'));var db=require(_0x234d('0x11'))['db'];function respondWithStatusCode(_0x2c48bb,_0x26284e){_0x26284e=_0x26284e||0xcc;return function(_0x506c78){if(_0x506c78){return _0x2c48bb[_0x234d('0x12')](_0x26284e);}return _0x2c48bb[_0x234d('0x13')](_0x26284e)['end']();};}function respondWithResult(_0x3506f0,_0x403e55){_0x403e55=_0x403e55||0xc8;return function(_0x30d250){if(_0x30d250){return _0x3506f0[_0x234d('0x13')](_0x403e55)['json'](_0x30d250);}};}function respondWithFilteredResult(_0x560711,_0x1a2ef8){return function(_0x2db59c){if(_0x2db59c){var _0x200860=typeof _0x1a2ef8[_0x234d('0x14')]==='undefined'&&typeof _0x1a2ef8[_0x234d('0x15')]==='undefined';var _0x3084aa=_0x2db59c[_0x234d('0x16')];var _0x25e2a2=_0x200860?0x0:_0x1a2ef8['offset'];var _0xb5f379=_0x200860?_0x2db59c[_0x234d('0x16')]:_0x1a2ef8[_0x234d('0x14')]+_0x1a2ef8[_0x234d('0x15')];var _0x1770a8;if(_0xb5f379>=_0x3084aa){_0xb5f379=_0x3084aa;_0x1770a8=0xc8;}else{_0x1770a8=0xce;}_0x560711[_0x234d('0x13')](_0x1770a8);return _0x560711[_0x234d('0x17')](_0x234d('0x18'),_0x25e2a2+'-'+_0xb5f379+'/'+_0x3084aa)[_0x234d('0x19')](_0x2db59c);}return null;};}function patchUpdates(_0x398b90){return function(_0x5e3b4e){try{jsonpatch[_0x234d('0x1a')](_0x5e3b4e,_0x398b90,!![]);}catch(_0x4a34cd){return BPromise['reject'](_0x4a34cd);}return _0x5e3b4e[_0x234d('0x1b')]();};}function saveUpdates(_0x48ae10,_0x2d59e5){return function(_0x49a4ef){if(_0x49a4ef){return _0x49a4ef[_0x234d('0x1c')](_0x48ae10)[_0x234d('0x1d')](function(_0x13bcbb){return _0x13bcbb;});}return null;};}function removeEntity(_0x1e5a60,_0x5916db){return function(_0x3ddf9b){if(_0x3ddf9b){return _0x3ddf9b[_0x234d('0x1e')]()[_0x234d('0x1d')](function(){_0x1e5a60[_0x234d('0x13')](0xcc)[_0x234d('0x1f')]();});}};}function handleEntityNotFound(_0x410323,_0x2dfbe8){return function(_0x10c8a4){if(!_0x10c8a4){_0x410323['sendStatus'](0x194);}return _0x10c8a4;};}function handleError(_0x1cce16,_0x1b1701){_0x1b1701=_0x1b1701||0x1f4;return function(_0x2f8e3a){logger[_0x234d('0x20')](_0x2f8e3a['stack']);if(_0x2f8e3a['name']){delete _0x2f8e3a[_0x234d('0x21')];}_0x1cce16[_0x234d('0x13')](_0x1b1701)[_0x234d('0x22')](_0x2f8e3a);};}function getMustacheRender(_0x52725f,_0x56c388){return Mustache['render'](_0x52725f,_[_0x234d('0x23')](_0x56c388[_0x234d('0x24')],{'contact':_0x56c388[_0x234d('0x25')],'message':_0x56c388[_0x234d('0x26')],'agent':_0x56c388[_0x234d('0x27')],'interaction':_0x56c388[_0x234d('0x28')],'account':_0x56c388['account']}))||'';}exports[_0x234d('0x29')]=function(_0x29467c,_0xda3ac8){var _0x303426={},_0x26b57c={},_0xc8a6ab={'count':0x0,'rows':[]};var _0x48cb90=_[_0x234d('0x2a')](db[_0x234d('0x2b')][_0x234d('0x2c')],function(_0x32cde7){return{'name':_0x32cde7[_0x234d('0x2d')],'type':_0x32cde7['type'][_0x234d('0x2e')]};});_0x26b57c[_0x234d('0x2f')]=_[_0x234d('0x2a')](_0x48cb90,_0x234d('0x21'));_0x26b57c[_0x234d('0x30')]=_['keys'](_0x29467c['query']);_0x26b57c['filters']=_[_0x234d('0x31')](_0x26b57c['model'],_0x26b57c[_0x234d('0x30')]);_0x303426[_0x234d('0x32')]=_[_0x234d('0x31')](_0x26b57c[_0x234d('0x2f')],qs['fields'](_0x29467c[_0x234d('0x30')][_0x234d('0x33')]));_0x303426[_0x234d('0x32')]=_0x303426[_0x234d('0x32')][_0x234d('0x34')]?_0x303426[_0x234d('0x32')]:_0x26b57c[_0x234d('0x2f')];if(!_0x29467c[_0x234d('0x30')][_0x234d('0x35')](_0x234d('0x36'))){_0x303426['limit']=qs['limit'](_0x29467c['query']['limit']);_0x303426[_0x234d('0x14')]=qs[_0x234d('0x14')](_0x29467c[_0x234d('0x30')]['offset']);}_0x303426[_0x234d('0x37')]=qs[_0x234d('0x38')](_0x29467c[_0x234d('0x30')][_0x234d('0x38')]);_0x303426['where']=qs[_0x234d('0x39')](_[_0x234d('0x3a')](_0x29467c[_0x234d('0x30')],_0x26b57c['filters']),_0x48cb90);if(_0x29467c['query'][_0x234d('0x3b')]){_0x303426[_0x234d('0x3c')]=_[_0x234d('0x23')](_0x303426[_0x234d('0x3c')],{'$or':_[_0x234d('0x2a')](_0x48cb90,function(_0x35c2af){if(_0x35c2af[_0x234d('0x3d')]!==_0x234d('0x3e')){var _0x592480={};_0x592480[_0x35c2af[_0x234d('0x21')]]={'$like':'%'+_0x29467c[_0x234d('0x30')][_0x234d('0x3b')]+'%'};return _0x592480;}})});}_0x303426=_[_0x234d('0x23')]({},_0x303426,_0x29467c[_0x234d('0x3f')]);var _0x12d580={'where':_0x303426[_0x234d('0x3c')]};return db[_0x234d('0x2b')][_0x234d('0x16')](_0x12d580)[_0x234d('0x1d')](function(_0x14fd8b){_0xc8a6ab[_0x234d('0x16')]=_0x14fd8b;if(_0x29467c[_0x234d('0x30')][_0x234d('0x40')]){_0x303426[_0x234d('0x41')]=[{'all':!![]}];}return db[_0x234d('0x2b')][_0x234d('0x42')](_0x303426);})['then'](function(_0x352e62){_0xc8a6ab[_0x234d('0x43')]=_0x352e62;return _0xc8a6ab;})[_0x234d('0x1d')](respondWithFilteredResult(_0xda3ac8,_0x303426))[_0x234d('0x44')](handleError(_0xda3ac8,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 5c77a75..6be873e 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 _0x761d=['migrations','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define','Migration'];(function(_0x55f30a,_0x8b4fe7){var _0x2c4b31=function(_0x2529e3){while(--_0x2529e3){_0x55f30a['push'](_0x55f30a['shift']());}};_0x2c4b31(++_0x8b4fe7);}(_0x761d,0xf1));var _0xd761=function(_0x52ecbf,_0x2804c6){_0x52ecbf=_0x52ecbf-0x0;var _0xedd380=_0x761d[_0x52ecbf];return _0xedd380;};'use strict';var _=require('lodash');var util=require(_0xd761('0x0'));var logger=require(_0xd761('0x1'))(_0xd761('0x2'));var moment=require('moment');var BPromise=require(_0xd761('0x3'));var rp=require(_0xd761('0x4'));var fs=require('fs');var path=require(_0xd761('0x5'));var rimraf=require(_0xd761('0x6'));var config=require(_0xd761('0x7'));var attributes=require(_0xd761('0x8'));module['exports']=function(_0x63b22d,_0x593150){return _0x63b22d[_0xd761('0x9')](_0xd761('0xa'),attributes,{'tableName':_0xd761('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f07=['bluebird','request-promise','path','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','util','api','moment'];(function(_0x27154b,_0x5ac79d){var _0x41be5c=function(_0x5eaa6a){while(--_0x5eaa6a){_0x27154b['push'](_0x27154b['shift']());}};_0x41be5c(++_0x5ac79d);}(_0x7f07,0x1d0));var _0x77f0=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0x7f07[_0x3e0191];return _0xf2ae83;};'use strict';var _=require(_0x77f0('0x0'));var util=require(_0x77f0('0x1'));var logger=require('../../config/logger')(_0x77f0('0x2'));var moment=require(_0x77f0('0x3'));var BPromise=require(_0x77f0('0x4'));var rp=require(_0x77f0('0x5'));var fs=require('fs');var path=require(_0x77f0('0x6'));var rimraf=require(_0x77f0('0x7'));var config=require('../../config/environment');var attributes=require(_0x77f0('0x8'));module[_0x77f0('0x9')]=function(_0x54ecec,_0x3d7b30){return _0x54ecec[_0x77f0('0xa')](_0x77f0('0xb'),attributes,{'tableName':_0x77f0('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 40ea225..a1b1a5b 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 _0x8a9a=['rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x424e49,_0x5123d0){var _0x162a53=function(_0xe2444a){while(--_0xe2444a){_0x424e49['push'](_0x424e49['shift']());}};_0x162a53(++_0x5123d0);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x8a9a[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var moment=require(_0xa8a9('0x1'));var BPromise=require(_0xa8a9('0x2'));var rs=require(_0xa8a9('0x3'));var fs=require('fs');var Redis=require(_0xa8a9('0x4'));var db=require(_0xa8a9('0x5'))['db'];var utils=require(_0xa8a9('0x6'));var logger=require(_0xa8a9('0x7'))(_0xa8a9('0x8'));var config=require(_0xa8a9('0x9'));var jayson=require(_0xa8a9('0xa'));var client=jayson[_0xa8a9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a2bc,_0x4a091d,_0x1b4873){return new BPromise(function(_0x129e9f,_0x1477b0){return client[_0xa8a9('0xc')](_0x24a2bc,_0x1b4873)[_0xa8a9('0xd')](function(_0x4ebe24){logger[_0xa8a9('0xe')](_0xa8a9('0xf'),_0x4a091d,'request\x20sent');logger[_0xa8a9('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'),JSON[_0xa8a9('0x12')](_0x4ebe24));if(_0x4ebe24['error']){if(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x14')]===0x1f4){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);return _0x1477b0(_0x4ebe24['error'][_0xa8a9('0x15')]);}logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24['error']['message']);return _0x129e9f(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);}else{logger[_0xa8a9('0xe')]('Migration,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'));_0x129e9f(_0x4ebe24[_0xa8a9('0x16')]['message']);}})['catch'](function(_0x1039c9){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x1039c9);_0x1477b0(_0x1039c9);});});} \ No newline at end of file +var _0xfd96=['jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x104c9b,_0x56944d){var _0x39ba4d=function(_0x5d81a1){while(--_0x5d81a1){_0x104c9b['push'](_0x104c9b['shift']());}};_0x39ba4d(++_0x56944d);}(_0xfd96,0xe7));var _0x6fd9=function(_0x14e1e8,_0x475955){_0x14e1e8=_0x14e1e8-0x0;var _0x2c6b3b=_0xfd96[_0x14e1e8];return _0x2c6b3b;};'use strict';var _=require(_0x6fd9('0x0'));var util=require('util');var moment=require(_0x6fd9('0x1'));var BPromise=require(_0x6fd9('0x2'));var rs=require(_0x6fd9('0x3'));var fs=require('fs');var Redis=require(_0x6fd9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fd9('0x5'));var logger=require(_0x6fd9('0x6'))(_0x6fd9('0x7'));var config=require(_0x6fd9('0x8'));var jayson=require(_0x6fd9('0x9'));var client=jayson[_0x6fd9('0xa')][_0x6fd9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22f24d,_0x5439f3,_0x156c37){return new BPromise(function(_0x5a3169,_0xa97372){return client[_0x6fd9('0xc')](_0x22f24d,_0x156c37)[_0x6fd9('0xd')](function(_0x58a98c){logger[_0x6fd9('0xe')](_0x6fd9('0xf'),_0x5439f3,_0x6fd9('0x10'));logger[_0x6fd9('0x11')]('Migration,\x20%s,\x20%s,\x20%s',_0x5439f3,_0x6fd9('0x10'),JSON[_0x6fd9('0x12')](_0x58a98c));if(_0x58a98c[_0x6fd9('0x13')]){if(_0x58a98c['error'][_0x6fd9('0x14')]===0x1f4){logger['error'](_0x6fd9('0xf'),_0x5439f3,_0x58a98c[_0x6fd9('0x13')][_0x6fd9('0x15')]);return _0xa97372(_0x58a98c[_0x6fd9('0x13')][_0x6fd9('0x15')]);}logger[_0x6fd9('0x13')](_0x6fd9('0xf'),_0x5439f3,_0x58a98c[_0x6fd9('0x13')][_0x6fd9('0x15')]);return _0x5a3169(_0x58a98c[_0x6fd9('0x13')][_0x6fd9('0x15')]);}else{logger['info'](_0x6fd9('0xf'),_0x5439f3,_0x6fd9('0x10'));_0x5a3169(_0x58a98c[_0x6fd9('0x16')]['message']);}})[_0x6fd9('0x17')](function(_0x3ffa6c){logger[_0x6fd9('0x13')](_0x6fd9('0xf'),_0x5439f3,_0x3ffa6c);_0xa97372(_0x3ffa6c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index beae85a..3a55b6a 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 _0x8683=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x5708f8,_0x5a21dc){var _0x93d33b=function(_0x2ac6d8){while(--_0x2ac6d8){_0x5708f8['push'](_0x5708f8['shift']());}};_0x93d33b(++_0x5a21dc);}(_0x8683,0x8b));var _0x3868=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x8683[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x3868('0x0'));var util=require(_0x3868('0x1'));var path=require(_0x3868('0x2'));var timeout=require(_0x3868('0x3'));var express=require(_0x3868('0x4'));var router=express['Router']();var fs_extra=require(_0x3868('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3868('0x6'));var config=require(_0x3868('0x7'));var controller=require('./network.controller');router[_0x3868('0x8')]('/',auth[_0x3868('0x9')](),controller[_0x3868('0xa')]);router[_0x3868('0x8')]('/:id',auth[_0x3868('0x9')](),controller[_0x3868('0xb')]);router[_0x3868('0xc')]('/',auth['isAuthenticated'](),controller[_0x3868('0xd')]);router[_0x3868('0xe')]('/:id',auth[_0x3868('0x9')](),controller[_0x3868('0xf')]);router[_0x3868('0x10')]('/:id',auth[_0x3868('0x9')](),controller[_0x3868('0x11')]);module[_0x3868('0x12')]=router; \ No newline at end of file +var _0x9c6f=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x307a58,_0x19c7aa){var _0x4de701=function(_0x212639){while(--_0x212639){_0x307a58['push'](_0x307a58['shift']());}};_0x4de701(++_0x19c7aa);}(_0x9c6f,0x79));var _0xf9c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c6f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf9c6('0x0'));var util=require(_0xf9c6('0x1'));var path=require(_0xf9c6('0x2'));var timeout=require(_0xf9c6('0x3'));var express=require(_0xf9c6('0x4'));var router=express['Router']();var fs_extra=require(_0xf9c6('0x5'));var auth=require(_0xf9c6('0x6'));var interaction=require(_0xf9c6('0x7'));var config=require(_0xf9c6('0x8'));var controller=require(_0xf9c6('0x9'));router[_0xf9c6('0xa')]('/',auth[_0xf9c6('0xb')](),controller[_0xf9c6('0xc')]);router['get'](_0xf9c6('0xd'),auth[_0xf9c6('0xb')](),controller['show']);router[_0xf9c6('0xe')]('/',auth[_0xf9c6('0xb')](),controller[_0xf9c6('0xf')]);router[_0xf9c6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf9c6('0x11')]);router[_0xf9c6('0x12')](_0xf9c6('0xd'),auth[_0xf9c6('0xb')](),controller[_0xf9c6('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f645811..9f845af 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 _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x896148,_0x3f267b){var _0x267bf0=function(_0x5bbd52){while(--_0x5bbd52){_0x896148['push'](_0x896148['shift']());}};_0x267bf0(++_0x3f267b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x1935c5,_0x4091a5){var _0x66f21e=function(_0xf1dea1){while(--_0xf1dea1){_0x1935c5['push'](_0x1935c5['shift']());}};_0x66f21e(++_0x4091a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 9c2de9f..44789fc 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 _0xd596=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','end','stack','name','send','render','merge','contact','interaction','account','map','Network','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','sequelize','transaction','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','toLowerCase','Reload','chan_sip.so','toUpperCase','TURN','format','/etc/asterisk/sip_xcally_%s.conf','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x3c4abd,_0x4afdd8){var _0x4b9053=function(_0xd88c1){while(--_0xd88c1){_0x3c4abd['push'](_0x3c4abd['shift']());}};_0x4b9053(++_0x4afdd8);}(_0xd596,0x14c));var _0x6d59=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd596[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x6d59('0x0'));var rimraf=require(_0x6d59('0x1'));var zipdir=require(_0x6d59('0x2'));var jsonpatch=require(_0x6d59('0x3'));var rp=require(_0x6d59('0x4'));var moment=require(_0x6d59('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6d59('0x6'));var util=require('util');var path=require(_0x6d59('0x7'));var sox=require(_0x6d59('0x8'));var csv=require(_0x6d59('0x9'));var ejs=require(_0x6d59('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d59('0xb'));var squel=require(_0x6d59('0xc'));var crypto=require(_0x6d59('0xd'));var jsforce=require(_0x6d59('0xe'));var deskjs=require(_0x6d59('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6d59('0x10'));var Papa=require(_0x6d59('0x11'));var Redis=require('ioredis');var authService=require(_0x6d59('0x12'));var qs=require(_0x6d59('0x13'));var as=require(_0x6d59('0x14'));var hardwareService=require(_0x6d59('0x15'));var logger=require('../../config/logger')(_0x6d59('0x16'));var utils=require(_0x6d59('0x17'));var config=require(_0x6d59('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d59('0x19'))['db'];var jayson=require(_0x6d59('0x1a'));var client=jayson[_0x6d59('0x1b')][_0x6d59('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1dd04d,_0x2007e5,_0x515fea,_0x11b69c){return new BPromise(function(_0x53f20e,_0x2dd26f){var _0x29504e=_0x11b69c||client;return _0x29504e['request'](_0x1dd04d,_0x515fea)[_0x6d59('0x1d')](function(_0x249567){logger['info']('Network,\x20%s,\x20%s',_0x2007e5,_0x6d59('0x1e'));logger['debug'](_0x6d59('0x1f'),_0x2007e5,_0x6d59('0x1e'),JSON[_0x6d59('0x20')](_0x249567));if(_0x249567[_0x6d59('0x21')]){if(_0x249567[_0x6d59('0x21')]['code']===0x1f4){logger[_0x6d59('0x21')](_0x6d59('0x22'),_0x2007e5,_0x249567[_0x6d59('0x21')][_0x6d59('0x23')]);return _0x2dd26f(_0x249567['error'][_0x6d59('0x23')]);}logger[_0x6d59('0x21')](_0x6d59('0x22'),_0x2007e5,_0x249567[_0x6d59('0x21')][_0x6d59('0x23')]);return _0x53f20e(_0x249567[_0x6d59('0x21')][_0x6d59('0x23')]);}else{logger[_0x6d59('0x24')]('Network,\x20%s,\x20%s',_0x2007e5,_0x6d59('0x1e'));_0x53f20e(_0x249567[_0x6d59('0x25')][_0x6d59('0x23')]);}})[_0x6d59('0x26')](function(_0x4a17b1){logger[_0x6d59('0x21')](_0x6d59('0x22'),_0x2007e5,_0x4a17b1);_0x2dd26f(_0x4a17b1);});});}function respondWithStatusCode(_0x54591c,_0x43c266){_0x43c266=_0x43c266||0xcc;return function(_0x1e6730){if(_0x1e6730){return _0x54591c[_0x6d59('0x27')](_0x43c266);}return _0x54591c[_0x6d59('0x28')](_0x43c266)['end']();};}function respondWithResult(_0x18e63b,_0x519568){_0x519568=_0x519568||0xc8;return function(_0x5b3af0){if(_0x5b3af0){return _0x18e63b[_0x6d59('0x28')](_0x519568)[_0x6d59('0x29')](_0x5b3af0);}};}function respondWithFilteredResult(_0x38d087,_0x363f9c){return function(_0x30b0b4){if(_0x30b0b4){var _0x1386c2=typeof _0x363f9c['offset']===_0x6d59('0x2a')&&typeof _0x363f9c[_0x6d59('0x2b')]==='undefined';var _0x4c49a8=_0x30b0b4[_0x6d59('0x2c')];var _0x2aeb60=_0x1386c2?0x0:_0x363f9c[_0x6d59('0x2d')];var _0x1e044c=_0x1386c2?_0x30b0b4[_0x6d59('0x2c')]:_0x363f9c[_0x6d59('0x2d')]+_0x363f9c[_0x6d59('0x2b')];var _0x3bd86b;if(_0x1e044c>=_0x4c49a8){_0x1e044c=_0x4c49a8;_0x3bd86b=0xc8;}else{_0x3bd86b=0xce;}_0x38d087[_0x6d59('0x28')](_0x3bd86b);return _0x38d087[_0x6d59('0x2e')](_0x6d59('0x2f'),_0x2aeb60+'-'+_0x1e044c+'/'+_0x4c49a8)['json'](_0x30b0b4);}return null;};}function patchUpdates(_0x7b4740){return function(_0x1349d9){try{jsonpatch[_0x6d59('0x30')](_0x1349d9,_0x7b4740,!![]);}catch(_0x211407){return BPromise[_0x6d59('0x31')](_0x211407);}return _0x1349d9[_0x6d59('0x32')]();};}function saveUpdates(_0x10f4a3,_0x310b53){return function(_0x3010e4){if(_0x3010e4){return _0x3010e4[_0x6d59('0x33')](_0x10f4a3)[_0x6d59('0x1d')](function(_0x42a22e){return _0x42a22e;});}return null;};}function removeEntity(_0x4a6aa4,_0x1f505e){return function(_0x2de9e5){if(_0x2de9e5){return _0x2de9e5['destroy']()[_0x6d59('0x1d')](function(){_0x4a6aa4['status'](0xcc)[_0x6d59('0x34')]();});}};}function handleEntityNotFound(_0x594a9b,_0x28ccca){return function(_0x467636){if(!_0x467636){_0x594a9b[_0x6d59('0x27')](0x194);}return _0x467636;};}function handleError(_0x2d2c81,_0x59f21e){_0x59f21e=_0x59f21e||0x1f4;return function(_0x35f716){logger['error'](_0x35f716[_0x6d59('0x35')]);if(_0x35f716[_0x6d59('0x36')]){delete _0x35f716['name'];}_0x2d2c81[_0x6d59('0x28')](_0x59f21e)[_0x6d59('0x37')](_0x35f716);};}function getMustacheRender(_0x373e47,_0x4cda7a){return Mustache[_0x6d59('0x38')](_0x373e47,_[_0x6d59('0x39')](_0x4cda7a['body'],{'contact':_0x4cda7a[_0x6d59('0x3a')],'message':_0x4cda7a['message'],'agent':_0x4cda7a['agent'],'interaction':_0x4cda7a[_0x6d59('0x3b')],'account':_0x4cda7a[_0x6d59('0x3c')]}))||'';}exports['index']=function(_0x50f00a,_0x4fc646){var _0x63b25f={},_0x8c58f5={},_0x1eb438={'count':0x0,'rows':[]};var _0x2c8497=_[_0x6d59('0x3d')](db[_0x6d59('0x3e')][_0x6d59('0x3f')],function(_0x1c9c9e){return{'name':_0x1c9c9e[_0x6d59('0x40')],'type':_0x1c9c9e[_0x6d59('0x41')][_0x6d59('0x42')]};});_0x8c58f5['model']=_[_0x6d59('0x3d')](_0x2c8497,'name');_0x8c58f5['query']=_[_0x6d59('0x43')](_0x50f00a['query']);_0x8c58f5[_0x6d59('0x44')]=_['intersection'](_0x8c58f5[_0x6d59('0x45')],_0x8c58f5[_0x6d59('0x46')]);_0x63b25f[_0x6d59('0x47')]=_[_0x6d59('0x48')](_0x8c58f5['model'],qs[_0x6d59('0x49')](_0x50f00a[_0x6d59('0x46')][_0x6d59('0x49')]));_0x63b25f[_0x6d59('0x47')]=_0x63b25f['attributes'][_0x6d59('0x4a')]?_0x63b25f['attributes']:_0x8c58f5['model'];if(!_0x50f00a[_0x6d59('0x46')]['hasOwnProperty']('nolimit')){_0x63b25f[_0x6d59('0x2b')]=qs[_0x6d59('0x2b')](_0x50f00a[_0x6d59('0x46')][_0x6d59('0x2b')]);_0x63b25f[_0x6d59('0x2d')]=qs[_0x6d59('0x2d')](_0x50f00a['query'][_0x6d59('0x2d')]);}_0x63b25f[_0x6d59('0x4b')]=qs['sort'](_0x50f00a['query'][_0x6d59('0x4c')]);_0x63b25f[_0x6d59('0x4d')]=qs[_0x6d59('0x44')](_[_0x6d59('0x4e')](_0x50f00a[_0x6d59('0x46')],_0x8c58f5[_0x6d59('0x44')]),_0x2c8497);if(_0x50f00a[_0x6d59('0x46')][_0x6d59('0x4f')]){_0x63b25f['where']=_[_0x6d59('0x39')](_0x63b25f[_0x6d59('0x4d')],{'$or':_[_0x6d59('0x3d')](_0x2c8497,function(_0x176ee2){if(_0x176ee2[_0x6d59('0x41')]!==_0x6d59('0x50')){var _0x51c51a={};_0x51c51a[_0x176ee2[_0x6d59('0x36')]]={'$like':'%'+_0x50f00a[_0x6d59('0x46')][_0x6d59('0x4f')]+'%'};return _0x51c51a;}})});}_0x63b25f=_[_0x6d59('0x39')]({},_0x63b25f,_0x50f00a[_0x6d59('0x51')]);var _0x3b8b49={'where':_0x63b25f[_0x6d59('0x4d')]};return db[_0x6d59('0x3e')]['count'](_0x3b8b49)[_0x6d59('0x1d')](function(_0x1bd4d4){_0x1eb438[_0x6d59('0x2c')]=_0x1bd4d4;if(_0x50f00a[_0x6d59('0x46')][_0x6d59('0x52')]){_0x63b25f[_0x6d59('0x53')]=[{'all':!![]}];}return db[_0x6d59('0x3e')][_0x6d59('0x54')](_0x63b25f);})[_0x6d59('0x1d')](function(_0x262770){_0x1eb438[_0x6d59('0x55')]=_0x262770;return _0x1eb438;})[_0x6d59('0x1d')](respondWithFilteredResult(_0x4fc646,_0x63b25f))[_0x6d59('0x26')](handleError(_0x4fc646,null));};exports[_0x6d59('0x56')]=function(_0x3650c0,_0x5ca3b3){var _0x2d7127={'raw':!![],'where':{'id':_0x3650c0[_0x6d59('0x57')]['id']}},_0x5d858b={};_0x5d858b[_0x6d59('0x45')]=_['keys'](db[_0x6d59('0x3e')][_0x6d59('0x3f')]);_0x5d858b[_0x6d59('0x46')]=_[_0x6d59('0x43')](_0x3650c0[_0x6d59('0x46')]);_0x5d858b[_0x6d59('0x44')]=_[_0x6d59('0x48')](_0x5d858b['model'],_0x5d858b[_0x6d59('0x46')]);_0x2d7127[_0x6d59('0x47')]=_[_0x6d59('0x48')](_0x5d858b['model'],qs[_0x6d59('0x49')](_0x3650c0['query'][_0x6d59('0x49')]));_0x2d7127[_0x6d59('0x47')]=_0x2d7127[_0x6d59('0x47')][_0x6d59('0x4a')]?_0x2d7127[_0x6d59('0x47')]:_0x5d858b['model'];if(_0x3650c0[_0x6d59('0x46')][_0x6d59('0x52')]){_0x2d7127[_0x6d59('0x53')]=[{'all':!![]}];}_0x2d7127=_[_0x6d59('0x39')]({},_0x2d7127,_0x3650c0[_0x6d59('0x51')]);return db['Network'][_0x6d59('0x58')](_0x2d7127)['then'](handleEntityNotFound(_0x5ca3b3,null))[_0x6d59('0x1d')](respondWithResult(_0x5ca3b3,null))[_0x6d59('0x26')](handleError(_0x5ca3b3,null));};exports[_0x6d59('0x59')]=function(_0x3e18eb,_0x88d103,_0x5a23b3){var _0x20e704;return db[_0x6d59('0x5a')][_0x6d59('0x5b')](function(_0x1e3b07){return db[_0x6d59('0x3e')]['create'](_0x3e18eb[_0x6d59('0x5c')],{'raw':!![]})['then'](function(_0x2f7213){_0x20e704=_0x2f7213;return db[_0x6d59('0x3e')][_0x6d59('0x54')]({'where':{'type':_0x3e18eb[_0x6d59('0x5c')][_0x6d59('0x41')]},'raw':!![]});})[_0x6d59('0x1d')](function(_0x4a78b3){if(_0x20e704['type']['toUpperCase']()==_0x6d59('0x5d')){var _0xd7d3cb=fs[_0x6d59('0x5e')](path[_0x6d59('0x5f')](config[_0x6d59('0x60')],_0x6d59('0x61')),'utf8');var _0x14af37=ejs[_0x6d59('0x38')](_0xd7d3cb,{'networks':_0x4a78b3||[]});fs['writeFileSync'](_0x6d59('0x62'),_0x14af37);return respondWithRpcPromise('Reload',_0x6d59('0x59'),{'module':_0x6d59('0x63')});}else if(_0x20e704[_0x6d59('0x41')]['toUpperCase']()=='TURN'){var _0xf95803=fs['readFileSync'](path[_0x6d59('0x5f')](config[_0x6d59('0x60')],_0x6d59('0x64')),_0x6d59('0x65'));var _0x1b374b=ejs[_0x6d59('0x38')](_0xf95803,{'networks':_0x4a78b3||[]});fs[_0x6d59('0x66')](_0x6d59('0x67'),_0x1b374b);return respondWithRpcPromise('Reload',_0x6d59('0x59'),{'module':_0x6d59('0x63')});}else{var _0x51c45a=fs[_0x6d59('0x5e')](path[_0x6d59('0x5f')](config[_0x6d59('0x60')],_0x6d59('0x68')),'utf8');var _0x82b7a9=ejs['render'](_0x51c45a,{'networks':_0x4a78b3||[]});fs[_0x6d59('0x66')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3e18eb['body'][_0x6d59('0x41')][_0x6d59('0x69')]()),_0x82b7a9);return respondWithRpcPromise(_0x6d59('0x6a'),_0x6d59('0x59'),{'module':_0x6d59('0x6b')});}return null;})[_0x6d59('0x1d')](function(){return _0x20e704;});})[_0x6d59('0x1d')](respondWithResult(_0x88d103,0xc9))[_0x6d59('0x26')](handleError(_0x88d103,null));};exports[_0x6d59('0x33')]=function(_0x1be708,_0x545f95,_0xb222){var _0x643065;return db[_0x6d59('0x5a')][_0x6d59('0x5b')](function(_0x389194){return db[_0x6d59('0x3e')][_0x6d59('0x58')]({'where':{'id':_0x1be708['params']['id']}})[_0x6d59('0x1d')](handleEntityNotFound(_0x545f95,null))['then'](saveUpdates(_0x1be708[_0x6d59('0x5c')],null))['then'](function(_0x5e0677){if(_0x5e0677){_0x643065=_0x5e0677;return db[_0x6d59('0x3e')]['findAll']({'where':{'type':_0x643065['type']},'raw':!![]});}return null;})[_0x6d59('0x1d')](function(_0x961238){if(_0x643065[_0x6d59('0x41')][_0x6d59('0x6c')]()==_0x6d59('0x5d')){var _0x22d1d3=fs[_0x6d59('0x5e')](path[_0x6d59('0x5f')](config[_0x6d59('0x60')],_0x6d59('0x61')),_0x6d59('0x65'));var _0x271b36=ejs['render'](_0x22d1d3,{'networks':_0x961238||[]});fs['writeFileSync'](_0x6d59('0x62'),_0x271b36);return respondWithRpcPromise(_0x6d59('0x6a'),'update',{'module':_0x6d59('0x63')});}else if(_0x643065['type'][_0x6d59('0x6c')]()==_0x6d59('0x6d')){var _0x6330c9=fs[_0x6d59('0x5e')](path[_0x6d59('0x5f')](config[_0x6d59('0x60')],_0x6d59('0x64')),_0x6d59('0x65'));var _0x143eb6=ejs[_0x6d59('0x38')](_0x6330c9,{'networks':_0x961238||[]});fs[_0x6d59('0x66')]('/etc/asterisk/turn_xcally.conf',_0x143eb6);return respondWithRpcPromise(_0x6d59('0x6a'),'update',{'module':_0x6d59('0x63')});}else{var _0x297259=fs[_0x6d59('0x5e')](path[_0x6d59('0x5f')](config[_0x6d59('0x60')],_0x6d59('0x68')),'utf8');var _0x3d427f=ejs[_0x6d59('0x38')](_0x297259,{'networks':_0x961238||[]});fs['writeFileSync'](util[_0x6d59('0x6e')](_0x6d59('0x6f'),_0x1be708['body']['type'][_0x6d59('0x69')]()),_0x3d427f);return respondWithRpcPromise(_0x6d59('0x6a'),'update',{'module':_0x6d59('0x6b')});}return null;})[_0x6d59('0x1d')](function(_0x365d44){if(_0x365d44){return _0x643065;}return null;});})[_0x6d59('0x1d')](respondWithResult(_0x545f95,null))[_0x6d59('0x26')](handleError(_0x545f95,null));};exports[_0x6d59('0x70')]=function(_0xe43b5,_0x4fa753,_0x1691c0){var _0x500694;return db['Network'][_0x6d59('0x58')]({'where':{'id':_0xe43b5[_0x6d59('0x57')]['id']}})[_0x6d59('0x1d')](function(_0x473e23){_0x500694=_0x473e23;return _0x473e23;})[_0x6d59('0x1d')](handleEntityNotFound(_0x4fa753,null))[_0x6d59('0x1d')](removeEntity(_0x4fa753,null))['then'](function(){if(_0x500694){return db['Network'][_0x6d59('0x54')]({'where':{'type':_0x500694[_0x6d59('0x41')]},'raw':!![]});}})[_0x6d59('0x1d')](function(_0x2a6a8a){if(_0x500694[_0x6d59('0x41')][_0x6d59('0x6c')]()=='STUN'){var _0x715d1c=fs[_0x6d59('0x5e')](path[_0x6d59('0x5f')](config[_0x6d59('0x60')],'server/files/templates/stun_multiple.ejs'),_0x6d59('0x65'));var _0x24a7cf=ejs[_0x6d59('0x38')](_0x715d1c,{'networks':_0x2a6a8a||[]});fs[_0x6d59('0x66')](_0x6d59('0x62'),_0x24a7cf);return respondWithRpcPromise(_0x6d59('0x6a'),'destroy',{'module':_0x6d59('0x63')});}else if(_0x500694[_0x6d59('0x41')]['toUpperCase']()=='TURN'){var _0x53be57=fs[_0x6d59('0x5e')](path['join'](config[_0x6d59('0x60')],_0x6d59('0x64')),'utf8');var _0x1e13f1=ejs[_0x6d59('0x38')](_0x53be57,{'networks':_0x2a6a8a||[]});fs[_0x6d59('0x66')](_0x6d59('0x67'),_0x1e13f1);return respondWithRpcPromise(_0x6d59('0x6a'),_0x6d59('0x70'),{'module':'res_stun_monitor.so'});}else{var _0x57b420=fs[_0x6d59('0x5e')](path[_0x6d59('0x5f')](config[_0x6d59('0x60')],_0x6d59('0x68')),_0x6d59('0x65'));var _0x2fd426=ejs[_0x6d59('0x38')](_0x57b420,{'networks':_0x2a6a8a||[]});fs['writeFileSync'](util[_0x6d59('0x6e')](_0x6d59('0x6f'),_0xe43b5[_0x6d59('0x5c')]['type']['toLowerCase']()),_0x2fd426);return respondWithRpcPromise(_0x6d59('0x6a'),_0x6d59('0x70'),{'module':_0x6d59('0x6b')});}return null;})[_0x6d59('0x26')](handleError(_0x4fa753,null));}; \ No newline at end of file +var _0xe9f9=['map','Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','filter','where','name','options','includeAll','include','findAll','rows','params','find','create','transaction','toUpperCase','readFileSync','join','root','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','sequelize','STUN','server/files/templates/stun_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','send','merge','body','contact','agent','interaction','account','index'];(function(_0x2d8f73,_0x1c06ca){var _0x56e078=function(_0x238a6b){while(--_0x238a6b){_0x2d8f73['push'](_0x2d8f73['shift']());}};_0x56e078(++_0x1c06ca);}(_0xe9f9,0x174));var _0x9e9f=function(_0x28e4e8,_0x44e738){_0x28e4e8=_0x28e4e8-0x0;var _0x50be25=_0xe9f9[_0x28e4e8];return _0x50be25;};'use strict';var emlformat=require(_0x9e9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e9f('0x1'));var jsonpatch=require(_0x9e9f('0x2'));var rp=require(_0x9e9f('0x3'));var moment=require(_0x9e9f('0x4'));var BPromise=require(_0x9e9f('0x5'));var Mustache=require('mustache');var util=require(_0x9e9f('0x6'));var path=require('path');var sox=require(_0x9e9f('0x7'));var csv=require(_0x9e9f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e9f('0x9'));var _=require('lodash');var squel=require(_0x9e9f('0xa'));var crypto=require(_0x9e9f('0xb'));var jsforce=require(_0x9e9f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9e9f('0x8'));var querystring=require(_0x9e9f('0xd'));var Papa=require(_0x9e9f('0xe'));var Redis=require(_0x9e9f('0xf'));var authService=require(_0x9e9f('0x10'));var qs=require(_0x9e9f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e9f('0x12'));var logger=require(_0x9e9f('0x13'))(_0x9e9f('0x14'));var utils=require('../../config/utils');var config=require(_0x9e9f('0x15'));var licenseUtil=require(_0x9e9f('0x16'));var db=require(_0x9e9f('0x17'))['db'];var jayson=require(_0x9e9f('0x18'));var client=jayson[_0x9e9f('0x19')][_0x9e9f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x52c423,_0x35e630,_0x41101e,_0x563f55){return new BPromise(function(_0x5433ba,_0x788dbe){var _0xba6358=_0x563f55||client;return _0xba6358[_0x9e9f('0x1b')](_0x52c423,_0x41101e)[_0x9e9f('0x1c')](function(_0x42c626){logger[_0x9e9f('0x1d')]('Network,\x20%s,\x20%s',_0x35e630,_0x9e9f('0x1e'));logger['debug'](_0x9e9f('0x1f'),_0x35e630,'request\x20sent',JSON['stringify'](_0x42c626));if(_0x42c626['error']){if(_0x42c626[_0x9e9f('0x20')][_0x9e9f('0x21')]===0x1f4){logger[_0x9e9f('0x20')](_0x9e9f('0x22'),_0x35e630,_0x42c626['error'][_0x9e9f('0x23')]);return _0x788dbe(_0x42c626[_0x9e9f('0x20')][_0x9e9f('0x23')]);}logger['error'](_0x9e9f('0x22'),_0x35e630,_0x42c626[_0x9e9f('0x20')][_0x9e9f('0x23')]);return _0x5433ba(_0x42c626[_0x9e9f('0x20')]['message']);}else{logger['info'](_0x9e9f('0x22'),_0x35e630,_0x9e9f('0x1e'));_0x5433ba(_0x42c626['result'][_0x9e9f('0x23')]);}})[_0x9e9f('0x24')](function(_0x376ea7){logger[_0x9e9f('0x20')]('Network,\x20%s,\x20%s',_0x35e630,_0x376ea7);_0x788dbe(_0x376ea7);});});}function respondWithStatusCode(_0x73314f,_0x1172c2){_0x1172c2=_0x1172c2||0xcc;return function(_0x5937d9){if(_0x5937d9){return _0x73314f['sendStatus'](_0x1172c2);}return _0x73314f[_0x9e9f('0x25')](_0x1172c2)[_0x9e9f('0x26')]();};}function respondWithResult(_0x54aa78,_0x172dd1){_0x172dd1=_0x172dd1||0xc8;return function(_0x3d7302){if(_0x3d7302){return _0x54aa78['status'](_0x172dd1)[_0x9e9f('0x27')](_0x3d7302);}};}function respondWithFilteredResult(_0x126490,_0x4a019b){return function(_0x5cdfe6){if(_0x5cdfe6){var _0x4744a0=typeof _0x4a019b[_0x9e9f('0x28')]===_0x9e9f('0x29')&&typeof _0x4a019b[_0x9e9f('0x2a')]==='undefined';var _0x139d63=_0x5cdfe6[_0x9e9f('0x2b')];var _0x2c8020=_0x4744a0?0x0:_0x4a019b['offset'];var _0x9032f2=_0x4744a0?_0x5cdfe6[_0x9e9f('0x2b')]:_0x4a019b[_0x9e9f('0x28')]+_0x4a019b['limit'];var _0x1229f4;if(_0x9032f2>=_0x139d63){_0x9032f2=_0x139d63;_0x1229f4=0xc8;}else{_0x1229f4=0xce;}_0x126490[_0x9e9f('0x25')](_0x1229f4);return _0x126490[_0x9e9f('0x2c')](_0x9e9f('0x2d'),_0x2c8020+'-'+_0x9032f2+'/'+_0x139d63)[_0x9e9f('0x27')](_0x5cdfe6);}return null;};}function patchUpdates(_0x3eec7f){return function(_0x3b3a2a){try{jsonpatch[_0x9e9f('0x2e')](_0x3b3a2a,_0x3eec7f,!![]);}catch(_0x5673c9){return BPromise[_0x9e9f('0x2f')](_0x5673c9);}return _0x3b3a2a[_0x9e9f('0x30')]();};}function saveUpdates(_0x2a5d5b,_0x36e1b9){return function(_0x5d7217){if(_0x5d7217){return _0x5d7217[_0x9e9f('0x31')](_0x2a5d5b)[_0x9e9f('0x1c')](function(_0x1570f0){return _0x1570f0;});}return null;};}function removeEntity(_0x23a990,_0x22c9c8){return function(_0xadc780){if(_0xadc780){return _0xadc780[_0x9e9f('0x32')]()[_0x9e9f('0x1c')](function(){_0x23a990[_0x9e9f('0x25')](0xcc)[_0x9e9f('0x26')]();});}};}function handleEntityNotFound(_0x183c99,_0x25860d){return function(_0x26d9c0){if(!_0x26d9c0){_0x183c99[_0x9e9f('0x33')](0x194);}return _0x26d9c0;};}function handleError(_0x41b153,_0x225d1d){_0x225d1d=_0x225d1d||0x1f4;return function(_0x2038ca){logger['error'](_0x2038ca['stack']);if(_0x2038ca['name']){delete _0x2038ca['name'];}_0x41b153[_0x9e9f('0x25')](_0x225d1d)[_0x9e9f('0x34')](_0x2038ca);};}function getMustacheRender(_0x578b1e,_0x1e4dbf){return Mustache['render'](_0x578b1e,_[_0x9e9f('0x35')](_0x1e4dbf[_0x9e9f('0x36')],{'contact':_0x1e4dbf[_0x9e9f('0x37')],'message':_0x1e4dbf[_0x9e9f('0x23')],'agent':_0x1e4dbf[_0x9e9f('0x38')],'interaction':_0x1e4dbf[_0x9e9f('0x39')],'account':_0x1e4dbf[_0x9e9f('0x3a')]}))||'';}exports[_0x9e9f('0x3b')]=function(_0x45a2c5,_0x1afb39){var _0x3b2c29={},_0x32f839={},_0x234658={'count':0x0,'rows':[]};var _0xc46f0d=_[_0x9e9f('0x3c')](db[_0x9e9f('0x3d')][_0x9e9f('0x3e')],function(_0x213e30){return{'name':_0x213e30[_0x9e9f('0x3f')],'type':_0x213e30[_0x9e9f('0x40')]['key']};});_0x32f839[_0x9e9f('0x41')]=_[_0x9e9f('0x3c')](_0xc46f0d,'name');_0x32f839[_0x9e9f('0x42')]=_[_0x9e9f('0x43')](_0x45a2c5[_0x9e9f('0x42')]);_0x32f839[_0x9e9f('0x44')]=_[_0x9e9f('0x45')](_0x32f839['model'],_0x32f839['query']);_0x3b2c29[_0x9e9f('0x46')]=_['intersection'](_0x32f839[_0x9e9f('0x41')],qs[_0x9e9f('0x47')](_0x45a2c5[_0x9e9f('0x42')]['fields']));_0x3b2c29[_0x9e9f('0x46')]=_0x3b2c29['attributes'][_0x9e9f('0x48')]?_0x3b2c29[_0x9e9f('0x46')]:_0x32f839[_0x9e9f('0x41')];if(!_0x45a2c5[_0x9e9f('0x42')][_0x9e9f('0x49')](_0x9e9f('0x4a'))){_0x3b2c29[_0x9e9f('0x2a')]=qs[_0x9e9f('0x2a')](_0x45a2c5[_0x9e9f('0x42')]['limit']);_0x3b2c29[_0x9e9f('0x28')]=qs[_0x9e9f('0x28')](_0x45a2c5[_0x9e9f('0x42')][_0x9e9f('0x28')]);}_0x3b2c29['order']=qs['sort'](_0x45a2c5[_0x9e9f('0x42')]['sort']);_0x3b2c29['where']=qs[_0x9e9f('0x44')](_['pick'](_0x45a2c5[_0x9e9f('0x42')],_0x32f839[_0x9e9f('0x44')]),_0xc46f0d);if(_0x45a2c5['query'][_0x9e9f('0x4b')]){_0x3b2c29['where']=_[_0x9e9f('0x35')](_0x3b2c29[_0x9e9f('0x4c')],{'$or':_[_0x9e9f('0x3c')](_0xc46f0d,function(_0x72cbe){if(_0x72cbe[_0x9e9f('0x40')]!=='VIRTUAL'){var _0x2da665={};_0x2da665[_0x72cbe[_0x9e9f('0x4d')]]={'$like':'%'+_0x45a2c5[_0x9e9f('0x42')][_0x9e9f('0x4b')]+'%'};return _0x2da665;}})});}_0x3b2c29=_[_0x9e9f('0x35')]({},_0x3b2c29,_0x45a2c5[_0x9e9f('0x4e')]);var _0x3889ff={'where':_0x3b2c29[_0x9e9f('0x4c')]};return db[_0x9e9f('0x3d')]['count'](_0x3889ff)['then'](function(_0x2c9635){_0x234658[_0x9e9f('0x2b')]=_0x2c9635;if(_0x45a2c5['query'][_0x9e9f('0x4f')]){_0x3b2c29[_0x9e9f('0x50')]=[{'all':!![]}];}return db[_0x9e9f('0x3d')][_0x9e9f('0x51')](_0x3b2c29);})[_0x9e9f('0x1c')](function(_0x195c64){_0x234658[_0x9e9f('0x52')]=_0x195c64;return _0x234658;})[_0x9e9f('0x1c')](respondWithFilteredResult(_0x1afb39,_0x3b2c29))[_0x9e9f('0x24')](handleError(_0x1afb39,null));};exports['show']=function(_0x5ce2fe,_0xdeeabb){var _0x3676d3={'raw':!![],'where':{'id':_0x5ce2fe[_0x9e9f('0x53')]['id']}},_0x3d55db={};_0x3d55db[_0x9e9f('0x41')]=_['keys'](db[_0x9e9f('0x3d')][_0x9e9f('0x3e')]);_0x3d55db[_0x9e9f('0x42')]=_['keys'](_0x5ce2fe[_0x9e9f('0x42')]);_0x3d55db['filters']=_[_0x9e9f('0x45')](_0x3d55db[_0x9e9f('0x41')],_0x3d55db['query']);_0x3676d3[_0x9e9f('0x46')]=_['intersection'](_0x3d55db['model'],qs[_0x9e9f('0x47')](_0x5ce2fe['query'][_0x9e9f('0x47')]));_0x3676d3[_0x9e9f('0x46')]=_0x3676d3[_0x9e9f('0x46')][_0x9e9f('0x48')]?_0x3676d3['attributes']:_0x3d55db[_0x9e9f('0x41')];if(_0x5ce2fe[_0x9e9f('0x42')][_0x9e9f('0x4f')]){_0x3676d3['include']=[{'all':!![]}];}_0x3676d3=_['merge']({},_0x3676d3,_0x5ce2fe[_0x9e9f('0x4e')]);return db[_0x9e9f('0x3d')][_0x9e9f('0x54')](_0x3676d3)[_0x9e9f('0x1c')](handleEntityNotFound(_0xdeeabb,null))[_0x9e9f('0x1c')](respondWithResult(_0xdeeabb,null))[_0x9e9f('0x24')](handleError(_0xdeeabb,null));};exports[_0x9e9f('0x55')]=function(_0x403027,_0x2959e4,_0x50b7f9){var _0x55b1a3;return db['sequelize'][_0x9e9f('0x56')](function(_0x2ecc3c){return db['Network'][_0x9e9f('0x55')](_0x403027[_0x9e9f('0x36')],{'raw':!![]})[_0x9e9f('0x1c')](function(_0x5ce985){_0x55b1a3=_0x5ce985;return db[_0x9e9f('0x3d')][_0x9e9f('0x51')]({'where':{'type':_0x403027[_0x9e9f('0x36')][_0x9e9f('0x40')]},'raw':!![]});})[_0x9e9f('0x1c')](function(_0x6ff75e){if(_0x55b1a3[_0x9e9f('0x40')][_0x9e9f('0x57')]()=='STUN'){var _0x219d16=fs[_0x9e9f('0x58')](path[_0x9e9f('0x59')](config[_0x9e9f('0x5a')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x5732fe=ejs[_0x9e9f('0x5b')](_0x219d16,{'networks':_0x6ff75e||[]});fs[_0x9e9f('0x5c')](_0x9e9f('0x5d'),_0x5732fe);return respondWithRpcPromise('Reload',_0x9e9f('0x55'),{'module':_0x9e9f('0x5e')});}else if(_0x55b1a3[_0x9e9f('0x40')]['toUpperCase']()==_0x9e9f('0x5f')){var _0x6d3b54=fs[_0x9e9f('0x58')](path[_0x9e9f('0x59')](config[_0x9e9f('0x5a')],_0x9e9f('0x60')),_0x9e9f('0x61'));var _0x17b40f=ejs[_0x9e9f('0x5b')](_0x6d3b54,{'networks':_0x6ff75e||[]});fs['writeFileSync'](_0x9e9f('0x62'),_0x17b40f);return respondWithRpcPromise(_0x9e9f('0x63'),'create',{'module':_0x9e9f('0x5e')});}else{var _0x3cf2d9=fs['readFileSync'](path[_0x9e9f('0x59')](config[_0x9e9f('0x5a')],_0x9e9f('0x64')),_0x9e9f('0x61'));var _0x5513e7=ejs[_0x9e9f('0x5b')](_0x3cf2d9,{'networks':_0x6ff75e||[]});fs['writeFileSync'](util[_0x9e9f('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x403027[_0x9e9f('0x36')][_0x9e9f('0x40')][_0x9e9f('0x66')]()),_0x5513e7);return respondWithRpcPromise(_0x9e9f('0x63'),_0x9e9f('0x55'),{'module':_0x9e9f('0x67')});}return null;})[_0x9e9f('0x1c')](function(){return _0x55b1a3;});})[_0x9e9f('0x1c')](respondWithResult(_0x2959e4,0xc9))['catch'](handleError(_0x2959e4,null));};exports[_0x9e9f('0x31')]=function(_0x27bf41,_0x1232e1,_0x3fdee2){var _0x848781;return db[_0x9e9f('0x68')][_0x9e9f('0x56')](function(_0x79e21e){return db['Network']['find']({'where':{'id':_0x27bf41[_0x9e9f('0x53')]['id']}})['then'](handleEntityNotFound(_0x1232e1,null))['then'](saveUpdates(_0x27bf41[_0x9e9f('0x36')],null))[_0x9e9f('0x1c')](function(_0x5566d0){if(_0x5566d0){_0x848781=_0x5566d0;return db['Network'][_0x9e9f('0x51')]({'where':{'type':_0x848781[_0x9e9f('0x40')]},'raw':!![]});}return null;})['then'](function(_0x109469){if(_0x848781[_0x9e9f('0x40')][_0x9e9f('0x57')]()==_0x9e9f('0x69')){var _0x226dba=fs[_0x9e9f('0x58')](path[_0x9e9f('0x59')](config[_0x9e9f('0x5a')],_0x9e9f('0x6a')),_0x9e9f('0x61'));var _0x2594b0=ejs['render'](_0x226dba,{'networks':_0x109469||[]});fs[_0x9e9f('0x5c')](_0x9e9f('0x5d'),_0x2594b0);return respondWithRpcPromise(_0x9e9f('0x63'),_0x9e9f('0x31'),{'module':_0x9e9f('0x5e')});}else if(_0x848781[_0x9e9f('0x40')][_0x9e9f('0x57')]()==_0x9e9f('0x5f')){var _0x533fc3=fs[_0x9e9f('0x58')](path[_0x9e9f('0x59')](config[_0x9e9f('0x5a')],_0x9e9f('0x60')),_0x9e9f('0x61'));var _0x46295c=ejs[_0x9e9f('0x5b')](_0x533fc3,{'networks':_0x109469||[]});fs['writeFileSync'](_0x9e9f('0x62'),_0x46295c);return respondWithRpcPromise(_0x9e9f('0x63'),_0x9e9f('0x31'),{'module':_0x9e9f('0x5e')});}else{var _0x22f2b5=fs['readFileSync'](path[_0x9e9f('0x59')](config[_0x9e9f('0x5a')],_0x9e9f('0x64')),_0x9e9f('0x61'));var _0x381805=ejs[_0x9e9f('0x5b')](_0x22f2b5,{'networks':_0x109469||[]});fs[_0x9e9f('0x5c')](util[_0x9e9f('0x65')](_0x9e9f('0x6b'),_0x27bf41[_0x9e9f('0x36')][_0x9e9f('0x40')][_0x9e9f('0x66')]()),_0x381805);return respondWithRpcPromise(_0x9e9f('0x63'),_0x9e9f('0x31'),{'module':_0x9e9f('0x67')});}return null;})[_0x9e9f('0x1c')](function(_0x146454){if(_0x146454){return _0x848781;}return null;});})[_0x9e9f('0x1c')](respondWithResult(_0x1232e1,null))['catch'](handleError(_0x1232e1,null));};exports[_0x9e9f('0x32')]=function(_0x45c5b5,_0x199007,_0x3cdc38){var _0x40aa7b;return db[_0x9e9f('0x3d')][_0x9e9f('0x54')]({'where':{'id':_0x45c5b5[_0x9e9f('0x53')]['id']}})['then'](function(_0x501da2){_0x40aa7b=_0x501da2;return _0x501da2;})[_0x9e9f('0x1c')](handleEntityNotFound(_0x199007,null))[_0x9e9f('0x1c')](removeEntity(_0x199007,null))[_0x9e9f('0x1c')](function(){if(_0x40aa7b){return db[_0x9e9f('0x3d')]['findAll']({'where':{'type':_0x40aa7b['type']},'raw':!![]});}})[_0x9e9f('0x1c')](function(_0x31b5ec){if(_0x40aa7b[_0x9e9f('0x40')]['toUpperCase']()==_0x9e9f('0x69')){var _0x529091=fs['readFileSync'](path[_0x9e9f('0x59')](config[_0x9e9f('0x5a')],_0x9e9f('0x6a')),_0x9e9f('0x61'));var _0x1e36ef=ejs[_0x9e9f('0x5b')](_0x529091,{'networks':_0x31b5ec||[]});fs[_0x9e9f('0x5c')](_0x9e9f('0x5d'),_0x1e36ef);return respondWithRpcPromise('Reload',_0x9e9f('0x32'),{'module':_0x9e9f('0x5e')});}else if(_0x40aa7b[_0x9e9f('0x40')]['toUpperCase']()==_0x9e9f('0x5f')){var _0x80dc93=fs['readFileSync'](path[_0x9e9f('0x59')](config['root'],_0x9e9f('0x60')),_0x9e9f('0x61'));var _0x2187ba=ejs[_0x9e9f('0x5b')](_0x80dc93,{'networks':_0x31b5ec||[]});fs['writeFileSync'](_0x9e9f('0x62'),_0x2187ba);return respondWithRpcPromise(_0x9e9f('0x63'),'destroy',{'module':_0x9e9f('0x5e')});}else{var _0x2aa821=fs[_0x9e9f('0x58')](path[_0x9e9f('0x59')](config[_0x9e9f('0x5a')],_0x9e9f('0x64')),_0x9e9f('0x61'));var _0x1fc624=ejs[_0x9e9f('0x5b')](_0x2aa821,{'networks':_0x31b5ec||[]});fs['writeFileSync'](util[_0x9e9f('0x65')](_0x9e9f('0x6b'),_0x45c5b5[_0x9e9f('0x36')][_0x9e9f('0x40')][_0x9e9f('0x66')]()),_0x1fc624);return respondWithRpcPromise(_0x9e9f('0x63'),_0x9e9f('0x32'),{'module':_0x9e9f('0x67')});}return null;})['catch'](handleError(_0x199007,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index eb542b7..a099d04 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 _0xad95=['./network.attributes','exports','network','util','moment','path'];(function(_0x2919a3,_0x10f0ae){var _0x1f4a25=function(_0xa61163){while(--_0xa61163){_0x2919a3['push'](_0x2919a3['shift']());}};_0x1f4a25(++_0x10f0ae);}(_0xad95,0x177));var _0x5ad9=function(_0x4dcc6c,_0x105de3){_0x4dcc6c=_0x4dcc6c-0x0;var _0x5aa58b=_0xad95[_0x4dcc6c];return _0x5aa58b;};'use strict';var _=require('lodash');var util=require(_0x5ad9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5ad9('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ad9('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ad9('0x3'));module[_0x5ad9('0x4')]=function(_0x3018f2,_0x230ff7){return _0x3018f2['define']('Network',attributes,{'tableName':_0x5ad9('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2633=['path','rimraf','exports','Network','network','lodash','util','bluebird','request-promise'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x2633,0x140));var _0x3263=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2633[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x3263('0x0'));var util=require(_0x3263('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3263('0x2'));var rp=require(_0x3263('0x3'));var fs=require('fs');var path=require(_0x3263('0x4'));var rimraf=require(_0x3263('0x5'));var config=require('../../config/environment');var attributes=require('./network.attributes');module[_0x3263('0x6')]=function(_0xb44fda,_0x5326f2){return _0xb44fda['define'](_0x3263('0x7'),attributes,{'tableName':_0x3263('0x8'),'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 0408d45..5b6a991 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 _0x6e41=['Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x170f9d,_0xba5fad){var _0x44d5f5=function(_0x1a165f){while(--_0x1a165f){_0x170f9d['push'](_0x170f9d['shift']());}};_0x44d5f5(++_0xba5fad);}(_0x6e41,0x168));var _0x16e4=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x6e41[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0x16e4('0x0'));var util=require(_0x16e4('0x1'));var moment=require(_0x16e4('0x2'));var BPromise=require(_0x16e4('0x3'));var rs=require(_0x16e4('0x4'));var fs=require('fs');var Redis=require(_0x16e4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x16e4('0x6'));var logger=require('../../config/logger')(_0x16e4('0x7'));var config=require(_0x16e4('0x8'));var jayson=require(_0x16e4('0x9'));var client=jayson[_0x16e4('0xa')][_0x16e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ba640,_0x3543dd,_0x34128a){return new BPromise(function(_0x3cad60,_0x904910){return client['request'](_0x3ba640,_0x34128a)[_0x16e4('0xc')](function(_0x1d9319){logger[_0x16e4('0xd')](_0x16e4('0xe'),_0x3543dd,_0x16e4('0xf'));logger['debug'](_0x16e4('0x10'),_0x3543dd,_0x16e4('0xf'),JSON[_0x16e4('0x11')](_0x1d9319));if(_0x1d9319[_0x16e4('0x12')]){if(_0x1d9319[_0x16e4('0x12')][_0x16e4('0x13')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x3543dd,_0x1d9319[_0x16e4('0x12')]['message']);return _0x904910(_0x1d9319[_0x16e4('0x12')][_0x16e4('0x14')]);}logger[_0x16e4('0x12')](_0x16e4('0xe'),_0x3543dd,_0x1d9319[_0x16e4('0x12')][_0x16e4('0x14')]);return _0x3cad60(_0x1d9319[_0x16e4('0x12')][_0x16e4('0x14')]);}else{logger[_0x16e4('0xd')]('Network,\x20%s,\x20%s',_0x3543dd,_0x16e4('0xf'));_0x3cad60(_0x1d9319[_0x16e4('0x15')][_0x16e4('0x14')]);}})['catch'](function(_0x39cede){logger[_0x16e4('0x12')](_0x16e4('0xe'),_0x3543dd,_0x39cede);_0x904910(_0x39cede);});});} \ No newline at end of file +var _0x08b3=['http','request','then','info','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x14a0c3,_0x85a56a){var _0x5cc0c5=function(_0x42a6bf){while(--_0x42a6bf){_0x14a0c3['push'](_0x14a0c3['shift']());}};_0x5cc0c5(++_0x85a56a);}(_0x08b3,0x114));var _0x308b=function(_0x1080cf,_0x472388){_0x1080cf=_0x1080cf-0x0;var _0x3c4605=_0x08b3[_0x1080cf];return _0x3c4605;};'use strict';var _=require(_0x308b('0x0'));var util=require(_0x308b('0x1'));var moment=require(_0x308b('0x2'));var BPromise=require(_0x308b('0x3'));var rs=require(_0x308b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x308b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x308b('0x6'))(_0x308b('0x7'));var config=require(_0x308b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x308b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x183ff7,_0xb4aec5,_0x552fcd){return new BPromise(function(_0x1d45c2,_0xc132e4){return client[_0x308b('0xa')](_0x183ff7,_0x552fcd)[_0x308b('0xb')](function(_0x2fb4c2){logger[_0x308b('0xc')]('Network,\x20%s,\x20%s',_0xb4aec5,_0x308b('0xd'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0xb4aec5,_0x308b('0xd'),JSON[_0x308b('0xe')](_0x2fb4c2));if(_0x2fb4c2[_0x308b('0xf')]){if(_0x2fb4c2[_0x308b('0xf')][_0x308b('0x10')]===0x1f4){logger[_0x308b('0xf')](_0x308b('0x11'),_0xb4aec5,_0x2fb4c2['error'][_0x308b('0x12')]);return _0xc132e4(_0x2fb4c2[_0x308b('0xf')][_0x308b('0x12')]);}logger['error'](_0x308b('0x11'),_0xb4aec5,_0x2fb4c2[_0x308b('0xf')][_0x308b('0x12')]);return _0x1d45c2(_0x2fb4c2[_0x308b('0xf')]['message']);}else{logger['info'](_0x308b('0x11'),_0xb4aec5,_0x308b('0xd'));_0x1d45c2(_0x2fb4c2['result']['message']);}})['catch'](function(_0x261ffb){logger['error'](_0x308b('0x11'),_0xb4aec5,_0x261ffb);_0xc132e4(_0x261ffb);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 1a6c630..7845572 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 _0x1cb9=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','addAnswer','/:id/notify','notify','/:id/applications','addAgents','put','update','destroy','removeDispositions','delete','removeAnswers','/:id/users'];(function(_0x2f1a40,_0x1bb5a3){var _0x2c8dac=function(_0x446acf){while(--_0x446acf){_0x2f1a40['push'](_0x2f1a40['shift']());}};_0x2c8dac(++_0x1bb5a3);}(_0x1cb9,0x14e));var _0x91cb=function(_0xdcfa4a,_0x1a8e2c){_0xdcfa4a=_0xdcfa4a-0x0;var _0x335061=_0x1cb9[_0xdcfa4a];return _0x335061;};'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('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x8')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x8')]('/:id/applications',auth[_0x91cb('0x9')](),controller[_0x91cb('0x13')]);router['get'](_0x91cb('0x14'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x15')]);router[_0x91cb('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x91cb('0x16')]);router[_0x91cb('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x91cb('0x17')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller['addDisposition']);router[_0x91cb('0x17')](_0x91cb('0x11'),auth['isAuthenticated'](),controller[_0x91cb('0x18')]);router[_0x91cb('0x17')](_0x91cb('0x19'),controller[_0x91cb('0x1a')]);router['post'](_0x91cb('0x1b'),auth[_0x91cb('0x9')](),controller['addApplications']);router[_0x91cb('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x91cb('0x1c')]);router[_0x91cb('0x17')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x91cb('0x1d')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x1e')]);router['delete'](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x1f')]);router['delete'](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x20')]);router[_0x91cb('0x21')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x22')]);router[_0x91cb('0x21')](_0x91cb('0x23'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x91cb('0x24')]=router; \ No newline at end of file +var _0xabce=['put','/:id','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','send'];(function(_0x3fe31e,_0x41c4de){var _0x5b31e4=function(_0x56a576){while(--_0x56a576){_0x3fe31e['push'](_0x3fe31e['shift']());}};_0x5b31e4(++_0x41c4de);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xeabc('0x15')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post'](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller['addDisposition']);router['post'](_0xeabc('0xe'),auth['isAuthenticated'](),controller[_0xeabc('0x17')]);router[_0xeabc('0x15')](_0xeabc('0x18'),controller[_0xeabc('0x19')]);router[_0xeabc('0x15')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x1a')]);router['post'](_0xeabc('0x14'),auth['isAuthenticated'](),controller[_0xeabc('0x1b')]);router[_0xeabc('0x15')]('/:id/send',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1c')]);router[_0xeabc('0x1d')](_0xeabc('0x1e'),auth[_0xeabc('0x8')](),controller['update']);router[_0xeabc('0x1f')](_0xeabc('0x1e'),auth[_0xeabc('0x8')](),controller['destroy']);router[_0xeabc('0x1f')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x20')]);router['delete'](_0xeabc('0xe'),auth['isAuthenticated'](),controller[_0xeabc('0x21')]);router['delete'](_0xeabc('0x14'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x22')]);module[_0xeabc('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 02ca235..0ed4957 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 _0x0809=['sequelize','randomstring','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','setDataValue'];(function(_0x5af4e4,_0x43ffd5){var _0x243ffb=function(_0x47e4e2){while(--_0x47e4e2){_0x5af4e4['push'](_0x5af4e4['shift']());}};_0x243ffb(++_0x43ffd5);}(_0x0809,0x172));var _0x9080=function(_0x747706,_0x55c835){_0x747706=_0x747706-0x0;var _0xcf4323=_0x0809[_0x747706];return _0xcf4323;};'use strict';var Sequelize=require(_0x9080('0x0'));var rs=require(_0x9080('0x1'));module['exports']={'name':{'type':Sequelize[_0x9080('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9080('0x2')]},'token':{'type':Sequelize[_0x9080('0x2')],'defaultValue':function(){return rs[_0x9080('0x3')]();}},'replyUri':{'type':Sequelize[_0x9080('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9080('0x4')],'defaultValue':function(){return _0x9080('0x5');}},'notificationSound':{'type':Sequelize[_0x9080('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9080('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9080('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9080('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9080('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9080('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9080('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9080('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x9080('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9080('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x42ec18){if(!_0x42ec18)this[_0x9080('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x42ec18);}}}; \ No newline at end of file +var _0x2ec5=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x325298,_0x2d948a){var _0x23297e=function(_0x589816){while(--_0x589816){_0x325298['push'](_0x325298['shift']());}};_0x23297e(++_0x2d948a);}(_0x2ec5,0x159));var _0x52ec=function(_0x5c645e,_0x19c953){_0x5c645e=_0x5c645e-0x0;var _0x446e87=_0x2ec5[_0x5c645e];return _0x446e87;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x52ec('0x0'));module[_0x52ec('0x1')]={'name':{'type':Sequelize[_0x52ec('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x52ec('0x2')]},'token':{'type':Sequelize[_0x52ec('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x52ec('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x52ec('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x52ec('0x3')],'defaultValue':function(){return _0x52ec('0x4');}},'notificationSound':{'type':Sequelize[_0x52ec('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x52ec('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x52ec('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x52ec('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x52ec('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x52ec('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x52ec('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x52ec('0x5')],'defaultValue':![],'comment':_0x52ec('0x7'),'set':function(_0x275ead){if(!_0x275ead)this[_0x52ec('0x8')]('mandatoryDispositionPauseId',null);this[_0x52ec('0x8')]('mandatoryDisposition',_0x275ead);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 40fd8de..2af12e7 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 _0xa242=['includeAll','include','findAll','rows','keys','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','findOne','Disposition','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','updatedAt','difference','createdAt','CompanyId','isNil','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','from','CmList','List','Contacts','OpenchannelApplication','applications','Applications','list','priority','asc','ListId','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','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','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','render','merge','body','contact','agent','account','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','VIRTUAL','filter','options','where'];(function(_0x23ad34,_0xfe09f3){var _0x429265=function(_0x1e134b){while(--_0x1e134b){_0x23ad34['push'](_0x23ad34['shift']());}};_0x429265(++_0xfe09f3);}(_0xa242,0x67));var _0x2a24=function(_0x22b6a0,_0x909db7){_0x22b6a0=_0x22b6a0-0x0;var _0xd4c13e=_0xa242[_0x22b6a0];return _0xd4c13e;};'use strict';var emlformat=require(_0x2a24('0x0'));var rimraf=require(_0x2a24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a24('0x2'));var rp=require('request-promise');var moment=require(_0x2a24('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2a24('0x4'));var util=require(_0x2a24('0x5'));var path=require(_0x2a24('0x6'));var sox=require(_0x2a24('0x7'));var csv=require(_0x2a24('0x8'));var ejs=require(_0x2a24('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a24('0xa'));var squel=require(_0x2a24('0xb'));var crypto=require(_0x2a24('0xc'));var jsforce=require(_0x2a24('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2a24('0x8'));var querystring=require('querystring');var Papa=require(_0x2a24('0xe'));var Redis=require(_0x2a24('0xf'));var authService=require(_0x2a24('0x10'));var qs=require(_0x2a24('0x11'));var as=require(_0x2a24('0x12'));var hardwareService=require(_0x2a24('0x13'));var logger=require(_0x2a24('0x14'))(_0x2a24('0x15'));var utils=require(_0x2a24('0x16'));var config=require(_0x2a24('0x17'));var licenseUtil=require(_0x2a24('0x18'));var db=require('../../mysqldb')['db'];config[_0x2a24('0x19')]=_[_0x2a24('0x1a')](config[_0x2a24('0x19')],{'host':_0x2a24('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a24('0x19')]));require(_0x2a24('0x1c'))[_0x2a24('0x1d')](socket);var jayson=require(_0x2a24('0x1e'));var client=jayson[_0x2a24('0x1f')][_0x2a24('0x20')]({'port':0x232c});var client9002=jayson[_0x2a24('0x1f')][_0x2a24('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5cf2be,_0xe9b961,_0xe5f5b8,_0x553d39){return new BPromise(function(_0x15d40c,_0x2d45ce){var _0x242721=_0x553d39||client;return _0x242721[_0x2a24('0x21')](_0x5cf2be,_0xe5f5b8)[_0x2a24('0x22')](function(_0x2cf7b8){logger[_0x2a24('0x23')](_0x2a24('0x24'),_0xe9b961,_0x2a24('0x25'));logger['debug'](_0x2a24('0x26'),_0xe9b961,_0x2a24('0x25'),JSON[_0x2a24('0x27')](_0x2cf7b8));if(_0x2cf7b8[_0x2a24('0x28')]){if(_0x2cf7b8[_0x2a24('0x28')]['code']===0x1f4){logger[_0x2a24('0x28')](_0x2a24('0x24'),_0xe9b961,_0x2cf7b8[_0x2a24('0x28')][_0x2a24('0x29')]);return _0x2d45ce(_0x2cf7b8[_0x2a24('0x28')][_0x2a24('0x29')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xe9b961,_0x2cf7b8[_0x2a24('0x28')][_0x2a24('0x29')]);return _0x15d40c(_0x2cf7b8['error']['message']);}else{logger['info'](_0x2a24('0x24'),_0xe9b961,_0x2a24('0x25'));_0x15d40c(_0x2cf7b8['result'][_0x2a24('0x29')]);}})[_0x2a24('0x2a')](function(_0x4b5793){logger[_0x2a24('0x28')](_0x2a24('0x24'),_0xe9b961,_0x4b5793);_0x2d45ce(_0x4b5793);});});}function respondWithStatusCode(_0x4a5048,_0x5bb628){_0x5bb628=_0x5bb628||0xcc;return function(_0x18df7c){if(_0x18df7c){return _0x4a5048[_0x2a24('0x2b')](_0x5bb628);}return _0x4a5048['status'](_0x5bb628)[_0x2a24('0x2c')]();};}function respondWithResult(_0x58350e,_0x2e204f){_0x2e204f=_0x2e204f||0xc8;return function(_0x213524){if(_0x213524){return _0x58350e[_0x2a24('0x2d')](_0x2e204f)[_0x2a24('0x2e')](_0x213524);}};}function respondWithFilteredResult(_0x139850,_0x3b47cf){return function(_0x42544e){if(_0x42544e){var _0x3f3b90=typeof _0x3b47cf[_0x2a24('0x2f')]===_0x2a24('0x30')&&typeof _0x3b47cf['limit']==='undefined';var _0x223930=_0x42544e[_0x2a24('0x31')];var _0x3ac3bf=_0x3f3b90?0x0:_0x3b47cf[_0x2a24('0x2f')];var _0x12c0a6=_0x3f3b90?_0x42544e['count']:_0x3b47cf['offset']+_0x3b47cf[_0x2a24('0x32')];var _0x721e4a;if(_0x12c0a6>=_0x223930){_0x12c0a6=_0x223930;_0x721e4a=0xc8;}else{_0x721e4a=0xce;}_0x139850[_0x2a24('0x2d')](_0x721e4a);return _0x139850[_0x2a24('0x33')](_0x2a24('0x34'),_0x3ac3bf+'-'+_0x12c0a6+'/'+_0x223930)['json'](_0x42544e);}return null;};}function patchUpdates(_0x245896){return function(_0x3d362a){try{jsonpatch[_0x2a24('0x35')](_0x3d362a,_0x245896,!![]);}catch(_0x86e1be){return BPromise[_0x2a24('0x36')](_0x86e1be);}return _0x3d362a[_0x2a24('0x37')]();};}function saveUpdates(_0x6b3f77,_0x27c808){return function(_0x235bcd){if(_0x235bcd){return _0x235bcd[_0x2a24('0x38')](_0x6b3f77)[_0x2a24('0x22')](function(_0xb868f8){return _0xb868f8;});}return null;};}function removeEntity(_0x2d3a48,_0x44731a){return function(_0x289bf3){if(_0x289bf3){return _0x289bf3[_0x2a24('0x39')]()[_0x2a24('0x22')](function(){var _0x3807e5=_0x289bf3['get']({'plain':!![]});var _0x4d80b8=_0x2a24('0x3a');return db[_0x2a24('0x3b')][_0x2a24('0x39')]({'where':{'type':_0x4d80b8,'resourceId':_0x3807e5['id']}})[_0x2a24('0x22')](function(){return _0x289bf3;});})[_0x2a24('0x22')](function(){_0x2d3a48[_0x2a24('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa0ba,_0x309024){return function(_0x3532fa){if(!_0x3532fa){_0x5aa0ba[_0x2a24('0x2b')](0x194);}return _0x3532fa;};}function handleError(_0x5d5246,_0x2fe2f5){_0x2fe2f5=_0x2fe2f5||0x1f4;return function(_0x5c45bc){logger[_0x2a24('0x28')](_0x5c45bc[_0x2a24('0x3c')]);if(_0x5c45bc[_0x2a24('0x3d')]){delete _0x5c45bc['name'];}_0x5d5246['status'](_0x2fe2f5)[_0x2a24('0x3e')](_0x5c45bc);};}function getMustacheRender(_0x105fc9,_0x57c6c8){return Mustache[_0x2a24('0x3f')](_0x105fc9,_[_0x2a24('0x40')](_0x57c6c8[_0x2a24('0x41')],{'contact':_0x57c6c8[_0x2a24('0x42')],'message':_0x57c6c8[_0x2a24('0x29')],'agent':_0x57c6c8[_0x2a24('0x43')],'interaction':_0x57c6c8['interaction'],'account':_0x57c6c8[_0x2a24('0x44')]}))||'';}exports[_0x2a24('0x45')]=function(_0x43f4fa,_0x4bfed6){var _0x28300f={'include':[{'model':db[_0x2a24('0x46')],'as':_0x2a24('0x47')}]},_0x6c820e={},_0x13533c={'count':0x0,'rows':[]};var _0x320657=_[_0x2a24('0x48')](db[_0x2a24('0x49')][_0x2a24('0x4a')],function(_0x1ca39a){return{'name':_0x1ca39a[_0x2a24('0x4b')],'type':_0x1ca39a[_0x2a24('0x4c')][_0x2a24('0x4d')]};});_0x6c820e[_0x2a24('0x4e')]=_[_0x2a24('0x48')](_0x320657,_0x2a24('0x3d'));_0x6c820e['query']=_['keys'](_0x43f4fa[_0x2a24('0x4f')]);_0x6c820e[_0x2a24('0x50')]=_['intersection'](_0x6c820e[_0x2a24('0x4e')],_0x6c820e['query']);_0x28300f[_0x2a24('0x51')]=_['intersection'](_0x6c820e[_0x2a24('0x4e')],qs[_0x2a24('0x52')](_0x43f4fa['query'][_0x2a24('0x52')]));_0x28300f[_0x2a24('0x51')]=_0x28300f[_0x2a24('0x51')][_0x2a24('0x53')]?_0x28300f[_0x2a24('0x51')]:_0x6c820e[_0x2a24('0x4e')];if(!_0x43f4fa[_0x2a24('0x4f')][_0x2a24('0x54')](_0x2a24('0x55'))){_0x28300f[_0x2a24('0x32')]=qs['limit'](_0x43f4fa[_0x2a24('0x4f')][_0x2a24('0x32')]);_0x28300f['offset']=qs[_0x2a24('0x2f')](_0x43f4fa['query']['offset']);}_0x28300f[_0x2a24('0x56')]=qs[_0x2a24('0x57')](_0x43f4fa['query'][_0x2a24('0x57')]);_0x28300f['where']=qs[_0x2a24('0x50')](_[_0x2a24('0x58')](_0x43f4fa[_0x2a24('0x4f')],_0x6c820e['filters']),_0x320657);if(_0x43f4fa[_0x2a24('0x4f')]['filter']){_0x28300f['where']=_[_0x2a24('0x40')](_0x28300f['where'],{'$or':_['map'](_0x320657,function(_0x4ee032){if(_0x4ee032['type']!==_0x2a24('0x59')){var _0x38cd6c={};_0x38cd6c[_0x4ee032[_0x2a24('0x3d')]]={'$like':'%'+_0x43f4fa[_0x2a24('0x4f')][_0x2a24('0x5a')]+'%'};return _0x38cd6c;}})});}_0x28300f=_[_0x2a24('0x40')]({},_0x28300f,_0x43f4fa[_0x2a24('0x5b')]);var _0x1b6786={'where':_0x28300f[_0x2a24('0x5c')]};return db[_0x2a24('0x49')][_0x2a24('0x31')](_0x1b6786)[_0x2a24('0x22')](function(_0x1ac256){_0x13533c[_0x2a24('0x31')]=_0x1ac256;if(_0x43f4fa['query'][_0x2a24('0x5d')]){_0x28300f[_0x2a24('0x5e')]=[{'all':!![]}];}return db[_0x2a24('0x49')][_0x2a24('0x5f')](_0x28300f);})[_0x2a24('0x22')](function(_0x332a4c){_0x13533c[_0x2a24('0x60')]=_0x332a4c;return _0x13533c;})[_0x2a24('0x22')](respondWithFilteredResult(_0x4bfed6,_0x28300f))['catch'](handleError(_0x4bfed6,null));};exports['show']=function(_0x33a0c3,_0x46c8bb){var _0x233188={'raw':![],'where':{'id':_0x33a0c3['params']['id']},'include':[{'model':db[_0x2a24('0x46')],'as':_0x2a24('0x47')}]},_0x58862e={};_0x58862e[_0x2a24('0x4e')]=_['keys'](db[_0x2a24('0x49')][_0x2a24('0x4a')]);_0x58862e[_0x2a24('0x4f')]=_[_0x2a24('0x61')](_0x33a0c3[_0x2a24('0x4f')]);_0x58862e['filters']=_[_0x2a24('0x62')](_0x58862e[_0x2a24('0x4e')],_0x58862e[_0x2a24('0x4f')]);_0x233188[_0x2a24('0x51')]=_[_0x2a24('0x62')](_0x58862e[_0x2a24('0x4e')],qs[_0x2a24('0x52')](_0x33a0c3['query']['fields']));_0x233188['attributes']=_0x233188[_0x2a24('0x51')][_0x2a24('0x53')]?_0x233188[_0x2a24('0x51')]:_0x58862e[_0x2a24('0x4e')];if(_0x33a0c3[_0x2a24('0x4f')]['includeAll']){_0x233188['include']=[{'all':!![]}];}_0x233188=_[_0x2a24('0x40')]({},_0x233188,_0x33a0c3[_0x2a24('0x5b')]);return db[_0x2a24('0x49')][_0x2a24('0x63')](_0x233188)[_0x2a24('0x22')](handleEntityNotFound(_0x46c8bb,null))[_0x2a24('0x22')](respondWithResult(_0x46c8bb,null))[_0x2a24('0x2a')](handleError(_0x46c8bb,null));};exports[_0x2a24('0x64')]=function(_0xd6d77,_0x498251){return db[_0x2a24('0x49')]['create'](_0xd6d77[_0x2a24('0x41')],{})[_0x2a24('0x22')](function(_0x4e1b4d){var _0x34dc9f=_0xd6d77[_0x2a24('0x65')]['get']({'plain':!![]});if(!_0x34dc9f)throw new Error(_0x2a24('0x66'));if(_0x34dc9f[_0x2a24('0x67')]===_0x2a24('0x65')){var _0x3e6b51=_0x4e1b4d[_0x2a24('0x68')]({'plain':!![]});var _0x3da264='OpenchannelAccounts';return db[_0x2a24('0x69')][_0x2a24('0x63')]({'where':{'name':_0x3da264,'userProfileId':_0x34dc9f[_0x2a24('0x6a')]},'raw':!![]})[_0x2a24('0x22')](function(_0x3bae6a){if(_0x3bae6a&&_0x3bae6a[_0x2a24('0x6b')]===0x0){return db[_0x2a24('0x3b')][_0x2a24('0x64')]({'name':_0x3e6b51['name'],'resourceId':_0x3e6b51['id'],'type':_0x3bae6a[_0x2a24('0x3d')],'sectionId':_0x3bae6a['id']},{})[_0x2a24('0x22')](function(){return _0x4e1b4d;});}else{return _0x4e1b4d;}})[_0x2a24('0x2a')](function(_0x4cad71){logger[_0x2a24('0x28')](_0x2a24('0x6c'),_0x4cad71);throw _0x4cad71;});}return _0x4e1b4d;})[_0x2a24('0x22')](respondWithResult(_0x498251,0xc9))['catch'](handleError(_0x498251,null));};exports['update']=function(_0x30af19,_0x1bada1){if(_0x30af19['body']['id']){delete _0x30af19[_0x2a24('0x41')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x30af19[_0x2a24('0x6d')]['id']},'include':[{'model':db['Pause'],'as':_0x2a24('0x47')}]})[_0x2a24('0x22')](handleEntityNotFound(_0x1bada1,null))[_0x2a24('0x22')](saveUpdates(_0x30af19[_0x2a24('0x41')],null))['then'](respondWithResult(_0x1bada1,null))[_0x2a24('0x2a')](handleError(_0x1bada1,null));};exports['destroy']=function(_0x47738d,_0xc89676){return db[_0x2a24('0x49')][_0x2a24('0x63')]({'where':{'id':_0x47738d['params']['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0xc89676,null))['then'](removeEntity(_0xc89676,null))[_0x2a24('0x2a')](handleError(_0xc89676,null));};exports[_0x2a24('0x6e')]=function(_0x255ed9,_0x45509d){return db['OpenchannelAccount'][_0x2a24('0x6e')]()[_0x2a24('0x22')](respondWithResult(_0x45509d,null))[_0x2a24('0x2a')](handleError(_0x45509d,null));};exports[_0x2a24('0x6f')]=function(_0x1bdb1a,_0x2040c2,_0x3cb80d){if(_0x1bdb1a[_0x2a24('0x41')]['id']){delete _0x1bdb1a['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x1bdb1a[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x2040c2,null))[_0x2a24('0x22')](function(_0x5f35b1){if(_0x5f35b1){_0x1bdb1a[_0x2a24('0x41')][_0x2a24('0x70')]=_0x5f35b1['id'];return db['Disposition'][_0x2a24('0x64')](_0x1bdb1a['body']);}})[_0x2a24('0x22')](respondWithResult(_0x2040c2,null))[_0x2a24('0x2a')](handleError(_0x2040c2,null));};exports['getDispositions']=function(_0x71fdd9,_0x32bcb5,_0x55bcce){var _0x21bf48={'raw':![],'where':{}};var _0x574e40={};var _0x5a403f={'count':0x0,'rows':[]};return db[_0x2a24('0x49')][_0x2a24('0x71')]({'where':{'id':_0x71fdd9['params']['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x32bcb5,null))[_0x2a24('0x22')](function(_0x14f17b){if(_0x14f17b){_0x574e40['model']=_[_0x2a24('0x61')](db[_0x2a24('0x72')][_0x2a24('0x4a')]);_0x574e40[_0x2a24('0x4f')]=_['keys'](_0x71fdd9[_0x2a24('0x4f')]);_0x574e40['filters']=_[_0x2a24('0x62')](_0x574e40['model'],_0x574e40['query']);_0x21bf48[_0x2a24('0x51')]=_['intersection'](_0x574e40[_0x2a24('0x4e')],qs[_0x2a24('0x52')](_0x71fdd9['query'][_0x2a24('0x52')]));_0x21bf48[_0x2a24('0x51')]=_0x21bf48[_0x2a24('0x51')][_0x2a24('0x53')]?_0x21bf48[_0x2a24('0x51')]:_0x574e40[_0x2a24('0x4e')];if(!_0x71fdd9[_0x2a24('0x4f')][_0x2a24('0x54')]('nolimit')){_0x21bf48[_0x2a24('0x32')]=qs[_0x2a24('0x32')](_0x71fdd9[_0x2a24('0x4f')][_0x2a24('0x32')]);_0x21bf48['offset']=qs[_0x2a24('0x2f')](_0x71fdd9['query'][_0x2a24('0x2f')]);}_0x21bf48['order']=qs['sort'](_0x71fdd9[_0x2a24('0x4f')][_0x2a24('0x57')]);_0x21bf48[_0x2a24('0x5c')]=qs['filters'](_[_0x2a24('0x58')](_0x71fdd9[_0x2a24('0x4f')],_0x574e40[_0x2a24('0x50')]));_0x21bf48['where'][_0x2a24('0x70')]=_0x14f17b['id'];if(_0x71fdd9['query'][_0x2a24('0x5a')]){_0x21bf48['where']=_[_0x2a24('0x40')](_0x21bf48[_0x2a24('0x5c')],{'$or':_[_0x2a24('0x48')](_0x21bf48['attributes'],function(_0x29f5ac){var _0x5c6b6b={};_0x5c6b6b[_0x29f5ac]={'$like':'%'+_0x71fdd9[_0x2a24('0x4f')][_0x2a24('0x5a')]+'%'};return _0x5c6b6b;})});}_0x21bf48=_['merge']({},_0x21bf48,_0x71fdd9[_0x2a24('0x5b')]);return db['Disposition'][_0x2a24('0x31')]({'where':_0x21bf48[_0x2a24('0x5c')]})['then'](function(_0x59c3c4){_0x5a403f[_0x2a24('0x31')]=_0x59c3c4;if(_0x71fdd9[_0x2a24('0x4f')][_0x2a24('0x5d')]){_0x21bf48[_0x2a24('0x5e')]=[{'all':!![]}];}return db[_0x2a24('0x72')][_0x2a24('0x5f')](_0x21bf48);})[_0x2a24('0x22')](function(_0x50cd4f){_0x5a403f[_0x2a24('0x60')]=_0x50cd4f;return _0x5a403f;});}})[_0x2a24('0x22')](respondWithFilteredResult(_0x32bcb5,_0x21bf48))['catch'](handleError(_0x32bcb5,null));};exports[_0x2a24('0x73')]=function(_0x5a5015,_0x593edc,_0x5e9526){return db[_0x2a24('0x49')][_0x2a24('0x63')]({'where':{'id':_0x5a5015[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x593edc,null))[_0x2a24('0x22')](function(_0x2c35b1){if(_0x2c35b1){return _0x2c35b1[_0x2a24('0x73')](_0x5a5015[_0x2a24('0x4f')][_0x2a24('0x74')]);}})['then'](respondWithStatusCode(_0x593edc,null))[_0x2a24('0x2a')](handleError(_0x593edc,null));};exports['addAnswer']=function(_0x18ac47,_0x2de559,_0x24281b){if(_0x18ac47[_0x2a24('0x41')]['id']){delete _0x18ac47[_0x2a24('0x41')]['id'];}return db['OpenchannelAccount'][_0x2a24('0x63')]({'where':{'id':_0x18ac47[_0x2a24('0x6d')]['id']}})['then'](handleEntityNotFound(_0x2de559,null))[_0x2a24('0x22')](function(_0x189c1f){if(_0x189c1f){_0x18ac47[_0x2a24('0x41')][_0x2a24('0x70')]=_0x189c1f['id'];return db['CannedAnswer']['create'](_0x18ac47['body']);}})[_0x2a24('0x22')](respondWithResult(_0x2de559,null))[_0x2a24('0x2a')](handleError(_0x2de559,null));};exports[_0x2a24('0x75')]=function(_0xc4d1b,_0x1fd03b,_0x26d27b){var _0x55dbc7={'raw':![],'where':{}};var _0x28693c={};var _0x3a5a9c={'count':0x0,'rows':[]};return db[_0x2a24('0x49')][_0x2a24('0x71')]({'where':{'id':_0xc4d1b[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x1fd03b,null))['then'](function(_0x464a06){if(_0x464a06){_0x28693c[_0x2a24('0x4e')]=_[_0x2a24('0x61')](db['CannedAnswer'][_0x2a24('0x4a')]);_0x28693c[_0x2a24('0x4f')]=_[_0x2a24('0x61')](_0xc4d1b['query']);_0x28693c[_0x2a24('0x50')]=_[_0x2a24('0x62')](_0x28693c[_0x2a24('0x4e')],_0x28693c[_0x2a24('0x4f')]);_0x55dbc7[_0x2a24('0x51')]=_[_0x2a24('0x62')](_0x28693c['model'],qs[_0x2a24('0x52')](_0xc4d1b['query'][_0x2a24('0x52')]));_0x55dbc7[_0x2a24('0x51')]=_0x55dbc7[_0x2a24('0x51')][_0x2a24('0x53')]?_0x55dbc7[_0x2a24('0x51')]:_0x28693c[_0x2a24('0x4e')];if(!_0xc4d1b['query'][_0x2a24('0x54')](_0x2a24('0x55'))){_0x55dbc7['limit']=qs[_0x2a24('0x32')](_0xc4d1b[_0x2a24('0x4f')][_0x2a24('0x32')]);_0x55dbc7[_0x2a24('0x2f')]=qs['offset'](_0xc4d1b['query']['offset']);}_0x55dbc7[_0x2a24('0x56')]=qs[_0x2a24('0x57')](_0xc4d1b['query']['sort']);_0x55dbc7[_0x2a24('0x5c')]=qs[_0x2a24('0x50')](_[_0x2a24('0x58')](_0xc4d1b[_0x2a24('0x4f')],_0x28693c[_0x2a24('0x50')]));_0x55dbc7[_0x2a24('0x5c')][_0x2a24('0x70')]=_0x464a06['id'];if(_0xc4d1b[_0x2a24('0x4f')][_0x2a24('0x5a')]){_0x55dbc7[_0x2a24('0x5c')]=_[_0x2a24('0x40')](_0x55dbc7[_0x2a24('0x5c')],{'$or':_[_0x2a24('0x48')](_0x55dbc7[_0x2a24('0x51')],function(_0x577573){var _0x24c620={};_0x24c620[_0x577573]={'$like':'%'+_0xc4d1b[_0x2a24('0x4f')]['filter']+'%'};return _0x24c620;})});}_0x55dbc7=_[_0x2a24('0x40')]({},_0x55dbc7,_0xc4d1b[_0x2a24('0x5b')]);return db[_0x2a24('0x76')][_0x2a24('0x31')]({'where':_0x55dbc7['where']})[_0x2a24('0x22')](function(_0x3ce98c){_0x3a5a9c['count']=_0x3ce98c;if(_0xc4d1b[_0x2a24('0x4f')][_0x2a24('0x5d')]){_0x55dbc7[_0x2a24('0x5e')]=[{'all':!![]}];}return db[_0x2a24('0x76')][_0x2a24('0x5f')](_0x55dbc7);})[_0x2a24('0x22')](function(_0x15d670){_0x3a5a9c['rows']=_0x15d670;return _0x3a5a9c;});}})[_0x2a24('0x22')](respondWithFilteredResult(_0x1fd03b,_0x55dbc7))[_0x2a24('0x2a')](handleError(_0x1fd03b,null));};exports[_0x2a24('0x77')]=function(_0x4e19a5,_0x267f4e,_0x277792){return db['OpenchannelAccount'][_0x2a24('0x63')]({'where':{'id':_0x4e19a5[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x267f4e,null))[_0x2a24('0x22')](function(_0x7ff886){if(_0x7ff886){return _0x7ff886[_0x2a24('0x77')](_0x4e19a5[_0x2a24('0x4f')][_0x2a24('0x74')]);}})['then'](respondWithStatusCode(_0x267f4e,null))[_0x2a24('0x2a')](handleError(_0x267f4e,null));};exports[_0x2a24('0x78')]=function(_0x320e91,_0x2de7b0,_0x3c8d11){var _0x3611ae={'body':_0x320e91[_0x2a24('0x41')],'channel':_0x2a24('0x79')};var _0x4be8a1=[];var _0x2fda99=[];var _0x27dfde={};var _0x3a8557=![];return db[_0x2a24('0x7a')][_0x2a24('0x6e')]()[_0x2a24('0x22')](function(_0x400961){if(!_0x400961){throw new db[(_0x2a24('0x7b'))]['ValidationError']('no\x20available\x20attributes');}_0x4be8a1=_['difference'](_[_0x2a24('0x61')](_0x400961),['createdAt',_0x2a24('0x7c')]);_0x2fda99=_[_0x2a24('0x7d')](_[_0x2a24('0x61')](_0x400961),[_0x2a24('0x7e'),_0x2a24('0x7c'),_0x2a24('0x7f'),'ListId']);if(_0x320e91[_0x2a24('0x41')]['id']){delete _0x320e91['body']['id'];}if(_[_0x2a24('0x80')](_0x320e91[_0x2a24('0x41')]['from'])){throw new db[(_0x2a24('0x7b'))][(_0x2a24('0x81'))](_0x2a24('0x82'));}if(_[_0x2a24('0x80')](_0x320e91[_0x2a24('0x41')][_0x2a24('0x41')])||_0x320e91[_0x2a24('0x41')][_0x2a24('0x41')]===''){throw new db[(_0x2a24('0x7b'))][(_0x2a24('0x81'))](_0x2a24('0x83'));}if(_[_0x2a24('0x80')](_0x320e91[_0x2a24('0x41')][_0x2a24('0x84')])){throw new db['Sequelize']['ValidationError'](_0x2a24('0x85')+_0x2fda99);}if(!_[_0x2a24('0x86')](_0x2fda99,_0x320e91[_0x2a24('0x41')][_0x2a24('0x84')])){throw new db[(_0x2a24('0x7b'))][(_0x2a24('0x81'))](_0x2a24('0x87')+_0x2fda99);}_0x27dfde[_0x320e91['body']['mapKey']]=_0x320e91[_0x2a24('0x41')][_0x2a24('0x88')];})[_0x2a24('0x22')](function(){return db[_0x2a24('0x49')][_0x2a24('0x63')]({'where':{'id':_0x320e91[_0x2a24('0x6d')]['id']},'include':[{'model':db[_0x2a24('0x89')],'as':_0x2a24('0x8a'),'include':[{'model':db[_0x2a24('0x7a')],'as':_0x2a24('0x8b'),'where':_0x27dfde,'limit':0x1,'order':[[_0x2a24('0x7c'),'DESC']]}]},{'model':db[_0x2a24('0x8c')],'as':'Applications'}]});})[_0x2a24('0x22')](handleEntityNotFound(_0x2de7b0,null))['then'](function(_0x35cc72){if(_0x35cc72&&_0x35cc72[_0x2a24('0x8a')]){_0x3611ae[_0x2a24('0x44')]=_0x35cc72;_0x3611ae[_0x2a24('0x8d')]=_0x35cc72[_0x2a24('0x8e')];_0x3611ae[_0x2a24('0x8f')]=_0x35cc72[_0x2a24('0x8a')];_0x3611ae[_0x2a24('0x8d')]=_['orderBy'](_0x3611ae[_0x2a24('0x8d')],[_0x2a24('0x90')],[_0x2a24('0x91')]);if(_0x3611ae[_0x2a24('0x44')]['Applications']){delete _0x3611ae[_0x2a24('0x44')][_0x2a24('0x8e')];}if(_0x3611ae[_0x2a24('0x44')][_0x2a24('0x8a')]&&_0x3611ae[_0x2a24('0x44')]['List'][_0x2a24('0x8b')]['length']){return _0x3611ae[_0x2a24('0x44')][_0x2a24('0x8a')][_0x2a24('0x8b')][0x0];}var _0x28149c=_[_0x2a24('0x1a')](_0x320e91[_0x2a24('0x41')],{'firstName':_0x320e91[_0x2a24('0x41')]['from'],'ListId':_0x35cc72[_0x2a24('0x92')]});_0x28149c[_0x320e91[_0x2a24('0x41')][_0x2a24('0x84')]]=_0x320e91[_0x2a24('0x41')][_0x2a24('0x88')];return db[_0x2a24('0x7a')][_0x2a24('0x64')](_0x28149c,{'fields':_0x4be8a1,'raw':!![]});}})[_0x2a24('0x22')](handleEntityNotFound(_0x2de7b0,null))[_0x2a24('0x22')](function(_0x24ac0f){_0x3611ae['contact']=_0x24ac0f;if(_0x24ac0f){var _0x3cad80={'ContactId':_0x24ac0f['id'],'OpenchannelAccountId':_0x320e91['params']['id'],'from':(_0x24ac0f[_0x2a24('0x93')]||'')+'\x20'+(_0x24ac0f[_0x2a24('0x94')]||'')};var _0x567b7c={'OpenchannelAccountId':_0x320e91[_0x2a24('0x6d')]['id'],'closed':![]};if(_0x320e91[_0x2a24('0x41')][_0x2a24('0x95')]){_0x567b7c[_0x2a24('0x95')]=_0x320e91[_0x2a24('0x41')][_0x2a24('0x95')];return db['OpenchannelInteraction'][_0x2a24('0x63')]({'where':_0x567b7c})[_0x2a24('0x22')](function(_0x1615ef){if(_0x1615ef){return[_0x1615ef,![]];}_0x3cad80[_0x2a24('0x95')]=_0x320e91[_0x2a24('0x41')][_0x2a24('0x95')];_0x3cad80[_0x2a24('0x96')]=_0x320e91['body'][_0x2a24('0x96')];return db[_0x2a24('0x97')][_0x2a24('0x64')](_0x3cad80)[_0x2a24('0x22')](function(_0x149247){return[_0x149247,!![]];});});}else{_0x567b7c[_0x2a24('0x95')]=null;}_0x567b7c[_0x2a24('0x98')]=_0x24ac0f['id'];return db[_0x2a24('0x97')][_0x2a24('0x63')]({'where':_0x567b7c})[_0x2a24('0x22')](function(_0x2252c2){if(_0x2252c2){return[_0x2252c2,![]];}return db['OpenchannelInteraction'][_0x2a24('0x64')](_0x3cad80)[_0x2a24('0x22')](function(_0x5c645d){return[_0x5c645d,!![]];});});}})[_0x2a24('0x99')](function(_0x423685,_0x56ada6){if(_0x423685){_0x3a8557=_0x56ada6;if(!_0x56ada6){var _0x2ab32b={'from':(_0x3611ae[_0x2a24('0x42')]['firstName']||'')+'\x20'+(_0x3611ae[_0x2a24('0x42')]['lastName']||'')};if(_0x320e91['body']['threadId']&&_0x320e91[_0x2a24('0x41')]['messageId']&&_0x320e91['body'][_0x2a24('0x95')]!=_0x320e91[_0x2a24('0x41')][_0x2a24('0x9a')]){_0x2ab32b['threadId']=_0x320e91[_0x2a24('0x41')][_0x2a24('0x9a')];}return _0x423685[_0x2a24('0x38')](_0x2ab32b);}else{return _0x423685;}}})[_0x2a24('0x22')](function(_0x38d9cb){_0x3611ae[_0x2a24('0x9b')]=_0x38d9cb[_0x2a24('0x68')]({'plain':!![]});_0x3611ae[_0x2a24('0x9b')][_0x2a24('0x9c')]=_0x3a8557;if(_0x3611ae['interaction'][_0x2a24('0x9c')]){if(_0x3611ae[_0x2a24('0x44')][_0x2a24('0x9d')]){_0x3611ae[_0x2a24('0x8d')]['push']({'id':0x0,'priority':_0x3611ae[_0x2a24('0x8d')][_0x2a24('0x53')]+0x1,'app':_0x2a24('0x9e'),'appdata':'unmanaged','interval':_0x2a24('0x9f')});}}return db[_0x2a24('0xa0')][_0x2a24('0x64')]({'body':_0x320e91[_0x2a24('0x41')][_0x2a24('0x41')],'OpenchannelAccountId':_0x320e91[_0x2a24('0x6d')]['id'],'OpenchannelInteractionId':_0x38d9cb['id'],'direction':'in','ContactId':_0x3611ae[_0x2a24('0x42')]['id'],'AttachmentId':_0x320e91[_0x2a24('0x41')][_0x2a24('0xa1')]});})[_0x2a24('0x22')](function(_0x39d9b2){_0x3611ae[_0x2a24('0x29')]=_0x39d9b2;if(_0x3611ae[_0x2a24('0x9b')][_0x2a24('0xa2')]){return db[_0x2a24('0xa3')]['find']({'attributes':['id','name'],'where':{'id':_0x3611ae[_0x2a24('0x9b')][_0x2a24('0xa2')]}})['then'](function(_0x7fea6f){if(_0x7fea6f){_0x3611ae[_0x2a24('0x8d')][_0x2a24('0xa4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x7fea6f[_0x2a24('0x3d')]+','+(_0x3611ae['account'][_0x2a24('0xa5')]||0xa),'interval':'*,*,*,*'});_0x3611ae[_0x2a24('0xa6')]=![];}return respondWithRpcPromise('Start',_0x2a24('0xa7'),_0x3611ae);});}return respondWithRpcPromise(_0x2a24('0xa8'),_0x2a24('0xa7'),_0x3611ae);})[_0x2a24('0x22')](function(_0x21dd2f){respondWithRpcPromise(_0x2a24('0xa9'),'EventManager',{'event':_0x2a24('0x78'),'message':_0x21dd2f},client9002);return _0x21dd2f;})[_0x2a24('0x22')](respondWithResult(_0x2de7b0,null))['catch'](handleError(_0x2de7b0,null));};exports['addApplications']=function(_0x244e47,_0x579f1b,_0x5a0f4c){return db[_0x2a24('0x49')]['findOne']({'where':{'id':_0x244e47[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x579f1b,null))[_0x2a24('0x22')](function(_0x778a93){if(_0x778a93){return db[_0x2a24('0xaa')][_0x2a24('0xab')](function(_0x5cb68b){return db[_0x2a24('0x8c')][_0x2a24('0x39')]({'where':{'OpenchannelAccountId':_0x244e47['params']['id']},'transaction':_0x5cb68b})[_0x2a24('0x22')](function(_0x269eec){var _0x3898e7=_[_0x2a24('0x48')](_0x244e47[_0x2a24('0x41')],function(_0x4683da){_0x4683da[_0x2a24('0x70')]=_0x244e47['params']['id'];return _0x4683da;});return db[_0x2a24('0x8c')][_0x2a24('0xac')](_0x3898e7,{'transaction':_0x5cb68b});});})[_0x2a24('0x22')](function(){return db[_0x2a24('0x8c')][_0x2a24('0xad')]({'where':{'OpenchannelAccountId':_0x244e47[_0x2a24('0x6d')]['id']},'order':_0x2a24('0x90')});});}})[_0x2a24('0x22')](respondWithResult(_0x579f1b,null))[_0x2a24('0x2a')](handleError(_0x579f1b,null));};exports['getApplications']=function(_0x3ead18,_0x9eab0a,_0x4e11b4){var _0x343a2f={};var _0x35a6a9={};var _0x3b07ed;var _0x3fa7a6;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3ead18[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x9eab0a,null))[_0x2a24('0x22')](function(_0x403476){if(_0x403476){_0x3b07ed=_0x403476;_0x35a6a9[_0x2a24('0x4e')]=_[_0x2a24('0x61')](db['OpenchannelApplication'][_0x2a24('0x4a')]);_0x35a6a9['query']=_['keys'](_0x3ead18['query']);_0x35a6a9['filters']=_['intersection'](_0x35a6a9[_0x2a24('0x4e')],_0x35a6a9[_0x2a24('0x4f')]);_0x343a2f[_0x2a24('0x51')]=_['intersection'](_0x35a6a9[_0x2a24('0x4e')],qs['fields'](_0x3ead18[_0x2a24('0x4f')][_0x2a24('0x52')]));_0x343a2f[_0x2a24('0x51')]=_0x343a2f['attributes'][_0x2a24('0x53')]?_0x343a2f[_0x2a24('0x51')]:_0x35a6a9[_0x2a24('0x4e')];_0x343a2f[_0x2a24('0x56')]=qs[_0x2a24('0x57')](_0x3ead18['query'][_0x2a24('0x57')]);_0x343a2f['where']=qs[_0x2a24('0x50')](_[_0x2a24('0x58')](_0x3ead18[_0x2a24('0x4f')],_0x35a6a9[_0x2a24('0x50')]));if(_0x3ead18[_0x2a24('0x4f')]['filter']){_0x343a2f[_0x2a24('0x5c')]=_[_0x2a24('0x40')](_0x343a2f[_0x2a24('0x5c')],{'$or':_[_0x2a24('0x48')](_0x343a2f[_0x2a24('0x51')],function(_0x131320){var _0x1e92c5={};_0x1e92c5[_0x131320]={'$like':'%'+_0x3ead18[_0x2a24('0x4f')][_0x2a24('0x5a')]+'%'};return _0x1e92c5;})});}_0x343a2f=_[_0x2a24('0x40')]({},_0x343a2f,_0x3ead18[_0x2a24('0x5b')]);return _0x3b07ed['getApplications'](_0x343a2f);}})[_0x2a24('0x22')](function(_0x8d15df){if(_0x8d15df){_0x3fa7a6=_0x8d15df['length'];if(!_0x3ead18['query'][_0x2a24('0x54')](_0x2a24('0x55'))){_0x343a2f[_0x2a24('0x32')]=qs[_0x2a24('0x32')](_0x3ead18['query'][_0x2a24('0x32')]);_0x343a2f[_0x2a24('0x2f')]=qs[_0x2a24('0x2f')](_0x3ead18['query']['offset']);}return _0x3b07ed[_0x2a24('0xae')](_0x343a2f);}})[_0x2a24('0x22')](function(_0x93d2d3){if(_0x93d2d3){return _0x93d2d3?{'count':_0x3fa7a6,'rows':_0x93d2d3}:null;}})[_0x2a24('0x22')](respondWithResult(_0x9eab0a,null))[_0x2a24('0x2a')](handleError(_0x9eab0a,null));};exports[_0x2a24('0xaf')]=function(_0x27d6b6,_0x473c11,_0x1f4703){var _0x3ca148={'raw':![],'where':{}};var _0x268526={};var _0x5394a6={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x27d6b6[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x473c11,null))[_0x2a24('0x22')](function(_0x11edeb){if(_0x11edeb){_0x268526['model']=_[_0x2a24('0x61')](db['OpenchannelInteraction']['rawAttributes']);_0x268526['query']=_['keys'](_0x27d6b6['query']);_0x268526[_0x2a24('0x50')]=_[_0x2a24('0x62')](_0x268526[_0x2a24('0x4e')],_0x268526[_0x2a24('0x4f')]);_0x3ca148['attributes']=_['intersection'](_0x268526['model'],qs[_0x2a24('0x52')](_0x27d6b6[_0x2a24('0x4f')]['fields']));_0x3ca148[_0x2a24('0x51')]=_0x3ca148['attributes'][_0x2a24('0x53')]?_0x3ca148[_0x2a24('0x51')]:_0x268526[_0x2a24('0x4e')];if(!_0x27d6b6[_0x2a24('0x4f')]['hasOwnProperty'](_0x2a24('0x55'))){_0x3ca148['limit']=qs[_0x2a24('0x32')](_0x27d6b6[_0x2a24('0x4f')][_0x2a24('0x32')]);_0x3ca148[_0x2a24('0x2f')]=qs[_0x2a24('0x2f')](_0x27d6b6[_0x2a24('0x4f')][_0x2a24('0x2f')]);}_0x3ca148['order']=qs[_0x2a24('0x57')](_0x27d6b6[_0x2a24('0x4f')][_0x2a24('0x57')]);_0x3ca148[_0x2a24('0x5c')]=qs['filters'](_[_0x2a24('0x58')](_0x27d6b6[_0x2a24('0x4f')],_0x268526[_0x2a24('0x50')]));_0x3ca148[_0x2a24('0x5c')]['OpenchannelAccountId']=_0x11edeb['id'];if(_0x27d6b6['query']['filter']){_0x3ca148[_0x2a24('0x5c')]=_[_0x2a24('0x40')](_0x3ca148['where'],{'$or':_['map'](_0x3ca148[_0x2a24('0x51')],function(_0x4f1b15){var _0x5edb6c={};_0x5edb6c[_0x4f1b15]={'$like':'%'+_0x27d6b6[_0x2a24('0x4f')][_0x2a24('0x5a')]+'%'};return _0x5edb6c;})});}_0x3ca148=_[_0x2a24('0x40')]({},_0x3ca148,_0x27d6b6['options']);return db[_0x2a24('0x97')][_0x2a24('0x31')]({'where':_0x3ca148['where']})[_0x2a24('0x22')](function(_0x1286e7){_0x5394a6[_0x2a24('0x31')]=_0x1286e7;if(_0x27d6b6[_0x2a24('0x4f')][_0x2a24('0x5d')]){_0x3ca148[_0x2a24('0x5e')]=[{'model':db[_0x2a24('0x7a')],'as':_0x2a24('0xb0'),'required':![]},{'model':db[_0x2a24('0xa3')],'as':_0x2a24('0xb1'),'attributes':[_0x2a24('0x3d'),'fullname',_0x2a24('0xb2')],'required':![]},{'model':db[_0x2a24('0xb3')],'as':_0x2a24('0xb4'),'attributes':['id',_0x2a24('0x3d'),_0x2a24('0xb5')],'where':_0x27d6b6[_0x2a24('0x4f')][_0x2a24('0xb6')]?{'id':_0x27d6b6[_0x2a24('0x4f')][_0x2a24('0xb6')]}:undefined,'required':_0x27d6b6[_0x2a24('0x4f')][_0x2a24('0xb6')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x2a24('0x5f')](_0x3ca148);})['then'](function(_0x204a65){_0x5394a6[_0x2a24('0x60')]=_0x204a65;return _0x5394a6;});}})[_0x2a24('0x22')](respondWithFilteredResult(_0x473c11,_0x3ca148))[_0x2a24('0x2a')](handleError(_0x473c11,null));};exports[_0x2a24('0xb7')]=function(_0x1b7caa,_0x3aba9e,_0x5a1908){return db['OpenchannelAccount'][_0x2a24('0x63')]({'where':{'id':_0x1b7caa[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x3aba9e,null))[_0x2a24('0x22')](function(_0x4e85ea){if(_0x4e85ea){return _0x4e85ea['addAgents'](_0x1b7caa[_0x2a24('0x41')][_0x2a24('0x74')],_[_0x2a24('0xb8')](_0x1b7caa[_0x2a24('0x41')],[_0x2a24('0x74'),'id'])||{})[_0x2a24('0x99')](function(_0x430516){for(var _0x1d8474=0x0;_0x1d8474<_0x1b7caa['body']['ids'][_0x2a24('0x53')];_0x1d8474+=0x1){socket[_0x2a24('0xb9')](_0x2a24('0xba'),{'UserId':_0x1b7caa['body'][_0x2a24('0x74')][_0x1d8474],'OpenchannelAccountId':_0x1b7caa['params']['id']});}return _0x430516;});}})['then'](respondWithResult(_0x3aba9e,null))[_0x2a24('0x2a')](handleError(_0x3aba9e,null));};exports['removeAgents']=function(_0x75d3ca,_0x35b348,_0x15227e){return db[_0x2a24('0x49')][_0x2a24('0x63')]({'where':{'id':_0x75d3ca[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x35b348,null))[_0x2a24('0x22')](function(_0x141d6e){if(_0x141d6e){return _0x141d6e[_0x2a24('0xbb')](_0x75d3ca['query'][_0x2a24('0x74')])[_0x2a24('0x22')](function(){if(_[_0x2a24('0xbc')](_0x75d3ca['query'][_0x2a24('0x74')])){for(var _0x2a8f26=0x0;_0x2a8f26<_0x75d3ca['query'][_0x2a24('0x74')][_0x2a24('0x53')];_0x2a8f26+=0x1){socket[_0x2a24('0xb9')](_0x2a24('0xbd'),{'UserId':Number(_0x75d3ca[_0x2a24('0x4f')]['ids'][_0x2a8f26]),'OpenchannelAccountId':Number(_0x75d3ca['params']['id'])});}}else{socket[_0x2a24('0xb9')](_0x2a24('0xbd'),{'UserId':Number(_0x75d3ca['query'][_0x2a24('0x74')]),'OpenchannelAccountId':Number(_0x75d3ca[_0x2a24('0x6d')]['id'])});}});}})['then'](respondWithStatusCode(_0x35b348,null))[_0x2a24('0x2a')](handleError(_0x35b348,null));};exports[_0x2a24('0xbe')]=function(_0xa73b43,_0x9ed190,_0x1995a3){var _0x27df03={};var _0x8c1e6d={};var _0x38df32;var _0x4f0ec3;return db[_0x2a24('0x49')][_0x2a24('0x71')]({'where':{'id':_0xa73b43[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x9ed190,null))['then'](function(_0x30716b){if(_0x30716b){_0x38df32=_0x30716b;_0x8c1e6d['model']=_[_0x2a24('0x61')](db[_0x2a24('0xa3')]['rawAttributes']);_0x8c1e6d[_0x2a24('0x4f')]=_[_0x2a24('0x61')](_0xa73b43['query']);_0x8c1e6d[_0x2a24('0x50')]=_[_0x2a24('0x62')](_0x8c1e6d[_0x2a24('0x4e')],_0x8c1e6d[_0x2a24('0x4f')]);_0x27df03['attributes']=_[_0x2a24('0x62')](_0x8c1e6d[_0x2a24('0x4e')],qs[_0x2a24('0x52')](_0xa73b43['query'][_0x2a24('0x52')]));_0x27df03[_0x2a24('0x51')]=_0x27df03[_0x2a24('0x51')][_0x2a24('0x53')]?_0x27df03['attributes']:_0x8c1e6d[_0x2a24('0x4e')];_0x27df03[_0x2a24('0x56')]=qs[_0x2a24('0x57')](_0xa73b43[_0x2a24('0x4f')][_0x2a24('0x57')]);_0x27df03[_0x2a24('0x5c')]=qs[_0x2a24('0x50')](_[_0x2a24('0x58')](_0xa73b43[_0x2a24('0x4f')],_0x8c1e6d['filters']));if(_0xa73b43[_0x2a24('0x4f')]['filter']){_0x27df03[_0x2a24('0x5c')]=_[_0x2a24('0x40')](_0x27df03[_0x2a24('0x5c')],{'$or':_['map'](_0x27df03['attributes'],function(_0x1ae9eb){var _0x409980={};_0x409980[_0x1ae9eb]={'$like':'%'+_0xa73b43['query'][_0x2a24('0x5a')]+'%'};return _0x409980;})});}_0x27df03=_[_0x2a24('0x40')]({},_0x27df03,_0xa73b43['options']);return _0x38df32[_0x2a24('0xbe')](_0x27df03);}})[_0x2a24('0x22')](function(_0x330c17){if(_0x330c17){_0x4f0ec3=_0x330c17[_0x2a24('0x53')];if(!_0xa73b43[_0x2a24('0x4f')][_0x2a24('0x54')]('nolimit')){_0x27df03[_0x2a24('0x32')]=qs['limit'](_0xa73b43[_0x2a24('0x4f')][_0x2a24('0x32')]);_0x27df03[_0x2a24('0x2f')]=qs[_0x2a24('0x2f')](_0xa73b43[_0x2a24('0x4f')][_0x2a24('0x2f')]);}return _0x38df32[_0x2a24('0xbe')](_0x27df03);}})[_0x2a24('0x22')](function(_0x436813){if(_0x436813){return _0x436813?{'count':_0x4f0ec3,'rows':_0x436813}:null;}})[_0x2a24('0x22')](respondWithResult(_0x9ed190,null))['catch'](handleError(_0x9ed190,null));};exports['send']=function(_0x4b7bbc,_0x19c614,_0x1d9b16){var _0x58c80e,_0x453506,_0x2b096f;if(_['isNil'](_0x4b7bbc[_0x2a24('0x41')][_0x2a24('0x41')])||_0x4b7bbc[_0x2a24('0x41')][_0x2a24('0x41')]===''){throw new db[(_0x2a24('0x7b'))]['ValidationError'](_0x2a24('0x83'));}if(_[_0x2a24('0x80')](_0x4b7bbc[_0x2a24('0x41')]['to'])){}_0x58c80e=_0x4b7bbc[_0x2a24('0x41')]['to'];return db['OpenchannelAccount'][_0x2a24('0x71')]({'where':{'id':_0x4b7bbc[_0x2a24('0x6d')]['id']}})[_0x2a24('0x22')](handleEntityNotFound(_0x19c614,null))['then'](function(_0xa07182){if(_0xa07182){return db[_0x2a24('0x49')][_0x2a24('0x63')]({'where':{'id':_0xa07182['id']},'include':[{'model':db[_0x2a24('0x89')],'as':_0x2a24('0x8a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0xa07182[_0x2a24('0x84')]]:_0x58c80e},'limit':0x1,'order':[['updatedAt',_0x2a24('0xbf')]]}]}]})[_0x2a24('0x22')](handleEntityNotFound(_0x19c614,null))[_0x2a24('0x22')](function(_0x8206d0){if(_0x8206d0&&_0x8206d0['List']){_0x453506=_0x8206d0[_0x2a24('0x68')]({'plain':!![]});if(_0x453506['List']&&_0x453506[_0x2a24('0x8a')][_0x2a24('0x8b')][_0x2a24('0x53')]){return _0x453506[_0x2a24('0x8a')][_0x2a24('0x8b')][0x0];}return db[_0x2a24('0x7a')][_0x2a24('0x64')](_['defaults'](_0x4b7bbc['body'],{'firstName':_0x58c80e,[_0x8206d0[_0x2a24('0x84')]]:_0x58c80e,'phone':_0x58c80e,'ListId':_0x453506[_0x2a24('0x92')]}));}})[_0x2a24('0x22')](handleEntityNotFound(_0x19c614,null))['then'](function(_0x1e618e){if(_0x1e618e){_0x2b096f=_0x1e618e;return db['OpenchannelInteraction'][_0x2a24('0x63')]({'where':{'ContactId':_0x2b096f['id'],'closed':![],'OpenchannelAccountId':_0x453506['id']}})['then'](function(_0x5df36f){if(_0x5df36f){return[_0x5df36f,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x4b7bbc[_0x2a24('0x65')]['id'],'ContactId':_0x2b096f['id'],'OpenchannelAccountId':_0x453506['id'],'lastMsgDirection':_0x2a24('0xc0'),'Messages':[_[_0x2a24('0x40')](_0x4b7bbc[_0x2a24('0x41')],{'read':![],'body':_0x4b7bbc[_0x2a24('0x41')][_0x2a24('0x41')],'OpenchannelAccountId':_0x453506['id'],'UserId':_0x4b7bbc[_0x2a24('0x65')]['id'],'ContactId':_0x2b096f['id']})]},{'include':[{'model':db[_0x2a24('0xa0')],'as':_0x2a24('0xc1')}]})[_0x2a24('0x22')](function(_0x41309a){return[_0x41309a,!![]];});});}})[_0x2a24('0x99')](function(_0x112e6b,_0x20f445){if(_0x20f445){return _0x112e6b;}return db[_0x2a24('0xa0')]['create'](_[_0x2a24('0x40')](_0x4b7bbc['body'],{'read':![],'body':_0x4b7bbc[_0x2a24('0x41')][_0x2a24('0x41')],'OpenchannelAccountId':_0x453506['id'],'OpenchannelInteractionId':_0x112e6b['id'],'UserId':_0x4b7bbc[_0x2a24('0x65')]['id'],'ContactId':_0x2b096f['id']}))[_0x2a24('0x22')](function(_0x2b8cfb){_0x112e6b['dataValues'][_0x2a24('0xc1')]=[];_0x112e6b[_0x2a24('0xc2')][_0x2a24('0xc1')][_0x2a24('0xc3')](_0x2b8cfb[_0x2a24('0xc2')]);return _0x112e6b;});});}})['then'](respondWithResult(_0x19c614,null))[_0x2a24('0x2a')](handleError(_0x19c614,null));}; \ No newline at end of file +var _0xc747=['status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','render','merge','body','agent','interaction','account','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','OpenchannelAccount','includeAll','include','findAll','keys','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','CannedAnswer','getAnswers','order','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','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','List','Contacts','DESC','OpenchannelApplication','Applications','applications','orderBy','priority','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','sequelize','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','addAgents','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','dataValues','Messages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus'];(function(_0x28e55e,_0x8a4870){var _0x3a4591=function(_0x263305){while(--_0x263305){_0x28e55e['push'](_0x28e55e['shift']());}};_0x3a4591(++_0x8a4870);}(_0xc747,0x8d));var _0x7c74=function(_0x44e167,_0x377fc6){_0x44e167=_0x44e167-0x0;var _0x32abc6=_0xc747[_0x44e167];return _0x32abc6;};'use strict';var emlformat=require(_0x7c74('0x0'));var rimraf=require(_0x7c74('0x1'));var zipdir=require(_0x7c74('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c74('0x3'));var moment=require(_0x7c74('0x4'));var BPromise=require(_0x7c74('0x5'));var Mustache=require(_0x7c74('0x6'));var util=require('util');var path=require(_0x7c74('0x7'));var sox=require('sox');var csv=require(_0x7c74('0x8'));var ejs=require(_0x7c74('0x9'));var fs=require('fs');var fs_extra=require(_0x7c74('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7c74('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7c74('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7c74('0xd'));var Papa=require(_0x7c74('0xe'));var Redis=require(_0x7c74('0xf'));var authService=require(_0x7c74('0x10'));var qs=require(_0x7c74('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c74('0x12'))(_0x7c74('0x13'));var utils=require(_0x7c74('0x14'));var config=require(_0x7c74('0x15'));var licenseUtil=require(_0x7c74('0x16'));var db=require(_0x7c74('0x17'))['db'];config[_0x7c74('0x18')]=_['defaults'](config[_0x7c74('0x18')],{'host':_0x7c74('0x19'),'port':0x18eb});var socket=require(_0x7c74('0x1a'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x7c74('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7c74('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x7c74('0x1c')][_0x7c74('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1a9ac8,_0x52bd8b,_0x3923c0,_0x5f03dc){return new BPromise(function(_0x174d8d,_0x3762bc){var _0x3b544a=_0x5f03dc||client;return _0x3b544a[_0x7c74('0x1e')](_0x1a9ac8,_0x3923c0)[_0x7c74('0x1f')](function(_0x1a04e9){logger['info'](_0x7c74('0x20'),_0x52bd8b,_0x7c74('0x21'));logger['debug'](_0x7c74('0x22'),_0x52bd8b,_0x7c74('0x21'),JSON['stringify'](_0x1a04e9));if(_0x1a04e9['error']){if(_0x1a04e9[_0x7c74('0x23')][_0x7c74('0x24')]===0x1f4){logger[_0x7c74('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x52bd8b,_0x1a04e9[_0x7c74('0x23')][_0x7c74('0x25')]);return _0x3762bc(_0x1a04e9[_0x7c74('0x23')][_0x7c74('0x25')]);}logger[_0x7c74('0x23')](_0x7c74('0x20'),_0x52bd8b,_0x1a04e9[_0x7c74('0x23')][_0x7c74('0x25')]);return _0x174d8d(_0x1a04e9[_0x7c74('0x23')]['message']);}else{logger[_0x7c74('0x26')](_0x7c74('0x20'),_0x52bd8b,_0x7c74('0x21'));_0x174d8d(_0x1a04e9[_0x7c74('0x27')]['message']);}})[_0x7c74('0x28')](function(_0x45f9b8){logger[_0x7c74('0x23')](_0x7c74('0x20'),_0x52bd8b,_0x45f9b8);_0x3762bc(_0x45f9b8);});});}function respondWithStatusCode(_0x6a082e,_0x5126a4){_0x5126a4=_0x5126a4||0xcc;return function(_0x1dced0){if(_0x1dced0){return _0x6a082e[_0x7c74('0x29')](_0x5126a4);}return _0x6a082e[_0x7c74('0x2a')](_0x5126a4)[_0x7c74('0x2b')]();};}function respondWithResult(_0x34a30c,_0x433233){_0x433233=_0x433233||0xc8;return function(_0x47d7e7){if(_0x47d7e7){return _0x34a30c[_0x7c74('0x2a')](_0x433233)['json'](_0x47d7e7);}};}function respondWithFilteredResult(_0x3090cf,_0x150c27){return function(_0x395db4){if(_0x395db4){var _0x401304=typeof _0x150c27[_0x7c74('0x2c')]==='undefined'&&typeof _0x150c27['limit']===_0x7c74('0x2d');var _0x281841=_0x395db4[_0x7c74('0x2e')];var _0x2e05f2=_0x401304?0x0:_0x150c27[_0x7c74('0x2c')];var _0x21beb4=_0x401304?_0x395db4[_0x7c74('0x2e')]:_0x150c27[_0x7c74('0x2c')]+_0x150c27[_0x7c74('0x2f')];var _0x5ae9c7;if(_0x21beb4>=_0x281841){_0x21beb4=_0x281841;_0x5ae9c7=0xc8;}else{_0x5ae9c7=0xce;}_0x3090cf['status'](_0x5ae9c7);return _0x3090cf[_0x7c74('0x30')](_0x7c74('0x31'),_0x2e05f2+'-'+_0x21beb4+'/'+_0x281841)['json'](_0x395db4);}return null;};}function patchUpdates(_0x102d7d){return function(_0xb5eab0){try{jsonpatch['apply'](_0xb5eab0,_0x102d7d,!![]);}catch(_0x26dc5b){return BPromise[_0x7c74('0x32')](_0x26dc5b);}return _0xb5eab0[_0x7c74('0x33')]();};}function saveUpdates(_0x2521c8,_0x17aec0){return function(_0x3fe42f){if(_0x3fe42f){return _0x3fe42f[_0x7c74('0x34')](_0x2521c8)['then'](function(_0x4e8166){return _0x4e8166;});}return null;};}function removeEntity(_0x5f57b0,_0x6250f0){return function(_0x4504a3){if(_0x4504a3){return _0x4504a3[_0x7c74('0x35')]()[_0x7c74('0x1f')](function(){var _0x197488=_0x4504a3[_0x7c74('0x36')]({'plain':!![]});var _0x5dd134=_0x7c74('0x37');return db[_0x7c74('0x38')][_0x7c74('0x35')]({'where':{'type':_0x5dd134,'resourceId':_0x197488['id']}})['then'](function(){return _0x4504a3;});})[_0x7c74('0x1f')](function(){_0x5f57b0[_0x7c74('0x2a')](0xcc)[_0x7c74('0x2b')]();});}};}function handleEntityNotFound(_0x847c78,_0x2601fd){return function(_0x584120){if(!_0x584120){_0x847c78[_0x7c74('0x29')](0x194);}return _0x584120;};}function handleError(_0x15fc2f,_0x4597a9){_0x4597a9=_0x4597a9||0x1f4;return function(_0x4debbd){logger['error'](_0x4debbd['stack']);if(_0x4debbd[_0x7c74('0x39')]){delete _0x4debbd[_0x7c74('0x39')];}_0x15fc2f[_0x7c74('0x2a')](_0x4597a9)[_0x7c74('0x3a')](_0x4debbd);};}function getMustacheRender(_0x7439ee,_0xe2e040){return Mustache[_0x7c74('0x3b')](_0x7439ee,_[_0x7c74('0x3c')](_0xe2e040[_0x7c74('0x3d')],{'contact':_0xe2e040['contact'],'message':_0xe2e040[_0x7c74('0x25')],'agent':_0xe2e040[_0x7c74('0x3e')],'interaction':_0xe2e040[_0x7c74('0x3f')],'account':_0xe2e040[_0x7c74('0x40')]}))||'';}exports['index']=function(_0x329938,_0x464200){var _0x1da7f0={'include':[{'model':db[_0x7c74('0x41')],'as':_0x7c74('0x42')}]},_0x1a5416={},_0x25d7d3={'count':0x0,'rows':[]};var _0x35f119=_[_0x7c74('0x43')](db['OpenchannelAccount'][_0x7c74('0x44')],function(_0x20cc82){return{'name':_0x20cc82[_0x7c74('0x45')],'type':_0x20cc82[_0x7c74('0x46')][_0x7c74('0x47')]};});_0x1a5416[_0x7c74('0x48')]=_[_0x7c74('0x43')](_0x35f119,_0x7c74('0x39'));_0x1a5416[_0x7c74('0x49')]=_['keys'](_0x329938[_0x7c74('0x49')]);_0x1a5416[_0x7c74('0x4a')]=_[_0x7c74('0x4b')](_0x1a5416[_0x7c74('0x48')],_0x1a5416[_0x7c74('0x49')]);_0x1da7f0[_0x7c74('0x4c')]=_['intersection'](_0x1a5416[_0x7c74('0x48')],qs[_0x7c74('0x4d')](_0x329938[_0x7c74('0x49')][_0x7c74('0x4d')]));_0x1da7f0[_0x7c74('0x4c')]=_0x1da7f0['attributes'][_0x7c74('0x4e')]?_0x1da7f0[_0x7c74('0x4c')]:_0x1a5416[_0x7c74('0x48')];if(!_0x329938['query']['hasOwnProperty'](_0x7c74('0x4f'))){_0x1da7f0[_0x7c74('0x2f')]=qs[_0x7c74('0x2f')](_0x329938[_0x7c74('0x49')][_0x7c74('0x2f')]);_0x1da7f0['offset']=qs[_0x7c74('0x2c')](_0x329938[_0x7c74('0x49')][_0x7c74('0x2c')]);}_0x1da7f0['order']=qs[_0x7c74('0x50')](_0x329938[_0x7c74('0x49')]['sort']);_0x1da7f0[_0x7c74('0x51')]=qs[_0x7c74('0x4a')](_[_0x7c74('0x52')](_0x329938[_0x7c74('0x49')],_0x1a5416[_0x7c74('0x4a')]),_0x35f119);if(_0x329938[_0x7c74('0x49')][_0x7c74('0x53')]){_0x1da7f0[_0x7c74('0x51')]=_[_0x7c74('0x3c')](_0x1da7f0[_0x7c74('0x51')],{'$or':_['map'](_0x35f119,function(_0x24e14a){if(_0x24e14a[_0x7c74('0x46')]!==_0x7c74('0x54')){var _0x18eff4={};_0x18eff4[_0x24e14a[_0x7c74('0x39')]]={'$like':'%'+_0x329938[_0x7c74('0x49')][_0x7c74('0x53')]+'%'};return _0x18eff4;}})});}_0x1da7f0=_[_0x7c74('0x3c')]({},_0x1da7f0,_0x329938[_0x7c74('0x55')]);var _0x3b7527={'where':_0x1da7f0[_0x7c74('0x51')]};return db[_0x7c74('0x56')][_0x7c74('0x2e')](_0x3b7527)[_0x7c74('0x1f')](function(_0x2763cd){_0x25d7d3[_0x7c74('0x2e')]=_0x2763cd;if(_0x329938[_0x7c74('0x49')][_0x7c74('0x57')]){_0x1da7f0[_0x7c74('0x58')]=[{'all':!![]}];}return db[_0x7c74('0x56')][_0x7c74('0x59')](_0x1da7f0);})['then'](function(_0x536a82){_0x25d7d3['rows']=_0x536a82;return _0x25d7d3;})[_0x7c74('0x1f')](respondWithFilteredResult(_0x464200,_0x1da7f0))['catch'](handleError(_0x464200,null));};exports['show']=function(_0x5bced0,_0x208a0e){var _0x497b7e={'raw':![],'where':{'id':_0x5bced0['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x530e2e={};_0x530e2e[_0x7c74('0x48')]=_['keys'](db[_0x7c74('0x56')][_0x7c74('0x44')]);_0x530e2e[_0x7c74('0x49')]=_[_0x7c74('0x5a')](_0x5bced0[_0x7c74('0x49')]);_0x530e2e[_0x7c74('0x4a')]=_[_0x7c74('0x4b')](_0x530e2e['model'],_0x530e2e[_0x7c74('0x49')]);_0x497b7e[_0x7c74('0x4c')]=_[_0x7c74('0x4b')](_0x530e2e[_0x7c74('0x48')],qs['fields'](_0x5bced0['query'][_0x7c74('0x4d')]));_0x497b7e['attributes']=_0x497b7e[_0x7c74('0x4c')][_0x7c74('0x4e')]?_0x497b7e[_0x7c74('0x4c')]:_0x530e2e[_0x7c74('0x48')];if(_0x5bced0[_0x7c74('0x49')][_0x7c74('0x57')]){_0x497b7e[_0x7c74('0x58')]=[{'all':!![]}];}_0x497b7e=_['merge']({},_0x497b7e,_0x5bced0[_0x7c74('0x55')]);return db[_0x7c74('0x56')]['find'](_0x497b7e)['then'](handleEntityNotFound(_0x208a0e,null))[_0x7c74('0x1f')](respondWithResult(_0x208a0e,null))[_0x7c74('0x28')](handleError(_0x208a0e,null));};exports[_0x7c74('0x5b')]=function(_0x451c7d,_0x14024e){return db[_0x7c74('0x56')][_0x7c74('0x5b')](_0x451c7d[_0x7c74('0x3d')],{})[_0x7c74('0x1f')](function(_0x595b80){var _0x36e0d3=_0x451c7d['user'][_0x7c74('0x36')]({'plain':!![]});if(!_0x36e0d3)throw new Error(_0x7c74('0x5c'));if(_0x36e0d3[_0x7c74('0x5d')]===_0x7c74('0x5e')){var _0x5ad1db=_0x595b80[_0x7c74('0x36')]({'plain':!![]});var _0x2acbf4='OpenchannelAccounts';return db[_0x7c74('0x5f')][_0x7c74('0x60')]({'where':{'name':_0x2acbf4,'userProfileId':_0x36e0d3[_0x7c74('0x61')]},'raw':!![]})['then'](function(_0x564268){if(_0x564268&&_0x564268[_0x7c74('0x62')]===0x0){return db[_0x7c74('0x38')][_0x7c74('0x5b')]({'name':_0x5ad1db[_0x7c74('0x39')],'resourceId':_0x5ad1db['id'],'type':_0x564268[_0x7c74('0x39')],'sectionId':_0x564268['id']},{})[_0x7c74('0x1f')](function(){return _0x595b80;});}else{return _0x595b80;}})['catch'](function(_0x18e135){logger[_0x7c74('0x23')](_0x7c74('0x63'),_0x18e135);throw _0x18e135;});}return _0x595b80;})[_0x7c74('0x1f')](respondWithResult(_0x14024e,0xc9))[_0x7c74('0x28')](handleError(_0x14024e,null));};exports[_0x7c74('0x34')]=function(_0x40fcfc,_0x6f379a){if(_0x40fcfc[_0x7c74('0x3d')]['id']){delete _0x40fcfc[_0x7c74('0x3d')]['id'];}return db[_0x7c74('0x56')][_0x7c74('0x60')]({'where':{'id':_0x40fcfc[_0x7c74('0x64')]['id']},'include':[{'model':db[_0x7c74('0x41')],'as':_0x7c74('0x42')}]})['then'](handleEntityNotFound(_0x6f379a,null))['then'](saveUpdates(_0x40fcfc[_0x7c74('0x3d')],null))['then'](respondWithResult(_0x6f379a,null))['catch'](handleError(_0x6f379a,null));};exports[_0x7c74('0x35')]=function(_0x254f6c,_0x1bc057){return db[_0x7c74('0x56')][_0x7c74('0x60')]({'where':{'id':_0x254f6c[_0x7c74('0x64')]['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x1bc057,null))[_0x7c74('0x1f')](removeEntity(_0x1bc057,null))[_0x7c74('0x28')](handleError(_0x1bc057,null));};exports[_0x7c74('0x65')]=function(_0x287bd0,_0x18b350){return db['OpenchannelAccount'][_0x7c74('0x65')]()['then'](respondWithResult(_0x18b350,null))[_0x7c74('0x28')](handleError(_0x18b350,null));};exports[_0x7c74('0x66')]=function(_0x2c7a5d,_0x455fbf,_0x4e78ab){if(_0x2c7a5d[_0x7c74('0x3d')]['id']){delete _0x2c7a5d['body']['id'];}return db['OpenchannelAccount'][_0x7c74('0x60')]({'where':{'id':_0x2c7a5d[_0x7c74('0x64')]['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x455fbf,null))[_0x7c74('0x1f')](function(_0x29d7e8){if(_0x29d7e8){_0x2c7a5d[_0x7c74('0x3d')][_0x7c74('0x67')]=_0x29d7e8['id'];return db[_0x7c74('0x68')][_0x7c74('0x5b')](_0x2c7a5d[_0x7c74('0x3d')]);}})[_0x7c74('0x1f')](respondWithResult(_0x455fbf,null))[_0x7c74('0x28')](handleError(_0x455fbf,null));};exports[_0x7c74('0x69')]=function(_0x37d30b,_0x4109a2,_0xad7ed2){var _0x1646f0={'raw':![],'where':{}};var _0x50751c={};var _0x3feedd={'count':0x0,'rows':[]};return db[_0x7c74('0x56')][_0x7c74('0x6a')]({'where':{'id':_0x37d30b[_0x7c74('0x64')]['id']}})['then'](handleEntityNotFound(_0x4109a2,null))[_0x7c74('0x1f')](function(_0x570c45){if(_0x570c45){_0x50751c['model']=_['keys'](db[_0x7c74('0x68')]['rawAttributes']);_0x50751c[_0x7c74('0x49')]=_[_0x7c74('0x5a')](_0x37d30b[_0x7c74('0x49')]);_0x50751c['filters']=_[_0x7c74('0x4b')](_0x50751c[_0x7c74('0x48')],_0x50751c[_0x7c74('0x49')]);_0x1646f0[_0x7c74('0x4c')]=_[_0x7c74('0x4b')](_0x50751c[_0x7c74('0x48')],qs[_0x7c74('0x4d')](_0x37d30b[_0x7c74('0x49')][_0x7c74('0x4d')]));_0x1646f0[_0x7c74('0x4c')]=_0x1646f0['attributes'][_0x7c74('0x4e')]?_0x1646f0[_0x7c74('0x4c')]:_0x50751c['model'];if(!_0x37d30b['query'][_0x7c74('0x6b')](_0x7c74('0x4f'))){_0x1646f0['limit']=qs[_0x7c74('0x2f')](_0x37d30b['query'][_0x7c74('0x2f')]);_0x1646f0[_0x7c74('0x2c')]=qs[_0x7c74('0x2c')](_0x37d30b['query'][_0x7c74('0x2c')]);}_0x1646f0['order']=qs[_0x7c74('0x50')](_0x37d30b['query']['sort']);_0x1646f0[_0x7c74('0x51')]=qs['filters'](_[_0x7c74('0x52')](_0x37d30b[_0x7c74('0x49')],_0x50751c[_0x7c74('0x4a')]));_0x1646f0[_0x7c74('0x51')][_0x7c74('0x67')]=_0x570c45['id'];if(_0x37d30b[_0x7c74('0x49')]['filter']){_0x1646f0[_0x7c74('0x51')]=_[_0x7c74('0x3c')](_0x1646f0['where'],{'$or':_[_0x7c74('0x43')](_0x1646f0[_0x7c74('0x4c')],function(_0x1bcfd1){var _0x490254={};_0x490254[_0x1bcfd1]={'$like':'%'+_0x37d30b[_0x7c74('0x49')][_0x7c74('0x53')]+'%'};return _0x490254;})});}_0x1646f0=_[_0x7c74('0x3c')]({},_0x1646f0,_0x37d30b['options']);return db[_0x7c74('0x68')][_0x7c74('0x2e')]({'where':_0x1646f0[_0x7c74('0x51')]})[_0x7c74('0x1f')](function(_0x2f9293){_0x3feedd[_0x7c74('0x2e')]=_0x2f9293;if(_0x37d30b[_0x7c74('0x49')][_0x7c74('0x57')]){_0x1646f0['include']=[{'all':!![]}];}return db[_0x7c74('0x68')][_0x7c74('0x59')](_0x1646f0);})['then'](function(_0x3bfdfc){_0x3feedd[_0x7c74('0x6c')]=_0x3bfdfc;return _0x3feedd;});}})[_0x7c74('0x1f')](respondWithFilteredResult(_0x4109a2,_0x1646f0))['catch'](handleError(_0x4109a2,null));};exports[_0x7c74('0x6d')]=function(_0x134408,_0x5cb02f,_0x4ec342){return db['OpenchannelAccount'][_0x7c74('0x60')]({'where':{'id':_0x134408[_0x7c74('0x64')]['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x5cb02f,null))[_0x7c74('0x1f')](function(_0x5f426c){if(_0x5f426c){return _0x5f426c[_0x7c74('0x6d')](_0x134408[_0x7c74('0x49')][_0x7c74('0x6e')]);}})[_0x7c74('0x1f')](respondWithStatusCode(_0x5cb02f,null))[_0x7c74('0x28')](handleError(_0x5cb02f,null));};exports['addAnswer']=function(_0x2ad8ae,_0x170868,_0x4902d5){if(_0x2ad8ae[_0x7c74('0x3d')]['id']){delete _0x2ad8ae[_0x7c74('0x3d')]['id'];}return db[_0x7c74('0x56')][_0x7c74('0x60')]({'where':{'id':_0x2ad8ae[_0x7c74('0x64')]['id']}})['then'](handleEntityNotFound(_0x170868,null))[_0x7c74('0x1f')](function(_0x5e69bd){if(_0x5e69bd){_0x2ad8ae[_0x7c74('0x3d')][_0x7c74('0x67')]=_0x5e69bd['id'];return db[_0x7c74('0x6f')][_0x7c74('0x5b')](_0x2ad8ae[_0x7c74('0x3d')]);}})['then'](respondWithResult(_0x170868,null))[_0x7c74('0x28')](handleError(_0x170868,null));};exports[_0x7c74('0x70')]=function(_0x9b886d,_0x1e7c2f,_0x1eacc8){var _0x290e15={'raw':![],'where':{}};var _0x47594c={};var _0x416378={'count':0x0,'rows':[]};return db[_0x7c74('0x56')][_0x7c74('0x6a')]({'where':{'id':_0x9b886d[_0x7c74('0x64')]['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x1e7c2f,null))['then'](function(_0x18cc2a){if(_0x18cc2a){_0x47594c[_0x7c74('0x48')]=_[_0x7c74('0x5a')](db[_0x7c74('0x6f')][_0x7c74('0x44')]);_0x47594c['query']=_[_0x7c74('0x5a')](_0x9b886d[_0x7c74('0x49')]);_0x47594c[_0x7c74('0x4a')]=_[_0x7c74('0x4b')](_0x47594c[_0x7c74('0x48')],_0x47594c[_0x7c74('0x49')]);_0x290e15['attributes']=_['intersection'](_0x47594c[_0x7c74('0x48')],qs[_0x7c74('0x4d')](_0x9b886d['query'][_0x7c74('0x4d')]));_0x290e15[_0x7c74('0x4c')]=_0x290e15[_0x7c74('0x4c')]['length']?_0x290e15[_0x7c74('0x4c')]:_0x47594c[_0x7c74('0x48')];if(!_0x9b886d[_0x7c74('0x49')][_0x7c74('0x6b')](_0x7c74('0x4f'))){_0x290e15[_0x7c74('0x2f')]=qs[_0x7c74('0x2f')](_0x9b886d[_0x7c74('0x49')][_0x7c74('0x2f')]);_0x290e15[_0x7c74('0x2c')]=qs[_0x7c74('0x2c')](_0x9b886d[_0x7c74('0x49')]['offset']);}_0x290e15[_0x7c74('0x71')]=qs[_0x7c74('0x50')](_0x9b886d['query']['sort']);_0x290e15['where']=qs[_0x7c74('0x4a')](_[_0x7c74('0x52')](_0x9b886d['query'],_0x47594c[_0x7c74('0x4a')]));_0x290e15['where'][_0x7c74('0x67')]=_0x18cc2a['id'];if(_0x9b886d['query'][_0x7c74('0x53')]){_0x290e15[_0x7c74('0x51')]=_[_0x7c74('0x3c')](_0x290e15[_0x7c74('0x51')],{'$or':_[_0x7c74('0x43')](_0x290e15['attributes'],function(_0x202971){var _0x311b9a={};_0x311b9a[_0x202971]={'$like':'%'+_0x9b886d[_0x7c74('0x49')]['filter']+'%'};return _0x311b9a;})});}_0x290e15=_[_0x7c74('0x3c')]({},_0x290e15,_0x9b886d[_0x7c74('0x55')]);return db[_0x7c74('0x6f')][_0x7c74('0x2e')]({'where':_0x290e15[_0x7c74('0x51')]})['then'](function(_0x4b1237){_0x416378[_0x7c74('0x2e')]=_0x4b1237;if(_0x9b886d['query'][_0x7c74('0x57')]){_0x290e15[_0x7c74('0x58')]=[{'all':!![]}];}return db[_0x7c74('0x6f')]['findAll'](_0x290e15);})[_0x7c74('0x1f')](function(_0x1138fa){_0x416378[_0x7c74('0x6c')]=_0x1138fa;return _0x416378;});}})['then'](respondWithFilteredResult(_0x1e7c2f,_0x290e15))[_0x7c74('0x28')](handleError(_0x1e7c2f,null));};exports['removeAnswers']=function(_0x5f1601,_0x4559bd,_0x424c97){return db[_0x7c74('0x56')]['find']({'where':{'id':_0x5f1601[_0x7c74('0x64')]['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x4559bd,null))[_0x7c74('0x1f')](function(_0x235059){if(_0x235059){return _0x235059['removeAnswers'](_0x5f1601['query'][_0x7c74('0x6e')]);}})[_0x7c74('0x1f')](respondWithStatusCode(_0x4559bd,null))[_0x7c74('0x28')](handleError(_0x4559bd,null));};exports[_0x7c74('0x72')]=function(_0x53bf5b,_0xf74f7,_0x3f5aa7){var _0x18a7e4={'body':_0x53bf5b[_0x7c74('0x3d')],'channel':_0x7c74('0x73')};var _0x591532=[];var _0x55b18c=[];var _0x5ba128={};var _0x10da08=![];return db[_0x7c74('0x74')][_0x7c74('0x65')]()[_0x7c74('0x1f')](function(_0x5dfec1){if(!_0x5dfec1){throw new db[(_0x7c74('0x75'))][(_0x7c74('0x76'))](_0x7c74('0x77'));}_0x591532=_[_0x7c74('0x78')](_[_0x7c74('0x5a')](_0x5dfec1),['createdAt',_0x7c74('0x79')]);_0x55b18c=_['difference'](_['keys'](_0x5dfec1),[_0x7c74('0x7a'),_0x7c74('0x79'),_0x7c74('0x7b'),_0x7c74('0x7c')]);if(_0x53bf5b[_0x7c74('0x3d')]['id']){delete _0x53bf5b[_0x7c74('0x3d')]['id'];}if(_['isNil'](_0x53bf5b['body'][_0x7c74('0x7d')])){throw new db[(_0x7c74('0x75'))][(_0x7c74('0x76'))](_0x7c74('0x7e'));}if(_[_0x7c74('0x7f')](_0x53bf5b[_0x7c74('0x3d')]['body'])||_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x3d')]===''){throw new db['Sequelize'][(_0x7c74('0x76'))](_0x7c74('0x80'));}if(_[_0x7c74('0x7f')](_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x81')])){throw new db['Sequelize']['ValidationError'](_0x7c74('0x82')+_0x55b18c);}if(!_[_0x7c74('0x83')](_0x55b18c,_0x53bf5b[_0x7c74('0x3d')]['mapKey'])){throw new db[(_0x7c74('0x75'))][(_0x7c74('0x76'))](_0x7c74('0x84')+_0x55b18c);}_0x5ba128[_0x53bf5b['body'][_0x7c74('0x81')]]=_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x7d')];})['then'](function(){return db[_0x7c74('0x56')][_0x7c74('0x60')]({'where':{'id':_0x53bf5b['params']['id']},'include':[{'model':db['CmList'],'as':_0x7c74('0x85'),'include':[{'model':db[_0x7c74('0x74')],'as':_0x7c74('0x86'),'where':_0x5ba128,'limit':0x1,'order':[['updatedAt',_0x7c74('0x87')]]}]},{'model':db[_0x7c74('0x88')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0xf74f7,null))[_0x7c74('0x1f')](function(_0x363e41){if(_0x363e41&&_0x363e41[_0x7c74('0x85')]){_0x18a7e4[_0x7c74('0x40')]=_0x363e41;_0x18a7e4['applications']=_0x363e41[_0x7c74('0x89')];_0x18a7e4['list']=_0x363e41[_0x7c74('0x85')];_0x18a7e4[_0x7c74('0x8a')]=_[_0x7c74('0x8b')](_0x18a7e4[_0x7c74('0x8a')],[_0x7c74('0x8c')],['asc']);if(_0x18a7e4[_0x7c74('0x40')][_0x7c74('0x89')]){delete _0x18a7e4['account'][_0x7c74('0x89')];}if(_0x18a7e4['account'][_0x7c74('0x85')]&&_0x18a7e4[_0x7c74('0x40')]['List'][_0x7c74('0x86')][_0x7c74('0x4e')]){return _0x18a7e4[_0x7c74('0x40')][_0x7c74('0x85')]['Contacts'][0x0];}var _0x4aad62=_[_0x7c74('0x8d')](_0x53bf5b[_0x7c74('0x3d')],{'firstName':_0x53bf5b['body'][_0x7c74('0x7d')],'ListId':_0x363e41['ListId']});_0x4aad62[_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x81')]]=_0x53bf5b[_0x7c74('0x3d')]['from'];return db['CmContact'][_0x7c74('0x5b')](_0x4aad62,{'fields':_0x591532,'raw':!![]});}})[_0x7c74('0x1f')](handleEntityNotFound(_0xf74f7,null))[_0x7c74('0x1f')](function(_0x10d222){_0x18a7e4[_0x7c74('0x8e')]=_0x10d222;if(_0x10d222){var _0x26b9a0={'ContactId':_0x10d222['id'],'OpenchannelAccountId':_0x53bf5b[_0x7c74('0x64')]['id'],'from':(_0x10d222[_0x7c74('0x8f')]||'')+'\x20'+(_0x10d222[_0x7c74('0x90')]||'')};var _0x6ab259={'OpenchannelAccountId':_0x53bf5b[_0x7c74('0x64')]['id'],'closed':![]};if(_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x91')]){_0x6ab259[_0x7c74('0x91')]=_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x91')];return db[_0x7c74('0x92')]['find']({'where':_0x6ab259})['then'](function(_0x4e1910){if(_0x4e1910){return[_0x4e1910,![]];}_0x26b9a0[_0x7c74('0x91')]=_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x91')];_0x26b9a0[_0x7c74('0x93')]=_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x93')];return db[_0x7c74('0x92')]['create'](_0x26b9a0)['then'](function(_0x25fb17){return[_0x25fb17,!![]];});});}else{_0x6ab259['threadId']=null;}_0x6ab259[_0x7c74('0x94')]=_0x10d222['id'];return db[_0x7c74('0x92')]['find']({'where':_0x6ab259})[_0x7c74('0x1f')](function(_0x22d4e0){if(_0x22d4e0){return[_0x22d4e0,![]];}return db[_0x7c74('0x92')][_0x7c74('0x5b')](_0x26b9a0)[_0x7c74('0x1f')](function(_0x1632fd){return[_0x1632fd,!![]];});});}})['spread'](function(_0x379952,_0x9e7e6e){if(_0x379952){_0x10da08=_0x9e7e6e;if(!_0x9e7e6e){var _0x1b8805={'from':(_0x18a7e4[_0x7c74('0x8e')][_0x7c74('0x8f')]||'')+'\x20'+(_0x18a7e4[_0x7c74('0x8e')][_0x7c74('0x90')]||'')};if(_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x91')]&&_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x95')]&&_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x91')]!=_0x53bf5b['body'][_0x7c74('0x95')]){_0x1b8805[_0x7c74('0x91')]=_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x95')];}return _0x379952['update'](_0x1b8805);}else{return _0x379952;}}})[_0x7c74('0x1f')](function(_0x17c893){_0x18a7e4[_0x7c74('0x3f')]=_0x17c893[_0x7c74('0x36')]({'plain':!![]});_0x18a7e4[_0x7c74('0x3f')][_0x7c74('0x96')]=_0x10da08;if(_0x18a7e4[_0x7c74('0x3f')]['created']){if(_0x18a7e4[_0x7c74('0x40')][_0x7c74('0x97')]){_0x18a7e4['applications'][_0x7c74('0x98')]({'id':0x0,'priority':_0x18a7e4[_0x7c74('0x8a')][_0x7c74('0x4e')]+0x1,'app':'close','appdata':_0x7c74('0x99'),'interval':_0x7c74('0x9a')});}}return db['OpenchannelMessage'][_0x7c74('0x5b')]({'body':_0x53bf5b['body'][_0x7c74('0x3d')],'OpenchannelAccountId':_0x53bf5b[_0x7c74('0x64')]['id'],'OpenchannelInteractionId':_0x17c893['id'],'direction':'in','ContactId':_0x18a7e4[_0x7c74('0x8e')]['id'],'AttachmentId':_0x53bf5b[_0x7c74('0x3d')][_0x7c74('0x9b')]});})[_0x7c74('0x1f')](function(_0x1b8609){_0x18a7e4[_0x7c74('0x25')]=_0x1b8609;if(_0x18a7e4[_0x7c74('0x3f')]['UserId']){return db['User'][_0x7c74('0x60')]({'attributes':['id','name'],'where':{'id':_0x18a7e4[_0x7c74('0x3f')][_0x7c74('0x9c')]}})[_0x7c74('0x1f')](function(_0x6a4e04){if(_0x6a4e04){_0x18a7e4[_0x7c74('0x8a')][_0x7c74('0x9d')]({'id':0x0,'priority':0x0,'app':_0x7c74('0x3e'),'appdata':_0x6a4e04[_0x7c74('0x39')]+','+(_0x18a7e4[_0x7c74('0x40')][_0x7c74('0x9e')]||0xa),'interval':'*,*,*,*'});_0x18a7e4['forcedOwnership']=![];}return respondWithRpcPromise(_0x7c74('0x9f'),_0x7c74('0xa0'),_0x18a7e4);});}return respondWithRpcPromise(_0x7c74('0x9f'),'startRouting',_0x18a7e4);})[_0x7c74('0x1f')](function(_0x23a6e4){respondWithRpcPromise('EventManager','EventManager',{'event':_0x7c74('0x72'),'message':_0x23a6e4},client9002);return _0x23a6e4;})[_0x7c74('0x1f')](respondWithResult(_0xf74f7,null))['catch'](handleError(_0xf74f7,null));};exports['addApplications']=function(_0x27f21c,_0x43bd2c,_0x9bdf7b){return db['OpenchannelAccount'][_0x7c74('0x6a')]({'where':{'id':_0x27f21c['params']['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x43bd2c,null))[_0x7c74('0x1f')](function(_0x27e758){if(_0x27e758){return db[_0x7c74('0xa1')]['transaction'](function(_0x5a2ef9){return db[_0x7c74('0x88')][_0x7c74('0x35')]({'where':{'OpenchannelAccountId':_0x27f21c['params']['id']},'transaction':_0x5a2ef9})['then'](function(_0x388c27){var _0x3f448c=_['map'](_0x27f21c[_0x7c74('0x3d')],function(_0x4f57cc){_0x4f57cc[_0x7c74('0x67')]=_0x27f21c[_0x7c74('0x64')]['id'];return _0x4f57cc;});return db[_0x7c74('0x88')]['bulkCreate'](_0x3f448c,{'transaction':_0x5a2ef9});});})[_0x7c74('0x1f')](function(){return db[_0x7c74('0x88')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x27f21c[_0x7c74('0x64')]['id']},'order':_0x7c74('0x8c')});});}})[_0x7c74('0x1f')](respondWithResult(_0x43bd2c,null))[_0x7c74('0x28')](handleError(_0x43bd2c,null));};exports[_0x7c74('0xa2')]=function(_0x4883b7,_0x370124,_0x2a8906){var _0x42feac={};var _0x19cd8e={};var _0x44e024;var _0x27af58;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4883b7[_0x7c74('0x64')]['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x370124,null))[_0x7c74('0x1f')](function(_0x3bffa1){if(_0x3bffa1){_0x44e024=_0x3bffa1;_0x19cd8e['model']=_[_0x7c74('0x5a')](db[_0x7c74('0x88')][_0x7c74('0x44')]);_0x19cd8e[_0x7c74('0x49')]=_[_0x7c74('0x5a')](_0x4883b7['query']);_0x19cd8e[_0x7c74('0x4a')]=_[_0x7c74('0x4b')](_0x19cd8e[_0x7c74('0x48')],_0x19cd8e['query']);_0x42feac[_0x7c74('0x4c')]=_[_0x7c74('0x4b')](_0x19cd8e['model'],qs['fields'](_0x4883b7['query'][_0x7c74('0x4d')]));_0x42feac[_0x7c74('0x4c')]=_0x42feac[_0x7c74('0x4c')]['length']?_0x42feac[_0x7c74('0x4c')]:_0x19cd8e[_0x7c74('0x48')];_0x42feac['order']=qs[_0x7c74('0x50')](_0x4883b7[_0x7c74('0x49')]['sort']);_0x42feac[_0x7c74('0x51')]=qs[_0x7c74('0x4a')](_[_0x7c74('0x52')](_0x4883b7[_0x7c74('0x49')],_0x19cd8e[_0x7c74('0x4a')]));if(_0x4883b7[_0x7c74('0x49')][_0x7c74('0x53')]){_0x42feac[_0x7c74('0x51')]=_['merge'](_0x42feac[_0x7c74('0x51')],{'$or':_['map'](_0x42feac['attributes'],function(_0x1e2e2f){var _0x22d036={};_0x22d036[_0x1e2e2f]={'$like':'%'+_0x4883b7[_0x7c74('0x49')]['filter']+'%'};return _0x22d036;})});}_0x42feac=_['merge']({},_0x42feac,_0x4883b7[_0x7c74('0x55')]);return _0x44e024[_0x7c74('0xa2')](_0x42feac);}})[_0x7c74('0x1f')](function(_0x5a99de){if(_0x5a99de){_0x27af58=_0x5a99de[_0x7c74('0x4e')];if(!_0x4883b7[_0x7c74('0x49')][_0x7c74('0x6b')](_0x7c74('0x4f'))){_0x42feac[_0x7c74('0x2f')]=qs[_0x7c74('0x2f')](_0x4883b7[_0x7c74('0x49')][_0x7c74('0x2f')]);_0x42feac['offset']=qs[_0x7c74('0x2c')](_0x4883b7[_0x7c74('0x49')][_0x7c74('0x2c')]);}return _0x44e024[_0x7c74('0xa2')](_0x42feac);}})['then'](function(_0x1caa55){if(_0x1caa55){return _0x1caa55?{'count':_0x27af58,'rows':_0x1caa55}:null;}})['then'](respondWithResult(_0x370124,null))[_0x7c74('0x28')](handleError(_0x370124,null));};exports[_0x7c74('0xa3')]=function(_0xabc09a,_0x3b3b62,_0x33edd9){var _0x4774f7={'raw':![],'where':{}};var _0x42ea86={};var _0x1459e8={'count':0x0,'rows':[]};return db[_0x7c74('0x56')]['findOne']({'where':{'id':_0xabc09a['params']['id']}})['then'](handleEntityNotFound(_0x3b3b62,null))[_0x7c74('0x1f')](function(_0x321ccd){if(_0x321ccd){_0x42ea86[_0x7c74('0x48')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x42ea86['query']=_[_0x7c74('0x5a')](_0xabc09a['query']);_0x42ea86[_0x7c74('0x4a')]=_[_0x7c74('0x4b')](_0x42ea86[_0x7c74('0x48')],_0x42ea86['query']);_0x4774f7[_0x7c74('0x4c')]=_['intersection'](_0x42ea86[_0x7c74('0x48')],qs[_0x7c74('0x4d')](_0xabc09a['query']['fields']));_0x4774f7[_0x7c74('0x4c')]=_0x4774f7[_0x7c74('0x4c')][_0x7c74('0x4e')]?_0x4774f7[_0x7c74('0x4c')]:_0x42ea86[_0x7c74('0x48')];if(!_0xabc09a[_0x7c74('0x49')][_0x7c74('0x6b')](_0x7c74('0x4f'))){_0x4774f7[_0x7c74('0x2f')]=qs['limit'](_0xabc09a['query'][_0x7c74('0x2f')]);_0x4774f7[_0x7c74('0x2c')]=qs[_0x7c74('0x2c')](_0xabc09a[_0x7c74('0x49')][_0x7c74('0x2c')]);}_0x4774f7['order']=qs[_0x7c74('0x50')](_0xabc09a['query'][_0x7c74('0x50')]);_0x4774f7[_0x7c74('0x51')]=qs[_0x7c74('0x4a')](_[_0x7c74('0x52')](_0xabc09a[_0x7c74('0x49')],_0x42ea86[_0x7c74('0x4a')]));_0x4774f7['where']['OpenchannelAccountId']=_0x321ccd['id'];if(_0xabc09a['query'][_0x7c74('0x53')]){_0x4774f7['where']=_[_0x7c74('0x3c')](_0x4774f7['where'],{'$or':_[_0x7c74('0x43')](_0x4774f7['attributes'],function(_0x4f1424){var _0x1ecf55={};_0x1ecf55[_0x4f1424]={'$like':'%'+_0xabc09a[_0x7c74('0x49')][_0x7c74('0x53')]+'%'};return _0x1ecf55;})});}_0x4774f7=_[_0x7c74('0x3c')]({},_0x4774f7,_0xabc09a[_0x7c74('0x55')]);return db[_0x7c74('0x92')][_0x7c74('0x2e')]({'where':_0x4774f7[_0x7c74('0x51')]})[_0x7c74('0x1f')](function(_0x3e4111){_0x1459e8['count']=_0x3e4111;if(_0xabc09a[_0x7c74('0x49')]['includeAll']){_0x4774f7[_0x7c74('0x58')]=[{'model':db[_0x7c74('0x74')],'as':_0x7c74('0xa4'),'required':![]},{'model':db[_0x7c74('0xa5')],'as':_0x7c74('0xa6'),'attributes':[_0x7c74('0x39'),_0x7c74('0xa7'),'internal'],'required':![]},{'model':db[_0x7c74('0xa8')],'as':_0x7c74('0xa9'),'attributes':['id',_0x7c74('0x39'),_0x7c74('0xaa')],'where':_0xabc09a['query']['tag']?{'id':_0xabc09a[_0x7c74('0x49')][_0x7c74('0xab')]}:undefined,'required':_0xabc09a['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x7c74('0x59')](_0x4774f7);})[_0x7c74('0x1f')](function(_0x508477){_0x1459e8[_0x7c74('0x6c')]=_0x508477;return _0x1459e8;});}})[_0x7c74('0x1f')](respondWithFilteredResult(_0x3b3b62,_0x4774f7))['catch'](handleError(_0x3b3b62,null));};exports['addAgents']=function(_0x574665,_0x2233f0,_0x2416ac){return db[_0x7c74('0x56')][_0x7c74('0x60')]({'where':{'id':_0x574665['params']['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x2233f0,null))[_0x7c74('0x1f')](function(_0x2a1f20){if(_0x2a1f20){return _0x2a1f20[_0x7c74('0xac')](_0x574665[_0x7c74('0x3d')]['ids'],_['omit'](_0x574665[_0x7c74('0x3d')],[_0x7c74('0x6e'),'id'])||{})[_0x7c74('0xad')](function(_0x25dad5){for(var _0x560bb9=0x0;_0x560bb9<_0x574665[_0x7c74('0x3d')][_0x7c74('0x6e')][_0x7c74('0x4e')];_0x560bb9+=0x1){socket[_0x7c74('0xae')]('userOpenchannelAccount:save',{'UserId':_0x574665[_0x7c74('0x3d')]['ids'][_0x560bb9],'OpenchannelAccountId':_0x574665[_0x7c74('0x64')]['id']});}return _0x25dad5;});}})[_0x7c74('0x1f')](respondWithResult(_0x2233f0,null))[_0x7c74('0x28')](handleError(_0x2233f0,null));};exports['removeAgents']=function(_0x274bfb,_0x55de4c,_0x503a5f){return db['OpenchannelAccount'][_0x7c74('0x60')]({'where':{'id':_0x274bfb['params']['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x55de4c,null))[_0x7c74('0x1f')](function(_0xe7d652){if(_0xe7d652){return _0xe7d652[_0x7c74('0xaf')](_0x274bfb[_0x7c74('0x49')][_0x7c74('0x6e')])['then'](function(){if(_[_0x7c74('0xb0')](_0x274bfb[_0x7c74('0x49')][_0x7c74('0x6e')])){for(var _0x21300a=0x0;_0x21300a<_0x274bfb[_0x7c74('0x49')][_0x7c74('0x6e')][_0x7c74('0x4e')];_0x21300a+=0x1){socket['emit'](_0x7c74('0xb1'),{'UserId':Number(_0x274bfb[_0x7c74('0x49')]['ids'][_0x21300a]),'OpenchannelAccountId':Number(_0x274bfb['params']['id'])});}}else{socket[_0x7c74('0xae')](_0x7c74('0xb1'),{'UserId':Number(_0x274bfb[_0x7c74('0x49')][_0x7c74('0x6e')]),'OpenchannelAccountId':Number(_0x274bfb[_0x7c74('0x64')]['id'])});}});}})[_0x7c74('0x1f')](respondWithStatusCode(_0x55de4c,null))[_0x7c74('0x28')](handleError(_0x55de4c,null));};exports['getAgents']=function(_0x2d357e,_0x1bd299,_0x286b4d){var _0xfa18e8={};var _0x2dfb2d={};var _0x589937;var _0x547175;return db[_0x7c74('0x56')]['findOne']({'where':{'id':_0x2d357e[_0x7c74('0x64')]['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x1bd299,null))['then'](function(_0x202169){if(_0x202169){_0x589937=_0x202169;_0x2dfb2d['model']=_[_0x7c74('0x5a')](db['User'][_0x7c74('0x44')]);_0x2dfb2d[_0x7c74('0x49')]=_[_0x7c74('0x5a')](_0x2d357e['query']);_0x2dfb2d[_0x7c74('0x4a')]=_[_0x7c74('0x4b')](_0x2dfb2d[_0x7c74('0x48')],_0x2dfb2d[_0x7c74('0x49')]);_0xfa18e8[_0x7c74('0x4c')]=_['intersection'](_0x2dfb2d[_0x7c74('0x48')],qs[_0x7c74('0x4d')](_0x2d357e[_0x7c74('0x49')][_0x7c74('0x4d')]));_0xfa18e8['attributes']=_0xfa18e8['attributes']['length']?_0xfa18e8[_0x7c74('0x4c')]:_0x2dfb2d[_0x7c74('0x48')];_0xfa18e8[_0x7c74('0x71')]=qs[_0x7c74('0x50')](_0x2d357e[_0x7c74('0x49')][_0x7c74('0x50')]);_0xfa18e8[_0x7c74('0x51')]=qs[_0x7c74('0x4a')](_[_0x7c74('0x52')](_0x2d357e[_0x7c74('0x49')],_0x2dfb2d['filters']));if(_0x2d357e[_0x7c74('0x49')][_0x7c74('0x53')]){_0xfa18e8[_0x7c74('0x51')]=_[_0x7c74('0x3c')](_0xfa18e8[_0x7c74('0x51')],{'$or':_[_0x7c74('0x43')](_0xfa18e8[_0x7c74('0x4c')],function(_0x53410e){var _0x16c1d5={};_0x16c1d5[_0x53410e]={'$like':'%'+_0x2d357e['query']['filter']+'%'};return _0x16c1d5;})});}_0xfa18e8=_[_0x7c74('0x3c')]({},_0xfa18e8,_0x2d357e['options']);return _0x589937[_0x7c74('0xb2')](_0xfa18e8);}})[_0x7c74('0x1f')](function(_0x3d88d7){if(_0x3d88d7){_0x547175=_0x3d88d7[_0x7c74('0x4e')];if(!_0x2d357e[_0x7c74('0x49')]['hasOwnProperty'](_0x7c74('0x4f'))){_0xfa18e8[_0x7c74('0x2f')]=qs[_0x7c74('0x2f')](_0x2d357e[_0x7c74('0x49')][_0x7c74('0x2f')]);_0xfa18e8[_0x7c74('0x2c')]=qs[_0x7c74('0x2c')](_0x2d357e[_0x7c74('0x49')][_0x7c74('0x2c')]);}return _0x589937['getAgents'](_0xfa18e8);}})[_0x7c74('0x1f')](function(_0x529bbc){if(_0x529bbc){return _0x529bbc?{'count':_0x547175,'rows':_0x529bbc}:null;}})[_0x7c74('0x1f')](respondWithResult(_0x1bd299,null))[_0x7c74('0x28')](handleError(_0x1bd299,null));};exports[_0x7c74('0x3a')]=function(_0x36d7b6,_0x25efda,_0x1e0737){var _0x1109a9,_0x82e385,_0x58a22f;if(_[_0x7c74('0x7f')](_0x36d7b6[_0x7c74('0x3d')][_0x7c74('0x3d')])||_0x36d7b6[_0x7c74('0x3d')]['body']===''){throw new db[(_0x7c74('0x75'))][(_0x7c74('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7c74('0x7f')](_0x36d7b6['body']['to'])){}_0x1109a9=_0x36d7b6[_0x7c74('0x3d')]['to'];return db[_0x7c74('0x56')]['findOne']({'where':{'id':_0x36d7b6[_0x7c74('0x64')]['id']}})[_0x7c74('0x1f')](handleEntityNotFound(_0x25efda,null))['then'](function(_0x32ba18){if(_0x32ba18){return db[_0x7c74('0x56')]['find']({'where':{'id':_0x32ba18['id']},'include':[{'model':db[_0x7c74('0xb3')],'as':'List','include':[{'model':db[_0x7c74('0x74')],'as':_0x7c74('0x86'),'where':{[_0x32ba18['mapKey']]:_0x1109a9},'limit':0x1,'order':[['updatedAt',_0x7c74('0x87')]]}]}]})['then'](handleEntityNotFound(_0x25efda,null))[_0x7c74('0x1f')](function(_0x3c5016){if(_0x3c5016&&_0x3c5016['List']){_0x82e385=_0x3c5016['get']({'plain':!![]});if(_0x82e385[_0x7c74('0x85')]&&_0x82e385[_0x7c74('0x85')]['Contacts']['length']){return _0x82e385[_0x7c74('0x85')][_0x7c74('0x86')][0x0];}return db[_0x7c74('0x74')][_0x7c74('0x5b')](_[_0x7c74('0x8d')](_0x36d7b6[_0x7c74('0x3d')],{'firstName':_0x1109a9,[_0x3c5016[_0x7c74('0x81')]]:_0x1109a9,'phone':_0x1109a9,'ListId':_0x82e385['ListId']}));}})[_0x7c74('0x1f')](handleEntityNotFound(_0x25efda,null))[_0x7c74('0x1f')](function(_0x500f12){if(_0x500f12){_0x58a22f=_0x500f12;return db[_0x7c74('0x92')][_0x7c74('0x60')]({'where':{'ContactId':_0x58a22f['id'],'closed':![],'OpenchannelAccountId':_0x82e385['id']}})['then'](function(_0x252e95){if(_0x252e95){return[_0x252e95,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x36d7b6[_0x7c74('0x5e')]['id'],'ContactId':_0x58a22f['id'],'OpenchannelAccountId':_0x82e385['id'],'lastMsgDirection':_0x7c74('0xb4'),'Messages':[_[_0x7c74('0x3c')](_0x36d7b6[_0x7c74('0x3d')],{'read':![],'body':_0x36d7b6[_0x7c74('0x3d')][_0x7c74('0x3d')],'OpenchannelAccountId':_0x82e385['id'],'UserId':_0x36d7b6[_0x7c74('0x5e')]['id'],'ContactId':_0x58a22f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x7c74('0x1f')](function(_0x404f0a){return[_0x404f0a,!![]];});});}})[_0x7c74('0xad')](function(_0x7978de,_0x366c9b){if(_0x366c9b){return _0x7978de;}return db['OpenchannelMessage'][_0x7c74('0x5b')](_[_0x7c74('0x3c')](_0x36d7b6[_0x7c74('0x3d')],{'read':![],'body':_0x36d7b6['body']['body'],'OpenchannelAccountId':_0x82e385['id'],'OpenchannelInteractionId':_0x7978de['id'],'UserId':_0x36d7b6[_0x7c74('0x5e')]['id'],'ContactId':_0x58a22f['id']}))['then'](function(_0x7883f2){_0x7978de[_0x7c74('0xb5')][_0x7c74('0xb6')]=[];_0x7978de[_0x7c74('0xb5')]['Messages'][_0x7c74('0x98')](_0x7883f2[_0x7c74('0xb5')]);return _0x7978de;});});}})['then'](respondWithResult(_0x25efda,null))[_0x7c74('0x28')](handleError(_0x25efda,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index bb86952..c61b156 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 _0x6077=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3644e0,_0x27e1de){var _0x3979bd=function(_0x12b745){while(--_0x12b745){_0x3644e0['push'](_0x3644e0['shift']());}};_0x3979bd(++_0x27e1de);}(_0x6077,0x134));var _0x7607=function(_0x2ae30b,_0x50f7d6){_0x2ae30b=_0x2ae30b-0x0;var _0x489fcb=_0x6077[_0x2ae30b];return _0x489fcb;};'use strict';var EventEmitter=require(_0x7607('0x0'));var OpenchannelAccount=require(_0x7607('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7607('0x2')](0x0);var events={'afterCreate':_0x7607('0x3'),'afterUpdate':_0x7607('0x4'),'afterDestroy':_0x7607('0x5')};function emitEvent(_0x12b81a){return function(_0x4129ee,_0xab819a,_0x6d2956){OpenchannelAccountEvents[_0x7607('0x6')](_0x12b81a+':'+_0x4129ee['id'],_0x4129ee);OpenchannelAccountEvents[_0x7607('0x6')](_0x12b81a,_0x4129ee);_0x6d2956(null);};}for(var e in events){if(events[_0x7607('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x7607('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xbf4d=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xbf4d,0x153));var _0xdbf4=function(_0x47fd17,_0x4f7037){_0x47fd17=_0x47fd17-0x0;var _0x353a4b=_0xbf4d[_0x47fd17];return _0x353a4b;};'use strict';var EventEmitter=require(_0xdbf4('0x0'));var OpenchannelAccount=require(_0xdbf4('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdbf4('0x2'),'afterUpdate':_0xdbf4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f711c){return function(_0x4b3d9b,_0x3cdff4,_0x431ef3){OpenchannelAccountEvents[_0xdbf4('0x4')](_0x2f711c+':'+_0x4b3d9b['id'],_0x4b3d9b);OpenchannelAccountEvents[_0xdbf4('0x4')](_0x2f711c,_0x4b3d9b);_0x431ef3(null);};}for(var e in events){if(events[_0xdbf4('0x5')](e)){var event=events[e];OpenchannelAccount[_0xdbf4('0x6')](e,emitEvent(event));}}module[_0xdbf4('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 5f8ce00..f925de6 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 _0x5498=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./openchannelAccount.attributes','define','OpenchannelAccount','openchannel_accounts'];(function(_0x40197b,_0x4e763f){var _0x3b9c2f=function(_0x41c34f){while(--_0x41c34f){_0x40197b['push'](_0x40197b['shift']());}};_0x3b9c2f(++_0x4e763f);}(_0x5498,0x181));var _0x8549=function(_0x45a472,_0x54e59b){_0x45a472=_0x45a472-0x0;var _0x437e19=_0x5498[_0x45a472];return _0x437e19;};'use strict';var _=require(_0x8549('0x0'));var util=require(_0x8549('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8549('0x2'));var BPromise=require(_0x8549('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8549('0x4'));var rimraf=require(_0x8549('0x5'));var config=require(_0x8549('0x6'));var attributes=require(_0x8549('0x7'));module['exports']=function(_0x184951,_0x8f2aa2){return _0x184951[_0x8549('0x8')](_0x8549('0x9'),attributes,{'tableName':_0x8549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x683d=['bluebird','request-promise','rimraf','../../config/environment','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x683d,0x19f));var _0xd683=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x683d[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0xd683('0x0'));var util=require(_0xd683('0x1'));var logger=require(_0xd683('0x2'))(_0xd683('0x3'));var moment=require(_0xd683('0x4'));var BPromise=require(_0xd683('0x5'));var rp=require(_0xd683('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd683('0x7'));var config=require(_0xd683('0x8'));var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x21bff7,_0x1dd63d){return _0x21bff7[_0xd683('0x9')](_0xd683('0xa'),attributes,{'tableName':_0xd683('0xb'),'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 a3f2104..aadeb26 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 _0x3287=['request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register'];(function(_0x51f4a0,_0x450701){var _0x342bcc=function(_0x1ed3c0){while(--_0x1ed3c0){_0x51f4a0['push'](_0x51f4a0['shift']());}};_0x342bcc(++_0x450701);}(_0x3287,0x6e));var _0x7328=function(_0x11a186,_0x47c511){_0x11a186=_0x11a186-0x0;var _0x411316=_0x3287[_0x11a186];return _0x411316;};'use strict';var _=require(_0x7328('0x0'));var util=require(_0x7328('0x1'));var moment=require(_0x7328('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7328('0x3'))['db'];var utils=require(_0x7328('0x4'));var logger=require(_0x7328('0x5'))(_0x7328('0x6'));var config=require(_0x7328('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7328('0x8')][_0x7328('0x9')]({'port':0x232a});config[_0x7328('0xa')]=_[_0x7328('0xb')](config[_0x7328('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7328('0xc'))(new Redis(config[_0x7328('0xa')]));require(_0x7328('0xd'))[_0x7328('0xe')](socket);function respondWithRpcPromise(_0xb6b454,_0x2cd25b,_0x342dec){return new BPromise(function(_0x10e11e,_0x5df050){return client[_0x7328('0xf')](_0xb6b454,_0x342dec)[_0x7328('0x10')](function(_0x592b6f){logger['info'](_0x7328('0x11'),_0x2cd25b,_0x7328('0x12'));logger[_0x7328('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2cd25b,'request\x20sent',JSON['stringify'](_0x592b6f));if(_0x592b6f[_0x7328('0x14')]){if(_0x592b6f['error']['code']===0x1f4){logger['error'](_0x7328('0x11'),_0x2cd25b,_0x592b6f[_0x7328('0x14')][_0x7328('0x15')]);return _0x5df050(_0x592b6f[_0x7328('0x14')]['message']);}logger[_0x7328('0x14')](_0x7328('0x11'),_0x2cd25b,_0x592b6f[_0x7328('0x14')]['message']);return _0x10e11e(_0x592b6f[_0x7328('0x14')][_0x7328('0x15')]);}else{logger[_0x7328('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x2cd25b,_0x7328('0x12'));_0x10e11e(_0x592b6f[_0x7328('0x17')]['message']);}})[_0x7328('0x18')](function(_0x25bdf1){logger[_0x7328('0x14')](_0x7328('0x11'),_0x2cd25b,_0x25bdf1);_0x5df050(_0x25bdf1);});});} \ No newline at end of file +var _0xf737=['then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request'];(function(_0x3eafeb,_0x573685){var _0x29ad32=function(_0x1c880b){while(--_0x1c880b){_0x3eafeb['push'](_0x3eafeb['shift']());}};_0x29ad32(++_0x573685);}(_0xf737,0xc9));var _0x7f73=function(_0x1e5583,_0xf37418){_0x1e5583=_0x1e5583-0x0;var _0x52b83e=_0xf737[_0x1e5583];return _0x52b83e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f73('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f73('0x1'))['db'];var utils=require(_0x7f73('0x2'));var logger=require(_0x7f73('0x3'))(_0x7f73('0x4'));var config=require(_0x7f73('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7f73('0x6')][_0x7f73('0x7')]({'port':0x232a});config[_0x7f73('0x8')]=_[_0x7f73('0x9')](config[_0x7f73('0x8')],{'host':_0x7f73('0xa'),'port':0x18eb});var socket=require(_0x7f73('0xb'))(new Redis(config[_0x7f73('0x8')]));require(_0x7f73('0xc'))[_0x7f73('0xd')](socket);function respondWithRpcPromise(_0x249b58,_0x5ba6d2,_0x1d5589){return new BPromise(function(_0x22af72,_0x402d86){return client[_0x7f73('0xe')](_0x249b58,_0x1d5589)[_0x7f73('0xf')](function(_0x2ae0d3){logger[_0x7f73('0x10')](_0x7f73('0x11'),_0x5ba6d2,_0x7f73('0x12'));logger[_0x7f73('0x13')](_0x7f73('0x14'),_0x5ba6d2,_0x7f73('0x12'),JSON[_0x7f73('0x15')](_0x2ae0d3));if(_0x2ae0d3[_0x7f73('0x16')]){if(_0x2ae0d3[_0x7f73('0x16')][_0x7f73('0x17')]===0x1f4){logger[_0x7f73('0x16')](_0x7f73('0x11'),_0x5ba6d2,_0x2ae0d3[_0x7f73('0x16')][_0x7f73('0x18')]);return _0x402d86(_0x2ae0d3[_0x7f73('0x16')][_0x7f73('0x18')]);}logger['error'](_0x7f73('0x11'),_0x5ba6d2,_0x2ae0d3['error'][_0x7f73('0x18')]);return _0x22af72(_0x2ae0d3[_0x7f73('0x16')][_0x7f73('0x18')]);}else{logger[_0x7f73('0x10')](_0x7f73('0x11'),_0x5ba6d2,_0x7f73('0x12'));_0x22af72(_0x2ae0d3[_0x7f73('0x19')]['message']);}})[_0x7f73('0x1a')](function(_0x5d05c5){logger[_0x7f73('0x16')](_0x7f73('0x11'),_0x5ba6d2,_0x5d05c5);_0x402d86(_0x5d05c5);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 289388f..685dd79 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 _0xf5cd=['remove','update','emit','removeListener','openchannelAccount:','save'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf5cd,0xf5));var _0xdf5c=function(_0x59f491,_0xae7629){_0x59f491=_0x59f491-0x0;var _0xa5b6f1=_0xf5cd[_0x59f491];return _0xa5b6f1;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xdf5c('0x0'),_0xdf5c('0x1'),_0xdf5c('0x2')];function createListener(_0x405eba,_0xda2be7){return function(_0x53aa37){_0xda2be7[_0xdf5c('0x3')](_0x405eba,_0x53aa37);};}function removeListener(_0x3009b8,_0x56ce20){return function(){OpenchannelAccountEvents[_0xdf5c('0x4')](_0x3009b8,_0x56ce20);};}exports['register']=function(_0x1b58d7){for(var _0x46fe74=0x0,_0x2d4486=events['length'];_0x46fe74<_0x2d4486;_0x46fe74++){var _0x256582=events[_0x46fe74];var _0x29ee26=createListener(_0xdf5c('0x5')+_0x256582,_0x1b58d7);OpenchannelAccountEvents['on'](_0x256582,_0x29ee26);}}; \ No newline at end of file +var _0x1254=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x1254,0x78));var _0x4125=function(_0x116459,_0x2f637c){_0x116459=_0x116459-0x0;var _0x3741d7=_0x1254[_0x116459];return _0x3741d7;};'use strict';var OpenchannelAccountEvents=require(_0x4125('0x0'));var events=[_0x4125('0x1'),_0x4125('0x2'),_0x4125('0x3')];function createListener(_0x4a0e25,_0x458925){return function(_0x1c65c3){_0x458925[_0x4125('0x4')](_0x4a0e25,_0x1c65c3);};}function removeListener(_0x947c30,_0x1338fa){return function(){OpenchannelAccountEvents[_0x4125('0x5')](_0x947c30,_0x1338fa);};}exports[_0x4125('0x6')]=function(_0x41ebe8){for(var _0xa6a6b0=0x0,_0x35245e=events[_0x4125('0x7')];_0xa6a6b0<_0x35245e;_0xa6a6b0++){var _0x538f05=events[_0xa6a6b0];var _0x5af3f3=createListener(_0x4125('0x8')+_0x538f05,_0x41ebe8);OpenchannelAccountEvents['on'](_0x538f05,_0x5af3f3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 994a526..477401b 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 _0xba4c=['delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','create','update'];(function(_0x16959a,_0x34b600){var _0x49616b=function(_0xd55d35){while(--_0xd55d35){_0x16959a['push'](_0x16959a['shift']());}};_0x49616b(++_0x34b600);}(_0xba4c,0x134));var _0xcba4=function(_0x3b8ef0,_0x24b268){_0x3b8ef0=_0x3b8ef0-0x0;var _0x14c275=_0xba4c[_0x3b8ef0];return _0x14c275;};'use strict';var multer=require(_0xcba4('0x0'));var util=require('util');var path=require(_0xcba4('0x1'));var timeout=require(_0xcba4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcba4('0x3'));var auth=require(_0xcba4('0x4'));var interaction=require(_0xcba4('0x5'));var config=require(_0xcba4('0x6'));var controller=require(_0xcba4('0x7'));router['get']('/',auth[_0xcba4('0x8')](),controller[_0xcba4('0x9')]);router[_0xcba4('0xa')](_0xcba4('0xb'),auth[_0xcba4('0x8')](),controller[_0xcba4('0xc')]);router['post']('/',auth[_0xcba4('0x8')](),controller[_0xcba4('0xd')]);router['put']('/:id',auth[_0xcba4('0x8')](),controller[_0xcba4('0xe')]);router[_0xcba4('0xf')](_0xcba4('0xb'),auth[_0xcba4('0x8')](),controller['destroy']);module[_0xcba4('0x10')]=router; \ No newline at end of file +var _0x9042=['./openchannelApplication.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x53b68b,_0x3ae972){var _0xf607cb=function(_0x5a7d07){while(--_0x5a7d07){_0x53b68b['push'](_0x53b68b['shift']());}};_0xf607cb(++_0x3ae972);}(_0x9042,0x15f));var _0x2904=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0x9042[_0x43aee5];return _0x76d1d0;};'use strict';var multer=require(_0x2904('0x0'));var util=require(_0x2904('0x1'));var path=require(_0x2904('0x2'));var timeout=require(_0x2904('0x3'));var express=require(_0x2904('0x4'));var router=express[_0x2904('0x5')]();var fs_extra=require(_0x2904('0x6'));var auth=require(_0x2904('0x7'));var interaction=require(_0x2904('0x8'));var config=require('../../config/environment');var controller=require(_0x2904('0x9'));router[_0x2904('0xa')]('/',auth[_0x2904('0xb')](),controller['index']);router[_0x2904('0xa')](_0x2904('0xc'),auth[_0x2904('0xb')](),controller['show']);router[_0x2904('0xd')]('/',auth[_0x2904('0xb')](),controller[_0x2904('0xe')]);router[_0x2904('0xf')](_0x2904('0xc'),auth[_0x2904('0xb')](),controller[_0x2904('0x10')]);router[_0x2904('0x11')]('/:id',auth[_0x2904('0xb')](),controller[_0x2904('0x12')]);module[_0x2904('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index fc8a42d..0b41334 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 _0xf79c=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0xf79c,0x1b4));var _0xcf79=function(_0x1b11f8,_0x221abe){_0x1b11f8=_0x1b11f8-0x0;var _0x20b74f=_0xf79c[_0x1b11f8];return _0x20b74f;};'use strict';var Sequelize=require(_0xcf79('0x0'));module[_0xcf79('0x1')]={'priority':{'type':Sequelize[_0xcf79('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcf79('0x3')],'allowNull':![],'defaultValue':_0xcf79('0x4')},'appdata':{'type':Sequelize[_0xcf79('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcf79('0x3')],'defaultValue':_0xcf79('0x6')}}; \ No newline at end of file +var _0xc547=['TEXT','*,*,*,*','sequelize','INTEGER','noop'];(function(_0x12149f,_0x24e436){var _0x5ae92b=function(_0x3e112d){while(--_0x3e112d){_0x12149f['push'](_0x12149f['shift']());}};_0x5ae92b(++_0x24e436);}(_0xc547,0xb6));var _0x7c54=function(_0x4a4179,_0x381a84){_0x4a4179=_0x4a4179-0x0;var _0x121fb9=_0xc547[_0x4a4179];return _0x121fb9;};'use strict';var Sequelize=require(_0x7c54('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7c54('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7c54('0x2')},'appdata':{'type':Sequelize[_0x7c54('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7c54('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a90ea77..294bd26 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 _0x38f5=['../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','error','name','send','render','merge','contact','message','agent','interaction','account','index','map','OpenchannelApplication','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','intersection','find','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x38f5,0xd0));var _0x538f=function(_0x2e4ebc,_0x50f034){_0x2e4ebc=_0x2e4ebc-0x0;var _0x563bed=_0x38f5[_0x2e4ebc];return _0x563bed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x538f('0x0'));var zipdir=require(_0x538f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x538f('0x2'));var moment=require(_0x538f('0x3'));var BPromise=require(_0x538f('0x4'));var Mustache=require(_0x538f('0x5'));var util=require(_0x538f('0x6'));var path=require('path');var sox=require(_0x538f('0x7'));var csv=require(_0x538f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x538f('0x9'));var _=require(_0x538f('0xa'));var squel=require(_0x538f('0xb'));var crypto=require(_0x538f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x538f('0xd'));var Papa=require(_0x538f('0xe'));var Redis=require(_0x538f('0xf'));var authService=require(_0x538f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x538f('0x11'));var logger=require(_0x538f('0x12'))('api');var utils=require(_0x538f('0x13'));var config=require(_0x538f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x538f('0x15'))['db'];function respondWithStatusCode(_0x5f3f03,_0x60517d){_0x60517d=_0x60517d||0xcc;return function(_0x16524e){if(_0x16524e){return _0x5f3f03[_0x538f('0x16')](_0x60517d);}return _0x5f3f03[_0x538f('0x17')](_0x60517d)['end']();};}function respondWithResult(_0x2951ec,_0x40799b){_0x40799b=_0x40799b||0xc8;return function(_0x20f42d){if(_0x20f42d){return _0x2951ec[_0x538f('0x17')](_0x40799b)[_0x538f('0x18')](_0x20f42d);}};}function respondWithFilteredResult(_0x17d0b8,_0x3a9434){return function(_0x40238a){if(_0x40238a){var _0x90b6ef=typeof _0x3a9434[_0x538f('0x19')]===_0x538f('0x1a')&&typeof _0x3a9434[_0x538f('0x1b')]==='undefined';var _0x566837=_0x40238a['count'];var _0x302c2c=_0x90b6ef?0x0:_0x3a9434[_0x538f('0x19')];var _0x502808=_0x90b6ef?_0x40238a[_0x538f('0x1c')]:_0x3a9434[_0x538f('0x19')]+_0x3a9434[_0x538f('0x1b')];var _0x2da628;if(_0x502808>=_0x566837){_0x502808=_0x566837;_0x2da628=0xc8;}else{_0x2da628=0xce;}_0x17d0b8[_0x538f('0x17')](_0x2da628);return _0x17d0b8[_0x538f('0x1d')]('Content-Range',_0x302c2c+'-'+_0x502808+'/'+_0x566837)[_0x538f('0x18')](_0x40238a);}return null;};}function patchUpdates(_0x599a6){return function(_0xced104){try{jsonpatch[_0x538f('0x1e')](_0xced104,_0x599a6,!![]);}catch(_0x4767ba){return BPromise['reject'](_0x4767ba);}return _0xced104[_0x538f('0x1f')]();};}function saveUpdates(_0x3251da,_0x34c7ff){return function(_0x10a72b){if(_0x10a72b){return _0x10a72b[_0x538f('0x20')](_0x3251da)[_0x538f('0x21')](function(_0x16b4aa){return _0x16b4aa;});}return null;};}function removeEntity(_0x922b56,_0x49fd44){return function(_0xcf045c){if(_0xcf045c){return _0xcf045c[_0x538f('0x22')]()[_0x538f('0x21')](function(){_0x922b56['status'](0xcc)[_0x538f('0x23')]();});}};}function handleEntityNotFound(_0x259971,_0x585d95){return function(_0x36f504){if(!_0x36f504){_0x259971['sendStatus'](0x194);}return _0x36f504;};}function handleError(_0x55fe32,_0x2058dd){_0x2058dd=_0x2058dd||0x1f4;return function(_0x51d8c6){logger[_0x538f('0x24')](_0x51d8c6['stack']);if(_0x51d8c6[_0x538f('0x25')]){delete _0x51d8c6[_0x538f('0x25')];}_0x55fe32['status'](_0x2058dd)[_0x538f('0x26')](_0x51d8c6);};}function getMustacheRender(_0x5b92e4,_0x441e32){return Mustache[_0x538f('0x27')](_0x5b92e4,_[_0x538f('0x28')](_0x441e32['body'],{'contact':_0x441e32[_0x538f('0x29')],'message':_0x441e32[_0x538f('0x2a')],'agent':_0x441e32[_0x538f('0x2b')],'interaction':_0x441e32[_0x538f('0x2c')],'account':_0x441e32[_0x538f('0x2d')]}))||'';}exports[_0x538f('0x2e')]=function(_0x209bc2,_0x5c6255){var _0x35e010={},_0x47cc9f={},_0x26b28e={'count':0x0,'rows':[]};var _0x2699e5=_[_0x538f('0x2f')](db[_0x538f('0x30')][_0x538f('0x31')],function(_0x4af908){return{'name':_0x4af908['fieldName'],'type':_0x4af908['type']['key']};});_0x47cc9f[_0x538f('0x32')]=_['map'](_0x2699e5,_0x538f('0x25'));_0x47cc9f[_0x538f('0x33')]=_[_0x538f('0x34')](_0x209bc2[_0x538f('0x33')]);_0x47cc9f[_0x538f('0x35')]=_['intersection'](_0x47cc9f[_0x538f('0x32')],_0x47cc9f[_0x538f('0x33')]);_0x35e010[_0x538f('0x36')]=_['intersection'](_0x47cc9f[_0x538f('0x32')],qs['fields'](_0x209bc2['query'][_0x538f('0x37')]));_0x35e010[_0x538f('0x36')]=_0x35e010[_0x538f('0x36')][_0x538f('0x38')]?_0x35e010['attributes']:_0x47cc9f[_0x538f('0x32')];if(!_0x209bc2['query'][_0x538f('0x39')](_0x538f('0x3a'))){_0x35e010[_0x538f('0x1b')]=qs[_0x538f('0x1b')](_0x209bc2[_0x538f('0x33')]['limit']);_0x35e010[_0x538f('0x19')]=qs['offset'](_0x209bc2['query'][_0x538f('0x19')]);}_0x35e010[_0x538f('0x3b')]=qs[_0x538f('0x3c')](_0x209bc2['query'][_0x538f('0x3c')]);_0x35e010[_0x538f('0x3d')]=qs[_0x538f('0x35')](_[_0x538f('0x3e')](_0x209bc2[_0x538f('0x33')],_0x47cc9f[_0x538f('0x35')]),_0x2699e5);if(_0x209bc2['query'][_0x538f('0x3f')]){_0x35e010['where']=_[_0x538f('0x28')](_0x35e010['where'],{'$or':_[_0x538f('0x2f')](_0x2699e5,function(_0x47b6cf){if(_0x47b6cf[_0x538f('0x40')]!=='VIRTUAL'){var _0xd1b4c1={};_0xd1b4c1[_0x47b6cf[_0x538f('0x25')]]={'$like':'%'+_0x209bc2[_0x538f('0x33')]['filter']+'%'};return _0xd1b4c1;}})});}_0x35e010=_[_0x538f('0x28')]({},_0x35e010,_0x209bc2[_0x538f('0x41')]);var _0x4dad1a={'where':_0x35e010[_0x538f('0x3d')]};return db[_0x538f('0x30')][_0x538f('0x1c')](_0x4dad1a)[_0x538f('0x21')](function(_0x208ab2){_0x26b28e[_0x538f('0x1c')]=_0x208ab2;if(_0x209bc2['query'][_0x538f('0x42')]){_0x35e010[_0x538f('0x43')]=[{'all':!![]}];}return db[_0x538f('0x30')][_0x538f('0x44')](_0x35e010);})['then'](function(_0x5bc8a8){_0x26b28e[_0x538f('0x45')]=_0x5bc8a8;return _0x26b28e;})[_0x538f('0x21')](respondWithFilteredResult(_0x5c6255,_0x35e010))[_0x538f('0x46')](handleError(_0x5c6255,null));};exports['show']=function(_0xb1bbb,_0x59faef){var _0x574d1a={'raw':!![],'where':{'id':_0xb1bbb['params']['id']}},_0x20a954={};_0x20a954[_0x538f('0x32')]=_['keys'](db[_0x538f('0x30')][_0x538f('0x31')]);_0x20a954[_0x538f('0x33')]=_[_0x538f('0x34')](_0xb1bbb['query']);_0x20a954[_0x538f('0x35')]=_[_0x538f('0x47')](_0x20a954[_0x538f('0x32')],_0x20a954[_0x538f('0x33')]);_0x574d1a['attributes']=_['intersection'](_0x20a954['model'],qs[_0x538f('0x37')](_0xb1bbb[_0x538f('0x33')][_0x538f('0x37')]));_0x574d1a[_0x538f('0x36')]=_0x574d1a[_0x538f('0x36')]['length']?_0x574d1a['attributes']:_0x20a954[_0x538f('0x32')];if(_0xb1bbb[_0x538f('0x33')][_0x538f('0x42')]){_0x574d1a[_0x538f('0x43')]=[{'all':!![]}];}_0x574d1a=_[_0x538f('0x28')]({},_0x574d1a,_0xb1bbb[_0x538f('0x41')]);return db[_0x538f('0x30')][_0x538f('0x48')](_0x574d1a)[_0x538f('0x21')](handleEntityNotFound(_0x59faef,null))[_0x538f('0x21')](respondWithResult(_0x59faef,null))[_0x538f('0x46')](handleError(_0x59faef,null));};exports['create']=function(_0x116304,_0x181ed9){return db['OpenchannelApplication'][_0x538f('0x49')](_0x116304['body'],{})[_0x538f('0x21')](respondWithResult(_0x181ed9,0xc9))[_0x538f('0x46')](handleError(_0x181ed9,null));};exports['update']=function(_0x587814,_0x1334b0){if(_0x587814[_0x538f('0x4a')]['id']){delete _0x587814[_0x538f('0x4a')]['id'];}return db[_0x538f('0x30')]['find']({'where':{'id':_0x587814[_0x538f('0x4b')]['id']}})[_0x538f('0x21')](handleEntityNotFound(_0x1334b0,null))[_0x538f('0x21')](saveUpdates(_0x587814[_0x538f('0x4a')],null))[_0x538f('0x21')](respondWithResult(_0x1334b0,null))[_0x538f('0x46')](handleError(_0x1334b0,null));};exports['destroy']=function(_0x4ab6e9,_0x2e1ed8){return db[_0x538f('0x30')][_0x538f('0x48')]({'where':{'id':_0x4ab6e9[_0x538f('0x4b')]['id']}})[_0x538f('0x21')](handleEntityNotFound(_0x2e1ed8,null))[_0x538f('0x21')](removeEntity(_0x2e1ed8,null))['catch'](handleError(_0x2e1ed8,null));}; \ No newline at end of file +var _0xcd97=['render','merge','body','contact','message','agent','account','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','update','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','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','then','destroy','error','name','send'];(function(_0x23895f,_0x43e4a9){var _0x39cfc9=function(_0x72a423){while(--_0x72a423){_0x23895f['push'](_0x23895f['shift']());}};_0x39cfc9(++_0x43e4a9);}(_0xcd97,0x1be));var _0x7cd9=function(_0x26dda0,_0x5b58ab){_0x26dda0=_0x26dda0-0x0;var _0x41089c=_0xcd97[_0x26dda0];return _0x41089c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7cd9('0x0'));var zipdir=require(_0x7cd9('0x1'));var jsonpatch=require(_0x7cd9('0x2'));var rp=require(_0x7cd9('0x3'));var moment=require(_0x7cd9('0x4'));var BPromise=require(_0x7cd9('0x5'));var Mustache=require(_0x7cd9('0x6'));var util=require(_0x7cd9('0x7'));var path=require(_0x7cd9('0x8'));var sox=require(_0x7cd9('0x9'));var csv=require(_0x7cd9('0xa'));var ejs=require(_0x7cd9('0xb'));var fs=require('fs');var fs_extra=require(_0x7cd9('0xc'));var _=require(_0x7cd9('0xd'));var squel=require(_0x7cd9('0xe'));var crypto=require(_0x7cd9('0xf'));var jsforce=require(_0x7cd9('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7cd9('0x11'));var Papa=require(_0x7cd9('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7cd9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cd9('0x14'))(_0x7cd9('0x15'));var utils=require(_0x7cd9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7cd9('0x17'));var db=require(_0x7cd9('0x18'))['db'];function respondWithStatusCode(_0x2a8b92,_0x5b2cce){_0x5b2cce=_0x5b2cce||0xcc;return function(_0x86c688){if(_0x86c688){return _0x2a8b92[_0x7cd9('0x19')](_0x5b2cce);}return _0x2a8b92[_0x7cd9('0x1a')](_0x5b2cce)[_0x7cd9('0x1b')]();};}function respondWithResult(_0x4b7efe,_0x246cd6){_0x246cd6=_0x246cd6||0xc8;return function(_0x20dfc1){if(_0x20dfc1){return _0x4b7efe[_0x7cd9('0x1a')](_0x246cd6)[_0x7cd9('0x1c')](_0x20dfc1);}};}function respondWithFilteredResult(_0x15dcec,_0x5b495a){return function(_0x117751){if(_0x117751){var _0x23c576=typeof _0x5b495a[_0x7cd9('0x1d')]===_0x7cd9('0x1e')&&typeof _0x5b495a[_0x7cd9('0x1f')]==='undefined';var _0x4aa63b=_0x117751['count'];var _0x3f117a=_0x23c576?0x0:_0x5b495a[_0x7cd9('0x1d')];var _0x11df8d=_0x23c576?_0x117751['count']:_0x5b495a[_0x7cd9('0x1d')]+_0x5b495a[_0x7cd9('0x1f')];var _0x174f11;if(_0x11df8d>=_0x4aa63b){_0x11df8d=_0x4aa63b;_0x174f11=0xc8;}else{_0x174f11=0xce;}_0x15dcec[_0x7cd9('0x1a')](_0x174f11);return _0x15dcec['set'](_0x7cd9('0x20'),_0x3f117a+'-'+_0x11df8d+'/'+_0x4aa63b)[_0x7cd9('0x1c')](_0x117751);}return null;};}function patchUpdates(_0x5cc9dd){return function(_0xdc68b){try{jsonpatch[_0x7cd9('0x21')](_0xdc68b,_0x5cc9dd,!![]);}catch(_0x4db793){return BPromise[_0x7cd9('0x22')](_0x4db793);}return _0xdc68b['save']();};}function saveUpdates(_0x3817a7,_0x100c92){return function(_0x58bed5){if(_0x58bed5){return _0x58bed5['update'](_0x3817a7)[_0x7cd9('0x23')](function(_0x531a91){return _0x531a91;});}return null;};}function removeEntity(_0x5ac650,_0x28f3eb){return function(_0x44411a){if(_0x44411a){return _0x44411a[_0x7cd9('0x24')]()['then'](function(){_0x5ac650[_0x7cd9('0x1a')](0xcc)[_0x7cd9('0x1b')]();});}};}function handleEntityNotFound(_0x4f7345,_0x5739da){return function(_0x386957){if(!_0x386957){_0x4f7345[_0x7cd9('0x19')](0x194);}return _0x386957;};}function handleError(_0x19c8e1,_0x537e1b){_0x537e1b=_0x537e1b||0x1f4;return function(_0x22eeaa){logger[_0x7cd9('0x25')](_0x22eeaa['stack']);if(_0x22eeaa[_0x7cd9('0x26')]){delete _0x22eeaa['name'];}_0x19c8e1[_0x7cd9('0x1a')](_0x537e1b)[_0x7cd9('0x27')](_0x22eeaa);};}function getMustacheRender(_0x543177,_0x59679f){return Mustache[_0x7cd9('0x28')](_0x543177,_[_0x7cd9('0x29')](_0x59679f[_0x7cd9('0x2a')],{'contact':_0x59679f[_0x7cd9('0x2b')],'message':_0x59679f[_0x7cd9('0x2c')],'agent':_0x59679f[_0x7cd9('0x2d')],'interaction':_0x59679f['interaction'],'account':_0x59679f[_0x7cd9('0x2e')]}))||'';}exports[_0x7cd9('0x2f')]=function(_0x521908,_0x26806a){var _0x330af9={},_0xdd6849={},_0x317d8a={'count':0x0,'rows':[]};var _0x31ce92=_[_0x7cd9('0x30')](db[_0x7cd9('0x31')][_0x7cd9('0x32')],function(_0x133d83){return{'name':_0x133d83[_0x7cd9('0x33')],'type':_0x133d83[_0x7cd9('0x34')][_0x7cd9('0x35')]};});_0xdd6849[_0x7cd9('0x36')]=_[_0x7cd9('0x30')](_0x31ce92,_0x7cd9('0x26'));_0xdd6849[_0x7cd9('0x37')]=_[_0x7cd9('0x38')](_0x521908[_0x7cd9('0x37')]);_0xdd6849['filters']=_[_0x7cd9('0x39')](_0xdd6849['model'],_0xdd6849[_0x7cd9('0x37')]);_0x330af9[_0x7cd9('0x3a')]=_[_0x7cd9('0x39')](_0xdd6849[_0x7cd9('0x36')],qs[_0x7cd9('0x3b')](_0x521908[_0x7cd9('0x37')][_0x7cd9('0x3b')]));_0x330af9[_0x7cd9('0x3a')]=_0x330af9[_0x7cd9('0x3a')][_0x7cd9('0x3c')]?_0x330af9[_0x7cd9('0x3a')]:_0xdd6849[_0x7cd9('0x36')];if(!_0x521908['query'][_0x7cd9('0x3d')](_0x7cd9('0x3e'))){_0x330af9['limit']=qs[_0x7cd9('0x1f')](_0x521908['query'][_0x7cd9('0x1f')]);_0x330af9[_0x7cd9('0x1d')]=qs['offset'](_0x521908[_0x7cd9('0x37')]['offset']);}_0x330af9[_0x7cd9('0x3f')]=qs['sort'](_0x521908['query'][_0x7cd9('0x40')]);_0x330af9[_0x7cd9('0x41')]=qs[_0x7cd9('0x42')](_['pick'](_0x521908[_0x7cd9('0x37')],_0xdd6849[_0x7cd9('0x42')]),_0x31ce92);if(_0x521908[_0x7cd9('0x37')][_0x7cd9('0x43')]){_0x330af9['where']=_['merge'](_0x330af9['where'],{'$or':_[_0x7cd9('0x30')](_0x31ce92,function(_0x2111d0){if(_0x2111d0[_0x7cd9('0x34')]!==_0x7cd9('0x44')){var _0x51c6e3={};_0x51c6e3[_0x2111d0[_0x7cd9('0x26')]]={'$like':'%'+_0x521908[_0x7cd9('0x37')][_0x7cd9('0x43')]+'%'};return _0x51c6e3;}})});}_0x330af9=_[_0x7cd9('0x29')]({},_0x330af9,_0x521908[_0x7cd9('0x45')]);var _0x3f1091={'where':_0x330af9[_0x7cd9('0x41')]};return db['OpenchannelApplication'][_0x7cd9('0x46')](_0x3f1091)[_0x7cd9('0x23')](function(_0x33ea72){_0x317d8a[_0x7cd9('0x46')]=_0x33ea72;if(_0x521908[_0x7cd9('0x37')][_0x7cd9('0x47')]){_0x330af9[_0x7cd9('0x48')]=[{'all':!![]}];}return db[_0x7cd9('0x31')][_0x7cd9('0x49')](_0x330af9);})[_0x7cd9('0x23')](function(_0x5da7e7){_0x317d8a[_0x7cd9('0x4a')]=_0x5da7e7;return _0x317d8a;})[_0x7cd9('0x23')](respondWithFilteredResult(_0x26806a,_0x330af9))[_0x7cd9('0x4b')](handleError(_0x26806a,null));};exports[_0x7cd9('0x4c')]=function(_0x27c6bc,_0xad0067){var _0x302f40={'raw':!![],'where':{'id':_0x27c6bc[_0x7cd9('0x4d')]['id']}},_0x44c062={};_0x44c062[_0x7cd9('0x36')]=_['keys'](db['OpenchannelApplication'][_0x7cd9('0x32')]);_0x44c062[_0x7cd9('0x37')]=_[_0x7cd9('0x38')](_0x27c6bc['query']);_0x44c062[_0x7cd9('0x42')]=_[_0x7cd9('0x39')](_0x44c062[_0x7cd9('0x36')],_0x44c062[_0x7cd9('0x37')]);_0x302f40[_0x7cd9('0x3a')]=_['intersection'](_0x44c062[_0x7cd9('0x36')],qs[_0x7cd9('0x3b')](_0x27c6bc['query']['fields']));_0x302f40[_0x7cd9('0x3a')]=_0x302f40[_0x7cd9('0x3a')][_0x7cd9('0x3c')]?_0x302f40[_0x7cd9('0x3a')]:_0x44c062[_0x7cd9('0x36')];if(_0x27c6bc[_0x7cd9('0x37')][_0x7cd9('0x47')]){_0x302f40['include']=[{'all':!![]}];}_0x302f40=_[_0x7cd9('0x29')]({},_0x302f40,_0x27c6bc[_0x7cd9('0x45')]);return db[_0x7cd9('0x31')][_0x7cd9('0x4e')](_0x302f40)[_0x7cd9('0x23')](handleEntityNotFound(_0xad0067,null))[_0x7cd9('0x23')](respondWithResult(_0xad0067,null))[_0x7cd9('0x4b')](handleError(_0xad0067,null));};exports[_0x7cd9('0x4f')]=function(_0x554a0b,_0x461eb3){return db[_0x7cd9('0x31')]['create'](_0x554a0b['body'],{})['then'](respondWithResult(_0x461eb3,0xc9))[_0x7cd9('0x4b')](handleError(_0x461eb3,null));};exports[_0x7cd9('0x50')]=function(_0x156807,_0x2974d2){if(_0x156807[_0x7cd9('0x2a')]['id']){delete _0x156807[_0x7cd9('0x2a')]['id'];}return db[_0x7cd9('0x31')][_0x7cd9('0x4e')]({'where':{'id':_0x156807['params']['id']}})[_0x7cd9('0x23')](handleEntityNotFound(_0x2974d2,null))[_0x7cd9('0x23')](saveUpdates(_0x156807[_0x7cd9('0x2a')],null))[_0x7cd9('0x23')](respondWithResult(_0x2974d2,null))[_0x7cd9('0x4b')](handleError(_0x2974d2,null));};exports[_0x7cd9('0x24')]=function(_0x13e46e,_0x3e45de){return db[_0x7cd9('0x31')][_0x7cd9('0x4e')]({'where':{'id':_0x13e46e[_0x7cd9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e45de,null))[_0x7cd9('0x23')](removeEntity(_0x3e45de,null))[_0x7cd9('0x4b')](handleError(_0x3e45de,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 5c632d7..8debc31 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 _0x534b=['path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','util','api','moment'];(function(_0x490054,_0xa57b72){var _0x422eb5=function(_0x2bbe96){while(--_0x2bbe96){_0x490054['push'](_0x490054['shift']());}};_0x422eb5(++_0xa57b72);}(_0x534b,0xb8));var _0xb534=function(_0x342b60,_0x3f0829){_0x342b60=_0x342b60-0x0;var _0x2a610c=_0x534b[_0x342b60];return _0x2a610c;};'use strict';var _=require('lodash');var util=require(_0xb534('0x0'));var logger=require('../../config/logger')(_0xb534('0x1'));var moment=require(_0xb534('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb534('0x3'));var rimraf=require(_0xb534('0x4'));var config=require('../../config/environment');var attributes=require(_0xb534('0x5'));module[_0xb534('0x6')]=function(_0x48d969,_0x391cbd){return _0x48d969[_0xb534('0x7')](_0xb534('0x8'),attributes,{'tableName':_0xb534('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb534('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x90e4=['api','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x107313,_0x8a055b){var _0x1fcd2e=function(_0x55ef17){while(--_0x55ef17){_0x107313['push'](_0x107313['shift']());}};_0x1fcd2e(++_0x8a055b);}(_0x90e4,0x16d));var _0x490e=function(_0x185334,_0x4630ac){_0x185334=_0x185334-0x0;var _0xf2e59a=_0x90e4[_0x185334];return _0xf2e59a;};'use strict';var _=require(_0x490e('0x0'));var util=require(_0x490e('0x1'));var logger=require(_0x490e('0x2'))(_0x490e('0x3'));var moment=require(_0x490e('0x4'));var BPromise=require(_0x490e('0x5'));var rp=require(_0x490e('0x6'));var fs=require('fs');var path=require(_0x490e('0x7'));var rimraf=require('rimraf');var config=require(_0x490e('0x8'));var attributes=require(_0x490e('0x9'));module[_0x490e('0xa')]=function(_0x447cd0,_0x515317){return _0x447cd0[_0x490e('0xb')](_0x490e('0xc'),attributes,{'tableName':_0x490e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x490e('0xe'),'collate':_0x490e('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index a226939..c9059de 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 _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x544123,_0x48d2c9){var _0x34dcd4=function(_0x3bca3a){while(--_0x3bca3a){_0x544123['push'](_0x544123['shift']());}};_0x34dcd4(++_0x48d2c9);}(_0xb10b,0x12a));var _0xbb10=function(_0x10c778,_0x58ef9e){_0x10c778=_0x10c778-0x0;var _0x4e9fb2=_0xb10b[_0x10c778];return _0x4e9fb2;};'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?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x1c6045,_0x46d59f){var _0x257e28=function(_0x3b64d4){while(--_0x3b64d4){_0x1c6045['push'](_0x1c6045['shift']());}};_0x257e28(++_0x46d59f);}(_0xb10b,0x12a));var _0xbb10=function(_0x4992be,_0x555abf){_0x4992be=_0x4992be-0x0;var _0x39e44e=_0xb10b[_0x4992be];return _0x39e44e;};'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?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c7bb076..7e9e2a5 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 _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file +var _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_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['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/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9b17fc8..0c49d53 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 _0x9234=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x9234,0x1bd));var _0x4923=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0x9234[_0x5d6e35];return _0x5d7ada;};'use strict';var Sequelize=require(_0x4923('0x0'));module['exports']={'closed':{'type':Sequelize[_0x4923('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4923('0x2')]},'disposition':{'type':Sequelize[_0x4923('0x3')]},'secondDisposition':{'type':Sequelize[_0x4923('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4923('0x3')]},'read1stAt':{'type':Sequelize[_0x4923('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x4923('0x3')]},'lastMsgAt':{'type':Sequelize[_0x4923('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4923('0x4')]('in',_0x4923('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x4923('0x3')]}}; \ No newline at end of file +var _0x1648=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x1648,0xa7));var _0x8164=function(_0xfc4348,_0x25183e){_0xfc4348=_0xfc4348-0x0;var _0x101e34=_0x1648[_0xfc4348];return _0x101e34;};'use strict';var Sequelize=require(_0x8164('0x0'));module[_0x8164('0x1')]={'closed':{'type':Sequelize[_0x8164('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8164('0x3')]},'disposition':{'type':Sequelize[_0x8164('0x4')]},'secondDisposition':{'type':Sequelize[_0x8164('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8164('0x4')]},'read1stAt':{'type':Sequelize[_0x8164('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x8164('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8164('0x5')]('in',_0x8164('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8164('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index de610c5..eb6eafd 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 _0xa9e0=['omit','emit','openchannelInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','User','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','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','../../components/export/pdf','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','error','stack','name','send','render','body','contact','message','agent','interaction','account','Users','fullname','TagIds','Tags','split','forEach','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','all','catch','params','includeAll','include','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','merge','format','options','findAll','rows','addTags','setTags'];(function(_0x26b1a8,_0x7b4bb){var _0x5c24bd=function(_0x241229){while(--_0x241229){_0x26b1a8['push'](_0x26b1a8['shift']());}};_0x5c24bd(++_0x7b4bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 pdf=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=typeof _0x459eb1[_0x0a9e('0x1e')]===_0x0a9e('0x1f')&&typeof _0x459eb1[_0x0a9e('0x20')]===_0x0a9e('0x1f');var _0x20559e=_0x478723[_0x0a9e('0x21')];var _0x112016=_0x106033?0x0:_0x459eb1[_0x0a9e('0x1e')];var _0x105080=_0x106033?_0x478723['count']:_0x459eb1[_0x0a9e('0x1e')]+_0x459eb1[_0x0a9e('0x20')];var _0x53682f;if(_0x105080>=_0x20559e){_0x105080=_0x20559e;_0x53682f=0xc8;}else{_0x53682f=0xce;}_0x5a0a06[_0x0a9e('0x22')](_0x53682f);return _0x5a0a06['set']('Content-Range',_0x112016+'-'+_0x105080+'/'+_0x20559e)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x432e56){return function(_0x38e7c4){try{jsonpatch[_0x0a9e('0x23')](_0x38e7c4,_0x432e56,!![]);}catch(_0x4abc77){return BPromise[_0x0a9e('0x24')](_0x4abc77);}return _0x38e7c4[_0x0a9e('0x25')]();};}function saveUpdates(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')](_0x3b45bc)[_0x0a9e('0x27')](function(_0x5ea472){return _0x5ea472;});}return null;};}function removeEntity(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(_0x3a8e58){return _0x3a8e58[_0x0a9e('0x28')]()[_0x0a9e('0x27')](function(){_0x59181e['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(!_0x5bfb33){_0x479bc4[_0x0a9e('0x1b')](0x194);}return _0x5bfb33;};}function handleError(_0x34dc65,_0x25fba9){_0x25fba9=_0x25fba9||0x1f4;return function(_0x14433c){logger[_0x0a9e('0x29')](_0x14433c[_0x0a9e('0x2a')]);if(_0x14433c[_0x0a9e('0x2b')]){delete _0x14433c[_0x0a9e('0x2b')];}_0x34dc65['status'](_0x25fba9)[_0x0a9e('0x2c')](_0x14433c);};}function getMustacheRender(_0x468813,_0x2b1f27){return Mustache[_0x0a9e('0x2d')](_0x468813,_['merge'](_0x2b1f27[_0x0a9e('0x2e')],{'contact':_0x2b1f27[_0x0a9e('0x2f')],'message':_0x2b1f27[_0x0a9e('0x30')],'agent':_0x2b1f27[_0x0a9e('0x31')],'interaction':_0x2b1f27[_0x0a9e('0x32')],'account':_0x2b1f27[_0x0a9e('0x33')]}))||'';}function getInteractionUsers(_0x296f41,_0x2e8759){return new BPromise(function(_0x1dbde2,_0x540530){try{if(_0x2e8759[_0x296f41['id']]){_0x296f41[_0x0a9e('0x34')]=_['map'](_0x2e8759[_0x296f41['id']],function(_0x2407f9){return{'id':_0x2407f9['id'],'fullname':_0x2407f9[_0x0a9e('0x35')]};});}}catch(_0x1122db){_0x540530(_0x1122db);}_0x1dbde2(_0x296f41);});}function getInteractionTags(_0x33bdb7,_0x25ce3a){return new BPromise(function(_0x5180f1,_0x66c1d2){try{if(_0x33bdb7[_0x0a9e('0x36')]){_0x33bdb7[_0x0a9e('0x37')]=[];_0x33bdb7[_0x0a9e('0x36')][_0x0a9e('0x38')](',')[_0x0a9e('0x39')](function(_0x332d35){_0x33bdb7[_0x0a9e('0x37')]['push'](_0x25ce3a[_0x332d35]);});}delete _0x33bdb7[_0x0a9e('0x36')];}catch(_0x5e7238){_0x66c1d2(_0x5e7238);}_0x5180f1(_0x33bdb7);});}function updateOpenchannelInteraction(_0x2cc7a0,_0x14b13f,_0x2b7e7f){return new BPromise(function(_0x3f3d41,_0x567193){return getInteractionUsers(_0x2cc7a0,_0x2b7e7f)[_0x0a9e('0x27')](function(_0xd1836d){return getInteractionTags(_0xd1836d,_0x14b13f);})[_0x0a9e('0x27')](function(_0x15de0e){_0x3f3d41(_0x15de0e);})['catch'](function(_0x54135e){_0x567193(_0x54135e);});});}exports[_0x0a9e('0x3a')]=function(_0x5640eb,_0x24936a){var _0x3d9717={},_0x381c37={},_0x1ef87a={'count':0x0,'rows':[]};var _0x4f41ae=_[_0x0a9e('0x3b')](db[_0x0a9e('0x3c')][_0x0a9e('0x3d')],function(_0x533942){return{'name':_0x533942[_0x0a9e('0x3e')],'type':_0x533942[_0x0a9e('0x3f')][_0x0a9e('0x40')]};});_0x381c37['model']=_['map'](_0x4f41ae,_0x0a9e('0x2b'));_0x381c37[_0x0a9e('0x41')]=_['keys'](_0x5640eb[_0x0a9e('0x41')]);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],_0x381c37['query']);_0x3d9717['attributes']=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],qs['fields'](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x3d9717[_0x0a9e('0x46')]=_0x3d9717['attributes'][_0x0a9e('0x47')]?_0x3d9717[_0x0a9e('0x46')]:_0x381c37[_0x0a9e('0x44')];if(!_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x3d9717[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x20')]);_0x3d9717[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x1e')]);}_0x3d9717[_0x0a9e('0x4a')]=qs['sort'](_0x5640eb['query'][_0x0a9e('0x4b')]);_0x3d9717[_0x0a9e('0x4c')]=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5640eb[_0x0a9e('0x41')],_0x381c37[_0x0a9e('0x42')]),_0x4f41ae);var _0x10b040=[];var _0x445e25=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')]('id')[_0x0a9e('0x4f')](_0x0a9e('0x2b'))['field'](_0x0a9e('0x50'))[_0x0a9e('0x51')](_0x0a9e('0x52'));var _0xfbd5ad=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')](_0x0a9e('0x53'))[_0x0a9e('0x4f')]('u.fullname')[_0x0a9e('0x4f')]('ui.OpenchannelInteractionId')[_0x0a9e('0x51')](_0x0a9e('0x54'),'ui')[_0x0a9e('0x55')]('users','u',_0x0a9e('0x56'));var _0x7f6eb1=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x51')](_0x0a9e('0x57'),'i')[_0x0a9e('0x55')](_0x0a9e('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0a9e('0x55')](_0x0a9e('0x59'),'o',_0x0a9e('0x5a'))[_0x0a9e('0x55')](_0x0a9e('0x5b'),'a',_0x0a9e('0x5c'))[_0x0a9e('0x55')](_0x0a9e('0x5d'),'me',_0x0a9e('0x5e'))['left_join'](_0x0a9e('0x5f'),'it',_0x0a9e('0x60'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1adfee=squel[_0x0a9e('0x61')]();var _0x37edaa=[];var _0x11545a=squel[_0x0a9e('0x61')]();var _0x30decb;if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x62')]){_0x30decb=as['parseSearch'](_0x5640eb['query']['search']);var _0x39d77d=_0x30decb[_0x0a9e('0x63')];for(var _0x14d602=0x0;_0x14d602<_0x30decb['conditions'][_0x0a9e('0x47')];_0x14d602++){var _0x161aa7=_0x30decb['conditions'][_0x14d602];var _0x5a88da='i';var _0x2ef381=_['find'](_0x4f41ae,[_0x0a9e('0x2b'),_0x161aa7['field']]);if(!_0x2ef381){switch(_0x161aa7[_0x0a9e('0x4f')]){case _0x0a9e('0x64'):if(_0x161aa7[_0x0a9e('0x65')]==0x1){_0x7f6eb1['having']('`'+_0x161aa7[_0x0a9e('0x4f')]+_0x0a9e('0x66'));}else{_0x7f6eb1['having']('`'+_0x161aa7['field']+_0x0a9e('0x67'));}break;case _0x0a9e('0x68'):if(_0x161aa7['operator']===_0x0a9e('0x69')){if(_0x161aa7['value'][_0x0a9e('0x38')]('\x20')['length']>0x1){_0x1adfee[_0x39d77d](_0x0a9e('0x6a'),qs['getFullTextValue'](_0x161aa7['value']),null);}else{var _0x5df0ad='%'+_0x161aa7[_0x0a9e('0x65')]+'%';_0x1adfee[_0x39d77d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5df0ad,_0x5df0ad,_0x5df0ad);}}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x6c')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x6c');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case _0x0a9e('0x70'):var _0xb83dfd=_0x161aa7[_0x0a9e('0x65')]['split'](',')[_0x0a9e('0x3b')](function(_0x26bc80){return Number(_0x26bc80);});_0xb83dfd['forEach'](function(_0x3649cc){_0x11545a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3649cc+',%');});_0x37edaa=_[_0x0a9e('0x71')](_0x37edaa,_0xb83dfd);break;case'User':if(_0x161aa7['operator']==='$substring'){_0x1adfee[_0x39d77d](_0x0a9e('0x72'),'%'+_0x161aa7['value']+'%',null);}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x73')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x73');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381['type'],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case'body':_0xe05a5a=as[_0x0a9e('0x6d')]('me',null,_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a['value'][_0x0a9e('0x1c')]);break;}}else{var _0xe05a5a=as['buildExpression'](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')]['end']);}}}else{var _0x176840=_(_0x5640eb[_0x0a9e('0x41')])[_0x0a9e('0x74')]()['map'](function(_0x3528b7){return _['some'](_0x4f41ae,['name',_0x3528b7])?_0x3528b7:undefined;})[_0x0a9e('0x75')]()[_0x0a9e('0x65')]();if(!_[_0x0a9e('0x76')](_0x176840)){_0x176840[_0x0a9e('0x39')](function(_0x186f39){if(_0x186f39===_0x0a9e('0x77')){_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),[][_0x0a9e('0x79')](_0x5640eb[_0x0a9e('0x41')][_0x186f39]));}else if(_0x186f39===_0x0a9e('0x7a')){var _0x19012b=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])[_0x0a9e('0x7c')];var _0x412a72=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])['$lte'];_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x7d'),_0x19012b,_0x412a72);}else{if(_0x5640eb[_0x0a9e('0x41')][_0x186f39]==='null'){_0x7f6eb1[_0x0a9e('0x4c')]('i.'+_0x186f39+_0x0a9e('0x7e'));}else{_0x7f6eb1['where']('i.'+_0x186f39+_0x0a9e('0x7f'),_0x5640eb[_0x0a9e('0x41')][_0x186f39]);}}});}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x80')]){if(_0x5640eb[_0x0a9e('0x41')]['read']==0x1){_0x7f6eb1['having']('`unreadMessages`\x20=\x200');}else{_0x7f6eb1[_0x0a9e('0x81')](_0x0a9e('0x82'));}}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]){_0x37edaa=_[_0x0a9e('0x84')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')])?_0x5640eb[_0x0a9e('0x41')]['tag']:new Array(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]);_0x37edaa[_0x0a9e('0x39')](function(_0x4a4fc7){_0x11545a['or'](_0x0a9e('0x85'),'%,'+_0x4a4fc7+',%');});}if(_0x5640eb['query'][_0x0a9e('0x86')]){var _0x44351d=_0x5640eb['query'][_0x0a9e('0x86')][_0x0a9e('0x87')]('\x5c','\x5c\x5c')[_0x0a9e('0x87')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x88')](_0x44351d)){_0x1adfee['or']('i.id\x20LIKE\x20?',_0x44351d+'%');}else{_0x1adfee['or'](_0x0a9e('0x89'),qs[_0x0a9e('0x8a')](_0x44351d))['or'](_0x0a9e('0x8b'),_0x44351d+'%')['or'](_0x0a9e('0x8c'),_0x44351d+'%');}}}_0x7f6eb1['where'](_0x1adfee);_0x7f6eb1[_0x0a9e('0x8d')](_0x0a9e('0x8e'));var _0x2d5506={'type':db[_0x0a9e('0x8f')]['QueryTypes'][_0x0a9e('0x90')],'raw':!![]};var _0x3511c9=_0x7f6eb1[_0x0a9e('0x91')]();_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x8e'));_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x92'),_0x0a9e('0x64'));if(_0x3d9717[_0x0a9e('0x4a')]){_0x3d9717[_0x0a9e('0x4a')][_0x0a9e('0x39')](function(_0x1f10ef){var _0x25744a=_0x1f10ef[0x0]===_0x0a9e('0x93')?_0x1f10ef[0x0]:'i.'+_0x1f10ef[0x0];_0x7f6eb1['order'](_0x25744a,_0x1f10ef[0x1]===_0x0a9e('0x94')?![]:!![]);});}if(!_[_0x0a9e('0x76')](_0x37edaa)){_0x7f6eb1[_0x0a9e('0x81')](_0x11545a);_0x3511c9['where'](_0x0a9e('0x95'),_0x37edaa);}BPromise[_0x0a9e('0x96')]()[_0x0a9e('0x27')](function(){if(!_0x30decb){if(_0x5640eb[_0x0a9e('0x41')]['OpenchannelAccountId'])return;_0x3511c9['where'](_0x0a9e('0x97'));_0x7f6eb1[_0x0a9e('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5640eb[_0x0a9e('0x98')]['role']!==_0x0a9e('0x31'))return;return _0x5640eb[_0x0a9e('0x98')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x27')](function(_0x41cf12){if(_[_0x0a9e('0x76')](_0x41cf12)){_0x3511c9[_0x0a9e('0x4c')](_0x0a9e('0x99'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x99'));}else{_0x3511c9['where'](_0x0a9e('0x78'),_[_0x0a9e('0x3b')](_0x41cf12,'id'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),_['map'](_0x41cf12,'id'));}});})[_0x0a9e('0x27')](function(){if(_0x5640eb[_0x0a9e('0x98')]['role']===_0x0a9e('0x31')&&!_0x30decb&&!_0x5640eb['query'][_0x0a9e('0x77')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x3511c9[_0x0a9e('0x9b')](),_0x2d5506);})['then'](function(_0x51ccd7){_0x1ef87a[_0x0a9e('0x21')]=_0x51ccd7[_0x0a9e('0x47')];if(_0x1ef87a[_0x0a9e('0x21')]===0x0)return[];return db['sequelize'][_0x0a9e('0x41')](_0x445e25[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x4e46b2){_0x10b040=_[_0x0a9e('0x9c')](_0x4e46b2,'id');_0x2d5506=_['merge'](_0x2d5506,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5640eb['query'][_0x0a9e('0x45')]){_0x3d9717[_0x0a9e('0x46')][_0x0a9e('0x39')](function(_0x3bfadf){_0x7f6eb1[_0x0a9e('0x4f')]('i.'+_0x3bfadf);});}else{_0x7f6eb1[_0x0a9e('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x64'));_0x7f6eb1['field'](_0x0a9e('0x9d'),_0x0a9e('0x9e'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0x9f'),'Account.mandatoryDisposition');_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa0'),_0x0a9e('0x93'));_0x7f6eb1['field'](_0x0a9e('0xa1'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x7f6eb1[_0x0a9e('0x4f')]('c.email',_0x0a9e('0xa6'));_0x7f6eb1[_0x0a9e('0x4f')]('c.phone',_0x0a9e('0xa7'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa8'),'Contact.mobile');_0x7f6eb1[_0x0a9e('0x4f')]('c.fax',_0x0a9e('0xa9'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x7f6eb1[_0x0a9e('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0a9e('0x36'));}if(_0x3d9717[_0x0a9e('0x20')])_0x7f6eb1[_0x0a9e('0x20')](_0x3d9717[_0x0a9e('0x20')]);if(_0x3d9717[_0x0a9e('0x1e')])_0x7f6eb1[_0x0a9e('0x1e')](_0x3d9717[_0x0a9e('0x1e')]);return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x7f6eb1[_0x0a9e('0x9b')](),_0x2d5506);})[_0x0a9e('0x27')](function(_0x3754e2){if(_0x3754e2[_0x0a9e('0x47')]>0x0)_0xfbd5ad['where'](_0x0a9e('0xae'),_[_0x0a9e('0x3b')](_0x3754e2,'id'));return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0xfbd5ad[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x3afc8c){var _0x1756c7=_['groupBy'](_0x3afc8c,_0x0a9e('0xaf'));var _0x5e725e=[];_0x3754e2[_0x0a9e('0x39')](function(_0x27041d){_0x5e725e[_0x0a9e('0xb0')](updateOpenchannelInteraction(_0x27041d,_0x10b040,_0x1756c7));});return BPromise[_0x0a9e('0xb1')](_0x5e725e);});});})['then'](function(_0x3ceba6){_0x1ef87a['rows']=_0x3ceba6;return _0x1ef87a;})[_0x0a9e('0x27')](respondWithFilteredResult(_0x24936a,_0x3d9717))[_0x0a9e('0xb2')](handleError(_0x24936a,null));};exports['show']=function(_0x231c6a,_0x63c9f7){var _0x1dd541={};if(_0x231c6a['query']['type']&&_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0x3f')]===_0x0a9e('0x51')){_0x1dd541[_0x0a9e('0x51')]=_0x231c6a[_0x0a9e('0xb3')]['id'];}else{_0x1dd541['id']=_0x231c6a[_0x0a9e('0xb3')]['id'];}var _0x17793e={'raw':![],'where':_0x1dd541},_0x3c75b9={};_0x3c75b9[_0x0a9e('0x44')]=_['keys'](db[_0x0a9e('0x3c')]['rawAttributes']);_0x3c75b9[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x231c6a[_0x0a9e('0x41')]);_0x3c75b9[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x3c75b9['model'],_0x3c75b9[_0x0a9e('0x41')]);_0x17793e[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x3c75b9[_0x0a9e('0x44')],qs[_0x0a9e('0x45')](_0x231c6a['query']['fields']));_0x17793e[_0x0a9e('0x46')]=_0x17793e['attributes'][_0x0a9e('0x47')]?_0x17793e[_0x0a9e('0x46')]:_0x3c75b9[_0x0a9e('0x44')];if(_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x17793e[_0x0a9e('0xb5')]=[{'all':!![]}];}_0x17793e=_['merge']({},_0x17793e,_0x231c6a['options']);return db[_0x0a9e('0x3c')]['find'](_0x17793e)[_0x0a9e('0x27')](handleEntityNotFound(_0x63c9f7,null))['then'](respondWithResult(_0x63c9f7,null))[_0x0a9e('0xb2')](handleError(_0x63c9f7,null));};exports['create']=function(_0x558d60,_0x1c49dc){return db[_0x0a9e('0x3c')]['create'](_0x558d60[_0x0a9e('0x2e')],{})[_0x0a9e('0x27')](respondWithResult(_0x1c49dc,0xc9))[_0x0a9e('0xb2')](handleError(_0x1c49dc,null));};exports[_0x0a9e('0x26')]=function(_0x2eb028,_0x5ab0bc){if(_0x2eb028['body']['id']){delete _0x2eb028[_0x0a9e('0x2e')]['id'];}return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x2eb028[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x5ab0bc,null))['then'](saveUpdates(_0x2eb028[_0x0a9e('0x2e')],null))[_0x0a9e('0x27')](respondWithResult(_0x5ab0bc,null))['catch'](handleError(_0x5ab0bc,null));};exports[_0x0a9e('0x28')]=function(_0x19fd11,_0xcacabb){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x19fd11[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xcacabb,null))[_0x0a9e('0x27')](removeEntity(_0xcacabb,null))[_0x0a9e('0xb2')](handleError(_0xcacabb,null));};exports[_0x0a9e('0xb6')]=function(_0x4bdebb,_0x1065a7){return db[_0x0a9e('0x3c')][_0x0a9e('0xb6')]()[_0x0a9e('0x27')](respondWithResult(_0x1065a7,null))[_0x0a9e('0xb2')](handleError(_0x1065a7,null));};exports['addMessage']=function(_0x500868,_0x21902c,_0x16ae1a){return db[_0x0a9e('0xb7')][_0x0a9e('0x6b')]({'where':{'id':_0x500868[_0x0a9e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x21902c,null))[_0x0a9e('0x27')](function(_0x3c775a){if(_0x3c775a){return _0x3c775a[_0x0a9e('0xb8')](_0x500868['body'][_0x0a9e('0xb9')],_['omit'](_0x500868[_0x0a9e('0x2e')],['ids','id'])||{});}})[_0x0a9e('0x27')](respondWithResult(_0x21902c,null))[_0x0a9e('0xb2')](handleError(_0x21902c,null));};exports[_0x0a9e('0xba')]=function(_0x5c500c,_0xc9529d,_0x5ed560){var _0x4383da={'raw':![],'where':{}};var _0x2b1824={};var _0x43a00a={'count':0x0,'rows':[]};return db[_0x0a9e('0x3c')][_0x0a9e('0xbb')]({'where':{'id':_0x5c500c[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xc9529d,null))[_0x0a9e('0x27')](function(_0x2aaf07){if(_0x2aaf07){_0x2b1824[_0x0a9e('0x44')]=_[_0x0a9e('0x74')](db[_0x0a9e('0xb7')][_0x0a9e('0x3d')]);_0x2b1824[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x5c500c[_0x0a9e('0x41')]);_0x2b1824['filters']=_['intersection'](_0x2b1824[_0x0a9e('0x44')],_0x2b1824['query']);_0x4383da[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x2b1824['model'],qs[_0x0a9e('0x45')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x4383da[_0x0a9e('0x46')]=_0x4383da['attributes'][_0x0a9e('0x47')]?_0x4383da[_0x0a9e('0x46')]:_0x2b1824[_0x0a9e('0x44')];if(!_0x5c500c[_0x0a9e('0x41')]['hasOwnProperty'](_0x0a9e('0x49'))){_0x4383da[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5c500c['query'][_0x0a9e('0x20')]);_0x4383da[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5c500c['query'][_0x0a9e('0x1e')]);}_0x4383da[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x4b')]);_0x4383da['where']=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5c500c['query'],_0x2b1824[_0x0a9e('0x42')]));_0x4383da[_0x0a9e('0x4c')][_0x0a9e('0xaf')]=_0x2aaf07['id'];if(_0x5c500c['query']['filter']){_0x4383da['where']=_[_0x0a9e('0xbc')](_0x4383da[_0x0a9e('0x4c')],{'$or':_['map'](_0x4383da[_0x0a9e('0x46')],function(_0x1f78b4){var _0x2a8d55={};_0x2a8d55[_0x1f78b4]={'$like':'%'+_0x5c500c['query'][_0x0a9e('0x86')]+'%'};return _0x2a8d55;})});}if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')]){var _0x30b3b8=_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')][_0x0a9e('0x38')](',');var _0x328ec5={};_0x328ec5[_0x30b3b8[0x0]]={'$gte':moment(_0x30b3b8[0x1])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4383da[_0x0a9e('0x4c')]=_['merge'](_0x4383da[_0x0a9e('0x4c')],_0x328ec5);}_0x4383da=_[_0x0a9e('0xbc')]({},_0x4383da,_0x5c500c[_0x0a9e('0xbe')]);return db[_0x0a9e('0xb7')][_0x0a9e('0x21')]({'where':_0x4383da[_0x0a9e('0x4c')]})['then'](function(_0x1a0314){_0x43a00a[_0x0a9e('0x21')]=_0x1a0314;if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x4383da['include']=[{'all':!![]}];}return db[_0x0a9e('0xb7')][_0x0a9e('0xbf')](_0x4383da);})[_0x0a9e('0x27')](function(_0x1c9539){_0x43a00a[_0x0a9e('0xc0')]=_0x1c9539;return _0x43a00a;});}})[_0x0a9e('0x27')](respondWithFilteredResult(_0xc9529d,_0x4383da))[_0x0a9e('0xb2')](handleError(_0xc9529d,null));};exports[_0x0a9e('0xc1')]=function(_0x3299b7,_0x3539b7,_0x57f0ad){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x3299b7[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x3539b7,null))[_0x0a9e('0x27')](function(_0x253f74){if(_0x253f74){return _0x253f74[_0x0a9e('0xc2')](_0x3299b7[_0x0a9e('0x2e')]['ids'],_[_0x0a9e('0xc3')](_0x3299b7[_0x0a9e('0x2e')],[_0x0a9e('0xb9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0x70')][_0x0a9e('0xbf')]({'attributes':['id',_0x0a9e('0x2b'),_0x0a9e('0x50')],'where':{'id':_0x3299b7[_0x0a9e('0x2e')][_0x0a9e('0xb9')]}});})[_0x0a9e('0x27')](function(_0x336a19){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x3299b7['params']['id']),'tags':_0x336a19||[]});return{'id':Number(_0x3299b7[_0x0a9e('0xb3')]['id']),'tags':_0x336a19||[]};});}})[_0x0a9e('0x27')](respondWithResult(_0x3539b7,null))[_0x0a9e('0xb2')](handleError(_0x3539b7,null));};exports[_0x0a9e('0xc6')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x2b624e['params']['id']}})['then'](handleEntityNotFound(_0x3942fd,null))[_0x0a9e('0x27')](function(_0x3fa3f2){if(_0x3fa3f2){return _0x3fa3f2[_0x0a9e('0xc6')](_0x2b624e[_0x0a9e('0x41')]['ids']);}})[_0x0a9e('0x27')](respondWithStatusCode(_0x3942fd,null))[_0x0a9e('0xb2')](handleError(_0x3942fd,null));};exports[_0x0a9e('0xc7')]=function(_0x1fdb10,_0x2c8d1d){var _0x4b6c21=moment()['unix']()[_0x0a9e('0x9b')]();var _0x33bcb2=path[_0x0a9e('0xc8')](config['root'],_0x0a9e('0xc9'),_0x0a9e('0xca'),_0x0a9e('0xcb'));var _0x4cee8c=path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),'files',_0x0a9e('0xcd'));var _0x336b30=path[_0x0a9e('0xc8')](_0x33bcb2,_0x4b6c21);var _0x549e03=util['format']('transcript-%d-%s.zip',_0x1fdb10[_0x0a9e('0xb3')]['id'],_0x4b6c21);var _0x1f50db=path[_0x0a9e('0xc8')](_0x33bcb2,_0x549e03);var _0x26931c=[];_0x26931c['push']({'model':db[_0x0a9e('0xce')],'as':'User','attributes':['id',_0x0a9e('0x35')],'raw':!![]});_0x26931c[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xcf')],'as':'Contact','attributes':['id',_0x0a9e('0xd0'),_0x0a9e('0xd1')],'raw':!![]});if(_0x1fdb10[_0x0a9e('0x41')]['attachments']){_0x26931c[_0x0a9e('0xb0')]({'model':db['Attachment'],'as':_0x0a9e('0xd2'),'raw':!![]});}var _0x5c57e1=[{'model':db[_0x0a9e('0xb7')],'as':'Messages','attributes':['id',_0x0a9e('0x2e'),_0x0a9e('0x7a'),_0x0a9e('0xd3'),_0x0a9e('0xd4'),_0x0a9e('0x80')],'include':_0x26931c}];_0x5c57e1[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xd5')],'as':'Account','attributes':['id',_0x0a9e('0x2b')]});_0x5c57e1[_0x0a9e('0xb0')]({'model':db['User'],'as':_0x0a9e('0xd6'),'attributes':['id',_0x0a9e('0x35')]});return db['OpenchannelInteraction'][_0x0a9e('0x6b')]({'where':{'id':_0x1fdb10[_0x0a9e('0xb3')]['id']},'include':_0x5c57e1})[_0x0a9e('0x27')](handleEntityNotFound(_0x2c8d1d,null))['then'](function(_0x3766d7){if(_0x3766d7){var _0xf49ed4=_0x3766d7[_0x0a9e('0xd7')]({'plain':!![]});fs[_0x0a9e('0xd8')](_0x336b30);var _0x2003bc={'channel':_0x0a9e('0xd9'),'account':_0xf49ed4[_0x0a9e('0xda')][_0x0a9e('0x2b')],'agent':_0xf49ed4[_0x0a9e('0xd6')]?_0xf49ed4[_0x0a9e('0xd6')]['fullname']:_0x0a9e('0xdb'),'createdAt':moment(_0xf49ed4['createdAt'])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'closedAt':_0xf49ed4[_0x0a9e('0xdd')]?moment(_0xf49ed4[_0x0a9e('0xde')])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x9b')]():'','disposition':_0xf49ed4[_0x0a9e('0xdf')],'visibility':_0xf49ed4[_0x0a9e('0xe0')]?'Public':_0x0a9e('0xe1'),'messages':_(_0xf49ed4[_0x0a9e('0xe2')])[_0x0a9e('0x86')]({'secret':![]})[_0x0a9e('0x3b')](function(_0x31e1e0){if(_0x31e1e0[_0x0a9e('0xd2')]){var _0x1e93f5=path['join'](_0x4cee8c,_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]);if(fs[_0x0a9e('0xe4')](_0x1e93f5)){fs[_0x0a9e('0xe5')](_0x1e93f5)[_0x0a9e('0xe6')](fs[_0x0a9e('0xe7')](path[_0x0a9e('0xc8')](_0x336b30,_0x31e1e0['Attachment']['basename'])));}}return{'date':moment(_0x31e1e0[_0x0a9e('0x7a')])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'sender':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?_0x31e1e0[_0x0a9e('0xce')]?_0x31e1e0['User'][_0x0a9e('0x35')]:_0x0a9e('0xe9'):_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd0')]+(_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd1')]?'\x20'+_0x31e1e0[_0x0a9e('0x68')]['lastName']:''),'body':_0x31e1e0[_0x0a9e('0xd2')]?_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]:_0x31e1e0['body'],'direction':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?'A':'C','secret':_0x31e1e0[_0x0a9e('0xd4')],'read':_0x31e1e0[_0x0a9e('0x80')],'attachment':_0x31e1e0['Attachment']};})[_0x0a9e('0x65')]()};return ejs[_0x0a9e('0xea')](path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),_0x0a9e('0xeb'),_0x0a9e('0xec')),{'interaction':_0x2003bc})[_0x0a9e('0x27')](function(_0x4e5dec){var _0x3ede01=path[_0x0a9e('0xc8')](_0x336b30,_0x0a9e('0xed')+_0xf49ed4['id']+'-'+_0x4b6c21+_0x0a9e('0xee'));var _0x5f4c6f={'path':_0x3ede01,'channel':'Openchannel','interactionId':_0xf49ed4['id']};return pdf[_0x0a9e('0xef')](_0x4e5dec,_0x5f4c6f);})[_0x0a9e('0x27')](function(){return new BPromise(function(_0x44cd25,_0x596ba3){zipdir(_0x336b30,{'saveTo':_0x1f50db},function(_0x3ccede,_0x40180d){if(_0x3ccede)return _0x596ba3(_0x3ccede);return _0x44cd25(_0x40180d);});})['then'](function(){return new BPromise(function(_0x1970f1,_0x5d19b1){rimraf(_0x336b30,function(_0x35cc2a){if(_0x35cc2a)_0x5d19b1(_0x35cc2a);return _0x1970f1();});});})['then'](function(){return _0x2c8d1d['download'](_0x1f50db,_0x549e03,function(_0x48eaa3){if(_0x48eaa3){console[_0x0a9e('0xf0')](_0x0a9e('0xf1'),_0x48eaa3);}else{fs[_0x0a9e('0xf2')](_0x1f50db);}});});});}else{return _0x2c8d1d[_0x0a9e('0x1b')](0xc8);}})[_0x0a9e('0xb2')](handleError(_0x2c8d1d,null));}; \ No newline at end of file +var _0xa9e0=['omit','emit','openchannelInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','User','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','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','../../components/export/pdf','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','error','stack','name','send','render','body','contact','message','agent','interaction','account','Users','fullname','TagIds','Tags','split','forEach','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','all','catch','params','includeAll','include','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','merge','format','options','findAll','rows','addTags','setTags'];(function(_0x2654e8,_0x94edf){var _0x5939f1=function(_0x3c31b4){while(--_0x3c31b4){_0x2654e8['push'](_0x2654e8['shift']());}};_0x5939f1(++_0x94edf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 pdf=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=typeof _0x459eb1[_0x0a9e('0x1e')]===_0x0a9e('0x1f')&&typeof _0x459eb1[_0x0a9e('0x20')]===_0x0a9e('0x1f');var _0x20559e=_0x478723[_0x0a9e('0x21')];var _0x112016=_0x106033?0x0:_0x459eb1[_0x0a9e('0x1e')];var _0x105080=_0x106033?_0x478723['count']:_0x459eb1[_0x0a9e('0x1e')]+_0x459eb1[_0x0a9e('0x20')];var _0x53682f;if(_0x105080>=_0x20559e){_0x105080=_0x20559e;_0x53682f=0xc8;}else{_0x53682f=0xce;}_0x5a0a06[_0x0a9e('0x22')](_0x53682f);return _0x5a0a06['set']('Content-Range',_0x112016+'-'+_0x105080+'/'+_0x20559e)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x432e56){return function(_0x38e7c4){try{jsonpatch[_0x0a9e('0x23')](_0x38e7c4,_0x432e56,!![]);}catch(_0x4abc77){return BPromise[_0x0a9e('0x24')](_0x4abc77);}return _0x38e7c4[_0x0a9e('0x25')]();};}function saveUpdates(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')](_0x3b45bc)[_0x0a9e('0x27')](function(_0x5ea472){return _0x5ea472;});}return null;};}function removeEntity(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(_0x3a8e58){return _0x3a8e58[_0x0a9e('0x28')]()[_0x0a9e('0x27')](function(){_0x59181e['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(!_0x5bfb33){_0x479bc4[_0x0a9e('0x1b')](0x194);}return _0x5bfb33;};}function handleError(_0x34dc65,_0x25fba9){_0x25fba9=_0x25fba9||0x1f4;return function(_0x14433c){logger[_0x0a9e('0x29')](_0x14433c[_0x0a9e('0x2a')]);if(_0x14433c[_0x0a9e('0x2b')]){delete _0x14433c[_0x0a9e('0x2b')];}_0x34dc65['status'](_0x25fba9)[_0x0a9e('0x2c')](_0x14433c);};}function getMustacheRender(_0x468813,_0x2b1f27){return Mustache[_0x0a9e('0x2d')](_0x468813,_['merge'](_0x2b1f27[_0x0a9e('0x2e')],{'contact':_0x2b1f27[_0x0a9e('0x2f')],'message':_0x2b1f27[_0x0a9e('0x30')],'agent':_0x2b1f27[_0x0a9e('0x31')],'interaction':_0x2b1f27[_0x0a9e('0x32')],'account':_0x2b1f27[_0x0a9e('0x33')]}))||'';}function getInteractionUsers(_0x296f41,_0x2e8759){return new BPromise(function(_0x1dbde2,_0x540530){try{if(_0x2e8759[_0x296f41['id']]){_0x296f41[_0x0a9e('0x34')]=_['map'](_0x2e8759[_0x296f41['id']],function(_0x2407f9){return{'id':_0x2407f9['id'],'fullname':_0x2407f9[_0x0a9e('0x35')]};});}}catch(_0x1122db){_0x540530(_0x1122db);}_0x1dbde2(_0x296f41);});}function getInteractionTags(_0x33bdb7,_0x25ce3a){return new BPromise(function(_0x5180f1,_0x66c1d2){try{if(_0x33bdb7[_0x0a9e('0x36')]){_0x33bdb7[_0x0a9e('0x37')]=[];_0x33bdb7[_0x0a9e('0x36')][_0x0a9e('0x38')](',')[_0x0a9e('0x39')](function(_0x332d35){_0x33bdb7[_0x0a9e('0x37')]['push'](_0x25ce3a[_0x332d35]);});}delete _0x33bdb7[_0x0a9e('0x36')];}catch(_0x5e7238){_0x66c1d2(_0x5e7238);}_0x5180f1(_0x33bdb7);});}function updateOpenchannelInteraction(_0x2cc7a0,_0x14b13f,_0x2b7e7f){return new BPromise(function(_0x3f3d41,_0x567193){return getInteractionUsers(_0x2cc7a0,_0x2b7e7f)[_0x0a9e('0x27')](function(_0xd1836d){return getInteractionTags(_0xd1836d,_0x14b13f);})[_0x0a9e('0x27')](function(_0x15de0e){_0x3f3d41(_0x15de0e);})['catch'](function(_0x54135e){_0x567193(_0x54135e);});});}exports[_0x0a9e('0x3a')]=function(_0x5640eb,_0x24936a){var _0x3d9717={},_0x381c37={},_0x1ef87a={'count':0x0,'rows':[]};var _0x4f41ae=_[_0x0a9e('0x3b')](db[_0x0a9e('0x3c')][_0x0a9e('0x3d')],function(_0x533942){return{'name':_0x533942[_0x0a9e('0x3e')],'type':_0x533942[_0x0a9e('0x3f')][_0x0a9e('0x40')]};});_0x381c37['model']=_['map'](_0x4f41ae,_0x0a9e('0x2b'));_0x381c37[_0x0a9e('0x41')]=_['keys'](_0x5640eb[_0x0a9e('0x41')]);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],_0x381c37['query']);_0x3d9717['attributes']=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],qs['fields'](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x3d9717[_0x0a9e('0x46')]=_0x3d9717['attributes'][_0x0a9e('0x47')]?_0x3d9717[_0x0a9e('0x46')]:_0x381c37[_0x0a9e('0x44')];if(!_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x3d9717[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x20')]);_0x3d9717[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x1e')]);}_0x3d9717[_0x0a9e('0x4a')]=qs['sort'](_0x5640eb['query'][_0x0a9e('0x4b')]);_0x3d9717[_0x0a9e('0x4c')]=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5640eb[_0x0a9e('0x41')],_0x381c37[_0x0a9e('0x42')]),_0x4f41ae);var _0x10b040=[];var _0x445e25=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')]('id')[_0x0a9e('0x4f')](_0x0a9e('0x2b'))['field'](_0x0a9e('0x50'))[_0x0a9e('0x51')](_0x0a9e('0x52'));var _0xfbd5ad=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')](_0x0a9e('0x53'))[_0x0a9e('0x4f')]('u.fullname')[_0x0a9e('0x4f')]('ui.OpenchannelInteractionId')[_0x0a9e('0x51')](_0x0a9e('0x54'),'ui')[_0x0a9e('0x55')]('users','u',_0x0a9e('0x56'));var _0x7f6eb1=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x51')](_0x0a9e('0x57'),'i')[_0x0a9e('0x55')](_0x0a9e('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0a9e('0x55')](_0x0a9e('0x59'),'o',_0x0a9e('0x5a'))[_0x0a9e('0x55')](_0x0a9e('0x5b'),'a',_0x0a9e('0x5c'))[_0x0a9e('0x55')](_0x0a9e('0x5d'),'me',_0x0a9e('0x5e'))['left_join'](_0x0a9e('0x5f'),'it',_0x0a9e('0x60'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1adfee=squel[_0x0a9e('0x61')]();var _0x37edaa=[];var _0x11545a=squel[_0x0a9e('0x61')]();var _0x30decb;if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x62')]){_0x30decb=as['parseSearch'](_0x5640eb['query']['search']);var _0x39d77d=_0x30decb[_0x0a9e('0x63')];for(var _0x14d602=0x0;_0x14d602<_0x30decb['conditions'][_0x0a9e('0x47')];_0x14d602++){var _0x161aa7=_0x30decb['conditions'][_0x14d602];var _0x5a88da='i';var _0x2ef381=_['find'](_0x4f41ae,[_0x0a9e('0x2b'),_0x161aa7['field']]);if(!_0x2ef381){switch(_0x161aa7[_0x0a9e('0x4f')]){case _0x0a9e('0x64'):if(_0x161aa7[_0x0a9e('0x65')]==0x1){_0x7f6eb1['having']('`'+_0x161aa7[_0x0a9e('0x4f')]+_0x0a9e('0x66'));}else{_0x7f6eb1['having']('`'+_0x161aa7['field']+_0x0a9e('0x67'));}break;case _0x0a9e('0x68'):if(_0x161aa7['operator']===_0x0a9e('0x69')){if(_0x161aa7['value'][_0x0a9e('0x38')]('\x20')['length']>0x1){_0x1adfee[_0x39d77d](_0x0a9e('0x6a'),qs['getFullTextValue'](_0x161aa7['value']),null);}else{var _0x5df0ad='%'+_0x161aa7[_0x0a9e('0x65')]+'%';_0x1adfee[_0x39d77d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5df0ad,_0x5df0ad,_0x5df0ad);}}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x6c')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x6c');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case _0x0a9e('0x70'):var _0xb83dfd=_0x161aa7[_0x0a9e('0x65')]['split'](',')[_0x0a9e('0x3b')](function(_0x26bc80){return Number(_0x26bc80);});_0xb83dfd['forEach'](function(_0x3649cc){_0x11545a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3649cc+',%');});_0x37edaa=_[_0x0a9e('0x71')](_0x37edaa,_0xb83dfd);break;case'User':if(_0x161aa7['operator']==='$substring'){_0x1adfee[_0x39d77d](_0x0a9e('0x72'),'%'+_0x161aa7['value']+'%',null);}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x73')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x73');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381['type'],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case'body':_0xe05a5a=as[_0x0a9e('0x6d')]('me',null,_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a['value'][_0x0a9e('0x1c')]);break;}}else{var _0xe05a5a=as['buildExpression'](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')]['end']);}}}else{var _0x176840=_(_0x5640eb[_0x0a9e('0x41')])[_0x0a9e('0x74')]()['map'](function(_0x3528b7){return _['some'](_0x4f41ae,['name',_0x3528b7])?_0x3528b7:undefined;})[_0x0a9e('0x75')]()[_0x0a9e('0x65')]();if(!_[_0x0a9e('0x76')](_0x176840)){_0x176840[_0x0a9e('0x39')](function(_0x186f39){if(_0x186f39===_0x0a9e('0x77')){_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),[][_0x0a9e('0x79')](_0x5640eb[_0x0a9e('0x41')][_0x186f39]));}else if(_0x186f39===_0x0a9e('0x7a')){var _0x19012b=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])[_0x0a9e('0x7c')];var _0x412a72=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])['$lte'];_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x7d'),_0x19012b,_0x412a72);}else{if(_0x5640eb[_0x0a9e('0x41')][_0x186f39]==='null'){_0x7f6eb1[_0x0a9e('0x4c')]('i.'+_0x186f39+_0x0a9e('0x7e'));}else{_0x7f6eb1['where']('i.'+_0x186f39+_0x0a9e('0x7f'),_0x5640eb[_0x0a9e('0x41')][_0x186f39]);}}});}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x80')]){if(_0x5640eb[_0x0a9e('0x41')]['read']==0x1){_0x7f6eb1['having']('`unreadMessages`\x20=\x200');}else{_0x7f6eb1[_0x0a9e('0x81')](_0x0a9e('0x82'));}}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]){_0x37edaa=_[_0x0a9e('0x84')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')])?_0x5640eb[_0x0a9e('0x41')]['tag']:new Array(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]);_0x37edaa[_0x0a9e('0x39')](function(_0x4a4fc7){_0x11545a['or'](_0x0a9e('0x85'),'%,'+_0x4a4fc7+',%');});}if(_0x5640eb['query'][_0x0a9e('0x86')]){var _0x44351d=_0x5640eb['query'][_0x0a9e('0x86')][_0x0a9e('0x87')]('\x5c','\x5c\x5c')[_0x0a9e('0x87')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x88')](_0x44351d)){_0x1adfee['or']('i.id\x20LIKE\x20?',_0x44351d+'%');}else{_0x1adfee['or'](_0x0a9e('0x89'),qs[_0x0a9e('0x8a')](_0x44351d))['or'](_0x0a9e('0x8b'),_0x44351d+'%')['or'](_0x0a9e('0x8c'),_0x44351d+'%');}}}_0x7f6eb1['where'](_0x1adfee);_0x7f6eb1[_0x0a9e('0x8d')](_0x0a9e('0x8e'));var _0x2d5506={'type':db[_0x0a9e('0x8f')]['QueryTypes'][_0x0a9e('0x90')],'raw':!![]};var _0x3511c9=_0x7f6eb1[_0x0a9e('0x91')]();_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x8e'));_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x92'),_0x0a9e('0x64'));if(_0x3d9717[_0x0a9e('0x4a')]){_0x3d9717[_0x0a9e('0x4a')][_0x0a9e('0x39')](function(_0x1f10ef){var _0x25744a=_0x1f10ef[0x0]===_0x0a9e('0x93')?_0x1f10ef[0x0]:'i.'+_0x1f10ef[0x0];_0x7f6eb1['order'](_0x25744a,_0x1f10ef[0x1]===_0x0a9e('0x94')?![]:!![]);});}if(!_[_0x0a9e('0x76')](_0x37edaa)){_0x7f6eb1[_0x0a9e('0x81')](_0x11545a);_0x3511c9['where'](_0x0a9e('0x95'),_0x37edaa);}BPromise[_0x0a9e('0x96')]()[_0x0a9e('0x27')](function(){if(!_0x30decb){if(_0x5640eb[_0x0a9e('0x41')]['OpenchannelAccountId'])return;_0x3511c9['where'](_0x0a9e('0x97'));_0x7f6eb1[_0x0a9e('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5640eb[_0x0a9e('0x98')]['role']!==_0x0a9e('0x31'))return;return _0x5640eb[_0x0a9e('0x98')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x27')](function(_0x41cf12){if(_[_0x0a9e('0x76')](_0x41cf12)){_0x3511c9[_0x0a9e('0x4c')](_0x0a9e('0x99'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x99'));}else{_0x3511c9['where'](_0x0a9e('0x78'),_[_0x0a9e('0x3b')](_0x41cf12,'id'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),_['map'](_0x41cf12,'id'));}});})[_0x0a9e('0x27')](function(){if(_0x5640eb[_0x0a9e('0x98')]['role']===_0x0a9e('0x31')&&!_0x30decb&&!_0x5640eb['query'][_0x0a9e('0x77')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x3511c9[_0x0a9e('0x9b')](),_0x2d5506);})['then'](function(_0x51ccd7){_0x1ef87a[_0x0a9e('0x21')]=_0x51ccd7[_0x0a9e('0x47')];if(_0x1ef87a[_0x0a9e('0x21')]===0x0)return[];return db['sequelize'][_0x0a9e('0x41')](_0x445e25[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x4e46b2){_0x10b040=_[_0x0a9e('0x9c')](_0x4e46b2,'id');_0x2d5506=_['merge'](_0x2d5506,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5640eb['query'][_0x0a9e('0x45')]){_0x3d9717[_0x0a9e('0x46')][_0x0a9e('0x39')](function(_0x3bfadf){_0x7f6eb1[_0x0a9e('0x4f')]('i.'+_0x3bfadf);});}else{_0x7f6eb1[_0x0a9e('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x64'));_0x7f6eb1['field'](_0x0a9e('0x9d'),_0x0a9e('0x9e'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0x9f'),'Account.mandatoryDisposition');_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa0'),_0x0a9e('0x93'));_0x7f6eb1['field'](_0x0a9e('0xa1'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x7f6eb1[_0x0a9e('0x4f')]('c.email',_0x0a9e('0xa6'));_0x7f6eb1[_0x0a9e('0x4f')]('c.phone',_0x0a9e('0xa7'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa8'),'Contact.mobile');_0x7f6eb1[_0x0a9e('0x4f')]('c.fax',_0x0a9e('0xa9'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x7f6eb1[_0x0a9e('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0a9e('0x36'));}if(_0x3d9717[_0x0a9e('0x20')])_0x7f6eb1[_0x0a9e('0x20')](_0x3d9717[_0x0a9e('0x20')]);if(_0x3d9717[_0x0a9e('0x1e')])_0x7f6eb1[_0x0a9e('0x1e')](_0x3d9717[_0x0a9e('0x1e')]);return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x7f6eb1[_0x0a9e('0x9b')](),_0x2d5506);})[_0x0a9e('0x27')](function(_0x3754e2){if(_0x3754e2[_0x0a9e('0x47')]>0x0)_0xfbd5ad['where'](_0x0a9e('0xae'),_[_0x0a9e('0x3b')](_0x3754e2,'id'));return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0xfbd5ad[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x3afc8c){var _0x1756c7=_['groupBy'](_0x3afc8c,_0x0a9e('0xaf'));var _0x5e725e=[];_0x3754e2[_0x0a9e('0x39')](function(_0x27041d){_0x5e725e[_0x0a9e('0xb0')](updateOpenchannelInteraction(_0x27041d,_0x10b040,_0x1756c7));});return BPromise[_0x0a9e('0xb1')](_0x5e725e);});});})['then'](function(_0x3ceba6){_0x1ef87a['rows']=_0x3ceba6;return _0x1ef87a;})[_0x0a9e('0x27')](respondWithFilteredResult(_0x24936a,_0x3d9717))[_0x0a9e('0xb2')](handleError(_0x24936a,null));};exports['show']=function(_0x231c6a,_0x63c9f7){var _0x1dd541={};if(_0x231c6a['query']['type']&&_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0x3f')]===_0x0a9e('0x51')){_0x1dd541[_0x0a9e('0x51')]=_0x231c6a[_0x0a9e('0xb3')]['id'];}else{_0x1dd541['id']=_0x231c6a[_0x0a9e('0xb3')]['id'];}var _0x17793e={'raw':![],'where':_0x1dd541},_0x3c75b9={};_0x3c75b9[_0x0a9e('0x44')]=_['keys'](db[_0x0a9e('0x3c')]['rawAttributes']);_0x3c75b9[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x231c6a[_0x0a9e('0x41')]);_0x3c75b9[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x3c75b9['model'],_0x3c75b9[_0x0a9e('0x41')]);_0x17793e[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x3c75b9[_0x0a9e('0x44')],qs[_0x0a9e('0x45')](_0x231c6a['query']['fields']));_0x17793e[_0x0a9e('0x46')]=_0x17793e['attributes'][_0x0a9e('0x47')]?_0x17793e[_0x0a9e('0x46')]:_0x3c75b9[_0x0a9e('0x44')];if(_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x17793e[_0x0a9e('0xb5')]=[{'all':!![]}];}_0x17793e=_['merge']({},_0x17793e,_0x231c6a['options']);return db[_0x0a9e('0x3c')]['find'](_0x17793e)[_0x0a9e('0x27')](handleEntityNotFound(_0x63c9f7,null))['then'](respondWithResult(_0x63c9f7,null))[_0x0a9e('0xb2')](handleError(_0x63c9f7,null));};exports['create']=function(_0x558d60,_0x1c49dc){return db[_0x0a9e('0x3c')]['create'](_0x558d60[_0x0a9e('0x2e')],{})[_0x0a9e('0x27')](respondWithResult(_0x1c49dc,0xc9))[_0x0a9e('0xb2')](handleError(_0x1c49dc,null));};exports[_0x0a9e('0x26')]=function(_0x2eb028,_0x5ab0bc){if(_0x2eb028['body']['id']){delete _0x2eb028[_0x0a9e('0x2e')]['id'];}return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x2eb028[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x5ab0bc,null))['then'](saveUpdates(_0x2eb028[_0x0a9e('0x2e')],null))[_0x0a9e('0x27')](respondWithResult(_0x5ab0bc,null))['catch'](handleError(_0x5ab0bc,null));};exports[_0x0a9e('0x28')]=function(_0x19fd11,_0xcacabb){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x19fd11[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xcacabb,null))[_0x0a9e('0x27')](removeEntity(_0xcacabb,null))[_0x0a9e('0xb2')](handleError(_0xcacabb,null));};exports[_0x0a9e('0xb6')]=function(_0x4bdebb,_0x1065a7){return db[_0x0a9e('0x3c')][_0x0a9e('0xb6')]()[_0x0a9e('0x27')](respondWithResult(_0x1065a7,null))[_0x0a9e('0xb2')](handleError(_0x1065a7,null));};exports['addMessage']=function(_0x500868,_0x21902c,_0x16ae1a){return db[_0x0a9e('0xb7')][_0x0a9e('0x6b')]({'where':{'id':_0x500868[_0x0a9e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x21902c,null))[_0x0a9e('0x27')](function(_0x3c775a){if(_0x3c775a){return _0x3c775a[_0x0a9e('0xb8')](_0x500868['body'][_0x0a9e('0xb9')],_['omit'](_0x500868[_0x0a9e('0x2e')],['ids','id'])||{});}})[_0x0a9e('0x27')](respondWithResult(_0x21902c,null))[_0x0a9e('0xb2')](handleError(_0x21902c,null));};exports[_0x0a9e('0xba')]=function(_0x5c500c,_0xc9529d,_0x5ed560){var _0x4383da={'raw':![],'where':{}};var _0x2b1824={};var _0x43a00a={'count':0x0,'rows':[]};return db[_0x0a9e('0x3c')][_0x0a9e('0xbb')]({'where':{'id':_0x5c500c[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xc9529d,null))[_0x0a9e('0x27')](function(_0x2aaf07){if(_0x2aaf07){_0x2b1824[_0x0a9e('0x44')]=_[_0x0a9e('0x74')](db[_0x0a9e('0xb7')][_0x0a9e('0x3d')]);_0x2b1824[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x5c500c[_0x0a9e('0x41')]);_0x2b1824['filters']=_['intersection'](_0x2b1824[_0x0a9e('0x44')],_0x2b1824['query']);_0x4383da[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x2b1824['model'],qs[_0x0a9e('0x45')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x4383da[_0x0a9e('0x46')]=_0x4383da['attributes'][_0x0a9e('0x47')]?_0x4383da[_0x0a9e('0x46')]:_0x2b1824[_0x0a9e('0x44')];if(!_0x5c500c[_0x0a9e('0x41')]['hasOwnProperty'](_0x0a9e('0x49'))){_0x4383da[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5c500c['query'][_0x0a9e('0x20')]);_0x4383da[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5c500c['query'][_0x0a9e('0x1e')]);}_0x4383da[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x4b')]);_0x4383da['where']=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5c500c['query'],_0x2b1824[_0x0a9e('0x42')]));_0x4383da[_0x0a9e('0x4c')][_0x0a9e('0xaf')]=_0x2aaf07['id'];if(_0x5c500c['query']['filter']){_0x4383da['where']=_[_0x0a9e('0xbc')](_0x4383da[_0x0a9e('0x4c')],{'$or':_['map'](_0x4383da[_0x0a9e('0x46')],function(_0x1f78b4){var _0x2a8d55={};_0x2a8d55[_0x1f78b4]={'$like':'%'+_0x5c500c['query'][_0x0a9e('0x86')]+'%'};return _0x2a8d55;})});}if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')]){var _0x30b3b8=_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')][_0x0a9e('0x38')](',');var _0x328ec5={};_0x328ec5[_0x30b3b8[0x0]]={'$gte':moment(_0x30b3b8[0x1])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4383da[_0x0a9e('0x4c')]=_['merge'](_0x4383da[_0x0a9e('0x4c')],_0x328ec5);}_0x4383da=_[_0x0a9e('0xbc')]({},_0x4383da,_0x5c500c[_0x0a9e('0xbe')]);return db[_0x0a9e('0xb7')][_0x0a9e('0x21')]({'where':_0x4383da[_0x0a9e('0x4c')]})['then'](function(_0x1a0314){_0x43a00a[_0x0a9e('0x21')]=_0x1a0314;if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x4383da['include']=[{'all':!![]}];}return db[_0x0a9e('0xb7')][_0x0a9e('0xbf')](_0x4383da);})[_0x0a9e('0x27')](function(_0x1c9539){_0x43a00a[_0x0a9e('0xc0')]=_0x1c9539;return _0x43a00a;});}})[_0x0a9e('0x27')](respondWithFilteredResult(_0xc9529d,_0x4383da))[_0x0a9e('0xb2')](handleError(_0xc9529d,null));};exports[_0x0a9e('0xc1')]=function(_0x3299b7,_0x3539b7,_0x57f0ad){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x3299b7[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x3539b7,null))[_0x0a9e('0x27')](function(_0x253f74){if(_0x253f74){return _0x253f74[_0x0a9e('0xc2')](_0x3299b7[_0x0a9e('0x2e')]['ids'],_[_0x0a9e('0xc3')](_0x3299b7[_0x0a9e('0x2e')],[_0x0a9e('0xb9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0x70')][_0x0a9e('0xbf')]({'attributes':['id',_0x0a9e('0x2b'),_0x0a9e('0x50')],'where':{'id':_0x3299b7[_0x0a9e('0x2e')][_0x0a9e('0xb9')]}});})[_0x0a9e('0x27')](function(_0x336a19){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x3299b7['params']['id']),'tags':_0x336a19||[]});return{'id':Number(_0x3299b7[_0x0a9e('0xb3')]['id']),'tags':_0x336a19||[]};});}})[_0x0a9e('0x27')](respondWithResult(_0x3539b7,null))[_0x0a9e('0xb2')](handleError(_0x3539b7,null));};exports[_0x0a9e('0xc6')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x2b624e['params']['id']}})['then'](handleEntityNotFound(_0x3942fd,null))[_0x0a9e('0x27')](function(_0x3fa3f2){if(_0x3fa3f2){return _0x3fa3f2[_0x0a9e('0xc6')](_0x2b624e[_0x0a9e('0x41')]['ids']);}})[_0x0a9e('0x27')](respondWithStatusCode(_0x3942fd,null))[_0x0a9e('0xb2')](handleError(_0x3942fd,null));};exports[_0x0a9e('0xc7')]=function(_0x1fdb10,_0x2c8d1d){var _0x4b6c21=moment()['unix']()[_0x0a9e('0x9b')]();var _0x33bcb2=path[_0x0a9e('0xc8')](config['root'],_0x0a9e('0xc9'),_0x0a9e('0xca'),_0x0a9e('0xcb'));var _0x4cee8c=path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),'files',_0x0a9e('0xcd'));var _0x336b30=path[_0x0a9e('0xc8')](_0x33bcb2,_0x4b6c21);var _0x549e03=util['format']('transcript-%d-%s.zip',_0x1fdb10[_0x0a9e('0xb3')]['id'],_0x4b6c21);var _0x1f50db=path[_0x0a9e('0xc8')](_0x33bcb2,_0x549e03);var _0x26931c=[];_0x26931c['push']({'model':db[_0x0a9e('0xce')],'as':'User','attributes':['id',_0x0a9e('0x35')],'raw':!![]});_0x26931c[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xcf')],'as':'Contact','attributes':['id',_0x0a9e('0xd0'),_0x0a9e('0xd1')],'raw':!![]});if(_0x1fdb10[_0x0a9e('0x41')]['attachments']){_0x26931c[_0x0a9e('0xb0')]({'model':db['Attachment'],'as':_0x0a9e('0xd2'),'raw':!![]});}var _0x5c57e1=[{'model':db[_0x0a9e('0xb7')],'as':'Messages','attributes':['id',_0x0a9e('0x2e'),_0x0a9e('0x7a'),_0x0a9e('0xd3'),_0x0a9e('0xd4'),_0x0a9e('0x80')],'include':_0x26931c}];_0x5c57e1[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xd5')],'as':'Account','attributes':['id',_0x0a9e('0x2b')]});_0x5c57e1[_0x0a9e('0xb0')]({'model':db['User'],'as':_0x0a9e('0xd6'),'attributes':['id',_0x0a9e('0x35')]});return db['OpenchannelInteraction'][_0x0a9e('0x6b')]({'where':{'id':_0x1fdb10[_0x0a9e('0xb3')]['id']},'include':_0x5c57e1})[_0x0a9e('0x27')](handleEntityNotFound(_0x2c8d1d,null))['then'](function(_0x3766d7){if(_0x3766d7){var _0xf49ed4=_0x3766d7[_0x0a9e('0xd7')]({'plain':!![]});fs[_0x0a9e('0xd8')](_0x336b30);var _0x2003bc={'channel':_0x0a9e('0xd9'),'account':_0xf49ed4[_0x0a9e('0xda')][_0x0a9e('0x2b')],'agent':_0xf49ed4[_0x0a9e('0xd6')]?_0xf49ed4[_0x0a9e('0xd6')]['fullname']:_0x0a9e('0xdb'),'createdAt':moment(_0xf49ed4['createdAt'])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'closedAt':_0xf49ed4[_0x0a9e('0xdd')]?moment(_0xf49ed4[_0x0a9e('0xde')])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x9b')]():'','disposition':_0xf49ed4[_0x0a9e('0xdf')],'visibility':_0xf49ed4[_0x0a9e('0xe0')]?'Public':_0x0a9e('0xe1'),'messages':_(_0xf49ed4[_0x0a9e('0xe2')])[_0x0a9e('0x86')]({'secret':![]})[_0x0a9e('0x3b')](function(_0x31e1e0){if(_0x31e1e0[_0x0a9e('0xd2')]){var _0x1e93f5=path['join'](_0x4cee8c,_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]);if(fs[_0x0a9e('0xe4')](_0x1e93f5)){fs[_0x0a9e('0xe5')](_0x1e93f5)[_0x0a9e('0xe6')](fs[_0x0a9e('0xe7')](path[_0x0a9e('0xc8')](_0x336b30,_0x31e1e0['Attachment']['basename'])));}}return{'date':moment(_0x31e1e0[_0x0a9e('0x7a')])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'sender':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?_0x31e1e0[_0x0a9e('0xce')]?_0x31e1e0['User'][_0x0a9e('0x35')]:_0x0a9e('0xe9'):_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd0')]+(_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd1')]?'\x20'+_0x31e1e0[_0x0a9e('0x68')]['lastName']:''),'body':_0x31e1e0[_0x0a9e('0xd2')]?_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]:_0x31e1e0['body'],'direction':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?'A':'C','secret':_0x31e1e0[_0x0a9e('0xd4')],'read':_0x31e1e0[_0x0a9e('0x80')],'attachment':_0x31e1e0['Attachment']};})[_0x0a9e('0x65')]()};return ejs[_0x0a9e('0xea')](path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),_0x0a9e('0xeb'),_0x0a9e('0xec')),{'interaction':_0x2003bc})[_0x0a9e('0x27')](function(_0x4e5dec){var _0x3ede01=path[_0x0a9e('0xc8')](_0x336b30,_0x0a9e('0xed')+_0xf49ed4['id']+'-'+_0x4b6c21+_0x0a9e('0xee'));var _0x5f4c6f={'path':_0x3ede01,'channel':'Openchannel','interactionId':_0xf49ed4['id']};return pdf[_0x0a9e('0xef')](_0x4e5dec,_0x5f4c6f);})[_0x0a9e('0x27')](function(){return new BPromise(function(_0x44cd25,_0x596ba3){zipdir(_0x336b30,{'saveTo':_0x1f50db},function(_0x3ccede,_0x40180d){if(_0x3ccede)return _0x596ba3(_0x3ccede);return _0x44cd25(_0x40180d);});})['then'](function(){return new BPromise(function(_0x1970f1,_0x5d19b1){rimraf(_0x336b30,function(_0x35cc2a){if(_0x35cc2a)_0x5d19b1(_0x35cc2a);return _0x1970f1();});});})['then'](function(){return _0x2c8d1d['download'](_0x1f50db,_0x549e03,function(_0x48eaa3){if(_0x48eaa3){console[_0x0a9e('0xf0')](_0x0a9e('0xf1'),_0x48eaa3);}else{fs[_0x0a9e('0xf2')](_0x1f50db);}});});});}else{return _0x2c8d1d[_0x0a9e('0x1b')](0xc8);}})[_0x0a9e('0xb2')](handleError(_0x2c8d1d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index aea3a0e..20cedf7 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 _0x9933=['length','emit','catch','hasOwnProperty','hook','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x2a938c,_0x3c0bcf){var _0x175e87=function(_0x5f13e6){while(--_0x5f13e6){_0x2a938c['push'](_0x2a938c['shift']());}};_0x175e87(++_0x3c0bcf);}(_0x9933,0xf5));var _0x3993=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9933[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x3993('0x0'))['db'][_0x3993('0x1')];var OpenchannelMessage=require(_0x3993('0x0'))['db'][_0x3993('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3993('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x480dd8){return function(_0x505898,_0x4635ba,_0x3ed161){_0x505898[_0x3993('0x4')]({'attributes':['id'],'raw':!![]})[_0x3993('0x5')](function(_0x31b0d8){_0x505898[_0x3993('0x6')](_0x3993('0x7'),_0x31b0d8[_0x3993('0x8')](function(_0x207dc5){return{'id':_0x207dc5['id']};}));return OpenchannelMessage[_0x3993('0x9')]({'where':{'OpenchannelInteractionId':_0x505898['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x264f3e){_0x505898[_0x3993('0x6')](_0x3993('0xa'),_0x264f3e[_0x3993('0xb')]);OpenchannelInteractionEvents[_0x3993('0xc')](_0x480dd8+':'+_0x505898['id'],_0x505898);OpenchannelInteractionEvents[_0x3993('0xc')](_0x480dd8,_0x505898);_0x3ed161(null);})[_0x3993('0xd')](_0x3ed161(null));};}for(var e in events){if(events[_0x3993('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x3993('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xf19a=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0xf19a,0x130));var _0xaf19=function(_0x171d07,_0x59c974){_0x171d07=_0x171d07-0x0;var _0x135563=_0xf19a[_0x171d07];return _0x135563;};'use strict';var EventEmitter=require(_0xaf19('0x0'));var OpenchannelInteraction=require(_0xaf19('0x1'))['db'][_0xaf19('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xaf19('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xaf19('0x4')](0x0);var events={'afterCreate':_0xaf19('0x5'),'afterUpdate':_0xaf19('0x6'),'afterDestroy':_0xaf19('0x7')};function emitEvent(_0x1b11c1){return function(_0x5b4aeb,_0x1ce70d,_0x3d59b7){_0x5b4aeb[_0xaf19('0x8')]({'attributes':['id'],'raw':!![]})[_0xaf19('0x9')](function(_0x26e8dc){_0x5b4aeb[_0xaf19('0xa')](_0xaf19('0xb'),_0x26e8dc['map'](function(_0xbcf885){return{'id':_0xbcf885['id']};}));return OpenchannelMessage[_0xaf19('0xc')]({'where':{'OpenchannelInteractionId':_0x5b4aeb['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaf19('0x9')](function(_0x2ce4ab){_0x5b4aeb[_0xaf19('0xa')](_0xaf19('0xd'),_0x2ce4ab['length']);OpenchannelInteractionEvents[_0xaf19('0xe')](_0x1b11c1+':'+_0x5b4aeb['id'],_0x5b4aeb);OpenchannelInteractionEvents[_0xaf19('0xe')](_0x1b11c1,_0x5b4aeb);_0x3d59b7(null);})['catch'](_0x3d59b7(null));};}for(var e in events){if(events[_0xaf19('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xaf19('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 25cbc32..4555dcd 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 _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x527c39,_0x3ea2a6){_0x527c39=_0x527c39-0x0;var _0x3f4dd6=_0xfdbd[_0x527c39];return _0x3f4dd6;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x188508,_0xf72a24,_0x47c629){if(_0x188508[_0xdfdb('0xa')](_0xdfdb('0xb'))){_0x188508[_0xdfdb('0xc')]=moment()[_0xdfdb('0xd')](_0xdfdb('0xe'));}_0x47c629(null,_0x188508);}}});}; \ No newline at end of file +var _0x4317=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x1e7714,_0x117ad1){var _0x1f20b6=function(_0x8d0f5b){while(--_0x8d0f5b){_0x1e7714['push'](_0x1e7714['shift']());}};_0x1f20b6(++_0x117ad1);}(_0x4317,0x7c));var _0x7431=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4317[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var fs=require('fs');var path=require(_0x7431('0x5'));var rimraf=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var attributes=require(_0x7431('0x8'));module['exports']=function(_0x57adc1,_0x1e1f35){return _0x57adc1[_0x7431('0x9')](_0x7431('0xa'),attributes,{'tableName':_0x7431('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4650df,_0x23e688,_0x1629c4){if(_0x4650df[_0x7431('0xc')](_0x7431('0xd'))){_0x4650df[_0x7431('0xe')]=moment()[_0x7431('0xf')](_0x7431('0x10'));}_0x1629c4(null,_0x4650df);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 147b4a0..d9f83d4 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 _0xa4cb=['stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','debug','AddTagsToOpenchannelInteraction','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x1abb9f,_0x4ad1d7){var _0x3b52be=function(_0x28f503){while(--_0x28f503){_0x1abb9f['push'](_0x1abb9f['shift']());}};_0x3b52be(++_0x4ad1d7);}(_0xa4cb,0x88));var _0xba4c=function(_0x8f8669,_0x41a6fb){_0x8f8669=_0x8f8669-0x0;var _0x59f91a=_0xa4cb[_0x8f8669];return _0x59f91a;};'use strict';var _=require('lodash');var util=require(_0xba4c('0x0'));var moment=require(_0xba4c('0x1'));var BPromise=require(_0xba4c('0x2'));var rs=require(_0xba4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba4c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba4c('0x5'))(_0xba4c('0x6'));var config=require(_0xba4c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba4c('0x8')][_0xba4c('0x9')]({'port':0x232a});config[_0xba4c('0xa')]=_[_0xba4c('0xb')](config[_0xba4c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xba4c('0xc'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xba4c('0xd')](socket);function respondWithRpcPromise(_0x1c2242,_0x16212c,_0x9f1ad1){return new BPromise(function(_0x15bd8c,_0x1daa32){return client[_0xba4c('0xe')](_0x1c2242,_0x9f1ad1)[_0xba4c('0xf')](function(_0x5c6e23){logger[_0xba4c('0x10')](_0xba4c('0x11'),_0x16212c,_0xba4c('0x12'));logger['debug'](_0xba4c('0x13'),_0x16212c,_0xba4c('0x12'),JSON[_0xba4c('0x14')](_0x5c6e23));if(_0x5c6e23[_0xba4c('0x15')]){if(_0x5c6e23[_0xba4c('0x15')][_0xba4c('0x16')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x16212c,_0x5c6e23[_0xba4c('0x15')]['message']);return _0x1daa32(_0x5c6e23['error']['message']);}logger[_0xba4c('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x16212c,_0x5c6e23[_0xba4c('0x15')][_0xba4c('0x17')]);return _0x15bd8c(_0x5c6e23[_0xba4c('0x15')][_0xba4c('0x17')]);}else{logger['info'](_0xba4c('0x11'),_0x16212c,_0xba4c('0x12'));_0x15bd8c(_0x5c6e23['result'][_0xba4c('0x17')]);}})[_0xba4c('0x18')](function(_0xfaf78){logger[_0xba4c('0x15')](_0xba4c('0x11'),_0x16212c,_0xfaf78);_0x1daa32(_0xfaf78);});});}exports[_0xba4c('0x19')]=function(_0x20aa43){var _0x3dad95=this;return new Promise(function(_0x31a38b,_0x52deca){return db[_0xba4c('0x1a')]['update'](_0x20aa43[_0xba4c('0x1b')],{'raw':_0x20aa43[_0xba4c('0x1c')]?_0x20aa43['options'][_0xba4c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20aa43[_0xba4c('0x1c')]?_0x20aa43[_0xba4c('0x1c')][_0xba4c('0x1e')]||null:null,'attributes':_0x20aa43[_0xba4c('0x1c')]?_0x20aa43[_0xba4c('0x1c')]['attributes']||null:null,'limit':_0x20aa43['options']?_0x20aa43[_0xba4c('0x1c')]['limit']||null:null})[_0xba4c('0xf')](function(_0x1797fc){logger[_0xba4c('0x10')]('UpdateOpenchannelInteraction',_0x20aa43);logger[_0xba4c('0x1f')](_0xba4c('0x19'),_0x20aa43,JSON[_0xba4c('0x14')](_0x1797fc));_0x31a38b(_0x1797fc);})[_0xba4c('0x18')](function(_0x3c59b0){logger[_0xba4c('0x15')](_0xba4c('0x19'),_0x3c59b0[_0xba4c('0x17')],_0x20aa43);_0x52deca(_0x3dad95[_0xba4c('0x15')](0x1f4,_0x3c59b0['message']));});});};exports[_0xba4c('0x20')]=function(_0x56e78a){return new Promise(function(_0x67b514,_0x4ab1c2){return db[_0xba4c('0x1a')][_0xba4c('0x21')]({'where':_0x56e78a[_0xba4c('0x1c')]?_0x56e78a[_0xba4c('0x1c')][_0xba4c('0x1e')]||null:null})[_0xba4c('0xf')](function(_0x4fb2bf){if(_0x4fb2bf){return _0x4fb2bf[_0xba4c('0x22')](_0x56e78a[_0xba4c('0x1b')]['ids'],_[_0xba4c('0x23')](_0x56e78a[_0xba4c('0x1b')],[_0xba4c('0x24'),'id'])||{});}})[_0xba4c('0x25')](function(_0x5ea40a){logger[_0xba4c('0x10')](_0xba4c('0x26'),_0x56e78a);logger['debug'](_0xba4c('0x26'),_0x56e78a,JSON[_0xba4c('0x14')](_0x5ea40a));_0x67b514(_0x5ea40a);})[_0xba4c('0x18')](function(_0x3f2f39){logger['error'](_0xba4c('0x26'),_0x3f2f39[_0xba4c('0x17')],_0x56e78a);_0x4ab1c2(_this['error'](0x1f4,_0x3f2f39['message']));});});}; \ No newline at end of file +var _0x150d=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x337110,_0x62161f){var _0x3c34cf=function(_0x10dd5f){while(--_0x10dd5f){_0x337110['push'](_0x337110['shift']());}};_0x3c34cf(++_0x62161f);}(_0x150d,0xa3));var _0xd150=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x150d[_0x15ec4e];return _0xb5e5dd;};'use strict';var _=require(_0xd150('0x0'));var util=require(_0xd150('0x1'));var moment=require(_0xd150('0x2'));var BPromise=require('bluebird');var rs=require(_0xd150('0x3'));var fs=require('fs');var Redis=require(_0xd150('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd150('0x5'));var logger=require(_0xd150('0x6'))(_0xd150('0x7'));var config=require(_0xd150('0x8'));var jayson=require(_0xd150('0x9'));var client=jayson['client'][_0xd150('0xa')]({'port':0x232a});config[_0xd150('0xb')]=_[_0xd150('0xc')](config['redis'],{'host':_0xd150('0xd'),'port':0x18eb});var socket=require(_0xd150('0xe'))(new Redis(config[_0xd150('0xb')]));require(_0xd150('0xf'))[_0xd150('0x10')](socket);function respondWithRpcPromise(_0x4d220a,_0x5d2c4f,_0x4c9727){return new BPromise(function(_0x58f257,_0x3c2fd3){return client['request'](_0x4d220a,_0x4c9727)[_0xd150('0x11')](function(_0x1550ef){logger[_0xd150('0x12')](_0xd150('0x13'),_0x5d2c4f,_0xd150('0x14'));logger[_0xd150('0x15')](_0xd150('0x16'),_0x5d2c4f,_0xd150('0x14'),JSON[_0xd150('0x17')](_0x1550ef));if(_0x1550ef[_0xd150('0x18')]){if(_0x1550ef['error']['code']===0x1f4){logger['error'](_0xd150('0x13'),_0x5d2c4f,_0x1550ef[_0xd150('0x18')][_0xd150('0x19')]);return _0x3c2fd3(_0x1550ef[_0xd150('0x18')]['message']);}logger[_0xd150('0x18')](_0xd150('0x13'),_0x5d2c4f,_0x1550ef[_0xd150('0x18')][_0xd150('0x19')]);return _0x58f257(_0x1550ef[_0xd150('0x18')][_0xd150('0x19')]);}else{logger[_0xd150('0x12')](_0xd150('0x13'),_0x5d2c4f,'request\x20sent');_0x58f257(_0x1550ef[_0xd150('0x1a')][_0xd150('0x19')]);}})['catch'](function(_0x2182b1){logger[_0xd150('0x18')](_0xd150('0x13'),_0x5d2c4f,_0x2182b1);_0x3c2fd3(_0x2182b1);});});}exports[_0xd150('0x1b')]=function(_0x34d93a){var _0x5a6ffc=this;return new Promise(function(_0x207054,_0x3b4ebf){return db[_0xd150('0x1c')][_0xd150('0x1d')](_0x34d93a['body'],{'raw':_0x34d93a[_0xd150('0x1e')]?_0x34d93a[_0xd150('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d93a[_0xd150('0x1e')]?_0x34d93a[_0xd150('0x1e')][_0xd150('0x1f')]||null:null,'attributes':_0x34d93a[_0xd150('0x1e')]?_0x34d93a['options'][_0xd150('0x20')]||null:null,'limit':_0x34d93a['options']?_0x34d93a['options'][_0xd150('0x21')]||null:null})[_0xd150('0x11')](function(_0x361415){logger['info'](_0xd150('0x1b'),_0x34d93a);logger[_0xd150('0x15')]('UpdateOpenchannelInteraction',_0x34d93a,JSON[_0xd150('0x17')](_0x361415));_0x207054(_0x361415);})[_0xd150('0x22')](function(_0x4cb369){logger[_0xd150('0x18')]('UpdateOpenchannelInteraction',_0x4cb369[_0xd150('0x19')],_0x34d93a);_0x3b4ebf(_0x5a6ffc['error'](0x1f4,_0x4cb369[_0xd150('0x19')]));});});};exports[_0xd150('0x23')]=function(_0x309e15){return new Promise(function(_0x1ae389,_0x4b32a6){return db[_0xd150('0x1c')][_0xd150('0x24')]({'where':_0x309e15[_0xd150('0x1e')]?_0x309e15[_0xd150('0x1e')][_0xd150('0x1f')]||null:null})[_0xd150('0x11')](function(_0xf1d198){if(_0xf1d198){return _0xf1d198[_0xd150('0x25')](_0x309e15[_0xd150('0x26')]['ids'],_[_0xd150('0x27')](_0x309e15[_0xd150('0x26')],[_0xd150('0x28'),'id'])||{});}})[_0xd150('0x29')](function(_0x471079){logger['info']('AddTags',_0x309e15);logger[_0xd150('0x15')](_0xd150('0x2a'),_0x309e15,JSON[_0xd150('0x17')](_0x471079));_0x1ae389(_0x471079);})[_0xd150('0x22')](function(_0x4dd947){logger['error']('AddTags',_0x4dd947[_0xd150('0x19')],_0x309e15);_0x4b32a6(_this[_0xd150('0x18')](0x1f4,_0x4dd947[_0xd150('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b0fff00..85b6897 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 _0x3b76=['register','save','emit'];(function(_0xef78ee,_0x2a97dd){var _0x2dca92=function(_0x1f2ebb){while(--_0x1f2ebb){_0xef78ee['push'](_0xef78ee['shift']());}};_0x2dca92(++_0x2a97dd);}(_0x3b76,0x1ba));var _0x63b7=function(_0xd2794a,_0x130fe){_0xd2794a=_0xd2794a-0x0;var _0x2efda5=_0x3b76[_0xd2794a];return _0x2efda5;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x63b7('0x0'),'remove','update'];function createListener(_0x10366e,_0xfc116d){return function(_0x47ee85){_0xfc116d[_0x63b7('0x1')](_0x10366e,_0x47ee85);};}function removeListener(_0x402f0c,_0x23b984){return function(){OpenchannelInteractionEvents['removeListener'](_0x402f0c,_0x23b984);};}exports[_0x63b7('0x2')]=function(_0x5561e9){for(var _0x29e251=0x0,_0x19bc18=events['length'];_0x29e251<_0x19bc18;_0x29e251++){var _0x117c61=events[_0x29e251];var _0x359666=createListener('openchannelInteraction:'+_0x117c61,_0x5561e9);OpenchannelInteractionEvents['on'](_0x117c61,_0x359666);}}; \ No newline at end of file +var _0xd155=['update','removeListener','register','openchannelInteraction:','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd155,0x106));var _0x5d15=function(_0x56658f,_0x4e89b7){_0x56658f=_0x56658f-0x0;var _0x5d9501=_0xd155[_0x56658f];return _0x5d9501;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x5d15('0x0'),_0x5d15('0x1'),_0x5d15('0x2')];function createListener(_0x488a7e,_0x1ca4c3){return function(_0x1e638f){_0x1ca4c3['emit'](_0x488a7e,_0x1e638f);};}function removeListener(_0x3bcb19,_0x27ac4e){return function(){OpenchannelInteractionEvents[_0x5d15('0x3')](_0x3bcb19,_0x27ac4e);};}exports[_0x5d15('0x4')]=function(_0x4e5345){for(var _0x27eb92=0x0,_0x4fb620=events['length'];_0x27eb92<_0x4fb620;_0x27eb92++){var _0x45e8ea=events[_0x27eb92];var _0x4b7a87=createListener(_0x5d15('0x5')+_0x45e8ea,_0x4e5345);OpenchannelInteractionEvents['on'](_0x45e8ea,_0x4b7a87);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index c4ce63f..2409eb6 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 _0x1e99=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','create','put','update','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x8fcf70,_0x3324a2){var _0x5b335c=function(_0x628ee){while(--_0x628ee){_0x8fcf70['push'](_0x8fcf70['shift']());}};_0x5b335c(++_0x3324a2);}(_0x1e99,0x1d7));var _0x91e9=function(_0xad802e,_0x418000){_0xad802e=_0xad802e-0x0;var _0x39f72f=_0x1e99[_0xad802e];return _0x39f72f;};'use strict';var multer=require(_0x91e9('0x0'));var util=require(_0x91e9('0x1'));var path=require(_0x91e9('0x2'));var timeout=require(_0x91e9('0x3'));var express=require(_0x91e9('0x4'));var router=express[_0x91e9('0x5')]();var fs_extra=require(_0x91e9('0x6'));var auth=require(_0x91e9('0x7'));var interaction=require(_0x91e9('0x8'));var config=require('../../config/environment');var controller=require(_0x91e9('0x9'));router[_0x91e9('0xa')]('/',auth[_0x91e9('0xb')](),controller[_0x91e9('0xc')]);router[_0x91e9('0xa')](_0x91e9('0xd'),auth[_0x91e9('0xb')](),controller[_0x91e9('0xe')]);router[_0x91e9('0xa')](_0x91e9('0xf'),auth[_0x91e9('0xb')](),controller['show']);router[_0x91e9('0x10')]('/',auth[_0x91e9('0xb')](),interaction[_0x91e9('0x11')](_0x91e9('0x12'),_0x91e9('0x13')),controller[_0x91e9('0x14')]);router[_0x91e9('0x15')](_0x91e9('0xf'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x16')]);router[_0x91e9('0x15')]('/:id/accept',auth['isAuthenticated'](),controller[_0x91e9('0x17')]);router[_0x91e9('0x15')]('/:id/reject',auth[_0x91e9('0xb')](),controller[_0x91e9('0x18')]);router[_0x91e9('0x19')](_0x91e9('0xf'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x1a')]);module[_0x91e9('0x1b')]=router; \ No newline at end of file +var _0xf3de=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','reject','exports','multer','util','path','express','Router'];(function(_0x5bb22f,_0x515720){var _0x251f38=function(_0x30500b){while(--_0x30500b){_0x5bb22f['push'](_0x5bb22f['shift']());}};_0x251f38(++_0x515720);}(_0xf3de,0x1c3));var _0xef3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3de[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xef3d('0x0'));var util=require(_0xef3d('0x1'));var path=require(_0xef3d('0x2'));var timeout=require('connect-timeout');var express=require(_0xef3d('0x3'));var router=express[_0xef3d('0x4')]();var fs_extra=require(_0xef3d('0x5'));var auth=require(_0xef3d('0x6'));var interaction=require(_0xef3d('0x7'));var config=require('../../config/environment');var controller=require('./openchannelMessage.controller');router[_0xef3d('0x8')]('/',auth[_0xef3d('0x9')](),controller[_0xef3d('0xa')]);router[_0xef3d('0x8')](_0xef3d('0xb'),auth[_0xef3d('0x9')](),controller[_0xef3d('0xc')]);router['get'](_0xef3d('0xd'),auth[_0xef3d('0x9')](),controller['show']);router[_0xef3d('0xe')]('/',auth[_0xef3d('0x9')](),interaction[_0xef3d('0xf')](_0xef3d('0x10'),_0xef3d('0x11')),controller['create']);router[_0xef3d('0x12')](_0xef3d('0xd'),auth['isAuthenticated'](),controller[_0xef3d('0x13')]);router[_0xef3d('0x12')]('/:id/accept',auth[_0xef3d('0x9')](),controller[_0xef3d('0x14')]);router[_0xef3d('0x12')](_0xef3d('0x15'),auth[_0xef3d('0x9')](),controller[_0xef3d('0x16')]);router['delete'](_0xef3d('0xd'),auth[_0xef3d('0x9')](),controller['destroy']);module[_0xef3d('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index f54b5db..febc3fb 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 _0x0a97=['STRING','sequelize','exports','TEXT','medium','out'];(function(_0x528495,_0x4d52da){var _0x38de7f=function(_0x917ec8){while(--_0x917ec8){_0x528495['push'](_0x528495['shift']());}};_0x38de7f(++_0x4d52da);}(_0x0a97,0x11b));var _0x70a9=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x0a97[_0x1bc013];return _0x55df36;};'use strict';var Sequelize=require(_0x70a9('0x0'));module[_0x70a9('0x1')]={'body':{'type':Sequelize[_0x70a9('0x2')](_0x70a9('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x70a9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x70a9('0x5')]},'providerResponse':{'type':Sequelize[_0x70a9('0x2')]}}; \ No newline at end of file +var _0xd2de=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x1f4d82,_0x455a88){var _0x5b708e=function(_0x5a5dd6){while(--_0x5a5dd6){_0x1f4d82['push'](_0x1f4d82['shift']());}};_0x5b708e(++_0x455a88);}(_0xd2de,0xe9));var _0xed2d=function(_0x34b487,_0xc3b127){_0x34b487=_0x34b487-0x0;var _0x54376e=_0xd2de[_0x34b487];return _0x54376e;};'use strict';var Sequelize=require(_0xed2d('0x0'));module[_0xed2d('0x1')]={'body':{'type':Sequelize[_0xed2d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xed2d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xed2d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xed2d('0x4')]('in',_0xed2d('0x5')),'defaultValue':_0xed2d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xed2d('0x6')]},'providerName':{'type':Sequelize[_0xed2d('0x7')]},'providerResponse':{'type':Sequelize[_0xed2d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 7ab2974..5842202 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 _0x2d90=['lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','then','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','stack','name','body','contact','index','map','OpenchannelMessage','rawAttributes','fieldName','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','show','params','include','find','create','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','OpenchannelInteractionId','isNil','interaction','user','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x406b67,_0x16b181){var _0x48f11e=function(_0xbca157){while(--_0xbca157){_0x406b67['push'](_0x406b67['shift']());}};_0x48f11e(++_0x16b181);}(_0x2d90,0x6b));var _0x02d9=function(_0x32af52,_0x2e9086){_0x32af52=_0x32af52-0x0;var _0x1e7b0e=_0x2d90[_0x32af52];return _0x1e7b0e;};'use strict';var emlformat=require(_0x02d9('0x0'));var rimraf=require(_0x02d9('0x1'));var zipdir=require(_0x02d9('0x2'));var jsonpatch=require(_0x02d9('0x3'));var rp=require(_0x02d9('0x4'));var moment=require('moment');var BPromise=require(_0x02d9('0x5'));var Mustache=require(_0x02d9('0x6'));var util=require(_0x02d9('0x7'));var path=require(_0x02d9('0x8'));var sox=require(_0x02d9('0x9'));var csv=require('to-csv');var ejs=require(_0x02d9('0xa'));var fs=require('fs');var fs_extra=require(_0x02d9('0xb'));var _=require(_0x02d9('0xc'));var squel=require('squel');var crypto=require(_0x02d9('0xd'));var jsforce=require(_0x02d9('0xe'));var deskjs=require(_0x02d9('0xf'));var toCsv=require(_0x02d9('0x10'));var querystring=require('querystring');var Papa=require(_0x02d9('0x11'));var Redis=require(_0x02d9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x02d9('0x13'));var as=require(_0x02d9('0x14'));var hardwareService=require(_0x02d9('0x15'));var logger=require(_0x02d9('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x02d9('0x17'));var db=require(_0x02d9('0x18'))['db'];config[_0x02d9('0x19')]=_[_0x02d9('0x1a')](config[_0x02d9('0x19')],{'host':_0x02d9('0x1b'),'port':0x18eb});var socket=require(_0x02d9('0x1c'))(new Redis(config[_0x02d9('0x19')]));require(_0x02d9('0x1d'))['register'](socket);var jayson=require(_0x02d9('0x1e'));var client=jayson[_0x02d9('0x1f')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2af1cd,_0x9ecf26,_0x422600,_0x2cc458){return new BPromise(function(_0x157723,_0x7c828){var _0x1c5fdf=_0x2cc458||client;return _0x1c5fdf['request'](_0x2af1cd,_0x422600)[_0x02d9('0x20')](function(_0x51f599){logger[_0x02d9('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x9ecf26,'request\x20sent');logger[_0x02d9('0x22')](_0x02d9('0x23'),_0x9ecf26,_0x02d9('0x24'),JSON[_0x02d9('0x25')](_0x51f599));if(_0x51f599[_0x02d9('0x26')]){if(_0x51f599[_0x02d9('0x26')][_0x02d9('0x27')]===0x1f4){logger[_0x02d9('0x26')](_0x02d9('0x28'),_0x9ecf26,_0x51f599['error'][_0x02d9('0x29')]);return _0x7c828(_0x51f599[_0x02d9('0x26')][_0x02d9('0x29')]);}logger['error'](_0x02d9('0x28'),_0x9ecf26,_0x51f599[_0x02d9('0x26')][_0x02d9('0x29')]);return _0x157723(_0x51f599['error']['message']);}else{logger[_0x02d9('0x21')](_0x02d9('0x28'),_0x9ecf26,_0x02d9('0x24'));_0x157723(_0x51f599[_0x02d9('0x2a')]['message']);}})[_0x02d9('0x2b')](function(_0x475a56){logger[_0x02d9('0x26')](_0x02d9('0x28'),_0x9ecf26,_0x475a56);_0x7c828(_0x475a56);});});}function respondWithStatusCode(_0x4ff9bf,_0x14e410){_0x14e410=_0x14e410||0xcc;return function(_0x5b1b14){if(_0x5b1b14){return _0x4ff9bf[_0x02d9('0x2c')](_0x14e410);}return _0x4ff9bf[_0x02d9('0x2d')](_0x14e410)[_0x02d9('0x2e')]();};}function respondWithResult(_0x2bf094,_0x124d7c){_0x124d7c=_0x124d7c||0xc8;return function(_0x51390f){if(_0x51390f){return _0x2bf094['status'](_0x124d7c)['json'](_0x51390f);}};}function respondWithFilteredResult(_0x1ff8ff,_0x11726d){return function(_0x3c785a){if(_0x3c785a){var _0x596d9c=typeof _0x11726d[_0x02d9('0x2f')]===_0x02d9('0x30')&&typeof _0x11726d[_0x02d9('0x31')]===_0x02d9('0x30');var _0x4ed78a=_0x3c785a[_0x02d9('0x32')];var _0x352bf6=_0x596d9c?0x0:_0x11726d[_0x02d9('0x2f')];var _0x490468=_0x596d9c?_0x3c785a[_0x02d9('0x32')]:_0x11726d[_0x02d9('0x2f')]+_0x11726d[_0x02d9('0x31')];var _0x5e4d3a;if(_0x490468>=_0x4ed78a){_0x490468=_0x4ed78a;_0x5e4d3a=0xc8;}else{_0x5e4d3a=0xce;}_0x1ff8ff[_0x02d9('0x2d')](_0x5e4d3a);return _0x1ff8ff[_0x02d9('0x33')](_0x02d9('0x34'),_0x352bf6+'-'+_0x490468+'/'+_0x4ed78a)[_0x02d9('0x35')](_0x3c785a);}return null;};}function patchUpdates(_0xebfb2b){return function(_0x5d881e){try{jsonpatch[_0x02d9('0x36')](_0x5d881e,_0xebfb2b,!![]);}catch(_0x398dca){return BPromise[_0x02d9('0x37')](_0x398dca);}return _0x5d881e['save']();};}function saveUpdates(_0x3b7968,_0x4a1498){return function(_0xa70963){if(_0xa70963){return _0xa70963[_0x02d9('0x38')](_0x3b7968)[_0x02d9('0x20')](function(_0x5b2f17){return _0x5b2f17;});}return null;};}function removeEntity(_0x3f700f,_0xc0e52f){return function(_0xf26033){if(_0xf26033){return _0xf26033[_0x02d9('0x39')]()[_0x02d9('0x20')](function(){_0x3f700f[_0x02d9('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e073,_0x146ccb){return function(_0x3a49ca){if(!_0x3a49ca){_0x34e073[_0x02d9('0x2c')](0x194);}return _0x3a49ca;};}function handleError(_0x5c462c,_0x5cec58){_0x5cec58=_0x5cec58||0x1f4;return function(_0x17c343){logger[_0x02d9('0x26')](_0x17c343[_0x02d9('0x3a')]);if(_0x17c343[_0x02d9('0x3b')]){delete _0x17c343[_0x02d9('0x3b')];}_0x5c462c[_0x02d9('0x2d')](_0x5cec58)['send'](_0x17c343);};}function getMustacheRender(_0x5aee83,_0x15ff90){return Mustache['render'](_0x5aee83,_['merge'](_0x15ff90[_0x02d9('0x3c')],{'contact':_0x15ff90[_0x02d9('0x3d')],'message':_0x15ff90['message'],'agent':_0x15ff90['agent'],'interaction':_0x15ff90['interaction'],'account':_0x15ff90['account']}))||'';}exports[_0x02d9('0x3e')]=function(_0x1e322c,_0x3eb59b){var _0xfd9796={},_0x138c03={},_0x388a29={'count':0x0,'rows':[]};var _0x4a52c1=_[_0x02d9('0x3f')](db[_0x02d9('0x40')][_0x02d9('0x41')],function(_0x400337){return{'name':_0x400337[_0x02d9('0x42')],'type':_0x400337['type']['key']};});_0x138c03[_0x02d9('0x43')]=_[_0x02d9('0x3f')](_0x4a52c1,_0x02d9('0x3b'));_0x138c03['query']=_[_0x02d9('0x44')](_0x1e322c['query']);_0x138c03['filters']=_[_0x02d9('0x45')](_0x138c03['model'],_0x138c03[_0x02d9('0x46')]);_0xfd9796['attributes']=_['intersection'](_0x138c03[_0x02d9('0x43')],qs['fields'](_0x1e322c[_0x02d9('0x46')][_0x02d9('0x47')]));_0xfd9796[_0x02d9('0x48')]=_0xfd9796['attributes'][_0x02d9('0x49')]?_0xfd9796[_0x02d9('0x48')]:_0x138c03['model'];if(!_0x1e322c[_0x02d9('0x46')][_0x02d9('0x4a')](_0x02d9('0x4b'))){_0xfd9796['limit']=qs['limit'](_0x1e322c[_0x02d9('0x46')][_0x02d9('0x31')]);_0xfd9796[_0x02d9('0x2f')]=qs[_0x02d9('0x2f')](_0x1e322c['query'][_0x02d9('0x2f')]);}_0xfd9796[_0x02d9('0x4c')]=qs['sort'](_0x1e322c[_0x02d9('0x46')]['sort']);_0xfd9796[_0x02d9('0x4d')]=qs[_0x02d9('0x4e')](_[_0x02d9('0x4f')](_0x1e322c['query'],_0x138c03[_0x02d9('0x4e')]),_0x4a52c1);if(_0x1e322c[_0x02d9('0x46')][_0x02d9('0x50')]){_0xfd9796[_0x02d9('0x4d')]=_[_0x02d9('0x51')](_0xfd9796['where'],{'$or':_[_0x02d9('0x3f')](_0x4a52c1,function(_0x2d9c77){if(_0x2d9c77[_0x02d9('0x52')]!==_0x02d9('0x53')){var _0x12da9b={};_0x12da9b[_0x2d9c77['name']]={'$like':'%'+_0x1e322c['query'][_0x02d9('0x50')]+'%'};return _0x12da9b;}})});}_0xfd9796=_[_0x02d9('0x51')]({},_0xfd9796,_0x1e322c['options']);var _0x183deb={'where':_0xfd9796[_0x02d9('0x4d')]};return db['OpenchannelMessage']['count'](_0x183deb)[_0x02d9('0x20')](function(_0x20acd7){_0x388a29[_0x02d9('0x32')]=_0x20acd7;if(_0x1e322c[_0x02d9('0x46')][_0x02d9('0x54')]){_0xfd9796['include']=[{'all':!![]}];}return db[_0x02d9('0x40')][_0x02d9('0x55')](_0xfd9796);})[_0x02d9('0x20')](function(_0x123a46){_0x388a29['rows']=_0x123a46;return _0x388a29;})[_0x02d9('0x20')](respondWithFilteredResult(_0x3eb59b,_0xfd9796))[_0x02d9('0x2b')](handleError(_0x3eb59b,null));};exports[_0x02d9('0x56')]=function(_0x230145,_0x30cc6a){var _0x50a33a={'raw':!![],'where':{'id':_0x230145[_0x02d9('0x57')]['id']}},_0x5c2df0={};_0x5c2df0[_0x02d9('0x43')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x5c2df0[_0x02d9('0x46')]=_[_0x02d9('0x44')](_0x230145[_0x02d9('0x46')]);_0x5c2df0['filters']=_[_0x02d9('0x45')](_0x5c2df0[_0x02d9('0x43')],_0x5c2df0[_0x02d9('0x46')]);_0x50a33a['attributes']=_[_0x02d9('0x45')](_0x5c2df0[_0x02d9('0x43')],qs[_0x02d9('0x47')](_0x230145[_0x02d9('0x46')]['fields']));_0x50a33a[_0x02d9('0x48')]=_0x50a33a[_0x02d9('0x48')][_0x02d9('0x49')]?_0x50a33a['attributes']:_0x5c2df0[_0x02d9('0x43')];if(_0x230145['query'][_0x02d9('0x54')]){_0x50a33a[_0x02d9('0x58')]=[{'all':!![]}];}_0x50a33a=_[_0x02d9('0x51')]({},_0x50a33a,_0x230145['options']);return db['OpenchannelMessage'][_0x02d9('0x59')](_0x50a33a)[_0x02d9('0x20')](handleEntityNotFound(_0x30cc6a,null))[_0x02d9('0x20')](respondWithResult(_0x30cc6a,null))['catch'](handleError(_0x30cc6a,null));};exports['create']=function(_0x21fd33,_0x218e8f){return db[_0x02d9('0x40')][_0x02d9('0x5a')](_0x21fd33[_0x02d9('0x3c')],{})[_0x02d9('0x20')](respondWithResult(_0x218e8f,0xc9))[_0x02d9('0x2b')](handleError(_0x218e8f,null));};exports[_0x02d9('0x38')]=function(_0x3bcdd0,_0x2ba376){if(_0x3bcdd0[_0x02d9('0x3c')]['id']){delete _0x3bcdd0['body']['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x3bcdd0[_0x02d9('0x57')]['id']}})[_0x02d9('0x20')](handleEntityNotFound(_0x2ba376,null))[_0x02d9('0x20')](saveUpdates(_0x3bcdd0[_0x02d9('0x3c')],null))[_0x02d9('0x20')](respondWithResult(_0x2ba376,null))['catch'](handleError(_0x2ba376,null));};exports[_0x02d9('0x39')]=function(_0x58cba5,_0x3058cb){return db[_0x02d9('0x40')][_0x02d9('0x59')]({'where':{'id':_0x58cba5[_0x02d9('0x57')]['id']}})['then'](handleEntityNotFound(_0x3058cb,null))[_0x02d9('0x20')](removeEntity(_0x3058cb,null))['catch'](handleError(_0x3058cb,null));};exports[_0x02d9('0x5b')]=function(_0x55121d,_0x1f3348){return db[_0x02d9('0x40')][_0x02d9('0x5b')]()[_0x02d9('0x20')](respondWithResult(_0x1f3348,null))[_0x02d9('0x2b')](handleError(_0x1f3348,null));};var interaction_log=require(_0x02d9('0x16'))(_0x02d9('0x5c'));exports[_0x02d9('0x5d')]=function(_0x4a1e8e,_0x313495,_0x16123f){var _0x402935={'agent':{},'channel':_0x02d9('0x5e')};if(_0x4a1e8e['body']['id']){delete _0x4a1e8e['body']['id'];}_0x4a1e8e[_0x02d9('0x3c')]['read']=!![];_0x4a1e8e[_0x02d9('0x3c')][_0x02d9('0x5f')]=moment()[_0x02d9('0x60')](_0x02d9('0x61'));_0x4a1e8e[_0x02d9('0x3c')]['UserId']=_0x4a1e8e[_0x02d9('0x3c')][_0x02d9('0x62')]||_0x4a1e8e['user']['id'];_0x402935['agent']['id']=_0x4a1e8e['body'][_0x02d9('0x62')];return db[_0x02d9('0x40')][_0x02d9('0x59')]({'where':{'id':_0x4a1e8e[_0x02d9('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x02d9('0x63')}]})[_0x02d9('0x20')](handleEntityNotFound(_0x313495,null))[_0x02d9('0x20')](saveUpdates(_0x4a1e8e[_0x02d9('0x3c')],null))[_0x02d9('0x20')](function(_0x924df9){if(_0x924df9){_0x402935['message']=_0x924df9[_0x02d9('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x02d9('0x59')]({'where':{'id':_0x924df9[_0x02d9('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x313495,null))[_0x02d9('0x20')](function(_0x4e7e53){if(_0x4e7e53){return _0x4e7e53[_0x02d9('0x38')]({'UserId':_0x4a1e8e['body'][_0x02d9('0x62')],'read1stAt':_[_0x02d9('0x66')](_0x4e7e53['read1stAt'])?moment()[_0x02d9('0x60')](_0x02d9('0x61')):undefined});}return null;})['then'](function(_0x2d6bba){if(_0x2d6bba){_0x402935[_0x02d9('0x67')]=_0x2d6bba[_0x02d9('0x64')]({'plain':!![]});interaction_log[_0x02d9('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a1e8e[_0x02d9('0x68')]['id'],_0x4a1e8e['user'][_0x02d9('0x3b')],_0x4a1e8e[_0x02d9('0x68')]['role'],_0x402935[_0x02d9('0x67')]['id'],_0x4a1e8e['body']?JSON['stringify'](_0x4a1e8e[_0x02d9('0x3c')]):_0x02d9('0x69'));return respondWithRpcPromise(_0x02d9('0x6a'),_0x02d9('0x6b'),_0x402935);}return null;})['then'](function(_0xaba43a){if(_0xaba43a){if(_0x4a1e8e['body'][_0x02d9('0x6c')]){_0x402935['message'][_0x02d9('0x6d')]=util[_0x02d9('0x60')](_0x02d9('0x6e'),_0x4a1e8e['user']['name']);_0x402935[_0x02d9('0x29')][_0x02d9('0x6f')]=_0x402935[_0x02d9('0x6f')];_0x402935[_0x02d9('0x29')][_0x02d9('0x70')]=_0x02d9('0x5d');return respondWithRpcPromise('EventManager',_0x02d9('0x71'),{'event':'acceptmessage','message':_0x402935[_0x02d9('0x29')]},client9002)[_0x02d9('0x20')](function(){return _0x402935;});}return _0x402935;}return null;})[_0x02d9('0x20')](respondWithResult(_0x313495,null))['catch'](handleError(_0x313495,null));};var interaction_log=require(_0x02d9('0x16'))('openchannel-interactions');exports['reject']=function(_0x2e2368,_0x54882e,_0x2c851f){var _0x17c41d={'agent':{},'channel':_0x02d9('0x5e')};if(_0x2e2368[_0x02d9('0x3c')]['id']){delete _0x2e2368[_0x02d9('0x3c')]['id'];}_0x2e2368[_0x02d9('0x3c')][_0x02d9('0x62')]=_0x2e2368[_0x02d9('0x3c')][_0x02d9('0x62')]||_0x2e2368[_0x02d9('0x68')]['id'];_0x17c41d[_0x02d9('0x72')]['id']=_0x2e2368[_0x02d9('0x3c')][_0x02d9('0x62')];return db[_0x02d9('0x40')][_0x02d9('0x59')]({'where':{'id':_0x2e2368[_0x02d9('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x54882e,null))[_0x02d9('0x20')](function(_0x4f90aa){if(_0x4f90aa){_0x17c41d[_0x02d9('0x29')]=_0x4f90aa[_0x02d9('0x64')]({'plain':!![]});return db[_0x02d9('0x73')]['find']({'where':{'id':_0x4f90aa['OpenchannelInteractionId']}});}return null;})[_0x02d9('0x20')](handleEntityNotFound(_0x54882e,null))[_0x02d9('0x20')](function(_0xa39450){if(_0xa39450){_0x17c41d[_0x02d9('0x67')]=_0xa39450[_0x02d9('0x64')]({'plain':!![]});interaction_log[_0x02d9('0x21')](_0x02d9('0x74'),_0x2e2368['user']['id'],_0x2e2368[_0x02d9('0x68')][_0x02d9('0x3b')],_0x2e2368[_0x02d9('0x68')][_0x02d9('0x75')],_0x17c41d[_0x02d9('0x67')]['id'],_0x2e2368['body']?JSON[_0x02d9('0x25')](_0x2e2368[_0x02d9('0x3c')]):_0x02d9('0x69'));return respondWithRpcPromise('RejectMessage',_0x02d9('0x76'),_0x17c41d);}return null;})['then'](function(_0x1bf35a){if(_0x1bf35a){_0x1bf35a['message'][_0x02d9('0x6d')]=util[_0x02d9('0x60')](_0x02d9('0x6e'),_0x2e2368['user'][_0x02d9('0x3b')]);_0x1bf35a[_0x02d9('0x29')][_0x02d9('0x6f')]=_0x17c41d['channel'];_0x1bf35a[_0x02d9('0x29')][_0x02d9('0x70')]='reject';respondWithRpcPromise(_0x02d9('0x71'),'EventManager',{'event':'rejectmessage','message':_0x1bf35a[_0x02d9('0x29')]},client9002);return _0x17c41d;}return null;})[_0x02d9('0x20')](respondWithResult(_0x54882e,null))[_0x02d9('0x2b')](handleError(_0x54882e,null));}; \ No newline at end of file +var _0x1c32=['OpenchannelMessage','include','findAll','catch','show','params','rawAttributes','includeAll','options','create','update','find','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','channel','event','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','render','body','agent','interaction','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x1c32,0xab));var _0x21c3=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x1c32[_0x44b3bd];return _0x1efc4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21c3('0x0'));var zipdir=require(_0x21c3('0x1'));var jsonpatch=require(_0x21c3('0x2'));var rp=require(_0x21c3('0x3'));var moment=require(_0x21c3('0x4'));var BPromise=require(_0x21c3('0x5'));var Mustache=require(_0x21c3('0x6'));var util=require(_0x21c3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x21c3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21c3('0x9'));var _=require(_0x21c3('0xa'));var squel=require(_0x21c3('0xb'));var crypto=require(_0x21c3('0xc'));var jsforce=require(_0x21c3('0xd'));var deskjs=require(_0x21c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x21c3('0xf'));var Papa=require(_0x21c3('0x10'));var Redis=require(_0x21c3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x21c3('0x12'));var as=require(_0x21c3('0x13'));var hardwareService=require(_0x21c3('0x14'));var logger=require(_0x21c3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x21c3('0x16'));var licenseUtil=require(_0x21c3('0x17'));var db=require(_0x21c3('0x18'))['db'];config['redis']=_['defaults'](config[_0x21c3('0x19')],{'host':_0x21c3('0x1a'),'port':0x18eb});var socket=require(_0x21c3('0x1b'))(new Redis(config[_0x21c3('0x19')]));require('./openchannelMessage.socket')[_0x21c3('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x21c3('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x21c3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x224375,_0x11f1b5,_0x539028,_0x1a94d9){return new BPromise(function(_0x377e22,_0x4cb811){var _0x51dab2=_0x1a94d9||client;return _0x51dab2['request'](_0x224375,_0x539028)[_0x21c3('0x1f')](function(_0x1bfc84){logger['info'](_0x21c3('0x20'),_0x11f1b5,_0x21c3('0x21'));logger[_0x21c3('0x22')](_0x21c3('0x23'),_0x11f1b5,_0x21c3('0x21'),JSON[_0x21c3('0x24')](_0x1bfc84));if(_0x1bfc84[_0x21c3('0x25')]){if(_0x1bfc84[_0x21c3('0x25')][_0x21c3('0x26')]===0x1f4){logger['error'](_0x21c3('0x20'),_0x11f1b5,_0x1bfc84['error']['message']);return _0x4cb811(_0x1bfc84[_0x21c3('0x25')][_0x21c3('0x27')]);}logger[_0x21c3('0x25')](_0x21c3('0x20'),_0x11f1b5,_0x1bfc84[_0x21c3('0x25')][_0x21c3('0x27')]);return _0x377e22(_0x1bfc84['error']['message']);}else{logger['info'](_0x21c3('0x20'),_0x11f1b5,_0x21c3('0x21'));_0x377e22(_0x1bfc84['result'][_0x21c3('0x27')]);}})['catch'](function(_0x2ba775){logger['error'](_0x21c3('0x20'),_0x11f1b5,_0x2ba775);_0x4cb811(_0x2ba775);});});}function respondWithStatusCode(_0xeda7a6,_0x1b6789){_0x1b6789=_0x1b6789||0xcc;return function(_0x5d107f){if(_0x5d107f){return _0xeda7a6[_0x21c3('0x28')](_0x1b6789);}return _0xeda7a6[_0x21c3('0x29')](_0x1b6789)[_0x21c3('0x2a')]();};}function respondWithResult(_0x4c240d,_0x894588){_0x894588=_0x894588||0xc8;return function(_0x205ddd){if(_0x205ddd){return _0x4c240d['status'](_0x894588)[_0x21c3('0x2b')](_0x205ddd);}};}function respondWithFilteredResult(_0xedf0bd,_0x2cc9be){return function(_0x3aefa5){if(_0x3aefa5){var _0xed3c03=typeof _0x2cc9be[_0x21c3('0x2c')]===_0x21c3('0x2d')&&typeof _0x2cc9be[_0x21c3('0x2e')]===_0x21c3('0x2d');var _0x334bf5=_0x3aefa5[_0x21c3('0x2f')];var _0x1af884=_0xed3c03?0x0:_0x2cc9be[_0x21c3('0x2c')];var _0x57afc3=_0xed3c03?_0x3aefa5['count']:_0x2cc9be['offset']+_0x2cc9be[_0x21c3('0x2e')];var _0x1f4f9f;if(_0x57afc3>=_0x334bf5){_0x57afc3=_0x334bf5;_0x1f4f9f=0xc8;}else{_0x1f4f9f=0xce;}_0xedf0bd['status'](_0x1f4f9f);return _0xedf0bd[_0x21c3('0x30')](_0x21c3('0x31'),_0x1af884+'-'+_0x57afc3+'/'+_0x334bf5)[_0x21c3('0x2b')](_0x3aefa5);}return null;};}function patchUpdates(_0x8c0181){return function(_0x53a99c){try{jsonpatch[_0x21c3('0x32')](_0x53a99c,_0x8c0181,!![]);}catch(_0x1b0547){return BPromise[_0x21c3('0x33')](_0x1b0547);}return _0x53a99c[_0x21c3('0x34')]();};}function saveUpdates(_0x8282c4,_0x38c56e){return function(_0x5776bb){if(_0x5776bb){return _0x5776bb['update'](_0x8282c4)[_0x21c3('0x1f')](function(_0x2bfeae){return _0x2bfeae;});}return null;};}function removeEntity(_0xc670b6,_0x51ba09){return function(_0x51cf26){if(_0x51cf26){return _0x51cf26[_0x21c3('0x35')]()[_0x21c3('0x1f')](function(){_0xc670b6[_0x21c3('0x29')](0xcc)[_0x21c3('0x2a')]();});}};}function handleEntityNotFound(_0x1af070,_0x4b4ea5){return function(_0x10d326){if(!_0x10d326){_0x1af070['sendStatus'](0x194);}return _0x10d326;};}function handleError(_0x4c3d36,_0x121a79){_0x121a79=_0x121a79||0x1f4;return function(_0x22ace5){logger[_0x21c3('0x25')](_0x22ace5[_0x21c3('0x36')]);if(_0x22ace5[_0x21c3('0x37')]){delete _0x22ace5[_0x21c3('0x37')];}_0x4c3d36['status'](_0x121a79)[_0x21c3('0x38')](_0x22ace5);};}function getMustacheRender(_0x5c57d7,_0x19ccca){return Mustache[_0x21c3('0x39')](_0x5c57d7,_['merge'](_0x19ccca[_0x21c3('0x3a')],{'contact':_0x19ccca['contact'],'message':_0x19ccca[_0x21c3('0x27')],'agent':_0x19ccca[_0x21c3('0x3b')],'interaction':_0x19ccca[_0x21c3('0x3c')],'account':_0x19ccca['account']}))||'';}exports['index']=function(_0xf11127,_0x2d73fc){var _0x13a513={},_0x1fc4b9={},_0x4afe1a={'count':0x0,'rows':[]};var _0x1c32d1=_['map'](db['OpenchannelMessage']['rawAttributes'],function(_0x553353){return{'name':_0x553353[_0x21c3('0x3d')],'type':_0x553353[_0x21c3('0x3e')][_0x21c3('0x3f')]};});_0x1fc4b9[_0x21c3('0x40')]=_[_0x21c3('0x41')](_0x1c32d1,_0x21c3('0x37'));_0x1fc4b9[_0x21c3('0x42')]=_[_0x21c3('0x43')](_0xf11127['query']);_0x1fc4b9['filters']=_[_0x21c3('0x44')](_0x1fc4b9['model'],_0x1fc4b9[_0x21c3('0x42')]);_0x13a513[_0x21c3('0x45')]=_[_0x21c3('0x44')](_0x1fc4b9[_0x21c3('0x40')],qs[_0x21c3('0x46')](_0xf11127[_0x21c3('0x42')][_0x21c3('0x46')]));_0x13a513[_0x21c3('0x45')]=_0x13a513['attributes'][_0x21c3('0x47')]?_0x13a513[_0x21c3('0x45')]:_0x1fc4b9[_0x21c3('0x40')];if(!_0xf11127['query'][_0x21c3('0x48')]('nolimit')){_0x13a513[_0x21c3('0x2e')]=qs['limit'](_0xf11127[_0x21c3('0x42')][_0x21c3('0x2e')]);_0x13a513[_0x21c3('0x2c')]=qs[_0x21c3('0x2c')](_0xf11127[_0x21c3('0x42')][_0x21c3('0x2c')]);}_0x13a513[_0x21c3('0x49')]=qs[_0x21c3('0x4a')](_0xf11127['query'][_0x21c3('0x4a')]);_0x13a513[_0x21c3('0x4b')]=qs[_0x21c3('0x4c')](_[_0x21c3('0x4d')](_0xf11127['query'],_0x1fc4b9[_0x21c3('0x4c')]),_0x1c32d1);if(_0xf11127[_0x21c3('0x42')]['filter']){_0x13a513['where']=_[_0x21c3('0x4e')](_0x13a513[_0x21c3('0x4b')],{'$or':_[_0x21c3('0x41')](_0x1c32d1,function(_0x37c876){if(_0x37c876[_0x21c3('0x3e')]!==_0x21c3('0x4f')){var _0x4ef1ca={};_0x4ef1ca[_0x37c876['name']]={'$like':'%'+_0xf11127[_0x21c3('0x42')][_0x21c3('0x50')]+'%'};return _0x4ef1ca;}})});}_0x13a513=_[_0x21c3('0x4e')]({},_0x13a513,_0xf11127['options']);var _0x110704={'where':_0x13a513[_0x21c3('0x4b')]};return db[_0x21c3('0x51')][_0x21c3('0x2f')](_0x110704)['then'](function(_0x4c0a7f){_0x4afe1a[_0x21c3('0x2f')]=_0x4c0a7f;if(_0xf11127[_0x21c3('0x42')]['includeAll']){_0x13a513[_0x21c3('0x52')]=[{'all':!![]}];}return db[_0x21c3('0x51')][_0x21c3('0x53')](_0x13a513);})[_0x21c3('0x1f')](function(_0x56ac2f){_0x4afe1a['rows']=_0x56ac2f;return _0x4afe1a;})[_0x21c3('0x1f')](respondWithFilteredResult(_0x2d73fc,_0x13a513))[_0x21c3('0x54')](handleError(_0x2d73fc,null));};exports[_0x21c3('0x55')]=function(_0x184114,_0x1e82aa){var _0x2ac4ff={'raw':!![],'where':{'id':_0x184114[_0x21c3('0x56')]['id']}},_0x5c2eb9={};_0x5c2eb9[_0x21c3('0x40')]=_['keys'](db[_0x21c3('0x51')][_0x21c3('0x57')]);_0x5c2eb9[_0x21c3('0x42')]=_[_0x21c3('0x43')](_0x184114['query']);_0x5c2eb9['filters']=_[_0x21c3('0x44')](_0x5c2eb9[_0x21c3('0x40')],_0x5c2eb9[_0x21c3('0x42')]);_0x2ac4ff['attributes']=_[_0x21c3('0x44')](_0x5c2eb9['model'],qs[_0x21c3('0x46')](_0x184114[_0x21c3('0x42')][_0x21c3('0x46')]));_0x2ac4ff[_0x21c3('0x45')]=_0x2ac4ff[_0x21c3('0x45')][_0x21c3('0x47')]?_0x2ac4ff[_0x21c3('0x45')]:_0x5c2eb9['model'];if(_0x184114['query'][_0x21c3('0x58')]){_0x2ac4ff['include']=[{'all':!![]}];}_0x2ac4ff=_['merge']({},_0x2ac4ff,_0x184114[_0x21c3('0x59')]);return db[_0x21c3('0x51')]['find'](_0x2ac4ff)[_0x21c3('0x1f')](handleEntityNotFound(_0x1e82aa,null))['then'](respondWithResult(_0x1e82aa,null))['catch'](handleError(_0x1e82aa,null));};exports[_0x21c3('0x5a')]=function(_0x35a8c5,_0x3bd2bf){return db[_0x21c3('0x51')]['create'](_0x35a8c5['body'],{})[_0x21c3('0x1f')](respondWithResult(_0x3bd2bf,0xc9))[_0x21c3('0x54')](handleError(_0x3bd2bf,null));};exports[_0x21c3('0x5b')]=function(_0x472c90,_0x1dc24c){if(_0x472c90[_0x21c3('0x3a')]['id']){delete _0x472c90['body']['id'];}return db[_0x21c3('0x51')][_0x21c3('0x5c')]({'where':{'id':_0x472c90[_0x21c3('0x56')]['id']}})[_0x21c3('0x1f')](handleEntityNotFound(_0x1dc24c,null))[_0x21c3('0x1f')](saveUpdates(_0x472c90[_0x21c3('0x3a')],null))[_0x21c3('0x1f')](respondWithResult(_0x1dc24c,null))['catch'](handleError(_0x1dc24c,null));};exports['destroy']=function(_0x3a1ac7,_0x133d6c){return db[_0x21c3('0x51')][_0x21c3('0x5c')]({'where':{'id':_0x3a1ac7['params']['id']}})[_0x21c3('0x1f')](handleEntityNotFound(_0x133d6c,null))['then'](removeEntity(_0x133d6c,null))['catch'](handleError(_0x133d6c,null));};exports[_0x21c3('0x5d')]=function(_0x419176,_0x536d99){return db[_0x21c3('0x51')][_0x21c3('0x5d')]()[_0x21c3('0x1f')](respondWithResult(_0x536d99,null))['catch'](handleError(_0x536d99,null));};var interaction_log=require(_0x21c3('0x15'))(_0x21c3('0x5e'));exports['accept']=function(_0x53e9ac,_0x5a8ad5,_0x26ddad){var _0x2edee3={'agent':{},'channel':_0x21c3('0x5f')};if(_0x53e9ac['body']['id']){delete _0x53e9ac[_0x21c3('0x3a')]['id'];}_0x53e9ac['body'][_0x21c3('0x60')]=!![];_0x53e9ac[_0x21c3('0x3a')][_0x21c3('0x61')]=moment()[_0x21c3('0x62')](_0x21c3('0x63'));_0x53e9ac[_0x21c3('0x3a')][_0x21c3('0x64')]=_0x53e9ac[_0x21c3('0x3a')][_0x21c3('0x64')]||_0x53e9ac[_0x21c3('0x65')]['id'];_0x2edee3[_0x21c3('0x3b')]['id']=_0x53e9ac[_0x21c3('0x3a')][_0x21c3('0x64')];return db['OpenchannelMessage'][_0x21c3('0x5c')]({'where':{'id':_0x53e9ac[_0x21c3('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x21c3('0x66')],'as':_0x21c3('0x67')}]})[_0x21c3('0x1f')](handleEntityNotFound(_0x5a8ad5,null))['then'](saveUpdates(_0x53e9ac[_0x21c3('0x3a')],null))[_0x21c3('0x1f')](function(_0x5b3775){if(_0x5b3775){_0x2edee3[_0x21c3('0x27')]=_0x5b3775[_0x21c3('0x68')]({'plain':!![]});return db[_0x21c3('0x69')]['find']({'where':{'id':_0x5b3775[_0x21c3('0x6a')]}});}return null;})[_0x21c3('0x1f')](handleEntityNotFound(_0x5a8ad5,null))[_0x21c3('0x1f')](function(_0x14a816){if(_0x14a816){return _0x14a816[_0x21c3('0x5b')]({'UserId':_0x53e9ac[_0x21c3('0x3a')][_0x21c3('0x64')],'read1stAt':_[_0x21c3('0x6b')](_0x14a816[_0x21c3('0x6c')])?moment()[_0x21c3('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x21c3('0x1f')](function(_0x165ab5){if(_0x165ab5){_0x2edee3[_0x21c3('0x3c')]=_0x165ab5[_0x21c3('0x68')]({'plain':!![]});interaction_log[_0x21c3('0x6d')](_0x21c3('0x6e'),_0x53e9ac[_0x21c3('0x65')]['id'],_0x53e9ac[_0x21c3('0x65')]['name'],_0x53e9ac['user'][_0x21c3('0x6f')],_0x2edee3[_0x21c3('0x3c')]['id'],_0x53e9ac[_0x21c3('0x3a')]?JSON[_0x21c3('0x24')](_0x53e9ac[_0x21c3('0x3a')]):_0x21c3('0x70'));return respondWithRpcPromise(_0x21c3('0x71'),_0x21c3('0x72'),_0x2edee3);}return null;})['then'](function(_0x3f5d00){if(_0x3f5d00){if(_0x53e9ac[_0x21c3('0x3a')][_0x21c3('0x73')]){_0x2edee3[_0x21c3('0x27')]['interface']=util['format']('SIP/%s',_0x53e9ac['user'][_0x21c3('0x37')]);_0x2edee3['message'][_0x21c3('0x74')]=_0x2edee3[_0x21c3('0x74')];_0x2edee3[_0x21c3('0x27')][_0x21c3('0x75')]=_0x21c3('0x76');return respondWithRpcPromise(_0x21c3('0x77'),'EventManager',{'event':_0x21c3('0x78'),'message':_0x2edee3[_0x21c3('0x27')]},client9002)[_0x21c3('0x1f')](function(){return _0x2edee3;});}return _0x2edee3;}return null;})[_0x21c3('0x1f')](respondWithResult(_0x5a8ad5,null))[_0x21c3('0x54')](handleError(_0x5a8ad5,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x21c3('0x33')]=function(_0x3ea75f,_0x3c0765,_0x29622c){var _0x4d7b06={'agent':{},'channel':'openchannel'};if(_0x3ea75f[_0x21c3('0x3a')]['id']){delete _0x3ea75f[_0x21c3('0x3a')]['id'];}_0x3ea75f[_0x21c3('0x3a')][_0x21c3('0x64')]=_0x3ea75f[_0x21c3('0x3a')]['UserId']||_0x3ea75f[_0x21c3('0x65')]['id'];_0x4d7b06[_0x21c3('0x3b')]['id']=_0x3ea75f[_0x21c3('0x3a')]['UserId'];return db['OpenchannelMessage'][_0x21c3('0x5c')]({'where':{'id':_0x3ea75f[_0x21c3('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c0765,null))[_0x21c3('0x1f')](function(_0x1a461d){if(_0x1a461d){_0x4d7b06[_0x21c3('0x27')]=_0x1a461d[_0x21c3('0x68')]({'plain':!![]});return db[_0x21c3('0x69')]['find']({'where':{'id':_0x1a461d[_0x21c3('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x3c0765,null))[_0x21c3('0x1f')](function(_0x2ec7b1){if(_0x2ec7b1){_0x4d7b06[_0x21c3('0x3c')]=_0x2ec7b1['get']({'plain':!![]});interaction_log[_0x21c3('0x6d')](_0x21c3('0x79'),_0x3ea75f[_0x21c3('0x65')]['id'],_0x3ea75f[_0x21c3('0x65')][_0x21c3('0x37')],_0x3ea75f['user'][_0x21c3('0x6f')],_0x4d7b06['interaction']['id'],_0x3ea75f[_0x21c3('0x3a')]?JSON[_0x21c3('0x24')](_0x3ea75f[_0x21c3('0x3a')]):'null');return respondWithRpcPromise(_0x21c3('0x7a'),_0x21c3('0x7b'),_0x4d7b06);}return null;})[_0x21c3('0x1f')](function(_0x5193d9){if(_0x5193d9){_0x5193d9[_0x21c3('0x27')]['interface']=util[_0x21c3('0x62')](_0x21c3('0x7c'),_0x3ea75f[_0x21c3('0x65')][_0x21c3('0x37')]);_0x5193d9[_0x21c3('0x27')][_0x21c3('0x74')]=_0x4d7b06[_0x21c3('0x74')];_0x5193d9['message'][_0x21c3('0x75')]='reject';respondWithRpcPromise(_0x21c3('0x77'),'EventManager',{'event':_0x21c3('0x7d'),'message':_0x5193d9[_0x21c3('0x27')]},client9002);return _0x4d7b06;}return null;})[_0x21c3('0x1f')](respondWithResult(_0x3c0765,null))[_0x21c3('0x54')](handleError(_0x3c0765,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 3682cd2..45a7a64 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 _0x3ad8=['emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','remove'];(function(_0x25b963,_0xdcbc9f){var _0x462061=function(_0x4db8e6){while(--_0x4db8e6){_0x25b963['push'](_0x25b963['shift']());}};_0x462061(++_0xdcbc9f);}(_0x3ad8,0x1a3));var _0x83ad=function(_0x37a560,_0x114f58){_0x37a560=_0x37a560-0x0;var _0x56f5e7=_0x3ad8[_0x37a560];return _0x56f5e7;};'use strict';var EventEmitter=require(_0x83ad('0x0'));var OpenchannelMessage=require(_0x83ad('0x1'))['db'][_0x83ad('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x83ad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x83ad('0x4')};function emitEvent(_0x5921ca){return function(_0x5dd27,_0xad6999,_0x5da485){OpenchannelMessageEvents[_0x83ad('0x5')](_0x5921ca+':'+_0x5dd27['id'],_0x5dd27);OpenchannelMessageEvents['emit'](_0x5921ca,_0x5dd27);_0x5da485(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x83ad('0x6')](e,emitEvent(event));}}module[_0x83ad('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xe880=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x9b6ed3,_0x4927d5){var _0x4cf6ea=function(_0x385c45){while(--_0x385c45){_0x9b6ed3['push'](_0x9b6ed3['shift']());}};_0x4cf6ea(++_0x4927d5);}(_0xe880,0x14c));var _0x0e88=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe880[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x0e88('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0e88('0x1')](0x0);var events={'afterCreate':_0x0e88('0x2'),'afterUpdate':_0x0e88('0x3'),'afterDestroy':_0x0e88('0x4')};function emitEvent(_0x2cf537){return function(_0x4d1efd,_0x40ba1b,_0x361185){OpenchannelMessageEvents[_0x0e88('0x5')](_0x2cf537+':'+_0x4d1efd['id'],_0x4d1efd);OpenchannelMessageEvents[_0x0e88('0x5')](_0x2cf537,_0x4d1efd);_0x361185(null);};}for(var e in events){if(events[_0x0e88('0x6')](e)){var event=events[e];OpenchannelMessage[_0x0e88('0x7')](e,emitEvent(event));}}module[_0x0e88('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 b749318..4ea9928 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 _0x366f=['threadId','Interaction','update','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./openchannelMessage.attributes','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','toLowerCase','catch','error','secret','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Contact','keys','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s'];(function(_0x1322cd,_0x28abb1){var _0x5cc70c=function(_0x4c630e){while(--_0x4c630e){_0x1322cd['push'](_0x1322cd['shift']());}};_0x5cc70c(++_0x28abb1);}(_0x366f,0x144));var _0xf366=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x366f[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0xf366('0x0'));var util=require(_0xf366('0x1'));var logger=require(_0xf366('0x2'))(_0xf366('0x3'));var moment=require(_0xf366('0x4'));var BPromise=require(_0xf366('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf366('0x6'));var rimraf=require('rimraf');var config=require(_0xf366('0x7'));var attributes=require(_0xf366('0x8'));module['exports']=function(_0x1e80b0,_0x56a8ef){return _0x1e80b0[_0xf366('0x9')]('OpenchannelMessage',attributes,{'tableName':_0xf366('0xa'),'paranoid':![],'indexes':[{'name':_0xf366('0xb'),'fields':[_0xf366('0xc')],'type':_0xf366('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xba2b5a,_0x4afba5,_0x5d823d){var _0x447361=_0x1e80b0[_0xf366('0xe')];var _0x4dfbaa=_0xba2b5a[_0xf366('0xf')]({'plain':!![]});if(_0x4dfbaa[_0xf366('0x10')]['toLowerCase']()==='in'||_0x4dfbaa[_0xf366('0x10')]['toLowerCase']()===_0xf366('0x11')&&!_0x4dfbaa['secret']&&!_[_0xf366('0x12')](_0x4dfbaa[_0xf366('0x13')])){_0x447361[_0xf366('0x14')][_0xf366('0x15')]({'where':{'id':_0x4dfbaa[_0xf366('0x16')]}})[_0xf366('0x17')](function(_0x2e5b06){if(_0x2e5b06){_0x2e5b06['update']({'lastMsgAt':_0x4dfbaa[_0xf366('0x18')],'lastMsgDirection':_0x4dfbaa[_0xf366('0x10')][_0xf366('0x19')]()});}})[_0xf366('0x1a')](function(_0xc82f76){console[_0xf366('0x1b')](_0xc82f76);});}if(_0x4dfbaa['direction']==='out'&&!_0x4dfbaa[_0xf366('0x1c')]){var _0x484dbc;_0x447361[_0xf366('0x1d')][_0xf366('0x1e')]()[_0xf366('0x17')](function(_0x128ebe){return _0x447361[_0xf366('0x1f')]['find']({'where':{'id':_0x4dfbaa[_0xf366('0x20')]},'include':[{'model':_0x447361[_0xf366('0x14')],'as':'Interactions','where':{'id':_0x4dfbaa[_0xf366('0x16')]},'limit':0x1,'include':[{'model':_0x447361[_0xf366('0x1d')],'as':_0xf366('0x21'),'attributes':_[_0xf366('0x22')](_0x128ebe)}]}]});})[_0xf366('0x17')](function(_0x53a52b){_0x484dbc=_0x53a52b[_0xf366('0xf')]({'plain':!![]});if(_0x484dbc&&_0x484dbc['replyUri']){logger[_0xf366('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0xf366('0x24'),util['format'](_0xf366('0x25'),_0x4dfbaa['id'],_0x484dbc[_0xf366('0x26')]));if(_0x484dbc[_0xf366('0x27')]&&_0x484dbc['Interactions'][_0xf366('0x28')]){_0x4dfbaa['Interaction']=_[_0xf366('0x29')](_0x484dbc[_0xf366('0x27')][0x0],_0xf366('0x21'));_0x4dfbaa['Contact']=_0x484dbc[_0xf366('0x27')][0x0][_0xf366('0x21')];}var _0x4afba5={'method':_0xf366('0x2a'),'uri':encodeURI(_0x484dbc['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4afba5[_0xf366('0x2b')]){case _0xf366('0x2c'):_0x4afba5['qs']=_0x4dfbaa;break;case _0xf366('0x2a'):_0x4afba5[_0xf366('0xc')]=_0x4dfbaa;break;}return rp(_0x4afba5)[_0xf366('0x17')](function(_0xf747e5){logger['info'](_0xf366('0x2d'),_0xf366('0x24'),util['format'](_0xf366('0x2e'),_0x4dfbaa['id'],_0x484dbc[_0xf366('0x26')]));if(_0xf747e5['body']['threadId']&&_0xf747e5['body'][_0xf366('0x2f')]!=_0x4dfbaa[_0xf366('0x30')][_0xf366('0x2f')]){return _0x447361['OpenchannelInteraction'][_0xf366('0x31')]({'threadId':_0xf747e5['body'][_0xf366('0x2f')]},{'logging':!![],'where':{'id':_0x4dfbaa['Interaction']['id']}});}else{return;}})[_0xf366('0x17')](function(){return _0xba2b5a['update']({'read':!![]});})['catch'](function(_0x3bfe34){logger[_0xf366('0x1b')]('OpenchannelMessage,\x20%s,\x20%s',_0xf366('0x24'),util[_0xf366('0x32')](_0x3bfe34,{'showHidden':![],'depth':null}));_0x5d823d();});}else{_0x5d823d();}})[_0xf366('0x33')](function(){_0x5d823d();});}else{_0x5d823d();}}},'charset':_0xf366('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3868=['POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit'];(function(_0x32349d,_0x558bde){var _0x50c1de=function(_0x3b5a7f){while(--_0x3b5a7f){_0x32349d['push'](_0x32349d['shift']());}};_0x50c1de(++_0x558bde);}(_0x3868,0x1a8));var _0x8386=function(_0x1741bf,_0x4ca168){_0x1741bf=_0x1741bf-0x0;var _0x42c816=_0x3868[_0x1741bf];return _0x42c816;};'use strict';var _=require(_0x8386('0x0'));var util=require('util');var logger=require(_0x8386('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8386('0x2'));var rp=require(_0x8386('0x3'));var fs=require('fs');var path=require(_0x8386('0x4'));var rimraf=require(_0x8386('0x5'));var config=require(_0x8386('0x6'));var attributes=require(_0x8386('0x7'));module[_0x8386('0x8')]=function(_0x371b6a,_0x4d8aef){return _0x371b6a[_0x8386('0x9')](_0x8386('0xa'),attributes,{'tableName':_0x8386('0xb'),'paranoid':![],'indexes':[{'name':_0x8386('0xc'),'fields':[_0x8386('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x19b779,_0x51316d,_0x1a6e2f){var _0x4bcbb8=_0x371b6a[_0x8386('0xe')];var _0x5242d5=_0x19b779[_0x8386('0xf')]({'plain':!![]});if(_0x5242d5[_0x8386('0x10')]['toLowerCase']()==='in'||_0x5242d5[_0x8386('0x10')][_0x8386('0x11')]()===_0x8386('0x12')&&!_0x5242d5[_0x8386('0x13')]&&!_[_0x8386('0x14')](_0x5242d5[_0x8386('0x15')])){_0x4bcbb8[_0x8386('0x16')][_0x8386('0x17')]({'where':{'id':_0x5242d5[_0x8386('0x18')]}})[_0x8386('0x19')](function(_0x798f43){if(_0x798f43){_0x798f43[_0x8386('0x1a')]({'lastMsgAt':_0x5242d5[_0x8386('0x1b')],'lastMsgDirection':_0x5242d5[_0x8386('0x10')][_0x8386('0x11')]()});}})[_0x8386('0x1c')](function(_0x976b91){console[_0x8386('0x1d')](_0x976b91);});}if(_0x5242d5[_0x8386('0x10')]==='out'&&!_0x5242d5[_0x8386('0x13')]){var _0x532397;_0x4bcbb8[_0x8386('0x1e')][_0x8386('0x1f')]()[_0x8386('0x19')](function(_0xd7d4c3){return _0x4bcbb8['OpenchannelAccount'][_0x8386('0x20')]({'where':{'id':_0x5242d5[_0x8386('0x21')]},'include':[{'model':_0x4bcbb8[_0x8386('0x16')],'as':_0x8386('0x22'),'where':{'id':_0x5242d5['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x4bcbb8[_0x8386('0x1e')],'as':_0x8386('0x23'),'attributes':_[_0x8386('0x24')](_0xd7d4c3)}]}]});})[_0x8386('0x19')](function(_0x2518dd){_0x532397=_0x2518dd[_0x8386('0xf')]({'plain':!![]});if(_0x532397&&_0x532397[_0x8386('0x25')]){logger[_0x8386('0x26')](_0x8386('0x27'),_0x8386('0x28'),util[_0x8386('0x29')](_0x8386('0x2a'),_0x5242d5['id'],_0x532397[_0x8386('0x25')]));if(_0x532397['Interactions']&&_0x532397[_0x8386('0x22')]['length']){_0x5242d5['Interaction']=_[_0x8386('0x2b')](_0x532397[_0x8386('0x22')][0x0],'Contact');_0x5242d5[_0x8386('0x23')]=_0x532397[_0x8386('0x22')][0x0]['Contact'];}var _0x51316d={'method':_0x8386('0x2c'),'uri':encodeURI(_0x532397[_0x8386('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x51316d[_0x8386('0x2d')]){case _0x8386('0x2e'):_0x51316d['qs']=_0x5242d5;break;case _0x8386('0x2c'):_0x51316d[_0x8386('0xd')]=_0x5242d5;break;}return rp(_0x51316d)['then'](function(_0x3ce83d){logger[_0x8386('0x26')](_0x8386('0x27'),_0x8386('0x28'),util[_0x8386('0x29')](_0x8386('0x2f'),_0x5242d5['id'],_0x532397[_0x8386('0x25')]));if(_0x3ce83d[_0x8386('0xd')]['threadId']&&_0x3ce83d[_0x8386('0xd')][_0x8386('0x30')]!=_0x5242d5[_0x8386('0x31')]['threadId']){return _0x4bcbb8[_0x8386('0x16')][_0x8386('0x1a')]({'threadId':_0x3ce83d[_0x8386('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x5242d5[_0x8386('0x31')]['id']}});}else{return;}})[_0x8386('0x19')](function(){return _0x19b779[_0x8386('0x1a')]({'read':!![]});})[_0x8386('0x1c')](function(_0x7bf864){logger[_0x8386('0x1d')](_0x8386('0x27'),_0x8386('0x28'),util[_0x8386('0x32')](_0x7bf864,{'showHidden':![],'depth':null}));_0x1a6e2f();});}else{_0x1a6e2f();}})['finally'](function(){_0x1a6e2f();});}else{_0x1a6e2f();}}},'charset':'utf8mb4','collate':_0x8386('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 7576f69..4d9c8de 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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x3eb51a,_0x3c3a6e){var _0x5eb741=function(_0x355bc3){while(--_0x355bc3){_0x3eb51a['push'](_0x3eb51a['shift']());}};_0x5eb741(++_0x3c3a6e);}(_0xb10b,0x12a));var _0xbb10=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0xb10b[_0x35485a];return _0x5148e6;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x4162ed,_0x3ab256){var _0xf2ad12=function(_0x4f1c05){while(--_0x4f1c05){_0x4162ed['push'](_0x4162ed['shift']());}};_0xf2ad12(++_0x3ab256);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 2b01f04..9552b2b 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 _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file +var _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x4fd168,_0x5722ff){var _0x41792d=function(_0x2ec2f0){while(--_0x2ec2f0){_0x4fd168['push'](_0x4fd168['shift']());}};_0x41792d(++_0x5722ff);}(_0xf4eb,0xec));var _0xbf4e=function(_0x224ea5,_0x2ca08c){_0x224ea5=_0x224ea5-0x0;var _0x15db57=_0xf4eb[_0x224ea5];return _0x15db57;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f6a32a7..87fbbb3 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 _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x28fe92,_0x403572){var _0x3ff255=function(_0x3c2635){while(--_0x3c2635){_0x28fe92['push'](_0x28fe92['shift']());}};_0x3ff255(++_0x403572);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x1a0faf,_0x1f4b7d){var _0x522fee=function(_0x47d0de){while(--_0x47d0de){_0x1a0faf['push'](_0x1a0faf['shift']());}};_0x522fee(++_0x1f4b7d);}(_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/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 10d96a1..98a66d1 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 _0x69a4=['INTEGER','beepall','roundrobin','exports','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x69a4,0x76));var _0x469a=function(_0x4598c9,_0x2d416d){_0x4598c9=_0x4598c9-0x0;var _0x2aa386=_0x69a4[_0x4598c9];return _0x2aa386;};'use strict';var Sequelize=require('sequelize');module[_0x469a('0x0')]={'name':{'type':Sequelize[_0x469a('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x469a('0x1')]},'timeout':{'type':Sequelize[_0x469a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x469a('0x3'),_0x469a('0x4'))}}; \ No newline at end of file +var _0xe396=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0xe396,0xa3));var _0x6e39=function(_0x247174,_0x2d1e9d){_0x247174=_0x247174-0x0;var _0x3c7af6=_0xe396[_0x247174];return _0x3c7af6;};'use strict';var Sequelize=require(_0x6e39('0x0'));module[_0x6e39('0x1')]={'name':{'type':Sequelize[_0x6e39('0x2')],'unique':_0x6e39('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6e39('0x2')]},'timeout':{'type':Sequelize[_0x6e39('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6e39('0x5')](_0x6e39('0x6'),_0x6e39('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index ec0863e..ad6f4d1 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 _0x63bb=['undefined','count','offset','Content-Range','apply','reject','save','OpenchannelQueues','UserProfileResource','destroy','then','end','sendStatus','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','OpenchannelQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','catch','rawAttributes','length','find','user','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','UserOpenchannelQueue','findAll','findAndCountAll','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','openchannelPause','getTeams','findOne','Team','nolimit','addTeams','ids','User','voicePause','Agents','sequelize','transaction','each','emit','userOpenchannelQueue:save','removeTeams','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','json','limit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x63bb,0xf8));var _0xb63b=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x63bb[_0x5951e8];return _0x20a1f5;};'use strict';var emlformat=require(_0xb63b('0x0'));var rimraf=require(_0xb63b('0x1'));var zipdir=require(_0xb63b('0x2'));var jsonpatch=require(_0xb63b('0x3'));var rp=require(_0xb63b('0x4'));var moment=require(_0xb63b('0x5'));var BPromise=require(_0xb63b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb63b('0x7'));var sox=require(_0xb63b('0x8'));var csv=require(_0xb63b('0x9'));var ejs=require(_0xb63b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb63b('0xb'));var squel=require(_0xb63b('0xc'));var crypto=require(_0xb63b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb63b('0xe'));var toCsv=require(_0xb63b('0x9'));var querystring=require('querystring');var Papa=require(_0xb63b('0xf'));var Redis=require(_0xb63b('0x10'));var authService=require(_0xb63b('0x11'));var qs=require(_0xb63b('0x12'));var as=require(_0xb63b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb63b('0x14'))(_0xb63b('0x15'));var utils=require(_0xb63b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb63b('0x17'))['db'];config[_0xb63b('0x18')]=_[_0xb63b('0x19')](config[_0xb63b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xb63b('0x1a'))(new Redis(config[_0xb63b('0x18')]));require(_0xb63b('0x1b'))[_0xb63b('0x1c')](socket);function respondWithStatusCode(_0x2d0e2a,_0x2a9f72){_0x2a9f72=_0x2a9f72||0xcc;return function(_0x40fd5e){if(_0x40fd5e){return _0x2d0e2a['sendStatus'](_0x2a9f72);}return _0x2d0e2a[_0xb63b('0x1d')](_0x2a9f72)['end']();};}function respondWithResult(_0x21ac0e,_0x44ae16){_0x44ae16=_0x44ae16||0xc8;return function(_0x108d3a){if(_0x108d3a){return _0x21ac0e[_0xb63b('0x1d')](_0x44ae16)[_0xb63b('0x1e')](_0x108d3a);}};}function respondWithFilteredResult(_0x59718f,_0x1c864a){return function(_0x322426){if(_0x322426){var _0x53ce69=typeof _0x1c864a['offset']==='undefined'&&typeof _0x1c864a[_0xb63b('0x1f')]===_0xb63b('0x20');var _0x39b7b7=_0x322426[_0xb63b('0x21')];var _0x4f4527=_0x53ce69?0x0:_0x1c864a[_0xb63b('0x22')];var _0x1735fa=_0x53ce69?_0x322426[_0xb63b('0x21')]:_0x1c864a[_0xb63b('0x22')]+_0x1c864a['limit'];var _0x482cb8;if(_0x1735fa>=_0x39b7b7){_0x1735fa=_0x39b7b7;_0x482cb8=0xc8;}else{_0x482cb8=0xce;}_0x59718f[_0xb63b('0x1d')](_0x482cb8);return _0x59718f['set'](_0xb63b('0x23'),_0x4f4527+'-'+_0x1735fa+'/'+_0x39b7b7)[_0xb63b('0x1e')](_0x322426);}return null;};}function patchUpdates(_0x37a57f){return function(_0x1678b6){try{jsonpatch[_0xb63b('0x24')](_0x1678b6,_0x37a57f,!![]);}catch(_0x2cc35c){return BPromise[_0xb63b('0x25')](_0x2cc35c);}return _0x1678b6[_0xb63b('0x26')]();};}function saveUpdates(_0x5aedd2,_0x215898){return function(_0x5e19eb){if(_0x5e19eb){return _0x5e19eb['update'](_0x5aedd2)['then'](function(_0x89c2ed){return _0x89c2ed;});}return null;};}function removeEntity(_0x3e8121,_0x4f8b1d){return function(_0x387966){if(_0x387966){return _0x387966['destroy']()['then'](function(){var _0x512053=_0x387966['get']({'plain':!![]});var _0x5c396a=_0xb63b('0x27');return db[_0xb63b('0x28')][_0xb63b('0x29')]({'where':{'type':_0x5c396a,'resourceId':_0x512053['id']}})[_0xb63b('0x2a')](function(){return _0x387966;});})[_0xb63b('0x2a')](function(){_0x3e8121['status'](0xcc)[_0xb63b('0x2b')]();});}};}function handleEntityNotFound(_0x1fd64d,_0x4ddcf0){return function(_0x239e4c){if(!_0x239e4c){_0x1fd64d[_0xb63b('0x2c')](0x194);}return _0x239e4c;};}function handleError(_0x20e797,_0x25a7c9){_0x25a7c9=_0x25a7c9||0x1f4;return function(_0x3757a6){logger['error'](_0x3757a6[_0xb63b('0x2d')]);if(_0x3757a6['name']){delete _0x3757a6[_0xb63b('0x2e')];}_0x20e797[_0xb63b('0x1d')](_0x25a7c9)[_0xb63b('0x2f')](_0x3757a6);};}function getMustacheRender(_0x49cd65,_0x1b573a){return Mustache[_0xb63b('0x30')](_0x49cd65,_[_0xb63b('0x31')](_0x1b573a[_0xb63b('0x32')],{'contact':_0x1b573a[_0xb63b('0x33')],'message':_0x1b573a[_0xb63b('0x34')],'agent':_0x1b573a[_0xb63b('0x35')],'interaction':_0x1b573a[_0xb63b('0x36')],'account':_0x1b573a[_0xb63b('0x37')]}))||'';}exports[_0xb63b('0x38')]=function(_0x393556,_0x46ce32){var _0x2c3afa={},_0x2f8a09={},_0x28954a={'count':0x0,'rows':[]};var _0xa04281=_[_0xb63b('0x39')](db[_0xb63b('0x3a')]['rawAttributes'],function(_0xe546a3){return{'name':_0xe546a3[_0xb63b('0x3b')],'type':_0xe546a3['type'][_0xb63b('0x3c')]};});_0x2f8a09[_0xb63b('0x3d')]=_['map'](_0xa04281,_0xb63b('0x2e'));_0x2f8a09[_0xb63b('0x3e')]=_[_0xb63b('0x3f')](_0x393556['query']);_0x2f8a09[_0xb63b('0x40')]=_[_0xb63b('0x41')](_0x2f8a09['model'],_0x2f8a09['query']);_0x2c3afa[_0xb63b('0x42')]=_[_0xb63b('0x41')](_0x2f8a09[_0xb63b('0x3d')],qs[_0xb63b('0x43')](_0x393556[_0xb63b('0x3e')][_0xb63b('0x43')]));_0x2c3afa[_0xb63b('0x42')]=_0x2c3afa[_0xb63b('0x42')]['length']?_0x2c3afa[_0xb63b('0x42')]:_0x2f8a09['model'];if(!_0x393556[_0xb63b('0x3e')][_0xb63b('0x44')]('nolimit')){_0x2c3afa['limit']=qs[_0xb63b('0x1f')](_0x393556[_0xb63b('0x3e')][_0xb63b('0x1f')]);_0x2c3afa[_0xb63b('0x22')]=qs[_0xb63b('0x22')](_0x393556[_0xb63b('0x3e')][_0xb63b('0x22')]);}_0x2c3afa[_0xb63b('0x45')]=qs[_0xb63b('0x46')](_0x393556[_0xb63b('0x3e')][_0xb63b('0x46')]);_0x2c3afa[_0xb63b('0x47')]=qs[_0xb63b('0x40')](_[_0xb63b('0x48')](_0x393556[_0xb63b('0x3e')],_0x2f8a09[_0xb63b('0x40')]),_0xa04281);if(_0x393556[_0xb63b('0x3e')][_0xb63b('0x49')]){_0x2c3afa[_0xb63b('0x47')]=_[_0xb63b('0x31')](_0x2c3afa[_0xb63b('0x47')],{'$or':_[_0xb63b('0x39')](_0xa04281,function(_0x5c20ab){if(_0x5c20ab['type']!=='VIRTUAL'){var _0x4ade9f={};_0x4ade9f[_0x5c20ab[_0xb63b('0x2e')]]={'$like':'%'+_0x393556[_0xb63b('0x3e')][_0xb63b('0x49')]+'%'};return _0x4ade9f;}})});}_0x2c3afa=_[_0xb63b('0x31')]({},_0x2c3afa,_0x393556[_0xb63b('0x4a')]);var _0x15c8b8={'where':_0x2c3afa[_0xb63b('0x47')]};return db[_0xb63b('0x3a')]['count'](_0x15c8b8)[_0xb63b('0x2a')](function(_0x2e7591){_0x28954a[_0xb63b('0x21')]=_0x2e7591;if(_0x393556[_0xb63b('0x3e')][_0xb63b('0x4b')]){_0x2c3afa[_0xb63b('0x4c')]=[{'all':!![]}];}return db[_0xb63b('0x3a')]['findAll'](_0x2c3afa);})['then'](function(_0x41c5c3){_0x28954a['rows']=_0x41c5c3;return _0x28954a;})[_0xb63b('0x2a')](respondWithFilteredResult(_0x46ce32,_0x2c3afa))[_0xb63b('0x4d')](handleError(_0x46ce32,null));};exports['show']=function(_0x205fae,_0x224931){var _0x2093de={'raw':!![],'where':{'id':_0x205fae['params']['id']}},_0x2ee090={};_0x2ee090[_0xb63b('0x3d')]=_[_0xb63b('0x3f')](db[_0xb63b('0x3a')][_0xb63b('0x4e')]);_0x2ee090[_0xb63b('0x3e')]=_[_0xb63b('0x3f')](_0x205fae['query']);_0x2ee090[_0xb63b('0x40')]=_[_0xb63b('0x41')](_0x2ee090[_0xb63b('0x3d')],_0x2ee090[_0xb63b('0x3e')]);_0x2093de['attributes']=_[_0xb63b('0x41')](_0x2ee090[_0xb63b('0x3d')],qs['fields'](_0x205fae[_0xb63b('0x3e')][_0xb63b('0x43')]));_0x2093de[_0xb63b('0x42')]=_0x2093de[_0xb63b('0x42')][_0xb63b('0x4f')]?_0x2093de[_0xb63b('0x42')]:_0x2ee090[_0xb63b('0x3d')];if(_0x205fae['query'][_0xb63b('0x4b')]){_0x2093de['include']=[{'all':!![]}];}_0x2093de=_['merge']({},_0x2093de,_0x205fae[_0xb63b('0x4a')]);return db['OpenchannelQueue'][_0xb63b('0x50')](_0x2093de)[_0xb63b('0x2a')](handleEntityNotFound(_0x224931,null))[_0xb63b('0x2a')](respondWithResult(_0x224931,null))['catch'](handleError(_0x224931,null));};exports['create']=function(_0x520ff2,_0x3fa092){return db[_0xb63b('0x3a')]['create'](_0x520ff2[_0xb63b('0x32')],{})[_0xb63b('0x2a')](function(_0x4a4727){var _0x185020=_0x520ff2[_0xb63b('0x51')][_0xb63b('0x52')]({'plain':!![]});if(!_0x185020)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x185020['role']===_0xb63b('0x51')){var _0x2b4420=_0x4a4727[_0xb63b('0x52')]({'plain':!![]});var _0x336749=_0xb63b('0x27');return db[_0xb63b('0x53')]['find']({'where':{'name':_0x336749,'userProfileId':_0x185020['userProfileId']},'raw':!![]})['then'](function(_0x3d3b13){if(_0x3d3b13&&_0x3d3b13[_0xb63b('0x54')]===0x0){return db[_0xb63b('0x28')]['create']({'name':_0x2b4420['name'],'resourceId':_0x2b4420['id'],'type':_0x3d3b13['name'],'sectionId':_0x3d3b13['id']},{})['then'](function(){return _0x4a4727;});}else{return _0x4a4727;}})[_0xb63b('0x4d')](function(_0x15767b){logger[_0xb63b('0x55')](_0xb63b('0x56'),_0x15767b);throw _0x15767b;});}return _0x4a4727;})['then'](respondWithResult(_0x3fa092,0xc9))[_0xb63b('0x4d')](handleError(_0x3fa092,null));};exports[_0xb63b('0x57')]=function(_0x4b4adc,_0x117730){if(_0x4b4adc[_0xb63b('0x32')]['id']){delete _0x4b4adc[_0xb63b('0x32')]['id'];}return db[_0xb63b('0x3a')]['find']({'where':{'id':_0x4b4adc[_0xb63b('0x58')]['id']}})['then'](handleEntityNotFound(_0x117730,null))[_0xb63b('0x2a')](saveUpdates(_0x4b4adc[_0xb63b('0x32')],null))['then'](respondWithResult(_0x117730,null))[_0xb63b('0x4d')](handleError(_0x117730,null));};exports[_0xb63b('0x29')]=function(_0x1d43a2,_0x859f67){return db['OpenchannelQueue'][_0xb63b('0x50')]({'where':{'id':_0x1d43a2[_0xb63b('0x58')]['id']}})[_0xb63b('0x2a')](handleEntityNotFound(_0x859f67,null))[_0xb63b('0x2a')](removeEntity(_0x859f67,null))[_0xb63b('0x4d')](handleError(_0x859f67,null));};exports[_0xb63b('0x59')]=function(_0x4e5f53,_0x2b44a0){return db[_0xb63b('0x3a')][_0xb63b('0x59')]()['then'](respondWithResult(_0x2b44a0,null))['catch'](handleError(_0x2b44a0,null));};exports[_0xb63b('0x5a')]=function(_0x579d69,_0x245479,_0x256e6c){var _0x2c9b84={'raw':!![],'where':{}},_0xa6746={},_0x1843a4;return db[_0xb63b('0x3a')]['findOne']({'where':{'id':_0x579d69[_0xb63b('0x58')]['id']}})['then'](handleEntityNotFound(_0x245479,null))[_0xb63b('0x2a')](function(_0x3e97e3){if(_0x3e97e3){_0x1843a4=_0x3e97e3['get']({'plain':!![]});_0xa6746['model']=_[_0xb63b('0x3f')](db[_0xb63b('0x5b')][_0xb63b('0x4e')]);_0xa6746[_0xb63b('0x3e')]=_[_0xb63b('0x3f')](_0x579d69[_0xb63b('0x3e')]);_0xa6746['filters']=_[_0xb63b('0x41')](_0xa6746[_0xb63b('0x3d')],_0xa6746['query']);_0x2c9b84[_0xb63b('0x42')]=_['intersection'](_0xa6746['model'],qs[_0xb63b('0x43')](_0x579d69[_0xb63b('0x3e')][_0xb63b('0x43')]));_0x2c9b84[_0xb63b('0x42')]=_0x2c9b84[_0xb63b('0x42')][_0xb63b('0x4f')]?_0x2c9b84[_0xb63b('0x42')]:_0xa6746[_0xb63b('0x3d')];if(!_0x579d69[_0xb63b('0x3e')][_0xb63b('0x44')]('nolimit')){_0x2c9b84[_0xb63b('0x1f')]=qs[_0xb63b('0x1f')](_0x579d69[_0xb63b('0x3e')][_0xb63b('0x1f')]);_0x2c9b84[_0xb63b('0x22')]=qs[_0xb63b('0x22')](_0x579d69[_0xb63b('0x3e')][_0xb63b('0x22')]);}_0x2c9b84[_0xb63b('0x45')]=qs[_0xb63b('0x46')](_0x579d69[_0xb63b('0x3e')][_0xb63b('0x46')]);_0x2c9b84[_0xb63b('0x47')]=qs[_0xb63b('0x40')](_[_0xb63b('0x48')](_0x579d69[_0xb63b('0x3e')],_0xa6746['filters']));_0x2c9b84[_0xb63b('0x47')]['OpenchannelQueueId']=_0x3e97e3['id'];if(_0x579d69[_0xb63b('0x3e')][_0xb63b('0x49')]){_0x2c9b84[_0xb63b('0x47')]=_[_0xb63b('0x31')](_0x2c9b84[_0xb63b('0x47')],{'$or':_[_0xb63b('0x39')](_0x2c9b84[_0xb63b('0x42')],function(_0x3a055f){var _0x5eef9a={};_0x5eef9a[_0x3a055f]={'$like':'%'+_0x579d69[_0xb63b('0x3e')][_0xb63b('0x49')]+'%'};return _0x5eef9a;})});}_0x2c9b84=_[_0xb63b('0x31')]({},_0x2c9b84,_0x579d69['options']);return db[_0xb63b('0x5b')][_0xb63b('0x5c')](_0x2c9b84);}})[_0xb63b('0x2a')](function(_0xf0a8ae){if(_0xf0a8ae){return db['User'][_0xb63b('0x5d')]({'where':{'id':_[_0xb63b('0x39')](_0xf0a8ae,_0xb63b('0x5e')),'role':_0xb63b('0x35')},'attributes':['id',_0xb63b('0x2e'),'openchannelPause',_0xb63b('0x5f'),_0xb63b('0x60')]});}})[_0xb63b('0x2a')](function(_0x27ec9f){if(_0x27ec9f){return{'count':_0x27ec9f[_0xb63b('0x21')],'rows':_[_0xb63b('0x39')](_0x27ec9f[_0xb63b('0x61')],function(_0x28301c){return{'membername':_0x28301c[_0xb63b('0x2e')],'UserId':_0x28301c['id'],'queue_name':_0x1843a4['name'],'OpenchannelQueueId':_0x1843a4['id'],'interface':util[_0xb63b('0x62')](_0xb63b('0x63'),_0xb63b('0x64'),_0x28301c[_0xb63b('0x2e')]),'penalty':0x0,'paused':_0x28301c[_0xb63b('0x65')],'createdAt':_0x28301c[_0xb63b('0x60')],'updatedAt':_0x28301c[_0xb63b('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb63b('0x2a')](respondWithFilteredResult(_0x245479,_0x2c9b84))[_0xb63b('0x4d')](handleError(_0x245479,null));};exports[_0xb63b('0x66')]=function(_0x3fe78,_0x113b1c,_0x57e508){var _0x10a9c7={};var _0x4a5a43={};var _0x2de207;var _0x482059;return db['OpenchannelQueue'][_0xb63b('0x67')]({'where':{'id':_0x3fe78[_0xb63b('0x58')]['id']}})[_0xb63b('0x2a')](handleEntityNotFound(_0x113b1c,null))[_0xb63b('0x2a')](function(_0x350a8f){if(_0x350a8f){_0x2de207=_0x350a8f;_0x4a5a43[_0xb63b('0x3d')]=_[_0xb63b('0x3f')](db[_0xb63b('0x68')]['rawAttributes']);_0x4a5a43['query']=_[_0xb63b('0x3f')](_0x3fe78[_0xb63b('0x3e')]);_0x4a5a43['filters']=_['intersection'](_0x4a5a43['model'],_0x4a5a43['query']);_0x10a9c7[_0xb63b('0x42')]=_[_0xb63b('0x41')](_0x4a5a43[_0xb63b('0x3d')],qs['fields'](_0x3fe78['query']['fields']));_0x10a9c7[_0xb63b('0x42')]=_0x10a9c7[_0xb63b('0x42')][_0xb63b('0x4f')]?_0x10a9c7[_0xb63b('0x42')]:_0x4a5a43['model'];_0x10a9c7[_0xb63b('0x45')]=qs[_0xb63b('0x46')](_0x3fe78[_0xb63b('0x3e')][_0xb63b('0x46')]);_0x10a9c7[_0xb63b('0x47')]=qs[_0xb63b('0x40')](_['pick'](_0x3fe78[_0xb63b('0x3e')],_0x4a5a43[_0xb63b('0x40')]));if(_0x3fe78[_0xb63b('0x3e')]['filter']){_0x10a9c7[_0xb63b('0x47')]=_[_0xb63b('0x31')](_0x10a9c7[_0xb63b('0x47')],{'$or':_[_0xb63b('0x39')](_0x10a9c7['attributes'],function(_0x5e4299){var _0x145eac={};_0x145eac[_0x5e4299]={'$like':'%'+_0x3fe78[_0xb63b('0x3e')]['filter']+'%'};return _0x145eac;})});}_0x10a9c7=_[_0xb63b('0x31')]({},_0x10a9c7,_0x3fe78[_0xb63b('0x4a')]);return _0x2de207[_0xb63b('0x66')](_0x10a9c7);}})[_0xb63b('0x2a')](function(_0x277186){if(_0x277186){_0x482059=_0x277186['length'];if(!_0x3fe78['query']['hasOwnProperty'](_0xb63b('0x69'))){_0x10a9c7[_0xb63b('0x1f')]=qs[_0xb63b('0x1f')](_0x3fe78[_0xb63b('0x3e')]['limit']);_0x10a9c7['offset']=qs[_0xb63b('0x22')](_0x3fe78['query']['offset']);}return _0x2de207['getTeams'](_0x10a9c7);}})[_0xb63b('0x2a')](function(_0x30951e){if(_0x30951e){return _0x30951e?{'count':_0x482059,'rows':_0x30951e}:null;}})[_0xb63b('0x2a')](respondWithResult(_0x113b1c,null))[_0xb63b('0x4d')](handleError(_0x113b1c,null));};exports[_0xb63b('0x6a')]=function(_0x54f624,_0x1338ee,_0x3458a2){var _0x23baa9=_0x54f624[_0xb63b('0x32')][_0xb63b('0x6b')];return db[_0xb63b('0x68')][_0xb63b('0x5c')]({'where':{'id':_0x23baa9},'attributes':['id'],'include':[{'model':db[_0xb63b('0x6c')],'as':'Agents','attributes':['id',_0xb63b('0x2e'),'online',_0xb63b('0x6d'),'interface'],'raw':!![]}]})[_0xb63b('0x2a')](function(_0xd03ea0){if(_0xd03ea0){var _0x438627=_['flatMap'](_0xd03ea0,function(_0x58ed2c){var _0x3191dd=_0x58ed2c[_0xb63b('0x52')]({'plain':!![]});return _0x3191dd[_0xb63b('0x6e')];});return db[_0xb63b('0x3a')][_0xb63b('0x50')]({'where':{'id':_0x54f624[_0xb63b('0x58')]['id']}})[_0xb63b('0x2a')](function(_0x485e2c){return db[_0xb63b('0x6f')][_0xb63b('0x70')](function(_0xed6996){return _0x485e2c[_0xb63b('0x6a')](_0x23baa9,{'transaction':_0xed6996})[_0xb63b('0x2a')](function(){return BPromise[_0xb63b('0x71')](_0x438627,function(_0x1c1de7){return db[_0xb63b('0x5b')]['findOrCreate']({'where':{'UserId':_0x1c1de7['id'],'OpenchannelQueueId':_0x54f624['params']['id']},'transaction':_0xed6996});});})['then'](function(){_0x438627['forEach'](function(_0x5b14dd){socket[_0xb63b('0x72')](_0xb63b('0x73'),{'UserId':_0x5b14dd['id'],'OpenchannelQueueId':_0x485e2c['id']});});});});});}})[_0xb63b('0x2a')](respondWithStatusCode(_0x1338ee,null))[_0xb63b('0x4d')](handleError(_0x1338ee,null));};exports[_0xb63b('0x74')]=function(_0x2ae5f3,_0x52ee04,_0x925ed8){return db['Team']['findAll']({'where':{'id':_0x2ae5f3[_0xb63b('0x3e')][_0xb63b('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xb63b('0x6c')],'as':_0xb63b('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x52ee04,null))[_0xb63b('0x2a')](function(_0x103416){var _0x48d4ca=_[_0xb63b('0x39')](_0x103416,'id');var _0x10aefc=[];var _0x5c8535=[];var _0x2ca497=squel['select']();_0x2ca497['field'](_0xb63b('0x75'))[_0xb63b('0x76')](_0xb63b('0x77'),'tq')['join'](_0xb63b('0x78'),'ut',_0xb63b('0x79'))[_0xb63b('0x47')](_0xb63b('0x7a'),_0x2ae5f3['params']['id']);for(var _0xf04071=0x0;_0xf04071<_0x103416[_0xb63b('0x4f')];_0xf04071+=0x1){let _0x1bcfbb=_0x103416[_0xf04071];for(var _0x24ed78=0x0;_0x24ed78<_0x1bcfbb['Agents'][_0xb63b('0x4f')];_0x24ed78+=0x1){let _0x58e9af=_0x1bcfbb['Agents'][_0x24ed78];var _0x308a15=_0x2ca497[_0xb63b('0x7b')]();_0x308a15[_0xb63b('0x47')]('ut.UserId\x20=\x20?',_0x58e9af['id']);_0x5c8535['push'](db[_0xb63b('0x6f')]['query'](_0x308a15[_0xb63b('0x7c')](),{'type':db[_0xb63b('0x6f')][_0xb63b('0x7d')][_0xb63b('0x7e')]})['then'](function(_0x15680e){if(_0x15680e[_0xb63b('0x4f')]===0x1){return _0x58e9af['id'];}else{var _0x341a1f=_[_0xb63b('0x7f')](_[_0xb63b('0x39')](_0x15680e,_0xb63b('0x80')),function(_0x51a570){return _['includes'](_0x48d4ca,_0x51a570);});if(_0x341a1f){return _0x58e9af['id'];}}}));}}return BPromise[_0xb63b('0x81')](_0x5c8535)[_0xb63b('0x2a')](function(_0x135990){_0x10aefc=_(_0x10aefc)[_0xb63b('0x82')](_0x135990)[_0xb63b('0x83')]()[_0xb63b('0x84')]();return db[_0xb63b('0x3a')][_0xb63b('0x50')]({'where':{'id':_0x2ae5f3[_0xb63b('0x58')]['id']}})[_0xb63b('0x2a')](function(_0x1f4e05){return db['sequelize']['transaction'](function(_0x59f9c2){return _0x1f4e05[_0xb63b('0x74')](_0x2ae5f3[_0xb63b('0x3e')][_0xb63b('0x6b')],{'transaction':_0x59f9c2})[_0xb63b('0x2a')](function(){if(!_['isEmpty'](_0x10aefc)){return _0x1f4e05[_0xb63b('0x85')](_0x10aefc,{'transaction':_0x59f9c2});}})['then'](function(){_0x10aefc[_0xb63b('0x86')](function(_0x20a216){socket[_0xb63b('0x72')](_0xb63b('0x87'),{'UserId':_0x20a216,'OpenchannelQueueId':_0x1f4e05['id']});});});});});});})[_0xb63b('0x2a')](respondWithStatusCode(_0x52ee04,null))[_0xb63b('0x4d')](handleError(_0x52ee04,null));};exports[_0xb63b('0x88')]=function(_0x5d2931,_0x4d52b9,_0x21aa56){return db[_0xb63b('0x3a')][_0xb63b('0x50')]({'where':{'id':_0x5d2931[_0xb63b('0x58')]['id']}})[_0xb63b('0x2a')](handleEntityNotFound(_0x4d52b9,null))[_0xb63b('0x2a')](function(_0xea8951){if(_0xea8951){return _0xea8951[_0xb63b('0x88')](_0x5d2931['body'][_0xb63b('0x6b')],_['omit'](_0x5d2931[_0xb63b('0x32')],[_0xb63b('0x6b'),'id'])||{})[_0xb63b('0x89')](function(_0x16ca9a){for(var _0x53d6cf=0x0;_0x53d6cf<_0x5d2931[_0xb63b('0x32')][_0xb63b('0x6b')][_0xb63b('0x4f')];_0x53d6cf+=0x1){socket[_0xb63b('0x72')]('userOpenchannelQueue:save',{'UserId':_0x5d2931['body'][_0xb63b('0x6b')][_0x53d6cf],'OpenchannelQueueId':_0x5d2931[_0xb63b('0x58')]['id']});}return _0x16ca9a;});}})[_0xb63b('0x2a')](respondWithResult(_0x4d52b9,null))['catch'](handleError(_0x4d52b9,null));};exports[_0xb63b('0x85')]=function(_0xd71454,_0x533914,_0x3b5e2f){return db['OpenchannelQueue']['find']({'where':{'id':_0xd71454[_0xb63b('0x58')]['id']}})[_0xb63b('0x2a')](handleEntityNotFound(_0x533914,null))['then'](function(_0x431159){if(_0x431159){return _0x431159[_0xb63b('0x85')](_0xd71454[_0xb63b('0x3e')]['ids'])[_0xb63b('0x2a')](function(){if(_[_0xb63b('0x8a')](_0xd71454[_0xb63b('0x3e')]['ids'])){for(var _0x28b745=0x0;_0x28b745<_0xd71454['query'][_0xb63b('0x6b')][_0xb63b('0x4f')];_0x28b745+=0x1){socket[_0xb63b('0x72')](_0xb63b('0x87'),{'UserId':Number(_0xd71454['query'][_0xb63b('0x6b')][_0x28b745]),'OpenchannelQueueId':Number(_0xd71454[_0xb63b('0x58')]['id'])});}}else{socket[_0xb63b('0x72')](_0xb63b('0x87'),{'UserId':Number(_0xd71454[_0xb63b('0x3e')][_0xb63b('0x6b')]),'OpenchannelQueueId':Number(_0xd71454['params']['id'])});}});}})[_0xb63b('0x2a')](respondWithStatusCode(_0x533914,null))['catch'](handleError(_0x533914,null));};exports[_0xb63b('0x8b')]=function(_0x271420,_0xc04db9,_0x38c360){var _0x1e5edd={};var _0x4c581e={};var _0xad3b;var _0x57362d;return db['OpenchannelQueue'][_0xb63b('0x67')]({'where':{'id':_0x271420['params']['id']}})[_0xb63b('0x2a')](handleEntityNotFound(_0xc04db9,null))[_0xb63b('0x2a')](function(_0x1573d0){if(_0x1573d0){_0xad3b=_0x1573d0;_0x4c581e[_0xb63b('0x3d')]=_[_0xb63b('0x3f')](db['User'][_0xb63b('0x4e')]);_0x4c581e[_0xb63b('0x3e')]=_[_0xb63b('0x3f')](_0x271420['query']);_0x4c581e[_0xb63b('0x40')]=_[_0xb63b('0x41')](_0x4c581e[_0xb63b('0x3d')],_0x4c581e['query']);_0x1e5edd[_0xb63b('0x42')]=_['intersection'](_0x4c581e['model'],qs[_0xb63b('0x43')](_0x271420[_0xb63b('0x3e')]['fields']));_0x1e5edd[_0xb63b('0x42')]=_0x1e5edd[_0xb63b('0x42')]['length']?_0x1e5edd[_0xb63b('0x42')]:_0x4c581e[_0xb63b('0x3d')];_0x1e5edd[_0xb63b('0x45')]=qs[_0xb63b('0x46')](_0x271420[_0xb63b('0x3e')]['sort']);_0x1e5edd['where']=qs[_0xb63b('0x40')](_[_0xb63b('0x48')](_0x271420[_0xb63b('0x3e')],_0x4c581e[_0xb63b('0x40')]));if(_0x271420['query'][_0xb63b('0x49')]){_0x1e5edd[_0xb63b('0x47')]=_[_0xb63b('0x31')](_0x1e5edd[_0xb63b('0x47')],{'$or':_[_0xb63b('0x39')](_0x1e5edd[_0xb63b('0x42')],function(_0x27948c){var _0x2501c5={};_0x2501c5[_0x27948c]={'$like':'%'+_0x271420[_0xb63b('0x3e')][_0xb63b('0x49')]+'%'};return _0x2501c5;})});}_0x1e5edd=_[_0xb63b('0x31')]({},_0x1e5edd,_0x271420[_0xb63b('0x4a')]);return _0xad3b[_0xb63b('0x8b')](_0x1e5edd);}})[_0xb63b('0x2a')](function(_0x3a97bf){if(_0x3a97bf){_0x57362d=_0x3a97bf[_0xb63b('0x4f')];if(!_0x271420[_0xb63b('0x3e')][_0xb63b('0x44')](_0xb63b('0x69'))){_0x1e5edd[_0xb63b('0x1f')]=qs[_0xb63b('0x1f')](_0x271420['query'][_0xb63b('0x1f')]);_0x1e5edd['offset']=qs[_0xb63b('0x22')](_0x271420[_0xb63b('0x3e')][_0xb63b('0x22')]);}return _0xad3b[_0xb63b('0x8b')](_0x1e5edd);}})[_0xb63b('0x2a')](function(_0x35ce75){if(_0x35ce75){return _0x35ce75?{'count':_0x57362d,'rows':_0x35ce75}:null;}})[_0xb63b('0x2a')](respondWithResult(_0xc04db9,null))[_0xb63b('0x4d')](handleError(_0xc04db9,null));}; \ No newline at end of file +var _0x3ae9=['VIRTUAL','OpenchannelQueue','includeAll','findAll','rows','show','params','include','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','options','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','openchannelPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./openchannelQueue.socket','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','name','send','render','merge','body','contact','message','interaction','account','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x24cc72,_0x4dc73a){var _0xd49f1e=function(_0x39f581){while(--_0x39f581){_0x24cc72['push'](_0x24cc72['shift']());}};_0xd49f1e(++_0x4dc73a);}(_0x3ae9,0xdb));var _0x93ae=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x3ae9[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x93ae('0x0'));var jsonpatch=require(_0x93ae('0x1'));var rp=require(_0x93ae('0x2'));var moment=require('moment');var BPromise=require(_0x93ae('0x3'));var Mustache=require(_0x93ae('0x4'));var util=require(_0x93ae('0x5'));var path=require(_0x93ae('0x6'));var sox=require('sox');var csv=require(_0x93ae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93ae('0x8'));var _=require(_0x93ae('0x9'));var squel=require(_0x93ae('0xa'));var crypto=require(_0x93ae('0xb'));var jsforce=require(_0x93ae('0xc'));var deskjs=require(_0x93ae('0xd'));var toCsv=require('to-csv');var querystring=require(_0x93ae('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x93ae('0xf'));var as=require(_0x93ae('0x10'));var hardwareService=require(_0x93ae('0x11'));var logger=require(_0x93ae('0x12'))(_0x93ae('0x13'));var utils=require(_0x93ae('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x93ae('0x15'))['db'];config[_0x93ae('0x16')]=_['defaults'](config['redis'],{'host':_0x93ae('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x93ae('0x16')]));require(_0x93ae('0x18'))['register'](socket);function respondWithStatusCode(_0x392a55,_0x7f8662){_0x7f8662=_0x7f8662||0xcc;return function(_0x3c38b9){if(_0x3c38b9){return _0x392a55[_0x93ae('0x19')](_0x7f8662);}return _0x392a55[_0x93ae('0x1a')](_0x7f8662)[_0x93ae('0x1b')]();};}function respondWithResult(_0x5ed82a,_0x11a9ce){_0x11a9ce=_0x11a9ce||0xc8;return function(_0x282094){if(_0x282094){return _0x5ed82a[_0x93ae('0x1a')](_0x11a9ce)['json'](_0x282094);}};}function respondWithFilteredResult(_0x1a1718,_0x514a0c){return function(_0x54cfd0){if(_0x54cfd0){var _0x1002b6=typeof _0x514a0c['offset']===_0x93ae('0x1c')&&typeof _0x514a0c[_0x93ae('0x1d')]==='undefined';var _0x2dd19a=_0x54cfd0[_0x93ae('0x1e')];var _0x32afa8=_0x1002b6?0x0:_0x514a0c[_0x93ae('0x1f')];var _0x4a0cb8=_0x1002b6?_0x54cfd0[_0x93ae('0x1e')]:_0x514a0c[_0x93ae('0x1f')]+_0x514a0c['limit'];var _0x3e0407;if(_0x4a0cb8>=_0x2dd19a){_0x4a0cb8=_0x2dd19a;_0x3e0407=0xc8;}else{_0x3e0407=0xce;}_0x1a1718[_0x93ae('0x1a')](_0x3e0407);return _0x1a1718[_0x93ae('0x20')](_0x93ae('0x21'),_0x32afa8+'-'+_0x4a0cb8+'/'+_0x2dd19a)[_0x93ae('0x22')](_0x54cfd0);}return null;};}function patchUpdates(_0x468fdf){return function(_0xcdd84f){try{jsonpatch['apply'](_0xcdd84f,_0x468fdf,!![]);}catch(_0x5e7c32){return BPromise[_0x93ae('0x23')](_0x5e7c32);}return _0xcdd84f[_0x93ae('0x24')]();};}function saveUpdates(_0x4f9f43,_0x4d0c48){return function(_0x18ffeb){if(_0x18ffeb){return _0x18ffeb[_0x93ae('0x25')](_0x4f9f43)[_0x93ae('0x26')](function(_0x10f6a3){return _0x10f6a3;});}return null;};}function removeEntity(_0x1abea7,_0xe17086){return function(_0x1970f4){if(_0x1970f4){return _0x1970f4[_0x93ae('0x27')]()['then'](function(){var _0x564c15=_0x1970f4['get']({'plain':!![]});var _0x270319=_0x93ae('0x28');return db[_0x93ae('0x29')][_0x93ae('0x27')]({'where':{'type':_0x270319,'resourceId':_0x564c15['id']}})[_0x93ae('0x26')](function(){return _0x1970f4;});})[_0x93ae('0x26')](function(){_0x1abea7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x223f42,_0x115ac5){return function(_0x1aa36c){if(!_0x1aa36c){_0x223f42[_0x93ae('0x19')](0x194);}return _0x1aa36c;};}function handleError(_0x485622,_0x54d8fc){_0x54d8fc=_0x54d8fc||0x1f4;return function(_0x554318){logger[_0x93ae('0x2a')](_0x554318['stack']);if(_0x554318[_0x93ae('0x2b')]){delete _0x554318[_0x93ae('0x2b')];}_0x485622['status'](_0x54d8fc)[_0x93ae('0x2c')](_0x554318);};}function getMustacheRender(_0x1554cf,_0x11359d){return Mustache[_0x93ae('0x2d')](_0x1554cf,_[_0x93ae('0x2e')](_0x11359d[_0x93ae('0x2f')],{'contact':_0x11359d[_0x93ae('0x30')],'message':_0x11359d[_0x93ae('0x31')],'agent':_0x11359d['agent'],'interaction':_0x11359d[_0x93ae('0x32')],'account':_0x11359d[_0x93ae('0x33')]}))||'';}exports[_0x93ae('0x34')]=function(_0x1a8344,_0x176213){var _0x18759e={},_0x432b3e={},_0x19773f={'count':0x0,'rows':[]};var _0x53be22=_[_0x93ae('0x35')](db['OpenchannelQueue'][_0x93ae('0x36')],function(_0x116330){return{'name':_0x116330[_0x93ae('0x37')],'type':_0x116330[_0x93ae('0x38')][_0x93ae('0x39')]};});_0x432b3e[_0x93ae('0x3a')]=_['map'](_0x53be22,_0x93ae('0x2b'));_0x432b3e[_0x93ae('0x3b')]=_[_0x93ae('0x3c')](_0x1a8344['query']);_0x432b3e[_0x93ae('0x3d')]=_[_0x93ae('0x3e')](_0x432b3e[_0x93ae('0x3a')],_0x432b3e['query']);_0x18759e['attributes']=_[_0x93ae('0x3e')](_0x432b3e[_0x93ae('0x3a')],qs[_0x93ae('0x3f')](_0x1a8344[_0x93ae('0x3b')][_0x93ae('0x3f')]));_0x18759e[_0x93ae('0x40')]=_0x18759e[_0x93ae('0x40')][_0x93ae('0x41')]?_0x18759e[_0x93ae('0x40')]:_0x432b3e[_0x93ae('0x3a')];if(!_0x1a8344[_0x93ae('0x3b')][_0x93ae('0x42')](_0x93ae('0x43'))){_0x18759e[_0x93ae('0x1d')]=qs['limit'](_0x1a8344[_0x93ae('0x3b')][_0x93ae('0x1d')]);_0x18759e['offset']=qs[_0x93ae('0x1f')](_0x1a8344['query']['offset']);}_0x18759e[_0x93ae('0x44')]=qs['sort'](_0x1a8344[_0x93ae('0x3b')][_0x93ae('0x45')]);_0x18759e[_0x93ae('0x46')]=qs[_0x93ae('0x3d')](_[_0x93ae('0x47')](_0x1a8344[_0x93ae('0x3b')],_0x432b3e['filters']),_0x53be22);if(_0x1a8344[_0x93ae('0x3b')][_0x93ae('0x48')]){_0x18759e[_0x93ae('0x46')]=_[_0x93ae('0x2e')](_0x18759e[_0x93ae('0x46')],{'$or':_[_0x93ae('0x35')](_0x53be22,function(_0xfd2595){if(_0xfd2595[_0x93ae('0x38')]!==_0x93ae('0x49')){var _0x3fc8a2={};_0x3fc8a2[_0xfd2595[_0x93ae('0x2b')]]={'$like':'%'+_0x1a8344['query'][_0x93ae('0x48')]+'%'};return _0x3fc8a2;}})});}_0x18759e=_[_0x93ae('0x2e')]({},_0x18759e,_0x1a8344['options']);var _0x553f3a={'where':_0x18759e[_0x93ae('0x46')]};return db[_0x93ae('0x4a')][_0x93ae('0x1e')](_0x553f3a)[_0x93ae('0x26')](function(_0x3095b2){_0x19773f[_0x93ae('0x1e')]=_0x3095b2;if(_0x1a8344[_0x93ae('0x3b')][_0x93ae('0x4b')]){_0x18759e['include']=[{'all':!![]}];}return db[_0x93ae('0x4a')][_0x93ae('0x4c')](_0x18759e);})[_0x93ae('0x26')](function(_0x18a077){_0x19773f[_0x93ae('0x4d')]=_0x18a077;return _0x19773f;})['then'](respondWithFilteredResult(_0x176213,_0x18759e))['catch'](handleError(_0x176213,null));};exports[_0x93ae('0x4e')]=function(_0x5f3697,_0x39b3fb){var _0x4b4e7d={'raw':!![],'where':{'id':_0x5f3697[_0x93ae('0x4f')]['id']}},_0x499244={};_0x499244[_0x93ae('0x3a')]=_[_0x93ae('0x3c')](db[_0x93ae('0x4a')][_0x93ae('0x36')]);_0x499244[_0x93ae('0x3b')]=_[_0x93ae('0x3c')](_0x5f3697['query']);_0x499244[_0x93ae('0x3d')]=_['intersection'](_0x499244['model'],_0x499244[_0x93ae('0x3b')]);_0x4b4e7d[_0x93ae('0x40')]=_[_0x93ae('0x3e')](_0x499244[_0x93ae('0x3a')],qs['fields'](_0x5f3697[_0x93ae('0x3b')]['fields']));_0x4b4e7d[_0x93ae('0x40')]=_0x4b4e7d[_0x93ae('0x40')][_0x93ae('0x41')]?_0x4b4e7d[_0x93ae('0x40')]:_0x499244[_0x93ae('0x3a')];if(_0x5f3697[_0x93ae('0x3b')][_0x93ae('0x4b')]){_0x4b4e7d[_0x93ae('0x50')]=[{'all':!![]}];}_0x4b4e7d=_[_0x93ae('0x2e')]({},_0x4b4e7d,_0x5f3697['options']);return db['OpenchannelQueue']['find'](_0x4b4e7d)['then'](handleEntityNotFound(_0x39b3fb,null))['then'](respondWithResult(_0x39b3fb,null))[_0x93ae('0x51')](handleError(_0x39b3fb,null));};exports[_0x93ae('0x52')]=function(_0x42fa94,_0x39f6e3){return db['OpenchannelQueue'][_0x93ae('0x52')](_0x42fa94['body'],{})[_0x93ae('0x26')](function(_0x2d2089){var _0x3553d3=_0x42fa94[_0x93ae('0x53')][_0x93ae('0x54')]({'plain':!![]});if(!_0x3553d3)throw new Error(_0x93ae('0x55'));if(_0x3553d3[_0x93ae('0x56')]===_0x93ae('0x53')){var _0x436509=_0x2d2089['get']({'plain':!![]});var _0xe62c2d='OpenchannelQueues';return db[_0x93ae('0x57')][_0x93ae('0x58')]({'where':{'name':_0xe62c2d,'userProfileId':_0x3553d3[_0x93ae('0x59')]},'raw':!![]})[_0x93ae('0x26')](function(_0x2fad46){if(_0x2fad46&&_0x2fad46[_0x93ae('0x5a')]===0x0){return db[_0x93ae('0x29')]['create']({'name':_0x436509[_0x93ae('0x2b')],'resourceId':_0x436509['id'],'type':_0x2fad46['name'],'sectionId':_0x2fad46['id']},{})['then'](function(){return _0x2d2089;});}else{return _0x2d2089;}})[_0x93ae('0x51')](function(_0x3a8360){logger['error'](_0x93ae('0x5b'),_0x3a8360);throw _0x3a8360;});}return _0x2d2089;})[_0x93ae('0x26')](respondWithResult(_0x39f6e3,0xc9))[_0x93ae('0x51')](handleError(_0x39f6e3,null));};exports[_0x93ae('0x25')]=function(_0x2824c0,_0x4145f6){if(_0x2824c0[_0x93ae('0x2f')]['id']){delete _0x2824c0[_0x93ae('0x2f')]['id'];}return db[_0x93ae('0x4a')][_0x93ae('0x58')]({'where':{'id':_0x2824c0[_0x93ae('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4145f6,null))[_0x93ae('0x26')](saveUpdates(_0x2824c0[_0x93ae('0x2f')],null))[_0x93ae('0x26')](respondWithResult(_0x4145f6,null))[_0x93ae('0x51')](handleError(_0x4145f6,null));};exports[_0x93ae('0x27')]=function(_0x1ffa1e,_0x47ce30){return db[_0x93ae('0x4a')][_0x93ae('0x58')]({'where':{'id':_0x1ffa1e[_0x93ae('0x4f')]['id']}})[_0x93ae('0x26')](handleEntityNotFound(_0x47ce30,null))[_0x93ae('0x26')](removeEntity(_0x47ce30,null))['catch'](handleError(_0x47ce30,null));};exports[_0x93ae('0x5c')]=function(_0x3ccef1,_0x32d01d){return db['OpenchannelQueue'][_0x93ae('0x5c')]()[_0x93ae('0x26')](respondWithResult(_0x32d01d,null))['catch'](handleError(_0x32d01d,null));};exports[_0x93ae('0x5d')]=function(_0x45ff85,_0x134665,_0x120e65){var _0xb38655={'raw':!![],'where':{}},_0x12c019={},_0x339459;return db['OpenchannelQueue'][_0x93ae('0x5e')]({'where':{'id':_0x45ff85['params']['id']}})['then'](handleEntityNotFound(_0x134665,null))[_0x93ae('0x26')](function(_0xf3d920){if(_0xf3d920){_0x339459=_0xf3d920['get']({'plain':!![]});_0x12c019[_0x93ae('0x3a')]=_[_0x93ae('0x3c')](db[_0x93ae('0x5f')][_0x93ae('0x36')]);_0x12c019[_0x93ae('0x3b')]=_[_0x93ae('0x3c')](_0x45ff85[_0x93ae('0x3b')]);_0x12c019[_0x93ae('0x3d')]=_[_0x93ae('0x3e')](_0x12c019['model'],_0x12c019['query']);_0xb38655[_0x93ae('0x40')]=_[_0x93ae('0x3e')](_0x12c019[_0x93ae('0x3a')],qs[_0x93ae('0x3f')](_0x45ff85[_0x93ae('0x3b')][_0x93ae('0x3f')]));_0xb38655[_0x93ae('0x40')]=_0xb38655['attributes']['length']?_0xb38655[_0x93ae('0x40')]:_0x12c019[_0x93ae('0x3a')];if(!_0x45ff85[_0x93ae('0x3b')][_0x93ae('0x42')](_0x93ae('0x43'))){_0xb38655[_0x93ae('0x1d')]=qs[_0x93ae('0x1d')](_0x45ff85[_0x93ae('0x3b')][_0x93ae('0x1d')]);_0xb38655['offset']=qs[_0x93ae('0x1f')](_0x45ff85['query']['offset']);}_0xb38655[_0x93ae('0x44')]=qs[_0x93ae('0x45')](_0x45ff85[_0x93ae('0x3b')][_0x93ae('0x45')]);_0xb38655[_0x93ae('0x46')]=qs[_0x93ae('0x3d')](_[_0x93ae('0x47')](_0x45ff85[_0x93ae('0x3b')],_0x12c019[_0x93ae('0x3d')]));_0xb38655[_0x93ae('0x46')][_0x93ae('0x60')]=_0xf3d920['id'];if(_0x45ff85[_0x93ae('0x3b')]['filter']){_0xb38655['where']=_[_0x93ae('0x2e')](_0xb38655[_0x93ae('0x46')],{'$or':_[_0x93ae('0x35')](_0xb38655['attributes'],function(_0x57fcc8){var _0x21cff4={};_0x21cff4[_0x57fcc8]={'$like':'%'+_0x45ff85[_0x93ae('0x3b')]['filter']+'%'};return _0x21cff4;})});}_0xb38655=_[_0x93ae('0x2e')]({},_0xb38655,_0x45ff85[_0x93ae('0x61')]);return db[_0x93ae('0x5f')][_0x93ae('0x4c')](_0xb38655);}})[_0x93ae('0x26')](function(_0x50d60b){if(_0x50d60b){return db[_0x93ae('0x62')][_0x93ae('0x63')]({'where':{'id':_[_0x93ae('0x35')](_0x50d60b,'UserId'),'role':_0x93ae('0x64')},'attributes':['id',_0x93ae('0x2b'),'openchannelPause',_0x93ae('0x65'),_0x93ae('0x66')]});}})[_0x93ae('0x26')](function(_0x974aea){if(_0x974aea){return{'count':_0x974aea['count'],'rows':_[_0x93ae('0x35')](_0x974aea['rows'],function(_0x2d68f4){return{'membername':_0x2d68f4[_0x93ae('0x2b')],'UserId':_0x2d68f4['id'],'queue_name':_0x339459['name'],'OpenchannelQueueId':_0x339459['id'],'interface':util[_0x93ae('0x67')](_0x93ae('0x68'),'SIP',_0x2d68f4[_0x93ae('0x2b')]),'penalty':0x0,'paused':_0x2d68f4[_0x93ae('0x69')],'createdAt':_0x2d68f4[_0x93ae('0x66')],'updatedAt':_0x2d68f4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x93ae('0x26')](respondWithFilteredResult(_0x134665,_0xb38655))['catch'](handleError(_0x134665,null));};exports['getTeams']=function(_0x3ee3a1,_0x57b3b8,_0x401295){var _0x1ed4f5={};var _0x22e0e3={};var _0x18bed6;var _0x1e6008;return db[_0x93ae('0x4a')][_0x93ae('0x5e')]({'where':{'id':_0x3ee3a1[_0x93ae('0x4f')]['id']}})[_0x93ae('0x26')](handleEntityNotFound(_0x57b3b8,null))[_0x93ae('0x26')](function(_0x48c419){if(_0x48c419){_0x18bed6=_0x48c419;_0x22e0e3['model']=_[_0x93ae('0x3c')](db[_0x93ae('0x6a')][_0x93ae('0x36')]);_0x22e0e3[_0x93ae('0x3b')]=_[_0x93ae('0x3c')](_0x3ee3a1['query']);_0x22e0e3[_0x93ae('0x3d')]=_[_0x93ae('0x3e')](_0x22e0e3[_0x93ae('0x3a')],_0x22e0e3[_0x93ae('0x3b')]);_0x1ed4f5['attributes']=_['intersection'](_0x22e0e3['model'],qs[_0x93ae('0x3f')](_0x3ee3a1['query'][_0x93ae('0x3f')]));_0x1ed4f5[_0x93ae('0x40')]=_0x1ed4f5['attributes'][_0x93ae('0x41')]?_0x1ed4f5[_0x93ae('0x40')]:_0x22e0e3[_0x93ae('0x3a')];_0x1ed4f5[_0x93ae('0x44')]=qs[_0x93ae('0x45')](_0x3ee3a1[_0x93ae('0x3b')][_0x93ae('0x45')]);_0x1ed4f5[_0x93ae('0x46')]=qs[_0x93ae('0x3d')](_[_0x93ae('0x47')](_0x3ee3a1[_0x93ae('0x3b')],_0x22e0e3[_0x93ae('0x3d')]));if(_0x3ee3a1['query'][_0x93ae('0x48')]){_0x1ed4f5[_0x93ae('0x46')]=_[_0x93ae('0x2e')](_0x1ed4f5[_0x93ae('0x46')],{'$or':_[_0x93ae('0x35')](_0x1ed4f5['attributes'],function(_0x44b828){var _0x57f80b={};_0x57f80b[_0x44b828]={'$like':'%'+_0x3ee3a1[_0x93ae('0x3b')][_0x93ae('0x48')]+'%'};return _0x57f80b;})});}_0x1ed4f5=_[_0x93ae('0x2e')]({},_0x1ed4f5,_0x3ee3a1[_0x93ae('0x61')]);return _0x18bed6['getTeams'](_0x1ed4f5);}})[_0x93ae('0x26')](function(_0x48cdd0){if(_0x48cdd0){_0x1e6008=_0x48cdd0[_0x93ae('0x41')];if(!_0x3ee3a1[_0x93ae('0x3b')][_0x93ae('0x42')](_0x93ae('0x43'))){_0x1ed4f5[_0x93ae('0x1d')]=qs[_0x93ae('0x1d')](_0x3ee3a1['query'][_0x93ae('0x1d')]);_0x1ed4f5[_0x93ae('0x1f')]=qs[_0x93ae('0x1f')](_0x3ee3a1['query'][_0x93ae('0x1f')]);}return _0x18bed6[_0x93ae('0x6b')](_0x1ed4f5);}})[_0x93ae('0x26')](function(_0x4c14e0){if(_0x4c14e0){return _0x4c14e0?{'count':_0x1e6008,'rows':_0x4c14e0}:null;}})[_0x93ae('0x26')](respondWithResult(_0x57b3b8,null))['catch'](handleError(_0x57b3b8,null));};exports[_0x93ae('0x6c')]=function(_0x40c137,_0x5d565f,_0x238c08){var _0x126267=_0x40c137[_0x93ae('0x2f')][_0x93ae('0x6d')];return db['Team'][_0x93ae('0x4c')]({'where':{'id':_0x126267},'attributes':['id'],'include':[{'model':db[_0x93ae('0x62')],'as':_0x93ae('0x6e'),'attributes':['id','name',_0x93ae('0x6f'),_0x93ae('0x70'),_0x93ae('0x71')],'raw':!![]}]})[_0x93ae('0x26')](function(_0x1c4351){if(_0x1c4351){var _0x45a9df=_[_0x93ae('0x72')](_0x1c4351,function(_0x4d113f){var _0x20827f=_0x4d113f[_0x93ae('0x54')]({'plain':!![]});return _0x20827f['Agents'];});return db[_0x93ae('0x4a')][_0x93ae('0x58')]({'where':{'id':_0x40c137[_0x93ae('0x4f')]['id']}})['then'](function(_0x3ad95c){return db['sequelize'][_0x93ae('0x73')](function(_0x78000b){return _0x3ad95c[_0x93ae('0x6c')](_0x126267,{'transaction':_0x78000b})[_0x93ae('0x26')](function(){return BPromise[_0x93ae('0x74')](_0x45a9df,function(_0x4b7bf4){return db['UserOpenchannelQueue'][_0x93ae('0x75')]({'where':{'UserId':_0x4b7bf4['id'],'OpenchannelQueueId':_0x40c137[_0x93ae('0x4f')]['id']},'transaction':_0x78000b});});})[_0x93ae('0x26')](function(){_0x45a9df[_0x93ae('0x76')](function(_0x5ce983){socket[_0x93ae('0x77')](_0x93ae('0x78'),{'UserId':_0x5ce983['id'],'OpenchannelQueueId':_0x3ad95c['id']});});});});});}})[_0x93ae('0x26')](respondWithStatusCode(_0x5d565f,null))['catch'](handleError(_0x5d565f,null));};exports['removeTeams']=function(_0x5627cb,_0x59b637,_0xa7c701){return db[_0x93ae('0x6a')][_0x93ae('0x4c')]({'where':{'id':_0x5627cb['query'][_0x93ae('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x93ae('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x93ae('0x26')](handleEntityNotFound(_0x59b637,null))[_0x93ae('0x26')](function(_0x5cea5b){var _0x5e4d82=_['map'](_0x5cea5b,'id');var _0x4ae222=[];var _0x6e3646=[];var _0x487ff0=squel['select']();_0x487ff0[_0x93ae('0x79')]('tq.TeamId')[_0x93ae('0x7a')]('team_has_openchannel_queues','tq')[_0x93ae('0x7b')](_0x93ae('0x7c'),'ut',_0x93ae('0x7d'))[_0x93ae('0x46')]('OpenchannelQueueId\x20=\x20?',_0x5627cb[_0x93ae('0x4f')]['id']);for(var _0x14545c=0x0;_0x14545c<_0x5cea5b[_0x93ae('0x41')];_0x14545c+=0x1){let _0x5d46b6=_0x5cea5b[_0x14545c];for(var _0x50ec59=0x0;_0x50ec59<_0x5d46b6['Agents'][_0x93ae('0x41')];_0x50ec59+=0x1){let _0x5a3ced=_0x5d46b6[_0x93ae('0x6e')][_0x50ec59];var _0x3b02f5=_0x487ff0[_0x93ae('0x7e')]();_0x3b02f5[_0x93ae('0x46')](_0x93ae('0x7f'),_0x5a3ced['id']);_0x6e3646[_0x93ae('0x80')](db[_0x93ae('0x81')][_0x93ae('0x3b')](_0x3b02f5[_0x93ae('0x82')](),{'type':db[_0x93ae('0x81')][_0x93ae('0x83')][_0x93ae('0x84')]})[_0x93ae('0x26')](function(_0x89f902){if(_0x89f902['length']===0x1){return _0x5a3ced['id'];}else{var _0x1a51a7=_['every'](_['map'](_0x89f902,_0x93ae('0x85')),function(_0x40444a){return _[_0x93ae('0x86')](_0x5e4d82,_0x40444a);});if(_0x1a51a7){return _0x5a3ced['id'];}}}));}}return BPromise[_0x93ae('0x87')](_0x6e3646)[_0x93ae('0x26')](function(_0xe4ad65){_0x4ae222=_(_0x4ae222)[_0x93ae('0x88')](_0xe4ad65)[_0x93ae('0x89')]()[_0x93ae('0x8a')]();return db[_0x93ae('0x4a')]['find']({'where':{'id':_0x5627cb[_0x93ae('0x4f')]['id']}})[_0x93ae('0x26')](function(_0x32d9a2){return db[_0x93ae('0x81')][_0x93ae('0x73')](function(_0x3ffe18){return _0x32d9a2[_0x93ae('0x8b')](_0x5627cb[_0x93ae('0x3b')][_0x93ae('0x6d')],{'transaction':_0x3ffe18})['then'](function(){if(!_['isEmpty'](_0x4ae222)){return _0x32d9a2[_0x93ae('0x8c')](_0x4ae222,{'transaction':_0x3ffe18});}})['then'](function(){_0x4ae222['forEach'](function(_0x19f5f1){socket[_0x93ae('0x77')](_0x93ae('0x8d'),{'UserId':_0x19f5f1,'OpenchannelQueueId':_0x32d9a2['id']});});});});});});})[_0x93ae('0x26')](respondWithStatusCode(_0x59b637,null))[_0x93ae('0x51')](handleError(_0x59b637,null));};exports['addAgents']=function(_0x3e7fe0,_0x404fae,_0x4fb636){return db[_0x93ae('0x4a')][_0x93ae('0x58')]({'where':{'id':_0x3e7fe0[_0x93ae('0x4f')]['id']}})[_0x93ae('0x26')](handleEntityNotFound(_0x404fae,null))[_0x93ae('0x26')](function(_0x21745c){if(_0x21745c){return _0x21745c[_0x93ae('0x8e')](_0x3e7fe0['body']['ids'],_[_0x93ae('0x8f')](_0x3e7fe0[_0x93ae('0x2f')],[_0x93ae('0x6d'),'id'])||{})[_0x93ae('0x90')](function(_0x3a2e03){for(var _0x2cd07e=0x0;_0x2cd07e<_0x3e7fe0[_0x93ae('0x2f')][_0x93ae('0x6d')][_0x93ae('0x41')];_0x2cd07e+=0x1){socket[_0x93ae('0x77')](_0x93ae('0x78'),{'UserId':_0x3e7fe0[_0x93ae('0x2f')][_0x93ae('0x6d')][_0x2cd07e],'OpenchannelQueueId':_0x3e7fe0[_0x93ae('0x4f')]['id']});}return _0x3a2e03;});}})['then'](respondWithResult(_0x404fae,null))[_0x93ae('0x51')](handleError(_0x404fae,null));};exports[_0x93ae('0x8c')]=function(_0x216ef7,_0x9c4123,_0x462f51){return db[_0x93ae('0x4a')][_0x93ae('0x58')]({'where':{'id':_0x216ef7['params']['id']}})['then'](handleEntityNotFound(_0x9c4123,null))[_0x93ae('0x26')](function(_0x21e113){if(_0x21e113){return _0x21e113[_0x93ae('0x8c')](_0x216ef7[_0x93ae('0x3b')][_0x93ae('0x6d')])[_0x93ae('0x26')](function(){if(_['isArray'](_0x216ef7['query']['ids'])){for(var _0xdc0ccb=0x0;_0xdc0ccb<_0x216ef7[_0x93ae('0x3b')][_0x93ae('0x6d')][_0x93ae('0x41')];_0xdc0ccb+=0x1){socket['emit'](_0x93ae('0x8d'),{'UserId':Number(_0x216ef7['query']['ids'][_0xdc0ccb]),'OpenchannelQueueId':Number(_0x216ef7[_0x93ae('0x4f')]['id'])});}}else{socket[_0x93ae('0x77')](_0x93ae('0x8d'),{'UserId':Number(_0x216ef7['query']['ids']),'OpenchannelQueueId':Number(_0x216ef7[_0x93ae('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x9c4123,null))[_0x93ae('0x51')](handleError(_0x9c4123,null));};exports[_0x93ae('0x91')]=function(_0xebc7ea,_0x19cc71,_0x39da90){var _0x391f26={};var _0x535ef9={};var _0x1c859d;var _0x321126;return db[_0x93ae('0x4a')][_0x93ae('0x5e')]({'where':{'id':_0xebc7ea[_0x93ae('0x4f')]['id']}})[_0x93ae('0x26')](handleEntityNotFound(_0x19cc71,null))[_0x93ae('0x26')](function(_0x1b2978){if(_0x1b2978){_0x1c859d=_0x1b2978;_0x535ef9['model']=_['keys'](db[_0x93ae('0x62')][_0x93ae('0x36')]);_0x535ef9[_0x93ae('0x3b')]=_[_0x93ae('0x3c')](_0xebc7ea['query']);_0x535ef9[_0x93ae('0x3d')]=_[_0x93ae('0x3e')](_0x535ef9['model'],_0x535ef9[_0x93ae('0x3b')]);_0x391f26[_0x93ae('0x40')]=_[_0x93ae('0x3e')](_0x535ef9[_0x93ae('0x3a')],qs[_0x93ae('0x3f')](_0xebc7ea[_0x93ae('0x3b')][_0x93ae('0x3f')]));_0x391f26[_0x93ae('0x40')]=_0x391f26[_0x93ae('0x40')][_0x93ae('0x41')]?_0x391f26[_0x93ae('0x40')]:_0x535ef9[_0x93ae('0x3a')];_0x391f26[_0x93ae('0x44')]=qs[_0x93ae('0x45')](_0xebc7ea[_0x93ae('0x3b')]['sort']);_0x391f26[_0x93ae('0x46')]=qs['filters'](_['pick'](_0xebc7ea[_0x93ae('0x3b')],_0x535ef9[_0x93ae('0x3d')]));if(_0xebc7ea[_0x93ae('0x3b')][_0x93ae('0x48')]){_0x391f26['where']=_[_0x93ae('0x2e')](_0x391f26[_0x93ae('0x46')],{'$or':_[_0x93ae('0x35')](_0x391f26[_0x93ae('0x40')],function(_0x211809){var _0x463bea={};_0x463bea[_0x211809]={'$like':'%'+_0xebc7ea[_0x93ae('0x3b')][_0x93ae('0x48')]+'%'};return _0x463bea;})});}_0x391f26=_[_0x93ae('0x2e')]({},_0x391f26,_0xebc7ea[_0x93ae('0x61')]);return _0x1c859d[_0x93ae('0x91')](_0x391f26);}})[_0x93ae('0x26')](function(_0x4a58b9){if(_0x4a58b9){_0x321126=_0x4a58b9[_0x93ae('0x41')];if(!_0xebc7ea[_0x93ae('0x3b')][_0x93ae('0x42')](_0x93ae('0x43'))){_0x391f26[_0x93ae('0x1d')]=qs['limit'](_0xebc7ea[_0x93ae('0x3b')]['limit']);_0x391f26[_0x93ae('0x1f')]=qs[_0x93ae('0x1f')](_0xebc7ea[_0x93ae('0x3b')][_0x93ae('0x1f')]);}return _0x1c859d[_0x93ae('0x91')](_0x391f26);}})[_0x93ae('0x26')](function(_0xd00c8b){if(_0xd00c8b){return _0xd00c8b?{'count':_0x321126,'rows':_0xd00c8b}:null;}})[_0x93ae('0x26')](respondWithResult(_0x19cc71,null))['catch'](handleError(_0x19cc71,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a0fb1c5..f0598ba 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 _0xd59f=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','save'];(function(_0x27d038,_0x436cd1){var _0x49734c=function(_0x4f2d68){while(--_0x4f2d68){_0x27d038['push'](_0x27d038['shift']());}};_0x49734c(++_0x436cd1);}(_0xd59f,0x191));var _0xfd59=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0xd59f[_0x401676];return _0x4f13fe;};'use strict';var EventEmitter=require(_0xfd59('0x0'));var OpenchannelQueue=require(_0xfd59('0x1'))['db'][_0xfd59('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd59('0x3'),'afterUpdate':_0xfd59('0x4'),'afterDestroy':_0xfd59('0x5')};function emitEvent(_0x347b22){return function(_0x49f2cf,_0x26d9e5,_0x1deca0){OpenchannelQueueEvents[_0xfd59('0x6')](_0x347b22+':'+_0x49f2cf['id'],_0x49f2cf);OpenchannelQueueEvents[_0xfd59('0x6')](_0x347b22,_0x49f2cf);_0x1deca0(null);};}for(var e in events){if(events[_0xfd59('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xfd59('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x9222=['setMaxListeners','save','emit','hook','exports','../../mysqldb','OpenchannelQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9222,0x194));var _0x2922=function(_0x2400f6,_0x1f1cf6){_0x2400f6=_0x2400f6-0x0;var _0x39e3f5=_0x9222[_0x2400f6];return _0x39e3f5;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x2922('0x0'))['db'][_0x2922('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2922('0x2')](0x0);var events={'afterCreate':_0x2922('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4b0325){return function(_0x4ac6be,_0x36d2b0,_0x4d3230){OpenchannelQueueEvents[_0x2922('0x4')](_0x4b0325+':'+_0x4ac6be['id'],_0x4ac6be);OpenchannelQueueEvents['emit'](_0x4b0325,_0x4ac6be);_0x4d3230(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x2922('0x5')](e,emitEvent(event));}}module[_0x2922('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 75d802e..8eb1471 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 _0x52f1=['define','OpenchannelQueue','openchannel_queues','../../config/logger','api','moment','bluebird','rimraf','./openchannelQueue.attributes','exports'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x52f1,0xb7));var _0x152f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x52f1[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x152f('0x0'))(_0x152f('0x1'));var moment=require(_0x152f('0x2'));var BPromise=require(_0x152f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x152f('0x4'));var config=require('../../config/environment');var attributes=require(_0x152f('0x5'));module[_0x152f('0x6')]=function(_0x53a2af,_0x3690aa){return _0x53a2af[_0x152f('0x7')](_0x152f('0x8'),attributes,{'tableName':_0x152f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb7a=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x592a9b,_0x5ebce6){var _0x2ef76f=function(_0x48155f){while(--_0x48155f){_0x592a9b['push'](_0x592a9b['shift']());}};_0x2ef76f(++_0x5ebce6);}(_0xbb7a,0xc2));var _0xabb7=function(_0x281c3d,_0x39e39e){_0x281c3d=_0x281c3d-0x0;var _0x1e008d=_0xbb7a[_0x281c3d];return _0x1e008d;};'use strict';var _=require(_0xabb7('0x0'));var util=require(_0xabb7('0x1'));var logger=require(_0xabb7('0x2'))('api');var moment=require(_0xabb7('0x3'));var BPromise=require(_0xabb7('0x4'));var rp=require(_0xabb7('0x5'));var fs=require('fs');var path=require(_0xabb7('0x6'));var rimraf=require('rimraf');var config=require(_0xabb7('0x7'));var attributes=require(_0xabb7('0x8'));module[_0xabb7('0x9')]=function(_0x1f2e27,_0x1d9fef){return _0x1f2e27[_0xabb7('0xa')](_0xabb7('0xb'),attributes,{'tableName':_0xabb7('0xc'),'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 8a19b21..fe2440e 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 _0x6fcf=['then','ShowOpenchannelQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','include','map','model'];(function(_0x216c52,_0x264f2f){var _0x485bea=function(_0x22899c){while(--_0x22899c){_0x216c52['push'](_0x216c52['shift']());}};_0x485bea(++_0x264f2f);}(_0x6fcf,0x1d7));var _0xf6fc=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0x6fcf[_0x3eb4a9];return _0x48dbad;};'use strict';var _=require(_0xf6fc('0x0'));var util=require('util');var moment=require(_0xf6fc('0x1'));var BPromise=require(_0xf6fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6fc('0x3'));var db=require(_0xf6fc('0x4'))['db'];var utils=require(_0xf6fc('0x5'));var logger=require(_0xf6fc('0x6'))(_0xf6fc('0x7'));var config=require('../../config/environment');var jayson=require(_0xf6fc('0x8'));var client=jayson[_0xf6fc('0x9')]['http']({'port':0x232a});config[_0xf6fc('0xa')]=_['defaults'](config[_0xf6fc('0xa')],{'host':_0xf6fc('0xb'),'port':0x18eb});var socket=require(_0xf6fc('0xc'))(new Redis(config[_0xf6fc('0xa')]));require(_0xf6fc('0xd'))[_0xf6fc('0xe')](socket);function respondWithRpcPromise(_0x5694e1,_0x13c90c,_0xa9ef26){return new BPromise(function(_0x371873,_0x194b31){return client[_0xf6fc('0xf')](_0x5694e1,_0xa9ef26)['then'](function(_0x292bcd){logger[_0xf6fc('0x10')](_0xf6fc('0x11'),_0x13c90c,'request\x20sent');logger[_0xf6fc('0x12')](_0xf6fc('0x13'),_0x13c90c,_0xf6fc('0x14'),JSON[_0xf6fc('0x15')](_0x292bcd));if(_0x292bcd[_0xf6fc('0x16')]){if(_0x292bcd[_0xf6fc('0x16')][_0xf6fc('0x17')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x13c90c,_0x292bcd['error'][_0xf6fc('0x18')]);return _0x194b31(_0x292bcd['error'][_0xf6fc('0x18')]);}logger['error'](_0xf6fc('0x11'),_0x13c90c,_0x292bcd[_0xf6fc('0x16')]['message']);return _0x371873(_0x292bcd[_0xf6fc('0x16')]['message']);}else{logger[_0xf6fc('0x10')](_0xf6fc('0x11'),_0x13c90c,_0xf6fc('0x14'));_0x371873(_0x292bcd[_0xf6fc('0x19')]['message']);}})[_0xf6fc('0x1a')](function(_0x37fc1d){logger['error'](_0xf6fc('0x11'),_0x13c90c,_0x37fc1d);_0x194b31(_0x37fc1d);});});}exports[_0xf6fc('0x1b')]=function(_0x3fcc5b){var _0x4ca866=this;return new Promise(function(_0xdd470f,_0x4fa6ea){return db[_0xf6fc('0x1c')]['findAll']({'raw':_0x3fcc5b[_0xf6fc('0x1d')]?_0x3fcc5b['options']['raw']===undefined?!![]:![]:!![],'where':_0x3fcc5b[_0xf6fc('0x1d')]?_0x3fcc5b[_0xf6fc('0x1d')][_0xf6fc('0x1e')]||null:null,'attributes':_0x3fcc5b[_0xf6fc('0x1d')]?_0x3fcc5b['options'][_0xf6fc('0x1f')]||null:null,'limit':_0x3fcc5b[_0xf6fc('0x1d')]?_0x3fcc5b['options'][_0xf6fc('0x20')]||null:null,'include':_0x3fcc5b[_0xf6fc('0x1d')]?_0x3fcc5b[_0xf6fc('0x1d')][_0xf6fc('0x21')]?_[_0xf6fc('0x22')](_0x3fcc5b[_0xf6fc('0x1d')][_0xf6fc('0x21')],function(_0x5c7522){return{'model':db[_0x5c7522[_0xf6fc('0x23')]],'as':_0x5c7522['as'],'attributes':_0x5c7522[_0xf6fc('0x1f')],'include':_0x5c7522[_0xf6fc('0x21')]?_[_0xf6fc('0x22')](_0x5c7522[_0xf6fc('0x21')],function(_0x5b3bc8){return{'model':db[_0x5b3bc8['model']],'as':_0x5b3bc8['as'],'attributes':_0x5b3bc8['attributes'],'include':_0x5b3bc8[_0xf6fc('0x21')]?_[_0xf6fc('0x22')](_0x5b3bc8['include'],function(_0x23ee4b){return{'model':db[_0x23ee4b['model']],'as':_0x23ee4b['as'],'attributes':_0x23ee4b[_0xf6fc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf6fc('0x24')](function(_0x8d84cc){logger[_0xf6fc('0x10')](_0xf6fc('0x1b'),_0x3fcc5b);logger[_0xf6fc('0x12')]('GetOpenchannelQueue',_0x3fcc5b,JSON[_0xf6fc('0x15')](_0x8d84cc));_0xdd470f(_0x8d84cc);})[_0xf6fc('0x1a')](function(_0xa655f2){logger[_0xf6fc('0x16')](_0xf6fc('0x1b'),_0xa655f2[_0xf6fc('0x18')],_0x3fcc5b);_0x4fa6ea(_0x4ca866[_0xf6fc('0x16')](0x1f4,_0xa655f2[_0xf6fc('0x18')]));});});};exports[_0xf6fc('0x25')]=function(_0x45f5a9){var _0x56b2b5=this;return new Promise(function(_0x1f17fa,_0x29cc78){return db[_0xf6fc('0x1c')][_0xf6fc('0x26')]({'raw':_0x45f5a9[_0xf6fc('0x1d')]?_0x45f5a9[_0xf6fc('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x45f5a9['options']?_0x45f5a9[_0xf6fc('0x1d')][_0xf6fc('0x1e')]||null:null,'attributes':_0x45f5a9['options']?_0x45f5a9['options'][_0xf6fc('0x1f')]||null:null,'include':_0x45f5a9['options']?_0x45f5a9['options'][_0xf6fc('0x21')]?_[_0xf6fc('0x22')](_0x45f5a9['options'][_0xf6fc('0x21')],function(_0x1bf5a6){return{'model':db[_0x1bf5a6[_0xf6fc('0x23')]],'as':_0x1bf5a6['as'],'attributes':_0x1bf5a6[_0xf6fc('0x1f')],'include':_0x1bf5a6[_0xf6fc('0x21')]?_[_0xf6fc('0x22')](_0x1bf5a6['include'],function(_0x100b77){return{'model':db[_0x100b77[_0xf6fc('0x23')]],'as':_0x100b77['as'],'attributes':_0x100b77['attributes'],'include':_0x100b77[_0xf6fc('0x21')]?_[_0xf6fc('0x22')](_0x100b77[_0xf6fc('0x21')],function(_0xfc4145){return{'model':db[_0xfc4145[_0xf6fc('0x23')]],'as':_0xfc4145['as'],'attributes':_0xfc4145[_0xf6fc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf6fc('0x24')](function(_0x5ac41f){logger[_0xf6fc('0x10')](_0xf6fc('0x25'),_0x45f5a9);logger['debug'](_0xf6fc('0x25'),_0x45f5a9,JSON['stringify'](_0x5ac41f));_0x1f17fa(_0x5ac41f);})[_0xf6fc('0x1a')](function(_0x2ca09c){logger[_0xf6fc('0x16')](_0xf6fc('0x25'),_0x2ca09c[_0xf6fc('0x18')],_0x45f5a9);_0x29cc78(_0x56b2b5[_0xf6fc('0x16')](0x1f4,_0x2ca09c['message']));});});}; \ No newline at end of file +var _0x222c=['limit','include','map','model','attributes','then','catch','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','GetOpenchannelQueue','OpenchannelQueue','options','raw','where'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x222c,0xcc));var _0xc222=function(_0xa92094,_0x43807f){_0xa92094=_0xa92094-0x0;var _0x18dea9=_0x222c[_0xa92094];return _0x18dea9;};'use strict';var _=require(_0xc222('0x0'));var util=require('util');var moment=require(_0xc222('0x1'));var BPromise=require(_0xc222('0x2'));var rs=require(_0xc222('0x3'));var fs=require('fs');var Redis=require(_0xc222('0x4'));var db=require(_0xc222('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc222('0x6'));var jayson=require(_0xc222('0x7'));var client=jayson[_0xc222('0x8')]['http']({'port':0x232a});config[_0xc222('0x9')]=_['defaults'](config[_0xc222('0x9')],{'host':_0xc222('0xa'),'port':0x18eb});var socket=require(_0xc222('0xb'))(new Redis(config[_0xc222('0x9')]));require(_0xc222('0xc'))[_0xc222('0xd')](socket);function respondWithRpcPromise(_0x49d778,_0x35408b,_0x3c901d){return new BPromise(function(_0x4b6a98,_0x175aee){return client[_0xc222('0xe')](_0x49d778,_0x3c901d)['then'](function(_0x235122){logger[_0xc222('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x35408b,'request\x20sent');logger[_0xc222('0x10')](_0xc222('0x11'),_0x35408b,_0xc222('0x12'),JSON[_0xc222('0x13')](_0x235122));if(_0x235122[_0xc222('0x14')]){if(_0x235122['error'][_0xc222('0x15')]===0x1f4){logger[_0xc222('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x35408b,_0x235122[_0xc222('0x14')]['message']);return _0x175aee(_0x235122['error'][_0xc222('0x16')]);}logger[_0xc222('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x35408b,_0x235122[_0xc222('0x14')][_0xc222('0x16')]);return _0x4b6a98(_0x235122[_0xc222('0x14')][_0xc222('0x16')]);}else{logger[_0xc222('0xf')](_0xc222('0x17'),_0x35408b,_0xc222('0x12'));_0x4b6a98(_0x235122[_0xc222('0x18')][_0xc222('0x16')]);}})['catch'](function(_0x5d4b57){logger[_0xc222('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x35408b,_0x5d4b57);_0x175aee(_0x5d4b57);});});}exports[_0xc222('0x19')]=function(_0x103565){var _0x540d6a=this;return new Promise(function(_0xbabbc6,_0x1a1491){return db[_0xc222('0x1a')]['findAll']({'raw':_0x103565[_0xc222('0x1b')]?_0x103565[_0xc222('0x1b')][_0xc222('0x1c')]===undefined?!![]:![]:!![],'where':_0x103565[_0xc222('0x1b')]?_0x103565[_0xc222('0x1b')][_0xc222('0x1d')]||null:null,'attributes':_0x103565[_0xc222('0x1b')]?_0x103565[_0xc222('0x1b')]['attributes']||null:null,'limit':_0x103565[_0xc222('0x1b')]?_0x103565['options'][_0xc222('0x1e')]||null:null,'include':_0x103565[_0xc222('0x1b')]?_0x103565[_0xc222('0x1b')][_0xc222('0x1f')]?_[_0xc222('0x20')](_0x103565[_0xc222('0x1b')][_0xc222('0x1f')],function(_0x5a3197){return{'model':db[_0x5a3197[_0xc222('0x21')]],'as':_0x5a3197['as'],'attributes':_0x5a3197[_0xc222('0x22')],'include':_0x5a3197[_0xc222('0x1f')]?_[_0xc222('0x20')](_0x5a3197[_0xc222('0x1f')],function(_0x49dd56){return{'model':db[_0x49dd56[_0xc222('0x21')]],'as':_0x49dd56['as'],'attributes':_0x49dd56[_0xc222('0x22')],'include':_0x49dd56[_0xc222('0x1f')]?_[_0xc222('0x20')](_0x49dd56[_0xc222('0x1f')],function(_0x2b59da){return{'model':db[_0x2b59da[_0xc222('0x21')]],'as':_0x2b59da['as'],'attributes':_0x2b59da['attributes']};}):[]};}):[]};}):[]:[]})[_0xc222('0x23')](function(_0x857458){logger[_0xc222('0xf')](_0xc222('0x19'),_0x103565);logger['debug'](_0xc222('0x19'),_0x103565,JSON[_0xc222('0x13')](_0x857458));_0xbabbc6(_0x857458);})[_0xc222('0x24')](function(_0x3399d6){logger[_0xc222('0x14')](_0xc222('0x19'),_0x3399d6[_0xc222('0x16')],_0x103565);_0x1a1491(_0x540d6a['error'](0x1f4,_0x3399d6['message']));});});};exports[_0xc222('0x25')]=function(_0xba1e4d){var _0x4fccf1=this;return new Promise(function(_0x703206,_0x245394){return db[_0xc222('0x1a')][_0xc222('0x26')]({'raw':_0xba1e4d['options']?_0xba1e4d['options'][_0xc222('0x1c')]===undefined?!![]:![]:!![],'where':_0xba1e4d[_0xc222('0x1b')]?_0xba1e4d[_0xc222('0x1b')][_0xc222('0x1d')]||null:null,'attributes':_0xba1e4d[_0xc222('0x1b')]?_0xba1e4d['options'][_0xc222('0x22')]||null:null,'include':_0xba1e4d[_0xc222('0x1b')]?_0xba1e4d[_0xc222('0x1b')]['include']?_[_0xc222('0x20')](_0xba1e4d[_0xc222('0x1b')]['include'],function(_0x2a99b3){return{'model':db[_0x2a99b3['model']],'as':_0x2a99b3['as'],'attributes':_0x2a99b3[_0xc222('0x22')],'include':_0x2a99b3['include']?_[_0xc222('0x20')](_0x2a99b3[_0xc222('0x1f')],function(_0x869844){return{'model':db[_0x869844['model']],'as':_0x869844['as'],'attributes':_0x869844[_0xc222('0x22')],'include':_0x869844[_0xc222('0x1f')]?_[_0xc222('0x20')](_0x869844[_0xc222('0x1f')],function(_0x704461){return{'model':db[_0x704461[_0xc222('0x21')]],'as':_0x704461['as'],'attributes':_0x704461[_0xc222('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc222('0x23')](function(_0x2ae68b){logger[_0xc222('0xf')]('ShowOpenchannelQueue',_0xba1e4d);logger[_0xc222('0x10')]('ShowOpenchannelQueue',_0xba1e4d,JSON[_0xc222('0x13')](_0x2ae68b));_0x703206(_0x2ae68b);})[_0xc222('0x24')](function(_0x47f427){logger[_0xc222('0x14')](_0xc222('0x25'),_0x47f427[_0xc222('0x16')],_0xba1e4d);_0x245394(_0x4fccf1['error'](0x1f4,_0x47f427[_0xc222('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 4c97337..8141b0c 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 _0x02e8=['emit','removeListener','register','length','save','update'];(function(_0x2dd8df,_0x4a89ad){var _0x568d9f=function(_0x105f5f){while(--_0x105f5f){_0x2dd8df['push'](_0x2dd8df['shift']());}};_0x568d9f(++_0x4a89ad);}(_0x02e8,0x190));var _0x802e=function(_0x2c5619,_0x298f71){_0x2c5619=_0x2c5619-0x0;var _0x2b1513=_0x02e8[_0x2c5619];return _0x2b1513;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x802e('0x0'),'remove',_0x802e('0x1')];function createListener(_0xacac0a,_0x23eb04){return function(_0x2ac654){_0x23eb04[_0x802e('0x2')](_0xacac0a,_0x2ac654);};}function removeListener(_0x4d773a,_0x19041a){return function(){OpenchannelQueueEvents[_0x802e('0x3')](_0x4d773a,_0x19041a);};}exports[_0x802e('0x4')]=function(_0x11fb6b){for(var _0x27dd9b=0x0,_0x95b33=events[_0x802e('0x5')];_0x27dd9b<_0x95b33;_0x27dd9b++){var _0xbf3f57=events[_0x27dd9b];var _0x3ef660=createListener('openchannelQueue:'+_0xbf3f57,_0x11fb6b);OpenchannelQueueEvents['on'](_0xbf3f57,_0x3ef660);}}; \ No newline at end of file +var _0x9e92=['save','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x1c7181,_0x57e4b7){var _0x49d073=function(_0x10821a){while(--_0x10821a){_0x1c7181['push'](_0x1c7181['shift']());}};_0x49d073(++_0x57e4b7);}(_0x9e92,0x1e3));var _0x29e9=function(_0x20fdca,_0x1488e3){_0x20fdca=_0x20fdca-0x0;var _0x34720e=_0x9e92[_0x20fdca];return _0x34720e;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x29e9('0x0'),'remove',_0x29e9('0x1')];function createListener(_0x166259,_0x17c3db){return function(_0x4fc9a4){_0x17c3db[_0x29e9('0x2')](_0x166259,_0x4fc9a4);};}function removeListener(_0x205e56,_0xdfe8c5){return function(){OpenchannelQueueEvents[_0x29e9('0x3')](_0x205e56,_0xdfe8c5);};}exports[_0x29e9('0x4')]=function(_0x273cc1){for(var _0x4cc3a7=0x0,_0x4c21c2=events[_0x29e9('0x5')];_0x4cc3a7<_0x4c21c2;_0x4cc3a7++){var _0x1a0832=events[_0x4cc3a7];var _0x240ed1=createListener(_0x29e9('0x6')+_0x1a0832,_0x273cc1);OpenchannelQueueEvents['on'](_0x1a0832,_0x240ed1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index affda8c..129a962 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 _0x7e78=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x555919,_0x183784){var _0x5a6da7=function(_0x110ba6){while(--_0x110ba6){_0x555919['push'](_0x555919['shift']());}};_0x5a6da7(++_0x183784);}(_0x7e78,0x98));var _0x87e7=function(_0xbfa422,_0x2fa627){_0xbfa422=_0xbfa422-0x0;var _0x446e17=_0x7e78[_0xbfa422];return _0x446e17;};'use strict';var multer=require(_0x87e7('0x0'));var util=require(_0x87e7('0x1'));var path=require(_0x87e7('0x2'));var timeout=require('connect-timeout');var express=require(_0x87e7('0x3'));var router=express['Router']();var fs_extra=require(_0x87e7('0x4'));var auth=require(_0x87e7('0x5'));var interaction=require(_0x87e7('0x6'));var config=require(_0x87e7('0x7'));var controller=require(_0x87e7('0x8'));router[_0x87e7('0x9')]('/',auth[_0x87e7('0xa')](),controller[_0x87e7('0xb')]);router[_0x87e7('0x9')](_0x87e7('0xc'),auth[_0x87e7('0xa')](),controller[_0x87e7('0xd')]);router[_0x87e7('0x9')]('/:id',auth[_0x87e7('0xa')](),controller['show']);router[_0x87e7('0xe')]('/',auth[_0x87e7('0xa')](),controller[_0x87e7('0xf')]);router[_0x87e7('0x10')](_0x87e7('0x11'),auth['isAuthenticated'](),controller[_0x87e7('0x12')]);router[_0x87e7('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x87e7('0x14')]);module[_0x87e7('0x15')]=router; \ No newline at end of file +var _0x0170=['connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','delete','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0170,0x80));var _0x0017=function(_0x164908,_0x221733){_0x164908=_0x164908-0x0;var _0x3f44b2=_0x0170[_0x164908];return _0x3f44b2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0017('0x0'));var express=require(_0x0017('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0017('0x2'));var config=require(_0x0017('0x3'));var controller=require(_0x0017('0x4'));router['get']('/',auth[_0x0017('0x5')](),controller[_0x0017('0x6')]);router[_0x0017('0x7')](_0x0017('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x0017('0x7')](_0x0017('0x9'),auth[_0x0017('0x5')](),controller[_0x0017('0xa')]);router['post']('/',auth[_0x0017('0x5')](),controller[_0x0017('0xb')]);router[_0x0017('0xc')](_0x0017('0x9'),auth[_0x0017('0x5')](),controller[_0x0017('0xd')]);router[_0x0017('0xe')]('/:id',auth[_0x0017('0x5')](),controller['destroy']);module[_0x0017('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 5ea2cbf..87e3038 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 _0x1f93=['sequelize','exports','STRING','DATE','moment'];(function(_0x1d50e2,_0x2d7860){var _0x5c436b=function(_0x327240){while(--_0x327240){_0x1d50e2['push'](_0x1d50e2['shift']());}};_0x5c436b(++_0x2d7860);}(_0x1f93,0x1da));var _0x31f9=function(_0x26a46d,_0xbfb125){_0x26a46d=_0x26a46d-0x0;var _0x303a0e=_0x1f93[_0x26a46d];return _0x303a0e;};'use strict';var moment=require(_0x31f9('0x0'));var Sequelize=require(_0x31f9('0x1'));module[_0x31f9('0x2')]={'uniqueid':{'type':Sequelize[_0x31f9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x31f9('0x3')]},'joinAt':{'type':Sequelize[_0x31f9('0x4')]},'leaveAt':{'type':Sequelize[_0x31f9('0x4')]},'acceptAt':{'type':Sequelize[_0x31f9('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x31f9('0x3')]}}; \ No newline at end of file +var _0xfb6f=['exports','STRING','DATE','moment','sequelize'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0xfb6f,0xf3));var _0xffb6=function(_0x5ad16d,_0x34e76c){_0x5ad16d=_0x5ad16d-0x0;var _0x5d4db5=_0xfb6f[_0x5ad16d];return _0x5d4db5;};'use strict';var moment=require(_0xffb6('0x0'));var Sequelize=require(_0xffb6('0x1'));module[_0xffb6('0x2')]={'uniqueid':{'type':Sequelize[_0xffb6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xffb6('0x3')]},'joinAt':{'type':Sequelize[_0xffb6('0x4')]},'leaveAt':{'type':Sequelize[_0xffb6('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xffb6('0x4')]},'reason':{'type':Sequelize[_0xffb6('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 8f552f0..55c48e3 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 _0x306d=['agent','interaction','account','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','reject','update','then','destroy','end','error','stack','name','send','render','merge','contact','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x306d,0x176));var _0xd306=function(_0x4caf4e,_0x1e50ef){_0x4caf4e=_0x4caf4e-0x0;var _0x491888=_0x306d[_0x4caf4e];return _0x491888;};'use strict';var emlformat=require(_0xd306('0x0'));var rimraf=require(_0xd306('0x1'));var zipdir=require(_0xd306('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd306('0x3'));var moment=require('moment');var BPromise=require(_0xd306('0x4'));var Mustache=require('mustache');var util=require(_0xd306('0x5'));var path=require(_0xd306('0x6'));var sox=require(_0xd306('0x7'));var csv=require('to-csv');var ejs=require(_0xd306('0x8'));var fs=require('fs');var fs_extra=require(_0xd306('0x9'));var _=require('lodash');var squel=require(_0xd306('0xa'));var crypto=require(_0xd306('0xb'));var jsforce=require(_0xd306('0xc'));var deskjs=require(_0xd306('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd306('0xe'));var Papa=require(_0xd306('0xf'));var Redis=require(_0xd306('0x10'));var authService=require(_0xd306('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd306('0x12'));var hardwareService=require(_0xd306('0x13'));var logger=require(_0xd306('0x14'))(_0xd306('0x15'));var utils=require(_0xd306('0x16'));var config=require(_0xd306('0x17'));var licenseUtil=require(_0xd306('0x18'));var db=require(_0xd306('0x19'))['db'];function respondWithStatusCode(_0x255f96,_0x596a04){_0x596a04=_0x596a04||0xcc;return function(_0x3a28a5){if(_0x3a28a5){return _0x255f96[_0xd306('0x1a')](_0x596a04);}return _0x255f96[_0xd306('0x1b')](_0x596a04)['end']();};}function respondWithResult(_0x45d47e,_0x4a477b){_0x4a477b=_0x4a477b||0xc8;return function(_0x4a6325){if(_0x4a6325){return _0x45d47e['status'](_0x4a477b)[_0xd306('0x1c')](_0x4a6325);}};}function respondWithFilteredResult(_0x9e79c7,_0x5a6aed){return function(_0x3ef402){if(_0x3ef402){var _0x256501=typeof _0x5a6aed[_0xd306('0x1d')]===_0xd306('0x1e')&&typeof _0x5a6aed['limit']==='undefined';var _0x1e4721=_0x3ef402[_0xd306('0x1f')];var _0xa1c86f=_0x256501?0x0:_0x5a6aed['offset'];var _0x5add89=_0x256501?_0x3ef402[_0xd306('0x1f')]:_0x5a6aed[_0xd306('0x1d')]+_0x5a6aed[_0xd306('0x20')];var _0x390d79;if(_0x5add89>=_0x1e4721){_0x5add89=_0x1e4721;_0x390d79=0xc8;}else{_0x390d79=0xce;}_0x9e79c7[_0xd306('0x1b')](_0x390d79);return _0x9e79c7['set']('Content-Range',_0xa1c86f+'-'+_0x5add89+'/'+_0x1e4721)[_0xd306('0x1c')](_0x3ef402);}return null;};}function patchUpdates(_0x3d44a1){return function(_0x5c3d2c){try{jsonpatch['apply'](_0x5c3d2c,_0x3d44a1,!![]);}catch(_0x4a9ef1){return BPromise[_0xd306('0x21')](_0x4a9ef1);}return _0x5c3d2c['save']();};}function saveUpdates(_0x37b75e,_0x5c5811){return function(_0x5e3e8e){if(_0x5e3e8e){return _0x5e3e8e[_0xd306('0x22')](_0x37b75e)[_0xd306('0x23')](function(_0x4ed723){return _0x4ed723;});}return null;};}function removeEntity(_0x22a8af,_0x2a4b38){return function(_0x496663){if(_0x496663){return _0x496663[_0xd306('0x24')]()[_0xd306('0x23')](function(){_0x22a8af[_0xd306('0x1b')](0xcc)[_0xd306('0x25')]();});}};}function handleEntityNotFound(_0x3bb11d,_0x109455){return function(_0x11c74e){if(!_0x11c74e){_0x3bb11d[_0xd306('0x1a')](0x194);}return _0x11c74e;};}function handleError(_0x1356cb,_0x421738){_0x421738=_0x421738||0x1f4;return function(_0x3bf454){logger[_0xd306('0x26')](_0x3bf454[_0xd306('0x27')]);if(_0x3bf454[_0xd306('0x28')]){delete _0x3bf454[_0xd306('0x28')];}_0x1356cb[_0xd306('0x1b')](_0x421738)[_0xd306('0x29')](_0x3bf454);};}function getMustacheRender(_0x27b59b,_0x50c96b){return Mustache[_0xd306('0x2a')](_0x27b59b,_[_0xd306('0x2b')](_0x50c96b['body'],{'contact':_0x50c96b[_0xd306('0x2c')],'message':_0x50c96b[_0xd306('0x2d')],'agent':_0x50c96b[_0xd306('0x2e')],'interaction':_0x50c96b[_0xd306('0x2f')],'account':_0x50c96b[_0xd306('0x30')]}))||'';}exports[_0xd306('0x31')]=function(_0x1deffc,_0x179d06){var _0xfc95a2={},_0x49bcc4={},_0x3955c4={'count':0x0,'rows':[]};var _0x5dce7e=_['map'](db[_0xd306('0x32')][_0xd306('0x33')],function(_0x6996f5){return{'name':_0x6996f5[_0xd306('0x34')],'type':_0x6996f5[_0xd306('0x35')][_0xd306('0x36')]};});_0x49bcc4[_0xd306('0x37')]=_[_0xd306('0x38')](_0x5dce7e,_0xd306('0x28'));_0x49bcc4[_0xd306('0x39')]=_[_0xd306('0x3a')](_0x1deffc[_0xd306('0x39')]);_0x49bcc4[_0xd306('0x3b')]=_[_0xd306('0x3c')](_0x49bcc4[_0xd306('0x37')],_0x49bcc4[_0xd306('0x39')]);_0xfc95a2[_0xd306('0x3d')]=_[_0xd306('0x3c')](_0x49bcc4[_0xd306('0x37')],qs[_0xd306('0x3e')](_0x1deffc[_0xd306('0x39')]['fields']));_0xfc95a2[_0xd306('0x3d')]=_0xfc95a2[_0xd306('0x3d')][_0xd306('0x3f')]?_0xfc95a2['attributes']:_0x49bcc4['model'];if(!_0x1deffc['query'][_0xd306('0x40')](_0xd306('0x41'))){_0xfc95a2['limit']=qs['limit'](_0x1deffc[_0xd306('0x39')][_0xd306('0x20')]);_0xfc95a2[_0xd306('0x1d')]=qs[_0xd306('0x1d')](_0x1deffc['query']['offset']);}_0xfc95a2[_0xd306('0x42')]=qs[_0xd306('0x43')](_0x1deffc[_0xd306('0x39')][_0xd306('0x43')]);_0xfc95a2[_0xd306('0x44')]=qs[_0xd306('0x3b')](_[_0xd306('0x45')](_0x1deffc[_0xd306('0x39')],_0x49bcc4[_0xd306('0x3b')]),_0x5dce7e);if(_0x1deffc['query'][_0xd306('0x46')]){_0xfc95a2[_0xd306('0x44')]=_[_0xd306('0x2b')](_0xfc95a2[_0xd306('0x44')],{'$or':_[_0xd306('0x38')](_0x5dce7e,function(_0x5e453c){if(_0x5e453c['type']!==_0xd306('0x47')){var _0x2b5dfc={};_0x2b5dfc[_0x5e453c[_0xd306('0x28')]]={'$like':'%'+_0x1deffc[_0xd306('0x39')][_0xd306('0x46')]+'%'};return _0x2b5dfc;}})});}_0xfc95a2=_[_0xd306('0x2b')]({},_0xfc95a2,_0x1deffc[_0xd306('0x48')]);var _0x3b8be0={'where':_0xfc95a2[_0xd306('0x44')]};return db[_0xd306('0x32')][_0xd306('0x1f')](_0x3b8be0)[_0xd306('0x23')](function(_0x5a52ea){_0x3955c4[_0xd306('0x1f')]=_0x5a52ea;if(_0x1deffc[_0xd306('0x39')][_0xd306('0x49')]){_0xfc95a2[_0xd306('0x4a')]=[{'all':!![]}];}return db[_0xd306('0x32')][_0xd306('0x4b')](_0xfc95a2);})[_0xd306('0x23')](function(_0x3f2923){_0x3955c4[_0xd306('0x4c')]=_0x3f2923;return _0x3955c4;})[_0xd306('0x23')](respondWithFilteredResult(_0x179d06,_0xfc95a2))['catch'](handleError(_0x179d06,null));};exports[_0xd306('0x4d')]=function(_0x2da1a1,_0x3fa860){var _0x570226={'raw':!![],'where':{'id':_0x2da1a1[_0xd306('0x4e')]['id']}},_0x525a66={};_0x525a66['model']=_['keys'](db[_0xd306('0x32')][_0xd306('0x33')]);_0x525a66['query']=_[_0xd306('0x3a')](_0x2da1a1[_0xd306('0x39')]);_0x525a66[_0xd306('0x3b')]=_['intersection'](_0x525a66[_0xd306('0x37')],_0x525a66[_0xd306('0x39')]);_0x570226[_0xd306('0x3d')]=_[_0xd306('0x3c')](_0x525a66[_0xd306('0x37')],qs['fields'](_0x2da1a1['query'][_0xd306('0x3e')]));_0x570226['attributes']=_0x570226[_0xd306('0x3d')]['length']?_0x570226[_0xd306('0x3d')]:_0x525a66[_0xd306('0x37')];if(_0x2da1a1['query'][_0xd306('0x49')]){_0x570226[_0xd306('0x4a')]=[{'all':!![]}];}_0x570226=_[_0xd306('0x2b')]({},_0x570226,_0x2da1a1[_0xd306('0x48')]);return db['OpenchannelQueueReport'][_0xd306('0x4f')](_0x570226)[_0xd306('0x23')](handleEntityNotFound(_0x3fa860,null))[_0xd306('0x23')](respondWithResult(_0x3fa860,null))[_0xd306('0x50')](handleError(_0x3fa860,null));};exports[_0xd306('0x51')]=function(_0x5c35d2,_0x56717c){return db['OpenchannelQueueReport']['create'](_0x5c35d2['body'],{})[_0xd306('0x23')](respondWithResult(_0x56717c,0xc9))[_0xd306('0x50')](handleError(_0x56717c,null));};exports['update']=function(_0x4abc76,_0x4e56b8){if(_0x4abc76['body']['id']){delete _0x4abc76[_0xd306('0x52')]['id'];}return db['OpenchannelQueueReport'][_0xd306('0x4f')]({'where':{'id':_0x4abc76['params']['id']}})[_0xd306('0x23')](handleEntityNotFound(_0x4e56b8,null))['then'](saveUpdates(_0x4abc76['body'],null))['then'](respondWithResult(_0x4e56b8,null))[_0xd306('0x50')](handleError(_0x4e56b8,null));};exports[_0xd306('0x24')]=function(_0x4f1e79,_0x15b359){return db['OpenchannelQueueReport'][_0xd306('0x4f')]({'where':{'id':_0x4f1e79[_0xd306('0x4e')]['id']}})[_0xd306('0x23')](handleEntityNotFound(_0x15b359,null))[_0xd306('0x23')](removeEntity(_0x15b359,null))[_0xd306('0x50')](handleError(_0x15b359,null));};exports[_0xd306('0x53')]=function(_0x179df4,_0x305d75){return db['OpenchannelQueueReport'][_0xd306('0x53')]()['then'](respondWithResult(_0x305d75,null))['catch'](handleError(_0x305d75,null));}; \ No newline at end of file +var _0xffab=['OpenchannelQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','type','VIRTUAL','name','filter','options','include','catch','show','params','includeAll','find','create','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','set','Content-Range','apply','save','update','then','destroy','error','render','merge','body','contact','message','interaction','account','map'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xffab,0x1a5));var _0xbffa=function(_0x18fd5c,_0x452ebb){_0x18fd5c=_0x18fd5c-0x0;var _0x19e42e=_0xffab[_0x18fd5c];return _0x19e42e;};'use strict';var emlformat=require(_0xbffa('0x0'));var rimraf=require(_0xbffa('0x1'));var zipdir=require(_0xbffa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbffa('0x3'));var moment=require(_0xbffa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbffa('0x5'));var util=require(_0xbffa('0x6'));var path=require(_0xbffa('0x7'));var sox=require(_0xbffa('0x8'));var csv=require(_0xbffa('0x9'));var ejs=require(_0xbffa('0xa'));var fs=require('fs');var fs_extra=require(_0xbffa('0xb'));var _=require('lodash');var squel=require(_0xbffa('0xc'));var crypto=require('crypto');var jsforce=require(_0xbffa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbffa('0x9'));var querystring=require(_0xbffa('0xe'));var Papa=require('papaparse');var Redis=require(_0xbffa('0xf'));var authService=require(_0xbffa('0x10'));var qs=require(_0xbffa('0x11'));var as=require(_0xbffa('0x12'));var hardwareService=require(_0xbffa('0x13'));var logger=require(_0xbffa('0x14'))(_0xbffa('0x15'));var utils=require(_0xbffa('0x16'));var config=require(_0xbffa('0x17'));var licenseUtil=require(_0xbffa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x473397,_0x474c81){_0x474c81=_0x474c81||0xcc;return function(_0x9b2d86){if(_0x9b2d86){return _0x473397[_0xbffa('0x19')](_0x474c81);}return _0x473397[_0xbffa('0x1a')](_0x474c81)[_0xbffa('0x1b')]();};}function respondWithResult(_0x1181ea,_0x3d1259){_0x3d1259=_0x3d1259||0xc8;return function(_0x4a3fcd){if(_0x4a3fcd){return _0x1181ea[_0xbffa('0x1a')](_0x3d1259)[_0xbffa('0x1c')](_0x4a3fcd);}};}function respondWithFilteredResult(_0x244d99,_0x1cfe01){return function(_0x909cf3){if(_0x909cf3){var _0x3ccb80=typeof _0x1cfe01[_0xbffa('0x1d')]==='undefined'&&typeof _0x1cfe01['limit']==='undefined';var _0x25be01=_0x909cf3[_0xbffa('0x1e')];var _0x2199e8=_0x3ccb80?0x0:_0x1cfe01[_0xbffa('0x1d')];var _0x54c1a9=_0x3ccb80?_0x909cf3[_0xbffa('0x1e')]:_0x1cfe01[_0xbffa('0x1d')]+_0x1cfe01['limit'];var _0x9339de;if(_0x54c1a9>=_0x25be01){_0x54c1a9=_0x25be01;_0x9339de=0xc8;}else{_0x9339de=0xce;}_0x244d99[_0xbffa('0x1a')](_0x9339de);return _0x244d99[_0xbffa('0x1f')](_0xbffa('0x20'),_0x2199e8+'-'+_0x54c1a9+'/'+_0x25be01)[_0xbffa('0x1c')](_0x909cf3);}return null;};}function patchUpdates(_0x233108){return function(_0x5960e3){try{jsonpatch[_0xbffa('0x21')](_0x5960e3,_0x233108,!![]);}catch(_0x35497a){return BPromise['reject'](_0x35497a);}return _0x5960e3[_0xbffa('0x22')]();};}function saveUpdates(_0x451219,_0x240011){return function(_0x4b1974){if(_0x4b1974){return _0x4b1974[_0xbffa('0x23')](_0x451219)[_0xbffa('0x24')](function(_0x22abe7){return _0x22abe7;});}return null;};}function removeEntity(_0x2c1d36,_0xe224bc){return function(_0x43e40a){if(_0x43e40a){return _0x43e40a[_0xbffa('0x25')]()[_0xbffa('0x24')](function(){_0x2c1d36['status'](0xcc)[_0xbffa('0x1b')]();});}};}function handleEntityNotFound(_0x59676c,_0x36435b){return function(_0x184101){if(!_0x184101){_0x59676c['sendStatus'](0x194);}return _0x184101;};}function handleError(_0x390cd1,_0x4e3ff4){_0x4e3ff4=_0x4e3ff4||0x1f4;return function(_0x24fed0){logger[_0xbffa('0x26')](_0x24fed0['stack']);if(_0x24fed0['name']){delete _0x24fed0['name'];}_0x390cd1['status'](_0x4e3ff4)['send'](_0x24fed0);};}function getMustacheRender(_0xe97470,_0x3c32bb){return Mustache[_0xbffa('0x27')](_0xe97470,_[_0xbffa('0x28')](_0x3c32bb[_0xbffa('0x29')],{'contact':_0x3c32bb[_0xbffa('0x2a')],'message':_0x3c32bb[_0xbffa('0x2b')],'agent':_0x3c32bb['agent'],'interaction':_0x3c32bb[_0xbffa('0x2c')],'account':_0x3c32bb[_0xbffa('0x2d')]}))||'';}exports['index']=function(_0xfe5670,_0x1073cb){var _0x228337={},_0x99f617={},_0x2a972f={'count':0x0,'rows':[]};var _0xfbc0ab=_[_0xbffa('0x2e')](db[_0xbffa('0x2f')][_0xbffa('0x30')],function(_0x4fcabe){return{'name':_0x4fcabe[_0xbffa('0x31')],'type':_0x4fcabe['type'][_0xbffa('0x32')]};});_0x99f617[_0xbffa('0x33')]=_['map'](_0xfbc0ab,'name');_0x99f617['query']=_[_0xbffa('0x34')](_0xfe5670[_0xbffa('0x35')]);_0x99f617[_0xbffa('0x36')]=_['intersection'](_0x99f617[_0xbffa('0x33')],_0x99f617[_0xbffa('0x35')]);_0x228337[_0xbffa('0x37')]=_[_0xbffa('0x38')](_0x99f617['model'],qs[_0xbffa('0x39')](_0xfe5670[_0xbffa('0x35')]['fields']));_0x228337[_0xbffa('0x37')]=_0x228337[_0xbffa('0x37')]['length']?_0x228337[_0xbffa('0x37')]:_0x99f617['model'];if(!_0xfe5670['query'][_0xbffa('0x3a')](_0xbffa('0x3b'))){_0x228337[_0xbffa('0x3c')]=qs[_0xbffa('0x3c')](_0xfe5670['query'][_0xbffa('0x3c')]);_0x228337[_0xbffa('0x1d')]=qs[_0xbffa('0x1d')](_0xfe5670[_0xbffa('0x35')][_0xbffa('0x1d')]);}_0x228337[_0xbffa('0x3d')]=qs['sort'](_0xfe5670[_0xbffa('0x35')][_0xbffa('0x3e')]);_0x228337['where']=qs[_0xbffa('0x36')](_[_0xbffa('0x3f')](_0xfe5670[_0xbffa('0x35')],_0x99f617[_0xbffa('0x36')]),_0xfbc0ab);if(_0xfe5670[_0xbffa('0x35')]['filter']){_0x228337[_0xbffa('0x40')]=_[_0xbffa('0x28')](_0x228337[_0xbffa('0x40')],{'$or':_['map'](_0xfbc0ab,function(_0x2f0fc7){if(_0x2f0fc7[_0xbffa('0x41')]!==_0xbffa('0x42')){var _0x48a5bb={};_0x48a5bb[_0x2f0fc7[_0xbffa('0x43')]]={'$like':'%'+_0xfe5670[_0xbffa('0x35')][_0xbffa('0x44')]+'%'};return _0x48a5bb;}})});}_0x228337=_[_0xbffa('0x28')]({},_0x228337,_0xfe5670[_0xbffa('0x45')]);var _0x19c1af={'where':_0x228337['where']};return db[_0xbffa('0x2f')][_0xbffa('0x1e')](_0x19c1af)[_0xbffa('0x24')](function(_0xac3e26){_0x2a972f['count']=_0xac3e26;if(_0xfe5670[_0xbffa('0x35')]['includeAll']){_0x228337[_0xbffa('0x46')]=[{'all':!![]}];}return db[_0xbffa('0x2f')]['findAll'](_0x228337);})['then'](function(_0x123ebb){_0x2a972f['rows']=_0x123ebb;return _0x2a972f;})[_0xbffa('0x24')](respondWithFilteredResult(_0x1073cb,_0x228337))[_0xbffa('0x47')](handleError(_0x1073cb,null));};exports[_0xbffa('0x48')]=function(_0x316f6e,_0x4d5537){var _0x55853f={'raw':!![],'where':{'id':_0x316f6e[_0xbffa('0x49')]['id']}},_0x4e71b4={};_0x4e71b4[_0xbffa('0x33')]=_[_0xbffa('0x34')](db[_0xbffa('0x2f')][_0xbffa('0x30')]);_0x4e71b4[_0xbffa('0x35')]=_['keys'](_0x316f6e[_0xbffa('0x35')]);_0x4e71b4[_0xbffa('0x36')]=_[_0xbffa('0x38')](_0x4e71b4[_0xbffa('0x33')],_0x4e71b4[_0xbffa('0x35')]);_0x55853f['attributes']=_[_0xbffa('0x38')](_0x4e71b4[_0xbffa('0x33')],qs[_0xbffa('0x39')](_0x316f6e[_0xbffa('0x35')]['fields']));_0x55853f[_0xbffa('0x37')]=_0x55853f[_0xbffa('0x37')]['length']?_0x55853f[_0xbffa('0x37')]:_0x4e71b4[_0xbffa('0x33')];if(_0x316f6e[_0xbffa('0x35')][_0xbffa('0x4a')]){_0x55853f[_0xbffa('0x46')]=[{'all':!![]}];}_0x55853f=_[_0xbffa('0x28')]({},_0x55853f,_0x316f6e[_0xbffa('0x45')]);return db[_0xbffa('0x2f')][_0xbffa('0x4b')](_0x55853f)[_0xbffa('0x24')](handleEntityNotFound(_0x4d5537,null))[_0xbffa('0x24')](respondWithResult(_0x4d5537,null))[_0xbffa('0x47')](handleError(_0x4d5537,null));};exports[_0xbffa('0x4c')]=function(_0x452c06,_0x224070){return db[_0xbffa('0x2f')][_0xbffa('0x4c')](_0x452c06[_0xbffa('0x29')],{})[_0xbffa('0x24')](respondWithResult(_0x224070,0xc9))[_0xbffa('0x47')](handleError(_0x224070,null));};exports[_0xbffa('0x23')]=function(_0x7e6c6c,_0x2081cc){if(_0x7e6c6c[_0xbffa('0x29')]['id']){delete _0x7e6c6c[_0xbffa('0x29')]['id'];}return db[_0xbffa('0x2f')][_0xbffa('0x4b')]({'where':{'id':_0x7e6c6c[_0xbffa('0x49')]['id']}})[_0xbffa('0x24')](handleEntityNotFound(_0x2081cc,null))[_0xbffa('0x24')](saveUpdates(_0x7e6c6c[_0xbffa('0x29')],null))[_0xbffa('0x24')](respondWithResult(_0x2081cc,null))[_0xbffa('0x47')](handleError(_0x2081cc,null));};exports['destroy']=function(_0x8a417f,_0x4b723f){return db['OpenchannelQueueReport'][_0xbffa('0x4b')]({'where':{'id':_0x8a417f['params']['id']}})[_0xbffa('0x24')](handleEntityNotFound(_0x4b723f,null))['then'](removeEntity(_0x4b723f,null))[_0xbffa('0x47')](handleError(_0x4b723f,null));};exports[_0xbffa('0x4d')]=function(_0x3025b6,_0x558a39){return db['OpenchannelQueueReport']['describe']()[_0xbffa('0x24')](respondWithResult(_0x558a39,null))[_0xbffa('0x47')](handleError(_0x558a39,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4d9b37e..cd3fe59 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 _0x8b4f=['rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x30870e,_0x52d05d){var _0x25b244=function(_0xac000a){while(--_0xac000a){_0x30870e['push'](_0x30870e['shift']());}};_0x25b244(++_0x52d05d);}(_0x8b4f,0x19d));var _0xf8b4=function(_0x19409d,_0xf48905){_0x19409d=_0x19409d-0x0;var _0x5de146=_0x8b4f[_0x19409d];return _0x5de146;};'use strict';var _=require(_0xf8b4('0x0'));var util=require(_0xf8b4('0x1'));var logger=require('../../config/logger')(_0xf8b4('0x2'));var moment=require(_0xf8b4('0x3'));var BPromise=require(_0xf8b4('0x4'));var rp=require(_0xf8b4('0x5'));var fs=require('fs');var path=require(_0xf8b4('0x6'));var rimraf=require(_0xf8b4('0x7'));var config=require(_0xf8b4('0x8'));var attributes=require(_0xf8b4('0x9'));module[_0xf8b4('0xa')]=function(_0x53658a,_0x29f867){return _0x53658a[_0xf8b4('0xb')](_0xf8b4('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xf8b4('0xd'),'fields':[_0xf8b4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea03=['report_openchannel_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','./openchannelQueueReport.attributes','exports','define'];(function(_0x3856d0,_0x939a2e){var _0x4b54a1=function(_0x4523c8){while(--_0x4523c8){_0x3856d0['push'](_0x3856d0['shift']());}};_0x4b54a1(++_0x939a2e);}(_0xea03,0x1ba));var _0x3ea0=function(_0x161ab6,_0x51ee5c){_0x161ab6=_0x161ab6-0x0;var _0x437d12=_0xea03[_0x161ab6];return _0x437d12;};'use strict';var _=require(_0x3ea0('0x0'));var util=require('util');var logger=require(_0x3ea0('0x1'))(_0x3ea0('0x2'));var moment=require(_0x3ea0('0x3'));var BPromise=require(_0x3ea0('0x4'));var rp=require(_0x3ea0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3ea0('0x6'));module[_0x3ea0('0x7')]=function(_0x266966,_0xed8a4b){return _0x266966[_0x3ea0('0x8')]('OpenchannelQueueReport',attributes,{'tableName':_0x3ea0('0x9'),'paranoid':![],'indexes':[{'name':_0x3ea0('0xa'),'fields':[_0x3ea0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index adf6356..c2ef609 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 _0xb81a=['body','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','create'];(function(_0x233e41,_0x1f9300){var _0x59fecf=function(_0x43df0b){while(--_0x43df0b){_0x233e41['push'](_0x233e41['shift']());}};_0x59fecf(++_0x1f9300);}(_0xb81a,0x1f3));var _0xab81=function(_0x9f149e,_0xbc274a){_0x9f149e=_0x9f149e-0x0;var _0x4f3db5=_0xb81a[_0x9f149e];return _0x4f3db5;};'use strict';var _=require(_0xab81('0x0'));var util=require(_0xab81('0x1'));var moment=require('moment');var BPromise=require(_0xab81('0x2'));var rs=require(_0xab81('0x3'));var fs=require('fs');var Redis=require(_0xab81('0x4'));var db=require(_0xab81('0x5'))['db'];var utils=require(_0xab81('0x6'));var logger=require(_0xab81('0x7'))(_0xab81('0x8'));var config=require(_0xab81('0x9'));var jayson=require(_0xab81('0xa'));var client=jayson[_0xab81('0xb')][_0xab81('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc1c7f4,_0x4b80d7,_0x5d533c){return new BPromise(function(_0x28bc80,_0xaf3321){return client[_0xab81('0xd')](_0xc1c7f4,_0x5d533c)[_0xab81('0xe')](function(_0x2cd454){logger[_0xab81('0xf')](_0xab81('0x10'),_0x4b80d7,_0xab81('0x11'));logger[_0xab81('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x4b80d7,_0xab81('0x11'),JSON[_0xab81('0x13')](_0x2cd454));if(_0x2cd454['error']){if(_0x2cd454['error'][_0xab81('0x14')]===0x1f4){logger[_0xab81('0x15')](_0xab81('0x10'),_0x4b80d7,_0x2cd454[_0xab81('0x15')]['message']);return _0xaf3321(_0x2cd454[_0xab81('0x15')][_0xab81('0x16')]);}logger[_0xab81('0x15')](_0xab81('0x10'),_0x4b80d7,_0x2cd454[_0xab81('0x15')][_0xab81('0x16')]);return _0x28bc80(_0x2cd454[_0xab81('0x15')][_0xab81('0x16')]);}else{logger[_0xab81('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4b80d7,_0xab81('0x11'));_0x28bc80(_0x2cd454[_0xab81('0x17')][_0xab81('0x16')]);}})[_0xab81('0x18')](function(_0xf12be5){logger['error'](_0xab81('0x10'),_0x4b80d7,_0xf12be5);_0xaf3321(_0xf12be5);});});}exports['CreateOpenchannelQueueReport']=function(_0x265fe8){var _0x22a9c9=this;return new Promise(function(_0x235448,_0x9b7737){return db['OpenchannelQueueReport'][_0xab81('0x19')](_0x265fe8[_0xab81('0x1a')],{'raw':_0x265fe8[_0xab81('0x1b')]?_0x265fe8[_0xab81('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xab81('0xe')](function(_0x3450b0){logger[_0xab81('0xf')](_0xab81('0x1c'),_0x265fe8);logger[_0xab81('0x12')]('CreateOpenchannelQueueReport',_0x265fe8,JSON[_0xab81('0x13')](_0x3450b0));_0x235448(_0x3450b0);})[_0xab81('0x18')](function(_0x477636){logger[_0xab81('0x15')]('CreateOpenchannelQueueReport',_0x477636[_0xab81('0x16')],_0x265fe8);_0x9b7737(_0x22a9c9[_0xab81('0x15')](0x1f4,_0x477636[_0xab81('0x16')]));});});};exports[_0xab81('0x1d')]=function(_0x221ec9){var _0x57bfc9=this;return new Promise(function(_0x2abbc0,_0x147e91){return db[_0xab81('0x1e')]['update'](_0x221ec9['body'],{'raw':_0x221ec9[_0xab81('0x1b')]?_0x221ec9[_0xab81('0x1b')][_0xab81('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x221ec9[_0xab81('0x1b')]?_0x221ec9['options'][_0xab81('0x20')]||null:null,'attributes':_0x221ec9[_0xab81('0x1b')]?_0x221ec9[_0xab81('0x1b')][_0xab81('0x21')]||null:null,'limit':_0x221ec9[_0xab81('0x1b')]?_0x221ec9[_0xab81('0x1b')][_0xab81('0x22')]||null:null})[_0xab81('0xe')](function(_0x13e6c6){logger[_0xab81('0xf')](_0xab81('0x1d'),_0x221ec9);logger['debug'](_0xab81('0x1d'),_0x221ec9,JSON[_0xab81('0x13')](_0x13e6c6));_0x2abbc0(_0x13e6c6);})[_0xab81('0x18')](function(_0x10a552){logger[_0xab81('0x15')]('UpdateOpenchannelQueueReport',_0x10a552[_0xab81('0x16')],_0x221ec9);_0x147e91(_0x57bfc9[_0xab81('0x15')](0x1f4,_0x10a552['message']));});});}; \ No newline at end of file +var _0xfa3f=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','update','attributes','limit','UpdateOpenchannelQueueReport','util','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfa3f,0xd7));var _0xffa3=function(_0x2d6b32,_0x227bfc){_0x2d6b32=_0x2d6b32-0x0;var _0x3c608f=_0xfa3f[_0x2d6b32];return _0x3c608f;};'use strict';var _=require('lodash');var util=require(_0xffa3('0x0'));var moment=require(_0xffa3('0x1'));var BPromise=require('bluebird');var rs=require(_0xffa3('0x2'));var fs=require('fs');var Redis=require(_0xffa3('0x3'));var db=require(_0xffa3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xffa3('0x5'))(_0xffa3('0x6'));var config=require(_0xffa3('0x7'));var jayson=require(_0xffa3('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x466a0b,_0x523d4f,_0x842ff){return new BPromise(function(_0x5ecba9,_0x48d104){return client['request'](_0x466a0b,_0x842ff)[_0xffa3('0x9')](function(_0x306d80){logger[_0xffa3('0xa')](_0xffa3('0xb'),_0x523d4f,_0xffa3('0xc'));logger[_0xffa3('0xd')](_0xffa3('0xe'),_0x523d4f,'request\x20sent',JSON[_0xffa3('0xf')](_0x306d80));if(_0x306d80[_0xffa3('0x10')]){if(_0x306d80['error'][_0xffa3('0x11')]===0x1f4){logger['error'](_0xffa3('0xb'),_0x523d4f,_0x306d80[_0xffa3('0x10')][_0xffa3('0x12')]);return _0x48d104(_0x306d80[_0xffa3('0x10')]['message']);}logger['error'](_0xffa3('0xb'),_0x523d4f,_0x306d80[_0xffa3('0x10')]['message']);return _0x5ecba9(_0x306d80[_0xffa3('0x10')][_0xffa3('0x12')]);}else{logger[_0xffa3('0xa')](_0xffa3('0xb'),_0x523d4f,'request\x20sent');_0x5ecba9(_0x306d80[_0xffa3('0x13')][_0xffa3('0x12')]);}})[_0xffa3('0x14')](function(_0x1a3082){logger[_0xffa3('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x523d4f,_0x1a3082);_0x48d104(_0x1a3082);});});}exports['CreateOpenchannelQueueReport']=function(_0x486c0c){var _0x1648c1=this;return new Promise(function(_0xf2ac60,_0x3b8b0d){return db[_0xffa3('0x15')][_0xffa3('0x16')](_0x486c0c[_0xffa3('0x17')],{'raw':_0x486c0c[_0xffa3('0x18')]?_0x486c0c[_0xffa3('0x18')][_0xffa3('0x19')]===undefined?!![]:![]:!![]})[_0xffa3('0x9')](function(_0xfa70){logger['info'](_0xffa3('0x1a'),_0x486c0c);logger[_0xffa3('0xd')](_0xffa3('0x1a'),_0x486c0c,JSON[_0xffa3('0xf')](_0xfa70));_0xf2ac60(_0xfa70);})[_0xffa3('0x14')](function(_0x51553d){logger[_0xffa3('0x10')](_0xffa3('0x1a'),_0x51553d[_0xffa3('0x12')],_0x486c0c);_0x3b8b0d(_0x1648c1[_0xffa3('0x10')](0x1f4,_0x51553d[_0xffa3('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x462134){var _0x4ac8f8=this;return new Promise(function(_0x5cd79c,_0x663ae0){return db[_0xffa3('0x15')][_0xffa3('0x1b')](_0x462134[_0xffa3('0x17')],{'raw':_0x462134['options']?_0x462134['options'][_0xffa3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x462134['options']?_0x462134[_0xffa3('0x18')]['where']||null:null,'attributes':_0x462134[_0xffa3('0x18')]?_0x462134['options'][_0xffa3('0x1c')]||null:null,'limit':_0x462134['options']?_0x462134[_0xffa3('0x18')][_0xffa3('0x1d')]||null:null})['then'](function(_0x98af97){logger[_0xffa3('0xa')](_0xffa3('0x1e'),_0x462134);logger[_0xffa3('0xd')](_0xffa3('0x1e'),_0x462134,JSON['stringify'](_0x98af97));_0x5cd79c(_0x98af97);})['catch'](function(_0x4061c2){logger[_0xffa3('0x10')](_0xffa3('0x1e'),_0x4061c2[_0xffa3('0x12')],_0x462134);_0x663ae0(_0x4ac8f8[_0xffa3('0x10')](0x1f4,_0x4061c2[_0xffa3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 58e07f3..54f29f1 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 _0x6784=['express','Router','fs-extra','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3b790d,_0x26afba){var _0x398b29=function(_0x15e88d){while(--_0x15e88d){_0x3b790d['push'](_0x3b790d['shift']());}};_0x398b29(++_0x26afba);}(_0x6784,0x74));var _0x4678=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0x6784[_0x597484];return _0x218e64;};'use strict';var multer=require(_0x4678('0x0'));var util=require(_0x4678('0x1'));var path=require(_0x4678('0x2'));var timeout=require(_0x4678('0x3'));var express=require(_0x4678('0x4'));var router=express[_0x4678('0x5')]();var fs_extra=require(_0x4678('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4678('0x7'));var config=require('../../config/environment');var controller=require(_0x4678('0x8'));router[_0x4678('0x9')]('/',auth[_0x4678('0xa')](),controller[_0x4678('0xb')]);router[_0x4678('0x9')](_0x4678('0xc'),auth[_0x4678('0xa')](),controller[_0x4678('0xd')]);router[_0x4678('0x9')](_0x4678('0xe'),auth[_0x4678('0xa')](),controller['show']);router[_0x4678('0xf')]('/',auth[_0x4678('0xa')](),controller[_0x4678('0x10')]);router['put'](_0x4678('0xe'),auth[_0x4678('0xa')](),controller['update']);router[_0x4678('0x11')](_0x4678('0xe'),auth[_0x4678('0xa')](),controller[_0x4678('0x12')]);module[_0x4678('0x13')]=router; \ No newline at end of file +var _0x29db=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x27102a,_0x432add){var _0x314c90=function(_0xd8dbb4){while(--_0xd8dbb4){_0x27102a['push'](_0x27102a['shift']());}};_0x314c90(++_0x432add);}(_0x29db,0x13f));var _0xb29d=function(_0x37fb21,_0x13d088){_0x37fb21=_0x37fb21-0x0;var _0x58ca12=_0x29db[_0x37fb21];return _0x58ca12;};'use strict';var multer=require(_0xb29d('0x0'));var util=require('util');var path=require(_0xb29d('0x1'));var timeout=require(_0xb29d('0x2'));var express=require(_0xb29d('0x3'));var router=express[_0xb29d('0x4')]();var fs_extra=require(_0xb29d('0x5'));var auth=require(_0xb29d('0x6'));var interaction=require(_0xb29d('0x7'));var config=require(_0xb29d('0x8'));var controller=require(_0xb29d('0x9'));router[_0xb29d('0xa')]('/',auth[_0xb29d('0xb')](),controller[_0xb29d('0xc')]);router[_0xb29d('0xa')]('/describe',auth[_0xb29d('0xb')](),controller['describe']);router[_0xb29d('0xa')](_0xb29d('0xd'),auth[_0xb29d('0xb')](),controller[_0xb29d('0xe')]);router[_0xb29d('0xf')]('/',auth[_0xb29d('0xb')](),controller['create']);router[_0xb29d('0x10')](_0xb29d('0xd'),auth[_0xb29d('0xb')](),controller[_0xb29d('0x11')]);router[_0xb29d('0x12')](_0xb29d('0xd'),auth[_0xb29d('0xb')](),controller[_0xb29d('0x13')]);module[_0xb29d('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 6d6a641..fb8693b 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 _0x35eb=['NOW','moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x4fdee1,_0x3f290c){var _0x87826e=function(_0x2cbeaa){while(--_0x2cbeaa){_0x4fdee1['push'](_0x4fdee1['shift']());}};_0x87826e(++_0x3f290c);}(_0x35eb,0x1cd));var _0xb35e=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x35eb[_0x237546];return _0x233e29;};'use strict';var moment=require(_0xb35e('0x0'));var Sequelize=require(_0xb35e('0x1'));module[_0xb35e('0x2')]={'uniqueid':{'type':Sequelize[_0xb35e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb35e('0x4')](_0xb35e('0x5'),_0xb35e('0x6'),_0xb35e('0x7')),'allowNull':![],'defaultValue':_0xb35e('0x7')},'transferredAt':{'type':Sequelize[_0xb35e('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xb35e('0x9')]}}; \ No newline at end of file +var _0xc4b0=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE','moment'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0xc4b0,0x8f));var _0x0c4b=function(_0x4eee59,_0x195b9a){_0x4eee59=_0x4eee59-0x0;var _0x42194d=_0xc4b0[_0x4eee59];return _0x42194d;};'use strict';var moment=require(_0x0c4b('0x0'));var Sequelize=require(_0x0c4b('0x1'));module[_0x0c4b('0x2')]={'uniqueid':{'type':Sequelize[_0x0c4b('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0c4b('0x4')](_0x0c4b('0x5'),_0x0c4b('0x6'),'queue'),'allowNull':![],'defaultValue':_0x0c4b('0x7')},'transferredAt':{'type':Sequelize[_0x0c4b('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 23b04d9..f71d153 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 _0x681b=['body','agent','account','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','render','merge'];(function(_0x46708b,_0x544089){var _0x3036c7=function(_0x313700){while(--_0x313700){_0x46708b['push'](_0x46708b['shift']());}};_0x3036c7(++_0x544089);}(_0x681b,0x75));var _0xb681=function(_0x4a28de,_0x516308){_0x4a28de=_0x4a28de-0x0;var _0x97acbe=_0x681b[_0x4a28de];return _0x97acbe;};'use strict';var emlformat=require(_0xb681('0x0'));var rimraf=require(_0xb681('0x1'));var zipdir=require(_0xb681('0x2'));var jsonpatch=require(_0xb681('0x3'));var rp=require(_0xb681('0x4'));var moment=require(_0xb681('0x5'));var BPromise=require(_0xb681('0x6'));var Mustache=require(_0xb681('0x7'));var util=require(_0xb681('0x8'));var path=require('path');var sox=require(_0xb681('0x9'));var csv=require(_0xb681('0xa'));var ejs=require(_0xb681('0xb'));var fs=require('fs');var fs_extra=require(_0xb681('0xc'));var _=require(_0xb681('0xd'));var squel=require(_0xb681('0xe'));var crypto=require(_0xb681('0xf'));var jsforce=require(_0xb681('0x10'));var deskjs=require(_0xb681('0x11'));var toCsv=require(_0xb681('0xa'));var querystring=require(_0xb681('0x12'));var Papa=require(_0xb681('0x13'));var Redis=require(_0xb681('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb681('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb681('0x16'));var logger=require(_0xb681('0x17'))(_0xb681('0x18'));var utils=require('../../config/utils');var config=require(_0xb681('0x19'));var licenseUtil=require(_0xb681('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d6873,_0x56aed0){_0x56aed0=_0x56aed0||0xcc;return function(_0x20842d){if(_0x20842d){return _0x1d6873[_0xb681('0x1b')](_0x56aed0);}return _0x1d6873[_0xb681('0x1c')](_0x56aed0)[_0xb681('0x1d')]();};}function respondWithResult(_0x143a06,_0x3d3c4e){_0x3d3c4e=_0x3d3c4e||0xc8;return function(_0x582e91){if(_0x582e91){return _0x143a06['status'](_0x3d3c4e)[_0xb681('0x1e')](_0x582e91);}};}function respondWithFilteredResult(_0x1d1bce,_0x52d0a3){return function(_0x3d634c){if(_0x3d634c){var _0x583e3d=typeof _0x52d0a3[_0xb681('0x1f')]===_0xb681('0x20')&&typeof _0x52d0a3['limit']===_0xb681('0x20');var _0x5a8ea6=_0x3d634c[_0xb681('0x21')];var _0x341e0b=_0x583e3d?0x0:_0x52d0a3[_0xb681('0x1f')];var _0x170620=_0x583e3d?_0x3d634c[_0xb681('0x21')]:_0x52d0a3[_0xb681('0x1f')]+_0x52d0a3[_0xb681('0x22')];var _0x131e41;if(_0x170620>=_0x5a8ea6){_0x170620=_0x5a8ea6;_0x131e41=0xc8;}else{_0x131e41=0xce;}_0x1d1bce[_0xb681('0x1c')](_0x131e41);return _0x1d1bce[_0xb681('0x23')](_0xb681('0x24'),_0x341e0b+'-'+_0x170620+'/'+_0x5a8ea6)['json'](_0x3d634c);}return null;};}function patchUpdates(_0x64e0f9){return function(_0x311e57){try{jsonpatch[_0xb681('0x25')](_0x311e57,_0x64e0f9,!![]);}catch(_0x2a4c96){return BPromise[_0xb681('0x26')](_0x2a4c96);}return _0x311e57['save']();};}function saveUpdates(_0x3183d6,_0x50da89){return function(_0x2574d0){if(_0x2574d0){return _0x2574d0[_0xb681('0x27')](_0x3183d6)[_0xb681('0x28')](function(_0x34b120){return _0x34b120;});}return null;};}function removeEntity(_0x42040e,_0x3c23fe){return function(_0x1339d9){if(_0x1339d9){return _0x1339d9[_0xb681('0x29')]()[_0xb681('0x28')](function(){_0x42040e[_0xb681('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6545,_0x29b2bd){return function(_0x19fbd4){if(!_0x19fbd4){_0x5b6545[_0xb681('0x1b')](0x194);}return _0x19fbd4;};}function handleError(_0xf6d4f,_0xa9afc5){_0xa9afc5=_0xa9afc5||0x1f4;return function(_0x46283a){logger[_0xb681('0x2a')](_0x46283a['stack']);if(_0x46283a['name']){delete _0x46283a[_0xb681('0x2b')];}_0xf6d4f['status'](_0xa9afc5)[_0xb681('0x2c')](_0x46283a);};}function getMustacheRender(_0x297301,_0x4687ee){return Mustache[_0xb681('0x2d')](_0x297301,_[_0xb681('0x2e')](_0x4687ee[_0xb681('0x2f')],{'contact':_0x4687ee['contact'],'message':_0x4687ee['message'],'agent':_0x4687ee[_0xb681('0x30')],'interaction':_0x4687ee['interaction'],'account':_0x4687ee[_0xb681('0x31')]}))||'';}exports[_0xb681('0x32')]=function(_0x54092f,_0x220c4d){var _0x531587={},_0x4a07c4={},_0x2d427e={'count':0x0,'rows':[]};var _0x466ec0=_[_0xb681('0x33')](db[_0xb681('0x34')][_0xb681('0x35')],function(_0x2763f6){return{'name':_0x2763f6[_0xb681('0x36')],'type':_0x2763f6[_0xb681('0x37')][_0xb681('0x38')]};});_0x4a07c4[_0xb681('0x39')]=_[_0xb681('0x33')](_0x466ec0,_0xb681('0x2b'));_0x4a07c4[_0xb681('0x3a')]=_[_0xb681('0x3b')](_0x54092f[_0xb681('0x3a')]);_0x4a07c4[_0xb681('0x3c')]=_[_0xb681('0x3d')](_0x4a07c4[_0xb681('0x39')],_0x4a07c4[_0xb681('0x3a')]);_0x531587[_0xb681('0x3e')]=_[_0xb681('0x3d')](_0x4a07c4[_0xb681('0x39')],qs[_0xb681('0x3f')](_0x54092f[_0xb681('0x3a')][_0xb681('0x3f')]));_0x531587['attributes']=_0x531587['attributes']['length']?_0x531587['attributes']:_0x4a07c4[_0xb681('0x39')];if(!_0x54092f[_0xb681('0x3a')][_0xb681('0x40')]('nolimit')){_0x531587['limit']=qs['limit'](_0x54092f[_0xb681('0x3a')][_0xb681('0x22')]);_0x531587['offset']=qs[_0xb681('0x1f')](_0x54092f[_0xb681('0x3a')][_0xb681('0x1f')]);}_0x531587[_0xb681('0x41')]=qs[_0xb681('0x42')](_0x54092f[_0xb681('0x3a')][_0xb681('0x42')]);_0x531587[_0xb681('0x43')]=qs[_0xb681('0x3c')](_[_0xb681('0x44')](_0x54092f[_0xb681('0x3a')],_0x4a07c4[_0xb681('0x3c')]),_0x466ec0);if(_0x54092f[_0xb681('0x3a')][_0xb681('0x45')]){_0x531587[_0xb681('0x43')]=_['merge'](_0x531587[_0xb681('0x43')],{'$or':_['map'](_0x466ec0,function(_0x5a6f88){if(_0x5a6f88[_0xb681('0x37')]!=='VIRTUAL'){var _0xe7666f={};_0xe7666f[_0x5a6f88['name']]={'$like':'%'+_0x54092f[_0xb681('0x3a')]['filter']+'%'};return _0xe7666f;}})});}_0x531587=_[_0xb681('0x2e')]({},_0x531587,_0x54092f[_0xb681('0x46')]);var _0xbf5559={'where':_0x531587[_0xb681('0x43')]};return db['OpenchannelTransferReport']['count'](_0xbf5559)[_0xb681('0x28')](function(_0x4b6a86){_0x2d427e[_0xb681('0x21')]=_0x4b6a86;if(_0x54092f[_0xb681('0x3a')][_0xb681('0x47')]){_0x531587[_0xb681('0x48')]=[{'all':!![]}];}return db[_0xb681('0x34')][_0xb681('0x49')](_0x531587);})[_0xb681('0x28')](function(_0x47a0e1){_0x2d427e[_0xb681('0x4a')]=_0x47a0e1;return _0x2d427e;})['then'](respondWithFilteredResult(_0x220c4d,_0x531587))[_0xb681('0x4b')](handleError(_0x220c4d,null));};exports[_0xb681('0x4c')]=function(_0x5dc059,_0x358862){var _0x301df7={'raw':!![],'where':{'id':_0x5dc059[_0xb681('0x4d')]['id']}},_0x1fd077={};_0x1fd077[_0xb681('0x39')]=_[_0xb681('0x3b')](db[_0xb681('0x34')]['rawAttributes']);_0x1fd077[_0xb681('0x3a')]=_[_0xb681('0x3b')](_0x5dc059[_0xb681('0x3a')]);_0x1fd077['filters']=_['intersection'](_0x1fd077['model'],_0x1fd077[_0xb681('0x3a')]);_0x301df7[_0xb681('0x3e')]=_['intersection'](_0x1fd077[_0xb681('0x39')],qs[_0xb681('0x3f')](_0x5dc059[_0xb681('0x3a')][_0xb681('0x3f')]));_0x301df7['attributes']=_0x301df7[_0xb681('0x3e')][_0xb681('0x4e')]?_0x301df7[_0xb681('0x3e')]:_0x1fd077[_0xb681('0x39')];if(_0x5dc059['query']['includeAll']){_0x301df7[_0xb681('0x48')]=[{'all':!![]}];}_0x301df7=_['merge']({},_0x301df7,_0x5dc059[_0xb681('0x46')]);return db['OpenchannelTransferReport'][_0xb681('0x4f')](_0x301df7)[_0xb681('0x28')](handleEntityNotFound(_0x358862,null))[_0xb681('0x28')](respondWithResult(_0x358862,null))[_0xb681('0x4b')](handleError(_0x358862,null));};exports[_0xb681('0x50')]=function(_0x221b10,_0x4cca04){return db[_0xb681('0x34')][_0xb681('0x50')](_0x221b10[_0xb681('0x2f')],{})[_0xb681('0x28')](respondWithResult(_0x4cca04,0xc9))[_0xb681('0x4b')](handleError(_0x4cca04,null));};exports[_0xb681('0x27')]=function(_0x2391b8,_0x12808f){if(_0x2391b8['body']['id']){delete _0x2391b8[_0xb681('0x2f')]['id'];}return db[_0xb681('0x34')]['find']({'where':{'id':_0x2391b8['params']['id']}})[_0xb681('0x28')](handleEntityNotFound(_0x12808f,null))[_0xb681('0x28')](saveUpdates(_0x2391b8['body'],null))[_0xb681('0x28')](respondWithResult(_0x12808f,null))['catch'](handleError(_0x12808f,null));};exports[_0xb681('0x29')]=function(_0x53b49a,_0x31c0ef){return db[_0xb681('0x34')][_0xb681('0x4f')]({'where':{'id':_0x53b49a['params']['id']}})[_0xb681('0x28')](handleEntityNotFound(_0x31c0ef,null))['then'](removeEntity(_0x31c0ef,null))['catch'](handleError(_0x31c0ef,null));};exports[_0xb681('0x51')]=function(_0x46fdf6,_0x377b4e){return db[_0xb681('0x34')]['describe']()[_0xb681('0x28')](respondWithResult(_0x377b4e,null))[_0xb681('0x4b')](handleError(_0x377b4e,null));}; \ No newline at end of file +var _0x1177=['query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','pick','where','filter','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','params','rawAttributes','create','find','describe','eml-format','rimraf','zip-dir','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','error','stack','name','send','render','merge','body','message','interaction','index','map','fieldName','type','model','keys'];(function(_0x3cede2,_0x135cd2){var _0x55f922=function(_0x2f872f){while(--_0x2f872f){_0x3cede2['push'](_0x3cede2['shift']());}};_0x55f922(++_0x135cd2);}(_0x1177,0xad));var _0x7117=function(_0x3deb7b,_0x5c4502){_0x3deb7b=_0x3deb7b-0x0;var _0x474d5a=_0x1177[_0x3deb7b];return _0x474d5a;};'use strict';var emlformat=require(_0x7117('0x0'));var rimraf=require(_0x7117('0x1'));var zipdir=require(_0x7117('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7117('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7117('0x4'));var util=require('util');var path=require(_0x7117('0x5'));var sox=require('sox');var csv=require(_0x7117('0x6'));var ejs=require(_0x7117('0x7'));var fs=require('fs');var fs_extra=require(_0x7117('0x8'));var _=require(_0x7117('0x9'));var squel=require('squel');var crypto=require(_0x7117('0xa'));var jsforce=require(_0x7117('0xb'));var deskjs=require(_0x7117('0xc'));var toCsv=require(_0x7117('0x6'));var querystring=require(_0x7117('0xd'));var Papa=require(_0x7117('0xe'));var Redis=require(_0x7117('0xf'));var authService=require(_0x7117('0x10'));var qs=require(_0x7117('0x11'));var as=require(_0x7117('0x12'));var hardwareService=require(_0x7117('0x13'));var logger=require(_0x7117('0x14'))('api');var utils=require(_0x7117('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7117('0x16'));var db=require(_0x7117('0x17'))['db'];function respondWithStatusCode(_0x40b4b5,_0x1d1089){_0x1d1089=_0x1d1089||0xcc;return function(_0x3ef583){if(_0x3ef583){return _0x40b4b5['sendStatus'](_0x1d1089);}return _0x40b4b5[_0x7117('0x18')](_0x1d1089)[_0x7117('0x19')]();};}function respondWithResult(_0x372a00,_0x5b00a4){_0x5b00a4=_0x5b00a4||0xc8;return function(_0x1fb88e){if(_0x1fb88e){return _0x372a00[_0x7117('0x18')](_0x5b00a4)[_0x7117('0x1a')](_0x1fb88e);}};}function respondWithFilteredResult(_0x4dc754,_0x5df4e6){return function(_0x136f23){if(_0x136f23){var _0x4462ec=typeof _0x5df4e6[_0x7117('0x1b')]===_0x7117('0x1c')&&typeof _0x5df4e6[_0x7117('0x1d')]===_0x7117('0x1c');var _0x264c93=_0x136f23[_0x7117('0x1e')];var _0x580e97=_0x4462ec?0x0:_0x5df4e6['offset'];var _0x150b69=_0x4462ec?_0x136f23[_0x7117('0x1e')]:_0x5df4e6[_0x7117('0x1b')]+_0x5df4e6['limit'];var _0x1d4a8a;if(_0x150b69>=_0x264c93){_0x150b69=_0x264c93;_0x1d4a8a=0xc8;}else{_0x1d4a8a=0xce;}_0x4dc754[_0x7117('0x18')](_0x1d4a8a);return _0x4dc754[_0x7117('0x1f')]('Content-Range',_0x580e97+'-'+_0x150b69+'/'+_0x264c93)['json'](_0x136f23);}return null;};}function patchUpdates(_0x53049f){return function(_0x256e6a){try{jsonpatch[_0x7117('0x20')](_0x256e6a,_0x53049f,!![]);}catch(_0x270783){return BPromise['reject'](_0x270783);}return _0x256e6a[_0x7117('0x21')]();};}function saveUpdates(_0x194a64,_0x55e40a){return function(_0x5c5325){if(_0x5c5325){return _0x5c5325[_0x7117('0x22')](_0x194a64)['then'](function(_0x1313e1){return _0x1313e1;});}return null;};}function removeEntity(_0x3661be,_0x2066b8){return function(_0x1f31b4){if(_0x1f31b4){return _0x1f31b4[_0x7117('0x23')]()[_0x7117('0x24')](function(){_0x3661be[_0x7117('0x18')](0xcc)[_0x7117('0x19')]();});}};}function handleEntityNotFound(_0xb52f20,_0x28fe91){return function(_0x30e4cf){if(!_0x30e4cf){_0xb52f20['sendStatus'](0x194);}return _0x30e4cf;};}function handleError(_0xebd91c,_0x2cc6ab){_0x2cc6ab=_0x2cc6ab||0x1f4;return function(_0x56a0e2){logger[_0x7117('0x25')](_0x56a0e2[_0x7117('0x26')]);if(_0x56a0e2['name']){delete _0x56a0e2[_0x7117('0x27')];}_0xebd91c[_0x7117('0x18')](_0x2cc6ab)[_0x7117('0x28')](_0x56a0e2);};}function getMustacheRender(_0x86bbd1,_0x5064ec){return Mustache[_0x7117('0x29')](_0x86bbd1,_[_0x7117('0x2a')](_0x5064ec[_0x7117('0x2b')],{'contact':_0x5064ec['contact'],'message':_0x5064ec[_0x7117('0x2c')],'agent':_0x5064ec['agent'],'interaction':_0x5064ec[_0x7117('0x2d')],'account':_0x5064ec['account']}))||'';}exports[_0x7117('0x2e')]=function(_0xe645a4,_0x45cef4){var _0x18cd57={},_0x5985c9={},_0x3af71c={'count':0x0,'rows':[]};var _0x26bd71=_[_0x7117('0x2f')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x46930a){return{'name':_0x46930a[_0x7117('0x30')],'type':_0x46930a[_0x7117('0x31')]['key']};});_0x5985c9[_0x7117('0x32')]=_[_0x7117('0x2f')](_0x26bd71,_0x7117('0x27'));_0x5985c9['query']=_[_0x7117('0x33')](_0xe645a4[_0x7117('0x34')]);_0x5985c9[_0x7117('0x35')]=_['intersection'](_0x5985c9[_0x7117('0x32')],_0x5985c9[_0x7117('0x34')]);_0x18cd57[_0x7117('0x36')]=_[_0x7117('0x37')](_0x5985c9[_0x7117('0x32')],qs[_0x7117('0x38')](_0xe645a4[_0x7117('0x34')][_0x7117('0x38')]));_0x18cd57[_0x7117('0x36')]=_0x18cd57['attributes']['length']?_0x18cd57['attributes']:_0x5985c9[_0x7117('0x32')];if(!_0xe645a4[_0x7117('0x34')][_0x7117('0x39')](_0x7117('0x3a'))){_0x18cd57[_0x7117('0x1d')]=qs[_0x7117('0x1d')](_0xe645a4[_0x7117('0x34')][_0x7117('0x1d')]);_0x18cd57[_0x7117('0x1b')]=qs['offset'](_0xe645a4[_0x7117('0x34')][_0x7117('0x1b')]);}_0x18cd57[_0x7117('0x3b')]=qs['sort'](_0xe645a4[_0x7117('0x34')]['sort']);_0x18cd57['where']=qs['filters'](_[_0x7117('0x3c')](_0xe645a4[_0x7117('0x34')],_0x5985c9['filters']),_0x26bd71);if(_0xe645a4[_0x7117('0x34')]['filter']){_0x18cd57[_0x7117('0x3d')]=_['merge'](_0x18cd57[_0x7117('0x3d')],{'$or':_[_0x7117('0x2f')](_0x26bd71,function(_0x5c1c84){if(_0x5c1c84[_0x7117('0x31')]!=='VIRTUAL'){var _0x439338={};_0x439338[_0x5c1c84[_0x7117('0x27')]]={'$like':'%'+_0xe645a4[_0x7117('0x34')][_0x7117('0x3e')]+'%'};return _0x439338;}})});}_0x18cd57=_[_0x7117('0x2a')]({},_0x18cd57,_0xe645a4[_0x7117('0x3f')]);var _0x3955ae={'where':_0x18cd57[_0x7117('0x3d')]};return db[_0x7117('0x40')]['count'](_0x3955ae)['then'](function(_0x519001){_0x3af71c[_0x7117('0x1e')]=_0x519001;if(_0xe645a4[_0x7117('0x34')][_0x7117('0x41')]){_0x18cd57[_0x7117('0x42')]=[{'all':!![]}];}return db[_0x7117('0x40')][_0x7117('0x43')](_0x18cd57);})['then'](function(_0x5aa28d){_0x3af71c[_0x7117('0x44')]=_0x5aa28d;return _0x3af71c;})[_0x7117('0x24')](respondWithFilteredResult(_0x45cef4,_0x18cd57))[_0x7117('0x45')](handleError(_0x45cef4,null));};exports['show']=function(_0x5d19b4,_0x3cc04a){var _0x64179f={'raw':!![],'where':{'id':_0x5d19b4[_0x7117('0x46')]['id']}},_0x4893fe={};_0x4893fe[_0x7117('0x32')]=_[_0x7117('0x33')](db[_0x7117('0x40')][_0x7117('0x47')]);_0x4893fe[_0x7117('0x34')]=_[_0x7117('0x33')](_0x5d19b4[_0x7117('0x34')]);_0x4893fe['filters']=_[_0x7117('0x37')](_0x4893fe[_0x7117('0x32')],_0x4893fe[_0x7117('0x34')]);_0x64179f[_0x7117('0x36')]=_['intersection'](_0x4893fe[_0x7117('0x32')],qs[_0x7117('0x38')](_0x5d19b4['query'][_0x7117('0x38')]));_0x64179f[_0x7117('0x36')]=_0x64179f[_0x7117('0x36')]['length']?_0x64179f[_0x7117('0x36')]:_0x4893fe[_0x7117('0x32')];if(_0x5d19b4['query'][_0x7117('0x41')]){_0x64179f[_0x7117('0x42')]=[{'all':!![]}];}_0x64179f=_[_0x7117('0x2a')]({},_0x64179f,_0x5d19b4['options']);return db[_0x7117('0x40')]['find'](_0x64179f)[_0x7117('0x24')](handleEntityNotFound(_0x3cc04a,null))['then'](respondWithResult(_0x3cc04a,null))[_0x7117('0x45')](handleError(_0x3cc04a,null));};exports[_0x7117('0x48')]=function(_0x103b7b,_0x351784){return db[_0x7117('0x40')]['create'](_0x103b7b[_0x7117('0x2b')],{})[_0x7117('0x24')](respondWithResult(_0x351784,0xc9))[_0x7117('0x45')](handleError(_0x351784,null));};exports[_0x7117('0x22')]=function(_0x9d93fe,_0x5b7d9d){if(_0x9d93fe[_0x7117('0x2b')]['id']){delete _0x9d93fe[_0x7117('0x2b')]['id'];}return db[_0x7117('0x40')]['find']({'where':{'id':_0x9d93fe['params']['id']}})['then'](handleEntityNotFound(_0x5b7d9d,null))[_0x7117('0x24')](saveUpdates(_0x9d93fe['body'],null))[_0x7117('0x24')](respondWithResult(_0x5b7d9d,null))[_0x7117('0x45')](handleError(_0x5b7d9d,null));};exports[_0x7117('0x23')]=function(_0x5e9368,_0x3b6415){return db[_0x7117('0x40')][_0x7117('0x49')]({'where':{'id':_0x5e9368['params']['id']}})['then'](handleEntityNotFound(_0x3b6415,null))['then'](removeEntity(_0x3b6415,null))[_0x7117('0x45')](handleError(_0x3b6415,null));};exports[_0x7117('0x4a')]=function(_0x49a469,_0x3506c3){return db[_0x7117('0x40')][_0x7117('0x4a')]()[_0x7117('0x24')](respondWithResult(_0x3506c3,null))[_0x7117('0x45')](handleError(_0x3506c3,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 62d858f..8014696 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 _0x5b34=['../../config/environment','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2a24b3,_0x3f4ef2){var _0x2d9039=function(_0x4ca416){while(--_0x4ca416){_0x2a24b3['push'](_0x2a24b3['shift']());}};_0x2d9039(++_0x3f4ef2);}(_0x5b34,0x191));var _0x45b3=function(_0x35248f,_0x5f44d4){_0x35248f=_0x35248f-0x0;var _0x45b3eb=_0x5b34[_0x35248f];return _0x45b3eb;};'use strict';var _=require(_0x45b3('0x0'));var util=require(_0x45b3('0x1'));var logger=require(_0x45b3('0x2'))(_0x45b3('0x3'));var moment=require('moment');var BPromise=require(_0x45b3('0x4'));var rp=require(_0x45b3('0x5'));var fs=require('fs');var path=require(_0x45b3('0x6'));var rimraf=require('rimraf');var config=require(_0x45b3('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x45b3('0x8')]=function(_0x4d3b77,_0x3bbb40){return _0x4d3b77[_0x45b3('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0x45b3('0xa'),'paranoid':![],'indexes':[{'name':_0x45b3('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1daf=['../../config/logger','api','moment','bluebird','request-promise','path','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x1048ba,_0x31e6fb){var _0x44df10=function(_0x5ef92d){while(--_0x5ef92d){_0x1048ba['push'](_0x1048ba['shift']());}};_0x44df10(++_0x31e6fb);}(_0x1daf,0x67));var _0xf1da=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1daf[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xf1da('0x0'));var util=require('util');var logger=require(_0xf1da('0x1'))(_0xf1da('0x2'));var moment=require(_0xf1da('0x3'));var BPromise=require(_0xf1da('0x4'));var rp=require(_0xf1da('0x5'));var fs=require('fs');var path=require(_0xf1da('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf1da('0x7'));module[_0xf1da('0x8')]=function(_0x13feca,_0x19f226){return _0x13feca[_0xf1da('0x9')](_0xf1da('0xa'),attributes,{'tableName':_0xf1da('0xb'),'paranoid':![],'indexes':[{'name':_0xf1da('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index da0ac6e..38ce955 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 _0x6759=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0xfea6cd,_0x520080){var _0x254a22=function(_0x5491c4){while(--_0x5491c4){_0xfea6cd['push'](_0xfea6cd['shift']());}};_0x254a22(++_0x520080);}(_0x6759,0x126));var _0x9675=function(_0x16b77e,_0x4a56a3){_0x16b77e=_0x16b77e-0x0;var _0x3ae284=_0x6759[_0x16b77e];return _0x3ae284;};'use strict';var _=require(_0x9675('0x0'));var util=require('util');var moment=require(_0x9675('0x1'));var BPromise=require(_0x9675('0x2'));var rs=require(_0x9675('0x3'));var fs=require('fs');var Redis=require(_0x9675('0x4'));var db=require(_0x9675('0x5'))['db'];var utils=require(_0x9675('0x6'));var logger=require('../../config/logger')(_0x9675('0x7'));var config=require('../../config/environment');var jayson=require(_0x9675('0x8'));var client=jayson[_0x9675('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x198f1f,_0xec5caa,_0x1d3cfd){return new BPromise(function(_0x6732f,_0x288152){return client[_0x9675('0xa')](_0x198f1f,_0x1d3cfd)[_0x9675('0xb')](function(_0xc8fb5f){logger[_0x9675('0xc')](_0x9675('0xd'),_0xec5caa,'request\x20sent');logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0xec5caa,_0x9675('0xe'),JSON[_0x9675('0xf')](_0xc8fb5f));if(_0xc8fb5f[_0x9675('0x10')]){if(_0xc8fb5f[_0x9675('0x10')][_0x9675('0x11')]===0x1f4){logger[_0x9675('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xec5caa,_0xc8fb5f[_0x9675('0x10')][_0x9675('0x12')]);return _0x288152(_0xc8fb5f[_0x9675('0x10')]['message']);}logger[_0x9675('0x10')](_0x9675('0xd'),_0xec5caa,_0xc8fb5f['error'][_0x9675('0x12')]);return _0x6732f(_0xc8fb5f[_0x9675('0x10')]['message']);}else{logger[_0x9675('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xec5caa,_0x9675('0xe'));_0x6732f(_0xc8fb5f[_0x9675('0x13')][_0x9675('0x12')]);}})[_0x9675('0x14')](function(_0x26fb68){logger[_0x9675('0x10')](_0x9675('0xd'),_0xec5caa,_0x26fb68);_0x288152(_0x26fb68);});});} \ No newline at end of file +var _0x6b9b=['rpc','client','http','request','then','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','randomstring','../../config/utils','../../config/logger'];(function(_0x5bfc98,_0xa385b0){var _0x3ff395=function(_0x2a3db8){while(--_0x2a3db8){_0x5bfc98['push'](_0x5bfc98['shift']());}};_0x3ff395(++_0xa385b0);}(_0x6b9b,0x19a));var _0xb6b9=function(_0x5532e7,_0x4e3d7){_0x5532e7=_0x5532e7-0x0;var _0x56ccf4=_0x6b9b[_0x5532e7];return _0x56ccf4;};'use strict';var _=require('lodash');var util=require(_0xb6b9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb6b9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb6b9('0x2'));var logger=require(_0xb6b9('0x3'))(_0xb6b9('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb6b9('0x5')][_0xb6b9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5ae819,_0x2f9765,_0x1fc130){return new BPromise(function(_0x453731,_0x1d2d39){return client[_0xb6b9('0x7')](_0x5ae819,_0x1fc130)[_0xb6b9('0x8')](function(_0x518127){logger[_0xb6b9('0x9')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2f9765,_0xb6b9('0xa'));logger['debug'](_0xb6b9('0xb'),_0x2f9765,_0xb6b9('0xa'),JSON[_0xb6b9('0xc')](_0x518127));if(_0x518127[_0xb6b9('0xd')]){if(_0x518127[_0xb6b9('0xd')]['code']===0x1f4){logger[_0xb6b9('0xd')](_0xb6b9('0xe'),_0x2f9765,_0x518127[_0xb6b9('0xd')][_0xb6b9('0xf')]);return _0x1d2d39(_0x518127['error'][_0xb6b9('0xf')]);}logger[_0xb6b9('0xd')](_0xb6b9('0xe'),_0x2f9765,_0x518127[_0xb6b9('0xd')][_0xb6b9('0xf')]);return _0x453731(_0x518127[_0xb6b9('0xd')]['message']);}else{logger[_0xb6b9('0x9')](_0xb6b9('0xe'),_0x2f9765,_0xb6b9('0xa'));_0x453731(_0x518127[_0xb6b9('0x10')][_0xb6b9('0xf')]);}})[_0xb6b9('0x11')](function(_0x32c6a4){logger[_0xb6b9('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2f9765,_0x32c6a4);_0x1d2d39(_0x32c6a4);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 59cde04..e16ea8a 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 _0xf77b=['/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x143039,_0x2aa74a){var _0x3ee551=function(_0x3fdc94){while(--_0x3fdc94){_0x143039['push'](_0x143039['shift']());}};_0x3ee551(++_0x2aa74a);}(_0xf77b,0xc6));var _0xbf77=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xf77b[_0x3430aa];return _0x2ac5c;};'use strict';var multer=require(_0xbf77('0x0'));var util=require(_0xbf77('0x1'));var path=require('path');var timeout=require(_0xbf77('0x2'));var express=require(_0xbf77('0x3'));var router=express[_0xbf77('0x4')]();var fs_extra=require(_0xbf77('0x5'));var auth=require(_0xbf77('0x6'));var interaction=require(_0xbf77('0x7'));var config=require('../../config/environment');var controller=require('./pause.controller');router['get']('/',auth[_0xbf77('0x8')](),controller[_0xbf77('0x9')]);router[_0xbf77('0xa')](_0xbf77('0xb'),auth[_0xbf77('0x8')](),controller[_0xbf77('0xc')]);router['post']('/',auth[_0xbf77('0x8')](),controller[_0xbf77('0xd')]);router[_0xbf77('0xe')](_0xbf77('0xb'),auth[_0xbf77('0x8')](),controller[_0xbf77('0xf')]);router[_0xbf77('0x10')]('/:id',auth[_0xbf77('0x8')](),controller[_0xbf77('0x11')]);module[_0xbf77('0x12')]=router; \ No newline at end of file +var _0x2ad7=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create'];(function(_0x1a0e73,_0x3e0c94){var _0x4273e5=function(_0x2cefea){while(--_0x2cefea){_0x1a0e73['push'](_0x1a0e73['shift']());}};_0x4273e5(++_0x3e0c94);}(_0x2ad7,0x159));var _0x72ad=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2ad7[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x72ad('0x0'));var util=require(_0x72ad('0x1'));var path=require('path');var timeout=require(_0x72ad('0x2'));var express=require(_0x72ad('0x3'));var router=express[_0x72ad('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x72ad('0x5'));var config=require(_0x72ad('0x6'));var controller=require('./pause.controller');router[_0x72ad('0x7')]('/',auth[_0x72ad('0x8')](),controller['index']);router[_0x72ad('0x7')](_0x72ad('0x9'),auth[_0x72ad('0x8')](),controller[_0x72ad('0xa')]);router['post']('/',auth[_0x72ad('0x8')](),controller[_0x72ad('0xb')]);router[_0x72ad('0xc')](_0x72ad('0x9'),auth[_0x72ad('0x8')](),controller[_0x72ad('0xd')]);router[_0x72ad('0xe')](_0x72ad('0x9'),auth[_0x72ad('0x8')](),controller[_0x72ad('0xf')]);module[_0x72ad('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2cc8dcc..b1778b4 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 _0xeb39=['STRING','name','sequelize','exports'];(function(_0x23c326,_0x143624){var _0xf10b29=function(_0x6838bd){while(--_0x6838bd){_0x23c326['push'](_0x23c326['shift']());}};_0xf10b29(++_0x143624);}(_0xeb39,0x17e));var _0x9eb3=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0xeb39[_0x285c85];return _0x2f81cd;};'use strict';var Sequelize=require(_0x9eb3('0x0'));module[_0x9eb3('0x1')]={'name':{'type':Sequelize[_0x9eb3('0x2')],'unique':_0x9eb3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9eb3('0x2')]}}; \ No newline at end of file +var _0x9497=['name','sequelize','exports'];(function(_0x507714,_0x418454){var _0x131937=function(_0x43eff7){while(--_0x43eff7){_0x507714['push'](_0x507714['shift']());}};_0x131937(++_0x418454);}(_0x9497,0x1bd));var _0x7949=function(_0xff395a,_0x2762cb){_0xff395a=_0xff395a-0x0;var _0x426d68=_0x9497[_0xff395a];return _0x426d68;};'use strict';var Sequelize=require(_0x7949('0x0'));module[_0x7949('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7949('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2058dc7..9ea1a6e 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 _0x1f56=['fast-json-patch','request-promise','moment','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/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','save','update','destroy','Pauses','UserProfileResource','then','error','name','send','render','merge','contact','message','agent','account','index','map','Pause','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir'];(function(_0x13cd20,_0x1d9211){var _0x22b6de=function(_0x4b574f){while(--_0x4b574f){_0x13cd20['push'](_0x13cd20['shift']());}};_0x22b6de(++_0x1d9211);}(_0x1f56,0x1c4));var _0x61f5=function(_0xbb4093,_0xa7be80){_0xbb4093=_0xbb4093-0x0;var _0x77b6d3=_0x1f56[_0xbb4093];return _0x77b6d3;};'use strict';var emlformat=require(_0x61f5('0x0'));var rimraf=require(_0x61f5('0x1'));var zipdir=require(_0x61f5('0x2'));var jsonpatch=require(_0x61f5('0x3'));var rp=require(_0x61f5('0x4'));var moment=require(_0x61f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x61f5('0x6'));var util=require('util');var path=require(_0x61f5('0x7'));var sox=require(_0x61f5('0x8'));var csv=require(_0x61f5('0x9'));var ejs=require(_0x61f5('0xa'));var fs=require('fs');var fs_extra=require(_0x61f5('0xb'));var _=require(_0x61f5('0xc'));var squel=require(_0x61f5('0xd'));var crypto=require(_0x61f5('0xe'));var jsforce=require(_0x61f5('0xf'));var deskjs=require(_0x61f5('0x10'));var toCsv=require(_0x61f5('0x9'));var querystring=require(_0x61f5('0x11'));var Papa=require(_0x61f5('0x12'));var Redis=require(_0x61f5('0x13'));var authService=require(_0x61f5('0x14'));var qs=require(_0x61f5('0x15'));var as=require(_0x61f5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61f5('0x17'))(_0x61f5('0x18'));var utils=require(_0x61f5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x61f5('0x1a'));var db=require(_0x61f5('0x1b'))['db'];function respondWithStatusCode(_0x11acaf,_0x51c7d9){_0x51c7d9=_0x51c7d9||0xcc;return function(_0x2690bc){if(_0x2690bc){return _0x11acaf[_0x61f5('0x1c')](_0x51c7d9);}return _0x11acaf[_0x61f5('0x1d')](_0x51c7d9)['end']();};}function respondWithResult(_0x36855d,_0x11b8f0){_0x11b8f0=_0x11b8f0||0xc8;return function(_0x4fe6c7){if(_0x4fe6c7){return _0x36855d['status'](_0x11b8f0)['json'](_0x4fe6c7);}};}function respondWithFilteredResult(_0x4fe556,_0x54932e){return function(_0x4c09eb){if(_0x4c09eb){var _0x1e358b=typeof _0x54932e[_0x61f5('0x1e')]==='undefined'&&typeof _0x54932e[_0x61f5('0x1f')]===_0x61f5('0x20');var _0x3a7763=_0x4c09eb[_0x61f5('0x21')];var _0x537b04=_0x1e358b?0x0:_0x54932e['offset'];var _0x4f7807=_0x1e358b?_0x4c09eb['count']:_0x54932e[_0x61f5('0x1e')]+_0x54932e['limit'];var _0x4dd9f4;if(_0x4f7807>=_0x3a7763){_0x4f7807=_0x3a7763;_0x4dd9f4=0xc8;}else{_0x4dd9f4=0xce;}_0x4fe556[_0x61f5('0x1d')](_0x4dd9f4);return _0x4fe556['set'](_0x61f5('0x22'),_0x537b04+'-'+_0x4f7807+'/'+_0x3a7763)[_0x61f5('0x23')](_0x4c09eb);}return null;};}function patchUpdates(_0x1f2fbc){return function(_0x2e1968){try{jsonpatch[_0x61f5('0x24')](_0x2e1968,_0x1f2fbc,!![]);}catch(_0x1f5d01){return BPromise['reject'](_0x1f5d01);}return _0x2e1968[_0x61f5('0x25')]();};}function saveUpdates(_0x469f70,_0x48c9f0){return function(_0x11f952){if(_0x11f952){return _0x11f952[_0x61f5('0x26')](_0x469f70)['then'](function(_0x3d4a6e){return _0x3d4a6e;});}return null;};}function removeEntity(_0x1da2d5,_0x2f0af4){return function(_0x29b6d2){if(_0x29b6d2){return _0x29b6d2[_0x61f5('0x27')]()['then'](function(){var _0x1716c6=_0x29b6d2['get']({'plain':!![]});var _0x1dc602=_0x61f5('0x28');return db[_0x61f5('0x29')][_0x61f5('0x27')]({'where':{'type':_0x1dc602,'resourceId':_0x1716c6['id']}})[_0x61f5('0x2a')](function(){return _0x29b6d2;});})['then'](function(){_0x1da2d5[_0x61f5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x382640,_0x5514f5){return function(_0x530708){if(!_0x530708){_0x382640[_0x61f5('0x1c')](0x194);}return _0x530708;};}function handleError(_0x2b16d3,_0x548346){_0x548346=_0x548346||0x1f4;return function(_0x3f67dc){logger[_0x61f5('0x2b')](_0x3f67dc['stack']);if(_0x3f67dc[_0x61f5('0x2c')]){delete _0x3f67dc['name'];}_0x2b16d3[_0x61f5('0x1d')](_0x548346)[_0x61f5('0x2d')](_0x3f67dc);};}function getMustacheRender(_0x4c6ce8,_0x1afead){return Mustache[_0x61f5('0x2e')](_0x4c6ce8,_[_0x61f5('0x2f')](_0x1afead['body'],{'contact':_0x1afead[_0x61f5('0x30')],'message':_0x1afead[_0x61f5('0x31')],'agent':_0x1afead[_0x61f5('0x32')],'interaction':_0x1afead['interaction'],'account':_0x1afead[_0x61f5('0x33')]}))||'';}exports[_0x61f5('0x34')]=function(_0x40c9b3,_0x5422b3){var _0x57b9a2={},_0x33c2a7={},_0x4946f2={'count':0x0,'rows':[]};var _0x2f7119=_[_0x61f5('0x35')](db[_0x61f5('0x36')][_0x61f5('0x37')],function(_0x1c4610){return{'name':_0x1c4610['fieldName'],'type':_0x1c4610[_0x61f5('0x38')][_0x61f5('0x39')]};});_0x33c2a7[_0x61f5('0x3a')]=_[_0x61f5('0x35')](_0x2f7119,_0x61f5('0x2c'));_0x33c2a7[_0x61f5('0x3b')]=_[_0x61f5('0x3c')](_0x40c9b3['query']);_0x33c2a7['filters']=_[_0x61f5('0x3d')](_0x33c2a7['model'],_0x33c2a7[_0x61f5('0x3b')]);_0x57b9a2[_0x61f5('0x3e')]=_[_0x61f5('0x3d')](_0x33c2a7[_0x61f5('0x3a')],qs['fields'](_0x40c9b3[_0x61f5('0x3b')][_0x61f5('0x3f')]));_0x57b9a2[_0x61f5('0x3e')]=_0x57b9a2[_0x61f5('0x3e')]['length']?_0x57b9a2['attributes']:_0x33c2a7[_0x61f5('0x3a')];if(!_0x40c9b3[_0x61f5('0x3b')][_0x61f5('0x40')](_0x61f5('0x41'))){_0x57b9a2[_0x61f5('0x1f')]=qs[_0x61f5('0x1f')](_0x40c9b3[_0x61f5('0x3b')]['limit']);_0x57b9a2['offset']=qs[_0x61f5('0x1e')](_0x40c9b3[_0x61f5('0x3b')][_0x61f5('0x1e')]);}_0x57b9a2['order']=qs[_0x61f5('0x42')](_0x40c9b3['query'][_0x61f5('0x42')]);_0x57b9a2[_0x61f5('0x43')]=qs[_0x61f5('0x44')](_[_0x61f5('0x45')](_0x40c9b3[_0x61f5('0x3b')],_0x33c2a7[_0x61f5('0x44')]),_0x2f7119);if(_0x40c9b3[_0x61f5('0x3b')][_0x61f5('0x46')]){_0x57b9a2['where']=_[_0x61f5('0x2f')](_0x57b9a2[_0x61f5('0x43')],{'$or':_[_0x61f5('0x35')](_0x2f7119,function(_0x14f1db){if(_0x14f1db[_0x61f5('0x38')]!==_0x61f5('0x47')){var _0x171e68={};_0x171e68[_0x14f1db['name']]={'$like':'%'+_0x40c9b3['query'][_0x61f5('0x46')]+'%'};return _0x171e68;}})});}_0x57b9a2=_[_0x61f5('0x2f')]({},_0x57b9a2,_0x40c9b3['options']);var _0x33e260={'where':_0x57b9a2['where']};return db[_0x61f5('0x36')]['count'](_0x33e260)[_0x61f5('0x2a')](function(_0x4db9fe){_0x4946f2[_0x61f5('0x21')]=_0x4db9fe;if(_0x40c9b3[_0x61f5('0x3b')][_0x61f5('0x48')]){_0x57b9a2[_0x61f5('0x49')]=[{'all':!![]}];}return db[_0x61f5('0x36')][_0x61f5('0x4a')](_0x57b9a2);})[_0x61f5('0x2a')](function(_0x21ed4c){_0x4946f2[_0x61f5('0x4b')]=_0x21ed4c;return _0x4946f2;})['then'](respondWithFilteredResult(_0x5422b3,_0x57b9a2))[_0x61f5('0x4c')](handleError(_0x5422b3,null));};exports[_0x61f5('0x4d')]=function(_0x42e84f,_0x283712){var _0xeef677={'raw':!![],'where':{'id':_0x42e84f[_0x61f5('0x4e')]['id']}},_0x691262={};_0x691262[_0x61f5('0x3a')]=_['keys'](db[_0x61f5('0x36')][_0x61f5('0x37')]);_0x691262[_0x61f5('0x3b')]=_[_0x61f5('0x3c')](_0x42e84f[_0x61f5('0x3b')]);_0x691262[_0x61f5('0x44')]=_['intersection'](_0x691262[_0x61f5('0x3a')],_0x691262[_0x61f5('0x3b')]);_0xeef677[_0x61f5('0x3e')]=_[_0x61f5('0x3d')](_0x691262[_0x61f5('0x3a')],qs['fields'](_0x42e84f['query'][_0x61f5('0x3f')]));_0xeef677['attributes']=_0xeef677[_0x61f5('0x3e')][_0x61f5('0x4f')]?_0xeef677[_0x61f5('0x3e')]:_0x691262[_0x61f5('0x3a')];if(_0x42e84f['query'][_0x61f5('0x48')]){_0xeef677[_0x61f5('0x49')]=[{'all':!![]}];}_0xeef677=_[_0x61f5('0x2f')]({},_0xeef677,_0x42e84f[_0x61f5('0x50')]);return db[_0x61f5('0x36')]['find'](_0xeef677)[_0x61f5('0x2a')](handleEntityNotFound(_0x283712,null))['then'](respondWithResult(_0x283712,null))[_0x61f5('0x4c')](handleError(_0x283712,null));};exports[_0x61f5('0x51')]=function(_0x36bba2,_0x34a1df){return db['Pause']['create'](_0x36bba2[_0x61f5('0x52')],{})[_0x61f5('0x2a')](function(_0x7f659b){var _0xbea7b6=_0x36bba2[_0x61f5('0x53')][_0x61f5('0x54')]({'plain':!![]});if(!_0xbea7b6)throw new Error(_0x61f5('0x55'));if(_0xbea7b6[_0x61f5('0x56')]===_0x61f5('0x53')){var _0x242bd6=_0x7f659b[_0x61f5('0x54')]({'plain':!![]});var _0x1801af='Pauses';return db[_0x61f5('0x57')]['find']({'where':{'name':_0x1801af,'userProfileId':_0xbea7b6['userProfileId']},'raw':!![]})[_0x61f5('0x2a')](function(_0x45fbce){if(_0x45fbce&&_0x45fbce[_0x61f5('0x58')]===0x0){return db[_0x61f5('0x29')]['create']({'name':_0x242bd6[_0x61f5('0x2c')],'resourceId':_0x242bd6['id'],'type':_0x45fbce[_0x61f5('0x2c')],'sectionId':_0x45fbce['id']},{})[_0x61f5('0x2a')](function(){return _0x7f659b;});}else{return _0x7f659b;}})['catch'](function(_0x3c19c6){logger[_0x61f5('0x2b')](_0x61f5('0x59'),_0x3c19c6);throw _0x3c19c6;});}return _0x7f659b;})[_0x61f5('0x2a')](respondWithResult(_0x34a1df,0xc9))[_0x61f5('0x4c')](handleError(_0x34a1df,null));};exports[_0x61f5('0x26')]=function(_0x25e989,_0x1fe3ed){if(_0x25e989[_0x61f5('0x52')]['id']){delete _0x25e989[_0x61f5('0x52')]['id'];}return db[_0x61f5('0x36')][_0x61f5('0x5a')]({'where':{'id':_0x25e989[_0x61f5('0x4e')]['id']}})[_0x61f5('0x2a')](handleEntityNotFound(_0x1fe3ed,null))[_0x61f5('0x2a')](saveUpdates(_0x25e989[_0x61f5('0x52')],null))[_0x61f5('0x2a')](respondWithResult(_0x1fe3ed,null))[_0x61f5('0x4c')](handleError(_0x1fe3ed,null));};exports[_0x61f5('0x27')]=function(_0x5a5ce0,_0x5dd4fa){return db[_0x61f5('0x36')]['find']({'where':{'id':_0x5a5ce0['params']['id']}})[_0x61f5('0x2a')](handleEntityNotFound(_0x5dd4fa,null))[_0x61f5('0x2a')](removeEntity(_0x5dd4fa,null))['catch'](handleError(_0x5dd4fa,null));}; \ No newline at end of file +var _0x2781=['findAll','rows','catch','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','count','set','apply','save','then','get','Pauses','UserProfileResource','sendStatus','name','send','render','merge','contact','agent','interaction','account','index','map','fieldName','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','Pause'];(function(_0x32855a,_0x23d0bc){var _0x57f7c8=function(_0xc09de5){while(--_0xc09de5){_0x32855a['push'](_0x32855a['shift']());}};_0x57f7c8(++_0x23d0bc);}(_0x2781,0x16e));var _0x1278=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2781[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x1278('0x0'));var rimraf=require(_0x1278('0x1'));var zipdir=require(_0x1278('0x2'));var jsonpatch=require(_0x1278('0x3'));var rp=require(_0x1278('0x4'));var moment=require(_0x1278('0x5'));var BPromise=require(_0x1278('0x6'));var Mustache=require(_0x1278('0x7'));var util=require('util');var path=require(_0x1278('0x8'));var sox=require('sox');var csv=require(_0x1278('0x9'));var ejs=require(_0x1278('0xa'));var fs=require('fs');var fs_extra=require(_0x1278('0xb'));var _=require('lodash');var squel=require(_0x1278('0xc'));var crypto=require(_0x1278('0xd'));var jsforce=require(_0x1278('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1278('0x9'));var querystring=require(_0x1278('0xf'));var Papa=require(_0x1278('0x10'));var Redis=require(_0x1278('0x11'));var authService=require(_0x1278('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1278('0x13'));var hardwareService=require(_0x1278('0x14'));var logger=require(_0x1278('0x15'))('api');var utils=require(_0x1278('0x16'));var config=require(_0x1278('0x17'));var licenseUtil=require(_0x1278('0x18'));var db=require(_0x1278('0x19'))['db'];function respondWithStatusCode(_0x4b2aa8,_0x37ae94){_0x37ae94=_0x37ae94||0xcc;return function(_0x35d7f9){if(_0x35d7f9){return _0x4b2aa8['sendStatus'](_0x37ae94);}return _0x4b2aa8[_0x1278('0x1a')](_0x37ae94)[_0x1278('0x1b')]();};}function respondWithResult(_0x366ad4,_0x22ec0d){_0x22ec0d=_0x22ec0d||0xc8;return function(_0x466adb){if(_0x466adb){return _0x366ad4[_0x1278('0x1a')](_0x22ec0d)['json'](_0x466adb);}};}function respondWithFilteredResult(_0x589695,_0x581732){return function(_0x3c26a2){if(_0x3c26a2){var _0x11783e=typeof _0x581732[_0x1278('0x1c')]==='undefined'&&typeof _0x581732[_0x1278('0x1d')]==='undefined';var _0x4411de=_0x3c26a2[_0x1278('0x1e')];var _0x49431e=_0x11783e?0x0:_0x581732['offset'];var _0x433f48=_0x11783e?_0x3c26a2['count']:_0x581732[_0x1278('0x1c')]+_0x581732[_0x1278('0x1d')];var _0x35045c;if(_0x433f48>=_0x4411de){_0x433f48=_0x4411de;_0x35045c=0xc8;}else{_0x35045c=0xce;}_0x589695[_0x1278('0x1a')](_0x35045c);return _0x589695[_0x1278('0x1f')]('Content-Range',_0x49431e+'-'+_0x433f48+'/'+_0x4411de)['json'](_0x3c26a2);}return null;};}function patchUpdates(_0x47dc17){return function(_0x16682b){try{jsonpatch[_0x1278('0x20')](_0x16682b,_0x47dc17,!![]);}catch(_0x20ae19){return BPromise['reject'](_0x20ae19);}return _0x16682b[_0x1278('0x21')]();};}function saveUpdates(_0x53d5cc,_0x3aa624){return function(_0xa36948){if(_0xa36948){return _0xa36948['update'](_0x53d5cc)[_0x1278('0x22')](function(_0x4a8d01){return _0x4a8d01;});}return null;};}function removeEntity(_0x5e7b69,_0x307183){return function(_0x306725){if(_0x306725){return _0x306725['destroy']()[_0x1278('0x22')](function(){var _0x3811b3=_0x306725[_0x1278('0x23')]({'plain':!![]});var _0x241dfb=_0x1278('0x24');return db[_0x1278('0x25')]['destroy']({'where':{'type':_0x241dfb,'resourceId':_0x3811b3['id']}})[_0x1278('0x22')](function(){return _0x306725;});})[_0x1278('0x22')](function(){_0x5e7b69[_0x1278('0x1a')](0xcc)[_0x1278('0x1b')]();});}};}function handleEntityNotFound(_0x26582f,_0x2a9145){return function(_0x7546b4){if(!_0x7546b4){_0x26582f[_0x1278('0x26')](0x194);}return _0x7546b4;};}function handleError(_0x13865b,_0xc630dd){_0xc630dd=_0xc630dd||0x1f4;return function(_0x4fee6e){logger['error'](_0x4fee6e['stack']);if(_0x4fee6e['name']){delete _0x4fee6e[_0x1278('0x27')];}_0x13865b[_0x1278('0x1a')](_0xc630dd)[_0x1278('0x28')](_0x4fee6e);};}function getMustacheRender(_0x40825a,_0x1e1ab4){return Mustache[_0x1278('0x29')](_0x40825a,_[_0x1278('0x2a')](_0x1e1ab4['body'],{'contact':_0x1e1ab4[_0x1278('0x2b')],'message':_0x1e1ab4['message'],'agent':_0x1e1ab4[_0x1278('0x2c')],'interaction':_0x1e1ab4[_0x1278('0x2d')],'account':_0x1e1ab4[_0x1278('0x2e')]}))||'';}exports[_0x1278('0x2f')]=function(_0x29c4b5,_0x2ada85){var _0x324a5b={},_0x2059f3={},_0x5061be={'count':0x0,'rows':[]};var _0x5ee53e=_[_0x1278('0x30')](db['Pause']['rawAttributes'],function(_0x364149){return{'name':_0x364149[_0x1278('0x31')],'type':_0x364149['type']['key']};});_0x2059f3[_0x1278('0x32')]=_[_0x1278('0x30')](_0x5ee53e,_0x1278('0x27'));_0x2059f3[_0x1278('0x33')]=_[_0x1278('0x34')](_0x29c4b5[_0x1278('0x33')]);_0x2059f3[_0x1278('0x35')]=_['intersection'](_0x2059f3['model'],_0x2059f3[_0x1278('0x33')]);_0x324a5b[_0x1278('0x36')]=_[_0x1278('0x37')](_0x2059f3[_0x1278('0x32')],qs[_0x1278('0x38')](_0x29c4b5[_0x1278('0x33')]['fields']));_0x324a5b[_0x1278('0x36')]=_0x324a5b[_0x1278('0x36')]['length']?_0x324a5b['attributes']:_0x2059f3[_0x1278('0x32')];if(!_0x29c4b5[_0x1278('0x33')]['hasOwnProperty'](_0x1278('0x39'))){_0x324a5b['limit']=qs[_0x1278('0x1d')](_0x29c4b5['query'][_0x1278('0x1d')]);_0x324a5b[_0x1278('0x1c')]=qs[_0x1278('0x1c')](_0x29c4b5[_0x1278('0x33')][_0x1278('0x1c')]);}_0x324a5b[_0x1278('0x3a')]=qs[_0x1278('0x3b')](_0x29c4b5[_0x1278('0x33')][_0x1278('0x3b')]);_0x324a5b[_0x1278('0x3c')]=qs[_0x1278('0x35')](_[_0x1278('0x3d')](_0x29c4b5[_0x1278('0x33')],_0x2059f3[_0x1278('0x35')]),_0x5ee53e);if(_0x29c4b5[_0x1278('0x33')]['filter']){_0x324a5b['where']=_[_0x1278('0x2a')](_0x324a5b[_0x1278('0x3c')],{'$or':_[_0x1278('0x30')](_0x5ee53e,function(_0x58546f){if(_0x58546f[_0x1278('0x3e')]!==_0x1278('0x3f')){var _0x1cd626={};_0x1cd626[_0x58546f[_0x1278('0x27')]]={'$like':'%'+_0x29c4b5['query'][_0x1278('0x40')]+'%'};return _0x1cd626;}})});}_0x324a5b=_[_0x1278('0x2a')]({},_0x324a5b,_0x29c4b5[_0x1278('0x41')]);var _0x47c539={'where':_0x324a5b[_0x1278('0x3c')]};return db['Pause'][_0x1278('0x1e')](_0x47c539)[_0x1278('0x22')](function(_0x4c70a4){_0x5061be[_0x1278('0x1e')]=_0x4c70a4;if(_0x29c4b5[_0x1278('0x33')][_0x1278('0x42')]){_0x324a5b[_0x1278('0x43')]=[{'all':!![]}];}return db[_0x1278('0x44')][_0x1278('0x45')](_0x324a5b);})[_0x1278('0x22')](function(_0x524877){_0x5061be[_0x1278('0x46')]=_0x524877;return _0x5061be;})[_0x1278('0x22')](respondWithFilteredResult(_0x2ada85,_0x324a5b))[_0x1278('0x47')](handleError(_0x2ada85,null));};exports['show']=function(_0x3a1743,_0x457833){var _0x52b82e={'raw':!![],'where':{'id':_0x3a1743['params']['id']}},_0x5e042c={};_0x5e042c['model']=_[_0x1278('0x34')](db[_0x1278('0x44')][_0x1278('0x48')]);_0x5e042c[_0x1278('0x33')]=_[_0x1278('0x34')](_0x3a1743['query']);_0x5e042c[_0x1278('0x35')]=_['intersection'](_0x5e042c[_0x1278('0x32')],_0x5e042c[_0x1278('0x33')]);_0x52b82e['attributes']=_[_0x1278('0x37')](_0x5e042c[_0x1278('0x32')],qs['fields'](_0x3a1743[_0x1278('0x33')]['fields']));_0x52b82e[_0x1278('0x36')]=_0x52b82e['attributes'][_0x1278('0x49')]?_0x52b82e[_0x1278('0x36')]:_0x5e042c[_0x1278('0x32')];if(_0x3a1743[_0x1278('0x33')][_0x1278('0x42')]){_0x52b82e['include']=[{'all':!![]}];}_0x52b82e=_['merge']({},_0x52b82e,_0x3a1743[_0x1278('0x41')]);return db[_0x1278('0x44')][_0x1278('0x4a')](_0x52b82e)[_0x1278('0x22')](handleEntityNotFound(_0x457833,null))[_0x1278('0x22')](respondWithResult(_0x457833,null))['catch'](handleError(_0x457833,null));};exports[_0x1278('0x4b')]=function(_0xfe24b2,_0x1b51af){return db[_0x1278('0x44')][_0x1278('0x4b')](_0xfe24b2[_0x1278('0x4c')],{})[_0x1278('0x22')](function(_0x3c9915){var _0x323951=_0xfe24b2[_0x1278('0x4d')][_0x1278('0x23')]({'plain':!![]});if(!_0x323951)throw new Error(_0x1278('0x4e'));if(_0x323951[_0x1278('0x4f')]===_0x1278('0x4d')){var _0xe3c92d=_0x3c9915[_0x1278('0x23')]({'plain':!![]});var _0x5ab336=_0x1278('0x24');return db[_0x1278('0x50')]['find']({'where':{'name':_0x5ab336,'userProfileId':_0x323951[_0x1278('0x51')]},'raw':!![]})[_0x1278('0x22')](function(_0x45f31b){if(_0x45f31b&&_0x45f31b[_0x1278('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0xe3c92d[_0x1278('0x27')],'resourceId':_0xe3c92d['id'],'type':_0x45f31b[_0x1278('0x27')],'sectionId':_0x45f31b['id']},{})[_0x1278('0x22')](function(){return _0x3c9915;});}else{return _0x3c9915;}})[_0x1278('0x47')](function(_0x1b6da4){logger[_0x1278('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b6da4);throw _0x1b6da4;});}return _0x3c9915;})['then'](respondWithResult(_0x1b51af,0xc9))[_0x1278('0x47')](handleError(_0x1b51af,null));};exports[_0x1278('0x54')]=function(_0x38fa1f,_0x2f9106){if(_0x38fa1f[_0x1278('0x4c')]['id']){delete _0x38fa1f[_0x1278('0x4c')]['id'];}return db[_0x1278('0x44')][_0x1278('0x4a')]({'where':{'id':_0x38fa1f[_0x1278('0x55')]['id']}})[_0x1278('0x22')](handleEntityNotFound(_0x2f9106,null))[_0x1278('0x22')](saveUpdates(_0x38fa1f[_0x1278('0x4c')],null))[_0x1278('0x22')](respondWithResult(_0x2f9106,null))[_0x1278('0x47')](handleError(_0x2f9106,null));};exports[_0x1278('0x56')]=function(_0x4fce1e,_0x5bb7ff){return db['Pause'][_0x1278('0x4a')]({'where':{'id':_0x4fce1e[_0x1278('0x55')]['id']}})[_0x1278('0x22')](handleEntityNotFound(_0x5bb7ff,null))[_0x1278('0x22')](removeEntity(_0x5bb7ff,null))[_0x1278('0x47')](handleError(_0x5bb7ff,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 13faa49..66e1b62 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 _0xa467=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Pause','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa467,0x143));var _0x7a46=function(_0x5f02cc,_0x197979){_0x5f02cc=_0x5f02cc-0x0;var _0x178882=_0xa467[_0x5f02cc];return _0x178882;};'use strict';var _=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var logger=require(_0x7a46('0x2'))(_0x7a46('0x3'));var moment=require(_0x7a46('0x4'));var BPromise=require(_0x7a46('0x5'));var rp=require(_0x7a46('0x6'));var fs=require('fs');var path=require(_0x7a46('0x7'));var rimraf=require(_0x7a46('0x8'));var config=require('../../config/environment');var attributes=require('./pause.attributes');module[_0x7a46('0x9')]=function(_0x1940e6,_0x3bfa2c){return _0x1940e6[_0x7a46('0xa')](_0x7a46('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5453=['bluebird','request-promise','../../config/environment','./pause.attributes','define','lodash','util','../../config/logger','api','moment'];(function(_0x142521,_0x462df9){var _0x31d30d=function(_0x34b39c){while(--_0x34b39c){_0x142521['push'](_0x142521['shift']());}};_0x31d30d(++_0x462df9);}(_0x5453,0x18b));var _0x3545=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5453[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x3545('0x0'));var util=require(_0x3545('0x1'));var logger=require(_0x3545('0x2'))(_0x3545('0x3'));var moment=require(_0x3545('0x4'));var BPromise=require(_0x3545('0x5'));var rp=require(_0x3545('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3545('0x7'));var attributes=require(_0x3545('0x8'));module['exports']=function(_0x22a172,_0x59ce7b){return _0x22a172[_0x3545('0x9')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1266d6a..5719613 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 _0xdd89=['map','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowPause','Pause','options','raw','where','attributes','include','model'];(function(_0x5178fb,_0x121e19){var _0x348183=function(_0x52c2ec){while(--_0x52c2ec){_0x5178fb['push'](_0x5178fb['shift']());}};_0x348183(++_0x121e19);}(_0xdd89,0xf9));var _0x9dd8=function(_0x5e2751,_0x518a55){_0x5e2751=_0x5e2751-0x0;var _0x139a39=_0xdd89[_0x5e2751];return _0x139a39;};'use strict';var _=require(_0x9dd8('0x0'));var util=require('util');var moment=require(_0x9dd8('0x1'));var BPromise=require(_0x9dd8('0x2'));var rs=require(_0x9dd8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9dd8('0x4'))['db'];var utils=require(_0x9dd8('0x5'));var logger=require(_0x9dd8('0x6'))('rpc');var config=require(_0x9dd8('0x7'));var jayson=require(_0x9dd8('0x8'));var client=jayson[_0x9dd8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb6224f,_0x4bfa30,_0x2d8288){return new BPromise(function(_0x42a002,_0x5486aa){return client[_0x9dd8('0xa')](_0xb6224f,_0x2d8288)[_0x9dd8('0xb')](function(_0x2a0b82){logger[_0x9dd8('0xc')](_0x9dd8('0xd'),_0x4bfa30,'request\x20sent');logger[_0x9dd8('0xe')](_0x9dd8('0xf'),_0x4bfa30,_0x9dd8('0x10'),JSON[_0x9dd8('0x11')](_0x2a0b82));if(_0x2a0b82[_0x9dd8('0x12')]){if(_0x2a0b82[_0x9dd8('0x12')]['code']===0x1f4){logger[_0x9dd8('0x12')]('Pause,\x20%s,\x20%s',_0x4bfa30,_0x2a0b82['error'][_0x9dd8('0x13')]);return _0x5486aa(_0x2a0b82[_0x9dd8('0x12')][_0x9dd8('0x13')]);}logger[_0x9dd8('0x12')](_0x9dd8('0xd'),_0x4bfa30,_0x2a0b82[_0x9dd8('0x12')][_0x9dd8('0x13')]);return _0x42a002(_0x2a0b82[_0x9dd8('0x12')][_0x9dd8('0x13')]);}else{logger[_0x9dd8('0xc')](_0x9dd8('0xd'),_0x4bfa30,_0x9dd8('0x10'));_0x42a002(_0x2a0b82[_0x9dd8('0x14')][_0x9dd8('0x13')]);}})[_0x9dd8('0x15')](function(_0x346f47){logger[_0x9dd8('0x12')]('Pause,\x20%s,\x20%s',_0x4bfa30,_0x346f47);_0x5486aa(_0x346f47);});});}exports[_0x9dd8('0x16')]=function(_0x2ca5d6){var _0x3d3e04=this;return new Promise(function(_0x70375c,_0x446a6f){return db[_0x9dd8('0x17')]['find']({'raw':_0x2ca5d6[_0x9dd8('0x18')]?_0x2ca5d6[_0x9dd8('0x18')][_0x9dd8('0x19')]===undefined?!![]:![]:!![],'where':_0x2ca5d6[_0x9dd8('0x18')]?_0x2ca5d6[_0x9dd8('0x18')][_0x9dd8('0x1a')]||null:null,'attributes':_0x2ca5d6[_0x9dd8('0x18')]?_0x2ca5d6[_0x9dd8('0x18')][_0x9dd8('0x1b')]||null:null,'include':_0x2ca5d6[_0x9dd8('0x18')]?_0x2ca5d6[_0x9dd8('0x18')][_0x9dd8('0x1c')]?_['map'](_0x2ca5d6[_0x9dd8('0x18')][_0x9dd8('0x1c')],function(_0x453111){return{'model':db[_0x453111[_0x9dd8('0x1d')]],'as':_0x453111['as'],'attributes':_0x453111[_0x9dd8('0x1b')],'include':_0x453111['include']?_['map'](_0x453111[_0x9dd8('0x1c')],function(_0x47ff0b){return{'model':db[_0x47ff0b[_0x9dd8('0x1d')]],'as':_0x47ff0b['as'],'attributes':_0x47ff0b[_0x9dd8('0x1b')],'include':_0x47ff0b['include']?_[_0x9dd8('0x1e')](_0x47ff0b[_0x9dd8('0x1c')],function(_0x293cd7){return{'model':db[_0x293cd7['model']],'as':_0x293cd7['as'],'attributes':_0x293cd7[_0x9dd8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9dd8('0xb')](function(_0x2c1c8a){logger['info'](_0x9dd8('0x16'),_0x2ca5d6);logger[_0x9dd8('0xe')](_0x9dd8('0x16'),_0x2ca5d6,JSON['stringify'](_0x2c1c8a));_0x70375c(_0x2c1c8a);})[_0x9dd8('0x15')](function(_0x3c80e5){logger[_0x9dd8('0x12')](_0x9dd8('0x16'),_0x3c80e5[_0x9dd8('0x13')],_0x2ca5d6);_0x446a6f(_0x3d3e04[_0x9dd8('0x12')](0x1f4,_0x3c80e5['message']));});});}; \ No newline at end of file +var _0x5f40=['request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Pause','find','options','raw','where','include','model','attributes','map','ShowPause','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x95d239,_0x3cc0d3){var _0x29d267=function(_0x48bef2){while(--_0x48bef2){_0x95d239['push'](_0x95d239['shift']());}};_0x29d267(++_0x3cc0d3);}(_0x5f40,0x148));var _0x05f4=function(_0x54b957,_0x567494){_0x54b957=_0x54b957-0x0;var _0x5a9b98=_0x5f40[_0x54b957];return _0x5a9b98;};'use strict';var _=require(_0x05f4('0x0'));var util=require(_0x05f4('0x1'));var moment=require(_0x05f4('0x2'));var BPromise=require(_0x05f4('0x3'));var rs=require(_0x05f4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05f4('0x5'))['db'];var utils=require(_0x05f4('0x6'));var logger=require(_0x05f4('0x7'))('rpc');var config=require(_0x05f4('0x8'));var jayson=require(_0x05f4('0x9'));var client=jayson[_0x05f4('0xa')][_0x05f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x274112,_0x7abac,_0x26b9dd){return new BPromise(function(_0x499464,_0x3022af){return client[_0x05f4('0xc')](_0x274112,_0x26b9dd)[_0x05f4('0xd')](function(_0x394b45){logger[_0x05f4('0xe')](_0x05f4('0xf'),_0x7abac,'request\x20sent');logger[_0x05f4('0x10')](_0x05f4('0x11'),_0x7abac,_0x05f4('0x12'),JSON[_0x05f4('0x13')](_0x394b45));if(_0x394b45[_0x05f4('0x14')]){if(_0x394b45['error'][_0x05f4('0x15')]===0x1f4){logger['error'](_0x05f4('0xf'),_0x7abac,_0x394b45[_0x05f4('0x14')]['message']);return _0x3022af(_0x394b45[_0x05f4('0x14')][_0x05f4('0x16')]);}logger['error']('Pause,\x20%s,\x20%s',_0x7abac,_0x394b45[_0x05f4('0x14')][_0x05f4('0x16')]);return _0x499464(_0x394b45[_0x05f4('0x14')][_0x05f4('0x16')]);}else{logger[_0x05f4('0xe')](_0x05f4('0xf'),_0x7abac,'request\x20sent');_0x499464(_0x394b45['result'][_0x05f4('0x16')]);}})['catch'](function(_0x2359fb){logger[_0x05f4('0x14')]('Pause,\x20%s,\x20%s',_0x7abac,_0x2359fb);_0x3022af(_0x2359fb);});});}exports['ShowPause']=function(_0x194683){var _0x377559=this;return new Promise(function(_0x475c0b,_0xd9b550){return db[_0x05f4('0x17')][_0x05f4('0x18')]({'raw':_0x194683['options']?_0x194683[_0x05f4('0x19')][_0x05f4('0x1a')]===undefined?!![]:![]:!![],'where':_0x194683[_0x05f4('0x19')]?_0x194683[_0x05f4('0x19')][_0x05f4('0x1b')]||null:null,'attributes':_0x194683[_0x05f4('0x19')]?_0x194683[_0x05f4('0x19')]['attributes']||null:null,'include':_0x194683[_0x05f4('0x19')]?_0x194683[_0x05f4('0x19')]['include']?_['map'](_0x194683['options'][_0x05f4('0x1c')],function(_0x602e98){return{'model':db[_0x602e98[_0x05f4('0x1d')]],'as':_0x602e98['as'],'attributes':_0x602e98[_0x05f4('0x1e')],'include':_0x602e98[_0x05f4('0x1c')]?_[_0x05f4('0x1f')](_0x602e98[_0x05f4('0x1c')],function(_0x2d6657){return{'model':db[_0x2d6657['model']],'as':_0x2d6657['as'],'attributes':_0x2d6657[_0x05f4('0x1e')],'include':_0x2d6657[_0x05f4('0x1c')]?_[_0x05f4('0x1f')](_0x2d6657['include'],function(_0x5c9be8){return{'model':db[_0x5c9be8[_0x05f4('0x1d')]],'as':_0x5c9be8['as'],'attributes':_0x5c9be8['attributes']};}):[]};}):[]};}):[]:[]})[_0x05f4('0xd')](function(_0xa45c5){logger[_0x05f4('0xe')](_0x05f4('0x20'),_0x194683);logger[_0x05f4('0x10')](_0x05f4('0x20'),_0x194683,JSON[_0x05f4('0x13')](_0xa45c5));_0x475c0b(_0xa45c5);})[_0x05f4('0x21')](function(_0x1633cc){logger[_0x05f4('0x14')](_0x05f4('0x20'),_0x1633cc[_0x05f4('0x16')],_0x194683);_0xd9b550(_0x377559[_0x05f4('0x14')](0x1f4,_0x1633cc['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 3ef4e2c..7276583 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 _0x3ad5=['multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','root','originalname','replace','format','%s-%s%s','basename','now','extname','single','file','update','delete'];(function(_0x2dfd2b,_0x522d82){var _0x3fda3a=function(_0x3d28ef){while(--_0x3d28ef){_0x2dfd2b['push'](_0x2dfd2b['shift']());}};_0x3fda3a(++_0x522d82);}(_0x3ad5,0x1b0));var _0x53ad=function(_0x1ef830,_0x2679ca){_0x1ef830=_0x1ef830-0x0;var _0x58910f=_0x3ad5[_0x1ef830];return _0x58910f;};'use strict';var multer=require(_0x53ad('0x0'));var util=require('util');var path=require(_0x53ad('0x1'));var timeout=require(_0x53ad('0x2'));var express=require('express');var router=express[_0x53ad('0x3')]();var fs_extra=require(_0x53ad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x53ad('0x5'));var config=require('../../config/environment');var controller=require(_0x53ad('0x6'));router[_0x53ad('0x7')]('/',auth[_0x53ad('0x8')](),controller['index']);router['get'](_0x53ad('0x9'),controller[_0x53ad('0xa')]);router[_0x53ad('0x7')](_0x53ad('0xb'),auth[_0x53ad('0x8')](),controller['show']);router[_0x53ad('0x7')](_0x53ad('0xc'),auth['isAuthenticated'](),controller[_0x53ad('0xd')]);var upload=multer({'storage':multer[_0x53ad('0xe')]({'destination':function(_0x5b2729,_0x2b85c4,_0x4476d6){_0x4476d6(null,path['join'](config[_0x53ad('0xf')],'server/files/plugins'));},'filename':function(_0x2f01e2,_0x25db73,_0x57fa65){_0x25db73[_0x53ad('0x10')]=_0x25db73[_0x53ad('0x10')][_0x53ad('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57fa65(null,util[_0x53ad('0x12')](_0x53ad('0x13'),path[_0x53ad('0x14')](_0x25db73[_0x53ad('0x10')],path['extname'](_0x25db73[_0x53ad('0x10')])),Date[_0x53ad('0x15')](),path[_0x53ad('0x16')](_0x25db73[_0x53ad('0x10')])));}})});router['post']('/',upload[_0x53ad('0x17')](_0x53ad('0x18')),controller['upload']);router['post'](_0x53ad('0x9'),controller['webhookPost']);router['put']('/:id',auth[_0x53ad('0x8')](),controller[_0x53ad('0x19')]);router[_0x53ad('0x1a')]('/:id',auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x731d=['originalname','replace','format','%s-%s%s','basename','extname','now','single','upload','post','webhookPost','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/webhook','webhookGet','/:id','isAuthenticated','/:id/download','download','diskStorage','join','root'];(function(_0x44f7e7,_0x4e60e0){var _0x1f228a=function(_0x52c765){while(--_0x52c765){_0x44f7e7['push'](_0x44f7e7['shift']());}};_0x1f228a(++_0x4e60e0);}(_0x731d,0x14a));var _0xd731=function(_0x20a3b2,_0x2e2ea7){_0x20a3b2=_0x20a3b2-0x0;var _0x2ea313=_0x731d[_0x20a3b2];return _0x2ea313;};'use strict';var multer=require(_0xd731('0x0'));var util=require('util');var path=require(_0xd731('0x1'));var timeout=require(_0xd731('0x2'));var express=require(_0xd731('0x3'));var router=express[_0xd731('0x4')]();var fs_extra=require(_0xd731('0x5'));var auth=require(_0xd731('0x6'));var interaction=require(_0xd731('0x7'));var config=require(_0xd731('0x8'));var controller=require('./plugin.controller');router[_0xd731('0x9')]('/',auth['isAuthenticated'](),controller[_0xd731('0xa')]);router['get'](_0xd731('0xb'),controller[_0xd731('0xc')]);router['get'](_0xd731('0xd'),auth[_0xd731('0xe')](),controller['show']);router[_0xd731('0x9')](_0xd731('0xf'),auth[_0xd731('0xe')](),controller[_0xd731('0x10')]);var upload=multer({'storage':multer[_0xd731('0x11')]({'destination':function(_0x2c7026,_0x2834a3,_0x52d5c6){_0x52d5c6(null,path[_0xd731('0x12')](config[_0xd731('0x13')],'server/files/plugins'));},'filename':function(_0x141c6a,_0x21123e,_0x480b86){_0x21123e['originalname']=_0x21123e[_0xd731('0x14')][_0xd731('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x480b86(null,util[_0xd731('0x16')](_0xd731('0x17'),path[_0xd731('0x18')](_0x21123e['originalname'],path[_0xd731('0x19')](_0x21123e[_0xd731('0x14')])),Date[_0xd731('0x1a')](),path[_0xd731('0x19')](_0x21123e[_0xd731('0x14')])));}})});router['post']('/',upload[_0xd731('0x1b')]('file'),controller[_0xd731('0x1c')]);router[_0xd731('0x1d')](_0xd731('0xb'),controller[_0xd731('0x1e')]);router[_0xd731('0x1f')](_0xd731('0xd'),auth[_0xd731('0xe')](),controller[_0xd731('0x20')]);router[_0xd731('0x21')](_0xd731('0xd'),auth[_0xd731('0xe')](),controller[_0xd731('0x21')]);module[_0xd731('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1973f19..905c9d1 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 _0x7bc9=['exports','html','TEXT','STRING','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x1d63ed,_0x402d6d){var _0x2f6c98=function(_0x2cc2ea){while(--_0x2cc2ea){_0x1d63ed['push'](_0x1d63ed['shift']());}};_0x2f6c98(++_0x402d6d);}(_0x7bc9,0x122));var _0x97bc=function(_0x31a40b,_0x343819){_0x31a40b=_0x31a40b-0x0;var _0x50f6a0=_0x7bc9[_0x31a40b];return _0x50f6a0;};'use strict';var Sequelize=require('sequelize');module[_0x97bc('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x97bc('0x1'),'script')},'description':{'type':Sequelize[_0x97bc('0x2')]},'version':{'type':Sequelize[_0x97bc('0x2')]},'path':{'type':Sequelize[_0x97bc('0x3')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x97bc('0x4')],'defaultValue':0x0,'comment':_0x97bc('0x5')},'sidebar':{'type':Sequelize['ENUM'](_0x97bc('0x6'),_0x97bc('0x7'),_0x97bc('0x8'),'never'),'defaultValue':'always','comment':_0x97bc('0x9')},'icon':{'type':Sequelize[_0x97bc('0x3')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x97bc('0x3')]},'scriptName':{'type':Sequelize[_0x97bc('0x3')]},'scriptPath':{'type':Sequelize[_0x97bc('0x3')]}}; \ No newline at end of file +var _0xbe78=['never','sequelize','exports','STRING','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly'];(function(_0x11c528,_0x46c26c){var _0x5f1094=function(_0x580cad){while(--_0x580cad){_0x11c528['push'](_0x11c528['shift']());}};_0x5f1094(++_0x46c26c);}(_0xbe78,0x65));var _0x8be7=function(_0x269e95,_0xd86ff3){_0x269e95=_0x269e95-0x0;var _0x11f59c=_0xbe78[_0x269e95];return _0x11f59c;};'use strict';var Sequelize=require(_0x8be7('0x0'));module[_0x8be7('0x1')]={'name':{'type':Sequelize[_0x8be7('0x2')]},'type':{'type':Sequelize[_0x8be7('0x3')](_0x8be7('0x4'),_0x8be7('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x8be7('0x2')],'comment':_0x8be7('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x8be7('0x3')](_0x8be7('0x7'),_0x8be7('0x8'),'always',_0x8be7('0x9')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x8be7('0x2')]},'adminUrl':{'type':Sequelize[_0x8be7('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x8be7('0x2')]},'scriptPath':{'type':Sequelize[_0x8be7('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 37e477a..7c455ce 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 _0x6aa7=['isDirectory','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','sidebar','always','icon-apps','test','agent','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','plugins','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','hostname','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./plugin.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','stack','name','send','merge','body','message','interaction','index','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','options','Plugin','includeAll','include','findAll','rows','catch','show','params','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile'];(function(_0x4d031f,_0x812441){var _0x108482=function(_0x5575bf){while(--_0x5575bf){_0x4d031f['push'](_0x4d031f['shift']());}};_0x108482(++_0x812441);}(_0x6aa7,0x178));var _0x76aa=function(_0x32eddb,_0x51f4c6){_0x32eddb=_0x32eddb-0x0;var _0x45b508=_0x6aa7[_0x32eddb];return _0x45b508;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var extract=require(_0x76aa('0xf'));var rimraf=require(_0x76aa('0x10'));var archiver=require(_0x76aa('0x11'));var Redis=require(_0x76aa('0x12'));var authService=require(_0x76aa('0x13'));var qs=require(_0x76aa('0x14'));var as=require(_0x76aa('0x15'));var hardwareService=require(_0x76aa('0x16'));var logger=require(_0x76aa('0x17'))(_0x76aa('0x18'));var utils=require('../../config/utils');var config=require(_0x76aa('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x76aa('0x1a'))['db'];config[_0x76aa('0x1b')]=_[_0x76aa('0x1c')](config[_0x76aa('0x1b')],{'host':_0x76aa('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x76aa('0x1e'))['register'](socket);function respondWithStatusCode(_0x180d92,_0x319bf1){_0x319bf1=_0x319bf1||0xcc;return function(_0x5cf594){if(_0x5cf594){return _0x180d92[_0x76aa('0x1f')](_0x319bf1);}return _0x180d92['status'](_0x319bf1)[_0x76aa('0x20')]();};}function respondWithResult(_0x5181d2,_0x1515e9){_0x1515e9=_0x1515e9||0xc8;return function(_0x413cf6){if(_0x413cf6){return _0x5181d2[_0x76aa('0x21')](_0x1515e9)[_0x76aa('0x22')](_0x413cf6);}};}function respondWithFilteredResult(_0xa1bc7,_0x3ead3f){return function(_0x496902){if(_0x496902){var _0x5d6202=typeof _0x3ead3f[_0x76aa('0x23')]===_0x76aa('0x24')&&typeof _0x3ead3f[_0x76aa('0x25')]===_0x76aa('0x24');var _0x15109b=_0x496902[_0x76aa('0x26')];var _0x19af92=_0x5d6202?0x0:_0x3ead3f[_0x76aa('0x23')];var _0x385157=_0x5d6202?_0x496902['count']:_0x3ead3f[_0x76aa('0x23')]+_0x3ead3f[_0x76aa('0x25')];var _0x338a6b;if(_0x385157>=_0x15109b){_0x385157=_0x15109b;_0x338a6b=0xc8;}else{_0x338a6b=0xce;}_0xa1bc7['status'](_0x338a6b);return _0xa1bc7[_0x76aa('0x27')](_0x76aa('0x28'),_0x19af92+'-'+_0x385157+'/'+_0x15109b)[_0x76aa('0x22')](_0x496902);}return null;};}function patchUpdates(_0x2bd2c6){return function(_0x29c50c){try{jsonpatch[_0x76aa('0x29')](_0x29c50c,_0x2bd2c6,!![]);}catch(_0x3cd039){return BPromise[_0x76aa('0x2a')](_0x3cd039);}return _0x29c50c[_0x76aa('0x2b')]();};}function saveUpdates(_0x2cba6d,_0x37f1ab){return function(_0x26b75e){if(_0x26b75e){return _0x26b75e[_0x76aa('0x2c')](_0x2cba6d)['then'](function(_0xb5e8a9){return _0xb5e8a9;});}return null;};}function removeEntity(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){return _0x2e7ab4[_0x76aa('0x2d')]()[_0x76aa('0x2e')](function(){var _0x25a803=_0x2e7ab4[_0x76aa('0x2f')]({'plain':!![]});var _0xd12a99=_0x76aa('0x30');return db['UserProfileResource'][_0x76aa('0x2d')]({'where':{'type':_0xd12a99,'resourceId':_0x25a803['id']}})['then'](function(){return _0x2e7ab4;});})[_0x76aa('0x2e')](function(){_0x1d6d15[_0x76aa('0x21')](0xcc)[_0x76aa('0x20')]();});}};}function handleEntityNotFound(_0x1e90b9,_0x1eecd9){return function(_0x2d6213){if(!_0x2d6213){_0x1e90b9[_0x76aa('0x1f')](0x194);}return _0x2d6213;};}function handleError(_0x3827ec,_0x19fd4f){_0x19fd4f=_0x19fd4f||0x1f4;return function(_0x3ea05a){logger['error'](_0x3ea05a[_0x76aa('0x31')]);if(_0x3ea05a[_0x76aa('0x32')]){delete _0x3ea05a[_0x76aa('0x32')];}_0x3827ec[_0x76aa('0x21')](_0x19fd4f)[_0x76aa('0x33')](_0x3ea05a);};}function getMustacheRender(_0x38ecd1,_0x35a705){return Mustache['render'](_0x38ecd1,_[_0x76aa('0x34')](_0x35a705[_0x76aa('0x35')],{'contact':_0x35a705['contact'],'message':_0x35a705[_0x76aa('0x36')],'agent':_0x35a705['agent'],'interaction':_0x35a705[_0x76aa('0x37')],'account':_0x35a705['account']}))||'';}exports[_0x76aa('0x38')]=function(_0x5653e0,_0x58f135){var _0x1aa182={},_0x282c56={},_0x198fcb={'count':0x0,'rows':[]};var _0x37dfab=_['map'](db['Plugin'][_0x76aa('0x39')],function(_0x1c7b6f){return{'name':_0x1c7b6f[_0x76aa('0x3a')],'type':_0x1c7b6f[_0x76aa('0x3b')][_0x76aa('0x3c')]};});_0x282c56['model']=_[_0x76aa('0x3d')](_0x37dfab,'name');_0x282c56['query']=_[_0x76aa('0x3e')](_0x5653e0[_0x76aa('0x3f')]);_0x282c56[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x282c56['model'],_0x282c56[_0x76aa('0x3f')]);_0x1aa182[_0x76aa('0x42')]=_[_0x76aa('0x41')](_0x282c56['model'],qs[_0x76aa('0x43')](_0x5653e0[_0x76aa('0x3f')][_0x76aa('0x43')]));_0x1aa182[_0x76aa('0x42')]=_0x1aa182[_0x76aa('0x42')][_0x76aa('0x44')]?_0x1aa182[_0x76aa('0x42')]:_0x282c56[_0x76aa('0x45')];if(!_0x5653e0[_0x76aa('0x3f')]['hasOwnProperty'](_0x76aa('0x46'))){_0x1aa182[_0x76aa('0x25')]=qs[_0x76aa('0x25')](_0x5653e0[_0x76aa('0x3f')][_0x76aa('0x25')]);_0x1aa182[_0x76aa('0x23')]=qs['offset'](_0x5653e0['query'][_0x76aa('0x23')]);}_0x1aa182[_0x76aa('0x47')]=qs[_0x76aa('0x48')](_0x5653e0[_0x76aa('0x3f')]['sort']);_0x1aa182[_0x76aa('0x49')]=qs[_0x76aa('0x40')](_[_0x76aa('0x4a')](_0x5653e0[_0x76aa('0x3f')],_0x282c56[_0x76aa('0x40')]),_0x37dfab);if(_0x5653e0['query'][_0x76aa('0x4b')]){_0x1aa182['where']=_[_0x76aa('0x34')](_0x1aa182['where'],{'$or':_['map'](_0x37dfab,function(_0x4f7f3a){if(_0x4f7f3a[_0x76aa('0x3b')]!=='VIRTUAL'){var _0x5cf314={};_0x5cf314[_0x4f7f3a['name']]={'$like':'%'+_0x5653e0[_0x76aa('0x3f')][_0x76aa('0x4b')]+'%'};return _0x5cf314;}})});}_0x1aa182=_[_0x76aa('0x34')]({},_0x1aa182,_0x5653e0[_0x76aa('0x4c')]);var _0x27a52e={'where':_0x1aa182['where']};return db[_0x76aa('0x4d')][_0x76aa('0x26')](_0x27a52e)[_0x76aa('0x2e')](function(_0x2d6b7f){_0x198fcb[_0x76aa('0x26')]=_0x2d6b7f;if(_0x5653e0['query'][_0x76aa('0x4e')]){_0x1aa182[_0x76aa('0x4f')]=[{'all':!![]}];}return db['Plugin'][_0x76aa('0x50')](_0x1aa182);})['then'](function(_0x3aa858){_0x198fcb[_0x76aa('0x51')]=_0x3aa858;return _0x198fcb;})[_0x76aa('0x2e')](respondWithFilteredResult(_0x58f135,_0x1aa182))[_0x76aa('0x52')](handleError(_0x58f135,null));};exports[_0x76aa('0x53')]=function(_0x3e0315,_0x2e229d){var _0x165858={'raw':!![],'where':{'id':_0x3e0315[_0x76aa('0x54')]['id']}},_0xb8d052={};_0xb8d052['model']=_[_0x76aa('0x3e')](db['Plugin'][_0x76aa('0x39')]);_0xb8d052[_0x76aa('0x3f')]=_[_0x76aa('0x3e')](_0x3e0315[_0x76aa('0x3f')]);_0xb8d052['filters']=_['intersection'](_0xb8d052[_0x76aa('0x45')],_0xb8d052['query']);_0x165858[_0x76aa('0x42')]=_[_0x76aa('0x41')](_0xb8d052[_0x76aa('0x45')],qs[_0x76aa('0x43')](_0x3e0315[_0x76aa('0x3f')][_0x76aa('0x43')]));_0x165858['attributes']=_0x165858['attributes'][_0x76aa('0x44')]?_0x165858[_0x76aa('0x42')]:_0xb8d052[_0x76aa('0x45')];if(_0x3e0315[_0x76aa('0x3f')][_0x76aa('0x4e')]){_0x165858[_0x76aa('0x4f')]=[{'all':!![]}];}_0x165858=_['merge']({},_0x165858,_0x3e0315[_0x76aa('0x4c')]);return db[_0x76aa('0x4d')][_0x76aa('0x55')](_0x165858)['then'](handleEntityNotFound(_0x2e229d,null))[_0x76aa('0x2e')](respondWithResult(_0x2e229d,null))['catch'](handleError(_0x2e229d,null));};exports[_0x76aa('0x56')]=function(_0x5e1d84,_0x339b0d,_0x4449c1){return db[_0x76aa('0x4d')][_0x76aa('0x55')]({'where':{'id':_0x5e1d84[_0x76aa('0x54')]['id']},'attributes':[_0x76aa('0x32'),_0x76aa('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x339b0d,null))[_0x76aa('0x2e')](function(_0x5eeaa5){if(_0x5eeaa5){var _0x3ee32=path[_0x76aa('0x57')](config[_0x76aa('0x58')],_0x76aa('0x59'),util[_0x76aa('0x5a')](_0x76aa('0x5b'),path[_0x76aa('0x5c')](_0x5eeaa5['path'])));var _0x333a3a=fs[_0x76aa('0x5d')](_0x3ee32);var _0x27fc84=archiver(_0x76aa('0x5e'),{'zlib':{'level':0x9}});_0x27fc84['on']('warning',function(_0xb9401b){if(_0xb9401b[_0x76aa('0x5f')]===_0x76aa('0x60')){logger[_0x76aa('0x61')](_0xb9401b);}else{throw new db[(_0x76aa('0x62'))][(_0x76aa('0x63'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x27fc84['on'](_0x76aa('0x61'),function(_0xbf78c7){throw new db[(_0x76aa('0x62'))][(_0x76aa('0x63'))](_0x76aa('0x64'));});_0x27fc84[_0x76aa('0x65')](_0x333a3a);_0x27fc84[_0x76aa('0x66')]('**/*',{'cwd':path['join'](config[_0x76aa('0x58')],_0x76aa('0x59'),path['dirname'](_0x5eeaa5[_0x76aa('0x7')])),'ignore':[path[_0x76aa('0x57')](path['basename'](_0x5eeaa5[_0x76aa('0x7')]),_0x76aa('0x67')),path[_0x76aa('0x57')](path[_0x76aa('0x5c')](_0x5eeaa5[_0x76aa('0x7')]),_0x76aa('0x68'))],'nodir':!![]})[_0x76aa('0x69')]();_0x333a3a['on'](_0x76aa('0x6a'),function(){if(!fs[_0x76aa('0x6b')](_0x3ee32)){throw new db['Sequelize'][(_0x76aa('0x63'))]('Plugin\x20not\x20found');}return _0x339b0d[_0x76aa('0x56')](_0x3ee32,util[_0x76aa('0x5a')](_0x76aa('0x5b'),path[_0x76aa('0x5c')](_0x5eeaa5[_0x76aa('0x7')])),function(_0x260ad2){if(_0x260ad2){throw new db[(_0x76aa('0x62'))][(_0x76aa('0x63'))](_0x76aa('0x6c'));}fs['unlinkSync'](_0x3ee32);logger[_0x76aa('0x6d')](_0x76aa('0x6e'));logger[_0x76aa('0x6d')](_0x76aa('0x6f'));});});}return null;})[_0x76aa('0x52')](handleError(_0x339b0d,null));};exports[_0x76aa('0x70')]=function(_0x3d6d10,_0x157540,_0x5546b6){var _0x364d05=path['basename'](_0x3d6d10[_0x76aa('0x71')][_0x76aa('0x72')],path[_0x76aa('0x73')](_0x3d6d10[_0x76aa('0x71')][_0x76aa('0x72')]));var _0x234dc4=path[_0x76aa('0x57')](config['root'],_0x76aa('0x59'),_0x3d6d10[_0x76aa('0x71')]['filename']);var _0x54334b=path[_0x76aa('0x57')](config[_0x76aa('0x58')],'server/files/plugins',_0x364d05);logger[_0x76aa('0x6d')](_0x76aa('0x74'),_0x234dc4);logger[_0x76aa('0x6d')]('Plugin\x20upload\x20destination:\x20%s',_0x54334b);try{fs[_0x76aa('0x75')](_0x234dc4,parseInt('0777',0x8));extract(_0x234dc4,{'dir':_0x54334b},function(_0xf31e1f){if(_0xf31e1f){logger[_0x76aa('0x61')](_0xf31e1f);handleError(_0xf31e1f,!![]);};var _0x2315cf=fs[_0x76aa('0x76')](_0x54334b);if(_0x2315cf['length']>0x1){removeReferences(_0x234dc4,_0x54334b);logger['error'](_0x76aa('0x77'));return _0x5546b6(new Error('Invalid\x20plugin\x20structure'));}var _0x2a8fd3=fs[_0x76aa('0x78')](path[_0x76aa('0x57')](_0x54334b,_0x2315cf[0x0]));if(_0x2a8fd3[_0x76aa('0x79')]()){removeReferences(_0x234dc4,_0x54334b);logger[_0x76aa('0x61')](_0x76aa('0x77'));return _0x5546b6(new Error(_0x76aa('0x77')));}if(_0x2a8fd3[_0x76aa('0x7a')]()){var _0xa19c1c=fs['readdirSync'](path[_0x76aa('0x57')](_0x54334b,_0x2315cf[0x0]));if(_0xa19c1c[_0x76aa('0x44')]===0x0){removeReferences(_0x234dc4,_0x54334b);logger[_0x76aa('0x61')](_0x76aa('0x77'));return _0x5546b6(new Error('Invalid\x20plugin\x20structure'));}var _0x4c0af4=_0xa19c1c['some'](function(_0x1a01ac){return _0x1a01ac==='manifest.json';});if(!_0x4c0af4){return _0x5546b6(new Error(_0x76aa('0x7b')));}var _0x256195=fs[_0x76aa('0x7c')](path[_0x76aa('0x57')](_0x54334b,_0x2315cf[0x0],'manifest.json'));var _0x7eb34e=JSON['parse'](_0x256195);if(_0x76aa('0x24')==typeof _0x7eb34e[_0x76aa('0x32')]){return _0x5546b6(new Error(_0x76aa('0x7d')));}if(_0x76aa('0x24')==typeof _0x7eb34e[_0x76aa('0x3b')]){return _0x5546b6(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x76aa('0x24')==typeof _0x7eb34e[_0x76aa('0x7e')]){return _0x5546b6(new Error(_0x76aa('0x7f')));}if(_0x76aa('0x24')==typeof _0x7eb34e[_0x76aa('0x80')]){return _0x5546b6(new Error(_0x76aa('0x81')));}if(_0x7eb34e[_0x76aa('0x3b')]===_0x76aa('0x82')){if('undefined'==typeof _0x7eb34e[_0x76aa('0x80')][_0x76aa('0x83')]){return _0x5546b6(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x76aa('0x24')==typeof _0x7eb34e[_0x76aa('0x80')][_0x76aa('0x83')][_0x76aa('0x84')]&&_0x76aa('0x24')==typeof _0x7eb34e[_0x76aa('0x80')][_0x76aa('0x83')]['agent']){return _0x5546b6(new Error(_0x76aa('0x85')));}}else if(_0x7eb34e['type']==='script'){if(_0x76aa('0x24')==typeof _0x7eb34e[_0x76aa('0x80')]['scriptName']){return _0x5546b6(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x76aa('0x24')==typeof _0x7eb34e[_0x76aa('0x80')][_0x76aa('0x86')]){return _0x5546b6(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x5546b6(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x17efc6=_0x7eb34e[_0x76aa('0x32')];var _0x2e55ac=_0x7eb34e['description'];var _0xb70589=_0x7eb34e['type'];var _0x521bae=_0x7eb34e[_0x76aa('0x87')]?_0x7eb34e[_0x76aa('0x87')]:_0x76aa('0x88');var _0x1e539f=_0x7eb34e['icon']?_0x7eb34e['icon']:_0x76aa('0x89');var _0x272a28='';var _0x19ebb7='';var _0x5080ea='';var _0x424638='';var _0x3b6e44=_0x7eb34e[_0x76aa('0x7e')];if(_0xb70589===_0x76aa('0x82')){if(_0x76aa('0x24')!=typeof _0x7eb34e['parameters'][_0x76aa('0x83')]['admin']){var _0x52d5ce=_0x7eb34e[_0x76aa('0x80')][_0x76aa('0x83')][_0x76aa('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x76aa('0x8a')](_0x52d5ce)){_0x272a28=path[_0x76aa('0x57')]('plugins',_0x364d05,_0x2315cf[0x0],_0x52d5ce);}else{_0x272a28=_0x52d5ce;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x7eb34e['parameters'][_0x76aa('0x83')][_0x76aa('0x8b')]){var _0x211df5=_0x7eb34e['parameters']['views'][_0x76aa('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x76aa('0x8a')](_0x211df5)){_0x19ebb7=path[_0x76aa('0x57')]('plugins',_0x364d05,_0x2315cf[0x0],_0x211df5);}else{_0x19ebb7=_0x211df5;}}else{logger['info'](_0x76aa('0x8c'));}}else if(_0xb70589===_0x76aa('0x8d')){_0x5080ea=_0x7eb34e[_0x76aa('0x80')][_0x76aa('0x8e')];_0x424638=_0x7eb34e[_0x76aa('0x80')]['scriptPath'];if('undefined'!=typeof _0x7eb34e[_0x76aa('0x80')]['views']){if('undefined'!=typeof _0x7eb34e['parameters'][_0x76aa('0x83')][_0x76aa('0x84')]){var _0x52d5ce=_0x7eb34e[_0x76aa('0x80')][_0x76aa('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x76aa('0x8a')](_0x52d5ce)){_0x272a28=path[_0x76aa('0x57')](_0x76aa('0x8f'),_0x364d05,_0x2315cf[0x0],_0x52d5ce);}else{_0x272a28=_0x52d5ce;}}if(_0x76aa('0x24')!=typeof _0x7eb34e[_0x76aa('0x80')][_0x76aa('0x83')][_0x76aa('0x8b')]){var _0x211df5=_0x7eb34e[_0x76aa('0x80')]['views'][_0x76aa('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x76aa('0x8a')](_0x211df5)){_0x19ebb7=path['join'](_0x76aa('0x8f'),_0x364d05,_0x2315cf[0x0],_0x211df5);}else{_0x19ebb7=_0x211df5;}}}}var _0x1b68de={'name':_0x17efc6,'description':_0x2e55ac,'path':path[_0x76aa('0x57')](_0x364d05,_0x2315cf[0x0]),'type':_0xb70589,'sidebar':_0x521bae,'icon':_0x1e539f,'adminUrl':_0x272a28,'agentUrl':_0x19ebb7,'scriptName':_0x5080ea,'scriptPath':_0x424638,'version':_0x3b6e44};removeReferences(_0x234dc4,null);return db['Plugin'][_0x76aa('0x90')](_0x1b68de)[_0x76aa('0x2e')](function(_0x4df4e0){var _0xa0ac6a={'role':_0x3d6d10[_0x76aa('0x35')][_0x76aa('0x91')],'userProfileId':_0x3d6d10['body'][_0x76aa('0x92')]};if(!_0xa0ac6a)throw new Error(_0x76aa('0x93'));if(_0xa0ac6a['role']==='user'){var _0x5941a5=_0x4df4e0[_0x76aa('0x2f')]({'plain':!![]});return db[_0x76aa('0x94')][_0x76aa('0x55')]({'where':{'name':_0x76aa('0x30'),'userProfileId':_0xa0ac6a['userProfileId']},'raw':!![]})['then'](function(_0x4a449c){if(_0x4a449c&&_0x4a449c[_0x76aa('0x95')]===0x0){return db['UserProfileResource'][_0x76aa('0x90')]({'name':_0x5941a5[_0x76aa('0x32')],'resourceId':_0x5941a5['id'],'type':_0x4a449c['name'],'sectionId':_0x4a449c['id']},{})[_0x76aa('0x2e')](function(){return _0x4df4e0;});}else{return _0x4df4e0;}})[_0x76aa('0x52')](function(_0x516f80){logger[_0x76aa('0x61')](_0x76aa('0x96'),_0x516f80);throw _0x516f80;});}return _0x4df4e0;})[_0x76aa('0x2e')](respondWithResult(_0x157540,null))[_0x76aa('0x52')](handleError(_0x157540,null));}});}catch(_0x1f00d7){_0x157540[_0x76aa('0x21')](0x1f4)['send'](_0x1f00d7);}};function removeReferences(_0x37d4f6,_0x4f5ded){try{if(_0x37d4f6){fs['unlinkSync'](_0x37d4f6);logger['info']('Zip\x20archive\x20removed');}if(_0x4f5ded){rimraf(_0x4f5ded,function(){});logger['info'](_0x76aa('0x97'));}}catch(_0x11f59f){logger[_0x76aa('0x61')](_0x11f59f);}}exports[_0x76aa('0x2c')]=function(_0x47c0de,_0x447103,_0x2192ed){return db[_0x76aa('0x4d')][_0x76aa('0x55')]({'where':{'id':_0x47c0de[_0x76aa('0x54')]['id']}})['then'](handleEntityNotFound(_0x447103,null))[_0x76aa('0x2e')](saveUpdates(_0x47c0de[_0x76aa('0x35')],null))[_0x76aa('0x2e')](respondWithResult(_0x447103,null))[_0x76aa('0x52')](handleError(_0x447103,null));};exports[_0x76aa('0x98')]=function(_0x40f4a3,_0x31bb82,_0x5aef82){return db[_0x76aa('0x4d')][_0x76aa('0x55')]({'where':{'id':_0x40f4a3['params']['id']}})['then'](function(_0x216e87){if(_0x216e87){return _0x216e87[_0x76aa('0x2d')]();}})['then'](function(_0x7fd982){rimraf(path['join'](config[_0x76aa('0x58')],'server/files/plugins',path[_0x76aa('0x99')](_0x7fd982[_0x76aa('0x7')])),function(){});return _0x7fd982;})[_0x76aa('0x2e')](handleEntityNotFound(_0x31bb82,null))[_0x76aa('0x2e')](respondWithStatusCode(_0x31bb82,null))[_0x76aa('0x52')](handleError(_0x31bb82,null));};exports['webhookGet']=function(_0x1db650,_0x54bfd7,_0x1af32e){return BPromise[_0x76aa('0x9a')]()['then'](function(){if(!_0x1db650['query'][_0x76aa('0x7')]){throw new Error(_0x76aa('0x9b'));}if(!_0x1db650[_0x76aa('0x3f')][_0x76aa('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5a1577=_0x1db650[_0x76aa('0x3f')]['hostname']?_0x1db650[_0x76aa('0x3f')]['hostname']+':'+_0x1db650[_0x76aa('0x3f')][_0x76aa('0x9c')]:'http://localhost:'+_0x1db650[_0x76aa('0x3f')]['port'];var _0x57d526=_0x1db650[_0x76aa('0x3f')][_0x76aa('0x22')]?_0x1db650['query'][_0x76aa('0x22')]:!![];var _0x84cf1=_0x1db650[_0x76aa('0x3f')]['encoding']?_0x1db650[_0x76aa('0x3f')][_0x76aa('0x9d')]:null;var _0x20a0a2={'method':_0x1db650[_0x76aa('0x9e')],'uri':util[_0x76aa('0x5a')](_0x76aa('0x9f'),_0x5a1577,_0x1db650[_0x76aa('0x3f')][_0x76aa('0x7')]),'json':_0x57d526,'resolveWithFullResponse':!![],'encoding':_0x84cf1,'qs':_0x1db650[_0x76aa('0x3f')]};if(_0x1db650[_0x76aa('0xa0')]){_0x20a0a2[_0x76aa('0xa0')]=_0x1db650[_0x76aa('0xa0')];if(_0x20a0a2['headers'][_0x76aa('0xa1')]){delete _0x20a0a2[_0x76aa('0xa0')]['content-length'];}}if(_0x20a0a2[_0x76aa('0xa0')][_0x76aa('0xa2')]){delete _0x20a0a2['headers']['content-type'];}return rp(_0x20a0a2);})[_0x76aa('0x2e')](function(_0x3ba3aa){if(_0x3ba3aa){_0x54bfd7['set'](_0x3ba3aa[_0x76aa('0xa0')]);logger[_0x76aa('0x6d')](_0x3ba3aa[_0x76aa('0x35')]);if(_['endsWith'](_0x1db650[_0x76aa('0x3f')][_0x76aa('0x7')],'download')&&_0x3ba3aa[_0x76aa('0xa3')]==0x1f4){return _0x54bfd7[_0x76aa('0x1f')](_0x3ba3aa[_0x76aa('0xa3')]);}else{return _0x54bfd7[_0x76aa('0x21')](_0x3ba3aa[_0x76aa('0xa3')])[_0x76aa('0x33')](_0x3ba3aa['body']);}}else{return _0x54bfd7[_0x76aa('0x1f')](0xc8);}})['catch'](handleError(_0x54bfd7,null));};exports[_0x76aa('0xa4')]=function(_0x2d29db,_0x1f26b4,_0x5e7842){return BPromise['resolve']()[_0x76aa('0x2e')](function(){if(!_0x2d29db[_0x76aa('0x3f')][_0x76aa('0x7')]){throw new Error(_0x76aa('0x9b'));}if(!_0x2d29db[_0x76aa('0x3f')][_0x76aa('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5a4c03=_0x2d29db[_0x76aa('0x3f')][_0x76aa('0xa5')]?_0x2d29db[_0x76aa('0x3f')][_0x76aa('0xa5')]+':'+_0x2d29db['query'][_0x76aa('0x9c')]:'http://localhost:'+_0x2d29db['query'][_0x76aa('0x9c')];var _0x786a76=_0x2d29db[_0x76aa('0x3f')]['json']?_0x2d29db[_0x76aa('0x3f')][_0x76aa('0x22')]:!![];var _0x2abcef=_0x2d29db[_0x76aa('0x3f')][_0x76aa('0x9d')]?_0x2d29db[_0x76aa('0x3f')][_0x76aa('0x9d')]:null;var _0x55775d={'method':_0x2d29db[_0x76aa('0x9e')],'uri':util[_0x76aa('0x5a')](_0x76aa('0x9f'),_0x5a4c03,_0x2d29db[_0x76aa('0x3f')][_0x76aa('0x7')]),'json':_0x786a76,'resolveWithFullResponse':!![],'encoding':_0x2abcef,'body':_0x2d29db[_0x76aa('0x35')]};if(_0x2d29db['headers']){_0x55775d[_0x76aa('0xa0')]=_0x2d29db[_0x76aa('0xa0')];if(_0x55775d[_0x76aa('0xa0')][_0x76aa('0xa1')]){delete _0x55775d['headers'][_0x76aa('0xa1')];}}if(_0x55775d[_0x76aa('0xa0')][_0x76aa('0xa2')]){delete _0x55775d[_0x76aa('0xa0')][_0x76aa('0xa2')];}return rp(_0x55775d);})['then'](function(_0x203bc2){if(_0x203bc2){_0x1f26b4[_0x76aa('0x27')](_0x203bc2['headers']);logger['info'](_0x203bc2[_0x76aa('0x35')]);return _0x1f26b4[_0x76aa('0x21')](_0x203bc2[_0x76aa('0xa3')])[_0x76aa('0x33')](_0x203bc2[_0x76aa('0x35')]);}else{return _0x1f26b4[_0x76aa('0x1f')](0xc8);}})['catch'](handleError(_0x1f26b4,null));}; \ No newline at end of file +var _0x34e8=['body','contact','message','agent','interaction','account','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','options','Plugin','includeAll','include','findAll','catch','params','rawAttributes','length','find','download','join','server/files/plugins','%s.zip','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','root','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','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','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','description','sidebar','icon','icon-apps','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','script','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','delete','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','set','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','content-type','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','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./plugin.socket','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','get','error','stack','name','render','merge'];(function(_0x49426a,_0x1c3d82){var _0x6a108a=function(_0x144621){while(--_0x144621){_0x49426a['push'](_0x49426a['shift']());}};_0x6a108a(++_0x1c3d82);}(_0x34e8,0x12c));var _0x834e=function(_0x16288b,_0x1aeb9b){_0x16288b=_0x16288b-0x0;var _0x1373fa=_0x34e8[_0x16288b];return _0x1373fa;};'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 extract=require(_0x834e('0x12'));var rimraf=require(_0x834e('0x1'));var archiver=require(_0x834e('0x13'));var Redis=require(_0x834e('0x14'));var authService=require(_0x834e('0x15'));var qs=require(_0x834e('0x16'));var as=require(_0x834e('0x17'));var hardwareService=require(_0x834e('0x18'));var logger=require(_0x834e('0x19'))(_0x834e('0x1a'));var utils=require('../../config/utils');var config=require(_0x834e('0x1b'));var licenseUtil=require(_0x834e('0x1c'));var db=require('../../mysqldb')['db'];config[_0x834e('0x1d')]=_[_0x834e('0x1e')](config[_0x834e('0x1d')],{'host':_0x834e('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x834e('0x1d')]));require(_0x834e('0x20'))['register'](socket);function respondWithStatusCode(_0x316205,_0x4a9cdc){_0x4a9cdc=_0x4a9cdc||0xcc;return function(_0x38a8cd){if(_0x38a8cd){return _0x316205[_0x834e('0x21')](_0x4a9cdc);}return _0x316205['status'](_0x4a9cdc)[_0x834e('0x22')]();};}function respondWithResult(_0x22106e,_0x370fb5){_0x370fb5=_0x370fb5||0xc8;return function(_0x50b3f6){if(_0x50b3f6){return _0x22106e[_0x834e('0x23')](_0x370fb5)[_0x834e('0x24')](_0x50b3f6);}};}function respondWithFilteredResult(_0x34e41a,_0xb993a1){return function(_0x237947){if(_0x237947){var _0x254677=typeof _0xb993a1[_0x834e('0x25')]==='undefined'&&typeof _0xb993a1[_0x834e('0x26')]===_0x834e('0x27');var _0x113ff4=_0x237947[_0x834e('0x28')];var _0x4ab05d=_0x254677?0x0:_0xb993a1[_0x834e('0x25')];var _0x62f8f1=_0x254677?_0x237947['count']:_0xb993a1[_0x834e('0x25')]+_0xb993a1[_0x834e('0x26')];var _0x8d406e;if(_0x62f8f1>=_0x113ff4){_0x62f8f1=_0x113ff4;_0x8d406e=0xc8;}else{_0x8d406e=0xce;}_0x34e41a['status'](_0x8d406e);return _0x34e41a['set'](_0x834e('0x29'),_0x4ab05d+'-'+_0x62f8f1+'/'+_0x113ff4)[_0x834e('0x24')](_0x237947);}return null;};}function patchUpdates(_0x589dde){return function(_0x25ee1d){try{jsonpatch[_0x834e('0x2a')](_0x25ee1d,_0x589dde,!![]);}catch(_0x58f4fd){return BPromise[_0x834e('0x2b')](_0x58f4fd);}return _0x25ee1d[_0x834e('0x2c')]();};}function saveUpdates(_0x338636,_0x561cd2){return function(_0x24fcf7){if(_0x24fcf7){return _0x24fcf7[_0x834e('0x2d')](_0x338636)['then'](function(_0x5bef62){return _0x5bef62;});}return null;};}function removeEntity(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){return _0x2826ec[_0x834e('0x2e')]()[_0x834e('0x2f')](function(){var _0x2cc2eb=_0x2826ec[_0x834e('0x30')]({'plain':!![]});var _0x130cc5='Plugins';return db['UserProfileResource']['destroy']({'where':{'type':_0x130cc5,'resourceId':_0x2cc2eb['id']}})['then'](function(){return _0x2826ec;});})[_0x834e('0x2f')](function(){_0x1e713a[_0x834e('0x23')](0xcc)[_0x834e('0x22')]();});}};}function handleEntityNotFound(_0x5dacc1,_0xb5bc06){return function(_0x11f1ce){if(!_0x11f1ce){_0x5dacc1[_0x834e('0x21')](0x194);}return _0x11f1ce;};}function handleError(_0x1e026a,_0x4551f5){_0x4551f5=_0x4551f5||0x1f4;return function(_0x390119){logger[_0x834e('0x31')](_0x390119[_0x834e('0x32')]);if(_0x390119[_0x834e('0x33')]){delete _0x390119['name'];}_0x1e026a[_0x834e('0x23')](_0x4551f5)['send'](_0x390119);};}function getMustacheRender(_0x2c75c2,_0x3787b0){return Mustache[_0x834e('0x34')](_0x2c75c2,_[_0x834e('0x35')](_0x3787b0[_0x834e('0x36')],{'contact':_0x3787b0[_0x834e('0x37')],'message':_0x3787b0[_0x834e('0x38')],'agent':_0x3787b0[_0x834e('0x39')],'interaction':_0x3787b0[_0x834e('0x3a')],'account':_0x3787b0[_0x834e('0x3b')]}))||'';}exports['index']=function(_0x2a3c7f,_0x2f408a){var _0x24a9df={},_0xaf01f4={},_0x595cc0={'count':0x0,'rows':[]};var _0x3f88ad=_[_0x834e('0x3c')](db['Plugin']['rawAttributes'],function(_0x59385a){return{'name':_0x59385a[_0x834e('0x3d')],'type':_0x59385a[_0x834e('0x3e')][_0x834e('0x3f')]};});_0xaf01f4[_0x834e('0x40')]=_[_0x834e('0x3c')](_0x3f88ad,_0x834e('0x33'));_0xaf01f4['query']=_[_0x834e('0x41')](_0x2a3c7f['query']);_0xaf01f4[_0x834e('0x42')]=_[_0x834e('0x43')](_0xaf01f4['model'],_0xaf01f4[_0x834e('0x44')]);_0x24a9df[_0x834e('0x45')]=_['intersection'](_0xaf01f4['model'],qs[_0x834e('0x46')](_0x2a3c7f[_0x834e('0x44')][_0x834e('0x46')]));_0x24a9df[_0x834e('0x45')]=_0x24a9df[_0x834e('0x45')]['length']?_0x24a9df[_0x834e('0x45')]:_0xaf01f4['model'];if(!_0x2a3c7f['query'][_0x834e('0x47')]('nolimit')){_0x24a9df[_0x834e('0x26')]=qs[_0x834e('0x26')](_0x2a3c7f[_0x834e('0x44')][_0x834e('0x26')]);_0x24a9df[_0x834e('0x25')]=qs['offset'](_0x2a3c7f[_0x834e('0x44')][_0x834e('0x25')]);}_0x24a9df[_0x834e('0x48')]=qs['sort'](_0x2a3c7f[_0x834e('0x44')][_0x834e('0x49')]);_0x24a9df['where']=qs[_0x834e('0x42')](_['pick'](_0x2a3c7f[_0x834e('0x44')],_0xaf01f4[_0x834e('0x42')]),_0x3f88ad);if(_0x2a3c7f['query']['filter']){_0x24a9df[_0x834e('0x4a')]=_[_0x834e('0x35')](_0x24a9df[_0x834e('0x4a')],{'$or':_[_0x834e('0x3c')](_0x3f88ad,function(_0x8ad264){if(_0x8ad264[_0x834e('0x3e')]!==_0x834e('0x4b')){var _0x4a3381={};_0x4a3381[_0x8ad264[_0x834e('0x33')]]={'$like':'%'+_0x2a3c7f['query'][_0x834e('0x4c')]+'%'};return _0x4a3381;}})});}_0x24a9df=_['merge']({},_0x24a9df,_0x2a3c7f[_0x834e('0x4d')]);var _0x5a5807={'where':_0x24a9df[_0x834e('0x4a')]};return db[_0x834e('0x4e')]['count'](_0x5a5807)[_0x834e('0x2f')](function(_0x3f2321){_0x595cc0[_0x834e('0x28')]=_0x3f2321;if(_0x2a3c7f[_0x834e('0x44')][_0x834e('0x4f')]){_0x24a9df[_0x834e('0x50')]=[{'all':!![]}];}return db[_0x834e('0x4e')][_0x834e('0x51')](_0x24a9df);})[_0x834e('0x2f')](function(_0x279ea1){_0x595cc0['rows']=_0x279ea1;return _0x595cc0;})[_0x834e('0x2f')](respondWithFilteredResult(_0x2f408a,_0x24a9df))[_0x834e('0x52')](handleError(_0x2f408a,null));};exports['show']=function(_0x112306,_0x42fd90){var _0x25b035={'raw':!![],'where':{'id':_0x112306[_0x834e('0x53')]['id']}},_0x2112d5={};_0x2112d5[_0x834e('0x40')]=_['keys'](db['Plugin'][_0x834e('0x54')]);_0x2112d5[_0x834e('0x44')]=_[_0x834e('0x41')](_0x112306[_0x834e('0x44')]);_0x2112d5[_0x834e('0x42')]=_[_0x834e('0x43')](_0x2112d5[_0x834e('0x40')],_0x2112d5[_0x834e('0x44')]);_0x25b035[_0x834e('0x45')]=_[_0x834e('0x43')](_0x2112d5[_0x834e('0x40')],qs[_0x834e('0x46')](_0x112306[_0x834e('0x44')][_0x834e('0x46')]));_0x25b035[_0x834e('0x45')]=_0x25b035[_0x834e('0x45')][_0x834e('0x55')]?_0x25b035[_0x834e('0x45')]:_0x2112d5[_0x834e('0x40')];if(_0x112306[_0x834e('0x44')]['includeAll']){_0x25b035[_0x834e('0x50')]=[{'all':!![]}];}_0x25b035=_[_0x834e('0x35')]({},_0x25b035,_0x112306['options']);return db[_0x834e('0x4e')][_0x834e('0x56')](_0x25b035)['then'](handleEntityNotFound(_0x42fd90,null))[_0x834e('0x2f')](respondWithResult(_0x42fd90,null))[_0x834e('0x52')](handleError(_0x42fd90,null));};exports[_0x834e('0x57')]=function(_0x35636e,_0x4288e4,_0xb77aab){return db[_0x834e('0x4e')]['find']({'where':{'id':_0x35636e[_0x834e('0x53')]['id']},'attributes':[_0x834e('0x33'),_0x834e('0x8')],'raw':!![]})[_0x834e('0x2f')](handleEntityNotFound(_0x4288e4,null))[_0x834e('0x2f')](function(_0x396bbe){if(_0x396bbe){var _0x344b51=path[_0x834e('0x58')](config['root'],_0x834e('0x59'),util['format'](_0x834e('0x5a'),path['basename'](_0x396bbe[_0x834e('0x8')])));var _0x536419=fs['createWriteStream'](_0x344b51);var _0x6c0b29=archiver(_0x834e('0x5b'),{'zlib':{'level':0x9}});_0x6c0b29['on']('warning',function(_0x5be43d){if(_0x5be43d[_0x834e('0x5c')]===_0x834e('0x5d')){logger[_0x834e('0x31')](_0x5be43d);}else{throw new db[(_0x834e('0x5e'))][(_0x834e('0x5f'))](_0x834e('0x60'));}});_0x6c0b29['on'](_0x834e('0x31'),function(_0x4273f1){throw new db['Sequelize'][(_0x834e('0x5f'))](_0x834e('0x60'));});_0x6c0b29['pipe'](_0x536419);_0x6c0b29[_0x834e('0x61')]('**/*',{'cwd':path[_0x834e('0x58')](config[_0x834e('0x62')],'server/files/plugins',path[_0x834e('0x63')](_0x396bbe[_0x834e('0x8')])),'ignore':[path[_0x834e('0x58')](path[_0x834e('0x64')](_0x396bbe['path']),_0x834e('0x65')),path[_0x834e('0x58')](path[_0x834e('0x64')](_0x396bbe['path']),_0x834e('0x66'))],'nodir':!![]})[_0x834e('0x67')]();_0x536419['on'](_0x834e('0x68'),function(){if(!fs[_0x834e('0x69')](_0x344b51)){throw new db[(_0x834e('0x5e'))][(_0x834e('0x5f'))](_0x834e('0x6a'));}return _0x4288e4[_0x834e('0x57')](_0x344b51,util[_0x834e('0x6b')](_0x834e('0x5a'),path[_0x834e('0x64')](_0x396bbe[_0x834e('0x8')])),function(_0x1b7045){if(_0x1b7045){throw new db[(_0x834e('0x5e'))][(_0x834e('0x5f'))](_0x834e('0x6c'));}fs[_0x834e('0x6d')](_0x344b51);logger[_0x834e('0x6e')](_0x834e('0x6f'));logger[_0x834e('0x6e')](_0x834e('0x70'));});});}return null;})[_0x834e('0x52')](handleError(_0x4288e4,null));};exports['upload']=function(_0x2145cf,_0x25d6f4,_0x45bcc2){var _0x36cc14=path['basename'](_0x2145cf[_0x834e('0x71')]['filename'],path['extname'](_0x2145cf[_0x834e('0x71')][_0x834e('0x72')]));var _0x1644dd=path[_0x834e('0x58')](config[_0x834e('0x62')],_0x834e('0x59'),_0x2145cf[_0x834e('0x71')][_0x834e('0x72')]);var _0x525ed3=path[_0x834e('0x58')](config['root'],_0x834e('0x59'),_0x36cc14);logger[_0x834e('0x6e')]('Plugin\x20upload\x20filepath:\x20%s',_0x1644dd);logger['info'](_0x834e('0x73'),_0x525ed3);try{fs[_0x834e('0x74')](_0x1644dd,parseInt(_0x834e('0x75'),0x8));extract(_0x1644dd,{'dir':_0x525ed3},function(_0x2cca07){if(_0x2cca07){logger[_0x834e('0x31')](_0x2cca07);handleError(_0x2cca07,!![]);};var _0x5a4854=fs[_0x834e('0x76')](_0x525ed3);if(_0x5a4854[_0x834e('0x55')]>0x1){removeReferences(_0x1644dd,_0x525ed3);logger[_0x834e('0x31')](_0x834e('0x77'));return _0x45bcc2(new Error(_0x834e('0x77')));}var _0x28b5c9=fs[_0x834e('0x78')](path[_0x834e('0x58')](_0x525ed3,_0x5a4854[0x0]));if(_0x28b5c9[_0x834e('0x79')]()){removeReferences(_0x1644dd,_0x525ed3);logger[_0x834e('0x31')]('Invalid\x20plugin\x20structure');return _0x45bcc2(new Error(_0x834e('0x77')));}if(_0x28b5c9[_0x834e('0x7a')]()){var _0x42fc96=fs[_0x834e('0x76')](path['join'](_0x525ed3,_0x5a4854[0x0]));if(_0x42fc96[_0x834e('0x55')]===0x0){removeReferences(_0x1644dd,_0x525ed3);logger['error']('Invalid\x20plugin\x20structure');return _0x45bcc2(new Error('Invalid\x20plugin\x20structure'));}var _0x452f7f=_0x42fc96[_0x834e('0x7b')](function(_0x514aac){return _0x514aac===_0x834e('0x7c');});if(!_0x452f7f){return _0x45bcc2(new Error(_0x834e('0x7d')));}var _0x4d4477=fs[_0x834e('0x7e')](path[_0x834e('0x58')](_0x525ed3,_0x5a4854[0x0],'manifest.json'));var _0x5df169=JSON[_0x834e('0x7f')](_0x4d4477);if(_0x834e('0x27')==typeof _0x5df169[_0x834e('0x33')]){return _0x45bcc2(new Error(_0x834e('0x80')));}if(_0x834e('0x27')==typeof _0x5df169['type']){return _0x45bcc2(new Error(_0x834e('0x81')));}if('undefined'==typeof _0x5df169[_0x834e('0x82')]){return _0x45bcc2(new Error(_0x834e('0x83')));}if(_0x834e('0x27')==typeof _0x5df169['parameters']){return _0x45bcc2(new Error(_0x834e('0x84')));}if(_0x5df169[_0x834e('0x3e')]==='html'){if(_0x834e('0x27')==typeof _0x5df169[_0x834e('0x85')][_0x834e('0x86')]){return _0x45bcc2(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x834e('0x27')==typeof _0x5df169[_0x834e('0x85')][_0x834e('0x86')][_0x834e('0x87')]&&_0x834e('0x27')==typeof _0x5df169[_0x834e('0x85')][_0x834e('0x86')][_0x834e('0x39')]){return _0x45bcc2(new Error(_0x834e('0x88')));}}else if(_0x5df169[_0x834e('0x3e')]==='script'){if('undefined'==typeof _0x5df169['parameters'][_0x834e('0x89')]){return _0x45bcc2(new Error(_0x834e('0x8a')));}if(_0x834e('0x27')==typeof _0x5df169[_0x834e('0x85')][_0x834e('0x8b')]){return _0x45bcc2(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x45bcc2(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4520fc=_0x5df169[_0x834e('0x33')];var _0x23ad7c=_0x5df169[_0x834e('0x8c')];var _0x40a705=_0x5df169['type'];var _0x2df0d5=_0x5df169[_0x834e('0x8d')]?_0x5df169[_0x834e('0x8d')]:'always';var _0x3b3f73=_0x5df169[_0x834e('0x8e')]?_0x5df169[_0x834e('0x8e')]:_0x834e('0x8f');var _0x23bc1e='';var _0x585d02='';var _0x55f1a0='';var _0x227797='';var _0x40a872=_0x5df169['version'];if(_0x40a705===_0x834e('0x90')){if('undefined'!=typeof _0x5df169[_0x834e('0x85')][_0x834e('0x86')][_0x834e('0x87')]){var _0x29839d=_0x5df169[_0x834e('0x85')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x29839d)){_0x23bc1e=path[_0x834e('0x58')](_0x834e('0x91'),_0x36cc14,_0x5a4854[0x0],_0x29839d);}else{_0x23bc1e=_0x29839d;}}else{logger[_0x834e('0x6e')](_0x834e('0x92'));}if(_0x834e('0x27')!=typeof _0x5df169[_0x834e('0x85')][_0x834e('0x86')][_0x834e('0x39')]){var _0xfb93b1=_0x5df169['parameters'][_0x834e('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x834e('0x93')](_0xfb93b1)){_0x585d02=path[_0x834e('0x58')](_0x834e('0x91'),_0x36cc14,_0x5a4854[0x0],_0xfb93b1);}else{_0x585d02=_0xfb93b1;}}else{logger[_0x834e('0x6e')](_0x834e('0x94'));}}else if(_0x40a705===_0x834e('0x95')){_0x55f1a0=_0x5df169['parameters']['scriptName'];_0x227797=_0x5df169[_0x834e('0x85')][_0x834e('0x8b')];if('undefined'!=typeof _0x5df169[_0x834e('0x85')][_0x834e('0x86')]){if(_0x834e('0x27')!=typeof _0x5df169[_0x834e('0x85')][_0x834e('0x86')]['admin']){var _0x29839d=_0x5df169[_0x834e('0x85')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x29839d)){_0x23bc1e=path[_0x834e('0x58')](_0x834e('0x91'),_0x36cc14,_0x5a4854[0x0],_0x29839d);}else{_0x23bc1e=_0x29839d;}}if('undefined'!=typeof _0x5df169[_0x834e('0x85')][_0x834e('0x86')]['agent']){var _0xfb93b1=_0x5df169['parameters']['views'][_0x834e('0x39')];if(!/^(f|ht)tps?:\/\//i[_0x834e('0x93')](_0xfb93b1)){_0x585d02=path[_0x834e('0x58')](_0x834e('0x91'),_0x36cc14,_0x5a4854[0x0],_0xfb93b1);}else{_0x585d02=_0xfb93b1;}}}}var _0x55e0f7={'name':_0x4520fc,'description':_0x23ad7c,'path':path[_0x834e('0x58')](_0x36cc14,_0x5a4854[0x0]),'type':_0x40a705,'sidebar':_0x2df0d5,'icon':_0x3b3f73,'adminUrl':_0x23bc1e,'agentUrl':_0x585d02,'scriptName':_0x55f1a0,'scriptPath':_0x227797,'version':_0x40a872};removeReferences(_0x1644dd,null);return db[_0x834e('0x4e')][_0x834e('0x96')](_0x55e0f7)[_0x834e('0x2f')](function(_0x46aabf){var _0x27603d={'role':_0x2145cf[_0x834e('0x36')][_0x834e('0x97')],'userProfileId':_0x2145cf[_0x834e('0x36')][_0x834e('0x98')]};if(!_0x27603d)throw new Error(_0x834e('0x99'));if(_0x27603d[_0x834e('0x97')]===_0x834e('0x9a')){var _0x120ea7=_0x46aabf[_0x834e('0x30')]({'plain':!![]});return db[_0x834e('0x9b')][_0x834e('0x56')]({'where':{'name':_0x834e('0x9c'),'userProfileId':_0x27603d[_0x834e('0x98')]},'raw':!![]})[_0x834e('0x2f')](function(_0x2c634b){if(_0x2c634b&&_0x2c634b[_0x834e('0x9d')]===0x0){return db['UserProfileResource'][_0x834e('0x96')]({'name':_0x120ea7[_0x834e('0x33')],'resourceId':_0x120ea7['id'],'type':_0x2c634b[_0x834e('0x33')],'sectionId':_0x2c634b['id']},{})[_0x834e('0x2f')](function(){return _0x46aabf;});}else{return _0x46aabf;}})[_0x834e('0x52')](function(_0x3bcdcd){logger[_0x834e('0x31')](_0x834e('0x9e'),_0x3bcdcd);throw _0x3bcdcd;});}return _0x46aabf;})[_0x834e('0x2f')](respondWithResult(_0x25d6f4,null))['catch'](handleError(_0x25d6f4,null));}});}catch(_0x5ce790){_0x25d6f4['status'](0x1f4)[_0x834e('0x9f')](_0x5ce790);}};function removeReferences(_0x493e1f,_0x287a4c){try{if(_0x493e1f){fs[_0x834e('0x6d')](_0x493e1f);logger[_0x834e('0x6e')]('Zip\x20archive\x20removed');}if(_0x287a4c){rimraf(_0x287a4c,function(){});logger[_0x834e('0x6e')](_0x834e('0xa0'));}}catch(_0x330bc3){logger[_0x834e('0x31')](_0x330bc3);}}exports[_0x834e('0x2d')]=function(_0x473e89,_0x528052,_0x10dd7b){return db[_0x834e('0x4e')][_0x834e('0x56')]({'where':{'id':_0x473e89[_0x834e('0x53')]['id']}})[_0x834e('0x2f')](handleEntityNotFound(_0x528052,null))['then'](saveUpdates(_0x473e89['body'],null))['then'](respondWithResult(_0x528052,null))['catch'](handleError(_0x528052,null));};exports[_0x834e('0xa1')]=function(_0x2ccdde,_0x56fc05,_0x3bd1e7){return db[_0x834e('0x4e')]['find']({'where':{'id':_0x2ccdde[_0x834e('0x53')]['id']}})[_0x834e('0x2f')](function(_0xbf7693){if(_0xbf7693){return _0xbf7693[_0x834e('0x2e')]();}})[_0x834e('0x2f')](function(_0x404bab){rimraf(path['join'](config['root'],_0x834e('0x59'),path[_0x834e('0x63')](_0x404bab[_0x834e('0x8')])),function(){});return _0x404bab;})['then'](handleEntityNotFound(_0x56fc05,null))[_0x834e('0x2f')](respondWithStatusCode(_0x56fc05,null))[_0x834e('0x52')](handleError(_0x56fc05,null));};exports['webhookGet']=function(_0x45dea6,_0x13d76a,_0x216d1f){return BPromise[_0x834e('0xa2')]()['then'](function(){if(!_0x45dea6[_0x834e('0x44')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x45dea6[_0x834e('0x44')][_0x834e('0xa3')]){throw new Error(_0x834e('0xa4'));}var _0x3fde89=_0x45dea6[_0x834e('0x44')][_0x834e('0xa5')]?_0x45dea6['query']['hostname']+':'+_0x45dea6[_0x834e('0x44')][_0x834e('0xa3')]:_0x834e('0xa6')+_0x45dea6[_0x834e('0x44')][_0x834e('0xa3')];var _0x3363c7=_0x45dea6[_0x834e('0x44')]['json']?_0x45dea6[_0x834e('0x44')][_0x834e('0x24')]:!![];var _0x56f28b=_0x45dea6[_0x834e('0x44')][_0x834e('0xa7')]?_0x45dea6[_0x834e('0x44')][_0x834e('0xa7')]:null;var _0x284a75={'method':_0x45dea6[_0x834e('0xa8')],'uri':util[_0x834e('0x6b')](_0x834e('0xa9'),_0x3fde89,_0x45dea6[_0x834e('0x44')][_0x834e('0x8')]),'json':_0x3363c7,'resolveWithFullResponse':!![],'encoding':_0x56f28b,'qs':_0x45dea6[_0x834e('0x44')]};if(_0x45dea6[_0x834e('0xaa')]){_0x284a75[_0x834e('0xaa')]=_0x45dea6[_0x834e('0xaa')];if(_0x284a75['headers'][_0x834e('0xab')]){delete _0x284a75[_0x834e('0xaa')]['content-length'];}}if(_0x284a75[_0x834e('0xaa')]['content-type']){delete _0x284a75[_0x834e('0xaa')]['content-type'];}return rp(_0x284a75);})[_0x834e('0x2f')](function(_0x560d10){if(_0x560d10){_0x13d76a[_0x834e('0xac')](_0x560d10[_0x834e('0xaa')]);logger[_0x834e('0x6e')](_0x560d10[_0x834e('0x36')]);if(_['endsWith'](_0x45dea6[_0x834e('0x44')][_0x834e('0x8')],_0x834e('0x57'))&&_0x560d10[_0x834e('0xad')]==0x1f4){return _0x13d76a[_0x834e('0x21')](_0x560d10[_0x834e('0xad')]);}else{return _0x13d76a[_0x834e('0x23')](_0x560d10[_0x834e('0xad')])[_0x834e('0x9f')](_0x560d10[_0x834e('0x36')]);}}else{return _0x13d76a[_0x834e('0x21')](0xc8);}})[_0x834e('0x52')](handleError(_0x13d76a,null));};exports[_0x834e('0xae')]=function(_0x246f01,_0x1c7061,_0xfec19d){return BPromise[_0x834e('0xa2')]()['then'](function(){if(!_0x246f01['query'][_0x834e('0x8')]){throw new Error(_0x834e('0xaf'));}if(!_0x246f01[_0x834e('0x44')][_0x834e('0xa3')]){throw new Error(_0x834e('0xa4'));}var _0x31f336=_0x246f01[_0x834e('0x44')][_0x834e('0xa5')]?_0x246f01[_0x834e('0x44')][_0x834e('0xa5')]+':'+_0x246f01[_0x834e('0x44')][_0x834e('0xa3')]:'http://localhost:'+_0x246f01[_0x834e('0x44')]['port'];var _0x2fdb72=_0x246f01[_0x834e('0x44')][_0x834e('0x24')]?_0x246f01['query'][_0x834e('0x24')]:!![];var _0x23a386=_0x246f01['query']['encoding']?_0x246f01[_0x834e('0x44')][_0x834e('0xa7')]:null;var _0x4e0f4d={'method':_0x246f01[_0x834e('0xa8')],'uri':util[_0x834e('0x6b')](_0x834e('0xa9'),_0x31f336,_0x246f01[_0x834e('0x44')][_0x834e('0x8')]),'json':_0x2fdb72,'resolveWithFullResponse':!![],'encoding':_0x23a386,'body':_0x246f01['body']};if(_0x246f01['headers']){_0x4e0f4d[_0x834e('0xaa')]=_0x246f01['headers'];if(_0x4e0f4d['headers']['content-length']){delete _0x4e0f4d[_0x834e('0xaa')][_0x834e('0xab')];}}if(_0x4e0f4d['headers'][_0x834e('0xb0')]){delete _0x4e0f4d[_0x834e('0xaa')][_0x834e('0xb0')];}return rp(_0x4e0f4d);})[_0x834e('0x2f')](function(_0x54875f){if(_0x54875f){_0x1c7061[_0x834e('0xac')](_0x54875f[_0x834e('0xaa')]);logger[_0x834e('0x6e')](_0x54875f['body']);return _0x1c7061[_0x834e('0x23')](_0x54875f['statusCode'])[_0x834e('0x9f')](_0x54875f['body']);}else{return _0x1c7061[_0x834e('0x21')](0xc8);}})[_0x834e('0x52')](handleError(_0x1c7061,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 203bd7d..7d579ee 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 _0xa456=['Plugin','setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x4f423a,_0x2d0ca0){var _0x16c481=function(_0x1dccd3){while(--_0x1dccd3){_0x4f423a['push'](_0x4f423a['shift']());}};_0x16c481(++_0x2d0ca0);}(_0xa456,0x142));var _0x6a45=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xa456[_0x5f3f88];return _0xd08119;};'use strict';var EventEmitter=require(_0x6a45('0x0'));var Plugin=require(_0x6a45('0x1'))['db'][_0x6a45('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6a45('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6a45('0x4'),'afterDestroy':_0x6a45('0x5')};function emitEvent(_0x3f7448){return function(_0x500c72,_0x1f0701,_0x40acad){PluginEvents[_0x6a45('0x6')](_0x3f7448+':'+_0x500c72['id'],_0x500c72);PluginEvents[_0x6a45('0x6')](_0x3f7448,_0x500c72);_0x40acad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x6a45('0x7')](e,emitEvent(event));}}module[_0x6a45('0x8')]=PluginEvents; \ No newline at end of file +var _0x7880=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x492c55,_0xb714c1){var _0x39511a=function(_0x308e32){while(--_0x308e32){_0x492c55['push'](_0x492c55['shift']());}};_0x39511a(++_0xb714c1);}(_0x7880,0x1f4));var _0x0788=function(_0x20be28,_0x24b925){_0x20be28=_0x20be28-0x0;var _0x8ab067=_0x7880[_0x20be28];return _0x8ab067;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x0788('0x0'))['db'][_0x0788('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x0788('0x2')](0x0);var events={'afterCreate':_0x0788('0x3'),'afterUpdate':_0x0788('0x4'),'afterDestroy':_0x0788('0x5')};function emitEvent(_0x5c29f7){return function(_0x3925a6,_0x1e0814,_0x317885){PluginEvents[_0x0788('0x6')](_0x5c29f7+':'+_0x3925a6['id'],_0x3925a6);PluginEvents[_0x0788('0x6')](_0x5c29f7,_0x3925a6);_0x317885(null);};}for(var e in events){if(events[_0x0788('0x7')](e)){var event=events[e];Plugin[_0x0788('0x8')](e,emitEvent(event));}}module[_0x0788('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 06d4fc4..b34b68c 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 _0xac9d=['bluebird','request-promise','path','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xac9d,0x14d));var _0xdac9=function(_0x44cd28,_0x1502d9){_0x44cd28=_0x44cd28-0x0;var _0x39356e=_0xac9d[_0x44cd28];return _0x39356e;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var logger=require(_0xdac9('0x2'))(_0xdac9('0x3'));var moment=require(_0xdac9('0x4'));var BPromise=require(_0xdac9('0x5'));var rp=require(_0xdac9('0x6'));var fs=require('fs');var path=require(_0xdac9('0x7'));var rimraf=require('rimraf');var config=require(_0xdac9('0x8'));var attributes=require('./plugin.attributes');module[_0xdac9('0x9')]=function(_0x1f8ff3,_0x1222bb){return _0x1f8ff3[_0xdac9('0xa')](_0xdac9('0xb'),attributes,{'tableName':_0xdac9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac9d=['bluebird','request-promise','path','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xac9d,0x14d));var _0xdac9=function(_0x4f9d26,_0x641341){_0x4f9d26=_0x4f9d26-0x0;var _0x57debc=_0xac9d[_0x4f9d26];return _0x57debc;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var logger=require(_0xdac9('0x2'))(_0xdac9('0x3'));var moment=require(_0xdac9('0x4'));var BPromise=require(_0xdac9('0x5'));var rp=require(_0xdac9('0x6'));var fs=require('fs');var path=require(_0xdac9('0x7'));var rimraf=require('rimraf');var config=require(_0xdac9('0x8'));var attributes=require('./plugin.attributes');module[_0xdac9('0x9')]=function(_0x1f8ff3,_0x1222bb){return _0x1f8ff3[_0xdac9('0xa')](_0xdac9('0xb'),attributes,{'tableName':_0xdac9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 6edec72..1101ea7 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 _0x7849=['debug','request\x20sent','stringify','error','message','info','result','catch','CreatePlugin','Plugin','create','options','raw','then','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','./plugin.socket','request','Plugin,\x20%s,\x20%s'];(function(_0x20c02e,_0x37a630){var _0x2edb58=function(_0x15e619){while(--_0x15e619){_0x20c02e['push'](_0x20c02e['shift']());}};_0x2edb58(++_0x37a630);}(_0x7849,0x158));var _0x9784=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7849[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x9784('0x0'));var moment=require('moment');var BPromise=require(_0x9784('0x1'));var rs=require(_0x9784('0x2'));var fs=require('fs');var Redis=require(_0x9784('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9784('0x4'));var logger=require(_0x9784('0x5'))(_0x9784('0x6'));var config=require(_0x9784('0x7'));var jayson=require(_0x9784('0x8'));var client=jayson[_0x9784('0x9')][_0x9784('0xa')]({'port':0x232a});config['redis']=_[_0x9784('0xb')](config['redis'],{'host':_0x9784('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9784('0xd'))['register'](socket);function respondWithRpcPromise(_0x1fadfc,_0x14cf3f,_0x10921f){return new BPromise(function(_0x9fead,_0x295536){return client[_0x9784('0xe')](_0x1fadfc,_0x10921f)['then'](function(_0x23693d){logger['info'](_0x9784('0xf'),_0x14cf3f,'request\x20sent');logger[_0x9784('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x14cf3f,_0x9784('0x11'),JSON[_0x9784('0x12')](_0x23693d));if(_0x23693d[_0x9784('0x13')]){if(_0x23693d[_0x9784('0x13')]['code']===0x1f4){logger[_0x9784('0x13')](_0x9784('0xf'),_0x14cf3f,_0x23693d[_0x9784('0x13')]['message']);return _0x295536(_0x23693d[_0x9784('0x13')][_0x9784('0x14')]);}logger['error'](_0x9784('0xf'),_0x14cf3f,_0x23693d[_0x9784('0x13')]['message']);return _0x9fead(_0x23693d['error']['message']);}else{logger[_0x9784('0x15')]('Plugin,\x20%s,\x20%s',_0x14cf3f,_0x9784('0x11'));_0x9fead(_0x23693d[_0x9784('0x16')][_0x9784('0x14')]);}})[_0x9784('0x17')](function(_0x5e2d2d){logger['error'](_0x9784('0xf'),_0x14cf3f,_0x5e2d2d);_0x295536(_0x5e2d2d);});});}exports[_0x9784('0x18')]=function(_0x5c6bb7){var _0x5e21ed=this;return new Promise(function(_0x40b53e,_0x1ca4e4){return db[_0x9784('0x19')][_0x9784('0x1a')](_0x5c6bb7['body'],{'raw':_0x5c6bb7[_0x9784('0x1b')]?_0x5c6bb7[_0x9784('0x1b')][_0x9784('0x1c')]===undefined?!![]:![]:!![]})[_0x9784('0x1d')](function(_0x3f6984){logger['info'](_0x9784('0x18'),_0x5c6bb7);logger[_0x9784('0x10')]('CreatePlugin',_0x5c6bb7,JSON[_0x9784('0x12')](_0x3f6984));_0x40b53e(_0x3f6984);})['catch'](function(_0x105cd4){logger[_0x9784('0x13')](_0x9784('0x18'),_0x105cd4[_0x9784('0x14')],_0x5c6bb7);_0x1ca4e4(_0x5e21ed[_0x9784('0x13')](0x1f4,_0x105cd4[_0x9784('0x14')]));});});}; \ No newline at end of file +var _0xbd3e=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','body','options','raw','CreatePlugin','catch','lodash','util','moment','bluebird'];(function(_0x22d792,_0x1b2739){var _0x300c89=function(_0x5ede0a){while(--_0x5ede0a){_0x22d792['push'](_0x22d792['shift']());}};_0x300c89(++_0x1b2739);}(_0xbd3e,0x9c));var _0xebd3=function(_0x456a3c,_0x65baf3){_0x456a3c=_0x456a3c-0x0;var _0x2b756d=_0xbd3e[_0x456a3c];return _0x2b756d;};'use strict';var _=require(_0xebd3('0x0'));var util=require(_0xebd3('0x1'));var moment=require(_0xebd3('0x2'));var BPromise=require(_0xebd3('0x3'));var rs=require(_0xebd3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebd3('0x5'))['db'];var utils=require(_0xebd3('0x6'));var logger=require(_0xebd3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xebd3('0x8'));var client=jayson[_0xebd3('0x9')][_0xebd3('0xa')]({'port':0x232a});config[_0xebd3('0xb')]=_[_0xebd3('0xc')](config[_0xebd3('0xb')],{'host':_0xebd3('0xd'),'port':0x18eb});var socket=require(_0xebd3('0xe'))(new Redis(config[_0xebd3('0xb')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x338b30,_0x8b949a,_0x264951){return new BPromise(function(_0x1c4740,_0x24922f){return client[_0xebd3('0xf')](_0x338b30,_0x264951)[_0xebd3('0x10')](function(_0x40cbf2){logger[_0xebd3('0x11')](_0xebd3('0x12'),_0x8b949a,_0xebd3('0x13'));logger[_0xebd3('0x14')](_0xebd3('0x15'),_0x8b949a,'request\x20sent',JSON[_0xebd3('0x16')](_0x40cbf2));if(_0x40cbf2['error']){if(_0x40cbf2[_0xebd3('0x17')][_0xebd3('0x18')]===0x1f4){logger[_0xebd3('0x17')](_0xebd3('0x12'),_0x8b949a,_0x40cbf2[_0xebd3('0x17')][_0xebd3('0x19')]);return _0x24922f(_0x40cbf2[_0xebd3('0x17')]['message']);}logger[_0xebd3('0x17')](_0xebd3('0x12'),_0x8b949a,_0x40cbf2[_0xebd3('0x17')][_0xebd3('0x19')]);return _0x1c4740(_0x40cbf2[_0xebd3('0x17')][_0xebd3('0x19')]);}else{logger[_0xebd3('0x11')](_0xebd3('0x12'),_0x8b949a,_0xebd3('0x13'));_0x1c4740(_0x40cbf2[_0xebd3('0x1a')][_0xebd3('0x19')]);}})['catch'](function(_0x25e349){logger[_0xebd3('0x17')]('Plugin,\x20%s,\x20%s',_0x8b949a,_0x25e349);_0x24922f(_0x25e349);});});}exports['CreatePlugin']=function(_0x1eeb77){var _0x320c7c=this;return new Promise(function(_0x1d1bb9,_0x160689){return db['Plugin']['create'](_0x1eeb77[_0xebd3('0x1b')],{'raw':_0x1eeb77[_0xebd3('0x1c')]?_0x1eeb77[_0xebd3('0x1c')][_0xebd3('0x1d')]===undefined?!![]:![]:!![]})[_0xebd3('0x10')](function(_0x16d342){logger['info'](_0xebd3('0x1e'),_0x1eeb77);logger[_0xebd3('0x14')](_0xebd3('0x1e'),_0x1eeb77,JSON[_0xebd3('0x16')](_0x16d342));_0x1d1bb9(_0x16d342);})[_0xebd3('0x1f')](function(_0x5811b8){logger[_0xebd3('0x17')](_0xebd3('0x1e'),_0x5811b8[_0xebd3('0x19')],_0x1eeb77);_0x160689(_0x320c7c[_0xebd3('0x17')](0x1f4,_0x5811b8[_0xebd3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0d1d13d..40f7d4f 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 _0x1f65=['save','remove','emit','removeListener','plugin:','./plugin.events'];(function(_0x58f19c,_0x3e211e){var _0x4bd000=function(_0x283caf){while(--_0x283caf){_0x58f19c['push'](_0x58f19c['shift']());}};_0x4bd000(++_0x3e211e);}(_0x1f65,0x185));var _0x51f6=function(_0x45e332,_0x1b2cce){_0x45e332=_0x45e332-0x0;var _0xfdd1fc=_0x1f65[_0x45e332];return _0xfdd1fc;};'use strict';var PluginEvents=require(_0x51f6('0x0'));var events=[_0x51f6('0x1'),_0x51f6('0x2'),'update'];function createListener(_0x2be689,_0x54cc27){return function(_0x229981){_0x54cc27[_0x51f6('0x3')](_0x2be689,_0x229981);};}function removeListener(_0x149d38,_0x31f9b7){return function(){PluginEvents[_0x51f6('0x4')](_0x149d38,_0x31f9b7);};}exports['register']=function(_0x2972dd){for(var _0x5b4c0e=0x0,_0x34fdc2=events['length'];_0x5b4c0e<_0x34fdc2;_0x5b4c0e++){var _0x891117=events[_0x5b4c0e];var _0x458b08=createListener(_0x51f6('0x5')+_0x891117,_0x2972dd);PluginEvents['on'](_0x891117,_0x458b08);}}; \ No newline at end of file +var _0xa937=['emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xa937,0xde));var _0x7a93=function(_0x119d67,_0x26894e){_0x119d67=_0x119d67-0x0;var _0x538dff=_0xa937[_0x119d67];return _0x538dff;};'use strict';var PluginEvents=require(_0x7a93('0x0'));var events=[_0x7a93('0x1'),'remove','update'];function createListener(_0xf233fd,_0x26e313){return function(_0x27a97a){_0x26e313[_0x7a93('0x2')](_0xf233fd,_0x27a97a);};}function removeListener(_0x4c08be,_0x217b3c){return function(){PluginEvents[_0x7a93('0x3')](_0x4c08be,_0x217b3c);};}exports[_0x7a93('0x4')]=function(_0x31d423){for(var _0x5eec4e=0x0,_0x34a356=events[_0x7a93('0x5')];_0x5eec4e<_0x34a356;_0x5eec4e++){var _0x80c60=events[_0x5eec4e];var _0x491244=createListener(_0x7a93('0x6')+_0x80c60,_0x31d423);PluginEvents['on'](_0x80c60,_0x491244);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f733145..91498fc 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 _0xc2db=['isAuthenticated','index','/:id','create','update','delete','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xc2db,0xbe));var _0xbc2d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc2db[_0x502c7d];return _0x30b7ed;};'use strict';var express=require(_0xbc2d('0x0'));var router=express[_0xbc2d('0x1')]();var auth=require(_0xbc2d('0x2'));var controller=require(_0xbc2d('0x3'));router[_0xbc2d('0x4')]('/',auth[_0xbc2d('0x5')](),controller[_0xbc2d('0x6')]);router[_0xbc2d('0x4')](_0xbc2d('0x7'),auth[_0xbc2d('0x5')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbc2d('0x8')]);router['put']('/:id',auth[_0xbc2d('0x5')](),controller[_0xbc2d('0x9')]);router[_0xbc2d('0xa')](_0xbc2d('0x7'),auth[_0xbc2d('0x5')](),controller[_0xbc2d('0xb')]);module[_0xbc2d('0xc')]=router; \ No newline at end of file +var _0x9f6a=['./pm2.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','express','Router'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0x9f6a,0x129));var _0xa9f6=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x9f6a[_0x2070da];return _0x4f9fe1;};'use strict';var express=require(_0xa9f6('0x0'));var router=express[_0xa9f6('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xa9f6('0x2'));router[_0xa9f6('0x3')]('/',auth[_0xa9f6('0x4')](),controller[_0xa9f6('0x5')]);router[_0xa9f6('0x3')](_0xa9f6('0x6'),auth['isAuthenticated'](),controller[_0xa9f6('0x7')]);router[_0xa9f6('0x8')]('/',auth[_0xa9f6('0x4')](),controller['create']);router[_0xa9f6('0x9')](_0xa9f6('0x6'),auth['isAuthenticated'](),controller[_0xa9f6('0xa')]);router[_0xa9f6('0xb')](_0xa9f6('0x6'),auth[_0xa9f6('0x4')](),controller['destroy']);module[_0xa9f6('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 01accbc..1788507 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 _0xbbb5=['catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','motion2','length'];(function(_0x5408c9,_0x19f8e7){var _0x4512df=function(_0x1c01fa){while(--_0x1c01fa){_0x5408c9['push'](_0x5408c9['shift']());}};_0x4512df(++_0x19f8e7);}(_0xbbb5,0x168));var _0x5bbb=function(_0xb982d0,_0x10266c){_0xb982d0=_0xb982d0-0x0;var _0x3c7c09=_0xbbb5[_0xb982d0];return _0x3c7c09;};'use strict';var _=require(_0x5bbb('0x0'));var pm2=require(_0x5bbb('0x1'));var logger=require(_0x5bbb('0x2'))(_0x5bbb('0x3'));var path=require('path');var exec=require(_0x5bbb('0x4'))[_0x5bbb('0x5')];var BPromise=require(_0x5bbb('0x6'));function handleEntityNotFound(_0x43673a,_0x3b0c23){return function(_0x1d784c){if(!_0x1d784c){_0x43673a[_0x5bbb('0x7')](0x194);;}return _0x1d784c;};}function respondWithResult(_0x3c1a5f,_0xc4d663){_0xc4d663=_0xc4d663||0xc8;return function(_0xbff2c7){if(_0xbff2c7){return _0x3c1a5f[_0x5bbb('0x8')](_0xc4d663)['json'](_0xbff2c7);}return null;};}function handleError(_0x5bdb47,_0x2ddcfd){_0x2ddcfd=_0x2ddcfd||0x1f4;return function(_0x1f688d){logger[_0x5bbb('0x9')](_0x1f688d[_0x5bbb('0xa')]);if(_0x1f688d['name']){delete _0x1f688d[_0x5bbb('0xb')];}_0x5bdb47[_0x5bbb('0x8')](_0x2ddcfd)[_0x5bbb('0xc')](_0x1f688d);};}function execChildProcess(){return new BPromise(function(_0x1e8d8c,_0x1fd28f){exec(_0x5bbb('0xd'),function(_0xb03adb,_0x44d9a2,_0x230803){logger[_0x5bbb('0xe')](_0x44d9a2);logger[_0x5bbb('0xe')](_0x230803);if(_0xb03adb){logger[_0x5bbb('0x9')](_0xb03adb);return _0x1fd28f(_0xb03adb);}return _0x1e8d8c(_0x44d9a2);});});}exports[_0x5bbb('0xf')]=function(_0x186a4b,_0x5848ca){return pm2[_0x5bbb('0x10')]()[_0x5bbb('0x11')](function(_0x1d46b2){if(_0x1d46b2){var _0x57ef2c=_['reject'](_0x1d46b2,function(_0x322a3e){return _0x322a3e[_0x5bbb('0xb')]==='express'||_0x322a3e['name']===_0x5bbb('0x12');});return{'rows':_0x57ef2c,'count':_0x57ef2c[_0x5bbb('0x13')]};}return null;})[_0x5bbb('0x11')](respondWithResult(_0x5848ca,null))[_0x5bbb('0x14')](handleError(_0x5848ca,null));};exports[_0x5bbb('0x15')]=function(_0x602892,_0x45e67d){return pm2['describe'](_0x602892[_0x5bbb('0x16')]['id'])['then'](respondWithResult(_0x45e67d,null))[_0x5bbb('0x11')](handleEntityNotFound(_0x45e67d,null))[_0x5bbb('0x14')](handleError(_0x45e67d,null));};exports[_0x5bbb('0x17')]=function(_0x3f5145,_0x159261){if(_0x3f5145[_0x5bbb('0x18')][_0x5bbb('0xb')]&&_0x3f5145[_0x5bbb('0x18')][_0x5bbb('0x19')]){var _0x45846b=path[_0x5bbb('0x1a')](__dirname,_0x5bbb('0x1b'),_0x3f5145[_0x5bbb('0x18')][_0x5bbb('0x19')]);var _0x2a874f=process[_0x5bbb('0x1c')]();process[_0x5bbb('0x1d')](path['dirname'](_0x45846b));return execChildProcess()['then'](function(_0x57ec37){process[_0x5bbb('0x1d')](_0x2a874f);return pm2['start']({'name':_0x3f5145['body'][_0x5bbb('0xb')],'script':_0x45846b});})['then'](function(_0x345e4c){pm2[_0x5bbb('0x1e')]();return _0x345e4c[0x0];})[_0x5bbb('0x11')](respondWithResult(_0x159261,0xc9))[_0x5bbb('0x14')](handleError(_0x159261,null));}else{return _0x159261[_0x5bbb('0x8')](0x1f4)['send']({'message':_0x5bbb('0x1f')});}};exports[_0x5bbb('0x20')]=function(_0x403852,_0x198d94){if(_0x403852[_0x5bbb('0x18')]['id']){delete _0x403852[_0x5bbb('0x18')]['id'];}var _0x188684={'online':'restart','stopped':'stop'};if(_0x188684[_0x5bbb('0x21')](_0x403852[_0x5bbb('0x18')][_0x5bbb('0x8')])){return pm2[_0x188684[_0x403852[_0x5bbb('0x18')]['status']]](_0x403852[_0x5bbb('0x16')]['id'])[_0x5bbb('0x11')](respondWithResult(_0x198d94,0xc8))[_0x5bbb('0x14')](handleError(_0x198d94,null));}else{return _0x198d94['status'](0x1f4)['send']({'message':_0x5bbb('0x22')});}};exports[_0x5bbb('0x23')]=function(_0x4b61bb,_0x3e9c61){if(_0x4b61bb[_0x5bbb('0x18')]['id']){delete _0x4b61bb[_0x5bbb('0x18')]['id'];}if(_0x4b61bb[_0x5bbb('0x16')]['id']){return pm2[_0x5bbb('0x24')](_0x4b61bb[_0x5bbb('0x16')]['id'])[_0x5bbb('0x11')](function(_0x18df6d){pm2[_0x5bbb('0x1e')]();return _0x18df6d[0x0];})[_0x5bbb('0x11')](respondWithResult(_0x3e9c61,null))[_0x5bbb('0x14')](handleError(_0x3e9c61,null));}else{return _0x3e9c61[_0x5bbb('0x8')](0x1f4)[_0x5bbb('0xc')]({'message':_0x5bbb('0x25')});}}; \ No newline at end of file +var _0x9dcb=['list','then','reject','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','status','error','stack','name','send','info'];(function(_0x5632f0,_0x3fafcf){var _0x20d639=function(_0x2a2175){while(--_0x2a2175){_0x5632f0['push'](_0x5632f0['shift']());}};_0x20d639(++_0x3fafcf);}(_0x9dcb,0x1b5));var _0xb9dc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9dcb[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xb9dc('0x0'));var pm2=require(_0xb9dc('0x1'));var logger=require(_0xb9dc('0x2'))(_0xb9dc('0x3'));var path=require(_0xb9dc('0x4'));var exec=require(_0xb9dc('0x5'))[_0xb9dc('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x500ede,_0x540b6e){return function(_0x300000){if(!_0x300000){_0x500ede[_0xb9dc('0x7')](0x194);;}return _0x300000;};}function respondWithResult(_0x32f80d,_0x2c4a25){_0x2c4a25=_0x2c4a25||0xc8;return function(_0x3e1829){if(_0x3e1829){return _0x32f80d[_0xb9dc('0x8')](_0x2c4a25)['json'](_0x3e1829);}return null;};}function handleError(_0x5c9ffe,_0x238602){_0x238602=_0x238602||0x1f4;return function(_0x2bdac6){logger[_0xb9dc('0x9')](_0x2bdac6[_0xb9dc('0xa')]);if(_0x2bdac6[_0xb9dc('0xb')]){delete _0x2bdac6[_0xb9dc('0xb')];}_0x5c9ffe['status'](_0x238602)[_0xb9dc('0xc')](_0x2bdac6);};}function execChildProcess(){return new BPromise(function(_0x13fc58,_0x4e9149){exec('npm\x20install',function(_0x394aa6,_0x5886e8,_0x529e6e){logger[_0xb9dc('0xd')](_0x5886e8);logger[_0xb9dc('0xd')](_0x529e6e);if(_0x394aa6){logger[_0xb9dc('0x9')](_0x394aa6);return _0x4e9149(_0x394aa6);}return _0x13fc58(_0x5886e8);});});}exports['index']=function(_0x2459a4,_0x1acd5b){return pm2[_0xb9dc('0xe')]()[_0xb9dc('0xf')](function(_0x449bed){if(_0x449bed){var _0x46d38a=_[_0xb9dc('0x10')](_0x449bed,function(_0x4e706b){return _0x4e706b[_0xb9dc('0xb')]===_0xb9dc('0x11')||_0x4e706b[_0xb9dc('0xb')]===_0xb9dc('0x12');});return{'rows':_0x46d38a,'count':_0x46d38a[_0xb9dc('0x13')]};}return null;})[_0xb9dc('0xf')](respondWithResult(_0x1acd5b,null))[_0xb9dc('0x14')](handleError(_0x1acd5b,null));};exports[_0xb9dc('0x15')]=function(_0x483afb,_0x22d03b){return pm2[_0xb9dc('0x16')](_0x483afb['params']['id'])['then'](respondWithResult(_0x22d03b,null))['then'](handleEntityNotFound(_0x22d03b,null))[_0xb9dc('0x14')](handleError(_0x22d03b,null));};exports[_0xb9dc('0x17')]=function(_0x49a6e5,_0x1febd0){if(_0x49a6e5['body'][_0xb9dc('0xb')]&&_0x49a6e5[_0xb9dc('0x18')][_0xb9dc('0x19')]){var _0x53554d=path[_0xb9dc('0x1a')](__dirname,_0xb9dc('0x1b'),_0x49a6e5['body'][_0xb9dc('0x19')]);var _0x2eefd9=process[_0xb9dc('0x1c')]();process[_0xb9dc('0x1d')](path[_0xb9dc('0x1e')](_0x53554d));return execChildProcess()[_0xb9dc('0xf')](function(_0x4870bc){process[_0xb9dc('0x1d')](_0x2eefd9);return pm2[_0xb9dc('0x1f')]({'name':_0x49a6e5[_0xb9dc('0x18')]['name'],'script':_0x53554d});})[_0xb9dc('0xf')](function(_0x3e9e9a){pm2[_0xb9dc('0x20')]();return _0x3e9e9a[0x0];})[_0xb9dc('0xf')](respondWithResult(_0x1febd0,0xc9))[_0xb9dc('0x14')](handleError(_0x1febd0,null));}else{return _0x1febd0[_0xb9dc('0x8')](0x1f4)['send']({'message':_0xb9dc('0x21')});}};exports[_0xb9dc('0x22')]=function(_0x479514,_0x4aa789){if(_0x479514[_0xb9dc('0x18')]['id']){delete _0x479514[_0xb9dc('0x18')]['id'];}var _0x5aeb68={'online':_0xb9dc('0x23'),'stopped':_0xb9dc('0x24')};if(_0x5aeb68[_0xb9dc('0x25')](_0x479514[_0xb9dc('0x18')]['status'])){return pm2[_0x5aeb68[_0x479514[_0xb9dc('0x18')]['status']]](_0x479514[_0xb9dc('0x26')]['id'])[_0xb9dc('0xf')](respondWithResult(_0x4aa789,0xc8))[_0xb9dc('0x14')](handleError(_0x4aa789,null));}else{return _0x4aa789[_0xb9dc('0x8')](0x1f4)[_0xb9dc('0xc')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x34e8bb,_0x44312e){if(_0x34e8bb['body']['id']){delete _0x34e8bb[_0xb9dc('0x18')]['id'];}if(_0x34e8bb['params']['id']){return pm2[_0xb9dc('0x27')](_0x34e8bb['params']['id'])['then'](function(_0x50879a){pm2['dump']();return _0x50879a[0x0];})['then'](respondWithResult(_0x44312e,null))[_0xb9dc('0x14')](handleError(_0x44312e,null));}else{return _0x44312e['status'](0x1f4)['send']({'message':_0xb9dc('0x28')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 78caa2d..88081a7 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 _0xa7fa=['fs-extra','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','express','Router'];(function(_0xe3b2c8,_0x1d4ffe){var _0x1a72db=function(_0x1c4c19){while(--_0x1c4c19){_0xe3b2c8['push'](_0xe3b2c8['shift']());}};_0x1a72db(++_0x1d4ffe);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaa7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa7f('0x1'));var express=require(_0xaa7f('0x2'));var router=express[_0xaa7f('0x3')]();var fs_extra=require(_0xaa7f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaa7f('0x5'));var config=require(_0xaa7f('0x6'));module[_0xaa7f('0x7')]=router; \ No newline at end of file +var _0x12c9=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x12c9,0x9f));var _0x912c=function(_0x1d9df3,_0x3c72da){_0x1d9df3=_0x1d9df3-0x0;var _0x187ad3=_0x12c9[_0x1d9df3];return _0x187ad3;};'use strict';var multer=require(_0x912c('0x0'));var util=require('util');var path=require(_0x912c('0x1'));var timeout=require('connect-timeout');var express=require(_0x912c('0x2'));var router=express['Router']();var fs_extra=require(_0x912c('0x3'));var auth=require(_0x912c('0x4'));var interaction=require(_0x912c('0x5'));var config=require(_0x912c('0x6'));module[_0x912c('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 4c10b58..29610df 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 _0x8582=['DATE','STRING','sequelize','exports','INTEGER'];(function(_0x5af70e,_0x461eab){var _0x13ef35=function(_0x11a772){while(--_0x11a772){_0x5af70e['push'](_0x5af70e['shift']());}};_0x13ef35(++_0x461eab);}(_0x8582,0x156));var _0x2858=function(_0x11bc08,_0x1f8e73){_0x11bc08=_0x11bc08-0x0;var _0x3f574e=_0x8582[_0x11bc08];return _0x3f574e;};'use strict';var Sequelize=require(_0x2858('0x0'));module[_0x2858('0x1')]={'state':{'type':Sequelize[_0x2858('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2858('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2858('0x3')]},'responsetime':{'type':Sequelize[_0x2858('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x2858('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2858('0x4')]}}; \ No newline at end of file +var _0xa10c=['sequelize','exports','INTEGER','STRING'];(function(_0x34d746,_0x3be498){var _0x1d4b81=function(_0x3e4b49){while(--_0x3e4b49){_0x34d746['push'](_0x34d746['shift']());}};_0x1d4b81(++_0x3be498);}(_0xa10c,0x1bc));var _0xca10=function(_0x2520f5,_0x8d148d){_0x2520f5=_0x2520f5-0x0;var _0x2b52fd=_0xa10c[_0x2520f5];return _0x2b52fd;};'use strict';var Sequelize=require(_0xca10('0x0'));module[_0xca10('0x1')]={'state':{'type':Sequelize[_0xca10('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xca10('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xca10('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xca10('0x3')]},'membername':{'type':Sequelize[_0xca10('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 293cfa2..cbaa55d 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 _0x51b5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./reportAgentPreview.attributes','define'];(function(_0x4848d2,_0x1a1591){var _0x5deadd=function(_0x33b181){while(--_0x33b181){_0x4848d2['push'](_0x4848d2['shift']());}};_0x5deadd(++_0x1a1591);}(_0x51b5,0x78));var _0x551b=function(_0x256207,_0x494d43){_0x256207=_0x256207-0x0;var _0x888a8c=_0x51b5[_0x256207];return _0x888a8c;};'use strict';var _=require(_0x551b('0x0'));var util=require(_0x551b('0x1'));var logger=require(_0x551b('0x2'))(_0x551b('0x3'));var moment=require(_0x551b('0x4'));var BPromise=require(_0x551b('0x5'));var rp=require(_0x551b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x551b('0x7'));var attributes=require(_0x551b('0x8'));module['exports']=function(_0x1f94a2,_0x2323ef){return _0x1f94a2[_0x551b('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x325d=['../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','request-promise'];(function(_0x180417,_0x3b2597){var _0x2a5d24=function(_0x5dec6a){while(--_0x5dec6a){_0x180417['push'](_0x180417['shift']());}};_0x2a5d24(++_0x3b2597);}(_0x325d,0x131));var _0xd325=function(_0x4339f2,_0x66bbaf){_0x4339f2=_0x4339f2-0x0;var _0x324916=_0x325d[_0x4339f2];return _0x324916;};'use strict';var _=require(_0xd325('0x0'));var util=require(_0xd325('0x1'));var logger=require(_0xd325('0x2'))(_0xd325('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd325('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd325('0x5'));var attributes=require(_0xd325('0x6'));module['exports']=function(_0x32b402,_0x5df833){return _0x32b402[_0xd325('0x7')](_0xd325('0x8'),attributes,{'tableName':_0xd325('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 8b4d0f8..b19730f 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 _0x67f1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird'];(function(_0x2adc73,_0x3ab1d1){var _0x432a38=function(_0x5dc7e5){while(--_0x5dc7e5){_0x2adc73['push'](_0x2adc73['shift']());}};_0x432a38(++_0x3ab1d1);}(_0x67f1,0x13c));var _0x167f=function(_0x10b494,_0x135478){_0x10b494=_0x10b494-0x0;var _0x527133=_0x67f1[_0x10b494];return _0x527133;};'use strict';var _=require(_0x167f('0x0'));var util=require(_0x167f('0x1'));var moment=require(_0x167f('0x2'));var BPromise=require(_0x167f('0x3'));var rs=require(_0x167f('0x4'));var fs=require('fs');var Redis=require(_0x167f('0x5'));var db=require(_0x167f('0x6'))['db'];var utils=require(_0x167f('0x7'));var logger=require(_0x167f('0x8'))(_0x167f('0x9'));var config=require('../../config/environment');var jayson=require(_0x167f('0xa'));var client=jayson[_0x167f('0xb')][_0x167f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55da5c,_0x19f20e,_0x26c797){return new BPromise(function(_0x22930f,_0x326577){return client[_0x167f('0xd')](_0x55da5c,_0x26c797)[_0x167f('0xe')](function(_0xc2cc27){logger[_0x167f('0xf')](_0x167f('0x10'),_0x19f20e,'request\x20sent');logger[_0x167f('0x11')](_0x167f('0x12'),_0x19f20e,'request\x20sent',JSON[_0x167f('0x13')](_0xc2cc27));if(_0xc2cc27[_0x167f('0x14')]){if(_0xc2cc27[_0x167f('0x14')][_0x167f('0x15')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x19f20e,_0xc2cc27[_0x167f('0x14')][_0x167f('0x16')]);return _0x326577(_0xc2cc27[_0x167f('0x14')][_0x167f('0x16')]);}logger[_0x167f('0x14')](_0x167f('0x10'),_0x19f20e,_0xc2cc27[_0x167f('0x14')][_0x167f('0x16')]);return _0x22930f(_0xc2cc27[_0x167f('0x14')]['message']);}else{logger[_0x167f('0xf')](_0x167f('0x10'),_0x19f20e,_0x167f('0x17'));_0x22930f(_0xc2cc27[_0x167f('0x18')][_0x167f('0x16')]);}})[_0x167f('0x19')](function(_0x370979){logger[_0x167f('0x14')](_0x167f('0x10'),_0x19f20e,_0x370979);_0x326577(_0x370979);});});}exports[_0x167f('0x1a')]=function(_0x3c1ffd){var _0x18d12e=this;return new Promise(function(_0x2f8da8,_0x95a5da){return db[_0x167f('0x1b')][_0x167f('0x1c')](_0x3c1ffd[_0x167f('0x1d')],{'raw':_0x3c1ffd[_0x167f('0x1e')]?_0x3c1ffd[_0x167f('0x1e')][_0x167f('0x1f')]===undefined?!![]:![]:!![]})[_0x167f('0xe')](function(_0x4528be){logger[_0x167f('0xf')](_0x167f('0x1a'),_0x3c1ffd);logger[_0x167f('0x11')](_0x167f('0x1a'),_0x3c1ffd,JSON['stringify'](_0x4528be));_0x2f8da8(_0x4528be);})[_0x167f('0x19')](function(_0x343f9b){logger[_0x167f('0x14')](_0x167f('0x1a'),_0x343f9b['message'],_0x3c1ffd);_0x95a5da(_0x18d12e[_0x167f('0x14')](0x1f4,_0x343f9b['message']));});});}; \ No newline at end of file +var _0x8452=['catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','randomstring','ioredis','../../mysqldb','rpc','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x8452,0x157));var _0x2845=function(_0xb6bddf,_0x2372c3){_0xb6bddf=_0xb6bddf-0x0;var _0x1a7749=_0x8452[_0xb6bddf];return _0x1a7749;};'use strict';var _=require('lodash');var util=require(_0x2845('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2845('0x1'));var fs=require('fs');var Redis=require(_0x2845('0x2'));var db=require(_0x2845('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2845('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2845('0x5')][_0x2845('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3d00af,_0x3e216b,_0x549514){return new BPromise(function(_0x49dc24,_0x309d73){return client['request'](_0x3d00af,_0x549514)[_0x2845('0x7')](function(_0x5c3c3f){logger[_0x2845('0x8')](_0x2845('0x9'),_0x3e216b,_0x2845('0xa'));logger[_0x2845('0xb')](_0x2845('0xc'),_0x3e216b,'request\x20sent',JSON[_0x2845('0xd')](_0x5c3c3f));if(_0x5c3c3f[_0x2845('0xe')]){if(_0x5c3c3f['error']['code']===0x1f4){logger[_0x2845('0xe')](_0x2845('0x9'),_0x3e216b,_0x5c3c3f[_0x2845('0xe')][_0x2845('0xf')]);return _0x309d73(_0x5c3c3f['error']['message']);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x3e216b,_0x5c3c3f[_0x2845('0xe')][_0x2845('0xf')]);return _0x49dc24(_0x5c3c3f[_0x2845('0xe')]['message']);}else{logger[_0x2845('0x8')](_0x2845('0x9'),_0x3e216b,_0x2845('0xa'));_0x49dc24(_0x5c3c3f[_0x2845('0x10')]['message']);}})[_0x2845('0x11')](function(_0x3182b7){logger['error'](_0x2845('0x9'),_0x3e216b,_0x3182b7);_0x309d73(_0x3182b7);});});}exports[_0x2845('0x12')]=function(_0x3a6a72){var _0x405904=this;return new Promise(function(_0x170b28,_0x373ac2){return db[_0x2845('0x13')][_0x2845('0x14')](_0x3a6a72[_0x2845('0x15')],{'raw':_0x3a6a72[_0x2845('0x16')]?_0x3a6a72[_0x2845('0x16')][_0x2845('0x17')]===undefined?!![]:![]:!![]})[_0x2845('0x7')](function(_0x545eab){logger['info']('CreateReportAgentPreview',_0x3a6a72);logger[_0x2845('0xb')](_0x2845('0x12'),_0x3a6a72,JSON[_0x2845('0xd')](_0x545eab));_0x170b28(_0x545eab);})[_0x2845('0x11')](function(_0x390907){logger[_0x2845('0xe')](_0x2845('0x12'),_0x390907[_0x2845('0xf')],_0x3a6a72);_0x373ac2(_0x405904[_0x2845('0xe')](0x1f4,_0x390907[_0x2845('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index aa80599..64d6e88 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 _0xe36b=['showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','./rpc.controller','/voice/channels','isAuthenticated','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id'];(function(_0x42d5a9,_0x84e690){var _0x55fa7b=function(_0x3b43c4){while(--_0x3b43c4){_0x42d5a9['push'](_0x42d5a9['shift']());}};_0x55fa7b(++_0x84e690);}(_0xe36b,0xb9));var _0xbe36=function(_0x490cc7,_0x27962c){_0x490cc7=_0x490cc7-0x0;var _0x4f79ce=_0xe36b[_0x490cc7];return _0x4f79ce;};'use strict';var multer=require(_0xbe36('0x0'));var util=require(_0xbe36('0x1'));var path=require(_0xbe36('0x2'));var express=require(_0xbe36('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xbe36('0x4'));router['get'](_0xbe36('0x5'),auth[_0xbe36('0x6')](),controller['voiceChannels']);router[_0xbe36('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xbe36('0x6')](),controller[_0xbe36('0x8')]);router[_0xbe36('0x7')](_0xbe36('0x9'),auth[_0xbe36('0x6')](),controller[_0xbe36('0xa')]);router[_0xbe36('0x7')]('/voice/queues',auth['isAuthenticated'](),controller[_0xbe36('0xb')]);router[_0xbe36('0x7')](_0xbe36('0xc'),auth[_0xbe36('0x6')](),controller[_0xbe36('0xd')]);router['get'](_0xbe36('0xe'),auth[_0xbe36('0x6')](),controller[_0xbe36('0xf')]);router[_0xbe36('0x7')](_0xbe36('0x10'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x11')]);router[_0xbe36('0x7')](_0xbe36('0x12'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x13')]);router['get'](_0xbe36('0x14'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x15')]);router[_0xbe36('0x7')](_0xbe36('0x16'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xbe36('0x7')]('/fax/queues',auth[_0xbe36('0x6')](),controller['faxQueues']);router['get'](_0xbe36('0x17'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x18')]);router[_0xbe36('0x7')](_0xbe36('0x19'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x1a')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0xbe36('0x6')](),controller[_0xbe36('0x1b')]);router['get'](_0xbe36('0x1c'),auth['isAuthenticated'](),controller[_0xbe36('0x1d')]);router[_0xbe36('0x7')](_0xbe36('0x1e'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x1f')]);router[_0xbe36('0x7')](_0xbe36('0x20'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x21')]);router[_0xbe36('0x22')](_0xbe36('0x20'),auth[_0xbe36('0x6')](),controller['updateVoiceQueue']);router[_0xbe36('0x7')](_0xbe36('0x23'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x24')]);router[_0xbe36('0x7')](_0xbe36('0x25'),auth['isAuthenticated'](),controller[_0xbe36('0x26')]);router[_0xbe36('0x7')](_0xbe36('0x27'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x28')]);router[_0xbe36('0x22')](_0xbe36('0x29'),auth['isAuthenticated'](),controller[_0xbe36('0x2a')]);router[_0xbe36('0x7')](_0xbe36('0x2b'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x2c')]);router[_0xbe36('0x7')](_0xbe36('0x2d'),auth['isAuthenticated'](),controller[_0xbe36('0x2e')]);router[_0xbe36('0x7')](_0xbe36('0x2f'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x30')]);router[_0xbe36('0x7')](_0xbe36('0x31'),auth[_0xbe36('0x6')](),controller['faxAccounts']);router['get'](_0xbe36('0x32'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x33')]);router[_0xbe36('0x7')](_0xbe36('0x34'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x35')]);router['get']('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xbe36('0x36')]);router['get'](_0xbe36('0x37'),auth['isAuthenticated'](),controller[_0xbe36('0x38')]);router['get'](_0xbe36('0x39'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x3a')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xbe36('0x6')](),controller[_0xbe36('0x3b')]);router[_0xbe36('0x7')]('/fax/queues/waitinginteractions',auth[_0xbe36('0x6')](),controller[_0xbe36('0x3c')]);router[_0xbe36('0x3d')](_0xbe36('0x3e'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x3f')](_0xbe36('0x40')));router['get'](_0xbe36('0x41'),auth['isAuthenticated'](),controller[_0xbe36('0x42')]);router['post'](_0xbe36('0x43'),auth['isAuthenticated'](),controller[_0xbe36('0x3f')](_0xbe36('0x44')));router['get'](_0xbe36('0x45'),auth[_0xbe36('0x6')](),controller['showChatQueues']);router['post'](_0xbe36('0x46'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x3f')](_0xbe36('0x47')));router[_0xbe36('0x7')](_0xbe36('0x48'),auth['isAuthenticated'](),controller[_0xbe36('0x49')]);router[_0xbe36('0x3d')](_0xbe36('0x4a'),auth['isAuthenticated'](),controller[_0xbe36('0x3f')]('openchannel'));router['get'](_0xbe36('0x4b'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x4c')]);router[_0xbe36('0x3d')]('/sms/queues/:id/notify',auth[_0xbe36('0x6')](),controller[_0xbe36('0x3f')](_0xbe36('0x4d')));router[_0xbe36('0x3d')](_0xbe36('0x4e'),auth['isAuthenticated'](),controller[_0xbe36('0x3f')](_0xbe36('0x4f')));router[_0xbe36('0x7')](_0xbe36('0x50'),auth[_0xbe36('0x6')](),controller['showSmsQueues']);router[_0xbe36('0x7')](_0xbe36('0x51'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x52')]);router['post'](_0xbe36('0x53'),auth[_0xbe36('0x6')](),controller[_0xbe36('0x54')]);module[_0xbe36('0x55')]=router; \ No newline at end of file +var _0x4c80=['outboundChannels','/agents','put','/agents/:id/capacity','/telephones','telephones','trunks','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','fax','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','showVoiceQueues','updateVoiceQueue','outbound','/outbound/channels'];(function(_0x91b1c6,_0x252190){var _0x2cfb44=function(_0x29c545){while(--_0x29c545){_0x91b1c6['push'](_0x91b1c6['shift']());}};_0x2cfb44(++_0x252190);}(_0x4c80,0x1d9));var _0x04c8=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x4c80[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require(_0x04c8('0x0'));var path=require(_0x04c8('0x1'));var express=require(_0x04c8('0x2'));var router=express[_0x04c8('0x3')]();var auth=require(_0x04c8('0x4'));var controller=require(_0x04c8('0x5'));router['get']('/voice/channels',auth[_0x04c8('0x6')](),controller[_0x04c8('0x7')]);router[_0x04c8('0x8')](_0x04c8('0x9'),auth['isAuthenticated'](),controller[_0x04c8('0xa')]);router['get'](_0x04c8('0xb'),auth[_0x04c8('0x6')](),controller[_0x04c8('0xc')]);router[_0x04c8('0x8')](_0x04c8('0xd'),auth[_0x04c8('0x6')](),controller[_0x04c8('0xe')]);router[_0x04c8('0x8')](_0x04c8('0xf'),auth[_0x04c8('0x6')](),controller[_0x04c8('0x10')]);router[_0x04c8('0x8')](_0x04c8('0x11'),auth[_0x04c8('0x6')](),controller['mailQueues']);router[_0x04c8('0x8')](_0x04c8('0x12'),auth[_0x04c8('0x6')](),controller[_0x04c8('0x13')]);router[_0x04c8('0x8')](_0x04c8('0x14'),auth[_0x04c8('0x6')](),controller['openchannelQueues']);router['get'](_0x04c8('0x15'),auth['isAuthenticated'](),controller[_0x04c8('0x16')]);router['get'](_0x04c8('0x17'),auth[_0x04c8('0x6')](),controller[_0x04c8('0x18')]);router[_0x04c8('0x8')](_0x04c8('0x19'),auth['isAuthenticated'](),controller[_0x04c8('0x1a')]);router[_0x04c8('0x8')](_0x04c8('0x1b'),auth[_0x04c8('0x6')](),controller[_0x04c8('0x1c')]);router[_0x04c8('0x8')](_0x04c8('0x1d'),auth[_0x04c8('0x6')](),controller['voiceQueuesChannels']);router['get'](_0x04c8('0x1e'),auth[_0x04c8('0x6')](),controller[_0x04c8('0x1f')]);router[_0x04c8('0x8')](_0x04c8('0x20'),auth[_0x04c8('0x6')](),controller[_0x04c8('0x21')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x04c8('0x6')](),controller['voiceQueuesChannelRedirect']);router['get']('/voice/queues/:id',auth[_0x04c8('0x6')](),controller[_0x04c8('0x22')]);router['put']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x04c8('0x23')]);router[_0x04c8('0x8')]('/outbound',auth['isAuthenticated'](),controller[_0x04c8('0x24')]);router['get'](_0x04c8('0x25'),auth['isAuthenticated'](),controller[_0x04c8('0x26')]);router['get'](_0x04c8('0x27'),auth[_0x04c8('0x6')](),controller['agents']);router[_0x04c8('0x28')](_0x04c8('0x29'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x04c8('0x8')](_0x04c8('0x2a'),auth[_0x04c8('0x6')](),controller[_0x04c8('0x2b')]);router[_0x04c8('0x8')]('/trunks',auth[_0x04c8('0x6')](),controller[_0x04c8('0x2c')]);router[_0x04c8('0x8')](_0x04c8('0x2d'),auth[_0x04c8('0x6')](),controller[_0x04c8('0x2e')]);router['get']('/fax/accounts',auth[_0x04c8('0x6')](),controller[_0x04c8('0x2f')]);router['get']('/chat/queues/waitinginteractions',auth[_0x04c8('0x6')](),controller[_0x04c8('0x30')]);router[_0x04c8('0x8')](_0x04c8('0x31'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router['get']('/openchannel/queues/waitinginteractions',auth[_0x04c8('0x6')](),controller[_0x04c8('0x32')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x04c8('0x6')](),controller[_0x04c8('0x33')]);router[_0x04c8('0x8')](_0x04c8('0x34'),auth[_0x04c8('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0x04c8('0x8')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x04c8('0x8')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x04c8('0x35')]);router[_0x04c8('0x36')]('/mail/queues/:id/notify',auth[_0x04c8('0x6')](),controller[_0x04c8('0x37')](_0x04c8('0x38')));router[_0x04c8('0x8')](_0x04c8('0x39'),auth[_0x04c8('0x6')](),controller[_0x04c8('0x3a')]);router[_0x04c8('0x36')](_0x04c8('0x3b'),auth[_0x04c8('0x6')](),controller[_0x04c8('0x37')](_0x04c8('0x3c')));router[_0x04c8('0x8')]('/chat/queues/:id',auth[_0x04c8('0x6')](),controller[_0x04c8('0x3d')]);router['post']('/fax/queues/:id/notify',auth[_0x04c8('0x6')](),controller[_0x04c8('0x37')](_0x04c8('0x3e')));router[_0x04c8('0x8')]('/fax/queues/:id',auth[_0x04c8('0x6')](),controller[_0x04c8('0x3f')]);router[_0x04c8('0x36')](_0x04c8('0x40'),auth[_0x04c8('0x6')](),controller['queueNotify']('openchannel'));router[_0x04c8('0x8')]('/openchannel/queues/:id',auth[_0x04c8('0x6')](),controller[_0x04c8('0x41')]);router['post'](_0x04c8('0x42'),auth['isAuthenticated'](),controller[_0x04c8('0x37')](_0x04c8('0x43')));router[_0x04c8('0x36')](_0x04c8('0x44'),auth[_0x04c8('0x6')](),controller['queueNotify']('whatsapp'));router['get'](_0x04c8('0x45'),auth[_0x04c8('0x6')](),controller['showSmsQueues']);router[_0x04c8('0x8')](_0x04c8('0x46'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x04c8('0x36')](_0x04c8('0x47'),auth[_0x04c8('0x6')](),controller['agentNotify']);module[_0x04c8('0x48')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 4f3d050..4cc238e 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 _0xfdcd=['params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','user','interaction','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','agent','internal','AgentCapacity','capacity','Telephones','Trunks','Campaigns','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','MessageId','Start','agentTransferTimeout','bluebird','lodash','../../mysqldb','api','jayson/promise','client','http','request','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor'];(function(_0x1aed1,_0x491dec){var _0xd0b1a6=function(_0x2d915e){while(--_0x2d915e){_0x1aed1['push'](_0x1aed1['shift']());}};_0xd0b1a6(++_0x491dec);}(_0xfdcd,0xe0));var _0xdfdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdcd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xdfdc('0x0'));var moment=require('moment');var _=require(_0xdfdc('0x1'));var util=require('util');var db=require(_0xdfdc('0x2'))['db'];var logger=require('../../config/logger')(_0xdfdc('0x3'));var jayson=require(_0xdfdc('0x4'));var amiClient=jayson[_0xdfdc('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xdfdc('0x5')][_0xdfdc('0x6')]({'port':0x232b});var routingClient=jayson[_0xdfdc('0x5')][_0xdfdc('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x1a7589,_0x517d49,_0x37360b){return new BPromise(function(_0x14d6cc,_0x1b3ce3){var _0x29de97=_0x37360b?_0x37360b:amiClient;return _0x29de97[_0xdfdc('0x7')](_0x1a7589,_0x517d49)['then'](function(_0x32fcae){if(_0x32fcae['error']){if(_0x32fcae[_0xdfdc('0x8')][_0xdfdc('0x9')]===0x1f4){return _0x1b3ce3(_0x32fcae['error'][_0xdfdc('0xa')]);}return _0x14d6cc(_0x32fcae[_0xdfdc('0x8')]['message']);}else{_0x14d6cc(_0x32fcae[_0xdfdc('0xb')]);}})[_0xdfdc('0xc')](function(_0x351ee6){_0x1b3ce3(_0x351ee6);});});}function respondWithResult(_0x1d407a,_0x21af0a){_0x21af0a=_0x21af0a||0xc8;return function(_0x306f7f){if(_0x306f7f){return _0x1d407a[_0xdfdc('0xd')](_0x21af0a)[_0xdfdc('0xe')](_0x306f7f);}return _0x1d407a[_0xdfdc('0xf')](0x194);};}function handleError(_0x2e6d62,_0x13b7e7){_0x13b7e7=_0x13b7e7||0x1f4;return function(_0x29a894){logger[_0xdfdc('0x8')](_0x29a894[_0xdfdc('0x10')]);if(_0x29a894[_0xdfdc('0x11')]){delete _0x29a894[_0xdfdc('0x11')];}_0x2e6d62['status'](_0x13b7e7)[_0xdfdc('0x12')](_0x29a894);};}function findById(_0x59c715){return function(_0x4d5002){if(!_[_0xdfdc('0x13')](_0x59c715)&&!_['isNil'](_0x4d5002)&&!_[_0xdfdc('0x13')](_0x4d5002[_0xdfdc('0x14')])){return _[_0xdfdc('0x15')](_0x4d5002[_0xdfdc('0x14')],function(_0x6a732){return _0x6a732['id']==_0x59c715;});}return null;};}exports[_0xdfdc('0x16')]=function(_0x205dde,_0x22d1f1){return respondWithRpcPromise(_0xdfdc('0x17'),_0x205dde[_0xdfdc('0x18')])[_0xdfdc('0x19')](respondWithResult(_0x22d1f1,null))['catch'](handleError(_0x22d1f1,null));};exports[_0xdfdc('0x1a')]=function(_0x2f3545,_0x5929b6){return respondWithRpcPromise(_0xdfdc('0x1b'),_['merge'](_0x2f3545[_0xdfdc('0x18')],_0x2f3545[_0xdfdc('0x1c')]))[_0xdfdc('0x19')](respondWithResult(_0x5929b6,null))[_0xdfdc('0xc')](handleError(_0x5929b6,null));};exports[_0xdfdc('0x1d')]=function(_0x536194,_0xf4d0b5){return respondWithRpcPromise(_0xdfdc('0x1e'),_[_0xdfdc('0x1f')](_0x536194[_0xdfdc('0x18')],_0x536194[_0xdfdc('0x1c')]))['then'](respondWithResult(_0xf4d0b5,null))[_0xdfdc('0xc')](handleError(_0xf4d0b5,null));};exports['voiceQueues']=function(_0x4e39a5,_0x181304){return respondWithRpcPromise('VoiceQueues',_0x4e39a5['query'])[_0xdfdc('0x19')](respondWithResult(_0x181304,null))['catch'](handleError(_0x181304,null));};exports[_0xdfdc('0x20')]=function(_0x3f5237,_0xf40869){return respondWithRpcPromise('VoiceQueues',_0x3f5237[_0xdfdc('0x18')])[_0xdfdc('0x19')](findById(_0x3f5237['params']['id']))['then'](respondWithResult(_0xf40869,null))[_0xdfdc('0xc')](handleError(_0xf40869,null));};exports[_0xdfdc('0x21')]=function(_0x48adcd,_0x9f683c){return respondWithRpcPromise(_0xdfdc('0x22'),_[_0xdfdc('0x1f')](_0x48adcd[_0xdfdc('0x23')],_0x48adcd[_0xdfdc('0x1c')]))[_0xdfdc('0x19')](respondWithResult(_0x9f683c,null))[_0xdfdc('0xc')](handleError(_0x9f683c,null));};exports[_0xdfdc('0x24')]=function(_0x4d3398,_0x5dd5b0){return respondWithRpcPromise(_0xdfdc('0x25'),_[_0xdfdc('0x1f')](_0x4d3398[_0xdfdc('0x18')],_0x4d3398[_0xdfdc('0x1c')]))[_0xdfdc('0x19')](respondWithResult(_0x5dd5b0,null))[_0xdfdc('0xc')](handleError(_0x5dd5b0,null));};exports[_0xdfdc('0x26')]=function(_0xad2b2f,_0x536138){return respondWithRpcPromise(_0xdfdc('0x27'),_0xad2b2f['query'])[_0xdfdc('0x19')](respondWithResult(_0x536138,null))['catch'](handleError(_0x536138,null));};exports[_0xdfdc('0x28')]=function(_0x2f0c07,_0x1ab6b0){return respondWithRpcPromise(_0xdfdc('0x29'),_[_0xdfdc('0x1f')](_0x2f0c07[_0xdfdc('0x18')],_0x2f0c07[_0xdfdc('0x1c')]))[_0xdfdc('0x19')](respondWithResult(_0x1ab6b0,null))['catch'](handleError(_0x1ab6b0,null));};exports[_0xdfdc('0x2a')]=function(_0x50acef,_0x33ff18){return respondWithRpcPromise(_0xdfdc('0x2b'),_[_0xdfdc('0x1f')](_0x50acef[_0xdfdc('0x18')],_0x50acef['params']))['then'](respondWithResult(_0x33ff18,null))[_0xdfdc('0xc')](handleError(_0x33ff18,null));};exports[_0xdfdc('0x2c')]=function(_0x16607d,_0x1e5f4d){return respondWithRpcPromise(_0xdfdc('0x2d'),_[_0xdfdc('0x1f')](_0x16607d[_0xdfdc('0x18')],_0x16607d[_0xdfdc('0x1c')]))[_0xdfdc('0x19')](respondWithResult(_0x1e5f4d,null))['catch'](handleError(_0x1e5f4d,null));};exports['outbound']=function(_0x14a3ca,_0x3cdb20){return respondWithRpcPromise(_0xdfdc('0x2e'),_0x14a3ca[_0xdfdc('0x18')])[_0xdfdc('0x19')](respondWithResult(_0x3cdb20,null))[_0xdfdc('0xc')](handleError(_0x3cdb20,null));};exports['outboundChannels']=function(_0x21eb6a,_0x57a00d){return respondWithRpcPromise(_0xdfdc('0x2f'),_0x21eb6a[_0xdfdc('0x18')])[_0xdfdc('0x19')](respondWithResult(_0x57a00d,null))[_0xdfdc('0xc')](handleError(_0x57a00d,null));};exports[_0xdfdc('0x30')]=function(_0x2f0076,_0x5242ef){var _0x1df51c;return respondWithRpcPromise('Agents',_0x2f0076[_0xdfdc('0x18')])[_0xdfdc('0x19')](function(_0x30ef2d){_0x1df51c=_0x30ef2d;return respondWithRpcPromise(_0xdfdc('0x31'),_0x2f0076[_0xdfdc('0x18')],routingClient);})[_0xdfdc('0x19')](function(_0x55c38d){return _[_0xdfdc('0x1f')]({},_0x55c38d,_0x1df51c);})['then'](respondWithResult(_0x5242ef,null))[_0xdfdc('0xc')](handleError(_0x5242ef,null));};exports[_0xdfdc('0x32')]=function(_0x46fe39,_0x5d3bc2){if(_0x46fe39[_0xdfdc('0x23')]&&_0x46fe39[_0xdfdc('0x23')]['interaction']&&_0x46fe39[_0xdfdc('0x33')]&&_0x46fe39['user']['name']){for(var _0x5ae5bf in _0x46fe39[_0xdfdc('0x23')][_0xdfdc('0x34')]){if(_0x46fe39[_0xdfdc('0x23')][_0xdfdc('0x34')]['hasOwnProperty'](_0x5ae5bf)){db[_0xdfdc('0x35')]['findAll']({'where':{'channel':_0x5ae5bf,'membername':_0x46fe39[_0xdfdc('0x33')][_0xdfdc('0x11')],'type':_0xdfdc('0x36'),'exitAt':null,'uniqueid':_0x46fe39['body'][_0xdfdc('0x34')][_0x5ae5bf]&&_0x46fe39[_0xdfdc('0x23')][_0xdfdc('0x34')][_0x5ae5bf][_0xdfdc('0x37')]?{'$notIn':_0x46fe39[_0xdfdc('0x23')]['interaction'][_0x5ae5bf]}:{'$ne':null}}})[_0xdfdc('0x19')](function(_0x2b9475){var _0x50af20=moment()[_0xdfdc('0x38')](_0xdfdc('0x39'));for(var _0x1dc0ed=0x0,_0x1a5fdf=_0x2b9475[_0xdfdc('0x37')];_0x1dc0ed<_0x1a5fdf;_0x1dc0ed+=0x1){_0x2b9475[_0x1dc0ed]['updateAttributes']({'exitAt':_0x50af20});}});for(var _0x3e09c9=0x0;_0x3e09c9<_0x46fe39[_0xdfdc('0x23')]['interaction'][_0x5ae5bf][_0xdfdc('0x37')];_0x3e09c9+=0x1){db[_0xdfdc('0x35')][_0xdfdc('0x3a')]({'where':{'channel':_0x5ae5bf,'membername':_0x46fe39[_0xdfdc('0x33')][_0xdfdc('0x11')],'type':_0xdfdc('0x36'),'uniqueid':_0x46fe39['body']['interaction'][_0x5ae5bf][_0x3e09c9],'exitAt':null},'defaults':{'channel':_0x5ae5bf,'membername':_0x46fe39['user'][_0xdfdc('0x11')],'interface':_[_0xdfdc('0x13')](_0x46fe39[_0xdfdc('0x33')][_0xdfdc('0x3b')])?util[_0xdfdc('0x38')]('SIP/%s',_0x46fe39[_0xdfdc('0x33')]['name']):_0x46fe39[_0xdfdc('0x33')][_0xdfdc('0x3b')],'type':_0xdfdc('0x36'),'enterAt':moment()[_0xdfdc('0x38')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xdfdc('0x3c'),'internal':_0x46fe39['user'][_0xdfdc('0x3d')],'uniqueid':_0x46fe39['body'][_0xdfdc('0x34')][_0x5ae5bf][_0x3e09c9]}});}}}}return respondWithRpcPromise(_0xdfdc('0x3e'),{'id':_0x46fe39[_0xdfdc('0x1c')]['id'],'capacity':_0x46fe39[_0xdfdc('0x23')][_0xdfdc('0x3f')]},routingClient)[_0xdfdc('0x19')](respondWithResult(_0x5d3bc2,null))[_0xdfdc('0xc')](handleError(_0x5d3bc2,null));};exports['telephones']=function(_0x316df6,_0x29a0f0){return respondWithRpcPromise(_0xdfdc('0x40'),_0x316df6[_0xdfdc('0x18')])[_0xdfdc('0x19')](respondWithResult(_0x29a0f0,null))[_0xdfdc('0xc')](handleError(_0x29a0f0,null));};exports['trunks']=function(_0x204db8,_0x386652){return respondWithRpcPromise(_0xdfdc('0x41'),_0x204db8[_0xdfdc('0x18')])['then'](respondWithResult(_0x386652,null))[_0xdfdc('0xc')](handleError(_0x386652,null));};exports['campaigns']=function(_0x39a512,_0x337b7c){return respondWithRpcPromise(_0xdfdc('0x42'),_0x39a512[_0xdfdc('0x18')])[_0xdfdc('0x19')](respondWithResult(_0x337b7c,null))['catch'](handleError(_0x337b7c,null));};exports['chatQueues']=function(_0x223782,_0x5ab91a){return respondWithRpcPromise(_0xdfdc('0x43'),_0x223782[_0xdfdc('0x18')],routingClient)['then'](respondWithResult(_0x5ab91a,null))['catch'](handleError(_0x5ab91a,null));};exports['showChatQueues']=function(_0x4735ea,_0x2d6975){return respondWithRpcPromise(_0xdfdc('0x43'),_0x4735ea[_0xdfdc('0x18')],routingClient)['then'](findById(_0x4735ea[_0xdfdc('0x1c')]['id']))[_0xdfdc('0x19')](respondWithResult(_0x2d6975,null))[_0xdfdc('0xc')](handleError(_0x2d6975,null));};exports[_0xdfdc('0x44')]=function(_0x4596b0,_0x1d46ac){return respondWithRpcPromise(_0xdfdc('0x45'),_0x4596b0['query'],routingClient)['then'](respondWithResult(_0x1d46ac,null))['catch'](handleError(_0x1d46ac,null));};exports[_0xdfdc('0x46')]=function(_0x829151,_0x1e3439){return respondWithRpcPromise(_0xdfdc('0x45'),_0x829151[_0xdfdc('0x18')],routingClient)[_0xdfdc('0x19')](findById(_0x829151[_0xdfdc('0x1c')]['id']))[_0xdfdc('0x19')](respondWithResult(_0x1e3439,null))['catch'](handleError(_0x1e3439,null));};exports['mailAccounts']=function(_0x10cac4,_0x1a0cec){return respondWithRpcPromise(_0xdfdc('0x47'),_0x10cac4['query'],mailClient)[_0xdfdc('0x19')](respondWithResult(_0x1a0cec,null))[_0xdfdc('0xc')](handleError(_0x1a0cec,null));};exports[_0xdfdc('0x48')]=function(_0x5dc699,_0x1ed74a){return respondWithRpcPromise(_0xdfdc('0x49'),_0x5dc699[_0xdfdc('0x18')],routingClient)[_0xdfdc('0x19')](respondWithResult(_0x1ed74a,null))['catch'](handleError(_0x1ed74a,null));};exports[_0xdfdc('0x4a')]=function(_0x41e533,_0x50f791){return respondWithRpcPromise(_0xdfdc('0x49'),_0x41e533['query'],routingClient)[_0xdfdc('0x19')](findById(_0x41e533['params']['id']))[_0xdfdc('0x19')](respondWithResult(_0x50f791,null))[_0xdfdc('0xc')](handleError(_0x50f791,null));};exports[_0xdfdc('0x4b')]=function(_0x4b4e14,_0x37d858){return respondWithRpcPromise(_0xdfdc('0x4c'),_0x4b4e14['query'],routingClient)['then'](respondWithResult(_0x37d858,null))[_0xdfdc('0xc')](handleError(_0x37d858,null));};exports[_0xdfdc('0x4d')]=function(_0x44d7bd,_0x30d74c){return respondWithRpcPromise(_0xdfdc('0x4c'),_0x44d7bd[_0xdfdc('0x18')],routingClient)['then'](findById(_0x44d7bd[_0xdfdc('0x1c')]['id']))['then'](respondWithResult(_0x30d74c,null))[_0xdfdc('0xc')](handleError(_0x30d74c,null));};exports[_0xdfdc('0x4e')]=function(_0x4120f9,_0x32a2f2){return respondWithRpcPromise(_0xdfdc('0x4f'),_0x4120f9[_0xdfdc('0x18')],routingClient)[_0xdfdc('0x19')](respondWithResult(_0x32a2f2,null))['catch'](handleError(_0x32a2f2,null));};exports['showWhatsappQueues']=function(_0x40ffb9,_0xc6dab0){return respondWithRpcPromise('WhatsappQueues',_0x40ffb9[_0xdfdc('0x18')],routingClient)[_0xdfdc('0x19')](findById(_0x40ffb9[_0xdfdc('0x1c')]['id']))[_0xdfdc('0x19')](respondWithResult(_0xc6dab0,null))[_0xdfdc('0xc')](handleError(_0xc6dab0,null));};exports[_0xdfdc('0x50')]=function(_0x21051f,_0x5591da){return respondWithRpcPromise(_0xdfdc('0x51'),_0x21051f[_0xdfdc('0x18')],routingClient)[_0xdfdc('0x19')](respondWithResult(_0x5591da,null))['catch'](handleError(_0x5591da,null));};exports['showFaxQueues']=function(_0x56e61e,_0x42e523){return respondWithRpcPromise(_0xdfdc('0x51'),_0x56e61e[_0xdfdc('0x18')],routingClient)[_0xdfdc('0x19')](findById(_0x56e61e[_0xdfdc('0x1c')]['id']))[_0xdfdc('0x19')](respondWithResult(_0x42e523,null))[_0xdfdc('0xc')](handleError(_0x42e523,null));};exports['faxAccounts']=function(_0x3f6830,_0x5266e5){return respondWithRpcPromise(_0xdfdc('0x52'),_0x3f6830['query'])[_0xdfdc('0x19')](respondWithResult(_0x5266e5,null))['catch'](handleError(_0x5266e5,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fb20b,_0x269d0f){return respondWithRpcPromise(_0xdfdc('0x53'),_0x3fb20b[_0xdfdc('0x18')],routingClient)[_0xdfdc('0x19')](respondWithResult(_0x269d0f,null))['catch'](handleError(_0x269d0f,null));};exports[_0xdfdc('0x54')]=function(_0x3af7d7,_0x298f21){return respondWithRpcPromise(_0xdfdc('0x55'),_0x3af7d7[_0xdfdc('0x18')],routingClient)['then'](respondWithResult(_0x298f21,null))[_0xdfdc('0xc')](handleError(_0x298f21,null));};exports[_0xdfdc('0x56')]=function(_0xafce06,_0x5e5867){return respondWithRpcPromise(_0xdfdc('0x57'),_0xafce06[_0xdfdc('0x18')],routingClient)[_0xdfdc('0x19')](respondWithResult(_0x5e5867,null))[_0xdfdc('0xc')](handleError(_0x5e5867,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x5039b2,_0x14b1a9){return respondWithRpcPromise(_0xdfdc('0x57'),_0x5039b2[_0xdfdc('0x18')],routingClient)['then'](function(_0x5ef0e3){if(_0x5039b2[_0xdfdc('0x18')][_0xdfdc('0x58')]!==undefined){var _0x549b3e=_(_0x5ef0e3[_0xdfdc('0x14')])[_0xdfdc('0x59')]([_0x5039b2[_0xdfdc('0x18')][_0xdfdc('0x58')],_0x5039b2['params']['id']])[_0xdfdc('0x5a')](_0xdfdc('0x5b'))['uniq']()[_0xdfdc('0x5c')]();return _0x5ef0e3[_0xdfdc('0x14')][_0xdfdc('0x59')](function(_0x51ac60){return _0x549b3e[_0xdfdc('0x5d')](_0x51ac60['queue_id'])>-0x1;});}else{return _0x5ef0e3['rows'][_0xdfdc('0x59')](function(_0x2fda77){return _0x2fda77['queue_id']===parseInt(_0x5039b2[_0xdfdc('0x1c')]['id']);});}})['then'](respondWithResult(_0x14b1a9,null))['catch'](handleError(_0x14b1a9,null));};exports['smsQueuesWaitingInteractions']=function(_0x5a7e56,_0x54d4ae){return respondWithRpcPromise(_0xdfdc('0x5e'),_0x5a7e56['query'],routingClient)[_0xdfdc('0x19')](respondWithResult(_0x54d4ae,null))[_0xdfdc('0xc')](handleError(_0x54d4ae,null));};exports[_0xdfdc('0x5f')]=function(_0x55539c,_0x21068e){return respondWithRpcPromise(_0xdfdc('0x60'),_0x55539c[_0xdfdc('0x18')],routingClient)[_0xdfdc('0x19')](respondWithResult(_0x21068e,null))[_0xdfdc('0xc')](handleError(_0x21068e,null));};exports['faxQueuesWaitingInteractions']=function(_0x2f8193,_0x16bdcf){return respondWithRpcPromise(_0xdfdc('0x61'),_0x2f8193['query'],routingClient)[_0xdfdc('0x19')](respondWithResult(_0x16bdcf,null))[_0xdfdc('0xc')](handleError(_0x16bdcf,null));};exports[_0xdfdc('0x62')]=function(_0x57748c){return function(_0x36ae39,_0x4f3b93){var _0x3b5eee,_0x339232;var _0x45bc77=_[_0xdfdc('0x63')](_0x57748c);var _0x30d6ea=_0x57748c==='chat'?_0xdfdc('0x64'):_0xdfdc('0x65');return db[_0x45bc77+_0xdfdc('0x66')][_0xdfdc('0x67')]({'raw':!![],'where':{'id':_0x36ae39[_0xdfdc('0x1c')]['id']}})[_0xdfdc('0x19')](function(_0x1482fe){if(_['isNil'](_0x1482fe)){throw new Error(_0x45bc77+_0xdfdc('0x68'));}_0x3b5eee=_0x1482fe;return db[_0x45bc77+_0xdfdc('0x69')][_0xdfdc('0x67')]({'where':{'id':_0x36ae39[_0xdfdc('0x23')][_0xdfdc('0x6a')]},'include':[{'model':db[_0x45bc77+_0xdfdc('0x6b')],'as':_0xdfdc('0x6b')},{'model':db[_0x45bc77+_0x30d6ea],'as':_0xdfdc('0x65')}]});})[_0xdfdc('0x19')](function(_0x571ccc){if(_[_0xdfdc('0x13')](_0x571ccc)){throw new Error(_0x45bc77+_0xdfdc('0x6c'));}_0x339232=_0x571ccc;return _0x571ccc[_0xdfdc('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdfdc('0x19')](function(){var _0x18deec={'uniqueid':_0x57748c+'.'+_0x339232['id']+'.'+_0x339232[_0xdfdc('0x6b')]['id'],'FromUserId':_0x36ae39[_0xdfdc('0x33')]['id'],'type':_0xdfdc('0x6e')};_0x18deec[_0x45bc77+'MessageId']=_0x339232['id'];_0x18deec[_0x45bc77+_0xdfdc('0x6f')]=_0x339232[_0xdfdc('0x6b')]['id'];_0x18deec[_0xdfdc('0x70')+_0x45bc77+_0x30d6ea+'Id']=_0x339232[_0xdfdc('0x65')]['id'];_0x18deec['To'+_0x45bc77+_0xdfdc('0x71')]=_0x3b5eee['id'];return db[_0x45bc77+_0xdfdc('0x72')][_0xdfdc('0x73')](_0x18deec);})[_0xdfdc('0x19')](function(){return respondWithRpcPromise('Start',{'channel':_0x57748c,'interaction':_0x339232[_0xdfdc('0x6b')],'message':_0x339232,'account':_0x339232['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xdfdc('0x6e'),'appdata':_0x3b5eee[_0xdfdc('0x11')]+','+(_0x339232['Account'][_0xdfdc('0x74')]||0x12c),'interval':_0xdfdc('0x75')}]},routingClient);})['then'](respondWithResult(_0x4f3b93,null))[_0xdfdc('0xc')](handleError(_0x4f3b93,null));};};exports[_0xdfdc('0x76')]=function(_0x18befb,_0x39ef04){var _0x3ec75b,_0x5debfb;if(_['isNil'](_0x18befb['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x5ac02d=_0x18befb['body'][_0xdfdc('0x77')];var _0x46b97d=_['capitalize'](_0x5ac02d);var _0x41d2eb=_0x5ac02d===_0xdfdc('0x78')?_0xdfdc('0x64'):_0xdfdc('0x65');return db[_0xdfdc('0x79')][_0xdfdc('0x67')]({'raw':!![],'where':{'id':_0x18befb[_0xdfdc('0x1c')]['id'],'role':_0xdfdc('0x3c')}})[_0xdfdc('0x19')](function(_0x52602a){if(_[_0xdfdc('0x13')](_0x52602a)){throw new Error(_0xdfdc('0x7a'));}_0x3ec75b=_0x52602a;return db[_0x46b97d+_0xdfdc('0x69')][_0xdfdc('0x67')]({'where':{'id':_0x18befb[_0xdfdc('0x23')][_0xdfdc('0x6a')]},'include':[{'model':db[_0x46b97d+_0xdfdc('0x6b')],'as':_0xdfdc('0x6b')},{'model':db[_0x46b97d+_0x41d2eb],'as':_0xdfdc('0x65')}]});})[_0xdfdc('0x19')](function(_0x347921){if(_[_0xdfdc('0x13')](_0x347921)){throw new Error(_0x46b97d+_0xdfdc('0x6c'));}_0x5debfb=_0x347921;return _0x347921[_0xdfdc('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdfdc('0x19')](function(){var _0x3d5340={'uniqueid':_0x5ac02d+'.'+_0x5debfb['id']+'.'+_0x5debfb['Interaction']['id'],'FromUserId':_0x18befb[_0xdfdc('0x33')]['id'],'type':_0xdfdc('0x6e'),'ToUserId':_0x3ec75b['id']};_0x3d5340[_0x46b97d+_0xdfdc('0x7b')]=_0x5debfb['id'];_0x3d5340[_0x46b97d+_0xdfdc('0x6f')]=_0x5debfb[_0xdfdc('0x6b')]['id'];_0x3d5340[_0xdfdc('0x70')+_0x46b97d+_0x41d2eb+'Id']=_0x5debfb[_0xdfdc('0x65')]['id'];return db[_0x46b97d+'TransferReport'][_0xdfdc('0x73')](_0x3d5340);})[_0xdfdc('0x19')](function(){return respondWithRpcPromise(_0xdfdc('0x7c'),{'channel':_0x5ac02d,'interaction':_0x5debfb[_0xdfdc('0x6b')],'message':_0x5debfb,'account':_0x5debfb['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xdfdc('0x3c'),'appdata':_0x3ec75b[_0xdfdc('0x11')]+','+(_0x5debfb[_0xdfdc('0x65')][_0xdfdc('0x7d')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xdfdc('0x19')](respondWithResult(_0x39ef04,null))[_0xdfdc('0xc')](handleError(_0x39ef04,null));}; \ No newline at end of file +var _0xdce4=['Channel\x20field\x20is\x20mandatory','Message','MessageId','bluebird','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','send','isNil','rows','find','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','format','length','findOrCreate','SIP/%s','interface','YYYY-MM-DD\x20HH:mm:ss','internal','AgentCapacity','telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','Start','*,*,*,*','agentNotify','channel'];(function(_0x543c51,_0xff0084){var _0x360555=function(_0x2a0801){while(--_0x2a0801){_0x543c51['push'](_0x543c51['shift']());}};_0x360555(++_0xff0084);}(_0xdce4,0x186));var _0x4dce=function(_0x3e07bd,_0x3d71df){_0x3e07bd=_0x3e07bd-0x0;var _0x52051b=_0xdce4[_0x3e07bd];return _0x52051b;};'use strict';var BPromise=require(_0x4dce('0x0'));var moment=require('moment');var _=require(_0x4dce('0x1'));var util=require(_0x4dce('0x2'));var db=require(_0x4dce('0x3'))['db'];var logger=require(_0x4dce('0x4'))(_0x4dce('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x4dce('0x6')][_0x4dce('0x7')]({'port':0x232a});var mailClient=jayson[_0x4dce('0x6')][_0x4dce('0x7')]({'port':0x232b});var routingClient=jayson[_0x4dce('0x6')][_0x4dce('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x24c4d4,_0x466422,_0x34af6b){return new BPromise(function(_0x1e51ca,_0x117f50){var _0x136954=_0x34af6b?_0x34af6b:amiClient;return _0x136954[_0x4dce('0x8')](_0x24c4d4,_0x466422)[_0x4dce('0x9')](function(_0x3d749f){if(_0x3d749f[_0x4dce('0xa')]){if(_0x3d749f[_0x4dce('0xa')][_0x4dce('0xb')]===0x1f4){return _0x117f50(_0x3d749f[_0x4dce('0xa')][_0x4dce('0xc')]);}return _0x1e51ca(_0x3d749f['error'][_0x4dce('0xc')]);}else{_0x1e51ca(_0x3d749f[_0x4dce('0xd')]);}})[_0x4dce('0xe')](function(_0x17c940){_0x117f50(_0x17c940);});});}function respondWithResult(_0x4fd4a1,_0x223a33){_0x223a33=_0x223a33||0xc8;return function(_0x4ae912){if(_0x4ae912){return _0x4fd4a1[_0x4dce('0xf')](_0x223a33)[_0x4dce('0x10')](_0x4ae912);}return _0x4fd4a1[_0x4dce('0x11')](0x194);};}function handleError(_0x7e838,_0x79cb07){_0x79cb07=_0x79cb07||0x1f4;return function(_0x4e4cd9){logger[_0x4dce('0xa')](_0x4e4cd9[_0x4dce('0x12')]);if(_0x4e4cd9['name']){delete _0x4e4cd9['name'];}_0x7e838['status'](_0x79cb07)[_0x4dce('0x13')](_0x4e4cd9);};}function findById(_0x3d6f45){return function(_0x48fe80){if(!_[_0x4dce('0x14')](_0x3d6f45)&&!_[_0x4dce('0x14')](_0x48fe80)&&!_[_0x4dce('0x14')](_0x48fe80[_0x4dce('0x15')])){return _[_0x4dce('0x16')](_0x48fe80[_0x4dce('0x15')],function(_0x19f212){return _0x19f212['id']==_0x3d6f45;});}return null;};}exports[_0x4dce('0x17')]=function(_0x1ec2b1,_0x4cab83){return respondWithRpcPromise(_0x4dce('0x18'),_0x1ec2b1[_0x4dce('0x19')])[_0x4dce('0x9')](respondWithResult(_0x4cab83,null))[_0x4dce('0xe')](handleError(_0x4cab83,null));};exports['voiceChannelMixMonitor']=function(_0x45b0a1,_0x5a8164){return respondWithRpcPromise(_0x4dce('0x1a'),_[_0x4dce('0x1b')](_0x45b0a1[_0x4dce('0x19')],_0x45b0a1['params']))['then'](respondWithResult(_0x5a8164,null))[_0x4dce('0xe')](handleError(_0x5a8164,null));};exports[_0x4dce('0x1c')]=function(_0xb119f2,_0x28a019){return respondWithRpcPromise(_0x4dce('0x1d'),_[_0x4dce('0x1b')](_0xb119f2[_0x4dce('0x19')],_0xb119f2[_0x4dce('0x1e')]))[_0x4dce('0x9')](respondWithResult(_0x28a019,null))[_0x4dce('0xe')](handleError(_0x28a019,null));};exports['voiceQueues']=function(_0x3c537f,_0x4892d7){return respondWithRpcPromise(_0x4dce('0x1f'),_0x3c537f[_0x4dce('0x19')])[_0x4dce('0x9')](respondWithResult(_0x4892d7,null))[_0x4dce('0xe')](handleError(_0x4892d7,null));};exports[_0x4dce('0x20')]=function(_0x343e80,_0x45a3d9){return respondWithRpcPromise(_0x4dce('0x1f'),_0x343e80[_0x4dce('0x19')])[_0x4dce('0x9')](findById(_0x343e80[_0x4dce('0x1e')]['id']))[_0x4dce('0x9')](respondWithResult(_0x45a3d9,null))[_0x4dce('0xe')](handleError(_0x45a3d9,null));};exports[_0x4dce('0x21')]=function(_0x1eb83d,_0x390769){return respondWithRpcPromise(_0x4dce('0x22'),_[_0x4dce('0x1b')](_0x1eb83d[_0x4dce('0x23')],_0x1eb83d['params']))[_0x4dce('0x9')](respondWithResult(_0x390769,null))[_0x4dce('0xe')](handleError(_0x390769,null));};exports[_0x4dce('0x24')]=function(_0x3a3ef2,_0x1e70fb){return respondWithRpcPromise(_0x4dce('0x25'),_['merge'](_0x3a3ef2[_0x4dce('0x19')],_0x3a3ef2[_0x4dce('0x1e')]))[_0x4dce('0x9')](respondWithResult(_0x1e70fb,null))['catch'](handleError(_0x1e70fb,null));};exports[_0x4dce('0x26')]=function(_0x49eeb6,_0x211954){return respondWithRpcPromise(_0x4dce('0x27'),_0x49eeb6['query'])[_0x4dce('0x9')](respondWithResult(_0x211954,null))[_0x4dce('0xe')](handleError(_0x211954,null));};exports[_0x4dce('0x28')]=function(_0x52c71c,_0x264907){return respondWithRpcPromise(_0x4dce('0x29'),_[_0x4dce('0x1b')](_0x52c71c[_0x4dce('0x19')],_0x52c71c[_0x4dce('0x1e')]))[_0x4dce('0x9')](respondWithResult(_0x264907,null))[_0x4dce('0xe')](handleError(_0x264907,null));};exports[_0x4dce('0x2a')]=function(_0x1bc184,_0x269e81){return respondWithRpcPromise(_0x4dce('0x2b'),_[_0x4dce('0x1b')](_0x1bc184['query'],_0x1bc184[_0x4dce('0x1e')]))[_0x4dce('0x9')](respondWithResult(_0x269e81,null))['catch'](handleError(_0x269e81,null));};exports['voiceQueuesChannelRedirect']=function(_0x59b0dc,_0x3b0245){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x4dce('0x1b')](_0x59b0dc[_0x4dce('0x19')],_0x59b0dc[_0x4dce('0x1e')]))[_0x4dce('0x9')](respondWithResult(_0x3b0245,null))[_0x4dce('0xe')](handleError(_0x3b0245,null));};exports[_0x4dce('0x2c')]=function(_0x365c18,_0x1dc63c){return respondWithRpcPromise(_0x4dce('0x2d'),_0x365c18[_0x4dce('0x19')])['then'](respondWithResult(_0x1dc63c,null))['catch'](handleError(_0x1dc63c,null));};exports[_0x4dce('0x2e')]=function(_0x4e313d,_0x1f5cd5){return respondWithRpcPromise(_0x4dce('0x2f'),_0x4e313d[_0x4dce('0x19')])['then'](respondWithResult(_0x1f5cd5,null))[_0x4dce('0xe')](handleError(_0x1f5cd5,null));};exports['agents']=function(_0x458a7c,_0x70bb36){var _0x529369;return respondWithRpcPromise('Agents',_0x458a7c[_0x4dce('0x19')])[_0x4dce('0x9')](function(_0x126952){_0x529369=_0x126952;return respondWithRpcPromise(_0x4dce('0x30'),_0x458a7c['query'],routingClient);})[_0x4dce('0x9')](function(_0x3734a1){return _[_0x4dce('0x1b')]({},_0x3734a1,_0x529369);})[_0x4dce('0x9')](respondWithResult(_0x70bb36,null))[_0x4dce('0xe')](handleError(_0x70bb36,null));};exports[_0x4dce('0x31')]=function(_0x22b33b,_0x2f9632){if(_0x22b33b[_0x4dce('0x23')]&&_0x22b33b['body'][_0x4dce('0x32')]&&_0x22b33b[_0x4dce('0x33')]&&_0x22b33b[_0x4dce('0x33')][_0x4dce('0x34')]){for(var _0x481600 in _0x22b33b[_0x4dce('0x23')][_0x4dce('0x32')]){if(_0x22b33b[_0x4dce('0x23')][_0x4dce('0x32')][_0x4dce('0x35')](_0x481600)){db[_0x4dce('0x36')][_0x4dce('0x37')]({'where':{'channel':_0x481600,'membername':_0x22b33b[_0x4dce('0x33')]['name'],'type':_0x4dce('0x38'),'exitAt':null,'uniqueid':_0x22b33b[_0x4dce('0x23')]['interaction'][_0x481600]&&_0x22b33b[_0x4dce('0x23')][_0x4dce('0x32')][_0x481600]['length']?{'$notIn':_0x22b33b['body'][_0x4dce('0x32')][_0x481600]}:{'$ne':null}}})['then'](function(_0x37fcdb){var _0x4c7e64=moment()[_0x4dce('0x39')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0xf33b56=0x0,_0xaab020=_0x37fcdb[_0x4dce('0x3a')];_0xf33b56<_0xaab020;_0xf33b56+=0x1){_0x37fcdb[_0xf33b56]['updateAttributes']({'exitAt':_0x4c7e64});}});for(var _0x154fcd=0x0;_0x154fcd<_0x22b33b[_0x4dce('0x23')][_0x4dce('0x32')][_0x481600][_0x4dce('0x3a')];_0x154fcd+=0x1){db[_0x4dce('0x36')][_0x4dce('0x3b')]({'where':{'channel':_0x481600,'membername':_0x22b33b['user'][_0x4dce('0x34')],'type':'INTERACTION','uniqueid':_0x22b33b['body'][_0x4dce('0x32')][_0x481600][_0x154fcd],'exitAt':null},'defaults':{'channel':_0x481600,'membername':_0x22b33b[_0x4dce('0x33')][_0x4dce('0x34')],'interface':_[_0x4dce('0x14')](_0x22b33b['user']['interface'])?util[_0x4dce('0x39')](_0x4dce('0x3c'),_0x22b33b['user'][_0x4dce('0x34')]):_0x22b33b[_0x4dce('0x33')][_0x4dce('0x3d')],'type':_0x4dce('0x38'),'enterAt':moment()[_0x4dce('0x39')](_0x4dce('0x3e')),'role':'agent','internal':_0x22b33b['user'][_0x4dce('0x3f')],'uniqueid':_0x22b33b[_0x4dce('0x23')][_0x4dce('0x32')][_0x481600][_0x154fcd]}});}}}}return respondWithRpcPromise(_0x4dce('0x40'),{'id':_0x22b33b[_0x4dce('0x1e')]['id'],'capacity':_0x22b33b[_0x4dce('0x23')]['capacity']},routingClient)[_0x4dce('0x9')](respondWithResult(_0x2f9632,null))[_0x4dce('0xe')](handleError(_0x2f9632,null));};exports[_0x4dce('0x41')]=function(_0x33d8d4,_0x4ed15b){return respondWithRpcPromise('Telephones',_0x33d8d4['query'])[_0x4dce('0x9')](respondWithResult(_0x4ed15b,null))[_0x4dce('0xe')](handleError(_0x4ed15b,null));};exports[_0x4dce('0x42')]=function(_0x5e1b37,_0x2baab9){return respondWithRpcPromise(_0x4dce('0x43'),_0x5e1b37[_0x4dce('0x19')])[_0x4dce('0x9')](respondWithResult(_0x2baab9,null))[_0x4dce('0xe')](handleError(_0x2baab9,null));};exports[_0x4dce('0x44')]=function(_0x1183c4,_0x1fce69){return respondWithRpcPromise('Campaigns',_0x1183c4[_0x4dce('0x19')])[_0x4dce('0x9')](respondWithResult(_0x1fce69,null))[_0x4dce('0xe')](handleError(_0x1fce69,null));};exports[_0x4dce('0x45')]=function(_0x33cbfd,_0x1a3998){return respondWithRpcPromise(_0x4dce('0x46'),_0x33cbfd[_0x4dce('0x19')],routingClient)[_0x4dce('0x9')](respondWithResult(_0x1a3998,null))[_0x4dce('0xe')](handleError(_0x1a3998,null));};exports[_0x4dce('0x47')]=function(_0x1ebaa4,_0x1d74ae){return respondWithRpcPromise('ChatQueues',_0x1ebaa4[_0x4dce('0x19')],routingClient)['then'](findById(_0x1ebaa4['params']['id']))[_0x4dce('0x9')](respondWithResult(_0x1d74ae,null))[_0x4dce('0xe')](handleError(_0x1d74ae,null));};exports[_0x4dce('0x48')]=function(_0x1ea3de,_0x2771b5){return respondWithRpcPromise(_0x4dce('0x49'),_0x1ea3de['query'],routingClient)['then'](respondWithResult(_0x2771b5,null))[_0x4dce('0xe')](handleError(_0x2771b5,null));};exports[_0x4dce('0x4a')]=function(_0x55cfb5,_0x300aec){return respondWithRpcPromise(_0x4dce('0x49'),_0x55cfb5[_0x4dce('0x19')],routingClient)[_0x4dce('0x9')](findById(_0x55cfb5[_0x4dce('0x1e')]['id']))[_0x4dce('0x9')](respondWithResult(_0x300aec,null))[_0x4dce('0xe')](handleError(_0x300aec,null));};exports[_0x4dce('0x4b')]=function(_0x1d4f4c,_0x2745ff){return respondWithRpcPromise(_0x4dce('0x4c'),_0x1d4f4c[_0x4dce('0x19')],mailClient)[_0x4dce('0x9')](respondWithResult(_0x2745ff,null))[_0x4dce('0xe')](handleError(_0x2745ff,null));};exports[_0x4dce('0x4d')]=function(_0x35ecaf,_0x2ae842){return respondWithRpcPromise('OpenchannelQueues',_0x35ecaf[_0x4dce('0x19')],routingClient)[_0x4dce('0x9')](respondWithResult(_0x2ae842,null))['catch'](handleError(_0x2ae842,null));};exports[_0x4dce('0x4e')]=function(_0x34d0df,_0x33eb01){return respondWithRpcPromise(_0x4dce('0x4f'),_0x34d0df[_0x4dce('0x19')],routingClient)['then'](findById(_0x34d0df[_0x4dce('0x1e')]['id']))[_0x4dce('0x9')](respondWithResult(_0x33eb01,null))['catch'](handleError(_0x33eb01,null));};exports['smsQueues']=function(_0x24aee1,_0x3e7b9f){return respondWithRpcPromise('SmsQueues',_0x24aee1[_0x4dce('0x19')],routingClient)[_0x4dce('0x9')](respondWithResult(_0x3e7b9f,null))['catch'](handleError(_0x3e7b9f,null));};exports['showSmsQueues']=function(_0x298fef,_0x3f1354){return respondWithRpcPromise(_0x4dce('0x50'),_0x298fef[_0x4dce('0x19')],routingClient)[_0x4dce('0x9')](findById(_0x298fef[_0x4dce('0x1e')]['id']))[_0x4dce('0x9')](respondWithResult(_0x3f1354,null))[_0x4dce('0xe')](handleError(_0x3f1354,null));};exports[_0x4dce('0x51')]=function(_0x3bbcb4,_0x132eb3){return respondWithRpcPromise(_0x4dce('0x52'),_0x3bbcb4['query'],routingClient)[_0x4dce('0x9')](respondWithResult(_0x132eb3,null))[_0x4dce('0xe')](handleError(_0x132eb3,null));};exports[_0x4dce('0x53')]=function(_0x58f483,_0x35ec94){return respondWithRpcPromise(_0x4dce('0x52'),_0x58f483['query'],routingClient)[_0x4dce('0x9')](findById(_0x58f483[_0x4dce('0x1e')]['id']))[_0x4dce('0x9')](respondWithResult(_0x35ec94,null))[_0x4dce('0xe')](handleError(_0x35ec94,null));};exports[_0x4dce('0x54')]=function(_0x107f5f,_0x5631b4){return respondWithRpcPromise(_0x4dce('0x55'),_0x107f5f[_0x4dce('0x19')],routingClient)['then'](respondWithResult(_0x5631b4,null))[_0x4dce('0xe')](handleError(_0x5631b4,null));};exports[_0x4dce('0x56')]=function(_0x532c7c,_0x2e7d33){return respondWithRpcPromise('FaxQueues',_0x532c7c['query'],routingClient)[_0x4dce('0x9')](findById(_0x532c7c[_0x4dce('0x1e')]['id']))[_0x4dce('0x9')](respondWithResult(_0x2e7d33,null))[_0x4dce('0xe')](handleError(_0x2e7d33,null));};exports[_0x4dce('0x57')]=function(_0x193cb8,_0x53cdcd){return respondWithRpcPromise(_0x4dce('0x58'),_0x193cb8['query'])[_0x4dce('0x9')](respondWithResult(_0x53cdcd,null))[_0x4dce('0xe')](handleError(_0x53cdcd,null));};exports[_0x4dce('0x59')]=function(_0x1dc032,_0x20b3f0){return respondWithRpcPromise(_0x4dce('0x5a'),_0x1dc032[_0x4dce('0x19')],routingClient)[_0x4dce('0x9')](respondWithResult(_0x20b3f0,null))[_0x4dce('0xe')](handleError(_0x20b3f0,null));};exports[_0x4dce('0x5b')]=function(_0x511a84,_0x48da89){return respondWithRpcPromise(_0x4dce('0x5c'),_0x511a84[_0x4dce('0x19')],routingClient)[_0x4dce('0x9')](respondWithResult(_0x48da89,null))[_0x4dce('0xe')](handleError(_0x48da89,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2f1711,_0x40c56c){return respondWithRpcPromise(_0x4dce('0x5d'),_0x2f1711['query'],routingClient)[_0x4dce('0x9')](respondWithResult(_0x40c56c,null))['catch'](handleError(_0x40c56c,null));};exports[_0x4dce('0x5e')]=function(_0x1db413,_0x5f33b5){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1db413['query'],routingClient)['then'](function(_0x574fcb){if(_0x1db413[_0x4dce('0x19')][_0x4dce('0x5f')]!==undefined){var _0x4ce178=_(_0x574fcb[_0x4dce('0x15')])[_0x4dce('0x60')]([_0x1db413['query'][_0x4dce('0x5f')],_0x1db413[_0x4dce('0x1e')]['id']])['map'](_0x4dce('0x61'))['uniq']()[_0x4dce('0x62')]();return _0x574fcb['rows'][_0x4dce('0x60')](function(_0x570605){return _0x4ce178[_0x4dce('0x63')](_0x570605['queue_id'])>-0x1;});}else{return _0x574fcb[_0x4dce('0x15')][_0x4dce('0x60')](function(_0x59e0c1){return _0x59e0c1[_0x4dce('0x61')]===parseInt(_0x1db413[_0x4dce('0x1e')]['id']);});}})[_0x4dce('0x9')](respondWithResult(_0x5f33b5,null))[_0x4dce('0xe')](handleError(_0x5f33b5,null));};exports[_0x4dce('0x64')]=function(_0x118375,_0x47bab3){return respondWithRpcPromise(_0x4dce('0x65'),_0x118375[_0x4dce('0x19')],routingClient)[_0x4dce('0x9')](respondWithResult(_0x47bab3,null))[_0x4dce('0xe')](handleError(_0x47bab3,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xb05d23,_0x59e0ba){return respondWithRpcPromise(_0x4dce('0x66'),_0xb05d23[_0x4dce('0x19')],routingClient)[_0x4dce('0x9')](respondWithResult(_0x59e0ba,null))['catch'](handleError(_0x59e0ba,null));};exports[_0x4dce('0x67')]=function(_0x3860b6,_0x255ad8){return respondWithRpcPromise(_0x4dce('0x68'),_0x3860b6[_0x4dce('0x19')],routingClient)[_0x4dce('0x9')](respondWithResult(_0x255ad8,null))[_0x4dce('0xe')](handleError(_0x255ad8,null));};exports[_0x4dce('0x69')]=function(_0xd8b987){return function(_0x584a96,_0x2c5439){var _0x444da6,_0x4e1cdc;var _0x51965b=_[_0x4dce('0x6a')](_0xd8b987);var _0x4ebcf9=_0xd8b987===_0x4dce('0x6b')?_0x4dce('0x6c'):_0x4dce('0x6d');return db[_0x51965b+_0x4dce('0x6e')][_0x4dce('0x6f')]({'raw':!![],'where':{'id':_0x584a96[_0x4dce('0x1e')]['id']}})[_0x4dce('0x9')](function(_0x2b70ed){if(_['isNil'](_0x2b70ed)){throw new Error(_0x51965b+_0x4dce('0x70'));}_0x444da6=_0x2b70ed;return db[_0x51965b+'Message']['findOne']({'where':{'id':_0x584a96['body'][_0x4dce('0x71')]},'include':[{'model':db[_0x51965b+_0x4dce('0x72')],'as':_0x4dce('0x72')},{'model':db[_0x51965b+_0x4ebcf9],'as':'Account'}]});})[_0x4dce('0x9')](function(_0x5cd566){if(_[_0x4dce('0x14')](_0x5cd566)){throw new Error(_0x51965b+_0x4dce('0x73'));}_0x4e1cdc=_0x5cd566;return _0x5cd566[_0x4dce('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4dce('0x9')](function(){var _0xa0dc2d={'uniqueid':_0xd8b987+'.'+_0x4e1cdc['id']+'.'+_0x4e1cdc[_0x4dce('0x72')]['id'],'FromUserId':_0x584a96[_0x4dce('0x33')]['id'],'type':_0x4dce('0x75')};_0xa0dc2d[_0x51965b+'MessageId']=_0x4e1cdc['id'];_0xa0dc2d[_0x51965b+_0x4dce('0x76')]=_0x4e1cdc[_0x4dce('0x72')]['id'];_0xa0dc2d[_0x4dce('0x77')+_0x51965b+_0x4ebcf9+'Id']=_0x4e1cdc[_0x4dce('0x6d')]['id'];_0xa0dc2d['To'+_0x51965b+_0x4dce('0x78')]=_0x444da6['id'];return db[_0x51965b+_0x4dce('0x79')]['create'](_0xa0dc2d);})['then'](function(){return respondWithRpcPromise(_0x4dce('0x7a'),{'channel':_0xd8b987,'interaction':_0x4e1cdc[_0x4dce('0x72')],'message':_0x4e1cdc,'account':_0x4e1cdc[_0x4dce('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x444da6[_0x4dce('0x34')]+','+(_0x4e1cdc[_0x4dce('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x4dce('0x7b')}]},routingClient);})[_0x4dce('0x9')](respondWithResult(_0x2c5439,null))[_0x4dce('0xe')](handleError(_0x2c5439,null));};};exports[_0x4dce('0x7c')]=function(_0x512d0d,_0x2b713e){var _0xa8ee22,_0x49a901;if(_[_0x4dce('0x14')](_0x512d0d[_0x4dce('0x23')][_0x4dce('0x7d')])){throw new Error(_0x4dce('0x7e'));}var _0x1d1705=_0x512d0d['body'][_0x4dce('0x7d')];var _0x4a69df=_['capitalize'](_0x1d1705);var _0x3d0f1a=_0x1d1705===_0x4dce('0x6b')?'Website':_0x4dce('0x6d');return db['User'][_0x4dce('0x6f')]({'raw':!![],'where':{'id':_0x512d0d[_0x4dce('0x1e')]['id'],'role':'agent'}})[_0x4dce('0x9')](function(_0xdc4d40){if(_['isNil'](_0xdc4d40)){throw new Error('Agent\x20not\x20found');}_0xa8ee22=_0xdc4d40;return db[_0x4a69df+_0x4dce('0x7f')][_0x4dce('0x6f')]({'where':{'id':_0x512d0d[_0x4dce('0x23')][_0x4dce('0x71')]},'include':[{'model':db[_0x4a69df+_0x4dce('0x72')],'as':_0x4dce('0x72')},{'model':db[_0x4a69df+_0x3d0f1a],'as':_0x4dce('0x6d')}]});})[_0x4dce('0x9')](function(_0x24d660){if(_[_0x4dce('0x14')](_0x24d660)){throw new Error(_0x4a69df+_0x4dce('0x73'));}_0x49a901=_0x24d660;return _0x24d660[_0x4dce('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4dce('0x9')](function(){var _0x5238d6={'uniqueid':_0x1d1705+'.'+_0x49a901['id']+'.'+_0x49a901[_0x4dce('0x72')]['id'],'FromUserId':_0x512d0d[_0x4dce('0x33')]['id'],'type':'queue','ToUserId':_0xa8ee22['id']};_0x5238d6[_0x4a69df+_0x4dce('0x80')]=_0x49a901['id'];_0x5238d6[_0x4a69df+'InteractionId']=_0x49a901[_0x4dce('0x72')]['id'];_0x5238d6[_0x4dce('0x77')+_0x4a69df+_0x3d0f1a+'Id']=_0x49a901[_0x4dce('0x6d')]['id'];return db[_0x4a69df+'TransferReport']['create'](_0x5238d6);})['then'](function(){return respondWithRpcPromise(_0x4dce('0x7a'),{'channel':_0x1d1705,'interaction':_0x49a901[_0x4dce('0x72')],'message':_0x49a901,'account':_0x49a901[_0x4dce('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0xa8ee22[_0x4dce('0x34')]+','+(_0x49a901[_0x4dce('0x6d')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x4dce('0x9')](respondWithResult(_0x2b713e,null))['catch'](handleError(_0x2b713e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a0a34eb..ad01822 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 _0x892d=['index','isAuthenticated','show','/:id/run','run','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','./schedule.controller','get'];(function(_0x28c30d,_0x206a4d){var _0x55353d=function(_0x4f081f){while(--_0x4f081f){_0x28c30d['push'](_0x28c30d['shift']());}};_0x55353d(++_0x206a4d);}(_0x892d,0x1d3));var _0xd892=function(_0x4877f8,_0x19bf57){_0x4877f8=_0x4877f8-0x0;var _0x433252=_0x892d[_0x4877f8];return _0x433252;};'use strict';var multer=require(_0xd892('0x0'));var util=require(_0xd892('0x1'));var path=require(_0xd892('0x2'));var timeout=require(_0xd892('0x3'));var express=require('express');var router=express[_0xd892('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd892('0x5'));var config=require('../../config/environment');var controller=require(_0xd892('0x6'));router[_0xd892('0x7')]('/',auth['isAuthenticated'](),controller[_0xd892('0x8')]);router['get']('/:id',auth[_0xd892('0x9')](),controller[_0xd892('0xa')]);router[_0xd892('0x7')](_0xd892('0xb'),auth[_0xd892('0x9')](),controller[_0xd892('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd892('0xd')]);router[_0xd892('0xe')](_0xd892('0xf'),auth[_0xd892('0x9')](),controller[_0xd892('0x10')]);router[_0xd892('0x11')](_0xd892('0xf'),auth[_0xd892('0x9')](),controller[_0xd892('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf78e=['../../components/auth/service','../../components/interaction/service','./schedule.controller','isAuthenticated','index','/:id','show','run','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x5f46f4,_0x520e79){var _0x1a4106=function(_0x568344){while(--_0x568344){_0x5f46f4['push'](_0x5f46f4['shift']());}};_0x1a4106(++_0x520e79);}(_0xf78e,0x105));var _0xef78=function(_0x22a81b,_0x51edff){_0x22a81b=_0x22a81b-0x0;var _0x4540aa=_0xf78e[_0x22a81b];return _0x4540aa;};'use strict';var multer=require(_0xef78('0x0'));var util=require(_0xef78('0x1'));var path=require('path');var timeout=require(_0xef78('0x2'));var express=require('express');var router=express[_0xef78('0x3')]();var fs_extra=require(_0xef78('0x4'));var auth=require(_0xef78('0x5'));var interaction=require(_0xef78('0x6'));var config=require('../../config/environment');var controller=require(_0xef78('0x7'));router['get']('/',auth[_0xef78('0x8')](),controller[_0xef78('0x9')]);router['get'](_0xef78('0xa'),auth[_0xef78('0x8')](),controller[_0xef78('0xb')]);router['get']('/:id/run',auth[_0xef78('0x8')](),controller[_0xef78('0xc')]);router[_0xef78('0xd')]('/',auth[_0xef78('0x8')](),controller[_0xef78('0xe')]);router['put'](_0xef78('0xa'),auth[_0xef78('0x8')](),controller[_0xef78('0xf')]);router[_0xef78('0x10')](_0xef78('0xa'),auth[_0xef78('0x8')](),controller[_0xef78('0x11')]);module[_0xef78('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 6a18607..fc33de0 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 _0x7a54=['months','days','hours','xlsx','csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years'];(function(_0x3e926c,_0x233f58){var _0x57eeaf=function(_0x3754c9){while(--_0x3754c9){_0x3e926c['push'](_0x3e926c['shift']());}};_0x57eeaf(++_0x233f58);}(_0x7a54,0x106));var _0x47a5=function(_0x14538e,_0x49b097){_0x14538e=_0x14538e-0x0;var _0x4aa601=_0x7a54[_0x14538e];return _0x4aa601;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'name':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x47a5('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x47a5('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x47a5('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x47a5('0x6')](_0x47a5('0x7'),'quarters',_0x47a5('0x8'),'weeks',_0x47a5('0x9'),_0x47a5('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x47a5('0x9')},'output':{'type':Sequelize['ENUM']('csv','pdf',_0x47a5('0xb')),'allowNull':![],'defaultValue':_0x47a5('0xc')},'type':{'type':Sequelize['ENUM'](_0x47a5('0xd'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x47a5('0x2')]},'cc':{'type':Sequelize[_0x47a5('0xe')]},'bcc':{'type':Sequelize[_0x47a5('0xe')]},'sendIfEmpty':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe3da=['TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','minutes','pdf','xlsx','csv','custom','default'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xae3d('0x0'));module[_0xae3d('0x1')]={'name':{'type':Sequelize[_0xae3d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xae3d('0x2')]},'active':{'type':Sequelize[_0xae3d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xae3d('0x2')],'allowNull':![],'defaultValue':_0xae3d('0x4')},'startAt':{'type':Sequelize[_0xae3d('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xae3d('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xae3d('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xae3d('0x7')](_0xae3d('0x8'),_0xae3d('0x9'),_0xae3d('0xa'),_0xae3d('0xb'),_0xae3d('0xc'),'hours',_0xae3d('0xd')),'allowNull':![],'defaultValue':_0xae3d('0xc')},'output':{'type':Sequelize['ENUM']('csv',_0xae3d('0xe'),_0xae3d('0xf')),'allowNull':![],'defaultValue':_0xae3d('0x10')},'type':{'type':Sequelize[_0xae3d('0x7')](_0xae3d('0x11'),_0xae3d('0x12')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xae3d('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xae3d('0x13')]},'bcc':{'type':Sequelize[_0xae3d('0x13')]},'sendIfEmpty':{'type':Sequelize[_0xae3d('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 9a4d966..79caad8 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 _0x45f2=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','Scheduler','UserProfileResource','error','stack','name','send','merge','body','contact','message','agent','interaction','account','index','map','Schedule','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter'];(function(_0x5cd7a3,_0x1aa14f){var _0x21235d=function(_0x3152a9){while(--_0x3152a9){_0x5cd7a3['push'](_0x5cd7a3['shift']());}};_0x21235d(++_0x1aa14f);}(_0x45f2,0x71));var _0x245f=function(_0xbb1c6a,_0x4a6693){_0xbb1c6a=_0xbb1c6a-0x0;var _0x27e68c=_0x45f2[_0xbb1c6a];return _0x27e68c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x245f('0x0'));var zipdir=require(_0x245f('0x1'));var jsonpatch=require(_0x245f('0x2'));var rp=require(_0x245f('0x3'));var moment=require(_0x245f('0x4'));var BPromise=require(_0x245f('0x5'));var Mustache=require(_0x245f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x245f('0x7'));var csv=require('to-csv');var ejs=require(_0x245f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x245f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x245f('0xa'));var deskjs=require(_0x245f('0xb'));var toCsv=require(_0x245f('0xc'));var querystring=require(_0x245f('0xd'));var Papa=require(_0x245f('0xe'));var Redis=require(_0x245f('0xf'));var authService=require(_0x245f('0x10'));var qs=require(_0x245f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x245f('0x12'));var utils=require(_0x245f('0x13'));var config=require(_0x245f('0x14'));var licenseUtil=require(_0x245f('0x15'));var db=require(_0x245f('0x16'))['db'];function respondWithStatusCode(_0x38122d,_0x2b399e){_0x2b399e=_0x2b399e||0xcc;return function(_0x3888ee){if(_0x3888ee){return _0x38122d[_0x245f('0x17')](_0x2b399e);}return _0x38122d[_0x245f('0x18')](_0x2b399e)[_0x245f('0x19')]();};}function respondWithResult(_0x5e6c4c,_0x5eef33){_0x5eef33=_0x5eef33||0xc8;return function(_0xfa9dd8){if(_0xfa9dd8){return _0x5e6c4c[_0x245f('0x18')](_0x5eef33)['json'](_0xfa9dd8);}};}function respondWithFilteredResult(_0x28bcdd,_0x275469){return function(_0x59c6c3){if(_0x59c6c3){var _0x560d98=typeof _0x275469[_0x245f('0x1a')]==='undefined'&&typeof _0x275469[_0x245f('0x1b')]===_0x245f('0x1c');var _0x271f47=_0x59c6c3[_0x245f('0x1d')];var _0x2e8f4f=_0x560d98?0x0:_0x275469[_0x245f('0x1a')];var _0x40754c=_0x560d98?_0x59c6c3[_0x245f('0x1d')]:_0x275469['offset']+_0x275469['limit'];var _0x1e27fe;if(_0x40754c>=_0x271f47){_0x40754c=_0x271f47;_0x1e27fe=0xc8;}else{_0x1e27fe=0xce;}_0x28bcdd[_0x245f('0x18')](_0x1e27fe);return _0x28bcdd[_0x245f('0x1e')](_0x245f('0x1f'),_0x2e8f4f+'-'+_0x40754c+'/'+_0x271f47)[_0x245f('0x20')](_0x59c6c3);}return null;};}function patchUpdates(_0x1dc2c2){return function(_0x309f0d){try{jsonpatch[_0x245f('0x21')](_0x309f0d,_0x1dc2c2,!![]);}catch(_0x27bc98){return BPromise['reject'](_0x27bc98);}return _0x309f0d[_0x245f('0x22')]();};}function saveUpdates(_0x1fe9c4,_0x38d555){return function(_0x52a18b){if(_0x52a18b){return _0x52a18b[_0x245f('0x23')](_0x1fe9c4)[_0x245f('0x24')](function(_0x2ce7c2){return _0x2ce7c2;});}return null;};}function removeEntity(_0x2318a3,_0x54a426){return function(_0x1726f4){if(_0x1726f4){return _0x1726f4[_0x245f('0x25')]()[_0x245f('0x24')](function(){var _0x79a9a1=_0x1726f4['get']({'plain':!![]});var _0x2db471=_0x245f('0x26');return db[_0x245f('0x27')][_0x245f('0x25')]({'where':{'type':_0x2db471,'resourceId':_0x79a9a1['id']}})[_0x245f('0x24')](function(){return _0x1726f4;});})['then'](function(){_0x2318a3[_0x245f('0x18')](0xcc)[_0x245f('0x19')]();});}};}function handleEntityNotFound(_0x26d8d8,_0x2b3bce){return function(_0x195b2d){if(!_0x195b2d){_0x26d8d8[_0x245f('0x17')](0x194);}return _0x195b2d;};}function handleError(_0x56aa8d,_0x5d3670){_0x5d3670=_0x5d3670||0x1f4;return function(_0x44666b){logger[_0x245f('0x28')](_0x44666b[_0x245f('0x29')]);if(_0x44666b[_0x245f('0x2a')]){delete _0x44666b[_0x245f('0x2a')];}_0x56aa8d[_0x245f('0x18')](_0x5d3670)[_0x245f('0x2b')](_0x44666b);};}function getMustacheRender(_0x5c9344,_0xc13518){return Mustache['render'](_0x5c9344,_[_0x245f('0x2c')](_0xc13518[_0x245f('0x2d')],{'contact':_0xc13518[_0x245f('0x2e')],'message':_0xc13518[_0x245f('0x2f')],'agent':_0xc13518[_0x245f('0x30')],'interaction':_0xc13518[_0x245f('0x31')],'account':_0xc13518[_0x245f('0x32')]}))||'';}exports[_0x245f('0x33')]=function(_0x406d79,_0x1109fd){var _0x563156={},_0x581d65={},_0xebd4b={'count':0x0,'rows':[]};var _0x4e20eb=_[_0x245f('0x34')](db[_0x245f('0x35')]['rawAttributes'],function(_0x427d57){return{'name':_0x427d57[_0x245f('0x36')],'type':_0x427d57[_0x245f('0x37')][_0x245f('0x38')]};});_0x581d65[_0x245f('0x39')]=_[_0x245f('0x34')](_0x4e20eb,_0x245f('0x2a'));_0x581d65[_0x245f('0x3a')]=_[_0x245f('0x3b')](_0x406d79[_0x245f('0x3a')]);_0x581d65[_0x245f('0x3c')]=_['intersection'](_0x581d65[_0x245f('0x39')],_0x581d65[_0x245f('0x3a')]);_0x563156[_0x245f('0x3d')]=_[_0x245f('0x3e')](_0x581d65[_0x245f('0x39')],qs[_0x245f('0x3f')](_0x406d79[_0x245f('0x3a')][_0x245f('0x3f')]));_0x563156[_0x245f('0x3d')]=_0x563156['attributes'][_0x245f('0x40')]?_0x563156['attributes']:_0x581d65[_0x245f('0x39')];if(!_0x406d79['query'][_0x245f('0x41')](_0x245f('0x42'))){_0x563156['limit']=qs[_0x245f('0x1b')](_0x406d79[_0x245f('0x3a')]['limit']);_0x563156[_0x245f('0x1a')]=qs['offset'](_0x406d79[_0x245f('0x3a')]['offset']);}_0x563156[_0x245f('0x43')]=qs['sort'](_0x406d79[_0x245f('0x3a')][_0x245f('0x44')]);_0x563156[_0x245f('0x45')]=qs['filters'](_[_0x245f('0x46')](_0x406d79[_0x245f('0x3a')],_0x581d65['filters']),_0x4e20eb);if(_0x406d79['query']['filter']){_0x563156[_0x245f('0x45')]=_['merge'](_0x563156[_0x245f('0x45')],{'$or':_[_0x245f('0x34')](_0x4e20eb,function(_0x13f5b0){if(_0x13f5b0[_0x245f('0x37')]!==_0x245f('0x47')){var _0x58adca={};_0x58adca[_0x13f5b0[_0x245f('0x2a')]]={'$like':'%'+_0x406d79[_0x245f('0x3a')][_0x245f('0x48')]+'%'};return _0x58adca;}})});}_0x563156=_[_0x245f('0x2c')]({},_0x563156,_0x406d79[_0x245f('0x49')]);var _0x4e44f2={'where':_0x563156[_0x245f('0x45')]};return db['Schedule']['count'](_0x4e44f2)[_0x245f('0x24')](function(_0x5bfed7){_0xebd4b[_0x245f('0x1d')]=_0x5bfed7;if(_0x406d79[_0x245f('0x3a')][_0x245f('0x4a')]){_0x563156[_0x245f('0x4b')]=[{'all':!![]}];}return db[_0x245f('0x35')][_0x245f('0x4c')](_0x563156);})['then'](function(_0xe0e191){_0xebd4b[_0x245f('0x4d')]=_0xe0e191;return _0xebd4b;})[_0x245f('0x24')](respondWithFilteredResult(_0x1109fd,_0x563156))[_0x245f('0x4e')](handleError(_0x1109fd,null));};exports[_0x245f('0x4f')]=function(_0x211251,_0x5abd21){var _0x4648b8={'raw':![],'where':{'id':_0x211251[_0x245f('0x50')]['id']}},_0x4852c7={};_0x4852c7['model']=_['keys'](db['Schedule'][_0x245f('0x51')]);_0x4852c7['query']=_['keys'](_0x211251['query']);_0x4852c7[_0x245f('0x3c')]=_['intersection'](_0x4852c7[_0x245f('0x39')],_0x4852c7[_0x245f('0x3a')]);_0x4648b8['attributes']=_['intersection'](_0x4852c7[_0x245f('0x39')],qs[_0x245f('0x3f')](_0x211251[_0x245f('0x3a')][_0x245f('0x3f')]));_0x4648b8[_0x245f('0x3d')]=_0x4648b8[_0x245f('0x3d')][_0x245f('0x40')]?_0x4648b8['attributes']:_0x4852c7['model'];if(_0x211251['query']['includeAll']){_0x4648b8[_0x245f('0x4b')]=[{'all':!![]}];}_0x4648b8=_[_0x245f('0x2c')]({},_0x4648b8,_0x211251[_0x245f('0x49')]);return db[_0x245f('0x35')][_0x245f('0x52')](_0x4648b8)['then'](handleEntityNotFound(_0x5abd21,null))[_0x245f('0x24')](respondWithResult(_0x5abd21,null))['catch'](handleError(_0x5abd21,null));};exports['create']=function(_0x3f8fea,_0x5c7f68){return db[_0x245f('0x35')][_0x245f('0x53')](_0x3f8fea[_0x245f('0x2d')],{})[_0x245f('0x24')](function(_0x37f89f){var _0x3e1a04=_0x3f8fea[_0x245f('0x54')][_0x245f('0x55')]({'plain':!![]});if(!_0x3e1a04)throw new Error(_0x245f('0x56'));if(_0x3e1a04[_0x245f('0x57')]===_0x245f('0x54')){var _0x58dca1=_0x37f89f[_0x245f('0x55')]({'plain':!![]});var _0x5448bb='Scheduler';return db[_0x245f('0x58')][_0x245f('0x52')]({'where':{'name':_0x5448bb,'userProfileId':_0x3e1a04[_0x245f('0x59')]},'raw':!![]})[_0x245f('0x24')](function(_0x1cc063){if(_0x1cc063&&_0x1cc063[_0x245f('0x5a')]===0x0){return db['UserProfileResource'][_0x245f('0x53')]({'name':_0x58dca1[_0x245f('0x2a')],'resourceId':_0x58dca1['id'],'type':_0x1cc063['name'],'sectionId':_0x1cc063['id']},{})['then'](function(){return _0x37f89f;});}else{return _0x37f89f;}})[_0x245f('0x4e')](function(_0x1b017e){logger[_0x245f('0x28')](_0x245f('0x5b'),_0x1b017e);throw _0x1b017e;});}return _0x37f89f;})['then'](respondWithResult(_0x5c7f68,0xc9))[_0x245f('0x4e')](handleError(_0x5c7f68,null));};exports[_0x245f('0x23')]=function(_0x1ad215,_0x10f72b){if(_0x1ad215[_0x245f('0x2d')]['id']){delete _0x1ad215['body']['id'];}return db['Schedule']['find']({'where':{'id':_0x1ad215[_0x245f('0x50')]['id']}})[_0x245f('0x24')](handleEntityNotFound(_0x10f72b,null))[_0x245f('0x24')](saveUpdates(_0x1ad215[_0x245f('0x2d')],null))['then'](respondWithResult(_0x10f72b,null))[_0x245f('0x4e')](handleError(_0x10f72b,null));};exports[_0x245f('0x25')]=function(_0x2c2ff2,_0x9e3398){return db['Schedule']['find']({'where':{'id':_0x2c2ff2[_0x245f('0x50')]['id']}})['then'](handleEntityNotFound(_0x9e3398,null))[_0x245f('0x24')](removeEntity(_0x9e3398,null))[_0x245f('0x4e')](handleError(_0x9e3398,null));};exports[_0x245f('0x5c')]=function(_0x4dbbfa,_0x59d018,_0x4c5830){var _0x5d604a=require('../../config/schedule');return db[_0x245f('0x35')]['find']({'where':{'id':_0x4dbbfa['params']['id']},'raw':!![]})[_0x245f('0x24')](handleEntityNotFound(_0x59d018,null))['then'](function(){_0x5d604a[_0x245f('0x5c')](_0x4dbbfa[_0x245f('0x50')]['id']);})[_0x245f('0x24')](respondWithStatusCode(_0x59d018,null))['catch'](handleError(_0x59d018,null));}; \ No newline at end of file +var _0x47a2=['Scheduler','destroy','end','error','name','render','merge','body','contact','message','interaction','index','Schedule','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','user','role','get','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','apply','reject','save','update','then'];(function(_0x36a92e,_0x57f43a){var _0x1f083d=function(_0x26e817){while(--_0x26e817){_0x36a92e['push'](_0x36a92e['shift']());}};_0x1f083d(++_0x57f43a);}(_0x47a2,0xd1));var _0x247a=function(_0x3d7318,_0x1dcaf3){_0x3d7318=_0x3d7318-0x0;var _0x50d0e6=_0x47a2[_0x3d7318];return _0x50d0e6;};'use strict';var emlformat=require(_0x247a('0x0'));var rimraf=require(_0x247a('0x1'));var zipdir=require(_0x247a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x247a('0x3'));var moment=require(_0x247a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x247a('0x5'));var util=require('util');var path=require('path');var sox=require(_0x247a('0x6'));var csv=require('to-csv');var ejs=require(_0x247a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x247a('0x8'));var deskjs=require(_0x247a('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x247a('0xa'));var authService=require(_0x247a('0xb'));var qs=require(_0x247a('0xc'));var as=require(_0x247a('0xd'));var hardwareService=require(_0x247a('0xe'));var logger=require(_0x247a('0xf'))(_0x247a('0x10'));var utils=require(_0x247a('0x11'));var config=require(_0x247a('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbd46a,_0x2133b4){_0x2133b4=_0x2133b4||0xcc;return function(_0xa42c){if(_0xa42c){return _0xbd46a[_0x247a('0x13')](_0x2133b4);}return _0xbd46a[_0x247a('0x14')](_0x2133b4)['end']();};}function respondWithResult(_0x7bdc5f,_0x1845b7){_0x1845b7=_0x1845b7||0xc8;return function(_0x4050d7){if(_0x4050d7){return _0x7bdc5f[_0x247a('0x14')](_0x1845b7)[_0x247a('0x15')](_0x4050d7);}};}function respondWithFilteredResult(_0x3756de,_0x36d689){return function(_0x17c26d){if(_0x17c26d){var _0x4bc373=typeof _0x36d689['offset']==='undefined'&&typeof _0x36d689[_0x247a('0x16')]===_0x247a('0x17');var _0x4f8a76=_0x17c26d[_0x247a('0x18')];var _0x1742e7=_0x4bc373?0x0:_0x36d689[_0x247a('0x19')];var _0x57c1e7=_0x4bc373?_0x17c26d[_0x247a('0x18')]:_0x36d689['offset']+_0x36d689['limit'];var _0x258483;if(_0x57c1e7>=_0x4f8a76){_0x57c1e7=_0x4f8a76;_0x258483=0xc8;}else{_0x258483=0xce;}_0x3756de[_0x247a('0x14')](_0x258483);return _0x3756de['set']('Content-Range',_0x1742e7+'-'+_0x57c1e7+'/'+_0x4f8a76)[_0x247a('0x15')](_0x17c26d);}return null;};}function patchUpdates(_0x6f5dcd){return function(_0x3d3b50){try{jsonpatch[_0x247a('0x1a')](_0x3d3b50,_0x6f5dcd,!![]);}catch(_0xccf6ec){return BPromise[_0x247a('0x1b')](_0xccf6ec);}return _0x3d3b50[_0x247a('0x1c')]();};}function saveUpdates(_0x18fcc3,_0x3bbb98){return function(_0x27847e){if(_0x27847e){return _0x27847e[_0x247a('0x1d')](_0x18fcc3)['then'](function(_0x1986e0){return _0x1986e0;});}return null;};}function removeEntity(_0x129a00,_0xb4e535){return function(_0x33b618){if(_0x33b618){return _0x33b618['destroy']()[_0x247a('0x1e')](function(){var _0x247dd0=_0x33b618['get']({'plain':!![]});var _0x2a8072=_0x247a('0x1f');return db['UserProfileResource'][_0x247a('0x20')]({'where':{'type':_0x2a8072,'resourceId':_0x247dd0['id']}})['then'](function(){return _0x33b618;});})[_0x247a('0x1e')](function(){_0x129a00[_0x247a('0x14')](0xcc)[_0x247a('0x21')]();});}};}function handleEntityNotFound(_0x562aab,_0x2a7536){return function(_0x336d37){if(!_0x336d37){_0x562aab[_0x247a('0x13')](0x194);}return _0x336d37;};}function handleError(_0x3bae86,_0x30556a){_0x30556a=_0x30556a||0x1f4;return function(_0x3a3e5b){logger[_0x247a('0x22')](_0x3a3e5b['stack']);if(_0x3a3e5b[_0x247a('0x23')]){delete _0x3a3e5b[_0x247a('0x23')];}_0x3bae86[_0x247a('0x14')](_0x30556a)['send'](_0x3a3e5b);};}function getMustacheRender(_0x31cad3,_0x10f417){return Mustache[_0x247a('0x24')](_0x31cad3,_[_0x247a('0x25')](_0x10f417[_0x247a('0x26')],{'contact':_0x10f417[_0x247a('0x27')],'message':_0x10f417[_0x247a('0x28')],'agent':_0x10f417['agent'],'interaction':_0x10f417[_0x247a('0x29')],'account':_0x10f417['account']}))||'';}exports[_0x247a('0x2a')]=function(_0x4c530b,_0x338b6c){var _0x567858={},_0x52ca60={},_0x4a0eba={'count':0x0,'rows':[]};var _0x92bc33=_['map'](db[_0x247a('0x2b')][_0x247a('0x2c')],function(_0x54c3bb){return{'name':_0x54c3bb[_0x247a('0x2d')],'type':_0x54c3bb[_0x247a('0x2e')]['key']};});_0x52ca60[_0x247a('0x2f')]=_[_0x247a('0x30')](_0x92bc33,_0x247a('0x23'));_0x52ca60[_0x247a('0x31')]=_[_0x247a('0x32')](_0x4c530b[_0x247a('0x31')]);_0x52ca60[_0x247a('0x33')]=_[_0x247a('0x34')](_0x52ca60[_0x247a('0x2f')],_0x52ca60[_0x247a('0x31')]);_0x567858['attributes']=_['intersection'](_0x52ca60[_0x247a('0x2f')],qs[_0x247a('0x35')](_0x4c530b[_0x247a('0x31')][_0x247a('0x35')]));_0x567858[_0x247a('0x36')]=_0x567858['attributes'][_0x247a('0x37')]?_0x567858[_0x247a('0x36')]:_0x52ca60[_0x247a('0x2f')];if(!_0x4c530b[_0x247a('0x31')][_0x247a('0x38')](_0x247a('0x39'))){_0x567858[_0x247a('0x16')]=qs['limit'](_0x4c530b['query'][_0x247a('0x16')]);_0x567858['offset']=qs['offset'](_0x4c530b[_0x247a('0x31')]['offset']);}_0x567858[_0x247a('0x3a')]=qs[_0x247a('0x3b')](_0x4c530b['query']['sort']);_0x567858['where']=qs['filters'](_[_0x247a('0x3c')](_0x4c530b[_0x247a('0x31')],_0x52ca60[_0x247a('0x33')]),_0x92bc33);if(_0x4c530b[_0x247a('0x31')][_0x247a('0x3d')]){_0x567858[_0x247a('0x3e')]=_[_0x247a('0x25')](_0x567858[_0x247a('0x3e')],{'$or':_[_0x247a('0x30')](_0x92bc33,function(_0x42dbed){if(_0x42dbed[_0x247a('0x2e')]!==_0x247a('0x3f')){var _0x56404e={};_0x56404e[_0x42dbed[_0x247a('0x23')]]={'$like':'%'+_0x4c530b[_0x247a('0x31')][_0x247a('0x3d')]+'%'};return _0x56404e;}})});}_0x567858=_[_0x247a('0x25')]({},_0x567858,_0x4c530b[_0x247a('0x40')]);var _0x5621a6={'where':_0x567858['where']};return db['Schedule'][_0x247a('0x18')](_0x5621a6)[_0x247a('0x1e')](function(_0x463c78){_0x4a0eba[_0x247a('0x18')]=_0x463c78;if(_0x4c530b[_0x247a('0x31')][_0x247a('0x41')]){_0x567858[_0x247a('0x42')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x567858);})[_0x247a('0x1e')](function(_0x79cb1b){_0x4a0eba[_0x247a('0x43')]=_0x79cb1b;return _0x4a0eba;})['then'](respondWithFilteredResult(_0x338b6c,_0x567858))['catch'](handleError(_0x338b6c,null));};exports[_0x247a('0x44')]=function(_0x56db49,_0x34fdab){var _0x5f3b5b={'raw':![],'where':{'id':_0x56db49[_0x247a('0x45')]['id']}},_0x3027b4={};_0x3027b4[_0x247a('0x2f')]=_[_0x247a('0x32')](db['Schedule'][_0x247a('0x2c')]);_0x3027b4['query']=_[_0x247a('0x32')](_0x56db49[_0x247a('0x31')]);_0x3027b4[_0x247a('0x33')]=_[_0x247a('0x34')](_0x3027b4[_0x247a('0x2f')],_0x3027b4[_0x247a('0x31')]);_0x5f3b5b['attributes']=_['intersection'](_0x3027b4[_0x247a('0x2f')],qs[_0x247a('0x35')](_0x56db49['query'][_0x247a('0x35')]));_0x5f3b5b['attributes']=_0x5f3b5b[_0x247a('0x36')][_0x247a('0x37')]?_0x5f3b5b['attributes']:_0x3027b4[_0x247a('0x2f')];if(_0x56db49['query']['includeAll']){_0x5f3b5b[_0x247a('0x42')]=[{'all':!![]}];}_0x5f3b5b=_['merge']({},_0x5f3b5b,_0x56db49['options']);return db['Schedule'][_0x247a('0x46')](_0x5f3b5b)[_0x247a('0x1e')](handleEntityNotFound(_0x34fdab,null))['then'](respondWithResult(_0x34fdab,null))[_0x247a('0x47')](handleError(_0x34fdab,null));};exports[_0x247a('0x48')]=function(_0x5c874c,_0x460f6c){return db['Schedule'][_0x247a('0x48')](_0x5c874c[_0x247a('0x26')],{})[_0x247a('0x1e')](function(_0x4def6b){var _0x18ee84=_0x5c874c[_0x247a('0x49')]['get']({'plain':!![]});if(!_0x18ee84)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18ee84[_0x247a('0x4a')]===_0x247a('0x49')){var _0xb50990=_0x4def6b[_0x247a('0x4b')]({'plain':!![]});var _0x20e01c=_0x247a('0x1f');return db['UserProfileSection'][_0x247a('0x46')]({'where':{'name':_0x20e01c,'userProfileId':_0x18ee84['userProfileId']},'raw':!![]})[_0x247a('0x1e')](function(_0x26064d){if(_0x26064d&&_0x26064d['autoAssociation']===0x0){return db[_0x247a('0x4c')][_0x247a('0x48')]({'name':_0xb50990['name'],'resourceId':_0xb50990['id'],'type':_0x26064d['name'],'sectionId':_0x26064d['id']},{})[_0x247a('0x1e')](function(){return _0x4def6b;});}else{return _0x4def6b;}})['catch'](function(_0x255ca6){logger['error'](_0x247a('0x4d'),_0x255ca6);throw _0x255ca6;});}return _0x4def6b;})[_0x247a('0x1e')](respondWithResult(_0x460f6c,0xc9))[_0x247a('0x47')](handleError(_0x460f6c,null));};exports[_0x247a('0x1d')]=function(_0x1058a4,_0x2d7d69){if(_0x1058a4[_0x247a('0x26')]['id']){delete _0x1058a4['body']['id'];}return db['Schedule'][_0x247a('0x46')]({'where':{'id':_0x1058a4['params']['id']}})[_0x247a('0x1e')](handleEntityNotFound(_0x2d7d69,null))[_0x247a('0x1e')](saveUpdates(_0x1058a4[_0x247a('0x26')],null))[_0x247a('0x1e')](respondWithResult(_0x2d7d69,null))['catch'](handleError(_0x2d7d69,null));};exports[_0x247a('0x20')]=function(_0x44f576,_0xd29efe){return db[_0x247a('0x2b')][_0x247a('0x46')]({'where':{'id':_0x44f576[_0x247a('0x45')]['id']}})[_0x247a('0x1e')](handleEntityNotFound(_0xd29efe,null))[_0x247a('0x1e')](removeEntity(_0xd29efe,null))['catch'](handleError(_0xd29efe,null));};exports['run']=function(_0x12e5e6,_0x5506f4,_0x42e426){var _0x1a9771=require(_0x247a('0x4e'));return db[_0x247a('0x2b')][_0x247a('0x46')]({'where':{'id':_0x12e5e6['params']['id']},'raw':!![]})[_0x247a('0x1e')](handleEntityNotFound(_0x5506f4,null))[_0x247a('0x1e')](function(){_0x1a9771[_0x247a('0x4f')](_0x12e5e6[_0x247a('0x45')]['id']);})[_0x247a('0x1e')](respondWithStatusCode(_0x5506f4,null))['catch'](handleError(_0x5506f4,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index f6278d6..a51f978 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 _0x6454=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','util','../../config/logger','moment','request-promise','path'];(function(_0xc3a54a,_0x5363e8){var _0x7ff179=function(_0x2faeaf){while(--_0x2faeaf){_0xc3a54a['push'](_0xc3a54a['shift']());}};_0x7ff179(++_0x5363e8);}(_0x6454,0x193));var _0x4645=function(_0x43cdc5,_0x2f19ba){_0x43cdc5=_0x43cdc5-0x0;var _0x2da6c5=_0x6454[_0x43cdc5];return _0x2da6c5;};'use strict';var _=require('lodash');var util=require(_0x4645('0x0'));var logger=require(_0x4645('0x1'))('api');var moment=require(_0x4645('0x2'));var BPromise=require('bluebird');var rp=require(_0x4645('0x3'));var fs=require('fs');var path=require(_0x4645('0x4'));var rimraf=require(_0x4645('0x5'));var config=require(_0x4645('0x6'));var attributes=require(_0x4645('0x7'));module[_0x4645('0x8')]=function(_0x122152,_0x26c838){return _0x122152[_0x4645('0x9')](_0x4645('0xa'),attributes,{'tableName':_0x4645('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc240=['define','Schedule','tools_schedules','api','bluebird','request-promise','rimraf','./schedule.attributes','exports'];(function(_0x46d514,_0x345f4c){var _0x128225=function(_0x112be1){while(--_0x112be1){_0x46d514['push'](_0x46d514['shift']());}};_0x128225(++_0x345f4c);}(_0xc240,0xc0));var _0x0c24=function(_0x2f023a,_0x410a3f){_0x2f023a=_0x2f023a-0x0;var _0x24238f=_0xc240[_0x2f023a];return _0x24238f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0c24('0x0'));var moment=require('moment');var BPromise=require(_0x0c24('0x1'));var rp=require(_0x0c24('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c24('0x3'));var config=require('../../config/environment');var attributes=require(_0x0c24('0x4'));module[_0x0c24('0x5')]=function(_0x108789,_0x209698){return _0x108789[_0x0c24('0x6')](_0x0c24('0x7'),attributes,{'tableName':_0x0c24('0x8'),'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 d9245e4..0c26282 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 _0x39bc=['../../config/environment','jayson/promise','client','http','request','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x39bc,0x154));var _0xc39b=function(_0x477d24,_0x335155){_0x477d24=_0x477d24-0x0;var _0x31295c=_0x39bc[_0x477d24];return _0x31295c;};'use strict';var _=require(_0xc39b('0x0'));var util=require(_0xc39b('0x1'));var moment=require(_0xc39b('0x2'));var BPromise=require(_0xc39b('0x3'));var rs=require(_0xc39b('0x4'));var fs=require('fs');var Redis=require(_0xc39b('0x5'));var db=require(_0xc39b('0x6'))['db'];var utils=require(_0xc39b('0x7'));var logger=require(_0xc39b('0x8'))(_0xc39b('0x9'));var config=require(_0xc39b('0xa'));var jayson=require(_0xc39b('0xb'));var client=jayson[_0xc39b('0xc')][_0xc39b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x42279a,_0x2f90f1,_0x1f5467){return new BPromise(function(_0x5269be,_0x5bd746){return client[_0xc39b('0xe')](_0x42279a,_0x1f5467)['then'](function(_0x1aea73){logger['info'](_0xc39b('0xf'),_0x2f90f1,_0xc39b('0x10'));logger['debug'](_0xc39b('0x11'),_0x2f90f1,_0xc39b('0x10'),JSON[_0xc39b('0x12')](_0x1aea73));if(_0x1aea73[_0xc39b('0x13')]){if(_0x1aea73[_0xc39b('0x13')][_0xc39b('0x14')]===0x1f4){logger[_0xc39b('0x13')]('Schedule,\x20%s,\x20%s',_0x2f90f1,_0x1aea73['error'][_0xc39b('0x15')]);return _0x5bd746(_0x1aea73['error']['message']);}logger[_0xc39b('0x13')](_0xc39b('0xf'),_0x2f90f1,_0x1aea73[_0xc39b('0x13')]['message']);return _0x5269be(_0x1aea73['error'][_0xc39b('0x15')]);}else{logger[_0xc39b('0x16')]('Schedule,\x20%s,\x20%s',_0x2f90f1,_0xc39b('0x10'));_0x5269be(_0x1aea73[_0xc39b('0x17')][_0xc39b('0x15')]);}})[_0xc39b('0x18')](function(_0x21f03a){logger[_0xc39b('0x13')]('Schedule,\x20%s,\x20%s',_0x2f90f1,_0x21f03a);_0x5bd746(_0x21f03a);});});} \ No newline at end of file +var _0xc510=['catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result'];(function(_0x554fea,_0x3c162a){var _0x139864=function(_0x8ad32c){while(--_0x8ad32c){_0x554fea['push'](_0x554fea['shift']());}};_0x139864(++_0x3c162a);}(_0xc510,0x18d));var _0x0c51=function(_0x4a6992,_0x15fed3){_0x4a6992=_0x4a6992-0x0;var _0x5cbaee=_0xc510[_0x4a6992];return _0x5cbaee;};'use strict';var _=require(_0x0c51('0x0'));var util=require(_0x0c51('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0c51('0x2'));var fs=require('fs');var Redis=require(_0x0c51('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c51('0x4'));var logger=require(_0x0c51('0x5'))(_0x0c51('0x6'));var config=require(_0x0c51('0x7'));var jayson=require(_0x0c51('0x8'));var client=jayson[_0x0c51('0x9')][_0x0c51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a96a7,_0xe43a34,_0x499185){return new BPromise(function(_0xba9a8b,_0x10ed8c){return client[_0x0c51('0xb')](_0x5a96a7,_0x499185)[_0x0c51('0xc')](function(_0x1e6f2b){logger[_0x0c51('0xd')](_0x0c51('0xe'),_0xe43a34,'request\x20sent');logger['debug'](_0x0c51('0xf'),_0xe43a34,'request\x20sent',JSON['stringify'](_0x1e6f2b));if(_0x1e6f2b[_0x0c51('0x10')]){if(_0x1e6f2b[_0x0c51('0x10')][_0x0c51('0x11')]===0x1f4){logger[_0x0c51('0x10')]('Schedule,\x20%s,\x20%s',_0xe43a34,_0x1e6f2b[_0x0c51('0x10')][_0x0c51('0x12')]);return _0x10ed8c(_0x1e6f2b['error']['message']);}logger[_0x0c51('0x10')]('Schedule,\x20%s,\x20%s',_0xe43a34,_0x1e6f2b[_0x0c51('0x10')][_0x0c51('0x12')]);return _0xba9a8b(_0x1e6f2b[_0x0c51('0x10')][_0x0c51('0x12')]);}else{logger[_0x0c51('0xd')](_0x0c51('0xe'),_0xe43a34,_0x0c51('0x13'));_0xba9a8b(_0x1e6f2b[_0x0c51('0x14')]['message']);}})[_0x0c51('0x15')](function(_0x583955){logger[_0x0c51('0x10')]('Schedule,\x20%s,\x20%s',_0xe43a34,_0x583955);_0x10ed8c(_0x583955);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 4f81bc2..aba025f 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 _0xe6d9=['put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0xe6d9,0xa6));var _0x9e6d=function(_0x4b4c3b,_0x121398){_0x4b4c3b=_0x4b4c3b-0x0;var _0x125d77=_0xe6d9[_0x4b4c3b];return _0x125d77;};'use strict';var multer=require(_0x9e6d('0x0'));var util=require(_0x9e6d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e6d('0x2')]();var fs_extra=require(_0x9e6d('0x3'));var auth=require(_0x9e6d('0x4'));var interaction=require(_0x9e6d('0x5'));var config=require('../../config/environment');var controller=require(_0x9e6d('0x6'));router[_0x9e6d('0x7')]('/',auth[_0x9e6d('0x8')](),controller[_0x9e6d('0x9')]);router[_0x9e6d('0x7')](_0x9e6d('0xa'),auth[_0x9e6d('0x8')](),controller[_0x9e6d('0xb')]);router['get'](_0x9e6d('0xc'),auth[_0x9e6d('0x8')](),controller[_0x9e6d('0xd')]);router[_0x9e6d('0x7')](_0x9e6d('0xe'),auth['isAuthenticated'](),controller[_0x9e6d('0xf')]);router[_0x9e6d('0x10')]('/',auth[_0x9e6d('0x8')](),controller[_0x9e6d('0x11')]);router[_0x9e6d('0x12')]('/:id',auth[_0x9e6d('0x8')](),controller[_0x9e6d('0x13')]);router[_0x9e6d('0x14')](_0x9e6d('0xc'),auth['isAuthenticated'](),controller[_0x9e6d('0x15')]);module[_0x9e6d('0x16')]=router; \ No newline at end of file +var _0x25a4=['create','put','/:id','delete','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','download','post'];(function(_0x25e7de,_0x24b676){var _0x5cd6b8=function(_0x38526c){while(--_0x38526c){_0x25e7de['push'](_0x25e7de['shift']());}};_0x5cd6b8(++_0x24b676);}(_0x25a4,0xef));var _0x425a=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0x25a4[_0x28669c];return _0x4a3af6;};'use strict';var multer=require('multer');var util=require(_0x425a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x425a('0x1')]();var fs_extra=require(_0x425a('0x2'));var auth=require(_0x425a('0x3'));var interaction=require(_0x425a('0x4'));var config=require(_0x425a('0x5'));var controller=require(_0x425a('0x6'));router[_0x425a('0x7')]('/',auth[_0x425a('0x8')](),controller['index']);router[_0x425a('0x7')](_0x425a('0x9'),auth[_0x425a('0x8')](),controller[_0x425a('0xa')]);router[_0x425a('0x7')]('/:id',auth[_0x425a('0x8')](),controller['show']);router['get']('/:id/download',auth[_0x425a('0x8')](),controller[_0x425a('0xb')]);router[_0x425a('0xc')]('/',auth['isAuthenticated'](),controller[_0x425a('0xd')]);router[_0x425a('0xe')](_0x425a('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x425a('0x10')](_0x425a('0xf'),auth[_0x425a('0x8')](),controller['destroy']);module[_0x425a('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 90994d0..566574a 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 _0x4b84=['createdAt','sequelize','moment','exports','value','extname','getDataValue','STRING','setDataValue','INTEGER','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x4aa716,_0x5320a0){var _0x332982=function(_0x2088c3){while(--_0x2088c3){_0x4aa716['push'](_0x4aa716['shift']());}};_0x332982(++_0x5320a0);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0x4b84[_0x4cf8d4];return _0x2c1beb;};'use strict';var Sequelize=require(_0x44b8('0x0'));var moment=require(_0x44b8('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x44b8('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x44b8('0x3'))?path[_0x44b8('0x4')](this[_0x44b8('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x44b8('0x6')],'set':function(_0x54274b){var _0x327f59=_0x54274b['replace'](/\\/g,'/');this[_0x44b8('0x7')]('value',_0x327f59);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x44b8('0x8')],'set':function(_0x42319d){this[_0x44b8('0x7')]('startedAt',moment()[_0x44b8('0x9')](_0x42319d,'ms'));this[_0x44b8('0x7')](_0x44b8('0xa'),moment());this[_0x44b8('0x7')](_0x44b8('0xb'),_0x42319d);}},'startedAt':{'type':Sequelize[_0x44b8('0xc')],'get':function(){return moment(this[_0x44b8('0x5')]('startedAt'))[_0x44b8('0xd')](_0x44b8('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x44b8('0xc')],'get':function(){return moment(this['getDataValue'](_0x44b8('0xa')))[_0x44b8('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x44b8('0xf')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x44b8('0x10')))[_0x44b8('0xd')](_0x44b8('0xe'))[_0x44b8('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x44b8('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x44b8('0xf')]();}}}; \ No newline at end of file +var _0xeec6=['value','extname','STRING','replace','setDataValue','INTEGER','closedAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0xeec6,0x1c2));var _0x6eec=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0xeec6[_0x43fdf8];return _0x1160c6;};'use strict';var Sequelize=require(_0x6eec('0x0'));var moment=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var config=require(_0x6eec('0x3'));module['exports']={'format':{'type':Sequelize[_0x6eec('0x4')],'get':function(){return this[_0x6eec('0x5')](_0x6eec('0x6'))?path[_0x6eec('0x7')](this[_0x6eec('0x5')](_0x6eec('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6eec('0x8')]},'value':{'type':Sequelize[_0x6eec('0x8')],'set':function(_0x48064a){var _0x5a5e47=_0x48064a[_0x6eec('0x9')](/\\/g,'/');this[_0x6eec('0xa')](_0x6eec('0x6'),_0x5a5e47);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6eec('0xb')],'set':function(_0x3aca38){this[_0x6eec('0xa')]('startedAt',moment()['subtract'](_0x3aca38,'ms'));this['setDataValue'](_0x6eec('0xc'),moment());this[_0x6eec('0xa')]('duration',_0x3aca38);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6eec('0x5')]('startedAt'))[_0x6eec('0xd')](_0x6eec('0xe'))[_0x6eec('0xf')]();}},'closedAt':{'type':Sequelize[_0x6eec('0x10')],'get':function(){return moment(this[_0x6eec('0x5')]('closedAt'))[_0x6eec('0xd')](_0x6eec('0xe'))[_0x6eec('0xf')]();}},'createdAt':{'type':Sequelize[_0x6eec('0x10')],'get':function(){return moment(this[_0x6eec('0x5')](_0x6eec('0x11')))[_0x6eec('0xd')](_0x6eec('0xe'))[_0x6eec('0xf')]();}},'updatedAt':{'type':Sequelize[_0x6eec('0x10')],'get':function(){return moment(this['getDataValue'](_0x6eec('0x12')))['format'](_0x6eec('0xe'))[_0x6eec('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 34baf4b..7839682 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 _0xd561=['join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','render','merge','body','message','agent','account','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','duration','closedAt','value','describe','download','uniqueid'];(function(_0x4f3120,_0x55e9b0){var _0x2aca19=function(_0x10d11b){while(--_0x10d11b){_0x4f3120['push'](_0x4f3120['shift']());}};_0x2aca19(++_0x55e9b0);}(_0xd561,0x1c9));var _0x1d56=function(_0x91922a,_0x2fcff6){_0x91922a=_0x91922a-0x0;var _0x46a4b0=_0xd561[_0x91922a];return _0x46a4b0;};'use strict';var emlformat=require(_0x1d56('0x0'));var rimraf=require(_0x1d56('0x1'));var zipdir=require(_0x1d56('0x2'));var jsonpatch=require(_0x1d56('0x3'));var rp=require(_0x1d56('0x4'));var moment=require(_0x1d56('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1d56('0x6'));var util=require(_0x1d56('0x7'));var path=require(_0x1d56('0x8'));var sox=require(_0x1d56('0x9'));var csv=require(_0x1d56('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d56('0xb'));var _=require(_0x1d56('0xc'));var squel=require(_0x1d56('0xd'));var crypto=require(_0x1d56('0xe'));var jsforce=require(_0x1d56('0xf'));var deskjs=require(_0x1d56('0x10'));var toCsv=require(_0x1d56('0xa'));var querystring=require(_0x1d56('0x11'));var Papa=require(_0x1d56('0x12'));var Redis=require(_0x1d56('0x13'));var authService=require(_0x1d56('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d56('0x15'));var logger=require('../../config/logger')(_0x1d56('0x16'));var utils=require(_0x1d56('0x17'));var config=require(_0x1d56('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1d56('0x19'))['db'];function respondWithStatusCode(_0x4115d3,_0x3f6995){_0x3f6995=_0x3f6995||0xcc;return function(_0x3a901a){if(_0x3a901a){return _0x4115d3[_0x1d56('0x1a')](_0x3f6995);}return _0x4115d3[_0x1d56('0x1b')](_0x3f6995)[_0x1d56('0x1c')]();};}function respondWithResult(_0x5459e7,_0x2bdb57){_0x2bdb57=_0x2bdb57||0xc8;return function(_0x2326a0){if(_0x2326a0){return _0x5459e7[_0x1d56('0x1b')](_0x2bdb57)[_0x1d56('0x1d')](_0x2326a0);}};}function respondWithFilteredResult(_0x3ca414,_0x44df86){return function(_0x3dc679){if(_0x3dc679){var _0x2b7a00=typeof _0x44df86[_0x1d56('0x1e')]===_0x1d56('0x1f')&&typeof _0x44df86[_0x1d56('0x20')]===_0x1d56('0x1f');var _0x31b07d=_0x3dc679[_0x1d56('0x21')];var _0x4dbd1d=_0x2b7a00?0x0:_0x44df86[_0x1d56('0x1e')];var _0x1658c1=_0x2b7a00?_0x3dc679[_0x1d56('0x21')]:_0x44df86['offset']+_0x44df86[_0x1d56('0x20')];var _0x14d3f4;if(_0x1658c1>=_0x31b07d){_0x1658c1=_0x31b07d;_0x14d3f4=0xc8;}else{_0x14d3f4=0xce;}_0x3ca414[_0x1d56('0x1b')](_0x14d3f4);return _0x3ca414[_0x1d56('0x22')](_0x1d56('0x23'),_0x4dbd1d+'-'+_0x1658c1+'/'+_0x31b07d)['json'](_0x3dc679);}return null;};}function patchUpdates(_0x26110e){return function(_0x87bd36){try{jsonpatch[_0x1d56('0x24')](_0x87bd36,_0x26110e,!![]);}catch(_0x55bcd5){return BPromise['reject'](_0x55bcd5);}return _0x87bd36[_0x1d56('0x25')]();};}function saveUpdates(_0x52fa2f,_0x25206f){return function(_0x3246fe){if(_0x3246fe){return _0x3246fe[_0x1d56('0x26')](_0x52fa2f)[_0x1d56('0x27')](function(_0x299074){return _0x299074;});}return null;};}function removeEntity(_0x48d4d3,_0xc37c07){return function(_0x52f255){if(_0x52f255){return _0x52f255[_0x1d56('0x28')]()[_0x1d56('0x27')](function(){_0x48d4d3[_0x1d56('0x1b')](0xcc)[_0x1d56('0x1c')]();});}};}function handleEntityNotFound(_0x398ea9,_0x7c937d){return function(_0x212a8c){if(!_0x212a8c){_0x398ea9[_0x1d56('0x1a')](0x194);}return _0x212a8c;};}function handleError(_0x2dfd5c,_0x4d3209){_0x4d3209=_0x4d3209||0x1f4;return function(_0x434bce){logger['error'](_0x434bce[_0x1d56('0x29')]);if(_0x434bce[_0x1d56('0x2a')]){delete _0x434bce[_0x1d56('0x2a')];}_0x2dfd5c[_0x1d56('0x1b')](_0x4d3209)[_0x1d56('0x2b')](_0x434bce);};}function getMustacheRender(_0x44abdf,_0x42e71e){return Mustache[_0x1d56('0x2c')](_0x44abdf,_[_0x1d56('0x2d')](_0x42e71e[_0x1d56('0x2e')],{'contact':_0x42e71e['contact'],'message':_0x42e71e[_0x1d56('0x2f')],'agent':_0x42e71e[_0x1d56('0x30')],'interaction':_0x42e71e['interaction'],'account':_0x42e71e[_0x1d56('0x31')]}))||'';}exports[_0x1d56('0x32')]=function(_0x49f65d,_0x571966){var _0x9c6c9={},_0x4dcfdd={},_0x185815={'count':0x0,'rows':[]};var _0x22a73b=_[_0x1d56('0x33')](db[_0x1d56('0x34')][_0x1d56('0x35')],function(_0x73833f){return{'name':_0x73833f[_0x1d56('0x36')],'type':_0x73833f[_0x1d56('0x37')][_0x1d56('0x38')]};});_0x4dcfdd['model']=_[_0x1d56('0x39')](_['map'](_0x22a73b,_0x1d56('0x2a')),[_0x1d56('0x3a')]);_0x4dcfdd[_0x1d56('0x3b')]=_[_0x1d56('0x3c')](_0x49f65d[_0x1d56('0x3b')]);_0x4dcfdd[_0x1d56('0x3d')]=_[_0x1d56('0x3e')](_0x4dcfdd[_0x1d56('0x3f')],_0x4dcfdd[_0x1d56('0x3b')]);_0x9c6c9[_0x1d56('0x40')]=_[_0x1d56('0x3e')](_0x4dcfdd[_0x1d56('0x3f')],qs[_0x1d56('0x41')](_0x49f65d['query']['fields']));_0x9c6c9['attributes']=_0x9c6c9['attributes'][_0x1d56('0x42')]?_0x9c6c9[_0x1d56('0x40')]:_0x4dcfdd[_0x1d56('0x3f')];if(!_0x49f65d[_0x1d56('0x3b')]['hasOwnProperty'](_0x1d56('0x43'))){_0x9c6c9['limit']=qs[_0x1d56('0x20')](_0x49f65d[_0x1d56('0x3b')]['limit']);_0x9c6c9[_0x1d56('0x1e')]=qs[_0x1d56('0x1e')](_0x49f65d['query'][_0x1d56('0x1e')]);}_0x9c6c9['order']=qs[_0x1d56('0x44')](_0x49f65d[_0x1d56('0x3b')][_0x1d56('0x44')]);_0x9c6c9['where']=qs[_0x1d56('0x3d')](_[_0x1d56('0x45')](_0x49f65d[_0x1d56('0x3b')],_0x4dcfdd[_0x1d56('0x3d')]),_0x22a73b);if(_0x49f65d[_0x1d56('0x3b')][_0x1d56('0x46')]){_0x9c6c9[_0x1d56('0x47')]=_['merge'](_0x9c6c9[_0x1d56('0x47')],{'$or':_['map'](_0x22a73b,function(_0x4e87c5){if(_0x4e87c5[_0x1d56('0x37')]!==_0x1d56('0x48')){var _0x3bbff8={};_0x3bbff8[_0x4e87c5[_0x1d56('0x2a')]]={'$like':'%'+_0x49f65d[_0x1d56('0x3b')][_0x1d56('0x46')]+'%'};return _0x3bbff8;}})});}_0x9c6c9=_[_0x1d56('0x2d')]({},_0x9c6c9,_0x49f65d[_0x1d56('0x49')]);var _0x2ea581={'where':_0x9c6c9['where']};return db[_0x1d56('0x34')][_0x1d56('0x21')](_0x2ea581)[_0x1d56('0x27')](function(_0x4a9397){_0x185815[_0x1d56('0x21')]=_0x4a9397;if(_0x49f65d[_0x1d56('0x3b')][_0x1d56('0x4a')]){_0x9c6c9[_0x1d56('0x4b')]=[{'all':!![]}];}return db[_0x1d56('0x34')][_0x1d56('0x4c')](_0x9c6c9);})[_0x1d56('0x27')](function(_0xc92469){_0x185815[_0x1d56('0x4d')]=_0xc92469;return _0x185815;})[_0x1d56('0x27')](respondWithFilteredResult(_0x571966,_0x9c6c9))[_0x1d56('0x4e')](handleError(_0x571966,null));};exports['show']=function(_0x1cbc42,_0x2ae142){var _0x504a34={'raw':![],'where':{'id':_0x1cbc42[_0x1d56('0x4f')]['id']}},_0x2282af={};_0x2282af[_0x1d56('0x3f')]=_[_0x1d56('0x3c')](db[_0x1d56('0x34')][_0x1d56('0x35')]);_0x2282af[_0x1d56('0x3b')]=_[_0x1d56('0x3c')](_0x1cbc42[_0x1d56('0x3b')]);_0x2282af[_0x1d56('0x3d')]=_['intersection'](_0x2282af['model'],_0x2282af[_0x1d56('0x3b')]);_0x504a34[_0x1d56('0x40')]=_[_0x1d56('0x3e')](_0x2282af[_0x1d56('0x3f')],qs['fields'](_0x1cbc42[_0x1d56('0x3b')][_0x1d56('0x41')]));_0x504a34['attributes']=_0x504a34['attributes']['length']?_0x504a34[_0x1d56('0x40')]:_0x2282af[_0x1d56('0x3f')];if(_0x1cbc42[_0x1d56('0x3b')][_0x1d56('0x4a')]){_0x504a34['include']=[{'all':!![]}];}_0x504a34=_[_0x1d56('0x2d')]({},_0x504a34,_0x1cbc42['options']);return db[_0x1d56('0x34')][_0x1d56('0x50')](_0x504a34)[_0x1d56('0x27')](handleEntityNotFound(_0x2ae142,null))[_0x1d56('0x27')](respondWithResult(_0x2ae142,null))[_0x1d56('0x4e')](handleError(_0x2ae142,null));};exports[_0x1d56('0x51')]=function(_0x2cc803,_0x22c7f9){return db[_0x1d56('0x34')][_0x1d56('0x51')](_0x2cc803[_0x1d56('0x2e')],{})['then'](respondWithResult(_0x22c7f9,0xc9))[_0x1d56('0x4e')](handleError(_0x22c7f9,null));};exports['update']=function(_0x470d65,_0x3d42d3){if(_0x470d65['body']['id']){delete _0x470d65[_0x1d56('0x2e')]['id'];}delete _0x470d65[_0x1d56('0x2e')][_0x1d56('0x52')];delete _0x470d65[_0x1d56('0x2e')]['createdAt'];delete _0x470d65[_0x1d56('0x2e')][_0x1d56('0x53')];delete _0x470d65[_0x1d56('0x2e')][_0x1d56('0x54')];return db[_0x1d56('0x34')][_0x1d56('0x50')]({'where':{'id':_0x470d65[_0x1d56('0x4f')]['id']}})[_0x1d56('0x27')](handleEntityNotFound(_0x3d42d3,null))[_0x1d56('0x27')](saveUpdates(_0x470d65['body'],null))[_0x1d56('0x27')](respondWithResult(_0x3d42d3,null))[_0x1d56('0x4e')](handleError(_0x3d42d3,null));};exports[_0x1d56('0x55')]=function(_0x210fd2,_0x2a4bdb){return db[_0x1d56('0x34')]['describe']()[_0x1d56('0x27')](respondWithResult(_0x2a4bdb,null))[_0x1d56('0x4e')](handleError(_0x2a4bdb,null));};exports[_0x1d56('0x56')]=function(_0x191f64,_0x1ace0c,_0x55e3d1){var _0x7704eb=require('../../components/encryptor');var _0x5c3cf9=![];var _0xdbeb6b={};if(_0x191f64[_0x1d56('0x3b')][_0x1d56('0x37')]&&_0x191f64['query'][_0x1d56('0x37')]===_0x1d56('0x57')){_0xdbeb6b[_0x1d56('0x57')]=_0x191f64['params']['id'];}else{_0xdbeb6b['id']=_0x191f64[_0x1d56('0x4f')]['id'];}return db[_0x1d56('0x34')][_0x1d56('0x50')]({'where':_0xdbeb6b,'attributes':['id','value'],'raw':!![]})[_0x1d56('0x27')](handleEntityNotFound(_0x1ace0c,null))['then'](function(_0x2c514f){if(_0x2c514f){var _0x3287e2=path[_0x1d56('0x58')](config[_0x1d56('0x59')],_0x1d56('0x5a'),_0x2c514f[_0x1d56('0x54')]);var _0x432018=util[_0x1d56('0x3a')](_0x1d56('0x5b'),_0x3287e2);if(fs[_0x1d56('0x5c')](_0x432018)){_0x5c3cf9=!![];return _0x7704eb[_0x1d56('0x5d')](_0x432018,_0x3287e2,config[_0x1d56('0x5e')][_0x1d56('0x5f')])[_0x1d56('0x27')](function(){return _0x2c514f;});}return _0x2c514f;}})[_0x1d56('0x27')](function(_0xa5117c){if(_0xa5117c){var _0x3b8e30=path[_0x1d56('0x58')](config[_0x1d56('0x59')],_0x1d56('0x5a'),_0xa5117c[_0x1d56('0x54')]);if(!fs[_0x1d56('0x5c')](_0x3b8e30)){throw new db[(_0x1d56('0x60'))][(_0x1d56('0x61'))](_0x1d56('0x62'));}if(_0xa5117c['filename']){return _0x1ace0c[_0x1d56('0x56')](_0x3b8e30,_0xa5117c[_0x1d56('0x63')]+path[_0x1d56('0x64')](_0x3b8e30),function(){if(_0x5c3cf9){fs[_0x1d56('0x65')](_0x3b8e30);}});}else{return _0x1ace0c[_0x1d56('0x56')](_0x3b8e30,function(_0x475df5){if(_0x5c3cf9){fs['unlink'](_0x3b8e30);}});}}})[_0x1d56('0x4e')](function(_0x20b1cb){if(_0x20b1cb['message']===_0x1d56('0x62')){_0x1ace0c[_0x1d56('0x1b')](0x194)[_0x1d56('0x2b')]('Not\x20found');}else{return handleError(_0x1ace0c,null);}});};exports[_0x1d56('0x28')]=function(_0x298a20,_0x51332c){return db[_0x1d56('0x34')][_0x1d56('0x50')]({'where':{'id':_0x298a20[_0x1d56('0x4f')]['id']}})['then'](function(_0x2a03ef){if(_[_0x1d56('0x66')](_0x2a03ef)){throw new ReferenceError(_0x1d56('0x67'));}return _0x2a03ef;})['then'](function(_0x57bb29){var _0x40a02d=path[_0x1d56('0x58')](config[_0x1d56('0x59')],_0x1d56('0x5a'),_0x57bb29[_0x1d56('0x54')]);logger['info'](_0x1d56('0x68'),_0x40a02d);if(!_[_0x1d56('0x66')](_0x57bb29[_0x1d56('0x54')])&&fs['existsSync'](_0x40a02d)){logger['info'](_0x1d56('0x69')+_0x40a02d+_0x1d56('0x6a'));fs[_0x1d56('0x6b')](_0x40a02d);}_0x40a02d=_0x40a02d+'.cypher';if(!_[_0x1d56('0x66')](_0x57bb29[_0x1d56('0x54')])&&fs[_0x1d56('0x5c')](_0x40a02d)){logger[_0x1d56('0x6c')](_0x1d56('0x69')+_0x40a02d+_0x1d56('0x6a'));fs[_0x1d56('0x6b')](_0x40a02d);}return _0x57bb29;})[_0x1d56('0x27')](function(_0x424bfe){if(!_0x424bfe)throw new InternalError();return _0x424bfe[_0x1d56('0x28')]();})[_0x1d56('0x27')](function(){_0x51332c[_0x1d56('0x1b')](0xcc)['end']();})[_0x1d56('0x4e')](handleError(_0x51332c,null));}; \ No newline at end of file +var _0xc6d9=['moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','name','send','render','merge','body','message','agent','account','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','root','existsSync','decryptFile','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','download','extname','unlink','Not\x20found','join','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x11b53b,_0x188564){var _0x529666=function(_0x54ef3a){while(--_0x54ef3a){_0x11b53b['push'](_0x11b53b['shift']());}};_0x529666(++_0x188564);}(_0xc6d9,0xd0));var _0x9c6d=function(_0x2a1fec,_0x1ac998){_0x2a1fec=_0x2a1fec-0x0;var _0x162010=_0xc6d9[_0x2a1fec];return _0x162010;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c6d('0x0'));var zipdir=require(_0x9c6d('0x1'));var jsonpatch=require(_0x9c6d('0x2'));var rp=require(_0x9c6d('0x3'));var moment=require(_0x9c6d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c6d('0x5'));var util=require(_0x9c6d('0x6'));var path=require(_0x9c6d('0x7'));var sox=require('sox');var csv=require(_0x9c6d('0x8'));var ejs=require(_0x9c6d('0x9'));var fs=require('fs');var fs_extra=require(_0x9c6d('0xa'));var _=require(_0x9c6d('0xb'));var squel=require(_0x9c6d('0xc'));var crypto=require(_0x9c6d('0xd'));var jsforce=require(_0x9c6d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9c6d('0x8'));var querystring=require(_0x9c6d('0xf'));var Papa=require(_0x9c6d('0x10'));var Redis=require(_0x9c6d('0x11'));var authService=require(_0x9c6d('0x12'));var qs=require(_0x9c6d('0x13'));var as=require(_0x9c6d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c6d('0x15'))(_0x9c6d('0x16'));var utils=require('../../config/utils');var config=require(_0x9c6d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c6d('0x18'))['db'];function respondWithStatusCode(_0x3b0072,_0x53022d){_0x53022d=_0x53022d||0xcc;return function(_0x2e90a1){if(_0x2e90a1){return _0x3b0072[_0x9c6d('0x19')](_0x53022d);}return _0x3b0072[_0x9c6d('0x1a')](_0x53022d)[_0x9c6d('0x1b')]();};}function respondWithResult(_0x2d8414,_0x2e3ce5){_0x2e3ce5=_0x2e3ce5||0xc8;return function(_0x2b508a){if(_0x2b508a){return _0x2d8414['status'](_0x2e3ce5)['json'](_0x2b508a);}};}function respondWithFilteredResult(_0x4501b7,_0x3c8950){return function(_0x29ed71){if(_0x29ed71){var _0x109323=typeof _0x3c8950[_0x9c6d('0x1c')]===_0x9c6d('0x1d')&&typeof _0x3c8950[_0x9c6d('0x1e')]===_0x9c6d('0x1d');var _0x4c4f26=_0x29ed71['count'];var _0x33ea81=_0x109323?0x0:_0x3c8950[_0x9c6d('0x1c')];var _0x459494=_0x109323?_0x29ed71['count']:_0x3c8950[_0x9c6d('0x1c')]+_0x3c8950[_0x9c6d('0x1e')];var _0x48bd75;if(_0x459494>=_0x4c4f26){_0x459494=_0x4c4f26;_0x48bd75=0xc8;}else{_0x48bd75=0xce;}_0x4501b7['status'](_0x48bd75);return _0x4501b7[_0x9c6d('0x1f')](_0x9c6d('0x20'),_0x33ea81+'-'+_0x459494+'/'+_0x4c4f26)['json'](_0x29ed71);}return null;};}function patchUpdates(_0x486129){return function(_0x26db5b){try{jsonpatch[_0x9c6d('0x21')](_0x26db5b,_0x486129,!![]);}catch(_0x58c5fd){return BPromise['reject'](_0x58c5fd);}return _0x26db5b[_0x9c6d('0x22')]();};}function saveUpdates(_0x3e073a,_0x1513e8){return function(_0x4f5404){if(_0x4f5404){return _0x4f5404[_0x9c6d('0x23')](_0x3e073a)[_0x9c6d('0x24')](function(_0x1df99f){return _0x1df99f;});}return null;};}function removeEntity(_0xf1caa2,_0x225808){return function(_0x35998b){if(_0x35998b){return _0x35998b[_0x9c6d('0x25')]()[_0x9c6d('0x24')](function(){_0xf1caa2[_0x9c6d('0x1a')](0xcc)[_0x9c6d('0x1b')]();});}};}function handleEntityNotFound(_0x538d8a,_0x1d89b3){return function(_0x27dd93){if(!_0x27dd93){_0x538d8a['sendStatus'](0x194);}return _0x27dd93;};}function handleError(_0x6ae110,_0x4f3711){_0x4f3711=_0x4f3711||0x1f4;return function(_0x23c3f3){logger['error'](_0x23c3f3['stack']);if(_0x23c3f3[_0x9c6d('0x26')]){delete _0x23c3f3[_0x9c6d('0x26')];}_0x6ae110[_0x9c6d('0x1a')](_0x4f3711)[_0x9c6d('0x27')](_0x23c3f3);};}function getMustacheRender(_0x320171,_0x22018a){return Mustache[_0x9c6d('0x28')](_0x320171,_[_0x9c6d('0x29')](_0x22018a[_0x9c6d('0x2a')],{'contact':_0x22018a['contact'],'message':_0x22018a[_0x9c6d('0x2b')],'agent':_0x22018a[_0x9c6d('0x2c')],'interaction':_0x22018a['interaction'],'account':_0x22018a[_0x9c6d('0x2d')]}))||'';}exports[_0x9c6d('0x2e')]=function(_0x18ce95,_0xc21d1d){var _0x18a2e0={},_0x192feb={},_0xcaf576={'count':0x0,'rows':[]};var _0x418bd8=_[_0x9c6d('0x2f')](db[_0x9c6d('0x30')][_0x9c6d('0x31')],function(_0x336099){return{'name':_0x336099[_0x9c6d('0x32')],'type':_0x336099[_0x9c6d('0x33')][_0x9c6d('0x34')]};});_0x192feb[_0x9c6d('0x35')]=_['differenceBy'](_[_0x9c6d('0x2f')](_0x418bd8,_0x9c6d('0x26')),[_0x9c6d('0x36')]);_0x192feb[_0x9c6d('0x37')]=_[_0x9c6d('0x38')](_0x18ce95['query']);_0x192feb[_0x9c6d('0x39')]=_[_0x9c6d('0x3a')](_0x192feb[_0x9c6d('0x35')],_0x192feb[_0x9c6d('0x37')]);_0x18a2e0[_0x9c6d('0x3b')]=_[_0x9c6d('0x3a')](_0x192feb[_0x9c6d('0x35')],qs[_0x9c6d('0x3c')](_0x18ce95[_0x9c6d('0x37')][_0x9c6d('0x3c')]));_0x18a2e0[_0x9c6d('0x3b')]=_0x18a2e0['attributes'][_0x9c6d('0x3d')]?_0x18a2e0[_0x9c6d('0x3b')]:_0x192feb[_0x9c6d('0x35')];if(!_0x18ce95[_0x9c6d('0x37')]['hasOwnProperty'](_0x9c6d('0x3e'))){_0x18a2e0[_0x9c6d('0x1e')]=qs[_0x9c6d('0x1e')](_0x18ce95[_0x9c6d('0x37')]['limit']);_0x18a2e0[_0x9c6d('0x1c')]=qs['offset'](_0x18ce95['query'][_0x9c6d('0x1c')]);}_0x18a2e0[_0x9c6d('0x3f')]=qs[_0x9c6d('0x40')](_0x18ce95[_0x9c6d('0x37')][_0x9c6d('0x40')]);_0x18a2e0[_0x9c6d('0x41')]=qs[_0x9c6d('0x39')](_[_0x9c6d('0x42')](_0x18ce95[_0x9c6d('0x37')],_0x192feb[_0x9c6d('0x39')]),_0x418bd8);if(_0x18ce95['query'][_0x9c6d('0x43')]){_0x18a2e0[_0x9c6d('0x41')]=_[_0x9c6d('0x29')](_0x18a2e0[_0x9c6d('0x41')],{'$or':_[_0x9c6d('0x2f')](_0x418bd8,function(_0x5151da){if(_0x5151da['type']!==_0x9c6d('0x44')){var _0x3272e3={};_0x3272e3[_0x5151da[_0x9c6d('0x26')]]={'$like':'%'+_0x18ce95[_0x9c6d('0x37')][_0x9c6d('0x43')]+'%'};return _0x3272e3;}})});}_0x18a2e0=_[_0x9c6d('0x29')]({},_0x18a2e0,_0x18ce95[_0x9c6d('0x45')]);var _0x201b99={'where':_0x18a2e0[_0x9c6d('0x41')]};return db['ScreenRecording'][_0x9c6d('0x46')](_0x201b99)['then'](function(_0x5c916c){_0xcaf576[_0x9c6d('0x46')]=_0x5c916c;if(_0x18ce95['query']['includeAll']){_0x18a2e0[_0x9c6d('0x47')]=[{'all':!![]}];}return db[_0x9c6d('0x30')][_0x9c6d('0x48')](_0x18a2e0);})[_0x9c6d('0x24')](function(_0x3bbc97){_0xcaf576[_0x9c6d('0x49')]=_0x3bbc97;return _0xcaf576;})[_0x9c6d('0x24')](respondWithFilteredResult(_0xc21d1d,_0x18a2e0))[_0x9c6d('0x4a')](handleError(_0xc21d1d,null));};exports[_0x9c6d('0x4b')]=function(_0x1dba51,_0x304d8a){var _0x266662={'raw':![],'where':{'id':_0x1dba51[_0x9c6d('0x4c')]['id']}},_0x441feb={};_0x441feb[_0x9c6d('0x35')]=_[_0x9c6d('0x38')](db[_0x9c6d('0x30')][_0x9c6d('0x31')]);_0x441feb[_0x9c6d('0x37')]=_['keys'](_0x1dba51[_0x9c6d('0x37')]);_0x441feb[_0x9c6d('0x39')]=_[_0x9c6d('0x3a')](_0x441feb[_0x9c6d('0x35')],_0x441feb[_0x9c6d('0x37')]);_0x266662[_0x9c6d('0x3b')]=_['intersection'](_0x441feb['model'],qs[_0x9c6d('0x3c')](_0x1dba51[_0x9c6d('0x37')][_0x9c6d('0x3c')]));_0x266662[_0x9c6d('0x3b')]=_0x266662[_0x9c6d('0x3b')][_0x9c6d('0x3d')]?_0x266662[_0x9c6d('0x3b')]:_0x441feb['model'];if(_0x1dba51[_0x9c6d('0x37')][_0x9c6d('0x4d')]){_0x266662[_0x9c6d('0x47')]=[{'all':!![]}];}_0x266662=_[_0x9c6d('0x29')]({},_0x266662,_0x1dba51[_0x9c6d('0x45')]);return db[_0x9c6d('0x30')][_0x9c6d('0x4e')](_0x266662)[_0x9c6d('0x24')](handleEntityNotFound(_0x304d8a,null))[_0x9c6d('0x24')](respondWithResult(_0x304d8a,null))[_0x9c6d('0x4a')](handleError(_0x304d8a,null));};exports[_0x9c6d('0x4f')]=function(_0x42c7f7,_0x332b82){return db[_0x9c6d('0x30')][_0x9c6d('0x4f')](_0x42c7f7[_0x9c6d('0x2a')],{})['then'](respondWithResult(_0x332b82,0xc9))['catch'](handleError(_0x332b82,null));};exports['update']=function(_0x2478b6,_0x1cb00e){if(_0x2478b6[_0x9c6d('0x2a')]['id']){delete _0x2478b6[_0x9c6d('0x2a')]['id'];}delete _0x2478b6[_0x9c6d('0x2a')][_0x9c6d('0x50')];delete _0x2478b6[_0x9c6d('0x2a')][_0x9c6d('0x51')];delete _0x2478b6[_0x9c6d('0x2a')][_0x9c6d('0x52')];delete _0x2478b6[_0x9c6d('0x2a')][_0x9c6d('0x53')];return db['ScreenRecording'][_0x9c6d('0x4e')]({'where':{'id':_0x2478b6[_0x9c6d('0x4c')]['id']}})[_0x9c6d('0x24')](handleEntityNotFound(_0x1cb00e,null))[_0x9c6d('0x24')](saveUpdates(_0x2478b6['body'],null))['then'](respondWithResult(_0x1cb00e,null))[_0x9c6d('0x4a')](handleError(_0x1cb00e,null));};exports[_0x9c6d('0x54')]=function(_0x181fac,_0xa307ba){return db[_0x9c6d('0x30')][_0x9c6d('0x54')]()['then'](respondWithResult(_0xa307ba,null))[_0x9c6d('0x4a')](handleError(_0xa307ba,null));};exports['download']=function(_0x31025c,_0x31dfa4,_0x1b822a){var _0x4999cf=require(_0x9c6d('0x55'));var _0x5a0331=![];var _0x2c790f={};if(_0x31025c[_0x9c6d('0x37')][_0x9c6d('0x33')]&&_0x31025c[_0x9c6d('0x37')][_0x9c6d('0x33')]===_0x9c6d('0x56')){_0x2c790f['uniqueid']=_0x31025c[_0x9c6d('0x4c')]['id'];}else{_0x2c790f['id']=_0x31025c[_0x9c6d('0x4c')]['id'];}return db[_0x9c6d('0x30')][_0x9c6d('0x4e')]({'where':_0x2c790f,'attributes':['id',_0x9c6d('0x53')],'raw':!![]})[_0x9c6d('0x24')](handleEntityNotFound(_0x31dfa4,null))[_0x9c6d('0x24')](function(_0x382f12){if(_0x382f12){var _0x3da4d5=path['join'](config[_0x9c6d('0x57')],'server/files/screen_recordings',_0x382f12[_0x9c6d('0x53')]);var _0xb99ba4=util[_0x9c6d('0x36')]('%s.cypher',_0x3da4d5);if(fs[_0x9c6d('0x58')](_0xb99ba4)){_0x5a0331=!![];return _0x4999cf[_0x9c6d('0x59')](_0xb99ba4,_0x3da4d5,config['secrets'][_0x9c6d('0x5a')])['then'](function(){return _0x382f12;});}return _0x382f12;}})['then'](function(_0x2f4fcd){if(_0x2f4fcd){var _0x2d518e=path['join'](config[_0x9c6d('0x57')],_0x9c6d('0x5b'),_0x2f4fcd[_0x9c6d('0x53')]);if(!fs['existsSync'](_0x2d518e)){throw new db[(_0x9c6d('0x5c'))]['ValidationError'](_0x9c6d('0x5d'));}if(_0x2f4fcd[_0x9c6d('0x5e')]){return _0x31dfa4[_0x9c6d('0x5f')](_0x2d518e,_0x2f4fcd[_0x9c6d('0x5e')]+path[_0x9c6d('0x60')](_0x2d518e),function(){if(_0x5a0331){fs[_0x9c6d('0x61')](_0x2d518e);}});}else{return _0x31dfa4[_0x9c6d('0x5f')](_0x2d518e,function(_0x2a8dcf){if(_0x5a0331){fs[_0x9c6d('0x61')](_0x2d518e);}});}}})['catch'](function(_0x4712f7){if(_0x4712f7[_0x9c6d('0x2b')]==='ScreenRecording\x20not\x20found'){_0x31dfa4[_0x9c6d('0x1a')](0x194)[_0x9c6d('0x27')](_0x9c6d('0x62'));}else{return handleError(_0x31dfa4,null);}});};exports[_0x9c6d('0x25')]=function(_0x25ea82,_0x520d18){return db[_0x9c6d('0x30')][_0x9c6d('0x4e')]({'where':{'id':_0x25ea82[_0x9c6d('0x4c')]['id']}})[_0x9c6d('0x24')](function(_0x290b81){if(_['isNil'](_0x290b81)){throw new ReferenceError('Entity\x20not\x20found');}return _0x290b81;})['then'](function(_0x379efb){var _0xd6b751=path[_0x9c6d('0x63')](config[_0x9c6d('0x57')],'server/files/screen_recordings',_0x379efb[_0x9c6d('0x53')]);logger[_0x9c6d('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0xd6b751);if(!_[_0x9c6d('0x65')](_0x379efb[_0x9c6d('0x53')])&&fs[_0x9c6d('0x58')](_0xd6b751)){logger['info'](_0x9c6d('0x66')+_0xd6b751+_0x9c6d('0x67'));fs[_0x9c6d('0x68')](_0xd6b751);}_0xd6b751=_0xd6b751+_0x9c6d('0x69');if(!_[_0x9c6d('0x65')](_0x379efb[_0x9c6d('0x53')])&&fs[_0x9c6d('0x58')](_0xd6b751)){logger[_0x9c6d('0x64')]('File:\x20\x22'+_0xd6b751+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0xd6b751);}return _0x379efb;})[_0x9c6d('0x24')](function(_0x379e5e){if(!_0x379e5e)throw new InternalError();return _0x379e5e['destroy']();})[_0x9c6d('0x24')](function(){_0x520d18[_0x9c6d('0x1a')](0xcc)[_0x9c6d('0x1b')]();})['catch'](handleError(_0x520d18,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ed4c37e..c2a3a7f 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 _0xaef2=['api','moment','bluebird','request-promise','path','../../config/environment','define','ScreenRecording','interactionid','lodash','util','../../config/logger'];(function(_0x2f9e4a,_0x3c42a0){var _0xeee811=function(_0x578d30){while(--_0x578d30){_0x2f9e4a['push'](_0x2f9e4a['shift']());}};_0xeee811(++_0x3c42a0);}(_0xaef2,0x159));var _0x2aef=function(_0x2c2db6,_0x26dc58){_0x2c2db6=_0x2c2db6-0x0;var _0x5e5925=_0xaef2[_0x2c2db6];return _0x5e5925;};'use strict';var _=require(_0x2aef('0x0'));var util=require(_0x2aef('0x1'));var logger=require(_0x2aef('0x2'))(_0x2aef('0x3'));var moment=require(_0x2aef('0x4'));var BPromise=require(_0x2aef('0x5'));var rp=require(_0x2aef('0x6'));var fs=require('fs');var path=require(_0x2aef('0x7'));var rimraf=require('rimraf');var config=require(_0x2aef('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x2ec53e,_0x3d4701){return _0x2ec53e[_0x2aef('0x9')](_0x2aef('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x2aef('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c89=['bluebird','path','./screenRecording.attributes','ScreenRecording','interactionid','lodash','util','../../config/logger'];(function(_0x60b834,_0x3ccdda){var _0x832e5e=function(_0x422e31){while(--_0x422e31){_0x60b834['push'](_0x60b834['shift']());}};_0x832e5e(++_0x3ccdda);}(_0x2c89,0x65));var _0x92c8=function(_0x3165bf,_0x35cf7e){_0x3165bf=_0x3165bf-0x0;var _0x43850b=_0x2c89[_0x3165bf];return _0x43850b;};'use strict';var _=require(_0x92c8('0x0'));var util=require(_0x92c8('0x1'));var logger=require(_0x92c8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x92c8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92c8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x92c8('0x5'));module['exports']=function(_0x24c987,_0x865a2f){return _0x24c987['define'](_0x92c8('0x6'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x92c8('0x7'),'fields':[_0x92c8('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f343eb9..c2ee7d9 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 _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x4b60e2,_0x2214ac){var _0x201f93=function(_0x46a023){while(--_0x46a023){_0x4b60e2['push'](_0x4b60e2['shift']());}};_0x201f93(++_0x2214ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x220f92,_0x54bda5){var _0xede08=function(_0x44e330){while(--_0x44e330){_0x220f92['push'](_0x220f92['shift']());}};_0xede08(++_0x54bda5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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/setting/index.js b/server/api/setting/index.js index 3933046..5fe165e 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 _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x57684f,_0x3e26ad){var _0x21474c=function(_0xc84ea7){while(--_0xc84ea7){_0x57684f['push'](_0x57684f['shift']());}};_0x21474c(++_0x3e26ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x3b330e,_0x350e11){var _0xa61a79=function(_0x370470){while(--_0x370470){_0x3b330e['push'](_0x3b330e['shift']());}};_0xa61a79(++_0x350e11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 7e04e6a..954d856 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 _0x394d=['alternate','UNSIGNED','sequelize','exports','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x5d76cc,_0x195736){var _0x4acce4=function(_0x3b889d){while(--_0x3b889d){_0x5d76cc['push'](_0x5d76cc['shift']());}};_0x4acce4(++_0x195736);}(_0x394d,0xf2));var _0xd394=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x394d[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0xd394('0x0'));module[_0xd394('0x1')]={'min_internal':{'type':Sequelize[_0xd394('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xd394('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xd394('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xd394('0x3')],'defaultValue':_0xd394('0x4')},'logo':{'type':Sequelize[_0xd394('0x3')]},'defaultLogo':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xd394('0x3')]},'turnaddr':{'type':Sequelize[_0xd394('0x3')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xd394('0x3')]},'pageTitle':{'type':Sequelize[_0xd394('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xd394('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd394('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xd394('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd394('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd394('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xd394('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xd394('0x3')],'defaultValue':_0xd394('0x6')},'chatTimeout':{'type':Sequelize[_0xd394('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xd394('0x3')]},'defaultPreferred':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xd394('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xd394('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xd394('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xd394('0x3')]},'defaultFavicon':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xd394('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xd394('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xd394('0x2')]},'transcribeRegion':{'type':Sequelize[_0xd394('0x3')]},'sentiment':{'type':Sequelize[_0xd394('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xd394('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd394('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xd394('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xd394('0x2')](0x2)[_0xd394('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xd394('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0xd394('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xd394('0x2')](0x2)[_0xd394('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xd394('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xd394('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xd394('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xd394('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xd394('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xd394('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xd394('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x4537=['BOOLEAN','STRING','alternate','UNSIGNED','exports','INTEGER','min_internal','min_mailbox'];(function(_0x639789,_0x755ea9){var _0x1e7459=function(_0x49e247){while(--_0x49e247){_0x639789['push'](_0x639789['shift']());}};_0x1e7459(++_0x755ea9);}(_0x4537,0x1dc));var _0x7453=function(_0x229f5e,_0x433f0f){_0x229f5e=_0x229f5e-0x0;var _0x2d62ff=_0x4537[_0x229f5e];return _0x2d62ff;};'use strict';var Sequelize=require('sequelize');module[_0x7453('0x0')]={'min_internal':{'type':Sequelize[_0x7453('0x1')](0xb),'unique':_0x7453('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7453('0x1')](0xb),'unique':_0x7453('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x7453('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7453('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x7453('0x5')]},'turnaddr':{'type':Sequelize[_0x7453('0x5')]},'turnusername':{'type':Sequelize[_0x7453('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x7453('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7453('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7453('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x7453('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x7453('0x6')},'chatTimeout':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7453('0x5')]},'defaultPreferred':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7453('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7453('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7453('0x1')]},'transcribeRegion':{'type':Sequelize[_0x7453('0x5')]},'sentiment':{'type':Sequelize[_0x7453('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x7453('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x7453('0x5')]},'language':{'type':Sequelize[_0x7453('0x5')]},'bucket':{'type':Sequelize[_0x7453('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7453('0x1')](0x2)[_0x7453('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7453('0x1')](0x2)[_0x7453('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x7453('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7453('0x1')](0x2)[_0x7453('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7453('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x7453('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7453('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6500e5b..3f48f9c 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 _0xf51f=['getLogo','server/files/images/logos','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','\x20not\x20found','download','getLogoLogin','defaultPreferred','defaultFavicon','existsSync','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','getLicense','default_preferred.png','custom','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','render','merge','body','contact','agent','account','index','Setting','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','addLogo','file','logo','addLogoLogin','filename'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf51f,0x19f));var _0xff51=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0xf51f[_0x2b0bc2];return _0x56e5b9;};'use strict';var emlformat=require(_0xff51('0x0'));var rimraf=require(_0xff51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff51('0x2'));var rp=require(_0xff51('0x3'));var moment=require('moment');var BPromise=require(_0xff51('0x4'));var Mustache=require(_0xff51('0x5'));var util=require(_0xff51('0x6'));var path=require(_0xff51('0x7'));var sox=require(_0xff51('0x8'));var csv=require(_0xff51('0x9'));var ejs=require(_0xff51('0xa'));var fs=require('fs');var fs_extra=require(_0xff51('0xb'));var _=require(_0xff51('0xc'));var squel=require(_0xff51('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xff51('0xe'));var toCsv=require(_0xff51('0x9'));var querystring=require(_0xff51('0xf'));var Papa=require('papaparse');var Redis=require(_0xff51('0x10'));var authService=require(_0xff51('0x11'));var qs=require(_0xff51('0x12'));var as=require(_0xff51('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff51('0x14'))('api');var utils=require(_0xff51('0x15'));var config=require(_0xff51('0x16'));var licenseUtil=require(_0xff51('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xff51('0x18'));var client=jayson[_0xff51('0x19')][_0xff51('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x17e598,_0x44ffa9,_0x1d3b07,_0x50752e){return new BPromise(function(_0x417f62,_0xf899eb){var _0x176a64=_0x50752e||client;return _0x176a64[_0xff51('0x1b')](_0x17e598,_0x1d3b07)[_0xff51('0x1c')](function(_0x4404e0){logger['info'](_0xff51('0x1d'),_0x44ffa9,'request\x20sent');logger['debug'](_0xff51('0x1e'),_0x44ffa9,'request\x20sent',JSON['stringify'](_0x4404e0));if(_0x4404e0['error']){if(_0x4404e0[_0xff51('0x1f')][_0xff51('0x20')]===0x1f4){logger[_0xff51('0x1f')](_0xff51('0x1d'),_0x44ffa9,_0x4404e0[_0xff51('0x1f')][_0xff51('0x21')]);return _0xf899eb(_0x4404e0[_0xff51('0x1f')]['message']);}logger[_0xff51('0x1f')]('Setting,\x20%s,\x20%s',_0x44ffa9,_0x4404e0['error']['message']);return _0x417f62(_0x4404e0[_0xff51('0x1f')][_0xff51('0x21')]);}else{logger[_0xff51('0x22')]('Setting,\x20%s,\x20%s',_0x44ffa9,_0xff51('0x23'));_0x417f62(_0x4404e0['result']['message']);}})[_0xff51('0x24')](function(_0x15a7ef){logger[_0xff51('0x1f')](_0xff51('0x1d'),_0x44ffa9,_0x15a7ef);_0xf899eb(_0x15a7ef);});});}function respondWithStatusCode(_0x1c4224,_0x9e2f6f){_0x9e2f6f=_0x9e2f6f||0xcc;return function(_0x563301){if(_0x563301){return _0x1c4224['sendStatus'](_0x9e2f6f);}return _0x1c4224[_0xff51('0x25')](_0x9e2f6f)[_0xff51('0x26')]();};}function respondWithResult(_0x2d25b9,_0x52a340){_0x52a340=_0x52a340||0xc8;return function(_0x58840c){if(_0x58840c){return _0x2d25b9['status'](_0x52a340)[_0xff51('0x27')](_0x58840c);}};}function respondWithFilteredResult(_0x3af926,_0x587d76){return function(_0x2c61bd){if(_0x2c61bd){var _0x324b52=typeof _0x587d76[_0xff51('0x28')]==='undefined'&&typeof _0x587d76['limit']===_0xff51('0x29');var _0x150989=_0x2c61bd[_0xff51('0x2a')];var _0x2e1fcb=_0x324b52?0x0:_0x587d76[_0xff51('0x28')];var _0x3f6c8e=_0x324b52?_0x2c61bd[_0xff51('0x2a')]:_0x587d76[_0xff51('0x28')]+_0x587d76[_0xff51('0x2b')];var _0x59186c;if(_0x3f6c8e>=_0x150989){_0x3f6c8e=_0x150989;_0x59186c=0xc8;}else{_0x59186c=0xce;}_0x3af926['status'](_0x59186c);return _0x3af926[_0xff51('0x2c')](_0xff51('0x2d'),_0x2e1fcb+'-'+_0x3f6c8e+'/'+_0x150989)[_0xff51('0x27')](_0x2c61bd);}return null;};}function patchUpdates(_0x4f4d9b){return function(_0x8668ef){try{jsonpatch[_0xff51('0x2e')](_0x8668ef,_0x4f4d9b,!![]);}catch(_0xf3d943){return BPromise[_0xff51('0x2f')](_0xf3d943);}return _0x8668ef[_0xff51('0x30')]();};}function saveUpdates(_0xbe8f58,_0x4cc6c3){return function(_0x3483e4){if(_0x3483e4){return _0x3483e4[_0xff51('0x31')](_0xbe8f58)[_0xff51('0x1c')](function(_0x1c4d99){return _0x1c4d99;});}return null;};}function removeEntity(_0x44106b,_0xab9166){return function(_0x45afe9){if(_0x45afe9){return _0x45afe9[_0xff51('0x32')]()[_0xff51('0x1c')](function(){_0x44106b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c8ddf,_0x24ce22){return function(_0x1f351b){if(!_0x1f351b){_0x5c8ddf['sendStatus'](0x194);}return _0x1f351b;};}function handleError(_0x300204,_0x4277f5){_0x4277f5=_0x4277f5||0x1f4;return function(_0x270001){logger[_0xff51('0x1f')](_0x270001[_0xff51('0x33')]);if(_0x270001['name']){delete _0x270001[_0xff51('0x34')];}_0x300204[_0xff51('0x25')](_0x4277f5)[_0xff51('0x35')](_0x270001);};}function getMustacheRender(_0x2db93e,_0x3b9f41){return Mustache[_0xff51('0x36')](_0x2db93e,_[_0xff51('0x37')](_0x3b9f41[_0xff51('0x38')],{'contact':_0x3b9f41[_0xff51('0x39')],'message':_0x3b9f41[_0xff51('0x21')],'agent':_0x3b9f41[_0xff51('0x3a')],'interaction':_0x3b9f41['interaction'],'account':_0x3b9f41[_0xff51('0x3b')]}))||'';}exports[_0xff51('0x3c')]=function(_0x936819,_0x5c88a4){var _0x481a7e={},_0x389fae={},_0x4df2b0={'count':0x0,'rows':[]};var _0x3652f9=_['map'](db[_0xff51('0x3d')]['rawAttributes'],function(_0x571470){return{'name':_0x571470[_0xff51('0x3e')],'type':_0x571470['type'][_0xff51('0x3f')]};});_0x389fae[_0xff51('0x40')]=_['map'](_0x3652f9,_0xff51('0x34'));_0x389fae[_0xff51('0x41')]=_[_0xff51('0x42')](_0x936819[_0xff51('0x41')]);_0x389fae[_0xff51('0x43')]=_[_0xff51('0x44')](_0x389fae[_0xff51('0x40')],_0x389fae['query']);_0x481a7e[_0xff51('0x45')]=_['intersection'](_0x389fae[_0xff51('0x40')],qs[_0xff51('0x46')](_0x936819[_0xff51('0x41')][_0xff51('0x46')]));_0x481a7e[_0xff51('0x45')]=_0x481a7e[_0xff51('0x45')][_0xff51('0x47')]?_0x481a7e[_0xff51('0x45')]:_0x389fae['model'];if(!_0x936819[_0xff51('0x41')][_0xff51('0x48')](_0xff51('0x49'))){_0x481a7e['limit']=qs[_0xff51('0x2b')](_0x936819[_0xff51('0x41')][_0xff51('0x2b')]);_0x481a7e[_0xff51('0x28')]=qs[_0xff51('0x28')](_0x936819[_0xff51('0x41')][_0xff51('0x28')]);}_0x481a7e[_0xff51('0x4a')]=qs['sort'](_0x936819[_0xff51('0x41')][_0xff51('0x4b')]);_0x481a7e[_0xff51('0x4c')]=qs[_0xff51('0x43')](_[_0xff51('0x4d')](_0x936819[_0xff51('0x41')],_0x389fae[_0xff51('0x43')]),_0x3652f9);if(_0x936819['query'][_0xff51('0x4e')]){_0x481a7e[_0xff51('0x4c')]=_[_0xff51('0x37')](_0x481a7e[_0xff51('0x4c')],{'$or':_['map'](_0x3652f9,function(_0x56b35c){if(_0x56b35c['type']!==_0xff51('0x4f')){var _0x299713={};_0x299713[_0x56b35c[_0xff51('0x34')]]={'$like':'%'+_0x936819[_0xff51('0x41')][_0xff51('0x4e')]+'%'};return _0x299713;}})});}_0x481a7e=_[_0xff51('0x37')]({},_0x481a7e,_0x936819[_0xff51('0x50')]);var _0x533408={'where':_0x481a7e[_0xff51('0x4c')]};return db['Setting'][_0xff51('0x2a')](_0x533408)[_0xff51('0x1c')](function(_0x3f81cd){_0x4df2b0[_0xff51('0x2a')]=_0x3f81cd;if(_0x936819[_0xff51('0x41')][_0xff51('0x51')]){_0x481a7e[_0xff51('0x52')]=[{'all':!![]}];}return db[_0xff51('0x3d')][_0xff51('0x53')](_0x481a7e);})[_0xff51('0x1c')](function(_0x5cc697){_0x4df2b0[_0xff51('0x54')]=_0x5cc697;return _0x4df2b0;})[_0xff51('0x1c')](respondWithFilteredResult(_0x5c88a4,_0x481a7e))[_0xff51('0x24')](handleError(_0x5c88a4,null));};exports['show']=function(_0x2ded0a,_0x29df8c){var _0x22940a={'raw':![],'where':{'id':_0x2ded0a[_0xff51('0x55')]['id']}},_0x9aa75f={};_0x9aa75f[_0xff51('0x40')]=_[_0xff51('0x42')](db[_0xff51('0x3d')][_0xff51('0x56')]);_0x9aa75f['query']=_[_0xff51('0x42')](_0x2ded0a[_0xff51('0x41')]);_0x9aa75f[_0xff51('0x43')]=_[_0xff51('0x44')](_0x9aa75f[_0xff51('0x40')],_0x9aa75f[_0xff51('0x41')]);_0x22940a[_0xff51('0x45')]=_[_0xff51('0x44')](_0x9aa75f['model'],qs['fields'](_0x2ded0a[_0xff51('0x41')][_0xff51('0x46')]));_0x22940a[_0xff51('0x45')]=_0x22940a[_0xff51('0x45')][_0xff51('0x47')]?_0x22940a[_0xff51('0x45')]:_0x9aa75f[_0xff51('0x40')];if(_0x2ded0a[_0xff51('0x41')][_0xff51('0x51')]){_0x22940a[_0xff51('0x52')]=[{'all':!![]}];}_0x22940a=_[_0xff51('0x37')]({},_0x22940a,_0x2ded0a['options']);return db['Setting']['find'](_0x22940a)[_0xff51('0x1c')](handleEntityNotFound(_0x29df8c,null))[_0xff51('0x1c')](respondWithResult(_0x29df8c,null))[_0xff51('0x24')](handleError(_0x29df8c,null));};exports['update']=function(_0x514b5e,_0x148f4e){if(_0x514b5e[_0xff51('0x38')]['id']){delete _0x514b5e[_0xff51('0x38')]['id'];}return db[_0xff51('0x3d')][_0xff51('0x57')]({'where':{'id':_0x514b5e[_0xff51('0x55')]['id']}})[_0xff51('0x1c')](handleEntityNotFound(_0x148f4e,null))[_0xff51('0x1c')](saveUpdates(_0x514b5e[_0xff51('0x38')],null))['then'](respondWithResult(_0x148f4e,null))[_0xff51('0x24')](handleError(_0x148f4e,null));};exports[_0xff51('0x58')]=function(_0x1e6944,_0xf43710,_0x1a5ee3){if(_0x1e6944[_0xff51('0x59')]&&_0x1e6944[_0xff51('0x59')]['filename']){_0x1e6944['body'][_0xff51('0x5a')]=_0x1e6944[_0xff51('0x59')]['filename'];}return db['Setting'][_0xff51('0x57')]({'where':{'id':_0x1e6944['params']['id']}})[_0xff51('0x1c')](handleEntityNotFound(_0xf43710,null))[_0xff51('0x1c')](saveUpdates(_0x1e6944['body'],null))[_0xff51('0x1c')](respondWithResult(_0xf43710,null))['catch'](handleError(_0xf43710,null));};exports[_0xff51('0x5b')]=function(_0x3151b2,_0x2a26a6,_0x1a9c0e){if(_0x3151b2[_0xff51('0x59')]&&_0x3151b2['file'][_0xff51('0x5c')]){_0x3151b2['body']['loginLogo']=_0x3151b2['file'][_0xff51('0x5c')];}return db['Setting'][_0xff51('0x57')]({'where':{'id':_0x3151b2[_0xff51('0x55')]['id']}})['then'](handleEntityNotFound(_0x2a26a6,null))[_0xff51('0x1c')](saveUpdates(_0x3151b2[_0xff51('0x38')],null))[_0xff51('0x1c')](respondWithResult(_0x2a26a6,null))[_0xff51('0x24')](handleError(_0x2a26a6,null));};var utilLicense=require(_0xff51('0x17'));exports[_0xff51('0x5d')]=function(_0x4fc00e,_0x433bc7,_0xd5f9f5){var _0x3bf1fd=_0xff51('0x5e');var _0x2a60ed={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x15540b){if(_0x15540b){_0x2a60ed=_0x15540b;}return db[_0xff51('0x3d')]['find']({'where':{'id':_0x4fc00e[_0xff51('0x55')]['id']},'attributes':[_0xff51('0x5a'),_0xff51('0x5f'),_0xff51('0x60'),_0xff51('0x61'),_0xff51('0x62'),_0xff51('0x63'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xff51('0x1c')](handleEntityNotFound(_0x433bc7,null))[_0xff51('0x1c')](function(_0x359928){if(_0x359928){var _0x58db6b=_0x359928[_0xff51('0x5a')]&&fs['existsSync'](path[_0xff51('0x64')](config[_0xff51('0x65')],_0x3bf1fd,_['toLower'](_0x359928['logo'])))?path[_0xff51('0x64')](config[_0xff51('0x65')],_0x3bf1fd,_[_0xff51('0x66')](_0x359928['logo'])):path[_0xff51('0x64')](config[_0xff51('0x65')],_0x3bf1fd,_[_0xff51('0x66')](_0xff51('0x67')));var _0x4d2d8e=_0xff51('0x68')+_[_0xff51('0x69')](_0xff51('0x5a'));if(_0x359928[_0x4d2d8e]||!_0x2a60ed['custom']){_0x58db6b=path['join'](config[_0xff51('0x65')],_0x3bf1fd,_[_0xff51('0x66')](_0xff51('0x67')));}if(!fs['existsSync'](_0x58db6b)){throw new db[(_0xff51('0x6a'))]['ValidationError'](_[_0xff51('0x69')]('logo')+_0xff51('0x6b'));}return _0x433bc7[_0xff51('0x6c')](_0x58db6b);}})[_0xff51('0x24')](handleError(_0x433bc7,null));};var utilLicense=require('../../config/license/util');exports[_0xff51('0x6d')]=function(_0x40bfc3,_0x4f73ac,_0x2661b2){var _0x3aff03='server/files/images/logos';var _0x3b8ada={'custom':![]};return utilLicense['getLicense']()[_0xff51('0x1c')](function(_0x1aaed6){if(_0x1aaed6){_0x3b8ada=_0x1aaed6;}return db[_0xff51('0x3d')][_0xff51('0x57')]({'where':{'id':_0x40bfc3[_0xff51('0x55')]['id']},'attributes':['logo',_0xff51('0x5f'),_0xff51('0x60'),_0xff51('0x61'),_0xff51('0x62'),'defaultLoginLogo',_0xff51('0x6e'),_0xff51('0x6f')],'raw':!![]});})[_0xff51('0x1c')](handleEntityNotFound(_0x4f73ac,null))['then'](function(_0x365f99){if(_0x365f99){var _0x1fb8d2=_0x365f99['loginLogo']&&fs[_0xff51('0x70')](path[_0xff51('0x64')](config[_0xff51('0x65')],_0x3aff03,_[_0xff51('0x66')](_0x365f99[_0xff51('0x5f')])))?path[_0xff51('0x64')](config[_0xff51('0x65')],_0x3aff03,_[_0xff51('0x66')](_0x365f99[_0xff51('0x5f')])):path[_0xff51('0x64')](config['root'],_0x3aff03,_[_0xff51('0x66')](_0xff51('0x71')));var _0x47bc79='default'+_[_0xff51('0x69')](_0xff51('0x5f'));if(_0x365f99[_0x47bc79]||!_0x3b8ada['custom']){_0x1fb8d2=path[_0xff51('0x64')](config['root'],_0x3aff03,_[_0xff51('0x66')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x1fb8d2)){throw new db[(_0xff51('0x6a'))][(_0xff51('0x72'))](_[_0xff51('0x69')]('loginLogo')+_0xff51('0x6b'));}return _0x4f73ac[_0xff51('0x6c')](_0x1fb8d2);}})[_0xff51('0x24')](handleError(_0x4f73ac,null));};exports[_0xff51('0x73')]=function(_0xa915ff,_0x34300c){return db[_0xff51('0x3d')][_0xff51('0x57')]({'where':{'id':_0xa915ff[_0xff51('0x55')]['id']},'attributes':[_0xff51('0x74')]})[_0xff51('0x1c')](respondWithResult(_0x34300c,null))[_0xff51('0x24')](handleError(_0x34300c,null));};exports[_0xff51('0x75')]=function(_0x61b394,_0x49bcdf,_0x2a1cf7){if(_0x61b394[_0xff51('0x59')]&&_0x61b394[_0xff51('0x59')]['filename']){_0x61b394[_0xff51('0x38')]['preferred']=_0x61b394[_0xff51('0x59')][_0xff51('0x5c')];}return db[_0xff51('0x3d')][_0xff51('0x57')]({'where':{'id':_0x61b394[_0xff51('0x55')]['id']}})['then'](handleEntityNotFound(_0x49bcdf,null))[_0xff51('0x1c')](saveUpdates(_0x61b394[_0xff51('0x38')],null))[_0xff51('0x1c')](respondWithResult(_0x49bcdf,null))[_0xff51('0x24')](handleError(_0x49bcdf,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x394d7a,_0x6aabeb,_0x5cef80){var _0x37fd6d=_0xff51('0x5e');var _0x2f9438={'custom':![]};return utilLicense[_0xff51('0x76')]()[_0xff51('0x1c')](function(_0x1db9aa){if(_0x1db9aa){_0x2f9438=_0x1db9aa;}return db[_0xff51('0x3d')][_0xff51('0x57')]({'where':{'id':_0x394d7a[_0xff51('0x55')]['id']},'attributes':['logo',_0xff51('0x5f'),_0xff51('0x60'),_0xff51('0x61'),_0xff51('0x62'),_0xff51('0x63'),_0xff51('0x6e'),_0xff51('0x6f')],'raw':!![]});})['then'](handleEntityNotFound(_0x6aabeb,null))[_0xff51('0x1c')](function(_0x3c700d){if(_0x3c700d){var _0x1cb8e6=_0x3c700d[_0xff51('0x60')]&&fs[_0xff51('0x70')](path['join'](config[_0xff51('0x65')],_0x37fd6d,_[_0xff51('0x66')](_0x3c700d[_0xff51('0x60')])))?path['join'](config[_0xff51('0x65')],_0x37fd6d,_[_0xff51('0x66')](_0x3c700d[_0xff51('0x60')])):path[_0xff51('0x64')](config[_0xff51('0x65')],_0x37fd6d,_['toLower'](_0xff51('0x77')));var _0x4493bb=_0xff51('0x68')+_['upperFirst'](_0xff51('0x60'));if(_0x3c700d[_0x4493bb]||!_0x2f9438[_0xff51('0x78')]||!_0x2f9438[_0xff51('0x60')]){_0x1cb8e6=path[_0xff51('0x64')](config[_0xff51('0x65')],_0x37fd6d,_[_0xff51('0x66')](_0xff51('0x77')));}if(!fs[_0xff51('0x70')](_0x1cb8e6)){throw new db[(_0xff51('0x6a'))][(_0xff51('0x72'))](_[_0xff51('0x69')]('preferred')+'\x20not\x20found');}return _0x6aabeb[_0xff51('0x6c')](_0x1cb8e6);}})[_0xff51('0x24')](handleError(_0x6aabeb,null));};exports['addFavicon']=function(_0x29cbf8,_0x328cd3,_0x800928){if(_0x29cbf8[_0xff51('0x59')]&&_0x29cbf8[_0xff51('0x59')][_0xff51('0x5c')]){_0x29cbf8[_0xff51('0x38')][_0xff51('0x61')]=_0x29cbf8['file'][_0xff51('0x5c')];}return db[_0xff51('0x3d')][_0xff51('0x57')]({'where':{'id':_0x29cbf8[_0xff51('0x55')]['id']}})[_0xff51('0x1c')](handleEntityNotFound(_0x328cd3,null))['then'](saveUpdates(_0x29cbf8[_0xff51('0x38')],null))[_0xff51('0x1c')](respondWithResult(_0x328cd3,null))[_0xff51('0x24')](handleError(_0x328cd3,null));};var utilLicense=require(_0xff51('0x17'));exports[_0xff51('0x79')]=function(_0x5ce5af,_0x4515d3,_0xb8c5c8){var _0x2f88ae=_0xff51('0x5e');var _0x4519f9={'custom':![]};return utilLicense[_0xff51('0x76')]()[_0xff51('0x1c')](function(_0x129e8a){if(_0x129e8a){_0x4519f9=_0x129e8a;}return db[_0xff51('0x3d')][_0xff51('0x57')]({'where':{'id':_0x5ce5af[_0xff51('0x55')]['id']},'attributes':[_0xff51('0x5a'),_0xff51('0x5f'),'preferred',_0xff51('0x61'),_0xff51('0x62'),_0xff51('0x63'),_0xff51('0x6e'),'defaultFavicon'],'raw':!![]});})[_0xff51('0x1c')](handleEntityNotFound(_0x4515d3,null))[_0xff51('0x1c')](function(_0x9d1d85){if(_0x9d1d85){var _0x1684d7=_0x9d1d85[_0xff51('0x61')]&&fs[_0xff51('0x70')](path[_0xff51('0x64')](config[_0xff51('0x65')],_0x2f88ae,_[_0xff51('0x66')](_0x9d1d85[_0xff51('0x61')])))?path[_0xff51('0x64')](config['root'],_0x2f88ae,_[_0xff51('0x66')](_0x9d1d85[_0xff51('0x61')])):path[_0xff51('0x64')](config[_0xff51('0x65')],_0x2f88ae,_[_0xff51('0x66')](_0xff51('0x7a')));var _0x1cc616=_0xff51('0x68')+_[_0xff51('0x69')](_0xff51('0x61'));if(_0x9d1d85[_0x1cc616]||!_0x4519f9[_0xff51('0x78')]){_0x1684d7=path[_0xff51('0x64')](config[_0xff51('0x65')],_0x2f88ae,_[_0xff51('0x66')](_0xff51('0x7a')));}if(!fs[_0xff51('0x70')](_0x1684d7)){throw new db[(_0xff51('0x6a'))]['ValidationError'](_[_0xff51('0x69')]('favicon')+_0xff51('0x6b'));}return _0x4515d3[_0xff51('0x6c')](_0x1684d7);}})['catch'](handleError(_0x4515d3,null));};exports[_0xff51('0x7b')]=function(_0x18f88d,_0xbe8449){var _0x135f9f={'offset':moment()[_0xff51('0x7c')]()};_0x135f9f['now']=moment()[_0xff51('0x7c')](_0x135f9f[_0xff51('0x28')])[_0xff51('0x7d')](_0xff51('0x7e'));return _0xbe8449[_0xff51('0x25')](0xc8)[_0xff51('0x35')](_0x135f9f);}; \ No newline at end of file +var _0x278a=['addLogo','file','filename','logo','find','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','Sequelize','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','update','destroy','end','merge','body','contact','agent','interaction','account','index','map','Setting','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','intersection'];(function(_0x157298,_0x2f1dd2){var _0x43368c=function(_0x5848ff){while(--_0x5848ff){_0x157298['push'](_0x157298['shift']());}};_0x43368c(++_0x2f1dd2);}(_0x278a,0x127));var _0xa278=function(_0x44fda3,_0x5b8a48){_0x44fda3=_0x44fda3-0x0;var _0x28ad22=_0x278a[_0x44fda3];return _0x28ad22;};'use strict';var emlformat=require(_0xa278('0x0'));var rimraf=require(_0xa278('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa278('0x2'));var rp=require('request-promise');var moment=require(_0xa278('0x3'));var BPromise=require(_0xa278('0x4'));var Mustache=require('mustache');var util=require(_0xa278('0x5'));var path=require(_0xa278('0x6'));var sox=require('sox');var csv=require(_0xa278('0x7'));var ejs=require(_0xa278('0x8'));var fs=require('fs');var fs_extra=require(_0xa278('0x9'));var _=require(_0xa278('0xa'));var squel=require(_0xa278('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa278('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa278('0xd'));var Papa=require('papaparse');var Redis=require(_0xa278('0xe'));var authService=require(_0xa278('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa278('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa278('0x11'))(_0xa278('0x12'));var utils=require(_0xa278('0x13'));var config=require(_0xa278('0x14'));var licenseUtil=require(_0xa278('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa278('0x16'));var client=jayson[_0xa278('0x17')][_0xa278('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3018f7,_0x347b47,_0x3fbcc0,_0x1a7e30){return new BPromise(function(_0x15c9c3,_0x55e417){var _0x3dd859=_0x1a7e30||client;return _0x3dd859[_0xa278('0x19')](_0x3018f7,_0x3fbcc0)[_0xa278('0x1a')](function(_0x22fa72){logger[_0xa278('0x1b')]('Setting,\x20%s,\x20%s',_0x347b47,_0xa278('0x1c'));logger[_0xa278('0x1d')](_0xa278('0x1e'),_0x347b47,_0xa278('0x1c'),JSON[_0xa278('0x1f')](_0x22fa72));if(_0x22fa72[_0xa278('0x20')]){if(_0x22fa72[_0xa278('0x20')][_0xa278('0x21')]===0x1f4){logger[_0xa278('0x20')](_0xa278('0x22'),_0x347b47,_0x22fa72['error'][_0xa278('0x23')]);return _0x55e417(_0x22fa72[_0xa278('0x20')][_0xa278('0x23')]);}logger[_0xa278('0x20')](_0xa278('0x22'),_0x347b47,_0x22fa72[_0xa278('0x20')]['message']);return _0x15c9c3(_0x22fa72['error'][_0xa278('0x23')]);}else{logger[_0xa278('0x1b')](_0xa278('0x22'),_0x347b47,'request\x20sent');_0x15c9c3(_0x22fa72[_0xa278('0x24')]['message']);}})[_0xa278('0x25')](function(_0x51c549){logger[_0xa278('0x20')]('Setting,\x20%s,\x20%s',_0x347b47,_0x51c549);_0x55e417(_0x51c549);});});}function respondWithStatusCode(_0x1bff88,_0xc673d2){_0xc673d2=_0xc673d2||0xcc;return function(_0x5db041){if(_0x5db041){return _0x1bff88[_0xa278('0x26')](_0xc673d2);}return _0x1bff88[_0xa278('0x27')](_0xc673d2)['end']();};}function respondWithResult(_0x5a50a0,_0x1f3db3){_0x1f3db3=_0x1f3db3||0xc8;return function(_0x596069){if(_0x596069){return _0x5a50a0[_0xa278('0x27')](_0x1f3db3)[_0xa278('0x28')](_0x596069);}};}function respondWithFilteredResult(_0x258fc4,_0x4cdb65){return function(_0x386dc2){if(_0x386dc2){var _0xd6ed01=typeof _0x4cdb65['offset']==='undefined'&&typeof _0x4cdb65[_0xa278('0x29')]===_0xa278('0x2a');var _0x194090=_0x386dc2[_0xa278('0x2b')];var _0x340552=_0xd6ed01?0x0:_0x4cdb65[_0xa278('0x2c')];var _0x47d76d=_0xd6ed01?_0x386dc2['count']:_0x4cdb65[_0xa278('0x2c')]+_0x4cdb65['limit'];var _0x2328c8;if(_0x47d76d>=_0x194090){_0x47d76d=_0x194090;_0x2328c8=0xc8;}else{_0x2328c8=0xce;}_0x258fc4[_0xa278('0x27')](_0x2328c8);return _0x258fc4['set'](_0xa278('0x2d'),_0x340552+'-'+_0x47d76d+'/'+_0x194090)[_0xa278('0x28')](_0x386dc2);}return null;};}function patchUpdates(_0x20221b){return function(_0x5f1cb1){try{jsonpatch[_0xa278('0x2e')](_0x5f1cb1,_0x20221b,!![]);}catch(_0xa35758){return BPromise[_0xa278('0x2f')](_0xa35758);}return _0x5f1cb1['save']();};}function saveUpdates(_0x4fac1d,_0x357143){return function(_0x3acd38){if(_0x3acd38){return _0x3acd38[_0xa278('0x30')](_0x4fac1d)[_0xa278('0x1a')](function(_0x564520){return _0x564520;});}return null;};}function removeEntity(_0x343954,_0x22a13d){return function(_0x1fcb1b){if(_0x1fcb1b){return _0x1fcb1b[_0xa278('0x31')]()[_0xa278('0x1a')](function(){_0x343954[_0xa278('0x27')](0xcc)[_0xa278('0x32')]();});}};}function handleEntityNotFound(_0x2a2433,_0x2b405e){return function(_0x2ddd8a){if(!_0x2ddd8a){_0x2a2433[_0xa278('0x26')](0x194);}return _0x2ddd8a;};}function handleError(_0x3ac208,_0xb8c351){_0xb8c351=_0xb8c351||0x1f4;return function(_0x984874){logger[_0xa278('0x20')](_0x984874['stack']);if(_0x984874['name']){delete _0x984874['name'];}_0x3ac208[_0xa278('0x27')](_0xb8c351)['send'](_0x984874);};}function getMustacheRender(_0x44828a,_0x441f9f){return Mustache['render'](_0x44828a,_[_0xa278('0x33')](_0x441f9f[_0xa278('0x34')],{'contact':_0x441f9f[_0xa278('0x35')],'message':_0x441f9f[_0xa278('0x23')],'agent':_0x441f9f[_0xa278('0x36')],'interaction':_0x441f9f[_0xa278('0x37')],'account':_0x441f9f[_0xa278('0x38')]}))||'';}exports[_0xa278('0x39')]=function(_0x1e62d6,_0x4254f8){var _0x4a91dd={},_0x3666b0={},_0x10cc26={'count':0x0,'rows':[]};var _0x648d68=_[_0xa278('0x3a')](db[_0xa278('0x3b')]['rawAttributes'],function(_0x24ca26){return{'name':_0x24ca26[_0xa278('0x3c')],'type':_0x24ca26[_0xa278('0x3d')][_0xa278('0x3e')]};});_0x3666b0[_0xa278('0x3f')]=_[_0xa278('0x3a')](_0x648d68,'name');_0x3666b0[_0xa278('0x40')]=_['keys'](_0x1e62d6[_0xa278('0x40')]);_0x3666b0[_0xa278('0x41')]=_['intersection'](_0x3666b0[_0xa278('0x3f')],_0x3666b0[_0xa278('0x40')]);_0x4a91dd[_0xa278('0x42')]=_['intersection'](_0x3666b0[_0xa278('0x3f')],qs[_0xa278('0x43')](_0x1e62d6['query'][_0xa278('0x43')]));_0x4a91dd[_0xa278('0x42')]=_0x4a91dd['attributes'][_0xa278('0x44')]?_0x4a91dd[_0xa278('0x42')]:_0x3666b0[_0xa278('0x3f')];if(!_0x1e62d6[_0xa278('0x40')][_0xa278('0x45')](_0xa278('0x46'))){_0x4a91dd['limit']=qs['limit'](_0x1e62d6[_0xa278('0x40')][_0xa278('0x29')]);_0x4a91dd[_0xa278('0x2c')]=qs[_0xa278('0x2c')](_0x1e62d6[_0xa278('0x40')][_0xa278('0x2c')]);}_0x4a91dd[_0xa278('0x47')]=qs['sort'](_0x1e62d6[_0xa278('0x40')][_0xa278('0x48')]);_0x4a91dd[_0xa278('0x49')]=qs[_0xa278('0x41')](_['pick'](_0x1e62d6['query'],_0x3666b0[_0xa278('0x41')]),_0x648d68);if(_0x1e62d6[_0xa278('0x40')]['filter']){_0x4a91dd[_0xa278('0x49')]=_['merge'](_0x4a91dd[_0xa278('0x49')],{'$or':_[_0xa278('0x3a')](_0x648d68,function(_0x45cdf9){if(_0x45cdf9['type']!==_0xa278('0x4a')){var _0x5dd343={};_0x5dd343[_0x45cdf9['name']]={'$like':'%'+_0x1e62d6[_0xa278('0x40')][_0xa278('0x4b')]+'%'};return _0x5dd343;}})});}_0x4a91dd=_[_0xa278('0x33')]({},_0x4a91dd,_0x1e62d6[_0xa278('0x4c')]);var _0x208b1b={'where':_0x4a91dd['where']};return db[_0xa278('0x3b')][_0xa278('0x2b')](_0x208b1b)[_0xa278('0x1a')](function(_0x3cf17f){_0x10cc26[_0xa278('0x2b')]=_0x3cf17f;if(_0x1e62d6['query'][_0xa278('0x4d')]){_0x4a91dd[_0xa278('0x4e')]=[{'all':!![]}];}return db[_0xa278('0x3b')][_0xa278('0x4f')](_0x4a91dd);})[_0xa278('0x1a')](function(_0x1cd6e9){_0x10cc26[_0xa278('0x50')]=_0x1cd6e9;return _0x10cc26;})['then'](respondWithFilteredResult(_0x4254f8,_0x4a91dd))[_0xa278('0x25')](handleError(_0x4254f8,null));};exports[_0xa278('0x51')]=function(_0x114553,_0xcb9378){var _0x698615={'raw':![],'where':{'id':_0x114553[_0xa278('0x52')]['id']}},_0x418245={};_0x418245[_0xa278('0x3f')]=_[_0xa278('0x53')](db[_0xa278('0x3b')][_0xa278('0x54')]);_0x418245['query']=_[_0xa278('0x53')](_0x114553[_0xa278('0x40')]);_0x418245[_0xa278('0x41')]=_[_0xa278('0x55')](_0x418245['model'],_0x418245['query']);_0x698615[_0xa278('0x42')]=_['intersection'](_0x418245[_0xa278('0x3f')],qs[_0xa278('0x43')](_0x114553[_0xa278('0x40')][_0xa278('0x43')]));_0x698615[_0xa278('0x42')]=_0x698615[_0xa278('0x42')][_0xa278('0x44')]?_0x698615[_0xa278('0x42')]:_0x418245['model'];if(_0x114553[_0xa278('0x40')][_0xa278('0x4d')]){_0x698615[_0xa278('0x4e')]=[{'all':!![]}];}_0x698615=_['merge']({},_0x698615,_0x114553[_0xa278('0x4c')]);return db[_0xa278('0x3b')]['find'](_0x698615)['then'](handleEntityNotFound(_0xcb9378,null))[_0xa278('0x1a')](respondWithResult(_0xcb9378,null))[_0xa278('0x25')](handleError(_0xcb9378,null));};exports['update']=function(_0x1be230,_0x496b3a){if(_0x1be230[_0xa278('0x34')]['id']){delete _0x1be230[_0xa278('0x34')]['id'];}return db[_0xa278('0x3b')]['find']({'where':{'id':_0x1be230[_0xa278('0x52')]['id']}})[_0xa278('0x1a')](handleEntityNotFound(_0x496b3a,null))[_0xa278('0x1a')](saveUpdates(_0x1be230[_0xa278('0x34')],null))['then'](respondWithResult(_0x496b3a,null))[_0xa278('0x25')](handleError(_0x496b3a,null));};exports[_0xa278('0x56')]=function(_0x1b21c4,_0x254bf3,_0x153823){if(_0x1b21c4[_0xa278('0x57')]&&_0x1b21c4['file'][_0xa278('0x58')]){_0x1b21c4[_0xa278('0x34')][_0xa278('0x59')]=_0x1b21c4[_0xa278('0x57')][_0xa278('0x58')];}return db[_0xa278('0x3b')][_0xa278('0x5a')]({'where':{'id':_0x1b21c4[_0xa278('0x52')]['id']}})[_0xa278('0x1a')](handleEntityNotFound(_0x254bf3,null))[_0xa278('0x1a')](saveUpdates(_0x1b21c4[_0xa278('0x34')],null))['then'](respondWithResult(_0x254bf3,null))[_0xa278('0x25')](handleError(_0x254bf3,null));};exports[_0xa278('0x5b')]=function(_0x532a76,_0x3a808d,_0xf0ced){if(_0x532a76[_0xa278('0x57')]&&_0x532a76[_0xa278('0x57')][_0xa278('0x58')]){_0x532a76['body'][_0xa278('0x5c')]=_0x532a76[_0xa278('0x57')][_0xa278('0x58')];}return db[_0xa278('0x3b')][_0xa278('0x5a')]({'where':{'id':_0x532a76[_0xa278('0x52')]['id']}})[_0xa278('0x1a')](handleEntityNotFound(_0x3a808d,null))[_0xa278('0x1a')](saveUpdates(_0x532a76[_0xa278('0x34')],null))[_0xa278('0x1a')](respondWithResult(_0x3a808d,null))[_0xa278('0x25')](handleError(_0x3a808d,null));};var utilLicense=require(_0xa278('0x15'));exports[_0xa278('0x5d')]=function(_0xf33b55,_0x930cfa,_0x272fbb){var _0x4abce0=_0xa278('0x5e');var _0x1481e1={'custom':![]};return utilLicense[_0xa278('0x5f')]()[_0xa278('0x1a')](function(_0x4bcf79){if(_0x4bcf79){_0x1481e1=_0x4bcf79;}return db[_0xa278('0x3b')]['find']({'where':{'id':_0xf33b55[_0xa278('0x52')]['id']},'attributes':[_0xa278('0x59'),_0xa278('0x5c'),_0xa278('0x60'),_0xa278('0x61'),_0xa278('0x62'),_0xa278('0x63'),_0xa278('0x64'),_0xa278('0x65')],'raw':!![]});})[_0xa278('0x1a')](handleEntityNotFound(_0x930cfa,null))[_0xa278('0x1a')](function(_0xd98ded){if(_0xd98ded){var _0x4e330f=_0xd98ded[_0xa278('0x59')]&&fs[_0xa278('0x66')](path[_0xa278('0x67')](config[_0xa278('0x68')],_0x4abce0,_[_0xa278('0x69')](_0xd98ded[_0xa278('0x59')])))?path[_0xa278('0x67')](config['root'],_0x4abce0,_[_0xa278('0x69')](_0xd98ded[_0xa278('0x59')])):path['join'](config[_0xa278('0x68')],_0x4abce0,_[_0xa278('0x69')](_0xa278('0x6a')));var _0x16c5a4=_0xa278('0x6b')+_[_0xa278('0x6c')](_0xa278('0x59'));if(_0xd98ded[_0x16c5a4]||!_0x1481e1[_0xa278('0x6d')]){_0x4e330f=path[_0xa278('0x67')](config['root'],_0x4abce0,_['toLower'](_0xa278('0x6a')));}if(!fs['existsSync'](_0x4e330f)){throw new db['Sequelize'][(_0xa278('0x6e'))](_['upperFirst'](_0xa278('0x59'))+_0xa278('0x6f'));}return _0x930cfa[_0xa278('0x70')](_0x4e330f);}})['catch'](handleError(_0x930cfa,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x21aa15,_0x3ce99e,_0x5469bd){var _0x1f8018=_0xa278('0x5e');var _0x5d1f2a={'custom':![]};return utilLicense[_0xa278('0x5f')]()[_0xa278('0x1a')](function(_0xb32da4){if(_0xb32da4){_0x5d1f2a=_0xb32da4;}return db[_0xa278('0x3b')]['find']({'where':{'id':_0x21aa15[_0xa278('0x52')]['id']},'attributes':['logo',_0xa278('0x5c'),'preferred',_0xa278('0x61'),_0xa278('0x62'),'defaultLoginLogo','defaultPreferred',_0xa278('0x65')],'raw':!![]});})['then'](handleEntityNotFound(_0x3ce99e,null))['then'](function(_0x51ec51){if(_0x51ec51){var _0xd125b=_0x51ec51[_0xa278('0x5c')]&&fs[_0xa278('0x66')](path[_0xa278('0x67')](config[_0xa278('0x68')],_0x1f8018,_[_0xa278('0x69')](_0x51ec51['loginLogo'])))?path['join'](config[_0xa278('0x68')],_0x1f8018,_[_0xa278('0x69')](_0x51ec51[_0xa278('0x5c')])):path[_0xa278('0x67')](config[_0xa278('0x68')],_0x1f8018,_[_0xa278('0x69')]('default_loginLogo.svg'));var _0x253c5e=_0xa278('0x6b')+_[_0xa278('0x6c')](_0xa278('0x5c'));if(_0x51ec51[_0x253c5e]||!_0x5d1f2a['custom']){_0xd125b=path[_0xa278('0x67')](config['root'],_0x1f8018,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0xd125b)){throw new db[(_0xa278('0x71'))][(_0xa278('0x6e'))](_[_0xa278('0x6c')]('loginLogo')+_0xa278('0x6f'));}return _0x3ce99e[_0xa278('0x70')](_0xd125b);}})[_0xa278('0x25')](handleError(_0x3ce99e,null));};exports[_0xa278('0x72')]=function(_0x3317cf,_0x8d54d6){return db[_0xa278('0x3b')][_0xa278('0x5a')]({'where':{'id':_0x3317cf[_0xa278('0x52')]['id']},'attributes':[_0xa278('0x73')]})['then'](respondWithResult(_0x8d54d6,null))['catch'](handleError(_0x8d54d6,null));};exports['addPreferred']=function(_0x1b236d,_0x9acfbe,_0x3b7917){if(_0x1b236d[_0xa278('0x57')]&&_0x1b236d['file'][_0xa278('0x58')]){_0x1b236d[_0xa278('0x34')][_0xa278('0x60')]=_0x1b236d[_0xa278('0x57')][_0xa278('0x58')];}return db[_0xa278('0x3b')][_0xa278('0x5a')]({'where':{'id':_0x1b236d[_0xa278('0x52')]['id']}})[_0xa278('0x1a')](handleEntityNotFound(_0x9acfbe,null))[_0xa278('0x1a')](saveUpdates(_0x1b236d[_0xa278('0x34')],null))[_0xa278('0x1a')](respondWithResult(_0x9acfbe,null))[_0xa278('0x25')](handleError(_0x9acfbe,null));};var utilLicense=require(_0xa278('0x15'));exports[_0xa278('0x74')]=function(_0x1681cc,_0x3d22fd,_0xa62852){var _0x204198='server/files/images/logos';var _0x57a8e2={'custom':![]};return utilLicense[_0xa278('0x5f')]()[_0xa278('0x1a')](function(_0x5558e2){if(_0x5558e2){_0x57a8e2=_0x5558e2;}return db['Setting']['find']({'where':{'id':_0x1681cc[_0xa278('0x52')]['id']},'attributes':['logo','loginLogo',_0xa278('0x60'),_0xa278('0x61'),_0xa278('0x62'),_0xa278('0x63'),_0xa278('0x64'),'defaultFavicon'],'raw':!![]});})[_0xa278('0x1a')](handleEntityNotFound(_0x3d22fd,null))[_0xa278('0x1a')](function(_0x2d46b9){if(_0x2d46b9){var _0xa3cdd7=_0x2d46b9[_0xa278('0x60')]&&fs[_0xa278('0x66')](path[_0xa278('0x67')](config[_0xa278('0x68')],_0x204198,_['toLower'](_0x2d46b9[_0xa278('0x60')])))?path['join'](config['root'],_0x204198,_[_0xa278('0x69')](_0x2d46b9['preferred'])):path[_0xa278('0x67')](config[_0xa278('0x68')],_0x204198,_[_0xa278('0x69')](_0xa278('0x75')));var _0x2d63c6=_0xa278('0x6b')+_[_0xa278('0x6c')](_0xa278('0x60'));if(_0x2d46b9[_0x2d63c6]||!_0x57a8e2[_0xa278('0x6d')]||!_0x57a8e2[_0xa278('0x60')]){_0xa3cdd7=path[_0xa278('0x67')](config[_0xa278('0x68')],_0x204198,_[_0xa278('0x69')]('default_preferred.png'));}if(!fs['existsSync'](_0xa3cdd7)){throw new db['Sequelize'][(_0xa278('0x6e'))](_[_0xa278('0x6c')](_0xa278('0x60'))+'\x20not\x20found');}return _0x3d22fd[_0xa278('0x70')](_0xa3cdd7);}})[_0xa278('0x25')](handleError(_0x3d22fd,null));};exports[_0xa278('0x76')]=function(_0x50f86a,_0x3584fd,_0x424a7a){if(_0x50f86a['file']&&_0x50f86a[_0xa278('0x57')][_0xa278('0x58')]){_0x50f86a['body']['favicon']=_0x50f86a[_0xa278('0x57')][_0xa278('0x58')];}return db[_0xa278('0x3b')][_0xa278('0x5a')]({'where':{'id':_0x50f86a[_0xa278('0x52')]['id']}})[_0xa278('0x1a')](handleEntityNotFound(_0x3584fd,null))['then'](saveUpdates(_0x50f86a[_0xa278('0x34')],null))['then'](respondWithResult(_0x3584fd,null))['catch'](handleError(_0x3584fd,null));};var utilLicense=require('../../config/license/util');exports[_0xa278('0x77')]=function(_0x27cc7e,_0x333f1b,_0x1fd885){var _0x3e58a4='server/files/images/logos';var _0x207d7e={'custom':![]};return utilLicense[_0xa278('0x5f')]()[_0xa278('0x1a')](function(_0x3d9e6b){if(_0x3d9e6b){_0x207d7e=_0x3d9e6b;}return db['Setting'][_0xa278('0x5a')]({'where':{'id':_0x27cc7e[_0xa278('0x52')]['id']},'attributes':[_0xa278('0x59'),_0xa278('0x5c'),_0xa278('0x60'),'favicon',_0xa278('0x62'),_0xa278('0x63'),_0xa278('0x64'),_0xa278('0x65')],'raw':!![]});})['then'](handleEntityNotFound(_0x333f1b,null))[_0xa278('0x1a')](function(_0xe0a2be){if(_0xe0a2be){var _0x28fff4=_0xe0a2be[_0xa278('0x61')]&&fs[_0xa278('0x66')](path[_0xa278('0x67')](config[_0xa278('0x68')],_0x3e58a4,_['toLower'](_0xe0a2be[_0xa278('0x61')])))?path['join'](config[_0xa278('0x68')],_0x3e58a4,_[_0xa278('0x69')](_0xe0a2be[_0xa278('0x61')])):path[_0xa278('0x67')](config['root'],_0x3e58a4,_[_0xa278('0x69')](_0xa278('0x78')));var _0x4b8658=_0xa278('0x6b')+_[_0xa278('0x6c')](_0xa278('0x61'));if(_0xe0a2be[_0x4b8658]||!_0x207d7e[_0xa278('0x6d')]){_0x28fff4=path[_0xa278('0x67')](config['root'],_0x3e58a4,_[_0xa278('0x69')]('default_favicon.ico'));}if(!fs[_0xa278('0x66')](_0x28fff4)){throw new db[(_0xa278('0x71'))][(_0xa278('0x6e'))](_['upperFirst']('favicon')+_0xa278('0x6f'));}return _0x333f1b['download'](_0x28fff4);}})[_0xa278('0x25')](handleError(_0x333f1b,null));};exports[_0xa278('0x79')]=function(_0x237421,_0x4a6333){var _0x465aab={'offset':moment()[_0xa278('0x7a')]()};_0x465aab[_0xa278('0x7b')]=moment()[_0xa278('0x7a')](_0x465aab['offset'])[_0xa278('0x7c')](_0xa278('0x7d'));return _0x4a6333[_0xa278('0x27')](0xc8)[_0xa278('0x7e')](_0x465aab);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 94bb526..2e3cf34 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 _0xd1a1=['define','Setting','settings','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./setting.attributes','exports'];(function(_0x271923,_0x4bff14){var _0x45b28c=function(_0x536bdd){while(--_0x536bdd){_0x271923['push'](_0x271923['shift']());}};_0x45b28c(++_0x4bff14);}(_0xd1a1,0x7b));var _0x1d1a=function(_0x4eff84,_0x25280b){_0x4eff84=_0x4eff84-0x0;var _0x9acef5=_0xd1a1[_0x4eff84];return _0x9acef5;};'use strict';var _=require(_0x1d1a('0x0'));var util=require(_0x1d1a('0x1'));var logger=require(_0x1d1a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1d1a('0x3'));var rp=require(_0x1d1a('0x4'));var fs=require('fs');var path=require(_0x1d1a('0x5'));var rimraf=require(_0x1d1a('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d1a('0x7'));module[_0x1d1a('0x8')]=function(_0xe12ebb,_0x505ac0){return _0xe12ebb[_0x1d1a('0x9')](_0x1d1a('0xa'),attributes,{'tableName':_0x1d1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa66e=['request-promise','path','rimraf','./setting.attributes','define','Setting','settings','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3866a6,_0x487418){var _0x39596f=function(_0x7f37ab){while(--_0x7f37ab){_0x3866a6['push'](_0x3866a6['shift']());}};_0x39596f(++_0x487418);}(_0xa66e,0x67));var _0xea66=function(_0x508150,_0x1edc73){_0x508150=_0x508150-0x0;var _0x3e728e=_0xa66e[_0x508150];return _0x3e728e;};'use strict';var _=require(_0xea66('0x0'));var util=require(_0xea66('0x1'));var logger=require(_0xea66('0x2'))('api');var moment=require(_0xea66('0x3'));var BPromise=require(_0xea66('0x4'));var rp=require(_0xea66('0x5'));var fs=require('fs');var path=require(_0xea66('0x6'));var rimraf=require(_0xea66('0x7'));var config=require('../../config/environment');var attributes=require(_0xea66('0x8'));module['exports']=function(_0x1974ec,_0x4ddd47){return _0x1974ec[_0xea66('0x9')](_0xea66('0xa'),attributes,{'tableName':_0xea66('0xb'),'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 2bb841f..743b665 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 _0xafa5=['raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xafa5,0x6c));var _0x5afa=function(_0x13b25d,_0x34e7b7){_0x13b25d=_0x13b25d-0x0;var _0x4322de=_0xafa5[_0x13b25d];return _0x4322de;};'use strict';var _=require(_0x5afa('0x0'));var util=require('util');var moment=require(_0x5afa('0x1'));var BPromise=require(_0x5afa('0x2'));var rs=require(_0x5afa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5afa('0x4'));var logger=require(_0x5afa('0x5'))(_0x5afa('0x6'));var config=require(_0x5afa('0x7'));var jayson=require(_0x5afa('0x8'));var client=jayson[_0x5afa('0x9')][_0x5afa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29a389,_0x5d21fd,_0x7bf169){return new BPromise(function(_0x18f768,_0x3cc061){return client[_0x5afa('0xb')](_0x29a389,_0x7bf169)[_0x5afa('0xc')](function(_0x354d4a){logger[_0x5afa('0xd')](_0x5afa('0xe'),_0x5d21fd,'request\x20sent');logger[_0x5afa('0xf')](_0x5afa('0x10'),_0x5d21fd,_0x5afa('0x11'),JSON[_0x5afa('0x12')](_0x354d4a));if(_0x354d4a[_0x5afa('0x13')]){if(_0x354d4a[_0x5afa('0x13')][_0x5afa('0x14')]===0x1f4){logger[_0x5afa('0x13')]('Setting,\x20%s,\x20%s',_0x5d21fd,_0x354d4a[_0x5afa('0x13')][_0x5afa('0x15')]);return _0x3cc061(_0x354d4a[_0x5afa('0x13')][_0x5afa('0x15')]);}logger[_0x5afa('0x13')](_0x5afa('0xe'),_0x5d21fd,_0x354d4a['error'][_0x5afa('0x15')]);return _0x18f768(_0x354d4a[_0x5afa('0x13')][_0x5afa('0x15')]);}else{logger[_0x5afa('0xd')](_0x5afa('0xe'),_0x5d21fd,_0x5afa('0x11'));_0x18f768(_0x354d4a[_0x5afa('0x16')]['message']);}})[_0x5afa('0x17')](function(_0x2185a3){logger[_0x5afa('0x13')](_0x5afa('0xe'),_0x5d21fd,_0x2185a3);_0x3cc061(_0x2185a3);});});}exports[_0x5afa('0x18')]=function(_0x55c6a1){var _0x120c0b=this;return new Promise(function(_0x4a9b5b,_0x21b6c4){return db[_0x5afa('0x19')][_0x5afa('0x1a')]({'raw':_0x55c6a1[_0x5afa('0x1b')]?_0x55c6a1[_0x5afa('0x1b')][_0x5afa('0x1c')]===undefined?!![]:![]:!![],'where':_0x55c6a1[_0x5afa('0x1b')]?_0x55c6a1[_0x5afa('0x1b')][_0x5afa('0x1d')]||null:null,'attributes':_0x55c6a1[_0x5afa('0x1b')]?_0x55c6a1[_0x5afa('0x1b')][_0x5afa('0x1e')]||null:null,'include':_0x55c6a1[_0x5afa('0x1b')]?_0x55c6a1['options'][_0x5afa('0x1f')]?_[_0x5afa('0x20')](_0x55c6a1[_0x5afa('0x1b')][_0x5afa('0x1f')],function(_0x32bcba){return{'model':db[_0x32bcba[_0x5afa('0x21')]],'as':_0x32bcba['as'],'attributes':_0x32bcba['attributes'],'include':_0x32bcba[_0x5afa('0x1f')]?_[_0x5afa('0x20')](_0x32bcba[_0x5afa('0x1f')],function(_0x5194ce){return{'model':db[_0x5194ce[_0x5afa('0x21')]],'as':_0x5194ce['as'],'attributes':_0x5194ce[_0x5afa('0x1e')],'include':_0x5194ce['include']?_[_0x5afa('0x20')](_0x5194ce[_0x5afa('0x1f')],function(_0x5b4fdf){return{'model':db[_0x5b4fdf[_0x5afa('0x21')]],'as':_0x5b4fdf['as'],'attributes':_0x5b4fdf['attributes']};}):[]};}):[]};}):[]:[]})[_0x5afa('0xc')](function(_0x44ae4d){logger[_0x5afa('0xd')](_0x5afa('0x18'),_0x55c6a1);logger[_0x5afa('0xf')](_0x5afa('0x18'),_0x55c6a1,JSON[_0x5afa('0x12')](_0x44ae4d));_0x4a9b5b(_0x44ae4d);})[_0x5afa('0x17')](function(_0x1d4f31){logger['error'](_0x5afa('0x18'),_0x1d4f31[_0x5afa('0x15')],_0x55c6a1);_0x21b6c4(_0x120c0b[_0x5afa('0x13')](0x1f4,_0x1d4f31['message']));});});}; \ No newline at end of file +var _0xa8e1=['jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSetting','Setting','find','options','raw','where','map','include','attributes','model','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1ba426,_0xc5fc4b){var _0x28ee10=function(_0x74aebc){while(--_0x74aebc){_0x1ba426['push'](_0x1ba426['shift']());}};_0x28ee10(++_0xc5fc4b);}(_0xa8e1,0x1b0));var _0x1a8e=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xa8e1[_0x59d89e];return _0x554e93;};'use strict';var _=require(_0x1a8e('0x0'));var util=require(_0x1a8e('0x1'));var moment=require(_0x1a8e('0x2'));var BPromise=require('bluebird');var rs=require(_0x1a8e('0x3'));var fs=require('fs');var Redis=require(_0x1a8e('0x4'));var db=require(_0x1a8e('0x5'))['db'];var utils=require(_0x1a8e('0x6'));var logger=require(_0x1a8e('0x7'))(_0x1a8e('0x8'));var config=require(_0x1a8e('0x9'));var jayson=require(_0x1a8e('0xa'));var client=jayson['client'][_0x1a8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a31cb,_0xcb763d,_0x29cf30){return new BPromise(function(_0xc4a931,_0x3f1f0e){return client[_0x1a8e('0xc')](_0x4a31cb,_0x29cf30)[_0x1a8e('0xd')](function(_0x4df933){logger[_0x1a8e('0xe')](_0x1a8e('0xf'),_0xcb763d,_0x1a8e('0x10'));logger[_0x1a8e('0x11')](_0x1a8e('0x12'),_0xcb763d,'request\x20sent',JSON[_0x1a8e('0x13')](_0x4df933));if(_0x4df933[_0x1a8e('0x14')]){if(_0x4df933[_0x1a8e('0x14')]['code']===0x1f4){logger['error'](_0x1a8e('0xf'),_0xcb763d,_0x4df933[_0x1a8e('0x14')]['message']);return _0x3f1f0e(_0x4df933['error'][_0x1a8e('0x15')]);}logger[_0x1a8e('0x14')]('Setting,\x20%s,\x20%s',_0xcb763d,_0x4df933[_0x1a8e('0x14')][_0x1a8e('0x15')]);return _0xc4a931(_0x4df933[_0x1a8e('0x14')]['message']);}else{logger[_0x1a8e('0xe')](_0x1a8e('0xf'),_0xcb763d,_0x1a8e('0x10'));_0xc4a931(_0x4df933[_0x1a8e('0x16')][_0x1a8e('0x15')]);}})['catch'](function(_0x111c06){logger[_0x1a8e('0x14')](_0x1a8e('0xf'),_0xcb763d,_0x111c06);_0x3f1f0e(_0x111c06);});});}exports[_0x1a8e('0x17')]=function(_0x5a28b8){var _0x533962=this;return new Promise(function(_0x55b471,_0x255122){return db[_0x1a8e('0x18')][_0x1a8e('0x19')]({'raw':_0x5a28b8[_0x1a8e('0x1a')]?_0x5a28b8[_0x1a8e('0x1a')][_0x1a8e('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a28b8[_0x1a8e('0x1a')]?_0x5a28b8[_0x1a8e('0x1a')][_0x1a8e('0x1c')]||null:null,'attributes':_0x5a28b8['options']?_0x5a28b8['options']['attributes']||null:null,'include':_0x5a28b8[_0x1a8e('0x1a')]?_0x5a28b8[_0x1a8e('0x1a')]['include']?_[_0x1a8e('0x1d')](_0x5a28b8['options'][_0x1a8e('0x1e')],function(_0x40d3c9){return{'model':db[_0x40d3c9['model']],'as':_0x40d3c9['as'],'attributes':_0x40d3c9[_0x1a8e('0x1f')],'include':_0x40d3c9[_0x1a8e('0x1e')]?_[_0x1a8e('0x1d')](_0x40d3c9[_0x1a8e('0x1e')],function(_0x1f4efc){return{'model':db[_0x1f4efc['model']],'as':_0x1f4efc['as'],'attributes':_0x1f4efc[_0x1a8e('0x1f')],'include':_0x1f4efc['include']?_[_0x1a8e('0x1d')](_0x1f4efc['include'],function(_0x28b279){return{'model':db[_0x28b279[_0x1a8e('0x20')]],'as':_0x28b279['as'],'attributes':_0x28b279[_0x1a8e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52e13a){logger[_0x1a8e('0xe')](_0x1a8e('0x17'),_0x5a28b8);logger[_0x1a8e('0x11')](_0x1a8e('0x17'),_0x5a28b8,JSON[_0x1a8e('0x13')](_0x52e13a));_0x55b471(_0x52e13a);})[_0x1a8e('0x21')](function(_0x5cf875){logger[_0x1a8e('0x14')](_0x1a8e('0x17'),_0x5cf875[_0x1a8e('0x15')],_0x5a28b8);_0x255122(_0x533962[_0x1a8e('0x14')](0x1f4,_0x5cf875[_0x1a8e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 0b6d3bb..a2ba7b3 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 _0x439a=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util'];(function(_0x265671,_0x34d1ca){var _0x6f293c=function(_0x22fb1e){while(--_0x22fb1e){_0x265671['push'](_0x265671['shift']());}};_0x6f293c(++_0x34d1ca);}(_0x439a,0x1eb));var _0xa439=function(_0x4aefb9,_0x55959c){_0x4aefb9=_0x4aefb9-0x0;var _0x3152dc=_0x439a[_0x4aefb9];return _0x3152dc;};'use strict';var multer=require('multer');var util=require(_0xa439('0x0'));var path=require('path');var timeout=require(_0xa439('0x1'));var express=require(_0xa439('0x2'));var router=express[_0xa439('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa439('0x4'));var config=require(_0xa439('0x5'));var controller=require(_0xa439('0x6'));router[_0xa439('0x7')]('/',auth[_0xa439('0x8')](),controller[_0xa439('0x9')]);router[_0xa439('0x7')](_0xa439('0xa'),auth[_0xa439('0x8')](),controller['describe']);router[_0xa439('0x7')](_0xa439('0xb'),auth[_0xa439('0x8')](),controller[_0xa439('0xc')]);router[_0xa439('0x7')]('/:id/dispositions',auth[_0xa439('0x8')](),controller[_0xa439('0xd')]);router[_0xa439('0x7')](_0xa439('0xe'),auth['isAuthenticated'](),controller[_0xa439('0xf')]);router['get']('/:id/applications',auth[_0xa439('0x8')](),controller[_0xa439('0x10')]);router[_0xa439('0x7')](_0xa439('0x11'),auth['isAuthenticated'](),controller[_0xa439('0x12')]);router[_0xa439('0x7')](_0xa439('0x13'),controller[_0xa439('0x14')]);router['get'](_0xa439('0x15'),auth['isAuthenticated'](),controller[_0xa439('0x16')]);router[_0xa439('0x17')]('/',auth[_0xa439('0x8')](),controller['create']);router[_0xa439('0x17')](_0xa439('0x18'),auth[_0xa439('0x8')](),controller[_0xa439('0x19')]);router[_0xa439('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xa439('0x1a')]);router[_0xa439('0x17')](_0xa439('0x1b'),controller[_0xa439('0x1c')]);router[_0xa439('0x17')]('/:id/applications',auth[_0xa439('0x8')](),controller[_0xa439('0x1d')]);router[_0xa439('0x17')](_0xa439('0x1e'),auth[_0xa439('0x8')](),controller[_0xa439('0x1f')]);router[_0xa439('0x17')](_0xa439('0x13'),controller[_0xa439('0x20')]);router[_0xa439('0x17')](_0xa439('0x15'),auth[_0xa439('0x8')](),controller['addAgents']);router[_0xa439('0x21')](_0xa439('0xb'),auth['isAuthenticated'](),controller[_0xa439('0x22')]);router[_0xa439('0x23')](_0xa439('0xb'),auth[_0xa439('0x8')](),controller[_0xa439('0x24')]);router[_0xa439('0x23')](_0xa439('0x18'),auth['isAuthenticated'](),controller[_0xa439('0x25')]);router[_0xa439('0x23')](_0xa439('0xe'),auth[_0xa439('0x8')](),controller[_0xa439('0x26')]);router[_0xa439('0x23')](_0xa439('0x15'),auth[_0xa439('0x8')](),controller[_0xa439('0x27')]);module[_0xa439('0x28')]=router; \ No newline at end of file +var _0xf45a=['removeDispositions','removeAnswers','/:id/users','removeAgents','exports','util','express','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/status','statusGet','getAgents','post','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','send','status','put','update','destroy','delete'];(function(_0x1ae27f,_0x12946f){var _0x57e9c9=function(_0x26a1d8){while(--_0x26a1d8){_0x1ae27f['push'](_0x1ae27f['shift']());}};_0x57e9c9(++_0x12946f);}(_0xf45a,0x149));var _0xaf45=function(_0x43116a,_0x3a82da){_0x43116a=_0x43116a-0x0;var _0x51d00b=_0xf45a[_0x43116a];return _0x51d00b;};'use strict';var multer=require('multer');var util=require(_0xaf45('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaf45('0x1'));var router=express['Router']();var fs_extra=require(_0xaf45('0x2'));var auth=require(_0xaf45('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xaf45('0x4'));var controller=require(_0xaf45('0x5'));router[_0xaf45('0x6')]('/',auth[_0xaf45('0x7')](),controller['index']);router[_0xaf45('0x6')](_0xaf45('0x8'),auth[_0xaf45('0x7')](),controller['describe']);router['get'](_0xaf45('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xaf45('0x6')](_0xaf45('0xa'),auth[_0xaf45('0x7')](),controller[_0xaf45('0xb')]);router[_0xaf45('0x6')](_0xaf45('0xc'),auth[_0xaf45('0x7')](),controller[_0xaf45('0xd')]);router[_0xaf45('0x6')]('/:id/applications',auth[_0xaf45('0x7')](),controller[_0xaf45('0xe')]);router[_0xaf45('0x6')]('/:id/interactions',auth[_0xaf45('0x7')](),controller[_0xaf45('0xf')]);router[_0xaf45('0x6')](_0xaf45('0x10'),controller[_0xaf45('0x11')]);router['get']('/:id/users',auth[_0xaf45('0x7')](),controller[_0xaf45('0x12')]);router[_0xaf45('0x13')]('/',auth[_0xaf45('0x7')](),controller['create']);router['post'](_0xaf45('0xa'),auth[_0xaf45('0x7')](),controller['addDisposition']);router[_0xaf45('0x13')](_0xaf45('0xc'),auth[_0xaf45('0x7')](),controller[_0xaf45('0x14')]);router['post'](_0xaf45('0x15'),controller[_0xaf45('0x16')]);router[_0xaf45('0x13')](_0xaf45('0x17'),auth['isAuthenticated'](),controller['addApplications']);router[_0xaf45('0x13')](_0xaf45('0x18'),auth['isAuthenticated'](),controller[_0xaf45('0x19')]);router[_0xaf45('0x13')]('/:id/status',controller[_0xaf45('0x1a')]);router[_0xaf45('0x13')]('/:id/users',auth[_0xaf45('0x7')](),controller['addAgents']);router[_0xaf45('0x1b')]('/:id',auth[_0xaf45('0x7')](),controller[_0xaf45('0x1c')]);router['delete'](_0xaf45('0x9'),auth[_0xaf45('0x7')](),controller[_0xaf45('0x1d')]);router[_0xaf45('0x1e')](_0xaf45('0xa'),auth[_0xaf45('0x7')](),controller[_0xaf45('0x1f')]);router['delete'](_0xaf45('0xc'),auth[_0xaf45('0x7')](),controller[_0xaf45('0x20')]);router[_0xaf45('0x1e')](_0xaf45('0x21'),auth[_0xaf45('0x7')](),controller[_0xaf45('0x22')]);module[_0xaf45('0x23')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 6968e8c..3808131 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 _0x6888=['sequelize','exports','STRING','name','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6888,0xd2));var _0x8688=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x6888[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x8688('0x0'));var rs=require('randomstring');module[_0x8688('0x1')]={'name':{'type':Sequelize[_0x8688('0x2')],'unique':_0x8688('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8688('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8688('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x8688('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8688('0x4')](_0x8688('0x5'),_0x8688('0x6'),_0x8688('0x7'),_0x8688('0x8'),_0x8688('0x9'),'clickatell',_0x8688('0xa'),_0x8688('0xb'),_0x8688('0xc'),_0x8688('0xd'))},'accountSid':{'type':Sequelize[_0x8688('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x8688('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8688('0x2')]},'password':{'type':Sequelize[_0x8688('0x2')]},'apiKey':{'type':Sequelize[_0x8688('0x2')]},'applicationId':{'type':Sequelize[_0x8688('0x2')]},'accountId':{'type':Sequelize[_0x8688('0x2')]},'senderString':{'type':Sequelize[_0x8688('0x2')]},'deliveryReport':{'type':Sequelize[_0x8688('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x8688('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8688('0xf');}},'notificationSound':{'type':Sequelize[_0x8688('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8688('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8688('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8688('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8688('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8688('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8688('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8688('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8688('0x10')],'comment':_0x8688('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x8688('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3a1c41){if(!_0x3a1c41)this[_0x8688('0x12')](_0x8688('0x13'),null);this[_0x8688('0x12')](_0x8688('0x14'),_0x3a1c41);}}}; \ No newline at end of file +var _0x4f9b=['skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','twilio'];(function(_0x37c3c5,_0x3b48ba){var _0x494347=function(_0x5c75df){while(--_0x5c75df){_0x37c3c5['push'](_0x37c3c5['shift']());}};_0x494347(++_0x3b48ba);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x4bbb38,_0x18cc39){_0x4bbb38=_0x4bbb38-0x0;var _0x5b29e8=_0x4f9b[_0x4bbb38];return _0x5b29e8;};'use strict';var Sequelize=require(_0xb4f9('0x0'));var rs=require(_0xb4f9('0x1'));module[_0xb4f9('0x2')]={'name':{'type':Sequelize[_0xb4f9('0x3')],'unique':_0xb4f9('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xb4f9('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb4f9('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb4f9('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xb4f9('0x5'),_0xb4f9('0x6'),_0xb4f9('0x7'),_0xb4f9('0x8'),_0xb4f9('0x9'),_0xb4f9('0xa'),'bandwidth',_0xb4f9('0xb'),_0xb4f9('0xc'),_0xb4f9('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xb4f9('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xb4f9('0xe')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb4f9('0x3')]},'password':{'type':Sequelize[_0xb4f9('0x3')]},'apiKey':{'type':Sequelize[_0xb4f9('0x3')]},'applicationId':{'type':Sequelize[_0xb4f9('0x3')]},'accountId':{'type':Sequelize[_0xb4f9('0x3')]},'senderString':{'type':Sequelize[_0xb4f9('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xb4f9('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb4f9('0xf')],'defaultValue':function(){return _0xb4f9('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb4f9('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb4f9('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb4f9('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb4f9('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb4f9('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb4f9('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb4f9('0x11')],'comment':_0xb4f9('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xb4f9('0x12')],'defaultValue':![],'comment':_0xb4f9('0x14'),'set':function(_0xc6e4da){if(!_0xc6e4da)this[_0xb4f9('0x15')]('mandatoryDispositionPauseId',null);this[_0xb4f9('0x15')](_0xb4f9('0x16'),_0xc6e4da);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index aa7b76f..e39609b 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 _0x79d8=['from','From','Body','MessageSid','skebby','sender','text','connectel','clicksend','messageId','Text','MessageUUID','results','csc','segmentedMessage','fromNumber','bandwidth','intelepeer','refid','isNil','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','CmContact','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','unshift','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','send','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','debug','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','DELIVERED','clickatell','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','state','addAgents','userSmsAccount:save','removeAgents','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','json','limit','undefined','count','offset','status','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','render','body','agent','account','index','Pause','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','findOne','Disposition','nolimit','pick','map','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','SmsApplication','applications','orderBy','priority','asc','Applications','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x79d8,0x67));var _0x879d=function(_0x2cddc7,_0x32135d){_0x2cddc7=_0x2cddc7-0x0;var _0x5979a9=_0x79d8[_0x2cddc7];return _0x5979a9;};'use strict';var emlformat=require(_0x879d('0x0'));var rimraf=require(_0x879d('0x1'));var zipdir=require(_0x879d('0x2'));var jsonpatch=require(_0x879d('0x3'));var rp=require('request-promise');var moment=require(_0x879d('0x4'));var BPromise=require(_0x879d('0x5'));var Mustache=require('mustache');var util=require(_0x879d('0x6'));var path=require(_0x879d('0x7'));var sox=require(_0x879d('0x8'));var csv=require('to-csv');var ejs=require(_0x879d('0x9'));var fs=require('fs');var fs_extra=require(_0x879d('0xa'));var _=require(_0x879d('0xb'));var squel=require(_0x879d('0xc'));var crypto=require('crypto');var jsforce=require(_0x879d('0xd'));var deskjs=require(_0x879d('0xe'));var toCsv=require(_0x879d('0xf'));var querystring=require(_0x879d('0x10'));var Papa=require(_0x879d('0x11'));var Redis=require('ioredis');var authService=require(_0x879d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x879d('0x13'));var logger=require(_0x879d('0x14'))(_0x879d('0x15'));var utils=require('../../config/utils');var config=require(_0x879d('0x16'));var licenseUtil=require(_0x879d('0x17'));var db=require('../../mysqldb')['db'];config[_0x879d('0x18')]=_[_0x879d('0x19')](config['redis'],{'host':_0x879d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x879d('0x18')]));require(_0x879d('0x1b'))[_0x879d('0x1c')](socket);var jayson=require(_0x879d('0x1d'));var client=jayson[_0x879d('0x1e')][_0x879d('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x53dcdc,_0x575001,_0x419401,_0x175dfe){return new BPromise(function(_0x534a44,_0x4c6f59){var _0x7478cd=_0x175dfe||client;return _0x7478cd[_0x879d('0x20')](_0x53dcdc,_0x419401)[_0x879d('0x21')](function(_0x3f4e38){logger[_0x879d('0x22')](_0x879d('0x23'),_0x575001,_0x879d('0x24'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x575001,_0x879d('0x24'),JSON['stringify'](_0x3f4e38));if(_0x3f4e38[_0x879d('0x25')]){if(_0x3f4e38['error'][_0x879d('0x26')]===0x1f4){logger[_0x879d('0x25')](_0x879d('0x23'),_0x575001,_0x3f4e38[_0x879d('0x25')][_0x879d('0x27')]);return _0x4c6f59(_0x3f4e38[_0x879d('0x25')][_0x879d('0x27')]);}logger['error'](_0x879d('0x23'),_0x575001,_0x3f4e38[_0x879d('0x25')][_0x879d('0x27')]);return _0x534a44(_0x3f4e38[_0x879d('0x25')][_0x879d('0x27')]);}else{logger[_0x879d('0x22')]('SmsAccount,\x20%s,\x20%s',_0x575001,_0x879d('0x24'));_0x534a44(_0x3f4e38['result'][_0x879d('0x27')]);}})[_0x879d('0x28')](function(_0x396a85){logger['error'](_0x879d('0x23'),_0x575001,_0x396a85);_0x4c6f59(_0x396a85);});});}function respondWithStatusCode(_0x31b4f8,_0x12c652){_0x12c652=_0x12c652||0xcc;return function(_0x221e09){if(_0x221e09){return _0x31b4f8[_0x879d('0x29')](_0x12c652);}return _0x31b4f8['status'](_0x12c652)['end']();};}function respondWithResult(_0x919c8,_0x20f777){_0x20f777=_0x20f777||0xc8;return function(_0x5480c7){if(_0x5480c7){return _0x919c8['status'](_0x20f777)[_0x879d('0x2a')](_0x5480c7);}};}function respondWithFilteredResult(_0x1b3b96,_0x7a7d51){return function(_0x2c4510){if(_0x2c4510){var _0x510f84=typeof _0x7a7d51['offset']==='undefined'&&typeof _0x7a7d51[_0x879d('0x2b')]===_0x879d('0x2c');var _0x113b3c=_0x2c4510[_0x879d('0x2d')];var _0x5d7683=_0x510f84?0x0:_0x7a7d51[_0x879d('0x2e')];var _0x15dc14=_0x510f84?_0x2c4510[_0x879d('0x2d')]:_0x7a7d51['offset']+_0x7a7d51[_0x879d('0x2b')];var _0x234799;if(_0x15dc14>=_0x113b3c){_0x15dc14=_0x113b3c;_0x234799=0xc8;}else{_0x234799=0xce;}_0x1b3b96[_0x879d('0x2f')](_0x234799);return _0x1b3b96['set'](_0x879d('0x30'),_0x5d7683+'-'+_0x15dc14+'/'+_0x113b3c)[_0x879d('0x2a')](_0x2c4510);}return null;};}function patchUpdates(_0x3df57e){return function(_0x8430c1){try{jsonpatch[_0x879d('0x31')](_0x8430c1,_0x3df57e,!![]);}catch(_0x29ec88){return BPromise[_0x879d('0x32')](_0x29ec88);}return _0x8430c1[_0x879d('0x33')]();};}function saveUpdates(_0x180e03,_0x284881){return function(_0x27ce01){if(_0x27ce01){return _0x27ce01[_0x879d('0x34')](_0x180e03)[_0x879d('0x21')](function(_0x714e9a){return _0x714e9a;});}return null;};}function removeEntity(_0x582b06,_0xceb608){return function(_0x302d82){if(_0x302d82){return _0x302d82[_0x879d('0x35')]()['then'](function(){var _0x4071e3=_0x302d82[_0x879d('0x36')]({'plain':!![]});var _0x528e14=_0x879d('0x37');return db[_0x879d('0x38')][_0x879d('0x35')]({'where':{'type':_0x528e14,'resourceId':_0x4071e3['id']}})[_0x879d('0x21')](function(){return _0x302d82;});})['then'](function(){_0x582b06[_0x879d('0x2f')](0xcc)[_0x879d('0x39')]();});}};}function handleEntityNotFound(_0x193800,_0x579c4a){return function(_0xa30bd5){if(!_0xa30bd5){_0x193800[_0x879d('0x29')](0x194);}return _0xa30bd5;};}function handleError(_0x3e4e3c,_0x407224){_0x407224=_0x407224||0x1f4;return function(_0x33bf73){logger[_0x879d('0x25')](_0x33bf73[_0x879d('0x3a')]);if(_0x33bf73[_0x879d('0x3b')]){delete _0x33bf73[_0x879d('0x3b')];}_0x3e4e3c[_0x879d('0x2f')](_0x407224)['send'](_0x33bf73);};}function getMustacheRender(_0x4b2e9e,_0x39519f){return Mustache[_0x879d('0x3c')](_0x4b2e9e,_['merge'](_0x39519f[_0x879d('0x3d')],{'contact':_0x39519f['contact'],'message':_0x39519f['message'],'agent':_0x39519f[_0x879d('0x3e')],'interaction':_0x39519f['interaction'],'account':_0x39519f[_0x879d('0x3f')]}))||'';}exports[_0x879d('0x40')]=function(_0x29b88a,_0x594e89){var _0x27fa47={'include':[{'model':db[_0x879d('0x41')],'as':'mandatoryDispositionPause'}]},_0x1f421b={},_0x712a5b={'count':0x0,'rows':[]};var _0x2c04c2=_['map'](db[_0x879d('0x42')][_0x879d('0x43')],function(_0x1550ce){return{'name':_0x1550ce[_0x879d('0x44')],'type':_0x1550ce[_0x879d('0x45')][_0x879d('0x46')]};});_0x1f421b[_0x879d('0x47')]=_['map'](_0x2c04c2,_0x879d('0x3b'));_0x1f421b[_0x879d('0x48')]=_[_0x879d('0x49')](_0x29b88a[_0x879d('0x48')]);_0x1f421b[_0x879d('0x4a')]=_[_0x879d('0x4b')](_0x1f421b[_0x879d('0x47')],_0x1f421b['query']);_0x27fa47['attributes']=_[_0x879d('0x4b')](_0x1f421b[_0x879d('0x47')],qs[_0x879d('0x4c')](_0x29b88a[_0x879d('0x48')][_0x879d('0x4c')]));_0x27fa47['attributes']=_0x27fa47[_0x879d('0x4d')][_0x879d('0x4e')]?_0x27fa47[_0x879d('0x4d')]:_0x1f421b[_0x879d('0x47')];if(!_0x29b88a[_0x879d('0x48')][_0x879d('0x4f')]('nolimit')){_0x27fa47[_0x879d('0x2b')]=qs[_0x879d('0x2b')](_0x29b88a['query'][_0x879d('0x2b')]);_0x27fa47['offset']=qs['offset'](_0x29b88a[_0x879d('0x48')][_0x879d('0x2e')]);}_0x27fa47[_0x879d('0x50')]=qs[_0x879d('0x51')](_0x29b88a[_0x879d('0x48')][_0x879d('0x51')]);_0x27fa47[_0x879d('0x52')]=qs['filters'](_['pick'](_0x29b88a['query'],_0x1f421b[_0x879d('0x4a')]),_0x2c04c2);if(_0x29b88a[_0x879d('0x48')][_0x879d('0x53')]){_0x27fa47[_0x879d('0x52')]=_[_0x879d('0x54')](_0x27fa47[_0x879d('0x52')],{'$or':_['map'](_0x2c04c2,function(_0x1503c2){if(_0x1503c2['type']!==_0x879d('0x55')){var _0x526f02={};_0x526f02[_0x1503c2[_0x879d('0x3b')]]={'$like':'%'+_0x29b88a[_0x879d('0x48')][_0x879d('0x53')]+'%'};return _0x526f02;}})});}_0x27fa47=_[_0x879d('0x54')]({},_0x27fa47,_0x29b88a[_0x879d('0x56')]);var _0x255d53={'where':_0x27fa47[_0x879d('0x52')]};return db['SmsAccount']['count'](_0x255d53)[_0x879d('0x21')](function(_0x42c904){_0x712a5b[_0x879d('0x2d')]=_0x42c904;if(_0x29b88a[_0x879d('0x48')][_0x879d('0x57')]){_0x27fa47[_0x879d('0x58')]=[{'all':!![]}];}return db[_0x879d('0x42')][_0x879d('0x59')](_0x27fa47);})['then'](function(_0x336ef9){_0x712a5b[_0x879d('0x5a')]=_0x336ef9;return _0x712a5b;})['then'](respondWithFilteredResult(_0x594e89,_0x27fa47))[_0x879d('0x28')](handleError(_0x594e89,null));};exports[_0x879d('0x5b')]=function(_0x1c1fad,_0x40a239){var _0x49526e={'raw':![],'where':{'id':_0x1c1fad[_0x879d('0x5c')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x58e9aa={};_0x58e9aa[_0x879d('0x47')]=_[_0x879d('0x49')](db[_0x879d('0x42')]['rawAttributes']);_0x58e9aa[_0x879d('0x48')]=_[_0x879d('0x49')](_0x1c1fad['query']);_0x58e9aa[_0x879d('0x4a')]=_[_0x879d('0x4b')](_0x58e9aa['model'],_0x58e9aa[_0x879d('0x48')]);_0x49526e['attributes']=_[_0x879d('0x4b')](_0x58e9aa['model'],qs[_0x879d('0x4c')](_0x1c1fad['query'][_0x879d('0x4c')]));_0x49526e[_0x879d('0x4d')]=_0x49526e[_0x879d('0x4d')][_0x879d('0x4e')]?_0x49526e[_0x879d('0x4d')]:_0x58e9aa[_0x879d('0x47')];if(_0x1c1fad['query'][_0x879d('0x57')]){_0x49526e[_0x879d('0x58')]=[{'all':!![]}];}_0x49526e=_[_0x879d('0x54')]({},_0x49526e,_0x1c1fad[_0x879d('0x56')]);return db['SmsAccount'][_0x879d('0x5d')](_0x49526e)[_0x879d('0x21')](handleEntityNotFound(_0x40a239,null))['then'](respondWithResult(_0x40a239,null))[_0x879d('0x28')](handleError(_0x40a239,null));};exports['create']=function(_0x30aeed,_0x2a7323){return db[_0x879d('0x42')][_0x879d('0x5e')](_0x30aeed['body'],{})[_0x879d('0x21')](function(_0x4a9b92){var _0xfca6d9=_0x30aeed[_0x879d('0x5f')]['get']({'plain':!![]});if(!_0xfca6d9)throw new Error(_0x879d('0x60'));if(_0xfca6d9['role']===_0x879d('0x5f')){var _0xa97563=_0x4a9b92['get']({'plain':!![]});var _0x57f5f5=_0x879d('0x37');return db[_0x879d('0x61')][_0x879d('0x5d')]({'where':{'name':_0x57f5f5,'userProfileId':_0xfca6d9[_0x879d('0x62')]},'raw':!![]})['then'](function(_0x58f1ce){if(_0x58f1ce&&_0x58f1ce['autoAssociation']===0x0){return db[_0x879d('0x38')][_0x879d('0x5e')]({'name':_0xa97563[_0x879d('0x3b')],'resourceId':_0xa97563['id'],'type':_0x58f1ce['name'],'sectionId':_0x58f1ce['id']},{})[_0x879d('0x21')](function(){return _0x4a9b92;});}else{return _0x4a9b92;}})[_0x879d('0x28')](function(_0x2faafd){logger['error'](_0x879d('0x63'),_0x2faafd);throw _0x2faafd;});}return _0x4a9b92;})[_0x879d('0x21')](respondWithResult(_0x2a7323,0xc9))[_0x879d('0x28')](handleError(_0x2a7323,null));};exports['update']=function(_0x352767,_0x4f62df){if(_0x352767[_0x879d('0x3d')]['id']){delete _0x352767[_0x879d('0x3d')]['id'];}return db[_0x879d('0x42')][_0x879d('0x5d')]({'where':{'id':_0x352767[_0x879d('0x5c')]['id']},'include':[{'model':db[_0x879d('0x41')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4f62df,null))[_0x879d('0x21')](saveUpdates(_0x352767['body'],null))['then'](respondWithResult(_0x4f62df,null))[_0x879d('0x28')](handleError(_0x4f62df,null));};exports[_0x879d('0x35')]=function(_0x449476,_0x2592c3){return db[_0x879d('0x42')]['find']({'where':{'id':_0x449476[_0x879d('0x5c')]['id']}})[_0x879d('0x21')](handleEntityNotFound(_0x2592c3,null))['then'](removeEntity(_0x2592c3,null))['catch'](handleError(_0x2592c3,null));};exports[_0x879d('0x64')]=function(_0x5296ea,_0x3fc7ca){return db['SmsAccount'][_0x879d('0x64')]()[_0x879d('0x21')](respondWithResult(_0x3fc7ca,null))[_0x879d('0x28')](handleError(_0x3fc7ca,null));};exports[_0x879d('0x65')]=function(_0x37e77d,_0x430573,_0x11b0d8){if(_0x37e77d[_0x879d('0x3d')]['id']){delete _0x37e77d[_0x879d('0x3d')]['id'];}return db['SmsAccount'][_0x879d('0x5d')]({'where':{'id':_0x37e77d['params']['id']}})[_0x879d('0x21')](handleEntityNotFound(_0x430573,null))[_0x879d('0x21')](function(_0x40d1e7){if(_0x40d1e7){_0x37e77d[_0x879d('0x3d')][_0x879d('0x66')]=_0x40d1e7['id'];return db['Disposition']['create'](_0x37e77d[_0x879d('0x3d')]);}})['then'](respondWithResult(_0x430573,null))[_0x879d('0x28')](handleError(_0x430573,null));};exports['getDispositions']=function(_0x2c6abf,_0x1cd76f,_0x58751f){var _0x3958f9={'raw':![],'where':{}};var _0x59c4f6={};var _0xcec2f4={'count':0x0,'rows':[]};return db['SmsAccount'][_0x879d('0x67')]({'where':{'id':_0x2c6abf[_0x879d('0x5c')]['id']}})[_0x879d('0x21')](handleEntityNotFound(_0x1cd76f,null))[_0x879d('0x21')](function(_0xd967e4){if(_0xd967e4){_0x59c4f6['model']=_['keys'](db[_0x879d('0x68')][_0x879d('0x43')]);_0x59c4f6[_0x879d('0x48')]=_[_0x879d('0x49')](_0x2c6abf[_0x879d('0x48')]);_0x59c4f6[_0x879d('0x4a')]=_[_0x879d('0x4b')](_0x59c4f6[_0x879d('0x47')],_0x59c4f6[_0x879d('0x48')]);_0x3958f9[_0x879d('0x4d')]=_[_0x879d('0x4b')](_0x59c4f6[_0x879d('0x47')],qs[_0x879d('0x4c')](_0x2c6abf[_0x879d('0x48')]['fields']));_0x3958f9['attributes']=_0x3958f9[_0x879d('0x4d')][_0x879d('0x4e')]?_0x3958f9[_0x879d('0x4d')]:_0x59c4f6[_0x879d('0x47')];if(!_0x2c6abf['query'][_0x879d('0x4f')](_0x879d('0x69'))){_0x3958f9[_0x879d('0x2b')]=qs[_0x879d('0x2b')](_0x2c6abf[_0x879d('0x48')][_0x879d('0x2b')]);_0x3958f9[_0x879d('0x2e')]=qs[_0x879d('0x2e')](_0x2c6abf[_0x879d('0x48')]['offset']);}_0x3958f9[_0x879d('0x50')]=qs[_0x879d('0x51')](_0x2c6abf['query']['sort']);_0x3958f9[_0x879d('0x52')]=qs['filters'](_[_0x879d('0x6a')](_0x2c6abf[_0x879d('0x48')],_0x59c4f6[_0x879d('0x4a')]));_0x3958f9[_0x879d('0x52')][_0x879d('0x66')]=_0xd967e4['id'];if(_0x2c6abf[_0x879d('0x48')]['filter']){_0x3958f9[_0x879d('0x52')]=_[_0x879d('0x54')](_0x3958f9[_0x879d('0x52')],{'$or':_[_0x879d('0x6b')](_0x3958f9['attributes'],function(_0x49cc97){var _0x4b365e={};_0x4b365e[_0x49cc97]={'$like':'%'+_0x2c6abf['query'][_0x879d('0x53')]+'%'};return _0x4b365e;})});}_0x3958f9=_[_0x879d('0x54')]({},_0x3958f9,_0x2c6abf[_0x879d('0x56')]);return db['Disposition']['count']({'where':_0x3958f9[_0x879d('0x52')]})[_0x879d('0x21')](function(_0x389005){_0xcec2f4[_0x879d('0x2d')]=_0x389005;if(_0x2c6abf[_0x879d('0x48')][_0x879d('0x57')]){_0x3958f9[_0x879d('0x58')]=[{'all':!![]}];}return db[_0x879d('0x68')][_0x879d('0x59')](_0x3958f9);})[_0x879d('0x21')](function(_0x28f5f8){_0xcec2f4[_0x879d('0x5a')]=_0x28f5f8;return _0xcec2f4;});}})[_0x879d('0x21')](respondWithFilteredResult(_0x1cd76f,_0x3958f9))[_0x879d('0x28')](handleError(_0x1cd76f,null));};exports[_0x879d('0x6c')]=function(_0xda123a,_0x31163b,_0x4f0bcf){return db[_0x879d('0x42')][_0x879d('0x5d')]({'where':{'id':_0xda123a['params']['id']}})['then'](handleEntityNotFound(_0x31163b,null))[_0x879d('0x21')](function(_0x302cf0){if(_0x302cf0){return _0x302cf0[_0x879d('0x6c')](_0xda123a[_0x879d('0x48')][_0x879d('0x6d')]);}})[_0x879d('0x21')](respondWithStatusCode(_0x31163b,null))[_0x879d('0x28')](handleError(_0x31163b,null));};exports[_0x879d('0x6e')]=function(_0x156b59,_0xe8c394,_0x5874d0){if(_0x156b59[_0x879d('0x3d')]['id']){delete _0x156b59[_0x879d('0x3d')]['id'];}return db[_0x879d('0x42')]['find']({'where':{'id':_0x156b59[_0x879d('0x5c')]['id']}})[_0x879d('0x21')](handleEntityNotFound(_0xe8c394,null))[_0x879d('0x21')](function(_0x392676){if(_0x392676){_0x156b59[_0x879d('0x3d')][_0x879d('0x66')]=_0x392676['id'];return db['CannedAnswer'][_0x879d('0x5e')](_0x156b59[_0x879d('0x3d')]);}})[_0x879d('0x21')](respondWithResult(_0xe8c394,null))[_0x879d('0x28')](handleError(_0xe8c394,null));};exports[_0x879d('0x6f')]=function(_0xcde38a,_0x3fee69,_0x979144){var _0x2a5a6d={'raw':![],'where':{}};var _0xa548ac={};var _0x5b1a9c={'count':0x0,'rows':[]};return db[_0x879d('0x42')][_0x879d('0x67')]({'where':{'id':_0xcde38a[_0x879d('0x5c')]['id']}})[_0x879d('0x21')](handleEntityNotFound(_0x3fee69,null))['then'](function(_0x2021f1){if(_0x2021f1){_0xa548ac[_0x879d('0x47')]=_[_0x879d('0x49')](db[_0x879d('0x70')][_0x879d('0x43')]);_0xa548ac[_0x879d('0x48')]=_[_0x879d('0x49')](_0xcde38a[_0x879d('0x48')]);_0xa548ac['filters']=_['intersection'](_0xa548ac[_0x879d('0x47')],_0xa548ac['query']);_0x2a5a6d['attributes']=_['intersection'](_0xa548ac[_0x879d('0x47')],qs[_0x879d('0x4c')](_0xcde38a[_0x879d('0x48')][_0x879d('0x4c')]));_0x2a5a6d[_0x879d('0x4d')]=_0x2a5a6d[_0x879d('0x4d')][_0x879d('0x4e')]?_0x2a5a6d[_0x879d('0x4d')]:_0xa548ac[_0x879d('0x47')];if(!_0xcde38a['query'][_0x879d('0x4f')](_0x879d('0x69'))){_0x2a5a6d[_0x879d('0x2b')]=qs[_0x879d('0x2b')](_0xcde38a['query'][_0x879d('0x2b')]);_0x2a5a6d[_0x879d('0x2e')]=qs[_0x879d('0x2e')](_0xcde38a[_0x879d('0x48')][_0x879d('0x2e')]);}_0x2a5a6d['order']=qs[_0x879d('0x51')](_0xcde38a[_0x879d('0x48')]['sort']);_0x2a5a6d[_0x879d('0x52')]=qs[_0x879d('0x4a')](_[_0x879d('0x6a')](_0xcde38a[_0x879d('0x48')],_0xa548ac['filters']));_0x2a5a6d['where']['SmsAccountId']=_0x2021f1['id'];if(_0xcde38a[_0x879d('0x48')][_0x879d('0x53')]){_0x2a5a6d['where']=_[_0x879d('0x54')](_0x2a5a6d[_0x879d('0x52')],{'$or':_[_0x879d('0x6b')](_0x2a5a6d[_0x879d('0x4d')],function(_0xe67d8e){var _0x41c73c={};_0x41c73c[_0xe67d8e]={'$like':'%'+_0xcde38a[_0x879d('0x48')]['filter']+'%'};return _0x41c73c;})});}_0x2a5a6d=_[_0x879d('0x54')]({},_0x2a5a6d,_0xcde38a[_0x879d('0x56')]);return db[_0x879d('0x70')][_0x879d('0x2d')]({'where':_0x2a5a6d[_0x879d('0x52')]})['then'](function(_0x580003){_0x5b1a9c['count']=_0x580003;if(_0xcde38a['query'][_0x879d('0x57')]){_0x2a5a6d[_0x879d('0x58')]=[{'all':!![]}];}return db[_0x879d('0x70')][_0x879d('0x59')](_0x2a5a6d);})[_0x879d('0x21')](function(_0x450251){_0x5b1a9c[_0x879d('0x5a')]=_0x450251;return _0x5b1a9c;});}})['then'](respondWithFilteredResult(_0x3fee69,_0x2a5a6d))[_0x879d('0x28')](handleError(_0x3fee69,null));};exports[_0x879d('0x71')]=function(_0x3ce62a,_0x476c3e,_0x503842){return db['SmsAccount'][_0x879d('0x5d')]({'where':{'id':_0x3ce62a['params']['id']}})[_0x879d('0x21')](handleEntityNotFound(_0x476c3e,null))[_0x879d('0x21')](function(_0x47c021){if(_0x47c021){return _0x47c021[_0x879d('0x71')](_0x3ce62a[_0x879d('0x48')][_0x879d('0x6d')]);}})['then'](respondWithStatusCode(_0x476c3e,null))[_0x879d('0x28')](handleError(_0x476c3e,null));};exports[_0x879d('0x72')]=function(_0x459d84,_0x180d77,_0x37cc3a){var _0x58ae05={'channel':'sms'};var _0x374285=[];var _0x593910=[];var _0x46972a={};return db[_0x879d('0x42')]['find']({'where':{'id':_0x459d84[_0x879d('0x5c')]['id']},'include':[{'model':db[_0x879d('0x73')],'as':'Applications'}]})[_0x879d('0x21')](handleEntityNotFound(_0x180d77,null))[_0x879d('0x21')](function(_0x4cfbc3){_0x58ae05[_0x879d('0x3f')]=_0x4cfbc3;_0x58ae05[_0x879d('0x74')]=_[_0x879d('0x75')](_0x4cfbc3['Applications'],[_0x879d('0x76')],[_0x879d('0x77')]);if(_0x58ae05['account'][_0x879d('0x78')]){delete _0x58ae05['account'][_0x879d('0x78')];}return db['CmContact']['describe']();})[_0x879d('0x21')](function(_0x2b3f23){if(!_0x2b3f23){throw new db[(_0x879d('0x79'))]['ValidationError']('no\x20available\x20attributes');}_0x374285=_[_0x879d('0x7a')](_['keys'](_0x2b3f23),[_0x879d('0x7b'),_0x879d('0x7c')]);_0x593910=_['difference'](_[_0x879d('0x49')](_0x2b3f23),[_0x879d('0x7b'),_0x879d('0x7c'),_0x879d('0x7d'),_0x879d('0x7e')]);_0x58ae05['body']={'mapKey':_0x879d('0x7f')};if(_0x58ae05[_0x879d('0x3f')][_0x879d('0x45')]){switch(_0x58ae05['account']['type']){case _0x879d('0x80'):_0x58ae05[_0x879d('0x3d')][_0x879d('0x81')]=_0x459d84[_0x879d('0x3d')][_0x879d('0x82')];_0x58ae05['body']['body']=_0x459d84['body'][_0x879d('0x83')];_0x58ae05[_0x879d('0x3d')]['messageId']=_0x459d84[_0x879d('0x3d')][_0x879d('0x84')];break;case _0x879d('0x85'):_0x58ae05['body'][_0x879d('0x81')]='+'+_0x459d84['body'][_0x879d('0x86')];_0x58ae05[_0x879d('0x3d')]['body']=_0x459d84[_0x879d('0x3d')][_0x879d('0x87')];break;case _0x879d('0x88'):_0x58ae05['body'][_0x879d('0x81')]=_0x459d84[_0x879d('0x3d')][_0x879d('0x81')];_0x58ae05[_0x879d('0x3d')]['body']=_0x459d84['body'][_0x879d('0x27')];break;case _0x879d('0x89'):_0x58ae05['body'][_0x879d('0x81')]=_0x459d84[_0x879d('0x3d')][_0x879d('0x81')];_0x58ae05[_0x879d('0x3d')][_0x879d('0x3d')]=_0x459d84[_0x879d('0x3d')][_0x879d('0x3d')];_0x58ae05['body'][_0x879d('0x8a')]=_0x459d84['body']['message_id'];break;case'plivo':_0x58ae05[_0x879d('0x3d')][_0x879d('0x81')]=_0x459d84['body'][_0x879d('0x82')];_0x58ae05[_0x879d('0x3d')]['body']=_0x459d84[_0x879d('0x3d')][_0x879d('0x8b')];_0x58ae05[_0x879d('0x3d')][_0x879d('0x8a')]=_0x459d84[_0x879d('0x3d')][_0x879d('0x8c')];break;case'infobip':_0x58ae05[_0x879d('0x3d')][_0x879d('0x81')]='+'+_0x459d84['body']['results'][0x0][_0x879d('0x81')];_0x58ae05[_0x879d('0x3d')][_0x879d('0x3d')]=_0x459d84[_0x879d('0x3d')][_0x879d('0x8d')][0x0][_0x879d('0x87')];_0x58ae05[_0x879d('0x3d')][_0x879d('0x8a')]=_0x459d84['body'][_0x879d('0x8d')][0x0]['messageId'];break;case _0x879d('0x8e'):_0x58ae05[_0x879d('0x3d')][_0x879d('0x81')]=_0x459d84[_0x879d('0x3d')]['originatingAddress'];_0x58ae05[_0x879d('0x3d')][_0x879d('0x3d')]=_0x459d84[_0x879d('0x3d')][_0x879d('0x8f')]['message'];break;case'clickatell':_0x58ae05[_0x879d('0x3d')][_0x879d('0x81')]=_0x459d84[_0x879d('0x3d')][_0x879d('0x90')];_0x58ae05[_0x879d('0x3d')][_0x879d('0x3d')]=_0x459d84[_0x879d('0x3d')][_0x879d('0x87')];_0x58ae05[_0x879d('0x3d')]['messageId']=_0x459d84['body']['replyMessageId'];break;case _0x879d('0x91'):_0x58ae05[_0x879d('0x3d')]['messageId']=_0x459d84[_0x879d('0x3d')][0x0][_0x879d('0x27')]['id'];_0x58ae05[_0x879d('0x3d')][_0x879d('0x81')]=_0x459d84[_0x879d('0x3d')][0x0]['message'][_0x879d('0x81')];_0x58ae05[_0x879d('0x3d')]['body']=_0x459d84[_0x879d('0x3d')][0x0]['message'][_0x879d('0x87')];break;case _0x879d('0x92'):_0x58ae05[_0x879d('0x3d')][_0x879d('0x81')]=_0x459d84[_0x879d('0x3d')][_0x879d('0x81')];_0x58ae05[_0x879d('0x3d')][_0x879d('0x3d')]=_0x459d84[_0x879d('0x3d')]['message'];_0x58ae05['body']['messageId']=_0x459d84[_0x879d('0x3d')][_0x879d('0x93')];break;}}if(_0x58ae05[_0x879d('0x3d')]['id']){delete _0x58ae05['body']['id'];}if(_[_0x879d('0x94')](_0x58ae05[_0x879d('0x3d')][_0x879d('0x81')])){throw new db[(_0x879d('0x79'))][(_0x879d('0x95'))](_0x879d('0x96'));}if(_[_0x879d('0x94')](_0x58ae05['body'][_0x879d('0x3d')])||_0x58ae05['body'][_0x879d('0x3d')]===''){throw new db[(_0x879d('0x79'))][(_0x879d('0x95'))](_0x879d('0x97'));}if(_[_0x879d('0x94')](_0x58ae05[_0x879d('0x3d')][_0x879d('0x98')])){throw new db[(_0x879d('0x79'))][(_0x879d('0x95'))](_0x879d('0x99')+_0x593910);}if(!_[_0x879d('0x9a')](_0x593910,_0x58ae05[_0x879d('0x3d')][_0x879d('0x98')])){throw new db[(_0x879d('0x79'))][(_0x879d('0x95'))](_0x879d('0x9b')+_0x593910);}_0x46972a[_0x58ae05[_0x879d('0x3d')][_0x879d('0x98')]]=_0x58ae05[_0x879d('0x3d')]['from'];return db[_0x879d('0x9c')][_0x879d('0x5d')]({'where':{'id':_0x58ae05[_0x879d('0x3f')][_0x879d('0x7e')]},'include':[{'model':db[_0x879d('0x9d')],'as':'Contacts','where':_0x46972a,'limit':0x1,'order':[['updatedAt',_0x879d('0x9e')]]}]});})['then'](handleEntityNotFound(_0x180d77,null))[_0x879d('0x21')](function(_0x408ab4){if(_0x408ab4){_0x58ae05[_0x879d('0x9f')]=_[_0x879d('0xa0')](_0x408ab4,['Contacts']);if(_0x408ab4[_0x879d('0xa1')][_0x879d('0x4e')]){return _0x408ab4[_0x879d('0xa1')][0x0];}var _0x2bc428=_['defaults'](_0x58ae05[_0x879d('0x3d')],{'firstName':_0x58ae05['body'][_0x879d('0x81')],'ListId':_0x408ab4['id']});_0x2bc428[_0x58ae05[_0x879d('0x3d')][_0x879d('0x98')]]=_0x58ae05[_0x879d('0x3d')][_0x879d('0x81')];return db[_0x879d('0x9d')]['create'](_0x2bc428,{'fields':_0x374285,'raw':!![]});}})[_0x879d('0x21')](handleEntityNotFound(_0x180d77,null))[_0x879d('0x21')](function(_0x3f7b43){if(_0x3f7b43){_0x58ae05[_0x879d('0xa2')]=_0x3f7b43;var _0x12e4e6={'ContactId':_0x3f7b43['id'],'phone':_0x58ae05[_0x879d('0x3d')][_0x879d('0x81')],'SmsAccountId':_0x459d84[_0x879d('0x5c')]['id']};var _0x507eaa={'ContactId':_0x3f7b43['id'],'SmsAccountId':_0x459d84[_0x879d('0x5c')]['id'],'closed':![]};return db[_0x879d('0xa3')]['find']({'where':_0x507eaa})[_0x879d('0x21')](function(_0x10fe2f){if(_0x10fe2f){return[_0x10fe2f,![]];}return db[_0x879d('0xa3')]['create'](_0x12e4e6)[_0x879d('0x21')](function(_0x8fdaad){return[_0x8fdaad,!![]];});});}})[_0x879d('0xa4')](function(_0x26993b,_0xfb5503){_0x58ae05[_0x879d('0xa5')]=_0x26993b[_0x879d('0x36')]({'plain':!![]});_0x58ae05['interaction'][_0x879d('0xa6')]=![];if(_0xfb5503){if(_0x58ae05['account'][_0x879d('0xa7')]){_0x58ae05[_0x879d('0x74')][_0x879d('0xa8')]({'id':0x0,'priority':_0x58ae05['applications'][_0x879d('0x4e')]+0x1,'app':_0x879d('0xa9'),'appdata':_0x879d('0xaa'),'interval':_0x879d('0xab')});}_0x58ae05[_0x879d('0xa5')][_0x879d('0xa6')]=!![];}return db[_0x879d('0xac')][_0x879d('0x5e')]({'phone':_0x58ae05[_0x879d('0x3d')]['from'],'messageId':_0x58ae05['body'][_0x879d('0x8a')],'body':_0x58ae05[_0x879d('0x3d')][_0x879d('0x3d')],'SmsAccountId':_0x459d84['params']['id'],'SmsInteractionId':_0x26993b['id'],'direction':'in','ContactId':_0x26993b[_0x879d('0xad')],'AttachmentId':_0x58ae05[_0x879d('0x3d')]['AttachmentId']});})[_0x879d('0x21')](function(_0x1fa4fa){_0x58ae05[_0x879d('0x27')]=_0x1fa4fa;if(_0x58ae05[_0x879d('0xa5')]['UserId']){return db['User'][_0x879d('0x5d')]({'attributes':['id',_0x879d('0x3b')],'where':{'id':_0x58ae05[_0x879d('0xa5')][_0x879d('0xae')]}})[_0x879d('0x21')](function(_0x25ddcb){if(_0x25ddcb){_0x58ae05[_0x879d('0x74')][_0x879d('0xaf')]({'id':0x0,'priority':0x0,'app':_0x879d('0x3e'),'appdata':_0x25ddcb['name']+','+(_0x58ae05[_0x879d('0x3f')]['waitForTheAssignedAgent']||0xa),'interval':_0x879d('0xab')});}return respondWithRpcPromise(_0x879d('0xb0'),_0x879d('0xb1'),_0x58ae05);});}return respondWithRpcPromise('Start','startRouting',_0x58ae05);})[_0x879d('0x21')](function(_0x118ec6){if(_0x118ec6){var _0x19a62a=0xc8;var _0xe57da9=_0x879d('0xb2');logger[_0x879d('0x22')](_0x879d('0xb3'),_0xe57da9,_0x19a62a,_0x879d('0xb4'));logger['debug'](_0x879d('0xb5'),_0xe57da9,_0x19a62a,_0x879d('0xb4'),JSON[_0x879d('0xb6')](_0x118ec6));if(_0x58ae05[_0x879d('0x3f')][_0x879d('0x45')]===_0x879d('0x80')){return _0x180d77['status'](_0x19a62a)['set']('Content-Type','text/xml')[_0x879d('0xb7')](_0x879d('0xb8'));}else{return _0x180d77[_0x879d('0x2f')](_0x19a62a)[_0x879d('0x2a')](_0x118ec6);}}})['catch'](handleError(_0x180d77,null));};exports[_0x879d('0xb9')]=function(_0x3f9534,_0x3612ee,_0x2e33f7){return db[_0x879d('0x42')]['findOne']({'where':{'id':_0x3f9534[_0x879d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3612ee,null))[_0x879d('0x21')](function(_0x2a28c9){if(_0x2a28c9){return db[_0x879d('0xba')][_0x879d('0xbb')](function(_0x12faa8){return db[_0x879d('0x73')]['destroy']({'where':{'SmsAccountId':_0x3f9534['params']['id']},'transaction':_0x12faa8})[_0x879d('0x21')](function(_0x215bdc){var _0x5a3397=_[_0x879d('0x6b')](_0x3f9534['body'],function(_0x2dc735){_0x2dc735[_0x879d('0x66')]=_0x3f9534[_0x879d('0x5c')]['id'];return _0x2dc735;});return db[_0x879d('0x73')][_0x879d('0xbc')](_0x5a3397,{'transaction':_0x12faa8});});})[_0x879d('0x21')](function(){return db['SmsApplication'][_0x879d('0xbd')]({'where':{'SmsAccountId':_0x3f9534['params']['id']},'order':_0x879d('0x76')});});}})[_0x879d('0x21')](respondWithResult(_0x3612ee,null))['catch'](handleError(_0x3612ee,null));};exports[_0x879d('0xbe')]=function(_0x931b79,_0x5746f5,_0x5e91e6){var _0x39ef2c={};var _0x34fd6c={};var _0x246eb2;var _0x24e4a2;return db[_0x879d('0x42')][_0x879d('0x67')]({'where':{'id':_0x931b79['params']['id']}})[_0x879d('0x21')](handleEntityNotFound(_0x5746f5,null))[_0x879d('0x21')](function(_0x2e59d3){if(_0x2e59d3){_0x246eb2=_0x2e59d3;_0x34fd6c[_0x879d('0x47')]=_[_0x879d('0x49')](db['SmsApplication'][_0x879d('0x43')]);_0x34fd6c[_0x879d('0x48')]=_[_0x879d('0x49')](_0x931b79[_0x879d('0x48')]);_0x34fd6c['filters']=_[_0x879d('0x4b')](_0x34fd6c[_0x879d('0x47')],_0x34fd6c[_0x879d('0x48')]);_0x39ef2c[_0x879d('0x4d')]=_[_0x879d('0x4b')](_0x34fd6c[_0x879d('0x47')],qs['fields'](_0x931b79['query'][_0x879d('0x4c')]));_0x39ef2c[_0x879d('0x4d')]=_0x39ef2c[_0x879d('0x4d')][_0x879d('0x4e')]?_0x39ef2c[_0x879d('0x4d')]:_0x34fd6c[_0x879d('0x47')];_0x39ef2c[_0x879d('0x50')]=qs[_0x879d('0x51')](_0x931b79['query']['sort']);_0x39ef2c[_0x879d('0x52')]=qs[_0x879d('0x4a')](_[_0x879d('0x6a')](_0x931b79['query'],_0x34fd6c[_0x879d('0x4a')]));if(_0x931b79['query'][_0x879d('0x53')]){_0x39ef2c[_0x879d('0x52')]=_['merge'](_0x39ef2c[_0x879d('0x52')],{'$or':_['map'](_0x39ef2c['attributes'],function(_0x5f4976){var _0x170d4c={};_0x170d4c[_0x5f4976]={'$like':'%'+_0x931b79[_0x879d('0x48')][_0x879d('0x53')]+'%'};return _0x170d4c;})});}_0x39ef2c=_[_0x879d('0x54')]({},_0x39ef2c,_0x931b79[_0x879d('0x56')]);return _0x246eb2[_0x879d('0xbe')](_0x39ef2c);}})[_0x879d('0x21')](function(_0x3d4c6d){if(_0x3d4c6d){_0x24e4a2=_0x3d4c6d[_0x879d('0x4e')];if(!_0x931b79['query'][_0x879d('0x4f')](_0x879d('0x69'))){_0x39ef2c[_0x879d('0x2b')]=qs[_0x879d('0x2b')](_0x931b79[_0x879d('0x48')][_0x879d('0x2b')]);_0x39ef2c['offset']=qs[_0x879d('0x2e')](_0x931b79['query'][_0x879d('0x2e')]);}return _0x246eb2[_0x879d('0xbe')](_0x39ef2c);}})[_0x879d('0x21')](function(_0x152fa8){if(_0x152fa8){return _0x152fa8?{'count':_0x24e4a2,'rows':_0x152fa8}:null;}})[_0x879d('0x21')](respondWithResult(_0x5746f5,null))[_0x879d('0x28')](handleError(_0x5746f5,null));};exports[_0x879d('0xbf')]=function(_0x2045ae,_0x3ba828,_0xc1b56b){var _0x1ecaa7={'raw':![],'where':{}};var _0x4fcca6={};var _0x54b823={'count':0x0,'rows':[]};return db[_0x879d('0x42')]['findOne']({'where':{'id':_0x2045ae[_0x879d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3ba828,null))[_0x879d('0x21')](function(_0xec6a16){if(_0xec6a16){_0x4fcca6['model']=_[_0x879d('0x49')](db['SmsInteraction'][_0x879d('0x43')]);_0x4fcca6[_0x879d('0x48')]=_[_0x879d('0x49')](_0x2045ae[_0x879d('0x48')]);_0x4fcca6[_0x879d('0x4a')]=_[_0x879d('0x4b')](_0x4fcca6[_0x879d('0x47')],_0x4fcca6[_0x879d('0x48')]);_0x1ecaa7[_0x879d('0x4d')]=_[_0x879d('0x4b')](_0x4fcca6[_0x879d('0x47')],qs[_0x879d('0x4c')](_0x2045ae[_0x879d('0x48')][_0x879d('0x4c')]));_0x1ecaa7['attributes']=_0x1ecaa7['attributes']['length']?_0x1ecaa7['attributes']:_0x4fcca6[_0x879d('0x47')];if(!_0x2045ae[_0x879d('0x48')][_0x879d('0x4f')](_0x879d('0x69'))){_0x1ecaa7['limit']=qs[_0x879d('0x2b')](_0x2045ae[_0x879d('0x48')][_0x879d('0x2b')]);_0x1ecaa7[_0x879d('0x2e')]=qs[_0x879d('0x2e')](_0x2045ae[_0x879d('0x48')][_0x879d('0x2e')]);}_0x1ecaa7[_0x879d('0x50')]=qs[_0x879d('0x51')](_0x2045ae[_0x879d('0x48')][_0x879d('0x51')]);_0x1ecaa7[_0x879d('0x52')]=qs[_0x879d('0x4a')](_['pick'](_0x2045ae[_0x879d('0x48')],_0x4fcca6[_0x879d('0x4a')]));_0x1ecaa7['where'][_0x879d('0x66')]=_0xec6a16['id'];if(_0x2045ae[_0x879d('0x48')][_0x879d('0x53')]){_0x1ecaa7[_0x879d('0x52')]=_['merge'](_0x1ecaa7['where'],{'$or':_[_0x879d('0x6b')](_0x1ecaa7[_0x879d('0x4d')],function(_0x39438c){var _0x2fb873={};_0x2fb873[_0x39438c]={'$like':'%'+_0x2045ae[_0x879d('0x48')][_0x879d('0x53')]+'%'};return _0x2fb873;})});}_0x1ecaa7=_[_0x879d('0x54')]({},_0x1ecaa7,_0x2045ae[_0x879d('0x56')]);return db[_0x879d('0xa3')][_0x879d('0x2d')]({'where':_0x1ecaa7[_0x879d('0x52')]})[_0x879d('0x21')](function(_0x57aa8b){_0x54b823[_0x879d('0x2d')]=_0x57aa8b;if(_0x2045ae[_0x879d('0x48')][_0x879d('0x57')]){_0x1ecaa7[_0x879d('0x58')]=[{'model':db[_0x879d('0x9d')],'as':_0x879d('0xc0'),'required':![]},{'model':db[_0x879d('0xc1')],'as':_0x879d('0xc2'),'attributes':[_0x879d('0x3b'),_0x879d('0xc3'),_0x879d('0xc4')],'required':![]},{'model':db[_0x879d('0xc5')],'as':_0x879d('0xc6'),'attributes':['id',_0x879d('0x3b'),_0x879d('0xc7')],'where':_0x2045ae['query'][_0x879d('0xc8')]?{'id':_0x2045ae[_0x879d('0x48')]['tag']}:undefined,'required':_0x2045ae[_0x879d('0x48')][_0x879d('0xc8')]?!![]:![]}];}return db[_0x879d('0xa3')][_0x879d('0x59')](_0x1ecaa7);})[_0x879d('0x21')](function(_0x1baab8){_0x54b823[_0x879d('0x5a')]=_0x1baab8;return _0x54b823;});}})[_0x879d('0x21')](respondWithFilteredResult(_0x3ba828,_0x1ecaa7))[_0x879d('0x28')](handleError(_0x3ba828,null));};exports[_0x879d('0xb7')]=function(_0x306144,_0x35180d,_0x44a1a3){var _0x2313b3,_0x5634ca,_0x58e6fa;if(_[_0x879d('0x94')](_0x306144[_0x879d('0x3d')][_0x879d('0x3d')])||_0x306144['body']['body']===''){throw new db[(_0x879d('0x79'))][(_0x879d('0x95'))](_0x879d('0x97'));}if(_['isNil'](_0x306144[_0x879d('0x3d')]['to'])){throw new db[(_0x879d('0x79'))][(_0x879d('0x95'))](_0x879d('0xc9'));}_0x2313b3=_0x306144[_0x879d('0x3d')]['to'];return db[_0x879d('0x42')][_0x879d('0x5d')]({'where':{'id':_0x306144['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x879d('0x9d')],'as':'Contacts','where':{'mobile':_0x2313b3},'limit':0x1,'order':[[_0x879d('0x7c'),_0x879d('0x9e')]]}]}]})[_0x879d('0x21')](handleEntityNotFound(_0x35180d,null))[_0x879d('0x21')](function(_0x158bcc){if(_0x158bcc&&_0x158bcc['List']){_0x5634ca=_0x158bcc[_0x879d('0x36')]({'plain':!![]});if(_0x5634ca[_0x879d('0xca')]&&_0x5634ca[_0x879d('0xca')][_0x879d('0xa1')][_0x879d('0x4e')]){return _0x5634ca[_0x879d('0xca')][_0x879d('0xa1')][0x0];}return db[_0x879d('0x9d')]['create'](_[_0x879d('0x19')](_0x306144[_0x879d('0x3d')],{'firstName':_0x2313b3,'mobile':_0x2313b3,'phone':_0x2313b3,'ListId':_0x5634ca[_0x879d('0x7e')]}));}})['then'](handleEntityNotFound(_0x35180d,null))[_0x879d('0x21')](function(_0x4f3593){if(_0x4f3593){_0x58e6fa=_0x4f3593;return db['SmsInteraction'][_0x879d('0x5d')]({'where':{'ContactId':_0x58e6fa['id'],'closed':![],'SmsAccountId':_0x5634ca['id']}})[_0x879d('0x21')](function(_0x8ddfb1){if(_0x8ddfb1){return[_0x8ddfb1,![]];}return db[_0x879d('0xa3')][_0x879d('0x5e')]({'UserId':_0x306144['user']['id'],'ContactId':_0x58e6fa['id'],'SmsAccountId':_0x5634ca['id'],'phone':_0x2313b3,'firstMsgDirection':_0x879d('0xcb'),'Messages':[_[_0x879d('0x54')](_0x306144['body'],{'read':![],'body':_0x306144[_0x879d('0x3d')][_0x879d('0x3d')],'phone':_0x2313b3,'SmsAccountId':_0x5634ca['id'],'UserId':_0x306144[_0x879d('0x5f')]['id'],'ContactId':_0x58e6fa['id']})]},{'include':[{'model':db[_0x879d('0xac')],'as':_0x879d('0xcc')}]})[_0x879d('0x21')](function(_0xccbc3e){return[_0xccbc3e,!![]];});});}})[_0x879d('0xa4')](function(_0x184e63,_0xe9a13e){if(_0xe9a13e){return _0x184e63;}return db['SmsMessage'][_0x879d('0x5e')](_['merge'](_0x306144['body'],{'read':![],'body':_0x306144[_0x879d('0x3d')][_0x879d('0x3d')],'phone':_0x2313b3,'SmsAccountId':_0x5634ca['id'],'SmsInteractionId':_0x184e63['id'],'UserId':_0x306144['user']['id'],'ContactId':_0x58e6fa['id']}))[_0x879d('0x21')](function(_0x3f27bc){_0x184e63[_0x879d('0xcd')][_0x879d('0xcc')]=[];_0x184e63[_0x879d('0xcd')][_0x879d('0xcc')][_0x879d('0xa8')](_0x3f27bc['dataValues']);return _0x184e63;});})[_0x879d('0x21')](respondWithResult(_0x35180d,null))[_0x879d('0x28')](handleError(_0x35180d,null));};exports[_0x879d('0x2f')]=function(_0x21db7c,_0x2c1d74,_0x2042b5){if(_0x21db7c[_0x879d('0x3d')]['id']){delete _0x21db7c[_0x879d('0x3d')]['id'];}var _0x121fce,_0xe9b260,_0x5a3ea8;return db[_0x879d('0x42')]['find']({'where':{'id':_0x21db7c[_0x879d('0x5c')]['id']}})[_0x879d('0x21')](handleEntityNotFound(_0x2c1d74,null))[_0x879d('0x21')](function(_0x2037e5){if(_0x2037e5){_0x5a3ea8=_0x2037e5;logger[_0x879d('0xce')](_0x879d('0xb3'),_0x879d('0x2f'),_0x879d('0xcf'),_0x2037e5[_0x879d('0x45')],util['inspect'](_0x21db7c[_0x879d('0x3d')],{'showHidden':![],'depth':null}));switch(_0x2037e5['type']){case'skebby':if(_0x21db7c[_0x879d('0x3d')][_0x879d('0xd0')]&&_0x21db7c['body'][_0x879d('0x2f')]){_0xe9b260=_0x21db7c[_0x879d('0x3d')]['status'];return db[_0x879d('0xac')][_0x879d('0x5d')]({'where':{'messageId':_0x21db7c['body'][_0x879d('0xd0')]}});}break;case _0x879d('0x88'):if(_0x21db7c[_0x879d('0x3d')][_0x879d('0xd1')]&&_0x21db7c[_0x879d('0x3d')][_0x879d('0xd2')]){_0xe9b260=_0x21db7c[_0x879d('0x3d')][_0x879d('0xd2')];return db[_0x879d('0xac')][_0x879d('0x5d')]({'where':{'messageId':_0x21db7c[_0x879d('0x3d')][_0x879d('0xd1')]}});}break;case _0x879d('0x89'):if(_0x21db7c[_0x879d('0x3d')][_0x879d('0xd3')]&&_0x21db7c['body']['status_code']){_0xe9b260=_0x21db7c['body'][_0x879d('0xd4')];return db['SmsMessage'][_0x879d('0x5d')]({'where':{'messageId':_0x21db7c[_0x879d('0x3d')][_0x879d('0xd3')]}});}break;case _0x879d('0xd5'):var _0x2aa92d=_0x21db7c[_0x879d('0x3d')][_0x879d('0x8d')][0x0];if(_0x2aa92d['messageId']&&_0x2aa92d['status'][_0x879d('0xd6')]===_0x879d('0xd7')){_0xe9b260=_0x2aa92d['status'][_0x879d('0xd6')];return db[_0x879d('0xac')][_0x879d('0x5d')]({'where':{'messageId':_0x2aa92d[_0x879d('0x8a')]}});}break;case _0x879d('0xd8'):if(_0x21db7c[_0x879d('0x3d')]['messageId']&&_0x21db7c[_0x879d('0x3d')][_0x879d('0x2f')]){_0xe9b260=_0x21db7c['body']['status'];return db[_0x879d('0xac')][_0x879d('0x5d')]({'where':{'messageId':_0x21db7c['body']['messageId']}});}break;case _0x879d('0x91'):if(_0x21db7c[_0x879d('0x3d')][0x0][_0x879d('0x27')]['id']){_0xe9b260=_0x21db7c[_0x879d('0x3d')][0x0]['type'];return db[_0x879d('0xac')][_0x879d('0x5d')]({'where':{'messageId':_0x21db7c[_0x879d('0x3d')][0x0][_0x879d('0x27')]['id']}});}break;case _0x879d('0x92'):if(_0x21db7c[_0x879d('0x3d')][_0x879d('0xd9')]&&_0x21db7c['body']['status']){_0xe9b260=_0x21db7c[_0x879d('0x3d')]['status'];return db[_0x879d('0xac')]['find']({'where':{'messageId':_0x21db7c[_0x879d('0x3d')][_0x879d('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x2c1d74,null))[_0x879d('0x21')](function(_0x5a7707){if(_0x5a7707){_0x121fce=_0x5a7707;switch(_0x5a3ea8['type']){case'skebby':if(_0xe9b260===_0x879d('0xd7')){return _0x121fce['update']({'read':!![]});}else{logger[_0x879d('0x25')](_0x879d('0xb3'),_0x879d('0x2f'),_0x879d('0x85'),util['inspect'](_0x21db7c[_0x879d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x879d('0x88'):if(_0xe9b260==='1'){return _0x121fce[_0x879d('0x34')]({'read':!![]});}else{logger[_0x879d('0x25')](_0x879d('0xb3'),'status',_0x879d('0x85'),util[_0x879d('0xda')](_0x21db7c['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x21db7c['body'][_0x879d('0xdb')]&&_0xe9b260>=0xc8&&_0xe9b260<=0xce){return _0x121fce['update']({'read':!![]});}else{logger[_0x879d('0x25')](_0x879d('0xb3'),_0x879d('0x2f'),_0x879d('0x89'),util[_0x879d('0xda')](_0x21db7c[_0x879d('0x3d')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x36a361=_0x21db7c[_0x879d('0x3d')]['results'][0x0];if(_0x36a361[_0x879d('0x2f')][_0x879d('0xd6')]===_0x879d('0xd7')){return _0x121fce[_0x879d('0x34')]({'read':!![]});}else{logger[_0x879d('0x25')](_0x879d('0xb3'),_0x879d('0x2f'),'infobip',util[_0x879d('0xda')](_0x21db7c[_0x879d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x879d('0xd8'):if(_0xe9b260==_0x879d('0xdc')||_0xe9b260==_0x879d('0xdd')){return _0x121fce[_0x879d('0x34')]({'read':!![]});}else{logger[_0x879d('0x25')](_0x879d('0xb3'),_0x879d('0x2f'),'clickatell',util[_0x879d('0xda')](_0x21db7c['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0xe9b260==_0x879d('0xde')){return _0x121fce[_0x879d('0x34')]({'read':!![]});}else{logger[_0x879d('0x25')](_0x879d('0xb3'),_0x879d('0x2f'),_0x879d('0x91'),util[_0x879d('0xda')](_0x21db7c[_0x879d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x879d('0x92'):if(_0xe9b260===_0x879d('0xdf')||_0xe9b260==='ACCEPTD'){return _0x121fce['update']({'read':!![]});}else{logger[_0x879d('0x25')](_0x879d('0xb3'),'status',_0x879d('0x92'),util['inspect'](_0x21db7c['body'],{'showHidden':![],'depth':null}));}break;}return _0x121fce;}})['then'](respondWithResult(_0x2c1d74,null))[_0x879d('0x28')](handleError(_0x2c1d74,null));};exports['statusGet']=function(_0xf2f9dc,_0x587dd4,_0x4622bf){var _0x4972ca,_0x28572b,_0x35dbcf;return db[_0x879d('0x42')][_0x879d('0x5d')]({'where':{'id':_0xf2f9dc['params']['id']}})[_0x879d('0x21')](handleEntityNotFound(_0x587dd4,null))[_0x879d('0x21')](function(_0x1baf58){if(_0x1baf58){_0x35dbcf=_0x1baf58;logger[_0x879d('0xce')](_0x879d('0xb3'),_0x879d('0x2f'),_0x879d('0xcf'),_0x1baf58['type'],util[_0x879d('0xda')](_0xf2f9dc[_0x879d('0x48')],{'showHidden':![],'depth':null}));switch(_0x1baf58[_0x879d('0x45')]){case _0x879d('0x8e'):if(_0xf2f9dc[_0x879d('0x48')][_0x879d('0xe0')]&&_0xf2f9dc[_0x879d('0x48')]['state']){_0x28572b=_0xf2f9dc[_0x879d('0x48')][_0x879d('0xe1')];return db['SmsMessage'][_0x879d('0x5d')]({'where':{'messageId':_0xf2f9dc[_0x879d('0x48')][_0x879d('0xe0')]}});}break;}}})['then'](handleEntityNotFound(_0x587dd4,null))[_0x879d('0x21')](function(_0x4931a3){if(_0x4931a3){_0x4972ca=_0x4931a3;switch(_0x35dbcf['type']){case _0x879d('0x8e'):if(_0x28572b==='2'||_0x28572b==='6'){return _0x4972ca[_0x879d('0x34')]({'read':!![]});}else{logger[_0x879d('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x879d('0x2f'),_0x879d('0x8e'),util[_0x879d('0xda')](_0xf2f9dc[_0x879d('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x4972ca;}})[_0x879d('0x21')](respondWithResult(_0x587dd4,null))[_0x879d('0x28')](handleError(_0x587dd4,null));};exports[_0x879d('0xe2')]=function(_0x4c6cff,_0x59d3aa,_0x5e67cb){return db[_0x879d('0x42')]['find']({'where':{'id':_0x4c6cff[_0x879d('0x5c')]['id']}})[_0x879d('0x21')](handleEntityNotFound(_0x59d3aa,null))[_0x879d('0x21')](function(_0x5f0c78){if(_0x5f0c78){return _0x5f0c78[_0x879d('0xe2')](_0x4c6cff[_0x879d('0x3d')][_0x879d('0x6d')],_[_0x879d('0xa0')](_0x4c6cff[_0x879d('0x3d')],[_0x879d('0x6d'),'id'])||{})['spread'](function(_0x14dd29){for(var _0x41f725=0x0;_0x41f725<_0x4c6cff[_0x879d('0x3d')]['ids'][_0x879d('0x4e')];_0x41f725+=0x1){socket['emit'](_0x879d('0xe3'),{'UserId':_0x4c6cff[_0x879d('0x3d')][_0x879d('0x6d')][_0x41f725],'SmsAccountId':_0x4c6cff[_0x879d('0x5c')]['id']});}return _0x14dd29;});}})['then'](respondWithResult(_0x59d3aa,null))['catch'](handleError(_0x59d3aa,null));};exports[_0x879d('0xe4')]=function(_0x59a7ad,_0x25feb7,_0x27823a){return db[_0x879d('0x42')][_0x879d('0x5d')]({'where':{'id':_0x59a7ad[_0x879d('0x5c')]['id']}})[_0x879d('0x21')](handleEntityNotFound(_0x25feb7,null))[_0x879d('0x21')](function(_0x58be90){if(_0x58be90){return _0x58be90['removeAgents'](_0x59a7ad[_0x879d('0x48')][_0x879d('0x6d')])[_0x879d('0x21')](function(){if(_['isArray'](_0x59a7ad['query']['ids'])){for(var _0x3c6756=0x0;_0x3c6756<_0x59a7ad['query'][_0x879d('0x6d')][_0x879d('0x4e')];_0x3c6756+=0x1){socket['emit'](_0x879d('0xe5'),{'UserId':Number(_0x59a7ad['query'][_0x879d('0x6d')][_0x3c6756]),'SmsAccountId':Number(_0x59a7ad['params']['id'])});}}else{socket[_0x879d('0xe6')](_0x879d('0xe5'),{'UserId':Number(_0x59a7ad[_0x879d('0x48')][_0x879d('0x6d')]),'SmsAccountId':Number(_0x59a7ad['params']['id'])});}});}})[_0x879d('0x21')](respondWithStatusCode(_0x25feb7,null))[_0x879d('0x28')](handleError(_0x25feb7,null));};exports['getAgents']=function(_0x59530f,_0x5b36ed,_0x8abccf){var _0x364247={};var _0x250a94={};var _0x270f48;var _0xc1f21c;return db['SmsAccount'][_0x879d('0x67')]({'where':{'id':_0x59530f[_0x879d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5b36ed,null))[_0x879d('0x21')](function(_0x4b76a3){if(_0x4b76a3){_0x270f48=_0x4b76a3;_0x250a94['model']=_[_0x879d('0x49')](db[_0x879d('0xc1')][_0x879d('0x43')]);_0x250a94[_0x879d('0x48')]=_[_0x879d('0x49')](_0x59530f[_0x879d('0x48')]);_0x250a94[_0x879d('0x4a')]=_[_0x879d('0x4b')](_0x250a94['model'],_0x250a94[_0x879d('0x48')]);_0x364247[_0x879d('0x4d')]=_[_0x879d('0x4b')](_0x250a94[_0x879d('0x47')],qs[_0x879d('0x4c')](_0x59530f[_0x879d('0x48')][_0x879d('0x4c')]));_0x364247['attributes']=_0x364247[_0x879d('0x4d')][_0x879d('0x4e')]?_0x364247[_0x879d('0x4d')]:_0x250a94[_0x879d('0x47')];_0x364247[_0x879d('0x50')]=qs[_0x879d('0x51')](_0x59530f['query'][_0x879d('0x51')]);_0x364247['where']=qs['filters'](_['pick'](_0x59530f[_0x879d('0x48')],_0x250a94['filters']));if(_0x59530f[_0x879d('0x48')][_0x879d('0x53')]){_0x364247['where']=_[_0x879d('0x54')](_0x364247[_0x879d('0x52')],{'$or':_[_0x879d('0x6b')](_0x364247[_0x879d('0x4d')],function(_0x275f88){var _0x3c2fd8={};_0x3c2fd8[_0x275f88]={'$like':'%'+_0x59530f['query'][_0x879d('0x53')]+'%'};return _0x3c2fd8;})});}_0x364247=_[_0x879d('0x54')]({},_0x364247,_0x59530f[_0x879d('0x56')]);return _0x270f48[_0x879d('0xe7')](_0x364247);}})[_0x879d('0x21')](function(_0x3224f2){if(_0x3224f2){_0xc1f21c=_0x3224f2['length'];if(!_0x59530f['query']['hasOwnProperty'](_0x879d('0x69'))){_0x364247[_0x879d('0x2b')]=qs['limit'](_0x59530f[_0x879d('0x48')][_0x879d('0x2b')]);_0x364247[_0x879d('0x2e')]=qs[_0x879d('0x2e')](_0x59530f[_0x879d('0x48')][_0x879d('0x2e')]);}return _0x270f48[_0x879d('0xe7')](_0x364247);}})[_0x879d('0x21')](function(_0x19751c){if(_0x19751c){return _0x19751c?{'count':_0xc1f21c,'rows':_0x19751c}:null;}})[_0x879d('0x21')](respondWithResult(_0x5b36ed,null))['catch'](handleError(_0x5b36ed,null));}; \ No newline at end of file +var _0x6282=['removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','sms','Applications','applications','orderBy','priority','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','From','Body','messageId','from','sender','text','connectel','clicksend','message_id','plivo','Text','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','omit','SmsInteraction','spread','created','autoclose','push','close','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','addApplications','sequelize','bulkCreate','getApplications','SmsApplication','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','redif','skebby','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','ids','emit','userSmsAccount:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','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/logger','api','../../config/utils','../../mysqldb','redis','defaults','./smsAccount.socket','register','jayson/promise','client','request','info','request\x20sent','debug','error','SmsAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','then','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','Pause','mandatoryDispositionPause','map','SmsAccount','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','SmsAccountId','Disposition','getDispositions','rows'];(function(_0x5752f8,_0x4c9fc9){var _0x42259d=function(_0xc2240a){while(--_0xc2240a){_0x5752f8['push'](_0x5752f8['shift']());}};_0x42259d(++_0x4c9fc9);}(_0x6282,0x76));var _0x2628=function(_0x57ec1a,_0x2b7624){_0x57ec1a=_0x57ec1a-0x0;var _0x2159ad=_0x6282[_0x57ec1a];return _0x2159ad;};'use strict';var emlformat=require(_0x2628('0x0'));var rimraf=require(_0x2628('0x1'));var zipdir=require(_0x2628('0x2'));var jsonpatch=require(_0x2628('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2628('0x4'));var Mustache=require(_0x2628('0x5'));var util=require('util');var path=require(_0x2628('0x6'));var sox=require(_0x2628('0x7'));var csv=require(_0x2628('0x8'));var ejs=require(_0x2628('0x9'));var fs=require('fs');var fs_extra=require(_0x2628('0xa'));var _=require('lodash');var squel=require(_0x2628('0xb'));var crypto=require(_0x2628('0xc'));var jsforce=require(_0x2628('0xd'));var deskjs=require(_0x2628('0xe'));var toCsv=require(_0x2628('0x8'));var querystring=require(_0x2628('0xf'));var Papa=require(_0x2628('0x10'));var Redis=require(_0x2628('0x11'));var authService=require(_0x2628('0x12'));var qs=require(_0x2628('0x13'));var as=require(_0x2628('0x14'));var hardwareService=require(_0x2628('0x15'));var logger=require(_0x2628('0x16'))(_0x2628('0x17'));var utils=require(_0x2628('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2628('0x19'))['db'];config[_0x2628('0x1a')]=_[_0x2628('0x1b')](config[_0x2628('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2628('0x1a')]));require(_0x2628('0x1c'))[_0x2628('0x1d')](socket);var jayson=require(_0x2628('0x1e'));var client=jayson[_0x2628('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x645884,_0x16e67a,_0x457163,_0x4f418d){return new BPromise(function(_0x13a728,_0x1551e4){var _0x51df16=_0x4f418d||client;return _0x51df16[_0x2628('0x20')](_0x645884,_0x457163)['then'](function(_0x441002){logger[_0x2628('0x21')]('SmsAccount,\x20%s,\x20%s',_0x16e67a,_0x2628('0x22'));logger[_0x2628('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x16e67a,_0x2628('0x22'),JSON['stringify'](_0x441002));if(_0x441002[_0x2628('0x24')]){if(_0x441002['error']['code']===0x1f4){logger[_0x2628('0x24')](_0x2628('0x25'),_0x16e67a,_0x441002[_0x2628('0x24')][_0x2628('0x26')]);return _0x1551e4(_0x441002[_0x2628('0x24')][_0x2628('0x26')]);}logger[_0x2628('0x24')](_0x2628('0x25'),_0x16e67a,_0x441002[_0x2628('0x24')]['message']);return _0x13a728(_0x441002[_0x2628('0x24')][_0x2628('0x26')]);}else{logger[_0x2628('0x21')](_0x2628('0x25'),_0x16e67a,_0x2628('0x22'));_0x13a728(_0x441002['result'][_0x2628('0x26')]);}})[_0x2628('0x27')](function(_0xa1ec75){logger[_0x2628('0x24')](_0x2628('0x25'),_0x16e67a,_0xa1ec75);_0x1551e4(_0xa1ec75);});});}function respondWithStatusCode(_0x57455c,_0x4a8768){_0x4a8768=_0x4a8768||0xcc;return function(_0x459681){if(_0x459681){return _0x57455c[_0x2628('0x28')](_0x4a8768);}return _0x57455c[_0x2628('0x29')](_0x4a8768)[_0x2628('0x2a')]();};}function respondWithResult(_0x135ed7,_0x571711){_0x571711=_0x571711||0xc8;return function(_0x433265){if(_0x433265){return _0x135ed7[_0x2628('0x29')](_0x571711)[_0x2628('0x2b')](_0x433265);}};}function respondWithFilteredResult(_0x1df2d8,_0x2c27fe){return function(_0x118e75){if(_0x118e75){var _0x49480f=typeof _0x2c27fe['offset']===_0x2628('0x2c')&&typeof _0x2c27fe[_0x2628('0x2d')]===_0x2628('0x2c');var _0x59a28e=_0x118e75['count'];var _0x17bc01=_0x49480f?0x0:_0x2c27fe[_0x2628('0x2e')];var _0x1174cd=_0x49480f?_0x118e75[_0x2628('0x2f')]:_0x2c27fe['offset']+_0x2c27fe[_0x2628('0x2d')];var _0x1dd96a;if(_0x1174cd>=_0x59a28e){_0x1174cd=_0x59a28e;_0x1dd96a=0xc8;}else{_0x1dd96a=0xce;}_0x1df2d8[_0x2628('0x29')](_0x1dd96a);return _0x1df2d8[_0x2628('0x30')]('Content-Range',_0x17bc01+'-'+_0x1174cd+'/'+_0x59a28e)[_0x2628('0x2b')](_0x118e75);}return null;};}function patchUpdates(_0x16cd54){return function(_0x70d522){try{jsonpatch[_0x2628('0x31')](_0x70d522,_0x16cd54,!![]);}catch(_0x45711d){return BPromise[_0x2628('0x32')](_0x45711d);}return _0x70d522[_0x2628('0x33')]();};}function saveUpdates(_0x31d231,_0x127e25){return function(_0x5a7157){if(_0x5a7157){return _0x5a7157[_0x2628('0x34')](_0x31d231)[_0x2628('0x35')](function(_0x3b2b89){return _0x3b2b89;});}return null;};}function removeEntity(_0x2d18a5,_0x1b711d){return function(_0x5607b0){if(_0x5607b0){return _0x5607b0['destroy']()[_0x2628('0x35')](function(){var _0x42930c=_0x5607b0[_0x2628('0x36')]({'plain':!![]});var _0x572e2d=_0x2628('0x37');return db[_0x2628('0x38')][_0x2628('0x39')]({'where':{'type':_0x572e2d,'resourceId':_0x42930c['id']}})['then'](function(){return _0x5607b0;});})[_0x2628('0x35')](function(){_0x2d18a5[_0x2628('0x29')](0xcc)[_0x2628('0x2a')]();});}};}function handleEntityNotFound(_0x4792fa,_0x497e6b){return function(_0x5c7af8){if(!_0x5c7af8){_0x4792fa['sendStatus'](0x194);}return _0x5c7af8;};}function handleError(_0x154650,_0x20a424){_0x20a424=_0x20a424||0x1f4;return function(_0x276285){logger['error'](_0x276285[_0x2628('0x3a')]);if(_0x276285[_0x2628('0x3b')]){delete _0x276285[_0x2628('0x3b')];}_0x154650['status'](_0x20a424)[_0x2628('0x3c')](_0x276285);};}function getMustacheRender(_0x3daa48,_0x184c01){return Mustache[_0x2628('0x3d')](_0x3daa48,_[_0x2628('0x3e')](_0x184c01[_0x2628('0x3f')],{'contact':_0x184c01[_0x2628('0x40')],'message':_0x184c01['message'],'agent':_0x184c01[_0x2628('0x41')],'interaction':_0x184c01[_0x2628('0x42')],'account':_0x184c01[_0x2628('0x43')]}))||'';}exports[_0x2628('0x44')]=function(_0x13de4d,_0x2bc23f){var _0x5cad89={'include':[{'model':db[_0x2628('0x45')],'as':_0x2628('0x46')}]},_0x32a593={},_0x55ffda={'count':0x0,'rows':[]};var _0x3a88f9=_[_0x2628('0x47')](db[_0x2628('0x48')]['rawAttributes'],function(_0x1f7743){return{'name':_0x1f7743['fieldName'],'type':_0x1f7743['type'][_0x2628('0x49')]};});_0x32a593[_0x2628('0x4a')]=_[_0x2628('0x47')](_0x3a88f9,_0x2628('0x3b'));_0x32a593[_0x2628('0x4b')]=_['keys'](_0x13de4d[_0x2628('0x4b')]);_0x32a593[_0x2628('0x4c')]=_[_0x2628('0x4d')](_0x32a593[_0x2628('0x4a')],_0x32a593[_0x2628('0x4b')]);_0x5cad89['attributes']=_[_0x2628('0x4d')](_0x32a593['model'],qs[_0x2628('0x4e')](_0x13de4d[_0x2628('0x4b')][_0x2628('0x4e')]));_0x5cad89[_0x2628('0x4f')]=_0x5cad89['attributes']['length']?_0x5cad89[_0x2628('0x4f')]:_0x32a593[_0x2628('0x4a')];if(!_0x13de4d['query'][_0x2628('0x50')](_0x2628('0x51'))){_0x5cad89[_0x2628('0x2d')]=qs[_0x2628('0x2d')](_0x13de4d['query'][_0x2628('0x2d')]);_0x5cad89[_0x2628('0x2e')]=qs[_0x2628('0x2e')](_0x13de4d[_0x2628('0x4b')][_0x2628('0x2e')]);}_0x5cad89[_0x2628('0x52')]=qs[_0x2628('0x53')](_0x13de4d[_0x2628('0x4b')]['sort']);_0x5cad89[_0x2628('0x54')]=qs['filters'](_[_0x2628('0x55')](_0x13de4d['query'],_0x32a593[_0x2628('0x4c')]),_0x3a88f9);if(_0x13de4d[_0x2628('0x4b')][_0x2628('0x56')]){_0x5cad89[_0x2628('0x54')]=_[_0x2628('0x3e')](_0x5cad89['where'],{'$or':_[_0x2628('0x47')](_0x3a88f9,function(_0x5bac16){if(_0x5bac16[_0x2628('0x57')]!==_0x2628('0x58')){var _0xbd5fc9={};_0xbd5fc9[_0x5bac16['name']]={'$like':'%'+_0x13de4d[_0x2628('0x4b')][_0x2628('0x56')]+'%'};return _0xbd5fc9;}})});}_0x5cad89=_['merge']({},_0x5cad89,_0x13de4d[_0x2628('0x59')]);var _0x32f3d2={'where':_0x5cad89[_0x2628('0x54')]};return db[_0x2628('0x48')][_0x2628('0x2f')](_0x32f3d2)['then'](function(_0x405e07){_0x55ffda['count']=_0x405e07;if(_0x13de4d[_0x2628('0x4b')][_0x2628('0x5a')]){_0x5cad89[_0x2628('0x5b')]=[{'all':!![]}];}return db[_0x2628('0x48')][_0x2628('0x5c')](_0x5cad89);})[_0x2628('0x35')](function(_0x3a3528){_0x55ffda['rows']=_0x3a3528;return _0x55ffda;})[_0x2628('0x35')](respondWithFilteredResult(_0x2bc23f,_0x5cad89))[_0x2628('0x27')](handleError(_0x2bc23f,null));};exports[_0x2628('0x5d')]=function(_0x403c78,_0x1838c7){var _0x426538={'raw':![],'where':{'id':_0x403c78[_0x2628('0x5e')]['id']},'include':[{'model':db[_0x2628('0x45')],'as':'mandatoryDispositionPause'}]},_0x1aa06a={};_0x1aa06a['model']=_[_0x2628('0x5f')](db[_0x2628('0x48')][_0x2628('0x60')]);_0x1aa06a[_0x2628('0x4b')]=_[_0x2628('0x5f')](_0x403c78['query']);_0x1aa06a['filters']=_[_0x2628('0x4d')](_0x1aa06a['model'],_0x1aa06a[_0x2628('0x4b')]);_0x426538[_0x2628('0x4f')]=_[_0x2628('0x4d')](_0x1aa06a[_0x2628('0x4a')],qs[_0x2628('0x4e')](_0x403c78[_0x2628('0x4b')][_0x2628('0x4e')]));_0x426538[_0x2628('0x4f')]=_0x426538[_0x2628('0x4f')][_0x2628('0x61')]?_0x426538[_0x2628('0x4f')]:_0x1aa06a[_0x2628('0x4a')];if(_0x403c78[_0x2628('0x4b')][_0x2628('0x5a')]){_0x426538[_0x2628('0x5b')]=[{'all':!![]}];}_0x426538=_[_0x2628('0x3e')]({},_0x426538,_0x403c78[_0x2628('0x59')]);return db[_0x2628('0x48')][_0x2628('0x62')](_0x426538)[_0x2628('0x35')](handleEntityNotFound(_0x1838c7,null))[_0x2628('0x35')](respondWithResult(_0x1838c7,null))[_0x2628('0x27')](handleError(_0x1838c7,null));};exports['create']=function(_0x36c920,_0x177ab1){return db['SmsAccount'][_0x2628('0x63')](_0x36c920[_0x2628('0x3f')],{})[_0x2628('0x35')](function(_0x1bf368){var _0x13187b=_0x36c920[_0x2628('0x64')][_0x2628('0x36')]({'plain':!![]});if(!_0x13187b)throw new Error(_0x2628('0x65'));if(_0x13187b['role']===_0x2628('0x64')){var _0x38c0bc=_0x1bf368[_0x2628('0x36')]({'plain':!![]});var _0x553128=_0x2628('0x37');return db[_0x2628('0x66')][_0x2628('0x62')]({'where':{'name':_0x553128,'userProfileId':_0x13187b[_0x2628('0x67')]},'raw':!![]})[_0x2628('0x35')](function(_0x4b574f){if(_0x4b574f&&_0x4b574f[_0x2628('0x68')]===0x0){return db['UserProfileResource']['create']({'name':_0x38c0bc['name'],'resourceId':_0x38c0bc['id'],'type':_0x4b574f[_0x2628('0x3b')],'sectionId':_0x4b574f['id']},{})[_0x2628('0x35')](function(){return _0x1bf368;});}else{return _0x1bf368;}})['catch'](function(_0x1bbb9a){logger[_0x2628('0x24')](_0x2628('0x69'),_0x1bbb9a);throw _0x1bbb9a;});}return _0x1bf368;})['then'](respondWithResult(_0x177ab1,0xc9))['catch'](handleError(_0x177ab1,null));};exports['update']=function(_0x54f9c0,_0x3a3477){if(_0x54f9c0[_0x2628('0x3f')]['id']){delete _0x54f9c0[_0x2628('0x3f')]['id'];}return db[_0x2628('0x48')][_0x2628('0x62')]({'where':{'id':_0x54f9c0['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x2628('0x35')](handleEntityNotFound(_0x3a3477,null))[_0x2628('0x35')](saveUpdates(_0x54f9c0['body'],null))['then'](respondWithResult(_0x3a3477,null))[_0x2628('0x27')](handleError(_0x3a3477,null));};exports[_0x2628('0x39')]=function(_0x54869e,_0x189c92){return db[_0x2628('0x48')][_0x2628('0x62')]({'where':{'id':_0x54869e['params']['id']}})['then'](handleEntityNotFound(_0x189c92,null))[_0x2628('0x35')](removeEntity(_0x189c92,null))[_0x2628('0x27')](handleError(_0x189c92,null));};exports['describe']=function(_0x321e4d,_0x1c5575){return db[_0x2628('0x48')]['describe']()[_0x2628('0x35')](respondWithResult(_0x1c5575,null))[_0x2628('0x27')](handleError(_0x1c5575,null));};exports['addDisposition']=function(_0x22278f,_0x93072a,_0x219aeb){if(_0x22278f[_0x2628('0x3f')]['id']){delete _0x22278f['body']['id'];}return db[_0x2628('0x48')][_0x2628('0x62')]({'where':{'id':_0x22278f[_0x2628('0x5e')]['id']}})['then'](handleEntityNotFound(_0x93072a,null))['then'](function(_0x4fe8b1){if(_0x4fe8b1){_0x22278f[_0x2628('0x3f')][_0x2628('0x6a')]=_0x4fe8b1['id'];return db[_0x2628('0x6b')][_0x2628('0x63')](_0x22278f['body']);}})['then'](respondWithResult(_0x93072a,null))[_0x2628('0x27')](handleError(_0x93072a,null));};exports[_0x2628('0x6c')]=function(_0x5b540f,_0x1ea2e9,_0xff4c5e){var _0x2b5053={'raw':![],'where':{}};var _0x21ecd2={};var _0x121435={'count':0x0,'rows':[]};return db[_0x2628('0x48')]['findOne']({'where':{'id':_0x5b540f[_0x2628('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1ea2e9,null))[_0x2628('0x35')](function(_0x544a91){if(_0x544a91){_0x21ecd2[_0x2628('0x4a')]=_[_0x2628('0x5f')](db[_0x2628('0x6b')][_0x2628('0x60')]);_0x21ecd2[_0x2628('0x4b')]=_[_0x2628('0x5f')](_0x5b540f[_0x2628('0x4b')]);_0x21ecd2[_0x2628('0x4c')]=_[_0x2628('0x4d')](_0x21ecd2[_0x2628('0x4a')],_0x21ecd2[_0x2628('0x4b')]);_0x2b5053[_0x2628('0x4f')]=_[_0x2628('0x4d')](_0x21ecd2[_0x2628('0x4a')],qs[_0x2628('0x4e')](_0x5b540f['query'][_0x2628('0x4e')]));_0x2b5053[_0x2628('0x4f')]=_0x2b5053[_0x2628('0x4f')][_0x2628('0x61')]?_0x2b5053[_0x2628('0x4f')]:_0x21ecd2[_0x2628('0x4a')];if(!_0x5b540f[_0x2628('0x4b')][_0x2628('0x50')]('nolimit')){_0x2b5053[_0x2628('0x2d')]=qs['limit'](_0x5b540f[_0x2628('0x4b')]['limit']);_0x2b5053[_0x2628('0x2e')]=qs[_0x2628('0x2e')](_0x5b540f[_0x2628('0x4b')][_0x2628('0x2e')]);}_0x2b5053[_0x2628('0x52')]=qs['sort'](_0x5b540f[_0x2628('0x4b')][_0x2628('0x53')]);_0x2b5053[_0x2628('0x54')]=qs[_0x2628('0x4c')](_[_0x2628('0x55')](_0x5b540f[_0x2628('0x4b')],_0x21ecd2[_0x2628('0x4c')]));_0x2b5053[_0x2628('0x54')][_0x2628('0x6a')]=_0x544a91['id'];if(_0x5b540f[_0x2628('0x4b')][_0x2628('0x56')]){_0x2b5053['where']=_[_0x2628('0x3e')](_0x2b5053['where'],{'$or':_[_0x2628('0x47')](_0x2b5053[_0x2628('0x4f')],function(_0xf1007d){var _0x3767ec={};_0x3767ec[_0xf1007d]={'$like':'%'+_0x5b540f['query']['filter']+'%'};return _0x3767ec;})});}_0x2b5053=_[_0x2628('0x3e')]({},_0x2b5053,_0x5b540f[_0x2628('0x59')]);return db['Disposition'][_0x2628('0x2f')]({'where':_0x2b5053['where']})['then'](function(_0x2d294c){_0x121435[_0x2628('0x2f')]=_0x2d294c;if(_0x5b540f['query'][_0x2628('0x5a')]){_0x2b5053['include']=[{'all':!![]}];}return db['Disposition'][_0x2628('0x5c')](_0x2b5053);})[_0x2628('0x35')](function(_0xbd2b20){_0x121435[_0x2628('0x6d')]=_0xbd2b20;return _0x121435;});}})[_0x2628('0x35')](respondWithFilteredResult(_0x1ea2e9,_0x2b5053))[_0x2628('0x27')](handleError(_0x1ea2e9,null));};exports[_0x2628('0x6e')]=function(_0x564619,_0x10c130,_0x245061){return db['SmsAccount'][_0x2628('0x62')]({'where':{'id':_0x564619[_0x2628('0x5e')]['id']}})[_0x2628('0x35')](handleEntityNotFound(_0x10c130,null))[_0x2628('0x35')](function(_0x581371){if(_0x581371){return _0x581371[_0x2628('0x6e')](_0x564619['query']['ids']);}})[_0x2628('0x35')](respondWithStatusCode(_0x10c130,null))[_0x2628('0x27')](handleError(_0x10c130,null));};exports[_0x2628('0x6f')]=function(_0x2f67f0,_0x1859f2,_0x485fb2){if(_0x2f67f0[_0x2628('0x3f')]['id']){delete _0x2f67f0['body']['id'];}return db[_0x2628('0x48')][_0x2628('0x62')]({'where':{'id':_0x2f67f0[_0x2628('0x5e')]['id']}})[_0x2628('0x35')](handleEntityNotFound(_0x1859f2,null))[_0x2628('0x35')](function(_0xd442f9){if(_0xd442f9){_0x2f67f0[_0x2628('0x3f')]['SmsAccountId']=_0xd442f9['id'];return db['CannedAnswer'][_0x2628('0x63')](_0x2f67f0[_0x2628('0x3f')]);}})['then'](respondWithResult(_0x1859f2,null))['catch'](handleError(_0x1859f2,null));};exports[_0x2628('0x70')]=function(_0x39e3a4,_0x569861,_0x4f5dce){var _0x7f1364={'raw':![],'where':{}};var _0x400267={};var _0xd4aeb0={'count':0x0,'rows':[]};return db[_0x2628('0x48')][_0x2628('0x71')]({'where':{'id':_0x39e3a4[_0x2628('0x5e')]['id']}})[_0x2628('0x35')](handleEntityNotFound(_0x569861,null))['then'](function(_0x3ff209){if(_0x3ff209){_0x400267[_0x2628('0x4a')]=_[_0x2628('0x5f')](db[_0x2628('0x72')][_0x2628('0x60')]);_0x400267[_0x2628('0x4b')]=_[_0x2628('0x5f')](_0x39e3a4[_0x2628('0x4b')]);_0x400267[_0x2628('0x4c')]=_[_0x2628('0x4d')](_0x400267[_0x2628('0x4a')],_0x400267[_0x2628('0x4b')]);_0x7f1364[_0x2628('0x4f')]=_[_0x2628('0x4d')](_0x400267[_0x2628('0x4a')],qs['fields'](_0x39e3a4[_0x2628('0x4b')][_0x2628('0x4e')]));_0x7f1364[_0x2628('0x4f')]=_0x7f1364[_0x2628('0x4f')][_0x2628('0x61')]?_0x7f1364[_0x2628('0x4f')]:_0x400267['model'];if(!_0x39e3a4[_0x2628('0x4b')]['hasOwnProperty'](_0x2628('0x51'))){_0x7f1364[_0x2628('0x2d')]=qs[_0x2628('0x2d')](_0x39e3a4[_0x2628('0x4b')][_0x2628('0x2d')]);_0x7f1364[_0x2628('0x2e')]=qs['offset'](_0x39e3a4[_0x2628('0x4b')]['offset']);}_0x7f1364[_0x2628('0x52')]=qs[_0x2628('0x53')](_0x39e3a4[_0x2628('0x4b')][_0x2628('0x53')]);_0x7f1364[_0x2628('0x54')]=qs[_0x2628('0x4c')](_[_0x2628('0x55')](_0x39e3a4[_0x2628('0x4b')],_0x400267['filters']));_0x7f1364[_0x2628('0x54')]['SmsAccountId']=_0x3ff209['id'];if(_0x39e3a4[_0x2628('0x4b')]['filter']){_0x7f1364['where']=_[_0x2628('0x3e')](_0x7f1364['where'],{'$or':_[_0x2628('0x47')](_0x7f1364[_0x2628('0x4f')],function(_0xc6797e){var _0x276a5d={};_0x276a5d[_0xc6797e]={'$like':'%'+_0x39e3a4['query']['filter']+'%'};return _0x276a5d;})});}_0x7f1364=_[_0x2628('0x3e')]({},_0x7f1364,_0x39e3a4[_0x2628('0x59')]);return db[_0x2628('0x72')][_0x2628('0x2f')]({'where':_0x7f1364[_0x2628('0x54')]})[_0x2628('0x35')](function(_0x548756){_0xd4aeb0[_0x2628('0x2f')]=_0x548756;if(_0x39e3a4[_0x2628('0x4b')]['includeAll']){_0x7f1364[_0x2628('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2628('0x5c')](_0x7f1364);})[_0x2628('0x35')](function(_0x30b752){_0xd4aeb0[_0x2628('0x6d')]=_0x30b752;return _0xd4aeb0;});}})[_0x2628('0x35')](respondWithFilteredResult(_0x569861,_0x7f1364))[_0x2628('0x27')](handleError(_0x569861,null));};exports['removeAnswers']=function(_0x5209ee,_0x12041e,_0x183305){return db[_0x2628('0x48')][_0x2628('0x62')]({'where':{'id':_0x5209ee[_0x2628('0x5e')]['id']}})['then'](handleEntityNotFound(_0x12041e,null))[_0x2628('0x35')](function(_0x2b40ef){if(_0x2b40ef){return _0x2b40ef[_0x2628('0x73')](_0x5209ee[_0x2628('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x12041e,null))[_0x2628('0x27')](handleError(_0x12041e,null));};exports['notify']=function(_0x3379d7,_0x3b6e9c,_0x2fd5be){var _0x51a816={'channel':_0x2628('0x74')};var _0x3b2771=[];var _0x3a139e=[];var _0x1511d6={};return db[_0x2628('0x48')][_0x2628('0x62')]({'where':{'id':_0x3379d7['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x2628('0x75')}]})['then'](handleEntityNotFound(_0x3b6e9c,null))[_0x2628('0x35')](function(_0x15a406){_0x51a816['account']=_0x15a406;_0x51a816[_0x2628('0x76')]=_[_0x2628('0x77')](_0x15a406['Applications'],[_0x2628('0x78')],['asc']);if(_0x51a816[_0x2628('0x43')][_0x2628('0x75')]){delete _0x51a816[_0x2628('0x43')][_0x2628('0x75')];}return db[_0x2628('0x79')][_0x2628('0x7a')]();})[_0x2628('0x35')](function(_0x3cd65f){if(!_0x3cd65f){throw new db[(_0x2628('0x7b'))][(_0x2628('0x7c'))](_0x2628('0x7d'));}_0x3b2771=_[_0x2628('0x7e')](_[_0x2628('0x5f')](_0x3cd65f),['createdAt','updatedAt']);_0x3a139e=_[_0x2628('0x7e')](_[_0x2628('0x5f')](_0x3cd65f),[_0x2628('0x7f'),_0x2628('0x80'),'CompanyId',_0x2628('0x81')]);_0x51a816[_0x2628('0x3f')]={'mapKey':_0x2628('0x82')};if(_0x51a816['account'][_0x2628('0x57')]){switch(_0x51a816[_0x2628('0x43')][_0x2628('0x57')]){case _0x2628('0x83'):_0x51a816[_0x2628('0x3f')]['from']=_0x3379d7[_0x2628('0x3f')][_0x2628('0x84')];_0x51a816[_0x2628('0x3f')][_0x2628('0x3f')]=_0x3379d7[_0x2628('0x3f')][_0x2628('0x85')];_0x51a816[_0x2628('0x3f')][_0x2628('0x86')]=_0x3379d7['body']['MessageSid'];break;case'skebby':_0x51a816[_0x2628('0x3f')][_0x2628('0x87')]='+'+_0x3379d7[_0x2628('0x3f')][_0x2628('0x88')];_0x51a816[_0x2628('0x3f')][_0x2628('0x3f')]=_0x3379d7[_0x2628('0x3f')][_0x2628('0x89')];break;case _0x2628('0x8a'):_0x51a816[_0x2628('0x3f')]['from']=_0x3379d7[_0x2628('0x3f')][_0x2628('0x87')];_0x51a816[_0x2628('0x3f')]['body']=_0x3379d7[_0x2628('0x3f')]['message'];break;case _0x2628('0x8b'):_0x51a816['body']['from']=_0x3379d7[_0x2628('0x3f')][_0x2628('0x87')];_0x51a816[_0x2628('0x3f')]['body']=_0x3379d7[_0x2628('0x3f')][_0x2628('0x3f')];_0x51a816[_0x2628('0x3f')]['messageId']=_0x3379d7[_0x2628('0x3f')][_0x2628('0x8c')];break;case _0x2628('0x8d'):_0x51a816[_0x2628('0x3f')][_0x2628('0x87')]=_0x3379d7[_0x2628('0x3f')]['From'];_0x51a816[_0x2628('0x3f')]['body']=_0x3379d7[_0x2628('0x3f')][_0x2628('0x8e')];_0x51a816[_0x2628('0x3f')]['messageId']=_0x3379d7[_0x2628('0x3f')]['MessageUUID'];break;case'infobip':_0x51a816[_0x2628('0x3f')][_0x2628('0x87')]='+'+_0x3379d7[_0x2628('0x3f')][_0x2628('0x8f')][0x0][_0x2628('0x87')];_0x51a816[_0x2628('0x3f')][_0x2628('0x3f')]=_0x3379d7['body'][_0x2628('0x8f')][0x0][_0x2628('0x89')];_0x51a816['body'][_0x2628('0x86')]=_0x3379d7[_0x2628('0x3f')]['results'][0x0]['messageId'];break;case'csc':_0x51a816['body'][_0x2628('0x87')]=_0x3379d7['body'][_0x2628('0x90')];_0x51a816['body'][_0x2628('0x3f')]=_0x3379d7[_0x2628('0x3f')][_0x2628('0x91')][_0x2628('0x26')];break;case _0x2628('0x92'):_0x51a816[_0x2628('0x3f')][_0x2628('0x87')]=_0x3379d7[_0x2628('0x3f')][_0x2628('0x93')];_0x51a816[_0x2628('0x3f')][_0x2628('0x3f')]=_0x3379d7[_0x2628('0x3f')][_0x2628('0x89')];_0x51a816[_0x2628('0x3f')][_0x2628('0x86')]=_0x3379d7[_0x2628('0x3f')][_0x2628('0x94')];break;case _0x2628('0x95'):_0x51a816[_0x2628('0x3f')]['messageId']=_0x3379d7[_0x2628('0x3f')][0x0]['message']['id'];_0x51a816[_0x2628('0x3f')][_0x2628('0x87')]=_0x3379d7[_0x2628('0x3f')][0x0]['message'][_0x2628('0x87')];_0x51a816[_0x2628('0x3f')][_0x2628('0x3f')]=_0x3379d7[_0x2628('0x3f')][0x0]['message']['text'];break;case _0x2628('0x96'):_0x51a816[_0x2628('0x3f')][_0x2628('0x87')]=_0x3379d7[_0x2628('0x3f')][_0x2628('0x87')];_0x51a816[_0x2628('0x3f')][_0x2628('0x3f')]=_0x3379d7[_0x2628('0x3f')][_0x2628('0x26')];_0x51a816[_0x2628('0x3f')][_0x2628('0x86')]=_0x3379d7[_0x2628('0x3f')][_0x2628('0x97')];break;}}if(_0x51a816[_0x2628('0x3f')]['id']){delete _0x51a816['body']['id'];}if(_[_0x2628('0x98')](_0x51a816[_0x2628('0x3f')]['from'])){throw new db[(_0x2628('0x7b'))][(_0x2628('0x7c'))](_0x2628('0x99'));}if(_[_0x2628('0x98')](_0x51a816[_0x2628('0x3f')][_0x2628('0x3f')])||_0x51a816[_0x2628('0x3f')]['body']===''){throw new db[(_0x2628('0x7b'))][(_0x2628('0x7c'))](_0x2628('0x9a'));}if(_[_0x2628('0x98')](_0x51a816[_0x2628('0x3f')]['mapKey'])){throw new db[(_0x2628('0x7b'))][(_0x2628('0x7c'))](_0x2628('0x9b')+_0x3a139e);}if(!_[_0x2628('0x9c')](_0x3a139e,_0x51a816['body'][_0x2628('0x9d')])){throw new db['Sequelize'][(_0x2628('0x7c'))](_0x2628('0x9e')+_0x3a139e);}_0x1511d6[_0x51a816[_0x2628('0x3f')]['mapKey']]=_0x51a816[_0x2628('0x3f')][_0x2628('0x87')];return db['CmList']['find']({'where':{'id':_0x51a816[_0x2628('0x43')][_0x2628('0x81')]},'include':[{'model':db[_0x2628('0x79')],'as':_0x2628('0x9f'),'where':_0x1511d6,'limit':0x1,'order':[[_0x2628('0x80'),_0x2628('0xa0')]]}]});})['then'](handleEntityNotFound(_0x3b6e9c,null))['then'](function(_0x27f963){if(_0x27f963){_0x51a816['list']=_[_0x2628('0xa1')](_0x27f963,[_0x2628('0x9f')]);if(_0x27f963[_0x2628('0x9f')][_0x2628('0x61')]){return _0x27f963['Contacts'][0x0];}var _0x278282=_['defaults'](_0x51a816['body'],{'firstName':_0x51a816[_0x2628('0x3f')]['from'],'ListId':_0x27f963['id']});_0x278282[_0x51a816[_0x2628('0x3f')][_0x2628('0x9d')]]=_0x51a816['body'][_0x2628('0x87')];return db[_0x2628('0x79')]['create'](_0x278282,{'fields':_0x3b2771,'raw':!![]});}})[_0x2628('0x35')](handleEntityNotFound(_0x3b6e9c,null))[_0x2628('0x35')](function(_0x4b94de){if(_0x4b94de){_0x51a816[_0x2628('0x40')]=_0x4b94de;var _0x9de7c6={'ContactId':_0x4b94de['id'],'phone':_0x51a816[_0x2628('0x3f')][_0x2628('0x87')],'SmsAccountId':_0x3379d7[_0x2628('0x5e')]['id']};var _0x304b6e={'ContactId':_0x4b94de['id'],'SmsAccountId':_0x3379d7[_0x2628('0x5e')]['id'],'closed':![]};return db[_0x2628('0xa2')][_0x2628('0x62')]({'where':_0x304b6e})[_0x2628('0x35')](function(_0x4d7f7e){if(_0x4d7f7e){return[_0x4d7f7e,![]];}return db[_0x2628('0xa2')]['create'](_0x9de7c6)[_0x2628('0x35')](function(_0x447d8f){return[_0x447d8f,!![]];});});}})[_0x2628('0xa3')](function(_0x1b5360,_0x5baf26){_0x51a816[_0x2628('0x42')]=_0x1b5360[_0x2628('0x36')]({'plain':!![]});_0x51a816[_0x2628('0x42')][_0x2628('0xa4')]=![];if(_0x5baf26){if(_0x51a816[_0x2628('0x43')][_0x2628('0xa5')]){_0x51a816['applications'][_0x2628('0xa6')]({'id':0x0,'priority':_0x51a816[_0x2628('0x76')][_0x2628('0x61')]+0x1,'app':_0x2628('0xa7'),'appdata':'unmanaged','interval':_0x2628('0xa8')});}_0x51a816[_0x2628('0x42')][_0x2628('0xa4')]=!![];}return db[_0x2628('0xa9')]['create']({'phone':_0x51a816[_0x2628('0x3f')][_0x2628('0x87')],'messageId':_0x51a816['body'][_0x2628('0x86')],'body':_0x51a816[_0x2628('0x3f')][_0x2628('0x3f')],'SmsAccountId':_0x3379d7[_0x2628('0x5e')]['id'],'SmsInteractionId':_0x1b5360['id'],'direction':'in','ContactId':_0x1b5360['ContactId'],'AttachmentId':_0x51a816['body'][_0x2628('0xaa')]});})['then'](function(_0x13ca1f){_0x51a816['message']=_0x13ca1f;if(_0x51a816[_0x2628('0x42')][_0x2628('0xab')]){return db[_0x2628('0xac')][_0x2628('0x62')]({'attributes':['id',_0x2628('0x3b')],'where':{'id':_0x51a816['interaction'][_0x2628('0xab')]}})[_0x2628('0x35')](function(_0x201dfb){if(_0x201dfb){_0x51a816[_0x2628('0x76')][_0x2628('0xad')]({'id':0x0,'priority':0x0,'app':_0x2628('0x41'),'appdata':_0x201dfb['name']+','+(_0x51a816['account'][_0x2628('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2628('0xaf'),'startRouting',_0x51a816);});}return respondWithRpcPromise(_0x2628('0xaf'),_0x2628('0xb0'),_0x51a816);})['then'](function(_0x36cbd7){if(_0x36cbd7){var _0x4e02f1=0xc8;var _0x12c9da=_0x2628('0xb1');logger['info'](_0x2628('0xb2'),_0x12c9da,_0x4e02f1,_0x2628('0xb3'));logger[_0x2628('0x23')](_0x2628('0xb4'),_0x12c9da,_0x4e02f1,_0x2628('0xb3'),JSON[_0x2628('0xb5')](_0x36cbd7));if(_0x51a816['account'][_0x2628('0x57')]===_0x2628('0x83')){return _0x3b6e9c[_0x2628('0x29')](_0x4e02f1)['set'](_0x2628('0xb6'),'text/xml')[_0x2628('0x3c')]('\x0a');}else{return _0x3b6e9c[_0x2628('0x29')](_0x4e02f1)[_0x2628('0x2b')](_0x36cbd7);}}})[_0x2628('0x27')](handleError(_0x3b6e9c,null));};exports[_0x2628('0xb7')]=function(_0x3cc097,_0x5a386e,_0x507ae8){return db[_0x2628('0x48')][_0x2628('0x71')]({'where':{'id':_0x3cc097[_0x2628('0x5e')]['id']}})[_0x2628('0x35')](handleEntityNotFound(_0x5a386e,null))['then'](function(_0x11d89f){if(_0x11d89f){return db[_0x2628('0xb8')]['transaction'](function(_0x3032d5){return db['SmsApplication'][_0x2628('0x39')]({'where':{'SmsAccountId':_0x3cc097[_0x2628('0x5e')]['id']},'transaction':_0x3032d5})[_0x2628('0x35')](function(_0xb5b068){var _0x1115af=_[_0x2628('0x47')](_0x3cc097[_0x2628('0x3f')],function(_0x54cce4){_0x54cce4['SmsAccountId']=_0x3cc097[_0x2628('0x5e')]['id'];return _0x54cce4;});return db['SmsApplication'][_0x2628('0xb9')](_0x1115af,{'transaction':_0x3032d5});});})['then'](function(){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x3cc097[_0x2628('0x5e')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x5a386e,null))[_0x2628('0x27')](handleError(_0x5a386e,null));};exports[_0x2628('0xba')]=function(_0x596954,_0x22818e,_0x153a9a){var _0x125736={};var _0x497b2a={};var _0x38ac94;var _0x14fced;return db[_0x2628('0x48')][_0x2628('0x71')]({'where':{'id':_0x596954[_0x2628('0x5e')]['id']}})[_0x2628('0x35')](handleEntityNotFound(_0x22818e,null))[_0x2628('0x35')](function(_0x4e389d){if(_0x4e389d){_0x38ac94=_0x4e389d;_0x497b2a['model']=_['keys'](db[_0x2628('0xbb')][_0x2628('0x60')]);_0x497b2a['query']=_[_0x2628('0x5f')](_0x596954[_0x2628('0x4b')]);_0x497b2a['filters']=_[_0x2628('0x4d')](_0x497b2a[_0x2628('0x4a')],_0x497b2a[_0x2628('0x4b')]);_0x125736['attributes']=_[_0x2628('0x4d')](_0x497b2a[_0x2628('0x4a')],qs[_0x2628('0x4e')](_0x596954[_0x2628('0x4b')]['fields']));_0x125736[_0x2628('0x4f')]=_0x125736[_0x2628('0x4f')][_0x2628('0x61')]?_0x125736[_0x2628('0x4f')]:_0x497b2a['model'];_0x125736['order']=qs[_0x2628('0x53')](_0x596954[_0x2628('0x4b')][_0x2628('0x53')]);_0x125736[_0x2628('0x54')]=qs[_0x2628('0x4c')](_['pick'](_0x596954[_0x2628('0x4b')],_0x497b2a[_0x2628('0x4c')]));if(_0x596954[_0x2628('0x4b')][_0x2628('0x56')]){_0x125736[_0x2628('0x54')]=_[_0x2628('0x3e')](_0x125736[_0x2628('0x54')],{'$or':_[_0x2628('0x47')](_0x125736[_0x2628('0x4f')],function(_0x44b276){var _0x4c49f={};_0x4c49f[_0x44b276]={'$like':'%'+_0x596954[_0x2628('0x4b')]['filter']+'%'};return _0x4c49f;})});}_0x125736=_[_0x2628('0x3e')]({},_0x125736,_0x596954[_0x2628('0x59')]);return _0x38ac94[_0x2628('0xba')](_0x125736);}})['then'](function(_0x2c2f71){if(_0x2c2f71){_0x14fced=_0x2c2f71['length'];if(!_0x596954[_0x2628('0x4b')][_0x2628('0x50')](_0x2628('0x51'))){_0x125736[_0x2628('0x2d')]=qs['limit'](_0x596954[_0x2628('0x4b')]['limit']);_0x125736[_0x2628('0x2e')]=qs[_0x2628('0x2e')](_0x596954[_0x2628('0x4b')][_0x2628('0x2e')]);}return _0x38ac94[_0x2628('0xba')](_0x125736);}})[_0x2628('0x35')](function(_0x41ef6e){if(_0x41ef6e){return _0x41ef6e?{'count':_0x14fced,'rows':_0x41ef6e}:null;}})['then'](respondWithResult(_0x22818e,null))[_0x2628('0x27')](handleError(_0x22818e,null));};exports[_0x2628('0xbc')]=function(_0x346d9f,_0x34151b,_0x24f8c5){var _0x42e794={'raw':![],'where':{}};var _0x424952={};var _0x3a8a42={'count':0x0,'rows':[]};return db['SmsAccount'][_0x2628('0x71')]({'where':{'id':_0x346d9f[_0x2628('0x5e')]['id']}})['then'](handleEntityNotFound(_0x34151b,null))[_0x2628('0x35')](function(_0x1a5d43){if(_0x1a5d43){_0x424952['model']=_[_0x2628('0x5f')](db['SmsInteraction'][_0x2628('0x60')]);_0x424952['query']=_[_0x2628('0x5f')](_0x346d9f[_0x2628('0x4b')]);_0x424952[_0x2628('0x4c')]=_[_0x2628('0x4d')](_0x424952[_0x2628('0x4a')],_0x424952[_0x2628('0x4b')]);_0x42e794[_0x2628('0x4f')]=_[_0x2628('0x4d')](_0x424952[_0x2628('0x4a')],qs['fields'](_0x346d9f[_0x2628('0x4b')][_0x2628('0x4e')]));_0x42e794[_0x2628('0x4f')]=_0x42e794[_0x2628('0x4f')][_0x2628('0x61')]?_0x42e794[_0x2628('0x4f')]:_0x424952[_0x2628('0x4a')];if(!_0x346d9f[_0x2628('0x4b')]['hasOwnProperty'](_0x2628('0x51'))){_0x42e794['limit']=qs[_0x2628('0x2d')](_0x346d9f[_0x2628('0x4b')]['limit']);_0x42e794[_0x2628('0x2e')]=qs[_0x2628('0x2e')](_0x346d9f[_0x2628('0x4b')][_0x2628('0x2e')]);}_0x42e794[_0x2628('0x52')]=qs[_0x2628('0x53')](_0x346d9f[_0x2628('0x4b')][_0x2628('0x53')]);_0x42e794[_0x2628('0x54')]=qs['filters'](_[_0x2628('0x55')](_0x346d9f[_0x2628('0x4b')],_0x424952[_0x2628('0x4c')]));_0x42e794['where'][_0x2628('0x6a')]=_0x1a5d43['id'];if(_0x346d9f[_0x2628('0x4b')][_0x2628('0x56')]){_0x42e794[_0x2628('0x54')]=_[_0x2628('0x3e')](_0x42e794[_0x2628('0x54')],{'$or':_[_0x2628('0x47')](_0x42e794[_0x2628('0x4f')],function(_0x1cefb3){var _0x2bec2f={};_0x2bec2f[_0x1cefb3]={'$like':'%'+_0x346d9f[_0x2628('0x4b')][_0x2628('0x56')]+'%'};return _0x2bec2f;})});}_0x42e794=_[_0x2628('0x3e')]({},_0x42e794,_0x346d9f[_0x2628('0x59')]);return db[_0x2628('0xa2')][_0x2628('0x2f')]({'where':_0x42e794[_0x2628('0x54')]})[_0x2628('0x35')](function(_0x558987){_0x3a8a42['count']=_0x558987;if(_0x346d9f['query'][_0x2628('0x5a')]){_0x42e794[_0x2628('0x5b')]=[{'model':db[_0x2628('0x79')],'as':_0x2628('0xbd'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x2628('0x3b'),_0x2628('0xbe'),_0x2628('0xbf')],'required':![]},{'model':db[_0x2628('0xc0')],'as':_0x2628('0xc1'),'attributes':['id',_0x2628('0x3b'),_0x2628('0xc2')],'where':_0x346d9f[_0x2628('0x4b')]['tag']?{'id':_0x346d9f[_0x2628('0x4b')][_0x2628('0xc3')]}:undefined,'required':_0x346d9f[_0x2628('0x4b')]['tag']?!![]:![]}];}return db[_0x2628('0xa2')][_0x2628('0x5c')](_0x42e794);})['then'](function(_0x53b719){_0x3a8a42[_0x2628('0x6d')]=_0x53b719;return _0x3a8a42;});}})[_0x2628('0x35')](respondWithFilteredResult(_0x34151b,_0x42e794))['catch'](handleError(_0x34151b,null));};exports[_0x2628('0x3c')]=function(_0x3596ae,_0x5d5833,_0x1bf43f){var _0x3c39d9,_0x3d1ba8,_0x46df11;if(_[_0x2628('0x98')](_0x3596ae[_0x2628('0x3f')][_0x2628('0x3f')])||_0x3596ae['body'][_0x2628('0x3f')]===''){throw new db[(_0x2628('0x7b'))][(_0x2628('0x7c'))](_0x2628('0x9a'));}if(_[_0x2628('0x98')](_0x3596ae['body']['to'])){throw new db['Sequelize'][(_0x2628('0x7c'))](_0x2628('0xc4'));}_0x3c39d9=_0x3596ae[_0x2628('0x3f')]['to'];return db[_0x2628('0x48')]['find']({'where':{'id':_0x3596ae['params']['id']},'include':[{'model':db['CmList'],'as':_0x2628('0xc5'),'include':[{'model':db['CmContact'],'as':_0x2628('0x9f'),'where':{'mobile':_0x3c39d9},'limit':0x1,'order':[['updatedAt',_0x2628('0xa0')]]}]}]})['then'](handleEntityNotFound(_0x5d5833,null))[_0x2628('0x35')](function(_0x310ebc){if(_0x310ebc&&_0x310ebc[_0x2628('0xc5')]){_0x3d1ba8=_0x310ebc[_0x2628('0x36')]({'plain':!![]});if(_0x3d1ba8[_0x2628('0xc5')]&&_0x3d1ba8['List'][_0x2628('0x9f')][_0x2628('0x61')]){return _0x3d1ba8[_0x2628('0xc5')][_0x2628('0x9f')][0x0];}return db[_0x2628('0x79')][_0x2628('0x63')](_[_0x2628('0x1b')](_0x3596ae[_0x2628('0x3f')],{'firstName':_0x3c39d9,'mobile':_0x3c39d9,'phone':_0x3c39d9,'ListId':_0x3d1ba8[_0x2628('0x81')]}));}})[_0x2628('0x35')](handleEntityNotFound(_0x5d5833,null))['then'](function(_0x1c8c5d){if(_0x1c8c5d){_0x46df11=_0x1c8c5d;return db['SmsInteraction']['find']({'where':{'ContactId':_0x46df11['id'],'closed':![],'SmsAccountId':_0x3d1ba8['id']}})[_0x2628('0x35')](function(_0x33af3c){if(_0x33af3c){return[_0x33af3c,![]];}return db['SmsInteraction'][_0x2628('0x63')]({'UserId':_0x3596ae['user']['id'],'ContactId':_0x46df11['id'],'SmsAccountId':_0x3d1ba8['id'],'phone':_0x3c39d9,'firstMsgDirection':_0x2628('0xc6'),'Messages':[_[_0x2628('0x3e')](_0x3596ae[_0x2628('0x3f')],{'read':![],'body':_0x3596ae[_0x2628('0x3f')][_0x2628('0x3f')],'phone':_0x3c39d9,'SmsAccountId':_0x3d1ba8['id'],'UserId':_0x3596ae['user']['id'],'ContactId':_0x46df11['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x2628('0xc7')}]})[_0x2628('0x35')](function(_0x4dfcec){return[_0x4dfcec,!![]];});});}})[_0x2628('0xa3')](function(_0x3e09f7,_0x53ee85){if(_0x53ee85){return _0x3e09f7;}return db['SmsMessage'][_0x2628('0x63')](_[_0x2628('0x3e')](_0x3596ae['body'],{'read':![],'body':_0x3596ae[_0x2628('0x3f')][_0x2628('0x3f')],'phone':_0x3c39d9,'SmsAccountId':_0x3d1ba8['id'],'SmsInteractionId':_0x3e09f7['id'],'UserId':_0x3596ae[_0x2628('0x64')]['id'],'ContactId':_0x46df11['id']}))['then'](function(_0x31aef8){_0x3e09f7[_0x2628('0xc8')][_0x2628('0xc7')]=[];_0x3e09f7['dataValues'][_0x2628('0xc7')][_0x2628('0xa6')](_0x31aef8['dataValues']);return _0x3e09f7;});})[_0x2628('0x35')](respondWithResult(_0x5d5833,null))['catch'](handleError(_0x5d5833,null));};exports[_0x2628('0x29')]=function(_0x4cfb44,_0x58c679,_0x4f9c17){if(_0x4cfb44['body']['id']){delete _0x4cfb44[_0x2628('0x3f')]['id'];}var _0x676787,_0x9eca0a,_0x12d59f;return db[_0x2628('0x48')][_0x2628('0x62')]({'where':{'id':_0x4cfb44[_0x2628('0x5e')]['id']}})[_0x2628('0x35')](handleEntityNotFound(_0x58c679,null))[_0x2628('0x35')](function(_0x4a73f3){if(_0x4a73f3){_0x12d59f=_0x4a73f3;logger['debug'](_0x2628('0xb2'),_0x2628('0x29'),'received\x20delivery\x20report\x20from',_0x4a73f3[_0x2628('0x57')],util[_0x2628('0xc9')](_0x4cfb44[_0x2628('0x3f')],{'showHidden':![],'depth':null}));switch(_0x4a73f3[_0x2628('0x57')]){case'skebby':if(_0x4cfb44[_0x2628('0x3f')][_0x2628('0xca')]&&_0x4cfb44[_0x2628('0x3f')][_0x2628('0x29')]){_0x9eca0a=_0x4cfb44[_0x2628('0x3f')][_0x2628('0x29')];return db[_0x2628('0xa9')][_0x2628('0x62')]({'where':{'messageId':_0x4cfb44[_0x2628('0x3f')][_0x2628('0xca')]}});}break;case'connectel':if(_0x4cfb44[_0x2628('0x3f')][_0x2628('0xcb')]&&_0x4cfb44['body']['statusInt']){_0x9eca0a=_0x4cfb44[_0x2628('0x3f')][_0x2628('0xcc')];return db['SmsMessage']['find']({'where':{'messageId':_0x4cfb44['body']['requestid']}});}break;case _0x2628('0x8b'):if(_0x4cfb44[_0x2628('0x3f')][_0x2628('0x8c')]&&_0x4cfb44[_0x2628('0x3f')]['status_code']){_0x9eca0a=_0x4cfb44[_0x2628('0x3f')][_0x2628('0xcd')];return db[_0x2628('0xa9')][_0x2628('0x62')]({'where':{'messageId':_0x4cfb44['body']['message_id']}});}break;case _0x2628('0xce'):var _0x3779a6=_0x4cfb44[_0x2628('0x3f')][_0x2628('0x8f')][0x0];if(_0x3779a6[_0x2628('0x86')]&&_0x3779a6['status'][_0x2628('0xcf')]===_0x2628('0xd0')){_0x9eca0a=_0x3779a6[_0x2628('0x29')]['groupName'];return db[_0x2628('0xa9')][_0x2628('0x62')]({'where':{'messageId':_0x3779a6[_0x2628('0x86')]}});}break;case _0x2628('0x92'):if(_0x4cfb44[_0x2628('0x3f')][_0x2628('0x86')]&&_0x4cfb44[_0x2628('0x3f')]['status']){_0x9eca0a=_0x4cfb44[_0x2628('0x3f')]['status'];return db[_0x2628('0xa9')][_0x2628('0x62')]({'where':{'messageId':_0x4cfb44['body'][_0x2628('0x86')]}});}break;case _0x2628('0x95'):if(_0x4cfb44[_0x2628('0x3f')][0x0]['message']['id']){_0x9eca0a=_0x4cfb44['body'][0x0][_0x2628('0x57')];return db[_0x2628('0xa9')][_0x2628('0x62')]({'where':{'messageId':_0x4cfb44[_0x2628('0x3f')][0x0][_0x2628('0x26')]['id']}});}break;case'intelepeer':if(_0x4cfb44['body'][_0x2628('0xd1')]&&_0x4cfb44['body'][_0x2628('0x29')]){_0x9eca0a=_0x4cfb44[_0x2628('0x3f')][_0x2628('0x29')];return db[_0x2628('0xa9')]['find']({'where':{'messageId':_0x4cfb44[_0x2628('0x3f')][_0x2628('0xd1')]}});}break;}}})[_0x2628('0x35')](handleEntityNotFound(_0x58c679,null))[_0x2628('0x35')](function(_0x2c69bb){if(_0x2c69bb){_0x676787=_0x2c69bb;switch(_0x12d59f['type']){case _0x2628('0xd2'):if(_0x9eca0a==='DELIVERED'){return _0x676787[_0x2628('0x34')]({'read':!![]});}else{logger[_0x2628('0x24')](_0x2628('0xb2'),_0x2628('0x29'),_0x2628('0xd2'),util['inspect'](_0x4cfb44[_0x2628('0x3f')],{'showHidden':![],'depth':null}));}break;case _0x2628('0x8a'):if(_0x9eca0a==='1'){return _0x676787[_0x2628('0x34')]({'read':!![]});}else{logger[_0x2628('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2628('0x29'),_0x2628('0xd2'),util[_0x2628('0xc9')](_0x4cfb44[_0x2628('0x3f')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4cfb44[_0x2628('0x3f')][_0x2628('0xd3')]&&_0x9eca0a>=0xc8&&_0x9eca0a<=0xce){return _0x676787[_0x2628('0x34')]({'read':!![]});}else{logger['error'](_0x2628('0xb2'),_0x2628('0x29'),_0x2628('0x8b'),util['inspect'](_0x4cfb44['body'],{'showHidden':![],'depth':null}));}break;case _0x2628('0xce'):var _0x5dbdb5=_0x4cfb44[_0x2628('0x3f')][_0x2628('0x8f')][0x0];if(_0x5dbdb5[_0x2628('0x29')]['groupName']===_0x2628('0xd0')){return _0x676787[_0x2628('0x34')]({'read':!![]});}else{logger[_0x2628('0x24')](_0x2628('0xb2'),_0x2628('0x29'),_0x2628('0xce'),util['inspect'](_0x4cfb44[_0x2628('0x3f')],{'showHidden':![],'depth':null}));}break;case _0x2628('0x92'):if(_0x9eca0a==_0x2628('0xd4')||_0x9eca0a==_0x2628('0xd5')){return _0x676787['update']({'read':!![]});}else{logger[_0x2628('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2628('0x29'),_0x2628('0x92'),util[_0x2628('0xc9')](_0x4cfb44[_0x2628('0x3f')],{'showHidden':![],'depth':null}));}break;case _0x2628('0x95'):if(_0x9eca0a==_0x2628('0xd6')){return _0x676787[_0x2628('0x34')]({'read':!![]});}else{logger[_0x2628('0x24')](_0x2628('0xb2'),_0x2628('0x29'),'bandwidth',util[_0x2628('0xc9')](_0x4cfb44[_0x2628('0x3f')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x9eca0a===_0x2628('0xd7')||_0x9eca0a===_0x2628('0xd8')){return _0x676787[_0x2628('0x34')]({'read':!![]});}else{logger[_0x2628('0x24')](_0x2628('0xb2'),_0x2628('0x29'),'intelepeer',util[_0x2628('0xc9')](_0x4cfb44[_0x2628('0x3f')],{'showHidden':![],'depth':null}));}break;}return _0x676787;}})[_0x2628('0x35')](respondWithResult(_0x58c679,null))[_0x2628('0x27')](handleError(_0x58c679,null));};exports[_0x2628('0xd9')]=function(_0x5df9d2,_0x2e5948,_0x5393f0){var _0x295fe2,_0x33b052,_0x498061;return db[_0x2628('0x48')][_0x2628('0x62')]({'where':{'id':_0x5df9d2[_0x2628('0x5e')]['id']}})[_0x2628('0x35')](handleEntityNotFound(_0x2e5948,null))[_0x2628('0x35')](function(_0x3c2aa2){if(_0x3c2aa2){_0x498061=_0x3c2aa2;logger[_0x2628('0x23')](_0x2628('0xb2'),'status',_0x2628('0xda'),_0x3c2aa2[_0x2628('0x57')],util[_0x2628('0xc9')](_0x5df9d2[_0x2628('0x4b')],{'showHidden':![],'depth':null}));switch(_0x3c2aa2[_0x2628('0x57')]){case _0x2628('0xdb'):if(_0x5df9d2[_0x2628('0x4b')][_0x2628('0xdc')]&&_0x5df9d2[_0x2628('0x4b')][_0x2628('0xdd')]){_0x33b052=_0x5df9d2[_0x2628('0x4b')]['state'];return db[_0x2628('0xa9')][_0x2628('0x62')]({'where':{'messageId':_0x5df9d2['query'][_0x2628('0xdc')]}});}break;}}})[_0x2628('0x35')](handleEntityNotFound(_0x2e5948,null))['then'](function(_0x4f0365){if(_0x4f0365){_0x295fe2=_0x4f0365;switch(_0x498061[_0x2628('0x57')]){case _0x2628('0xdb'):if(_0x33b052==='2'||_0x33b052==='6'){return _0x295fe2['update']({'read':!![]});}else{logger[_0x2628('0x24')](_0x2628('0xb2'),_0x2628('0x29'),_0x2628('0xdb'),util[_0x2628('0xc9')](_0x5df9d2['query'],{'showHidden':![],'depth':null}));};break;}return _0x295fe2;}})[_0x2628('0x35')](respondWithResult(_0x2e5948,null))[_0x2628('0x27')](handleError(_0x2e5948,null));};exports[_0x2628('0xde')]=function(_0x46a62e,_0x20a1e3,_0x3c20e3){return db[_0x2628('0x48')][_0x2628('0x62')]({'where':{'id':_0x46a62e['params']['id']}})[_0x2628('0x35')](handleEntityNotFound(_0x20a1e3,null))['then'](function(_0x550317){if(_0x550317){return _0x550317[_0x2628('0xde')](_0x46a62e[_0x2628('0x3f')][_0x2628('0xdf')],_['omit'](_0x46a62e['body'],[_0x2628('0xdf'),'id'])||{})[_0x2628('0xa3')](function(_0x2e18e4){for(var _0x195801=0x0;_0x195801<_0x46a62e['body'][_0x2628('0xdf')][_0x2628('0x61')];_0x195801+=0x1){socket[_0x2628('0xe0')](_0x2628('0xe1'),{'UserId':_0x46a62e[_0x2628('0x3f')]['ids'][_0x195801],'SmsAccountId':_0x46a62e[_0x2628('0x5e')]['id']});}return _0x2e18e4;});}})[_0x2628('0x35')](respondWithResult(_0x20a1e3,null))[_0x2628('0x27')](handleError(_0x20a1e3,null));};exports[_0x2628('0xe2')]=function(_0x270c4f,_0x591c0e,_0x38519a){return db[_0x2628('0x48')][_0x2628('0x62')]({'where':{'id':_0x270c4f[_0x2628('0x5e')]['id']}})[_0x2628('0x35')](handleEntityNotFound(_0x591c0e,null))['then'](function(_0x170e4a){if(_0x170e4a){return _0x170e4a[_0x2628('0xe2')](_0x270c4f[_0x2628('0x4b')]['ids'])['then'](function(){if(_['isArray'](_0x270c4f[_0x2628('0x4b')][_0x2628('0xdf')])){for(var _0x514723=0x0;_0x514723<_0x270c4f[_0x2628('0x4b')][_0x2628('0xdf')][_0x2628('0x61')];_0x514723+=0x1){socket[_0x2628('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x270c4f[_0x2628('0x4b')][_0x2628('0xdf')][_0x514723]),'SmsAccountId':Number(_0x270c4f[_0x2628('0x5e')]['id'])});}}else{socket[_0x2628('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x270c4f[_0x2628('0x4b')]['ids']),'SmsAccountId':Number(_0x270c4f[_0x2628('0x5e')]['id'])});}});}})[_0x2628('0x35')](respondWithStatusCode(_0x591c0e,null))[_0x2628('0x27')](handleError(_0x591c0e,null));};exports[_0x2628('0xe3')]=function(_0x4bde38,_0x4183b5,_0x5014d1){var _0x1d170c={};var _0x1102c5={};var _0x15320e;var _0x107efb;return db[_0x2628('0x48')]['findOne']({'where':{'id':_0x4bde38[_0x2628('0x5e')]['id']}})[_0x2628('0x35')](handleEntityNotFound(_0x4183b5,null))['then'](function(_0x4cfc33){if(_0x4cfc33){_0x15320e=_0x4cfc33;_0x1102c5[_0x2628('0x4a')]=_['keys'](db[_0x2628('0xac')][_0x2628('0x60')]);_0x1102c5[_0x2628('0x4b')]=_[_0x2628('0x5f')](_0x4bde38['query']);_0x1102c5[_0x2628('0x4c')]=_[_0x2628('0x4d')](_0x1102c5[_0x2628('0x4a')],_0x1102c5[_0x2628('0x4b')]);_0x1d170c[_0x2628('0x4f')]=_['intersection'](_0x1102c5[_0x2628('0x4a')],qs[_0x2628('0x4e')](_0x4bde38[_0x2628('0x4b')][_0x2628('0x4e')]));_0x1d170c[_0x2628('0x4f')]=_0x1d170c[_0x2628('0x4f')][_0x2628('0x61')]?_0x1d170c['attributes']:_0x1102c5[_0x2628('0x4a')];_0x1d170c[_0x2628('0x52')]=qs[_0x2628('0x53')](_0x4bde38[_0x2628('0x4b')][_0x2628('0x53')]);_0x1d170c['where']=qs[_0x2628('0x4c')](_['pick'](_0x4bde38[_0x2628('0x4b')],_0x1102c5[_0x2628('0x4c')]));if(_0x4bde38[_0x2628('0x4b')][_0x2628('0x56')]){_0x1d170c[_0x2628('0x54')]=_[_0x2628('0x3e')](_0x1d170c[_0x2628('0x54')],{'$or':_[_0x2628('0x47')](_0x1d170c[_0x2628('0x4f')],function(_0x1466a5){var _0xa77f3f={};_0xa77f3f[_0x1466a5]={'$like':'%'+_0x4bde38[_0x2628('0x4b')][_0x2628('0x56')]+'%'};return _0xa77f3f;})});}_0x1d170c=_[_0x2628('0x3e')]({},_0x1d170c,_0x4bde38['options']);return _0x15320e[_0x2628('0xe3')](_0x1d170c);}})['then'](function(_0x5bbdc3){if(_0x5bbdc3){_0x107efb=_0x5bbdc3[_0x2628('0x61')];if(!_0x4bde38[_0x2628('0x4b')][_0x2628('0x50')]('nolimit')){_0x1d170c[_0x2628('0x2d')]=qs[_0x2628('0x2d')](_0x4bde38['query'][_0x2628('0x2d')]);_0x1d170c[_0x2628('0x2e')]=qs[_0x2628('0x2e')](_0x4bde38[_0x2628('0x4b')][_0x2628('0x2e')]);}return _0x15320e[_0x2628('0xe3')](_0x1d170c);}})[_0x2628('0x35')](function(_0x3630df){if(_0x3630df){return _0x3630df?{'count':_0x107efb,'rows':_0x3630df}:null;}})[_0x2628('0x35')](respondWithResult(_0x4183b5,null))[_0x2628('0x27')](handleError(_0x4183b5,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 4c71510..ad40974 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 _0x5e6b=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount','update','remove'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x5e6b,0xcb));var _0xb5e6=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x5e6b[_0x4063a4];return _0x17908d;};'use strict';var EventEmitter=require(_0xb5e6('0x0'));var SmsAccount=require(_0xb5e6('0x1'))['db'][_0xb5e6('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb5e6('0x3'),'afterDestroy':_0xb5e6('0x4')};function emitEvent(_0x366b20){return function(_0x32c934,_0x537d81,_0x24d360){SmsAccountEvents['emit'](_0x366b20+':'+_0x32c934['id'],_0x32c934);SmsAccountEvents[_0xb5e6('0x5')](_0x366b20,_0x32c934);_0x24d360(null);};}for(var e in events){if(events[_0xb5e6('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xb5e6('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x5dd1=['emit','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x2d850b,_0x3a061b){var _0x41403e=function(_0x53258c){while(--_0x53258c){_0x2d850b['push'](_0x2d850b['shift']());}};_0x41403e(++_0x3a061b);}(_0x5dd1,0x19f));var _0x15dd=function(_0x1d850e,_0x723bc4){_0x1d850e=_0x1d850e-0x0;var _0x2efd1f=_0x5dd1[_0x1d850e];return _0x2efd1f;};'use strict';var EventEmitter=require(_0x15dd('0x0'));var SmsAccount=require(_0x15dd('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x15dd('0x2')](0x0);var events={'afterCreate':_0x15dd('0x3'),'afterUpdate':'update','afterDestroy':_0x15dd('0x4')};function emitEvent(_0x2cbb7c){return function(_0x154488,_0x457877,_0x3dd17f){SmsAccountEvents['emit'](_0x2cbb7c+':'+_0x154488['id'],_0x154488);SmsAccountEvents[_0x15dd('0x5')](_0x2cbb7c,_0x154488);_0x3dd17f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 88dd810..9ebf227 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 _0x7162=['bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','util','api'];(function(_0x447e50,_0x58d1de){var _0x78a7c3=function(_0x2cc10f){while(--_0x2cc10f){_0x447e50['push'](_0x447e50['shift']());}};_0x78a7c3(++_0x58d1de);}(_0x7162,0xb2));var _0x2716=function(_0xa4f047,_0x30cffe){_0xa4f047=_0xa4f047-0x0;var _0x280a03=_0x7162[_0xa4f047];return _0x280a03;};'use strict';var _=require('lodash');var util=require(_0x2716('0x0'));var logger=require('../../config/logger')(_0x2716('0x1'));var moment=require('moment');var BPromise=require(_0x2716('0x2'));var rp=require(_0x2716('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2716('0x4'));var config=require(_0x2716('0x5'));var attributes=require(_0x2716('0x6'));module[_0x2716('0x7')]=function(_0x526aa2,_0x27f5f0){return _0x526aa2['define'](_0x2716('0x8'),attributes,{'tableName':_0x2716('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb1c=['lodash','util','api','moment','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define'];(function(_0x565c4e,_0x1e77f9){var _0x4a167f=function(_0x537269){while(--_0x537269){_0x565c4e['push'](_0x565c4e['shift']());}};_0x4a167f(++_0x1e77f9);}(_0xdb1c,0x19a));var _0xcdb1=function(_0x4d247c,_0x3dff9e){_0x4d247c=_0x4d247c-0x0;var _0x42c60c=_0xdb1c[_0x4d247c];return _0x42c60c;};'use strict';var _=require(_0xcdb1('0x0'));var util=require(_0xcdb1('0x1'));var logger=require('../../config/logger')(_0xcdb1('0x2'));var moment=require(_0xcdb1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdb1('0x4'));var rimraf=require(_0xcdb1('0x5'));var config=require(_0xcdb1('0x6'));var attributes=require(_0xcdb1('0x7'));module[_0xcdb1('0x8')]=function(_0x351d75,_0x217015){return _0x351d75[_0xcdb1('0x9')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index b83d76f..9400607 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 _0x4c4f=['client','http','redis','localhost','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','model','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4c4f,0xdf));var _0xf4c4=function(_0x4a2434,_0x4cba70){_0x4a2434=_0x4a2434-0x0;var _0x16c63a=_0x4c4f[_0x4a2434];return _0x16c63a;};'use strict';var _=require(_0xf4c4('0x0'));var util=require('util');var moment=require(_0xf4c4('0x1'));var BPromise=require(_0xf4c4('0x2'));var rs=require(_0xf4c4('0x3'));var fs=require('fs');var Redis=require(_0xf4c4('0x4'));var db=require(_0xf4c4('0x5'))['db'];var utils=require(_0xf4c4('0x6'));var logger=require('../../config/logger')(_0xf4c4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf4c4('0x8')][_0xf4c4('0x9')]({'port':0x232a});config[_0xf4c4('0xa')]=_['defaults'](config['redis'],{'host':_0xf4c4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4c4('0xa')]));require('./smsAccount.socket')[_0xf4c4('0xc')](socket);function respondWithRpcPromise(_0x5eb241,_0x1bbbe0,_0x33aedd){return new BPromise(function(_0x57a31f,_0x230c6d){return client[_0xf4c4('0xd')](_0x5eb241,_0x33aedd)[_0xf4c4('0xe')](function(_0x40de41){logger['info'](_0xf4c4('0xf'),_0x1bbbe0,_0xf4c4('0x10'));logger[_0xf4c4('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1bbbe0,_0xf4c4('0x10'),JSON[_0xf4c4('0x12')](_0x40de41));if(_0x40de41['error']){if(_0x40de41[_0xf4c4('0x13')][_0xf4c4('0x14')]===0x1f4){logger[_0xf4c4('0x13')]('SmsAccount,\x20%s,\x20%s',_0x1bbbe0,_0x40de41['error'][_0xf4c4('0x15')]);return _0x230c6d(_0x40de41[_0xf4c4('0x13')][_0xf4c4('0x15')]);}logger[_0xf4c4('0x13')](_0xf4c4('0xf'),_0x1bbbe0,_0x40de41[_0xf4c4('0x13')][_0xf4c4('0x15')]);return _0x57a31f(_0x40de41[_0xf4c4('0x13')][_0xf4c4('0x15')]);}else{logger[_0xf4c4('0x16')](_0xf4c4('0xf'),_0x1bbbe0,_0xf4c4('0x10'));_0x57a31f(_0x40de41[_0xf4c4('0x17')][_0xf4c4('0x15')]);}})[_0xf4c4('0x18')](function(_0x43666a){logger[_0xf4c4('0x13')](_0xf4c4('0xf'),_0x1bbbe0,_0x43666a);_0x230c6d(_0x43666a);});});}exports[_0xf4c4('0x19')]=function(_0x24c838){var _0x41692f=this;return new Promise(function(_0x3c7bcf,_0x4ab1f0){return db[_0xf4c4('0x1a')]['find']({'raw':_0x24c838[_0xf4c4('0x1b')]?_0x24c838['options']['raw']===undefined?!![]:![]:!![],'where':_0x24c838['options']?_0x24c838[_0xf4c4('0x1b')][_0xf4c4('0x1c')]||null:null,'attributes':_0x24c838[_0xf4c4('0x1b')]?_0x24c838['options'][_0xf4c4('0x1d')]||null:null,'include':_0x24c838[_0xf4c4('0x1b')]?_0x24c838[_0xf4c4('0x1b')][_0xf4c4('0x1e')]?_['map'](_0x24c838[_0xf4c4('0x1b')]['include'],function(_0x4cb6ae){return{'model':db[_0x4cb6ae[_0xf4c4('0x1f')]],'as':_0x4cb6ae['as'],'attributes':_0x4cb6ae['attributes'],'include':_0x4cb6ae[_0xf4c4('0x1e')]?_['map'](_0x4cb6ae[_0xf4c4('0x1e')],function(_0x47281f){return{'model':db[_0x47281f['model']],'as':_0x47281f['as'],'attributes':_0x47281f[_0xf4c4('0x1d')],'include':_0x47281f['include']?_[_0xf4c4('0x20')](_0x47281f[_0xf4c4('0x1e')],function(_0x43a417){return{'model':db[_0x43a417[_0xf4c4('0x1f')]],'as':_0x43a417['as'],'attributes':_0x43a417['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xce0b69){logger[_0xf4c4('0x16')](_0xf4c4('0x19'),_0x24c838);logger[_0xf4c4('0x11')](_0xf4c4('0x19'),_0x24c838,JSON[_0xf4c4('0x12')](_0xce0b69));_0x3c7bcf(_0xce0b69);})['catch'](function(_0x4f2fe1){logger['error']('ShowSmsAccount',_0x4f2fe1['message'],_0x24c838);_0x4ab1f0(_0x41692f[_0xf4c4('0x13')](0x1f4,_0x4f2fe1['message']));});});}; \ No newline at end of file +var _0xaf10=['map','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xaf10,0x8e));var _0x0af1=function(_0x2ea8ba,_0x37a095){_0x2ea8ba=_0x2ea8ba-0x0;var _0xe16946=_0xaf10[_0x2ea8ba];return _0xe16946;};'use strict';var _=require(_0x0af1('0x0'));var util=require(_0x0af1('0x1'));var moment=require(_0x0af1('0x2'));var BPromise=require(_0x0af1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0af1('0x4'));var db=require(_0x0af1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0af1('0x6'));var jayson=require(_0x0af1('0x7'));var client=jayson[_0x0af1('0x8')][_0x0af1('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0af1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0af1('0xb'))(new Redis(config[_0x0af1('0xa')]));require(_0x0af1('0xc'))['register'](socket);function respondWithRpcPromise(_0x2a151e,_0xbeca9c,_0x29175b){return new BPromise(function(_0x2db510,_0x4e71da){return client[_0x0af1('0xd')](_0x2a151e,_0x29175b)[_0x0af1('0xe')](function(_0xf54fd5){logger[_0x0af1('0xf')](_0x0af1('0x10'),_0xbeca9c,_0x0af1('0x11'));logger['debug'](_0x0af1('0x12'),_0xbeca9c,_0x0af1('0x11'),JSON[_0x0af1('0x13')](_0xf54fd5));if(_0xf54fd5[_0x0af1('0x14')]){if(_0xf54fd5['error']['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0xbeca9c,_0xf54fd5['error']['message']);return _0x4e71da(_0xf54fd5[_0x0af1('0x14')]['message']);}logger['error'](_0x0af1('0x10'),_0xbeca9c,_0xf54fd5[_0x0af1('0x14')][_0x0af1('0x15')]);return _0x2db510(_0xf54fd5[_0x0af1('0x14')][_0x0af1('0x15')]);}else{logger[_0x0af1('0xf')](_0x0af1('0x10'),_0xbeca9c,_0x0af1('0x11'));_0x2db510(_0xf54fd5[_0x0af1('0x16')][_0x0af1('0x15')]);}})[_0x0af1('0x17')](function(_0xb5f84a){logger['error'](_0x0af1('0x10'),_0xbeca9c,_0xb5f84a);_0x4e71da(_0xb5f84a);});});}exports[_0x0af1('0x18')]=function(_0x1cf5a8){var _0x1502c9=this;return new Promise(function(_0x48dba2,_0x23c91e){return db[_0x0af1('0x19')][_0x0af1('0x1a')]({'raw':_0x1cf5a8[_0x0af1('0x1b')]?_0x1cf5a8[_0x0af1('0x1b')][_0x0af1('0x1c')]===undefined?!![]:![]:!![],'where':_0x1cf5a8[_0x0af1('0x1b')]?_0x1cf5a8['options'][_0x0af1('0x1d')]||null:null,'attributes':_0x1cf5a8[_0x0af1('0x1b')]?_0x1cf5a8[_0x0af1('0x1b')][_0x0af1('0x1e')]||null:null,'include':_0x1cf5a8[_0x0af1('0x1b')]?_0x1cf5a8[_0x0af1('0x1b')]['include']?_['map'](_0x1cf5a8[_0x0af1('0x1b')][_0x0af1('0x1f')],function(_0x32644f){return{'model':db[_0x32644f[_0x0af1('0x20')]],'as':_0x32644f['as'],'attributes':_0x32644f['attributes'],'include':_0x32644f['include']?_[_0x0af1('0x21')](_0x32644f[_0x0af1('0x1f')],function(_0x321221){return{'model':db[_0x321221[_0x0af1('0x20')]],'as':_0x321221['as'],'attributes':_0x321221[_0x0af1('0x1e')],'include':_0x321221[_0x0af1('0x1f')]?_['map'](_0x321221[_0x0af1('0x1f')],function(_0x27b912){return{'model':db[_0x27b912[_0x0af1('0x20')]],'as':_0x27b912['as'],'attributes':_0x27b912['attributes']};}):[]};}):[]};}):[]:[]})[_0x0af1('0xe')](function(_0x3c4b90){logger[_0x0af1('0xf')](_0x0af1('0x18'),_0x1cf5a8);logger[_0x0af1('0x22')](_0x0af1('0x18'),_0x1cf5a8,JSON['stringify'](_0x3c4b90));_0x48dba2(_0x3c4b90);})[_0x0af1('0x17')](function(_0x496314){logger[_0x0af1('0x14')]('ShowSmsAccount',_0x496314[_0x0af1('0x15')],_0x1cf5a8);_0x23c91e(_0x1502c9[_0x0af1('0x14')](0x1f4,_0x496314[_0x0af1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 57601c6..8c6bf8f 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 _0xdf0b=['save','emit','register','smsAccount:','./smsAccount.events'];(function(_0x49b672,_0x397489){var _0x524658=function(_0x4fc882){while(--_0x4fc882){_0x49b672['push'](_0x49b672['shift']());}};_0x524658(++_0x397489);}(_0xdf0b,0xd6));var _0xbdf0=function(_0x43aeba,_0x1cc5c0){_0x43aeba=_0x43aeba-0x0;var _0x10d744=_0xdf0b[_0x43aeba];return _0x10d744;};'use strict';var SmsAccountEvents=require(_0xbdf0('0x0'));var events=[_0xbdf0('0x1'),'remove','update'];function createListener(_0x47dfaa,_0x271f4a){return function(_0x1c8a3c){_0x271f4a[_0xbdf0('0x2')](_0x47dfaa,_0x1c8a3c);};}function removeListener(_0x5ad4ca,_0x3c2f7a){return function(){SmsAccountEvents['removeListener'](_0x5ad4ca,_0x3c2f7a);};}exports[_0xbdf0('0x3')]=function(_0x16086a){for(var _0x546fae=0x0,_0x3741ba=events['length'];_0x546fae<_0x3741ba;_0x546fae++){var _0x363bbc=events[_0x546fae];var _0x4cd4b3=createListener(_0xbdf0('0x4')+_0x363bbc,_0x16086a);SmsAccountEvents['on'](_0x363bbc,_0x4cd4b3);}}; \ No newline at end of file +var _0x918d=['length','./smsAccount.events','save','remove','update','removeListener'];(function(_0x2a9914,_0x24a552){var _0x3992ce=function(_0x5353e8){while(--_0x5353e8){_0x2a9914['push'](_0x2a9914['shift']());}};_0x3992ce(++_0x24a552);}(_0x918d,0xeb));var _0xd918=function(_0x4e228c,_0xe484b9){_0x4e228c=_0x4e228c-0x0;var _0x5f08b7=_0x918d[_0x4e228c];return _0x5f08b7;};'use strict';var SmsAccountEvents=require(_0xd918('0x0'));var events=[_0xd918('0x1'),_0xd918('0x2'),_0xd918('0x3')];function createListener(_0x3594dd,_0x39fdd3){return function(_0x22d014){_0x39fdd3['emit'](_0x3594dd,_0x22d014);};}function removeListener(_0x467d98,_0x428cec){return function(){SmsAccountEvents[_0xd918('0x4')](_0x467d98,_0x428cec);};}exports['register']=function(_0x56b16a){for(var _0x4f6cd5=0x0,_0x5049ef=events[_0xd918('0x5')];_0x4f6cd5<_0x5049ef;_0x4f6cd5++){var _0x19be7b=events[_0x4f6cd5];var _0x13a110=createListener('smsAccount:'+_0x19be7b,_0x56b16a);SmsAccountEvents['on'](_0x19be7b,_0x13a110);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index a378b77..3e4be6c 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 _0x89dd=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x89dd,0xcb));var _0xd89d=function(_0x3a989a,_0x13557c){_0x3a989a=_0x3a989a-0x0;var _0x549e16=_0x89dd[_0x3a989a];return _0x549e16;};'use strict';var multer=require(_0xd89d('0x0'));var util=require(_0xd89d('0x1'));var path=require(_0xd89d('0x2'));var timeout=require(_0xd89d('0x3'));var express=require(_0xd89d('0x4'));var router=express['Router']();var fs_extra=require(_0xd89d('0x5'));var auth=require(_0xd89d('0x6'));var interaction=require(_0xd89d('0x7'));var config=require('../../config/environment');var controller=require('./smsApplication.controller');router['get']('/',auth[_0xd89d('0x8')](),controller[_0xd89d('0x9')]);router[_0xd89d('0xa')](_0xd89d('0xb'),auth[_0xd89d('0x8')](),controller[_0xd89d('0xc')]);router[_0xd89d('0xd')]('/',auth[_0xd89d('0x8')](),controller[_0xd89d('0xe')]);router[_0xd89d('0xf')](_0xd89d('0xb'),auth[_0xd89d('0x8')](),controller[_0xd89d('0x10')]);router['delete'](_0xd89d('0xb'),auth[_0xd89d('0x8')](),controller[_0xd89d('0x11')]);module[_0xd89d('0x12')]=router; \ No newline at end of file +var _0xb4f3=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index','/:id','post','put','delete'];(function(_0x586626,_0x1427f7){var _0x7bffbe=function(_0x3749ba){while(--_0x3749ba){_0x586626['push'](_0x586626['shift']());}};_0x7bffbe(++_0x1427f7);}(_0xb4f3,0xbd));var _0x3b4f=function(_0x59e172,_0x3e6f89){_0x59e172=_0x59e172-0x0;var _0x45da5c=_0xb4f3[_0x59e172];return _0x45da5c;};'use strict';var multer=require(_0x3b4f('0x0'));var util=require(_0x3b4f('0x1'));var path=require('path');var timeout=require(_0x3b4f('0x2'));var express=require(_0x3b4f('0x3'));var router=express[_0x3b4f('0x4')]();var fs_extra=require(_0x3b4f('0x5'));var auth=require(_0x3b4f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3b4f('0x7'));router[_0x3b4f('0x8')]('/',auth[_0x3b4f('0x9')](),controller[_0x3b4f('0xa')]);router[_0x3b4f('0x8')](_0x3b4f('0xb'),auth[_0x3b4f('0x9')](),controller['show']);router[_0x3b4f('0xc')]('/',auth[_0x3b4f('0x9')](),controller['create']);router[_0x3b4f('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3b4f('0xe')]('/:id',auth[_0x3b4f('0x9')](),controller[_0x3b4f('0xf')]);module[_0x3b4f('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 32d7c71..8505ec6 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 _0xc0d3=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc0d3,0x95));var _0x3c0d=function(_0x2f62fc,_0x36a22a){_0x2f62fc=_0x2f62fc-0x0;var _0x463987=_0xc0d3[_0x2f62fc];return _0x463987;};'use strict';var Sequelize=require('sequelize');module[_0x3c0d('0x0')]={'priority':{'type':Sequelize[_0x3c0d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3c0d('0x2')],'allowNull':![],'defaultValue':_0x3c0d('0x3')},'appdata':{'type':Sequelize[_0x3c0d('0x4')]()},'description':{'type':Sequelize[_0x3c0d('0x2')]},'interval':{'type':Sequelize[_0x3c0d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf448=['*,*,*,*','exports','STRING','TEXT'];(function(_0x3dad2f,_0x3c87fb){var _0x36f462=function(_0x10ae1b){while(--_0x10ae1b){_0x3dad2f['push'](_0x3dad2f['shift']());}};_0x36f462(++_0x3c87fb);}(_0xf448,0x111));var _0x8f44=function(_0x4a782b,_0x55584a){_0x4a782b=_0x4a782b-0x0;var _0x5cb5a0=_0xf448[_0x4a782b];return _0x5cb5a0;};'use strict';var Sequelize=require('sequelize');module[_0x8f44('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8f44('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8f44('0x2')]()},'description':{'type':Sequelize[_0x8f44('0x1')]},'interval':{'type':Sequelize[_0x8f44('0x1')],'defaultValue':_0x8f44('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index afed1f5..604db62 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 _0x4fd0=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','render','body','contact','message','agent','interaction','account','index','map','SmsApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv'];(function(_0x5e49de,_0x1d3dd9){var _0x328849=function(_0x457210){while(--_0x457210){_0x5e49de['push'](_0x5e49de['shift']());}};_0x328849(++_0x1d3dd9);}(_0x4fd0,0x1be));var _0x04fd=function(_0x58a975,_0x4f7451){_0x58a975=_0x58a975-0x0;var _0x47f055=_0x4fd0[_0x58a975];return _0x47f055;};'use strict';var emlformat=require(_0x04fd('0x0'));var rimraf=require(_0x04fd('0x1'));var zipdir=require(_0x04fd('0x2'));var jsonpatch=require(_0x04fd('0x3'));var rp=require(_0x04fd('0x4'));var moment=require(_0x04fd('0x5'));var BPromise=require(_0x04fd('0x6'));var Mustache=require(_0x04fd('0x7'));var util=require('util');var path=require(_0x04fd('0x8'));var sox=require('sox');var csv=require(_0x04fd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x04fd('0xa'));var crypto=require(_0x04fd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04fd('0xc'));var toCsv=require(_0x04fd('0x9'));var querystring=require(_0x04fd('0xd'));var Papa=require(_0x04fd('0xe'));var Redis=require(_0x04fd('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04fd('0x10'));var logger=require(_0x04fd('0x11'))('api');var utils=require(_0x04fd('0x12'));var config=require(_0x04fd('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x04fd('0x14'))['db'];function respondWithStatusCode(_0x2577a6,_0x15f6b6){_0x15f6b6=_0x15f6b6||0xcc;return function(_0x1e253c){if(_0x1e253c){return _0x2577a6[_0x04fd('0x15')](_0x15f6b6);}return _0x2577a6[_0x04fd('0x16')](_0x15f6b6)[_0x04fd('0x17')]();};}function respondWithResult(_0x26cd7b,_0x4fe45b){_0x4fe45b=_0x4fe45b||0xc8;return function(_0x208108){if(_0x208108){return _0x26cd7b[_0x04fd('0x16')](_0x4fe45b)[_0x04fd('0x18')](_0x208108);}};}function respondWithFilteredResult(_0x1496c8,_0x35b04e){return function(_0x18edb6){if(_0x18edb6){var _0x4e1f74=typeof _0x35b04e[_0x04fd('0x19')]==='undefined'&&typeof _0x35b04e[_0x04fd('0x1a')]==='undefined';var _0x33f3fd=_0x18edb6[_0x04fd('0x1b')];var _0x462f2c=_0x4e1f74?0x0:_0x35b04e[_0x04fd('0x19')];var _0x12daba=_0x4e1f74?_0x18edb6['count']:_0x35b04e[_0x04fd('0x19')]+_0x35b04e[_0x04fd('0x1a')];var _0x498eab;if(_0x12daba>=_0x33f3fd){_0x12daba=_0x33f3fd;_0x498eab=0xc8;}else{_0x498eab=0xce;}_0x1496c8['status'](_0x498eab);return _0x1496c8['set'](_0x04fd('0x1c'),_0x462f2c+'-'+_0x12daba+'/'+_0x33f3fd)[_0x04fd('0x18')](_0x18edb6);}return null;};}function patchUpdates(_0x210535){return function(_0x3b2366){try{jsonpatch[_0x04fd('0x1d')](_0x3b2366,_0x210535,!![]);}catch(_0x1e1ca9){return BPromise[_0x04fd('0x1e')](_0x1e1ca9);}return _0x3b2366[_0x04fd('0x1f')]();};}function saveUpdates(_0x2af1d9,_0x24a465){return function(_0x2b364e){if(_0x2b364e){return _0x2b364e['update'](_0x2af1d9)[_0x04fd('0x20')](function(_0x1436aa){return _0x1436aa;});}return null;};}function removeEntity(_0x4f0a4e,_0x653759){return function(_0x15f94b){if(_0x15f94b){return _0x15f94b[_0x04fd('0x21')]()['then'](function(){_0x4f0a4e[_0x04fd('0x16')](0xcc)[_0x04fd('0x17')]();});}};}function handleEntityNotFound(_0x2a9d6e,_0x4a12cd){return function(_0x184178){if(!_0x184178){_0x2a9d6e[_0x04fd('0x15')](0x194);}return _0x184178;};}function handleError(_0x39d706,_0x2748d2){_0x2748d2=_0x2748d2||0x1f4;return function(_0x5388e0){logger[_0x04fd('0x22')](_0x5388e0[_0x04fd('0x23')]);if(_0x5388e0[_0x04fd('0x24')]){delete _0x5388e0[_0x04fd('0x24')];}_0x39d706['status'](_0x2748d2)[_0x04fd('0x25')](_0x5388e0);};}function getMustacheRender(_0x3da762,_0x562697){return Mustache[_0x04fd('0x26')](_0x3da762,_['merge'](_0x562697[_0x04fd('0x27')],{'contact':_0x562697[_0x04fd('0x28')],'message':_0x562697[_0x04fd('0x29')],'agent':_0x562697[_0x04fd('0x2a')],'interaction':_0x562697[_0x04fd('0x2b')],'account':_0x562697[_0x04fd('0x2c')]}))||'';}exports[_0x04fd('0x2d')]=function(_0x16d5ae,_0x310446){var _0x26d0e2={},_0x430756={},_0x14b9cd={'count':0x0,'rows':[]};var _0x2816b1=_[_0x04fd('0x2e')](db[_0x04fd('0x2f')][_0x04fd('0x30')],function(_0x443fe3){return{'name':_0x443fe3[_0x04fd('0x31')],'type':_0x443fe3[_0x04fd('0x32')]['key']};});_0x430756[_0x04fd('0x33')]=_[_0x04fd('0x2e')](_0x2816b1,_0x04fd('0x24'));_0x430756[_0x04fd('0x34')]=_[_0x04fd('0x35')](_0x16d5ae[_0x04fd('0x34')]);_0x430756[_0x04fd('0x36')]=_[_0x04fd('0x37')](_0x430756['model'],_0x430756['query']);_0x26d0e2['attributes']=_[_0x04fd('0x37')](_0x430756[_0x04fd('0x33')],qs[_0x04fd('0x38')](_0x16d5ae[_0x04fd('0x34')][_0x04fd('0x38')]));_0x26d0e2[_0x04fd('0x39')]=_0x26d0e2[_0x04fd('0x39')][_0x04fd('0x3a')]?_0x26d0e2[_0x04fd('0x39')]:_0x430756['model'];if(!_0x16d5ae[_0x04fd('0x34')][_0x04fd('0x3b')]('nolimit')){_0x26d0e2[_0x04fd('0x1a')]=qs[_0x04fd('0x1a')](_0x16d5ae[_0x04fd('0x34')][_0x04fd('0x1a')]);_0x26d0e2[_0x04fd('0x19')]=qs[_0x04fd('0x19')](_0x16d5ae[_0x04fd('0x34')][_0x04fd('0x19')]);}_0x26d0e2['order']=qs[_0x04fd('0x3c')](_0x16d5ae[_0x04fd('0x34')][_0x04fd('0x3c')]);_0x26d0e2[_0x04fd('0x3d')]=qs[_0x04fd('0x36')](_[_0x04fd('0x3e')](_0x16d5ae[_0x04fd('0x34')],_0x430756[_0x04fd('0x36')]),_0x2816b1);if(_0x16d5ae[_0x04fd('0x34')][_0x04fd('0x3f')]){_0x26d0e2[_0x04fd('0x3d')]=_[_0x04fd('0x40')](_0x26d0e2[_0x04fd('0x3d')],{'$or':_['map'](_0x2816b1,function(_0x17a9d4){if(_0x17a9d4['type']!==_0x04fd('0x41')){var _0x20f6a8={};_0x20f6a8[_0x17a9d4[_0x04fd('0x24')]]={'$like':'%'+_0x16d5ae[_0x04fd('0x34')][_0x04fd('0x3f')]+'%'};return _0x20f6a8;}})});}_0x26d0e2=_['merge']({},_0x26d0e2,_0x16d5ae[_0x04fd('0x42')]);var _0x253daf={'where':_0x26d0e2[_0x04fd('0x3d')]};return db[_0x04fd('0x2f')][_0x04fd('0x1b')](_0x253daf)[_0x04fd('0x20')](function(_0x21be44){_0x14b9cd[_0x04fd('0x1b')]=_0x21be44;if(_0x16d5ae[_0x04fd('0x34')][_0x04fd('0x43')]){_0x26d0e2['include']=[{'all':!![]}];}return db[_0x04fd('0x2f')][_0x04fd('0x44')](_0x26d0e2);})[_0x04fd('0x20')](function(_0x23ea3e){_0x14b9cd[_0x04fd('0x45')]=_0x23ea3e;return _0x14b9cd;})[_0x04fd('0x20')](respondWithFilteredResult(_0x310446,_0x26d0e2))[_0x04fd('0x46')](handleError(_0x310446,null));};exports['show']=function(_0x48638f,_0x2c4bc0){var _0x165fe8={'raw':!![],'where':{'id':_0x48638f[_0x04fd('0x47')]['id']}},_0xfa1111={};_0xfa1111['model']=_[_0x04fd('0x35')](db[_0x04fd('0x2f')][_0x04fd('0x30')]);_0xfa1111[_0x04fd('0x34')]=_[_0x04fd('0x35')](_0x48638f['query']);_0xfa1111[_0x04fd('0x36')]=_[_0x04fd('0x37')](_0xfa1111['model'],_0xfa1111['query']);_0x165fe8[_0x04fd('0x39')]=_['intersection'](_0xfa1111[_0x04fd('0x33')],qs[_0x04fd('0x38')](_0x48638f[_0x04fd('0x34')][_0x04fd('0x38')]));_0x165fe8[_0x04fd('0x39')]=_0x165fe8[_0x04fd('0x39')]['length']?_0x165fe8['attributes']:_0xfa1111[_0x04fd('0x33')];if(_0x48638f[_0x04fd('0x34')][_0x04fd('0x43')]){_0x165fe8[_0x04fd('0x48')]=[{'all':!![]}];}_0x165fe8=_[_0x04fd('0x40')]({},_0x165fe8,_0x48638f[_0x04fd('0x42')]);return db[_0x04fd('0x2f')][_0x04fd('0x49')](_0x165fe8)[_0x04fd('0x20')](handleEntityNotFound(_0x2c4bc0,null))[_0x04fd('0x20')](respondWithResult(_0x2c4bc0,null))[_0x04fd('0x46')](handleError(_0x2c4bc0,null));};exports[_0x04fd('0x4a')]=function(_0x53d625,_0x378362){return db[_0x04fd('0x2f')][_0x04fd('0x4a')](_0x53d625[_0x04fd('0x27')],{})[_0x04fd('0x20')](respondWithResult(_0x378362,0xc9))['catch'](handleError(_0x378362,null));};exports[_0x04fd('0x4b')]=function(_0x34c775,_0x164c80){if(_0x34c775[_0x04fd('0x27')]['id']){delete _0x34c775['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x34c775[_0x04fd('0x47')]['id']}})[_0x04fd('0x20')](handleEntityNotFound(_0x164c80,null))[_0x04fd('0x20')](saveUpdates(_0x34c775['body'],null))[_0x04fd('0x20')](respondWithResult(_0x164c80,null))[_0x04fd('0x46')](handleError(_0x164c80,null));};exports[_0x04fd('0x21')]=function(_0x13fe91,_0x4e81b8){return db[_0x04fd('0x2f')]['find']({'where':{'id':_0x13fe91[_0x04fd('0x47')]['id']}})[_0x04fd('0x20')](handleEntityNotFound(_0x4e81b8,null))[_0x04fd('0x20')](removeEntity(_0x4e81b8,null))[_0x04fd('0x46')](handleError(_0x4e81b8,null));}; \ No newline at end of file +var _0x5072=['reject','update','then','destroy','sendStatus','stack','name','send','render','merge','body','message','agent','index','map','SmsApplication','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','sort','where','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','find','eml-format','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','offset','count','limit','set','Content-Range'];(function(_0x4e3d10,_0x2c0e16){var _0x262410=function(_0x1d5a5e){while(--_0x1d5a5e){_0x4e3d10['push'](_0x4e3d10['shift']());}};_0x262410(++_0x2c0e16);}(_0x5072,0xb0));var _0x2507=function(_0x377cda,_0x4fdcd4){_0x377cda=_0x377cda-0x0;var _0x467abc=_0x5072[_0x377cda];return _0x467abc;};'use strict';var emlformat=require(_0x2507('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2507('0x1'));var moment=require(_0x2507('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2507('0x3'));var util=require(_0x2507('0x4'));var path=require(_0x2507('0x5'));var sox=require('sox');var csv=require(_0x2507('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2507('0x7'));var _=require(_0x2507('0x8'));var squel=require(_0x2507('0x9'));var crypto=require(_0x2507('0xa'));var jsforce=require(_0x2507('0xb'));var deskjs=require(_0x2507('0xc'));var toCsv=require(_0x2507('0x6'));var querystring=require(_0x2507('0xd'));var Papa=require(_0x2507('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2507('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2507('0x10'));var logger=require(_0x2507('0x11'))(_0x2507('0x12'));var utils=require(_0x2507('0x13'));var config=require(_0x2507('0x14'));var licenseUtil=require(_0x2507('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf8ab5c,_0xfe60f7){_0xfe60f7=_0xfe60f7||0xcc;return function(_0x461c39){if(_0x461c39){return _0xf8ab5c['sendStatus'](_0xfe60f7);}return _0xf8ab5c[_0x2507('0x16')](_0xfe60f7)[_0x2507('0x17')]();};}function respondWithResult(_0x814653,_0x569ab8){_0x569ab8=_0x569ab8||0xc8;return function(_0x337bab){if(_0x337bab){return _0x814653[_0x2507('0x16')](_0x569ab8)[_0x2507('0x18')](_0x337bab);}};}function respondWithFilteredResult(_0x23e6ed,_0x2c48d5){return function(_0x3ce2a0){if(_0x3ce2a0){var _0x2ec4fd=typeof _0x2c48d5['offset']===_0x2507('0x19')&&typeof _0x2c48d5['limit']==='undefined';var _0x5494ba=_0x3ce2a0['count'];var _0x4e3720=_0x2ec4fd?0x0:_0x2c48d5[_0x2507('0x1a')];var _0x162852=_0x2ec4fd?_0x3ce2a0[_0x2507('0x1b')]:_0x2c48d5['offset']+_0x2c48d5[_0x2507('0x1c')];var _0x5519b9;if(_0x162852>=_0x5494ba){_0x162852=_0x5494ba;_0x5519b9=0xc8;}else{_0x5519b9=0xce;}_0x23e6ed[_0x2507('0x16')](_0x5519b9);return _0x23e6ed[_0x2507('0x1d')](_0x2507('0x1e'),_0x4e3720+'-'+_0x162852+'/'+_0x5494ba)['json'](_0x3ce2a0);}return null;};}function patchUpdates(_0x1e0f9f){return function(_0x651584){try{jsonpatch['apply'](_0x651584,_0x1e0f9f,!![]);}catch(_0x364867){return BPromise[_0x2507('0x1f')](_0x364867);}return _0x651584['save']();};}function saveUpdates(_0x5309b3,_0x2fcc77){return function(_0x4f2a29){if(_0x4f2a29){return _0x4f2a29[_0x2507('0x20')](_0x5309b3)[_0x2507('0x21')](function(_0x150a5c){return _0x150a5c;});}return null;};}function removeEntity(_0x3b14a4,_0x42f89c){return function(_0x2c30b0){if(_0x2c30b0){return _0x2c30b0[_0x2507('0x22')]()[_0x2507('0x21')](function(){_0x3b14a4['status'](0xcc)[_0x2507('0x17')]();});}};}function handleEntityNotFound(_0x2adde1,_0x419d60){return function(_0x251ce8){if(!_0x251ce8){_0x2adde1[_0x2507('0x23')](0x194);}return _0x251ce8;};}function handleError(_0x186d0e,_0x48ee44){_0x48ee44=_0x48ee44||0x1f4;return function(_0x1ae55b){logger['error'](_0x1ae55b[_0x2507('0x24')]);if(_0x1ae55b[_0x2507('0x25')]){delete _0x1ae55b[_0x2507('0x25')];}_0x186d0e[_0x2507('0x16')](_0x48ee44)[_0x2507('0x26')](_0x1ae55b);};}function getMustacheRender(_0x576dea,_0x55b8a7){return Mustache[_0x2507('0x27')](_0x576dea,_[_0x2507('0x28')](_0x55b8a7[_0x2507('0x29')],{'contact':_0x55b8a7['contact'],'message':_0x55b8a7[_0x2507('0x2a')],'agent':_0x55b8a7[_0x2507('0x2b')],'interaction':_0x55b8a7['interaction'],'account':_0x55b8a7['account']}))||'';}exports[_0x2507('0x2c')]=function(_0x42dc1e,_0x493a95){var _0x18ab63={},_0x1c57b8={},_0xf8cd91={'count':0x0,'rows':[]};var _0x373e00=_[_0x2507('0x2d')](db[_0x2507('0x2e')][_0x2507('0x2f')],function(_0x5ed4db){return{'name':_0x5ed4db['fieldName'],'type':_0x5ed4db[_0x2507('0x30')]['key']};});_0x1c57b8[_0x2507('0x31')]=_[_0x2507('0x2d')](_0x373e00,_0x2507('0x25'));_0x1c57b8['query']=_[_0x2507('0x32')](_0x42dc1e[_0x2507('0x33')]);_0x1c57b8[_0x2507('0x34')]=_[_0x2507('0x35')](_0x1c57b8['model'],_0x1c57b8['query']);_0x18ab63[_0x2507('0x36')]=_[_0x2507('0x35')](_0x1c57b8[_0x2507('0x31')],qs['fields'](_0x42dc1e['query'][_0x2507('0x37')]));_0x18ab63[_0x2507('0x36')]=_0x18ab63['attributes'][_0x2507('0x38')]?_0x18ab63[_0x2507('0x36')]:_0x1c57b8[_0x2507('0x31')];if(!_0x42dc1e[_0x2507('0x33')]['hasOwnProperty']('nolimit')){_0x18ab63[_0x2507('0x1c')]=qs[_0x2507('0x1c')](_0x42dc1e[_0x2507('0x33')][_0x2507('0x1c')]);_0x18ab63['offset']=qs['offset'](_0x42dc1e[_0x2507('0x33')][_0x2507('0x1a')]);}_0x18ab63['order']=qs[_0x2507('0x39')](_0x42dc1e[_0x2507('0x33')][_0x2507('0x39')]);_0x18ab63['where']=qs[_0x2507('0x34')](_['pick'](_0x42dc1e[_0x2507('0x33')],_0x1c57b8[_0x2507('0x34')]),_0x373e00);if(_0x42dc1e[_0x2507('0x33')]['filter']){_0x18ab63[_0x2507('0x3a')]=_[_0x2507('0x28')](_0x18ab63[_0x2507('0x3a')],{'$or':_[_0x2507('0x2d')](_0x373e00,function(_0x3f3da6){if(_0x3f3da6['type']!==_0x2507('0x3b')){var _0x5cbb0e={};_0x5cbb0e[_0x3f3da6['name']]={'$like':'%'+_0x42dc1e[_0x2507('0x33')]['filter']+'%'};return _0x5cbb0e;}})});}_0x18ab63=_[_0x2507('0x28')]({},_0x18ab63,_0x42dc1e[_0x2507('0x3c')]);var _0x12aa93={'where':_0x18ab63['where']};return db['SmsApplication']['count'](_0x12aa93)['then'](function(_0x1a6ea1){_0xf8cd91[_0x2507('0x1b')]=_0x1a6ea1;if(_0x42dc1e[_0x2507('0x33')]['includeAll']){_0x18ab63[_0x2507('0x3d')]=[{'all':!![]}];}return db[_0x2507('0x2e')][_0x2507('0x3e')](_0x18ab63);})['then'](function(_0x44acf5){_0xf8cd91[_0x2507('0x3f')]=_0x44acf5;return _0xf8cd91;})[_0x2507('0x21')](respondWithFilteredResult(_0x493a95,_0x18ab63))[_0x2507('0x40')](handleError(_0x493a95,null));};exports['show']=function(_0x557e74,_0x55d018){var _0x5154e8={'raw':!![],'where':{'id':_0x557e74[_0x2507('0x41')]['id']}},_0x5bd09f={};_0x5bd09f[_0x2507('0x31')]=_['keys'](db['SmsApplication'][_0x2507('0x2f')]);_0x5bd09f['query']=_[_0x2507('0x32')](_0x557e74[_0x2507('0x33')]);_0x5bd09f[_0x2507('0x34')]=_[_0x2507('0x35')](_0x5bd09f[_0x2507('0x31')],_0x5bd09f['query']);_0x5154e8[_0x2507('0x36')]=_[_0x2507('0x35')](_0x5bd09f[_0x2507('0x31')],qs[_0x2507('0x37')](_0x557e74['query'][_0x2507('0x37')]));_0x5154e8[_0x2507('0x36')]=_0x5154e8[_0x2507('0x36')]['length']?_0x5154e8['attributes']:_0x5bd09f['model'];if(_0x557e74['query'][_0x2507('0x42')]){_0x5154e8[_0x2507('0x3d')]=[{'all':!![]}];}_0x5154e8=_[_0x2507('0x28')]({},_0x5154e8,_0x557e74['options']);return db[_0x2507('0x2e')]['find'](_0x5154e8)[_0x2507('0x21')](handleEntityNotFound(_0x55d018,null))[_0x2507('0x21')](respondWithResult(_0x55d018,null))[_0x2507('0x40')](handleError(_0x55d018,null));};exports[_0x2507('0x43')]=function(_0x2c3b3c,_0x5f367a){return db[_0x2507('0x2e')]['create'](_0x2c3b3c[_0x2507('0x29')],{})[_0x2507('0x21')](respondWithResult(_0x5f367a,0xc9))[_0x2507('0x40')](handleError(_0x5f367a,null));};exports[_0x2507('0x20')]=function(_0x18108f,_0x40cf36){if(_0x18108f[_0x2507('0x29')]['id']){delete _0x18108f[_0x2507('0x29')]['id'];}return db[_0x2507('0x2e')][_0x2507('0x44')]({'where':{'id':_0x18108f[_0x2507('0x41')]['id']}})['then'](handleEntityNotFound(_0x40cf36,null))[_0x2507('0x21')](saveUpdates(_0x18108f['body'],null))[_0x2507('0x21')](respondWithResult(_0x40cf36,null))[_0x2507('0x40')](handleError(_0x40cf36,null));};exports[_0x2507('0x22')]=function(_0x3c7a41,_0x49fd1a){return db[_0x2507('0x2e')]['find']({'where':{'id':_0x3c7a41[_0x2507('0x41')]['id']}})['then'](handleEntityNotFound(_0x49fd1a,null))[_0x2507('0x21')](removeEntity(_0x49fd1a,null))[_0x2507('0x40')](handleError(_0x49fd1a,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 7860895..cc3a72e 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 _0x2bde=['exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x5c5f69,_0x4d568b){var _0x50c1bc=function(_0x1c6374){while(--_0x1c6374){_0x5c5f69['push'](_0x5c5f69['shift']());}};_0x50c1bc(++_0x4d568b);}(_0x2bde,0x19d));var _0xe2bd=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0x2bde[_0x47604d];return _0x388e4c;};'use strict';var _=require(_0xe2bd('0x0'));var util=require(_0xe2bd('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe2bd('0x2'));var rp=require(_0xe2bd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2bd('0x4'));var config=require(_0xe2bd('0x5'));var attributes=require(_0xe2bd('0x6'));module[_0xe2bd('0x7')]=function(_0x363903,_0x1533dc){return _0x363903['define'](_0xe2bd('0x8'),attributes,{'tableName':_0xe2bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe2bd('0xa'),'collate':_0xe2bd('0xb')});}; \ No newline at end of file +var _0x86c0=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsApplication'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x86c0,0x1a7));var _0x086c=function(_0x4005e8,_0x52a3b5){_0x4005e8=_0x4005e8-0x0;var _0x2d2903=_0x86c0[_0x4005e8];return _0x2d2903;};'use strict';var _=require(_0x086c('0x0'));var util=require(_0x086c('0x1'));var logger=require(_0x086c('0x2'))(_0x086c('0x3'));var moment=require(_0x086c('0x4'));var BPromise=require(_0x086c('0x5'));var rp=require(_0x086c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x086c('0x7'));var config=require(_0x086c('0x8'));var attributes=require('./smsApplication.attributes');module[_0x086c('0x9')]=function(_0x49093f,_0x1547ff){return _0x49093f[_0x086c('0xa')](_0x086c('0xb'),attributes,{'tableName':_0x086c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x086c('0xd'),'collate':_0x086c('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 5260c24..01c5d99 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 _0x639d=['moment','randomstring','ioredis','../../config/utils','rpc','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x639d,0xbb));var _0xd639=function(_0x2dccaf,_0x360685){_0x2dccaf=_0x2dccaf-0x0;var _0x91fe5=_0x639d[_0x2dccaf];return _0x91fe5;};'use strict';var _=require(_0xd639('0x0'));var util=require(_0xd639('0x1'));var moment=require(_0xd639('0x2'));var BPromise=require('bluebird');var rs=require(_0xd639('0x3'));var fs=require('fs');var Redis=require(_0xd639('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd639('0x5'));var logger=require('../../config/logger')(_0xd639('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd639('0x7')][_0xd639('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x283157,_0x2e6dd4,_0x200b82){return new BPromise(function(_0x3be7c6,_0x42b044){return client[_0xd639('0x9')](_0x283157,_0x200b82)['then'](function(_0x12960e){logger[_0xd639('0xa')](_0xd639('0xb'),_0x2e6dd4,_0xd639('0xc'));logger[_0xd639('0xd')](_0xd639('0xe'),_0x2e6dd4,_0xd639('0xc'),JSON[_0xd639('0xf')](_0x12960e));if(_0x12960e[_0xd639('0x10')]){if(_0x12960e['error'][_0xd639('0x11')]===0x1f4){logger[_0xd639('0x10')](_0xd639('0xb'),_0x2e6dd4,_0x12960e['error'][_0xd639('0x12')]);return _0x42b044(_0x12960e[_0xd639('0x10')][_0xd639('0x12')]);}logger['error'](_0xd639('0xb'),_0x2e6dd4,_0x12960e[_0xd639('0x10')]['message']);return _0x3be7c6(_0x12960e[_0xd639('0x10')][_0xd639('0x12')]);}else{logger['info'](_0xd639('0xb'),_0x2e6dd4,_0xd639('0xc'));_0x3be7c6(_0x12960e[_0xd639('0x13')][_0xd639('0x12')]);}})[_0xd639('0x14')](function(_0x5e3c84){logger[_0xd639('0x10')](_0xd639('0xb'),_0x2e6dd4,_0x5e3c84);_0x42b044(_0x5e3c84);});});} \ No newline at end of file +var _0x43fd=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0x43fd,0x1ec));var _0xd43f=function(_0x515414,_0x4f4e6a){_0x515414=_0x515414-0x0;var _0x2c30c7=_0x43fd[_0x515414];return _0x2c30c7;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd43f('0x1'));var fs=require('fs');var Redis=require(_0xd43f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd43f('0x3'));var logger=require('../../config/logger')(_0xd43f('0x4'));var config=require(_0xd43f('0x5'));var jayson=require(_0xd43f('0x6'));var client=jayson[_0xd43f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde214d,_0xad5196,_0x20ccd7){return new BPromise(function(_0x331163,_0x547e12){return client[_0xd43f('0x8')](_0xde214d,_0x20ccd7)[_0xd43f('0x9')](function(_0x52e9c8){logger[_0xd43f('0xa')](_0xd43f('0xb'),_0xad5196,_0xd43f('0xc'));logger[_0xd43f('0xd')](_0xd43f('0xe'),_0xad5196,'request\x20sent',JSON[_0xd43f('0xf')](_0x52e9c8));if(_0x52e9c8[_0xd43f('0x10')]){if(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x11')]===0x1f4){logger[_0xd43f('0x10')](_0xd43f('0xb'),_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x547e12(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);}logger[_0xd43f('0x10')]('SmsApplication,\x20%s,\x20%s',_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x331163(_0x52e9c8[_0xd43f('0x10')]['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0xad5196,_0xd43f('0xc'));_0x331163(_0x52e9c8[_0xd43f('0x13')]['message']);}})[_0xd43f('0x14')](function(_0x3647df){logger['error']('SmsApplication,\x20%s,\x20%s',_0xad5196,_0x3647df);_0x547e12(_0x3647df);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 672e6a9..4f61cde 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 _0x677a=['isAuthenticated','/describe','describe','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get'];(function(_0x28f6c5,_0x48e43f){var _0x317bcf=function(_0x43cb7a){while(--_0x43cb7a){_0x28f6c5['push'](_0x28f6c5['shift']());}};_0x317bcf(++_0x48e43f);}(_0x677a,0xd6));var _0xa677=function(_0x1980a7,_0x31242d){_0x1980a7=_0x1980a7-0x0;var _0x350432=_0x677a[_0x1980a7];return _0x350432;};'use strict';var multer=require(_0xa677('0x0'));var util=require('util');var path=require(_0xa677('0x1'));var timeout=require(_0xa677('0x2'));var express=require(_0xa677('0x3'));var router=express[_0xa677('0x4')]();var fs_extra=require(_0xa677('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa677('0x6'));var config=require(_0xa677('0x7'));var controller=require(_0xa677('0x8'));router[_0xa677('0x9')]('/',auth[_0xa677('0xa')](),controller['index']);router[_0xa677('0x9')](_0xa677('0xb'),auth[_0xa677('0xa')](),controller[_0xa677('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa677('0xd')]);router['get'](_0xa677('0xe'),auth[_0xa677('0xa')](),controller['getMessages']);router[_0xa677('0x9')](_0xa677('0xf'),auth[_0xa677('0xa')](),controller[_0xa677('0x10')]);router['post']('/',auth[_0xa677('0xa')](),controller[_0xa677('0x11')]);router[_0xa677('0x12')](_0xa677('0xe'),auth['isAuthenticated'](),controller[_0xa677('0x13')]);router['post'](_0xa677('0x14'),auth[_0xa677('0xa')](),interaction[_0xa677('0x15')](_0xa677('0x16'),_0xa677('0x17')),controller[_0xa677('0x18')]);router[_0xa677('0x19')](_0xa677('0x1a'),auth[_0xa677('0xa')](),interaction[_0xa677('0x15')](_0xa677('0x16'),_0xa677('0x1b')),controller[_0xa677('0x1c')]);router[_0xa677('0x1d')]('/:id',auth[_0xa677('0xa')](),interaction[_0xa677('0x15')]('sms','smsinteraction:destroy'),controller[_0xa677('0x1e')]);router[_0xa677('0x1d')](_0xa677('0x14'),auth[_0xa677('0xa')](),controller['removeTags']);module[_0xa677('0x1f')]=router; \ No newline at end of file +var _0xd43e=['Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/:id','isAuthenticated','show','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','smsinteraction:addtags','put','smsinteraction:update','delete','sms','smsinteraction:destroy','removeTags','multer','path','connect-timeout','express'];(function(_0x218419,_0x57f42c){var _0xe4f396=function(_0x5a25ee){while(--_0x5a25ee){_0x218419['push'](_0x218419['shift']());}};_0xe4f396(++_0x57f42c);}(_0xd43e,0x88));var _0xed43=function(_0x130536,_0x543ea0){_0x130536=_0x130536-0x0;var _0x31b0cb=_0xd43e[_0x130536];return _0x31b0cb;};'use strict';var multer=require(_0xed43('0x0'));var util=require('util');var path=require(_0xed43('0x1'));var timeout=require(_0xed43('0x2'));var express=require(_0xed43('0x3'));var router=express[_0xed43('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xed43('0x5'));var config=require(_0xed43('0x6'));var controller=require(_0xed43('0x7'));router[_0xed43('0x8')]('/',auth['isAuthenticated'](),controller[_0xed43('0x9')]);router[_0xed43('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xed43('0x8')](_0xed43('0xa'),auth[_0xed43('0xb')](),controller[_0xed43('0xc')]);router[_0xed43('0x8')]('/:id/messages',auth[_0xed43('0xb')](),controller[_0xed43('0xd')]);router['get'](_0xed43('0xe'),auth[_0xed43('0xb')](),controller[_0xed43('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xed43('0x10')]);router[_0xed43('0x11')]('/:id/messages',auth[_0xed43('0xb')](),controller[_0xed43('0x12')]);router[_0xed43('0x11')](_0xed43('0x13'),auth[_0xed43('0xb')](),interaction[_0xed43('0x14')]('sms',_0xed43('0x15')),controller['addTags']);router[_0xed43('0x16')]('/:id',auth[_0xed43('0xb')](),interaction['tracked']('sms',_0xed43('0x17')),controller['update']);router[_0xed43('0x18')](_0xed43('0xa'),auth[_0xed43('0xb')](),interaction['tracked'](_0xed43('0x19'),_0xed43('0x1a')),controller['destroy']);router['delete'](_0xed43('0x13'),auth[_0xed43('0xb')](),controller[_0xed43('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9730ccf..f82d306 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 _0x89e1=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x58e6be,_0x274cd3){var _0x3340df=function(_0x1475b9){while(--_0x1475b9){_0x58e6be['push'](_0x58e6be['shift']());}};_0x3340df(++_0x274cd3);}(_0x89e1,0xcb));var _0x189e=function(_0x4e84eb,_0x333f26){_0x4e84eb=_0x4e84eb-0x0;var _0x11cdad=_0x89e1[_0x4e84eb];return _0x11cdad;};'use strict';var Sequelize=require(_0x189e('0x0'));var moment=require('moment');module[_0x189e('0x1')]={'closed':{'type':Sequelize[_0x189e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x189e('0x3')]},'disposition':{'type':Sequelize[_0x189e('0x4')]},'secondDisposition':{'type':Sequelize[_0x189e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x189e('0x4')]},'note':{'type':Sequelize[_0x189e('0x4')]},'phone':{'type':Sequelize[_0x189e('0x4')]},'read1stAt':{'type':Sequelize[_0x189e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x189e('0x5')]('in',_0x189e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x189e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x189e('0x5')]('in',_0x189e('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5090=['exports','DATE','STRING','ENUM','out'];(function(_0x3df240,_0x1c6990){var _0x187d87=function(_0x9565cf){while(--_0x9565cf){_0x3df240['push'](_0x3df240['shift']());}};_0x187d87(++_0x1c6990);}(_0x5090,0x195));var _0x0509=function(_0x232e21,_0x2ea878){_0x232e21=_0x232e21-0x0;var _0x5a1d2d=_0x5090[_0x232e21];return _0x5a1d2d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0509('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0509('0x1')]},'disposition':{'type':Sequelize[_0x0509('0x2')]},'secondDisposition':{'type':Sequelize[_0x0509('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0509('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0509('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0509('0x3')]('in',_0x0509('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0509('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x0509('0x3')]('in',_0x0509('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a37ff54..a00a6da 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 _0x7c7c=['log','err','rimraf','zip-dir','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','error','stack','name','send','render','merge','interaction','Users','map','fullname','TagIds','Tags','push','catch','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','body','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','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.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','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','contactName','isEmpty','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','i.SmsAccountId\x20IS\x20NULL','role','toString','keyBy','SmsInteraction','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','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.SmsInteractionId\x20IN\x20?','groupBy','all','show','includeAll','include','update','params','describe','addMessage','SmsMessage','ids','omit','SmsInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','setTags','spread','Tag','smsInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','CmContact','firstName','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','disposition','Messages','out','System','lastName','renderFile','views','downloadInteraction.html','transcript-','.pdf','Sms','createPdfFromHTML'];(function(_0x4e83e1,_0x511f13){var _0x236e44=function(_0x2f63b7){while(--_0x2f63b7){_0x4e83e1['push'](_0x4e83e1['shift']());}};_0x236e44(++_0x511f13);}(_0x7c7c,0xed));var _0xc7c7=function(_0x35f167,_0x5c5195){_0x35f167=_0x35f167-0x0;var _0x57b77a=_0x7c7c[_0x35f167];return _0x57b77a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc7c7('0x0'));var zipdir=require(_0xc7c7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc7c7('0x2'));var BPromise=require(_0xc7c7('0x3'));var Mustache=require('mustache');var util=require(_0xc7c7('0x4'));var path=require(_0xc7c7('0x5'));var sox=require('sox');var csv=require(_0xc7c7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc7c7('0x7'));var _=require(_0xc7c7('0x8'));var squel=require('squel');var crypto=require(_0xc7c7('0x9'));var jsforce=require(_0xc7c7('0xa'));var deskjs=require(_0xc7c7('0xb'));var toCsv=require(_0xc7c7('0x6'));var querystring=require(_0xc7c7('0xc'));var Papa=require('papaparse');var Redis=require(_0xc7c7('0xd'));var authService=require(_0xc7c7('0xe'));var qs=require(_0xc7c7('0xf'));var as=require(_0xc7c7('0x10'));var pdf=require(_0xc7c7('0x11'));var hardwareService=require(_0xc7c7('0x12'));var logger=require(_0xc7c7('0x13'))('api');var utils=require(_0xc7c7('0x14'));var config=require(_0xc7c7('0x15'));var licenseUtil=require(_0xc7c7('0x16'));var db=require(_0xc7c7('0x17'))['db'];config[_0xc7c7('0x18')]=_[_0xc7c7('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc7c7('0x1a'))(new Redis(config[_0xc7c7('0x18')]));require(_0xc7c7('0x1b'))['register'](socket);function respondWithStatusCode(_0x1a7411,_0x3b7338){_0x3b7338=_0x3b7338||0xcc;return function(_0x2d21b0){if(_0x2d21b0){return _0x1a7411[_0xc7c7('0x1c')](_0x3b7338);}return _0x1a7411[_0xc7c7('0x1d')](_0x3b7338)[_0xc7c7('0x1e')]();};}function respondWithResult(_0x1941fe,_0xca2f20){_0xca2f20=_0xca2f20||0xc8;return function(_0x2b7071){if(_0x2b7071){return _0x1941fe[_0xc7c7('0x1d')](_0xca2f20)[_0xc7c7('0x1f')](_0x2b7071);}};}function respondWithFilteredResult(_0x511038,_0x7f5495){return function(_0x406739){if(_0x406739){var _0x154f0d=typeof _0x7f5495[_0xc7c7('0x20')]===_0xc7c7('0x21')&&typeof _0x7f5495[_0xc7c7('0x22')]===_0xc7c7('0x21');var _0x563a2a=_0x406739[_0xc7c7('0x23')];var _0x21b5d6=_0x154f0d?0x0:_0x7f5495[_0xc7c7('0x20')];var _0xc6213a=_0x154f0d?_0x406739[_0xc7c7('0x23')]:_0x7f5495[_0xc7c7('0x20')]+_0x7f5495['limit'];var _0x319a52;if(_0xc6213a>=_0x563a2a){_0xc6213a=_0x563a2a;_0x319a52=0xc8;}else{_0x319a52=0xce;}_0x511038[_0xc7c7('0x1d')](_0x319a52);return _0x511038['set'](_0xc7c7('0x24'),_0x21b5d6+'-'+_0xc6213a+'/'+_0x563a2a)[_0xc7c7('0x1f')](_0x406739);}return null;};}function patchUpdates(_0x3be512){return function(_0x4e19e3){try{jsonpatch['apply'](_0x4e19e3,_0x3be512,!![]);}catch(_0x23746f){return BPromise['reject'](_0x23746f);}return _0x4e19e3[_0xc7c7('0x25')]();};}function saveUpdates(_0x481ef9,_0x380e18){return function(_0x111e1d){if(_0x111e1d){return _0x111e1d['update'](_0x481ef9)[_0xc7c7('0x26')](function(_0x5b7a64){return _0x5b7a64;});}return null;};}function removeEntity(_0x34dac7,_0x52ed38){return function(_0x5931c9){if(_0x5931c9){return _0x5931c9[_0xc7c7('0x27')]()[_0xc7c7('0x26')](function(){_0x34dac7[_0xc7c7('0x1d')](0xcc)[_0xc7c7('0x1e')]();});}};}function handleEntityNotFound(_0xaed84d,_0x3db44a){return function(_0x585457){if(!_0x585457){_0xaed84d[_0xc7c7('0x1c')](0x194);}return _0x585457;};}function handleError(_0x5c6439,_0x148469){_0x148469=_0x148469||0x1f4;return function(_0x549119){logger[_0xc7c7('0x28')](_0x549119[_0xc7c7('0x29')]);if(_0x549119[_0xc7c7('0x2a')]){delete _0x549119[_0xc7c7('0x2a')];}_0x5c6439[_0xc7c7('0x1d')](_0x148469)[_0xc7c7('0x2b')](_0x549119);};}function getMustacheRender(_0x4149b0,_0x42a8b6){return Mustache[_0xc7c7('0x2c')](_0x4149b0,_[_0xc7c7('0x2d')](_0x42a8b6['body'],{'contact':_0x42a8b6['contact'],'message':_0x42a8b6['message'],'agent':_0x42a8b6['agent'],'interaction':_0x42a8b6[_0xc7c7('0x2e')],'account':_0x42a8b6['account']}))||'';}function getInteractionUsers(_0x44dbcb,_0x13f929){return new BPromise(function(_0x24ca09,_0x5df16d){try{if(_0x13f929[_0x44dbcb['id']]){_0x44dbcb[_0xc7c7('0x2f')]=_[_0xc7c7('0x30')](_0x13f929[_0x44dbcb['id']],function(_0x120e45){return{'id':_0x120e45['id'],'fullname':_0x120e45[_0xc7c7('0x31')]};});}}catch(_0x285ede){_0x5df16d(_0x285ede);}_0x24ca09(_0x44dbcb);});}function getInteractionTags(_0x284119,_0x1ec7d8){return new BPromise(function(_0x1dff5a,_0x6b51fa){try{if(_0x284119[_0xc7c7('0x32')]){_0x284119[_0xc7c7('0x33')]=[];_0x284119[_0xc7c7('0x32')]['split'](',')['forEach'](function(_0x4b5356){_0x284119[_0xc7c7('0x33')][_0xc7c7('0x34')](_0x1ec7d8[_0x4b5356]);});}delete _0x284119[_0xc7c7('0x32')];}catch(_0x128127){_0x6b51fa(_0x128127);}_0x1dff5a(_0x284119);});}function updateSmsInteraction(_0x31d302,_0x13ca7e,_0x2fd3b9){return new BPromise(function(_0x4feb3c,_0x19cd2f){return getInteractionUsers(_0x31d302,_0x2fd3b9)[_0xc7c7('0x26')](function(_0x25366f){return getInteractionTags(_0x25366f,_0x13ca7e);})[_0xc7c7('0x26')](function(_0x361c27){_0x4feb3c(_0x361c27);})[_0xc7c7('0x35')](function(_0x34f894){_0x19cd2f(_0x34f894);});});}exports[_0xc7c7('0x36')]=function(_0x86d76c,_0x5ddf27){var _0x56e660={},_0x3b1c2c={},_0x19f9ad={'count':0x0,'rows':[]};var _0x398838=_['map'](db['SmsInteraction'][_0xc7c7('0x37')],function(_0x45bc05){return{'name':_0x45bc05['fieldName'],'type':_0x45bc05[_0xc7c7('0x38')][_0xc7c7('0x39')]};});_0x3b1c2c[_0xc7c7('0x3a')]=_[_0xc7c7('0x30')](_0x398838,_0xc7c7('0x2a'));_0x3b1c2c[_0xc7c7('0x3b')]=_[_0xc7c7('0x3c')](_0x86d76c[_0xc7c7('0x3b')]);_0x3b1c2c[_0xc7c7('0x3d')]=_[_0xc7c7('0x3e')](_0x3b1c2c[_0xc7c7('0x3a')],_0x3b1c2c[_0xc7c7('0x3b')]);_0x56e660[_0xc7c7('0x3f')]=_[_0xc7c7('0x3e')](_0x3b1c2c[_0xc7c7('0x3a')],qs['fields'](_0x86d76c[_0xc7c7('0x3b')][_0xc7c7('0x40')]));_0x56e660['attributes']=_0x56e660[_0xc7c7('0x3f')][_0xc7c7('0x41')]?_0x56e660[_0xc7c7('0x3f')]:_0x3b1c2c[_0xc7c7('0x3a')];if(!_0x86d76c[_0xc7c7('0x3b')][_0xc7c7('0x42')](_0xc7c7('0x43'))){_0x56e660['limit']=qs['limit'](_0x86d76c[_0xc7c7('0x3b')][_0xc7c7('0x22')]);_0x56e660[_0xc7c7('0x20')]=qs[_0xc7c7('0x20')](_0x86d76c[_0xc7c7('0x3b')][_0xc7c7('0x20')]);}_0x56e660[_0xc7c7('0x44')]=qs[_0xc7c7('0x45')](_0x86d76c[_0xc7c7('0x3b')][_0xc7c7('0x45')]);_0x56e660[_0xc7c7('0x46')]=qs[_0xc7c7('0x3d')](_[_0xc7c7('0x47')](_0x86d76c[_0xc7c7('0x3b')],_0x3b1c2c['filters']),_0x398838);var _0x2a8e25=[];var _0x351365=squel['select']()['field']('id')[_0xc7c7('0x48')](_0xc7c7('0x2a'))[_0xc7c7('0x48')](_0xc7c7('0x49'))[_0xc7c7('0x4a')](_0xc7c7('0x4b'));var _0xff4d7b=squel['select']()['field']('u.id')[_0xc7c7('0x48')](_0xc7c7('0x4c'))[_0xc7c7('0x48')](_0xc7c7('0x4d'))[_0xc7c7('0x4a')](_0xc7c7('0x4e'),'ui')[_0xc7c7('0x4f')](_0xc7c7('0x50'),'u',_0xc7c7('0x51'));var _0x5ad54a=squel[_0xc7c7('0x52')]()[_0xc7c7('0x4a')](_0xc7c7('0x53'),'i')['left_join'](_0xc7c7('0x54'),'c',_0xc7c7('0x55'))['left_join']('users','o',_0xc7c7('0x56'))['left_join'](_0xc7c7('0x57'),'a',_0xc7c7('0x58'))[_0xc7c7('0x4f')]('sms_messages','me',_0xc7c7('0x59'))[_0xc7c7('0x4f')](_0xc7c7('0x5a'),'it',_0xc7c7('0x5b'))[_0xc7c7('0x4f')]('tools_tags','t',_0xc7c7('0x5c'));var _0x4daadd=squel[_0xc7c7('0x5d')]();var _0x55a776=[];var _0x2430a5=squel[_0xc7c7('0x5d')]();var _0x5d9005;if(_0x86d76c['query'][_0xc7c7('0x5e')]){_0x5d9005=as[_0xc7c7('0x5f')](_0x86d76c[_0xc7c7('0x3b')]['search']);var _0x370ddb=_0x5d9005['sqlOperator'];for(var _0x5a7df0=0x0;_0x5a7df0<_0x5d9005[_0xc7c7('0x60')][_0xc7c7('0x41')];_0x5a7df0++){var _0x4fd112=_0x5d9005[_0xc7c7('0x60')][_0x5a7df0];var _0x2854b0='i';var _0x1fde69=_[_0xc7c7('0x61')](_0x398838,[_0xc7c7('0x2a'),_0x4fd112['field']]);if(!_0x1fde69){switch(_0x4fd112[_0xc7c7('0x48')]){case _0xc7c7('0x62'):if(_0x4fd112[_0xc7c7('0x63')]==0x1){_0x5ad54a[_0xc7c7('0x64')]('`'+_0x4fd112['field']+'`\x20=\x200');}else{_0x5ad54a[_0xc7c7('0x64')]('`'+_0x4fd112[_0xc7c7('0x48')]+_0xc7c7('0x65'));}break;case _0xc7c7('0x66'):if(_0x4fd112[_0xc7c7('0x67')]===_0xc7c7('0x68')){if(_0x4fd112['value']['split']('\x20')[_0xc7c7('0x41')]>0x1){_0x4daadd[_0x370ddb](_0xc7c7('0x69'),qs[_0xc7c7('0x6a')](_0x4fd112['value']),null);}else{var _0x16e552='%'+_0x4fd112['value']+'%';_0x4daadd[_0x370ddb](_0xc7c7('0x6b'),_0x16e552,_0x16e552,_0x16e552);}}else{_0x1fde69=_[_0xc7c7('0x61')](_0x398838,['name',_0xc7c7('0x6c')]);_0x4fd112[_0xc7c7('0x48')]=_0xc7c7('0x6c');_0x1d8642=as[_0xc7c7('0x6d')](_0x2854b0,_0x1fde69[_0xc7c7('0x38')],_0x4fd112);_0x4daadd[_0x370ddb](_0x1d8642['text'],_0x1d8642[_0xc7c7('0x63')]['start'],_0x1d8642[_0xc7c7('0x63')][_0xc7c7('0x1e')]);}break;case'Tag':var _0x44e8fc=_0x4fd112[_0xc7c7('0x63')][_0xc7c7('0x6e')](',')[_0xc7c7('0x30')](function(_0x5c98b2){return Number(_0x5c98b2);});_0x44e8fc['forEach'](function(_0x40fc28){_0x2430a5['or'](_0xc7c7('0x6f'),'%,'+_0x40fc28+',%');});_0x55a776=_[_0xc7c7('0x70')](_0x55a776,_0x44e8fc);break;case _0xc7c7('0x71'):if(_0x4fd112['operator']===_0xc7c7('0x68')){_0x4daadd[_0x370ddb](_0xc7c7('0x72'),'%'+_0x4fd112[_0xc7c7('0x63')]+'%',null);}else{_0x1fde69=_['find'](_0x398838,[_0xc7c7('0x2a'),_0xc7c7('0x73')]);_0x4fd112['field']=_0xc7c7('0x73');_0x1d8642=as[_0xc7c7('0x6d')](_0x2854b0,_0x1fde69[_0xc7c7('0x38')],_0x4fd112);_0x4daadd[_0x370ddb](_0x1d8642[_0xc7c7('0x74')],_0x1d8642['value'][_0xc7c7('0x75')],_0x1d8642[_0xc7c7('0x63')][_0xc7c7('0x1e')]);}break;case _0xc7c7('0x76'):_0x1d8642=as['buildExpression']('me',null,_0x4fd112);_0x4daadd[_0x370ddb](_0x1d8642[_0xc7c7('0x74')],_0x1d8642['value'][_0xc7c7('0x75')],_0x1d8642['value'][_0xc7c7('0x1e')]);break;}}else{var _0x1d8642=as[_0xc7c7('0x6d')](_0x2854b0,_0x1fde69[_0xc7c7('0x38')],_0x4fd112);_0x4daadd[_0x370ddb](_0x1d8642[_0xc7c7('0x74')],_0x1d8642['value'][_0xc7c7('0x75')],_0x1d8642[_0xc7c7('0x63')][_0xc7c7('0x1e')]);}}}else{var _0x547576=_(_0x86d76c['query'])['keys']()[_0xc7c7('0x30')](function(_0x42b69d){return _[_0xc7c7('0x77')](_0x398838,[_0xc7c7('0x2a'),_0x42b69d])?_0x42b69d:undefined;})[_0xc7c7('0x78')]()[_0xc7c7('0x63')]();if(!_['isEmpty'](_0x547576)){_0x547576['forEach'](function(_0x340f78){if(_0x340f78===_0xc7c7('0x79')){_0x5ad54a[_0xc7c7('0x46')](_0xc7c7('0x7a'),[][_0xc7c7('0x7b')](_0x86d76c[_0xc7c7('0x3b')][_0x340f78]));}else if(_0x340f78===_0xc7c7('0x7c')){var _0x48df32=JSON[_0xc7c7('0x7d')](_0x86d76c[_0xc7c7('0x3b')][_0x340f78])['$gte'];var _0x2a1455=JSON[_0xc7c7('0x7d')](_0x86d76c['query'][_0x340f78])[_0xc7c7('0x7e')];_0x5ad54a[_0xc7c7('0x46')](_0xc7c7('0x7f'),_0x48df32,_0x2a1455);}else{if(_0x86d76c['query'][_0x340f78]===_0xc7c7('0x80')){_0x5ad54a[_0xc7c7('0x46')]('i.'+_0x340f78+_0xc7c7('0x81'));}else{_0x5ad54a['where']('i.'+_0x340f78+_0xc7c7('0x82'),_0x86d76c['query'][_0x340f78]);}}});}if(_0x86d76c[_0xc7c7('0x3b')]['read']){if(_0x86d76c['query'][_0xc7c7('0x83')]==0x1){_0x5ad54a[_0xc7c7('0x64')](_0xc7c7('0x84'));}else{_0x5ad54a['having'](_0xc7c7('0x85'));}}if(_0x86d76c['query'][_0xc7c7('0x86')]){_0x55a776=_[_0xc7c7('0x87')](_0x86d76c[_0xc7c7('0x3b')][_0xc7c7('0x86')])?_0x86d76c[_0xc7c7('0x3b')]['tag']:new Array(_0x86d76c[_0xc7c7('0x3b')][_0xc7c7('0x86')]);_0x55a776['forEach'](function(_0x26c2dd){_0x2430a5['or'](_0xc7c7('0x6f'),'%,'+_0x26c2dd+',%');});}if(_0x86d76c[_0xc7c7('0x3b')][_0xc7c7('0x88')]){var _0x26c8a1=_0x86d76c['query'][_0xc7c7('0x88')][_0xc7c7('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc7c7('0x8a')](_0x26c8a1)){_0x4daadd['or']('i.id\x20LIKE\x20?',_0x26c8a1+'%')['or'](_0xc7c7('0x8b'),_0x26c8a1+'%');}else{_0x4daadd['or'](_0xc7c7('0x8c'),qs[_0xc7c7('0x6a')](_0x26c8a1))['or'](_0xc7c7('0x8d'),_0x26c8a1+'%');}}}_0x5ad54a[_0xc7c7('0x46')](_0x4daadd);_0x5ad54a[_0xc7c7('0x8e')](_0xc7c7('0x8f'));var _0xa93da3={'type':db[_0xc7c7('0x90')][_0xc7c7('0x91')]['SELECT'],'raw':!![]};var _0x478184=_0x5ad54a['clone']();_0x478184[_0xc7c7('0x48')]('i.id');_0x478184[_0xc7c7('0x48')](_0xc7c7('0x92'),_0xc7c7('0x62'));if(_0x56e660[_0xc7c7('0x44')]){_0x56e660[_0xc7c7('0x44')][_0xc7c7('0x93')](function(_0x2d8d32){var _0xc81ef3=_0x2d8d32[0x0]===_0xc7c7('0x94')?_0x2d8d32[0x0]:'i.'+_0x2d8d32[0x0];_0x5ad54a['order'](_0xc81ef3,_0x2d8d32[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc7c7('0x95')](_0x55a776)){_0x5ad54a['having'](_0x2430a5);_0x478184[_0xc7c7('0x46')]('t.id\x20IN\x20?',_0x55a776);}BPromise['resolve']()[_0xc7c7('0x26')](function(){if(!_0x5d9005){if(_0x86d76c[_0xc7c7('0x3b')][_0xc7c7('0x79')])return;_0x478184[_0xc7c7('0x46')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x5ad54a[_0xc7c7('0x46')](_0xc7c7('0x96'));return;}if(_0x86d76c[_0xc7c7('0x97')]['role']!==_0xc7c7('0x98'))return;return _0x86d76c[_0xc7c7('0x97')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x1bdbc7){if(_[_0xc7c7('0x95')](_0x1bdbc7)){_0x478184['where'](_0xc7c7('0x99'));_0x5ad54a[_0xc7c7('0x46')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x478184[_0xc7c7('0x46')](_0xc7c7('0x7a'),_[_0xc7c7('0x30')](_0x1bdbc7,'id'));_0x5ad54a[_0xc7c7('0x46')](_0xc7c7('0x7a'),_[_0xc7c7('0x30')](_0x1bdbc7,'id'));}});})[_0xc7c7('0x26')](function(){if(_0x86d76c[_0xc7c7('0x97')][_0xc7c7('0x9a')]===_0xc7c7('0x98')&&!_0x5d9005&&!_0x86d76c[_0xc7c7('0x3b')]['SmsAccountId'])return[];return db['sequelize'][_0xc7c7('0x3b')](_0x478184[_0xc7c7('0x9b')](),_0xa93da3);})[_0xc7c7('0x26')](function(_0x2259de){_0x19f9ad[_0xc7c7('0x23')]=_0x2259de['length'];if(_0x19f9ad[_0xc7c7('0x23')]===0x0)return[];return db['sequelize'][_0xc7c7('0x3b')](_0x351365[_0xc7c7('0x9b')](),_0xa93da3)['then'](function(_0x326572){_0x2a8e25=_[_0xc7c7('0x9c')](_0x326572,'id');_0xa93da3=_['merge'](_0xa93da3,{'model':db[_0xc7c7('0x9d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x86d76c[_0xc7c7('0x3b')]['fields']){_0x56e660['attributes']['forEach'](function(_0x2a79de){_0x5ad54a['field']('i.'+_0x2a79de);});}else{_0x5ad54a[_0xc7c7('0x48')](_0xc7c7('0x92'),_0xc7c7('0x62'));_0x5ad54a['field']('a.key','Account.key');_0x5ad54a[_0xc7c7('0x48')](_0xc7c7('0x9e'),_0xc7c7('0x9f'));_0x5ad54a[_0xc7c7('0x48')](_0xc7c7('0xa0'),_0xc7c7('0x94'));_0x5ad54a[_0xc7c7('0x48')](_0xc7c7('0xa1'));_0x5ad54a[_0xc7c7('0x48')]('c.firstName',_0xc7c7('0xa2'));_0x5ad54a[_0xc7c7('0x48')](_0xc7c7('0xa3'),_0xc7c7('0xa4'));_0x5ad54a['field'](_0xc7c7('0xa5'),_0xc7c7('0xa6'));_0x5ad54a['field'](_0xc7c7('0xa7'),_0xc7c7('0xa8'));_0x5ad54a[_0xc7c7('0x48')]('c.mobile',_0xc7c7('0xa9'));_0x5ad54a[_0xc7c7('0x48')](_0xc7c7('0xaa'),'Contact.fax');_0x5ad54a[_0xc7c7('0x48')](_0xc7c7('0xab'),_0xc7c7('0xac'));_0x5ad54a[_0xc7c7('0x48')](_0xc7c7('0xad'),_0xc7c7('0xae'));_0x5ad54a[_0xc7c7('0x48')](_0xc7c7('0xaf'),_0xc7c7('0x32'));}if(_0x56e660[_0xc7c7('0x22')])_0x5ad54a['limit'](_0x56e660[_0xc7c7('0x22')]);if(_0x56e660[_0xc7c7('0x20')])_0x5ad54a[_0xc7c7('0x20')](_0x56e660['offset']);return db[_0xc7c7('0xb0')][_0xc7c7('0x3b')](_0x5ad54a[_0xc7c7('0x9b')](),_0xa93da3);})['then'](function(_0x1f9c0c){if(_0x1f9c0c[_0xc7c7('0x41')]>0x0)_0xff4d7b[_0xc7c7('0x46')](_0xc7c7('0xb1'),_[_0xc7c7('0x30')](_0x1f9c0c,'id'));return db[_0xc7c7('0xb0')]['query'](_0xff4d7b[_0xc7c7('0x9b')](),_0xa93da3)[_0xc7c7('0x26')](function(_0x4efa67){var _0xb7314c=_[_0xc7c7('0xb2')](_0x4efa67,'SmsInteractionId');var _0x312504=[];_0x1f9c0c[_0xc7c7('0x93')](function(_0x68a63e){_0x312504[_0xc7c7('0x34')](updateSmsInteraction(_0x68a63e,_0x2a8e25,_0xb7314c));});return BPromise[_0xc7c7('0xb3')](_0x312504);});});})[_0xc7c7('0x26')](function(_0x4d1ead){_0x19f9ad['rows']=_0x4d1ead;return _0x19f9ad;})[_0xc7c7('0x26')](respondWithFilteredResult(_0x5ddf27,_0x56e660))[_0xc7c7('0x35')](handleError(_0x5ddf27,null));};exports[_0xc7c7('0xb4')]=function(_0x580d37,_0x508154){var _0xb2e1e3={'raw':![],'where':{'id':_0x580d37['params']['id']}},_0x443066={};_0x443066['model']=_[_0xc7c7('0x3c')](db[_0xc7c7('0x9d')][_0xc7c7('0x37')]);_0x443066[_0xc7c7('0x3b')]=_[_0xc7c7('0x3c')](_0x580d37['query']);_0x443066['filters']=_[_0xc7c7('0x3e')](_0x443066[_0xc7c7('0x3a')],_0x443066[_0xc7c7('0x3b')]);_0xb2e1e3[_0xc7c7('0x3f')]=_[_0xc7c7('0x3e')](_0x443066[_0xc7c7('0x3a')],qs[_0xc7c7('0x40')](_0x580d37[_0xc7c7('0x3b')][_0xc7c7('0x40')]));_0xb2e1e3['attributes']=_0xb2e1e3[_0xc7c7('0x3f')][_0xc7c7('0x41')]?_0xb2e1e3['attributes']:_0x443066[_0xc7c7('0x3a')];if(_0x580d37[_0xc7c7('0x3b')][_0xc7c7('0xb5')]){_0xb2e1e3[_0xc7c7('0xb6')]=[{'all':!![]}];}_0xb2e1e3=_['merge']({},_0xb2e1e3,_0x580d37['options']);return db['SmsInteraction']['find'](_0xb2e1e3)[_0xc7c7('0x26')](handleEntityNotFound(_0x508154,null))[_0xc7c7('0x26')](respondWithResult(_0x508154,null))[_0xc7c7('0x35')](handleError(_0x508154,null));};exports['create']=function(_0x32306b,_0x111ec7){return db[_0xc7c7('0x9d')]['create'](_0x32306b[_0xc7c7('0x76')],{})['then'](respondWithResult(_0x111ec7,0xc9))[_0xc7c7('0x35')](handleError(_0x111ec7,null));};exports[_0xc7c7('0xb7')]=function(_0x2818b9,_0x4c3a0d){if(_0x2818b9[_0xc7c7('0x76')]['id']){delete _0x2818b9[_0xc7c7('0x76')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x2818b9[_0xc7c7('0xb8')]['id']}})['then'](handleEntityNotFound(_0x4c3a0d,null))['then'](saveUpdates(_0x2818b9['body'],null))[_0xc7c7('0x26')](respondWithResult(_0x4c3a0d,null))['catch'](handleError(_0x4c3a0d,null));};exports['destroy']=function(_0x3774bc,_0x55879b){return db['SmsInteraction']['find']({'where':{'id':_0x3774bc[_0xc7c7('0xb8')]['id']}})['then'](handleEntityNotFound(_0x55879b,null))[_0xc7c7('0x26')](removeEntity(_0x55879b,null))[_0xc7c7('0x35')](handleError(_0x55879b,null));};exports[_0xc7c7('0xb9')]=function(_0x161a88,_0x480f48){return db['SmsInteraction'][_0xc7c7('0xb9')]()[_0xc7c7('0x26')](respondWithResult(_0x480f48,null))[_0xc7c7('0x35')](handleError(_0x480f48,null));};exports[_0xc7c7('0xba')]=function(_0x297c44,_0x1585fe,_0x2b8a7e){return db[_0xc7c7('0xbb')][_0xc7c7('0x61')]({'where':{'id':_0x297c44[_0xc7c7('0xb8')]['id']}})[_0xc7c7('0x26')](handleEntityNotFound(_0x1585fe,null))[_0xc7c7('0x26')](function(_0x2d405f){if(_0x2d405f){return _0x2d405f[_0xc7c7('0xba')](_0x297c44['body'][_0xc7c7('0xbc')],_[_0xc7c7('0xbd')](_0x297c44[_0xc7c7('0x76')],[_0xc7c7('0xbc'),'id'])||{});}})[_0xc7c7('0x26')](respondWithResult(_0x1585fe,null))[_0xc7c7('0x35')](handleError(_0x1585fe,null));};exports['getMessages']=function(_0x4f3274,_0x3c57a3,_0x4e3267){var _0x4f5246={'raw':![],'where':{}};var _0x15328f={};var _0x1747a={'count':0x0,'rows':[]};return db[_0xc7c7('0x9d')]['findOne']({'where':{'id':_0x4f3274[_0xc7c7('0xb8')]['id']}})[_0xc7c7('0x26')](handleEntityNotFound(_0x3c57a3,null))[_0xc7c7('0x26')](function(_0x16b7ed){if(_0x16b7ed){_0x15328f[_0xc7c7('0x3a')]=_['keys'](db[_0xc7c7('0xbb')][_0xc7c7('0x37')]);_0x15328f[_0xc7c7('0x3b')]=_[_0xc7c7('0x3c')](_0x4f3274[_0xc7c7('0x3b')]);_0x15328f[_0xc7c7('0x3d')]=_[_0xc7c7('0x3e')](_0x15328f['model'],_0x15328f[_0xc7c7('0x3b')]);_0x4f5246[_0xc7c7('0x3f')]=_[_0xc7c7('0x3e')](_0x15328f[_0xc7c7('0x3a')],qs[_0xc7c7('0x40')](_0x4f3274[_0xc7c7('0x3b')][_0xc7c7('0x40')]));_0x4f5246[_0xc7c7('0x3f')]=_0x4f5246['attributes'][_0xc7c7('0x41')]?_0x4f5246['attributes']:_0x15328f[_0xc7c7('0x3a')];if(!_0x4f3274[_0xc7c7('0x3b')]['hasOwnProperty'](_0xc7c7('0x43'))){_0x4f5246[_0xc7c7('0x22')]=qs[_0xc7c7('0x22')](_0x4f3274[_0xc7c7('0x3b')][_0xc7c7('0x22')]);_0x4f5246['offset']=qs[_0xc7c7('0x20')](_0x4f3274['query'][_0xc7c7('0x20')]);}_0x4f5246[_0xc7c7('0x44')]=qs[_0xc7c7('0x45')](_0x4f3274[_0xc7c7('0x3b')]['sort']);_0x4f5246['where']=qs[_0xc7c7('0x3d')](_[_0xc7c7('0x47')](_0x4f3274[_0xc7c7('0x3b')],_0x15328f[_0xc7c7('0x3d')]));_0x4f5246[_0xc7c7('0x46')][_0xc7c7('0xbe')]=_0x16b7ed['id'];if(_0x4f3274[_0xc7c7('0x3b')][_0xc7c7('0x88')]){_0x4f5246[_0xc7c7('0x46')]=_[_0xc7c7('0x2d')](_0x4f5246['where'],{'$or':_['map'](_0x4f5246['attributes'],function(_0x22329a){var _0x4a6efd={};_0x4a6efd[_0x22329a]={'$like':'%'+_0x4f3274['query'][_0xc7c7('0x88')]+'%'};return _0x4a6efd;})});}if(_0x4f3274['query'][_0xc7c7('0xbf')]){var _0x1bb252=_0x4f3274['query'][_0xc7c7('0xbf')][_0xc7c7('0x6e')](',');var _0x20d36f={};_0x20d36f[_0x1bb252[0x0]]={'$gte':moment(_0x1bb252[0x1])[_0xc7c7('0xc0')](_0xc7c7('0xc1'))};_0x4f5246[_0xc7c7('0x46')]=_[_0xc7c7('0x2d')](_0x4f5246[_0xc7c7('0x46')],_0x20d36f);}_0x4f5246=_[_0xc7c7('0x2d')]({},_0x4f5246,_0x4f3274[_0xc7c7('0xc2')]);return db['SmsMessage'][_0xc7c7('0x23')]({'where':_0x4f5246[_0xc7c7('0x46')]})[_0xc7c7('0x26')](function(_0x4d4865){_0x1747a['count']=_0x4d4865;if(_0x4f3274[_0xc7c7('0x3b')][_0xc7c7('0xb5')]){_0x4f5246['include']=[{'all':!![]}];}return db[_0xc7c7('0xbb')][_0xc7c7('0xc3')](_0x4f5246);})[_0xc7c7('0x26')](function(_0x3de09e){_0x1747a[_0xc7c7('0xc4')]=_0x3de09e;return _0x1747a;});}})[_0xc7c7('0x26')](respondWithFilteredResult(_0x3c57a3,_0x4f5246))[_0xc7c7('0x35')](handleError(_0x3c57a3,null));};exports[_0xc7c7('0xc5')]=function(_0x3d76e7,_0xc684e7,_0x53937d){return db['SmsInteraction'][_0xc7c7('0x61')]({'where':{'id':_0x3d76e7[_0xc7c7('0xb8')]['id']}})[_0xc7c7('0x26')](handleEntityNotFound(_0xc684e7,null))[_0xc7c7('0x26')](function(_0x431217){if(_0x431217){return _0x431217[_0xc7c7('0xc6')](_0x3d76e7['body']['ids'],_[_0xc7c7('0xbd')](_0x3d76e7[_0xc7c7('0x76')],[_0xc7c7('0xbc'),'id'])||{})[_0xc7c7('0xc7')](function(){return db[_0xc7c7('0xc8')][_0xc7c7('0xc3')]({'attributes':['id',_0xc7c7('0x2a'),_0xc7c7('0x49')],'where':{'id':_0x3d76e7[_0xc7c7('0x76')]['ids']}});})[_0xc7c7('0x26')](function(_0x305a34){socket['emit'](_0xc7c7('0xc9'),{'id':Number(_0x3d76e7[_0xc7c7('0xb8')]['id']),'tags':_0x305a34||[]});return{'id':Number(_0x3d76e7[_0xc7c7('0xb8')]['id']),'tags':_0x305a34||[]};});}})[_0xc7c7('0x26')](respondWithResult(_0xc684e7,null))['catch'](handleError(_0xc684e7,null));};exports[_0xc7c7('0xca')]=function(_0x391ce3,_0x358226,_0x26e2e1){return db[_0xc7c7('0x9d')][_0xc7c7('0x61')]({'where':{'id':_0x391ce3[_0xc7c7('0xb8')]['id']}})['then'](handleEntityNotFound(_0x358226,null))[_0xc7c7('0x26')](function(_0x21c945){if(_0x21c945){return _0x21c945[_0xc7c7('0xca')](_0x391ce3['query'][_0xc7c7('0xbc')]);}})[_0xc7c7('0x26')](respondWithStatusCode(_0x358226,null))[_0xc7c7('0x35')](handleError(_0x358226,null));};exports[_0xc7c7('0xcb')]=function(_0x220700,_0x187a9d){var _0xfa9f12=moment()[_0xc7c7('0xcc')]()[_0xc7c7('0x9b')]();var _0x41c6d8=path['join'](config['root'],_0xc7c7('0xcd'),_0xc7c7('0xce'),_0xc7c7('0xcf'));var _0x421f65=path[_0xc7c7('0xd0')](config[_0xc7c7('0xd1')],'server','files',_0xc7c7('0xd2'));var _0x5590c9=path[_0xc7c7('0xd0')](_0x41c6d8,_0xfa9f12);var _0x1e89f4=util[_0xc7c7('0xc0')](_0xc7c7('0xd3'),_0x220700['params']['id'],_0xfa9f12);var _0x25c0bf=path[_0xc7c7('0xd0')](_0x41c6d8,_0x1e89f4);var _0x235e6b=[];_0x235e6b[_0xc7c7('0x34')]({'model':db['User'],'as':_0xc7c7('0x71'),'attributes':['id',_0xc7c7('0x31')],'raw':!![]});_0x235e6b[_0xc7c7('0x34')]({'model':db[_0xc7c7('0xd4')],'as':_0xc7c7('0x66'),'attributes':['id',_0xc7c7('0xd5'),'lastName'],'raw':!![]});var _0x16d49e=[{'model':db[_0xc7c7('0xbb')],'as':'Messages','attributes':['id',_0xc7c7('0x76'),'createdAt',_0xc7c7('0xd6'),_0xc7c7('0xd7'),_0xc7c7('0x83')],'include':_0x235e6b}];_0x16d49e[_0xc7c7('0x34')]({'model':db[_0xc7c7('0xd8')],'as':_0xc7c7('0xd9'),'attributes':['id','name']});_0x16d49e[_0xc7c7('0x34')]({'model':db[_0xc7c7('0x71')],'as':_0xc7c7('0xda'),'attributes':['id','fullname']});return db[_0xc7c7('0x9d')]['find']({'where':{'id':_0x220700[_0xc7c7('0xb8')]['id']},'include':_0x16d49e})[_0xc7c7('0x26')](handleEntityNotFound(_0x187a9d,null))[_0xc7c7('0x26')](function(_0x5734f9){if(_0x5734f9){var _0x35eed2=_0x5734f9[_0xc7c7('0xdb')]({'plain':!![]});fs[_0xc7c7('0xdc')](_0x5590c9);var _0x2912bb={'channel':'Sms','account':_0x35eed2[_0xc7c7('0xd9')][_0xc7c7('0x2a')],'agent':_0x35eed2[_0xc7c7('0xda')]?_0x35eed2[_0xc7c7('0xda')][_0xc7c7('0x31')]:'N.A.','createdAt':moment(_0x35eed2['createdAt'])[_0xc7c7('0xc0')](_0xc7c7('0xc1'))[_0xc7c7('0x9b')](),'closedAt':_0x35eed2['closed']?moment(_0x35eed2['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xc7c7('0x9b')]():'','disposition':_0x35eed2[_0xc7c7('0xdd')],'messages':_(_0x35eed2[_0xc7c7('0xde')])[_0xc7c7('0x88')]({'secret':![]})['map'](function(_0x16c5ce){return{'date':moment(_0x16c5ce[_0xc7c7('0x7c')])[_0xc7c7('0xc0')](_0xc7c7('0xc1'))['toString'](),'sender':_0x16c5ce[_0xc7c7('0xd6')]===_0xc7c7('0xdf')?_0x16c5ce[_0xc7c7('0x71')]?_0x16c5ce['User'][_0xc7c7('0x31')]:_0xc7c7('0xe0'):_0x16c5ce[_0xc7c7('0x66')][_0xc7c7('0xd5')]+(_0x16c5ce[_0xc7c7('0x66')][_0xc7c7('0xe1')]?'\x20'+_0x16c5ce[_0xc7c7('0x66')][_0xc7c7('0xe1')]:''),'body':_0x16c5ce[_0xc7c7('0x76')],'direction':_0x16c5ce[_0xc7c7('0xd6')]===_0xc7c7('0xdf')?'A':'C','secret':_0x16c5ce[_0xc7c7('0xd7')],'read':_0x16c5ce['read']};})[_0xc7c7('0x63')]()};return ejs[_0xc7c7('0xe2')](path[_0xc7c7('0xd0')](config['root'],'server',_0xc7c7('0xe3'),_0xc7c7('0xe4')),{'interaction':_0x2912bb})['then'](function(_0x59edc6){var _0x3b57da=path[_0xc7c7('0xd0')](_0x5590c9,_0xc7c7('0xe5')+_0x35eed2['id']+'-'+_0xfa9f12+_0xc7c7('0xe6'));var _0x5210e3={'path':_0x3b57da,'channel':_0xc7c7('0xe7'),'interactionId':_0x35eed2['id']};return pdf[_0xc7c7('0xe8')](_0x59edc6,_0x5210e3);})[_0xc7c7('0x26')](function(){return new BPromise(function(_0x49755a,_0x52c882){zipdir(_0x5590c9,{'saveTo':_0x25c0bf},function(_0x58b542,_0x3d198d){if(_0x58b542)return _0x52c882(_0x58b542);return _0x49755a(_0x3d198d);});})[_0xc7c7('0x26')](function(){return new BPromise(function(_0x54aafc,_0x4eb232){rimraf(_0x5590c9,function(_0x4c0183){if(_0x4c0183)_0x4eb232(_0x4c0183);return _0x54aafc();});});})[_0xc7c7('0x26')](function(){return _0x187a9d['download'](_0x25c0bf,_0x1e89f4,function(_0x44030d){if(_0x44030d){console[_0xc7c7('0xe9')](_0xc7c7('0xea'),_0x44030d);}else{fs['unlinkSync'](_0x25c0bf);}});});});}else{return _0x187a9d[_0xc7c7('0x1c')](0xc8);}})['catch'](handleError(_0x187a9d,null));}; \ No newline at end of file +var _0xa350=['sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','render','merge','body','contact','message','interaction','account','Users','map','TagIds','Tags','split','forEach','push','then','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','sms_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','Account.key','i.*','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','show','params','intersection','includeAll','options','describe','addMessage','ids','omit','findOne','SmsMessage','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','color','emit','smsInteractionTags:save','download','join','root','server','tmp','files','transcript-%d-%s.zip','User','CmContact','firstName','createdAt','direction','secret','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','Messages','System','lastName','out','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa350,0xde));var _0x0a35=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xa350[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x0a35('0x0'));var rimraf=require(_0x0a35('0x1'));var zipdir=require(_0x0a35('0x2'));var jsonpatch=require(_0x0a35('0x3'));var rp=require(_0x0a35('0x4'));var moment=require(_0x0a35('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0a35('0x6'));var util=require(_0x0a35('0x7'));var path=require(_0x0a35('0x8'));var sox=require(_0x0a35('0x9'));var csv=require(_0x0a35('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a35('0xb'));var squel=require('squel');var crypto=require(_0x0a35('0xc'));var jsforce=require(_0x0a35('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a35('0xa'));var querystring=require('querystring');var Papa=require(_0x0a35('0xe'));var Redis=require(_0x0a35('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a35('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0a35('0x11'));var utils=require(_0x0a35('0x12'));var config=require(_0x0a35('0x13'));var licenseUtil=require(_0x0a35('0x14'));var db=require(_0x0a35('0x15'))['db'];config[_0x0a35('0x16')]=_['defaults'](config[_0x0a35('0x16')],{'host':_0x0a35('0x17'),'port':0x18eb});var socket=require(_0x0a35('0x18'))(new Redis(config[_0x0a35('0x16')]));require(_0x0a35('0x19'))[_0x0a35('0x1a')](socket);function respondWithStatusCode(_0x2e3fdc,_0x52a14c){_0x52a14c=_0x52a14c||0xcc;return function(_0x54c1ea){if(_0x54c1ea){return _0x2e3fdc[_0x0a35('0x1b')](_0x52a14c);}return _0x2e3fdc[_0x0a35('0x1c')](_0x52a14c)[_0x0a35('0x1d')]();};}function respondWithResult(_0x281fa4,_0xc9b372){_0xc9b372=_0xc9b372||0xc8;return function(_0x39a847){if(_0x39a847){return _0x281fa4[_0x0a35('0x1c')](_0xc9b372)['json'](_0x39a847);}};}function respondWithFilteredResult(_0x25c42a,_0x2219ed){return function(_0x46c07d){if(_0x46c07d){var _0x46e930=typeof _0x2219ed['offset']==='undefined'&&typeof _0x2219ed[_0x0a35('0x1e')]===_0x0a35('0x1f');var _0xc71189=_0x46c07d[_0x0a35('0x20')];var _0x1b2f35=_0x46e930?0x0:_0x2219ed[_0x0a35('0x21')];var _0x2879bd=_0x46e930?_0x46c07d[_0x0a35('0x20')]:_0x2219ed[_0x0a35('0x21')]+_0x2219ed[_0x0a35('0x1e')];var _0x237548;if(_0x2879bd>=_0xc71189){_0x2879bd=_0xc71189;_0x237548=0xc8;}else{_0x237548=0xce;}_0x25c42a['status'](_0x237548);return _0x25c42a['set'](_0x0a35('0x22'),_0x1b2f35+'-'+_0x2879bd+'/'+_0xc71189)[_0x0a35('0x23')](_0x46c07d);}return null;};}function patchUpdates(_0x1b7232){return function(_0x1a4502){try{jsonpatch[_0x0a35('0x24')](_0x1a4502,_0x1b7232,!![]);}catch(_0x2bc5a4){return BPromise[_0x0a35('0x25')](_0x2bc5a4);}return _0x1a4502[_0x0a35('0x26')]();};}function saveUpdates(_0x46e576,_0x42b8f3){return function(_0x120edf){if(_0x120edf){return _0x120edf[_0x0a35('0x27')](_0x46e576)['then'](function(_0x12ec41){return _0x12ec41;});}return null;};}function removeEntity(_0x1fa04f,_0x2d63c5){return function(_0x227a56){if(_0x227a56){return _0x227a56[_0x0a35('0x28')]()['then'](function(){_0x1fa04f[_0x0a35('0x1c')](0xcc)[_0x0a35('0x1d')]();});}};}function handleEntityNotFound(_0x3ca412,_0x532341){return function(_0x3e5ee1){if(!_0x3e5ee1){_0x3ca412[_0x0a35('0x1b')](0x194);}return _0x3e5ee1;};}function handleError(_0x369395,_0x110d53){_0x110d53=_0x110d53||0x1f4;return function(_0x2a49de){logger[_0x0a35('0x29')](_0x2a49de[_0x0a35('0x2a')]);if(_0x2a49de[_0x0a35('0x2b')]){delete _0x2a49de[_0x0a35('0x2b')];}_0x369395[_0x0a35('0x1c')](_0x110d53)[_0x0a35('0x2c')](_0x2a49de);};}function getMustacheRender(_0x109144,_0x10d0ec){return Mustache[_0x0a35('0x2d')](_0x109144,_[_0x0a35('0x2e')](_0x10d0ec[_0x0a35('0x2f')],{'contact':_0x10d0ec[_0x0a35('0x30')],'message':_0x10d0ec[_0x0a35('0x31')],'agent':_0x10d0ec['agent'],'interaction':_0x10d0ec[_0x0a35('0x32')],'account':_0x10d0ec[_0x0a35('0x33')]}))||'';}function getInteractionUsers(_0x174ba6,_0x3e4aca){return new BPromise(function(_0xb2a3d4,_0x4b4e74){try{if(_0x3e4aca[_0x174ba6['id']]){_0x174ba6[_0x0a35('0x34')]=_[_0x0a35('0x35')](_0x3e4aca[_0x174ba6['id']],function(_0x32b2ce){return{'id':_0x32b2ce['id'],'fullname':_0x32b2ce['fullname']};});}}catch(_0x48eb46){_0x4b4e74(_0x48eb46);}_0xb2a3d4(_0x174ba6);});}function getInteractionTags(_0x2afe84,_0x14c995){return new BPromise(function(_0x582749,_0xa17b83){try{if(_0x2afe84[_0x0a35('0x36')]){_0x2afe84[_0x0a35('0x37')]=[];_0x2afe84[_0x0a35('0x36')][_0x0a35('0x38')](',')[_0x0a35('0x39')](function(_0x287b95){_0x2afe84[_0x0a35('0x37')][_0x0a35('0x3a')](_0x14c995[_0x287b95]);});}delete _0x2afe84['TagIds'];}catch(_0x54d03a){_0xa17b83(_0x54d03a);}_0x582749(_0x2afe84);});}function updateSmsInteraction(_0xfbb5a8,_0x82ff01,_0x2e5817){return new BPromise(function(_0x3f696a,_0x53573d){return getInteractionUsers(_0xfbb5a8,_0x2e5817)[_0x0a35('0x3b')](function(_0x1c0126){return getInteractionTags(_0x1c0126,_0x82ff01);})[_0x0a35('0x3b')](function(_0xace4c4){_0x3f696a(_0xace4c4);})[_0x0a35('0x3c')](function(_0x11b919){_0x53573d(_0x11b919);});});}exports[_0x0a35('0x3d')]=function(_0x2f48b3,_0x5ec3db){var _0x54fdbd={},_0x2d554e={},_0x4ad06c={'count':0x0,'rows':[]};var _0x1a6003=_['map'](db[_0x0a35('0x3e')][_0x0a35('0x3f')],function(_0x5108fb){return{'name':_0x5108fb[_0x0a35('0x40')],'type':_0x5108fb[_0x0a35('0x41')][_0x0a35('0x42')]};});_0x2d554e[_0x0a35('0x43')]=_[_0x0a35('0x35')](_0x1a6003,_0x0a35('0x2b'));_0x2d554e[_0x0a35('0x44')]=_[_0x0a35('0x45')](_0x2f48b3[_0x0a35('0x44')]);_0x2d554e[_0x0a35('0x46')]=_['intersection'](_0x2d554e['model'],_0x2d554e[_0x0a35('0x44')]);_0x54fdbd[_0x0a35('0x47')]=_['intersection'](_0x2d554e['model'],qs[_0x0a35('0x48')](_0x2f48b3[_0x0a35('0x44')]['fields']));_0x54fdbd[_0x0a35('0x47')]=_0x54fdbd[_0x0a35('0x47')][_0x0a35('0x49')]?_0x54fdbd['attributes']:_0x2d554e['model'];if(!_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x4a')](_0x0a35('0x4b'))){_0x54fdbd[_0x0a35('0x1e')]=qs[_0x0a35('0x1e')](_0x2f48b3['query'][_0x0a35('0x1e')]);_0x54fdbd[_0x0a35('0x21')]=qs[_0x0a35('0x21')](_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x21')]);}_0x54fdbd[_0x0a35('0x4c')]=qs[_0x0a35('0x4d')](_0x2f48b3['query']['sort']);_0x54fdbd['where']=qs[_0x0a35('0x46')](_[_0x0a35('0x4e')](_0x2f48b3[_0x0a35('0x44')],_0x2d554e[_0x0a35('0x46')]),_0x1a6003);var _0xb9d0f3=[];var _0x34b23f=squel[_0x0a35('0x4f')]()[_0x0a35('0x50')]('id')[_0x0a35('0x50')](_0x0a35('0x2b'))[_0x0a35('0x50')]('color')[_0x0a35('0x51')](_0x0a35('0x52'));var _0x4d9514=squel[_0x0a35('0x4f')]()['field']('u.id')[_0x0a35('0x50')](_0x0a35('0x53'))[_0x0a35('0x50')](_0x0a35('0x54'))[_0x0a35('0x51')](_0x0a35('0x55'),'ui')['left_join'](_0x0a35('0x56'),'u','u.id\x20=\x20ui.UserId');var _0x18a8f3=squel[_0x0a35('0x4f')]()[_0x0a35('0x51')](_0x0a35('0x57'),'i')[_0x0a35('0x58')]('cm_contacts','c',_0x0a35('0x59'))[_0x0a35('0x58')](_0x0a35('0x56'),'o',_0x0a35('0x5a'))[_0x0a35('0x58')](_0x0a35('0x5b'),'a','a.id\x20=\x20i.SmsAccountId')[_0x0a35('0x58')](_0x0a35('0x5c'),'me',_0x0a35('0x5d'))['left_join'](_0x0a35('0x5e'),'it',_0x0a35('0x5f'))[_0x0a35('0x58')](_0x0a35('0x52'),'t',_0x0a35('0x60'));var _0xc8da0c=squel[_0x0a35('0x61')]();var _0x149392=[];var _0x296ae5=squel[_0x0a35('0x61')]();var _0x38f00c;if(_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x62')]){_0x38f00c=as[_0x0a35('0x63')](_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x62')]);var _0x2dc185=_0x38f00c[_0x0a35('0x64')];for(var _0x3d9f85=0x0;_0x3d9f85<_0x38f00c[_0x0a35('0x65')][_0x0a35('0x49')];_0x3d9f85++){var _0x1f1aa5=_0x38f00c['conditions'][_0x3d9f85];var _0x663354='i';var _0x24ff36=_[_0x0a35('0x66')](_0x1a6003,['name',_0x1f1aa5['field']]);if(!_0x24ff36){switch(_0x1f1aa5[_0x0a35('0x50')]){case _0x0a35('0x67'):if(_0x1f1aa5[_0x0a35('0x68')]==0x1){_0x18a8f3[_0x0a35('0x69')]('`'+_0x1f1aa5[_0x0a35('0x50')]+_0x0a35('0x6a'));}else{_0x18a8f3[_0x0a35('0x69')]('`'+_0x1f1aa5['field']+_0x0a35('0x6b'));}break;case _0x0a35('0x6c'):if(_0x1f1aa5['operator']===_0x0a35('0x6d')){if(_0x1f1aa5[_0x0a35('0x68')][_0x0a35('0x38')]('\x20')[_0x0a35('0x49')]>0x1){_0xc8da0c[_0x2dc185](_0x0a35('0x6e'),qs[_0x0a35('0x6f')](_0x1f1aa5[_0x0a35('0x68')]),null);}else{var _0x57d7eb='%'+_0x1f1aa5['value']+'%';_0xc8da0c[_0x2dc185](_0x0a35('0x70'),_0x57d7eb,_0x57d7eb,_0x57d7eb);}}else{_0x24ff36=_[_0x0a35('0x66')](_0x1a6003,[_0x0a35('0x2b'),_0x0a35('0x71')]);_0x1f1aa5['field']=_0x0a35('0x71');_0x5480ba=as[_0x0a35('0x72')](_0x663354,_0x24ff36['type'],_0x1f1aa5);_0xc8da0c[_0x2dc185](_0x5480ba[_0x0a35('0x73')],_0x5480ba[_0x0a35('0x68')][_0x0a35('0x74')],_0x5480ba[_0x0a35('0x68')]['end']);}break;case _0x0a35('0x75'):var _0x92c134=_0x1f1aa5[_0x0a35('0x68')][_0x0a35('0x38')](',')[_0x0a35('0x35')](function(_0x3b3ca9){return Number(_0x3b3ca9);});_0x92c134[_0x0a35('0x39')](function(_0xa64fd4){_0x296ae5['or'](_0x0a35('0x76'),'%,'+_0xa64fd4+',%');});_0x149392=_[_0x0a35('0x77')](_0x149392,_0x92c134);break;case'User':if(_0x1f1aa5[_0x0a35('0x78')]===_0x0a35('0x6d')){_0xc8da0c[_0x2dc185](_0x0a35('0x79'),'%'+_0x1f1aa5['value']+'%',null);}else{_0x24ff36=_[_0x0a35('0x66')](_0x1a6003,['name',_0x0a35('0x7a')]);_0x1f1aa5[_0x0a35('0x50')]=_0x0a35('0x7a');_0x5480ba=as[_0x0a35('0x72')](_0x663354,_0x24ff36['type'],_0x1f1aa5);_0xc8da0c[_0x2dc185](_0x5480ba[_0x0a35('0x73')],_0x5480ba[_0x0a35('0x68')][_0x0a35('0x74')],_0x5480ba[_0x0a35('0x68')]['end']);}break;case _0x0a35('0x2f'):_0x5480ba=as[_0x0a35('0x72')]('me',null,_0x1f1aa5);_0xc8da0c[_0x2dc185](_0x5480ba[_0x0a35('0x73')],_0x5480ba[_0x0a35('0x68')]['start'],_0x5480ba[_0x0a35('0x68')][_0x0a35('0x1d')]);break;}}else{var _0x5480ba=as[_0x0a35('0x72')](_0x663354,_0x24ff36['type'],_0x1f1aa5);_0xc8da0c[_0x2dc185](_0x5480ba[_0x0a35('0x73')],_0x5480ba[_0x0a35('0x68')][_0x0a35('0x74')],_0x5480ba[_0x0a35('0x68')][_0x0a35('0x1d')]);}}}else{var _0x3551c6=_(_0x2f48b3[_0x0a35('0x44')])[_0x0a35('0x45')]()['map'](function(_0x344e04){return _[_0x0a35('0x7b')](_0x1a6003,[_0x0a35('0x2b'),_0x344e04])?_0x344e04:undefined;})['compact']()[_0x0a35('0x68')]();if(!_[_0x0a35('0x7c')](_0x3551c6)){_0x3551c6['forEach'](function(_0x38af44){if(_0x38af44===_0x0a35('0x7d')){_0x18a8f3[_0x0a35('0x7e')](_0x0a35('0x7f'),[][_0x0a35('0x80')](_0x2f48b3[_0x0a35('0x44')][_0x38af44]));}else if(_0x38af44==='createdAt'){var _0x5af341=JSON['parse'](_0x2f48b3[_0x0a35('0x44')][_0x38af44])[_0x0a35('0x81')];var _0x5893f1=JSON[_0x0a35('0x82')](_0x2f48b3[_0x0a35('0x44')][_0x38af44])[_0x0a35('0x83')];_0x18a8f3[_0x0a35('0x7e')](_0x0a35('0x84'),_0x5af341,_0x5893f1);}else{if(_0x2f48b3[_0x0a35('0x44')][_0x38af44]==='null'){_0x18a8f3[_0x0a35('0x7e')]('i.'+_0x38af44+_0x0a35('0x85'));}else{_0x18a8f3[_0x0a35('0x7e')]('i.'+_0x38af44+_0x0a35('0x86'),_0x2f48b3[_0x0a35('0x44')][_0x38af44]);}}});}if(_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x87')]){if(_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x87')]==0x1){_0x18a8f3[_0x0a35('0x69')](_0x0a35('0x88'));}else{_0x18a8f3[_0x0a35('0x69')]('`unreadMessages`\x20>\x200');}}if(_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x89')]){_0x149392=_[_0x0a35('0x8a')](_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x89')])?_0x2f48b3['query'][_0x0a35('0x89')]:new Array(_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x89')]);_0x149392[_0x0a35('0x39')](function(_0xa354f1){_0x296ae5['or'](_0x0a35('0x76'),'%,'+_0xa354f1+',%');});}if(_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x8b')]){var _0x5632bb=_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x8b')][_0x0a35('0x8c')]('\x5c','\x5c\x5c')[_0x0a35('0x8c')](/'/g,'\x27\x27');if(qs[_0x0a35('0x8d')](_0x5632bb)){_0xc8da0c['or'](_0x0a35('0x8e'),_0x5632bb+'%')['or']('i.phone\x20LIKE\x20?',_0x5632bb+'%');}else{_0xc8da0c['or'](_0x0a35('0x8f'),qs[_0x0a35('0x6f')](_0x5632bb))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5632bb+'%');}}}_0x18a8f3[_0x0a35('0x7e')](_0xc8da0c);_0x18a8f3['group'](_0x0a35('0x90'));var _0x2b8b4e={'type':db[_0x0a35('0x91')][_0x0a35('0x92')][_0x0a35('0x93')],'raw':!![]};var _0x32cee8=_0x18a8f3[_0x0a35('0x94')]();_0x32cee8[_0x0a35('0x50')](_0x0a35('0x90'));_0x32cee8[_0x0a35('0x50')](_0x0a35('0x95'),_0x0a35('0x67'));if(_0x54fdbd['order']){_0x54fdbd[_0x0a35('0x4c')][_0x0a35('0x39')](function(_0x505dbe){var _0x4ce5c4=_0x505dbe[0x0]==='contactName'?_0x505dbe[0x0]:'i.'+_0x505dbe[0x0];_0x18a8f3['order'](_0x4ce5c4,_0x505dbe[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a35('0x7c')](_0x149392)){_0x18a8f3[_0x0a35('0x69')](_0x296ae5);_0x32cee8[_0x0a35('0x7e')](_0x0a35('0x96'),_0x149392);}BPromise[_0x0a35('0x97')]()['then'](function(){if(!_0x38f00c){if(_0x2f48b3[_0x0a35('0x44')]['SmsAccountId'])return;_0x32cee8[_0x0a35('0x7e')](_0x0a35('0x98'));_0x18a8f3[_0x0a35('0x7e')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2f48b3[_0x0a35('0x99')][_0x0a35('0x9a')]!==_0x0a35('0x9b'))return;return _0x2f48b3[_0x0a35('0x99')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x0a35('0x3b')](function(_0x45f836){if(_[_0x0a35('0x7c')](_0x45f836)){_0x32cee8['where'](_0x0a35('0x9c'));_0x18a8f3[_0x0a35('0x7e')](_0x0a35('0x9c'));}else{_0x32cee8[_0x0a35('0x7e')](_0x0a35('0x7f'),_[_0x0a35('0x35')](_0x45f836,'id'));_0x18a8f3[_0x0a35('0x7e')](_0x0a35('0x7f'),_[_0x0a35('0x35')](_0x45f836,'id'));}});})['then'](function(){if(_0x2f48b3[_0x0a35('0x99')]['role']==='agent'&&!_0x38f00c&&!_0x2f48b3[_0x0a35('0x44')][_0x0a35('0x7d')])return[];return db[_0x0a35('0x9d')][_0x0a35('0x44')](_0x32cee8[_0x0a35('0x9e')](),_0x2b8b4e);})[_0x0a35('0x3b')](function(_0x46d07c){_0x4ad06c[_0x0a35('0x20')]=_0x46d07c[_0x0a35('0x49')];if(_0x4ad06c['count']===0x0)return[];return db['sequelize'][_0x0a35('0x44')](_0x34b23f[_0x0a35('0x9e')](),_0x2b8b4e)[_0x0a35('0x3b')](function(_0x312bbd){_0xb9d0f3=_['keyBy'](_0x312bbd,'id');_0x2b8b4e=_[_0x0a35('0x2e')](_0x2b8b4e,{'model':db[_0x0a35('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f48b3[_0x0a35('0x44')]['fields']){_0x54fdbd['attributes'][_0x0a35('0x39')](function(_0x17b55){_0x18a8f3[_0x0a35('0x50')]('i.'+_0x17b55);});}else{_0x18a8f3['field'](_0x0a35('0x95'),_0x0a35('0x67'));_0x18a8f3['field']('a.key',_0x0a35('0x9f'));_0x18a8f3['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x18a8f3[_0x0a35('0x50')]('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');_0x18a8f3[_0x0a35('0x50')](_0x0a35('0xa0'));_0x18a8f3[_0x0a35('0x50')]('c.firstName','Contact.firstName');_0x18a8f3[_0x0a35('0x50')](_0x0a35('0xa1'),_0x0a35('0xa2'));_0x18a8f3[_0x0a35('0x50')](_0x0a35('0xa3'),_0x0a35('0xa4'));_0x18a8f3[_0x0a35('0x50')]('c.phone',_0x0a35('0xa5'));_0x18a8f3['field'](_0x0a35('0xa6'),_0x0a35('0xa7'));_0x18a8f3['field']('c.fax',_0x0a35('0xa8'));_0x18a8f3[_0x0a35('0x50')](_0x0a35('0xa9'),_0x0a35('0xaa'));_0x18a8f3[_0x0a35('0x50')](_0x0a35('0xab'),_0x0a35('0xac'));_0x18a8f3[_0x0a35('0x50')](_0x0a35('0xad'),'TagIds');}if(_0x54fdbd[_0x0a35('0x1e')])_0x18a8f3['limit'](_0x54fdbd[_0x0a35('0x1e')]);if(_0x54fdbd['offset'])_0x18a8f3['offset'](_0x54fdbd[_0x0a35('0x21')]);return db[_0x0a35('0x9d')]['query'](_0x18a8f3['toString'](),_0x2b8b4e);})[_0x0a35('0x3b')](function(_0x45742d){if(_0x45742d[_0x0a35('0x49')]>0x0)_0x4d9514[_0x0a35('0x7e')](_0x0a35('0xae'),_[_0x0a35('0x35')](_0x45742d,'id'));return db[_0x0a35('0x9d')]['query'](_0x4d9514[_0x0a35('0x9e')](),_0x2b8b4e)['then'](function(_0x1b141e){var _0xf42ac7=_['groupBy'](_0x1b141e,_0x0a35('0xaf'));var _0x2f65aa=[];_0x45742d[_0x0a35('0x39')](function(_0x4f7f8c){_0x2f65aa[_0x0a35('0x3a')](updateSmsInteraction(_0x4f7f8c,_0xb9d0f3,_0xf42ac7));});return BPromise[_0x0a35('0xb0')](_0x2f65aa);});});})[_0x0a35('0x3b')](function(_0x1139a1){_0x4ad06c[_0x0a35('0xb1')]=_0x1139a1;return _0x4ad06c;})[_0x0a35('0x3b')](respondWithFilteredResult(_0x5ec3db,_0x54fdbd))[_0x0a35('0x3c')](handleError(_0x5ec3db,null));};exports[_0x0a35('0xb2')]=function(_0x37885b,_0x4a8d2a){var _0x15f005={'raw':![],'where':{'id':_0x37885b[_0x0a35('0xb3')]['id']}},_0x87bb6d={};_0x87bb6d[_0x0a35('0x43')]=_['keys'](db[_0x0a35('0x3e')][_0x0a35('0x3f')]);_0x87bb6d[_0x0a35('0x44')]=_[_0x0a35('0x45')](_0x37885b[_0x0a35('0x44')]);_0x87bb6d[_0x0a35('0x46')]=_[_0x0a35('0xb4')](_0x87bb6d[_0x0a35('0x43')],_0x87bb6d[_0x0a35('0x44')]);_0x15f005['attributes']=_['intersection'](_0x87bb6d[_0x0a35('0x43')],qs[_0x0a35('0x48')](_0x37885b[_0x0a35('0x44')][_0x0a35('0x48')]));_0x15f005[_0x0a35('0x47')]=_0x15f005[_0x0a35('0x47')]['length']?_0x15f005[_0x0a35('0x47')]:_0x87bb6d[_0x0a35('0x43')];if(_0x37885b[_0x0a35('0x44')][_0x0a35('0xb5')]){_0x15f005['include']=[{'all':!![]}];}_0x15f005=_[_0x0a35('0x2e')]({},_0x15f005,_0x37885b[_0x0a35('0xb6')]);return db['SmsInteraction'][_0x0a35('0x66')](_0x15f005)['then'](handleEntityNotFound(_0x4a8d2a,null))[_0x0a35('0x3b')](respondWithResult(_0x4a8d2a,null))[_0x0a35('0x3c')](handleError(_0x4a8d2a,null));};exports['create']=function(_0x25156c,_0x3cbd1c){return db[_0x0a35('0x3e')]['create'](_0x25156c[_0x0a35('0x2f')],{})['then'](respondWithResult(_0x3cbd1c,0xc9))[_0x0a35('0x3c')](handleError(_0x3cbd1c,null));};exports[_0x0a35('0x27')]=function(_0x31ef67,_0x67c770){if(_0x31ef67[_0x0a35('0x2f')]['id']){delete _0x31ef67[_0x0a35('0x2f')]['id'];}return db[_0x0a35('0x3e')]['find']({'where':{'id':_0x31ef67[_0x0a35('0xb3')]['id']}})[_0x0a35('0x3b')](handleEntityNotFound(_0x67c770,null))[_0x0a35('0x3b')](saveUpdates(_0x31ef67['body'],null))[_0x0a35('0x3b')](respondWithResult(_0x67c770,null))[_0x0a35('0x3c')](handleError(_0x67c770,null));};exports[_0x0a35('0x28')]=function(_0x35ff59,_0x3a735d){return db[_0x0a35('0x3e')][_0x0a35('0x66')]({'where':{'id':_0x35ff59[_0x0a35('0xb3')]['id']}})['then'](handleEntityNotFound(_0x3a735d,null))[_0x0a35('0x3b')](removeEntity(_0x3a735d,null))['catch'](handleError(_0x3a735d,null));};exports[_0x0a35('0xb7')]=function(_0x1591fd,_0x37fb4f){return db[_0x0a35('0x3e')][_0x0a35('0xb7')]()[_0x0a35('0x3b')](respondWithResult(_0x37fb4f,null))['catch'](handleError(_0x37fb4f,null));};exports['addMessage']=function(_0x1c459c,_0x561ce3,_0x293029){return db['SmsMessage'][_0x0a35('0x66')]({'where':{'id':_0x1c459c[_0x0a35('0xb3')]['id']}})['then'](handleEntityNotFound(_0x561ce3,null))['then'](function(_0x43a8d1){if(_0x43a8d1){return _0x43a8d1[_0x0a35('0xb8')](_0x1c459c['body'][_0x0a35('0xb9')],_[_0x0a35('0xba')](_0x1c459c[_0x0a35('0x2f')],[_0x0a35('0xb9'),'id'])||{});}})[_0x0a35('0x3b')](respondWithResult(_0x561ce3,null))['catch'](handleError(_0x561ce3,null));};exports['getMessages']=function(_0x4296fb,_0x31bf1c,_0x3c090a){var _0x4b6da3={'raw':![],'where':{}};var _0x5d8c1a={};var _0x352abf={'count':0x0,'rows':[]};return db[_0x0a35('0x3e')][_0x0a35('0xbb')]({'where':{'id':_0x4296fb[_0x0a35('0xb3')]['id']}})[_0x0a35('0x3b')](handleEntityNotFound(_0x31bf1c,null))['then'](function(_0xe31560){if(_0xe31560){_0x5d8c1a[_0x0a35('0x43')]=_[_0x0a35('0x45')](db[_0x0a35('0xbc')][_0x0a35('0x3f')]);_0x5d8c1a[_0x0a35('0x44')]=_[_0x0a35('0x45')](_0x4296fb[_0x0a35('0x44')]);_0x5d8c1a[_0x0a35('0x46')]=_[_0x0a35('0xb4')](_0x5d8c1a[_0x0a35('0x43')],_0x5d8c1a[_0x0a35('0x44')]);_0x4b6da3[_0x0a35('0x47')]=_['intersection'](_0x5d8c1a[_0x0a35('0x43')],qs[_0x0a35('0x48')](_0x4296fb[_0x0a35('0x44')]['fields']));_0x4b6da3[_0x0a35('0x47')]=_0x4b6da3[_0x0a35('0x47')]['length']?_0x4b6da3[_0x0a35('0x47')]:_0x5d8c1a[_0x0a35('0x43')];if(!_0x4296fb[_0x0a35('0x44')]['hasOwnProperty'](_0x0a35('0x4b'))){_0x4b6da3[_0x0a35('0x1e')]=qs['limit'](_0x4296fb[_0x0a35('0x44')][_0x0a35('0x1e')]);_0x4b6da3[_0x0a35('0x21')]=qs[_0x0a35('0x21')](_0x4296fb[_0x0a35('0x44')][_0x0a35('0x21')]);}_0x4b6da3[_0x0a35('0x4c')]=qs['sort'](_0x4296fb[_0x0a35('0x44')]['sort']);_0x4b6da3[_0x0a35('0x7e')]=qs['filters'](_[_0x0a35('0x4e')](_0x4296fb[_0x0a35('0x44')],_0x5d8c1a[_0x0a35('0x46')]));_0x4b6da3[_0x0a35('0x7e')]['SmsInteractionId']=_0xe31560['id'];if(_0x4296fb[_0x0a35('0x44')][_0x0a35('0x8b')]){_0x4b6da3['where']=_[_0x0a35('0x2e')](_0x4b6da3['where'],{'$or':_[_0x0a35('0x35')](_0x4b6da3[_0x0a35('0x47')],function(_0x14c56f){var _0x3a4628={};_0x3a4628[_0x14c56f]={'$like':'%'+_0x4296fb[_0x0a35('0x44')][_0x0a35('0x8b')]+'%'};return _0x3a4628;})});}if(_0x4296fb['query'][_0x0a35('0x81')]){var _0x44cfc3=_0x4296fb['query']['$gte'][_0x0a35('0x38')](',');var _0x477350={};_0x477350[_0x44cfc3[0x0]]={'$gte':moment(_0x44cfc3[0x1])[_0x0a35('0xbd')](_0x0a35('0xbe'))};_0x4b6da3[_0x0a35('0x7e')]=_[_0x0a35('0x2e')](_0x4b6da3['where'],_0x477350);}_0x4b6da3=_[_0x0a35('0x2e')]({},_0x4b6da3,_0x4296fb[_0x0a35('0xb6')]);return db['SmsMessage'][_0x0a35('0x20')]({'where':_0x4b6da3[_0x0a35('0x7e')]})[_0x0a35('0x3b')](function(_0x1aa9b9){_0x352abf[_0x0a35('0x20')]=_0x1aa9b9;if(_0x4296fb[_0x0a35('0x44')][_0x0a35('0xb5')]){_0x4b6da3['include']=[{'all':!![]}];}return db[_0x0a35('0xbc')]['findAll'](_0x4b6da3);})[_0x0a35('0x3b')](function(_0x31ea8e){_0x352abf[_0x0a35('0xb1')]=_0x31ea8e;return _0x352abf;});}})[_0x0a35('0x3b')](respondWithFilteredResult(_0x31bf1c,_0x4b6da3))[_0x0a35('0x3c')](handleError(_0x31bf1c,null));};exports[_0x0a35('0xbf')]=function(_0x3bd317,_0x15cfca,_0x2fd69a){return db[_0x0a35('0x3e')][_0x0a35('0x66')]({'where':{'id':_0x3bd317['params']['id']}})['then'](handleEntityNotFound(_0x15cfca,null))[_0x0a35('0x3b')](function(_0x3d7ca5){if(_0x3d7ca5){return _0x3d7ca5['setTags'](_0x3bd317[_0x0a35('0x2f')][_0x0a35('0xb9')],_['omit'](_0x3bd317[_0x0a35('0x2f')],[_0x0a35('0xb9'),'id'])||{})[_0x0a35('0xc0')](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a35('0x2b'),_0x0a35('0xc1')],'where':{'id':_0x3bd317[_0x0a35('0x2f')][_0x0a35('0xb9')]}});})[_0x0a35('0x3b')](function(_0x597b29){socket[_0x0a35('0xc2')](_0x0a35('0xc3'),{'id':Number(_0x3bd317['params']['id']),'tags':_0x597b29||[]});return{'id':Number(_0x3bd317[_0x0a35('0xb3')]['id']),'tags':_0x597b29||[]};});}})[_0x0a35('0x3b')](respondWithResult(_0x15cfca,null))[_0x0a35('0x3c')](handleError(_0x15cfca,null));};exports['removeTags']=function(_0x3ce76d,_0x355cf9,_0x26c93d){return db['SmsInteraction'][_0x0a35('0x66')]({'where':{'id':_0x3ce76d[_0x0a35('0xb3')]['id']}})[_0x0a35('0x3b')](handleEntityNotFound(_0x355cf9,null))[_0x0a35('0x3b')](function(_0x5beacc){if(_0x5beacc){return _0x5beacc['removeTags'](_0x3ce76d['query'][_0x0a35('0xb9')]);}})[_0x0a35('0x3b')](respondWithStatusCode(_0x355cf9,null))['catch'](handleError(_0x355cf9,null));};exports[_0x0a35('0xc4')]=function(_0x317221,_0xd654e7){var _0x2549e6=moment()['unix']()[_0x0a35('0x9e')]();var _0xf89b18=path[_0x0a35('0xc5')](config[_0x0a35('0xc6')],_0x0a35('0xc7'),'files',_0x0a35('0xc8'));var _0x206803=path['join'](config[_0x0a35('0xc6')],_0x0a35('0xc7'),_0x0a35('0xc9'),'attachments');var _0x206cb3=path[_0x0a35('0xc5')](_0xf89b18,_0x2549e6);var _0x1b684d=util[_0x0a35('0xbd')](_0x0a35('0xca'),_0x317221['params']['id'],_0x2549e6);var _0x92021c=path['join'](_0xf89b18,_0x1b684d);var _0x772832=[];_0x772832[_0x0a35('0x3a')]({'model':db[_0x0a35('0xcb')],'as':_0x0a35('0xcb'),'attributes':['id','fullname'],'raw':!![]});_0x772832['push']({'model':db[_0x0a35('0xcc')],'as':'Contact','attributes':['id',_0x0a35('0xcd'),'lastName'],'raw':!![]});var _0x12a2c1=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x0a35('0x2f'),_0x0a35('0xce'),_0x0a35('0xcf'),_0x0a35('0xd0'),'read'],'include':_0x772832}];_0x12a2c1[_0x0a35('0x3a')]({'model':db[_0x0a35('0xd1')],'as':_0x0a35('0xd2'),'attributes':['id','name']});_0x12a2c1[_0x0a35('0x3a')]({'model':db[_0x0a35('0xcb')],'as':_0x0a35('0xd3'),'attributes':['id',_0x0a35('0xd4')]});return db[_0x0a35('0x3e')][_0x0a35('0x66')]({'where':{'id':_0x317221[_0x0a35('0xb3')]['id']},'include':_0x12a2c1})[_0x0a35('0x3b')](handleEntityNotFound(_0xd654e7,null))[_0x0a35('0x3b')](function(_0x5af962){if(_0x5af962){var _0x3d13a3=_0x5af962[_0x0a35('0xd5')]({'plain':!![]});fs[_0x0a35('0xd6')](_0x206cb3);var _0x54b5fe={'channel':_0x0a35('0xd7'),'account':_0x3d13a3[_0x0a35('0xd2')]['name'],'agent':_0x3d13a3[_0x0a35('0xd3')]?_0x3d13a3[_0x0a35('0xd3')][_0x0a35('0xd4')]:_0x0a35('0xd8'),'createdAt':moment(_0x3d13a3[_0x0a35('0xce')])[_0x0a35('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a35('0x9e')](),'closedAt':_0x3d13a3[_0x0a35('0xd9')]?moment(_0x3d13a3[_0x0a35('0xda')])[_0x0a35('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a35('0x9e')]():'','disposition':_0x3d13a3[_0x0a35('0xdb')],'messages':_(_0x3d13a3[_0x0a35('0xdc')])[_0x0a35('0x8b')]({'secret':![]})[_0x0a35('0x35')](function(_0x191a5f){return{'date':moment(_0x191a5f[_0x0a35('0xce')])[_0x0a35('0xbd')](_0x0a35('0xbe'))[_0x0a35('0x9e')](),'sender':_0x191a5f['direction']==='out'?_0x191a5f[_0x0a35('0xcb')]?_0x191a5f[_0x0a35('0xcb')]['fullname']:_0x0a35('0xdd'):_0x191a5f['Contact'][_0x0a35('0xcd')]+(_0x191a5f['Contact'][_0x0a35('0xde')]?'\x20'+_0x191a5f[_0x0a35('0x6c')]['lastName']:''),'body':_0x191a5f[_0x0a35('0x2f')],'direction':_0x191a5f[_0x0a35('0xcf')]===_0x0a35('0xdf')?'A':'C','secret':_0x191a5f[_0x0a35('0xd0')],'read':_0x191a5f[_0x0a35('0x87')]};})[_0x0a35('0x68')]()};return ejs['renderFile'](path[_0x0a35('0xc5')](config['root'],_0x0a35('0xc7'),_0x0a35('0xe0'),_0x0a35('0xe1')),{'interaction':_0x54b5fe})[_0x0a35('0x3b')](function(_0x327da8){var _0x2f847b=path[_0x0a35('0xc5')](_0x206cb3,_0x0a35('0xe2')+_0x3d13a3['id']+'-'+_0x2549e6+_0x0a35('0xe3'));var _0x3b8ccc={'path':_0x2f847b,'channel':_0x0a35('0xd7'),'interactionId':_0x3d13a3['id']};return pdf[_0x0a35('0xe4')](_0x327da8,_0x3b8ccc);})[_0x0a35('0x3b')](function(){return new BPromise(function(_0x3bd567,_0x4aad11){zipdir(_0x206cb3,{'saveTo':_0x92021c},function(_0x1e126c,_0x44c7f4){if(_0x1e126c)return _0x4aad11(_0x1e126c);return _0x3bd567(_0x44c7f4);});})[_0x0a35('0x3b')](function(){return new BPromise(function(_0x9dd966,_0x504d9a){rimraf(_0x206cb3,function(_0x2d2f19){if(_0x2d2f19)_0x504d9a(_0x2d2f19);return _0x9dd966();});});})[_0x0a35('0x3b')](function(){return _0xd654e7[_0x0a35('0xc4')](_0x92021c,_0x1b684d,function(_0x356ba6){if(_0x356ba6){console[_0x0a35('0xe5')](_0x0a35('0xe6'),_0x356ba6);}else{fs['unlinkSync'](_0x92021c);}});});});}else{return _0xd654e7[_0x0a35('0x1b')](0xc8);}})['catch'](handleError(_0xd654e7,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 013c27c..3849e91 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 _0xe14b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','getUsers','then','setDataValue','findAll'];(function(_0xe2326f,_0x102fe6){var _0x30122d=function(_0xd3fb7){while(--_0xd3fb7){_0xe2326f['push'](_0xe2326f['shift']());}};_0x30122d(++_0x102fe6);}(_0xe14b,0x93));var _0xbe14=function(_0x25b42d,_0x47227e){_0x25b42d=_0x25b42d-0x0;var _0x1ee4e4=_0xe14b[_0x25b42d];return _0x1ee4e4;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var SmsInteraction=require(_0xbe14('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xbe14('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xbe14('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbe14('0x4'),'afterDestroy':'remove'};function emitEvent(_0x496c04){return function(_0x1833e3,_0x2d1a4a,_0x1fe204){_0x1833e3[_0xbe14('0x5')]({'attributes':['id'],'raw':!![]})[_0xbe14('0x6')](function(_0x39387e){_0x1833e3[_0xbe14('0x7')]('Users',_0x39387e['map'](function(_0x496063){return{'id':_0x496063['id']};}));return SmsMessage[_0xbe14('0x8')]({'where':{'SmsInteractionId':_0x1833e3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbe14('0x6')](function(_0xd68cd7){_0x1833e3[_0xbe14('0x7')]('unreadMessages',_0xd68cd7['length']);SmsInteractionEvents[_0xbe14('0x9')](_0x496c04+':'+_0x1833e3['id'],_0x1833e3);SmsInteractionEvents[_0xbe14('0x9')](_0x496c04,_0x1833e3);_0x1fe204(null);})['catch'](_0x1fe204(null));};}for(var e in events){if(events[_0xbe14('0xa')](e)){var event=events[e];SmsInteraction[_0xbe14('0xb')](e,emitEvent(event));}}module[_0xbe14('0xc')]=SmsInteractionEvents; \ No newline at end of file +var _0x207c=['then','Users','map','setDataValue','unreadMessages','length','emit','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers'];(function(_0x4032e3,_0x6d6449){var _0x34f51a=function(_0x3f77e4){while(--_0x3f77e4){_0x4032e3['push'](_0x4032e3['shift']());}};_0x34f51a(++_0x6d6449);}(_0x207c,0x1e8));var _0xc207=function(_0x3ff59d,_0x209599){_0x3ff59d=_0x3ff59d-0x0;var _0x221f59=_0x207c[_0x3ff59d];return _0x221f59;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xc207('0x0'))['db'][_0xc207('0x1')];var SmsMessage=require(_0xc207('0x0'))['db'][_0xc207('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc207('0x3')](0x0);var events={'afterCreate':_0xc207('0x4'),'afterUpdate':_0xc207('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38ff02){return function(_0x59bc89,_0x5a727b,_0x55023e){_0x59bc89[_0xc207('0x6')]({'attributes':['id'],'raw':!![]})[_0xc207('0x7')](function(_0x3395e4){_0x59bc89['setDataValue'](_0xc207('0x8'),_0x3395e4[_0xc207('0x9')](function(_0x3c579f){return{'id':_0x3c579f['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x59bc89['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc207('0x7')](function(_0x817576){_0x59bc89[_0xc207('0xa')](_0xc207('0xb'),_0x817576[_0xc207('0xc')]);SmsInteractionEvents[_0xc207('0xd')](_0x38ff02+':'+_0x59bc89['id'],_0x59bc89);SmsInteractionEvents['emit'](_0x38ff02,_0x59bc89);_0x55023e(null);})['catch'](_0x55023e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc207('0xe')](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 50a55ed..91535c0 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 _0x09eb=['util','../../config/logger','moment','bluebird','path','rimraf','exports','SmsInteraction','sms_interactions','closed','closedAt','lodash'];(function(_0x39553b,_0x15d6ac){var _0x3cd31d=function(_0x2ea569){while(--_0x2ea569){_0x39553b['push'](_0x39553b['shift']());}};_0x3cd31d(++_0x15d6ac);}(_0x09eb,0x197));var _0xb09e=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x09eb[_0x2a8860];return _0x2f47a4;};'use strict';var _=require(_0xb09e('0x0'));var util=require(_0xb09e('0x1'));var logger=require(_0xb09e('0x2'))('api');var moment=require(_0xb09e('0x3'));var BPromise=require(_0xb09e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb09e('0x5'));var rimraf=require(_0xb09e('0x6'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xb09e('0x7')]=function(_0x5f4ce3,_0x3fd0e0){return _0x5f4ce3['define'](_0xb09e('0x8'),attributes,{'tableName':_0xb09e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf2f73d,_0x525550,_0x2b62e8){if(_0xf2f73d['changed'](_0xb09e('0xa'))){_0xf2f73d[_0xb09e('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2b62e8(null,_0xf2f73d);}}});}; \ No newline at end of file +var _0x6fed=['exports','define','SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x6fed,0x1e3));var _0xd6fe=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6fed[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xd6fe('0x0'));var util=require(_0xd6fe('0x1'));var logger=require(_0xd6fe('0x2'))(_0xd6fe('0x3'));var moment=require(_0xd6fe('0x4'));var BPromise=require(_0xd6fe('0x5'));var rp=require(_0xd6fe('0x6'));var fs=require('fs');var path=require(_0xd6fe('0x7'));var rimraf=require(_0xd6fe('0x8'));var config=require(_0xd6fe('0x9'));var attributes=require(_0xd6fe('0xa'));module[_0xd6fe('0xb')]=function(_0x2a66c0,_0x34dea2){return _0x2a66c0[_0xd6fe('0xc')](_0xd6fe('0xd'),attributes,{'tableName':_0xd6fe('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20020c,_0x123643,_0x62959b){if(_0x20020c[_0xd6fe('0xf')]('closed')){_0x20020c[_0xd6fe('0x10')]=moment()[_0xd6fe('0x11')](_0xd6fe('0x12'));}_0x62959b(null,_0x20020c);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index be5a8e5..5883bba 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 _0xdb14=['error','code','message','request\x20sent','result','UpdateSmsInteraction','update','body','options','attributes','stringify','catch','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x52b805,_0x4b5da6){var _0x3ed152=function(_0x1d59ac){while(--_0x1d59ac){_0x52b805['push'](_0x52b805['shift']());}};_0x3ed152(++_0x4b5da6);}(_0xdb14,0x68));var _0x4db1=function(_0x24c564,_0x49afff){_0x24c564=_0x24c564-0x0;var _0x3a5538=_0xdb14[_0x24c564];return _0x3a5538;};'use strict';var _=require(_0x4db1('0x0'));var util=require('util');var moment=require(_0x4db1('0x1'));var BPromise=require(_0x4db1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4db1('0x3'));var db=require(_0x4db1('0x4'))['db'];var utils=require(_0x4db1('0x5'));var logger=require(_0x4db1('0x6'))(_0x4db1('0x7'));var config=require(_0x4db1('0x8'));var jayson=require(_0x4db1('0x9'));var client=jayson[_0x4db1('0xa')]['http']({'port':0x232a});config[_0x4db1('0xb')]=_['defaults'](config[_0x4db1('0xb')],{'host':_0x4db1('0xc'),'port':0x18eb});var socket=require(_0x4db1('0xd'))(new Redis(config[_0x4db1('0xb')]));require(_0x4db1('0xe'))[_0x4db1('0xf')](socket);function respondWithRpcPromise(_0x40075d,_0x1d4f0e,_0x481d5a){return new BPromise(function(_0x2eb36b,_0x3721c9){return client[_0x4db1('0x10')](_0x40075d,_0x481d5a)[_0x4db1('0x11')](function(_0x1cefb4){logger[_0x4db1('0x12')](_0x4db1('0x13'),_0x1d4f0e,'request\x20sent');logger[_0x4db1('0x14')](_0x4db1('0x15'),_0x1d4f0e,'request\x20sent',JSON['stringify'](_0x1cefb4));if(_0x1cefb4[_0x4db1('0x16')]){if(_0x1cefb4[_0x4db1('0x16')][_0x4db1('0x17')]===0x1f4){logger[_0x4db1('0x16')](_0x4db1('0x13'),_0x1d4f0e,_0x1cefb4[_0x4db1('0x16')][_0x4db1('0x18')]);return _0x3721c9(_0x1cefb4['error']['message']);}logger[_0x4db1('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x1d4f0e,_0x1cefb4[_0x4db1('0x16')][_0x4db1('0x18')]);return _0x2eb36b(_0x1cefb4[_0x4db1('0x16')][_0x4db1('0x18')]);}else{logger[_0x4db1('0x12')](_0x4db1('0x13'),_0x1d4f0e,_0x4db1('0x19'));_0x2eb36b(_0x1cefb4[_0x4db1('0x1a')][_0x4db1('0x18')]);}})['catch'](function(_0x351b6c){logger[_0x4db1('0x16')](_0x4db1('0x13'),_0x1d4f0e,_0x351b6c);_0x3721c9(_0x351b6c);});});}exports[_0x4db1('0x1b')]=function(_0x40ea7b){var _0x280833=this;return new Promise(function(_0x135907,_0x1166c4){return db['SmsInteraction'][_0x4db1('0x1c')](_0x40ea7b[_0x4db1('0x1d')],{'raw':_0x40ea7b[_0x4db1('0x1e')]?_0x40ea7b[_0x4db1('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40ea7b[_0x4db1('0x1e')]?_0x40ea7b[_0x4db1('0x1e')]['where']||null:null,'attributes':_0x40ea7b['options']?_0x40ea7b[_0x4db1('0x1e')][_0x4db1('0x1f')]||null:null,'limit':_0x40ea7b[_0x4db1('0x1e')]?_0x40ea7b[_0x4db1('0x1e')]['limit']||null:null})[_0x4db1('0x11')](function(_0x31b3b1){logger['info'](_0x4db1('0x1b'),_0x40ea7b);logger[_0x4db1('0x14')](_0x4db1('0x1b'),_0x40ea7b,JSON[_0x4db1('0x20')](_0x31b3b1));_0x135907(_0x31b3b1);})[_0x4db1('0x21')](function(_0x9881e5){logger[_0x4db1('0x16')](_0x4db1('0x1b'),_0x9881e5[_0x4db1('0x18')],_0x40ea7b);_0x1166c4(_0x280833[_0x4db1('0x16')](0x1f4,_0x9881e5['message']));});});};exports[_0x4db1('0x22')]=function(_0x83e9a4){return new Promise(function(_0x2063e9,_0x59c07f){return db[_0x4db1('0x23')][_0x4db1('0x24')]({'where':_0x83e9a4[_0x4db1('0x1e')]?_0x83e9a4[_0x4db1('0x1e')]['where']||null:null})['then'](function(_0x4507a2){if(_0x4507a2){return _0x4507a2[_0x4db1('0x25')](_0x83e9a4[_0x4db1('0x1d')][_0x4db1('0x26')],_[_0x4db1('0x27')](_0x83e9a4[_0x4db1('0x1d')],[_0x4db1('0x26'),'id'])||{});}})[_0x4db1('0x28')](function(_0x40a219){logger['info']('AddTags',_0x83e9a4);logger[_0x4db1('0x14')]('AddTags',_0x83e9a4,JSON[_0x4db1('0x20')](_0x40a219));_0x2063e9(_0x40a219);})[_0x4db1('0x21')](function(_0x1d5aab){logger[_0x4db1('0x16')](_0x4db1('0x29'),_0x1d5aab[_0x4db1('0x18')],_0x83e9a4);_0x59c07f(_this[_0x4db1('0x16')](0x1f4,_0x1d5aab[_0x4db1('0x18')]));});});}; \ No newline at end of file +var _0x3216=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateSmsInteraction','options','where','attributes','limit','catch','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','debug'];(function(_0x2e11a2,_0x12e557){var _0x1d6759=function(_0x1bfe9f){while(--_0x1bfe9f){_0x2e11a2['push'](_0x2e11a2['shift']());}};_0x1d6759(++_0x12e557);}(_0x3216,0x78));var _0x6321=function(_0x25dc1c,_0x5e66b8){_0x25dc1c=_0x25dc1c-0x0;var _0x2fee52=_0x3216[_0x25dc1c];return _0x2fee52;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6321('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6321('0x1'))['db'];var utils=require(_0x6321('0x2'));var logger=require(_0x6321('0x3'))(_0x6321('0x4'));var config=require('../../config/environment');var jayson=require(_0x6321('0x5'));var client=jayson[_0x6321('0x6')][_0x6321('0x7')]({'port':0x232a});config['redis']=_[_0x6321('0x8')](config[_0x6321('0x9')],{'host':_0x6321('0xa'),'port':0x18eb});var socket=require(_0x6321('0xb'))(new Redis(config[_0x6321('0x9')]));require(_0x6321('0xc'))[_0x6321('0xd')](socket);function respondWithRpcPromise(_0x1cb968,_0x3d55c6,_0x3be7a5){return new BPromise(function(_0x4a14b6,_0xadaffa){return client[_0x6321('0xe')](_0x1cb968,_0x3be7a5)[_0x6321('0xf')](function(_0x51e980){logger[_0x6321('0x10')](_0x6321('0x11'),_0x3d55c6,_0x6321('0x12'));logger['debug'](_0x6321('0x13'),_0x3d55c6,_0x6321('0x12'),JSON[_0x6321('0x14')](_0x51e980));if(_0x51e980[_0x6321('0x15')]){if(_0x51e980['error'][_0x6321('0x16')]===0x1f4){logger[_0x6321('0x15')](_0x6321('0x11'),_0x3d55c6,_0x51e980[_0x6321('0x15')][_0x6321('0x17')]);return _0xadaffa(_0x51e980['error'][_0x6321('0x17')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x3d55c6,_0x51e980[_0x6321('0x15')][_0x6321('0x17')]);return _0x4a14b6(_0x51e980[_0x6321('0x15')]['message']);}else{logger[_0x6321('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x3d55c6,_0x6321('0x12'));_0x4a14b6(_0x51e980[_0x6321('0x18')][_0x6321('0x17')]);}})['catch'](function(_0x3428aa){logger[_0x6321('0x15')](_0x6321('0x11'),_0x3d55c6,_0x3428aa);_0xadaffa(_0x3428aa);});});}exports[_0x6321('0x19')]=function(_0x36d4ad){var _0x668bf6=this;return new Promise(function(_0x366a87,_0x390641){return db['SmsInteraction']['update'](_0x36d4ad['body'],{'raw':_0x36d4ad[_0x6321('0x1a')]?_0x36d4ad[_0x6321('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d4ad[_0x6321('0x1a')]?_0x36d4ad['options'][_0x6321('0x1b')]||null:null,'attributes':_0x36d4ad[_0x6321('0x1a')]?_0x36d4ad[_0x6321('0x1a')][_0x6321('0x1c')]||null:null,'limit':_0x36d4ad[_0x6321('0x1a')]?_0x36d4ad[_0x6321('0x1a')][_0x6321('0x1d')]||null:null})[_0x6321('0xf')](function(_0x3c5987){logger['info'](_0x6321('0x19'),_0x36d4ad);logger['debug'](_0x6321('0x19'),_0x36d4ad,JSON[_0x6321('0x14')](_0x3c5987));_0x366a87(_0x3c5987);})[_0x6321('0x1e')](function(_0x442d58){logger[_0x6321('0x15')](_0x6321('0x19'),_0x442d58['message'],_0x36d4ad);_0x390641(_0x668bf6[_0x6321('0x15')](0x1f4,_0x442d58[_0x6321('0x17')]));});});};exports[_0x6321('0x1f')]=function(_0x59a6ce){return new Promise(function(_0x26ed3b,_0x316880){return db['SmsInteraction'][_0x6321('0x20')]({'where':_0x59a6ce[_0x6321('0x1a')]?_0x59a6ce[_0x6321('0x1a')][_0x6321('0x1b')]||null:null})[_0x6321('0xf')](function(_0x39254b){if(_0x39254b){return _0x39254b[_0x6321('0x21')](_0x59a6ce[_0x6321('0x22')][_0x6321('0x23')],_[_0x6321('0x24')](_0x59a6ce[_0x6321('0x22')],[_0x6321('0x23'),'id'])||{});}})[_0x6321('0x25')](function(_0x107dba){logger['info'](_0x6321('0x26'),_0x59a6ce);logger[_0x6321('0x27')]('AddTags',_0x59a6ce,JSON[_0x6321('0x14')](_0x107dba));_0x26ed3b(_0x107dba);})['catch'](function(_0x12ba49){logger[_0x6321('0x15')]('AddTags',_0x12ba49[_0x6321('0x17')],_0x59a6ce);_0x316880(_this[_0x6321('0x15')](0x1f4,_0x12ba49[_0x6321('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a73dfb6..9200c29 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 _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0xbe3839,_0x4829c5){var _0x13717f=function(_0x4b0652){while(--_0x4b0652){_0xbe3839['push'](_0xbe3839['shift']());}};_0x13717f(++_0x4829c5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x4120ce,_0x242aee){var _0x21b5ef=function(_0x46463e){while(--_0x46463e){_0x4120ce['push'](_0x4120ce['shift']());}};_0x21b5ef(++_0x242aee);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0337186..6e5cd31 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 _0xe85c=['get','/:id','show','post','tracked','sms','smsmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','/describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe85c,0xb2));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce85('0x0'));var util=require(_0xce85('0x1'));var path=require(_0xce85('0x2'));var timeout=require('connect-timeout');var express=require(_0xce85('0x3'));var router=express[_0xce85('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xce85('0x5'));var config=require(_0xce85('0x6'));var controller=require(_0xce85('0x7'));router['get']('/',auth[_0xce85('0x8')](),controller[_0xce85('0x9')]);router['get'](_0xce85('0xa'),auth[_0xce85('0x8')](),controller['describe']);router[_0xce85('0xb')](_0xce85('0xc'),auth[_0xce85('0x8')](),controller[_0xce85('0xd')]);router[_0xce85('0xe')]('/',auth[_0xce85('0x8')](),interaction[_0xce85('0xf')](_0xce85('0x10'),_0xce85('0x11')),controller[_0xce85('0x12')]);router[_0xce85('0xe')]('/:id/status',controller['status']);router[_0xce85('0x13')](_0xce85('0xc'),auth[_0xce85('0x8')](),controller[_0xce85('0x14')]);router['put'](_0xce85('0x15'),auth[_0xce85('0x8')](),controller[_0xce85('0x16')]);router[_0xce85('0x13')](_0xce85('0x17'),auth[_0xce85('0x8')](),controller[_0xce85('0x18')]);router[_0xce85('0x19')](_0xce85('0xc'),auth[_0xce85('0x8')](),controller['destroy']);module[_0xce85('0x1a')]=router; \ No newline at end of file +var _0x0d2e=['post','sms','/:id/status','status','put','/:id','accept','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','show'];(function(_0x314956,_0x3380da){var _0x2ebce0=function(_0x1e174a){while(--_0x1e174a){_0x314956['push'](_0x314956['shift']());}};_0x2ebce0(++_0x3380da);}(_0x0d2e,0x15b));var _0xe0d2=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x0d2e[_0x412e27];return _0x53da42;};'use strict';var multer=require(_0xe0d2('0x0'));var util=require(_0xe0d2('0x1'));var path=require('path');var timeout=require(_0xe0d2('0x2'));var express=require(_0xe0d2('0x3'));var router=express[_0xe0d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe0d2('0x5'));var interaction=require(_0xe0d2('0x6'));var config=require(_0xe0d2('0x7'));var controller=require(_0xe0d2('0x8'));router[_0xe0d2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe0d2('0x9')](_0xe0d2('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xe0d2('0x9')]('/:id',auth[_0xe0d2('0xb')](),controller[_0xe0d2('0xc')]);router[_0xe0d2('0xd')]('/',auth[_0xe0d2('0xb')](),interaction['tracked'](_0xe0d2('0xe'),'smsmessage:create'),controller['create']);router[_0xe0d2('0xd')](_0xe0d2('0xf'),controller[_0xe0d2('0x10')]);router[_0xe0d2('0x11')](_0xe0d2('0x12'),auth[_0xe0d2('0xb')](),controller['update']);router[_0xe0d2('0x11')]('/:id/accept',auth[_0xe0d2('0xb')](),controller[_0xe0d2('0x13')]);router[_0xe0d2('0x11')](_0xe0d2('0x14'),auth[_0xe0d2('0xb')](),controller['reject']);router[_0xe0d2('0x15')](_0xe0d2('0x12'),auth[_0xe0d2('0xb')](),controller[_0xe0d2('0x16')]);module[_0xe0d2('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 93f5372..9a61543 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 _0xebf8=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x48f5a0,_0x17d919){var _0x11218b=function(_0x2bfa22){while(--_0x2bfa22){_0x48f5a0['push'](_0x48f5a0['shift']());}};_0x11218b(++_0x17d919);}(_0xebf8,0x16e));var _0x8ebf=function(_0x33f149,_0x320070){_0x33f149=_0x33f149-0x0;var _0x39dd5a=_0xebf8[_0x33f149];return _0x39dd5a;};'use strict';var Sequelize=require(_0x8ebf('0x0'));module[_0x8ebf('0x1')]={'body':{'type':Sequelize[_0x8ebf('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8ebf('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8ebf('0x4')]('in',_0x8ebf('0x5')),'defaultValue':_0x8ebf('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8ebf('0x6')](0xbe)},'phone':{'type':Sequelize[_0x8ebf('0x6')]},'readAt':{'type':Sequelize[_0x8ebf('0x7')]},'secret':{'type':Sequelize[_0x8ebf('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8ebf('0x6')]},'providerResponse':{'type':Sequelize[_0x8ebf('0x2')]}}; \ No newline at end of file +var _0xb3b6=['medium','BOOLEAN','out','STRING','exports','TEXT'];(function(_0x1486ce,_0x233c7f){var _0x10a7b2=function(_0xd96f47){while(--_0xd96f47){_0x1486ce['push'](_0x1486ce['shift']());}};_0x10a7b2(++_0x233c7f);}(_0xb3b6,0x160));var _0x6b3b=function(_0x457f81,_0x3ba467){_0x457f81=_0x457f81-0x0;var _0x3f57ae=_0xb3b6[_0x457f81];return _0x3f57ae;};'use strict';var Sequelize=require('sequelize');module[_0x6b3b('0x0')]={'body':{'type':Sequelize[_0x6b3b('0x1')](_0x6b3b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6b3b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6b3b('0x4')),'defaultValue':_0x6b3b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6b3b('0x5')](0xbe)},'phone':{'type':Sequelize[_0x6b3b('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x6b3b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6b3b('0x5')]},'providerResponse':{'type':Sequelize[_0x6b3b('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index eaefd04..08d0625 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 _0x3852=['format','UserId','user','CmContact','get','SmsInteraction','update','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','redis','./smsMessage.socket','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','undefined','limit','count','offset','json','apply','reject','save','destroy','sendStatus','stack','name','render','merge','body','agent','interaction','account','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','SmsMessage','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','describe','sms-interactions','accept','readAt'];(function(_0x1affd0,_0x42efc6){var _0x3b6b73=function(_0x54a6b5){while(--_0x54a6b5){_0x1affd0['push'](_0x1affd0['shift']());}};_0x3b6b73(++_0x42efc6);}(_0x3852,0x1c8));var _0x2385=function(_0x2d61af,_0x55fb44){_0x2d61af=_0x2d61af-0x0;var _0x393d15=_0x3852[_0x2d61af];return _0x393d15;};'use strict';var emlformat=require(_0x2385('0x0'));var rimraf=require(_0x2385('0x1'));var zipdir=require(_0x2385('0x2'));var jsonpatch=require(_0x2385('0x3'));var rp=require(_0x2385('0x4'));var moment=require('moment');var BPromise=require(_0x2385('0x5'));var Mustache=require(_0x2385('0x6'));var util=require(_0x2385('0x7'));var path=require(_0x2385('0x8'));var sox=require(_0x2385('0x9'));var csv=require(_0x2385('0xa'));var ejs=require(_0x2385('0xb'));var fs=require('fs');var fs_extra=require(_0x2385('0xc'));var _=require(_0x2385('0xd'));var squel=require('squel');var crypto=require(_0x2385('0xe'));var jsforce=require(_0x2385('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2385('0xa'));var querystring=require('querystring');var Papa=require(_0x2385('0x10'));var Redis=require(_0x2385('0x11'));var authService=require(_0x2385('0x12'));var qs=require(_0x2385('0x13'));var as=require(_0x2385('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2385('0x15'))(_0x2385('0x16'));var utils=require('../../config/utils');var config=require(_0x2385('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2385('0x18'))['db'];config['redis']=_[_0x2385('0x19')](config['redis'],{'host':_0x2385('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2385('0x1b')]));require(_0x2385('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2385('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x2385('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x41b0da,_0x28cddd,_0x4cc01f,_0x40ada8){return new BPromise(function(_0x9a331d,_0x431644){var _0x536d06=_0x40ada8||client;return _0x536d06['request'](_0x41b0da,_0x4cc01f)[_0x2385('0x1e')](function(_0x2c560f){logger[_0x2385('0x1f')](_0x2385('0x20'),_0x28cddd,_0x2385('0x21'));logger['debug'](_0x2385('0x22'),_0x28cddd,_0x2385('0x21'),JSON[_0x2385('0x23')](_0x2c560f));if(_0x2c560f[_0x2385('0x24')]){if(_0x2c560f['error'][_0x2385('0x25')]===0x1f4){logger[_0x2385('0x24')](_0x2385('0x20'),_0x28cddd,_0x2c560f[_0x2385('0x24')][_0x2385('0x26')]);return _0x431644(_0x2c560f[_0x2385('0x24')][_0x2385('0x26')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x28cddd,_0x2c560f[_0x2385('0x24')][_0x2385('0x26')]);return _0x9a331d(_0x2c560f['error'][_0x2385('0x26')]);}else{logger[_0x2385('0x1f')](_0x2385('0x20'),_0x28cddd,_0x2385('0x21'));_0x9a331d(_0x2c560f['result'][_0x2385('0x26')]);}})[_0x2385('0x27')](function(_0x1ea69c){logger[_0x2385('0x24')](_0x2385('0x20'),_0x28cddd,_0x1ea69c);_0x431644(_0x1ea69c);});});}function respondWithStatusCode(_0xb19a52,_0x94cdf7){_0x94cdf7=_0x94cdf7||0xcc;return function(_0x59e6d7){if(_0x59e6d7){return _0xb19a52['sendStatus'](_0x94cdf7);}return _0xb19a52[_0x2385('0x28')](_0x94cdf7)[_0x2385('0x29')]();};}function respondWithResult(_0x53573d,_0x30dd6b){_0x30dd6b=_0x30dd6b||0xc8;return function(_0x3e4688){if(_0x3e4688){return _0x53573d['status'](_0x30dd6b)['json'](_0x3e4688);}};}function respondWithFilteredResult(_0xfc5d2c,_0x2d7b13){return function(_0x411da6){if(_0x411da6){var _0x30ff6f=typeof _0x2d7b13['offset']===_0x2385('0x2a')&&typeof _0x2d7b13[_0x2385('0x2b')]===_0x2385('0x2a');var _0x4c1623=_0x411da6[_0x2385('0x2c')];var _0x2fe5dd=_0x30ff6f?0x0:_0x2d7b13[_0x2385('0x2d')];var _0x12df1f=_0x30ff6f?_0x411da6['count']:_0x2d7b13[_0x2385('0x2d')]+_0x2d7b13[_0x2385('0x2b')];var _0xdfe7ea;if(_0x12df1f>=_0x4c1623){_0x12df1f=_0x4c1623;_0xdfe7ea=0xc8;}else{_0xdfe7ea=0xce;}_0xfc5d2c[_0x2385('0x28')](_0xdfe7ea);return _0xfc5d2c['set']('Content-Range',_0x2fe5dd+'-'+_0x12df1f+'/'+_0x4c1623)[_0x2385('0x2e')](_0x411da6);}return null;};}function patchUpdates(_0x3ebb50){return function(_0x114614){try{jsonpatch[_0x2385('0x2f')](_0x114614,_0x3ebb50,!![]);}catch(_0x2507d6){return BPromise[_0x2385('0x30')](_0x2507d6);}return _0x114614[_0x2385('0x31')]();};}function saveUpdates(_0x128878,_0x2972e4){return function(_0x2860b0){if(_0x2860b0){return _0x2860b0['update'](_0x128878)[_0x2385('0x1e')](function(_0x452bef){return _0x452bef;});}return null;};}function removeEntity(_0x52f575,_0x1b162e){return function(_0x196b48){if(_0x196b48){return _0x196b48[_0x2385('0x32')]()['then'](function(){_0x52f575['status'](0xcc)[_0x2385('0x29')]();});}};}function handleEntityNotFound(_0x4d5a56,_0x2e3c2c){return function(_0x3bd3e0){if(!_0x3bd3e0){_0x4d5a56[_0x2385('0x33')](0x194);}return _0x3bd3e0;};}function handleError(_0x2c0b4e,_0x33312d){_0x33312d=_0x33312d||0x1f4;return function(_0x22b9a4){logger['error'](_0x22b9a4[_0x2385('0x34')]);if(_0x22b9a4[_0x2385('0x35')]){delete _0x22b9a4[_0x2385('0x35')];}_0x2c0b4e[_0x2385('0x28')](_0x33312d)['send'](_0x22b9a4);};}function getMustacheRender(_0x354642,_0x10886d){return Mustache[_0x2385('0x36')](_0x354642,_[_0x2385('0x37')](_0x10886d[_0x2385('0x38')],{'contact':_0x10886d['contact'],'message':_0x10886d['message'],'agent':_0x10886d[_0x2385('0x39')],'interaction':_0x10886d[_0x2385('0x3a')],'account':_0x10886d[_0x2385('0x3b')]}))||'';}exports[_0x2385('0x3c')]=function(_0x30491b,_0x2a1923){var _0x3476bf={},_0x120725={},_0x7bfee4={'count':0x0,'rows':[]};var _0x4295ba=_[_0x2385('0x3d')](db['SmsMessage']['rawAttributes'],function(_0x32daf8){return{'name':_0x32daf8[_0x2385('0x3e')],'type':_0x32daf8[_0x2385('0x3f')][_0x2385('0x40')]};});_0x120725[_0x2385('0x41')]=_[_0x2385('0x3d')](_0x4295ba,_0x2385('0x35'));_0x120725[_0x2385('0x42')]=_[_0x2385('0x43')](_0x30491b['query']);_0x120725['filters']=_[_0x2385('0x44')](_0x120725[_0x2385('0x41')],_0x120725['query']);_0x3476bf['attributes']=_[_0x2385('0x44')](_0x120725['model'],qs[_0x2385('0x45')](_0x30491b['query'][_0x2385('0x45')]));_0x3476bf['attributes']=_0x3476bf[_0x2385('0x46')][_0x2385('0x47')]?_0x3476bf['attributes']:_0x120725[_0x2385('0x41')];if(!_0x30491b[_0x2385('0x42')][_0x2385('0x48')](_0x2385('0x49'))){_0x3476bf['limit']=qs['limit'](_0x30491b[_0x2385('0x42')][_0x2385('0x2b')]);_0x3476bf[_0x2385('0x2d')]=qs['offset'](_0x30491b[_0x2385('0x42')]['offset']);}_0x3476bf[_0x2385('0x4a')]=qs[_0x2385('0x4b')](_0x30491b['query'][_0x2385('0x4b')]);_0x3476bf['where']=qs[_0x2385('0x4c')](_[_0x2385('0x4d')](_0x30491b['query'],_0x120725[_0x2385('0x4c')]),_0x4295ba);if(_0x30491b['query'][_0x2385('0x4e')]){_0x3476bf[_0x2385('0x4f')]=_['merge'](_0x3476bf[_0x2385('0x4f')],{'$or':_[_0x2385('0x3d')](_0x4295ba,function(_0x1d3303){if(_0x1d3303[_0x2385('0x3f')]!==_0x2385('0x50')){var _0x402af2={};_0x402af2[_0x1d3303['name']]={'$like':'%'+_0x30491b[_0x2385('0x42')][_0x2385('0x4e')]+'%'};return _0x402af2;}})});}_0x3476bf=_[_0x2385('0x37')]({},_0x3476bf,_0x30491b[_0x2385('0x51')]);var _0x39b44={'where':_0x3476bf[_0x2385('0x4f')]};return db[_0x2385('0x52')][_0x2385('0x2c')](_0x39b44)['then'](function(_0x1087dd){_0x7bfee4[_0x2385('0x2c')]=_0x1087dd;if(_0x30491b[_0x2385('0x42')][_0x2385('0x53')]){_0x3476bf[_0x2385('0x54')]=[{'all':!![]}];}return db[_0x2385('0x52')][_0x2385('0x55')](_0x3476bf);})[_0x2385('0x1e')](function(_0x3e5741){_0x7bfee4[_0x2385('0x56')]=_0x3e5741;return _0x7bfee4;})[_0x2385('0x1e')](respondWithFilteredResult(_0x2a1923,_0x3476bf))[_0x2385('0x27')](handleError(_0x2a1923,null));};exports[_0x2385('0x57')]=function(_0xcc8b54,_0x3a67c6){var _0xb9a7a1={'raw':!![],'where':{'id':_0xcc8b54[_0x2385('0x58')]['id']}},_0x179bf3={};_0x179bf3[_0x2385('0x41')]=_[_0x2385('0x43')](db['SmsMessage'][_0x2385('0x59')]);_0x179bf3[_0x2385('0x42')]=_['keys'](_0xcc8b54[_0x2385('0x42')]);_0x179bf3[_0x2385('0x4c')]=_[_0x2385('0x44')](_0x179bf3['model'],_0x179bf3[_0x2385('0x42')]);_0xb9a7a1[_0x2385('0x46')]=_[_0x2385('0x44')](_0x179bf3[_0x2385('0x41')],qs[_0x2385('0x45')](_0xcc8b54[_0x2385('0x42')][_0x2385('0x45')]));_0xb9a7a1[_0x2385('0x46')]=_0xb9a7a1['attributes']['length']?_0xb9a7a1['attributes']:_0x179bf3[_0x2385('0x41')];if(_0xcc8b54[_0x2385('0x42')][_0x2385('0x53')]){_0xb9a7a1['include']=[{'all':!![]}];}_0xb9a7a1=_[_0x2385('0x37')]({},_0xb9a7a1,_0xcc8b54['options']);return db[_0x2385('0x52')][_0x2385('0x5a')](_0xb9a7a1)['then'](handleEntityNotFound(_0x3a67c6,null))[_0x2385('0x1e')](respondWithResult(_0x3a67c6,null))[_0x2385('0x27')](handleError(_0x3a67c6,null));};exports[_0x2385('0x5b')]=function(_0x50acbb,_0x2c610e){return db[_0x2385('0x52')][_0x2385('0x5b')](_0x50acbb[_0x2385('0x38')],{})['then'](respondWithResult(_0x2c610e,0xc9))[_0x2385('0x27')](handleError(_0x2c610e,null));};exports['update']=function(_0x56e2bf,_0x32f054){if(_0x56e2bf[_0x2385('0x38')]['id']){delete _0x56e2bf[_0x2385('0x38')]['id'];}return db[_0x2385('0x52')][_0x2385('0x5a')]({'where':{'id':_0x56e2bf[_0x2385('0x58')]['id']}})[_0x2385('0x1e')](handleEntityNotFound(_0x32f054,null))[_0x2385('0x1e')](saveUpdates(_0x56e2bf[_0x2385('0x38')],null))['then'](respondWithResult(_0x32f054,null))['catch'](handleError(_0x32f054,null));};exports[_0x2385('0x32')]=function(_0x4e4861,_0x4bb56a){return db[_0x2385('0x52')][_0x2385('0x5a')]({'where':{'id':_0x4e4861[_0x2385('0x58')]['id']}})[_0x2385('0x1e')](handleEntityNotFound(_0x4bb56a,null))[_0x2385('0x1e')](removeEntity(_0x4bb56a,null))[_0x2385('0x27')](handleError(_0x4bb56a,null));};exports[_0x2385('0x5c')]=function(_0x4613dc,_0x3dee63){return db[_0x2385('0x52')][_0x2385('0x5c')]()[_0x2385('0x1e')](respondWithResult(_0x3dee63,null))[_0x2385('0x27')](handleError(_0x3dee63,null));};var interaction_log=require('../../config/logger')(_0x2385('0x5d'));exports[_0x2385('0x5e')]=function(_0x52c032,_0x52404c,_0x539594){var _0x3169e5={'agent':{},'channel':'sms'};if(_0x52c032['body']['id']){delete _0x52c032[_0x2385('0x38')]['id'];}_0x52c032[_0x2385('0x38')]['read']=!![];_0x52c032[_0x2385('0x38')][_0x2385('0x5f')]=moment()[_0x2385('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x52c032['body'][_0x2385('0x61')]=_0x52c032[_0x2385('0x38')][_0x2385('0x61')]||_0x52c032[_0x2385('0x62')]['id'];_0x3169e5[_0x2385('0x39')]['id']=_0x52c032['body']['UserId'];return db[_0x2385('0x52')][_0x2385('0x5a')]({'where':{'id':_0x52c032[_0x2385('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x2385('0x63')],'as':'Contact'}]})[_0x2385('0x1e')](handleEntityNotFound(_0x52404c,null))[_0x2385('0x1e')](saveUpdates(_0x52c032[_0x2385('0x38')],null))[_0x2385('0x1e')](function(_0x4efe37){if(_0x4efe37){_0x3169e5[_0x2385('0x26')]=_0x4efe37[_0x2385('0x64')]({'plain':!![]});return db[_0x2385('0x65')]['find']({'where':{'id':_0x4efe37['SmsInteractionId']}});}return null;})[_0x2385('0x1e')](handleEntityNotFound(_0x52404c,null))[_0x2385('0x1e')](function(_0x4830e3){if(_0x4830e3){return _0x4830e3[_0x2385('0x66')]({'UserId':_0x52c032[_0x2385('0x38')][_0x2385('0x61')],'read1stAt':_[_0x2385('0x67')](_0x4830e3[_0x2385('0x68')])?moment()[_0x2385('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4fd88a){if(_0x4fd88a){_0x3169e5[_0x2385('0x3a')]=_0x4fd88a[_0x2385('0x64')]({'plain':!![]});interaction_log[_0x2385('0x1f')](_0x2385('0x69'),_0x52c032[_0x2385('0x62')]['id'],_0x52c032[_0x2385('0x62')]['name'],_0x52c032[_0x2385('0x62')][_0x2385('0x6a')],_0x3169e5[_0x2385('0x3a')]['id'],_0x52c032[_0x2385('0x38')]?JSON['stringify'](_0x52c032['body']):_0x2385('0x6b'));return respondWithRpcPromise(_0x2385('0x6c'),_0x2385('0x6d'),_0x3169e5);}return null;})[_0x2385('0x1e')](function(_0x1368ff){if(_0x1368ff){if(_0x52c032[_0x2385('0x38')][_0x2385('0x6e')]){_0x3169e5[_0x2385('0x26')][_0x2385('0x6f')]=util[_0x2385('0x60')](_0x2385('0x70'),_0x52c032[_0x2385('0x62')]['name']);_0x3169e5[_0x2385('0x26')][_0x2385('0x71')]=_0x3169e5[_0x2385('0x71')];_0x3169e5[_0x2385('0x26')][_0x2385('0x72')]=_0x2385('0x5e');return respondWithRpcPromise(_0x2385('0x73'),_0x2385('0x73'),{'event':_0x2385('0x74'),'message':_0x3169e5['message']},client9002)[_0x2385('0x1e')](function(){return _0x3169e5;});}return _0x3169e5;}return null;})[_0x2385('0x1e')](respondWithResult(_0x52404c,null))['catch'](handleError(_0x52404c,null));};var interaction_log=require(_0x2385('0x15'))(_0x2385('0x5d'));exports[_0x2385('0x30')]=function(_0x2103d5,_0x165754,_0x33eb5b){var _0x2a9c38={'agent':{},'channel':_0x2385('0x75')};if(_0x2103d5[_0x2385('0x38')]['id']){delete _0x2103d5[_0x2385('0x38')]['id'];}_0x2103d5['body'][_0x2385('0x61')]=_0x2103d5['body']['UserId']||_0x2103d5[_0x2385('0x62')]['id'];_0x2a9c38[_0x2385('0x39')]['id']=_0x2103d5['body'][_0x2385('0x61')];return db[_0x2385('0x52')][_0x2385('0x5a')]({'where':{'id':_0x2103d5[_0x2385('0x58')]['id'],'UserId':null}})[_0x2385('0x1e')](handleEntityNotFound(_0x165754,null))[_0x2385('0x1e')](function(_0x1f2579){if(_0x1f2579){_0x2a9c38[_0x2385('0x26')]=_0x1f2579[_0x2385('0x64')]({'plain':!![]});return db[_0x2385('0x65')][_0x2385('0x5a')]({'where':{'id':_0x1f2579['SmsInteractionId']}});}return null;})[_0x2385('0x1e')](handleEntityNotFound(_0x165754,null))[_0x2385('0x1e')](function(_0x3d4a65){if(_0x3d4a65){_0x2a9c38['interaction']=_0x3d4a65[_0x2385('0x64')]({'plain':!![]});interaction_log[_0x2385('0x1f')](_0x2385('0x76'),_0x2103d5['user']['id'],_0x2103d5[_0x2385('0x62')][_0x2385('0x35')],_0x2103d5[_0x2385('0x62')][_0x2385('0x6a')],_0x2a9c38['interaction']['id'],_0x2103d5[_0x2385('0x38')]?JSON[_0x2385('0x23')](_0x2103d5['body']):_0x2385('0x6b'));return respondWithRpcPromise(_0x2385('0x77'),'rejectMessage',_0x2a9c38);}return null;})[_0x2385('0x1e')](function(_0x1ba72d){if(_0x1ba72d){_0x1ba72d[_0x2385('0x26')]['interface']=util[_0x2385('0x60')](_0x2385('0x70'),_0x2103d5[_0x2385('0x62')]['name']);_0x1ba72d[_0x2385('0x26')][_0x2385('0x71')]=_0x2a9c38[_0x2385('0x71')];_0x1ba72d[_0x2385('0x26')]['event']=_0x2385('0x30');respondWithRpcPromise(_0x2385('0x73'),'EventManager',{'event':_0x2385('0x78'),'message':_0x1ba72d[_0x2385('0x26')]},client9002);return _0x2a9c38;}return null;})['then'](respondWithResult(_0x165754,null))[_0x2385('0x27')](handleError(_0x165754,null));};exports['status']=function(_0x46463b,_0x5e1a49,_0x333bf5){if(_0x46463b[_0x2385('0x38')]['id']){delete _0x46463b[_0x2385('0x38')]['id'];}var _0x3b6dc4;return db[_0x2385('0x52')]['find']({'where':{'id':_0x46463b[_0x2385('0x58')]['id']}})[_0x2385('0x1e')](handleEntityNotFound(_0x5e1a49,null))[_0x2385('0x1e')](function(_0x39b29d){if(_0x39b29d){_0x3b6dc4=_0x39b29d;return db[_0x2385('0x79')][_0x2385('0x5a')]({'where':{'id':_0x39b29d['SmsAccountId']}});}})[_0x2385('0x1e')](handleEntityNotFound(_0x5e1a49,null))[_0x2385('0x1e')](function(_0x4abf8f){if(_0x4abf8f){logger[_0x2385('0x7a')](_0x2385('0x22'),_0x2385('0x28'),_0x2385('0x7b'),_0x4abf8f[_0x2385('0x3f')],util[_0x2385('0x7c')](_0x46463b[_0x2385('0x38')],{'showHidden':![],'depth':null}));switch(_0x4abf8f['type']){case'twilio':if(_0x46463b[_0x2385('0x38')][_0x2385('0x7d')]&&_0x46463b[_0x2385('0x38')]['MessageSid']===_0x3b6dc4[_0x2385('0x7e')]){return _0x3b6dc4[_0x2385('0x66')]({'read':!![]});}else{logger[_0x2385('0x24')](_0x2385('0x7f'),_0x2385('0x28'),'twilio',util[_0x2385('0x7c')](_0x46463b['body'],{'showHidden':![],'depth':null}));}break;case _0x2385('0x80'):if(_0x46463b[_0x2385('0x38')][_0x2385('0x81')]&&_0x46463b[_0x2385('0x38')][_0x2385('0x81')]===_0x3b6dc4['messageId']&&_['indexOf']([_0x2385('0x82'),_0x2385('0x83')],_0x46463b[_0x2385('0x38')][_0x2385('0x84')])>=0x0){return _0x3b6dc4[_0x2385('0x66')]({'read':!![]});}else{logger[_0x2385('0x24')](_0x2385('0x7f'),'status',_0x2385('0x85'),util[_0x2385('0x7c')](_0x46463b[_0x2385('0x38')],{'showHidden':![],'depth':null}));}break;case _0x2385('0x86'):var _0x34eea9=_0x46463b[_0x2385('0x38')][_0x2385('0x87')][0x0];if(_0x34eea9[_0x2385('0x28')][_0x2385('0x88')]===_0x2385('0x89')){return _0x3b6dc4[_0x2385('0x66')]({'read':!![]});}else{logger[_0x2385('0x24')](_0x2385('0x7f'),'status',_0x2385('0x86'),util[_0x2385('0x7c')](_0x46463b[_0x2385('0x38')],{'showHidden':![],'depth':null}));}break;}return _0x3b6dc4;}})[_0x2385('0x1e')](respondWithResult(_0x5e1a49,null))['catch'](handleError(_0x5e1a49,null));}; \ No newline at end of file +var _0xaf72=['acceptMessage','manual','interface','channel','event','accept','EventManager','acceptmessage','get','RejectMessage','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','results','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','limit','offset','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','body','contact','agent','interaction','account','index','map','SmsMessage','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','findAll','show','params','length','include','options','find','create','describe','sms-interactions','sms','format','UserId','user','CmContact','Contact','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null'];(function(_0x1d515b,_0x42e9d1){var _0x1145df=function(_0x3f8a97){while(--_0x3f8a97){_0x1d515b['push'](_0x1d515b['shift']());}};_0x1145df(++_0x42e9d1);}(_0xaf72,0x1b0));var _0x2af7=function(_0x7698f5,_0x1be3dd){_0x7698f5=_0x7698f5-0x0;var _0x2039a6=_0xaf72[_0x7698f5];return _0x2039a6;};'use strict';var emlformat=require(_0x2af7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2af7('0x1'));var jsonpatch=require(_0x2af7('0x2'));var rp=require(_0x2af7('0x3'));var moment=require(_0x2af7('0x4'));var BPromise=require(_0x2af7('0x5'));var Mustache=require(_0x2af7('0x6'));var util=require(_0x2af7('0x7'));var path=require('path');var sox=require(_0x2af7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2af7('0x9'));var crypto=require(_0x2af7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2af7('0xb'));var toCsv=require(_0x2af7('0xc'));var querystring=require(_0x2af7('0xd'));var Papa=require(_0x2af7('0xe'));var Redis=require(_0x2af7('0xf'));var authService=require(_0x2af7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2af7('0x11'));var logger=require(_0x2af7('0x12'))(_0x2af7('0x13'));var utils=require(_0x2af7('0x14'));var config=require(_0x2af7('0x15'));var licenseUtil=require(_0x2af7('0x16'));var db=require(_0x2af7('0x17'))['db'];config['redis']=_['defaults'](config[_0x2af7('0x18')],{'host':_0x2af7('0x19'),'port':0x18eb});var socket=require(_0x2af7('0x1a'))(new Redis(config['redis']));require(_0x2af7('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2af7('0x1c')]['http']({'port':0x232c});var client9002=jayson['client'][_0x2af7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5e6a7b,_0x5d9bc8,_0x51b09a,_0x389f9e){return new BPromise(function(_0x22c76f,_0x5a228d){var _0x3c48da=_0x389f9e||client;return _0x3c48da[_0x2af7('0x1e')](_0x5e6a7b,_0x51b09a)[_0x2af7('0x1f')](function(_0x167cc1){logger[_0x2af7('0x20')]('SmsMessage,\x20%s,\x20%s',_0x5d9bc8,_0x2af7('0x21'));logger['debug'](_0x2af7('0x22'),_0x5d9bc8,'request\x20sent',JSON[_0x2af7('0x23')](_0x167cc1));if(_0x167cc1['error']){if(_0x167cc1[_0x2af7('0x24')][_0x2af7('0x25')]===0x1f4){logger[_0x2af7('0x24')](_0x2af7('0x26'),_0x5d9bc8,_0x167cc1[_0x2af7('0x24')][_0x2af7('0x27')]);return _0x5a228d(_0x167cc1[_0x2af7('0x24')][_0x2af7('0x27')]);}logger[_0x2af7('0x24')]('SmsMessage,\x20%s,\x20%s',_0x5d9bc8,_0x167cc1['error'][_0x2af7('0x27')]);return _0x22c76f(_0x167cc1['error']['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x5d9bc8,_0x2af7('0x21'));_0x22c76f(_0x167cc1[_0x2af7('0x28')][_0x2af7('0x27')]);}})[_0x2af7('0x29')](function(_0x5b0eea){logger['error'](_0x2af7('0x26'),_0x5d9bc8,_0x5b0eea);_0x5a228d(_0x5b0eea);});});}function respondWithStatusCode(_0x136c50,_0x5d6ea7){_0x5d6ea7=_0x5d6ea7||0xcc;return function(_0x21264f){if(_0x21264f){return _0x136c50[_0x2af7('0x2a')](_0x5d6ea7);}return _0x136c50[_0x2af7('0x2b')](_0x5d6ea7)[_0x2af7('0x2c')]();};}function respondWithResult(_0x41e38a,_0x348e07){_0x348e07=_0x348e07||0xc8;return function(_0x387a18){if(_0x387a18){return _0x41e38a[_0x2af7('0x2b')](_0x348e07)[_0x2af7('0x2d')](_0x387a18);}};}function respondWithFilteredResult(_0x2db9e8,_0x117dd1){return function(_0x161fa4){if(_0x161fa4){var _0x58d54c=typeof _0x117dd1['offset']==='undefined'&&typeof _0x117dd1[_0x2af7('0x2e')]==='undefined';var _0x569dcf=_0x161fa4['count'];var _0x32b5eb=_0x58d54c?0x0:_0x117dd1[_0x2af7('0x2f')];var _0x224ce2=_0x58d54c?_0x161fa4[_0x2af7('0x30')]:_0x117dd1[_0x2af7('0x2f')]+_0x117dd1[_0x2af7('0x2e')];var _0x298df8;if(_0x224ce2>=_0x569dcf){_0x224ce2=_0x569dcf;_0x298df8=0xc8;}else{_0x298df8=0xce;}_0x2db9e8[_0x2af7('0x2b')](_0x298df8);return _0x2db9e8['set'](_0x2af7('0x31'),_0x32b5eb+'-'+_0x224ce2+'/'+_0x569dcf)[_0x2af7('0x2d')](_0x161fa4);}return null;};}function patchUpdates(_0x561c08){return function(_0x5b5b0c){try{jsonpatch[_0x2af7('0x32')](_0x5b5b0c,_0x561c08,!![]);}catch(_0x1db469){return BPromise[_0x2af7('0x33')](_0x1db469);}return _0x5b5b0c[_0x2af7('0x34')]();};}function saveUpdates(_0x24b954,_0x1e7cbe){return function(_0x362ffd){if(_0x362ffd){return _0x362ffd[_0x2af7('0x35')](_0x24b954)[_0x2af7('0x1f')](function(_0x3738e9){return _0x3738e9;});}return null;};}function removeEntity(_0x110732,_0x32f1a){return function(_0x2ed21a){if(_0x2ed21a){return _0x2ed21a[_0x2af7('0x36')]()[_0x2af7('0x1f')](function(){_0x110732[_0x2af7('0x2b')](0xcc)[_0x2af7('0x2c')]();});}};}function handleEntityNotFound(_0x37da29,_0x168e12){return function(_0x2a1c84){if(!_0x2a1c84){_0x37da29['sendStatus'](0x194);}return _0x2a1c84;};}function handleError(_0x2b0a97,_0x2987c4){_0x2987c4=_0x2987c4||0x1f4;return function(_0x3551dd){logger['error'](_0x3551dd[_0x2af7('0x37')]);if(_0x3551dd[_0x2af7('0x38')]){delete _0x3551dd['name'];}_0x2b0a97[_0x2af7('0x2b')](_0x2987c4)[_0x2af7('0x39')](_0x3551dd);};}function getMustacheRender(_0x16f3c8,_0x3de269){return Mustache['render'](_0x16f3c8,_['merge'](_0x3de269[_0x2af7('0x3a')],{'contact':_0x3de269[_0x2af7('0x3b')],'message':_0x3de269['message'],'agent':_0x3de269[_0x2af7('0x3c')],'interaction':_0x3de269[_0x2af7('0x3d')],'account':_0x3de269[_0x2af7('0x3e')]}))||'';}exports[_0x2af7('0x3f')]=function(_0x1bb029,_0x584164){var _0x40e79b={},_0x26fa73={},_0x50e63b={'count':0x0,'rows':[]};var _0xf2e50c=_[_0x2af7('0x40')](db[_0x2af7('0x41')][_0x2af7('0x42')],function(_0x173056){return{'name':_0x173056[_0x2af7('0x43')],'type':_0x173056['type'][_0x2af7('0x44')]};});_0x26fa73['model']=_[_0x2af7('0x40')](_0xf2e50c,_0x2af7('0x38'));_0x26fa73[_0x2af7('0x45')]=_['keys'](_0x1bb029[_0x2af7('0x45')]);_0x26fa73[_0x2af7('0x46')]=_[_0x2af7('0x47')](_0x26fa73[_0x2af7('0x48')],_0x26fa73[_0x2af7('0x45')]);_0x40e79b[_0x2af7('0x49')]=_[_0x2af7('0x47')](_0x26fa73[_0x2af7('0x48')],qs[_0x2af7('0x4a')](_0x1bb029['query'][_0x2af7('0x4a')]));_0x40e79b[_0x2af7('0x49')]=_0x40e79b[_0x2af7('0x49')]['length']?_0x40e79b[_0x2af7('0x49')]:_0x26fa73[_0x2af7('0x48')];if(!_0x1bb029[_0x2af7('0x45')][_0x2af7('0x4b')](_0x2af7('0x4c'))){_0x40e79b[_0x2af7('0x2e')]=qs['limit'](_0x1bb029['query'][_0x2af7('0x2e')]);_0x40e79b[_0x2af7('0x2f')]=qs[_0x2af7('0x2f')](_0x1bb029['query'][_0x2af7('0x2f')]);}_0x40e79b['order']=qs[_0x2af7('0x4d')](_0x1bb029[_0x2af7('0x45')][_0x2af7('0x4d')]);_0x40e79b['where']=qs[_0x2af7('0x46')](_[_0x2af7('0x4e')](_0x1bb029[_0x2af7('0x45')],_0x26fa73[_0x2af7('0x46')]),_0xf2e50c);if(_0x1bb029[_0x2af7('0x45')][_0x2af7('0x4f')]){_0x40e79b[_0x2af7('0x50')]=_['merge'](_0x40e79b[_0x2af7('0x50')],{'$or':_[_0x2af7('0x40')](_0xf2e50c,function(_0x166b57){if(_0x166b57[_0x2af7('0x51')]!==_0x2af7('0x52')){var _0x25a628={};_0x25a628[_0x166b57[_0x2af7('0x38')]]={'$like':'%'+_0x1bb029['query'][_0x2af7('0x4f')]+'%'};return _0x25a628;}})});}_0x40e79b=_[_0x2af7('0x53')]({},_0x40e79b,_0x1bb029['options']);var _0x3c3a76={'where':_0x40e79b[_0x2af7('0x50')]};return db[_0x2af7('0x41')]['count'](_0x3c3a76)[_0x2af7('0x1f')](function(_0x40d9d2){_0x50e63b[_0x2af7('0x30')]=_0x40d9d2;if(_0x1bb029['query'][_0x2af7('0x54')]){_0x40e79b['include']=[{'all':!![]}];}return db[_0x2af7('0x41')][_0x2af7('0x55')](_0x40e79b);})['then'](function(_0x4264b0){_0x50e63b['rows']=_0x4264b0;return _0x50e63b;})[_0x2af7('0x1f')](respondWithFilteredResult(_0x584164,_0x40e79b))[_0x2af7('0x29')](handleError(_0x584164,null));};exports[_0x2af7('0x56')]=function(_0x27d622,_0x238f9f){var _0x550e59={'raw':!![],'where':{'id':_0x27d622[_0x2af7('0x57')]['id']}},_0x34e362={};_0x34e362[_0x2af7('0x48')]=_['keys'](db['SmsMessage']['rawAttributes']);_0x34e362[_0x2af7('0x45')]=_['keys'](_0x27d622['query']);_0x34e362[_0x2af7('0x46')]=_[_0x2af7('0x47')](_0x34e362[_0x2af7('0x48')],_0x34e362[_0x2af7('0x45')]);_0x550e59['attributes']=_[_0x2af7('0x47')](_0x34e362[_0x2af7('0x48')],qs['fields'](_0x27d622['query'][_0x2af7('0x4a')]));_0x550e59[_0x2af7('0x49')]=_0x550e59['attributes'][_0x2af7('0x58')]?_0x550e59[_0x2af7('0x49')]:_0x34e362[_0x2af7('0x48')];if(_0x27d622[_0x2af7('0x45')]['includeAll']){_0x550e59[_0x2af7('0x59')]=[{'all':!![]}];}_0x550e59=_['merge']({},_0x550e59,_0x27d622[_0x2af7('0x5a')]);return db[_0x2af7('0x41')][_0x2af7('0x5b')](_0x550e59)[_0x2af7('0x1f')](handleEntityNotFound(_0x238f9f,null))[_0x2af7('0x1f')](respondWithResult(_0x238f9f,null))[_0x2af7('0x29')](handleError(_0x238f9f,null));};exports[_0x2af7('0x5c')]=function(_0xfb24a9,_0x39cd7b){return db[_0x2af7('0x41')][_0x2af7('0x5c')](_0xfb24a9[_0x2af7('0x3a')],{})[_0x2af7('0x1f')](respondWithResult(_0x39cd7b,0xc9))[_0x2af7('0x29')](handleError(_0x39cd7b,null));};exports['update']=function(_0x279e91,_0x12d6e1){if(_0x279e91[_0x2af7('0x3a')]['id']){delete _0x279e91[_0x2af7('0x3a')]['id'];}return db[_0x2af7('0x41')][_0x2af7('0x5b')]({'where':{'id':_0x279e91[_0x2af7('0x57')]['id']}})[_0x2af7('0x1f')](handleEntityNotFound(_0x12d6e1,null))[_0x2af7('0x1f')](saveUpdates(_0x279e91['body'],null))['then'](respondWithResult(_0x12d6e1,null))[_0x2af7('0x29')](handleError(_0x12d6e1,null));};exports[_0x2af7('0x36')]=function(_0x2f6414,_0x320d7c){return db['SmsMessage'][_0x2af7('0x5b')]({'where':{'id':_0x2f6414[_0x2af7('0x57')]['id']}})[_0x2af7('0x1f')](handleEntityNotFound(_0x320d7c,null))[_0x2af7('0x1f')](removeEntity(_0x320d7c,null))[_0x2af7('0x29')](handleError(_0x320d7c,null));};exports[_0x2af7('0x5d')]=function(_0x28b2de,_0x384d8a){return db[_0x2af7('0x41')][_0x2af7('0x5d')]()[_0x2af7('0x1f')](respondWithResult(_0x384d8a,null))[_0x2af7('0x29')](handleError(_0x384d8a,null));};var interaction_log=require(_0x2af7('0x12'))(_0x2af7('0x5e'));exports['accept']=function(_0x58aee2,_0x5d838e,_0x58c165){var _0x1b92bc={'agent':{},'channel':_0x2af7('0x5f')};if(_0x58aee2[_0x2af7('0x3a')]['id']){delete _0x58aee2[_0x2af7('0x3a')]['id'];}_0x58aee2['body']['read']=!![];_0x58aee2[_0x2af7('0x3a')]['readAt']=moment()[_0x2af7('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x58aee2[_0x2af7('0x3a')]['UserId']=_0x58aee2[_0x2af7('0x3a')][_0x2af7('0x61')]||_0x58aee2[_0x2af7('0x62')]['id'];_0x1b92bc[_0x2af7('0x3c')]['id']=_0x58aee2['body']['UserId'];return db[_0x2af7('0x41')][_0x2af7('0x5b')]({'where':{'id':_0x58aee2['params']['id'],'UserId':null},'include':[{'model':db[_0x2af7('0x63')],'as':_0x2af7('0x64')}]})[_0x2af7('0x1f')](handleEntityNotFound(_0x5d838e,null))[_0x2af7('0x1f')](saveUpdates(_0x58aee2['body'],null))['then'](function(_0x29efd8){if(_0x29efd8){_0x1b92bc[_0x2af7('0x27')]=_0x29efd8['get']({'plain':!![]});return db['SmsInteraction'][_0x2af7('0x5b')]({'where':{'id':_0x29efd8[_0x2af7('0x65')]}});}return null;})[_0x2af7('0x1f')](handleEntityNotFound(_0x5d838e,null))[_0x2af7('0x1f')](function(_0x4d74f2){if(_0x4d74f2){return _0x4d74f2['update']({'UserId':_0x58aee2[_0x2af7('0x3a')][_0x2af7('0x61')],'read1stAt':_[_0x2af7('0x66')](_0x4d74f2[_0x2af7('0x67')])?moment()[_0x2af7('0x60')](_0x2af7('0x68')):undefined});}return null;})[_0x2af7('0x1f')](function(_0x319d26){if(_0x319d26){_0x1b92bc[_0x2af7('0x3d')]=_0x319d26['get']({'plain':!![]});interaction_log[_0x2af7('0x20')](_0x2af7('0x69'),_0x58aee2['user']['id'],_0x58aee2[_0x2af7('0x62')][_0x2af7('0x38')],_0x58aee2[_0x2af7('0x62')][_0x2af7('0x6a')],_0x1b92bc['interaction']['id'],_0x58aee2[_0x2af7('0x3a')]?JSON['stringify'](_0x58aee2[_0x2af7('0x3a')]):_0x2af7('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x2af7('0x6c'),_0x1b92bc);}return null;})['then'](function(_0x4d28c9){if(_0x4d28c9){if(_0x58aee2['body'][_0x2af7('0x6d')]){_0x1b92bc[_0x2af7('0x27')][_0x2af7('0x6e')]=util[_0x2af7('0x60')]('SIP/%s',_0x58aee2[_0x2af7('0x62')][_0x2af7('0x38')]);_0x1b92bc[_0x2af7('0x27')][_0x2af7('0x6f')]=_0x1b92bc['channel'];_0x1b92bc[_0x2af7('0x27')][_0x2af7('0x70')]=_0x2af7('0x71');return respondWithRpcPromise(_0x2af7('0x72'),_0x2af7('0x72'),{'event':_0x2af7('0x73'),'message':_0x1b92bc[_0x2af7('0x27')]},client9002)[_0x2af7('0x1f')](function(){return _0x1b92bc;});}return _0x1b92bc;}return null;})[_0x2af7('0x1f')](respondWithResult(_0x5d838e,null))[_0x2af7('0x29')](handleError(_0x5d838e,null));};var interaction_log=require('../../config/logger')(_0x2af7('0x5e'));exports[_0x2af7('0x33')]=function(_0x3099fe,_0x52620b,_0x2f4da9){var _0x25ec98={'agent':{},'channel':'sms'};if(_0x3099fe['body']['id']){delete _0x3099fe[_0x2af7('0x3a')]['id'];}_0x3099fe['body'][_0x2af7('0x61')]=_0x3099fe[_0x2af7('0x3a')]['UserId']||_0x3099fe[_0x2af7('0x62')]['id'];_0x25ec98['agent']['id']=_0x3099fe[_0x2af7('0x3a')]['UserId'];return db['SmsMessage'][_0x2af7('0x5b')]({'where':{'id':_0x3099fe[_0x2af7('0x57')]['id'],'UserId':null}})[_0x2af7('0x1f')](handleEntityNotFound(_0x52620b,null))['then'](function(_0x35f4c6){if(_0x35f4c6){_0x25ec98[_0x2af7('0x27')]=_0x35f4c6[_0x2af7('0x74')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x35f4c6[_0x2af7('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x52620b,null))[_0x2af7('0x1f')](function(_0x522f01){if(_0x522f01){_0x25ec98['interaction']=_0x522f01['get']({'plain':!![]});interaction_log[_0x2af7('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3099fe[_0x2af7('0x62')]['id'],_0x3099fe[_0x2af7('0x62')]['name'],_0x3099fe[_0x2af7('0x62')]['role'],_0x25ec98['interaction']['id'],_0x3099fe[_0x2af7('0x3a')]?JSON[_0x2af7('0x23')](_0x3099fe[_0x2af7('0x3a')]):_0x2af7('0x6b'));return respondWithRpcPromise(_0x2af7('0x75'),'rejectMessage',_0x25ec98);}return null;})['then'](function(_0x20496a){if(_0x20496a){_0x20496a['message'][_0x2af7('0x6e')]=util['format'](_0x2af7('0x76'),_0x3099fe[_0x2af7('0x62')]['name']);_0x20496a[_0x2af7('0x27')]['channel']=_0x25ec98['channel'];_0x20496a['message'][_0x2af7('0x70')]='reject';respondWithRpcPromise(_0x2af7('0x72'),_0x2af7('0x72'),{'event':_0x2af7('0x77'),'message':_0x20496a[_0x2af7('0x27')]},client9002);return _0x25ec98;}return null;})[_0x2af7('0x1f')](respondWithResult(_0x52620b,null))[_0x2af7('0x29')](handleError(_0x52620b,null));};exports[_0x2af7('0x2b')]=function(_0x488406,_0xa856f7,_0x342c12){if(_0x488406[_0x2af7('0x3a')]['id']){delete _0x488406[_0x2af7('0x3a')]['id'];}var _0x10cd7c;return db[_0x2af7('0x41')][_0x2af7('0x5b')]({'where':{'id':_0x488406[_0x2af7('0x57')]['id']}})[_0x2af7('0x1f')](handleEntityNotFound(_0xa856f7,null))[_0x2af7('0x1f')](function(_0x3f1391){if(_0x3f1391){_0x10cd7c=_0x3f1391;return db[_0x2af7('0x78')]['find']({'where':{'id':_0x3f1391[_0x2af7('0x79')]}});}})[_0x2af7('0x1f')](handleEntityNotFound(_0xa856f7,null))[_0x2af7('0x1f')](function(_0x459f76){if(_0x459f76){logger[_0x2af7('0x7a')](_0x2af7('0x22'),_0x2af7('0x2b'),_0x2af7('0x7b'),_0x459f76[_0x2af7('0x51')],util[_0x2af7('0x7c')](_0x488406[_0x2af7('0x3a')],{'showHidden':![],'depth':null}));switch(_0x459f76[_0x2af7('0x51')]){case _0x2af7('0x7d'):if(_0x488406[_0x2af7('0x3a')][_0x2af7('0x7e')]&&_0x488406[_0x2af7('0x3a')][_0x2af7('0x7e')]===_0x10cd7c[_0x2af7('0x7f')]){return _0x10cd7c['update']({'read':!![]});}else{logger[_0x2af7('0x24')](_0x2af7('0x80'),_0x2af7('0x2b'),_0x2af7('0x7d'),util['inspect'](_0x488406[_0x2af7('0x3a')],{'showHidden':![],'depth':null}));}break;case _0x2af7('0x81'):if(_0x488406[_0x2af7('0x3a')][_0x2af7('0x82')]&&_0x488406[_0x2af7('0x3a')][_0x2af7('0x82')]===_0x10cd7c[_0x2af7('0x7f')]&&_[_0x2af7('0x83')](['sent',_0x2af7('0x84')],_0x488406[_0x2af7('0x3a')]['Status'])>=0x0){return _0x10cd7c[_0x2af7('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2af7('0x2b'),'plivio',util[_0x2af7('0x7c')](_0x488406['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x59d79a=_0x488406[_0x2af7('0x3a')][_0x2af7('0x85')][0x0];if(_0x59d79a['status']['groupName']===_0x2af7('0x86')){return _0x10cd7c[_0x2af7('0x35')]({'read':!![]});}else{logger[_0x2af7('0x24')](_0x2af7('0x80'),'status','infobip',util[_0x2af7('0x7c')](_0x488406[_0x2af7('0x3a')],{'showHidden':![],'depth':null}));}break;}return _0x10cd7c;}})[_0x2af7('0x1f')](respondWithResult(_0xa856f7,null))[_0x2af7('0x29')](handleError(_0xa856f7,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index b0c8a74..5649014 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 _0x53e4=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','SmsMessage'];(function(_0x595609,_0x4d56f3){var _0x3822ba=function(_0x54a3b0){while(--_0x54a3b0){_0x595609['push'](_0x595609['shift']());}};_0x3822ba(++_0x4d56f3);}(_0x53e4,0x7e));var _0x453e=function(_0x25d4e5,_0x30b67f){_0x25d4e5=_0x25d4e5-0x0;var _0x44d116=_0x53e4[_0x25d4e5];return _0x44d116;};'use strict';var EventEmitter=require(_0x453e('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x453e('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x453e('0x2')](0x0);var events={'afterCreate':_0x453e('0x3'),'afterUpdate':_0x453e('0x4'),'afterDestroy':_0x453e('0x5')};function emitEvent(_0x36a97d){return function(_0x3927c6,_0x5e47ea,_0x268fe4){SmsMessageEvents[_0x453e('0x6')](_0x36a97d+':'+_0x3927c6['id'],_0x3927c6);SmsMessageEvents['emit'](_0x36a97d,_0x3927c6);_0x268fe4(null);};}for(var e in events){if(events[_0x453e('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xaafe=['hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','save','emit'];(function(_0x1398af,_0x129fc8){var _0x450604=function(_0x5602be){while(--_0x5602be){_0x1398af['push'](_0x1398af['shift']());}};_0x450604(++_0x129fc8);}(_0xaafe,0x83));var _0xeaaf=function(_0x327501,_0x373895){_0x327501=_0x327501-0x0;var _0x45a0c8=_0xaafe[_0x327501];return _0x45a0c8;};'use strict';var EventEmitter=require(_0xeaaf('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xeaaf('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xeaaf('0x2')](0x0);var events={'afterCreate':_0xeaaf('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d0d16){return function(_0x522fe3,_0x3392a1,_0xb0115a){SmsMessageEvents[_0xeaaf('0x4')](_0x2d0d16+':'+_0x522fe3['id'],_0x522fe3);SmsMessageEvents[_0xeaaf('0x4')](_0x2d0d16,_0x522fe3);_0xb0115a(null);};}for(var e in events){if(events[_0xeaaf('0x5')](e)){var event=events[e];SmsMessage[_0xeaaf('0x6')](e,emitEvent(event));}}module[_0xeaaf('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 05c979d..cee8a37 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 _0x937a=['csc','crypto','apiKey','login','text','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','accountId','/messages','applicationId','bandwidth','intelepeer','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','token','sid','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','clicksend','password','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json'];(function(_0x219a03,_0x4f53a8){var _0x55ba9c=function(_0x4aeb46){while(--_0x4aeb46){_0x219a03['push'](_0x219a03['shift']());}};_0x55ba9c(++_0x4f53a8);}(_0x937a,0x19b));var _0xa937=function(_0x470a01,_0x1ef188){_0x470a01=_0x470a01-0x0;var _0x5df181=_0x937a[_0x470a01];return _0x5df181;};'use strict';var _=require('lodash');var util=require(_0xa937('0x0'));var logger=require(_0xa937('0x1'))(_0xa937('0x2'));var moment=require(_0xa937('0x3'));var BPromise=require(_0xa937('0x4'));var rp=require(_0xa937('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa937('0x6'));var attributes=require(_0xa937('0x7'));module[_0xa937('0x8')]=function(_0x37b5f8,_0x4234bf){return _0x37b5f8[_0xa937('0x9')](_0xa937('0xa'),attributes,{'tableName':_0xa937('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa937('0xc')]},{'name':_0xa937('0xd'),'fields':[_0xa937('0xe')],'type':_0xa937('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b2a8f,_0x15de47,_0x4bb2bd){var _0x36f72f=_0x37b5f8[_0xa937('0x10')];var _0x42ce05=_0x3b2a8f[_0xa937('0x11')]({'plain':!![]});if(_0x42ce05[_0xa937('0x12')][_0xa937('0x13')]()==='in'||_0x42ce05['direction'][_0xa937('0x13')]()===_0xa937('0x14')&&!_0x42ce05[_0xa937('0x15')]&&!_[_0xa937('0x16')](_0x42ce05[_0xa937('0x17')])){_0x36f72f[_0xa937('0x18')][_0xa937('0x19')]({'where':{'id':_0x42ce05[_0xa937('0x1a')]}})[_0xa937('0x1b')](function(_0x386a23){if(_0x386a23){_0x386a23[_0xa937('0x1c')]({'lastMsgAt':_0x42ce05[_0xa937('0x1d')],'lastMsgDirection':_0x42ce05[_0xa937('0x12')]['toLowerCase']()});}})[_0xa937('0x1e')](function(_0xab9ce){console['error'](_0xab9ce);});}if(_0x42ce05[_0xa937('0x12')]==='out'&&!_0x42ce05[_0xa937('0x15')]){var _0x162f41;_0x36f72f[_0xa937('0x1f')][_0xa937('0x20')]({'where':{'id':_0x42ce05[_0xa937('0x21')]},'raw':!![]})[_0xa937('0x1b')](function(_0x239b63){_0x162f41=_0x239b63;if(_0x162f41&&_0x162f41[_0xa937('0x22')]){switch(_0x162f41[_0xa937('0x22')]){case _0xa937('0x23'):var _0x983af0=require(_0xa937('0x23'));if(_0x162f41[_0xa937('0x24')]&&_0x162f41[_0xa937('0x25')]&&_0x162f41[_0xa937('0x26')]){var _0x5279a0=new _0x983af0(_0x162f41[_0xa937('0x24')],_0x162f41[_0xa937('0x25')]);_0x5279a0[_0xa937('0x27')][_0xa937('0x28')]({'body':_0x42ce05[_0xa937('0xe')],'to':_0x42ce05['phone'],'from':_0x162f41[_0xa937('0x26')],'statusCallback':_0x162f41['remote']+_0xa937('0x29')+_0x42ce05['id']+_0xa937('0x2a')+_0x162f41[_0xa937('0x2b')]})[_0xa937('0x1b')](function(_0x5ad62f){if(_0x5ad62f['sid']){return _0x3b2a8f[_0xa937('0x1c')]({'messageId':_0x5ad62f[_0xa937('0x2c')]});}})[_0xa937('0x1e')](function(_0x10507b){logger[_0xa937('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa937('0x2e'),_0xa937('0x23'),util[_0xa937('0x2f')](_0x10507b,{'showHidden':![],'depth':null}));});}else{logger[_0xa937('0x2d')](_0xa937('0x30'),_0xa937('0x2e'),'twilio',_0xa937('0x31'));}break;case _0xa937('0x32'):var _0xfe2e16=_0xa937('0x33');if(_0x162f41[_0xa937('0x34')]&&_0x162f41['password']){var _0x11859a={'recipient':[_0x42ce05[_0xa937('0x26')]],'message':_0x42ce05[_0xa937('0xe')],'message_type':_0x162f41[_0xa937('0x35')]};if(_0x162f41['smsMethod']&&_0x162f41['smsMethod']!=='SI'){_0x11859a[_0xa937('0x36')]=_0x162f41[_0xa937('0x26')];}var _0x336710={'url':_0xfe2e16+_0xa937('0x37')+_0x162f41[_0xa937('0x34')]+_0xa937('0x38')+_0x162f41['password'],'method':'GET'};rp(_0x336710)[_0xa937('0x1b')](function(_0x34957b){var _0x4115cd=_0x34957b[_0xa937('0x39')](';');var _0x187d9c={'user_key':_0x4115cd[0x0],'session_key':_0x4115cd[0x1]};_0x336710={'url':_0xfe2e16+_0xa937('0x3a'),'method':_0xa937('0x3b'),'headers':{'user_key':_0x187d9c[_0xa937('0x3c')],'Session_key':_0x187d9c[_0xa937('0x3d')]},'json':!![],'body':_0x11859a};return rp(_0x336710);})[_0xa937('0x1b')](function(_0x5e3dc5){if(_0x5e3dc5[_0xa937('0x3e')]>=0x1){var _0x19cebd={'messageId':_0x5e3dc5[_0xa937('0x3f')]};if(_0x162f41['smsMethod']!=='GP'||!_0x162f41['deliveryReport']){_0x19cebd[_0xa937('0x40')]=!![];}return _0x3b2a8f[_0xa937('0x1c')](_0x19cebd);}else{return logger['error'](_0xa937('0x30'),_0xa937('0x2e'),_0xa937('0x32'),util[_0xa937('0x2f')](_0x5e3dc5,{'showHidden':![],'depth':null}));}})[_0xa937('0x1e')](function(_0xe11adb){return logger['error'](_0xa937('0x30'),_0xa937('0x2e'),'skebby',util[_0xa937('0x2f')](_0xe11adb,{'showHidden':![],'depth':null}));});}else{logger[_0xa937('0x2d')](_0xa937('0x30'),_0xa937('0x2e'),_0xa937('0x32'),_0xa937('0x41'));}break;case _0xa937('0x42'):if(_0x162f41[_0xa937('0x25')]){var _0x165520={'recipient':_0x42ce05[_0xa937('0x26')],'message':_0x42ce05[_0xa937('0xe')],'sender':_0x162f41[_0xa937('0x43')]||_0x162f41[_0xa937('0x26')],'authorization':_0x162f41[_0xa937('0x25')]};var _0x15de47={'method':_0xa937('0x3b'),'uri':_0xa937('0x44'),'body':_0x165520,'json':!![]};rp(_0x15de47)[_0xa937('0x1b')](function(_0x3a6e13){var _0x464269={'messageId':_0x3a6e13[_0xa937('0x45')]};if(!_0x162f41[_0xa937('0x46')]){_0x464269[_0xa937('0x40')]=!![];}return _0x3b2a8f[_0xa937('0x1c')](_0x464269);})[_0xa937('0x1e')](function(_0x32526b){logger[_0xa937('0x2d')](_0xa937('0x30'),'afterCreate',_0xa937('0x42'),util[_0xa937('0x2f')](_0x32526b,{'showHidden':![],'depth':null}));});}else{logger[_0xa937('0x2d')](_0xa937('0x30'),_0xa937('0x2e'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xa937('0x47'):if(_0x162f41[_0xa937('0x34')]&&_0x162f41[_0xa937('0x48')]){var _0x165520={'messages':[{'source':_0xa937('0x49'),'to':_0x42ce05['phone'],'body':_0x42ce05[_0xa937('0xe')],'from':_0x162f41['senderString']||_0x162f41[_0xa937('0x26')]}]};var _0x29e9ea=util[_0xa937('0x4a')](_0xa937('0x4b'),_0x162f41[_0xa937('0x34')],_0x162f41[_0xa937('0x48')]);var _0x15de47={'method':_0xa937('0x3b'),'uri':_0xa937('0x4c'),'body':_0x165520,'headers':{'Authorization':util['format'](_0xa937('0x4d'),new Buffer(_0x29e9ea)[_0xa937('0x4e')]('base64'))},'json':!![]};rp(_0x15de47)[_0xa937('0x1b')](function(_0x4c2f4b){if(_0x4c2f4b[_0xa937('0x4f')]>=0xc8&&_0x4c2f4b['http_code']<=0xce){if(_0x4c2f4b[_0xa937('0x50')]&&_0x4c2f4b[_0xa937('0x50')][_0xa937('0x51')]>0x0){var _0x30b24f=_[_0xa937('0x52')](_0x4c2f4b['data'][_0xa937('0x27')]);var _0x1980f9={'messageId':_0x30b24f[_0xa937('0x53')]};if(!_0x162f41[_0xa937('0x46')]){_0x1980f9['read']=!![];}return _0x3b2a8f['update'](_0x1980f9);}else{logger[_0xa937('0x2d')](_0xa937('0x30'),'afterCreate','clickSend',util[_0xa937('0x2f')](_0x4c2f4b,{'showHidden':![],'depth':null}));}}else{logger[_0xa937('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa937('0x2e'),'clickSend',util[_0xa937('0x2f')](_0x4c2f4b,{'showHidden':![],'depth':null}));}})[_0xa937('0x1e')](function(_0x55a4ab){logger[_0xa937('0x2d')](_0xa937('0x30'),_0xa937('0x2e'),_0xa937('0x54'),util['inspect'](_0x55a4ab,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa937('0x30'),'afterCreate',_0xa937('0x54'),_0xa937('0x41'));}break;case _0xa937('0x55'):if(_0x162f41[_0xa937('0x56')]&&_0x162f41[_0xa937('0x25')]){var _0x165520={'dst':_0x42ce05[_0xa937('0x26')],'text':_0x42ce05[_0xa937('0xe')],'src':_0x162f41['senderString']||_0x162f41['phone'],'url':_0x162f41[_0xa937('0x57')]+_0xa937('0x29')+_0x42ce05['id']+_0xa937('0x2a')+_0x162f41[_0xa937('0x2b')]};var _0x29e9ea=util[_0xa937('0x4a')](_0xa937('0x4b'),_0x162f41['authId'],_0x162f41[_0xa937('0x25')]);var _0x15de47={'method':_0xa937('0x3b'),'uri':util[_0xa937('0x4a')](_0xa937('0x58'),_0x162f41[_0xa937('0x56')]),'body':_0x165520,'headers':{'Authorization':util[_0xa937('0x4a')](_0xa937('0x4d'),new Buffer(_0x29e9ea)[_0xa937('0x4e')](_0xa937('0x59')))},'json':!![]};rp(_0x15de47)[_0xa937('0x1b')](function(_0x1c4586){var _0x4b8cc3={'messageId':_0x1c4586[_0xa937('0x5a')][0x0]};return _0x3b2a8f[_0xa937('0x1c')](_0x4b8cc3);})[_0xa937('0x1e')](function(_0x856b5c){logger[_0xa937('0x2d')](_0xa937('0x30'),_0xa937('0x2e'),_0xa937('0x55'),util[_0xa937('0x2f')](_0x856b5c,{'showHidden':![],'depth':null}));});}else{logger[_0xa937('0x2d')](_0xa937('0x30'),_0xa937('0x2e'),_0xa937('0x55'),_0xa937('0x5b'));}break;case _0xa937('0x5c'):if(_0x162f41['username']&&_0x162f41['password']){if(_0x162f41[_0xa937('0x5d')]){var _0x470351={'method':'POST','uri':_0x162f41[_0xa937('0x5d')]+_0xa937('0x5e'),'body':{'username':_0x162f41['username'],'password':_0x162f41[_0xa937('0x48')]},'json':!![]};return rp(_0x470351)[_0xa937('0x1b')](function(_0x2d1213){var _0x22a044={'method':'POST','uri':_0x162f41[_0xa937('0x5d')]+_0xa937('0x5f'),'body':{'messages':[{'from':_0x162f41[_0xa937('0x26')],'destinations':[{'to':_0x42ce05['phone']}],'text':_0x42ce05[_0xa937('0xe')],'notifyUrl':_0x162f41[_0xa937('0x57')]+'/api/sms/messages/'+_0x42ce05['id']+'/status?token='+_0x162f41[_0xa937('0x2b')],'notifyContentType':_0xa937('0x60'),'callbackData':_0x162f41['phone']+';'+_0x42ce05[_0xa937('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x2d1213['token']},'json':!![]};return rp(_0x22a044)[_0xa937('0x1b')](function(_0xc4ac11){if(_0xc4ac11['messages']){var _0x30ad3c={'messageId':_0xc4ac11['messages'][0x0][_0xa937('0xc')]};if(!_0x162f41[_0xa937('0x46')]){_0x30ad3c[_0xa937('0x40')]=!![];}return _0x3b2a8f[_0xa937('0x1c')](_0x30ad3c);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0xa937('0x2f')](_0xc4ac11,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x6af261){return logger[_0xa937('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa937('0x5c'),util[_0xa937('0x2f')](_0x6af261,{'showHidden':![],'depth':null}));});}else{logger[_0xa937('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa937('0x2e'),_0xa937('0x5c'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xa937('0x2d')](_0xa937('0x30'),_0xa937('0x2e'),'infobip',_0xa937('0x41'));}break;case _0xa937('0x61'):var _0x2a4242=require(_0xa937('0x62'));if(_0x162f41[_0xa937('0x63')]){var _0x3bcf51={};_0x3bcf51[_0xa937('0x64')]=_0x162f41[_0xa937('0x34')];_0x3bcf51[_0xa937('0x26')]=_0x42ce05[_0xa937('0x26')];_0x3bcf51[_0xa937('0x36')]=_0x162f41[_0xa937('0x26')];_0x3bcf51[_0xa937('0x65')]=_0x42ce05[_0xa937('0xe')];_0x3bcf51['timestamp']=+new Date();var _0x15c848='';var _0x29dbbd='';var _0x2fd55a=Object[_0xa937('0x66')](_0x3bcf51);_0x2fd55a[_0xa937('0x67')]();for(var _0x44d61c=0x0;_0x44d61c<_0x2fd55a[_0xa937('0x68')];_0x44d61c++){if(_0x15c848!=''){_0x15c848+='&';}_0x15c848+=_0x2fd55a[_0x44d61c]+'='+encodeURIComponent(_0x3bcf51[_0x2fd55a[_0x44d61c]]);_0x29dbbd+=_0x3bcf51[_0x2fd55a[_0x44d61c]];}_0x29dbbd+=_0x162f41[_0xa937('0x63')];_0x29dbbd=_0x2a4242[_0xa937('0x69')](_0xa937('0x6a'))[_0xa937('0x1c')](_0x29dbbd)[_0xa937('0x6b')]('hex');if(_0x15c848!==''){_0x15c848+='&';}_0x15c848+=_0xa937('0x6c')+_0x29dbbd;var _0x336710={'method':'GET','uri':_0x162f41[_0xa937('0x5d')]+_0xa937('0x6d')+_0x15c848,'json':!![]};return rp(_0x336710)[_0xa937('0x1b')](function(_0x2f1949){var _0x2ce7c7=Object[_0xa937('0x66')](_0x2f1949);if(_0x2f1949[_0x2ce7c7[0x0]][_0xa937('0x2d')]&&parseInt(_0x2f1949[_0x2ce7c7[0x0]][_0xa937('0x2d')])===0x0){var _0x48c155={'messageId':_0x2f1949[_0x2ce7c7[0x0]]['id_sms']};if(!_0x162f41[_0xa937('0x46')]){_0x48c155[_0xa937('0x40')]=!![];}return _0x3b2a8f[_0xa937('0x1c')](_0x48c155);}else{return logger[_0xa937('0x2d')](_0xa937('0x30'),'afterCreate',_0xa937('0x61'),util[_0xa937('0x2f')](_0x2f1949['error'],{'showHidden':![],'depth':null}));}})[_0xa937('0x1e')](function(_0x335bce){return logger[_0xa937('0x2d')](_0xa937('0x30'),'afterCreate',_0xa937('0x61'),util[_0xa937('0x2f')](_0x335bce,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa937('0x2e'),'csc','Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x162f41[_0xa937('0x63')]){var _0x28c87f={'method':'POST','uri':_0xa937('0x6e'),'headers':{'Authorization':_0x162f41[_0xa937('0x63')]},'body':{'content':_0x42ce05[_0xa937('0xe')],'to':[_0x42ce05['phone']],'from':_0x162f41[_0xa937('0x26')],'binary':![],'clientMessageId':_0xa937('0x6f'),'charset':_0xa937('0x70')},'json':!![]};rp(_0x28c87f)[_0xa937('0x1b')](function(_0x344e2f){if(!_0x344e2f['error']){var _0x340699={'messageId':_0x344e2f[_0xa937('0x27')][0x0][_0xa937('0x71')]};if(!_0x162f41[_0xa937('0x46')]){_0x340699[_0xa937('0x40')]=!![];}return _0x3b2a8f[_0xa937('0x1c')](_0x340699);}else{return logger[_0xa937('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa937('0x72'),util['inspect'](_0x344e2f[_0xa937('0x2d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x16316c){return logger[_0xa937('0x2d')](_0xa937('0x30'),_0xa937('0x2e'),_0xa937('0x72'),util[_0xa937('0x2f')](_0x16316c,{'showHidden':![],'depth':null}));});}else{logger[_0xa937('0x2d')](_0xa937('0x30'),_0xa937('0x2e'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x162f41[_0xa937('0x34')]&&_0x162f41['password']){var _0x29e9ea=util[_0xa937('0x4a')](_0xa937('0x4b'),_0x162f41['username'],_0x162f41[_0xa937('0x48')]);var _0x15de47={'method':_0xa937('0x3b'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x162f41[_0xa937('0x73')]+_0xa937('0x74'),'body':{'to':[_0x42ce05[_0xa937('0x26')]],'text':_0x42ce05['body'],'from':_0x162f41[_0xa937('0x26')],'applicationId':_0x162f41[_0xa937('0x75')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x29e9ea)[_0xa937('0x4e')]('base64'))},'json':!![]};rp(_0x15de47)['then'](function(_0x4240e2){if(_0x4240e2['id']){var _0x45cb8e={'messageId':_0x4240e2['id']};return _0x3b2a8f[_0xa937('0x1c')](_0x45cb8e);}else{logger[_0xa937('0x2d')](_0xa937('0x30'),_0xa937('0x2e'),_0xa937('0x76'),util[_0xa937('0x2f')](_0x4240e2,{'showHidden':![],'depth':null}));}})[_0xa937('0x1e')](function(_0xe75ef0){logger[_0xa937('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0xa937('0x2f')](_0xe75ef0,{'showHidden':![],'depth':null}));});}else{logger[_0xa937('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa937('0x2e'),_0xa937('0x76'),_0xa937('0x41'));}break;case _0xa937('0x77'):if(_0x162f41[_0xa937('0x63')]){var _0x5d488b={};var _0x336710={'method':_0xa937('0x3b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x162f41[_0xa937('0x63')],'Content-Type':_0xa937('0x60')},'body':{'from':_0x162f41[_0xa937('0x26')],'to':_0x42ce05[_0xa937('0x26')],'text':_0x42ce05['body']},'json':!![]};return rp(_0x336710)[_0xa937('0x1b')](function(_0x1b4ebe){if(_0x1b4ebe['code']==0xca){_0x5d488b[_0xa937('0x78')]=_0x1b4ebe;var _0x5e62c7={'method':_0xa937('0x3b'),'uri':_0xa937('0x79'),'headers':{'Authorization':_0xa937('0x7a')+_0x162f41[_0xa937('0x63')],'Content-Type':_0xa937('0x60')},'body':{'refid':_0x5d488b[_0xa937('0x78')][_0xa937('0x7b')]},'json':!![]};return rp(_0x5e62c7)[_0xa937('0x1b')](function(_0x3f128b){_0x5d488b[_0xa937('0x7c')]=_0x3f128b;var _0x5dbe98={'messageId':_0x5d488b['message'][_0xa937('0x7b')],'read':!![]};return _0x3b2a8f[_0xa937('0x1c')](_0x5dbe98);});}else{return logger[_0xa937('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa937('0x2e'),_0xa937('0x77'),util[_0xa937('0x2f')](_0x1b4ebe,{'showHidden':![],'depth':null}));}})[_0xa937('0x1e')](function(_0x419097){return logger[_0xa937('0x2d')](_0xa937('0x30'),'afterCreate',_0xa937('0x77'),util[_0xa937('0x2f')](_0x419097,{'showHidden':![],'depth':null}));});}else{return logger[_0xa937('0x2d')](_0xa937('0x30'),'afterCreate','intelepeer','Token\x20not\x20received');}break;}}})[_0xa937('0x7d')](function(){_0x4bb2bd();});}else{_0x4bb2bd();}}},'charset':'utf8mb4','collate':_0xa937('0x7e')});}; \ No newline at end of file +var _0xed1e=['Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','Basic\x20%s','toString','http_code','data','queued_count','head','messages','clickSend','plivo','authId','%s:%s','base64','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','hex','id_sms','csc','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','application/json','code','message','refid','status','finally','utf8mb4','lodash','util','api','request-promise','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','body','get','direction','toLowerCase','out','isNil','SmsInteraction','findOne','SmsInteractionId','then','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','token','sid','update','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','POST','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x1031e6,_0x3e5b64){var _0x224542=function(_0x539a1c){while(--_0x539a1c){_0x1031e6['push'](_0x1031e6['shift']());}};_0x224542(++_0x3e5b64);}(_0xed1e,0xad));var _0xeed1=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0xed1e[_0x2134b7];return _0x6c5914;};'use strict';var _=require(_0xeed1('0x0'));var util=require(_0xeed1('0x1'));var logger=require('../../config/logger')(_0xeed1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeed1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeed1('0x4'));var attributes=require(_0xeed1('0x5'));module[_0xeed1('0x6')]=function(_0x1a0c5a,_0x975348){return _0x1a0c5a['define'](_0xeed1('0x7'),attributes,{'tableName':_0xeed1('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xeed1('0x9')]},{'name':'fti_sms_messages','fields':[_0xeed1('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x463d68,_0x64a37c,_0x1cab2c){var _0x4debfa=_0x1a0c5a['models'];var _0x53acba=_0x463d68[_0xeed1('0xb')]({'plain':!![]});if(_0x53acba[_0xeed1('0xc')]['toLowerCase']()==='in'||_0x53acba[_0xeed1('0xc')][_0xeed1('0xd')]()===_0xeed1('0xe')&&!_0x53acba['secret']&&!_[_0xeed1('0xf')](_0x53acba['UserId'])){_0x4debfa[_0xeed1('0x10')][_0xeed1('0x11')]({'where':{'id':_0x53acba[_0xeed1('0x12')]}})[_0xeed1('0x13')](function(_0x4d24b5){if(_0x4d24b5){_0x4d24b5['update']({'lastMsgAt':_0x53acba[_0xeed1('0x14')],'lastMsgDirection':_0x53acba[_0xeed1('0xc')][_0xeed1('0xd')]()});}})[_0xeed1('0x15')](function(_0x4cdfad){console[_0xeed1('0x16')](_0x4cdfad);});}if(_0x53acba['direction']===_0xeed1('0xe')&&!_0x53acba[_0xeed1('0x17')]){var _0x4c9555;_0x4debfa[_0xeed1('0x18')][_0xeed1('0x19')]({'where':{'id':_0x53acba[_0xeed1('0x1a')]},'raw':!![]})[_0xeed1('0x13')](function(_0x412064){_0x4c9555=_0x412064;if(_0x4c9555&&_0x4c9555[_0xeed1('0x1b')]){switch(_0x4c9555[_0xeed1('0x1b')]){case'twilio':var _0x310fa0=require(_0xeed1('0x1c'));if(_0x4c9555[_0xeed1('0x1d')]&&_0x4c9555[_0xeed1('0x1e')]&&_0x4c9555[_0xeed1('0x1f')]){var _0x3bfae3=new _0x310fa0(_0x4c9555[_0xeed1('0x1d')],_0x4c9555[_0xeed1('0x1e')]);_0x3bfae3['messages'][_0xeed1('0x20')]({'body':_0x53acba[_0xeed1('0xa')],'to':_0x53acba['phone'],'from':_0x4c9555[_0xeed1('0x1f')],'statusCallback':_0x4c9555[_0xeed1('0x21')]+_0xeed1('0x22')+_0x53acba['id']+_0xeed1('0x23')+_0x4c9555[_0xeed1('0x24')]})[_0xeed1('0x13')](function(_0x1d4021){if(_0x1d4021[_0xeed1('0x25')]){return _0x463d68[_0xeed1('0x26')]({'messageId':_0x1d4021[_0xeed1('0x25')]});}})[_0xeed1('0x15')](function(_0x4f3e97){logger[_0xeed1('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeed1('0x27'),'twilio',util['inspect'](_0x4f3e97,{'showHidden':![],'depth':null}));});}else{logger[_0xeed1('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xeed1('0x1c'),_0xeed1('0x28'));}break;case'skebby':var _0x4ebb99=_0xeed1('0x29');if(_0x4c9555[_0xeed1('0x2a')]&&_0x4c9555[_0xeed1('0x2b')]){var _0x4b75f4={'recipient':[_0x53acba[_0xeed1('0x1f')]],'message':_0x53acba[_0xeed1('0xa')],'message_type':_0x4c9555[_0xeed1('0x2c')]};if(_0x4c9555[_0xeed1('0x2c')]&&_0x4c9555['smsMethod']!=='SI'){_0x4b75f4[_0xeed1('0x2d')]=_0x4c9555[_0xeed1('0x1f')];}var _0x216461={'url':_0x4ebb99+_0xeed1('0x2e')+_0x4c9555[_0xeed1('0x2a')]+_0xeed1('0x2f')+_0x4c9555[_0xeed1('0x2b')],'method':_0xeed1('0x30')};rp(_0x216461)[_0xeed1('0x13')](function(_0x176055){var _0x1c3e20=_0x176055[_0xeed1('0x31')](';');var _0x2513ec={'user_key':_0x1c3e20[0x0],'session_key':_0x1c3e20[0x1]};_0x216461={'url':_0x4ebb99+'sms','method':_0xeed1('0x32'),'headers':{'user_key':_0x2513ec['user_key'],'Session_key':_0x2513ec[_0xeed1('0x33')]},'json':!![],'body':_0x4b75f4};return rp(_0x216461);})[_0xeed1('0x13')](function(_0xbe34af){if(_0xbe34af[_0xeed1('0x34')]>=0x1){var _0x194a89={'messageId':_0xbe34af[_0xeed1('0x35')]};if(_0x4c9555[_0xeed1('0x2c')]!=='GP'||!_0x4c9555[_0xeed1('0x36')]){_0x194a89[_0xeed1('0x37')]=!![];}return _0x463d68[_0xeed1('0x26')](_0x194a89);}else{return logger[_0xeed1('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeed1('0x27'),_0xeed1('0x38'),util[_0xeed1('0x39')](_0xbe34af,{'showHidden':![],'depth':null}));}})[_0xeed1('0x15')](function(_0x30c502){return logger['error'](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x38'),util[_0xeed1('0x39')](_0x30c502,{'showHidden':![],'depth':null}));});}else{logger[_0xeed1('0x16')](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x38'),_0xeed1('0x3b'));}break;case _0xeed1('0x3c'):if(_0x4c9555[_0xeed1('0x1e')]){var _0x8a0cea={'recipient':_0x53acba[_0xeed1('0x1f')],'message':_0x53acba[_0xeed1('0xa')],'sender':_0x4c9555[_0xeed1('0x3d')]||_0x4c9555[_0xeed1('0x1f')],'authorization':_0x4c9555[_0xeed1('0x1e')]};var _0x64a37c={'method':_0xeed1('0x32'),'uri':_0xeed1('0x3e'),'body':_0x8a0cea,'json':!![]};rp(_0x64a37c)[_0xeed1('0x13')](function(_0x22ad19){var _0x3788dd={'messageId':_0x22ad19[_0xeed1('0x3f')]};if(!_0x4c9555[_0xeed1('0x36')]){_0x3788dd[_0xeed1('0x37')]=!![];}return _0x463d68[_0xeed1('0x26')](_0x3788dd);})['catch'](function(_0x52e4f4){logger[_0xeed1('0x16')](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x3c'),util['inspect'](_0x52e4f4,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeed1('0x27'),_0xeed1('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0xeed1('0x40'):if(_0x4c9555['username']&&_0x4c9555[_0xeed1('0x2b')]){var _0x8a0cea={'messages':[{'source':_0xeed1('0x41'),'to':_0x53acba[_0xeed1('0x1f')],'body':_0x53acba[_0xeed1('0xa')],'from':_0x4c9555[_0xeed1('0x3d')]||_0x4c9555[_0xeed1('0x1f')]}]};var _0x259786=util['format']('%s:%s',_0x4c9555[_0xeed1('0x2a')],_0x4c9555[_0xeed1('0x2b')]);var _0x64a37c={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x8a0cea,'headers':{'Authorization':util[_0xeed1('0x42')](_0xeed1('0x43'),new Buffer(_0x259786)[_0xeed1('0x44')]('base64'))},'json':!![]};rp(_0x64a37c)[_0xeed1('0x13')](function(_0x6f7c60){if(_0x6f7c60['http_code']>=0xc8&&_0x6f7c60[_0xeed1('0x45')]<=0xce){if(_0x6f7c60[_0xeed1('0x46')]&&_0x6f7c60['data'][_0xeed1('0x47')]>0x0){var _0x15c162=_[_0xeed1('0x48')](_0x6f7c60['data'][_0xeed1('0x49')]);var _0x729d3a={'messageId':_0x15c162['message_id']};if(!_0x4c9555[_0xeed1('0x36')]){_0x729d3a[_0xeed1('0x37')]=!![];}return _0x463d68[_0xeed1('0x26')](_0x729d3a);}else{logger[_0xeed1('0x16')](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x4a'),util[_0xeed1('0x39')](_0x6f7c60,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x4a'),util['inspect'](_0x6f7c60,{'showHidden':![],'depth':null}));}})[_0xeed1('0x15')](function(_0x1877b2){logger[_0xeed1('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeed1('0x27'),_0xeed1('0x4a'),util[_0xeed1('0x39')](_0x1877b2,{'showHidden':![],'depth':null}));});}else{logger[_0xeed1('0x16')](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xeed1('0x4b'):if(_0x4c9555[_0xeed1('0x4c')]&&_0x4c9555[_0xeed1('0x1e')]){var _0x8a0cea={'dst':_0x53acba[_0xeed1('0x1f')],'text':_0x53acba[_0xeed1('0xa')],'src':_0x4c9555['senderString']||_0x4c9555['phone'],'url':_0x4c9555[_0xeed1('0x21')]+'/api/sms/messages/'+_0x53acba['id']+'/status?token='+_0x4c9555[_0xeed1('0x24')]};var _0x259786=util[_0xeed1('0x42')](_0xeed1('0x4d'),_0x4c9555[_0xeed1('0x4c')],_0x4c9555[_0xeed1('0x1e')]);var _0x64a37c={'method':_0xeed1('0x32'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x4c9555['authId']),'body':_0x8a0cea,'headers':{'Authorization':util[_0xeed1('0x42')]('Basic\x20%s',new Buffer(_0x259786)[_0xeed1('0x44')](_0xeed1('0x4e')))},'json':!![]};rp(_0x64a37c)['then'](function(_0x2371a6){var _0x412381={'messageId':_0x2371a6['message_uuid'][0x0]};return _0x463d68['update'](_0x412381);})[_0xeed1('0x15')](function(_0x506836){logger['error'](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x4b'),util[_0xeed1('0x39')](_0x506836,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xeed1('0x4b'),_0xeed1('0x4f'));}break;case'infobip':if(_0x4c9555['username']&&_0x4c9555['password']){if(_0x4c9555[_0xeed1('0x50')]){var _0x596990={'method':'POST','uri':_0x4c9555[_0xeed1('0x50')]+_0xeed1('0x51'),'body':{'username':_0x4c9555[_0xeed1('0x2a')],'password':_0x4c9555[_0xeed1('0x2b')]},'json':!![]};return rp(_0x596990)[_0xeed1('0x13')](function(_0x1548fd){var _0x3c5f53={'method':_0xeed1('0x32'),'uri':_0x4c9555['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x4c9555[_0xeed1('0x1f')],'destinations':[{'to':_0x53acba['phone']}],'text':_0x53acba[_0xeed1('0xa')],'notifyUrl':_0x4c9555[_0xeed1('0x21')]+_0xeed1('0x22')+_0x53acba['id']+_0xeed1('0x23')+_0x4c9555[_0xeed1('0x24')],'notifyContentType':'application/json','callbackData':_0x4c9555[_0xeed1('0x1f')]+';'+_0x53acba[_0xeed1('0xa')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x1548fd['token']},'json':!![]};return rp(_0x3c5f53)[_0xeed1('0x13')](function(_0x20ed03){if(_0x20ed03[_0xeed1('0x49')]){var _0x2418eb={'messageId':_0x20ed03[_0xeed1('0x49')][0x0]['messageId']};if(!_0x4c9555['deliveryReport']){_0x2418eb[_0xeed1('0x37')]=!![];}return _0x463d68[_0xeed1('0x26')](_0x2418eb);}else{return logger[_0xeed1('0x16')](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x52'),util[_0xeed1('0x39')](_0x20ed03,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x1c03fc){return logger[_0xeed1('0x16')](_0xeed1('0x3a'),'afterCreate','infobip',util[_0xeed1('0x39')](_0x1c03fc,{'showHidden':![],'depth':null}));});}else{logger[_0xeed1('0x16')](_0xeed1('0x3a'),_0xeed1('0x27'),'infobip',_0xeed1('0x53'));}}else{logger[_0xeed1('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0xeed1('0x3b'));}break;case'csc':var _0x2a0099=require(_0xeed1('0x54'));if(_0x4c9555[_0xeed1('0x55')]){var _0xc34dd7={};_0xc34dd7[_0xeed1('0x56')]=_0x4c9555[_0xeed1('0x2a')];_0xc34dd7[_0xeed1('0x1f')]=_0x53acba[_0xeed1('0x1f')];_0xc34dd7[_0xeed1('0x2d')]=_0x4c9555[_0xeed1('0x1f')];_0xc34dd7[_0xeed1('0x57')]=_0x53acba[_0xeed1('0xa')];_0xc34dd7[_0xeed1('0x58')]=+new Date();var _0x10ba16='';var _0x5a5b09='';var _0x120063=Object[_0xeed1('0x59')](_0xc34dd7);_0x120063[_0xeed1('0x5a')]();for(var _0x2a3428=0x0;_0x2a3428<_0x120063[_0xeed1('0x5b')];_0x2a3428++){if(_0x10ba16!=''){_0x10ba16+='&';}_0x10ba16+=_0x120063[_0x2a3428]+'='+encodeURIComponent(_0xc34dd7[_0x120063[_0x2a3428]]);_0x5a5b09+=_0xc34dd7[_0x120063[_0x2a3428]];}_0x5a5b09+=_0x4c9555['apiKey'];_0x5a5b09=_0x2a0099[_0xeed1('0x5c')](_0xeed1('0x5d'))[_0xeed1('0x26')](_0x5a5b09)['digest'](_0xeed1('0x5e'));if(_0x10ba16!==''){_0x10ba16+='&';}_0x10ba16+='signature='+_0x5a5b09;var _0x216461={'method':'GET','uri':_0x4c9555[_0xeed1('0x50')]+'/external/get/send.php?'+_0x10ba16,'json':!![]};return rp(_0x216461)['then'](function(_0x6f5c7b){var _0x3afa81=Object[_0xeed1('0x59')](_0x6f5c7b);if(_0x6f5c7b[_0x3afa81[0x0]]['error']&&parseInt(_0x6f5c7b[_0x3afa81[0x0]][_0xeed1('0x16')])===0x0){var _0x2afacf={'messageId':_0x6f5c7b[_0x3afa81[0x0]][_0xeed1('0x5f')]};if(!_0x4c9555[_0xeed1('0x36')]){_0x2afacf[_0xeed1('0x37')]=!![];}return _0x463d68[_0xeed1('0x26')](_0x2afacf);}else{return logger[_0xeed1('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeed1('0x27'),_0xeed1('0x60'),util[_0xeed1('0x39')](_0x6f5c7b[_0xeed1('0x16')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x16aefb){return logger[_0xeed1('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeed1('0x27'),_0xeed1('0x60'),util[_0xeed1('0x39')](_0x16aefb,{'showHidden':![],'depth':null}));});}else{logger[_0xeed1('0x16')](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x60'),'Missing\x20parameters:\x20apiKey');}break;case _0xeed1('0x61'):if(_0x4c9555['apiKey']){var _0x45dbc5={'method':_0xeed1('0x32'),'uri':_0xeed1('0x62'),'headers':{'Authorization':_0x4c9555[_0xeed1('0x55')]},'body':{'content':_0x53acba[_0xeed1('0xa')],'to':[_0x53acba[_0xeed1('0x1f')]],'from':_0x4c9555['phone'],'binary':![],'clientMessageId':'uuid','charset':_0xeed1('0x63')},'json':!![]};rp(_0x45dbc5)['then'](function(_0x2100ec){if(!_0x2100ec[_0xeed1('0x16')]){var _0x11d33c={'messageId':_0x2100ec[_0xeed1('0x49')][0x0][_0xeed1('0x64')]};if(!_0x4c9555[_0xeed1('0x36')]){_0x11d33c[_0xeed1('0x37')]=!![];}return _0x463d68[_0xeed1('0x26')](_0x11d33c);}else{return logger['error'](_0xeed1('0x3a'),'afterCreate','clickatell',util['inspect'](_0x2100ec['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4ccc15){return logger['error'](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x61'),util['inspect'](_0x4ccc15,{'showHidden':![],'depth':null}));});}else{logger[_0xeed1('0x16')](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x61'),_0xeed1('0x65'));}break;case _0xeed1('0x66'):if(_0x4c9555[_0xeed1('0x2a')]&&_0x4c9555[_0xeed1('0x2b')]){var _0x259786=util[_0xeed1('0x42')]('%s:%s',_0x4c9555[_0xeed1('0x2a')],_0x4c9555[_0xeed1('0x2b')]);var _0x64a37c={'method':_0xeed1('0x32'),'uri':_0xeed1('0x67')+_0x4c9555[_0xeed1('0x68')]+_0xeed1('0x69'),'body':{'to':[_0x53acba[_0xeed1('0x1f')]],'text':_0x53acba['body'],'from':_0x4c9555[_0xeed1('0x1f')],'applicationId':_0x4c9555[_0xeed1('0x6a')]},'headers':{'Authorization':util[_0xeed1('0x42')](_0xeed1('0x43'),new Buffer(_0x259786)[_0xeed1('0x44')](_0xeed1('0x4e')))},'json':!![]};rp(_0x64a37c)[_0xeed1('0x13')](function(_0x1eb8d2){if(_0x1eb8d2['id']){var _0x16509e={'messageId':_0x1eb8d2['id']};return _0x463d68[_0xeed1('0x26')](_0x16509e);}else{logger['error'](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x66'),util[_0xeed1('0x39')](_0x1eb8d2,{'showHidden':![],'depth':null}));}})[_0xeed1('0x15')](function(_0x3ea499){logger[_0xeed1('0x16')](_0xeed1('0x3a'),'afterCreate',_0xeed1('0x66'),util['inspect'](_0x3ea499,{'showHidden':![],'depth':null}));});}else{logger[_0xeed1('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeed1('0x27'),_0xeed1('0x66'),_0xeed1('0x3b'));}break;case _0xeed1('0x6b'):if(_0x4c9555[_0xeed1('0x55')]){var _0x3e34c1={};var _0x216461={'method':_0xeed1('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xeed1('0x6c')+_0x4c9555[_0xeed1('0x55')],'Content-Type':_0xeed1('0x6d')},'body':{'from':_0x4c9555[_0xeed1('0x1f')],'to':_0x53acba[_0xeed1('0x1f')],'text':_0x53acba[_0xeed1('0xa')]},'json':!![]};return rp(_0x216461)[_0xeed1('0x13')](function(_0x5f44c3){if(_0x5f44c3[_0xeed1('0x6e')]==0xca){_0x3e34c1['message']=_0x5f44c3;var _0x12996a={'method':_0xeed1('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xeed1('0x6c')+_0x4c9555['apiKey'],'Content-Type':_0xeed1('0x6d')},'body':{'refid':_0x3e34c1[_0xeed1('0x6f')][_0xeed1('0x70')]},'json':!![]};return rp(_0x12996a)['then'](function(_0x52e09e){_0x3e34c1[_0xeed1('0x71')]=_0x52e09e;var _0x1b3012={'messageId':_0x3e34c1[_0xeed1('0x6f')]['refid'],'read':!![]};return _0x463d68[_0xeed1('0x26')](_0x1b3012);});}else{return logger['error'](_0xeed1('0x3a'),_0xeed1('0x27'),'intelepeer',util['inspect'](_0x5f44c3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x45ad99){return logger[_0xeed1('0x16')](_0xeed1('0x3a'),_0xeed1('0x27'),_0xeed1('0x6b'),util[_0xeed1('0x39')](_0x45ad99,{'showHidden':![],'depth':null}));});}else{return logger[_0xeed1('0x16')](_0xeed1('0x3a'),_0xeed1('0x27'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xeed1('0x72')](function(){_0x1cab2c();});}else{_0x1cab2c();}}},'charset':_0xeed1('0x73'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index bf1a9e8..8b998e6 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 _0x2b5f=['message','catch','create','body','options','raw','debug','CreateSmsMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x421e36,_0x18776e){var _0x20b3e3=function(_0x767de4){while(--_0x767de4){_0x421e36['push'](_0x421e36['shift']());}};_0x20b3e3(++_0x18776e);}(_0x2b5f,0x15d));var _0xf2b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2b5f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf2b5('0x0'));var util=require('util');var moment=require(_0xf2b5('0x1'));var BPromise=require(_0xf2b5('0x2'));var rs=require(_0xf2b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2b5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2b5('0x5'))(_0xf2b5('0x6'));var config=require('../../config/environment');var jayson=require(_0xf2b5('0x7'));var client=jayson[_0xf2b5('0x8')][_0xf2b5('0x9')]({'port':0x232a});config[_0xf2b5('0xa')]=_[_0xf2b5('0xb')](config[_0xf2b5('0xa')],{'host':_0xf2b5('0xc'),'port':0x18eb});var socket=require(_0xf2b5('0xd'))(new Redis(config['redis']));require(_0xf2b5('0xe'))['register'](socket);function respondWithRpcPromise(_0x197a9f,_0x49231f,_0x2d7b97){return new BPromise(function(_0x18ed2e,_0x3ac3ec){return client[_0xf2b5('0xf')](_0x197a9f,_0x2d7b97)[_0xf2b5('0x10')](function(_0x38ff82){logger[_0xf2b5('0x11')](_0xf2b5('0x12'),_0x49231f,_0xf2b5('0x13'));logger['debug'](_0xf2b5('0x14'),_0x49231f,_0xf2b5('0x13'),JSON[_0xf2b5('0x15')](_0x38ff82));if(_0x38ff82[_0xf2b5('0x16')]){if(_0x38ff82[_0xf2b5('0x16')]['code']===0x1f4){logger[_0xf2b5('0x16')]('SmsMessage,\x20%s,\x20%s',_0x49231f,_0x38ff82[_0xf2b5('0x16')][_0xf2b5('0x17')]);return _0x3ac3ec(_0x38ff82['error'][_0xf2b5('0x17')]);}logger[_0xf2b5('0x16')](_0xf2b5('0x12'),_0x49231f,_0x38ff82[_0xf2b5('0x16')][_0xf2b5('0x17')]);return _0x18ed2e(_0x38ff82[_0xf2b5('0x16')][_0xf2b5('0x17')]);}else{logger['info'](_0xf2b5('0x12'),_0x49231f,_0xf2b5('0x13'));_0x18ed2e(_0x38ff82['result']['message']);}})[_0xf2b5('0x18')](function(_0x3c1281){logger[_0xf2b5('0x16')](_0xf2b5('0x12'),_0x49231f,_0x3c1281);_0x3ac3ec(_0x3c1281);});});}exports['CreateSmsMessage']=function(_0x34247a){var _0x26dafa=this;return new Promise(function(_0x1d93bb,_0xfdafe4){return db['SmsMessage'][_0xf2b5('0x19')](_0x34247a[_0xf2b5('0x1a')],{'raw':_0x34247a[_0xf2b5('0x1b')]?_0x34247a[_0xf2b5('0x1b')][_0xf2b5('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x39fbbc){logger[_0xf2b5('0x11')]('CreateSmsMessage',_0x34247a);logger[_0xf2b5('0x1d')](_0xf2b5('0x1e'),_0x34247a,JSON[_0xf2b5('0x15')](_0x39fbbc));_0x1d93bb(_0x39fbbc);})[_0xf2b5('0x18')](function(_0x26fa10){logger['error'](_0xf2b5('0x1e'),_0x26fa10['message'],_0x34247a);_0xfdafe4(_0x26dafa[_0xf2b5('0x16')](0x1f4,_0x26fa10[_0xf2b5('0x17')]));});});}; \ No newline at end of file +var _0xdaa9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','create','options','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1dda13,_0x1df427){var _0xc76aa6=function(_0x4ac95f){while(--_0x4ac95f){_0x1dda13['push'](_0x1dda13['shift']());}};_0xc76aa6(++_0x1df427);}(_0xdaa9,0x77));var _0x9daa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdaa9[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x9daa('0x0'));var moment=require(_0x9daa('0x1'));var BPromise=require(_0x9daa('0x2'));var rs=require(_0x9daa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9daa('0x4'))['db'];var utils=require(_0x9daa('0x5'));var logger=require(_0x9daa('0x6'))('rpc');var config=require(_0x9daa('0x7'));var jayson=require(_0x9daa('0x8'));var client=jayson[_0x9daa('0x9')][_0x9daa('0xa')]({'port':0x232a});config['redis']=_[_0x9daa('0xb')](config[_0x9daa('0xc')],{'host':_0x9daa('0xd'),'port':0x18eb});var socket=require(_0x9daa('0xe'))(new Redis(config['redis']));require(_0x9daa('0xf'))['register'](socket);function respondWithRpcPromise(_0x532d8a,_0x4e174c,_0x314b7b){return new BPromise(function(_0x467c3e,_0x2dc06f){return client['request'](_0x532d8a,_0x314b7b)[_0x9daa('0x10')](function(_0x30a6f9){logger[_0x9daa('0x11')](_0x9daa('0x12'),_0x4e174c,_0x9daa('0x13'));logger[_0x9daa('0x14')](_0x9daa('0x15'),_0x4e174c,_0x9daa('0x13'),JSON[_0x9daa('0x16')](_0x30a6f9));if(_0x30a6f9[_0x9daa('0x17')]){if(_0x30a6f9[_0x9daa('0x17')][_0x9daa('0x18')]===0x1f4){logger['error'](_0x9daa('0x12'),_0x4e174c,_0x30a6f9[_0x9daa('0x17')][_0x9daa('0x19')]);return _0x2dc06f(_0x30a6f9[_0x9daa('0x17')][_0x9daa('0x19')]);}logger[_0x9daa('0x17')]('SmsMessage,\x20%s,\x20%s',_0x4e174c,_0x30a6f9['error'][_0x9daa('0x19')]);return _0x467c3e(_0x30a6f9['error'][_0x9daa('0x19')]);}else{logger[_0x9daa('0x11')](_0x9daa('0x12'),_0x4e174c,_0x9daa('0x13'));_0x467c3e(_0x30a6f9[_0x9daa('0x1a')][_0x9daa('0x19')]);}})[_0x9daa('0x1b')](function(_0x927700){logger[_0x9daa('0x17')](_0x9daa('0x12'),_0x4e174c,_0x927700);_0x2dc06f(_0x927700);});});}exports[_0x9daa('0x1c')]=function(_0x5cc59b){var _0x1db55d=this;return new Promise(function(_0x3f595c,_0x584d3b){return db['SmsMessage'][_0x9daa('0x1d')](_0x5cc59b['body'],{'raw':_0x5cc59b[_0x9daa('0x1e')]?_0x5cc59b['options']['raw']===undefined?!![]:![]:!![]})[_0x9daa('0x10')](function(_0x3345f3){logger[_0x9daa('0x11')](_0x9daa('0x1c'),_0x5cc59b);logger['debug'](_0x9daa('0x1c'),_0x5cc59b,JSON[_0x9daa('0x16')](_0x3345f3));_0x3f595c(_0x3345f3);})[_0x9daa('0x1b')](function(_0x40e0f5){logger['error']('CreateSmsMessage',_0x40e0f5[_0x9daa('0x19')],_0x5cc59b);_0x584d3b(_0x1db55d['error'](0x1f4,_0x40e0f5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 985b0f7..056a5ab 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 _0xa51a=['removeListener','smsMessage:','./smsMessage.events','save','remove'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa51a,0x115));var _0xaa51=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xa51a[_0x513aa5];return _0x1a1a7c;};'use strict';var SmsMessageEvents=require(_0xaa51('0x0'));var events=[_0xaa51('0x1'),_0xaa51('0x2'),'update'];function createListener(_0x5b4969,_0x41eaf0){return function(_0x5d9be9){_0x41eaf0['emit'](_0x5b4969,_0x5d9be9);};}function removeListener(_0x15ba40,_0x267581){return function(){SmsMessageEvents[_0xaa51('0x3')](_0x15ba40,_0x267581);};}exports['register']=function(_0x5f1bae){for(var _0x5d1fd3=0x0,_0x321137=events['length'];_0x5d1fd3<_0x321137;_0x5d1fd3++){var _0x34c932=events[_0x5d1fd3];var _0x5e97da=createListener(_0xaa51('0x4')+_0x34c932,_0x5f1bae);SmsMessageEvents['on'](_0x34c932,_0x5e97da);}}; \ No newline at end of file +var _0xbcc4=['smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x4cdcb8,_0x93f8cb){var _0xa4ae34=function(_0x2bbe5c){while(--_0x2bbe5c){_0x4cdcb8['push'](_0x4cdcb8['shift']());}};_0xa4ae34(++_0x93f8cb);}(_0xbcc4,0x69));var _0x4bcc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbcc4[_0x19e35c];return _0x3e1fe8;};'use strict';var SmsMessageEvents=require(_0x4bcc('0x0'));var events=[_0x4bcc('0x1'),_0x4bcc('0x2'),_0x4bcc('0x3')];function createListener(_0x2d19eb,_0x407c35){return function(_0x76d413){_0x407c35[_0x4bcc('0x4')](_0x2d19eb,_0x76d413);};}function removeListener(_0xa80ecb,_0x477df6){return function(){SmsMessageEvents[_0x4bcc('0x5')](_0xa80ecb,_0x477df6);};}exports['register']=function(_0x1732a0){for(var _0x3bc370=0x0,_0x343d93=events[_0x4bcc('0x6')];_0x3bc370<_0x343d93;_0x3bc370++){var _0x38d1a0=events[_0x3bc370];var _0x2b1387=createListener(_0x4bcc('0x7')+_0x38d1a0,_0x1732a0);SmsMessageEvents['on'](_0x38d1a0,_0x2b1387);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7382980..cfe04b8 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 _0xd54f=['get','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xd54f,0x6b));var _0xfd54=function(_0x18af13,_0x1a0693){_0x18af13=_0x18af13-0x0;var _0x37a567=_0xd54f[_0x18af13];return _0x37a567;};'use strict';var multer=require(_0xfd54('0x0'));var util=require(_0xfd54('0x1'));var path=require(_0xfd54('0x2'));var timeout=require(_0xfd54('0x3'));var express=require('express');var router=express[_0xfd54('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfd54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfd54('0x6'));var controller=require(_0xfd54('0x7'));router['get']('/',auth[_0xfd54('0x8')](),controller['index']);router[_0xfd54('0x9')](_0xfd54('0xa'),auth['isAuthenticated'](),controller[_0xfd54('0xb')]);router['get'](_0xfd54('0xc'),auth[_0xfd54('0x8')](),controller[_0xfd54('0xd')]);router[_0xfd54('0x9')](_0xfd54('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xfd54('0x9')](_0xfd54('0xf'),auth[_0xfd54('0x8')](),controller[_0xfd54('0x10')]);router['get'](_0xfd54('0x11'),auth[_0xfd54('0x8')](),controller[_0xfd54('0x12')]);router[_0xfd54('0x13')]('/',auth[_0xfd54('0x8')](),controller[_0xfd54('0x14')]);router['post'](_0xfd54('0xf'),auth['isAuthenticated'](),controller[_0xfd54('0x15')]);router[_0xfd54('0x13')](_0xfd54('0x11'),auth['isAuthenticated'](),controller[_0xfd54('0x16')]);router[_0xfd54('0x17')](_0xfd54('0xc'),auth[_0xfd54('0x8')](),controller[_0xfd54('0x18')]);router[_0xfd54('0x19')](_0xfd54('0xc'),auth['isAuthenticated'](),controller[_0xfd54('0x1a')]);router['delete'](_0xfd54('0xf'),auth[_0xfd54('0x8')](),controller['removeTeams']);router[_0xfd54('0x19')](_0xfd54('0x11'),auth[_0xfd54('0x8')](),controller[_0xfd54('0x1b')]);module[_0xfd54('0x1c')]=router; \ No newline at end of file +var _0xac64=['addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users'];(function(_0x24dedb,_0x116fe6){var _0x4220b2=function(_0x1bf700){while(--_0x1bf700){_0x24dedb['push'](_0x24dedb['shift']());}};_0x4220b2(++_0x116fe6);}(_0xac64,0x158));var _0x4ac6=function(_0x2377ee,_0x155192){_0x2377ee=_0x2377ee-0x0;var _0x22c38b=_0xac64[_0x2377ee];return _0x22c38b;};'use strict';var multer=require('multer');var util=require(_0x4ac6('0x0'));var path=require(_0x4ac6('0x1'));var timeout=require(_0x4ac6('0x2'));var express=require('express');var router=express[_0x4ac6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4ac6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4ac6('0x5'));var controller=require('./smsQueue.controller');router[_0x4ac6('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4ac6('0x6')](_0x4ac6('0x7'),auth['isAuthenticated'](),controller[_0x4ac6('0x8')]);router[_0x4ac6('0x6')](_0x4ac6('0x9'),auth[_0x4ac6('0xa')](),controller[_0x4ac6('0xb')]);router[_0x4ac6('0x6')](_0x4ac6('0xc'),auth[_0x4ac6('0xa')](),controller['getMembers']);router['get'](_0x4ac6('0xd'),auth[_0x4ac6('0xa')](),controller[_0x4ac6('0xe')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x4ac6('0xf')]);router[_0x4ac6('0x10')]('/',auth[_0x4ac6('0xa')](),controller[_0x4ac6('0x11')]);router['post'](_0x4ac6('0xd'),auth[_0x4ac6('0xa')](),controller[_0x4ac6('0x12')]);router[_0x4ac6('0x10')](_0x4ac6('0x13'),auth['isAuthenticated'](),controller[_0x4ac6('0x14')]);router[_0x4ac6('0x15')](_0x4ac6('0x9'),auth[_0x4ac6('0xa')](),controller[_0x4ac6('0x16')]);router['delete']('/:id',auth[_0x4ac6('0xa')](),controller[_0x4ac6('0x17')]);router[_0x4ac6('0x18')](_0x4ac6('0xd'),auth[_0x4ac6('0xa')](),controller[_0x4ac6('0x19')]);router['delete'](_0x4ac6('0x13'),auth['isAuthenticated'](),controller[_0x4ac6('0x1a')]);module[_0x4ac6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 0423c09..e0b5af6 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 _0x065b=['sequelize','STRING','INTEGER','ENUM','beepall','roundrobin'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x065b,0x150));var _0xb065=function(_0x390143,_0x2b54ac){_0x390143=_0x390143-0x0;var _0x11361b=_0x065b[_0x390143];return _0x11361b;};'use strict';var Sequelize=require(_0xb065('0x0'));module['exports']={'name':{'type':Sequelize[_0xb065('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb065('0x1')]},'timeout':{'type':Sequelize[_0xb065('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb065('0x3')]('rrmemory',_0xb065('0x4'),_0xb065('0x5'))}}; \ No newline at end of file +var _0x0db0=['roundrobin','STRING','INTEGER','ENUM','beepall'];(function(_0x4decb9,_0x413568){var _0x5a0f6a=function(_0x4b03a9){while(--_0x4b03a9){_0x4decb9['push'](_0x4decb9['shift']());}};_0x5a0f6a(++_0x413568);}(_0x0db0,0x6a));var _0x00db=function(_0x56a69f,_0x1bf698){_0x56a69f=_0x56a69f-0x0;var _0x1cb629=_0x0db0[_0x56a69f];return _0x1cb629;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x00db('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x00db('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x00db('0x2')]('rrmemory',_0x00db('0x3'),_0x00db('0x4'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index eed39ef..408156f 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 _0x6cf0=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','SmsQueue','includeAll','include','findAll','rows','catch','show','params','length','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','interface','sequelize','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','user_has_teams','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','message','agent','interaction','index','map'];(function(_0x1431ea,_0x17ceaa){var _0x5c282a=function(_0x511250){while(--_0x511250){_0x1431ea['push'](_0x1431ea['shift']());}};_0x5c282a(++_0x17ceaa);}(_0x6cf0,0x1ef));var _0x06cf=function(_0x3acb2e,_0x243552){_0x3acb2e=_0x3acb2e-0x0;var _0x48b407=_0x6cf0[_0x3acb2e];return _0x48b407;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06cf('0x0'));var zipdir=require(_0x06cf('0x1'));var jsonpatch=require(_0x06cf('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x06cf('0x3'));var util=require(_0x06cf('0x4'));var path=require(_0x06cf('0x5'));var sox=require(_0x06cf('0x6'));var csv=require(_0x06cf('0x7'));var ejs=require(_0x06cf('0x8'));var fs=require('fs');var fs_extra=require(_0x06cf('0x9'));var _=require(_0x06cf('0xa'));var squel=require(_0x06cf('0xb'));var crypto=require(_0x06cf('0xc'));var jsforce=require(_0x06cf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x06cf('0x7'));var querystring=require(_0x06cf('0xe'));var Papa=require('papaparse');var Redis=require(_0x06cf('0xf'));var authService=require(_0x06cf('0x10'));var qs=require(_0x06cf('0x11'));var as=require(_0x06cf('0x12'));var hardwareService=require(_0x06cf('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x06cf('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x06cf('0x15'))['db'];config[_0x06cf('0x16')]=_['defaults'](config['redis'],{'host':_0x06cf('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x06cf('0x16')]));require('./smsQueue.socket')[_0x06cf('0x18')](socket);function respondWithStatusCode(_0xbb54c0,_0x2d78a7){_0x2d78a7=_0x2d78a7||0xcc;return function(_0x3ce161){if(_0x3ce161){return _0xbb54c0[_0x06cf('0x19')](_0x2d78a7);}return _0xbb54c0[_0x06cf('0x1a')](_0x2d78a7)[_0x06cf('0x1b')]();};}function respondWithResult(_0x222b5d,_0x3d73c5){_0x3d73c5=_0x3d73c5||0xc8;return function(_0x4285dd){if(_0x4285dd){return _0x222b5d[_0x06cf('0x1a')](_0x3d73c5)[_0x06cf('0x1c')](_0x4285dd);}};}function respondWithFilteredResult(_0x921ada,_0x90ccaf){return function(_0x401363){if(_0x401363){var _0x20bbd9=typeof _0x90ccaf['offset']==='undefined'&&typeof _0x90ccaf['limit']===_0x06cf('0x1d');var _0x529837=_0x401363[_0x06cf('0x1e')];var _0x920ee2=_0x20bbd9?0x0:_0x90ccaf[_0x06cf('0x1f')];var _0x2c5792=_0x20bbd9?_0x401363[_0x06cf('0x1e')]:_0x90ccaf[_0x06cf('0x1f')]+_0x90ccaf[_0x06cf('0x20')];var _0x1baf0a;if(_0x2c5792>=_0x529837){_0x2c5792=_0x529837;_0x1baf0a=0xc8;}else{_0x1baf0a=0xce;}_0x921ada[_0x06cf('0x1a')](_0x1baf0a);return _0x921ada['set'](_0x06cf('0x21'),_0x920ee2+'-'+_0x2c5792+'/'+_0x529837)[_0x06cf('0x1c')](_0x401363);}return null;};}function patchUpdates(_0x3d7032){return function(_0x58ce8b){try{jsonpatch[_0x06cf('0x22')](_0x58ce8b,_0x3d7032,!![]);}catch(_0x4f17c1){return BPromise[_0x06cf('0x23')](_0x4f17c1);}return _0x58ce8b[_0x06cf('0x24')]();};}function saveUpdates(_0x19082b,_0x1ce499){return function(_0x457a4a){if(_0x457a4a){return _0x457a4a[_0x06cf('0x25')](_0x19082b)[_0x06cf('0x26')](function(_0x3b0b93){return _0x3b0b93;});}return null;};}function removeEntity(_0x137520,_0xcdd2c1){return function(_0x2c88e5){if(_0x2c88e5){return _0x2c88e5[_0x06cf('0x27')]()['then'](function(){var _0x38c65c=_0x2c88e5[_0x06cf('0x28')]({'plain':!![]});var _0x23b559='SmsQueues';return db['UserProfileResource'][_0x06cf('0x27')]({'where':{'type':_0x23b559,'resourceId':_0x38c65c['id']}})[_0x06cf('0x26')](function(){return _0x2c88e5;});})[_0x06cf('0x26')](function(){_0x137520[_0x06cf('0x1a')](0xcc)[_0x06cf('0x1b')]();});}};}function handleEntityNotFound(_0x109ecb,_0x5e800e){return function(_0x172809){if(!_0x172809){_0x109ecb['sendStatus'](0x194);}return _0x172809;};}function handleError(_0xcce2cd,_0x55a442){_0x55a442=_0x55a442||0x1f4;return function(_0x39feaf){logger[_0x06cf('0x29')](_0x39feaf[_0x06cf('0x2a')]);if(_0x39feaf[_0x06cf('0x2b')]){delete _0x39feaf[_0x06cf('0x2b')];}_0xcce2cd[_0x06cf('0x1a')](_0x55a442)['send'](_0x39feaf);};}function getMustacheRender(_0x37dc33,_0x465f23){return Mustache['render'](_0x37dc33,_['merge'](_0x465f23['body'],{'contact':_0x465f23['contact'],'message':_0x465f23[_0x06cf('0x2c')],'agent':_0x465f23[_0x06cf('0x2d')],'interaction':_0x465f23[_0x06cf('0x2e')],'account':_0x465f23['account']}))||'';}exports[_0x06cf('0x2f')]=function(_0x43bedd,_0x56be1d){var _0x67c5c2={},_0x3f9413={},_0x13f523={'count':0x0,'rows':[]};var _0x1b06ad=_[_0x06cf('0x30')](db['SmsQueue'][_0x06cf('0x31')],function(_0x36c590){return{'name':_0x36c590[_0x06cf('0x32')],'type':_0x36c590[_0x06cf('0x33')][_0x06cf('0x34')]};});_0x3f9413[_0x06cf('0x35')]=_['map'](_0x1b06ad,_0x06cf('0x2b'));_0x3f9413[_0x06cf('0x36')]=_[_0x06cf('0x37')](_0x43bedd[_0x06cf('0x36')]);_0x3f9413['filters']=_[_0x06cf('0x38')](_0x3f9413[_0x06cf('0x35')],_0x3f9413[_0x06cf('0x36')]);_0x67c5c2[_0x06cf('0x39')]=_[_0x06cf('0x38')](_0x3f9413['model'],qs[_0x06cf('0x3a')](_0x43bedd[_0x06cf('0x36')][_0x06cf('0x3a')]));_0x67c5c2['attributes']=_0x67c5c2[_0x06cf('0x39')]['length']?_0x67c5c2['attributes']:_0x3f9413[_0x06cf('0x35')];if(!_0x43bedd['query'][_0x06cf('0x3b')](_0x06cf('0x3c'))){_0x67c5c2[_0x06cf('0x20')]=qs[_0x06cf('0x20')](_0x43bedd[_0x06cf('0x36')]['limit']);_0x67c5c2[_0x06cf('0x1f')]=qs['offset'](_0x43bedd[_0x06cf('0x36')][_0x06cf('0x1f')]);}_0x67c5c2[_0x06cf('0x3d')]=qs[_0x06cf('0x3e')](_0x43bedd[_0x06cf('0x36')]['sort']);_0x67c5c2[_0x06cf('0x3f')]=qs[_0x06cf('0x40')](_[_0x06cf('0x41')](_0x43bedd[_0x06cf('0x36')],_0x3f9413[_0x06cf('0x40')]),_0x1b06ad);if(_0x43bedd[_0x06cf('0x36')][_0x06cf('0x42')]){_0x67c5c2[_0x06cf('0x3f')]=_['merge'](_0x67c5c2[_0x06cf('0x3f')],{'$or':_[_0x06cf('0x30')](_0x1b06ad,function(_0x32e540){if(_0x32e540[_0x06cf('0x33')]!=='VIRTUAL'){var _0xe39219={};_0xe39219[_0x32e540[_0x06cf('0x2b')]]={'$like':'%'+_0x43bedd[_0x06cf('0x36')][_0x06cf('0x42')]+'%'};return _0xe39219;}})});}_0x67c5c2=_['merge']({},_0x67c5c2,_0x43bedd[_0x06cf('0x43')]);var _0x33b743={'where':_0x67c5c2[_0x06cf('0x3f')]};return db[_0x06cf('0x44')][_0x06cf('0x1e')](_0x33b743)[_0x06cf('0x26')](function(_0x18aea2){_0x13f523[_0x06cf('0x1e')]=_0x18aea2;if(_0x43bedd['query'][_0x06cf('0x45')]){_0x67c5c2[_0x06cf('0x46')]=[{'all':!![]}];}return db[_0x06cf('0x44')][_0x06cf('0x47')](_0x67c5c2);})[_0x06cf('0x26')](function(_0x6df406){_0x13f523[_0x06cf('0x48')]=_0x6df406;return _0x13f523;})[_0x06cf('0x26')](respondWithFilteredResult(_0x56be1d,_0x67c5c2))[_0x06cf('0x49')](handleError(_0x56be1d,null));};exports[_0x06cf('0x4a')]=function(_0x28869a,_0x18f567){var _0x1bdcfd={'raw':!![],'where':{'id':_0x28869a[_0x06cf('0x4b')]['id']}},_0x24667c={};_0x24667c[_0x06cf('0x35')]=_[_0x06cf('0x37')](db[_0x06cf('0x44')]['rawAttributes']);_0x24667c[_0x06cf('0x36')]=_[_0x06cf('0x37')](_0x28869a[_0x06cf('0x36')]);_0x24667c[_0x06cf('0x40')]=_[_0x06cf('0x38')](_0x24667c[_0x06cf('0x35')],_0x24667c[_0x06cf('0x36')]);_0x1bdcfd[_0x06cf('0x39')]=_[_0x06cf('0x38')](_0x24667c[_0x06cf('0x35')],qs[_0x06cf('0x3a')](_0x28869a[_0x06cf('0x36')][_0x06cf('0x3a')]));_0x1bdcfd[_0x06cf('0x39')]=_0x1bdcfd[_0x06cf('0x39')][_0x06cf('0x4c')]?_0x1bdcfd['attributes']:_0x24667c[_0x06cf('0x35')];if(_0x28869a[_0x06cf('0x36')][_0x06cf('0x45')]){_0x1bdcfd['include']=[{'all':!![]}];}_0x1bdcfd=_[_0x06cf('0x4d')]({},_0x1bdcfd,_0x28869a['options']);return db['SmsQueue']['find'](_0x1bdcfd)['then'](handleEntityNotFound(_0x18f567,null))[_0x06cf('0x26')](respondWithResult(_0x18f567,null))['catch'](handleError(_0x18f567,null));};exports[_0x06cf('0x4e')]=function(_0x36c3a7,_0x257e7f){return db['SmsQueue'][_0x06cf('0x4e')](_0x36c3a7[_0x06cf('0x4f')],{})[_0x06cf('0x26')](function(_0x320611){var _0x1e8d0a=_0x36c3a7[_0x06cf('0x50')]['get']({'plain':!![]});if(!_0x1e8d0a)throw new Error(_0x06cf('0x51'));if(_0x1e8d0a[_0x06cf('0x52')]===_0x06cf('0x50')){var _0x1e3997=_0x320611['get']({'plain':!![]});var _0x1d0630=_0x06cf('0x53');return db[_0x06cf('0x54')][_0x06cf('0x55')]({'where':{'name':_0x1d0630,'userProfileId':_0x1e8d0a[_0x06cf('0x56')]},'raw':!![]})[_0x06cf('0x26')](function(_0x200116){if(_0x200116&&_0x200116[_0x06cf('0x57')]===0x0){return db['UserProfileResource'][_0x06cf('0x4e')]({'name':_0x1e3997[_0x06cf('0x2b')],'resourceId':_0x1e3997['id'],'type':_0x200116['name'],'sectionId':_0x200116['id']},{})['then'](function(){return _0x320611;});}else{return _0x320611;}})[_0x06cf('0x49')](function(_0x567c6e){logger[_0x06cf('0x29')](_0x06cf('0x58'),_0x567c6e);throw _0x567c6e;});}return _0x320611;})['then'](respondWithResult(_0x257e7f,0xc9))[_0x06cf('0x49')](handleError(_0x257e7f,null));};exports[_0x06cf('0x25')]=function(_0x1863c1,_0x261017){if(_0x1863c1[_0x06cf('0x4f')]['id']){delete _0x1863c1[_0x06cf('0x4f')]['id'];}return db[_0x06cf('0x44')]['find']({'where':{'id':_0x1863c1[_0x06cf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x261017,null))[_0x06cf('0x26')](saveUpdates(_0x1863c1[_0x06cf('0x4f')],null))[_0x06cf('0x26')](respondWithResult(_0x261017,null))['catch'](handleError(_0x261017,null));};exports[_0x06cf('0x27')]=function(_0x3a2704,_0x2ea59c){return db[_0x06cf('0x44')][_0x06cf('0x55')]({'where':{'id':_0x3a2704['params']['id']}})[_0x06cf('0x26')](handleEntityNotFound(_0x2ea59c,null))['then'](removeEntity(_0x2ea59c,null))[_0x06cf('0x49')](handleError(_0x2ea59c,null));};exports[_0x06cf('0x59')]=function(_0x3f00bc,_0x27bccc){return db[_0x06cf('0x44')][_0x06cf('0x59')]()['then'](respondWithResult(_0x27bccc,null))[_0x06cf('0x49')](handleError(_0x27bccc,null));};exports[_0x06cf('0x5a')]=function(_0x4d17fc,_0x331045,_0x48226f){var _0x464a2d={'raw':!![],'where':{}},_0x4512df={},_0x162859;return db[_0x06cf('0x44')]['findOne']({'where':{'id':_0x4d17fc[_0x06cf('0x4b')]['id']}})[_0x06cf('0x26')](handleEntityNotFound(_0x331045,null))[_0x06cf('0x26')](function(_0x1a59d4){if(_0x1a59d4){_0x162859=_0x1a59d4[_0x06cf('0x28')]({'plain':!![]});_0x4512df['model']=_[_0x06cf('0x37')](db[_0x06cf('0x5b')]['rawAttributes']);_0x4512df[_0x06cf('0x36')]=_['keys'](_0x4d17fc['query']);_0x4512df['filters']=_[_0x06cf('0x38')](_0x4512df[_0x06cf('0x35')],_0x4512df['query']);_0x464a2d[_0x06cf('0x39')]=_[_0x06cf('0x38')](_0x4512df[_0x06cf('0x35')],qs[_0x06cf('0x3a')](_0x4d17fc[_0x06cf('0x36')][_0x06cf('0x3a')]));_0x464a2d[_0x06cf('0x39')]=_0x464a2d[_0x06cf('0x39')][_0x06cf('0x4c')]?_0x464a2d['attributes']:_0x4512df[_0x06cf('0x35')];if(!_0x4d17fc[_0x06cf('0x36')][_0x06cf('0x3b')](_0x06cf('0x3c'))){_0x464a2d['limit']=qs[_0x06cf('0x20')](_0x4d17fc[_0x06cf('0x36')][_0x06cf('0x20')]);_0x464a2d[_0x06cf('0x1f')]=qs[_0x06cf('0x1f')](_0x4d17fc['query'][_0x06cf('0x1f')]);}_0x464a2d[_0x06cf('0x3d')]=qs[_0x06cf('0x3e')](_0x4d17fc['query'][_0x06cf('0x3e')]);_0x464a2d[_0x06cf('0x3f')]=qs[_0x06cf('0x40')](_[_0x06cf('0x41')](_0x4d17fc[_0x06cf('0x36')],_0x4512df[_0x06cf('0x40')]));_0x464a2d[_0x06cf('0x3f')][_0x06cf('0x5c')]=_0x1a59d4['id'];if(_0x4d17fc[_0x06cf('0x36')]['filter']){_0x464a2d[_0x06cf('0x3f')]=_[_0x06cf('0x4d')](_0x464a2d[_0x06cf('0x3f')],{'$or':_[_0x06cf('0x30')](_0x464a2d[_0x06cf('0x39')],function(_0xa997e7){var _0x4c2c4c={};_0x4c2c4c[_0xa997e7]={'$like':'%'+_0x4d17fc['query'][_0x06cf('0x42')]+'%'};return _0x4c2c4c;})});}_0x464a2d=_[_0x06cf('0x4d')]({},_0x464a2d,_0x4d17fc[_0x06cf('0x43')]);return db[_0x06cf('0x5b')][_0x06cf('0x47')](_0x464a2d);}})[_0x06cf('0x26')](function(_0x3099ac){if(_0x3099ac){return db[_0x06cf('0x5d')][_0x06cf('0x5e')]({'where':{'id':_[_0x06cf('0x30')](_0x3099ac,_0x06cf('0x5f')),'role':_0x06cf('0x2d')},'attributes':['id','name',_0x06cf('0x60'),_0x06cf('0x61'),'createdAt']});}})['then'](function(_0xb94187){if(_0xb94187){return{'count':_0xb94187[_0x06cf('0x1e')],'rows':_['map'](_0xb94187[_0x06cf('0x48')],function(_0x4d5c24){return{'membername':_0x4d5c24['name'],'UserId':_0x4d5c24['id'],'queue_name':_0x162859[_0x06cf('0x2b')],'SmsQueueId':_0x162859['id'],'interface':util[_0x06cf('0x62')](_0x06cf('0x63'),_0x06cf('0x64'),_0x4d5c24[_0x06cf('0x2b')]),'penalty':0x0,'paused':_0x4d5c24[_0x06cf('0x60')],'createdAt':_0x4d5c24[_0x06cf('0x65')],'updatedAt':_0x4d5c24['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x331045,_0x464a2d))[_0x06cf('0x49')](handleError(_0x331045,null));};exports[_0x06cf('0x66')]=function(_0x1cb77c,_0x2c9978,_0x59e6cf){var _0x1bf60f={};var _0xd6dd33={};var _0x5ab1d4;var _0x16d8b9;return db[_0x06cf('0x44')][_0x06cf('0x67')]({'where':{'id':_0x1cb77c['params']['id']}})['then'](handleEntityNotFound(_0x2c9978,null))['then'](function(_0x57142f){if(_0x57142f){_0x5ab1d4=_0x57142f;_0xd6dd33[_0x06cf('0x35')]=_[_0x06cf('0x37')](db[_0x06cf('0x68')][_0x06cf('0x31')]);_0xd6dd33['query']=_['keys'](_0x1cb77c[_0x06cf('0x36')]);_0xd6dd33[_0x06cf('0x40')]=_[_0x06cf('0x38')](_0xd6dd33[_0x06cf('0x35')],_0xd6dd33[_0x06cf('0x36')]);_0x1bf60f[_0x06cf('0x39')]=_[_0x06cf('0x38')](_0xd6dd33[_0x06cf('0x35')],qs[_0x06cf('0x3a')](_0x1cb77c[_0x06cf('0x36')][_0x06cf('0x3a')]));_0x1bf60f[_0x06cf('0x39')]=_0x1bf60f['attributes']['length']?_0x1bf60f[_0x06cf('0x39')]:_0xd6dd33[_0x06cf('0x35')];_0x1bf60f[_0x06cf('0x3d')]=qs['sort'](_0x1cb77c[_0x06cf('0x36')][_0x06cf('0x3e')]);_0x1bf60f[_0x06cf('0x3f')]=qs['filters'](_['pick'](_0x1cb77c[_0x06cf('0x36')],_0xd6dd33[_0x06cf('0x40')]));if(_0x1cb77c[_0x06cf('0x36')][_0x06cf('0x42')]){_0x1bf60f['where']=_['merge'](_0x1bf60f[_0x06cf('0x3f')],{'$or':_[_0x06cf('0x30')](_0x1bf60f[_0x06cf('0x39')],function(_0x10b1e6){var _0x3060f6={};_0x3060f6[_0x10b1e6]={'$like':'%'+_0x1cb77c[_0x06cf('0x36')]['filter']+'%'};return _0x3060f6;})});}_0x1bf60f=_[_0x06cf('0x4d')]({},_0x1bf60f,_0x1cb77c['options']);return _0x5ab1d4[_0x06cf('0x66')](_0x1bf60f);}})[_0x06cf('0x26')](function(_0x3ee2bd){if(_0x3ee2bd){_0x16d8b9=_0x3ee2bd[_0x06cf('0x4c')];if(!_0x1cb77c[_0x06cf('0x36')][_0x06cf('0x3b')](_0x06cf('0x3c'))){_0x1bf60f[_0x06cf('0x20')]=qs[_0x06cf('0x20')](_0x1cb77c[_0x06cf('0x36')][_0x06cf('0x20')]);_0x1bf60f[_0x06cf('0x1f')]=qs[_0x06cf('0x1f')](_0x1cb77c[_0x06cf('0x36')][_0x06cf('0x1f')]);}return _0x5ab1d4[_0x06cf('0x66')](_0x1bf60f);}})[_0x06cf('0x26')](function(_0xc05ab2){if(_0xc05ab2){return _0xc05ab2?{'count':_0x16d8b9,'rows':_0xc05ab2}:null;}})[_0x06cf('0x26')](respondWithResult(_0x2c9978,null))[_0x06cf('0x49')](handleError(_0x2c9978,null));};exports[_0x06cf('0x69')]=function(_0x5a2da3,_0x425aed,_0x578e88){var _0x1d8d52=_0x5a2da3['body'][_0x06cf('0x6a')];return db['Team']['findAll']({'where':{'id':_0x1d8d52},'attributes':['id'],'include':[{'model':db[_0x06cf('0x5d')],'as':_0x06cf('0x6b'),'attributes':['id',_0x06cf('0x2b'),_0x06cf('0x6c'),'voicePause',_0x06cf('0x6d')],'raw':!![]}]})[_0x06cf('0x26')](function(_0x1d3524){if(_0x1d3524){var _0x1ac1e2=_['flatMap'](_0x1d3524,function(_0x417fd1){var _0x27a4a6=_0x417fd1[_0x06cf('0x28')]({'plain':!![]});return _0x27a4a6[_0x06cf('0x6b')];});return db[_0x06cf('0x44')][_0x06cf('0x55')]({'where':{'id':_0x5a2da3[_0x06cf('0x4b')]['id']}})[_0x06cf('0x26')](function(_0x1b5a41){return db[_0x06cf('0x6e')]['transaction'](function(_0x1926ea){return _0x1b5a41[_0x06cf('0x69')](_0x1d8d52,{'transaction':_0x1926ea})[_0x06cf('0x26')](function(){return BPromise['each'](_0x1ac1e2,function(_0xaf1b1e){return db[_0x06cf('0x5b')]['findOrCreate']({'where':{'UserId':_0xaf1b1e['id'],'SmsQueueId':_0x5a2da3[_0x06cf('0x4b')]['id']},'transaction':_0x1926ea});});})[_0x06cf('0x26')](function(){_0x1ac1e2[_0x06cf('0x6f')](function(_0x5b280b){socket[_0x06cf('0x70')](_0x06cf('0x71'),{'UserId':_0x5b280b['id'],'SmsQueueId':_0x1b5a41['id']});});});});});}})['then'](respondWithStatusCode(_0x425aed,null))[_0x06cf('0x49')](handleError(_0x425aed,null));};exports[_0x06cf('0x72')]=function(_0x5168ed,_0x46a87f,_0x56f2f7){return db[_0x06cf('0x68')][_0x06cf('0x47')]({'where':{'id':_0x5168ed[_0x06cf('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x06cf('0x5d')],'as':_0x06cf('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x06cf('0x26')](handleEntityNotFound(_0x46a87f,null))['then'](function(_0x311404){var _0x581e11=_[_0x06cf('0x30')](_0x311404,'id');var _0x3ca7ab=[];var _0x3e5537=[];var _0x503818=squel[_0x06cf('0x73')]();_0x503818['field'](_0x06cf('0x74'))[_0x06cf('0x75')](_0x06cf('0x76'),'tq')['join'](_0x06cf('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x5168ed[_0x06cf('0x4b')]['id']);for(var _0x5a4594=0x0;_0x5a4594<_0x311404['length'];_0x5a4594+=0x1){let _0x5c4833=_0x311404[_0x5a4594];for(var _0x1267b2=0x0;_0x1267b2<_0x5c4833[_0x06cf('0x6b')][_0x06cf('0x4c')];_0x1267b2+=0x1){let _0x564884=_0x5c4833[_0x06cf('0x6b')][_0x1267b2];var _0x370dd5=_0x503818[_0x06cf('0x78')]();_0x370dd5['where'](_0x06cf('0x79'),_0x564884['id']);_0x3e5537['push'](db[_0x06cf('0x6e')]['query'](_0x370dd5[_0x06cf('0x7a')](),{'type':db[_0x06cf('0x6e')][_0x06cf('0x7b')][_0x06cf('0x7c')]})['then'](function(_0xd1d22f){if(_0xd1d22f[_0x06cf('0x4c')]===0x1){return _0x564884['id'];}else{var _0x3da5de=_[_0x06cf('0x7d')](_[_0x06cf('0x30')](_0xd1d22f,_0x06cf('0x7e')),function(_0x51395a){return _['includes'](_0x581e11,_0x51395a);});if(_0x3da5de){return _0x564884['id'];}}}));}}return BPromise[_0x06cf('0x7f')](_0x3e5537)[_0x06cf('0x26')](function(_0x1ce189){_0x3ca7ab=_(_0x3ca7ab)['union'](_0x1ce189)['compact']()['value']();return db[_0x06cf('0x44')][_0x06cf('0x55')]({'where':{'id':_0x5168ed['params']['id']}})['then'](function(_0x33a60c){return db[_0x06cf('0x6e')]['transaction'](function(_0x61d11f){return _0x33a60c['removeTeams'](_0x5168ed['query']['ids'],{'transaction':_0x61d11f})[_0x06cf('0x26')](function(){if(!_[_0x06cf('0x80')](_0x3ca7ab)){return _0x33a60c[_0x06cf('0x81')](_0x3ca7ab,{'transaction':_0x61d11f});}})[_0x06cf('0x26')](function(){_0x3ca7ab[_0x06cf('0x6f')](function(_0x47c6cc){socket[_0x06cf('0x70')](_0x06cf('0x82'),{'UserId':_0x47c6cc,'SmsQueueId':_0x33a60c['id']});});});});});});})[_0x06cf('0x26')](respondWithStatusCode(_0x46a87f,null))[_0x06cf('0x49')](handleError(_0x46a87f,null));};exports[_0x06cf('0x83')]=function(_0x2e29ab,_0x555ec0,_0x35e582){return db[_0x06cf('0x44')][_0x06cf('0x55')]({'where':{'id':_0x2e29ab['params']['id']}})[_0x06cf('0x26')](handleEntityNotFound(_0x555ec0,null))['then'](function(_0x21c2d5){if(_0x21c2d5){return _0x21c2d5['addAgents'](_0x2e29ab[_0x06cf('0x4f')][_0x06cf('0x6a')],_[_0x06cf('0x84')](_0x2e29ab[_0x06cf('0x4f')],[_0x06cf('0x6a'),'id'])||{})[_0x06cf('0x85')](function(_0x4e98dd){for(var _0x2d7ac6=0x0;_0x2d7ac6<_0x2e29ab[_0x06cf('0x4f')]['ids'][_0x06cf('0x4c')];_0x2d7ac6+=0x1){socket[_0x06cf('0x70')](_0x06cf('0x71'),{'UserId':_0x2e29ab[_0x06cf('0x4f')][_0x06cf('0x6a')][_0x2d7ac6],'SmsQueueId':_0x2e29ab[_0x06cf('0x4b')]['id']});}return _0x4e98dd;});}})[_0x06cf('0x26')](respondWithResult(_0x555ec0,null))[_0x06cf('0x49')](handleError(_0x555ec0,null));};exports[_0x06cf('0x81')]=function(_0x47ec78,_0x30bdda,_0x3caefd){return db['SmsQueue']['find']({'where':{'id':_0x47ec78[_0x06cf('0x4b')]['id']}})[_0x06cf('0x26')](handleEntityNotFound(_0x30bdda,null))['then'](function(_0x79fd92){if(_0x79fd92){return _0x79fd92['removeAgents'](_0x47ec78[_0x06cf('0x36')]['ids'])['then'](function(){if(_[_0x06cf('0x86')](_0x47ec78['query']['ids'])){for(var _0x1b1d81=0x0;_0x1b1d81<_0x47ec78['query'][_0x06cf('0x6a')][_0x06cf('0x4c')];_0x1b1d81+=0x1){socket['emit'](_0x06cf('0x82'),{'UserId':Number(_0x47ec78[_0x06cf('0x36')]['ids'][_0x1b1d81]),'SmsQueueId':Number(_0x47ec78[_0x06cf('0x4b')]['id'])});}}else{socket[_0x06cf('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x47ec78[_0x06cf('0x36')][_0x06cf('0x6a')]),'SmsQueueId':Number(_0x47ec78[_0x06cf('0x4b')]['id'])});}});}})[_0x06cf('0x26')](respondWithStatusCode(_0x30bdda,null))['catch'](handleError(_0x30bdda,null));};exports[_0x06cf('0x87')]=function(_0x40aa19,_0x57fc2c,_0x53a1d4){var _0x361df3={};var _0x1b8eec={};var _0x11c65d;var _0x3ea4f3;return db[_0x06cf('0x44')][_0x06cf('0x67')]({'where':{'id':_0x40aa19[_0x06cf('0x4b')]['id']}})[_0x06cf('0x26')](handleEntityNotFound(_0x57fc2c,null))[_0x06cf('0x26')](function(_0x19a2cb){if(_0x19a2cb){_0x11c65d=_0x19a2cb;_0x1b8eec[_0x06cf('0x35')]=_[_0x06cf('0x37')](db[_0x06cf('0x5d')][_0x06cf('0x31')]);_0x1b8eec[_0x06cf('0x36')]=_[_0x06cf('0x37')](_0x40aa19[_0x06cf('0x36')]);_0x1b8eec[_0x06cf('0x40')]=_[_0x06cf('0x38')](_0x1b8eec[_0x06cf('0x35')],_0x1b8eec['query']);_0x361df3[_0x06cf('0x39')]=_[_0x06cf('0x38')](_0x1b8eec[_0x06cf('0x35')],qs['fields'](_0x40aa19[_0x06cf('0x36')][_0x06cf('0x3a')]));_0x361df3[_0x06cf('0x39')]=_0x361df3[_0x06cf('0x39')]['length']?_0x361df3[_0x06cf('0x39')]:_0x1b8eec['model'];_0x361df3[_0x06cf('0x3d')]=qs[_0x06cf('0x3e')](_0x40aa19[_0x06cf('0x36')][_0x06cf('0x3e')]);_0x361df3[_0x06cf('0x3f')]=qs['filters'](_[_0x06cf('0x41')](_0x40aa19[_0x06cf('0x36')],_0x1b8eec['filters']));if(_0x40aa19[_0x06cf('0x36')]['filter']){_0x361df3[_0x06cf('0x3f')]=_[_0x06cf('0x4d')](_0x361df3[_0x06cf('0x3f')],{'$or':_['map'](_0x361df3['attributes'],function(_0x14ed32){var _0x28f6eb={};_0x28f6eb[_0x14ed32]={'$like':'%'+_0x40aa19[_0x06cf('0x36')][_0x06cf('0x42')]+'%'};return _0x28f6eb;})});}_0x361df3=_['merge']({},_0x361df3,_0x40aa19[_0x06cf('0x43')]);return _0x11c65d[_0x06cf('0x87')](_0x361df3);}})[_0x06cf('0x26')](function(_0x488b35){if(_0x488b35){_0x3ea4f3=_0x488b35['length'];if(!_0x40aa19[_0x06cf('0x36')][_0x06cf('0x3b')](_0x06cf('0x3c'))){_0x361df3[_0x06cf('0x20')]=qs[_0x06cf('0x20')](_0x40aa19['query'][_0x06cf('0x20')]);_0x361df3[_0x06cf('0x1f')]=qs[_0x06cf('0x1f')](_0x40aa19[_0x06cf('0x36')][_0x06cf('0x1f')]);}return _0x11c65d[_0x06cf('0x87')](_0x361df3);}})[_0x06cf('0x26')](function(_0xdadecb){if(_0xdadecb){return _0xdadecb?{'count':_0x3ea4f3,'rows':_0xdadecb}:null;}})['then'](respondWithResult(_0x57fc2c,null))[_0x06cf('0x49')](handleError(_0x57fc2c,null));}; \ No newline at end of file +var _0xcd4f=['end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','SmsQueues','UserProfileResource','destroy','sendStatus','error','stack','name','send','render','merge','body','contact','message','interaction','account','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','SmsQueue','rows','catch','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','hasOwnProperty','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','status'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0xcd4f,0x108));var _0xfcd4=function(_0x8529cd,_0x57b8d0){_0x8529cd=_0x8529cd-0x0;var _0x53c4c4=_0xcd4f[_0x8529cd];return _0x53c4c4;};'use strict';var emlformat=require(_0xfcd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcd4('0x1'));var jsonpatch=require(_0xfcd4('0x2'));var rp=require(_0xfcd4('0x3'));var moment=require(_0xfcd4('0x4'));var BPromise=require(_0xfcd4('0x5'));var Mustache=require(_0xfcd4('0x6'));var util=require('util');var path=require(_0xfcd4('0x7'));var sox=require('sox');var csv=require(_0xfcd4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcd4('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfcd4('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfcd4('0xb'));var Papa=require(_0xfcd4('0xc'));var Redis=require(_0xfcd4('0xd'));var authService=require(_0xfcd4('0xe'));var qs=require(_0xfcd4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcd4('0x10'));var logger=require(_0xfcd4('0x11'))('api');var utils=require(_0xfcd4('0x12'));var config=require(_0xfcd4('0x13'));var licenseUtil=require(_0xfcd4('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xfcd4('0x15')](config['redis'],{'host':_0xfcd4('0x16'),'port':0x18eb});var socket=require(_0xfcd4('0x17'))(new Redis(config[_0xfcd4('0x18')]));require(_0xfcd4('0x19'))[_0xfcd4('0x1a')](socket);function respondWithStatusCode(_0x241e2d,_0x99b550){_0x99b550=_0x99b550||0xcc;return function(_0x2d9757){if(_0x2d9757){return _0x241e2d['sendStatus'](_0x99b550);}return _0x241e2d[_0xfcd4('0x1b')](_0x99b550)[_0xfcd4('0x1c')]();};}function respondWithResult(_0xeb1402,_0x312053){_0x312053=_0x312053||0xc8;return function(_0x503a49){if(_0x503a49){return _0xeb1402[_0xfcd4('0x1b')](_0x312053)[_0xfcd4('0x1d')](_0x503a49);}};}function respondWithFilteredResult(_0x13bdc2,_0xab5058){return function(_0x458860){if(_0x458860){var _0x3cf539=typeof _0xab5058[_0xfcd4('0x1e')]===_0xfcd4('0x1f')&&typeof _0xab5058['limit']===_0xfcd4('0x1f');var _0x5d492d=_0x458860[_0xfcd4('0x20')];var _0x2db153=_0x3cf539?0x0:_0xab5058[_0xfcd4('0x1e')];var _0x30f74b=_0x3cf539?_0x458860['count']:_0xab5058[_0xfcd4('0x1e')]+_0xab5058[_0xfcd4('0x21')];var _0x334230;if(_0x30f74b>=_0x5d492d){_0x30f74b=_0x5d492d;_0x334230=0xc8;}else{_0x334230=0xce;}_0x13bdc2[_0xfcd4('0x1b')](_0x334230);return _0x13bdc2[_0xfcd4('0x22')](_0xfcd4('0x23'),_0x2db153+'-'+_0x30f74b+'/'+_0x5d492d)[_0xfcd4('0x1d')](_0x458860);}return null;};}function patchUpdates(_0x4b6124){return function(_0x2bcdb4){try{jsonpatch[_0xfcd4('0x24')](_0x2bcdb4,_0x4b6124,!![]);}catch(_0x544817){return BPromise[_0xfcd4('0x25')](_0x544817);}return _0x2bcdb4[_0xfcd4('0x26')]();};}function saveUpdates(_0x5802b9,_0x197e20){return function(_0x4b1e60){if(_0x4b1e60){return _0x4b1e60[_0xfcd4('0x27')](_0x5802b9)[_0xfcd4('0x28')](function(_0x57428e){return _0x57428e;});}return null;};}function removeEntity(_0x8eb6e7,_0x2b3b33){return function(_0x3f374d){if(_0x3f374d){return _0x3f374d['destroy']()[_0xfcd4('0x28')](function(){var _0x307317=_0x3f374d['get']({'plain':!![]});var _0x163e29=_0xfcd4('0x29');return db[_0xfcd4('0x2a')][_0xfcd4('0x2b')]({'where':{'type':_0x163e29,'resourceId':_0x307317['id']}})[_0xfcd4('0x28')](function(){return _0x3f374d;});})[_0xfcd4('0x28')](function(){_0x8eb6e7['status'](0xcc)[_0xfcd4('0x1c')]();});}};}function handleEntityNotFound(_0x5ef98a,_0x39d8f7){return function(_0x3e7f3b){if(!_0x3e7f3b){_0x5ef98a[_0xfcd4('0x2c')](0x194);}return _0x3e7f3b;};}function handleError(_0x2fb1dd,_0x5e6e97){_0x5e6e97=_0x5e6e97||0x1f4;return function(_0x217873){logger[_0xfcd4('0x2d')](_0x217873[_0xfcd4('0x2e')]);if(_0x217873[_0xfcd4('0x2f')]){delete _0x217873['name'];}_0x2fb1dd[_0xfcd4('0x1b')](_0x5e6e97)[_0xfcd4('0x30')](_0x217873);};}function getMustacheRender(_0x1df86e,_0x4aa75b){return Mustache[_0xfcd4('0x31')](_0x1df86e,_[_0xfcd4('0x32')](_0x4aa75b[_0xfcd4('0x33')],{'contact':_0x4aa75b[_0xfcd4('0x34')],'message':_0x4aa75b[_0xfcd4('0x35')],'agent':_0x4aa75b['agent'],'interaction':_0x4aa75b[_0xfcd4('0x36')],'account':_0x4aa75b[_0xfcd4('0x37')]}))||'';}exports['index']=function(_0x17dfc6,_0x37d497){var _0x206cf5={},_0x1097bf={},_0x4262a8={'count':0x0,'rows':[]};var _0x2d762c=_['map'](db['SmsQueue'][_0xfcd4('0x38')],function(_0x13be97){return{'name':_0x13be97[_0xfcd4('0x39')],'type':_0x13be97[_0xfcd4('0x3a')][_0xfcd4('0x3b')]};});_0x1097bf[_0xfcd4('0x3c')]=_[_0xfcd4('0x3d')](_0x2d762c,_0xfcd4('0x2f'));_0x1097bf[_0xfcd4('0x3e')]=_[_0xfcd4('0x3f')](_0x17dfc6[_0xfcd4('0x3e')]);_0x1097bf[_0xfcd4('0x40')]=_[_0xfcd4('0x41')](_0x1097bf[_0xfcd4('0x3c')],_0x1097bf[_0xfcd4('0x3e')]);_0x206cf5['attributes']=_[_0xfcd4('0x41')](_0x1097bf[_0xfcd4('0x3c')],qs[_0xfcd4('0x42')](_0x17dfc6[_0xfcd4('0x3e')]['fields']));_0x206cf5['attributes']=_0x206cf5['attributes'][_0xfcd4('0x43')]?_0x206cf5[_0xfcd4('0x44')]:_0x1097bf[_0xfcd4('0x3c')];if(!_0x17dfc6['query']['hasOwnProperty'](_0xfcd4('0x45'))){_0x206cf5[_0xfcd4('0x21')]=qs[_0xfcd4('0x21')](_0x17dfc6[_0xfcd4('0x3e')][_0xfcd4('0x21')]);_0x206cf5[_0xfcd4('0x1e')]=qs[_0xfcd4('0x1e')](_0x17dfc6[_0xfcd4('0x3e')][_0xfcd4('0x1e')]);}_0x206cf5[_0xfcd4('0x46')]=qs[_0xfcd4('0x47')](_0x17dfc6[_0xfcd4('0x3e')][_0xfcd4('0x47')]);_0x206cf5[_0xfcd4('0x48')]=qs[_0xfcd4('0x40')](_[_0xfcd4('0x49')](_0x17dfc6['query'],_0x1097bf['filters']),_0x2d762c);if(_0x17dfc6[_0xfcd4('0x3e')]['filter']){_0x206cf5[_0xfcd4('0x48')]=_[_0xfcd4('0x32')](_0x206cf5['where'],{'$or':_['map'](_0x2d762c,function(_0x30e399){if(_0x30e399['type']!==_0xfcd4('0x4a')){var _0x2ec3d6={};_0x2ec3d6[_0x30e399['name']]={'$like':'%'+_0x17dfc6[_0xfcd4('0x3e')][_0xfcd4('0x4b')]+'%'};return _0x2ec3d6;}})});}_0x206cf5=_[_0xfcd4('0x32')]({},_0x206cf5,_0x17dfc6[_0xfcd4('0x4c')]);var _0x48328f={'where':_0x206cf5['where']};return db['SmsQueue']['count'](_0x48328f)['then'](function(_0x55dff8){_0x4262a8[_0xfcd4('0x20')]=_0x55dff8;if(_0x17dfc6['query'][_0xfcd4('0x4d')]){_0x206cf5[_0xfcd4('0x4e')]=[{'all':!![]}];}return db[_0xfcd4('0x4f')]['findAll'](_0x206cf5);})[_0xfcd4('0x28')](function(_0x205232){_0x4262a8[_0xfcd4('0x50')]=_0x205232;return _0x4262a8;})[_0xfcd4('0x28')](respondWithFilteredResult(_0x37d497,_0x206cf5))[_0xfcd4('0x51')](handleError(_0x37d497,null));};exports['show']=function(_0x23afea,_0x394849){var _0x3fa214={'raw':!![],'where':{'id':_0x23afea[_0xfcd4('0x52')]['id']}},_0x1a5ef1={};_0x1a5ef1[_0xfcd4('0x3c')]=_[_0xfcd4('0x3f')](db[_0xfcd4('0x4f')][_0xfcd4('0x38')]);_0x1a5ef1[_0xfcd4('0x3e')]=_[_0xfcd4('0x3f')](_0x23afea[_0xfcd4('0x3e')]);_0x1a5ef1[_0xfcd4('0x40')]=_['intersection'](_0x1a5ef1['model'],_0x1a5ef1[_0xfcd4('0x3e')]);_0x3fa214[_0xfcd4('0x44')]=_['intersection'](_0x1a5ef1[_0xfcd4('0x3c')],qs[_0xfcd4('0x42')](_0x23afea['query'][_0xfcd4('0x42')]));_0x3fa214[_0xfcd4('0x44')]=_0x3fa214[_0xfcd4('0x44')][_0xfcd4('0x43')]?_0x3fa214[_0xfcd4('0x44')]:_0x1a5ef1[_0xfcd4('0x3c')];if(_0x23afea[_0xfcd4('0x3e')][_0xfcd4('0x4d')]){_0x3fa214['include']=[{'all':!![]}];}_0x3fa214=_[_0xfcd4('0x32')]({},_0x3fa214,_0x23afea[_0xfcd4('0x4c')]);return db['SmsQueue']['find'](_0x3fa214)[_0xfcd4('0x28')](handleEntityNotFound(_0x394849,null))[_0xfcd4('0x28')](respondWithResult(_0x394849,null))[_0xfcd4('0x51')](handleError(_0x394849,null));};exports[_0xfcd4('0x53')]=function(_0x11e113,_0x15b31a){return db['SmsQueue'][_0xfcd4('0x53')](_0x11e113[_0xfcd4('0x33')],{})[_0xfcd4('0x28')](function(_0x17c502){var _0xd54746=_0x11e113[_0xfcd4('0x54')][_0xfcd4('0x55')]({'plain':!![]});if(!_0xd54746)throw new Error(_0xfcd4('0x56'));if(_0xd54746[_0xfcd4('0x57')]===_0xfcd4('0x54')){var _0x3c43cd=_0x17c502[_0xfcd4('0x55')]({'plain':!![]});var _0x263f0c=_0xfcd4('0x29');return db['UserProfileSection'][_0xfcd4('0x58')]({'where':{'name':_0x263f0c,'userProfileId':_0xd54746['userProfileId']},'raw':!![]})[_0xfcd4('0x28')](function(_0x467285){if(_0x467285&&_0x467285[_0xfcd4('0x59')]===0x0){return db[_0xfcd4('0x2a')][_0xfcd4('0x53')]({'name':_0x3c43cd[_0xfcd4('0x2f')],'resourceId':_0x3c43cd['id'],'type':_0x467285[_0xfcd4('0x2f')],'sectionId':_0x467285['id']},{})[_0xfcd4('0x28')](function(){return _0x17c502;});}else{return _0x17c502;}})[_0xfcd4('0x51')](function(_0x3797d5){logger[_0xfcd4('0x2d')](_0xfcd4('0x5a'),_0x3797d5);throw _0x3797d5;});}return _0x17c502;})[_0xfcd4('0x28')](respondWithResult(_0x15b31a,0xc9))[_0xfcd4('0x51')](handleError(_0x15b31a,null));};exports[_0xfcd4('0x27')]=function(_0x34e99d,_0x48d589){if(_0x34e99d[_0xfcd4('0x33')]['id']){delete _0x34e99d[_0xfcd4('0x33')]['id'];}return db[_0xfcd4('0x4f')][_0xfcd4('0x58')]({'where':{'id':_0x34e99d[_0xfcd4('0x52')]['id']}})[_0xfcd4('0x28')](handleEntityNotFound(_0x48d589,null))[_0xfcd4('0x28')](saveUpdates(_0x34e99d[_0xfcd4('0x33')],null))[_0xfcd4('0x28')](respondWithResult(_0x48d589,null))[_0xfcd4('0x51')](handleError(_0x48d589,null));};exports['destroy']=function(_0x1836b8,_0x3437e6){return db[_0xfcd4('0x4f')]['find']({'where':{'id':_0x1836b8[_0xfcd4('0x52')]['id']}})[_0xfcd4('0x28')](handleEntityNotFound(_0x3437e6,null))['then'](removeEntity(_0x3437e6,null))[_0xfcd4('0x51')](handleError(_0x3437e6,null));};exports[_0xfcd4('0x5b')]=function(_0x3a49f5,_0x32cf57){return db[_0xfcd4('0x4f')][_0xfcd4('0x5b')]()['then'](respondWithResult(_0x32cf57,null))[_0xfcd4('0x51')](handleError(_0x32cf57,null));};exports[_0xfcd4('0x5c')]=function(_0x599f57,_0x5db782,_0x2b7baf){var _0x3643ce={'raw':!![],'where':{}},_0x538bf0={},_0x3ecd3e;return db[_0xfcd4('0x4f')]['findOne']({'where':{'id':_0x599f57[_0xfcd4('0x52')]['id']}})['then'](handleEntityNotFound(_0x5db782,null))[_0xfcd4('0x28')](function(_0x3ee279){if(_0x3ee279){_0x3ecd3e=_0x3ee279[_0xfcd4('0x55')]({'plain':!![]});_0x538bf0[_0xfcd4('0x3c')]=_[_0xfcd4('0x3f')](db[_0xfcd4('0x5d')][_0xfcd4('0x38')]);_0x538bf0[_0xfcd4('0x3e')]=_[_0xfcd4('0x3f')](_0x599f57[_0xfcd4('0x3e')]);_0x538bf0[_0xfcd4('0x40')]=_['intersection'](_0x538bf0[_0xfcd4('0x3c')],_0x538bf0[_0xfcd4('0x3e')]);_0x3643ce[_0xfcd4('0x44')]=_[_0xfcd4('0x41')](_0x538bf0[_0xfcd4('0x3c')],qs['fields'](_0x599f57[_0xfcd4('0x3e')][_0xfcd4('0x42')]));_0x3643ce[_0xfcd4('0x44')]=_0x3643ce[_0xfcd4('0x44')][_0xfcd4('0x43')]?_0x3643ce[_0xfcd4('0x44')]:_0x538bf0[_0xfcd4('0x3c')];if(!_0x599f57[_0xfcd4('0x3e')][_0xfcd4('0x5e')](_0xfcd4('0x45'))){_0x3643ce[_0xfcd4('0x21')]=qs['limit'](_0x599f57[_0xfcd4('0x3e')][_0xfcd4('0x21')]);_0x3643ce[_0xfcd4('0x1e')]=qs['offset'](_0x599f57[_0xfcd4('0x3e')][_0xfcd4('0x1e')]);}_0x3643ce[_0xfcd4('0x46')]=qs[_0xfcd4('0x47')](_0x599f57[_0xfcd4('0x3e')][_0xfcd4('0x47')]);_0x3643ce[_0xfcd4('0x48')]=qs[_0xfcd4('0x40')](_[_0xfcd4('0x49')](_0x599f57[_0xfcd4('0x3e')],_0x538bf0['filters']));_0x3643ce['where'][_0xfcd4('0x5f')]=_0x3ee279['id'];if(_0x599f57[_0xfcd4('0x3e')][_0xfcd4('0x4b')]){_0x3643ce[_0xfcd4('0x48')]=_['merge'](_0x3643ce[_0xfcd4('0x48')],{'$or':_[_0xfcd4('0x3d')](_0x3643ce[_0xfcd4('0x44')],function(_0x17a797){var _0x166efa={};_0x166efa[_0x17a797]={'$like':'%'+_0x599f57[_0xfcd4('0x3e')][_0xfcd4('0x4b')]+'%'};return _0x166efa;})});}_0x3643ce=_['merge']({},_0x3643ce,_0x599f57[_0xfcd4('0x4c')]);return db[_0xfcd4('0x5d')][_0xfcd4('0x60')](_0x3643ce);}})[_0xfcd4('0x28')](function(_0x1734b7){if(_0x1734b7){return db[_0xfcd4('0x61')][_0xfcd4('0x62')]({'where':{'id':_[_0xfcd4('0x3d')](_0x1734b7,_0xfcd4('0x63')),'role':_0xfcd4('0x64')},'attributes':['id',_0xfcd4('0x2f'),_0xfcd4('0x65'),_0xfcd4('0x66'),_0xfcd4('0x67')]});}})[_0xfcd4('0x28')](function(_0x471873){if(_0x471873){return{'count':_0x471873['count'],'rows':_[_0xfcd4('0x3d')](_0x471873[_0xfcd4('0x50')],function(_0x265ded){return{'membername':_0x265ded[_0xfcd4('0x2f')],'UserId':_0x265ded['id'],'queue_name':_0x3ecd3e['name'],'SmsQueueId':_0x3ecd3e['id'],'interface':util['format']('%s/%s',_0xfcd4('0x68'),_0x265ded[_0xfcd4('0x2f')]),'penalty':0x0,'paused':_0x265ded['smsPause'],'createdAt':_0x265ded[_0xfcd4('0x67')],'updatedAt':_0x265ded[_0xfcd4('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5db782,_0x3643ce))[_0xfcd4('0x51')](handleError(_0x5db782,null));};exports['getTeams']=function(_0x3b13cb,_0x522300,_0x2bd8bf){var _0x16fcf9={};var _0xd2206f={};var _0x166b64;var _0x540361;return db[_0xfcd4('0x4f')]['findOne']({'where':{'id':_0x3b13cb[_0xfcd4('0x52')]['id']}})[_0xfcd4('0x28')](handleEntityNotFound(_0x522300,null))['then'](function(_0x27243a){if(_0x27243a){_0x166b64=_0x27243a;_0xd2206f[_0xfcd4('0x3c')]=_[_0xfcd4('0x3f')](db['Team']['rawAttributes']);_0xd2206f['query']=_[_0xfcd4('0x3f')](_0x3b13cb['query']);_0xd2206f[_0xfcd4('0x40')]=_[_0xfcd4('0x41')](_0xd2206f[_0xfcd4('0x3c')],_0xd2206f['query']);_0x16fcf9['attributes']=_[_0xfcd4('0x41')](_0xd2206f[_0xfcd4('0x3c')],qs[_0xfcd4('0x42')](_0x3b13cb[_0xfcd4('0x3e')][_0xfcd4('0x42')]));_0x16fcf9[_0xfcd4('0x44')]=_0x16fcf9['attributes']['length']?_0x16fcf9['attributes']:_0xd2206f[_0xfcd4('0x3c')];_0x16fcf9['order']=qs['sort'](_0x3b13cb['query'][_0xfcd4('0x47')]);_0x16fcf9['where']=qs[_0xfcd4('0x40')](_[_0xfcd4('0x49')](_0x3b13cb[_0xfcd4('0x3e')],_0xd2206f[_0xfcd4('0x40')]));if(_0x3b13cb[_0xfcd4('0x3e')][_0xfcd4('0x4b')]){_0x16fcf9[_0xfcd4('0x48')]=_[_0xfcd4('0x32')](_0x16fcf9[_0xfcd4('0x48')],{'$or':_['map'](_0x16fcf9[_0xfcd4('0x44')],function(_0x4619af){var _0x3a19fe={};_0x3a19fe[_0x4619af]={'$like':'%'+_0x3b13cb[_0xfcd4('0x3e')]['filter']+'%'};return _0x3a19fe;})});}_0x16fcf9=_['merge']({},_0x16fcf9,_0x3b13cb[_0xfcd4('0x4c')]);return _0x166b64['getTeams'](_0x16fcf9);}})[_0xfcd4('0x28')](function(_0x2bccdd){if(_0x2bccdd){_0x540361=_0x2bccdd[_0xfcd4('0x43')];if(!_0x3b13cb[_0xfcd4('0x3e')][_0xfcd4('0x5e')](_0xfcd4('0x45'))){_0x16fcf9['limit']=qs[_0xfcd4('0x21')](_0x3b13cb[_0xfcd4('0x3e')][_0xfcd4('0x21')]);_0x16fcf9['offset']=qs[_0xfcd4('0x1e')](_0x3b13cb[_0xfcd4('0x3e')][_0xfcd4('0x1e')]);}return _0x166b64[_0xfcd4('0x69')](_0x16fcf9);}})[_0xfcd4('0x28')](function(_0x193618){if(_0x193618){return _0x193618?{'count':_0x540361,'rows':_0x193618}:null;}})['then'](respondWithResult(_0x522300,null))[_0xfcd4('0x51')](handleError(_0x522300,null));};exports[_0xfcd4('0x6a')]=function(_0xf6a224,_0x4e4deb,_0x2289d9){var _0x53529a=_0xf6a224['body'][_0xfcd4('0x6b')];return db[_0xfcd4('0x6c')][_0xfcd4('0x60')]({'where':{'id':_0x53529a},'attributes':['id'],'include':[{'model':db[_0xfcd4('0x61')],'as':_0xfcd4('0x6d'),'attributes':['id',_0xfcd4('0x2f'),'online',_0xfcd4('0x6e'),'interface'],'raw':!![]}]})['then'](function(_0x52acdb){if(_0x52acdb){var _0x584683=_[_0xfcd4('0x6f')](_0x52acdb,function(_0x513208){var _0x54abad=_0x513208[_0xfcd4('0x55')]({'plain':!![]});return _0x54abad[_0xfcd4('0x6d')];});return db['SmsQueue'][_0xfcd4('0x58')]({'where':{'id':_0xf6a224[_0xfcd4('0x52')]['id']}})[_0xfcd4('0x28')](function(_0x3d97cd){return db[_0xfcd4('0x70')]['transaction'](function(_0x34a6a0){return _0x3d97cd[_0xfcd4('0x6a')](_0x53529a,{'transaction':_0x34a6a0})['then'](function(){return BPromise[_0xfcd4('0x71')](_0x584683,function(_0x4aa370){return db[_0xfcd4('0x5d')][_0xfcd4('0x72')]({'where':{'UserId':_0x4aa370['id'],'SmsQueueId':_0xf6a224['params']['id']},'transaction':_0x34a6a0});});})[_0xfcd4('0x28')](function(){_0x584683[_0xfcd4('0x73')](function(_0x5d1d5d){socket[_0xfcd4('0x74')](_0xfcd4('0x75'),{'UserId':_0x5d1d5d['id'],'SmsQueueId':_0x3d97cd['id']});});});});});}})[_0xfcd4('0x28')](respondWithStatusCode(_0x4e4deb,null))[_0xfcd4('0x51')](handleError(_0x4e4deb,null));};exports[_0xfcd4('0x76')]=function(_0x47e386,_0x16faa2,_0x4b1b90){return db[_0xfcd4('0x6c')]['findAll']({'where':{'id':_0x47e386['query'][_0xfcd4('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfcd4('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xfcd4('0x28')](handleEntityNotFound(_0x16faa2,null))[_0xfcd4('0x28')](function(_0x22eabb){var _0x1f09aa=_[_0xfcd4('0x3d')](_0x22eabb,'id');var _0x18d843=[];var _0x54e5db=[];var _0x28d034=squel[_0xfcd4('0x77')]();_0x28d034[_0xfcd4('0x78')]('tq.TeamId')[_0xfcd4('0x79')](_0xfcd4('0x7a'),'tq')[_0xfcd4('0x7b')](_0xfcd4('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfcd4('0x48')](_0xfcd4('0x7d'),_0x47e386[_0xfcd4('0x52')]['id']);for(var _0x2c93e1=0x0;_0x2c93e1<_0x22eabb['length'];_0x2c93e1+=0x1){let _0x137255=_0x22eabb[_0x2c93e1];for(var _0x2e948f=0x0;_0x2e948f<_0x137255[_0xfcd4('0x6d')][_0xfcd4('0x43')];_0x2e948f+=0x1){let _0x4918a3=_0x137255['Agents'][_0x2e948f];var _0x7a05a3=_0x28d034['clone']();_0x7a05a3[_0xfcd4('0x48')](_0xfcd4('0x7e'),_0x4918a3['id']);_0x54e5db[_0xfcd4('0x7f')](db[_0xfcd4('0x70')][_0xfcd4('0x3e')](_0x7a05a3[_0xfcd4('0x80')](),{'type':db[_0xfcd4('0x70')][_0xfcd4('0x81')][_0xfcd4('0x82')]})[_0xfcd4('0x28')](function(_0x4e4f4b){if(_0x4e4f4b[_0xfcd4('0x43')]===0x1){return _0x4918a3['id'];}else{var _0x2795b1=_[_0xfcd4('0x83')](_[_0xfcd4('0x3d')](_0x4e4f4b,_0xfcd4('0x84')),function(_0x22e79a){return _[_0xfcd4('0x85')](_0x1f09aa,_0x22e79a);});if(_0x2795b1){return _0x4918a3['id'];}}}));}}return BPromise[_0xfcd4('0x86')](_0x54e5db)[_0xfcd4('0x28')](function(_0x502d5f){_0x18d843=_(_0x18d843)[_0xfcd4('0x87')](_0x502d5f)['compact']()[_0xfcd4('0x88')]();return db[_0xfcd4('0x4f')][_0xfcd4('0x58')]({'where':{'id':_0x47e386['params']['id']}})[_0xfcd4('0x28')](function(_0x5b9b23){return db[_0xfcd4('0x70')][_0xfcd4('0x89')](function(_0x1300bb){return _0x5b9b23[_0xfcd4('0x76')](_0x47e386[_0xfcd4('0x3e')][_0xfcd4('0x6b')],{'transaction':_0x1300bb})[_0xfcd4('0x28')](function(){if(!_['isEmpty'](_0x18d843)){return _0x5b9b23[_0xfcd4('0x8a')](_0x18d843,{'transaction':_0x1300bb});}})[_0xfcd4('0x28')](function(){_0x18d843[_0xfcd4('0x73')](function(_0x214ab0){socket['emit'](_0xfcd4('0x8b'),{'UserId':_0x214ab0,'SmsQueueId':_0x5b9b23['id']});});});});});});})[_0xfcd4('0x28')](respondWithStatusCode(_0x16faa2,null))[_0xfcd4('0x51')](handleError(_0x16faa2,null));};exports[_0xfcd4('0x8c')]=function(_0x534488,_0x7836ea,_0x4862eb){return db[_0xfcd4('0x4f')]['find']({'where':{'id':_0x534488['params']['id']}})[_0xfcd4('0x28')](handleEntityNotFound(_0x7836ea,null))[_0xfcd4('0x28')](function(_0x21ad53){if(_0x21ad53){return _0x21ad53[_0xfcd4('0x8c')](_0x534488['body'][_0xfcd4('0x6b')],_[_0xfcd4('0x8d')](_0x534488['body'],[_0xfcd4('0x6b'),'id'])||{})[_0xfcd4('0x8e')](function(_0x2336c5){for(var _0x15ebf5=0x0;_0x15ebf5<_0x534488[_0xfcd4('0x33')][_0xfcd4('0x6b')][_0xfcd4('0x43')];_0x15ebf5+=0x1){socket[_0xfcd4('0x74')]('userSmsQueue:save',{'UserId':_0x534488[_0xfcd4('0x33')]['ids'][_0x15ebf5],'SmsQueueId':_0x534488[_0xfcd4('0x52')]['id']});}return _0x2336c5;});}})[_0xfcd4('0x28')](respondWithResult(_0x7836ea,null))[_0xfcd4('0x51')](handleError(_0x7836ea,null));};exports[_0xfcd4('0x8a')]=function(_0x347d42,_0x455d42,_0x3c255e){return db['SmsQueue'][_0xfcd4('0x58')]({'where':{'id':_0x347d42[_0xfcd4('0x52')]['id']}})[_0xfcd4('0x28')](handleEntityNotFound(_0x455d42,null))['then'](function(_0x39d36d){if(_0x39d36d){return _0x39d36d[_0xfcd4('0x8a')](_0x347d42['query'][_0xfcd4('0x6b')])[_0xfcd4('0x28')](function(){if(_[_0xfcd4('0x8f')](_0x347d42[_0xfcd4('0x3e')][_0xfcd4('0x6b')])){for(var _0x2ffb26=0x0;_0x2ffb26<_0x347d42['query'][_0xfcd4('0x6b')]['length'];_0x2ffb26+=0x1){socket['emit'](_0xfcd4('0x8b'),{'UserId':Number(_0x347d42[_0xfcd4('0x3e')][_0xfcd4('0x6b')][_0x2ffb26]),'SmsQueueId':Number(_0x347d42[_0xfcd4('0x52')]['id'])});}}else{socket[_0xfcd4('0x74')]('userSmsQueue:remove',{'UserId':Number(_0x347d42[_0xfcd4('0x3e')][_0xfcd4('0x6b')]),'SmsQueueId':Number(_0x347d42[_0xfcd4('0x52')]['id'])});}});}})[_0xfcd4('0x28')](respondWithStatusCode(_0x455d42,null))['catch'](handleError(_0x455d42,null));};exports[_0xfcd4('0x90')]=function(_0x1214fa,_0x50ff3c,_0x4631b6){var _0x25f4c0={};var _0x4e5fa0={};var _0x4767cd;var _0x30406a;return db['SmsQueue'][_0xfcd4('0x91')]({'where':{'id':_0x1214fa['params']['id']}})[_0xfcd4('0x28')](handleEntityNotFound(_0x50ff3c,null))[_0xfcd4('0x28')](function(_0x462b8){if(_0x462b8){_0x4767cd=_0x462b8;_0x4e5fa0[_0xfcd4('0x3c')]=_[_0xfcd4('0x3f')](db[_0xfcd4('0x61')][_0xfcd4('0x38')]);_0x4e5fa0['query']=_['keys'](_0x1214fa[_0xfcd4('0x3e')]);_0x4e5fa0['filters']=_['intersection'](_0x4e5fa0[_0xfcd4('0x3c')],_0x4e5fa0[_0xfcd4('0x3e')]);_0x25f4c0[_0xfcd4('0x44')]=_[_0xfcd4('0x41')](_0x4e5fa0['model'],qs[_0xfcd4('0x42')](_0x1214fa['query'][_0xfcd4('0x42')]));_0x25f4c0[_0xfcd4('0x44')]=_0x25f4c0['attributes'][_0xfcd4('0x43')]?_0x25f4c0[_0xfcd4('0x44')]:_0x4e5fa0[_0xfcd4('0x3c')];_0x25f4c0['order']=qs[_0xfcd4('0x47')](_0x1214fa[_0xfcd4('0x3e')][_0xfcd4('0x47')]);_0x25f4c0[_0xfcd4('0x48')]=qs['filters'](_[_0xfcd4('0x49')](_0x1214fa[_0xfcd4('0x3e')],_0x4e5fa0[_0xfcd4('0x40')]));if(_0x1214fa[_0xfcd4('0x3e')]['filter']){_0x25f4c0[_0xfcd4('0x48')]=_[_0xfcd4('0x32')](_0x25f4c0['where'],{'$or':_['map'](_0x25f4c0['attributes'],function(_0x2a6b68){var _0x42b08b={};_0x42b08b[_0x2a6b68]={'$like':'%'+_0x1214fa['query'][_0xfcd4('0x4b')]+'%'};return _0x42b08b;})});}_0x25f4c0=_[_0xfcd4('0x32')]({},_0x25f4c0,_0x1214fa['options']);return _0x4767cd['getAgents'](_0x25f4c0);}})[_0xfcd4('0x28')](function(_0x25229d){if(_0x25229d){_0x30406a=_0x25229d[_0xfcd4('0x43')];if(!_0x1214fa[_0xfcd4('0x3e')][_0xfcd4('0x5e')]('nolimit')){_0x25f4c0[_0xfcd4('0x21')]=qs[_0xfcd4('0x21')](_0x1214fa[_0xfcd4('0x3e')][_0xfcd4('0x21')]);_0x25f4c0[_0xfcd4('0x1e')]=qs['offset'](_0x1214fa[_0xfcd4('0x3e')][_0xfcd4('0x1e')]);}return _0x4767cd[_0xfcd4('0x90')](_0x25f4c0);}})[_0xfcd4('0x28')](function(_0x22c75a){if(_0x22c75a){return _0x22c75a?{'count':_0x30406a,'rows':_0x22c75a}:null;}})['then'](respondWithResult(_0x50ff3c,null))['catch'](handleError(_0x50ff3c,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 858309d..070ebed 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 _0x4b26=['update','remove','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x4fbe76,_0x1b7645){var _0x72a29b=function(_0x293702){while(--_0x293702){_0x4fbe76['push'](_0x4fbe76['shift']());}};_0x72a29b(++_0x1b7645);}(_0x4b26,0xd7));var _0x64b2=function(_0x37349c,_0x5f53f5){_0x37349c=_0x37349c-0x0;var _0x5eae75=_0x4b26[_0x37349c];return _0x5eae75;};'use strict';var EventEmitter=require(_0x64b2('0x0'));var SmsQueue=require(_0x64b2('0x1'))['db'][_0x64b2('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x64b2('0x3')](0x0);var events={'afterCreate':_0x64b2('0x4'),'afterUpdate':_0x64b2('0x5'),'afterDestroy':_0x64b2('0x6')};function emitEvent(_0x2445aa){return function(_0x32df2e,_0x51eaf5,_0x36d505){SmsQueueEvents[_0x64b2('0x7')](_0x2445aa+':'+_0x32df2e['id'],_0x32df2e);SmsQueueEvents[_0x64b2('0x7')](_0x2445aa,_0x32df2e);_0x36d505(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x64b2('0x8')](e,emitEvent(event));}}module[_0x64b2('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x6268=['emit','hasOwnProperty','hook','events','SmsQueue','save','update','remove'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x6268,0x193));var _0x8626=function(_0x57a215,_0x5a69af){_0x57a215=_0x57a215-0x0;var _0x240b14=_0x6268[_0x57a215];return _0x240b14;};'use strict';var EventEmitter=require(_0x8626('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x8626('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8626('0x2'),'afterUpdate':_0x8626('0x3'),'afterDestroy':_0x8626('0x4')};function emitEvent(_0x4669b2){return function(_0x42555d,_0x521b0d,_0x173b3e){SmsQueueEvents[_0x8626('0x5')](_0x4669b2+':'+_0x42555d['id'],_0x42555d);SmsQueueEvents[_0x8626('0x5')](_0x4669b2,_0x42555d);_0x173b3e(null);};}for(var e in events){if(events[_0x8626('0x6')](e)){var event=events[e];SmsQueue[_0x8626('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 0873663..bd9f7fd 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 _0x3ae7=['../../config/environment','./smsQueue.attributes','define','SmsQueue','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x496df0,_0x9045cb){var _0x6c2d3b=function(_0x52e8e4){while(--_0x52e8e4){_0x496df0['push'](_0x496df0['shift']());}};_0x6c2d3b(++_0x9045cb);}(_0x3ae7,0x1e4));var _0x73ae=function(_0xd8e857,_0x389ba5){_0xd8e857=_0xd8e857-0x0;var _0x67f361=_0x3ae7[_0xd8e857];return _0x67f361;};'use strict';var _=require(_0x73ae('0x0'));var util=require(_0x73ae('0x1'));var logger=require(_0x73ae('0x2'))(_0x73ae('0x3'));var moment=require('moment');var BPromise=require(_0x73ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73ae('0x5'));var rimraf=require('rimraf');var config=require(_0x73ae('0x6'));var attributes=require(_0x73ae('0x7'));module['exports']=function(_0x4e53fd,_0xd95e74){return _0x4e53fd[_0x73ae('0x8')](_0x73ae('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9bc=['rimraf','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','../../config/logger','request-promise','path'];(function(_0x59990c,_0x13ab03){var _0x51c6dc=function(_0x4a0770){while(--_0x4a0770){_0x59990c['push'](_0x59990c['shift']());}};_0x51c6dc(++_0x13ab03);}(_0xd9bc,0x1a3));var _0xcd9b=function(_0x218018,_0x219562){_0x218018=_0x218018-0x0;var _0x160712=_0xd9bc[_0x218018];return _0x160712;};'use strict';var _=require(_0xcd9b('0x0'));var util=require('util');var logger=require(_0xcd9b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcd9b('0x2'));var fs=require('fs');var path=require(_0xcd9b('0x3'));var rimraf=require(_0xcd9b('0x4'));var config=require('../../config/environment');var attributes=require(_0xcd9b('0x5'));module[_0xcd9b('0x6')]=function(_0x458fc4,_0x1e92d1){return _0x458fc4['define'](_0xcd9b('0x7'),attributes,{'tableName':_0xcd9b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 0dd9fd1..967f670 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 _0xe5fd=['map','ShowSmsQueue','SmsQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','attributes','limit','include','model'];(function(_0x426b63,_0x3b4c07){var _0x1adcc0=function(_0x638c80){while(--_0x638c80){_0x426b63['push'](_0x426b63['shift']());}};_0x1adcc0(++_0x3b4c07);}(_0xe5fd,0x1b1));var _0xde5f=function(_0x3b167c,_0x2aacbb){_0x3b167c=_0x3b167c-0x0;var _0x1b2999=_0xe5fd[_0x3b167c];return _0x1b2999;};'use strict';var _=require(_0xde5f('0x0'));var util=require('util');var moment=require(_0xde5f('0x1'));var BPromise=require(_0xde5f('0x2'));var rs=require(_0xde5f('0x3'));var fs=require('fs');var Redis=require(_0xde5f('0x4'));var db=require(_0xde5f('0x5'))['db'];var utils=require(_0xde5f('0x6'));var logger=require(_0xde5f('0x7'))(_0xde5f('0x8'));var config=require('../../config/environment');var jayson=require(_0xde5f('0x9'));var client=jayson[_0xde5f('0xa')][_0xde5f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde5f('0xc')],{'host':_0xde5f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde5f('0xc')]));require('./smsQueue.socket')[_0xde5f('0xe')](socket);function respondWithRpcPromise(_0x1fc813,_0x2c1751,_0x381d05){return new BPromise(function(_0xd11b0f,_0x4fb477){return client[_0xde5f('0xf')](_0x1fc813,_0x381d05)[_0xde5f('0x10')](function(_0xf8ab2){logger[_0xde5f('0x11')](_0xde5f('0x12'),_0x2c1751,_0xde5f('0x13'));logger[_0xde5f('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2c1751,_0xde5f('0x13'),JSON[_0xde5f('0x15')](_0xf8ab2));if(_0xf8ab2[_0xde5f('0x16')]){if(_0xf8ab2[_0xde5f('0x16')][_0xde5f('0x17')]===0x1f4){logger[_0xde5f('0x16')]('SmsQueue,\x20%s,\x20%s',_0x2c1751,_0xf8ab2['error'][_0xde5f('0x18')]);return _0x4fb477(_0xf8ab2[_0xde5f('0x16')][_0xde5f('0x18')]);}logger[_0xde5f('0x16')](_0xde5f('0x12'),_0x2c1751,_0xf8ab2['error'][_0xde5f('0x18')]);return _0xd11b0f(_0xf8ab2['error'][_0xde5f('0x18')]);}else{logger[_0xde5f('0x11')]('SmsQueue,\x20%s,\x20%s',_0x2c1751,_0xde5f('0x13'));_0xd11b0f(_0xf8ab2[_0xde5f('0x19')][_0xde5f('0x18')]);}})[_0xde5f('0x1a')](function(_0x51dc24){logger[_0xde5f('0x16')](_0xde5f('0x12'),_0x2c1751,_0x51dc24);_0x4fb477(_0x51dc24);});});}exports[_0xde5f('0x1b')]=function(_0x2e8217){var _0x4de51e=this;return new Promise(function(_0x4f9d24,_0x51f5e5){return db['SmsQueue'][_0xde5f('0x1c')]({'raw':_0x2e8217[_0xde5f('0x1d')]?_0x2e8217['options'][_0xde5f('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e8217[_0xde5f('0x1d')]?_0x2e8217[_0xde5f('0x1d')]['where']||null:null,'attributes':_0x2e8217[_0xde5f('0x1d')]?_0x2e8217[_0xde5f('0x1d')][_0xde5f('0x1f')]||null:null,'limit':_0x2e8217['options']?_0x2e8217[_0xde5f('0x1d')][_0xde5f('0x20')]||null:null,'include':_0x2e8217[_0xde5f('0x1d')]?_0x2e8217[_0xde5f('0x1d')][_0xde5f('0x21')]?_['map'](_0x2e8217[_0xde5f('0x1d')]['include'],function(_0x1587d0){return{'model':db[_0x1587d0[_0xde5f('0x22')]],'as':_0x1587d0['as'],'attributes':_0x1587d0[_0xde5f('0x1f')],'include':_0x1587d0[_0xde5f('0x21')]?_[_0xde5f('0x23')](_0x1587d0[_0xde5f('0x21')],function(_0x5692c5){return{'model':db[_0x5692c5['model']],'as':_0x5692c5['as'],'attributes':_0x5692c5['attributes'],'include':_0x5692c5[_0xde5f('0x21')]?_[_0xde5f('0x23')](_0x5692c5[_0xde5f('0x21')],function(_0x7a44d){return{'model':db[_0x7a44d[_0xde5f('0x22')]],'as':_0x7a44d['as'],'attributes':_0x7a44d[_0xde5f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xde5f('0x10')](function(_0x4d68cb){logger[_0xde5f('0x11')](_0xde5f('0x1b'),_0x2e8217);logger['debug']('GetSmsQueue',_0x2e8217,JSON['stringify'](_0x4d68cb));_0x4f9d24(_0x4d68cb);})[_0xde5f('0x1a')](function(_0x349284){logger[_0xde5f('0x16')](_0xde5f('0x1b'),_0x349284[_0xde5f('0x18')],_0x2e8217);_0x51f5e5(_0x4de51e[_0xde5f('0x16')](0x1f4,_0x349284[_0xde5f('0x18')]));});});};exports[_0xde5f('0x24')]=function(_0x40a6d4){var _0x3a4ad7=this;return new Promise(function(_0x12ee5e,_0x119019){return db[_0xde5f('0x25')]['find']({'raw':_0x40a6d4[_0xde5f('0x1d')]?_0x40a6d4[_0xde5f('0x1d')][_0xde5f('0x1e')]===undefined?!![]:![]:!![],'where':_0x40a6d4['options']?_0x40a6d4['options'][_0xde5f('0x26')]||null:null,'attributes':_0x40a6d4[_0xde5f('0x1d')]?_0x40a6d4[_0xde5f('0x1d')]['attributes']||null:null,'include':_0x40a6d4[_0xde5f('0x1d')]?_0x40a6d4[_0xde5f('0x1d')]['include']?_[_0xde5f('0x23')](_0x40a6d4['options']['include'],function(_0x528ec0){return{'model':db[_0x528ec0[_0xde5f('0x22')]],'as':_0x528ec0['as'],'attributes':_0x528ec0[_0xde5f('0x1f')],'include':_0x528ec0['include']?_[_0xde5f('0x23')](_0x528ec0[_0xde5f('0x21')],function(_0x34e0f0){return{'model':db[_0x34e0f0[_0xde5f('0x22')]],'as':_0x34e0f0['as'],'attributes':_0x34e0f0[_0xde5f('0x1f')],'include':_0x34e0f0[_0xde5f('0x21')]?_[_0xde5f('0x23')](_0x34e0f0[_0xde5f('0x21')],function(_0x5502d9){return{'model':db[_0x5502d9[_0xde5f('0x22')]],'as':_0x5502d9['as'],'attributes':_0x5502d9[_0xde5f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xde5f('0x10')](function(_0x2ac435){logger['info']('ShowSmsQueue',_0x40a6d4);logger[_0xde5f('0x14')]('ShowSmsQueue',_0x40a6d4,JSON[_0xde5f('0x15')](_0x2ac435));_0x12ee5e(_0x2ac435);})['catch'](function(_0x46cd13){logger[_0xde5f('0x16')](_0xde5f('0x24'),_0x46cd13[_0xde5f('0x18')],_0x40a6d4);_0x119019(_0x3a4ad7[_0xde5f('0x16')](0x1f4,_0x46cd13[_0xde5f('0x18')]));});});}; \ No newline at end of file +var _0xc4a9=['GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','model','ShowSmsQueue','find','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4e21ba,_0x18097f){var _0x55b94b=function(_0x3b9add){while(--_0x3b9add){_0x4e21ba['push'](_0x4e21ba['shift']());}};_0x55b94b(++_0x18097f);}(_0xc4a9,0xca));var _0x9c4a=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xc4a9[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x9c4a('0x0'));var util=require(_0x9c4a('0x1'));var moment=require(_0x9c4a('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c4a('0x3'));var fs=require('fs');var Redis=require(_0x9c4a('0x4'));var db=require(_0x9c4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9c4a('0x6'));var config=require('../../config/environment');var jayson=require(_0x9c4a('0x7'));var client=jayson[_0x9c4a('0x8')]['http']({'port':0x232a});config[_0x9c4a('0x9')]=_[_0x9c4a('0xa')](config[_0x9c4a('0x9')],{'host':_0x9c4a('0xb'),'port':0x18eb});var socket=require(_0x9c4a('0xc'))(new Redis(config[_0x9c4a('0x9')]));require(_0x9c4a('0xd'))['register'](socket);function respondWithRpcPromise(_0x2bea4c,_0x71aaf2,_0x3e4821){return new BPromise(function(_0x11b680,_0x5ca319){return client['request'](_0x2bea4c,_0x3e4821)[_0x9c4a('0xe')](function(_0x3c5c3d){logger[_0x9c4a('0xf')](_0x9c4a('0x10'),_0x71aaf2,_0x9c4a('0x11'));logger[_0x9c4a('0x12')](_0x9c4a('0x13'),_0x71aaf2,'request\x20sent',JSON[_0x9c4a('0x14')](_0x3c5c3d));if(_0x3c5c3d[_0x9c4a('0x15')]){if(_0x3c5c3d['error'][_0x9c4a('0x16')]===0x1f4){logger[_0x9c4a('0x15')]('SmsQueue,\x20%s,\x20%s',_0x71aaf2,_0x3c5c3d[_0x9c4a('0x15')][_0x9c4a('0x17')]);return _0x5ca319(_0x3c5c3d[_0x9c4a('0x15')][_0x9c4a('0x17')]);}logger['error'](_0x9c4a('0x10'),_0x71aaf2,_0x3c5c3d['error'][_0x9c4a('0x17')]);return _0x11b680(_0x3c5c3d[_0x9c4a('0x15')][_0x9c4a('0x17')]);}else{logger[_0x9c4a('0xf')](_0x9c4a('0x10'),_0x71aaf2,_0x9c4a('0x11'));_0x11b680(_0x3c5c3d[_0x9c4a('0x18')][_0x9c4a('0x17')]);}})[_0x9c4a('0x19')](function(_0x2bb98e){logger[_0x9c4a('0x15')](_0x9c4a('0x10'),_0x71aaf2,_0x2bb98e);_0x5ca319(_0x2bb98e);});});}exports[_0x9c4a('0x1a')]=function(_0x14eedc){var _0x56ddf5=this;return new Promise(function(_0x35ec43,_0x405c96){return db[_0x9c4a('0x1b')]['findAll']({'raw':_0x14eedc['options']?_0x14eedc[_0x9c4a('0x1c')][_0x9c4a('0x1d')]===undefined?!![]:![]:!![],'where':_0x14eedc[_0x9c4a('0x1c')]?_0x14eedc[_0x9c4a('0x1c')][_0x9c4a('0x1e')]||null:null,'attributes':_0x14eedc['options']?_0x14eedc[_0x9c4a('0x1c')][_0x9c4a('0x1f')]||null:null,'limit':_0x14eedc['options']?_0x14eedc['options'][_0x9c4a('0x20')]||null:null,'include':_0x14eedc[_0x9c4a('0x1c')]?_0x14eedc[_0x9c4a('0x1c')][_0x9c4a('0x21')]?_['map'](_0x14eedc[_0x9c4a('0x1c')][_0x9c4a('0x21')],function(_0x3e3667){return{'model':db[_0x3e3667['model']],'as':_0x3e3667['as'],'attributes':_0x3e3667[_0x9c4a('0x1f')],'include':_0x3e3667['include']?_['map'](_0x3e3667[_0x9c4a('0x21')],function(_0x210809){return{'model':db[_0x210809[_0x9c4a('0x22')]],'as':_0x210809['as'],'attributes':_0x210809[_0x9c4a('0x1f')],'include':_0x210809['include']?_['map'](_0x210809[_0x9c4a('0x21')],function(_0x111e1e){return{'model':db[_0x111e1e[_0x9c4a('0x22')]],'as':_0x111e1e['as'],'attributes':_0x111e1e[_0x9c4a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9c4a('0xe')](function(_0x270400){logger[_0x9c4a('0xf')](_0x9c4a('0x1a'),_0x14eedc);logger[_0x9c4a('0x12')](_0x9c4a('0x1a'),_0x14eedc,JSON[_0x9c4a('0x14')](_0x270400));_0x35ec43(_0x270400);})['catch'](function(_0x5dd7a3){logger['error'](_0x9c4a('0x1a'),_0x5dd7a3['message'],_0x14eedc);_0x405c96(_0x56ddf5[_0x9c4a('0x15')](0x1f4,_0x5dd7a3[_0x9c4a('0x17')]));});});};exports[_0x9c4a('0x23')]=function(_0xb424f8){var _0x95d3da=this;return new Promise(function(_0x371ea9,_0xd7d49f){return db['SmsQueue'][_0x9c4a('0x24')]({'raw':_0xb424f8['options']?_0xb424f8[_0x9c4a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xb424f8[_0x9c4a('0x1c')]?_0xb424f8['options'][_0x9c4a('0x1e')]||null:null,'attributes':_0xb424f8[_0x9c4a('0x1c')]?_0xb424f8[_0x9c4a('0x1c')]['attributes']||null:null,'include':_0xb424f8[_0x9c4a('0x1c')]?_0xb424f8['options'][_0x9c4a('0x21')]?_[_0x9c4a('0x25')](_0xb424f8[_0x9c4a('0x1c')][_0x9c4a('0x21')],function(_0x11fdca){return{'model':db[_0x11fdca['model']],'as':_0x11fdca['as'],'attributes':_0x11fdca[_0x9c4a('0x1f')],'include':_0x11fdca[_0x9c4a('0x21')]?_['map'](_0x11fdca[_0x9c4a('0x21')],function(_0x5ef7f9){return{'model':db[_0x5ef7f9[_0x9c4a('0x22')]],'as':_0x5ef7f9['as'],'attributes':_0x5ef7f9[_0x9c4a('0x1f')],'include':_0x5ef7f9['include']?_[_0x9c4a('0x25')](_0x5ef7f9[_0x9c4a('0x21')],function(_0x6d1917){return{'model':db[_0x6d1917[_0x9c4a('0x22')]],'as':_0x6d1917['as'],'attributes':_0x6d1917[_0x9c4a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9c4a('0xe')](function(_0x292ac5){logger[_0x9c4a('0xf')]('ShowSmsQueue',_0xb424f8);logger[_0x9c4a('0x12')](_0x9c4a('0x23'),_0xb424f8,JSON['stringify'](_0x292ac5));_0x371ea9(_0x292ac5);})[_0x9c4a('0x19')](function(_0x4c8647){logger[_0x9c4a('0x15')](_0x9c4a('0x23'),_0x4c8647[_0x9c4a('0x17')],_0xb424f8);_0xd7d49f(_0x95d3da[_0x9c4a('0x15')](0x1f4,_0x4c8647[_0x9c4a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index eb9cefa..495b564 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 _0x194a=['emit','removeListener','register','./smsQueue.events','remove'];(function(_0x5dd575,_0x12b875){var _0x4671cd=function(_0x394436){while(--_0x394436){_0x5dd575['push'](_0x5dd575['shift']());}};_0x4671cd(++_0x12b875);}(_0x194a,0x85));var _0xa194=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x194a[_0x59befa];return _0x1dd63d;};'use strict';var SmsQueueEvents=require(_0xa194('0x0'));var events=['save',_0xa194('0x1'),'update'];function createListener(_0xacb22d,_0x480790){return function(_0x4142cd){_0x480790[_0xa194('0x2')](_0xacb22d,_0x4142cd);};}function removeListener(_0x31c286,_0x5f1e8d){return function(){SmsQueueEvents[_0xa194('0x3')](_0x31c286,_0x5f1e8d);};}exports[_0xa194('0x4')]=function(_0xb20980){for(var _0x46962d=0x0,_0xd9a315=events['length'];_0x46962d<_0xd9a315;_0x46962d++){var _0x7f156=events[_0x46962d];var _0x1b53b8=createListener('smsQueue:'+_0x7f156,_0xb20980);SmsQueueEvents['on'](_0x7f156,_0x1b53b8);}}; \ No newline at end of file +var _0xfb56=['smsQueue:','./smsQueue.events','save','remove','removeListener','register','length'];(function(_0x2a0284,_0x590089){var _0x5ece76=function(_0x3095a4){while(--_0x3095a4){_0x2a0284['push'](_0x2a0284['shift']());}};_0x5ece76(++_0x590089);}(_0xfb56,0x1e4));var _0x6fb5=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xfb56[_0x215e65];return _0xa85842;};'use strict';var SmsQueueEvents=require(_0x6fb5('0x0'));var events=[_0x6fb5('0x1'),_0x6fb5('0x2'),'update'];function createListener(_0x7aea24,_0x55370d){return function(_0x481270){_0x55370d['emit'](_0x7aea24,_0x481270);};}function removeListener(_0x408ccc,_0x286f11){return function(){SmsQueueEvents[_0x6fb5('0x3')](_0x408ccc,_0x286f11);};}exports[_0x6fb5('0x4')]=function(_0x5951d1){for(var _0x18bf99=0x0,_0x31be00=events[_0x6fb5('0x5')];_0x18bf99<_0x31be00;_0x18bf99++){var _0x2eeefb=events[_0x18bf99];var _0x331f5d=createListener(_0x6fb5('0x6')+_0x2eeefb,_0x5951d1);SmsQueueEvents['on'](_0x2eeefb,_0x331f5d);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 7b33593..a454094 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 _0xcd89=['/describe','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0xcd89,0xc7));var _0x9cd8=function(_0x492480,_0x5c0de8){_0x492480=_0x492480-0x0;var _0x255edd=_0xcd89[_0x492480];return _0x255edd;};'use strict';var multer=require('multer');var util=require(_0x9cd8('0x0'));var path=require(_0x9cd8('0x1'));var timeout=require(_0x9cd8('0x2'));var express=require(_0x9cd8('0x3'));var router=express[_0x9cd8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd8('0x5'));var interaction=require(_0x9cd8('0x6'));var config=require(_0x9cd8('0x7'));var controller=require(_0x9cd8('0x8'));router[_0x9cd8('0x9')]('/',auth['isAuthenticated'](),controller[_0x9cd8('0xa')]);router[_0x9cd8('0x9')](_0x9cd8('0xb'),auth[_0x9cd8('0xc')](),controller['describe']);router['get'](_0x9cd8('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9cd8('0xe')]('/',auth[_0x9cd8('0xc')](),controller[_0x9cd8('0xf')]);router[_0x9cd8('0x10')](_0x9cd8('0xd'),auth[_0x9cd8('0xc')](),controller[_0x9cd8('0x11')]);router[_0x9cd8('0x12')]('/:id',auth[_0x9cd8('0xc')](),controller[_0x9cd8('0x13')]);module[_0x9cd8('0x14')]=router; \ No newline at end of file +var _0xb83f=['express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x5b1d47,_0x42082e){var _0x57fa68=function(_0x49c445){while(--_0x49c445){_0x5b1d47['push'](_0x5b1d47['shift']());}};_0x57fa68(++_0x42082e);}(_0xb83f,0x1b1));var _0xfb83=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xb83f[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0xfb83('0x0'));var util=require(_0xfb83('0x1'));var path=require(_0xfb83('0x2'));var timeout=require(_0xfb83('0x3'));var express=require(_0xfb83('0x4'));var router=express[_0xfb83('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfb83('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0xfb83('0x7')]('/',auth[_0xfb83('0x8')](),controller[_0xfb83('0x9')]);router[_0xfb83('0x7')](_0xfb83('0xa'),auth[_0xfb83('0x8')](),controller['describe']);router[_0xfb83('0x7')](_0xfb83('0xb'),auth[_0xfb83('0x8')](),controller[_0xfb83('0xc')]);router[_0xfb83('0xd')]('/',auth['isAuthenticated'](),controller[_0xfb83('0xe')]);router[_0xfb83('0xf')](_0xfb83('0xb'),auth[_0xfb83('0x8')](),controller[_0xfb83('0x10')]);router[_0xfb83('0x11')](_0xfb83('0xb'),auth[_0xfb83('0x8')](),controller['destroy']);module[_0xfb83('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 0f6284e..801bd9b 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 _0x7704=['DATE','sequelize','exports','STRING'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7704,0x18d));var _0x4770=function(_0x153776,_0x299c38){_0x153776=_0x153776-0x0;var _0x4c6887=_0x7704[_0x153776];return _0x4c6887;};'use strict';var moment=require('moment');var Sequelize=require(_0x4770('0x0'));module[_0x4770('0x1')]={'uniqueid':{'type':Sequelize[_0x4770('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4770('0x2')]},'joinAt':{'type':Sequelize[_0x4770('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4770('0x3')]},'exitAt':{'type':Sequelize[_0x4770('0x3')]},'reason':{'type':Sequelize[_0x4770('0x2')]}}; \ No newline at end of file +var _0xc238=['STRING','DATE','moment','sequelize'];(function(_0x42b99c,_0x2f775d){var _0x1bd261=function(_0xe0fbfd){while(--_0xe0fbfd){_0x42b99c['push'](_0x42b99c['shift']());}};_0x1bd261(++_0x2f775d);}(_0xc238,0x186));var _0x8c23=function(_0x42b321,_0x3cb124){_0x42b321=_0x42b321-0x0;var _0x4f1065=_0xc238[_0x42b321];return _0x4f1065;};'use strict';var moment=require(_0x8c23('0x0'));var Sequelize=require(_0x8c23('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x8c23('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8c23('0x3')]},'leaveAt':{'type':Sequelize[_0x8c23('0x3')]},'acceptAt':{'type':Sequelize[_0x8c23('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8c23('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 073f9a6..015dd50 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 _0xca2d=['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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','merge','body','contact','message','agent','account','index','SmsQueueReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','catch','keys','create','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel'];(function(_0x4d9100,_0x5d39ff){var _0x4ffd43=function(_0x517532){while(--_0x517532){_0x4d9100['push'](_0x4d9100['shift']());}};_0x4ffd43(++_0x5d39ff);}(_0xca2d,0x12d));var _0xdca2=function(_0xc8c149,_0x104184){_0xc8c149=_0xc8c149-0x0;var _0x261259=_0xca2d[_0xc8c149];return _0x261259;};'use strict';var emlformat=require(_0xdca2('0x0'));var rimraf=require(_0xdca2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdca2('0x2'));var rp=require(_0xdca2('0x3'));var moment=require(_0xdca2('0x4'));var BPromise=require(_0xdca2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdca2('0x6'));var sox=require(_0xdca2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdca2('0x8'));var _=require(_0xdca2('0x9'));var squel=require(_0xdca2('0xa'));var crypto=require('crypto');var jsforce=require(_0xdca2('0xb'));var deskjs=require(_0xdca2('0xc'));var toCsv=require(_0xdca2('0xd'));var querystring=require(_0xdca2('0xe'));var Papa=require(_0xdca2('0xf'));var Redis=require(_0xdca2('0x10'));var authService=require(_0xdca2('0x11'));var qs=require(_0xdca2('0x12'));var as=require(_0xdca2('0x13'));var hardwareService=require(_0xdca2('0x14'));var logger=require(_0xdca2('0x15'))(_0xdca2('0x16'));var utils=require(_0xdca2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdca2('0x18'))['db'];function respondWithStatusCode(_0x407cf0,_0x19092f){_0x19092f=_0x19092f||0xcc;return function(_0xa03886){if(_0xa03886){return _0x407cf0[_0xdca2('0x19')](_0x19092f);}return _0x407cf0['status'](_0x19092f)['end']();};}function respondWithResult(_0x41ba90,_0x2c0052){_0x2c0052=_0x2c0052||0xc8;return function(_0x72fb5e){if(_0x72fb5e){return _0x41ba90[_0xdca2('0x1a')](_0x2c0052)[_0xdca2('0x1b')](_0x72fb5e);}};}function respondWithFilteredResult(_0x2c02ce,_0x5650f0){return function(_0x4f655){if(_0x4f655){var _0x49f19d=typeof _0x5650f0[_0xdca2('0x1c')]===_0xdca2('0x1d')&&typeof _0x5650f0[_0xdca2('0x1e')]==='undefined';var _0x566ebe=_0x4f655['count'];var _0xf1534e=_0x49f19d?0x0:_0x5650f0[_0xdca2('0x1c')];var _0x50e6d5=_0x49f19d?_0x4f655[_0xdca2('0x1f')]:_0x5650f0[_0xdca2('0x1c')]+_0x5650f0[_0xdca2('0x1e')];var _0x19b28a;if(_0x50e6d5>=_0x566ebe){_0x50e6d5=_0x566ebe;_0x19b28a=0xc8;}else{_0x19b28a=0xce;}_0x2c02ce[_0xdca2('0x1a')](_0x19b28a);return _0x2c02ce[_0xdca2('0x20')](_0xdca2('0x21'),_0xf1534e+'-'+_0x50e6d5+'/'+_0x566ebe)[_0xdca2('0x1b')](_0x4f655);}return null;};}function patchUpdates(_0x184730){return function(_0x12855b){try{jsonpatch[_0xdca2('0x22')](_0x12855b,_0x184730,!![]);}catch(_0x5811b1){return BPromise[_0xdca2('0x23')](_0x5811b1);}return _0x12855b['save']();};}function saveUpdates(_0x578b55,_0x4a3f19){return function(_0x54144f){if(_0x54144f){return _0x54144f[_0xdca2('0x24')](_0x578b55)[_0xdca2('0x25')](function(_0x96bdea){return _0x96bdea;});}return null;};}function removeEntity(_0xab1b08,_0x653a41){return function(_0x235ba5){if(_0x235ba5){return _0x235ba5[_0xdca2('0x26')]()['then'](function(){_0xab1b08['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0821,_0x5bb0f1){return function(_0x4c7718){if(!_0x4c7718){_0x3a0821['sendStatus'](0x194);}return _0x4c7718;};}function handleError(_0x83da03,_0x2dbc92){_0x2dbc92=_0x2dbc92||0x1f4;return function(_0x35633c){logger[_0xdca2('0x27')](_0x35633c[_0xdca2('0x28')]);if(_0x35633c[_0xdca2('0x29')]){delete _0x35633c[_0xdca2('0x29')];}_0x83da03['status'](_0x2dbc92)[_0xdca2('0x2a')](_0x35633c);};}function getMustacheRender(_0x4c49cb,_0x3b1468){return Mustache['render'](_0x4c49cb,_[_0xdca2('0x2b')](_0x3b1468[_0xdca2('0x2c')],{'contact':_0x3b1468[_0xdca2('0x2d')],'message':_0x3b1468[_0xdca2('0x2e')],'agent':_0x3b1468[_0xdca2('0x2f')],'interaction':_0x3b1468['interaction'],'account':_0x3b1468[_0xdca2('0x30')]}))||'';}exports[_0xdca2('0x31')]=function(_0x19a9e5,_0x5ec996){var _0x14cdce={},_0x205972={},_0x1b8f1a={'count':0x0,'rows':[]};var _0x2a01fb=_['map'](db[_0xdca2('0x32')][_0xdca2('0x33')],function(_0x373dea){return{'name':_0x373dea[_0xdca2('0x34')],'type':_0x373dea['type'][_0xdca2('0x35')]};});_0x205972[_0xdca2('0x36')]=_[_0xdca2('0x37')](_0x2a01fb,_0xdca2('0x29'));_0x205972[_0xdca2('0x38')]=_['keys'](_0x19a9e5['query']);_0x205972[_0xdca2('0x39')]=_[_0xdca2('0x3a')](_0x205972['model'],_0x205972[_0xdca2('0x38')]);_0x14cdce[_0xdca2('0x3b')]=_[_0xdca2('0x3a')](_0x205972[_0xdca2('0x36')],qs[_0xdca2('0x3c')](_0x19a9e5[_0xdca2('0x38')]['fields']));_0x14cdce[_0xdca2('0x3b')]=_0x14cdce[_0xdca2('0x3b')][_0xdca2('0x3d')]?_0x14cdce[_0xdca2('0x3b')]:_0x205972[_0xdca2('0x36')];if(!_0x19a9e5[_0xdca2('0x38')]['hasOwnProperty'](_0xdca2('0x3e'))){_0x14cdce[_0xdca2('0x1e')]=qs[_0xdca2('0x1e')](_0x19a9e5[_0xdca2('0x38')]['limit']);_0x14cdce[_0xdca2('0x1c')]=qs['offset'](_0x19a9e5['query'][_0xdca2('0x1c')]);}_0x14cdce[_0xdca2('0x3f')]=qs[_0xdca2('0x40')](_0x19a9e5[_0xdca2('0x38')][_0xdca2('0x40')]);_0x14cdce[_0xdca2('0x41')]=qs[_0xdca2('0x39')](_[_0xdca2('0x42')](_0x19a9e5[_0xdca2('0x38')],_0x205972[_0xdca2('0x39')]),_0x2a01fb);if(_0x19a9e5[_0xdca2('0x38')][_0xdca2('0x43')]){_0x14cdce['where']=_[_0xdca2('0x2b')](_0x14cdce['where'],{'$or':_[_0xdca2('0x37')](_0x2a01fb,function(_0x1fed4f){if(_0x1fed4f['type']!==_0xdca2('0x44')){var _0x10e9d4={};_0x10e9d4[_0x1fed4f['name']]={'$like':'%'+_0x19a9e5[_0xdca2('0x38')][_0xdca2('0x43')]+'%'};return _0x10e9d4;}})});}_0x14cdce=_['merge']({},_0x14cdce,_0x19a9e5[_0xdca2('0x45')]);var _0x9ffff5={'where':_0x14cdce[_0xdca2('0x41')]};return db[_0xdca2('0x32')]['count'](_0x9ffff5)[_0xdca2('0x25')](function(_0xb5851d){_0x1b8f1a[_0xdca2('0x1f')]=_0xb5851d;if(_0x19a9e5['query'][_0xdca2('0x46')]){_0x14cdce[_0xdca2('0x47')]=[{'all':!![]}];}return db[_0xdca2('0x32')]['findAll'](_0x14cdce);})[_0xdca2('0x25')](function(_0x1580db){_0x1b8f1a['rows']=_0x1580db;return _0x1b8f1a;})['then'](respondWithFilteredResult(_0x5ec996,_0x14cdce))[_0xdca2('0x48')](handleError(_0x5ec996,null));};exports['show']=function(_0x2da73d,_0x25c63a){var _0x282ee2={'raw':!![],'where':{'id':_0x2da73d['params']['id']}},_0x3ac692={};_0x3ac692[_0xdca2('0x36')]=_[_0xdca2('0x49')](db[_0xdca2('0x32')][_0xdca2('0x33')]);_0x3ac692[_0xdca2('0x38')]=_[_0xdca2('0x49')](_0x2da73d[_0xdca2('0x38')]);_0x3ac692[_0xdca2('0x39')]=_[_0xdca2('0x3a')](_0x3ac692[_0xdca2('0x36')],_0x3ac692['query']);_0x282ee2[_0xdca2('0x3b')]=_[_0xdca2('0x3a')](_0x3ac692[_0xdca2('0x36')],qs[_0xdca2('0x3c')](_0x2da73d[_0xdca2('0x38')][_0xdca2('0x3c')]));_0x282ee2[_0xdca2('0x3b')]=_0x282ee2['attributes']['length']?_0x282ee2['attributes']:_0x3ac692['model'];if(_0x2da73d['query'][_0xdca2('0x46')]){_0x282ee2[_0xdca2('0x47')]=[{'all':!![]}];}_0x282ee2=_[_0xdca2('0x2b')]({},_0x282ee2,_0x2da73d[_0xdca2('0x45')]);return db[_0xdca2('0x32')]['find'](_0x282ee2)[_0xdca2('0x25')](handleEntityNotFound(_0x25c63a,null))['then'](respondWithResult(_0x25c63a,null))[_0xdca2('0x48')](handleError(_0x25c63a,null));};exports[_0xdca2('0x4a')]=function(_0x39c3c1,_0x46edb1){return db[_0xdca2('0x32')][_0xdca2('0x4a')](_0x39c3c1[_0xdca2('0x2c')],{})['then'](respondWithResult(_0x46edb1,0xc9))[_0xdca2('0x48')](handleError(_0x46edb1,null));};exports['update']=function(_0x429ba2,_0x55210b){if(_0x429ba2[_0xdca2('0x2c')]['id']){delete _0x429ba2[_0xdca2('0x2c')]['id'];}return db[_0xdca2('0x32')][_0xdca2('0x4b')]({'where':{'id':_0x429ba2[_0xdca2('0x4c')]['id']}})[_0xdca2('0x25')](handleEntityNotFound(_0x55210b,null))['then'](saveUpdates(_0x429ba2[_0xdca2('0x2c')],null))[_0xdca2('0x25')](respondWithResult(_0x55210b,null))[_0xdca2('0x48')](handleError(_0x55210b,null));};exports[_0xdca2('0x26')]=function(_0x1a1682,_0x317a2b){return db[_0xdca2('0x32')][_0xdca2('0x4b')]({'where':{'id':_0x1a1682[_0xdca2('0x4c')]['id']}})[_0xdca2('0x25')](handleEntityNotFound(_0x317a2b,null))[_0xdca2('0x25')](removeEntity(_0x317a2b,null))[_0xdca2('0x48')](handleError(_0x317a2b,null));};exports[_0xdca2('0x4d')]=function(_0x251ea0,_0x4cfb95){return db['SmsQueueReport'][_0xdca2('0x4d')]()[_0xdca2('0x25')](respondWithResult(_0x4cfb95,null))[_0xdca2('0x48')](handleError(_0x4cfb95,null));}; \ No newline at end of file +var _0xff20=['../../components/parsers/advancedSearch','../../config/logger','api','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','render','body','agent','interaction','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','keys','intersection','include','find','create','catch','update','params','describe','fast-json-patch','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0xff20,0x87));var _0x0ff2=function(_0x262799,_0x14a591){_0x262799=_0x262799-0x0;var _0x1a7368=_0xff20[_0x262799];return _0x1a7368;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0ff2('0x0'));var rp=require('request-promise');var moment=require(_0x0ff2('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x0ff2('0x2'));var util=require(_0x0ff2('0x3'));var path=require(_0x0ff2('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ff2('0x5'));var _=require(_0x0ff2('0x6'));var squel=require(_0x0ff2('0x7'));var crypto=require(_0x0ff2('0x8'));var jsforce=require(_0x0ff2('0x9'));var deskjs=require(_0x0ff2('0xa'));var toCsv=require(_0x0ff2('0xb'));var querystring=require('querystring');var Papa=require(_0x0ff2('0xc'));var Redis=require(_0x0ff2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0ff2('0xe'));var as=require(_0x0ff2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ff2('0x10'))(_0x0ff2('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2969c7,_0xb9f739){_0xb9f739=_0xb9f739||0xcc;return function(_0x46079b){if(_0x46079b){return _0x2969c7['sendStatus'](_0xb9f739);}return _0x2969c7[_0x0ff2('0x12')](_0xb9f739)['end']();};}function respondWithResult(_0x255741,_0x43c276){_0x43c276=_0x43c276||0xc8;return function(_0x27b8f3){if(_0x27b8f3){return _0x255741[_0x0ff2('0x12')](_0x43c276)[_0x0ff2('0x13')](_0x27b8f3);}};}function respondWithFilteredResult(_0x1a14e9,_0x51b70a){return function(_0x12243b){if(_0x12243b){var _0x46be0a=typeof _0x51b70a[_0x0ff2('0x14')]==='undefined'&&typeof _0x51b70a[_0x0ff2('0x15')]===_0x0ff2('0x16');var _0x72a2c2=_0x12243b['count'];var _0x4cab52=_0x46be0a?0x0:_0x51b70a[_0x0ff2('0x14')];var _0x187225=_0x46be0a?_0x12243b[_0x0ff2('0x17')]:_0x51b70a[_0x0ff2('0x14')]+_0x51b70a[_0x0ff2('0x15')];var _0xe21e60;if(_0x187225>=_0x72a2c2){_0x187225=_0x72a2c2;_0xe21e60=0xc8;}else{_0xe21e60=0xce;}_0x1a14e9[_0x0ff2('0x12')](_0xe21e60);return _0x1a14e9[_0x0ff2('0x18')](_0x0ff2('0x19'),_0x4cab52+'-'+_0x187225+'/'+_0x72a2c2)[_0x0ff2('0x13')](_0x12243b);}return null;};}function patchUpdates(_0x25b51c){return function(_0x21bfab){try{jsonpatch[_0x0ff2('0x1a')](_0x21bfab,_0x25b51c,!![]);}catch(_0x116c70){return BPromise[_0x0ff2('0x1b')](_0x116c70);}return _0x21bfab[_0x0ff2('0x1c')]();};}function saveUpdates(_0x3ef9b3,_0x2ae05a){return function(_0x239098){if(_0x239098){return _0x239098['update'](_0x3ef9b3)[_0x0ff2('0x1d')](function(_0x30e3a){return _0x30e3a;});}return null;};}function removeEntity(_0x9f7a62,_0x39a1be){return function(_0x526394){if(_0x526394){return _0x526394[_0x0ff2('0x1e')]()[_0x0ff2('0x1d')](function(){_0x9f7a62['status'](0xcc)[_0x0ff2('0x1f')]();});}};}function handleEntityNotFound(_0x525535,_0x349436){return function(_0x124968){if(!_0x124968){_0x525535[_0x0ff2('0x20')](0x194);}return _0x124968;};}function handleError(_0x290506,_0x3acc89){_0x3acc89=_0x3acc89||0x1f4;return function(_0x1f36c8){logger[_0x0ff2('0x21')](_0x1f36c8[_0x0ff2('0x22')]);if(_0x1f36c8[_0x0ff2('0x23')]){delete _0x1f36c8['name'];}_0x290506['status'](_0x3acc89)[_0x0ff2('0x24')](_0x1f36c8);};}function getMustacheRender(_0x5ad1ce,_0xa7a62f){return Mustache[_0x0ff2('0x25')](_0x5ad1ce,_['merge'](_0xa7a62f[_0x0ff2('0x26')],{'contact':_0xa7a62f['contact'],'message':_0xa7a62f['message'],'agent':_0xa7a62f[_0x0ff2('0x27')],'interaction':_0xa7a62f[_0x0ff2('0x28')],'account':_0xa7a62f['account']}))||'';}exports[_0x0ff2('0x29')]=function(_0x1b601a,_0x1f4333){var _0x4dfb93={},_0xa9db40={},_0x524077={'count':0x0,'rows':[]};var _0x2c124d=_['map'](db[_0x0ff2('0x2a')][_0x0ff2('0x2b')],function(_0x388b6c){return{'name':_0x388b6c[_0x0ff2('0x2c')],'type':_0x388b6c[_0x0ff2('0x2d')][_0x0ff2('0x2e')]};});_0xa9db40[_0x0ff2('0x2f')]=_[_0x0ff2('0x30')](_0x2c124d,_0x0ff2('0x23'));_0xa9db40[_0x0ff2('0x31')]=_['keys'](_0x1b601a[_0x0ff2('0x31')]);_0xa9db40[_0x0ff2('0x32')]=_['intersection'](_0xa9db40['model'],_0xa9db40['query']);_0x4dfb93[_0x0ff2('0x33')]=_['intersection'](_0xa9db40[_0x0ff2('0x2f')],qs['fields'](_0x1b601a['query'][_0x0ff2('0x34')]));_0x4dfb93['attributes']=_0x4dfb93[_0x0ff2('0x33')][_0x0ff2('0x35')]?_0x4dfb93[_0x0ff2('0x33')]:_0xa9db40['model'];if(!_0x1b601a[_0x0ff2('0x31')][_0x0ff2('0x36')]('nolimit')){_0x4dfb93[_0x0ff2('0x15')]=qs[_0x0ff2('0x15')](_0x1b601a['query'][_0x0ff2('0x15')]);_0x4dfb93[_0x0ff2('0x14')]=qs[_0x0ff2('0x14')](_0x1b601a[_0x0ff2('0x31')][_0x0ff2('0x14')]);}_0x4dfb93['order']=qs['sort'](_0x1b601a['query'][_0x0ff2('0x37')]);_0x4dfb93[_0x0ff2('0x38')]=qs[_0x0ff2('0x32')](_[_0x0ff2('0x39')](_0x1b601a[_0x0ff2('0x31')],_0xa9db40[_0x0ff2('0x32')]),_0x2c124d);if(_0x1b601a['query']['filter']){_0x4dfb93['where']=_[_0x0ff2('0x3a')](_0x4dfb93[_0x0ff2('0x38')],{'$or':_['map'](_0x2c124d,function(_0x117997){if(_0x117997[_0x0ff2('0x2d')]!==_0x0ff2('0x3b')){var _0x8a7e7c={};_0x8a7e7c[_0x117997[_0x0ff2('0x23')]]={'$like':'%'+_0x1b601a[_0x0ff2('0x31')][_0x0ff2('0x3c')]+'%'};return _0x8a7e7c;}})});}_0x4dfb93=_[_0x0ff2('0x3a')]({},_0x4dfb93,_0x1b601a[_0x0ff2('0x3d')]);var _0x320b8e={'where':_0x4dfb93['where']};return db['SmsQueueReport'][_0x0ff2('0x17')](_0x320b8e)[_0x0ff2('0x1d')](function(_0x5f187e){_0x524077['count']=_0x5f187e;if(_0x1b601a['query'][_0x0ff2('0x3e')]){_0x4dfb93['include']=[{'all':!![]}];}return db[_0x0ff2('0x2a')][_0x0ff2('0x3f')](_0x4dfb93);})[_0x0ff2('0x1d')](function(_0x3bd46d){_0x524077[_0x0ff2('0x40')]=_0x3bd46d;return _0x524077;})[_0x0ff2('0x1d')](respondWithFilteredResult(_0x1f4333,_0x4dfb93))['catch'](handleError(_0x1f4333,null));};exports[_0x0ff2('0x41')]=function(_0x32cba3,_0x1dcb8b){var _0x1aabae={'raw':!![],'where':{'id':_0x32cba3['params']['id']}},_0x1791c4={};_0x1791c4[_0x0ff2('0x2f')]=_[_0x0ff2('0x42')](db[_0x0ff2('0x2a')][_0x0ff2('0x2b')]);_0x1791c4[_0x0ff2('0x31')]=_['keys'](_0x32cba3[_0x0ff2('0x31')]);_0x1791c4[_0x0ff2('0x32')]=_['intersection'](_0x1791c4[_0x0ff2('0x2f')],_0x1791c4[_0x0ff2('0x31')]);_0x1aabae[_0x0ff2('0x33')]=_[_0x0ff2('0x43')](_0x1791c4[_0x0ff2('0x2f')],qs['fields'](_0x32cba3['query']['fields']));_0x1aabae[_0x0ff2('0x33')]=_0x1aabae[_0x0ff2('0x33')][_0x0ff2('0x35')]?_0x1aabae[_0x0ff2('0x33')]:_0x1791c4[_0x0ff2('0x2f')];if(_0x32cba3[_0x0ff2('0x31')]['includeAll']){_0x1aabae[_0x0ff2('0x44')]=[{'all':!![]}];}_0x1aabae=_[_0x0ff2('0x3a')]({},_0x1aabae,_0x32cba3[_0x0ff2('0x3d')]);return db[_0x0ff2('0x2a')][_0x0ff2('0x45')](_0x1aabae)[_0x0ff2('0x1d')](handleEntityNotFound(_0x1dcb8b,null))['then'](respondWithResult(_0x1dcb8b,null))['catch'](handleError(_0x1dcb8b,null));};exports['create']=function(_0x366a71,_0xf6b26a){return db['SmsQueueReport'][_0x0ff2('0x46')](_0x366a71[_0x0ff2('0x26')],{})[_0x0ff2('0x1d')](respondWithResult(_0xf6b26a,0xc9))[_0x0ff2('0x47')](handleError(_0xf6b26a,null));};exports[_0x0ff2('0x48')]=function(_0x49275f,_0x115e66){if(_0x49275f['body']['id']){delete _0x49275f['body']['id'];}return db['SmsQueueReport'][_0x0ff2('0x45')]({'where':{'id':_0x49275f[_0x0ff2('0x49')]['id']}})[_0x0ff2('0x1d')](handleEntityNotFound(_0x115e66,null))[_0x0ff2('0x1d')](saveUpdates(_0x49275f[_0x0ff2('0x26')],null))[_0x0ff2('0x1d')](respondWithResult(_0x115e66,null))['catch'](handleError(_0x115e66,null));};exports[_0x0ff2('0x1e')]=function(_0x4e0456,_0x2a87d3){return db[_0x0ff2('0x2a')]['find']({'where':{'id':_0x4e0456['params']['id']}})[_0x0ff2('0x1d')](handleEntityNotFound(_0x2a87d3,null))[_0x0ff2('0x1d')](removeEntity(_0x2a87d3,null))[_0x0ff2('0x47')](handleError(_0x2a87d3,null));};exports[_0x0ff2('0x4a')]=function(_0x2e5fcf,_0x45cf52){return db['SmsQueueReport'][_0x0ff2('0x4a')]()[_0x0ff2('0x1d')](respondWithResult(_0x45cf52,null))[_0x0ff2('0x47')](handleError(_0x45cf52,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 8a4f94a..1280f4a 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 _0x5e2b=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue'];(function(_0x4fa892,_0x4e66a0){var _0x260ef6=function(_0x3ac4a5){while(--_0x3ac4a5){_0x4fa892['push'](_0x4fa892['shift']());}};_0x260ef6(++_0x4e66a0);}(_0x5e2b,0xd2));var _0xb5e2=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x5e2b[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require('lodash');var util=require(_0xb5e2('0x0'));var logger=require(_0xb5e2('0x1'))(_0xb5e2('0x2'));var moment=require(_0xb5e2('0x3'));var BPromise=require(_0xb5e2('0x4'));var rp=require(_0xb5e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb5e2('0x6'));module['exports']=function(_0x347bf1,_0xd7053d){return _0x347bf1[_0xb5e2('0x7')](_0xb5e2('0x8'),attributes,{'tableName':_0xb5e2('0x9'),'paranoid':![],'indexes':[{'name':_0xb5e2('0xa'),'fields':[_0xb5e2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bc6=['./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','path','../../config/environment'];(function(_0x8b2fbc,_0x5dc121){var _0x43f51c=function(_0x547756){while(--_0x547756){_0x8b2fbc['push'](_0x8b2fbc['shift']());}};_0x43f51c(++_0x5dc121);}(_0x2bc6,0x163));var _0x62bc=function(_0x11e09b,_0x56069e){_0x11e09b=_0x11e09b-0x0;var _0x4c4a57=_0x2bc6[_0x11e09b];return _0x4c4a57;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var logger=require(_0x62bc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x62bc('0x3'));var rimraf=require('rimraf');var config=require(_0x62bc('0x4'));var attributes=require(_0x62bc('0x5'));module['exports']=function(_0x3cce26,_0x450cb6){return _0x3cce26[_0x62bc('0x6')](_0x62bc('0x7'),attributes,{'tableName':_0x62bc('0x8'),'paranoid':![],'indexes':[{'name':_0x62bc('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 6e010e9..0c3e6d0 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 _0x01c6=['error','code','message','SmsQueueReport,\x20%s,\x20%s','info','result','CreateSmsQueueReport','options','debug','catch','UpdateSmsQueueReport','SmsQueueReport','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x01c6,0x1aa));var _0x601c=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0x01c6[_0x47e93d];return _0xe86c46;};'use strict';var _=require(_0x601c('0x0'));var util=require(_0x601c('0x1'));var moment=require(_0x601c('0x2'));var BPromise=require(_0x601c('0x3'));var rs=require(_0x601c('0x4'));var fs=require('fs');var Redis=require(_0x601c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x601c('0x6'));var logger=require(_0x601c('0x7'))(_0x601c('0x8'));var config=require(_0x601c('0x9'));var jayson=require(_0x601c('0xa'));var client=jayson['client'][_0x601c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a3d5c,_0x290a6e,_0x3776a4){return new BPromise(function(_0x50cdb6,_0x3d948a){return client['request'](_0x4a3d5c,_0x3776a4)[_0x601c('0xc')](function(_0x44160c){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x290a6e,'request\x20sent');logger['debug'](_0x601c('0xd'),_0x290a6e,_0x601c('0xe'),JSON[_0x601c('0xf')](_0x44160c));if(_0x44160c[_0x601c('0x10')]){if(_0x44160c['error'][_0x601c('0x11')]===0x1f4){logger[_0x601c('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x290a6e,_0x44160c[_0x601c('0x10')][_0x601c('0x12')]);return _0x3d948a(_0x44160c['error'][_0x601c('0x12')]);}logger[_0x601c('0x10')](_0x601c('0x13'),_0x290a6e,_0x44160c[_0x601c('0x10')][_0x601c('0x12')]);return _0x50cdb6(_0x44160c['error']['message']);}else{logger[_0x601c('0x14')](_0x601c('0x13'),_0x290a6e,_0x601c('0xe'));_0x50cdb6(_0x44160c[_0x601c('0x15')][_0x601c('0x12')]);}})['catch'](function(_0x2b3767){logger['error'](_0x601c('0x13'),_0x290a6e,_0x2b3767);_0x3d948a(_0x2b3767);});});}exports[_0x601c('0x16')]=function(_0x2dfe0b){var _0x39756a=this;return new Promise(function(_0x5489b7,_0x2600bc){return db['SmsQueueReport']['create'](_0x2dfe0b['body'],{'raw':_0x2dfe0b[_0x601c('0x17')]?_0x2dfe0b[_0x601c('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x601c('0xc')](function(_0x517d58){logger[_0x601c('0x14')](_0x601c('0x16'),_0x2dfe0b);logger[_0x601c('0x18')](_0x601c('0x16'),_0x2dfe0b,JSON[_0x601c('0xf')](_0x517d58));_0x5489b7(_0x517d58);})[_0x601c('0x19')](function(_0x19227a){logger['error'](_0x601c('0x16'),_0x19227a[_0x601c('0x12')],_0x2dfe0b);_0x2600bc(_0x39756a[_0x601c('0x10')](0x1f4,_0x19227a[_0x601c('0x12')]));});});};exports[_0x601c('0x1a')]=function(_0x5d18c8){var _0x3c9bed=this;return new Promise(function(_0x101303,_0x3d3f30){return db[_0x601c('0x1b')][_0x601c('0x1c')](_0x5d18c8[_0x601c('0x1d')],{'raw':_0x5d18c8['options']?_0x5d18c8[_0x601c('0x17')][_0x601c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d18c8['options']?_0x5d18c8[_0x601c('0x17')][_0x601c('0x1f')]||null:null,'attributes':_0x5d18c8[_0x601c('0x17')]?_0x5d18c8[_0x601c('0x17')][_0x601c('0x20')]||null:null,'limit':_0x5d18c8[_0x601c('0x17')]?_0x5d18c8[_0x601c('0x17')][_0x601c('0x21')]||null:null})[_0x601c('0xc')](function(_0x8abf05){logger['info']('UpdateSmsQueueReport',_0x5d18c8);logger[_0x601c('0x18')](_0x601c('0x1a'),_0x5d18c8,JSON['stringify'](_0x8abf05));_0x101303(_0x8abf05);})[_0x601c('0x19')](function(_0x4a17e7){logger[_0x601c('0x10')](_0x601c('0x1a'),_0x4a17e7[_0x601c('0x12')],_0x5d18c8);_0x3d3f30(_0x3c9bed[_0x601c('0x10')](0x1f4,_0x4a17e7[_0x601c('0x12')]));});});}; \ No newline at end of file +var _0xcb8d=['then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x495f05,_0x369d88){var _0x27c6b7=function(_0x14d808){while(--_0x14d808){_0x495f05['push'](_0x495f05['shift']());}};_0x27c6b7(++_0x369d88);}(_0xcb8d,0x80));var _0xdcb8=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0xcb8d[_0x557fd2];return _0x1b54a2;};'use strict';var _=require(_0xdcb8('0x0'));var util=require(_0xdcb8('0x1'));var moment=require('moment');var BPromise=require(_0xdcb8('0x2'));var rs=require(_0xdcb8('0x3'));var fs=require('fs');var Redis=require(_0xdcb8('0x4'));var db=require(_0xdcb8('0x5'))['db'];var utils=require(_0xdcb8('0x6'));var logger=require(_0xdcb8('0x7'))(_0xdcb8('0x8'));var config=require(_0xdcb8('0x9'));var jayson=require(_0xdcb8('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3627,_0x3ce1eb,_0x263731){return new BPromise(function(_0x4600ea,_0x6cd1c){return client[_0xdcb8('0xb')](_0x3c3627,_0x263731)[_0xdcb8('0xc')](function(_0x2cfbf0){logger['info'](_0xdcb8('0xd'),_0x3ce1eb,_0xdcb8('0xe'));logger[_0xdcb8('0xf')](_0xdcb8('0x10'),_0x3ce1eb,'request\x20sent',JSON[_0xdcb8('0x11')](_0x2cfbf0));if(_0x2cfbf0[_0xdcb8('0x12')]){if(_0x2cfbf0[_0xdcb8('0x12')][_0xdcb8('0x13')]===0x1f4){logger[_0xdcb8('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x3ce1eb,_0x2cfbf0[_0xdcb8('0x12')][_0xdcb8('0x14')]);return _0x6cd1c(_0x2cfbf0[_0xdcb8('0x12')][_0xdcb8('0x14')]);}logger[_0xdcb8('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x3ce1eb,_0x2cfbf0[_0xdcb8('0x12')][_0xdcb8('0x14')]);return _0x4600ea(_0x2cfbf0['error'][_0xdcb8('0x14')]);}else{logger[_0xdcb8('0x15')](_0xdcb8('0xd'),_0x3ce1eb,_0xdcb8('0xe'));_0x4600ea(_0x2cfbf0[_0xdcb8('0x16')]['message']);}})[_0xdcb8('0x17')](function(_0xba9f7a){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3ce1eb,_0xba9f7a);_0x6cd1c(_0xba9f7a);});});}exports[_0xdcb8('0x18')]=function(_0x3eb240){var _0x5842ca=this;return new Promise(function(_0x597ebd,_0x58663f){return db[_0xdcb8('0x19')][_0xdcb8('0x1a')](_0x3eb240[_0xdcb8('0x1b')],{'raw':_0x3eb240[_0xdcb8('0x1c')]?_0x3eb240[_0xdcb8('0x1c')][_0xdcb8('0x1d')]===undefined?!![]:![]:!![]})[_0xdcb8('0xc')](function(_0x29a290){logger[_0xdcb8('0x15')](_0xdcb8('0x18'),_0x3eb240);logger[_0xdcb8('0xf')](_0xdcb8('0x18'),_0x3eb240,JSON['stringify'](_0x29a290));_0x597ebd(_0x29a290);})[_0xdcb8('0x17')](function(_0x527bb3){logger[_0xdcb8('0x12')](_0xdcb8('0x18'),_0x527bb3[_0xdcb8('0x14')],_0x3eb240);_0x58663f(_0x5842ca[_0xdcb8('0x12')](0x1f4,_0x527bb3[_0xdcb8('0x14')]));});});};exports[_0xdcb8('0x1e')]=function(_0x31d8a4){var _0x3e4631=this;return new Promise(function(_0x36d90e,_0x5915de){return db['SmsQueueReport'][_0xdcb8('0x1f')](_0x31d8a4[_0xdcb8('0x1b')],{'raw':_0x31d8a4[_0xdcb8('0x1c')]?_0x31d8a4[_0xdcb8('0x1c')][_0xdcb8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31d8a4['options']?_0x31d8a4['options'][_0xdcb8('0x20')]||null:null,'attributes':_0x31d8a4[_0xdcb8('0x1c')]?_0x31d8a4[_0xdcb8('0x1c')][_0xdcb8('0x21')]||null:null,'limit':_0x31d8a4[_0xdcb8('0x1c')]?_0x31d8a4[_0xdcb8('0x1c')][_0xdcb8('0x22')]||null:null})[_0xdcb8('0xc')](function(_0x487dbd){logger[_0xdcb8('0x15')]('UpdateSmsQueueReport',_0x31d8a4);logger['debug']('UpdateSmsQueueReport',_0x31d8a4,JSON[_0xdcb8('0x11')](_0x487dbd));_0x36d90e(_0x487dbd);})[_0xdcb8('0x17')](function(_0x5354aa){logger['error'](_0xdcb8('0x1e'),_0x5354aa[_0xdcb8('0x14')],_0x31d8a4);_0x5915de(_0x3e4631[_0xdcb8('0x12')](0x1f4,_0x5354aa[_0xdcb8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 33798df..4857a69 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 _0xc5b2=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','create','update'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xc5b2,0x158));var _0x2c5b=function(_0x2eddf6,_0x543459){_0x2eddf6=_0x2eddf6-0x0;var _0x3d9adc=_0xc5b2[_0x2eddf6];return _0x3d9adc;};'use strict';var multer=require(_0x2c5b('0x0'));var util=require(_0x2c5b('0x1'));var path=require(_0x2c5b('0x2'));var timeout=require(_0x2c5b('0x3'));var express=require(_0x2c5b('0x4'));var router=express[_0x2c5b('0x5')]();var fs_extra=require(_0x2c5b('0x6'));var auth=require(_0x2c5b('0x7'));var interaction=require(_0x2c5b('0x8'));var config=require(_0x2c5b('0x9'));var controller=require('./smsTransferReport.controller');router[_0x2c5b('0xa')]('/',auth[_0x2c5b('0xb')](),controller[_0x2c5b('0xc')]);router[_0x2c5b('0xa')]('/describe',auth[_0x2c5b('0xb')](),controller[_0x2c5b('0xd')]);router['get'](_0x2c5b('0xe'),auth[_0x2c5b('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2c5b('0xf')]);router['put'](_0x2c5b('0xe'),auth[_0x2c5b('0xb')](),controller[_0x2c5b('0x10')]);router[_0x2c5b('0x11')](_0x2c5b('0xe'),auth[_0x2c5b('0xb')](),controller['destroy']);module[_0x2c5b('0x12')]=router; \ No newline at end of file +var _0xf4d6=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','post','create','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4d6,0xd4));var _0x6f4d=function(_0x40ef55,_0x9441dc){_0x40ef55=_0x40ef55-0x0;var _0x4c1c00=_0xf4d6[_0x40ef55];return _0x4c1c00;};'use strict';var multer=require('multer');var util=require(_0x6f4d('0x0'));var path=require(_0x6f4d('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f4d('0x2'));var router=express[_0x6f4d('0x3')]();var fs_extra=require(_0x6f4d('0x4'));var auth=require(_0x6f4d('0x5'));var interaction=require(_0x6f4d('0x6'));var config=require(_0x6f4d('0x7'));var controller=require('./smsTransferReport.controller');router[_0x6f4d('0x8')]('/',auth['isAuthenticated'](),controller[_0x6f4d('0x9')]);router[_0x6f4d('0x8')]('/describe',auth[_0x6f4d('0xa')](),controller[_0x6f4d('0xb')]);router[_0x6f4d('0x8')](_0x6f4d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6f4d('0xd')]('/',auth[_0x6f4d('0xa')](),controller[_0x6f4d('0xe')]);router['put'](_0x6f4d('0xc'),auth[_0x6f4d('0xa')](),controller[_0x6f4d('0xf')]);router[_0x6f4d('0x10')]('/:id',auth[_0x6f4d('0xa')](),controller[_0x6f4d('0x11')]);module[_0x6f4d('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 689a88e..ddbfc16 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 _0x26ad=['sequelize','STRING','account','agent','DATE','NOW','moment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x26ad,0x18e));var _0xd26a=function(_0x20118a,_0x3dbdf3){_0x20118a=_0x20118a-0x0;var _0x538b5f=_0x26ad[_0x20118a];return _0x538b5f;};'use strict';var moment=require(_0xd26a('0x0'));var Sequelize=require(_0xd26a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd26a('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd26a('0x3'),_0xd26a('0x4'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xd26a('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xd26a('0x6')]}}; \ No newline at end of file +var _0x756f=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x756f,0x11d));var _0xf756=function(_0x5189f7,_0x3a2203){_0x5189f7=_0x5189f7-0x0;var _0x2019b0=_0x756f[_0x5189f7];return _0x2019b0;};'use strict';var moment=require(_0xf756('0x0'));var Sequelize=require(_0xf756('0x1'));module[_0xf756('0x2')]={'uniqueid':{'type':Sequelize[_0xf756('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf756('0x4')](_0xf756('0x5'),_0xf756('0x6'),_0xf756('0x7')),'allowNull':![],'defaultValue':_0xf756('0x7')},'transferredAt':{'type':Sequelize[_0xf756('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xf756('0x9')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 514d565..8a191d4 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 _0xeac0=['send','merge','body','contact','message','account','index','map','SmsTransferReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name'];(function(_0xae12d4,_0x2dc825){var _0x4038c1=function(_0x2c87b2){while(--_0x2c87b2){_0xae12d4['push'](_0xae12d4['shift']());}};_0x4038c1(++_0x2dc825);}(_0xeac0,0xc3));var _0x0eac=function(_0x2d9a49,_0x1cdcd5){_0x2d9a49=_0x2d9a49-0x0;var _0x331ad5=_0xeac0[_0x2d9a49];return _0x331ad5;};'use strict';var emlformat=require(_0x0eac('0x0'));var rimraf=require(_0x0eac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0eac('0x2'));var rp=require('request-promise');var moment=require(_0x0eac('0x3'));var BPromise=require(_0x0eac('0x4'));var Mustache=require(_0x0eac('0x5'));var util=require(_0x0eac('0x6'));var path=require(_0x0eac('0x7'));var sox=require(_0x0eac('0x8'));var csv=require(_0x0eac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0eac('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0eac('0xb'));var jsforce=require(_0x0eac('0xc'));var deskjs=require(_0x0eac('0xd'));var toCsv=require(_0x0eac('0x9'));var querystring=require(_0x0eac('0xe'));var Papa=require(_0x0eac('0xf'));var Redis=require(_0x0eac('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0eac('0x11'));var as=require(_0x0eac('0x12'));var hardwareService=require(_0x0eac('0x13'));var logger=require(_0x0eac('0x14'))(_0x0eac('0x15'));var utils=require(_0x0eac('0x16'));var config=require(_0x0eac('0x17'));var licenseUtil=require(_0x0eac('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c08f4,_0xeb6192){_0xeb6192=_0xeb6192||0xcc;return function(_0x53c8ba){if(_0x53c8ba){return _0x4c08f4[_0x0eac('0x19')](_0xeb6192);}return _0x4c08f4[_0x0eac('0x1a')](_0xeb6192)[_0x0eac('0x1b')]();};}function respondWithResult(_0x2c41ac,_0x2b3ef8){_0x2b3ef8=_0x2b3ef8||0xc8;return function(_0x54129e){if(_0x54129e){return _0x2c41ac[_0x0eac('0x1a')](_0x2b3ef8)[_0x0eac('0x1c')](_0x54129e);}};}function respondWithFilteredResult(_0x18c8da,_0x2d5864){return function(_0x1b7667){if(_0x1b7667){var _0x444fae=typeof _0x2d5864[_0x0eac('0x1d')]===_0x0eac('0x1e')&&typeof _0x2d5864[_0x0eac('0x1f')]===_0x0eac('0x1e');var _0x56e875=_0x1b7667[_0x0eac('0x20')];var _0x2c4655=_0x444fae?0x0:_0x2d5864[_0x0eac('0x1d')];var _0x5b9a57=_0x444fae?_0x1b7667[_0x0eac('0x20')]:_0x2d5864[_0x0eac('0x1d')]+_0x2d5864[_0x0eac('0x1f')];var _0x14e831;if(_0x5b9a57>=_0x56e875){_0x5b9a57=_0x56e875;_0x14e831=0xc8;}else{_0x14e831=0xce;}_0x18c8da[_0x0eac('0x1a')](_0x14e831);return _0x18c8da[_0x0eac('0x21')]('Content-Range',_0x2c4655+'-'+_0x5b9a57+'/'+_0x56e875)['json'](_0x1b7667);}return null;};}function patchUpdates(_0x32edb0){return function(_0x1d0e67){try{jsonpatch[_0x0eac('0x22')](_0x1d0e67,_0x32edb0,!![]);}catch(_0x35d5fd){return BPromise['reject'](_0x35d5fd);}return _0x1d0e67[_0x0eac('0x23')]();};}function saveUpdates(_0x928316,_0x4ea00c){return function(_0x58d9d5){if(_0x58d9d5){return _0x58d9d5[_0x0eac('0x24')](_0x928316)[_0x0eac('0x25')](function(_0x51869d){return _0x51869d;});}return null;};}function removeEntity(_0x4cee83,_0x3bfdd8){return function(_0x514be8){if(_0x514be8){return _0x514be8[_0x0eac('0x26')]()[_0x0eac('0x25')](function(){_0x4cee83['status'](0xcc)[_0x0eac('0x1b')]();});}};}function handleEntityNotFound(_0x47f407,_0x1ee1b8){return function(_0x90fc7){if(!_0x90fc7){_0x47f407[_0x0eac('0x19')](0x194);}return _0x90fc7;};}function handleError(_0x13967f,_0x5cce2e){_0x5cce2e=_0x5cce2e||0x1f4;return function(_0x207bc1){logger[_0x0eac('0x27')](_0x207bc1[_0x0eac('0x28')]);if(_0x207bc1[_0x0eac('0x29')]){delete _0x207bc1[_0x0eac('0x29')];}_0x13967f[_0x0eac('0x1a')](_0x5cce2e)[_0x0eac('0x2a')](_0x207bc1);};}function getMustacheRender(_0x519177,_0x9efb1d){return Mustache['render'](_0x519177,_[_0x0eac('0x2b')](_0x9efb1d[_0x0eac('0x2c')],{'contact':_0x9efb1d[_0x0eac('0x2d')],'message':_0x9efb1d[_0x0eac('0x2e')],'agent':_0x9efb1d['agent'],'interaction':_0x9efb1d['interaction'],'account':_0x9efb1d[_0x0eac('0x2f')]}))||'';}exports[_0x0eac('0x30')]=function(_0x3afd34,_0x180f7c){var _0x5a1d60={},_0x2b0c55={},_0x5f438d={'count':0x0,'rows':[]};var _0x50280c=_[_0x0eac('0x31')](db[_0x0eac('0x32')]['rawAttributes'],function(_0x15d2aa){return{'name':_0x15d2aa[_0x0eac('0x33')],'type':_0x15d2aa[_0x0eac('0x34')][_0x0eac('0x35')]};});_0x2b0c55['model']=_[_0x0eac('0x31')](_0x50280c,'name');_0x2b0c55[_0x0eac('0x36')]=_[_0x0eac('0x37')](_0x3afd34[_0x0eac('0x36')]);_0x2b0c55[_0x0eac('0x38')]=_[_0x0eac('0x39')](_0x2b0c55['model'],_0x2b0c55[_0x0eac('0x36')]);_0x5a1d60[_0x0eac('0x3a')]=_['intersection'](_0x2b0c55[_0x0eac('0x3b')],qs[_0x0eac('0x3c')](_0x3afd34['query'][_0x0eac('0x3c')]));_0x5a1d60[_0x0eac('0x3a')]=_0x5a1d60[_0x0eac('0x3a')][_0x0eac('0x3d')]?_0x5a1d60['attributes']:_0x2b0c55['model'];if(!_0x3afd34[_0x0eac('0x36')][_0x0eac('0x3e')](_0x0eac('0x3f'))){_0x5a1d60[_0x0eac('0x1f')]=qs[_0x0eac('0x1f')](_0x3afd34[_0x0eac('0x36')][_0x0eac('0x1f')]);_0x5a1d60['offset']=qs[_0x0eac('0x1d')](_0x3afd34[_0x0eac('0x36')]['offset']);}_0x5a1d60['order']=qs[_0x0eac('0x40')](_0x3afd34['query'][_0x0eac('0x40')]);_0x5a1d60[_0x0eac('0x41')]=qs[_0x0eac('0x38')](_[_0x0eac('0x42')](_0x3afd34[_0x0eac('0x36')],_0x2b0c55[_0x0eac('0x38')]),_0x50280c);if(_0x3afd34[_0x0eac('0x36')][_0x0eac('0x43')]){_0x5a1d60['where']=_[_0x0eac('0x2b')](_0x5a1d60[_0x0eac('0x41')],{'$or':_[_0x0eac('0x31')](_0x50280c,function(_0x184bba){if(_0x184bba[_0x0eac('0x34')]!==_0x0eac('0x44')){var _0x1a615a={};_0x1a615a[_0x184bba[_0x0eac('0x29')]]={'$like':'%'+_0x3afd34[_0x0eac('0x36')]['filter']+'%'};return _0x1a615a;}})});}_0x5a1d60=_['merge']({},_0x5a1d60,_0x3afd34[_0x0eac('0x45')]);var _0x5d17cb={'where':_0x5a1d60[_0x0eac('0x41')]};return db['SmsTransferReport'][_0x0eac('0x20')](_0x5d17cb)[_0x0eac('0x25')](function(_0x588680){_0x5f438d['count']=_0x588680;if(_0x3afd34[_0x0eac('0x36')][_0x0eac('0x46')]){_0x5a1d60[_0x0eac('0x47')]=[{'all':!![]}];}return db[_0x0eac('0x32')][_0x0eac('0x48')](_0x5a1d60);})[_0x0eac('0x25')](function(_0x104c1e){_0x5f438d['rows']=_0x104c1e;return _0x5f438d;})[_0x0eac('0x25')](respondWithFilteredResult(_0x180f7c,_0x5a1d60))[_0x0eac('0x49')](handleError(_0x180f7c,null));};exports['show']=function(_0x323bf4,_0x5ee5ca){var _0x1e4246={'raw':!![],'where':{'id':_0x323bf4[_0x0eac('0x4a')]['id']}},_0x457511={};_0x457511[_0x0eac('0x3b')]=_[_0x0eac('0x37')](db[_0x0eac('0x32')][_0x0eac('0x4b')]);_0x457511[_0x0eac('0x36')]=_[_0x0eac('0x37')](_0x323bf4[_0x0eac('0x36')]);_0x457511[_0x0eac('0x38')]=_[_0x0eac('0x39')](_0x457511[_0x0eac('0x3b')],_0x457511[_0x0eac('0x36')]);_0x1e4246['attributes']=_['intersection'](_0x457511[_0x0eac('0x3b')],qs['fields'](_0x323bf4[_0x0eac('0x36')][_0x0eac('0x3c')]));_0x1e4246['attributes']=_0x1e4246['attributes']['length']?_0x1e4246[_0x0eac('0x3a')]:_0x457511[_0x0eac('0x3b')];if(_0x323bf4[_0x0eac('0x36')]['includeAll']){_0x1e4246[_0x0eac('0x47')]=[{'all':!![]}];}_0x1e4246=_[_0x0eac('0x2b')]({},_0x1e4246,_0x323bf4['options']);return db['SmsTransferReport'][_0x0eac('0x4c')](_0x1e4246)[_0x0eac('0x25')](handleEntityNotFound(_0x5ee5ca,null))[_0x0eac('0x25')](respondWithResult(_0x5ee5ca,null))[_0x0eac('0x49')](handleError(_0x5ee5ca,null));};exports[_0x0eac('0x4d')]=function(_0x175023,_0x50918b){return db[_0x0eac('0x32')][_0x0eac('0x4d')](_0x175023['body'],{})[_0x0eac('0x25')](respondWithResult(_0x50918b,0xc9))[_0x0eac('0x49')](handleError(_0x50918b,null));};exports['update']=function(_0x461811,_0x345782){if(_0x461811[_0x0eac('0x2c')]['id']){delete _0x461811['body']['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x461811[_0x0eac('0x4a')]['id']}})[_0x0eac('0x25')](handleEntityNotFound(_0x345782,null))[_0x0eac('0x25')](saveUpdates(_0x461811['body'],null))[_0x0eac('0x25')](respondWithResult(_0x345782,null))[_0x0eac('0x49')](handleError(_0x345782,null));};exports[_0x0eac('0x26')]=function(_0x27acd0,_0x60c35d){return db['SmsTransferReport'][_0x0eac('0x4c')]({'where':{'id':_0x27acd0[_0x0eac('0x4a')]['id']}})[_0x0eac('0x25')](handleEntityNotFound(_0x60c35d,null))[_0x0eac('0x25')](removeEntity(_0x60c35d,null))[_0x0eac('0x49')](handleError(_0x60c35d,null));};exports[_0x0eac('0x4e')]=function(_0x4d092e,_0x4a3b99){return db[_0x0eac('0x32')][_0x0eac('0x4e')]()[_0x0eac('0x25')](respondWithResult(_0x4a3b99,null))[_0x0eac('0x49')](handleError(_0x4a3b99,null));}; \ No newline at end of file +var _0x009d=['count','set','apply','save','update','destroy','then','sendStatus','stack','name','send','body','message','account','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsTransferReport','includeAll','include','catch','params','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined'];(function(_0x5eda84,_0xf0f87d){var _0x1b18ec=function(_0x1e7268){while(--_0x1e7268){_0x5eda84['push'](_0x5eda84['shift']());}};_0x1b18ec(++_0xf0f87d);}(_0x009d,0xba));var _0xd009=function(_0x39e29a,_0x51bc3c){_0x39e29a=_0x39e29a-0x0;var _0x25f97f=_0x009d[_0x39e29a];return _0x25f97f;};'use strict';var emlformat=require(_0xd009('0x0'));var rimraf=require(_0xd009('0x1'));var zipdir=require(_0xd009('0x2'));var jsonpatch=require(_0xd009('0x3'));var rp=require(_0xd009('0x4'));var moment=require(_0xd009('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd009('0x6'));var csv=require(_0xd009('0x7'));var ejs=require(_0xd009('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd009('0x9'));var squel=require(_0xd009('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd009('0x7'));var querystring=require(_0xd009('0xb'));var Papa=require(_0xd009('0xc'));var Redis=require('ioredis');var authService=require(_0xd009('0xd'));var qs=require(_0xd009('0xe'));var as=require(_0xd009('0xf'));var hardwareService=require(_0xd009('0x10'));var logger=require(_0xd009('0x11'))('api');var utils=require(_0xd009('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd009('0x13'));var db=require(_0xd009('0x14'))['db'];function respondWithStatusCode(_0x6fd8f6,_0x4f13d8){_0x4f13d8=_0x4f13d8||0xcc;return function(_0x14cdee){if(_0x14cdee){return _0x6fd8f6['sendStatus'](_0x4f13d8);}return _0x6fd8f6[_0xd009('0x15')](_0x4f13d8)[_0xd009('0x16')]();};}function respondWithResult(_0x460d8d,_0xd81773){_0xd81773=_0xd81773||0xc8;return function(_0x4d2edc){if(_0x4d2edc){return _0x460d8d[_0xd009('0x15')](_0xd81773)[_0xd009('0x17')](_0x4d2edc);}};}function respondWithFilteredResult(_0x41b479,_0xb4e9c){return function(_0x3b915b){if(_0x3b915b){var _0x46c169=typeof _0xb4e9c[_0xd009('0x18')]==='undefined'&&typeof _0xb4e9c[_0xd009('0x19')]===_0xd009('0x1a');var _0xb10c6c=_0x3b915b[_0xd009('0x1b')];var _0x589083=_0x46c169?0x0:_0xb4e9c[_0xd009('0x18')];var _0xfdd15d=_0x46c169?_0x3b915b[_0xd009('0x1b')]:_0xb4e9c['offset']+_0xb4e9c['limit'];var _0x18a021;if(_0xfdd15d>=_0xb10c6c){_0xfdd15d=_0xb10c6c;_0x18a021=0xc8;}else{_0x18a021=0xce;}_0x41b479[_0xd009('0x15')](_0x18a021);return _0x41b479[_0xd009('0x1c')]('Content-Range',_0x589083+'-'+_0xfdd15d+'/'+_0xb10c6c)[_0xd009('0x17')](_0x3b915b);}return null;};}function patchUpdates(_0x3d4f73){return function(_0x3bc708){try{jsonpatch[_0xd009('0x1d')](_0x3bc708,_0x3d4f73,!![]);}catch(_0x51e8e1){return BPromise['reject'](_0x51e8e1);}return _0x3bc708[_0xd009('0x1e')]();};}function saveUpdates(_0x575275,_0x405a69){return function(_0x39f422){if(_0x39f422){return _0x39f422[_0xd009('0x1f')](_0x575275)['then'](function(_0x507c9e){return _0x507c9e;});}return null;};}function removeEntity(_0x47a56f,_0x2ddb76){return function(_0x4d7e27){if(_0x4d7e27){return _0x4d7e27[_0xd009('0x20')]()[_0xd009('0x21')](function(){_0x47a56f[_0xd009('0x15')](0xcc)[_0xd009('0x16')]();});}};}function handleEntityNotFound(_0x7cb924,_0x1b9c9e){return function(_0x39da8a){if(!_0x39da8a){_0x7cb924[_0xd009('0x22')](0x194);}return _0x39da8a;};}function handleError(_0x256c89,_0x11d61a){_0x11d61a=_0x11d61a||0x1f4;return function(_0x358e6c){logger['error'](_0x358e6c[_0xd009('0x23')]);if(_0x358e6c[_0xd009('0x24')]){delete _0x358e6c[_0xd009('0x24')];}_0x256c89[_0xd009('0x15')](_0x11d61a)[_0xd009('0x25')](_0x358e6c);};}function getMustacheRender(_0x679f4e,_0x2069b){return Mustache['render'](_0x679f4e,_['merge'](_0x2069b[_0xd009('0x26')],{'contact':_0x2069b['contact'],'message':_0x2069b[_0xd009('0x27')],'agent':_0x2069b['agent'],'interaction':_0x2069b['interaction'],'account':_0x2069b[_0xd009('0x28')]}))||'';}exports['index']=function(_0x3d435f,_0x451bf1){var _0x27bb31={},_0x5b4d86={},_0x58d4cc={'count':0x0,'rows':[]};var _0x5b0b99=_[_0xd009('0x29')](db['SmsTransferReport'][_0xd009('0x2a')],function(_0x3b6a5b){return{'name':_0x3b6a5b[_0xd009('0x2b')],'type':_0x3b6a5b['type'][_0xd009('0x2c')]};});_0x5b4d86['model']=_[_0xd009('0x29')](_0x5b0b99,_0xd009('0x24'));_0x5b4d86['query']=_[_0xd009('0x2d')](_0x3d435f[_0xd009('0x2e')]);_0x5b4d86[_0xd009('0x2f')]=_[_0xd009('0x30')](_0x5b4d86[_0xd009('0x31')],_0x5b4d86[_0xd009('0x2e')]);_0x27bb31[_0xd009('0x32')]=_[_0xd009('0x30')](_0x5b4d86[_0xd009('0x31')],qs['fields'](_0x3d435f['query'][_0xd009('0x33')]));_0x27bb31[_0xd009('0x32')]=_0x27bb31['attributes'][_0xd009('0x34')]?_0x27bb31[_0xd009('0x32')]:_0x5b4d86[_0xd009('0x31')];if(!_0x3d435f[_0xd009('0x2e')][_0xd009('0x35')](_0xd009('0x36'))){_0x27bb31[_0xd009('0x19')]=qs['limit'](_0x3d435f[_0xd009('0x2e')][_0xd009('0x19')]);_0x27bb31[_0xd009('0x18')]=qs['offset'](_0x3d435f[_0xd009('0x2e')][_0xd009('0x18')]);}_0x27bb31[_0xd009('0x37')]=qs[_0xd009('0x38')](_0x3d435f[_0xd009('0x2e')][_0xd009('0x38')]);_0x27bb31[_0xd009('0x39')]=qs['filters'](_[_0xd009('0x3a')](_0x3d435f['query'],_0x5b4d86[_0xd009('0x2f')]),_0x5b0b99);if(_0x3d435f[_0xd009('0x2e')]['filter']){_0x27bb31[_0xd009('0x39')]=_[_0xd009('0x3b')](_0x27bb31[_0xd009('0x39')],{'$or':_[_0xd009('0x29')](_0x5b0b99,function(_0x332f4d){if(_0x332f4d['type']!==_0xd009('0x3c')){var _0x162f7c={};_0x162f7c[_0x332f4d[_0xd009('0x24')]]={'$like':'%'+_0x3d435f[_0xd009('0x2e')][_0xd009('0x3d')]+'%'};return _0x162f7c;}})});}_0x27bb31=_[_0xd009('0x3b')]({},_0x27bb31,_0x3d435f[_0xd009('0x3e')]);var _0x5a6928={'where':_0x27bb31[_0xd009('0x39')]};return db[_0xd009('0x3f')][_0xd009('0x1b')](_0x5a6928)['then'](function(_0x378867){_0x58d4cc['count']=_0x378867;if(_0x3d435f[_0xd009('0x2e')][_0xd009('0x40')]){_0x27bb31[_0xd009('0x41')]=[{'all':!![]}];}return db[_0xd009('0x3f')]['findAll'](_0x27bb31);})[_0xd009('0x21')](function(_0x4d4c2b){_0x58d4cc['rows']=_0x4d4c2b;return _0x58d4cc;})[_0xd009('0x21')](respondWithFilteredResult(_0x451bf1,_0x27bb31))[_0xd009('0x42')](handleError(_0x451bf1,null));};exports['show']=function(_0xa74fac,_0x21434a){var _0x30334c={'raw':!![],'where':{'id':_0xa74fac[_0xd009('0x43')]['id']}},_0x87269a={};_0x87269a[_0xd009('0x31')]=_[_0xd009('0x2d')](db[_0xd009('0x3f')][_0xd009('0x2a')]);_0x87269a[_0xd009('0x2e')]=_['keys'](_0xa74fac[_0xd009('0x2e')]);_0x87269a[_0xd009('0x2f')]=_[_0xd009('0x30')](_0x87269a[_0xd009('0x31')],_0x87269a[_0xd009('0x2e')]);_0x30334c['attributes']=_['intersection'](_0x87269a['model'],qs[_0xd009('0x33')](_0xa74fac[_0xd009('0x2e')][_0xd009('0x33')]));_0x30334c[_0xd009('0x32')]=_0x30334c[_0xd009('0x32')]['length']?_0x30334c[_0xd009('0x32')]:_0x87269a[_0xd009('0x31')];if(_0xa74fac[_0xd009('0x2e')][_0xd009('0x40')]){_0x30334c[_0xd009('0x41')]=[{'all':!![]}];}_0x30334c=_[_0xd009('0x3b')]({},_0x30334c,_0xa74fac[_0xd009('0x3e')]);return db[_0xd009('0x3f')][_0xd009('0x44')](_0x30334c)[_0xd009('0x21')](handleEntityNotFound(_0x21434a,null))[_0xd009('0x21')](respondWithResult(_0x21434a,null))[_0xd009('0x42')](handleError(_0x21434a,null));};exports['create']=function(_0x4b4a3e,_0x1df02e){return db[_0xd009('0x3f')][_0xd009('0x45')](_0x4b4a3e[_0xd009('0x26')],{})[_0xd009('0x21')](respondWithResult(_0x1df02e,0xc9))[_0xd009('0x42')](handleError(_0x1df02e,null));};exports['update']=function(_0x1c953f,_0x4d67d4){if(_0x1c953f[_0xd009('0x26')]['id']){delete _0x1c953f[_0xd009('0x26')]['id'];}return db[_0xd009('0x3f')][_0xd009('0x44')]({'where':{'id':_0x1c953f[_0xd009('0x43')]['id']}})[_0xd009('0x21')](handleEntityNotFound(_0x4d67d4,null))['then'](saveUpdates(_0x1c953f[_0xd009('0x26')],null))[_0xd009('0x21')](respondWithResult(_0x4d67d4,null))['catch'](handleError(_0x4d67d4,null));};exports[_0xd009('0x20')]=function(_0x2f7d8f,_0x12054f){return db[_0xd009('0x3f')][_0xd009('0x44')]({'where':{'id':_0x2f7d8f[_0xd009('0x43')]['id']}})[_0xd009('0x21')](handleEntityNotFound(_0x12054f,null))[_0xd009('0x21')](removeEntity(_0x12054f,null))['catch'](handleError(_0x12054f,null));};exports[_0xd009('0x46')]=function(_0x50806b,_0x23b705){return db[_0xd009('0x3f')]['describe']()['then'](respondWithResult(_0x23b705,null))[_0xd009('0x42')](handleError(_0x23b705,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0a64187..019bc79 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 _0x524e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','../../config/logger'];(function(_0x465dcd,_0x35029b){var _0xa8123f=function(_0x339034){while(--_0x339034){_0x465dcd['push'](_0x465dcd['shift']());}};_0xa8123f(++_0x35029b);}(_0x524e,0x15e));var _0xe524=function(_0x5c339a,_0x3392c0){_0x5c339a=_0x5c339a-0x0;var _0x1f2120=_0x524e[_0x5c339a];return _0x1f2120;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xe524('0xc'),'fields':[_0xe524('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['path','../../config/environment','exports','define','report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x16f168,_0x3e59a6){var _0x33ef64=function(_0x3a53a5){while(--_0x3a53a5){_0x16f168['push'](_0x16f168['shift']());}};_0x33ef64(++_0x3e59a6);}(_0xa46e,0x8a));var _0xea46=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0xa46e[_0x36bf88];return _0x332914;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('SmsTransferReport',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 2540ed1..e50c39f 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 _0x0136=['../../config/logger','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x5c7239,_0xebfeda){var _0x1624f4=function(_0x33323a){while(--_0x33323a){_0x5c7239['push'](_0x5c7239['shift']());}};_0x1624f4(++_0xebfeda);}(_0x0136,0x120));var _0x6013=function(_0x5afbda,_0x215086){_0x5afbda=_0x5afbda-0x0;var _0x433876=_0x0136[_0x5afbda];return _0x433876;};'use strict';var _=require(_0x6013('0x0'));var util=require(_0x6013('0x1'));var moment=require(_0x6013('0x2'));var BPromise=require('bluebird');var rs=require(_0x6013('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6013('0x4'))['db'];var utils=require(_0x6013('0x5'));var logger=require(_0x6013('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6013('0x7'));var client=jayson[_0x6013('0x8')][_0x6013('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x531bdd,_0x113ec5,_0x4a02f4){return new BPromise(function(_0x4105eb,_0x1d408f){return client[_0x6013('0xa')](_0x531bdd,_0x4a02f4)[_0x6013('0xb')](function(_0x5ea645){logger[_0x6013('0xc')](_0x6013('0xd'),_0x113ec5,_0x6013('0xe'));logger['debug'](_0x6013('0xf'),_0x113ec5,_0x6013('0xe'),JSON[_0x6013('0x10')](_0x5ea645));if(_0x5ea645[_0x6013('0x11')]){if(_0x5ea645[_0x6013('0x11')][_0x6013('0x12')]===0x1f4){logger[_0x6013('0x11')](_0x6013('0xd'),_0x113ec5,_0x5ea645['error'][_0x6013('0x13')]);return _0x1d408f(_0x5ea645[_0x6013('0x11')][_0x6013('0x13')]);}logger[_0x6013('0x11')](_0x6013('0xd'),_0x113ec5,_0x5ea645[_0x6013('0x11')][_0x6013('0x13')]);return _0x4105eb(_0x5ea645[_0x6013('0x11')][_0x6013('0x13')]);}else{logger[_0x6013('0xc')](_0x6013('0xd'),_0x113ec5,_0x6013('0xe'));_0x4105eb(_0x5ea645[_0x6013('0x14')][_0x6013('0x13')]);}})['catch'](function(_0x1d22df){logger[_0x6013('0x11')](_0x6013('0xd'),_0x113ec5,_0x1d22df);_0x1d408f(_0x1d22df);});});} \ No newline at end of file +var _0xf591=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x16386e,_0x5ca2d0){var _0x38d702=function(_0x3355dd){while(--_0x3355dd){_0x16386e['push'](_0x16386e['shift']());}};_0x38d702(++_0x5ca2d0);}(_0xf591,0x10d));var _0x1f59=function(_0x54ca03,_0x3fd8a7){_0x54ca03=_0x54ca03-0x0;var _0x4db040=_0xf591[_0x54ca03];return _0x4db040;};'use strict';var _=require(_0x1f59('0x0'));var util=require(_0x1f59('0x1'));var moment=require(_0x1f59('0x2'));var BPromise=require(_0x1f59('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f59('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f59('0x5'));var logger=require(_0x1f59('0x6'))(_0x1f59('0x7'));var config=require(_0x1f59('0x8'));var jayson=require(_0x1f59('0x9'));var client=jayson[_0x1f59('0xa')][_0x1f59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dcafb,_0x24eda1,_0x3b454c){return new BPromise(function(_0x55cecf,_0x556130){return client[_0x1f59('0xc')](_0x4dcafb,_0x3b454c)[_0x1f59('0xd')](function(_0x14e923){logger[_0x1f59('0xe')](_0x1f59('0xf'),_0x24eda1,'request\x20sent');logger[_0x1f59('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x24eda1,_0x1f59('0x11'),JSON[_0x1f59('0x12')](_0x14e923));if(_0x14e923[_0x1f59('0x13')]){if(_0x14e923['error'][_0x1f59('0x14')]===0x1f4){logger[_0x1f59('0x13')](_0x1f59('0xf'),_0x24eda1,_0x14e923[_0x1f59('0x13')][_0x1f59('0x15')]);return _0x556130(_0x14e923[_0x1f59('0x13')][_0x1f59('0x15')]);}logger[_0x1f59('0x13')](_0x1f59('0xf'),_0x24eda1,_0x14e923[_0x1f59('0x13')][_0x1f59('0x15')]);return _0x55cecf(_0x14e923[_0x1f59('0x13')]['message']);}else{logger[_0x1f59('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x24eda1,_0x1f59('0x11'));_0x55cecf(_0x14e923['result'][_0x1f59('0x15')]);}})[_0x1f59('0x16')](function(_0x90745c){logger[_0x1f59('0x13')](_0x1f59('0xf'),_0x24eda1,_0x90745c);_0x556130(_0x90745c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 8ed1675..0010ed4 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 _0xc201=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','file','create','put','update','delete','multer','util'];(function(_0x7af6a1,_0x2cf8fd){var _0x5107e8=function(_0x21342d){while(--_0x21342d){_0x7af6a1['push'](_0x7af6a1['shift']());}};_0x5107e8(++_0x2cf8fd);}(_0xc201,0xee));var _0x1c20=function(_0x5c3488,_0x24f456){_0x5c3488=_0x5c3488-0x0;var _0x48e6f7=_0xc201[_0x5c3488];return _0x48e6f7;};'use strict';var multer=require(_0x1c20('0x0'));var util=require(_0x1c20('0x1'));var path=require(_0x1c20('0x2'));var timeout=require(_0x1c20('0x3'));var express=require(_0x1c20('0x4'));var router=express[_0x1c20('0x5')]();var fs_extra=require(_0x1c20('0x6'));var auth=require(_0x1c20('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1c20('0x8'));var controller=require('./sound.controller');router[_0x1c20('0x9')]('/',auth[_0x1c20('0xa')](),controller[_0x1c20('0xb')]);router[_0x1c20('0x9')](_0x1c20('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1c20('0x9')](_0x1c20('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x1c20('0xe')]({'destination':function(_0x3aeec8,_0x1c1cd6,_0x164944){_0x164944(null,path[_0x1c20('0xf')](config[_0x1c20('0x10')],_0x1c20('0x11')));},'filename':function(_0x848323,_0xa45856,_0x542046){_0xa45856[_0x1c20('0x12')]=_0xa45856[_0x1c20('0x12')][_0x1c20('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x542046(null,util[_0x1c20('0x14')](_0x1c20('0x15'),path['basename'](_0xa45856['originalname'],path[_0x1c20('0x16')](_0xa45856['originalname'])),Date[_0x1c20('0x17')](),path[_0x1c20('0x16')](_0xa45856[_0x1c20('0x12')])));}})});router[_0x1c20('0x18')]('/',upload['single'](_0x1c20('0x19')),controller[_0x1c20('0x1a')]);router[_0x1c20('0x1b')](_0x1c20('0xc'),auth[_0x1c20('0xa')](),controller[_0x1c20('0x1c')]);router[_0x1c20('0x1d')](_0x1c20('0xc'),auth[_0x1c20('0xa')](),controller[_0x1c20('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x3d0e=['join','root','server/files/sounds/original/','replace','format','originalname','now','extname','post','file','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','index','get','show','download'];(function(_0x406d98,_0x39898a){var _0x11b2ab=function(_0x300bc6){while(--_0x300bc6){_0x406d98['push'](_0x406d98['shift']());}};_0x11b2ab(++_0x39898a);}(_0x3d0e,0x83));var _0xe3d0=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x3d0e[_0x3054be];return _0x3df150;};'use strict';var multer=require('multer');var util=require(_0xe3d0('0x0'));var path=require(_0xe3d0('0x1'));var timeout=require(_0xe3d0('0x2'));var express=require(_0xe3d0('0x3'));var router=express[_0xe3d0('0x4')]();var fs_extra=require(_0xe3d0('0x5'));var auth=require(_0xe3d0('0x6'));var interaction=require(_0xe3d0('0x7'));var config=require(_0xe3d0('0x8'));var controller=require(_0xe3d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe3d0('0xa')]);router[_0xe3d0('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe3d0('0xc')]);router[_0xe3d0('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0xe3d0('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x590de1,_0x2293ee,_0x46193f){_0x46193f(null,path[_0xe3d0('0xe')](config[_0xe3d0('0xf')],_0xe3d0('0x10')));},'filename':function(_0x454c8c,_0x22960b,_0x16252f){_0x22960b['originalname']=_0x22960b['originalname'][_0xe3d0('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x16252f(null,util[_0xe3d0('0x12')]('%s-%s%s',path['basename'](_0x22960b[_0xe3d0('0x13')],path['extname'](_0x22960b[_0xe3d0('0x13')])),Date[_0xe3d0('0x14')](),path[_0xe3d0('0x15')](_0x22960b['originalname'])));}})});router[_0xe3d0('0x16')]('/',upload['single'](_0xe3d0('0x17')),controller[_0xe3d0('0x18')]);router[_0xe3d0('0x19')](_0xe3d0('0x1a'),auth['isAuthenticated'](),controller[_0xe3d0('0x1b')]);router[_0xe3d0('0x1c')](_0xe3d0('0x1a'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index dd8e2fa..93fd0be 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 _0x6105=['BIGINT','INTEGER','sequelize','STRING','name','FLOAT'];(function(_0x5aa051,_0x1560b9){var _0x30f23b=function(_0x315bf0){while(--_0x315bf0){_0x5aa051['push'](_0x5aa051['shift']());}};_0x30f23b(++_0x1560b9);}(_0x6105,0x16a));var _0x5610=function(_0x25aa88,_0x10ca1f){_0x25aa88=_0x25aa88-0x0;var _0x48fcad=_0x6105[_0x25aa88];return _0x48fcad;};'use strict';var Sequelize=require(_0x5610('0x0'));module['exports']={'name':{'type':Sequelize[_0x5610('0x1')],'unique':_0x5610('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x5610('0x1')]},'display_name':{'type':Sequelize[_0x5610('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x5610('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x5610('0x3')]},'original_sampleCount':{'type':Sequelize[_0x5610('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x5610('0x4')]},'original_sampleRate':{'type':Sequelize[_0x5610('0x5')]},'converted_format':{'type':Sequelize[_0x5610('0x1')]},'converted_duration':{'type':Sequelize[_0x5610('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x5610('0x4')]},'converted_channelCount':{'type':Sequelize[_0x5610('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x5610('0x5')]}}; \ No newline at end of file +var _0x5882=['INTEGER','BIGINT','sequelize','STRING','name','FLOAT'];(function(_0x196ddc,_0x514491){var _0x5d15f2=function(_0x5bcf05){while(--_0x5bcf05){_0x196ddc['push'](_0x196ddc['shift']());}};_0x5d15f2(++_0x514491);}(_0x5882,0x1a0));var _0x2588=function(_0x399c70,_0x1000e0){_0x399c70=_0x399c70-0x0;var _0x435196=_0x5882[_0x399c70];return _0x435196;};'use strict';var Sequelize=require(_0x2588('0x0'));module['exports']={'name':{'type':Sequelize[_0x2588('0x1')],'unique':_0x2588('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x2588('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x2588('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x2588('0x4')]},'original_bitRate':{'type':Sequelize[_0x2588('0x5')]},'original_sampleRate':{'type':Sequelize[_0x2588('0x4')]},'converted_format':{'type':Sequelize[_0x2588('0x1')]},'converted_duration':{'type':Sequelize[_0x2588('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x2588('0x5')]},'converted_channelCount':{'type':Sequelize[_0x2588('0x4')]},'converted_bitRate':{'type':Sequelize[_0x2588('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x2588('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a46ec16..22e913f 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 _0xb19e=['json','offset','count','set','Content-Range','reject','save','then','destroy','Sounds','UserProfileResource','status','error','name','render','merge','body','contact','account','index','map','Sound','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','filter','includeAll','include','findAll','rows','catch','show','params','keys','download','find','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','originalname','extname','file','substring','server/files/sounds/original','filename','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','end','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','start','update','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x376997,_0x311114){var _0x288e49=function(_0x168b92){while(--_0x168b92){_0x376997['push'](_0x376997['shift']());}};_0x288e49(++_0x311114);}(_0xb19e,0xe4));var _0xeb19=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xb19e[_0x56825b];return _0x69ce77;};'use strict';var emlformat=require(_0xeb19('0x0'));var rimraf=require(_0xeb19('0x1'));var zipdir=require(_0xeb19('0x2'));var jsonpatch=require(_0xeb19('0x3'));var rp=require('request-promise');var moment=require(_0xeb19('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeb19('0x5'));var util=require('util');var path=require(_0xeb19('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeb19('0x7'));var fs=require('fs');var fs_extra=require(_0xeb19('0x8'));var _=require('lodash');var squel=require(_0xeb19('0x9'));var crypto=require(_0xeb19('0xa'));var jsforce=require(_0xeb19('0xb'));var deskjs=require(_0xeb19('0xc'));var toCsv=require(_0xeb19('0xd'));var querystring=require(_0xeb19('0xe'));var Papa=require(_0xeb19('0xf'));var Redis=require(_0xeb19('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeb19('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb19('0x12'))(_0xeb19('0x13'));var utils=require(_0xeb19('0x14'));var config=require(_0xeb19('0x15'));var licenseUtil=require(_0xeb19('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45832d,_0xa63707){_0xa63707=_0xa63707||0xcc;return function(_0x2156a3){if(_0x2156a3){return _0x45832d[_0xeb19('0x17')](_0xa63707);}return _0x45832d['status'](_0xa63707)['end']();};}function respondWithResult(_0x2c3cab,_0x4439fa){_0x4439fa=_0x4439fa||0xc8;return function(_0x3861af){if(_0x3861af){return _0x2c3cab['status'](_0x4439fa)[_0xeb19('0x18')](_0x3861af);}};}function respondWithFilteredResult(_0x371253,_0x33d817){return function(_0x12c13e){if(_0x12c13e){var _0x122fa2=typeof _0x33d817['offset']==='undefined'&&typeof _0x33d817['limit']==='undefined';var _0x3c8d61=_0x12c13e['count'];var _0xa0b0b3=_0x122fa2?0x0:_0x33d817[_0xeb19('0x19')];var _0xb7320=_0x122fa2?_0x12c13e[_0xeb19('0x1a')]:_0x33d817[_0xeb19('0x19')]+_0x33d817['limit'];var _0x422dc0;if(_0xb7320>=_0x3c8d61){_0xb7320=_0x3c8d61;_0x422dc0=0xc8;}else{_0x422dc0=0xce;}_0x371253['status'](_0x422dc0);return _0x371253[_0xeb19('0x1b')](_0xeb19('0x1c'),_0xa0b0b3+'-'+_0xb7320+'/'+_0x3c8d61)['json'](_0x12c13e);}return null;};}function patchUpdates(_0x3a3edb){return function(_0x3064fc){try{jsonpatch['apply'](_0x3064fc,_0x3a3edb,!![]);}catch(_0x376ff0){return BPromise[_0xeb19('0x1d')](_0x376ff0);}return _0x3064fc[_0xeb19('0x1e')]();};}function saveUpdates(_0x5a8bf0,_0x11dcdb){return function(_0x41bfcc){if(_0x41bfcc){return _0x41bfcc['update'](_0x5a8bf0)[_0xeb19('0x1f')](function(_0x1feadb){return _0x1feadb;});}return null;};}function removeEntity(_0x58133a,_0x57bd7f){return function(_0x5f0580){if(_0x5f0580){return _0x5f0580[_0xeb19('0x20')]()[_0xeb19('0x1f')](function(){var _0x5ca105=_0x5f0580['get']({'plain':!![]});var _0x404e8c=_0xeb19('0x21');return db[_0xeb19('0x22')][_0xeb19('0x20')]({'where':{'type':_0x404e8c,'resourceId':_0x5ca105['id']}})[_0xeb19('0x1f')](function(){return _0x5f0580;});})[_0xeb19('0x1f')](function(){_0x58133a[_0xeb19('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcd49e0,_0xfc459){return function(_0x49b936){if(!_0x49b936){_0xcd49e0[_0xeb19('0x17')](0x194);}return _0x49b936;};}function handleError(_0x548dab,_0x2c5038){_0x2c5038=_0x2c5038||0x1f4;return function(_0x3eb86e){logger[_0xeb19('0x24')](_0x3eb86e['stack']);if(_0x3eb86e[_0xeb19('0x25')]){delete _0x3eb86e['name'];}_0x548dab[_0xeb19('0x23')](_0x2c5038)['send'](_0x3eb86e);};}function getMustacheRender(_0x5e46ea,_0x36f925){return Mustache[_0xeb19('0x26')](_0x5e46ea,_[_0xeb19('0x27')](_0x36f925[_0xeb19('0x28')],{'contact':_0x36f925[_0xeb19('0x29')],'message':_0x36f925['message'],'agent':_0x36f925['agent'],'interaction':_0x36f925['interaction'],'account':_0x36f925[_0xeb19('0x2a')]}))||'';}exports[_0xeb19('0x2b')]=function(_0xc79f91,_0x160ffd){var _0x594e99={},_0x198287={},_0x241656={'count':0x0,'rows':[]};var _0x1d5a9e=_[_0xeb19('0x2c')](db[_0xeb19('0x2d')][_0xeb19('0x2e')],function(_0x116214){return{'name':_0x116214[_0xeb19('0x2f')],'type':_0x116214[_0xeb19('0x30')][_0xeb19('0x31')]};});_0x198287[_0xeb19('0x32')]=_[_0xeb19('0x2c')](_0x1d5a9e,_0xeb19('0x25'));_0x198287[_0xeb19('0x33')]=_['keys'](_0xc79f91['query']);_0x198287[_0xeb19('0x34')]=_['intersection'](_0x198287[_0xeb19('0x32')],_0x198287['query']);_0x594e99[_0xeb19('0x35')]=_[_0xeb19('0x36')](_0x198287[_0xeb19('0x32')],qs[_0xeb19('0x37')](_0xc79f91[_0xeb19('0x33')][_0xeb19('0x37')]));_0x594e99[_0xeb19('0x35')]=_0x594e99[_0xeb19('0x35')][_0xeb19('0x38')]?_0x594e99[_0xeb19('0x35')]:_0x198287[_0xeb19('0x32')];if(!_0xc79f91['query'][_0xeb19('0x39')](_0xeb19('0x3a'))){_0x594e99[_0xeb19('0x3b')]=qs['limit'](_0xc79f91[_0xeb19('0x33')]['limit']);_0x594e99[_0xeb19('0x19')]=qs[_0xeb19('0x19')](_0xc79f91[_0xeb19('0x33')][_0xeb19('0x19')]);}_0x594e99[_0xeb19('0x3c')]=qs['sort'](_0xc79f91['query'][_0xeb19('0x3d')]);_0x594e99['where']=qs[_0xeb19('0x34')](_[_0xeb19('0x3e')](_0xc79f91[_0xeb19('0x33')],_0x198287[_0xeb19('0x34')]),_0x1d5a9e);if(_0xc79f91[_0xeb19('0x33')]['filter']){_0x594e99[_0xeb19('0x3f')]=_[_0xeb19('0x27')](_0x594e99[_0xeb19('0x3f')],{'$or':_['map'](_0x1d5a9e,function(_0x4c1c95){if(_0x4c1c95[_0xeb19('0x30')]!=='VIRTUAL'){var _0x5262ba={};_0x5262ba[_0x4c1c95['name']]={'$like':'%'+_0xc79f91[_0xeb19('0x33')][_0xeb19('0x40')]+'%'};return _0x5262ba;}})});}_0x594e99=_['merge']({},_0x594e99,_0xc79f91['options']);var _0x55a4a8={'where':_0x594e99[_0xeb19('0x3f')]};return db[_0xeb19('0x2d')][_0xeb19('0x1a')](_0x55a4a8)[_0xeb19('0x1f')](function(_0x48ecba){_0x241656[_0xeb19('0x1a')]=_0x48ecba;if(_0xc79f91[_0xeb19('0x33')][_0xeb19('0x41')]){_0x594e99[_0xeb19('0x42')]=[{'all':!![]}];}return db[_0xeb19('0x2d')][_0xeb19('0x43')](_0x594e99);})['then'](function(_0x27548f){_0x241656[_0xeb19('0x44')]=_0x27548f;return _0x241656;})[_0xeb19('0x1f')](respondWithFilteredResult(_0x160ffd,_0x594e99))[_0xeb19('0x45')](handleError(_0x160ffd,null));};exports[_0xeb19('0x46')]=function(_0x459081,_0x71226c){var _0x51e302={'raw':!![],'where':{'id':_0x459081[_0xeb19('0x47')]['id']}},_0x18f44a={};_0x18f44a[_0xeb19('0x32')]=_['keys'](db[_0xeb19('0x2d')][_0xeb19('0x2e')]);_0x18f44a[_0xeb19('0x33')]=_[_0xeb19('0x48')](_0x459081[_0xeb19('0x33')]);_0x18f44a[_0xeb19('0x34')]=_[_0xeb19('0x36')](_0x18f44a[_0xeb19('0x32')],_0x18f44a[_0xeb19('0x33')]);_0x51e302[_0xeb19('0x35')]=_['intersection'](_0x18f44a[_0xeb19('0x32')],qs[_0xeb19('0x37')](_0x459081['query'][_0xeb19('0x37')]));_0x51e302[_0xeb19('0x35')]=_0x51e302[_0xeb19('0x35')][_0xeb19('0x38')]?_0x51e302['attributes']:_0x18f44a['model'];if(_0x459081[_0xeb19('0x33')]['includeAll']){_0x51e302[_0xeb19('0x42')]=[{'all':!![]}];}_0x51e302=_[_0xeb19('0x27')]({},_0x51e302,_0x459081['options']);return db[_0xeb19('0x2d')]['find'](_0x51e302)[_0xeb19('0x1f')](handleEntityNotFound(_0x71226c,null))['then'](respondWithResult(_0x71226c,null))['catch'](handleError(_0x71226c,null));};exports[_0xeb19('0x49')]=function(_0xd21677,_0x18fbe1,_0x1ef030){return db[_0xeb19('0x2d')][_0xeb19('0x4a')]({'where':{'id':_0xd21677[_0xeb19('0x47')]['id']},'attributes':[_0xeb19('0x25'),_0xeb19('0x4b'),_0xeb19('0x4c')],'raw':!![]})[_0xeb19('0x1f')](handleEntityNotFound(_0x18fbe1,null))[_0xeb19('0x1f')](function(_0x5153b2){if(_0x5153b2){if(!fs[_0xeb19('0x4d')](path[_0xeb19('0x4e')](config[_0xeb19('0x4f')],'server/files/sounds/converted',_0x5153b2['save_name']+'.'+_0x5153b2[_0xeb19('0x4c')]))){throw new db[(_0xeb19('0x50'))][(_0xeb19('0x51'))](_0xeb19('0x52'));}return _0x18fbe1[_0xeb19('0x49')](path['join'](config[_0xeb19('0x4f')],_0xeb19('0x53'),util[_0xeb19('0x54')](_0xeb19('0x55'),_0x5153b2[_0xeb19('0x4b')],_0x5153b2['converted_format'])),util[_0xeb19('0x54')]('%s.%s',_0x5153b2[_0xeb19('0x25')],_0x5153b2['converted_format']));}return null;})[_0xeb19('0x45')](handleError(_0x18fbe1,null));};exports[_0xeb19('0x56')]=function(_0x2dfc02,_0x26990e,_0x253303){var _0x37a819={'name':path[_0xeb19('0x57')](_0x2dfc02['file'][_0xeb19('0x58')],path[_0xeb19('0x59')](_0x2dfc02[_0xeb19('0x5a')]['originalname'])),'save_name':path[_0xeb19('0x57')](_0x2dfc02[_0xeb19('0x5a')]['filename'],path['extname'](_0x2dfc02[_0xeb19('0x5a')]['filename'])),'original_format':path[_0xeb19('0x59')](_0x2dfc02[_0xeb19('0x5a')][_0xeb19('0x58')])[_0xeb19('0x5b')](0x1),'converted_format':'wav'};var _0x366a28=path[_0xeb19('0x4e')](config[_0xeb19('0x4f')],_0xeb19('0x5c'),_0x2dfc02[_0xeb19('0x5a')][_0xeb19('0x5d')]);var _0x2414f8=path[_0xeb19('0x4e')](config[_0xeb19('0x4f')],'server/files/sounds/converted',util[_0xeb19('0x54')](_0xeb19('0x55'),path[_0xeb19('0x57')](_0x2dfc02[_0xeb19('0x5a')][_0xeb19('0x5d')],path[_0xeb19('0x59')](_0x2dfc02['file'][_0xeb19('0x5d')])),_0x37a819[_0xeb19('0x4c')]));logger[_0xeb19('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x366a28);logger['info'](_0xeb19('0x5f'),_0x2414f8);try{fs['chmodSync'](_0x366a28,parseInt(_0xeb19('0x60'),0x8));var _0xdcca85=sox[_0xeb19('0x61')](_0x366a28,_0x2414f8,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xdcca85['on'](_0xeb19('0x24'),function(_0xb7a68d){fs[_0xeb19('0x62')](_0x366a28);_0x26990e[_0xeb19('0x23')](0x1f4)[_0xeb19('0x63')](_0xb7a68d);});_0xdcca85['on'](_0xeb19('0x64'),function(_0x563290){_0x37a819[_0xeb19('0x65')]=isNaN(_0x563290[_0xeb19('0x66')])?null:_0x563290['duration']*0x3e8;_0x37a819[_0xeb19('0x67')]=isNaN(_0x563290[_0xeb19('0x68')])?null:_0x563290[_0xeb19('0x68')];_0x37a819['original_channelCount']=isNaN(_0x563290['channelCount'])?null:_0x563290[_0xeb19('0x69')];_0x37a819[_0xeb19('0x6a')]=isNaN(_0x563290[_0xeb19('0x6b')])?null:_0x563290['bitRate'];_0x37a819[_0xeb19('0x6c')]=isNaN(_0x563290['sampleRate'])?null:_0x563290[_0xeb19('0x6d')];});_0xdcca85['on']('dest',function(_0x1bfdb4){_0x37a819[_0xeb19('0x6e')]=isNaN(_0x1bfdb4[_0xeb19('0x66')])?null:_0x1bfdb4[_0xeb19('0x66')]*0x3e8;_0x37a819[_0xeb19('0x6f')]=isNaN(_0x1bfdb4[_0xeb19('0x68')])?null:_0x1bfdb4[_0xeb19('0x68')];_0x37a819[_0xeb19('0x70')]=isNaN(_0x1bfdb4['channelCount'])?null:_0x1bfdb4[_0xeb19('0x69')];_0x37a819[_0xeb19('0x71')]=isNaN(_0x1bfdb4[_0xeb19('0x6b')])?null:_0x1bfdb4['bitRate'];_0x37a819[_0xeb19('0x72')]=isNaN(_0x1bfdb4[_0xeb19('0x6d')])?null:_0x1bfdb4[_0xeb19('0x6d')];});_0xdcca85['on'](_0xeb19('0x73'),function(){fs['chmodSync'](_0x2414f8,parseInt(_0xeb19('0x60'),0x8));return db[_0xeb19('0x2d')][_0xeb19('0x56')](_0x37a819)[_0xeb19('0x1f')](function(_0x2f7bed){var _0x2e2e59={'role':_0x2dfc02[_0xeb19('0x28')][_0xeb19('0x74')],'userProfileId':_0x2dfc02['body'][_0xeb19('0x75')]};if(!_0x2e2e59)throw new Error(_0xeb19('0x76'));if(_0x2e2e59[_0xeb19('0x74')]===_0xeb19('0x77')){var _0x3e0e80=_0x2f7bed[_0xeb19('0x78')]({'plain':!![]});return db['UserProfileSection'][_0xeb19('0x4a')]({'where':{'name':_0xeb19('0x21'),'userProfileId':_0x2e2e59[_0xeb19('0x75')]},'raw':!![]})['then'](function(_0xc0accf){if(_0xc0accf&&_0xc0accf[_0xeb19('0x79')]===0x0){return db[_0xeb19('0x22')]['create']({'name':_0x3e0e80[_0xeb19('0x25')],'resourceId':_0x3e0e80['id'],'type':_0xc0accf[_0xeb19('0x25')],'sectionId':_0xc0accf['id']},{})[_0xeb19('0x1f')](function(){return _0x2f7bed;});}else{return _0x2f7bed;}})[_0xeb19('0x45')](function(_0x16fe89){logger[_0xeb19('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16fe89);throw _0x16fe89;});}return _0x2f7bed;})[_0xeb19('0x1f')](respondWithResult(_0x26990e,null))[_0xeb19('0x45')](handleError(_0x26990e,null));});_0xdcca85[_0xeb19('0x7a')]();}catch(_0x2b8c45){_0x26990e[_0xeb19('0x23')](0x1f4)[_0xeb19('0x63')](_0x2b8c45);}};exports[_0xeb19('0x7b')]=function(_0x2d328e,_0x1c1e9f,_0x1b55ba){return db[_0xeb19('0x2d')][_0xeb19('0x4a')]({'where':{'id':_0x2d328e['params']['id']}})[_0xeb19('0x1f')](handleEntityNotFound(_0x1c1e9f,null))[_0xeb19('0x1f')](saveUpdates(_[_0xeb19('0x3e')](_0x2d328e[_0xeb19('0x28')],[_0xeb19('0x25'),_0xeb19('0x7c')]),null))[_0xeb19('0x1f')](respondWithResult(_0x1c1e9f,null))[_0xeb19('0x45')](handleError(_0x1c1e9f,null));};exports['delete']=function(_0x374e67,_0x437b53,_0x4f7523){return db[_0xeb19('0x2d')][_0xeb19('0x4a')]({'where':{'id':_0x374e67[_0xeb19('0x47')]['id']}})['then'](function(_0x353d4f){if(_0x353d4f){return _0x353d4f[_0xeb19('0x20')]();}})[_0xeb19('0x1f')](function(_0x50a49b){var _0x3835cd=path[_0xeb19('0x4e')](config[_0xeb19('0x4f')],'server/files/sounds/original',util[_0xeb19('0x54')](_0xeb19('0x55'),_0x50a49b[_0xeb19('0x4b')],_0x50a49b[_0xeb19('0x7d')]));var _0x4432df=path[_0xeb19('0x4e')](config['root'],_0xeb19('0x53'),util[_0xeb19('0x54')](_0xeb19('0x55'),_0x50a49b[_0xeb19('0x4b')],_0x50a49b[_0xeb19('0x4c')]));fs['unlinkSync'](_0x3835cd);fs[_0xeb19('0x62')](_0x4432df);return _0x50a49b;})[_0xeb19('0x1f')](function(_0x2f6718){if(_0x2f6718){return _0x437b53[_0xeb19('0x23')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x437b53,null))['catch'](handleError(_0x437b53,null));}; \ No newline at end of file +var _0x46bc=['papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','get','Sounds','UserProfileResource','destroy','then','error','stack','send','merge','body','message','agent','account','index','map','Sound','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','order','sort','pick','filter','where','VIRTUAL','options','findAll','catch','show','params','length','includeAll','include','find','name','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','create','basename','file','originalname','filename','extname','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','original_format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','jsforce','desk.js'];(function(_0x3b0f0a,_0x239af4){var _0x4e3647=function(_0x4cb857){while(--_0x4cb857){_0x3b0f0a['push'](_0x3b0f0a['shift']());}};_0x4e3647(++_0x239af4);}(_0x46bc,0x1d8));var _0xc46b=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0x46bc[_0x3616bb];return _0x1c0994;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc46b('0x0'));var zipdir=require(_0xc46b('0x1'));var jsonpatch=require(_0xc46b('0x2'));var rp=require('request-promise');var moment=require(_0xc46b('0x3'));var BPromise=require(_0xc46b('0x4'));var Mustache=require(_0xc46b('0x5'));var util=require(_0xc46b('0x6'));var path=require('path');var sox=require(_0xc46b('0x7'));var csv=require(_0xc46b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc46b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc46b('0xa'));var deskjs=require(_0xc46b('0xb'));var toCsv=require(_0xc46b('0x8'));var querystring=require('querystring');var Papa=require(_0xc46b('0xc'));var Redis=require('ioredis');var authService=require(_0xc46b('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc46b('0xe'));var logger=require(_0xc46b('0xf'))(_0xc46b('0x10'));var utils=require(_0xc46b('0x11'));var config=require(_0xc46b('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c7553,_0x17ae46){_0x17ae46=_0x17ae46||0xcc;return function(_0x50f1c4){if(_0x50f1c4){return _0x3c7553[_0xc46b('0x13')](_0x17ae46);}return _0x3c7553[_0xc46b('0x14')](_0x17ae46)[_0xc46b('0x15')]();};}function respondWithResult(_0x5d3890,_0x500817){_0x500817=_0x500817||0xc8;return function(_0x515ad1){if(_0x515ad1){return _0x5d3890[_0xc46b('0x14')](_0x500817)['json'](_0x515ad1);}};}function respondWithFilteredResult(_0x2ceafe,_0x134b5f){return function(_0x3599b5){if(_0x3599b5){var _0x4ff9b5=typeof _0x134b5f[_0xc46b('0x16')]===_0xc46b('0x17')&&typeof _0x134b5f['limit']===_0xc46b('0x17');var _0x367b13=_0x3599b5['count'];var _0x39e964=_0x4ff9b5?0x0:_0x134b5f[_0xc46b('0x16')];var _0x556303=_0x4ff9b5?_0x3599b5[_0xc46b('0x18')]:_0x134b5f['offset']+_0x134b5f[_0xc46b('0x19')];var _0x42303d;if(_0x556303>=_0x367b13){_0x556303=_0x367b13;_0x42303d=0xc8;}else{_0x42303d=0xce;}_0x2ceafe[_0xc46b('0x14')](_0x42303d);return _0x2ceafe[_0xc46b('0x1a')](_0xc46b('0x1b'),_0x39e964+'-'+_0x556303+'/'+_0x367b13)[_0xc46b('0x1c')](_0x3599b5);}return null;};}function patchUpdates(_0x22e0a9){return function(_0xf5d6a4){try{jsonpatch[_0xc46b('0x1d')](_0xf5d6a4,_0x22e0a9,!![]);}catch(_0xb29163){return BPromise['reject'](_0xb29163);}return _0xf5d6a4[_0xc46b('0x1e')]();};}function saveUpdates(_0x1f5b3d,_0xc925f){return function(_0x5e10ca){if(_0x5e10ca){return _0x5e10ca[_0xc46b('0x1f')](_0x1f5b3d)['then'](function(_0x192ef0){return _0x192ef0;});}return null;};}function removeEntity(_0x32db63,_0x212fec){return function(_0x3eb0ab){if(_0x3eb0ab){return _0x3eb0ab['destroy']()['then'](function(){var _0x211413=_0x3eb0ab[_0xc46b('0x20')]({'plain':!![]});var _0x243022=_0xc46b('0x21');return db[_0xc46b('0x22')][_0xc46b('0x23')]({'where':{'type':_0x243022,'resourceId':_0x211413['id']}})[_0xc46b('0x24')](function(){return _0x3eb0ab;});})[_0xc46b('0x24')](function(){_0x32db63['status'](0xcc)[_0xc46b('0x15')]();});}};}function handleEntityNotFound(_0x10ee64,_0x15402a){return function(_0xcd4321){if(!_0xcd4321){_0x10ee64[_0xc46b('0x13')](0x194);}return _0xcd4321;};}function handleError(_0x3d7eb6,_0x1af091){_0x1af091=_0x1af091||0x1f4;return function(_0x3ac0c1){logger[_0xc46b('0x25')](_0x3ac0c1[_0xc46b('0x26')]);if(_0x3ac0c1['name']){delete _0x3ac0c1['name'];}_0x3d7eb6['status'](_0x1af091)[_0xc46b('0x27')](_0x3ac0c1);};}function getMustacheRender(_0x476963,_0x4ce752){return Mustache['render'](_0x476963,_[_0xc46b('0x28')](_0x4ce752[_0xc46b('0x29')],{'contact':_0x4ce752['contact'],'message':_0x4ce752[_0xc46b('0x2a')],'agent':_0x4ce752[_0xc46b('0x2b')],'interaction':_0x4ce752['interaction'],'account':_0x4ce752[_0xc46b('0x2c')]}))||'';}exports[_0xc46b('0x2d')]=function(_0x47523d,_0x57a068){var _0x2e78b0={},_0x37db2d={},_0x579f66={'count':0x0,'rows':[]};var _0x983e13=_[_0xc46b('0x2e')](db[_0xc46b('0x2f')][_0xc46b('0x30')],function(_0x3de418){return{'name':_0x3de418['fieldName'],'type':_0x3de418['type'][_0xc46b('0x31')]};});_0x37db2d['model']=_['map'](_0x983e13,'name');_0x37db2d[_0xc46b('0x32')]=_[_0xc46b('0x33')](_0x47523d[_0xc46b('0x32')]);_0x37db2d[_0xc46b('0x34')]=_['intersection'](_0x37db2d[_0xc46b('0x35')],_0x37db2d[_0xc46b('0x32')]);_0x2e78b0[_0xc46b('0x36')]=_[_0xc46b('0x37')](_0x37db2d[_0xc46b('0x35')],qs[_0xc46b('0x38')](_0x47523d['query'][_0xc46b('0x38')]));_0x2e78b0[_0xc46b('0x36')]=_0x2e78b0[_0xc46b('0x36')]['length']?_0x2e78b0['attributes']:_0x37db2d[_0xc46b('0x35')];if(!_0x47523d[_0xc46b('0x32')]['hasOwnProperty']('nolimit')){_0x2e78b0['limit']=qs[_0xc46b('0x19')](_0x47523d['query'][_0xc46b('0x19')]);_0x2e78b0[_0xc46b('0x16')]=qs['offset'](_0x47523d[_0xc46b('0x32')][_0xc46b('0x16')]);}_0x2e78b0[_0xc46b('0x39')]=qs[_0xc46b('0x3a')](_0x47523d[_0xc46b('0x32')]['sort']);_0x2e78b0['where']=qs[_0xc46b('0x34')](_[_0xc46b('0x3b')](_0x47523d[_0xc46b('0x32')],_0x37db2d['filters']),_0x983e13);if(_0x47523d[_0xc46b('0x32')][_0xc46b('0x3c')]){_0x2e78b0[_0xc46b('0x3d')]=_[_0xc46b('0x28')](_0x2e78b0[_0xc46b('0x3d')],{'$or':_[_0xc46b('0x2e')](_0x983e13,function(_0x360194){if(_0x360194['type']!==_0xc46b('0x3e')){var _0x1bf9f3={};_0x1bf9f3[_0x360194['name']]={'$like':'%'+_0x47523d[_0xc46b('0x32')]['filter']+'%'};return _0x1bf9f3;}})});}_0x2e78b0=_[_0xc46b('0x28')]({},_0x2e78b0,_0x47523d[_0xc46b('0x3f')]);var _0x26b695={'where':_0x2e78b0[_0xc46b('0x3d')]};return db['Sound'][_0xc46b('0x18')](_0x26b695)[_0xc46b('0x24')](function(_0x4065ac){_0x579f66[_0xc46b('0x18')]=_0x4065ac;if(_0x47523d['query']['includeAll']){_0x2e78b0['include']=[{'all':!![]}];}return db[_0xc46b('0x2f')][_0xc46b('0x40')](_0x2e78b0);})[_0xc46b('0x24')](function(_0x19ac30){_0x579f66['rows']=_0x19ac30;return _0x579f66;})[_0xc46b('0x24')](respondWithFilteredResult(_0x57a068,_0x2e78b0))[_0xc46b('0x41')](handleError(_0x57a068,null));};exports[_0xc46b('0x42')]=function(_0x57a0c4,_0xcbc137){var _0x150f60={'raw':!![],'where':{'id':_0x57a0c4[_0xc46b('0x43')]['id']}},_0x462836={};_0x462836[_0xc46b('0x35')]=_['keys'](db['Sound'][_0xc46b('0x30')]);_0x462836['query']=_[_0xc46b('0x33')](_0x57a0c4[_0xc46b('0x32')]);_0x462836[_0xc46b('0x34')]=_[_0xc46b('0x37')](_0x462836[_0xc46b('0x35')],_0x462836['query']);_0x150f60['attributes']=_[_0xc46b('0x37')](_0x462836[_0xc46b('0x35')],qs[_0xc46b('0x38')](_0x57a0c4[_0xc46b('0x32')][_0xc46b('0x38')]));_0x150f60['attributes']=_0x150f60[_0xc46b('0x36')][_0xc46b('0x44')]?_0x150f60[_0xc46b('0x36')]:_0x462836['model'];if(_0x57a0c4['query'][_0xc46b('0x45')]){_0x150f60[_0xc46b('0x46')]=[{'all':!![]}];}_0x150f60=_[_0xc46b('0x28')]({},_0x150f60,_0x57a0c4[_0xc46b('0x3f')]);return db[_0xc46b('0x2f')]['find'](_0x150f60)['then'](handleEntityNotFound(_0xcbc137,null))[_0xc46b('0x24')](respondWithResult(_0xcbc137,null))[_0xc46b('0x41')](handleError(_0xcbc137,null));};exports['download']=function(_0x157652,_0x1a6e67,_0x52c8d8){return db[_0xc46b('0x2f')][_0xc46b('0x47')]({'where':{'id':_0x157652[_0xc46b('0x43')]['id']},'attributes':[_0xc46b('0x48'),_0xc46b('0x49'),_0xc46b('0x4a')],'raw':!![]})[_0xc46b('0x24')](handleEntityNotFound(_0x1a6e67,null))[_0xc46b('0x24')](function(_0x4a478a){if(_0x4a478a){if(!fs[_0xc46b('0x4b')](path['join'](config[_0xc46b('0x4c')],_0xc46b('0x4d'),_0x4a478a[_0xc46b('0x49')]+'.'+_0x4a478a[_0xc46b('0x4a')]))){throw new db[(_0xc46b('0x4e'))][(_0xc46b('0x4f'))](_0xc46b('0x50'));}return _0x1a6e67['download'](path[_0xc46b('0x51')](config['root'],_0xc46b('0x4d'),util[_0xc46b('0x52')](_0xc46b('0x53'),_0x4a478a[_0xc46b('0x49')],_0x4a478a[_0xc46b('0x4a')])),util['format'](_0xc46b('0x53'),_0x4a478a[_0xc46b('0x48')],_0x4a478a[_0xc46b('0x4a')]));}return null;})['catch'](handleError(_0x1a6e67,null));};exports[_0xc46b('0x54')]=function(_0x120951,_0x1e8f2c,_0x80b18e){var _0x358379={'name':path[_0xc46b('0x55')](_0x120951[_0xc46b('0x56')][_0xc46b('0x57')],path['extname'](_0x120951[_0xc46b('0x56')]['originalname'])),'save_name':path['basename'](_0x120951[_0xc46b('0x56')][_0xc46b('0x58')],path[_0xc46b('0x59')](_0x120951[_0xc46b('0x56')][_0xc46b('0x58')])),'original_format':path[_0xc46b('0x59')](_0x120951[_0xc46b('0x56')][_0xc46b('0x57')])['substring'](0x1),'converted_format':_0xc46b('0x5a')};var _0x4e2c3e=path['join'](config[_0xc46b('0x4c')],_0xc46b('0x5b'),_0x120951[_0xc46b('0x56')][_0xc46b('0x58')]);var _0x43bab9=path[_0xc46b('0x51')](config[_0xc46b('0x4c')],_0xc46b('0x4d'),util[_0xc46b('0x52')](_0xc46b('0x53'),path[_0xc46b('0x55')](_0x120951[_0xc46b('0x56')]['filename'],path[_0xc46b('0x59')](_0x120951['file'][_0xc46b('0x58')])),_0x358379[_0xc46b('0x4a')]));logger[_0xc46b('0x5c')](_0xc46b('0x5d'),_0x4e2c3e);logger[_0xc46b('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0x43bab9);try{fs[_0xc46b('0x5e')](_0x4e2c3e,parseInt(_0xc46b('0x5f'),0x8));var _0x2ec665=sox[_0xc46b('0x60')](_0x4e2c3e,_0x43bab9,{'sampleRate':0x1f40,'format':_0xc46b('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ec665['on'](_0xc46b('0x25'),function(_0x569971){fs[_0xc46b('0x61')](_0x4e2c3e);_0x1e8f2c[_0xc46b('0x14')](0x1f4)[_0xc46b('0x27')](_0x569971);});_0x2ec665['on'](_0xc46b('0x62'),function(_0x3e1ddd){_0x358379[_0xc46b('0x63')]=isNaN(_0x3e1ddd[_0xc46b('0x64')])?null:_0x3e1ddd[_0xc46b('0x64')]*0x3e8;_0x358379['original_sampleCount']=isNaN(_0x3e1ddd[_0xc46b('0x65')])?null:_0x3e1ddd['sampleCount'];_0x358379[_0xc46b('0x66')]=isNaN(_0x3e1ddd['channelCount'])?null:_0x3e1ddd[_0xc46b('0x67')];_0x358379[_0xc46b('0x68')]=isNaN(_0x3e1ddd[_0xc46b('0x69')])?null:_0x3e1ddd[_0xc46b('0x69')];_0x358379[_0xc46b('0x6a')]=isNaN(_0x3e1ddd[_0xc46b('0x6b')])?null:_0x3e1ddd['sampleRate'];});_0x2ec665['on'](_0xc46b('0x6c'),function(_0x22db4b){_0x358379[_0xc46b('0x6d')]=isNaN(_0x22db4b[_0xc46b('0x64')])?null:_0x22db4b[_0xc46b('0x64')]*0x3e8;_0x358379[_0xc46b('0x6e')]=isNaN(_0x22db4b['sampleCount'])?null:_0x22db4b[_0xc46b('0x65')];_0x358379['converted_channelCount']=isNaN(_0x22db4b[_0xc46b('0x67')])?null:_0x22db4b[_0xc46b('0x67')];_0x358379[_0xc46b('0x6f')]=isNaN(_0x22db4b[_0xc46b('0x69')])?null:_0x22db4b[_0xc46b('0x69')];_0x358379[_0xc46b('0x70')]=isNaN(_0x22db4b[_0xc46b('0x6b')])?null:_0x22db4b[_0xc46b('0x6b')];});_0x2ec665['on'](_0xc46b('0x15'),function(){fs['chmodSync'](_0x43bab9,parseInt(_0xc46b('0x5f'),0x8));return db['Sound'][_0xc46b('0x54')](_0x358379)[_0xc46b('0x24')](function(_0x3343f8){var _0x436752={'role':_0x120951[_0xc46b('0x29')][_0xc46b('0x71')],'userProfileId':_0x120951[_0xc46b('0x29')][_0xc46b('0x72')]};if(!_0x436752)throw new Error(_0xc46b('0x73'));if(_0x436752[_0xc46b('0x71')]===_0xc46b('0x74')){var _0x4021c8=_0x3343f8['get']({'plain':!![]});return db[_0xc46b('0x75')][_0xc46b('0x47')]({'where':{'name':_0xc46b('0x21'),'userProfileId':_0x436752[_0xc46b('0x72')]},'raw':!![]})[_0xc46b('0x24')](function(_0x17ff33){if(_0x17ff33&&_0x17ff33['autoAssociation']===0x0){return db[_0xc46b('0x22')][_0xc46b('0x54')]({'name':_0x4021c8[_0xc46b('0x48')],'resourceId':_0x4021c8['id'],'type':_0x17ff33['name'],'sectionId':_0x17ff33['id']},{})[_0xc46b('0x24')](function(){return _0x3343f8;});}else{return _0x3343f8;}})[_0xc46b('0x41')](function(_0x5e73fc){logger['error'](_0xc46b('0x76'),_0x5e73fc);throw _0x5e73fc;});}return _0x3343f8;})[_0xc46b('0x24')](respondWithResult(_0x1e8f2c,null))[_0xc46b('0x41')](handleError(_0x1e8f2c,null));});_0x2ec665['start']();}catch(_0x1df3cf){_0x1e8f2c[_0xc46b('0x14')](0x1f4)[_0xc46b('0x27')](_0x1df3cf);}};exports[_0xc46b('0x1f')]=function(_0x41470a,_0x521659,_0x198a27){return db[_0xc46b('0x2f')][_0xc46b('0x47')]({'where':{'id':_0x41470a['params']['id']}})[_0xc46b('0x24')](handleEntityNotFound(_0x521659,null))[_0xc46b('0x24')](saveUpdates(_['pick'](_0x41470a[_0xc46b('0x29')],[_0xc46b('0x48'),_0xc46b('0x77')]),null))[_0xc46b('0x24')](respondWithResult(_0x521659,null))[_0xc46b('0x41')](handleError(_0x521659,null));};exports['delete']=function(_0x59eafa,_0x515c8f,_0x43e29c){return db[_0xc46b('0x2f')][_0xc46b('0x47')]({'where':{'id':_0x59eafa[_0xc46b('0x43')]['id']}})['then'](function(_0x3fd2a3){if(_0x3fd2a3){return _0x3fd2a3[_0xc46b('0x23')]();}})[_0xc46b('0x24')](function(_0x267ea0){var _0xe77c1d=path[_0xc46b('0x51')](config[_0xc46b('0x4c')],_0xc46b('0x5b'),util[_0xc46b('0x52')](_0xc46b('0x53'),_0x267ea0[_0xc46b('0x49')],_0x267ea0[_0xc46b('0x78')]));var _0x13ef95=path[_0xc46b('0x51')](config[_0xc46b('0x4c')],_0xc46b('0x4d'),util[_0xc46b('0x52')](_0xc46b('0x53'),_0x267ea0[_0xc46b('0x49')],_0x267ea0[_0xc46b('0x4a')]));fs[_0xc46b('0x61')](_0xe77c1d);fs[_0xc46b('0x61')](_0x13ef95);return _0x267ea0;})['then'](function(_0x32c417){if(_0x32c417){return _0x515c8f['status'](0xcc)[_0xc46b('0x15')]();}})[_0xc46b('0x24')](handleEntityNotFound(_0x515c8f,null))[_0xc46b('0x41')](handleError(_0x515c8f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 9cec2f7..fd9f7e6 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 _0xb79e=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xa62c9f,_0x38843a){var _0x43534f=function(_0x1bde0c){while(--_0x1bde0c){_0xa62c9f['push'](_0xa62c9f['shift']());}};_0x43534f(++_0x38843a);}(_0xb79e,0x1f0));var _0xeb79=function(_0x11ced2,_0x4d7199){_0x11ced2=_0x11ced2-0x0;var _0x36a414=_0xb79e[_0x11ced2];return _0x36a414;};'use strict';var _=require(_0xeb79('0x0'));var util=require(_0xeb79('0x1'));var logger=require(_0xeb79('0x2'))(_0xeb79('0x3'));var moment=require('moment');var BPromise=require(_0xeb79('0x4'));var rp=require(_0xeb79('0x5'));var fs=require('fs');var path=require(_0xeb79('0x6'));var rimraf=require(_0xeb79('0x7'));var config=require(_0xeb79('0x8'));var attributes=require(_0xeb79('0x9'));module[_0xeb79('0xa')]=function(_0x42f3c1,_0x958ec9){return _0x42f3c1[_0xeb79('0xb')](_0xeb79('0xc'),attributes,{'tableName':_0xeb79('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8e4=['request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','util','../../config/logger','moment','bluebird'];(function(_0x15ce1a,_0xafd6c9){var _0x51d839=function(_0x36ad53){while(--_0x36ad53){_0x15ce1a['push'](_0x15ce1a['shift']());}};_0x51d839(++_0xafd6c9);}(_0xa8e4,0x140));var _0x4a8e=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xa8e4[_0x1b2ff7];return _0x31656a;};'use strict';var _=require('lodash');var util=require(_0x4a8e('0x0'));var logger=require(_0x4a8e('0x1'))('api');var moment=require(_0x4a8e('0x2'));var BPromise=require(_0x4a8e('0x3'));var rp=require(_0x4a8e('0x4'));var fs=require('fs');var path=require(_0x4a8e('0x5'));var rimraf=require(_0x4a8e('0x6'));var config=require(_0x4a8e('0x7'));var attributes=require(_0x4a8e('0x8'));module[_0x4a8e('0x9')]=function(_0x5e33a3,_0x55b30a){return _0x5e33a3[_0x4a8e('0xa')](_0x4a8e('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 983de6b..e4c1b37 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 _0x589a=['catch','lodash','moment','randomstring','ioredis','../../config/utils','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','ShowSound','Sound','find','options','raw','where','attributes','include','model','map'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0x589a,0x1e7));var _0xa589=function(_0x25cfe3,_0xd13431){_0x25cfe3=_0x25cfe3-0x0;var _0x4f9f02=_0x589a[_0x25cfe3];return _0x4f9f02;};'use strict';var _=require(_0xa589('0x0'));var util=require('util');var moment=require(_0xa589('0x1'));var BPromise=require('bluebird');var rs=require(_0xa589('0x2'));var fs=require('fs');var Redis=require(_0xa589('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa589('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa589('0x5'));var client=jayson['client'][_0xa589('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2eaaaf,_0x5142f6,_0x12bd4f){return new BPromise(function(_0x1e657f,_0x2466b6){return client[_0xa589('0x7')](_0x2eaaaf,_0x12bd4f)[_0xa589('0x8')](function(_0x1d3db1){logger[_0xa589('0x9')](_0xa589('0xa'),_0x5142f6,_0xa589('0xb'));logger[_0xa589('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x5142f6,_0xa589('0xb'),JSON[_0xa589('0xd')](_0x1d3db1));if(_0x1d3db1[_0xa589('0xe')]){if(_0x1d3db1[_0xa589('0xe')]['code']===0x1f4){logger[_0xa589('0xe')](_0xa589('0xa'),_0x5142f6,_0x1d3db1[_0xa589('0xe')][_0xa589('0xf')]);return _0x2466b6(_0x1d3db1['error'][_0xa589('0xf')]);}logger[_0xa589('0xe')](_0xa589('0xa'),_0x5142f6,_0x1d3db1['error'][_0xa589('0xf')]);return _0x1e657f(_0x1d3db1[_0xa589('0xe')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x5142f6,_0xa589('0xb'));_0x1e657f(_0x1d3db1['result'][_0xa589('0xf')]);}})['catch'](function(_0x29be28){logger[_0xa589('0xe')](_0xa589('0xa'),_0x5142f6,_0x29be28);_0x2466b6(_0x29be28);});});}exports[_0xa589('0x10')]=function(_0x5e7b43){var _0x421005=this;return new Promise(function(_0x28da36,_0x22199e){return db[_0xa589('0x11')][_0xa589('0x12')]({'raw':_0x5e7b43['options']?_0x5e7b43[_0xa589('0x13')][_0xa589('0x14')]===undefined?!![]:![]:!![],'where':_0x5e7b43[_0xa589('0x13')]?_0x5e7b43[_0xa589('0x13')][_0xa589('0x15')]||null:null,'attributes':_0x5e7b43[_0xa589('0x13')]?_0x5e7b43[_0xa589('0x13')][_0xa589('0x16')]||null:null,'include':_0x5e7b43['options']?_0x5e7b43[_0xa589('0x13')]['include']?_['map'](_0x5e7b43['options'][_0xa589('0x17')],function(_0x3867ea){return{'model':db[_0x3867ea[_0xa589('0x18')]],'as':_0x3867ea['as'],'attributes':_0x3867ea[_0xa589('0x16')],'include':_0x3867ea[_0xa589('0x17')]?_['map'](_0x3867ea[_0xa589('0x17')],function(_0x29e010){return{'model':db[_0x29e010[_0xa589('0x18')]],'as':_0x29e010['as'],'attributes':_0x29e010[_0xa589('0x16')],'include':_0x29e010['include']?_[_0xa589('0x19')](_0x29e010[_0xa589('0x17')],function(_0x26a911){return{'model':db[_0x26a911[_0xa589('0x18')]],'as':_0x26a911['as'],'attributes':_0x26a911[_0xa589('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cca89){logger[_0xa589('0x9')](_0xa589('0x10'),_0x5e7b43);logger[_0xa589('0xc')](_0xa589('0x10'),_0x5e7b43,JSON[_0xa589('0xd')](_0x1cca89));_0x28da36(_0x1cca89);})[_0xa589('0x1a')](function(_0xb67f6a){logger[_0xa589('0xe')]('ShowSound',_0xb67f6a['message'],_0x5e7b43);_0x22199e(_0x421005[_0xa589('0xe')](0x1f4,_0xb67f6a[_0xa589('0xf')]));});});}; \ No newline at end of file +var _0x08a7=['include','map','model','attributes','ShowSound','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Sound','find','options','raw','where'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x08a7,0xb3));var _0x708a=function(_0x545ba9,_0xc04a8f){_0x545ba9=_0x545ba9-0x0;var _0x3931b7=_0x08a7[_0x545ba9];return _0x3931b7;};'use strict';var _=require(_0x708a('0x0'));var util=require(_0x708a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x708a('0x2'));var db=require(_0x708a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x708a('0x4'))('rpc');var config=require(_0x708a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x708a('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x247d4,_0x2b2397,_0x1a4a0e){return new BPromise(function(_0x5a424f,_0x1652f6){return client[_0x708a('0x7')](_0x247d4,_0x1a4a0e)[_0x708a('0x8')](function(_0x5e87d2){logger[_0x708a('0x9')](_0x708a('0xa'),_0x2b2397,_0x708a('0xb'));logger[_0x708a('0xc')](_0x708a('0xd'),_0x2b2397,_0x708a('0xb'),JSON[_0x708a('0xe')](_0x5e87d2));if(_0x5e87d2[_0x708a('0xf')]){if(_0x5e87d2[_0x708a('0xf')][_0x708a('0x10')]===0x1f4){logger[_0x708a('0xf')](_0x708a('0xa'),_0x2b2397,_0x5e87d2[_0x708a('0xf')][_0x708a('0x11')]);return _0x1652f6(_0x5e87d2[_0x708a('0xf')]['message']);}logger[_0x708a('0xf')](_0x708a('0xa'),_0x2b2397,_0x5e87d2[_0x708a('0xf')][_0x708a('0x11')]);return _0x5a424f(_0x5e87d2[_0x708a('0xf')][_0x708a('0x11')]);}else{logger[_0x708a('0x9')](_0x708a('0xa'),_0x2b2397,_0x708a('0xb'));_0x5a424f(_0x5e87d2['result'][_0x708a('0x11')]);}})[_0x708a('0x12')](function(_0x419462){logger[_0x708a('0xf')](_0x708a('0xa'),_0x2b2397,_0x419462);_0x1652f6(_0x419462);});});}exports['ShowSound']=function(_0x585840){var _0x2f3c36=this;return new Promise(function(_0x2d15e2,_0x31dda3){return db[_0x708a('0x13')][_0x708a('0x14')]({'raw':_0x585840[_0x708a('0x15')]?_0x585840['options'][_0x708a('0x16')]===undefined?!![]:![]:!![],'where':_0x585840[_0x708a('0x15')]?_0x585840[_0x708a('0x15')][_0x708a('0x17')]||null:null,'attributes':_0x585840[_0x708a('0x15')]?_0x585840['options']['attributes']||null:null,'include':_0x585840[_0x708a('0x15')]?_0x585840['options'][_0x708a('0x18')]?_[_0x708a('0x19')](_0x585840[_0x708a('0x15')][_0x708a('0x18')],function(_0x470ce6){return{'model':db[_0x470ce6[_0x708a('0x1a')]],'as':_0x470ce6['as'],'attributes':_0x470ce6[_0x708a('0x1b')],'include':_0x470ce6[_0x708a('0x18')]?_[_0x708a('0x19')](_0x470ce6[_0x708a('0x18')],function(_0x42e4e0){return{'model':db[_0x42e4e0[_0x708a('0x1a')]],'as':_0x42e4e0['as'],'attributes':_0x42e4e0[_0x708a('0x1b')],'include':_0x42e4e0[_0x708a('0x18')]?_['map'](_0x42e4e0['include'],function(_0x2a0e49){return{'model':db[_0x2a0e49[_0x708a('0x1a')]],'as':_0x2a0e49['as'],'attributes':_0x2a0e49[_0x708a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46711f){logger[_0x708a('0x9')](_0x708a('0x1c'),_0x585840);logger[_0x708a('0xc')](_0x708a('0x1c'),_0x585840,JSON[_0x708a('0xe')](_0x46711f));_0x2d15e2(_0x46711f);})['catch'](function(_0x59dc2b){logger[_0x708a('0xf')](_0x708a('0x1c'),_0x59dc2b['message'],_0x585840);_0x31dda3(_0x2f3c36[_0x708a('0xf')](0x1f4,_0x59dc2b[_0x708a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 0a8d553..e14b406 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 _0xac5d=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','show','post'];(function(_0x1c391d,_0x3f1c38){var _0xb9dc55=function(_0x4c83bc){while(--_0x4c83bc){_0x1c391d['push'](_0x1c391d['shift']());}};_0xb9dc55(++_0x3f1c38);}(_0xac5d,0x83));var _0xdac5=function(_0x506a86,_0x41e1c9){_0x506a86=_0x506a86-0x0;var _0x5e1960=_0xac5d[_0x506a86];return _0x5e1960;};'use strict';var multer=require(_0xdac5('0x0'));var util=require(_0xdac5('0x1'));var path=require(_0xdac5('0x2'));var timeout=require(_0xdac5('0x3'));var express=require(_0xdac5('0x4'));var router=express[_0xdac5('0x5')]();var fs_extra=require(_0xdac5('0x6'));var auth=require(_0xdac5('0x7'));var interaction=require(_0xdac5('0x8'));var config=require(_0xdac5('0x9'));var controller=require(_0xdac5('0xa'));router[_0xdac5('0xb')]('/',auth[_0xdac5('0xc')](),controller[_0xdac5('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdac5('0xe')]);router[_0xdac5('0xf')]('/',auth['isAuthenticated'](),controller[_0xdac5('0x10')]);router[_0xdac5('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdac5('0x12')]('/:id',auth[_0xdac5('0xc')](),controller[_0xdac5('0x13')]);module[_0xdac5('0x14')]=router; \ No newline at end of file +var _0xc470=['create','put','/:id','update','exports','multer','util','../../components/auth/service','../../components/interaction/service','./squareMessage.controller','get','isAuthenticated','show','post'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0xc470,0x147));var _0x0c47=function(_0x562431,_0x3bd79f){_0x562431=_0x562431-0x0;var _0x11d1af=_0xc470[_0x562431];return _0x11d1af;};'use strict';var multer=require(_0x0c47('0x0'));var util=require(_0x0c47('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(_0x0c47('0x2'));var interaction=require(_0x0c47('0x3'));var config=require('../../config/environment');var controller=require(_0x0c47('0x4'));router[_0x0c47('0x5')]('/',auth[_0x0c47('0x6')](),controller['index']);router[_0x0c47('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x0c47('0x7')]);router[_0x0c47('0x8')]('/',auth[_0x0c47('0x6')](),controller[_0x0c47('0x9')]);router[_0x0c47('0xa')](_0x0c47('0xb'),auth[_0x0c47('0x6')](),controller[_0x0c47('0xc')]);router['delete'](_0x0c47('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x0c47('0xd')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ec76039..b78d904 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 _0xc3b5=['out','STRING','TEXT','medium','ENUM'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x4141d9,_0x1438e4){_0x4141d9=_0x4141d9-0x0;var _0x2cc840=_0xc3b5[_0x4141d9];return _0x2cc840;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x5c3b('0x0')]},'body':{'type':Sequelize[_0x5c3b('0x1')](_0x5c3b('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x5c3b('0x3')]('in',_0x5c3b('0x4')),'defaultValue':_0x5c3b('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x5c3b('0x0')]},'providerResponse':{'type':Sequelize[_0x5c3b('0x1')]}}; \ No newline at end of file +var _0xd0bb=['exports','STRING','medium','out','TEXT','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3df41c,_0x2c4f5c){_0x3df41c=_0x3df41c-0x0;var _0x56cc7b=_0xd0bb[_0x3df41c];return _0x56cc7b;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'uniqueid':{'type':Sequelize[_0xbd0b('0x2')]},'body':{'type':Sequelize['TEXT'](_0xbd0b('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbd0b('0x4')),'defaultValue':_0xbd0b('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbd0b('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 398af41..e95e00f 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 _0x326f=['query','filters','intersection','attributes','model','fields','length','sort','where','pick','VIRTUAL','options','SquareMessage','includeAll','findAll','rows','catch','show','params','find','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','rawAttributes','type','key','keys'];(function(_0x547068,_0x311651){var _0x2bbb99=function(_0x1ba48c){while(--_0x1ba48c){_0x547068['push'](_0x547068['shift']());}};_0x2bbb99(++_0x311651);}(_0x326f,0x191));var _0xf326=function(_0xb5c61e,_0x45dcf6){_0xb5c61e=_0xb5c61e-0x0;var _0x3c668a=_0x326f[_0xb5c61e];return _0x3c668a;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require(_0xf326('0x1'));var zipdir=require(_0xf326('0x2'));var jsonpatch=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var moment=require('moment');var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require('util');var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require(_0xf326('0xb'));var _=require('lodash');var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require(_0xf326('0xf'));var toCsv=require(_0xf326('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require(_0xf326('0x14'));var logger=require('../../config/logger')(_0xf326('0x15'));var utils=require(_0xf326('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xefb985,_0x98af3b){_0x98af3b=_0x98af3b||0xcc;return function(_0x5a63b6){if(_0x5a63b6){return _0xefb985[_0xf326('0x18')](_0x98af3b);}return _0xefb985[_0xf326('0x19')](_0x98af3b)['end']();};}function respondWithResult(_0x4c952a,_0x2d9f49){_0x2d9f49=_0x2d9f49||0xc8;return function(_0x18b1c9){if(_0x18b1c9){return _0x4c952a[_0xf326('0x19')](_0x2d9f49)[_0xf326('0x1a')](_0x18b1c9);}};}function respondWithFilteredResult(_0x1cdb5a,_0x4e3966){return function(_0x27d53c){if(_0x27d53c){var _0x29b5c8=typeof _0x4e3966[_0xf326('0x1b')]===_0xf326('0x1c')&&typeof _0x4e3966[_0xf326('0x1d')]==='undefined';var _0x35ee84=_0x27d53c['count'];var _0x4a4c5f=_0x29b5c8?0x0:_0x4e3966[_0xf326('0x1b')];var _0x1b6a8a=_0x29b5c8?_0x27d53c[_0xf326('0x1e')]:_0x4e3966['offset']+_0x4e3966[_0xf326('0x1d')];var _0x4896fc;if(_0x1b6a8a>=_0x35ee84){_0x1b6a8a=_0x35ee84;_0x4896fc=0xc8;}else{_0x4896fc=0xce;}_0x1cdb5a[_0xf326('0x19')](_0x4896fc);return _0x1cdb5a[_0xf326('0x1f')](_0xf326('0x20'),_0x4a4c5f+'-'+_0x1b6a8a+'/'+_0x35ee84)[_0xf326('0x1a')](_0x27d53c);}return null;};}function patchUpdates(_0xebb044){return function(_0xd1e5dd){try{jsonpatch['apply'](_0xd1e5dd,_0xebb044,!![]);}catch(_0x2b5a04){return BPromise['reject'](_0x2b5a04);}return _0xd1e5dd[_0xf326('0x21')]();};}function saveUpdates(_0xe3b582,_0x2afcbb){return function(_0x2c4d37){if(_0x2c4d37){return _0x2c4d37[_0xf326('0x22')](_0xe3b582)[_0xf326('0x23')](function(_0x33f6f4){return _0x33f6f4;});}return null;};}function removeEntity(_0x376675,_0x434be6){return function(_0x1a400b){if(_0x1a400b){return _0x1a400b[_0xf326('0x24')]()['then'](function(){_0x376675[_0xf326('0x19')](0xcc)[_0xf326('0x25')]();});}};}function handleEntityNotFound(_0x4ee4a3,_0x56d498){return function(_0x5c3d63){if(!_0x5c3d63){_0x4ee4a3[_0xf326('0x18')](0x194);}return _0x5c3d63;};}function handleError(_0x2cfb9c,_0x4d21a0){_0x4d21a0=_0x4d21a0||0x1f4;return function(_0x35823d){logger[_0xf326('0x26')](_0x35823d[_0xf326('0x27')]);if(_0x35823d[_0xf326('0x28')]){delete _0x35823d[_0xf326('0x28')];}_0x2cfb9c[_0xf326('0x19')](_0x4d21a0)[_0xf326('0x29')](_0x35823d);};}function getMustacheRender(_0x59d82a,_0xafba3c){return Mustache[_0xf326('0x2a')](_0x59d82a,_[_0xf326('0x2b')](_0xafba3c[_0xf326('0x2c')],{'contact':_0xafba3c[_0xf326('0x2d')],'message':_0xafba3c['message'],'agent':_0xafba3c[_0xf326('0x2e')],'interaction':_0xafba3c[_0xf326('0x2f')],'account':_0xafba3c[_0xf326('0x30')]}))||'';}exports[_0xf326('0x31')]=function(_0x5e58e6,_0x2bede6){var _0x1e27c3={},_0x1dcf84={},_0x11ba75={'count':0x0,'rows':[]};var _0x2b8de6=_[_0xf326('0x32')](db['SquareMessage'][_0xf326('0x33')],function(_0x4bc756){return{'name':_0x4bc756['fieldName'],'type':_0x4bc756[_0xf326('0x34')][_0xf326('0x35')]};});_0x1dcf84['model']=_['map'](_0x2b8de6,'name');_0x1dcf84['query']=_[_0xf326('0x36')](_0x5e58e6[_0xf326('0x37')]);_0x1dcf84[_0xf326('0x38')]=_[_0xf326('0x39')](_0x1dcf84['model'],_0x1dcf84[_0xf326('0x37')]);_0x1e27c3[_0xf326('0x3a')]=_[_0xf326('0x39')](_0x1dcf84[_0xf326('0x3b')],qs['fields'](_0x5e58e6[_0xf326('0x37')][_0xf326('0x3c')]));_0x1e27c3[_0xf326('0x3a')]=_0x1e27c3['attributes'][_0xf326('0x3d')]?_0x1e27c3[_0xf326('0x3a')]:_0x1dcf84[_0xf326('0x3b')];if(!_0x5e58e6[_0xf326('0x37')]['hasOwnProperty']('nolimit')){_0x1e27c3[_0xf326('0x1d')]=qs[_0xf326('0x1d')](_0x5e58e6[_0xf326('0x37')][_0xf326('0x1d')]);_0x1e27c3[_0xf326('0x1b')]=qs[_0xf326('0x1b')](_0x5e58e6['query'][_0xf326('0x1b')]);}_0x1e27c3['order']=qs[_0xf326('0x3e')](_0x5e58e6['query'][_0xf326('0x3e')]);_0x1e27c3[_0xf326('0x3f')]=qs['filters'](_[_0xf326('0x40')](_0x5e58e6[_0xf326('0x37')],_0x1dcf84['filters']),_0x2b8de6);if(_0x5e58e6['query']['filter']){_0x1e27c3[_0xf326('0x3f')]=_[_0xf326('0x2b')](_0x1e27c3[_0xf326('0x3f')],{'$or':_[_0xf326('0x32')](_0x2b8de6,function(_0x5a5faf){if(_0x5a5faf['type']!==_0xf326('0x41')){var _0x128d71={};_0x128d71[_0x5a5faf[_0xf326('0x28')]]={'$like':'%'+_0x5e58e6[_0xf326('0x37')]['filter']+'%'};return _0x128d71;}})});}_0x1e27c3=_['merge']({},_0x1e27c3,_0x5e58e6[_0xf326('0x42')]);var _0x1827bd={'where':_0x1e27c3[_0xf326('0x3f')]};return db[_0xf326('0x43')][_0xf326('0x1e')](_0x1827bd)[_0xf326('0x23')](function(_0x163d9d){_0x11ba75[_0xf326('0x1e')]=_0x163d9d;if(_0x5e58e6[_0xf326('0x37')][_0xf326('0x44')]){_0x1e27c3['include']=[{'all':!![]}];}return db[_0xf326('0x43')][_0xf326('0x45')](_0x1e27c3);})[_0xf326('0x23')](function(_0x4e8630){_0x11ba75[_0xf326('0x46')]=_0x4e8630;return _0x11ba75;})['then'](respondWithFilteredResult(_0x2bede6,_0x1e27c3))[_0xf326('0x47')](handleError(_0x2bede6,null));};exports[_0xf326('0x48')]=function(_0x26690f,_0x1292d0){var _0x4f1554={'raw':!![],'where':{'id':_0x26690f[_0xf326('0x49')]['id']}},_0x704b2a={};_0x704b2a[_0xf326('0x3b')]=_['keys'](db[_0xf326('0x43')]['rawAttributes']);_0x704b2a[_0xf326('0x37')]=_[_0xf326('0x36')](_0x26690f[_0xf326('0x37')]);_0x704b2a[_0xf326('0x38')]=_['intersection'](_0x704b2a['model'],_0x704b2a[_0xf326('0x37')]);_0x4f1554[_0xf326('0x3a')]=_[_0xf326('0x39')](_0x704b2a[_0xf326('0x3b')],qs[_0xf326('0x3c')](_0x26690f[_0xf326('0x37')]['fields']));_0x4f1554[_0xf326('0x3a')]=_0x4f1554[_0xf326('0x3a')][_0xf326('0x3d')]?_0x4f1554[_0xf326('0x3a')]:_0x704b2a[_0xf326('0x3b')];if(_0x26690f[_0xf326('0x37')][_0xf326('0x44')]){_0x4f1554['include']=[{'all':!![]}];}_0x4f1554=_[_0xf326('0x2b')]({},_0x4f1554,_0x26690f[_0xf326('0x42')]);return db[_0xf326('0x43')][_0xf326('0x4a')](_0x4f1554)[_0xf326('0x23')](handleEntityNotFound(_0x1292d0,null))['then'](respondWithResult(_0x1292d0,null))[_0xf326('0x47')](handleError(_0x1292d0,null));};exports['create']=function(_0x8bc9a7,_0x2cf8b0){return db[_0xf326('0x43')][_0xf326('0x4b')](_0x8bc9a7[_0xf326('0x2c')],{})[_0xf326('0x23')](respondWithResult(_0x2cf8b0,0xc9))[_0xf326('0x47')](handleError(_0x2cf8b0,null));};exports[_0xf326('0x22')]=function(_0x574bcc,_0x358f5a){if(_0x574bcc[_0xf326('0x2c')]['id']){delete _0x574bcc[_0xf326('0x2c')]['id'];}return db[_0xf326('0x43')][_0xf326('0x4a')]({'where':{'id':_0x574bcc[_0xf326('0x49')]['id']}})['then'](handleEntityNotFound(_0x358f5a,null))[_0xf326('0x23')](saveUpdates(_0x574bcc[_0xf326('0x2c')],null))[_0xf326('0x23')](respondWithResult(_0x358f5a,null))['catch'](handleError(_0x358f5a,null));};exports[_0xf326('0x24')]=function(_0x1d56c4,_0x4f1ef2){return db['SquareMessage'][_0xf326('0x4a')]({'where':{'id':_0x1d56c4[_0xf326('0x49')]['id']}})[_0xf326('0x23')](handleEntityNotFound(_0x4f1ef2,null))[_0xf326('0x23')](removeEntity(_0x4f1ef2,null))[_0xf326('0x47')](handleError(_0x4f1ef2,null));}; \ No newline at end of file +var _0xe2f0=['limit','count','apply','reject','save','then','destroy','end','error','stack','name','send','merge','body','contact','message','agent','interaction','account','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','SquareMessage','includeAll','include','show','rawAttributes','find','catch','create','update','params','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0xe2f0,0x1b3));var _0x0e2f=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xe2f0[_0x547456];return _0xc1fd7b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e2f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e2f('0x1'));var rp=require(_0x0e2f('0x2'));var moment=require('moment');var BPromise=require(_0x0e2f('0x3'));var Mustache=require('mustache');var util=require(_0x0e2f('0x4'));var path=require(_0x0e2f('0x5'));var sox=require('sox');var csv=require(_0x0e2f('0x6'));var ejs=require(_0x0e2f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e2f('0x8'));var squel=require(_0x0e2f('0x9'));var crypto=require('crypto');var jsforce=require(_0x0e2f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0e2f('0x6'));var querystring=require(_0x0e2f('0xb'));var Papa=require(_0x0e2f('0xc'));var Redis=require(_0x0e2f('0xd'));var authService=require(_0x0e2f('0xe'));var qs=require(_0x0e2f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e2f('0x10'));var logger=require('../../config/logger')(_0x0e2f('0x11'));var utils=require(_0x0e2f('0x12'));var config=require(_0x0e2f('0x13'));var licenseUtil=require(_0x0e2f('0x14'));var db=require(_0x0e2f('0x15'))['db'];function respondWithStatusCode(_0x2c5a7b,_0x248aad){_0x248aad=_0x248aad||0xcc;return function(_0x21e6ab){if(_0x21e6ab){return _0x2c5a7b[_0x0e2f('0x16')](_0x248aad);}return _0x2c5a7b[_0x0e2f('0x17')](_0x248aad)['end']();};}function respondWithResult(_0x33f304,_0x14516c){_0x14516c=_0x14516c||0xc8;return function(_0x53b2f7){if(_0x53b2f7){return _0x33f304['status'](_0x14516c)[_0x0e2f('0x18')](_0x53b2f7);}};}function respondWithFilteredResult(_0x24f8e4,_0x4c1951){return function(_0x1c5edf){if(_0x1c5edf){var _0x55d05f=typeof _0x4c1951[_0x0e2f('0x19')]===_0x0e2f('0x1a')&&typeof _0x4c1951[_0x0e2f('0x1b')]===_0x0e2f('0x1a');var _0x44df3a=_0x1c5edf[_0x0e2f('0x1c')];var _0xf654a9=_0x55d05f?0x0:_0x4c1951[_0x0e2f('0x19')];var _0x3d4288=_0x55d05f?_0x1c5edf[_0x0e2f('0x1c')]:_0x4c1951[_0x0e2f('0x19')]+_0x4c1951[_0x0e2f('0x1b')];var _0x537f82;if(_0x3d4288>=_0x44df3a){_0x3d4288=_0x44df3a;_0x537f82=0xc8;}else{_0x537f82=0xce;}_0x24f8e4[_0x0e2f('0x17')](_0x537f82);return _0x24f8e4['set']('Content-Range',_0xf654a9+'-'+_0x3d4288+'/'+_0x44df3a)[_0x0e2f('0x18')](_0x1c5edf);}return null;};}function patchUpdates(_0x3e6197){return function(_0x1f6186){try{jsonpatch[_0x0e2f('0x1d')](_0x1f6186,_0x3e6197,!![]);}catch(_0x40d52c){return BPromise[_0x0e2f('0x1e')](_0x40d52c);}return _0x1f6186[_0x0e2f('0x1f')]();};}function saveUpdates(_0x13e8d0,_0x20e06b){return function(_0x45bb9f){if(_0x45bb9f){return _0x45bb9f['update'](_0x13e8d0)[_0x0e2f('0x20')](function(_0x2aeb88){return _0x2aeb88;});}return null;};}function removeEntity(_0x508643,_0x5cb801){return function(_0x40b538){if(_0x40b538){return _0x40b538[_0x0e2f('0x21')]()['then'](function(){_0x508643[_0x0e2f('0x17')](0xcc)[_0x0e2f('0x22')]();});}};}function handleEntityNotFound(_0x5762ff,_0x5ae519){return function(_0x144b8f){if(!_0x144b8f){_0x5762ff['sendStatus'](0x194);}return _0x144b8f;};}function handleError(_0x17895d,_0x8bba2){_0x8bba2=_0x8bba2||0x1f4;return function(_0xa0cea9){logger[_0x0e2f('0x23')](_0xa0cea9[_0x0e2f('0x24')]);if(_0xa0cea9[_0x0e2f('0x25')]){delete _0xa0cea9[_0x0e2f('0x25')];}_0x17895d[_0x0e2f('0x17')](_0x8bba2)[_0x0e2f('0x26')](_0xa0cea9);};}function getMustacheRender(_0x43c9f1,_0x4a961c){return Mustache['render'](_0x43c9f1,_[_0x0e2f('0x27')](_0x4a961c[_0x0e2f('0x28')],{'contact':_0x4a961c[_0x0e2f('0x29')],'message':_0x4a961c[_0x0e2f('0x2a')],'agent':_0x4a961c[_0x0e2f('0x2b')],'interaction':_0x4a961c[_0x0e2f('0x2c')],'account':_0x4a961c[_0x0e2f('0x2d')]}))||'';}exports[_0x0e2f('0x2e')]=function(_0x5ccd0f,_0x4577c2){var _0x32fb1a={},_0x27d8b9={},_0x2200d1={'count':0x0,'rows':[]};var _0x4f0289=_[_0x0e2f('0x2f')](db['SquareMessage']['rawAttributes'],function(_0x53f0bb){return{'name':_0x53f0bb[_0x0e2f('0x30')],'type':_0x53f0bb[_0x0e2f('0x31')][_0x0e2f('0x32')]};});_0x27d8b9[_0x0e2f('0x33')]=_['map'](_0x4f0289,_0x0e2f('0x25'));_0x27d8b9['query']=_[_0x0e2f('0x34')](_0x5ccd0f['query']);_0x27d8b9[_0x0e2f('0x35')]=_[_0x0e2f('0x36')](_0x27d8b9[_0x0e2f('0x33')],_0x27d8b9[_0x0e2f('0x37')]);_0x32fb1a[_0x0e2f('0x38')]=_[_0x0e2f('0x36')](_0x27d8b9[_0x0e2f('0x33')],qs[_0x0e2f('0x39')](_0x5ccd0f[_0x0e2f('0x37')][_0x0e2f('0x39')]));_0x32fb1a[_0x0e2f('0x38')]=_0x32fb1a[_0x0e2f('0x38')][_0x0e2f('0x3a')]?_0x32fb1a['attributes']:_0x27d8b9[_0x0e2f('0x33')];if(!_0x5ccd0f[_0x0e2f('0x37')][_0x0e2f('0x3b')](_0x0e2f('0x3c'))){_0x32fb1a[_0x0e2f('0x1b')]=qs[_0x0e2f('0x1b')](_0x5ccd0f['query'][_0x0e2f('0x1b')]);_0x32fb1a[_0x0e2f('0x19')]=qs[_0x0e2f('0x19')](_0x5ccd0f[_0x0e2f('0x37')][_0x0e2f('0x19')]);}_0x32fb1a['order']=qs[_0x0e2f('0x3d')](_0x5ccd0f[_0x0e2f('0x37')][_0x0e2f('0x3d')]);_0x32fb1a[_0x0e2f('0x3e')]=qs[_0x0e2f('0x35')](_[_0x0e2f('0x3f')](_0x5ccd0f[_0x0e2f('0x37')],_0x27d8b9[_0x0e2f('0x35')]),_0x4f0289);if(_0x5ccd0f['query'][_0x0e2f('0x40')]){_0x32fb1a[_0x0e2f('0x3e')]=_[_0x0e2f('0x27')](_0x32fb1a[_0x0e2f('0x3e')],{'$or':_['map'](_0x4f0289,function(_0x6c3d60){if(_0x6c3d60['type']!==_0x0e2f('0x41')){var _0x32df72={};_0x32df72[_0x6c3d60[_0x0e2f('0x25')]]={'$like':'%'+_0x5ccd0f[_0x0e2f('0x37')][_0x0e2f('0x40')]+'%'};return _0x32df72;}})});}_0x32fb1a=_[_0x0e2f('0x27')]({},_0x32fb1a,_0x5ccd0f[_0x0e2f('0x42')]);var _0x1bd909={'where':_0x32fb1a[_0x0e2f('0x3e')]};return db[_0x0e2f('0x43')]['count'](_0x1bd909)[_0x0e2f('0x20')](function(_0x1068b7){_0x2200d1[_0x0e2f('0x1c')]=_0x1068b7;if(_0x5ccd0f[_0x0e2f('0x37')][_0x0e2f('0x44')]){_0x32fb1a[_0x0e2f('0x45')]=[{'all':!![]}];}return db[_0x0e2f('0x43')]['findAll'](_0x32fb1a);})[_0x0e2f('0x20')](function(_0x580f1c){_0x2200d1['rows']=_0x580f1c;return _0x2200d1;})[_0x0e2f('0x20')](respondWithFilteredResult(_0x4577c2,_0x32fb1a))['catch'](handleError(_0x4577c2,null));};exports[_0x0e2f('0x46')]=function(_0xfe593d,_0x32fdfe){var _0x795db={'raw':!![],'where':{'id':_0xfe593d['params']['id']}},_0x3f810b={};_0x3f810b[_0x0e2f('0x33')]=_[_0x0e2f('0x34')](db[_0x0e2f('0x43')][_0x0e2f('0x47')]);_0x3f810b['query']=_[_0x0e2f('0x34')](_0xfe593d[_0x0e2f('0x37')]);_0x3f810b['filters']=_['intersection'](_0x3f810b[_0x0e2f('0x33')],_0x3f810b[_0x0e2f('0x37')]);_0x795db[_0x0e2f('0x38')]=_[_0x0e2f('0x36')](_0x3f810b[_0x0e2f('0x33')],qs[_0x0e2f('0x39')](_0xfe593d[_0x0e2f('0x37')][_0x0e2f('0x39')]));_0x795db[_0x0e2f('0x38')]=_0x795db[_0x0e2f('0x38')][_0x0e2f('0x3a')]?_0x795db[_0x0e2f('0x38')]:_0x3f810b[_0x0e2f('0x33')];if(_0xfe593d[_0x0e2f('0x37')][_0x0e2f('0x44')]){_0x795db[_0x0e2f('0x45')]=[{'all':!![]}];}_0x795db=_['merge']({},_0x795db,_0xfe593d[_0x0e2f('0x42')]);return db['SquareMessage'][_0x0e2f('0x48')](_0x795db)[_0x0e2f('0x20')](handleEntityNotFound(_0x32fdfe,null))['then'](respondWithResult(_0x32fdfe,null))[_0x0e2f('0x49')](handleError(_0x32fdfe,null));};exports[_0x0e2f('0x4a')]=function(_0x5d872b,_0xa4c4ac){return db[_0x0e2f('0x43')]['create'](_0x5d872b[_0x0e2f('0x28')],{})[_0x0e2f('0x20')](respondWithResult(_0xa4c4ac,0xc9))[_0x0e2f('0x49')](handleError(_0xa4c4ac,null));};exports[_0x0e2f('0x4b')]=function(_0x513d9a,_0x324474){if(_0x513d9a[_0x0e2f('0x28')]['id']){delete _0x513d9a[_0x0e2f('0x28')]['id'];}return db[_0x0e2f('0x43')][_0x0e2f('0x48')]({'where':{'id':_0x513d9a[_0x0e2f('0x4c')]['id']}})[_0x0e2f('0x20')](handleEntityNotFound(_0x324474,null))[_0x0e2f('0x20')](saveUpdates(_0x513d9a[_0x0e2f('0x28')],null))[_0x0e2f('0x20')](respondWithResult(_0x324474,null))[_0x0e2f('0x49')](handleError(_0x324474,null));};exports[_0x0e2f('0x21')]=function(_0x1edcdb,_0x4ea56b){return db[_0x0e2f('0x43')][_0x0e2f('0x48')]({'where':{'id':_0x1edcdb[_0x0e2f('0x4c')]['id']}})[_0x0e2f('0x20')](handleEntityNotFound(_0x4ea56b,null))['then'](removeEntity(_0x4ea56b,null))[_0x0e2f('0x49')](handleError(_0x4ea56b,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 5c9d168..08d7451 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 _0x0943=['path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0943,0x1a8));var _0x3094=function(_0xfd886a,_0x148bdc){_0xfd886a=_0xfd886a-0x0;var _0x29efb6=_0x0943[_0xfd886a];return _0x29efb6;};'use strict';var _=require(_0x3094('0x0'));var util=require(_0x3094('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3094('0x2'));var BPromise=require(_0x3094('0x3'));var rp=require(_0x3094('0x4'));var fs=require('fs');var path=require(_0x3094('0x5'));var rimraf=require(_0x3094('0x6'));var config=require(_0x3094('0x7'));var attributes=require(_0x3094('0x8'));module[_0x3094('0x9')]=function(_0x597770,_0x42180c){return _0x597770[_0x3094('0xa')](_0x3094('0xb'),attributes,{'tableName':_0x3094('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cb3=['bluebird','request-promise','path','./squareMessage.attributes','exports','define','square_messages','lodash','util','api','moment'];(function(_0xc0caf6,_0x31cb91){var _0x2b8267=function(_0xbeb348){while(--_0xbeb348){_0xc0caf6['push'](_0xc0caf6['shift']());}};_0x2b8267(++_0x31cb91);}(_0x8cb3,0xd8));var _0x38cb=function(_0x3c1b11,_0x49d483){_0x3c1b11=_0x3c1b11-0x0;var _0x40687c=_0x8cb3[_0x3c1b11];return _0x40687c;};'use strict';var _=require(_0x38cb('0x0'));var util=require(_0x38cb('0x1'));var logger=require('../../config/logger')(_0x38cb('0x2'));var moment=require(_0x38cb('0x3'));var BPromise=require(_0x38cb('0x4'));var rp=require(_0x38cb('0x5'));var fs=require('fs');var path=require(_0x38cb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x38cb('0x7'));module[_0x38cb('0x8')]=function(_0x4a2b88,_0x450d6c){return _0x4a2b88[_0x38cb('0x9')]('SquareMessage',attributes,{'tableName':_0x38cb('0xa'),'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 baa80a0..ad21cfa 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x2bdfa5,_0x572115){var _0x17977b=function(_0x336757){while(--_0x336757){_0x2bdfa5['push'](_0x2bdfa5['shift']());}};_0x17977b(++_0x572115);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x77ee3b,_0x301d48){var _0x125afd=function(_0x2bd18e){while(--_0x2bd18e){_0x77ee3b['push'](_0x77ee3b['shift']());}};_0x125afd(++_0x301d48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index bee8b5e..4f7c46a 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 _0x53c1=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./squareOdbc.controller','get','isAuthenticated','index','show','15s','test','create','put','/:id','update'];(function(_0x349b17,_0x2ecaff){var _0x2065ba=function(_0xd72954){while(--_0xd72954){_0x349b17['push'](_0x349b17['shift']());}};_0x2065ba(++_0x2ecaff);}(_0x53c1,0xc7));var _0x153c=function(_0x25291b,_0x20f31e){_0x25291b=_0x25291b-0x0;var _0xde4ae2=_0x53c1[_0x25291b];return _0xde4ae2;};'use strict';var multer=require(_0x153c('0x0'));var util=require('util');var path=require(_0x153c('0x1'));var timeout=require(_0x153c('0x2'));var express=require(_0x153c('0x3'));var router=express[_0x153c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x153c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x153c('0x6'));router[_0x153c('0x7')]('/',auth[_0x153c('0x8')](),controller[_0x153c('0x9')]);router[_0x153c('0x7')]('/:id',auth[_0x153c('0x8')](),controller[_0x153c('0xa')]);router['get']('/:id/test',auth[_0x153c('0x8')](),timeout(_0x153c('0xb')),controller[_0x153c('0xc')]);router['post']('/',auth[_0x153c('0x8')](),controller[_0x153c('0xd')]);router[_0x153c('0xe')](_0x153c('0xf'),auth['isAuthenticated'](),controller[_0x153c('0x10')]);router['delete'](_0x153c('0xf'),auth[_0x153c('0x8')](),controller['destroy']);module[_0x153c('0x11')]=router; \ No newline at end of file +var _0x3365=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','/:id/test','15s','test','post','put','update','delete','destroy'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3365,0xfd));var _0x5336=function(_0x4dfb65,_0x455784){_0x4dfb65=_0x4dfb65-0x0;var _0x1c7674=_0x3365[_0x4dfb65];return _0x1c7674;};'use strict';var multer=require('multer');var util=require(_0x5336('0x0'));var path=require('path');var timeout=require(_0x5336('0x1'));var express=require('express');var router=express[_0x5336('0x2')]();var fs_extra=require(_0x5336('0x3'));var auth=require(_0x5336('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x5336('0x5')]('/',auth[_0x5336('0x6')](),controller['index']);router[_0x5336('0x5')](_0x5336('0x7'),auth[_0x5336('0x6')](),controller[_0x5336('0x8')]);router['get'](_0x5336('0x9'),auth[_0x5336('0x6')](),timeout(_0x5336('0xa')),controller[_0x5336('0xb')]);router[_0x5336('0xc')]('/',auth[_0x5336('0x6')](),controller['create']);router[_0x5336('0xd')]('/:id',auth[_0x5336('0x6')](),controller[_0x5336('0xe')]);router[_0x5336('0xf')](_0x5336('0x7'),auth[_0x5336('0x6')](),controller[_0x5336('0x10')]);module[_0x5336('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 979b189..c3d232d 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 _0x0d9f=['exports','STRING'];(function(_0x11e483,_0x34c7f4){var _0x150783=function(_0x31e33e){while(--_0x31e33e){_0x11e483['push'](_0x11e483['shift']());}};_0x150783(++_0x34c7f4);}(_0x0d9f,0x15e));var _0xf0d9=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0x0d9f[_0x42bafd];return _0x2ed705;};'use strict';var Sequelize=require('sequelize');module[_0xf0d9('0x0')]={'name':{'type':Sequelize[_0xf0d9('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xf0d9('0x1')]},'description':{'type':Sequelize[_0xf0d9('0x1')]}}; \ No newline at end of file +var _0xa9fc=['exports','STRING','sequelize'];(function(_0x4081c1,_0x4eb370){var _0x1b371c=function(_0x4fdd53){while(--_0x4fdd53){_0x4081c1['push'](_0x4081c1['shift']());}};_0x1b371c(++_0x4eb370);}(_0xa9fc,0x17c));var _0xca9f=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0xa9fc[_0x3c4a7c];return _0xf13d1e;};'use strict';var Sequelize=require(_0xca9f('0x0'));module[_0xca9f('0x1')]={'name':{'type':Sequelize[_0xca9f('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xca9f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 256b16c..270bfbf 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 _0x1db9=['type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','ODBC','error','name','send','render','merge','body','contact','message','agent','interaction','account','map','SquareOdbc','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x1fe288,_0x381b6a){var _0x140bde=function(_0x41f12c){while(--_0x41f12c){_0x1fe288['push'](_0x1fe288['shift']());}};_0x140bde(++_0x381b6a);}(_0x1db9,0x176));var _0x91db=function(_0x1cdf66,_0x48ff84){_0x1cdf66=_0x1cdf66-0x0;var _0x3551c1=_0x1db9[_0x1cdf66];return _0x3551c1;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=typeof _0x33b39d[_0x91db('0x19')]===_0x91db('0x1a')&&typeof _0x33b39d[_0x91db('0x1b')]===_0x91db('0x1a');var _0x5f5440=_0x260b56[_0x91db('0x1c')];var _0x23d125=_0x143bc4?0x0:_0x33b39d[_0x91db('0x19')];var _0x42e66c=_0x143bc4?_0x260b56[_0x91db('0x1c')]:_0x33b39d[_0x91db('0x19')]+_0x33b39d['limit'];var _0x4ae820;if(_0x42e66c>=_0x5f5440){_0x42e66c=_0x5f5440;_0x4ae820=0xc8;}else{_0x4ae820=0xce;}_0x2df307[_0x91db('0x16')](_0x4ae820);return _0x2df307[_0x91db('0x1d')](_0x91db('0x1e'),_0x23d125+'-'+_0x42e66c+'/'+_0x5f5440)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x50cf9c){return function(_0x168dea){try{jsonpatch[_0x91db('0x1f')](_0x168dea,_0x50cf9c,!![]);}catch(_0x6e3ca6){return BPromise[_0x91db('0x20')](_0x6e3ca6);}return _0x168dea[_0x91db('0x21')]();};}function saveUpdates(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x22')](_0x31b96c)[_0x91db('0x23')](function(_0x554454){return _0x554454;});}return null;};}function removeEntity(_0x58774f,_0x134caa){return function(_0x2ac8d5){if(_0x2ac8d5){return _0x2ac8d5['destroy']()[_0x91db('0x23')](function(){var _0x16efa4=_0x2ac8d5[_0x91db('0x24')]({'plain':!![]});var _0x6e3a9c=_0x91db('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x6e3a9c,'resourceId':_0x16efa4['id']}})[_0x91db('0x23')](function(){return _0x2ac8d5;});})[_0x91db('0x23')](function(){_0x58774f[_0x91db('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b38f2,_0x3c31ea){return function(_0x46c0e8){if(!_0x46c0e8){_0x3b38f2[_0x91db('0x15')](0x194);}return _0x46c0e8;};}function handleError(_0x512c79,_0x1a64f0){_0x1a64f0=_0x1a64f0||0x1f4;return function(_0x2a00d1){logger[_0x91db('0x26')](_0x2a00d1['stack']);if(_0x2a00d1[_0x91db('0x27')]){delete _0x2a00d1[_0x91db('0x27')];}_0x512c79[_0x91db('0x16')](_0x1a64f0)[_0x91db('0x28')](_0x2a00d1);};}function getMustacheRender(_0x1cf61c,_0x1e865e){return Mustache[_0x91db('0x29')](_0x1cf61c,_[_0x91db('0x2a')](_0x1e865e[_0x91db('0x2b')],{'contact':_0x1e865e[_0x91db('0x2c')],'message':_0x1e865e[_0x91db('0x2d')],'agent':_0x1e865e[_0x91db('0x2e')],'interaction':_0x1e865e[_0x91db('0x2f')],'account':_0x1e865e[_0x91db('0x30')]}))||'';}exports['index']=function(_0x37689d,_0x1368b9){var _0x73d4f4={},_0x431bf6={},_0x370934={'count':0x0,'rows':[]};var _0x593920=_[_0x91db('0x31')](db[_0x91db('0x32')][_0x91db('0x33')],function(_0x4fada9){return{'name':_0x4fada9[_0x91db('0x34')],'type':_0x4fada9['type'][_0x91db('0x35')]};});_0x431bf6[_0x91db('0x36')]=_[_0x91db('0x31')](_0x593920,_0x91db('0x27'));_0x431bf6['query']=_[_0x91db('0x37')](_0x37689d[_0x91db('0x38')]);_0x431bf6[_0x91db('0x39')]=_['intersection'](_0x431bf6[_0x91db('0x36')],_0x431bf6[_0x91db('0x38')]);_0x73d4f4['attributes']=_[_0x91db('0x3a')](_0x431bf6[_0x91db('0x36')],qs['fields'](_0x37689d[_0x91db('0x38')]['fields']));_0x73d4f4[_0x91db('0x3b')]=_0x73d4f4[_0x91db('0x3b')]['length']?_0x73d4f4['attributes']:_0x431bf6['model'];if(!_0x37689d[_0x91db('0x38')][_0x91db('0x3c')]('nolimit')){_0x73d4f4[_0x91db('0x1b')]=qs[_0x91db('0x1b')](_0x37689d[_0x91db('0x38')][_0x91db('0x1b')]);_0x73d4f4[_0x91db('0x19')]=qs[_0x91db('0x19')](_0x37689d[_0x91db('0x38')][_0x91db('0x19')]);}_0x73d4f4[_0x91db('0x3d')]=qs[_0x91db('0x3e')](_0x37689d[_0x91db('0x38')]['sort']);_0x73d4f4[_0x91db('0x3f')]=qs['filters'](_[_0x91db('0x40')](_0x37689d[_0x91db('0x38')],_0x431bf6['filters']),_0x593920);if(_0x37689d[_0x91db('0x38')][_0x91db('0x41')]){_0x73d4f4[_0x91db('0x3f')]=_[_0x91db('0x2a')](_0x73d4f4[_0x91db('0x3f')],{'$or':_['map'](_0x593920,function(_0x2254af){if(_0x2254af[_0x91db('0x42')]!==_0x91db('0x43')){var _0x55188b={};_0x55188b[_0x2254af[_0x91db('0x27')]]={'$like':'%'+_0x37689d[_0x91db('0x38')][_0x91db('0x41')]+'%'};return _0x55188b;}})});}_0x73d4f4=_['merge']({},_0x73d4f4,_0x37689d[_0x91db('0x44')]);var _0x2b7830={'where':_0x73d4f4[_0x91db('0x3f')]};return db[_0x91db('0x32')][_0x91db('0x1c')](_0x2b7830)['then'](function(_0x4dcdad){_0x370934['count']=_0x4dcdad;if(_0x37689d[_0x91db('0x38')][_0x91db('0x45')]){_0x73d4f4[_0x91db('0x46')]=[{'all':!![]}];}return db[_0x91db('0x32')][_0x91db('0x47')](_0x73d4f4);})[_0x91db('0x23')](function(_0x2b1fef){_0x370934[_0x91db('0x48')]=_0x2b1fef;return _0x370934;})[_0x91db('0x23')](respondWithFilteredResult(_0x1368b9,_0x73d4f4))[_0x91db('0x49')](handleError(_0x1368b9,null));};exports[_0x91db('0x4a')]=function(_0x4aa644,_0x546940){var _0x44ca29={'raw':!![],'where':{'id':_0x4aa644[_0x91db('0x4b')]['id']}},_0x45742d={};_0x45742d['model']=_[_0x91db('0x37')](db[_0x91db('0x32')][_0x91db('0x33')]);_0x45742d[_0x91db('0x38')]=_[_0x91db('0x37')](_0x4aa644['query']);_0x45742d[_0x91db('0x39')]=_['intersection'](_0x45742d[_0x91db('0x36')],_0x45742d[_0x91db('0x38')]);_0x44ca29[_0x91db('0x3b')]=_[_0x91db('0x3a')](_0x45742d[_0x91db('0x36')],qs[_0x91db('0x4c')](_0x4aa644[_0x91db('0x38')][_0x91db('0x4c')]));_0x44ca29[_0x91db('0x3b')]=_0x44ca29['attributes']['length']?_0x44ca29[_0x91db('0x3b')]:_0x45742d[_0x91db('0x36')];if(_0x4aa644[_0x91db('0x38')][_0x91db('0x45')]){_0x44ca29[_0x91db('0x46')]=[{'all':!![]}];}_0x44ca29=_['merge']({},_0x44ca29,_0x4aa644[_0x91db('0x44')]);return db[_0x91db('0x32')][_0x91db('0x4d')](_0x44ca29)[_0x91db('0x23')](handleEntityNotFound(_0x546940,null))[_0x91db('0x23')](respondWithResult(_0x546940,null))['catch'](handleError(_0x546940,null));};exports[_0x91db('0x4e')]=function(_0x1da3dc,_0xb60404){return db[_0x91db('0x32')][_0x91db('0x4e')](_0x1da3dc[_0x91db('0x2b')],{})['then'](function(_0x561e4a){var _0x132fb5=_0x1da3dc['user'][_0x91db('0x24')]({'plain':!![]});if(!_0x132fb5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x132fb5['role']===_0x91db('0x4f')){var _0x371277=_0x561e4a[_0x91db('0x24')]({'plain':!![]});var _0x515bd5=_0x91db('0x25');return db[_0x91db('0x50')][_0x91db('0x4d')]({'where':{'name':_0x515bd5,'userProfileId':_0x132fb5['userProfileId']},'raw':!![]})['then'](function(_0x173d3e){if(_0x173d3e&&_0x173d3e[_0x91db('0x51')]===0x0){return db['UserProfileResource'][_0x91db('0x4e')]({'name':_0x371277['name'],'resourceId':_0x371277['id'],'type':_0x173d3e[_0x91db('0x27')],'sectionId':_0x173d3e['id']},{})[_0x91db('0x23')](function(){return _0x561e4a;});}else{return _0x561e4a;}})[_0x91db('0x49')](function(_0x6744b7){logger['error'](_0x91db('0x52'),_0x6744b7);throw _0x6744b7;});}return _0x561e4a;})[_0x91db('0x23')](respondWithResult(_0xb60404,0xc9))[_0x91db('0x49')](handleError(_0xb60404,null));};exports[_0x91db('0x22')]=function(_0xf513f6,_0x3c8dec){if(_0xf513f6[_0x91db('0x2b')]['id']){delete _0xf513f6[_0x91db('0x2b')]['id'];}return db[_0x91db('0x32')][_0x91db('0x4d')]({'where':{'id':_0xf513f6['params']['id']}})[_0x91db('0x23')](handleEntityNotFound(_0x3c8dec,null))[_0x91db('0x23')](saveUpdates(_0xf513f6[_0x91db('0x2b')],null))[_0x91db('0x23')](respondWithResult(_0x3c8dec,null))[_0x91db('0x49')](handleError(_0x3c8dec,null));};exports['destroy']=function(_0x3d3c34,_0x5a90e2){return db[_0x91db('0x32')][_0x91db('0x4d')]({'where':{'id':_0x3d3c34['params']['id']}})['then'](handleEntityNotFound(_0x5a90e2,null))[_0x91db('0x23')](removeEntity(_0x5a90e2,null))[_0x91db('0x49')](handleError(_0x5a90e2,null));};exports[_0x91db('0x53')]=function(_0x51324a,_0x14a150,_0x99ee11){var _0x1fb402;return db[_0x91db('0x32')][_0x91db('0x4d')]({'where':{'id':_0x51324a[_0x91db('0x4b')]['id']},'attributes':['id','dsn']})[_0x91db('0x23')](handleEntityNotFound(_0x14a150,null))[_0x91db('0x23')](function(_0x335b44){if(_0x335b44){var _0x25a71b=require(_0x91db('0x54'))();_0x25a71b[_0x91db('0x55')](_0x335b44[_0x91db('0x56')]);_0x25a71b[_0x91db('0x57')]();return _0x335b44;}})[_0x91db('0x23')](respondWithResult(_0x14a150,null))[_0x91db('0x49')](handleError(_0x14a150,null));}; \ No newline at end of file +var _0xe181=['get','ODBC','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','render','merge','body','contact','message','agent','account','index','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','options','SquareOdbc','findAll','rows','params','rawAttributes','includeAll','include','find','catch','create','user'];(function(_0x12ff93,_0x22c56b){var _0x394c42=function(_0x3466f6){while(--_0x3466f6){_0x12ff93['push'](_0x12ff93['shift']());}};_0x394c42(++_0x22c56b);}(_0xe181,0x68));var _0x1e18=function(_0x477aab,_0x4d08fd){_0x477aab=_0x477aab-0x0;var _0x2cd294=_0xe181[_0x477aab];return _0x2cd294;};'use strict';var emlformat=require(_0x1e18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e18('0x1'));var jsonpatch=require(_0x1e18('0x2'));var rp=require(_0x1e18('0x3'));var moment=require(_0x1e18('0x4'));var BPromise=require(_0x1e18('0x5'));var Mustache=require(_0x1e18('0x6'));var util=require(_0x1e18('0x7'));var path=require('path');var sox=require(_0x1e18('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e18('0x9'));var _=require(_0x1e18('0xa'));var squel=require(_0x1e18('0xb'));var crypto=require(_0x1e18('0xc'));var jsforce=require(_0x1e18('0xd'));var deskjs=require(_0x1e18('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1e18('0xf'));var Papa=require(_0x1e18('0x10'));var Redis=require(_0x1e18('0x11'));var authService=require(_0x1e18('0x12'));var qs=require(_0x1e18('0x13'));var as=require(_0x1e18('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e18('0x15'))(_0x1e18('0x16'));var utils=require(_0x1e18('0x17'));var config=require(_0x1e18('0x18'));var licenseUtil=require(_0x1e18('0x19'));var db=require(_0x1e18('0x1a'))['db'];function respondWithStatusCode(_0x1743c3,_0x33a98d){_0x33a98d=_0x33a98d||0xcc;return function(_0x531e1b){if(_0x531e1b){return _0x1743c3[_0x1e18('0x1b')](_0x33a98d);}return _0x1743c3['status'](_0x33a98d)[_0x1e18('0x1c')]();};}function respondWithResult(_0x563eff,_0x404b7f){_0x404b7f=_0x404b7f||0xc8;return function(_0x36b583){if(_0x36b583){return _0x563eff[_0x1e18('0x1d')](_0x404b7f)[_0x1e18('0x1e')](_0x36b583);}};}function respondWithFilteredResult(_0x1687ba,_0x1e1ce6){return function(_0x39bc56){if(_0x39bc56){var _0x33fea1=typeof _0x1e1ce6[_0x1e18('0x1f')]===_0x1e18('0x20')&&typeof _0x1e1ce6[_0x1e18('0x21')]===_0x1e18('0x20');var _0x349f3c=_0x39bc56[_0x1e18('0x22')];var _0x21b851=_0x33fea1?0x0:_0x1e1ce6['offset'];var _0x1c91d2=_0x33fea1?_0x39bc56[_0x1e18('0x22')]:_0x1e1ce6[_0x1e18('0x1f')]+_0x1e1ce6[_0x1e18('0x21')];var _0x2834ee;if(_0x1c91d2>=_0x349f3c){_0x1c91d2=_0x349f3c;_0x2834ee=0xc8;}else{_0x2834ee=0xce;}_0x1687ba[_0x1e18('0x1d')](_0x2834ee);return _0x1687ba[_0x1e18('0x23')](_0x1e18('0x24'),_0x21b851+'-'+_0x1c91d2+'/'+_0x349f3c)[_0x1e18('0x1e')](_0x39bc56);}return null;};}function patchUpdates(_0x22baca){return function(_0x2489c3){try{jsonpatch[_0x1e18('0x25')](_0x2489c3,_0x22baca,!![]);}catch(_0x3c4fdf){return BPromise[_0x1e18('0x26')](_0x3c4fdf);}return _0x2489c3[_0x1e18('0x27')]();};}function saveUpdates(_0x975df0,_0x3fd0a7){return function(_0x5eb6b4){if(_0x5eb6b4){return _0x5eb6b4[_0x1e18('0x28')](_0x975df0)[_0x1e18('0x29')](function(_0x3e9b2c){return _0x3e9b2c;});}return null;};}function removeEntity(_0x52d5e2,_0xf74622){return function(_0xdda2ce){if(_0xdda2ce){return _0xdda2ce[_0x1e18('0x2a')]()[_0x1e18('0x29')](function(){var _0x4c4309=_0xdda2ce['get']({'plain':!![]});var _0x6fa4db='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x6fa4db,'resourceId':_0x4c4309['id']}})[_0x1e18('0x29')](function(){return _0xdda2ce;});})[_0x1e18('0x29')](function(){_0x52d5e2[_0x1e18('0x1d')](0xcc)[_0x1e18('0x1c')]();});}};}function handleEntityNotFound(_0x3a95c1,_0x38fca8){return function(_0x167f67){if(!_0x167f67){_0x3a95c1[_0x1e18('0x1b')](0x194);}return _0x167f67;};}function handleError(_0xa0f951,_0x193e7b){_0x193e7b=_0x193e7b||0x1f4;return function(_0x1015a3){logger[_0x1e18('0x2b')](_0x1015a3[_0x1e18('0x2c')]);if(_0x1015a3[_0x1e18('0x2d')]){delete _0x1015a3['name'];}_0xa0f951[_0x1e18('0x1d')](_0x193e7b)['send'](_0x1015a3);};}function getMustacheRender(_0x441f85,_0x1baf4f){return Mustache[_0x1e18('0x2e')](_0x441f85,_[_0x1e18('0x2f')](_0x1baf4f[_0x1e18('0x30')],{'contact':_0x1baf4f[_0x1e18('0x31')],'message':_0x1baf4f[_0x1e18('0x32')],'agent':_0x1baf4f[_0x1e18('0x33')],'interaction':_0x1baf4f['interaction'],'account':_0x1baf4f[_0x1e18('0x34')]}))||'';}exports[_0x1e18('0x35')]=function(_0x5d4df9,_0xd83059){var _0x29a6c8={},_0x415d7b={},_0x4cf595={'count':0x0,'rows':[]};var _0x40fd04=_['map'](db['SquareOdbc']['rawAttributes'],function(_0xa4fe9e){return{'name':_0xa4fe9e['fieldName'],'type':_0xa4fe9e[_0x1e18('0x36')][_0x1e18('0x37')]};});_0x415d7b[_0x1e18('0x38')]=_['map'](_0x40fd04,'name');_0x415d7b[_0x1e18('0x39')]=_[_0x1e18('0x3a')](_0x5d4df9[_0x1e18('0x39')]);_0x415d7b[_0x1e18('0x3b')]=_[_0x1e18('0x3c')](_0x415d7b[_0x1e18('0x38')],_0x415d7b[_0x1e18('0x39')]);_0x29a6c8[_0x1e18('0x3d')]=_[_0x1e18('0x3c')](_0x415d7b[_0x1e18('0x38')],qs[_0x1e18('0x3e')](_0x5d4df9[_0x1e18('0x39')]['fields']));_0x29a6c8['attributes']=_0x29a6c8[_0x1e18('0x3d')][_0x1e18('0x3f')]?_0x29a6c8[_0x1e18('0x3d')]:_0x415d7b['model'];if(!_0x5d4df9[_0x1e18('0x39')]['hasOwnProperty'](_0x1e18('0x40'))){_0x29a6c8['limit']=qs['limit'](_0x5d4df9[_0x1e18('0x39')][_0x1e18('0x21')]);_0x29a6c8[_0x1e18('0x1f')]=qs[_0x1e18('0x1f')](_0x5d4df9[_0x1e18('0x39')][_0x1e18('0x1f')]);}_0x29a6c8['order']=qs[_0x1e18('0x41')](_0x5d4df9[_0x1e18('0x39')][_0x1e18('0x41')]);_0x29a6c8[_0x1e18('0x42')]=qs['filters'](_[_0x1e18('0x43')](_0x5d4df9['query'],_0x415d7b[_0x1e18('0x3b')]),_0x40fd04);if(_0x5d4df9[_0x1e18('0x39')]['filter']){_0x29a6c8[_0x1e18('0x42')]=_[_0x1e18('0x2f')](_0x29a6c8['where'],{'$or':_['map'](_0x40fd04,function(_0x511214){if(_0x511214[_0x1e18('0x36')]!==_0x1e18('0x44')){var _0x12945d={};_0x12945d[_0x511214[_0x1e18('0x2d')]]={'$like':'%'+_0x5d4df9[_0x1e18('0x39')][_0x1e18('0x45')]+'%'};return _0x12945d;}})});}_0x29a6c8=_[_0x1e18('0x2f')]({},_0x29a6c8,_0x5d4df9[_0x1e18('0x46')]);var _0x1cae7e={'where':_0x29a6c8[_0x1e18('0x42')]};return db[_0x1e18('0x47')]['count'](_0x1cae7e)[_0x1e18('0x29')](function(_0x5cc2e5){_0x4cf595[_0x1e18('0x22')]=_0x5cc2e5;if(_0x5d4df9[_0x1e18('0x39')]['includeAll']){_0x29a6c8['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x1e18('0x48')](_0x29a6c8);})[_0x1e18('0x29')](function(_0x4dc5eb){_0x4cf595[_0x1e18('0x49')]=_0x4dc5eb;return _0x4cf595;})[_0x1e18('0x29')](respondWithFilteredResult(_0xd83059,_0x29a6c8))['catch'](handleError(_0xd83059,null));};exports['show']=function(_0x171f7f,_0x36c1d8){var _0x25575e={'raw':!![],'where':{'id':_0x171f7f[_0x1e18('0x4a')]['id']}},_0x1d6ab5={};_0x1d6ab5[_0x1e18('0x38')]=_[_0x1e18('0x3a')](db[_0x1e18('0x47')][_0x1e18('0x4b')]);_0x1d6ab5[_0x1e18('0x39')]=_['keys'](_0x171f7f['query']);_0x1d6ab5[_0x1e18('0x3b')]=_[_0x1e18('0x3c')](_0x1d6ab5[_0x1e18('0x38')],_0x1d6ab5[_0x1e18('0x39')]);_0x25575e[_0x1e18('0x3d')]=_[_0x1e18('0x3c')](_0x1d6ab5[_0x1e18('0x38')],qs['fields'](_0x171f7f['query']['fields']));_0x25575e[_0x1e18('0x3d')]=_0x25575e[_0x1e18('0x3d')][_0x1e18('0x3f')]?_0x25575e[_0x1e18('0x3d')]:_0x1d6ab5[_0x1e18('0x38')];if(_0x171f7f[_0x1e18('0x39')][_0x1e18('0x4c')]){_0x25575e[_0x1e18('0x4d')]=[{'all':!![]}];}_0x25575e=_[_0x1e18('0x2f')]({},_0x25575e,_0x171f7f[_0x1e18('0x46')]);return db[_0x1e18('0x47')][_0x1e18('0x4e')](_0x25575e)[_0x1e18('0x29')](handleEntityNotFound(_0x36c1d8,null))[_0x1e18('0x29')](respondWithResult(_0x36c1d8,null))[_0x1e18('0x4f')](handleError(_0x36c1d8,null));};exports[_0x1e18('0x50')]=function(_0x45363c,_0x1540f4){return db[_0x1e18('0x47')][_0x1e18('0x50')](_0x45363c['body'],{})[_0x1e18('0x29')](function(_0x17a8ac){var _0x215aa2=_0x45363c[_0x1e18('0x51')][_0x1e18('0x52')]({'plain':!![]});if(!_0x215aa2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x215aa2['role']===_0x1e18('0x51')){var _0x30dc06=_0x17a8ac['get']({'plain':!![]});var _0x3194db=_0x1e18('0x53');return db[_0x1e18('0x54')]['find']({'where':{'name':_0x3194db,'userProfileId':_0x215aa2[_0x1e18('0x55')]},'raw':!![]})[_0x1e18('0x29')](function(_0x4400d6){if(_0x4400d6&&_0x4400d6[_0x1e18('0x56')]===0x0){return db[_0x1e18('0x57')]['create']({'name':_0x30dc06[_0x1e18('0x2d')],'resourceId':_0x30dc06['id'],'type':_0x4400d6['name'],'sectionId':_0x4400d6['id']},{})['then'](function(){return _0x17a8ac;});}else{return _0x17a8ac;}})[_0x1e18('0x4f')](function(_0x6af9c0){logger[_0x1e18('0x2b')](_0x1e18('0x58'),_0x6af9c0);throw _0x6af9c0;});}return _0x17a8ac;})[_0x1e18('0x29')](respondWithResult(_0x1540f4,0xc9))[_0x1e18('0x4f')](handleError(_0x1540f4,null));};exports['update']=function(_0x23a320,_0x352282){if(_0x23a320[_0x1e18('0x30')]['id']){delete _0x23a320['body']['id'];}return db[_0x1e18('0x47')][_0x1e18('0x4e')]({'where':{'id':_0x23a320['params']['id']}})[_0x1e18('0x29')](handleEntityNotFound(_0x352282,null))['then'](saveUpdates(_0x23a320[_0x1e18('0x30')],null))[_0x1e18('0x29')](respondWithResult(_0x352282,null))[_0x1e18('0x4f')](handleError(_0x352282,null));};exports[_0x1e18('0x2a')]=function(_0x127af3,_0x31f349){return db[_0x1e18('0x47')][_0x1e18('0x4e')]({'where':{'id':_0x127af3['params']['id']}})[_0x1e18('0x29')](handleEntityNotFound(_0x31f349,null))[_0x1e18('0x29')](removeEntity(_0x31f349,null))['catch'](handleError(_0x31f349,null));};exports[_0x1e18('0x59')]=function(_0x57418e,_0x4deba0,_0x41b29a){var _0xc24ae8;return db[_0x1e18('0x47')][_0x1e18('0x4e')]({'where':{'id':_0x57418e['params']['id']},'attributes':['id',_0x1e18('0x5a')]})[_0x1e18('0x29')](handleEntityNotFound(_0x4deba0,null))[_0x1e18('0x29')](function(_0x52ed70){if(_0x52ed70){var _0x48bcc3=require(_0x1e18('0x5b'))();_0x48bcc3['openSync'](_0x52ed70['dsn']);_0x48bcc3[_0x1e18('0x5c')]();return _0x52ed70;}})[_0x1e18('0x29')](respondWithResult(_0x4deba0,null))[_0x1e18('0x4f')](handleError(_0x4deba0,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 58e9862..6767956 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 _0x87d5=['bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','../../config/logger','moment'];(function(_0x37a722,_0x1118a6){var _0x588deb=function(_0x3c0803){while(--_0x3c0803){_0x37a722['push'](_0x37a722['shift']());}};_0x588deb(++_0x1118a6);}(_0x87d5,0x6b));var _0x587d=function(_0x3cec15,_0x121af4){_0x3cec15=_0x3cec15-0x0;var _0x239080=_0x87d5[_0x3cec15];return _0x239080;};'use strict';var _=require(_0x587d('0x0'));var util=require('util');var logger=require(_0x587d('0x1'))('api');var moment=require(_0x587d('0x2'));var BPromise=require(_0x587d('0x3'));var rp=require(_0x587d('0x4'));var fs=require('fs');var path=require(_0x587d('0x5'));var rimraf=require('rimraf');var config=require(_0x587d('0x6'));var attributes=require(_0x587d('0x7'));module[_0x587d('0x8')]=function(_0x5c61bd,_0x2a3419){return _0x5c61bd[_0x587d('0x9')](_0x587d('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0268=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger'];(function(_0x538341,_0x58f916){var _0x20cb57=function(_0x5cbe8f){while(--_0x5cbe8f){_0x538341['push'](_0x538341['shift']());}};_0x20cb57(++_0x58f916);}(_0x0268,0x17e));var _0x8026=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x0268[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x8026('0x0'));var util=require('util');var logger=require(_0x8026('0x1'))(_0x8026('0x2'));var moment=require('moment');var BPromise=require(_0x8026('0x3'));var rp=require(_0x8026('0x4'));var fs=require('fs');var path=require(_0x8026('0x5'));var rimraf=require(_0x8026('0x6'));var config=require(_0x8026('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x8026('0x8')]=function(_0x7a8ba2,_0x589205){return _0x7a8ba2[_0x8026('0x9')](_0x8026('0xa'),attributes,{'tableName':_0x8026('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 35eda32..5c6e8dc 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x2e5a17,_0x558f0e){var _0x24f53d=function(_0x564eb5){while(--_0x564eb5){_0x2e5a17['push'](_0x2e5a17['shift']());}};_0x24f53d(++_0x558f0e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x5fc3[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x30861a,_0x337deb){var _0xa37ad6=function(_0x4dad90){while(--_0x4dad90){_0x30861a['push'](_0x30861a['shift']());}};_0xa37ad6(++_0x337deb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x5fc3[_0x533110];return _0xc3c866;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index bcdc1b6..c647c90 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 _0x2481=['/:id/users','getUsers','post','addUsers','put','delete','destroy','removeUsers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2481,0x153));var _0x1248=function(_0x571e32,_0x5a76be){_0x571e32=_0x571e32-0x0;var _0x1a4df3=_0x2481[_0x571e32];return _0x1a4df3;};'use strict';var multer=require(_0x1248('0x0'));var util=require(_0x1248('0x1'));var path=require('path');var timeout=require(_0x1248('0x2'));var express=require(_0x1248('0x3'));var router=express[_0x1248('0x4')]();var fs_extra=require(_0x1248('0x5'));var auth=require(_0x1248('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1248('0x7'));var controller=require(_0x1248('0x8'));router[_0x1248('0x9')]('/',auth[_0x1248('0xa')](),controller['index']);router[_0x1248('0x9')](_0x1248('0xb'),auth[_0x1248('0xa')](),controller[_0x1248('0xc')]);router[_0x1248('0x9')](_0x1248('0xd'),auth[_0x1248('0xa')](),controller[_0x1248('0xe')]);router[_0x1248('0xf')]('/',auth[_0x1248('0xa')](),controller['create']);router['post'](_0x1248('0xd'),auth['isAuthenticated'](),controller[_0x1248('0x10')]);router[_0x1248('0x11')](_0x1248('0xb'),auth[_0x1248('0xa')](),controller['update']);router[_0x1248('0x12')](_0x1248('0xb'),auth['isAuthenticated'](),controller[_0x1248('0x13')]);router['delete']('/:id/users',auth[_0x1248('0xa')](),controller[_0x1248('0x14')]);module[_0x1248('0x15')]=router; \ No newline at end of file +var _0xa44b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','put','update','delete','destroy','removeUsers','util','path','connect-timeout'];(function(_0x86e72b,_0x1b7e44){var _0x103792=function(_0x1bdf7e){while(--_0x1bdf7e){_0x86e72b['push'](_0x86e72b['shift']());}};_0x103792(++_0x1b7e44);}(_0xa44b,0xc3));var _0xba44=function(_0x19691f,_0x159737){_0x19691f=_0x19691f-0x0;var _0x5677b6=_0xa44b[_0x19691f];return _0x5677b6;};'use strict';var multer=require('multer');var util=require(_0xba44('0x0'));var path=require(_0xba44('0x1'));var timeout=require(_0xba44('0x2'));var express=require(_0xba44('0x3'));var router=express[_0xba44('0x4')]();var fs_extra=require(_0xba44('0x5'));var auth=require(_0xba44('0x6'));var interaction=require(_0xba44('0x7'));var config=require('../../config/environment');var controller=require(_0xba44('0x8'));router[_0xba44('0x9')]('/',auth[_0xba44('0xa')](),controller[_0xba44('0xb')]);router[_0xba44('0x9')](_0xba44('0xc'),auth['isAuthenticated'](),controller[_0xba44('0xd')]);router['get'](_0xba44('0xe'),auth[_0xba44('0xa')](),controller[_0xba44('0xf')]);router[_0xba44('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xba44('0x10')]('/:id/users',auth[_0xba44('0xa')](),controller['addUsers']);router[_0xba44('0x11')](_0xba44('0xc'),auth[_0xba44('0xa')](),controller[_0xba44('0x12')]);router[_0xba44('0x13')](_0xba44('0xc'),auth[_0xba44('0xa')](),controller[_0xba44('0x14')]);router[_0xba44('0x13')](_0xba44('0xe'),auth[_0xba44('0xa')](),controller[_0xba44('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0059da3..3f701ae 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 _0x6ade=['name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','STRING'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x6ade,0x15a));var _0xe6ad=function(_0x228d05,_0x460d69){_0x228d05=_0x228d05-0x0;var _0x356156=_0x6ade[_0x228d05];return _0x356156;};'use strict';var Sequelize=require(_0xe6ad('0x0'));module['exports']={'name':{'type':Sequelize[_0xe6ad('0x1')],'unique':_0xe6ad('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xe6ad('0x3')]},'preproduction':{'type':Sequelize[_0xe6ad('0x4')](_0xe6ad('0x5')),'get':function(){if(this[_0xe6ad('0x6')](_0xe6ad('0x7'))){return this[_0xe6ad('0x6')](_0xe6ad('0x7'))[_0xe6ad('0x8')](_0xe6ad('0x9'));}}},'production':{'type':Sequelize[_0xe6ad('0x4')]('long'),'get':function(){if(this[_0xe6ad('0x6')](_0xe6ad('0xa'))){return this[_0xe6ad('0x6')](_0xe6ad('0xa'))[_0xe6ad('0x8')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xe6ad('0xb')]}}; \ No newline at end of file +var _0xa953=['production','toString','DATE','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','utf8'];(function(_0x378f46,_0x58c4b0){var _0x519f9c=function(_0x1c6e17){while(--_0x1c6e17){_0x378f46['push'](_0x378f46['shift']());}};_0x519f9c(++_0x58c4b0);}(_0xa953,0x1d1));var _0x3a95=function(_0x236cc0,_0xc76be8){_0x236cc0=_0x236cc0-0x0;var _0x509cc7=_0xa953[_0x236cc0];return _0x509cc7;};'use strict';var Sequelize=require('sequelize');module[_0x3a95('0x0')]={'name':{'type':Sequelize[_0x3a95('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x3a95('0x2')]},'preproduction':{'type':Sequelize[_0x3a95('0x3')](_0x3a95('0x4')),'get':function(){if(this[_0x3a95('0x5')](_0x3a95('0x6'))){return this[_0x3a95('0x5')](_0x3a95('0x6'))['toString'](_0x3a95('0x7'));}}},'production':{'type':Sequelize[_0x3a95('0x3')]('long'),'get':function(){if(this['getDataValue']('production')){return this[_0x3a95('0x5')](_0x3a95('0x8'))[_0x3a95('0x9')]('utf8');}}},'savedAt':{'type':Sequelize[_0x3a95('0xa')]},'publishedAt':{'type':Sequelize[_0x3a95('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 655cfb7..e9f351c 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 _0x814b=['omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','nolimit','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','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','stack','render','contact','message','interaction','account','index','map','SquareProject','rawAttributes','type','model','name','keys','query','intersection','attributes','length','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','catch','show','params','fields','merge','body','user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addUsers','ids'];(function(_0xd92031,_0xdc1d3a){var _0x4db3da=function(_0x3d2354){while(--_0x3d2354){_0xd92031['push'](_0xd92031['shift']());}};_0x4db3da(++_0xdc1d3a);}(_0x814b,0x1a2));var _0xb814=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x814b[_0x2ff4bd];return _0x28edc6;};'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'];config[_0xb814('0x1b')]=_[_0xb814('0x1c')](config[_0xb814('0x1b')],{'host':_0xb814('0x1d'),'port':0x18eb});var socket=require(_0xb814('0x1e'))(new Redis(config[_0xb814('0x1b')]));require(_0xb814('0x1f'))[_0xb814('0x20')](socket);function respondWithStatusCode(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xcc;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x21')](_0x44fb96);}return _0x3f4881[_0xb814('0x22')](_0x44fb96)[_0xb814('0x23')]();};}function respondWithResult(_0x45e0d0,_0x265a83){_0x265a83=_0x265a83||0xc8;return function(_0x125ce2){if(_0x125ce2){return _0x45e0d0[_0xb814('0x22')](_0x265a83)[_0xb814('0x24')](_0x125ce2);}};}function respondWithFilteredResult(_0x48c9df,_0x168a48){return function(_0x55ba16){if(_0x55ba16){var _0x270598=typeof _0x168a48[_0xb814('0x25')]==='undefined'&&typeof _0x168a48['limit']==='undefined';var _0x399b43=_0x55ba16['count'];var _0x57c128=_0x270598?0x0:_0x168a48[_0xb814('0x25')];var _0x24211d=_0x270598?_0x55ba16[_0xb814('0x26')]:_0x168a48['offset']+_0x168a48[_0xb814('0x27')];var _0x531032;if(_0x24211d>=_0x399b43){_0x24211d=_0x399b43;_0x531032=0xc8;}else{_0x531032=0xce;}_0x48c9df[_0xb814('0x22')](_0x531032);return _0x48c9df[_0xb814('0x28')](_0xb814('0x29'),_0x57c128+'-'+_0x24211d+'/'+_0x399b43)[_0xb814('0x24')](_0x55ba16);}return null;};}function patchUpdates(_0x27352e){return function(_0x2bd039){try{jsonpatch[_0xb814('0x2a')](_0x2bd039,_0x27352e,!![]);}catch(_0x594470){return BPromise[_0xb814('0x2b')](_0x594470);}return _0x2bd039['save']();};}function saveUpdates(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x2c')](_0x3f81d0)[_0xb814('0x2d')](function(_0xb9e57d){return _0xb9e57d;});}return null;};}function removeEntity(_0x3d836c,_0x5755ea){return function(_0x392222){if(_0x392222){return _0x392222[_0xb814('0x2e')]()[_0xb814('0x2d')](function(){var _0x349394=_0x392222[_0xb814('0x2f')]({'plain':!![]});var _0x1d5965=_0xb814('0x30');return db[_0xb814('0x31')]['destroy']({'where':{'type':_0x1d5965,'resourceId':_0x349394['id']}})[_0xb814('0x2d')](function(){return _0x392222;});})[_0xb814('0x2d')](function(){_0x3d836c['status'](0xcc)[_0xb814('0x23')]();});}};}function handleEntityNotFound(_0x37d24d,_0x530744){return function(_0x499f22){if(!_0x499f22){_0x37d24d[_0xb814('0x21')](0x194);}return _0x499f22;};}function handleError(_0x2051d0,_0x58c3ca){_0x58c3ca=_0x58c3ca||0x1f4;return function(_0x338a28){logger['error'](_0x338a28[_0xb814('0x32')]);if(_0x338a28['name']){delete _0x338a28['name'];}_0x2051d0[_0xb814('0x22')](_0x58c3ca)['send'](_0x338a28);};}function getMustacheRender(_0x2431e2,_0x19469b){return Mustache[_0xb814('0x33')](_0x2431e2,_['merge'](_0x19469b['body'],{'contact':_0x19469b[_0xb814('0x34')],'message':_0x19469b[_0xb814('0x35')],'agent':_0x19469b['agent'],'interaction':_0x19469b[_0xb814('0x36')],'account':_0x19469b[_0xb814('0x37')]}))||'';}exports[_0xb814('0x38')]=function(_0x217b7e,_0x1b78de){var _0x60024d={},_0x3672f3={},_0x4df4e6={'count':0x0,'rows':[]};var _0x3207ec=_[_0xb814('0x39')](db[_0xb814('0x3a')][_0xb814('0x3b')],function(_0x14100d){return{'name':_0x14100d['fieldName'],'type':_0x14100d[_0xb814('0x3c')]['key']};});_0x3672f3[_0xb814('0x3d')]=_[_0xb814('0x39')](_0x3207ec,_0xb814('0x3e'));_0x3672f3['query']=_[_0xb814('0x3f')](_0x217b7e[_0xb814('0x40')]);_0x3672f3['filters']=_[_0xb814('0x41')](_0x3672f3[_0xb814('0x3d')],_0x3672f3[_0xb814('0x40')]);_0x60024d[_0xb814('0x42')]=_[_0xb814('0x41')](_0x3672f3[_0xb814('0x3d')],qs['fields'](_0x217b7e[_0xb814('0x40')]['fields']));_0x60024d[_0xb814('0x42')]=_0x60024d['attributes'][_0xb814('0x43')]?_0x60024d['attributes']:_0x3672f3[_0xb814('0x3d')];if(!_0x217b7e[_0xb814('0x40')]['hasOwnProperty']('nolimit')){_0x60024d['limit']=qs['limit'](_0x217b7e[_0xb814('0x40')][_0xb814('0x27')]);_0x60024d[_0xb814('0x25')]=qs[_0xb814('0x25')](_0x217b7e['query']['offset']);}_0x60024d[_0xb814('0x44')]=qs['sort'](_0x217b7e[_0xb814('0x40')][_0xb814('0x45')]);_0x60024d[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x217b7e[_0xb814('0x40')],_0x3672f3[_0xb814('0x47')]),_0x3207ec);if(_0x217b7e[_0xb814('0x40')][_0xb814('0x49')]){_0x60024d['where']=_['merge'](_0x60024d['where'],{'$or':_[_0xb814('0x39')](_0x3207ec,function(_0x5ba0bc){if(_0x5ba0bc[_0xb814('0x3c')]!=='VIRTUAL'){var _0x411723={};_0x411723[_0x5ba0bc[_0xb814('0x3e')]]={'$like':'%'+_0x217b7e[_0xb814('0x40')][_0xb814('0x49')]+'%'};return _0x411723;}})});}_0x60024d=_['merge']({},_0x60024d,_0x217b7e[_0xb814('0x4a')]);var _0x15f01a={'where':_0x60024d[_0xb814('0x46')]};return db[_0xb814('0x3a')][_0xb814('0x26')](_0x15f01a)[_0xb814('0x2d')](function(_0x534eb8){_0x4df4e6[_0xb814('0x26')]=_0x534eb8;if(_0x217b7e[_0xb814('0x40')][_0xb814('0x4b')]){_0x60024d[_0xb814('0x4c')]=[{'all':!![]}];}return db[_0xb814('0x3a')][_0xb814('0x4d')](_0x60024d);})[_0xb814('0x2d')](function(_0x519545){_0x4df4e6['rows']=_0x519545;return _0x4df4e6;})[_0xb814('0x2d')](respondWithFilteredResult(_0x1b78de,_0x60024d))[_0xb814('0x4e')](handleError(_0x1b78de,null));};exports[_0xb814('0x4f')]=function(_0x2bf906,_0x43f1b){var _0x40e627={'raw':![],'where':{'id':_0x2bf906[_0xb814('0x50')]['id']}},_0x24b697={};_0x24b697[_0xb814('0x3d')]=_[_0xb814('0x3f')](db[_0xb814('0x3a')]['rawAttributes']);_0x24b697[_0xb814('0x40')]=_[_0xb814('0x3f')](_0x2bf906['query']);_0x24b697[_0xb814('0x47')]=_['intersection'](_0x24b697[_0xb814('0x3d')],_0x24b697[_0xb814('0x40')]);_0x40e627[_0xb814('0x42')]=_[_0xb814('0x41')](_0x24b697[_0xb814('0x3d')],qs[_0xb814('0x51')](_0x2bf906[_0xb814('0x40')][_0xb814('0x51')]));_0x40e627[_0xb814('0x42')]=_0x40e627[_0xb814('0x42')]['length']?_0x40e627['attributes']:_0x24b697[_0xb814('0x3d')];if(_0x2bf906[_0xb814('0x40')][_0xb814('0x4b')]){_0x40e627[_0xb814('0x4c')]=[{'all':!![]}];}_0x40e627=_[_0xb814('0x52')]({},_0x40e627,_0x2bf906[_0xb814('0x4a')]);return db[_0xb814('0x3a')]['find'](_0x40e627)[_0xb814('0x2d')](handleEntityNotFound(_0x43f1b,null))[_0xb814('0x2d')](respondWithResult(_0x43f1b,null))[_0xb814('0x4e')](handleError(_0x43f1b,null));};exports['create']=function(_0x3a5556,_0x4e6f3c){return db[_0xb814('0x3a')]['create'](_0x3a5556[_0xb814('0x53')],{})[_0xb814('0x2d')](function(_0x590c4b){var _0x793ea1=_0x3a5556[_0xb814('0x54')][_0xb814('0x2f')]({'plain':!![]});if(!_0x793ea1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x793ea1[_0xb814('0x55')]==='user'){var _0x13bdcf=_0x590c4b[_0xb814('0x2f')]({'plain':!![]});var _0x4aed78=_0xb814('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x4aed78,'userProfileId':_0x793ea1[_0xb814('0x56')]},'raw':!![]})[_0xb814('0x2d')](function(_0x34935b){if(_0x34935b&&_0x34935b['autoAssociation']===0x0){return db[_0xb814('0x31')]['create']({'name':_0x13bdcf[_0xb814('0x3e')],'resourceId':_0x13bdcf['id'],'type':_0x34935b[_0xb814('0x3e')],'sectionId':_0x34935b['id']},{})['then'](function(){return _0x590c4b;});}else{return _0x590c4b;}})[_0xb814('0x4e')](function(_0x5c32c2){logger[_0xb814('0x57')](_0xb814('0x58'),_0x5c32c2);throw _0x5c32c2;});}return _0x590c4b;})[_0xb814('0x2d')](respondWithResult(_0x4e6f3c,0xc9))[_0xb814('0x4e')](handleError(_0x4e6f3c,null));};exports[_0xb814('0x2c')]=function(_0x34acca,_0x21d3e9){if(_0x34acca[_0xb814('0x53')]['id']){delete _0x34acca['body']['id'];}return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x34acca['params']['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x21d3e9,null))[_0xb814('0x2d')](saveUpdates(_0x34acca['body'],null))[_0xb814('0x2d')](respondWithResult(_0x21d3e9,null))['catch'](handleError(_0x21d3e9,null));};exports['destroy']=function(_0x2114ca,_0x5257be){return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x2114ca[_0xb814('0x50')]['id']}})['then'](handleEntityNotFound(_0x5257be,null))[_0xb814('0x2d')](removeEntity(_0x5257be,null))['catch'](handleError(_0x5257be,null));};exports[_0xb814('0x5a')]=function(_0x1e9196,_0x1236d4,_0x176585){return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x1e9196[_0xb814('0x50')]['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x1236d4,null))[_0xb814('0x2d')](function(_0x4d611d){if(_0x4d611d){return _0x4d611d[_0xb814('0x5a')](_0x1e9196[_0xb814('0x53')][_0xb814('0x5b')],_[_0xb814('0x5c')](_0x1e9196[_0xb814('0x53')],[_0xb814('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x1236d4,null))[_0xb814('0x4e')](handleError(_0x1236d4,null));};exports['removeUsers']=function(_0x3cd4f7,_0x39b754,_0xac95cf){return db['SquareProject'][_0xb814('0x59')]({'where':{'id':_0x3cd4f7['params']['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x39b754,null))['then'](function(_0x2f0c94){if(_0x2f0c94){return _0x2f0c94[_0xb814('0x5d')](_0x3cd4f7[_0xb814('0x40')][_0xb814('0x5b')])[_0xb814('0x2d')](function(){if(_[_0xb814('0x5e')](_0x3cd4f7[_0xb814('0x40')]['ids'])){for(var _0x44088d=0x0;_0x44088d<_0x3cd4f7['query'][_0xb814('0x5b')][_0xb814('0x43')];_0x44088d+=0x1){socket[_0xb814('0x5f')](_0xb814('0x60'),{'UserId':Number(_0x3cd4f7[_0xb814('0x40')][_0xb814('0x5b')][_0x44088d]),'SquareProjectId':Number(_0x3cd4f7['params']['id'])});}}else{socket[_0xb814('0x5f')](_0xb814('0x60'),{'UserId':Number(_0x3cd4f7['query'][_0xb814('0x5b')]),'SquareProjectId':Number(_0x3cd4f7[_0xb814('0x50')]['id'])});}});}})[_0xb814('0x2d')](respondWithStatusCode(_0x39b754,null))[_0xb814('0x4e')](handleError(_0x39b754,null));};exports[_0xb814('0x61')]=function(_0x51d834,_0x3a4d4b,_0x5e8e8e){var _0x24594a={};var _0x16f8f2={};var _0x2645f6;var _0x45dc85;return db[_0xb814('0x3a')][_0xb814('0x62')]({'where':{'id':_0x51d834['params']['id']}})['then'](handleEntityNotFound(_0x3a4d4b,null))['then'](function(_0x25c776){if(_0x25c776){_0x2645f6=_0x25c776;_0x16f8f2['model']=_[_0xb814('0x3f')](db[_0xb814('0x63')][_0xb814('0x3b')]);_0x16f8f2['query']=_[_0xb814('0x3f')](_0x51d834[_0xb814('0x40')]);_0x16f8f2[_0xb814('0x47')]=_['intersection'](_0x16f8f2[_0xb814('0x3d')],_0x16f8f2[_0xb814('0x40')]);_0x24594a[_0xb814('0x42')]=_[_0xb814('0x41')](_0x16f8f2['model'],qs['fields'](_0x51d834[_0xb814('0x40')][_0xb814('0x51')]));_0x24594a[_0xb814('0x42')]=_0x24594a[_0xb814('0x42')][_0xb814('0x43')]?_0x24594a[_0xb814('0x42')]:_0x16f8f2[_0xb814('0x3d')];_0x24594a[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x51d834[_0xb814('0x40')][_0xb814('0x45')]);_0x24594a[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x51d834[_0xb814('0x40')],_0x16f8f2['filters']));if(_0x51d834[_0xb814('0x40')][_0xb814('0x49')]){_0x24594a[_0xb814('0x46')]=_[_0xb814('0x52')](_0x24594a[_0xb814('0x46')],{'$or':_[_0xb814('0x39')](_0x24594a['attributes'],function(_0xff4dc2){var _0x52e1fc={};_0x52e1fc[_0xff4dc2]={'$like':'%'+_0x51d834[_0xb814('0x40')][_0xb814('0x49')]+'%'};return _0x52e1fc;})});}_0x24594a=_[_0xb814('0x52')]({},_0x24594a,_0x51d834[_0xb814('0x4a')]);return _0x2645f6[_0xb814('0x61')](_0x24594a);}})['then'](function(_0x4c44ee){if(_0x4c44ee){_0x45dc85=_0x4c44ee[_0xb814('0x43')];if(!_0x51d834[_0xb814('0x40')][_0xb814('0x64')](_0xb814('0x65'))){_0x24594a['limit']=qs[_0xb814('0x27')](_0x51d834['query'][_0xb814('0x27')]);_0x24594a[_0xb814('0x25')]=qs['offset'](_0x51d834['query'][_0xb814('0x25')]);}return _0x2645f6['getUsers'](_0x24594a);}})[_0xb814('0x2d')](function(_0x163c2b){if(_0x163c2b){return _0x163c2b?{'count':_0x45dc85,'rows':_0x163c2b}:null;}})[_0xb814('0x2d')](respondWithResult(_0x3a4d4b,null))[_0xb814('0x4e')](handleError(_0x3a4d4b,null));}; \ No newline at end of file +var _0x9957=['type','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','findAll','show','params','rawAttributes','options','catch','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','pick','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','SquareProjects','UserProfileResource','error','stack','name','send','render','body','contact','message','agent','interaction','index','SquareProject','fieldName'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];config[_0x7995('0x1b')]=_[_0x7995('0x1c')](config[_0x7995('0x1b')],{'host':_0x7995('0x1d'),'port':0x18eb});var socket=require(_0x7995('0x1e'))(new Redis(config['redis']));require('./squareProject.socket')[_0x7995('0x1f')](socket);function respondWithStatusCode(_0x2233dd,_0x24b5bb){_0x24b5bb=_0x24b5bb||0xcc;return function(_0x321ae8){if(_0x321ae8){return _0x2233dd[_0x7995('0x20')](_0x24b5bb);}return _0x2233dd[_0x7995('0x21')](_0x24b5bb)[_0x7995('0x22')]();};}function respondWithResult(_0x41cbf0,_0x5377e5){_0x5377e5=_0x5377e5||0xc8;return function(_0x2eeacc){if(_0x2eeacc){return _0x41cbf0['status'](_0x5377e5)[_0x7995('0x23')](_0x2eeacc);}};}function respondWithFilteredResult(_0x37f297,_0x43d4b8){return function(_0x291317){if(_0x291317){var _0x1e1415=typeof _0x43d4b8[_0x7995('0x24')]==='undefined'&&typeof _0x43d4b8['limit']===_0x7995('0x25');var _0x5e6f90=_0x291317['count'];var _0x3ec178=_0x1e1415?0x0:_0x43d4b8[_0x7995('0x24')];var _0x4cbe10=_0x1e1415?_0x291317[_0x7995('0x26')]:_0x43d4b8['offset']+_0x43d4b8['limit'];var _0x3e4c54;if(_0x4cbe10>=_0x5e6f90){_0x4cbe10=_0x5e6f90;_0x3e4c54=0xc8;}else{_0x3e4c54=0xce;}_0x37f297[_0x7995('0x21')](_0x3e4c54);return _0x37f297[_0x7995('0x27')](_0x7995('0x28'),_0x3ec178+'-'+_0x4cbe10+'/'+_0x5e6f90)[_0x7995('0x23')](_0x291317);}return null;};}function patchUpdates(_0x1c278a){return function(_0x5d40ae){try{jsonpatch[_0x7995('0x29')](_0x5d40ae,_0x1c278a,!![]);}catch(_0x46ee4b){return BPromise[_0x7995('0x2a')](_0x46ee4b);}return _0x5d40ae[_0x7995('0x2b')]();};}function saveUpdates(_0x563799,_0x13bc35){return function(_0x475351){if(_0x475351){return _0x475351[_0x7995('0x2c')](_0x563799)['then'](function(_0x39df42){return _0x39df42;});}return null;};}function removeEntity(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(_0x268ce7){return _0x268ce7[_0x7995('0x2d')]()[_0x7995('0x2e')](function(){var _0x56691a=_0x268ce7[_0x7995('0x2f')]({'plain':!![]});var _0x5911c3=_0x7995('0x30');return db[_0x7995('0x31')][_0x7995('0x2d')]({'where':{'type':_0x5911c3,'resourceId':_0x56691a['id']}})[_0x7995('0x2e')](function(){return _0x268ce7;});})[_0x7995('0x2e')](function(){_0x34e70c['status'](0xcc)[_0x7995('0x22')]();});}};}function handleEntityNotFound(_0x514445,_0x456a28){return function(_0x3250e0){if(!_0x3250e0){_0x514445[_0x7995('0x20')](0x194);}return _0x3250e0;};}function handleError(_0x574574,_0x530611){_0x530611=_0x530611||0x1f4;return function(_0x48e573){logger[_0x7995('0x32')](_0x48e573[_0x7995('0x33')]);if(_0x48e573[_0x7995('0x34')]){delete _0x48e573[_0x7995('0x34')];}_0x574574[_0x7995('0x21')](_0x530611)[_0x7995('0x35')](_0x48e573);};}function getMustacheRender(_0x538841,_0x481c74){return Mustache[_0x7995('0x36')](_0x538841,_['merge'](_0x481c74[_0x7995('0x37')],{'contact':_0x481c74[_0x7995('0x38')],'message':_0x481c74[_0x7995('0x39')],'agent':_0x481c74[_0x7995('0x3a')],'interaction':_0x481c74[_0x7995('0x3b')],'account':_0x481c74['account']}))||'';}exports[_0x7995('0x3c')]=function(_0x33e24e,_0x5dd802){var _0x48db25={},_0x577412={},_0x45bc5e={'count':0x0,'rows':[]};var _0x3acfc3=_['map'](db[_0x7995('0x3d')]['rawAttributes'],function(_0x37917b){return{'name':_0x37917b[_0x7995('0x3e')],'type':_0x37917b[_0x7995('0x3f')]['key']};});_0x577412['model']=_[_0x7995('0x40')](_0x3acfc3,'name');_0x577412['query']=_[_0x7995('0x41')](_0x33e24e[_0x7995('0x42')]);_0x577412['filters']=_[_0x7995('0x43')](_0x577412[_0x7995('0x44')],_0x577412[_0x7995('0x42')]);_0x48db25[_0x7995('0x45')]=_[_0x7995('0x43')](_0x577412['model'],qs[_0x7995('0x46')](_0x33e24e[_0x7995('0x42')][_0x7995('0x46')]));_0x48db25[_0x7995('0x45')]=_0x48db25['attributes'][_0x7995('0x47')]?_0x48db25[_0x7995('0x45')]:_0x577412[_0x7995('0x44')];if(!_0x33e24e[_0x7995('0x42')][_0x7995('0x48')](_0x7995('0x49'))){_0x48db25['limit']=qs[_0x7995('0x4a')](_0x33e24e[_0x7995('0x42')][_0x7995('0x4a')]);_0x48db25[_0x7995('0x24')]=qs[_0x7995('0x24')](_0x33e24e[_0x7995('0x42')][_0x7995('0x24')]);}_0x48db25[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_0x33e24e[_0x7995('0x42')][_0x7995('0x4c')]);_0x48db25[_0x7995('0x4d')]=qs[_0x7995('0x4e')](_['pick'](_0x33e24e['query'],_0x577412[_0x7995('0x4e')]),_0x3acfc3);if(_0x33e24e[_0x7995('0x42')]['filter']){_0x48db25['where']=_[_0x7995('0x4f')](_0x48db25['where'],{'$or':_['map'](_0x3acfc3,function(_0x23da6b){if(_0x23da6b[_0x7995('0x3f')]!==_0x7995('0x50')){var _0x576b96={};_0x576b96[_0x23da6b[_0x7995('0x34')]]={'$like':'%'+_0x33e24e['query'][_0x7995('0x51')]+'%'};return _0x576b96;}})});}_0x48db25=_['merge']({},_0x48db25,_0x33e24e['options']);var _0x39c5b8={'where':_0x48db25[_0x7995('0x4d')]};return db[_0x7995('0x3d')][_0x7995('0x26')](_0x39c5b8)['then'](function(_0x3c5cde){_0x45bc5e[_0x7995('0x26')]=_0x3c5cde;if(_0x33e24e[_0x7995('0x42')][_0x7995('0x52')]){_0x48db25['include']=[{'all':!![]}];}return db['SquareProject'][_0x7995('0x53')](_0x48db25);})['then'](function(_0x23c41d){_0x45bc5e['rows']=_0x23c41d;return _0x45bc5e;})[_0x7995('0x2e')](respondWithFilteredResult(_0x5dd802,_0x48db25))['catch'](handleError(_0x5dd802,null));};exports[_0x7995('0x54')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'raw':![],'where':{'id':_0x1b0373[_0x7995('0x55')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x44')]=_['keys'](db[_0x7995('0x3d')][_0x7995('0x56')]);_0x336ff2[_0x7995('0x42')]=_['keys'](_0x1b0373[_0x7995('0x42')]);_0x336ff2[_0x7995('0x4e')]=_[_0x7995('0x43')](_0x336ff2[_0x7995('0x44')],_0x336ff2[_0x7995('0x42')]);_0x3e9e62['attributes']=_[_0x7995('0x43')](_0x336ff2[_0x7995('0x44')],qs['fields'](_0x1b0373[_0x7995('0x42')]['fields']));_0x3e9e62[_0x7995('0x45')]=_0x3e9e62[_0x7995('0x45')][_0x7995('0x47')]?_0x3e9e62[_0x7995('0x45')]:_0x336ff2[_0x7995('0x44')];if(_0x1b0373[_0x7995('0x42')][_0x7995('0x52')]){_0x3e9e62['include']=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x4f')]({},_0x3e9e62,_0x1b0373[_0x7995('0x57')]);return db[_0x7995('0x3d')]['find'](_0x3e9e62)[_0x7995('0x2e')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x2e')](respondWithResult(_0x4d9245,null))[_0x7995('0x58')](handleError(_0x4d9245,null));};exports['create']=function(_0x4ec548,_0x5a592e){return db[_0x7995('0x3d')][_0x7995('0x59')](_0x4ec548['body'],{})[_0x7995('0x2e')](function(_0x29f300){var _0x31f27c=_0x4ec548[_0x7995('0x5a')][_0x7995('0x2f')]({'plain':!![]});if(!_0x31f27c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31f27c[_0x7995('0x5b')]==='user'){var _0x14fe7f=_0x29f300[_0x7995('0x2f')]({'plain':!![]});var _0x206d2a='SquareProjects';return db['UserProfileSection']['find']({'where':{'name':_0x206d2a,'userProfileId':_0x31f27c['userProfileId']},'raw':!![]})[_0x7995('0x2e')](function(_0x3709de){if(_0x3709de&&_0x3709de[_0x7995('0x5c')]===0x0){return db[_0x7995('0x31')][_0x7995('0x59')]({'name':_0x14fe7f[_0x7995('0x34')],'resourceId':_0x14fe7f['id'],'type':_0x3709de[_0x7995('0x34')],'sectionId':_0x3709de['id']},{})[_0x7995('0x2e')](function(){return _0x29f300;});}else{return _0x29f300;}})[_0x7995('0x58')](function(_0x17ecd3){logger[_0x7995('0x32')](_0x7995('0x5d'),_0x17ecd3);throw _0x17ecd3;});}return _0x29f300;})[_0x7995('0x2e')](respondWithResult(_0x5a592e,0xc9))[_0x7995('0x58')](handleError(_0x5a592e,null));};exports[_0x7995('0x2c')]=function(_0x416133,_0x447a2b){if(_0x416133[_0x7995('0x37')]['id']){delete _0x416133[_0x7995('0x37')]['id'];}return db['SquareProject'][_0x7995('0x5e')]({'where':{'id':_0x416133[_0x7995('0x55')]['id']}})[_0x7995('0x2e')](handleEntityNotFound(_0x447a2b,null))[_0x7995('0x2e')](saveUpdates(_0x416133['body'],null))['then'](respondWithResult(_0x447a2b,null))[_0x7995('0x58')](handleError(_0x447a2b,null));};exports[_0x7995('0x2d')]=function(_0x5b9467,_0x332a85){return db['SquareProject'][_0x7995('0x5e')]({'where':{'id':_0x5b9467[_0x7995('0x55')]['id']}})[_0x7995('0x2e')](handleEntityNotFound(_0x332a85,null))[_0x7995('0x2e')](removeEntity(_0x332a85,null))['catch'](handleError(_0x332a85,null));};exports['addUsers']=function(_0x40e5fc,_0x398fac,_0x6c0221){return db[_0x7995('0x3d')][_0x7995('0x5e')]({'where':{'id':_0x40e5fc[_0x7995('0x55')]['id']}})[_0x7995('0x2e')](handleEntityNotFound(_0x398fac,null))[_0x7995('0x2e')](function(_0x984c23){if(_0x984c23){return _0x984c23['addUsers'](_0x40e5fc[_0x7995('0x37')][_0x7995('0x5f')],_[_0x7995('0x60')](_0x40e5fc[_0x7995('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x398fac,null))[_0x7995('0x58')](handleError(_0x398fac,null));};exports[_0x7995('0x61')]=function(_0x47d5d7,_0x971a23,_0x375fc9){return db[_0x7995('0x3d')][_0x7995('0x5e')]({'where':{'id':_0x47d5d7[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x971a23,null))[_0x7995('0x2e')](function(_0x564fca){if(_0x564fca){return _0x564fca[_0x7995('0x61')](_0x47d5d7[_0x7995('0x42')][_0x7995('0x5f')])[_0x7995('0x2e')](function(){if(_[_0x7995('0x62')](_0x47d5d7[_0x7995('0x42')][_0x7995('0x5f')])){for(var _0x44372a=0x0;_0x44372a<_0x47d5d7[_0x7995('0x42')][_0x7995('0x5f')][_0x7995('0x47')];_0x44372a+=0x1){socket[_0x7995('0x63')]('userSquareProject:remove',{'UserId':Number(_0x47d5d7[_0x7995('0x42')][_0x7995('0x5f')][_0x44372a]),'SquareProjectId':Number(_0x47d5d7[_0x7995('0x55')]['id'])});}}else{socket[_0x7995('0x63')](_0x7995('0x64'),{'UserId':Number(_0x47d5d7['query']['ids']),'SquareProjectId':Number(_0x47d5d7[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x2e')](respondWithStatusCode(_0x971a23,null))[_0x7995('0x58')](handleError(_0x971a23,null));};exports[_0x7995('0x65')]=function(_0x5aa2ec,_0x22d317,_0x50a12e){var _0x5df621={};var _0xca8238={};var _0x36d27d;var _0x3f0a71;return db[_0x7995('0x3d')][_0x7995('0x66')]({'where':{'id':_0x5aa2ec[_0x7995('0x55')]['id']}})[_0x7995('0x2e')](handleEntityNotFound(_0x22d317,null))[_0x7995('0x2e')](function(_0x3fde86){if(_0x3fde86){_0x36d27d=_0x3fde86;_0xca8238[_0x7995('0x44')]=_['keys'](db[_0x7995('0x67')][_0x7995('0x56')]);_0xca8238[_0x7995('0x42')]=_['keys'](_0x5aa2ec[_0x7995('0x42')]);_0xca8238[_0x7995('0x4e')]=_[_0x7995('0x43')](_0xca8238[_0x7995('0x44')],_0xca8238[_0x7995('0x42')]);_0x5df621[_0x7995('0x45')]=_[_0x7995('0x43')](_0xca8238[_0x7995('0x44')],qs[_0x7995('0x46')](_0x5aa2ec[_0x7995('0x42')][_0x7995('0x46')]));_0x5df621['attributes']=_0x5df621['attributes'][_0x7995('0x47')]?_0x5df621[_0x7995('0x45')]:_0xca8238[_0x7995('0x44')];_0x5df621[_0x7995('0x4b')]=qs['sort'](_0x5aa2ec[_0x7995('0x42')][_0x7995('0x4c')]);_0x5df621['where']=qs['filters'](_[_0x7995('0x68')](_0x5aa2ec[_0x7995('0x42')],_0xca8238['filters']));if(_0x5aa2ec[_0x7995('0x42')]['filter']){_0x5df621[_0x7995('0x4d')]=_[_0x7995('0x4f')](_0x5df621['where'],{'$or':_['map'](_0x5df621[_0x7995('0x45')],function(_0x50c1a4){var _0x31b9e6={};_0x31b9e6[_0x50c1a4]={'$like':'%'+_0x5aa2ec[_0x7995('0x42')][_0x7995('0x51')]+'%'};return _0x31b9e6;})});}_0x5df621=_[_0x7995('0x4f')]({},_0x5df621,_0x5aa2ec[_0x7995('0x57')]);return _0x36d27d[_0x7995('0x65')](_0x5df621);}})[_0x7995('0x2e')](function(_0x14cb17){if(_0x14cb17){_0x3f0a71=_0x14cb17[_0x7995('0x47')];if(!_0x5aa2ec[_0x7995('0x42')][_0x7995('0x48')](_0x7995('0x49'))){_0x5df621[_0x7995('0x4a')]=qs[_0x7995('0x4a')](_0x5aa2ec[_0x7995('0x42')][_0x7995('0x4a')]);_0x5df621[_0x7995('0x24')]=qs[_0x7995('0x24')](_0x5aa2ec[_0x7995('0x42')][_0x7995('0x24')]);}return _0x36d27d[_0x7995('0x65')](_0x5df621);}})[_0x7995('0x2e')](function(_0x11fe75){if(_0x11fe75){return _0x11fe75?{'count':_0x3f0a71,'rows':_0x11fe75}:null;}})[_0x7995('0x2e')](respondWithResult(_0x22d317,null))[_0x7995('0x58')](handleError(_0x22d317,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 5668ef2..453a8e4 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 _0x7a37=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','remove','emit'];(function(_0x4a9bdd,_0x5098f5){var _0x1ba3a4=function(_0x3b157f){while(--_0x3b157f){_0x4a9bdd['push'](_0x4a9bdd['shift']());}};_0x1ba3a4(++_0x5098f5);}(_0x7a37,0xdf));var _0x77a3=function(_0x35c2fc,_0xabea37){_0x35c2fc=_0x35c2fc-0x0;var _0x4727fd=_0x7a37[_0x35c2fc];return _0x4727fd;};'use strict';var EventEmitter=require(_0x77a3('0x0'));var SquareProject=require(_0x77a3('0x1'))['db'][_0x77a3('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x77a3('0x3')](0x0);var events={'afterCreate':_0x77a3('0x4'),'afterUpdate':'update','afterDestroy':_0x77a3('0x5')};function emitEvent(_0x529e53){return function(_0x48f39a,_0x4028ad,_0x3d74f3){SquareProjectEvents[_0x77a3('0x6')](_0x529e53+':'+_0x48f39a['id'],_0x48f39a);SquareProjectEvents[_0x77a3('0x6')](_0x529e53,_0x48f39a);_0x3d74f3(null);};}for(var e in events){if(events[_0x77a3('0x7')](e)){var event=events[e];SquareProject[_0x77a3('0x8')](e,emitEvent(event));}}module[_0x77a3('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x87df=['../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x12d308,_0x537c28){var _0x216737=function(_0x17cc98){while(--_0x17cc98){_0x12d308['push'](_0x12d308['shift']());}};_0x216737(++_0x537c28);}(_0x87df,0x167));var _0xf87d=function(_0x812b4,_0x5c732f){_0x812b4=_0x812b4-0x0;var _0x1b1950=_0x87df[_0x812b4];return _0x1b1950;};'use strict';var EventEmitter=require(_0xf87d('0x0'));var SquareProject=require(_0xf87d('0x1'))['db'][_0xf87d('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xf87d('0x3')](0x0);var events={'afterCreate':_0xf87d('0x4'),'afterUpdate':_0xf87d('0x5'),'afterDestroy':_0xf87d('0x6')};function emitEvent(_0xb0fb5a){return function(_0x25290a,_0x1d4ff6,_0x4fbca2){SquareProjectEvents['emit'](_0xb0fb5a+':'+_0x25290a['id'],_0x25290a);SquareProjectEvents[_0xf87d('0x7')](_0xb0fb5a,_0x25290a);_0x4fbca2(null);};}for(var e in events){if(events[_0xf87d('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xf87d('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 170073e..89f30c6 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 _0x7ae7=['define','SquareProject','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','publishedAt','format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x2828b7,_0x327deb){var _0x55fc41=function(_0x49d301){while(--_0x49d301){_0x2828b7['push'](_0x2828b7['shift']());}};_0x55fc41(++_0x327deb);}(_0x7ae7,0xd9));var _0x77ae=function(_0x1ac393,_0x52793d){_0x1ac393=_0x1ac393-0x0;var _0x2b54b2=_0x7ae7[_0x1ac393];return _0x2b54b2;};'use strict';var _=require(_0x77ae('0x0'));var util=require(_0x77ae('0x1'));var logger=require('../../config/logger')(_0x77ae('0x2'));var moment=require(_0x77ae('0x3'));var BPromise=require(_0x77ae('0x4'));var rp=require(_0x77ae('0x5'));var fs=require('fs');var path=require(_0x77ae('0x6'));var rimraf=require(_0x77ae('0x7'));var config=require(_0x77ae('0x8'));var attributes=require(_0x77ae('0x9'));module[_0x77ae('0xa')]=function(_0x3dd200,_0x276be6){return _0x3dd200[_0x77ae('0xb')](_0x77ae('0xc'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x131f0b,_0x43f894,_0xbffd7f){if(_0x131f0b[_0x77ae('0xd')](_0x77ae('0xe'))){_0x131f0b[_0x77ae('0xf')]=moment()['format'](_0x77ae('0x10'));}if(_0x131f0b['changed']('production')){_0x131f0b[_0x77ae('0x11')]=moment()[_0x77ae('0x12')](_0x77ae('0x10'));}_0xbffd7f(null,_0x131f0b);}}});}; \ No newline at end of file +var _0xc737=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SquareProject','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util'];(function(_0x360f8e,_0x2ae51b){var _0x1061d9=function(_0x5233bf){while(--_0x5233bf){_0x360f8e['push'](_0x360f8e['shift']());}};_0x1061d9(++_0x2ae51b);}(_0xc737,0x8e));var _0x7c73=function(_0x26924f,_0x5253f2){_0x26924f=_0x26924f-0x0;var _0x5657ef=_0xc737[_0x26924f];return _0x5657ef;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var logger=require('../../config/logger')(_0x7c73('0x2'));var moment=require(_0x7c73('0x3'));var BPromise=require(_0x7c73('0x4'));var rp=require(_0x7c73('0x5'));var fs=require('fs');var path=require(_0x7c73('0x6'));var rimraf=require(_0x7c73('0x7'));var config=require(_0x7c73('0x8'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x1eb29f,_0x2f09f7){return _0x1eb29f[_0x7c73('0x9')](_0x7c73('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x575a80,_0x4f9b28,_0x5d4573){if(_0x575a80['changed'](_0x7c73('0xb'))){_0x575a80[_0x7c73('0xc')]=moment()[_0x7c73('0xd')](_0x7c73('0xe'));}if(_0x575a80['changed'](_0x7c73('0xf'))){_0x575a80['publishedAt']=moment()[_0x7c73('0xd')](_0x7c73('0xe'));}_0x5d4573(null,_0x575a80);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 8920ec2..ea7154f 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 _0x02cc=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowSquareProject','SquareProject','find','options','raw','where','include','map','model','attributes','stringify','catch','lodash','moment','bluebird','randomstring'];(function(_0x3bd865,_0xdf2780){var _0x10b695=function(_0x13ff6d){while(--_0x13ff6d){_0x3bd865['push'](_0x3bd865['shift']());}};_0x10b695(++_0xdf2780);}(_0x02cc,0x15b));var _0xc02c=function(_0x2dcf68,_0x15d9f9){_0x2dcf68=_0x2dcf68-0x0;var _0x4ad47a=_0x02cc[_0x2dcf68];return _0x4ad47a;};'use strict';var _=require(_0xc02c('0x0'));var util=require('util');var moment=require(_0xc02c('0x1'));var BPromise=require(_0xc02c('0x2'));var rs=require(_0xc02c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc02c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc02c('0x5'));var config=require(_0xc02c('0x6'));var jayson=require(_0xc02c('0x7'));var client=jayson[_0xc02c('0x8')][_0xc02c('0x9')]({'port':0x232a});config[_0xc02c('0xa')]=_[_0xc02c('0xb')](config[_0xc02c('0xa')],{'host':_0xc02c('0xc'),'port':0x18eb});var socket=require(_0xc02c('0xd'))(new Redis(config['redis']));require(_0xc02c('0xe'))[_0xc02c('0xf')](socket);function respondWithRpcPromise(_0x1dde57,_0x781eff,_0x19a1bd){return new BPromise(function(_0x403e5d,_0x14a374){return client[_0xc02c('0x10')](_0x1dde57,_0x19a1bd)[_0xc02c('0x11')](function(_0x46ee93){logger['info'](_0xc02c('0x12'),_0x781eff,_0xc02c('0x13'));logger[_0xc02c('0x14')](_0xc02c('0x15'),_0x781eff,_0xc02c('0x13'),JSON['stringify'](_0x46ee93));if(_0x46ee93['error']){if(_0x46ee93[_0xc02c('0x16')][_0xc02c('0x17')]===0x1f4){logger[_0xc02c('0x16')](_0xc02c('0x12'),_0x781eff,_0x46ee93[_0xc02c('0x16')]['message']);return _0x14a374(_0x46ee93[_0xc02c('0x16')][_0xc02c('0x18')]);}logger['error'](_0xc02c('0x12'),_0x781eff,_0x46ee93[_0xc02c('0x16')]['message']);return _0x403e5d(_0x46ee93['error'][_0xc02c('0x18')]);}else{logger[_0xc02c('0x19')](_0xc02c('0x12'),_0x781eff,'request\x20sent');_0x403e5d(_0x46ee93[_0xc02c('0x1a')][_0xc02c('0x18')]);}})['catch'](function(_0x238598){logger[_0xc02c('0x16')]('SquareProject,\x20%s,\x20%s',_0x781eff,_0x238598);_0x14a374(_0x238598);});});}exports[_0xc02c('0x1b')]=function(_0x544094){var _0x877f2d=this;return new Promise(function(_0x108b33,_0x3262f4){return db[_0xc02c('0x1c')][_0xc02c('0x1d')]({'raw':_0x544094[_0xc02c('0x1e')]?_0x544094[_0xc02c('0x1e')][_0xc02c('0x1f')]===undefined?!![]:![]:!![],'where':_0x544094['options']?_0x544094[_0xc02c('0x1e')][_0xc02c('0x20')]||null:null,'attributes':_0x544094[_0xc02c('0x1e')]?_0x544094[_0xc02c('0x1e')]['attributes']||null:null,'include':_0x544094[_0xc02c('0x1e')]?_0x544094[_0xc02c('0x1e')][_0xc02c('0x21')]?_[_0xc02c('0x22')](_0x544094['options'][_0xc02c('0x21')],function(_0x475282){return{'model':db[_0x475282[_0xc02c('0x23')]],'as':_0x475282['as'],'attributes':_0x475282[_0xc02c('0x24')],'include':_0x475282[_0xc02c('0x21')]?_[_0xc02c('0x22')](_0x475282['include'],function(_0x594310){return{'model':db[_0x594310[_0xc02c('0x23')]],'as':_0x594310['as'],'attributes':_0x594310[_0xc02c('0x24')],'include':_0x594310[_0xc02c('0x21')]?_[_0xc02c('0x22')](_0x594310[_0xc02c('0x21')],function(_0x48d137){return{'model':db[_0x48d137[_0xc02c('0x23')]],'as':_0x48d137['as'],'attributes':_0x48d137[_0xc02c('0x24')]};}):[]};}):[]};}):[]:[]})[_0xc02c('0x11')](function(_0x3144ad){logger[_0xc02c('0x19')](_0xc02c('0x1b'),_0x544094);logger[_0xc02c('0x14')](_0xc02c('0x1b'),_0x544094,JSON[_0xc02c('0x25')](_0x3144ad));_0x108b33(_0x3144ad);})[_0xc02c('0x26')](function(_0x190b52){logger[_0xc02c('0x16')](_0xc02c('0x1b'),_0x190b52[_0xc02c('0x18')],_0x544094);_0x3262f4(_0x877f2d[_0xc02c('0x16')](0x1f4,_0x190b52[_0xc02c('0x18')]));});});}; \ No newline at end of file +var _0xa587=['include','map','model','ShowSquareProject','lodash','moment','bluebird','../../mysqldb','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareProject','find','options','raw','where','attributes'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xa587,0x1ee));var _0x7a58=function(_0x307fcf,_0x54f76b){_0x307fcf=_0x307fcf-0x0;var _0x505ee3=_0xa587[_0x307fcf];return _0x505ee3;};'use strict';var _=require(_0x7a58('0x0'));var util=require('util');var moment=require(_0x7a58('0x1'));var BPromise=require(_0x7a58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a58('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7a58('0x4'));var config=require(_0x7a58('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7a58('0x6')]({'port':0x232a});config[_0x7a58('0x7')]=_['defaults'](config[_0x7a58('0x7')],{'host':_0x7a58('0x8'),'port':0x18eb});var socket=require(_0x7a58('0x9'))(new Redis(config[_0x7a58('0x7')]));require(_0x7a58('0xa'))[_0x7a58('0xb')](socket);function respondWithRpcPromise(_0x8eecc1,_0x12bab9,_0x4b245a){return new BPromise(function(_0x1157c3,_0x57feba){return client[_0x7a58('0xc')](_0x8eecc1,_0x4b245a)[_0x7a58('0xd')](function(_0x273e68){logger[_0x7a58('0xe')](_0x7a58('0xf'),_0x12bab9,_0x7a58('0x10'));logger[_0x7a58('0x11')](_0x7a58('0x12'),_0x12bab9,_0x7a58('0x10'),JSON[_0x7a58('0x13')](_0x273e68));if(_0x273e68['error']){if(_0x273e68[_0x7a58('0x14')][_0x7a58('0x15')]===0x1f4){logger[_0x7a58('0x14')](_0x7a58('0xf'),_0x12bab9,_0x273e68[_0x7a58('0x14')]['message']);return _0x57feba(_0x273e68['error'][_0x7a58('0x16')]);}logger[_0x7a58('0x14')]('SquareProject,\x20%s,\x20%s',_0x12bab9,_0x273e68[_0x7a58('0x14')][_0x7a58('0x16')]);return _0x1157c3(_0x273e68[_0x7a58('0x14')][_0x7a58('0x16')]);}else{logger[_0x7a58('0xe')]('SquareProject,\x20%s,\x20%s',_0x12bab9,_0x7a58('0x10'));_0x1157c3(_0x273e68[_0x7a58('0x17')][_0x7a58('0x16')]);}})[_0x7a58('0x18')](function(_0x17a707){logger[_0x7a58('0x14')]('SquareProject,\x20%s,\x20%s',_0x12bab9,_0x17a707);_0x57feba(_0x17a707);});});}exports['ShowSquareProject']=function(_0x3b7352){var _0x2eceb3=this;return new Promise(function(_0x49cc77,_0xa4e527){return db[_0x7a58('0x19')][_0x7a58('0x1a')]({'raw':_0x3b7352['options']?_0x3b7352[_0x7a58('0x1b')][_0x7a58('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b7352['options']?_0x3b7352['options'][_0x7a58('0x1d')]||null:null,'attributes':_0x3b7352[_0x7a58('0x1b')]?_0x3b7352[_0x7a58('0x1b')][_0x7a58('0x1e')]||null:null,'include':_0x3b7352[_0x7a58('0x1b')]?_0x3b7352[_0x7a58('0x1b')][_0x7a58('0x1f')]?_[_0x7a58('0x20')](_0x3b7352['options'][_0x7a58('0x1f')],function(_0x1adb3e){return{'model':db[_0x1adb3e[_0x7a58('0x21')]],'as':_0x1adb3e['as'],'attributes':_0x1adb3e[_0x7a58('0x1e')],'include':_0x1adb3e[_0x7a58('0x1f')]?_[_0x7a58('0x20')](_0x1adb3e[_0x7a58('0x1f')],function(_0xf8cf6c){return{'model':db[_0xf8cf6c['model']],'as':_0xf8cf6c['as'],'attributes':_0xf8cf6c[_0x7a58('0x1e')],'include':_0xf8cf6c['include']?_[_0x7a58('0x20')](_0xf8cf6c[_0x7a58('0x1f')],function(_0x4557b7){return{'model':db[_0x4557b7['model']],'as':_0x4557b7['as'],'attributes':_0x4557b7['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a58('0xd')](function(_0x7d8dcf){logger[_0x7a58('0xe')]('ShowSquareProject',_0x3b7352);logger['debug']('ShowSquareProject',_0x3b7352,JSON[_0x7a58('0x13')](_0x7d8dcf));_0x49cc77(_0x7d8dcf);})[_0x7a58('0x18')](function(_0x54e7b1){logger[_0x7a58('0x14')](_0x7a58('0x22'),_0x54e7b1[_0x7a58('0x16')],_0x3b7352);_0xa4e527(_0x2eceb3['error'](0x1f4,_0x54e7b1[_0x7a58('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index fb07c10..941dae9 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 _0x5d17=['./squareProject.events','save','removeListener','register','length','squareProject:'];(function(_0x1ec4a6,_0x26b9a5){var _0x1b3d8e=function(_0x4331fd){while(--_0x4331fd){_0x1ec4a6['push'](_0x1ec4a6['shift']());}};_0x1b3d8e(++_0x26b9a5);}(_0x5d17,0x114));var _0x75d1=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0x5d17[_0x257017];return _0x38536d;};'use strict';var SquareProjectEvents=require(_0x75d1('0x0'));var events=[_0x75d1('0x1'),'remove','update'];function createListener(_0x39c0ec,_0x426717){return function(_0x1c9ba6){_0x426717['emit'](_0x39c0ec,_0x1c9ba6);};}function removeListener(_0x177460,_0x45d03a){return function(){SquareProjectEvents[_0x75d1('0x2')](_0x177460,_0x45d03a);};}exports[_0x75d1('0x3')]=function(_0x56ac0a){for(var _0x458681=0x0,_0x116a51=events[_0x75d1('0x4')];_0x458681<_0x116a51;_0x458681++){var _0x1ee61b=events[_0x458681];var _0x3a9d5e=createListener(_0x75d1('0x5')+_0x1ee61b,_0x56ac0a);SquareProjectEvents['on'](_0x1ee61b,_0x3a9d5e);}}; \ No newline at end of file +var _0x90b1=['save','remove','emit','length','squareProject:','./squareProject.events'];(function(_0x13b799,_0x3d9b3b){var _0x2d8e3f=function(_0x476a93){while(--_0x476a93){_0x13b799['push'](_0x13b799['shift']());}};_0x2d8e3f(++_0x3d9b3b);}(_0x90b1,0x1bb));var _0x190b=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0x90b1[_0x580971];return _0x16d873;};'use strict';var SquareProjectEvents=require(_0x190b('0x0'));var events=[_0x190b('0x1'),_0x190b('0x2'),'update'];function createListener(_0x487731,_0x1e5984){return function(_0x44ca85){_0x1e5984[_0x190b('0x3')](_0x487731,_0x44ca85);};}function removeListener(_0x120ddc,_0x4fbcad){return function(){SquareProjectEvents['removeListener'](_0x120ddc,_0x4fbcad);};}exports['register']=function(_0x5da9c1){for(var _0x27ff8c=0x0,_0x34a689=events[_0x190b('0x4')];_0x27ff8c<_0x34a689;_0x27ff8c++){var _0x626aa1=events[_0x27ff8c];var _0x311161=createListener(_0x190b('0x5')+_0x626aa1,_0x5da9c1);SquareProjectEvents['on'](_0x626aa1,_0x311161);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index a0bc9b0..27849f6 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 _0xa965=['show','/:id/download','download','post','put','/:id','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x3798d7,_0x58db01){var _0x308afa=function(_0x398818){while(--_0x398818){_0x3798d7['push'](_0x3798d7['shift']());}};_0x308afa(++_0x58db01);}(_0xa965,0x172));var _0x5a96=function(_0x51a58c,_0x5b0474){_0x51a58c=_0x51a58c-0x0;var _0x513149=_0xa965[_0x51a58c];return _0x513149;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5a96('0x0'));var express=require(_0x5a96('0x1'));var router=express[_0x5a96('0x2')]();var fs_extra=require(_0x5a96('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5a96('0x4'));var controller=require('./squareRecording.controller');router[_0x5a96('0x5')]('/',auth[_0x5a96('0x6')](),controller[_0x5a96('0x7')]);router[_0x5a96('0x5')]('/:id',auth[_0x5a96('0x6')](),controller[_0x5a96('0x8')]);router[_0x5a96('0x5')](_0x5a96('0x9'),auth['isAuthenticated'](),controller[_0x5a96('0xa')]);router[_0x5a96('0xb')]('/',auth[_0x5a96('0x6')](),controller['create']);router[_0x5a96('0xc')](_0x5a96('0xd'),auth[_0x5a96('0x6')](),controller[_0x5a96('0xe')]);router[_0x5a96('0xf')](_0x5a96('0xd'),auth[_0x5a96('0x6')](),controller[_0x5a96('0x10')]);module[_0x5a96('0x11')]=router; \ No newline at end of file +var _0x7918=['download','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','/:id','isAuthenticated'];(function(_0x5bcff1,_0x5d77f2){var _0x16f669=function(_0x483981){while(--_0x483981){_0x5bcff1['push'](_0x5bcff1['shift']());}};_0x16f669(++_0x5d77f2);}(_0x7918,0x1e1));var _0x8791=function(_0x42cde7,_0x10c434){_0x42cde7=_0x42cde7-0x0;var _0x1300d7=_0x7918[_0x42cde7];return _0x1300d7;};'use strict';var multer=require(_0x8791('0x0'));var util=require(_0x8791('0x1'));var path=require(_0x8791('0x2'));var timeout=require(_0x8791('0x3'));var express=require(_0x8791('0x4'));var router=express[_0x8791('0x5')]();var fs_extra=require(_0x8791('0x6'));var auth=require(_0x8791('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8791('0x8'));var controller=require(_0x8791('0x9'));router[_0x8791('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8791('0xb'),auth[_0x8791('0xc')](),controller['show']);router['get']('/:id/download',auth[_0x8791('0xc')](),controller[_0x8791('0xd')]);router[_0x8791('0xe')]('/',auth['isAuthenticated'](),controller[_0x8791('0xf')]);router[_0x8791('0x10')](_0x8791('0xb'),auth['isAuthenticated'](),controller[_0x8791('0x11')]);router['delete'](_0x8791('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8791('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 74739bc..9e2699c 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 _0x84ef=['STRING','VIRTUAL','savePath','substring','exports'];(function(_0x4ac4a1,_0x2e9361){var _0x5d5bb1=function(_0x2c1735){while(--_0x2c1735){_0x4ac4a1['push'](_0x4ac4a1['shift']());}};_0x5d5bb1(++_0x2e9361);}(_0x84ef,0x1d5));var _0xf84e=function(_0x896226,_0x525c80){_0x896226=_0x896226-0x0;var _0x34e3cd=_0x84ef[_0x896226];return _0x34e3cd;};'use strict';var Sequelize=require('sequelize');module[_0xf84e('0x0')]={'uniqueid':{'type':Sequelize[_0xf84e('0x1')]},'callerid':{'type':Sequelize[_0xf84e('0x1')]},'calleridname':{'type':Sequelize[_0xf84e('0x1')]},'context':{'type':Sequelize[_0xf84e('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf84e('0x1')]},'accountcode':{'type':Sequelize[_0xf84e('0x1')]},'dnid':{'type':Sequelize[_0xf84e('0x1')]},'projectName':{'type':Sequelize[_0xf84e('0x1')]},'saveName':{'type':Sequelize[_0xf84e('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf84e('0x2')],'get':function(){var _0x128a7c='';var _0x21fa60=this['getDataValue'](_0xf84e('0x3'));if(_0x21fa60){_0x128a7c=_0x21fa60[_0xf84e('0x4')](_0x21fa60['lastIndexOf']('.'));}return _0x128a7c;}}}; \ No newline at end of file +var _0x3e65=['getDataValue','lastIndexOf','sequelize','STRING'];(function(_0x4ab58b,_0xf68d15){var _0x5ef5b7=function(_0x2e0641){while(--_0x2e0641){_0x4ab58b['push'](_0x4ab58b['shift']());}};_0x5ef5b7(++_0xf68d15);}(_0x3e65,0xde));var _0x53e6=function(_0x26f531,_0x3d37c7){_0x26f531=_0x26f531-0x0;var _0x282820=_0x3e65[_0x26f531];return _0x282820;};'use strict';var Sequelize=require(_0x53e6('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x53e6('0x1')]},'callerid':{'type':Sequelize[_0x53e6('0x1')]},'calleridname':{'type':Sequelize[_0x53e6('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x53e6('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x53e6('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x53e6('0x1')]},'saveName':{'type':Sequelize[_0x53e6('0x1')]},'filename':{'type':Sequelize[_0x53e6('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3bc436='';var _0x17a288=this[_0x53e6('0x2')]('savePath');if(_0x17a288){_0x3bc436=_0x17a288['substring'](_0x17a288[_0x53e6('0x3')]('.'));}return _0x3bc436;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c113dca..e70a0ab 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 _0xcb10=['render','merge','body','message','agent','interaction','account','map','SquareRecording','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','model','nolimit','order','sort','filter','where','VIRTUAL','count','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','update','type','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','SquareRecording\x20not\x20found','download','extname','unlink','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','json','apply','save','then','destroy','error','stack','name'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xcb10,0x104));var _0x0cb1=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xcb10[_0x173441];return _0x2423a8;};'use strict';var emlformat=require(_0x0cb1('0x0'));var rimraf=require(_0x0cb1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cb1('0x2'));var rp=require(_0x0cb1('0x3'));var moment=require('moment');var BPromise=require(_0x0cb1('0x4'));var Mustache=require('mustache');var util=require(_0x0cb1('0x5'));var path=require(_0x0cb1('0x6'));var sox=require(_0x0cb1('0x7'));var csv=require(_0x0cb1('0x8'));var ejs=require(_0x0cb1('0x9'));var fs=require('fs');var fs_extra=require(_0x0cb1('0xa'));var _=require(_0x0cb1('0xb'));var squel=require(_0x0cb1('0xc'));var crypto=require('crypto');var jsforce=require(_0x0cb1('0xd'));var deskjs=require(_0x0cb1('0xe'));var toCsv=require(_0x0cb1('0x8'));var querystring=require(_0x0cb1('0xf'));var Papa=require(_0x0cb1('0x10'));var Redis=require(_0x0cb1('0x11'));var authService=require(_0x0cb1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0cb1('0x13'))(_0x0cb1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0cb1('0x15'))['db'];function respondWithStatusCode(_0x5ab983,_0x6b6477){_0x6b6477=_0x6b6477||0xcc;return function(_0x1c5680){if(_0x1c5680){return _0x5ab983[_0x0cb1('0x16')](_0x6b6477);}return _0x5ab983[_0x0cb1('0x17')](_0x6b6477)[_0x0cb1('0x18')]();};}function respondWithResult(_0x29ff45,_0x5144a8){_0x5144a8=_0x5144a8||0xc8;return function(_0x1a8d98){if(_0x1a8d98){return _0x29ff45[_0x0cb1('0x17')](_0x5144a8)['json'](_0x1a8d98);}};}function respondWithFilteredResult(_0x1053f6,_0x4eb8bc){return function(_0x3e6e6b){if(_0x3e6e6b){var _0x145cd4=typeof _0x4eb8bc['offset']===_0x0cb1('0x19')&&typeof _0x4eb8bc[_0x0cb1('0x1a')]===_0x0cb1('0x19');var _0x1f3434=_0x3e6e6b['count'];var _0x2cda93=_0x145cd4?0x0:_0x4eb8bc[_0x0cb1('0x1b')];var _0xe0488d=_0x145cd4?_0x3e6e6b['count']:_0x4eb8bc['offset']+_0x4eb8bc[_0x0cb1('0x1a')];var _0x109db9;if(_0xe0488d>=_0x1f3434){_0xe0488d=_0x1f3434;_0x109db9=0xc8;}else{_0x109db9=0xce;}_0x1053f6['status'](_0x109db9);return _0x1053f6[_0x0cb1('0x1c')]('Content-Range',_0x2cda93+'-'+_0xe0488d+'/'+_0x1f3434)[_0x0cb1('0x1d')](_0x3e6e6b);}return null;};}function patchUpdates(_0x5d77c2){return function(_0x29a2dc){try{jsonpatch[_0x0cb1('0x1e')](_0x29a2dc,_0x5d77c2,!![]);}catch(_0x39c2bb){return BPromise['reject'](_0x39c2bb);}return _0x29a2dc[_0x0cb1('0x1f')]();};}function saveUpdates(_0x1f4702,_0x95f9a){return function(_0x25598e){if(_0x25598e){return _0x25598e['update'](_0x1f4702)[_0x0cb1('0x20')](function(_0x5215d7){return _0x5215d7;});}return null;};}function removeEntity(_0xc177bf,_0x4eeccb){return function(_0x40b6a2){if(_0x40b6a2){return _0x40b6a2[_0x0cb1('0x21')]()[_0x0cb1('0x20')](function(){_0xc177bf[_0x0cb1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb9ac,_0x34289b){return function(_0x2cde9c){if(!_0x2cde9c){_0x2bb9ac[_0x0cb1('0x16')](0x194);}return _0x2cde9c;};}function handleError(_0x3db759,_0x421183){_0x421183=_0x421183||0x1f4;return function(_0x4a45b5){logger[_0x0cb1('0x22')](_0x4a45b5[_0x0cb1('0x23')]);if(_0x4a45b5[_0x0cb1('0x24')]){delete _0x4a45b5['name'];}_0x3db759[_0x0cb1('0x17')](_0x421183)['send'](_0x4a45b5);};}function getMustacheRender(_0x2de48a,_0x2fe61a){return Mustache[_0x0cb1('0x25')](_0x2de48a,_[_0x0cb1('0x26')](_0x2fe61a[_0x0cb1('0x27')],{'contact':_0x2fe61a['contact'],'message':_0x2fe61a[_0x0cb1('0x28')],'agent':_0x2fe61a[_0x0cb1('0x29')],'interaction':_0x2fe61a[_0x0cb1('0x2a')],'account':_0x2fe61a[_0x0cb1('0x2b')]}))||'';}exports['index']=function(_0x4fc65e,_0x3cbcc8){var _0x191cf5={},_0x269183={},_0x1dd093={'count':0x0,'rows':[]};var _0x2e9ff3=_[_0x0cb1('0x2c')](db[_0x0cb1('0x2d')][_0x0cb1('0x2e')],function(_0x36622f){return{'name':_0x36622f[_0x0cb1('0x2f')],'type':_0x36622f['type'][_0x0cb1('0x30')]};});_0x269183['model']=_['map'](_0x2e9ff3,_0x0cb1('0x24'));_0x269183[_0x0cb1('0x31')]=_[_0x0cb1('0x32')](_0x4fc65e[_0x0cb1('0x31')]);_0x269183[_0x0cb1('0x33')]=_[_0x0cb1('0x34')](_0x269183['model'],_0x269183[_0x0cb1('0x31')]);_0x191cf5[_0x0cb1('0x35')]=_[_0x0cb1('0x34')](_0x269183['model'],qs[_0x0cb1('0x36')](_0x4fc65e[_0x0cb1('0x31')][_0x0cb1('0x36')]));_0x191cf5[_0x0cb1('0x35')]=_0x191cf5[_0x0cb1('0x35')]['length']?_0x191cf5[_0x0cb1('0x35')]:_0x269183[_0x0cb1('0x37')];if(!_0x4fc65e['query']['hasOwnProperty'](_0x0cb1('0x38'))){_0x191cf5[_0x0cb1('0x1a')]=qs['limit'](_0x4fc65e['query']['limit']);_0x191cf5[_0x0cb1('0x1b')]=qs[_0x0cb1('0x1b')](_0x4fc65e[_0x0cb1('0x31')][_0x0cb1('0x1b')]);}_0x191cf5[_0x0cb1('0x39')]=qs[_0x0cb1('0x3a')](_0x4fc65e[_0x0cb1('0x31')][_0x0cb1('0x3a')]);_0x191cf5['where']=qs['filters'](_['pick'](_0x4fc65e[_0x0cb1('0x31')],_0x269183['filters']),_0x2e9ff3);if(_0x4fc65e[_0x0cb1('0x31')][_0x0cb1('0x3b')]){_0x191cf5[_0x0cb1('0x3c')]=_[_0x0cb1('0x26')](_0x191cf5[_0x0cb1('0x3c')],{'$or':_[_0x0cb1('0x2c')](_0x2e9ff3,function(_0x520930){if(_0x520930['type']!==_0x0cb1('0x3d')){var _0xd0a0f3={};_0xd0a0f3[_0x520930[_0x0cb1('0x24')]]={'$like':'%'+_0x4fc65e[_0x0cb1('0x31')][_0x0cb1('0x3b')]+'%'};return _0xd0a0f3;}})});}_0x191cf5=_['merge']({},_0x191cf5,_0x4fc65e['options']);var _0x5d8117={'where':_0x191cf5[_0x0cb1('0x3c')]};return db['SquareRecording'][_0x0cb1('0x3e')](_0x5d8117)[_0x0cb1('0x20')](function(_0xd4a85d){_0x1dd093[_0x0cb1('0x3e')]=_0xd4a85d;if(_0x4fc65e['query']['includeAll']){_0x191cf5[_0x0cb1('0x3f')]=[{'all':!![]}];}return db[_0x0cb1('0x2d')][_0x0cb1('0x40')](_0x191cf5);})[_0x0cb1('0x20')](function(_0x1a6c35){_0x1dd093[_0x0cb1('0x41')]=_0x1a6c35;return _0x1dd093;})[_0x0cb1('0x20')](respondWithFilteredResult(_0x3cbcc8,_0x191cf5))[_0x0cb1('0x42')](handleError(_0x3cbcc8,null));};exports[_0x0cb1('0x43')]=function(_0x217c28,_0x5cc3ab){var _0x4d3e28={'raw':!![],'where':{'id':_0x217c28[_0x0cb1('0x44')]['id']}},_0x4977eb={};_0x4977eb[_0x0cb1('0x37')]=_[_0x0cb1('0x32')](db['SquareRecording']['rawAttributes']);_0x4977eb[_0x0cb1('0x31')]=_[_0x0cb1('0x32')](_0x217c28[_0x0cb1('0x31')]);_0x4977eb[_0x0cb1('0x33')]=_[_0x0cb1('0x34')](_0x4977eb[_0x0cb1('0x37')],_0x4977eb[_0x0cb1('0x31')]);_0x4d3e28[_0x0cb1('0x35')]=_['intersection'](_0x4977eb[_0x0cb1('0x37')],qs[_0x0cb1('0x36')](_0x217c28[_0x0cb1('0x31')][_0x0cb1('0x36')]));_0x4d3e28[_0x0cb1('0x35')]=_0x4d3e28[_0x0cb1('0x35')][_0x0cb1('0x45')]?_0x4d3e28[_0x0cb1('0x35')]:_0x4977eb[_0x0cb1('0x37')];if(_0x217c28['query'][_0x0cb1('0x46')]){_0x4d3e28[_0x0cb1('0x3f')]=[{'all':!![]}];}_0x4d3e28=_[_0x0cb1('0x26')]({},_0x4d3e28,_0x217c28[_0x0cb1('0x47')]);return db['SquareRecording'][_0x0cb1('0x48')](_0x4d3e28)['then'](handleEntityNotFound(_0x5cc3ab,null))[_0x0cb1('0x20')](respondWithResult(_0x5cc3ab,null))[_0x0cb1('0x42')](handleError(_0x5cc3ab,null));};exports[_0x0cb1('0x49')]=function(_0x59021f,_0x3f2b91){return db['SquareRecording'][_0x0cb1('0x49')](_0x59021f[_0x0cb1('0x27')],{})[_0x0cb1('0x20')](respondWithResult(_0x3f2b91,0xc9))[_0x0cb1('0x42')](handleError(_0x3f2b91,null));};exports[_0x0cb1('0x4a')]=function(_0x431f1b,_0x3dc6bb){if(_0x431f1b['body']['id']){delete _0x431f1b['body']['id'];}return db[_0x0cb1('0x2d')][_0x0cb1('0x48')]({'where':{'id':_0x431f1b[_0x0cb1('0x44')]['id']}})[_0x0cb1('0x20')](handleEntityNotFound(_0x3dc6bb,null))[_0x0cb1('0x20')](saveUpdates(_0x431f1b[_0x0cb1('0x27')],null))[_0x0cb1('0x20')](respondWithResult(_0x3dc6bb,null))['catch'](handleError(_0x3dc6bb,null));};exports['download']=function(_0x337d6d,_0x7ad47f,_0xdb7b9f){var _0x450d5b=require('../../components/encryptor');var _0xc5d59b=![];var _0xabdac5={};if(_0x337d6d[_0x0cb1('0x31')][_0x0cb1('0x4b')]&&_0x337d6d[_0x0cb1('0x31')][_0x0cb1('0x4b')]===_0x0cb1('0x4c')){_0xabdac5[_0x0cb1('0x4c')]=_0x337d6d[_0x0cb1('0x44')]['id'];}else{_0xabdac5['id']=_0x337d6d[_0x0cb1('0x44')]['id'];}return db[_0x0cb1('0x2d')]['find']({'where':_0xabdac5,'attributes':['id',_0x0cb1('0x4d'),_0x0cb1('0x4e')],'raw':!![]})[_0x0cb1('0x20')](handleEntityNotFound(_0x7ad47f,null))['then'](function(_0x32ace6){if(_0x32ace6){var _0x2b1ca0=_0x32ace6[_0x0cb1('0x4d')];var _0x19c029=util[_0x0cb1('0x4f')](_0x0cb1('0x50'),_0x2b1ca0);if(fs['existsSync'](_0x19c029)){_0xc5d59b=!![];return _0x450d5b[_0x0cb1('0x51')](_0x19c029,_0x2b1ca0,config[_0x0cb1('0x52')][_0x0cb1('0x53')])[_0x0cb1('0x20')](function(){return _0x32ace6;});}return _0x32ace6;}})[_0x0cb1('0x20')](function(_0x499cdb){if(_0x499cdb){var _0x4207ab=_0x499cdb[_0x0cb1('0x4d')];if(!fs[_0x0cb1('0x54')](_0x4207ab)){throw new db['Sequelize']['ValidationError'](_0x0cb1('0x55'));}if(_0x499cdb['filename']){return _0x7ad47f[_0x0cb1('0x56')](_0x4207ab,_0x499cdb['filename']+path[_0x0cb1('0x57')](_0x4207ab),function(){if(_0xc5d59b){fs['unlink'](_0x4207ab);}});}else{return _0x7ad47f[_0x0cb1('0x56')](_0x4207ab,function(_0x417317){if(_0xc5d59b){fs[_0x0cb1('0x58')](_0x4207ab);}});}}})[_0x0cb1('0x42')](function(_0x133f7c){if(_0x133f7c[_0x0cb1('0x28')]===_0x0cb1('0x55')){_0x7ad47f[_0x0cb1('0x17')](0x194)[_0x0cb1('0x59')](_0x0cb1('0x5a'));}else{return handleError(_0x7ad47f,null);}});};exports[_0x0cb1('0x21')]=function(_0x10d231,_0x1fe009){return db['SquareRecording'][_0x0cb1('0x48')]({'where':{'id':_0x10d231['params']['id']}})[_0x0cb1('0x20')](function(_0x27b4ff){if(_[_0x0cb1('0x5b')](_0x27b4ff)){throw new ReferenceError(_0x0cb1('0x5c'));}return _0x27b4ff;})[_0x0cb1('0x20')](function(_0x5686fc){var _0x5a2390=_0x5686fc[_0x0cb1('0x4d')];logger[_0x0cb1('0x5d')](_0x0cb1('0x5e'),_0x5a2390);if(!_[_0x0cb1('0x5b')](_0x5686fc[_0x0cb1('0x4d')])&&fs[_0x0cb1('0x54')](_0x5a2390)){logger[_0x0cb1('0x5d')](_0x0cb1('0x5f')+_0x5a2390+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0cb1('0x60')](_0x5a2390);}_0x5a2390=_0x5a2390+_0x0cb1('0x61');if(!_[_0x0cb1('0x5b')](_0x5686fc[_0x0cb1('0x4d')])&&fs[_0x0cb1('0x54')](_0x5a2390)){logger[_0x0cb1('0x5d')]('File:\x20\x22'+_0x5a2390+_0x0cb1('0x62'));fs[_0x0cb1('0x60')](_0x5a2390);}return _0x5686fc;})[_0x0cb1('0x20')](function(_0x4ad389){if(!_0x4ad389)throw new InternalError();return _0x4ad389['destroy']();})[_0x0cb1('0x20')](function(){_0x1fe009[_0x0cb1('0x17')](0xcc)[_0x0cb1('0x18')]();})[_0x0cb1('0x42')](handleError(_0x1fe009,null));}; \ No newline at end of file +var _0x15b8=['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/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','render','merge','body','contact','message','agent','interaction','account','SquareRecording','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','filter','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','include','find','create','download','../../components/encryptor','filename','savePath','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','send','Not\x20found','destroy','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x23a4f6,_0x104a2d){var _0x187cd2=function(_0x5ad344){while(--_0x5ad344){_0x23a4f6['push'](_0x23a4f6['shift']());}};_0x187cd2(++_0x104a2d);}(_0x15b8,0xcd));var _0x815b=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x15b8[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x815b('0x0'));var zipdir=require(_0x815b('0x1'));var jsonpatch=require(_0x815b('0x2'));var rp=require(_0x815b('0x3'));var moment=require(_0x815b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x815b('0x5'));var util=require(_0x815b('0x6'));var path=require(_0x815b('0x7'));var sox=require(_0x815b('0x8'));var csv=require(_0x815b('0x9'));var ejs=require(_0x815b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x815b('0xb'));var squel=require(_0x815b('0xc'));var crypto=require(_0x815b('0xd'));var jsforce=require(_0x815b('0xe'));var deskjs=require(_0x815b('0xf'));var toCsv=require(_0x815b('0x9'));var querystring=require(_0x815b('0x10'));var Papa=require(_0x815b('0x11'));var Redis=require(_0x815b('0x12'));var authService=require(_0x815b('0x13'));var qs=require(_0x815b('0x14'));var as=require(_0x815b('0x15'));var hardwareService=require(_0x815b('0x16'));var logger=require(_0x815b('0x17'))(_0x815b('0x18'));var utils=require(_0x815b('0x19'));var config=require(_0x815b('0x1a'));var licenseUtil=require(_0x815b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d134a,_0x1ca5d5){_0x1ca5d5=_0x1ca5d5||0xcc;return function(_0x1d25ab){if(_0x1d25ab){return _0x4d134a['sendStatus'](_0x1ca5d5);}return _0x4d134a['status'](_0x1ca5d5)['end']();};}function respondWithResult(_0x25c1ed,_0x5c89eb){_0x5c89eb=_0x5c89eb||0xc8;return function(_0x5814ee){if(_0x5814ee){return _0x25c1ed[_0x815b('0x1c')](_0x5c89eb)[_0x815b('0x1d')](_0x5814ee);}};}function respondWithFilteredResult(_0x1f4aae,_0x59ea04){return function(_0x495431){if(_0x495431){var _0x14f14f=typeof _0x59ea04[_0x815b('0x1e')]===_0x815b('0x1f')&&typeof _0x59ea04[_0x815b('0x20')]===_0x815b('0x1f');var _0x114305=_0x495431[_0x815b('0x21')];var _0x92d86a=_0x14f14f?0x0:_0x59ea04[_0x815b('0x1e')];var _0x2fa2bd=_0x14f14f?_0x495431[_0x815b('0x21')]:_0x59ea04[_0x815b('0x1e')]+_0x59ea04[_0x815b('0x20')];var _0x4cd48b;if(_0x2fa2bd>=_0x114305){_0x2fa2bd=_0x114305;_0x4cd48b=0xc8;}else{_0x4cd48b=0xce;}_0x1f4aae[_0x815b('0x1c')](_0x4cd48b);return _0x1f4aae[_0x815b('0x22')](_0x815b('0x23'),_0x92d86a+'-'+_0x2fa2bd+'/'+_0x114305)[_0x815b('0x1d')](_0x495431);}return null;};}function patchUpdates(_0x3f710c){return function(_0x4acb47){try{jsonpatch[_0x815b('0x24')](_0x4acb47,_0x3f710c,!![]);}catch(_0x2f7f8b){return BPromise[_0x815b('0x25')](_0x2f7f8b);}return _0x4acb47['save']();};}function saveUpdates(_0x4f7a6a,_0x3ffdb7){return function(_0x2923ed){if(_0x2923ed){return _0x2923ed[_0x815b('0x26')](_0x4f7a6a)[_0x815b('0x27')](function(_0xe36d21){return _0xe36d21;});}return null;};}function removeEntity(_0x31ab20,_0x11f1c1){return function(_0x480c89){if(_0x480c89){return _0x480c89['destroy']()[_0x815b('0x27')](function(){_0x31ab20[_0x815b('0x1c')](0xcc)[_0x815b('0x28')]();});}};}function handleEntityNotFound(_0x15098a,_0x1486c6){return function(_0x3115c7){if(!_0x3115c7){_0x15098a[_0x815b('0x29')](0x194);}return _0x3115c7;};}function handleError(_0x26f465,_0x57345c){_0x57345c=_0x57345c||0x1f4;return function(_0x27b4e1){logger[_0x815b('0x2a')](_0x27b4e1[_0x815b('0x2b')]);if(_0x27b4e1['name']){delete _0x27b4e1[_0x815b('0x2c')];}_0x26f465[_0x815b('0x1c')](_0x57345c)['send'](_0x27b4e1);};}function getMustacheRender(_0x47e72f,_0x2b02cd){return Mustache[_0x815b('0x2d')](_0x47e72f,_[_0x815b('0x2e')](_0x2b02cd[_0x815b('0x2f')],{'contact':_0x2b02cd[_0x815b('0x30')],'message':_0x2b02cd[_0x815b('0x31')],'agent':_0x2b02cd[_0x815b('0x32')],'interaction':_0x2b02cd[_0x815b('0x33')],'account':_0x2b02cd[_0x815b('0x34')]}))||'';}exports['index']=function(_0x1ed8f1,_0x2ba2a3){var _0xa007e3={},_0x36a799={},_0xde518c={'count':0x0,'rows':[]};var _0x990382=_['map'](db[_0x815b('0x35')][_0x815b('0x36')],function(_0x20ccca){return{'name':_0x20ccca[_0x815b('0x37')],'type':_0x20ccca[_0x815b('0x38')]['key']};});_0x36a799[_0x815b('0x39')]=_['map'](_0x990382,_0x815b('0x2c'));_0x36a799[_0x815b('0x3a')]=_[_0x815b('0x3b')](_0x1ed8f1['query']);_0x36a799[_0x815b('0x3c')]=_['intersection'](_0x36a799['model'],_0x36a799['query']);_0xa007e3[_0x815b('0x3d')]=_['intersection'](_0x36a799[_0x815b('0x39')],qs['fields'](_0x1ed8f1[_0x815b('0x3a')][_0x815b('0x3e')]));_0xa007e3['attributes']=_0xa007e3[_0x815b('0x3d')]['length']?_0xa007e3['attributes']:_0x36a799[_0x815b('0x39')];if(!_0x1ed8f1[_0x815b('0x3a')][_0x815b('0x3f')]('nolimit')){_0xa007e3[_0x815b('0x20')]=qs[_0x815b('0x20')](_0x1ed8f1[_0x815b('0x3a')]['limit']);_0xa007e3[_0x815b('0x1e')]=qs[_0x815b('0x1e')](_0x1ed8f1[_0x815b('0x3a')]['offset']);}_0xa007e3[_0x815b('0x40')]=qs[_0x815b('0x41')](_0x1ed8f1[_0x815b('0x3a')][_0x815b('0x41')]);_0xa007e3[_0x815b('0x42')]=qs['filters'](_['pick'](_0x1ed8f1[_0x815b('0x3a')],_0x36a799['filters']),_0x990382);if(_0x1ed8f1['query'][_0x815b('0x43')]){_0xa007e3[_0x815b('0x42')]=_['merge'](_0xa007e3[_0x815b('0x42')],{'$or':_[_0x815b('0x44')](_0x990382,function(_0x3cf5ce){if(_0x3cf5ce[_0x815b('0x38')]!==_0x815b('0x45')){var _0x3f6587={};_0x3f6587[_0x3cf5ce[_0x815b('0x2c')]]={'$like':'%'+_0x1ed8f1['query'][_0x815b('0x43')]+'%'};return _0x3f6587;}})});}_0xa007e3=_[_0x815b('0x2e')]({},_0xa007e3,_0x1ed8f1[_0x815b('0x46')]);var _0x17f48f={'where':_0xa007e3[_0x815b('0x42')]};return db[_0x815b('0x35')]['count'](_0x17f48f)[_0x815b('0x27')](function(_0x3fc1fc){_0xde518c[_0x815b('0x21')]=_0x3fc1fc;if(_0x1ed8f1[_0x815b('0x3a')][_0x815b('0x47')]){_0xa007e3['include']=[{'all':!![]}];}return db[_0x815b('0x35')][_0x815b('0x48')](_0xa007e3);})[_0x815b('0x27')](function(_0x4f7ccf){_0xde518c[_0x815b('0x49')]=_0x4f7ccf;return _0xde518c;})['then'](respondWithFilteredResult(_0x2ba2a3,_0xa007e3))[_0x815b('0x4a')](handleError(_0x2ba2a3,null));};exports[_0x815b('0x4b')]=function(_0x40c4e8,_0x1071c1){var _0x33f220={'raw':!![],'where':{'id':_0x40c4e8[_0x815b('0x4c')]['id']}},_0x16945d={};_0x16945d['model']=_[_0x815b('0x3b')](db['SquareRecording'][_0x815b('0x36')]);_0x16945d[_0x815b('0x3a')]=_[_0x815b('0x3b')](_0x40c4e8[_0x815b('0x3a')]);_0x16945d[_0x815b('0x3c')]=_[_0x815b('0x4d')](_0x16945d[_0x815b('0x39')],_0x16945d['query']);_0x33f220[_0x815b('0x3d')]=_[_0x815b('0x4d')](_0x16945d['model'],qs[_0x815b('0x3e')](_0x40c4e8[_0x815b('0x3a')][_0x815b('0x3e')]));_0x33f220[_0x815b('0x3d')]=_0x33f220[_0x815b('0x3d')][_0x815b('0x4e')]?_0x33f220[_0x815b('0x3d')]:_0x16945d[_0x815b('0x39')];if(_0x40c4e8['query'][_0x815b('0x47')]){_0x33f220[_0x815b('0x4f')]=[{'all':!![]}];}_0x33f220=_[_0x815b('0x2e')]({},_0x33f220,_0x40c4e8[_0x815b('0x46')]);return db['SquareRecording'][_0x815b('0x50')](_0x33f220)[_0x815b('0x27')](handleEntityNotFound(_0x1071c1,null))[_0x815b('0x27')](respondWithResult(_0x1071c1,null))[_0x815b('0x4a')](handleError(_0x1071c1,null));};exports[_0x815b('0x51')]=function(_0x10dc8d,_0x58ac9b){return db[_0x815b('0x35')][_0x815b('0x51')](_0x10dc8d[_0x815b('0x2f')],{})['then'](respondWithResult(_0x58ac9b,0xc9))['catch'](handleError(_0x58ac9b,null));};exports['update']=function(_0x4bc43f,_0x372128){if(_0x4bc43f['body']['id']){delete _0x4bc43f[_0x815b('0x2f')]['id'];}return db[_0x815b('0x35')]['find']({'where':{'id':_0x4bc43f[_0x815b('0x4c')]['id']}})[_0x815b('0x27')](handleEntityNotFound(_0x372128,null))[_0x815b('0x27')](saveUpdates(_0x4bc43f[_0x815b('0x2f')],null))[_0x815b('0x27')](respondWithResult(_0x372128,null))[_0x815b('0x4a')](handleError(_0x372128,null));};exports[_0x815b('0x52')]=function(_0x52aa0a,_0x266803,_0x2b6f71){var _0x3c9c87=require(_0x815b('0x53'));var _0x53aeb0=![];var _0x991211={};if(_0x52aa0a[_0x815b('0x3a')][_0x815b('0x38')]&&_0x52aa0a[_0x815b('0x3a')][_0x815b('0x38')]==='uniqueid'){_0x991211['uniqueid']=_0x52aa0a['params']['id'];}else{_0x991211['id']=_0x52aa0a[_0x815b('0x4c')]['id'];}return db['SquareRecording']['find']({'where':_0x991211,'attributes':['id','savePath',_0x815b('0x54')],'raw':!![]})[_0x815b('0x27')](handleEntityNotFound(_0x266803,null))[_0x815b('0x27')](function(_0x375fcb){if(_0x375fcb){var _0x44646f=_0x375fcb[_0x815b('0x55')];var _0x52a465=util[_0x815b('0x56')](_0x815b('0x57'),_0x44646f);if(fs[_0x815b('0x58')](_0x52a465)){_0x53aeb0=!![];return _0x3c9c87[_0x815b('0x59')](_0x52a465,_0x44646f,config['secrets'][_0x815b('0x5a')])['then'](function(){return _0x375fcb;});}return _0x375fcb;}})[_0x815b('0x27')](function(_0x319b15){if(_0x319b15){var _0x5d1429=_0x319b15[_0x815b('0x55')];if(!fs[_0x815b('0x58')](_0x5d1429)){throw new db[(_0x815b('0x5b'))][(_0x815b('0x5c'))](_0x815b('0x5d'));}if(_0x319b15['filename']){return _0x266803[_0x815b('0x52')](_0x5d1429,_0x319b15[_0x815b('0x54')]+path[_0x815b('0x5e')](_0x5d1429),function(){if(_0x53aeb0){fs[_0x815b('0x5f')](_0x5d1429);}});}else{return _0x266803[_0x815b('0x52')](_0x5d1429,function(_0x122bba){if(_0x53aeb0){fs[_0x815b('0x5f')](_0x5d1429);}});}}})[_0x815b('0x4a')](function(_0x1917b2){if(_0x1917b2[_0x815b('0x31')]===_0x815b('0x5d')){_0x266803[_0x815b('0x1c')](0x194)[_0x815b('0x60')](_0x815b('0x61'));}else{return handleError(_0x266803,null);}});};exports[_0x815b('0x62')]=function(_0xabe6a5,_0x5607c9){return db[_0x815b('0x35')][_0x815b('0x50')]({'where':{'id':_0xabe6a5['params']['id']}})[_0x815b('0x27')](function(_0x11e84e){if(_[_0x815b('0x63')](_0x11e84e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x11e84e;})[_0x815b('0x27')](function(_0x27ecff){var _0x27d89b=_0x27ecff[_0x815b('0x55')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x27d89b);if(!_[_0x815b('0x63')](_0x27ecff[_0x815b('0x55')])&&fs[_0x815b('0x58')](_0x27d89b)){logger[_0x815b('0x64')](_0x815b('0x65')+_0x27d89b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x815b('0x66')](_0x27d89b);}_0x27d89b=_0x27d89b+_0x815b('0x67');if(!_[_0x815b('0x63')](_0x27ecff[_0x815b('0x55')])&&fs[_0x815b('0x58')](_0x27d89b)){logger[_0x815b('0x64')](_0x815b('0x65')+_0x27d89b+_0x815b('0x68'));fs['unlinkSync'](_0x27d89b);}return _0x27ecff;})['then'](function(_0x34a7a0){if(!_0x34a7a0)throw new InternalError();return _0x34a7a0[_0x815b('0x62')]();})[_0x815b('0x27')](function(){_0x5607c9[_0x815b('0x1c')](0xcc)[_0x815b('0x28')]();})[_0x815b('0x4a')](handleError(_0x5607c9,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index fa16006..f46d983 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 _0x69d4=['util','api','moment','bluebird','path','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash'];(function(_0x18612c,_0x4e86fa){var _0xd78d71=function(_0x17511a){while(--_0x17511a){_0x18612c['push'](_0x18612c['shift']());}};_0xd78d71(++_0x4e86fa);}(_0x69d4,0x83));var _0x469d=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x69d4[_0x16db8b];return _0x5ba017;};'use strict';var _=require(_0x469d('0x0'));var util=require(_0x469d('0x1'));var logger=require('../../config/logger')(_0x469d('0x2'));var moment=require(_0x469d('0x3'));var BPromise=require(_0x469d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x469d('0x5'));var rimraf=require('rimraf');var config=require(_0x469d('0x6'));var attributes=require(_0x469d('0x7'));module[_0x469d('0x8')]=function(_0x336101,_0x3d0ec8){return _0x336101[_0x469d('0x9')]('SquareRecording',attributes,{'tableName':_0x469d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47d6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','lodash','util','../../config/logger'];(function(_0x5f0879,_0xb09fb5){var _0x562897=function(_0x525d43){while(--_0x525d43){_0x5f0879['push'](_0x5f0879['shift']());}};_0x562897(++_0xb09fb5);}(_0x47d6,0x13f));var _0x647d=function(_0xba2c0b,_0x117f50){_0xba2c0b=_0xba2c0b-0x0;var _0xba5637=_0x47d6[_0xba2c0b];return _0xba5637;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var logger=require(_0x647d('0x2'))(_0x647d('0x3'));var moment=require(_0x647d('0x4'));var BPromise=require(_0x647d('0x5'));var rp=require(_0x647d('0x6'));var fs=require('fs');var path=require(_0x647d('0x7'));var rimraf=require(_0x647d('0x8'));var config=require(_0x647d('0x9'));var attributes=require(_0x647d('0xa'));module[_0x647d('0xb')]=function(_0x8a0753,_0x8ffe2b){return _0x8a0753[_0x647d('0xc')](_0x647d('0xd'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index f544825..84c8dec 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 _0x13c7=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x13c7,0x1af));var _0x713c=function(_0x32eda1,_0x291aa7){_0x32eda1=_0x32eda1-0x0;var _0x7e145a=_0x13c7[_0x32eda1];return _0x7e145a;};'use strict';var _=require(_0x713c('0x0'));var util=require('util');var moment=require(_0x713c('0x1'));var BPromise=require(_0x713c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x713c('0x3'));var db=require(_0x713c('0x4'))['db'];var utils=require(_0x713c('0x5'));var logger=require('../../config/logger')(_0x713c('0x6'));var config=require(_0x713c('0x7'));var jayson=require(_0x713c('0x8'));var client=jayson[_0x713c('0x9')][_0x713c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ab1ae,_0x3d4341,_0x2a1731){return new BPromise(function(_0x3faa5a,_0x4d979a){return client['request'](_0x1ab1ae,_0x2a1731)[_0x713c('0xb')](function(_0xed0077){logger[_0x713c('0xc')](_0x713c('0xd'),_0x3d4341,_0x713c('0xe'));logger[_0x713c('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3d4341,_0x713c('0xe'),JSON[_0x713c('0x10')](_0xed0077));if(_0xed0077[_0x713c('0x11')]){if(_0xed0077[_0x713c('0x11')][_0x713c('0x12')]===0x1f4){logger['error'](_0x713c('0xd'),_0x3d4341,_0xed0077[_0x713c('0x11')][_0x713c('0x13')]);return _0x4d979a(_0xed0077[_0x713c('0x11')][_0x713c('0x13')]);}logger[_0x713c('0x11')](_0x713c('0xd'),_0x3d4341,_0xed0077[_0x713c('0x11')]['message']);return _0x3faa5a(_0xed0077[_0x713c('0x11')][_0x713c('0x13')]);}else{logger['info'](_0x713c('0xd'),_0x3d4341,_0x713c('0xe'));_0x3faa5a(_0xed0077['result'][_0x713c('0x13')]);}})[_0x713c('0x14')](function(_0x3bd64c){logger[_0x713c('0x11')](_0x713c('0xd'),_0x3d4341,_0x3bd64c);_0x4d979a(_0x3bd64c);});});}exports[_0x713c('0x15')]=function(_0x2a778c){var _0x201d89=this;return new Promise(function(_0x58065d,_0x448e02){return db[_0x713c('0x16')]['create'](_0x2a778c[_0x713c('0x17')],{'raw':_0x2a778c[_0x713c('0x18')]?_0x2a778c[_0x713c('0x18')][_0x713c('0x19')]===undefined?!![]:![]:!![]})[_0x713c('0xb')](function(_0xe1099f){logger[_0x713c('0xc')](_0x713c('0x15'),_0x2a778c);logger['debug'](_0x713c('0x15'),_0x2a778c,JSON['stringify'](_0xe1099f));_0x58065d(_0xe1099f);})['catch'](function(_0x495165){logger[_0x713c('0x11')](_0x713c('0x15'),_0x495165[_0x713c('0x13')],_0x2a778c);_0x448e02(_0x201d89['error'](0x1f4,_0x495165[_0x713c('0x13')]));});});}; \ No newline at end of file +var _0x04ba=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','util','moment','bluebird'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x04ba,0x1bf));var _0xa04b=function(_0x23c741,_0x4ed6f2){_0x23c741=_0x23c741-0x0;var _0x3bed53=_0x04ba[_0x23c741];return _0x3bed53;};'use strict';var _=require('lodash');var util=require(_0xa04b('0x0'));var moment=require(_0xa04b('0x1'));var BPromise=require(_0xa04b('0x2'));var rs=require(_0xa04b('0x3'));var fs=require('fs');var Redis=require(_0xa04b('0x4'));var db=require(_0xa04b('0x5'))['db'];var utils=require(_0xa04b('0x6'));var logger=require(_0xa04b('0x7'))(_0xa04b('0x8'));var config=require(_0xa04b('0x9'));var jayson=require(_0xa04b('0xa'));var client=jayson[_0xa04b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36d5d6,_0x11f589,_0x263271){return new BPromise(function(_0x3a865e,_0x43e57a){return client['request'](_0x36d5d6,_0x263271)['then'](function(_0x2e0670){logger[_0xa04b('0xc')](_0xa04b('0xd'),_0x11f589,_0xa04b('0xe'));logger[_0xa04b('0xf')](_0xa04b('0x10'),_0x11f589,_0xa04b('0xe'),JSON[_0xa04b('0x11')](_0x2e0670));if(_0x2e0670[_0xa04b('0x12')]){if(_0x2e0670[_0xa04b('0x12')][_0xa04b('0x13')]===0x1f4){logger[_0xa04b('0x12')](_0xa04b('0xd'),_0x11f589,_0x2e0670[_0xa04b('0x12')][_0xa04b('0x14')]);return _0x43e57a(_0x2e0670[_0xa04b('0x12')][_0xa04b('0x14')]);}logger[_0xa04b('0x12')](_0xa04b('0xd'),_0x11f589,_0x2e0670[_0xa04b('0x12')][_0xa04b('0x14')]);return _0x3a865e(_0x2e0670[_0xa04b('0x12')][_0xa04b('0x14')]);}else{logger[_0xa04b('0xc')](_0xa04b('0xd'),_0x11f589,_0xa04b('0xe'));_0x3a865e(_0x2e0670[_0xa04b('0x15')][_0xa04b('0x14')]);}})[_0xa04b('0x16')](function(_0x2fbf70){logger[_0xa04b('0x12')](_0xa04b('0xd'),_0x11f589,_0x2fbf70);_0x43e57a(_0x2fbf70);});});}exports[_0xa04b('0x17')]=function(_0x4d9008){var _0x6f4bcb=this;return new Promise(function(_0x31d0f6,_0x151725){return db[_0xa04b('0x18')][_0xa04b('0x19')](_0x4d9008[_0xa04b('0x1a')],{'raw':_0x4d9008[_0xa04b('0x1b')]?_0x4d9008[_0xa04b('0x1b')][_0xa04b('0x1c')]===undefined?!![]:![]:!![]})[_0xa04b('0x1d')](function(_0x170763){logger[_0xa04b('0xc')](_0xa04b('0x17'),_0x4d9008);logger[_0xa04b('0xf')]('CreateSquareRecording',_0x4d9008,JSON[_0xa04b('0x11')](_0x170763));_0x31d0f6(_0x170763);})['catch'](function(_0x114f0d){logger[_0xa04b('0x12')]('CreateSquareRecording',_0x114f0d['message'],_0x4d9008);_0x151725(_0x6f4bcb['error'](0x1f4,_0x114f0d[_0xa04b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 5c57082..48c386c 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 _0x5c13=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x1003fe,_0x4a52ca){var _0x454197=function(_0x100f98){while(--_0x100f98){_0x1003fe['push'](_0x1003fe['shift']());}};_0x454197(++_0x4a52ca);}(_0x5c13,0x103));var _0x35c1=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x5c13[_0x5a26f5];return _0x2e9ef7;};'use strict';var multer=require(_0x35c1('0x0'));var util=require(_0x35c1('0x1'));var path=require(_0x35c1('0x2'));var timeout=require(_0x35c1('0x3'));var express=require(_0x35c1('0x4'));var router=express[_0x35c1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x35c1('0x6'));var interaction=require(_0x35c1('0x7'));var config=require('../../config/environment');var controller=require(_0x35c1('0x8'));router[_0x35c1('0x9')]('/',auth[_0x35c1('0xa')](),controller['index']);router[_0x35c1('0x9')](_0x35c1('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x35c1('0x9')](_0x35c1('0xc'),auth[_0x35c1('0xa')](),controller[_0x35c1('0xd')]);router[_0x35c1('0xe')]('/',auth['isAuthenticated'](),controller[_0x35c1('0xf')]);router[_0x35c1('0x10')](_0x35c1('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x35c1('0x11')](_0x35c1('0xc'),auth[_0x35c1('0xa')](),controller[_0x35c1('0x12')]);module[_0x35c1('0x13')]=router; \ No newline at end of file +var _0x26f0=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','put','/:id','update','delete','exports','multer','util','path'];(function(_0x39aa89,_0x1a5c2b){var _0x3313b3=function(_0x48d502){while(--_0x48d502){_0x39aa89['push'](_0x39aa89['shift']());}};_0x3313b3(++_0x1a5c2b);}(_0x26f0,0xf4));var _0x026f=function(_0x51d5ae,_0x1224e6){_0x51d5ae=_0x51d5ae-0x0;var _0x1a6fd9=_0x26f0[_0x51d5ae];return _0x1a6fd9;};'use strict';var multer=require(_0x026f('0x0'));var util=require(_0x026f('0x1'));var path=require(_0x026f('0x2'));var timeout=require(_0x026f('0x3'));var express=require('express');var router=express[_0x026f('0x4')]();var fs_extra=require(_0x026f('0x5'));var auth=require(_0x026f('0x6'));var interaction=require(_0x026f('0x7'));var config=require(_0x026f('0x8'));var controller=require('./squareReport.controller');router[_0x026f('0x9')]('/',auth['isAuthenticated'](),controller[_0x026f('0xa')]);router['get'](_0x026f('0xb'),auth[_0x026f('0xc')](),controller['describe']);router[_0x026f('0x9')]('/:id',auth[_0x026f('0xc')](),controller[_0x026f('0xd')]);router['post']('/',auth[_0x026f('0xc')](),controller['create']);router[_0x026f('0xe')](_0x026f('0xf'),auth[_0x026f('0xc')](),controller[_0x026f('0x10')]);router[_0x026f('0x11')](_0x026f('0xf'),auth[_0x026f('0xc')](),controller['destroy']);module[_0x026f('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index abedcb1..ef93027 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 _0xc168=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2e0b1e,_0x2e6050){var _0xbfe797=function(_0x51fd75){while(--_0x51fd75){_0x2e0b1e['push'](_0x2e0b1e['shift']());}};_0xbfe797(++_0x2e6050);}(_0xc168,0xb3));var _0x8c16=function(_0x5abf56,_0x41b7ff){_0x5abf56=_0x5abf56-0x0;var _0x438c20=_0xc168[_0x5abf56];return _0x438c20;};'use strict';var Sequelize=require(_0x8c16('0x0'));module[_0x8c16('0x1')]={'network':{'type':Sequelize[_0x8c16('0x2')]},'network_script':{'type':Sequelize[_0x8c16('0x2')]},'request':{'type':Sequelize[_0x8c16('0x2')]},'channel':{'type':Sequelize[_0x8c16('0x2')]},'language':{'type':Sequelize[_0x8c16('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8c16('0x2')]},'version':{'type':Sequelize[_0x8c16('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x8c16('0x2')]},'callingani2':{'type':Sequelize[_0x8c16('0x2')]},'callington':{'type':Sequelize[_0x8c16('0x2')]},'callingtns':{'type':Sequelize[_0x8c16('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x8c16('0x2')]},'context':{'type':Sequelize[_0x8c16('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8c16('0x2')]},'enhanced':{'type':Sequelize[_0x8c16('0x2')]},'accountcode':{'type':Sequelize[_0x8c16('0x2')]},'threadid':{'type':Sequelize[_0x8c16('0x2')]},'project_name':{'type':Sequelize[_0x8c16('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x8c16('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd45e=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x2e2845,_0x582e64){var _0x448695=function(_0x1b5582){while(--_0x1b5582){_0x2e2845['push'](_0x2e2845['shift']());}};_0x448695(++_0x582e64);}(_0xd45e,0x1a8));var _0xed45=function(_0x5dcafc,_0x345cf6){_0x5dcafc=_0x5dcafc-0x0;var _0x2d9add=_0xd45e[_0x5dcafc];return _0x2d9add;};'use strict';var Sequelize=require(_0xed45('0x0'));module[_0xed45('0x1')]={'network':{'type':Sequelize[_0xed45('0x2')]},'network_script':{'type':Sequelize[_0xed45('0x2')]},'request':{'type':Sequelize[_0xed45('0x2')]},'channel':{'type':Sequelize[_0xed45('0x2')]},'language':{'type':Sequelize[_0xed45('0x2')]},'type':{'type':Sequelize[_0xed45('0x2')]},'uniqueid':{'type':Sequelize[_0xed45('0x2')]},'version':{'type':Sequelize[_0xed45('0x2')]},'callerid':{'type':Sequelize[_0xed45('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xed45('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xed45('0x2')]},'dnid':{'type':Sequelize[_0xed45('0x2')]},'rdnis':{'type':Sequelize[_0xed45('0x2')]},'context':{'type':Sequelize[_0xed45('0x2')]},'extension':{'type':Sequelize[_0xed45('0x2')]},'priority':{'type':Sequelize[_0xed45('0x2')]},'enhanced':{'type':Sequelize[_0xed45('0x2')]},'accountcode':{'type':Sequelize[_0xed45('0x2')]},'threadid':{'type':Sequelize[_0xed45('0x2')]},'project_name':{'type':Sequelize[_0xed45('0x2')]},'joinAt':{'type':Sequelize[_0xed45('0x3')]},'leaveAt':{'type':Sequelize[_0xed45('0x3')]},'bot':{'type':Sequelize[_0xed45('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 76bc65f..170c828 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 _0xaf60=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','send','merge','body','interaction','account','map','SquareReport','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','find','catch','create','describe','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf60,0x82));var _0x0af6=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xaf60[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x0af6('0x0'));var rimraf=require(_0x0af6('0x1'));var zipdir=require(_0x0af6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0af6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0af6('0x4'));var path=require(_0x0af6('0x5'));var sox=require(_0x0af6('0x6'));var csv=require(_0x0af6('0x7'));var ejs=require(_0x0af6('0x8'));var fs=require('fs');var fs_extra=require(_0x0af6('0x9'));var _=require(_0x0af6('0xa'));var squel=require('squel');var crypto=require(_0x0af6('0xb'));var jsforce=require(_0x0af6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0af6('0x7'));var querystring=require(_0x0af6('0xd'));var Papa=require(_0x0af6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0af6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0af6('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x0af6('0x11'));var licenseUtil=require(_0x0af6('0x12'));var db=require(_0x0af6('0x13'))['db'];function respondWithStatusCode(_0x478df5,_0x1a51ed){_0x1a51ed=_0x1a51ed||0xcc;return function(_0x30a734){if(_0x30a734){return _0x478df5[_0x0af6('0x14')](_0x1a51ed);}return _0x478df5['status'](_0x1a51ed)[_0x0af6('0x15')]();};}function respondWithResult(_0x578485,_0x29bff0){_0x29bff0=_0x29bff0||0xc8;return function(_0x4ed1aa){if(_0x4ed1aa){return _0x578485[_0x0af6('0x16')](_0x29bff0)[_0x0af6('0x17')](_0x4ed1aa);}};}function respondWithFilteredResult(_0x1f9733,_0x3ccdd9){return function(_0x53fb83){if(_0x53fb83){var _0x57a725=typeof _0x3ccdd9['offset']==='undefined'&&typeof _0x3ccdd9['limit']===_0x0af6('0x18');var _0x2509e5=_0x53fb83[_0x0af6('0x19')];var _0x2bd5c0=_0x57a725?0x0:_0x3ccdd9['offset'];var _0x57511e=_0x57a725?_0x53fb83[_0x0af6('0x19')]:_0x3ccdd9[_0x0af6('0x1a')]+_0x3ccdd9['limit'];var _0xae2c02;if(_0x57511e>=_0x2509e5){_0x57511e=_0x2509e5;_0xae2c02=0xc8;}else{_0xae2c02=0xce;}_0x1f9733[_0x0af6('0x16')](_0xae2c02);return _0x1f9733['set'](_0x0af6('0x1b'),_0x2bd5c0+'-'+_0x57511e+'/'+_0x2509e5)[_0x0af6('0x17')](_0x53fb83);}return null;};}function patchUpdates(_0x2bac00){return function(_0x5908bd){try{jsonpatch[_0x0af6('0x1c')](_0x5908bd,_0x2bac00,!![]);}catch(_0xd27ac0){return BPromise[_0x0af6('0x1d')](_0xd27ac0);}return _0x5908bd['save']();};}function saveUpdates(_0x48a50f,_0x4adb2b){return function(_0xfd5351){if(_0xfd5351){return _0xfd5351[_0x0af6('0x1e')](_0x48a50f)[_0x0af6('0x1f')](function(_0x2879e3){return _0x2879e3;});}return null;};}function removeEntity(_0x4b3acc,_0x3aae56){return function(_0x2083df){if(_0x2083df){return _0x2083df[_0x0af6('0x20')]()[_0x0af6('0x1f')](function(){_0x4b3acc['status'](0xcc)[_0x0af6('0x15')]();});}};}function handleEntityNotFound(_0x34508e,_0x4923ab){return function(_0x2c670e){if(!_0x2c670e){_0x34508e['sendStatus'](0x194);}return _0x2c670e;};}function handleError(_0x5fbff4,_0x43e44d){_0x43e44d=_0x43e44d||0x1f4;return function(_0x39281d){logger[_0x0af6('0x21')](_0x39281d[_0x0af6('0x22')]);if(_0x39281d['name']){delete _0x39281d['name'];}_0x5fbff4['status'](_0x43e44d)[_0x0af6('0x23')](_0x39281d);};}function getMustacheRender(_0x357b1e,_0x197427){return Mustache['render'](_0x357b1e,_[_0x0af6('0x24')](_0x197427[_0x0af6('0x25')],{'contact':_0x197427['contact'],'message':_0x197427['message'],'agent':_0x197427['agent'],'interaction':_0x197427[_0x0af6('0x26')],'account':_0x197427[_0x0af6('0x27')]}))||'';}exports['index']=function(_0x412388,_0xd75dea){var _0x4673b8={},_0x1dc221={},_0x53ec8a={'count':0x0,'rows':[]};var _0x56b787=_[_0x0af6('0x28')](db[_0x0af6('0x29')]['rawAttributes'],function(_0x5d9dda){return{'name':_0x5d9dda[_0x0af6('0x2a')],'type':_0x5d9dda[_0x0af6('0x2b')][_0x0af6('0x2c')]};});_0x1dc221['model']=_['map'](_0x56b787,_0x0af6('0x2d'));_0x1dc221[_0x0af6('0x2e')]=_[_0x0af6('0x2f')](_0x412388['query']);_0x1dc221[_0x0af6('0x30')]=_[_0x0af6('0x31')](_0x1dc221['model'],_0x1dc221['query']);_0x4673b8['attributes']=_[_0x0af6('0x31')](_0x1dc221[_0x0af6('0x32')],qs[_0x0af6('0x33')](_0x412388[_0x0af6('0x2e')][_0x0af6('0x33')]));_0x4673b8['attributes']=_0x4673b8[_0x0af6('0x34')][_0x0af6('0x35')]?_0x4673b8[_0x0af6('0x34')]:_0x1dc221[_0x0af6('0x32')];if(!_0x412388['query'][_0x0af6('0x36')]('nolimit')){_0x4673b8[_0x0af6('0x37')]=qs['limit'](_0x412388['query'][_0x0af6('0x37')]);_0x4673b8[_0x0af6('0x1a')]=qs[_0x0af6('0x1a')](_0x412388[_0x0af6('0x2e')][_0x0af6('0x1a')]);}_0x4673b8[_0x0af6('0x38')]=qs[_0x0af6('0x39')](_0x412388[_0x0af6('0x2e')][_0x0af6('0x39')]);_0x4673b8[_0x0af6('0x3a')]=qs[_0x0af6('0x30')](_[_0x0af6('0x3b')](_0x412388[_0x0af6('0x2e')],_0x1dc221[_0x0af6('0x30')]),_0x56b787);if(_0x412388[_0x0af6('0x2e')][_0x0af6('0x3c')]){_0x4673b8[_0x0af6('0x3a')]=_[_0x0af6('0x24')](_0x4673b8[_0x0af6('0x3a')],{'$or':_[_0x0af6('0x28')](_0x56b787,function(_0x367819){if(_0x367819[_0x0af6('0x2b')]!==_0x0af6('0x3d')){var _0x382cc6={};_0x382cc6[_0x367819[_0x0af6('0x2d')]]={'$like':'%'+_0x412388[_0x0af6('0x2e')]['filter']+'%'};return _0x382cc6;}})});}_0x4673b8=_['merge']({},_0x4673b8,_0x412388[_0x0af6('0x3e')]);var _0xba11d6={'where':_0x4673b8[_0x0af6('0x3a')]};return db[_0x0af6('0x29')][_0x0af6('0x19')](_0xba11d6)[_0x0af6('0x1f')](function(_0x59b52e){_0x53ec8a[_0x0af6('0x19')]=_0x59b52e;if(_0x412388[_0x0af6('0x2e')][_0x0af6('0x3f')]){_0x4673b8['include']=[{'all':!![]}];}return db[_0x0af6('0x29')][_0x0af6('0x40')](_0x4673b8);})[_0x0af6('0x1f')](function(_0xda1e31){_0x53ec8a[_0x0af6('0x41')]=_0xda1e31;return _0x53ec8a;})['then'](respondWithFilteredResult(_0xd75dea,_0x4673b8))['catch'](handleError(_0xd75dea,null));};exports['show']=function(_0x531c6d,_0x5a3715){var _0x1c2c46={'raw':!![],'where':{'id':_0x531c6d[_0x0af6('0x42')]['id']}},_0x1d09e0={};_0x1d09e0[_0x0af6('0x32')]=_[_0x0af6('0x2f')](db[_0x0af6('0x29')][_0x0af6('0x43')]);_0x1d09e0[_0x0af6('0x2e')]=_['keys'](_0x531c6d[_0x0af6('0x2e')]);_0x1d09e0[_0x0af6('0x30')]=_[_0x0af6('0x31')](_0x1d09e0[_0x0af6('0x32')],_0x1d09e0[_0x0af6('0x2e')]);_0x1c2c46[_0x0af6('0x34')]=_['intersection'](_0x1d09e0[_0x0af6('0x32')],qs[_0x0af6('0x33')](_0x531c6d[_0x0af6('0x2e')]['fields']));_0x1c2c46[_0x0af6('0x34')]=_0x1c2c46[_0x0af6('0x34')]['length']?_0x1c2c46[_0x0af6('0x34')]:_0x1d09e0['model'];if(_0x531c6d[_0x0af6('0x2e')]['includeAll']){_0x1c2c46[_0x0af6('0x44')]=[{'all':!![]}];}_0x1c2c46=_[_0x0af6('0x24')]({},_0x1c2c46,_0x531c6d[_0x0af6('0x3e')]);return db[_0x0af6('0x29')][_0x0af6('0x45')](_0x1c2c46)['then'](handleEntityNotFound(_0x5a3715,null))[_0x0af6('0x1f')](respondWithResult(_0x5a3715,null))[_0x0af6('0x46')](handleError(_0x5a3715,null));};exports[_0x0af6('0x47')]=function(_0x5a585b,_0xa92498){return db['SquareReport'][_0x0af6('0x47')](_0x5a585b[_0x0af6('0x25')],{})[_0x0af6('0x1f')](respondWithResult(_0xa92498,0xc9))['catch'](handleError(_0xa92498,null));};exports['update']=function(_0x3ff5f4,_0x54e87a){if(_0x3ff5f4['body']['id']){delete _0x3ff5f4[_0x0af6('0x25')]['id'];}return db[_0x0af6('0x29')][_0x0af6('0x45')]({'where':{'id':_0x3ff5f4[_0x0af6('0x42')]['id']}})['then'](handleEntityNotFound(_0x54e87a,null))[_0x0af6('0x1f')](saveUpdates(_0x3ff5f4[_0x0af6('0x25')],null))[_0x0af6('0x1f')](respondWithResult(_0x54e87a,null))[_0x0af6('0x46')](handleError(_0x54e87a,null));};exports[_0x0af6('0x20')]=function(_0x5bed05,_0x3888c2){return db[_0x0af6('0x29')]['find']({'where':{'id':_0x5bed05[_0x0af6('0x42')]['id']}})[_0x0af6('0x1f')](handleEntityNotFound(_0x3888c2,null))[_0x0af6('0x1f')](removeEntity(_0x3888c2,null))[_0x0af6('0x46')](handleError(_0x3888c2,null));};exports[_0x0af6('0x48')]=function(_0x2b3a33,_0x11b63d){return db['SquareReport'][_0x0af6('0x48')]()[_0x0af6('0x1f')](respondWithResult(_0x11b63d,null))['catch'](handleError(_0x11b63d,null));}; \ No newline at end of file +var _0x26c2=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','params','length','create','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','send','render','merge','body','contact','message','interaction','account','map','SquareReport','rawAttributes'];(function(_0x5b3b2e,_0x1481c2){var _0x4fa8d0=function(_0x50638b){while(--_0x50638b){_0x5b3b2e['push'](_0x5b3b2e['shift']());}};_0x4fa8d0(++_0x1481c2);}(_0x26c2,0x1d6));var _0x226c=function(_0x36ef25,_0x4d81a2){_0x36ef25=_0x36ef25-0x0;var _0x284425=_0x26c2[_0x36ef25];return _0x284425;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x226c('0x0'));var zipdir=require(_0x226c('0x1'));var jsonpatch=require(_0x226c('0x2'));var rp=require(_0x226c('0x3'));var moment=require('moment');var BPromise=require(_0x226c('0x4'));var Mustache=require('mustache');var util=require(_0x226c('0x5'));var path=require(_0x226c('0x6'));var sox=require(_0x226c('0x7'));var csv=require(_0x226c('0x8'));var ejs=require(_0x226c('0x9'));var fs=require('fs');var fs_extra=require(_0x226c('0xa'));var _=require(_0x226c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x226c('0xc'));var toCsv=require(_0x226c('0x8'));var querystring=require('querystring');var Papa=require(_0x226c('0xd'));var Redis=require(_0x226c('0xe'));var authService=require(_0x226c('0xf'));var qs=require(_0x226c('0x10'));var as=require(_0x226c('0x11'));var hardwareService=require(_0x226c('0x12'));var logger=require(_0x226c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x226c('0x14'));var licenseUtil=require(_0x226c('0x15'));var db=require(_0x226c('0x16'))['db'];function respondWithStatusCode(_0xa2f997,_0x593335){_0x593335=_0x593335||0xcc;return function(_0x48e142){if(_0x48e142){return _0xa2f997[_0x226c('0x17')](_0x593335);}return _0xa2f997[_0x226c('0x18')](_0x593335)[_0x226c('0x19')]();};}function respondWithResult(_0x1650e8,_0x665c7d){_0x665c7d=_0x665c7d||0xc8;return function(_0x5ab641){if(_0x5ab641){return _0x1650e8[_0x226c('0x18')](_0x665c7d)[_0x226c('0x1a')](_0x5ab641);}};}function respondWithFilteredResult(_0x2550db,_0x4b542b){return function(_0x19d62d){if(_0x19d62d){var _0x34489a=typeof _0x4b542b[_0x226c('0x1b')]===_0x226c('0x1c')&&typeof _0x4b542b[_0x226c('0x1d')]===_0x226c('0x1c');var _0x35d7d7=_0x19d62d[_0x226c('0x1e')];var _0x17e360=_0x34489a?0x0:_0x4b542b[_0x226c('0x1b')];var _0x2e51f4=_0x34489a?_0x19d62d[_0x226c('0x1e')]:_0x4b542b[_0x226c('0x1b')]+_0x4b542b['limit'];var _0x34242a;if(_0x2e51f4>=_0x35d7d7){_0x2e51f4=_0x35d7d7;_0x34242a=0xc8;}else{_0x34242a=0xce;}_0x2550db[_0x226c('0x18')](_0x34242a);return _0x2550db[_0x226c('0x1f')]('Content-Range',_0x17e360+'-'+_0x2e51f4+'/'+_0x35d7d7)[_0x226c('0x1a')](_0x19d62d);}return null;};}function patchUpdates(_0x9fae06){return function(_0x5b7a02){try{jsonpatch[_0x226c('0x20')](_0x5b7a02,_0x9fae06,!![]);}catch(_0x29c441){return BPromise[_0x226c('0x21')](_0x29c441);}return _0x5b7a02[_0x226c('0x22')]();};}function saveUpdates(_0x290542,_0x242a67){return function(_0x49e476){if(_0x49e476){return _0x49e476[_0x226c('0x23')](_0x290542)[_0x226c('0x24')](function(_0x17ab5f){return _0x17ab5f;});}return null;};}function removeEntity(_0x3f2643,_0x392717){return function(_0x6a80){if(_0x6a80){return _0x6a80['destroy']()[_0x226c('0x24')](function(){_0x3f2643[_0x226c('0x18')](0xcc)[_0x226c('0x19')]();});}};}function handleEntityNotFound(_0x4a371f,_0x1a720f){return function(_0x544d41){if(!_0x544d41){_0x4a371f[_0x226c('0x17')](0x194);}return _0x544d41;};}function handleError(_0x1d5259,_0x1a9454){_0x1a9454=_0x1a9454||0x1f4;return function(_0x343eec){logger['error'](_0x343eec['stack']);if(_0x343eec['name']){delete _0x343eec['name'];}_0x1d5259['status'](_0x1a9454)[_0x226c('0x25')](_0x343eec);};}function getMustacheRender(_0x8ed8b6,_0x58b2c9){return Mustache[_0x226c('0x26')](_0x8ed8b6,_[_0x226c('0x27')](_0x58b2c9[_0x226c('0x28')],{'contact':_0x58b2c9[_0x226c('0x29')],'message':_0x58b2c9[_0x226c('0x2a')],'agent':_0x58b2c9['agent'],'interaction':_0x58b2c9[_0x226c('0x2b')],'account':_0x58b2c9[_0x226c('0x2c')]}))||'';}exports['index']=function(_0x260bb5,_0x160f9e){var _0x3632ae={},_0x47f333={},_0x116263={'count':0x0,'rows':[]};var _0x311bc0=_[_0x226c('0x2d')](db[_0x226c('0x2e')][_0x226c('0x2f')],function(_0x8756b7){return{'name':_0x8756b7[_0x226c('0x30')],'type':_0x8756b7['type'][_0x226c('0x31')]};});_0x47f333[_0x226c('0x32')]=_[_0x226c('0x2d')](_0x311bc0,'name');_0x47f333[_0x226c('0x33')]=_[_0x226c('0x34')](_0x260bb5[_0x226c('0x33')]);_0x47f333[_0x226c('0x35')]=_[_0x226c('0x36')](_0x47f333[_0x226c('0x32')],_0x47f333[_0x226c('0x33')]);_0x3632ae[_0x226c('0x37')]=_['intersection'](_0x47f333[_0x226c('0x32')],qs[_0x226c('0x38')](_0x260bb5[_0x226c('0x33')][_0x226c('0x38')]));_0x3632ae[_0x226c('0x37')]=_0x3632ae['attributes']['length']?_0x3632ae[_0x226c('0x37')]:_0x47f333[_0x226c('0x32')];if(!_0x260bb5[_0x226c('0x33')]['hasOwnProperty']('nolimit')){_0x3632ae[_0x226c('0x1d')]=qs[_0x226c('0x1d')](_0x260bb5[_0x226c('0x33')]['limit']);_0x3632ae[_0x226c('0x1b')]=qs['offset'](_0x260bb5[_0x226c('0x33')]['offset']);}_0x3632ae[_0x226c('0x39')]=qs[_0x226c('0x3a')](_0x260bb5[_0x226c('0x33')]['sort']);_0x3632ae[_0x226c('0x3b')]=qs['filters'](_[_0x226c('0x3c')](_0x260bb5[_0x226c('0x33')],_0x47f333[_0x226c('0x35')]),_0x311bc0);if(_0x260bb5['query'][_0x226c('0x3d')]){_0x3632ae['where']=_[_0x226c('0x27')](_0x3632ae[_0x226c('0x3b')],{'$or':_[_0x226c('0x2d')](_0x311bc0,function(_0x38541c){if(_0x38541c[_0x226c('0x3e')]!=='VIRTUAL'){var _0x2abab7={};_0x2abab7[_0x38541c['name']]={'$like':'%'+_0x260bb5[_0x226c('0x33')][_0x226c('0x3d')]+'%'};return _0x2abab7;}})});}_0x3632ae=_[_0x226c('0x27')]({},_0x3632ae,_0x260bb5[_0x226c('0x3f')]);var _0x49a3ea={'where':_0x3632ae['where']};return db['SquareReport'][_0x226c('0x1e')](_0x49a3ea)['then'](function(_0x505407){_0x116263[_0x226c('0x1e')]=_0x505407;if(_0x260bb5[_0x226c('0x33')][_0x226c('0x40')]){_0x3632ae[_0x226c('0x41')]=[{'all':!![]}];}return db[_0x226c('0x2e')][_0x226c('0x42')](_0x3632ae);})[_0x226c('0x24')](function(_0x5a076a){_0x116263[_0x226c('0x43')]=_0x5a076a;return _0x116263;})[_0x226c('0x24')](respondWithFilteredResult(_0x160f9e,_0x3632ae))[_0x226c('0x44')](handleError(_0x160f9e,null));};exports['show']=function(_0x900ec,_0x7dd731){var _0x46923f={'raw':!![],'where':{'id':_0x900ec[_0x226c('0x45')]['id']}},_0x15f5e5={};_0x15f5e5[_0x226c('0x32')]=_['keys'](db[_0x226c('0x2e')][_0x226c('0x2f')]);_0x15f5e5[_0x226c('0x33')]=_[_0x226c('0x34')](_0x900ec[_0x226c('0x33')]);_0x15f5e5[_0x226c('0x35')]=_[_0x226c('0x36')](_0x15f5e5['model'],_0x15f5e5['query']);_0x46923f[_0x226c('0x37')]=_[_0x226c('0x36')](_0x15f5e5[_0x226c('0x32')],qs['fields'](_0x900ec['query'][_0x226c('0x38')]));_0x46923f[_0x226c('0x37')]=_0x46923f[_0x226c('0x37')][_0x226c('0x46')]?_0x46923f[_0x226c('0x37')]:_0x15f5e5[_0x226c('0x32')];if(_0x900ec[_0x226c('0x33')][_0x226c('0x40')]){_0x46923f[_0x226c('0x41')]=[{'all':!![]}];}_0x46923f=_[_0x226c('0x27')]({},_0x46923f,_0x900ec[_0x226c('0x3f')]);return db['SquareReport']['find'](_0x46923f)[_0x226c('0x24')](handleEntityNotFound(_0x7dd731,null))[_0x226c('0x24')](respondWithResult(_0x7dd731,null))[_0x226c('0x44')](handleError(_0x7dd731,null));};exports[_0x226c('0x47')]=function(_0x1aed90,_0x1508be){return db[_0x226c('0x2e')][_0x226c('0x47')](_0x1aed90[_0x226c('0x28')],{})[_0x226c('0x24')](respondWithResult(_0x1508be,0xc9))[_0x226c('0x44')](handleError(_0x1508be,null));};exports[_0x226c('0x23')]=function(_0x139901,_0xa52a81){if(_0x139901[_0x226c('0x28')]['id']){delete _0x139901['body']['id'];}return db['SquareReport'][_0x226c('0x48')]({'where':{'id':_0x139901[_0x226c('0x45')]['id']}})['then'](handleEntityNotFound(_0xa52a81,null))[_0x226c('0x24')](saveUpdates(_0x139901[_0x226c('0x28')],null))[_0x226c('0x24')](respondWithResult(_0xa52a81,null))['catch'](handleError(_0xa52a81,null));};exports['destroy']=function(_0xc4bb92,_0x4a30a5){return db[_0x226c('0x2e')][_0x226c('0x48')]({'where':{'id':_0xc4bb92['params']['id']}})[_0x226c('0x24')](handleEntityNotFound(_0x4a30a5,null))[_0x226c('0x24')](removeEntity(_0x4a30a5,null))['catch'](handleError(_0x4a30a5,null));};exports[_0x226c('0x49')]=function(_0x416f8f,_0x3c701e){return db['SquareReport']['describe']()[_0x226c('0x24')](respondWithResult(_0x3c701e,null))[_0x226c('0x44')](handleError(_0x3c701e,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 07c78ab..662d9ef 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 _0x6391=['report_square','uid_pname','project_name','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport'];(function(_0x1a69fc,_0xc78d18){var _0xf58ab1=function(_0x3b9efe){while(--_0x3b9efe){_0x1a69fc['push'](_0x1a69fc['shift']());}};_0xf58ab1(++_0xc78d18);}(_0x6391,0x121));var _0x1639=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0x6391[_0x5b077b];return _0x16faf7;};'use strict';var _=require('lodash');var util=require(_0x1639('0x0'));var logger=require(_0x1639('0x1'))(_0x1639('0x2'));var moment=require(_0x1639('0x3'));var BPromise=require(_0x1639('0x4'));var rp=require(_0x1639('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1639('0x6'));var config=require(_0x1639('0x7'));var attributes=require(_0x1639('0x8'));module['exports']=function(_0x38cf65,_0x17b77c){return _0x38cf65[_0x1639('0x9')](_0x1639('0xa'),attributes,{'tableName':_0x1639('0xb'),'paranoid':![],'indexes':[{'name':_0x1639('0xc'),'fields':['uniqueid',_0x1639('0xd')]},{'name':_0x1639('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ede=['leaveAt','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x1ede,0xe2));var _0xe1ed=function(_0x256830,_0x273fc8){_0x256830=_0x256830-0x0;var _0x45624e=_0x1ede[_0x256830];return _0x45624e;};'use strict';var _=require(_0xe1ed('0x0'));var util=require(_0xe1ed('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe1ed('0x2'));var BPromise=require(_0xe1ed('0x3'));var rp=require(_0xe1ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe1ed('0x5'));var config=require(_0xe1ed('0x6'));var attributes=require('./squareReport.attributes');module[_0xe1ed('0x7')]=function(_0x1cd7a3,_0x28170f){return _0x1cd7a3[_0xe1ed('0x8')](_0xe1ed('0x9'),attributes,{'tableName':_0xe1ed('0xa'),'paranoid':![],'indexes':[{'name':_0xe1ed('0xb'),'fields':[_0xe1ed('0xc'),_0xe1ed('0xd')]},{'name':_0xe1ed('0xe'),'fields':[_0xe1ed('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index f0bdcd5..4abc92b 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 _0x4b84=['CreateSquareReport','SquareReport','create','options','raw','catch','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message'];(function(_0x5d6d0c,_0x151b76){var _0x471366=function(_0x1bbbf7){while(--_0x1bbbf7){_0x5d6d0c['push'](_0x5d6d0c['shift']());}};_0x471366(++_0x151b76);}(_0x4b84,0x1cc));var _0x44b8=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0x4b84[_0x592d48];return _0x5d789e;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('SquareReport,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('SquareReport,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')](_0x55e258['body'],{'raw':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![]})[_0x44b8('0x7')](function(_0x102ef9){logger[_0x44b8('0x8')](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON[_0x44b8('0xc')](_0x102ef9));_0xe3de8f(_0x102ef9);})[_0x44b8('0x15')](function(_0x14996c){logger['error'](_0x44b8('0x10'),_0x14996c[_0x44b8('0xf')],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x14996c[_0x44b8('0xf')]));});});};exports[_0x44b8('0x16')]=function(_0x51a34a){var _0x402497=this;return new Promise(function(_0x54677c,_0x41a922){return db[_0x44b8('0x11')][_0x44b8('0x17')](_0x51a34a[_0x44b8('0x18')],{'raw':_0x51a34a[_0x44b8('0x13')]?_0x51a34a['options'][_0x44b8('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51a34a['options']?_0x51a34a[_0x44b8('0x13')][_0x44b8('0x19')]||null:null,'attributes':_0x51a34a['options']?_0x51a34a[_0x44b8('0x13')][_0x44b8('0x1a')]||null:null,'limit':_0x51a34a[_0x44b8('0x13')]?_0x51a34a['options'][_0x44b8('0x1b')]||null:null})[_0x44b8('0x7')](function(_0x53d9c7){logger[_0x44b8('0x8')]('UpdateSquareReport',_0x51a34a);logger[_0x44b8('0xa')]('UpdateSquareReport',_0x51a34a,JSON['stringify'](_0x53d9c7));_0x54677c(_0x53d9c7);})['catch'](function(_0x387293){logger[_0x44b8('0xd')](_0x44b8('0x16'),_0x387293[_0x44b8('0xf')],_0x51a34a);_0x41a922(_0x402497[_0x44b8('0xd')](0x1f4,_0x387293[_0x44b8('0xf')]));});});}; \ No newline at end of file +var _0x46ed=['options','raw','CreateSquareReport','catch','UpdateSquareReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','create','body'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('SquareReport,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});}exports['CreateSquareReport']=function(_0x5ddd04){var _0x2e8f6d=this;return new Promise(function(_0x1bd574,_0x488690){return db['SquareReport'][_0xd46e('0x16')](_0x5ddd04[_0xd46e('0x17')],{'raw':_0x5ddd04[_0xd46e('0x18')]?_0x5ddd04[_0xd46e('0x18')][_0xd46e('0x19')]===undefined?!![]:![]:!![]})[_0xd46e('0xc')](function(_0x3b5fa4){logger[_0xd46e('0xd')](_0xd46e('0x1a'),_0x5ddd04);logger[_0xd46e('0xf')](_0xd46e('0x1a'),_0x5ddd04,JSON['stringify'](_0x3b5fa4));_0x1bd574(_0x3b5fa4);})[_0xd46e('0x1b')](function(_0x1c83fa){logger[_0xd46e('0x13')](_0xd46e('0x1a'),_0x1c83fa[_0xd46e('0x14')],_0x5ddd04);_0x488690(_0x2e8f6d[_0xd46e('0x13')](0x1f4,_0x1c83fa[_0xd46e('0x14')]));});});};exports[_0xd46e('0x1c')]=function(_0x62dea5){var _0x4cf899=this;return new Promise(function(_0x314570,_0x5424e5){return db['SquareReport'][_0xd46e('0x1d')](_0x62dea5[_0xd46e('0x17')],{'raw':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')]['where']||null:null,'attributes':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x1e')]||null:null,'limit':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x1f')]||null:null})['then'](function(_0x465d54){logger[_0xd46e('0xd')](_0xd46e('0x1c'),_0x62dea5);logger[_0xd46e('0xf')](_0xd46e('0x1c'),_0x62dea5,JSON[_0xd46e('0x12')](_0x465d54));_0x314570(_0x465d54);})[_0xd46e('0x1b')](function(_0x2c5ec7){logger[_0xd46e('0x13')](_0xd46e('0x1c'),_0x2c5ec7[_0xd46e('0x14')],_0x62dea5);_0x5424e5(_0x4cf899[_0xd46e('0x13')](0x1f4,_0x2c5ec7[_0xd46e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 59e21ba..9822cd3 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 _0x75e5=['../../config/environment','index','get','/describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5e6375,_0x2dc9e5){var _0x1f2707=function(_0xf5dc4b){while(--_0xf5dc4b){_0x5e6375['push'](_0x5e6375['shift']());}};_0x1f2707(++_0x2dc9e5);}(_0x75e5,0x112));var _0x575e=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0x75e5[_0xcfeff4];return _0xb2fadc;};'use strict';var multer=require(_0x575e('0x0'));var util=require('util');var path=require(_0x575e('0x1'));var timeout=require('connect-timeout');var express=require(_0x575e('0x2'));var router=express[_0x575e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x575e('0x4'));var interaction=require(_0x575e('0x5'));var config=require(_0x575e('0x6'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x575e('0x7')]);router[_0x575e('0x8')](_0x575e('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x575e('0x8')](_0x575e('0xa'),auth[_0x575e('0xb')](),controller[_0x575e('0xc')]);router[_0x575e('0xd')]('/',auth[_0x575e('0xb')](),controller[_0x575e('0xe')]);router[_0x575e('0xf')](_0x575e('0xa'),auth[_0x575e('0xb')](),controller[_0x575e('0x10')]);router[_0x575e('0x11')](_0x575e('0xa'),auth[_0x575e('0xb')](),controller[_0x575e('0x12')]);module[_0x575e('0x13')]=router; \ No newline at end of file +var _0x17c3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x28bdfc,_0x3d2547){var _0x5ad073=function(_0x844a35){while(--_0x844a35){_0x28bdfc['push'](_0x28bdfc['shift']());}};_0x5ad073(++_0x3d2547);}(_0x17c3,0x1c8));var _0x317c=function(_0x311578,_0x3acaf6){_0x311578=_0x311578-0x0;var _0x4288a0=_0x17c3[_0x311578];return _0x4288a0;};'use strict';var multer=require(_0x317c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x317c('0x1'));var express=require(_0x317c('0x2'));var router=express[_0x317c('0x3')]();var fs_extra=require(_0x317c('0x4'));var auth=require(_0x317c('0x5'));var interaction=require(_0x317c('0x6'));var config=require(_0x317c('0x7'));var controller=require(_0x317c('0x8'));router['get']('/',auth[_0x317c('0x9')](),controller[_0x317c('0xa')]);router[_0x317c('0xb')](_0x317c('0xc'),auth[_0x317c('0x9')](),controller[_0x317c('0xd')]);router[_0x317c('0xb')](_0x317c('0xe'),auth[_0x317c('0x9')](),controller[_0x317c('0xf')]);router[_0x317c('0x10')]('/',auth[_0x317c('0x9')](),controller[_0x317c('0x11')]);router[_0x317c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x317c('0x13')]);router[_0x317c('0x14')]('/:id',auth[_0x317c('0x9')](),controller[_0x317c('0x15')]);module[_0x317c('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c32af4d..a283771 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 _0x6cc2=['STRING','TEXT','sequelize','exports'];(function(_0x3334cc,_0xf159e0){var _0x46bc49=function(_0x37a782){while(--_0x37a782){_0x3334cc['push'](_0x3334cc['shift']());}};_0x46bc49(++_0xf159e0);}(_0x6cc2,0x116));var _0x26cc=function(_0x3950b2,_0x488072){_0x3950b2=_0x3950b2-0x0;var _0x31662e=_0x6cc2[_0x3950b2];return _0x31662e;};'use strict';var Sequelize=require(_0x26cc('0x0'));module[_0x26cc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x26cc('0x2')]},'data':{'type':Sequelize[_0x26cc('0x3')]},'project_name':{'type':Sequelize[_0x26cc('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xafd7=['STRING','TEXT','sequelize','exports'];(function(_0x34df9a,_0x48bb17){var _0x58bb27=function(_0x295bd3){while(--_0x295bd3){_0x34df9a['push'](_0x34df9a['shift']());}};_0x58bb27(++_0x48bb17);}(_0xafd7,0xae));var _0x7afd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xafd7[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x7afd('0x0'));module[_0x7afd('0x1')]={'uniqueid':{'type':Sequelize[_0x7afd('0x2')]},'node':{'type':Sequelize[_0x7afd('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x7afd('0x3')]},'project_name':{'type':Sequelize[_0x7afd('0x2')]},'callerid':{'type':Sequelize[_0x7afd('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f846f7d..334a099 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 _0x63de=['rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','where','filter','VIRTUAL','options','findAll','rows','catch','includeAll','find','create','update','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','send','render','merge','contact','message','agent','interaction','account','index','map','SquareDetailsReport'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0x63de,0x69));var _0xe63d=function(_0x25020c,_0x14280e){_0x25020c=_0x25020c-0x0;var _0x1a18cc=_0x63de[_0x25020c];return _0x1a18cc;};'use strict';var emlformat=require(_0xe63d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe63d('0x1'));var jsonpatch=require(_0xe63d('0x2'));var rp=require('request-promise');var moment=require(_0xe63d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe63d('0x4'));var util=require(_0xe63d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe63d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe63d('0x7'));var _=require(_0xe63d('0x8'));var squel=require(_0xe63d('0x9'));var crypto=require(_0xe63d('0xa'));var jsforce=require(_0xe63d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe63d('0x6'));var querystring=require(_0xe63d('0xc'));var Papa=require(_0xe63d('0xd'));var Redis=require(_0xe63d('0xe'));var authService=require(_0xe63d('0xf'));var qs=require(_0xe63d('0x10'));var as=require(_0xe63d('0x11'));var hardwareService=require(_0xe63d('0x12'));var logger=require(_0xe63d('0x13'))('api');var utils=require(_0xe63d('0x14'));var config=require(_0xe63d('0x15'));var licenseUtil=require(_0xe63d('0x16'));var db=require(_0xe63d('0x17'))['db'];function respondWithStatusCode(_0xc3f079,_0x31a2c2){_0x31a2c2=_0x31a2c2||0xcc;return function(_0x3d27fd){if(_0x3d27fd){return _0xc3f079[_0xe63d('0x18')](_0x31a2c2);}return _0xc3f079[_0xe63d('0x19')](_0x31a2c2)[_0xe63d('0x1a')]();};}function respondWithResult(_0x20eca6,_0x130074){_0x130074=_0x130074||0xc8;return function(_0x4b1e5a){if(_0x4b1e5a){return _0x20eca6['status'](_0x130074)[_0xe63d('0x1b')](_0x4b1e5a);}};}function respondWithFilteredResult(_0x38e898,_0x61248){return function(_0x1deafe){if(_0x1deafe){var _0xa4c688=typeof _0x61248[_0xe63d('0x1c')]===_0xe63d('0x1d')&&typeof _0x61248[_0xe63d('0x1e')]===_0xe63d('0x1d');var _0x396305=_0x1deafe['count'];var _0x4c7a73=_0xa4c688?0x0:_0x61248[_0xe63d('0x1c')];var _0x374894=_0xa4c688?_0x1deafe[_0xe63d('0x1f')]:_0x61248[_0xe63d('0x1c')]+_0x61248[_0xe63d('0x1e')];var _0x374c73;if(_0x374894>=_0x396305){_0x374894=_0x396305;_0x374c73=0xc8;}else{_0x374c73=0xce;}_0x38e898[_0xe63d('0x19')](_0x374c73);return _0x38e898[_0xe63d('0x20')](_0xe63d('0x21'),_0x4c7a73+'-'+_0x374894+'/'+_0x396305)[_0xe63d('0x1b')](_0x1deafe);}return null;};}function patchUpdates(_0x2240fc){return function(_0x47d2af){try{jsonpatch[_0xe63d('0x22')](_0x47d2af,_0x2240fc,!![]);}catch(_0x1848a5){return BPromise['reject'](_0x1848a5);}return _0x47d2af[_0xe63d('0x23')]();};}function saveUpdates(_0x2cff35,_0x435ce7){return function(_0x4ac056){if(_0x4ac056){return _0x4ac056['update'](_0x2cff35)[_0xe63d('0x24')](function(_0x5af7a2){return _0x5af7a2;});}return null;};}function removeEntity(_0x192d58,_0x517ccc){return function(_0x704029){if(_0x704029){return _0x704029[_0xe63d('0x25')]()[_0xe63d('0x24')](function(){_0x192d58['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d66a,_0x52b1cb){return function(_0x10dbd4){if(!_0x10dbd4){_0x38d66a[_0xe63d('0x18')](0x194);}return _0x10dbd4;};}function handleError(_0x23105e,_0x46328e){_0x46328e=_0x46328e||0x1f4;return function(_0x5e0099){logger['error'](_0x5e0099[_0xe63d('0x26')]);if(_0x5e0099[_0xe63d('0x27')]){delete _0x5e0099[_0xe63d('0x27')];}_0x23105e[_0xe63d('0x19')](_0x46328e)[_0xe63d('0x28')](_0x5e0099);};}function getMustacheRender(_0x1502ea,_0x4fd946){return Mustache[_0xe63d('0x29')](_0x1502ea,_[_0xe63d('0x2a')](_0x4fd946['body'],{'contact':_0x4fd946[_0xe63d('0x2b')],'message':_0x4fd946[_0xe63d('0x2c')],'agent':_0x4fd946[_0xe63d('0x2d')],'interaction':_0x4fd946[_0xe63d('0x2e')],'account':_0x4fd946[_0xe63d('0x2f')]}))||'';}exports[_0xe63d('0x30')]=function(_0x1c2f47,_0x23de89){var _0x5062c0={},_0x3463b4={},_0x5bb074={'count':0x0,'rows':[]};var _0x4c9992=_[_0xe63d('0x31')](db[_0xe63d('0x32')][_0xe63d('0x33')],function(_0x2f8d2a){return{'name':_0x2f8d2a[_0xe63d('0x34')],'type':_0x2f8d2a[_0xe63d('0x35')][_0xe63d('0x36')]};});_0x3463b4['model']=_[_0xe63d('0x31')](_0x4c9992,_0xe63d('0x27'));_0x3463b4[_0xe63d('0x37')]=_[_0xe63d('0x38')](_0x1c2f47[_0xe63d('0x37')]);_0x3463b4[_0xe63d('0x39')]=_[_0xe63d('0x3a')](_0x3463b4[_0xe63d('0x3b')],_0x3463b4[_0xe63d('0x37')]);_0x5062c0[_0xe63d('0x3c')]=_[_0xe63d('0x3a')](_0x3463b4[_0xe63d('0x3b')],qs[_0xe63d('0x3d')](_0x1c2f47[_0xe63d('0x37')][_0xe63d('0x3d')]));_0x5062c0[_0xe63d('0x3c')]=_0x5062c0[_0xe63d('0x3c')][_0xe63d('0x3e')]?_0x5062c0['attributes']:_0x3463b4[_0xe63d('0x3b')];if(!_0x1c2f47[_0xe63d('0x37')][_0xe63d('0x3f')]('nolimit')){_0x5062c0[_0xe63d('0x1e')]=qs['limit'](_0x1c2f47[_0xe63d('0x37')][_0xe63d('0x1e')]);_0x5062c0['offset']=qs[_0xe63d('0x1c')](_0x1c2f47[_0xe63d('0x37')][_0xe63d('0x1c')]);}_0x5062c0['order']=qs['sort'](_0x1c2f47['query']['sort']);_0x5062c0[_0xe63d('0x40')]=qs[_0xe63d('0x39')](_['pick'](_0x1c2f47[_0xe63d('0x37')],_0x3463b4[_0xe63d('0x39')]),_0x4c9992);if(_0x1c2f47[_0xe63d('0x37')][_0xe63d('0x41')]){_0x5062c0['where']=_['merge'](_0x5062c0[_0xe63d('0x40')],{'$or':_['map'](_0x4c9992,function(_0x232439){if(_0x232439[_0xe63d('0x35')]!==_0xe63d('0x42')){var _0x3067ec={};_0x3067ec[_0x232439[_0xe63d('0x27')]]={'$like':'%'+_0x1c2f47[_0xe63d('0x37')][_0xe63d('0x41')]+'%'};return _0x3067ec;}})});}_0x5062c0=_[_0xe63d('0x2a')]({},_0x5062c0,_0x1c2f47[_0xe63d('0x43')]);var _0x5e27c6={'where':_0x5062c0[_0xe63d('0x40')]};return db[_0xe63d('0x32')][_0xe63d('0x1f')](_0x5e27c6)[_0xe63d('0x24')](function(_0x17f948){_0x5bb074[_0xe63d('0x1f')]=_0x17f948;if(_0x1c2f47[_0xe63d('0x37')]['includeAll']){_0x5062c0['include']=[{'all':!![]}];}return db[_0xe63d('0x32')][_0xe63d('0x44')](_0x5062c0);})['then'](function(_0x542569){_0x5bb074[_0xe63d('0x45')]=_0x542569;return _0x5bb074;})[_0xe63d('0x24')](respondWithFilteredResult(_0x23de89,_0x5062c0))[_0xe63d('0x46')](handleError(_0x23de89,null));};exports['show']=function(_0x3ced17,_0x2cd0a7){var _0x19495c={'raw':!![],'where':{'id':_0x3ced17['params']['id']}},_0x4df2b3={};_0x4df2b3['model']=_[_0xe63d('0x38')](db[_0xe63d('0x32')][_0xe63d('0x33')]);_0x4df2b3[_0xe63d('0x37')]=_['keys'](_0x3ced17['query']);_0x4df2b3[_0xe63d('0x39')]=_['intersection'](_0x4df2b3[_0xe63d('0x3b')],_0x4df2b3[_0xe63d('0x37')]);_0x19495c[_0xe63d('0x3c')]=_['intersection'](_0x4df2b3['model'],qs[_0xe63d('0x3d')](_0x3ced17[_0xe63d('0x37')][_0xe63d('0x3d')]));_0x19495c['attributes']=_0x19495c[_0xe63d('0x3c')]['length']?_0x19495c[_0xe63d('0x3c')]:_0x4df2b3[_0xe63d('0x3b')];if(_0x3ced17[_0xe63d('0x37')][_0xe63d('0x47')]){_0x19495c['include']=[{'all':!![]}];}_0x19495c=_[_0xe63d('0x2a')]({},_0x19495c,_0x3ced17['options']);return db[_0xe63d('0x32')][_0xe63d('0x48')](_0x19495c)[_0xe63d('0x24')](handleEntityNotFound(_0x2cd0a7,null))[_0xe63d('0x24')](respondWithResult(_0x2cd0a7,null))[_0xe63d('0x46')](handleError(_0x2cd0a7,null));};exports[_0xe63d('0x49')]=function(_0x1452b7,_0x53666f){return db[_0xe63d('0x32')][_0xe63d('0x49')](_0x1452b7['body'],{})[_0xe63d('0x24')](respondWithResult(_0x53666f,0xc9))['catch'](handleError(_0x53666f,null));};exports[_0xe63d('0x4a')]=function(_0x516d34,_0x5309b3){if(_0x516d34[_0xe63d('0x4b')]['id']){delete _0x516d34[_0xe63d('0x4b')]['id'];}return db[_0xe63d('0x32')][_0xe63d('0x48')]({'where':{'id':_0x516d34[_0xe63d('0x4c')]['id']}})[_0xe63d('0x24')](handleEntityNotFound(_0x5309b3,null))[_0xe63d('0x24')](saveUpdates(_0x516d34[_0xe63d('0x4b')],null))[_0xe63d('0x24')](respondWithResult(_0x5309b3,null))[_0xe63d('0x46')](handleError(_0x5309b3,null));};exports[_0xe63d('0x25')]=function(_0x3c38c3,_0x547893){return db['SquareDetailsReport'][_0xe63d('0x48')]({'where':{'id':_0x3c38c3[_0xe63d('0x4c')]['id']}})[_0xe63d('0x24')](handleEntityNotFound(_0x547893,null))[_0xe63d('0x24')](removeEntity(_0x547893,null))['catch'](handleError(_0x547893,null));};exports[_0xe63d('0x4d')]=function(_0x23321d,_0x11dfe8){return db[_0xe63d('0x32')][_0xe63d('0x4d')]()[_0xe63d('0x24')](respondWithResult(_0x11dfe8,null))[_0xe63d('0x46')](handleError(_0x11dfe8,null));}; \ No newline at end of file +var _0x2f9b=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','render','merge','body','agent','interaction','account','index','map','SquareDetailsReport','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','options','includeAll','include','rows','catch','show','rawAttributes','create','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','jsforce','querystring'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x2f9b,0xd4));var _0xb2f9=function(_0x2d93f8,_0x5370f2){_0x2d93f8=_0x2d93f8-0x0;var _0x100113=_0x2f9b[_0x2d93f8];return _0x100113;};'use strict';var emlformat=require(_0xb2f9('0x0'));var rimraf=require(_0xb2f9('0x1'));var zipdir=require(_0xb2f9('0x2'));var jsonpatch=require(_0xb2f9('0x3'));var rp=require(_0xb2f9('0x4'));var moment=require(_0xb2f9('0x5'));var BPromise=require(_0xb2f9('0x6'));var Mustache=require('mustache');var util=require(_0xb2f9('0x7'));var path=require('path');var sox=require(_0xb2f9('0x8'));var csv=require(_0xb2f9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2f9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb2f9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb2f9('0x9'));var querystring=require(_0xb2f9('0xc'));var Papa=require('papaparse');var Redis=require(_0xb2f9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb2f9('0xe'));var as=require(_0xb2f9('0xf'));var hardwareService=require(_0xb2f9('0x10'));var logger=require(_0xb2f9('0x11'))(_0xb2f9('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb2f9('0x13'))['db'];function respondWithStatusCode(_0x51fdbb,_0x47a016){_0x47a016=_0x47a016||0xcc;return function(_0x458749){if(_0x458749){return _0x51fdbb[_0xb2f9('0x14')](_0x47a016);}return _0x51fdbb[_0xb2f9('0x15')](_0x47a016)[_0xb2f9('0x16')]();};}function respondWithResult(_0x5825a3,_0x3e83cd){_0x3e83cd=_0x3e83cd||0xc8;return function(_0x36937c){if(_0x36937c){return _0x5825a3[_0xb2f9('0x15')](_0x3e83cd)[_0xb2f9('0x17')](_0x36937c);}};}function respondWithFilteredResult(_0x277101,_0x28cf10){return function(_0x5b8b19){if(_0x5b8b19){var _0x4dec01=typeof _0x28cf10[_0xb2f9('0x18')]===_0xb2f9('0x19')&&typeof _0x28cf10[_0xb2f9('0x1a')]===_0xb2f9('0x19');var _0x497b76=_0x5b8b19[_0xb2f9('0x1b')];var _0x19cf0b=_0x4dec01?0x0:_0x28cf10[_0xb2f9('0x18')];var _0x8fd3b9=_0x4dec01?_0x5b8b19[_0xb2f9('0x1b')]:_0x28cf10[_0xb2f9('0x18')]+_0x28cf10[_0xb2f9('0x1a')];var _0x3fb383;if(_0x8fd3b9>=_0x497b76){_0x8fd3b9=_0x497b76;_0x3fb383=0xc8;}else{_0x3fb383=0xce;}_0x277101[_0xb2f9('0x15')](_0x3fb383);return _0x277101[_0xb2f9('0x1c')](_0xb2f9('0x1d'),_0x19cf0b+'-'+_0x8fd3b9+'/'+_0x497b76)[_0xb2f9('0x17')](_0x5b8b19);}return null;};}function patchUpdates(_0x3ddac4){return function(_0x3ca93a){try{jsonpatch[_0xb2f9('0x1e')](_0x3ca93a,_0x3ddac4,!![]);}catch(_0x194088){return BPromise[_0xb2f9('0x1f')](_0x194088);}return _0x3ca93a['save']();};}function saveUpdates(_0x19f2f3,_0x3187ee){return function(_0x3a5151){if(_0x3a5151){return _0x3a5151[_0xb2f9('0x20')](_0x19f2f3)[_0xb2f9('0x21')](function(_0x9e1025){return _0x9e1025;});}return null;};}function removeEntity(_0x4c118f,_0x406213){return function(_0x56e691){if(_0x56e691){return _0x56e691[_0xb2f9('0x22')]()[_0xb2f9('0x21')](function(){_0x4c118f['status'](0xcc)[_0xb2f9('0x16')]();});}};}function handleEntityNotFound(_0x21c3db,_0x91ecec){return function(_0x1bb615){if(!_0x1bb615){_0x21c3db['sendStatus'](0x194);}return _0x1bb615;};}function handleError(_0x40514a,_0x23b41c){_0x23b41c=_0x23b41c||0x1f4;return function(_0x4ed03e){logger[_0xb2f9('0x23')](_0x4ed03e[_0xb2f9('0x24')]);if(_0x4ed03e[_0xb2f9('0x25')]){delete _0x4ed03e[_0xb2f9('0x25')];}_0x40514a[_0xb2f9('0x15')](_0x23b41c)[_0xb2f9('0x26')](_0x4ed03e);};}function getMustacheRender(_0x5090b3,_0x326b34){return Mustache[_0xb2f9('0x27')](_0x5090b3,_[_0xb2f9('0x28')](_0x326b34[_0xb2f9('0x29')],{'contact':_0x326b34['contact'],'message':_0x326b34['message'],'agent':_0x326b34[_0xb2f9('0x2a')],'interaction':_0x326b34[_0xb2f9('0x2b')],'account':_0x326b34[_0xb2f9('0x2c')]}))||'';}exports[_0xb2f9('0x2d')]=function(_0xdbd3e8,_0x4dcd2e){var _0x3925e1={},_0x3958fc={},_0x2d0342={'count':0x0,'rows':[]};var _0x4bb1e5=_[_0xb2f9('0x2e')](db[_0xb2f9('0x2f')]['rawAttributes'],function(_0x526214){return{'name':_0x526214[_0xb2f9('0x30')],'type':_0x526214['type']['key']};});_0x3958fc[_0xb2f9('0x31')]=_[_0xb2f9('0x2e')](_0x4bb1e5,_0xb2f9('0x25'));_0x3958fc[_0xb2f9('0x32')]=_[_0xb2f9('0x33')](_0xdbd3e8['query']);_0x3958fc['filters']=_['intersection'](_0x3958fc[_0xb2f9('0x31')],_0x3958fc['query']);_0x3925e1[_0xb2f9('0x34')]=_[_0xb2f9('0x35')](_0x3958fc['model'],qs[_0xb2f9('0x36')](_0xdbd3e8[_0xb2f9('0x32')][_0xb2f9('0x36')]));_0x3925e1[_0xb2f9('0x34')]=_0x3925e1['attributes'][_0xb2f9('0x37')]?_0x3925e1[_0xb2f9('0x34')]:_0x3958fc[_0xb2f9('0x31')];if(!_0xdbd3e8['query'][_0xb2f9('0x38')]('nolimit')){_0x3925e1[_0xb2f9('0x1a')]=qs[_0xb2f9('0x1a')](_0xdbd3e8[_0xb2f9('0x32')][_0xb2f9('0x1a')]);_0x3925e1[_0xb2f9('0x18')]=qs[_0xb2f9('0x18')](_0xdbd3e8['query'][_0xb2f9('0x18')]);}_0x3925e1[_0xb2f9('0x39')]=qs['sort'](_0xdbd3e8[_0xb2f9('0x32')][_0xb2f9('0x3a')]);_0x3925e1[_0xb2f9('0x3b')]=qs[_0xb2f9('0x3c')](_[_0xb2f9('0x3d')](_0xdbd3e8[_0xb2f9('0x32')],_0x3958fc[_0xb2f9('0x3c')]),_0x4bb1e5);if(_0xdbd3e8['query'][_0xb2f9('0x3e')]){_0x3925e1[_0xb2f9('0x3b')]=_[_0xb2f9('0x28')](_0x3925e1['where'],{'$or':_[_0xb2f9('0x2e')](_0x4bb1e5,function(_0x122b99){if(_0x122b99[_0xb2f9('0x3f')]!=='VIRTUAL'){var _0x173d61={};_0x173d61[_0x122b99[_0xb2f9('0x25')]]={'$like':'%'+_0xdbd3e8[_0xb2f9('0x32')]['filter']+'%'};return _0x173d61;}})});}_0x3925e1=_[_0xb2f9('0x28')]({},_0x3925e1,_0xdbd3e8[_0xb2f9('0x40')]);var _0x19019c={'where':_0x3925e1[_0xb2f9('0x3b')]};return db[_0xb2f9('0x2f')]['count'](_0x19019c)[_0xb2f9('0x21')](function(_0x4ff7a8){_0x2d0342['count']=_0x4ff7a8;if(_0xdbd3e8[_0xb2f9('0x32')][_0xb2f9('0x41')]){_0x3925e1[_0xb2f9('0x42')]=[{'all':!![]}];}return db[_0xb2f9('0x2f')]['findAll'](_0x3925e1);})['then'](function(_0x4e44cf){_0x2d0342[_0xb2f9('0x43')]=_0x4e44cf;return _0x2d0342;})[_0xb2f9('0x21')](respondWithFilteredResult(_0x4dcd2e,_0x3925e1))[_0xb2f9('0x44')](handleError(_0x4dcd2e,null));};exports[_0xb2f9('0x45')]=function(_0x29f03c,_0x321af1){var _0xab6fad={'raw':!![],'where':{'id':_0x29f03c['params']['id']}},_0x29317b={};_0x29317b['model']=_['keys'](db[_0xb2f9('0x2f')][_0xb2f9('0x46')]);_0x29317b[_0xb2f9('0x32')]=_[_0xb2f9('0x33')](_0x29f03c['query']);_0x29317b[_0xb2f9('0x3c')]=_[_0xb2f9('0x35')](_0x29317b['model'],_0x29317b[_0xb2f9('0x32')]);_0xab6fad[_0xb2f9('0x34')]=_[_0xb2f9('0x35')](_0x29317b['model'],qs[_0xb2f9('0x36')](_0x29f03c[_0xb2f9('0x32')][_0xb2f9('0x36')]));_0xab6fad[_0xb2f9('0x34')]=_0xab6fad['attributes'][_0xb2f9('0x37')]?_0xab6fad[_0xb2f9('0x34')]:_0x29317b['model'];if(_0x29f03c['query'][_0xb2f9('0x41')]){_0xab6fad[_0xb2f9('0x42')]=[{'all':!![]}];}_0xab6fad=_[_0xb2f9('0x28')]({},_0xab6fad,_0x29f03c[_0xb2f9('0x40')]);return db[_0xb2f9('0x2f')]['find'](_0xab6fad)['then'](handleEntityNotFound(_0x321af1,null))['then'](respondWithResult(_0x321af1,null))[_0xb2f9('0x44')](handleError(_0x321af1,null));};exports[_0xb2f9('0x47')]=function(_0x3479d5,_0x10a44a){return db[_0xb2f9('0x2f')][_0xb2f9('0x47')](_0x3479d5[_0xb2f9('0x29')],{})[_0xb2f9('0x21')](respondWithResult(_0x10a44a,0xc9))['catch'](handleError(_0x10a44a,null));};exports[_0xb2f9('0x20')]=function(_0x54ad1b,_0x17d00d){if(_0x54ad1b['body']['id']){delete _0x54ad1b[_0xb2f9('0x29')]['id'];}return db[_0xb2f9('0x2f')][_0xb2f9('0x48')]({'where':{'id':_0x54ad1b[_0xb2f9('0x49')]['id']}})[_0xb2f9('0x21')](handleEntityNotFound(_0x17d00d,null))[_0xb2f9('0x21')](saveUpdates(_0x54ad1b[_0xb2f9('0x29')],null))[_0xb2f9('0x21')](respondWithResult(_0x17d00d,null))[_0xb2f9('0x44')](handleError(_0x17d00d,null));};exports['destroy']=function(_0x33377c,_0x5eda68){return db[_0xb2f9('0x2f')][_0xb2f9('0x48')]({'where':{'id':_0x33377c[_0xb2f9('0x49')]['id']}})[_0xb2f9('0x21')](handleEntityNotFound(_0x5eda68,null))[_0xb2f9('0x21')](removeEntity(_0x5eda68,null))[_0xb2f9('0x44')](handleError(_0x5eda68,null));};exports[_0xb2f9('0x4a')]=function(_0x26a43,_0x548d33){return db[_0xb2f9('0x2f')][_0xb2f9('0x4a')]()[_0xb2f9('0x21')](respondWithResult(_0x548d33,null))[_0xb2f9('0x44')](handleError(_0x548d33,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 699e113..3c2851d 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 _0xc740=['exports','report_square_details','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x190afc,_0x223544){var _0x25c011=function(_0x2d0ac7){while(--_0x2d0ac7){_0x190afc['push'](_0x190afc['shift']());}};_0x25c011(++_0x223544);}(_0xc740,0xba));var _0x0c74=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc740[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x0c74('0x0'));var logger=require(_0x0c74('0x1'))(_0x0c74('0x2'));var moment=require(_0x0c74('0x3'));var BPromise=require('bluebird');var rp=require(_0x0c74('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0c74('0x5'));var attributes=require('./squareReportDetail.attributes');module[_0x0c74('0x6')]=function(_0xd5599c,_0x20eba5){return _0xd5599c['define']('SquareDetailsReport',attributes,{'tableName':_0x0c74('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c36=['moment','request-promise','path','rimraf','./squareReportDetail.attributes','exports','SquareDetailsReport','../../config/logger','api'];(function(_0x2e2b1b,_0x5dc64f){var _0x1c7e1a=function(_0x574420){while(--_0x574420){_0x2e2b1b['push'](_0x2e2b1b['shift']());}};_0x1c7e1a(++_0x5dc64f);}(_0x3c36,0x10c));var _0x63c3=function(_0x1ae4fd,_0x3401fe){_0x1ae4fd=_0x1ae4fd-0x0;var _0x5d8334=_0x3c36[_0x1ae4fd];return _0x5d8334;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x63c3('0x0'))(_0x63c3('0x1'));var moment=require(_0x63c3('0x2'));var BPromise=require('bluebird');var rp=require(_0x63c3('0x3'));var fs=require('fs');var path=require(_0x63c3('0x4'));var rimraf=require(_0x63c3('0x5'));var config=require('../../config/environment');var attributes=require(_0x63c3('0x6'));module[_0x63c3('0x7')]=function(_0x5e1eae,_0x5c381f){return _0x5e1eae['define'](_0x63c3('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 2b0dd04..baaf620 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 _0xf510=['raw','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','create','options'];(function(_0x2cc8b9,_0x73204a){var _0x8331f8=function(_0x2db16e){while(--_0x2db16e){_0x2cc8b9['push'](_0x2cc8b9['shift']());}};_0x8331f8(++_0x73204a);}(_0xf510,0x7e));var _0x0f51=function(_0x11f539,_0x1026d1){_0x11f539=_0x11f539-0x0;var _0x3a5963=_0xf510[_0x11f539];return _0x3a5963;};'use strict';var _=require(_0x0f51('0x0'));var util=require('util');var moment=require(_0x0f51('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f51('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f51('0x3'))['db'];var utils=require(_0x0f51('0x4'));var logger=require(_0x0f51('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0f51('0x6'));var client=jayson['client'][_0x0f51('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2514f5,_0x2bfd7e,_0x4f42eb){return new BPromise(function(_0x599ed1,_0x28a3a5){return client[_0x0f51('0x8')](_0x2514f5,_0x4f42eb)[_0x0f51('0x9')](function(_0x1fc49e){logger['info'](_0x0f51('0xa'),_0x2bfd7e,_0x0f51('0xb'));logger[_0x0f51('0xc')](_0x0f51('0xd'),_0x2bfd7e,'request\x20sent',JSON[_0x0f51('0xe')](_0x1fc49e));if(_0x1fc49e[_0x0f51('0xf')]){if(_0x1fc49e['error'][_0x0f51('0x10')]===0x1f4){logger[_0x0f51('0xf')](_0x0f51('0xa'),_0x2bfd7e,_0x1fc49e['error'][_0x0f51('0x11')]);return _0x28a3a5(_0x1fc49e['error'][_0x0f51('0x11')]);}logger[_0x0f51('0xf')](_0x0f51('0xa'),_0x2bfd7e,_0x1fc49e[_0x0f51('0xf')][_0x0f51('0x11')]);return _0x599ed1(_0x1fc49e[_0x0f51('0xf')][_0x0f51('0x11')]);}else{logger[_0x0f51('0x12')](_0x0f51('0xa'),_0x2bfd7e,'request\x20sent');_0x599ed1(_0x1fc49e[_0x0f51('0x13')][_0x0f51('0x11')]);}})[_0x0f51('0x14')](function(_0x35659f){logger[_0x0f51('0xf')](_0x0f51('0xa'),_0x2bfd7e,_0x35659f);_0x28a3a5(_0x35659f);});});}exports[_0x0f51('0x15')]=function(_0x36357f){var _0x399578=this;return new Promise(function(_0x542ffd,_0x12bb07){return db['SquareDetailsReport'][_0x0f51('0x16')](_0x36357f['body'],{'raw':_0x36357f['options']?_0x36357f[_0x0f51('0x17')][_0x0f51('0x18')]===undefined?!![]:![]:!![]})[_0x0f51('0x9')](function(_0x14a007){logger['info']('CreateSquareDetailsReport',_0x36357f);logger[_0x0f51('0xc')]('CreateSquareDetailsReport',_0x36357f,JSON['stringify'](_0x14a007));_0x542ffd(_0x14a007);})[_0x0f51('0x14')](function(_0x2a17a3){logger[_0x0f51('0xf')]('CreateSquareDetailsReport',_0x2a17a3[_0x0f51('0x11')],_0x36357f);_0x12bb07(_0x399578[_0x0f51('0xf')](0x1f4,_0x2a17a3['message']));});});}; \ No newline at end of file +var _0x11eb=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','options','raw','moment','bluebird'];(function(_0x223b44,_0xb82d32){var _0x400c2e=function(_0x328eff){while(--_0x328eff){_0x223b44['push'](_0x223b44['shift']());}};_0x400c2e(++_0xb82d32);}(_0x11eb,0xdf));var _0xb11e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x11eb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb11e('0x0'));var BPromise=require(_0xb11e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb11e('0x2'));var db=require(_0xb11e('0x3'))['db'];var utils=require(_0xb11e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb11e('0x5'));var jayson=require(_0xb11e('0x6'));var client=jayson[_0xb11e('0x7')][_0xb11e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5106b5,_0x327b8f,_0x3450a4){return new BPromise(function(_0x27df38,_0x3bea02){return client[_0xb11e('0x9')](_0x5106b5,_0x3450a4)[_0xb11e('0xa')](function(_0x18ed15){logger['info'](_0xb11e('0xb'),_0x327b8f,_0xb11e('0xc'));logger[_0xb11e('0xd')](_0xb11e('0xe'),_0x327b8f,_0xb11e('0xc'),JSON[_0xb11e('0xf')](_0x18ed15));if(_0x18ed15[_0xb11e('0x10')]){if(_0x18ed15[_0xb11e('0x10')][_0xb11e('0x11')]===0x1f4){logger['error'](_0xb11e('0xb'),_0x327b8f,_0x18ed15[_0xb11e('0x10')]['message']);return _0x3bea02(_0x18ed15[_0xb11e('0x10')][_0xb11e('0x12')]);}logger[_0xb11e('0x10')](_0xb11e('0xb'),_0x327b8f,_0x18ed15[_0xb11e('0x10')][_0xb11e('0x12')]);return _0x27df38(_0x18ed15[_0xb11e('0x10')][_0xb11e('0x12')]);}else{logger[_0xb11e('0x13')](_0xb11e('0xb'),_0x327b8f,_0xb11e('0xc'));_0x27df38(_0x18ed15[_0xb11e('0x14')][_0xb11e('0x12')]);}})[_0xb11e('0x15')](function(_0x24d0f1){logger[_0xb11e('0x10')](_0xb11e('0xb'),_0x327b8f,_0x24d0f1);_0x3bea02(_0x24d0f1);});});}exports[_0xb11e('0x16')]=function(_0x51cb11){var _0x199ec5=this;return new Promise(function(_0x4e8a8e,_0x39d13a){return db['SquareDetailsReport']['create'](_0x51cb11['body'],{'raw':_0x51cb11[_0xb11e('0x17')]?_0x51cb11['options'][_0xb11e('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x15f12a){logger[_0xb11e('0x13')](_0xb11e('0x16'),_0x51cb11);logger[_0xb11e('0xd')](_0xb11e('0x16'),_0x51cb11,JSON[_0xb11e('0xf')](_0x15f12a));_0x4e8a8e(_0x15f12a);})['catch'](function(_0x1ec743){logger[_0xb11e('0x10')](_0xb11e('0x16'),_0x1ec743[_0xb11e('0x12')],_0x51cb11);_0x39d13a(_0x199ec5[_0xb11e('0x10')](0x1f4,_0x1ec743[_0xb11e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index a342848..85929b5 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 _0x9f5f=['../../components/auth/service','./system.controller','get','isAuthenticated','killProcess','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9f5f,0x197));var _0xf9f5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9f5f[_0x40a045];return _0x1a687c;};'use strict';var express=require(_0xf9f5('0x0'));var router=express['Router']();var auth=require(_0xf9f5('0x1'));var controller=require(_0xf9f5('0x2'));router[_0xf9f5('0x3')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/process/:pid/kill',auth[_0xf9f5('0x4')](),controller[_0xf9f5('0x5')]);module['exports']=router; \ No newline at end of file +var _0x5527=['/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x1166bc,_0x552156){var _0x18a4ce=function(_0x2f144b){while(--_0x2f144b){_0x1166bc['push'](_0x1166bc['shift']());}};_0x18a4ce(++_0x552156);}(_0x5527,0x111));var _0x7552=function(_0x4b35ad,_0x3f26b3){_0x4b35ad=_0x4b35ad-0x0;var _0x363616=_0x5527[_0x4b35ad];return _0x363616;};'use strict';var express=require(_0x7552('0x0'));var router=express[_0x7552('0x1')]();var auth=require(_0x7552('0x2'));var controller=require(_0x7552('0x3'));router[_0x7552('0x4')]('/',auth[_0x7552('0x5')](),controller[_0x7552('0x6')]);router['get'](_0x7552('0x7'),auth[_0x7552('0x5')](),controller[_0x7552('0x8')]);module[_0x7552('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index dab8420..a1b2407 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 _0xd664=['kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','util','bluebird','error','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0xd664,0xa5));var _0x4d66=function(_0x376190,_0x2fc049){_0x376190=_0x376190-0x0;var _0x463f35=_0xd664[_0x376190];return _0x463f35;};'use strict';var info=require(_0x4d66('0x0'));var exec=require(_0x4d66('0x1'))['exec'];var logger=require('../../config/logger')('api');var util=require(_0x4d66('0x2'));var BPromise=require(_0x4d66('0x3'));var _=require('lodash');function handleError(_0x48fd1a,_0x335a49,_0x3f5a6e){_0x335a49=_0x335a49||0x1f4;return function(_0x3806ad){logger[_0x4d66('0x4')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3f5a6e,_0x335a49,util[_0x4d66('0x5')](_0x3806ad,{'showHidden':![],'depth':null}));delete _0x3806ad[_0x4d66('0x6')];_0x48fd1a[_0x4d66('0x7')](_0x335a49)[_0x4d66('0x8')](_0x3806ad);};}exports[_0x4d66('0x9')]=function(_0x2eb5b6,_0x434138){return info[_0x4d66('0xa')]()[_0x4d66('0xb')](function(_0xe200ed){return _0x434138['status'](0xc8)[_0x4d66('0xc')](_0xe200ed);})[_0x4d66('0xd')](function(_0xa0d547){return _0x434138[_0x4d66('0x7')](0x1f4)[_0x4d66('0xc')](_0xa0d547);});};exports[_0x4d66('0xe')]=function(_0x3da8ec,_0x19900d){var _0x32c6ba=[_0x4d66('0xf')];return new BPromise(function(_0x3e47f6,_0x3b8214){return exec(util[_0x4d66('0x10')](_0x4d66('0x11'),_0x3da8ec['params'][_0x4d66('0x12')]),function(_0x5e1de3,_0x175519,_0x3624db){if(_0x5e1de3){return _0x3b8214(_0x5e1de3);}return _0x3e47f6(_0x175519);});})[_0x4d66('0xb')](function(_0x4b647b){var _0x2aaf2b=![];var _0x3d3cda=_0x4b647b[_0x4d66('0x13')](/\n/);for(var _0x4f0150=0x0,_0xbd27f2=_0x32c6ba[_0x4d66('0x14')];_0x4f0150<_0xbd27f2,_0x2aaf2b===![];_0x4f0150+=0x1){if(_0x4b647b[_0x4d66('0x15')](_0x32c6ba[_0x4f0150])>=0x0){_0x2aaf2b=!![];}}if(!_0x2aaf2b){throw new Error(util['format'](_0x4d66('0x16'),_0x3da8ec[_0x4d66('0x17')][_0x4d66('0x12')]));}process[_0x4d66('0x18')](_0x3da8ec[_0x4d66('0x17')][_0x4d66('0x12')],_0x4d66('0x19'));return _0x19900d[_0x4d66('0x7')](0xc8)[_0x4d66('0xc')]({'message':util['format'](_0x4d66('0x1a'),_0x3da8ec[_0x4d66('0x17')][_0x4d66('0x12')])});})[_0x4d66('0xd')](handleError(_0x19900d,null,_0x4d66('0xe')));}; \ No newline at end of file +var _0x9b8e=['inspect','name','status','getAllData','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x46f506,_0x216aa5){var _0xbfe9a9=function(_0x632e9f){while(--_0x632e9f){_0x46f506['push'](_0x46f506['shift']());}};_0xbfe9a9(++_0x216aa5);}(_0x9b8e,0x158));var _0xe9b8=function(_0x470de8,_0x50dec7){_0x470de8=_0x470de8-0x0;var _0x47a03e=_0x9b8e[_0x470de8];return _0x47a03e;};'use strict';var info=require(_0xe9b8('0x0'));var exec=require('child_process')[_0xe9b8('0x1')];var logger=require(_0xe9b8('0x2'))('api');var util=require('util');var BPromise=require(_0xe9b8('0x3'));var _=require('lodash');function handleError(_0x1fb7b1,_0x175526,_0x5dc89c){_0x175526=_0x175526||0x1f4;return function(_0x192595){logger[_0xe9b8('0x4')](_0xe9b8('0x5'),_0x5dc89c,_0x175526,util[_0xe9b8('0x6')](_0x192595,{'showHidden':![],'depth':null}));delete _0x192595[_0xe9b8('0x7')];_0x1fb7b1[_0xe9b8('0x8')](_0x175526)['send'](_0x192595);};}exports['index']=function(_0xd19fb9,_0x25caff){return info[_0xe9b8('0x9')]()[_0xe9b8('0xa')](function(_0x4aab24){return _0x25caff[_0xe9b8('0x8')](0xc8)['json'](_0x4aab24);})[_0xe9b8('0xb')](function(_0x305fa4){return _0x25caff[_0xe9b8('0x8')](0x1f4)[_0xe9b8('0xc')](_0x305fa4);});};exports[_0xe9b8('0xd')]=function(_0x250656,_0x6c5395){var _0x3ac945=[_0xe9b8('0xe')];return new BPromise(function(_0x3bab83,_0x3ecb54){return exec(util[_0xe9b8('0xf')](_0xe9b8('0x10'),_0x250656['params']['pid']),function(_0x568fb9,_0x4b8772,_0x38f287){if(_0x568fb9){return _0x3ecb54(_0x568fb9);}return _0x3bab83(_0x4b8772);});})['then'](function(_0x59a70c){var _0xe05950=![];var _0x13933a=_0x59a70c[_0xe9b8('0x11')](/\n/);for(var _0xdff91b=0x0,_0x592bf3=_0x3ac945[_0xe9b8('0x12')];_0xdff91b<_0x592bf3,_0xe05950===![];_0xdff91b+=0x1){if(_0x59a70c['indexOf'](_0x3ac945[_0xdff91b])>=0x0){_0xe05950=!![];}}if(!_0xe05950){throw new Error(util[_0xe9b8('0xf')](_0xe9b8('0x13'),_0x250656[_0xe9b8('0x14')][_0xe9b8('0x15')]));}process[_0xe9b8('0x16')](_0x250656[_0xe9b8('0x14')]['pid'],_0xe9b8('0x17'));return _0x6c5395['status'](0xc8)[_0xe9b8('0xc')]({'message':util[_0xe9b8('0xf')](_0xe9b8('0x18'),_0x250656['params'][_0xe9b8('0x15')])});})[_0xe9b8('0xb')](handleError(_0x6c5395,null,_0xe9b8('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 5aaa7bd..109cb83 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 _0x2b37=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x2b37,0x12b));var _0x72b3=function(_0x24721a,_0x1ac53c){_0x24721a=_0x24721a-0x0;var _0x6a9880=_0x2b37[_0x24721a];return _0x6a9880;};'use strict';var multer=require(_0x72b3('0x0'));var util=require(_0x72b3('0x1'));var path=require(_0x72b3('0x2'));var timeout=require(_0x72b3('0x3'));var express=require(_0x72b3('0x4'));var router=express[_0x72b3('0x5')]();var fs_extra=require(_0x72b3('0x6'));var auth=require(_0x72b3('0x7'));var interaction=require(_0x72b3('0x8'));var config=require(_0x72b3('0x9'));var controller=require('./tag.controller');router[_0x72b3('0xa')]('/',auth[_0x72b3('0xb')](),controller['index']);router[_0x72b3('0xa')](_0x72b3('0xc'),auth[_0x72b3('0xb')](),controller['show']);router[_0x72b3('0xd')]('/',auth[_0x72b3('0xb')](),controller[_0x72b3('0xe')]);router['put'](_0x72b3('0xc'),auth[_0x72b3('0xb')](),controller[_0x72b3('0xf')]);router[_0x72b3('0x10')](_0x72b3('0xc'),auth[_0x72b3('0xb')](),controller[_0x72b3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7573=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x2a7763,_0x2ff6c6){var _0x1df53e=function(_0x19dd74){while(--_0x19dd74){_0x2a7763['push'](_0x2a7763['shift']());}};_0x1df53e(++_0x2ff6c6);}(_0x7573,0x72));var _0x3757=function(_0x4405d0,_0x1cefb7){_0x4405d0=_0x4405d0-0x0;var _0x3e6a8e=_0x7573[_0x4405d0];return _0x3e6a8e;};'use strict';var multer=require(_0x3757('0x0'));var util=require(_0x3757('0x1'));var path=require(_0x3757('0x2'));var timeout=require(_0x3757('0x3'));var express=require(_0x3757('0x4'));var router=express[_0x3757('0x5')]();var fs_extra=require(_0x3757('0x6'));var auth=require(_0x3757('0x7'));var interaction=require(_0x3757('0x8'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x3757('0x9')]('/',auth['isAuthenticated'](),controller[_0x3757('0xa')]);router['get'](_0x3757('0xb'),auth[_0x3757('0xc')](),controller[_0x3757('0xd')]);router[_0x3757('0xe')]('/',auth[_0x3757('0xc')](),controller[_0x3757('0xf')]);router[_0x3757('0x10')](_0x3757('0xb'),auth[_0x3757('0xc')](),controller[_0x3757('0x11')]);router[_0x3757('0x12')](_0x3757('0xb'),auth[_0x3757('0xc')](),controller[_0x3757('0x13')]);module[_0x3757('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 7c6ac88..2311626 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 _0xea28=['exports','STRING','name','#0091EA','sequelize'];(function(_0x57aafb,_0x28b787){var _0x45f312=function(_0x4af127){while(--_0x4af127){_0x57aafb['push'](_0x57aafb['shift']());}};_0x45f312(++_0x28b787);}(_0xea28,0x13a));var _0x8ea2=function(_0x2b6fac,_0x4c8077){_0x2b6fac=_0x2b6fac-0x0;var _0x30e734=_0xea28[_0x2b6fac];return _0x30e734;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'name':{'type':Sequelize[_0x8ea2('0x2')],'unique':_0x8ea2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':_0x8ea2('0x4')},'description':{'type':Sequelize[_0x8ea2('0x2')]}}; \ No newline at end of file +var _0xdd4f=['sequelize','STRING','#0091EA'];(function(_0x51d29b,_0x513d45){var _0x3b465c=function(_0xa821f6){while(--_0xa821f6){_0x51d29b['push'](_0x51d29b['shift']());}};_0x3b465c(++_0x513d45);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5953c7,_0x4d7d19){_0x5953c7=_0x5953c7-0x0;var _0x445271=_0xdd4f[_0x5953c7];return _0x445271;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xfdd4('0x1')],'defaultValue':_0xfdd4('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index fd6bbe2..229c232 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 _0xcf23=['request-promise','moment','bluebird','path','sox','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','then','get','Tags','UserProfileResource','sendStatus','stack','name','send','merge','contact','message','agent','interaction','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','fast-json-patch'];(function(_0x749173,_0x55e7c7){var _0x21b5d6=function(_0x16ec45){while(--_0x16ec45){_0x749173['push'](_0x749173['shift']());}};_0x21b5d6(++_0x55e7c7);}(_0xcf23,0x1a8));var _0x3cf2=function(_0x1bf992,_0x38677b){_0x1bf992=_0x1bf992-0x0;var _0x276d12=_0xcf23[_0x1bf992];return _0x276d12;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3cf2('0x0'));var rp=require(_0x3cf2('0x1'));var moment=require(_0x3cf2('0x2'));var BPromise=require(_0x3cf2('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3cf2('0x4'));var sox=require(_0x3cf2('0x5'));var csv=require('to-csv');var ejs=require(_0x3cf2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3cf2('0x7'));var crypto=require(_0x3cf2('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3cf2('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3cf2('0xa'));var Redis=require(_0x3cf2('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x3cf2('0xc'));var as=require(_0x3cf2('0xd'));var hardwareService=require(_0x3cf2('0xe'));var logger=require(_0x3cf2('0xf'))(_0x3cf2('0x10'));var utils=require(_0x3cf2('0x11'));var config=require(_0x3cf2('0x12'));var licenseUtil=require(_0x3cf2('0x13'));var db=require(_0x3cf2('0x14'))['db'];function respondWithStatusCode(_0x462613,_0x40615f){_0x40615f=_0x40615f||0xcc;return function(_0x37248d){if(_0x37248d){return _0x462613['sendStatus'](_0x40615f);}return _0x462613[_0x3cf2('0x15')](_0x40615f)[_0x3cf2('0x16')]();};}function respondWithResult(_0x14a991,_0x38070e){_0x38070e=_0x38070e||0xc8;return function(_0x276f6d){if(_0x276f6d){return _0x14a991['status'](_0x38070e)['json'](_0x276f6d);}};}function respondWithFilteredResult(_0x3af9c7,_0x1306f6){return function(_0x4b9853){if(_0x4b9853){var _0x207963=typeof _0x1306f6[_0x3cf2('0x17')]===_0x3cf2('0x18')&&typeof _0x1306f6['limit']===_0x3cf2('0x18');var _0x4ef241=_0x4b9853[_0x3cf2('0x19')];var _0x6696a6=_0x207963?0x0:_0x1306f6[_0x3cf2('0x17')];var _0x4b70aa=_0x207963?_0x4b9853[_0x3cf2('0x19')]:_0x1306f6[_0x3cf2('0x17')]+_0x1306f6['limit'];var _0x13ed94;if(_0x4b70aa>=_0x4ef241){_0x4b70aa=_0x4ef241;_0x13ed94=0xc8;}else{_0x13ed94=0xce;}_0x3af9c7['status'](_0x13ed94);return _0x3af9c7[_0x3cf2('0x1a')](_0x3cf2('0x1b'),_0x6696a6+'-'+_0x4b70aa+'/'+_0x4ef241)[_0x3cf2('0x1c')](_0x4b9853);}return null;};}function patchUpdates(_0x4edd92){return function(_0x473f12){try{jsonpatch[_0x3cf2('0x1d')](_0x473f12,_0x4edd92,!![]);}catch(_0x2764f2){return BPromise['reject'](_0x2764f2);}return _0x473f12['save']();};}function saveUpdates(_0x45e098,_0x4fab3a){return function(_0x1ef080){if(_0x1ef080){return _0x1ef080['update'](_0x45e098)['then'](function(_0x310574){return _0x310574;});}return null;};}function removeEntity(_0x47bbc8,_0x441dc8){return function(_0x525016){if(_0x525016){return _0x525016['destroy']()[_0x3cf2('0x1e')](function(){var _0x33cbdc=_0x525016[_0x3cf2('0x1f')]({'plain':!![]});var _0x5c572a=_0x3cf2('0x20');return db[_0x3cf2('0x21')]['destroy']({'where':{'type':_0x5c572a,'resourceId':_0x33cbdc['id']}})[_0x3cf2('0x1e')](function(){return _0x525016;});})[_0x3cf2('0x1e')](function(){_0x47bbc8[_0x3cf2('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8159b6,_0x7ebf94){return function(_0x5a5654){if(!_0x5a5654){_0x8159b6[_0x3cf2('0x22')](0x194);}return _0x5a5654;};}function handleError(_0x8c989,_0x20d1a9){_0x20d1a9=_0x20d1a9||0x1f4;return function(_0x4abe6b){logger['error'](_0x4abe6b[_0x3cf2('0x23')]);if(_0x4abe6b[_0x3cf2('0x24')]){delete _0x4abe6b[_0x3cf2('0x24')];}_0x8c989[_0x3cf2('0x15')](_0x20d1a9)[_0x3cf2('0x25')](_0x4abe6b);};}function getMustacheRender(_0xd4a5e0,_0x166be6){return Mustache['render'](_0xd4a5e0,_[_0x3cf2('0x26')](_0x166be6['body'],{'contact':_0x166be6[_0x3cf2('0x27')],'message':_0x166be6[_0x3cf2('0x28')],'agent':_0x166be6[_0x3cf2('0x29')],'interaction':_0x166be6[_0x3cf2('0x2a')],'account':_0x166be6['account']}))||'';}exports['index']=function(_0x53498f,_0x135c48){var _0x5a19ac={},_0x131a3b={},_0x5808c5={'count':0x0,'rows':[]};var _0x244b91=_[_0x3cf2('0x2b')](db[_0x3cf2('0x2c')][_0x3cf2('0x2d')],function(_0x3676b2){return{'name':_0x3676b2[_0x3cf2('0x2e')],'type':_0x3676b2[_0x3cf2('0x2f')][_0x3cf2('0x30')]};});_0x131a3b[_0x3cf2('0x31')]=_['map'](_0x244b91,_0x3cf2('0x24'));_0x131a3b[_0x3cf2('0x32')]=_[_0x3cf2('0x33')](_0x53498f[_0x3cf2('0x32')]);_0x131a3b[_0x3cf2('0x34')]=_['intersection'](_0x131a3b[_0x3cf2('0x31')],_0x131a3b[_0x3cf2('0x32')]);_0x5a19ac['attributes']=_[_0x3cf2('0x35')](_0x131a3b[_0x3cf2('0x31')],qs[_0x3cf2('0x36')](_0x53498f[_0x3cf2('0x32')]['fields']));_0x5a19ac[_0x3cf2('0x37')]=_0x5a19ac[_0x3cf2('0x37')][_0x3cf2('0x38')]?_0x5a19ac[_0x3cf2('0x37')]:_0x131a3b[_0x3cf2('0x31')];if(!_0x53498f[_0x3cf2('0x32')][_0x3cf2('0x39')](_0x3cf2('0x3a'))){_0x5a19ac[_0x3cf2('0x3b')]=qs[_0x3cf2('0x3b')](_0x53498f['query'][_0x3cf2('0x3b')]);_0x5a19ac[_0x3cf2('0x17')]=qs[_0x3cf2('0x17')](_0x53498f[_0x3cf2('0x32')]['offset']);}_0x5a19ac[_0x3cf2('0x3c')]=qs[_0x3cf2('0x3d')](_0x53498f['query'][_0x3cf2('0x3d')]);_0x5a19ac[_0x3cf2('0x3e')]=qs[_0x3cf2('0x34')](_['pick'](_0x53498f[_0x3cf2('0x32')],_0x131a3b[_0x3cf2('0x34')]),_0x244b91);if(_0x53498f[_0x3cf2('0x32')][_0x3cf2('0x3f')]){_0x5a19ac[_0x3cf2('0x3e')]=_['merge'](_0x5a19ac[_0x3cf2('0x3e')],{'$or':_[_0x3cf2('0x2b')](_0x244b91,function(_0x26f189){if(_0x26f189[_0x3cf2('0x2f')]!==_0x3cf2('0x40')){var _0x2513c2={};_0x2513c2[_0x26f189['name']]={'$like':'%'+_0x53498f[_0x3cf2('0x32')][_0x3cf2('0x3f')]+'%'};return _0x2513c2;}})});}_0x5a19ac=_['merge']({},_0x5a19ac,_0x53498f[_0x3cf2('0x41')]);var _0x71d758={'where':_0x5a19ac[_0x3cf2('0x3e')]};return db[_0x3cf2('0x2c')]['count'](_0x71d758)[_0x3cf2('0x1e')](function(_0x6b8603){_0x5808c5[_0x3cf2('0x19')]=_0x6b8603;if(_0x53498f[_0x3cf2('0x32')][_0x3cf2('0x42')]){_0x5a19ac[_0x3cf2('0x43')]=[{'all':!![]}];}return db['Tag'][_0x3cf2('0x44')](_0x5a19ac);})['then'](function(_0x267c20){_0x5808c5[_0x3cf2('0x45')]=_0x267c20;return _0x5808c5;})[_0x3cf2('0x1e')](respondWithFilteredResult(_0x135c48,_0x5a19ac))[_0x3cf2('0x46')](handleError(_0x135c48,null));};exports[_0x3cf2('0x47')]=function(_0x2557ac,_0xfae31e){var _0x27dacc={'raw':!![],'where':{'id':_0x2557ac[_0x3cf2('0x48')]['id']}},_0x3bd813={};_0x3bd813[_0x3cf2('0x31')]=_[_0x3cf2('0x33')](db['Tag']['rawAttributes']);_0x3bd813[_0x3cf2('0x32')]=_[_0x3cf2('0x33')](_0x2557ac[_0x3cf2('0x32')]);_0x3bd813['filters']=_[_0x3cf2('0x35')](_0x3bd813[_0x3cf2('0x31')],_0x3bd813['query']);_0x27dacc[_0x3cf2('0x37')]=_['intersection'](_0x3bd813[_0x3cf2('0x31')],qs['fields'](_0x2557ac[_0x3cf2('0x32')][_0x3cf2('0x36')]));_0x27dacc[_0x3cf2('0x37')]=_0x27dacc['attributes'][_0x3cf2('0x38')]?_0x27dacc[_0x3cf2('0x37')]:_0x3bd813[_0x3cf2('0x31')];if(_0x2557ac['query']['includeAll']){_0x27dacc[_0x3cf2('0x43')]=[{'all':!![]}];}_0x27dacc=_['merge']({},_0x27dacc,_0x2557ac[_0x3cf2('0x41')]);return db[_0x3cf2('0x2c')][_0x3cf2('0x49')](_0x27dacc)[_0x3cf2('0x1e')](handleEntityNotFound(_0xfae31e,null))[_0x3cf2('0x1e')](respondWithResult(_0xfae31e,null))[_0x3cf2('0x46')](handleError(_0xfae31e,null));};exports[_0x3cf2('0x4a')]=function(_0x287753,_0x468643){return db[_0x3cf2('0x2c')][_0x3cf2('0x4a')](_0x287753[_0x3cf2('0x4b')],{})[_0x3cf2('0x1e')](function(_0x301c9c){var _0x52bb44=_0x287753[_0x3cf2('0x4c')][_0x3cf2('0x1f')]({'plain':!![]});if(!_0x52bb44)throw new Error(_0x3cf2('0x4d'));if(_0x52bb44[_0x3cf2('0x4e')]===_0x3cf2('0x4c')){var _0x16974b=_0x301c9c[_0x3cf2('0x1f')]({'plain':!![]});var _0x3f928f=_0x3cf2('0x20');return db[_0x3cf2('0x4f')][_0x3cf2('0x49')]({'where':{'name':_0x3f928f,'userProfileId':_0x52bb44[_0x3cf2('0x50')]},'raw':!![]})[_0x3cf2('0x1e')](function(_0x3db621){if(_0x3db621&&_0x3db621['autoAssociation']===0x0){return db[_0x3cf2('0x21')][_0x3cf2('0x4a')]({'name':_0x16974b[_0x3cf2('0x24')],'resourceId':_0x16974b['id'],'type':_0x3db621['name'],'sectionId':_0x3db621['id']},{})[_0x3cf2('0x1e')](function(){return _0x301c9c;});}else{return _0x301c9c;}})[_0x3cf2('0x46')](function(_0x357cde){logger[_0x3cf2('0x51')](_0x3cf2('0x52'),_0x357cde);throw _0x357cde;});}return _0x301c9c;})['then'](respondWithResult(_0x468643,0xc9))[_0x3cf2('0x46')](handleError(_0x468643,null));};exports[_0x3cf2('0x53')]=function(_0x2833fc,_0x3377f1){if(_0x2833fc['body']['id']){delete _0x2833fc['body']['id'];}return db['Tag'][_0x3cf2('0x49')]({'where':{'id':_0x2833fc[_0x3cf2('0x48')]['id']}})[_0x3cf2('0x1e')](handleEntityNotFound(_0x3377f1,null))[_0x3cf2('0x1e')](saveUpdates(_0x2833fc[_0x3cf2('0x4b')],null))[_0x3cf2('0x1e')](respondWithResult(_0x3377f1,null))[_0x3cf2('0x46')](handleError(_0x3377f1,null));};exports[_0x3cf2('0x54')]=function(_0x12b6a5,_0x5a1860){return db[_0x3cf2('0x2c')]['find']({'where':{'id':_0x12b6a5[_0x3cf2('0x48')]['id']}})[_0x3cf2('0x1e')](handleEntityNotFound(_0x5a1860,null))['then'](removeEntity(_0x5a1860,null))['catch'](handleError(_0x5a1860,null));}; \ No newline at end of file +var _0xd38f=['undefined','limit','count','offset','Content-Range','json','reject','save','then','destroy','Tags','UserProfileResource','sendStatus','stack','name','render','merge','body','message','agent','interaction','index','Tag','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','update','eml-format','rimraf','fast-json-patch','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/utils','../../config/environment','../../mysqldb','status'];(function(_0x141764,_0x232824){var _0x4edf69=function(_0x333335){while(--_0x333335){_0x141764['push'](_0x141764['shift']());}};_0x4edf69(++_0x232824);}(_0xd38f,0x1f2));var _0xfd38=function(_0x4e2790,_0x46e6a8){_0x4e2790=_0x4e2790-0x0;var _0x4856fe=_0xd38f[_0x4e2790];return _0x4856fe;};'use strict';var emlformat=require(_0xfd38('0x0'));var rimraf=require(_0xfd38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd38('0x2'));var rp=require(_0xfd38('0x3'));var moment=require(_0xfd38('0x4'));var BPromise=require(_0xfd38('0x5'));var Mustache=require(_0xfd38('0x6'));var util=require(_0xfd38('0x7'));var path=require(_0xfd38('0x8'));var sox=require(_0xfd38('0x9'));var csv=require(_0xfd38('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd38('0xb'));var _=require(_0xfd38('0xc'));var squel=require(_0xfd38('0xd'));var crypto=require(_0xfd38('0xe'));var jsforce=require(_0xfd38('0xf'));var deskjs=require(_0xfd38('0x10'));var toCsv=require(_0xfd38('0xa'));var querystring=require(_0xfd38('0x11'));var Papa=require(_0xfd38('0x12'));var Redis=require(_0xfd38('0x13'));var authService=require(_0xfd38('0x14'));var qs=require(_0xfd38('0x15'));var as=require(_0xfd38('0x16'));var hardwareService=require(_0xfd38('0x17'));var logger=require(_0xfd38('0x18'))(_0xfd38('0x19'));var utils=require(_0xfd38('0x1a'));var config=require(_0xfd38('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd38('0x1c'))['db'];function respondWithStatusCode(_0x15fc66,_0x1e31fa){_0x1e31fa=_0x1e31fa||0xcc;return function(_0xe99403){if(_0xe99403){return _0x15fc66['sendStatus'](_0x1e31fa);}return _0x15fc66[_0xfd38('0x1d')](_0x1e31fa)['end']();};}function respondWithResult(_0x457631,_0x261dca){_0x261dca=_0x261dca||0xc8;return function(_0x406369){if(_0x406369){return _0x457631['status'](_0x261dca)['json'](_0x406369);}};}function respondWithFilteredResult(_0x136b4d,_0xb8848d){return function(_0x5ec97e){if(_0x5ec97e){var _0x46f653=typeof _0xb8848d['offset']===_0xfd38('0x1e')&&typeof _0xb8848d[_0xfd38('0x1f')]===_0xfd38('0x1e');var _0x1c486a=_0x5ec97e[_0xfd38('0x20')];var _0x5c2939=_0x46f653?0x0:_0xb8848d[_0xfd38('0x21')];var _0x1eab96=_0x46f653?_0x5ec97e['count']:_0xb8848d[_0xfd38('0x21')]+_0xb8848d[_0xfd38('0x1f')];var _0x598f25;if(_0x1eab96>=_0x1c486a){_0x1eab96=_0x1c486a;_0x598f25=0xc8;}else{_0x598f25=0xce;}_0x136b4d['status'](_0x598f25);return _0x136b4d['set'](_0xfd38('0x22'),_0x5c2939+'-'+_0x1eab96+'/'+_0x1c486a)[_0xfd38('0x23')](_0x5ec97e);}return null;};}function patchUpdates(_0x44ecda){return function(_0x1621ef){try{jsonpatch['apply'](_0x1621ef,_0x44ecda,!![]);}catch(_0x416d5c){return BPromise[_0xfd38('0x24')](_0x416d5c);}return _0x1621ef[_0xfd38('0x25')]();};}function saveUpdates(_0x37544d,_0x54a38f){return function(_0x5cd98d){if(_0x5cd98d){return _0x5cd98d['update'](_0x37544d)[_0xfd38('0x26')](function(_0x5aca86){return _0x5aca86;});}return null;};}function removeEntity(_0x474744,_0x2cf8de){return function(_0xbec701){if(_0xbec701){return _0xbec701[_0xfd38('0x27')]()[_0xfd38('0x26')](function(){var _0xc6f03f=_0xbec701['get']({'plain':!![]});var _0x3fe30c=_0xfd38('0x28');return db[_0xfd38('0x29')]['destroy']({'where':{'type':_0x3fe30c,'resourceId':_0xc6f03f['id']}})['then'](function(){return _0xbec701;});})[_0xfd38('0x26')](function(){_0x474744['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f134f,_0xe3f62b){return function(_0x936cb){if(!_0x936cb){_0x3f134f[_0xfd38('0x2a')](0x194);}return _0x936cb;};}function handleError(_0x4b4709,_0x417b9d){_0x417b9d=_0x417b9d||0x1f4;return function(_0x570952){logger['error'](_0x570952[_0xfd38('0x2b')]);if(_0x570952[_0xfd38('0x2c')]){delete _0x570952[_0xfd38('0x2c')];}_0x4b4709[_0xfd38('0x1d')](_0x417b9d)['send'](_0x570952);};}function getMustacheRender(_0x20268,_0x572310){return Mustache[_0xfd38('0x2d')](_0x20268,_[_0xfd38('0x2e')](_0x572310[_0xfd38('0x2f')],{'contact':_0x572310['contact'],'message':_0x572310[_0xfd38('0x30')],'agent':_0x572310[_0xfd38('0x31')],'interaction':_0x572310[_0xfd38('0x32')],'account':_0x572310['account']}))||'';}exports[_0xfd38('0x33')]=function(_0x415387,_0x2e0785){var _0x514ef7={},_0x30f4b0={},_0x3df9be={'count':0x0,'rows':[]};var _0x63b4c=_['map'](db[_0xfd38('0x34')]['rawAttributes'],function(_0x590942){return{'name':_0x590942[_0xfd38('0x35')],'type':_0x590942[_0xfd38('0x36')][_0xfd38('0x37')]};});_0x30f4b0[_0xfd38('0x38')]=_[_0xfd38('0x39')](_0x63b4c,_0xfd38('0x2c'));_0x30f4b0[_0xfd38('0x3a')]=_[_0xfd38('0x3b')](_0x415387['query']);_0x30f4b0[_0xfd38('0x3c')]=_[_0xfd38('0x3d')](_0x30f4b0['model'],_0x30f4b0['query']);_0x514ef7[_0xfd38('0x3e')]=_[_0xfd38('0x3d')](_0x30f4b0[_0xfd38('0x38')],qs[_0xfd38('0x3f')](_0x415387[_0xfd38('0x3a')]['fields']));_0x514ef7['attributes']=_0x514ef7[_0xfd38('0x3e')][_0xfd38('0x40')]?_0x514ef7[_0xfd38('0x3e')]:_0x30f4b0[_0xfd38('0x38')];if(!_0x415387[_0xfd38('0x3a')][_0xfd38('0x41')](_0xfd38('0x42'))){_0x514ef7[_0xfd38('0x1f')]=qs[_0xfd38('0x1f')](_0x415387[_0xfd38('0x3a')]['limit']);_0x514ef7[_0xfd38('0x21')]=qs[_0xfd38('0x21')](_0x415387['query'][_0xfd38('0x21')]);}_0x514ef7['order']=qs[_0xfd38('0x43')](_0x415387[_0xfd38('0x3a')][_0xfd38('0x43')]);_0x514ef7['where']=qs[_0xfd38('0x3c')](_['pick'](_0x415387[_0xfd38('0x3a')],_0x30f4b0['filters']),_0x63b4c);if(_0x415387['query'][_0xfd38('0x44')]){_0x514ef7[_0xfd38('0x45')]=_['merge'](_0x514ef7[_0xfd38('0x45')],{'$or':_['map'](_0x63b4c,function(_0x5be7ed){if(_0x5be7ed['type']!==_0xfd38('0x46')){var _0x3ad3ad={};_0x3ad3ad[_0x5be7ed[_0xfd38('0x2c')]]={'$like':'%'+_0x415387[_0xfd38('0x3a')][_0xfd38('0x44')]+'%'};return _0x3ad3ad;}})});}_0x514ef7=_[_0xfd38('0x2e')]({},_0x514ef7,_0x415387[_0xfd38('0x47')]);var _0x49b1af={'where':_0x514ef7[_0xfd38('0x45')]};return db['Tag'][_0xfd38('0x20')](_0x49b1af)[_0xfd38('0x26')](function(_0x530f5e){_0x3df9be[_0xfd38('0x20')]=_0x530f5e;if(_0x415387[_0xfd38('0x3a')][_0xfd38('0x48')]){_0x514ef7[_0xfd38('0x49')]=[{'all':!![]}];}return db[_0xfd38('0x34')][_0xfd38('0x4a')](_0x514ef7);})['then'](function(_0x5899d1){_0x3df9be['rows']=_0x5899d1;return _0x3df9be;})[_0xfd38('0x26')](respondWithFilteredResult(_0x2e0785,_0x514ef7))['catch'](handleError(_0x2e0785,null));};exports['show']=function(_0x2418db,_0x55d5f8){var _0x2ec22b={'raw':!![],'where':{'id':_0x2418db[_0xfd38('0x4b')]['id']}},_0xbd3f84={};_0xbd3f84[_0xfd38('0x38')]=_['keys'](db[_0xfd38('0x34')][_0xfd38('0x4c')]);_0xbd3f84[_0xfd38('0x3a')]=_[_0xfd38('0x3b')](_0x2418db[_0xfd38('0x3a')]);_0xbd3f84[_0xfd38('0x3c')]=_[_0xfd38('0x3d')](_0xbd3f84['model'],_0xbd3f84['query']);_0x2ec22b[_0xfd38('0x3e')]=_[_0xfd38('0x3d')](_0xbd3f84[_0xfd38('0x38')],qs[_0xfd38('0x3f')](_0x2418db[_0xfd38('0x3a')][_0xfd38('0x3f')]));_0x2ec22b[_0xfd38('0x3e')]=_0x2ec22b['attributes'][_0xfd38('0x40')]?_0x2ec22b[_0xfd38('0x3e')]:_0xbd3f84[_0xfd38('0x38')];if(_0x2418db[_0xfd38('0x3a')][_0xfd38('0x48')]){_0x2ec22b[_0xfd38('0x49')]=[{'all':!![]}];}_0x2ec22b=_[_0xfd38('0x2e')]({},_0x2ec22b,_0x2418db[_0xfd38('0x47')]);return db['Tag'][_0xfd38('0x4d')](_0x2ec22b)[_0xfd38('0x26')](handleEntityNotFound(_0x55d5f8,null))[_0xfd38('0x26')](respondWithResult(_0x55d5f8,null))[_0xfd38('0x4e')](handleError(_0x55d5f8,null));};exports[_0xfd38('0x4f')]=function(_0x3e6bed,_0x10b886){return db[_0xfd38('0x34')][_0xfd38('0x4f')](_0x3e6bed[_0xfd38('0x2f')],{})[_0xfd38('0x26')](function(_0x326b0a){var _0x524803=_0x3e6bed['user'][_0xfd38('0x50')]({'plain':!![]});if(!_0x524803)throw new Error(_0xfd38('0x51'));if(_0x524803[_0xfd38('0x52')]===_0xfd38('0x53')){var _0x59916e=_0x326b0a[_0xfd38('0x50')]({'plain':!![]});var _0x466b42='Tags';return db[_0xfd38('0x54')][_0xfd38('0x4d')]({'where':{'name':_0x466b42,'userProfileId':_0x524803['userProfileId']},'raw':!![]})['then'](function(_0x2a6428){if(_0x2a6428&&_0x2a6428[_0xfd38('0x55')]===0x0){return db[_0xfd38('0x29')][_0xfd38('0x4f')]({'name':_0x59916e[_0xfd38('0x2c')],'resourceId':_0x59916e['id'],'type':_0x2a6428[_0xfd38('0x2c')],'sectionId':_0x2a6428['id']},{})['then'](function(){return _0x326b0a;});}else{return _0x326b0a;}})['catch'](function(_0x1880c3){logger[_0xfd38('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1880c3);throw _0x1880c3;});}return _0x326b0a;})[_0xfd38('0x26')](respondWithResult(_0x10b886,0xc9))['catch'](handleError(_0x10b886,null));};exports[_0xfd38('0x57')]=function(_0x1fdeb7,_0x5c236c){if(_0x1fdeb7[_0xfd38('0x2f')]['id']){delete _0x1fdeb7[_0xfd38('0x2f')]['id'];}return db['Tag'][_0xfd38('0x4d')]({'where':{'id':_0x1fdeb7[_0xfd38('0x4b')]['id']}})[_0xfd38('0x26')](handleEntityNotFound(_0x5c236c,null))[_0xfd38('0x26')](saveUpdates(_0x1fdeb7[_0xfd38('0x2f')],null))['then'](respondWithResult(_0x5c236c,null))[_0xfd38('0x4e')](handleError(_0x5c236c,null));};exports[_0xfd38('0x27')]=function(_0x1f569c,_0x13a9d0){return db[_0xfd38('0x34')][_0xfd38('0x4d')]({'where':{'id':_0x1f569c[_0xfd38('0x4b')]['id']}})[_0xfd38('0x26')](handleEntityNotFound(_0x13a9d0,null))[_0xfd38('0x26')](removeEntity(_0x13a9d0,null))[_0xfd38('0x4e')](handleError(_0x13a9d0,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 286d700..413810c 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 _0x9672=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util'];(function(_0x4956b6,_0x37a247){var _0x291eab=function(_0x565c30){while(--_0x565c30){_0x4956b6['push'](_0x4956b6['shift']());}};_0x291eab(++_0x37a247);}(_0x9672,0xee));var _0x2967=function(_0x496636,_0x1ba8ab){_0x496636=_0x496636-0x0;var _0x54c4ba=_0x9672[_0x496636];return _0x54c4ba;};'use strict';var _=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var logger=require('../../config/logger')(_0x2967('0x2'));var moment=require(_0x2967('0x3'));var BPromise=require(_0x2967('0x4'));var rp=require(_0x2967('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2967('0x6'));var config=require(_0x2967('0x7'));var attributes=require(_0x2967('0x8'));module['exports']=function(_0x4baad7,_0x24424d){return _0x4baad7[_0x2967('0x9')](_0x2967('0xa'),attributes,{'tableName':_0x2967('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cac=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','tools_tags'];(function(_0x40f46f,_0x16bba2){var _0x9d21a=function(_0x2ad948){while(--_0x2ad948){_0x40f46f['push'](_0x40f46f['shift']());}};_0x9d21a(++_0x16bba2);}(_0x6cac,0xe7));var _0xc6ca=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6cac[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc6ca('0x0'));var util=require('util');var logger=require(_0xc6ca('0x1'))(_0xc6ca('0x2'));var moment=require(_0xc6ca('0x3'));var BPromise=require(_0xc6ca('0x4'));var rp=require(_0xc6ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6ca('0x6'));var config=require(_0xc6ca('0x7'));var attributes=require(_0xc6ca('0x8'));module[_0xc6ca('0x9')]=function(_0x3081be,_0x41f84e){return _0x3081be['define']('Tag',attributes,{'tableName':_0xc6ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index ba3d823..cb43320 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 _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x3c89e9,_0x42b4cd){var _0x371c9f=function(_0x16f8a7){while(--_0x16f8a7){_0x3c89e9['push'](_0x3c89e9['shift']());}};_0x371c9f(++_0x42b4cd);}(_0xb821,0xa7));var _0x1b82=function(_0x9c3267,_0x3c9313){_0x9c3267=_0x9c3267-0x0;var _0x41e39f=_0xb821[_0x9c3267];return _0x41e39f;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('Tag,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +var _0xf290=['message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf290,0xde));var _0x0f29=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0xf290[_0x533110];return _0xc3c866;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('Tag,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f656a8e..8c13caf 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 _0xc395=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','update','delete','exports','multer'];(function(_0x542e9a,_0x1bddd0){var _0xe4572d=function(_0x5494d9){while(--_0x5494d9){_0x542e9a['push'](_0x542e9a['shift']());}};_0xe4572d(++_0x1bddd0);}(_0xc395,0x89));var _0x5c39=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xc395[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x5c39('0x0'));var util=require('util');var path=require(_0x5c39('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c39('0x2'));var router=express['Router']();var fs_extra=require(_0x5c39('0x3'));var auth=require(_0x5c39('0x4'));var interaction=require(_0x5c39('0x5'));var config=require(_0x5c39('0x6'));var controller=require('./team.controller');router[_0x5c39('0x7')]('/',auth[_0x5c39('0x8')](),controller[_0x5c39('0x9')]);router[_0x5c39('0x7')](_0x5c39('0xa'),auth[_0x5c39('0x8')](),controller[_0x5c39('0xb')]);router[_0x5c39('0x7')](_0x5c39('0xc'),auth[_0x5c39('0x8')](),controller[_0x5c39('0xd')]);router['get'](_0x5c39('0xe'),auth[_0x5c39('0x8')](),controller[_0x5c39('0xf')]);router[_0x5c39('0x10')]('/',auth[_0x5c39('0x8')](),controller[_0x5c39('0x11')]);router[_0x5c39('0x10')](_0x5c39('0xc'),auth[_0x5c39('0x8')](),controller[_0x5c39('0x12')]);router[_0x5c39('0x10')](_0x5c39('0xe'),auth['isAuthenticated'](),controller[_0x5c39('0x13')]);router['put'](_0x5c39('0xa'),auth[_0x5c39('0x8')](),controller[_0x5c39('0x14')]);router[_0x5c39('0x15')](_0x5c39('0xa'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x5c39('0xc'),auth[_0x5c39('0x8')](),controller['removeQueues']);router[_0x5c39('0x15')](_0x5c39('0xe'),auth[_0x5c39('0x8')](),controller['removeAgents']);module[_0x5c39('0x16')]=router; \ No newline at end of file +var _0x94a8=['addQueues','addAgents','put','update','delete','destroy','removeQueues','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','/:id/users','post'];(function(_0x1bb11e,_0x58fd78){var _0x422492=function(_0x5d8dfd){while(--_0x5d8dfd){_0x1bb11e['push'](_0x1bb11e['shift']());}};_0x422492(++_0x58fd78);}(_0x94a8,0xb1));var _0x894a=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x94a8[_0x45e98e];return _0x374dba;};'use strict';var multer=require('multer');var util=require(_0x894a('0x0'));var path=require('path');var timeout=require(_0x894a('0x1'));var express=require('express');var router=express[_0x894a('0x2')]();var fs_extra=require(_0x894a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x894a('0x4'));var controller=require(_0x894a('0x5'));router[_0x894a('0x6')]('/',auth[_0x894a('0x7')](),controller[_0x894a('0x8')]);router[_0x894a('0x6')](_0x894a('0x9'),auth['isAuthenticated'](),controller[_0x894a('0xa')]);router[_0x894a('0x6')](_0x894a('0xb'),auth[_0x894a('0x7')](),controller[_0x894a('0xc')]);router[_0x894a('0x6')](_0x894a('0xd'),auth[_0x894a('0x7')](),controller['getAgents']);router[_0x894a('0xe')]('/',auth[_0x894a('0x7')](),controller['create']);router[_0x894a('0xe')](_0x894a('0xb'),auth[_0x894a('0x7')](),controller[_0x894a('0xf')]);router[_0x894a('0xe')](_0x894a('0xd'),auth[_0x894a('0x7')](),controller[_0x894a('0x10')]);router[_0x894a('0x11')]('/:id',auth[_0x894a('0x7')](),controller[_0x894a('0x12')]);router[_0x894a('0x13')](_0x894a('0x9'),auth[_0x894a('0x7')](),controller[_0x894a('0x14')]);router[_0x894a('0x13')]('/:id/queues',auth[_0x894a('0x7')](),controller[_0x894a('0x15')]);router[_0x894a('0x13')](_0x894a('0xd'),auth[_0x894a('0x7')](),controller[_0x894a('0x16')]);module[_0x894a('0x17')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 9183f75..a48ee68 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 _0xf1da=['sequelize','exports','STRING','name'];(function(_0x14e001,_0x569bf){var _0x2c09da=function(_0x2efab1){while(--_0x2efab1){_0x14e001['push'](_0x14e001['shift']());}};_0x2c09da(++_0x569bf);}(_0xf1da,0x14c));var _0xaf1d=function(_0x47ffea,_0x4fa9ce){_0x47ffea=_0x47ffea-0x0;var _0x4e3968=_0xf1da[_0x47ffea];return _0x4e3968;};'use strict';var Sequelize=require(_0xaf1d('0x0'));module[_0xaf1d('0x1')]={'name':{'type':Sequelize[_0xaf1d('0x2')],'allowNull':![],'unique':_0xaf1d('0x3')},'description':{'type':Sequelize[_0xaf1d('0x2')]}}; \ No newline at end of file +var _0x0b5f=['STRING'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0x0b5f,0xf8));var _0xf0b5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0b5f[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf0b5('0x0')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xf0b5('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2711cff..9cae6e4 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 _0x527c=['where','pick','filters','filter','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','create','user','role','get','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','remove','Voice','Sms','Fax','Openchannel','Whatsapp','sequelize','penalty','QueueId','defaults','TeamVoiceQueue','User','Queue','findOrCreate','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','interface','format','SIP/%s','all','addAgents','removeAgents','Chat','Mail','parse','emit','Queue:remove','getAgents','hasOwnProperty','nolimit','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./team.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','Teams','destroy','then','error','name','send','render','merge','body','message','interaction','account','map','Team','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','order','sort'];(function(_0x5a184e,_0x3f30d6){var _0x3914a3=function(_0xa8ce99){while(--_0xa8ce99){_0x5a184e['push'](_0x5a184e['shift']());}};_0x3914a3(++_0x3f30d6);}(_0x527c,0xd0));var _0xc527=function(_0x2e7522,_0x5b1548){_0x2e7522=_0x2e7522-0x0;var _0x200019=_0x527c[_0x2e7522];return _0x200019;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc527('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc527('0x1'));var rp=require(_0xc527('0x2'));var moment=require(_0xc527('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc527('0x4'));var util=require('util');var path=require(_0xc527('0x5'));var sox=require('sox');var csv=require(_0xc527('0x6'));var ejs=require(_0xc527('0x7'));var fs=require('fs');var fs_extra=require(_0xc527('0x8'));var _=require(_0xc527('0x9'));var squel=require('squel');var crypto=require(_0xc527('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc527('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc527('0xc'));var Papa=require(_0xc527('0xd'));var Redis=require('ioredis');var authService=require(_0xc527('0xe'));var qs=require(_0xc527('0xf'));var as=require(_0xc527('0x10'));var hardwareService=require(_0xc527('0x11'));var logger=require(_0xc527('0x12'))(_0xc527('0x13'));var utils=require(_0xc527('0x14'));var config=require(_0xc527('0x15'));var licenseUtil=require(_0xc527('0x16'));var db=require(_0xc527('0x17'))['db'];config[_0xc527('0x18')]=_['defaults'](config[_0xc527('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc527('0x19'))(new Redis(config[_0xc527('0x18')]));require(_0xc527('0x1a'))[_0xc527('0x1b')](socket);function respondWithStatusCode(_0x596187,_0x490a2d){_0x490a2d=_0x490a2d||0xcc;return function(_0x38739b){if(_0x38739b){return _0x596187[_0xc527('0x1c')](_0x490a2d);}return _0x596187['status'](_0x490a2d)[_0xc527('0x1d')]();};}function respondWithResult(_0x3a5e1a,_0x54c2b7){_0x54c2b7=_0x54c2b7||0xc8;return function(_0x3a7712){if(_0x3a7712){return _0x3a5e1a['status'](_0x54c2b7)[_0xc527('0x1e')](_0x3a7712);}};}function respondWithFilteredResult(_0x5af3a0,_0x8b82ae){return function(_0x5f0f77){if(_0x5f0f77){var _0x5bf052=typeof _0x8b82ae[_0xc527('0x1f')]===_0xc527('0x20')&&typeof _0x8b82ae[_0xc527('0x21')]==='undefined';var _0xf2d8ff=_0x5f0f77[_0xc527('0x22')];var _0x4646f0=_0x5bf052?0x0:_0x8b82ae[_0xc527('0x1f')];var _0x58047c=_0x5bf052?_0x5f0f77['count']:_0x8b82ae[_0xc527('0x1f')]+_0x8b82ae['limit'];var _0x5d06cf;if(_0x58047c>=_0xf2d8ff){_0x58047c=_0xf2d8ff;_0x5d06cf=0xc8;}else{_0x5d06cf=0xce;}_0x5af3a0[_0xc527('0x23')](_0x5d06cf);return _0x5af3a0[_0xc527('0x24')]('Content-Range',_0x4646f0+'-'+_0x58047c+'/'+_0xf2d8ff)[_0xc527('0x1e')](_0x5f0f77);}return null;};}function patchUpdates(_0x862f64){return function(_0x5446d4){try{jsonpatch[_0xc527('0x25')](_0x5446d4,_0x862f64,!![]);}catch(_0x5f118a){return BPromise[_0xc527('0x26')](_0x5f118a);}return _0x5446d4[_0xc527('0x27')]();};}function saveUpdates(_0x3bc2e9,_0x2c8f9d){return function(_0x3e2cae){if(_0x3e2cae){return _0x3e2cae[_0xc527('0x28')](_0x3bc2e9)['then'](function(_0x7ff9bc){return _0x7ff9bc;});}return null;};}function removeEntity(_0x174fa7,_0x21ecff){return function(_0x212533){if(_0x212533){return _0x212533['destroy']()['then'](function(){var _0x5c5538=_0x212533['get']({'plain':!![]});var _0x541e78=_0xc527('0x29');return db['UserProfileResource'][_0xc527('0x2a')]({'where':{'type':_0x541e78,'resourceId':_0x5c5538['id']}})['then'](function(){return _0x212533;});})[_0xc527('0x2b')](function(){_0x174fa7[_0xc527('0x23')](0xcc)[_0xc527('0x1d')]();});}};}function handleEntityNotFound(_0x5e0d5a,_0x507c79){return function(_0x194d59){if(!_0x194d59){_0x5e0d5a[_0xc527('0x1c')](0x194);}return _0x194d59;};}function handleError(_0x396217,_0x213b1d){_0x213b1d=_0x213b1d||0x1f4;return function(_0x47f9bd){logger[_0xc527('0x2c')](_0x47f9bd['stack']);if(_0x47f9bd[_0xc527('0x2d')]){delete _0x47f9bd[_0xc527('0x2d')];}_0x396217[_0xc527('0x23')](_0x213b1d)[_0xc527('0x2e')](_0x47f9bd);};}function getMustacheRender(_0x22c092,_0x5c2358){return Mustache[_0xc527('0x2f')](_0x22c092,_[_0xc527('0x30')](_0x5c2358[_0xc527('0x31')],{'contact':_0x5c2358['contact'],'message':_0x5c2358[_0xc527('0x32')],'agent':_0x5c2358['agent'],'interaction':_0x5c2358[_0xc527('0x33')],'account':_0x5c2358[_0xc527('0x34')]}))||'';}exports['index']=function(_0x557b50,_0x18a13a){var _0x6a510c={},_0x8b3289={},_0x4b93fc={'count':0x0,'rows':[]};var _0x5790a0=_[_0xc527('0x35')](db[_0xc527('0x36')][_0xc527('0x37')],function(_0x2a6531){return{'name':_0x2a6531[_0xc527('0x38')],'type':_0x2a6531['type'][_0xc527('0x39')]};});_0x8b3289[_0xc527('0x3a')]=_[_0xc527('0x35')](_0x5790a0,'name');_0x8b3289['query']=_[_0xc527('0x3b')](_0x557b50[_0xc527('0x3c')]);_0x8b3289['filters']=_['intersection'](_0x8b3289['model'],_0x8b3289[_0xc527('0x3c')]);_0x6a510c[_0xc527('0x3d')]=_[_0xc527('0x3e')](_0x8b3289[_0xc527('0x3a')],qs[_0xc527('0x3f')](_0x557b50[_0xc527('0x3c')]['fields']));_0x6a510c[_0xc527('0x3d')]=_0x6a510c[_0xc527('0x3d')]['length']?_0x6a510c[_0xc527('0x3d')]:_0x8b3289[_0xc527('0x3a')];if(!_0x557b50['query']['hasOwnProperty']('nolimit')){_0x6a510c[_0xc527('0x21')]=qs[_0xc527('0x21')](_0x557b50[_0xc527('0x3c')]['limit']);_0x6a510c[_0xc527('0x1f')]=qs['offset'](_0x557b50['query']['offset']);}_0x6a510c[_0xc527('0x40')]=qs[_0xc527('0x41')](_0x557b50[_0xc527('0x3c')]['sort']);_0x6a510c[_0xc527('0x42')]=qs['filters'](_[_0xc527('0x43')](_0x557b50['query'],_0x8b3289[_0xc527('0x44')]),_0x5790a0);if(_0x557b50[_0xc527('0x3c')][_0xc527('0x45')]){_0x6a510c['where']=_[_0xc527('0x30')](_0x6a510c[_0xc527('0x42')],{'$or':_[_0xc527('0x35')](_0x5790a0,function(_0xf20484){if(_0xf20484[_0xc527('0x46')]!==_0xc527('0x47')){var _0x28704e={};_0x28704e[_0xf20484['name']]={'$like':'%'+_0x557b50[_0xc527('0x3c')]['filter']+'%'};return _0x28704e;}})});}_0x6a510c=_[_0xc527('0x30')]({},_0x6a510c,_0x557b50[_0xc527('0x48')]);var _0x18003f={'where':_0x6a510c[_0xc527('0x42')]};return db[_0xc527('0x36')]['count'](_0x18003f)[_0xc527('0x2b')](function(_0xdc448){_0x4b93fc[_0xc527('0x22')]=_0xdc448;if(_0x557b50['query'][_0xc527('0x49')]){_0x6a510c['include']=[{'all':!![]}];}return db['Team'][_0xc527('0x4a')](_0x6a510c);})[_0xc527('0x2b')](function(_0x4207ea){_0x4b93fc[_0xc527('0x4b')]=_0x4207ea;return _0x4b93fc;})[_0xc527('0x2b')](respondWithFilteredResult(_0x18a13a,_0x6a510c))[_0xc527('0x4c')](handleError(_0x18a13a,null));};exports[_0xc527('0x4d')]=function(_0x3fd5a6,_0x5ba2bb){var _0xa8da8d={'raw':![],'where':{'id':_0x3fd5a6[_0xc527('0x4e')]['id']}},_0x281b41={};_0x281b41['model']=_[_0xc527('0x3b')](db[_0xc527('0x36')][_0xc527('0x37')]);_0x281b41['query']=_[_0xc527('0x3b')](_0x3fd5a6[_0xc527('0x3c')]);_0x281b41[_0xc527('0x44')]=_[_0xc527('0x3e')](_0x281b41[_0xc527('0x3a')],_0x281b41[_0xc527('0x3c')]);_0xa8da8d[_0xc527('0x3d')]=_[_0xc527('0x3e')](_0x281b41['model'],qs[_0xc527('0x3f')](_0x3fd5a6['query']['fields']));_0xa8da8d[_0xc527('0x3d')]=_0xa8da8d[_0xc527('0x3d')][_0xc527('0x4f')]?_0xa8da8d[_0xc527('0x3d')]:_0x281b41['model'];if(_0x3fd5a6[_0xc527('0x3c')][_0xc527('0x49')]){_0xa8da8d[_0xc527('0x50')]=[{'all':!![]}];}_0xa8da8d=_[_0xc527('0x30')]({},_0xa8da8d,_0x3fd5a6[_0xc527('0x48')]);return db[_0xc527('0x36')]['find'](_0xa8da8d)[_0xc527('0x2b')](handleEntityNotFound(_0x5ba2bb,null))[_0xc527('0x2b')](respondWithResult(_0x5ba2bb,null))['catch'](handleError(_0x5ba2bb,null));};exports[_0xc527('0x51')]=function(_0x486435,_0x4e800a){return db[_0xc527('0x36')][_0xc527('0x51')](_0x486435['body'],{})[_0xc527('0x2b')](function(_0x1e9d23){var _0x7811c8=_0x486435[_0xc527('0x52')]['get']({'plain':!![]});if(!_0x7811c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7811c8[_0xc527('0x53')]==='user'){var _0x549130=_0x1e9d23[_0xc527('0x54')]({'plain':!![]});var _0x36b320=_0xc527('0x29');return db[_0xc527('0x55')][_0xc527('0x56')]({'where':{'name':_0x36b320,'userProfileId':_0x7811c8[_0xc527('0x57')]},'raw':!![]})[_0xc527('0x2b')](function(_0x2a7ae5){if(_0x2a7ae5&&_0x2a7ae5['autoAssociation']===0x0){return db[_0xc527('0x58')][_0xc527('0x51')]({'name':_0x549130[_0xc527('0x2d')],'resourceId':_0x549130['id'],'type':_0x2a7ae5[_0xc527('0x2d')],'sectionId':_0x2a7ae5['id']},{})[_0xc527('0x2b')](function(){return _0x1e9d23;});}else{return _0x1e9d23;}})[_0xc527('0x4c')](function(_0x17671f){logger['error'](_0xc527('0x59'),_0x17671f);throw _0x17671f;});}return _0x1e9d23;})[_0xc527('0x2b')](respondWithResult(_0x4e800a,0xc9))['catch'](handleError(_0x4e800a,null));};exports['update']=function(_0x433645,_0x3ad5e2){if(_0x433645['body']['id']){delete _0x433645[_0xc527('0x31')]['id'];}return db['Team'][_0xc527('0x56')]({'where':{'id':_0x433645[_0xc527('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3ad5e2,null))[_0xc527('0x2b')](saveUpdates(_0x433645[_0xc527('0x31')],null))[_0xc527('0x2b')](respondWithResult(_0x3ad5e2,null))[_0xc527('0x4c')](handleError(_0x3ad5e2,null));};exports[_0xc527('0x2a')]=function(_0x8ac1c6,_0x54d9ef){return db[_0xc527('0x36')][_0xc527('0x56')]({'where':{'id':_0x8ac1c6[_0xc527('0x4e')]['id']}})[_0xc527('0x2b')](handleEntityNotFound(_0x54d9ef,null))['then'](removeEntity(_0x54d9ef,null))[_0xc527('0x4c')](handleError(_0x54d9ef,null));};exports[_0xc527('0x5a')]=function(_0x3f7bcb,_0x397c9e,_0x5f4f27){return db['Team'][_0xc527('0x5b')]({'where':{'id':_0x3f7bcb[_0xc527('0x4e')]['id']}})[_0xc527('0x2b')](handleEntityNotFound(_0x397c9e,null))[_0xc527('0x2b')](function(_0x4f9f5a){if(!_0x3f7bcb[_0xc527('0x3c')][_0xc527('0x5c')]||!utils[_0xc527('0x5d')](_0x3f7bcb[_0xc527('0x3c')][_0xc527('0x5c')])){throw new db[(_0xc527('0x5e'))][(_0xc527('0x5f'))]('Unknown\x20channel');}var _0x173478={};var _0x23be75={};_0x23be75[_0xc527('0x3a')]=_[_0xc527('0x3b')](db[_[_0xc527('0x60')](_0x3f7bcb[_0xc527('0x3c')][_0xc527('0x5c')][_0xc527('0x61')]())+'Queue']['rawAttributes']);_0x23be75[_0xc527('0x3c')]=_['keys'](_0x3f7bcb[_0xc527('0x3c')]);_0x23be75['filters']=_[_0xc527('0x3e')](_0x23be75[_0xc527('0x3a')],_0x23be75['query']);_0x173478[_0xc527('0x3d')]=_[_0xc527('0x3e')](_0x23be75[_0xc527('0x3a')],qs['fields'](_0x3f7bcb[_0xc527('0x3c')]['fields']));_0x173478[_0xc527('0x3d')]=_0x173478[_0xc527('0x3d')][_0xc527('0x4f')]?_0x173478[_0xc527('0x3d')]:_0x23be75[_0xc527('0x3a')];_0x173478[_0xc527('0x21')]=qs[_0xc527('0x21')](_0x3f7bcb[_0xc527('0x3c')][_0xc527('0x21')]);_0x173478[_0xc527('0x1f')]=qs[_0xc527('0x1f')](_0x3f7bcb[_0xc527('0x3c')]['offset']);_0x173478['order']=qs[_0xc527('0x41')](_0x3f7bcb[_0xc527('0x3c')]['sort']);_0x173478['where']=qs[_0xc527('0x44')](_['pick'](_0x3f7bcb[_0xc527('0x3c')],_0x23be75[_0xc527('0x44')]));_0x173478=_['merge']({},_0x173478,_0x3f7bcb[_0xc527('0x48')]);return _0x4f9f5a[_0xc527('0x54')+_[_0xc527('0x60')](_0x3f7bcb[_0xc527('0x3c')][_0xc527('0x5c')][_0xc527('0x61')]())+_0xc527('0x62')](_0x173478);})[_0xc527('0x2b')](respondWithResult(_0x397c9e,null))['catch'](handleError(_0x397c9e,null));};exports[_0xc527('0x63')]=function(_0x514e89,_0x2b9049,_0xb66088){return db[_0xc527('0x36')][_0xc527('0x5b')]({'where':{'id':_0x514e89[_0xc527('0x4e')]['id']}})[_0xc527('0x2b')](function(_0x2e0610){if(_0x2e0610){if(!_0x514e89['body']['channel']||!utils[_0xc527('0x5d')](_0x514e89['body'][_0xc527('0x5c')])){throw new db[(_0xc527('0x5e'))]['ValidationError'](_0xc527('0x64'));}return _0x2e0610[_0xc527('0x65')+_['capitalize'](_0x514e89[_0xc527('0x31')][_0xc527('0x5c')][_0xc527('0x61')]())+'Queues'](_0x514e89[_0xc527('0x31')][_0xc527('0x66')]);}return null;})[_0xc527('0x2b')](handleEntityNotFound(_0x2b9049,null))[_0xc527('0x2b')](respondWithStatusCode(_0x2b9049,null))['catch'](handleError(_0x2b9049,null));};exports[_0xc527('0x67')]=function(_0x191530,_0x10f8aa,_0xe6fc7f){return db[_0xc527('0x36')][_0xc527('0x5b')]({'where':{'id':_0x191530[_0xc527('0x4e')]['id']}})[_0xc527('0x2b')](function(_0x3b48b2){if(_0x3b48b2){if(!_0x191530['query'][_0xc527('0x5c')]||!utils[_0xc527('0x5d')](_0x191530[_0xc527('0x3c')]['channel'])){throw new db[(_0xc527('0x5e'))][(_0xc527('0x5f'))](_0xc527('0x64'));}return _0x3b48b2[_0xc527('0x68')+_[_0xc527('0x60')](_0x191530[_0xc527('0x3c')][_0xc527('0x5c')]['toLowerCase']())+_0xc527('0x62')](_0x191530['query'][_0xc527('0x66')]);}return null;})[_0xc527('0x2b')](handleEntityNotFound(_0x10f8aa,null))[_0xc527('0x2b')](respondWithStatusCode(_0x10f8aa,null))[_0xc527('0x4c')](handleError(_0x10f8aa,null));};exports['addAgents']=function(_0x353d21,_0x492e25){return db[_0xc527('0x36')][_0xc527('0x56')]({'where':{'id':_0x353d21[_0xc527('0x4e')]['id']}})['then'](handleEntityNotFound(_0x492e25,null))[_0xc527('0x2b')](function(_0x4de2d0){if(_0x4de2d0){var _0x3b563e=[_0xc527('0x69'),'Chat','Mail',_0xc527('0x6a'),_0xc527('0x6b'),_0xc527('0x6c'),_0xc527('0x6d')];return db[_0xc527('0x6e')]['transaction'](function(_0x37d655){var _0x3fefc0=_[_0xc527('0x35')](_0x3b563e,function(_0x5b1886){var _0x47d4d9={'attributes':['id','name']};if(_0x5b1886===_0xc527('0x69')){_0x47d4d9['through']={'attributes':[_0xc527('0x6f')]};}return _0x4de2d0[_0xc527('0x54')+_0x5b1886+_0xc527('0x62')](_0x47d4d9)[_0xc527('0x2b')](function(_0x59c171){var _0x206e07=_['map'](_0x59c171,function(_0x423418){var _0x4f1122=_[_0xc527('0x35')](_0x353d21[_0xc527('0x31')][_0xc527('0x66')],function(_0xa5093e){var _0x1d8e1b={'where':{'UserId':_0xa5093e,[_0x5b1886+_0xc527('0x70')]:_0x423418['id']},'transaction':_0x37d655};if(_0x5b1886===_0xc527('0x69')){_0x1d8e1b[_0xc527('0x71')]={'penalty':_0x423418[_0xc527('0x72')][_0xc527('0x6f')]};}return db[_0xc527('0x73')+_0x5b1886+_0xc527('0x74')][_0xc527('0x75')](_0x1d8e1b)['then'](function(){socket['emit'](_0xc527('0x52')+_0x5b1886+_0xc527('0x76'),{'UserId':_0xa5093e,[_0x5b1886+'QueueId']:_0x423418['id']});if(_0x5b1886!==_0xc527('0x69'))return;return db['User'][_0xc527('0x4a')]({'where':{'id':_0x353d21['body'][_0xc527('0x66')],'online':0x1},'attributes':['id',_0xc527('0x2d'),_0xc527('0x77'),_0xc527('0x78'),'interface'],'raw':!![]})[_0xc527('0x2b')](function(_0x59c440){var _0x5b8b63=_[_0xc527('0x35')](_0x59c440,function(_0x41ddd3){return db[_0xc527('0x79')][_0xc527('0x7a')]({'membername':_0x41ddd3[_0xc527('0x2d')],'UserId':_0x41ddd3['id'],'queue_name':_0x423418[_0xc527('0x2d')],'VoiceQueueId':_0x423418['id'],'interface':_['isNil'](_0x41ddd3[_0xc527('0x7b')])?util[_0xc527('0x7c')](_0xc527('0x7d'),_0x41ddd3[_0xc527('0x2d')]):_0x41ddd3['interface'],'paused':_0x41ddd3[_0xc527('0x78')]||![],'penalty':_0x423418['TeamVoiceQueue']['penalty']},{'transaction':_0x37d655});});return Promise[_0xc527('0x7e')](_0x5b8b63);});});});return Promise[_0xc527('0x7e')](_0x4f1122);});return Promise[_0xc527('0x7e')](_0x206e07);});});return Promise[_0xc527('0x7e')](_0x3fefc0)[_0xc527('0x2b')](function(){return _0x4de2d0[_0xc527('0x7f')](_0x353d21[_0xc527('0x31')][_0xc527('0x66')],{'transaction':_0x37d655})['spread'](function(_0x5c411a){return _0x5c411a;});});});}})[_0xc527('0x2b')](respondWithResult(_0x492e25,null))[_0xc527('0x4c')](handleError(_0x492e25,null));};exports[_0xc527('0x80')]=function(_0x2b7c5c,_0x2f7371){return db[_0xc527('0x36')][_0xc527('0x56')]({'where':{'id':_0x2b7c5c[_0xc527('0x4e')]['id']}})[_0xc527('0x2b')](handleEntityNotFound(_0x2f7371,null))[_0xc527('0x2b')](function(_0x338064){if(_0x338064){var _0x93e558=[_0xc527('0x69'),_0xc527('0x81'),_0xc527('0x82'),_0xc527('0x6a'),'Fax',_0xc527('0x6c'),_0xc527('0x6d')];return db[_0xc527('0x6e')]['transaction'](function(_0xafd17d){var _0x3c4fc4=_[_0xc527('0x35')](_0x93e558,function(_0x3b58cb){var _0xf39d2a={'attributes':['id','name']};return _0x338064[_0xc527('0x54')+_0x3b58cb+_0xc527('0x62')](_0xf39d2a)[_0xc527('0x2b')](function(_0xa750d3){var _0xe89003=_[_0xc527('0x35')](_0xa750d3,function(_0x408379){return _0x408379[_0xc527('0x80')](_0x2b7c5c[_0xc527('0x3c')]['ids'],{'transaction':_0xafd17d})[_0xc527('0x2b')](function(){var _0x57a932=JSON[_0xc527('0x83')]('['+_0x2b7c5c['query']['ids']+']');var _0x4485ba=_[_0xc527('0x35')](_0x57a932,function(_0x5166c9){socket[_0xc527('0x84')](_0xc527('0x52')+_0x3b58cb+_0xc527('0x85'),{'UserId':Number(_0x5166c9),[_0x3b58cb+_0xc527('0x70')]:_0x408379['id']});if(_0x3b58cb!==_0xc527('0x69'))return;return db['UserVoiceQueueRt'][_0xc527('0x2a')]({'where':{'VoiceQueueId':_0x408379['id'],'UserId':_0x5166c9},'transaction':_0xafd17d});});return Promise[_0xc527('0x7e')](_0x4485ba);});});return Promise[_0xc527('0x7e')](_0xe89003);});});return Promise[_0xc527('0x7e')](_0x3c4fc4)['then'](function(){return _0x338064['removeAgents'](_0x2b7c5c[_0xc527('0x3c')]['ids'],{'transaction':_0xafd17d});});});}})[_0xc527('0x2b')](respondWithStatusCode(_0x2f7371,null))[_0xc527('0x4c')](handleError(_0x2f7371,null));};exports[_0xc527('0x86')]=function(_0x3e159f,_0x5a6ebf,_0x3080ee){var _0x54b6aa={};var _0x5b5429={};var _0x2ca8ad;var _0x309ab2;return db['Team'][_0xc527('0x5b')]({'where':{'id':_0x3e159f['params']['id']}})['then'](handleEntityNotFound(_0x5a6ebf,null))['then'](function(_0x25f26d){if(_0x25f26d){_0x2ca8ad=_0x25f26d;_0x5b5429[_0xc527('0x3a')]=_['keys'](db[_0xc527('0x73')][_0xc527('0x37')]);_0x5b5429[_0xc527('0x3c')]=_[_0xc527('0x3b')](_0x3e159f[_0xc527('0x3c')]);_0x5b5429[_0xc527('0x44')]=_['intersection'](_0x5b5429[_0xc527('0x3a')],_0x5b5429['query']);_0x54b6aa['attributes']=_[_0xc527('0x3e')](_0x5b5429['model'],qs[_0xc527('0x3f')](_0x3e159f[_0xc527('0x3c')][_0xc527('0x3f')]));_0x54b6aa[_0xc527('0x3d')]=_0x54b6aa[_0xc527('0x3d')]['length']?_0x54b6aa[_0xc527('0x3d')]:_0x5b5429['model'];_0x54b6aa['order']=qs[_0xc527('0x41')](_0x3e159f[_0xc527('0x3c')][_0xc527('0x41')]);_0x54b6aa[_0xc527('0x42')]=qs[_0xc527('0x44')](_[_0xc527('0x43')](_0x3e159f['query'],_0x5b5429[_0xc527('0x44')]));if(_0x3e159f[_0xc527('0x3c')]['filter']){_0x54b6aa[_0xc527('0x42')]=_['merge'](_0x54b6aa[_0xc527('0x42')],{'$or':_['map'](_0x54b6aa[_0xc527('0x3d')],function(_0x48d8de){var _0x2a1b40={};_0x2a1b40[_0x48d8de]={'$like':'%'+_0x3e159f['query'][_0xc527('0x45')]+'%'};return _0x2a1b40;})});}_0x54b6aa=_[_0xc527('0x30')]({},_0x54b6aa,_0x3e159f['options']);return _0x2ca8ad[_0xc527('0x86')](_0x54b6aa);}})[_0xc527('0x2b')](function(_0x46a19a){if(_0x46a19a){_0x309ab2=_0x46a19a[_0xc527('0x4f')];if(!_0x3e159f[_0xc527('0x3c')][_0xc527('0x87')](_0xc527('0x88'))){_0x54b6aa[_0xc527('0x21')]=qs[_0xc527('0x21')](_0x3e159f[_0xc527('0x3c')][_0xc527('0x21')]);_0x54b6aa['offset']=qs[_0xc527('0x1f')](_0x3e159f[_0xc527('0x3c')][_0xc527('0x1f')]);}return _0x2ca8ad[_0xc527('0x86')](_0x54b6aa);}})[_0xc527('0x2b')](function(_0x39c1a2){if(_0x39c1a2){return _0x39c1a2?{'count':_0x309ab2,'rows':_0x39c1a2}:null;}})[_0xc527('0x2b')](respondWithResult(_0x5a6ebf,null))['catch'](handleError(_0x5a6ebf,null));}; \ No newline at end of file +var _0xc439=['Content-Range','apply','reject','save','then','destroy','get','Teams','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','channel','Sequelize','toLowerCase','Queue','capitalize','Queues','addQueues','findOne','isValidChannel','ValidationError','Unknown\x20channel','add','ids','remove','Chat','Mail','Sms','Fax','Openchannel','Voice','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','removeAgents','Whatsapp','sequelize','parse','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x139537,_0x899738){var _0x4257fd=function(_0x34fd63){while(--_0x34fd63){_0x139537['push'](_0x139537['shift']());}};_0x4257fd(++_0x899738);}(_0xc439,0x174));var _0x9c43=function(_0x6778cb,_0x3f7da0){_0x6778cb=_0x6778cb-0x0;var _0x565790=_0xc439[_0x6778cb];return _0x565790;};'use strict';var emlformat=require(_0x9c43('0x0'));var rimraf=require(_0x9c43('0x1'));var zipdir=require(_0x9c43('0x2'));var jsonpatch=require(_0x9c43('0x3'));var rp=require(_0x9c43('0x4'));var moment=require(_0x9c43('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c43('0x6'));var path=require(_0x9c43('0x7'));var sox=require(_0x9c43('0x8'));var csv=require(_0x9c43('0x9'));var ejs=require(_0x9c43('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c43('0xb'));var squel=require(_0x9c43('0xc'));var crypto=require(_0x9c43('0xd'));var jsforce=require(_0x9c43('0xe'));var deskjs=require(_0x9c43('0xf'));var toCsv=require(_0x9c43('0x9'));var querystring=require('querystring');var Papa=require(_0x9c43('0x10'));var Redis=require(_0x9c43('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9c43('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c43('0x13'));var logger=require(_0x9c43('0x14'))(_0x9c43('0x15'));var utils=require(_0x9c43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9c43('0x17'));var db=require(_0x9c43('0x18'))['db'];config['redis']=_['defaults'](config[_0x9c43('0x19')],{'host':_0x9c43('0x1a'),'port':0x18eb});var socket=require(_0x9c43('0x1b'))(new Redis(config[_0x9c43('0x19')]));require(_0x9c43('0x1c'))[_0x9c43('0x1d')](socket);function respondWithStatusCode(_0xdaaa87,_0x5ab32a){_0x5ab32a=_0x5ab32a||0xcc;return function(_0x4f6e7f){if(_0x4f6e7f){return _0xdaaa87[_0x9c43('0x1e')](_0x5ab32a);}return _0xdaaa87[_0x9c43('0x1f')](_0x5ab32a)[_0x9c43('0x20')]();};}function respondWithResult(_0x126d88,_0x4c3525){_0x4c3525=_0x4c3525||0xc8;return function(_0x28ea75){if(_0x28ea75){return _0x126d88[_0x9c43('0x1f')](_0x4c3525)[_0x9c43('0x21')](_0x28ea75);}};}function respondWithFilteredResult(_0x454218,_0x531965){return function(_0x2544d1){if(_0x2544d1){var _0x1337cb=typeof _0x531965['offset']===_0x9c43('0x22')&&typeof _0x531965[_0x9c43('0x23')]==='undefined';var _0xbbdac7=_0x2544d1[_0x9c43('0x24')];var _0x72ff1a=_0x1337cb?0x0:_0x531965[_0x9c43('0x25')];var _0x56ae66=_0x1337cb?_0x2544d1[_0x9c43('0x24')]:_0x531965[_0x9c43('0x25')]+_0x531965[_0x9c43('0x23')];var _0x17e755;if(_0x56ae66>=_0xbbdac7){_0x56ae66=_0xbbdac7;_0x17e755=0xc8;}else{_0x17e755=0xce;}_0x454218[_0x9c43('0x1f')](_0x17e755);return _0x454218[_0x9c43('0x26')](_0x9c43('0x27'),_0x72ff1a+'-'+_0x56ae66+'/'+_0xbbdac7)[_0x9c43('0x21')](_0x2544d1);}return null;};}function patchUpdates(_0x19f313){return function(_0x1c56e7){try{jsonpatch[_0x9c43('0x28')](_0x1c56e7,_0x19f313,!![]);}catch(_0x2c0427){return BPromise[_0x9c43('0x29')](_0x2c0427);}return _0x1c56e7[_0x9c43('0x2a')]();};}function saveUpdates(_0x52b6bd,_0x5049b3){return function(_0x2dd1bc){if(_0x2dd1bc){return _0x2dd1bc['update'](_0x52b6bd)[_0x9c43('0x2b')](function(_0x54795a){return _0x54795a;});}return null;};}function removeEntity(_0xc1cc87,_0x41a4c4){return function(_0x388666){if(_0x388666){return _0x388666[_0x9c43('0x2c')]()[_0x9c43('0x2b')](function(){var _0x5e556b=_0x388666[_0x9c43('0x2d')]({'plain':!![]});var _0x5500b8=_0x9c43('0x2e');return db['UserProfileResource'][_0x9c43('0x2c')]({'where':{'type':_0x5500b8,'resourceId':_0x5e556b['id']}})['then'](function(){return _0x388666;});})[_0x9c43('0x2b')](function(){_0xc1cc87[_0x9c43('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x568d70,_0x1d42e6){return function(_0x569b5b){if(!_0x569b5b){_0x568d70[_0x9c43('0x1e')](0x194);}return _0x569b5b;};}function handleError(_0x5266ab,_0x2e6bd6){_0x2e6bd6=_0x2e6bd6||0x1f4;return function(_0x3ed5ac){logger['error'](_0x3ed5ac[_0x9c43('0x2f')]);if(_0x3ed5ac[_0x9c43('0x30')]){delete _0x3ed5ac['name'];}_0x5266ab[_0x9c43('0x1f')](_0x2e6bd6)[_0x9c43('0x31')](_0x3ed5ac);};}function getMustacheRender(_0x44381c,_0x526cfa){return Mustache[_0x9c43('0x32')](_0x44381c,_[_0x9c43('0x33')](_0x526cfa[_0x9c43('0x34')],{'contact':_0x526cfa[_0x9c43('0x35')],'message':_0x526cfa[_0x9c43('0x36')],'agent':_0x526cfa[_0x9c43('0x37')],'interaction':_0x526cfa[_0x9c43('0x38')],'account':_0x526cfa[_0x9c43('0x39')]}))||'';}exports[_0x9c43('0x3a')]=function(_0x42be25,_0x166696){var _0x4f0109={},_0x40c519={},_0x3ba9d5={'count':0x0,'rows':[]};var _0x26d98f=_['map'](db[_0x9c43('0x3b')][_0x9c43('0x3c')],function(_0xcfd051){return{'name':_0xcfd051[_0x9c43('0x3d')],'type':_0xcfd051[_0x9c43('0x3e')][_0x9c43('0x3f')]};});_0x40c519[_0x9c43('0x40')]=_[_0x9c43('0x41')](_0x26d98f,'name');_0x40c519[_0x9c43('0x42')]=_[_0x9c43('0x43')](_0x42be25[_0x9c43('0x42')]);_0x40c519[_0x9c43('0x44')]=_['intersection'](_0x40c519[_0x9c43('0x40')],_0x40c519[_0x9c43('0x42')]);_0x4f0109[_0x9c43('0x45')]=_[_0x9c43('0x46')](_0x40c519[_0x9c43('0x40')],qs[_0x9c43('0x47')](_0x42be25[_0x9c43('0x42')]['fields']));_0x4f0109['attributes']=_0x4f0109[_0x9c43('0x45')][_0x9c43('0x48')]?_0x4f0109[_0x9c43('0x45')]:_0x40c519[_0x9c43('0x40')];if(!_0x42be25[_0x9c43('0x42')]['hasOwnProperty'](_0x9c43('0x49'))){_0x4f0109[_0x9c43('0x23')]=qs[_0x9c43('0x23')](_0x42be25[_0x9c43('0x42')]['limit']);_0x4f0109[_0x9c43('0x25')]=qs['offset'](_0x42be25[_0x9c43('0x42')][_0x9c43('0x25')]);}_0x4f0109[_0x9c43('0x4a')]=qs['sort'](_0x42be25[_0x9c43('0x42')][_0x9c43('0x4b')]);_0x4f0109[_0x9c43('0x4c')]=qs['filters'](_['pick'](_0x42be25[_0x9c43('0x42')],_0x40c519[_0x9c43('0x44')]),_0x26d98f);if(_0x42be25[_0x9c43('0x42')]['filter']){_0x4f0109[_0x9c43('0x4c')]=_[_0x9c43('0x33')](_0x4f0109[_0x9c43('0x4c')],{'$or':_[_0x9c43('0x41')](_0x26d98f,function(_0x5acd80){if(_0x5acd80[_0x9c43('0x3e')]!==_0x9c43('0x4d')){var _0x8378c0={};_0x8378c0[_0x5acd80['name']]={'$like':'%'+_0x42be25[_0x9c43('0x42')][_0x9c43('0x4e')]+'%'};return _0x8378c0;}})});}_0x4f0109=_[_0x9c43('0x33')]({},_0x4f0109,_0x42be25[_0x9c43('0x4f')]);var _0x579025={'where':_0x4f0109['where']};return db[_0x9c43('0x3b')][_0x9c43('0x24')](_0x579025)[_0x9c43('0x2b')](function(_0x53eaf7){_0x3ba9d5[_0x9c43('0x24')]=_0x53eaf7;if(_0x42be25[_0x9c43('0x42')][_0x9c43('0x50')]){_0x4f0109['include']=[{'all':!![]}];}return db[_0x9c43('0x3b')][_0x9c43('0x51')](_0x4f0109);})['then'](function(_0x30a52f){_0x3ba9d5[_0x9c43('0x52')]=_0x30a52f;return _0x3ba9d5;})[_0x9c43('0x2b')](respondWithFilteredResult(_0x166696,_0x4f0109))[_0x9c43('0x53')](handleError(_0x166696,null));};exports[_0x9c43('0x54')]=function(_0x2eac0a,_0x38a63b){var _0x1da1db={'raw':![],'where':{'id':_0x2eac0a[_0x9c43('0x55')]['id']}},_0x17ff5e={};_0x17ff5e[_0x9c43('0x40')]=_['keys'](db[_0x9c43('0x3b')][_0x9c43('0x3c')]);_0x17ff5e['query']=_['keys'](_0x2eac0a[_0x9c43('0x42')]);_0x17ff5e[_0x9c43('0x44')]=_['intersection'](_0x17ff5e[_0x9c43('0x40')],_0x17ff5e['query']);_0x1da1db['attributes']=_[_0x9c43('0x46')](_0x17ff5e[_0x9c43('0x40')],qs[_0x9c43('0x47')](_0x2eac0a[_0x9c43('0x42')][_0x9c43('0x47')]));_0x1da1db[_0x9c43('0x45')]=_0x1da1db['attributes'][_0x9c43('0x48')]?_0x1da1db[_0x9c43('0x45')]:_0x17ff5e['model'];if(_0x2eac0a[_0x9c43('0x42')][_0x9c43('0x50')]){_0x1da1db[_0x9c43('0x56')]=[{'all':!![]}];}_0x1da1db=_[_0x9c43('0x33')]({},_0x1da1db,_0x2eac0a['options']);return db[_0x9c43('0x3b')][_0x9c43('0x57')](_0x1da1db)['then'](handleEntityNotFound(_0x38a63b,null))['then'](respondWithResult(_0x38a63b,null))[_0x9c43('0x53')](handleError(_0x38a63b,null));};exports[_0x9c43('0x58')]=function(_0x34186a,_0x599f0d){return db['Team'][_0x9c43('0x58')](_0x34186a[_0x9c43('0x34')],{})[_0x9c43('0x2b')](function(_0x2d3029){var _0x842884=_0x34186a[_0x9c43('0x59')][_0x9c43('0x2d')]({'plain':!![]});if(!_0x842884)throw new Error(_0x9c43('0x5a'));if(_0x842884['role']===_0x9c43('0x59')){var _0x51b159=_0x2d3029['get']({'plain':!![]});var _0x5aefff='Teams';return db[_0x9c43('0x5b')][_0x9c43('0x57')]({'where':{'name':_0x5aefff,'userProfileId':_0x842884['userProfileId']},'raw':!![]})['then'](function(_0x4f8fb8){if(_0x4f8fb8&&_0x4f8fb8['autoAssociation']===0x0){return db[_0x9c43('0x5c')][_0x9c43('0x58')]({'name':_0x51b159[_0x9c43('0x30')],'resourceId':_0x51b159['id'],'type':_0x4f8fb8[_0x9c43('0x30')],'sectionId':_0x4f8fb8['id']},{})[_0x9c43('0x2b')](function(){return _0x2d3029;});}else{return _0x2d3029;}})[_0x9c43('0x53')](function(_0x465ff5){logger['error'](_0x9c43('0x5d'),_0x465ff5);throw _0x465ff5;});}return _0x2d3029;})[_0x9c43('0x2b')](respondWithResult(_0x599f0d,0xc9))['catch'](handleError(_0x599f0d,null));};exports[_0x9c43('0x5e')]=function(_0x3fc5e2,_0x19159f){if(_0x3fc5e2[_0x9c43('0x34')]['id']){delete _0x3fc5e2[_0x9c43('0x34')]['id'];}return db[_0x9c43('0x3b')][_0x9c43('0x57')]({'where':{'id':_0x3fc5e2[_0x9c43('0x55')]['id']}})['then'](handleEntityNotFound(_0x19159f,null))['then'](saveUpdates(_0x3fc5e2[_0x9c43('0x34')],null))[_0x9c43('0x2b')](respondWithResult(_0x19159f,null))[_0x9c43('0x53')](handleError(_0x19159f,null));};exports[_0x9c43('0x2c')]=function(_0x3b884d,_0x5b5ac8){return db[_0x9c43('0x3b')][_0x9c43('0x57')]({'where':{'id':_0x3b884d[_0x9c43('0x55')]['id']}})[_0x9c43('0x2b')](handleEntityNotFound(_0x5b5ac8,null))['then'](removeEntity(_0x5b5ac8,null))[_0x9c43('0x53')](handleError(_0x5b5ac8,null));};exports['getQueues']=function(_0x409b0e,_0x469d30,_0x5901ee){return db[_0x9c43('0x3b')]['findOne']({'where':{'id':_0x409b0e[_0x9c43('0x55')]['id']}})['then'](handleEntityNotFound(_0x469d30,null))[_0x9c43('0x2b')](function(_0x41f434){if(!_0x409b0e['query'][_0x9c43('0x5f')]||!utils['isValidChannel'](_0x409b0e[_0x9c43('0x42')]['channel'])){throw new db[(_0x9c43('0x60'))]['ValidationError']('Unknown\x20channel');}var _0x31f845={};var _0x35c2d8={};_0x35c2d8['model']=_[_0x9c43('0x43')](db[_['capitalize'](_0x409b0e[_0x9c43('0x42')][_0x9c43('0x5f')][_0x9c43('0x61')]())+_0x9c43('0x62')][_0x9c43('0x3c')]);_0x35c2d8[_0x9c43('0x42')]=_[_0x9c43('0x43')](_0x409b0e[_0x9c43('0x42')]);_0x35c2d8[_0x9c43('0x44')]=_[_0x9c43('0x46')](_0x35c2d8[_0x9c43('0x40')],_0x35c2d8[_0x9c43('0x42')]);_0x31f845[_0x9c43('0x45')]=_[_0x9c43('0x46')](_0x35c2d8[_0x9c43('0x40')],qs[_0x9c43('0x47')](_0x409b0e['query'][_0x9c43('0x47')]));_0x31f845[_0x9c43('0x45')]=_0x31f845[_0x9c43('0x45')][_0x9c43('0x48')]?_0x31f845['attributes']:_0x35c2d8[_0x9c43('0x40')];_0x31f845[_0x9c43('0x23')]=qs[_0x9c43('0x23')](_0x409b0e[_0x9c43('0x42')][_0x9c43('0x23')]);_0x31f845['offset']=qs['offset'](_0x409b0e[_0x9c43('0x42')][_0x9c43('0x25')]);_0x31f845['order']=qs['sort'](_0x409b0e['query'][_0x9c43('0x4b')]);_0x31f845[_0x9c43('0x4c')]=qs[_0x9c43('0x44')](_['pick'](_0x409b0e[_0x9c43('0x42')],_0x35c2d8[_0x9c43('0x44')]));_0x31f845=_[_0x9c43('0x33')]({},_0x31f845,_0x409b0e[_0x9c43('0x4f')]);return _0x41f434[_0x9c43('0x2d')+_[_0x9c43('0x63')](_0x409b0e['query']['channel'][_0x9c43('0x61')]())+_0x9c43('0x64')](_0x31f845);})[_0x9c43('0x2b')](respondWithResult(_0x469d30,null))[_0x9c43('0x53')](handleError(_0x469d30,null));};exports[_0x9c43('0x65')]=function(_0x5d2b91,_0x4762cc,_0x5217bc){return db[_0x9c43('0x3b')][_0x9c43('0x66')]({'where':{'id':_0x5d2b91[_0x9c43('0x55')]['id']}})['then'](function(_0xe60980){if(_0xe60980){if(!_0x5d2b91[_0x9c43('0x34')]['channel']||!utils[_0x9c43('0x67')](_0x5d2b91[_0x9c43('0x34')]['channel'])){throw new db[(_0x9c43('0x60'))][(_0x9c43('0x68'))](_0x9c43('0x69'));}return _0xe60980[_0x9c43('0x6a')+_[_0x9c43('0x63')](_0x5d2b91[_0x9c43('0x34')][_0x9c43('0x5f')][_0x9c43('0x61')]())+_0x9c43('0x64')](_0x5d2b91[_0x9c43('0x34')][_0x9c43('0x6b')]);}return null;})[_0x9c43('0x2b')](handleEntityNotFound(_0x4762cc,null))['then'](respondWithStatusCode(_0x4762cc,null))[_0x9c43('0x53')](handleError(_0x4762cc,null));};exports['removeQueues']=function(_0x107bd5,_0x4616d1,_0x224eca){return db['Team'][_0x9c43('0x66')]({'where':{'id':_0x107bd5[_0x9c43('0x55')]['id']}})[_0x9c43('0x2b')](function(_0x27ba0f){if(_0x27ba0f){if(!_0x107bd5[_0x9c43('0x42')][_0x9c43('0x5f')]||!utils[_0x9c43('0x67')](_0x107bd5[_0x9c43('0x42')][_0x9c43('0x5f')])){throw new db[(_0x9c43('0x60'))][(_0x9c43('0x68'))]('Unknown\x20channel');}return _0x27ba0f[_0x9c43('0x6c')+_['capitalize'](_0x107bd5[_0x9c43('0x42')][_0x9c43('0x5f')][_0x9c43('0x61')]())+_0x9c43('0x64')](_0x107bd5[_0x9c43('0x42')][_0x9c43('0x6b')]);}return null;})[_0x9c43('0x2b')](handleEntityNotFound(_0x4616d1,null))[_0x9c43('0x2b')](respondWithStatusCode(_0x4616d1,null))[_0x9c43('0x53')](handleError(_0x4616d1,null));};exports['addAgents']=function(_0x184455,_0x1cf1d9){return db['Team']['find']({'where':{'id':_0x184455[_0x9c43('0x55')]['id']}})[_0x9c43('0x2b')](handleEntityNotFound(_0x1cf1d9,null))['then'](function(_0x39889f){if(_0x39889f){var _0x1603bc=['Voice',_0x9c43('0x6d'),_0x9c43('0x6e'),_0x9c43('0x6f'),_0x9c43('0x70'),_0x9c43('0x71'),'Whatsapp'];return db['sequelize']['transaction'](function(_0x27b30f){var _0x408774=_['map'](_0x1603bc,function(_0x104272){var _0x59e86b={'attributes':['id','name']};if(_0x104272===_0x9c43('0x72')){_0x59e86b['through']={'attributes':[_0x9c43('0x73')]};}return _0x39889f[_0x9c43('0x2d')+_0x104272+'Queues'](_0x59e86b)[_0x9c43('0x2b')](function(_0x2b994a){var _0x120fcb=_[_0x9c43('0x41')](_0x2b994a,function(_0x5e0bfc){var _0x13263c=_[_0x9c43('0x41')](_0x184455[_0x9c43('0x34')][_0x9c43('0x6b')],function(_0x39fc9e){var _0x397cb4={'where':{'UserId':_0x39fc9e,[_0x104272+_0x9c43('0x74')]:_0x5e0bfc['id']},'transaction':_0x27b30f};if(_0x104272===_0x9c43('0x72')){_0x397cb4[_0x9c43('0x75')]={'penalty':_0x5e0bfc[_0x9c43('0x76')][_0x9c43('0x73')]};}return db[_0x9c43('0x77')+_0x104272+_0x9c43('0x62')][_0x9c43('0x78')](_0x397cb4)[_0x9c43('0x2b')](function(){socket[_0x9c43('0x79')](_0x9c43('0x59')+_0x104272+_0x9c43('0x7a'),{'UserId':_0x39fc9e,[_0x104272+_0x9c43('0x74')]:_0x5e0bfc['id']});if(_0x104272!==_0x9c43('0x72'))return;return db[_0x9c43('0x77')][_0x9c43('0x51')]({'where':{'id':_0x184455[_0x9c43('0x34')][_0x9c43('0x6b')],'online':0x1},'attributes':['id',_0x9c43('0x30'),_0x9c43('0x7b'),_0x9c43('0x7c'),_0x9c43('0x7d')],'raw':!![]})[_0x9c43('0x2b')](function(_0x1e5f4d){var _0x13517f=_[_0x9c43('0x41')](_0x1e5f4d,function(_0x1a31ff){return db[_0x9c43('0x7e')]['upsert']({'membername':_0x1a31ff['name'],'UserId':_0x1a31ff['id'],'queue_name':_0x5e0bfc['name'],'VoiceQueueId':_0x5e0bfc['id'],'interface':_[_0x9c43('0x7f')](_0x1a31ff[_0x9c43('0x7d')])?util[_0x9c43('0x80')](_0x9c43('0x81'),_0x1a31ff['name']):_0x1a31ff['interface'],'paused':_0x1a31ff[_0x9c43('0x7c')]||![],'penalty':_0x5e0bfc[_0x9c43('0x76')][_0x9c43('0x73')]},{'transaction':_0x27b30f});});return Promise[_0x9c43('0x82')](_0x13517f);});});});return Promise[_0x9c43('0x82')](_0x13263c);});return Promise[_0x9c43('0x82')](_0x120fcb);});});return Promise[_0x9c43('0x82')](_0x408774)[_0x9c43('0x2b')](function(){return _0x39889f['addAgents'](_0x184455['body'][_0x9c43('0x6b')],{'transaction':_0x27b30f})['spread'](function(_0x3aa817){return _0x3aa817;});});});}})[_0x9c43('0x2b')](respondWithResult(_0x1cf1d9,null))[_0x9c43('0x53')](handleError(_0x1cf1d9,null));};exports[_0x9c43('0x83')]=function(_0x438bbf,_0x3acdcc){return db[_0x9c43('0x3b')][_0x9c43('0x57')]({'where':{'id':_0x438bbf[_0x9c43('0x55')]['id']}})[_0x9c43('0x2b')](handleEntityNotFound(_0x3acdcc,null))[_0x9c43('0x2b')](function(_0x32cff1){if(_0x32cff1){var _0x792c0=[_0x9c43('0x72'),_0x9c43('0x6d'),_0x9c43('0x6e'),'Sms',_0x9c43('0x70'),_0x9c43('0x71'),_0x9c43('0x84')];return db[_0x9c43('0x85')]['transaction'](function(_0x1d6c85){var _0x232bbe=_[_0x9c43('0x41')](_0x792c0,function(_0x8a72bd){var _0x373f0b={'attributes':['id',_0x9c43('0x30')]};return _0x32cff1[_0x9c43('0x2d')+_0x8a72bd+'Queues'](_0x373f0b)[_0x9c43('0x2b')](function(_0x3b44db){var _0x273e0f=_[_0x9c43('0x41')](_0x3b44db,function(_0x4b8b94){return _0x4b8b94[_0x9c43('0x83')](_0x438bbf[_0x9c43('0x42')][_0x9c43('0x6b')],{'transaction':_0x1d6c85})[_0x9c43('0x2b')](function(){var _0x480af3=JSON[_0x9c43('0x86')]('['+_0x438bbf[_0x9c43('0x42')]['ids']+']');var _0x2069eb=_[_0x9c43('0x41')](_0x480af3,function(_0x23a3b3){socket['emit'](_0x9c43('0x59')+_0x8a72bd+_0x9c43('0x87'),{'UserId':Number(_0x23a3b3),[_0x8a72bd+_0x9c43('0x74')]:_0x4b8b94['id']});if(_0x8a72bd!=='Voice')return;return db[_0x9c43('0x7e')][_0x9c43('0x2c')]({'where':{'VoiceQueueId':_0x4b8b94['id'],'UserId':_0x23a3b3},'transaction':_0x1d6c85});});return Promise[_0x9c43('0x82')](_0x2069eb);});});return Promise[_0x9c43('0x82')](_0x273e0f);});});return Promise[_0x9c43('0x82')](_0x232bbe)['then'](function(){return _0x32cff1[_0x9c43('0x83')](_0x438bbf[_0x9c43('0x42')][_0x9c43('0x6b')],{'transaction':_0x1d6c85});});});}})['then'](respondWithStatusCode(_0x3acdcc,null))[_0x9c43('0x53')](handleError(_0x3acdcc,null));};exports[_0x9c43('0x88')]=function(_0x3e1cd5,_0x1db843,_0x292b80){var _0x1d2f68={};var _0x4516ba={};var _0x43ce5f;var _0x1d14ba;return db['Team'][_0x9c43('0x66')]({'where':{'id':_0x3e1cd5[_0x9c43('0x55')]['id']}})[_0x9c43('0x2b')](handleEntityNotFound(_0x1db843,null))[_0x9c43('0x2b')](function(_0xedbf6f){if(_0xedbf6f){_0x43ce5f=_0xedbf6f;_0x4516ba['model']=_['keys'](db['User'][_0x9c43('0x3c')]);_0x4516ba[_0x9c43('0x42')]=_[_0x9c43('0x43')](_0x3e1cd5['query']);_0x4516ba['filters']=_[_0x9c43('0x46')](_0x4516ba[_0x9c43('0x40')],_0x4516ba['query']);_0x1d2f68[_0x9c43('0x45')]=_[_0x9c43('0x46')](_0x4516ba[_0x9c43('0x40')],qs[_0x9c43('0x47')](_0x3e1cd5['query']['fields']));_0x1d2f68[_0x9c43('0x45')]=_0x1d2f68[_0x9c43('0x45')]['length']?_0x1d2f68[_0x9c43('0x45')]:_0x4516ba[_0x9c43('0x40')];_0x1d2f68[_0x9c43('0x4a')]=qs[_0x9c43('0x4b')](_0x3e1cd5[_0x9c43('0x42')][_0x9c43('0x4b')]);_0x1d2f68[_0x9c43('0x4c')]=qs['filters'](_['pick'](_0x3e1cd5[_0x9c43('0x42')],_0x4516ba['filters']));if(_0x3e1cd5[_0x9c43('0x42')][_0x9c43('0x4e')]){_0x1d2f68[_0x9c43('0x4c')]=_['merge'](_0x1d2f68['where'],{'$or':_['map'](_0x1d2f68[_0x9c43('0x45')],function(_0x522b24){var _0xf5d5c6={};_0xf5d5c6[_0x522b24]={'$like':'%'+_0x3e1cd5[_0x9c43('0x42')]['filter']+'%'};return _0xf5d5c6;})});}_0x1d2f68=_[_0x9c43('0x33')]({},_0x1d2f68,_0x3e1cd5['options']);return _0x43ce5f[_0x9c43('0x88')](_0x1d2f68);}})[_0x9c43('0x2b')](function(_0x4dbae9){if(_0x4dbae9){_0x1d14ba=_0x4dbae9[_0x9c43('0x48')];if(!_0x3e1cd5[_0x9c43('0x42')]['hasOwnProperty'](_0x9c43('0x49'))){_0x1d2f68[_0x9c43('0x23')]=qs['limit'](_0x3e1cd5['query']['limit']);_0x1d2f68[_0x9c43('0x25')]=qs[_0x9c43('0x25')](_0x3e1cd5[_0x9c43('0x42')][_0x9c43('0x25')]);}return _0x43ce5f['getAgents'](_0x1d2f68);}})[_0x9c43('0x2b')](function(_0x15d407){if(_0x15d407){return _0x15d407?{'count':_0x1d14ba,'rows':_0x15d407}:null;}})[_0x9c43('0x2b')](respondWithResult(_0x1db843,null))[_0x9c43('0x53')](handleError(_0x1db843,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8a58082..29aa8e9 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 _0xe79c=['Team','setMaxListeners','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xe79c,0x1ae));var _0xce79=function(_0x212759,_0x2daec2){_0x212759=_0x212759-0x0;var _0x59d9ca=_0xe79c[_0x212759];return _0x59d9ca;};'use strict';var EventEmitter=require(_0xce79('0x0'));var Team=require(_0xce79('0x1'))['db'][_0xce79('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xce79('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xce79('0x4')};function emitEvent(_0x3c9db3){return function(_0x1c16ff,_0x53b29a,_0x4d87bf){TeamEvents[_0xce79('0x5')](_0x3c9db3+':'+_0x1c16ff['id'],_0x1c16ff);TeamEvents['emit'](_0x3c9db3,_0x1c16ff);_0x4d87bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xce79('0x6')](e,emitEvent(event));}}module[_0xce79('0x7')]=TeamEvents; \ No newline at end of file +var _0x627e=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x627e,0x1a5));var _0xe627=function(_0x342239,_0x333a4b){_0x342239=_0x342239-0x0;var _0x44ca21=_0x627e[_0x342239];return _0x44ca21;};'use strict';var EventEmitter=require(_0xe627('0x0'));var Team=require(_0xe627('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xe627('0x2')](0x0);var events={'afterCreate':_0xe627('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x441be6){return function(_0x18dfc5,_0x572c78,_0x26bc1d){TeamEvents[_0xe627('0x4')](_0x441be6+':'+_0x18dfc5['id'],_0x18dfc5);TeamEvents[_0xe627('0x4')](_0x441be6,_0x18dfc5);_0x26bc1d(null);};}for(var e in events){if(events[_0xe627('0x5')](e)){var event=events[e];Team[_0xe627('0x6')](e,emitEvent(event));}}module[_0xe627('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4f0f27e..03c4bed 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 _0xa935=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','Team','teams','util','../../config/logger'];(function(_0x28b052,_0x1c1268){var _0x20cfcf=function(_0x5b47e6){while(--_0x5b47e6){_0x28b052['push'](_0x28b052['shift']());}};_0x20cfcf(++_0x1c1268);}(_0xa935,0xe2));var _0x5a93=function(_0x129102,_0x3ac9c9){_0x129102=_0x129102-0x0;var _0x346551=_0xa935[_0x129102];return _0x346551;};'use strict';var _=require('lodash');var util=require(_0x5a93('0x0'));var logger=require(_0x5a93('0x1'))(_0x5a93('0x2'));var moment=require(_0x5a93('0x3'));var BPromise=require(_0x5a93('0x4'));var rp=require(_0x5a93('0x5'));var fs=require('fs');var path=require(_0x5a93('0x6'));var rimraf=require(_0x5a93('0x7'));var config=require(_0x5a93('0x8'));var attributes=require(_0x5a93('0x9'));module['exports']=function(_0x20d71d,_0x3f51f0){return _0x20d71d['define'](_0x5a93('0xa'),attributes,{'tableName':_0x5a93('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c6a=['api','bluebird','path','rimraf','../../config/environment','./team.attributes','exports','Team','teams','lodash','util','../../config/logger'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x2c6a,0x8d));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa2c6('0x0'));var util=require(_0xa2c6('0x1'));var logger=require(_0xa2c6('0x2'))(_0xa2c6('0x3'));var moment=require('moment');var BPromise=require(_0xa2c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2c6('0x5'));var rimraf=require(_0xa2c6('0x6'));var config=require(_0xa2c6('0x7'));var attributes=require(_0xa2c6('0x8'));module[_0xa2c6('0x9')]=function(_0x3e1346,_0x4e3c6d){return _0x3e1346['define'](_0xa2c6('0xa'),attributes,{'tableName':_0xa2c6('0xb'),'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 3c0d177..898d6d3 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 _0xf682=['http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf682,0xf2));var _0x2f68=function(_0x6f0671,_0x44aafb){_0x6f0671=_0x6f0671-0x0;var _0x2d45da=_0xf682[_0x6f0671];return _0x2d45da;};'use strict';var _=require('lodash');var util=require(_0x2f68('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2f68('0x1'));var fs=require('fs');var Redis=require(_0x2f68('0x2'));var db=require(_0x2f68('0x3'))['db'];var utils=require(_0x2f68('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f68('0x5'));var jayson=require(_0x2f68('0x6'));var client=jayson[_0x2f68('0x7')][_0x2f68('0x8')]({'port':0x232a});config[_0x2f68('0x9')]=_[_0x2f68('0xa')](config['redis'],{'host':_0x2f68('0xb'),'port':0x18eb});var socket=require(_0x2f68('0xc'))(new Redis(config['redis']));require(_0x2f68('0xd'))[_0x2f68('0xe')](socket);function respondWithRpcPromise(_0x5c3066,_0x4462dd,_0x1252f6){return new BPromise(function(_0x587247,_0x3073e1){return client['request'](_0x5c3066,_0x1252f6)[_0x2f68('0xf')](function(_0x26501b){logger[_0x2f68('0x10')](_0x2f68('0x11'),_0x4462dd,'request\x20sent');logger[_0x2f68('0x12')](_0x2f68('0x13'),_0x4462dd,_0x2f68('0x14'),JSON['stringify'](_0x26501b));if(_0x26501b[_0x2f68('0x15')]){if(_0x26501b[_0x2f68('0x15')][_0x2f68('0x16')]===0x1f4){logger[_0x2f68('0x15')](_0x2f68('0x11'),_0x4462dd,_0x26501b[_0x2f68('0x15')][_0x2f68('0x17')]);return _0x3073e1(_0x26501b['error'][_0x2f68('0x17')]);}logger[_0x2f68('0x15')](_0x2f68('0x11'),_0x4462dd,_0x26501b[_0x2f68('0x15')][_0x2f68('0x17')]);return _0x587247(_0x26501b['error'][_0x2f68('0x17')]);}else{logger['info'](_0x2f68('0x11'),_0x4462dd,_0x2f68('0x14'));_0x587247(_0x26501b[_0x2f68('0x18')][_0x2f68('0x17')]);}})['catch'](function(_0x1e1333){logger['error'](_0x2f68('0x11'),_0x4462dd,_0x1e1333);_0x3073e1(_0x1e1333);});});} \ No newline at end of file +var _0xc37b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','localhost','socket.io-emitter','redis','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x415d08,_0xdf5627){var _0x1ed893=function(_0x58d4e9){while(--_0x58d4e9){_0x415d08['push'](_0x415d08['shift']());}};_0x1ed893(++_0xdf5627);}(_0xc37b,0x183));var _0xbc37=function(_0x49b43a,_0x28ebff){_0x49b43a=_0x49b43a-0x0;var _0x3b006b=_0xc37b[_0x49b43a];return _0x3b006b;};'use strict';var _=require('lodash');var util=require(_0xbc37('0x0'));var moment=require(_0xbc37('0x1'));var BPromise=require(_0xbc37('0x2'));var rs=require(_0xbc37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc37('0x4'))['db'];var utils=require(_0xbc37('0x5'));var logger=require(_0xbc37('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbc37('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xbc37('0x8'),'port':0x18eb});var socket=require(_0xbc37('0x9'))(new Redis(config[_0xbc37('0xa')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x34ebf1,_0x163d3f,_0x313f92){return new BPromise(function(_0x353f53,_0x3c595d){return client['request'](_0x34ebf1,_0x313f92)[_0xbc37('0xb')](function(_0x1a8474){logger[_0xbc37('0xc')](_0xbc37('0xd'),_0x163d3f,_0xbc37('0xe'));logger[_0xbc37('0xf')](_0xbc37('0x10'),_0x163d3f,_0xbc37('0xe'),JSON[_0xbc37('0x11')](_0x1a8474));if(_0x1a8474[_0xbc37('0x12')]){if(_0x1a8474[_0xbc37('0x12')][_0xbc37('0x13')]===0x1f4){logger[_0xbc37('0x12')](_0xbc37('0xd'),_0x163d3f,_0x1a8474[_0xbc37('0x12')]['message']);return _0x3c595d(_0x1a8474[_0xbc37('0x12')][_0xbc37('0x14')]);}logger[_0xbc37('0x12')](_0xbc37('0xd'),_0x163d3f,_0x1a8474['error'][_0xbc37('0x14')]);return _0x353f53(_0x1a8474[_0xbc37('0x12')][_0xbc37('0x14')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x163d3f,'request\x20sent');_0x353f53(_0x1a8474[_0xbc37('0x15')]['message']);}})[_0xbc37('0x16')](function(_0x591a97){logger[_0xbc37('0x12')](_0xbc37('0xd'),_0x163d3f,_0x591a97);_0x3c595d(_0x591a97);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index cc4cafb..50d3d5e 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 _0x5fab=['emit','removeListener','register','length','./team.events','save','update'];(function(_0x3f95c9,_0x2e9e91){var _0x4b5131=function(_0x49b5a9){while(--_0x49b5a9){_0x3f95c9['push'](_0x3f95c9['shift']());}};_0x4b5131(++_0x2e9e91);}(_0x5fab,0x177));var _0xb5fa=function(_0x57c4ec,_0xfb1ad0){_0x57c4ec=_0x57c4ec-0x0;var _0x157f3c=_0x5fab[_0x57c4ec];return _0x157f3c;};'use strict';var TeamEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){TeamEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('team:'+_0x1aec3e,_0x44df89);TeamEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x7e02=['team:','./team.events','save','remove','update','register','length'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0x7e02,0x71));var _0x27e0=function(_0x1e5b8b,_0x4937be){_0x1e5b8b=_0x1e5b8b-0x0;var _0x59393f=_0x7e02[_0x1e5b8b];return _0x59393f;};'use strict';var TeamEvents=require(_0x27e0('0x0'));var events=[_0x27e0('0x1'),_0x27e0('0x2'),_0x27e0('0x3')];function createListener(_0x6daf9e,_0x3bfa3b){return function(_0x310a36){_0x3bfa3b['emit'](_0x6daf9e,_0x310a36);};}function removeListener(_0x4fa613,_0x3d4f41){return function(){TeamEvents['removeListener'](_0x4fa613,_0x3d4f41);};}exports[_0x27e0('0x4')]=function(_0x1f98c5){for(var _0x3ddcd2=0x0,_0x1cc944=events[_0x27e0('0x5')];_0x3ddcd2<_0x1cc944;_0x3ddcd2++){var _0x2dff51=events[_0x3ddcd2];var _0x44ae54=createListener(_0x27e0('0x6')+_0x2dff51,_0x1f98c5);TeamEvents['on'](_0x2dff51,_0x44ae54);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 54000be..1ac26f4 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 _0x4c71=['../../config/environment','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x8886e3,_0x5ce7e5){var _0x514866=function(_0x543faf){while(--_0x543faf){_0x8886e3['push'](_0x8886e3['shift']());}};_0x514866(++_0x5ce7e5);}(_0x4c71,0x12b));var _0x14c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4c71[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x14c7('0x0'));var util=require(_0x14c7('0x1'));var path=require('path');var timeout=require(_0x14c7('0x2'));var express=require(_0x14c7('0x3'));var router=express[_0x14c7('0x4')]();var fs_extra=require(_0x14c7('0x5'));var auth=require(_0x14c7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x14c7('0x7'));module[_0x14c7('0x8')]=router; \ No newline at end of file +var _0xf45e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path'];(function(_0x5297bb,_0x2735e8){var _0x483366=function(_0x5e4a24){while(--_0x5e4a24){_0x5297bb['push'](_0x5297bb['shift']());}};_0x483366(++_0x2735e8);}(_0xf45e,0x115));var _0xef45=function(_0xa8d61c,_0x285f7a){_0xa8d61c=_0xa8d61c-0x0;var _0x98c03f=_0xf45e[_0xa8d61c];return _0x98c03f;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var fs_extra=require(_0xef45('0x4'));var auth=require(_0xef45('0x5'));var interaction=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));module[_0xef45('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 8c48490..1922940 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 _0xb10b=['sequelize','INTEGER'];(function(_0x40e04a,_0x4bce60){var _0x26d07e=function(_0x208939){while(--_0x208939){_0x40e04a['push'](_0x40e04a['shift']());}};_0x26d07e(++_0x4bce60);}(_0xb10b,0x12a));var _0xbb10=function(_0xf56b46,_0x4e32e8){_0xf56b46=_0xf56b46-0x0;var _0x583cea=_0xb10b[_0xf56b46];return _0x583cea;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1dcba0,_0x341963){var _0x3dedbe=function(_0x143e28){while(--_0x143e28){_0x1dcba0['push'](_0x1dcba0['shift']());}};_0x3dedbe(++_0x341963);}(_0xe706,0xa3));var _0x6e70=function(_0x3f4315,_0xd6ec89){_0x3f4315=_0x3f4315-0x0;var _0x5842e3=_0xe706[_0x3f4315];return _0x5842e3;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index b9da6d7..92e5193 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 _0xe897=['rimraf','../../config/environment','./teamVoiceQueue.attributes','define','team_has_voice_queues','lodash','util','bluebird','request-promise','path'];(function(_0x5f99b0,_0xbc349d){var _0x30487c=function(_0x243ff8){while(--_0x243ff8){_0x5f99b0['push'](_0x5f99b0['shift']());}};_0x30487c(++_0xbc349d);}(_0xe897,0x19f));var _0x7e89=function(_0x4891c0,_0x8c1fb7){_0x4891c0=_0x4891c0-0x0;var _0x22e338=_0xe897[_0x4891c0];return _0x22e338;};'use strict';var _=require(_0x7e89('0x0'));var util=require(_0x7e89('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7e89('0x2'));var rp=require(_0x7e89('0x3'));var fs=require('fs');var path=require(_0x7e89('0x4'));var rimraf=require(_0x7e89('0x5'));var config=require(_0x7e89('0x6'));var attributes=require(_0x7e89('0x7'));module['exports']=function(_0xb0bb0f,_0x466d9c){return _0xb0bb0f[_0x7e89('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0x7e89('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb71c=['request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x1273fe,_0x173b8d){var _0x38ae60=function(_0x140a62){while(--_0x140a62){_0x1273fe['push'](_0x1273fe['shift']());}};_0x38ae60(++_0x173b8d);}(_0xb71c,0xb7));var _0xcb71=function(_0x5519f3,_0x3a989e){_0x5519f3=_0x5519f3-0x0;var _0x73a551=_0xb71c[_0x5519f3];return _0x73a551;};'use strict';var _=require(_0xcb71('0x0'));var util=require(_0xcb71('0x1'));var logger=require(_0xcb71('0x2'))(_0xcb71('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb71('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb71('0x5'));var config=require(_0xcb71('0x6'));var attributes=require(_0xcb71('0x7'));module['exports']=function(_0x5c4e1f,_0x5ba023){return _0x5c4e1f[_0xcb71('0x8')](_0xcb71('0x9'),attributes,{'tableName':_0xcb71('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 4156871..653017e 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 _0x958b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x386ea8,_0x595f3a){var _0x421653=function(_0x4c4753){while(--_0x4c4753){_0x386ea8['push'](_0x386ea8['shift']());}};_0x421653(++_0x595f3a);}(_0x958b,0x172));var _0xb958=function(_0x5a2e19,_0x5dca3c){_0x5a2e19=_0x5a2e19-0x0;var _0x1aeab9=_0x958b[_0x5a2e19];return _0x1aeab9;};'use strict';var _=require(_0xb958('0x0'));var util=require(_0xb958('0x1'));var moment=require(_0xb958('0x2'));var BPromise=require(_0xb958('0x3'));var rs=require(_0xb958('0x4'));var fs=require('fs');var Redis=require(_0xb958('0x5'));var db=require(_0xb958('0x6'))['db'];var utils=require(_0xb958('0x7'));var logger=require(_0xb958('0x8'))(_0xb958('0x9'));var config=require(_0xb958('0xa'));var jayson=require(_0xb958('0xb'));var client=jayson[_0xb958('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a4d1f,_0x101067,_0x117803){return new BPromise(function(_0x159df5,_0x162fa){return client[_0xb958('0xd')](_0x1a4d1f,_0x117803)[_0xb958('0xe')](function(_0x4c768f){logger[_0xb958('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x101067,_0xb958('0x10'));logger[_0xb958('0x11')](_0xb958('0x12'),_0x101067,_0xb958('0x10'),JSON['stringify'](_0x4c768f));if(_0x4c768f[_0xb958('0x13')]){if(_0x4c768f[_0xb958('0x13')][_0xb958('0x14')]===0x1f4){logger[_0xb958('0x13')](_0xb958('0x15'),_0x101067,_0x4c768f[_0xb958('0x13')]['message']);return _0x162fa(_0x4c768f[_0xb958('0x13')][_0xb958('0x16')]);}logger[_0xb958('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x101067,_0x4c768f[_0xb958('0x13')][_0xb958('0x16')]);return _0x159df5(_0x4c768f[_0xb958('0x13')][_0xb958('0x16')]);}else{logger[_0xb958('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x101067,_0xb958('0x10'));_0x159df5(_0x4c768f[_0xb958('0x17')][_0xb958('0x16')]);}})[_0xb958('0x18')](function(_0x24464f){logger['error'](_0xb958('0x15'),_0x101067,_0x24464f);_0x162fa(_0x24464f);});});} \ No newline at end of file +var _0xae92=['TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','stringify','error','code'];(function(_0x14f949,_0x49f4c5){var _0x4cca47=function(_0xd1de2b){while(--_0xd1de2b){_0x14f949['push'](_0x14f949['shift']());}};_0x4cca47(++_0x49f4c5);}(_0xae92,0x1d2));var _0x2ae9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae92[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2ae9('0x0'));var util=require(_0x2ae9('0x1'));var moment=require(_0x2ae9('0x2'));var BPromise=require(_0x2ae9('0x3'));var rs=require(_0x2ae9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ae9('0x5'))['db'];var utils=require(_0x2ae9('0x6'));var logger=require(_0x2ae9('0x7'))('rpc');var config=require(_0x2ae9('0x8'));var jayson=require(_0x2ae9('0x9'));var client=jayson['client'][_0x2ae9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a0104,_0x21fd5b,_0xf06364){return new BPromise(function(_0x6adf10,_0x526376){return client[_0x2ae9('0xb')](_0x5a0104,_0xf06364)['then'](function(_0x5d778b){logger[_0x2ae9('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x21fd5b,_0x2ae9('0xd'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x21fd5b,_0x2ae9('0xd'),JSON[_0x2ae9('0xe')](_0x5d778b));if(_0x5d778b[_0x2ae9('0xf')]){if(_0x5d778b['error'][_0x2ae9('0x10')]===0x1f4){logger[_0x2ae9('0xf')](_0x2ae9('0x11'),_0x21fd5b,_0x5d778b[_0x2ae9('0xf')][_0x2ae9('0x12')]);return _0x526376(_0x5d778b[_0x2ae9('0xf')][_0x2ae9('0x12')]);}logger[_0x2ae9('0xf')](_0x2ae9('0x11'),_0x21fd5b,_0x5d778b[_0x2ae9('0xf')][_0x2ae9('0x12')]);return _0x6adf10(_0x5d778b[_0x2ae9('0xf')]['message']);}else{logger[_0x2ae9('0xc')](_0x2ae9('0x11'),_0x21fd5b,'request\x20sent');_0x6adf10(_0x5d778b[_0x2ae9('0x13')][_0x2ae9('0x12')]);}})[_0x2ae9('0x14')](function(_0x365145){logger[_0x2ae9('0xf')](_0x2ae9('0x11'),_0x21fd5b,_0x365145);_0x526376(_0x365145);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 534b806..d36e16b 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 _0xae24=['../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','path','express','Router'];(function(_0x192a8e,_0x2fc581){var _0x284767=function(_0x5959b1){while(--_0x5959b1){_0x192a8e['push'](_0x192a8e['shift']());}};_0x284767(++_0x2fc581);}(_0xae24,0x182));var _0x4ae2=function(_0x5dbd4c,_0x5c4589){_0x5dbd4c=_0x5dbd4c-0x0;var _0x37966f=_0xae24[_0x5dbd4c];return _0x37966f;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')]('/',auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x8')]);router[_0x4ae2('0x6')](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4ae2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4ae2('0xb')](_0x4ae2('0x9'),auth['isAuthenticated'](),controller[_0x4ae2('0xc')]);router[_0x4ae2('0xd')](_0x4ae2('0x9'),auth[_0x4ae2('0x7')](),controller['destroy']);module[_0x4ae2('0xe')]=router; \ No newline at end of file +var _0x2eb2=['/:id','show','post','create','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x37fe0e,_0x298770){var _0x3c5d5f=function(_0x6461fc){while(--_0x6461fc){_0x37fe0e['push'](_0x37fe0e['shift']());}};_0x3c5d5f(++_0x298770);}(_0x2eb2,0x19f));var _0x22eb=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x2eb2[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x22eb('0x7')]('/',auth[_0x22eb('0x8')](),controller[_0x22eb('0x9')]);router[_0x22eb('0x7')](_0x22eb('0xa'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x8')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth['isAuthenticated'](),controller[_0x22eb('0xf')]);router['delete']('/:id',auth[_0x22eb('0x8')](),controller['destroy']);module[_0x22eb('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index fe5980b..e06b757 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 _0xe0cb=['TEXT','sequelize','exports','STRING'];(function(_0x3c090d,_0x2e9410){var _0x4b845b=function(_0x44ea0e){while(--_0x44ea0e){_0x3c090d['push'](_0x3c090d['shift']());}};_0x4b845b(++_0x2e9410);}(_0xe0cb,0x95));var _0xbe0c=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xe0cb[_0x3bfdde];return _0x3f752a;};'use strict';var Sequelize=require(_0xbe0c('0x0'));module[_0xbe0c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbe0c('0x2')]},'html':{'type':Sequelize[_0xbe0c('0x3')]}}; \ No newline at end of file +var _0x4822=['STRING'];(function(_0x134555,_0x2caadd){var _0x3b08a2=function(_0x1f58bd){while(--_0x1f58bd){_0x134555['push'](_0x134555['shift']());}};_0x3b08a2(++_0x2caadd);}(_0x4822,0x12e));var _0x2482=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x4822[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2482('0x0')]},'description':{'type':Sequelize[_0x2482('0x0')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0962ec9..ed709ae 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 _0x336e=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','destroy','error','name','send','merge','body','message','agent','interaction','account','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','VIRTUAL','options','include','findAll','rows','catch','params','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x50b51e,_0x3a18ce){var _0x2688e6=function(_0xb9fe9){while(--_0xb9fe9){_0x50b51e['push'](_0x50b51e['shift']());}};_0x2688e6(++_0x3a18ce);}(_0x336e,0x14f));var _0xe336=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x336e[_0x4e9d3c];return _0x2d0825;};'use strict';var emlformat=require(_0xe336('0x0'));var rimraf=require(_0xe336('0x1'));var zipdir=require(_0xe336('0x2'));var jsonpatch=require(_0xe336('0x3'));var rp=require(_0xe336('0x4'));var moment=require('moment');var BPromise=require(_0xe336('0x5'));var Mustache=require('mustache');var util=require(_0xe336('0x6'));var path=require(_0xe336('0x7'));var sox=require(_0xe336('0x8'));var csv=require(_0xe336('0x9'));var ejs=require(_0xe336('0xa'));var fs=require('fs');var fs_extra=require(_0xe336('0xb'));var _=require(_0xe336('0xc'));var squel=require('squel');var crypto=require(_0xe336('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe336('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe336('0xf'));var Papa=require(_0xe336('0x10'));var Redis=require('ioredis');var authService=require(_0xe336('0x11'));var qs=require(_0xe336('0x12'));var as=require(_0xe336('0x13'));var hardwareService=require(_0xe336('0x14'));var logger=require(_0xe336('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xe336('0x16'));var licenseUtil=require(_0xe336('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x128d09,_0x1c8fbc){_0x1c8fbc=_0x1c8fbc||0xcc;return function(_0x3331ab){if(_0x3331ab){return _0x128d09[_0xe336('0x18')](_0x1c8fbc);}return _0x128d09['status'](_0x1c8fbc)[_0xe336('0x19')]();};}function respondWithResult(_0x22f3a9,_0x494527){_0x494527=_0x494527||0xc8;return function(_0x29fec5){if(_0x29fec5){return _0x22f3a9[_0xe336('0x1a')](_0x494527)[_0xe336('0x1b')](_0x29fec5);}};}function respondWithFilteredResult(_0xfcde9d,_0x45f6ed){return function(_0x598b50){if(_0x598b50){var _0x48dc3d=typeof _0x45f6ed[_0xe336('0x1c')]==='undefined'&&typeof _0x45f6ed[_0xe336('0x1d')]===_0xe336('0x1e');var _0x57212c=_0x598b50[_0xe336('0x1f')];var _0x2a9888=_0x48dc3d?0x0:_0x45f6ed[_0xe336('0x1c')];var _0x3a3711=_0x48dc3d?_0x598b50[_0xe336('0x1f')]:_0x45f6ed[_0xe336('0x1c')]+_0x45f6ed[_0xe336('0x1d')];var _0x2dad80;if(_0x3a3711>=_0x57212c){_0x3a3711=_0x57212c;_0x2dad80=0xc8;}else{_0x2dad80=0xce;}_0xfcde9d[_0xe336('0x1a')](_0x2dad80);return _0xfcde9d[_0xe336('0x20')](_0xe336('0x21'),_0x2a9888+'-'+_0x3a3711+'/'+_0x57212c)[_0xe336('0x1b')](_0x598b50);}return null;};}function patchUpdates(_0x52a230){return function(_0x4402a2){try{jsonpatch[_0xe336('0x22')](_0x4402a2,_0x52a230,!![]);}catch(_0xc54ab7){return BPromise[_0xe336('0x23')](_0xc54ab7);}return _0x4402a2[_0xe336('0x24')]();};}function saveUpdates(_0x373d22,_0x4ae2fc){return function(_0x440f97){if(_0x440f97){return _0x440f97[_0xe336('0x25')](_0x373d22)[_0xe336('0x26')](function(_0xbe688c){return _0xbe688c;});}return null;};}function removeEntity(_0x40789e,_0x4d330c){return function(_0x68d3b5){if(_0x68d3b5){return _0x68d3b5['destroy']()['then'](function(){var _0x1360f7=_0x68d3b5[_0xe336('0x27')]({'plain':!![]});var _0x5962af='Templates';return db['UserProfileResource'][_0xe336('0x28')]({'where':{'type':_0x5962af,'resourceId':_0x1360f7['id']}})[_0xe336('0x26')](function(){return _0x68d3b5;});})[_0xe336('0x26')](function(){_0x40789e[_0xe336('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a1e9c,_0x28a75a){return function(_0x23492d){if(!_0x23492d){_0x3a1e9c[_0xe336('0x18')](0x194);}return _0x23492d;};}function handleError(_0x29caff,_0x527d04){_0x527d04=_0x527d04||0x1f4;return function(_0x499281){logger[_0xe336('0x29')](_0x499281['stack']);if(_0x499281[_0xe336('0x2a')]){delete _0x499281['name'];}_0x29caff[_0xe336('0x1a')](_0x527d04)[_0xe336('0x2b')](_0x499281);};}function getMustacheRender(_0x106d61,_0xd5bb39){return Mustache['render'](_0x106d61,_[_0xe336('0x2c')](_0xd5bb39[_0xe336('0x2d')],{'contact':_0xd5bb39['contact'],'message':_0xd5bb39[_0xe336('0x2e')],'agent':_0xd5bb39[_0xe336('0x2f')],'interaction':_0xd5bb39[_0xe336('0x30')],'account':_0xd5bb39[_0xe336('0x31')]}))||'';}exports[_0xe336('0x32')]=function(_0x30b814,_0x5650ea){var _0x1a023b={},_0x7e98ce={},_0x420ba8={'count':0x0,'rows':[]};var _0x43e32e=_[_0xe336('0x33')](db[_0xe336('0x34')][_0xe336('0x35')],function(_0x2da89f){return{'name':_0x2da89f[_0xe336('0x36')],'type':_0x2da89f[_0xe336('0x37')][_0xe336('0x38')]};});_0x7e98ce[_0xe336('0x39')]=_[_0xe336('0x33')](_0x43e32e,_0xe336('0x2a'));_0x7e98ce[_0xe336('0x3a')]=_[_0xe336('0x3b')](_0x30b814['query']);_0x7e98ce['filters']=_[_0xe336('0x3c')](_0x7e98ce['model'],_0x7e98ce['query']);_0x1a023b[_0xe336('0x3d')]=_[_0xe336('0x3c')](_0x7e98ce[_0xe336('0x39')],qs[_0xe336('0x3e')](_0x30b814[_0xe336('0x3a')]['fields']));_0x1a023b['attributes']=_0x1a023b['attributes'][_0xe336('0x3f')]?_0x1a023b['attributes']:_0x7e98ce[_0xe336('0x39')];if(!_0x30b814[_0xe336('0x3a')][_0xe336('0x40')](_0xe336('0x41'))){_0x1a023b['limit']=qs['limit'](_0x30b814[_0xe336('0x3a')][_0xe336('0x1d')]);_0x1a023b['offset']=qs[_0xe336('0x1c')](_0x30b814['query'][_0xe336('0x1c')]);}_0x1a023b['order']=qs['sort'](_0x30b814['query']['sort']);_0x1a023b[_0xe336('0x42')]=qs[_0xe336('0x43')](_[_0xe336('0x44')](_0x30b814[_0xe336('0x3a')],_0x7e98ce['filters']),_0x43e32e);if(_0x30b814[_0xe336('0x3a')][_0xe336('0x45')]){_0x1a023b['where']=_['merge'](_0x1a023b[_0xe336('0x42')],{'$or':_[_0xe336('0x33')](_0x43e32e,function(_0x13bb64){if(_0x13bb64[_0xe336('0x37')]!==_0xe336('0x46')){var _0x1db841={};_0x1db841[_0x13bb64['name']]={'$like':'%'+_0x30b814[_0xe336('0x3a')][_0xe336('0x45')]+'%'};return _0x1db841;}})});}_0x1a023b=_[_0xe336('0x2c')]({},_0x1a023b,_0x30b814[_0xe336('0x47')]);var _0x53097d={'where':_0x1a023b[_0xe336('0x42')]};return db[_0xe336('0x34')][_0xe336('0x1f')](_0x53097d)[_0xe336('0x26')](function(_0x203ab3){_0x420ba8[_0xe336('0x1f')]=_0x203ab3;if(_0x30b814[_0xe336('0x3a')]['includeAll']){_0x1a023b[_0xe336('0x48')]=[{'all':!![]}];}return db[_0xe336('0x34')][_0xe336('0x49')](_0x1a023b);})[_0xe336('0x26')](function(_0x311f10){_0x420ba8[_0xe336('0x4a')]=_0x311f10;return _0x420ba8;})[_0xe336('0x26')](respondWithFilteredResult(_0x5650ea,_0x1a023b))[_0xe336('0x4b')](handleError(_0x5650ea,null));};exports['show']=function(_0x500281,_0x3bb035){var _0x808251={'raw':!![],'where':{'id':_0x500281[_0xe336('0x4c')]['id']}},_0x5e2487={};_0x5e2487[_0xe336('0x39')]=_[_0xe336('0x3b')](db[_0xe336('0x34')][_0xe336('0x35')]);_0x5e2487[_0xe336('0x3a')]=_[_0xe336('0x3b')](_0x500281['query']);_0x5e2487[_0xe336('0x43')]=_['intersection'](_0x5e2487[_0xe336('0x39')],_0x5e2487[_0xe336('0x3a')]);_0x808251[_0xe336('0x3d')]=_[_0xe336('0x3c')](_0x5e2487['model'],qs[_0xe336('0x3e')](_0x500281[_0xe336('0x3a')][_0xe336('0x3e')]));_0x808251[_0xe336('0x3d')]=_0x808251['attributes'][_0xe336('0x3f')]?_0x808251['attributes']:_0x5e2487['model'];if(_0x500281[_0xe336('0x3a')]['includeAll']){_0x808251[_0xe336('0x48')]=[{'all':!![]}];}_0x808251=_[_0xe336('0x2c')]({},_0x808251,_0x500281[_0xe336('0x47')]);return db['Template'][_0xe336('0x4d')](_0x808251)['then'](handleEntityNotFound(_0x3bb035,null))[_0xe336('0x26')](respondWithResult(_0x3bb035,null))[_0xe336('0x4b')](handleError(_0x3bb035,null));};exports['create']=function(_0x158196,_0x4ae377){return db[_0xe336('0x34')]['create'](_0x158196[_0xe336('0x2d')],{})[_0xe336('0x26')](function(_0x1bb246){var _0xd15c30=_0x158196['user'][_0xe336('0x27')]({'plain':!![]});if(!_0xd15c30)throw new Error(_0xe336('0x4e'));if(_0xd15c30[_0xe336('0x4f')]==='user'){var _0x2a3333=_0x1bb246[_0xe336('0x27')]({'plain':!![]});var _0x27187a=_0xe336('0x50');return db['UserProfileSection'][_0xe336('0x4d')]({'where':{'name':_0x27187a,'userProfileId':_0xd15c30[_0xe336('0x51')]},'raw':!![]})['then'](function(_0x3b83b4){if(_0x3b83b4&&_0x3b83b4['autoAssociation']===0x0){return db[_0xe336('0x52')][_0xe336('0x53')]({'name':_0x2a3333[_0xe336('0x2a')],'resourceId':_0x2a3333['id'],'type':_0x3b83b4[_0xe336('0x2a')],'sectionId':_0x3b83b4['id']},{})[_0xe336('0x26')](function(){return _0x1bb246;});}else{return _0x1bb246;}})[_0xe336('0x4b')](function(_0x268abc){logger[_0xe336('0x29')](_0xe336('0x54'),_0x268abc);throw _0x268abc;});}return _0x1bb246;})['then'](respondWithResult(_0x4ae377,0xc9))[_0xe336('0x4b')](handleError(_0x4ae377,null));};exports[_0xe336('0x25')]=function(_0xa2f714,_0xce7903){if(_0xa2f714[_0xe336('0x2d')]['id']){delete _0xa2f714[_0xe336('0x2d')]['id'];}return db[_0xe336('0x34')][_0xe336('0x4d')]({'where':{'id':_0xa2f714[_0xe336('0x4c')]['id']}})[_0xe336('0x26')](handleEntityNotFound(_0xce7903,null))['then'](saveUpdates(_0xa2f714[_0xe336('0x2d')],null))[_0xe336('0x26')](respondWithResult(_0xce7903,null))[_0xe336('0x4b')](handleError(_0xce7903,null));};exports[_0xe336('0x28')]=function(_0x1edd5c,_0x1b3e7b){return db[_0xe336('0x34')][_0xe336('0x4d')]({'where':{'id':_0x1edd5c[_0xe336('0x4c')]['id']}})[_0xe336('0x26')](handleEntityNotFound(_0x1b3e7b,null))[_0xe336('0x26')](removeEntity(_0x1b3e7b,null))[_0xe336('0x4b')](handleError(_0x1b3e7b,null));}; \ No newline at end of file +var _0x1820=['offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Templates','end','sendStatus','error','stack','name','render','merge','body','contact','agent','interaction','account','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json'];(function(_0x46b4da,_0x2026ab){var _0x3fc469=function(_0x3e7e21){while(--_0x3e7e21){_0x46b4da['push'](_0x46b4da['shift']());}};_0x3fc469(++_0x2026ab);}(_0x1820,0x13a));var _0x0182=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x1820[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0182('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0182('0x1'));var BPromise=require(_0x0182('0x2'));var Mustache=require('mustache');var util=require(_0x0182('0x3'));var path=require(_0x0182('0x4'));var sox=require(_0x0182('0x5'));var csv=require('to-csv');var ejs=require(_0x0182('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0182('0x7'));var crypto=require(_0x0182('0x8'));var jsforce=require(_0x0182('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x0182('0xa'));var querystring=require('querystring');var Papa=require(_0x0182('0xb'));var Redis=require('ioredis');var authService=require(_0x0182('0xc'));var qs=require(_0x0182('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0182('0xe'));var logger=require('../../config/logger')(_0x0182('0xf'));var utils=require(_0x0182('0x10'));var config=require(_0x0182('0x11'));var licenseUtil=require(_0x0182('0x12'));var db=require(_0x0182('0x13'))['db'];function respondWithStatusCode(_0x17bb9d,_0x276cfe){_0x276cfe=_0x276cfe||0xcc;return function(_0x32c1d3){if(_0x32c1d3){return _0x17bb9d['sendStatus'](_0x276cfe);}return _0x17bb9d[_0x0182('0x14')](_0x276cfe)['end']();};}function respondWithResult(_0x35612c,_0x1d19f3){_0x1d19f3=_0x1d19f3||0xc8;return function(_0x4b1073){if(_0x4b1073){return _0x35612c[_0x0182('0x14')](_0x1d19f3)[_0x0182('0x15')](_0x4b1073);}};}function respondWithFilteredResult(_0xa77283,_0x28efc3){return function(_0x4b91bf){if(_0x4b91bf){var _0xa64c9b=typeof _0x28efc3[_0x0182('0x16')]===_0x0182('0x17')&&typeof _0x28efc3[_0x0182('0x18')]==='undefined';var _0x4fd96a=_0x4b91bf['count'];var _0xd641d7=_0xa64c9b?0x0:_0x28efc3[_0x0182('0x16')];var _0x4881a7=_0xa64c9b?_0x4b91bf[_0x0182('0x19')]:_0x28efc3[_0x0182('0x16')]+_0x28efc3[_0x0182('0x18')];var _0x4bf857;if(_0x4881a7>=_0x4fd96a){_0x4881a7=_0x4fd96a;_0x4bf857=0xc8;}else{_0x4bf857=0xce;}_0xa77283['status'](_0x4bf857);return _0xa77283[_0x0182('0x1a')]('Content-Range',_0xd641d7+'-'+_0x4881a7+'/'+_0x4fd96a)['json'](_0x4b91bf);}return null;};}function patchUpdates(_0x3b9005){return function(_0x3bd647){try{jsonpatch[_0x0182('0x1b')](_0x3bd647,_0x3b9005,!![]);}catch(_0x1f332e){return BPromise[_0x0182('0x1c')](_0x1f332e);}return _0x3bd647[_0x0182('0x1d')]();};}function saveUpdates(_0x51c15e,_0x5d13e8){return function(_0x28ca24){if(_0x28ca24){return _0x28ca24[_0x0182('0x1e')](_0x51c15e)[_0x0182('0x1f')](function(_0x43d33c){return _0x43d33c;});}return null;};}function removeEntity(_0x193379,_0x40ff0c){return function(_0x4d8c9e){if(_0x4d8c9e){return _0x4d8c9e[_0x0182('0x20')]()[_0x0182('0x1f')](function(){var _0x1f456f=_0x4d8c9e[_0x0182('0x21')]({'plain':!![]});var _0x43c95c=_0x0182('0x22');return db['UserProfileResource'][_0x0182('0x20')]({'where':{'type':_0x43c95c,'resourceId':_0x1f456f['id']}})[_0x0182('0x1f')](function(){return _0x4d8c9e;});})[_0x0182('0x1f')](function(){_0x193379[_0x0182('0x14')](0xcc)[_0x0182('0x23')]();});}};}function handleEntityNotFound(_0x237dff,_0xd6ffb7){return function(_0x4b8528){if(!_0x4b8528){_0x237dff[_0x0182('0x24')](0x194);}return _0x4b8528;};}function handleError(_0x5ca20b,_0x320e2e){_0x320e2e=_0x320e2e||0x1f4;return function(_0xce1a04){logger[_0x0182('0x25')](_0xce1a04[_0x0182('0x26')]);if(_0xce1a04[_0x0182('0x27')]){delete _0xce1a04['name'];}_0x5ca20b[_0x0182('0x14')](_0x320e2e)['send'](_0xce1a04);};}function getMustacheRender(_0x118160,_0x366537){return Mustache[_0x0182('0x28')](_0x118160,_[_0x0182('0x29')](_0x366537[_0x0182('0x2a')],{'contact':_0x366537[_0x0182('0x2b')],'message':_0x366537['message'],'agent':_0x366537[_0x0182('0x2c')],'interaction':_0x366537[_0x0182('0x2d')],'account':_0x366537[_0x0182('0x2e')]}))||'';}exports[_0x0182('0x2f')]=function(_0x281f9e,_0x11028b){var _0x16a78c={},_0x35e9d7={},_0x1120ad={'count':0x0,'rows':[]};var _0x314fe3=_[_0x0182('0x30')](db[_0x0182('0x31')][_0x0182('0x32')],function(_0x3defc7){return{'name':_0x3defc7[_0x0182('0x33')],'type':_0x3defc7[_0x0182('0x34')][_0x0182('0x35')]};});_0x35e9d7[_0x0182('0x36')]=_[_0x0182('0x30')](_0x314fe3,_0x0182('0x27'));_0x35e9d7[_0x0182('0x37')]=_[_0x0182('0x38')](_0x281f9e[_0x0182('0x37')]);_0x35e9d7['filters']=_[_0x0182('0x39')](_0x35e9d7[_0x0182('0x36')],_0x35e9d7[_0x0182('0x37')]);_0x16a78c[_0x0182('0x3a')]=_['intersection'](_0x35e9d7[_0x0182('0x36')],qs[_0x0182('0x3b')](_0x281f9e[_0x0182('0x37')][_0x0182('0x3b')]));_0x16a78c['attributes']=_0x16a78c[_0x0182('0x3a')][_0x0182('0x3c')]?_0x16a78c['attributes']:_0x35e9d7[_0x0182('0x36')];if(!_0x281f9e[_0x0182('0x37')][_0x0182('0x3d')](_0x0182('0x3e'))){_0x16a78c[_0x0182('0x18')]=qs[_0x0182('0x18')](_0x281f9e[_0x0182('0x37')][_0x0182('0x18')]);_0x16a78c[_0x0182('0x16')]=qs[_0x0182('0x16')](_0x281f9e[_0x0182('0x37')][_0x0182('0x16')]);}_0x16a78c[_0x0182('0x3f')]=qs[_0x0182('0x40')](_0x281f9e['query'][_0x0182('0x40')]);_0x16a78c[_0x0182('0x41')]=qs[_0x0182('0x42')](_[_0x0182('0x43')](_0x281f9e['query'],_0x35e9d7[_0x0182('0x42')]),_0x314fe3);if(_0x281f9e['query'][_0x0182('0x44')]){_0x16a78c['where']=_['merge'](_0x16a78c['where'],{'$or':_[_0x0182('0x30')](_0x314fe3,function(_0x1d1129){if(_0x1d1129[_0x0182('0x34')]!==_0x0182('0x45')){var _0x3313ba={};_0x3313ba[_0x1d1129[_0x0182('0x27')]]={'$like':'%'+_0x281f9e[_0x0182('0x37')][_0x0182('0x44')]+'%'};return _0x3313ba;}})});}_0x16a78c=_['merge']({},_0x16a78c,_0x281f9e[_0x0182('0x46')]);var _0x3a911c={'where':_0x16a78c[_0x0182('0x41')]};return db['Template'][_0x0182('0x19')](_0x3a911c)[_0x0182('0x1f')](function(_0x3d4087){_0x1120ad[_0x0182('0x19')]=_0x3d4087;if(_0x281f9e[_0x0182('0x37')][_0x0182('0x47')]){_0x16a78c[_0x0182('0x48')]=[{'all':!![]}];}return db[_0x0182('0x31')]['findAll'](_0x16a78c);})['then'](function(_0x21c568){_0x1120ad['rows']=_0x21c568;return _0x1120ad;})[_0x0182('0x1f')](respondWithFilteredResult(_0x11028b,_0x16a78c))[_0x0182('0x49')](handleError(_0x11028b,null));};exports['show']=function(_0x35f61a,_0x31b5af){var _0x1cedbb={'raw':!![],'where':{'id':_0x35f61a['params']['id']}},_0x1ca98e={};_0x1ca98e[_0x0182('0x36')]=_[_0x0182('0x38')](db[_0x0182('0x31')][_0x0182('0x32')]);_0x1ca98e[_0x0182('0x37')]=_[_0x0182('0x38')](_0x35f61a[_0x0182('0x37')]);_0x1ca98e[_0x0182('0x42')]=_['intersection'](_0x1ca98e[_0x0182('0x36')],_0x1ca98e[_0x0182('0x37')]);_0x1cedbb[_0x0182('0x3a')]=_[_0x0182('0x39')](_0x1ca98e['model'],qs[_0x0182('0x3b')](_0x35f61a[_0x0182('0x37')][_0x0182('0x3b')]));_0x1cedbb[_0x0182('0x3a')]=_0x1cedbb[_0x0182('0x3a')][_0x0182('0x3c')]?_0x1cedbb[_0x0182('0x3a')]:_0x1ca98e[_0x0182('0x36')];if(_0x35f61a[_0x0182('0x37')][_0x0182('0x47')]){_0x1cedbb[_0x0182('0x48')]=[{'all':!![]}];}_0x1cedbb=_[_0x0182('0x29')]({},_0x1cedbb,_0x35f61a[_0x0182('0x46')]);return db[_0x0182('0x31')][_0x0182('0x4a')](_0x1cedbb)['then'](handleEntityNotFound(_0x31b5af,null))['then'](respondWithResult(_0x31b5af,null))['catch'](handleError(_0x31b5af,null));};exports['create']=function(_0x419cef,_0x2eddd1){return db[_0x0182('0x31')][_0x0182('0x4b')](_0x419cef['body'],{})['then'](function(_0xfa638d){var _0x24209d=_0x419cef[_0x0182('0x4c')][_0x0182('0x21')]({'plain':!![]});if(!_0x24209d)throw new Error(_0x0182('0x4d'));if(_0x24209d['role']===_0x0182('0x4c')){var _0x3d16f0=_0xfa638d[_0x0182('0x21')]({'plain':!![]});var _0x325151=_0x0182('0x22');return db[_0x0182('0x4e')][_0x0182('0x4a')]({'where':{'name':_0x325151,'userProfileId':_0x24209d[_0x0182('0x4f')]},'raw':!![]})['then'](function(_0x2fb1ec){if(_0x2fb1ec&&_0x2fb1ec[_0x0182('0x50')]===0x0){return db[_0x0182('0x51')]['create']({'name':_0x3d16f0[_0x0182('0x27')],'resourceId':_0x3d16f0['id'],'type':_0x2fb1ec[_0x0182('0x27')],'sectionId':_0x2fb1ec['id']},{})[_0x0182('0x1f')](function(){return _0xfa638d;});}else{return _0xfa638d;}})[_0x0182('0x49')](function(_0x218dc1){logger[_0x0182('0x25')](_0x0182('0x52'),_0x218dc1);throw _0x218dc1;});}return _0xfa638d;})['then'](respondWithResult(_0x2eddd1,0xc9))[_0x0182('0x49')](handleError(_0x2eddd1,null));};exports[_0x0182('0x1e')]=function(_0x30eeaf,_0x158df4){if(_0x30eeaf[_0x0182('0x2a')]['id']){delete _0x30eeaf[_0x0182('0x2a')]['id'];}return db['Template']['find']({'where':{'id':_0x30eeaf[_0x0182('0x53')]['id']}})[_0x0182('0x1f')](handleEntityNotFound(_0x158df4,null))[_0x0182('0x1f')](saveUpdates(_0x30eeaf['body'],null))[_0x0182('0x1f')](respondWithResult(_0x158df4,null))[_0x0182('0x49')](handleError(_0x158df4,null));};exports[_0x0182('0x20')]=function(_0x5d1dda,_0x1ee58b){return db[_0x0182('0x31')][_0x0182('0x4a')]({'where':{'id':_0x5d1dda['params']['id']}})[_0x0182('0x1f')](handleEntityNotFound(_0x1ee58b,null))[_0x0182('0x1f')](removeEntity(_0x1ee58b,null))['catch'](handleError(_0x1ee58b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 4bc3802..1386851 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 _0x22a9=['../../config/logger','api','bluebird','request-promise','path','rimraf','./template.attributes','exports','define','tools_templates','lodash','util'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x22a9,0x8e));var _0x922a=function(_0x250776,_0x446351){_0x250776=_0x250776-0x0;var _0x3820dc=_0x22a9[_0x250776];return _0x3820dc;};'use strict';var _=require(_0x922a('0x0'));var util=require(_0x922a('0x1'));var logger=require(_0x922a('0x2'))(_0x922a('0x3'));var moment=require('moment');var BPromise=require(_0x922a('0x4'));var rp=require(_0x922a('0x5'));var fs=require('fs');var path=require(_0x922a('0x6'));var rimraf=require(_0x922a('0x7'));var config=require('../../config/environment');var attributes=require(_0x922a('0x8'));module[_0x922a('0x9')]=function(_0x312bce,_0x6ab23d){return _0x312bce[_0x922a('0xa')]('Template',attributes,{'tableName':_0x922a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x539d=['../../config/environment','exports','define','tools_templates','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x5b7a45,_0x2f4629){var _0x50e70e=function(_0x2e0a64){while(--_0x2e0a64){_0x5b7a45['push'](_0x5b7a45['shift']());}};_0x50e70e(++_0x2f4629);}(_0x539d,0xb4));var _0xd539=function(_0x310a54,_0x212d9a){_0x310a54=_0x310a54-0x0;var _0x4e4caa=_0x539d[_0x310a54];return _0x4e4caa;};'use strict';var _=require(_0xd539('0x0'));var util=require(_0xd539('0x1'));var logger=require(_0xd539('0x2'))(_0xd539('0x3'));var moment=require(_0xd539('0x4'));var BPromise=require('bluebird');var rp=require(_0xd539('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd539('0x6'));var config=require(_0xd539('0x7'));var attributes=require('./template.attributes');module[_0xd539('0x8')]=function(_0x372016,_0x4f2ec7){return _0x372016[_0xd539('0x9')]('Template',attributes,{'tableName':_0xd539('0xa'),'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 48ebf32..e0c92fe 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 _0x091e=['../../config/environment','jayson/promise','client','http','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTemplate','findAll','options','raw','where','attributes','include','model','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x091e,0x121));var _0xe091=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x091e[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xe091('0x0'));var util=require('util');var moment=require(_0xe091('0x1'));var BPromise=require(_0xe091('0x2'));var rs=require(_0xe091('0x3'));var fs=require('fs');var Redis=require(_0xe091('0x4'));var db=require(_0xe091('0x5'))['db'];var utils=require(_0xe091('0x6'));var logger=require('../../config/logger')(_0xe091('0x7'));var config=require(_0xe091('0x8'));var jayson=require(_0xe091('0x9'));var client=jayson[_0xe091('0xa')][_0xe091('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cd33d,_0x383ed0,_0xe1c64c){return new BPromise(function(_0x510ad6,_0x4b5c75){return client['request'](_0x3cd33d,_0xe1c64c)[_0xe091('0xc')](function(_0x472170){logger['info'](_0xe091('0xd'),_0x383ed0,_0xe091('0xe'));logger[_0xe091('0xf')](_0xe091('0x10'),_0x383ed0,'request\x20sent',JSON[_0xe091('0x11')](_0x472170));if(_0x472170[_0xe091('0x12')]){if(_0x472170['error'][_0xe091('0x13')]===0x1f4){logger[_0xe091('0x12')](_0xe091('0xd'),_0x383ed0,_0x472170['error'][_0xe091('0x14')]);return _0x4b5c75(_0x472170[_0xe091('0x12')][_0xe091('0x14')]);}logger['error']('Template,\x20%s,\x20%s',_0x383ed0,_0x472170['error']['message']);return _0x510ad6(_0x472170[_0xe091('0x12')]['message']);}else{logger[_0xe091('0x15')]('Template,\x20%s,\x20%s',_0x383ed0,_0xe091('0xe'));_0x510ad6(_0x472170[_0xe091('0x16')][_0xe091('0x14')]);}})[_0xe091('0x17')](function(_0x45c0d8){logger[_0xe091('0x12')](_0xe091('0xd'),_0x383ed0,_0x45c0d8);_0x4b5c75(_0x45c0d8);});});}exports[_0xe091('0x18')]=function(_0x3b6a07){var _0x228b9c=this;return new Promise(function(_0x22cfdb,_0x419b47){return db['Template'][_0xe091('0x19')]({'raw':_0x3b6a07[_0xe091('0x1a')]?_0x3b6a07['options'][_0xe091('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b6a07[_0xe091('0x1a')]?_0x3b6a07['options'][_0xe091('0x1c')]||null:null,'attributes':_0x3b6a07[_0xe091('0x1a')]?_0x3b6a07[_0xe091('0x1a')][_0xe091('0x1d')]||null:null,'limit':_0x3b6a07[_0xe091('0x1a')]?_0x3b6a07[_0xe091('0x1a')]['limit']||null:null,'include':_0x3b6a07[_0xe091('0x1a')]?_0x3b6a07[_0xe091('0x1a')][_0xe091('0x1e')]?_['map'](_0x3b6a07['options']['include'],function(_0x24cd18){return{'model':db[_0x24cd18[_0xe091('0x1f')]],'as':_0x24cd18['as'],'attributes':_0x24cd18['attributes'],'include':_0x24cd18[_0xe091('0x1e')]?_[_0xe091('0x20')](_0x24cd18['include'],function(_0x469a8a){return{'model':db[_0x469a8a[_0xe091('0x1f')]],'as':_0x469a8a['as'],'attributes':_0x469a8a[_0xe091('0x1d')],'include':_0x469a8a[_0xe091('0x1e')]?_[_0xe091('0x20')](_0x469a8a[_0xe091('0x1e')],function(_0x1ee5ec){return{'model':db[_0x1ee5ec[_0xe091('0x1f')]],'as':_0x1ee5ec['as'],'attributes':_0x1ee5ec[_0xe091('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe091('0xc')](function(_0x20f6f1){logger[_0xe091('0x15')](_0xe091('0x18'),_0x3b6a07);logger[_0xe091('0xf')]('GetTemplate',_0x3b6a07,JSON['stringify'](_0x20f6f1));_0x22cfdb(_0x20f6f1);})[_0xe091('0x17')](function(_0x466ec7){logger[_0xe091('0x12')](_0xe091('0x18'),_0x466ec7[_0xe091('0x14')],_0x3b6a07);_0x419b47(_0x228b9c[_0xe091('0x12')](0x1f4,_0x466ec7['message']));});});}; \ No newline at end of file +var _0x38ac=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','options','raw','where','limit','map','include','model','attributes','stringify'];(function(_0x4c4396,_0x2f6841){var _0x394c38=function(_0x43e44f){while(--_0x43e44f){_0x4c4396['push'](_0x4c4396['shift']());}};_0x394c38(++_0x2f6841);}(_0x38ac,0x1e1));var _0xc38a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x38ac[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xc38a('0x0'));var moment=require(_0xc38a('0x1'));var BPromise=require(_0xc38a('0x2'));var rs=require(_0xc38a('0x3'));var fs=require('fs');var Redis=require(_0xc38a('0x4'));var db=require(_0xc38a('0x5'))['db'];var utils=require(_0xc38a('0x6'));var logger=require(_0xc38a('0x7'))(_0xc38a('0x8'));var config=require('../../config/environment');var jayson=require(_0xc38a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40df51,_0x40454f,_0x2ba4bf){return new BPromise(function(_0x563330,_0x53782d){return client['request'](_0x40df51,_0x2ba4bf)[_0xc38a('0xa')](function(_0x108992){logger[_0xc38a('0xb')]('Template,\x20%s,\x20%s',_0x40454f,'request\x20sent');logger[_0xc38a('0xc')](_0xc38a('0xd'),_0x40454f,_0xc38a('0xe'),JSON['stringify'](_0x108992));if(_0x108992['error']){if(_0x108992[_0xc38a('0xf')][_0xc38a('0x10')]===0x1f4){logger['error'](_0xc38a('0x11'),_0x40454f,_0x108992[_0xc38a('0xf')][_0xc38a('0x12')]);return _0x53782d(_0x108992[_0xc38a('0xf')][_0xc38a('0x12')]);}logger[_0xc38a('0xf')](_0xc38a('0x11'),_0x40454f,_0x108992[_0xc38a('0xf')][_0xc38a('0x12')]);return _0x563330(_0x108992['error'][_0xc38a('0x12')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x40454f,_0xc38a('0xe'));_0x563330(_0x108992[_0xc38a('0x13')][_0xc38a('0x12')]);}})['catch'](function(_0x25ebcf){logger[_0xc38a('0xf')](_0xc38a('0x11'),_0x40454f,_0x25ebcf);_0x53782d(_0x25ebcf);});});}exports[_0xc38a('0x14')]=function(_0x2ad4d2){var _0x4e2984=this;return new Promise(function(_0x3bd221,_0x183877){return db[_0xc38a('0x15')]['findAll']({'raw':_0x2ad4d2['options']?_0x2ad4d2[_0xc38a('0x16')][_0xc38a('0x17')]===undefined?!![]:![]:!![],'where':_0x2ad4d2[_0xc38a('0x16')]?_0x2ad4d2['options'][_0xc38a('0x18')]||null:null,'attributes':_0x2ad4d2[_0xc38a('0x16')]?_0x2ad4d2['options']['attributes']||null:null,'limit':_0x2ad4d2[_0xc38a('0x16')]?_0x2ad4d2[_0xc38a('0x16')][_0xc38a('0x19')]||null:null,'include':_0x2ad4d2[_0xc38a('0x16')]?_0x2ad4d2[_0xc38a('0x16')]['include']?_[_0xc38a('0x1a')](_0x2ad4d2[_0xc38a('0x16')][_0xc38a('0x1b')],function(_0x208ef1){return{'model':db[_0x208ef1[_0xc38a('0x1c')]],'as':_0x208ef1['as'],'attributes':_0x208ef1[_0xc38a('0x1d')],'include':_0x208ef1[_0xc38a('0x1b')]?_[_0xc38a('0x1a')](_0x208ef1[_0xc38a('0x1b')],function(_0x354776){return{'model':db[_0x354776['model']],'as':_0x354776['as'],'attributes':_0x354776[_0xc38a('0x1d')],'include':_0x354776[_0xc38a('0x1b')]?_['map'](_0x354776[_0xc38a('0x1b')],function(_0x2aca0d){return{'model':db[_0x2aca0d[_0xc38a('0x1c')]],'as':_0x2aca0d['as'],'attributes':_0x2aca0d[_0xc38a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc38a('0xa')](function(_0x494c81){logger['info'](_0xc38a('0x14'),_0x2ad4d2);logger['debug'](_0xc38a('0x14'),_0x2ad4d2,JSON[_0xc38a('0x1e')](_0x494c81));_0x3bd221(_0x494c81);})[_0xc38a('0x1f')](function(_0x44357e){logger[_0xc38a('0xf')](_0xc38a('0x14'),_0x44357e[_0xc38a('0x12')],_0x2ad4d2);_0x183877(_0x4e2984['error'](0x1f4,_0x44357e[_0xc38a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 26ed06d..25656c8 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 _0x607e=['get','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','isAuthenticated','index'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x607e,0x1e1));var _0xe607=function(_0x343b0a,_0x586263){_0x343b0a=_0x343b0a-0x0;var _0x3d8ff8=_0x607e[_0x343b0a];return _0x3d8ff8;};'use strict';var multer=require(_0xe607('0x0'));var util=require(_0xe607('0x1'));var path=require(_0xe607('0x2'));var timeout=require(_0xe607('0x3'));var express=require(_0xe607('0x4'));var router=express[_0xe607('0x5')]();var fs_extra=require(_0xe607('0x6'));var auth=require(_0xe607('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe607('0x8'));var controller=require(_0xe607('0x9'));router['get']('/',auth[_0xe607('0xa')](),controller[_0xe607('0xb')]);router[_0xe607('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xe607('0xd')]);router[_0xe607('0xc')](_0xe607('0xe'),auth[_0xe607('0xa')](),controller[_0xe607('0xf')]);router[_0xe607('0xc')](_0xe607('0x10'),auth[_0xe607('0xa')](),controller[_0xe607('0x11')]);router[_0xe607('0xc')](_0xe607('0x12'),auth[_0xe607('0xa')](),controller['getActions']);router[_0xe607('0x13')]('/',auth[_0xe607('0xa')](),controller[_0xe607('0x14')]);router[_0xe607('0x13')]('/:id/all_conditions',auth[_0xe607('0xa')](),controller[_0xe607('0x15')]);router['post'](_0xe607('0x10'),auth['isAuthenticated'](),controller[_0xe607('0x16')]);router[_0xe607('0x13')](_0xe607('0x12'),auth[_0xe607('0xa')](),controller[_0xe607('0x17')]);router[_0xe607('0x18')](_0xe607('0x19'),auth[_0xe607('0xa')](),controller[_0xe607('0x1a')]);router[_0xe607('0x1b')](_0xe607('0x19'),auth[_0xe607('0xa')](),controller[_0xe607('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xd39b=['addAction','put','delete','/:id','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAnyCondition'];(function(_0x4489f2,_0x1f9128){var _0x5cc527=function(_0x44201f){while(--_0x44201f){_0x4489f2['push'](_0x4489f2['shift']());}};_0x5cc527(++_0x1f9128);}(_0xd39b,0x1ad));var _0xbd39=function(_0x3c2519,_0x24e702){_0x3c2519=_0x3c2519-0x0;var _0x3c8ca3=_0xd39b[_0x3c2519];return _0x3c8ca3;};'use strict';var multer=require('multer');var util=require(_0xbd39('0x0'));var path=require(_0xbd39('0x1'));var timeout=require(_0xbd39('0x2'));var express=require(_0xbd39('0x3'));var router=express[_0xbd39('0x4')]();var fs_extra=require(_0xbd39('0x5'));var auth=require(_0xbd39('0x6'));var interaction=require(_0xbd39('0x7'));var config=require('../../config/environment');var controller=require(_0xbd39('0x8'));router[_0xbd39('0x9')]('/',auth[_0xbd39('0xa')](),controller[_0xbd39('0xb')]);router['get']('/:id',auth[_0xbd39('0xa')](),controller[_0xbd39('0xc')]);router[_0xbd39('0x9')](_0xbd39('0xd'),auth['isAuthenticated'](),controller[_0xbd39('0xe')]);router[_0xbd39('0x9')](_0xbd39('0xf'),auth[_0xbd39('0xa')](),controller['getAnyConditions']);router[_0xbd39('0x9')](_0xbd39('0x10'),auth['isAuthenticated'](),controller[_0xbd39('0x11')]);router[_0xbd39('0x12')]('/',auth[_0xbd39('0xa')](),controller[_0xbd39('0x13')]);router['post']('/:id/all_conditions',auth[_0xbd39('0xa')](),controller['addAllCondition']);router['post'](_0xbd39('0xf'),auth['isAuthenticated'](),controller[_0xbd39('0x14')]);router[_0xbd39('0x12')]('/:id/actions',auth[_0xbd39('0xa')](),controller[_0xbd39('0x15')]);router[_0xbd39('0x16')]('/:id',auth[_0xbd39('0xa')](),controller['update']);router[_0xbd39('0x17')](_0xbd39('0x18'),auth[_0xbd39('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 7375c99..738e8cc 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 _0x1305=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0x1305,0x107));var _0x5130=function(_0x2696f7,_0x4ba5f6){_0x2696f7=_0x2696f7-0x0;var _0x439507=_0x1305[_0x2696f7];return _0x439507;};'use strict';var Sequelize=require(_0x5130('0x0'));module[_0x5130('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5130('0x2')]},'status':{'type':Sequelize[_0x5130('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x98f3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x51f644,_0x5bf98e){var _0x3b6c47=function(_0x5a182f){while(--_0x5a182f){_0x51f644['push'](_0x51f644['shift']());}};_0x3b6c47(++_0x5bf98e);}(_0x98f3,0x12c));var _0x398f=function(_0x12f036,_0x27e401){_0x12f036=_0x12f036-0x0;var _0xf0be1b=_0x98f3[_0x12f036];return _0xf0be1b;};'use strict';var Sequelize=require(_0x398f('0x0'));module[_0x398f('0x1')]={'name':{'type':Sequelize[_0x398f('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x398f('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 314f0ac..ab2ebbc 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 _0x4c5e=['path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','get','Triggers','UserProfileResource','destroy','error','name','send','render','merge','contact','agent','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','length','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','nolimit','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5de67c,_0x22c425){var _0x3cceab=function(_0x59a358){while(--_0x59a358){_0x5de67c['push'](_0x5de67c['shift']());}};_0x3cceab(++_0x22c425);}(_0x4c5e,0x11b));var _0xe4c5=function(_0x55ec8f,_0x133f1a){_0x55ec8f=_0x55ec8f-0x0;var _0x3728e4=_0x4c5e[_0x55ec8f];return _0x3728e4;};'use strict';var emlformat=require(_0xe4c5('0x0'));var rimraf=require(_0xe4c5('0x1'));var zipdir=require(_0xe4c5('0x2'));var jsonpatch=require(_0xe4c5('0x3'));var rp=require(_0xe4c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe4c5('0x5'));var sox=require(_0xe4c5('0x6'));var csv=require(_0xe4c5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4c5('0x8'));var squel=require(_0xe4c5('0x9'));var crypto=require(_0xe4c5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe4c5('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe4c5('0xc'));var Papa=require(_0xe4c5('0xd'));var Redis=require('ioredis');var authService=require(_0xe4c5('0xe'));var qs=require(_0xe4c5('0xf'));var as=require(_0xe4c5('0x10'));var hardwareService=require(_0xe4c5('0x11'));var logger=require(_0xe4c5('0x12'))('api');var utils=require(_0xe4c5('0x13'));var config=require(_0xe4c5('0x14'));var licenseUtil=require(_0xe4c5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358c0a,_0x48d8a8){_0x48d8a8=_0x48d8a8||0xcc;return function(_0x5ca0e2){if(_0x5ca0e2){return _0x358c0a[_0xe4c5('0x16')](_0x48d8a8);}return _0x358c0a[_0xe4c5('0x17')](_0x48d8a8)[_0xe4c5('0x18')]();};}function respondWithResult(_0x44bad4,_0x5edb13){_0x5edb13=_0x5edb13||0xc8;return function(_0x39851e){if(_0x39851e){return _0x44bad4[_0xe4c5('0x17')](_0x5edb13)[_0xe4c5('0x19')](_0x39851e);}};}function respondWithFilteredResult(_0x499f24,_0x572b42){return function(_0x5b2a1c){if(_0x5b2a1c){var _0x42e3c1=typeof _0x572b42['offset']===_0xe4c5('0x1a')&&typeof _0x572b42[_0xe4c5('0x1b')]===_0xe4c5('0x1a');var _0x30aa2c=_0x5b2a1c[_0xe4c5('0x1c')];var _0x4a7ca1=_0x42e3c1?0x0:_0x572b42[_0xe4c5('0x1d')];var _0x2b91ba=_0x42e3c1?_0x5b2a1c[_0xe4c5('0x1c')]:_0x572b42['offset']+_0x572b42['limit'];var _0x3f5fb1;if(_0x2b91ba>=_0x30aa2c){_0x2b91ba=_0x30aa2c;_0x3f5fb1=0xc8;}else{_0x3f5fb1=0xce;}_0x499f24[_0xe4c5('0x17')](_0x3f5fb1);return _0x499f24[_0xe4c5('0x1e')](_0xe4c5('0x1f'),_0x4a7ca1+'-'+_0x2b91ba+'/'+_0x30aa2c)[_0xe4c5('0x19')](_0x5b2a1c);}return null;};}function patchUpdates(_0x18f918){return function(_0x21cf1b){try{jsonpatch[_0xe4c5('0x20')](_0x21cf1b,_0x18f918,!![]);}catch(_0x8dd89){return BPromise[_0xe4c5('0x21')](_0x8dd89);}return _0x21cf1b['save']();};}function saveUpdates(_0x1ea7c3,_0x4f9f77){return function(_0x49be9c){if(_0x49be9c){return _0x49be9c[_0xe4c5('0x22')](_0x1ea7c3)[_0xe4c5('0x23')](function(_0x53cf25){return _0x53cf25;});}return null;};}function removeEntity(_0x276f9a,_0xf148bb){return function(_0x46b582){if(_0x46b582){return _0x46b582['destroy']()[_0xe4c5('0x23')](function(){var _0x1906b5=_0x46b582[_0xe4c5('0x24')]({'plain':!![]});var _0x42ebb5=_0xe4c5('0x25');return db[_0xe4c5('0x26')][_0xe4c5('0x27')]({'where':{'type':_0x42ebb5,'resourceId':_0x1906b5['id']}})[_0xe4c5('0x23')](function(){return _0x46b582;});})[_0xe4c5('0x23')](function(){_0x276f9a[_0xe4c5('0x17')](0xcc)[_0xe4c5('0x18')]();});}};}function handleEntityNotFound(_0x256580,_0x2b5d28){return function(_0x3fac72){if(!_0x3fac72){_0x256580['sendStatus'](0x194);}return _0x3fac72;};}function handleError(_0x2708f7,_0x1e8cf1){_0x1e8cf1=_0x1e8cf1||0x1f4;return function(_0x138346){logger[_0xe4c5('0x28')](_0x138346['stack']);if(_0x138346[_0xe4c5('0x29')]){delete _0x138346[_0xe4c5('0x29')];}_0x2708f7[_0xe4c5('0x17')](_0x1e8cf1)[_0xe4c5('0x2a')](_0x138346);};}function getMustacheRender(_0x5d21f5,_0x4c248b){return Mustache[_0xe4c5('0x2b')](_0x5d21f5,_[_0xe4c5('0x2c')](_0x4c248b['body'],{'contact':_0x4c248b[_0xe4c5('0x2d')],'message':_0x4c248b['message'],'agent':_0x4c248b[_0xe4c5('0x2e')],'interaction':_0x4c248b['interaction'],'account':_0x4c248b['account']}))||'';}exports['index']=function(_0x454fb7,_0x153319){var _0x557bf9={},_0x3d661f={},_0x237767={'count':0x0,'rows':[]};var _0xe19d7c=_[_0xe4c5('0x2f')](db[_0xe4c5('0x30')][_0xe4c5('0x31')],function(_0x4158cc){return{'name':_0x4158cc[_0xe4c5('0x32')],'type':_0x4158cc[_0xe4c5('0x33')][_0xe4c5('0x34')]};});_0x3d661f[_0xe4c5('0x35')]=_[_0xe4c5('0x2f')](_0xe19d7c,_0xe4c5('0x29'));_0x3d661f[_0xe4c5('0x36')]=_[_0xe4c5('0x37')](_0x454fb7[_0xe4c5('0x36')]);_0x3d661f[_0xe4c5('0x38')]=_[_0xe4c5('0x39')](_0x3d661f['model'],_0x3d661f[_0xe4c5('0x36')]);_0x557bf9[_0xe4c5('0x3a')]=_['intersection'](_0x3d661f[_0xe4c5('0x35')],qs[_0xe4c5('0x3b')](_0x454fb7[_0xe4c5('0x36')][_0xe4c5('0x3b')]));_0x557bf9['attributes']=_0x557bf9[_0xe4c5('0x3a')]['length']?_0x557bf9[_0xe4c5('0x3a')]:_0x3d661f[_0xe4c5('0x35')];if(!_0x454fb7[_0xe4c5('0x36')][_0xe4c5('0x3c')]('nolimit')){_0x557bf9[_0xe4c5('0x1b')]=qs['limit'](_0x454fb7[_0xe4c5('0x36')]['limit']);_0x557bf9[_0xe4c5('0x1d')]=qs['offset'](_0x454fb7[_0xe4c5('0x36')][_0xe4c5('0x1d')]);}_0x557bf9[_0xe4c5('0x3d')]=qs[_0xe4c5('0x3e')](_0x454fb7[_0xe4c5('0x36')]['sort']);_0x557bf9[_0xe4c5('0x3f')]=qs[_0xe4c5('0x38')](_[_0xe4c5('0x40')](_0x454fb7[_0xe4c5('0x36')],_0x3d661f[_0xe4c5('0x38')]),_0xe19d7c);if(_0x454fb7[_0xe4c5('0x36')][_0xe4c5('0x41')]){_0x557bf9[_0xe4c5('0x3f')]=_[_0xe4c5('0x2c')](_0x557bf9['where'],{'$or':_[_0xe4c5('0x2f')](_0xe19d7c,function(_0x4854e1){if(_0x4854e1[_0xe4c5('0x33')]!==_0xe4c5('0x42')){var _0x485316={};_0x485316[_0x4854e1[_0xe4c5('0x29')]]={'$like':'%'+_0x454fb7[_0xe4c5('0x36')]['filter']+'%'};return _0x485316;}})});}_0x557bf9=_[_0xe4c5('0x2c')]({},_0x557bf9,_0x454fb7[_0xe4c5('0x43')]);var _0x1e880d={'where':_0x557bf9[_0xe4c5('0x3f')]};return db['Trigger'][_0xe4c5('0x1c')](_0x1e880d)[_0xe4c5('0x23')](function(_0x125a73){_0x237767['count']=_0x125a73;if(_0x454fb7[_0xe4c5('0x36')][_0xe4c5('0x44')]){_0x557bf9[_0xe4c5('0x45')]=[{'all':!![]}];}return db[_0xe4c5('0x30')][_0xe4c5('0x46')](_0x557bf9);})[_0xe4c5('0x23')](function(_0x4a093b){_0x237767['rows']=_0x4a093b;return _0x237767;})[_0xe4c5('0x23')](respondWithFilteredResult(_0x153319,_0x557bf9))['catch'](handleError(_0x153319,null));};exports[_0xe4c5('0x47')]=function(_0x2ead08,_0x3c5403){var _0x2d9b45={'raw':![],'where':{'id':_0x2ead08['params']['id']}},_0x4f98e4={};_0x4f98e4[_0xe4c5('0x35')]=_[_0xe4c5('0x37')](db['Trigger'][_0xe4c5('0x31')]);_0x4f98e4[_0xe4c5('0x36')]=_[_0xe4c5('0x37')](_0x2ead08['query']);_0x4f98e4[_0xe4c5('0x38')]=_[_0xe4c5('0x39')](_0x4f98e4[_0xe4c5('0x35')],_0x4f98e4[_0xe4c5('0x36')]);_0x2d9b45[_0xe4c5('0x3a')]=_[_0xe4c5('0x39')](_0x4f98e4[_0xe4c5('0x35')],qs['fields'](_0x2ead08['query']['fields']));_0x2d9b45['attributes']=_0x2d9b45[_0xe4c5('0x3a')][_0xe4c5('0x48')]?_0x2d9b45[_0xe4c5('0x3a')]:_0x4f98e4[_0xe4c5('0x35')];if(_0x2ead08[_0xe4c5('0x36')][_0xe4c5('0x44')]){_0x2d9b45['include']=[{'all':!![]}];}_0x2d9b45=_[_0xe4c5('0x2c')]({},_0x2d9b45,_0x2ead08[_0xe4c5('0x43')]);return db[_0xe4c5('0x30')]['find'](_0x2d9b45)[_0xe4c5('0x23')](handleEntityNotFound(_0x3c5403,null))['then'](respondWithResult(_0x3c5403,null))[_0xe4c5('0x49')](handleError(_0x3c5403,null));};exports['create']=function(_0x3a71e7,_0x1bf1b9){return db[_0xe4c5('0x30')][_0xe4c5('0x4a')](_0x3a71e7['body'],{})[_0xe4c5('0x23')](function(_0x4995a0){var _0x5b6038=_0x3a71e7['user'][_0xe4c5('0x24')]({'plain':!![]});if(!_0x5b6038)throw new Error(_0xe4c5('0x4b'));if(_0x5b6038[_0xe4c5('0x4c')]===_0xe4c5('0x4d')){var _0x53b9db=_0x4995a0[_0xe4c5('0x24')]({'plain':!![]});var _0x235780=_0xe4c5('0x25');return db[_0xe4c5('0x4e')][_0xe4c5('0x4f')]({'where':{'name':_0x235780,'userProfileId':_0x5b6038[_0xe4c5('0x50')]},'raw':!![]})[_0xe4c5('0x23')](function(_0x1875e4){if(_0x1875e4&&_0x1875e4['autoAssociation']===0x0){return db['UserProfileResource'][_0xe4c5('0x4a')]({'name':_0x53b9db[_0xe4c5('0x29')],'resourceId':_0x53b9db['id'],'type':_0x1875e4[_0xe4c5('0x29')],'sectionId':_0x1875e4['id']},{})[_0xe4c5('0x23')](function(){return _0x4995a0;});}else{return _0x4995a0;}})[_0xe4c5('0x49')](function(_0x544131){logger[_0xe4c5('0x28')](_0xe4c5('0x51'),_0x544131);throw _0x544131;});}return _0x4995a0;})[_0xe4c5('0x23')](respondWithResult(_0x1bf1b9,0xc9))[_0xe4c5('0x49')](handleError(_0x1bf1b9,null));};exports[_0xe4c5('0x22')]=function(_0x49caa1,_0x28dcca){if(_0x49caa1['body']['id']){delete _0x49caa1[_0xe4c5('0x52')]['id'];}return db[_0xe4c5('0x30')][_0xe4c5('0x4f')]({'where':{'id':_0x49caa1[_0xe4c5('0x53')]['id']}})[_0xe4c5('0x23')](handleEntityNotFound(_0x28dcca,null))[_0xe4c5('0x23')](saveUpdates(_0x49caa1[_0xe4c5('0x52')],null))[_0xe4c5('0x23')](respondWithResult(_0x28dcca,null))[_0xe4c5('0x49')](handleError(_0x28dcca,null));};exports[_0xe4c5('0x27')]=function(_0x5d0224,_0x15ff92){return db[_0xe4c5('0x30')][_0xe4c5('0x4f')]({'where':{'id':_0x5d0224[_0xe4c5('0x53')]['id']}})['then'](handleEntityNotFound(_0x15ff92,null))['then'](removeEntity(_0x15ff92,null))[_0xe4c5('0x49')](handleError(_0x15ff92,null));};exports[_0xe4c5('0x54')]=function(_0xf9443d,_0x39ee45,_0x24d26c){if(_0xf9443d[_0xe4c5('0x52')]['id']){delete _0xf9443d[_0xe4c5('0x52')]['id'];}return db[_0xe4c5('0x30')]['find']({'where':{'id':_0xf9443d[_0xe4c5('0x53')]['id']}})[_0xe4c5('0x23')](handleEntityNotFound(_0x39ee45,null))[_0xe4c5('0x23')](function(_0x487679){if(_0x487679){_0xf9443d['body'][_0xe4c5('0x55')]=_0x487679['id'];return db[_0xe4c5('0x56')]['create'](_0xf9443d[_0xe4c5('0x52')]);}})[_0xe4c5('0x23')](respondWithResult(_0x39ee45,null))[_0xe4c5('0x49')](handleError(_0x39ee45,null));};exports[_0xe4c5('0x57')]=function(_0x1e1851,_0x115423,_0x534ac1){if(_0x1e1851[_0xe4c5('0x52')]['id']){delete _0x1e1851[_0xe4c5('0x52')]['id'];}return db['Trigger']['find']({'where':{'id':_0x1e1851[_0xe4c5('0x53')]['id']}})[_0xe4c5('0x23')](handleEntityNotFound(_0x115423,null))['then'](function(_0x4ac35d){if(_0x4ac35d){_0x1e1851[_0xe4c5('0x52')]['TriggerAnyId']=_0x4ac35d['id'];return db[_0xe4c5('0x56')][_0xe4c5('0x4a')](_0x1e1851['body']);}})[_0xe4c5('0x23')](respondWithResult(_0x115423,null))[_0xe4c5('0x49')](handleError(_0x115423,null));};exports[_0xe4c5('0x58')]=function(_0x4eccb6,_0x3a26e7,_0x2fb4cd){var _0x4d1868={};var _0x41549b={};var _0x5b49b4;var _0x467526;return db['Trigger'][_0xe4c5('0x59')]({'where':{'id':_0x4eccb6[_0xe4c5('0x53')]['id']}})['then'](handleEntityNotFound(_0x3a26e7,null))[_0xe4c5('0x23')](function(_0x3d12a4){if(_0x3d12a4){_0x5b49b4=_0x3d12a4;_0x41549b[_0xe4c5('0x35')]=_[_0xe4c5('0x37')](db[_0xe4c5('0x56')]['rawAttributes']);_0x41549b[_0xe4c5('0x36')]=_['keys'](_0x4eccb6[_0xe4c5('0x36')]);_0x41549b[_0xe4c5('0x38')]=_[_0xe4c5('0x39')](_0x41549b[_0xe4c5('0x35')],_0x41549b[_0xe4c5('0x36')]);_0x4d1868[_0xe4c5('0x3a')]=_['intersection'](_0x41549b[_0xe4c5('0x35')],qs[_0xe4c5('0x3b')](_0x4eccb6['query'][_0xe4c5('0x3b')]));_0x4d1868[_0xe4c5('0x3a')]=_0x4d1868[_0xe4c5('0x3a')][_0xe4c5('0x48')]?_0x4d1868[_0xe4c5('0x3a')]:_0x41549b[_0xe4c5('0x35')];_0x4d1868[_0xe4c5('0x3d')]=qs[_0xe4c5('0x3e')](_0x4eccb6[_0xe4c5('0x36')][_0xe4c5('0x3e')]);_0x4d1868[_0xe4c5('0x3f')]=qs[_0xe4c5('0x38')](_[_0xe4c5('0x40')](_0x4eccb6[_0xe4c5('0x36')],_0x41549b['filters']));if(_0x4eccb6[_0xe4c5('0x36')][_0xe4c5('0x41')]){_0x4d1868[_0xe4c5('0x3f')]=_[_0xe4c5('0x2c')](_0x4d1868[_0xe4c5('0x3f')],{'$or':_[_0xe4c5('0x2f')](_0x4d1868[_0xe4c5('0x3a')],function(_0x34a784){var _0x18f83e={};_0x18f83e[_0x34a784]={'$like':'%'+_0x4eccb6[_0xe4c5('0x36')]['filter']+'%'};return _0x18f83e;})});}_0x4d1868=_['merge']({},_0x4d1868,_0x4eccb6[_0xe4c5('0x43')]);return _0x5b49b4[_0xe4c5('0x58')](_0x4d1868);}})[_0xe4c5('0x23')](function(_0x537ce0){if(_0x537ce0){_0x467526=_0x537ce0[_0xe4c5('0x48')];if(!_0x4eccb6[_0xe4c5('0x36')][_0xe4c5('0x3c')]('nolimit')){_0x4d1868[_0xe4c5('0x1b')]=qs['limit'](_0x4eccb6[_0xe4c5('0x36')][_0xe4c5('0x1b')]);_0x4d1868[_0xe4c5('0x1d')]=qs['offset'](_0x4eccb6['query'][_0xe4c5('0x1d')]);}return _0x5b49b4[_0xe4c5('0x58')](_0x4d1868);}})[_0xe4c5('0x23')](function(_0x584f13){if(_0x584f13){return _0x584f13?{'count':_0x467526,'rows':_0x584f13}:null;}})[_0xe4c5('0x23')](respondWithResult(_0x3a26e7,null))[_0xe4c5('0x49')](handleError(_0x3a26e7,null));};exports[_0xe4c5('0x5a')]=function(_0x49410e,_0x518aeb,_0xe6aca8){var _0x2c6cea={};var _0x503032={};var _0x2e86c4;var _0xfc8cde;return db[_0xe4c5('0x30')][_0xe4c5('0x59')]({'where':{'id':_0x49410e['params']['id']}})[_0xe4c5('0x23')](handleEntityNotFound(_0x518aeb,null))[_0xe4c5('0x23')](function(_0x575348){if(_0x575348){_0x2e86c4=_0x575348;_0x503032['model']=_[_0xe4c5('0x37')](db[_0xe4c5('0x56')][_0xe4c5('0x31')]);_0x503032[_0xe4c5('0x36')]=_[_0xe4c5('0x37')](_0x49410e[_0xe4c5('0x36')]);_0x503032[_0xe4c5('0x38')]=_[_0xe4c5('0x39')](_0x503032[_0xe4c5('0x35')],_0x503032[_0xe4c5('0x36')]);_0x2c6cea['attributes']=_[_0xe4c5('0x39')](_0x503032[_0xe4c5('0x35')],qs[_0xe4c5('0x3b')](_0x49410e[_0xe4c5('0x36')]['fields']));_0x2c6cea[_0xe4c5('0x3a')]=_0x2c6cea['attributes'][_0xe4c5('0x48')]?_0x2c6cea[_0xe4c5('0x3a')]:_0x503032[_0xe4c5('0x35')];_0x2c6cea[_0xe4c5('0x3d')]=qs[_0xe4c5('0x3e')](_0x49410e['query']['sort']);_0x2c6cea[_0xe4c5('0x3f')]=qs[_0xe4c5('0x38')](_['pick'](_0x49410e['query'],_0x503032[_0xe4c5('0x38')]));if(_0x49410e[_0xe4c5('0x36')][_0xe4c5('0x41')]){_0x2c6cea['where']=_[_0xe4c5('0x2c')](_0x2c6cea['where'],{'$or':_['map'](_0x2c6cea['attributes'],function(_0x14c6e0){var _0x1db130={};_0x1db130[_0x14c6e0]={'$like':'%'+_0x49410e[_0xe4c5('0x36')][_0xe4c5('0x41')]+'%'};return _0x1db130;})});}_0x2c6cea=_['merge']({},_0x2c6cea,_0x49410e['options']);return _0x2e86c4[_0xe4c5('0x5a')](_0x2c6cea);}})[_0xe4c5('0x23')](function(_0x4e10d4){if(_0x4e10d4){_0xfc8cde=_0x4e10d4[_0xe4c5('0x48')];if(!_0x49410e['query']['hasOwnProperty'](_0xe4c5('0x5b'))){_0x2c6cea['limit']=qs[_0xe4c5('0x1b')](_0x49410e[_0xe4c5('0x36')][_0xe4c5('0x1b')]);_0x2c6cea[_0xe4c5('0x1d')]=qs['offset'](_0x49410e[_0xe4c5('0x36')][_0xe4c5('0x1d')]);}return _0x2e86c4['getAnyConditions'](_0x2c6cea);}})['then'](function(_0x44658e){if(_0x44658e){return _0x44658e?{'count':_0xfc8cde,'rows':_0x44658e}:null;}})[_0xe4c5('0x23')](respondWithResult(_0x518aeb,null))[_0xe4c5('0x49')](handleError(_0x518aeb,null));};exports[_0xe4c5('0x5c')]=function(_0x25c75a,_0x59bcd0,_0x53fee2){if(_0x25c75a[_0xe4c5('0x52')]['id']){delete _0x25c75a['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x25c75a[_0xe4c5('0x53')]['id']}})[_0xe4c5('0x23')](handleEntityNotFound(_0x59bcd0,null))[_0xe4c5('0x23')](function(_0x4f837f){if(_0x4f837f){_0x25c75a[_0xe4c5('0x52')][_0xe4c5('0x5d')]=_0x4f837f['id'];return db['Action']['create'](_0x25c75a[_0xe4c5('0x52')]);}})[_0xe4c5('0x23')](respondWithResult(_0x59bcd0,null))[_0xe4c5('0x49')](handleError(_0x59bcd0,null));};exports[_0xe4c5('0x5e')]=function(_0xdcb1a7,_0x367a3d,_0x363113){var _0x388f77={};var _0x723e8d={};var _0x156c18;var _0x22127a;return db[_0xe4c5('0x30')][_0xe4c5('0x59')]({'where':{'id':_0xdcb1a7[_0xe4c5('0x53')]['id']}})[_0xe4c5('0x23')](handleEntityNotFound(_0x367a3d,null))[_0xe4c5('0x23')](function(_0x11e9bf){if(_0x11e9bf){_0x156c18=_0x11e9bf;_0x723e8d[_0xe4c5('0x35')]=_['keys'](db[_0xe4c5('0x5f')][_0xe4c5('0x31')]);_0x723e8d[_0xe4c5('0x36')]=_[_0xe4c5('0x37')](_0xdcb1a7[_0xe4c5('0x36')]);_0x723e8d['filters']=_[_0xe4c5('0x39')](_0x723e8d[_0xe4c5('0x35')],_0x723e8d[_0xe4c5('0x36')]);_0x388f77[_0xe4c5('0x3a')]=_[_0xe4c5('0x39')](_0x723e8d[_0xe4c5('0x35')],qs[_0xe4c5('0x3b')](_0xdcb1a7[_0xe4c5('0x36')][_0xe4c5('0x3b')]));_0x388f77[_0xe4c5('0x3a')]=_0x388f77['attributes'][_0xe4c5('0x48')]?_0x388f77[_0xe4c5('0x3a')]:_0x723e8d[_0xe4c5('0x35')];_0x388f77[_0xe4c5('0x3d')]=qs[_0xe4c5('0x3e')](_0xdcb1a7[_0xe4c5('0x36')][_0xe4c5('0x3e')]);_0x388f77[_0xe4c5('0x3f')]=qs[_0xe4c5('0x38')](_[_0xe4c5('0x40')](_0xdcb1a7[_0xe4c5('0x36')],_0x723e8d[_0xe4c5('0x38')]));if(_0xdcb1a7[_0xe4c5('0x36')]['filter']){_0x388f77[_0xe4c5('0x3f')]=_[_0xe4c5('0x2c')](_0x388f77[_0xe4c5('0x3f')],{'$or':_[_0xe4c5('0x2f')](_0x388f77['attributes'],function(_0x31dfed){var _0x40d839={};_0x40d839[_0x31dfed]={'$like':'%'+_0xdcb1a7[_0xe4c5('0x36')][_0xe4c5('0x41')]+'%'};return _0x40d839;})});}_0x388f77=_[_0xe4c5('0x2c')]({},_0x388f77,_0xdcb1a7[_0xe4c5('0x43')]);return _0x156c18[_0xe4c5('0x5e')](_0x388f77);}})[_0xe4c5('0x23')](function(_0x36baa4){if(_0x36baa4){_0x22127a=_0x36baa4[_0xe4c5('0x48')];if(!_0xdcb1a7['query'][_0xe4c5('0x3c')](_0xe4c5('0x5b'))){_0x388f77[_0xe4c5('0x1b')]=qs[_0xe4c5('0x1b')](_0xdcb1a7[_0xe4c5('0x36')][_0xe4c5('0x1b')]);_0x388f77[_0xe4c5('0x1d')]=qs['offset'](_0xdcb1a7['query']['offset']);}return _0x156c18[_0xe4c5('0x5e')](_0x388f77);}})[_0xe4c5('0x23')](function(_0xd2781d){if(_0xd2781d){return _0xd2781d?{'count':_0x22127a,'rows':_0xd2781d}:null;}})[_0xe4c5('0x23')](respondWithResult(_0x367a3d,null))[_0xe4c5('0x49')](handleError(_0x367a3d,null));}; \ No newline at end of file +var _0x4510=['TriggerAnyId','getAllConditions','nolimit','getAnyConditions','TriggerId','findOne','Action','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','end','status','limit','undefined','offset','count','set','Content-Range','json','reject','save','update','then','get','Triggers','UserProfileResource','destroy','stack','render','merge','body','contact','message','agent','account','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','name','filter','options','includeAll','include','findAll','rows','catch','show','params','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','Condition'];(function(_0x4a9a1a,_0x47db07){var _0x14e8af=function(_0x385e41){while(--_0x385e41){_0x4a9a1a['push'](_0x4a9a1a['shift']());}};_0x14e8af(++_0x47db07);}(_0x4510,0x11b));var _0x0451=function(_0xa24605,_0x49cfdd){_0xa24605=_0xa24605-0x0;var _0x13f63d=_0x4510[_0xa24605];return _0x13f63d;};'use strict';var emlformat=require(_0x0451('0x0'));var rimraf=require(_0x0451('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0451('0x2'));var BPromise=require(_0x0451('0x3'));var Mustache=require(_0x0451('0x4'));var util=require(_0x0451('0x5'));var path=require(_0x0451('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0451('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0451('0x8'));var squel=require(_0x0451('0x9'));var crypto=require(_0x0451('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0451('0xb'));var toCsv=require(_0x0451('0xc'));var querystring=require(_0x0451('0xd'));var Papa=require('papaparse');var Redis=require(_0x0451('0xe'));var authService=require(_0x0451('0xf'));var qs=require(_0x0451('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0451('0x11'));var utils=require(_0x0451('0x12'));var config=require(_0x0451('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0451('0x14'))['db'];function respondWithStatusCode(_0x440df3,_0x5f2089){_0x5f2089=_0x5f2089||0xcc;return function(_0x385ceb){if(_0x385ceb){return _0x440df3['sendStatus'](_0x5f2089);}return _0x440df3['status'](_0x5f2089)[_0x0451('0x15')]();};}function respondWithResult(_0x5efb1e,_0x4b97ad){_0x4b97ad=_0x4b97ad||0xc8;return function(_0x1ae997){if(_0x1ae997){return _0x5efb1e[_0x0451('0x16')](_0x4b97ad)['json'](_0x1ae997);}};}function respondWithFilteredResult(_0x2ddc65,_0x176e4e){return function(_0x4c241b){if(_0x4c241b){var _0x2e9612=typeof _0x176e4e['offset']==='undefined'&&typeof _0x176e4e[_0x0451('0x17')]===_0x0451('0x18');var _0x36db4a=_0x4c241b['count'];var _0x6acaf2=_0x2e9612?0x0:_0x176e4e[_0x0451('0x19')];var _0x27bd55=_0x2e9612?_0x4c241b[_0x0451('0x1a')]:_0x176e4e[_0x0451('0x19')]+_0x176e4e[_0x0451('0x17')];var _0x5a0dbc;if(_0x27bd55>=_0x36db4a){_0x27bd55=_0x36db4a;_0x5a0dbc=0xc8;}else{_0x5a0dbc=0xce;}_0x2ddc65['status'](_0x5a0dbc);return _0x2ddc65[_0x0451('0x1b')](_0x0451('0x1c'),_0x6acaf2+'-'+_0x27bd55+'/'+_0x36db4a)[_0x0451('0x1d')](_0x4c241b);}return null;};}function patchUpdates(_0x52f41f){return function(_0x25351d){try{jsonpatch['apply'](_0x25351d,_0x52f41f,!![]);}catch(_0x522151){return BPromise[_0x0451('0x1e')](_0x522151);}return _0x25351d[_0x0451('0x1f')]();};}function saveUpdates(_0x5d2414,_0x474755){return function(_0x56716c){if(_0x56716c){return _0x56716c[_0x0451('0x20')](_0x5d2414)[_0x0451('0x21')](function(_0x34c76c){return _0x34c76c;});}return null;};}function removeEntity(_0x569ad6,_0x3d48c1){return function(_0x5dd157){if(_0x5dd157){return _0x5dd157['destroy']()[_0x0451('0x21')](function(){var _0x2b4926=_0x5dd157[_0x0451('0x22')]({'plain':!![]});var _0x4cce67=_0x0451('0x23');return db[_0x0451('0x24')][_0x0451('0x25')]({'where':{'type':_0x4cce67,'resourceId':_0x2b4926['id']}})[_0x0451('0x21')](function(){return _0x5dd157;});})[_0x0451('0x21')](function(){_0x569ad6['status'](0xcc)[_0x0451('0x15')]();});}};}function handleEntityNotFound(_0x338394,_0x1ccffd){return function(_0x5bd688){if(!_0x5bd688){_0x338394['sendStatus'](0x194);}return _0x5bd688;};}function handleError(_0x2143de,_0x1715a3){_0x1715a3=_0x1715a3||0x1f4;return function(_0x5ef053){logger['error'](_0x5ef053[_0x0451('0x26')]);if(_0x5ef053['name']){delete _0x5ef053['name'];}_0x2143de[_0x0451('0x16')](_0x1715a3)['send'](_0x5ef053);};}function getMustacheRender(_0x3c09f4,_0x5ece69){return Mustache[_0x0451('0x27')](_0x3c09f4,_[_0x0451('0x28')](_0x5ece69[_0x0451('0x29')],{'contact':_0x5ece69[_0x0451('0x2a')],'message':_0x5ece69[_0x0451('0x2b')],'agent':_0x5ece69[_0x0451('0x2c')],'interaction':_0x5ece69['interaction'],'account':_0x5ece69[_0x0451('0x2d')]}))||'';}exports['index']=function(_0x497d85,_0x21e542){var _0x5c2a1f={},_0x5def0a={},_0x392d76={'count':0x0,'rows':[]};var _0x1c077c=_[_0x0451('0x2e')](db[_0x0451('0x2f')][_0x0451('0x30')],function(_0x488e6b){return{'name':_0x488e6b[_0x0451('0x31')],'type':_0x488e6b[_0x0451('0x32')][_0x0451('0x33')]};});_0x5def0a[_0x0451('0x34')]=_[_0x0451('0x2e')](_0x1c077c,'name');_0x5def0a[_0x0451('0x35')]=_[_0x0451('0x36')](_0x497d85[_0x0451('0x35')]);_0x5def0a[_0x0451('0x37')]=_['intersection'](_0x5def0a[_0x0451('0x34')],_0x5def0a[_0x0451('0x35')]);_0x5c2a1f['attributes']=_[_0x0451('0x38')](_0x5def0a[_0x0451('0x34')],qs[_0x0451('0x39')](_0x497d85[_0x0451('0x35')][_0x0451('0x39')]));_0x5c2a1f['attributes']=_0x5c2a1f[_0x0451('0x3a')][_0x0451('0x3b')]?_0x5c2a1f[_0x0451('0x3a')]:_0x5def0a[_0x0451('0x34')];if(!_0x497d85['query'][_0x0451('0x3c')]('nolimit')){_0x5c2a1f[_0x0451('0x17')]=qs[_0x0451('0x17')](_0x497d85[_0x0451('0x35')][_0x0451('0x17')]);_0x5c2a1f[_0x0451('0x19')]=qs['offset'](_0x497d85[_0x0451('0x35')]['offset']);}_0x5c2a1f[_0x0451('0x3d')]=qs[_0x0451('0x3e')](_0x497d85[_0x0451('0x35')][_0x0451('0x3e')]);_0x5c2a1f[_0x0451('0x3f')]=qs['filters'](_[_0x0451('0x40')](_0x497d85[_0x0451('0x35')],_0x5def0a[_0x0451('0x37')]),_0x1c077c);if(_0x497d85['query']['filter']){_0x5c2a1f[_0x0451('0x3f')]=_[_0x0451('0x28')](_0x5c2a1f[_0x0451('0x3f')],{'$or':_[_0x0451('0x2e')](_0x1c077c,function(_0x13d8af){if(_0x13d8af[_0x0451('0x32')]!=='VIRTUAL'){var _0x427054={};_0x427054[_0x13d8af[_0x0451('0x41')]]={'$like':'%'+_0x497d85['query'][_0x0451('0x42')]+'%'};return _0x427054;}})});}_0x5c2a1f=_[_0x0451('0x28')]({},_0x5c2a1f,_0x497d85[_0x0451('0x43')]);var _0x591ec4={'where':_0x5c2a1f[_0x0451('0x3f')]};return db[_0x0451('0x2f')]['count'](_0x591ec4)[_0x0451('0x21')](function(_0x162ec7){_0x392d76[_0x0451('0x1a')]=_0x162ec7;if(_0x497d85[_0x0451('0x35')][_0x0451('0x44')]){_0x5c2a1f[_0x0451('0x45')]=[{'all':!![]}];}return db[_0x0451('0x2f')][_0x0451('0x46')](_0x5c2a1f);})[_0x0451('0x21')](function(_0x1e3681){_0x392d76[_0x0451('0x47')]=_0x1e3681;return _0x392d76;})[_0x0451('0x21')](respondWithFilteredResult(_0x21e542,_0x5c2a1f))[_0x0451('0x48')](handleError(_0x21e542,null));};exports[_0x0451('0x49')]=function(_0x2b6b5b,_0x39479e){var _0x50050b={'raw':![],'where':{'id':_0x2b6b5b[_0x0451('0x4a')]['id']}},_0x12b2ee={};_0x12b2ee[_0x0451('0x34')]=_[_0x0451('0x36')](db['Trigger'][_0x0451('0x30')]);_0x12b2ee[_0x0451('0x35')]=_[_0x0451('0x36')](_0x2b6b5b[_0x0451('0x35')]);_0x12b2ee[_0x0451('0x37')]=_[_0x0451('0x38')](_0x12b2ee[_0x0451('0x34')],_0x12b2ee[_0x0451('0x35')]);_0x50050b[_0x0451('0x3a')]=_[_0x0451('0x38')](_0x12b2ee[_0x0451('0x34')],qs['fields'](_0x2b6b5b[_0x0451('0x35')]['fields']));_0x50050b['attributes']=_0x50050b[_0x0451('0x3a')][_0x0451('0x3b')]?_0x50050b[_0x0451('0x3a')]:_0x12b2ee['model'];if(_0x2b6b5b[_0x0451('0x35')][_0x0451('0x44')]){_0x50050b[_0x0451('0x45')]=[{'all':!![]}];}_0x50050b=_['merge']({},_0x50050b,_0x2b6b5b[_0x0451('0x43')]);return db[_0x0451('0x2f')]['find'](_0x50050b)[_0x0451('0x21')](handleEntityNotFound(_0x39479e,null))[_0x0451('0x21')](respondWithResult(_0x39479e,null))['catch'](handleError(_0x39479e,null));};exports[_0x0451('0x4b')]=function(_0xf31891,_0x1c3618){return db['Trigger'][_0x0451('0x4b')](_0xf31891[_0x0451('0x29')],{})[_0x0451('0x21')](function(_0x501a4a){var _0x12ffc9=_0xf31891[_0x0451('0x4c')][_0x0451('0x22')]({'plain':!![]});if(!_0x12ffc9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ffc9[_0x0451('0x4d')]===_0x0451('0x4c')){var _0x203cc0=_0x501a4a[_0x0451('0x22')]({'plain':!![]});var _0x46ee87=_0x0451('0x23');return db[_0x0451('0x4e')]['find']({'where':{'name':_0x46ee87,'userProfileId':_0x12ffc9[_0x0451('0x4f')]},'raw':!![]})[_0x0451('0x21')](function(_0x443e95){if(_0x443e95&&_0x443e95[_0x0451('0x50')]===0x0){return db[_0x0451('0x24')][_0x0451('0x4b')]({'name':_0x203cc0['name'],'resourceId':_0x203cc0['id'],'type':_0x443e95[_0x0451('0x41')],'sectionId':_0x443e95['id']},{})[_0x0451('0x21')](function(){return _0x501a4a;});}else{return _0x501a4a;}})[_0x0451('0x48')](function(_0x567d50){logger[_0x0451('0x51')](_0x0451('0x52'),_0x567d50);throw _0x567d50;});}return _0x501a4a;})['then'](respondWithResult(_0x1c3618,0xc9))['catch'](handleError(_0x1c3618,null));};exports[_0x0451('0x20')]=function(_0xdbbfff,_0x2f607f){if(_0xdbbfff[_0x0451('0x29')]['id']){delete _0xdbbfff['body']['id'];}return db[_0x0451('0x2f')]['find']({'where':{'id':_0xdbbfff[_0x0451('0x4a')]['id']}})[_0x0451('0x21')](handleEntityNotFound(_0x2f607f,null))[_0x0451('0x21')](saveUpdates(_0xdbbfff[_0x0451('0x29')],null))['then'](respondWithResult(_0x2f607f,null))[_0x0451('0x48')](handleError(_0x2f607f,null));};exports[_0x0451('0x25')]=function(_0x53849c,_0xf1e27d){return db[_0x0451('0x2f')]['find']({'where':{'id':_0x53849c['params']['id']}})[_0x0451('0x21')](handleEntityNotFound(_0xf1e27d,null))[_0x0451('0x21')](removeEntity(_0xf1e27d,null))[_0x0451('0x48')](handleError(_0xf1e27d,null));};exports['addAllCondition']=function(_0x5b5a5f,_0x210027,_0x49b200){if(_0x5b5a5f[_0x0451('0x29')]['id']){delete _0x5b5a5f[_0x0451('0x29')]['id'];}return db[_0x0451('0x2f')][_0x0451('0x53')]({'where':{'id':_0x5b5a5f[_0x0451('0x4a')]['id']}})[_0x0451('0x21')](handleEntityNotFound(_0x210027,null))[_0x0451('0x21')](function(_0x4755b8){if(_0x4755b8){_0x5b5a5f['body']['TriggerAllId']=_0x4755b8['id'];return db[_0x0451('0x54')][_0x0451('0x4b')](_0x5b5a5f['body']);}})[_0x0451('0x21')](respondWithResult(_0x210027,null))[_0x0451('0x48')](handleError(_0x210027,null));};exports['addAnyCondition']=function(_0x577646,_0x2879c6,_0x59e770){if(_0x577646[_0x0451('0x29')]['id']){delete _0x577646[_0x0451('0x29')]['id'];}return db[_0x0451('0x2f')][_0x0451('0x53')]({'where':{'id':_0x577646[_0x0451('0x4a')]['id']}})[_0x0451('0x21')](handleEntityNotFound(_0x2879c6,null))[_0x0451('0x21')](function(_0x4dcdd4){if(_0x4dcdd4){_0x577646['body'][_0x0451('0x55')]=_0x4dcdd4['id'];return db[_0x0451('0x54')][_0x0451('0x4b')](_0x577646[_0x0451('0x29')]);}})['then'](respondWithResult(_0x2879c6,null))[_0x0451('0x48')](handleError(_0x2879c6,null));};exports[_0x0451('0x56')]=function(_0xd70b75,_0x37ed26,_0x526853){var _0x3593a8={};var _0x137435={};var _0x515031;var _0x4ca54d;return db[_0x0451('0x2f')]['findOne']({'where':{'id':_0xd70b75[_0x0451('0x4a')]['id']}})[_0x0451('0x21')](handleEntityNotFound(_0x37ed26,null))['then'](function(_0x4155a1){if(_0x4155a1){_0x515031=_0x4155a1;_0x137435['model']=_[_0x0451('0x36')](db[_0x0451('0x54')][_0x0451('0x30')]);_0x137435[_0x0451('0x35')]=_[_0x0451('0x36')](_0xd70b75['query']);_0x137435[_0x0451('0x37')]=_['intersection'](_0x137435[_0x0451('0x34')],_0x137435['query']);_0x3593a8[_0x0451('0x3a')]=_[_0x0451('0x38')](_0x137435[_0x0451('0x34')],qs[_0x0451('0x39')](_0xd70b75['query'][_0x0451('0x39')]));_0x3593a8[_0x0451('0x3a')]=_0x3593a8[_0x0451('0x3a')][_0x0451('0x3b')]?_0x3593a8[_0x0451('0x3a')]:_0x137435[_0x0451('0x34')];_0x3593a8['order']=qs[_0x0451('0x3e')](_0xd70b75[_0x0451('0x35')][_0x0451('0x3e')]);_0x3593a8[_0x0451('0x3f')]=qs[_0x0451('0x37')](_['pick'](_0xd70b75[_0x0451('0x35')],_0x137435[_0x0451('0x37')]));if(_0xd70b75['query'][_0x0451('0x42')]){_0x3593a8['where']=_['merge'](_0x3593a8[_0x0451('0x3f')],{'$or':_[_0x0451('0x2e')](_0x3593a8[_0x0451('0x3a')],function(_0x473716){var _0x2d03d2={};_0x2d03d2[_0x473716]={'$like':'%'+_0xd70b75[_0x0451('0x35')][_0x0451('0x42')]+'%'};return _0x2d03d2;})});}_0x3593a8=_[_0x0451('0x28')]({},_0x3593a8,_0xd70b75[_0x0451('0x43')]);return _0x515031[_0x0451('0x56')](_0x3593a8);}})['then'](function(_0x248b4b){if(_0x248b4b){_0x4ca54d=_0x248b4b[_0x0451('0x3b')];if(!_0xd70b75[_0x0451('0x35')][_0x0451('0x3c')](_0x0451('0x57'))){_0x3593a8[_0x0451('0x17')]=qs[_0x0451('0x17')](_0xd70b75[_0x0451('0x35')]['limit']);_0x3593a8[_0x0451('0x19')]=qs[_0x0451('0x19')](_0xd70b75['query'][_0x0451('0x19')]);}return _0x515031[_0x0451('0x56')](_0x3593a8);}})[_0x0451('0x21')](function(_0x16eb9f){if(_0x16eb9f){return _0x16eb9f?{'count':_0x4ca54d,'rows':_0x16eb9f}:null;}})['then'](respondWithResult(_0x37ed26,null))[_0x0451('0x48')](handleError(_0x37ed26,null));};exports[_0x0451('0x58')]=function(_0x361c60,_0x32d145,_0x2a2c65){var _0x1f3f0a={};var _0x1fe265={};var _0x304cc0;var _0x582cde;return db[_0x0451('0x2f')]['findOne']({'where':{'id':_0x361c60[_0x0451('0x4a')]['id']}})[_0x0451('0x21')](handleEntityNotFound(_0x32d145,null))[_0x0451('0x21')](function(_0x282ea6){if(_0x282ea6){_0x304cc0=_0x282ea6;_0x1fe265[_0x0451('0x34')]=_[_0x0451('0x36')](db[_0x0451('0x54')][_0x0451('0x30')]);_0x1fe265[_0x0451('0x35')]=_[_0x0451('0x36')](_0x361c60[_0x0451('0x35')]);_0x1fe265['filters']=_[_0x0451('0x38')](_0x1fe265[_0x0451('0x34')],_0x1fe265['query']);_0x1f3f0a['attributes']=_[_0x0451('0x38')](_0x1fe265[_0x0451('0x34')],qs['fields'](_0x361c60[_0x0451('0x35')]['fields']));_0x1f3f0a[_0x0451('0x3a')]=_0x1f3f0a[_0x0451('0x3a')][_0x0451('0x3b')]?_0x1f3f0a['attributes']:_0x1fe265[_0x0451('0x34')];_0x1f3f0a[_0x0451('0x3d')]=qs[_0x0451('0x3e')](_0x361c60[_0x0451('0x35')][_0x0451('0x3e')]);_0x1f3f0a[_0x0451('0x3f')]=qs[_0x0451('0x37')](_[_0x0451('0x40')](_0x361c60[_0x0451('0x35')],_0x1fe265[_0x0451('0x37')]));if(_0x361c60[_0x0451('0x35')]['filter']){_0x1f3f0a[_0x0451('0x3f')]=_[_0x0451('0x28')](_0x1f3f0a[_0x0451('0x3f')],{'$or':_[_0x0451('0x2e')](_0x1f3f0a[_0x0451('0x3a')],function(_0x18a801){var _0x521267={};_0x521267[_0x18a801]={'$like':'%'+_0x361c60[_0x0451('0x35')][_0x0451('0x42')]+'%'};return _0x521267;})});}_0x1f3f0a=_[_0x0451('0x28')]({},_0x1f3f0a,_0x361c60[_0x0451('0x43')]);return _0x304cc0['getAnyConditions'](_0x1f3f0a);}})[_0x0451('0x21')](function(_0x4b1927){if(_0x4b1927){_0x582cde=_0x4b1927[_0x0451('0x3b')];if(!_0x361c60['query'][_0x0451('0x3c')](_0x0451('0x57'))){_0x1f3f0a[_0x0451('0x17')]=qs[_0x0451('0x17')](_0x361c60[_0x0451('0x35')][_0x0451('0x17')]);_0x1f3f0a[_0x0451('0x19')]=qs['offset'](_0x361c60[_0x0451('0x35')]['offset']);}return _0x304cc0[_0x0451('0x58')](_0x1f3f0a);}})[_0x0451('0x21')](function(_0x4f034e){if(_0x4f034e){return _0x4f034e?{'count':_0x582cde,'rows':_0x4f034e}:null;}})[_0x0451('0x21')](respondWithResult(_0x32d145,null))['catch'](handleError(_0x32d145,null));};exports['addAction']=function(_0x8d39f5,_0xd168a0,_0x402929){if(_0x8d39f5[_0x0451('0x29')]['id']){delete _0x8d39f5[_0x0451('0x29')]['id'];}return db[_0x0451('0x2f')][_0x0451('0x53')]({'where':{'id':_0x8d39f5[_0x0451('0x4a')]['id']}})['then'](handleEntityNotFound(_0xd168a0,null))[_0x0451('0x21')](function(_0x24dd16){if(_0x24dd16){_0x8d39f5[_0x0451('0x29')][_0x0451('0x59')]=_0x24dd16['id'];return db['Action']['create'](_0x8d39f5[_0x0451('0x29')]);}})[_0x0451('0x21')](respondWithResult(_0xd168a0,null))['catch'](handleError(_0xd168a0,null));};exports['getActions']=function(_0x5ac829,_0x5f4ebd,_0x199dc7){var _0x9b072c={};var _0x32753d={};var _0x34717c;var _0x4bc18b;return db[_0x0451('0x2f')][_0x0451('0x5a')]({'where':{'id':_0x5ac829[_0x0451('0x4a')]['id']}})[_0x0451('0x21')](handleEntityNotFound(_0x5f4ebd,null))[_0x0451('0x21')](function(_0x5bdfac){if(_0x5bdfac){_0x34717c=_0x5bdfac;_0x32753d[_0x0451('0x34')]=_[_0x0451('0x36')](db[_0x0451('0x5b')][_0x0451('0x30')]);_0x32753d['query']=_[_0x0451('0x36')](_0x5ac829[_0x0451('0x35')]);_0x32753d[_0x0451('0x37')]=_[_0x0451('0x38')](_0x32753d['model'],_0x32753d[_0x0451('0x35')]);_0x9b072c['attributes']=_[_0x0451('0x38')](_0x32753d['model'],qs[_0x0451('0x39')](_0x5ac829['query'][_0x0451('0x39')]));_0x9b072c['attributes']=_0x9b072c['attributes'][_0x0451('0x3b')]?_0x9b072c[_0x0451('0x3a')]:_0x32753d['model'];_0x9b072c[_0x0451('0x3d')]=qs[_0x0451('0x3e')](_0x5ac829[_0x0451('0x35')][_0x0451('0x3e')]);_0x9b072c[_0x0451('0x3f')]=qs[_0x0451('0x37')](_['pick'](_0x5ac829[_0x0451('0x35')],_0x32753d[_0x0451('0x37')]));if(_0x5ac829[_0x0451('0x35')][_0x0451('0x42')]){_0x9b072c[_0x0451('0x3f')]=_['merge'](_0x9b072c[_0x0451('0x3f')],{'$or':_[_0x0451('0x2e')](_0x9b072c['attributes'],function(_0x195174){var _0x48c459={};_0x48c459[_0x195174]={'$like':'%'+_0x5ac829[_0x0451('0x35')][_0x0451('0x42')]+'%'};return _0x48c459;})});}_0x9b072c=_[_0x0451('0x28')]({},_0x9b072c,_0x5ac829['options']);return _0x34717c['getActions'](_0x9b072c);}})['then'](function(_0x25286d){if(_0x25286d){_0x4bc18b=_0x25286d[_0x0451('0x3b')];if(!_0x5ac829[_0x0451('0x35')][_0x0451('0x3c')](_0x0451('0x57'))){_0x9b072c[_0x0451('0x17')]=qs['limit'](_0x5ac829[_0x0451('0x35')][_0x0451('0x17')]);_0x9b072c[_0x0451('0x19')]=qs[_0x0451('0x19')](_0x5ac829[_0x0451('0x35')][_0x0451('0x19')]);}return _0x34717c['getActions'](_0x9b072c);}})[_0x0451('0x21')](function(_0x458edf){if(_0x458edf){return _0x458edf?{'count':_0x4bc18b,'rows':_0x458edf}:null;}})['then'](respondWithResult(_0x5f4ebd,null))[_0x0451('0x48')](handleError(_0x5f4ebd,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 10c3dfb..56d5bb4 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 _0xccdc=['Trigger','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./trigger.attributes','define'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xccdc,0x15f));var _0xcccd=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xccdc[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require(_0xcccd('0x0'));var logger=require(_0xcccd('0x1'))(_0xcccd('0x2'));var moment=require(_0xcccd('0x3'));var BPromise=require('bluebird');var rp=require(_0xcccd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcccd('0x5'));var config=require(_0xcccd('0x6'));var attributes=require(_0xcccd('0x7'));module['exports']=function(_0xd9263b,_0x2f89fc){return _0xd9263b[_0xcccd('0x8')](_0xcccd('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x026b=['moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','tools_triggers','lodash','util','../../config/logger','api'];(function(_0x238621,_0x7fd122){var _0x3af5f6=function(_0x2a924d){while(--_0x2a924d){_0x238621['push'](_0x238621['shift']());}};_0x3af5f6(++_0x7fd122);}(_0x026b,0x17d));var _0xb026=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x026b[_0x3e25c1];return _0x52e7f2;};'use strict';var _=require(_0xb026('0x0'));var util=require(_0xb026('0x1'));var logger=require(_0xb026('0x2'))(_0xb026('0x3'));var moment=require(_0xb026('0x4'));var BPromise=require(_0xb026('0x5'));var rp=require(_0xb026('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb026('0x7'));var config=require(_0xb026('0x8'));var attributes=require(_0xb026('0x9'));module['exports']=function(_0x477c6a,_0x464243){return _0x477c6a['define']('Trigger',attributes,{'tableName':_0xb026('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 4d6d4ae..de89272 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 _0xbc9d=['Trigger','options','raw','where','limit','include','model','attributes','map','ShowTrigger','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger'];(function(_0x5d4de2,_0x55f16d){var _0x4ddb95=function(_0x153c74){while(--_0x153c74){_0x5d4de2['push'](_0x5d4de2['shift']());}};_0x4ddb95(++_0x55f16d);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x482943,_0x1f86f3){_0x482943=_0x482943-0x0;var _0x9954cc=_0xbc9d[_0x482943];return _0x9954cc;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var moment=require(_0xdbc9('0x2'));var BPromise=require(_0xdbc9('0x3'));var rs=require(_0xdbc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbc9('0x5'))(_0xdbc9('0x6'));var config=require(_0xdbc9('0x7'));var jayson=require(_0xdbc9('0x8'));var client=jayson[_0xdbc9('0x9')][_0xdbc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x381a0e,_0x4a9246,_0x2dbd23){return new BPromise(function(_0x181f8a,_0x3d4918){return client['request'](_0x381a0e,_0x2dbd23)[_0xdbc9('0xb')](function(_0x53cff1){logger['info'](_0xdbc9('0xc'),_0x4a9246,_0xdbc9('0xd'));logger[_0xdbc9('0xe')](_0xdbc9('0xf'),_0x4a9246,'request\x20sent',JSON[_0xdbc9('0x10')](_0x53cff1));if(_0x53cff1[_0xdbc9('0x11')]){if(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x12')]===0x1f4){logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x53cff1['error']['message']);return _0x3d4918(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x13')]);}logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x53cff1[_0xdbc9('0x11')]['message']);return _0x181f8a(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x13')]);}else{logger[_0xdbc9('0x14')]('Trigger,\x20%s,\x20%s',_0x4a9246,_0xdbc9('0xd'));_0x181f8a(_0x53cff1[_0xdbc9('0x15')]['message']);}})[_0xdbc9('0x16')](function(_0x37856d){logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x37856d);_0x3d4918(_0x37856d);});});}exports[_0xdbc9('0x17')]=function(_0x33f1bd){var _0x9f343d=this;return new Promise(function(_0xc2ddd2,_0x2ad952){return db[_0xdbc9('0x18')]['findAll']({'raw':_0x33f1bd[_0xdbc9('0x19')]?_0x33f1bd['options'][_0xdbc9('0x1a')]===undefined?!![]:![]:!![],'where':_0x33f1bd[_0xdbc9('0x19')]?_0x33f1bd['options'][_0xdbc9('0x1b')]||null:null,'attributes':_0x33f1bd['options']?_0x33f1bd['options']['attributes']||null:null,'limit':_0x33f1bd['options']?_0x33f1bd[_0xdbc9('0x19')][_0xdbc9('0x1c')]||null:null,'include':_0x33f1bd['options']?_0x33f1bd[_0xdbc9('0x19')][_0xdbc9('0x1d')]?_['map'](_0x33f1bd[_0xdbc9('0x19')][_0xdbc9('0x1d')],function(_0x1b1c0d){return{'model':db[_0x1b1c0d[_0xdbc9('0x1e')]],'as':_0x1b1c0d['as'],'attributes':_0x1b1c0d[_0xdbc9('0x1f')],'include':_0x1b1c0d[_0xdbc9('0x1d')]?_[_0xdbc9('0x20')](_0x1b1c0d[_0xdbc9('0x1d')],function(_0x3c8c1d){return{'model':db[_0x3c8c1d['model']],'as':_0x3c8c1d['as'],'attributes':_0x3c8c1d[_0xdbc9('0x1f')],'include':_0x3c8c1d[_0xdbc9('0x1d')]?_[_0xdbc9('0x20')](_0x3c8c1d[_0xdbc9('0x1d')],function(_0x24fdec){return{'model':db[_0x24fdec['model']],'as':_0x24fdec['as'],'attributes':_0x24fdec[_0xdbc9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdbc9('0xb')](function(_0x5300bd){logger['info'](_0xdbc9('0x17'),_0x33f1bd);logger[_0xdbc9('0xe')](_0xdbc9('0x17'),_0x33f1bd,JSON['stringify'](_0x5300bd));_0xc2ddd2(_0x5300bd);})[_0xdbc9('0x16')](function(_0x539e57){logger['error'](_0xdbc9('0x17'),_0x539e57['message'],_0x33f1bd);_0x2ad952(_0x9f343d['error'](0x1f4,_0x539e57[_0xdbc9('0x13')]));});});};exports[_0xdbc9('0x21')]=function(_0x1cb557){var _0x4db824=this;return new Promise(function(_0x35eaf8,_0x22f8aa){return db['Trigger']['find']({'raw':_0x1cb557[_0xdbc9('0x19')]?_0x1cb557[_0xdbc9('0x19')][_0xdbc9('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cb557[_0xdbc9('0x19')]?_0x1cb557[_0xdbc9('0x19')][_0xdbc9('0x1b')]||null:null,'attributes':_0x1cb557[_0xdbc9('0x19')]?_0x1cb557['options'][_0xdbc9('0x1f')]||null:null,'include':_0x1cb557[_0xdbc9('0x19')]?_0x1cb557[_0xdbc9('0x19')][_0xdbc9('0x1d')]?_[_0xdbc9('0x20')](_0x1cb557[_0xdbc9('0x19')]['include'],function(_0x1cf210){return{'model':db[_0x1cf210['model']],'as':_0x1cf210['as'],'attributes':_0x1cf210['attributes'],'include':_0x1cf210['include']?_['map'](_0x1cf210['include'],function(_0x321a37){return{'model':db[_0x321a37[_0xdbc9('0x1e')]],'as':_0x321a37['as'],'attributes':_0x321a37[_0xdbc9('0x1f')],'include':_0x321a37['include']?_[_0xdbc9('0x20')](_0x321a37[_0xdbc9('0x1d')],function(_0x2c1053){return{'model':db[_0x2c1053[_0xdbc9('0x1e')]],'as':_0x2c1053['as'],'attributes':_0x2c1053[_0xdbc9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdbc9('0xb')](function(_0x5bc477){logger[_0xdbc9('0x14')](_0xdbc9('0x21'),_0x1cb557);logger[_0xdbc9('0xe')]('ShowTrigger',_0x1cb557,JSON[_0xdbc9('0x10')](_0x5bc477));_0x35eaf8(_0x5bc477);})[_0xdbc9('0x16')](function(_0x30fa5c){logger[_0xdbc9('0x11')]('ShowTrigger',_0x30fa5c['message'],_0x1cb557);_0x22f8aa(_0x4db824[_0xdbc9('0x11')](0x1f4,_0x30fa5c[_0xdbc9('0x13')]));});});}; \ No newline at end of file +var _0x84a0=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','GetTrigger','ShowTrigger','find','lodash','util','moment'];(function(_0x265106,_0x2a66af){var _0x31c902=function(_0x815503){while(--_0x815503){_0x265106['push'](_0x265106['shift']());}};_0x31c902(++_0x2a66af);}(_0x84a0,0x66));var _0x084a=function(_0x18ab34,_0xb78e01){_0x18ab34=_0x18ab34-0x0;var _0x186317=_0x84a0[_0x18ab34];return _0x186317;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6810,_0x373d2,_0x2b30bc){return new BPromise(function(_0x58d419,_0x1051a9){return client[_0x084a('0xa')](_0x2e6810,_0x2b30bc)[_0x084a('0xb')](function(_0x2888e3){logger[_0x084a('0xc')]('Trigger,\x20%s,\x20%s',_0x373d2,'request\x20sent');logger[_0x084a('0xd')](_0x084a('0xe'),_0x373d2,_0x084a('0xf'),JSON[_0x084a('0x10')](_0x2888e3));if(_0x2888e3[_0x084a('0x11')]){if(_0x2888e3['error']['code']===0x1f4){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);return _0x1051a9(_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);}logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3['error'][_0x084a('0x13')]);return _0x58d419(_0x2888e3['error'][_0x084a('0x13')]);}else{logger[_0x084a('0xc')](_0x084a('0x12'),_0x373d2,_0x084a('0xf'));_0x58d419(_0x2888e3[_0x084a('0x14')]['message']);}})[_0x084a('0x15')](function(_0x4abd81){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x4abd81);_0x1051a9(_0x4abd81);});});}exports['GetTrigger']=function(_0xf2c333){var _0x32c729=this;return new Promise(function(_0x4134b9,_0x14bb19){return db[_0x084a('0x16')][_0x084a('0x17')]({'raw':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x19')]===undefined?!![]:![]:!![],'where':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1a')]||null:null,'attributes':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1b')]||null:null,'limit':_0xf2c333['options']?_0xf2c333[_0x084a('0x18')][_0x084a('0x1c')]||null:null,'include':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1d')]?_['map'](_0xf2c333[_0x084a('0x18')][_0x084a('0x1d')],function(_0x6346a5){return{'model':db[_0x6346a5[_0x084a('0x1e')]],'as':_0x6346a5['as'],'attributes':_0x6346a5[_0x084a('0x1b')],'include':_0x6346a5[_0x084a('0x1d')]?_['map'](_0x6346a5[_0x084a('0x1d')],function(_0x2af138){return{'model':db[_0x2af138[_0x084a('0x1e')]],'as':_0x2af138['as'],'attributes':_0x2af138['attributes'],'include':_0x2af138[_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x2af138[_0x084a('0x1d')],function(_0x4c5658){return{'model':db[_0x4c5658['model']],'as':_0x4c5658['as'],'attributes':_0x4c5658['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33b88f){logger['info']('GetTrigger',_0xf2c333);logger['debug'](_0x084a('0x20'),_0xf2c333,JSON[_0x084a('0x10')](_0x33b88f));_0x4134b9(_0x33b88f);})[_0x084a('0x15')](function(_0x2c4149){logger[_0x084a('0x11')](_0x084a('0x20'),_0x2c4149[_0x084a('0x13')],_0xf2c333);_0x14bb19(_0x32c729[_0x084a('0x11')](0x1f4,_0x2c4149['message']));});});};exports[_0x084a('0x21')]=function(_0x3b2b38){var _0x501a16=this;return new Promise(function(_0xe1980b,_0x24bcf5){return db[_0x084a('0x16')][_0x084a('0x22')]({'raw':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x19')]===undefined?!![]:![]:!![],'where':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x1a')]||null:null,'attributes':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x1b')]||null:null,'include':_0x3b2b38['options']?_0x3b2b38['options'][_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x3b2b38[_0x084a('0x18')][_0x084a('0x1d')],function(_0x83f94f){return{'model':db[_0x83f94f['model']],'as':_0x83f94f['as'],'attributes':_0x83f94f[_0x084a('0x1b')],'include':_0x83f94f[_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x83f94f['include'],function(_0x109593){return{'model':db[_0x109593[_0x084a('0x1e')]],'as':_0x109593['as'],'attributes':_0x109593[_0x084a('0x1b')],'include':_0x109593['include']?_['map'](_0x109593['include'],function(_0xf97d1b){return{'model':db[_0xf97d1b[_0x084a('0x1e')]],'as':_0xf97d1b['as'],'attributes':_0xf97d1b[_0x084a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c09c3){logger[_0x084a('0xc')](_0x084a('0x21'),_0x3b2b38);logger[_0x084a('0xd')](_0x084a('0x21'),_0x3b2b38,JSON[_0x084a('0x10')](_0x3c09c3));_0xe1980b(_0x3c09c3);})[_0x084a('0x15')](function(_0x19354f){logger[_0x084a('0x11')](_0x084a('0x21'),_0x19354f[_0x084a('0x13')],_0x3b2b38);_0x24bcf5(_0x501a16[_0x084a('0x11')](0x1f4,_0x19354f[_0x084a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c1e14bd..8381fdd 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 _0x79d7=['post','/:id/clone','clone','put','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x79d7,0x1bb));var _0x779d=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x79d7[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0x779d('0x0'));var util=require(_0x779d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x779d('0x2'));var router=express[_0x779d('0x3')]();var fs_extra=require(_0x779d('0x4'));var auth=require(_0x779d('0x5'));var interaction=require(_0x779d('0x6'));var config=require('../../config/environment');var controller=require(_0x779d('0x7'));router[_0x779d('0x8')]('/',auth[_0x779d('0x9')](),controller[_0x779d('0xa')]);router[_0x779d('0x8')](_0x779d('0xb'),auth['isAuthenticated'](),controller[_0x779d('0xc')]);router[_0x779d('0xd')](_0x779d('0xe'),auth[_0x779d('0x9')](),controller[_0x779d('0xf')]);router[_0x779d('0xd')]('/',auth[_0x779d('0x9')](),controller['create']);router[_0x779d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x779d('0x11')]);router[_0x779d('0x12')]('/:id',auth[_0x779d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbd29=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','put','update','delete','util','path','connect-timeout','express'];(function(_0x4caed7,_0xb598cc){var _0x376239=function(_0x496514){while(--_0x496514){_0x4caed7['push'](_0x4caed7['shift']());}};_0x376239(++_0xb598cc);}(_0xbd29,0x1df));var _0x9bd2=function(_0x5407a9,_0x2924b8){_0x5407a9=_0x5407a9-0x0;var _0x4a32c2=_0xbd29[_0x5407a9];return _0x4a32c2;};'use strict';var multer=require('multer');var util=require(_0x9bd2('0x0'));var path=require(_0x9bd2('0x1'));var timeout=require(_0x9bd2('0x2'));var express=require(_0x9bd2('0x3'));var router=express[_0x9bd2('0x4')]();var fs_extra=require(_0x9bd2('0x5'));var auth=require(_0x9bd2('0x6'));var interaction=require(_0x9bd2('0x7'));var config=require(_0x9bd2('0x8'));var controller=require(_0x9bd2('0x9'));router[_0x9bd2('0xa')]('/',auth[_0x9bd2('0xb')](),controller[_0x9bd2('0xc')]);router[_0x9bd2('0xa')](_0x9bd2('0xd'),auth[_0x9bd2('0xb')](),controller[_0x9bd2('0xe')]);router[_0x9bd2('0xf')](_0x9bd2('0x10'),auth[_0x9bd2('0xb')](),controller[_0x9bd2('0x11')]);router[_0x9bd2('0xf')]('/',auth[_0x9bd2('0xb')](),controller['create']);router[_0x9bd2('0x12')](_0x9bd2('0xd'),auth[_0x9bd2('0xb')](),controller[_0x9bd2('0x13')]);router[_0x9bd2('0x14')](_0x9bd2('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index d4d061a..c6bb91e 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 _0x65af=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','uac','uas','pai','certificate','active','passive','actpass','dynamic','BOOLEAN','sequelize','STRING','user','peer','friend','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','setDataValue','insecure'];(function(_0x1dcbcc,_0x31a0fc){var _0x38590e=function(_0xd1a9aa){while(--_0xd1a9aa){_0x1dcbcc['push'](_0x1dcbcc['shift']());}};_0x38590e(++_0x31a0fc);}(_0x65af,0x198));var _0xf65a=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x65af[_0x4a3898];return _0x25ceb0;};'use strict';var Sequelize=require(_0xf65a('0x0'));module['exports']={'name':{'type':Sequelize[_0xf65a('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0xf65a('0x2'),_0xf65a('0x3')),'allowNull':![],'defaultValue':_0xf65a('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x6'),'ALLOWED_PASSED_SCREEN',_0xf65a('0x7'),'ALLOWED',_0xf65a('0x8'),_0xf65a('0x9'),_0xf65a('0xa'),_0xf65a('0xb'))},'deny':{'type':Sequelize[_0xf65a('0x1')]},'permit':{'type':Sequelize[_0xf65a('0x1')]},'secret':{'type':Sequelize[_0xf65a('0x1')]},'md5secret':{'type':Sequelize[_0xf65a('0x1')]},'remotesecret':{'type':Sequelize[_0xf65a('0x1')]},'transport':{'type':Sequelize[_0xf65a('0x1')],'defaultValue':'udp','set':function(_0x1719f4){this['setDataValue'](_0xf65a('0xc'),_0x1719f4?_0x1719f4['join'](','):null);},'get':function(){return this['getDataValue'](_0xf65a('0xc'))?this[_0xf65a('0xd')](_0xf65a('0xc'))[_0xf65a('0xe')](','):null;},'comment':_0xf65a('0xf')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf65a('0x10'),_0xf65a('0x11'),_0xf65a('0x12'),_0xf65a('0x13'),_0xf65a('0x14')),'defaultValue':_0xf65a('0x10')},'directmedia':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x15'),'no','nonat',_0xf65a('0x16'),_0xf65a('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf65a('0x5')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf65a('0x1')]},'directmediadeny':{'type':Sequelize[_0xf65a('0x1')]},'nat':{'type':Sequelize[_0xf65a('0x1')],'defaultValue':_0xf65a('0x18'),'set':function(_0x174e27){this['setDataValue']('nat',_0x174e27?_0x174e27['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xf65a('0xd')](_0xf65a('0x19'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xf65a('0x1')]},'namedcallgroup':{'type':Sequelize[_0xf65a('0x1')]},'pickupgroup':{'type':Sequelize[_0xf65a('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf65a('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xf65a('0x1a')},'allow':{'type':Sequelize[_0xf65a('0x1')],'allowNull':![],'defaultValue':_0xf65a('0x1b'),'set':function(_0x2b2129){this['setDataValue'](_0xf65a('0x1c'),_0x2b2129?_0x2b2129[_0xf65a('0x1d')](';'):_0xf65a('0x1b'));},'get':function(){return this['getDataValue'](_0xf65a('0x1c'))?this[_0xf65a('0xd')]('allow')[_0xf65a('0xe')](';'):null;},'comment':_0xf65a('0x1e')},'autoframing':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x15'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x706bfc){this[_0xf65a('0x1f')](_0xf65a('0x20'),_0x706bfc?_0x706bfc[_0xf65a('0x1d')](','):null);},'get':function(){return this[_0xf65a('0xd')](_0xf65a('0x20'))?this[_0xf65a('0xd')](_0xf65a('0x20'))[_0xf65a('0xe')](','):null;},'comment':_0xf65a('0x21')},'trustrpid':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x15'),'no',_0xf65a('0x22'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xf65a('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xf65a('0x23')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xf65a('0x5')]('yes','no'),'defaultValue':_0xf65a('0x15')},'busylevel':{'type':Sequelize[_0xf65a('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xf65a('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xf65a('0x5')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x15'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf65a('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xf65a('0x15'),'no',_0xf65a('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf65a('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf65a('0x5')]('yes','no')},'mailbox':{'type':Sequelize[_0xf65a('0x1')]},'session_timers':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x26'),_0xf65a('0x27'),'originate')},'session_expires':{'type':Sequelize[_0xf65a('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xf65a('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x28'),_0xf65a('0x29')),'defaultValue':_0xf65a('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xf65a('0x1')]},'fromdomain':{'type':Sequelize[_0xf65a('0x1')]},'fromuser':{'type':Sequelize[_0xf65a('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x15'),'no'),'defaultValue':_0xf65a('0x15')},'keepalive':{'type':Sequelize[_0xf65a('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xf65a('0x1')]},'defaultuser':{'type':Sequelize[_0xf65a('0x1')]},'rtptimeout':{'type':Sequelize[_0xf65a('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf65a('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf65a('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x15'),'no',_0xf65a('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf65a('0x1')]},'callbackextension':{'type':Sequelize[_0xf65a('0x1')]},'timert1':{'type':Sequelize[_0xf65a('0x24')](0xb)},'timerb':{'type':Sequelize[_0xf65a('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xf65a('0x1')]},'contactdeny':{'type':Sequelize[_0xf65a('0x1')]},'contactacl':{'type':Sequelize[_0xf65a('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xf65a('0x1')]},'use_q850_reason':{'type':Sequelize[_0xf65a('0x1')]},'maxforwards':{'type':Sequelize[_0xf65a('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf65a('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xf65a('0x15'),'no')},'force_avp':{'type':Sequelize[_0xf65a('0x5')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0xf65a('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xf65a('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0xf65a('0x5')]('yes','no','fingerprint',_0xf65a('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xf65a('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf65a('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xf65a('0x1')]},'dtlscipher':{'type':Sequelize[_0xf65a('0x1')]},'dtlscafile':{'type':Sequelize[_0xf65a('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0xf65a('0x2c'),_0xf65a('0x2d'),_0xf65a('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf65a('0x1')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf65a('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf65a('0x5')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xf65a('0x5')]('yes','no')},'vmexten':{'type':Sequelize[_0xf65a('0x1')]},'mohinterpret':{'type':Sequelize[_0xf65a('0x1')]},'mohsuggest':{'type':Sequelize[_0xf65a('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf65a('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xf65a('0x2f')},'canreinvite':{'type':Sequelize[_0xf65a('0x5')](_0xf65a('0x15'),'no','nonat',_0xf65a('0x16'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf65a('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf65a('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x853e=['getDataValue','rfc2833','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','refuse','originate','uas','pai','fingerprint','certificate','active','passive','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport'];(function(_0x4975ef,_0x487d6b){var _0x4dff47=function(_0x57e92b){while(--_0x57e92b){_0x4975ef['push'](_0x4975ef['shift']());}};_0x4dff47(++_0x487d6b);}(_0x853e,0xe4));var _0xe853=function(_0x2ae846,_0x7461cd){_0x2ae846=_0x2ae846-0x0;var _0x515a34=_0x853e[_0x2ae846];return _0x515a34;};'use strict';var Sequelize=require(_0xe853('0x0'));module[_0xe853('0x1')]={'name':{'type':Sequelize[_0xe853('0x2')],'allowNull':![],'unique':_0xe853('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xe853('0x4'),_0xe853('0x5'),'peer'),'allowNull':![],'defaultValue':_0xe853('0x4')},'context':{'type':Sequelize[_0xe853('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xe853('0x6')]('ALLOWED_NOT_SCREENED',_0xe853('0x7'),_0xe853('0x8'),_0xe853('0x9'),_0xe853('0xa'),_0xe853('0xb'),_0xe853('0xc'),_0xe853('0xd'))},'deny':{'type':Sequelize[_0xe853('0x2')]},'permit':{'type':Sequelize[_0xe853('0x2')]},'secret':{'type':Sequelize[_0xe853('0x2')]},'md5secret':{'type':Sequelize[_0xe853('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xe853('0x2')],'defaultValue':_0xe853('0xe'),'set':function(_0x40140e){this[_0xe853('0xf')](_0xe853('0x10'),_0x40140e?_0x40140e['join'](','):null);},'get':function(){return this[_0xe853('0x11')]('transport')?this[_0xe853('0x11')](_0xe853('0x10'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x12'),'info',_0xe853('0x13'),_0xe853('0x14'),_0xe853('0x15')),'defaultValue':_0xe853('0x12')},'directmedia':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no','nonat',_0xe853('0x17'),_0xe853('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe853('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe853('0x2')]},'directmediadeny':{'type':Sequelize[_0xe853('0x2')]},'nat':{'type':Sequelize[_0xe853('0x2')],'defaultValue':_0xe853('0x19'),'set':function(_0x1c50a3){this[_0xe853('0xf')](_0xe853('0x1a'),_0x1c50a3?_0x1c50a3['join'](','):null);},'get':function(){return this[_0xe853('0x11')]('nat')?this[_0xe853('0x11')](_0xe853('0x1a'))[_0xe853('0x1b')](','):null;},'comment':_0xe853('0x1c')},'callgroup':{'type':Sequelize[_0xe853('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe853('0x2')]},'pickupgroup':{'type':Sequelize[_0xe853('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe853('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe853('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe853('0x2')],'defaultValue':_0xe853('0x1d')},'allow':{'type':Sequelize[_0xe853('0x2')],'allowNull':![],'defaultValue':_0xe853('0x1e'),'set':function(_0x587ca8){this[_0xe853('0xf')](_0xe853('0x1f'),_0x587ca8?_0x587ca8[_0xe853('0x20')](';'):_0xe853('0x1e'));},'get':function(){return this[_0xe853('0x11')](_0xe853('0x1f'))?this['getDataValue'](_0xe853('0x1f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no')},'insecure':{'type':Sequelize[_0xe853('0x2')],'defaultValue':_0xe853('0x21'),'set':function(_0x36bc30){this[_0xe853('0xf')](_0xe853('0x22'),_0x36bc30?_0x36bc30[_0xe853('0x20')](','):null);},'get':function(){return this['getDataValue'](_0xe853('0x22'))?this['getDataValue'](_0xe853('0x22'))[_0xe853('0x1b')](','):null;},'comment':_0xe853('0x23')},'trustrpid':{'type':Sequelize[_0xe853('0x6')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xe853('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe853('0x6')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no')},'accountcode':{'type':Sequelize[_0xe853('0x24')](0xb)},'setvar':{'type':Sequelize[_0xe853('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0xe853('0x16'),'no'),'defaultValue':_0xe853('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xe853('0x6')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe853('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xe853('0x2')]},'videosupport':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xe853('0x16'),'no')},'mailbox':{'type':Sequelize[_0xe853('0x2')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xe853('0x25'),_0xe853('0x26'))},'session_expires':{'type':Sequelize[_0xe853('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xe853('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'defaultValue':_0xe853('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xe853('0x2')]},'regexten':{'type':Sequelize[_0xe853('0x2')]},'fromdomain':{'type':Sequelize[_0xe853('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xe853('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe853('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe853('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no',_0xe853('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe853('0x2')]},'callbackextension':{'type':Sequelize[_0xe853('0x2')]},'timert1':{'type':Sequelize[_0xe853('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xe853('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xe853('0x2')]},'contactacl':{'type':Sequelize[_0xe853('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xe853('0x2')]},'use_q850_reason':{'type':Sequelize[_0xe853('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe853('0x6')]('yes','no')},'force_avp':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no')},'icesupport':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xe853('0x16'),'no',_0xe853('0x29'),_0xe853('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xe853('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xe853('0x2')]},'dtlscipher':{'type':Sequelize[_0xe853('0x2')]},'dtlscafile':{'type':Sequelize[_0xe853('0x2')]},'dtlscapath':{'type':Sequelize[_0xe853('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe853('0x2b'),_0xe853('0x2c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe853('0x2')]},'recordofffeature':{'type':Sequelize[_0xe853('0x2')]},'call_limit':{'type':Sequelize[_0xe853('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xe853('0x6')](_0xe853('0x16'),'no')},'vmexten':{'type':Sequelize[_0xe853('0x2')]},'mohinterpret':{'type':Sequelize[_0xe853('0x2')]},'mohsuggest':{'type':Sequelize[_0xe853('0x2')]},'parkinglot':{'type':Sequelize[_0xe853('0x2')]},'description':{'type':Sequelize[_0xe853('0x2')]},'host':{'type':Sequelize[_0xe853('0x2')],'defaultValue':_0xe853('0x2d')},'canreinvite':{'type':Sequelize['ENUM'](_0xe853('0x16'),'no',_0xe853('0x2e'),'update',_0xe853('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xe853('0x2')]},'active':{'type':Sequelize[_0xe853('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe853('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 9b0146a..f774f3b 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 _0xb10b=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','get','Trunks','UserProfileResource','stack','name','send','render','merge','agent','interaction','account','map','Trunk','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','length','find','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','chan_sip.so','userProfileId','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','root','Reload','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1fc82b,_0x5150a6){_0x1fc82b=_0x1fc82b-0x0;var _0x4c6679=_0xb10b[_0x1fc82b];return _0x4c6679;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];var jayson=require(_0xbb10('0x18'));var client=jayson[_0xbb10('0x19')][_0xbb10('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x442548,_0x147230,_0x58a612,_0x26e021){return new BPromise(function(_0x42d7e4,_0x45b9d6){var _0x17fd46=_0x26e021||client;return _0x17fd46[_0xbb10('0x1b')](_0x442548,_0x58a612)[_0xbb10('0x1c')](function(_0x24a57b){logger[_0xbb10('0x1d')](_0xbb10('0x1e'),_0x147230,_0xbb10('0x1f'));logger['debug'](_0xbb10('0x20'),_0x147230,_0xbb10('0x1f'),JSON[_0xbb10('0x21')](_0x24a57b));if(_0x24a57b[_0xbb10('0x22')]){if(_0x24a57b[_0xbb10('0x22')][_0xbb10('0x23')]===0x1f4){logger[_0xbb10('0x22')](_0xbb10('0x1e'),_0x147230,_0x24a57b[_0xbb10('0x22')][_0xbb10('0x24')]);return _0x45b9d6(_0x24a57b['error'][_0xbb10('0x24')]);}logger[_0xbb10('0x22')](_0xbb10('0x1e'),_0x147230,_0x24a57b[_0xbb10('0x22')][_0xbb10('0x24')]);return _0x42d7e4(_0x24a57b[_0xbb10('0x22')]['message']);}else{logger[_0xbb10('0x1d')](_0xbb10('0x1e'),_0x147230,'request\x20sent');_0x42d7e4(_0x24a57b['result'][_0xbb10('0x24')]);}})[_0xbb10('0x25')](function(_0x2e911d){logger[_0xbb10('0x22')](_0xbb10('0x1e'),_0x147230,_0x2e911d);_0x45b9d6(_0x2e911d);});});}function respondWithStatusCode(_0x1824b7,_0x407cb4){_0x407cb4=_0x407cb4||0xcc;return function(_0x436104){if(_0x436104){return _0x1824b7[_0xbb10('0x26')](_0x407cb4);}return _0x1824b7[_0xbb10('0x27')](_0x407cb4)[_0xbb10('0x28')]();};}function respondWithResult(_0x26ad93,_0x537898){_0x537898=_0x537898||0xc8;return function(_0x4fedac){if(_0x4fedac){return _0x26ad93['status'](_0x537898)[_0xbb10('0x29')](_0x4fedac);}};}function respondWithFilteredResult(_0x3c5ae7,_0x2c89b9){return function(_0x4e25ff){if(_0x4e25ff){var _0x2fdde9=typeof _0x2c89b9[_0xbb10('0x2a')]===_0xbb10('0x2b')&&typeof _0x2c89b9[_0xbb10('0x2c')]===_0xbb10('0x2b');var _0x20d946=_0x4e25ff[_0xbb10('0x2d')];var _0x4aabb9=_0x2fdde9?0x0:_0x2c89b9[_0xbb10('0x2a')];var _0x21ac54=_0x2fdde9?_0x4e25ff[_0xbb10('0x2d')]:_0x2c89b9[_0xbb10('0x2a')]+_0x2c89b9[_0xbb10('0x2c')];var _0x2ff4c1;if(_0x21ac54>=_0x20d946){_0x21ac54=_0x20d946;_0x2ff4c1=0xc8;}else{_0x2ff4c1=0xce;}_0x3c5ae7['status'](_0x2ff4c1);return _0x3c5ae7[_0xbb10('0x2e')]('Content-Range',_0x4aabb9+'-'+_0x21ac54+'/'+_0x20d946)[_0xbb10('0x29')](_0x4e25ff);}return null;};}function patchUpdates(_0x56f2da){return function(_0x16ad2a){try{jsonpatch[_0xbb10('0x2f')](_0x16ad2a,_0x56f2da,!![]);}catch(_0x1b59f9){return BPromise['reject'](_0x1b59f9);}return _0x16ad2a['save']();};}function saveUpdates(_0x4c3744,_0x34f65e){return function(_0x4f590d){if(_0x4f590d){return _0x4f590d[_0xbb10('0x30')](_0x4c3744)[_0xbb10('0x1c')](function(_0x2f653f){return _0x2f653f;});}return null;};}function removeEntity(_0x1c0b57,_0x37a83f){return function(_0x138bc6){if(_0x138bc6){return _0x138bc6[_0xbb10('0x31')]()['then'](function(){var _0x25acb3=_0x138bc6[_0xbb10('0x32')]({'plain':!![]});var _0x441d15=_0xbb10('0x33');return db[_0xbb10('0x34')][_0xbb10('0x31')]({'where':{'type':_0x441d15,'resourceId':_0x25acb3['id']}})[_0xbb10('0x1c')](function(){return _0x138bc6;});})[_0xbb10('0x1c')](function(){_0x1c0b57[_0xbb10('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b5352,_0x150107){return function(_0x1ddd9e){if(!_0x1ddd9e){_0x2b5352[_0xbb10('0x26')](0x194);}return _0x1ddd9e;};}function handleError(_0x570f5a,_0x111762){_0x111762=_0x111762||0x1f4;return function(_0x5de37b){logger['error'](_0x5de37b[_0xbb10('0x35')]);if(_0x5de37b[_0xbb10('0x36')]){delete _0x5de37b[_0xbb10('0x36')];}_0x570f5a[_0xbb10('0x27')](_0x111762)[_0xbb10('0x37')](_0x5de37b);};}function getMustacheRender(_0x29d11a,_0x547062){return Mustache[_0xbb10('0x38')](_0x29d11a,_[_0xbb10('0x39')](_0x547062['body'],{'contact':_0x547062['contact'],'message':_0x547062['message'],'agent':_0x547062[_0xbb10('0x3a')],'interaction':_0x547062[_0xbb10('0x3b')],'account':_0x547062[_0xbb10('0x3c')]}))||'';}exports['index']=function(_0x3c0cd7,_0x3e8538){var _0x4345f3={},_0x4d1a83={},_0x17b6c5={'count':0x0,'rows':[]};var _0x12238a=_[_0xbb10('0x3d')](db[_0xbb10('0x3e')]['rawAttributes'],function(_0xd238e9){return{'name':_0xd238e9[_0xbb10('0x3f')],'type':_0xd238e9['type'][_0xbb10('0x40')]};});_0x4d1a83[_0xbb10('0x41')]=_[_0xbb10('0x3d')](_0x12238a,_0xbb10('0x36'));_0x4d1a83[_0xbb10('0x42')]=_[_0xbb10('0x43')](_0x3c0cd7['query']);_0x4d1a83[_0xbb10('0x44')]=_[_0xbb10('0x45')](_0x4d1a83[_0xbb10('0x41')],_0x4d1a83[_0xbb10('0x42')]);_0x4345f3['attributes']=_[_0xbb10('0x45')](_0x4d1a83[_0xbb10('0x41')],qs[_0xbb10('0x46')](_0x3c0cd7[_0xbb10('0x42')]['fields']));_0x4345f3[_0xbb10('0x47')]=_0x4345f3[_0xbb10('0x47')]['length']?_0x4345f3['attributes']:_0x4d1a83[_0xbb10('0x41')];if(!_0x3c0cd7['query'][_0xbb10('0x48')](_0xbb10('0x49'))){_0x4345f3['limit']=qs[_0xbb10('0x2c')](_0x3c0cd7[_0xbb10('0x42')][_0xbb10('0x2c')]);_0x4345f3['offset']=qs[_0xbb10('0x2a')](_0x3c0cd7[_0xbb10('0x42')][_0xbb10('0x2a')]);}_0x4345f3[_0xbb10('0x4a')]=qs[_0xbb10('0x4b')](_0x3c0cd7[_0xbb10('0x42')][_0xbb10('0x4b')]);_0x4345f3[_0xbb10('0x4c')]=qs[_0xbb10('0x44')](_[_0xbb10('0x4d')](_0x3c0cd7[_0xbb10('0x42')],_0x4d1a83[_0xbb10('0x44')]),_0x12238a);if(_0x3c0cd7['query'][_0xbb10('0x4e')]){_0x4345f3[_0xbb10('0x4c')]=_['merge'](_0x4345f3[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x3d')](_0x12238a,function(_0x1a7df6){if(_0x1a7df6[_0xbb10('0x4f')]!==_0xbb10('0x50')){var _0x39f0de={};_0x39f0de[_0x1a7df6[_0xbb10('0x36')]]={'$like':'%'+_0x3c0cd7['query']['filter']+'%'};return _0x39f0de;}})});}_0x4345f3=_[_0xbb10('0x39')]({},_0x4345f3,_0x3c0cd7[_0xbb10('0x51')]);var _0x2b12bd={'where':_0x4345f3['where']};return db['Trunk'][_0xbb10('0x2d')](_0x2b12bd)[_0xbb10('0x1c')](function(_0x1bd054){_0x17b6c5[_0xbb10('0x2d')]=_0x1bd054;if(_0x3c0cd7[_0xbb10('0x42')][_0xbb10('0x52')]){_0x4345f3[_0xbb10('0x53')]=[{'all':!![]}];}return db[_0xbb10('0x3e')][_0xbb10('0x54')](_0x4345f3);})[_0xbb10('0x1c')](function(_0x550111){_0x17b6c5['rows']=_0x550111;return _0x17b6c5;})[_0xbb10('0x1c')](respondWithFilteredResult(_0x3e8538,_0x4345f3))[_0xbb10('0x25')](handleError(_0x3e8538,null));};exports[_0xbb10('0x55')]=function(_0xb014b0,_0x36aa7d){var _0x440f9e={'raw':![],'where':{'id':_0xb014b0[_0xbb10('0x56')]['id']}},_0x358e7e={};_0x358e7e[_0xbb10('0x41')]=_[_0xbb10('0x43')](db[_0xbb10('0x3e')][_0xbb10('0x57')]);_0x358e7e[_0xbb10('0x42')]=_[_0xbb10('0x43')](_0xb014b0[_0xbb10('0x42')]);_0x358e7e['filters']=_[_0xbb10('0x45')](_0x358e7e['model'],_0x358e7e[_0xbb10('0x42')]);_0x440f9e[_0xbb10('0x47')]=_[_0xbb10('0x45')](_0x358e7e[_0xbb10('0x41')],qs[_0xbb10('0x46')](_0xb014b0[_0xbb10('0x42')][_0xbb10('0x46')]));_0x440f9e[_0xbb10('0x47')]=_0x440f9e[_0xbb10('0x47')][_0xbb10('0x58')]?_0x440f9e[_0xbb10('0x47')]:_0x358e7e[_0xbb10('0x41')];if(_0xb014b0[_0xbb10('0x42')][_0xbb10('0x52')]){_0x440f9e[_0xbb10('0x53')]=[{'all':!![]}];}_0x440f9e=_['merge']({},_0x440f9e,_0xb014b0[_0xbb10('0x51')]);return db[_0xbb10('0x3e')][_0xbb10('0x59')](_0x440f9e)[_0xbb10('0x1c')](handleEntityNotFound(_0x36aa7d,null))[_0xbb10('0x1c')](respondWithResult(_0x36aa7d,null))[_0xbb10('0x25')](handleError(_0x36aa7d,null));};exports['clone']=function(_0x120bda,_0x4731ce){var _0x2909a1={'where':{'id':_0x120bda[_0xbb10('0x56')]['id']}},_0x14fed3={};_0x14fed3[_0xbb10('0x41')]=_[_0xbb10('0x43')](db[_0xbb10('0x3e')][_0xbb10('0x57')]);_0x2909a1[_0xbb10('0x47')]=_[_0xbb10('0x45')](_0x14fed3[_0xbb10('0x41')],qs[_0xbb10('0x46')](_0x120bda['query']['fields']));_0x2909a1[_0xbb10('0x47')]=_0x2909a1[_0xbb10('0x47')][_0xbb10('0x58')]?_0x2909a1[_0xbb10('0x47')]:_0x14fed3['model'];if(_0x120bda['query'][_0xbb10('0x52')]){_0x2909a1[_0xbb10('0x53')]=[{'all':!![]}];}_0x2909a1=_[_0xbb10('0x39')]({},_0x2909a1,_0x120bda[_0xbb10('0x51')]);return db[_0xbb10('0x3e')][_0xbb10('0x59')](_0x2909a1)[_0xbb10('0x1c')](handleEntityNotFound(_0x4731ce,null))['then'](function(_0x117e84){if(_0x117e84){var _0x216cff=_0x117e84['get']({'plain':!![]});_0x216cff=qs['omit'](_0x216cff,['id','createdAt',_0xbb10('0x5a')]);_0x120bda[_0xbb10('0x5b')]=_[_0xbb10('0x5c')](_0x120bda['body'],['id','createdAt','updatedAt']);return db[_0xbb10('0x3e')][_0xbb10('0x5d')](_[_0xbb10('0x39')](_0x216cff,_0x120bda['body']),{'include':_0x120bda[_0xbb10('0x42')][_0xbb10('0x52')]?[{'all':!![]}]:undefined})['then'](function(_0x4a560c){var _0x27d7b9=_0x120bda[_0xbb10('0x5e')][_0xbb10('0x32')]({'plain':!![]});if(!_0x27d7b9)throw new Error(_0xbb10('0x5f'));if(_0x27d7b9['role']===_0xbb10('0x5e')){var _0xec48ac=_0x4a560c[_0xbb10('0x32')]({'plain':!![]});var _0x5202d7=_0xbb10('0x33');return db[_0xbb10('0x60')][_0xbb10('0x59')]({'where':{'name':_0x5202d7,'userProfileId':_0x27d7b9['userProfileId']},'raw':!![]})[_0xbb10('0x1c')](function(_0x31e85e){if(_0x31e85e&&_0x31e85e[_0xbb10('0x61')]===0x0){return db[_0xbb10('0x34')]['create']({'name':_0xec48ac[_0xbb10('0x36')],'resourceId':_0xec48ac['id'],'type':_0x31e85e[_0xbb10('0x36')],'sectionId':_0x31e85e['id']},{})[_0xbb10('0x1c')](function(){return _0x4a560c;});}else{return _0x4a560c;}})[_0xbb10('0x25')](function(_0x56b3a3){logger[_0xbb10('0x22')](_0xbb10('0x62'),_0x56b3a3);throw _0x56b3a3;});}return _0x4a560c;});}})[_0xbb10('0x1c')](respondWithResult(_0x4731ce,0xc9))[_0xbb10('0x25')](handleError(_0x4731ce,null));};exports[_0xbb10('0x5d')]=function(_0x17807e,_0x1e4694,_0x4a30c5){var _0x4a13d7;return db['Trunk'][_0xbb10('0x5d')](_0x17807e[_0xbb10('0x5b')],{'raw':!![]})[_0xbb10('0x1c')](function(_0x5c9afc){_0x4a13d7=_0x5c9afc;return db['Trunk'][_0xbb10('0x54')]({'raw':!![]});})[_0xbb10('0x1c')](function(_0xd9e743){var _0x3a9677=fs[_0xbb10('0x63')](path[_0xbb10('0x64')](config['root'],_0xbb10('0x65')),_0xbb10('0x66'));var _0x270fdb=fs[_0xbb10('0x63')](path[_0xbb10('0x64')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x329da7=ejs[_0xbb10('0x38')](_0x3a9677,{'trunks':_0xd9e743||[]});fs[_0xbb10('0x67')](_0xbb10('0x68'),_0x329da7);if(_0x4a13d7[_0xbb10('0x69')]){var _0x1d40b8=ejs['render'](_0x270fdb,{'trunks':_0xd9e743||[]});fs[_0xbb10('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x1d40b8);}})['then'](function(){return respondWithRpcPromise('Reload',_0xbb10('0x5d'),{'module':_0xbb10('0x6a')});})[_0xbb10('0x1c')](function(){var _0x108f99=_0x17807e['user'][_0xbb10('0x32')]({'plain':!![]});if(!_0x108f99)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x108f99['role']===_0xbb10('0x5e')){var _0xfe3db0=_0x4a13d7[_0xbb10('0x32')]({'plain':!![]});return db[_0xbb10('0x60')][_0xbb10('0x59')]({'where':{'name':'Trunks','userProfileId':_0x108f99[_0xbb10('0x6b')]},'raw':!![]})[_0xbb10('0x1c')](function(_0x2c6429){if(_0x2c6429&&_0x2c6429[_0xbb10('0x61')]===0x0){return db[_0xbb10('0x34')][_0xbb10('0x5d')]({'name':_0xfe3db0[_0xbb10('0x36')],'resourceId':_0xfe3db0['id'],'type':_0x2c6429['name'],'sectionId':_0x2c6429['id']},{})[_0xbb10('0x1c')](function(){return _0x4a13d7;});}else{return _0x4a13d7;}})[_0xbb10('0x25')](function(_0x30f3ea){logger[_0xbb10('0x22')](_0xbb10('0x62'),_0x30f3ea);throw _0x30f3ea;});}return _0x4a13d7;})[_0xbb10('0x1c')](respondWithResult(_0x1e4694,0xc9))[_0xbb10('0x25')](handleError(_0x1e4694,null));};exports[_0xbb10('0x30')]=function(_0x5a4429,_0x428146,_0x218690){var _0x145baf;return db['Trunk']['find']({'where':{'id':_0x5a4429['params']['id']}})[_0xbb10('0x1c')](handleEntityNotFound(_0x428146,null))['then'](saveUpdates(_0x5a4429['body'],null))[_0xbb10('0x1c')](function(_0x3ee56b){if(_0x3ee56b){_0x145baf=_0x3ee56b;return db[_0xbb10('0x3e')][_0xbb10('0x54')]({'raw':!![]});}})[_0xbb10('0x1c')](function(_0x24dca6){if(_0x24dca6){var _0x33116=fs[_0xbb10('0x63')](path[_0xbb10('0x64')](config['root'],_0xbb10('0x65')),_0xbb10('0x66'));var _0x46b6d2=fs[_0xbb10('0x63')](path['join'](config['root'],_0xbb10('0x6c')),_0xbb10('0x66'));var _0x30f0a4=ejs[_0xbb10('0x38')](_0x33116,{'trunks':_0x24dca6||[]});fs['writeFileSync'](_0xbb10('0x68'),_0x30f0a4);var _0x275bce=ejs[_0xbb10('0x38')](_0x46b6d2,{'trunks':_0x24dca6||[]});fs[_0xbb10('0x67')](_0xbb10('0x6d'),_0x275bce);return respondWithRpcPromise('Reload','update',{'module':_0xbb10('0x6a')});}return null;})[_0xbb10('0x1c')](function(_0x22c030){if(_0x22c030){return _0x145baf;}})['then'](respondWithResult(_0x428146,null))[_0xbb10('0x25')](handleError(_0x428146,null));};exports[_0xbb10('0x31')]=function(_0x50bcc9,_0x5caa06,_0x2f667f){var _0x26d0dd;return db[_0xbb10('0x3e')]['find']({'where':{'id':_0x50bcc9[_0xbb10('0x56')]['id']}})[_0xbb10('0x1c')](handleEntityNotFound(_0x5caa06,null))[_0xbb10('0x1c')](removeEntity(_0x5caa06,null))[_0xbb10('0x1c')](function(){return db[_0xbb10('0x3e')][_0xbb10('0x54')]({'raw':!![]});})[_0xbb10('0x1c')](function(_0x226363){var _0x3e6246=fs['readFileSync'](path[_0xbb10('0x64')](config[_0xbb10('0x6e')],_0xbb10('0x65')),_0xbb10('0x66'));var _0x3e3083=fs[_0xbb10('0x63')](path[_0xbb10('0x64')](config[_0xbb10('0x6e')],_0xbb10('0x6c')),_0xbb10('0x66'));var _0x15e043=ejs[_0xbb10('0x38')](_0x3e6246,{'trunks':_0x226363});var _0x59e985=ejs['render'](_0x3e3083,{'trunks':_0x226363});fs[_0xbb10('0x67')](_0xbb10('0x68'),_0x15e043);fs[_0xbb10('0x67')](_0xbb10('0x6d'),_0x59e985);return respondWithRpcPromise(_0xbb10('0x6f'),'destroy',{'module':_0xbb10('0x6a')});})[_0xbb10('0x25')](handleError(_0x5caa06,null));}; \ No newline at end of file +var _0x0713=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','destroy','get','Trunks','UserProfileResource','stack','name','render','merge','agent','interaction','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','options','include','findAll','rows','show','params','rawAttributes','find','clone','includeAll','omit','updatedAt','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','/etc/asterisk/sip_xcally_trunks.conf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x78d380,_0x3f21fc){var _0x4d9c95=function(_0x32fd12){while(--_0x32fd12){_0x78d380['push'](_0x78d380['shift']());}};_0x4d9c95(++_0x3f21fc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x3071('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5dc13b,_0x31c220,_0x44fbae,_0x5d4883){return new BPromise(function(_0x104e73,_0x4e1219){var _0x2fc15d=_0x5d4883||client;return _0x2fc15d[_0x3071('0x1c')](_0x5dc13b,_0x44fbae)[_0x3071('0x1d')](function(_0x1f14e1){logger[_0x3071('0x1e')](_0x3071('0x1f'),_0x31c220,_0x3071('0x20'));logger[_0x3071('0x21')](_0x3071('0x22'),_0x31c220,_0x3071('0x20'),JSON['stringify'](_0x1f14e1));if(_0x1f14e1[_0x3071('0x23')]){if(_0x1f14e1[_0x3071('0x23')][_0x3071('0x24')]===0x1f4){logger[_0x3071('0x23')](_0x3071('0x1f'),_0x31c220,_0x1f14e1[_0x3071('0x23')][_0x3071('0x25')]);return _0x4e1219(_0x1f14e1[_0x3071('0x23')]['message']);}logger[_0x3071('0x23')](_0x3071('0x1f'),_0x31c220,_0x1f14e1[_0x3071('0x23')]['message']);return _0x104e73(_0x1f14e1[_0x3071('0x23')]['message']);}else{logger[_0x3071('0x1e')](_0x3071('0x1f'),_0x31c220,_0x3071('0x20'));_0x104e73(_0x1f14e1[_0x3071('0x26')][_0x3071('0x25')]);}})[_0x3071('0x27')](function(_0x3c5cef){logger[_0x3071('0x23')]('Trunk,\x20%s,\x20%s',_0x31c220,_0x3c5cef);_0x4e1219(_0x3c5cef);});});}function respondWithStatusCode(_0x481a51,_0x2ce48a){_0x2ce48a=_0x2ce48a||0xcc;return function(_0xb05b1d){if(_0xb05b1d){return _0x481a51[_0x3071('0x28')](_0x2ce48a);}return _0x481a51[_0x3071('0x29')](_0x2ce48a)[_0x3071('0x2a')]();};}function respondWithResult(_0x44b45f,_0x7a4cb4){_0x7a4cb4=_0x7a4cb4||0xc8;return function(_0x1fe727){if(_0x1fe727){return _0x44b45f[_0x3071('0x29')](_0x7a4cb4)['json'](_0x1fe727);}};}function respondWithFilteredResult(_0x2e5f93,_0x3f1e6e){return function(_0x177138){if(_0x177138){var _0x4d5c4b=typeof _0x3f1e6e[_0x3071('0x2b')]===_0x3071('0x2c')&&typeof _0x3f1e6e[_0x3071('0x2d')]===_0x3071('0x2c');var _0x3fa3b8=_0x177138[_0x3071('0x2e')];var _0x177b5f=_0x4d5c4b?0x0:_0x3f1e6e[_0x3071('0x2b')];var _0x32f1b4=_0x4d5c4b?_0x177138[_0x3071('0x2e')]:_0x3f1e6e[_0x3071('0x2b')]+_0x3f1e6e['limit'];var _0x4f1484;if(_0x32f1b4>=_0x3fa3b8){_0x32f1b4=_0x3fa3b8;_0x4f1484=0xc8;}else{_0x4f1484=0xce;}_0x2e5f93[_0x3071('0x29')](_0x4f1484);return _0x2e5f93[_0x3071('0x2f')](_0x3071('0x30'),_0x177b5f+'-'+_0x32f1b4+'/'+_0x3fa3b8)[_0x3071('0x31')](_0x177138);}return null;};}function patchUpdates(_0x3f6d90){return function(_0x29538c){try{jsonpatch[_0x3071('0x32')](_0x29538c,_0x3f6d90,!![]);}catch(_0x1ccc41){return BPromise['reject'](_0x1ccc41);}return _0x29538c['save']();};}function saveUpdates(_0x4ab983,_0x1b0aaf){return function(_0x392800){if(_0x392800){return _0x392800['update'](_0x4ab983)[_0x3071('0x1d')](function(_0x28747d){return _0x28747d;});}return null;};}function removeEntity(_0x25250e,_0x13ae2c){return function(_0x5e1d2b){if(_0x5e1d2b){return _0x5e1d2b[_0x3071('0x33')]()[_0x3071('0x1d')](function(){var _0x602719=_0x5e1d2b[_0x3071('0x34')]({'plain':!![]});var _0x148096=_0x3071('0x35');return db[_0x3071('0x36')][_0x3071('0x33')]({'where':{'type':_0x148096,'resourceId':_0x602719['id']}})['then'](function(){return _0x5e1d2b;});})[_0x3071('0x1d')](function(){_0x25250e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a1a64,_0xa3a7ae){return function(_0x54d9c3){if(!_0x54d9c3){_0x1a1a64[_0x3071('0x28')](0x194);}return _0x54d9c3;};}function handleError(_0x46e94e,_0x265d76){_0x265d76=_0x265d76||0x1f4;return function(_0x14ac42){logger[_0x3071('0x23')](_0x14ac42[_0x3071('0x37')]);if(_0x14ac42['name']){delete _0x14ac42[_0x3071('0x38')];}_0x46e94e[_0x3071('0x29')](_0x265d76)['send'](_0x14ac42);};}function getMustacheRender(_0x44ad05,_0x5b1392){return Mustache[_0x3071('0x39')](_0x44ad05,_[_0x3071('0x3a')](_0x5b1392['body'],{'contact':_0x5b1392['contact'],'message':_0x5b1392[_0x3071('0x25')],'agent':_0x5b1392[_0x3071('0x3b')],'interaction':_0x5b1392[_0x3071('0x3c')],'account':_0x5b1392['account']}))||'';}exports[_0x3071('0x3d')]=function(_0x534a77,_0x1ac90a){var _0x4b7928={},_0x7c1782={},_0x100650={'count':0x0,'rows':[]};var _0x1fcc52=_[_0x3071('0x3e')](db[_0x3071('0x3f')]['rawAttributes'],function(_0x53ed25){return{'name':_0x53ed25[_0x3071('0x40')],'type':_0x53ed25[_0x3071('0x41')][_0x3071('0x42')]};});_0x7c1782[_0x3071('0x43')]=_['map'](_0x1fcc52,_0x3071('0x38'));_0x7c1782[_0x3071('0x44')]=_[_0x3071('0x45')](_0x534a77[_0x3071('0x44')]);_0x7c1782[_0x3071('0x46')]=_[_0x3071('0x47')](_0x7c1782['model'],_0x7c1782[_0x3071('0x44')]);_0x4b7928['attributes']=_['intersection'](_0x7c1782['model'],qs['fields'](_0x534a77[_0x3071('0x44')][_0x3071('0x48')]));_0x4b7928[_0x3071('0x49')]=_0x4b7928[_0x3071('0x49')][_0x3071('0x4a')]?_0x4b7928[_0x3071('0x49')]:_0x7c1782[_0x3071('0x43')];if(!_0x534a77[_0x3071('0x44')]['hasOwnProperty'](_0x3071('0x4b'))){_0x4b7928[_0x3071('0x2d')]=qs[_0x3071('0x2d')](_0x534a77[_0x3071('0x44')][_0x3071('0x2d')]);_0x4b7928['offset']=qs['offset'](_0x534a77[_0x3071('0x44')][_0x3071('0x2b')]);}_0x4b7928[_0x3071('0x4c')]=qs[_0x3071('0x4d')](_0x534a77[_0x3071('0x44')]['sort']);_0x4b7928[_0x3071('0x4e')]=qs['filters'](_[_0x3071('0x4f')](_0x534a77['query'],_0x7c1782['filters']),_0x1fcc52);if(_0x534a77[_0x3071('0x44')]['filter']){_0x4b7928[_0x3071('0x4e')]=_['merge'](_0x4b7928[_0x3071('0x4e')],{'$or':_[_0x3071('0x3e')](_0x1fcc52,function(_0x861889){if(_0x861889[_0x3071('0x41')]!=='VIRTUAL'){var _0x2d70bf={};_0x2d70bf[_0x861889['name']]={'$like':'%'+_0x534a77[_0x3071('0x44')]['filter']+'%'};return _0x2d70bf;}})});}_0x4b7928=_[_0x3071('0x3a')]({},_0x4b7928,_0x534a77[_0x3071('0x50')]);var _0x4d395a={'where':_0x4b7928[_0x3071('0x4e')]};return db[_0x3071('0x3f')][_0x3071('0x2e')](_0x4d395a)[_0x3071('0x1d')](function(_0x349adb){_0x100650[_0x3071('0x2e')]=_0x349adb;if(_0x534a77[_0x3071('0x44')]['includeAll']){_0x4b7928[_0x3071('0x51')]=[{'all':!![]}];}return db[_0x3071('0x3f')][_0x3071('0x52')](_0x4b7928);})[_0x3071('0x1d')](function(_0x4f676e){_0x100650[_0x3071('0x53')]=_0x4f676e;return _0x100650;})[_0x3071('0x1d')](respondWithFilteredResult(_0x1ac90a,_0x4b7928))[_0x3071('0x27')](handleError(_0x1ac90a,null));};exports[_0x3071('0x54')]=function(_0x22aade,_0x26c8e4){var _0x3ab6d4={'raw':![],'where':{'id':_0x22aade[_0x3071('0x55')]['id']}},_0x390944={};_0x390944[_0x3071('0x43')]=_[_0x3071('0x45')](db[_0x3071('0x3f')][_0x3071('0x56')]);_0x390944[_0x3071('0x44')]=_[_0x3071('0x45')](_0x22aade[_0x3071('0x44')]);_0x390944['filters']=_['intersection'](_0x390944[_0x3071('0x43')],_0x390944['query']);_0x3ab6d4[_0x3071('0x49')]=_[_0x3071('0x47')](_0x390944[_0x3071('0x43')],qs['fields'](_0x22aade[_0x3071('0x44')][_0x3071('0x48')]));_0x3ab6d4['attributes']=_0x3ab6d4['attributes'][_0x3071('0x4a')]?_0x3ab6d4[_0x3071('0x49')]:_0x390944[_0x3071('0x43')];if(_0x22aade[_0x3071('0x44')]['includeAll']){_0x3ab6d4[_0x3071('0x51')]=[{'all':!![]}];}_0x3ab6d4=_[_0x3071('0x3a')]({},_0x3ab6d4,_0x22aade[_0x3071('0x50')]);return db[_0x3071('0x3f')][_0x3071('0x57')](_0x3ab6d4)['then'](handleEntityNotFound(_0x26c8e4,null))[_0x3071('0x1d')](respondWithResult(_0x26c8e4,null))[_0x3071('0x27')](handleError(_0x26c8e4,null));};exports[_0x3071('0x58')]=function(_0x27bad1,_0x12d6be){var _0x24f429={'where':{'id':_0x27bad1['params']['id']}},_0x71d921={};_0x71d921['model']=_[_0x3071('0x45')](db['Trunk'][_0x3071('0x56')]);_0x24f429[_0x3071('0x49')]=_['intersection'](_0x71d921[_0x3071('0x43')],qs[_0x3071('0x48')](_0x27bad1['query'][_0x3071('0x48')]));_0x24f429[_0x3071('0x49')]=_0x24f429[_0x3071('0x49')][_0x3071('0x4a')]?_0x24f429[_0x3071('0x49')]:_0x71d921['model'];if(_0x27bad1[_0x3071('0x44')][_0x3071('0x59')]){_0x24f429[_0x3071('0x51')]=[{'all':!![]}];}_0x24f429=_['merge']({},_0x24f429,_0x27bad1[_0x3071('0x50')]);return db[_0x3071('0x3f')][_0x3071('0x57')](_0x24f429)[_0x3071('0x1d')](handleEntityNotFound(_0x12d6be,null))[_0x3071('0x1d')](function(_0x210123){if(_0x210123){var _0xe93f28=_0x210123[_0x3071('0x34')]({'plain':!![]});_0xe93f28=qs[_0x3071('0x5a')](_0xe93f28,['id','createdAt',_0x3071('0x5b')]);_0x27bad1[_0x3071('0x5c')]=_[_0x3071('0x5a')](_0x27bad1[_0x3071('0x5c')],['id',_0x3071('0x5d'),_0x3071('0x5b')]);return db[_0x3071('0x3f')][_0x3071('0x5e')](_[_0x3071('0x3a')](_0xe93f28,_0x27bad1[_0x3071('0x5c')]),{'include':_0x27bad1[_0x3071('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0x3071('0x1d')](function(_0x315044){var _0x279594=_0x27bad1[_0x3071('0x5f')][_0x3071('0x34')]({'plain':!![]});if(!_0x279594)throw new Error(_0x3071('0x60'));if(_0x279594[_0x3071('0x61')]===_0x3071('0x5f')){var _0x52fddc=_0x315044[_0x3071('0x34')]({'plain':!![]});var _0x1ebd77='Trunks';return db['UserProfileSection'][_0x3071('0x57')]({'where':{'name':_0x1ebd77,'userProfileId':_0x279594[_0x3071('0x62')]},'raw':!![]})[_0x3071('0x1d')](function(_0x38bc1f){if(_0x38bc1f&&_0x38bc1f['autoAssociation']===0x0){return db['UserProfileResource'][_0x3071('0x5e')]({'name':_0x52fddc['name'],'resourceId':_0x52fddc['id'],'type':_0x38bc1f['name'],'sectionId':_0x38bc1f['id']},{})['then'](function(){return _0x315044;});}else{return _0x315044;}})['catch'](function(_0xec6f46){logger[_0x3071('0x23')](_0x3071('0x63'),_0xec6f46);throw _0xec6f46;});}return _0x315044;});}})['then'](respondWithResult(_0x12d6be,0xc9))[_0x3071('0x27')](handleError(_0x12d6be,null));};exports[_0x3071('0x5e')]=function(_0xc5749b,_0x19a03d,_0x5a0c1b){var _0x2103a4;return db[_0x3071('0x3f')]['create'](_0xc5749b[_0x3071('0x5c')],{'raw':!![]})[_0x3071('0x1d')](function(_0x388cd1){_0x2103a4=_0x388cd1;return db[_0x3071('0x3f')][_0x3071('0x52')]({'raw':!![]});})[_0x3071('0x1d')](function(_0x2deac2){var _0x5d83aa=fs['readFileSync'](path[_0x3071('0x64')](config[_0x3071('0x65')],_0x3071('0x66')),'utf8');var _0x53ebfe=fs[_0x3071('0x67')](path[_0x3071('0x64')](config[_0x3071('0x65')],_0x3071('0x68')),_0x3071('0x69'));var _0x314ce6=ejs[_0x3071('0x39')](_0x5d83aa,{'trunks':_0x2deac2||[]});fs[_0x3071('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x314ce6);if(_0x2103a4[_0x3071('0x6b')]){var _0x5ea33f=ejs[_0x3071('0x39')](_0x53ebfe,{'trunks':_0x2deac2||[]});fs[_0x3071('0x6a')](_0x3071('0x6c'),_0x5ea33f);}})[_0x3071('0x1d')](function(){return respondWithRpcPromise(_0x3071('0x6d'),_0x3071('0x5e'),{'module':_0x3071('0x6e')});})[_0x3071('0x1d')](function(){var _0x4fa372=_0xc5749b[_0x3071('0x5f')][_0x3071('0x34')]({'plain':!![]});if(!_0x4fa372)throw new Error(_0x3071('0x60'));if(_0x4fa372['role']===_0x3071('0x5f')){var _0x22ec7b=_0x2103a4[_0x3071('0x34')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x3071('0x35'),'userProfileId':_0x4fa372['userProfileId']},'raw':!![]})[_0x3071('0x1d')](function(_0x10a207){if(_0x10a207&&_0x10a207[_0x3071('0x6f')]===0x0){return db[_0x3071('0x36')][_0x3071('0x5e')]({'name':_0x22ec7b[_0x3071('0x38')],'resourceId':_0x22ec7b['id'],'type':_0x10a207[_0x3071('0x38')],'sectionId':_0x10a207['id']},{})['then'](function(){return _0x2103a4;});}else{return _0x2103a4;}})[_0x3071('0x27')](function(_0x5e2b17){logger[_0x3071('0x23')](_0x3071('0x63'),_0x5e2b17);throw _0x5e2b17;});}return _0x2103a4;})[_0x3071('0x1d')](respondWithResult(_0x19a03d,0xc9))[_0x3071('0x27')](handleError(_0x19a03d,null));};exports[_0x3071('0x70')]=function(_0x277377,_0x4bc640,_0x254adf){var _0x5ed436;return db[_0x3071('0x3f')][_0x3071('0x57')]({'where':{'id':_0x277377[_0x3071('0x55')]['id']}})[_0x3071('0x1d')](handleEntityNotFound(_0x4bc640,null))[_0x3071('0x1d')](saveUpdates(_0x277377[_0x3071('0x5c')],null))[_0x3071('0x1d')](function(_0x32b961){if(_0x32b961){_0x5ed436=_0x32b961;return db[_0x3071('0x3f')][_0x3071('0x52')]({'raw':!![]});}})['then'](function(_0x456921){if(_0x456921){var _0x208864=fs['readFileSync'](path[_0x3071('0x64')](config[_0x3071('0x65')],_0x3071('0x66')),_0x3071('0x69'));var _0x37a707=fs['readFileSync'](path['join'](config[_0x3071('0x65')],'server/files/templates/registry.ejs'),_0x3071('0x69'));var _0x1f4509=ejs[_0x3071('0x39')](_0x208864,{'trunks':_0x456921||[]});fs[_0x3071('0x6a')](_0x3071('0x71'),_0x1f4509);var _0x2f31b7=ejs['render'](_0x37a707,{'trunks':_0x456921||[]});fs[_0x3071('0x6a')](_0x3071('0x6c'),_0x2f31b7);return respondWithRpcPromise(_0x3071('0x6d'),_0x3071('0x70'),{'module':'chan_sip.so'});}return null;})[_0x3071('0x1d')](function(_0x446546){if(_0x446546){return _0x5ed436;}})['then'](respondWithResult(_0x4bc640,null))[_0x3071('0x27')](handleError(_0x4bc640,null));};exports[_0x3071('0x33')]=function(_0x391887,_0x10bc5b,_0x34e4f3){var _0x547ba8;return db[_0x3071('0x3f')]['find']({'where':{'id':_0x391887[_0x3071('0x55')]['id']}})[_0x3071('0x1d')](handleEntityNotFound(_0x10bc5b,null))[_0x3071('0x1d')](removeEntity(_0x10bc5b,null))[_0x3071('0x1d')](function(){return db[_0x3071('0x3f')][_0x3071('0x52')]({'raw':!![]});})[_0x3071('0x1d')](function(_0x32b2e2){var _0x4ed248=fs[_0x3071('0x67')](path[_0x3071('0x64')](config[_0x3071('0x65')],'server/files/templates/trunk.ejs'),_0x3071('0x69'));var _0x5d22b0=fs[_0x3071('0x67')](path[_0x3071('0x64')](config[_0x3071('0x65')],'server/files/templates/registry.ejs'),_0x3071('0x69'));var _0x2ef706=ejs[_0x3071('0x39')](_0x4ed248,{'trunks':_0x32b2e2});var _0x9cc58c=ejs[_0x3071('0x39')](_0x5d22b0,{'trunks':_0x32b2e2});fs[_0x3071('0x6a')](_0x3071('0x71'),_0x2ef706);fs[_0x3071('0x6a')](_0x3071('0x6c'),_0x9cc58c);return respondWithRpcPromise('Reload',_0x3071('0x33'),{'module':_0x3071('0x6e')});})[_0x3071('0x27')](handleError(_0x10bc5b,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 184a303..303014c 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 _0x7902=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger'];(function(_0x44206b,_0x3a0e76){var _0x2e405e=function(_0x598a6d){while(--_0x598a6d){_0x44206b['push'](_0x44206b['shift']());}};_0x2e405e(++_0x3a0e76);}(_0x7902,0x190));var _0x2790=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x7902[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x2790('0x0'));var util=require(_0x2790('0x1'));var logger=require(_0x2790('0x2'))(_0x2790('0x3'));var moment=require(_0x2790('0x4'));var BPromise=require(_0x2790('0x5'));var rp=require(_0x2790('0x6'));var fs=require('fs');var path=require(_0x2790('0x7'));var rimraf=require('rimraf');var config=require(_0x2790('0x8'));var attributes=require('./trunk.attributes');module[_0x2790('0x9')]=function(_0x40374a,_0x485198){return _0x40374a[_0x2790('0xa')](_0x2790('0xb'),attributes,{'tableName':_0x2790('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bad=['moment','bluebird','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','util','../../config/logger'];(function(_0x2ee9ff,_0x525e5f){var _0xaebf62=function(_0x4e4f60){while(--_0x4e4f60){_0x2ee9ff['push'](_0x2ee9ff['shift']());}};_0xaebf62(++_0x525e5f);}(_0x7bad,0x195));var _0xd7ba=function(_0x431979,_0x2b3eb6){_0x431979=_0x431979-0x0;var _0x731032=_0x7bad[_0x431979];return _0x731032;};'use strict';var _=require('lodash');var util=require(_0xd7ba('0x0'));var logger=require(_0xd7ba('0x1'))('api');var moment=require(_0xd7ba('0x2'));var BPromise=require(_0xd7ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd7ba('0x4'));var config=require(_0xd7ba('0x5'));var attributes=require(_0xd7ba('0x6'));module[_0xd7ba('0x7')]=function(_0x1bfb48,_0x4f1a48){return _0x1bfb48[_0xd7ba('0x8')](_0xd7ba('0x9'),attributes,{'tableName':_0xd7ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 66c66be..cc9b5d7 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','catch','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','GetTrunk','debug','stringify','ShowTrunk','find','lodash'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x66fa,0x117));var _0xa66f=function(_0x24df0c,_0x535c83){_0x24df0c=_0x24df0c-0x0;var _0x21489d=_0x66fa[_0x24df0c];return _0x21489d;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Trunk,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Trunk,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['GetTrunk']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')]({'raw':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x18')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'limit':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1a')]||null:null,'include':_0x1cbe64['options']?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0x1cbe64[_0xa66f('0x16')]['include'],function(_0x337602){return{'model':db[_0x337602[_0xa66f('0x1d')]],'as':_0x337602['as'],'attributes':_0x337602[_0xa66f('0x19')],'include':_0x337602[_0xa66f('0x1b')]?_['map'](_0x337602['include'],function(_0xed98b9){return{'model':db[_0xed98b9['model']],'as':_0xed98b9['as'],'attributes':_0xed98b9[_0xa66f('0x19')],'include':_0xed98b9[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xed98b9['include'],function(_0x4683c7){return{'model':db[_0x4683c7[_0xa66f('0x1d')]],'as':_0x4683c7['as'],'attributes':_0x4683c7[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x17c103){logger[_0xa66f('0xc')](_0xa66f('0x1e'),_0x1cbe64);logger[_0xa66f('0x1f')](_0xa66f('0x1e'),_0x1cbe64,JSON[_0xa66f('0x20')](_0x17c103));_0x4a28d4(_0x17c103);})[_0xa66f('0x13')](function(_0x63650b){logger[_0xa66f('0xf')](_0xa66f('0x1e'),_0x63650b['message'],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x63650b[_0xa66f('0x12')]));});});};exports[_0xa66f('0x21')]=function(_0x55f309){var _0x44c79a=this;return new Promise(function(_0x2de5f3,_0x4cd7f2){return db[_0xa66f('0x14')][_0xa66f('0x22')]({'raw':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x55f309['options']?_0x55f309[_0xa66f('0x16')]['where']||null:null,'attributes':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'include':_0x55f309['options']?_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')]?_['map'](_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')],function(_0xba9457){return{'model':db[_0xba9457[_0xa66f('0x1d')]],'as':_0xba9457['as'],'attributes':_0xba9457[_0xa66f('0x19')],'include':_0xba9457[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xba9457[_0xa66f('0x1b')],function(_0x35ef27){return{'model':db[_0x35ef27[_0xa66f('0x1d')]],'as':_0x35ef27['as'],'attributes':_0x35ef27['attributes'],'include':_0x35ef27[_0xa66f('0x1b')]?_['map'](_0x35ef27[_0xa66f('0x1b')],function(_0x46f6cc){return{'model':db[_0x46f6cc[_0xa66f('0x1d')]],'as':_0x46f6cc['as'],'attributes':_0x46f6cc[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x201432){logger[_0xa66f('0xc')](_0xa66f('0x21'),_0x55f309);logger['debug'](_0xa66f('0x21'),_0x55f309,JSON['stringify'](_0x201432));_0x2de5f3(_0x201432);})[_0xa66f('0x13')](function(_0x45eeb8){logger[_0xa66f('0xf')]('ShowTrunk',_0x45eeb8['message'],_0x55f309);_0x4cd7f2(_0x44c79a[_0xa66f('0xf')](0x1f4,_0x45eeb8[_0xa66f('0x12')]));});});}; \ No newline at end of file +var _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xcb56c7,_0x5b00ef){var _0x2906fa=function(_0x21a7f0){while(--_0x21a7f0){_0xcb56c7['push'](_0xcb56c7['shift']());}};_0x2906fa(++_0x5b00ef);}(_0x2032,0xd9));var _0x2203=function(_0x5bbdcf,_0x13c3ae){_0x5bbdcf=_0x5bbdcf-0x0;var _0x3c0702=_0x2032[_0x5bbdcf];return _0x3c0702;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 6923123..22e08b2 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 _0xaa19=['delete','/:id/chat_interactions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./user.controller','get','index','/describe','describe','isAuthenticated','whoami','/presence','getAvatar','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','addQueues','diskStorage','join','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','pause','/:id/unpause','unpause','addChatInteractions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addSquareProjects','put','/:id','update','/:id/password','changePassword','removeQueues','/:id/teams'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xaa19,0x79));var _0x9aa1=function(_0x32a026,_0x4f777b){_0x32a026=_0x32a026-0x0;var _0x251a0e=_0xaa19[_0x32a026];return _0x251a0e;};'use strict';var multer=require(_0x9aa1('0x0'));var util=require(_0x9aa1('0x1'));var path=require(_0x9aa1('0x2'));var timeout=require(_0x9aa1('0x3'));var express=require('express');var router=express[_0x9aa1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9aa1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9aa1('0x6'));var controller=require(_0x9aa1('0x7'));router[_0x9aa1('0x8')]('/',auth['isAuthenticated'](),controller[_0x9aa1('0x9')]);router[_0x9aa1('0x8')](_0x9aa1('0xa'),auth['isAuthenticated'](),controller[_0x9aa1('0xb')]);router['get']('/whoami',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0xd')]);router[_0x9aa1('0x8')](_0x9aa1('0xe'),auth['isAuthenticated'](),controller['getPresence']);router[_0x9aa1('0x8')]('/:id',auth[_0x9aa1('0xc')](),controller['show']);router['get']('/:id/avatar',controller[_0x9aa1('0xf')]);router[_0x9aa1('0x8')]('/:id/open_tabs',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x10')]);router[_0x9aa1('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x9aa1('0x11')]);router['get'](_0x9aa1('0x12'),auth['isAuthenticated'](),controller[_0x9aa1('0x13')]);router[_0x9aa1('0x8')](_0x9aa1('0x14'),auth[_0x9aa1('0xc')](),controller['getVoiceQueuesRt']);router['get'](_0x9aa1('0x15'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x16')]);router[_0x9aa1('0x8')](_0x9aa1('0x17'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x18')]);router[_0x9aa1('0x8')](_0x9aa1('0x19'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x1a')]);router['get']('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x9aa1('0x1b')]);router[_0x9aa1('0x8')]('/:id/openchannel/interactions',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x1c')]);router[_0x9aa1('0x8')](_0x9aa1('0x1d'),auth['isAuthenticated'](),controller['getMailInteractions']);router['get'](_0x9aa1('0x1e'),auth['isAuthenticated'](),controller[_0x9aa1('0x1f')]);router[_0x9aa1('0x8')](_0x9aa1('0x20'),auth['isAuthenticated'](),controller[_0x9aa1('0x21')]);router[_0x9aa1('0x8')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x9aa1('0x22')]);router[_0x9aa1('0x8')]('/:id/teams',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x23')]);router[_0x9aa1('0x8')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x9aa1('0x8')]('/:id/agents',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x24')]);router[_0x9aa1('0x8')](_0x9aa1('0x25'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router['get'](_0x9aa1('0x26'),auth[_0x9aa1('0xc')](),controller['getFaxAccounts']);router['get'](_0x9aa1('0x27'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x28')]);router[_0x9aa1('0x8')](_0x9aa1('0x29'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x2a')]);router[_0x9aa1('0x8')]('/:id/sms_accounts',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x2b')]);router[_0x9aa1('0x8')]('/:id/chat_websites',auth[_0x9aa1('0xc')](),controller['getChatWebsites']);router[_0x9aa1('0x8')](_0x9aa1('0x2c'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x2d')]);router[_0x9aa1('0x8')](_0x9aa1('0x2e'),auth['isAuthenticated'](),controller[_0x9aa1('0x2f')]);router[_0x9aa1('0x8')]('/:id/scheduled_calls',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x30')]);router[_0x9aa1('0x8')](_0x9aa1('0x31'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x32')]);router[_0x9aa1('0x33')]('/:id/contacts',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x34')]);router['post']('/',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x35')]);router[_0x9aa1('0x33')]('/create_many',auth[_0x9aa1('0xc')](),controller['bulkCreate']);router['post'](_0x9aa1('0x12'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x36')]);var upload=multer({'storage':multer[_0x9aa1('0x37')]({'destination':function(_0x405cb1,_0x199fc5,_0x26a8d8){_0x26a8d8(null,path[_0x9aa1('0x38')](config['root'],_0x9aa1('0x39')));},'filename':function(_0x23e9a2,_0x9771a4,_0x340133){_0x340133(null,util['format'](_0x9aa1('0x3a'),Date[_0x9aa1('0x3b')](),_0x9771a4[_0x9aa1('0x3c')]));}})});router[_0x9aa1('0x33')]('/:id/avatar',upload[_0x9aa1('0x3d')](_0x9aa1('0x3e')),controller[_0x9aa1('0x3f')]);router[_0x9aa1('0x33')](_0x9aa1('0x40'),auth['isAuthenticated'](),controller['login']);router[_0x9aa1('0x33')](_0x9aa1('0x41'),auth['isAuthenticated'](),controller[_0x9aa1('0x42')]);router[_0x9aa1('0x33')]('/:id/pause',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x43')]);router[_0x9aa1('0x33')](_0x9aa1('0x44'),auth['isAuthenticated'](),controller[_0x9aa1('0x45')]);router[_0x9aa1('0x33')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x9aa1('0x33')]('/:id/chat_interactions',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x46')]);router[_0x9aa1('0x33')]('/:id/mail_interactions',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x47')]);router[_0x9aa1('0x33')]('/:id/fax_interactions',auth[_0x9aa1('0xc')](),controller['addFaxInteractions']);router[_0x9aa1('0x33')](_0x9aa1('0x48'),auth['isAuthenticated'](),controller[_0x9aa1('0x49')]);router['post'](_0x9aa1('0x4a'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x4b')]);router[_0x9aa1('0x33')](_0x9aa1('0x4c'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x4d')]);router['post'](_0x9aa1('0x26'),auth[_0x9aa1('0xc')](),controller['addFaxAccounts']);router[_0x9aa1('0x33')]('/:id/mail_accounts',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x4e')]);router[_0x9aa1('0x33')](_0x9aa1('0x29'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x4f')]);router[_0x9aa1('0x33')](_0x9aa1('0x50'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x51')]);router[_0x9aa1('0x33')](_0x9aa1('0x52'),auth[_0x9aa1('0xc')](),controller['addChatWebsites']);router[_0x9aa1('0x33')](_0x9aa1('0x2c'),auth[_0x9aa1('0xc')](),controller['addWhatsappAccounts']);router[_0x9aa1('0x33')](_0x9aa1('0x2e'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x53')]);router[_0x9aa1('0x33')](_0x9aa1('0x31'),auth[_0x9aa1('0xc')](),controller['createApiKey']);router[_0x9aa1('0x54')](_0x9aa1('0x55'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x56')]);router['put'](_0x9aa1('0x57'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x58')]);router['delete'](_0x9aa1('0x12'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x59')]);router['delete'](_0x9aa1('0x5a'),auth[_0x9aa1('0xc')](),controller['removeTeams']);router['delete'](_0x9aa1('0x55'),auth[_0x9aa1('0xc')](),controller['destroy']);router[_0x9aa1('0x5b')](_0x9aa1('0x5c'),auth[_0x9aa1('0xc')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x5d')]);router[_0x9aa1('0x5b')](_0x9aa1('0x5e'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x5f')]);router[_0x9aa1('0x5b')](_0x9aa1('0x48'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x60')]);router[_0x9aa1('0x5b')](_0x9aa1('0x4a'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x61')]);router['delete'](_0x9aa1('0x4c'),auth[_0x9aa1('0xc')](),controller['removeWhatsappInteractions']);router[_0x9aa1('0x5b')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x9aa1('0x62')]);router['delete'](_0x9aa1('0x27'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x63')]);router[_0x9aa1('0x5b')]('/:id/openchannel_accounts',auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x64')]);router[_0x9aa1('0x5b')](_0x9aa1('0x50'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0x9aa1('0x5b')](_0x9aa1('0x52'),auth['isAuthenticated'](),controller[_0x9aa1('0x65')]);router[_0x9aa1('0x5b')](_0x9aa1('0x2c'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x66')]);router['delete'](_0x9aa1('0x2e'),auth['isAuthenticated'](),controller[_0x9aa1('0x67')]);router[_0x9aa1('0x5b')](_0x9aa1('0x31'),auth[_0x9aa1('0xc')](),controller[_0x9aa1('0x68')]);module[_0x9aa1('0x69')]=router; \ No newline at end of file +var _0x61b8=['/:id/login','login','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/mail/interactions','/:id/sms/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','file'];(function(_0x1ad184,_0x5d0c35){var _0x3d083f=function(_0x5f1237){while(--_0x5f1237){_0x1ad184['push'](_0x1ad184['shift']());}};_0x3d083f(++_0x5d0c35);}(_0x61b8,0x169));var _0x861b=function(_0x3c31c6,_0x3f94be){_0x3c31c6=_0x3c31c6-0x0;var _0x5de6af=_0x61b8[_0x3c31c6];return _0x5de6af;};'use strict';var multer=require(_0x861b('0x0'));var util=require(_0x861b('0x1'));var path=require(_0x861b('0x2'));var timeout=require('connect-timeout');var express=require(_0x861b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x861b('0x4'));var interaction=require(_0x861b('0x5'));var config=require(_0x861b('0x6'));var controller=require('./user.controller');router[_0x861b('0x7')]('/',auth[_0x861b('0x8')](),controller[_0x861b('0x9')]);router[_0x861b('0x7')](_0x861b('0xa'),auth[_0x861b('0x8')](),controller[_0x861b('0xb')]);router[_0x861b('0x7')](_0x861b('0xc'),auth[_0x861b('0x8')](),controller[_0x861b('0xd')]);router['get'](_0x861b('0xe'),auth[_0x861b('0x8')](),controller[_0x861b('0xf')]);router['get'](_0x861b('0x10'),auth['isAuthenticated'](),controller[_0x861b('0x11')]);router[_0x861b('0x7')]('/:id/avatar',controller[_0x861b('0x12')]);router[_0x861b('0x7')](_0x861b('0x13'),auth[_0x861b('0x8')](),controller[_0x861b('0x14')]);router[_0x861b('0x7')](_0x861b('0x15'),auth[_0x861b('0x8')](),controller[_0x861b('0x16')]);router[_0x861b('0x7')](_0x861b('0x17'),auth[_0x861b('0x8')](),controller[_0x861b('0x18')]);router[_0x861b('0x7')](_0x861b('0x19'),auth[_0x861b('0x8')](),controller['getVoiceQueuesRt']);router[_0x861b('0x7')]('/:id/groups',auth['isAuthenticated'](),controller[_0x861b('0x1a')]);router['get'](_0x861b('0x1b'),auth[_0x861b('0x8')](),controller['getRecordings']);router[_0x861b('0x7')](_0x861b('0x1c'),auth[_0x861b('0x8')](),controller[_0x861b('0x1d')]);router['get']('/:id/chat/interactions',auth[_0x861b('0x8')](),controller[_0x861b('0x1e')]);router[_0x861b('0x7')]('/:id/openchannel/interactions',auth[_0x861b('0x8')](),controller['getOpenchannelInteractions']);router[_0x861b('0x7')](_0x861b('0x1f'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x861b('0x7')](_0x861b('0x20'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x861b('0x7')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x861b('0x21')]);router['get']('/:id/whatsapp/interactions',auth[_0x861b('0x8')](),controller[_0x861b('0x22')]);router[_0x861b('0x7')](_0x861b('0x23'),auth[_0x861b('0x8')](),controller[_0x861b('0x24')]);router['get'](_0x861b('0x25'),auth[_0x861b('0x8')](),controller[_0x861b('0x26')]);router[_0x861b('0x7')](_0x861b('0x27'),auth[_0x861b('0x8')](),controller['getAgents']);router['get'](_0x861b('0x28'),auth[_0x861b('0x8')](),controller[_0x861b('0x29')]);router[_0x861b('0x7')](_0x861b('0x2a'),auth[_0x861b('0x8')](),controller['getFaxAccounts']);router['get'](_0x861b('0x2b'),auth['isAuthenticated'](),controller[_0x861b('0x2c')]);router[_0x861b('0x7')](_0x861b('0x2d'),auth[_0x861b('0x8')](),controller[_0x861b('0x2e')]);router[_0x861b('0x7')](_0x861b('0x2f'),auth[_0x861b('0x8')](),controller['getSmsAccounts']);router['get'](_0x861b('0x30'),auth['isAuthenticated'](),controller[_0x861b('0x31')]);router[_0x861b('0x7')]('/:id/whatsapp_accounts',auth[_0x861b('0x8')](),controller['getWhatsappAccounts']);router['get'](_0x861b('0x32'),auth[_0x861b('0x8')](),controller['getSquareProjects']);router[_0x861b('0x7')](_0x861b('0x33'),auth['isAuthenticated'](),controller[_0x861b('0x34')]);router[_0x861b('0x7')]('/:id/api_key',auth[_0x861b('0x8')](),controller[_0x861b('0x35')]);router[_0x861b('0x36')](_0x861b('0x15'),auth[_0x861b('0x8')](),controller[_0x861b('0x37')]);router['post']('/',auth[_0x861b('0x8')](),controller[_0x861b('0x38')]);router[_0x861b('0x36')](_0x861b('0x39'),auth[_0x861b('0x8')](),controller['bulkCreate']);router['post'](_0x861b('0x17'),auth[_0x861b('0x8')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b773c,_0x23063f,_0x59fcd8){_0x59fcd8(null,path[_0x861b('0x3a')](config[_0x861b('0x3b')],_0x861b('0x3c')));},'filename':function(_0x489e85,_0x362e88,_0x466be2){_0x466be2(null,util[_0x861b('0x3d')](_0x861b('0x3e'),Date[_0x861b('0x3f')](),_0x362e88[_0x861b('0x40')]));}})});router['post'](_0x861b('0x41'),upload['single'](_0x861b('0x42')),controller['addAvatar']);router[_0x861b('0x36')](_0x861b('0x43'),auth[_0x861b('0x8')](),controller[_0x861b('0x44')]);router[_0x861b('0x36')]('/:id/logout',auth[_0x861b('0x8')](),controller[_0x861b('0x45')]);router[_0x861b('0x36')](_0x861b('0x46'),auth['isAuthenticated'](),controller[_0x861b('0x47')]);router[_0x861b('0x36')]('/:id/unpause',auth[_0x861b('0x8')](),controller[_0x861b('0x48')]);router[_0x861b('0x36')]('/:id/teams',auth[_0x861b('0x8')](),controller[_0x861b('0x49')]);router['post'](_0x861b('0x4a'),auth[_0x861b('0x8')](),controller['addChatInteractions']);router[_0x861b('0x36')](_0x861b('0x4b'),auth['isAuthenticated'](),controller[_0x861b('0x4c')]);router[_0x861b('0x36')](_0x861b('0x4d'),auth[_0x861b('0x8')](),controller[_0x861b('0x4e')]);router[_0x861b('0x36')]('/:id/sms_interactions',auth[_0x861b('0x8')](),controller['addSmsInteractions']);router[_0x861b('0x36')](_0x861b('0x4f'),auth['isAuthenticated'](),controller[_0x861b('0x50')]);router[_0x861b('0x36')](_0x861b('0x51'),auth[_0x861b('0x8')](),controller[_0x861b('0x52')]);router['post'](_0x861b('0x2a'),auth[_0x861b('0x8')](),controller['addFaxAccounts']);router[_0x861b('0x36')](_0x861b('0x2b'),auth[_0x861b('0x8')](),controller[_0x861b('0x53')]);router[_0x861b('0x36')](_0x861b('0x2d'),auth[_0x861b('0x8')](),controller[_0x861b('0x54')]);router[_0x861b('0x36')](_0x861b('0x2f'),auth['isAuthenticated'](),controller[_0x861b('0x55')]);router['post'](_0x861b('0x30'),auth['isAuthenticated'](),controller[_0x861b('0x56')]);router[_0x861b('0x36')]('/:id/whatsapp_accounts',auth[_0x861b('0x8')](),controller['addWhatsappAccounts']);router[_0x861b('0x36')](_0x861b('0x32'),auth[_0x861b('0x8')](),controller['addSquareProjects']);router[_0x861b('0x36')](_0x861b('0x57'),auth[_0x861b('0x8')](),controller[_0x861b('0x58')]);router[_0x861b('0x59')](_0x861b('0x10'),auth[_0x861b('0x8')](),controller[_0x861b('0x5a')]);router['put'](_0x861b('0x5b'),auth[_0x861b('0x8')](),controller[_0x861b('0x5c')]);router['delete'](_0x861b('0x17'),auth[_0x861b('0x8')](),controller['removeQueues']);router[_0x861b('0x5d')]('/:id/teams',auth[_0x861b('0x8')](),controller[_0x861b('0x5e')]);router[_0x861b('0x5d')](_0x861b('0x10'),auth['isAuthenticated'](),controller[_0x861b('0x5f')]);router[_0x861b('0x5d')]('/:id/chat_interactions',auth[_0x861b('0x8')](),controller[_0x861b('0x60')]);router['delete'](_0x861b('0x4b'),auth[_0x861b('0x8')](),controller[_0x861b('0x61')]);router[_0x861b('0x5d')](_0x861b('0x4d'),auth[_0x861b('0x8')](),controller[_0x861b('0x62')]);router[_0x861b('0x5d')](_0x861b('0x63'),auth[_0x861b('0x8')](),controller['removeSmsInteractions']);router[_0x861b('0x5d')](_0x861b('0x4f'),auth[_0x861b('0x8')](),controller[_0x861b('0x64')]);router[_0x861b('0x5d')]('/:id/whatsapp_interactions',auth[_0x861b('0x8')](),controller[_0x861b('0x65')]);router[_0x861b('0x5d')]('/:id/fax_accounts',auth[_0x861b('0x8')](),controller['removeFaxAccounts']);router['delete'](_0x861b('0x2b'),auth[_0x861b('0x8')](),controller['removeMailAccounts']);router[_0x861b('0x5d')](_0x861b('0x2d'),auth[_0x861b('0x8')](),controller[_0x861b('0x66')]);router[_0x861b('0x5d')](_0x861b('0x2f'),auth[_0x861b('0x8')](),controller[_0x861b('0x67')]);router[_0x861b('0x5d')](_0x861b('0x30'),auth[_0x861b('0x8')](),controller[_0x861b('0x68')]);router[_0x861b('0x5d')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x861b('0x69')]);router[_0x861b('0x5d')](_0x861b('0x32'),auth[_0x861b('0x8')](),controller[_0x861b('0x6a')]);router[_0x861b('0x5d')](_0x861b('0x57'),auth[_0x861b('0x8')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 0351df8..2a8a14e 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 _0x64e4=['rtcp_mux','force_avp','icesupport','dtlsverify','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','moment','util','lodash','exports','STRING','setDataValue','name','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','internal','email','ENUM','admin','agent','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','DATE','BOOLEAN','dynamic','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','showWebBar','get','wss','encryption','avpf','dtlssetup','dtlscertfile','dtlsprivatekey'];(function(_0x4ffb6a,_0xfc7df7){var _0x3b1687=function(_0x7dcb7d){while(--_0x7dcb7d){_0x4ffb6a['push'](_0x4ffb6a['shift']());}};_0x3b1687(++_0xfc7df7);}(_0x64e4,0x12a));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x464e('0x0'));var util=require(_0x464e('0x1'));var _=require(_0x464e('0x2'));module[_0x464e('0x3')]={'name':{'type':Sequelize[_0x464e('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4af466){this[_0x464e('0x5')](_0x464e('0x6'),_0x4af466);this[_0x464e('0x5')]('defaultuser',_0x4af466);},'comment':_0x464e('0x7')},'fullname':{'type':Sequelize[_0x464e('0x4')],'allowNull':![],'set':function(_0x414cbd){this[_0x464e('0x5')](_0x464e('0x8'),_0x414cbd);this[_0x464e('0x5')](_0x464e('0x9'),util[_0x464e('0xa')]('\x22%s\x22\x20<%s>',_0x414cbd,this[_0x464e('0xb')](_0x464e('0xc'))));}},'alias':{'type':Sequelize[_0x464e('0x4')]},'email':{'type':Sequelize[_0x464e('0x4')],'allowNull':![],'unique':_0x464e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x57a7e9){if(_0x57a7e9){this['setDataValue'](_0x464e('0xd'),_0x57a7e9['toLowerCase']());}}},'role':{'type':Sequelize[_0x464e('0xe')](_0x464e('0xf'),'user',_0x464e('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x464e('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x464e('0x11')},'internal':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':![],'unique':_0x464e('0xc'),'set':function(_0x265a82){this[_0x464e('0x5')](_0x464e('0xc'),_0x265a82);this[_0x464e('0x5')](_0x464e('0x13'),_0x265a82);this[_0x464e('0x5')](_0x464e('0x9'),util[_0x464e('0xa')](_0x464e('0x14'),this['getDataValue']('fullname'),_0x265a82));}},'salt':{'type':Sequelize[_0x464e('0x4')]},'phone':{'type':Sequelize[_0x464e('0x4')]},'mobile':{'type':Sequelize[_0x464e('0x4')]},'address':{'type':Sequelize[_0x464e('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x464e('0x4')]},'city':{'type':Sequelize[_0x464e('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x464e('0x15')]},'voicePause':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x464e('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x464e('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x464e('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x464e('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x464e('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x464e('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x464e('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x464e('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x464e('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x464e('0x17')},'ipaddr':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x464e('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x18'),_0x464e('0x19'),_0x464e('0x1a')),'allowNull':!![],'defaultValue':_0x464e('0x18')},'context':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![],'defaultValue':_0x464e('0x1b')},'callingpres':{'type':Sequelize['ENUM'](_0x464e('0x1c'),_0x464e('0x1d'),_0x464e('0x1e'),_0x464e('0x1f'),_0x464e('0x20'),_0x464e('0x21'),_0x464e('0x22'),_0x464e('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x464e('0x24'),'set':function(_0x59b6bb){this[_0x464e('0x5')](_0x464e('0x25'),_0x59b6bb?_0x59b6bb[_0x464e('0x26')](','):null);},'get':function(){return this[_0x464e('0xb')](_0x464e('0x25'))?this['getDataValue'](_0x464e('0x25'))[_0x464e('0x27')](','):null;},'comment':_0x464e('0x28')},'dtmfmode':{'type':Sequelize[_0x464e('0xe')]('rfc2833','info','shortinfo',_0x464e('0x29'),_0x464e('0x2a')),'allowNull':!![],'defaultValue':_0x464e('0x2b')},'directmedia':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no',_0x464e('0x2d'),_0x464e('0x2e'),_0x464e('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![],'defaultValue':_0x464e('0x30'),'set':function(_0x3bfe8e){this[_0x464e('0x5')]('nat',_0x3bfe8e?_0x3bfe8e[_0x464e('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x464e('0x31'))?this[_0x464e('0xb')](_0x464e('0x31'))[_0x464e('0x27')](','):null;},'comment':_0x464e('0x32')},'callgroup':{'type':Sequelize[_0x464e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x464e('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x464e('0x4')]},'language':{'type':Sequelize[_0x464e('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x464e('0x4')]},'disallow':{'type':Sequelize[_0x464e('0x4')],'allowNull':![],'defaultValue':_0x464e('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x464e('0x34'),'set':function(_0x45c881){this[_0x464e('0x5')](_0x464e('0x35'),_0x45c881?_0x45c881['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x464e('0x35'))?this[_0x464e('0xb')]('allow')[_0x464e('0x27')](';'):null;},'comment':_0x464e('0x36')},'autoframing':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0xaaf23b){this[_0x464e('0x5')](_0x464e('0x37'),_0xaaf23b?_0xaaf23b['join'](','):null);},'get':function(){return this['getDataValue'](_0x464e('0x37'))?this[_0x464e('0xb')](_0x464e('0x37'))[_0x464e('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no',_0x464e('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![],'defaultValue':_0x464e('0x39')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x464e('0x2c')},'busylevel':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x464e('0xe')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x464e('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no',_0x464e('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x3b'),_0x464e('0x3c'),_0x464e('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x3e'),'uas'),'allowNull':!![],'defaultValue':_0x464e('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x464e('0x2c')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x464e('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x464e('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no',_0x464e('0x40'),_0x464e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x42'),'passive',_0x464e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x464e('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x464e('0xe')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no','nonat',_0x464e('0x2e'),_0x464e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x464e('0x15')]},'passwordResetAt':{'type':Sequelize[_0x464e('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x464e('0x45')]},'showWebBar':{'type':Sequelize[_0x464e('0x12')],'defaultValue':0x0,'set':function(_0x43b9b0){this[_0x464e('0x5')](_0x464e('0x46'),_0x43b9b0);var _0x593372=this[_0x464e('0x47')]({'plain':!![]});switch(_0x43b9b0){case 0x0:case 0x1:var _0x1cb5d3=_0x593372[_0x464e('0x25')]?_['isArray'](_0x593372[_0x464e('0x25')])?_0x593372[_0x464e('0x25')][_0x464e('0x26')]():_0x593372[_0x464e('0x25')]:_0x464e('0x24');if(_0x1cb5d3===_0x464e('0x48')){_0x1cb5d3=_0x464e('0x24');}this[_0x464e('0x5')]('transport',_0x1cb5d3);this[_0x464e('0x5')](_0x464e('0x49'),'no');this[_0x464e('0x5')](_0x464e('0x4a'),null);this['setDataValue']('force_avp',null);this[_0x464e('0x5')]('icesupport',null);this[_0x464e('0x5')]('dtlsenable',null);this[_0x464e('0x5')]('dtlsverify',null);this[_0x464e('0x5')](_0x464e('0x4b'),null);this[_0x464e('0x5')](_0x464e('0x4c'),null);this['setDataValue'](_0x464e('0x4d'),null);this[_0x464e('0x5')](_0x464e('0x4e'),'no');break;case 0x2:this[_0x464e('0x5')](_0x464e('0x25'),'wss');this[_0x464e('0x5')](_0x464e('0x49'),_0x464e('0x2c'));this[_0x464e('0x5')](_0x464e('0x4a'),_0x464e('0x2c'));this[_0x464e('0x5')](_0x464e('0x4f'),_0x464e('0x2c'));this['setDataValue'](_0x464e('0x50'),_0x464e('0x2c'));this[_0x464e('0x5')]('dtlsenable',_0x464e('0x2c'));this['setDataValue'](_0x464e('0x51'),'no');this[_0x464e('0x5')](_0x464e('0x4b'),_0x464e('0x43'));this[_0x464e('0x5')]('dtlscertfile',_0x593372[_0x464e('0x4c')]||_0x464e('0x52'));this['setDataValue']('dtlsprivatekey',_0x593372['dtlsprivatekey']||_0x464e('0x53'));this[_0x464e('0x5')](_0x464e('0x4e'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x464e('0x45')],'set':function(_0x5669f5){this[_0x464e('0x5')](_0x464e('0x54'),_0x5669f5?_0x5669f5[_0x464e('0x26')](','):[]);},'get':function(){return this[_0x464e('0xb')](_0x464e('0x54'))?_['map'](this[_0x464e('0xb')]('permissions')[_0x464e('0x27')](','),function(_0x5b202f){return parseInt(_0x5b202f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x464e('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x464e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x464e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x464e('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x464e('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x464e('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x464e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x464e('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x464e('0xe')](_0x464e('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x464e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x464e('0x55')],'get':function(){return this[_0x464e('0xb')](_0x464e('0x56'))?this[_0x464e('0xb')](_0x464e('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x464e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![],'set':function(_0x55be9d){if(typeof _0x55be9d===_0x464e('0x57')){var _0x3f6f3e=_0x55be9d==='1'?!![]:_0x55be9d==='0'?![]:_0x55be9d===_0x464e('0x58')?!![]:_0x55be9d===_0x464e('0x59')?![]:![];this[_0x464e('0x5')](_0x464e('0x5a'),_0x3f6f3e);}else{this[_0x464e('0x5')](_0x464e('0x5a'),_0x55be9d);}}},'blocked':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![],'set':function(_0x4a5b24){this[_0x464e('0x5')](_0x464e('0x5b'),_0x4a5b24);if(_0x4a5b24===!![]){this['setDataValue'](_0x464e('0x5c'),moment());this[_0x464e('0x5')](_0x464e('0x5d'),0x0);}else{this[_0x464e('0x5')](_0x464e('0x5c'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x464e('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x464e('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x464e('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x464e('0x12')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x464e('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa703=['telephone','INTEGER','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','user','peer','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','uac','fingerprint','active','nonat','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','STRING','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM'];(function(_0x813665,_0x4c1e65){var _0x2481a4=function(_0x400a84){while(--_0x400a84){_0x813665['push'](_0x813665['shift']());}};_0x2481a4(++_0x4c1e65);}(_0xa703,0x194));var _0x3a70=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa703[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0x3a70('0x0'));var moment=require('moment');var util=require(_0x3a70('0x1'));var _=require(_0x3a70('0x2'));module['exports']={'name':{'type':Sequelize[_0x3a70('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ed779){this[_0x3a70('0x4')]('name',_0x2ed779);this[_0x3a70('0x4')](_0x3a70('0x5'),_0x2ed779);},'comment':_0x3a70('0x6')},'fullname':{'type':Sequelize[_0x3a70('0x3')],'allowNull':![],'set':function(_0x3bb960){this[_0x3a70('0x4')](_0x3a70('0x7'),_0x3bb960);this[_0x3a70('0x4')](_0x3a70('0x8'),util[_0x3a70('0x9')](_0x3a70('0xa'),_0x3bb960,this[_0x3a70('0xb')](_0x3a70('0xc'))));}},'alias':{'type':Sequelize[_0x3a70('0x3')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3a70('0xd'),'validate':{'isEmail':!![]},'set':function(_0x5b8846){if(_0x5b8846){this['setDataValue'](_0x3a70('0xd'),_0x5b8846[_0x3a70('0xe')]());}}},'role':{'type':Sequelize[_0x3a70('0xf')]('admin','user','agent',_0x3a70('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x3a70('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3a70('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':![],'unique':_0x3a70('0xc'),'set':function(_0x39eb27){this[_0x3a70('0x4')](_0x3a70('0xc'),_0x39eb27);this[_0x3a70('0x4')]('accountcode',_0x39eb27);this['setDataValue'](_0x3a70('0x8'),util[_0x3a70('0x9')](_0x3a70('0xa'),this[_0x3a70('0xb')](_0x3a70('0x7')),_0x39eb27));}},'salt':{'type':Sequelize[_0x3a70('0x3')]},'phone':{'type':Sequelize[_0x3a70('0x3')]},'mobile':{'type':Sequelize[_0x3a70('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x3a70('0x3')]},'userpic':{'type':Sequelize[_0x3a70('0x3')]},'city':{'type':Sequelize[_0x3a70('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3a70('0x3')],'defaultValue':_0x3a70('0x13')},'lastPauseAt':{'type':Sequelize[_0x3a70('0x14')]},'chatCapacity':{'type':Sequelize[_0x3a70('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3a70('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3a70('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3a70('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3a70('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3a70('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3a70('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![],'defaultValue':_0x3a70('0x15')},'ipaddr':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x3a70('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0x3a70('0x16'),_0x3a70('0x17')),'allowNull':!![],'defaultValue':_0x3a70('0x18')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x3a70('0x19'),_0x3a70('0x1a'),'ALLOWED',_0x3a70('0x1b'),'PROHIB_PASSED_SCREEN',_0x3a70('0x1c'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3a70('0x1d'),'set':function(_0x4fca76){this[_0x3a70('0x4')](_0x3a70('0x1e'),_0x4fca76?_0x4fca76[_0x3a70('0x1f')](','):null);},'get':function(){return this[_0x3a70('0xb')]('transport')?this[_0x3a70('0xb')]('transport')[_0x3a70('0x20')](','):null;},'comment':_0x3a70('0x21')},'dtmfmode':{'type':Sequelize['ENUM'](_0x3a70('0x22'),_0x3a70('0x23'),'shortinfo','inband',_0x3a70('0x24')),'allowNull':!![],'defaultValue':_0x3a70('0x22')},'directmedia':{'type':Sequelize[_0x3a70('0xf')]('yes','no','nonat',_0x3a70('0x25'),_0x3a70('0x26')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![],'defaultValue':_0x3a70('0x28'),'set':function(_0x2c5bbc){this[_0x3a70('0x4')]('nat',_0x2c5bbc?_0x2c5bbc[_0x3a70('0x1f')](','):null);},'get':function(){return this[_0x3a70('0xb')](_0x3a70('0x29'))?this[_0x3a70('0xb')](_0x3a70('0x29'))[_0x3a70('0x20')](','):null;},'comment':_0x3a70('0x2a')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x3a70('0x3')]},'pickupgroup':{'type':Sequelize[_0x3a70('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3a70('0x3')]},'disallow':{'type':Sequelize[_0x3a70('0x3')],'allowNull':![],'defaultValue':_0x3a70('0x2b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3a70('0x2c'),'set':function(_0x414015){this[_0x3a70('0x4')]('allow',_0x414015?_0x414015[_0x3a70('0x1f')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x3a70('0xb')]('allow')?this[_0x3a70('0xb')](_0x3a70('0x2d'))[_0x3a70('0x20')](';'):null;},'comment':_0x3a70('0x2e')},'autoframing':{'type':Sequelize[_0x3a70('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![],'set':function(_0x3f2904){this[_0x3a70('0x4')](_0x3a70('0x2f'),_0x3f2904?_0x3f2904[_0x3a70('0x1f')](','):null);},'get':function(){return this[_0x3a70('0xb')](_0x3a70('0x2f'))?this[_0x3a70('0xb')]('insecure')[_0x3a70('0x20')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no',_0x3a70('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![],'defaultValue':_0x3a70('0x31')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![],'defaultValue':_0x3a70('0x27')},'busylevel':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x3a70('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x3a70('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3a70('0xf')]('yes','no',_0x3a70('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3a70('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x33'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x34'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3a70('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3a70('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3a70('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no',_0x3a70('0x35'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x36'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3a70('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3a70('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no',_0x3a70('0x37'),_0x3a70('0x25'),_0x3a70('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3a70('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x3a70('0x14')]},'passwordResetAt':{'type':Sequelize[_0x3a70('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3a70('0x39')]},'showWebBar':{'type':Sequelize[_0x3a70('0x11')],'defaultValue':0x0,'set':function(_0x2f3e4a){this[_0x3a70('0x4')](_0x3a70('0x3a'),_0x2f3e4a);var _0x2612f0=this[_0x3a70('0x3b')]({'plain':!![]});switch(_0x2f3e4a){case 0x0:case 0x1:var _0x17dd26=_0x2612f0[_0x3a70('0x1e')]?_[_0x3a70('0x3c')](_0x2612f0[_0x3a70('0x1e')])?_0x2612f0[_0x3a70('0x1e')][_0x3a70('0x1f')]():_0x2612f0[_0x3a70('0x1e')]:_0x3a70('0x1d');if(_0x17dd26===_0x3a70('0x3d')){_0x17dd26=_0x3a70('0x1d');}this[_0x3a70('0x4')](_0x3a70('0x1e'),_0x17dd26);this['setDataValue'](_0x3a70('0x3e'),'no');this[_0x3a70('0x4')](_0x3a70('0x3f'),null);this['setDataValue'](_0x3a70('0x40'),null);this[_0x3a70('0x4')]('icesupport',null);this[_0x3a70('0x4')](_0x3a70('0x41'),null);this[_0x3a70('0x4')](_0x3a70('0x42'),null);this[_0x3a70('0x4')](_0x3a70('0x43'),null);this['setDataValue'](_0x3a70('0x44'),null);this[_0x3a70('0x4')](_0x3a70('0x45'),null);this[_0x3a70('0x4')](_0x3a70('0x46'),'no');break;case 0x2:this[_0x3a70('0x4')](_0x3a70('0x1e'),_0x3a70('0x3d'));this['setDataValue'](_0x3a70('0x3e'),_0x3a70('0x27'));this['setDataValue'](_0x3a70('0x3f'),_0x3a70('0x27'));this['setDataValue']('force_avp','yes');this[_0x3a70('0x4')](_0x3a70('0x47'),_0x3a70('0x27'));this[_0x3a70('0x4')](_0x3a70('0x41'),'yes');this['setDataValue'](_0x3a70('0x42'),'no');this['setDataValue'](_0x3a70('0x43'),'actpass');this[_0x3a70('0x4')](_0x3a70('0x44'),_0x2612f0[_0x3a70('0x44')]||'/etc/pki/tls/certs/motion.crt');this[_0x3a70('0x4')](_0x3a70('0x45'),_0x2612f0['dtlsprivatekey']||_0x3a70('0x48'));this[_0x3a70('0x4')](_0x3a70('0x46'),_0x3a70('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0x3a70('0x39')],'set':function(_0x18c52a){this['setDataValue'](_0x3a70('0x49'),_0x18c52a?_0x18c52a[_0x3a70('0x1f')](','):[]);},'get':function(){return this[_0x3a70('0xb')]('permissions')?_[_0x3a70('0x4a')](this[_0x3a70('0xb')](_0x3a70('0x49'))[_0x3a70('0x20')](','),function(_0xb5532d){return parseInt(_0xb5532d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3a70('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3a70('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3a70('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x3a70('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3a70('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3a70('0xf')](_0x3a70('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3a70('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3a70('0x4b')],'get':function(){return this[_0x3a70('0xb')](_0x3a70('0x4c'))?this[_0x3a70('0xb')](_0x3a70('0x4c')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3a70('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3a70('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![],'set':function(_0x4b6766){if(typeof _0x4b6766===_0x3a70('0x4d')){var _0x531bae=_0x4b6766==='1'?!![]:_0x4b6766==='0'?![]:_0x4b6766===_0x3a70('0x4e')?!![]:_0x4b6766===_0x3a70('0x4f')?![]:![];this[_0x3a70('0x4')](_0x3a70('0x50'),_0x531bae);}else{this[_0x3a70('0x4')]('screenrecording',_0x4b6766);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x123157){this[_0x3a70('0x4')](_0x3a70('0x51'),_0x123157);if(_0x123157===!![]){this[_0x3a70('0x4')](_0x3a70('0x52'),moment());this[_0x3a70('0x4')](_0x3a70('0x53'),0x0);}else{this[_0x3a70('0x4')](_0x3a70('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0x3a70('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3a70('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3a70('0x12')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 58064eb..514ff63 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 _0xfc64=['result','client','http','offline','idle','unknown','unavailable','ringing','busy','slice','charAt','toUpperCase','ui.','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','request','then','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','destroy','get','role','Users','user','Agents','Telephones','telephone','filter','ignore','value','includes','find','name','stack','send','render','contact','agent','interaction','account','index','map','User','fieldName','type','key','model','differenceBy','password','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','merge','where','VIRTUAL','sequelize','col','lower','options','includeAll','include','push','findAll','rows','openTabs','true','chat','dataValues','fax','openchannel','whatsapp','all','show','params','keys','rawAttributes','salt','sms','mail','update','body','describe','addContacts','omit','ids','Setting','findById','validatePasswordPattern','internal','min_internal','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','104','105','106','108','109','100','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','userProfileId','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','each','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','spread','Queue:save','voice','VoiceQueue','format','SIP/%s','penalty','UserVoiceQueueRt','removeQueues','Unknown\x20channel','remove','Queues','QueueId','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmList','List','Tag','color','tag','nolimit','order','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','mobile','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','upsert','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','MemberReport','concat','isMiddleware','resolve','logout','pause','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','QueuePause','%s%s','Pause','manual','getTeams','Team','addTeams','setDataValue','Chat','getMailQueues','Mail','getSmsQueues','Sms','Whatsapp','Fax','flatten','transaction','getDataValue','Voice','emit','removeTeams','getChatQueues','Openchannel','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lt','$ne','$notBetween','$in','$notIn','$like','$iLike','$overlap','$any','firstName','lastName','CmContact','Contact','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','queues','teams','isEmpty','inbound','toString','desc','asc','substring','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xfc64,0x1b3));var _0x4fc6=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xfc64[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x4fc6('0x0'));var rimraf=require(_0x4fc6('0x1'));var zipdir=require(_0x4fc6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fc6('0x3'));var moment=require(_0x4fc6('0x4'));var BPromise=require(_0x4fc6('0x5'));var Mustache=require(_0x4fc6('0x6'));var util=require(_0x4fc6('0x7'));var path=require('path');var sox=require(_0x4fc6('0x8'));var csv=require(_0x4fc6('0x9'));var ejs=require(_0x4fc6('0xa'));var fs=require('fs');var fs_extra=require(_0x4fc6('0xb'));var _=require(_0x4fc6('0xc'));var squel=require(_0x4fc6('0xd'));var crypto=require(_0x4fc6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4fc6('0xf'));var toCsv=require(_0x4fc6('0x9'));var querystring=require(_0x4fc6('0x10'));var Papa=require(_0x4fc6('0x11'));var Redis=require('ioredis');var values;var authService=require('../../components/auth/service');var qs=require(_0x4fc6('0x12'));var as=require(_0x4fc6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4fc6('0x14'));var utils=require(_0x4fc6('0x15'));var config=require(_0x4fc6('0x16'));var licenseUtil=require(_0x4fc6('0x17'));var db=require(_0x4fc6('0x18'))['db'];config[_0x4fc6('0x19')]=_[_0x4fc6('0x1a')](config[_0x4fc6('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fc6('0x1b'))(new Redis(config[_0x4fc6('0x19')]));require('./user.socket')[_0x4fc6('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc19535,_0x43e500,_0x4810e3,_0x55426f){return new BPromise(function(_0x24a112,_0x53dfd6){var _0x40dc97=_0x55426f||client;return _0x40dc97[_0x4fc6('0x1d')](_0xc19535,_0x4810e3)[_0x4fc6('0x1e')](function(_0x22ffcc){logger['info'](_0x4fc6('0x1f'),_0x43e500,_0x4fc6('0x20'));logger['debug'](_0x4fc6('0x21'),_0x43e500,_0x4fc6('0x20'),JSON[_0x4fc6('0x22')](_0x22ffcc));if(_0x22ffcc[_0x4fc6('0x23')]){if(_0x22ffcc[_0x4fc6('0x23')][_0x4fc6('0x24')]===0x1f4){logger[_0x4fc6('0x23')](_0x4fc6('0x1f'),_0x43e500,_0x22ffcc[_0x4fc6('0x23')][_0x4fc6('0x25')]);return _0x53dfd6(_0x22ffcc[_0x4fc6('0x23')]['message']);}logger[_0x4fc6('0x23')](_0x4fc6('0x1f'),_0x43e500,_0x22ffcc[_0x4fc6('0x23')]['message']);return _0x24a112(_0x22ffcc[_0x4fc6('0x23')][_0x4fc6('0x25')]);}else{logger[_0x4fc6('0x26')]('User,\x20%s,\x20%s',_0x43e500,_0x4fc6('0x20'));_0x24a112(_0x22ffcc['result'][_0x4fc6('0x25')]);}})[_0x4fc6('0x27')](function(_0x13cdb1){logger[_0x4fc6('0x23')](_0x4fc6('0x1f'),_0x43e500,_0x13cdb1);_0x53dfd6(_0x13cdb1);});});}function respondWithStatusCode(_0x354ee7,_0x4c62b3){_0x4c62b3=_0x4c62b3||0xcc;return function(_0x16632c){if(_0x16632c){return _0x354ee7[_0x4fc6('0x28')](_0x4c62b3);}return _0x354ee7['status'](_0x4c62b3)[_0x4fc6('0x29')]();};}function respondWithResult(_0x4320de,_0xc9be8b){_0xc9be8b=_0xc9be8b||0xc8;return function(_0x40f240){if(_0x40f240){return _0x4320de[_0x4fc6('0x2a')](_0xc9be8b)[_0x4fc6('0x2b')](_0x40f240);}};}function respondWithFilteredResult(_0x57cc0a,_0x2c9ed0){return function(_0x48be65){if(_0x48be65){var _0x266d75=typeof _0x2c9ed0['offset']===_0x4fc6('0x2c')&&typeof _0x2c9ed0[_0x4fc6('0x2d')]===_0x4fc6('0x2c');var _0xdbffaa=_0x48be65[_0x4fc6('0x2e')];var _0x37eac8=_0x266d75?0x0:_0x2c9ed0[_0x4fc6('0x2f')];var _0x467182=_0x266d75?_0x48be65['count']:_0x2c9ed0[_0x4fc6('0x2f')]+_0x2c9ed0[_0x4fc6('0x2d')];var _0x1167f1;if(_0x467182>=_0xdbffaa){_0x467182=_0xdbffaa;_0x1167f1=0xc8;}else{_0x1167f1=0xce;}_0x57cc0a[_0x4fc6('0x2a')](_0x1167f1);return _0x57cc0a[_0x4fc6('0x30')]('Content-Range',_0x37eac8+'-'+_0x467182+'/'+_0xdbffaa)['json'](_0x48be65);}return null;};}function patchUpdates(_0x1432cc){return function(_0x29a745){try{jsonpatch[_0x4fc6('0x31')](_0x29a745,_0x1432cc,!![]);}catch(_0x2958d9){return BPromise[_0x4fc6('0x32')](_0x2958d9);}return _0x29a745['save']();};}function saveUpdates(_0x59fcb0,_0x1c33df){return function(_0x5d036f){if(_0x5d036f){return _0x5d036f['update'](_0x59fcb0)[_0x4fc6('0x1e')](function(_0x419c75){return _0x419c75;});}return null;};}function removeEntity(_0x605ff4,_0xa076e7){return function(_0x3967dc){if(_0x3967dc){return _0x3967dc[_0x4fc6('0x33')]()[_0x4fc6('0x1e')](function(){var _0x3bc627=_0x3967dc[_0x4fc6('0x34')]({'plain':!![]});if(_0x3bc627[_0x4fc6('0x35')]==='admin')return;var _0x4a7794=[{'name':_0x4fc6('0x36'),'value':_0x4fc6('0x37'),'ignore':!![]},{'name':_0x4fc6('0x38'),'value':'agent','ignore':![]},{'name':_0x4fc6('0x39'),'value':_0x4fc6('0x3a'),'ignore':![]}];var _0x4c4ac3=_(_0x4a7794)[_0x4fc6('0x3b')](_0x4fc6('0x3c'))['map'](_0x4fc6('0x3d'))['value']();if(_[_0x4fc6('0x3e')](_0x4c4ac3,_0x3bc627[_0x4fc6('0x35')])){return;}var _0x3a47ce=_[_0x4fc6('0x3f')](_0x4a7794,[_0x4fc6('0x3d'),_0x3bc627['role']])[_0x4fc6('0x40')];return db['UserProfileResource'][_0x4fc6('0x33')]({'where':{'type':_0x3a47ce,'resourceId':_0x3bc627['id']}})[_0x4fc6('0x1e')](function(){return _0x3967dc;});})[_0x4fc6('0x1e')](function(){_0x605ff4[_0x4fc6('0x2a')](0xcc)[_0x4fc6('0x29')]();});}};}function handleEntityNotFound(_0xb0a6c3,_0x2785ac){return function(_0x4c49ad){if(!_0x4c49ad){_0xb0a6c3['sendStatus'](0x194);}return _0x4c49ad;};}function handleError(_0x162bdc,_0x403c9f){_0x403c9f=_0x403c9f||0x1f4;return function(_0xeb0797){logger[_0x4fc6('0x23')](_0xeb0797[_0x4fc6('0x41')]);if(_0xeb0797[_0x4fc6('0x40')]){delete _0xeb0797[_0x4fc6('0x40')];}_0x162bdc['status'](_0x403c9f)[_0x4fc6('0x42')](_0xeb0797);};}function getMustacheRender(_0x3645c4,_0x2d3963){return Mustache[_0x4fc6('0x43')](_0x3645c4,_['merge'](_0x2d3963['body'],{'contact':_0x2d3963[_0x4fc6('0x44')],'message':_0x2d3963['message'],'agent':_0x2d3963[_0x4fc6('0x45')],'interaction':_0x2d3963[_0x4fc6('0x46')],'account':_0x2d3963[_0x4fc6('0x47')]}))||'';}exports[_0x4fc6('0x48')]=function(_0x54fb8c,_0xe41cd0){var _0x5e398e={},_0x5827bb={},_0x416590={'count':0x0,'rows':[]};var _0xc36e6b=_[_0x4fc6('0x49')](db[_0x4fc6('0x4a')]['rawAttributes'],function(_0x4c7451){return{'name':_0x4c7451[_0x4fc6('0x4b')],'type':_0x4c7451[_0x4fc6('0x4c')][_0x4fc6('0x4d')]};});_0x5827bb[_0x4fc6('0x4e')]=_[_0x4fc6('0x4f')](_['map'](_0xc36e6b,'name'),[_0x4fc6('0x50'),'salt']);_0x5827bb['query']=_['keys'](_0x54fb8c[_0x4fc6('0x51')]);_0x5827bb[_0x4fc6('0x52')]=_[_0x4fc6('0x53')](_0x5827bb['model'],_0x5827bb[_0x4fc6('0x51')]);_0x5e398e[_0x4fc6('0x54')]=_[_0x4fc6('0x53')](_0x5827bb[_0x4fc6('0x4e')],qs[_0x4fc6('0x55')](_0x54fb8c['query'][_0x4fc6('0x55')]));_0x5e398e[_0x4fc6('0x54')]=_0x5e398e[_0x4fc6('0x54')][_0x4fc6('0x56')]?_0x5e398e[_0x4fc6('0x54')]:_0x5827bb[_0x4fc6('0x4e')];if(!_0x54fb8c[_0x4fc6('0x51')][_0x4fc6('0x57')]('nolimit')){_0x5e398e[_0x4fc6('0x2d')]=qs[_0x4fc6('0x2d')](_0x54fb8c[_0x4fc6('0x51')][_0x4fc6('0x2d')]);_0x5e398e[_0x4fc6('0x2f')]=qs['offset'](_0x54fb8c[_0x4fc6('0x51')][_0x4fc6('0x2f')]);}_0x5e398e['order']=qs[_0x4fc6('0x58')](_0x54fb8c[_0x4fc6('0x51')][_0x4fc6('0x58')]);_0x5e398e['where']=qs[_0x4fc6('0x52')](_[_0x4fc6('0x59')](_0x54fb8c[_0x4fc6('0x51')],_0x5827bb[_0x4fc6('0x52')]),_0xc36e6b);if(_0x54fb8c[_0x4fc6('0x51')]['filter']){_0x5e398e['where']=_[_0x4fc6('0x5a')](_0x5e398e[_0x4fc6('0x5b')],{'$or':_[_0x4fc6('0x49')](_0xc36e6b,function(_0x56916a){if(_0x56916a[_0x4fc6('0x4c')]!==_0x4fc6('0x5c')){return db[_0x4fc6('0x5d')]['where'](db['sequelize']['fn']('lower',db[_0x4fc6('0x5d')][_0x4fc6('0x5e')](_0x56916a[_0x4fc6('0x40')])),{'$like':db[_0x4fc6('0x5d')]['fn'](_0x4fc6('0x5f'),'%'+_0x54fb8c['query']['filter']+'%')});}})});}_0x5e398e=_[_0x4fc6('0x5a')]({},_0x5e398e,_0x54fb8c[_0x4fc6('0x60')]);var _0x2a56c9={'where':_0x5e398e[_0x4fc6('0x5b')]};return db['User'][_0x4fc6('0x2e')](_0x2a56c9)[_0x4fc6('0x1e')](function(_0x40481b){_0x416590[_0x4fc6('0x2e')]=_0x40481b;if(_0x54fb8c[_0x4fc6('0x51')][_0x4fc6('0x61')]){_0x5e398e[_0x4fc6('0x62')]=[{'all':!![]}];}if(!_[_0x4fc6('0x3e')](_0x5e398e[_0x4fc6('0x54')],'id')){_0x5e398e[_0x4fc6('0x54')][_0x4fc6('0x63')]('id');}return db['User'][_0x4fc6('0x64')](_0x5e398e);})[_0x4fc6('0x1e')](function(_0x3f1d0a){_0x416590[_0x4fc6('0x65')]=_0x3f1d0a;if(_0x54fb8c[_0x4fc6('0x51')][_0x4fc6('0x66')]===_0x4fc6('0x67')){var _0x131e23=[];for(var _0x42a6ab=0x0;_0x42a6ab<_0x416590['rows']['length'];_0x42a6ab++){_0x131e23[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x68'),_0x416590[_0x4fc6('0x65')][_0x42a6ab][_0x4fc6('0x69')]));_0x131e23['push'](get_open_tabs('sms',_0x416590['rows'][_0x42a6ab][_0x4fc6('0x69')]));_0x131e23[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x6a'),_0x416590['rows'][_0x42a6ab][_0x4fc6('0x69')]));_0x131e23[_0x4fc6('0x63')](get_open_tabs('mail',_0x416590['rows'][_0x42a6ab][_0x4fc6('0x69')]));_0x131e23[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x6b'),_0x416590['rows'][_0x42a6ab][_0x4fc6('0x69')]));_0x131e23['push'](get_open_tabs(_0x4fc6('0x6c'),_0x416590['rows'][_0x42a6ab][_0x4fc6('0x69')]));}return BPromise[_0x4fc6('0x6d')](_0x131e23)['then'](function(_0x208038){return _0x416590;});}else{return _0x416590;}})[_0x4fc6('0x1e')](respondWithFilteredResult(_0xe41cd0,_0x5e398e))[_0x4fc6('0x27')](handleError(_0xe41cd0,null));};exports[_0x4fc6('0x6e')]=function(_0x1293c4,_0x283ff7){var _0x1670e0={'raw':![],'where':{'id':_0x1293c4[_0x4fc6('0x6f')]['id']}},_0x540741={};_0x540741[_0x4fc6('0x4e')]=_['differenceBy'](_[_0x4fc6('0x70')](db[_0x4fc6('0x4a')][_0x4fc6('0x71')]),[_0x4fc6('0x50'),_0x4fc6('0x72')]);_0x540741['query']=_['keys'](_0x1293c4[_0x4fc6('0x51')]);_0x540741['filters']=_['intersection'](_0x540741[_0x4fc6('0x4e')],_0x540741['query']);_0x1670e0[_0x4fc6('0x54')]=_['intersection'](_0x540741[_0x4fc6('0x4e')],qs[_0x4fc6('0x55')](_0x1293c4[_0x4fc6('0x51')][_0x4fc6('0x55')]));_0x1670e0['attributes']=_0x1670e0[_0x4fc6('0x54')]['length']?_0x1670e0[_0x4fc6('0x54')]:_0x540741[_0x4fc6('0x4e')];if(_0x1293c4[_0x4fc6('0x51')][_0x4fc6('0x61')]){_0x1670e0['include']=[{'all':!![]}];}_0x1670e0=_[_0x4fc6('0x5a')]({},_0x1670e0,_0x1293c4['options']);if(!_['includes'](_0x1670e0[_0x4fc6('0x54')],'id')){_0x1670e0[_0x4fc6('0x54')][_0x4fc6('0x63')]('id');}return db[_0x4fc6('0x4a')][_0x4fc6('0x3f')](_0x1670e0)['then'](handleEntityNotFound(_0x283ff7,null))[_0x4fc6('0x1e')](function(_0xe0ee54){var _0x51efd6=[];values=_0xe0ee54;if(_0x1293c4[_0x4fc6('0x51')][_0x4fc6('0x66')]===_0x4fc6('0x67')){_0x51efd6[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x68'),_0xe0ee54[_0x4fc6('0x69')]));_0x51efd6[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x73'),_0xe0ee54[_0x4fc6('0x69')]));_0x51efd6[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x6b'),_0xe0ee54['dataValues']));_0x51efd6[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x6c'),_0xe0ee54[_0x4fc6('0x69')]));_0x51efd6['push'](get_open_tabs(_0x4fc6('0x6a'),_0xe0ee54[_0x4fc6('0x69')]));_0x51efd6[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x74'),_0xe0ee54[_0x4fc6('0x69')]));return BPromise['all'](_0x51efd6);}else{return values;}})[_0x4fc6('0x1e')](function(_0x3bd9b2){return values;})[_0x4fc6('0x1e')](respondWithResult(_0x283ff7,null))[_0x4fc6('0x27')](handleError(_0x283ff7,null));};exports[_0x4fc6('0x75')]=function(_0x5de4ed,_0x39baa4){if(_0x5de4ed[_0x4fc6('0x76')]['id']){delete _0x5de4ed[_0x4fc6('0x76')]['id'];}delete _0x5de4ed[_0x4fc6('0x76')][_0x4fc6('0x35')];return db[_0x4fc6('0x4a')][_0x4fc6('0x3f')]({'where':{'id':_0x5de4ed[_0x4fc6('0x6f')]['id']}})[_0x4fc6('0x1e')](handleEntityNotFound(_0x39baa4,null))[_0x4fc6('0x1e')](saveUpdates(_0x5de4ed['body'],null))[_0x4fc6('0x1e')](respondWithResult(_0x39baa4,null))[_0x4fc6('0x27')](handleError(_0x39baa4,null));};exports[_0x4fc6('0x77')]=function(_0x4d9bfe,_0x3c7613){return db[_0x4fc6('0x4a')][_0x4fc6('0x77')]()['then'](respondWithResult(_0x3c7613,null))[_0x4fc6('0x27')](handleError(_0x3c7613,null));};exports['addContacts']=function(_0x1f07f3,_0x22f458,_0x3fdb9b){return db[_0x4fc6('0x4a')][_0x4fc6('0x3f')]({'where':{'id':_0x1f07f3[_0x4fc6('0x6f')]['id']}})[_0x4fc6('0x1e')](handleEntityNotFound(_0x22f458,null))[_0x4fc6('0x1e')](function(_0x3b31b4){if(_0x3b31b4){return _0x3b31b4[_0x4fc6('0x78')](_0x1f07f3[_0x4fc6('0x76')]['ids'],_[_0x4fc6('0x79')](_0x1f07f3[_0x4fc6('0x76')],[_0x4fc6('0x7a'),'id'])||{});}})[_0x4fc6('0x1e')](respondWithResult(_0x22f458,null))['catch'](handleError(_0x22f458,null));};function validateUser(_0x313f24){return new BPromise(function(_0x5e7b5c,_0x5c5834){if(_0x313f24['internal'])return _0x5e7b5c(_0x313f24);return db[_0x4fc6('0x7b')][_0x4fc6('0x7c')](0x1)[_0x4fc6('0x1e')](function(_0x39d308){if(_0x39d308['securePassword'])authService[_0x4fc6('0x7d')](_0x313f24[_0x4fc6('0x50')]);db[_0x4fc6('0x4a')]['max'](_0x4fc6('0x7e'))[_0x4fc6('0x1e')](function(_0x517f47){if(_['isNil'](_0x517f47)){_0x313f24[_0x4fc6('0x7e')]=_0x39d308[_0x4fc6('0x7f')]||0x1;return;}if(_[_0x4fc6('0x80')](_0x39d308[_0x4fc6('0x7f')])||_0x39d308[_0x4fc6('0x7f')]===_0x517f47){_0x313f24[_0x4fc6('0x7e')]=_0x517f47+0x1;return;}if(_0x39d308['min_internal']>_0x517f47){_0x313f24['internal']=_0x39d308[_0x4fc6('0x7f')];return;}return db[_0x4fc6('0x5d')]['query'](_0x4fc6('0x81'),{'type':db[_0x4fc6('0x5d')]['QueryTypes']['SELECT']})[_0x4fc6('0x1e')](function(_0x59868c){if(_0x59868c&&_0x59868c[_0x4fc6('0x56')]){for(var _0x1b9b05=0x0,_0x492e5a=_0x59868c['length'];_0x1b9b05<_0x492e5a&&_[_0x4fc6('0x80')](_0x313f24[_0x4fc6('0x7e')]);_0x1b9b05++){if(_0x39d308[_0x4fc6('0x7f')]<=_0x59868c[_0x1b9b05][_0x4fc6('0x82')]){_0x313f24[_0x4fc6('0x7e')]=_0x59868c[_0x1b9b05]['from'];}else if(_0x39d308['min_internal']>_0x59868c[_0x1b9b05][_0x4fc6('0x82')]&&_0x39d308['min_internal']<=_0x59868c[_0x1b9b05]['to']){_0x313f24[_0x4fc6('0x7e')]=_0x39d308['min_internal'];}}}if(_[_0x4fc6('0x80')](_0x313f24[_0x4fc6('0x7e')])){_0x313f24[_0x4fc6('0x7e')]=_0x517f47+0x1;}return _0x5e7b5c(_0x313f24);});});})[_0x4fc6('0x27')](function(_0x5258b2){_0x5c5834(_0x5258b2);});});}function updateUser(_0x58548c){return new BPromise(function(_0x1a1e09,_0x43b8df){try{if(_0x58548c[_0x4fc6('0x83')]){_0x58548c[_0x4fc6('0x84')]=_0x58548c['internal'];_0x58548c[_0x4fc6('0x85')]={'mailbox':_0x58548c[_0x4fc6('0x7e')],'password':_0x58548c[_0x4fc6('0x50')],'fullname':_0x58548c[_0x4fc6('0x86')],'email':_0x58548c[_0x4fc6('0x87')]};}if(_0x58548c['role']===_0x4fc6('0x45')){if(!_0x58548c[_0x4fc6('0x88')])_0x58548c[_0x4fc6('0x88')]=[_0x4fc6('0x89'),_0x4fc6('0x8a'),_0x4fc6('0x8b'),'113','110',_0x4fc6('0x8c'),_0x4fc6('0x8d'),_0x4fc6('0x8e'),'107',_0x4fc6('0x8f'),_0x4fc6('0x90'),_0x4fc6('0x91'),'111',_0x4fc6('0x92'),_0x4fc6('0x93')];}_0x1a1e09(_0x58548c);}catch(_0x2750b5){_0x43b8df(_0x2750b5);}});}exports[_0x4fc6('0x94')]=function(_0x3f29ea,_0x3f19f8){if(_0x3f29ea['user'][_0x4fc6('0x35')]===_0x4fc6('0x45'))throw new Error(_0x4fc6('0x95'));if(_0x3f29ea['body'][_0x4fc6('0x35')]===_0x4fc6('0x37')&&_0x3f29ea[_0x4fc6('0x37')][_0x4fc6('0x35')]!=='admin'){throw new Error(_0x4fc6('0x96'));}if(_0x3f29ea[_0x4fc6('0x76')]['role']==='admin'&&_0x3f29ea['user']['role']!==_0x4fc6('0x97')){throw new Error(_0x4fc6('0x98'));}return licenseUtil['checkUserLimits']([_0x3f29ea[_0x4fc6('0x76')]])[_0x4fc6('0x1e')](function(){return validateUser(_0x3f29ea[_0x4fc6('0x76')]);})[_0x4fc6('0x1e')](function(_0x3a8a9b){return updateUser(_0x3a8a9b)['then'](function(_0x5b4d65){if(_0x5b4d65['role']===_0x4fc6('0x97')){_0x5b4d65['settingsEnabled']=_0x3f29ea[_0x4fc6('0x37')]['settingsEnabled'];delete _0x5b4d65[_0x4fc6('0x99')];}return _0x5b4d65;});})['then'](function(_0x909115){return db[_0x4fc6('0x4a')]['create'](_0x909115,{'include':[{'model':db[_0x4fc6('0x85')],'as':_0x4fc6('0x85')}]});})['then'](function(_0x34c870){if(_0x3f29ea['body'][_0x4fc6('0x35')]===_0x4fc6('0x37'))return _0x34c870;if(_0x3f29ea['user'][_0x4fc6('0x35')]!==_0x4fc6('0x37'))return _0x34c870;return db[_0x4fc6('0x9a')][_0x4fc6('0x3f')]({'where':{'name':_0x34c870[_0x4fc6('0x35')]===_0x4fc6('0x45')?_0x4fc6('0x38'):_0x4fc6('0x39'),'userProfileId':_0x3f29ea[_0x4fc6('0x37')]['userProfileId']},'raw':!![]})[_0x4fc6('0x1e')](function(_0xe05e4d){if(!_0xe05e4d||_0xe05e4d[_0x4fc6('0x9b')]!=0x0)return _0x34c870;return db[_0x4fc6('0x9c')]['create']({'name':_0x34c870['name'],'resourceId':_0x34c870['id'],'type':_0xe05e4d[_0x4fc6('0x40')],'sectionId':_0xe05e4d['id']},{})[_0x4fc6('0x1e')](function(){return _0x34c870;});})['catch'](function(_0x44bd1b){logger[_0x4fc6('0x23')](_0x4fc6('0x9d'),_0x44bd1b);throw _0x44bd1b;});})[_0x4fc6('0x1e')](respondWithResult(_0x3f19f8,0xc9))['catch'](handleError(_0x3f19f8,null));};exports[_0x4fc6('0x9e')]=function(_0x4916da,_0x80b904){var _0x59653a=_0x4916da[_0x4fc6('0x76')];var _0x333bd7=[];if(_0x4916da['user']['role']===_0x4fc6('0x45'))throw new Error(_0x4fc6('0x95'));if(_['some'](_0x59653a,['role',_0x4fc6('0x37')])&&_0x4916da[_0x4fc6('0x37')]['role']!==_0x4fc6('0x97')){throw new Error(_0x4fc6('0x96'));}if(_[_0x4fc6('0x9f')](_0x59653a,[_0x4fc6('0x35'),_0x4fc6('0x97')])&&_0x4916da['user'][_0x4fc6('0x35')]!=='admin'){throw new Error(_0x4fc6('0xa0'));}return licenseUtil[_0x4fc6('0xa1')](_0x59653a)[_0x4fc6('0x1e')](function(){return validateUser(_0x59653a[0x0]);})['then'](function(){for(var _0x31c3c0=0x1;_0x31c3c0<_0x59653a[_0x4fc6('0x56')];_0x31c3c0++){var _0xf2698e=_0x59653a[_0x31c3c0-0x1]['internal'];if(!_0x59653a[_0x31c3c0][_0x4fc6('0x7e')])_0x59653a[_0x31c3c0][_0x4fc6('0x7e')]=_0xf2698e+0x1;_0x333bd7[_0x4fc6('0x63')](validateUser(_0x59653a[_0x31c3c0]));}return BPromise[_0x4fc6('0x6d')](_0x333bd7);})[_0x4fc6('0x1e')](function(){_0x333bd7=[];for(var _0x55c3cf=0x0;_0x55c3cf<_0x59653a[_0x4fc6('0x56')];_0x55c3cf++){_0x333bd7[_0x4fc6('0x63')](updateUser(_0x59653a[_0x55c3cf]));}return BPromise[_0x4fc6('0x6d')](_0x333bd7);})[_0x4fc6('0x1e')](function(){return BPromise[_0x4fc6('0xa2')](_0x59653a,function(_0x3ac7a3){return db[_0x4fc6('0x4a')]['create'](_0x3ac7a3,{'include':[{'model':db[_0x4fc6('0x85')],'as':_0x4fc6('0x85')}]})[_0x4fc6('0x1e')](function(_0x9b890d){_0x3ac7a3['id']=_0x9b890d['id'];return _0x3ac7a3;});});})['then'](function(_0x4f350b){if(_0x4916da[_0x4fc6('0x76')][_0x4fc6('0x35')]===_0x4fc6('0x37'))return _0x4f350b;if(_0x4916da['user'][_0x4fc6('0x35')]!==_0x4fc6('0x37'))return _0x4f350b;var _0x31d23f=_[_0x4fc6('0x9f')](_0x4f350b,function(_0x2b3807){return _0x2b3807['role']==='agent'||_0x2b3807[_0x4fc6('0x35')]==='telephone';});if(!_0x31d23f)return _0x4f350b;return db[_0x4fc6('0x9a')][_0x4fc6('0x64')]({'where':{'name':{'$or':[_0x4fc6('0x38'),'Telephones']},'userProfileId':_0x4916da[_0x4fc6('0x37')][_0x4fc6('0x99')]},'raw':!![]})[_0x4fc6('0x1e')](function(_0x55c1fc){if(_['isEmpty'](_0x55c1fc)||!_['some'](_0x55c1fc,['autoAssociation',0x0]))return _0x4f350b;_0x333bd7=[];var _0x4b6899=_(_0x55c1fc)['map'](function(_0x2af2a5){if(_0x2af2a5[_0x4fc6('0x9b')]===0x1)return;return _0x2af2a5['name']===_0x4fc6('0x38')?'agent':_0x4fc6('0x3a');})['compact']()[_0x4fc6('0x3d')]();for(var _0x132286=0x0;_0x132286<_0x4f350b[_0x4fc6('0x56')];_0x132286++){if(!_[_0x4fc6('0x3e')](_0x4b6899,_0x4f350b[_0x132286][_0x4fc6('0x35')]))return;var _0x3fc16b=_0x4f350b[_0x132286]['role']==='agent'?_0x4fc6('0x38'):_0x4fc6('0x39');_0x333bd7['push'](db[_0x4fc6('0x9c')][_0x4fc6('0x94')]({'name':_0x4f350b[_0x132286][_0x4fc6('0x40')],'resourceId':_0x4f350b[_0x132286]['id'],'type':_0x3fc16b,'sectionId':_[_0x4fc6('0x3f')](_0x55c1fc,['name',_0x3fc16b])['id']},{}));}return BPromise[_0x4fc6('0x6d')](_0x333bd7);});})[_0x4fc6('0x1e')](respondWithResult(_0x80b904,0xc9))[_0x4fc6('0x27')](handleError(_0x80b904,null));};exports[_0x4fc6('0xa3')]=function(_0x4e2642,_0x2ff9df,_0x152d0b){if(_0x4e2642[_0x4fc6('0x76')]['id']){delete _0x4e2642[_0x4fc6('0x76')]['id'];}return db['User'][_0x4fc6('0x3f')]({'where':{'id':_0x4e2642['params']['id']}})[_0x4fc6('0x1e')](function(_0x23538e){if(!_0x23538e)return null;if(_0x23538e['id']===_0x4e2642['user']['id']){if(!_0x4e2642['body'][_0x4fc6('0xa4')]||!_0x4e2642[_0x4fc6('0x76')][_0x4fc6('0xa5')]){throw new db['Sequelize'][(_0x4fc6('0xa6'))](_0x4fc6('0xa7'));}if(!_0x23538e['authenticate'](_0x4e2642[_0x4fc6('0x76')]['oldPassword'])){throw new db['Sequelize'][(_0x4fc6('0xa6'))]('Wrong\x20credentials');}if(_0x4e2642[_0x4fc6('0x76')][_0x4fc6('0xa4')]===_0x4e2642['body'][_0x4fc6('0xa5')]){throw new db[(_0x4fc6('0xa8'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x4e2642['user']['role']==='admin'){if(!_0x4e2642[_0x4fc6('0x76')][_0x4fc6('0xa5')]){throw new db[(_0x4fc6('0xa8'))][(_0x4fc6('0xa6'))](_0x4fc6('0xa9'));}}else if(_0x4e2642['user']['role']===_0x4fc6('0x37')){if(!_0x4e2642[_0x4fc6('0x76')][_0x4fc6('0xa5')]){throw new db['Sequelize'][(_0x4fc6('0xa6'))](_0x4fc6('0xa9'));}if(_0x23538e[_0x4fc6('0x35')]!==_0x4fc6('0x45')){throw new db[(_0x4fc6('0xa8'))][(_0x4fc6('0xa6'))](_0x4fc6('0x95'));}}else{throw new db[(_0x4fc6('0xa8'))][(_0x4fc6('0xa6'))]('Unauthorized');}return _0x23538e;})[_0x4fc6('0x1e')](handleEntityNotFound(_0x2ff9df,null))[_0x4fc6('0x1e')](function(_0x30a5d1){return db[_0x4fc6('0x7b')][_0x4fc6('0xaa')]({'attributes':['id','securePassword',_0x4fc6('0xab'),_0x4fc6('0xac')]})[_0x4fc6('0x1e')](function(_0x273ba2){if(_0x273ba2['securePassword'])authService[_0x4fc6('0x7d')](_0x4e2642[_0x4fc6('0x76')][_0x4fc6('0xa5')]);if(!_0x273ba2['enforcePasswordHistory']||!_0x30a5d1['previousPasswords'])return _0x30a5d1;authService[_0x4fc6('0xad')](_0x4e2642[_0x4fc6('0x76')][_0x4fc6('0xa5')],_0x30a5d1[_0x4fc6('0xae')],_0x273ba2[_0x4fc6('0xac')]);return _0x30a5d1;})['then'](saveUpdates({'password':_0x4e2642['body'][_0x4fc6('0xa5')],'passwordResetAt':_0x4e2642[_0x4fc6('0x37')]['id']==_0x4e2642[_0x4fc6('0x6f')]['id']?moment():null,'previousPasswords':authService[_0x4fc6('0xaf')](_0x4e2642[_0x4fc6('0x76')][_0x4fc6('0xa5')],_0x30a5d1['previousPasswords'])},null));})['then'](respondWithResult(_0x2ff9df,null))[_0x4fc6('0x27')](handleError(_0x2ff9df,null));};exports[_0x4fc6('0xb0')]=function(_0x310682,_0x3796ee,_0x2ca615){var _0xf2a52e=_0x310682[_0x4fc6('0x76')][_0x4fc6('0xb1')];return db['User'][_0x4fc6('0x3f')]({'where':{'id':_0x310682[_0x4fc6('0x6f')]['id']},'attributes':['id','name',_0x4fc6('0x35'),_0x4fc6('0xb2'),_0x4fc6('0xb3'),_0x4fc6('0xb4'),_0x4fc6('0xb5')]})[_0x4fc6('0x1e')](handleEntityNotFound(_0x3796ee,null))[_0x4fc6('0x1e')](function(_0x4245f7){if(_0x4245f7){if(!utils[_0x4fc6('0xb6')](_0xf2a52e)){throw new db[(_0x4fc6('0xa8'))]['ValidationError']('Unknown\x20channel');}return _0x4245f7[_0x4fc6('0xb7')+_[_0x4fc6('0xb8')](_0xf2a52e[_0x4fc6('0xb9')]())+'Queues'](_0x310682['body'][_0x4fc6('0x7a')],{'penalty':_0x310682['body']['penalty']||0x0})[_0x4fc6('0xba')](function(_0x1a3307){for(var _0x5b81e6=0x0;_0x5b81e6<_0x310682[_0x4fc6('0x76')]['ids'][_0x4fc6('0x56')];_0x5b81e6+=0x1){var _0x1ff336={'UserId':_0x310682['params']['id']};_0x1ff336[_['capitalize'](_0xf2a52e[_0x4fc6('0xb9')]())+'QueueId']=_0x310682[_0x4fc6('0x76')]['ids'][_0x5b81e6];socket['emit']('user'+_[_0x4fc6('0xb8')](_0xf2a52e[_0x4fc6('0xb9')]())+_0x4fc6('0xbb'),_0x1ff336);}return _0x1a3307;})['then'](function(){if(_0xf2a52e===_0x4fc6('0xbc')){return db[_0x4fc6('0xbd')][_0x4fc6('0x64')]({'where':{'id':_0x310682[_0x4fc6('0x76')][_0x4fc6('0x7a')]||[]},'raw':!![],'attributes':['id',_0x4fc6('0x40')]});}})[_0x4fc6('0x1e')](function(_0x5aeb0d){var _0x3be876=_0x4245f7[_0x4fc6('0x34')]({'plain':!![]});var _0x514db3=[];if(_0xf2a52e===_0x4fc6('0xbc')&&_0x3be876['role']==='agent'&&_0x3be876['online']){for(var _0x3f2a67=0x0;_0x3f2a67<_0x5aeb0d[_0x4fc6('0x56')];_0x3f2a67+=0x1){_0x514db3['push']({'membername':_0x3be876[_0x4fc6('0x40')],'UserId':_0x3be876['id'],'queue_name':_0x5aeb0d[_0x3f2a67]['name'],'VoiceQueueId':_0x5aeb0d[_0x3f2a67]['id'],'interface':_[_0x4fc6('0x80')](_0x3be876[_0x4fc6('0xb5')])?util[_0x4fc6('0xbe')](_0x4fc6('0xbf'),_0x3be876[_0x4fc6('0x40')]):_0x3be876['interface'],'paused':_0x3be876['voicePause']||![],'penalty':_0x310682['body'][_0x4fc6('0xc0')]||0x0});}return BPromise[_0x4fc6('0xa2')](_0x514db3,function(_0x376262){return db[_0x4fc6('0xc1')]['upsert'](_0x376262);});}return _0x4245f7;});}})[_0x4fc6('0x1e')](respondWithStatusCode(_0x3796ee,null))[_0x4fc6('0x27')](handleError(_0x3796ee,null));};exports[_0x4fc6('0xc2')]=function(_0xc3a7f0,_0x4d98d6,_0x25d2d2){var _0x58ce95;return db[_0x4fc6('0x4a')][_0x4fc6('0x3f')]({'where':{'id':_0xc3a7f0[_0x4fc6('0x6f')]['id']},'attributes':['id',_0x4fc6('0x40'),'role']})[_0x4fc6('0x1e')](handleEntityNotFound(_0x4d98d6,null))[_0x4fc6('0x1e')](function(_0x2d785e){if(_0x2d785e){_0x58ce95=_0x2d785e;if(!_0xc3a7f0[_0x4fc6('0x51')][_0x4fc6('0xb1')]||!utils[_0x4fc6('0xb6')](_0xc3a7f0['query']['channel'])){throw new db[(_0x4fc6('0xa8'))][(_0x4fc6('0xa6'))](_0x4fc6('0xc3'));}return _0x2d785e[_0x4fc6('0xc4')+_[_0x4fc6('0xb8')](_0xc3a7f0[_0x4fc6('0x51')]['channel'][_0x4fc6('0xb9')]())+_0x4fc6('0xc5')](_0xc3a7f0[_0x4fc6('0x51')][_0x4fc6('0x7a')]);}})['then'](function(_0x243d5a){for(var _0x403c58=0x0;_0x403c58<_0xc3a7f0[_0x4fc6('0x51')][_0x4fc6('0x7a')][_0x4fc6('0x56')];_0x403c58+=0x1){var _0xf5a440={'UserId':_0xc3a7f0[_0x4fc6('0x6f')]['id']};_0xf5a440[_[_0x4fc6('0xb8')](_0xc3a7f0[_0x4fc6('0x51')][_0x4fc6('0xb1')][_0x4fc6('0xb9')]())+_0x4fc6('0xc6')]=_0xc3a7f0[_0x4fc6('0x51')][_0x4fc6('0x7a')][_0x403c58];socket['emit'](_0x4fc6('0x37')+_[_0x4fc6('0xb8')](_0xc3a7f0[_0x4fc6('0x51')]['channel'][_0x4fc6('0xb9')]())+_0x4fc6('0xc7'),_0xf5a440);}return _0x243d5a;})[_0x4fc6('0x1e')](function(){if(_0xc3a7f0[_0x4fc6('0x51')][_0x4fc6('0xb1')]===_0x4fc6('0xbc')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0xc3a7f0[_0x4fc6('0x6f')]['id'],'VoiceQueueId':_0xc3a7f0[_0x4fc6('0x51')]['ids']},'individualHooks':!![]})[_0x4fc6('0x1e')](function(){return _0x58ce95;});}return _0x58ce95;})['then'](respondWithStatusCode(_0x4d98d6,null))[_0x4fc6('0x27')](handleError(_0x4d98d6,null));};exports[_0x4fc6('0xc8')]=function(_0x42b29d,_0x21bf44,_0x4b2868){_0x42b29d[_0x4fc6('0x76')][_0x4fc6('0xc9')]=_0x42b29d[_0x4fc6('0xca')][_0x4fc6('0xcb')];return db[_0x4fc6('0x4a')][_0x4fc6('0x3f')]({'where':{'id':_0x42b29d['params']['id']}})[_0x4fc6('0x1e')](handleEntityNotFound(_0x21bf44,null))[_0x4fc6('0x1e')](saveUpdates(_0x42b29d[_0x4fc6('0x76')],null))['then'](respondWithResult(_0x21bf44,null))[_0x4fc6('0x27')](handleError(_0x21bf44,null));};exports[_0x4fc6('0xcc')]=function(_0x4c05b1,_0x337e27,_0x2725a1){var _0x1b146f=path[_0x4fc6('0xcd')](config[_0x4fc6('0xce')],_0x4fc6('0xcf'));return db[_0x4fc6('0x4a')]['find']({'where':{'id':_0x4c05b1['params']['id']},'attributes':['id',_0x4fc6('0xc9')],'raw':!![]})[_0x4fc6('0x1e')](handleEntityNotFound(_0x337e27,null))['then'](function(_0x46e56d){if(_0x46e56d){if(_['isNil'](_0x46e56d['userpic'])){return _0x337e27[_0x4fc6('0xd0')](_0x1b146f);}else{if(!fs['existsSync'](path[_0x4fc6('0xcd')](config['root'],_0x4fc6('0xd1'),_0x46e56d[_0x4fc6('0xc9')]))){return _0x337e27[_0x4fc6('0xd0')](_0x1b146f);}return _0x337e27[_0x4fc6('0xd0')](path[_0x4fc6('0xcd')](config[_0x4fc6('0xce')],_0x4fc6('0xd1'),_0x46e56d[_0x4fc6('0xc9')]));}}})[_0x4fc6('0x27')](handleError(_0x337e27,null));};exports[_0x4fc6('0xd2')]=function(_0xd786ed,_0x3ad118,_0x44daa5){return db[_0x4fc6('0x4a')]['find']({'where':{'id':_0xd786ed[_0x4fc6('0x6f')]['id']},'attributes':['id']})[_0x4fc6('0x1e')](handleEntityNotFound(_0x3ad118,null))[_0x4fc6('0x1e')](function(_0xfad519){var _0x37ee95=[];values=_0xfad519[_0x4fc6('0x69')];_0x37ee95[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x68'),_0xfad519[_0x4fc6('0x69')]));_0x37ee95[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x73'),_0xfad519[_0x4fc6('0x69')]));_0x37ee95['push'](get_open_tabs(_0x4fc6('0x6b'),_0xfad519[_0x4fc6('0x69')]));_0x37ee95['push'](get_open_tabs(_0x4fc6('0x6c'),_0xfad519[_0x4fc6('0x69')]));_0x37ee95[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x6a'),_0xfad519[_0x4fc6('0x69')]));_0x37ee95[_0x4fc6('0x63')](get_open_tabs(_0x4fc6('0x74'),_0xfad519[_0x4fc6('0x69')]));return BPromise['all'](_0x37ee95);})[_0x4fc6('0x1e')](function(_0x37d77c){var _0x1ba9c7=[];if(_0x37d77c){for(var _0x577c8f=0x0;_0x577c8f=_0x4f1401){_0x17c711=_0x4f1401;_0xdebc00=0xc8;}else{_0xdebc00=0xce;}_0x39fe43[_0x51c4('0x30')](_0xdebc00);return _0x39fe43[_0x51c4('0x37')]('Content-Range',_0x2974a3+'-'+_0x17c711+'/'+_0x4f1401)['json'](_0x32ef99);}return null;};}function patchUpdates(_0xb46c43){return function(_0x3e4cbd){try{jsonpatch['apply'](_0x3e4cbd,_0xb46c43,!![]);}catch(_0x41f425){return BPromise[_0x51c4('0x38')](_0x41f425);}return _0x3e4cbd['save']();};}function saveUpdates(_0x4e386a,_0x116df8){return function(_0x468afa){if(_0x468afa){return _0x468afa[_0x51c4('0x39')](_0x4e386a)['then'](function(_0x2d9d1e){return _0x2d9d1e;});}return null;};}function removeEntity(_0x1dbd8c,_0x1f95e8){return function(_0x17d4a8){if(_0x17d4a8){return _0x17d4a8['destroy']()[_0x51c4('0x3a')](function(){var _0xafa5a9=_0x17d4a8['get']({'plain':!![]});if(_0xafa5a9[_0x51c4('0x3b')]==='admin')return;var _0x285023=[{'name':_0x51c4('0x3c'),'value':_0x51c4('0x3d'),'ignore':!![]},{'name':_0x51c4('0x3e'),'value':_0x51c4('0x3f'),'ignore':![]},{'name':'Telephones','value':_0x51c4('0x40'),'ignore':![]}];var _0x5c4bb4=_(_0x285023)[_0x51c4('0x41')](_0x51c4('0x42'))[_0x51c4('0x43')](_0x51c4('0x44'))[_0x51c4('0x44')]();if(_[_0x51c4('0x45')](_0x5c4bb4,_0xafa5a9[_0x51c4('0x3b')])){return;}var _0xfcc949=_[_0x51c4('0x46')](_0x285023,[_0x51c4('0x44'),_0xafa5a9[_0x51c4('0x3b')]])[_0x51c4('0x47')];return db[_0x51c4('0x48')][_0x51c4('0x49')]({'where':{'type':_0xfcc949,'resourceId':_0xafa5a9['id']}})['then'](function(){return _0x17d4a8;});})[_0x51c4('0x3a')](function(){_0x1dbd8c[_0x51c4('0x30')](0xcc)[_0x51c4('0x31')]();});}};}function handleEntityNotFound(_0x2794f1,_0x1760eb){return function(_0x221a01){if(!_0x221a01){_0x2794f1[_0x51c4('0x2f')](0x194);}return _0x221a01;};}function handleError(_0x17dca0,_0x34625d){_0x34625d=_0x34625d||0x1f4;return function(_0x434b67){logger['error'](_0x434b67[_0x51c4('0x4a')]);if(_0x434b67[_0x51c4('0x47')]){delete _0x434b67[_0x51c4('0x47')];}_0x17dca0[_0x51c4('0x30')](_0x34625d)[_0x51c4('0x4b')](_0x434b67);};}function getMustacheRender(_0x31d648,_0x49cbe4){return Mustache[_0x51c4('0x4c')](_0x31d648,_[_0x51c4('0x4d')](_0x49cbe4[_0x51c4('0x4e')],{'contact':_0x49cbe4[_0x51c4('0x4f')],'message':_0x49cbe4[_0x51c4('0x2b')],'agent':_0x49cbe4[_0x51c4('0x3f')],'interaction':_0x49cbe4[_0x51c4('0x50')],'account':_0x49cbe4[_0x51c4('0x51')]}))||'';}exports[_0x51c4('0x52')]=function(_0x259b15,_0x4c9d36){var _0x45f9b9={},_0x4dc0e2={},_0xe3ce1e={'count':0x0,'rows':[]};var _0x1cb778=_[_0x51c4('0x43')](db['User'][_0x51c4('0x53')],function(_0x583059){return{'name':_0x583059[_0x51c4('0x54')],'type':_0x583059['type'][_0x51c4('0x55')]};});_0x4dc0e2[_0x51c4('0x56')]=_[_0x51c4('0x57')](_['map'](_0x1cb778,_0x51c4('0x47')),['password',_0x51c4('0x58')]);_0x4dc0e2[_0x51c4('0x59')]=_[_0x51c4('0x5a')](_0x259b15['query']);_0x4dc0e2[_0x51c4('0x5b')]=_['intersection'](_0x4dc0e2['model'],_0x4dc0e2['query']);_0x45f9b9['attributes']=_[_0x51c4('0x5c')](_0x4dc0e2[_0x51c4('0x56')],qs[_0x51c4('0x5d')](_0x259b15[_0x51c4('0x59')][_0x51c4('0x5d')]));_0x45f9b9[_0x51c4('0x5e')]=_0x45f9b9[_0x51c4('0x5e')][_0x51c4('0x5f')]?_0x45f9b9[_0x51c4('0x5e')]:_0x4dc0e2[_0x51c4('0x56')];if(!_0x259b15['query'][_0x51c4('0x60')](_0x51c4('0x61'))){_0x45f9b9[_0x51c4('0x34')]=qs[_0x51c4('0x34')](_0x259b15[_0x51c4('0x59')][_0x51c4('0x34')]);_0x45f9b9[_0x51c4('0x33')]=qs[_0x51c4('0x33')](_0x259b15['query'][_0x51c4('0x33')]);}_0x45f9b9[_0x51c4('0x62')]=qs[_0x51c4('0x63')](_0x259b15[_0x51c4('0x59')][_0x51c4('0x63')]);_0x45f9b9[_0x51c4('0x64')]=qs[_0x51c4('0x5b')](_['pick'](_0x259b15[_0x51c4('0x59')],_0x4dc0e2[_0x51c4('0x5b')]),_0x1cb778);if(_0x259b15[_0x51c4('0x59')][_0x51c4('0x41')]){_0x45f9b9['where']=_[_0x51c4('0x4d')](_0x45f9b9[_0x51c4('0x64')],{'$or':_[_0x51c4('0x43')](_0x1cb778,function(_0x2daf85){if(_0x2daf85[_0x51c4('0x65')]!==_0x51c4('0x66')){return db['sequelize'][_0x51c4('0x64')](db[_0x51c4('0x67')]['fn']('lower',db[_0x51c4('0x67')][_0x51c4('0x68')](_0x2daf85[_0x51c4('0x47')])),{'$like':db[_0x51c4('0x67')]['fn'](_0x51c4('0x69'),'%'+_0x259b15[_0x51c4('0x59')][_0x51c4('0x41')]+'%')});}})});}_0x45f9b9=_['merge']({},_0x45f9b9,_0x259b15[_0x51c4('0x6a')]);var _0x2a5649={'where':_0x45f9b9['where']};return db[_0x51c4('0x6b')][_0x51c4('0x36')](_0x2a5649)[_0x51c4('0x3a')](function(_0x381801){_0xe3ce1e[_0x51c4('0x36')]=_0x381801;if(_0x259b15[_0x51c4('0x59')]['includeAll']){_0x45f9b9[_0x51c4('0x6c')]=[{'all':!![]}];}if(!_[_0x51c4('0x45')](_0x45f9b9[_0x51c4('0x5e')],'id')){_0x45f9b9['attributes'][_0x51c4('0x6d')]('id');}return db['User']['findAll'](_0x45f9b9);})[_0x51c4('0x3a')](function(_0x5e20fa){_0xe3ce1e[_0x51c4('0x6e')]=_0x5e20fa;if(_0x259b15['query'][_0x51c4('0x6f')]==='true'){var _0x48ac5c=[];for(var _0x1619c3=0x0;_0x1619c3<_0xe3ce1e[_0x51c4('0x6e')][_0x51c4('0x5f')];_0x1619c3++){_0x48ac5c[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x70'),_0xe3ce1e[_0x51c4('0x6e')][_0x1619c3]['dataValues']));_0x48ac5c['push'](get_open_tabs(_0x51c4('0x71'),_0xe3ce1e['rows'][_0x1619c3][_0x51c4('0x72')]));_0x48ac5c[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x73'),_0xe3ce1e[_0x51c4('0x6e')][_0x1619c3][_0x51c4('0x72')]));_0x48ac5c[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x74'),_0xe3ce1e['rows'][_0x1619c3][_0x51c4('0x72')]));_0x48ac5c[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x75'),_0xe3ce1e[_0x51c4('0x6e')][_0x1619c3]['dataValues']));_0x48ac5c[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x76'),_0xe3ce1e[_0x51c4('0x6e')][_0x1619c3][_0x51c4('0x72')]));}return BPromise['all'](_0x48ac5c)['then'](function(_0x4cc05b){return _0xe3ce1e;});}else{return _0xe3ce1e;}})[_0x51c4('0x3a')](respondWithFilteredResult(_0x4c9d36,_0x45f9b9))[_0x51c4('0x2e')](handleError(_0x4c9d36,null));};exports[_0x51c4('0x77')]=function(_0x4dab0e,_0x27c4ab){var _0x75a708={'raw':![],'where':{'id':_0x4dab0e['params']['id']}},_0xb653d={};_0xb653d['model']=_[_0x51c4('0x57')](_[_0x51c4('0x5a')](db['User']['rawAttributes']),[_0x51c4('0x78'),_0x51c4('0x58')]);_0xb653d[_0x51c4('0x59')]=_['keys'](_0x4dab0e['query']);_0xb653d['filters']=_[_0x51c4('0x5c')](_0xb653d[_0x51c4('0x56')],_0xb653d[_0x51c4('0x59')]);_0x75a708['attributes']=_[_0x51c4('0x5c')](_0xb653d[_0x51c4('0x56')],qs[_0x51c4('0x5d')](_0x4dab0e[_0x51c4('0x59')][_0x51c4('0x5d')]));_0x75a708[_0x51c4('0x5e')]=_0x75a708['attributes']['length']?_0x75a708[_0x51c4('0x5e')]:_0xb653d[_0x51c4('0x56')];if(_0x4dab0e[_0x51c4('0x59')][_0x51c4('0x79')]){_0x75a708[_0x51c4('0x6c')]=[{'all':!![]}];}_0x75a708=_[_0x51c4('0x4d')]({},_0x75a708,_0x4dab0e[_0x51c4('0x6a')]);if(!_[_0x51c4('0x45')](_0x75a708[_0x51c4('0x5e')],'id')){_0x75a708[_0x51c4('0x5e')][_0x51c4('0x6d')]('id');}return db['User']['find'](_0x75a708)[_0x51c4('0x3a')](handleEntityNotFound(_0x27c4ab,null))['then'](function(_0x47373f){var _0x1f0fa3=[];values=_0x47373f;if(_0x4dab0e[_0x51c4('0x59')]['openTabs']===_0x51c4('0x7a')){_0x1f0fa3['push'](get_open_tabs('chat',_0x47373f[_0x51c4('0x72')]));_0x1f0fa3['push'](get_open_tabs(_0x51c4('0x71'),_0x47373f[_0x51c4('0x72')]));_0x1f0fa3['push'](get_open_tabs(_0x51c4('0x75'),_0x47373f['dataValues']));_0x1f0fa3['push'](get_open_tabs(_0x51c4('0x76'),_0x47373f[_0x51c4('0x72')]));_0x1f0fa3[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x73'),_0x47373f[_0x51c4('0x72')]));_0x1f0fa3[_0x51c4('0x6d')](get_open_tabs('mail',_0x47373f[_0x51c4('0x72')]));return BPromise[_0x51c4('0x7b')](_0x1f0fa3);}else{return values;}})[_0x51c4('0x3a')](function(_0x19c140){return values;})[_0x51c4('0x3a')](respondWithResult(_0x27c4ab,null))['catch'](handleError(_0x27c4ab,null));};exports['update']=function(_0x4a4c63,_0x163cb5){if(_0x4a4c63[_0x51c4('0x4e')]['id']){delete _0x4a4c63['body']['id'];}delete _0x4a4c63['body'][_0x51c4('0x3b')];return db[_0x51c4('0x6b')]['find']({'where':{'id':_0x4a4c63[_0x51c4('0x7c')]['id']}})[_0x51c4('0x3a')](handleEntityNotFound(_0x163cb5,null))[_0x51c4('0x3a')](saveUpdates(_0x4a4c63['body'],null))[_0x51c4('0x3a')](respondWithResult(_0x163cb5,null))[_0x51c4('0x2e')](handleError(_0x163cb5,null));};exports[_0x51c4('0x7d')]=function(_0x42db68,_0x3dd03d){return db[_0x51c4('0x6b')][_0x51c4('0x7d')]()[_0x51c4('0x3a')](respondWithResult(_0x3dd03d,null))[_0x51c4('0x2e')](handleError(_0x3dd03d,null));};exports[_0x51c4('0x7e')]=function(_0x29fb2a,_0x321eb5,_0x3a8d52){return db['User'][_0x51c4('0x46')]({'where':{'id':_0x29fb2a['params']['id']}})[_0x51c4('0x3a')](handleEntityNotFound(_0x321eb5,null))[_0x51c4('0x3a')](function(_0x598f02){if(_0x598f02){return _0x598f02[_0x51c4('0x7e')](_0x29fb2a['body'][_0x51c4('0x7f')],_[_0x51c4('0x80')](_0x29fb2a[_0x51c4('0x4e')],[_0x51c4('0x7f'),'id'])||{});}})[_0x51c4('0x3a')](respondWithResult(_0x321eb5,null))[_0x51c4('0x2e')](handleError(_0x321eb5,null));};function validateUser(_0x229b02){return new BPromise(function(_0x5373d6,_0xb891ec){if(_0x229b02['internal'])return _0x5373d6(_0x229b02);return db[_0x51c4('0x81')][_0x51c4('0x82')](0x1)[_0x51c4('0x3a')](function(_0x135ee6){if(_0x135ee6[_0x51c4('0x83')])authService['validatePasswordPattern'](_0x229b02[_0x51c4('0x78')]);db[_0x51c4('0x6b')][_0x51c4('0x84')](_0x51c4('0x85'))[_0x51c4('0x3a')](function(_0x3d17e3){if(_[_0x51c4('0x86')](_0x3d17e3)){_0x229b02[_0x51c4('0x85')]=_0x135ee6['min_internal']||0x1;return;}if(_[_0x51c4('0x86')](_0x135ee6[_0x51c4('0x87')])||_0x135ee6[_0x51c4('0x87')]===_0x3d17e3){_0x229b02[_0x51c4('0x85')]=_0x3d17e3+0x1;return;}if(_0x135ee6[_0x51c4('0x87')]>_0x3d17e3){_0x229b02[_0x51c4('0x85')]=_0x135ee6[_0x51c4('0x87')];return;}return db[_0x51c4('0x67')][_0x51c4('0x59')]('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[_0x51c4('0x67')][_0x51c4('0x88')][_0x51c4('0x89')]})[_0x51c4('0x3a')](function(_0x2028c8){if(_0x2028c8&&_0x2028c8[_0x51c4('0x5f')]){for(var _0x2415dd=0x0,_0xa534b=_0x2028c8['length'];_0x2415dd<_0xa534b&&_['isNil'](_0x229b02['internal']);_0x2415dd++){if(_0x135ee6[_0x51c4('0x87')]<=_0x2028c8[_0x2415dd][_0x51c4('0x8a')]){_0x229b02[_0x51c4('0x85')]=_0x2028c8[_0x2415dd][_0x51c4('0x8a')];}else if(_0x135ee6[_0x51c4('0x87')]>_0x2028c8[_0x2415dd][_0x51c4('0x8a')]&&_0x135ee6['min_internal']<=_0x2028c8[_0x2415dd]['to']){_0x229b02[_0x51c4('0x85')]=_0x135ee6[_0x51c4('0x87')];}}}if(_['isNil'](_0x229b02[_0x51c4('0x85')])){_0x229b02[_0x51c4('0x85')]=_0x3d17e3+0x1;}return _0x5373d6(_0x229b02);});});})[_0x51c4('0x2e')](function(_0x46e211){_0xb891ec(_0x46e211);});});}function updateUser(_0x47131c){return new BPromise(function(_0x5527c1,_0x2048e0){try{if(_0x47131c[_0x51c4('0x8b')]){_0x47131c[_0x51c4('0x8c')]=_0x47131c[_0x51c4('0x85')];_0x47131c[_0x51c4('0x8d')]={'mailbox':_0x47131c[_0x51c4('0x85')],'password':_0x47131c[_0x51c4('0x78')],'fullname':_0x47131c[_0x51c4('0x8e')],'email':_0x47131c[_0x51c4('0x8f')]};}if(_0x47131c[_0x51c4('0x3b')]===_0x51c4('0x3f')){if(!_0x47131c[_0x51c4('0x90')])_0x47131c[_0x51c4('0x90')]=[_0x51c4('0x91'),_0x51c4('0x92'),'103',_0x51c4('0x93'),_0x51c4('0x94'),_0x51c4('0x95'),_0x51c4('0x96'),_0x51c4('0x97'),_0x51c4('0x98'),'108',_0x51c4('0x99'),_0x51c4('0x9a'),_0x51c4('0x9b'),_0x51c4('0x9c'),_0x51c4('0x9d')];}_0x5527c1(_0x47131c);}catch(_0x3917b3){_0x2048e0(_0x3917b3);}});}exports['create']=function(_0x5e857e,_0x142711){if(_0x5e857e[_0x51c4('0x3d')]['role']===_0x51c4('0x3f'))throw new Error('Unauthorized');if(_0x5e857e[_0x51c4('0x4e')]['role']===_0x51c4('0x3d')&&_0x5e857e[_0x51c4('0x3d')][_0x51c4('0x3b')]!==_0x51c4('0x9e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5e857e['body']['role']==='admin'&&_0x5e857e[_0x51c4('0x3d')][_0x51c4('0x3b')]!==_0x51c4('0x9e')){throw new Error(_0x51c4('0x9f'));}return licenseUtil[_0x51c4('0xa0')]([_0x5e857e[_0x51c4('0x4e')]])[_0x51c4('0x3a')](function(){return validateUser(_0x5e857e['body']);})[_0x51c4('0x3a')](function(_0x517866){return updateUser(_0x517866)['then'](function(_0x5e8557){if(_0x5e8557[_0x51c4('0x3b')]===_0x51c4('0x9e')){_0x5e8557[_0x51c4('0xa1')]=_0x5e857e[_0x51c4('0x3d')][_0x51c4('0xa1')];delete _0x5e8557[_0x51c4('0xa2')];}return _0x5e8557;});})[_0x51c4('0x3a')](function(_0x40e4d3){return db[_0x51c4('0x6b')][_0x51c4('0xa3')](_0x40e4d3,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x51c4('0x3a')](function(_0x553098){if(_0x5e857e['body'][_0x51c4('0x3b')]===_0x51c4('0x3d'))return _0x553098;if(_0x5e857e[_0x51c4('0x3d')][_0x51c4('0x3b')]!=='user')return _0x553098;return db['UserProfileSection'][_0x51c4('0x46')]({'where':{'name':_0x553098[_0x51c4('0x3b')]===_0x51c4('0x3f')?_0x51c4('0x3e'):_0x51c4('0xa4'),'userProfileId':_0x5e857e[_0x51c4('0x3d')][_0x51c4('0xa2')]},'raw':!![]})[_0x51c4('0x3a')](function(_0xce4c70){if(!_0xce4c70||_0xce4c70[_0x51c4('0xa5')]!=0x0)return _0x553098;return db[_0x51c4('0x48')]['create']({'name':_0x553098[_0x51c4('0x47')],'resourceId':_0x553098['id'],'type':_0xce4c70[_0x51c4('0x47')],'sectionId':_0xce4c70['id']},{})[_0x51c4('0x3a')](function(){return _0x553098;});})['catch'](function(_0x1ebf82){logger[_0x51c4('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ebf82);throw _0x1ebf82;});})[_0x51c4('0x3a')](respondWithResult(_0x142711,0xc9))[_0x51c4('0x2e')](handleError(_0x142711,null));};exports['bulkCreate']=function(_0x18d70c,_0x1d91c4){var _0x3b2f08=_0x18d70c[_0x51c4('0x4e')];var _0x2795df=[];if(_0x18d70c['user'][_0x51c4('0x3b')]===_0x51c4('0x3f'))throw new Error(_0x51c4('0xa6'));if(_[_0x51c4('0xa7')](_0x3b2f08,['role',_0x51c4('0x3d')])&&_0x18d70c[_0x51c4('0x3d')][_0x51c4('0x3b')]!=='admin'){throw new Error(_0x51c4('0xa8'));}if(_[_0x51c4('0xa7')](_0x3b2f08,[_0x51c4('0x3b'),_0x51c4('0x9e')])&&_0x18d70c[_0x51c4('0x3d')][_0x51c4('0x3b')]!==_0x51c4('0x9e')){throw new Error(_0x51c4('0xa9'));}return licenseUtil['checkUserLimits'](_0x3b2f08)[_0x51c4('0x3a')](function(){return validateUser(_0x3b2f08[0x0]);})[_0x51c4('0x3a')](function(){for(var _0xb15522=0x1;_0xb15522<_0x3b2f08[_0x51c4('0x5f')];_0xb15522++){var _0x2d53b5=_0x3b2f08[_0xb15522-0x1][_0x51c4('0x85')];if(!_0x3b2f08[_0xb15522]['internal'])_0x3b2f08[_0xb15522][_0x51c4('0x85')]=_0x2d53b5+0x1;_0x2795df[_0x51c4('0x6d')](validateUser(_0x3b2f08[_0xb15522]));}return BPromise[_0x51c4('0x7b')](_0x2795df);})[_0x51c4('0x3a')](function(){_0x2795df=[];for(var _0x16e014=0x0;_0x16e014<_0x3b2f08['length'];_0x16e014++){_0x2795df[_0x51c4('0x6d')](updateUser(_0x3b2f08[_0x16e014]));}return BPromise['all'](_0x2795df);})[_0x51c4('0x3a')](function(){return BPromise[_0x51c4('0xaa')](_0x3b2f08,function(_0x53012f){return db['User'][_0x51c4('0xa3')](_0x53012f,{'include':[{'model':db[_0x51c4('0x8d')],'as':_0x51c4('0x8d')}]})[_0x51c4('0x3a')](function(_0x573cdf){_0x53012f['id']=_0x573cdf['id'];return _0x53012f;});});})[_0x51c4('0x3a')](function(_0x424d6a){if(_0x18d70c['body'][_0x51c4('0x3b')]===_0x51c4('0x3d'))return _0x424d6a;if(_0x18d70c[_0x51c4('0x3d')][_0x51c4('0x3b')]!==_0x51c4('0x3d'))return _0x424d6a;var _0x326a6c=_[_0x51c4('0xa7')](_0x424d6a,function(_0x157234){return _0x157234[_0x51c4('0x3b')]===_0x51c4('0x3f')||_0x157234[_0x51c4('0x3b')]===_0x51c4('0x40');});if(!_0x326a6c)return _0x424d6a;return db[_0x51c4('0xab')][_0x51c4('0xac')]({'where':{'name':{'$or':[_0x51c4('0x3e'),'Telephones']},'userProfileId':_0x18d70c[_0x51c4('0x3d')]['userProfileId']},'raw':!![]})[_0x51c4('0x3a')](function(_0x5e56c7){if(_[_0x51c4('0xad')](_0x5e56c7)||!_[_0x51c4('0xa7')](_0x5e56c7,[_0x51c4('0xa5'),0x0]))return _0x424d6a;_0x2795df=[];var _0x43eebe=_(_0x5e56c7)[_0x51c4('0x43')](function(_0x2be59b){if(_0x2be59b[_0x51c4('0xa5')]===0x1)return;return _0x2be59b[_0x51c4('0x47')]===_0x51c4('0x3e')?_0x51c4('0x3f'):'telephone';})['compact']()[_0x51c4('0x44')]();for(var _0x393b76=0x0;_0x393b76<_0x424d6a['length'];_0x393b76++){if(!_[_0x51c4('0x45')](_0x43eebe,_0x424d6a[_0x393b76][_0x51c4('0x3b')]))return;var _0x2ee125=_0x424d6a[_0x393b76][_0x51c4('0x3b')]===_0x51c4('0x3f')?_0x51c4('0x3e'):_0x51c4('0xa4');_0x2795df[_0x51c4('0x6d')](db[_0x51c4('0x48')][_0x51c4('0xa3')]({'name':_0x424d6a[_0x393b76][_0x51c4('0x47')],'resourceId':_0x424d6a[_0x393b76]['id'],'type':_0x2ee125,'sectionId':_[_0x51c4('0x46')](_0x5e56c7,[_0x51c4('0x47'),_0x2ee125])['id']},{}));}return BPromise[_0x51c4('0x7b')](_0x2795df);});})['then'](respondWithResult(_0x1d91c4,0xc9))[_0x51c4('0x2e')](handleError(_0x1d91c4,null));};exports[_0x51c4('0xae')]=function(_0x33e360,_0x2ed299,_0x2ea424){if(_0x33e360['body']['id']){delete _0x33e360[_0x51c4('0x4e')]['id'];}return db[_0x51c4('0x6b')]['find']({'where':{'id':_0x33e360[_0x51c4('0x7c')]['id']}})['then'](function(_0x1d9f07){if(!_0x1d9f07)return null;if(_0x1d9f07['id']===_0x33e360[_0x51c4('0x3d')]['id']){if(!_0x33e360[_0x51c4('0x4e')]['oldPassword']||!_0x33e360[_0x51c4('0x4e')][_0x51c4('0xaf')]){throw new db['Sequelize'][(_0x51c4('0xb0'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x1d9f07[_0x51c4('0xb1')](_0x33e360[_0x51c4('0x4e')][_0x51c4('0xb2')])){throw new db[(_0x51c4('0xb3'))][(_0x51c4('0xb0'))]('Wrong\x20credentials');}if(_0x33e360[_0x51c4('0x4e')][_0x51c4('0xb2')]===_0x33e360['body'][_0x51c4('0xaf')]){throw new db['Sequelize'][(_0x51c4('0xb0'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x33e360[_0x51c4('0x3d')][_0x51c4('0x3b')]===_0x51c4('0x9e')){if(!_0x33e360[_0x51c4('0x4e')]['newPassword']){throw new db[(_0x51c4('0xb3'))][(_0x51c4('0xb0'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x33e360['user'][_0x51c4('0x3b')]===_0x51c4('0x3d')){if(!_0x33e360[_0x51c4('0x4e')][_0x51c4('0xaf')]){throw new db[(_0x51c4('0xb3'))]['ValidationError'](_0x51c4('0xb4'));}if(_0x1d9f07[_0x51c4('0x3b')]!==_0x51c4('0x3f')){throw new db['Sequelize'][(_0x51c4('0xb0'))](_0x51c4('0xa6'));}}else{throw new db[(_0x51c4('0xb3'))]['ValidationError']('Unauthorized');}return _0x1d9f07;})[_0x51c4('0x3a')](handleEntityNotFound(_0x2ed299,null))['then'](function(_0x10c8cd){return db[_0x51c4('0x81')][_0x51c4('0xb5')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x51c4('0xb6')]})[_0x51c4('0x3a')](function(_0x2c520d){if(_0x2c520d['securePassword'])authService[_0x51c4('0xb7')](_0x33e360['body'][_0x51c4('0xaf')]);if(!_0x2c520d[_0x51c4('0xb8')]||!_0x10c8cd[_0x51c4('0xb9')])return _0x10c8cd;authService[_0x51c4('0xba')](_0x33e360[_0x51c4('0x4e')][_0x51c4('0xaf')],_0x10c8cd[_0x51c4('0xb9')],_0x2c520d['passwordHistoryLimit']);return _0x10c8cd;})['then'](saveUpdates({'password':_0x33e360[_0x51c4('0x4e')][_0x51c4('0xaf')],'passwordResetAt':_0x33e360[_0x51c4('0x3d')]['id']==_0x33e360[_0x51c4('0x7c')]['id']?moment():null,'previousPasswords':authService[_0x51c4('0xbb')](_0x33e360[_0x51c4('0x4e')][_0x51c4('0xaf')],_0x10c8cd[_0x51c4('0xb9')])},null));})['then'](respondWithResult(_0x2ed299,null))[_0x51c4('0x2e')](handleError(_0x2ed299,null));};exports[_0x51c4('0xbc')]=function(_0x1b5ad3,_0x6b7e01,_0x10958b){var _0x1f1932=_0x1b5ad3['body']['channel'];return db[_0x51c4('0x6b')][_0x51c4('0x46')]({'where':{'id':_0x1b5ad3['params']['id']},'attributes':['id',_0x51c4('0x47'),_0x51c4('0x3b'),_0x51c4('0xbd'),_0x51c4('0xbe'),_0x51c4('0xbf'),_0x51c4('0xc0')]})[_0x51c4('0x3a')](handleEntityNotFound(_0x6b7e01,null))['then'](function(_0x65eef9){if(_0x65eef9){if(!utils[_0x51c4('0xc1')](_0x1f1932)){throw new db['Sequelize'][(_0x51c4('0xb0'))](_0x51c4('0xc2'));}return _0x65eef9[_0x51c4('0xc3')+_['capitalize'](_0x1f1932[_0x51c4('0xc4')]())+_0x51c4('0xc5')](_0x1b5ad3[_0x51c4('0x4e')][_0x51c4('0x7f')],{'penalty':_0x1b5ad3[_0x51c4('0x4e')][_0x51c4('0xc6')]||0x0})[_0x51c4('0xc7')](function(_0x376d29){for(var _0xd30f05=0x0;_0xd30f05<_0x1b5ad3['body'][_0x51c4('0x7f')][_0x51c4('0x5f')];_0xd30f05+=0x1){var _0x3eabff={'UserId':_0x1b5ad3[_0x51c4('0x7c')]['id']};_0x3eabff[_[_0x51c4('0xc8')](_0x1f1932['toLowerCase']())+'QueueId']=_0x1b5ad3[_0x51c4('0x4e')][_0x51c4('0x7f')][_0xd30f05];socket[_0x51c4('0xc9')]('user'+_['capitalize'](_0x1f1932[_0x51c4('0xc4')]())+_0x51c4('0xca'),_0x3eabff);}return _0x376d29;})['then'](function(){if(_0x1f1932==='voice'){return db[_0x51c4('0xcb')][_0x51c4('0xac')]({'where':{'id':_0x1b5ad3[_0x51c4('0x4e')][_0x51c4('0x7f')]||[]},'raw':!![],'attributes':['id',_0x51c4('0x47')]});}})[_0x51c4('0x3a')](function(_0x1e97a8){var _0x4fa7fe=_0x65eef9['get']({'plain':!![]});var _0x2b47cf=[];if(_0x1f1932===_0x51c4('0xcc')&&_0x4fa7fe[_0x51c4('0x3b')]==='agent'&&_0x4fa7fe[_0x51c4('0xbd')]){for(var _0x24d2f3=0x0;_0x24d2f3<_0x1e97a8[_0x51c4('0x5f')];_0x24d2f3+=0x1){_0x2b47cf[_0x51c4('0x6d')]({'membername':_0x4fa7fe[_0x51c4('0x47')],'UserId':_0x4fa7fe['id'],'queue_name':_0x1e97a8[_0x24d2f3]['name'],'VoiceQueueId':_0x1e97a8[_0x24d2f3]['id'],'interface':_[_0x51c4('0x86')](_0x4fa7fe[_0x51c4('0xc0')])?util[_0x51c4('0xcd')]('SIP/%s',_0x4fa7fe[_0x51c4('0x47')]):_0x4fa7fe[_0x51c4('0xc0')],'paused':_0x4fa7fe[_0x51c4('0xbf')]||![],'penalty':_0x1b5ad3[_0x51c4('0x4e')][_0x51c4('0xc6')]||0x0});}return BPromise['each'](_0x2b47cf,function(_0x2a0553){return db[_0x51c4('0xce')][_0x51c4('0xcf')](_0x2a0553);});}return _0x65eef9;});}})['then'](respondWithStatusCode(_0x6b7e01,null))['catch'](handleError(_0x6b7e01,null));};exports[_0x51c4('0xd0')]=function(_0x5ae8e4,_0x445fc1,_0x2bf9c3){var _0x5de4b0;return db[_0x51c4('0x6b')][_0x51c4('0x46')]({'where':{'id':_0x5ae8e4['params']['id']},'attributes':['id',_0x51c4('0x47'),_0x51c4('0x3b')]})[_0x51c4('0x3a')](handleEntityNotFound(_0x445fc1,null))[_0x51c4('0x3a')](function(_0x5cb711){if(_0x5cb711){_0x5de4b0=_0x5cb711;if(!_0x5ae8e4[_0x51c4('0x59')][_0x51c4('0xd1')]||!utils[_0x51c4('0xc1')](_0x5ae8e4[_0x51c4('0x59')]['channel'])){throw new db[(_0x51c4('0xb3'))]['ValidationError'](_0x51c4('0xc2'));}return _0x5cb711[_0x51c4('0xd2')+_[_0x51c4('0xc8')](_0x5ae8e4[_0x51c4('0x59')][_0x51c4('0xd1')][_0x51c4('0xc4')]())+_0x51c4('0xc5')](_0x5ae8e4[_0x51c4('0x59')][_0x51c4('0x7f')]);}})[_0x51c4('0x3a')](function(_0xa5fd82){for(var _0x79abb6=0x0;_0x79abb6<_0x5ae8e4[_0x51c4('0x59')]['ids'][_0x51c4('0x5f')];_0x79abb6+=0x1){var _0x51f006={'UserId':_0x5ae8e4[_0x51c4('0x7c')]['id']};_0x51f006[_[_0x51c4('0xc8')](_0x5ae8e4['query'][_0x51c4('0xd1')]['toLowerCase']())+'QueueId']=_0x5ae8e4[_0x51c4('0x59')][_0x51c4('0x7f')][_0x79abb6];socket[_0x51c4('0xc9')](_0x51c4('0x3d')+_[_0x51c4('0xc8')](_0x5ae8e4[_0x51c4('0x59')][_0x51c4('0xd1')]['toLowerCase']())+_0x51c4('0xd3'),_0x51f006);}return _0xa5fd82;})[_0x51c4('0x3a')](function(){if(_0x5ae8e4[_0x51c4('0x59')][_0x51c4('0xd1')]===_0x51c4('0xcc')){return db[_0x51c4('0xce')][_0x51c4('0x49')]({'where':{'UserId':_0x5ae8e4[_0x51c4('0x7c')]['id'],'VoiceQueueId':_0x5ae8e4[_0x51c4('0x59')]['ids']},'individualHooks':!![]})[_0x51c4('0x3a')](function(){return _0x5de4b0;});}return _0x5de4b0;})['then'](respondWithStatusCode(_0x445fc1,null))[_0x51c4('0x2e')](handleError(_0x445fc1,null));};exports[_0x51c4('0xd4')]=function(_0x42f43d,_0x492f58,_0x5348bf){_0x42f43d[_0x51c4('0x4e')][_0x51c4('0xd5')]=_0x42f43d[_0x51c4('0xd6')]['filename'];return db['User'][_0x51c4('0x46')]({'where':{'id':_0x42f43d['params']['id']}})[_0x51c4('0x3a')](handleEntityNotFound(_0x492f58,null))['then'](saveUpdates(_0x42f43d['body'],null))[_0x51c4('0x3a')](respondWithResult(_0x492f58,null))[_0x51c4('0x2e')](handleError(_0x492f58,null));};exports[_0x51c4('0xd7')]=function(_0x1a389e,_0x36f536,_0x2660e6){var _0x3e4b69=path[_0x51c4('0xd8')](config[_0x51c4('0xd9')],_0x51c4('0xda'));return db[_0x51c4('0x6b')][_0x51c4('0x46')]({'where':{'id':_0x1a389e['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x51c4('0x3a')](handleEntityNotFound(_0x36f536,null))[_0x51c4('0x3a')](function(_0x4d3cf3){if(_0x4d3cf3){if(_['isNil'](_0x4d3cf3[_0x51c4('0xd5')])){return _0x36f536['download'](_0x3e4b69);}else{if(!fs[_0x51c4('0xdb')](path[_0x51c4('0xd8')](config[_0x51c4('0xd9')],'server/files/images/',_0x4d3cf3['userpic']))){return _0x36f536[_0x51c4('0xdc')](_0x3e4b69);}return _0x36f536[_0x51c4('0xdc')](path[_0x51c4('0xd8')](config[_0x51c4('0xd9')],'server/files/images/',_0x4d3cf3[_0x51c4('0xd5')]));}}})['catch'](handleError(_0x36f536,null));};exports[_0x51c4('0xdd')]=function(_0x2733ee,_0x1667b9,_0x55de97){return db[_0x51c4('0x6b')][_0x51c4('0x46')]({'where':{'id':_0x2733ee[_0x51c4('0x7c')]['id']},'attributes':['id']})[_0x51c4('0x3a')](handleEntityNotFound(_0x1667b9,null))[_0x51c4('0x3a')](function(_0x778a3e){var _0x596cd2=[];values=_0x778a3e[_0x51c4('0x72')];_0x596cd2[_0x51c4('0x6d')](get_open_tabs('chat',_0x778a3e['dataValues']));_0x596cd2[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x71'),_0x778a3e[_0x51c4('0x72')]));_0x596cd2[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x75'),_0x778a3e[_0x51c4('0x72')]));_0x596cd2[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x76'),_0x778a3e['dataValues']));_0x596cd2[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x73'),_0x778a3e[_0x51c4('0x72')]));_0x596cd2[_0x51c4('0x6d')](get_open_tabs(_0x51c4('0x74'),_0x778a3e[_0x51c4('0x72')]));return BPromise[_0x51c4('0x7b')](_0x596cd2);})['then'](function(_0x4105d3){var _0x2ce70d=[];if(_0x4105d3){for(var _0x3f852f=0x0;_0x3f852f=_0x1aa125[_0xfb02('0x54')]){throw new Error(_0xfb02('0x55'));}})[_0xfb02('0x11')](function(){if(_0x3c8b82){return db[_0xfb02('0x2d')][_0xfb02('0x4b')]({'where':{'membername':_0x3c8b82[_0xfb02('0x29')]},'individualHooks':!![]});}})[_0xfb02('0x11')](function(){if(_0x3c8b82){return _0x3c8b82['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x154813){if(_0x3c8b82){if(_0x154813){var _0x1ae2dd=[];_0x447b3a=_0x154813;if(_0x447b3a[_0xfb02('0x30')]){for(var _0x5d7ccf=0x0;_0x5d7ccf<_0x447b3a[_0xfb02('0x30')];_0x5d7ccf++){_0x1ae2dd[_0xfb02('0x35')](db['UserVoiceQueueRt'][_0xfb02('0x56')]({'membername':_0x3c8b82[_0xfb02('0x29')],'UserId':_0x3c8b82['id'],'queue_name':_0x447b3a[_0x5d7ccf]['name'],'VoiceQueueId':_0x447b3a[_0x5d7ccf]['id'],'interface':_0x323c6b,'paused':_0x3c8b82['loginInPause']||![],'penalty':_0x447b3a[_0x5d7ccf]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xfb02('0x49')](_0x1ae2dd);}}}})['then'](function(){if(_0x3c8b82){return db['MemberReport']['findAll']({'where':{'membername':_0x3c8b82['name'],'exitAt':null}});}})['then'](function(_0xaff8fa){if(_0x3c8b82){if(_0xaff8fa&&_0xaff8fa['length']){var _0x1d6b7f=[];_0xaff8fa[_0xfb02('0x34')](function(_0xbc42b6){_0x1d6b7f[_0xfb02('0x35')](_0xbc42b6[_0xfb02('0x2e')]({'exitAt':moment()['format'](_0xfb02('0x32'))}));});return BPromise[_0xfb02('0x49')](_0x1d6b7f);}}})[_0xfb02('0x11')](function(_0x2e031a){if(_0x3c8b82){var _0x782035=[];var _0x2095d7=[];var _0x563f40=utils['getChannels']();var _0x4be990={'membername':_0x3c8b82[_0xfb02('0x29')],'interface':_0x323c6b,'enterAt':moment()['format'](_0xfb02('0x32')),'role':_0x3c8b82[_0xfb02('0x2a')],'internal':_0x3c8b82[_0xfb02('0x2b')]};_0x563f40['forEach'](function(_0x21555f){_0x782035[_0xfb02('0x35')](_[_0xfb02('0x57')]({'channel':_0x21555f,'type':_0xfb02('0x58'),'data1':_0xfb02('0x59'),'data2':_0x323c6b},_0x4be990));if(_0x3c8b82[_0xfb02('0x4e')]){_0x2095d7[_0xfb02('0x35')](_[_0xfb02('0x57')]({'channel':_0x21555f,'type':_0xfb02('0x37'),'data1':_0xfb02('0x5a')},_0x4be990));}});return db[_0xfb02('0x3b')][_0xfb02('0x5b')](_0x782035['concat'](_0x2095d7),{'individualHooks':!![]});}})[_0xfb02('0x11')](function(){if(_0x3c8b82){return _0x3c8b82[_0xfb02('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xfb02('0x31')](_0xfb02('0x32')),'voicePause':_0x3c8b82[_0xfb02('0x4e')]||![],'mailPause':_0x3c8b82[_0xfb02('0x4e')]||![],'chatPause':_0x3c8b82[_0xfb02('0x4e')]||![],'faxPause':_0x3c8b82[_0xfb02('0x4e')]||![],'smsPause':_0x3c8b82['loginInPause']||![],'openchannelPause':_0x3c8b82['loginInPause']||![],'pauseType':_0x3c8b82[_0xfb02('0x4e')]?_0xfb02('0x5a'):null,'lastPauseAt':moment()['format'](_0xfb02('0x32')),'interface':_0x323c6b});}})[_0xfb02('0x11')](function(_0x9bba00){_0x2f36ff(_0x9bba00);})['catch'](function(_0x1e8cfe){_0x583ad4(_0x5380da[_0xfb02('0x16')](0x1f4,_0x1e8cfe[_0xfb02('0x19')]));});});}; \ No newline at end of file +var _0x55cc=['length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','format','body','type','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','update','findOne','isValidChannel','channel','Unknown\x20channel','voice','find','system','mail','chat','fax','set','all','LogoutUser','destroy','forEach','role','mobile','phone','interface','count','agent','agents','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','User,\x20%s,\x20%s','message','result','catch','GetUser','User','findAll','raw','options','attributes','limit','include','model','map','ShowUser','where','name','internal','UserVoiceQueueRt','PAUSE'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x55cc,0x191));var _0xc55c=function(_0x4a2eb3,_0x2dcbea){_0x4a2eb3=_0x4a2eb3-0x0;var _0x27b232=_0x55cc[_0x4a2eb3];return _0x27b232;};'use strict';var _=require(_0xc55c('0x0'));var util=require(_0xc55c('0x1'));var moment=require(_0xc55c('0x2'));var BPromise=require(_0xc55c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc55c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc55c('0x5'))('rpc');var config=require(_0xc55c('0x6'));var jayson=require(_0xc55c('0x7'));var client=jayson[_0xc55c('0x8')][_0xc55c('0x9')]({'port':0x232a});config[_0xc55c('0xa')]=_[_0xc55c('0xb')](config[_0xc55c('0xa')],{'host':_0xc55c('0xc'),'port':0x18eb});var socket=require(_0xc55c('0xd'))(new Redis(config[_0xc55c('0xa')]));require(_0xc55c('0xe'))[_0xc55c('0xf')](socket);function respondWithRpcPromise(_0x5dc93d,_0x5f3dc6,_0x4ec451){return new BPromise(function(_0x704dc0,_0x1f250c){return client[_0xc55c('0x10')](_0x5dc93d,_0x4ec451)[_0xc55c('0x11')](function(_0x1725eb){logger[_0xc55c('0x12')]('User,\x20%s,\x20%s',_0x5f3dc6,_0xc55c('0x13'));logger[_0xc55c('0x14')](_0xc55c('0x15'),_0x5f3dc6,_0xc55c('0x13'),JSON[_0xc55c('0x16')](_0x1725eb));if(_0x1725eb[_0xc55c('0x17')]){if(_0x1725eb[_0xc55c('0x17')]['code']===0x1f4){logger['error'](_0xc55c('0x18'),_0x5f3dc6,_0x1725eb['error']['message']);return _0x1f250c(_0x1725eb[_0xc55c('0x17')][_0xc55c('0x19')]);}logger[_0xc55c('0x17')](_0xc55c('0x18'),_0x5f3dc6,_0x1725eb[_0xc55c('0x17')][_0xc55c('0x19')]);return _0x704dc0(_0x1725eb['error'][_0xc55c('0x19')]);}else{logger[_0xc55c('0x12')](_0xc55c('0x18'),_0x5f3dc6,'request\x20sent');_0x704dc0(_0x1725eb[_0xc55c('0x1a')][_0xc55c('0x19')]);}})[_0xc55c('0x1b')](function(_0x5e8859){logger['error'](_0xc55c('0x18'),_0x5f3dc6,_0x5e8859);_0x1f250c(_0x5e8859);});});}exports[_0xc55c('0x1c')]=function(_0x1b6eef){var _0x22927f=this;return new Promise(function(_0x5d9d12,_0x34a87d){return db[_0xc55c('0x1d')][_0xc55c('0x1e')]({'raw':_0x1b6eef['options']?_0x1b6eef['options'][_0xc55c('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b6eef[_0xc55c('0x20')]?_0x1b6eef[_0xc55c('0x20')]['where']||null:null,'attributes':_0x1b6eef[_0xc55c('0x20')]?_0x1b6eef[_0xc55c('0x20')][_0xc55c('0x21')]||null:null,'limit':_0x1b6eef[_0xc55c('0x20')]?_0x1b6eef[_0xc55c('0x20')][_0xc55c('0x22')]||null:null,'include':_0x1b6eef[_0xc55c('0x20')]?_0x1b6eef[_0xc55c('0x20')][_0xc55c('0x23')]?_['map'](_0x1b6eef['options'][_0xc55c('0x23')],function(_0x1d3393){return{'model':db[_0x1d3393['model']],'as':_0x1d3393['as'],'attributes':_0x1d3393[_0xc55c('0x21')],'include':_0x1d3393[_0xc55c('0x23')]?_['map'](_0x1d3393[_0xc55c('0x23')],function(_0xcda1da){return{'model':db[_0xcda1da[_0xc55c('0x24')]],'as':_0xcda1da['as'],'attributes':_0xcda1da[_0xc55c('0x21')],'include':_0xcda1da['include']?_[_0xc55c('0x25')](_0xcda1da[_0xc55c('0x23')],function(_0x20a5df){return{'model':db[_0x20a5df['model']],'as':_0x20a5df['as'],'attributes':_0x20a5df['attributes']};}):[]};}):[]};}):[]:[]})[_0xc55c('0x11')](function(_0x589e01){logger[_0xc55c('0x12')](_0xc55c('0x1c'),_0x1b6eef);logger['debug'](_0xc55c('0x1c'),_0x1b6eef,JSON[_0xc55c('0x16')](_0x589e01));_0x5d9d12(_0x589e01);})[_0xc55c('0x1b')](function(_0x300859){logger[_0xc55c('0x17')]('GetUser',_0x300859['message'],_0x1b6eef);_0x34a87d(_0x22927f[_0xc55c('0x17')](0x1f4,_0x300859[_0xc55c('0x19')]));});});};exports[_0xc55c('0x26')]=function(_0x2a16d6){var _0x151407=this;return new Promise(function(_0x194865,_0x1807dc){return db[_0xc55c('0x1d')]['find']({'raw':_0x2a16d6['options']?_0x2a16d6['options'][_0xc55c('0x1f')]===undefined?!![]:![]:!![],'where':_0x2a16d6[_0xc55c('0x20')]?_0x2a16d6['options'][_0xc55c('0x27')]||null:null,'attributes':_0x2a16d6[_0xc55c('0x20')]?_0x2a16d6[_0xc55c('0x20')]['attributes']||null:null,'include':_0x2a16d6[_0xc55c('0x20')]?_0x2a16d6['options']['include']?_[_0xc55c('0x25')](_0x2a16d6[_0xc55c('0x20')][_0xc55c('0x23')],function(_0x593c54){return{'model':db[_0x593c54[_0xc55c('0x24')]],'as':_0x593c54['as'],'attributes':_0x593c54[_0xc55c('0x21')],'include':_0x593c54[_0xc55c('0x23')]?_['map'](_0x593c54[_0xc55c('0x23')],function(_0x640f50){return{'model':db[_0x640f50['model']],'as':_0x640f50['as'],'attributes':_0x640f50[_0xc55c('0x21')],'include':_0x640f50[_0xc55c('0x23')]?_[_0xc55c('0x25')](_0x640f50['include'],function(_0x255fc3){return{'model':db[_0x255fc3[_0xc55c('0x24')]],'as':_0x255fc3['as'],'attributes':_0x255fc3['attributes']};}):[]};}):[]};}):[]:[]})[_0xc55c('0x11')](function(_0x268113){logger[_0xc55c('0x12')](_0xc55c('0x26'),_0x2a16d6);logger[_0xc55c('0x14')](_0xc55c('0x26'),_0x2a16d6,JSON[_0xc55c('0x16')](_0x268113));_0x194865(_0x268113);})['catch'](function(_0x19697a){logger[_0xc55c('0x17')](_0xc55c('0x26'),_0x19697a[_0xc55c('0x19')],_0x2a16d6);_0x1807dc(_0x151407[_0xc55c('0x17')](0x1f4,_0x19697a[_0xc55c('0x19')]));});});};exports['PauseUser']=function(_0x518d68){var _0x3822da=this;return new Promise(function(_0x84a0,_0x3d1b95){var _0x4f59d6;return db[_0xc55c('0x1d')]['find']({'where':_0x518d68[_0xc55c('0x20')][_0xc55c('0x27')]||{},'attributes':['id',_0xc55c('0x28'),'role',_0xc55c('0x29'),'interface']})[_0xc55c('0x11')](function(_0x264f3c){if(_0x264f3c){_0x4f59d6=_0x264f3c;return db[_0xc55c('0x2a')]['update']({'paused':0x1},{'where':{'UserId':_0x4f59d6['id']},'individualHooks':!![]});}})[_0xc55c('0x11')](function(){if(_0x4f59d6){return db['MemberReport']['findAll']({'where':{'membername':_0x4f59d6['name'],'type':_0xc55c('0x2b'),'exitAt':null}});}})[_0xc55c('0x11')](function(_0xee83c4){if(_0x4f59d6){if(_0xee83c4&&_0xee83c4[_0xc55c('0x2c')]){var _0x52dcb7=moment()['format'](_0xc55c('0x2d'));for(var _0xa93b1f=0x0,_0x2ed0ed=_0xee83c4[_0xc55c('0x2c')];_0xa93b1f<_0x2ed0ed;_0xa93b1f++){_0xee83c4[_0xa93b1f][_0xc55c('0x2e')]({'exitAt':_0x52dcb7});}}}})[_0xc55c('0x11')](function(){if(_0x4f59d6){var _0x44666d=[];var _0x3eb52b=utils[_0xc55c('0x2f')]();_0x3eb52b['forEach'](function(_0xbaf4e1){_0x44666d[_0xc55c('0x30')]({'channel':_0xbaf4e1,'membername':_0x4f59d6[_0xc55c('0x28')],'interface':_[_0xc55c('0x31')](_0x4f59d6['interface'])?util['format'](_0xc55c('0x32'),_0x4f59d6[_0xc55c('0x28')]):_0x4f59d6['interface'],'type':_0xc55c('0x2b'),'enterAt':moment()[_0xc55c('0x33')](_0xc55c('0x2d')),'data1':_0x518d68[_0xc55c('0x34')][_0xc55c('0x35')]||_0xc55c('0x36'),'role':_0x4f59d6['role'],'internal':_0x4f59d6[_0xc55c('0x29')],'uniqueid':_0x518d68[_0xc55c('0x34')][_0xc55c('0x37')]||null});});return db[_0xc55c('0x38')][_0xc55c('0x39')](_0x44666d,{'individualHooks':!![]});}})[_0xc55c('0x11')](function(){if(_0x4f59d6){return _0x4f59d6[_0xc55c('0x3a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x518d68[_0xc55c('0x34')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xc55c('0x2d'))});}})[_0xc55c('0x11')](function(_0x3acda5){_0x84a0(_0x3acda5);})[_0xc55c('0x1b')](function(_0x58609a){_0x3d1b95(_0x3822da[_0xc55c('0x17')](0x1f4,_0x58609a[_0xc55c('0x19')]));});});};exports['UnpauseUser']=function(_0x22df57){var _0x216637=this;return new Promise(function(_0x3883d8,_0x5a1a96){var _0x19a1c7;return db[_0xc55c('0x1d')][_0xc55c('0x3b')]({'where':_0x22df57['options']['where']||{},'attributes':['id',_0xc55c('0x28')]})[_0xc55c('0x11')](function(_0x3c25a0){if(_0x3c25a0){_0x19a1c7=_0x3c25a0;if(_0x22df57[_0xc55c('0x34')]['channel']&&!utils[_0xc55c('0x3c')](_0x22df57[_0xc55c('0x34')][_0xc55c('0x3d')])){throw new Error(_0xc55c('0x3e'));}switch(_0x22df57[_0xc55c('0x34')]['channel']){case _0xc55c('0x3f'):return db[_0xc55c('0x2a')][_0xc55c('0x3a')]({'paused':0x0},{'where':{'UserId':_0x19a1c7['id']}})[_0xc55c('0x11')](function(){return db[_0xc55c('0x38')][_0xc55c('0x40')]({'where':{'channel':_0x22df57[_0xc55c('0x34')][_0xc55c('0x3d')],'membername':_0x19a1c7[_0xc55c('0x28')],'type':_0xc55c('0x2b'),'exitAt':null}});})[_0xc55c('0x11')](function(_0x3dba39){if(_0x3dba39){return _0x3dba39['update']({'exitAt':moment()[_0xc55c('0x33')](_0xc55c('0x2d')),'data2':_0xc55c('0x41')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x19a1c7['update']({'voicePause':![]});});case _0xc55c('0x42'):case _0xc55c('0x43'):case _0xc55c('0x44'):case'sms':case'openchannel':case'whatsapp':return db[_0xc55c('0x38')][_0xc55c('0x40')]({'where':{'channel':_0x22df57[_0xc55c('0x34')][_0xc55c('0x3d')],'membername':_0x19a1c7['name'],'type':_0xc55c('0x2b'),'exitAt':null}})['then'](function(_0x33f01b){return _0x33f01b[_0xc55c('0x3a')]({'exitAt':moment()['format'](_0xc55c('0x2d')),'data2':_0xc55c('0x41')},{'individualHooks':!![]});})[_0xc55c('0x11')](function(){var _0x577c44={};_[_0xc55c('0x45')](_0x577c44,util['format']('%s%s',_0x22df57[_0xc55c('0x34')][_0xc55c('0x3d')],'Pause'),![]);return _0x19a1c7[_0xc55c('0x3a')](_0x577c44);});default:return db[_0xc55c('0x2a')][_0xc55c('0x3a')]({'paused':0x0},{'where':{'UserId':_0x19a1c7['id']}})[_0xc55c('0x11')](function(){return db[_0xc55c('0x38')][_0xc55c('0x1e')]({'where':{'membername':_0x19a1c7[_0xc55c('0x28')],'type':_0xc55c('0x2b'),'exitAt':null}});})[_0xc55c('0x11')](function(_0x9c8d87){var _0x2525c1=[];_0x9c8d87['forEach'](function(_0x1193a6){_0x2525c1[_0xc55c('0x30')](_0x1193a6[_0xc55c('0x3a')]({'exitAt':moment()[_0xc55c('0x33')](_0xc55c('0x2d')),'data2':'system'}));});return BPromise[_0xc55c('0x46')](_0x2525c1);})[_0xc55c('0x11')](function(){return _0x19a1c7[_0xc55c('0x3a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xc55c('0x11')](function(_0x34e82b){_0x3883d8(_0x34e82b);})['catch'](function(_0x5b1e7f){_0x5a1a96(_0x216637[_0xc55c('0x17')](0x1f4,_0x5b1e7f[_0xc55c('0x19')]));});});};exports[_0xc55c('0x47')]=function(_0x1d5fe4){var _0x318004=this;return new Promise(function(_0x1fb1df,_0xe607b6){var _0x41f4d0;return db[_0xc55c('0x1d')]['findOne']({'where':_0x1d5fe4['options'][_0xc55c('0x27')]||{},'attributes':['id',_0xc55c('0x28')]})[_0xc55c('0x11')](function(_0x2f5825){if(_0x2f5825){_0x41f4d0=_0x2f5825;return db[_0xc55c('0x2a')][_0xc55c('0x48')]({'where':{'membername':_0x41f4d0[_0xc55c('0x28')]},'individualHooks':!![]});}})[_0xc55c('0x11')](function(){if(_0x41f4d0){return db[_0xc55c('0x38')][_0xc55c('0x1e')]({'where':{'membername':_0x41f4d0[_0xc55c('0x28')],'exitAt':null}});}})[_0xc55c('0x11')](function(_0xed309f){if(_0x41f4d0){if(_0xed309f&&_0xed309f[_0xc55c('0x2c')]){var _0x4c41b1=[];_0xed309f[_0xc55c('0x49')](function(_0x3a73ed){_0x4c41b1[_0xc55c('0x30')](_0x3a73ed[_0xc55c('0x3a')]({'exitAt':moment()[_0xc55c('0x33')](_0xc55c('0x2d'))}));});return BPromise[_0xc55c('0x46')](_0x4c41b1);}}})[_0xc55c('0x11')](function(){if(_0x41f4d0){return _0x41f4d0[_0xc55c('0x3a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xc55c('0x11')](function(_0x3a2923){_0x1fb1df(_0x3a2923);})[_0xc55c('0x1b')](function(_0x39407a){_0xe607b6(_0x318004['error'](0x1f4,_0x39407a[_0xc55c('0x19')]));});});};exports['LoginUser']=function(_0x18f5f8){var _0x5a8ba5=this;return new Promise(function(_0x441e85,_0x513ac5){var _0x52d6f2;var _0xd8899d;var _0x7b1107;var _0x543e56;return db[_0xc55c('0x1d')]['findOne']({'where':_0x18f5f8['options'][_0xc55c('0x27')]||{},'attributes':['id',_0xc55c('0x28'),_0xc55c('0x4a'),_0xc55c('0x4b'),_0xc55c('0x4c'),'internal','loginInPause','interface']})['then'](function(_0x1bc736){if(_0x1bc736){_0x52d6f2=_0x1bc736;_0x543e56=_0x18f5f8[_0xc55c('0x34')]['interface']?_0x18f5f8[_0xc55c('0x34')][_0xc55c('0x4d')]:util[_0xc55c('0x33')]('SIP/%s',_0x52d6f2[_0xc55c('0x28')]);return db[_0xc55c('0x1d')][_0xc55c('0x4e')]({'where':{'role':_0xc55c('0x4f'),'online':!![],'id':{'$ne':_0x52d6f2['id']}}});}})[_0xc55c('0x11')](function(_0x570ae7){if(_0x570ae7){_0x7b1107=_0x570ae7;return require('../../config/license/util')['getLicense']();}})[_0xc55c('0x11')](function(_0x1bf3cb){if(_0x1bf3cb&&_0x1bf3cb[_0xc55c('0x50')]&&_0x7b1107>=_0x1bf3cb[_0xc55c('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xc55c('0x11')](function(){if(_0x52d6f2){return db[_0xc55c('0x2a')][_0xc55c('0x48')]({'where':{'membername':_0x52d6f2['name']},'individualHooks':!![]});}})[_0xc55c('0x11')](function(){if(_0x52d6f2){return _0x52d6f2[_0xc55c('0x51')]({'raw':!![]});}})[_0xc55c('0x11')](function(_0x4e55dc){if(_0x52d6f2){if(_0x4e55dc){var _0x2eebb5=[];_0xd8899d=_0x4e55dc;if(_0xd8899d[_0xc55c('0x2c')]){for(var _0xbb73d1=0x0;_0xbb73d1<_0xd8899d[_0xc55c('0x2c')];_0xbb73d1++){_0x2eebb5[_0xc55c('0x30')](db['UserVoiceQueueRt'][_0xc55c('0x52')]({'membername':_0x52d6f2[_0xc55c('0x28')],'UserId':_0x52d6f2['id'],'queue_name':_0xd8899d[_0xbb73d1][_0xc55c('0x28')],'VoiceQueueId':_0xd8899d[_0xbb73d1]['id'],'interface':_0x543e56,'paused':_0x52d6f2[_0xc55c('0x53')]||![],'penalty':_0xd8899d[_0xbb73d1][_0xc55c('0x54')]||0x0}));}return BPromise[_0xc55c('0x46')](_0x2eebb5);}}}})['then'](function(){if(_0x52d6f2){return db[_0xc55c('0x38')][_0xc55c('0x1e')]({'where':{'membername':_0x52d6f2[_0xc55c('0x28')],'exitAt':null}});}})[_0xc55c('0x11')](function(_0xfb1cee){if(_0x52d6f2){if(_0xfb1cee&&_0xfb1cee['length']){var _0x5a8618=[];_0xfb1cee[_0xc55c('0x49')](function(_0x455a2b){_0x5a8618[_0xc55c('0x30')](_0x455a2b['update']({'exitAt':moment()[_0xc55c('0x33')](_0xc55c('0x2d'))}));});return BPromise[_0xc55c('0x46')](_0x5a8618);}}})[_0xc55c('0x11')](function(_0x3a6d8b){if(_0x52d6f2){var _0x4f323a=[];var _0x3b6a4e=[];var _0x32ecfd=utils[_0xc55c('0x2f')]();var _0x3abb45={'membername':_0x52d6f2[_0xc55c('0x28')],'interface':_0x543e56,'enterAt':moment()[_0xc55c('0x33')](_0xc55c('0x2d')),'role':_0x52d6f2[_0xc55c('0x4a')],'internal':_0x52d6f2[_0xc55c('0x29')]};_0x32ecfd[_0xc55c('0x49')](function(_0x59b43e){_0x4f323a['push'](_[_0xc55c('0x55')]({'channel':_0x59b43e,'type':'LOGIN','data1':_0xc55c('0x56'),'data2':_0x543e56},_0x3abb45));if(_0x52d6f2[_0xc55c('0x53')]){_0x3b6a4e[_0xc55c('0x30')](_['merge']({'channel':_0x59b43e,'type':'PAUSE','data1':'LOGININPAUSE'},_0x3abb45));}});return db[_0xc55c('0x38')][_0xc55c('0x39')](_0x4f323a[_0xc55c('0x57')](_0x3b6a4e),{'individualHooks':!![]});}})['then'](function(){if(_0x52d6f2){return _0x52d6f2[_0xc55c('0x3a')]({'online':!![],'lastLoginAt':moment()[_0xc55c('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x52d6f2[_0xc55c('0x53')]||![],'mailPause':_0x52d6f2[_0xc55c('0x53')]||![],'chatPause':_0x52d6f2[_0xc55c('0x53')]||![],'faxPause':_0x52d6f2[_0xc55c('0x53')]||![],'smsPause':_0x52d6f2['loginInPause']||![],'openchannelPause':_0x52d6f2[_0xc55c('0x53')]||![],'pauseType':_0x52d6f2[_0xc55c('0x53')]?_0xc55c('0x58'):null,'lastPauseAt':moment()[_0xc55c('0x33')](_0xc55c('0x2d')),'interface':_0x543e56});}})[_0xc55c('0x11')](function(_0x17d8df){_0x441e85(_0x17d8df);})[_0xc55c('0x1b')](function(_0xff9673){_0x513ac5(_0x5a8ba5[_0xc55c('0x17')](0x1f4,_0xff9673[_0xc55c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 6c7bf16..f029e06 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 _0xca45=['update','removeListener','length','./user.events','remove'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xca45,0xee));var _0x5ca4=function(_0x29fc62,_0x1f05f5){_0x29fc62=_0x29fc62-0x0;var _0x267637=_0xca45[_0x29fc62];return _0x267637;};'use strict';var UserEvents=require(_0x5ca4('0x0'));var events=['save',_0x5ca4('0x1'),_0x5ca4('0x2')];function createListener(_0x14ed25,_0x10f51a){return function(_0xdf3c02){_0x10f51a['emit'](_0x14ed25,_0xdf3c02);};}function removeListener(_0x1db2a7,_0x3c0e29){return function(){UserEvents[_0x5ca4('0x3')](_0x1db2a7,_0x3c0e29);};}exports['register']=function(_0x3da601){for(var _0x59fb8c=0x0,_0x562658=events[_0x5ca4('0x4')];_0x59fb8c<_0x562658;_0x59fb8c++){var _0x3daec7=events[_0x59fb8c];var _0x2c0f69=createListener('user:'+_0x3daec7,_0x3da601);UserEvents['on'](_0x3daec7,_0x2c0f69);}}; \ No newline at end of file +var _0x8e94=['update','emit','removeListener','length','user:','./user.events','save'];(function(_0x22c50e,_0x4ea131){var _0x500f85=function(_0x412f7b){while(--_0x412f7b){_0x22c50e['push'](_0x22c50e['shift']());}};_0x500f85(++_0x4ea131);}(_0x8e94,0x12b));var _0x48e9=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0x8e94[_0x281e5e];return _0x5a22d2;};'use strict';var UserEvents=require(_0x48e9('0x0'));var events=[_0x48e9('0x1'),'remove',_0x48e9('0x2')];function createListener(_0x3a8ca0,_0x565479){return function(_0x2228dc){_0x565479[_0x48e9('0x3')](_0x3a8ca0,_0x2228dc);};}function removeListener(_0x56e609,_0x343275){return function(){UserEvents[_0x48e9('0x4')](_0x56e609,_0x343275);};}exports['register']=function(_0x1b2f6c){for(var _0x4d9d0c=0x0,_0xeebc38=events[_0x48e9('0x5')];_0x4d9d0c<_0xeebc38;_0x4d9d0c++){var _0x2cacfa=events[_0x4d9d0c];var _0x4b8afa=createListener(_0x48e9('0x6')+_0x2cacfa,_0x1b2f6c);UserEvents['on'](_0x2cacfa,_0x4b8afa);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f0ad509..5e26abc 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 _0x85cf=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','util','path'];(function(_0x2a8c72,_0x5e0005){var _0x2586a3=function(_0x14be7f){while(--_0x14be7f){_0x2a8c72['push'](_0x2a8c72['shift']());}};_0x2586a3(++_0x5e0005);}(_0x85cf,0x76));var _0xf85c=function(_0x159abb,_0x17c433){_0x159abb=_0x159abb-0x0;var _0x55ee6a=_0x85cf[_0x159abb];return _0x55ee6a;};'use strict';var multer=require('multer');var util=require(_0xf85c('0x0'));var path=require(_0xf85c('0x1'));var timeout=require(_0xf85c('0x2'));var express=require(_0xf85c('0x3'));var router=express[_0xf85c('0x4')]();var fs_extra=require(_0xf85c('0x5'));var auth=require(_0xf85c('0x6'));var interaction=require(_0xf85c('0x7'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xce3a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x198cb2,_0x26f098){var _0x216c99=function(_0xaa2ded){while(--_0xaa2ded){_0x198cb2['push'](_0x198cb2['shift']());}};_0x216c99(++_0x26f098);}(_0xce3a,0x194));var _0xace3=function(_0x388e4b,_0x1561a3){_0x388e4b=_0x388e4b-0x0;var _0x63fd6e=_0xce3a[_0x388e4b];return _0x63fd6e;};'use strict';var multer=require(_0xace3('0x0'));var util=require(_0xace3('0x1'));var path=require(_0xace3('0x2'));var timeout=require(_0xace3('0x3'));var express=require(_0xace3('0x4'));var router=express[_0xace3('0x5')]();var fs_extra=require(_0xace3('0x6'));var auth=require(_0xace3('0x7'));var interaction=require(_0xace3('0x8'));var config=require(_0xace3('0x9'));module[_0xace3('0xa')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f6227a2..b5bfaf7 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 _0xd8b0=['exports','sequelize'];(function(_0x2a332d,_0x3d5865){var _0x5d24c4=function(_0x255e6c){while(--_0x255e6c){_0x2a332d['push'](_0x2a332d['shift']());}};_0x5d24c4(++_0x3d5865);}(_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')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0xa1199f,_0x21d285){var _0x31018e=function(_0x26f7b2){while(--_0x26f7b2){_0xa1199f['push'](_0xa1199f['shift']());}};_0x31018e(++_0x21d285);}(_0xb10b,0x12a));var _0xbb10=function(_0x415260,_0x135fcb){_0x415260=_0x415260-0x0;var _0x490f21=_0xb10b[_0x415260];return _0x490f21;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 58e1597..f2d9faf 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 _0xbe5d=['define','user_has_chat_queues','lodash','util','api','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x2aa17d,_0x110321){var _0x1f3242=function(_0x2364c1){while(--_0x2364c1){_0x2aa17d['push'](_0x2aa17d['shift']());}};_0x1f3242(++_0x110321);}(_0xbe5d,0x1b0));var _0xdbe5=function(_0x516cd6,_0xf63d1b){_0x516cd6=_0x516cd6-0x0;var _0x31c4bc=_0xbe5d[_0x516cd6];return _0x31c4bc;};'use strict';var _=require(_0xdbe5('0x0'));var util=require(_0xdbe5('0x1'));var logger=require('../../config/logger')(_0xdbe5('0x2'));var moment=require(_0xdbe5('0x3'));var BPromise=require(_0xdbe5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdbe5('0x5'));var config=require(_0xdbe5('0x6'));var attributes=require('./userChatQueue.attributes');module[_0xdbe5('0x7')]=function(_0x30ad16,_0x9a1df0){return _0x30ad16[_0xdbe5('0x8')]('UserChatQueue',attributes,{'tableName':_0xdbe5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad56=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xad56,0x17a));var _0x6ad5=function(_0x3735a2,_0x5deb88){_0x3735a2=_0x3735a2-0x0;var _0x31d61d=_0xad56[_0x3735a2];return _0x31d61d;};'use strict';var _=require('lodash');var util=require(_0x6ad5('0x0'));var logger=require(_0x6ad5('0x1'))(_0x6ad5('0x2'));var moment=require(_0x6ad5('0x3'));var BPromise=require(_0x6ad5('0x4'));var rp=require(_0x6ad5('0x5'));var fs=require('fs');var path=require(_0x6ad5('0x6'));var rimraf=require(_0x6ad5('0x7'));var config=require(_0x6ad5('0x8'));var attributes=require(_0x6ad5('0x9'));module[_0x6ad5('0xa')]=function(_0x2e4293,_0x681838){return _0x2e4293[_0x6ad5('0xb')](_0x6ad5('0xc'),attributes,{'tableName':_0x6ad5('0xd'),'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 a607d4e..37e290a 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 _0xdb1e=['info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0xdb1e,0x12b));var _0xedb1=function(_0x480eef,_0x4ab695){_0x480eef=_0x480eef-0x0;var _0xfde844=_0xdb1e[_0x480eef];return _0xfde844;};'use strict';var _=require(_0xedb1('0x0'));var util=require(_0xedb1('0x1'));var moment=require(_0xedb1('0x2'));var BPromise=require(_0xedb1('0x3'));var rs=require(_0xedb1('0x4'));var fs=require('fs');var Redis=require(_0xedb1('0x5'));var db=require(_0xedb1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xedb1('0x7'))('rpc');var config=require(_0xedb1('0x8'));var jayson=require(_0xedb1('0x9'));var client=jayson[_0xedb1('0xa')][_0xedb1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58d318,_0x2b31f4,_0xacfeed){return new BPromise(function(_0x51d2f3,_0x591df9){return client['request'](_0x58d318,_0xacfeed)[_0xedb1('0xc')](function(_0x5dc8e8){logger[_0xedb1('0xd')](_0xedb1('0xe'),_0x2b31f4,_0xedb1('0xf'));logger[_0xedb1('0x10')](_0xedb1('0x11'),_0x2b31f4,_0xedb1('0xf'),JSON[_0xedb1('0x12')](_0x5dc8e8));if(_0x5dc8e8[_0xedb1('0x13')]){if(_0x5dc8e8[_0xedb1('0x13')][_0xedb1('0x14')]===0x1f4){logger['error'](_0xedb1('0xe'),_0x2b31f4,_0x5dc8e8[_0xedb1('0x13')][_0xedb1('0x15')]);return _0x591df9(_0x5dc8e8['error'][_0xedb1('0x15')]);}logger[_0xedb1('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x2b31f4,_0x5dc8e8[_0xedb1('0x13')]['message']);return _0x51d2f3(_0x5dc8e8[_0xedb1('0x13')][_0xedb1('0x15')]);}else{logger[_0xedb1('0xd')](_0xedb1('0xe'),_0x2b31f4,_0xedb1('0xf'));_0x51d2f3(_0x5dc8e8[_0xedb1('0x16')][_0xedb1('0x15')]);}})[_0xedb1('0x17')](function(_0x5f2a1){logger[_0xedb1('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x2b31f4,_0x5f2a1);_0x591df9(_0x5f2a1);});});} \ No newline at end of file +var _0xd4d9=['UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1e1167,_0x1980c4){var _0x21c414=function(_0x4c705f){while(--_0x4c705f){_0x1e1167['push'](_0x1e1167['shift']());}};_0x21c414(++_0x1980c4);}(_0xd4d9,0x1e2));var _0x9d4d=function(_0x271b73,_0x37ac84){_0x271b73=_0x271b73-0x0;var _0x267965=_0xd4d9[_0x271b73];return _0x267965;};'use strict';var _=require('lodash');var util=require(_0x9d4d('0x0'));var moment=require(_0x9d4d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d4d('0x2'))['db'];var utils=require(_0x9d4d('0x3'));var logger=require(_0x9d4d('0x4'))('rpc');var config=require(_0x9d4d('0x5'));var jayson=require(_0x9d4d('0x6'));var client=jayson[_0x9d4d('0x7')][_0x9d4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1de989,_0x3b37e3,_0x557db3){return new BPromise(function(_0x57bea9,_0xaa1843){return client['request'](_0x1de989,_0x557db3)[_0x9d4d('0x9')](function(_0x45429c){logger['info'](_0x9d4d('0xa'),_0x3b37e3,_0x9d4d('0xb'));logger['debug'](_0x9d4d('0xc'),_0x3b37e3,'request\x20sent',JSON['stringify'](_0x45429c));if(_0x45429c[_0x9d4d('0xd')]){if(_0x45429c[_0x9d4d('0xd')][_0x9d4d('0xe')]===0x1f4){logger[_0x9d4d('0xd')](_0x9d4d('0xa'),_0x3b37e3,_0x45429c[_0x9d4d('0xd')][_0x9d4d('0xf')]);return _0xaa1843(_0x45429c[_0x9d4d('0xd')]['message']);}logger[_0x9d4d('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x3b37e3,_0x45429c['error']['message']);return _0x57bea9(_0x45429c[_0x9d4d('0xd')][_0x9d4d('0xf')]);}else{logger[_0x9d4d('0x10')](_0x9d4d('0xa'),_0x3b37e3,_0x9d4d('0xb'));_0x57bea9(_0x45429c[_0x9d4d('0x11')][_0x9d4d('0xf')]);}})[_0x9d4d('0x12')](function(_0x34a84b){logger[_0x9d4d('0xd')](_0x9d4d('0xa'),_0x3b37e3,_0x34a84b);_0xaa1843(_0x34a84b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 3db8c7b..2431b49 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 _0x6b72=['multer','path','connect-timeout','Router','fs-extra','../../config/environment','exports'];(function(_0x2e1992,_0x24dcf9){var _0x1908d9=function(_0x12e49f){while(--_0x12e49f){_0x2e1992['push'](_0x2e1992['shift']());}};_0x1908d9(++_0x24dcf9);}(_0x6b72,0x19d));var _0x26b7=function(_0xddd212,_0x52a870){_0xddd212=_0xddd212-0x0;var _0x55ac01=_0x6b72[_0xddd212];return _0x55ac01;};'use strict';var multer=require(_0x26b7('0x0'));var util=require('util');var path=require(_0x26b7('0x1'));var timeout=require(_0x26b7('0x2'));var express=require('express');var router=express[_0x26b7('0x3')]();var fs_extra=require(_0x26b7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x26b7('0x5'));module[_0x26b7('0x6')]=router; \ No newline at end of file +var _0x2884=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5e299e,_0x44f590){var _0x473b88=function(_0x20094a){while(--_0x20094a){_0x5e299e['push'](_0x5e299e['shift']());}};_0x473b88(++_0x44f590);}(_0x2884,0x1eb));var _0x4288=function(_0xa5c63f,_0x2aaaa8){_0xa5c63f=_0xa5c63f-0x0;var _0xf352b1=_0x2884[_0xa5c63f];return _0xf352b1;};'use strict';var multer=require(_0x4288('0x0'));var util=require('util');var path=require(_0x4288('0x1'));var timeout=require(_0x4288('0x2'));var express=require(_0x4288('0x3'));var router=express['Router']();var fs_extra=require(_0x4288('0x4'));var auth=require(_0x4288('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x4288('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 385bc97..5cd1a2e 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 _0xbaf0=['STRING','exports','INTEGER'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0baf('0x2')]}}; \ No newline at end of file +var _0x4213=['exports','INTEGER','STRING','sequelize'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x4213,0x77));var _0x3421=function(_0x533d4b,_0x23fb03){_0x533d4b=_0x533d4b-0x0;var _0x53c4e7=_0x4213[_0x533d4b];return _0x53c4e7;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'penalty':{'type':Sequelize[_0x3421('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3421('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3421('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5e7f9d0..e4b459f 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 _0x1ca3=['user_has_fax_queues','util','api','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes','UserFaxQueue'];(function(_0x3b4967,_0x2bdc77){var _0xd992c1=function(_0x373b0c){while(--_0x373b0c){_0x3b4967['push'](_0x3b4967['shift']());}};_0xd992c1(++_0x2bdc77);}(_0x1ca3,0x1ba));var _0x31ca=function(_0x2bdf69,_0x4f2e42){_0x2bdf69=_0x2bdf69-0x0;var _0x25dbb7=_0x1ca3[_0x2bdf69];return _0x25dbb7;};'use strict';var _=require('lodash');var util=require(_0x31ca('0x0'));var logger=require('../../config/logger')(_0x31ca('0x1'));var moment=require('moment');var BPromise=require(_0x31ca('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31ca('0x3'));var rimraf=require(_0x31ca('0x4'));var config=require(_0x31ca('0x5'));var attributes=require(_0x31ca('0x6'));module['exports']=function(_0x33e149,_0xa2a9de){return _0x33e149['define'](_0x31ca('0x7'),attributes,{'tableName':_0x31ca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37fe=['bluebird','request-promise','path','../../config/environment','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x37fe,0x1d3));var _0xe37f=function(_0x461322,_0x573961){_0x461322=_0x461322-0x0;var _0x6ca08d=_0x37fe[_0x461322];return _0x6ca08d;};'use strict';var _=require('lodash');var util=require(_0xe37f('0x0'));var logger=require(_0xe37f('0x1'))(_0xe37f('0x2'));var moment=require('moment');var BPromise=require(_0xe37f('0x3'));var rp=require(_0xe37f('0x4'));var fs=require('fs');var path=require(_0xe37f('0x5'));var rimraf=require('rimraf');var config=require(_0xe37f('0x6'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x1a8b9d,_0x36cb4a){return _0x1a8b9d[_0xe37f('0x7')](_0xe37f('0x8'),attributes,{'tableName':_0xe37f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index bc6bb8e..41c4822 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 _0x19ea=['jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4d1eef,_0xb9c2dc){var _0x7176c6=function(_0x2cd3ee){while(--_0x2cd3ee){_0x4d1eef['push'](_0x4d1eef['shift']());}};_0x7176c6(++_0xb9c2dc);}(_0x19ea,0x19d));var _0xa19e=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x19ea[_0x1e4a8e];return _0x5408f9;};'use strict';var _=require('lodash');var util=require(_0xa19e('0x0'));var moment=require(_0xa19e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa19e('0x2'))['db'];var utils=require(_0xa19e('0x3'));var logger=require(_0xa19e('0x4'))(_0xa19e('0x5'));var config=require(_0xa19e('0x6'));var jayson=require(_0xa19e('0x7'));var client=jayson[_0xa19e('0x8')][_0xa19e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x383a38,_0x211c71,_0xfc17e5){return new BPromise(function(_0x257586,_0x953723){return client[_0xa19e('0xa')](_0x383a38,_0xfc17e5)['then'](function(_0x4094bd){logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x211c71,_0xa19e('0xd'));logger['debug'](_0xa19e('0xe'),_0x211c71,'request\x20sent',JSON['stringify'](_0x4094bd));if(_0x4094bd[_0xa19e('0xf')]){if(_0x4094bd['error'][_0xa19e('0x10')]===0x1f4){logger[_0xa19e('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x211c71,_0x4094bd[_0xa19e('0xf')]['message']);return _0x953723(_0x4094bd[_0xa19e('0xf')][_0xa19e('0x11')]);}logger[_0xa19e('0xf')](_0xa19e('0xc'),_0x211c71,_0x4094bd[_0xa19e('0xf')][_0xa19e('0x11')]);return _0x257586(_0x4094bd[_0xa19e('0xf')][_0xa19e('0x11')]);}else{logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x211c71,_0xa19e('0xd'));_0x257586(_0x4094bd[_0xa19e('0x12')][_0xa19e('0x11')]);}})[_0xa19e('0x13')](function(_0x35f9a9){logger[_0xa19e('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x211c71,_0x35f9a9);_0x953723(_0x35f9a9);});});} \ No newline at end of file +var _0xc6a6=['message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0xfa7d2e,_0x2d81d5){var _0x169700=function(_0x11ed75){while(--_0x11ed75){_0xfa7d2e['push'](_0xfa7d2e['shift']());}};_0x169700(++_0x2d81d5);}(_0xc6a6,0x1a6));var _0x6c6a=function(_0x102846,_0x273812){_0x102846=_0x102846-0x0;var _0xaab81e=_0xc6a6[_0x102846];return _0xaab81e;};'use strict';var _=require('lodash');var util=require(_0x6c6a('0x0'));var moment=require(_0x6c6a('0x1'));var BPromise=require('bluebird');var rs=require(_0x6c6a('0x2'));var fs=require('fs');var Redis=require(_0x6c6a('0x3'));var db=require(_0x6c6a('0x4'))['db'];var utils=require(_0x6c6a('0x5'));var logger=require(_0x6c6a('0x6'))(_0x6c6a('0x7'));var config=require(_0x6c6a('0x8'));var jayson=require(_0x6c6a('0x9'));var client=jayson[_0x6c6a('0xa')][_0x6c6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x454dc9,_0x387961,_0x35605f){return new BPromise(function(_0x52eb3c,_0x22671e){return client[_0x6c6a('0xc')](_0x454dc9,_0x35605f)[_0x6c6a('0xd')](function(_0x35940a){logger[_0x6c6a('0xe')](_0x6c6a('0xf'),_0x387961,_0x6c6a('0x10'));logger['debug'](_0x6c6a('0x11'),_0x387961,_0x6c6a('0x10'),JSON['stringify'](_0x35940a));if(_0x35940a[_0x6c6a('0x12')]){if(_0x35940a[_0x6c6a('0x12')]['code']===0x1f4){logger[_0x6c6a('0x12')](_0x6c6a('0xf'),_0x387961,_0x35940a[_0x6c6a('0x12')]['message']);return _0x22671e(_0x35940a[_0x6c6a('0x12')][_0x6c6a('0x13')]);}logger['error'](_0x6c6a('0xf'),_0x387961,_0x35940a['error'][_0x6c6a('0x13')]);return _0x52eb3c(_0x35940a[_0x6c6a('0x12')][_0x6c6a('0x13')]);}else{logger['info'](_0x6c6a('0xf'),_0x387961,_0x6c6a('0x10'));_0x52eb3c(_0x35940a['result'][_0x6c6a('0x13')]);}})[_0x6c6a('0x14')](function(_0xdb9b0a){logger[_0x6c6a('0x12')](_0x6c6a('0xf'),_0x387961,_0xdb9b0a);_0x22671e(_0xdb9b0a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index bee9ad8..a7f8762 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 _0xae1b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','util','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xae1b,0x96));var _0xbae1=function(_0x220ee2,_0x3d32a9){_0x220ee2=_0x220ee2-0x0;var _0x239dee=_0xae1b[_0x220ee2];return _0x239dee;};'use strict';var multer=require('multer');var util=require(_0xbae1('0x0'));var path=require('path');var timeout=require(_0xbae1('0x1'));var express=require(_0xbae1('0x2'));var router=express[_0xbae1('0x3')]();var fs_extra=require(_0xbae1('0x4'));var auth=require(_0xbae1('0x5'));var interaction=require(_0xbae1('0x6'));var config=require('../../config/environment');module[_0xbae1('0x7')]=router; \ No newline at end of file +var _0x9123=['../../components/interaction/service','../../config/environment','multer','express','fs-extra','../../components/auth/service'];(function(_0x273102,_0x3e6523){var _0x697dd4=function(_0x50b26c){while(--_0x50b26c){_0x273102['push'](_0x273102['shift']());}};_0x697dd4(++_0x3e6523);}(_0x9123,0x140));var _0x3912=function(_0x3cb917,_0x8e49c){_0x3cb917=_0x3cb917-0x0;var _0x18d13e=_0x9123[_0x3cb917];return _0x18d13e;};'use strict';var multer=require(_0x3912('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3912('0x1'));var router=express['Router']();var fs_extra=require(_0x3912('0x2'));var auth=require(_0x3912('0x3'));var interaction=require(_0x3912('0x4'));var config=require(_0x3912('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index f7609f5..ce666d4 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 _0xd8b0=['exports','sequelize'];(function(_0x460ede,_0x185eb5){var _0x31944e=function(_0xcfe7e1){while(--_0xcfe7e1){_0x460ede['push'](_0x460ede['shift']());}};_0x31944e(++_0x185eb5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1f3ee7,_0x320e9d){var _0x2f750d=function(_0x31382e){while(--_0x31382e){_0x1f3ee7['push'](_0x1f3ee7['shift']());}};_0x2f750d(++_0x320e9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('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 2199fb0..48be99c 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x2e5636,_0x2b9540){var _0x4d7371=function(_0x28e14c){while(--_0x28e14c){_0x2e5636['push'](_0x2e5636['shift']());}};_0x4d7371(++_0x2b9540);}(_0xb10b,0x12a));var _0xbb10=function(_0x57fd0d,_0x2630ea){_0x57fd0d=_0x57fd0d-0x0;var _0x4b57f6=_0xb10b[_0x57fd0d];return _0x4b57f6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0xe50131,_0x3fd694){var _0x2cbe7c=function(_0xb4bd6d){while(--_0xb4bd6d){_0xe50131['push'](_0xe50131['shift']());}};_0x2cbe7c(++_0x3fd694);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 48f81ae..34e0e9c 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 _0x20fe=['request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x20fe,0xb3));var _0xe20f=function(_0x4f516a,_0x13c00f){_0x4f516a=_0x4f516a-0x0;var _0x560d28=_0x20fe[_0x4f516a];return _0x560d28;};'use strict';var _=require(_0xe20f('0x0'));var util=require(_0xe20f('0x1'));var moment=require('moment');var BPromise=require(_0xe20f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe20f('0x3'));var db=require(_0xe20f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe20f('0x5'));var config=require(_0xe20f('0x6'));var jayson=require(_0xe20f('0x7'));var client=jayson[_0xe20f('0x8')][_0xe20f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2668fa,_0x35db69,_0x4ce67d){return new BPromise(function(_0xf59f25,_0x29697){return client[_0xe20f('0xa')](_0x2668fa,_0x4ce67d)[_0xe20f('0xb')](function(_0x2a87e1){logger[_0xe20f('0xc')](_0xe20f('0xd'),_0x35db69,_0xe20f('0xe'));logger[_0xe20f('0xf')](_0xe20f('0x10'),_0x35db69,_0xe20f('0xe'),JSON['stringify'](_0x2a87e1));if(_0x2a87e1[_0xe20f('0x11')]){if(_0x2a87e1[_0xe20f('0x11')][_0xe20f('0x12')]===0x1f4){logger[_0xe20f('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x35db69,_0x2a87e1[_0xe20f('0x11')][_0xe20f('0x13')]);return _0x29697(_0x2a87e1['error'][_0xe20f('0x13')]);}logger[_0xe20f('0x11')](_0xe20f('0xd'),_0x35db69,_0x2a87e1['error']['message']);return _0xf59f25(_0x2a87e1[_0xe20f('0x11')][_0xe20f('0x13')]);}else{logger[_0xe20f('0xc')](_0xe20f('0xd'),_0x35db69,'request\x20sent');_0xf59f25(_0x2a87e1['result'][_0xe20f('0x13')]);}})[_0xe20f('0x14')](function(_0x1adb9f){logger[_0xe20f('0x11')](_0xe20f('0xd'),_0x35db69,_0x1adb9f);_0x29697(_0x1adb9f);});});} \ No newline at end of file +var _0x44e8=['UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug'];(function(_0x4a81db,_0x2eea9f){var _0x1caf65=function(_0x3881fb){while(--_0x3881fb){_0x4a81db['push'](_0x4a81db['shift']());}};_0x1caf65(++_0x2eea9f);}(_0x44e8,0xd7));var _0x844e=function(_0x4abd2d,_0x575c2a){_0x4abd2d=_0x4abd2d-0x0;var _0x2be680=_0x44e8[_0x4abd2d];return _0x2be680;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x844e('0x1'));var rs=require(_0x844e('0x2'));var fs=require('fs');var Redis=require(_0x844e('0x3'));var db=require(_0x844e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x844e('0x5'))(_0x844e('0x6'));var config=require(_0x844e('0x7'));var jayson=require(_0x844e('0x8'));var client=jayson['client'][_0x844e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x238796,_0x1706b3,_0x11cbd6){return new BPromise(function(_0x571b91,_0x31ab50){return client[_0x844e('0xa')](_0x238796,_0x11cbd6)[_0x844e('0xb')](function(_0x134672){logger[_0x844e('0xc')](_0x844e('0xd'),_0x1706b3,'request\x20sent');logger[_0x844e('0xe')](_0x844e('0xf'),_0x1706b3,_0x844e('0x10'),JSON[_0x844e('0x11')](_0x134672));if(_0x134672[_0x844e('0x12')]){if(_0x134672[_0x844e('0x12')][_0x844e('0x13')]===0x1f4){logger['error'](_0x844e('0xd'),_0x1706b3,_0x134672[_0x844e('0x12')]['message']);return _0x31ab50(_0x134672[_0x844e('0x12')][_0x844e('0x14')]);}logger['error'](_0x844e('0xd'),_0x1706b3,_0x134672[_0x844e('0x12')][_0x844e('0x14')]);return _0x571b91(_0x134672['error'][_0x844e('0x14')]);}else{logger[_0x844e('0xc')](_0x844e('0xd'),_0x1706b3,_0x844e('0x10'));_0x571b91(_0x134672[_0x844e('0x15')][_0x844e('0x14')]);}})[_0x844e('0x16')](function(_0x5506ef){logger['error'](_0x844e('0xd'),_0x1706b3,_0x5506ef);_0x31ab50(_0x5506ef);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index e960ad3..0784379 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 _0x5502=['connect-timeout','express','fs-extra','../../components/interaction/service','./userNotification.controller','exports','multer','util','path'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0x5502,0xf0));var _0x2550=function(_0x53bf6d,_0x4fb349){_0x53bf6d=_0x53bf6d-0x0;var _0x341fc2=_0x5502[_0x53bf6d];return _0x341fc2;};'use strict';var multer=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var path=require(_0x2550('0x2'));var timeout=require(_0x2550('0x3'));var express=require(_0x2550('0x4'));var router=express['Router']();var fs_extra=require(_0x2550('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2550('0x6'));var config=require('../../config/environment');var controller=require(_0x2550('0x7'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x2550('0x8')]=router; \ No newline at end of file +var _0x9cb2=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','util','path'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0x9cb2,0x15c));var _0x29cb=function(_0x509ea3,_0x4fd8a2){_0x509ea3=_0x509ea3-0x0;var _0x93f1b5=_0x9cb2[_0x509ea3];return _0x93f1b5;};'use strict';var multer=require(_0x29cb('0x0'));var util=require(_0x29cb('0x1'));var path=require(_0x29cb('0x2'));var timeout=require(_0x29cb('0x3'));var express=require(_0x29cb('0x4'));var router=express['Router']();var fs_extra=require(_0x29cb('0x5'));var auth=require(_0x29cb('0x6'));var interaction=require(_0x29cb('0x7'));var config=require(_0x29cb('0x8'));var controller=require(_0x29cb('0x9'));router[_0x29cb('0xa')]('/',auth[_0x29cb('0xb')](),controller[_0x29cb('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 56538dd..7724999 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 _0xaf04=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x2bc732,_0x169728){var _0x5e4442=function(_0x3b2811){while(--_0x3b2811){_0x2bc732['push'](_0x2bc732['shift']());}};_0x5e4442(++_0x169728);}(_0xaf04,0x18f));var _0x4af0=function(_0x482d7d,_0x4dbe23){_0x482d7d=_0x482d7d-0x0;var _0xecf6c1=_0xaf04[_0x482d7d];return _0xecf6c1;};'use strict';var Sequelize=require(_0x4af0('0x0'));module['exports']={'body':{'type':Sequelize[_0x4af0('0x1')]},'senderName':{'type':Sequelize[_0x4af0('0x2')]},'recipientsId':{'type':Sequelize[_0x4af0('0x1')]},'recipientsDescription':{'type':Sequelize[_0x4af0('0x2')]},'beep':{'type':Sequelize[_0x4af0('0x3')]}}; \ No newline at end of file +var _0x5752=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x402f70,_0x3d4111){var _0x4a1df2=function(_0x1aeb1f){while(--_0x1aeb1f){_0x402f70['push'](_0x402f70['shift']());}};_0x4a1df2(++_0x3d4111);}(_0x5752,0x1c1));var _0x2575=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x5752[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0x2575('0x0'));module[_0x2575('0x1')]={'body':{'type':Sequelize[_0x2575('0x2')]},'senderName':{'type':Sequelize[_0x2575('0x3')]},'recipientsId':{'type':Sequelize[_0x2575('0x2')]},'recipientsDescription':{'type':Sequelize[_0x2575('0x3')]},'beep':{'type':Sequelize[_0x2575('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d437da8..68030a5 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 _0x1d45=['defaults','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','sendUserNotification','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','union','ids','queue','replace','Queue','push','all','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis'];(function(_0x2e3c12,_0x59c523){var _0x223c67=function(_0x510b8c){while(--_0x510b8c){_0x2e3c12['push'](_0x2e3c12['shift']());}};_0x223c67(++_0x59c523);}(_0x1d45,0x193));var _0x51d4=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x1d45[_0x119d5a];return _0x15bff4;};'use strict';var emlformat=require(_0x51d4('0x0'));var rimraf=require(_0x51d4('0x1'));var zipdir=require(_0x51d4('0x2'));var jsonpatch=require(_0x51d4('0x3'));var rp=require(_0x51d4('0x4'));var moment=require(_0x51d4('0x5'));var BPromise=require(_0x51d4('0x6'));var Mustache=require('mustache');var util=require(_0x51d4('0x7'));var path=require(_0x51d4('0x8'));var sox=require(_0x51d4('0x9'));var csv=require(_0x51d4('0xa'));var ejs=require(_0x51d4('0xb'));var fs=require('fs');var fs_extra=require(_0x51d4('0xc'));var _=require(_0x51d4('0xd'));var squel=require('squel');var crypto=require(_0x51d4('0xe'));var jsforce=require(_0x51d4('0xf'));var deskjs=require(_0x51d4('0x10'));var toCsv=require(_0x51d4('0xa'));var querystring=require(_0x51d4('0x11'));var Papa=require(_0x51d4('0x12'));var Redis=require(_0x51d4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x51d4('0x14'));var as=require(_0x51d4('0x15'));var hardwareService=require(_0x51d4('0x16'));var logger=require(_0x51d4('0x17'))(_0x51d4('0x18'));var utils=require(_0x51d4('0x19'));var config=require(_0x51d4('0x1a'));var licenseUtil=require(_0x51d4('0x1b'));var db=require('../../mysqldb')['db'];config[_0x51d4('0x1c')]=_[_0x51d4('0x1d')](config['redis'],{'host':_0x51d4('0x1e'),'port':0x18eb});var socket=require(_0x51d4('0x1f'))(new Redis(config[_0x51d4('0x1c')]));require('./userNotification.socket')[_0x51d4('0x20')](socket);function respondWithStatusCode(_0x4231af,_0x4cfe80){_0x4cfe80=_0x4cfe80||0xcc;return function(_0x12aa9c){if(_0x12aa9c){return _0x4231af['sendStatus'](_0x4cfe80);}return _0x4231af[_0x51d4('0x21')](_0x4cfe80)[_0x51d4('0x22')]();};}function respondWithResult(_0x325e83,_0x4b4ec2){_0x4b4ec2=_0x4b4ec2||0xc8;return function(_0x4a0343){if(_0x4a0343){return _0x325e83[_0x51d4('0x21')](_0x4b4ec2)[_0x51d4('0x23')](_0x4a0343);}};}function respondWithFilteredResult(_0x3a733d,_0x3f6477){return function(_0x4838b4){if(_0x4838b4){var _0x29aadf=typeof _0x3f6477[_0x51d4('0x24')]==='undefined'&&typeof _0x3f6477[_0x51d4('0x25')]===_0x51d4('0x26');var _0x1b9d09=_0x4838b4[_0x51d4('0x27')];var _0xbbe6c5=_0x29aadf?0x0:_0x3f6477[_0x51d4('0x24')];var _0x22deb3=_0x29aadf?_0x4838b4[_0x51d4('0x27')]:_0x3f6477[_0x51d4('0x24')]+_0x3f6477['limit'];var _0x3522b9;if(_0x22deb3>=_0x1b9d09){_0x22deb3=_0x1b9d09;_0x3522b9=0xc8;}else{_0x3522b9=0xce;}_0x3a733d[_0x51d4('0x21')](_0x3522b9);return _0x3a733d[_0x51d4('0x28')](_0x51d4('0x29'),_0xbbe6c5+'-'+_0x22deb3+'/'+_0x1b9d09)[_0x51d4('0x23')](_0x4838b4);}return null;};}function patchUpdates(_0x21ca94){return function(_0x499c81){try{jsonpatch['apply'](_0x499c81,_0x21ca94,!![]);}catch(_0x590d09){return BPromise[_0x51d4('0x2a')](_0x590d09);}return _0x499c81['save']();};}function saveUpdates(_0x37e0e8,_0x1634ef){return function(_0x541736){if(_0x541736){return _0x541736[_0x51d4('0x2b')](_0x37e0e8)[_0x51d4('0x2c')](function(_0x2617b5){return _0x2617b5;});}return null;};}function removeEntity(_0x4bc3bd,_0x24270f){return function(_0x413e15){if(_0x413e15){return _0x413e15[_0x51d4('0x2d')]()[_0x51d4('0x2c')](function(){_0x4bc3bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f4ab4,_0x420df4){return function(_0x10fde5){if(!_0x10fde5){_0x4f4ab4[_0x51d4('0x2e')](0x194);}return _0x10fde5;};}function handleError(_0x33f718,_0x6f549){_0x6f549=_0x6f549||0x1f4;return function(_0x15da37){logger[_0x51d4('0x2f')](_0x15da37[_0x51d4('0x30')]);if(_0x15da37[_0x51d4('0x31')]){delete _0x15da37[_0x51d4('0x31')];}_0x33f718['status'](_0x6f549)[_0x51d4('0x32')](_0x15da37);};}function getMustacheRender(_0x3ec333,_0x4616a0){return Mustache[_0x51d4('0x33')](_0x3ec333,_[_0x51d4('0x34')](_0x4616a0[_0x51d4('0x35')],{'contact':_0x4616a0[_0x51d4('0x36')],'message':_0x4616a0[_0x51d4('0x37')],'agent':_0x4616a0[_0x51d4('0x38')],'interaction':_0x4616a0[_0x51d4('0x39')],'account':_0x4616a0[_0x51d4('0x3a')]}))||'';}exports[_0x51d4('0x3b')]=function(_0x2010af,_0x5a77d6,_0x2c8ff7){if(!_0x2010af[_0x51d4('0x35')][_0x51d4('0x3c')](_0x51d4('0x3d'))&&!_0x2010af[_0x51d4('0x35')][_0x51d4('0x3c')](_0x51d4('0x3e'))){throw new db[(_0x51d4('0x3f'))][(_0x51d4('0x40'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2010af[_0x51d4('0x35')][_0x51d4('0x3c')](_0x51d4('0x3e'))&&!_0x2010af[_0x51d4('0x35')]['hasOwnProperty']('view')){throw new db[(_0x51d4('0x3f'))]['ValidationError'](_0x51d4('0x41'));}if(!_0x2010af[_0x51d4('0x35')]['hasOwnProperty']('recipients')){throw new db[(_0x51d4('0x3f'))][(_0x51d4('0x40'))](_0x51d4('0x42'));}else{try{var _0x24d7b5=JSON[_0x51d4('0x43')](_0x2010af[_0x51d4('0x35')]['recipients']);}catch(_0x18f36e){logger['error'](_0x18f36e);throw new db['Sequelize']['ValidationError'](_0x51d4('0x44'));}var _0x5e5d0d=[_0x51d4('0x45'),'faxqueue',_0x51d4('0x46'),_0x51d4('0x47'),'smsqueue',_0x51d4('0x48'),_0x51d4('0x49'),_0x51d4('0x4a'),_0x51d4('0x4b')];if(_['some'](_0x24d7b5,function(_0x3f6fd4){return!_[_0x51d4('0x4c')](_0x5e5d0d,_0x3f6fd4[_0x51d4('0x4d')][_0x51d4('0x4e')]());})){throw new db['Sequelize'][(_0x51d4('0x40'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x41ca96={};_0x41ca96['senderName']=_0x2010af[_0x51d4('0x35')][_0x51d4('0x3c')](_0x51d4('0x4f'))?_0x2010af[_0x51d4('0x35')]['senderName']:_0x2010af[_0x51d4('0x4b')][_0x51d4('0x50')];_0x41ca96[_0x51d4('0x51')]=_['isEmpty'](_0x2010af['body'][_0x51d4('0x51')])?null:_0x2010af[_0x51d4('0x35')][_0x51d4('0x51')];_0x41ca96[_0x51d4('0x52')]=_0x2010af[_0x51d4('0x35')]['beep']||![];_0x41ca96[_0x51d4('0x53')]=_0x2010af[_0x51d4('0x4b')]['id'];return getContent(_0x2010af['body'])['then'](function(_0x5e6f53){_0x41ca96[_0x51d4('0x35')]=_0x5e6f53;return getRecipients(_0x24d7b5);})[_0x51d4('0x2c')](function(_0x5b61d3){_0x41ca96[_0x51d4('0x54')]=_['sortBy'](_0x5b61d3)['join'](',');return db[_0x51d4('0x55')][_0x51d4('0x56')](function(_0x41da97){return db[_0x51d4('0x57')][_0x51d4('0x58')](_0x41ca96,{'raw':!![],'transaction':_0x41da97})[_0x51d4('0x2c')](function(_0x34c096){var _0x335b5c={'sender':_0x41ca96[_0x51d4('0x4f')],'description':_0x41ca96['recipientsDescription'],'content':_0x41ca96['body'],'beep':_0x41ca96[_0x51d4('0x52')]};_0x5b61d3[_0x51d4('0x59')](function(_0x2e5d2d){_0x335b5c[_0x51d4('0x5a')]=_0x2e5d2d;socket[_0x51d4('0x5b')](_0x51d4('0x5c'),_0x335b5c);});return _0x34c096;});});})[_0x51d4('0x2c')](respondWithResult(_0x5a77d6,0xc9))[_0x51d4('0x5d')](handleError(_0x5a77d6,null));};function getContent(_0x188220){return new BPromise(function(_0x5e47a1,_0x317c8d){if(_0x188220[_0x51d4('0x3d')]){_0x5e47a1(_0x188220['text']);return;}return db[_0x51d4('0x5e')][_0x51d4('0x5f')]({'attributes':[_0x51d4('0x60')],'where':{'id':_0x188220['TemplateId']},'raw':!![]})[_0x51d4('0x2c')](function(_0x338aa3){if(!_0x338aa3)throw new db['Sequelize']['ValidationError'](_0x51d4('0x61'));var _0x50f4df=Mustache[_0x51d4('0x33')](_0x338aa3[_0x51d4('0x60')],_0x188220[_0x51d4('0x62')]);_0x5e47a1(_0x50f4df);})[_0x51d4('0x5d')](function(_0x26ba8f){_0x317c8d(_0x26ba8f);});});}function getRecipients(_0x7e663f){return new BPromise(function(_0x15abf9,_0x5f0a31){var _0x39a575=[];var _0x587b89=[];_0x7e663f[_0x51d4('0x59')](function(_0x18d983){var _0x6978de=_['startCase'](_0x18d983[_0x51d4('0x4d')]['toLowerCase']());if(_0x6978de==='User'){_0x39a575=_[_0x51d4('0x63')](_0x39a575,_0x18d983[_0x51d4('0x64')]);}else{if(_['includes'](_0x6978de,_0x51d4('0x65')))_0x6978de=_0x6978de[_0x51d4('0x66')](_0x51d4('0x65'),_0x51d4('0x67'));_0x18d983[_0x51d4('0x64')]['forEach'](function(_0x92eff2){_0x587b89[_0x51d4('0x68')](getAgents(_0x6978de,_0x92eff2));});}});return BPromise[_0x51d4('0x69')](_0x587b89)[_0x51d4('0x2c')](function(_0x3b4032){_0x39a575=_['union'](_0x39a575,_[_0x51d4('0x6a')](_0x3b4032));_0x15abf9(_0x39a575);})[_0x51d4('0x5d')](function(_0xe33bd7){_0x5f0a31(_0xe33bd7);});});}function getAgents(_0x41b459,_0x29a147){return new BPromise(function(_0x590557,_0x3c5115){return db[_0x41b459][_0x51d4('0x5f')]({'where':{'id':_0x29a147}})[_0x51d4('0x2c')](function(_0x45c28d){return _0x45c28d[_0x51d4('0x6b')]({'attributes':['id'],'raw':!![]})[_0x51d4('0x2c')](function(_0xea0687){var _0x4134d4=_['map'](_0xea0687,'id');_0x590557(_0x4134d4);});})['catch'](function(_0x4686db){_0x3c5115(_0x4686db);});});} \ No newline at end of file +var _0x0da3=['Queue','push','all','flatten','getAgents','map','eml-format','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userNotification.socket','register','sendStatus','status','end','json','limit','count','offset','set','apply','destroy','then','stack','name','send','merge','body','contact','message','agent','account','sendUserNotification','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','replace'];(function(_0x26704f,_0x5a4376){var _0x13ce24=function(_0x54942f){while(--_0x54942f){_0x26704f['push'](_0x26704f['shift']());}};_0x13ce24(++_0x5a4376);}(_0x0da3,0x6c));var _0x30da=function(_0x5057fc,_0x37d491){_0x5057fc=_0x5057fc-0x0;var _0x184a72=_0x0da3[_0x5057fc];return _0x184a72;};'use strict';var emlformat=require(_0x30da('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x30da('0x1'));var moment=require(_0x30da('0x2'));var BPromise=require(_0x30da('0x3'));var Mustache=require('mustache');var util=require(_0x30da('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x30da('0x5'));var fs=require('fs');var fs_extra=require(_0x30da('0x6'));var _=require(_0x30da('0x7'));var squel=require('squel');var crypto=require(_0x30da('0x8'));var jsforce=require(_0x30da('0x9'));var deskjs=require(_0x30da('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x30da('0xb'));var Redis=require(_0x30da('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x30da('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30da('0xe'));var logger=require(_0x30da('0xf'))(_0x30da('0x10'));var utils=require(_0x30da('0x11'));var config=require(_0x30da('0x12'));var licenseUtil=require(_0x30da('0x13'));var db=require(_0x30da('0x14'))['db'];config['redis']=_[_0x30da('0x15')](config['redis'],{'host':_0x30da('0x16'),'port':0x18eb});var socket=require(_0x30da('0x17'))(new Redis(config[_0x30da('0x18')]));require(_0x30da('0x19'))[_0x30da('0x1a')](socket);function respondWithStatusCode(_0x51bb39,_0x593af1){_0x593af1=_0x593af1||0xcc;return function(_0x26743e){if(_0x26743e){return _0x51bb39[_0x30da('0x1b')](_0x593af1);}return _0x51bb39[_0x30da('0x1c')](_0x593af1)[_0x30da('0x1d')]();};}function respondWithResult(_0x5f2c21,_0x3ffd17){_0x3ffd17=_0x3ffd17||0xc8;return function(_0x5ed9e1){if(_0x5ed9e1){return _0x5f2c21[_0x30da('0x1c')](_0x3ffd17)[_0x30da('0x1e')](_0x5ed9e1);}};}function respondWithFilteredResult(_0x164e17,_0x42edc2){return function(_0x6315b1){if(_0x6315b1){var _0x26a309=typeof _0x42edc2['offset']==='undefined'&&typeof _0x42edc2[_0x30da('0x1f')]==='undefined';var _0x299b3b=_0x6315b1[_0x30da('0x20')];var _0x1070be=_0x26a309?0x0:_0x42edc2[_0x30da('0x21')];var _0xec4ca5=_0x26a309?_0x6315b1[_0x30da('0x20')]:_0x42edc2[_0x30da('0x21')]+_0x42edc2[_0x30da('0x1f')];var _0x1d4f57;if(_0xec4ca5>=_0x299b3b){_0xec4ca5=_0x299b3b;_0x1d4f57=0xc8;}else{_0x1d4f57=0xce;}_0x164e17['status'](_0x1d4f57);return _0x164e17[_0x30da('0x22')]('Content-Range',_0x1070be+'-'+_0xec4ca5+'/'+_0x299b3b)[_0x30da('0x1e')](_0x6315b1);}return null;};}function patchUpdates(_0x43ab3f){return function(_0x3350c0){try{jsonpatch[_0x30da('0x23')](_0x3350c0,_0x43ab3f,!![]);}catch(_0x3e7c0f){return BPromise['reject'](_0x3e7c0f);}return _0x3350c0['save']();};}function saveUpdates(_0x58080f,_0x54394c){return function(_0x4a74d3){if(_0x4a74d3){return _0x4a74d3['update'](_0x58080f)['then'](function(_0x2a80ea){return _0x2a80ea;});}return null;};}function removeEntity(_0x59e405,_0x43d282){return function(_0x472bfd){if(_0x472bfd){return _0x472bfd[_0x30da('0x24')]()[_0x30da('0x25')](function(){_0x59e405[_0x30da('0x1c')](0xcc)[_0x30da('0x1d')]();});}};}function handleEntityNotFound(_0xbf5e60,_0x54f371){return function(_0x1640dc){if(!_0x1640dc){_0xbf5e60[_0x30da('0x1b')](0x194);}return _0x1640dc;};}function handleError(_0x1690b7,_0x265420){_0x265420=_0x265420||0x1f4;return function(_0x2f3cd5){logger['error'](_0x2f3cd5[_0x30da('0x26')]);if(_0x2f3cd5[_0x30da('0x27')]){delete _0x2f3cd5[_0x30da('0x27')];}_0x1690b7['status'](_0x265420)[_0x30da('0x28')](_0x2f3cd5);};}function getMustacheRender(_0x2c0780,_0x1d44ec){return Mustache['render'](_0x2c0780,_[_0x30da('0x29')](_0x1d44ec[_0x30da('0x2a')],{'contact':_0x1d44ec[_0x30da('0x2b')],'message':_0x1d44ec[_0x30da('0x2c')],'agent':_0x1d44ec[_0x30da('0x2d')],'interaction':_0x1d44ec['interaction'],'account':_0x1d44ec[_0x30da('0x2e')]}))||'';}exports[_0x30da('0x2f')]=function(_0xf2f0a1,_0x17a25a,_0x43ea29){if(!_0xf2f0a1[_0x30da('0x2a')]['hasOwnProperty'](_0x30da('0x30'))&&!_0xf2f0a1['body'][_0x30da('0x31')](_0x30da('0x32'))){throw new db[(_0x30da('0x33'))][(_0x30da('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0xf2f0a1['body']['hasOwnProperty'](_0x30da('0x32'))&&!_0xf2f0a1[_0x30da('0x2a')][_0x30da('0x31')](_0x30da('0x35'))){throw new db[(_0x30da('0x33'))][(_0x30da('0x34'))](_0x30da('0x36'));}if(!_0xf2f0a1[_0x30da('0x2a')][_0x30da('0x31')](_0x30da('0x37'))){throw new db[(_0x30da('0x33'))]['ValidationError'](_0x30da('0x38'));}else{try{var _0x194ec4=JSON[_0x30da('0x39')](_0xf2f0a1['body'][_0x30da('0x37')]);}catch(_0x5b6ade){logger[_0x30da('0x3a')](_0x5b6ade);throw new db[(_0x30da('0x33'))][(_0x30da('0x34'))](_0x30da('0x3b'));}var _0x571a1c=['chatqueue',_0x30da('0x3c'),_0x30da('0x3d'),_0x30da('0x3e'),'smsqueue',_0x30da('0x3f'),_0x30da('0x40'),_0x30da('0x41'),_0x30da('0x42')];if(_['some'](_0x194ec4,function(_0xfd2327){return!_['includes'](_0x571a1c,_0xfd2327[_0x30da('0x43')][_0x30da('0x44')]());})){throw new db[(_0x30da('0x33'))][(_0x30da('0x34'))](_0x30da('0x45'));}}}var _0x2780d8={};_0x2780d8['senderName']=_0xf2f0a1[_0x30da('0x2a')]['hasOwnProperty'](_0x30da('0x46'))?_0xf2f0a1[_0x30da('0x2a')][_0x30da('0x46')]:_0xf2f0a1['user'][_0x30da('0x47')];_0x2780d8[_0x30da('0x48')]=_['isEmpty'](_0xf2f0a1[_0x30da('0x2a')][_0x30da('0x48')])?null:_0xf2f0a1[_0x30da('0x2a')][_0x30da('0x48')];_0x2780d8[_0x30da('0x49')]=_0xf2f0a1[_0x30da('0x2a')][_0x30da('0x49')]||![];_0x2780d8[_0x30da('0x4a')]=_0xf2f0a1[_0x30da('0x42')]['id'];return getContent(_0xf2f0a1['body'])[_0x30da('0x25')](function(_0x594aec){_0x2780d8[_0x30da('0x2a')]=_0x594aec;return getRecipients(_0x194ec4);})[_0x30da('0x25')](function(_0x4662f3){_0x2780d8[_0x30da('0x4b')]=_[_0x30da('0x4c')](_0x4662f3)[_0x30da('0x4d')](',');return db[_0x30da('0x4e')][_0x30da('0x4f')](function(_0x2ea381){return db['UserNotification'][_0x30da('0x50')](_0x2780d8,{'raw':!![],'transaction':_0x2ea381})[_0x30da('0x25')](function(_0x219727){var _0x4db97a={'sender':_0x2780d8['senderName'],'description':_0x2780d8[_0x30da('0x48')],'content':_0x2780d8[_0x30da('0x2a')],'beep':_0x2780d8[_0x30da('0x49')]};_0x4662f3[_0x30da('0x51')](function(_0x103334){_0x4db97a['recipient']=_0x103334;socket[_0x30da('0x52')](_0x30da('0x53'),_0x4db97a);});return _0x219727;});});})[_0x30da('0x25')](respondWithResult(_0x17a25a,0xc9))[_0x30da('0x54')](handleError(_0x17a25a,null));};function getContent(_0x2c12a5){return new BPromise(function(_0x47e1b9,_0x3614fd){if(_0x2c12a5[_0x30da('0x30')]){_0x47e1b9(_0x2c12a5['text']);return;}return db[_0x30da('0x55')][_0x30da('0x56')]({'attributes':[_0x30da('0x57')],'where':{'id':_0x2c12a5['TemplateId']},'raw':!![]})[_0x30da('0x25')](function(_0x503d8a){if(!_0x503d8a)throw new db[(_0x30da('0x33'))][(_0x30da('0x34'))](_0x30da('0x58'));var _0x52ff5e=Mustache[_0x30da('0x59')](_0x503d8a[_0x30da('0x57')],_0x2c12a5['view']);_0x47e1b9(_0x52ff5e);})[_0x30da('0x54')](function(_0xe28ee8){_0x3614fd(_0xe28ee8);});});}function getRecipients(_0x14d470){return new BPromise(function(_0x52141a,_0x5bc346){var _0xf8d121=[];var _0x26c173=[];_0x14d470['forEach'](function(_0x4fe47c){var _0x444320=_[_0x30da('0x5a')](_0x4fe47c[_0x30da('0x43')]['toLowerCase']());if(_0x444320===_0x30da('0x5b')){_0xf8d121=_[_0x30da('0x5c')](_0xf8d121,_0x4fe47c[_0x30da('0x5d')]);}else{if(_['includes'](_0x444320,_0x30da('0x5e')))_0x444320=_0x444320[_0x30da('0x5f')]('queue',_0x30da('0x60'));_0x4fe47c[_0x30da('0x5d')]['forEach'](function(_0xf4ff3d){_0x26c173[_0x30da('0x61')](getAgents(_0x444320,_0xf4ff3d));});}});return BPromise[_0x30da('0x62')](_0x26c173)[_0x30da('0x25')](function(_0x4b0527){_0xf8d121=_[_0x30da('0x5c')](_0xf8d121,_[_0x30da('0x63')](_0x4b0527));_0x52141a(_0xf8d121);})[_0x30da('0x54')](function(_0xbcdc72){_0x5bc346(_0xbcdc72);});});}function getAgents(_0x72b06e,_0x11c8b6){return new BPromise(function(_0x314bdb,_0x5b7454){return db[_0x72b06e]['findOne']({'where':{'id':_0x11c8b6}})['then'](function(_0xcb0d77){return _0xcb0d77[_0x30da('0x64')]({'attributes':['id'],'raw':!![]})['then'](function(_0x6cd7b0){var _0x4507e9=_[_0x30da('0x65')](_0x6cd7b0,'id');_0x314bdb(_0x4507e9);});})[_0x30da('0x54')](function(_0xd70be){_0x5b7454(_0xd70be);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index d194d93..a6487c7 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 _0x7dfd=['../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd7df('0x0'));var UserNotification=require(_0xd7df('0x1'))['db'][_0xd7df('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xd7df('0x3')](0x0);var events={'afterCreate':_0xd7df('0x4'),'afterUpdate':_0xd7df('0x5'),'afterDestroy':_0xd7df('0x6')};function emitEvent(_0x38eee7){return function(_0x3ef231,_0x3d8c5a,_0x65a0b6){UserNotificationEvents[_0xd7df('0x7')](_0x38eee7+':'+_0x3ef231['id'],_0x3ef231);UserNotificationEvents[_0xd7df('0x7')](_0x38eee7,_0x3ef231);_0x65a0b6(null);};}for(var e in events){if(events[_0xd7df('0x8')](e)){var event=events[e];UserNotification[_0xd7df('0x9')](e,emitEvent(event));}}module[_0xd7df('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0x6aa7=['events','UserNotification','setMaxListeners','save','update','emit','hook','exports'];(function(_0x1a0652,_0x5a43e0){var _0x454506=function(_0x15f55f){while(--_0x15f55f){_0x1a0652['push'](_0x1a0652['shift']());}};_0x454506(++_0x5a43e0);}(_0x6aa7,0x178));var _0x76aa=function(_0x561d8a,_0x12493a){_0x561d8a=_0x561d8a-0x0;var _0xdba40d=_0x6aa7[_0x561d8a];return _0xdba40d;};'use strict';var EventEmitter=require(_0x76aa('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x76aa('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x76aa('0x2')](0x0);var events={'afterCreate':_0x76aa('0x3'),'afterUpdate':_0x76aa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x13f62b){return function(_0xef15ef,_0x1d6e04,_0x511588){UserNotificationEvents['emit'](_0x13f62b+':'+_0xef15ef['id'],_0xef15ef);UserNotificationEvents[_0x76aa('0x5')](_0x13f62b,_0xef15ef);_0x511588(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x76aa('0x6')](e,emitEvent(event));}}module[_0x76aa('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 9df188e..337b12e 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 _0x8ce8=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x79e94e,_0x2de453){var _0x35fe33=function(_0x4dc519){while(--_0x4dc519){_0x79e94e['push'](_0x79e94e['shift']());}};_0x35fe33(++_0x2de453);}(_0x8ce8,0xd3));var _0x88ce=function(_0x215ef4,_0x32ede2){_0x215ef4=_0x215ef4-0x0;var _0x578b9d=_0x8ce8[_0x215ef4];return _0x578b9d;};'use strict';var _=require(_0x88ce('0x0'));var util=require('util');var logger=require(_0x88ce('0x1'))(_0x88ce('0x2'));var moment=require(_0x88ce('0x3'));var BPromise=require(_0x88ce('0x4'));var rp=require(_0x88ce('0x5'));var fs=require('fs');var path=require(_0x88ce('0x6'));var rimraf=require(_0x88ce('0x7'));var config=require(_0x88ce('0x8'));var attributes=require(_0x88ce('0x9'));module[_0x88ce('0xa')]=function(_0x530921,_0x58e101){return _0x530921[_0x88ce('0xb')](_0x88ce('0xc'),attributes,{'tableName':_0x88ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x88ce('0xe'),'collate':_0x88ce('0xf')});}; \ No newline at end of file +var _0x0f73=['utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserNotification','userNotifications'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0f73,0x146));var _0x30f7=function(_0xf19b50,_0x3cd94c){_0xf19b50=_0xf19b50-0x0;var _0x1373b4=_0x0f73[_0xf19b50];return _0x1373b4;};'use strict';var _=require(_0x30f7('0x0'));var util=require(_0x30f7('0x1'));var logger=require(_0x30f7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x30f7('0x3'));var rp=require(_0x30f7('0x4'));var fs=require('fs');var path=require(_0x30f7('0x5'));var rimraf=require(_0x30f7('0x6'));var config=require(_0x30f7('0x7'));var attributes=require('./userNotification.attributes');module[_0x30f7('0x8')]=function(_0x593fe7,_0x49b5b8){return _0x593fe7[_0x30f7('0x9')](_0x30f7('0xa'),attributes,{'tableName':_0x30f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x30f7('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index dad7c3a..0de76ab 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 _0xdfce=['UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userNotification.socket','register','request','then','info'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xdfce,0xf9));var _0xedfc=function(_0x33cefc,_0x56812a){_0x33cefc=_0x33cefc-0x0;var _0x4a8511=_0xdfce[_0x33cefc];return _0x4a8511;};'use strict';var _=require(_0xedfc('0x0'));var util=require(_0xedfc('0x1'));var moment=require(_0xedfc('0x2'));var BPromise=require(_0xedfc('0x3'));var rs=require(_0xedfc('0x4'));var fs=require('fs');var Redis=require(_0xedfc('0x5'));var db=require(_0xedfc('0x6'))['db'];var utils=require(_0xedfc('0x7'));var logger=require(_0xedfc('0x8'))(_0xedfc('0x9'));var config=require(_0xedfc('0xa'));var jayson=require(_0xedfc('0xb'));var client=jayson[_0xedfc('0xc')][_0xedfc('0xd')]({'port':0x232a});config[_0xedfc('0xe')]=_[_0xedfc('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedfc('0xe')]));require(_0xedfc('0x10'))[_0xedfc('0x11')](socket);function respondWithRpcPromise(_0x596cd5,_0x1652d1,_0x3485da){return new BPromise(function(_0xcb9c6a,_0x2dd3a6){return client[_0xedfc('0x12')](_0x596cd5,_0x3485da)[_0xedfc('0x13')](function(_0x1fe672){logger[_0xedfc('0x14')](_0xedfc('0x15'),_0x1652d1,'request\x20sent');logger[_0xedfc('0x16')](_0xedfc('0x17'),_0x1652d1,_0xedfc('0x18'),JSON[_0xedfc('0x19')](_0x1fe672));if(_0x1fe672[_0xedfc('0x1a')]){if(_0x1fe672[_0xedfc('0x1a')]['code']===0x1f4){logger[_0xedfc('0x1a')](_0xedfc('0x15'),_0x1652d1,_0x1fe672['error'][_0xedfc('0x1b')]);return _0x2dd3a6(_0x1fe672[_0xedfc('0x1a')][_0xedfc('0x1b')]);}logger[_0xedfc('0x1a')]('UserNotification,\x20%s,\x20%s',_0x1652d1,_0x1fe672[_0xedfc('0x1a')]['message']);return _0xcb9c6a(_0x1fe672['error'][_0xedfc('0x1b')]);}else{logger[_0xedfc('0x14')](_0xedfc('0x15'),_0x1652d1,'request\x20sent');_0xcb9c6a(_0x1fe672[_0xedfc('0x1c')][_0xedfc('0x1b')]);}})[_0xedfc('0x1d')](function(_0xcc635c){logger['error'](_0xedfc('0x15'),_0x1652d1,_0xcc635c);_0x2dd3a6(_0xcc635c);});});} \ No newline at end of file +var _0x2f85=['jayson/promise','http','redis','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x8dec24,_0x903de0){var _0x381de1=function(_0x1aceb4){while(--_0x1aceb4){_0x8dec24['push'](_0x8dec24['shift']());}};_0x381de1(++_0x903de0);}(_0x2f85,0x198));var _0x52f8=function(_0x385a3b,_0x1cf3ce){_0x385a3b=_0x385a3b-0x0;var _0x226aee=_0x2f85[_0x385a3b];return _0x226aee;};'use strict';var _=require(_0x52f8('0x0'));var util=require('util');var moment=require(_0x52f8('0x1'));var BPromise=require(_0x52f8('0x2'));var rs=require(_0x52f8('0x3'));var fs=require('fs');var Redis=require(_0x52f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x52f8('0x5'));var logger=require('../../config/logger')(_0x52f8('0x6'));var config=require(_0x52f8('0x7'));var jayson=require(_0x52f8('0x8'));var client=jayson['client'][_0x52f8('0x9')]({'port':0x232a});config[_0x52f8('0xa')]=_['defaults'](config[_0x52f8('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x52f8('0xb'))(new Redis(config[_0x52f8('0xa')]));require(_0x52f8('0xc'))[_0x52f8('0xd')](socket);function respondWithRpcPromise(_0x3ee9e5,_0x44b04c,_0x5ce988){return new BPromise(function(_0x1a5ba1,_0x20f3ee){return client[_0x52f8('0xe')](_0x3ee9e5,_0x5ce988)[_0x52f8('0xf')](function(_0x4ba3e5){logger[_0x52f8('0x10')](_0x52f8('0x11'),_0x44b04c,_0x52f8('0x12'));logger[_0x52f8('0x13')](_0x52f8('0x14'),_0x44b04c,_0x52f8('0x12'),JSON['stringify'](_0x4ba3e5));if(_0x4ba3e5[_0x52f8('0x15')]){if(_0x4ba3e5[_0x52f8('0x15')][_0x52f8('0x16')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x44b04c,_0x4ba3e5['error'][_0x52f8('0x17')]);return _0x20f3ee(_0x4ba3e5['error'][_0x52f8('0x17')]);}logger[_0x52f8('0x15')](_0x52f8('0x11'),_0x44b04c,_0x4ba3e5[_0x52f8('0x15')][_0x52f8('0x17')]);return _0x1a5ba1(_0x4ba3e5[_0x52f8('0x15')][_0x52f8('0x17')]);}else{logger[_0x52f8('0x10')](_0x52f8('0x11'),_0x44b04c,_0x52f8('0x12'));_0x1a5ba1(_0x4ba3e5[_0x52f8('0x18')][_0x52f8('0x17')]);}})[_0x52f8('0x19')](function(_0x16d89c){logger[_0x52f8('0x15')](_0x52f8('0x11'),_0x44b04c,_0x16d89c);_0x20f3ee(_0x16d89c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 62dfcd3..e3c1a75 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 _0xecb2=['userNotification:','./userNotification.events','update','emit','removeListener','register','length'];(function(_0x46a513,_0x31dcd3){var _0xd23d18=function(_0x3571c7){while(--_0x3571c7){_0x46a513['push'](_0x46a513['shift']());}};_0xd23d18(++_0x31dcd3);}(_0xecb2,0xf6));var _0x2ecb=function(_0x1041cd,_0x571df0){_0x1041cd=_0x1041cd-0x0;var _0x58c89b=_0xecb2[_0x1041cd];return _0x58c89b;};'use strict';var UserNotificationEvents=require(_0x2ecb('0x0'));var events=['save','remove',_0x2ecb('0x1')];function createListener(_0x548b3c,_0x59d894){return function(_0x1bb230){_0x59d894[_0x2ecb('0x2')](_0x548b3c,_0x1bb230);};}function removeListener(_0x393e7c,_0x2a4fe5){return function(){UserNotificationEvents[_0x2ecb('0x3')](_0x393e7c,_0x2a4fe5);};}exports[_0x2ecb('0x4')]=function(_0x4c169f){for(var _0x51b28c=0x0,_0x49de99=events[_0x2ecb('0x5')];_0x51b28c<_0x49de99;_0x51b28c++){var _0x3df4a0=events[_0x51b28c];var _0x15a959=createListener(_0x2ecb('0x6')+_0x3df4a0,_0x4c169f);UserNotificationEvents['on'](_0x3df4a0,_0x15a959);}}; \ No newline at end of file +var _0x251b=['update','emit','removeListener','register','length','./userNotification.events','save','remove'];(function(_0x13bd21,_0x2c622d){var _0x3c3b86=function(_0x1dbc49){while(--_0x1dbc49){_0x13bd21['push'](_0x13bd21['shift']());}};_0x3c3b86(++_0x2c622d);}(_0x251b,0x185));var _0xb251=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x251b[_0x93942f];return _0x23fcd8;};'use strict';var UserNotificationEvents=require(_0xb251('0x0'));var events=[_0xb251('0x1'),_0xb251('0x2'),_0xb251('0x3')];function createListener(_0x2ddbc3,_0x4317d4){return function(_0x39d5bf){_0x4317d4[_0xb251('0x4')](_0x2ddbc3,_0x39d5bf);};}function removeListener(_0x304446,_0x334010){return function(){UserNotificationEvents[_0xb251('0x5')](_0x304446,_0x334010);};}exports[_0xb251('0x6')]=function(_0x5e96a7){for(var _0x30797a=0x0,_0x594a1b=events[_0xb251('0x7')];_0x30797a<_0x594a1b;_0x30797a++){var _0x3cf251=events[_0x30797a];var _0x923bc0=createListener('userNotification:'+_0x3cf251,_0x5e96a7);UserNotificationEvents['on'](_0x3cf251,_0x923bc0);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index ae2c2cb..43fca44 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 _0xbee3=['../../components/auth/service','../../components/interaction/service','../../config/environment','util','express','Router'];(function(_0x33813a,_0x502da7){var _0x239a3f=function(_0x1db4ae){while(--_0x1db4ae){_0x33813a['push'](_0x33813a['shift']());}};_0x239a3f(++_0x502da7);}(_0xbee3,0xd5));var _0x3bee=function(_0x15aec9,_0x12bd1f){_0x15aec9=_0x15aec9-0x0;var _0x9d7e2c=_0xbee3[_0x15aec9];return _0x9d7e2c;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3bee('0x3'));var interaction=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));module['exports']=router; \ No newline at end of file +var _0xd23d=['multer','util','path','connect-timeout','express','Router','fs-extra','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd23d,0xa0));var _0xdd23=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0xd23d[_0x27beea];return _0x122645;};'use strict';var multer=require(_0xdd23('0x0'));var util=require(_0xdd23('0x1'));var path=require(_0xdd23('0x2'));var timeout=require(_0xdd23('0x3'));var express=require(_0xdd23('0x4'));var router=express[_0xdd23('0x5')]();var fs_extra=require(_0xdd23('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xdd23('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 e5653ef..648420a 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1ec75e,_0x3b3233){var _0x2a1a7f=function(_0x345dc5){while(--_0x345dc5){_0x1ec75e['push'](_0x1ec75e['shift']());}};_0x2a1a7f(++_0x3b3233);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x4def54,_0x36de1d){var _0x137bee=function(_0x1dd6f4){while(--_0x1dd6f4){_0x4def54['push'](_0x4def54['shift']());}};_0x137bee(++_0x36de1d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 066afd5..f931b4e 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 _0x6286=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_has_openchannel_queues','util'];(function(_0x5d51b7,_0x2c7530){var _0x1b8516=function(_0x3e0838){while(--_0x3e0838){_0x5d51b7['push'](_0x5d51b7['shift']());}};_0x1b8516(++_0x2c7530);}(_0x6286,0xaf));var _0x6628=function(_0x50ff08,_0x26a6e6){_0x50ff08=_0x50ff08-0x0;var _0x53ddeb=_0x6286[_0x50ff08];return _0x53ddeb;};'use strict';var _=require('lodash');var util=require(_0x6628('0x0'));var logger=require('../../config/logger')(_0x6628('0x1'));var moment=require(_0x6628('0x2'));var BPromise=require(_0x6628('0x3'));var rp=require(_0x6628('0x4'));var fs=require('fs');var path=require(_0x6628('0x5'));var rimraf=require(_0x6628('0x6'));var config=require(_0x6628('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x6628('0x8')]=function(_0x1d8ede,_0x1a10ae){return _0x1d8ede[_0x6628('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x6628('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12f5=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0x12f5,0x186));var _0x512f=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x12f5[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0x512f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x512f('0x1'));var moment=require(_0x512f('0x2'));var BPromise=require(_0x512f('0x3'));var rp=require(_0x512f('0x4'));var fs=require('fs');var path=require(_0x512f('0x5'));var rimraf=require(_0x512f('0x6'));var config=require(_0x512f('0x7'));var attributes=require(_0x512f('0x8'));module[_0x512f('0x9')]=function(_0x1cf2b2,_0x1961d6){return _0x1cf2b2[_0x512f('0xa')](_0x512f('0xb'),attributes,{'tableName':_0x512f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index dce2156..243cea6 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 _0xfa12=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x14e27a,_0x3b4136){var _0x288688=function(_0x3d7ab1){while(--_0x3d7ab1){_0x14e27a['push'](_0x14e27a['shift']());}};_0x288688(++_0x3b4136);}(_0xfa12,0x113));var _0x2fa1=function(_0x1f05e6,_0x2fe295){_0x1f05e6=_0x1f05e6-0x0;var _0x440a1a=_0xfa12[_0x1f05e6];return _0x440a1a;};'use strict';var _=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var moment=require(_0x2fa1('0x2'));var BPromise=require(_0x2fa1('0x3'));var rs=require(_0x2fa1('0x4'));var fs=require('fs');var Redis=require(_0x2fa1('0x5'));var db=require(_0x2fa1('0x6'))['db'];var utils=require(_0x2fa1('0x7'));var logger=require(_0x2fa1('0x8'))(_0x2fa1('0x9'));var config=require(_0x2fa1('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2fa1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5080cb,_0x3861e5,_0x440773){return new BPromise(function(_0x3a08e4,_0x1e1acd){return client['request'](_0x5080cb,_0x440773)[_0x2fa1('0xc')](function(_0x3f67ac){logger[_0x2fa1('0xd')](_0x2fa1('0xe'),_0x3861e5,_0x2fa1('0xf'));logger[_0x2fa1('0x10')](_0x2fa1('0x11'),_0x3861e5,'request\x20sent',JSON['stringify'](_0x3f67ac));if(_0x3f67ac['error']){if(_0x3f67ac[_0x2fa1('0x12')][_0x2fa1('0x13')]===0x1f4){logger['error'](_0x2fa1('0xe'),_0x3861e5,_0x3f67ac[_0x2fa1('0x12')][_0x2fa1('0x14')]);return _0x1e1acd(_0x3f67ac[_0x2fa1('0x12')][_0x2fa1('0x14')]);}logger[_0x2fa1('0x12')](_0x2fa1('0xe'),_0x3861e5,_0x3f67ac[_0x2fa1('0x12')][_0x2fa1('0x14')]);return _0x3a08e4(_0x3f67ac[_0x2fa1('0x12')][_0x2fa1('0x14')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x3861e5,_0x2fa1('0xf'));_0x3a08e4(_0x3f67ac[_0x2fa1('0x15')][_0x2fa1('0x14')]);}})[_0x2fa1('0x16')](function(_0x14c1e5){logger[_0x2fa1('0x12')](_0x2fa1('0xe'),_0x3861e5,_0x14c1e5);_0x1e1acd(_0x14c1e5);});});} \ No newline at end of file +var _0xed87=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xed87,0x1aa));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7ed8('0x0'));var util=require(_0x7ed8('0x1'));var moment=require(_0x7ed8('0x2'));var BPromise=require(_0x7ed8('0x3'));var rs=require(_0x7ed8('0x4'));var fs=require('fs');var Redis=require(_0x7ed8('0x5'));var db=require(_0x7ed8('0x6'))['db'];var utils=require(_0x7ed8('0x7'));var logger=require(_0x7ed8('0x8'))(_0x7ed8('0x9'));var config=require(_0x7ed8('0xa'));var jayson=require(_0x7ed8('0xb'));var client=jayson['client'][_0x7ed8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6db328,_0x1e6c5d,_0x4bba05){return new BPromise(function(_0x3dfa7b,_0x509cfa){return client[_0x7ed8('0xd')](_0x6db328,_0x4bba05)[_0x7ed8('0xe')](function(_0x2b8f4e){logger[_0x7ed8('0xf')](_0x7ed8('0x10'),_0x1e6c5d,_0x7ed8('0x11'));logger[_0x7ed8('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1e6c5d,'request\x20sent',JSON[_0x7ed8('0x13')](_0x2b8f4e));if(_0x2b8f4e[_0x7ed8('0x14')]){if(_0x2b8f4e[_0x7ed8('0x14')][_0x7ed8('0x15')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1e6c5d,_0x2b8f4e[_0x7ed8('0x14')]['message']);return _0x509cfa(_0x2b8f4e['error'][_0x7ed8('0x16')]);}logger['error'](_0x7ed8('0x10'),_0x1e6c5d,_0x2b8f4e[_0x7ed8('0x14')][_0x7ed8('0x16')]);return _0x3dfa7b(_0x2b8f4e[_0x7ed8('0x14')][_0x7ed8('0x16')]);}else{logger[_0x7ed8('0xf')](_0x7ed8('0x10'),_0x1e6c5d,_0x7ed8('0x11'));_0x3dfa7b(_0x2b8f4e[_0x7ed8('0x17')][_0x7ed8('0x16')]);}})[_0x7ed8('0x18')](function(_0x824342){logger[_0x7ed8('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1e6c5d,_0x824342);_0x509cfa(_0x824342);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index fb0ba0c..0dc8a9b 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 _0xaeab=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','post','/:id/clone','clone','/:id/sections','addResources','put','update','delete','destroy','removeSections','exports'];(function(_0x1808d9,_0x4974d1){var _0x1e0c72=function(_0x358f3a){while(--_0x358f3a){_0x1808d9['push'](_0x1808d9['shift']());}};_0x1e0c72(++_0x4974d1);}(_0xaeab,0x91));var _0xbaea=function(_0x55ba91,_0x236f34){_0x55ba91=_0x55ba91-0x0;var _0x193dd7=_0xaeab[_0x55ba91];return _0x193dd7;};'use strict';var multer=require(_0xbaea('0x0'));var util=require('util');var path=require(_0xbaea('0x1'));var timeout=require('connect-timeout');var express=require(_0xbaea('0x2'));var router=express[_0xbaea('0x3')]();var fs_extra=require(_0xbaea('0x4'));var auth=require(_0xbaea('0x5'));var interaction=require(_0xbaea('0x6'));var config=require(_0xbaea('0x7'));var controller=require(_0xbaea('0x8'));router[_0xbaea('0x9')]('/',auth[_0xbaea('0xa')](),controller[_0xbaea('0xb')]);router['get'](_0xbaea('0xc'),auth[_0xbaea('0xa')](),controller[_0xbaea('0xd')]);router[_0xbaea('0x9')](_0xbaea('0xe'),auth[_0xbaea('0xa')](),controller[_0xbaea('0xf')]);router[_0xbaea('0x9')]('/:id/sections',auth[_0xbaea('0xa')](),controller[_0xbaea('0x10')]);router[_0xbaea('0x9')](_0xbaea('0x11'),auth[_0xbaea('0xa')](),controller['getResources']);router[_0xbaea('0x12')]('/',auth[_0xbaea('0xa')](),controller['create']);router[_0xbaea('0x12')](_0xbaea('0x13'),auth[_0xbaea('0xa')](),controller[_0xbaea('0x14')]);router[_0xbaea('0x12')](_0xbaea('0x15'),auth['isAuthenticated'](),controller['addSections']);router[_0xbaea('0x12')](_0xbaea('0x11'),auth[_0xbaea('0xa')](),controller[_0xbaea('0x16')]);router[_0xbaea('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xbaea('0x18')]);router[_0xbaea('0x19')]('/:id',auth[_0xbaea('0xa')](),controller[_0xbaea('0x1a')]);router[_0xbaea('0x19')](_0xbaea('0x15'),auth[_0xbaea('0xa')](),controller[_0xbaea('0x1b')]);router['delete']('/:id/resources',auth['isAuthenticated'](),controller['removeResources']);module[_0xbaea('0x1c')]=router; \ No newline at end of file +var _0x447b=['create','/:id/clone','clone','addSections','/:id/resources','addResources','delete','destroy','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x447b,0xe4));var _0xb447=function(_0x5183aa,_0x54277c){_0x5183aa=_0x5183aa-0x0;var _0x73ac67=_0x447b[_0x5183aa];return _0x73ac67;};'use strict';var multer=require(_0xb447('0x0'));var util=require(_0xb447('0x1'));var path=require('path');var timeout=require(_0xb447('0x2'));var express=require(_0xb447('0x3'));var router=express[_0xb447('0x4')]();var fs_extra=require(_0xb447('0x5'));var auth=require(_0xb447('0x6'));var interaction=require(_0xb447('0x7'));var config=require(_0xb447('0x8'));var controller=require(_0xb447('0x9'));router[_0xb447('0xa')]('/',auth[_0xb447('0xb')](),controller['index']);router['get'](_0xb447('0xc'),auth['isAuthenticated'](),controller[_0xb447('0xd')]);router[_0xb447('0xa')](_0xb447('0xe'),auth[_0xb447('0xb')](),controller[_0xb447('0xf')]);router['get'](_0xb447('0x10'),auth[_0xb447('0xb')](),controller[_0xb447('0x11')]);router[_0xb447('0xa')]('/:id/resources',auth[_0xb447('0xb')](),controller[_0xb447('0x12')]);router[_0xb447('0x13')]('/',auth[_0xb447('0xb')](),controller[_0xb447('0x14')]);router[_0xb447('0x13')](_0xb447('0x15'),auth[_0xb447('0xb')](),controller[_0xb447('0x16')]);router['post']('/:id/sections',auth[_0xb447('0xb')](),controller[_0xb447('0x17')]);router['post'](_0xb447('0x18'),auth[_0xb447('0xb')](),controller[_0xb447('0x19')]);router['put']('/:id',auth[_0xb447('0xb')](),controller['update']);router[_0xb447('0x1a')]('/:id',auth[_0xb447('0xb')](),controller[_0xb447('0x1b')]);router[_0xb447('0x1a')](_0xb447('0x10'),auth[_0xb447('0xb')](),controller[_0xb447('0x1c')]);router[_0xb447('0x1a')]('/:id/resources',auth['isAuthenticated'](),controller[_0xb447('0x1d')]);module[_0xb447('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 248da6d..e985c69 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 _0x80ed=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue'];(function(_0x32c98a,_0x5e6eb0){var _0x1796d3=function(_0x560640){while(--_0x560640){_0x32c98a['push'](_0x32c98a['shift']());}};_0x1796d3(++_0x5e6eb0);}(_0x80ed,0x11c));var _0xd80e=function(_0x5b8d97,_0x41addf){_0x5b8d97=_0x5b8d97-0x0;var _0x2b0d5a=_0x80ed[_0x5b8d97];return _0x2b0d5a;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd80e('0x1')],'allowNull':![],'unique':_0xd80e('0x2')},'crudPermissions':{'type':Sequelize[_0xd80e('0x1')],'set':function(_0x5052d7){this[_0xd80e('0x3')](_0xd80e('0x4'),_0x5052d7?_0x5052d7[_0xd80e('0x5')](''):[]);},'get':function(){return this[_0xd80e('0x6')]('crudPermissions')?this[_0xd80e('0x6')](_0xd80e('0x4'))[_0xd80e('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xd80e('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd80e('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xd80e('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xd80e('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd80e('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd80e('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xd80e('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd80e('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6582=['join','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x6582,0x108));var _0x2658=function(_0xe3f0b0,_0x43edc9){_0xe3f0b0=_0xe3f0b0-0x0;var _0x3a839e=_0x6582[_0xe3f0b0];return _0x3a839e;};'use strict';var Sequelize=require(_0x2658('0x0'));module[_0x2658('0x1')]={'name':{'type':Sequelize[_0x2658('0x2')],'allowNull':![],'unique':_0x2658('0x3')},'crudPermissions':{'type':Sequelize[_0x2658('0x2')],'set':function(_0x4acc8f){this[_0x2658('0x4')](_0x2658('0x5'),_0x4acc8f?_0x4acc8f[_0x2658('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0x2658('0x5'))[_0x2658('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2658('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2658('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2658('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2658('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2658('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2658('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2658('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2658('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 89011ce..00fd0e4 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 _0xcb29=['fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','UserProfile','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','create','params','find','omit','updatedAt','crudPermissions','createdAt','get','findAll','each','autoAssociation','UserProfileResource','sectionId','Resources','update','addSections','sequelize','transaction','UserProfileSection','userProfileId','ids','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','field','associatedResources','foreignKey','AnalyticExtractedReport','reportType','default','reportId','custom','CustomReports','CmContact','Tag','tag','ThroughTags','Agents','openTabs','true','chat','dataValues','mail','openchannel','whatsapp','slice','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','ui.UserId\x20=\x20?','toString','value','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareProjects','projectName','projects','JscriptyProject','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','membername','User','role','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','teams','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','dispositions','customdashboards','intervals','Interval','scheduler','Sound','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','AnalyticMetric','whatsappaccounts','WhatsappAccount','screenrecordings','ScreenRecording','eml-format','rimraf','zip-dir'];(function(_0x4f8ce3,_0x37da7f){var _0x6ad7d0=function(_0x4ce8b7){while(--_0x4ce8b7){_0x4f8ce3['push'](_0x4f8ce3['shift']());}};_0x6ad7d0(++_0x37da7f);}(_0xcb29,0xfc));var _0x9cb2=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xcb29[_0x4bb581];return _0x316bf5;};'use strict';var emlformat=require(_0x9cb2('0x0'));var rimraf=require(_0x9cb2('0x1'));var zipdir=require(_0x9cb2('0x2'));var jsonpatch=require(_0x9cb2('0x3'));var rp=require(_0x9cb2('0x4'));var moment=require(_0x9cb2('0x5'));var BPromise=require(_0x9cb2('0x6'));var Mustache=require('mustache');var util=require(_0x9cb2('0x7'));var path=require('path');var sox=require(_0x9cb2('0x8'));var csv=require(_0x9cb2('0x9'));var ejs=require(_0x9cb2('0xa'));var fs=require('fs');var fs_extra=require(_0x9cb2('0xb'));var _=require(_0x9cb2('0xc'));var squel=require('squel');var crypto=require(_0x9cb2('0xd'));var jsforce=require(_0x9cb2('0xe'));var deskjs=require(_0x9cb2('0xf'));var toCsv=require(_0x9cb2('0x9'));var querystring=require(_0x9cb2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9cb2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9cb2('0x12'));var hardwareService=require(_0x9cb2('0x13'));var logger=require(_0x9cb2('0x14'))(_0x9cb2('0x15'));var utils=require(_0x9cb2('0x16'));var config=require(_0x9cb2('0x17'));var licenseUtil=require(_0x9cb2('0x18'));var db=require(_0x9cb2('0x19'))['db'];config[_0x9cb2('0x1a')]=_[_0x9cb2('0x1b')](config[_0x9cb2('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')[_0x9cb2('0x1c')](socket);function respondWithStatusCode(_0x3f23f4,_0x8210ca){_0x8210ca=_0x8210ca||0xcc;return function(_0x4d7777){if(_0x4d7777){return _0x3f23f4[_0x9cb2('0x1d')](_0x8210ca);}return _0x3f23f4[_0x9cb2('0x1e')](_0x8210ca)[_0x9cb2('0x1f')]();};}function respondWithResult(_0x175bc5,_0x3290b9){_0x3290b9=_0x3290b9||0xc8;return function(_0x248e1d){if(_0x248e1d){return _0x175bc5[_0x9cb2('0x1e')](_0x3290b9)[_0x9cb2('0x20')](_0x248e1d);}};}function respondWithFilteredResult(_0x14fd12,_0x5d3c7d){return function(_0x4d77e6){if(_0x4d77e6){var _0x22be4d=typeof _0x5d3c7d[_0x9cb2('0x21')]===_0x9cb2('0x22')&&typeof _0x5d3c7d[_0x9cb2('0x23')]==='undefined';var _0x73ddd7=_0x4d77e6[_0x9cb2('0x24')];var _0x4fc6cc=_0x22be4d?0x0:_0x5d3c7d[_0x9cb2('0x21')];var _0x5ce3cc=_0x22be4d?_0x4d77e6[_0x9cb2('0x24')]:_0x5d3c7d[_0x9cb2('0x21')]+_0x5d3c7d[_0x9cb2('0x23')];var _0x3df44d;if(_0x5ce3cc>=_0x73ddd7){_0x5ce3cc=_0x73ddd7;_0x3df44d=0xc8;}else{_0x3df44d=0xce;}_0x14fd12[_0x9cb2('0x1e')](_0x3df44d);return _0x14fd12[_0x9cb2('0x25')](_0x9cb2('0x26'),_0x4fc6cc+'-'+_0x5ce3cc+'/'+_0x73ddd7)[_0x9cb2('0x20')](_0x4d77e6);}return null;};}function patchUpdates(_0x2244f3){return function(_0x3df20e){try{jsonpatch[_0x9cb2('0x27')](_0x3df20e,_0x2244f3,!![]);}catch(_0x513e49){return BPromise[_0x9cb2('0x28')](_0x513e49);}return _0x3df20e[_0x9cb2('0x29')]();};}function saveUpdates(_0x5612d7,_0x204572){return function(_0x334c85){if(_0x334c85){return _0x334c85['update'](_0x5612d7)[_0x9cb2('0x2a')](function(_0x31dec1){return _0x31dec1;});}return null;};}function removeEntity(_0x3e2f2d,_0x5ab21e){return function(_0x1a5050){if(_0x1a5050){return _0x1a5050[_0x9cb2('0x2b')]()['then'](function(){_0x3e2f2d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1665b9,_0x145762){return function(_0xcfedcb){if(!_0xcfedcb){_0x1665b9['sendStatus'](0x194);}return _0xcfedcb;};}function handleError(_0x2a728c,_0x190003){_0x190003=_0x190003||0x1f4;return function(_0xf7744b){logger[_0x9cb2('0x2c')](_0xf7744b[_0x9cb2('0x2d')]);if(_0xf7744b[_0x9cb2('0x2e')]){delete _0xf7744b[_0x9cb2('0x2e')];}_0x2a728c[_0x9cb2('0x1e')](_0x190003)[_0x9cb2('0x2f')](_0xf7744b);};}function getMustacheRender(_0x1b5192,_0x39e431){return Mustache[_0x9cb2('0x30')](_0x1b5192,_[_0x9cb2('0x31')](_0x39e431[_0x9cb2('0x32')],{'contact':_0x39e431[_0x9cb2('0x33')],'message':_0x39e431['message'],'agent':_0x39e431[_0x9cb2('0x34')],'interaction':_0x39e431[_0x9cb2('0x35')],'account':_0x39e431[_0x9cb2('0x36')]}))||'';}exports[_0x9cb2('0x37')]=function(_0x3f9faa,_0x1cb70f){var _0x4d991b={},_0x2d99ee={},_0x1cada0={'count':0x0,'rows':[]};var _0x5601e8=_[_0x9cb2('0x38')](db[_0x9cb2('0x39')]['rawAttributes'],function(_0x109a98){return{'name':_0x109a98[_0x9cb2('0x3a')],'type':_0x109a98[_0x9cb2('0x3b')][_0x9cb2('0x3c')]};});_0x2d99ee['model']=_[_0x9cb2('0x38')](_0x5601e8,_0x9cb2('0x2e'));_0x2d99ee[_0x9cb2('0x3d')]=_[_0x9cb2('0x3e')](_0x3f9faa['query']);_0x2d99ee[_0x9cb2('0x3f')]=_[_0x9cb2('0x40')](_0x2d99ee[_0x9cb2('0x41')],_0x2d99ee['query']);_0x4d991b[_0x9cb2('0x42')]=_[_0x9cb2('0x40')](_0x2d99ee['model'],qs[_0x9cb2('0x43')](_0x3f9faa[_0x9cb2('0x3d')][_0x9cb2('0x43')]));_0x4d991b[_0x9cb2('0x42')]=_0x4d991b['attributes'][_0x9cb2('0x44')]?_0x4d991b['attributes']:_0x2d99ee[_0x9cb2('0x41')];if(!_0x3f9faa[_0x9cb2('0x3d')][_0x9cb2('0x45')]('nolimit')){_0x4d991b['limit']=qs['limit'](_0x3f9faa['query'][_0x9cb2('0x23')]);_0x4d991b[_0x9cb2('0x21')]=qs[_0x9cb2('0x21')](_0x3f9faa['query'][_0x9cb2('0x21')]);}_0x4d991b[_0x9cb2('0x46')]=qs['sort'](_0x3f9faa[_0x9cb2('0x3d')][_0x9cb2('0x47')]);_0x4d991b[_0x9cb2('0x48')]=qs[_0x9cb2('0x3f')](_[_0x9cb2('0x49')](_0x3f9faa[_0x9cb2('0x3d')],_0x2d99ee['filters']),_0x5601e8);if(_0x3f9faa['query'][_0x9cb2('0x4a')]){_0x4d991b[_0x9cb2('0x48')]=_[_0x9cb2('0x31')](_0x4d991b[_0x9cb2('0x48')],{'$or':_[_0x9cb2('0x38')](_0x5601e8,function(_0x40589a){if(_0x40589a[_0x9cb2('0x3b')]!==_0x9cb2('0x4b')){var _0x2f1d2c={};_0x2f1d2c[_0x40589a[_0x9cb2('0x2e')]]={'$like':'%'+_0x3f9faa[_0x9cb2('0x3d')][_0x9cb2('0x4a')]+'%'};return _0x2f1d2c;}})});}_0x4d991b=_[_0x9cb2('0x31')]({},_0x4d991b,_0x3f9faa[_0x9cb2('0x4c')]);var _0x1eda87={'where':_0x4d991b[_0x9cb2('0x48')]};return db[_0x9cb2('0x39')][_0x9cb2('0x24')](_0x1eda87)[_0x9cb2('0x2a')](function(_0xe8e3c8){_0x1cada0['count']=_0xe8e3c8;if(_0x3f9faa[_0x9cb2('0x3d')][_0x9cb2('0x4d')]){_0x4d991b[_0x9cb2('0x4e')]=[{'all':!![]}];}return db[_0x9cb2('0x39')]['findAll'](_0x4d991b);})['then'](function(_0x306b10){_0x1cada0[_0x9cb2('0x4f')]=_0x306b10;return _0x1cada0;})[_0x9cb2('0x2a')](respondWithFilteredResult(_0x1cb70f,_0x4d991b))[_0x9cb2('0x50')](handleError(_0x1cb70f,null));};exports[_0x9cb2('0x51')]=function(_0x37eb24,_0x127e2c){var _0x2efb2a={'raw':![],'where':{'id':_0x37eb24['params']['id']}},_0x2e83e5={};_0x2e83e5['model']=_[_0x9cb2('0x3e')](db[_0x9cb2('0x39')][_0x9cb2('0x52')]);_0x2e83e5[_0x9cb2('0x3d')]=_[_0x9cb2('0x3e')](_0x37eb24[_0x9cb2('0x3d')]);_0x2e83e5['filters']=_[_0x9cb2('0x40')](_0x2e83e5[_0x9cb2('0x41')],_0x2e83e5[_0x9cb2('0x3d')]);_0x2efb2a['attributes']=_[_0x9cb2('0x40')](_0x2e83e5[_0x9cb2('0x41')],qs[_0x9cb2('0x43')](_0x37eb24[_0x9cb2('0x3d')][_0x9cb2('0x43')]));_0x2efb2a[_0x9cb2('0x42')]=_0x2efb2a[_0x9cb2('0x42')][_0x9cb2('0x44')]?_0x2efb2a[_0x9cb2('0x42')]:_0x2e83e5['model'];if(_0x37eb24[_0x9cb2('0x3d')][_0x9cb2('0x4d')]){_0x2efb2a[_0x9cb2('0x4e')]=[{'all':!![]}];}_0x2efb2a=_['merge']({},_0x2efb2a,_0x37eb24['options']);return db[_0x9cb2('0x39')]['find'](_0x2efb2a)['then'](handleEntityNotFound(_0x127e2c,null))[_0x9cb2('0x2a')](respondWithResult(_0x127e2c,null))[_0x9cb2('0x50')](handleError(_0x127e2c,null));};exports['create']=function(_0x59898e,_0x4c8237){return db['UserProfile'][_0x9cb2('0x53')](_0x59898e[_0x9cb2('0x32')],{})[_0x9cb2('0x2a')](respondWithResult(_0x4c8237,0xc9))[_0x9cb2('0x50')](handleError(_0x4c8237,null));};exports['clone']=function(_0x3f24e8,_0x543a11){var _0x1e2206={'where':{'id':_0x3f24e8[_0x9cb2('0x54')]['id']}},_0x583863={};_0x583863[_0x9cb2('0x41')]=_[_0x9cb2('0x3e')](db[_0x9cb2('0x39')][_0x9cb2('0x52')]);_0x1e2206[_0x9cb2('0x42')]=_[_0x9cb2('0x40')](_0x583863[_0x9cb2('0x41')],qs['fields'](_0x3f24e8[_0x9cb2('0x3d')][_0x9cb2('0x43')]));_0x1e2206[_0x9cb2('0x42')]=_0x1e2206[_0x9cb2('0x42')][_0x9cb2('0x44')]?_0x1e2206['attributes']:_0x583863[_0x9cb2('0x41')];if(_0x3f24e8[_0x9cb2('0x3d')][_0x9cb2('0x4d')]){_0x1e2206['include']=[{'all':!![]}];}_0x1e2206=_[_0x9cb2('0x31')]({},_0x1e2206,_0x3f24e8['options']);return db[_0x9cb2('0x39')][_0x9cb2('0x55')](_0x1e2206)[_0x9cb2('0x2a')](handleEntityNotFound(_0x543a11,null))['then'](function(_0x1f5957){if(_0x1f5957){var _0x408b8f=_0x1f5957['get']({'plain':!![]});_0x408b8f=qs[_0x9cb2('0x56')](_0x408b8f,['id','createdAt',_0x9cb2('0x57'),_0x9cb2('0x58')]);_0x3f24e8[_0x9cb2('0x32')]=_['omit'](_0x3f24e8['body'],['id',_0x9cb2('0x59'),_0x9cb2('0x57')]);return db['sequelize']['transaction'](function(_0x2964e1){return db[_0x9cb2('0x39')][_0x9cb2('0x53')](_[_0x9cb2('0x31')](_0x408b8f,_0x3f24e8[_0x9cb2('0x32')]),{'include':_0x3f24e8[_0x9cb2('0x3d')][_0x9cb2('0x4d')]?[{'all':!![]}]:undefined,'transaction':_0x2964e1})[_0x9cb2('0x2a')](function(_0xfaa1bd){var _0x200b80=_0xfaa1bd[_0x9cb2('0x5a')]({'plain':!![]});return db['UserProfileSection'][_0x9cb2('0x5b')]({'where':{'userProfileId':_0x3f24e8[_0x9cb2('0x54')]['id']},'raw':!![]})[_0x9cb2('0x2a')](function(_0x4ac106){if(_0x4ac106){return BPromise[_0x9cb2('0x5c')](_0x4ac106,function(_0x2ab831){return new BPromise(function(_0x36439c,_0x376b29){if(_0x2ab831[_0x9cb2('0x5d')]===null||_0x2ab831[_0x9cb2('0x5d')]===0x1)_0x36439c(null);return db[_0x9cb2('0x5e')][_0x9cb2('0x5b')]({'where':{'sectionId':_0x2ab831['id']},'raw':!![]})['then'](function(_0x2aecff){var _0x193012=_[_0x9cb2('0x38')](_0x2aecff,function(_0x2392c5){return qs[_0x9cb2('0x56')](_0x2392c5,['id','createdAt',_0x9cb2('0x57'),_0x9cb2('0x5f')]);});_0x36439c(_0x193012);})['catch'](function(_0x34a9a1){_0x376b29(_0x34a9a1);});})[_0x9cb2('0x2a')](function(_0x1e5b57){var _0x583111=qs[_0x9cb2('0x56')](_0x2ab831,['id',_0x9cb2('0x59'),_0x9cb2('0x57')]);_0x583111['userProfileId']=_0x200b80['id'];if(_0x1e5b57)_0x583111[_0x9cb2('0x60')]=_0x1e5b57;return _0x583111;})[_0x9cb2('0x2a')](function(_0x47157a){return db['UserProfileSection'][_0x9cb2('0x53')](_0x47157a,{'include':[{'model':db['UserProfileResource'],'as':_0x9cb2('0x60')}],'raw':!![],'transaction':_0x2964e1});});})['then'](function(){return _0x200b80;});}});});});}})['then'](respondWithResult(_0x543a11,0xc9))[_0x9cb2('0x50')](handleError(_0x543a11,null));};exports[_0x9cb2('0x61')]=function(_0x51b53c,_0x58be09){if(_0x51b53c['body']['id']){delete _0x51b53c[_0x9cb2('0x32')]['id'];}return db[_0x9cb2('0x39')][_0x9cb2('0x55')]({'where':{'id':_0x51b53c[_0x9cb2('0x54')]['id']}})[_0x9cb2('0x2a')](handleEntityNotFound(_0x58be09,null))['then'](saveUpdates(_0x51b53c[_0x9cb2('0x32')],null))[_0x9cb2('0x2a')](respondWithResult(_0x58be09,null))['catch'](handleError(_0x58be09,null));};exports[_0x9cb2('0x2b')]=function(_0x294c15,_0x18ed98){return db[_0x9cb2('0x39')][_0x9cb2('0x55')]({'where':{'id':_0x294c15['params']['id']}})[_0x9cb2('0x2a')](handleEntityNotFound(_0x18ed98,null))['then'](removeEntity(_0x18ed98,null))[_0x9cb2('0x50')](handleError(_0x18ed98,null));};exports['describe']=function(_0x1f042e,_0x505360){return db[_0x9cb2('0x39')]['describe']()[_0x9cb2('0x2a')](respondWithResult(_0x505360,null))[_0x9cb2('0x50')](handleError(_0x505360,null));};exports[_0x9cb2('0x62')]=function(_0x456d7e,_0x12765b){var _0x3b5ac8=_0x456d7e[_0x9cb2('0x32')];return db[_0x9cb2('0x39')][_0x9cb2('0x55')]({'where':{'id':_0x456d7e['params']['id']}})[_0x9cb2('0x2a')](handleEntityNotFound(_0x12765b,null))[_0x9cb2('0x2a')](function(_0x2ef770){if(_0x2ef770){return db[_0x9cb2('0x63')][_0x9cb2('0x64')](function(_0x361270){return db[_0x9cb2('0x65')][_0x9cb2('0x2b')]({'where':{'userProfileId':_0x456d7e[_0x9cb2('0x54')]['id'],'sectionId':_[_0x9cb2('0x38')](_0x3b5ac8,function(_0x4b4c29){return _0x4b4c29['sectionId'];})},'transaction':_0x361270})[_0x9cb2('0x2a')](function(){var _0x2b37ff=_[_0x9cb2('0x38')](_0x3b5ac8,function(_0x464878){_0x464878[_0x9cb2('0x66')]=_0x456d7e['params']['id'];return _0x464878;});var _0x58450f=[];return BPromise[_0x9cb2('0x5c')](_0x2b37ff,function(_0x30d379){return db[_0x9cb2('0x65')]['create'](_0x30d379,{'include':[{'model':db['UserProfileResource'],'as':_0x9cb2('0x60')}],'raw':!![],'transaction':_0x361270})['then'](function(_0x3a0502){_0x58450f['push'](_0x3a0502[_0x9cb2('0x5a')]({'plain':!![]}));});})[_0x9cb2('0x2a')](function(){return _0x58450f;});});});}})[_0x9cb2('0x2a')](function(_0x2a02af){return _0x2a02af;})['then'](respondWithResult(_0x12765b,null))[_0x9cb2('0x50')](handleError(_0x12765b,null));};exports['removeSections']=function(_0x16c184,_0x385085){var _0x2ee50c;return db[_0x9cb2('0x39')][_0x9cb2('0x55')]({'where':{'id':_0x16c184[_0x9cb2('0x54')]['id']},'attributes':['id',_0x9cb2('0x2e')]})[_0x9cb2('0x2a')](handleEntityNotFound(_0x385085,null))[_0x9cb2('0x2a')](function(_0x54ff62){if(_0x54ff62){_0x2ee50c=_0x54ff62;return db['UserProfileSection'][_0x9cb2('0x2b')]({'where':{'userProfileId':_0x16c184[_0x9cb2('0x54')]['id'],'sectionId':_0x16c184[_0x9cb2('0x3d')][_0x9cb2('0x67')]}});}})[_0x9cb2('0x2a')](function(){return _0x2ee50c;})[_0x9cb2('0x2a')](respondWithStatusCode(_0x385085,null))[_0x9cb2('0x50')](handleError(_0x385085,null));};exports['getSections']=function(_0x580c38,_0x4f4513){var _0x1a35b1=[];var _0x22a252=[];return db[_0x9cb2('0x65')]['findAll']({'where':{'userProfileId':_0x580c38[_0x9cb2('0x54')]['id']},'raw':!![]})['then'](function(_0x2a6afd){_0x1a35b1=_[_0x9cb2('0x4a')](_0x2a6afd,function(_0x12e4bf){return _0x12e4bf[_0x9cb2('0x68')]===0x1||_[_0x9cb2('0x69')]([0x3eb,0x709],_0x12e4bf[_0x9cb2('0x5f')]);});if(!_[_0x9cb2('0x6a')](_0x1a35b1)){return _['map'](_0x1a35b1,function(_0x22bf39){return _0x22bf39[_0x9cb2('0x5f')];});}else{return;}})['then'](function(_0x3bf10a){if(_0x3bf10a)_0x22a252=_0x3bf10a;if(_[_0x9cb2('0x69')](_0x22a252,0x64)){var _0x41426a=_[_0x9cb2('0x55')](_0x1a35b1,{'sectionId':0x64});return hasDefaultDashboard(_0x41426a)[_0x9cb2('0x2a')](function(_0xaa42f){return _[_0x9cb2('0x38')](_0x1a35b1,function(_0x5e0540){if(_0x5e0540['sectionId']===0x64){_0x5e0540[_0x9cb2('0x6b')]=_0xaa42f;}return _0x5e0540;});});}else{return;}})[_0x9cb2('0x2a')](function(_0x4ad3a6){if(_0x4ad3a6)_0x1a35b1=_0x4ad3a6;if(_[_0x9cb2('0x69')](_0x22a252,0x3eb)){var _0x5903b1=_[_0x9cb2('0x55')](_0x1a35b1,{'sectionId':0x3eb});return getCustomDashboards(_0x5903b1)['then'](function(_0xbc00cb){return _[_0x9cb2('0x38')](_0x1a35b1,function(_0x228a8c){if(_0x5903b1[_0x9cb2('0x68')]){if(_0x228a8c[_0x9cb2('0x5f')]===0x3eb){_0x228a8c[_0x9cb2('0x6b')]=_0xbc00cb;}}else{if(_0x228a8c['sectionId']===0x64){_0x228a8c[_0x9cb2('0x6b')]=_0xbc00cb;}}return _0x228a8c;});});}else{return;}})['then'](function(_0x43ecb4){if(_0x43ecb4)_0x1a35b1=_0x43ecb4;if(_[_0x9cb2('0x69')](_0x22a252,0x709)){var _0x5087f0=_[_0x9cb2('0x55')](_0x1a35b1,{'sectionId':0x709});return getPlugins(_0x5087f0)[_0x9cb2('0x2a')](function(_0xf4f80c){if(_0x5087f0['enabled']){return _[_0x9cb2('0x38')](_0x1a35b1,function(_0x4511da){if(_0x4511da[_0x9cb2('0x5f')]===0x709){_0x4511da[_0x9cb2('0x6b')]=_0xf4f80c;}return _0x4511da;});}else{var _0x2eabb4={'sectionId':0x76c,'enabled':0x1,'subsections':_0xf4f80c};var _0x56ba9a=_[_0x9cb2('0x38')](_0x1a35b1);_0x56ba9a[_0x9cb2('0x6c')](_0x2eabb4);return _0x56ba9a;}});}else{return;}})[_0x9cb2('0x2a')](function(_0x5a6499){if(_0x5a6499)_0x1a35b1=_0x5a6499;return _['filter'](_0x1a35b1,[_0x9cb2('0x68'),0x1]);})[_0x9cb2('0x2a')](respondWithResult(_0x4f4513,null))[_0x9cb2('0x50')](handleError(_0x4f4513,null));};function hasDefaultDashboard(_0xcc2ca7){var _0x5db2c6=[0x65];return new BPromise(function(_0x471a58,_0x3fc658){try{if(_0xcc2ca7[_0x9cb2('0x5d')]){_0x471a58(_0x5db2c6);}else{return db[_0x9cb2('0x5e')][_0x9cb2('0x6d')]({'where':{'sectionId':_0xcc2ca7['id']},'raw':!![]})['then'](function(_0x4508bf){_0x4508bf?_0x471a58(_0x5db2c6):_0x471a58();});}}catch(_0x2e0e6f){_0x3fc658(_0x2e0e6f);}});}function getCustomDashboards(_0x4ab318){var _0x11e700=[];return new BPromise(function(_0x564c33,_0x524fc7){try{if(_0x4ab318[_0x9cb2('0x5d')]){return db[_0x9cb2('0x6e')][_0x9cb2('0x5b')]({'raw':!![]})[_0x9cb2('0x2a')](function(_0x5c2372){_0x5c2372[_0x9cb2('0x6f')](function(_0x27d060){_0x11e700[_0x9cb2('0x6c')](_0x27d060['id']+0x1869f);});_0x564c33(_0x11e700);});}else{return db[_0x9cb2('0x5e')][_0x9cb2('0x5b')]({'where':{'sectionId':_0x4ab318['id']},'raw':!![]})['then'](function(_0xfe1f2b){_0xfe1f2b[_0x9cb2('0x6f')](function(_0x489e3b){_0x11e700['push'](_0x489e3b[_0x9cb2('0x70')]+0x1869f);});_0x564c33(_0x11e700);});}}catch(_0x2935ba){_0x524fc7(_0x2935ba);}});}function getPlugins(_0x5d7fde){var _0xd9e658=[];return new BPromise(function(_0x4e4f49,_0x1c3cbc){try{if(_0x5d7fde[_0x9cb2('0x5d')]){return db[_0x9cb2('0x71')][_0x9cb2('0x5b')]({'raw':!![]})[_0x9cb2('0x2a')](function(_0x1d1e11){_0x1d1e11[_0x9cb2('0x6f')](function(_0x2d961c){_0xd9e658[_0x9cb2('0x6c')](_0x2d961c['id']+0x15b38);});_0x4e4f49(_0xd9e658);});}else{return db[_0x9cb2('0x5e')]['findAll']({'where':{'sectionId':_0x5d7fde['id']},'raw':!![]})[_0x9cb2('0x2a')](function(_0x275e49){_0x275e49[_0x9cb2('0x6f')](function(_0x18005e){_0xd9e658[_0x9cb2('0x6c')](_0x18005e[_0x9cb2('0x70')]+0x15b38);});_0x4e4f49(_0xd9e658);});}}catch(_0x572b79){_0x1c3cbc(_0x572b79);}});}exports[_0x9cb2('0x72')]=function(_0x3aaec2,_0x112482){return db[_0x9cb2('0x39')]['find']({'where':{'id':_0x3aaec2[_0x9cb2('0x54')]['id']}})[_0x9cb2('0x2a')](handleEntityNotFound(_0x112482,null))[_0x9cb2('0x2a')](function(_0x53353c){if(_0x53353c){return db['sequelize'][_0x9cb2('0x64')](function(_0x57f1fc){return db[_0x9cb2('0x65')][_0x9cb2('0x5b')]({'where':{'userProfileId':_0x3aaec2['params']['id']},'attributes':['id'],'raw':!![]})[_0x9cb2('0x2a')](function(_0x19bd48){if(_0x19bd48){return db[_0x9cb2('0x65')][_0x9cb2('0x2b')]({'where':{'userProfileId':_0x3aaec2[_0x9cb2('0x54')]['id'],'id':_[_0x9cb2('0x38')](_0x19bd48,function(_0xef4305){return _0xef4305['id'];})},'transaction':_0x57f1fc});}})[_0x9cb2('0x2a')](function(_0x149ad9){var _0x19ac58=_[_0x9cb2('0x38')](_0x3aaec2[_0x9cb2('0x32')],function(_0x4f0714){_0x4f0714[_0x9cb2('0x66')]=_0x3aaec2['params']['id'];return _0x4f0714;});return db['UserProfileSection']['bulkCreate'](_0x19ac58,{'raw':!![],'transaction':_0x57f1fc});})[_0x9cb2('0x2a')](function(_0x1657ca){var _0x1312bd=_[_0x9cb2('0x4a')](_[_0x9cb2('0x38')](_0x1657ca,function(_0x2ca482){return _0x2ca482['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1312bd){return db[_0x9cb2('0x65')][_0x9cb2('0x5b')]({'where':{'userProfileId':_0x3aaec2[_0x9cb2('0x54')]['id'],'sectionId':_[_0x9cb2('0x38')](_0x1312bd,function(_0x40f537){return _0x40f537[_0x9cb2('0x5f')];})},'attributes':['id',_0x9cb2('0x5f')],'raw':!![]})['then'](function(_0x2620b1){var _0x30ef5d=_[_0x9cb2('0x38')](_0x3aaec2[_0x9cb2('0x32')],function(_0x359282){_0x359282['userProfileId']=_0x3aaec2[_0x9cb2('0x54')]['id'];return _0x359282;});return db[_0x9cb2('0x5e')][_0x9cb2('0x73')](_0x30ef5d,{'raw':!![],'transaction':_0x57f1fc});});}})[_0x9cb2('0x50')](handleError(_0x112482,null));});}})['then'](function(_0x12bc35){var _0x5e7a65=_[_0x9cb2('0x38')](_0x12bc35,function(_0x1efebb){return _0x1efebb['get']({'plain':!![]});});})[_0x9cb2('0x2a')](respondWithResult(_0x112482,null))[_0x9cb2('0x50')](handleError(_0x112482,null));};exports[_0x9cb2('0x74')]=function(_0x6fc4b3,_0xd09ae2,_0x3805c9){return db[_0x9cb2('0x39')][_0x9cb2('0x55')]({'where':{'id':_0x6fc4b3['params']['id']}})[_0x9cb2('0x2a')](handleEntityNotFound(_0xd09ae2,null))[_0x9cb2('0x2a')](function(_0x43d22f){if(_0x43d22f){return _0x43d22f['removeResources'](_0x6fc4b3['query'][_0x9cb2('0x67')]);}})[_0x9cb2('0x2a')](respondWithStatusCode(_0xd09ae2,null))[_0x9cb2('0x50')](handleError(_0xd09ae2,null));};exports['getResources']=function(_0x554fc0,_0x2cb7fa){var _0xf36d66={'raw':![],'where':{}};var _0x2e02f4={};var _0x531ab4={'count':0x0,'rows':[]};var _0x1f94e0=_0x554fc0[_0x9cb2('0x3d')][_0x9cb2('0x75')];if(typeof _0x1f94e0===_0x9cb2('0x22')){throw new db[(_0x9cb2('0x76'))][(_0x9cb2('0x77'))](_0x9cb2('0x78'));}var _0x5349df=_0x554fc0['query'][_0x9cb2('0x79')]||![];var _0x28cfbd=getQueryModels(_0x1f94e0,_0x5349df);if(typeof _0x28cfbd[_0x9cb2('0x7a')]===_0x9cb2('0x22')){throw new db['Sequelize']['ValidationError'](_0x9cb2('0x7b')+_0x1f94e0+'\x27');}var _0x23d542=[];if(!_['isEmpty'](_0x28cfbd['parentSections'])){_0x23d542=_0x28cfbd[_0x9cb2('0x7c')];}else{_0x23d542=[{'name':_0x1f94e0}];}return db['UserProfile'][_0x9cb2('0x6d')]({'where':{'id':_0x554fc0[_0x9cb2('0x54')]['id']}})[_0x9cb2('0x2a')](handleEntityNotFound(_0x2cb7fa,null))[_0x9cb2('0x2a')](function(_0x1bfc02){if(_0x1bfc02){var _0x36362f=[];for(var _0x36cb28=0x0;_0x36cb28<_0x23d542[_0x9cb2('0x44')];_0x36cb28++){_0x36362f['push'](db[_0x9cb2('0x65')]['findOne']({'where':{'userProfileId':_0x1bfc02['id'],'name':_0x23d542[_0x36cb28][_0x9cb2('0x2e')]},'raw':!![]}));}return BPromise[_0x9cb2('0x7d')](_0x36362f);}})[_0x9cb2('0x2a')](function(_0x350a9e){var _0x5e3e91=_[_0x9cb2('0x4a')](_0x350a9e,function(_0x376322){return _0x376322?_0x376322:undefined;});var _0x26024a=_[_0x9cb2('0x4a')](_0x23d542,[_0x9cb2('0x7e'),!![]]);var _0x4c4b58=_[_0x9cb2('0x6a')](_0x5e3e91)&&_[_0x9cb2('0x6a')](_0x26024a)?null:_[_0x9cb2('0x7f')](_0x26024a,_0x5e3e91);if(_0x4c4b58){var _0x3147c0=[];for(var _0x476de6=0x0;_0x476de6<_0x4c4b58['length'];_0x476de6++){var _0xc13966=_[_0x9cb2('0x55')](_0x23d542,function(_0x3b3812){return _0x4c4b58[_0x476de6]?_0x3b3812[_0x9cb2('0x2e')]===_0x4c4b58[_0x476de6]['name']:null;});if(_0xc13966){if(_0x4c4b58[_0x476de6][_0x9cb2('0x7e')]){_0x3147c0[_0x9cb2('0x6c')](getAllResources(_0x28cfbd[_0x9cb2('0x7a')],_0x4c4b58[_0x476de6]));}else{if(!_0x4c4b58[_0x476de6]['autoAssociation']){_0x3147c0['push'](getAllowedResources(_0xc13966,_0x4c4b58[_0x476de6],_0x28cfbd[_0x9cb2('0x7a')]));}else{if(_0xc13966['model']){_0x3147c0[_0x9cb2('0x6c')](getAllFilteredResources(_0xc13966,_0x4c4b58[_0x476de6]));}}}}}return BPromise['all'](_0x3147c0);}else{return null;}})[_0x9cb2('0x2a')](function(_0x107550){var _0x4f8650=_0x107550;var _0x3f3a5e=null;if(_0x4f8650){_0x3f3a5e=_0x4f8650[_0x9cb2('0x44')]===0x1?_0x4f8650[0x0]:null;}if(_0x3f3a5e||_0x4f8650){var _0x5182ff=db[_0x28cfbd['childModel']]['rawAttributes'];_0x2e02f4[_0x9cb2('0x41')]=_[_0x9cb2('0x3e')](_0x5182ff);_0x2e02f4['query']=_[_0x9cb2('0x3e')](_0x554fc0[_0x9cb2('0x3d')]);_0x2e02f4['filters']=_[_0x9cb2('0x40')](_0x2e02f4[_0x9cb2('0x41')],_0x2e02f4[_0x9cb2('0x3d')]);_0xf36d66[_0x9cb2('0x42')]=_['intersection'](_0x2e02f4['model'],qs[_0x9cb2('0x43')](_0x554fc0['query'][_0x9cb2('0x43')]));_0xf36d66[_0x9cb2('0x42')]=_0xf36d66[_0x9cb2('0x42')][_0x9cb2('0x44')]?_0xf36d66['attributes']:_0x2e02f4[_0x9cb2('0x41')];if(!_0x554fc0['query'][_0x9cb2('0x45')]('nolimit')){_0xf36d66[_0x9cb2('0x23')]=qs[_0x9cb2('0x23')](_0x554fc0[_0x9cb2('0x3d')][_0x9cb2('0x23')]);_0xf36d66[_0x9cb2('0x21')]=qs[_0x9cb2('0x21')](_0x554fc0[_0x9cb2('0x3d')]['offset']);}_0xf36d66[_0x9cb2('0x46')]=qs[_0x9cb2('0x47')](_0x554fc0[_0x9cb2('0x3d')]['sort']);_0xf36d66[_0x9cb2('0x48')]=qs['filters'](_[_0x9cb2('0x49')](_0x554fc0['query'],_0x2e02f4[_0x9cb2('0x3f')]));if(_0x554fc0[_0x9cb2('0x3d')]['filter']){_0xf36d66[_0x9cb2('0x48')]=_['merge'](_0xf36d66[_0x9cb2('0x48')],{'$or':_[_0x9cb2('0x38')](_0x5182ff,function(_0x31d8f1){if(_0x31d8f1['type']['key']!==_0x9cb2('0x4b')){var _0xaa570d={};_0xaa570d[_0x31d8f1[_0x9cb2('0x80')]]={'$like':'%'+_0x554fc0[_0x9cb2('0x3d')][_0x9cb2('0x4a')]+'%'};return _0xaa570d;}})});}var _0x3fe5bb=[];if(_0x3f3a5e){var _0x42bacb=_['find'](_0x23d542,['name',_0x3f3a5e[_0x9cb2('0x2e')]]);if(_0x42bacb[_0x9cb2('0x80')]){var _0xff157c={};if(_0x28cfbd[_0x9cb2('0x7a')]==='AnalyticExtractedReport'){_0xff157c[_0x42bacb['foreignKey']]=_[_0x9cb2('0x38')](_0x3f3a5e[_0x9cb2('0x81')],'id');}else{_0xff157c[_0x42bacb[_0x9cb2('0x82')]]=_0x3f3a5e['associatedResources'];}_0x3fe5bb[_0x9cb2('0x6c')](_0xff157c);}else{_0xf36d66[_0x9cb2('0x48')]['id']=_0x3f3a5e[_0x9cb2('0x81')];}}else{for(var _0x3706ce=0x0;_0x3706ce<_0x4f8650['length'];_0x3706ce++){var _0x42bacb=_[_0x9cb2('0x55')](_0x23d542,[_0x9cb2('0x2e'),_0x4f8650[_0x3706ce]['name']]);if(_0x42bacb[_0x9cb2('0x80')]){var _0xff157c={};_0xff157c[_0x42bacb[_0x9cb2('0x82')]]=_0x4f8650[_0x3706ce]['associatedResources'];_0x3fe5bb[_0x9cb2('0x6c')](_0xff157c);}else{if(!_0xf36d66['where']['id'])_0xf36d66[_0x9cb2('0x48')]['id']=[];_0x4f8650[_0x3706ce][_0x9cb2('0x81')]['forEach'](function(_0x14dc6b){_0xf36d66[_0x9cb2('0x48')]['id'][_0x9cb2('0x6c')](_0x14dc6b);});}}}if(!_[_0x9cb2('0x6a')](_0x3fe5bb)){_0xf36d66[_0x9cb2('0x48')]=_[_0x9cb2('0x31')](_0xf36d66[_0x9cb2('0x48')],{'$and':{'$or':_0x3fe5bb}});}_0xf36d66=_[_0x9cb2('0x31')]({},_0xf36d66,_0x554fc0[_0x9cb2('0x4c')]);if(_0x3f3a5e&&!_0x3f3a5e['autoAssociation']&&_0x28cfbd[_0x9cb2('0x7a')]===_0x9cb2('0x83')){if(_0x554fc0[_0x9cb2('0x3d')][_0x9cb2('0x4d')]){_0xf36d66[_0x9cb2('0x4e')]=[{'all':!![]}];}return db[_0x28cfbd[_0x9cb2('0x7a')]]['findAll'](_0xf36d66)[_0x9cb2('0x2a')](function(_0x5b1408){var _0x5bee90=[];_0x5b1408[_0x9cb2('0x6f')](function(_0x29e321){var _0x4dc92d;switch(_0x29e321[_0x9cb2('0x84')]){case _0x9cb2('0x85'):_0x4dc92d=_[_0x9cb2('0x55')](_0x3f3a5e[_0x9cb2('0x81')],function(_0xdb79da){return _0xdb79da['id']===_0x29e321[_0x9cb2('0x86')]&&_0xdb79da[_0x9cb2('0x3b')]==='DefaultReports';});break;case _0x9cb2('0x87'):_0x4dc92d=_['find'](_0x3f3a5e['associatedResources'],function(_0x4f2057){return _0x4f2057['id']===_0x29e321[_0x9cb2('0x86')]&&_0x4f2057[_0x9cb2('0x3b')]===_0x9cb2('0x88');});break;}if(_0x4dc92d)_0x5bee90['push'](_0x29e321);});_0x531ab4[_0x9cb2('0x24')]=_0x5bee90[_0x9cb2('0x44')];_0x531ab4[_0x9cb2('0x4f')]=_0x5bee90;return _0x531ab4;});}else{return db[_0x28cfbd['childModel']][_0x9cb2('0x24')]({'where':_0xf36d66['where']})[_0x9cb2('0x2a')](function(_0x30555d){_0x531ab4[_0x9cb2('0x24')]=_0x30555d;if(_0x554fc0[_0x9cb2('0x3d')][_0x9cb2('0x4d')]){if(_0x28cfbd[_0x9cb2('0x7a')]===_0x9cb2('0x89')){_0xf36d66[_0x9cb2('0x4e')]=[{'model':db[_0x9cb2('0x8a')],'as':'Tags','attributes':['id','name','color'],'required':_0x554fc0[_0x9cb2('0x3d')][_0x9cb2('0x8b')]?!![]:![]},{'model':db[_0x9cb2('0x8a')],'as':_0x9cb2('0x8c'),'attributes':['id',_0x9cb2('0x2e'),'color'],'through':_0x554fc0[_0x9cb2('0x3d')][_0x9cb2('0x8b')]?{'attributes':[],'where':{'TagId':_0x554fc0[_0x9cb2('0x3d')]['tag']||undefined}}:{},'required':_0x554fc0[_0x9cb2('0x3d')]['tag']?!![]:![]}];}else{_0xf36d66[_0x9cb2('0x4e')]=[{'all':!![]}];}}return db[_0x28cfbd[_0x9cb2('0x7a')]][_0x9cb2('0x5b')](_0xf36d66);})['then'](function(_0x346b64){_0x531ab4[_0x9cb2('0x4f')]=_0x346b64;if(_0x1f94e0===_0x9cb2('0x8d')&&_0x554fc0[_0x9cb2('0x3d')][_0x9cb2('0x8e')]===_0x9cb2('0x8f')){var _0x13fe56=[];for(var _0x2b80f3=0x0;_0x2b80f3<_0x531ab4[_0x9cb2('0x4f')][_0x9cb2('0x44')];_0x2b80f3++){_0x13fe56[_0x9cb2('0x6c')](getOpenTabs(_0x9cb2('0x90'),_0x531ab4[_0x9cb2('0x4f')][_0x2b80f3]['dataValues']));_0x13fe56[_0x9cb2('0x6c')](getOpenTabs('sms',_0x531ab4['rows'][_0x2b80f3][_0x9cb2('0x91')]));_0x13fe56[_0x9cb2('0x6c')](getOpenTabs('fax',_0x531ab4['rows'][_0x2b80f3][_0x9cb2('0x91')]));_0x13fe56[_0x9cb2('0x6c')](getOpenTabs(_0x9cb2('0x92'),_0x531ab4['rows'][_0x2b80f3][_0x9cb2('0x91')]));_0x13fe56[_0x9cb2('0x6c')](getOpenTabs(_0x9cb2('0x93'),_0x531ab4[_0x9cb2('0x4f')][_0x2b80f3][_0x9cb2('0x91')]));_0x13fe56[_0x9cb2('0x6c')](getOpenTabs(_0x9cb2('0x94'),_0x531ab4['rows'][_0x2b80f3][_0x9cb2('0x91')]));}return Promise[_0x9cb2('0x7d')](_0x13fe56)[_0x9cb2('0x2a')](function(){return _0x531ab4;});}return _0x531ab4;});}}else{return _0x531ab4;}})[_0x9cb2('0x2a')](respondWithFilteredResult(_0x2cb7fa,_0xf36d66))['catch'](handleError(_0x2cb7fa,null));};function getOpenTabs(_0x31c635,_0x580d40){var _0x3b94a9=_0x31c635['charAt'](0x0)['toUpperCase']()+_0x31c635[_0x9cb2('0x95')](0x1);var _0x197230={'type':db[_0x9cb2('0x76')][_0x9cb2('0x96')][_0x9cb2('0x97')],'raw':!![]};return new BPromise(function(_0x53c1a1,_0x88d366){var _0x3b4697=squel[_0x9cb2('0x98')]()['field']('ui.'+_0x3b94a9+_0x9cb2('0x99'),'id')[_0x9cb2('0x80')](_0x9cb2('0x9a'))[_0x9cb2('0x9b')](_0x9cb2('0x9c')+_0x31c635+'_interactions','ui')[_0x9cb2('0x48')](_0x9cb2('0x9d'),_0x580d40['id']);return db['sequelize']['query'](_0x3b4697[_0x9cb2('0x9e')](),_0x197230)['then'](function(_0x252f9c){_0x580d40[_0x3b94a9+'OpenTabs']=_0x252f9c;_0x53c1a1(_0x252f9c);})[_0x9cb2('0x50')](function(_0x38b484){_0x88d366(_0x38b484);});});}function getAllResources(_0x5edbda,_0x11112e){return new BPromise(function(_0x1c37d1,_0x462268){if(_0x11112e){var _0x24e398=_0x11112e['filter']?{[_0x11112e[_0x9cb2('0x4a')][_0x9cb2('0x80')]]:_0x11112e[_0x9cb2('0x4a')][_0x9cb2('0x9f')]}:undefined;return db[_0x5edbda]['findAll']({'where':_0x24e398,'raw':!![]})[_0x9cb2('0x2a')](function(_0x5ed599){_0x11112e[_0x9cb2('0x81')]=_[_0x9cb2('0x38')](_0x5ed599,'id');_0x1c37d1(_0x11112e);})[_0x9cb2('0x50')](function(_0xbb2344){_0x462268(_0xbb2344);});}else{_0x1c37d1(null);}});}function getAllFilteredResources(_0x1a6da1,_0x213351){return new BPromise(function(_0x8e7bf9,_0x4528d7){var _0x1fa1ca=_0x1a6da1[_0x9cb2('0x4a')]?{[_0x1a6da1[_0x9cb2('0x4a')][_0x9cb2('0x80')]]:_0x1a6da1[_0x9cb2('0x4a')][_0x9cb2('0x9f')]}:undefined;return db[_0x1a6da1['model']][_0x9cb2('0x5b')]({'where':_0x1fa1ca,'raw':!![]})[_0x9cb2('0x2a')](function(_0x18340c){_0x213351[_0x9cb2('0x81')]=_[_0x9cb2('0x38')](_0x18340c,function(_0x42a810){return _0x1a6da1[_0x9cb2('0x80')]?_0x42a810[_0x1a6da1[_0x9cb2('0x80')]]:_0x42a810[_0x9cb2('0x2e')];});_0x8e7bf9(_0x213351);})[_0x9cb2('0x50')](function(_0xa4c8b8){_0x4528d7(_0xa4c8b8);});});}function getAllowedResources(_0x1364bd,_0x3a56b,_0x10323d){return new BPromise(function(_0x4f04c3,_0x49a38c){if(_0x3a56b){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3a56b['id']},'raw':!![]})[_0x9cb2('0x2a')](function(_0x4871a2){if(_0x1364bd['field']&&_0x1364bd[_0x9cb2('0x80')]!=='id'){_0x3a56b[_0x9cb2('0x81')]=_[_0x9cb2('0x38')](_0x4871a2,function(_0x31470f){return _0x31470f[_0x1364bd[_0x9cb2('0x80')]];});}else{if(_0x10323d===_0x9cb2('0x83')){_0x3a56b[_0x9cb2('0x81')]=_[_0x9cb2('0x38')](_0x4871a2,function(_0x11cc04){return{'id':_0x11cc04[_0x9cb2('0x70')],'type':_0x11cc04[_0x9cb2('0x3b')]};});}else{_0x3a56b['associatedResources']=_[_0x9cb2('0x38')](_0x4871a2,function(_0x130031){return _0x130031[_0x9cb2('0x70')];});}}_0x4f04c3(_0x3a56b);})[_0x9cb2('0x50')](function(_0x387b23){_0x49a38c(_0x387b23);});}else{_0x4f04c3(null);}});}function getQueryModels(_0x161209,_0x45cd36){var _0x36de30=_0x161209['toLowerCase']();var _0x16ed75={'childModel':undefined,'parentSections':[]};switch(_0x36de30){case _0x9cb2('0xa0'):_0x16ed75['childModel']=_0x9cb2('0xa1');break;case'odbc':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xa2');break;case _0x9cb2('0xa3'):_0x16ed75['childModel']='SquareRecording';_0x16ed75[_0x9cb2('0x7c')]=[{'name':_0x9cb2('0xa4'),'field':_0x9cb2('0x2e'),'foreignKey':_0x9cb2('0xa5')}];break;case _0x9cb2('0xa6'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xa7');break;case'contacts':_0x16ed75[_0x9cb2('0x7a')]='CmContact';_0x16ed75[_0x9cb2('0x7c')]=[{'name':'Lists','field':'id','foreignKey':_0x9cb2('0xa8')}];break;case'lists':_0x16ed75['childModel']=_0x9cb2('0xa9');break;case _0x9cb2('0xaa'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xab');break;case _0x9cb2('0xac'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xad');break;case'chatqueues':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xae');break;case _0x9cb2('0xaf'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xb0');break;case _0x9cb2('0xb1'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xb2');break;case _0x9cb2('0xb3'):_0x16ed75[_0x9cb2('0x7a')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case _0x9cb2('0xb4'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xb5');break;case _0x9cb2('0xb6'):_0x16ed75['childModel']=_0x9cb2('0xb7');break;case _0x9cb2('0xb8'):_0x16ed75[_0x9cb2('0x7a')]='VoiceMail';break;case _0x9cb2('0xb9'):_0x16ed75[_0x9cb2('0x7a')]='VoiceRecording';_0x16ed75['parentSections']=[{'name':'Agents','field':'name','foreignKey':_0x9cb2('0xba'),'model':_0x9cb2('0xbb'),'filter':{'field':_0x9cb2('0xbc'),'value':['agent']}},{'name':'Telephones','field':_0x9cb2('0x2e'),'foreignKey':_0x9cb2('0xba'),'model':_0x9cb2('0xbb'),'filter':{'field':_0x9cb2('0xbc'),'value':[_0x9cb2('0xbd')]}},{'name':_0x9cb2('0xbe'),'field':_0x9cb2('0x2e'),'foreignKey':_0x9cb2('0xbf'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x9cb2('0xc0')]}},{'name':_0x9cb2('0xc1'),'field':'name','foreignKey':_0x9cb2('0xbf'),'model':_0x9cb2('0xc2'),'filter':{'field':_0x9cb2('0x3b'),'value':[_0x9cb2('0xc3')]}}];break;case _0x9cb2('0xc4'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xc5');break;case _0x9cb2('0xc6'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xc7');break;case _0x9cb2('0xc8'):_0x16ed75['childModel']=_0x9cb2('0xc9');break;case'ivrcampaigns':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xca');break;case _0x9cb2('0xcb'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xcc');break;case _0x9cb2('0xcd'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xce');break;case'mailsubstatuses':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xcf');break;case _0x9cb2('0xd0'):_0x16ed75['childModel']=_0x9cb2('0xd1');break;case'openchannelaccounts':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xd2');break;case _0x9cb2('0xd3'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xd4');break;case'smsaccounts':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xd5');break;case'whatsappqueues':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xd6');break;case _0x9cb2('0xd7'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xd8');break;case _0x9cb2('0xd9'):case _0x9cb2('0xda'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xc2');if(_0x45cd36){_0x16ed75[_0x9cb2('0x7c')]=[{'name':_0x9cb2('0xbe')},{'name':'QueueCampaigns'}];}break;case _0x9cb2('0xdb'):case _0x9cb2('0xdc'):case'telephones':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xbb');if(_0x45cd36){_0x16ed75['parentSections']=[{'name':_0x9cb2('0xdd'),'filter':{'field':_0x9cb2('0xbc'),'value':[_0x9cb2('0xde'),_0x9cb2('0xdf')]},'ignore':!![]},{'name':_0x9cb2('0x8d')},{'name':_0x9cb2('0xe0')}];}break;case _0x9cb2('0xe1'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xe2');break;case _0x9cb2('0xe3'):_0x16ed75['childModel']='SalesforceAccount';break;case _0x9cb2('0xe4'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xe5');break;case _0x9cb2('0xe6'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xe7');break;case _0x9cb2('0xe8'):_0x16ed75[_0x9cb2('0x7a')]='DeskAccount';break;case _0x9cb2('0xe9'):_0x16ed75[_0x9cb2('0x7a')]='ZohoAccount';break;case _0x9cb2('0xea'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xbb');break;case _0x9cb2('0xeb'):_0x16ed75[_0x9cb2('0x7a')]='CannedAnswer';break;case _0x9cb2('0xec'):_0x16ed75[_0x9cb2('0x7a')]='Disposition';break;case _0x9cb2('0xed'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0x6e');break;case _0x9cb2('0xee'):_0x16ed75['childModel']=_0x9cb2('0xef');break;case'pauses':_0x16ed75[_0x9cb2('0x7a')]='Pause';break;case _0x9cb2('0xf0'):_0x16ed75[_0x9cb2('0x7a')]='Schedule';break;case'sounds':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xf1');break;case'tags':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0x8a');break;case'templates':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xf2');break;case _0x9cb2('0xf3'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xf4');break;case'trunks':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xf5');break;case _0x9cb2('0xf6'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xf7');break;case _0x9cb2('0xf8'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0x71');break;case _0x9cb2('0xf9'):_0x16ed75[_0x9cb2('0x7a')]='AnalyticExtractedReport';_0x16ed75[_0x9cb2('0x7c')]=[{'name':'Reports','field':'id','foreignKey':_0x9cb2('0x86')}];break;case'metrics':_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xfa');break;case _0x9cb2('0xfb'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xfc');break;case _0x9cb2('0xfd'):_0x16ed75[_0x9cb2('0x7a')]=_0x9cb2('0xfe');_0x16ed75[_0x9cb2('0x7c')]=[{'name':_0x9cb2('0x8d'),'field':'id','foreignKey':'UserId','model':_0x9cb2('0xbb'),'filter':{'field':_0x9cb2('0xbc'),'value':[_0x9cb2('0x34')]}},{'name':_0x9cb2('0xe0'),'field':'id','foreignKey':'UserId','model':'User','filter':{'field':_0x9cb2('0xbc'),'value':['telephone']}}];break;default:return _0x16ed75;}return _0x16ed75;} \ No newline at end of file +var _0x97a4=['contact','interaction','account','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','options','where','count','includeAll','include','findAll','rows','show','keys','find','catch','create','body','get','omit','crudPermissions','createdAt','updatedAt','sequelize','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','params','transaction','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','findOne','all','union','ignore','sort','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','custom','CustomReports','CmContact','Tag','color','ThroughTags','tag','Agents','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','value','toLowerCase','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','teams','Team','voicequeues','User','Users','user','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','customdashboards','intervals','Interval','pauses','scheduler','Schedule','sounds','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','extractedreports','AnalyticMetric','screenrecordings','ScreenRecording','UserId','agent','Telephones','role','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','render','merge'];(function(_0x581d05,_0x2ba7b7){var _0x1c519c=function(_0x136c4a){while(--_0x136c4a){_0x581d05['push'](_0x581d05['shift']());}};_0x1c519c(++_0x2ba7b7);}(_0x97a4,0xd3));var _0x497a=function(_0x11f408,_0x2da6df){_0x11f408=_0x11f408-0x0;var _0x4e2f26=_0x97a4[_0x11f408];return _0x4e2f26;};'use strict';var emlformat=require(_0x497a('0x0'));var rimraf=require(_0x497a('0x1'));var zipdir=require(_0x497a('0x2'));var jsonpatch=require(_0x497a('0x3'));var rp=require(_0x497a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x497a('0x5'));var util=require(_0x497a('0x6'));var path=require(_0x497a('0x7'));var sox=require(_0x497a('0x8'));var csv=require(_0x497a('0x9'));var ejs=require(_0x497a('0xa'));var fs=require('fs');var fs_extra=require(_0x497a('0xb'));var _=require(_0x497a('0xc'));var squel=require(_0x497a('0xd'));var crypto=require(_0x497a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x497a('0x9'));var querystring=require(_0x497a('0xf'));var Papa=require(_0x497a('0x10'));var Redis=require('ioredis');var authService=require(_0x497a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x497a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x497a('0x13'))(_0x497a('0x14'));var utils=require(_0x497a('0x15'));var config=require(_0x497a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x497a('0x17'))['db'];config[_0x497a('0x18')]=_['defaults'](config[_0x497a('0x18')],{'host':_0x497a('0x19'),'port':0x18eb});var socket=require(_0x497a('0x1a'))(new Redis(config['redis']));require(_0x497a('0x1b'))[_0x497a('0x1c')](socket);function respondWithStatusCode(_0x5d9a43,_0x342e9b){_0x342e9b=_0x342e9b||0xcc;return function(_0x17813a){if(_0x17813a){return _0x5d9a43[_0x497a('0x1d')](_0x342e9b);}return _0x5d9a43['status'](_0x342e9b)[_0x497a('0x1e')]();};}function respondWithResult(_0x1d3deb,_0x3eff6e){_0x3eff6e=_0x3eff6e||0xc8;return function(_0x373aa3){if(_0x373aa3){return _0x1d3deb[_0x497a('0x1f')](_0x3eff6e)[_0x497a('0x20')](_0x373aa3);}};}function respondWithFilteredResult(_0x4a516c,_0x2533be){return function(_0x5f0d7b){if(_0x5f0d7b){var _0x1f11fd=typeof _0x2533be[_0x497a('0x21')]===_0x497a('0x22')&&typeof _0x2533be['limit']===_0x497a('0x22');var _0xb22010=_0x5f0d7b['count'];var _0x2b07a3=_0x1f11fd?0x0:_0x2533be[_0x497a('0x21')];var _0x1e2965=_0x1f11fd?_0x5f0d7b['count']:_0x2533be[_0x497a('0x21')]+_0x2533be[_0x497a('0x23')];var _0x1e54eb;if(_0x1e2965>=_0xb22010){_0x1e2965=_0xb22010;_0x1e54eb=0xc8;}else{_0x1e54eb=0xce;}_0x4a516c[_0x497a('0x1f')](_0x1e54eb);return _0x4a516c[_0x497a('0x24')](_0x497a('0x25'),_0x2b07a3+'-'+_0x1e2965+'/'+_0xb22010)['json'](_0x5f0d7b);}return null;};}function patchUpdates(_0x563752){return function(_0x44a7c0){try{jsonpatch[_0x497a('0x26')](_0x44a7c0,_0x563752,!![]);}catch(_0x4f01a3){return BPromise[_0x497a('0x27')](_0x4f01a3);}return _0x44a7c0[_0x497a('0x28')]();};}function saveUpdates(_0x37062f,_0x5983b9){return function(_0x270a9b){if(_0x270a9b){return _0x270a9b[_0x497a('0x29')](_0x37062f)[_0x497a('0x2a')](function(_0x4c53b1){return _0x4c53b1;});}return null;};}function removeEntity(_0x591998,_0xde3fa4){return function(_0x809052){if(_0x809052){return _0x809052[_0x497a('0x2b')]()[_0x497a('0x2a')](function(){_0x591998['status'](0xcc)[_0x497a('0x1e')]();});}};}function handleEntityNotFound(_0x12b663,_0x1c8552){return function(_0x5d5620){if(!_0x5d5620){_0x12b663['sendStatus'](0x194);}return _0x5d5620;};}function handleError(_0x42dab2,_0x18a282){_0x18a282=_0x18a282||0x1f4;return function(_0x3d6ed5){logger[_0x497a('0x2c')](_0x3d6ed5[_0x497a('0x2d')]);if(_0x3d6ed5[_0x497a('0x2e')]){delete _0x3d6ed5[_0x497a('0x2e')];}_0x42dab2[_0x497a('0x1f')](_0x18a282)['send'](_0x3d6ed5);};}function getMustacheRender(_0x4c80e2,_0x18965f){return Mustache[_0x497a('0x2f')](_0x4c80e2,_[_0x497a('0x30')](_0x18965f['body'],{'contact':_0x18965f[_0x497a('0x31')],'message':_0x18965f['message'],'agent':_0x18965f['agent'],'interaction':_0x18965f[_0x497a('0x32')],'account':_0x18965f[_0x497a('0x33')]}))||'';}exports[_0x497a('0x34')]=function(_0x3d0343,_0x13c3f8){var _0x41debf={},_0x1190bc={},_0x3de134={'count':0x0,'rows':[]};var _0x1761cf=_[_0x497a('0x35')](db[_0x497a('0x36')][_0x497a('0x37')],function(_0x68dab8){return{'name':_0x68dab8[_0x497a('0x38')],'type':_0x68dab8[_0x497a('0x39')][_0x497a('0x3a')]};});_0x1190bc[_0x497a('0x3b')]=_[_0x497a('0x35')](_0x1761cf,_0x497a('0x2e'));_0x1190bc[_0x497a('0x3c')]=_['keys'](_0x3d0343['query']);_0x1190bc[_0x497a('0x3d')]=_[_0x497a('0x3e')](_0x1190bc[_0x497a('0x3b')],_0x1190bc['query']);_0x41debf[_0x497a('0x3f')]=_[_0x497a('0x3e')](_0x1190bc[_0x497a('0x3b')],qs[_0x497a('0x40')](_0x3d0343['query'][_0x497a('0x40')]));_0x41debf[_0x497a('0x3f')]=_0x41debf['attributes'][_0x497a('0x41')]?_0x41debf[_0x497a('0x3f')]:_0x1190bc[_0x497a('0x3b')];if(!_0x3d0343[_0x497a('0x3c')][_0x497a('0x42')](_0x497a('0x43'))){_0x41debf[_0x497a('0x23')]=qs['limit'](_0x3d0343[_0x497a('0x3c')][_0x497a('0x23')]);_0x41debf['offset']=qs[_0x497a('0x21')](_0x3d0343[_0x497a('0x3c')][_0x497a('0x21')]);}_0x41debf[_0x497a('0x44')]=qs['sort'](_0x3d0343[_0x497a('0x3c')]['sort']);_0x41debf['where']=qs[_0x497a('0x3d')](_[_0x497a('0x45')](_0x3d0343[_0x497a('0x3c')],_0x1190bc[_0x497a('0x3d')]),_0x1761cf);if(_0x3d0343['query'][_0x497a('0x46')]){_0x41debf['where']=_[_0x497a('0x30')](_0x41debf['where'],{'$or':_[_0x497a('0x35')](_0x1761cf,function(_0x104a1e){if(_0x104a1e['type']!=='VIRTUAL'){var _0x51e719={};_0x51e719[_0x104a1e[_0x497a('0x2e')]]={'$like':'%'+_0x3d0343[_0x497a('0x3c')][_0x497a('0x46')]+'%'};return _0x51e719;}})});}_0x41debf=_[_0x497a('0x30')]({},_0x41debf,_0x3d0343[_0x497a('0x47')]);var _0xc5855b={'where':_0x41debf[_0x497a('0x48')]};return db[_0x497a('0x36')]['count'](_0xc5855b)[_0x497a('0x2a')](function(_0x4ddbd0){_0x3de134[_0x497a('0x49')]=_0x4ddbd0;if(_0x3d0343['query'][_0x497a('0x4a')]){_0x41debf[_0x497a('0x4b')]=[{'all':!![]}];}return db[_0x497a('0x36')][_0x497a('0x4c')](_0x41debf);})[_0x497a('0x2a')](function(_0x1fccd6){_0x3de134[_0x497a('0x4d')]=_0x1fccd6;return _0x3de134;})[_0x497a('0x2a')](respondWithFilteredResult(_0x13c3f8,_0x41debf))['catch'](handleError(_0x13c3f8,null));};exports[_0x497a('0x4e')]=function(_0x332c7c,_0x8bb944){var _0xcb7ec9={'raw':![],'where':{'id':_0x332c7c['params']['id']}},_0x1e355b={};_0x1e355b[_0x497a('0x3b')]=_['keys'](db[_0x497a('0x36')][_0x497a('0x37')]);_0x1e355b[_0x497a('0x3c')]=_[_0x497a('0x4f')](_0x332c7c[_0x497a('0x3c')]);_0x1e355b[_0x497a('0x3d')]=_[_0x497a('0x3e')](_0x1e355b[_0x497a('0x3b')],_0x1e355b['query']);_0xcb7ec9['attributes']=_[_0x497a('0x3e')](_0x1e355b['model'],qs[_0x497a('0x40')](_0x332c7c[_0x497a('0x3c')]['fields']));_0xcb7ec9[_0x497a('0x3f')]=_0xcb7ec9[_0x497a('0x3f')]['length']?_0xcb7ec9[_0x497a('0x3f')]:_0x1e355b[_0x497a('0x3b')];if(_0x332c7c['query'][_0x497a('0x4a')]){_0xcb7ec9[_0x497a('0x4b')]=[{'all':!![]}];}_0xcb7ec9=_[_0x497a('0x30')]({},_0xcb7ec9,_0x332c7c['options']);return db[_0x497a('0x36')][_0x497a('0x50')](_0xcb7ec9)[_0x497a('0x2a')](handleEntityNotFound(_0x8bb944,null))['then'](respondWithResult(_0x8bb944,null))[_0x497a('0x51')](handleError(_0x8bb944,null));};exports[_0x497a('0x52')]=function(_0x4c736d,_0x439df3){return db['UserProfile'][_0x497a('0x52')](_0x4c736d[_0x497a('0x53')],{})['then'](respondWithResult(_0x439df3,0xc9))[_0x497a('0x51')](handleError(_0x439df3,null));};exports['clone']=function(_0x40e543,_0xf4e832){var _0x52821c={'where':{'id':_0x40e543['params']['id']}},_0x20c338={};_0x20c338['model']=_[_0x497a('0x4f')](db[_0x497a('0x36')][_0x497a('0x37')]);_0x52821c['attributes']=_[_0x497a('0x3e')](_0x20c338['model'],qs[_0x497a('0x40')](_0x40e543['query'][_0x497a('0x40')]));_0x52821c[_0x497a('0x3f')]=_0x52821c[_0x497a('0x3f')][_0x497a('0x41')]?_0x52821c['attributes']:_0x20c338[_0x497a('0x3b')];if(_0x40e543[_0x497a('0x3c')]['includeAll']){_0x52821c[_0x497a('0x4b')]=[{'all':!![]}];}_0x52821c=_[_0x497a('0x30')]({},_0x52821c,_0x40e543[_0x497a('0x47')]);return db[_0x497a('0x36')][_0x497a('0x50')](_0x52821c)[_0x497a('0x2a')](handleEntityNotFound(_0xf4e832,null))[_0x497a('0x2a')](function(_0x1528a1){if(_0x1528a1){var _0x2212cc=_0x1528a1[_0x497a('0x54')]({'plain':!![]});_0x2212cc=qs[_0x497a('0x55')](_0x2212cc,['id','createdAt','updatedAt',_0x497a('0x56')]);_0x40e543[_0x497a('0x53')]=_[_0x497a('0x55')](_0x40e543[_0x497a('0x53')],['id',_0x497a('0x57'),_0x497a('0x58')]);return db[_0x497a('0x59')]['transaction'](function(_0x5a70ca){return db[_0x497a('0x36')][_0x497a('0x52')](_['merge'](_0x2212cc,_0x40e543[_0x497a('0x53')]),{'include':_0x40e543[_0x497a('0x3c')][_0x497a('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x5a70ca})[_0x497a('0x2a')](function(_0x48510b){var _0x91bf89=_0x48510b['get']({'plain':!![]});return db[_0x497a('0x5a')]['findAll']({'where':{'userProfileId':_0x40e543['params']['id']},'raw':!![]})[_0x497a('0x2a')](function(_0x1291e0){if(_0x1291e0){return BPromise['each'](_0x1291e0,function(_0x97730){return new BPromise(function(_0x9b9ea1,_0x3de8ec){if(_0x97730[_0x497a('0x5b')]===null||_0x97730[_0x497a('0x5b')]===0x1)_0x9b9ea1(null);return db[_0x497a('0x5c')][_0x497a('0x4c')]({'where':{'sectionId':_0x97730['id']},'raw':!![]})['then'](function(_0x503bd1){var _0x5f3ea6=_['map'](_0x503bd1,function(_0xff4d21){return qs[_0x497a('0x55')](_0xff4d21,['id',_0x497a('0x57'),_0x497a('0x58'),_0x497a('0x5d')]);});_0x9b9ea1(_0x5f3ea6);})['catch'](function(_0x46a77c){_0x3de8ec(_0x46a77c);});})[_0x497a('0x2a')](function(_0x3627f1){var _0x1024fa=qs[_0x497a('0x55')](_0x97730,['id','createdAt',_0x497a('0x58')]);_0x1024fa[_0x497a('0x5e')]=_0x91bf89['id'];if(_0x3627f1)_0x1024fa[_0x497a('0x5f')]=_0x3627f1;return _0x1024fa;})['then'](function(_0x17f664){return db['UserProfileSection'][_0x497a('0x52')](_0x17f664,{'include':[{'model':db[_0x497a('0x5c')],'as':_0x497a('0x5f')}],'raw':!![],'transaction':_0x5a70ca});});})[_0x497a('0x2a')](function(){return _0x91bf89;});}});});});}})[_0x497a('0x2a')](respondWithResult(_0xf4e832,0xc9))[_0x497a('0x51')](handleError(_0xf4e832,null));};exports[_0x497a('0x29')]=function(_0x270356,_0x5698d7){if(_0x270356[_0x497a('0x53')]['id']){delete _0x270356[_0x497a('0x53')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x270356['params']['id']}})[_0x497a('0x2a')](handleEntityNotFound(_0x5698d7,null))[_0x497a('0x2a')](saveUpdates(_0x270356[_0x497a('0x53')],null))[_0x497a('0x2a')](respondWithResult(_0x5698d7,null))[_0x497a('0x51')](handleError(_0x5698d7,null));};exports[_0x497a('0x2b')]=function(_0x395eb2,_0x58cac6){return db[_0x497a('0x36')]['find']({'where':{'id':_0x395eb2['params']['id']}})['then'](handleEntityNotFound(_0x58cac6,null))['then'](removeEntity(_0x58cac6,null))['catch'](handleError(_0x58cac6,null));};exports[_0x497a('0x60')]=function(_0x530108,_0x3a72df){return db[_0x497a('0x36')][_0x497a('0x60')]()[_0x497a('0x2a')](respondWithResult(_0x3a72df,null))[_0x497a('0x51')](handleError(_0x3a72df,null));};exports[_0x497a('0x61')]=function(_0x5cce91,_0x4c3e25){var _0x3296c0=_0x5cce91[_0x497a('0x53')];return db[_0x497a('0x36')][_0x497a('0x50')]({'where':{'id':_0x5cce91[_0x497a('0x62')]['id']}})[_0x497a('0x2a')](handleEntityNotFound(_0x4c3e25,null))[_0x497a('0x2a')](function(_0x4b51a9){if(_0x4b51a9){return db[_0x497a('0x59')][_0x497a('0x63')](function(_0x1cc501){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x5cce91[_0x497a('0x62')]['id'],'sectionId':_['map'](_0x3296c0,function(_0x4c9aa2){return _0x4c9aa2[_0x497a('0x5d')];})},'transaction':_0x1cc501})[_0x497a('0x2a')](function(){var _0x3328b1=_[_0x497a('0x35')](_0x3296c0,function(_0x506555){_0x506555[_0x497a('0x5e')]=_0x5cce91['params']['id'];return _0x506555;});var _0x42fdd0=[];return BPromise['each'](_0x3328b1,function(_0x5e0d61){return db[_0x497a('0x5a')][_0x497a('0x52')](_0x5e0d61,{'include':[{'model':db[_0x497a('0x5c')],'as':_0x497a('0x5f')}],'raw':!![],'transaction':_0x1cc501})['then'](function(_0x1893dd){_0x42fdd0['push'](_0x1893dd['get']({'plain':!![]}));});})[_0x497a('0x2a')](function(){return _0x42fdd0;});});});}})[_0x497a('0x2a')](function(_0xa60825){return _0xa60825;})['then'](respondWithResult(_0x4c3e25,null))['catch'](handleError(_0x4c3e25,null));};exports[_0x497a('0x64')]=function(_0x34389b,_0x3b9d0e){var _0x4b807a;return db[_0x497a('0x36')]['find']({'where':{'id':_0x34389b[_0x497a('0x62')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x3b9d0e,null))[_0x497a('0x2a')](function(_0x581e6d){if(_0x581e6d){_0x4b807a=_0x581e6d;return db[_0x497a('0x5a')][_0x497a('0x2b')]({'where':{'userProfileId':_0x34389b[_0x497a('0x62')]['id'],'sectionId':_0x34389b[_0x497a('0x3c')][_0x497a('0x65')]}});}})['then'](function(){return _0x4b807a;})[_0x497a('0x2a')](respondWithStatusCode(_0x3b9d0e,null))[_0x497a('0x51')](handleError(_0x3b9d0e,null));};exports[_0x497a('0x66')]=function(_0x28a7a4,_0x43753d){var _0x4e99da=[];var _0x2cb751=[];return db[_0x497a('0x5a')][_0x497a('0x4c')]({'where':{'userProfileId':_0x28a7a4[_0x497a('0x62')]['id']},'raw':!![]})[_0x497a('0x2a')](function(_0x9b4060){_0x4e99da=_['filter'](_0x9b4060,function(_0x5710fe){return _0x5710fe[_0x497a('0x67')]===0x1||_[_0x497a('0x68')]([0x3eb,0x709],_0x5710fe[_0x497a('0x5d')]);});if(!_[_0x497a('0x69')](_0x4e99da)){return _[_0x497a('0x35')](_0x4e99da,function(_0x46bede){return _0x46bede[_0x497a('0x5d')];});}else{return;}})[_0x497a('0x2a')](function(_0x58d4ce){if(_0x58d4ce)_0x2cb751=_0x58d4ce;if(_[_0x497a('0x68')](_0x2cb751,0x64)){var _0x599d53=_['find'](_0x4e99da,{'sectionId':0x64});return hasDefaultDashboard(_0x599d53)[_0x497a('0x2a')](function(_0x102712){return _[_0x497a('0x35')](_0x4e99da,function(_0x110415){if(_0x110415[_0x497a('0x5d')]===0x64){_0x110415['subsections']=_0x102712;}return _0x110415;});});}else{return;}})[_0x497a('0x2a')](function(_0x2e1749){if(_0x2e1749)_0x4e99da=_0x2e1749;if(_[_0x497a('0x68')](_0x2cb751,0x3eb)){var _0x181bc5=_[_0x497a('0x50')](_0x4e99da,{'sectionId':0x3eb});return getCustomDashboards(_0x181bc5)[_0x497a('0x2a')](function(_0x17c5d2){return _[_0x497a('0x35')](_0x4e99da,function(_0xe4e596){if(_0x181bc5[_0x497a('0x67')]){if(_0xe4e596[_0x497a('0x5d')]===0x3eb){_0xe4e596[_0x497a('0x6a')]=_0x17c5d2;}}else{if(_0xe4e596[_0x497a('0x5d')]===0x64){_0xe4e596[_0x497a('0x6a')]=_0x17c5d2;}}return _0xe4e596;});});}else{return;}})[_0x497a('0x2a')](function(_0x20cd60){if(_0x20cd60)_0x4e99da=_0x20cd60;if(_[_0x497a('0x68')](_0x2cb751,0x709)){var _0x1ecf3b=_[_0x497a('0x50')](_0x4e99da,{'sectionId':0x709});return getPlugins(_0x1ecf3b)['then'](function(_0x4f6a45){if(_0x1ecf3b[_0x497a('0x67')]){return _['map'](_0x4e99da,function(_0x3b2290){if(_0x3b2290[_0x497a('0x5d')]===0x709){_0x3b2290['subsections']=_0x4f6a45;}return _0x3b2290;});}else{var _0x59b4a3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4f6a45};var _0x2bd90d=_[_0x497a('0x35')](_0x4e99da);_0x2bd90d[_0x497a('0x6b')](_0x59b4a3);return _0x2bd90d;}});}else{return;}})[_0x497a('0x2a')](function(_0x335c4a){if(_0x335c4a)_0x4e99da=_0x335c4a;return _['filter'](_0x4e99da,[_0x497a('0x67'),0x1]);})[_0x497a('0x2a')](respondWithResult(_0x43753d,null))[_0x497a('0x51')](handleError(_0x43753d,null));};function hasDefaultDashboard(_0x273dfb){var _0x1a0acd=[0x65];return new BPromise(function(_0x54c180,_0x357f3f){try{if(_0x273dfb[_0x497a('0x5b')]){_0x54c180(_0x1a0acd);}else{return db[_0x497a('0x5c')]['findOne']({'where':{'sectionId':_0x273dfb['id']},'raw':!![]})[_0x497a('0x2a')](function(_0x19a046){_0x19a046?_0x54c180(_0x1a0acd):_0x54c180();});}}catch(_0x3b0da6){_0x357f3f(_0x3b0da6);}});}function getCustomDashboards(_0x5526ed){var _0x2291ac=[];return new BPromise(function(_0x533067,_0x3f0f36){try{if(_0x5526ed[_0x497a('0x5b')]){return db[_0x497a('0x6c')][_0x497a('0x4c')]({'raw':!![]})[_0x497a('0x2a')](function(_0x37fb42){_0x37fb42[_0x497a('0x6d')](function(_0x34038d){_0x2291ac[_0x497a('0x6b')](_0x34038d['id']+0x1869f);});_0x533067(_0x2291ac);});}else{return db['UserProfileResource'][_0x497a('0x4c')]({'where':{'sectionId':_0x5526ed['id']},'raw':!![]})[_0x497a('0x2a')](function(_0x1431cc){_0x1431cc['forEach'](function(_0x339e4b){_0x2291ac['push'](_0x339e4b['resourceId']+0x1869f);});_0x533067(_0x2291ac);});}}catch(_0x38ce73){_0x3f0f36(_0x38ce73);}});}function getPlugins(_0x1d02fc){var _0x5564f6=[];return new BPromise(function(_0x545fab,_0x45e0d9){try{if(_0x1d02fc['autoAssociation']){return db[_0x497a('0x6e')]['findAll']({'raw':!![]})[_0x497a('0x2a')](function(_0x3aff57){_0x3aff57[_0x497a('0x6d')](function(_0x346ddf){_0x5564f6[_0x497a('0x6b')](_0x346ddf['id']+0x15b38);});_0x545fab(_0x5564f6);});}else{return db[_0x497a('0x5c')]['findAll']({'where':{'sectionId':_0x1d02fc['id']},'raw':!![]})[_0x497a('0x2a')](function(_0x56f547){_0x56f547['forEach'](function(_0x53d25d){_0x5564f6['push'](_0x53d25d[_0x497a('0x6f')]+0x15b38);});_0x545fab(_0x5564f6);});}}catch(_0x244000){_0x45e0d9(_0x244000);}});}exports[_0x497a('0x70')]=function(_0x5148e8,_0x586d92){return db['UserProfile']['find']({'where':{'id':_0x5148e8[_0x497a('0x62')]['id']}})[_0x497a('0x2a')](handleEntityNotFound(_0x586d92,null))['then'](function(_0x351e96){if(_0x351e96){return db[_0x497a('0x59')][_0x497a('0x63')](function(_0x49a73a){return db[_0x497a('0x5a')][_0x497a('0x4c')]({'where':{'userProfileId':_0x5148e8[_0x497a('0x62')]['id']},'attributes':['id'],'raw':!![]})[_0x497a('0x2a')](function(_0x58ebcd){if(_0x58ebcd){return db[_0x497a('0x5a')]['destroy']({'where':{'userProfileId':_0x5148e8[_0x497a('0x62')]['id'],'id':_[_0x497a('0x35')](_0x58ebcd,function(_0x3442e9){return _0x3442e9['id'];})},'transaction':_0x49a73a});}})[_0x497a('0x2a')](function(_0x13fd84){var _0x1385ed=_[_0x497a('0x35')](_0x5148e8['body'],function(_0x5708c8){_0x5708c8[_0x497a('0x5e')]=_0x5148e8[_0x497a('0x62')]['id'];return _0x5708c8;});return db[_0x497a('0x5a')][_0x497a('0x71')](_0x1385ed,{'raw':!![],'transaction':_0x49a73a});})[_0x497a('0x2a')](function(_0x25deb5){var _0x229ec7=_['filter'](_[_0x497a('0x35')](_0x25deb5,function(_0xeea7cf){return _0xeea7cf[_0x497a('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x229ec7){return db[_0x497a('0x5a')][_0x497a('0x4c')]({'where':{'userProfileId':_0x5148e8[_0x497a('0x62')]['id'],'sectionId':_[_0x497a('0x35')](_0x229ec7,function(_0x29871b){return _0x29871b[_0x497a('0x5d')];})},'attributes':['id',_0x497a('0x5d')],'raw':!![]})[_0x497a('0x2a')](function(_0x4f6843){var _0x4f5ffa=_[_0x497a('0x35')](_0x5148e8[_0x497a('0x53')],function(_0x282c3d){_0x282c3d['userProfileId']=_0x5148e8[_0x497a('0x62')]['id'];return _0x282c3d;});return db[_0x497a('0x5c')][_0x497a('0x71')](_0x4f5ffa,{'raw':!![],'transaction':_0x49a73a});});}})[_0x497a('0x51')](handleError(_0x586d92,null));});}})[_0x497a('0x2a')](function(_0x30065b){var _0x29e436=_[_0x497a('0x35')](_0x30065b,function(_0x579073){return _0x579073[_0x497a('0x54')]({'plain':!![]});});})['then'](respondWithResult(_0x586d92,null))[_0x497a('0x51')](handleError(_0x586d92,null));};exports[_0x497a('0x72')]=function(_0x2cfa13,_0x3368aa,_0x11887e){return db['UserProfile']['find']({'where':{'id':_0x2cfa13['params']['id']}})[_0x497a('0x2a')](handleEntityNotFound(_0x3368aa,null))[_0x497a('0x2a')](function(_0x394c5c){if(_0x394c5c){return _0x394c5c[_0x497a('0x72')](_0x2cfa13[_0x497a('0x3c')][_0x497a('0x65')]);}})['then'](respondWithStatusCode(_0x3368aa,null))[_0x497a('0x51')](handleError(_0x3368aa,null));};exports['getResources']=function(_0x405f91,_0x1030a8){var _0x5b5481={'raw':![],'where':{}};var _0x50b398={};var _0x427808={'count':0x0,'rows':[]};var _0x1ad5d7=_0x405f91[_0x497a('0x3c')]['section'];if(typeof _0x1ad5d7===_0x497a('0x22')){throw new db[(_0x497a('0x73'))][(_0x497a('0x74'))](_0x497a('0x75'));}var _0x3e371f=_0x405f91[_0x497a('0x3c')][_0x497a('0x76')]||![];var _0x2deaf9=getQueryModels(_0x1ad5d7,_0x3e371f);if(typeof _0x2deaf9[_0x497a('0x77')]==='undefined'){throw new db['Sequelize'][(_0x497a('0x74'))](_0x497a('0x78')+_0x1ad5d7+'\x27');}var _0x4d48e1=[];if(!_[_0x497a('0x69')](_0x2deaf9[_0x497a('0x79')])){_0x4d48e1=_0x2deaf9[_0x497a('0x79')];}else{_0x4d48e1=[{'name':_0x1ad5d7}];}return db[_0x497a('0x36')]['findOne']({'where':{'id':_0x405f91[_0x497a('0x62')]['id']}})[_0x497a('0x2a')](handleEntityNotFound(_0x1030a8,null))[_0x497a('0x2a')](function(_0x3146d4){if(_0x3146d4){var _0x2c8e8a=[];for(var _0x79f6a9=0x0;_0x79f6a9<_0x4d48e1[_0x497a('0x41')];_0x79f6a9++){_0x2c8e8a[_0x497a('0x6b')](db['UserProfileSection'][_0x497a('0x7a')]({'where':{'userProfileId':_0x3146d4['id'],'name':_0x4d48e1[_0x79f6a9]['name']},'raw':!![]}));}return BPromise[_0x497a('0x7b')](_0x2c8e8a);}})[_0x497a('0x2a')](function(_0x52f9be){var _0x30d613=_['filter'](_0x52f9be,function(_0x489367){return _0x489367?_0x489367:undefined;});var _0x28568b=_['filter'](_0x4d48e1,['ignore',!![]]);var _0x5abd27=_[_0x497a('0x69')](_0x30d613)&&_[_0x497a('0x69')](_0x28568b)?null:_[_0x497a('0x7c')](_0x28568b,_0x30d613);if(_0x5abd27){var _0x1d0b52=[];for(var _0x515bf8=0x0;_0x515bf8<_0x5abd27[_0x497a('0x41')];_0x515bf8++){var _0x3c1a35=_[_0x497a('0x50')](_0x4d48e1,function(_0xe5383d){return _0x5abd27[_0x515bf8]?_0xe5383d[_0x497a('0x2e')]===_0x5abd27[_0x515bf8][_0x497a('0x2e')]:null;});if(_0x3c1a35){if(_0x5abd27[_0x515bf8][_0x497a('0x7d')]){_0x1d0b52[_0x497a('0x6b')](getAllResources(_0x2deaf9['childModel'],_0x5abd27[_0x515bf8]));}else{if(!_0x5abd27[_0x515bf8]['autoAssociation']){_0x1d0b52[_0x497a('0x6b')](getAllowedResources(_0x3c1a35,_0x5abd27[_0x515bf8],_0x2deaf9[_0x497a('0x77')]));}else{if(_0x3c1a35[_0x497a('0x3b')]){_0x1d0b52[_0x497a('0x6b')](getAllFilteredResources(_0x3c1a35,_0x5abd27[_0x515bf8]));}}}}}return BPromise[_0x497a('0x7b')](_0x1d0b52);}else{return null;}})[_0x497a('0x2a')](function(_0x1ae39a){var _0x12556f=_0x1ae39a;var _0x4a7aac=null;if(_0x12556f){_0x4a7aac=_0x12556f[_0x497a('0x41')]===0x1?_0x12556f[0x0]:null;}if(_0x4a7aac||_0x12556f){var _0x90324f=db[_0x2deaf9[_0x497a('0x77')]][_0x497a('0x37')];_0x50b398['model']=_['keys'](_0x90324f);_0x50b398[_0x497a('0x3c')]=_[_0x497a('0x4f')](_0x405f91[_0x497a('0x3c')]);_0x50b398[_0x497a('0x3d')]=_[_0x497a('0x3e')](_0x50b398[_0x497a('0x3b')],_0x50b398[_0x497a('0x3c')]);_0x5b5481[_0x497a('0x3f')]=_[_0x497a('0x3e')](_0x50b398[_0x497a('0x3b')],qs['fields'](_0x405f91['query'][_0x497a('0x40')]));_0x5b5481[_0x497a('0x3f')]=_0x5b5481[_0x497a('0x3f')]['length']?_0x5b5481[_0x497a('0x3f')]:_0x50b398[_0x497a('0x3b')];if(!_0x405f91['query'][_0x497a('0x42')](_0x497a('0x43'))){_0x5b5481[_0x497a('0x23')]=qs[_0x497a('0x23')](_0x405f91[_0x497a('0x3c')][_0x497a('0x23')]);_0x5b5481[_0x497a('0x21')]=qs[_0x497a('0x21')](_0x405f91[_0x497a('0x3c')][_0x497a('0x21')]);}_0x5b5481[_0x497a('0x44')]=qs[_0x497a('0x7e')](_0x405f91[_0x497a('0x3c')][_0x497a('0x7e')]);_0x5b5481[_0x497a('0x48')]=qs[_0x497a('0x3d')](_[_0x497a('0x45')](_0x405f91[_0x497a('0x3c')],_0x50b398[_0x497a('0x3d')]));if(_0x405f91['query'][_0x497a('0x46')]){_0x5b5481[_0x497a('0x48')]=_['merge'](_0x5b5481[_0x497a('0x48')],{'$or':_['map'](_0x90324f,function(_0x4e9ab7){if(_0x4e9ab7['type'][_0x497a('0x3a')]!=='VIRTUAL'){var _0x2cc088={};_0x2cc088[_0x4e9ab7[_0x497a('0x7f')]]={'$like':'%'+_0x405f91['query'][_0x497a('0x46')]+'%'};return _0x2cc088;}})});}var _0x206f56=[];if(_0x4a7aac){var _0x27d692=_[_0x497a('0x50')](_0x4d48e1,['name',_0x4a7aac[_0x497a('0x2e')]]);if(_0x27d692[_0x497a('0x7f')]){var _0x366ed9={};if(_0x2deaf9[_0x497a('0x77')]===_0x497a('0x80')){_0x366ed9[_0x27d692[_0x497a('0x81')]]=_[_0x497a('0x35')](_0x4a7aac[_0x497a('0x82')],'id');}else{_0x366ed9[_0x27d692[_0x497a('0x81')]]=_0x4a7aac[_0x497a('0x82')];}_0x206f56[_0x497a('0x6b')](_0x366ed9);}else{_0x5b5481[_0x497a('0x48')]['id']=_0x4a7aac[_0x497a('0x82')];}}else{for(var _0x268240=0x0;_0x268240<_0x12556f[_0x497a('0x41')];_0x268240++){var _0x27d692=_[_0x497a('0x50')](_0x4d48e1,[_0x497a('0x2e'),_0x12556f[_0x268240][_0x497a('0x2e')]]);if(_0x27d692[_0x497a('0x7f')]){var _0x366ed9={};_0x366ed9[_0x27d692[_0x497a('0x81')]]=_0x12556f[_0x268240][_0x497a('0x82')];_0x206f56[_0x497a('0x6b')](_0x366ed9);}else{if(!_0x5b5481[_0x497a('0x48')]['id'])_0x5b5481[_0x497a('0x48')]['id']=[];_0x12556f[_0x268240][_0x497a('0x82')][_0x497a('0x6d')](function(_0x5c414b){_0x5b5481[_0x497a('0x48')]['id'][_0x497a('0x6b')](_0x5c414b);});}}}if(!_[_0x497a('0x69')](_0x206f56)){_0x5b5481[_0x497a('0x48')]=_[_0x497a('0x30')](_0x5b5481[_0x497a('0x48')],{'$and':{'$or':_0x206f56}});}_0x5b5481=_[_0x497a('0x30')]({},_0x5b5481,_0x405f91['options']);if(_0x4a7aac&&!_0x4a7aac[_0x497a('0x5b')]&&_0x2deaf9[_0x497a('0x77')]==='AnalyticExtractedReport'){if(_0x405f91[_0x497a('0x3c')]['includeAll']){_0x5b5481[_0x497a('0x4b')]=[{'all':!![]}];}return db[_0x2deaf9[_0x497a('0x77')]][_0x497a('0x4c')](_0x5b5481)[_0x497a('0x2a')](function(_0x13f0a1){var _0x2e4365=[];_0x13f0a1[_0x497a('0x6d')](function(_0x26fde1){var _0x206204;switch(_0x26fde1[_0x497a('0x83')]){case _0x497a('0x84'):_0x206204=_[_0x497a('0x50')](_0x4a7aac[_0x497a('0x82')],function(_0x2a33d5){return _0x2a33d5['id']===_0x26fde1[_0x497a('0x85')]&&_0x2a33d5[_0x497a('0x39')]==='DefaultReports';});break;case _0x497a('0x86'):_0x206204=_[_0x497a('0x50')](_0x4a7aac['associatedResources'],function(_0x24e094){return _0x24e094['id']===_0x26fde1[_0x497a('0x85')]&&_0x24e094['type']===_0x497a('0x87');});break;}if(_0x206204)_0x2e4365['push'](_0x26fde1);});_0x427808[_0x497a('0x49')]=_0x2e4365['length'];_0x427808[_0x497a('0x4d')]=_0x2e4365;return _0x427808;});}else{return db[_0x2deaf9[_0x497a('0x77')]][_0x497a('0x49')]({'where':_0x5b5481[_0x497a('0x48')]})[_0x497a('0x2a')](function(_0x14adbc){_0x427808[_0x497a('0x49')]=_0x14adbc;if(_0x405f91[_0x497a('0x3c')][_0x497a('0x4a')]){if(_0x2deaf9[_0x497a('0x77')]===_0x497a('0x88')){_0x5b5481['include']=[{'model':db[_0x497a('0x89')],'as':'Tags','attributes':['id',_0x497a('0x2e'),_0x497a('0x8a')],'required':_0x405f91[_0x497a('0x3c')]['tag']?!![]:![]},{'model':db[_0x497a('0x89')],'as':_0x497a('0x8b'),'attributes':['id',_0x497a('0x2e'),_0x497a('0x8a')],'through':_0x405f91[_0x497a('0x3c')]['tag']?{'attributes':[],'where':{'TagId':_0x405f91[_0x497a('0x3c')]['tag']||undefined}}:{},'required':_0x405f91['query'][_0x497a('0x8c')]?!![]:![]}];}else{_0x5b5481[_0x497a('0x4b')]=[{'all':!![]}];}}return db[_0x2deaf9['childModel']][_0x497a('0x4c')](_0x5b5481);})[_0x497a('0x2a')](function(_0x58ab5a){_0x427808[_0x497a('0x4d')]=_0x58ab5a;if(_0x1ad5d7===_0x497a('0x8d')&&_0x405f91['query']['openTabs']===_0x497a('0x8e')){var _0x152fbf=[];for(var _0x2546a9=0x0;_0x2546a9<_0x427808[_0x497a('0x4d')]['length'];_0x2546a9++){_0x152fbf['push'](getOpenTabs(_0x497a('0x8f'),_0x427808[_0x497a('0x4d')][_0x2546a9][_0x497a('0x90')]));_0x152fbf[_0x497a('0x6b')](getOpenTabs(_0x497a('0x91'),_0x427808[_0x497a('0x4d')][_0x2546a9]['dataValues']));_0x152fbf[_0x497a('0x6b')](getOpenTabs(_0x497a('0x92'),_0x427808[_0x497a('0x4d')][_0x2546a9][_0x497a('0x90')]));_0x152fbf[_0x497a('0x6b')](getOpenTabs(_0x497a('0x93'),_0x427808[_0x497a('0x4d')][_0x2546a9]['dataValues']));_0x152fbf[_0x497a('0x6b')](getOpenTabs(_0x497a('0x94'),_0x427808[_0x497a('0x4d')][_0x2546a9][_0x497a('0x90')]));_0x152fbf['push'](getOpenTabs(_0x497a('0x95'),_0x427808[_0x497a('0x4d')][_0x2546a9][_0x497a('0x90')]));}return Promise[_0x497a('0x7b')](_0x152fbf)[_0x497a('0x2a')](function(){return _0x427808;});}return _0x427808;});}}else{return _0x427808;}})[_0x497a('0x2a')](respondWithFilteredResult(_0x1030a8,_0x5b5481))[_0x497a('0x51')](handleError(_0x1030a8,null));};function getOpenTabs(_0x1ff779,_0x3b746f){var _0x256533=_0x1ff779[_0x497a('0x96')](0x0)[_0x497a('0x97')]()+_0x1ff779[_0x497a('0x98')](0x1);var _0x2b5954={'type':db[_0x497a('0x73')][_0x497a('0x99')][_0x497a('0x9a')],'raw':!![]};return new BPromise(function(_0x3326ee,_0x5d04e1){var _0x37af90=squel[_0x497a('0x9b')]()[_0x497a('0x7f')](_0x497a('0x9c')+_0x256533+_0x497a('0x9d'),'id')[_0x497a('0x7f')](_0x497a('0x9e'))[_0x497a('0x9f')](_0x497a('0xa0')+_0x1ff779+_0x497a('0xa1'),'ui')[_0x497a('0x48')](_0x497a('0xa2'),_0x3b746f['id']);return db[_0x497a('0x59')][_0x497a('0x3c')](_0x37af90[_0x497a('0xa3')](),_0x2b5954)[_0x497a('0x2a')](function(_0x667d23){_0x3b746f[_0x256533+_0x497a('0xa4')]=_0x667d23;_0x3326ee(_0x667d23);})[_0x497a('0x51')](function(_0x2c5164){_0x5d04e1(_0x2c5164);});});}function getAllResources(_0x447a37,_0x531b41){return new BPromise(function(_0x4eb3d1,_0x4865a7){if(_0x531b41){var _0x12b331=_0x531b41[_0x497a('0x46')]?{[_0x531b41[_0x497a('0x46')][_0x497a('0x7f')]]:_0x531b41[_0x497a('0x46')][_0x497a('0xa5')]}:undefined;return db[_0x447a37][_0x497a('0x4c')]({'where':_0x12b331,'raw':!![]})[_0x497a('0x2a')](function(_0x436b2c){_0x531b41[_0x497a('0x82')]=_[_0x497a('0x35')](_0x436b2c,'id');_0x4eb3d1(_0x531b41);})[_0x497a('0x51')](function(_0x7ca5a4){_0x4865a7(_0x7ca5a4);});}else{_0x4eb3d1(null);}});}function getAllFilteredResources(_0x16e43,_0x23ec0e){return new BPromise(function(_0x181527,_0x175374){var _0x1a989d=_0x16e43[_0x497a('0x46')]?{[_0x16e43[_0x497a('0x46')]['field']]:_0x16e43[_0x497a('0x46')]['value']}:undefined;return db[_0x16e43[_0x497a('0x3b')]][_0x497a('0x4c')]({'where':_0x1a989d,'raw':!![]})[_0x497a('0x2a')](function(_0xfdb98a){_0x23ec0e[_0x497a('0x82')]=_['map'](_0xfdb98a,function(_0x408d68){return _0x16e43[_0x497a('0x7f')]?_0x408d68[_0x16e43[_0x497a('0x7f')]]:_0x408d68[_0x497a('0x2e')];});_0x181527(_0x23ec0e);})['catch'](function(_0x1774a9){_0x175374(_0x1774a9);});});}function getAllowedResources(_0x33b87e,_0x548d89,_0x5426ca){return new BPromise(function(_0x40b3b5,_0x53044a){if(_0x548d89){return db[_0x497a('0x5c')][_0x497a('0x4c')]({'where':{'sectionId':_0x548d89['id']},'raw':!![]})[_0x497a('0x2a')](function(_0x3655a8){if(_0x33b87e[_0x497a('0x7f')]&&_0x33b87e['field']!=='id'){_0x548d89[_0x497a('0x82')]=_[_0x497a('0x35')](_0x3655a8,function(_0x41a3a5){return _0x41a3a5[_0x33b87e[_0x497a('0x7f')]];});}else{if(_0x5426ca===_0x497a('0x80')){_0x548d89['associatedResources']=_[_0x497a('0x35')](_0x3655a8,function(_0x55c4b1){return{'id':_0x55c4b1['resourceId'],'type':_0x55c4b1[_0x497a('0x39')]};});}else{_0x548d89[_0x497a('0x82')]=_[_0x497a('0x35')](_0x3655a8,function(_0x5da34a){return _0x5da34a[_0x497a('0x6f')];});}}_0x40b3b5(_0x548d89);})[_0x497a('0x51')](function(_0x10447c){_0x53044a(_0x10447c);});}else{_0x40b3b5(null);}});}function getQueryModels(_0x407f95,_0x5eea74){var _0x40ea8c=_0x407f95[_0x497a('0xa6')]();var _0xead752={'childModel':undefined,'parentSections':[]};switch(_0x40ea8c){case'squareprojects':_0xead752[_0x497a('0x77')]=_0x497a('0xa7');break;case _0x497a('0xa8'):_0xead752[_0x497a('0x77')]='SquareOdbc';break;case _0x497a('0xa9'):_0xead752[_0x497a('0x77')]=_0x497a('0xaa');_0xead752[_0x497a('0x79')]=[{'name':_0x497a('0xab'),'field':_0x497a('0x2e'),'foreignKey':_0x497a('0xac')}];break;case _0x497a('0xad'):_0xead752[_0x497a('0x77')]=_0x497a('0xae');break;case _0x497a('0xaf'):_0xead752[_0x497a('0x77')]='CmContact';_0xead752[_0x497a('0x79')]=[{'name':'Lists','field':'id','foreignKey':_0x497a('0xb0')}];break;case'lists':_0xead752['childModel']=_0x497a('0xb1');break;case _0x497a('0xb2'):_0xead752['childModel']=_0x497a('0xb3');break;case _0x497a('0xb4'):_0xead752[_0x497a('0x77')]=_0x497a('0xb5');break;case'chatqueues':_0xead752[_0x497a('0x77')]=_0x497a('0xb6');break;case _0x497a('0xb7'):_0xead752[_0x497a('0x77')]=_0x497a('0xb8');break;case'faxqueues':_0xead752[_0x497a('0x77')]='FaxQueue';break;case _0x497a('0xb9'):_0xead752['childModel']=_0x497a('0xba');break;case _0x497a('0xbb'):case _0x497a('0xbc'):case'outboundroutes':_0xead752[_0x497a('0x77')]=_0x497a('0xbd');break;case'contexts':_0xead752[_0x497a('0x77')]=_0x497a('0xbe');break;case _0x497a('0xbf'):_0xead752[_0x497a('0x77')]=_0x497a('0xc0');break;case _0x497a('0xc1'):_0xead752[_0x497a('0x77')]=_0x497a('0xc2');_0xead752['parentSections']=[{'name':_0x497a('0x8d'),'field':_0x497a('0x2e'),'foreignKey':_0x497a('0xc3'),'model':'User','filter':{'field':'role','value':['agent']}},{'name':'Telephones','field':_0x497a('0x2e'),'foreignKey':_0x497a('0xc3'),'model':'User','filter':{'field':'role','value':[_0x497a('0xc4')]}},{'name':_0x497a('0xc5'),'field':_0x497a('0x2e'),'foreignKey':_0x497a('0xc6'),'model':_0x497a('0xc7'),'filter':{'field':_0x497a('0x39'),'value':[_0x497a('0xc8')]}},{'name':_0x497a('0xc9'),'field':'name','foreignKey':_0x497a('0xc6'),'model':_0x497a('0xc7'),'filter':{'field':_0x497a('0x39'),'value':['outbound']}}];break;case _0x497a('0xca'):_0xead752[_0x497a('0x77')]=_0x497a('0xcb');break;case _0x497a('0xcc'):_0xead752[_0x497a('0x77')]=_0x497a('0xcd');break;case'voiceprefixes':_0xead752['childModel']=_0x497a('0xce');break;case _0x497a('0xcf'):_0xead752[_0x497a('0x77')]=_0x497a('0xd0');break;case'mailqueues':_0xead752[_0x497a('0x77')]=_0x497a('0xd1');break;case _0x497a('0xd2'):_0xead752['childModel']=_0x497a('0xd3');break;case _0x497a('0xd4'):_0xead752[_0x497a('0x77')]=_0x497a('0xd5');break;case _0x497a('0xd6'):_0xead752[_0x497a('0x77')]='OpenchannelQueue';break;case _0x497a('0xd7'):_0xead752[_0x497a('0x77')]=_0x497a('0xd8');break;case _0x497a('0xd9'):_0xead752[_0x497a('0x77')]='SmsQueue';break;case _0x497a('0xda'):_0xead752['childModel']=_0x497a('0xdb');break;case _0x497a('0xdc'):_0xead752[_0x497a('0x77')]='WhatsappQueue';break;case _0x497a('0xdd'):_0xead752[_0x497a('0x77')]=_0x497a('0xde');break;case _0x497a('0xdf'):case'queuecampaigns':_0xead752['childModel']=_0x497a('0xc7');if(_0x5eea74){_0xead752[_0x497a('0x79')]=[{'name':'VoiceQueues'},{'name':_0x497a('0xc9')}];}break;case'users':case'agents':case'telephones':_0xead752[_0x497a('0x77')]=_0x497a('0xe0');if(_0x5eea74){_0xead752[_0x497a('0x79')]=[{'name':_0x497a('0xe1'),'filter':{'field':'role','value':['admin',_0x497a('0xe2')]},'ignore':!![]},{'name':_0x497a('0x8d')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0xead752[_0x497a('0x77')]='ZendeskAccount';break;case'salesforceaccounts':_0xead752['childModel']='SalesforceAccount';break;case'freshdeskaccounts':_0xead752[_0x497a('0x77')]='FreshdeskAccount';break;case _0x497a('0xe3'):_0xead752['childModel']=_0x497a('0xe4');break;case _0x497a('0xe5'):_0xead752[_0x497a('0x77')]=_0x497a('0xe6');break;case _0x497a('0xe7'):_0xead752[_0x497a('0x77')]=_0x497a('0xe8');break;case _0x497a('0xe9'):_0xead752['childModel']=_0x497a('0xe0');break;case'cannedanswers':_0xead752[_0x497a('0x77')]=_0x497a('0xea');break;case _0x497a('0xeb'):_0xead752['childModel']='Disposition';break;case _0x497a('0xec'):_0xead752[_0x497a('0x77')]='Dashboard';break;case _0x497a('0xed'):_0xead752[_0x497a('0x77')]=_0x497a('0xee');break;case _0x497a('0xef'):_0xead752[_0x497a('0x77')]='Pause';break;case _0x497a('0xf0'):_0xead752['childModel']=_0x497a('0xf1');break;case _0x497a('0xf2'):_0xead752[_0x497a('0x77')]='Sound';break;case _0x497a('0xf3'):_0xead752[_0x497a('0x77')]=_0x497a('0x89');break;case _0x497a('0xf4'):_0xead752[_0x497a('0x77')]=_0x497a('0xf5');break;case _0x497a('0xf6'):_0xead752[_0x497a('0x77')]=_0x497a('0xf7');break;case _0x497a('0xf8'):_0xead752[_0x497a('0x77')]=_0x497a('0xf9');break;case _0x497a('0xfa'):_0xead752[_0x497a('0x77')]=_0x497a('0xfb');break;case'plugins':_0xead752[_0x497a('0x77')]=_0x497a('0x6e');break;case _0x497a('0xfc'):_0xead752['childModel']=_0x497a('0x80');_0xead752[_0x497a('0x79')]=[{'name':'Reports','field':'id','foreignKey':_0x497a('0x85')}];break;case'metrics':_0xead752[_0x497a('0x77')]=_0x497a('0xfd');break;case'whatsappaccounts':_0xead752[_0x497a('0x77')]='WhatsappAccount';break;case _0x497a('0xfe'):_0xead752[_0x497a('0x77')]=_0x497a('0xff');_0xead752['parentSections']=[{'name':_0x497a('0x8d'),'field':'id','foreignKey':_0x497a('0x100'),'model':_0x497a('0xe0'),'filter':{'field':'role','value':[_0x497a('0x101')]}},{'name':_0x497a('0x102'),'field':'id','foreignKey':_0x497a('0x100'),'model':'User','filter':{'field':_0x497a('0x103'),'value':[_0x497a('0xc4')]}}];break;default:return _0xead752;}return _0xead752;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 7d49a00..4f3497b 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 _0xbcd8=['hasOwnProperty','hook','exports','UserProfile','setMaxListeners','update','remove','emit'];(function(_0x1866ea,_0x547489){var _0x34f90a=function(_0x2b9a5c){while(--_0x2b9a5c){_0x1866ea['push'](_0x1866ea['shift']());}};_0x34f90a(++_0x547489);}(_0xbcd8,0x9b));var _0x8bcd=function(_0x107376,_0x2bd620){_0x107376=_0x107376-0x0;var _0x29554c=_0xbcd8[_0x107376];return _0x29554c;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0x8bcd('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8bcd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8bcd('0x2'),'afterDestroy':_0x8bcd('0x3')};function emitEvent(_0x5dc6e4){return function(_0x3ffe8d,_0x591bf8,_0x4c419e){UserProfileEvents['emit'](_0x5dc6e4+':'+_0x3ffe8d['id'],_0x3ffe8d);UserProfileEvents[_0x8bcd('0x4')](_0x5dc6e4,_0x3ffe8d);_0x4c419e(null);};}for(var e in events){if(events[_0x8bcd('0x5')](e)){var event=events[e];UserProfile[_0x8bcd('0x6')](e,emitEvent(event));}}module[_0x8bcd('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xa9cd=['../../mysqldb','UserProfile','setMaxListeners','remove','emit','hasOwnProperty','exports','events'];(function(_0x2ed1a0,_0x36acd9){var _0x3d272e=function(_0x41460c){while(--_0x41460c){_0x2ed1a0['push'](_0x2ed1a0['shift']());}};_0x3d272e(++_0x36acd9);}(_0xa9cd,0x13f));var _0xda9c=function(_0x334068,_0x6e26bf){_0x334068=_0x334068-0x0;var _0x74585c=_0xa9cd[_0x334068];return _0x74585c;};'use strict';var EventEmitter=require(_0xda9c('0x0'));var UserProfile=require(_0xda9c('0x1'))['db'][_0xda9c('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xda9c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xda9c('0x4')};function emitEvent(_0x3159e3){return function(_0x1536cd,_0x5e9d7,_0x1d0d0f){UserProfileEvents[_0xda9c('0x5')](_0x3159e3+':'+_0x1536cd['id'],_0x1536cd);UserProfileEvents[_0xda9c('0x5')](_0x3159e3,_0x1536cd);_0x1d0d0f(null);};}for(var e in events){if(events[_0xda9c('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xda9c('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e95784f..7b14d61 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 _0x1eba=['exports','define','UserProfile','user_profiles','User','privacyEnabled','catch','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userProfile.attributes'];(function(_0x37f640,_0x36d435){var _0xf0a11=function(_0x2e5277){while(--_0x2e5277){_0x37f640['push'](_0x37f640['shift']());}};_0xf0a11(++_0x36d435);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x1eba[_0x3c6ae2];return _0x4edda;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1eb('0x5'));var rimraf=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var attributes=require(_0xa1eb('0x8'));module[_0xa1eb('0x9')]=function(_0x2933d0,_0x1d0d67){return _0x2933d0[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2aebb6,_0x9d7113,_0x54d235){var _0x1ecd20=_0x2933d0['models'];_0x1ecd20[_0xa1eb('0xd')]['update']({'privacyEnabled':_0x2aebb6[_0xa1eb('0xe')]},{'where':{'UserProfileId':_0x2aebb6['id']}})['then'](function(){_0x54d235();})[_0xa1eb('0xf')](function(_0x5502e4){_0x54d235(_0x5502e4);});}}});}; \ No newline at end of file +var _0xa062=['UserProfile','user_profiles','User','update','privacyEnabled','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x2ecd9a,_0x2e049d){var _0x211dac=function(_0x2964ed){while(--_0x2964ed){_0x2ecd9a['push'](_0x2ecd9a['shift']());}};_0x211dac(++_0x2e049d);}(_0xa062,0x101));var _0x2a06=function(_0x19f5ae,_0x3bc8e4){_0x19f5ae=_0x19f5ae-0x0;var _0x5448e7=_0xa062[_0x19f5ae];return _0x5448e7;};'use strict';var _=require(_0x2a06('0x0'));var util=require(_0x2a06('0x1'));var logger=require(_0x2a06('0x2'))('api');var moment=require(_0x2a06('0x3'));var BPromise=require(_0x2a06('0x4'));var rp=require(_0x2a06('0x5'));var fs=require('fs');var path=require(_0x2a06('0x6'));var rimraf=require('rimraf');var config=require(_0x2a06('0x7'));var attributes=require('./userProfile.attributes');module['exports']=function(_0x1376ba,_0x1ba42f){return _0x1376ba[_0x2a06('0x8')](_0x2a06('0x9'),attributes,{'tableName':_0x2a06('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x448892,_0x5da16b,_0x2a09df){var _0x30e8c5=_0x1376ba['models'];_0x30e8c5[_0x2a06('0xb')][_0x2a06('0xc')]({'privacyEnabled':_0x448892[_0x2a06('0xd')]},{'where':{'UserProfileId':_0x448892['id']}})['then'](function(){_0x2a09df();})['catch'](function(_0x4b0b28){_0x2a09df(_0x4b0b28);});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index c422e54..7882cb4 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 _0x7217=['then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request'];(function(_0x2886e2,_0x95fe23){var _0x267ec6=function(_0x539da4){while(--_0x539da4){_0x2886e2['push'](_0x2886e2['shift']());}};_0x267ec6(++_0x95fe23);}(_0x7217,0x19e));var _0x7721=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x7217[_0x32d457];return _0x338386;};'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});config[_0x7721('0xb')]=_[_0x7721('0xc')](config[_0x7721('0xb')],{'host':_0x7721('0xd'),'port':0x18eb});var socket=require(_0x7721('0xe'))(new Redis(config[_0x7721('0xb')]));require(_0x7721('0xf'))[_0x7721('0x10')](socket);function respondWithRpcPromise(_0x138740,_0x2c3986,_0x578d59){return new BPromise(function(_0x461d1a,_0x29bc8f){return client[_0x7721('0x11')](_0x138740,_0x578d59)[_0x7721('0x12')](function(_0xa8977c){logger[_0x7721('0x13')](_0x7721('0x14'),_0x2c3986,_0x7721('0x15'));logger['debug'](_0x7721('0x16'),_0x2c3986,_0x7721('0x15'),JSON['stringify'](_0xa8977c));if(_0xa8977c[_0x7721('0x17')]){if(_0xa8977c[_0x7721('0x17')][_0x7721('0x18')]===0x1f4){logger[_0x7721('0x17')]('UserProfile,\x20%s,\x20%s',_0x2c3986,_0xa8977c[_0x7721('0x17')][_0x7721('0x19')]);return _0x29bc8f(_0xa8977c['error']['message']);}logger['error'](_0x7721('0x14'),_0x2c3986,_0xa8977c[_0x7721('0x17')][_0x7721('0x19')]);return _0x461d1a(_0xa8977c[_0x7721('0x17')]['message']);}else{logger[_0x7721('0x13')]('UserProfile,\x20%s,\x20%s',_0x2c3986,_0x7721('0x15'));_0x461d1a(_0xa8977c['result'][_0x7721('0x19')]);}})[_0x7721('0x1a')](function(_0x3ab5a5){logger[_0x7721('0x17')](_0x7721('0x14'),_0x2c3986,_0x3ab5a5);_0x29bc8f(_0x3ab5a5);});});} \ No newline at end of file +var _0xdbf5=['request\x20sent','stringify','error','message','info','result','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s'];(function(_0x536e90,_0x12019d){var _0x522df2=function(_0x4ee2eb){while(--_0x4ee2eb){_0x536e90['push'](_0x536e90['shift']());}};_0x522df2(++_0x12019d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x420039,_0x5644ae){_0x420039=_0x420039-0x0;var _0x120975=_0xdbf5[_0x420039];return _0x120975;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});config[_0x5dbf('0xb')]=_[_0x5dbf('0xc')](config[_0x5dbf('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5dbf('0xd'))(new Redis(config['redis']));require(_0x5dbf('0xe'))[_0x5dbf('0xf')](socket);function respondWithRpcPromise(_0x264007,_0x1813bb,_0x4efed3){return new BPromise(function(_0xe3ddb7,_0x521a31){return client['request'](_0x264007,_0x4efed3)[_0x5dbf('0x10')](function(_0x5dbc97){logger['info'](_0x5dbf('0x11'),_0x1813bb,'request\x20sent');logger[_0x5dbf('0x12')](_0x5dbf('0x13'),_0x1813bb,_0x5dbf('0x14'),JSON[_0x5dbf('0x15')](_0x5dbc97));if(_0x5dbc97[_0x5dbf('0x16')]){if(_0x5dbc97['error']['code']===0x1f4){logger[_0x5dbf('0x16')](_0x5dbf('0x11'),_0x1813bb,_0x5dbc97['error'][_0x5dbf('0x17')]);return _0x521a31(_0x5dbc97[_0x5dbf('0x16')][_0x5dbf('0x17')]);}logger[_0x5dbf('0x16')](_0x5dbf('0x11'),_0x1813bb,_0x5dbc97[_0x5dbf('0x16')][_0x5dbf('0x17')]);return _0xe3ddb7(_0x5dbc97['error']['message']);}else{logger[_0x5dbf('0x18')](_0x5dbf('0x11'),_0x1813bb,_0x5dbf('0x14'));_0xe3ddb7(_0x5dbc97[_0x5dbf('0x19')][_0x5dbf('0x17')]);}})['catch'](function(_0x11cd00){logger['error']('UserProfile,\x20%s,\x20%s',_0x1813bb,_0x11cd00);_0x521a31(_0x11cd00);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 2d21117..4ce38a0 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 _0xf46f=['./userProfile.events','remove','removeListener','register','userProfile:'];(function(_0x637aa7,_0x37aa72){var _0x24b634=function(_0xc2aba3){while(--_0xc2aba3){_0x637aa7['push'](_0x637aa7['shift']());}};_0x24b634(++_0x37aa72);}(_0xf46f,0xaa));var _0xff46=function(_0x975f40,_0x31a568){_0x975f40=_0x975f40-0x0;var _0xa25569=_0xf46f[_0x975f40];return _0xa25569;};'use strict';var UserProfileEvents=require(_0xff46('0x0'));var events=['save',_0xff46('0x1'),'update'];function createListener(_0x5f47d2,_0x522ff1){return function(_0x2c0a5a){_0x522ff1['emit'](_0x5f47d2,_0x2c0a5a);};}function removeListener(_0x4f9d06,_0x45d830){return function(){UserProfileEvents[_0xff46('0x2')](_0x4f9d06,_0x45d830);};}exports[_0xff46('0x3')]=function(_0x2466bb){for(var _0x782dee=0x0,_0x236b39=events['length'];_0x782dee<_0x236b39;_0x782dee++){var _0x3e82ce=events[_0x782dee];var _0x1625bf=createListener(_0xff46('0x4')+_0x3e82ce,_0x2466bb);UserProfileEvents['on'](_0x3e82ce,_0x1625bf);}}; \ No newline at end of file +var _0xd5bf=['length','userProfile:','save','remove','update','emit','removeListener'];(function(_0x19aacd,_0x3923b6){var _0x3e0802=function(_0x1edf6b){while(--_0x1edf6b){_0x19aacd['push'](_0x19aacd['shift']());}};_0x3e0802(++_0x3923b6);}(_0xd5bf,0x18a));var _0xfd5b=function(_0x120f81,_0x240bde){_0x120f81=_0x120f81-0x0;var _0x42274f=_0xd5bf[_0x120f81];return _0x42274f;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xfd5b('0x0'),_0xfd5b('0x1'),_0xfd5b('0x2')];function createListener(_0x55c8a3,_0x212a4e){return function(_0x484daf){_0x212a4e[_0xfd5b('0x3')](_0x55c8a3,_0x484daf);};}function removeListener(_0x152a3f,_0x50c41d){return function(){UserProfileEvents[_0xfd5b('0x4')](_0x152a3f,_0x50c41d);};}exports['register']=function(_0x4c262a){for(var _0x5e0abb=0x0,_0x4a5502=events[_0xfd5b('0x5')];_0x5e0abb<_0x4a5502;_0x5e0abb++){var _0x1e3a3b=events[_0x5e0abb];var _0x31ccf1=createListener(_0xfd5b('0x6')+_0x1e3a3b,_0x4c262a);UserProfileEvents['on'](_0x1e3a3b,_0x31ccf1);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 75c198c..faf5791 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 _0x78dd=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','create','update','delete','destroy','exports','util'];(function(_0x9d02c8,_0x8d296a){var _0x349cc8=function(_0x12df5f){while(--_0x12df5f){_0x9d02c8['push'](_0x9d02c8['shift']());}};_0x349cc8(++_0x8d296a);}(_0x78dd,0x18f));var _0xd78d=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x78dd[_0x2ca2d0];return _0x521c23;};'use strict';var multer=require('multer');var util=require(_0xd78d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd78d('0x1'));var router=express[_0xd78d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd78d('0x3'));var interaction=require(_0xd78d('0x4'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xd78d('0x5')]('/',auth[_0xd78d('0x6')](),controller[_0xd78d('0x7')]);router['get'](_0xd78d('0x8'),auth[_0xd78d('0x6')](),controller['describe']);router['get'](_0xd78d('0x9'),auth[_0xd78d('0x6')](),controller[_0xd78d('0xa')]);router['post']('/',auth[_0xd78d('0x6')](),controller[_0xd78d('0xb')]);router['put'](_0xd78d('0x9'),auth[_0xd78d('0x6')](),controller[_0xd78d('0xc')]);router[_0xd78d('0xd')](_0xd78d('0x9'),auth[_0xd78d('0x6')](),controller[_0xd78d('0xe')]);module[_0xd78d('0xf')]=router; \ No newline at end of file +var _0x1f14=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','create','put','destroy'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1f14,0x10f));var _0x41f1=function(_0x35faa5,_0x32f118){_0x35faa5=_0x35faa5-0x0;var _0xa67e8b=_0x1f14[_0x35faa5];return _0xa67e8b;};'use strict';var multer=require(_0x41f1('0x0'));var util=require('util');var path=require(_0x41f1('0x1'));var timeout=require(_0x41f1('0x2'));var express=require(_0x41f1('0x3'));var router=express['Router']();var fs_extra=require(_0x41f1('0x4'));var auth=require(_0x41f1('0x5'));var interaction=require(_0x41f1('0x6'));var config=require(_0x41f1('0x7'));var controller=require(_0x41f1('0x8'));router[_0x41f1('0x9')]('/',auth[_0x41f1('0xa')](),controller['index']);router[_0x41f1('0x9')](_0x41f1('0xb'),auth[_0x41f1('0xa')](),controller[_0x41f1('0xc')]);router[_0x41f1('0x9')](_0x41f1('0xd'),auth[_0x41f1('0xa')](),controller['show']);router['post']('/',auth[_0x41f1('0xa')](),controller[_0x41f1('0xe')]);router[_0x41f1('0xf')](_0x41f1('0xd'),auth[_0x41f1('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x41f1('0x10')]);module[_0x41f1('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 77c449f..bd46762 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 _0xd009=['STRING','INTEGER','sequelize','exports'];(function(_0x291c1b,_0x5216a6){var _0x2109c9=function(_0x498cbf){while(--_0x498cbf){_0x291c1b['push'](_0x291c1b['shift']());}};_0x2109c9(++_0x5216a6);}(_0xd009,0x10e));var _0x9d00=function(_0xa3a518,_0x20c7c7){_0xa3a518=_0xa3a518-0x0;var _0x32e155=_0xd009[_0xa3a518];return _0x32e155;};'use strict';var Sequelize=require(_0x9d00('0x0'));module[_0x9d00('0x1')]={'name':{'type':Sequelize[_0x9d00('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9d00('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9d00('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe0a1=['STRING','INTEGER','sequelize'];(function(_0x359d16,_0x14169b){var _0x446f0c=function(_0xa8f5be){while(--_0xa8f5be){_0x359d16['push'](_0x359d16['shift']());}};_0x446f0c(++_0x14169b);}(_0xe0a1,0x143));var _0x1e0a=function(_0x447b93,_0x2670ae){_0x447b93=_0x447b93-0x0;var _0x1fd738=_0xe0a1[_0x447b93];return _0x1fd738;};'use strict';var Sequelize=require(_0x1e0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x1e0a('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1e0a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1e0a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index b189225..9e0205e 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 _0x7824=['interaction','account','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','UserProfileResource','include','findAll','rows','catch','params','find','create','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','stack','name','send','merge','body','contact','message','agent'];(function(_0x1551ed,_0x5cc3ce){var _0x499928=function(_0x41b8d5){while(--_0x41b8d5){_0x1551ed['push'](_0x1551ed['shift']());}};_0x499928(++_0x5cc3ce);}(_0x7824,0x72));var _0x4782=function(_0x464a0c,_0x522a8f){_0x464a0c=_0x464a0c-0x0;var _0x3e3606=_0x7824[_0x464a0c];return _0x3e3606;};'use strict';var emlformat=require(_0x4782('0x0'));var rimraf=require(_0x4782('0x1'));var zipdir=require(_0x4782('0x2'));var jsonpatch=require(_0x4782('0x3'));var rp=require(_0x4782('0x4'));var moment=require(_0x4782('0x5'));var BPromise=require(_0x4782('0x6'));var Mustache=require(_0x4782('0x7'));var util=require(_0x4782('0x8'));var path=require('path');var sox=require(_0x4782('0x9'));var csv=require(_0x4782('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4782('0xb'));var _=require('lodash');var squel=require(_0x4782('0xc'));var crypto=require(_0x4782('0xd'));var jsforce=require(_0x4782('0xe'));var deskjs=require(_0x4782('0xf'));var toCsv=require(_0x4782('0xa'));var querystring=require(_0x4782('0x10'));var Papa=require(_0x4782('0x11'));var Redis=require('ioredis');var authService=require(_0x4782('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4782('0x13'));var hardwareService=require(_0x4782('0x14'));var logger=require('../../config/logger')(_0x4782('0x15'));var utils=require(_0x4782('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4782('0x17'));var db=require(_0x4782('0x18'))['db'];function respondWithStatusCode(_0x7bd847,_0x443200){_0x443200=_0x443200||0xcc;return function(_0x5ef8a2){if(_0x5ef8a2){return _0x7bd847[_0x4782('0x19')](_0x443200);}return _0x7bd847[_0x4782('0x1a')](_0x443200)[_0x4782('0x1b')]();};}function respondWithResult(_0xedc502,_0x4c3f7e){_0x4c3f7e=_0x4c3f7e||0xc8;return function(_0x3df0cf){if(_0x3df0cf){return _0xedc502['status'](_0x4c3f7e)[_0x4782('0x1c')](_0x3df0cf);}};}function respondWithFilteredResult(_0x41ce21,_0x20d580){return function(_0x11f019){if(_0x11f019){var _0x1ce4f4=typeof _0x20d580['offset']===_0x4782('0x1d')&&typeof _0x20d580[_0x4782('0x1e')]===_0x4782('0x1d');var _0x146bc5=_0x11f019[_0x4782('0x1f')];var _0x8c1d60=_0x1ce4f4?0x0:_0x20d580[_0x4782('0x20')];var _0x53fa29=_0x1ce4f4?_0x11f019['count']:_0x20d580[_0x4782('0x20')]+_0x20d580['limit'];var _0x100a10;if(_0x53fa29>=_0x146bc5){_0x53fa29=_0x146bc5;_0x100a10=0xc8;}else{_0x100a10=0xce;}_0x41ce21[_0x4782('0x1a')](_0x100a10);return _0x41ce21[_0x4782('0x21')](_0x4782('0x22'),_0x8c1d60+'-'+_0x53fa29+'/'+_0x146bc5)[_0x4782('0x1c')](_0x11f019);}return null;};}function patchUpdates(_0x4faf48){return function(_0x714463){try{jsonpatch['apply'](_0x714463,_0x4faf48,!![]);}catch(_0x5c9f38){return BPromise[_0x4782('0x23')](_0x5c9f38);}return _0x714463['save']();};}function saveUpdates(_0x77b6ec,_0x4239c6){return function(_0x12ae9c){if(_0x12ae9c){return _0x12ae9c[_0x4782('0x24')](_0x77b6ec)[_0x4782('0x25')](function(_0x3035aa){return _0x3035aa;});}return null;};}function removeEntity(_0x30d708,_0x3c075f){return function(_0x2ea9ef){if(_0x2ea9ef){return _0x2ea9ef['destroy']()[_0x4782('0x25')](function(){_0x30d708[_0x4782('0x1a')](0xcc)[_0x4782('0x1b')]();});}};}function handleEntityNotFound(_0x567919,_0x21cee3){return function(_0x1ebd0d){if(!_0x1ebd0d){_0x567919[_0x4782('0x19')](0x194);}return _0x1ebd0d;};}function handleError(_0x25beed,_0x15f491){_0x15f491=_0x15f491||0x1f4;return function(_0x48a9ce){logger['error'](_0x48a9ce[_0x4782('0x26')]);if(_0x48a9ce[_0x4782('0x27')]){delete _0x48a9ce[_0x4782('0x27')];}_0x25beed['status'](_0x15f491)[_0x4782('0x28')](_0x48a9ce);};}function getMustacheRender(_0xaa1a17,_0xd0166f){return Mustache['render'](_0xaa1a17,_[_0x4782('0x29')](_0xd0166f[_0x4782('0x2a')],{'contact':_0xd0166f[_0x4782('0x2b')],'message':_0xd0166f[_0x4782('0x2c')],'agent':_0xd0166f[_0x4782('0x2d')],'interaction':_0xd0166f[_0x4782('0x2e')],'account':_0xd0166f[_0x4782('0x2f')]}))||'';}exports[_0x4782('0x30')]=function(_0x1233ba,_0x1240f4){var _0x12290e={},_0x40137a={},_0x5c3d04={'count':0x0,'rows':[]};var _0x1c779d=_[_0x4782('0x31')](db['UserProfileResource'][_0x4782('0x32')],function(_0xe1743a){return{'name':_0xe1743a[_0x4782('0x33')],'type':_0xe1743a[_0x4782('0x34')][_0x4782('0x35')]};});_0x40137a[_0x4782('0x36')]=_[_0x4782('0x31')](_0x1c779d,_0x4782('0x27'));_0x40137a[_0x4782('0x37')]=_[_0x4782('0x38')](_0x1233ba[_0x4782('0x37')]);_0x40137a[_0x4782('0x39')]=_[_0x4782('0x3a')](_0x40137a[_0x4782('0x36')],_0x40137a[_0x4782('0x37')]);_0x12290e['attributes']=_[_0x4782('0x3a')](_0x40137a[_0x4782('0x36')],qs[_0x4782('0x3b')](_0x1233ba[_0x4782('0x37')][_0x4782('0x3b')]));_0x12290e['attributes']=_0x12290e[_0x4782('0x3c')][_0x4782('0x3d')]?_0x12290e[_0x4782('0x3c')]:_0x40137a[_0x4782('0x36')];if(!_0x1233ba['query'][_0x4782('0x3e')](_0x4782('0x3f'))){_0x12290e[_0x4782('0x1e')]=qs[_0x4782('0x1e')](_0x1233ba['query']['limit']);_0x12290e[_0x4782('0x20')]=qs['offset'](_0x1233ba[_0x4782('0x37')][_0x4782('0x20')]);}_0x12290e[_0x4782('0x40')]=qs[_0x4782('0x41')](_0x1233ba[_0x4782('0x37')][_0x4782('0x41')]);_0x12290e[_0x4782('0x42')]=qs[_0x4782('0x39')](_[_0x4782('0x43')](_0x1233ba['query'],_0x40137a[_0x4782('0x39')]),_0x1c779d);if(_0x1233ba[_0x4782('0x37')][_0x4782('0x44')]){_0x12290e[_0x4782('0x42')]=_['merge'](_0x12290e['where'],{'$or':_['map'](_0x1c779d,function(_0x3312cc){if(_0x3312cc[_0x4782('0x34')]!=='VIRTUAL'){var _0x5b1e25={};_0x5b1e25[_0x3312cc[_0x4782('0x27')]]={'$like':'%'+_0x1233ba[_0x4782('0x37')][_0x4782('0x44')]+'%'};return _0x5b1e25;}})});}_0x12290e=_[_0x4782('0x29')]({},_0x12290e,_0x1233ba[_0x4782('0x45')]);var _0x3b6d0a={'where':_0x12290e['where']};return db[_0x4782('0x46')][_0x4782('0x1f')](_0x3b6d0a)['then'](function(_0xf8b607){_0x5c3d04[_0x4782('0x1f')]=_0xf8b607;if(_0x1233ba[_0x4782('0x37')]['includeAll']){_0x12290e[_0x4782('0x47')]=[{'all':!![]}];}return db[_0x4782('0x46')][_0x4782('0x48')](_0x12290e);})[_0x4782('0x25')](function(_0x3095fc){_0x5c3d04[_0x4782('0x49')]=_0x3095fc;return _0x5c3d04;})[_0x4782('0x25')](respondWithFilteredResult(_0x1240f4,_0x12290e))[_0x4782('0x4a')](handleError(_0x1240f4,null));};exports['show']=function(_0x256db4,_0x560fba){var _0x3c1f6f={'raw':![],'where':{'id':_0x256db4[_0x4782('0x4b')]['id']}},_0x14a0e7={};_0x14a0e7[_0x4782('0x36')]=_[_0x4782('0x38')](db['UserProfileResource']['rawAttributes']);_0x14a0e7[_0x4782('0x37')]=_['keys'](_0x256db4[_0x4782('0x37')]);_0x14a0e7['filters']=_[_0x4782('0x3a')](_0x14a0e7[_0x4782('0x36')],_0x14a0e7['query']);_0x3c1f6f[_0x4782('0x3c')]=_[_0x4782('0x3a')](_0x14a0e7[_0x4782('0x36')],qs[_0x4782('0x3b')](_0x256db4['query']['fields']));_0x3c1f6f[_0x4782('0x3c')]=_0x3c1f6f['attributes'][_0x4782('0x3d')]?_0x3c1f6f[_0x4782('0x3c')]:_0x14a0e7[_0x4782('0x36')];if(_0x256db4['query']['includeAll']){_0x3c1f6f[_0x4782('0x47')]=[{'all':!![]}];}_0x3c1f6f=_['merge']({},_0x3c1f6f,_0x256db4[_0x4782('0x45')]);return db[_0x4782('0x46')][_0x4782('0x4c')](_0x3c1f6f)[_0x4782('0x25')](handleEntityNotFound(_0x560fba,null))[_0x4782('0x25')](respondWithResult(_0x560fba,null))[_0x4782('0x4a')](handleError(_0x560fba,null));};exports[_0x4782('0x4d')]=function(_0x9c3901,_0x474629){return db[_0x4782('0x46')][_0x4782('0x4d')](_0x9c3901['body'],{})[_0x4782('0x25')](respondWithResult(_0x474629,0xc9))[_0x4782('0x4a')](handleError(_0x474629,null));};exports[_0x4782('0x24')]=function(_0x22c5ff,_0x3f998d){if(_0x22c5ff[_0x4782('0x2a')]['id']){delete _0x22c5ff[_0x4782('0x2a')]['id'];}return db['UserProfileResource'][_0x4782('0x4c')]({'where':{'id':_0x22c5ff[_0x4782('0x4b')]['id']}})[_0x4782('0x25')](handleEntityNotFound(_0x3f998d,null))[_0x4782('0x25')](saveUpdates(_0x22c5ff[_0x4782('0x2a')],null))[_0x4782('0x25')](respondWithResult(_0x3f998d,null))[_0x4782('0x4a')](handleError(_0x3f998d,null));};exports[_0x4782('0x4e')]=function(_0x2d5d22,_0x594a42){return db[_0x4782('0x46')][_0x4782('0x4c')]({'where':{'id':_0x2d5d22[_0x4782('0x4b')]['id']}})[_0x4782('0x25')](handleEntityNotFound(_0x594a42,null))[_0x4782('0x25')](removeEntity(_0x594a42,null))[_0x4782('0x4a')](handleError(_0x594a42,null));};exports[_0x4782('0x4f')]=function(_0x1f3fa9,_0x4b303f){return db[_0x4782('0x46')]['describe']()[_0x4782('0x25')](respondWithResult(_0x4b303f,null))[_0x4782('0x4a')](handleError(_0x4b303f,null));}; \ No newline at end of file +var _0x326f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','render','merge','body','message','agent','account','index','map','UserProfileResource','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse'];(function(_0xb64c6e,_0xea4496){var _0x231ce5=function(_0x4dbae5){while(--_0x4dbae5){_0xb64c6e['push'](_0xb64c6e['shift']());}};_0x231ce5(++_0xea4496);}(_0x326f,0xd1));var _0xf326=function(_0x452697,_0x49aa4e){_0x452697=_0x452697-0x0;var _0x4732de=_0x326f[_0x452697];return _0x4732de;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}function getMustacheRender(_0x55ad0f,_0x4a9abf){return Mustache[_0xf326('0x28')](_0x55ad0f,_[_0xf326('0x29')](_0x4a9abf[_0xf326('0x2a')],{'contact':_0x4a9abf['contact'],'message':_0x4a9abf[_0xf326('0x2b')],'agent':_0x4a9abf[_0xf326('0x2c')],'interaction':_0x4a9abf['interaction'],'account':_0x4a9abf[_0xf326('0x2d')]}))||'';}exports[_0xf326('0x2e')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2f')](db[_0xf326('0x30')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x31')],'type':_0x1035ed[_0xf326('0x32')]['key']};});_0x269be9[_0xf326('0x33')]=_[_0xf326('0x2f')](_0x39a1e2,_0xf326('0x26'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x34')]);_0x269be9[_0xf326('0x35')]=_[_0xf326('0x36')](_0x269be9[_0xf326('0x33')],_0x269be9[_0xf326('0x34')]);_0xa80156[_0xf326('0x37')]=_[_0xf326('0x36')](_0x269be9[_0xf326('0x33')],qs['fields'](_0xd77aba[_0xf326('0x34')][_0xf326('0x38')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x37')]['length']?_0xa80156[_0xf326('0x37')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x39')]('nolimit')){_0xa80156[_0xf326('0x1c')]=qs['limit'](_0xd77aba[_0xf326('0x34')][_0xf326('0x1c')]);_0xa80156[_0xf326('0x1a')]=qs['offset'](_0xd77aba[_0xf326('0x34')][_0xf326('0x1a')]);}_0xa80156['order']=qs[_0xf326('0x3a')](_0xd77aba[_0xf326('0x34')][_0xf326('0x3a')]);_0xa80156[_0xf326('0x3b')]=qs['filters'](_[_0xf326('0x3c')](_0xd77aba[_0xf326('0x34')],_0x269be9[_0xf326('0x35')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x34')][_0xf326('0x3d')]){_0xa80156['where']=_[_0xf326('0x29')](_0xa80156[_0xf326('0x3b')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x32')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x26')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3d')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x29')]({},_0xa80156,_0xd77aba[_0xf326('0x3e')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x30')][_0xf326('0x1d')](_0x39611e)[_0xf326('0x24')](function(_0x365627){_0x161143[_0xf326('0x1d')]=_0x365627;if(_0xd77aba[_0xf326('0x34')][_0xf326('0x3f')]){_0xa80156[_0xf326('0x40')]=[{'all':!![]}];}return db[_0xf326('0x30')][_0xf326('0x41')](_0xa80156);})[_0xf326('0x24')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x24')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x42')](handleError(_0x18d110,null));};exports[_0xf326('0x43')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':![],'where':{'id':_0x270288[_0xf326('0x44')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x33')]=_['keys'](db[_0xf326('0x30')][_0xf326('0x45')]);_0x4f4c51[_0xf326('0x34')]=_[_0xf326('0x46')](_0x270288[_0xf326('0x34')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x33')],_0x4f4c51[_0xf326('0x34')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x33')],qs[_0xf326('0x38')](_0x270288[_0xf326('0x34')]['fields']));_0x1a2d0d[_0xf326('0x37')]=_0x1a2d0d[_0xf326('0x37')][_0xf326('0x47')]?_0x1a2d0d[_0xf326('0x37')]:_0x4f4c51[_0xf326('0x33')];if(_0x270288[_0xf326('0x34')][_0xf326('0x3f')]){_0x1a2d0d[_0xf326('0x40')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x29')]({},_0x1a2d0d,_0x270288[_0xf326('0x3e')]);return db[_0xf326('0x30')][_0xf326('0x48')](_0x1a2d0d)[_0xf326('0x24')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x24')](respondWithResult(_0x1dd262,null))[_0xf326('0x42')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x30')][_0xf326('0x49')](_0x199f8b['body'],{})[_0xf326('0x24')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x42')](handleError(_0x1b0e03,null));};exports[_0xf326('0x22')]=function(_0x46fe85,_0x49341c){if(_0x46fe85[_0xf326('0x2a')]['id']){delete _0x46fe85[_0xf326('0x2a')]['id'];}return db[_0xf326('0x30')][_0xf326('0x48')]({'where':{'id':_0x46fe85[_0xf326('0x44')]['id']}})['then'](handleEntityNotFound(_0x49341c,null))['then'](saveUpdates(_0x46fe85[_0xf326('0x2a')],null))[_0xf326('0x24')](respondWithResult(_0x49341c,null))[_0xf326('0x42')](handleError(_0x49341c,null));};exports['destroy']=function(_0x102fba,_0x4650db){return db[_0xf326('0x30')]['find']({'where':{'id':_0x102fba['params']['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x4650db,null))['then'](removeEntity(_0x4650db,null))[_0xf326('0x42')](handleError(_0x4650db,null));};exports['describe']=function(_0x458e5f,_0x7ee57){return db[_0xf326('0x30')][_0xf326('0x4a')]()[_0xf326('0x24')](respondWithResult(_0x7ee57,null))[_0xf326('0x42')](handleError(_0x7ee57,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index ec7b8e9..cad613b 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 _0x3b4a=['user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource'];(function(_0x446010,_0x2a8f75){var _0xae0d0b=function(_0x5baff7){while(--_0x5baff7){_0x446010['push'](_0x446010['shift']());}};_0xae0d0b(++_0x2a8f75);}(_0x3b4a,0x1f2));var _0xa3b4=function(_0x54b62a,_0x4e899e){_0x54b62a=_0x54b62a-0x0;var _0xee6832=_0x3b4a[_0x54b62a];return _0xee6832;};'use strict';var _=require(_0xa3b4('0x0'));var util=require(_0xa3b4('0x1'));var logger=require(_0xa3b4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa3b4('0x3'));var rp=require(_0xa3b4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa3b4('0x5'));var attributes=require(_0xa3b4('0x6'));module[_0xa3b4('0x7')]=function(_0x197f0b,_0x34d6a0){return _0x197f0b['define'](_0xa3b4('0x8'),attributes,{'tableName':_0xa3b4('0x9'),'paranoid':![],'indexes':[{'name':_0xa3b4('0xa'),'fields':[_0xa3b4('0xb'),_0xa3b4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x685e=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','UserProfileResource','resourceId','sectionId','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x685e,0x1a3));var _0xe685=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0x685e[_0x21b359];return _0x57b8e7;};'use strict';var _=require(_0xe685('0x0'));var util=require(_0xe685('0x1'));var logger=require('../../config/logger')(_0xe685('0x2'));var moment=require(_0xe685('0x3'));var BPromise=require(_0xe685('0x4'));var rp=require(_0xe685('0x5'));var fs=require('fs');var path=require(_0xe685('0x6'));var rimraf=require(_0xe685('0x7'));var config=require(_0xe685('0x8'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x4aa03f,_0x35a18a){return _0x4aa03f['define'](_0xe685('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe685('0xa'),_0xe685('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 3622298..7d57968 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 _0x6b65=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x5d9b3d,_0x3ed41c){var _0x5503b5=function(_0x18afe4){while(--_0x18afe4){_0x5d9b3d['push'](_0x5d9b3d['shift']());}};_0x5503b5(++_0x3ed41c);}(_0x6b65,0x157));var _0x56b6=function(_0x206eec,_0x1d4bbf){_0x206eec=_0x206eec-0x0;var _0x2f7e08=_0x6b65[_0x206eec];return _0x2f7e08;};'use strict';var _=require(_0x56b6('0x0'));var util=require(_0x56b6('0x1'));var moment=require(_0x56b6('0x2'));var BPromise=require(_0x56b6('0x3'));var rs=require(_0x56b6('0x4'));var fs=require('fs');var Redis=require(_0x56b6('0x5'));var db=require(_0x56b6('0x6'))['db'];var utils=require(_0x56b6('0x7'));var logger=require(_0x56b6('0x8'))(_0x56b6('0x9'));var config=require(_0x56b6('0xa'));var jayson=require(_0x56b6('0xb'));var client=jayson[_0x56b6('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38e375,_0x2cb330,_0x37ec3f){return new BPromise(function(_0x32daa1,_0x14c891){return client['request'](_0x38e375,_0x37ec3f)[_0x56b6('0xd')](function(_0x405503){logger[_0x56b6('0xe')](_0x56b6('0xf'),_0x2cb330,_0x56b6('0x10'));logger[_0x56b6('0x11')](_0x56b6('0x12'),_0x2cb330,_0x56b6('0x10'),JSON['stringify'](_0x405503));if(_0x405503[_0x56b6('0x13')]){if(_0x405503[_0x56b6('0x13')][_0x56b6('0x14')]===0x1f4){logger[_0x56b6('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x2cb330,_0x405503['error'][_0x56b6('0x15')]);return _0x14c891(_0x405503[_0x56b6('0x13')]['message']);}logger['error'](_0x56b6('0xf'),_0x2cb330,_0x405503[_0x56b6('0x13')]['message']);return _0x32daa1(_0x405503['error'][_0x56b6('0x15')]);}else{logger[_0x56b6('0xe')](_0x56b6('0xf'),_0x2cb330,_0x56b6('0x10'));_0x32daa1(_0x405503[_0x56b6('0x16')][_0x56b6('0x15')]);}})[_0x56b6('0x17')](function(_0x1d9452){logger[_0x56b6('0x13')](_0x56b6('0xf'),_0x2cb330,_0x1d9452);_0x14c891(_0x1d9452);});});} \ No newline at end of file +var _0x4f9f=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x492efa,_0x195202){var _0x2707ff=function(_0xf577bb){while(--_0xf577bb){_0x492efa['push'](_0x492efa['shift']());}};_0x2707ff(++_0x195202);}(_0x4f9f,0x6b));var _0xf4f9=function(_0x4e1d3c,_0x4f9988){_0x4e1d3c=_0x4e1d3c-0x0;var _0x5177b2=_0x4f9f[_0x4e1d3c];return _0x5177b2;};'use strict';var _=require('lodash');var util=require(_0xf4f9('0x0'));var moment=require(_0xf4f9('0x1'));var BPromise=require(_0xf4f9('0x2'));var rs=require(_0xf4f9('0x3'));var fs=require('fs');var Redis=require(_0xf4f9('0x4'));var db=require(_0xf4f9('0x5'))['db'];var utils=require(_0xf4f9('0x6'));var logger=require('../../config/logger')(_0xf4f9('0x7'));var config=require(_0xf4f9('0x8'));var jayson=require(_0xf4f9('0x9'));var client=jayson[_0xf4f9('0xa')][_0xf4f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x197f31,_0xe641e5,_0x489e2e){return new BPromise(function(_0xdc41e7,_0x5ad1d4){return client[_0xf4f9('0xc')](_0x197f31,_0x489e2e)[_0xf4f9('0xd')](function(_0x519a8a){logger[_0xf4f9('0xe')](_0xf4f9('0xf'),_0xe641e5,'request\x20sent');logger[_0xf4f9('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0xe641e5,_0xf4f9('0x11'),JSON['stringify'](_0x519a8a));if(_0x519a8a[_0xf4f9('0x12')]){if(_0x519a8a[_0xf4f9('0x12')]['code']===0x1f4){logger['error'](_0xf4f9('0xf'),_0xe641e5,_0x519a8a['error'][_0xf4f9('0x13')]);return _0x5ad1d4(_0x519a8a[_0xf4f9('0x12')]['message']);}logger[_0xf4f9('0x12')]('UserProfileResource,\x20%s,\x20%s',_0xe641e5,_0x519a8a['error'][_0xf4f9('0x13')]);return _0xdc41e7(_0x519a8a[_0xf4f9('0x12')][_0xf4f9('0x13')]);}else{logger[_0xf4f9('0xe')](_0xf4f9('0xf'),_0xe641e5,_0xf4f9('0x11'));_0xdc41e7(_0x519a8a['result'][_0xf4f9('0x13')]);}})[_0xf4f9('0x14')](function(_0x4a047c){logger[_0xf4f9('0x12')](_0xf4f9('0xf'),_0xe641e5,_0x4a047c);_0x5ad1d4(_0x4a047c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e216147..e6f150e 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 _0xa19c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x42fa55,_0x227f14){var _0x31a76f=function(_0x6f5f21){while(--_0x6f5f21){_0x42fa55['push'](_0x42fa55['shift']());}};_0x31a76f(++_0x227f14);}(_0xa19c,0x120));var _0xca19=function(_0x5d1185,_0x124b58){_0x5d1185=_0x5d1185-0x0;var _0x27212b=_0xa19c[_0x5d1185];return _0x27212b;};'use strict';var multer=require('multer');var util=require(_0xca19('0x0'));var path=require(_0xca19('0x1'));var timeout=require(_0xca19('0x2'));var express=require(_0xca19('0x3'));var router=express[_0xca19('0x4')]();var fs_extra=require(_0xca19('0x5'));var auth=require(_0xca19('0x6'));var interaction=require(_0xca19('0x7'));var config=require(_0xca19('0x8'));var controller=require(_0xca19('0x9'));router[_0xca19('0xa')]('/',auth[_0xca19('0xb')](),controller[_0xca19('0xc')]);router[_0xca19('0xa')](_0xca19('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xca19('0xa')](_0xca19('0xe'),auth[_0xca19('0xb')](),controller[_0xca19('0xf')]);router['post']('/',auth[_0xca19('0xb')](),controller[_0xca19('0x10')]);router[_0xca19('0x11')](_0xca19('0xe'),auth['isAuthenticated'](),controller[_0xca19('0x12')]);router['delete']('/:id',auth[_0xca19('0xb')](),controller[_0xca19('0x13')]);module[_0xca19('0x14')]=router; \ No newline at end of file +var _0x3b71=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','path','Router','fs-extra'];(function(_0x419737,_0x43b581){var _0x229ee0=function(_0x187ff2){while(--_0x187ff2){_0x419737['push'](_0x419737['shift']());}};_0x229ee0(++_0x43b581);}(_0x3b71,0x119));var _0x13b7=function(_0x5b419e,_0x1494f0){_0x5b419e=_0x5b419e-0x0;var _0x98f62f=_0x3b71[_0x5b419e];return _0x98f62f;};'use strict';var multer=require(_0x13b7('0x0'));var util=require('util');var path=require(_0x13b7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13b7('0x2')]();var fs_extra=require(_0x13b7('0x3'));var auth=require(_0x13b7('0x4'));var interaction=require(_0x13b7('0x5'));var config=require(_0x13b7('0x6'));var controller=require(_0x13b7('0x7'));router[_0x13b7('0x8')]('/',auth[_0x13b7('0x9')](),controller['index']);router[_0x13b7('0x8')](_0x13b7('0xa'),auth['isAuthenticated'](),controller[_0x13b7('0xb')]);router[_0x13b7('0x8')](_0x13b7('0xc'),auth[_0x13b7('0x9')](),controller[_0x13b7('0xd')]);router[_0x13b7('0xe')]('/',auth[_0x13b7('0x9')](),controller['create']);router[_0x13b7('0xf')]('/:id',auth[_0x13b7('0x9')](),controller[_0x13b7('0x10')]);router[_0x13b7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x13b7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 461e774..01dcd35 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 _0xac55=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING'];(function(_0x3f2c44,_0x320482){var _0x26d1b1=function(_0x475ade){while(--_0x475ade){_0x3f2c44['push'](_0x3f2c44['shift']());}};_0x26d1b1(++_0x320482);}(_0xac55,0x1c8));var _0x5ac5=function(_0x4b40c2,_0x5850c4){_0x4b40c2=_0x4b40c2-0x0;var _0x454d29=_0xac55[_0x4b40c2];return _0x454d29;};'use strict';var Sequelize=require(_0x5ac5('0x0'));module[_0x5ac5('0x1')]={'name':{'type':Sequelize[_0x5ac5('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x5ac5('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x5ac5('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5ac5('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5ac5('0x2')],'set':function(_0x1cdfec){this[_0x5ac5('0x4')](_0x5ac5('0x5'),_0x1cdfec?_0x1cdfec[_0x5ac5('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x5ac5('0x7')](_0x5ac5('0x5'))[_0x5ac5('0x8')](''):[];}}}; \ No newline at end of file +var _0xfd3a=['crudPermissions','getDataValue','STRING','BOOLEAN','setDataValue'];(function(_0x5ebb42,_0x3f7cdc){var _0x15ee26=function(_0x355ba1){while(--_0x355ba1){_0x5ebb42['push'](_0x5ebb42['shift']());}};_0x15ee26(++_0x3f7cdc);}(_0xfd3a,0xb1));var _0xafd3=function(_0x36edad,_0x493944){_0x36edad=_0x36edad-0x0;var _0x48f7bf=_0xfd3a[_0x36edad];return _0x48f7bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xafd3('0x0')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xafd3('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xafd3('0x1')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x7be097){this[_0xafd3('0x2')](_0xafd3('0x3'),_0x7be097?_0x7be097['join'](''):[]);},'get':function(){return this[_0xafd3('0x4')](_0xafd3('0x3'))?this[_0xafd3('0x4')](_0xafd3('0x3'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e2a5bb3..719e098 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 _0x15db=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','destroy','error','stack','name','send','render','merge','body','contact','message','account','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','options','include','then','catch','show','params','includeAll','find','create','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5d26d2,_0xf95b67){var _0x1bf48e=function(_0x913807){while(--_0x913807){_0x5d26d2['push'](_0x5d26d2['shift']());}};_0x1bf48e(++_0xf95b67);}(_0x15db,0x87));var _0xb15d=function(_0x3d0fa1,_0xd57cd6){_0x3d0fa1=_0x3d0fa1-0x0;var _0x4660bc=_0x15db[_0x3d0fa1];return _0x4660bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb15d('0x0'));var zipdir=require(_0xb15d('0x1'));var jsonpatch=require(_0xb15d('0x2'));var rp=require(_0xb15d('0x3'));var moment=require(_0xb15d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb15d('0x5'));var util=require(_0xb15d('0x6'));var path=require(_0xb15d('0x7'));var sox=require('sox');var csv=require(_0xb15d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb15d('0x9'));var _=require('lodash');var squel=require(_0xb15d('0xa'));var crypto=require(_0xb15d('0xb'));var jsforce=require(_0xb15d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb15d('0x8'));var querystring=require(_0xb15d('0xd'));var Papa=require(_0xb15d('0xe'));var Redis=require('ioredis');var authService=require(_0xb15d('0xf'));var qs=require(_0xb15d('0x10'));var as=require(_0xb15d('0x11'));var hardwareService=require(_0xb15d('0x12'));var logger=require(_0xb15d('0x13'))(_0xb15d('0x14'));var utils=require(_0xb15d('0x15'));var config=require(_0xb15d('0x16'));var licenseUtil=require(_0xb15d('0x17'));var db=require(_0xb15d('0x18'))['db'];function respondWithStatusCode(_0x3433c9,_0x5ba730){_0x5ba730=_0x5ba730||0xcc;return function(_0x1a6863){if(_0x1a6863){return _0x3433c9[_0xb15d('0x19')](_0x5ba730);}return _0x3433c9[_0xb15d('0x1a')](_0x5ba730)[_0xb15d('0x1b')]();};}function respondWithResult(_0x3f4aff,_0x1c1f63){_0x1c1f63=_0x1c1f63||0xc8;return function(_0x5ef8cb){if(_0x5ef8cb){return _0x3f4aff[_0xb15d('0x1a')](_0x1c1f63)['json'](_0x5ef8cb);}};}function respondWithFilteredResult(_0x22677c,_0x423a6a){return function(_0x7f12f7){if(_0x7f12f7){var _0x4d001b=typeof _0x423a6a['offset']===_0xb15d('0x1c')&&typeof _0x423a6a[_0xb15d('0x1d')]===_0xb15d('0x1c');var _0x5ca18a=_0x7f12f7[_0xb15d('0x1e')];var _0x59d101=_0x4d001b?0x0:_0x423a6a[_0xb15d('0x1f')];var _0x1540fd=_0x4d001b?_0x7f12f7['count']:_0x423a6a[_0xb15d('0x1f')]+_0x423a6a['limit'];var _0x5e498b;if(_0x1540fd>=_0x5ca18a){_0x1540fd=_0x5ca18a;_0x5e498b=0xc8;}else{_0x5e498b=0xce;}_0x22677c[_0xb15d('0x1a')](_0x5e498b);return _0x22677c[_0xb15d('0x20')](_0xb15d('0x21'),_0x59d101+'-'+_0x1540fd+'/'+_0x5ca18a)[_0xb15d('0x22')](_0x7f12f7);}return null;};}function patchUpdates(_0x44d5f7){return function(_0x1e6ead){try{jsonpatch['apply'](_0x1e6ead,_0x44d5f7,!![]);}catch(_0x5434b7){return BPromise[_0xb15d('0x23')](_0x5434b7);}return _0x1e6ead['save']();};}function saveUpdates(_0xaf4b75,_0x4070fb){return function(_0x38d2e9){if(_0x38d2e9){return _0x38d2e9[_0xb15d('0x24')](_0xaf4b75)['then'](function(_0x4d5959){return _0x4d5959;});}return null;};}function removeEntity(_0x3d5cae,_0xd6c61e){return function(_0x300b1f){if(_0x300b1f){return _0x300b1f[_0xb15d('0x25')]()['then'](function(){_0x3d5cae[_0xb15d('0x1a')](0xcc)[_0xb15d('0x1b')]();});}};}function handleEntityNotFound(_0x1107da,_0x2b9564){return function(_0x3d8d96){if(!_0x3d8d96){_0x1107da['sendStatus'](0x194);}return _0x3d8d96;};}function handleError(_0x40d7cb,_0x175b81){_0x175b81=_0x175b81||0x1f4;return function(_0x2587c1){logger[_0xb15d('0x26')](_0x2587c1[_0xb15d('0x27')]);if(_0x2587c1[_0xb15d('0x28')]){delete _0x2587c1[_0xb15d('0x28')];}_0x40d7cb['status'](_0x175b81)[_0xb15d('0x29')](_0x2587c1);};}function getMustacheRender(_0x42f134,_0x43eb65){return Mustache[_0xb15d('0x2a')](_0x42f134,_[_0xb15d('0x2b')](_0x43eb65[_0xb15d('0x2c')],{'contact':_0x43eb65[_0xb15d('0x2d')],'message':_0x43eb65[_0xb15d('0x2e')],'agent':_0x43eb65['agent'],'interaction':_0x43eb65['interaction'],'account':_0x43eb65[_0xb15d('0x2f')]}))||'';}exports[_0xb15d('0x30')]=function(_0xf615ee,_0x3d7d34){var _0xf4ebe5={},_0x2a8258={},_0x5c8ddc={'count':0x0,'rows':[]};var _0x145e31=_[_0xb15d('0x31')](db[_0xb15d('0x32')][_0xb15d('0x33')],function(_0x29f0fb){return{'name':_0x29f0fb[_0xb15d('0x34')],'type':_0x29f0fb[_0xb15d('0x35')][_0xb15d('0x36')]};});_0x2a8258[_0xb15d('0x37')]=_['map'](_0x145e31,_0xb15d('0x28'));_0x2a8258[_0xb15d('0x38')]=_[_0xb15d('0x39')](_0xf615ee[_0xb15d('0x38')]);_0x2a8258[_0xb15d('0x3a')]=_[_0xb15d('0x3b')](_0x2a8258['model'],_0x2a8258[_0xb15d('0x38')]);_0xf4ebe5[_0xb15d('0x3c')]=_[_0xb15d('0x3b')](_0x2a8258[_0xb15d('0x37')],qs[_0xb15d('0x3d')](_0xf615ee[_0xb15d('0x38')][_0xb15d('0x3d')]));_0xf4ebe5[_0xb15d('0x3c')]=_0xf4ebe5['attributes'][_0xb15d('0x3e')]?_0xf4ebe5[_0xb15d('0x3c')]:_0x2a8258[_0xb15d('0x37')];if(!_0xf615ee[_0xb15d('0x38')][_0xb15d('0x3f')](_0xb15d('0x40'))){_0xf4ebe5[_0xb15d('0x1d')]=qs[_0xb15d('0x1d')](_0xf615ee[_0xb15d('0x38')][_0xb15d('0x1d')]);_0xf4ebe5[_0xb15d('0x1f')]=qs['offset'](_0xf615ee[_0xb15d('0x38')][_0xb15d('0x1f')]);}_0xf4ebe5['order']=qs[_0xb15d('0x41')](_0xf615ee[_0xb15d('0x38')][_0xb15d('0x41')]);_0xf4ebe5['where']=qs[_0xb15d('0x3a')](_['pick'](_0xf615ee['query'],_0x2a8258[_0xb15d('0x3a')]),_0x145e31);if(_0xf615ee[_0xb15d('0x38')][_0xb15d('0x42')]){_0xf4ebe5[_0xb15d('0x43')]=_[_0xb15d('0x2b')](_0xf4ebe5['where'],{'$or':_[_0xb15d('0x31')](_0x145e31,function(_0x334607){if(_0x334607[_0xb15d('0x35')]!=='VIRTUAL'){var _0x51cf67={};_0x51cf67[_0x334607[_0xb15d('0x28')]]={'$like':'%'+_0xf615ee[_0xb15d('0x38')]['filter']+'%'};return _0x51cf67;}})});}_0xf4ebe5=_[_0xb15d('0x2b')]({},_0xf4ebe5,_0xf615ee[_0xb15d('0x44')]);var _0xf422f2={'where':_0xf4ebe5[_0xb15d('0x43')]};return db[_0xb15d('0x32')][_0xb15d('0x1e')](_0xf422f2)['then'](function(_0x2f05b9){_0x5c8ddc[_0xb15d('0x1e')]=_0x2f05b9;if(_0xf615ee[_0xb15d('0x38')]['includeAll']){_0xf4ebe5[_0xb15d('0x45')]=[{'all':!![]}];}return db[_0xb15d('0x32')]['findAll'](_0xf4ebe5);})[_0xb15d('0x46')](function(_0x204067){_0x5c8ddc['rows']=_0x204067;return _0x5c8ddc;})[_0xb15d('0x46')](respondWithFilteredResult(_0x3d7d34,_0xf4ebe5))[_0xb15d('0x47')](handleError(_0x3d7d34,null));};exports[_0xb15d('0x48')]=function(_0x550688,_0x332d39){var _0x51fa27={'raw':![],'where':{'id':_0x550688[_0xb15d('0x49')]['id']}},_0x3bc7d2={};_0x3bc7d2[_0xb15d('0x37')]=_[_0xb15d('0x39')](db[_0xb15d('0x32')][_0xb15d('0x33')]);_0x3bc7d2[_0xb15d('0x38')]=_[_0xb15d('0x39')](_0x550688[_0xb15d('0x38')]);_0x3bc7d2[_0xb15d('0x3a')]=_[_0xb15d('0x3b')](_0x3bc7d2[_0xb15d('0x37')],_0x3bc7d2[_0xb15d('0x38')]);_0x51fa27[_0xb15d('0x3c')]=_['intersection'](_0x3bc7d2['model'],qs[_0xb15d('0x3d')](_0x550688[_0xb15d('0x38')][_0xb15d('0x3d')]));_0x51fa27['attributes']=_0x51fa27[_0xb15d('0x3c')][_0xb15d('0x3e')]?_0x51fa27[_0xb15d('0x3c')]:_0x3bc7d2[_0xb15d('0x37')];if(_0x550688['query'][_0xb15d('0x4a')]){_0x51fa27[_0xb15d('0x45')]=[{'all':!![]}];}_0x51fa27=_[_0xb15d('0x2b')]({},_0x51fa27,_0x550688[_0xb15d('0x44')]);return db['UserProfileSection'][_0xb15d('0x4b')](_0x51fa27)[_0xb15d('0x46')](handleEntityNotFound(_0x332d39,null))['then'](respondWithResult(_0x332d39,null))['catch'](handleError(_0x332d39,null));};exports[_0xb15d('0x4c')]=function(_0x214bfd,_0x4da6db){return db['UserProfileSection']['create'](_0x214bfd[_0xb15d('0x2c')],{})[_0xb15d('0x46')](respondWithResult(_0x4da6db,0xc9))[_0xb15d('0x47')](handleError(_0x4da6db,null));};exports[_0xb15d('0x24')]=function(_0xa33393,_0x46b602){if(_0xa33393[_0xb15d('0x2c')]['id']){delete _0xa33393[_0xb15d('0x2c')]['id'];}return db[_0xb15d('0x32')][_0xb15d('0x4b')]({'where':{'id':_0xa33393['params']['id']}})[_0xb15d('0x46')](handleEntityNotFound(_0x46b602,null))['then'](saveUpdates(_0xa33393[_0xb15d('0x2c')],null))['then'](respondWithResult(_0x46b602,null))[_0xb15d('0x47')](handleError(_0x46b602,null));};exports[_0xb15d('0x25')]=function(_0x38799e,_0x4feac8){return db[_0xb15d('0x32')]['find']({'where':{'id':_0x38799e[_0xb15d('0x49')]['id']}})[_0xb15d('0x46')](handleEntityNotFound(_0x4feac8,null))[_0xb15d('0x46')](removeEntity(_0x4feac8,null))['catch'](handleError(_0x4feac8,null));};exports[_0xb15d('0x4d')]=function(_0xb5af28,_0x5cc6c6){return db[_0xb15d('0x32')][_0xb15d('0x4d')]()[_0xb15d('0x46')](respondWithResult(_0x5cc6c6,null))[_0xb15d('0x47')](handleError(_0x5cc6c6,null));}; \ No newline at end of file +var _0x2504=['Content-Range','apply','save','update','then','destroy','stack','name','send','merge','body','contact','message','agent','interaction','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','UserProfileSection','include','findAll','catch','params','includeAll','options','create','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x50e51a,_0x39e949){var _0xe02402=function(_0xbc177a){while(--_0xbc177a){_0x50e51a['push'](_0x50e51a['shift']());}};_0xe02402(++_0x39e949);}(_0x2504,0x7b));var _0x4250=function(_0x28b488,_0x3cdd76){_0x28b488=_0x28b488-0x0;var _0x28cde9=_0x2504[_0x28b488];return _0x28cde9;};'use strict';var emlformat=require(_0x4250('0x0'));var rimraf=require(_0x4250('0x1'));var zipdir=require(_0x4250('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4250('0x3'));var moment=require(_0x4250('0x4'));var BPromise=require(_0x4250('0x5'));var Mustache=require('mustache');var util=require(_0x4250('0x6'));var path=require(_0x4250('0x7'));var sox=require('sox');var csv=require(_0x4250('0x8'));var ejs=require(_0x4250('0x9'));var fs=require('fs');var fs_extra=require(_0x4250('0xa'));var _=require(_0x4250('0xb'));var squel=require(_0x4250('0xc'));var crypto=require(_0x4250('0xd'));var jsforce=require(_0x4250('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4250('0x8'));var querystring=require(_0x4250('0xf'));var Papa=require('papaparse');var Redis=require(_0x4250('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4250('0x11'));var hardwareService=require(_0x4250('0x12'));var logger=require(_0x4250('0x13'))(_0x4250('0x14'));var utils=require(_0x4250('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4250('0x16'));var db=require(_0x4250('0x17'))['db'];function respondWithStatusCode(_0x4c305b,_0x4afbdd){_0x4afbdd=_0x4afbdd||0xcc;return function(_0x19f8c4){if(_0x19f8c4){return _0x4c305b[_0x4250('0x18')](_0x4afbdd);}return _0x4c305b[_0x4250('0x19')](_0x4afbdd)[_0x4250('0x1a')]();};}function respondWithResult(_0x234845,_0x25da4e){_0x25da4e=_0x25da4e||0xc8;return function(_0xe69442){if(_0xe69442){return _0x234845[_0x4250('0x19')](_0x25da4e)['json'](_0xe69442);}};}function respondWithFilteredResult(_0x9133d8,_0x3a707a){return function(_0x46a121){if(_0x46a121){var _0x3456ab=typeof _0x3a707a[_0x4250('0x1b')]===_0x4250('0x1c')&&typeof _0x3a707a[_0x4250('0x1d')]===_0x4250('0x1c');var _0x4cab9f=_0x46a121[_0x4250('0x1e')];var _0x5d6505=_0x3456ab?0x0:_0x3a707a[_0x4250('0x1b')];var _0x18ad7f=_0x3456ab?_0x46a121[_0x4250('0x1e')]:_0x3a707a[_0x4250('0x1b')]+_0x3a707a[_0x4250('0x1d')];var _0x204bb0;if(_0x18ad7f>=_0x4cab9f){_0x18ad7f=_0x4cab9f;_0x204bb0=0xc8;}else{_0x204bb0=0xce;}_0x9133d8[_0x4250('0x19')](_0x204bb0);return _0x9133d8['set'](_0x4250('0x1f'),_0x5d6505+'-'+_0x18ad7f+'/'+_0x4cab9f)['json'](_0x46a121);}return null;};}function patchUpdates(_0x357d13){return function(_0x3d50e3){try{jsonpatch[_0x4250('0x20')](_0x3d50e3,_0x357d13,!![]);}catch(_0x3f9555){return BPromise['reject'](_0x3f9555);}return _0x3d50e3[_0x4250('0x21')]();};}function saveUpdates(_0x1f7877,_0x4dc1f8){return function(_0x3d8634){if(_0x3d8634){return _0x3d8634[_0x4250('0x22')](_0x1f7877)[_0x4250('0x23')](function(_0x367389){return _0x367389;});}return null;};}function removeEntity(_0x6f0667,_0x3c5d64){return function(_0x272f4a){if(_0x272f4a){return _0x272f4a[_0x4250('0x24')]()[_0x4250('0x23')](function(){_0x6f0667['status'](0xcc)[_0x4250('0x1a')]();});}};}function handleEntityNotFound(_0x3d72ea,_0x44c2e9){return function(_0x18f77f){if(!_0x18f77f){_0x3d72ea[_0x4250('0x18')](0x194);}return _0x18f77f;};}function handleError(_0x360a85,_0x3822d9){_0x3822d9=_0x3822d9||0x1f4;return function(_0x44ba21){logger['error'](_0x44ba21[_0x4250('0x25')]);if(_0x44ba21['name']){delete _0x44ba21[_0x4250('0x26')];}_0x360a85['status'](_0x3822d9)[_0x4250('0x27')](_0x44ba21);};}function getMustacheRender(_0x1318ca,_0x31b045){return Mustache['render'](_0x1318ca,_[_0x4250('0x28')](_0x31b045[_0x4250('0x29')],{'contact':_0x31b045[_0x4250('0x2a')],'message':_0x31b045[_0x4250('0x2b')],'agent':_0x31b045[_0x4250('0x2c')],'interaction':_0x31b045[_0x4250('0x2d')],'account':_0x31b045['account']}))||'';}exports[_0x4250('0x2e')]=function(_0x40ac1e,_0x6dcca6){var _0x1edb79={},_0x514d9d={},_0x525d55={'count':0x0,'rows':[]};var _0x33ae14=_[_0x4250('0x2f')](db['UserProfileSection'][_0x4250('0x30')],function(_0x134e97){return{'name':_0x134e97[_0x4250('0x31')],'type':_0x134e97[_0x4250('0x32')][_0x4250('0x33')]};});_0x514d9d['model']=_[_0x4250('0x2f')](_0x33ae14,'name');_0x514d9d[_0x4250('0x34')]=_['keys'](_0x40ac1e[_0x4250('0x34')]);_0x514d9d[_0x4250('0x35')]=_[_0x4250('0x36')](_0x514d9d['model'],_0x514d9d['query']);_0x1edb79[_0x4250('0x37')]=_[_0x4250('0x36')](_0x514d9d[_0x4250('0x38')],qs[_0x4250('0x39')](_0x40ac1e[_0x4250('0x34')][_0x4250('0x39')]));_0x1edb79['attributes']=_0x1edb79['attributes'][_0x4250('0x3a')]?_0x1edb79['attributes']:_0x514d9d[_0x4250('0x38')];if(!_0x40ac1e['query'][_0x4250('0x3b')](_0x4250('0x3c'))){_0x1edb79[_0x4250('0x1d')]=qs[_0x4250('0x1d')](_0x40ac1e[_0x4250('0x34')][_0x4250('0x1d')]);_0x1edb79[_0x4250('0x1b')]=qs['offset'](_0x40ac1e['query'][_0x4250('0x1b')]);}_0x1edb79[_0x4250('0x3d')]=qs[_0x4250('0x3e')](_0x40ac1e[_0x4250('0x34')][_0x4250('0x3e')]);_0x1edb79[_0x4250('0x3f')]=qs['filters'](_[_0x4250('0x40')](_0x40ac1e[_0x4250('0x34')],_0x514d9d['filters']),_0x33ae14);if(_0x40ac1e[_0x4250('0x34')][_0x4250('0x41')]){_0x1edb79['where']=_[_0x4250('0x28')](_0x1edb79[_0x4250('0x3f')],{'$or':_[_0x4250('0x2f')](_0x33ae14,function(_0x14497d){if(_0x14497d['type']!==_0x4250('0x42')){var _0x2667f2={};_0x2667f2[_0x14497d[_0x4250('0x26')]]={'$like':'%'+_0x40ac1e['query'][_0x4250('0x41')]+'%'};return _0x2667f2;}})});}_0x1edb79=_[_0x4250('0x28')]({},_0x1edb79,_0x40ac1e['options']);var _0x38f56a={'where':_0x1edb79[_0x4250('0x3f')]};return db[_0x4250('0x43')][_0x4250('0x1e')](_0x38f56a)[_0x4250('0x23')](function(_0x585e04){_0x525d55['count']=_0x585e04;if(_0x40ac1e[_0x4250('0x34')]['includeAll']){_0x1edb79[_0x4250('0x44')]=[{'all':!![]}];}return db[_0x4250('0x43')][_0x4250('0x45')](_0x1edb79);})['then'](function(_0x201c75){_0x525d55['rows']=_0x201c75;return _0x525d55;})[_0x4250('0x23')](respondWithFilteredResult(_0x6dcca6,_0x1edb79))[_0x4250('0x46')](handleError(_0x6dcca6,null));};exports['show']=function(_0x164b7c,_0x8376b){var _0x1f83c2={'raw':![],'where':{'id':_0x164b7c[_0x4250('0x47')]['id']}},_0x21091d={};_0x21091d['model']=_['keys'](db[_0x4250('0x43')][_0x4250('0x30')]);_0x21091d[_0x4250('0x34')]=_['keys'](_0x164b7c['query']);_0x21091d[_0x4250('0x35')]=_[_0x4250('0x36')](_0x21091d[_0x4250('0x38')],_0x21091d[_0x4250('0x34')]);_0x1f83c2[_0x4250('0x37')]=_[_0x4250('0x36')](_0x21091d[_0x4250('0x38')],qs[_0x4250('0x39')](_0x164b7c[_0x4250('0x34')][_0x4250('0x39')]));_0x1f83c2[_0x4250('0x37')]=_0x1f83c2[_0x4250('0x37')][_0x4250('0x3a')]?_0x1f83c2[_0x4250('0x37')]:_0x21091d[_0x4250('0x38')];if(_0x164b7c['query'][_0x4250('0x48')]){_0x1f83c2[_0x4250('0x44')]=[{'all':!![]}];}_0x1f83c2=_[_0x4250('0x28')]({},_0x1f83c2,_0x164b7c[_0x4250('0x49')]);return db[_0x4250('0x43')]['find'](_0x1f83c2)[_0x4250('0x23')](handleEntityNotFound(_0x8376b,null))['then'](respondWithResult(_0x8376b,null))[_0x4250('0x46')](handleError(_0x8376b,null));};exports['create']=function(_0x4e6fba,_0x38b56d){return db[_0x4250('0x43')][_0x4250('0x4a')](_0x4e6fba[_0x4250('0x29')],{})[_0x4250('0x23')](respondWithResult(_0x38b56d,0xc9))[_0x4250('0x46')](handleError(_0x38b56d,null));};exports[_0x4250('0x22')]=function(_0xb66c90,_0x4c7bd9){if(_0xb66c90[_0x4250('0x29')]['id']){delete _0xb66c90['body']['id'];}return db[_0x4250('0x43')][_0x4250('0x4b')]({'where':{'id':_0xb66c90[_0x4250('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c7bd9,null))[_0x4250('0x23')](saveUpdates(_0xb66c90[_0x4250('0x29')],null))[_0x4250('0x23')](respondWithResult(_0x4c7bd9,null))[_0x4250('0x46')](handleError(_0x4c7bd9,null));};exports[_0x4250('0x24')]=function(_0x26da97,_0x515421){return db[_0x4250('0x43')][_0x4250('0x4b')]({'where':{'id':_0x26da97[_0x4250('0x47')]['id']}})[_0x4250('0x23')](handleEntityNotFound(_0x515421,null))[_0x4250('0x23')](removeEntity(_0x515421,null))[_0x4250('0x46')](handleError(_0x515421,null));};exports[_0x4250('0x4c')]=function(_0xd68429,_0x7ad4b4){return db[_0x4250('0x43')]['describe']()['then'](respondWithResult(_0x7ad4b4,null))[_0x4250('0x46')](handleError(_0x7ad4b4,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2c1cc37..9351866 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 _0xa45a=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x150709,_0x2bbcaf){var _0x32a787=function(_0x26f722){while(--_0x26f722){_0x150709['push'](_0x150709['shift']());}};_0x32a787(++_0x2bbcaf);}(_0xa45a,0xd0));var _0xaa45=function(_0x2343ea,_0x54a328){_0x2343ea=_0x2343ea-0x0;var _0x50f857=_0xa45a[_0x2343ea];return _0x50f857;};'use strict';var _=require('lodash');var util=require(_0xaa45('0x0'));var logger=require(_0xaa45('0x1'))('api');var moment=require(_0xaa45('0x2'));var BPromise=require('bluebird');var rp=require(_0xaa45('0x3'));var fs=require('fs');var path=require(_0xaa45('0x4'));var rimraf=require(_0xaa45('0x5'));var config=require(_0xaa45('0x6'));var attributes=require('./userProfileSection.attributes');module[_0xaa45('0x7')]=function(_0x1d7873,_0x1d0966){return _0x1d7873['define']('UserProfileSection',attributes,{'tableName':_0xaa45('0x8'),'paranoid':![],'indexes':[{'name':_0xaa45('0x9'),'fields':[_0xaa45('0xa'),_0xaa45('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f20=['request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x9fe288,_0x16b13e){var _0x4bf61b=function(_0x60c47f){while(--_0x60c47f){_0x9fe288['push'](_0x9fe288['shift']());}};_0x4bf61b(++_0x16b13e);}(_0x0f20,0x19a));var _0x00f2=function(_0x414312,_0x170840){_0x414312=_0x414312-0x0;var _0x49f3ec=_0x0f20[_0x414312];return _0x49f3ec;};'use strict';var _=require(_0x00f2('0x0'));var util=require(_0x00f2('0x1'));var logger=require(_0x00f2('0x2'))(_0x00f2('0x3'));var moment=require(_0x00f2('0x4'));var BPromise=require(_0x00f2('0x5'));var rp=require(_0x00f2('0x6'));var fs=require('fs');var path=require(_0x00f2('0x7'));var rimraf=require(_0x00f2('0x8'));var config=require(_0x00f2('0x9'));var attributes=require(_0x00f2('0xa'));module[_0x00f2('0xb')]=function(_0x207ccb,_0x1879d1){return _0x207ccb['define'](_0x00f2('0xc'),attributes,{'tableName':_0x00f2('0xd'),'paranoid':![],'indexes':[{'name':_0x00f2('0xe'),'fields':['sectionId',_0x00f2('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index a7e42b7..e1d42da 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 _0xc985=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','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','randomstring','ioredis','../../mysqldb'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc985,0x1ce));var _0x5c98=function(_0x4b2fe8,_0x1f93d3){_0x4b2fe8=_0x4b2fe8-0x0;var _0x168361=_0xc985[_0x4b2fe8];return _0x168361;};'use strict';var _=require(_0x5c98('0x0'));var util=require('util');var moment=require(_0x5c98('0x1'));var BPromise=require(_0x5c98('0x2'));var rs=require(_0x5c98('0x3'));var fs=require('fs');var Redis=require(_0x5c98('0x4'));var db=require(_0x5c98('0x5'))['db'];var utils=require(_0x5c98('0x6'));var logger=require(_0x5c98('0x7'))(_0x5c98('0x8'));var config=require(_0x5c98('0x9'));var jayson=require(_0x5c98('0xa'));var client=jayson[_0x5c98('0xb')][_0x5c98('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39fb0a,_0x4986bc,_0x5a8f32){return new BPromise(function(_0x273a0f,_0x32fe72){return client[_0x5c98('0xd')](_0x39fb0a,_0x5a8f32)[_0x5c98('0xe')](function(_0xfa4713){logger[_0x5c98('0xf')](_0x5c98('0x10'),_0x4986bc,_0x5c98('0x11'));logger[_0x5c98('0x12')](_0x5c98('0x13'),_0x4986bc,_0x5c98('0x11'),JSON[_0x5c98('0x14')](_0xfa4713));if(_0xfa4713[_0x5c98('0x15')]){if(_0xfa4713[_0x5c98('0x15')][_0x5c98('0x16')]===0x1f4){logger[_0x5c98('0x15')](_0x5c98('0x10'),_0x4986bc,_0xfa4713['error']['message']);return _0x32fe72(_0xfa4713[_0x5c98('0x15')]['message']);}logger['error'](_0x5c98('0x10'),_0x4986bc,_0xfa4713[_0x5c98('0x15')][_0x5c98('0x17')]);return _0x273a0f(_0xfa4713['error'][_0x5c98('0x17')]);}else{logger[_0x5c98('0xf')](_0x5c98('0x10'),_0x4986bc,_0x5c98('0x11'));_0x273a0f(_0xfa4713[_0x5c98('0x18')][_0x5c98('0x17')]);}})[_0x5c98('0x19')](function(_0x33aa95){logger[_0x5c98('0x15')](_0x5c98('0x10'),_0x4986bc,_0x33aa95);_0x32fe72(_0x33aa95);});});} \ No newline at end of file +var _0x98de=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','randomstring','ioredis'];(function(_0x5ddf09,_0xb6cff3){var _0xb74006=function(_0x4f3ad8){while(--_0x4f3ad8){_0x5ddf09['push'](_0x5ddf09['shift']());}};_0xb74006(++_0xb6cff3);}(_0x98de,0xce));var _0xe98d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x98de[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xe98d('0x0'));var moment=require(_0xe98d('0x1'));var BPromise=require('bluebird');var rs=require(_0xe98d('0x2'));var fs=require('fs');var Redis=require(_0xe98d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe98d('0x4'));var logger=require(_0xe98d('0x5'))(_0xe98d('0x6'));var config=require(_0xe98d('0x7'));var jayson=require(_0xe98d('0x8'));var client=jayson[_0xe98d('0x9')][_0xe98d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x255a6f,_0x1fc723,_0x528fd4){return new BPromise(function(_0x44dbfe,_0x41cede){return client[_0xe98d('0xb')](_0x255a6f,_0x528fd4)['then'](function(_0x5f5229){logger['info'](_0xe98d('0xc'),_0x1fc723,'request\x20sent');logger[_0xe98d('0xd')](_0xe98d('0xe'),_0x1fc723,_0xe98d('0xf'),JSON[_0xe98d('0x10')](_0x5f5229));if(_0x5f5229['error']){if(_0x5f5229[_0xe98d('0x11')][_0xe98d('0x12')]===0x1f4){logger[_0xe98d('0x11')](_0xe98d('0xc'),_0x1fc723,_0x5f5229['error']['message']);return _0x41cede(_0x5f5229[_0xe98d('0x11')]['message']);}logger[_0xe98d('0x11')](_0xe98d('0xc'),_0x1fc723,_0x5f5229[_0xe98d('0x11')][_0xe98d('0x13')]);return _0x44dbfe(_0x5f5229[_0xe98d('0x11')][_0xe98d('0x13')]);}else{logger['info'](_0xe98d('0xc'),_0x1fc723,_0xe98d('0xf'));_0x44dbfe(_0x5f5229['result'][_0xe98d('0x13')]);}})[_0xe98d('0x14')](function(_0x386c9a){logger[_0xe98d('0x11')](_0xe98d('0xc'),_0x1fc723,_0x386c9a);_0x41cede(_0x386c9a);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d2a9bc5..f3ee859 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 _0x18c9=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0x18c9,0x13c));var _0x918c=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x18c9[_0x16db8b];return _0x5ba017;};'use strict';var multer=require(_0x918c('0x0'));var util=require(_0x918c('0x1'));var path=require(_0x918c('0x2'));var timeout=require(_0x918c('0x3'));var express=require(_0x918c('0x4'));var router=express[_0x918c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x918c('0x6'));var interaction=require(_0x918c('0x7'));var config=require('../../config/environment');module[_0x918c('0x8')]=router; \ No newline at end of file +var _0x8f59=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0xbc9917,_0x479324){var _0x20ab5a=function(_0x43951d){while(--_0x43951d){_0xbc9917['push'](_0xbc9917['shift']());}};_0x20ab5a(++_0x479324);}(_0x8f59,0x11d));var _0x98f5=function(_0x38b6e8,_0x389246){_0x38b6e8=_0x38b6e8-0x0;var _0x45d71d=_0x8f59[_0x38b6e8];return _0x45d71d;};'use strict';var multer=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var path=require(_0x98f5('0x2'));var timeout=require(_0x98f5('0x3'));var express=require(_0x98f5('0x4'));var router=express[_0x98f5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x98f5('0x6'));var interaction=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));module[_0x98f5('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 98147bd..5f30fd1 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 _0xbaf0=['exports','INTEGER'];(function(_0x53eba7,_0x38744c){var _0x32491b=function(_0x61ea1d){while(--_0x61ea1d){_0x53eba7['push'](_0x53eba7['shift']());}};_0x32491b(++_0x38744c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x2c035f,_0x2e4555){var _0x191013=function(_0x48c686){while(--_0x48c686){_0x2c035f['push'](_0x2c035f['shift']());}};_0x191013(++_0x2e4555);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e68f0,_0x181383){_0x5e68f0=_0x5e68f0-0x0;var _0x320008=_0xb10b[_0x5e68f0];return _0x320008;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('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 974c8c1..4dd6d9d 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 _0x98f5=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x4fb6b6,_0x5eb1c7){var _0x3ea470=function(_0x26228c){while(--_0x26228c){_0x4fb6b6['push'](_0x4fb6b6['shift']());}};_0x3ea470(++_0x5eb1c7);}(_0x98f5,0x1e9));var _0x598f=function(_0x3f38f3,_0x22cad7){_0x3f38f3=_0x3f38f3-0x0;var _0x2e88c1=_0x98f5[_0x3f38f3];return _0x2e88c1;};'use strict';var _=require(_0x598f('0x0'));var util=require(_0x598f('0x1'));var logger=require(_0x598f('0x2'))('api');var moment=require(_0x598f('0x3'));var BPromise=require(_0x598f('0x4'));var rp=require(_0x598f('0x5'));var fs=require('fs');var path=require(_0x598f('0x6'));var rimraf=require(_0x598f('0x7'));var config=require(_0x598f('0x8'));var attributes=require(_0x598f('0x9'));module[_0x598f('0xa')]=function(_0x54d8a6,_0x2f006f){return _0x54d8a6[_0x598f('0xb')](_0x598f('0xc'),attributes,{'tableName':_0x598f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7626=['./userSmsQueue.attributes','exports','define','UserSmsQueue','../../config/logger','api'];(function(_0x4067ac,_0x363603){var _0x53d74d=function(_0x492ad4){while(--_0x492ad4){_0x4067ac['push'](_0x4067ac['shift']());}};_0x53d74d(++_0x363603);}(_0x7626,0xee));var _0x6762=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x7626[_0x3b231a];return _0x18d67a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6762('0x0'))(_0x6762('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6762('0x2'));module[_0x6762('0x3')]=function(_0x167ac8,_0x2e1645){return _0x167ac8[_0x6762('0x4')](_0x6762('0x5'),attributes,{'tableName':'user_has_sms_queues','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 5b8bbb0..d4827af 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 _0xdb3f=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','http','request','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0xdb3f,0xc1));var _0xfdb3=function(_0x8c8099,_0x27c68f){_0x8c8099=_0x8c8099-0x0;var _0x139267=_0xdb3f[_0x8c8099];return _0x139267;};'use strict';var _=require(_0xfdb3('0x0'));var util=require(_0xfdb3('0x1'));var moment=require(_0xfdb3('0x2'));var BPromise=require(_0xfdb3('0x3'));var rs=require(_0xfdb3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfdb3('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfdb3('0x6'));var client=jayson[_0xfdb3('0x7')][_0xfdb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b1c41,_0x3ea59e,_0x1b8712){return new BPromise(function(_0x5b465a,_0x1105ce){return client[_0xfdb3('0x9')](_0x2b1c41,_0x1b8712)['then'](function(_0x598db1){logger['info'](_0xfdb3('0xa'),_0x3ea59e,'request\x20sent');logger[_0xfdb3('0xb')](_0xfdb3('0xc'),_0x3ea59e,_0xfdb3('0xd'),JSON[_0xfdb3('0xe')](_0x598db1));if(_0x598db1[_0xfdb3('0xf')]){if(_0x598db1[_0xfdb3('0xf')]['code']===0x1f4){logger[_0xfdb3('0xf')](_0xfdb3('0xa'),_0x3ea59e,_0x598db1[_0xfdb3('0xf')][_0xfdb3('0x10')]);return _0x1105ce(_0x598db1[_0xfdb3('0xf')][_0xfdb3('0x10')]);}logger['error'](_0xfdb3('0xa'),_0x3ea59e,_0x598db1[_0xfdb3('0xf')][_0xfdb3('0x10')]);return _0x5b465a(_0x598db1[_0xfdb3('0xf')]['message']);}else{logger['info'](_0xfdb3('0xa'),_0x3ea59e,_0xfdb3('0xd'));_0x5b465a(_0x598db1[_0xfdb3('0x11')][_0xfdb3('0x10')]);}})[_0xfdb3('0x12')](function(_0x43fd16){logger[_0xfdb3('0xf')](_0xfdb3('0xa'),_0x3ea59e,_0x43fd16);_0x1105ce(_0x43fd16);});});} \ No newline at end of file +var _0xd8ef=['stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0xd8ef,0x1e6));var _0xfd8e=function(_0x246074,_0x9ac8e7){_0x246074=_0x246074-0x0;var _0x2f50b3=_0xd8ef[_0x246074];return _0x2f50b3;};'use strict';var _=require(_0xfd8e('0x0'));var util=require(_0xfd8e('0x1'));var moment=require(_0xfd8e('0x2'));var BPromise=require(_0xfd8e('0x3'));var rs=require(_0xfd8e('0x4'));var fs=require('fs');var Redis=require(_0xfd8e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd8e('0x6'));var logger=require(_0xfd8e('0x7'))(_0xfd8e('0x8'));var config=require(_0xfd8e('0x9'));var jayson=require(_0xfd8e('0xa'));var client=jayson[_0xfd8e('0xb')][_0xfd8e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cd7f3,_0x201e4c,_0x3c1b5d){return new BPromise(function(_0xe9e640,_0x5f485b){return client[_0xfd8e('0xd')](_0x4cd7f3,_0x3c1b5d)['then'](function(_0x4e16ec){logger[_0xfd8e('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x201e4c,'request\x20sent');logger[_0xfd8e('0xf')](_0xfd8e('0x10'),_0x201e4c,_0xfd8e('0x11'),JSON[_0xfd8e('0x12')](_0x4e16ec));if(_0x4e16ec[_0xfd8e('0x13')]){if(_0x4e16ec[_0xfd8e('0x13')][_0xfd8e('0x14')]===0x1f4){logger[_0xfd8e('0x13')](_0xfd8e('0x15'),_0x201e4c,_0x4e16ec[_0xfd8e('0x13')][_0xfd8e('0x16')]);return _0x5f485b(_0x4e16ec[_0xfd8e('0x13')][_0xfd8e('0x16')]);}logger[_0xfd8e('0x13')](_0xfd8e('0x15'),_0x201e4c,_0x4e16ec[_0xfd8e('0x13')][_0xfd8e('0x16')]);return _0xe9e640(_0x4e16ec[_0xfd8e('0x13')]['message']);}else{logger['info'](_0xfd8e('0x15'),_0x201e4c,'request\x20sent');_0xe9e640(_0x4e16ec[_0xfd8e('0x17')][_0xfd8e('0x16')]);}})['catch'](function(_0x44c82b){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x201e4c,_0x44c82b);_0x5f485b(_0x44c82b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index a4b5748..a0a9c81 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 _0x35ff=['Router','../../components/auth/service','../../config/environment','exports','util','path','express'];(function(_0x58b10a,_0x1db93a){var _0x4eb77b=function(_0x16b221){while(--_0x16b221){_0x58b10a['push'](_0x58b10a['shift']());}};_0x4eb77b(++_0x1db93a);}(_0x35ff,0xb3));var _0xf35f=function(_0x1c96aa,_0x5e721b){_0x1c96aa=_0x1c96aa-0x0;var _0x2043bf=_0x35ff[_0x1c96aa];return _0x2043bf;};'use strict';var multer=require('multer');var util=require(_0xf35f('0x0'));var path=require(_0xf35f('0x1'));var timeout=require('connect-timeout');var express=require(_0xf35f('0x2'));var router=express[_0xf35f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf35f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf35f('0x5'));module[_0xf35f('0x6')]=router; \ No newline at end of file +var _0x4ca7=['multer','util','path','express','Router','../../components/interaction/service','exports'];(function(_0x27820b,_0x300f45){var _0xdfed15=function(_0x5c0236){while(--_0x5c0236){_0x27820b['push'](_0x27820b['shift']());}};_0xdfed15(++_0x300f45);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x5da8ef,_0xfd4077){_0x5da8ef=_0x5da8ef-0x0;var _0x4970ee=_0x4ca7[_0x5da8ef];return _0x4970ee;};'use strict';var multer=require(_0x74ca('0x0'));var util=require(_0x74ca('0x1'));var path=require(_0x74ca('0x2'));var timeout=require('connect-timeout');var express=require(_0x74ca('0x3'));var router=express[_0x74ca('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x74ca('0x5'));var config=require('../../config/environment');module[_0x74ca('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 229fa55..d6996a9 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 _0xbaf0=['exports','INTEGER'];(function(_0x5cb367,_0x27ec9d){var _0x279365=function(_0x1d9d85){while(--_0x1d9d85){_0x5cb367['push'](_0x5cb367['shift']());}};_0x279365(++_0x27ec9d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x530932,_0x43affc){var _0x52b4b3=function(_0x39a22d){while(--_0x39a22d){_0x530932['push'](_0x530932['shift']());}};_0x52b4b3(++_0x43affc);}(_0xb10b,0x12a));var _0xbb10=function(_0x3fcc96,_0x1c65d4){_0x3fcc96=_0x3fcc96-0x0;var _0x5caa7a=_0xb10b[_0x3fcc96];return _0x5caa7a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 683996e..268bb4e 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 _0xadb8=['UserVoiceQueue','user_has_voice_queues','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define'];(function(_0x5694a7,_0x736d37){var _0x30e49a=function(_0xf4d4f6){while(--_0xf4d4f6){_0x5694a7['push'](_0x5694a7['shift']());}};_0x30e49a(++_0x736d37);}(_0xadb8,0x1d0));var _0x8adb=function(_0x480fc2,_0x482fba){_0x480fc2=_0x480fc2-0x0;var _0x540a95=_0xadb8[_0x480fc2];return _0x540a95;};'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 +var _0xc874=['../../config/logger','api','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x493bde,_0x1b3654){var _0x508e56=function(_0x6cc082){while(--_0x6cc082){_0x493bde['push'](_0x493bde['shift']());}};_0x508e56(++_0x1b3654);}(_0xc874,0x154));var _0x4c87=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0xc874[_0xdeefbd];return _0x4ff63f;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var logger=require(_0x4c87('0x1'))(_0x4c87('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4c87('0x3'));var fs=require('fs');var path=require(_0x4c87('0x4'));var rimraf=require(_0x4c87('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c87('0x6'));module[_0x4c87('0x7')]=function(_0x5d63ae,_0x46e0f5){return _0x5d63ae[_0x4c87('0x8')](_0x4c87('0x9'),attributes,{'tableName':_0x4c87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 297eb78..c2b5b38 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 _0xa6c1=['../../config/environment','jayson/promise','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','randomstring','../../mysqldb'];(function(_0x5909bc,_0x5f2492){var _0x290006=function(_0x562558){while(--_0x562558){_0x5909bc['push'](_0x5909bc['shift']());}};_0x290006(++_0x5f2492);}(_0xa6c1,0x10d));var _0x1a6c=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xa6c1[_0x2d8d69];return _0x39ae22;};'use strict';var _=require(_0x1a6c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a6c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a6c('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1a6c('0x3'));var jayson=require(_0x1a6c('0x4'));var client=jayson['client'][_0x1a6c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1623ca,_0x3570a7,_0xbc7801){return new BPromise(function(_0x2b8616,_0x1c248a){return client[_0x1a6c('0x6')](_0x1623ca,_0xbc7801)[_0x1a6c('0x7')](function(_0x307251){logger['info'](_0x1a6c('0x8'),_0x3570a7,_0x1a6c('0x9'));logger[_0x1a6c('0xa')](_0x1a6c('0xb'),_0x3570a7,'request\x20sent',JSON['stringify'](_0x307251));if(_0x307251[_0x1a6c('0xc')]){if(_0x307251[_0x1a6c('0xc')][_0x1a6c('0xd')]===0x1f4){logger[_0x1a6c('0xc')](_0x1a6c('0x8'),_0x3570a7,_0x307251[_0x1a6c('0xc')]['message']);return _0x1c248a(_0x307251[_0x1a6c('0xc')][_0x1a6c('0xe')]);}logger[_0x1a6c('0xc')](_0x1a6c('0x8'),_0x3570a7,_0x307251['error'][_0x1a6c('0xe')]);return _0x2b8616(_0x307251['error'][_0x1a6c('0xe')]);}else{logger[_0x1a6c('0xf')](_0x1a6c('0x8'),_0x3570a7,'request\x20sent');_0x2b8616(_0x307251['result'][_0x1a6c('0xe')]);}})[_0x1a6c('0x10')](function(_0x21aead){logger[_0x1a6c('0xc')](_0x1a6c('0x8'),_0x3570a7,_0x21aead);_0x1c248a(_0x21aead);});});} \ No newline at end of file +var _0xc9e9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserVoiceQueue,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x23ea0f,_0x4876f6){var _0x38b430=function(_0x63d9a6){while(--_0x63d9a6){_0x23ea0f['push'](_0x23ea0f['shift']());}};_0x38b430(++_0x4876f6);}(_0xc9e9,0x19f));var _0x9c9e=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xc9e9[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x9c9e('0x0'));var util=require(_0x9c9e('0x1'));var moment=require(_0x9c9e('0x2'));var BPromise=require(_0x9c9e('0x3'));var rs=require(_0x9c9e('0x4'));var fs=require('fs');var Redis=require(_0x9c9e('0x5'));var db=require(_0x9c9e('0x6'))['db'];var utils=require(_0x9c9e('0x7'));var logger=require(_0x9c9e('0x8'))(_0x9c9e('0x9'));var config=require('../../config/environment');var jayson=require(_0x9c9e('0xa'));var client=jayson[_0x9c9e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fd14c,_0x165616,_0x14720e){return new BPromise(function(_0x2f67b1,_0x587a84){return client[_0x9c9e('0xc')](_0x1fd14c,_0x14720e)['then'](function(_0x9d49dc){logger[_0x9c9e('0xd')](_0x9c9e('0xe'),_0x165616,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x165616,'request\x20sent',JSON[_0x9c9e('0xf')](_0x9d49dc));if(_0x9d49dc[_0x9c9e('0x10')]){if(_0x9d49dc[_0x9c9e('0x10')]['code']===0x1f4){logger['error'](_0x9c9e('0xe'),_0x165616,_0x9d49dc['error'][_0x9c9e('0x11')]);return _0x587a84(_0x9d49dc[_0x9c9e('0x10')]['message']);}logger[_0x9c9e('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x165616,_0x9d49dc['error'][_0x9c9e('0x11')]);return _0x2f67b1(_0x9d49dc[_0x9c9e('0x10')][_0x9c9e('0x11')]);}else{logger[_0x9c9e('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x165616,_0x9c9e('0x12'));_0x2f67b1(_0x9d49dc['result'][_0x9c9e('0x11')]);}})[_0x9c9e('0x13')](function(_0x13e367){logger[_0x9c9e('0x10')](_0x9c9e('0xe'),_0x165616,_0x13e367);_0x587a84(_0x13e367);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4aed22a..4c1b73f 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 _0xe8e8=['multer','util','express','Router','../../components/interaction/service','exports'];(function(_0x55839c,_0x50b90e){var _0x148fa3=function(_0x427fd7){while(--_0x427fd7){_0x55839c['push'](_0x55839c['shift']());}};_0x148fa3(++_0x50b90e);}(_0xe8e8,0xc6));var _0x8e8e=function(_0x3804ae,_0x5ea548){_0x3804ae=_0x3804ae-0x0;var _0x468e55=_0xe8e8[_0x3804ae];return _0x468e55;};'use strict';var multer=require(_0x8e8e('0x0'));var util=require(_0x8e8e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8e8e('0x2'));var router=express[_0x8e8e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8e8e('0x4'));var config=require('../../config/environment');module[_0x8e8e('0x5')]=router; \ No newline at end of file +var _0x5242=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5242,0x148));var _0x2524=function(_0x4552be,_0x43cc66){_0x4552be=_0x4552be-0x0;var _0xde2b98=_0x5242[_0x4552be];return _0xde2b98;};'use strict';var multer=require(_0x2524('0x0'));var util=require(_0x2524('0x1'));var path=require(_0x2524('0x2'));var timeout=require(_0x2524('0x3'));var express=require(_0x2524('0x4'));var router=express['Router']();var fs_extra=require(_0x2524('0x5'));var auth=require(_0x2524('0x6'));var interaction=require(_0x2524('0x7'));var config=require(_0x2524('0x8'));module[_0x2524('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 167c0dd..13cad1b 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 _0x6021=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','INTEGER'];(function(_0x3080d3,_0x2b69cf){var _0x185eae=function(_0x531792){while(--_0x531792){_0x3080d3['push'](_0x3080d3['shift']());}};_0x185eae(++_0x2b69cf);}(_0x6021,0x189));var _0x1602=function(_0x15b4c7,_0x21f457){_0x15b4c7=_0x15b4c7-0x0;var _0x273a3b=_0x6021[_0x15b4c7];return _0x273a3b;};'use strict';var Sequelize=require(_0x1602('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1602('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x1602('0x2')],'allowNull':![],'comment':_0x1602('0x3')},'UserId':{'type':Sequelize[_0x1602('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1602('0x4'),'comment':_0x1602('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1602('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x1602('0x2')],'allowNull':![],'unique':_0x1602('0x4'),'comment':_0x1602('0x3')},'penalty':{'type':Sequelize[_0x1602('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x1602('0x1')](0xb),'defaultValue':0x0,'comment':_0x1602('0x3')}}; \ No newline at end of file +var _0x4f07=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x4f07,0x145));var _0x74f0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4f07[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module[_0x74f0('0x0')]={'uniqueid':{'type':Sequelize[_0x74f0('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x74f0('0x2')},'membername':{'type':Sequelize[_0x74f0('0x3')],'allowNull':![],'comment':_0x74f0('0x2')},'UserId':{'type':Sequelize[_0x74f0('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x74f0('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x74f0('0x2')},'VoiceQueueId':{'type':Sequelize[_0x74f0('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x74f0('0x3')],'allowNull':![],'unique':_0x74f0('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x74f0('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x74f0('0x1')](0xb),'defaultValue':0x0,'comment':_0x74f0('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 4a1a781..6cce6e6 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 _0x7e97=['exports','events','../../mysqldb','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x551276,_0x5f28eb){var _0x9b1c35=function(_0x5a7939){while(--_0x5a7939){_0x551276['push'](_0x551276['shift']());}};_0x9b1c35(++_0x5f28eb);}(_0x7e97,0x19b));var _0x77e9=function(_0x5a630e,_0x128314){_0x5a630e=_0x5a630e-0x0;var _0x594bbc=_0x7e97[_0x5a630e];return _0x594bbc;};'use strict';var EventEmitter=require(_0x77e9('0x0'));var UserVoiceQueueRt=require(_0x77e9('0x1'))['db'][_0x77e9('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x77e9('0x3'),'afterUpdate':_0x77e9('0x4'),'afterDestroy':_0x77e9('0x5')};function emitEvent(_0x13a282){return function(_0x2c3a48,_0x2b5231,_0x504dfe){UserVoiceQueueRtEvents[_0x77e9('0x6')](_0x13a282+':'+_0x2c3a48['id'],_0x2c3a48);UserVoiceQueueRtEvents['emit'](_0x13a282,_0x2c3a48);_0x504dfe(null);};}for(var e in events){if(events[_0x77e9('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x77e9('0x8')](e,emitEvent(event));}}module[_0x77e9('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7f3d=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x7f3d,0xc6));var _0xd7f3=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0x7f3d[_0xec034];return _0x2c5a19;};'use strict';var EventEmitter=require(_0xd7f3('0x0'));var UserVoiceQueueRt=require(_0xd7f3('0x1'))['db'][_0xd7f3('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd7f3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd7f3('0x4'),'afterDestroy':_0xd7f3('0x5')};function emitEvent(_0x179d6f){return function(_0x4e9e08,_0x2e379b,_0x1e6a1e){UserVoiceQueueRtEvents[_0xd7f3('0x6')](_0x179d6f+':'+_0x4e9e08['id'],_0x4e9e08);UserVoiceQueueRtEvents['emit'](_0x179d6f,_0x4e9e08);_0x1e6a1e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xd7f3('0x7')](e,emitEvent(event));}}module[_0xd7f3('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 428dea8..ac06e84 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 _0x8db8=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x1fd1df,_0x53ac87){var _0x73f9e3=function(_0x405914){while(--_0x405914){_0x1fd1df['push'](_0x1fd1df['shift']());}};_0x73f9e3(++_0x53ac87);}(_0x8db8,0x6c));var _0x88db=function(_0x2b3bb9,_0x1556ce){_0x2b3bb9=_0x2b3bb9-0x0;var _0x5d3da5=_0x8db8[_0x2b3bb9];return _0x5d3da5;};'use strict';var _=require('lodash');var util=require(_0x88db('0x0'));var logger=require(_0x88db('0x1'))(_0x88db('0x2'));var moment=require(_0x88db('0x3'));var BPromise=require(_0x88db('0x4'));var rp=require(_0x88db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x88db('0x6'));var config=require(_0x88db('0x7'));var attributes=require(_0x88db('0x8'));module['exports']=function(_0x3ebfa2,_0x3f8999){return _0x3ebfa2[_0x88db('0x9')](_0x88db('0xa'),attributes,{'tableName':_0x88db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a6f=['exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x6eee62,_0x25680a){var _0x4d5417=function(_0x6b969a){while(--_0x6b969a){_0x6eee62['push'](_0x6eee62['shift']());}};_0x4d5417(++_0x25680a);}(_0x9a6f,0x1d7));var _0xf9a6=function(_0x33b578,_0x2b7bf0){_0x33b578=_0x33b578-0x0;var _0x407b4b=_0x9a6f[_0x33b578];return _0x407b4b;};'use strict';var _=require(_0xf9a6('0x0'));var util=require(_0xf9a6('0x1'));var logger=require(_0xf9a6('0x2'))(_0xf9a6('0x3'));var moment=require('moment');var BPromise=require(_0xf9a6('0x4'));var rp=require(_0xf9a6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9a6('0x6'));var config=require(_0xf9a6('0x7'));var attributes=require(_0xf9a6('0x8'));module[_0xf9a6('0x9')]=function(_0x54e469,_0x2edc39){return _0x54e469[_0xf9a6('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0xf9a6('0xb'),'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 498e85c..7870a7b 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 _0xa89a=['catch','GetVoiceQueueRtPauses','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4f3f71,_0x1e35ce){var _0x559c25=function(_0x1d874e){while(--_0x1d874e){_0x4f3f71['push'](_0x4f3f71['shift']());}};_0x559c25(++_0x1e35ce);}(_0xa89a,0x1d0));var _0xaa89=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xa89a[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xaa89('0x0'));var util=require(_0xaa89('0x1'));var moment=require(_0xaa89('0x2'));var BPromise=require(_0xaa89('0x3'));var rs=require(_0xaa89('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa89('0x5'))['db'];var utils=require(_0xaa89('0x6'));var logger=require(_0xaa89('0x7'))(_0xaa89('0x8'));var config=require(_0xaa89('0x9'));var jayson=require(_0xaa89('0xa'));var client=jayson[_0xaa89('0xb')][_0xaa89('0xc')]({'port':0x232a});config[_0xaa89('0xd')]=_[_0xaa89('0xe')](config[_0xaa89('0xd')],{'host':_0xaa89('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa89('0xd')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x105bdb,_0x4d147e,_0x440b7c){return new BPromise(function(_0x45b166,_0x8d5491){return client['request'](_0x105bdb,_0x440b7c)['then'](function(_0x3bf632){logger[_0xaa89('0x10')](_0xaa89('0x11'),_0x4d147e,_0xaa89('0x12'));logger[_0xaa89('0x13')](_0xaa89('0x14'),_0x4d147e,'request\x20sent',JSON[_0xaa89('0x15')](_0x3bf632));if(_0x3bf632['error']){if(_0x3bf632[_0xaa89('0x16')][_0xaa89('0x17')]===0x1f4){logger[_0xaa89('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4d147e,_0x3bf632[_0xaa89('0x16')][_0xaa89('0x18')]);return _0x8d5491(_0x3bf632[_0xaa89('0x16')]['message']);}logger[_0xaa89('0x16')](_0xaa89('0x11'),_0x4d147e,_0x3bf632['error'][_0xaa89('0x18')]);return _0x45b166(_0x3bf632['error']['message']);}else{logger[_0xaa89('0x10')](_0xaa89('0x11'),_0x4d147e,_0xaa89('0x12'));_0x45b166(_0x3bf632[_0xaa89('0x19')][_0xaa89('0x18')]);}})[_0xaa89('0x1a')](function(_0x46e8a5){logger['error'](_0xaa89('0x11'),_0x4d147e,_0x46e8a5);_0x8d5491(_0x46e8a5);});});}exports[_0xaa89('0x1b')]=function(_0x1cf443){var _0xa8af03=this;return new Promise(function(_0x4cd81a,_0x55e874){return db['UserVoiceQueueRt']['findAll']({'raw':_0x1cf443[_0xaa89('0x1c')]?_0x1cf443[_0xaa89('0x1c')][_0xaa89('0x1d')]===undefined?!![]:![]:!![],'where':_0x1cf443[_0xaa89('0x1c')]?_0x1cf443[_0xaa89('0x1c')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xaa89('0x1e')]['fn']('IF',db[_0xaa89('0x1e')][_0xaa89('0x1f')](_0xaa89('0x20')))),_0xaa89('0x21')]]})[_0xaa89('0x22')](function(_0x1ecc30){logger['info'](_0xaa89('0x1b'),_0x1cf443);logger[_0xaa89('0x13')](_0xaa89('0x1b'),_0x1cf443,JSON['stringify'](_0x1ecc30));_0x4cd81a(_0x1ecc30);})[_0xaa89('0x1a')](function(_0x252e22){logger[_0xaa89('0x16')]('GetVoiceQueueRtPauses',_0x252e22[_0xaa89('0x18')],_0x1cf443);_0x55e874(_0xa8af03[_0xaa89('0x16')](0x1f4,_0x252e22[_0xaa89('0x18')]));});});}; \ No newline at end of file +var _0xa15e=['../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x3e39c3,_0x395aef){var _0x3bb7e5=function(_0x274d7b){while(--_0x274d7b){_0x3e39c3['push'](_0x3e39c3['shift']());}};_0x3bb7e5(++_0x395aef);}(_0xa15e,0x82));var _0xea15=function(_0x57b5c5,_0x1ece81){_0x57b5c5=_0x57b5c5-0x0;var _0x235f93=_0xa15e[_0x57b5c5];return _0x235f93;};'use strict';var _=require('lodash');var util=require(_0xea15('0x0'));var moment=require(_0xea15('0x1'));var BPromise=require('bluebird');var rs=require(_0xea15('0x2'));var fs=require('fs');var Redis=require(_0xea15('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xea15('0x4'))(_0xea15('0x5'));var config=require(_0xea15('0x6'));var jayson=require(_0xea15('0x7'));var client=jayson[_0xea15('0x8')]['http']({'port':0x232a});config[_0xea15('0x9')]=_[_0xea15('0xa')](config[_0xea15('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xea15('0xb'))(new Redis(config['redis']));require(_0xea15('0xc'))['register'](socket);function respondWithRpcPromise(_0x33f7f0,_0xc05deb,_0x43c524){return new BPromise(function(_0x54421a,_0x33d882){return client['request'](_0x33f7f0,_0x43c524)[_0xea15('0xd')](function(_0x123f64){logger[_0xea15('0xe')](_0xea15('0xf'),_0xc05deb,_0xea15('0x10'));logger['debug'](_0xea15('0x11'),_0xc05deb,_0xea15('0x10'),JSON[_0xea15('0x12')](_0x123f64));if(_0x123f64[_0xea15('0x13')]){if(_0x123f64[_0xea15('0x13')][_0xea15('0x14')]===0x1f4){logger['error'](_0xea15('0xf'),_0xc05deb,_0x123f64[_0xea15('0x13')][_0xea15('0x15')]);return _0x33d882(_0x123f64[_0xea15('0x13')]['message']);}logger[_0xea15('0x13')](_0xea15('0xf'),_0xc05deb,_0x123f64['error'][_0xea15('0x15')]);return _0x54421a(_0x123f64[_0xea15('0x13')][_0xea15('0x15')]);}else{logger[_0xea15('0xe')](_0xea15('0xf'),_0xc05deb,_0xea15('0x10'));_0x54421a(_0x123f64['result']['message']);}})[_0xea15('0x16')](function(_0x49f02e){logger[_0xea15('0x13')](_0xea15('0xf'),_0xc05deb,_0x49f02e);_0x33d882(_0x49f02e);});});}exports[_0xea15('0x17')]=function(_0x46a87f){var _0x2d57a1=this;return new Promise(function(_0xdad800,_0x82c9bd){return db[_0xea15('0x18')][_0xea15('0x19')]({'raw':_0x46a87f[_0xea15('0x1a')]?_0x46a87f[_0xea15('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x46a87f[_0xea15('0x1a')]?_0x46a87f[_0xea15('0x1a')][_0xea15('0x1b')]||null:null,'attributes':[[db[_0xea15('0x1c')]['fn'](_0xea15('0x1d'),db['sequelize']['fn']('IF',db[_0xea15('0x1c')][_0xea15('0x1e')](_0xea15('0x1f')))),_0xea15('0x20')]]})[_0xea15('0xd')](function(_0x408ea2){logger[_0xea15('0xe')](_0xea15('0x17'),_0x46a87f);logger[_0xea15('0x21')](_0xea15('0x17'),_0x46a87f,JSON[_0xea15('0x12')](_0x408ea2));_0xdad800(_0x408ea2);})[_0xea15('0x16')](function(_0x3da4d9){logger[_0xea15('0x13')](_0xea15('0x17'),_0x3da4d9[_0xea15('0x15')],_0x46a87f);_0x82c9bd(_0x2d57a1[_0xea15('0x13')](0x1f4,_0x3da4d9['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index cf6b4ea..1f90e9f 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 _0xb9f6=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register'];(function(_0x16828c,_0x182eb7){var _0x8478d3=function(_0x55d157){while(--_0x55d157){_0x16828c['push'](_0x16828c['shift']());}};_0x8478d3(++_0x182eb7);}(_0xb9f6,0x14f));var _0x6b9f=function(_0x26fece,_0x260464){_0x26fece=_0x26fece-0x0;var _0x18f2c1=_0xb9f6[_0x26fece];return _0x18f2c1;};'use strict';var UserVoiceQueueRtEvents=require(_0x6b9f('0x0'));var events=[_0x6b9f('0x1'),_0x6b9f('0x2'),_0x6b9f('0x3')];function createListener(_0x1522e2,_0x55dcad){return function(_0xfb4bf){_0x55dcad[_0x6b9f('0x4')](_0x1522e2,_0xfb4bf);};}function removeListener(_0x533905,_0x1f7f90){return function(){UserVoiceQueueRtEvents[_0x6b9f('0x5')](_0x533905,_0x1f7f90);};}exports[_0x6b9f('0x6')]=function(_0x5837fb){for(var _0x4613a8=0x0,_0x1d1788=events[_0x6b9f('0x7')];_0x4613a8<_0x1d1788;_0x4613a8++){var _0x3eff14=events[_0x4613a8];var _0x14413f=createListener(_0x6b9f('0x8')+_0x3eff14,_0x5837fb);UserVoiceQueueRtEvents['on'](_0x3eff14,_0x14413f);}}; \ No newline at end of file +var _0xabbf=['emit','removeListener','register','userVoiceQueueRt:','remove','update'];(function(_0x5a5c85,_0xa2585a){var _0x492f6f=function(_0x2e8f81){while(--_0x2e8f81){_0x5a5c85['push'](_0x5a5c85['shift']());}};_0x492f6f(++_0xa2585a);}(_0xabbf,0x1ae));var _0xfabb=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0xabbf[_0x3203a1];return _0x24215e;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0xfabb('0x0'),_0xfabb('0x1')];function createListener(_0x5702eb,_0x47c2c3){return function(_0x20ac16){_0x47c2c3[_0xfabb('0x2')](_0x5702eb,_0x20ac16);};}function removeListener(_0x1ae6df,_0x21eb88){return function(){UserVoiceQueueRtEvents[_0xfabb('0x3')](_0x1ae6df,_0x21eb88);};}exports[_0xfabb('0x4')]=function(_0x5d3b86){for(var _0x52946a=0x0,_0x50d1b3=events['length'];_0x52946a<_0x50d1b3;_0x52946a++){var _0x44e2d0=events[_0x52946a];var _0x1238a5=createListener(_0xfabb('0x5')+_0x44e2d0,_0x5d3b86);UserVoiceQueueRtEvents['on'](_0x44e2d0,_0x1238a5);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 04d918e..e695108 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 _0x95af=['../../components/interaction/service','../../config/environment','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x95af,0x173));var _0xf95a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x95af[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xf95a('0x0'));var util=require(_0xf95a('0x1'));var path=require('path');var timeout=require(_0xf95a('0x2'));var express=require(_0xf95a('0x3'));var router=express[_0xf95a('0x4')]();var fs_extra=require(_0xf95a('0x5'));var auth=require(_0xf95a('0x6'));var interaction=require(_0xf95a('0x7'));var config=require(_0xf95a('0x8'));module['exports']=router; \ No newline at end of file +var _0x9c9b=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','util','path'];(function(_0x32a73f,_0x51def2){var _0x27444c=function(_0x4e9f57){while(--_0x4e9f57){_0x32a73f['push'](_0x32a73f['shift']());}};_0x27444c(++_0x51def2);}(_0x9c9b,0x194));var _0xb9c9=function(_0x34da15,_0x5a7855){_0x34da15=_0x34da15-0x0;var _0x34228e=_0x9c9b[_0x34da15];return _0x34228e;};'use strict';var multer=require('multer');var util=require(_0xb9c9('0x0'));var path=require(_0xb9c9('0x1'));var timeout=require(_0xb9c9('0x2'));var express=require(_0xb9c9('0x3'));var router=express[_0xb9c9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb9c9('0x5'));var interaction=require(_0xb9c9('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index ffa063e..b94ba1f 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 _0xd8b0=['exports','sequelize'];(function(_0x375524,_0x51b2d8){var _0x4272b2=function(_0x549473){while(--_0x549473){_0x375524['push'](_0x375524['shift']());}};_0x4272b2(++_0x51b2d8);}(_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')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x15a995,_0x5096c3){var _0x26bb24=function(_0x3849d1){while(--_0x3849d1){_0x15a995['push'](_0x15a995['shift']());}};_0x26bb24(++_0x5096c3);}(_0xe706,0xa3));var _0x6e70=function(_0x46d14b,_0x147907){_0x46d14b=_0x46d14b-0x0;var _0x367dfd=_0xe706[_0x46d14b];return _0x367dfd;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('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 cc6a674..742e065 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 _0x77e6=['path','../../config/environment','./userWhatsappQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12197e,_0x1c3801){var _0x3e223a=function(_0xf8186a){while(--_0xf8186a){_0x12197e['push'](_0x12197e['shift']());}};_0x3e223a(++_0x1c3801);}(_0x77e6,0x1a6));var _0x677e=function(_0x53ce56,_0x122efe){_0x53ce56=_0x53ce56-0x0;var _0xcf31f=_0x77e6[_0x53ce56];return _0xcf31f;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var logger=require(_0x677e('0x2'))(_0x677e('0x3'));var moment=require(_0x677e('0x4'));var BPromise=require(_0x677e('0x5'));var rp=require(_0x677e('0x6'));var fs=require('fs');var path=require(_0x677e('0x7'));var rimraf=require('rimraf');var config=require(_0x677e('0x8'));var attributes=require(_0x677e('0x9'));module['exports']=function(_0x18c5e1,_0x591b21){return _0x18c5e1[_0x677e('0xa')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5204=['request-promise','path','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird'];(function(_0x50d7fd,_0x30cd62){var _0x512b17=function(_0x305414){while(--_0x305414){_0x50d7fd['push'](_0x50d7fd['shift']());}};_0x512b17(++_0x30cd62);}(_0x5204,0xdf));var _0x4520=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x5204[_0x456b57];return _0x18f49f;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 445728b..1c43765 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 _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x16a01b,_0xb8a562){var _0x300cc4=function(_0xdafe30){while(--_0xdafe30){_0x16a01b['push'](_0x16a01b['shift']());}};_0x300cc4(++_0xb8a562);}(_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 +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x8fe1bd,_0x2670f1){var _0x5cfe70=function(_0x29e813){while(--_0x29e813){_0x8fe1bd['push'](_0x8fe1bd['shift']());}};_0x5cfe70(++_0x2670f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 60fa778..6bd78c9 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 _0xc966=['delete','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','show','/:id','update'];(function(_0x37caeb,_0x12c284){var _0x5660aa=function(_0x57b251){while(--_0x57b251){_0x37caeb['push'](_0x37caeb['shift']());}};_0x5660aa(++_0x12c284);}(_0xc966,0x161));var _0x6c96=function(_0x5d8b1c,_0x44baaf){_0x5d8b1c=_0x5d8b1c-0x0;var _0x5447d8=_0xc966[_0x5d8b1c];return _0x5447d8;};'use strict';var multer=require(_0x6c96('0x0'));var util=require(_0x6c96('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6c96('0x2')]();var fs_extra=require(_0x6c96('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6c96('0x4'));var config=require('../../config/environment');var controller=require(_0x6c96('0x5'));router[_0x6c96('0x6')]('/',auth[_0x6c96('0x7')](),controller['index']);router[_0x6c96('0x6')]('/:id',auth[_0x6c96('0x7')](),controller[_0x6c96('0x8')]);router['post']('/',auth[_0x6c96('0x7')](),controller['create']);router['put'](_0x6c96('0x9'),auth[_0x6c96('0x7')](),controller[_0x6c96('0xa')]);router[_0x6c96('0xb')](_0x6c96('0x9'),auth[_0x6c96('0x7')](),controller[_0x6c96('0xc')]);module[_0x6c96('0xd')]=router; \ No newline at end of file +var _0xcc3b=['isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','index','/:id'];(function(_0x1c123b,_0x50ad1c){var _0x3e6421=function(_0x16b936){while(--_0x16b936){_0x1c123b['push'](_0x1c123b['shift']());}};_0x3e6421(++_0x50ad1c);}(_0xcc3b,0x1d0));var _0xbcc3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcc3b[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0xbcc3('0x0'));var util=require(_0xbcc3('0x1'));var path=require(_0xbcc3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbcc3('0x3')]();var fs_extra=require(_0xbcc3('0x4'));var auth=require(_0xbcc3('0x5'));var interaction=require(_0xbcc3('0x6'));var config=require('../../config/environment');var controller=require(_0xbcc3('0x7'));router[_0xbcc3('0x8')]('/',auth['isAuthenticated'](),controller[_0xbcc3('0x9')]);router['get'](_0xbcc3('0xa'),auth[_0xbcc3('0xb')](),controller[_0xbcc3('0xc')]);router[_0xbcc3('0xd')]('/',auth[_0xbcc3('0xb')](),controller[_0xbcc3('0xe')]);router['put'](_0xbcc3('0xa'),auth[_0xbcc3('0xb')](),controller[_0xbcc3('0xf')]);router[_0xbcc3('0x10')](_0xbcc3('0xa'),auth[_0xbcc3('0xb')](),controller[_0xbcc3('0x11')]);module[_0xbcc3('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 535b3f6..28cada2 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 _0x82d0=['name'];(function(_0x281c4d,_0x485fb2){var _0x3f3944=function(_0x59ac48){while(--_0x59ac48){_0x281c4d['push'](_0x281c4d['shift']());}};_0x3f3944(++_0x485fb2);}(_0x82d0,0x140));var _0x082d=function(_0x855caa,_0x5624fa){_0x855caa=_0x855caa-0x0;var _0x25488a=_0x82d0[_0x855caa];return _0x25488a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x082d('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9b04=['name','STRING'];(function(_0xdf6197,_0x2f2df9){var _0x172d0c=function(_0x390f78){while(--_0x390f78){_0xdf6197['push'](_0xdf6197['shift']());}};_0x172d0c(++_0x2f2df9);}(_0x9b04,0xef));var _0x49b0=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x9b04[_0x3fc97b];return _0x3a0c82;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49b0('0x0')],'unique':_0x49b0('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x49b0('0x0')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 8ec32bc..064900d 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 _0xad5f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','Variables','end','error','stack','name','render','merge','body','contact','message','agent','interaction','account','index','map','Variable','rawAttributes','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','catch','params','intersection','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','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','papaparse','ioredis','../../components/auth/service'];(function(_0x3ab843,_0x5494f5){var _0x3ba1d4=function(_0x6c79c5){while(--_0x6c79c5){_0x3ab843['push'](_0x3ab843['shift']());}};_0x3ba1d4(++_0x5494f5);}(_0xad5f,0x1a8));var _0xfad5=function(_0x2efb96,_0x40a4ce){_0x2efb96=_0x2efb96-0x0;var _0x50d38d=_0xad5f[_0x2efb96];return _0x50d38d;};'use strict';var emlformat=require(_0xfad5('0x0'));var rimraf=require(_0xfad5('0x1'));var zipdir=require(_0xfad5('0x2'));var jsonpatch=require(_0xfad5('0x3'));var rp=require(_0xfad5('0x4'));var moment=require(_0xfad5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfad5('0x6'));var util=require(_0xfad5('0x7'));var path=require(_0xfad5('0x8'));var sox=require(_0xfad5('0x9'));var csv=require(_0xfad5('0xa'));var ejs=require(_0xfad5('0xb'));var fs=require('fs');var fs_extra=require(_0xfad5('0xc'));var _=require('lodash');var squel=require(_0xfad5('0xd'));var crypto=require(_0xfad5('0xe'));var jsforce=require(_0xfad5('0xf'));var deskjs=require(_0xfad5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfad5('0x11'));var Papa=require(_0xfad5('0x12'));var Redis=require(_0xfad5('0x13'));var authService=require(_0xfad5('0x14'));var qs=require(_0xfad5('0x15'));var as=require(_0xfad5('0x16'));var hardwareService=require(_0xfad5('0x17'));var logger=require('../../config/logger')(_0xfad5('0x18'));var utils=require(_0xfad5('0x19'));var config=require(_0xfad5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28ac32,_0x665534){_0x665534=_0x665534||0xcc;return function(_0xb1a9f6){if(_0xb1a9f6){return _0x28ac32[_0xfad5('0x1b')](_0x665534);}return _0x28ac32[_0xfad5('0x1c')](_0x665534)['end']();};}function respondWithResult(_0x35911d,_0x8491fa){_0x8491fa=_0x8491fa||0xc8;return function(_0x162d27){if(_0x162d27){return _0x35911d[_0xfad5('0x1c')](_0x8491fa)[_0xfad5('0x1d')](_0x162d27);}};}function respondWithFilteredResult(_0x1cc46a,_0x446f3c){return function(_0x4df22a){if(_0x4df22a){var _0x5bc9f6=typeof _0x446f3c[_0xfad5('0x1e')]===_0xfad5('0x1f')&&typeof _0x446f3c[_0xfad5('0x20')]===_0xfad5('0x1f');var _0x3a5b8a=_0x4df22a[_0xfad5('0x21')];var _0x10ae77=_0x5bc9f6?0x0:_0x446f3c[_0xfad5('0x1e')];var _0x259766=_0x5bc9f6?_0x4df22a['count']:_0x446f3c['offset']+_0x446f3c[_0xfad5('0x20')];var _0x40f087;if(_0x259766>=_0x3a5b8a){_0x259766=_0x3a5b8a;_0x40f087=0xc8;}else{_0x40f087=0xce;}_0x1cc46a['status'](_0x40f087);return _0x1cc46a['set'](_0xfad5('0x22'),_0x10ae77+'-'+_0x259766+'/'+_0x3a5b8a)[_0xfad5('0x1d')](_0x4df22a);}return null;};}function patchUpdates(_0x5a8857){return function(_0x4d97fa){try{jsonpatch[_0xfad5('0x23')](_0x4d97fa,_0x5a8857,!![]);}catch(_0x58c3ae){return BPromise[_0xfad5('0x24')](_0x58c3ae);}return _0x4d97fa[_0xfad5('0x25')]();};}function saveUpdates(_0x46f4e7,_0x58e43d){return function(_0x354a31){if(_0x354a31){return _0x354a31['update'](_0x46f4e7)[_0xfad5('0x26')](function(_0x75dab5){return _0x75dab5;});}return null;};}function removeEntity(_0xb5395e,_0x16e903){return function(_0x1205fd){if(_0x1205fd){return _0x1205fd[_0xfad5('0x27')]()[_0xfad5('0x26')](function(){var _0x3bcb8f=_0x1205fd[_0xfad5('0x28')]({'plain':!![]});var _0x45c149=_0xfad5('0x29');return db['UserProfileResource'][_0xfad5('0x27')]({'where':{'type':_0x45c149,'resourceId':_0x3bcb8f['id']}})[_0xfad5('0x26')](function(){return _0x1205fd;});})[_0xfad5('0x26')](function(){_0xb5395e[_0xfad5('0x1c')](0xcc)[_0xfad5('0x2a')]();});}};}function handleEntityNotFound(_0x59e2f4,_0x132d1d){return function(_0x3d9d95){if(!_0x3d9d95){_0x59e2f4[_0xfad5('0x1b')](0x194);}return _0x3d9d95;};}function handleError(_0x4e3c29,_0x3f4760){_0x3f4760=_0x3f4760||0x1f4;return function(_0x504ae6){logger[_0xfad5('0x2b')](_0x504ae6[_0xfad5('0x2c')]);if(_0x504ae6[_0xfad5('0x2d')]){delete _0x504ae6['name'];}_0x4e3c29[_0xfad5('0x1c')](_0x3f4760)['send'](_0x504ae6);};}function getMustacheRender(_0x50d118,_0x4c0e11){return Mustache[_0xfad5('0x2e')](_0x50d118,_[_0xfad5('0x2f')](_0x4c0e11[_0xfad5('0x30')],{'contact':_0x4c0e11[_0xfad5('0x31')],'message':_0x4c0e11[_0xfad5('0x32')],'agent':_0x4c0e11[_0xfad5('0x33')],'interaction':_0x4c0e11[_0xfad5('0x34')],'account':_0x4c0e11[_0xfad5('0x35')]}))||'';}exports[_0xfad5('0x36')]=function(_0x3b05d7,_0x4deb39){var _0x2c01ef={},_0x160fde={},_0x379797={'count':0x0,'rows':[]};var _0x4e4edf=_[_0xfad5('0x37')](db[_0xfad5('0x38')][_0xfad5('0x39')],function(_0x5a7f15){return{'name':_0x5a7f15['fieldName'],'type':_0x5a7f15[_0xfad5('0x3a')][_0xfad5('0x3b')]};});_0x160fde[_0xfad5('0x3c')]=_[_0xfad5('0x37')](_0x4e4edf,_0xfad5('0x2d'));_0x160fde['query']=_[_0xfad5('0x3d')](_0x3b05d7[_0xfad5('0x3e')]);_0x160fde[_0xfad5('0x3f')]=_['intersection'](_0x160fde[_0xfad5('0x3c')],_0x160fde[_0xfad5('0x3e')]);_0x2c01ef['attributes']=_['intersection'](_0x160fde[_0xfad5('0x3c')],qs[_0xfad5('0x40')](_0x3b05d7[_0xfad5('0x3e')][_0xfad5('0x40')]));_0x2c01ef[_0xfad5('0x41')]=_0x2c01ef[_0xfad5('0x41')][_0xfad5('0x42')]?_0x2c01ef['attributes']:_0x160fde[_0xfad5('0x3c')];if(!_0x3b05d7[_0xfad5('0x3e')][_0xfad5('0x43')](_0xfad5('0x44'))){_0x2c01ef[_0xfad5('0x20')]=qs['limit'](_0x3b05d7[_0xfad5('0x3e')][_0xfad5('0x20')]);_0x2c01ef['offset']=qs[_0xfad5('0x1e')](_0x3b05d7[_0xfad5('0x3e')][_0xfad5('0x1e')]);}_0x2c01ef['order']=qs['sort'](_0x3b05d7[_0xfad5('0x3e')][_0xfad5('0x45')]);_0x2c01ef[_0xfad5('0x46')]=qs[_0xfad5('0x3f')](_[_0xfad5('0x47')](_0x3b05d7[_0xfad5('0x3e')],_0x160fde[_0xfad5('0x3f')]),_0x4e4edf);if(_0x3b05d7[_0xfad5('0x3e')][_0xfad5('0x48')]){_0x2c01ef[_0xfad5('0x46')]=_[_0xfad5('0x2f')](_0x2c01ef[_0xfad5('0x46')],{'$or':_[_0xfad5('0x37')](_0x4e4edf,function(_0x3038e0){if(_0x3038e0[_0xfad5('0x3a')]!==_0xfad5('0x49')){var _0x28e07a={};_0x28e07a[_0x3038e0[_0xfad5('0x2d')]]={'$like':'%'+_0x3b05d7[_0xfad5('0x3e')][_0xfad5('0x48')]+'%'};return _0x28e07a;}})});}_0x2c01ef=_['merge']({},_0x2c01ef,_0x3b05d7[_0xfad5('0x4a')]);var _0x425707={'where':_0x2c01ef['where']};return db[_0xfad5('0x38')]['count'](_0x425707)['then'](function(_0xb876fa){_0x379797['count']=_0xb876fa;if(_0x3b05d7[_0xfad5('0x3e')]['includeAll']){_0x2c01ef[_0xfad5('0x4b')]=[{'all':!![]}];}return db[_0xfad5('0x38')]['findAll'](_0x2c01ef);})[_0xfad5('0x26')](function(_0x41906b){_0x379797['rows']=_0x41906b;return _0x379797;})['then'](respondWithFilteredResult(_0x4deb39,_0x2c01ef))[_0xfad5('0x4c')](handleError(_0x4deb39,null));};exports['show']=function(_0x57614f,_0x4711b9){var _0x528b00={'raw':!![],'where':{'id':_0x57614f[_0xfad5('0x4d')]['id']}},_0x2b882a={};_0x2b882a[_0xfad5('0x3c')]=_[_0xfad5('0x3d')](db[_0xfad5('0x38')]['rawAttributes']);_0x2b882a[_0xfad5('0x3e')]=_[_0xfad5('0x3d')](_0x57614f[_0xfad5('0x3e')]);_0x2b882a['filters']=_[_0xfad5('0x4e')](_0x2b882a[_0xfad5('0x3c')],_0x2b882a['query']);_0x528b00[_0xfad5('0x41')]=_[_0xfad5('0x4e')](_0x2b882a['model'],qs['fields'](_0x57614f['query'][_0xfad5('0x40')]));_0x528b00[_0xfad5('0x41')]=_0x528b00[_0xfad5('0x41')][_0xfad5('0x42')]?_0x528b00['attributes']:_0x2b882a[_0xfad5('0x3c')];if(_0x57614f[_0xfad5('0x3e')][_0xfad5('0x4f')]){_0x528b00[_0xfad5('0x4b')]=[{'all':!![]}];}_0x528b00=_[_0xfad5('0x2f')]({},_0x528b00,_0x57614f[_0xfad5('0x4a')]);return db[_0xfad5('0x38')][_0xfad5('0x50')](_0x528b00)[_0xfad5('0x26')](handleEntityNotFound(_0x4711b9,null))['then'](respondWithResult(_0x4711b9,null))[_0xfad5('0x4c')](handleError(_0x4711b9,null));};exports[_0xfad5('0x51')]=function(_0x501529,_0x22531c){return db[_0xfad5('0x38')][_0xfad5('0x51')](_0x501529[_0xfad5('0x30')],{})[_0xfad5('0x26')](function(_0x451984){var _0x4a9a19=_0x501529[_0xfad5('0x52')][_0xfad5('0x28')]({'plain':!![]});if(!_0x4a9a19)throw new Error(_0xfad5('0x53'));if(_0x4a9a19[_0xfad5('0x54')]===_0xfad5('0x52')){var _0x234371=_0x451984['get']({'plain':!![]});var _0x490dd4=_0xfad5('0x29');return db[_0xfad5('0x55')][_0xfad5('0x50')]({'where':{'name':_0x490dd4,'userProfileId':_0x4a9a19['userProfileId']},'raw':!![]})[_0xfad5('0x26')](function(_0x5b33a0){if(_0x5b33a0&&_0x5b33a0['autoAssociation']===0x0){return db[_0xfad5('0x56')][_0xfad5('0x51')]({'name':_0x234371[_0xfad5('0x2d')],'resourceId':_0x234371['id'],'type':_0x5b33a0[_0xfad5('0x2d')],'sectionId':_0x5b33a0['id']},{})[_0xfad5('0x26')](function(){return _0x451984;});}else{return _0x451984;}})[_0xfad5('0x4c')](function(_0x1e8099){logger['error'](_0xfad5('0x57'),_0x1e8099);throw _0x1e8099;});}return _0x451984;})[_0xfad5('0x26')](respondWithResult(_0x22531c,0xc9))[_0xfad5('0x4c')](handleError(_0x22531c,null));};exports[_0xfad5('0x58')]=function(_0x4aae92,_0x53e9e2){if(_0x4aae92[_0xfad5('0x30')]['id']){delete _0x4aae92[_0xfad5('0x30')]['id'];}return db[_0xfad5('0x38')][_0xfad5('0x50')]({'where':{'id':_0x4aae92[_0xfad5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x53e9e2,null))['then'](saveUpdates(_0x4aae92[_0xfad5('0x30')],null))['then'](respondWithResult(_0x53e9e2,null))[_0xfad5('0x4c')](handleError(_0x53e9e2,null));};exports[_0xfad5('0x27')]=function(_0x24e988,_0x476780){return db[_0xfad5('0x38')]['find']({'where':{'id':_0x24e988[_0xfad5('0x4d')]['id']}})[_0xfad5('0x26')](handleEntityNotFound(_0x476780,null))[_0xfad5('0x26')](removeEntity(_0x476780,null))[_0xfad5('0x4c')](handleError(_0x476780,null));}; \ No newline at end of file +var _0x0170=['length','hasOwnProperty','nolimit','order','filters','pick','filter','where','VIRTUAL','options','Variable','includeAll','include','rows','catch','show','params','find','create','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','save','update','then','destroy','get','Variables','UserProfileResource','name','send','render','merge','body','message','agent','account','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields'];(function(_0x5eae90,_0x2a1fc6){var _0x51c15a=function(_0x1d4af4){while(--_0x1d4af4){_0x5eae90['push'](_0x5eae90['shift']());}};_0x51c15a(++_0x2a1fc6);}(_0x0170,0x1d6));var _0x0017=function(_0x134c04,_0x2f33ce){_0x134c04=_0x134c04-0x0;var _0x53a3ba=_0x0170[_0x134c04];return _0x53a3ba;};'use strict';var emlformat=require(_0x0017('0x0'));var rimraf=require(_0x0017('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0017('0x2'));var rp=require(_0x0017('0x3'));var moment=require(_0x0017('0x4'));var BPromise=require(_0x0017('0x5'));var Mustache=require('mustache');var util=require(_0x0017('0x6'));var path=require(_0x0017('0x7'));var sox=require(_0x0017('0x8'));var csv=require(_0x0017('0x9'));var ejs=require(_0x0017('0xa'));var fs=require('fs');var fs_extra=require(_0x0017('0xb'));var _=require(_0x0017('0xc'));var squel=require(_0x0017('0xd'));var crypto=require(_0x0017('0xe'));var jsforce=require(_0x0017('0xf'));var deskjs=require(_0x0017('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0017('0x11'));var Redis=require(_0x0017('0x12'));var authService=require(_0x0017('0x13'));var qs=require(_0x0017('0x14'));var as=require(_0x0017('0x15'));var hardwareService=require(_0x0017('0x16'));var logger=require(_0x0017('0x17'))(_0x0017('0x18'));var utils=require(_0x0017('0x19'));var config=require(_0x0017('0x1a'));var licenseUtil=require(_0x0017('0x1b'));var db=require(_0x0017('0x1c'))['db'];function respondWithStatusCode(_0x25200c,_0x50c5d7){_0x50c5d7=_0x50c5d7||0xcc;return function(_0x21505f){if(_0x21505f){return _0x25200c[_0x0017('0x1d')](_0x50c5d7);}return _0x25200c[_0x0017('0x1e')](_0x50c5d7)[_0x0017('0x1f')]();};}function respondWithResult(_0xedbf4c,_0x4bcc57){_0x4bcc57=_0x4bcc57||0xc8;return function(_0x53911b){if(_0x53911b){return _0xedbf4c[_0x0017('0x1e')](_0x4bcc57)[_0x0017('0x20')](_0x53911b);}};}function respondWithFilteredResult(_0x44a006,_0x4ac607){return function(_0x22a6ab){if(_0x22a6ab){var _0x3b46f9=typeof _0x4ac607[_0x0017('0x21')]===_0x0017('0x22')&&typeof _0x4ac607['limit']===_0x0017('0x22');var _0x3a40d6=_0x22a6ab['count'];var _0x24cce2=_0x3b46f9?0x0:_0x4ac607[_0x0017('0x21')];var _0x29c8ea=_0x3b46f9?_0x22a6ab[_0x0017('0x23')]:_0x4ac607['offset']+_0x4ac607[_0x0017('0x24')];var _0x2397b6;if(_0x29c8ea>=_0x3a40d6){_0x29c8ea=_0x3a40d6;_0x2397b6=0xc8;}else{_0x2397b6=0xce;}_0x44a006['status'](_0x2397b6);return _0x44a006[_0x0017('0x25')]('Content-Range',_0x24cce2+'-'+_0x29c8ea+'/'+_0x3a40d6)[_0x0017('0x20')](_0x22a6ab);}return null;};}function patchUpdates(_0x54833a){return function(_0xc2d620){try{jsonpatch['apply'](_0xc2d620,_0x54833a,!![]);}catch(_0x2a64df){return BPromise['reject'](_0x2a64df);}return _0xc2d620[_0x0017('0x26')]();};}function saveUpdates(_0x6cd580,_0x444471){return function(_0x30b1e5){if(_0x30b1e5){return _0x30b1e5[_0x0017('0x27')](_0x6cd580)[_0x0017('0x28')](function(_0x515599){return _0x515599;});}return null;};}function removeEntity(_0x4b34ea,_0x3b8136){return function(_0x22c1ec){if(_0x22c1ec){return _0x22c1ec[_0x0017('0x29')]()[_0x0017('0x28')](function(){var _0x57bb44=_0x22c1ec[_0x0017('0x2a')]({'plain':!![]});var _0x354068=_0x0017('0x2b');return db[_0x0017('0x2c')][_0x0017('0x29')]({'where':{'type':_0x354068,'resourceId':_0x57bb44['id']}})[_0x0017('0x28')](function(){return _0x22c1ec;});})[_0x0017('0x28')](function(){_0x4b34ea[_0x0017('0x1e')](0xcc)[_0x0017('0x1f')]();});}};}function handleEntityNotFound(_0x2adbe0,_0x40462f){return function(_0x32c2ba){if(!_0x32c2ba){_0x2adbe0[_0x0017('0x1d')](0x194);}return _0x32c2ba;};}function handleError(_0x5e1dad,_0x20cb6a){_0x20cb6a=_0x20cb6a||0x1f4;return function(_0x377ab2){logger['error'](_0x377ab2['stack']);if(_0x377ab2[_0x0017('0x2d')]){delete _0x377ab2[_0x0017('0x2d')];}_0x5e1dad[_0x0017('0x1e')](_0x20cb6a)[_0x0017('0x2e')](_0x377ab2);};}function getMustacheRender(_0x56fe20,_0x23e6a3){return Mustache[_0x0017('0x2f')](_0x56fe20,_[_0x0017('0x30')](_0x23e6a3[_0x0017('0x31')],{'contact':_0x23e6a3['contact'],'message':_0x23e6a3[_0x0017('0x32')],'agent':_0x23e6a3[_0x0017('0x33')],'interaction':_0x23e6a3['interaction'],'account':_0x23e6a3[_0x0017('0x34')]}))||'';}exports[_0x0017('0x35')]=function(_0x37204f,_0x1dc8a0){var _0x3f3142={},_0x3cb86e={},_0x45d9ab={'count':0x0,'rows':[]};var _0x50044d=_[_0x0017('0x36')](db['Variable'][_0x0017('0x37')],function(_0x69bf36){return{'name':_0x69bf36[_0x0017('0x38')],'type':_0x69bf36[_0x0017('0x39')]['key']};});_0x3cb86e[_0x0017('0x3a')]=_[_0x0017('0x36')](_0x50044d,'name');_0x3cb86e[_0x0017('0x3b')]=_[_0x0017('0x3c')](_0x37204f[_0x0017('0x3b')]);_0x3cb86e['filters']=_['intersection'](_0x3cb86e[_0x0017('0x3a')],_0x3cb86e[_0x0017('0x3b')]);_0x3f3142[_0x0017('0x3d')]=_[_0x0017('0x3e')](_0x3cb86e[_0x0017('0x3a')],qs[_0x0017('0x3f')](_0x37204f['query'][_0x0017('0x3f')]));_0x3f3142[_0x0017('0x3d')]=_0x3f3142[_0x0017('0x3d')][_0x0017('0x40')]?_0x3f3142[_0x0017('0x3d')]:_0x3cb86e[_0x0017('0x3a')];if(!_0x37204f[_0x0017('0x3b')][_0x0017('0x41')](_0x0017('0x42'))){_0x3f3142['limit']=qs[_0x0017('0x24')](_0x37204f[_0x0017('0x3b')][_0x0017('0x24')]);_0x3f3142[_0x0017('0x21')]=qs[_0x0017('0x21')](_0x37204f[_0x0017('0x3b')][_0x0017('0x21')]);}_0x3f3142[_0x0017('0x43')]=qs['sort'](_0x37204f[_0x0017('0x3b')]['sort']);_0x3f3142['where']=qs[_0x0017('0x44')](_[_0x0017('0x45')](_0x37204f[_0x0017('0x3b')],_0x3cb86e[_0x0017('0x44')]),_0x50044d);if(_0x37204f[_0x0017('0x3b')][_0x0017('0x46')]){_0x3f3142[_0x0017('0x47')]=_[_0x0017('0x30')](_0x3f3142['where'],{'$or':_[_0x0017('0x36')](_0x50044d,function(_0x142d19){if(_0x142d19[_0x0017('0x39')]!==_0x0017('0x48')){var _0x118bb4={};_0x118bb4[_0x142d19[_0x0017('0x2d')]]={'$like':'%'+_0x37204f[_0x0017('0x3b')][_0x0017('0x46')]+'%'};return _0x118bb4;}})});}_0x3f3142=_[_0x0017('0x30')]({},_0x3f3142,_0x37204f[_0x0017('0x49')]);var _0x27ffa6={'where':_0x3f3142[_0x0017('0x47')]};return db[_0x0017('0x4a')][_0x0017('0x23')](_0x27ffa6)['then'](function(_0x50eb4b){_0x45d9ab['count']=_0x50eb4b;if(_0x37204f[_0x0017('0x3b')][_0x0017('0x4b')]){_0x3f3142[_0x0017('0x4c')]=[{'all':!![]}];}return db[_0x0017('0x4a')]['findAll'](_0x3f3142);})['then'](function(_0xf64c7d){_0x45d9ab[_0x0017('0x4d')]=_0xf64c7d;return _0x45d9ab;})[_0x0017('0x28')](respondWithFilteredResult(_0x1dc8a0,_0x3f3142))[_0x0017('0x4e')](handleError(_0x1dc8a0,null));};exports[_0x0017('0x4f')]=function(_0x40cf84,_0x10b840){var _0x3b68b6={'raw':!![],'where':{'id':_0x40cf84[_0x0017('0x50')]['id']}},_0x309de6={};_0x309de6[_0x0017('0x3a')]=_['keys'](db[_0x0017('0x4a')]['rawAttributes']);_0x309de6[_0x0017('0x3b')]=_[_0x0017('0x3c')](_0x40cf84[_0x0017('0x3b')]);_0x309de6[_0x0017('0x44')]=_[_0x0017('0x3e')](_0x309de6['model'],_0x309de6[_0x0017('0x3b')]);_0x3b68b6[_0x0017('0x3d')]=_[_0x0017('0x3e')](_0x309de6[_0x0017('0x3a')],qs[_0x0017('0x3f')](_0x40cf84[_0x0017('0x3b')]['fields']));_0x3b68b6[_0x0017('0x3d')]=_0x3b68b6[_0x0017('0x3d')][_0x0017('0x40')]?_0x3b68b6[_0x0017('0x3d')]:_0x309de6['model'];if(_0x40cf84[_0x0017('0x3b')][_0x0017('0x4b')]){_0x3b68b6[_0x0017('0x4c')]=[{'all':!![]}];}_0x3b68b6=_[_0x0017('0x30')]({},_0x3b68b6,_0x40cf84[_0x0017('0x49')]);return db[_0x0017('0x4a')][_0x0017('0x51')](_0x3b68b6)[_0x0017('0x28')](handleEntityNotFound(_0x10b840,null))[_0x0017('0x28')](respondWithResult(_0x10b840,null))[_0x0017('0x4e')](handleError(_0x10b840,null));};exports[_0x0017('0x52')]=function(_0x5d95be,_0x5c71c9){return db[_0x0017('0x4a')]['create'](_0x5d95be[_0x0017('0x31')],{})[_0x0017('0x28')](function(_0x585920){var _0x4985db=_0x5d95be[_0x0017('0x53')][_0x0017('0x2a')]({'plain':!![]});if(!_0x4985db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4985db['role']===_0x0017('0x53')){var _0x16f86b=_0x585920['get']({'plain':!![]});var _0xaaaf56='Variables';return db[_0x0017('0x54')]['find']({'where':{'name':_0xaaaf56,'userProfileId':_0x4985db[_0x0017('0x55')]},'raw':!![]})[_0x0017('0x28')](function(_0x32faa2){if(_0x32faa2&&_0x32faa2[_0x0017('0x56')]===0x0){return db[_0x0017('0x2c')]['create']({'name':_0x16f86b[_0x0017('0x2d')],'resourceId':_0x16f86b['id'],'type':_0x32faa2[_0x0017('0x2d')],'sectionId':_0x32faa2['id']},{})[_0x0017('0x28')](function(){return _0x585920;});}else{return _0x585920;}})[_0x0017('0x4e')](function(_0x94d285){logger[_0x0017('0x57')](_0x0017('0x58'),_0x94d285);throw _0x94d285;});}return _0x585920;})[_0x0017('0x28')](respondWithResult(_0x5c71c9,0xc9))[_0x0017('0x4e')](handleError(_0x5c71c9,null));};exports['update']=function(_0x3b4ed4,_0x3d8403){if(_0x3b4ed4['body']['id']){delete _0x3b4ed4[_0x0017('0x31')]['id'];}return db[_0x0017('0x4a')][_0x0017('0x51')]({'where':{'id':_0x3b4ed4[_0x0017('0x50')]['id']}})['then'](handleEntityNotFound(_0x3d8403,null))[_0x0017('0x28')](saveUpdates(_0x3b4ed4['body'],null))[_0x0017('0x28')](respondWithResult(_0x3d8403,null))[_0x0017('0x4e')](handleError(_0x3d8403,null));};exports[_0x0017('0x29')]=function(_0x1eb266,_0x53a24d){return db['Variable'][_0x0017('0x51')]({'where':{'id':_0x1eb266['params']['id']}})[_0x0017('0x28')](handleEntityNotFound(_0x53a24d,null))[_0x0017('0x28')](removeEntity(_0x53a24d,null))[_0x0017('0x4e')](handleError(_0x53a24d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 839a476..d55c2c3 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 _0xafa8=['moment','bluebird','request-promise','path','../../config/environment','exports','define','Variable','tools_variables','util','../../config/logger','api'];(function(_0x3e2e28,_0x27a40e){var _0x251a53=function(_0xcfa742){while(--_0xcfa742){_0x3e2e28['push'](_0x3e2e28['shift']());}};_0x251a53(++_0x27a40e);}(_0xafa8,0x135));var _0x8afa=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0xafa8[_0x2a7c2a];return _0x195732;};'use strict';var _=require('lodash');var util=require(_0x8afa('0x0'));var logger=require(_0x8afa('0x1'))(_0x8afa('0x2'));var moment=require(_0x8afa('0x3'));var BPromise=require(_0x8afa('0x4'));var rp=require(_0x8afa('0x5'));var fs=require('fs');var path=require(_0x8afa('0x6'));var rimraf=require('rimraf');var config=require(_0x8afa('0x7'));var attributes=require('./variable.attributes');module[_0x8afa('0x8')]=function(_0x4dc54d,_0x58aa65){return _0x4dc54d[_0x8afa('0x9')](_0x8afa('0xa'),attributes,{'tableName':_0x8afa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03bc=['bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','../../config/logger','api'];(function(_0x2f8a2c,_0x443347){var _0x5ba8d3=function(_0x26f894){while(--_0x26f894){_0x2f8a2c['push'](_0x2f8a2c['shift']());}};_0x5ba8d3(++_0x443347);}(_0x03bc,0xb8));var _0xc03b=function(_0x229c62,_0x4ea285){_0x229c62=_0x229c62-0x0;var _0x10f9b6=_0x03bc[_0x229c62];return _0x10f9b6;};'use strict';var _=require(_0xc03b('0x0'));var util=require('util');var logger=require(_0xc03b('0x1'))(_0xc03b('0x2'));var moment=require('moment');var BPromise=require(_0xc03b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc03b('0x4'));var rimraf=require(_0xc03b('0x5'));var config=require(_0xc03b('0x6'));var attributes=require(_0xc03b('0x7'));module[_0xc03b('0x8')]=function(_0x48e3de,_0x31eda8){return _0x48e3de['define'](_0xc03b('0x9'),attributes,{'tableName':_0xc03b('0xa'),'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 78400f2..3c49b41 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 _0x9982=['http','request','then','debug','request\x20sent','stringify','error','code','Variable,\x20%s,\x20%s','message','info','result','catch','ShowVariable','Variable','find','options','where','attributes','map','include','model','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31f405,_0x52a7a0){var _0x595af8=function(_0x53905b){while(--_0x53905b){_0x31f405['push'](_0x31f405['shift']());}};_0x595af8(++_0x52a7a0);}(_0x9982,0xb6));var _0x2998=function(_0x5ef582,_0x4d6bdd){_0x5ef582=_0x5ef582-0x0;var _0x40377e=_0x9982[_0x5ef582];return _0x40377e;};'use strict';var _=require(_0x2998('0x0'));var util=require('util');var moment=require(_0x2998('0x1'));var BPromise=require(_0x2998('0x2'));var rs=require(_0x2998('0x3'));var fs=require('fs');var Redis=require(_0x2998('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2998('0x5'))(_0x2998('0x6'));var config=require(_0x2998('0x7'));var jayson=require(_0x2998('0x8'));var client=jayson[_0x2998('0x9')][_0x2998('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49f270,_0x3b41b0,_0x261063){return new BPromise(function(_0x3065ce,_0xc6824f){return client[_0x2998('0xb')](_0x49f270,_0x261063)[_0x2998('0xc')](function(_0x529af6){logger['info']('Variable,\x20%s,\x20%s',_0x3b41b0,'request\x20sent');logger[_0x2998('0xd')]('Variable,\x20%s,\x20%s,\x20%s',_0x3b41b0,_0x2998('0xe'),JSON[_0x2998('0xf')](_0x529af6));if(_0x529af6[_0x2998('0x10')]){if(_0x529af6['error'][_0x2998('0x11')]===0x1f4){logger[_0x2998('0x10')](_0x2998('0x12'),_0x3b41b0,_0x529af6[_0x2998('0x10')][_0x2998('0x13')]);return _0xc6824f(_0x529af6['error'][_0x2998('0x13')]);}logger[_0x2998('0x10')](_0x2998('0x12'),_0x3b41b0,_0x529af6[_0x2998('0x10')][_0x2998('0x13')]);return _0x3065ce(_0x529af6['error']['message']);}else{logger[_0x2998('0x14')](_0x2998('0x12'),_0x3b41b0,_0x2998('0xe'));_0x3065ce(_0x529af6[_0x2998('0x15')][_0x2998('0x13')]);}})[_0x2998('0x16')](function(_0x19efb9){logger[_0x2998('0x10')](_0x2998('0x12'),_0x3b41b0,_0x19efb9);_0xc6824f(_0x19efb9);});});}exports[_0x2998('0x17')]=function(_0x3db0a3){var _0x36a5ea=this;return new Promise(function(_0x47d23e,_0x4a27b9){return db[_0x2998('0x18')][_0x2998('0x19')]({'raw':_0x3db0a3[_0x2998('0x1a')]?_0x3db0a3[_0x2998('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3db0a3[_0x2998('0x1a')]?_0x3db0a3['options'][_0x2998('0x1b')]||null:null,'attributes':_0x3db0a3[_0x2998('0x1a')]?_0x3db0a3[_0x2998('0x1a')][_0x2998('0x1c')]||null:null,'include':_0x3db0a3[_0x2998('0x1a')]?_0x3db0a3['options']['include']?_[_0x2998('0x1d')](_0x3db0a3[_0x2998('0x1a')][_0x2998('0x1e')],function(_0x5f0b51){return{'model':db[_0x5f0b51['model']],'as':_0x5f0b51['as'],'attributes':_0x5f0b51[_0x2998('0x1c')],'include':_0x5f0b51['include']?_[_0x2998('0x1d')](_0x5f0b51[_0x2998('0x1e')],function(_0x11e41c){return{'model':db[_0x11e41c['model']],'as':_0x11e41c['as'],'attributes':_0x11e41c[_0x2998('0x1c')],'include':_0x11e41c[_0x2998('0x1e')]?_[_0x2998('0x1d')](_0x11e41c[_0x2998('0x1e')],function(_0x3d3823){return{'model':db[_0x3d3823[_0x2998('0x1f')]],'as':_0x3d3823['as'],'attributes':_0x3d3823[_0x2998('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2998('0xc')](function(_0x534ab4){logger[_0x2998('0x14')]('ShowVariable',_0x3db0a3);logger[_0x2998('0xd')]('ShowVariable',_0x3db0a3,JSON[_0x2998('0xf')](_0x534ab4));_0x47d23e(_0x534ab4);})[_0x2998('0x16')](function(_0x3bb9db){logger['error'](_0x2998('0x17'),_0x3bb9db[_0x2998('0x13')],_0x3db0a3);_0x4a27b9(_0x36a5ea[_0x2998('0x10')](0x1f4,_0x3bb9db[_0x2998('0x13')]));});});}; \ No newline at end of file +var _0xf2e6=['ShowVariable','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Variable','options','raw','where','attributes','include','map','model','then'];(function(_0x497b9c,_0x4edbc1){var _0x3bd3b7=function(_0x24b111){while(--_0x24b111){_0x497b9c['push'](_0x497b9c['shift']());}};_0x3bd3b7(++_0x4edbc1);}(_0xf2e6,0x1d0));var _0x6f2e=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xf2e6[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x6f2e('0x0'));var util=require(_0x6f2e('0x1'));var moment=require(_0x6f2e('0x2'));var BPromise=require(_0x6f2e('0x3'));var rs=require(_0x6f2e('0x4'));var fs=require('fs');var Redis=require(_0x6f2e('0x5'));var db=require(_0x6f2e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f2e('0x7'))('rpc');var config=require(_0x6f2e('0x8'));var jayson=require(_0x6f2e('0x9'));var client=jayson[_0x6f2e('0xa')][_0x6f2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4673bc,_0x58921f,_0x524222){return new BPromise(function(_0x3eb40c,_0x3b6c4f){return client[_0x6f2e('0xc')](_0x4673bc,_0x524222)['then'](function(_0x388d94){logger['info'](_0x6f2e('0xd'),_0x58921f,_0x6f2e('0xe'));logger[_0x6f2e('0xf')](_0x6f2e('0x10'),_0x58921f,_0x6f2e('0xe'),JSON[_0x6f2e('0x11')](_0x388d94));if(_0x388d94['error']){if(_0x388d94[_0x6f2e('0x12')][_0x6f2e('0x13')]===0x1f4){logger[_0x6f2e('0x12')](_0x6f2e('0xd'),_0x58921f,_0x388d94[_0x6f2e('0x12')][_0x6f2e('0x14')]);return _0x3b6c4f(_0x388d94[_0x6f2e('0x12')][_0x6f2e('0x14')]);}logger['error']('Variable,\x20%s,\x20%s',_0x58921f,_0x388d94[_0x6f2e('0x12')][_0x6f2e('0x14')]);return _0x3eb40c(_0x388d94[_0x6f2e('0x12')][_0x6f2e('0x14')]);}else{logger[_0x6f2e('0x15')](_0x6f2e('0xd'),_0x58921f,_0x6f2e('0xe'));_0x3eb40c(_0x388d94['result'][_0x6f2e('0x14')]);}})['catch'](function(_0x471a0e){logger[_0x6f2e('0x12')](_0x6f2e('0xd'),_0x58921f,_0x471a0e);_0x3b6c4f(_0x471a0e);});});}exports['ShowVariable']=function(_0x3f0385){var _0x398a2f=this;return new Promise(function(_0x4f343a,_0x4f7757){return db[_0x6f2e('0x16')]['find']({'raw':_0x3f0385[_0x6f2e('0x17')]?_0x3f0385[_0x6f2e('0x17')][_0x6f2e('0x18')]===undefined?!![]:![]:!![],'where':_0x3f0385[_0x6f2e('0x17')]?_0x3f0385[_0x6f2e('0x17')][_0x6f2e('0x19')]||null:null,'attributes':_0x3f0385['options']?_0x3f0385[_0x6f2e('0x17')][_0x6f2e('0x1a')]||null:null,'include':_0x3f0385[_0x6f2e('0x17')]?_0x3f0385[_0x6f2e('0x17')][_0x6f2e('0x1b')]?_['map'](_0x3f0385['options']['include'],function(_0x2322e3){return{'model':db[_0x2322e3['model']],'as':_0x2322e3['as'],'attributes':_0x2322e3[_0x6f2e('0x1a')],'include':_0x2322e3[_0x6f2e('0x1b')]?_[_0x6f2e('0x1c')](_0x2322e3[_0x6f2e('0x1b')],function(_0x42fba6){return{'model':db[_0x42fba6['model']],'as':_0x42fba6['as'],'attributes':_0x42fba6[_0x6f2e('0x1a')],'include':_0x42fba6[_0x6f2e('0x1b')]?_['map'](_0x42fba6[_0x6f2e('0x1b')],function(_0x42f99c){return{'model':db[_0x42f99c[_0x6f2e('0x1d')]],'as':_0x42f99c['as'],'attributes':_0x42f99c[_0x6f2e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6f2e('0x1e')](function(_0x4df386){logger[_0x6f2e('0x15')]('ShowVariable',_0x3f0385);logger[_0x6f2e('0xf')](_0x6f2e('0x1f'),_0x3f0385,JSON[_0x6f2e('0x11')](_0x4df386));_0x4f343a(_0x4df386);})[_0x6f2e('0x20')](function(_0x322e66){logger[_0x6f2e('0x12')](_0x6f2e('0x1f'),_0x322e66[_0x6f2e('0x14')],_0x3f0385);_0x4f7757(_0x398a2f['error'](0x1f4,_0x322e66[_0x6f2e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 7a5ac5e..7a0524b 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 _0x8f2c=['express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','/restart','restart','migrations','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f2c,0x143));var _0xc8f2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8f2c[_0x122ef9];return _0x42fba0;};'use strict';var express=require(_0xc8f2('0x0'));var router=express[_0xc8f2('0x1')]();var auth=require(_0xc8f2('0x2'));var controller=require(_0xc8f2('0x3'));router[_0xc8f2('0x4')]('/',controller[_0xc8f2('0x5')]);router['get'](_0xc8f2('0x6'),auth[_0xc8f2('0x7')](),auth[_0xc8f2('0x8')](),controller[_0xc8f2('0x9')]);router[_0xc8f2('0x4')](_0xc8f2('0xa'),auth[_0xc8f2('0x7')](),auth[_0xc8f2('0x8')](),controller[_0xc8f2('0xb')]);router[_0xc8f2('0x4')](_0xc8f2('0xc'),auth[_0xc8f2('0x7')](),auth[_0xc8f2('0x8')](),controller['pull']);router[_0xc8f2('0x4')](_0xc8f2('0xd'),auth[_0xc8f2('0x7')](),controller[_0xc8f2('0xe')]);router['get']('/migrations',controller[_0xc8f2('0xf')]);module[_0xc8f2('0x10')]=router; \ No newline at end of file +var _0x1c59=['/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','/reset','isAuthenticated','reset','pull'];(function(_0x4c9441,_0x2ea921){var _0x59066d=function(_0x34ca72){while(--_0x34ca72){_0x4c9441['push'](_0x4c9441['shift']());}};_0x59066d(++_0x2ea921);}(_0x1c59,0xe5));var _0x91c5=function(_0x7a2ed0,_0x4c6eb0){_0x7a2ed0=_0x7a2ed0-0x0;var _0xbe7029=_0x1c59[_0x7a2ed0];return _0xbe7029;};'use strict';var express=require('express');var router=express[_0x91c5('0x0')]();var auth=require(_0x91c5('0x1'));var controller=require(_0x91c5('0x2'));router[_0x91c5('0x3')]('/',controller[_0x91c5('0x4')]);router[_0x91c5('0x3')](_0x91c5('0x5'),auth['isAuthenticated'](),auth[_0x91c5('0x6')](),controller['fetch']);router[_0x91c5('0x3')](_0x91c5('0x7'),auth[_0x91c5('0x8')](),auth[_0x91c5('0x6')](),controller[_0x91c5('0x9')]);router[_0x91c5('0x3')]('/pull',auth[_0x91c5('0x8')](),auth['canUpdate'](),controller[_0x91c5('0xa')]);router[_0x91c5('0x3')](_0x91c5('0xb'),auth[_0x91c5('0x8')](),controller[_0x91c5('0xc')]);router['get'](_0x91c5('0xd'),controller[_0x91c5('0xe')]);module[_0x91c5('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 3edbee6..22d7b81 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 _0x46c1=['.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','exports','\x20to\x20','last','UniqueConstraintError','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','root','index','query','latest','fetch','tags','2.0.0','json','origin','error','status','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace'];(function(_0x1d4016,_0x2df022){var _0x1b3954=function(_0x4a13bb){while(--_0x4a13bb){_0x1d4016['push'](_0x1d4016['shift']());}};_0x1b3954(++_0x2df022);}(_0x46c1,0x7c));var _0x146c=function(_0x153e30,_0x4d46fe){_0x153e30=_0x153e30-0x0;var _0xa26e18=_0x46c1[_0x153e30];return _0xa26e18;};'use strict';var Umzug=require('umzug');var path=require(_0x146c('0x0'));var fs=require('fs');var _=require(_0x146c('0x1'));var pkginfo=require(_0x146c('0x2'))(module,_0x146c('0x3'));var compareVersions=require(_0x146c('0x4'));var exec=require('child_process')[_0x146c('0x5')];var db=require(_0x146c('0x6'))['db'];var config=require(_0x146c('0x7'));var pm2=require(_0x146c('0x8'));var logger=require(_0x146c('0x9'))('update');var git=require('simple-git')(config[_0x146c('0xa')]);exports[_0x146c('0xb')]=function(_0x3bccd4,_0x54f99b){var _0x36a8c2={'current':module['exports'][_0x146c('0x3')],'phonebar':0x2};if(_0x3bccd4[_0x146c('0xc')]&&_0x3bccd4['query'][_0x146c('0xd')]){return git[_0x146c('0xe')]()[_0x146c('0xf')](function(_0x1cc0c6,_0x490baa){_0x36a8c2[_0x146c('0xd')]=(_0x1cc0c6?module['exports'][_0x146c('0x3')]:_0x490baa[_0x146c('0xd')])||_0x146c('0x10');return _0x54f99b['status'](0xc8)[_0x146c('0x11')](_0x36a8c2);});}else{return _0x54f99b['status'](0xc8)[_0x146c('0x11')](_0x36a8c2);}};exports['fetch']=function(_0x2f4dab,_0x138063){return git[_0x146c('0xe')]([_0x146c('0x12'),'master'],function(_0x297c83){if(_0x297c83){logger[_0x146c('0x13')](_0x297c83);return _0x138063['status'](0x1f4)[_0x146c('0x11')](_0x297c83);}logger['info']('git\x20fetch');return _0x138063[_0x146c('0x14')](0xc8)['json']({'output':_0x146c('0x15')});});};exports[_0x146c('0x16')]=function(_0x731da7,_0x4b1f21){return git[_0x146c('0x16')]([_0x146c('0x17'),_0x146c('0x18')],function(_0x46b94f){if(_0x46b94f){logger[_0x146c('0x13')](_0x46b94f);return _0x4b1f21[_0x146c('0x14')](0x1f4)[_0x146c('0x11')](_0x46b94f);}logger[_0x146c('0x19')](_0x146c('0x1a'));return _0x4b1f21['status'](0xc8)[_0x146c('0x11')]({'output':_0x146c('0x1b')});});};exports[_0x146c('0x1c')]=function(_0x8e7792,_0x11ac12){exec('npm\x20install\x20--production',function(_0x5b5ada,_0x1dfd0f,_0x26f5ed){logger[_0x146c('0x19')](_0x1dfd0f);logger[_0x146c('0x19')](_0x26f5ed);if(_0x5b5ada){logger['error'](_0x5b5ada);return _0x11ac12[_0x146c('0x14')](0x1f4)[_0x146c('0x11')](_0x5b5ada);}return _0x11ac12[_0x146c('0x14')](0xc8)[_0x146c('0x11')]({'output':_0x1dfd0f});});};exports[_0x146c('0x1d')]=function(_0x5e042f,_0x5d9cc9){return pm2[_0x146c('0x1d')](_0x146c('0x1e'))[_0x146c('0x1f')](function(_0x46c83c){logger['info'](_0x146c('0x20'),_0x46c83c);return _0x5d9cc9[_0x146c('0x14')](0xc8)[_0x146c('0x11')]({'output':_0x146c('0x21')});})[_0x146c('0x22')](function(_0x2298c0){logger[_0x146c('0x13')](_0x2298c0);return _0x5d9cc9[_0x146c('0x14')](0x1f4)[_0x146c('0x11')](_0x2298c0);});};exports['migrations']=function(_0x7c336b,_0x566d90){var _0x5c44ef=fs[_0x146c('0x23')](path[_0x146c('0x24')](config[_0x146c('0xa')],_0x146c('0x25'),_0x146c('0x26')));var _0x2e07e3=[];for(var _0x2073e1=0x0;_0x2073e1<_0x5c44ef[_0x146c('0x27')];_0x2073e1++){var _0x3d5ca9=_0x5c44ef[_0x2073e1][_0x146c('0x28')](_0x146c('0x29'),'');if(compareVersions(module['exports'][_0x146c('0x3')],_0x3d5ca9)===-0x1){_0x2e07e3[_0x146c('0x2a')](_0x3d5ca9);}}if(_0x2e07e3['length']){var _0x28ac45=_0x2e07e3[_0x146c('0x2b')](compareVersions);var _0x3b591b=new Umzug({'storage':_0x146c('0x2c'),'storageOptions':{'model':db[_0x146c('0x2d')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x146c('0x2c')][_0x146c('0x2e')](),db[_0x146c('0x2c')][_0x146c('0x2f')],function(){throw new Error(_0x146c('0x30'));}],'path':path['join'](config[_0x146c('0xa')],_0x146c('0x25'),_0x146c('0x26')),'pattern':/\.js$/}});_0x3b591b['up']({'migrations':_[_0x146c('0x31')](_0x28ac45,function(_0x4bfa56){return _0x4bfa56+_0x146c('0x29');})})[_0x146c('0x1f')](function(){return _0x566d90[_0x146c('0x14')](0xc8)[_0x146c('0x11')]({'output':_0x146c('0x32')+module[_0x146c('0x33')][_0x146c('0x3')]+_0x146c('0x34')+_[_0x146c('0x35')](_0x28ac45),'migrations':_[_0x146c('0x24')](_0x28ac45)});})[_0x146c('0x22')](function(_0x2af0af){if(_0x2af0af instanceof db[_0x146c('0x2c')][_0x146c('0x36')]){return _0x566d90[_0x146c('0x14')](0xc8)[_0x146c('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x566d90[_0x146c('0x14')](0x1f4)['json'](_0x2af0af);}});}else{return _0x566d90[_0x146c('0x14')](0xc8)[_0x146c('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x5f66=['../../config/logger','update','index','exports','latest','fetch','tags','status','json','origin','master','error','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','catch','migrations','readdirSync','join','root','server','replace','.js','push','length','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','last','UniqueConstraintError','path','pkginfo','version','compare-versions','child_process','exec','../../config/environment'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var Umzug=require('umzug');var path=require(_0x65f6('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x65f6('0x1'))(module,_0x65f6('0x2'));var compareVersions=require(_0x65f6('0x3'));var exec=require(_0x65f6('0x4'))[_0x65f6('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x65f6('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x65f6('0x7'))(_0x65f6('0x8'));var git=require('simple-git')(config['root']);exports[_0x65f6('0x9')]=function(_0x2c6571,_0x112079){var _0x8f6451={'current':module[_0x65f6('0xa')][_0x65f6('0x2')],'phonebar':0x2};if(_0x2c6571['query']&&_0x2c6571['query'][_0x65f6('0xb')]){return git[_0x65f6('0xc')]()[_0x65f6('0xd')](function(_0x25c416,_0x50d26d){_0x8f6451[_0x65f6('0xb')]=(_0x25c416?module['exports']['version']:_0x50d26d[_0x65f6('0xb')])||'2.0.0';return _0x112079[_0x65f6('0xe')](0xc8)['json'](_0x8f6451);});}else{return _0x112079[_0x65f6('0xe')](0xc8)[_0x65f6('0xf')](_0x8f6451);}};exports[_0x65f6('0xc')]=function(_0x217570,_0x369f96){return git[_0x65f6('0xc')]([_0x65f6('0x10'),_0x65f6('0x11')],function(_0x46dbc6){if(_0x46dbc6){logger[_0x65f6('0x12')](_0x46dbc6);return _0x369f96['status'](0x1f4)[_0x65f6('0xf')](_0x46dbc6);}logger['info']('git\x20fetch');return _0x369f96[_0x65f6('0xe')](0xc8)[_0x65f6('0xf')]({'output':_0x65f6('0x13')});});};exports[_0x65f6('0x14')]=function(_0x1b1cbb,_0x1f974c){return git[_0x65f6('0x14')]([_0x65f6('0x15'),'FETCH_HEAD'],function(_0x4d79a1){if(_0x4d79a1){logger[_0x65f6('0x12')](_0x4d79a1);return _0x1f974c['status'](0x1f4)['json'](_0x4d79a1);}logger['info'](_0x65f6('0x16'));return _0x1f974c[_0x65f6('0xe')](0xc8)['json']({'output':_0x65f6('0x17')});});};exports[_0x65f6('0x18')]=function(_0xbee6a4,_0x3876ed){exec(_0x65f6('0x19'),function(_0xc139c2,_0x581374,_0x197a49){logger['info'](_0x581374);logger['info'](_0x197a49);if(_0xc139c2){logger[_0x65f6('0x12')](_0xc139c2);return _0x3876ed[_0x65f6('0xe')](0x1f4)['json'](_0xc139c2);}return _0x3876ed[_0x65f6('0xe')](0xc8)[_0x65f6('0xf')]({'output':_0x581374});});};exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){return pm2[_0x65f6('0x1a')](_0x65f6('0x1b'))[_0x65f6('0x1c')](function(_0x5963e0){logger['info']('pm2\x20restart\x20motion\x20%s',_0x5963e0);return _0x4f5a69[_0x65f6('0xe')](0xc8)[_0x65f6('0xf')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x65f6('0x1d')](function(_0x28f710){logger['error'](_0x28f710);return _0x4f5a69[_0x65f6('0xe')](0x1f4)[_0x65f6('0xf')](_0x28f710);});};exports[_0x65f6('0x1e')]=function(_0x559330,_0x4ac04b){var _0x488d36=fs[_0x65f6('0x1f')](path[_0x65f6('0x20')](config[_0x65f6('0x21')],_0x65f6('0x22'),_0x65f6('0x1e')));var _0x14a387=[];for(var _0x144e55=0x0;_0x144e55<_0x488d36['length'];_0x144e55++){var _0x4ea23d=_0x488d36[_0x144e55][_0x65f6('0x23')](_0x65f6('0x24'),'');if(compareVersions(module['exports']['version'],_0x4ea23d)===-0x1){_0x14a387[_0x65f6('0x25')](_0x4ea23d);}}if(_0x14a387[_0x65f6('0x26')]){var _0x11fe3b=_0x14a387[_0x65f6('0x27')](compareVersions);var _0x1217fd=new Umzug({'storage':_0x65f6('0x28'),'storageOptions':{'model':db['Migration'],'modelName':_0x65f6('0x29'),'columnName':_0x65f6('0x2')},'migrations':{'params':[db[_0x65f6('0x28')]['getQueryInterface'](),db[_0x65f6('0x28')][_0x65f6('0x2a')],function(){throw new Error(_0x65f6('0x2b'));}],'path':path[_0x65f6('0x20')](config[_0x65f6('0x21')],_0x65f6('0x22'),'migrations'),'pattern':/\.js$/}});_0x1217fd['up']({'migrations':_[_0x65f6('0x2c')](_0x11fe3b,function(_0x1b24ea){return _0x1b24ea+'.js';})})[_0x65f6('0x1c')](function(){return _0x4ac04b['status'](0xc8)[_0x65f6('0xf')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x65f6('0xa')][_0x65f6('0x2')]+'\x20to\x20'+_[_0x65f6('0x2d')](_0x11fe3b),'migrations':_[_0x65f6('0x20')](_0x11fe3b)});})[_0x65f6('0x1d')](function(_0x515648){if(_0x515648 instanceof db['sequelize'][_0x65f6('0x2e')]){return _0x4ac04b['status'](0xc8)[_0x65f6('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4ac04b[_0x65f6('0xe')](0x1f4)[_0x65f6('0xf')](_0x515648);}});}else{return _0x4ac04b['status'](0xc8)[_0x65f6('0xf')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index b277373..48e196c 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x5d53ec,_0x4c95e1){var _0x30c752=function(_0x89ffd5){while(--_0x89ffd5){_0x5d53ec['push'](_0x5d53ec['shift']());}};_0x30c752(++_0x4c95e1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0x757a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','util','path'];(function(_0x460b3c,_0x4a4224){var _0x53db34=function(_0x5e88d3){while(--_0x5e88d3){_0x460b3c['push'](_0x460b3c['shift']());}};_0x53db34(++_0x4a4224);}(_0x757a,0xde));var _0xa757=function(_0x45f90c,_0x4c0b70){_0x45f90c=_0x45f90c-0x0;var _0x262e4e=_0x757a[_0x45f90c];return _0x262e4e;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0xc')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0xe')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller[_0xa757('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index c8c4ede..36f9262 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 _0xc4aa=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x28cda9,_0x52e9d1){var _0x5019fb=function(_0x10ab27){while(--_0x10ab27){_0x28cda9['push'](_0x28cda9['shift']());}};_0x5019fb(++_0x52e9d1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'type':{'type':Sequelize[_0xac4a('0x2')]},'uniqueid':{'type':Sequelize[_0xac4a('0x2')]},'calleridnum':{'type':Sequelize[_0xac4a('0x2')]},'calleridname':{'type':Sequelize[_0xac4a('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xac4a('0x3')]},'agentconnectAt':{'type':Sequelize[_0xac4a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xac4a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xac4a('0x3')]},'agentdumpAt':{'type':Sequelize[_0xac4a('0x3')]},'holdtime':{'type':Sequelize[_0xac4a('0x4')]},'agentcomplete':{'type':Sequelize[_0xac4a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xac4a('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xac4a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xac4a('0x4')]},'reason':{'type':Sequelize[_0xac4a('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xac4a('0x2')]},'channelstate':{'type':Sequelize[_0xac4a('0x4')]},'channelstatedesc':{'type':Sequelize[_0xac4a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xac4a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xac4a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xac4a('0x2')]},'priority':{'type':Sequelize[_0xac4a('0x2')]},'destchannel':{'type':Sequelize[_0xac4a('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xac4a('0x2')]},'destcalleridnum':{'type':Sequelize[_0xac4a('0x2')]},'destcalleridname':{'type':Sequelize[_0xac4a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xac4a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xac4a('0x2')]},'destlanguage':{'type':Sequelize[_0xac4a('0x2')]},'destaccountcode':{'type':Sequelize[_0xac4a('0x2')]},'destcontext':{'type':Sequelize[_0xac4a('0x2')]},'destexten':{'type':Sequelize[_0xac4a('0x2')]},'destpriority':{'type':Sequelize[_0xac4a('0x2')]},'destuniqueid':{'type':Sequelize[_0xac4a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xac4a('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xac4a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xac4a('0x2')],'comment':_0xac4a('0x6')},'transferexten':{'type':Sequelize[_0xac4a('0x2')]},'transferuniqueid':{'type':Sequelize[_0xac4a('0x2')]},'agententerreason':{'type':Sequelize[_0xac4a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbd51=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x52febf,_0xbe7d78){var _0xb203c=function(_0x11c5d4){while(--_0x11c5d4){_0x52febf['push'](_0x52febf['shift']());}};_0xb203c(++_0xbe7d78);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x561cd5,_0x40ef2b){_0x561cd5=_0x561cd5-0x0;var _0x2463be=_0xbd51[_0x561cd5];return _0x2463be;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'type':{'type':Sequelize[_0x1bd5('0x1')]},'uniqueid':{'type':Sequelize[_0x1bd5('0x1')]},'calleridnum':{'type':Sequelize[_0x1bd5('0x1')]},'calleridname':{'type':Sequelize[_0x1bd5('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x1bd5('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x1bd5('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x1bd5('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x1bd5('0x3')]},'agentcomplete':{'type':Sequelize[_0x1bd5('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x1bd5('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x1bd5('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x1bd5('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1bd5('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x1bd5('0x1')]},'channel':{'type':Sequelize[_0x1bd5('0x1')]},'channelstate':{'type':Sequelize[_0x1bd5('0x3')]},'channelstatedesc':{'type':Sequelize[_0x1bd5('0x1')]},'connectedlinenum':{'type':Sequelize[_0x1bd5('0x1')]},'connectedlinename':{'type':Sequelize[_0x1bd5('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1bd5('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1bd5('0x1')]},'priority':{'type':Sequelize[_0x1bd5('0x1')]},'destchannel':{'type':Sequelize[_0x1bd5('0x1')]},'destchannelstate':{'type':Sequelize[_0x1bd5('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x1bd5('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1bd5('0x1')]},'destcalleridname':{'type':Sequelize[_0x1bd5('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x1bd5('0x1')]},'destaccountcode':{'type':Sequelize[_0x1bd5('0x1')]},'destcontext':{'type':Sequelize[_0x1bd5('0x1')]},'destexten':{'type':Sequelize[_0x1bd5('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x1bd5('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x1bd5('0x1')]},'transfer':{'type':Sequelize[_0x1bd5('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1bd5('0x1')],'comment':_0x1bd5('0x5')},'transferexten':{'type':Sequelize[_0x1bd5('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1bd5('0x1')]},'agententerreason':{'type':Sequelize[_0x1bd5('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index a2da330..9521a43 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 _0x8ac4=['mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','end','name','send','body','contact','message','agent','interaction','account','index','VoiceAgentReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','describe','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x6d5f31,_0x510751){var _0x1b1dda=function(_0x12f562){while(--_0x12f562){_0x6d5f31['push'](_0x6d5f31['shift']());}};_0x1b1dda(++_0x510751);}(_0x8ac4,0x13b));var _0x48ac=function(_0x4007b4,_0x414c5b){_0x4007b4=_0x4007b4-0x0;var _0xe319d1=_0x8ac4[_0x4007b4];return _0xe319d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48ac('0x0'));var zipdir=require(_0x48ac('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48ac('0x2'));var moment=require(_0x48ac('0x3'));var BPromise=require(_0x48ac('0x4'));var Mustache=require(_0x48ac('0x5'));var util=require(_0x48ac('0x6'));var path=require(_0x48ac('0x7'));var sox=require(_0x48ac('0x8'));var csv=require(_0x48ac('0x9'));var ejs=require(_0x48ac('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48ac('0xb'));var squel=require('squel');var crypto=require(_0x48ac('0xc'));var jsforce=require(_0x48ac('0xd'));var deskjs=require(_0x48ac('0xe'));var toCsv=require(_0x48ac('0x9'));var querystring=require(_0x48ac('0xf'));var Papa=require(_0x48ac('0x10'));var Redis=require(_0x48ac('0x11'));var authService=require(_0x48ac('0x12'));var qs=require(_0x48ac('0x13'));var as=require(_0x48ac('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48ac('0x15'))(_0x48ac('0x16'));var utils=require(_0x48ac('0x17'));var config=require(_0x48ac('0x18'));var licenseUtil=require(_0x48ac('0x19'));var db=require(_0x48ac('0x1a'))['db'];function respondWithStatusCode(_0x4e7355,_0x5daf79){_0x5daf79=_0x5daf79||0xcc;return function(_0xb33bc8){if(_0xb33bc8){return _0x4e7355[_0x48ac('0x1b')](_0x5daf79);}return _0x4e7355[_0x48ac('0x1c')](_0x5daf79)['end']();};}function respondWithResult(_0x4570a6,_0x3a761e){_0x3a761e=_0x3a761e||0xc8;return function(_0x3e2752){if(_0x3e2752){return _0x4570a6[_0x48ac('0x1c')](_0x3a761e)['json'](_0x3e2752);}};}function respondWithFilteredResult(_0x1a2c64,_0x3e418d){return function(_0xd1593d){if(_0xd1593d){var _0x4c5fdc=typeof _0x3e418d[_0x48ac('0x1d')]===_0x48ac('0x1e')&&typeof _0x3e418d[_0x48ac('0x1f')]==='undefined';var _0x19755d=_0xd1593d[_0x48ac('0x20')];var _0x3c3d10=_0x4c5fdc?0x0:_0x3e418d['offset'];var _0x5c6df3=_0x4c5fdc?_0xd1593d[_0x48ac('0x20')]:_0x3e418d[_0x48ac('0x1d')]+_0x3e418d[_0x48ac('0x1f')];var _0x22a615;if(_0x5c6df3>=_0x19755d){_0x5c6df3=_0x19755d;_0x22a615=0xc8;}else{_0x22a615=0xce;}_0x1a2c64['status'](_0x22a615);return _0x1a2c64['set']('Content-Range',_0x3c3d10+'-'+_0x5c6df3+'/'+_0x19755d)[_0x48ac('0x21')](_0xd1593d);}return null;};}function patchUpdates(_0x4ea354){return function(_0x3a5909){try{jsonpatch[_0x48ac('0x22')](_0x3a5909,_0x4ea354,!![]);}catch(_0xd3352a){return BPromise[_0x48ac('0x23')](_0xd3352a);}return _0x3a5909[_0x48ac('0x24')]();};}function saveUpdates(_0x21777a,_0x490ef1){return function(_0x5562ea){if(_0x5562ea){return _0x5562ea[_0x48ac('0x25')](_0x21777a)[_0x48ac('0x26')](function(_0x5485ad){return _0x5485ad;});}return null;};}function removeEntity(_0x3d7926,_0x288e20){return function(_0x5645aa){if(_0x5645aa){return _0x5645aa[_0x48ac('0x27')]()[_0x48ac('0x26')](function(){_0x3d7926['status'](0xcc)[_0x48ac('0x28')]();});}};}function handleEntityNotFound(_0xd3dfb6,_0x33b8b3){return function(_0x175486){if(!_0x175486){_0xd3dfb6[_0x48ac('0x1b')](0x194);}return _0x175486;};}function handleError(_0x51a856,_0x5eb1d6){_0x5eb1d6=_0x5eb1d6||0x1f4;return function(_0xead6c){logger['error'](_0xead6c['stack']);if(_0xead6c[_0x48ac('0x29')]){delete _0xead6c[_0x48ac('0x29')];}_0x51a856[_0x48ac('0x1c')](_0x5eb1d6)[_0x48ac('0x2a')](_0xead6c);};}function getMustacheRender(_0x58d868,_0x41b24c){return Mustache['render'](_0x58d868,_['merge'](_0x41b24c[_0x48ac('0x2b')],{'contact':_0x41b24c[_0x48ac('0x2c')],'message':_0x41b24c[_0x48ac('0x2d')],'agent':_0x41b24c[_0x48ac('0x2e')],'interaction':_0x41b24c[_0x48ac('0x2f')],'account':_0x41b24c[_0x48ac('0x30')]}))||'';}exports[_0x48ac('0x31')]=function(_0x405b32,_0x23bae6){var _0x5f0df5={},_0x5553df={},_0x335b19={'count':0x0,'rows':[]};var _0x4ec549=_['map'](db[_0x48ac('0x32')][_0x48ac('0x33')],function(_0x5dd3b3){return{'name':_0x5dd3b3[_0x48ac('0x34')],'type':_0x5dd3b3[_0x48ac('0x35')][_0x48ac('0x36')]};});_0x5553df['model']=_[_0x48ac('0x37')](_0x4ec549,'name');_0x5553df[_0x48ac('0x38')]=_[_0x48ac('0x39')](_0x405b32['query']);_0x5553df[_0x48ac('0x3a')]=_[_0x48ac('0x3b')](_0x5553df['model'],_0x5553df[_0x48ac('0x38')]);_0x5f0df5[_0x48ac('0x3c')]=_[_0x48ac('0x3b')](_0x5553df[_0x48ac('0x3d')],qs['fields'](_0x405b32[_0x48ac('0x38')][_0x48ac('0x3e')]));_0x5f0df5['attributes']=_0x5f0df5[_0x48ac('0x3c')][_0x48ac('0x3f')]?_0x5f0df5[_0x48ac('0x3c')]:_0x5553df[_0x48ac('0x3d')];if(!_0x405b32[_0x48ac('0x38')][_0x48ac('0x40')](_0x48ac('0x41'))){_0x5f0df5[_0x48ac('0x1f')]=qs[_0x48ac('0x1f')](_0x405b32[_0x48ac('0x38')][_0x48ac('0x1f')]);_0x5f0df5['offset']=qs[_0x48ac('0x1d')](_0x405b32[_0x48ac('0x38')][_0x48ac('0x1d')]);}_0x5f0df5['order']=qs[_0x48ac('0x42')](_0x405b32[_0x48ac('0x38')]['sort']);_0x5f0df5[_0x48ac('0x43')]=qs[_0x48ac('0x3a')](_['pick'](_0x405b32[_0x48ac('0x38')],_0x5553df['filters']),_0x4ec549);if(_0x405b32[_0x48ac('0x38')][_0x48ac('0x44')]){_0x5f0df5[_0x48ac('0x43')]=_[_0x48ac('0x45')](_0x5f0df5[_0x48ac('0x43')],{'$or':_[_0x48ac('0x37')](_0x4ec549,function(_0x3298ea){if(_0x3298ea[_0x48ac('0x35')]!=='VIRTUAL'){var _0x5d7cae={};_0x5d7cae[_0x3298ea[_0x48ac('0x29')]]={'$like':'%'+_0x405b32[_0x48ac('0x38')][_0x48ac('0x44')]+'%'};return _0x5d7cae;}})});}_0x5f0df5=_[_0x48ac('0x45')]({},_0x5f0df5,_0x405b32[_0x48ac('0x46')]);var _0x34665f={'where':_0x5f0df5['where']};return db['VoiceAgentReport'][_0x48ac('0x20')](_0x34665f)['then'](function(_0xde727b){_0x335b19[_0x48ac('0x20')]=_0xde727b;if(_0x405b32['query'][_0x48ac('0x47')]){_0x5f0df5[_0x48ac('0x48')]=[{'all':!![]}];}return db[_0x48ac('0x32')][_0x48ac('0x49')](_0x5f0df5);})[_0x48ac('0x26')](function(_0x32d13f){_0x335b19[_0x48ac('0x4a')]=_0x32d13f;return _0x335b19;})[_0x48ac('0x26')](respondWithFilteredResult(_0x23bae6,_0x5f0df5))[_0x48ac('0x4b')](handleError(_0x23bae6,null));};exports['show']=function(_0x59b761,_0x16c509){var _0x3847b3={'raw':![],'where':{'id':_0x59b761[_0x48ac('0x4c')]['id']}},_0x574642={};_0x574642[_0x48ac('0x3d')]=_[_0x48ac('0x39')](db[_0x48ac('0x32')][_0x48ac('0x33')]);_0x574642[_0x48ac('0x38')]=_['keys'](_0x59b761[_0x48ac('0x38')]);_0x574642[_0x48ac('0x3a')]=_[_0x48ac('0x3b')](_0x574642['model'],_0x574642[_0x48ac('0x38')]);_0x3847b3[_0x48ac('0x3c')]=_[_0x48ac('0x3b')](_0x574642[_0x48ac('0x3d')],qs[_0x48ac('0x3e')](_0x59b761[_0x48ac('0x38')][_0x48ac('0x3e')]));_0x3847b3['attributes']=_0x3847b3['attributes'][_0x48ac('0x3f')]?_0x3847b3[_0x48ac('0x3c')]:_0x574642[_0x48ac('0x3d')];if(_0x59b761[_0x48ac('0x38')][_0x48ac('0x47')]){_0x3847b3[_0x48ac('0x48')]=[{'all':!![]}];}_0x3847b3=_[_0x48ac('0x45')]({},_0x3847b3,_0x59b761[_0x48ac('0x46')]);return db[_0x48ac('0x32')][_0x48ac('0x4d')](_0x3847b3)[_0x48ac('0x26')](handleEntityNotFound(_0x16c509,null))[_0x48ac('0x26')](respondWithResult(_0x16c509,null))[_0x48ac('0x4b')](handleError(_0x16c509,null));};exports[_0x48ac('0x4e')]=function(_0x3efe1a,_0x4789e3){return db[_0x48ac('0x32')][_0x48ac('0x4e')](_0x3efe1a['body'],{})['then'](respondWithResult(_0x4789e3,0xc9))[_0x48ac('0x4b')](handleError(_0x4789e3,null));};exports['update']=function(_0x5c0db8,_0x395e8e){if(_0x5c0db8[_0x48ac('0x2b')]['id']){delete _0x5c0db8[_0x48ac('0x2b')]['id'];}return db[_0x48ac('0x32')][_0x48ac('0x4d')]({'where':{'id':_0x5c0db8[_0x48ac('0x4c')]['id']}})[_0x48ac('0x26')](handleEntityNotFound(_0x395e8e,null))[_0x48ac('0x26')](saveUpdates(_0x5c0db8[_0x48ac('0x2b')],null))[_0x48ac('0x26')](respondWithResult(_0x395e8e,null))[_0x48ac('0x4b')](handleError(_0x395e8e,null));};exports['destroy']=function(_0x163630,_0x5f17d6){return db[_0x48ac('0x32')]['find']({'where':{'id':_0x163630[_0x48ac('0x4c')]['id']}})[_0x48ac('0x26')](handleEntityNotFound(_0x5f17d6,null))[_0x48ac('0x26')](removeEntity(_0x5f17d6,null))['catch'](handleError(_0x5f17d6,null));};exports[_0x48ac('0x4f')]=function(_0x4e924b,_0xcfcb0c){return db['VoiceAgentReport'][_0x48ac('0x4f')]()[_0x48ac('0x26')](respondWithResult(_0xcfcb0c,null))[_0x48ac('0x4b')](handleError(_0xcfcb0c,null));}; \ No newline at end of file +var _0x5e01=['name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','save','update','then','destroy','end','error','stack','send','render','merge','contact','account','index','map','VoiceAgentReport','rawAttributes','fieldName','key','model'];(function(_0x20f75c,_0x332fc7){var _0xe4c44d=function(_0x4f48e7){while(--_0x4f48e7){_0x20f75c['push'](_0x20f75c['shift']());}};_0xe4c44d(++_0x332fc7);}(_0x5e01,0x1a7));var _0x15e0=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x5e01[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0x15e0('0x0'));var rimraf=require(_0x15e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x15e0('0x2'));var moment=require('moment');var BPromise=require(_0x15e0('0x3'));var Mustache=require(_0x15e0('0x4'));var util=require(_0x15e0('0x5'));var path=require('path');var sox=require(_0x15e0('0x6'));var csv=require(_0x15e0('0x7'));var ejs=require(_0x15e0('0x8'));var fs=require('fs');var fs_extra=require(_0x15e0('0x9'));var _=require(_0x15e0('0xa'));var squel=require('squel');var crypto=require(_0x15e0('0xb'));var jsforce=require(_0x15e0('0xc'));var deskjs=require(_0x15e0('0xd'));var toCsv=require(_0x15e0('0x7'));var querystring=require(_0x15e0('0xe'));var Papa=require('papaparse');var Redis=require(_0x15e0('0xf'));var authService=require(_0x15e0('0x10'));var qs=require(_0x15e0('0x11'));var as=require(_0x15e0('0x12'));var hardwareService=require(_0x15e0('0x13'));var logger=require(_0x15e0('0x14'))('api');var utils=require(_0x15e0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x15e0('0x16'));var db=require(_0x15e0('0x17'))['db'];function respondWithStatusCode(_0xb2aecb,_0x3728d6){_0x3728d6=_0x3728d6||0xcc;return function(_0x110437){if(_0x110437){return _0xb2aecb[_0x15e0('0x18')](_0x3728d6);}return _0xb2aecb[_0x15e0('0x19')](_0x3728d6)['end']();};}function respondWithResult(_0x243b2e,_0x5de4ad){_0x5de4ad=_0x5de4ad||0xc8;return function(_0x17759a){if(_0x17759a){return _0x243b2e[_0x15e0('0x19')](_0x5de4ad)[_0x15e0('0x1a')](_0x17759a);}};}function respondWithFilteredResult(_0x44cf20,_0x1b951f){return function(_0x3361f7){if(_0x3361f7){var _0x15230d=typeof _0x1b951f[_0x15e0('0x1b')]===_0x15e0('0x1c')&&typeof _0x1b951f['limit']===_0x15e0('0x1c');var _0xc9e295=_0x3361f7[_0x15e0('0x1d')];var _0x1242d4=_0x15230d?0x0:_0x1b951f[_0x15e0('0x1b')];var _0x55a1c4=_0x15230d?_0x3361f7[_0x15e0('0x1d')]:_0x1b951f[_0x15e0('0x1b')]+_0x1b951f[_0x15e0('0x1e')];var _0x4f3e2f;if(_0x55a1c4>=_0xc9e295){_0x55a1c4=_0xc9e295;_0x4f3e2f=0xc8;}else{_0x4f3e2f=0xce;}_0x44cf20[_0x15e0('0x19')](_0x4f3e2f);return _0x44cf20['set']('Content-Range',_0x1242d4+'-'+_0x55a1c4+'/'+_0xc9e295)['json'](_0x3361f7);}return null;};}function patchUpdates(_0x4eb438){return function(_0xa32751){try{jsonpatch[_0x15e0('0x1f')](_0xa32751,_0x4eb438,!![]);}catch(_0x1a9532){return BPromise['reject'](_0x1a9532);}return _0xa32751[_0x15e0('0x20')]();};}function saveUpdates(_0x5010a4,_0x18d07a){return function(_0x4c549a){if(_0x4c549a){return _0x4c549a[_0x15e0('0x21')](_0x5010a4)[_0x15e0('0x22')](function(_0x303655){return _0x303655;});}return null;};}function removeEntity(_0x51c2a1,_0x37782f){return function(_0x26e791){if(_0x26e791){return _0x26e791[_0x15e0('0x23')]()[_0x15e0('0x22')](function(){_0x51c2a1['status'](0xcc)[_0x15e0('0x24')]();});}};}function handleEntityNotFound(_0x5bf15d,_0x4c8117){return function(_0x64b1ba){if(!_0x64b1ba){_0x5bf15d['sendStatus'](0x194);}return _0x64b1ba;};}function handleError(_0x165810,_0x347fa3){_0x347fa3=_0x347fa3||0x1f4;return function(_0x10b919){logger[_0x15e0('0x25')](_0x10b919[_0x15e0('0x26')]);if(_0x10b919['name']){delete _0x10b919['name'];}_0x165810['status'](_0x347fa3)[_0x15e0('0x27')](_0x10b919);};}function getMustacheRender(_0x3e8643,_0x45ef6e){return Mustache[_0x15e0('0x28')](_0x3e8643,_[_0x15e0('0x29')](_0x45ef6e['body'],{'contact':_0x45ef6e[_0x15e0('0x2a')],'message':_0x45ef6e['message'],'agent':_0x45ef6e['agent'],'interaction':_0x45ef6e['interaction'],'account':_0x45ef6e[_0x15e0('0x2b')]}))||'';}exports[_0x15e0('0x2c')]=function(_0x35a73b,_0x2a0925){var _0x3750a1={},_0x2723ec={},_0x45e256={'count':0x0,'rows':[]};var _0x4e4b1c=_[_0x15e0('0x2d')](db[_0x15e0('0x2e')][_0x15e0('0x2f')],function(_0x2cca50){return{'name':_0x2cca50[_0x15e0('0x30')],'type':_0x2cca50['type'][_0x15e0('0x31')]};});_0x2723ec[_0x15e0('0x32')]=_[_0x15e0('0x2d')](_0x4e4b1c,_0x15e0('0x33'));_0x2723ec[_0x15e0('0x34')]=_[_0x15e0('0x35')](_0x35a73b[_0x15e0('0x34')]);_0x2723ec['filters']=_[_0x15e0('0x36')](_0x2723ec[_0x15e0('0x32')],_0x2723ec['query']);_0x3750a1[_0x15e0('0x37')]=_['intersection'](_0x2723ec[_0x15e0('0x32')],qs[_0x15e0('0x38')](_0x35a73b[_0x15e0('0x34')]['fields']));_0x3750a1[_0x15e0('0x37')]=_0x3750a1['attributes']['length']?_0x3750a1[_0x15e0('0x37')]:_0x2723ec['model'];if(!_0x35a73b[_0x15e0('0x34')][_0x15e0('0x39')](_0x15e0('0x3a'))){_0x3750a1[_0x15e0('0x1e')]=qs[_0x15e0('0x1e')](_0x35a73b[_0x15e0('0x34')]['limit']);_0x3750a1[_0x15e0('0x1b')]=qs[_0x15e0('0x1b')](_0x35a73b['query'][_0x15e0('0x1b')]);}_0x3750a1[_0x15e0('0x3b')]=qs[_0x15e0('0x3c')](_0x35a73b[_0x15e0('0x34')][_0x15e0('0x3c')]);_0x3750a1[_0x15e0('0x3d')]=qs[_0x15e0('0x3e')](_[_0x15e0('0x3f')](_0x35a73b['query'],_0x2723ec[_0x15e0('0x3e')]),_0x4e4b1c);if(_0x35a73b[_0x15e0('0x34')][_0x15e0('0x40')]){_0x3750a1[_0x15e0('0x3d')]=_[_0x15e0('0x29')](_0x3750a1[_0x15e0('0x3d')],{'$or':_[_0x15e0('0x2d')](_0x4e4b1c,function(_0x383ba6){if(_0x383ba6[_0x15e0('0x41')]!==_0x15e0('0x42')){var _0x205f90={};_0x205f90[_0x383ba6[_0x15e0('0x33')]]={'$like':'%'+_0x35a73b[_0x15e0('0x34')][_0x15e0('0x40')]+'%'};return _0x205f90;}})});}_0x3750a1=_[_0x15e0('0x29')]({},_0x3750a1,_0x35a73b[_0x15e0('0x43')]);var _0x1f55ca={'where':_0x3750a1[_0x15e0('0x3d')]};return db[_0x15e0('0x2e')][_0x15e0('0x1d')](_0x1f55ca)[_0x15e0('0x22')](function(_0x1a88b4){_0x45e256['count']=_0x1a88b4;if(_0x35a73b[_0x15e0('0x34')]['includeAll']){_0x3750a1[_0x15e0('0x44')]=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x3750a1);})[_0x15e0('0x22')](function(_0xf68de8){_0x45e256[_0x15e0('0x45')]=_0xf68de8;return _0x45e256;})[_0x15e0('0x22')](respondWithFilteredResult(_0x2a0925,_0x3750a1))[_0x15e0('0x46')](handleError(_0x2a0925,null));};exports[_0x15e0('0x47')]=function(_0x3a6eed,_0x3900a0){var _0x509b1b={'raw':![],'where':{'id':_0x3a6eed[_0x15e0('0x48')]['id']}},_0x4f7f5c={};_0x4f7f5c[_0x15e0('0x32')]=_[_0x15e0('0x35')](db[_0x15e0('0x2e')]['rawAttributes']);_0x4f7f5c['query']=_['keys'](_0x3a6eed['query']);_0x4f7f5c['filters']=_[_0x15e0('0x36')](_0x4f7f5c[_0x15e0('0x32')],_0x4f7f5c[_0x15e0('0x34')]);_0x509b1b[_0x15e0('0x37')]=_[_0x15e0('0x36')](_0x4f7f5c[_0x15e0('0x32')],qs[_0x15e0('0x38')](_0x3a6eed[_0x15e0('0x34')][_0x15e0('0x38')]));_0x509b1b[_0x15e0('0x37')]=_0x509b1b[_0x15e0('0x37')][_0x15e0('0x49')]?_0x509b1b[_0x15e0('0x37')]:_0x4f7f5c[_0x15e0('0x32')];if(_0x3a6eed[_0x15e0('0x34')][_0x15e0('0x4a')]){_0x509b1b[_0x15e0('0x44')]=[{'all':!![]}];}_0x509b1b=_['merge']({},_0x509b1b,_0x3a6eed['options']);return db[_0x15e0('0x2e')][_0x15e0('0x4b')](_0x509b1b)['then'](handleEntityNotFound(_0x3900a0,null))['then'](respondWithResult(_0x3900a0,null))[_0x15e0('0x46')](handleError(_0x3900a0,null));};exports[_0x15e0('0x4c')]=function(_0x232318,_0x12821e){return db['VoiceAgentReport'][_0x15e0('0x4c')](_0x232318[_0x15e0('0x4d')],{})[_0x15e0('0x22')](respondWithResult(_0x12821e,0xc9))['catch'](handleError(_0x12821e,null));};exports[_0x15e0('0x21')]=function(_0x5581b4,_0x2247bd){if(_0x5581b4['body']['id']){delete _0x5581b4[_0x15e0('0x4d')]['id'];}return db[_0x15e0('0x2e')][_0x15e0('0x4b')]({'where':{'id':_0x5581b4[_0x15e0('0x48')]['id']}})['then'](handleEntityNotFound(_0x2247bd,null))[_0x15e0('0x22')](saveUpdates(_0x5581b4[_0x15e0('0x4d')],null))[_0x15e0('0x22')](respondWithResult(_0x2247bd,null))[_0x15e0('0x46')](handleError(_0x2247bd,null));};exports['destroy']=function(_0x82d4f5,_0x2f8375){return db[_0x15e0('0x2e')]['find']({'where':{'id':_0x82d4f5[_0x15e0('0x48')]['id']}})[_0x15e0('0x22')](handleEntityNotFound(_0x2f8375,null))['then'](removeEntity(_0x2f8375,null))[_0x15e0('0x46')](handleError(_0x2f8375,null));};exports['describe']=function(_0x5c59b9,_0x4eeb9f){return db[_0x15e0('0x2e')][_0x15e0('0x4e')]()['then'](respondWithResult(_0x4eeb9f,null))[_0x15e0('0x46')](handleError(_0x4eeb9f,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 4d52325..ff90ba8 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 _0x4615=['exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x5c6694,_0x83a29b){var _0x570cce=function(_0x48cbb1){while(--_0x48cbb1){_0x5c6694['push'](_0x5c6694['shift']());}};_0x570cce(++_0x83a29b);}(_0x4615,0xae));var _0x5461=function(_0x344c2f,_0xd8aef6){_0x344c2f=_0x344c2f-0x0;var _0x5cdc48=_0x4615[_0x344c2f];return _0x5cdc48;};'use strict';var _=require(_0x5461('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5461('0x1'));var moment=require(_0x5461('0x2'));var BPromise=require('bluebird');var rp=require(_0x5461('0x3'));var fs=require('fs');var path=require(_0x5461('0x4'));var rimraf=require(_0x5461('0x5'));var config=require(_0x5461('0x6'));var attributes=require(_0x5461('0x7'));module[_0x5461('0x8')]=function(_0x1e4d2c,_0x55b924){return _0x1e4d2c[_0x5461('0x9')](_0x5461('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x5461('0xb'),_0x5461('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c47=['VoiceAgentReport','uniqueid','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x535bcd,_0x1575af){var _0x42f269=function(_0x1463da){while(--_0x1463da){_0x535bcd['push'](_0x535bcd['shift']());}};_0x42f269(++_0x1575af);}(_0x5c47,0x142));var _0x75c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c47[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x75c4('0x0'));var util=require(_0x75c4('0x1'));var logger=require('../../config/logger')(_0x75c4('0x2'));var moment=require(_0x75c4('0x3'));var BPromise=require(_0x75c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x75c4('0x5'));var config=require(_0x75c4('0x6'));var attributes=require(_0x75c4('0x7'));module['exports']=function(_0x5d4bc2,_0x1f9b81){return _0x5d4bc2['define'](_0x75c4('0x8'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x75c4('0x9'),'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 20bf8f2..9922141 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 _0xe14f=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','UpdateVoiceAgentReport','update','raw','where','attributes','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5044a6,_0x2296f3){var _0x4041db=function(_0x127606){while(--_0x127606){_0x5044a6['push'](_0x5044a6['shift']());}};_0x4041db(++_0x2296f3);}(_0xe14f,0x9f));var _0xfe14=function(_0x2866ca,_0x58d520){_0x2866ca=_0x2866ca-0x0;var _0x24fe85=_0xe14f[_0x2866ca];return _0x24fe85;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfe14('0x0'));var BPromise=require(_0xfe14('0x1'));var rs=require(_0xfe14('0x2'));var fs=require('fs');var Redis=require(_0xfe14('0x3'));var db=require(_0xfe14('0x4'))['db'];var utils=require(_0xfe14('0x5'));var logger=require(_0xfe14('0x6'))('rpc');var config=require(_0xfe14('0x7'));var jayson=require(_0xfe14('0x8'));var client=jayson[_0xfe14('0x9')][_0xfe14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b4642,_0xa854a9,_0x3059bc){return new BPromise(function(_0x679a3f,_0x4af71c){return client[_0xfe14('0xb')](_0x5b4642,_0x3059bc)[_0xfe14('0xc')](function(_0x4495e9){logger[_0xfe14('0xd')](_0xfe14('0xe'),_0xa854a9,_0xfe14('0xf'));logger[_0xfe14('0x10')](_0xfe14('0x11'),_0xa854a9,_0xfe14('0xf'),JSON[_0xfe14('0x12')](_0x4495e9));if(_0x4495e9[_0xfe14('0x13')]){if(_0x4495e9[_0xfe14('0x13')][_0xfe14('0x14')]===0x1f4){logger['error'](_0xfe14('0xe'),_0xa854a9,_0x4495e9[_0xfe14('0x13')]['message']);return _0x4af71c(_0x4495e9[_0xfe14('0x13')]['message']);}logger[_0xfe14('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0xa854a9,_0x4495e9[_0xfe14('0x13')][_0xfe14('0x15')]);return _0x679a3f(_0x4495e9[_0xfe14('0x13')][_0xfe14('0x15')]);}else{logger['info'](_0xfe14('0xe'),_0xa854a9,'request\x20sent');_0x679a3f(_0x4495e9[_0xfe14('0x16')][_0xfe14('0x15')]);}})[_0xfe14('0x17')](function(_0x540432){logger[_0xfe14('0x13')](_0xfe14('0xe'),_0xa854a9,_0x540432);_0x4af71c(_0x540432);});});}exports[_0xfe14('0x18')]=function(_0x2ba1f4){var _0x3849a5=this;return new Promise(function(_0xb4cde1,_0x408070){return db[_0xfe14('0x19')]['create'](_0x2ba1f4[_0xfe14('0x1a')],{'raw':_0x2ba1f4[_0xfe14('0x1b')]?_0x2ba1f4[_0xfe14('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xfe14('0xc')](function(_0xcbd56a){logger[_0xfe14('0xd')](_0xfe14('0x18'),_0x2ba1f4);logger[_0xfe14('0x10')](_0xfe14('0x18'),_0x2ba1f4,JSON[_0xfe14('0x12')](_0xcbd56a));_0xb4cde1(_0xcbd56a);})[_0xfe14('0x17')](function(_0x2c7f69){logger[_0xfe14('0x13')](_0xfe14('0x18'),_0x2c7f69['message'],_0x2ba1f4);_0x408070(_0x3849a5[_0xfe14('0x13')](0x1f4,_0x2c7f69[_0xfe14('0x15')]));});});};exports[_0xfe14('0x1c')]=function(_0x4f48f7){var _0x4599d1=this;return new Promise(function(_0x1a11ce,_0x362ee8){return db['VoiceAgentReport'][_0xfe14('0x1d')](_0x4f48f7[_0xfe14('0x1a')],{'raw':_0x4f48f7[_0xfe14('0x1b')]?_0x4f48f7[_0xfe14('0x1b')][_0xfe14('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f48f7[_0xfe14('0x1b')]?_0x4f48f7['options'][_0xfe14('0x1f')]||null:null,'attributes':_0x4f48f7['options']?_0x4f48f7[_0xfe14('0x1b')][_0xfe14('0x20')]||null:null,'limit':_0x4f48f7[_0xfe14('0x1b')]?_0x4f48f7[_0xfe14('0x1b')]['limit']||null:null})[_0xfe14('0xc')](function(_0x15e637){logger['info'](_0xfe14('0x1c'),_0x4f48f7);logger[_0xfe14('0x10')](_0xfe14('0x1c'),_0x4f48f7,JSON[_0xfe14('0x12')](_0x15e637));_0x1a11ce(_0x15e637);})[_0xfe14('0x17')](function(_0x4fb124){logger[_0xfe14('0x13')]('UpdateVoiceAgentReport',_0x4fb124[_0xfe14('0x15')],_0x4f48f7);_0x362ee8(_0x4599d1[_0xfe14('0x13')](0x1f4,_0x4fb124[_0xfe14('0x15')]));});});}; \ No newline at end of file +var _0x8fa5=['CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1938f4,_0x5c0c98){var _0x37f4db=function(_0x5bec0c){while(--_0x5bec0c){_0x1938f4['push'](_0x1938f4['shift']());}};_0x37f4db(++_0x5c0c98);}(_0x8fa5,0xa5));var _0x58fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8fa5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x58fa('0x0'));var util=require(_0x58fa('0x1'));var moment=require(_0x58fa('0x2'));var BPromise=require(_0x58fa('0x3'));var rs=require(_0x58fa('0x4'));var fs=require('fs');var Redis=require(_0x58fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x58fa('0x6'));var config=require('../../config/environment');var jayson=require(_0x58fa('0x7'));var client=jayson[_0x58fa('0x8')][_0x58fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5819d9,_0x46e063,_0xeb42a0){return new BPromise(function(_0x3d2022,_0x1e5234){return client[_0x58fa('0xa')](_0x5819d9,_0xeb42a0)[_0x58fa('0xb')](function(_0x4c6471){logger[_0x58fa('0xc')](_0x58fa('0xd'),_0x46e063,_0x58fa('0xe'));logger[_0x58fa('0xf')](_0x58fa('0x10'),_0x46e063,'request\x20sent',JSON[_0x58fa('0x11')](_0x4c6471));if(_0x4c6471[_0x58fa('0x12')]){if(_0x4c6471[_0x58fa('0x12')]['code']===0x1f4){logger[_0x58fa('0x12')](_0x58fa('0xd'),_0x46e063,_0x4c6471[_0x58fa('0x12')]['message']);return _0x1e5234(_0x4c6471['error']['message']);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x46e063,_0x4c6471['error'][_0x58fa('0x13')]);return _0x3d2022(_0x4c6471['error'][_0x58fa('0x13')]);}else{logger[_0x58fa('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x46e063,_0x58fa('0xe'));_0x3d2022(_0x4c6471[_0x58fa('0x14')][_0x58fa('0x13')]);}})['catch'](function(_0x25199c){logger[_0x58fa('0x12')](_0x58fa('0xd'),_0x46e063,_0x25199c);_0x1e5234(_0x25199c);});});}exports[_0x58fa('0x15')]=function(_0x5952f5){var _0x18cc24=this;return new Promise(function(_0x1c1bc2,_0x319562){return db[_0x58fa('0x16')][_0x58fa('0x17')](_0x5952f5[_0x58fa('0x18')],{'raw':_0x5952f5[_0x58fa('0x19')]?_0x5952f5[_0x58fa('0x19')][_0x58fa('0x1a')]===undefined?!![]:![]:!![]})[_0x58fa('0xb')](function(_0x4410a7){logger[_0x58fa('0xc')](_0x58fa('0x15'),_0x5952f5);logger['debug'](_0x58fa('0x15'),_0x5952f5,JSON[_0x58fa('0x11')](_0x4410a7));_0x1c1bc2(_0x4410a7);})['catch'](function(_0x594e82){logger[_0x58fa('0x12')](_0x58fa('0x15'),_0x594e82[_0x58fa('0x13')],_0x5952f5);_0x319562(_0x18cc24['error'](0x1f4,_0x594e82[_0x58fa('0x13')]));});});};exports[_0x58fa('0x1b')]=function(_0x185933){var _0x59b87a=this;return new Promise(function(_0x39999a,_0x1147f8){return db[_0x58fa('0x16')]['update'](_0x185933[_0x58fa('0x18')],{'raw':_0x185933[_0x58fa('0x19')]?_0x185933[_0x58fa('0x19')][_0x58fa('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x185933[_0x58fa('0x19')]?_0x185933[_0x58fa('0x19')]['where']||null:null,'attributes':_0x185933[_0x58fa('0x19')]?_0x185933[_0x58fa('0x19')][_0x58fa('0x1c')]||null:null,'limit':_0x185933[_0x58fa('0x19')]?_0x185933[_0x58fa('0x19')][_0x58fa('0x1d')]||null:null})['then'](function(_0x13676f){logger['info']('UpdateVoiceAgentReport',_0x185933);logger[_0x58fa('0xf')]('UpdateVoiceAgentReport',_0x185933,JSON[_0x58fa('0x11')](_0x13676f));_0x39999a(_0x13676f);})[_0x58fa('0x1e')](function(_0x2038bd){logger[_0x58fa('0x12')](_0x58fa('0x1b'),_0x2038bd['message'],_0x185933);_0x1147f8(_0x59b87a['error'](0x1f4,_0x2038bd[_0x58fa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 6633707..88a4430 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.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(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 673bd83..367772c 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 _0x207c=['dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax'];(function(_0x2fed3e,_0x11013d){var _0x247181=function(_0xb875c1){while(--_0xb875c1){_0x2fed3e['push'](_0x2fed3e['shift']());}};_0x247181(++_0x11013d);}(_0x207c,0x1e8));var _0xc207=function(_0x40c1a9,_0x2b26c1){_0x40c1a9=_0x40c1a9-0x0;var _0x859fd2=_0x207c[_0x40c1a9];return _0x859fd2;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'uniqueid':{'type':Sequelize[_0xc207('0x1')]},'type':{'type':Sequelize[_0xc207('0x2')](_0xc207('0x3'),_0xc207('0x4'),_0xc207('0x5'),_0xc207('0x6'),'outbound-fax',_0xc207('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xc207('0x1')]},'destinationcontext':{'type':Sequelize[_0xc207('0x1')]},'callerid':{'type':Sequelize[_0xc207('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xc207('0x1')]},'lastapplication':{'type':Sequelize[_0xc207('0x1')]},'lastdata':{'type':Sequelize[_0xc207('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xc207('0x9')]},'answertime':{'type':Sequelize[_0xc207('0x9')]},'endtime':{'type':Sequelize[_0xc207('0x9')]},'duration':{'type':Sequelize[_0xc207('0xa')]},'billableseconds':{'type':Sequelize[_0xc207('0xa')]},'mohtime':{'type':Sequelize[_0xc207('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xc207('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc207('0x1')]},'note':{'type':Sequelize[_0xc207('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xc207('0xa')]},'sipcallid':{'type':Sequelize[_0xc207('0x1')]}}; \ No newline at end of file +var _0x3eea=['DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0xc4b7d4,_0x333e4d){var _0x42e67f=function(_0x42c425){while(--_0x42c425){_0xc4b7d4['push'](_0xc4b7d4['shift']());}};_0x42e67f(++_0x333e4d);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x34e6e1,_0xdfe4d6){_0x34e6e1=_0x34e6e1-0x0;var _0x3d73cc=_0x3eea[_0x34e6e1];return _0x3d73cc;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa3ee('0x1')]},'type':{'type':Sequelize[_0xa3ee('0x2')](_0xa3ee('0x3'),_0xa3ee('0x4'),_0xa3ee('0x5'),_0xa3ee('0x6'),_0xa3ee('0x7'),_0xa3ee('0x8'))},'tag':{'type':Sequelize[_0xa3ee('0x1')]},'accountcode':{'type':Sequelize[_0xa3ee('0x1')]},'source':{'type':Sequelize[_0xa3ee('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa3ee('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xa3ee('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xa3ee('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xa3ee('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa3ee('0xa')]},'duration':{'type':Sequelize[_0xa3ee('0xb')]},'billableseconds':{'type':Sequelize[_0xa3ee('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa3ee('0x1')]},'amaflags':{'type':Sequelize[_0xa3ee('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xa3ee('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xa3ee('0x1')]},'note':{'type':Sequelize[_0xa3ee('0x1')]},'prefix':{'type':Sequelize[_0xa3ee('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xa3ee('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 501bd25..2016e42 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 _0x6e1c=['show','params','keys','create','find','describe','uniqueid','user','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','render','body','contact','message','agent','interaction','index','map','VoiceCallReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','fullname','alias','User','findAll','rows','catch'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc6e1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e1('0x1'));var rp=require(_0xc6e1('0x2'));var moment=require(_0xc6e1('0x3'));var BPromise=require(_0xc6e1('0x4'));var Mustache=require(_0xc6e1('0x5'));var util=require(_0xc6e1('0x6'));var path=require(_0xc6e1('0x7'));var sox=require(_0xc6e1('0x8'));var csv=require(_0xc6e1('0x9'));var ejs=require(_0xc6e1('0xa'));var fs=require('fs');var fs_extra=require(_0xc6e1('0xb'));var _=require('lodash');var squel=require(_0xc6e1('0xc'));var crypto=require(_0xc6e1('0xd'));var jsforce=require(_0xc6e1('0xe'));var deskjs=require(_0xc6e1('0xf'));var toCsv=require(_0xc6e1('0x9'));var querystring=require('querystring');var Papa=require(_0xc6e1('0x10'));var Redis=require(_0xc6e1('0x11'));var authService=require(_0xc6e1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6e1('0x13'));var logger=require(_0xc6e1('0x14'))('api');var utils=require(_0xc6e1('0x15'));var config=require(_0xc6e1('0x16'));var licenseUtil=require(_0xc6e1('0x17'));var db=require(_0xc6e1('0x18'))['db'];function respondWithStatusCode(_0x22b511,_0x3526e7){_0x3526e7=_0x3526e7||0xcc;return function(_0x543048){if(_0x543048){return _0x22b511[_0xc6e1('0x19')](_0x3526e7);}return _0x22b511[_0xc6e1('0x1a')](_0x3526e7)[_0xc6e1('0x1b')]();};}function respondWithResult(_0x2d554f,_0x3573dd){_0x3573dd=_0x3573dd||0xc8;return function(_0x5a7e25){if(_0x5a7e25){return _0x2d554f['status'](_0x3573dd)[_0xc6e1('0x1c')](_0x5a7e25);}};}function respondWithFilteredResult(_0x30428e,_0x5da248){return function(_0x6a58af){if(_0x6a58af){var _0x580fae=typeof _0x5da248[_0xc6e1('0x1d')]==='undefined'&&typeof _0x5da248[_0xc6e1('0x1e')]===_0xc6e1('0x1f');var _0x18dad6=_0x6a58af[_0xc6e1('0x20')];var _0x527c70=_0x580fae?0x0:_0x5da248[_0xc6e1('0x1d')];var _0x2b8b22=_0x580fae?_0x6a58af[_0xc6e1('0x20')]:_0x5da248[_0xc6e1('0x1d')]+_0x5da248[_0xc6e1('0x1e')];var _0x40c19c;if(_0x2b8b22>=_0x18dad6){_0x2b8b22=_0x18dad6;_0x40c19c=0xc8;}else{_0x40c19c=0xce;}_0x30428e[_0xc6e1('0x1a')](_0x40c19c);return _0x30428e[_0xc6e1('0x21')](_0xc6e1('0x22'),_0x527c70+'-'+_0x2b8b22+'/'+_0x18dad6)[_0xc6e1('0x1c')](_0x6a58af);}return null;};}function patchUpdates(_0x23369a){return function(_0x816a){try{jsonpatch[_0xc6e1('0x23')](_0x816a,_0x23369a,!![]);}catch(_0x107ab7){return BPromise['reject'](_0x107ab7);}return _0x816a[_0xc6e1('0x24')]();};}function saveUpdates(_0x255ae1,_0x1ed09e){return function(_0x36c460){if(_0x36c460){return _0x36c460[_0xc6e1('0x25')](_0x255ae1)[_0xc6e1('0x26')](function(_0x571aa7){return _0x571aa7;});}return null;};}function removeEntity(_0x484d0c,_0x40b059){return function(_0x5597d3){if(_0x5597d3){return _0x5597d3[_0xc6e1('0x27')]()[_0xc6e1('0x26')](function(){_0x484d0c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e284e,_0x431cca){return function(_0x5b0537){if(!_0x5b0537){_0x2e284e[_0xc6e1('0x19')](0x194);}return _0x5b0537;};}function handleError(_0x17d658,_0x4de357){_0x4de357=_0x4de357||0x1f4;return function(_0x400687){logger[_0xc6e1('0x28')](_0x400687[_0xc6e1('0x29')]);if(_0x400687[_0xc6e1('0x2a')]){delete _0x400687[_0xc6e1('0x2a')];}_0x17d658[_0xc6e1('0x1a')](_0x4de357)['send'](_0x400687);};}function getMustacheRender(_0x1fcc3a,_0x600377){return Mustache[_0xc6e1('0x2b')](_0x1fcc3a,_['merge'](_0x600377[_0xc6e1('0x2c')],{'contact':_0x600377[_0xc6e1('0x2d')],'message':_0x600377[_0xc6e1('0x2e')],'agent':_0x600377[_0xc6e1('0x2f')],'interaction':_0x600377[_0xc6e1('0x30')],'account':_0x600377['account']}))||'';}exports[_0xc6e1('0x31')]=function(_0x1585d4,_0x5a7c24){var _0x2cdb1e={},_0x3d6d3d={},_0x3211af={'count':0x0,'rows':[]};var _0x36c230=_[_0xc6e1('0x32')](db[_0xc6e1('0x33')][_0xc6e1('0x34')],function(_0x382235){return{'name':_0x382235['fieldName'],'type':_0x382235[_0xc6e1('0x35')][_0xc6e1('0x36')]};});_0x3d6d3d[_0xc6e1('0x37')]=_[_0xc6e1('0x32')](_0x36c230,_0xc6e1('0x2a'));_0x3d6d3d[_0xc6e1('0x38')]=_['keys'](_0x1585d4['query']);_0x3d6d3d[_0xc6e1('0x39')]=_[_0xc6e1('0x3a')](_0x3d6d3d[_0xc6e1('0x37')],_0x3d6d3d['query']);_0x2cdb1e[_0xc6e1('0x3b')]=_[_0xc6e1('0x3a')](_0x3d6d3d['model'],qs[_0xc6e1('0x3c')](_0x1585d4[_0xc6e1('0x38')][_0xc6e1('0x3c')]));_0x2cdb1e[_0xc6e1('0x3b')]=_0x2cdb1e['attributes'][_0xc6e1('0x3d')]?_0x2cdb1e['attributes']:_0x3d6d3d[_0xc6e1('0x37')];if(!_0x1585d4[_0xc6e1('0x38')][_0xc6e1('0x3e')](_0xc6e1('0x3f'))){_0x2cdb1e[_0xc6e1('0x1e')]=qs['limit'](_0x1585d4['query'][_0xc6e1('0x1e')]);_0x2cdb1e[_0xc6e1('0x1d')]=qs[_0xc6e1('0x1d')](_0x1585d4['query'][_0xc6e1('0x1d')]);}_0x2cdb1e['order']=qs[_0xc6e1('0x40')](_0x1585d4[_0xc6e1('0x38')][_0xc6e1('0x40')]);_0x2cdb1e[_0xc6e1('0x41')]=qs[_0xc6e1('0x39')](_[_0xc6e1('0x42')](_0x1585d4[_0xc6e1('0x38')],_0x3d6d3d[_0xc6e1('0x39')]),_0x36c230);if(_0x1585d4['query'][_0xc6e1('0x43')]){_0x2cdb1e[_0xc6e1('0x41')]=_[_0xc6e1('0x44')](_0x2cdb1e['where'],{'$or':_['map'](_0x36c230,function(_0x3b051a){if(_0x3b051a[_0xc6e1('0x35')]!==_0xc6e1('0x45')){var _0x4b813b={};_0x4b813b[_0x3b051a[_0xc6e1('0x2a')]]={'$like':'%'+_0x1585d4[_0xc6e1('0x38')][_0xc6e1('0x43')]+'%'};return _0x4b813b;}})});}_0x2cdb1e=_['merge']({},_0x2cdb1e,_0x1585d4[_0xc6e1('0x46')]);var _0x4666a5={'where':_0x2cdb1e[_0xc6e1('0x41')]};return db[_0xc6e1('0x33')][_0xc6e1('0x20')](_0x4666a5)[_0xc6e1('0x26')](function(_0x2757dd){_0x3211af[_0xc6e1('0x20')]=_0x2757dd;if(_0x1585d4[_0xc6e1('0x38')][_0xc6e1('0x47')]){_0x2cdb1e[_0xc6e1('0x48')]=[{'attributes':['id',_0xc6e1('0x2a'),_0xc6e1('0x49'),_0xc6e1('0x4a')],'model':db[_0xc6e1('0x4b')],'as':'User'}];}return db[_0xc6e1('0x33')][_0xc6e1('0x4c')](_0x2cdb1e);})['then'](function(_0x1fee7c){_0x3211af[_0xc6e1('0x4d')]=_0x1fee7c;return _0x3211af;})[_0xc6e1('0x26')](respondWithFilteredResult(_0x5a7c24,_0x2cdb1e))[_0xc6e1('0x4e')](handleError(_0x5a7c24,null));};exports[_0xc6e1('0x4f')]=function(_0x47e4bb,_0x3c548b){var _0x1ef17e={'raw':!![],'where':{'id':_0x47e4bb[_0xc6e1('0x50')]['id']}},_0x598100={};_0x598100[_0xc6e1('0x37')]=_[_0xc6e1('0x51')](db[_0xc6e1('0x33')]['rawAttributes']);_0x598100[_0xc6e1('0x38')]=_[_0xc6e1('0x51')](_0x47e4bb[_0xc6e1('0x38')]);_0x598100[_0xc6e1('0x39')]=_[_0xc6e1('0x3a')](_0x598100['model'],_0x598100[_0xc6e1('0x38')]);_0x1ef17e['attributes']=_[_0xc6e1('0x3a')](_0x598100[_0xc6e1('0x37')],qs[_0xc6e1('0x3c')](_0x47e4bb[_0xc6e1('0x38')][_0xc6e1('0x3c')]));_0x1ef17e[_0xc6e1('0x3b')]=_0x1ef17e['attributes'][_0xc6e1('0x3d')]?_0x1ef17e[_0xc6e1('0x3b')]:_0x598100[_0xc6e1('0x37')];if(_0x47e4bb[_0xc6e1('0x38')][_0xc6e1('0x47')]){_0x1ef17e['include']=[{'all':!![]}];}_0x1ef17e=_[_0xc6e1('0x44')]({},_0x1ef17e,_0x47e4bb[_0xc6e1('0x46')]);return db['VoiceCallReport']['find'](_0x1ef17e)[_0xc6e1('0x26')](handleEntityNotFound(_0x3c548b,null))[_0xc6e1('0x26')](respondWithResult(_0x3c548b,null))['catch'](handleError(_0x3c548b,null));};exports['create']=function(_0x7768ec,_0x360724){return db[_0xc6e1('0x33')][_0xc6e1('0x52')](_0x7768ec[_0xc6e1('0x2c')],{})['then'](respondWithResult(_0x360724,0xc9))[_0xc6e1('0x4e')](handleError(_0x360724,null));};exports[_0xc6e1('0x27')]=function(_0xee6bfc,_0x21aff2){return db[_0xc6e1('0x33')][_0xc6e1('0x53')]({'where':{'id':_0xee6bfc[_0xc6e1('0x50')]['id']}})['then'](handleEntityNotFound(_0x21aff2,null))[_0xc6e1('0x26')](removeEntity(_0x21aff2,null))[_0xc6e1('0x4e')](handleError(_0x21aff2,null));};exports['describe']=function(_0x44138c,_0xc8ad72){return db[_0xc6e1('0x33')][_0xc6e1('0x54')]()[_0xc6e1('0x26')](respondWithResult(_0xc8ad72,null))['catch'](handleError(_0xc8ad72,null));};exports['update']=function(_0x4345b6,_0x222883){if(_0x4345b6[_0xc6e1('0x2c')][_0xc6e1('0x55')]){delete _0x4345b6[_0xc6e1('0x2c')][_0xc6e1('0x55')];}return db[_0xc6e1('0x33')][_0xc6e1('0x53')]({'where':{'uniqueid':_0x4345b6[_0xc6e1('0x50')]['id'],'UserId':{'$or':[null,_0x4345b6[_0xc6e1('0x56')]['id']]}}})[_0xc6e1('0x26')](handleEntityNotFound(_0x222883,null))[_0xc6e1('0x26')](saveUpdates(_0x4345b6[_0xc6e1('0x2c')],null))[_0xc6e1('0x26')](respondWithResult(_0x222883,null))[_0xc6e1('0x4e')](handleError(_0x222883,null));}; \ No newline at end of file +var _0xf01b=['nolimit','order','sort','pick','filter','where','type','VIRTUAL','VoiceCallReport','includeAll','include','User','findAll','rows','catch','options','find','create','destroy','params','describe','uniqueid','user','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','squel','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','offset','undefined','limit','count','set','json','apply','reject','update','then','error','stack','name','send','merge','body','contact','message','agent','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xf01b,0xb5));var _0xbf01=function(_0x2830d1,_0x316a7d){_0x2830d1=_0x2830d1-0x0;var _0x4e9930=_0xf01b[_0x2830d1];return _0x4e9930;};'use strict';var emlformat=require(_0xbf01('0x0'));var rimraf=require(_0xbf01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf01('0x2'));var rp=require(_0xbf01('0x3'));var moment=require(_0xbf01('0x4'));var BPromise=require(_0xbf01('0x5'));var Mustache=require('mustache');var util=require(_0xbf01('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbf01('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf01('0x8'));var _=require('lodash');var squel=require(_0xbf01('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf01('0x7'));var querystring=require(_0xbf01('0xa'));var Papa=require(_0xbf01('0xb'));var Redis=require(_0xbf01('0xc'));var authService=require(_0xbf01('0xd'));var qs=require(_0xbf01('0xe'));var as=require(_0xbf01('0xf'));var hardwareService=require(_0xbf01('0x10'));var logger=require('../../config/logger')(_0xbf01('0x11'));var utils=require(_0xbf01('0x12'));var config=require(_0xbf01('0x13'));var licenseUtil=require(_0xbf01('0x14'));var db=require(_0xbf01('0x15'))['db'];function respondWithStatusCode(_0x4647b9,_0x107555){_0x107555=_0x107555||0xcc;return function(_0xa0ccf2){if(_0xa0ccf2){return _0x4647b9[_0xbf01('0x16')](_0x107555);}return _0x4647b9[_0xbf01('0x17')](_0x107555)[_0xbf01('0x18')]();};}function respondWithResult(_0xac7dbe,_0x35820a){_0x35820a=_0x35820a||0xc8;return function(_0x4ffe71){if(_0x4ffe71){return _0xac7dbe[_0xbf01('0x17')](_0x35820a)['json'](_0x4ffe71);}};}function respondWithFilteredResult(_0x18f075,_0x16db06){return function(_0x212675){if(_0x212675){var _0x1155bb=typeof _0x16db06[_0xbf01('0x19')]===_0xbf01('0x1a')&&typeof _0x16db06[_0xbf01('0x1b')]===_0xbf01('0x1a');var _0x3fd930=_0x212675['count'];var _0x2d3c42=_0x1155bb?0x0:_0x16db06[_0xbf01('0x19')];var _0x1ece26=_0x1155bb?_0x212675[_0xbf01('0x1c')]:_0x16db06[_0xbf01('0x19')]+_0x16db06['limit'];var _0x254697;if(_0x1ece26>=_0x3fd930){_0x1ece26=_0x3fd930;_0x254697=0xc8;}else{_0x254697=0xce;}_0x18f075[_0xbf01('0x17')](_0x254697);return _0x18f075[_0xbf01('0x1d')]('Content-Range',_0x2d3c42+'-'+_0x1ece26+'/'+_0x3fd930)[_0xbf01('0x1e')](_0x212675);}return null;};}function patchUpdates(_0x1e54f0){return function(_0x47e203){try{jsonpatch[_0xbf01('0x1f')](_0x47e203,_0x1e54f0,!![]);}catch(_0x49c0fa){return BPromise[_0xbf01('0x20')](_0x49c0fa);}return _0x47e203['save']();};}function saveUpdates(_0xe86905,_0x53021d){return function(_0x414bc9){if(_0x414bc9){return _0x414bc9[_0xbf01('0x21')](_0xe86905)[_0xbf01('0x22')](function(_0x56d32a){return _0x56d32a;});}return null;};}function removeEntity(_0x3d7ac7,_0xb503c5){return function(_0xc773fa){if(_0xc773fa){return _0xc773fa['destroy']()['then'](function(){_0x3d7ac7[_0xbf01('0x17')](0xcc)[_0xbf01('0x18')]();});}};}function handleEntityNotFound(_0x5da1dc,_0x1f6f55){return function(_0xff0623){if(!_0xff0623){_0x5da1dc['sendStatus'](0x194);}return _0xff0623;};}function handleError(_0x3cee60,_0x1e9aa5){_0x1e9aa5=_0x1e9aa5||0x1f4;return function(_0x3101e5){logger[_0xbf01('0x23')](_0x3101e5[_0xbf01('0x24')]);if(_0x3101e5[_0xbf01('0x25')]){delete _0x3101e5[_0xbf01('0x25')];}_0x3cee60['status'](_0x1e9aa5)[_0xbf01('0x26')](_0x3101e5);};}function getMustacheRender(_0x4ef476,_0x16a3ee){return Mustache['render'](_0x4ef476,_[_0xbf01('0x27')](_0x16a3ee[_0xbf01('0x28')],{'contact':_0x16a3ee[_0xbf01('0x29')],'message':_0x16a3ee[_0xbf01('0x2a')],'agent':_0x16a3ee[_0xbf01('0x2b')],'interaction':_0x16a3ee['interaction'],'account':_0x16a3ee['account']}))||'';}exports[_0xbf01('0x2c')]=function(_0x378825,_0x52f411){var _0x2e14b4={},_0x14a562={},_0x5ce132={'count':0x0,'rows':[]};var _0x3afc14=_[_0xbf01('0x2d')](db['VoiceCallReport'][_0xbf01('0x2e')],function(_0x1f37a3){return{'name':_0x1f37a3[_0xbf01('0x2f')],'type':_0x1f37a3['type']['key']};});_0x14a562[_0xbf01('0x30')]=_['map'](_0x3afc14,'name');_0x14a562[_0xbf01('0x31')]=_[_0xbf01('0x32')](_0x378825[_0xbf01('0x31')]);_0x14a562[_0xbf01('0x33')]=_[_0xbf01('0x34')](_0x14a562[_0xbf01('0x30')],_0x14a562[_0xbf01('0x31')]);_0x2e14b4[_0xbf01('0x35')]=_[_0xbf01('0x34')](_0x14a562[_0xbf01('0x30')],qs[_0xbf01('0x36')](_0x378825[_0xbf01('0x31')][_0xbf01('0x36')]));_0x2e14b4[_0xbf01('0x35')]=_0x2e14b4[_0xbf01('0x35')][_0xbf01('0x37')]?_0x2e14b4[_0xbf01('0x35')]:_0x14a562[_0xbf01('0x30')];if(!_0x378825['query']['hasOwnProperty'](_0xbf01('0x38'))){_0x2e14b4[_0xbf01('0x1b')]=qs['limit'](_0x378825[_0xbf01('0x31')]['limit']);_0x2e14b4[_0xbf01('0x19')]=qs[_0xbf01('0x19')](_0x378825['query'][_0xbf01('0x19')]);}_0x2e14b4[_0xbf01('0x39')]=qs[_0xbf01('0x3a')](_0x378825['query']['sort']);_0x2e14b4['where']=qs[_0xbf01('0x33')](_[_0xbf01('0x3b')](_0x378825[_0xbf01('0x31')],_0x14a562['filters']),_0x3afc14);if(_0x378825['query'][_0xbf01('0x3c')]){_0x2e14b4[_0xbf01('0x3d')]=_[_0xbf01('0x27')](_0x2e14b4[_0xbf01('0x3d')],{'$or':_[_0xbf01('0x2d')](_0x3afc14,function(_0x51edd2){if(_0x51edd2[_0xbf01('0x3e')]!==_0xbf01('0x3f')){var _0x4010c1={};_0x4010c1[_0x51edd2[_0xbf01('0x25')]]={'$like':'%'+_0x378825['query'][_0xbf01('0x3c')]+'%'};return _0x4010c1;}})});}_0x2e14b4=_[_0xbf01('0x27')]({},_0x2e14b4,_0x378825['options']);var _0xacf9e9={'where':_0x2e14b4[_0xbf01('0x3d')]};return db[_0xbf01('0x40')][_0xbf01('0x1c')](_0xacf9e9)[_0xbf01('0x22')](function(_0x16f87d){_0x5ce132['count']=_0x16f87d;if(_0x378825[_0xbf01('0x31')][_0xbf01('0x41')]){_0x2e14b4[_0xbf01('0x42')]=[{'attributes':['id',_0xbf01('0x25'),'fullname','alias'],'model':db[_0xbf01('0x43')],'as':_0xbf01('0x43')}];}return db[_0xbf01('0x40')][_0xbf01('0x44')](_0x2e14b4);})['then'](function(_0x536a00){_0x5ce132[_0xbf01('0x45')]=_0x536a00;return _0x5ce132;})['then'](respondWithFilteredResult(_0x52f411,_0x2e14b4))[_0xbf01('0x46')](handleError(_0x52f411,null));};exports['show']=function(_0x22b30e,_0x35205a){var _0x476ca6={'raw':!![],'where':{'id':_0x22b30e['params']['id']}},_0x3033ad={};_0x3033ad['model']=_[_0xbf01('0x32')](db[_0xbf01('0x40')][_0xbf01('0x2e')]);_0x3033ad[_0xbf01('0x31')]=_['keys'](_0x22b30e[_0xbf01('0x31')]);_0x3033ad[_0xbf01('0x33')]=_[_0xbf01('0x34')](_0x3033ad[_0xbf01('0x30')],_0x3033ad[_0xbf01('0x31')]);_0x476ca6['attributes']=_['intersection'](_0x3033ad[_0xbf01('0x30')],qs['fields'](_0x22b30e[_0xbf01('0x31')]['fields']));_0x476ca6[_0xbf01('0x35')]=_0x476ca6[_0xbf01('0x35')][_0xbf01('0x37')]?_0x476ca6[_0xbf01('0x35')]:_0x3033ad[_0xbf01('0x30')];if(_0x22b30e[_0xbf01('0x31')][_0xbf01('0x41')]){_0x476ca6[_0xbf01('0x42')]=[{'all':!![]}];}_0x476ca6=_[_0xbf01('0x27')]({},_0x476ca6,_0x22b30e[_0xbf01('0x47')]);return db[_0xbf01('0x40')][_0xbf01('0x48')](_0x476ca6)['then'](handleEntityNotFound(_0x35205a,null))['then'](respondWithResult(_0x35205a,null))[_0xbf01('0x46')](handleError(_0x35205a,null));};exports[_0xbf01('0x49')]=function(_0xa839dc,_0x1ab89b){return db[_0xbf01('0x40')][_0xbf01('0x49')](_0xa839dc[_0xbf01('0x28')],{})['then'](respondWithResult(_0x1ab89b,0xc9))[_0xbf01('0x46')](handleError(_0x1ab89b,null));};exports[_0xbf01('0x4a')]=function(_0x3813f4,_0xf7aedf){return db[_0xbf01('0x40')][_0xbf01('0x48')]({'where':{'id':_0x3813f4[_0xbf01('0x4b')]['id']}})[_0xbf01('0x22')](handleEntityNotFound(_0xf7aedf,null))[_0xbf01('0x22')](removeEntity(_0xf7aedf,null))[_0xbf01('0x46')](handleError(_0xf7aedf,null));};exports['describe']=function(_0x477b25,_0x10f2b5){return db[_0xbf01('0x40')][_0xbf01('0x4c')]()['then'](respondWithResult(_0x10f2b5,null))[_0xbf01('0x46')](handleError(_0x10f2b5,null));};exports[_0xbf01('0x21')]=function(_0x427e04,_0x5017cd){if(_0x427e04[_0xbf01('0x28')]['uniqueid']){delete _0x427e04[_0xbf01('0x28')][_0xbf01('0x4d')];}return db['VoiceCallReport'][_0xbf01('0x48')]({'where':{'uniqueid':_0x427e04[_0xbf01('0x4b')]['id'],'UserId':{'$or':[null,_0x427e04[_0xbf01('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x5017cd,null))[_0xbf01('0x22')](saveUpdates(_0x427e04[_0xbf01('0x28')],null))[_0xbf01('0x22')](respondWithResult(_0x5017cd,null))[_0xbf01('0x46')](handleError(_0x5017cd,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3a5c29a..8b10649 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 _0x230a=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','report_call'];(function(_0x334fff,_0x577a24){var _0x4d5612=function(_0x58de93){while(--_0x58de93){_0x334fff['push'](_0x334fff['shift']());}};_0x4d5612(++_0x577a24);}(_0x230a,0xdd));var _0xa230=function(_0x438688,_0x3c5e51){_0x438688=_0x438688-0x0;var _0x2a7f22=_0x230a[_0x438688];return _0x2a7f22;};'use strict';var _=require(_0xa230('0x0'));var util=require(_0xa230('0x1'));var logger=require(_0xa230('0x2'))('api');var moment=require(_0xa230('0x3'));var BPromise=require(_0xa230('0x4'));var rp=require(_0xa230('0x5'));var fs=require('fs');var path=require(_0xa230('0x6'));var rimraf=require('rimraf');var config=require(_0xa230('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xa230('0x8')]=function(_0x3b8fd7,_0x2ba344){return _0x3b8fd7['define']('VoiceCallReport',attributes,{'tableName':_0xa230('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa230('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc96=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbc96,0x1c0));var _0x6bc9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbc96[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x6bc9('0x0'));var util=require(_0x6bc9('0x1'));var logger=require(_0x6bc9('0x2'))(_0x6bc9('0x3'));var moment=require('moment');var BPromise=require(_0x6bc9('0x4'));var rp=require(_0x6bc9('0x5'));var fs=require('fs');var path=require(_0x6bc9('0x6'));var rimraf=require(_0x6bc9('0x7'));var config=require('../../config/environment');var attributes=require(_0x6bc9('0x8'));module[_0x6bc9('0x9')]=function(_0x4a0836,_0x4a7033){return _0x4a0836[_0x6bc9('0xa')](_0x6bc9('0xb'),attributes,{'tableName':_0x6bc9('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6bc9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 029577f..93020a0 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 _0xef6c=['message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','map','include','attributes','model','CreateVoiceCallReport','body','update','UpdateVoiceCallReport','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xef6c,0x1d9));var _0xcef6=function(_0x28014d,_0x383e2f){_0x28014d=_0x28014d-0x0;var _0x2572cc=_0xef6c[_0x28014d];return _0x2572cc;};'use strict';var _=require('lodash');var util=require(_0xcef6('0x0'));var moment=require('moment');var BPromise=require(_0xcef6('0x1'));var rs=require(_0xcef6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcef6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcef6('0x4'))(_0xcef6('0x5'));var config=require(_0xcef6('0x6'));var jayson=require(_0xcef6('0x7'));var client=jayson[_0xcef6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bdc23,_0x22105e,_0x1f5a38){return new BPromise(function(_0x266a79,_0x224a56){return client[_0xcef6('0x9')](_0x4bdc23,_0x1f5a38)[_0xcef6('0xa')](function(_0x4cfdc3){logger[_0xcef6('0xb')](_0xcef6('0xc'),_0x22105e,'request\x20sent');logger[_0xcef6('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x22105e,_0xcef6('0xe'),JSON[_0xcef6('0xf')](_0x4cfdc3));if(_0x4cfdc3[_0xcef6('0x10')]){if(_0x4cfdc3[_0xcef6('0x10')]['code']===0x1f4){logger[_0xcef6('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x22105e,_0x4cfdc3[_0xcef6('0x10')]['message']);return _0x224a56(_0x4cfdc3[_0xcef6('0x10')][_0xcef6('0x11')]);}logger[_0xcef6('0x10')](_0xcef6('0xc'),_0x22105e,_0x4cfdc3[_0xcef6('0x10')][_0xcef6('0x11')]);return _0x266a79(_0x4cfdc3[_0xcef6('0x10')][_0xcef6('0x11')]);}else{logger[_0xcef6('0xb')](_0xcef6('0xc'),_0x22105e,_0xcef6('0xe'));_0x266a79(_0x4cfdc3[_0xcef6('0x12')][_0xcef6('0x11')]);}})[_0xcef6('0x13')](function(_0x4b1292){logger['error'](_0xcef6('0xc'),_0x22105e,_0x4b1292);_0x224a56(_0x4b1292);});});}exports[_0xcef6('0x14')]=function(_0x1adf85){var _0xb96f47=this;return new Promise(function(_0x4606dc,_0x450b16){return db[_0xcef6('0x15')][_0xcef6('0x16')]({'raw':_0x1adf85[_0xcef6('0x17')]?_0x1adf85[_0xcef6('0x17')][_0xcef6('0x18')]===undefined?!![]:![]:!![],'where':_0x1adf85[_0xcef6('0x17')]?_0x1adf85[_0xcef6('0x17')][_0xcef6('0x19')]||null:null,'attributes':_0x1adf85[_0xcef6('0x17')]?_0x1adf85[_0xcef6('0x17')]['attributes']||null:null,'limit':_0x1adf85['options']?_0x1adf85[_0xcef6('0x17')][_0xcef6('0x1a')]||null:null,'include':_0x1adf85[_0xcef6('0x17')]?_0x1adf85[_0xcef6('0x17')]['include']?_[_0xcef6('0x1b')](_0x1adf85[_0xcef6('0x17')][_0xcef6('0x1c')],function(_0xed28ed){return{'model':db[_0xed28ed['model']],'as':_0xed28ed['as'],'attributes':_0xed28ed[_0xcef6('0x1d')],'include':_0xed28ed['include']?_['map'](_0xed28ed[_0xcef6('0x1c')],function(_0x10a4c6){return{'model':db[_0x10a4c6[_0xcef6('0x1e')]],'as':_0x10a4c6['as'],'attributes':_0x10a4c6[_0xcef6('0x1d')],'include':_0x10a4c6[_0xcef6('0x1c')]?_[_0xcef6('0x1b')](_0x10a4c6[_0xcef6('0x1c')],function(_0xf2b8af){return{'model':db[_0xf2b8af[_0xcef6('0x1e')]],'as':_0xf2b8af['as'],'attributes':_0xf2b8af['attributes']};}):[]};}):[]};}):[]:[]})[_0xcef6('0xa')](function(_0x398a57){logger['info']('GetVoiceCallReport',_0x1adf85);logger[_0xcef6('0xd')](_0xcef6('0x14'),_0x1adf85,JSON[_0xcef6('0xf')](_0x398a57));_0x4606dc(_0x398a57);})['catch'](function(_0xb5867f){logger['error'](_0xcef6('0x14'),_0xb5867f['message'],_0x1adf85);_0x450b16(_0xb96f47[_0xcef6('0x10')](0x1f4,_0xb5867f[_0xcef6('0x11')]));});});};exports[_0xcef6('0x1f')]=function(_0xff16c5){var _0x3dc8e0=this;return new Promise(function(_0x4e25ca,_0x48ab0a){return db[_0xcef6('0x15')]['create'](_0xff16c5[_0xcef6('0x20')],{'raw':_0xff16c5['options']?_0xff16c5['options'][_0xcef6('0x18')]===undefined?!![]:![]:!![]})[_0xcef6('0xa')](function(_0x1bceb2){logger['info']('CreateVoiceCallReport',_0xff16c5);logger['debug'](_0xcef6('0x1f'),_0xff16c5,JSON[_0xcef6('0xf')](_0x1bceb2));_0x4e25ca(_0x1bceb2);})[_0xcef6('0x13')](function(_0x40d3ee){logger[_0xcef6('0x10')](_0xcef6('0x1f'),_0x40d3ee[_0xcef6('0x11')],_0xff16c5);_0x48ab0a(_0x3dc8e0[_0xcef6('0x10')](0x1f4,_0x40d3ee[_0xcef6('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0xc31da2){var _0x48a46d=this;return new Promise(function(_0x36f013,_0x5ab28d){return db[_0xcef6('0x15')][_0xcef6('0x21')](_0xc31da2[_0xcef6('0x20')],{'raw':_0xc31da2[_0xcef6('0x17')]?_0xc31da2[_0xcef6('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc31da2[_0xcef6('0x17')]?_0xc31da2[_0xcef6('0x17')][_0xcef6('0x19')]||null:null,'attributes':_0xc31da2[_0xcef6('0x17')]?_0xc31da2[_0xcef6('0x17')][_0xcef6('0x1d')]||null:null,'limit':_0xc31da2[_0xcef6('0x17')]?_0xc31da2['options'][_0xcef6('0x1a')]||null:null})[_0xcef6('0xa')](function(_0x3faa66){logger[_0xcef6('0xb')](_0xcef6('0x22'),_0xc31da2);logger[_0xcef6('0xd')]('UpdateVoiceCallReport',_0xc31da2,JSON[_0xcef6('0xf')](_0x3faa66));_0x36f013(_0x3faa66);})['catch'](function(_0x1eaad2){logger[_0xcef6('0x10')](_0xcef6('0x22'),_0x1eaad2[_0xcef6('0x11')],_0xc31da2);_0x5ab28d(_0x48a46d['error'](0x1f4,_0x1eaad2[_0xcef6('0x11')]));});});}; \ No newline at end of file +var _0xd189=['include','model','attributes','map','CreateVoiceCallReport','VoiceCallReport','body','raw','UpdateVoiceCallReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceCallReport','options','where','limit'];(function(_0x18d60d,_0x35880a){var _0x3b7ad7=function(_0x13eb53){while(--_0x13eb53){_0x18d60d['push'](_0x18d60d['shift']());}};_0x3b7ad7(++_0x35880a);}(_0xd189,0x160));var _0x9d18=function(_0x4eaca4,_0x5cd9f4){_0x4eaca4=_0x4eaca4-0x0;var _0x574d35=_0xd189[_0x4eaca4];return _0x574d35;};'use strict';var _=require(_0x9d18('0x0'));var util=require('util');var moment=require(_0x9d18('0x1'));var BPromise=require(_0x9d18('0x2'));var rs=require(_0x9d18('0x3'));var fs=require('fs');var Redis=require(_0x9d18('0x4'));var db=require(_0x9d18('0x5'))['db'];var utils=require(_0x9d18('0x6'));var logger=require(_0x9d18('0x7'))(_0x9d18('0x8'));var config=require(_0x9d18('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9d18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x301cec,_0x3fcea9,_0x13feab){return new BPromise(function(_0x2956e7,_0x4de301){return client[_0x9d18('0xb')](_0x301cec,_0x13feab)[_0x9d18('0xc')](function(_0x5ae101){logger['info'](_0x9d18('0xd'),_0x3fcea9,_0x9d18('0xe'));logger[_0x9d18('0xf')](_0x9d18('0x10'),_0x3fcea9,_0x9d18('0xe'),JSON[_0x9d18('0x11')](_0x5ae101));if(_0x5ae101[_0x9d18('0x12')]){if(_0x5ae101[_0x9d18('0x12')][_0x9d18('0x13')]===0x1f4){logger['error'](_0x9d18('0xd'),_0x3fcea9,_0x5ae101[_0x9d18('0x12')]['message']);return _0x4de301(_0x5ae101['error']['message']);}logger['error'](_0x9d18('0xd'),_0x3fcea9,_0x5ae101[_0x9d18('0x12')][_0x9d18('0x14')]);return _0x2956e7(_0x5ae101[_0x9d18('0x12')][_0x9d18('0x14')]);}else{logger[_0x9d18('0x15')](_0x9d18('0xd'),_0x3fcea9,_0x9d18('0xe'));_0x2956e7(_0x5ae101[_0x9d18('0x16')][_0x9d18('0x14')]);}})[_0x9d18('0x17')](function(_0x213cb9){logger['error'](_0x9d18('0xd'),_0x3fcea9,_0x213cb9);_0x4de301(_0x213cb9);});});}exports[_0x9d18('0x18')]=function(_0xbf858a){var _0x59db65=this;return new Promise(function(_0x32b586,_0x14a726){return db['VoiceCallReport']['findAll']({'raw':_0xbf858a[_0x9d18('0x19')]?_0xbf858a[_0x9d18('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xbf858a[_0x9d18('0x19')]?_0xbf858a['options'][_0x9d18('0x1a')]||null:null,'attributes':_0xbf858a[_0x9d18('0x19')]?_0xbf858a[_0x9d18('0x19')]['attributes']||null:null,'limit':_0xbf858a['options']?_0xbf858a[_0x9d18('0x19')][_0x9d18('0x1b')]||null:null,'include':_0xbf858a[_0x9d18('0x19')]?_0xbf858a['options']['include']?_['map'](_0xbf858a[_0x9d18('0x19')][_0x9d18('0x1c')],function(_0x5952fd){return{'model':db[_0x5952fd[_0x9d18('0x1d')]],'as':_0x5952fd['as'],'attributes':_0x5952fd[_0x9d18('0x1e')],'include':_0x5952fd[_0x9d18('0x1c')]?_[_0x9d18('0x1f')](_0x5952fd['include'],function(_0x4db69e){return{'model':db[_0x4db69e['model']],'as':_0x4db69e['as'],'attributes':_0x4db69e[_0x9d18('0x1e')],'include':_0x4db69e[_0x9d18('0x1c')]?_['map'](_0x4db69e[_0x9d18('0x1c')],function(_0x47f1eb){return{'model':db[_0x47f1eb[_0x9d18('0x1d')]],'as':_0x47f1eb['as'],'attributes':_0x47f1eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d18('0xc')](function(_0x475c4b){logger[_0x9d18('0x15')]('GetVoiceCallReport',_0xbf858a);logger[_0x9d18('0xf')]('GetVoiceCallReport',_0xbf858a,JSON[_0x9d18('0x11')](_0x475c4b));_0x32b586(_0x475c4b);})['catch'](function(_0x5b6616){logger[_0x9d18('0x12')](_0x9d18('0x18'),_0x5b6616['message'],_0xbf858a);_0x14a726(_0x59db65['error'](0x1f4,_0x5b6616[_0x9d18('0x14')]));});});};exports[_0x9d18('0x20')]=function(_0xe9c75b){var _0x18e880=this;return new Promise(function(_0x29f64e,_0xe3a7a7){return db[_0x9d18('0x21')]['create'](_0xe9c75b[_0x9d18('0x22')],{'raw':_0xe9c75b[_0x9d18('0x19')]?_0xe9c75b[_0x9d18('0x19')][_0x9d18('0x23')]===undefined?!![]:![]:!![]})[_0x9d18('0xc')](function(_0x3f580c){logger[_0x9d18('0x15')]('CreateVoiceCallReport',_0xe9c75b);logger[_0x9d18('0xf')](_0x9d18('0x20'),_0xe9c75b,JSON[_0x9d18('0x11')](_0x3f580c));_0x29f64e(_0x3f580c);})[_0x9d18('0x17')](function(_0x28c0f2){logger['error'](_0x9d18('0x20'),_0x28c0f2['message'],_0xe9c75b);_0xe3a7a7(_0x18e880['error'](0x1f4,_0x28c0f2[_0x9d18('0x14')]));});});};exports[_0x9d18('0x24')]=function(_0x46a0f1){var _0x41a737=this;return new Promise(function(_0x4e776f,_0x527bd8){return db['VoiceCallReport'][_0x9d18('0x25')](_0x46a0f1['body'],{'raw':_0x46a0f1[_0x9d18('0x19')]?_0x46a0f1['options'][_0x9d18('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a0f1[_0x9d18('0x19')]?_0x46a0f1[_0x9d18('0x19')]['where']||null:null,'attributes':_0x46a0f1[_0x9d18('0x19')]?_0x46a0f1['options'][_0x9d18('0x1e')]||null:null,'limit':_0x46a0f1['options']?_0x46a0f1[_0x9d18('0x19')][_0x9d18('0x1b')]||null:null})[_0x9d18('0xc')](function(_0x8ebab1){logger[_0x9d18('0x15')](_0x9d18('0x24'),_0x46a0f1);logger['debug']('UpdateVoiceCallReport',_0x46a0f1,JSON['stringify'](_0x8ebab1));_0x4e776f(_0x8ebab1);})[_0x9d18('0x17')](function(_0x1b16cc){logger['error']('UpdateVoiceCallReport',_0x1b16cc[_0x9d18('0x14')],_0x46a0f1);_0x527bd8(_0x41a737[_0x9d18('0x12')](0x1f4,_0x1b16cc[_0x9d18('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 69238bf..00f6bfa 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 _0x39a7=['isAuthenticated','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39a7,0x15b));var _0x739a=function(_0x5b756c,_0x3621b6){_0x5b756c=_0x5b756c-0x0;var _0x2e0952=_0x39a7[_0x5b756c];return _0x2e0952;};'use strict';var multer=require(_0x739a('0x0'));var util=require(_0x739a('0x1'));var path=require(_0x739a('0x2'));var timeout=require(_0x739a('0x3'));var express=require(_0x739a('0x4'));var router=express[_0x739a('0x5')]();var fs_extra=require(_0x739a('0x6'));var auth=require(_0x739a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x739a('0x8'));var controller=require(_0x739a('0x9'));router[_0x739a('0xa')]('/',auth['isAuthenticated'](),controller[_0x739a('0xb')]);router['get'](_0x739a('0xc'),auth[_0x739a('0xd')](),controller[_0x739a('0xe')]);router[_0x739a('0xf')]('/',auth[_0x739a('0xd')](),controller['create']);router['put'](_0x739a('0xc'),auth[_0x739a('0xd')](),controller[_0x739a('0x10')]);router[_0x739a('0x11')](_0x739a('0xc'),auth[_0x739a('0xd')](),controller[_0x739a('0x12')]);module[_0x739a('0x13')]=router; \ No newline at end of file +var _0xb447=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0xf8886b,_0x504891){var _0x321bd5=function(_0x3c116b){while(--_0x3c116b){_0xf8886b['push'](_0xf8886b['shift']());}};_0x321bd5(++_0x504891);}(_0xb447,0xbd));var _0x7b44=function(_0x457a5d,_0x3da867){_0x457a5d=_0x457a5d-0x0;var _0x5d07a2=_0xb447[_0x457a5d];return _0x5d07a2;};'use strict';var multer=require(_0x7b44('0x0'));var util=require(_0x7b44('0x1'));var path=require(_0x7b44('0x2'));var timeout=require(_0x7b44('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7b44('0x4'));var interaction=require(_0x7b44('0x5'));var config=require(_0x7b44('0x6'));var controller=require(_0x7b44('0x7'));router[_0x7b44('0x8')]('/',auth[_0x7b44('0x9')](),controller[_0x7b44('0xa')]);router[_0x7b44('0x8')](_0x7b44('0xb'),auth[_0x7b44('0x9')](),controller[_0x7b44('0xc')]);router[_0x7b44('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7b44('0xe')]('/:id',auth[_0x7b44('0x9')](),controller[_0x7b44('0xf')]);router[_0x7b44('0x10')](_0x7b44('0xb'),auth[_0x7b44('0x9')](),controller[_0x7b44('0x11')]);module[_0x7b44('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 4e44bf4..e6e33bf 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 _0x8fc4=['setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','STRING','name'];(function(_0x148a9e,_0x26ec5b){var _0x4e3296=function(_0x3dfba3){while(--_0x3dfba3){_0x148a9e['push'](_0x148a9e['shift']());}};_0x4e3296(++_0x26ec5b);}(_0x8fc4,0x141));var _0x48fc=function(_0x571af9,_0x4d5932){_0x571af9=_0x571af9-0x0;var _0x827624=_0x8fc4[_0x571af9];return _0x827624;};'use strict';var Sequelize=require(_0x48fc('0x0'));module['exports']={'name':{'type':Sequelize[_0x48fc('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x48fc('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x48fc('0x1')],'set':function(_0x314e10){this[_0x48fc('0x3')](_0x48fc('0x4'),_0x314e10?_0x314e10[_0x48fc('0x5')](''):[]);},'get':function(){return this[_0x48fc('0x6')](_0x48fc('0x4'))?this[_0x48fc('0x6')](_0x48fc('0x4'))[_0x48fc('0x7')](''):[];}},'auth':{'type':Sequelize[_0x48fc('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x48fc('0x1')]},'record':{'type':Sequelize[_0x48fc('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x48fc('0x1')]}}; \ No newline at end of file +var _0xea84=['getDataValue','BOOLEAN','exports','STRING','name','setDataValue','join','options'];(function(_0x14a6c8,_0x5542b1){var _0x1cd8c7=function(_0x400101){while(--_0x400101){_0x14a6c8['push'](_0x14a6c8['shift']());}};_0x1cd8c7(++_0x5542b1);}(_0xea84,0xca));var _0x4ea8=function(_0x3e6810,_0x4beb30){_0x3e6810=_0x3e6810-0x0;var _0x1801c9=_0xea84[_0x3e6810];return _0x1801c9;};'use strict';var Sequelize=require('sequelize');module[_0x4ea8('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x4ea8('0x1')],'unique':_0x4ea8('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x4ea8('0x1')],'set':function(_0x5cc2a5){this[_0x4ea8('0x3')]('options',_0x5cc2a5?_0x5cc2a5[_0x4ea8('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x4ea8('0x5'))?this[_0x4ea8('0x6')](_0x4ea8('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x4ea8('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4ea8('0x1')]},'description':{'type':Sequelize[_0x4ea8('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1c25de4..f08d329 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 _0x45ff=['UserProfileResource','error','name','send','merge','body','contact','message','agent','interaction','account','index','map','VoiceChanSpy','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','keys','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies'];(function(_0x81480d,_0x44cb9a){var _0x26d57f=function(_0x158e6b){while(--_0x158e6b){_0x81480d['push'](_0x81480d['shift']());}};_0x26d57f(++_0x44cb9a);}(_0x45ff,0xe1));var _0xf45f=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x45ff[_0x3747ae];return _0x339035;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf45f('0x0'));var zipdir=require(_0xf45f('0x1'));var jsonpatch=require(_0xf45f('0x2'));var rp=require(_0xf45f('0x3'));var moment=require('moment');var BPromise=require(_0xf45f('0x4'));var Mustache=require(_0xf45f('0x5'));var util=require(_0xf45f('0x6'));var path=require(_0xf45f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf45f('0x8'));var fs=require('fs');var fs_extra=require(_0xf45f('0x9'));var _=require(_0xf45f('0xa'));var squel=require(_0xf45f('0xb'));var crypto=require(_0xf45f('0xc'));var jsforce=require(_0xf45f('0xd'));var deskjs=require(_0xf45f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf45f('0xf'));var authService=require(_0xf45f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf45f('0x11'));var hardwareService=require(_0xf45f('0x12'));var logger=require(_0xf45f('0x13'))(_0xf45f('0x14'));var utils=require(_0xf45f('0x15'));var config=require(_0xf45f('0x16'));var licenseUtil=require(_0xf45f('0x17'));var db=require(_0xf45f('0x18'))['db'];function respondWithStatusCode(_0x31aa9b,_0x1bc94e){_0x1bc94e=_0x1bc94e||0xcc;return function(_0x4599d2){if(_0x4599d2){return _0x31aa9b[_0xf45f('0x19')](_0x1bc94e);}return _0x31aa9b[_0xf45f('0x1a')](_0x1bc94e)[_0xf45f('0x1b')]();};}function respondWithResult(_0x7a4931,_0x5061d4){_0x5061d4=_0x5061d4||0xc8;return function(_0x504802){if(_0x504802){return _0x7a4931[_0xf45f('0x1a')](_0x5061d4)[_0xf45f('0x1c')](_0x504802);}};}function respondWithFilteredResult(_0x4b6c06,_0x13fefc){return function(_0x599f37){if(_0x599f37){var _0x1c3a18=typeof _0x13fefc[_0xf45f('0x1d')]===_0xf45f('0x1e')&&typeof _0x13fefc[_0xf45f('0x1f')]===_0xf45f('0x1e');var _0xa1dbc7=_0x599f37[_0xf45f('0x20')];var _0x4a192b=_0x1c3a18?0x0:_0x13fefc['offset'];var _0x4ba4b6=_0x1c3a18?_0x599f37[_0xf45f('0x20')]:_0x13fefc['offset']+_0x13fefc[_0xf45f('0x1f')];var _0x3a6d9c;if(_0x4ba4b6>=_0xa1dbc7){_0x4ba4b6=_0xa1dbc7;_0x3a6d9c=0xc8;}else{_0x3a6d9c=0xce;}_0x4b6c06[_0xf45f('0x1a')](_0x3a6d9c);return _0x4b6c06['set'](_0xf45f('0x21'),_0x4a192b+'-'+_0x4ba4b6+'/'+_0xa1dbc7)[_0xf45f('0x1c')](_0x599f37);}return null;};}function patchUpdates(_0x2e7420){return function(_0xb72ccc){try{jsonpatch[_0xf45f('0x22')](_0xb72ccc,_0x2e7420,!![]);}catch(_0x21d0bb){return BPromise[_0xf45f('0x23')](_0x21d0bb);}return _0xb72ccc[_0xf45f('0x24')]();};}function saveUpdates(_0xd3699,_0x31cfe2){return function(_0x1d3ff7){if(_0x1d3ff7){return _0x1d3ff7[_0xf45f('0x25')](_0xd3699)[_0xf45f('0x26')](function(_0x2630cf){return _0x2630cf;});}return null;};}function removeEntity(_0x1c4368,_0x48a9a5){return function(_0x57fb8a){if(_0x57fb8a){return _0x57fb8a[_0xf45f('0x27')]()[_0xf45f('0x26')](function(){var _0x1eacc4=_0x57fb8a[_0xf45f('0x28')]({'plain':!![]});var _0x5e6b76=_0xf45f('0x29');return db[_0xf45f('0x2a')][_0xf45f('0x27')]({'where':{'type':_0x5e6b76,'resourceId':_0x1eacc4['id']}})[_0xf45f('0x26')](function(){return _0x57fb8a;});})[_0xf45f('0x26')](function(){_0x1c4368[_0xf45f('0x1a')](0xcc)[_0xf45f('0x1b')]();});}};}function handleEntityNotFound(_0x30116e,_0x61e572){return function(_0xf2e1c){if(!_0xf2e1c){_0x30116e[_0xf45f('0x19')](0x194);}return _0xf2e1c;};}function handleError(_0x3264a3,_0x28071c){_0x28071c=_0x28071c||0x1f4;return function(_0x3fb7af){logger[_0xf45f('0x2b')](_0x3fb7af['stack']);if(_0x3fb7af[_0xf45f('0x2c')]){delete _0x3fb7af[_0xf45f('0x2c')];}_0x3264a3[_0xf45f('0x1a')](_0x28071c)[_0xf45f('0x2d')](_0x3fb7af);};}function getMustacheRender(_0x26a305,_0x5e10d1){return Mustache['render'](_0x26a305,_[_0xf45f('0x2e')](_0x5e10d1[_0xf45f('0x2f')],{'contact':_0x5e10d1[_0xf45f('0x30')],'message':_0x5e10d1[_0xf45f('0x31')],'agent':_0x5e10d1[_0xf45f('0x32')],'interaction':_0x5e10d1[_0xf45f('0x33')],'account':_0x5e10d1[_0xf45f('0x34')]}))||'';}exports[_0xf45f('0x35')]=function(_0x2143c5,_0x4cb1c5){var _0x2d2650={},_0xb72378={},_0x5576fa={'count':0x0,'rows':[]};var _0xa74eb1=_[_0xf45f('0x36')](db[_0xf45f('0x37')]['rawAttributes'],function(_0x2044a7){return{'name':_0x2044a7[_0xf45f('0x38')],'type':_0x2044a7[_0xf45f('0x39')][_0xf45f('0x3a')]};});_0xb72378['model']=_[_0xf45f('0x36')](_0xa74eb1,_0xf45f('0x2c'));_0xb72378[_0xf45f('0x3b')]=_['keys'](_0x2143c5[_0xf45f('0x3b')]);_0xb72378[_0xf45f('0x3c')]=_['intersection'](_0xb72378[_0xf45f('0x3d')],_0xb72378[_0xf45f('0x3b')]);_0x2d2650['attributes']=_[_0xf45f('0x3e')](_0xb72378['model'],qs[_0xf45f('0x3f')](_0x2143c5[_0xf45f('0x3b')]['fields']));_0x2d2650[_0xf45f('0x40')]=_0x2d2650[_0xf45f('0x40')][_0xf45f('0x41')]?_0x2d2650['attributes']:_0xb72378[_0xf45f('0x3d')];if(!_0x2143c5[_0xf45f('0x3b')][_0xf45f('0x42')](_0xf45f('0x43'))){_0x2d2650['limit']=qs[_0xf45f('0x1f')](_0x2143c5[_0xf45f('0x3b')][_0xf45f('0x1f')]);_0x2d2650[_0xf45f('0x1d')]=qs[_0xf45f('0x1d')](_0x2143c5[_0xf45f('0x3b')][_0xf45f('0x1d')]);}_0x2d2650[_0xf45f('0x44')]=qs[_0xf45f('0x45')](_0x2143c5['query'][_0xf45f('0x45')]);_0x2d2650['where']=qs[_0xf45f('0x3c')](_[_0xf45f('0x46')](_0x2143c5[_0xf45f('0x3b')],_0xb72378[_0xf45f('0x3c')]),_0xa74eb1);if(_0x2143c5[_0xf45f('0x3b')]['filter']){_0x2d2650['where']=_[_0xf45f('0x2e')](_0x2d2650[_0xf45f('0x47')],{'$or':_['map'](_0xa74eb1,function(_0x26ea88){if(_0x26ea88['type']!=='VIRTUAL'){var _0x146b03={};_0x146b03[_0x26ea88['name']]={'$like':'%'+_0x2143c5[_0xf45f('0x3b')][_0xf45f('0x48')]+'%'};return _0x146b03;}})});}_0x2d2650=_['merge']({},_0x2d2650,_0x2143c5[_0xf45f('0x49')]);var _0x2c66d1={'where':_0x2d2650[_0xf45f('0x47')]};return db[_0xf45f('0x37')][_0xf45f('0x20')](_0x2c66d1)[_0xf45f('0x26')](function(_0x499c85){_0x5576fa[_0xf45f('0x20')]=_0x499c85;if(_0x2143c5['query'][_0xf45f('0x4a')]){_0x2d2650[_0xf45f('0x4b')]=[{'all':!![]}];}return db[_0xf45f('0x37')]['findAll'](_0x2d2650);})[_0xf45f('0x26')](function(_0x4b8fe8){_0x5576fa[_0xf45f('0x4c')]=_0x4b8fe8;return _0x5576fa;})[_0xf45f('0x26')](respondWithFilteredResult(_0x4cb1c5,_0x2d2650))[_0xf45f('0x4d')](handleError(_0x4cb1c5,null));};exports[_0xf45f('0x4e')]=function(_0x595d85,_0xa34a0){var _0x17e3db={'raw':![],'where':{'id':_0x595d85[_0xf45f('0x4f')]['id']}},_0x1dd2a3={};_0x1dd2a3[_0xf45f('0x3d')]=_['keys'](db[_0xf45f('0x37')][_0xf45f('0x50')]);_0x1dd2a3[_0xf45f('0x3b')]=_[_0xf45f('0x51')](_0x595d85[_0xf45f('0x3b')]);_0x1dd2a3[_0xf45f('0x3c')]=_[_0xf45f('0x3e')](_0x1dd2a3['model'],_0x1dd2a3[_0xf45f('0x3b')]);_0x17e3db['attributes']=_[_0xf45f('0x3e')](_0x1dd2a3['model'],qs['fields'](_0x595d85['query'][_0xf45f('0x3f')]));_0x17e3db[_0xf45f('0x40')]=_0x17e3db[_0xf45f('0x40')][_0xf45f('0x41')]?_0x17e3db[_0xf45f('0x40')]:_0x1dd2a3[_0xf45f('0x3d')];if(_0x595d85[_0xf45f('0x3b')][_0xf45f('0x4a')]){_0x17e3db[_0xf45f('0x4b')]=[{'all':!![]}];}_0x17e3db=_[_0xf45f('0x2e')]({},_0x17e3db,_0x595d85[_0xf45f('0x49')]);return db[_0xf45f('0x37')][_0xf45f('0x52')](_0x17e3db)[_0xf45f('0x26')](handleEntityNotFound(_0xa34a0,null))[_0xf45f('0x26')](respondWithResult(_0xa34a0,null))[_0xf45f('0x4d')](handleError(_0xa34a0,null));};exports['create']=function(_0x34d09a,_0x4ac6ff){return db[_0xf45f('0x37')]['create'](_0x34d09a['body'],{})['then'](function(_0x65f1cc){var _0x4212c0=_0x34d09a[_0xf45f('0x53')][_0xf45f('0x28')]({'plain':!![]});if(!_0x4212c0)throw new Error(_0xf45f('0x54'));if(_0x4212c0['role']===_0xf45f('0x53')){var _0xedbb6d=_0x65f1cc[_0xf45f('0x28')]({'plain':!![]});var _0x5a0c64=_0xf45f('0x29');return db[_0xf45f('0x55')]['find']({'where':{'name':_0x5a0c64,'userProfileId':_0x4212c0[_0xf45f('0x56')]},'raw':!![]})['then'](function(_0x183c0e){if(_0x183c0e&&_0x183c0e[_0xf45f('0x57')]===0x0){return db[_0xf45f('0x2a')][_0xf45f('0x58')]({'name':_0xedbb6d['name'],'resourceId':_0xedbb6d['id'],'type':_0x183c0e['name'],'sectionId':_0x183c0e['id']},{})[_0xf45f('0x26')](function(){return _0x65f1cc;});}else{return _0x65f1cc;}})[_0xf45f('0x4d')](function(_0x3a99d3){logger[_0xf45f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a99d3);throw _0x3a99d3;});}return _0x65f1cc;})[_0xf45f('0x26')](respondWithResult(_0x4ac6ff,0xc9))[_0xf45f('0x4d')](handleError(_0x4ac6ff,null));};exports['update']=function(_0x379fd0,_0x44bdca){if(_0x379fd0[_0xf45f('0x2f')]['id']){delete _0x379fd0['body']['id'];}return db[_0xf45f('0x37')]['find']({'where':{'id':_0x379fd0[_0xf45f('0x4f')]['id']}})[_0xf45f('0x26')](handleEntityNotFound(_0x44bdca,null))[_0xf45f('0x26')](saveUpdates(_0x379fd0[_0xf45f('0x2f')],null))[_0xf45f('0x26')](respondWithResult(_0x44bdca,null))[_0xf45f('0x4d')](handleError(_0x44bdca,null));};exports['destroy']=function(_0x3e1cfb,_0x3faf83){return db[_0xf45f('0x37')]['find']({'where':{'id':_0x3e1cfb['params']['id']}})[_0xf45f('0x26')](handleEntityNotFound(_0x3faf83,null))[_0xf45f('0x26')](removeEntity(_0x3faf83,null))[_0xf45f('0x4d')](handleError(_0x3faf83,null));}; \ No newline at end of file +var _0x8592=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','save','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','merge','body','message','agent','account','index','map','VoiceChanSpy','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','include','findAll','rows','catch','params','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x2e3301,_0x25070c){var _0x2b2d5c=function(_0x36f05b){while(--_0x36f05b){_0x2e3301['push'](_0x2e3301['shift']());}};_0x2b2d5c(++_0x25070c);}(_0x8592,0x194));var _0x2859=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x8592[_0x5a2d95];return _0x2c3986;};'use strict';var emlformat=require(_0x2859('0x0'));var rimraf=require(_0x2859('0x1'));var zipdir=require(_0x2859('0x2'));var jsonpatch=require(_0x2859('0x3'));var rp=require(_0x2859('0x4'));var moment=require(_0x2859('0x5'));var BPromise=require(_0x2859('0x6'));var Mustache=require(_0x2859('0x7'));var util=require('util');var path=require(_0x2859('0x8'));var sox=require(_0x2859('0x9'));var csv=require(_0x2859('0xa'));var ejs=require(_0x2859('0xb'));var fs=require('fs');var fs_extra=require(_0x2859('0xc'));var _=require(_0x2859('0xd'));var squel=require(_0x2859('0xe'));var crypto=require('crypto');var jsforce=require(_0x2859('0xf'));var deskjs=require(_0x2859('0x10'));var toCsv=require(_0x2859('0xa'));var querystring=require(_0x2859('0x11'));var Papa=require(_0x2859('0x12'));var Redis=require(_0x2859('0x13'));var authService=require(_0x2859('0x14'));var qs=require(_0x2859('0x15'));var as=require(_0x2859('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2859('0x17'));var utils=require(_0x2859('0x18'));var config=require(_0x2859('0x19'));var licenseUtil=require(_0x2859('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x163787,_0x428bf0){_0x428bf0=_0x428bf0||0xcc;return function(_0x3902d3){if(_0x3902d3){return _0x163787[_0x2859('0x1b')](_0x428bf0);}return _0x163787['status'](_0x428bf0)[_0x2859('0x1c')]();};}function respondWithResult(_0xbeaefa,_0x272c80){_0x272c80=_0x272c80||0xc8;return function(_0x46eee7){if(_0x46eee7){return _0xbeaefa[_0x2859('0x1d')](_0x272c80)[_0x2859('0x1e')](_0x46eee7);}};}function respondWithFilteredResult(_0x42894c,_0x555662){return function(_0x5adbaf){if(_0x5adbaf){var _0x2b540c=typeof _0x555662['offset']===_0x2859('0x1f')&&typeof _0x555662[_0x2859('0x20')]==='undefined';var _0x293623=_0x5adbaf[_0x2859('0x21')];var _0x2dcfa3=_0x2b540c?0x0:_0x555662[_0x2859('0x22')];var _0x3e9846=_0x2b540c?_0x5adbaf[_0x2859('0x21')]:_0x555662['offset']+_0x555662['limit'];var _0x197852;if(_0x3e9846>=_0x293623){_0x3e9846=_0x293623;_0x197852=0xc8;}else{_0x197852=0xce;}_0x42894c['status'](_0x197852);return _0x42894c[_0x2859('0x23')]('Content-Range',_0x2dcfa3+'-'+_0x3e9846+'/'+_0x293623)[_0x2859('0x1e')](_0x5adbaf);}return null;};}function patchUpdates(_0x5610c8){return function(_0x235eed){try{jsonpatch['apply'](_0x235eed,_0x5610c8,!![]);}catch(_0x4f2de6){return BPromise['reject'](_0x4f2de6);}return _0x235eed[_0x2859('0x24')]();};}function saveUpdates(_0xaa01ac,_0x5b846a){return function(_0x3b6958){if(_0x3b6958){return _0x3b6958['update'](_0xaa01ac)[_0x2859('0x25')](function(_0x155d49){return _0x155d49;});}return null;};}function removeEntity(_0x56b77f,_0x3ddd8d){return function(_0x52043f){if(_0x52043f){return _0x52043f[_0x2859('0x26')]()['then'](function(){var _0x4f65af=_0x52043f[_0x2859('0x27')]({'plain':!![]});var _0x10bac8=_0x2859('0x28');return db[_0x2859('0x29')][_0x2859('0x26')]({'where':{'type':_0x10bac8,'resourceId':_0x4f65af['id']}})[_0x2859('0x25')](function(){return _0x52043f;});})[_0x2859('0x25')](function(){_0x56b77f[_0x2859('0x1d')](0xcc)[_0x2859('0x1c')]();});}};}function handleEntityNotFound(_0x1a5bb7,_0x53bdf6){return function(_0x3cb73c){if(!_0x3cb73c){_0x1a5bb7['sendStatus'](0x194);}return _0x3cb73c;};}function handleError(_0x5a897e,_0x5a2afa){_0x5a2afa=_0x5a2afa||0x1f4;return function(_0x4289ac){logger[_0x2859('0x2a')](_0x4289ac[_0x2859('0x2b')]);if(_0x4289ac['name']){delete _0x4289ac[_0x2859('0x2c')];}_0x5a897e[_0x2859('0x1d')](_0x5a2afa)['send'](_0x4289ac);};}function getMustacheRender(_0x375c92,_0x4ab4fd){return Mustache['render'](_0x375c92,_[_0x2859('0x2d')](_0x4ab4fd[_0x2859('0x2e')],{'contact':_0x4ab4fd['contact'],'message':_0x4ab4fd[_0x2859('0x2f')],'agent':_0x4ab4fd[_0x2859('0x30')],'interaction':_0x4ab4fd['interaction'],'account':_0x4ab4fd[_0x2859('0x31')]}))||'';}exports[_0x2859('0x32')]=function(_0x4e9992,_0x59617c){var _0x121a73={},_0x3f2135={},_0x3c69ba={'count':0x0,'rows':[]};var _0xd2531b=_[_0x2859('0x33')](db[_0x2859('0x34')][_0x2859('0x35')],function(_0x4eaa4b){return{'name':_0x4eaa4b['fieldName'],'type':_0x4eaa4b['type'][_0x2859('0x36')]};});_0x3f2135[_0x2859('0x37')]=_[_0x2859('0x33')](_0xd2531b,_0x2859('0x2c'));_0x3f2135[_0x2859('0x38')]=_['keys'](_0x4e9992[_0x2859('0x38')]);_0x3f2135['filters']=_[_0x2859('0x39')](_0x3f2135['model'],_0x3f2135['query']);_0x121a73[_0x2859('0x3a')]=_[_0x2859('0x39')](_0x3f2135[_0x2859('0x37')],qs['fields'](_0x4e9992['query'][_0x2859('0x3b')]));_0x121a73[_0x2859('0x3a')]=_0x121a73['attributes'][_0x2859('0x3c')]?_0x121a73[_0x2859('0x3a')]:_0x3f2135['model'];if(!_0x4e9992[_0x2859('0x38')][_0x2859('0x3d')](_0x2859('0x3e'))){_0x121a73[_0x2859('0x20')]=qs[_0x2859('0x20')](_0x4e9992[_0x2859('0x38')]['limit']);_0x121a73['offset']=qs['offset'](_0x4e9992[_0x2859('0x38')][_0x2859('0x22')]);}_0x121a73[_0x2859('0x3f')]=qs[_0x2859('0x40')](_0x4e9992[_0x2859('0x38')][_0x2859('0x40')]);_0x121a73[_0x2859('0x41')]=qs[_0x2859('0x42')](_['pick'](_0x4e9992[_0x2859('0x38')],_0x3f2135[_0x2859('0x42')]),_0xd2531b);if(_0x4e9992['query'][_0x2859('0x43')]){_0x121a73[_0x2859('0x41')]=_[_0x2859('0x2d')](_0x121a73[_0x2859('0x41')],{'$or':_[_0x2859('0x33')](_0xd2531b,function(_0xbc5619){if(_0xbc5619['type']!==_0x2859('0x44')){var _0x3a37e7={};_0x3a37e7[_0xbc5619[_0x2859('0x2c')]]={'$like':'%'+_0x4e9992['query'][_0x2859('0x43')]+'%'};return _0x3a37e7;}})});}_0x121a73=_[_0x2859('0x2d')]({},_0x121a73,_0x4e9992['options']);var _0xce5312={'where':_0x121a73['where']};return db['VoiceChanSpy']['count'](_0xce5312)[_0x2859('0x25')](function(_0x2a88f6){_0x3c69ba[_0x2859('0x21')]=_0x2a88f6;if(_0x4e9992['query']['includeAll']){_0x121a73[_0x2859('0x45')]=[{'all':!![]}];}return db[_0x2859('0x34')][_0x2859('0x46')](_0x121a73);})[_0x2859('0x25')](function(_0x1bfc30){_0x3c69ba[_0x2859('0x47')]=_0x1bfc30;return _0x3c69ba;})['then'](respondWithFilteredResult(_0x59617c,_0x121a73))[_0x2859('0x48')](handleError(_0x59617c,null));};exports['show']=function(_0x2ab438,_0x4730b8){var _0xbd2582={'raw':![],'where':{'id':_0x2ab438[_0x2859('0x49')]['id']}},_0x5b0647={};_0x5b0647[_0x2859('0x37')]=_[_0x2859('0x4a')](db['VoiceChanSpy']['rawAttributes']);_0x5b0647[_0x2859('0x38')]=_[_0x2859('0x4a')](_0x2ab438['query']);_0x5b0647[_0x2859('0x42')]=_[_0x2859('0x39')](_0x5b0647['model'],_0x5b0647[_0x2859('0x38')]);_0xbd2582['attributes']=_[_0x2859('0x39')](_0x5b0647[_0x2859('0x37')],qs[_0x2859('0x3b')](_0x2ab438[_0x2859('0x38')][_0x2859('0x3b')]));_0xbd2582['attributes']=_0xbd2582['attributes'][_0x2859('0x3c')]?_0xbd2582[_0x2859('0x3a')]:_0x5b0647[_0x2859('0x37')];if(_0x2ab438[_0x2859('0x38')][_0x2859('0x4b')]){_0xbd2582[_0x2859('0x45')]=[{'all':!![]}];}_0xbd2582=_[_0x2859('0x2d')]({},_0xbd2582,_0x2ab438['options']);return db[_0x2859('0x34')][_0x2859('0x4c')](_0xbd2582)['then'](handleEntityNotFound(_0x4730b8,null))[_0x2859('0x25')](respondWithResult(_0x4730b8,null))['catch'](handleError(_0x4730b8,null));};exports['create']=function(_0x44736a,_0xf5b133){return db['VoiceChanSpy'][_0x2859('0x4d')](_0x44736a['body'],{})[_0x2859('0x25')](function(_0x3d1882){var _0x8591cc=_0x44736a[_0x2859('0x4e')][_0x2859('0x27')]({'plain':!![]});if(!_0x8591cc)throw new Error(_0x2859('0x4f'));if(_0x8591cc['role']===_0x2859('0x4e')){var _0x27e229=_0x3d1882['get']({'plain':!![]});var _0x2aab4c=_0x2859('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x2aab4c,'userProfileId':_0x8591cc['userProfileId']},'raw':!![]})['then'](function(_0x16893b){if(_0x16893b&&_0x16893b[_0x2859('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x27e229[_0x2859('0x2c')],'resourceId':_0x27e229['id'],'type':_0x16893b['name'],'sectionId':_0x16893b['id']},{})['then'](function(){return _0x3d1882;});}else{return _0x3d1882;}})[_0x2859('0x48')](function(_0x483974){logger[_0x2859('0x2a')](_0x2859('0x51'),_0x483974);throw _0x483974;});}return _0x3d1882;})[_0x2859('0x25')](respondWithResult(_0xf5b133,0xc9))[_0x2859('0x48')](handleError(_0xf5b133,null));};exports[_0x2859('0x52')]=function(_0x4c2e30,_0x4fdd15){if(_0x4c2e30['body']['id']){delete _0x4c2e30[_0x2859('0x2e')]['id'];}return db[_0x2859('0x34')]['find']({'where':{'id':_0x4c2e30[_0x2859('0x49')]['id']}})[_0x2859('0x25')](handleEntityNotFound(_0x4fdd15,null))[_0x2859('0x25')](saveUpdates(_0x4c2e30[_0x2859('0x2e')],null))['then'](respondWithResult(_0x4fdd15,null))[_0x2859('0x48')](handleError(_0x4fdd15,null));};exports['destroy']=function(_0x5ac7a2,_0x31e6c2){return db[_0x2859('0x34')][_0x2859('0x4c')]({'where':{'id':_0x5ac7a2[_0x2859('0x49')]['id']}})[_0x2859('0x25')](handleEntityNotFound(_0x31e6c2,null))['then'](removeEntity(_0x31e6c2,null))[_0x2859('0x48')](handleError(_0x31e6c2,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 454f1e4..30efe5f 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 _0xfa09=['agent','exports','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','${UNIQUEID}.%s,a','recordingFormat','auth','password','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','User','findAll','internal'];(function(_0x256670,_0x51d624){var _0x4b30d8=function(_0x14e137){while(--_0x14e137){_0x256670['push'](_0x256670['shift']());}};_0x4b30d8(++_0x51d624);}(_0xfa09,0x7f));var _0x9fa0=function(_0x5f075e,_0x8778e2){_0x5f075e=_0x5f075e-0x0;var _0x627ab1=_0xfa09[_0x5f075e];return _0x627ab1;};'use strict';var _=require(_0x9fa0('0x0'));var util=require(_0x9fa0('0x1'));var BPromise=require(_0x9fa0('0x2'));var attributes=require(_0x9fa0('0x3'));var getUserApplications=function(_0x335e5e,_0xa271a6,_0x13da5e){var _0x3dabc9=0x1;var _0x106945=[];var _0x3c6a7c={'context':_0xa271a6[_0x9fa0('0x4')]||'from-sip','exten':util['format'](_0x9fa0('0x5'),_0x335e5e[_0x9fa0('0x6')],_0x13da5e),'type':_0x9fa0('0x7'),'isApp':![],'ChanSpyId':_0x335e5e['id'],'UserId':_0xa271a6['id']};_0x106945[_0x9fa0('0x8')](_[_0x9fa0('0x9')]({'app':_0x9fa0('0xa'),'appdata':util[_0x9fa0('0xb')](_0x9fa0('0xc'),_0x9fa0('0xd')),'priority':_0x3dabc9++},_0x3c6a7c));if(_0x335e5e['record']){_0x106945[_0x9fa0('0x8')](_[_0x9fa0('0x9')]({'app':'MixMonitor','appdata':util[_0x9fa0('0xb')](_0x9fa0('0xe'),_0x335e5e[_0x9fa0('0xf')]),'priority':_0x3dabc9++},_0x3c6a7c));}if(_0x335e5e[_0x9fa0('0x10')]){_0x106945[_0x9fa0('0x8')](_[_0x9fa0('0x9')]({'app':'Authenticate','appdata':_0x335e5e[_0x9fa0('0x11')],'priority':_0x3dabc9++},_0x3c6a7c));}_0x106945[_0x9fa0('0x8')](_[_0x9fa0('0x9')]({'app':'ChanSpy','appdata':util[_0x9fa0('0xb')](_0x9fa0('0x12'),_0xa271a6[_0x9fa0('0x13')],_0x335e5e[_0x9fa0('0x14')]?_0x335e5e[_0x9fa0('0x14')][_0x9fa0('0x15')](''):''),'priority':_0x3dabc9++},_0x3c6a7c));if(_0x335e5e[_0x9fa0('0x16')]){_0x106945[_0x9fa0('0x8')](_['merge']({'app':_0x9fa0('0x17'),'priority':_0x3dabc9++},_0x3c6a7c));}return _0x106945;};var getChanSpyApplications=function(_0x2a2282,_0x5c6841){var _0x36dc26=[];for(var _0x549d6e=0x0,_0x2aca68=0x1;_0x549d6e<_0x5c6841[_0x9fa0('0x18')];_0x549d6e++,_0x2aca68=0x1){_0x36dc26=_0x36dc26[_0x9fa0('0x19')](getUserApplications(_0x2a2282,_0x5c6841[_0x549d6e],_0x5c6841[_0x549d6e]['internal']));if(_0x5c6841[_0x549d6e]['internal']!=_0x5c6841[_0x549d6e]['name']){_0x36dc26=_0x36dc26[_0x9fa0('0x19')](getUserApplications(_0x2a2282,_0x5c6841[_0x549d6e],_0x5c6841[_0x549d6e][_0x9fa0('0x13')]));}}return _0x36dc26;};var getChanSpyPromise=function(_0x37bd54,_0x4c0952){return new BPromise(function(_0x54195f,_0x24e5d6){return _0x37bd54[_0x9fa0('0x1a')][_0x9fa0('0x1b')]({'attributes':['id','name',_0x9fa0('0x1c')],'where':{'role':_0x9fa0('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0x4a8986){if(_0x4a8986){return _0x54195f(getChanSpyApplications(_0x4c0952,_0x4a8986));}return _0x54195f([]);})['catch'](function(_0x529a46){_0x24e5d6(_0x529a46);});});};module[_0x9fa0('0x1e')]=function(_0x16c250,_0x42e63d){var _0x2cb2a7=_0x16c250['models'];return _0x16c250[_0x9fa0('0x1f')](_0x9fa0('0x20'),attributes,{'tableName':_0x9fa0('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x46de49,_0x26046c,_0x40525c){return getChanSpyPromise(_0x2cb2a7,_0x46de49)[_0x9fa0('0x22')](function(_0x1d9b73){if(_0x1d9b73&&_0x1d9b73['length']){return _0x2cb2a7[_0x9fa0('0x23')][_0x9fa0('0x24')](_0x1d9b73);}})[_0x9fa0('0x22')](function(){_0x40525c();})[_0x9fa0('0x25')](function(_0x5278c3){_0x40525c(_0x5278c3);});},'afterUpdate':function(_0x51a665,_0x51561a,_0x2d3136){return _0x2cb2a7[_0x9fa0('0x23')][_0x9fa0('0x26')]({'where':{'ChanSpyId':_0x51a665['id']}})['then'](function(){return getChanSpyPromise(_0x2cb2a7,_0x51a665);})[_0x9fa0('0x22')](function(_0x51ab00){if(_0x51ab00&&_0x51ab00[_0x9fa0('0x18')]){return _0x2cb2a7[_0x9fa0('0x23')][_0x9fa0('0x24')](_0x51ab00);}})[_0x9fa0('0x22')](function(){_0x2d3136();})[_0x9fa0('0x25')](function(_0x386773){_0x2d3136(_0x386773);});},'afterDestroy':function(_0x119a4a,_0x4bdc1e,_0x1ea245){return _0x2cb2a7[_0x9fa0('0x23')][_0x9fa0('0x26')]({'where':{'ChanSpyId':_0x119a4a['id']}})['then'](function(){_0x1ea245();})[_0x9fa0('0x25')](function(_0x2b7585){_0x1ea245(_0x2b7585);});}}});}; \ No newline at end of file +var _0xbe31=['options','join','StopMixMonitor','concat','internal','User','findAll','agent','catch','exports','define','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','then','util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','name'];(function(_0x188155,_0x1d9f26){var _0x51a885=function(_0x269688){while(--_0x269688){_0x188155['push'](_0x188155['shift']());}};_0x51a885(++_0x1d9f26);}(_0xbe31,0x83));var _0x1be3=function(_0x396bcf,_0x4f7f2d){_0x396bcf=_0x396bcf-0x0;var _0x270824=_0xbe31[_0x396bcf];return _0x270824;};'use strict';var _=require('lodash');var util=require(_0x1be3('0x0'));var BPromise=require(_0x1be3('0x1'));var attributes=require(_0x1be3('0x2'));var getUserApplications=function(_0x474db2,_0x228047,_0x1bd12d){var _0xacfa1e=0x1;var _0x2c1ddd=[];var _0x3aacc2={'context':_0x228047['context']||_0x1be3('0x3'),'exten':util['format'](_0x1be3('0x4'),_0x474db2[_0x1be3('0x5')],_0x1bd12d),'type':_0x1be3('0x6'),'isApp':![],'ChanSpyId':_0x474db2['id'],'UserId':_0x228047['id']};_0x2c1ddd[_0x1be3('0x7')](_[_0x1be3('0x8')]({'app':_0x1be3('0x9'),'appdata':util[_0x1be3('0xa')](_0x1be3('0xb'),_0x1be3('0xc')),'priority':_0xacfa1e++},_0x3aacc2));if(_0x474db2[_0x1be3('0xd')]){_0x2c1ddd['push'](_[_0x1be3('0x8')]({'app':_0x1be3('0xe'),'appdata':util[_0x1be3('0xa')](_0x1be3('0xf'),_0x474db2[_0x1be3('0x10')]),'priority':_0xacfa1e++},_0x3aacc2));}if(_0x474db2[_0x1be3('0x11')]){_0x2c1ddd[_0x1be3('0x7')](_[_0x1be3('0x8')]({'app':_0x1be3('0x12'),'appdata':_0x474db2['password'],'priority':_0xacfa1e++},_0x3aacc2));}_0x2c1ddd[_0x1be3('0x7')](_['merge']({'app':_0x1be3('0x13'),'appdata':util[_0x1be3('0xa')]('SIP/%s,%s',_0x228047[_0x1be3('0x14')],_0x474db2['options']?_0x474db2[_0x1be3('0x15')][_0x1be3('0x16')](''):''),'priority':_0xacfa1e++},_0x3aacc2));if(_0x474db2[_0x1be3('0xd')]){_0x2c1ddd[_0x1be3('0x7')](_[_0x1be3('0x8')]({'app':_0x1be3('0x17'),'priority':_0xacfa1e++},_0x3aacc2));}return _0x2c1ddd;};var getChanSpyApplications=function(_0x567919,_0x53a9d7){var _0x5b8971=[];for(var _0x52d2f2=0x0,_0x181f5f=0x1;_0x52d2f2<_0x53a9d7['length'];_0x52d2f2++,_0x181f5f=0x1){_0x5b8971=_0x5b8971[_0x1be3('0x18')](getUserApplications(_0x567919,_0x53a9d7[_0x52d2f2],_0x53a9d7[_0x52d2f2][_0x1be3('0x19')]));if(_0x53a9d7[_0x52d2f2][_0x1be3('0x19')]!=_0x53a9d7[_0x52d2f2][_0x1be3('0x14')]){_0x5b8971=_0x5b8971[_0x1be3('0x18')](getUserApplications(_0x567919,_0x53a9d7[_0x52d2f2],_0x53a9d7[_0x52d2f2][_0x1be3('0x14')]));}}return _0x5b8971;};var getChanSpyPromise=function(_0x400035,_0x41c2af){return new BPromise(function(_0x745447,_0x118b5a){return _0x400035[_0x1be3('0x1a')][_0x1be3('0x1b')]({'attributes':['id','name','internal'],'where':{'role':_0x1be3('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2b6b35){if(_0x2b6b35){return _0x745447(getChanSpyApplications(_0x41c2af,_0x2b6b35));}return _0x745447([]);})[_0x1be3('0x1d')](function(_0x4366e8){_0x118b5a(_0x4366e8);});});};module[_0x1be3('0x1e')]=function(_0x3c0564,_0xc2d08c){var _0x2b7a7f=_0x3c0564['models'];return _0x3c0564[_0x1be3('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0x1be3('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f277a,_0x579461,_0xe5346d){return getChanSpyPromise(_0x2b7a7f,_0x3f277a)['then'](function(_0x134d79){if(_0x134d79&&_0x134d79[_0x1be3('0x21')]){return _0x2b7a7f[_0x1be3('0x22')][_0x1be3('0x23')](_0x134d79);}})['then'](function(){_0xe5346d();})[_0x1be3('0x1d')](function(_0x8d1f58){_0xe5346d(_0x8d1f58);});},'afterUpdate':function(_0x4c22df,_0x113cc4,_0x983a65){return _0x2b7a7f[_0x1be3('0x22')][_0x1be3('0x24')]({'where':{'ChanSpyId':_0x4c22df['id']}})[_0x1be3('0x25')](function(){return getChanSpyPromise(_0x2b7a7f,_0x4c22df);})[_0x1be3('0x25')](function(_0x5d35cf){if(_0x5d35cf&&_0x5d35cf[_0x1be3('0x21')]){return _0x2b7a7f['VoiceExtension'][_0x1be3('0x23')](_0x5d35cf);}})['then'](function(){_0x983a65();})[_0x1be3('0x1d')](function(_0x11a193){_0x983a65(_0x11a193);});},'afterDestroy':function(_0x569e40,_0x5426aa,_0x49f780){return _0x2b7a7f[_0x1be3('0x22')][_0x1be3('0x24')]({'where':{'ChanSpyId':_0x569e40['id']}})[_0x1be3('0x25')](function(){_0x49f780();})[_0x1be3('0x1d')](function(_0x1b697e){_0x49f780(_0x1b697e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index fca78e8..0c0e7e2 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 _0xecce=['code','message','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x275dd8,_0x3f58ad){var _0x28c88e=function(_0x5efac1){while(--_0x5efac1){_0x275dd8['push'](_0x275dd8['shift']());}};_0x28c88e(++_0x3f58ad);}(_0xecce,0x18f));var _0xeecc=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0xecce[_0x1b02bb];return _0x131245;};'use strict';var _=require(_0xeecc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeecc('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeecc('0x2'))['db'];var utils=require(_0xeecc('0x3'));var logger=require(_0xeecc('0x4'))(_0xeecc('0x5'));var config=require(_0xeecc('0x6'));var jayson=require(_0xeecc('0x7'));var client=jayson[_0xeecc('0x8')][_0xeecc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x237aa9,_0x2dcf90,_0x2d8eb9){return new BPromise(function(_0x23b16f,_0x2917a7){return client[_0xeecc('0xa')](_0x237aa9,_0x2d8eb9)[_0xeecc('0xb')](function(_0x168d78){logger[_0xeecc('0xc')](_0xeecc('0xd'),_0x2dcf90,_0xeecc('0xe'));logger[_0xeecc('0xf')](_0xeecc('0x10'),_0x2dcf90,_0xeecc('0xe'),JSON[_0xeecc('0x11')](_0x168d78));if(_0x168d78[_0xeecc('0x12')]){if(_0x168d78[_0xeecc('0x12')][_0xeecc('0x13')]===0x1f4){logger['error'](_0xeecc('0xd'),_0x2dcf90,_0x168d78[_0xeecc('0x12')][_0xeecc('0x14')]);return _0x2917a7(_0x168d78[_0xeecc('0x12')][_0xeecc('0x14')]);}logger[_0xeecc('0x12')](_0xeecc('0xd'),_0x2dcf90,_0x168d78['error']['message']);return _0x23b16f(_0x168d78[_0xeecc('0x12')]['message']);}else{logger[_0xeecc('0xc')](_0xeecc('0xd'),_0x2dcf90,'request\x20sent');_0x23b16f(_0x168d78['result'][_0xeecc('0x14')]);}})[_0xeecc('0x15')](function(_0x33516b){logger[_0xeecc('0x12')](_0xeecc('0xd'),_0x2dcf90,_0x33516b);_0x2917a7(_0x33516b);});});} \ No newline at end of file +var _0x7cdc=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x195388,_0x2f2e9d){var _0x41dec4=function(_0x9b2062){while(--_0x9b2062){_0x195388['push'](_0x195388['shift']());}};_0x41dec4(++_0x2f2e9d);}(_0x7cdc,0x175));var _0xc7cd=function(_0x2cdbe0,_0x4acd37){_0x2cdbe0=_0x2cdbe0-0x0;var _0x3a2d4f=_0x7cdc[_0x2cdbe0];return _0x3a2d4f;};'use strict';var _=require(_0xc7cd('0x0'));var util=require('util');var moment=require(_0xc7cd('0x1'));var BPromise=require('bluebird');var rs=require(_0xc7cd('0x2'));var fs=require('fs');var Redis=require(_0xc7cd('0x3'));var db=require(_0xc7cd('0x4'))['db'];var utils=require(_0xc7cd('0x5'));var logger=require(_0xc7cd('0x6'))(_0xc7cd('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc7cd('0x8')][_0xc7cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51d309,_0x584231,_0x3d707a){return new BPromise(function(_0x584638,_0x53f7c9){return client[_0xc7cd('0xa')](_0x51d309,_0x3d707a)[_0xc7cd('0xb')](function(_0x144acc){logger[_0xc7cd('0xc')](_0xc7cd('0xd'),_0x584231,_0xc7cd('0xe'));logger[_0xc7cd('0xf')](_0xc7cd('0x10'),_0x584231,_0xc7cd('0xe'),JSON[_0xc7cd('0x11')](_0x144acc));if(_0x144acc[_0xc7cd('0x12')]){if(_0x144acc['error'][_0xc7cd('0x13')]===0x1f4){logger['error'](_0xc7cd('0xd'),_0x584231,_0x144acc[_0xc7cd('0x12')][_0xc7cd('0x14')]);return _0x53f7c9(_0x144acc[_0xc7cd('0x12')][_0xc7cd('0x14')]);}logger[_0xc7cd('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x584231,_0x144acc['error'][_0xc7cd('0x14')]);return _0x584638(_0x144acc[_0xc7cd('0x12')][_0xc7cd('0x14')]);}else{logger[_0xc7cd('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x584231,_0xc7cd('0xe'));_0x584638(_0x144acc[_0xc7cd('0x15')][_0xc7cd('0x14')]);}})[_0xc7cd('0x16')](function(_0x265423){logger[_0xc7cd('0x12')](_0xc7cd('0xd'),_0x584231,_0x265423);_0x53f7c9(_0x265423);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c65b3f4..9ea671c 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 _0x324f=['../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x324f,0x94));var _0xf324=function(_0x1369c5,_0x48b717){_0x1369c5=_0x1369c5-0x0;var _0x6f395=_0x324f[_0x1369c5];return _0x6f395;};'use strict';var multer=require(_0xf324('0x0'));var util=require(_0xf324('0x1'));var path=require(_0xf324('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf324('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf324('0x4'));var interaction=require(_0xf324('0x5'));var config=require('../../config/environment');var controller=require(_0xf324('0x6'));router[_0xf324('0x7')]('/',auth['isAuthenticated'](),controller[_0xf324('0x8')]);router[_0xf324('0x7')](_0xf324('0x9'),auth[_0xf324('0xa')](),controller[_0xf324('0xb')]);router[_0xf324('0xc')]('/',auth[_0xf324('0xa')](),controller[_0xf324('0xd')]);router[_0xf324('0xe')]('/:id',auth[_0xf324('0xa')](),controller[_0xf324('0xf')]);router[_0xf324('0x10')](_0xf324('0x9'),auth['isAuthenticated'](),controller[_0xf324('0x11')]);module[_0xf324('0x12')]=router; \ No newline at end of file +var _0x495e=['fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','post','create','put','/:id','update','destroy','multer','connect-timeout','express','Router'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x495e,0xfb));var _0xe495=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x495e[_0x37e886];return _0x57c5cd;};'use strict';var multer=require(_0xe495('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe495('0x1'));var express=require(_0xe495('0x2'));var router=express[_0xe495('0x3')]();var fs_extra=require(_0xe495('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe495('0x5'));var config=require(_0xe495('0x6'));var controller=require(_0xe495('0x7'));router[_0xe495('0x8')]('/',auth[_0xe495('0x9')](),controller[_0xe495('0xa')]);router[_0xe495('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe495('0xb')]('/',auth['isAuthenticated'](),controller[_0xe495('0xc')]);router[_0xe495('0xd')](_0xe495('0xe'),auth[_0xe495('0x9')](),controller[_0xe495('0xf')]);router['delete'](_0xe495('0xe'),auth[_0xe495('0x9')](),controller[_0xe495('0x10')]);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 ef7e27d..7e4c82e 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 _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x7c14bc,_0x1d0b6f){var _0x13f5c7=function(_0x34f55a){while(--_0x34f55a){_0x7c14bc['push'](_0x7c14bc['shift']());}};_0x13f5c7(++_0x1d0b6f);}(_0x34e8,0x12c));var _0x834e=function(_0x54b7ab,_0x1a658e){_0x54b7ab=_0x54b7ab-0x0;var _0x15a8ba=_0x34e8[_0x54b7ab];return _0x15a8ba;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x191a17,_0x2e6cbf){var _0x4b4cb9=function(_0x163032){while(--_0x163032){_0x191a17['push'](_0x191a17['shift']());}};_0x4b4cb9(++_0x2e6cbf);}(_0xe14b,0x93));var _0xbe14=function(_0x254e46,_0x4ee9b4){_0x254e46=_0x254e46-0x0;var _0x9928e5=_0xe14b[_0x254e46];return _0x9928e5;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 002dd69..bb3de0c 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 _0x7a13=['join','root','server/files/templates/context.ejs','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Contexts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','name','send','render','merge','body','agent','interaction','account','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','type','VIRTUAL','options','VoiceContext','includeAll','include','findAll','show','params','create','readFileSync'];(function(_0x20afc3,_0x2f189a){var _0x4cbb43=function(_0x647042){while(--_0x647042){_0x20afc3['push'](_0x20afc3['shift']());}};_0x4cbb43(++_0x2f189a);}(_0x7a13,0xec));var _0x37a1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7a13[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x37a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x37a1('0x1'));var jsonpatch=require(_0x37a1('0x2'));var rp=require(_0x37a1('0x3'));var moment=require(_0x37a1('0x4'));var BPromise=require(_0x37a1('0x5'));var Mustache=require(_0x37a1('0x6'));var util=require(_0x37a1('0x7'));var path=require(_0x37a1('0x8'));var sox=require(_0x37a1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37a1('0xa'));var _=require(_0x37a1('0xb'));var squel=require('squel');var crypto=require(_0x37a1('0xc'));var jsforce=require(_0x37a1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x37a1('0xe'));var Papa=require(_0x37a1('0xf'));var Redis=require(_0x37a1('0x10'));var authService=require(_0x37a1('0x11'));var qs=require(_0x37a1('0x12'));var as=require(_0x37a1('0x13'));var hardwareService=require(_0x37a1('0x14'));var logger=require(_0x37a1('0x15'))(_0x37a1('0x16'));var utils=require(_0x37a1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x37a1('0x18'));var db=require(_0x37a1('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x37a1('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x448d57,_0x479975,_0x2cef79,_0x371505){return new BPromise(function(_0x1997c7,_0x289b42){var _0x212cdf=_0x371505||client;return _0x212cdf[_0x37a1('0x1b')](_0x448d57,_0x2cef79)[_0x37a1('0x1c')](function(_0x30c027){logger['info'](_0x37a1('0x1d'),_0x479975,_0x37a1('0x1e'));logger[_0x37a1('0x1f')](_0x37a1('0x20'),_0x479975,_0x37a1('0x1e'),JSON[_0x37a1('0x21')](_0x30c027));if(_0x30c027[_0x37a1('0x22')]){if(_0x30c027[_0x37a1('0x22')]['code']===0x1f4){logger[_0x37a1('0x22')](_0x37a1('0x1d'),_0x479975,_0x30c027[_0x37a1('0x22')][_0x37a1('0x23')]);return _0x289b42(_0x30c027['error'][_0x37a1('0x23')]);}logger['error'](_0x37a1('0x1d'),_0x479975,_0x30c027[_0x37a1('0x22')][_0x37a1('0x23')]);return _0x1997c7(_0x30c027[_0x37a1('0x22')][_0x37a1('0x23')]);}else{logger['info'](_0x37a1('0x1d'),_0x479975,_0x37a1('0x1e'));_0x1997c7(_0x30c027[_0x37a1('0x24')][_0x37a1('0x23')]);}})[_0x37a1('0x25')](function(_0x8ede52){logger[_0x37a1('0x22')](_0x37a1('0x1d'),_0x479975,_0x8ede52);_0x289b42(_0x8ede52);});});}function respondWithStatusCode(_0x79a7e2,_0xfe8e3d){_0xfe8e3d=_0xfe8e3d||0xcc;return function(_0x45a588){if(_0x45a588){return _0x79a7e2[_0x37a1('0x26')](_0xfe8e3d);}return _0x79a7e2['status'](_0xfe8e3d)[_0x37a1('0x27')]();};}function respondWithResult(_0xe89da9,_0x111226){_0x111226=_0x111226||0xc8;return function(_0x2bcb5a){if(_0x2bcb5a){return _0xe89da9[_0x37a1('0x28')](_0x111226)[_0x37a1('0x29')](_0x2bcb5a);}};}function respondWithFilteredResult(_0x1fe6f1,_0x289309){return function(_0x1ca23c){if(_0x1ca23c){var _0x4dc70c=typeof _0x289309[_0x37a1('0x2a')]===_0x37a1('0x2b')&&typeof _0x289309[_0x37a1('0x2c')]==='undefined';var _0x5d5ed7=_0x1ca23c[_0x37a1('0x2d')];var _0x2af78e=_0x4dc70c?0x0:_0x289309['offset'];var _0x3d0169=_0x4dc70c?_0x1ca23c[_0x37a1('0x2d')]:_0x289309['offset']+_0x289309['limit'];var _0x265b47;if(_0x3d0169>=_0x5d5ed7){_0x3d0169=_0x5d5ed7;_0x265b47=0xc8;}else{_0x265b47=0xce;}_0x1fe6f1[_0x37a1('0x28')](_0x265b47);return _0x1fe6f1[_0x37a1('0x2e')](_0x37a1('0x2f'),_0x2af78e+'-'+_0x3d0169+'/'+_0x5d5ed7)[_0x37a1('0x29')](_0x1ca23c);}return null;};}function patchUpdates(_0x1dc455){return function(_0x4ff395){try{jsonpatch['apply'](_0x4ff395,_0x1dc455,!![]);}catch(_0x4754bd){return BPromise[_0x37a1('0x30')](_0x4754bd);}return _0x4ff395[_0x37a1('0x31')]();};}function saveUpdates(_0x59c123,_0x4e1f24){return function(_0x369277){if(_0x369277){return _0x369277[_0x37a1('0x32')](_0x59c123)['then'](function(_0x3e73c8){return _0x3e73c8;});}return null;};}function removeEntity(_0x28485f,_0x5c227d){return function(_0x3d672d){if(_0x3d672d){return _0x3d672d[_0x37a1('0x33')]()[_0x37a1('0x1c')](function(){var _0x48979e=_0x3d672d[_0x37a1('0x34')]({'plain':!![]});var _0x12d743='Contexts';return db['UserProfileResource']['destroy']({'where':{'type':_0x12d743,'resourceId':_0x48979e['id']}})[_0x37a1('0x1c')](function(){return _0x3d672d;});})[_0x37a1('0x1c')](function(){_0x28485f['status'](0xcc)[_0x37a1('0x27')]();});}};}function handleEntityNotFound(_0x156fe6,_0x1541f4){return function(_0x43052c){if(!_0x43052c){_0x156fe6[_0x37a1('0x26')](0x194);}return _0x43052c;};}function handleError(_0x1cd710,_0xb9a0a2){_0xb9a0a2=_0xb9a0a2||0x1f4;return function(_0x371256){logger[_0x37a1('0x22')](_0x371256['stack']);if(_0x371256['name']){delete _0x371256[_0x37a1('0x35')];}_0x1cd710[_0x37a1('0x28')](_0xb9a0a2)[_0x37a1('0x36')](_0x371256);};}function getMustacheRender(_0x464cb3,_0x2ad4f2){return Mustache[_0x37a1('0x37')](_0x464cb3,_[_0x37a1('0x38')](_0x2ad4f2[_0x37a1('0x39')],{'contact':_0x2ad4f2['contact'],'message':_0x2ad4f2['message'],'agent':_0x2ad4f2[_0x37a1('0x3a')],'interaction':_0x2ad4f2[_0x37a1('0x3b')],'account':_0x2ad4f2[_0x37a1('0x3c')]}))||'';}exports[_0x37a1('0x3d')]=function(_0xca5df3,_0x56ce90){var _0x240bf3={},_0x323c0a={},_0x5b9900={'count':0x0,'rows':[]};var _0x574279=_['map'](db['VoiceContext'][_0x37a1('0x3e')],function(_0x41abe6){return{'name':_0x41abe6[_0x37a1('0x3f')],'type':_0x41abe6['type'][_0x37a1('0x40')]};});_0x323c0a[_0x37a1('0x41')]=_[_0x37a1('0x42')](_0x574279,'name');_0x323c0a[_0x37a1('0x43')]=_[_0x37a1('0x44')](_0xca5df3[_0x37a1('0x43')]);_0x323c0a[_0x37a1('0x45')]=_['intersection'](_0x323c0a[_0x37a1('0x41')],_0x323c0a[_0x37a1('0x43')]);_0x240bf3['attributes']=_[_0x37a1('0x46')](_0x323c0a['model'],qs['fields'](_0xca5df3[_0x37a1('0x43')][_0x37a1('0x47')]));_0x240bf3[_0x37a1('0x48')]=_0x240bf3[_0x37a1('0x48')][_0x37a1('0x49')]?_0x240bf3['attributes']:_0x323c0a['model'];if(!_0xca5df3[_0x37a1('0x43')][_0x37a1('0x4a')](_0x37a1('0x4b'))){_0x240bf3['limit']=qs[_0x37a1('0x2c')](_0xca5df3[_0x37a1('0x43')][_0x37a1('0x2c')]);_0x240bf3[_0x37a1('0x2a')]=qs[_0x37a1('0x2a')](_0xca5df3[_0x37a1('0x43')][_0x37a1('0x2a')]);}_0x240bf3[_0x37a1('0x4c')]=qs['sort'](_0xca5df3[_0x37a1('0x43')]['sort']);_0x240bf3['where']=qs[_0x37a1('0x45')](_[_0x37a1('0x4d')](_0xca5df3['query'],_0x323c0a[_0x37a1('0x45')]),_0x574279);if(_0xca5df3[_0x37a1('0x43')][_0x37a1('0x4e')]){_0x240bf3[_0x37a1('0x4f')]=_['merge'](_0x240bf3['where'],{'$or':_['map'](_0x574279,function(_0x21344c){if(_0x21344c[_0x37a1('0x50')]!==_0x37a1('0x51')){var _0x9f4097={};_0x9f4097[_0x21344c[_0x37a1('0x35')]]={'$like':'%'+_0xca5df3[_0x37a1('0x43')]['filter']+'%'};return _0x9f4097;}})});}_0x240bf3=_[_0x37a1('0x38')]({},_0x240bf3,_0xca5df3[_0x37a1('0x52')]);var _0x30d34a={'where':_0x240bf3[_0x37a1('0x4f')]};return db[_0x37a1('0x53')][_0x37a1('0x2d')](_0x30d34a)[_0x37a1('0x1c')](function(_0x580ba3){_0x5b9900[_0x37a1('0x2d')]=_0x580ba3;if(_0xca5df3[_0x37a1('0x43')][_0x37a1('0x54')]){_0x240bf3[_0x37a1('0x55')]=[{'all':!![]}];}return db[_0x37a1('0x53')][_0x37a1('0x56')](_0x240bf3);})['then'](function(_0x420e9b){_0x5b9900['rows']=_0x420e9b;return _0x5b9900;})[_0x37a1('0x1c')](respondWithFilteredResult(_0x56ce90,_0x240bf3))['catch'](handleError(_0x56ce90,null));};exports[_0x37a1('0x57')]=function(_0x57c5ae,_0xa8cb81){var _0x329364={'raw':![],'where':{'id':_0x57c5ae[_0x37a1('0x58')]['id']}},_0x3cbb59={};_0x3cbb59['model']=_['keys'](db['VoiceContext'][_0x37a1('0x3e')]);_0x3cbb59[_0x37a1('0x43')]=_['keys'](_0x57c5ae['query']);_0x3cbb59[_0x37a1('0x45')]=_['intersection'](_0x3cbb59['model'],_0x3cbb59[_0x37a1('0x43')]);_0x329364[_0x37a1('0x48')]=_[_0x37a1('0x46')](_0x3cbb59[_0x37a1('0x41')],qs[_0x37a1('0x47')](_0x57c5ae[_0x37a1('0x43')][_0x37a1('0x47')]));_0x329364[_0x37a1('0x48')]=_0x329364[_0x37a1('0x48')][_0x37a1('0x49')]?_0x329364[_0x37a1('0x48')]:_0x3cbb59[_0x37a1('0x41')];if(_0x57c5ae[_0x37a1('0x43')][_0x37a1('0x54')]){_0x329364['include']=[{'all':!![]}];}_0x329364=_[_0x37a1('0x38')]({},_0x329364,_0x57c5ae[_0x37a1('0x52')]);return db['VoiceContext']['find'](_0x329364)[_0x37a1('0x1c')](handleEntityNotFound(_0xa8cb81,null))[_0x37a1('0x1c')](respondWithResult(_0xa8cb81,null))[_0x37a1('0x25')](handleError(_0xa8cb81,null));};exports[_0x37a1('0x59')]=function(_0x56c18a,_0xbd6053,_0x2e7d97){var _0x4041ee;return db[_0x37a1('0x53')]['create'](_0x56c18a[_0x37a1('0x39')],{'raw':!![]})[_0x37a1('0x1c')](function(_0x4673b1){_0x4041ee=_0x4673b1;return db[_0x37a1('0x53')]['findAll']({'raw':!![]});})[_0x37a1('0x1c')](function(_0x698cfb){var _0x2ff82b=fs[_0x37a1('0x5a')](path[_0x37a1('0x5b')](config[_0x37a1('0x5c')],_0x37a1('0x5d')),_0x37a1('0x5e'));var _0x38520f=ejs['render'](_0x2ff82b,{'contexts':_0x698cfb||[]});fs['writeFileSync'](_0x37a1('0x5f'),_0x38520f);})['then'](function(){return respondWithRpcPromise(_0x37a1('0x60'),'create',{'module':_0x37a1('0x61')});})[_0x37a1('0x1c')](function(){var _0x534ad5=_0x56c18a[_0x37a1('0x62')][_0x37a1('0x34')]({'plain':!![]});if(!_0x534ad5)throw new Error(_0x37a1('0x63'));if(_0x534ad5[_0x37a1('0x64')]===_0x37a1('0x62')){var _0x1a206c=_0x4041ee[_0x37a1('0x34')]({'plain':!![]});return db[_0x37a1('0x65')][_0x37a1('0x66')]({'where':{'name':_0x37a1('0x67'),'userProfileId':_0x534ad5[_0x37a1('0x68')]},'raw':!![]})[_0x37a1('0x1c')](function(_0x35a6ec){if(_0x35a6ec&&_0x35a6ec[_0x37a1('0x69')]===0x0){return db[_0x37a1('0x6a')][_0x37a1('0x59')]({'name':_0x1a206c[_0x37a1('0x35')],'resourceId':_0x1a206c['id'],'type':_0x35a6ec['name'],'sectionId':_0x35a6ec['id']},{})[_0x37a1('0x1c')](function(){return _0x4041ee;});}else{return _0x4041ee;}})[_0x37a1('0x25')](function(_0x33492a){logger[_0x37a1('0x22')](_0x37a1('0x6b'),_0x33492a);throw _0x33492a;});}return _0x4041ee;})[_0x37a1('0x1c')](respondWithResult(_0xbd6053,0xc9))[_0x37a1('0x25')](handleError(_0xbd6053,null));};exports[_0x37a1('0x32')]=function(_0x7ff59b,_0x40970f,_0x2d2d76){var _0x4fe6b3;return db[_0x37a1('0x53')][_0x37a1('0x66')]({'where':{'id':_0x7ff59b[_0x37a1('0x58')]['id']}})[_0x37a1('0x1c')](handleEntityNotFound(_0x40970f,null))[_0x37a1('0x1c')](saveUpdates(_0x7ff59b['body'],null))[_0x37a1('0x1c')](function(_0xc7c154){if(_0xc7c154){_0x4fe6b3=_0xc7c154;return db[_0x37a1('0x53')][_0x37a1('0x56')]({'raw':!![]});}})[_0x37a1('0x1c')](function(_0x240a3a){var _0x526a1f=fs[_0x37a1('0x5a')](path[_0x37a1('0x5b')](config['root'],_0x37a1('0x5d')),_0x37a1('0x5e'));var _0x57fc5d=ejs[_0x37a1('0x37')](_0x526a1f,{'contexts':_0x240a3a||[]});fs[_0x37a1('0x6c')](_0x37a1('0x5f'),_0x57fc5d);})[_0x37a1('0x1c')](function(){return respondWithRpcPromise(_0x37a1('0x60'),_0x37a1('0x32'),{'module':_0x37a1('0x61')});})[_0x37a1('0x1c')](function(){return _0x4fe6b3;})['then'](respondWithResult(_0x40970f,null))[_0x37a1('0x25')](handleError(_0x40970f,null));};exports['destroy']=function(_0xdb9076,_0x2cc4ff,_0x4bc17c){var _0x4c4eea;return db[_0x37a1('0x53')][_0x37a1('0x66')]({'where':{'id':_0xdb9076['params']['id']}})['then'](handleEntityNotFound(_0x2cc4ff,null))['then'](removeEntity(_0x2cc4ff,null))[_0x37a1('0x1c')](function(){return db[_0x37a1('0x53')][_0x37a1('0x56')]({'raw':!![]});})[_0x37a1('0x1c')](function(_0xeb7c44){var _0x35fb17=fs[_0x37a1('0x5a')](path[_0x37a1('0x5b')](config[_0x37a1('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x85d3bb=ejs[_0x37a1('0x37')](_0x35fb17,{'contexts':_0xeb7c44});fs[_0x37a1('0x6c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x85d3bb);return respondWithRpcPromise(_0x37a1('0x60'),_0x37a1('0x33'),{'module':_0x37a1('0x61')});})['catch'](handleError(_0x2cc4ff,null));}; \ No newline at end of file +var _0xb313=['message','result','catch','status','json','limit','count','offset','apply','save','update','destroy','get','Contexts','end','stack','name','send','render','contact','agent','account','index','map','VoiceContext','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','show','params','length','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','writeFileSync','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x12aef6,_0x1a7923){var _0xeabc83=function(_0x3462f0){while(--_0x3462f0){_0x12aef6['push'](_0x12aef6['shift']());}};_0xeabc83(++_0x1a7923);}(_0xb313,0x167));var _0x3b31=function(_0x315d54,_0x333bec){_0x315d54=_0x315d54-0x0;var _0x21c13e=_0xb313[_0x315d54];return _0x21c13e;};'use strict';var emlformat=require(_0x3b31('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b31('0x1'));var jsonpatch=require(_0x3b31('0x2'));var rp=require(_0x3b31('0x3'));var moment=require('moment');var BPromise=require(_0x3b31('0x4'));var Mustache=require(_0x3b31('0x5'));var util=require(_0x3b31('0x6'));var path=require(_0x3b31('0x7'));var sox=require('sox');var csv=require(_0x3b31('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b31('0x9'));var _=require(_0x3b31('0xa'));var squel=require('squel');var crypto=require(_0x3b31('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3b31('0xc'));var toCsv=require(_0x3b31('0x8'));var querystring=require(_0x3b31('0xd'));var Papa=require(_0x3b31('0xe'));var Redis=require(_0x3b31('0xf'));var authService=require(_0x3b31('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3b31('0x11'));var hardwareService=require(_0x3b31('0x12'));var logger=require('../../config/logger')(_0x3b31('0x13'));var utils=require('../../config/utils');var config=require(_0x3b31('0x14'));var licenseUtil=require(_0x3b31('0x15'));var db=require(_0x3b31('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3b31('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe92d0d,_0x2f206a,_0x5ec4ba,_0x38e7ee){return new BPromise(function(_0x46230c,_0x5023fa){var _0xf606e2=_0x38e7ee||client;return _0xf606e2[_0x3b31('0x18')](_0xe92d0d,_0x5ec4ba)[_0x3b31('0x19')](function(_0x4e609c){logger[_0x3b31('0x1a')](_0x3b31('0x1b'),_0x2f206a,_0x3b31('0x1c'));logger['debug'](_0x3b31('0x1d'),_0x2f206a,_0x3b31('0x1c'),JSON[_0x3b31('0x1e')](_0x4e609c));if(_0x4e609c[_0x3b31('0x1f')]){if(_0x4e609c[_0x3b31('0x1f')][_0x3b31('0x20')]===0x1f4){logger[_0x3b31('0x1f')](_0x3b31('0x1b'),_0x2f206a,_0x4e609c['error'][_0x3b31('0x21')]);return _0x5023fa(_0x4e609c[_0x3b31('0x1f')][_0x3b31('0x21')]);}logger[_0x3b31('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x2f206a,_0x4e609c[_0x3b31('0x1f')][_0x3b31('0x21')]);return _0x46230c(_0x4e609c[_0x3b31('0x1f')][_0x3b31('0x21')]);}else{logger[_0x3b31('0x1a')](_0x3b31('0x1b'),_0x2f206a,_0x3b31('0x1c'));_0x46230c(_0x4e609c[_0x3b31('0x22')][_0x3b31('0x21')]);}})[_0x3b31('0x23')](function(_0x406a02){logger[_0x3b31('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x2f206a,_0x406a02);_0x5023fa(_0x406a02);});});}function respondWithStatusCode(_0x2fbb32,_0x46a6da){_0x46a6da=_0x46a6da||0xcc;return function(_0x3fda1c){if(_0x3fda1c){return _0x2fbb32['sendStatus'](_0x46a6da);}return _0x2fbb32[_0x3b31('0x24')](_0x46a6da)['end']();};}function respondWithResult(_0x271946,_0x31f83c){_0x31f83c=_0x31f83c||0xc8;return function(_0x49fe36){if(_0x49fe36){return _0x271946[_0x3b31('0x24')](_0x31f83c)[_0x3b31('0x25')](_0x49fe36);}};}function respondWithFilteredResult(_0x2a7ae2,_0x1241b4){return function(_0x42f3d0){if(_0x42f3d0){var _0x14b290=typeof _0x1241b4['offset']==='undefined'&&typeof _0x1241b4[_0x3b31('0x26')]==='undefined';var _0x226880=_0x42f3d0[_0x3b31('0x27')];var _0x490fbb=_0x14b290?0x0:_0x1241b4[_0x3b31('0x28')];var _0x493203=_0x14b290?_0x42f3d0[_0x3b31('0x27')]:_0x1241b4[_0x3b31('0x28')]+_0x1241b4[_0x3b31('0x26')];var _0x1c1820;if(_0x493203>=_0x226880){_0x493203=_0x226880;_0x1c1820=0xc8;}else{_0x1c1820=0xce;}_0x2a7ae2[_0x3b31('0x24')](_0x1c1820);return _0x2a7ae2['set']('Content-Range',_0x490fbb+'-'+_0x493203+'/'+_0x226880)['json'](_0x42f3d0);}return null;};}function patchUpdates(_0x4ff0cd){return function(_0x957639){try{jsonpatch[_0x3b31('0x29')](_0x957639,_0x4ff0cd,!![]);}catch(_0x173a45){return BPromise['reject'](_0x173a45);}return _0x957639[_0x3b31('0x2a')]();};}function saveUpdates(_0x56f51b,_0x310490){return function(_0xc74e63){if(_0xc74e63){return _0xc74e63[_0x3b31('0x2b')](_0x56f51b)['then'](function(_0x25fd7d){return _0x25fd7d;});}return null;};}function removeEntity(_0x57b49a,_0xe6e833){return function(_0x269a34){if(_0x269a34){return _0x269a34[_0x3b31('0x2c')]()[_0x3b31('0x19')](function(){var _0x24e051=_0x269a34[_0x3b31('0x2d')]({'plain':!![]});var _0x5b66e1=_0x3b31('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x5b66e1,'resourceId':_0x24e051['id']}})[_0x3b31('0x19')](function(){return _0x269a34;});})[_0x3b31('0x19')](function(){_0x57b49a[_0x3b31('0x24')](0xcc)[_0x3b31('0x2f')]();});}};}function handleEntityNotFound(_0x5d10bf,_0x9db791){return function(_0x5f4f99){if(!_0x5f4f99){_0x5d10bf['sendStatus'](0x194);}return _0x5f4f99;};}function handleError(_0x2df8be,_0x1a842f){_0x1a842f=_0x1a842f||0x1f4;return function(_0x32188d){logger[_0x3b31('0x1f')](_0x32188d[_0x3b31('0x30')]);if(_0x32188d[_0x3b31('0x31')]){delete _0x32188d[_0x3b31('0x31')];}_0x2df8be[_0x3b31('0x24')](_0x1a842f)[_0x3b31('0x32')](_0x32188d);};}function getMustacheRender(_0x2bdd30,_0x3f7008){return Mustache[_0x3b31('0x33')](_0x2bdd30,_['merge'](_0x3f7008['body'],{'contact':_0x3f7008[_0x3b31('0x34')],'message':_0x3f7008['message'],'agent':_0x3f7008[_0x3b31('0x35')],'interaction':_0x3f7008['interaction'],'account':_0x3f7008[_0x3b31('0x36')]}))||'';}exports[_0x3b31('0x37')]=function(_0xf45ddd,_0x1850d5){var _0x7e8b16={},_0x307716={},_0x5816b9={'count':0x0,'rows':[]};var _0x536639=_[_0x3b31('0x38')](db[_0x3b31('0x39')][_0x3b31('0x3a')],function(_0x4ae935){return{'name':_0x4ae935['fieldName'],'type':_0x4ae935['type'][_0x3b31('0x3b')]};});_0x307716[_0x3b31('0x3c')]=_[_0x3b31('0x38')](_0x536639,_0x3b31('0x31'));_0x307716[_0x3b31('0x3d')]=_[_0x3b31('0x3e')](_0xf45ddd[_0x3b31('0x3d')]);_0x307716[_0x3b31('0x3f')]=_[_0x3b31('0x40')](_0x307716[_0x3b31('0x3c')],_0x307716[_0x3b31('0x3d')]);_0x7e8b16[_0x3b31('0x41')]=_[_0x3b31('0x40')](_0x307716[_0x3b31('0x3c')],qs[_0x3b31('0x42')](_0xf45ddd[_0x3b31('0x3d')][_0x3b31('0x42')]));_0x7e8b16[_0x3b31('0x41')]=_0x7e8b16[_0x3b31('0x41')]['length']?_0x7e8b16[_0x3b31('0x41')]:_0x307716['model'];if(!_0xf45ddd['query']['hasOwnProperty']('nolimit')){_0x7e8b16['limit']=qs[_0x3b31('0x26')](_0xf45ddd[_0x3b31('0x3d')][_0x3b31('0x26')]);_0x7e8b16[_0x3b31('0x28')]=qs['offset'](_0xf45ddd[_0x3b31('0x3d')][_0x3b31('0x28')]);}_0x7e8b16[_0x3b31('0x43')]=qs['sort'](_0xf45ddd[_0x3b31('0x3d')][_0x3b31('0x44')]);_0x7e8b16[_0x3b31('0x45')]=qs[_0x3b31('0x3f')](_['pick'](_0xf45ddd[_0x3b31('0x3d')],_0x307716[_0x3b31('0x3f')]),_0x536639);if(_0xf45ddd[_0x3b31('0x3d')][_0x3b31('0x46')]){_0x7e8b16['where']=_[_0x3b31('0x47')](_0x7e8b16[_0x3b31('0x45')],{'$or':_[_0x3b31('0x38')](_0x536639,function(_0x331903){if(_0x331903[_0x3b31('0x48')]!=='VIRTUAL'){var _0x19fcf4={};_0x19fcf4[_0x331903[_0x3b31('0x31')]]={'$like':'%'+_0xf45ddd[_0x3b31('0x3d')][_0x3b31('0x46')]+'%'};return _0x19fcf4;}})});}_0x7e8b16=_[_0x3b31('0x47')]({},_0x7e8b16,_0xf45ddd[_0x3b31('0x49')]);var _0x2bdb8d={'where':_0x7e8b16[_0x3b31('0x45')]};return db[_0x3b31('0x39')][_0x3b31('0x27')](_0x2bdb8d)['then'](function(_0x2fd9c5){_0x5816b9[_0x3b31('0x27')]=_0x2fd9c5;if(_0xf45ddd[_0x3b31('0x3d')][_0x3b31('0x4a')]){_0x7e8b16[_0x3b31('0x4b')]=[{'all':!![]}];}return db['VoiceContext'][_0x3b31('0x4c')](_0x7e8b16);})[_0x3b31('0x19')](function(_0x415f46){_0x5816b9[_0x3b31('0x4d')]=_0x415f46;return _0x5816b9;})[_0x3b31('0x19')](respondWithFilteredResult(_0x1850d5,_0x7e8b16))[_0x3b31('0x23')](handleError(_0x1850d5,null));};exports[_0x3b31('0x4e')]=function(_0xe9ab48,_0xceea23){var _0x3eddf7={'raw':![],'where':{'id':_0xe9ab48[_0x3b31('0x4f')]['id']}},_0xe27955={};_0xe27955[_0x3b31('0x3c')]=_[_0x3b31('0x3e')](db[_0x3b31('0x39')][_0x3b31('0x3a')]);_0xe27955[_0x3b31('0x3d')]=_[_0x3b31('0x3e')](_0xe9ab48[_0x3b31('0x3d')]);_0xe27955[_0x3b31('0x3f')]=_[_0x3b31('0x40')](_0xe27955[_0x3b31('0x3c')],_0xe27955[_0x3b31('0x3d')]);_0x3eddf7[_0x3b31('0x41')]=_['intersection'](_0xe27955['model'],qs['fields'](_0xe9ab48['query']['fields']));_0x3eddf7[_0x3b31('0x41')]=_0x3eddf7[_0x3b31('0x41')][_0x3b31('0x50')]?_0x3eddf7[_0x3b31('0x41')]:_0xe27955[_0x3b31('0x3c')];if(_0xe9ab48[_0x3b31('0x3d')]['includeAll']){_0x3eddf7[_0x3b31('0x4b')]=[{'all':!![]}];}_0x3eddf7=_['merge']({},_0x3eddf7,_0xe9ab48[_0x3b31('0x49')]);return db['VoiceContext']['find'](_0x3eddf7)[_0x3b31('0x19')](handleEntityNotFound(_0xceea23,null))[_0x3b31('0x19')](respondWithResult(_0xceea23,null))[_0x3b31('0x23')](handleError(_0xceea23,null));};exports[_0x3b31('0x51')]=function(_0x5e1f11,_0x118f0f,_0x38430d){var _0x5c62f5;return db['VoiceContext'][_0x3b31('0x51')](_0x5e1f11[_0x3b31('0x52')],{'raw':!![]})[_0x3b31('0x19')](function(_0x561f48){_0x5c62f5=_0x561f48;return db[_0x3b31('0x39')][_0x3b31('0x4c')]({'raw':!![]});})[_0x3b31('0x19')](function(_0x1e169d){var _0x90ab84=fs[_0x3b31('0x53')](path[_0x3b31('0x54')](config['root'],_0x3b31('0x55')),_0x3b31('0x56'));var _0x4a2014=ejs['render'](_0x90ab84,{'contexts':_0x1e169d||[]});fs[_0x3b31('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4a2014);})[_0x3b31('0x19')](function(){return respondWithRpcPromise(_0x3b31('0x58'),_0x3b31('0x51'),{'module':'chan_sip.so'});})[_0x3b31('0x19')](function(){var _0xf37831=_0x5e1f11['user'][_0x3b31('0x2d')]({'plain':!![]});if(!_0xf37831)throw new Error(_0x3b31('0x59'));if(_0xf37831['role']===_0x3b31('0x5a')){var _0x40ef94=_0x5c62f5[_0x3b31('0x2d')]({'plain':!![]});return db[_0x3b31('0x5b')][_0x3b31('0x5c')]({'where':{'name':'Contexts','userProfileId':_0xf37831[_0x3b31('0x5d')]},'raw':!![]})[_0x3b31('0x19')](function(_0x5396c2){if(_0x5396c2&&_0x5396c2['autoAssociation']===0x0){return db['UserProfileResource'][_0x3b31('0x51')]({'name':_0x40ef94['name'],'resourceId':_0x40ef94['id'],'type':_0x5396c2['name'],'sectionId':_0x5396c2['id']},{})[_0x3b31('0x19')](function(){return _0x5c62f5;});}else{return _0x5c62f5;}})[_0x3b31('0x23')](function(_0x1a6000){logger[_0x3b31('0x1f')](_0x3b31('0x5e'),_0x1a6000);throw _0x1a6000;});}return _0x5c62f5;})[_0x3b31('0x19')](respondWithResult(_0x118f0f,0xc9))[_0x3b31('0x23')](handleError(_0x118f0f,null));};exports[_0x3b31('0x2b')]=function(_0x52ca87,_0x2e5e37,_0x534748){var _0x4defb3;return db[_0x3b31('0x39')][_0x3b31('0x5c')]({'where':{'id':_0x52ca87['params']['id']}})[_0x3b31('0x19')](handleEntityNotFound(_0x2e5e37,null))[_0x3b31('0x19')](saveUpdates(_0x52ca87[_0x3b31('0x52')],null))[_0x3b31('0x19')](function(_0x2e4ab0){if(_0x2e4ab0){_0x4defb3=_0x2e4ab0;return db[_0x3b31('0x39')][_0x3b31('0x4c')]({'raw':!![]});}})[_0x3b31('0x19')](function(_0x2a5bbd){var _0x55d321=fs[_0x3b31('0x53')](path[_0x3b31('0x54')](config[_0x3b31('0x5f')],_0x3b31('0x55')),'utf8');var _0x2a37d7=ejs[_0x3b31('0x33')](_0x55d321,{'contexts':_0x2a5bbd||[]});fs[_0x3b31('0x57')](_0x3b31('0x60'),_0x2a37d7);})['then'](function(){return respondWithRpcPromise(_0x3b31('0x58'),_0x3b31('0x2b'),{'module':_0x3b31('0x61')});})[_0x3b31('0x19')](function(){return _0x4defb3;})[_0x3b31('0x19')](respondWithResult(_0x2e5e37,null))[_0x3b31('0x23')](handleError(_0x2e5e37,null));};exports[_0x3b31('0x2c')]=function(_0x2cb405,_0x25e994,_0x3cb367){var _0x2d1378;return db[_0x3b31('0x39')]['find']({'where':{'id':_0x2cb405[_0x3b31('0x4f')]['id']}})[_0x3b31('0x19')](handleEntityNotFound(_0x25e994,null))['then'](removeEntity(_0x25e994,null))[_0x3b31('0x19')](function(){return db[_0x3b31('0x39')][_0x3b31('0x4c')]({'raw':!![]});})[_0x3b31('0x19')](function(_0xccd427){var _0x1cd36a=fs[_0x3b31('0x53')](path[_0x3b31('0x54')](config[_0x3b31('0x5f')],_0x3b31('0x55')),'utf8');var _0x3aeae7=ejs[_0x3b31('0x33')](_0x1cd36a,{'contexts':_0xccd427});fs[_0x3b31('0x57')](_0x3b31('0x60'),_0x3aeae7);return respondWithRpcPromise(_0x3b31('0x58'),_0x3b31('0x2c'),{'module':_0x3b31('0x61')});})[_0x3b31('0x23')](handleError(_0x25e994,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d066813..7f86a10 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 _0xaf15=['bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','api','moment'];(function(_0x5746a1,_0x11eab1){var _0x551a43=function(_0x7ddcbe){while(--_0x7ddcbe){_0x5746a1['push'](_0x5746a1['shift']());}};_0x551a43(++_0x11eab1);}(_0xaf15,0xbd));var _0x5af1=function(_0x461756,_0x475750){_0x461756=_0x461756-0x0;var _0x42966f=_0xaf15[_0x461756];return _0x42966f;};'use strict';var _=require(_0x5af1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5af1('0x1'));var moment=require(_0x5af1('0x2'));var BPromise=require(_0x5af1('0x3'));var rp=require(_0x5af1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5af1('0x5'));var config=require(_0x5af1('0x6'));var attributes=require(_0x5af1('0x7'));module[_0x5af1('0x8')]=function(_0x143842,_0x1541e6){return _0x143842[_0x5af1('0x9')](_0x5af1('0xa'),attributes,{'tableName':_0x5af1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88c1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts','../../config/logger'];(function(_0x18601c,_0x1912e2){var _0x52ffbe=function(_0xb5546f){while(--_0xb5546f){_0x18601c['push'](_0x18601c['shift']());}};_0x52ffbe(++_0x1912e2);}(_0x88c1,0x196));var _0x188c=function(_0x26552a,_0xd975c9){_0x26552a=_0x26552a-0x0;var _0x4daea3=_0x88c1[_0x26552a];return _0x4daea3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x188c('0x0'))('api');var moment=require(_0x188c('0x1'));var BPromise=require(_0x188c('0x2'));var rp=require(_0x188c('0x3'));var fs=require('fs');var path=require(_0x188c('0x4'));var rimraf=require(_0x188c('0x5'));var config=require(_0x188c('0x6'));var attributes=require('./voiceContext.attributes');module[_0x188c('0x7')]=function(_0x1bdbb8,_0x25183e){return _0x1bdbb8[_0x188c('0x8')](_0x188c('0x9'),attributes,{'tableName':_0x188c('0xa'),'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 cb86d43..9f6e268 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 _0x1315=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x295fa1,_0x519643){var _0xa94bfa=function(_0x195f30){while(--_0x195f30){_0x295fa1['push'](_0x295fa1['shift']());}};_0xa94bfa(++_0x519643);}(_0x1315,0x84));var _0x5131=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0x1315[_0x4a29a9];return _0x386570;};'use strict';var _=require(_0x5131('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5131('0x1'));var rs=require(_0x5131('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5131('0x3'))['db'];var utils=require(_0x5131('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5131('0x5'));var jayson=require(_0x5131('0x6'));var client=jayson[_0x5131('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ee2f6,_0x37b931,_0x146ee8){return new BPromise(function(_0x859baa,_0xc0c489){return client[_0x5131('0x8')](_0x2ee2f6,_0x146ee8)[_0x5131('0x9')](function(_0x3921a8){logger[_0x5131('0xa')]('VoiceContext,\x20%s,\x20%s',_0x37b931,_0x5131('0xb'));logger['debug'](_0x5131('0xc'),_0x37b931,_0x5131('0xb'),JSON['stringify'](_0x3921a8));if(_0x3921a8['error']){if(_0x3921a8[_0x5131('0xd')][_0x5131('0xe')]===0x1f4){logger[_0x5131('0xd')](_0x5131('0xf'),_0x37b931,_0x3921a8['error']['message']);return _0xc0c489(_0x3921a8[_0x5131('0xd')][_0x5131('0x10')]);}logger[_0x5131('0xd')](_0x5131('0xf'),_0x37b931,_0x3921a8[_0x5131('0xd')][_0x5131('0x10')]);return _0x859baa(_0x3921a8['error'][_0x5131('0x10')]);}else{logger[_0x5131('0xa')](_0x5131('0xf'),_0x37b931,_0x5131('0xb'));_0x859baa(_0x3921a8[_0x5131('0x11')]['message']);}})[_0x5131('0x12')](function(_0x2b623b){logger['error'](_0x5131('0xf'),_0x37b931,_0x2b623b);_0xc0c489(_0x2b623b);});});} \ No newline at end of file +var _0x0570=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x48498e,_0x1fcc1e){var _0x377457=function(_0x1f1b64){while(--_0x1f1b64){_0x48498e['push'](_0x48498e['shift']());}};_0x377457(++_0x1fcc1e);}(_0x0570,0xd8));var _0x0057=function(_0x3b60f4,_0x3307b9){_0x3b60f4=_0x3b60f4-0x0;var _0x1fc373=_0x0570[_0x3b60f4];return _0x1fc373;};'use strict';var _=require(_0x0057('0x0'));var util=require(_0x0057('0x1'));var moment=require(_0x0057('0x2'));var BPromise=require(_0x0057('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0057('0x4'))['db'];var utils=require(_0x0057('0x5'));var logger=require(_0x0057('0x6'))('rpc');var config=require(_0x0057('0x7'));var jayson=require(_0x0057('0x8'));var client=jayson[_0x0057('0x9')][_0x0057('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f477c,_0x4d2289,_0x5483d4){return new BPromise(function(_0x421564,_0x30c83e){return client[_0x0057('0xb')](_0x2f477c,_0x5483d4)[_0x0057('0xc')](function(_0x5038d7){logger[_0x0057('0xd')](_0x0057('0xe'),_0x4d2289,'request\x20sent');logger['debug'](_0x0057('0xf'),_0x4d2289,'request\x20sent',JSON[_0x0057('0x10')](_0x5038d7));if(_0x5038d7[_0x0057('0x11')]){if(_0x5038d7['error'][_0x0057('0x12')]===0x1f4){logger[_0x0057('0x11')](_0x0057('0xe'),_0x4d2289,_0x5038d7[_0x0057('0x11')][_0x0057('0x13')]);return _0x30c83e(_0x5038d7[_0x0057('0x11')][_0x0057('0x13')]);}logger[_0x0057('0x11')](_0x0057('0xe'),_0x4d2289,_0x5038d7[_0x0057('0x11')][_0x0057('0x13')]);return _0x421564(_0x5038d7['error'][_0x0057('0x13')]);}else{logger['info'](_0x0057('0xe'),_0x4d2289,'request\x20sent');_0x421564(_0x5038d7[_0x0057('0x14')][_0x0057('0x13')]);}})[_0x0057('0x15')](function(_0x3cc970){logger[_0x0057('0x11')](_0x0057('0xe'),_0x4d2289,_0x3cc970);_0x30c83e(_0x3cc970);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8751d11..79a5d26 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 _0xd6d6=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post'];(function(_0x1637c1,_0x3f8021){var _0x4a8277=function(_0x46c416){while(--_0x46c416){_0x1637c1['push'](_0x1637c1['shift']());}};_0x4a8277(++_0x3f8021);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x25c91b,_0x44fa0c){_0x25c91b=_0x25c91b-0x0;var _0x492da8=_0xd6d6[_0x25c91b];return _0x492da8;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var fs_extra=require(_0x6d6d('0x5'));var auth=require(_0x6d6d('0x6'));var interaction=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var controller=require(_0x6d6d('0x9'));router[_0x6d6d('0xa')]('/',auth['isAuthenticated'](),controller[_0x6d6d('0xb')]);router[_0x6d6d('0xa')](_0x6d6d('0xc'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0xe')]);router[_0x6d6d('0xa')](_0x6d6d('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x6d6d('0x10')]('/',auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x11')]);router[_0x6d6d('0x12')](_0x6d6d('0xf'),auth['isAuthenticated'](),controller[_0x6d6d('0x13')]);router[_0x6d6d('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x6d6d('0x15')]);module[_0x6d6d('0x16')]=router; \ No newline at end of file +var _0x6aa7=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','post','create','put','update','delete','exports','multer','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6aa7,0x178));var _0x76aa=function(_0x12ef66,_0xf690c){_0x12ef66=_0x12ef66-0x0;var _0x2ad928=_0x6aa7[_0x12ef66];return _0x2ad928;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0xc')]('/',auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0xe')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x10')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['destroy']);module[_0x76aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f471396..b17529e 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 _0x44a5=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x4599d7,_0x3fa5d1){var _0x5c89d3=function(_0x4577d1){while(--_0x4577d1){_0x4599d7['push'](_0x4599d7['shift']());}};_0x5c89d3(++_0x3fa5d1);}(_0x44a5,0x17e));var _0x544a=function(_0x2f78bd,_0x3c4b24){_0x2f78bd=_0x2f78bd-0x0;var _0x48383e=_0x44a5[_0x2f78bd];return _0x48383e;};'use strict';var Sequelize=require(_0x544a('0x0'));module[_0x544a('0x1')]={'privilege':{'type':Sequelize[_0x544a('0x2')]},'channel':{'type':Sequelize[_0x544a('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x544a('0x2')]},'calleridname':{'type':Sequelize[_0x544a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x544a('0x2')]},'connectedlinename':{'type':Sequelize[_0x544a('0x2')]},'language':{'type':Sequelize[_0x544a('0x2')]},'accountcode':{'type':Sequelize[_0x544a('0x2')]},'context':{'type':Sequelize[_0x544a('0x2')]},'exten':{'type':Sequelize[_0x544a('0x2')]},'priority':{'type':Sequelize[_0x544a('0x3')]},'uniqueid':{'type':Sequelize[_0x544a('0x2')]},'linkedid':{'type':Sequelize[_0x544a('0x2')]},'destchannel':{'type':Sequelize[_0x544a('0x2')]},'destchannelstate':{'type':Sequelize[_0x544a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x544a('0x2')]},'destcalleridname':{'type':Sequelize[_0x544a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x544a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x544a('0x2')]},'destlanguage':{'type':Sequelize[_0x544a('0x2')]},'destaccountcode':{'type':Sequelize[_0x544a('0x2')]},'destcontext':{'type':Sequelize[_0x544a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x544a('0x2')]},'destlinkedid':{'type':Sequelize[_0x544a('0x2')]},'dialstring':{'type':Sequelize[_0x544a('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x544a('0x4')]},'answertime':{'type':Sequelize[_0x544a('0x4')]},'endtime':{'type':Sequelize[_0x544a('0x4')]},'lastevent':{'type':Sequelize[_0x544a('0x2')],'comment':_0x544a('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x544a('0x3')]},'billableseconds':{'type':Sequelize[_0x544a('0x3')]}}; \ No newline at end of file +var _0xdb85=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x4663b8,_0x528c31){var _0x4ff846=function(_0x4a8f3a){while(--_0x4a8f3a){_0x4663b8['push'](_0x4663b8['shift']());}};_0x4ff846(++_0x528c31);}(_0xdb85,0x101));var _0x5db8=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0xdb85[_0x57474e];return _0xfaae8c;};'use strict';var Sequelize=require(_0x5db8('0x0'));module[_0x5db8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5db8('0x2')]},'channelstate':{'type':Sequelize[_0x5db8('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5db8('0x2')]},'calleridnum':{'type':Sequelize[_0x5db8('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5db8('0x2')]},'connectedlinename':{'type':Sequelize[_0x5db8('0x2')]},'language':{'type':Sequelize[_0x5db8('0x2')]},'accountcode':{'type':Sequelize[_0x5db8('0x2')]},'context':{'type':Sequelize[_0x5db8('0x2')]},'exten':{'type':Sequelize[_0x5db8('0x2')]},'priority':{'type':Sequelize[_0x5db8('0x3')]},'uniqueid':{'type':Sequelize[_0x5db8('0x2')]},'linkedid':{'type':Sequelize[_0x5db8('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x5db8('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5db8('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5db8('0x2')]},'destcalleridname':{'type':Sequelize[_0x5db8('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5db8('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x5db8('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5db8('0x3')]},'destuniqueid':{'type':Sequelize[_0x5db8('0x2')]},'destlinkedid':{'type':Sequelize[_0x5db8('0x2')]},'dialstring':{'type':Sequelize[_0x5db8('0x2')]},'dialstatus':{'type':Sequelize[_0x5db8('0x2')]},'starttime':{'type':Sequelize[_0x5db8('0x4')]},'answertime':{'type':Sequelize[_0x5db8('0x4')]},'endtime':{'type':Sequelize[_0x5db8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x5db8('0x5')},'routeId':{'type':Sequelize[_0x5db8('0x3')]},'duration':{'type':Sequelize[_0x5db8('0x3')]},'holdtime':{'type':Sequelize[_0x5db8('0x3')]},'billableseconds':{'type':Sequelize[_0x5db8('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 611b254..2b91552 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 _0xc0c3=['index','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','options','where','then','includeAll','include','findAll','show','params','rawAttributes','length','find','catch','create','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','end','error','stack','name','send','render','merge','body','contact','message','interaction','account'];(function(_0x426c01,_0x347436){var _0x2af01b=function(_0x1e4820){while(--_0x1e4820){_0x426c01['push'](_0x426c01['shift']());}};_0x2af01b(++_0x347436);}(_0xc0c3,0x1d0));var _0x3c0c=function(_0x4a2251,_0x592b33){_0x4a2251=_0x4a2251-0x0;var _0x227687=_0xc0c3[_0x4a2251];return _0x227687;};'use strict';var emlformat=require(_0x3c0c('0x0'));var rimraf=require(_0x3c0c('0x1'));var zipdir=require(_0x3c0c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c0c('0x3'));var moment=require(_0x3c0c('0x4'));var BPromise=require(_0x3c0c('0x5'));var Mustache=require(_0x3c0c('0x6'));var util=require('util');var path=require(_0x3c0c('0x7'));var sox=require(_0x3c0c('0x8'));var csv=require('to-csv');var ejs=require(_0x3c0c('0x9'));var fs=require('fs');var fs_extra=require(_0x3c0c('0xa'));var _=require(_0x3c0c('0xb'));var squel=require('squel');var crypto=require(_0x3c0c('0xc'));var jsforce=require(_0x3c0c('0xd'));var deskjs=require(_0x3c0c('0xe'));var toCsv=require(_0x3c0c('0xf'));var querystring=require('querystring');var Papa=require(_0x3c0c('0x10'));var Redis=require(_0x3c0c('0x11'));var authService=require(_0x3c0c('0x12'));var qs=require(_0x3c0c('0x13'));var as=require(_0x3c0c('0x14'));var hardwareService=require(_0x3c0c('0x15'));var logger=require(_0x3c0c('0x16'))(_0x3c0c('0x17'));var utils=require(_0x3c0c('0x18'));var config=require(_0x3c0c('0x19'));var licenseUtil=require(_0x3c0c('0x1a'));var db=require(_0x3c0c('0x1b'))['db'];function respondWithStatusCode(_0x364605,_0x32a68b){_0x32a68b=_0x32a68b||0xcc;return function(_0x9a3397){if(_0x9a3397){return _0x364605[_0x3c0c('0x1c')](_0x32a68b);}return _0x364605[_0x3c0c('0x1d')](_0x32a68b)['end']();};}function respondWithResult(_0x2ddb91,_0x3876da){_0x3876da=_0x3876da||0xc8;return function(_0xe2a4fb){if(_0xe2a4fb){return _0x2ddb91['status'](_0x3876da)[_0x3c0c('0x1e')](_0xe2a4fb);}};}function respondWithFilteredResult(_0x5793a8,_0x4cc28c){return function(_0x337e93){if(_0x337e93){var _0x3b6d2e=typeof _0x4cc28c[_0x3c0c('0x1f')]===_0x3c0c('0x20')&&typeof _0x4cc28c[_0x3c0c('0x21')]===_0x3c0c('0x20');var _0x3dd091=_0x337e93[_0x3c0c('0x22')];var _0x3cefa6=_0x3b6d2e?0x0:_0x4cc28c[_0x3c0c('0x1f')];var _0x3dea52=_0x3b6d2e?_0x337e93['count']:_0x4cc28c[_0x3c0c('0x1f')]+_0x4cc28c[_0x3c0c('0x21')];var _0x836be6;if(_0x3dea52>=_0x3dd091){_0x3dea52=_0x3dd091;_0x836be6=0xc8;}else{_0x836be6=0xce;}_0x5793a8[_0x3c0c('0x1d')](_0x836be6);return _0x5793a8[_0x3c0c('0x23')](_0x3c0c('0x24'),_0x3cefa6+'-'+_0x3dea52+'/'+_0x3dd091)[_0x3c0c('0x1e')](_0x337e93);}return null;};}function patchUpdates(_0x428b8a){return function(_0x465259){try{jsonpatch[_0x3c0c('0x25')](_0x465259,_0x428b8a,!![]);}catch(_0x44493a){return BPromise['reject'](_0x44493a);}return _0x465259[_0x3c0c('0x26')]();};}function saveUpdates(_0x42cdec,_0x37c419){return function(_0x35da35){if(_0x35da35){return _0x35da35['update'](_0x42cdec)['then'](function(_0x57f2de){return _0x57f2de;});}return null;};}function removeEntity(_0x575f48,_0x29fbd7){return function(_0x5471e3){if(_0x5471e3){return _0x5471e3[_0x3c0c('0x27')]()['then'](function(){_0x575f48['status'](0xcc)[_0x3c0c('0x28')]();});}};}function handleEntityNotFound(_0x173641,_0x2ae259){return function(_0x19ff3d){if(!_0x19ff3d){_0x173641[_0x3c0c('0x1c')](0x194);}return _0x19ff3d;};}function handleError(_0x1ce1f4,_0x46b270){_0x46b270=_0x46b270||0x1f4;return function(_0x1e3c80){logger[_0x3c0c('0x29')](_0x1e3c80[_0x3c0c('0x2a')]);if(_0x1e3c80['name']){delete _0x1e3c80[_0x3c0c('0x2b')];}_0x1ce1f4[_0x3c0c('0x1d')](_0x46b270)[_0x3c0c('0x2c')](_0x1e3c80);};}function getMustacheRender(_0x17ef08,_0x1ab9dd){return Mustache[_0x3c0c('0x2d')](_0x17ef08,_[_0x3c0c('0x2e')](_0x1ab9dd[_0x3c0c('0x2f')],{'contact':_0x1ab9dd[_0x3c0c('0x30')],'message':_0x1ab9dd[_0x3c0c('0x31')],'agent':_0x1ab9dd['agent'],'interaction':_0x1ab9dd[_0x3c0c('0x32')],'account':_0x1ab9dd[_0x3c0c('0x33')]}))||'';}exports[_0x3c0c('0x34')]=function(_0x21323d,_0x2b10a5){var _0x49801a={},_0x447976={},_0x245d96={'count':0x0,'rows':[]};var _0x5d9b19=_[_0x3c0c('0x35')](db[_0x3c0c('0x36')]['rawAttributes'],function(_0x59b1d9){return{'name':_0x59b1d9[_0x3c0c('0x37')],'type':_0x59b1d9[_0x3c0c('0x38')][_0x3c0c('0x39')]};});_0x447976[_0x3c0c('0x3a')]=_[_0x3c0c('0x35')](_0x5d9b19,'name');_0x447976[_0x3c0c('0x3b')]=_[_0x3c0c('0x3c')](_0x21323d[_0x3c0c('0x3b')]);_0x447976[_0x3c0c('0x3d')]=_[_0x3c0c('0x3e')](_0x447976['model'],_0x447976[_0x3c0c('0x3b')]);_0x49801a[_0x3c0c('0x3f')]=_[_0x3c0c('0x3e')](_0x447976[_0x3c0c('0x3a')],qs[_0x3c0c('0x40')](_0x21323d[_0x3c0c('0x3b')][_0x3c0c('0x40')]));_0x49801a['attributes']=_0x49801a['attributes']['length']?_0x49801a[_0x3c0c('0x3f')]:_0x447976[_0x3c0c('0x3a')];if(!_0x21323d[_0x3c0c('0x3b')][_0x3c0c('0x41')](_0x3c0c('0x42'))){_0x49801a[_0x3c0c('0x21')]=qs[_0x3c0c('0x21')](_0x21323d[_0x3c0c('0x3b')][_0x3c0c('0x21')]);_0x49801a[_0x3c0c('0x1f')]=qs[_0x3c0c('0x1f')](_0x21323d[_0x3c0c('0x3b')]['offset']);}_0x49801a[_0x3c0c('0x43')]=qs[_0x3c0c('0x44')](_0x21323d[_0x3c0c('0x3b')][_0x3c0c('0x44')]);_0x49801a['where']=qs[_0x3c0c('0x3d')](_[_0x3c0c('0x45')](_0x21323d['query'],_0x447976[_0x3c0c('0x3d')]),_0x5d9b19);if(_0x21323d[_0x3c0c('0x3b')][_0x3c0c('0x46')]){_0x49801a['where']=_['merge'](_0x49801a['where'],{'$or':_[_0x3c0c('0x35')](_0x5d9b19,function(_0x2d1cbf){if(_0x2d1cbf[_0x3c0c('0x38')]!==_0x3c0c('0x47')){var _0x23686e={};_0x23686e[_0x2d1cbf[_0x3c0c('0x2b')]]={'$like':'%'+_0x21323d[_0x3c0c('0x3b')][_0x3c0c('0x46')]+'%'};return _0x23686e;}})});}_0x49801a=_[_0x3c0c('0x2e')]({},_0x49801a,_0x21323d[_0x3c0c('0x48')]);var _0x25f3b1={'where':_0x49801a[_0x3c0c('0x49')]};return db['VoiceDialReport']['count'](_0x25f3b1)[_0x3c0c('0x4a')](function(_0x5d38ad){_0x245d96['count']=_0x5d38ad;if(_0x21323d[_0x3c0c('0x3b')][_0x3c0c('0x4b')]){_0x49801a[_0x3c0c('0x4c')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x3c0c('0x4d')](_0x49801a);})[_0x3c0c('0x4a')](function(_0xcdbcd9){_0x245d96['rows']=_0xcdbcd9;return _0x245d96;})[_0x3c0c('0x4a')](respondWithFilteredResult(_0x2b10a5,_0x49801a))['catch'](handleError(_0x2b10a5,null));};exports[_0x3c0c('0x4e')]=function(_0x4adbe9,_0x52b093){var _0x57068a={'raw':!![],'where':{'id':_0x4adbe9[_0x3c0c('0x4f')]['id']}},_0x5270df={};_0x5270df[_0x3c0c('0x3a')]=_[_0x3c0c('0x3c')](db[_0x3c0c('0x36')][_0x3c0c('0x50')]);_0x5270df[_0x3c0c('0x3b')]=_['keys'](_0x4adbe9[_0x3c0c('0x3b')]);_0x5270df[_0x3c0c('0x3d')]=_['intersection'](_0x5270df[_0x3c0c('0x3a')],_0x5270df['query']);_0x57068a['attributes']=_[_0x3c0c('0x3e')](_0x5270df['model'],qs[_0x3c0c('0x40')](_0x4adbe9[_0x3c0c('0x3b')][_0x3c0c('0x40')]));_0x57068a[_0x3c0c('0x3f')]=_0x57068a[_0x3c0c('0x3f')][_0x3c0c('0x51')]?_0x57068a[_0x3c0c('0x3f')]:_0x5270df[_0x3c0c('0x3a')];if(_0x4adbe9[_0x3c0c('0x3b')][_0x3c0c('0x4b')]){_0x57068a['include']=[{'all':!![]}];}_0x57068a=_[_0x3c0c('0x2e')]({},_0x57068a,_0x4adbe9['options']);return db['VoiceDialReport'][_0x3c0c('0x52')](_0x57068a)[_0x3c0c('0x4a')](handleEntityNotFound(_0x52b093,null))[_0x3c0c('0x4a')](respondWithResult(_0x52b093,null))[_0x3c0c('0x53')](handleError(_0x52b093,null));};exports[_0x3c0c('0x54')]=function(_0x349919,_0x4783fc){return db[_0x3c0c('0x36')][_0x3c0c('0x54')](_0x349919[_0x3c0c('0x2f')],{})[_0x3c0c('0x4a')](respondWithResult(_0x4783fc,0xc9))[_0x3c0c('0x53')](handleError(_0x4783fc,null));};exports['update']=function(_0xc9769,_0xd46b6){if(_0xc9769['body']['id']){delete _0xc9769[_0x3c0c('0x2f')]['id'];}return db[_0x3c0c('0x36')][_0x3c0c('0x52')]({'where':{'id':_0xc9769['params']['id']}})[_0x3c0c('0x4a')](handleEntityNotFound(_0xd46b6,null))['then'](saveUpdates(_0xc9769[_0x3c0c('0x2f')],null))['then'](respondWithResult(_0xd46b6,null))[_0x3c0c('0x53')](handleError(_0xd46b6,null));};exports[_0x3c0c('0x27')]=function(_0x531e6c,_0x503ad8){return db['VoiceDialReport'][_0x3c0c('0x52')]({'where':{'id':_0x531e6c['params']['id']}})['then'](handleEntityNotFound(_0x503ad8,null))[_0x3c0c('0x4a')](removeEntity(_0x503ad8,null))[_0x3c0c('0x53')](handleError(_0x503ad8,null));};exports[_0x3c0c('0x55')]=function(_0x1275c9,_0x624836){return db[_0x3c0c('0x36')][_0x3c0c('0x55')]()[_0x3c0c('0x4a')](respondWithResult(_0x624836,null))[_0x3c0c('0x53')](handleError(_0x624836,null));}; \ No newline at end of file +var _0x606c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','stack','name','render','body','contact','message','agent','interaction','index','map','VoiceDialReport','rawAttributes','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','keys','fields','find','create','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x7ea4d,_0xe81614){var _0x7617e4=function(_0xe329e0){while(--_0xe329e0){_0x7ea4d['push'](_0x7ea4d['shift']());}};_0x7617e4(++_0xe81614);}(_0x606c,0x16c));var _0xc606=function(_0x1c470d,_0x81d66b){_0x1c470d=_0x1c470d-0x0;var _0x12141b=_0x606c[_0x1c470d];return _0x12141b;};'use strict';var emlformat=require(_0xc606('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc606('0x1'));var jsonpatch=require(_0xc606('0x2'));var rp=require(_0xc606('0x3'));var moment=require(_0xc606('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc606('0x5'));var util=require('util');var path=require(_0xc606('0x6'));var sox=require(_0xc606('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc606('0x8'));var squel=require('squel');var crypto=require(_0xc606('0x9'));var jsforce=require(_0xc606('0xa'));var deskjs=require(_0xc606('0xb'));var toCsv=require(_0xc606('0xc'));var querystring=require('querystring');var Papa=require(_0xc606('0xd'));var Redis=require(_0xc606('0xe'));var authService=require(_0xc606('0xf'));var qs=require(_0xc606('0x10'));var as=require(_0xc606('0x11'));var hardwareService=require(_0xc606('0x12'));var logger=require('../../config/logger')(_0xc606('0x13'));var utils=require(_0xc606('0x14'));var config=require(_0xc606('0x15'));var licenseUtil=require(_0xc606('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1305e1,_0x9f6164){_0x9f6164=_0x9f6164||0xcc;return function(_0x338e43){if(_0x338e43){return _0x1305e1[_0xc606('0x17')](_0x9f6164);}return _0x1305e1[_0xc606('0x18')](_0x9f6164)[_0xc606('0x19')]();};}function respondWithResult(_0x4e7cf3,_0x35249d){_0x35249d=_0x35249d||0xc8;return function(_0x228e0a){if(_0x228e0a){return _0x4e7cf3[_0xc606('0x18')](_0x35249d)[_0xc606('0x1a')](_0x228e0a);}};}function respondWithFilteredResult(_0x20c4ec,_0x502420){return function(_0x1da617){if(_0x1da617){var _0x51d26c=typeof _0x502420[_0xc606('0x1b')]==='undefined'&&typeof _0x502420[_0xc606('0x1c')]===_0xc606('0x1d');var _0x3c53d3=_0x1da617[_0xc606('0x1e')];var _0xbaed22=_0x51d26c?0x0:_0x502420[_0xc606('0x1b')];var _0x3d04e1=_0x51d26c?_0x1da617[_0xc606('0x1e')]:_0x502420[_0xc606('0x1b')]+_0x502420[_0xc606('0x1c')];var _0x2ed9dd;if(_0x3d04e1>=_0x3c53d3){_0x3d04e1=_0x3c53d3;_0x2ed9dd=0xc8;}else{_0x2ed9dd=0xce;}_0x20c4ec[_0xc606('0x18')](_0x2ed9dd);return _0x20c4ec[_0xc606('0x1f')]('Content-Range',_0xbaed22+'-'+_0x3d04e1+'/'+_0x3c53d3)['json'](_0x1da617);}return null;};}function patchUpdates(_0x424b1e){return function(_0x58216c){try{jsonpatch[_0xc606('0x20')](_0x58216c,_0x424b1e,!![]);}catch(_0x461a9b){return BPromise[_0xc606('0x21')](_0x461a9b);}return _0x58216c[_0xc606('0x22')]();};}function saveUpdates(_0x5192d6,_0x4c6575){return function(_0x13b8c0){if(_0x13b8c0){return _0x13b8c0[_0xc606('0x23')](_0x5192d6)['then'](function(_0x34320b){return _0x34320b;});}return null;};}function removeEntity(_0x4da495,_0x54c1b9){return function(_0x35ec90){if(_0x35ec90){return _0x35ec90['destroy']()[_0xc606('0x24')](function(){_0x4da495[_0xc606('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e434a,_0x200daa){return function(_0x472a23){if(!_0x472a23){_0x2e434a['sendStatus'](0x194);}return _0x472a23;};}function handleError(_0x535173,_0x49933f){_0x49933f=_0x49933f||0x1f4;return function(_0x4b8825){logger['error'](_0x4b8825[_0xc606('0x25')]);if(_0x4b8825[_0xc606('0x26')]){delete _0x4b8825[_0xc606('0x26')];}_0x535173[_0xc606('0x18')](_0x49933f)['send'](_0x4b8825);};}function getMustacheRender(_0x4aacd6,_0x2df772){return Mustache[_0xc606('0x27')](_0x4aacd6,_['merge'](_0x2df772[_0xc606('0x28')],{'contact':_0x2df772[_0xc606('0x29')],'message':_0x2df772[_0xc606('0x2a')],'agent':_0x2df772[_0xc606('0x2b')],'interaction':_0x2df772[_0xc606('0x2c')],'account':_0x2df772['account']}))||'';}exports[_0xc606('0x2d')]=function(_0x5413f6,_0x3829ee){var _0x2e1c9a={},_0x57ccae={},_0x13ba1c={'count':0x0,'rows':[]};var _0x2e72b5=_[_0xc606('0x2e')](db[_0xc606('0x2f')][_0xc606('0x30')],function(_0xe3eaef){return{'name':_0xe3eaef['fieldName'],'type':_0xe3eaef[_0xc606('0x31')][_0xc606('0x32')]};});_0x57ccae[_0xc606('0x33')]=_[_0xc606('0x2e')](_0x2e72b5,_0xc606('0x26'));_0x57ccae[_0xc606('0x34')]=_['keys'](_0x5413f6[_0xc606('0x34')]);_0x57ccae[_0xc606('0x35')]=_['intersection'](_0x57ccae[_0xc606('0x33')],_0x57ccae['query']);_0x2e1c9a[_0xc606('0x36')]=_[_0xc606('0x37')](_0x57ccae[_0xc606('0x33')],qs['fields'](_0x5413f6[_0xc606('0x34')]['fields']));_0x2e1c9a['attributes']=_0x2e1c9a[_0xc606('0x36')][_0xc606('0x38')]?_0x2e1c9a[_0xc606('0x36')]:_0x57ccae['model'];if(!_0x5413f6['query'][_0xc606('0x39')](_0xc606('0x3a'))){_0x2e1c9a['limit']=qs[_0xc606('0x1c')](_0x5413f6['query']['limit']);_0x2e1c9a[_0xc606('0x1b')]=qs[_0xc606('0x1b')](_0x5413f6[_0xc606('0x34')]['offset']);}_0x2e1c9a['order']=qs[_0xc606('0x3b')](_0x5413f6[_0xc606('0x34')][_0xc606('0x3b')]);_0x2e1c9a['where']=qs[_0xc606('0x35')](_[_0xc606('0x3c')](_0x5413f6[_0xc606('0x34')],_0x57ccae[_0xc606('0x35')]),_0x2e72b5);if(_0x5413f6[_0xc606('0x34')][_0xc606('0x3d')]){_0x2e1c9a[_0xc606('0x3e')]=_[_0xc606('0x3f')](_0x2e1c9a[_0xc606('0x3e')],{'$or':_[_0xc606('0x2e')](_0x2e72b5,function(_0x4b9b24){if(_0x4b9b24[_0xc606('0x31')]!==_0xc606('0x40')){var _0x12b0f0={};_0x12b0f0[_0x4b9b24[_0xc606('0x26')]]={'$like':'%'+_0x5413f6[_0xc606('0x34')][_0xc606('0x3d')]+'%'};return _0x12b0f0;}})});}_0x2e1c9a=_['merge']({},_0x2e1c9a,_0x5413f6[_0xc606('0x41')]);var _0x8fad77={'where':_0x2e1c9a[_0xc606('0x3e')]};return db['VoiceDialReport'][_0xc606('0x1e')](_0x8fad77)['then'](function(_0x3ec2c8){_0x13ba1c['count']=_0x3ec2c8;if(_0x5413f6[_0xc606('0x34')][_0xc606('0x42')]){_0x2e1c9a[_0xc606('0x43')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xc606('0x44')](_0x2e1c9a);})['then'](function(_0x457fda){_0x13ba1c['rows']=_0x457fda;return _0x13ba1c;})['then'](respondWithFilteredResult(_0x3829ee,_0x2e1c9a))[_0xc606('0x45')](handleError(_0x3829ee,null));};exports['show']=function(_0x25d2fe,_0x15acbd){var _0x509714={'raw':!![],'where':{'id':_0x25d2fe['params']['id']}},_0x89e282={};_0x89e282[_0xc606('0x33')]=_['keys'](db['VoiceDialReport'][_0xc606('0x30')]);_0x89e282['query']=_[_0xc606('0x46')](_0x25d2fe[_0xc606('0x34')]);_0x89e282['filters']=_[_0xc606('0x37')](_0x89e282[_0xc606('0x33')],_0x89e282[_0xc606('0x34')]);_0x509714['attributes']=_[_0xc606('0x37')](_0x89e282[_0xc606('0x33')],qs[_0xc606('0x47')](_0x25d2fe['query'][_0xc606('0x47')]));_0x509714[_0xc606('0x36')]=_0x509714['attributes'][_0xc606('0x38')]?_0x509714['attributes']:_0x89e282[_0xc606('0x33')];if(_0x25d2fe[_0xc606('0x34')][_0xc606('0x42')]){_0x509714[_0xc606('0x43')]=[{'all':!![]}];}_0x509714=_[_0xc606('0x3f')]({},_0x509714,_0x25d2fe[_0xc606('0x41')]);return db[_0xc606('0x2f')][_0xc606('0x48')](_0x509714)[_0xc606('0x24')](handleEntityNotFound(_0x15acbd,null))[_0xc606('0x24')](respondWithResult(_0x15acbd,null))['catch'](handleError(_0x15acbd,null));};exports['create']=function(_0x4487af,_0xdc1266){return db[_0xc606('0x2f')][_0xc606('0x49')](_0x4487af[_0xc606('0x28')],{})[_0xc606('0x24')](respondWithResult(_0xdc1266,0xc9))[_0xc606('0x45')](handleError(_0xdc1266,null));};exports['update']=function(_0x315505,_0x2a2bb6){if(_0x315505[_0xc606('0x28')]['id']){delete _0x315505[_0xc606('0x28')]['id'];}return db[_0xc606('0x2f')][_0xc606('0x48')]({'where':{'id':_0x315505[_0xc606('0x4a')]['id']}})[_0xc606('0x24')](handleEntityNotFound(_0x2a2bb6,null))['then'](saveUpdates(_0x315505[_0xc606('0x28')],null))[_0xc606('0x24')](respondWithResult(_0x2a2bb6,null))[_0xc606('0x45')](handleError(_0x2a2bb6,null));};exports['destroy']=function(_0x228a39,_0xcd3f78){return db[_0xc606('0x2f')]['find']({'where':{'id':_0x228a39[_0xc606('0x4a')]['id']}})[_0xc606('0x24')](handleEntityNotFound(_0xcd3f78,null))[_0xc606('0x24')](removeEntity(_0xcd3f78,null))['catch'](handleError(_0xcd3f78,null));};exports[_0xc606('0x4b')]=function(_0x25cc16,_0x28dd24){return db[_0xc606('0x2f')][_0xc606('0x4b')]()[_0xc606('0x24')](respondWithResult(_0x28dd24,null))[_0xc606('0x45')](handleError(_0x28dd24,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a1e1930..5659284 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 _0xf083=['report_dial','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport'];(function(_0x1c33d9,_0x41f03d){var _0xfeb66e=function(_0x2b9c81){while(--_0x2b9c81){_0x1c33d9['push'](_0x1c33d9['shift']());}};_0xfeb66e(++_0x41f03d);}(_0xf083,0x188));var _0x3f08=function(_0x335fb4,_0x294eea){_0x335fb4=_0x335fb4-0x0;var _0x62c5b=_0xf083[_0x335fb4];return _0x62c5b;};'use strict';var _=require(_0x3f08('0x0'));var util=require(_0x3f08('0x1'));var logger=require(_0x3f08('0x2'))(_0x3f08('0x3'));var moment=require('moment');var BPromise=require(_0x3f08('0x4'));var rp=require(_0x3f08('0x5'));var fs=require('fs');var path=require(_0x3f08('0x6'));var rimraf=require(_0x3f08('0x7'));var config=require(_0x3f08('0x8'));var attributes=require(_0x3f08('0x9'));module['exports']=function(_0xfdb266,_0x4e5e10){return _0xfdb266['define'](_0x3f08('0xa'),attributes,{'tableName':_0x3f08('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3f08('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5e3=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x10f99a,_0x46e1f1){var _0x5aba0e=function(_0x37a737){while(--_0x37a737){_0x10f99a['push'](_0x10f99a['shift']());}};_0x5aba0e(++_0x46e1f1);}(_0xd5e3,0x1e0));var _0x3d5e=function(_0x4a42d0,_0x566ebb){_0x4a42d0=_0x4a42d0-0x0;var _0x120594=_0xd5e3[_0x4a42d0];return _0x120594;};'use strict';var _=require(_0x3d5e('0x0'));var util=require('util');var logger=require(_0x3d5e('0x1'))(_0x3d5e('0x2'));var moment=require(_0x3d5e('0x3'));var BPromise=require('bluebird');var rp=require(_0x3d5e('0x4'));var fs=require('fs');var path=require(_0x3d5e('0x5'));var rimraf=require(_0x3d5e('0x6'));var config=require(_0x3d5e('0x7'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x33b292,_0x1e90b3){return _0x33b292[_0x3d5e('0x8')](_0x3d5e('0x9'),attributes,{'tableName':_0x3d5e('0xa'),'paranoid':![],'indexes':[{'fields':[_0x3d5e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index cf21c08..f20ae7d 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 _0xf775=['rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','info','update','where','attributes','UpdateVoiceDialReport','util','randomstring','ioredis','../../mysqldb'];(function(_0x488901,_0x352103){var _0xef4f02=function(_0x4e4c72){while(--_0x4e4c72){_0x488901['push'](_0x488901['shift']());}};_0xef4f02(++_0x352103);}(_0xf775,0x1dc));var _0x5f77=function(_0x59a9a0,_0x169fa8){_0x59a9a0=_0x59a9a0-0x0;var _0x2a7eec=_0xf775[_0x59a9a0];return _0x2a7eec;};'use strict';var _=require('lodash');var util=require(_0x5f77('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5f77('0x1'));var fs=require('fs');var Redis=require(_0x5f77('0x2'));var db=require(_0x5f77('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5f77('0x4'));var config=require(_0x5f77('0x5'));var jayson=require(_0x5f77('0x6'));var client=jayson[_0x5f77('0x7')][_0x5f77('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x565998,_0x14f24b,_0x5957c0){return new BPromise(function(_0x437c5a,_0xb2446e){return client[_0x5f77('0x9')](_0x565998,_0x5957c0)[_0x5f77('0xa')](function(_0x3ae0af){logger['info'](_0x5f77('0xb'),_0x14f24b,_0x5f77('0xc'));logger[_0x5f77('0xd')](_0x5f77('0xe'),_0x14f24b,_0x5f77('0xc'),JSON[_0x5f77('0xf')](_0x3ae0af));if(_0x3ae0af[_0x5f77('0x10')]){if(_0x3ae0af['error'][_0x5f77('0x11')]===0x1f4){logger['error'](_0x5f77('0xb'),_0x14f24b,_0x3ae0af[_0x5f77('0x10')][_0x5f77('0x12')]);return _0xb2446e(_0x3ae0af[_0x5f77('0x10')][_0x5f77('0x12')]);}logger[_0x5f77('0x10')](_0x5f77('0xb'),_0x14f24b,_0x3ae0af[_0x5f77('0x10')]['message']);return _0x437c5a(_0x3ae0af[_0x5f77('0x10')][_0x5f77('0x12')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x14f24b,_0x5f77('0xc'));_0x437c5a(_0x3ae0af[_0x5f77('0x13')][_0x5f77('0x12')]);}})[_0x5f77('0x14')](function(_0x41f2fc){logger['error'](_0x5f77('0xb'),_0x14f24b,_0x41f2fc);_0xb2446e(_0x41f2fc);});});}exports[_0x5f77('0x15')]=function(_0x596688){var _0x4e5a0e=this;return new Promise(function(_0x5266eb,_0x285b0d){return db[_0x5f77('0x16')][_0x5f77('0x17')](_0x596688[_0x5f77('0x18')],{'raw':_0x596688['options']?_0x596688[_0x5f77('0x19')][_0x5f77('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x160761){logger[_0x5f77('0x1b')](_0x5f77('0x15'),_0x596688);logger[_0x5f77('0xd')](_0x5f77('0x15'),_0x596688,JSON[_0x5f77('0xf')](_0x160761));_0x5266eb(_0x160761);})[_0x5f77('0x14')](function(_0xec86b6){logger[_0x5f77('0x10')](_0x5f77('0x15'),_0xec86b6[_0x5f77('0x12')],_0x596688);_0x285b0d(_0x4e5a0e['error'](0x1f4,_0xec86b6[_0x5f77('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x332dff){var _0x358878=this;return new Promise(function(_0x5c5b41,_0x10a62e){return db[_0x5f77('0x16')][_0x5f77('0x1c')](_0x332dff[_0x5f77('0x18')],{'raw':_0x332dff[_0x5f77('0x19')]?_0x332dff[_0x5f77('0x19')][_0x5f77('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x332dff[_0x5f77('0x19')]?_0x332dff[_0x5f77('0x19')][_0x5f77('0x1d')]||null:null,'attributes':_0x332dff[_0x5f77('0x19')]?_0x332dff['options'][_0x5f77('0x1e')]||null:null,'limit':_0x332dff[_0x5f77('0x19')]?_0x332dff['options']['limit']||null:null})['then'](function(_0x795091){logger['info'](_0x5f77('0x1f'),_0x332dff);logger['debug']('UpdateVoiceDialReport',_0x332dff,JSON[_0x5f77('0xf')](_0x795091));_0x5c5b41(_0x795091);})[_0x5f77('0x14')](function(_0x5c73ab){logger[_0x5f77('0x10')](_0x5f77('0x1f'),_0x5c73ab[_0x5f77('0x12')],_0x332dff);_0x10a62e(_0x358878[_0x5f77('0x10')](0x1f4,_0x5c73ab[_0x5f77('0x12')]));});});}; \ No newline at end of file +var _0x45fe=['attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','create','body','options','raw','stringify','UpdateVoiceDialReport','VoiceDialReport','update'];(function(_0x4c2871,_0x4647b8){var _0x53f1dc=function(_0x5366dd){while(--_0x5366dd){_0x4c2871['push'](_0x4c2871['shift']());}};_0x53f1dc(++_0x4647b8);}(_0x45fe,0x12b));var _0xe45f=function(_0x2b49bc,_0x47b636){_0x2b49bc=_0x2b49bc-0x0;var _0x43cc65=_0x45fe[_0x2b49bc];return _0x43cc65;};'use strict';var _=require(_0xe45f('0x0'));var util=require(_0xe45f('0x1'));var moment=require('moment');var BPromise=require(_0xe45f('0x2'));var rs=require(_0xe45f('0x3'));var fs=require('fs');var Redis=require(_0xe45f('0x4'));var db=require(_0xe45f('0x5'))['db'];var utils=require(_0xe45f('0x6'));var logger=require(_0xe45f('0x7'))(_0xe45f('0x8'));var config=require(_0xe45f('0x9'));var jayson=require(_0xe45f('0xa'));var client=jayson['client'][_0xe45f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21b1d7,_0x47f657,_0x21bd9e){return new BPromise(function(_0x14db5b,_0x1f9441){return client[_0xe45f('0xc')](_0x21b1d7,_0x21bd9e)[_0xe45f('0xd')](function(_0x11899b){logger[_0xe45f('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x47f657,_0xe45f('0xf'));logger[_0xe45f('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x47f657,_0xe45f('0xf'),JSON['stringify'](_0x11899b));if(_0x11899b['error']){if(_0x11899b[_0xe45f('0x11')]['code']===0x1f4){logger['error'](_0xe45f('0x12'),_0x47f657,_0x11899b[_0xe45f('0x11')][_0xe45f('0x13')]);return _0x1f9441(_0x11899b[_0xe45f('0x11')][_0xe45f('0x13')]);}logger[_0xe45f('0x11')](_0xe45f('0x12'),_0x47f657,_0x11899b[_0xe45f('0x11')][_0xe45f('0x13')]);return _0x14db5b(_0x11899b[_0xe45f('0x11')][_0xe45f('0x13')]);}else{logger[_0xe45f('0xe')](_0xe45f('0x12'),_0x47f657,_0xe45f('0xf'));_0x14db5b(_0x11899b[_0xe45f('0x14')][_0xe45f('0x13')]);}})[_0xe45f('0x15')](function(_0x513692){logger[_0xe45f('0x11')](_0xe45f('0x12'),_0x47f657,_0x513692);_0x1f9441(_0x513692);});});}exports[_0xe45f('0x16')]=function(_0xca0272){var _0x2d8297=this;return new Promise(function(_0xff07e7,_0x5ee575){return db['VoiceDialReport'][_0xe45f('0x17')](_0xca0272[_0xe45f('0x18')],{'raw':_0xca0272[_0xe45f('0x19')]?_0xca0272[_0xe45f('0x19')][_0xe45f('0x1a')]===undefined?!![]:![]:!![]})[_0xe45f('0xd')](function(_0x5594c2){logger[_0xe45f('0xe')](_0xe45f('0x16'),_0xca0272);logger[_0xe45f('0x10')]('CreateVoiceDialReport',_0xca0272,JSON[_0xe45f('0x1b')](_0x5594c2));_0xff07e7(_0x5594c2);})[_0xe45f('0x15')](function(_0x4fa9d){logger[_0xe45f('0x11')](_0xe45f('0x16'),_0x4fa9d[_0xe45f('0x13')],_0xca0272);_0x5ee575(_0x2d8297[_0xe45f('0x11')](0x1f4,_0x4fa9d[_0xe45f('0x13')]));});});};exports[_0xe45f('0x1c')]=function(_0x3beca6){var _0x40914e=this;return new Promise(function(_0x33d094,_0x114fea){return db[_0xe45f('0x1d')][_0xe45f('0x1e')](_0x3beca6['body'],{'raw':_0x3beca6[_0xe45f('0x19')]?_0x3beca6[_0xe45f('0x19')][_0xe45f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3beca6[_0xe45f('0x19')]?_0x3beca6[_0xe45f('0x19')]['where']||null:null,'attributes':_0x3beca6[_0xe45f('0x19')]?_0x3beca6[_0xe45f('0x19')][_0xe45f('0x1f')]||null:null,'limit':_0x3beca6[_0xe45f('0x19')]?_0x3beca6[_0xe45f('0x19')][_0xe45f('0x20')]||null:null})[_0xe45f('0xd')](function(_0x4711ef){logger[_0xe45f('0xe')](_0xe45f('0x1c'),_0x3beca6);logger[_0xe45f('0x10')](_0xe45f('0x1c'),_0x3beca6,JSON['stringify'](_0x4711ef));_0x33d094(_0x4711ef);})[_0xe45f('0x15')](function(_0x274177){logger[_0xe45f('0x11')](_0xe45f('0x1c'),_0x274177[_0xe45f('0x13')],_0x3beca6);_0x114fea(_0x40914e[_0xe45f('0x11')](0x1f4,_0x274177[_0xe45f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 360ae13..ac64c9f 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 _0x99ae=['express','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated','show','post','addApplications','put','update','delete','multer','util','path'];(function(_0x3d73ba,_0x356e23){var _0x47e406=function(_0x90df31){while(--_0x90df31){_0x3d73ba['push'](_0x3d73ba['shift']());}};_0x47e406(++_0x356e23);}(_0x99ae,0x162));var _0xe99a=function(_0x3d1f16,_0x2ec77b){_0x3d1f16=_0x3d1f16-0x0;var _0x4c7d34=_0x99ae[_0x3d1f16];return _0x4c7d34;};'use strict';var multer=require(_0xe99a('0x0'));var util=require(_0xe99a('0x1'));var path=require(_0xe99a('0x2'));var timeout=require('connect-timeout');var express=require(_0xe99a('0x3'));var router=express['Router']();var fs_extra=require(_0xe99a('0x4'));var auth=require(_0xe99a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe99a('0x6'));var controller=require(_0xe99a('0x7'));router[_0xe99a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe99a('0x9'),auth[_0xe99a('0xa')](),controller[_0xe99a('0xb')]);router[_0xe99a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe99a('0xc')]('/:id/applications',auth['isAuthenticated'](),controller[_0xe99a('0xd')]);router[_0xe99a('0xe')](_0xe99a('0x9'),auth[_0xe99a('0xa')](),controller[_0xe99a('0xf')]);router[_0xe99a('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe1a8=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','update','delete','destroy','exports','multer','util'];(function(_0x650bc2,_0x58d5b7){var _0x5c0a64=function(_0x568deb){while(--_0x568deb){_0x650bc2['push'](_0x650bc2['shift']());}};_0x5c0a64(++_0x58d5b7);}(_0xe1a8,0x136));var _0x8e1a=function(_0x3378e5,_0x1f7566){_0x3378e5=_0x3378e5-0x0;var _0x4a5ba7=_0xe1a8[_0x3378e5];return _0x4a5ba7;};'use strict';var multer=require(_0x8e1a('0x0'));var util=require(_0x8e1a('0x1'));var path=require(_0x8e1a('0x2'));var timeout=require(_0x8e1a('0x3'));var express=require(_0x8e1a('0x4'));var router=express[_0x8e1a('0x5')]();var fs_extra=require(_0x8e1a('0x6'));var auth=require(_0x8e1a('0x7'));var interaction=require(_0x8e1a('0x8'));var config=require(_0x8e1a('0x9'));var controller=require(_0x8e1a('0xa'));router[_0x8e1a('0xb')]('/',auth['isAuthenticated'](),controller[_0x8e1a('0xc')]);router['get'](_0x8e1a('0xd'),auth[_0x8e1a('0xe')](),controller[_0x8e1a('0xf')]);router[_0x8e1a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8e1a('0x11')]);router['post'](_0x8e1a('0x12'),auth[_0x8e1a('0xe')](),controller[_0x8e1a('0x13')]);router['put'](_0x8e1a('0xd'),auth[_0x8e1a('0xe')](),controller[_0x8e1a('0x14')]);router[_0x8e1a('0x15')](_0x8e1a('0xd'),auth[_0x8e1a('0xe')](),controller[_0x8e1a('0x16')]);module[_0x8e1a('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 267c476..63d6298 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x1d6911,_0x16d910){var _0x54dac6=function(_0x58d3b1){while(--_0x58d3b1){_0x1d6911['push'](_0x1d6911['shift']());}};_0x54dac6(++_0x16d910);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x5584e0,_0x3e6cab){var _0x88ad0e=function(_0x48f77f){while(--_0x48f77f){_0x5584e0['push'](_0x5584e0['shift']());}};_0x88ad0e(++_0x3e6cab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 3e7e39c..9118bcb 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 _0xc49f=['VoiceExtension','rawAttributes','fieldName','key','model','map','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','findAll','rows','catch','show','params','length','includeAll','options','create','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','inbound','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','bulkCreate','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','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/environment','../../mysqldb','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','apply','destroy','get','InboundRoutes','outbound','InternalRoutes','filter','value','includes','find','type','UserProfileResource','then','end','sendStatus','error','stack','name','send','render','body','contact','message','agent','interaction','account','index'];(function(_0x5e77d7,_0x44d1fa){var _0x4e0661=function(_0x57acc3){while(--_0x57acc3){_0x5e77d7['push'](_0x5e77d7['shift']());}};_0x4e0661(++_0x44d1fa);}(_0xc49f,0x11b));var _0xfc49=function(_0x1fe06f,_0x160669){_0x1fe06f=_0x1fe06f-0x0;var _0x500880=_0xc49f[_0x1fe06f];return _0x500880;};'use strict';var emlformat=require(_0xfc49('0x0'));var rimraf=require(_0xfc49('0x1'));var zipdir=require(_0xfc49('0x2'));var jsonpatch=require(_0xfc49('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc49('0x4'));var Mustache=require(_0xfc49('0x5'));var util=require(_0xfc49('0x6'));var path=require('path');var sox=require(_0xfc49('0x7'));var csv=require('to-csv');var ejs=require(_0xfc49('0x8'));var fs=require('fs');var fs_extra=require(_0xfc49('0x9'));var _=require(_0xfc49('0xa'));var squel=require('squel');var crypto=require(_0xfc49('0xb'));var jsforce=require(_0xfc49('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfc49('0xd'));var Papa=require(_0xfc49('0xe'));var Redis=require(_0xfc49('0xf'));var authService=require(_0xfc49('0x10'));var qs=require(_0xfc49('0x11'));var as=require(_0xfc49('0x12'));var hardwareService=require(_0xfc49('0x13'));var logger=require(_0xfc49('0x14'))(_0xfc49('0x15'));var utils=require(_0xfc49('0x16'));var config=require(_0xfc49('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc49('0x18'))['db'];config['redis']=_[_0xfc49('0x19')](config[_0xfc49('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc49('0x1b'))(new Redis(config[_0xfc49('0x1a')]));require(_0xfc49('0x1c'))[_0xfc49('0x1d')](socket);function respondWithStatusCode(_0x54473e,_0x1bc93e){_0x1bc93e=_0x1bc93e||0xcc;return function(_0x27c15e){if(_0x27c15e){return _0x54473e['sendStatus'](_0x1bc93e);}return _0x54473e[_0xfc49('0x1e')](_0x1bc93e)['end']();};}function respondWithResult(_0x25ef42,_0x44f51f){_0x44f51f=_0x44f51f||0xc8;return function(_0x274913){if(_0x274913){return _0x25ef42[_0xfc49('0x1e')](_0x44f51f)[_0xfc49('0x1f')](_0x274913);}};}function respondWithFilteredResult(_0x13873b,_0x383295){return function(_0x289ff7){if(_0x289ff7){var _0x9e5c51=typeof _0x383295['offset']===_0xfc49('0x20')&&typeof _0x383295[_0xfc49('0x21')]==='undefined';var _0x504638=_0x289ff7[_0xfc49('0x22')];var _0xf7589a=_0x9e5c51?0x0:_0x383295[_0xfc49('0x23')];var _0x1608b2=_0x9e5c51?_0x289ff7[_0xfc49('0x22')]:_0x383295[_0xfc49('0x23')]+_0x383295['limit'];var _0x5d8ffa;if(_0x1608b2>=_0x504638){_0x1608b2=_0x504638;_0x5d8ffa=0xc8;}else{_0x5d8ffa=0xce;}_0x13873b[_0xfc49('0x1e')](_0x5d8ffa);return _0x13873b[_0xfc49('0x24')](_0xfc49('0x25'),_0xf7589a+'-'+_0x1608b2+'/'+_0x504638)[_0xfc49('0x1f')](_0x289ff7);}return null;};}function patchUpdates(_0x6cb8cb){return function(_0x202025){try{jsonpatch[_0xfc49('0x26')](_0x202025,_0x6cb8cb,!![]);}catch(_0x5716de){return BPromise['reject'](_0x5716de);}return _0x202025['save']();};}function saveUpdates(_0x562e22,_0x55346f){return function(_0x4a219b){if(_0x4a219b){return _0x4a219b['update'](_0x562e22)['then'](function(_0x424842){return _0x424842;});}return null;};}function removeEntity(_0x4819a4,_0x3f0da9){return function(_0x2e7cad){if(_0x2e7cad){return _0x2e7cad[_0xfc49('0x27')]()['then'](function(){var _0x4d8f26=_0x2e7cad[_0xfc49('0x28')]({'plain':!![]});var _0x53d0d2=[{'name':_0xfc49('0x29'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0xfc49('0x2a'),'ignore':![]},{'name':_0xfc49('0x2b'),'value':'internal','ignore':![]}];var _0x4d3484=_(_0x53d0d2)[_0xfc49('0x2c')]('ignore')['map'](_0xfc49('0x2d'))[_0xfc49('0x2d')]();if(_[_0xfc49('0x2e')](_0x4d3484,_0x4d8f26['type'])){return;}var _0x16aa67=_[_0xfc49('0x2f')](_0x53d0d2,[_0xfc49('0x2d'),_0x4d8f26[_0xfc49('0x30')]])['name'];return db[_0xfc49('0x31')][_0xfc49('0x27')]({'where':{'type':_0x16aa67,'resourceId':_0x4d8f26['id']}})[_0xfc49('0x32')](function(){return _0x2e7cad;});})[_0xfc49('0x32')](function(){_0x4819a4[_0xfc49('0x1e')](0xcc)[_0xfc49('0x33')]();});}};}function handleEntityNotFound(_0x37b252,_0x27550d){return function(_0x5f0213){if(!_0x5f0213){_0x37b252[_0xfc49('0x34')](0x194);}return _0x5f0213;};}function handleError(_0x31106b,_0x2e6863){_0x2e6863=_0x2e6863||0x1f4;return function(_0x51fefe){logger[_0xfc49('0x35')](_0x51fefe[_0xfc49('0x36')]);if(_0x51fefe[_0xfc49('0x37')]){delete _0x51fefe[_0xfc49('0x37')];}_0x31106b[_0xfc49('0x1e')](_0x2e6863)[_0xfc49('0x38')](_0x51fefe);};}function getMustacheRender(_0x431c56,_0x592340){return Mustache[_0xfc49('0x39')](_0x431c56,_['merge'](_0x592340[_0xfc49('0x3a')],{'contact':_0x592340[_0xfc49('0x3b')],'message':_0x592340[_0xfc49('0x3c')],'agent':_0x592340[_0xfc49('0x3d')],'interaction':_0x592340[_0xfc49('0x3e')],'account':_0x592340[_0xfc49('0x3f')]}))||'';}exports[_0xfc49('0x40')]=function(_0x3c51b7,_0x1118be){var _0x4e3b83={},_0x5766df={},_0x10722f={'count':0x0,'rows':[]};var _0x36e2ae=_['map'](db[_0xfc49('0x41')][_0xfc49('0x42')],function(_0x1dd55d){return{'name':_0x1dd55d[_0xfc49('0x43')],'type':_0x1dd55d['type'][_0xfc49('0x44')]};});_0x5766df[_0xfc49('0x45')]=_[_0xfc49('0x46')](_0x36e2ae,_0xfc49('0x37'));_0x5766df['query']=_[_0xfc49('0x47')](_0x3c51b7[_0xfc49('0x48')]);_0x5766df['filters']=_[_0xfc49('0x49')](_0x5766df['model'],_0x5766df['query']);_0x4e3b83['attributes']=_['intersection'](_0x5766df[_0xfc49('0x45')],qs[_0xfc49('0x4a')](_0x3c51b7[_0xfc49('0x48')][_0xfc49('0x4a')]));_0x4e3b83[_0xfc49('0x4b')]=_0x4e3b83[_0xfc49('0x4b')]['length']?_0x4e3b83[_0xfc49('0x4b')]:_0x5766df[_0xfc49('0x45')];if(!_0x3c51b7[_0xfc49('0x48')][_0xfc49('0x4c')](_0xfc49('0x4d'))){_0x4e3b83[_0xfc49('0x21')]=qs['limit'](_0x3c51b7['query'][_0xfc49('0x21')]);_0x4e3b83[_0xfc49('0x23')]=qs[_0xfc49('0x23')](_0x3c51b7[_0xfc49('0x48')]['offset']);}_0x4e3b83[_0xfc49('0x4e')]=qs[_0xfc49('0x4f')](_0x3c51b7[_0xfc49('0x48')][_0xfc49('0x4f')]);_0x4e3b83[_0xfc49('0x50')]=qs[_0xfc49('0x51')](_[_0xfc49('0x52')](_0x3c51b7[_0xfc49('0x48')],_0x5766df['filters']),_0x36e2ae);if(_0x3c51b7[_0xfc49('0x48')][_0xfc49('0x2c')]){_0x4e3b83[_0xfc49('0x50')]=_[_0xfc49('0x53')](_0x4e3b83[_0xfc49('0x50')],{'$or':_[_0xfc49('0x46')](_0x36e2ae,function(_0x4a5c2b){if(_0x4a5c2b[_0xfc49('0x30')]!==_0xfc49('0x54')){var _0x1792c1={};_0x1792c1[_0x4a5c2b[_0xfc49('0x37')]]={'$like':'%'+_0x3c51b7[_0xfc49('0x48')][_0xfc49('0x2c')]+'%'};return _0x1792c1;}})});}_0x4e3b83=_['merge']({},_0x4e3b83,_0x3c51b7['options']);var _0x435b95={'where':_0x4e3b83[_0xfc49('0x50')]};return db[_0xfc49('0x41')][_0xfc49('0x22')](_0x435b95)[_0xfc49('0x32')](function(_0x5d2c5b){_0x10722f['count']=_0x5d2c5b;if(_0x3c51b7[_0xfc49('0x48')]['includeAll']){_0x4e3b83['include']=[{'all':!![]}];}return db[_0xfc49('0x41')][_0xfc49('0x55')](_0x4e3b83);})['then'](function(_0x1f1820){_0x10722f[_0xfc49('0x56')]=_0x1f1820;return _0x10722f;})['then'](respondWithFilteredResult(_0x1118be,_0x4e3b83))[_0xfc49('0x57')](handleError(_0x1118be,null));};exports[_0xfc49('0x58')]=function(_0x7fd3ec,_0x56bc17){var _0x198ef5={'raw':![],'where':{'id':_0x7fd3ec[_0xfc49('0x59')]['id']}},_0x463591={};_0x463591[_0xfc49('0x45')]=_[_0xfc49('0x47')](db[_0xfc49('0x41')]['rawAttributes']);_0x463591[_0xfc49('0x48')]=_[_0xfc49('0x47')](_0x7fd3ec[_0xfc49('0x48')]);_0x463591['filters']=_[_0xfc49('0x49')](_0x463591[_0xfc49('0x45')],_0x463591[_0xfc49('0x48')]);_0x198ef5[_0xfc49('0x4b')]=_[_0xfc49('0x49')](_0x463591[_0xfc49('0x45')],qs[_0xfc49('0x4a')](_0x7fd3ec[_0xfc49('0x48')][_0xfc49('0x4a')]));_0x198ef5['attributes']=_0x198ef5[_0xfc49('0x4b')][_0xfc49('0x5a')]?_0x198ef5[_0xfc49('0x4b')]:_0x463591['model'];if(_0x7fd3ec['query'][_0xfc49('0x5b')]){_0x198ef5['include']=[{'all':!![]}];}_0x198ef5=_[_0xfc49('0x53')]({},_0x198ef5,_0x7fd3ec[_0xfc49('0x5c')]);return db[_0xfc49('0x41')][_0xfc49('0x2f')](_0x198ef5)[_0xfc49('0x32')](handleEntityNotFound(_0x56bc17,null))['then'](respondWithResult(_0x56bc17,null))[_0xfc49('0x57')](handleError(_0x56bc17,null));};exports['destroy']=function(_0x40d862,_0x1c55d4){return db[_0xfc49('0x41')][_0xfc49('0x2f')]({'where':{'id':_0x40d862[_0xfc49('0x59')]['id']}})[_0xfc49('0x32')](handleEntityNotFound(_0x1c55d4,null))[_0xfc49('0x32')](removeEntity(_0x1c55d4,null))[_0xfc49('0x57')](handleError(_0x1c55d4,null));};exports[_0xfc49('0x5d')]=function(_0x418eda,_0x550b7b){if(_0x418eda[_0xfc49('0x3a')]['type']===_0xfc49('0x2a')&&!_[_0xfc49('0x5e')](_0x418eda[_0xfc49('0x3a')][_0xfc49('0x5f')],'_')){_0x418eda['body'][_0xfc49('0x5f')]='_'[_0xfc49('0x60')](_0x418eda[_0xfc49('0x3a')][_0xfc49('0x5f')]);}return db['VoiceExtension'][_0xfc49('0x5d')](_0x418eda[_0xfc49('0x3a')],{'raw':![]})[_0xfc49('0x32')](function(_0x3ba992){var _0x284955=_0x418eda['user'][_0xfc49('0x28')]({'plain':!![]});if(!_0x284955)throw new Error(_0xfc49('0x61'));if(_0x284955['role']===_0xfc49('0x62')){var _0x5c9e3c=_0x3ba992[_0xfc49('0x28')]({'plain':!![]});var _0x556a4b=[{'name':'InboundRoutes','value':_0xfc49('0x63')},{'name':_0xfc49('0x64'),'value':_0xfc49('0x2a')},{'name':_0xfc49('0x2b'),'value':'internal'}];var _0x4445f7=_[_0xfc49('0x2f')](_0x556a4b,[_0xfc49('0x2d'),_0x5c9e3c[_0xfc49('0x30')]])['name'];return db[_0xfc49('0x65')][_0xfc49('0x2f')]({'where':{'name':_0x4445f7,'userProfileId':_0x284955[_0xfc49('0x66')]},'raw':!![]})[_0xfc49('0x32')](function(_0x9af16){if(_0x9af16&&_0x9af16[_0xfc49('0x67')]===0x0){return db[_0xfc49('0x31')]['create']({'name':_0x5c9e3c[_0xfc49('0x37')],'resourceId':_0x5c9e3c['id'],'type':_0x9af16[_0xfc49('0x37')],'sectionId':_0x9af16['id']},{})[_0xfc49('0x32')](function(){return _0x3ba992;});}else{return _0x3ba992;}})[_0xfc49('0x57')](function(_0x382956){logger['error'](_0xfc49('0x68'),_0x382956);throw _0x382956;});}return _0x3ba992;})[_0xfc49('0x32')](respondWithResult(_0x550b7b,0xc9))['catch'](handleError(_0x550b7b,null));};exports[_0xfc49('0x69')]=function(_0x52c156,_0x3fc0d5){if(_0x52c156['body']['id']){delete _0x52c156['body']['id'];}return db[_0xfc49('0x41')][_0xfc49('0x2f')]({'where':{'id':_0x52c156[_0xfc49('0x59')]['id']}})[_0xfc49('0x32')](handleEntityNotFound(_0x3fc0d5,null))[_0xfc49('0x32')](function(_0xafc5b){if(_0xafc5b){return db[_0xfc49('0x41')][_0xfc49('0x69')](_['pick'](_0x52c156[_0xfc49('0x3a')],[_0xfc49('0x5f'),_0xfc49('0x6a'),_0xfc49('0x6b'),_0xfc49('0x6c'),_0xfc49('0x6d'),_0xfc49('0x6e')]),{'where':{'context':_0xafc5b[_0xfc49('0x6a')],'exten':_0xafc5b[_0xfc49('0x5f')]},'individualHooks':!![]})['then'](function(_0x28a4ce){return _0x28a4ce;});}return null;})[_0xfc49('0x32')](respondWithStatusCode(_0x3fc0d5,null))[_0xfc49('0x57')](handleError(_0x3fc0d5,null));};exports[_0xfc49('0x6f')]=function(_0x437790,_0x4a2f70,_0x59f7db){return db[_0xfc49('0x41')]['findOne']({'where':{'id':_0x437790[_0xfc49('0x59')]['id']}})['then'](handleEntityNotFound(_0x4a2f70,null))[_0xfc49('0x32')](function(_0x5c6f5b){if(_0x5c6f5b){return db[_0xfc49('0x70')][_0xfc49('0x71')](function(_0x26560a){return db[_0xfc49('0x41')][_0xfc49('0x27')]({'where':{'VoiceExtensionId':_0x437790['params']['id']},'transaction':_0x26560a})[_0xfc49('0x32')](function(_0xabf0bb){var _0x4c0bc7=_[_0xfc49('0x46')](_0x437790[_0xfc49('0x3a')],function(_0x5305a6){_0x5305a6['VoiceExtensionId']=_0x437790[_0xfc49('0x59')]['id'];return _0x5305a6;});return db['VoiceExtension'][_0xfc49('0x72')](_0x4c0bc7,{'transaction':_0x26560a});});})[_0xfc49('0x32')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x437790['params']['id']},'order':_0xfc49('0x73')});});}})[_0xfc49('0x32')](respondWithResult(_0x4a2f70,null))[_0xfc49('0x57')](handleError(_0x4a2f70,null));}; \ No newline at end of file +var _0xb33d=['then','includeAll','findAll','rows','catch','show','params','keys','include','options','find','startsWith','exten','concat','create','user','OutboundRoutes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','mandatoryDisposition','addApplications','findOne','sequelize','transaction','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','offset','limit','undefined','count','json','apply','reject','save','update','destroy','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','value','includes','type','name','UserProfileResource','stack','send','render','body','message','agent','interaction','account','map','VoiceExtension','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x5318ef,_0x4f971e){var _0x167d37=function(_0x5a98da){while(--_0x5a98da){_0x5318ef['push'](_0x5318ef['shift']());}};_0x167d37(++_0x4f971e);}(_0xb33d,0x171));var _0xdb33=function(_0xeec31d,_0x189f0c){_0xeec31d=_0xeec31d-0x0;var _0x5915e1=_0xb33d[_0xeec31d];return _0x5915e1;};'use strict';var emlformat=require(_0xdb33('0x0'));var rimraf=require(_0xdb33('0x1'));var zipdir=require(_0xdb33('0x2'));var jsonpatch=require(_0xdb33('0x3'));var rp=require(_0xdb33('0x4'));var moment=require(_0xdb33('0x5'));var BPromise=require(_0xdb33('0x6'));var Mustache=require(_0xdb33('0x7'));var util=require('util');var path=require(_0xdb33('0x8'));var sox=require(_0xdb33('0x9'));var csv=require(_0xdb33('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb33('0xb'));var _=require('lodash');var squel=require(_0xdb33('0xc'));var crypto=require(_0xdb33('0xd'));var jsforce=require(_0xdb33('0xe'));var deskjs=require(_0xdb33('0xf'));var toCsv=require(_0xdb33('0xa'));var querystring=require(_0xdb33('0x10'));var Papa=require('papaparse');var Redis=require(_0xdb33('0x11'));var authService=require(_0xdb33('0x12'));var qs=require(_0xdb33('0x13'));var as=require(_0xdb33('0x14'));var hardwareService=require(_0xdb33('0x15'));var logger=require(_0xdb33('0x16'))(_0xdb33('0x17'));var utils=require(_0xdb33('0x18'));var config=require(_0xdb33('0x19'));var licenseUtil=require(_0xdb33('0x1a'));var db=require(_0xdb33('0x1b'))['db'];config[_0xdb33('0x1c')]=_[_0xdb33('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdb33('0x1e'))(new Redis(config[_0xdb33('0x1c')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x4ff218,_0xc40b34){_0xc40b34=_0xc40b34||0xcc;return function(_0x302ecc){if(_0x302ecc){return _0x4ff218[_0xdb33('0x1f')](_0xc40b34);}return _0x4ff218[_0xdb33('0x20')](_0xc40b34)[_0xdb33('0x21')]();};}function respondWithResult(_0x438490,_0x455e3e){_0x455e3e=_0x455e3e||0xc8;return function(_0x316432){if(_0x316432){return _0x438490[_0xdb33('0x20')](_0x455e3e)['json'](_0x316432);}};}function respondWithFilteredResult(_0x3ca1b5,_0x457ca1){return function(_0x561b1d){if(_0x561b1d){var _0x968aa9=typeof _0x457ca1[_0xdb33('0x22')]==='undefined'&&typeof _0x457ca1[_0xdb33('0x23')]===_0xdb33('0x24');var _0x337e36=_0x561b1d[_0xdb33('0x25')];var _0x475272=_0x968aa9?0x0:_0x457ca1['offset'];var _0x3ffe03=_0x968aa9?_0x561b1d[_0xdb33('0x25')]:_0x457ca1[_0xdb33('0x22')]+_0x457ca1[_0xdb33('0x23')];var _0x5332ce;if(_0x3ffe03>=_0x337e36){_0x3ffe03=_0x337e36;_0x5332ce=0xc8;}else{_0x5332ce=0xce;}_0x3ca1b5['status'](_0x5332ce);return _0x3ca1b5['set']('Content-Range',_0x475272+'-'+_0x3ffe03+'/'+_0x337e36)[_0xdb33('0x26')](_0x561b1d);}return null;};}function patchUpdates(_0x4d28df){return function(_0x4cfae5){try{jsonpatch[_0xdb33('0x27')](_0x4cfae5,_0x4d28df,!![]);}catch(_0x1f7e77){return BPromise[_0xdb33('0x28')](_0x1f7e77);}return _0x4cfae5[_0xdb33('0x29')]();};}function saveUpdates(_0x11a280,_0x3accd7){return function(_0x176858){if(_0x176858){return _0x176858[_0xdb33('0x2a')](_0x11a280)['then'](function(_0x4c7266){return _0x4c7266;});}return null;};}function removeEntity(_0x25ba12,_0x11d291){return function(_0x4944ed){if(_0x4944ed){return _0x4944ed[_0xdb33('0x2b')]()['then'](function(){var _0x56c9fd=_0x4944ed[_0xdb33('0x2c')]({'plain':!![]});var _0x52dbde=[{'name':_0xdb33('0x2d'),'value':_0xdb33('0x2e'),'ignore':![]},{'name':'OutboundRoutes','value':_0xdb33('0x2f'),'ignore':![]},{'name':_0xdb33('0x30'),'value':_0xdb33('0x31'),'ignore':![]}];var _0xe1dc8d=_(_0x52dbde)[_0xdb33('0x32')]('ignore')['map'](_0xdb33('0x33'))[_0xdb33('0x33')]();if(_[_0xdb33('0x34')](_0xe1dc8d,_0x56c9fd[_0xdb33('0x35')])){return;}var _0xaf5c00=_['find'](_0x52dbde,[_0xdb33('0x33'),_0x56c9fd[_0xdb33('0x35')]])[_0xdb33('0x36')];return db[_0xdb33('0x37')][_0xdb33('0x2b')]({'where':{'type':_0xaf5c00,'resourceId':_0x56c9fd['id']}})['then'](function(){return _0x4944ed;});})['then'](function(){_0x25ba12['status'](0xcc)[_0xdb33('0x21')]();});}};}function handleEntityNotFound(_0x12eea1,_0x32f83a){return function(_0x1761bf){if(!_0x1761bf){_0x12eea1[_0xdb33('0x1f')](0x194);}return _0x1761bf;};}function handleError(_0x5beab7,_0x53a98f){_0x53a98f=_0x53a98f||0x1f4;return function(_0x2f68c3){logger['error'](_0x2f68c3[_0xdb33('0x38')]);if(_0x2f68c3['name']){delete _0x2f68c3[_0xdb33('0x36')];}_0x5beab7['status'](_0x53a98f)[_0xdb33('0x39')](_0x2f68c3);};}function getMustacheRender(_0xa5f160,_0x5d7355){return Mustache[_0xdb33('0x3a')](_0xa5f160,_['merge'](_0x5d7355[_0xdb33('0x3b')],{'contact':_0x5d7355['contact'],'message':_0x5d7355[_0xdb33('0x3c')],'agent':_0x5d7355[_0xdb33('0x3d')],'interaction':_0x5d7355[_0xdb33('0x3e')],'account':_0x5d7355[_0xdb33('0x3f')]}))||'';}exports['index']=function(_0x3036bc,_0x5db2e1){var _0x2196fb={},_0x2b4278={},_0x40509c={'count':0x0,'rows':[]};var _0x22a170=_[_0xdb33('0x40')](db[_0xdb33('0x41')][_0xdb33('0x42')],function(_0x53bd00){return{'name':_0x53bd00['fieldName'],'type':_0x53bd00[_0xdb33('0x35')][_0xdb33('0x43')]};});_0x2b4278[_0xdb33('0x44')]=_[_0xdb33('0x40')](_0x22a170,'name');_0x2b4278['query']=_['keys'](_0x3036bc[_0xdb33('0x45')]);_0x2b4278[_0xdb33('0x46')]=_[_0xdb33('0x47')](_0x2b4278[_0xdb33('0x44')],_0x2b4278[_0xdb33('0x45')]);_0x2196fb[_0xdb33('0x48')]=_[_0xdb33('0x47')](_0x2b4278['model'],qs[_0xdb33('0x49')](_0x3036bc['query'][_0xdb33('0x49')]));_0x2196fb[_0xdb33('0x48')]=_0x2196fb[_0xdb33('0x48')][_0xdb33('0x4a')]?_0x2196fb[_0xdb33('0x48')]:_0x2b4278[_0xdb33('0x44')];if(!_0x3036bc[_0xdb33('0x45')][_0xdb33('0x4b')](_0xdb33('0x4c'))){_0x2196fb[_0xdb33('0x23')]=qs[_0xdb33('0x23')](_0x3036bc['query'][_0xdb33('0x23')]);_0x2196fb[_0xdb33('0x22')]=qs[_0xdb33('0x22')](_0x3036bc['query'][_0xdb33('0x22')]);}_0x2196fb[_0xdb33('0x4d')]=qs[_0xdb33('0x4e')](_0x3036bc[_0xdb33('0x45')][_0xdb33('0x4e')]);_0x2196fb[_0xdb33('0x4f')]=qs[_0xdb33('0x46')](_[_0xdb33('0x50')](_0x3036bc[_0xdb33('0x45')],_0x2b4278[_0xdb33('0x46')]),_0x22a170);if(_0x3036bc[_0xdb33('0x45')][_0xdb33('0x32')]){_0x2196fb[_0xdb33('0x4f')]=_[_0xdb33('0x51')](_0x2196fb['where'],{'$or':_['map'](_0x22a170,function(_0x35b296){if(_0x35b296['type']!==_0xdb33('0x52')){var _0x53c5e5={};_0x53c5e5[_0x35b296[_0xdb33('0x36')]]={'$like':'%'+_0x3036bc[_0xdb33('0x45')]['filter']+'%'};return _0x53c5e5;}})});}_0x2196fb=_[_0xdb33('0x51')]({},_0x2196fb,_0x3036bc['options']);var _0x496237={'where':_0x2196fb[_0xdb33('0x4f')]};return db[_0xdb33('0x41')][_0xdb33('0x25')](_0x496237)[_0xdb33('0x53')](function(_0x4c8201){_0x40509c[_0xdb33('0x25')]=_0x4c8201;if(_0x3036bc['query'][_0xdb33('0x54')]){_0x2196fb['include']=[{'all':!![]}];}return db[_0xdb33('0x41')][_0xdb33('0x55')](_0x2196fb);})[_0xdb33('0x53')](function(_0x4daf89){_0x40509c[_0xdb33('0x56')]=_0x4daf89;return _0x40509c;})[_0xdb33('0x53')](respondWithFilteredResult(_0x5db2e1,_0x2196fb))[_0xdb33('0x57')](handleError(_0x5db2e1,null));};exports[_0xdb33('0x58')]=function(_0x654b9c,_0x5e5892){var _0x4444b7={'raw':![],'where':{'id':_0x654b9c[_0xdb33('0x59')]['id']}},_0x5d2a66={};_0x5d2a66['model']=_[_0xdb33('0x5a')](db[_0xdb33('0x41')][_0xdb33('0x42')]);_0x5d2a66[_0xdb33('0x45')]=_[_0xdb33('0x5a')](_0x654b9c[_0xdb33('0x45')]);_0x5d2a66[_0xdb33('0x46')]=_[_0xdb33('0x47')](_0x5d2a66['model'],_0x5d2a66[_0xdb33('0x45')]);_0x4444b7['attributes']=_[_0xdb33('0x47')](_0x5d2a66['model'],qs['fields'](_0x654b9c[_0xdb33('0x45')][_0xdb33('0x49')]));_0x4444b7[_0xdb33('0x48')]=_0x4444b7[_0xdb33('0x48')][_0xdb33('0x4a')]?_0x4444b7['attributes']:_0x5d2a66[_0xdb33('0x44')];if(_0x654b9c[_0xdb33('0x45')]['includeAll']){_0x4444b7[_0xdb33('0x5b')]=[{'all':!![]}];}_0x4444b7=_[_0xdb33('0x51')]({},_0x4444b7,_0x654b9c[_0xdb33('0x5c')]);return db['VoiceExtension'][_0xdb33('0x5d')](_0x4444b7)[_0xdb33('0x53')](handleEntityNotFound(_0x5e5892,null))[_0xdb33('0x53')](respondWithResult(_0x5e5892,null))[_0xdb33('0x57')](handleError(_0x5e5892,null));};exports[_0xdb33('0x2b')]=function(_0x2392d6,_0x14d8f0){return db['VoiceExtension'][_0xdb33('0x5d')]({'where':{'id':_0x2392d6['params']['id']}})['then'](handleEntityNotFound(_0x14d8f0,null))[_0xdb33('0x53')](removeEntity(_0x14d8f0,null))[_0xdb33('0x57')](handleError(_0x14d8f0,null));};exports['create']=function(_0x59e491,_0x1ffb3d){if(_0x59e491[_0xdb33('0x3b')][_0xdb33('0x35')]==='outbound'&&!_[_0xdb33('0x5e')](_0x59e491[_0xdb33('0x3b')][_0xdb33('0x5f')],'_')){_0x59e491['body'][_0xdb33('0x5f')]='_'[_0xdb33('0x60')](_0x59e491[_0xdb33('0x3b')]['exten']);}return db[_0xdb33('0x41')][_0xdb33('0x61')](_0x59e491[_0xdb33('0x3b')],{'raw':![]})[_0xdb33('0x53')](function(_0x486423){var _0x268420=_0x59e491['user'][_0xdb33('0x2c')]({'plain':!![]});if(!_0x268420)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x268420['role']===_0xdb33('0x62')){var _0x1a10c0=_0x486423[_0xdb33('0x2c')]({'plain':!![]});var _0x3bfcf4=[{'name':_0xdb33('0x2d'),'value':_0xdb33('0x2e')},{'name':_0xdb33('0x63'),'value':'outbound'},{'name':_0xdb33('0x30'),'value':_0xdb33('0x31')}];var _0x14c392=_['find'](_0x3bfcf4,[_0xdb33('0x33'),_0x1a10c0['type']])[_0xdb33('0x36')];return db['UserProfileSection'][_0xdb33('0x5d')]({'where':{'name':_0x14c392,'userProfileId':_0x268420[_0xdb33('0x64')]},'raw':!![]})['then'](function(_0x30cf47){if(_0x30cf47&&_0x30cf47[_0xdb33('0x65')]===0x0){return db[_0xdb33('0x37')][_0xdb33('0x61')]({'name':_0x1a10c0['name'],'resourceId':_0x1a10c0['id'],'type':_0x30cf47['name'],'sectionId':_0x30cf47['id']},{})['then'](function(){return _0x486423;});}else{return _0x486423;}})[_0xdb33('0x57')](function(_0x2d1f9b){logger['error'](_0xdb33('0x66'),_0x2d1f9b);throw _0x2d1f9b;});}return _0x486423;})['then'](respondWithResult(_0x1ffb3d,0xc9))['catch'](handleError(_0x1ffb3d,null));};exports[_0xdb33('0x2a')]=function(_0x6411bc,_0x53d0f2){if(_0x6411bc[_0xdb33('0x3b')]['id']){delete _0x6411bc[_0xdb33('0x3b')]['id'];}return db[_0xdb33('0x41')]['find']({'where':{'id':_0x6411bc[_0xdb33('0x59')]['id']}})[_0xdb33('0x53')](handleEntityNotFound(_0x53d0f2,null))['then'](function(_0x330ba9){if(_0x330ba9){return db[_0xdb33('0x41')]['update'](_['pick'](_0x6411bc[_0xdb33('0x3b')],['exten',_0xdb33('0x67'),_0xdb33('0x68'),'recordingFormat','cutdigits',_0xdb33('0x69')]),{'where':{'context':_0x330ba9[_0xdb33('0x67')],'exten':_0x330ba9['exten']},'individualHooks':!![]})[_0xdb33('0x53')](function(_0x52da7a){return _0x52da7a;});}return null;})[_0xdb33('0x53')](respondWithStatusCode(_0x53d0f2,null))['catch'](handleError(_0x53d0f2,null));};exports[_0xdb33('0x6a')]=function(_0x5654a3,_0x5f3928,_0x170f3f){return db[_0xdb33('0x41')][_0xdb33('0x6b')]({'where':{'id':_0x5654a3['params']['id']}})['then'](handleEntityNotFound(_0x5f3928,null))['then'](function(_0x10d391){if(_0x10d391){return db[_0xdb33('0x6c')][_0xdb33('0x6d')](function(_0x138d56){return db[_0xdb33('0x41')][_0xdb33('0x2b')]({'where':{'VoiceExtensionId':_0x5654a3[_0xdb33('0x59')]['id']},'transaction':_0x138d56})['then'](function(_0x202b9d){var _0x40d350=_[_0xdb33('0x40')](_0x5654a3[_0xdb33('0x3b')],function(_0x2f1af0){_0x2f1af0['VoiceExtensionId']=_0x5654a3['params']['id'];return _0x2f1af0;});return db[_0xdb33('0x41')][_0xdb33('0x6e')](_0x40d350,{'transaction':_0x138d56});});})[_0xdb33('0x53')](function(){return db[_0xdb33('0x41')][_0xdb33('0x6f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5654a3['params']['id']},'order':_0xdb33('0x70')});});}})[_0xdb33('0x53')](respondWithResult(_0x5f3928,null))[_0xdb33('0x57')](handleError(_0x5f3928,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 47dc75c..2f49fa0 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 _0x7760=['update','remove','emit','hasOwnProperty','hook','events','VoiceExtension','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7760,0x15d));var _0x0776=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x7760[_0x20a558];return _0x53d3f7;};'use strict';var EventEmitter=require(_0x0776('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x0776('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0776('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0776('0x3'),'afterDestroy':_0x0776('0x4')};function emitEvent(_0xadf61e){return function(_0x15fb22,_0x42c54b,_0x476835){VoiceExtensionEvents['emit'](_0xadf61e+':'+_0x15fb22['id'],_0x15fb22);VoiceExtensionEvents[_0x0776('0x5')](_0xadf61e,_0x15fb22);_0x476835(null);};}for(var e in events){if(events[_0x0776('0x6')](e)){var event=events[e];VoiceExtension[_0x0776('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xbd93=['save','update','remove','emit','hook','exports','events','VoiceExtension','setMaxListeners'];(function(_0x56658f,_0x4e89b7){var _0x5d9501=function(_0x4378f5){while(--_0x4378f5){_0x56658f['push'](_0x56658f['shift']());}};_0x5d9501(++_0x4e89b7);}(_0xbd93,0xba));var _0x3bd9=function(_0x237a3c,_0xa3e8e4){_0x237a3c=_0x237a3c-0x0;var _0x56eb9b=_0xbd93[_0x237a3c];return _0x56eb9b;};'use strict';var EventEmitter=require(_0x3bd9('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x3bd9('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x3bd9('0x2')](0x0);var events={'afterCreate':_0x3bd9('0x3'),'afterUpdate':_0x3bd9('0x4'),'afterDestroy':_0x3bd9('0x5')};function emitEvent(_0x1dfb87){return function(_0x566bf5,_0x493e7b,_0x4bc77d){VoiceExtensionEvents['emit'](_0x1dfb87+':'+_0x566bf5['id'],_0x566bf5);VoiceExtensionEvents[_0x3bd9('0x6')](_0x1dfb87,_0x566bf5);_0x4bc77d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x3bd9('0x7')](e,emitEvent(event));}}module[_0x3bd9('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index d14748a..a224406 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 _0x8ea4=['voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x8ea4,0x169));var _0x48ea=function(_0x466f2e,_0x5e2a7f){_0x466f2e=_0x466f2e-0x0;var _0x22dfbb=_0x8ea4[_0x466f2e];return _0x22dfbb;};'use strict';var _=require(_0x48ea('0x0'));var util=require(_0x48ea('0x1'));var logger=require(_0x48ea('0x2'))(_0x48ea('0x3'));var moment=require(_0x48ea('0x4'));var BPromise=require(_0x48ea('0x5'));var rp=require(_0x48ea('0x6'));var fs=require('fs');var path=require(_0x48ea('0x7'));var rimraf=require(_0x48ea('0x8'));var config=require(_0x48ea('0x9'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x46ff69,_0x14df38){return _0x46ff69[_0x48ea('0xa')]('VoiceExtension',attributes,{'tableName':_0x48ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c60=['voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension'];(function(_0x2df692,_0x46c31a){var _0x382e11=function(_0x59e3b9){while(--_0x59e3b9){_0x2df692['push'](_0x2df692['shift']());}};_0x382e11(++_0x46c31a);}(_0x9c60,0x105));var _0x09c6=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c60[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x09c6('0x0'));var util=require(_0x09c6('0x1'));var logger=require(_0x09c6('0x2'))(_0x09c6('0x3'));var moment=require(_0x09c6('0x4'));var BPromise=require(_0x09c6('0x5'));var rp=require(_0x09c6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x09c6('0x7'));var attributes=require(_0x09c6('0x8'));module[_0x09c6('0x9')]=function(_0x2e93f0,_0x1b8684){return _0x2e93f0[_0x09c6('0xa')](_0x09c6('0xb'),attributes,{'tableName':_0x09c6('0xc'),'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 c5ab931..5eee418 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 _0x2043=['defaults','socket.io-emitter','info','request\x20sent','debug','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis'];(function(_0x33efea,_0x1af963){var _0x5f18fb=function(_0x38362e){while(--_0x38362e){_0x33efea['push'](_0x33efea['shift']());}};_0x5f18fb(++_0x1af963);}(_0x2043,0x127));var _0x3204=function(_0x25646a,_0x5e9012){_0x25646a=_0x25646a-0x0;var _0x2eb8e4=_0x2043[_0x25646a];return _0x2eb8e4;};'use strict';var _=require('lodash');var util=require(_0x3204('0x0'));var moment=require(_0x3204('0x1'));var BPromise=require('bluebird');var rs=require(_0x3204('0x2'));var fs=require('fs');var Redis=require(_0x3204('0x3'));var db=require(_0x3204('0x4'))['db'];var utils=require(_0x3204('0x5'));var logger=require('../../config/logger')(_0x3204('0x6'));var config=require('../../config/environment');var jayson=require(_0x3204('0x7'));var client=jayson[_0x3204('0x8')][_0x3204('0x9')]({'port':0x232a});config[_0x3204('0xa')]=_[_0x3204('0xb')](config[_0x3204('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3204('0xc'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x380314,_0x363f30,_0x38f3c8){return new BPromise(function(_0x3d910e,_0x435a67){return client['request'](_0x380314,_0x38f3c8)['then'](function(_0x268c8a){logger[_0x3204('0xd')]('VoiceExtension,\x20%s,\x20%s',_0x363f30,_0x3204('0xe'));logger[_0x3204('0xf')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x363f30,_0x3204('0xe'),JSON[_0x3204('0x10')](_0x268c8a));if(_0x268c8a['error']){if(_0x268c8a[_0x3204('0x11')][_0x3204('0x12')]===0x1f4){logger[_0x3204('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x363f30,_0x268c8a['error'][_0x3204('0x13')]);return _0x435a67(_0x268c8a[_0x3204('0x11')][_0x3204('0x13')]);}logger[_0x3204('0x11')](_0x3204('0x14'),_0x363f30,_0x268c8a[_0x3204('0x11')][_0x3204('0x13')]);return _0x3d910e(_0x268c8a[_0x3204('0x11')][_0x3204('0x13')]);}else{logger[_0x3204('0xd')](_0x3204('0x14'),_0x363f30,'request\x20sent');_0x3d910e(_0x268c8a[_0x3204('0x15')][_0x3204('0x13')]);}})[_0x3204('0x16')](function(_0x5133cc){logger[_0x3204('0x11')](_0x3204('0x14'),_0x363f30,_0x5133cc);_0x435a67(_0x5133cc);});});}exports[_0x3204('0x17')]=function(_0x1307ab){var _0x3949dd=this;return new Promise(function(_0x24aec1,_0x504b8f){return db[_0x3204('0x18')][_0x3204('0x19')]({'raw':_0x1307ab['options']?_0x1307ab[_0x3204('0x1a')][_0x3204('0x1b')]===undefined?!![]:![]:!![],'where':_0x1307ab[_0x3204('0x1a')]?_0x1307ab[_0x3204('0x1a')][_0x3204('0x1c')]||null:null,'attributes':_0x1307ab['options']?_0x1307ab[_0x3204('0x1a')][_0x3204('0x1d')]||null:null,'limit':_0x1307ab[_0x3204('0x1a')]?_0x1307ab[_0x3204('0x1a')]['limit']||null:null,'include':_0x1307ab[_0x3204('0x1a')]?_0x1307ab[_0x3204('0x1a')][_0x3204('0x1e')]?_[_0x3204('0x1f')](_0x1307ab[_0x3204('0x1a')][_0x3204('0x1e')],function(_0x202eec){return{'model':db[_0x202eec[_0x3204('0x20')]],'as':_0x202eec['as'],'attributes':_0x202eec[_0x3204('0x1d')],'include':_0x202eec[_0x3204('0x1e')]?_['map'](_0x202eec[_0x3204('0x1e')],function(_0x4dee96){return{'model':db[_0x4dee96[_0x3204('0x20')]],'as':_0x4dee96['as'],'attributes':_0x4dee96[_0x3204('0x1d')],'include':_0x4dee96[_0x3204('0x1e')]?_[_0x3204('0x1f')](_0x4dee96[_0x3204('0x1e')],function(_0x49fedc){return{'model':db[_0x49fedc['model']],'as':_0x49fedc['as'],'attributes':_0x49fedc[_0x3204('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3204('0x21')](function(_0x4fdd40){logger[_0x3204('0xd')](_0x3204('0x17'),_0x1307ab);logger[_0x3204('0xf')](_0x3204('0x17'),_0x1307ab,JSON[_0x3204('0x10')](_0x4fdd40));_0x24aec1(_0x4fdd40);})[_0x3204('0x16')](function(_0x356fb5){logger[_0x3204('0x11')](_0x3204('0x17'),_0x356fb5['message'],_0x1307ab);_0x504b8f(_0x3949dd[_0x3204('0x11')](0x1f4,_0x356fb5[_0x3204('0x13')]));});});}; \ No newline at end of file +var _0x5f59=['info','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','include','map','model','then','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','request\x20sent','debug','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s'];(function(_0x300e14,_0x11fbce){var _0x25cbe0=function(_0x1cde6c){while(--_0x1cde6c){_0x300e14['push'](_0x300e14['shift']());}};_0x25cbe0(++_0x11fbce);}(_0x5f59,0x1d3));var _0x95f5=function(_0x40922f,_0x5a73b0){_0x40922f=_0x40922f-0x0;var _0x5d8158=_0x5f59[_0x40922f];return _0x5d8158;};'use strict';var _=require(_0x95f5('0x0'));var util=require('util');var moment=require(_0x95f5('0x1'));var BPromise=require('bluebird');var rs=require(_0x95f5('0x2'));var fs=require('fs');var Redis=require(_0x95f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x95f5('0x4'));var logger=require('../../config/logger')(_0x95f5('0x5'));var config=require(_0x95f5('0x6'));var jayson=require(_0x95f5('0x7'));var client=jayson[_0x95f5('0x8')][_0x95f5('0x9')]({'port':0x232a});config[_0x95f5('0xa')]=_[_0x95f5('0xb')](config[_0x95f5('0xa')],{'host':_0x95f5('0xc'),'port':0x18eb});var socket=require(_0x95f5('0xd'))(new Redis(config[_0x95f5('0xa')]));require(_0x95f5('0xe'))['register'](socket);function respondWithRpcPromise(_0x34e1ed,_0x546e9a,_0x593d25){return new BPromise(function(_0x5b42cf,_0x4d9c6b){return client[_0x95f5('0xf')](_0x34e1ed,_0x593d25)['then'](function(_0x7e6257){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x546e9a,_0x95f5('0x10'));logger[_0x95f5('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x546e9a,_0x95f5('0x10'),JSON[_0x95f5('0x12')](_0x7e6257));if(_0x7e6257[_0x95f5('0x13')]){if(_0x7e6257[_0x95f5('0x13')][_0x95f5('0x14')]===0x1f4){logger[_0x95f5('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x546e9a,_0x7e6257['error']['message']);return _0x4d9c6b(_0x7e6257[_0x95f5('0x13')][_0x95f5('0x15')]);}logger['error'](_0x95f5('0x16'),_0x546e9a,_0x7e6257[_0x95f5('0x13')]['message']);return _0x5b42cf(_0x7e6257[_0x95f5('0x13')][_0x95f5('0x15')]);}else{logger[_0x95f5('0x17')](_0x95f5('0x16'),_0x546e9a,'request\x20sent');_0x5b42cf(_0x7e6257[_0x95f5('0x18')]['message']);}})['catch'](function(_0x1fdfeb){logger[_0x95f5('0x13')](_0x95f5('0x16'),_0x546e9a,_0x1fdfeb);_0x4d9c6b(_0x1fdfeb);});});}exports[_0x95f5('0x19')]=function(_0x1eec83){var _0x21fe7c=this;return new Promise(function(_0x507c74,_0x49ff3f){return db[_0x95f5('0x1a')][_0x95f5('0x1b')]({'raw':_0x1eec83['options']?_0x1eec83[_0x95f5('0x1c')][_0x95f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x1eec83[_0x95f5('0x1c')]?_0x1eec83[_0x95f5('0x1c')]['where']||null:null,'attributes':_0x1eec83[_0x95f5('0x1c')]?_0x1eec83[_0x95f5('0x1c')][_0x95f5('0x1e')]||null:null,'limit':_0x1eec83[_0x95f5('0x1c')]?_0x1eec83[_0x95f5('0x1c')]['limit']||null:null,'include':_0x1eec83['options']?_0x1eec83['options'][_0x95f5('0x1f')]?_[_0x95f5('0x20')](_0x1eec83[_0x95f5('0x1c')][_0x95f5('0x1f')],function(_0x223547){return{'model':db[_0x223547[_0x95f5('0x21')]],'as':_0x223547['as'],'attributes':_0x223547[_0x95f5('0x1e')],'include':_0x223547['include']?_[_0x95f5('0x20')](_0x223547['include'],function(_0x498dec){return{'model':db[_0x498dec[_0x95f5('0x21')]],'as':_0x498dec['as'],'attributes':_0x498dec[_0x95f5('0x1e')],'include':_0x498dec[_0x95f5('0x1f')]?_[_0x95f5('0x20')](_0x498dec[_0x95f5('0x1f')],function(_0x38b81b){return{'model':db[_0x38b81b[_0x95f5('0x21')]],'as':_0x38b81b['as'],'attributes':_0x38b81b[_0x95f5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x95f5('0x22')](function(_0x34b6ff){logger['info'](_0x95f5('0x19'),_0x1eec83);logger[_0x95f5('0x11')](_0x95f5('0x19'),_0x1eec83,JSON['stringify'](_0x34b6ff));_0x507c74(_0x34b6ff);})['catch'](function(_0x1ec5ca){logger['error'](_0x95f5('0x19'),_0x1ec5ca[_0x95f5('0x15')],_0x1eec83);_0x49ff3f(_0x21fe7c['error'](0x1f4,_0x1ec5ca[_0x95f5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 030ffb1..ae63718 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 _0x9857=['update','emit','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x4bb35f,_0x1674f4){var _0x239f4c=function(_0x6b9c18){while(--_0x6b9c18){_0x4bb35f['push'](_0x4bb35f['shift']());}};_0x239f4c(++_0x1674f4);}(_0x9857,0x1ed));var _0x7985=function(_0x1bad53,_0x42acd9){_0x1bad53=_0x1bad53-0x0;var _0x395f76=_0x9857[_0x1bad53];return _0x395f76;};'use strict';var VoiceExtensionEvents=require(_0x7985('0x0'));var events=[_0x7985('0x1'),_0x7985('0x2'),_0x7985('0x3')];function createListener(_0x58ea1a,_0x55781b){return function(_0xee94f3){_0x55781b[_0x7985('0x4')](_0x58ea1a,_0xee94f3);};}function removeListener(_0x5a0fd5,_0xeb9c83){return function(){VoiceExtensionEvents['removeListener'](_0x5a0fd5,_0xeb9c83);};}exports[_0x7985('0x5')]=function(_0x372ca2){for(var _0x553745=0x0,_0x341622=events[_0x7985('0x6')];_0x553745<_0x341622;_0x553745++){var _0x389fe4=events[_0x553745];var _0x235f75=createListener(_0x7985('0x7')+_0x389fe4,_0x372ca2);VoiceExtensionEvents['on'](_0x389fe4,_0x235f75);}}; \ No newline at end of file +var _0xd569=['remove','update','register','length','voiceExtension:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd569,0xf5));var _0x9d56=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0xd569[_0x39d39d];return _0x577ac3;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x9d56('0x0'),_0x9d56('0x1'),_0x9d56('0x2')];function createListener(_0xa753f7,_0x201770){return function(_0x44e594){_0x201770['emit'](_0xa753f7,_0x44e594);};}function removeListener(_0x5ed6e4,_0x18e004){return function(){VoiceExtensionEvents['removeListener'](_0x5ed6e4,_0x18e004);};}exports[_0x9d56('0x3')]=function(_0x218e54){for(var _0x483357=0x0,_0x3dea72=events[_0x9d56('0x4')];_0x483357<_0x3dea72;_0x483357++){var _0x5d2d00=events[_0x483357];var _0x368960=createListener(_0x9d56('0x5')+_0x5d2d00,_0x218e54);VoiceExtensionEvents['on'](_0x5d2d00,_0x368960);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 6cddafb..77479ab 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 _0xce3a=['isAuthenticated','getMessages','post','create','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id'];(function(_0x17d3d0,_0x6ecac3){var _0x3a4144=function(_0x258783){while(--_0x258783){_0x17d3d0['push'](_0x17d3d0['shift']());}};_0x3a4144(++_0x6ecac3);}(_0xce3a,0x194));var _0xace3=function(_0x15d1dd,_0x58fcfc){_0x15d1dd=_0x15d1dd-0x0;var _0x1d60d4=_0xce3a[_0x15d1dd];return _0x1d60d4;};'use strict';var multer=require(_0xace3('0x0'));var util=require(_0xace3('0x1'));var path=require(_0xace3('0x2'));var timeout=require(_0xace3('0x3'));var express=require(_0xace3('0x4'));var router=express[_0xace3('0x5')]();var fs_extra=require(_0xace3('0x6'));var auth=require(_0xace3('0x7'));var interaction=require(_0xace3('0x8'));var config=require(_0xace3('0x9'));var controller=require(_0xace3('0xa'));router[_0xace3('0xb')]('/',auth['isAuthenticated'](),controller[_0xace3('0xc')]);router[_0xace3('0xb')](_0xace3('0xd'),auth[_0xace3('0xe')](),controller['show']);router[_0xace3('0xb')]('/:id/messages',auth[_0xace3('0xe')](),controller[_0xace3('0xf')]);router[_0xace3('0x10')]('/',auth[_0xace3('0xe')](),controller[_0xace3('0x11')]);router[_0xace3('0x12')](_0xace3('0xd'),auth[_0xace3('0xe')](),controller['update']);router['delete']('/:id',auth[_0xace3('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x22dd=['getMessages','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages'];(function(_0x5f0c2e,_0x33309f){var _0x1c2dda=function(_0x205be4){while(--_0x205be4){_0x5f0c2e['push'](_0x5f0c2e['shift']());}};_0x1c2dda(++_0x33309f);}(_0x22dd,0xe4));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd22d('0x0'));var util=require(_0xd22d('0x1'));var path=require(_0xd22d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd22d('0x3')]();var fs_extra=require(_0xd22d('0x4'));var auth=require(_0xd22d('0x5'));var interaction=require(_0xd22d('0x6'));var config=require(_0xd22d('0x7'));var controller=require(_0xd22d('0x8'));router[_0xd22d('0x9')]('/',auth[_0xd22d('0xa')](),controller[_0xd22d('0xb')]);router[_0xd22d('0x9')]('/:id',auth[_0xd22d('0xa')](),controller[_0xd22d('0xc')]);router['get'](_0xd22d('0xd'),auth['isAuthenticated'](),controller[_0xd22d('0xe')]);router['post']('/',auth[_0xd22d('0xa')](),controller[_0xd22d('0xf')]);router[_0xd22d('0x10')](_0xd22d('0x11'),auth[_0xd22d('0xa')](),controller[_0xd22d('0x12')]);router[_0xd22d('0x13')](_0xd22d('0x11'),auth['isAuthenticated'](),controller[_0xd22d('0x14')]);module[_0xd22d('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 601ed3e..deaf4a0 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 _0x8f4c=['fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue'];(function(_0x3be623,_0x3b4381){var _0x2ae423=function(_0x2d3a3b){while(--_0x2d3a3b){_0x3be623['push'](_0x3be623['shift']());}};_0x2ae423(++_0x3b4381);}(_0x8f4c,0x113));var _0xc8f4=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x8f4c[_0x43d16c];return _0x208cce;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'customer_id':{'type':Sequelize[_0xc8f4('0x2')]},'context':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x3'),'unique':_0xc8f4('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xc8f4('0x4')},'password':{'type':Sequelize[_0xc8f4('0x2')]},'fullname':{'type':Sequelize[_0xc8f4('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x32cd80){this['setDataValue']('email',typeof _0x32cd80==='string'&&_0x32cd80[_0xc8f4('0x5')]()?_0x32cd80['trim']():null);}},'pager':{'type':Sequelize[_0xc8f4('0x2')]},'tz':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x6')},'attach':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':_0xc8f4('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc8f4('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc8f4('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':_0xc8f4('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xc8f4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xc8f4('0x2')]},'emailbody':{'type':Sequelize[_0xc8f4('0x2')]},'maxsecs':{'type':Sequelize[_0xc8f4('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc8f4('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc8f4('0xb')],'get':function(){return this[_0xc8f4('0xc')](_0xc8f4('0xd'))+_0xc8f4('0xe')+this[_0xc8f4('0xc')](_0xc8f4('0xf'));}}}; \ No newline at end of file +var _0x9c00=['STRING','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','\x20-\x20','mailbox','sequelize','exports','from-voicemail','contest_mailbox'];(function(_0x4c816e,_0x310b37){var _0x1c66b0=function(_0x1cb953){while(--_0x1cb953){_0x4c816e['push'](_0x4c816e['shift']());}};_0x1c66b0(++_0x310b37);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2d579f,_0x370e5d){_0x2d579f=_0x2d579f-0x0;var _0x1145da=_0x9c00[_0x2d579f];return _0x1145da;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x09c0('0x2'),'unique':_0x09c0('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x09c0('0x3')},'password':{'type':Sequelize[_0x09c0('0x4')]},'fullname':{'type':Sequelize[_0x09c0('0x4')]},'email':{'type':Sequelize[_0x09c0('0x4')],'validate':{'isEmail':!![]},'set':function(_0x1cbf99){this['setDataValue']('email',typeof _0x1cbf99===_0x09c0('0x5')&&_0x1cbf99[_0x09c0('0x6')]()?_0x1cbf99[_0x09c0('0x6')]():null);}},'pager':{'type':Sequelize[_0x09c0('0x4')]},'tz':{'type':Sequelize[_0x09c0('0x4')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':_0x09c0('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':_0x09c0('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x09c0('0x4')]},'callback':{'type':Sequelize[_0x09c0('0x4')]},'review':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x09c0('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':_0x09c0('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x09c0('0x7')](_0x09c0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x09c0('0x8'),'no'),'defaultValue':_0x09c0('0x8'),'allowNull':![]},'stamp':{'type':_0x09c0('0xa')},'emailsubject':{'type':Sequelize[_0x09c0('0x4')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x09c0('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x09c0('0xc')]('fullname')+_0x09c0('0xd')+this[_0x09c0('0xc')](_0x09c0('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index c9cf305..e428141 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 _0x0cdc=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','send','render','contact','message','agent','interaction','account','index','VoiceMail','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','VoiceMailMessage','nolimit','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','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/license/util','../../mysqldb','sendStatus'];(function(_0x10d244,_0x49c680){var _0x67755d=function(_0x21ea7b){while(--_0x21ea7b){_0x10d244['push'](_0x10d244['shift']());}};_0x67755d(++_0x49c680);}(_0x0cdc,0x1c0));var _0xc0cd=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x0cdc[_0x59e821];return _0x5333f6;};'use strict';var emlformat=require(_0xc0cd('0x0'));var rimraf=require(_0xc0cd('0x1'));var zipdir=require(_0xc0cd('0x2'));var jsonpatch=require(_0xc0cd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc0cd('0x4'));var Mustache=require(_0xc0cd('0x5'));var util=require(_0xc0cd('0x6'));var path=require(_0xc0cd('0x7'));var sox=require('sox');var csv=require(_0xc0cd('0x8'));var ejs=require(_0xc0cd('0x9'));var fs=require('fs');var fs_extra=require(_0xc0cd('0xa'));var _=require('lodash');var squel=require(_0xc0cd('0xb'));var crypto=require(_0xc0cd('0xc'));var jsforce=require(_0xc0cd('0xd'));var deskjs=require(_0xc0cd('0xe'));var toCsv=require(_0xc0cd('0x8'));var querystring=require(_0xc0cd('0xf'));var Papa=require(_0xc0cd('0x10'));var Redis=require('ioredis');var authService=require(_0xc0cd('0x11'));var qs=require(_0xc0cd('0x12'));var as=require(_0xc0cd('0x13'));var hardwareService=require(_0xc0cd('0x14'));var logger=require(_0xc0cd('0x15'))(_0xc0cd('0x16'));var utils=require(_0xc0cd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc0cd('0x18'));var db=require(_0xc0cd('0x19'))['db'];function respondWithStatusCode(_0x33418c,_0x586c05){_0x586c05=_0x586c05||0xcc;return function(_0x3767b3){if(_0x3767b3){return _0x33418c[_0xc0cd('0x1a')](_0x586c05);}return _0x33418c[_0xc0cd('0x1b')](_0x586c05)[_0xc0cd('0x1c')]();};}function respondWithResult(_0x4e8515,_0x1ddeb2){_0x1ddeb2=_0x1ddeb2||0xc8;return function(_0x3435ca){if(_0x3435ca){return _0x4e8515[_0xc0cd('0x1b')](_0x1ddeb2)[_0xc0cd('0x1d')](_0x3435ca);}};}function respondWithFilteredResult(_0x39a86d,_0xd5482d){return function(_0x148ca0){if(_0x148ca0){var _0x189496=typeof _0xd5482d[_0xc0cd('0x1e')]===_0xc0cd('0x1f')&&typeof _0xd5482d[_0xc0cd('0x20')]===_0xc0cd('0x1f');var _0x21c51d=_0x148ca0[_0xc0cd('0x21')];var _0x18c7c6=_0x189496?0x0:_0xd5482d['offset'];var _0x23666a=_0x189496?_0x148ca0[_0xc0cd('0x21')]:_0xd5482d[_0xc0cd('0x1e')]+_0xd5482d[_0xc0cd('0x20')];var _0x1a4c2f;if(_0x23666a>=_0x21c51d){_0x23666a=_0x21c51d;_0x1a4c2f=0xc8;}else{_0x1a4c2f=0xce;}_0x39a86d[_0xc0cd('0x1b')](_0x1a4c2f);return _0x39a86d[_0xc0cd('0x22')](_0xc0cd('0x23'),_0x18c7c6+'-'+_0x23666a+'/'+_0x21c51d)['json'](_0x148ca0);}return null;};}function patchUpdates(_0x575dfa){return function(_0x66305f){try{jsonpatch[_0xc0cd('0x24')](_0x66305f,_0x575dfa,!![]);}catch(_0x4e3061){return BPromise[_0xc0cd('0x25')](_0x4e3061);}return _0x66305f[_0xc0cd('0x26')]();};}function saveUpdates(_0x4c0828,_0x571b34){return function(_0x3cd983){if(_0x3cd983){return _0x3cd983['update'](_0x4c0828)[_0xc0cd('0x27')](function(_0x1ed106){return _0x1ed106;});}return null;};}function removeEntity(_0x177024,_0x4495d7){return function(_0x5767f3){if(_0x5767f3){return _0x5767f3[_0xc0cd('0x28')]()[_0xc0cd('0x27')](function(){var _0x50dce6=_0x5767f3[_0xc0cd('0x29')]({'plain':!![]});var _0x18cbe7='Voicemails';return db['UserProfileResource'][_0xc0cd('0x28')]({'where':{'type':_0x18cbe7,'resourceId':_0x50dce6['id']}})[_0xc0cd('0x27')](function(){return _0x5767f3;});})['then'](function(){_0x177024[_0xc0cd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50cf39,_0x477ba8){return function(_0x47c8b2){if(!_0x47c8b2){_0x50cf39['sendStatus'](0x194);}return _0x47c8b2;};}function handleError(_0x4932f1,_0x1cee42){_0x1cee42=_0x1cee42||0x1f4;return function(_0x14d1a2){logger[_0xc0cd('0x2a')](_0x14d1a2[_0xc0cd('0x2b')]);if(_0x14d1a2[_0xc0cd('0x2c')]){delete _0x14d1a2['name'];}_0x4932f1[_0xc0cd('0x1b')](_0x1cee42)[_0xc0cd('0x2d')](_0x14d1a2);};}function getMustacheRender(_0x4849f1,_0x8eeac1){return Mustache[_0xc0cd('0x2e')](_0x4849f1,_['merge'](_0x8eeac1['body'],{'contact':_0x8eeac1[_0xc0cd('0x2f')],'message':_0x8eeac1[_0xc0cd('0x30')],'agent':_0x8eeac1[_0xc0cd('0x31')],'interaction':_0x8eeac1[_0xc0cd('0x32')],'account':_0x8eeac1[_0xc0cd('0x33')]}))||'';}exports[_0xc0cd('0x34')]=function(_0x47c14b,_0x2df840){var _0x169fa6={},_0x181ab5={},_0x4a7e78={'count':0x0,'rows':[]};var _0x1f36fd=_['map'](db[_0xc0cd('0x35')][_0xc0cd('0x36')],function(_0x4afced){return{'name':_0x4afced[_0xc0cd('0x37')],'type':_0x4afced[_0xc0cd('0x38')][_0xc0cd('0x39')]};});_0x181ab5[_0xc0cd('0x3a')]=_['map'](_0x1f36fd,_0xc0cd('0x2c'));_0x181ab5['query']=_[_0xc0cd('0x3b')](_0x47c14b[_0xc0cd('0x3c')]);_0x181ab5[_0xc0cd('0x3d')]=_[_0xc0cd('0x3e')](_0x181ab5['model'],_0x181ab5[_0xc0cd('0x3c')]);_0x169fa6['attributes']=_[_0xc0cd('0x3e')](_0x181ab5[_0xc0cd('0x3a')],qs[_0xc0cd('0x3f')](_0x47c14b['query'][_0xc0cd('0x3f')]));_0x169fa6[_0xc0cd('0x40')]=_0x169fa6['attributes'][_0xc0cd('0x41')]?_0x169fa6[_0xc0cd('0x40')]:_0x181ab5[_0xc0cd('0x3a')];if(!_0x47c14b[_0xc0cd('0x3c')][_0xc0cd('0x42')]('nolimit')){_0x169fa6[_0xc0cd('0x20')]=qs[_0xc0cd('0x20')](_0x47c14b[_0xc0cd('0x3c')]['limit']);_0x169fa6[_0xc0cd('0x1e')]=qs['offset'](_0x47c14b[_0xc0cd('0x3c')][_0xc0cd('0x1e')]);}_0x169fa6[_0xc0cd('0x43')]=qs[_0xc0cd('0x44')](_0x47c14b['query'][_0xc0cd('0x44')]);_0x169fa6['where']=qs['filters'](_[_0xc0cd('0x45')](_0x47c14b[_0xc0cd('0x3c')],_0x181ab5['filters']),_0x1f36fd);if(_0x47c14b['query'][_0xc0cd('0x46')]){_0x169fa6[_0xc0cd('0x47')]=_[_0xc0cd('0x48')](_0x169fa6[_0xc0cd('0x47')],{'$or':_[_0xc0cd('0x49')](_0x1f36fd,function(_0x23cfa1){if(_0x23cfa1[_0xc0cd('0x38')]!==_0xc0cd('0x4a')){var _0x216f81={};_0x216f81[_0x23cfa1[_0xc0cd('0x2c')]]={'$like':'%'+_0x47c14b[_0xc0cd('0x3c')]['filter']+'%'};return _0x216f81;}})});}_0x169fa6=_['merge']({},_0x169fa6,_0x47c14b[_0xc0cd('0x4b')]);var _0x139936={'where':_0x169fa6[_0xc0cd('0x47')]};return db[_0xc0cd('0x35')]['count'](_0x139936)[_0xc0cd('0x27')](function(_0xe5b7fb){_0x4a7e78[_0xc0cd('0x21')]=_0xe5b7fb;if(_0x47c14b[_0xc0cd('0x3c')]['includeAll']){_0x169fa6[_0xc0cd('0x4c')]=[{'all':!![]}];}return db[_0xc0cd('0x35')][_0xc0cd('0x4d')](_0x169fa6);})[_0xc0cd('0x27')](function(_0x3e023f){_0x4a7e78[_0xc0cd('0x4e')]=_0x3e023f;return _0x4a7e78;})['then'](respondWithFilteredResult(_0x2df840,_0x169fa6))['catch'](handleError(_0x2df840,null));};exports['show']=function(_0x4d3930,_0x12b582){var _0x3e2683={'raw':!![],'where':{'id':_0x4d3930[_0xc0cd('0x4f')]['id']}},_0x1d7b08={};_0x1d7b08[_0xc0cd('0x3a')]=_[_0xc0cd('0x3b')](db['VoiceMail'][_0xc0cd('0x36')]);_0x1d7b08['query']=_[_0xc0cd('0x3b')](_0x4d3930['query']);_0x1d7b08[_0xc0cd('0x3d')]=_[_0xc0cd('0x3e')](_0x1d7b08[_0xc0cd('0x3a')],_0x1d7b08[_0xc0cd('0x3c')]);_0x3e2683[_0xc0cd('0x40')]=_['intersection'](_0x1d7b08[_0xc0cd('0x3a')],qs[_0xc0cd('0x3f')](_0x4d3930[_0xc0cd('0x3c')][_0xc0cd('0x3f')]));_0x3e2683[_0xc0cd('0x40')]=_0x3e2683[_0xc0cd('0x40')][_0xc0cd('0x41')]?_0x3e2683['attributes']:_0x1d7b08['model'];if(_0x4d3930['query']['includeAll']){_0x3e2683[_0xc0cd('0x4c')]=[{'all':!![]}];}_0x3e2683=_[_0xc0cd('0x48')]({},_0x3e2683,_0x4d3930[_0xc0cd('0x4b')]);return db[_0xc0cd('0x35')][_0xc0cd('0x50')](_0x3e2683)['then'](handleEntityNotFound(_0x12b582,null))['then'](respondWithResult(_0x12b582,null))[_0xc0cd('0x51')](handleError(_0x12b582,null));};exports[_0xc0cd('0x52')]=function(_0x30df2e,_0x46ec6e){return db[_0xc0cd('0x35')][_0xc0cd('0x52')](_0x30df2e['body'],{})['then'](function(_0x18ab8c){var _0x4af24c=_0x30df2e[_0xc0cd('0x53')][_0xc0cd('0x29')]({'plain':!![]});if(!_0x4af24c)throw new Error(_0xc0cd('0x54'));if(_0x4af24c[_0xc0cd('0x55')]===_0xc0cd('0x53')){var _0x42a9c4=_0x18ab8c['get']({'plain':!![]});var _0x40ee9e=_0xc0cd('0x56');return db[_0xc0cd('0x57')][_0xc0cd('0x50')]({'where':{'name':_0x40ee9e,'userProfileId':_0x4af24c[_0xc0cd('0x58')]},'raw':!![]})['then'](function(_0x3cb647){if(_0x3cb647&&_0x3cb647[_0xc0cd('0x59')]===0x0){return db[_0xc0cd('0x5a')][_0xc0cd('0x52')]({'name':_0x42a9c4['name'],'resourceId':_0x42a9c4['id'],'type':_0x3cb647['name'],'sectionId':_0x3cb647['id']},{})[_0xc0cd('0x27')](function(){return _0x18ab8c;});}else{return _0x18ab8c;}})[_0xc0cd('0x51')](function(_0x3ec415){logger[_0xc0cd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ec415);throw _0x3ec415;});}return _0x18ab8c;})[_0xc0cd('0x27')](respondWithResult(_0x46ec6e,0xc9))['catch'](handleError(_0x46ec6e,null));};exports['update']=function(_0x33ac6c,_0x230ad4){if(_0x33ac6c[_0xc0cd('0x5b')]['id']){delete _0x33ac6c[_0xc0cd('0x5b')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x33ac6c[_0xc0cd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x230ad4,null))['then'](saveUpdates(_0x33ac6c['body'],null))[_0xc0cd('0x27')](respondWithResult(_0x230ad4,null))[_0xc0cd('0x51')](handleError(_0x230ad4,null));};exports[_0xc0cd('0x28')]=function(_0x5aff44,_0x53c16c){return db[_0xc0cd('0x35')][_0xc0cd('0x50')]({'where':{'id':_0x5aff44['params']['id']}})[_0xc0cd('0x27')](handleEntityNotFound(_0x53c16c,null))[_0xc0cd('0x27')](removeEntity(_0x53c16c,null))['catch'](handleError(_0x53c16c,null));};exports['getMessages']=function(_0x4e64d2,_0xfffdf9,_0x289cc4){return db[_0xc0cd('0x35')]['findOne']({'where':{'id':_0x4e64d2[_0xc0cd('0x4f')]['id']}})[_0xc0cd('0x27')](handleEntityNotFound(_0xfffdf9,null))['then'](function(_0x1c3620){var _0xddb28;var _0x56d61c={},_0xa7f92c={};_0xa7f92c['model']=_[_0xc0cd('0x3b')](db[_0xc0cd('0x5c')]['rawAttributes']);_0xa7f92c[_0xc0cd('0x3c')]=_['keys'](_0x4e64d2[_0xc0cd('0x3c')]);_0xa7f92c['filters']=_[_0xc0cd('0x3e')](_0xa7f92c['model'],_0xa7f92c[_0xc0cd('0x3c')]);_0x56d61c[_0xc0cd('0x40')]=_[_0xc0cd('0x3e')](_0xa7f92c['model'],qs[_0xc0cd('0x3f')](_0x4e64d2[_0xc0cd('0x3c')][_0xc0cd('0x3f')]));_0x56d61c['attributes']=_0x56d61c[_0xc0cd('0x40')][_0xc0cd('0x41')]?_0x56d61c[_0xc0cd('0x40')]:_0xa7f92c['model'];if(!_0x4e64d2[_0xc0cd('0x3c')][_0xc0cd('0x42')](_0xc0cd('0x5d'))){_0x56d61c[_0xc0cd('0x20')]=qs['limit'](_0x4e64d2[_0xc0cd('0x3c')]['limit']);_0x56d61c[_0xc0cd('0x1e')]=qs[_0xc0cd('0x1e')](_0x4e64d2[_0xc0cd('0x3c')][_0xc0cd('0x1e')]);}_0x56d61c[_0xc0cd('0x43')]=qs[_0xc0cd('0x44')](_0x4e64d2[_0xc0cd('0x3c')]['sort']);_0x56d61c['where']=qs[_0xc0cd('0x3d')](_[_0xc0cd('0x45')](_0x4e64d2[_0xc0cd('0x3c')],_0xa7f92c['filters']));if(_0x4e64d2[_0xc0cd('0x3c')][_0xc0cd('0x46')]){_0x56d61c['where']=_['merge'](_0x56d61c[_0xc0cd('0x47')],{'$or':_['map'](_0x56d61c[_0xc0cd('0x40')],function(_0x1ebee2){var _0x10131d={};_0x10131d[_0x1ebee2]={'$like':'%'+_0x4e64d2[_0xc0cd('0x3c')][_0xc0cd('0x46')]+'%'};return _0x10131d;})});}_0x56d61c[_0xc0cd('0x47')]=_[_0xc0cd('0x48')](_0x56d61c[_0xc0cd('0x47')],{'mailboxuser':_0x1c3620[_0xc0cd('0x5e')]});_0x56d61c=_[_0xc0cd('0x48')]({},_0x56d61c,_0x4e64d2[_0xc0cd('0x4b')]);return db['VoiceMailMessage']['findAndCountAll'](_0x56d61c)[_0xc0cd('0x27')](respondWithFilteredResult(_0xfffdf9,_0x56d61c));})['catch'](handleError(_0xfffdf9,null));}; \ No newline at end of file +var _0xd61a=['catch','show','params','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','VoiceMailMessage','rawAttributes','hasOwnProperty','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','offset','undefined','limit','count','apply','reject','then','destroy','get','Voicemails','error','stack','name','send','render','merge','body','contact','message','account','VoiceMail','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','map','VIRTUAL','options','includeAll','include','findAll'];(function(_0xd5d5ed,_0x39be7b){var _0x12a328=function(_0x155aad){while(--_0x155aad){_0xd5d5ed['push'](_0xd5d5ed['shift']());}};_0x12a328(++_0x39be7b);}(_0xd61a,0x114));var _0xad61=function(_0x595add,_0x15feb9){_0x595add=_0x595add-0x0;var _0x52eb1a=_0xd61a[_0x595add];return _0x52eb1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad61('0x0'));var zipdir=require(_0xad61('0x1'));var jsonpatch=require(_0xad61('0x2'));var rp=require(_0xad61('0x3'));var moment=require(_0xad61('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xad61('0x5'));var util=require(_0xad61('0x6'));var path=require(_0xad61('0x7'));var sox=require(_0xad61('0x8'));var csv=require(_0xad61('0x9'));var ejs=require(_0xad61('0xa'));var fs=require('fs');var fs_extra=require(_0xad61('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xad61('0xc'));var jsforce=require(_0xad61('0xd'));var deskjs=require(_0xad61('0xe'));var toCsv=require(_0xad61('0x9'));var querystring=require(_0xad61('0xf'));var Papa=require(_0xad61('0x10'));var Redis=require(_0xad61('0x11'));var authService=require(_0xad61('0x12'));var qs=require(_0xad61('0x13'));var as=require(_0xad61('0x14'));var hardwareService=require(_0xad61('0x15'));var logger=require(_0xad61('0x16'))(_0xad61('0x17'));var utils=require(_0xad61('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xad61('0x19'));var db=require(_0xad61('0x1a'))['db'];function respondWithStatusCode(_0x1f9be5,_0x328012){_0x328012=_0x328012||0xcc;return function(_0x52252d){if(_0x52252d){return _0x1f9be5[_0xad61('0x1b')](_0x328012);}return _0x1f9be5[_0xad61('0x1c')](_0x328012)['end']();};}function respondWithResult(_0x4b5f53,_0x85a7b6){_0x85a7b6=_0x85a7b6||0xc8;return function(_0x1b20dd){if(_0x1b20dd){return _0x4b5f53[_0xad61('0x1c')](_0x85a7b6)['json'](_0x1b20dd);}};}function respondWithFilteredResult(_0x291b30,_0x1c62cc){return function(_0x4c1226){if(_0x4c1226){var _0x29827d=typeof _0x1c62cc[_0xad61('0x1d')]===_0xad61('0x1e')&&typeof _0x1c62cc[_0xad61('0x1f')]==='undefined';var _0x49b71f=_0x4c1226[_0xad61('0x20')];var _0x246291=_0x29827d?0x0:_0x1c62cc['offset'];var _0x300e61=_0x29827d?_0x4c1226['count']:_0x1c62cc[_0xad61('0x1d')]+_0x1c62cc[_0xad61('0x1f')];var _0x2db9f3;if(_0x300e61>=_0x49b71f){_0x300e61=_0x49b71f;_0x2db9f3=0xc8;}else{_0x2db9f3=0xce;}_0x291b30[_0xad61('0x1c')](_0x2db9f3);return _0x291b30['set']('Content-Range',_0x246291+'-'+_0x300e61+'/'+_0x49b71f)['json'](_0x4c1226);}return null;};}function patchUpdates(_0x55a9c2){return function(_0x1f7f37){try{jsonpatch[_0xad61('0x21')](_0x1f7f37,_0x55a9c2,!![]);}catch(_0x308cdd){return BPromise[_0xad61('0x22')](_0x308cdd);}return _0x1f7f37['save']();};}function saveUpdates(_0x2de11b,_0x5bba84){return function(_0x38f73f){if(_0x38f73f){return _0x38f73f['update'](_0x2de11b)[_0xad61('0x23')](function(_0x27f5eb){return _0x27f5eb;});}return null;};}function removeEntity(_0x50f11d,_0x31d3c5){return function(_0x281914){if(_0x281914){return _0x281914[_0xad61('0x24')]()[_0xad61('0x23')](function(){var _0x43feae=_0x281914[_0xad61('0x25')]({'plain':!![]});var _0x38fb78=_0xad61('0x26');return db['UserProfileResource'][_0xad61('0x24')]({'where':{'type':_0x38fb78,'resourceId':_0x43feae['id']}})['then'](function(){return _0x281914;});})[_0xad61('0x23')](function(){_0x50f11d[_0xad61('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4be9aa,_0x34f3be){return function(_0x164680){if(!_0x164680){_0x4be9aa[_0xad61('0x1b')](0x194);}return _0x164680;};}function handleError(_0x469dee,_0x4b6bc7){_0x4b6bc7=_0x4b6bc7||0x1f4;return function(_0x458c97){logger[_0xad61('0x27')](_0x458c97[_0xad61('0x28')]);if(_0x458c97[_0xad61('0x29')]){delete _0x458c97[_0xad61('0x29')];}_0x469dee[_0xad61('0x1c')](_0x4b6bc7)[_0xad61('0x2a')](_0x458c97);};}function getMustacheRender(_0x312bb7,_0x2c0d32){return Mustache[_0xad61('0x2b')](_0x312bb7,_[_0xad61('0x2c')](_0x2c0d32[_0xad61('0x2d')],{'contact':_0x2c0d32[_0xad61('0x2e')],'message':_0x2c0d32[_0xad61('0x2f')],'agent':_0x2c0d32['agent'],'interaction':_0x2c0d32['interaction'],'account':_0x2c0d32[_0xad61('0x30')]}))||'';}exports['index']=function(_0x1f0b80,_0x399376){var _0x3171f0={},_0x14d3a2={},_0x27213a={'count':0x0,'rows':[]};var _0xcef932=_['map'](db[_0xad61('0x31')]['rawAttributes'],function(_0x546090){return{'name':_0x546090[_0xad61('0x32')],'type':_0x546090[_0xad61('0x33')]['key']};});_0x14d3a2[_0xad61('0x34')]=_['map'](_0xcef932,_0xad61('0x29'));_0x14d3a2[_0xad61('0x35')]=_[_0xad61('0x36')](_0x1f0b80['query']);_0x14d3a2['filters']=_[_0xad61('0x37')](_0x14d3a2[_0xad61('0x34')],_0x14d3a2['query']);_0x3171f0[_0xad61('0x38')]=_[_0xad61('0x37')](_0x14d3a2[_0xad61('0x34')],qs[_0xad61('0x39')](_0x1f0b80[_0xad61('0x35')][_0xad61('0x39')]));_0x3171f0[_0xad61('0x38')]=_0x3171f0[_0xad61('0x38')][_0xad61('0x3a')]?_0x3171f0[_0xad61('0x38')]:_0x14d3a2[_0xad61('0x34')];if(!_0x1f0b80[_0xad61('0x35')]['hasOwnProperty'](_0xad61('0x3b'))){_0x3171f0[_0xad61('0x1f')]=qs[_0xad61('0x1f')](_0x1f0b80[_0xad61('0x35')]['limit']);_0x3171f0['offset']=qs['offset'](_0x1f0b80[_0xad61('0x35')][_0xad61('0x1d')]);}_0x3171f0[_0xad61('0x3c')]=qs[_0xad61('0x3d')](_0x1f0b80['query'][_0xad61('0x3d')]);_0x3171f0['where']=qs[_0xad61('0x3e')](_[_0xad61('0x3f')](_0x1f0b80['query'],_0x14d3a2[_0xad61('0x3e')]),_0xcef932);if(_0x1f0b80['query'][_0xad61('0x40')]){_0x3171f0['where']=_[_0xad61('0x2c')](_0x3171f0[_0xad61('0x41')],{'$or':_[_0xad61('0x42')](_0xcef932,function(_0x2873dd){if(_0x2873dd[_0xad61('0x33')]!==_0xad61('0x43')){var _0x24f7e1={};_0x24f7e1[_0x2873dd[_0xad61('0x29')]]={'$like':'%'+_0x1f0b80['query'][_0xad61('0x40')]+'%'};return _0x24f7e1;}})});}_0x3171f0=_['merge']({},_0x3171f0,_0x1f0b80[_0xad61('0x44')]);var _0x5edce7={'where':_0x3171f0[_0xad61('0x41')]};return db[_0xad61('0x31')][_0xad61('0x20')](_0x5edce7)[_0xad61('0x23')](function(_0x1227c9){_0x27213a['count']=_0x1227c9;if(_0x1f0b80[_0xad61('0x35')][_0xad61('0x45')]){_0x3171f0[_0xad61('0x46')]=[{'all':!![]}];}return db[_0xad61('0x31')][_0xad61('0x47')](_0x3171f0);})[_0xad61('0x23')](function(_0x475467){_0x27213a['rows']=_0x475467;return _0x27213a;})['then'](respondWithFilteredResult(_0x399376,_0x3171f0))[_0xad61('0x48')](handleError(_0x399376,null));};exports[_0xad61('0x49')]=function(_0x136c87,_0x5cc634){var _0x4985ae={'raw':!![],'where':{'id':_0x136c87[_0xad61('0x4a')]['id']}},_0x1ed1d2={};_0x1ed1d2[_0xad61('0x34')]=_[_0xad61('0x36')](db[_0xad61('0x31')]['rawAttributes']);_0x1ed1d2[_0xad61('0x35')]=_[_0xad61('0x36')](_0x136c87[_0xad61('0x35')]);_0x1ed1d2[_0xad61('0x3e')]=_[_0xad61('0x37')](_0x1ed1d2[_0xad61('0x34')],_0x1ed1d2[_0xad61('0x35')]);_0x4985ae[_0xad61('0x38')]=_[_0xad61('0x37')](_0x1ed1d2[_0xad61('0x34')],qs[_0xad61('0x39')](_0x136c87[_0xad61('0x35')][_0xad61('0x39')]));_0x4985ae[_0xad61('0x38')]=_0x4985ae[_0xad61('0x38')][_0xad61('0x3a')]?_0x4985ae[_0xad61('0x38')]:_0x1ed1d2[_0xad61('0x34')];if(_0x136c87[_0xad61('0x35')]['includeAll']){_0x4985ae['include']=[{'all':!![]}];}_0x4985ae=_[_0xad61('0x2c')]({},_0x4985ae,_0x136c87[_0xad61('0x44')]);return db[_0xad61('0x31')]['find'](_0x4985ae)[_0xad61('0x23')](handleEntityNotFound(_0x5cc634,null))[_0xad61('0x23')](respondWithResult(_0x5cc634,null))[_0xad61('0x48')](handleError(_0x5cc634,null));};exports['create']=function(_0x524b32,_0x3b3d94){return db[_0xad61('0x31')][_0xad61('0x4b')](_0x524b32[_0xad61('0x2d')],{})[_0xad61('0x23')](function(_0x384829){var _0x28cef4=_0x524b32[_0xad61('0x4c')][_0xad61('0x25')]({'plain':!![]});if(!_0x28cef4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28cef4[_0xad61('0x4d')]===_0xad61('0x4c')){var _0xadc6dc=_0x384829[_0xad61('0x25')]({'plain':!![]});var _0x25bb78=_0xad61('0x26');return db[_0xad61('0x4e')]['find']({'where':{'name':_0x25bb78,'userProfileId':_0x28cef4['userProfileId']},'raw':!![]})[_0xad61('0x23')](function(_0x418ddd){if(_0x418ddd&&_0x418ddd[_0xad61('0x4f')]===0x0){return db['UserProfileResource'][_0xad61('0x4b')]({'name':_0xadc6dc[_0xad61('0x29')],'resourceId':_0xadc6dc['id'],'type':_0x418ddd[_0xad61('0x29')],'sectionId':_0x418ddd['id']},{})[_0xad61('0x23')](function(){return _0x384829;});}else{return _0x384829;}})[_0xad61('0x48')](function(_0x4db023){logger[_0xad61('0x27')](_0xad61('0x50'),_0x4db023);throw _0x4db023;});}return _0x384829;})[_0xad61('0x23')](respondWithResult(_0x3b3d94,0xc9))['catch'](handleError(_0x3b3d94,null));};exports[_0xad61('0x51')]=function(_0x205200,_0x332676){if(_0x205200[_0xad61('0x2d')]['id']){delete _0x205200[_0xad61('0x2d')]['id'];}return db[_0xad61('0x31')]['find']({'where':{'id':_0x205200[_0xad61('0x4a')]['id']}})[_0xad61('0x23')](handleEntityNotFound(_0x332676,null))['then'](saveUpdates(_0x205200[_0xad61('0x2d')],null))[_0xad61('0x23')](respondWithResult(_0x332676,null))[_0xad61('0x48')](handleError(_0x332676,null));};exports[_0xad61('0x24')]=function(_0x3be9e0,_0x72e6c5){return db[_0xad61('0x31')]['find']({'where':{'id':_0x3be9e0[_0xad61('0x4a')]['id']}})[_0xad61('0x23')](handleEntityNotFound(_0x72e6c5,null))[_0xad61('0x23')](removeEntity(_0x72e6c5,null))[_0xad61('0x48')](handleError(_0x72e6c5,null));};exports['getMessages']=function(_0x3ccc47,_0x4d8aff,_0x4d056d){return db[_0xad61('0x31')]['findOne']({'where':{'id':_0x3ccc47[_0xad61('0x4a')]['id']}})[_0xad61('0x23')](handleEntityNotFound(_0x4d8aff,null))['then'](function(_0x3c005c){var _0x5178b5;var _0x315153={},_0x1f360d={};_0x1f360d[_0xad61('0x34')]=_[_0xad61('0x36')](db[_0xad61('0x52')][_0xad61('0x53')]);_0x1f360d['query']=_[_0xad61('0x36')](_0x3ccc47['query']);_0x1f360d[_0xad61('0x3e')]=_[_0xad61('0x37')](_0x1f360d['model'],_0x1f360d[_0xad61('0x35')]);_0x315153[_0xad61('0x38')]=_[_0xad61('0x37')](_0x1f360d[_0xad61('0x34')],qs[_0xad61('0x39')](_0x3ccc47[_0xad61('0x35')]['fields']));_0x315153['attributes']=_0x315153[_0xad61('0x38')][_0xad61('0x3a')]?_0x315153[_0xad61('0x38')]:_0x1f360d[_0xad61('0x34')];if(!_0x3ccc47[_0xad61('0x35')][_0xad61('0x54')](_0xad61('0x3b'))){_0x315153[_0xad61('0x1f')]=qs[_0xad61('0x1f')](_0x3ccc47[_0xad61('0x35')][_0xad61('0x1f')]);_0x315153[_0xad61('0x1d')]=qs[_0xad61('0x1d')](_0x3ccc47[_0xad61('0x35')][_0xad61('0x1d')]);}_0x315153[_0xad61('0x3c')]=qs[_0xad61('0x3d')](_0x3ccc47['query'][_0xad61('0x3d')]);_0x315153[_0xad61('0x41')]=qs[_0xad61('0x3e')](_[_0xad61('0x3f')](_0x3ccc47['query'],_0x1f360d[_0xad61('0x3e')]));if(_0x3ccc47[_0xad61('0x35')]['filter']){_0x315153[_0xad61('0x41')]=_[_0xad61('0x2c')](_0x315153[_0xad61('0x41')],{'$or':_[_0xad61('0x42')](_0x315153[_0xad61('0x38')],function(_0x4c379e){var _0x5bf389={};_0x5bf389[_0x4c379e]={'$like':'%'+_0x3ccc47[_0xad61('0x35')][_0xad61('0x40')]+'%'};return _0x5bf389;})});}_0x315153[_0xad61('0x41')]=_[_0xad61('0x2c')](_0x315153['where'],{'mailboxuser':_0x3c005c[_0xad61('0x55')]});_0x315153=_[_0xad61('0x2c')]({},_0x315153,_0x3ccc47['options']);return db['VoiceMailMessage'][_0xad61('0x56')](_0x315153)[_0xad61('0x23')](respondWithFilteredResult(_0x4d8aff,_0x315153));})[_0xad61('0x48')](handleError(_0x4d8aff,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 651beb9..d517e58 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 _0x5853=['request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','moment'];(function(_0x522581,_0x4ef9a0){var _0xd1c011=function(_0x3455bc){while(--_0x3455bc){_0x522581['push'](_0x522581['shift']());}};_0xd1c011(++_0x4ef9a0);}(_0x5853,0x113));var _0x3585=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x5853[_0x4c1ec2];return _0x3f6f1c;};'use strict';var _=require(_0x3585('0x0'));var util=require(_0x3585('0x1'));var logger=require(_0x3585('0x2'))(_0x3585('0x3'));var moment=require(_0x3585('0x4'));var BPromise=require('bluebird');var rp=require(_0x3585('0x5'));var fs=require('fs');var path=require(_0x3585('0x6'));var rimraf=require(_0x3585('0x7'));var config=require(_0x3585('0x8'));var attributes=require(_0x3585('0x9'));module[_0x3585('0xa')]=function(_0x561ebe,_0x2e895d){return _0x561ebe['define']('VoiceMail',attributes,{'tableName':_0x3585('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x3585('0xc'),_0x3585('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5aa8=['define','VoiceMail','mailbox_context','mailbox','context','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports'];(function(_0xc77d4b,_0x1154c5){var _0x41308e=function(_0x4d1840){while(--_0x4d1840){_0xc77d4b['push'](_0xc77d4b['shift']());}};_0x41308e(++_0x1154c5);}(_0x5aa8,0x155));var _0x85aa=function(_0x2f21ac,_0x258f70){_0x2f21ac=_0x2f21ac-0x0;var _0x24f453=_0x5aa8[_0x2f21ac];return _0x24f453;};'use strict';var _=require(_0x85aa('0x0'));var util=require(_0x85aa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x85aa('0x2'));var BPromise=require(_0x85aa('0x3'));var rp=require(_0x85aa('0x4'));var fs=require('fs');var path=require(_0x85aa('0x5'));var rimraf=require('rimraf');var config=require(_0x85aa('0x6'));var attributes=require(_0x85aa('0x7'));module[_0x85aa('0x8')]=function(_0x39c9bd,_0x269d42){return _0x39c9bd[_0x85aa('0x9')](_0x85aa('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x85aa('0xb'),'fields':[_0x85aa('0xc'),_0x85aa('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index ee92afe..e04c023 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 _0x6de8=['result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message','info','VoiceMail,\x20%s,\x20%s'];(function(_0x381e5f,_0x459b89){var _0x4d71dd=function(_0x260a2d){while(--_0x260a2d){_0x381e5f['push'](_0x381e5f['shift']());}};_0x4d71dd(++_0x459b89);}(_0x6de8,0x16a));var _0x86de=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x6de8[_0x45b034];return _0x509cb0;};'use strict';var _=require('lodash');var util=require(_0x86de('0x0'));var moment=require('moment');var BPromise=require(_0x86de('0x1'));var rs=require(_0x86de('0x2'));var fs=require('fs');var Redis=require(_0x86de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x86de('0x4'));var logger=require(_0x86de('0x5'))(_0x86de('0x6'));var config=require(_0x86de('0x7'));var jayson=require(_0x86de('0x8'));var client=jayson[_0x86de('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41088b,_0x40ab8b,_0x36a582){return new BPromise(function(_0x56f37f,_0x1b0576){return client[_0x86de('0xa')](_0x41088b,_0x36a582)['then'](function(_0x751f7d){logger['info']('VoiceMail,\x20%s,\x20%s',_0x40ab8b,_0x86de('0xb'));logger[_0x86de('0xc')](_0x86de('0xd'),_0x40ab8b,_0x86de('0xb'),JSON['stringify'](_0x751f7d));if(_0x751f7d[_0x86de('0xe')]){if(_0x751f7d[_0x86de('0xe')]['code']===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x40ab8b,_0x751f7d['error'][_0x86de('0xf')]);return _0x1b0576(_0x751f7d[_0x86de('0xe')][_0x86de('0xf')]);}logger[_0x86de('0xe')]('VoiceMail,\x20%s,\x20%s',_0x40ab8b,_0x751f7d['error']['message']);return _0x56f37f(_0x751f7d[_0x86de('0xe')][_0x86de('0xf')]);}else{logger[_0x86de('0x10')](_0x86de('0x11'),_0x40ab8b,_0x86de('0xb'));_0x56f37f(_0x751f7d[_0x86de('0x12')][_0x86de('0xf')]);}})['catch'](function(_0x4e4391){logger[_0x86de('0xe')]('VoiceMail,\x20%s,\x20%s',_0x40ab8b,_0x4e4391);_0x1b0576(_0x4e4391);});});} \ No newline at end of file +var _0xc6cd=['VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceMail,\x20%s,\x20%s','debug'];(function(_0x536c07,_0x5c4c1a){var _0x5dd8e4=function(_0x44b010){while(--_0x44b010){_0x536c07['push'](_0x536c07['shift']());}};_0x5dd8e4(++_0x5c4c1a);}(_0xc6cd,0x18f));var _0xdc6c=function(_0x1fadb8,_0x3b8422){_0x1fadb8=_0x1fadb8-0x0;var _0x5676f7=_0xc6cd[_0x1fadb8];return _0x5676f7;};'use strict';var _=require('lodash');var util=require(_0xdc6c('0x0'));var moment=require(_0xdc6c('0x1'));var BPromise=require(_0xdc6c('0x2'));var rs=require(_0xdc6c('0x3'));var fs=require('fs');var Redis=require(_0xdc6c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc6c('0x5'));var logger=require(_0xdc6c('0x6'))(_0xdc6c('0x7'));var config=require(_0xdc6c('0x8'));var jayson=require(_0xdc6c('0x9'));var client=jayson[_0xdc6c('0xa')][_0xdc6c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb8f96a,_0x100479,_0x204f35){return new BPromise(function(_0x4cdbbb,_0x500008){return client['request'](_0xb8f96a,_0x204f35)['then'](function(_0x2f53a0){logger[_0xdc6c('0xc')](_0xdc6c('0xd'),_0x100479,'request\x20sent');logger[_0xdc6c('0xe')](_0xdc6c('0xf'),_0x100479,_0xdc6c('0x10'),JSON[_0xdc6c('0x11')](_0x2f53a0));if(_0x2f53a0[_0xdc6c('0x12')]){if(_0x2f53a0[_0xdc6c('0x12')][_0xdc6c('0x13')]===0x1f4){logger[_0xdc6c('0x12')](_0xdc6c('0xd'),_0x100479,_0x2f53a0[_0xdc6c('0x12')][_0xdc6c('0x14')]);return _0x500008(_0x2f53a0[_0xdc6c('0x12')][_0xdc6c('0x14')]);}logger['error'](_0xdc6c('0xd'),_0x100479,_0x2f53a0[_0xdc6c('0x12')][_0xdc6c('0x14')]);return _0x4cdbbb(_0x2f53a0[_0xdc6c('0x12')][_0xdc6c('0x14')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x100479,'request\x20sent');_0x4cdbbb(_0x2f53a0[_0xdc6c('0x15')][_0xdc6c('0x14')]);}})[_0xdc6c('0x16')](function(_0x17b6d2){logger['error'](_0xdc6c('0xd'),_0x100479,_0x17b6d2);_0x500008(_0x17b6d2);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9a0f694..1d981a6 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 _0x463e=['show','/:id/download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','isAuthenticated'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x463e,0x1d6));var _0xe463=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x463e[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0xe463('0x0'));var util=require(_0xe463('0x1'));var path=require(_0xe463('0x2'));var timeout=require(_0xe463('0x3'));var express=require(_0xe463('0x4'));var router=express[_0xe463('0x5')]();var fs_extra=require(_0xe463('0x6'));var auth=require(_0xe463('0x7'));var interaction=require(_0xe463('0x8'));var config=require(_0xe463('0x9'));var controller=require(_0xe463('0xa'));router[_0xe463('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe463('0xc'),auth[_0xe463('0xd')](),controller[_0xe463('0xe')]);router[_0xe463('0xb')](_0xe463('0xf'),auth[_0xe463('0xd')](),controller['download']);router[_0xe463('0x10')]('/',auth['isAuthenticated'](),controller[_0xe463('0x11')]);router[_0xe463('0x12')](_0xe463('0xc'),auth[_0xe463('0xd')](),controller[_0xe463('0x13')]);router[_0xe463('0x14')](_0xe463('0xc'),auth[_0xe463('0xd')](),controller[_0xe463('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8cd9=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','post','put','update'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x8cd9,0x112));var _0x98cd=function(_0x2e2090,_0x25e14c){_0x2e2090=_0x2e2090-0x0;var _0x206217=_0x8cd9[_0x2e2090];return _0x206217;};'use strict';var multer=require(_0x98cd('0x0'));var util=require(_0x98cd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98cd('0x2'));var router=express[_0x98cd('0x3')]();var fs_extra=require(_0x98cd('0x4'));var auth=require(_0x98cd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x98cd('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x98cd('0x7')]('/',auth[_0x98cd('0x8')](),controller[_0x98cd('0x9')]);router[_0x98cd('0x7')](_0x98cd('0xa'),auth[_0x98cd('0x8')](),controller['show']);router[_0x98cd('0x7')](_0x98cd('0xb'),auth[_0x98cd('0x8')](),controller['download']);router[_0x98cd('0xc')]('/',auth[_0x98cd('0x8')](),controller['create']);router[_0x98cd('0xd')](_0x98cd('0xa'),auth[_0x98cd('0x8')](),controller[_0x98cd('0xe')]);router['delete']('/:id',auth[_0x98cd('0x8')](),controller[_0x98cd('0xf')]);module[_0x98cd('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9399fd7..76cb741 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 _0x72e4=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x72e4,0x1e8));var _0x472e=function(_0x45ce98,_0x33af4c){_0x45ce98=_0x45ce98-0x0;var _0x3c24d3=_0x72e4[_0x45ce98];return _0x3c24d3;};'use strict';var Sequelize=require(_0x472e('0x0'));module[_0x472e('0x1')]={'name':{'type':Sequelize[_0x472e('0x2')],'get':function(_0x564d44){return this[_0x472e('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x472e('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x472e('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x472e('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x472e('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x472e('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x472e('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x472e('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x472e('0x6')](_0x472e('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x472e('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x472e('0x5')],'defaultValue':''},'stamp':{'type':_0x472e('0x8'),'defaultValue':Sequelize[_0x472e('0x9')](_0x472e('0xa'))}}; \ No newline at end of file +var _0x045f=['STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x41dd6b,_0x5ae4ba){var _0x156c5a=function(_0x130aea){while(--_0x130aea){_0x41dd6b['push'](_0x41dd6b['shift']());}};_0x156c5a(++_0x5ae4ba);}(_0x045f,0x1a9));var _0xf045=function(_0x49f8a3,_0x58c321){_0x49f8a3=_0x49f8a3-0x0;var _0x4a6a17=_0x045f[_0x49f8a3];return _0x4a6a17;};'use strict';var Sequelize=require(_0xf045('0x0'));module[_0xf045('0x1')]={'name':{'type':Sequelize[_0xf045('0x2')],'get':function(_0x50bd84){return this[_0xf045('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xf045('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xf045('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf045('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xf045('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xf045('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf045('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf045('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xf045('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf045('0x5')],'defaultValue':''},'stamp':{'type':_0xf045('0x7'),'defaultValue':Sequelize[_0xf045('0x8')](_0xf045('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index acd7682..c6102a8 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 _0x1224=['request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','send','merge','body','contact','message','interaction','index','map','rawAttributes','type','key','model','differenceBy','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','options','VoiceMailMessage','include','findAll','rows','catch','show','params','keys','fields','find','create','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4f2bf2,_0x387ecd){var _0x447db=function(_0x269025){while(--_0x269025){_0x4f2bf2['push'](_0x4f2bf2['shift']());}};_0x447db(++_0x387ecd);}(_0x1224,0x10d));var _0x4122=function(_0x26d492,_0x4e9f12){_0x26d492=_0x26d492-0x0;var _0x189f2c=_0x1224[_0x26d492];return _0x189f2c;};'use strict';var emlformat=require(_0x4122('0x0'));var rimraf=require(_0x4122('0x1'));var zipdir=require(_0x4122('0x2'));var jsonpatch=require(_0x4122('0x3'));var rp=require(_0x4122('0x4'));var moment=require(_0x4122('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4122('0x6'));var util=require(_0x4122('0x7'));var path=require(_0x4122('0x8'));var sox=require('sox');var csv=require(_0x4122('0x9'));var ejs=require(_0x4122('0xa'));var fs=require('fs');var fs_extra=require(_0x4122('0xb'));var _=require(_0x4122('0xc'));var squel=require(_0x4122('0xd'));var crypto=require(_0x4122('0xe'));var jsforce=require(_0x4122('0xf'));var deskjs=require(_0x4122('0x10'));var toCsv=require(_0x4122('0x9'));var querystring=require(_0x4122('0x11'));var Papa=require(_0x4122('0x12'));var Redis=require(_0x4122('0x13'));var authService=require(_0x4122('0x14'));var qs=require(_0x4122('0x15'));var as=require(_0x4122('0x16'));var hardwareService=require(_0x4122('0x17'));var logger=require(_0x4122('0x18'))(_0x4122('0x19'));var utils=require(_0x4122('0x1a'));var config=require(_0x4122('0x1b'));var licenseUtil=require(_0x4122('0x1c'));var db=require(_0x4122('0x1d'))['db'];function respondWithStatusCode(_0x440ff0,_0x8d4876){_0x8d4876=_0x8d4876||0xcc;return function(_0xe213d){if(_0xe213d){return _0x440ff0[_0x4122('0x1e')](_0x8d4876);}return _0x440ff0[_0x4122('0x1f')](_0x8d4876)[_0x4122('0x20')]();};}function respondWithResult(_0x421ee3,_0x1a701e){_0x1a701e=_0x1a701e||0xc8;return function(_0x3a88fe){if(_0x3a88fe){return _0x421ee3['status'](_0x1a701e)[_0x4122('0x21')](_0x3a88fe);}};}function respondWithFilteredResult(_0x3c674e,_0x192e77){return function(_0x359909){if(_0x359909){var _0x520300=typeof _0x192e77[_0x4122('0x22')]===_0x4122('0x23')&&typeof _0x192e77['limit']===_0x4122('0x23');var _0x3ec4d3=_0x359909[_0x4122('0x24')];var _0x4636ae=_0x520300?0x0:_0x192e77[_0x4122('0x22')];var _0x42374d=_0x520300?_0x359909[_0x4122('0x24')]:_0x192e77['offset']+_0x192e77['limit'];var _0x586105;if(_0x42374d>=_0x3ec4d3){_0x42374d=_0x3ec4d3;_0x586105=0xc8;}else{_0x586105=0xce;}_0x3c674e[_0x4122('0x1f')](_0x586105);return _0x3c674e[_0x4122('0x25')](_0x4122('0x26'),_0x4636ae+'-'+_0x42374d+'/'+_0x3ec4d3)[_0x4122('0x21')](_0x359909);}return null;};}function patchUpdates(_0xef6995){return function(_0xb0a7d){try{jsonpatch[_0x4122('0x27')](_0xb0a7d,_0xef6995,!![]);}catch(_0x46b24e){return BPromise['reject'](_0x46b24e);}return _0xb0a7d[_0x4122('0x28')]();};}function saveUpdates(_0x50e243,_0x4f949a){return function(_0x508cd7){if(_0x508cd7){return _0x508cd7[_0x4122('0x29')](_0x50e243)[_0x4122('0x2a')](function(_0x317418){return _0x317418;});}return null;};}function removeEntity(_0x4eb35b,_0x128fde){return function(_0x386cdc){if(_0x386cdc){return _0x386cdc['destroy']()['then'](function(){_0x4eb35b[_0x4122('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4db23e,_0x59895d){return function(_0x1b449b){if(!_0x1b449b){_0x4db23e[_0x4122('0x1e')](0x194);}return _0x1b449b;};}function handleError(_0xbb76e1,_0x1bb51b){_0x1bb51b=_0x1bb51b||0x1f4;return function(_0x31568f){logger[_0x4122('0x2b')](_0x31568f[_0x4122('0x2c')]);if(_0x31568f[_0x4122('0x2d')]){delete _0x31568f[_0x4122('0x2d')];}_0xbb76e1[_0x4122('0x1f')](_0x1bb51b)[_0x4122('0x2e')](_0x31568f);};}function getMustacheRender(_0x419275,_0xfefaf6){return Mustache['render'](_0x419275,_[_0x4122('0x2f')](_0xfefaf6[_0x4122('0x30')],{'contact':_0xfefaf6[_0x4122('0x31')],'message':_0xfefaf6[_0x4122('0x32')],'agent':_0xfefaf6['agent'],'interaction':_0xfefaf6[_0x4122('0x33')],'account':_0xfefaf6['account']}))||'';}exports[_0x4122('0x34')]=function(_0x431430,_0x3a9633){var _0xd8634b={},_0x443ec4={},_0x308cda={'count':0x0,'rows':[]};var _0xb98ce8=_[_0x4122('0x35')](db['VoiceMailMessage'][_0x4122('0x36')],function(_0x11c2a2){return{'name':_0x11c2a2['fieldName'],'type':_0x11c2a2[_0x4122('0x37')][_0x4122('0x38')]};});_0x443ec4[_0x4122('0x39')]=_[_0x4122('0x3a')](_['map'](_0xb98ce8,_0x4122('0x2d')),[_0x4122('0x2d')]);_0x443ec4['query']=_['keys'](_0x431430[_0x4122('0x3b')]);_0x443ec4['filters']=_[_0x4122('0x3c')](_0x443ec4[_0x4122('0x39')],_0x443ec4['query']);_0xd8634b[_0x4122('0x3d')]=_[_0x4122('0x3c')](_0x443ec4[_0x4122('0x39')],qs['fields'](_0x431430[_0x4122('0x3b')]['fields']));_0xd8634b[_0x4122('0x3d')]=_0xd8634b[_0x4122('0x3d')][_0x4122('0x3e')]?_0xd8634b['attributes']:_0x443ec4[_0x4122('0x39')];if(!_0x431430['query'][_0x4122('0x3f')](_0x4122('0x40'))){_0xd8634b['limit']=qs['limit'](_0x431430['query'][_0x4122('0x41')]);_0xd8634b['offset']=qs[_0x4122('0x22')](_0x431430[_0x4122('0x3b')][_0x4122('0x22')]);}_0xd8634b[_0x4122('0x42')]=qs[_0x4122('0x43')](_0x431430['query']['sort']);_0xd8634b[_0x4122('0x44')]=qs['filters'](_[_0x4122('0x45')](_0x431430['query'],_0x443ec4[_0x4122('0x46')]),_0xb98ce8);if(_0x431430[_0x4122('0x3b')]['filter']){_0xd8634b[_0x4122('0x44')]=_[_0x4122('0x2f')](_0xd8634b[_0x4122('0x44')],{'$or':_[_0x4122('0x35')](_0xb98ce8,function(_0x6ce0aa){if(_0x6ce0aa[_0x4122('0x37')]!=='VIRTUAL'){var _0x3944c1={};_0x3944c1[_0x6ce0aa['name']]={'$like':'%'+_0x431430[_0x4122('0x3b')]['filter']+'%'};return _0x3944c1;}})});}_0xd8634b=_[_0x4122('0x2f')]({},_0xd8634b,_0x431430[_0x4122('0x47')]);var _0x3bfa95={'where':_0xd8634b[_0x4122('0x44')]};return db[_0x4122('0x48')]['count'](_0x3bfa95)[_0x4122('0x2a')](function(_0x30c3dc){_0x308cda['count']=_0x30c3dc;if(_0x431430['query']['includeAll']){_0xd8634b[_0x4122('0x49')]=[{'all':!![]}];}return db[_0x4122('0x48')][_0x4122('0x4a')](_0xd8634b);})[_0x4122('0x2a')](function(_0x164499){_0x308cda[_0x4122('0x4b')]=_0x164499;return _0x308cda;})[_0x4122('0x2a')](respondWithFilteredResult(_0x3a9633,_0xd8634b))[_0x4122('0x4c')](handleError(_0x3a9633,null));};exports[_0x4122('0x4d')]=function(_0x5ecbe2,_0x2ab287){var _0x4c6578={'raw':!![],'where':{'id':_0x5ecbe2[_0x4122('0x4e')]['id']}},_0x58b686={};_0x58b686[_0x4122('0x39')]=_[_0x4122('0x4f')](db['VoiceMailMessage'][_0x4122('0x36')]);_0x58b686[_0x4122('0x3b')]=_['keys'](_0x5ecbe2[_0x4122('0x3b')]);_0x58b686[_0x4122('0x46')]=_[_0x4122('0x3c')](_0x58b686[_0x4122('0x39')],_0x58b686['query']);_0x4c6578[_0x4122('0x3d')]=_[_0x4122('0x3c')](_0x58b686[_0x4122('0x39')],qs[_0x4122('0x50')](_0x5ecbe2[_0x4122('0x3b')]['fields']));_0x4c6578['attributes']=_0x4c6578[_0x4122('0x3d')][_0x4122('0x3e')]?_0x4c6578[_0x4122('0x3d')]:_0x58b686[_0x4122('0x39')];if(_0x5ecbe2[_0x4122('0x3b')]['includeAll']){_0x4c6578[_0x4122('0x49')]=[{'all':!![]}];}_0x4c6578=_[_0x4122('0x2f')]({},_0x4c6578,_0x5ecbe2[_0x4122('0x47')]);return db['VoiceMailMessage'][_0x4122('0x51')](_0x4c6578)['then'](handleEntityNotFound(_0x2ab287,null))[_0x4122('0x2a')](respondWithResult(_0x2ab287,null))[_0x4122('0x4c')](handleError(_0x2ab287,null));};exports[_0x4122('0x52')]=function(_0x3e59ab,_0x5db776){return db['VoiceMailMessage'][_0x4122('0x52')](_0x3e59ab[_0x4122('0x30')],{})[_0x4122('0x2a')](respondWithResult(_0x5db776,0xc9))[_0x4122('0x4c')](handleError(_0x5db776,null));};exports['update']=function(_0x2b03b4,_0x5678ff){if(_0x2b03b4[_0x4122('0x30')]['id']){delete _0x2b03b4['body']['id'];}return db[_0x4122('0x48')][_0x4122('0x51')]({'where':{'id':_0x2b03b4[_0x4122('0x4e')]['id']}})[_0x4122('0x2a')](handleEntityNotFound(_0x5678ff,null))[_0x4122('0x2a')](saveUpdates(_0x2b03b4[_0x4122('0x30')],null))['then'](respondWithResult(_0x5678ff,null))[_0x4122('0x4c')](handleError(_0x5678ff,null));};exports['destroy']=function(_0x167805,_0x16a503){return db[_0x4122('0x48')][_0x4122('0x51')]({'where':{'id':_0x167805[_0x4122('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16a503,null))[_0x4122('0x2a')](removeEntity(_0x16a503,null))[_0x4122('0x4c')](handleError(_0x16a503,null));};exports[_0x4122('0x53')]=function(_0x2cdb41,_0x564e91,_0x1839f8){return db['VoiceMailMessage'][_0x4122('0x51')]({'where':{'id':_0x2cdb41[_0x4122('0x4e')]['id']},'attributes':['id',_0x4122('0x54'),_0x4122('0x55')]})[_0x4122('0x2a')](handleEntityNotFound(_0x564e91,null))[_0x4122('0x2a')](function(_0x41eba0){if(_0x41eba0){if(!_0x41eba0[_0x4122('0x54')]){throw new db[(_0x4122('0x56'))]['ValidationError'](_0x4122('0x57'));}var _0x1afd1c={'Content-Type':_0x4122('0x58'),'Content-Disposition':'attachment'};if(_0x41eba0['msg_id']){_0x1afd1c['Content-Disposition']=_0x4122('0x59')+_0x41eba0[_0x4122('0x55')]+_0x4122('0x5a');}_0x564e91['set'](_0x1afd1c);return _0x564e91[_0x4122('0x2e')](new Buffer(_0x41eba0[_0x4122('0x54')]));}})[_0x4122('0x4c')](handleError(_0x564e91,null));}; \ No newline at end of file +var _0xe469=['model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','catch','create','update','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','destroy','then','error','name','send','render','merge','body','contact','message','agent','account','index','map','VoiceMailMessage','fieldName','type','key','keys','query','intersection'];(function(_0x411d8c,_0x22d9ff){var _0x34f6e5=function(_0x3bfa94){while(--_0x3bfa94){_0x411d8c['push'](_0x411d8c['shift']());}};_0x34f6e5(++_0x22d9ff);}(_0xe469,0x1d6));var _0x9e46=function(_0x52a9a8,_0x4c68b4){_0x52a9a8=_0x52a9a8-0x0;var _0xb139cc=_0xe469[_0x52a9a8];return _0xb139cc;};'use strict';var emlformat=require(_0x9e46('0x0'));var rimraf=require(_0x9e46('0x1'));var zipdir=require(_0x9e46('0x2'));var jsonpatch=require(_0x9e46('0x3'));var rp=require(_0x9e46('0x4'));var moment=require(_0x9e46('0x5'));var BPromise=require(_0x9e46('0x6'));var Mustache=require(_0x9e46('0x7'));var util=require('util');var path=require(_0x9e46('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e46('0x9'));var _=require(_0x9e46('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9e46('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9e46('0xc'));var querystring=require(_0x9e46('0xd'));var Papa=require(_0x9e46('0xe'));var Redis=require(_0x9e46('0xf'));var authService=require(_0x9e46('0x10'));var qs=require(_0x9e46('0x11'));var as=require(_0x9e46('0x12'));var hardwareService=require(_0x9e46('0x13'));var logger=require(_0x9e46('0x14'))(_0x9e46('0x15'));var utils=require(_0x9e46('0x16'));var config=require(_0x9e46('0x17'));var licenseUtil=require(_0x9e46('0x18'));var db=require(_0x9e46('0x19'))['db'];function respondWithStatusCode(_0x18411f,_0x1a67a0){_0x1a67a0=_0x1a67a0||0xcc;return function(_0x2d13e6){if(_0x2d13e6){return _0x18411f[_0x9e46('0x1a')](_0x1a67a0);}return _0x18411f[_0x9e46('0x1b')](_0x1a67a0)[_0x9e46('0x1c')]();};}function respondWithResult(_0x36429b,_0x3f0026){_0x3f0026=_0x3f0026||0xc8;return function(_0x40ad78){if(_0x40ad78){return _0x36429b[_0x9e46('0x1b')](_0x3f0026)['json'](_0x40ad78);}};}function respondWithFilteredResult(_0x326fde,_0x437ce8){return function(_0x2c14cd){if(_0x2c14cd){var _0x4e47f6=typeof _0x437ce8[_0x9e46('0x1d')]===_0x9e46('0x1e')&&typeof _0x437ce8[_0x9e46('0x1f')]===_0x9e46('0x1e');var _0xe4110a=_0x2c14cd[_0x9e46('0x20')];var _0x1fe5fa=_0x4e47f6?0x0:_0x437ce8[_0x9e46('0x1d')];var _0x428b1e=_0x4e47f6?_0x2c14cd[_0x9e46('0x20')]:_0x437ce8[_0x9e46('0x1d')]+_0x437ce8[_0x9e46('0x1f')];var _0x592c2e;if(_0x428b1e>=_0xe4110a){_0x428b1e=_0xe4110a;_0x592c2e=0xc8;}else{_0x592c2e=0xce;}_0x326fde[_0x9e46('0x1b')](_0x592c2e);return _0x326fde[_0x9e46('0x21')](_0x9e46('0x22'),_0x1fe5fa+'-'+_0x428b1e+'/'+_0xe4110a)[_0x9e46('0x23')](_0x2c14cd);}return null;};}function patchUpdates(_0x582257){return function(_0x531d55){try{jsonpatch[_0x9e46('0x24')](_0x531d55,_0x582257,!![]);}catch(_0x3f5057){return BPromise['reject'](_0x3f5057);}return _0x531d55['save']();};}function saveUpdates(_0x143a86,_0xfbb3de){return function(_0x34804a){if(_0x34804a){return _0x34804a['update'](_0x143a86)['then'](function(_0x43bcdf){return _0x43bcdf;});}return null;};}function removeEntity(_0x5c704d,_0x272e43){return function(_0xb58745){if(_0xb58745){return _0xb58745[_0x9e46('0x25')]()[_0x9e46('0x26')](function(){_0x5c704d[_0x9e46('0x1b')](0xcc)[_0x9e46('0x1c')]();});}};}function handleEntityNotFound(_0x52304c,_0x5d19be){return function(_0x421e26){if(!_0x421e26){_0x52304c[_0x9e46('0x1a')](0x194);}return _0x421e26;};}function handleError(_0x59dc57,_0x41eea3){_0x41eea3=_0x41eea3||0x1f4;return function(_0x4b70b7){logger[_0x9e46('0x27')](_0x4b70b7['stack']);if(_0x4b70b7['name']){delete _0x4b70b7[_0x9e46('0x28')];}_0x59dc57['status'](_0x41eea3)[_0x9e46('0x29')](_0x4b70b7);};}function getMustacheRender(_0x57a677,_0x21a5a8){return Mustache[_0x9e46('0x2a')](_0x57a677,_[_0x9e46('0x2b')](_0x21a5a8[_0x9e46('0x2c')],{'contact':_0x21a5a8[_0x9e46('0x2d')],'message':_0x21a5a8[_0x9e46('0x2e')],'agent':_0x21a5a8[_0x9e46('0x2f')],'interaction':_0x21a5a8['interaction'],'account':_0x21a5a8[_0x9e46('0x30')]}))||'';}exports[_0x9e46('0x31')]=function(_0x4a64c2,_0xdf0424){var _0x1aeb03={},_0x1f04a6={},_0x3e3f19={'count':0x0,'rows':[]};var _0x25fbb0=_[_0x9e46('0x32')](db[_0x9e46('0x33')]['rawAttributes'],function(_0x3066b6){return{'name':_0x3066b6[_0x9e46('0x34')],'type':_0x3066b6[_0x9e46('0x35')][_0x9e46('0x36')]};});_0x1f04a6['model']=_['differenceBy'](_['map'](_0x25fbb0,_0x9e46('0x28')),[_0x9e46('0x28')]);_0x1f04a6['query']=_[_0x9e46('0x37')](_0x4a64c2[_0x9e46('0x38')]);_0x1f04a6['filters']=_[_0x9e46('0x39')](_0x1f04a6[_0x9e46('0x3a')],_0x1f04a6[_0x9e46('0x38')]);_0x1aeb03['attributes']=_['intersection'](_0x1f04a6[_0x9e46('0x3a')],qs[_0x9e46('0x3b')](_0x4a64c2['query'][_0x9e46('0x3b')]));_0x1aeb03[_0x9e46('0x3c')]=_0x1aeb03[_0x9e46('0x3c')]['length']?_0x1aeb03[_0x9e46('0x3c')]:_0x1f04a6[_0x9e46('0x3a')];if(!_0x4a64c2[_0x9e46('0x38')][_0x9e46('0x3d')](_0x9e46('0x3e'))){_0x1aeb03['limit']=qs[_0x9e46('0x1f')](_0x4a64c2['query']['limit']);_0x1aeb03[_0x9e46('0x1d')]=qs['offset'](_0x4a64c2[_0x9e46('0x38')]['offset']);}_0x1aeb03[_0x9e46('0x3f')]=qs[_0x9e46('0x40')](_0x4a64c2['query'][_0x9e46('0x40')]);_0x1aeb03[_0x9e46('0x41')]=qs['filters'](_[_0x9e46('0x42')](_0x4a64c2[_0x9e46('0x38')],_0x1f04a6[_0x9e46('0x43')]),_0x25fbb0);if(_0x4a64c2[_0x9e46('0x38')][_0x9e46('0x44')]){_0x1aeb03[_0x9e46('0x41')]=_[_0x9e46('0x2b')](_0x1aeb03[_0x9e46('0x41')],{'$or':_[_0x9e46('0x32')](_0x25fbb0,function(_0x214b5d){if(_0x214b5d['type']!==_0x9e46('0x45')){var _0x48afbe={};_0x48afbe[_0x214b5d[_0x9e46('0x28')]]={'$like':'%'+_0x4a64c2[_0x9e46('0x38')][_0x9e46('0x44')]+'%'};return _0x48afbe;}})});}_0x1aeb03=_[_0x9e46('0x2b')]({},_0x1aeb03,_0x4a64c2[_0x9e46('0x46')]);var _0x324051={'where':_0x1aeb03[_0x9e46('0x41')]};return db[_0x9e46('0x33')]['count'](_0x324051)[_0x9e46('0x26')](function(_0x503209){_0x3e3f19[_0x9e46('0x20')]=_0x503209;if(_0x4a64c2[_0x9e46('0x38')][_0x9e46('0x47')]){_0x1aeb03[_0x9e46('0x48')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x9e46('0x49')](_0x1aeb03);})[_0x9e46('0x26')](function(_0x4d47a7){_0x3e3f19[_0x9e46('0x4a')]=_0x4d47a7;return _0x3e3f19;})['then'](respondWithFilteredResult(_0xdf0424,_0x1aeb03))['catch'](handleError(_0xdf0424,null));};exports['show']=function(_0x4a4739,_0x5d13ca){var _0x205e4d={'raw':!![],'where':{'id':_0x4a4739[_0x9e46('0x4b')]['id']}},_0x4310c3={};_0x4310c3[_0x9e46('0x3a')]=_[_0x9e46('0x37')](db[_0x9e46('0x33')]['rawAttributes']);_0x4310c3[_0x9e46('0x38')]=_[_0x9e46('0x37')](_0x4a4739[_0x9e46('0x38')]);_0x4310c3[_0x9e46('0x43')]=_[_0x9e46('0x39')](_0x4310c3['model'],_0x4310c3['query']);_0x205e4d[_0x9e46('0x3c')]=_[_0x9e46('0x39')](_0x4310c3[_0x9e46('0x3a')],qs[_0x9e46('0x3b')](_0x4a4739[_0x9e46('0x38')][_0x9e46('0x3b')]));_0x205e4d['attributes']=_0x205e4d[_0x9e46('0x3c')][_0x9e46('0x4c')]?_0x205e4d[_0x9e46('0x3c')]:_0x4310c3['model'];if(_0x4a4739[_0x9e46('0x38')]['includeAll']){_0x205e4d[_0x9e46('0x48')]=[{'all':!![]}];}_0x205e4d=_[_0x9e46('0x2b')]({},_0x205e4d,_0x4a4739[_0x9e46('0x46')]);return db[_0x9e46('0x33')][_0x9e46('0x4d')](_0x205e4d)[_0x9e46('0x26')](handleEntityNotFound(_0x5d13ca,null))['then'](respondWithResult(_0x5d13ca,null))[_0x9e46('0x4e')](handleError(_0x5d13ca,null));};exports[_0x9e46('0x4f')]=function(_0x59a9f9,_0x4effb4){return db['VoiceMailMessage']['create'](_0x59a9f9['body'],{})[_0x9e46('0x26')](respondWithResult(_0x4effb4,0xc9))[_0x9e46('0x4e')](handleError(_0x4effb4,null));};exports[_0x9e46('0x50')]=function(_0xd189ec,_0x2ca9bd){if(_0xd189ec['body']['id']){delete _0xd189ec[_0x9e46('0x2c')]['id'];}return db['VoiceMailMessage'][_0x9e46('0x4d')]({'where':{'id':_0xd189ec['params']['id']}})[_0x9e46('0x26')](handleEntityNotFound(_0x2ca9bd,null))[_0x9e46('0x26')](saveUpdates(_0xd189ec[_0x9e46('0x2c')],null))['then'](respondWithResult(_0x2ca9bd,null))[_0x9e46('0x4e')](handleError(_0x2ca9bd,null));};exports[_0x9e46('0x25')]=function(_0xcbbe35,_0xcb98b){return db[_0x9e46('0x33')][_0x9e46('0x4d')]({'where':{'id':_0xcbbe35[_0x9e46('0x4b')]['id']}})[_0x9e46('0x26')](handleEntityNotFound(_0xcb98b,null))[_0x9e46('0x26')](removeEntity(_0xcb98b,null))[_0x9e46('0x4e')](handleError(_0xcb98b,null));};exports['download']=function(_0x388268,_0x3c3788,_0x11a5c4){return db['VoiceMailMessage'][_0x9e46('0x4d')]({'where':{'id':_0x388268[_0x9e46('0x4b')]['id']},'attributes':['id',_0x9e46('0x51'),_0x9e46('0x52')]})['then'](handleEntityNotFound(_0x3c3788,null))['then'](function(_0x3a7e6b){if(_0x3a7e6b){if(!_0x3a7e6b['recording']){throw new db[(_0x9e46('0x53'))]['ValidationError'](_0x9e46('0x54'));}var _0x54d2e4={'Content-Type':_0x9e46('0x55'),'Content-Disposition':_0x9e46('0x56')};if(_0x3a7e6b[_0x9e46('0x52')]){_0x54d2e4[_0x9e46('0x57')]='attachment;\x20filename=\x22'+_0x3a7e6b['msg_id']+'.wav\x22';}_0x3c3788[_0x9e46('0x21')](_0x54d2e4);return _0x3c3788[_0x9e46('0x29')](new Buffer(_0x3a7e6b['recording']));}})['catch'](handleError(_0x3c3788,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 94e722c..84f734b 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 _0xa5d2=['bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','dir','lodash','../../config/logger','api','moment'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xa5d2,0x164));var _0x2a5d=function(_0x3aafb3,_0x5f044d){_0x3aafb3=_0x3aafb3-0x0;var _0x1bcc7d=_0xa5d2[_0x3aafb3];return _0x1bcc7d;};'use strict';var _=require(_0x2a5d('0x0'));var util=require('util');var logger=require(_0x2a5d('0x1'))(_0x2a5d('0x2'));var moment=require(_0x2a5d('0x3'));var BPromise=require(_0x2a5d('0x4'));var rp=require(_0x2a5d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a5d('0x6'));var config=require(_0x2a5d('0x7'));var attributes=require(_0x2a5d('0x8'));module['exports']=function(_0x52614d,_0x45932c){return _0x52614d[_0x2a5d('0x9')](_0x2a5d('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x2a5d('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x3469=['voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','path','./voiceMailMessage.attributes','VoiceMailMessage'];(function(_0x4ec3e0,_0x34fbed){var _0x27b93e=function(_0x443ea5){while(--_0x443ea5){_0x4ec3e0['push'](_0x4ec3e0['shift']());}};_0x27b93e(++_0x34fbed);}(_0x3469,0x16a));var _0x9346=function(_0x2c4e71,_0x19ad8b){_0x2c4e71=_0x2c4e71-0x0;var _0x5528c3=_0x3469[_0x2c4e71];return _0x5528c3;};'use strict';var _=require(_0x9346('0x0'));var util=require(_0x9346('0x1'));var logger=require('../../config/logger')(_0x9346('0x2'));var moment=require(_0x9346('0x3'));var BPromise=require(_0x9346('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9346('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9346('0x6'));module['exports']=function(_0x49ac81,_0x8b03e9){return _0x49ac81['define'](_0x9346('0x7'),attributes,{'tableName':_0x9346('0x8'),'paranoid':![],'indexes':[{'name':_0x9346('0x9'),'fields':[_0x9346('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 309c7d8..f16da83 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x35c33d,_0x46defa){var _0x5139b3=function(_0x427391){while(--_0x427391){_0x35c33d['push'](_0x35c33d['shift']());}};_0x5139b3(++_0x46defa);}(_0x2ef3,0xba));var _0x32ef=function(_0x4284c2,_0x5d3e1f){_0x4284c2=_0x4284c2-0x0;var _0x4ae5af=_0x2ef3[_0x4284c2];return _0x4ae5af;};'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')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x157b63,_0x57c4cf){var _0x4706d1=function(_0x35b607){while(--_0x35b607){_0x157b63['push'](_0x157b63['shift']());}};_0x4706d1(++_0x57c4cf);}(_0xdb28,0x106));var _0x8db2=function(_0x18abe9,_0x26a004){_0x18abe9=_0x18abe9-0x0;var _0x8e7b4b=_0xdb28[_0x18abe9];return _0x8e7b4b;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index bb249b4..5f2381c 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 _0x90c0=['/:id/sounds','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','getSounds','post'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x90c0,0x194));var _0x090c=function(_0x406ae7,_0x12181b){_0x406ae7=_0x406ae7-0x0;var _0x5a5b9d=_0x90c0[_0x406ae7];return _0x5a5b9d;};'use strict';var multer=require(_0x090c('0x0'));var util=require(_0x090c('0x1'));var path=require(_0x090c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x090c('0x3'));var interaction=require(_0x090c('0x4'));var config=require(_0x090c('0x5'));var controller=require(_0x090c('0x6'));router['get']('/',auth[_0x090c('0x7')](),controller[_0x090c('0x8')]);router[_0x090c('0x9')](_0x090c('0xa'),auth['isAuthenticated'](),controller[_0x090c('0xb')]);router[_0x090c('0x9')]('/:id/sounds',auth[_0x090c('0x7')](),controller[_0x090c('0xc')]);router[_0x090c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x090c('0xd')](_0x090c('0xe'),auth[_0x090c('0x7')](),controller['addSound']);router[_0x090c('0xf')](_0x090c('0xa'),auth['isAuthenticated'](),controller[_0x090c('0x10')]);router[_0x090c('0x11')](_0x090c('0xa'),auth['isAuthenticated'](),controller[_0x090c('0x12')]);router[_0x090c('0x11')](_0x090c('0x13'),auth[_0x090c('0x7')](),controller[_0x090c('0x14')]);module[_0x090c('0x15')]=router; \ No newline at end of file +var _0x4dc2=['delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSounds','create','post','/:id/sounds','addSound','update'];(function(_0x41ba41,_0x145412){var _0x22d385=function(_0x571d2a){while(--_0x571d2a){_0x41ba41['push'](_0x41ba41['shift']());}};_0x22d385(++_0x145412);}(_0x4dc2,0x1cd));var _0x24dc=function(_0x134127,_0x59573d){_0x134127=_0x134127-0x0;var _0x13259a=_0x4dc2[_0x134127];return _0x13259a;};'use strict';var multer=require(_0x24dc('0x0'));var util=require('util');var path=require(_0x24dc('0x1'));var timeout=require(_0x24dc('0x2'));var express=require(_0x24dc('0x3'));var router=express[_0x24dc('0x4')]();var fs_extra=require(_0x24dc('0x5'));var auth=require(_0x24dc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24dc('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x24dc('0x8')]('/',auth[_0x24dc('0x9')](),controller[_0x24dc('0xa')]);router[_0x24dc('0x8')](_0x24dc('0xb'),auth[_0x24dc('0x9')](),controller[_0x24dc('0xc')]);router['get']('/:id/sounds',auth[_0x24dc('0x9')](),controller[_0x24dc('0xd')]);router['post']('/',auth[_0x24dc('0x9')](),controller[_0x24dc('0xe')]);router[_0x24dc('0xf')](_0x24dc('0x10'),auth[_0x24dc('0x9')](),controller[_0x24dc('0x11')]);router['put'](_0x24dc('0xb'),auth[_0x24dc('0x9')](),controller[_0x24dc('0x12')]);router[_0x24dc('0x13')](_0x24dc('0xb'),auth[_0x24dc('0x9')](),controller[_0x24dc('0x14')]);router[_0x24dc('0x13')](_0x24dc('0x15'),auth['isAuthenticated'](),controller[_0x24dc('0x16')]);module[_0x24dc('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index fd85646..0cdfe59 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 _0x7a2b=['name','ENUM','files','quietmp3nb','quietmp3','STRING','TIMESTAMP','exports'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x7a2b,0x197));var _0xb7a2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7a2b[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0xb7a2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb7a2('0x1')},'mode':{'type':Sequelize[_0xb7a2('0x2')]('custom',_0xb7a2('0x3'),'mp3nb',_0xb7a2('0x4'),_0xb7a2('0x5'),'mp3'),'allowNull':!![],'defaultValue':_0xb7a2('0x3')},'directory':{'type':Sequelize[_0xb7a2('0x6')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xb7a2('0x6')],'allowNull':!![]},'sort':{'type':Sequelize[_0xb7a2('0x6')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xb7a2('0x6')],'allowNull':!![]},'stamp':{'type':_0xb7a2('0x7')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4d54=['mp3','files','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','mp3nb','quietmp3'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0x4d54,0x124));var _0x44d5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4d54[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x44d5('0x0'));module[_0x44d5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x44d5('0x2')},'mode':{'type':Sequelize[_0x44d5('0x3')](_0x44d5('0x4'),'files',_0x44d5('0x5'),'quietmp3nb',_0x44d5('0x6'),_0x44d5('0x7')),'allowNull':!![],'defaultValue':_0x44d5('0x8')},'directory':{'type':Sequelize[_0x44d5('0x9')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x44d5('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x44d5('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x44d5('0xb')},'defaultEntry':{'type':Sequelize[_0x44d5('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 45e7983..a4c7b0e 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 _0x80e0=['Sequelize','ValidationError','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','hasOwnProperty','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','get','MusicOnHolds','stack','name','render','contact','message','agent','index','VoiceMusicOnHold','fieldName','type','map','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options','body','find','transaction','mode','directory','join','root','server/files/moh','create','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','sequelize','readdirSync','forEach','unlinkSync'];(function(_0x2a84d6,_0x538497){var _0x55c2ea=function(_0x3f5d46){while(--_0x3f5d46){_0x2a84d6['push'](_0x2a84d6['shift']());}};_0x55c2ea(++_0x538497);}(_0x80e0,0x161));var _0x080e=function(_0x23e0c6,_0x467271){_0x23e0c6=_0x23e0c6-0x0;var _0x53671b=_0x80e0[_0x23e0c6];return _0x53671b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x080e('0x0'));var jsonpatch=require(_0x080e('0x1'));var rp=require(_0x080e('0x2'));var moment=require(_0x080e('0x3'));var BPromise=require(_0x080e('0x4'));var Mustache=require(_0x080e('0x5'));var util=require(_0x080e('0x6'));var path=require(_0x080e('0x7'));var sox=require(_0x080e('0x8'));var csv=require(_0x080e('0x9'));var ejs=require(_0x080e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x080e('0xb'));var crypto=require(_0x080e('0xc'));var jsforce=require(_0x080e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x080e('0x9'));var querystring=require(_0x080e('0xe'));var Papa=require(_0x080e('0xf'));var Redis=require('ioredis');var authService=require(_0x080e('0x10'));var qs=require(_0x080e('0x11'));var as=require(_0x080e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x080e('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x080e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf9ca6a,_0x1c48ee){_0x1c48ee=_0x1c48ee||0xcc;return function(_0x18ae8a){if(_0x18ae8a){return _0xf9ca6a[_0x080e('0x15')](_0x1c48ee);}return _0xf9ca6a[_0x080e('0x16')](_0x1c48ee)[_0x080e('0x17')]();};}function respondWithResult(_0x13abcb,_0x1cc766){_0x1cc766=_0x1cc766||0xc8;return function(_0x4775fe){if(_0x4775fe){return _0x13abcb[_0x080e('0x16')](_0x1cc766)[_0x080e('0x18')](_0x4775fe);}};}function respondWithFilteredResult(_0x497362,_0x2270c2){return function(_0x37cec1){if(_0x37cec1){var _0x17be2c=typeof _0x2270c2[_0x080e('0x19')]==='undefined'&&typeof _0x2270c2[_0x080e('0x1a')]===_0x080e('0x1b');var _0x39b28a=_0x37cec1[_0x080e('0x1c')];var _0x19c0f2=_0x17be2c?0x0:_0x2270c2[_0x080e('0x19')];var _0x42dda1=_0x17be2c?_0x37cec1[_0x080e('0x1c')]:_0x2270c2[_0x080e('0x19')]+_0x2270c2['limit'];var _0x4824ba;if(_0x42dda1>=_0x39b28a){_0x42dda1=_0x39b28a;_0x4824ba=0xc8;}else{_0x4824ba=0xce;}_0x497362['status'](_0x4824ba);return _0x497362[_0x080e('0x1d')]('Content-Range',_0x19c0f2+'-'+_0x42dda1+'/'+_0x39b28a)[_0x080e('0x18')](_0x37cec1);}return null;};}function patchUpdates(_0xbeba2){return function(_0x25d4b2){try{jsonpatch['apply'](_0x25d4b2,_0xbeba2,!![]);}catch(_0x5c99c0){return BPromise[_0x080e('0x1e')](_0x5c99c0);}return _0x25d4b2[_0x080e('0x1f')]();};}function saveUpdates(_0x57e359,_0x30d4d3){return function(_0x1ea27b){if(_0x1ea27b){return _0x1ea27b[_0x080e('0x20')](_0x57e359)[_0x080e('0x21')](function(_0x1dbf98){return _0x1dbf98;});}return null;};}function removeEntity(_0x4f0507,_0x1c8d9e){return function(_0x243fbc){if(_0x243fbc){return _0x243fbc[_0x080e('0x22')]()['then'](function(){var _0x10dc49=_0x243fbc[_0x080e('0x23')]({'plain':!![]});var _0xd41acc=_0x080e('0x24');return db['UserProfileResource'][_0x080e('0x22')]({'where':{'type':_0xd41acc,'resourceId':_0x10dc49['id']}})['then'](function(){return _0x243fbc;});})[_0x080e('0x21')](function(){_0x4f0507[_0x080e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8ac987,_0x2796cf){return function(_0x243f7a){if(!_0x243f7a){_0x8ac987['sendStatus'](0x194);}return _0x243f7a;};}function handleError(_0x234736,_0x5c44ca){_0x5c44ca=_0x5c44ca||0x1f4;return function(_0xacc950){logger['error'](_0xacc950[_0x080e('0x25')]);if(_0xacc950[_0x080e('0x26')]){delete _0xacc950['name'];}_0x234736[_0x080e('0x16')](_0x5c44ca)['send'](_0xacc950);};}function getMustacheRender(_0x369cc7,_0x10708f){return Mustache[_0x080e('0x27')](_0x369cc7,_['merge'](_0x10708f['body'],{'contact':_0x10708f[_0x080e('0x28')],'message':_0x10708f[_0x080e('0x29')],'agent':_0x10708f[_0x080e('0x2a')],'interaction':_0x10708f['interaction'],'account':_0x10708f['account']}))||'';}exports[_0x080e('0x2b')]=function(_0x2a3866,_0x4d303b){var _0x4823a1={},_0x217584={},_0x9a243e={'count':0x0,'rows':[]};var _0x51e712=_['map'](db[_0x080e('0x2c')]['rawAttributes'],function(_0x3b41fa){return{'name':_0x3b41fa[_0x080e('0x2d')],'type':_0x3b41fa[_0x080e('0x2e')]['key']};});_0x217584['model']=_[_0x080e('0x2f')](_0x51e712,_0x080e('0x26'));_0x217584['query']=_[_0x080e('0x30')](_0x2a3866[_0x080e('0x31')]);_0x217584['filters']=_[_0x080e('0x32')](_0x217584[_0x080e('0x33')],_0x217584[_0x080e('0x31')]);_0x4823a1['attributes']=_[_0x080e('0x32')](_0x217584[_0x080e('0x33')],qs[_0x080e('0x34')](_0x2a3866[_0x080e('0x31')][_0x080e('0x34')]));_0x4823a1['attributes']=_0x4823a1[_0x080e('0x35')][_0x080e('0x36')]?_0x4823a1[_0x080e('0x35')]:_0x217584[_0x080e('0x33')];if(!_0x2a3866[_0x080e('0x31')]['hasOwnProperty'](_0x080e('0x37'))){_0x4823a1[_0x080e('0x1a')]=qs[_0x080e('0x1a')](_0x2a3866['query'][_0x080e('0x1a')]);_0x4823a1[_0x080e('0x19')]=qs[_0x080e('0x19')](_0x2a3866[_0x080e('0x31')][_0x080e('0x19')]);}_0x4823a1[_0x080e('0x38')]=qs[_0x080e('0x39')](_0x2a3866[_0x080e('0x31')][_0x080e('0x39')]);delete _0x2a3866['query'][_0x080e('0x39')];_0x4823a1['where']=qs[_0x080e('0x3a')](_[_0x080e('0x3b')](_0x2a3866[_0x080e('0x31')],_0x217584[_0x080e('0x3a')]),_0x51e712);if(_0x2a3866[_0x080e('0x31')][_0x080e('0x3c')]){_0x4823a1[_0x080e('0x3d')]=_[_0x080e('0x3e')](_0x4823a1[_0x080e('0x3d')],{'$or':_[_0x080e('0x2f')](_0x51e712,function(_0x458d1b){if(_0x458d1b[_0x080e('0x2e')]!=='VIRTUAL'){var _0x4a2fab={};_0x4a2fab[_0x458d1b[_0x080e('0x26')]]={'$like':'%'+_0x2a3866[_0x080e('0x31')]['filter']+'%'};return _0x4a2fab;}})});}_0x4823a1=_['merge']({},_0x4823a1,_0x2a3866['options']);var _0x5dd707={'where':_0x4823a1[_0x080e('0x3d')]};return db['VoiceMusicOnHold'][_0x080e('0x1c')](_0x5dd707)[_0x080e('0x21')](function(_0x3e694b){_0x9a243e[_0x080e('0x1c')]=_0x3e694b;if(_0x2a3866[_0x080e('0x31')][_0x080e('0x3f')]){_0x4823a1[_0x080e('0x40')]=[{'all':!![]}];}return db[_0x080e('0x2c')][_0x080e('0x41')](_0x4823a1);})['then'](function(_0x5a6d50){_0x9a243e[_0x080e('0x42')]=_0x5a6d50;return _0x9a243e;})[_0x080e('0x21')](respondWithFilteredResult(_0x4d303b,_0x4823a1))[_0x080e('0x43')](handleError(_0x4d303b,null));};exports['show']=function(_0x126f0d,_0x4a4746){var _0x1f0dd1={'raw':![],'where':{'id':_0x126f0d[_0x080e('0x44')]['id']}},_0x35b57d={};_0x35b57d[_0x080e('0x33')]=_[_0x080e('0x30')](db[_0x080e('0x2c')][_0x080e('0x45')]);_0x35b57d[_0x080e('0x31')]=_[_0x080e('0x30')](_0x126f0d['query']);_0x35b57d[_0x080e('0x3a')]=_[_0x080e('0x32')](_0x35b57d['model'],_0x35b57d['query']);_0x1f0dd1[_0x080e('0x35')]=_[_0x080e('0x32')](_0x35b57d[_0x080e('0x33')],qs[_0x080e('0x34')](_0x126f0d[_0x080e('0x31')][_0x080e('0x34')]));_0x1f0dd1['attributes']=_0x1f0dd1['attributes'][_0x080e('0x36')]?_0x1f0dd1[_0x080e('0x35')]:_0x35b57d['model'];if(_0x126f0d[_0x080e('0x31')][_0x080e('0x3f')]){_0x1f0dd1[_0x080e('0x40')]=[{'all':!![]}];}_0x1f0dd1=_['merge']({},_0x1f0dd1,_0x126f0d[_0x080e('0x46')]);return db[_0x080e('0x2c')]['find'](_0x1f0dd1)['then'](handleEntityNotFound(_0x4a4746,null))[_0x080e('0x21')](respondWithResult(_0x4a4746,null))[_0x080e('0x43')](handleError(_0x4a4746,null));};exports[_0x080e('0x20')]=function(_0xf9faae,_0x1a62db){if(_0xf9faae['body']['id']){delete _0xf9faae[_0x080e('0x47')]['id'];}return db[_0x080e('0x2c')][_0x080e('0x48')]({'where':{'id':_0xf9faae[_0x080e('0x44')]['id']}})[_0x080e('0x21')](handleEntityNotFound(_0x1a62db,null))['then'](saveUpdates(_0xf9faae['body'],null))[_0x080e('0x21')](respondWithResult(_0x1a62db,null))['catch'](handleError(_0x1a62db,null));};exports['create']=function(_0x101084,_0x27ea49,_0x4df2c8){return db['sequelize'][_0x080e('0x49')](function(_0x494bfd){if(_0x101084['body'][_0x080e('0x4a')]==='files'){_0x101084[_0x080e('0x47')][_0x080e('0x4b')]=path[_0x080e('0x4c')](config[_0x080e('0x4d')],_0x080e('0x4e'),_0x101084[_0x080e('0x47')][_0x080e('0x26')]);}return db['VoiceMusicOnHold'][_0x080e('0x4f')](_0x101084['body'],{'transaction':_0x494bfd})[_0x080e('0x21')](function(_0x1742b8){if(_0x101084['body']['mode']===_0x080e('0x50')){fs[_0x080e('0x51')](_0x1742b8[_0x080e('0x4b')],parseInt(_0x080e('0x52'),0x8));}var _0x1c14d7=_0x101084[_0x080e('0x53')][_0x080e('0x23')]({'plain':!![]});if(!_0x1c14d7)throw new Error(_0x080e('0x54'));if(_0x1c14d7[_0x080e('0x55')]===_0x080e('0x53')){var _0x178c1f=_0x1742b8['get']({'plain':!![]});return db[_0x080e('0x56')][_0x080e('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x1c14d7[_0x080e('0x57')]},'raw':!![]})[_0x080e('0x21')](function(_0x4eec79){if(_0x4eec79&&_0x4eec79[_0x080e('0x58')]===0x0){return db[_0x080e('0x59')][_0x080e('0x4f')]({'name':_0x178c1f[_0x080e('0x26')],'resourceId':_0x178c1f['id'],'type':_0x4eec79[_0x080e('0x26')],'sectionId':_0x4eec79['id']},{})['then'](function(){return _0x1742b8;});}else{return _0x1742b8;}})[_0x080e('0x43')](function(_0x28639c){logger[_0x080e('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28639c);});}return _0x1742b8;});})[_0x080e('0x21')](respondWithResult(_0x27ea49,0xc9))[_0x080e('0x43')](handleError(_0x27ea49,null));};exports[_0x080e('0x22')]=function(_0x44d5bc,_0x19caab,_0x297420){var _0x2d8efe;return db[_0x080e('0x2c')]['find']({'where':{'id':_0x44d5bc['params']['id']}})[_0x080e('0x21')](function(_0x5e154e){if(_0x5e154e){return db[_0x080e('0x5b')][_0x080e('0x49')](function(_0x1b9bbd){return _0x5e154e[_0x080e('0x22')]({'transaction':_0x1b9bbd,'raw':!![]})[_0x080e('0x21')](function(_0x4c5796){if(_0x4c5796[_0x080e('0x4b')]){fs[_0x080e('0x5c')](_0x4c5796[_0x080e('0x4b')])[_0x080e('0x5d')](function(_0x551752){fs[_0x080e('0x5e')](path[_0x080e('0x4c')](_0x4c5796[_0x080e('0x4b')],_0x551752));});fs['rmdirSync'](_0x4c5796[_0x080e('0x4b')]);}return _0x4c5796;});})[_0x080e('0x43')](function(_0x523b16){throw new db[(_0x080e('0x5f'))][(_0x080e('0x60'))](_0x523b16['message']);});}})[_0x080e('0x21')](handleEntityNotFound(_0x19caab,null))[_0x080e('0x21')](removeEntity(_0x19caab,null))['catch'](handleError(_0x19caab,null));};exports['addSound']=function(_0x338a01,_0x22dfb9,_0x1c7385){return db[_0x080e('0x5b')][_0x080e('0x49')](function(_0x178281){var _0xbe50e1;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x338a01[_0x080e('0x44')]['id']}})['then'](function(_0x997365){if(_0x997365){_0xbe50e1=_0x997365;return _0x997365['addSound'](_0x338a01[_0x080e('0x47')]['id'],{'transaction':_0x178281});}})[_0x080e('0x21')](function(_0x525ae0){if(_0x525ae0){return db[_0x080e('0x61')][_0x080e('0x62')]({'where':{'id':_0x338a01[_0x080e('0x47')]['id']},'attributes':['id',_0x080e('0x26'),_0x080e('0x63'),_0x080e('0x64'),_0x080e('0x65')],'raw':!![]});}})[_0x080e('0x21')](function(_0x3a139a){if(_0x3a139a){var _0x2718a0=path['join'](config[_0x080e('0x4d')],_0x080e('0x66'),util[_0x080e('0x67')](_0x080e('0x68'),path[_0x080e('0x69')](_0x3a139a[_0x080e('0x63')],path[_0x080e('0x6a')](_0x3a139a[_0x080e('0x63')])),_0x3a139a[_0x080e('0x64')]));var _0x5b5713=path[_0x080e('0x4c')](config['root'],'server/files/moh',_0xbe50e1[_0x080e('0x26')],util[_0x080e('0x67')](_0x080e('0x68'),_0x3a139a[_0x080e('0x26')],_0x3a139a[_0x080e('0x64')]));fs[_0x080e('0x6b')](_0x2718a0,_0x5b5713);return _0x3a139a;}})[_0x080e('0x43')](function(_0x15e012){throw new db[(_0x080e('0x5f'))][(_0x080e('0x60'))](_0x15e012[_0x080e('0x29')]);});})['then'](handleEntityNotFound(_0x22dfb9,null))[_0x080e('0x21')](respondWithResult(_0x22dfb9,0xc9))['catch'](handleError(_0x22dfb9,null));};exports[_0x080e('0x6c')]=function(_0x685bdf,_0x5c6534,_0x29b932){return db[_0x080e('0x5b')][_0x080e('0x49')](function(_0x578544){var _0x193ad0;return db[_0x080e('0x2c')][_0x080e('0x62')]({'where':{'id':_0x685bdf[_0x080e('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c6534,null))[_0x080e('0x21')](function(_0x29265a){if(_0x29265a){_0x193ad0=_0x29265a;return _0x29265a[_0x080e('0x6c')](_0x685bdf[_0x080e('0x44')][_0x080e('0x6d')]);}})[_0x080e('0x21')](function(_0x1d2fee){if(_0x1d2fee){return db[_0x080e('0x61')][_0x080e('0x62')]({'where':{'id':_0x685bdf['params'][_0x080e('0x6d')]},'attributes':['id',_0x080e('0x26'),'save_name',_0x080e('0x64'),_0x080e('0x65')],'raw':!![]});}})[_0x080e('0x21')](function(_0x4f8251){if(_0x4f8251){fs[_0x080e('0x5e')](path[_0x080e('0x4c')](_0x193ad0['directory'],util['format'](_0x080e('0x68'),_0x4f8251[_0x080e('0x26')],_0x4f8251[_0x080e('0x64')])));return _0x4f8251;}})[_0x080e('0x43')](function(_0x55666c){throw new db[(_0x080e('0x5f'))][(_0x080e('0x60'))](_0x55666c[_0x080e('0x29')]);});})[_0x080e('0x21')](handleEntityNotFound(_0x5c6534,null))['then'](respondWithStatusCode(_0x5c6534,0xcc))[_0x080e('0x43')](handleError(_0x5c6534,null));};exports[_0x080e('0x6e')]=function(_0x1466ca,_0x8688a,_0x442304){var _0x1d8126={};var _0xd09c82={};var _0x503ca1;var _0x475f22;return db[_0x080e('0x2c')][_0x080e('0x62')]({'where':{'id':_0x1466ca[_0x080e('0x44')]['id']}})[_0x080e('0x21')](handleEntityNotFound(_0x8688a,null))[_0x080e('0x21')](function(_0x5dfd3e){if(_0x5dfd3e){_0x503ca1=_0x5dfd3e;_0xd09c82[_0x080e('0x33')]=_[_0x080e('0x30')](db['Sound']['rawAttributes']);_0xd09c82[_0x080e('0x31')]=_[_0x080e('0x30')](_0x1466ca[_0x080e('0x31')]);_0xd09c82[_0x080e('0x3a')]=_[_0x080e('0x32')](_0xd09c82['model'],_0xd09c82[_0x080e('0x31')]);_0x1d8126[_0x080e('0x35')]=_[_0x080e('0x32')](_0xd09c82['model'],qs[_0x080e('0x34')](_0x1466ca[_0x080e('0x31')][_0x080e('0x34')]));_0x1d8126[_0x080e('0x35')]=_0x1d8126['attributes'][_0x080e('0x36')]?_0x1d8126[_0x080e('0x35')]:_0xd09c82['model'];_0x1d8126['order']=qs[_0x080e('0x39')](_0x1466ca[_0x080e('0x31')][_0x080e('0x39')]);_0x1d8126[_0x080e('0x3d')]=qs[_0x080e('0x3a')](_[_0x080e('0x3b')](_0x1466ca[_0x080e('0x31')],_0xd09c82['filters']));if(_0x1466ca['query']['filter']){_0x1d8126[_0x080e('0x3d')]=_[_0x080e('0x3e')](_0x1d8126[_0x080e('0x3d')],{'$or':_['map'](_0x1d8126['attributes'],function(_0xf9a29e){var _0x296875={};_0x296875[_0xf9a29e]={'$like':'%'+_0x1466ca[_0x080e('0x31')][_0x080e('0x3c')]+'%'};return _0x296875;})});}_0x1d8126=_[_0x080e('0x3e')]({},_0x1d8126,_0x1466ca[_0x080e('0x46')]);return _0x503ca1[_0x080e('0x6e')](_0x1d8126);}})[_0x080e('0x21')](function(_0x2eac06){if(_0x2eac06){_0x475f22=_0x2eac06[_0x080e('0x36')];if(!_0x1466ca['query'][_0x080e('0x6f')]('nolimit')){_0x1d8126['limit']=qs[_0x080e('0x1a')](_0x1466ca[_0x080e('0x31')][_0x080e('0x1a')]);_0x1d8126[_0x080e('0x19')]=qs['offset'](_0x1466ca[_0x080e('0x31')][_0x080e('0x19')]);}return _0x503ca1[_0x080e('0x6e')](_0x1d8126);}})[_0x080e('0x21')](function(_0xb73cb7){if(_0xb73cb7){return _0xb73cb7?{'count':_0x475f22,'rows':_0xb73cb7}:null;}})[_0x080e('0x21')](respondWithResult(_0x8688a,null))[_0x080e('0x43')](handleError(_0x8688a,null));}; \ No newline at end of file +var _0x3cd8=['map','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','options','include','rows','catch','params','includeAll','find','create','sequelize','transaction','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','message','removeSound','id2','unlinkSync','getSounds','pick','nolimit','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','render','merge','body','contact','agent','interaction','account','index','VoiceMusicOnHold','rawAttributes','type','key'];(function(_0x5cb09b,_0x260a11){var _0xf780e6=function(_0x5c714d){while(--_0x5c714d){_0x5cb09b['push'](_0x5cb09b['shift']());}};_0xf780e6(++_0x260a11);}(_0x3cd8,0x12a));var _0x83cd=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0x3cd8[_0x13342f];return _0x2fc1fc;};'use strict';var emlformat=require(_0x83cd('0x0'));var rimraf=require(_0x83cd('0x1'));var zipdir=require(_0x83cd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x83cd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x83cd('0x4'));var util=require(_0x83cd('0x5'));var path=require(_0x83cd('0x6'));var sox=require(_0x83cd('0x7'));var csv=require(_0x83cd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83cd('0x9'));var _=require(_0x83cd('0xa'));var squel=require(_0x83cd('0xb'));var crypto=require(_0x83cd('0xc'));var jsforce=require(_0x83cd('0xd'));var deskjs=require(_0x83cd('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x83cd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x83cd('0x10'));var as=require(_0x83cd('0x11'));var hardwareService=require(_0x83cd('0x12'));var logger=require(_0x83cd('0x13'))(_0x83cd('0x14'));var utils=require(_0x83cd('0x15'));var config=require(_0x83cd('0x16'));var licenseUtil=require(_0x83cd('0x17'));var db=require(_0x83cd('0x18'))['db'];function respondWithStatusCode(_0x469a36,_0x52c41c){_0x52c41c=_0x52c41c||0xcc;return function(_0x4d9b8a){if(_0x4d9b8a){return _0x469a36['sendStatus'](_0x52c41c);}return _0x469a36[_0x83cd('0x19')](_0x52c41c)[_0x83cd('0x1a')]();};}function respondWithResult(_0x471281,_0x14eb56){_0x14eb56=_0x14eb56||0xc8;return function(_0x37928a){if(_0x37928a){return _0x471281[_0x83cd('0x19')](_0x14eb56)[_0x83cd('0x1b')](_0x37928a);}};}function respondWithFilteredResult(_0x5e3712,_0x2724c2){return function(_0xa1250b){if(_0xa1250b){var _0x2a605f=typeof _0x2724c2['offset']===_0x83cd('0x1c')&&typeof _0x2724c2[_0x83cd('0x1d')]==='undefined';var _0x2fee38=_0xa1250b[_0x83cd('0x1e')];var _0x24e98d=_0x2a605f?0x0:_0x2724c2[_0x83cd('0x1f')];var _0x253199=_0x2a605f?_0xa1250b[_0x83cd('0x1e')]:_0x2724c2[_0x83cd('0x1f')]+_0x2724c2['limit'];var _0x4636e7;if(_0x253199>=_0x2fee38){_0x253199=_0x2fee38;_0x4636e7=0xc8;}else{_0x4636e7=0xce;}_0x5e3712['status'](_0x4636e7);return _0x5e3712[_0x83cd('0x20')]('Content-Range',_0x24e98d+'-'+_0x253199+'/'+_0x2fee38)['json'](_0xa1250b);}return null;};}function patchUpdates(_0x1a2aee){return function(_0x4c8eda){try{jsonpatch['apply'](_0x4c8eda,_0x1a2aee,!![]);}catch(_0x147dca){return BPromise['reject'](_0x147dca);}return _0x4c8eda[_0x83cd('0x21')]();};}function saveUpdates(_0x1bab73,_0x100845){return function(_0x37c846){if(_0x37c846){return _0x37c846[_0x83cd('0x22')](_0x1bab73)[_0x83cd('0x23')](function(_0x5ddb1b){return _0x5ddb1b;});}return null;};}function removeEntity(_0x25b94f,_0x4c441e){return function(_0x30e1e0){if(_0x30e1e0){return _0x30e1e0[_0x83cd('0x24')]()[_0x83cd('0x23')](function(){var _0x237223=_0x30e1e0[_0x83cd('0x25')]({'plain':!![]});var _0x480d21=_0x83cd('0x26');return db[_0x83cd('0x27')][_0x83cd('0x24')]({'where':{'type':_0x480d21,'resourceId':_0x237223['id']}})[_0x83cd('0x23')](function(){return _0x30e1e0;});})[_0x83cd('0x23')](function(){_0x25b94f['status'](0xcc)[_0x83cd('0x1a')]();});}};}function handleEntityNotFound(_0x6a9e16,_0x54dc6a){return function(_0x4be240){if(!_0x4be240){_0x6a9e16[_0x83cd('0x28')](0x194);}return _0x4be240;};}function handleError(_0x278ad8,_0x4b6a70){_0x4b6a70=_0x4b6a70||0x1f4;return function(_0x509543){logger[_0x83cd('0x29')](_0x509543[_0x83cd('0x2a')]);if(_0x509543[_0x83cd('0x2b')]){delete _0x509543[_0x83cd('0x2b')];}_0x278ad8[_0x83cd('0x19')](_0x4b6a70)['send'](_0x509543);};}function getMustacheRender(_0x3f5c57,_0x1a54bd){return Mustache[_0x83cd('0x2c')](_0x3f5c57,_[_0x83cd('0x2d')](_0x1a54bd[_0x83cd('0x2e')],{'contact':_0x1a54bd[_0x83cd('0x2f')],'message':_0x1a54bd['message'],'agent':_0x1a54bd[_0x83cd('0x30')],'interaction':_0x1a54bd[_0x83cd('0x31')],'account':_0x1a54bd[_0x83cd('0x32')]}))||'';}exports[_0x83cd('0x33')]=function(_0x299a07,_0x1c6a82){var _0x58ce76={},_0xb64ee9={},_0x3f9e73={'count':0x0,'rows':[]};var _0x23c7fa=_['map'](db[_0x83cd('0x34')][_0x83cd('0x35')],function(_0x55f35c){return{'name':_0x55f35c['fieldName'],'type':_0x55f35c[_0x83cd('0x36')][_0x83cd('0x37')]};});_0xb64ee9['model']=_[_0x83cd('0x38')](_0x23c7fa,'name');_0xb64ee9['query']=_[_0x83cd('0x39')](_0x299a07[_0x83cd('0x3a')]);_0xb64ee9[_0x83cd('0x3b')]=_['intersection'](_0xb64ee9['model'],_0xb64ee9[_0x83cd('0x3a')]);_0x58ce76[_0x83cd('0x3c')]=_[_0x83cd('0x3d')](_0xb64ee9[_0x83cd('0x3e')],qs[_0x83cd('0x3f')](_0x299a07[_0x83cd('0x3a')][_0x83cd('0x3f')]));_0x58ce76[_0x83cd('0x3c')]=_0x58ce76[_0x83cd('0x3c')][_0x83cd('0x40')]?_0x58ce76['attributes']:_0xb64ee9['model'];if(!_0x299a07[_0x83cd('0x3a')][_0x83cd('0x41')]('nolimit')){_0x58ce76['limit']=qs[_0x83cd('0x1d')](_0x299a07[_0x83cd('0x3a')][_0x83cd('0x1d')]);_0x58ce76['offset']=qs[_0x83cd('0x1f')](_0x299a07[_0x83cd('0x3a')][_0x83cd('0x1f')]);}_0x58ce76[_0x83cd('0x42')]=qs[_0x83cd('0x43')](_0x299a07[_0x83cd('0x3a')]['sort']);delete _0x299a07['query']['sort'];_0x58ce76[_0x83cd('0x44')]=qs[_0x83cd('0x3b')](_['pick'](_0x299a07[_0x83cd('0x3a')],_0xb64ee9['filters']),_0x23c7fa);if(_0x299a07[_0x83cd('0x3a')]['filter']){_0x58ce76['where']=_[_0x83cd('0x2d')](_0x58ce76[_0x83cd('0x44')],{'$or':_[_0x83cd('0x38')](_0x23c7fa,function(_0xc1efb9){if(_0xc1efb9['type']!==_0x83cd('0x45')){var _0x2d5798={};_0x2d5798[_0xc1efb9[_0x83cd('0x2b')]]={'$like':'%'+_0x299a07['query'][_0x83cd('0x46')]+'%'};return _0x2d5798;}})});}_0x58ce76=_[_0x83cd('0x2d')]({},_0x58ce76,_0x299a07[_0x83cd('0x47')]);var _0x350178={'where':_0x58ce76['where']};return db['VoiceMusicOnHold'][_0x83cd('0x1e')](_0x350178)[_0x83cd('0x23')](function(_0x3d25ad){_0x3f9e73[_0x83cd('0x1e')]=_0x3d25ad;if(_0x299a07[_0x83cd('0x3a')]['includeAll']){_0x58ce76[_0x83cd('0x48')]=[{'all':!![]}];}return db[_0x83cd('0x34')]['findAll'](_0x58ce76);})[_0x83cd('0x23')](function(_0x273427){_0x3f9e73[_0x83cd('0x49')]=_0x273427;return _0x3f9e73;})[_0x83cd('0x23')](respondWithFilteredResult(_0x1c6a82,_0x58ce76))[_0x83cd('0x4a')](handleError(_0x1c6a82,null));};exports['show']=function(_0x2f3325,_0x5b1e15){var _0x21bf84={'raw':![],'where':{'id':_0x2f3325[_0x83cd('0x4b')]['id']}},_0x913d08={};_0x913d08[_0x83cd('0x3e')]=_[_0x83cd('0x39')](db[_0x83cd('0x34')]['rawAttributes']);_0x913d08['query']=_[_0x83cd('0x39')](_0x2f3325[_0x83cd('0x3a')]);_0x913d08['filters']=_[_0x83cd('0x3d')](_0x913d08[_0x83cd('0x3e')],_0x913d08[_0x83cd('0x3a')]);_0x21bf84[_0x83cd('0x3c')]=_[_0x83cd('0x3d')](_0x913d08[_0x83cd('0x3e')],qs[_0x83cd('0x3f')](_0x2f3325[_0x83cd('0x3a')]['fields']));_0x21bf84[_0x83cd('0x3c')]=_0x21bf84[_0x83cd('0x3c')][_0x83cd('0x40')]?_0x21bf84[_0x83cd('0x3c')]:_0x913d08[_0x83cd('0x3e')];if(_0x2f3325[_0x83cd('0x3a')][_0x83cd('0x4c')]){_0x21bf84['include']=[{'all':!![]}];}_0x21bf84=_[_0x83cd('0x2d')]({},_0x21bf84,_0x2f3325[_0x83cd('0x47')]);return db[_0x83cd('0x34')][_0x83cd('0x4d')](_0x21bf84)[_0x83cd('0x23')](handleEntityNotFound(_0x5b1e15,null))[_0x83cd('0x23')](respondWithResult(_0x5b1e15,null))[_0x83cd('0x4a')](handleError(_0x5b1e15,null));};exports['update']=function(_0x1a9825,_0x49bbd6){if(_0x1a9825[_0x83cd('0x2e')]['id']){delete _0x1a9825[_0x83cd('0x2e')]['id'];}return db[_0x83cd('0x34')][_0x83cd('0x4d')]({'where':{'id':_0x1a9825[_0x83cd('0x4b')]['id']}})[_0x83cd('0x23')](handleEntityNotFound(_0x49bbd6,null))[_0x83cd('0x23')](saveUpdates(_0x1a9825[_0x83cd('0x2e')],null))[_0x83cd('0x23')](respondWithResult(_0x49bbd6,null))['catch'](handleError(_0x49bbd6,null));};exports[_0x83cd('0x4e')]=function(_0x4106fd,_0x41e230,_0x391ccc){return db[_0x83cd('0x4f')][_0x83cd('0x50')](function(_0x1e16df){if(_0x4106fd[_0x83cd('0x2e')]['mode']===_0x83cd('0x51')){_0x4106fd['body']['directory']=path[_0x83cd('0x52')](config[_0x83cd('0x53')],_0x83cd('0x54'),_0x4106fd[_0x83cd('0x2e')]['name']);}return db['VoiceMusicOnHold']['create'](_0x4106fd[_0x83cd('0x2e')],{'transaction':_0x1e16df})['then'](function(_0x10d83e){if(_0x4106fd[_0x83cd('0x2e')][_0x83cd('0x55')]==='files'){fs[_0x83cd('0x56')](_0x10d83e[_0x83cd('0x57')],parseInt(_0x83cd('0x58'),0x8));}var _0x474771=_0x4106fd[_0x83cd('0x59')][_0x83cd('0x25')]({'plain':!![]});if(!_0x474771)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x474771[_0x83cd('0x5a')]===_0x83cd('0x59')){var _0x51dbc3=_0x10d83e[_0x83cd('0x25')]({'plain':!![]});return db[_0x83cd('0x5b')][_0x83cd('0x4d')]({'where':{'name':_0x83cd('0x26'),'userProfileId':_0x474771['userProfileId']},'raw':!![]})[_0x83cd('0x23')](function(_0x44abfb){if(_0x44abfb&&_0x44abfb[_0x83cd('0x5c')]===0x0){return db[_0x83cd('0x27')][_0x83cd('0x4e')]({'name':_0x51dbc3[_0x83cd('0x2b')],'resourceId':_0x51dbc3['id'],'type':_0x44abfb[_0x83cd('0x2b')],'sectionId':_0x44abfb['id']},{})[_0x83cd('0x23')](function(){return _0x10d83e;});}else{return _0x10d83e;}})[_0x83cd('0x4a')](function(_0x3c3c52){logger['error'](_0x83cd('0x5d'),_0x3c3c52);});}return _0x10d83e;});})[_0x83cd('0x23')](respondWithResult(_0x41e230,0xc9))[_0x83cd('0x4a')](handleError(_0x41e230,null));};exports['destroy']=function(_0x336b8b,_0x1c286d,_0x4173f0){var _0x5a10c7;return db[_0x83cd('0x34')][_0x83cd('0x4d')]({'where':{'id':_0x336b8b['params']['id']}})[_0x83cd('0x23')](function(_0x25809b){if(_0x25809b){return db[_0x83cd('0x4f')][_0x83cd('0x50')](function(_0x5bf46d){return _0x25809b[_0x83cd('0x24')]({'transaction':_0x5bf46d,'raw':!![]})[_0x83cd('0x23')](function(_0x6ab490){if(_0x6ab490['directory']){fs[_0x83cd('0x5e')](_0x6ab490['directory'])[_0x83cd('0x5f')](function(_0x18c66a){fs['unlinkSync'](path[_0x83cd('0x52')](_0x6ab490[_0x83cd('0x57')],_0x18c66a));});fs[_0x83cd('0x60')](_0x6ab490[_0x83cd('0x57')]);}return _0x6ab490;});})['catch'](function(_0x225e7e){throw new db[(_0x83cd('0x61'))][(_0x83cd('0x62'))](_0x225e7e['message']);});}})[_0x83cd('0x23')](handleEntityNotFound(_0x1c286d,null))[_0x83cd('0x23')](removeEntity(_0x1c286d,null))[_0x83cd('0x4a')](handleError(_0x1c286d,null));};exports[_0x83cd('0x63')]=function(_0x3c5904,_0x3a44ee,_0x792903){return db[_0x83cd('0x4f')][_0x83cd('0x50')](function(_0x48b180){var _0x38d000;return db[_0x83cd('0x34')]['find']({'where':{'id':_0x3c5904['params']['id']}})[_0x83cd('0x23')](function(_0x359d93){if(_0x359d93){_0x38d000=_0x359d93;return _0x359d93[_0x83cd('0x63')](_0x3c5904[_0x83cd('0x2e')]['id'],{'transaction':_0x48b180});}})[_0x83cd('0x23')](function(_0x2d693b){if(_0x2d693b){return db[_0x83cd('0x64')][_0x83cd('0x65')]({'where':{'id':_0x3c5904['body']['id']},'attributes':['id','name','save_name',_0x83cd('0x66'),_0x83cd('0x67')],'raw':!![]});}})[_0x83cd('0x23')](function(_0x4638eb){if(_0x4638eb){var _0x3bae4a=path[_0x83cd('0x52')](config[_0x83cd('0x53')],_0x83cd('0x68'),util[_0x83cd('0x69')](_0x83cd('0x6a'),path[_0x83cd('0x6b')](_0x4638eb[_0x83cd('0x6c')],path[_0x83cd('0x6d')](_0x4638eb['save_name'])),_0x4638eb[_0x83cd('0x66')]));var _0x44f690=path[_0x83cd('0x52')](config[_0x83cd('0x53')],'server/files/moh',_0x38d000[_0x83cd('0x2b')],util[_0x83cd('0x69')]('%s.%s',_0x4638eb['name'],_0x4638eb[_0x83cd('0x66')]));fs[_0x83cd('0x6e')](_0x3bae4a,_0x44f690);return _0x4638eb;}})[_0x83cd('0x4a')](function(_0x22faee){throw new db[(_0x83cd('0x61'))]['ValidationError'](_0x22faee[_0x83cd('0x6f')]);});})[_0x83cd('0x23')](handleEntityNotFound(_0x3a44ee,null))[_0x83cd('0x23')](respondWithResult(_0x3a44ee,0xc9))[_0x83cd('0x4a')](handleError(_0x3a44ee,null));};exports[_0x83cd('0x70')]=function(_0x5c742f,_0x10173b,_0x3c0776){return db[_0x83cd('0x4f')][_0x83cd('0x50')](function(_0x26dbeb){var _0x2f5bba;return db[_0x83cd('0x34')][_0x83cd('0x65')]({'where':{'id':_0x5c742f[_0x83cd('0x4b')]['id']}})[_0x83cd('0x23')](handleEntityNotFound(_0x10173b,null))[_0x83cd('0x23')](function(_0x64c90d){if(_0x64c90d){_0x2f5bba=_0x64c90d;return _0x64c90d[_0x83cd('0x70')](_0x5c742f[_0x83cd('0x4b')][_0x83cd('0x71')]);}})[_0x83cd('0x23')](function(_0x2b334d){if(_0x2b334d){return db['Sound']['findOne']({'where':{'id':_0x5c742f['params'][_0x83cd('0x71')]},'attributes':['id','name','save_name',_0x83cd('0x66'),_0x83cd('0x67')],'raw':!![]});}})['then'](function(_0x462006){if(_0x462006){fs[_0x83cd('0x72')](path[_0x83cd('0x52')](_0x2f5bba[_0x83cd('0x57')],util['format'](_0x83cd('0x6a'),_0x462006[_0x83cd('0x2b')],_0x462006[_0x83cd('0x66')])));return _0x462006;}})[_0x83cd('0x4a')](function(_0x1d5e7f){throw new db['Sequelize'][(_0x83cd('0x62'))](_0x1d5e7f['message']);});})['then'](handleEntityNotFound(_0x10173b,null))[_0x83cd('0x23')](respondWithStatusCode(_0x10173b,0xcc))[_0x83cd('0x4a')](handleError(_0x10173b,null));};exports[_0x83cd('0x73')]=function(_0x1eefef,_0x4407d7,_0x2ec04f){var _0x227bc2={};var _0x2344a5={};var _0x1501f5;var _0x56c195;return db[_0x83cd('0x34')][_0x83cd('0x65')]({'where':{'id':_0x1eefef[_0x83cd('0x4b')]['id']}})[_0x83cd('0x23')](handleEntityNotFound(_0x4407d7,null))[_0x83cd('0x23')](function(_0x130aa5){if(_0x130aa5){_0x1501f5=_0x130aa5;_0x2344a5[_0x83cd('0x3e')]=_[_0x83cd('0x39')](db[_0x83cd('0x64')][_0x83cd('0x35')]);_0x2344a5[_0x83cd('0x3a')]=_[_0x83cd('0x39')](_0x1eefef[_0x83cd('0x3a')]);_0x2344a5[_0x83cd('0x3b')]=_[_0x83cd('0x3d')](_0x2344a5['model'],_0x2344a5[_0x83cd('0x3a')]);_0x227bc2[_0x83cd('0x3c')]=_['intersection'](_0x2344a5['model'],qs['fields'](_0x1eefef['query'][_0x83cd('0x3f')]));_0x227bc2[_0x83cd('0x3c')]=_0x227bc2[_0x83cd('0x3c')][_0x83cd('0x40')]?_0x227bc2[_0x83cd('0x3c')]:_0x2344a5[_0x83cd('0x3e')];_0x227bc2[_0x83cd('0x42')]=qs['sort'](_0x1eefef[_0x83cd('0x3a')][_0x83cd('0x43')]);_0x227bc2[_0x83cd('0x44')]=qs[_0x83cd('0x3b')](_[_0x83cd('0x74')](_0x1eefef['query'],_0x2344a5['filters']));if(_0x1eefef['query'][_0x83cd('0x46')]){_0x227bc2[_0x83cd('0x44')]=_['merge'](_0x227bc2[_0x83cd('0x44')],{'$or':_[_0x83cd('0x38')](_0x227bc2[_0x83cd('0x3c')],function(_0x4151da){var _0x521735={};_0x521735[_0x4151da]={'$like':'%'+_0x1eefef[_0x83cd('0x3a')][_0x83cd('0x46')]+'%'};return _0x521735;})});}_0x227bc2=_[_0x83cd('0x2d')]({},_0x227bc2,_0x1eefef['options']);return _0x1501f5[_0x83cd('0x73')](_0x227bc2);}})[_0x83cd('0x23')](function(_0x5a371b){if(_0x5a371b){_0x56c195=_0x5a371b['length'];if(!_0x1eefef['query'][_0x83cd('0x41')](_0x83cd('0x75'))){_0x227bc2['limit']=qs[_0x83cd('0x1d')](_0x1eefef[_0x83cd('0x3a')][_0x83cd('0x1d')]);_0x227bc2[_0x83cd('0x1f')]=qs['offset'](_0x1eefef[_0x83cd('0x3a')][_0x83cd('0x1f')]);}return _0x1501f5[_0x83cd('0x73')](_0x227bc2);}})[_0x83cd('0x23')](function(_0x403292){if(_0x403292){return _0x403292?{'count':_0x56c195,'rows':_0x403292}:null;}})[_0x83cd('0x23')](respondWithResult(_0x4407d7,null))[_0x83cd('0x4a')](handleError(_0x4407d7,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 747410a..e3da5c4 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 _0x8d9e=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','../../config/logger'];(function(_0x1a8c02,_0x26728e){var _0x1240ec=function(_0x4a5f4b){while(--_0x4a5f4b){_0x1a8c02['push'](_0x1a8c02['shift']());}};_0x1240ec(++_0x26728e);}(_0x8d9e,0x99));var _0xe8d9=function(_0x1f55f7,_0x4f8eef){_0x1f55f7=_0x1f55f7-0x0;var _0x47cc15=_0x8d9e[_0x1f55f7];return _0x47cc15;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe8d9('0x0'))(_0xe8d9('0x1'));var moment=require('moment');var BPromise=require(_0xe8d9('0x2'));var rp=require(_0xe8d9('0x3'));var fs=require('fs');var path=require(_0xe8d9('0x4'));var rimraf=require(_0xe8d9('0x5'));var config=require(_0xe8d9('0x6'));var attributes=require(_0xe8d9('0x7'));module[_0xe8d9('0x8')]=function(_0x138807,_0x1020a6){return _0x138807[_0xe8d9('0x9')](_0xe8d9('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2aeb=['exports','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceMusicOnHold.attributes'];(function(_0x546895,_0xb414da){var _0x3b5a09=function(_0x1da01c){while(--_0x1da01c){_0x546895['push'](_0x546895['shift']());}};_0x3b5a09(++_0xb414da);}(_0x2aeb,0x7b));var _0xb2ae=function(_0x223cb4,_0x36cf96){_0x223cb4=_0x223cb4-0x0;var _0x561919=_0x2aeb[_0x223cb4];return _0x561919;};'use strict';var _=require(_0xb2ae('0x0'));var util=require(_0xb2ae('0x1'));var logger=require(_0xb2ae('0x2'))(_0xb2ae('0x3'));var moment=require(_0xb2ae('0x4'));var BPromise=require('bluebird');var rp=require(_0xb2ae('0x5'));var fs=require('fs');var path=require(_0xb2ae('0x6'));var rimraf=require(_0xb2ae('0x7'));var config=require('../../config/environment');var attributes=require(_0xb2ae('0x8'));module[_0xb2ae('0x9')]=function(_0x307f20,_0x57e477){return _0x307f20['define'](_0xb2ae('0xa'),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 113436f..bdb5d0b 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 _0x866e=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error'];(function(_0x421bec,_0x5efe48){var _0x26ad85=function(_0x30cdad){while(--_0x30cdad){_0x421bec['push'](_0x421bec['shift']());}};_0x26ad85(++_0x5efe48);}(_0x866e,0x10b));var _0xe866=function(_0x1ee34f,_0x1a0a8f){_0x1ee34f=_0x1ee34f-0x0;var _0x2a587d=_0x866e[_0x1ee34f];return _0x2a587d;};'use strict';var _=require(_0xe866('0x0'));var util=require(_0xe866('0x1'));var moment=require(_0xe866('0x2'));var BPromise=require(_0xe866('0x3'));var rs=require(_0xe866('0x4'));var fs=require('fs');var Redis=require(_0xe866('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe866('0x6'))(_0xe866('0x7'));var config=require(_0xe866('0x8'));var jayson=require(_0xe866('0x9'));var client=jayson[_0xe866('0xa')][_0xe866('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1edad3,_0xeec5b8,_0x2b2d82){return new BPromise(function(_0xa788a9,_0x3ba3b1){return client['request'](_0x1edad3,_0x2b2d82)[_0xe866('0xc')](function(_0x2d9eeb){logger[_0xe866('0xd')](_0xe866('0xe'),_0xeec5b8,_0xe866('0xf'));logger[_0xe866('0x10')](_0xe866('0x11'),_0xeec5b8,_0xe866('0xf'),JSON['stringify'](_0x2d9eeb));if(_0x2d9eeb[_0xe866('0x12')]){if(_0x2d9eeb[_0xe866('0x12')][_0xe866('0x13')]===0x1f4){logger[_0xe866('0x12')](_0xe866('0xe'),_0xeec5b8,_0x2d9eeb[_0xe866('0x12')][_0xe866('0x14')]);return _0x3ba3b1(_0x2d9eeb['error'][_0xe866('0x14')]);}logger[_0xe866('0x12')](_0xe866('0xe'),_0xeec5b8,_0x2d9eeb[_0xe866('0x12')]['message']);return _0xa788a9(_0x2d9eeb[_0xe866('0x12')][_0xe866('0x14')]);}else{logger[_0xe866('0xd')](_0xe866('0xe'),_0xeec5b8,_0xe866('0xf'));_0xa788a9(_0x2d9eeb['result'][_0xe866('0x14')]);}})[_0xe866('0x15')](function(_0x4ee0e2){logger[_0xe866('0x12')](_0xe866('0xe'),_0xeec5b8,_0x4ee0e2);_0x3ba3b1(_0x4ee0e2);});});} \ No newline at end of file +var _0x9364=['VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x2ab7ff,_0x59435c){var _0x59d1fa=function(_0x2959ac){while(--_0x2959ac){_0x2ab7ff['push'](_0x2ab7ff['shift']());}};_0x59d1fa(++_0x59435c);}(_0x9364,0x1ee));var _0x4936=function(_0x2e3e44,_0x1ff4f5){_0x2e3e44=_0x2e3e44-0x0;var _0x59c0cc=_0x9364[_0x2e3e44];return _0x59c0cc;};'use strict';var _=require('lodash');var util=require(_0x4936('0x0'));var moment=require(_0x4936('0x1'));var BPromise=require(_0x4936('0x2'));var rs=require(_0x4936('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4936('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4936('0x5'))(_0x4936('0x6'));var config=require(_0x4936('0x7'));var jayson=require(_0x4936('0x8'));var client=jayson[_0x4936('0x9')][_0x4936('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57e0c4,_0x32bbce,_0x48967b){return new BPromise(function(_0x1f02e5,_0x415714){return client['request'](_0x57e0c4,_0x48967b)[_0x4936('0xb')](function(_0x2945d9){logger['info'](_0x4936('0xc'),_0x32bbce,'request\x20sent');logger[_0x4936('0xd')](_0x4936('0xe'),_0x32bbce,'request\x20sent',JSON[_0x4936('0xf')](_0x2945d9));if(_0x2945d9['error']){if(_0x2945d9['error'][_0x4936('0x10')]===0x1f4){logger[_0x4936('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x32bbce,_0x2945d9['error'][_0x4936('0x12')]);return _0x415714(_0x2945d9[_0x4936('0x11')][_0x4936('0x12')]);}logger['error'](_0x4936('0xc'),_0x32bbce,_0x2945d9[_0x4936('0x11')][_0x4936('0x12')]);return _0x1f02e5(_0x2945d9[_0x4936('0x11')][_0x4936('0x12')]);}else{logger[_0x4936('0x13')](_0x4936('0xc'),_0x32bbce,_0x4936('0x14'));_0x1f02e5(_0x2945d9['result'][_0x4936('0x12')]);}})[_0x4936('0x15')](function(_0x3d381a){logger['error'](_0x4936('0xc'),_0x32bbce,_0x3d381a);_0x415714(_0x3d381a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 4e89607..59999b8 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 _0x1623=['../../components/auth/service','./voicePrefix.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getAgents','post','create','/:id/users','addAgents','put','delete','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x205e4f,_0x4a681a){var _0x2657a4=function(_0x2b85c8){while(--_0x2b85c8){_0x205e4f['push'](_0x205e4f['shift']());}};_0x2657a4(++_0x4a681a);}(_0x1623,0xab));var _0x3162=function(_0x2c09cd,_0x573df2){_0x2c09cd=_0x2c09cd-0x0;var _0x322380=_0x1623[_0x2c09cd];return _0x322380;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0x3162('0xe')]);router[_0x3162('0xf')]('/',auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0xf')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);router[_0x3162('0x13')]('/:id',auth[_0x3162('0x7')](),controller['update']);router[_0x3162('0x14')](_0x3162('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x3162('0x14')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller['removeAgents']);module[_0x3162('0x15')]=router; \ No newline at end of file +var _0xcaf2=['connect-timeout','Router','fs-extra','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/users','getAgents','post','addAgents','put','update','exports','multer','path'];(function(_0x3edb0a,_0x2997de){var _0xa55d3a=function(_0x4a08e1){while(--_0x4a08e1){_0x3edb0a['push'](_0x3edb0a['shift']());}};_0xa55d3a(++_0x2997de);}(_0xcaf2,0x8a));var _0x2caf=function(_0x15781b,_0x4db9bb){_0x15781b=_0x15781b-0x0;var _0x20f955=_0xcaf2[_0x15781b];return _0x20f955;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var fs_extra=require(_0x2caf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2caf('0x5'));var config=require('../../config/environment');var controller=require(_0x2caf('0x6'));router[_0x2caf('0x7')]('/',auth[_0x2caf('0x8')](),controller['index']);router[_0x2caf('0x7')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xa')]);router['get'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xc')]);router[_0x2caf('0x7')](_0x2caf('0xd'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0xf')]('/',auth[_0x2caf('0x8')](),controller['create']);router[_0x2caf('0xf')](_0x2caf('0xd'),auth[_0x2caf('0x8')](),controller[_0x2caf('0x10')]);router[_0x2caf('0x11')](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0x12')]);router['delete'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller['destroy']);router['delete']('/:id/users',auth[_0x2caf('0x8')](),controller['removeAgents']);module[_0x2caf('0x13')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f65e14d..d7628b7 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 _0x53d4=['VIRTUAL','system-','name','INTEGER','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53d4,0x178));var _0x453d=function(_0x4b8abb,_0x283c07){_0x4b8abb=_0x4b8abb-0x0;var _0x24ec74=_0x53d4[_0x4b8abb];return _0x24ec74;};'use strict';var Sequelize=require(_0x453d('0x0'));module['exports']={'name':{'type':Sequelize[_0x453d('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x453d('0x2')],'get':function(_0x27a18a){return _0x453d('0x3')+this['getDataValue'](_0x453d('0x4'))+'-';}},'description':{'type':Sequelize[_0x453d('0x1')]},'callerIdAll':{'type':Sequelize[_0x453d('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x453d('0x5')]}}; \ No newline at end of file +var _0x89ed=['sequelize','exports','STRING','VIRTUAL','getDataValue','name','INTEGER'];(function(_0x519639,_0x39c8fc){var _0x400edf=function(_0x16f4c6){while(--_0x16f4c6){_0x519639['push'](_0x519639['shift']());}};_0x400edf(++_0x39c8fc);}(_0x89ed,0xa1));var _0xd89e=function(_0x3d01e4,_0x41546e){_0x3d01e4=_0x3d01e4-0x0;var _0x440197=_0x89ed[_0x3d01e4];return _0x440197;};'use strict';var Sequelize=require(_0xd89e('0x0'));module[_0xd89e('0x1')]={'name':{'type':Sequelize[_0xd89e('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xd89e('0x3')],'get':function(_0x43e263){return'system-'+this[_0xd89e('0x4')](_0xd89e('0x5'))+'-';}},'description':{'type':Sequelize[_0xd89e('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xd89e('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index e6ce03c..272768b 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 _0x9457=['VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','push','${EXTEN:','length','charAt','system-','sequelize','findById','params','ids','omit','spread','removeAgents','isArray','emit','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','render','body','message','agent','account','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','VoicePrefix','rows','catch','keys','rawAttributes','find','describe','create','transaction','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0xe2097a,_0x14d43a){var _0x1c6d62=function(_0x31dced){while(--_0x31dced){_0xe2097a['push'](_0xe2097a['shift']());}};_0x1c6d62(++_0x14d43a);}(_0x9457,0xa9));var _0x7945=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9457[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7945('0x0'));var zipdir=require(_0x7945('0x1'));var jsonpatch=require(_0x7945('0x2'));var rp=require(_0x7945('0x3'));var moment=require(_0x7945('0x4'));var BPromise=require(_0x7945('0x5'));var Mustache=require(_0x7945('0x6'));var util=require(_0x7945('0x7'));var path=require(_0x7945('0x8'));var sox=require(_0x7945('0x9'));var csv=require('to-csv');var ejs=require(_0x7945('0xa'));var fs=require('fs');var fs_extra=require(_0x7945('0xb'));var _=require(_0x7945('0xc'));var squel=require(_0x7945('0xd'));var crypto=require(_0x7945('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7945('0xf'));var toCsv=require(_0x7945('0x10'));var querystring=require(_0x7945('0x11'));var Papa=require(_0x7945('0x12'));var Redis=require(_0x7945('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7945('0x14'));var hardwareService=require(_0x7945('0x15'));var logger=require(_0x7945('0x16'))(_0x7945('0x17'));var utils=require(_0x7945('0x18'));var config=require(_0x7945('0x19'));var licenseUtil=require(_0x7945('0x1a'));var db=require(_0x7945('0x1b'))['db'];config[_0x7945('0x1c')]=_[_0x7945('0x1d')](config[_0x7945('0x1c')],{'host':_0x7945('0x1e'),'port':0x18eb});var socket=require(_0x7945('0x1f'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x7945('0x20')](socket);function respondWithStatusCode(_0x50c908,_0x24767f){_0x24767f=_0x24767f||0xcc;return function(_0x36dc7d){if(_0x36dc7d){return _0x50c908[_0x7945('0x21')](_0x24767f);}return _0x50c908[_0x7945('0x22')](_0x24767f)[_0x7945('0x23')]();};}function respondWithResult(_0x7ca61f,_0x23fd7c){_0x23fd7c=_0x23fd7c||0xc8;return function(_0x4f2623){if(_0x4f2623){return _0x7ca61f['status'](_0x23fd7c)[_0x7945('0x24')](_0x4f2623);}};}function respondWithFilteredResult(_0x4cfc53,_0x2daefe){return function(_0x2e1aa0){if(_0x2e1aa0){var _0x5b6f28=typeof _0x2daefe['offset']===_0x7945('0x25')&&typeof _0x2daefe[_0x7945('0x26')]===_0x7945('0x25');var _0x17ad79=_0x2e1aa0[_0x7945('0x27')];var _0x95a4cc=_0x5b6f28?0x0:_0x2daefe[_0x7945('0x28')];var _0x5084de=_0x5b6f28?_0x2e1aa0['count']:_0x2daefe[_0x7945('0x28')]+_0x2daefe[_0x7945('0x26')];var _0xbacf76;if(_0x5084de>=_0x17ad79){_0x5084de=_0x17ad79;_0xbacf76=0xc8;}else{_0xbacf76=0xce;}_0x4cfc53['status'](_0xbacf76);return _0x4cfc53[_0x7945('0x29')]('Content-Range',_0x95a4cc+'-'+_0x5084de+'/'+_0x17ad79)['json'](_0x2e1aa0);}return null;};}function patchUpdates(_0x20a2fb){return function(_0x187ff0){try{jsonpatch[_0x7945('0x2a')](_0x187ff0,_0x20a2fb,!![]);}catch(_0x36fa95){return BPromise[_0x7945('0x2b')](_0x36fa95);}return _0x187ff0['save']();};}function saveUpdates(_0x27fa80,_0x4e0b17){return function(_0x581ca8){if(_0x581ca8){return _0x581ca8[_0x7945('0x2c')](_0x27fa80)[_0x7945('0x2d')](function(_0x58a4fd){return _0x58a4fd;});}return null;};}function removeEntity(_0x344893,_0x295f44){return function(_0x4e4b25){if(_0x4e4b25){return _0x4e4b25[_0x7945('0x2e')]()['then'](function(){var _0x27aedb=_0x4e4b25[_0x7945('0x2f')]({'plain':!![]});var _0xfdda17='VoicePrefixes';return db[_0x7945('0x30')][_0x7945('0x2e')]({'where':{'type':_0xfdda17,'resourceId':_0x27aedb['id']}})[_0x7945('0x2d')](function(){return _0x4e4b25;});})[_0x7945('0x2d')](function(){_0x344893[_0x7945('0x22')](0xcc)[_0x7945('0x23')]();});}};}function handleEntityNotFound(_0x3278dc,_0x39ee29){return function(_0x16c803){if(!_0x16c803){_0x3278dc['sendStatus'](0x194);}return _0x16c803;};}function handleError(_0x1c3185,_0x2dc873){_0x2dc873=_0x2dc873||0x1f4;return function(_0x1b2b1c){logger[_0x7945('0x31')](_0x1b2b1c[_0x7945('0x32')]);if(_0x1b2b1c[_0x7945('0x33')]){delete _0x1b2b1c[_0x7945('0x33')];}_0x1c3185['status'](_0x2dc873)['send'](_0x1b2b1c);};}function getMustacheRender(_0x14b7a9,_0x35dbf3){return Mustache[_0x7945('0x34')](_0x14b7a9,_['merge'](_0x35dbf3[_0x7945('0x35')],{'contact':_0x35dbf3['contact'],'message':_0x35dbf3[_0x7945('0x36')],'agent':_0x35dbf3[_0x7945('0x37')],'interaction':_0x35dbf3['interaction'],'account':_0x35dbf3[_0x7945('0x38')]}))||'';}exports[_0x7945('0x39')]=function(_0x6ecd0d,_0xf6b8e2){var _0x177a64={},_0x2b77ee={},_0x4bb16c={'count':0x0,'rows':[]};var _0x4b61b4=_[_0x7945('0x3a')](db['VoicePrefix']['rawAttributes'],function(_0x3c2c9a){return{'name':_0x3c2c9a[_0x7945('0x3b')],'type':_0x3c2c9a[_0x7945('0x3c')][_0x7945('0x3d')]};});_0x2b77ee[_0x7945('0x3e')]=_[_0x7945('0x3a')](_0x4b61b4,_0x7945('0x33'));_0x2b77ee[_0x7945('0x3f')]=_['keys'](_0x6ecd0d['query']);_0x2b77ee[_0x7945('0x40')]=_[_0x7945('0x41')](_0x2b77ee[_0x7945('0x3e')],_0x2b77ee[_0x7945('0x3f')]);_0x177a64['attributes']=_['intersection'](_0x2b77ee['model'],qs['fields'](_0x6ecd0d['query'][_0x7945('0x42')]));_0x177a64[_0x7945('0x43')]=_0x177a64[_0x7945('0x43')]['length']?_0x177a64[_0x7945('0x43')]:_0x2b77ee[_0x7945('0x3e')];if(!_0x6ecd0d[_0x7945('0x3f')][_0x7945('0x44')](_0x7945('0x45'))){_0x177a64[_0x7945('0x26')]=qs['limit'](_0x6ecd0d[_0x7945('0x3f')]['limit']);_0x177a64[_0x7945('0x28')]=qs[_0x7945('0x28')](_0x6ecd0d['query'][_0x7945('0x28')]);}_0x177a64[_0x7945('0x46')]=qs[_0x7945('0x47')](_0x6ecd0d[_0x7945('0x3f')][_0x7945('0x47')]);_0x177a64[_0x7945('0x48')]=qs[_0x7945('0x40')](_[_0x7945('0x49')](_0x6ecd0d[_0x7945('0x3f')],_0x2b77ee[_0x7945('0x40')]),_0x4b61b4);if(_0x6ecd0d[_0x7945('0x3f')][_0x7945('0x4a')]){_0x177a64[_0x7945('0x48')]=_[_0x7945('0x4b')](_0x177a64['where'],{'$or':_[_0x7945('0x3a')](_0x4b61b4,function(_0x2a099c){if(_0x2a099c[_0x7945('0x3c')]!=='VIRTUAL'){var _0xe6dd77={};_0xe6dd77[_0x2a099c['name']]={'$like':'%'+_0x6ecd0d[_0x7945('0x3f')][_0x7945('0x4a')]+'%'};return _0xe6dd77;}})});}_0x177a64=_['merge']({},_0x177a64,_0x6ecd0d[_0x7945('0x4c')]);var _0xc19ece={'where':_0x177a64['where']};return db['VoicePrefix'][_0x7945('0x27')](_0xc19ece)[_0x7945('0x2d')](function(_0xfafa6d){_0x4bb16c[_0x7945('0x27')]=_0xfafa6d;if(_0x6ecd0d[_0x7945('0x3f')][_0x7945('0x4d')]){_0x177a64[_0x7945('0x4e')]=[{'all':!![]}];}return db[_0x7945('0x4f')]['findAll'](_0x177a64);})['then'](function(_0x88fda1){_0x4bb16c[_0x7945('0x50')]=_0x88fda1;return _0x4bb16c;})[_0x7945('0x2d')](respondWithFilteredResult(_0xf6b8e2,_0x177a64))[_0x7945('0x51')](handleError(_0xf6b8e2,null));};exports['show']=function(_0xd88e6d,_0x33b5ed){var _0x10bf3e={'raw':![],'where':{'id':_0xd88e6d['params']['id']}},_0x1cb76e={};_0x1cb76e[_0x7945('0x3e')]=_[_0x7945('0x52')](db[_0x7945('0x4f')][_0x7945('0x53')]);_0x1cb76e[_0x7945('0x3f')]=_[_0x7945('0x52')](_0xd88e6d[_0x7945('0x3f')]);_0x1cb76e[_0x7945('0x40')]=_[_0x7945('0x41')](_0x1cb76e[_0x7945('0x3e')],_0x1cb76e['query']);_0x10bf3e[_0x7945('0x43')]=_[_0x7945('0x41')](_0x1cb76e[_0x7945('0x3e')],qs[_0x7945('0x42')](_0xd88e6d[_0x7945('0x3f')][_0x7945('0x42')]));_0x10bf3e[_0x7945('0x43')]=_0x10bf3e[_0x7945('0x43')]['length']?_0x10bf3e['attributes']:_0x1cb76e['model'];if(_0xd88e6d[_0x7945('0x3f')][_0x7945('0x4d')]){_0x10bf3e[_0x7945('0x4e')]=[{'all':!![]}];}_0x10bf3e=_[_0x7945('0x4b')]({},_0x10bf3e,_0xd88e6d[_0x7945('0x4c')]);return db[_0x7945('0x4f')][_0x7945('0x54')](_0x10bf3e)[_0x7945('0x2d')](handleEntityNotFound(_0x33b5ed,null))[_0x7945('0x2d')](respondWithResult(_0x33b5ed,null))['catch'](handleError(_0x33b5ed,null));};exports[_0x7945('0x2e')]=function(_0x19870c,_0x4f937c){return db[_0x7945('0x4f')][_0x7945('0x54')]({'where':{'id':_0x19870c['params']['id']}})[_0x7945('0x2d')](handleEntityNotFound(_0x4f937c,null))[_0x7945('0x2d')](removeEntity(_0x4f937c,null))['catch'](handleError(_0x4f937c,null));};exports[_0x7945('0x55')]=function(_0x2a5254,_0x53f7c8){return db[_0x7945('0x4f')][_0x7945('0x55')]()['then'](respondWithResult(_0x53f7c8,null))[_0x7945('0x51')](handleError(_0x53f7c8,null));};exports[_0x7945('0x56')]=function(_0x10428e,_0x451fa9){var _0x3abef3;return db['sequelize'][_0x7945('0x57')](function(_0x567ec8){return db['VoicePrefix'][_0x7945('0x56')](_0x10428e[_0x7945('0x35')],{'transaction':_0x567ec8})['then'](function(_0x1a4f84){_0x3abef3=_0x1a4f84[_0x7945('0x2f')]({'plain':!![]});return db[_0x7945('0x58')][_0x7945('0x54')]({'where':{'id':_0x3abef3[_0x7945('0x59')]},'raw':!![]})[_0x7945('0x2d')](function(_0x180a8f){return createVoicePrefixExtensions(_0x3abef3,_0x180a8f,_0x567ec8);});});})[_0x7945('0x2d')](function(){var _0x664671=_0x10428e['user'][_0x7945('0x2f')]({'plain':!![]});if(!_0x664671)throw new Error(_0x7945('0x5a'));if(_0x664671[_0x7945('0x5b')]===_0x7945('0x5c')){var _0x19a64b=_0x3abef3;return db['UserProfileSection'][_0x7945('0x54')]({'where':{'name':_0x7945('0x5d'),'userProfileId':_0x664671[_0x7945('0x5e')]},'raw':!![]})[_0x7945('0x2d')](function(_0x472b80){if(_0x472b80&&_0x472b80[_0x7945('0x5f')]===0x0){return db[_0x7945('0x30')][_0x7945('0x56')]({'name':_0x19a64b[_0x7945('0x33')],'resourceId':_0x19a64b['id'],'type':_0x472b80[_0x7945('0x33')],'sectionId':_0x472b80['id']},{})[_0x7945('0x2d')](function(){return _0x3abef3;});}else{return _0x3abef3;}})['catch'](function(_0x377052){logger['error'](_0x7945('0x60'),_0x377052);throw _0x377052;});}return _0x3abef3;})[_0x7945('0x2d')](respondWithResult(_0x451fa9,null))[_0x7945('0x51')](handleError(_0x451fa9,null));};function Extension(_0x4a5700,_0x16968f,_0xa7c5d4,_0x3de616){this[_0x7945('0x61')]=_0x7945('0x62');this[_0x7945('0x63')]=_0x4a5700;this['app']=_0xa7c5d4;this['type']=_0x7945('0x64');this[_0x7945('0x65')]='Voice\x20Prefix\x20Extension';this[_0x7945('0x66')]=_0x16968f;this[_0x7945('0x67')]=_0x3de616;}function createVoicePrefixExtensions(_0x87d2d2,_0x461a9d,_0x5ed4a1){return new BPromise(function(_0x4e55c8,_0x45034e){var _0x462766=new Extension(formatPrefixName(_0x87d2d2[_0x7945('0x68')]),0x1,'NoOp',_0x7945('0x69'));_0x462766[_0x7945('0x6a')]=_0x87d2d2['id'];return db[_0x7945('0x58')][_0x7945('0x56')](_0x462766,{'transaction':_0x5ed4a1})['then'](function(_0x220b72){var _0x1c0aba=_0x220b72[_0x7945('0x2f')]({'plain':!![]});var _0x44e288=_[_0x7945('0x3a')](addVoicePrefixExtensions(_0x87d2d2,_0x461a9d),function(_0x50a82f){_0x50a82f[_0x7945('0x59')]=_0x1c0aba['id'];_0x50a82f['VoicePrefixId']=_0x87d2d2['id'];return _0x50a82f;});return db[_0x7945('0x58')][_0x7945('0x6b')](_0x44e288,{'transaction':_0x5ed4a1})['then'](function(_0xecf21d){if(!_0xecf21d){return _0x45034e(_0x7945('0x6c'));}else{return _0x4e55c8(_0xecf21d);}})['catch'](function(_0x19217b){return _0x45034e(_0x19217b);});});;});};function addVoicePrefixExtensions(_0x6fc3f4,_0x543b68){var _0x17044e=[];var _0x28be5c=formatPrefixName(_0x6fc3f4[_0x7945('0x68')]);_0x17044e['push'](new Extension(_0x28be5c,0x2,_0x7945('0x6d'),_0x7945('0x6e')+_0x6fc3f4[_0x7945('0x33')]));if(_0x6fc3f4['callerIdAll']){_0x17044e['push'](new Extension(_0x28be5c,0x3,_0x7945('0x6d'),_0x7945('0x6f')+_0x6fc3f4[_0x7945('0x70')]));}else{_0x17044e['push'](new Extension(_0x28be5c,0x3,_0x7945('0x71'),_0x7945('0x72')));}_0x17044e[_0x7945('0x73')](new Extension(_0x28be5c,0x4,'goto',_0x543b68[_0x7945('0x61')]+','+_0x7945('0x74')+(0x8+_0x6fc3f4[_0x7945('0x33')][_0x7945('0x75')])+'}'+','+0x1));return _0x17044e;}function formatPrefixName(_0x313e01){var _0x24074c='_';for(var _0x1d862e=0x0;_0x1d862e<_0x313e01[_0x7945('0x75')];_0x1d862e++){if(_0x313e01[_0x7945('0x76')](_0x1d862e)=='-'){_0x24074c+=_0x313e01[_0x7945('0x76')](_0x1d862e);}else{_0x24074c+='['+_0x313e01[_0x7945('0x76')](_0x1d862e)+']';}}_0x24074c+='.';return _0x24074c;}exports[_0x7945('0x2c')]=function(_0x2915ae,_0x3c23d6,_0x9a581){var _0x3bef9f=_0x2915ae['body'];_0x3bef9f['prefix']=_0x7945('0x77')+_0x3bef9f['name']+'-';return db[_0x7945('0x78')][_0x7945('0x57')](function(_0x5d08a4){return db[_0x7945('0x4f')][_0x7945('0x2c')](_0x3bef9f,{'where':{'id':_0x3bef9f['id']},'transaction':_0x5d08a4})['then'](function(){return db[_0x7945('0x58')]['destroy']({'where':{'VoicePrefixId':_0x3bef9f['id']},'transaction':_0x5d08a4})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x3bef9f['VoiceExtensionId']},'raw':!![]})[_0x7945('0x2d')](function(_0x2f2ce6){return createVoicePrefixExtensions(_0x3bef9f,_0x2f2ce6,_0x5d08a4);});});});})[_0x7945('0x2d')](function(){return db['VoicePrefix'][_0x7945('0x79')](_0x3bef9f['id']);})['then'](respondWithResult(_0x3c23d6,null))['catch'](handleError(_0x3c23d6,null));};exports['addAgents']=function(_0x2b680f,_0x3d3622,_0x25ff39){return db[_0x7945('0x4f')]['find']({'where':{'id':_0x2b680f[_0x7945('0x7a')]['id']}})[_0x7945('0x2d')](handleEntityNotFound(_0x3d3622,null))[_0x7945('0x2d')](function(_0x573563){if(_0x573563){return _0x573563['addAgents'](_0x2b680f[_0x7945('0x35')][_0x7945('0x7b')],_[_0x7945('0x7c')](_0x2b680f['body'],['ids','id'])||{})[_0x7945('0x7d')](function(_0x5a9a3f){for(var _0x552d9c=0x0;_0x552d9c<_0x2b680f['body']['ids']['length'];_0x552d9c+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x2b680f[_0x7945('0x35')][_0x7945('0x7b')][_0x552d9c],'VoicePrefixId':_0x2b680f['params']['id']});}return _0x5a9a3f;});}})[_0x7945('0x2d')](respondWithResult(_0x3d3622,null))[_0x7945('0x51')](handleError(_0x3d3622,null));};exports[_0x7945('0x7e')]=function(_0x4f0818,_0x2bef8e,_0x15ba05){return db[_0x7945('0x4f')][_0x7945('0x54')]({'where':{'id':_0x4f0818[_0x7945('0x7a')]['id']}})[_0x7945('0x2d')](handleEntityNotFound(_0x2bef8e,null))[_0x7945('0x2d')](function(_0xcad2c6){if(_0xcad2c6){return _0xcad2c6['removeAgents'](_0x4f0818['query'][_0x7945('0x7b')])[_0x7945('0x2d')](function(){if(_[_0x7945('0x7f')](_0x4f0818['query'][_0x7945('0x7b')])){for(var _0x49ecb5=0x0;_0x49ecb5<_0x4f0818[_0x7945('0x3f')][_0x7945('0x7b')][_0x7945('0x75')];_0x49ecb5+=0x1){socket[_0x7945('0x80')]('userVoicePrefix:remove',{'UserId':Number(_0x4f0818[_0x7945('0x3f')][_0x7945('0x7b')][_0x49ecb5]),'VoicePrefixId':Number(_0x4f0818['params']['id'])});}}else{socket[_0x7945('0x80')]('userVoicePrefix:remove',{'UserId':Number(_0x4f0818[_0x7945('0x3f')][_0x7945('0x7b')]),'VoicePrefixId':Number(_0x4f0818[_0x7945('0x7a')]['id'])});}});}})[_0x7945('0x2d')](respondWithStatusCode(_0x2bef8e,null))[_0x7945('0x51')](handleError(_0x2bef8e,null));};exports[_0x7945('0x81')]=function(_0x31d20e,_0x58f1b3,_0x5375e1){var _0x2c36ad={};var _0x1ac674={};var _0xc07093;var _0x34b15c;return db[_0x7945('0x4f')]['findOne']({'where':{'id':_0x31d20e['params']['id']}})['then'](handleEntityNotFound(_0x58f1b3,null))[_0x7945('0x2d')](function(_0x4edde9){if(_0x4edde9){_0xc07093=_0x4edde9;_0x1ac674[_0x7945('0x3e')]=_[_0x7945('0x52')](db[_0x7945('0x82')][_0x7945('0x53')]);_0x1ac674[_0x7945('0x3f')]=_[_0x7945('0x52')](_0x31d20e[_0x7945('0x3f')]);_0x1ac674[_0x7945('0x40')]=_[_0x7945('0x41')](_0x1ac674[_0x7945('0x3e')],_0x1ac674['query']);_0x2c36ad['attributes']=_[_0x7945('0x41')](_0x1ac674['model'],qs[_0x7945('0x42')](_0x31d20e[_0x7945('0x3f')]['fields']));_0x2c36ad[_0x7945('0x43')]=_0x2c36ad[_0x7945('0x43')][_0x7945('0x75')]?_0x2c36ad[_0x7945('0x43')]:_0x1ac674[_0x7945('0x3e')];_0x2c36ad['order']=qs['sort'](_0x31d20e['query'][_0x7945('0x47')]);_0x2c36ad[_0x7945('0x48')]=qs[_0x7945('0x40')](_[_0x7945('0x49')](_0x31d20e[_0x7945('0x3f')],_0x1ac674['filters']));if(_0x31d20e['query'][_0x7945('0x4a')]){_0x2c36ad[_0x7945('0x48')]=_[_0x7945('0x4b')](_0x2c36ad[_0x7945('0x48')],{'$or':_[_0x7945('0x3a')](_0x2c36ad[_0x7945('0x43')],function(_0xce592d){var _0x389ddf={};_0x389ddf[_0xce592d]={'$like':'%'+_0x31d20e[_0x7945('0x3f')][_0x7945('0x4a')]+'%'};return _0x389ddf;})});}_0x2c36ad=_[_0x7945('0x4b')]({},_0x2c36ad,_0x31d20e['options']);return _0xc07093['getAgents'](_0x2c36ad);}})[_0x7945('0x2d')](function(_0x33bc3b){if(_0x33bc3b){_0x34b15c=_0x33bc3b['length'];if(!_0x31d20e[_0x7945('0x3f')][_0x7945('0x44')]('nolimit')){_0x2c36ad['limit']=qs[_0x7945('0x26')](_0x31d20e[_0x7945('0x3f')][_0x7945('0x26')]);_0x2c36ad['offset']=qs[_0x7945('0x28')](_0x31d20e[_0x7945('0x3f')][_0x7945('0x28')]);}return _0xc07093[_0x7945('0x81')](_0x2c36ad);}})['then'](function(_0x33c26e){if(_0x33c26e){return _0x33c26e?{'count':_0x34b15c,'rows':_0x33c26e}:null;}})['then'](respondWithResult(_0x58f1b3,null))['catch'](handleError(_0x58f1b3,null));}; \ No newline at end of file +var _0x3edf=['transaction','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','VoicePrefixes','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','VoiceExtension','findById','addAgents','omit','ids','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','update','then','get','destroy','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','include','findAll','rows','show','rawAttributes','intersection','includeAll','find','catch','params','describe','sequelize'];(function(_0x1cefbb,_0x355822){var _0x3928f2=function(_0x18c2f){while(--_0x18c2f){_0x1cefbb['push'](_0x1cefbb['shift']());}};_0x3928f2(++_0x355822);}(_0x3edf,0x12f));var _0xf3ed=function(_0xc1bead,_0x1a4eaf){_0xc1bead=_0xc1bead-0x0;var _0x39536e=_0x3edf[_0xc1bead];return _0x39536e;};'use strict';var emlformat=require(_0xf3ed('0x0'));var rimraf=require(_0xf3ed('0x1'));var zipdir=require(_0xf3ed('0x2'));var jsonpatch=require(_0xf3ed('0x3'));var rp=require(_0xf3ed('0x4'));var moment=require(_0xf3ed('0x5'));var BPromise=require(_0xf3ed('0x6'));var Mustache=require(_0xf3ed('0x7'));var util=require(_0xf3ed('0x8'));var path=require(_0xf3ed('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf3ed('0xa'));var fs=require('fs');var fs_extra=require(_0xf3ed('0xb'));var _=require(_0xf3ed('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf3ed('0xd'));var querystring=require(_0xf3ed('0xe'));var Papa=require('papaparse');var Redis=require(_0xf3ed('0xf'));var authService=require(_0xf3ed('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3ed('0x11'));var logger=require(_0xf3ed('0x12'))(_0xf3ed('0x13'));var utils=require('../../config/utils');var config=require(_0xf3ed('0x14'));var licenseUtil=require(_0xf3ed('0x15'));var db=require(_0xf3ed('0x16'))['db'];config[_0xf3ed('0x17')]=_[_0xf3ed('0x18')](config[_0xf3ed('0x17')],{'host':_0xf3ed('0x19'),'port':0x18eb});var socket=require(_0xf3ed('0x1a'))(new Redis(config['redis']));require(_0xf3ed('0x1b'))['register'](socket);function respondWithStatusCode(_0x91c728,_0x46cdf1){_0x46cdf1=_0x46cdf1||0xcc;return function(_0x301977){if(_0x301977){return _0x91c728[_0xf3ed('0x1c')](_0x46cdf1);}return _0x91c728['status'](_0x46cdf1)[_0xf3ed('0x1d')]();};}function respondWithResult(_0x3cf59e,_0x211a32){_0x211a32=_0x211a32||0xc8;return function(_0x55208d){if(_0x55208d){return _0x3cf59e[_0xf3ed('0x1e')](_0x211a32)[_0xf3ed('0x1f')](_0x55208d);}};}function respondWithFilteredResult(_0x44c43f,_0x31b437){return function(_0x5af9aa){if(_0x5af9aa){var _0x16bfed=typeof _0x31b437['offset']===_0xf3ed('0x20')&&typeof _0x31b437[_0xf3ed('0x21')]===_0xf3ed('0x20');var _0x1a2034=_0x5af9aa[_0xf3ed('0x22')];var _0x3720e2=_0x16bfed?0x0:_0x31b437['offset'];var _0x12aef2=_0x16bfed?_0x5af9aa[_0xf3ed('0x22')]:_0x31b437[_0xf3ed('0x23')]+_0x31b437[_0xf3ed('0x21')];var _0x53294b;if(_0x12aef2>=_0x1a2034){_0x12aef2=_0x1a2034;_0x53294b=0xc8;}else{_0x53294b=0xce;}_0x44c43f[_0xf3ed('0x1e')](_0x53294b);return _0x44c43f[_0xf3ed('0x24')]('Content-Range',_0x3720e2+'-'+_0x12aef2+'/'+_0x1a2034)[_0xf3ed('0x1f')](_0x5af9aa);}return null;};}function patchUpdates(_0xdb1144){return function(_0x58f7fa){try{jsonpatch[_0xf3ed('0x25')](_0x58f7fa,_0xdb1144,!![]);}catch(_0x2d9640){return BPromise['reject'](_0x2d9640);}return _0x58f7fa['save']();};}function saveUpdates(_0x2ab284,_0x5cf449){return function(_0x3def87){if(_0x3def87){return _0x3def87[_0xf3ed('0x26')](_0x2ab284)[_0xf3ed('0x27')](function(_0x16e19d){return _0x16e19d;});}return null;};}function removeEntity(_0x264749,_0x22c6e4){return function(_0x1e9249){if(_0x1e9249){return _0x1e9249['destroy']()[_0xf3ed('0x27')](function(){var _0xf9fe40=_0x1e9249[_0xf3ed('0x28')]({'plain':!![]});var _0x5721cf='VoicePrefixes';return db['UserProfileResource'][_0xf3ed('0x29')]({'where':{'type':_0x5721cf,'resourceId':_0xf9fe40['id']}})[_0xf3ed('0x27')](function(){return _0x1e9249;});})[_0xf3ed('0x27')](function(){_0x264749[_0xf3ed('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x441578,_0x4aed75){return function(_0x4b9b61){if(!_0x4b9b61){_0x441578[_0xf3ed('0x1c')](0x194);}return _0x4b9b61;};}function handleError(_0xbadbcf,_0xf081bc){_0xf081bc=_0xf081bc||0x1f4;return function(_0x3a2ee3){logger[_0xf3ed('0x2a')](_0x3a2ee3[_0xf3ed('0x2b')]);if(_0x3a2ee3[_0xf3ed('0x2c')]){delete _0x3a2ee3[_0xf3ed('0x2c')];}_0xbadbcf[_0xf3ed('0x1e')](_0xf081bc)[_0xf3ed('0x2d')](_0x3a2ee3);};}function getMustacheRender(_0x5cb1ed,_0x2d99d4){return Mustache[_0xf3ed('0x2e')](_0x5cb1ed,_[_0xf3ed('0x2f')](_0x2d99d4[_0xf3ed('0x30')],{'contact':_0x2d99d4[_0xf3ed('0x31')],'message':_0x2d99d4[_0xf3ed('0x32')],'agent':_0x2d99d4[_0xf3ed('0x33')],'interaction':_0x2d99d4[_0xf3ed('0x34')],'account':_0x2d99d4[_0xf3ed('0x35')]}))||'';}exports[_0xf3ed('0x36')]=function(_0x117b5f,_0x34dfe5){var _0x31b7b5={},_0x5916b5={},_0x5150cb={'count':0x0,'rows':[]};var _0x3e85b5=_[_0xf3ed('0x37')](db[_0xf3ed('0x38')]['rawAttributes'],function(_0x1bdcd5){return{'name':_0x1bdcd5[_0xf3ed('0x39')],'type':_0x1bdcd5[_0xf3ed('0x3a')][_0xf3ed('0x3b')]};});_0x5916b5[_0xf3ed('0x3c')]=_[_0xf3ed('0x37')](_0x3e85b5,_0xf3ed('0x2c'));_0x5916b5[_0xf3ed('0x3d')]=_[_0xf3ed('0x3e')](_0x117b5f[_0xf3ed('0x3d')]);_0x5916b5[_0xf3ed('0x3f')]=_['intersection'](_0x5916b5[_0xf3ed('0x3c')],_0x5916b5['query']);_0x31b7b5[_0xf3ed('0x40')]=_['intersection'](_0x5916b5[_0xf3ed('0x3c')],qs[_0xf3ed('0x41')](_0x117b5f[_0xf3ed('0x3d')][_0xf3ed('0x41')]));_0x31b7b5[_0xf3ed('0x40')]=_0x31b7b5[_0xf3ed('0x40')][_0xf3ed('0x42')]?_0x31b7b5[_0xf3ed('0x40')]:_0x5916b5['model'];if(!_0x117b5f[_0xf3ed('0x3d')][_0xf3ed('0x43')](_0xf3ed('0x44'))){_0x31b7b5[_0xf3ed('0x21')]=qs[_0xf3ed('0x21')](_0x117b5f[_0xf3ed('0x3d')][_0xf3ed('0x21')]);_0x31b7b5['offset']=qs[_0xf3ed('0x23')](_0x117b5f[_0xf3ed('0x3d')][_0xf3ed('0x23')]);}_0x31b7b5[_0xf3ed('0x45')]=qs[_0xf3ed('0x46')](_0x117b5f['query']['sort']);_0x31b7b5[_0xf3ed('0x47')]=qs[_0xf3ed('0x3f')](_['pick'](_0x117b5f[_0xf3ed('0x3d')],_0x5916b5['filters']),_0x3e85b5);if(_0x117b5f[_0xf3ed('0x3d')]['filter']){_0x31b7b5[_0xf3ed('0x47')]=_[_0xf3ed('0x2f')](_0x31b7b5[_0xf3ed('0x47')],{'$or':_[_0xf3ed('0x37')](_0x3e85b5,function(_0x4901f6){if(_0x4901f6['type']!==_0xf3ed('0x48')){var _0x358f3c={};_0x358f3c[_0x4901f6[_0xf3ed('0x2c')]]={'$like':'%'+_0x117b5f[_0xf3ed('0x3d')][_0xf3ed('0x49')]+'%'};return _0x358f3c;}})});}_0x31b7b5=_[_0xf3ed('0x2f')]({},_0x31b7b5,_0x117b5f[_0xf3ed('0x4a')]);var _0x4b623d={'where':_0x31b7b5[_0xf3ed('0x47')]};return db['VoicePrefix'][_0xf3ed('0x22')](_0x4b623d)[_0xf3ed('0x27')](function(_0x346f95){_0x5150cb[_0xf3ed('0x22')]=_0x346f95;if(_0x117b5f['query']['includeAll']){_0x31b7b5[_0xf3ed('0x4b')]=[{'all':!![]}];}return db[_0xf3ed('0x38')][_0xf3ed('0x4c')](_0x31b7b5);})['then'](function(_0x35724e){_0x5150cb[_0xf3ed('0x4d')]=_0x35724e;return _0x5150cb;})[_0xf3ed('0x27')](respondWithFilteredResult(_0x34dfe5,_0x31b7b5))['catch'](handleError(_0x34dfe5,null));};exports[_0xf3ed('0x4e')]=function(_0x71c51f,_0x548906){var _0xd017b0={'raw':![],'where':{'id':_0x71c51f['params']['id']}},_0x5059e9={};_0x5059e9['model']=_[_0xf3ed('0x3e')](db[_0xf3ed('0x38')][_0xf3ed('0x4f')]);_0x5059e9['query']=_[_0xf3ed('0x3e')](_0x71c51f[_0xf3ed('0x3d')]);_0x5059e9[_0xf3ed('0x3f')]=_[_0xf3ed('0x50')](_0x5059e9[_0xf3ed('0x3c')],_0x5059e9[_0xf3ed('0x3d')]);_0xd017b0[_0xf3ed('0x40')]=_['intersection'](_0x5059e9[_0xf3ed('0x3c')],qs[_0xf3ed('0x41')](_0x71c51f[_0xf3ed('0x3d')][_0xf3ed('0x41')]));_0xd017b0[_0xf3ed('0x40')]=_0xd017b0[_0xf3ed('0x40')]['length']?_0xd017b0['attributes']:_0x5059e9[_0xf3ed('0x3c')];if(_0x71c51f[_0xf3ed('0x3d')][_0xf3ed('0x51')]){_0xd017b0[_0xf3ed('0x4b')]=[{'all':!![]}];}_0xd017b0=_[_0xf3ed('0x2f')]({},_0xd017b0,_0x71c51f['options']);return db['VoicePrefix'][_0xf3ed('0x52')](_0xd017b0)[_0xf3ed('0x27')](handleEntityNotFound(_0x548906,null))[_0xf3ed('0x27')](respondWithResult(_0x548906,null))[_0xf3ed('0x53')](handleError(_0x548906,null));};exports['destroy']=function(_0x443525,_0x334532){return db[_0xf3ed('0x38')][_0xf3ed('0x52')]({'where':{'id':_0x443525[_0xf3ed('0x54')]['id']}})[_0xf3ed('0x27')](handleEntityNotFound(_0x334532,null))[_0xf3ed('0x27')](removeEntity(_0x334532,null))[_0xf3ed('0x53')](handleError(_0x334532,null));};exports['describe']=function(_0x44669d,_0xa3303a){return db[_0xf3ed('0x38')][_0xf3ed('0x55')]()[_0xf3ed('0x27')](respondWithResult(_0xa3303a,null))[_0xf3ed('0x53')](handleError(_0xa3303a,null));};exports['create']=function(_0x9cc1df,_0x44cca9){var _0x37268f;return db[_0xf3ed('0x56')][_0xf3ed('0x57')](function(_0x5d8abf){return db[_0xf3ed('0x38')][_0xf3ed('0x58')](_0x9cc1df[_0xf3ed('0x30')],{'transaction':_0x5d8abf})[_0xf3ed('0x27')](function(_0x5a516c){_0x37268f=_0x5a516c[_0xf3ed('0x28')]({'plain':!![]});return db['VoiceExtension'][_0xf3ed('0x52')]({'where':{'id':_0x37268f['VoiceExtensionId']},'raw':!![]})[_0xf3ed('0x27')](function(_0x1bdcf4){return createVoicePrefixExtensions(_0x37268f,_0x1bdcf4,_0x5d8abf);});});})[_0xf3ed('0x27')](function(){var _0x5d0b5b=_0x9cc1df['user'][_0xf3ed('0x28')]({'plain':!![]});if(!_0x5d0b5b)throw new Error(_0xf3ed('0x59'));if(_0x5d0b5b[_0xf3ed('0x5a')]===_0xf3ed('0x5b')){var _0x5a0d95=_0x37268f;return db[_0xf3ed('0x5c')][_0xf3ed('0x52')]({'where':{'name':_0xf3ed('0x5d'),'userProfileId':_0x5d0b5b['userProfileId']},'raw':!![]})[_0xf3ed('0x27')](function(_0xee8a88){if(_0xee8a88&&_0xee8a88[_0xf3ed('0x5e')]===0x0){return db[_0xf3ed('0x5f')][_0xf3ed('0x58')]({'name':_0x5a0d95[_0xf3ed('0x2c')],'resourceId':_0x5a0d95['id'],'type':_0xee8a88[_0xf3ed('0x2c')],'sectionId':_0xee8a88['id']},{})[_0xf3ed('0x27')](function(){return _0x37268f;});}else{return _0x37268f;}})['catch'](function(_0x10ef22){logger[_0xf3ed('0x2a')](_0xf3ed('0x60'),_0x10ef22);throw _0x10ef22;});}return _0x37268f;})[_0xf3ed('0x27')](respondWithResult(_0x44cca9,null))['catch'](handleError(_0x44cca9,null));};function Extension(_0x2c8c32,_0x39e140,_0x2f653e,_0x44a6d6){this[_0xf3ed('0x61')]=_0xf3ed('0x62');this[_0xf3ed('0x63')]=_0x2c8c32;this[_0xf3ed('0x64')]=_0x2f653e;this[_0xf3ed('0x3a')]='system';this[_0xf3ed('0x65')]=_0xf3ed('0x66');this[_0xf3ed('0x67')]=_0x39e140;this[_0xf3ed('0x68')]=_0x44a6d6;}function createVoicePrefixExtensions(_0x38b39f,_0x41778f,_0x37b650){return new BPromise(function(_0xdcd5f7,_0x155ba0){var _0x57fabd=new Extension(formatPrefixName(_0x38b39f[_0xf3ed('0x69')]),0x1,'NoOp','Voice\x20Prefix');_0x57fabd[_0xf3ed('0x6a')]=_0x38b39f['id'];return db['VoiceExtension']['create'](_0x57fabd,{'transaction':_0x37b650})['then'](function(_0x7b1300){var _0x34d969=_0x7b1300[_0xf3ed('0x28')]({'plain':!![]});var _0x4a22ca=_['map'](addVoicePrefixExtensions(_0x38b39f,_0x41778f),function(_0x22ca18){_0x22ca18['VoiceExtensionId']=_0x34d969['id'];_0x22ca18[_0xf3ed('0x6a')]=_0x38b39f['id'];return _0x22ca18;});return db['VoiceExtension']['bulkCreate'](_0x4a22ca,{'transaction':_0x37b650})['then'](function(_0x328744){if(!_0x328744){return _0x155ba0('Extensions\x20creation\x20failed');}else{return _0xdcd5f7(_0x328744);}})['catch'](function(_0x145d5e){return _0x155ba0(_0x145d5e);});});;});};function addVoicePrefixExtensions(_0x58434f,_0x548a05){var _0x538119=[];var _0x55ed07=formatPrefixName(_0x58434f[_0xf3ed('0x69')]);_0x538119[_0xf3ed('0x6b')](new Extension(_0x55ed07,0x2,_0xf3ed('0x6c'),_0xf3ed('0x6d')+_0x58434f[_0xf3ed('0x2c')]));if(_0x58434f[_0xf3ed('0x6e')]){_0x538119[_0xf3ed('0x6b')](new Extension(_0x55ed07,0x3,_0xf3ed('0x6c'),_0xf3ed('0x6f')+_0x58434f[_0xf3ed('0x6e')]));}else{_0x538119[_0xf3ed('0x6b')](new Extension(_0x55ed07,0x3,'NoOp','No\x20callerid\x20available'));}_0x538119['push'](new Extension(_0x55ed07,0x4,_0xf3ed('0x70'),_0x548a05[_0xf3ed('0x61')]+','+_0xf3ed('0x71')+(0x8+_0x58434f[_0xf3ed('0x2c')][_0xf3ed('0x42')])+'}'+','+0x1));return _0x538119;}function formatPrefixName(_0x89e293){var _0x4efda9='_';for(var _0x4fa412=0x0;_0x4fa412<_0x89e293[_0xf3ed('0x42')];_0x4fa412++){if(_0x89e293[_0xf3ed('0x72')](_0x4fa412)=='-'){_0x4efda9+=_0x89e293[_0xf3ed('0x72')](_0x4fa412);}else{_0x4efda9+='['+_0x89e293[_0xf3ed('0x72')](_0x4fa412)+']';}}_0x4efda9+='.';return _0x4efda9;}exports[_0xf3ed('0x26')]=function(_0x23f642,_0x7620da,_0x533889){var _0x283e0f=_0x23f642[_0xf3ed('0x30')];_0x283e0f[_0xf3ed('0x69')]=_0xf3ed('0x73')+_0x283e0f[_0xf3ed('0x2c')]+'-';return db['sequelize'][_0xf3ed('0x57')](function(_0x14c625){return db[_0xf3ed('0x38')][_0xf3ed('0x26')](_0x283e0f,{'where':{'id':_0x283e0f['id']},'transaction':_0x14c625})[_0xf3ed('0x27')](function(){return db[_0xf3ed('0x74')][_0xf3ed('0x29')]({'where':{'VoicePrefixId':_0x283e0f['id']},'transaction':_0x14c625})[_0xf3ed('0x27')](function(){return db[_0xf3ed('0x74')][_0xf3ed('0x52')]({'where':{'id':_0x283e0f['VoiceExtensionId']},'raw':!![]})[_0xf3ed('0x27')](function(_0x157546){return createVoicePrefixExtensions(_0x283e0f,_0x157546,_0x14c625);});});});})[_0xf3ed('0x27')](function(){return db[_0xf3ed('0x38')][_0xf3ed('0x75')](_0x283e0f['id']);})[_0xf3ed('0x27')](respondWithResult(_0x7620da,null))[_0xf3ed('0x53')](handleError(_0x7620da,null));};exports[_0xf3ed('0x76')]=function(_0x16c4bb,_0x44edad,_0x442497){return db['VoicePrefix']['find']({'where':{'id':_0x16c4bb[_0xf3ed('0x54')]['id']}})[_0xf3ed('0x27')](handleEntityNotFound(_0x44edad,null))[_0xf3ed('0x27')](function(_0x513733){if(_0x513733){return _0x513733[_0xf3ed('0x76')](_0x16c4bb[_0xf3ed('0x30')]['ids'],_[_0xf3ed('0x77')](_0x16c4bb[_0xf3ed('0x30')],[_0xf3ed('0x78'),'id'])||{})[_0xf3ed('0x79')](function(_0x166b9c){for(var _0x1e93cc=0x0;_0x1e93cc<_0x16c4bb[_0xf3ed('0x30')]['ids']['length'];_0x1e93cc+=0x1){socket[_0xf3ed('0x7a')]('userVoicePrefix:save',{'UserId':_0x16c4bb[_0xf3ed('0x30')][_0xf3ed('0x78')][_0x1e93cc],'VoicePrefixId':_0x16c4bb[_0xf3ed('0x54')]['id']});}return _0x166b9c;});}})[_0xf3ed('0x27')](respondWithResult(_0x44edad,null))['catch'](handleError(_0x44edad,null));};exports[_0xf3ed('0x7b')]=function(_0x364867,_0x492b3f,_0x137ad7){return db[_0xf3ed('0x38')][_0xf3ed('0x52')]({'where':{'id':_0x364867[_0xf3ed('0x54')]['id']}})[_0xf3ed('0x27')](handleEntityNotFound(_0x492b3f,null))['then'](function(_0x1fca9d){if(_0x1fca9d){return _0x1fca9d[_0xf3ed('0x7b')](_0x364867[_0xf3ed('0x3d')][_0xf3ed('0x78')])[_0xf3ed('0x27')](function(){if(_[_0xf3ed('0x7c')](_0x364867[_0xf3ed('0x3d')]['ids'])){for(var _0x14798d=0x0;_0x14798d<_0x364867['query'][_0xf3ed('0x78')][_0xf3ed('0x42')];_0x14798d+=0x1){socket[_0xf3ed('0x7a')](_0xf3ed('0x7d'),{'UserId':Number(_0x364867['query'][_0xf3ed('0x78')][_0x14798d]),'VoicePrefixId':Number(_0x364867[_0xf3ed('0x54')]['id'])});}}else{socket[_0xf3ed('0x7a')](_0xf3ed('0x7d'),{'UserId':Number(_0x364867[_0xf3ed('0x3d')][_0xf3ed('0x78')]),'VoicePrefixId':Number(_0x364867[_0xf3ed('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x492b3f,null))[_0xf3ed('0x53')](handleError(_0x492b3f,null));};exports[_0xf3ed('0x7e')]=function(_0x44a5c8,_0x5f2d60,_0xc5f9e3){var _0x243408={};var _0xe3976e={};var _0x3ff6a0;var _0x16380a;return db[_0xf3ed('0x38')][_0xf3ed('0x7f')]({'where':{'id':_0x44a5c8[_0xf3ed('0x54')]['id']}})[_0xf3ed('0x27')](handleEntityNotFound(_0x5f2d60,null))['then'](function(_0x3379d8){if(_0x3379d8){_0x3ff6a0=_0x3379d8;_0xe3976e[_0xf3ed('0x3c')]=_['keys'](db[_0xf3ed('0x80')][_0xf3ed('0x4f')]);_0xe3976e[_0xf3ed('0x3d')]=_[_0xf3ed('0x3e')](_0x44a5c8['query']);_0xe3976e['filters']=_[_0xf3ed('0x50')](_0xe3976e[_0xf3ed('0x3c')],_0xe3976e[_0xf3ed('0x3d')]);_0x243408[_0xf3ed('0x40')]=_[_0xf3ed('0x50')](_0xe3976e['model'],qs[_0xf3ed('0x41')](_0x44a5c8[_0xf3ed('0x3d')][_0xf3ed('0x41')]));_0x243408[_0xf3ed('0x40')]=_0x243408['attributes'][_0xf3ed('0x42')]?_0x243408['attributes']:_0xe3976e[_0xf3ed('0x3c')];_0x243408['order']=qs[_0xf3ed('0x46')](_0x44a5c8['query'][_0xf3ed('0x46')]);_0x243408[_0xf3ed('0x47')]=qs[_0xf3ed('0x3f')](_[_0xf3ed('0x81')](_0x44a5c8[_0xf3ed('0x3d')],_0xe3976e[_0xf3ed('0x3f')]));if(_0x44a5c8['query'][_0xf3ed('0x49')]){_0x243408[_0xf3ed('0x47')]=_[_0xf3ed('0x2f')](_0x243408[_0xf3ed('0x47')],{'$or':_[_0xf3ed('0x37')](_0x243408[_0xf3ed('0x40')],function(_0x1e20b0){var _0x58b907={};_0x58b907[_0x1e20b0]={'$like':'%'+_0x44a5c8[_0xf3ed('0x3d')]['filter']+'%'};return _0x58b907;})});}_0x243408=_[_0xf3ed('0x2f')]({},_0x243408,_0x44a5c8[_0xf3ed('0x4a')]);return _0x3ff6a0['getAgents'](_0x243408);}})[_0xf3ed('0x27')](function(_0x93116f){if(_0x93116f){_0x16380a=_0x93116f[_0xf3ed('0x42')];if(!_0x44a5c8[_0xf3ed('0x3d')][_0xf3ed('0x43')]('nolimit')){_0x243408[_0xf3ed('0x21')]=qs[_0xf3ed('0x21')](_0x44a5c8[_0xf3ed('0x3d')][_0xf3ed('0x21')]);_0x243408[_0xf3ed('0x23')]=qs[_0xf3ed('0x23')](_0x44a5c8[_0xf3ed('0x3d')]['offset']);}return _0x3ff6a0[_0xf3ed('0x7e')](_0x243408);}})[_0xf3ed('0x27')](function(_0x43fa3b){if(_0x43fa3b){return _0x43fa3b?{'count':_0x16380a,'rows':_0x43fa3b}:null;}})[_0xf3ed('0x27')](respondWithResult(_0x5f2d60,null))[_0xf3ed('0x53')](handleError(_0x5f2d60,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 931dbe0..1dc6d7d 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 _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x34e8,0x12c));var _0x834e=function(_0x17da93,_0x4a9d5d){_0x17da93=_0x17da93-0x0;var _0x303f60=_0x34e8[_0x17da93];return _0x303f60;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 30ede59..e65e962 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 _0xdd9e=['./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x38e00e,_0x3ed345){var _0x3cc248=function(_0x3cb0c7){while(--_0x3cb0c7){_0x38e00e['push'](_0x38e00e['shift']());}};_0x3cc248(++_0x3ed345);}(_0xdd9e,0x157));var _0xedd9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdd9e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xedd9('0x0'));var util=require(_0xedd9('0x1'));var logger=require(_0xedd9('0x2'))(_0xedd9('0x3'));var moment=require('moment');var BPromise=require(_0xedd9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xedd9('0x5'));var rimraf=require(_0xedd9('0x6'));var config=require(_0xedd9('0x7'));var attributes=require(_0xedd9('0x8'));module[_0xedd9('0x9')]=function(_0x51826a,_0x287ffa){return _0x51826a[_0xedd9('0xa')](_0xedd9('0xb'),attributes,{'tableName':_0xedd9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0159=['../../config/logger','moment','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x0159,0xcf));var _0x9015=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0159[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9015('0x0'));var util=require(_0x9015('0x1'));var logger=require(_0x9015('0x2'))('api');var moment=require(_0x9015('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9015('0x4'));var rimraf=require(_0x9015('0x5'));var config=require(_0x9015('0x6'));var attributes=require(_0x9015('0x7'));module[_0x9015('0x8')]=function(_0x353250,_0x38800b){return _0x353250[_0x9015('0x9')](_0x9015('0xa'),attributes,{'tableName':'voice_prefixes','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 7f748cf..a93df69 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 _0x43a2=['request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','socket.io-emitter','redis','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s'];(function(_0x2f196c,_0x4317ca){var _0x27191d=function(_0x124ba2){while(--_0x124ba2){_0x2f196c['push'](_0x2f196c['shift']());}};_0x27191d(++_0x4317ca);}(_0x43a2,0xd0));var _0x243a=function(_0x1a85fa,_0x17eea7){_0x1a85fa=_0x1a85fa-0x0;var _0x342d33=_0x43a2[_0x1a85fa];return _0x342d33;};'use strict';var _=require('lodash');var util=require(_0x243a('0x0'));var moment=require(_0x243a('0x1'));var BPromise=require(_0x243a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x243a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x243a('0x4'));var logger=require(_0x243a('0x5'))(_0x243a('0x6'));var config=require(_0x243a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x243a('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x243a('0x9'))(new Redis(config[_0x243a('0xa')]));require(_0x243a('0xb'))[_0x243a('0xc')](socket);function respondWithRpcPromise(_0x39b0fc,_0x41a114,_0x5a1f51){return new BPromise(function(_0x497be7,_0x195162){return client[_0x243a('0xd')](_0x39b0fc,_0x5a1f51)[_0x243a('0xe')](function(_0x372eb8){logger[_0x243a('0xf')](_0x243a('0x10'),_0x41a114,_0x243a('0x11'));logger[_0x243a('0x12')](_0x243a('0x13'),_0x41a114,_0x243a('0x11'),JSON[_0x243a('0x14')](_0x372eb8));if(_0x372eb8[_0x243a('0x15')]){if(_0x372eb8[_0x243a('0x15')][_0x243a('0x16')]===0x1f4){logger[_0x243a('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x41a114,_0x372eb8[_0x243a('0x15')][_0x243a('0x17')]);return _0x195162(_0x372eb8[_0x243a('0x15')]['message']);}logger[_0x243a('0x15')](_0x243a('0x10'),_0x41a114,_0x372eb8[_0x243a('0x15')][_0x243a('0x17')]);return _0x497be7(_0x372eb8['error']['message']);}else{logger[_0x243a('0xf')](_0x243a('0x10'),_0x41a114,_0x243a('0x11'));_0x497be7(_0x372eb8['result'][_0x243a('0x17')]);}})[_0x243a('0x18')](function(_0xf4cdb8){logger[_0x243a('0x15')](_0x243a('0x10'),_0x41a114,_0xf4cdb8);_0x195162(_0xf4cdb8);});});} \ No newline at end of file +var _0x8a15=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x282f9a,_0x63dff){var _0x52528c=function(_0xcf1c4c){while(--_0xcf1c4c){_0x282f9a['push'](_0x282f9a['shift']());}};_0x52528c(++_0x63dff);}(_0x8a15,0x17a));var _0x58a1=function(_0x3f6bab,_0x47fdb0){_0x3f6bab=_0x3f6bab-0x0;var _0x26d34b=_0x8a15[_0x3f6bab];return _0x26d34b;};'use strict';var _=require(_0x58a1('0x0'));var util=require(_0x58a1('0x1'));var moment=require(_0x58a1('0x2'));var BPromise=require(_0x58a1('0x3'));var rs=require(_0x58a1('0x4'));var fs=require('fs');var Redis=require(_0x58a1('0x5'));var db=require(_0x58a1('0x6'))['db'];var utils=require(_0x58a1('0x7'));var logger=require('../../config/logger')(_0x58a1('0x8'));var config=require(_0x58a1('0x9'));var jayson=require(_0x58a1('0xa'));var client=jayson['client'][_0x58a1('0xb')]({'port':0x232a});config[_0x58a1('0xc')]=_[_0x58a1('0xd')](config[_0x58a1('0xc')],{'host':_0x58a1('0xe'),'port':0x18eb});var socket=require(_0x58a1('0xf'))(new Redis(config[_0x58a1('0xc')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x561858,_0x47bbbc,_0x40e959){return new BPromise(function(_0x4b323d,_0x1d87c7){return client[_0x58a1('0x10')](_0x561858,_0x40e959)['then'](function(_0x47fcf9){logger[_0x58a1('0x11')](_0x58a1('0x12'),_0x47bbbc,_0x58a1('0x13'));logger['debug'](_0x58a1('0x14'),_0x47bbbc,'request\x20sent',JSON[_0x58a1('0x15')](_0x47fcf9));if(_0x47fcf9[_0x58a1('0x16')]){if(_0x47fcf9['error'][_0x58a1('0x17')]===0x1f4){logger['error'](_0x58a1('0x12'),_0x47bbbc,_0x47fcf9[_0x58a1('0x16')][_0x58a1('0x18')]);return _0x1d87c7(_0x47fcf9[_0x58a1('0x16')][_0x58a1('0x18')]);}logger['error'](_0x58a1('0x12'),_0x47bbbc,_0x47fcf9[_0x58a1('0x16')][_0x58a1('0x18')]);return _0x4b323d(_0x47fcf9[_0x58a1('0x16')]['message']);}else{logger[_0x58a1('0x11')](_0x58a1('0x12'),_0x47bbbc,'request\x20sent');_0x4b323d(_0x47fcf9[_0x58a1('0x19')][_0x58a1('0x18')]);}})[_0x58a1('0x1a')](function(_0x350a64){logger[_0x58a1('0x16')](_0x58a1('0x12'),_0x47bbbc,_0x350a64);_0x1d87c7(_0x350a64);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a1a64a3..2edeaa4 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 _0xc6ec=['update','emit','register','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc6ec,0xa5));var _0xcc6e=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0xc6ec[_0x3a13cf];return _0x4817c;};'use strict';var VoicePrefixEvents=require(_0xcc6e('0x0'));var events=[_0xcc6e('0x1'),_0xcc6e('0x2'),_0xcc6e('0x3')];function createListener(_0x4b9fe0,_0x5b2548){return function(_0x32ea3c){_0x5b2548[_0xcc6e('0x4')](_0x4b9fe0,_0x32ea3c);};}function removeListener(_0x2f19e7,_0x457c27){return function(){VoicePrefixEvents['removeListener'](_0x2f19e7,_0x457c27);};}exports[_0xcc6e('0x5')]=function(_0x16d4f1){for(var _0x2fb1cc=0x0,_0x59ad60=events['length'];_0x2fb1cc<_0x59ad60;_0x2fb1cc++){var _0x36db10=events[_0x2fb1cc];var _0x85e2e7=createListener(_0xcc6e('0x6')+_0x36db10,_0x16d4f1);VoicePrefixEvents['on'](_0x36db10,_0x85e2e7);}}; \ No newline at end of file +var _0x0791=['update','emit','removeListener','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x7aacd7,_0x5520eb){var _0x4b5f8c=function(_0x34024f){while(--_0x34024f){_0x7aacd7['push'](_0x7aacd7['shift']());}};_0x4b5f8c(++_0x5520eb);}(_0x0791,0xb4));var _0x1079=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x0791[_0x183b97];return _0x629cf7;};'use strict';var VoicePrefixEvents=require(_0x1079('0x0'));var events=[_0x1079('0x1'),'remove',_0x1079('0x2')];function createListener(_0x33e1f2,_0x1ef6df){return function(_0x477499){_0x1ef6df[_0x1079('0x3')](_0x33e1f2,_0x477499);};}function removeListener(_0x208c22,_0x3ecf55){return function(){VoicePrefixEvents[_0x1079('0x4')](_0x208c22,_0x3ecf55);};}exports['register']=function(_0x5d2023){for(var _0xac33c8=0x0,_0x30cc09=events[_0x1079('0x5')];_0xac33c8<_0x30cc09;_0xac33c8++){var _0x27ae5f=events[_0xac33c8];var _0x4d435d=createListener(_0x1079('0x6')+_0x27ae5f,_0x5d2023);VoicePrefixEvents['on'](_0x27ae5f,_0x4d435d);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index f73157b..7e0ad18 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 _0x47dd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents','/:id/members','/:id/lists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','/:id/teams','addAgents','addLists','put','update','destroy','delete','removeTeams','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express'];(function(_0x3bff42,_0x3e4bdf){var _0x24437e=function(_0x2bcbb3){while(--_0x2bcbb3){_0x3bff42['push'](_0x3bff42['shift']());}};_0x24437e(++_0x3e4bdf);}(_0x47dd,0x176));var _0xd47d=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0x47dd[_0x318410];return _0x2898a3;};'use strict';var multer=require(_0xd47d('0x0'));var util=require('util');var path=require(_0xd47d('0x1'));var timeout=require(_0xd47d('0x2'));var express=require(_0xd47d('0x3'));var router=express[_0xd47d('0x4')]();var fs_extra=require(_0xd47d('0x5'));var auth=require(_0xd47d('0x6'));var interaction=require(_0xd47d('0x7'));var config=require(_0xd47d('0x8'));var controller=require(_0xd47d('0x9'));router[_0xd47d('0xa')]('/',auth[_0xd47d('0xb')](),controller['index']);router[_0xd47d('0xa')](_0xd47d('0xc'),auth['isAuthenticated'](),controller[_0xd47d('0xd')]);router[_0xd47d('0xa')](_0xd47d('0xe'),auth[_0xd47d('0xb')](),controller[_0xd47d('0xf')]);router[_0xd47d('0xa')](_0xd47d('0x10'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xd47d('0xa')](_0xd47d('0x11'),auth[_0xd47d('0xb')](),controller['getHopperFinals']);router[_0xd47d('0xa')](_0xd47d('0x12'),auth[_0xd47d('0xb')](),controller[_0xd47d('0x13')]);router[_0xd47d('0xa')]('/:id/teams',auth[_0xd47d('0xb')](),controller[_0xd47d('0x14')]);router[_0xd47d('0xa')](_0xd47d('0x15'),auth[_0xd47d('0xb')](),controller[_0xd47d('0x16')]);router[_0xd47d('0xa')](_0xd47d('0x17'),auth['isAuthenticated'](),controller['getMembers']);router[_0xd47d('0xa')](_0xd47d('0x18'),auth[_0xd47d('0xb')](),controller['getLists']);router['get'](_0xd47d('0x19'),auth[_0xd47d('0xb')](),controller[_0xd47d('0x1a')]);router['post']('/',auth[_0xd47d('0xb')](),controller[_0xd47d('0x1b')]);router[_0xd47d('0x1c')](_0xd47d('0x1d'),auth[_0xd47d('0xb')](),controller[_0xd47d('0x1e')]);router['post'](_0xd47d('0x1f'),auth['isAuthenticated'](),controller['addTeams']);router[_0xd47d('0x1c')](_0xd47d('0x15'),auth['isAuthenticated'](),controller[_0xd47d('0x20')]);router[_0xd47d('0x1c')](_0xd47d('0x18'),auth['isAuthenticated'](),controller[_0xd47d('0x21')]);router[_0xd47d('0x1c')](_0xd47d('0x19'),auth[_0xd47d('0xb')](),controller['addBlackLists']);router[_0xd47d('0x22')](_0xd47d('0xc'),auth['isAuthenticated'](),controller[_0xd47d('0x23')]);router['delete'](_0xd47d('0xc'),auth[_0xd47d('0xb')](),controller[_0xd47d('0x24')]);router[_0xd47d('0x25')](_0xd47d('0x1f'),auth[_0xd47d('0xb')](),controller[_0xd47d('0x26')]);router['delete'](_0xd47d('0x15'),auth['isAuthenticated'](),controller['removeAgents']);router['delete'](_0xd47d('0x18'),auth[_0xd47d('0xb')](),controller[_0xd47d('0x27')]);router[_0xd47d('0x25')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xd47d('0x28')]);module[_0xd47d('0x29')]=router; \ No newline at end of file +var _0xc55e=['isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getTeams','getAgents','/:id/members','getLists','/:id/blacklists','post','create','/:id/clone','/:id/teams','addTeams','/:id/users','addAgents','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get'];(function(_0x31158f,_0x235311){var _0x158b17=function(_0x14e247){while(--_0x14e247){_0x31158f['push'](_0x31158f['shift']());}};_0x158b17(++_0x235311);}(_0xc55e,0x1d9));var _0xec55=function(_0x250648,_0x291318){_0x250648=_0x250648-0x0;var _0x17e04e=_0xc55e[_0x250648];return _0x17e04e;};'use strict';var multer=require(_0xec55('0x0'));var util=require(_0xec55('0x1'));var path=require(_0xec55('0x2'));var timeout=require(_0xec55('0x3'));var express=require(_0xec55('0x4'));var router=express[_0xec55('0x5')]();var fs_extra=require(_0xec55('0x6'));var auth=require(_0xec55('0x7'));var interaction=require(_0xec55('0x8'));var config=require('../../config/environment');var controller=require(_0xec55('0x9'));router[_0xec55('0xa')]('/',auth[_0xec55('0xb')](),controller[_0xec55('0xc')]);router[_0xec55('0xa')](_0xec55('0xd'),auth[_0xec55('0xb')](),controller[_0xec55('0xe')]);router[_0xec55('0xa')](_0xec55('0xf'),auth[_0xec55('0xb')](),controller[_0xec55('0x10')]);router[_0xec55('0xa')]('/:id/hopper_histories',auth[_0xec55('0xb')](),controller[_0xec55('0x11')]);router[_0xec55('0xa')](_0xec55('0x12'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xec55('0xa')](_0xec55('0x13'),auth[_0xec55('0xb')](),controller[_0xec55('0x14')]);router['get']('/:id/teams',auth[_0xec55('0xb')](),controller[_0xec55('0x15')]);router[_0xec55('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xec55('0x16')]);router[_0xec55('0xa')](_0xec55('0x17'),auth['isAuthenticated'](),controller['getMembers']);router[_0xec55('0xa')]('/:id/lists',auth[_0xec55('0xb')](),controller[_0xec55('0x18')]);router[_0xec55('0xa')](_0xec55('0x19'),auth[_0xec55('0xb')](),controller['getBlackLists']);router[_0xec55('0x1a')]('/',auth[_0xec55('0xb')](),controller[_0xec55('0x1b')]);router['post'](_0xec55('0x1c'),auth['isAuthenticated'](),controller['clone']);router[_0xec55('0x1a')](_0xec55('0x1d'),auth[_0xec55('0xb')](),controller[_0xec55('0x1e')]);router[_0xec55('0x1a')](_0xec55('0x1f'),auth[_0xec55('0xb')](),controller[_0xec55('0x20')]);router[_0xec55('0x1a')]('/:id/lists',auth[_0xec55('0xb')](),controller[_0xec55('0x21')]);router[_0xec55('0x1a')](_0xec55('0x19'),auth[_0xec55('0xb')](),controller[_0xec55('0x22')]);router[_0xec55('0x23')](_0xec55('0xd'),auth['isAuthenticated'](),controller[_0xec55('0x24')]);router[_0xec55('0x25')]('/:id',auth[_0xec55('0xb')](),controller[_0xec55('0x26')]);router[_0xec55('0x25')](_0xec55('0x1d'),auth['isAuthenticated'](),controller[_0xec55('0x27')]);router[_0xec55('0x25')](_0xec55('0x1f'),auth[_0xec55('0xb')](),controller[_0xec55('0x28')]);router[_0xec55('0x25')]('/:id/lists',auth[_0xec55('0xb')](),controller[_0xec55('0x29')]);router[_0xec55('0x25')]('/:id/blacklists',auth[_0xec55('0xb')](),controller[_0xec55('0x2a')]);module[_0xec55('0x2b')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 028c0ab..b448fa7 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 _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x31ce33,_0x1a7f94){var _0x32d860=function(_0x3bae39){while(--_0x3bae39){_0x31ce33['push'](_0x31ce33['shift']());}};_0x32d860(++_0x1a7f94);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x5b5b5f,_0x1d88f8){var _0x380741=function(_0x11ccc0){while(--_0x11ccc0){_0x5b5b5f['push'](_0x5b5b5f['shift']());}};_0x380741(++_0x1d88f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'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 763f2c3..b08cb35 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 _0xfded=['select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','isEmpty','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','QueueCampaigns','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','render','merge','body','contact','message','interaction','account','map','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','VoiceQueue','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','inbound','outbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','createdAt','updatedAt','user','UserProfileSection','userProfileId','getHoppers','findOne','CmHopper','sort','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0x50eb44,_0x3d955f){var _0x4742df=function(_0x87c95e){while(--_0x87c95e){_0x50eb44['push'](_0x50eb44['shift']());}};_0x4742df(++_0x3d955f);}(_0xfded,0xf7));var _0xdfde=function(_0x1599b5,_0x28b24b){_0x1599b5=_0x1599b5-0x0;var _0x22b161=_0xfded[_0x1599b5];return _0x22b161;};'use strict';var emlformat=require(_0xdfde('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdfde('0x1'));var rp=require(_0xdfde('0x2'));var moment=require(_0xdfde('0x3'));var BPromise=require(_0xdfde('0x4'));var Mustache=require(_0xdfde('0x5'));var util=require(_0xdfde('0x6'));var path=require(_0xdfde('0x7'));var sox=require(_0xdfde('0x8'));var csv=require(_0xdfde('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfde('0xa'));var _=require(_0xdfde('0xb'));var squel=require(_0xdfde('0xc'));var crypto=require('crypto');var jsforce=require(_0xdfde('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdfde('0xe'));var Papa=require(_0xdfde('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdfde('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfde('0x11'));var logger=require(_0xdfde('0x12'))(_0xdfde('0x13'));var utils=require(_0xdfde('0x14'));var config=require(_0xdfde('0x15'));var licenseUtil=require(_0xdfde('0x16'));var db=require(_0xdfde('0x17'))['db'];config['redis']=_[_0xdfde('0x18')](config[_0xdfde('0x19')],{'host':_0xdfde('0x1a'),'port':0x18eb});var socket=require(_0xdfde('0x1b'))(new Redis(config[_0xdfde('0x19')]));require(_0xdfde('0x1c'))[_0xdfde('0x1d')](socket);function respondWithStatusCode(_0x36670e,_0x46fd39){_0x46fd39=_0x46fd39||0xcc;return function(_0x413c7c){if(_0x413c7c){return _0x36670e['sendStatus'](_0x46fd39);}return _0x36670e[_0xdfde('0x1e')](_0x46fd39)['end']();};}function respondWithResult(_0x1712cb,_0x483e68){_0x483e68=_0x483e68||0xc8;return function(_0x3cbd90){if(_0x3cbd90){return _0x1712cb['status'](_0x483e68)[_0xdfde('0x1f')](_0x3cbd90);}};}function respondWithFilteredResult(_0x2b4e4e,_0x5a9257){return function(_0x5eff88){if(_0x5eff88){var _0x56826c=typeof _0x5a9257[_0xdfde('0x20')]===_0xdfde('0x21')&&typeof _0x5a9257['limit']===_0xdfde('0x21');var _0xb29d02=_0x5eff88['count'];var _0x40661e=_0x56826c?0x0:_0x5a9257['offset'];var _0x27ceb2=_0x56826c?_0x5eff88[_0xdfde('0x22')]:_0x5a9257[_0xdfde('0x20')]+_0x5a9257[_0xdfde('0x23')];var _0x56e62d;if(_0x27ceb2>=_0xb29d02){_0x27ceb2=_0xb29d02;_0x56e62d=0xc8;}else{_0x56e62d=0xce;}_0x2b4e4e[_0xdfde('0x1e')](_0x56e62d);return _0x2b4e4e[_0xdfde('0x24')]('Content-Range',_0x40661e+'-'+_0x27ceb2+'/'+_0xb29d02)['json'](_0x5eff88);}return null;};}function patchUpdates(_0x5eccc2){return function(_0x17140d){try{jsonpatch[_0xdfde('0x25')](_0x17140d,_0x5eccc2,!![]);}catch(_0x39c266){return BPromise[_0xdfde('0x26')](_0x39c266);}return _0x17140d['save']();};}function saveUpdates(_0x50ddfe,_0x3a2f38){return function(_0x5d7b2e){if(_0x5d7b2e){return _0x5d7b2e[_0xdfde('0x27')](_0x50ddfe)[_0xdfde('0x28')](function(_0xe2bb88){return _0xe2bb88;});}return null;};}function removeEntity(_0x299cc1,_0x2dd139){return function(_0xc6c95e){if(_0xc6c95e){return _0xc6c95e[_0xdfde('0x29')]()[_0xdfde('0x28')](function(){var _0x488c2b=_0xc6c95e[_0xdfde('0x2a')]({'plain':!![]});var _0x5b7dde=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0xdfde('0x2b'),'value':'outbound','ignore':![]}];var _0x3ccf0d=_(_0x5b7dde)['filter'](_0xdfde('0x2c'))['map'](_0xdfde('0x2d'))[_0xdfde('0x2d')]();if(_[_0xdfde('0x2e')](_0x3ccf0d,_0x488c2b[_0xdfde('0x2f')])){return;}var _0x1f4635=_[_0xdfde('0x30')](_0x5b7dde,[_0xdfde('0x2d'),_0x488c2b['type']])[_0xdfde('0x31')];return db[_0xdfde('0x32')][_0xdfde('0x29')]({'where':{'type':_0x1f4635,'resourceId':_0x488c2b['id']}})['then'](function(){return _0xc6c95e;});})[_0xdfde('0x28')](function(){_0x299cc1[_0xdfde('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x98a0c0,_0x2c3a8d){return function(_0x9297a6){if(!_0x9297a6){_0x98a0c0['sendStatus'](0x194);}return _0x9297a6;};}function handleError(_0x17a502,_0x4ce4c4){_0x4ce4c4=_0x4ce4c4||0x1f4;return function(_0x2730c3){logger[_0xdfde('0x33')](_0x2730c3[_0xdfde('0x34')]);if(_0x2730c3[_0xdfde('0x31')]){delete _0x2730c3[_0xdfde('0x31')];}_0x17a502['status'](_0x4ce4c4)[_0xdfde('0x35')](_0x2730c3);};}function getMustacheRender(_0x2f83a5,_0x4231ba){return Mustache[_0xdfde('0x36')](_0x2f83a5,_[_0xdfde('0x37')](_0x4231ba[_0xdfde('0x38')],{'contact':_0x4231ba[_0xdfde('0x39')],'message':_0x4231ba[_0xdfde('0x3a')],'agent':_0x4231ba['agent'],'interaction':_0x4231ba[_0xdfde('0x3b')],'account':_0x4231ba[_0xdfde('0x3c')]}))||'';}exports['index']=function(_0x3b991f,_0x5058c9){var _0x4bd414={},_0x24c7e5={},_0x151429={'count':0x0,'rows':[]};var _0x1a5066=_[_0xdfde('0x3d')](db['VoiceQueue']['rawAttributes'],function(_0x26f244){return{'name':_0x26f244[_0xdfde('0x3e')],'type':_0x26f244[_0xdfde('0x2f')]['key']};});_0x24c7e5['model']=_[_0xdfde('0x3d')](_0x1a5066,_0xdfde('0x31'));_0x24c7e5[_0xdfde('0x3f')]=_[_0xdfde('0x40')](_0x3b991f[_0xdfde('0x3f')]);_0x24c7e5[_0xdfde('0x41')]=_['intersection'](_0x24c7e5[_0xdfde('0x42')],_0x24c7e5['query']);_0x4bd414[_0xdfde('0x43')]=_[_0xdfde('0x44')](_0x24c7e5[_0xdfde('0x42')],qs[_0xdfde('0x45')](_0x3b991f['query']['fields']));_0x4bd414['attributes']=_0x4bd414[_0xdfde('0x43')][_0xdfde('0x46')]?_0x4bd414[_0xdfde('0x43')]:_0x24c7e5['model'];if(!_0x3b991f[_0xdfde('0x3f')][_0xdfde('0x47')](_0xdfde('0x48'))){_0x4bd414[_0xdfde('0x23')]=qs[_0xdfde('0x23')](_0x3b991f[_0xdfde('0x3f')][_0xdfde('0x23')]);_0x4bd414[_0xdfde('0x20')]=qs[_0xdfde('0x20')](_0x3b991f[_0xdfde('0x3f')]['offset']);}_0x4bd414['order']=qs['sort'](_0x3b991f['query']['sort']);_0x4bd414[_0xdfde('0x49')]=qs[_0xdfde('0x41')](_[_0xdfde('0x4a')](_0x3b991f['query'],_0x24c7e5[_0xdfde('0x41')]),_0x1a5066);if(_0x3b991f['query'][_0xdfde('0x4b')]){_0x4bd414[_0xdfde('0x49')]=_[_0xdfde('0x37')](_0x4bd414[_0xdfde('0x49')],{'$or':_[_0xdfde('0x3d')](_0x1a5066,function(_0x3f1254){if(_0x3f1254[_0xdfde('0x2f')]!==_0xdfde('0x4c')){var _0x380932={};_0x380932[_0x3f1254['name']]={'$like':'%'+_0x3b991f[_0xdfde('0x3f')][_0xdfde('0x4b')]+'%'};return _0x380932;}})});}_0x4bd414=_[_0xdfde('0x37')]({},_0x4bd414,_0x3b991f[_0xdfde('0x4d')]);var _0x310158={'where':_0x4bd414[_0xdfde('0x49')]};return db['VoiceQueue'][_0xdfde('0x22')](_0x310158)[_0xdfde('0x28')](function(_0x44ab11){_0x151429['count']=_0x44ab11;if(_0x3b991f[_0xdfde('0x3f')][_0xdfde('0x4e')]){_0x4bd414[_0xdfde('0x4f')]=[{'all':!![]}];}return db['VoiceQueue'][_0xdfde('0x50')](_0x4bd414);})[_0xdfde('0x28')](function(_0x5d4ae2){_0x151429['rows']=_0x5d4ae2;return _0x151429;})[_0xdfde('0x28')](respondWithFilteredResult(_0x5058c9,_0x4bd414))[_0xdfde('0x51')](handleError(_0x5058c9,null));};exports[_0xdfde('0x52')]=function(_0x39ca2e,_0x6414c5){var _0x29e7b3={'raw':![],'where':{'id':_0x39ca2e[_0xdfde('0x53')]['id']}},_0xfe6fc6={};_0xfe6fc6[_0xdfde('0x42')]=_['keys'](db[_0xdfde('0x54')]['rawAttributes']);_0xfe6fc6[_0xdfde('0x3f')]=_[_0xdfde('0x40')](_0x39ca2e[_0xdfde('0x3f')]);_0xfe6fc6[_0xdfde('0x41')]=_[_0xdfde('0x44')](_0xfe6fc6[_0xdfde('0x42')],_0xfe6fc6['query']);_0x29e7b3[_0xdfde('0x43')]=_['intersection'](_0xfe6fc6['model'],qs[_0xdfde('0x45')](_0x39ca2e[_0xdfde('0x3f')][_0xdfde('0x45')]));_0x29e7b3[_0xdfde('0x43')]=_0x29e7b3['attributes']['length']?_0x29e7b3[_0xdfde('0x43')]:_0xfe6fc6['model'];if(_0x39ca2e[_0xdfde('0x3f')][_0xdfde('0x4e')]){_0x29e7b3['include']=[{'all':!![]}];}_0x29e7b3=_[_0xdfde('0x37')]({},_0x29e7b3,_0x39ca2e[_0xdfde('0x4d')]);return db[_0xdfde('0x54')]['find'](_0x29e7b3)[_0xdfde('0x28')](handleEntityNotFound(_0x6414c5,null))[_0xdfde('0x28')](respondWithResult(_0x6414c5,null))[_0xdfde('0x51')](handleError(_0x6414c5,null));};exports[_0xdfde('0x55')]=function(_0x1dcd13,_0x26f1cb){return db['VoiceQueue'][_0xdfde('0x55')](_0x1dcd13[_0xdfde('0x38')],{})['then'](function(_0x32957b){var _0x3817fc=_0x1dcd13['user'][_0xdfde('0x2a')]({'plain':!![]});if(!_0x3817fc)throw new Error(_0xdfde('0x56'));if(_0x3817fc['role']==='user'){var _0x4efa41=_0x32957b['get']({'plain':!![]});var _0x1ef90e=[{'name':_0xdfde('0x57'),'value':_0xdfde('0x58')},{'name':_0xdfde('0x2b'),'value':_0xdfde('0x59')}];var _0xe456ee=_[_0xdfde('0x30')](_0x1ef90e,[_0xdfde('0x2d'),_0x4efa41[_0xdfde('0x2f')]])[_0xdfde('0x31')];return db['UserProfileSection'][_0xdfde('0x30')]({'where':{'name':_0xe456ee,'userProfileId':_0x3817fc['userProfileId']},'raw':!![]})[_0xdfde('0x28')](function(_0x4086eb){if(_0x4086eb&&_0x4086eb[_0xdfde('0x5a')]===0x0){return db[_0xdfde('0x32')]['create']({'name':_0x4efa41[_0xdfde('0x31')],'resourceId':_0x4efa41['id'],'type':_0x4086eb[_0xdfde('0x31')],'sectionId':_0x4086eb['id']},{})[_0xdfde('0x28')](function(){return _0x32957b;});}else{return _0x32957b;}})[_0xdfde('0x51')](function(_0x43683f){logger[_0xdfde('0x33')](_0xdfde('0x5b'),_0x43683f);throw _0x43683f;});}return _0x32957b;})[_0xdfde('0x28')](respondWithResult(_0x26f1cb,0xc9))['catch'](handleError(_0x26f1cb,null));};exports['clone']=function(_0x2a5066,_0x4b63cf){var _0x131eb3={'where':{'id':_0x2a5066['params']['id']}},_0x2d548d={};_0x2d548d[_0xdfde('0x42')]=_[_0xdfde('0x40')](db[_0xdfde('0x54')][_0xdfde('0x5c')]);_0x131eb3[_0xdfde('0x43')]=_['intersection'](_0x2d548d[_0xdfde('0x42')],qs[_0xdfde('0x45')](_0x2a5066['query'][_0xdfde('0x45')]));_0x131eb3[_0xdfde('0x43')]=_0x131eb3[_0xdfde('0x43')][_0xdfde('0x46')]?_0x131eb3[_0xdfde('0x43')]:_0x2d548d[_0xdfde('0x42')];if(_0x2a5066[_0xdfde('0x3f')][_0xdfde('0x4e')]){_0x131eb3[_0xdfde('0x4f')]=[{'all':!![]}];}_0x131eb3=_[_0xdfde('0x37')]({},_0x131eb3,_0x2a5066[_0xdfde('0x4d')]);return db['VoiceQueue'][_0xdfde('0x30')](_0x131eb3)['then'](handleEntityNotFound(_0x4b63cf,null))[_0xdfde('0x28')](function(_0x16bd32){if(_0x16bd32){var _0x2c7e16=_0x16bd32[_0xdfde('0x2a')]({'plain':!![]});_0x2c7e16=qs[_0xdfde('0x5d')](_0x2c7e16,['id',_0xdfde('0x5e'),_0xdfde('0x5f')]);_0x2a5066[_0xdfde('0x38')]=_[_0xdfde('0x5d')](_0x2a5066[_0xdfde('0x38')],['id',_0xdfde('0x5e'),_0xdfde('0x5f')]);return db[_0xdfde('0x54')]['create'](_[_0xdfde('0x37')](_0x2c7e16,_0x2a5066[_0xdfde('0x38')]),{'include':_0x2a5066[_0xdfde('0x3f')][_0xdfde('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x52f48d){var _0x5a10b0=_0x2a5066[_0xdfde('0x60')][_0xdfde('0x2a')]({'plain':!![]});if(!_0x5a10b0)throw new Error(_0xdfde('0x56'));if(_0x5a10b0['role']===_0xdfde('0x60')){var _0x3ccf4c=_0x52f48d[_0xdfde('0x2a')]({'plain':!![]});var _0x4885c2=[{'name':_0xdfde('0x57'),'value':_0xdfde('0x58')},{'name':'QueueCampaigns','value':_0xdfde('0x59')}];var _0x81c55d=_['find'](_0x4885c2,[_0xdfde('0x2d'),_0x3ccf4c[_0xdfde('0x2f')]])[_0xdfde('0x31')];return db[_0xdfde('0x61')][_0xdfde('0x30')]({'where':{'name':_0x81c55d,'userProfileId':_0x5a10b0[_0xdfde('0x62')]},'raw':!![]})[_0xdfde('0x28')](function(_0x57259){if(_0x57259&&_0x57259[_0xdfde('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x3ccf4c[_0xdfde('0x31')],'resourceId':_0x3ccf4c['id'],'type':_0x57259['name'],'sectionId':_0x57259['id']},{})['then'](function(){return _0x52f48d;});}else{return _0x52f48d;}})[_0xdfde('0x51')](function(_0x3523c4){logger[_0xdfde('0x33')](_0xdfde('0x5b'),_0x3523c4);throw _0x3523c4;});}return _0x52f48d;});}})['then'](respondWithResult(_0x4b63cf,0xc9))[_0xdfde('0x51')](handleError(_0x4b63cf,null));};exports[_0xdfde('0x27')]=function(_0x23f61d,_0xcf6531){if(_0x23f61d[_0xdfde('0x38')]['id']){delete _0x23f61d[_0xdfde('0x38')]['id'];}return db[_0xdfde('0x54')][_0xdfde('0x30')]({'where':{'id':_0x23f61d[_0xdfde('0x53')]['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0xcf6531,null))[_0xdfde('0x28')](saveUpdates(_0x23f61d[_0xdfde('0x38')],null))['then'](respondWithResult(_0xcf6531,null))[_0xdfde('0x51')](handleError(_0xcf6531,null));};exports['destroy']=function(_0x512a6c,_0x495d5e){return db[_0xdfde('0x54')][_0xdfde('0x30')]({'where':{'id':_0x512a6c['params']['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x495d5e,null))[_0xdfde('0x28')](removeEntity(_0x495d5e,null))[_0xdfde('0x51')](handleError(_0x495d5e,null));};exports[_0xdfde('0x63')]=function(_0x449c04,_0x211f6b,_0x239a54){var _0x317fb8={'raw':![],'where':{}};var _0x1ef99e={};var _0x543254={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xdfde('0x64')]({'where':{'id':_0x449c04[_0xdfde('0x53')]['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x211f6b,null))[_0xdfde('0x28')](function(_0x45d5f1){if(_0x45d5f1){_0x1ef99e[_0xdfde('0x42')]=_[_0xdfde('0x40')](db[_0xdfde('0x65')][_0xdfde('0x5c')]);_0x1ef99e[_0xdfde('0x3f')]=_[_0xdfde('0x40')](_0x449c04[_0xdfde('0x3f')]);_0x1ef99e[_0xdfde('0x41')]=_[_0xdfde('0x44')](_0x1ef99e['model'],_0x1ef99e[_0xdfde('0x3f')]);_0x317fb8['attributes']=_['intersection'](_0x1ef99e[_0xdfde('0x42')],qs[_0xdfde('0x45')](_0x449c04[_0xdfde('0x3f')]['fields']));_0x317fb8[_0xdfde('0x43')]=_0x317fb8[_0xdfde('0x43')]['length']?_0x317fb8[_0xdfde('0x43')]:_0x1ef99e[_0xdfde('0x42')];if(!_0x449c04[_0xdfde('0x3f')][_0xdfde('0x47')](_0xdfde('0x48'))){_0x317fb8[_0xdfde('0x23')]=qs['limit'](_0x449c04[_0xdfde('0x3f')]['limit']);_0x317fb8[_0xdfde('0x20')]=qs['offset'](_0x449c04[_0xdfde('0x3f')][_0xdfde('0x20')]);}_0x317fb8['order']=qs[_0xdfde('0x66')](_0x449c04[_0xdfde('0x3f')]['sort']);_0x317fb8[_0xdfde('0x49')]=qs[_0xdfde('0x41')](_[_0xdfde('0x4a')](_0x449c04['query'],_0x1ef99e[_0xdfde('0x41')]));_0x317fb8['where'][_0xdfde('0x67')]=_0x45d5f1['id'];if(_0x449c04[_0xdfde('0x3f')][_0xdfde('0x4b')]){_0x317fb8['where']=_[_0xdfde('0x37')](_0x317fb8[_0xdfde('0x49')],{'$or':_[_0xdfde('0x3d')](_0x317fb8['attributes'],function(_0x3dc2b7){var _0x3db200={};_0x3db200[_0x3dc2b7]={'$like':'%'+_0x449c04['query'][_0xdfde('0x4b')]+'%'};return _0x3db200;})});}_0x317fb8=_[_0xdfde('0x37')]({},_0x317fb8,_0x449c04['options']);return db[_0xdfde('0x65')][_0xdfde('0x22')]({'where':_0x317fb8['where']})[_0xdfde('0x28')](function(_0x66ce3f){_0x543254[_0xdfde('0x22')]=_0x66ce3f;if(_0x449c04[_0xdfde('0x3f')][_0xdfde('0x4e')]){_0x317fb8[_0xdfde('0x4f')]=[{'all':!![]}];}return db[_0xdfde('0x65')][_0xdfde('0x50')](_0x317fb8);})['then'](function(_0x39d2fc){_0x543254[_0xdfde('0x68')]=_0x39d2fc;return _0x543254;});}})[_0xdfde('0x28')](respondWithFilteredResult(_0x211f6b,_0x317fb8))[_0xdfde('0x51')](handleError(_0x211f6b,null));};exports[_0xdfde('0x69')]=function(_0xcf3d54,_0x57c32b,_0x52f5d8){var _0x475aff={'raw':!![],'where':{}};var _0x42a827={};var _0x3d5816={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xdfde('0x64')]({'where':{'id':_0xcf3d54['params']['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x57c32b,null))['then'](function(_0x37e811){if(_0x37e811){_0x42a827[_0xdfde('0x42')]=_[_0xdfde('0x40')](db[_0xdfde('0x6a')][_0xdfde('0x5c')]);_0x42a827[_0xdfde('0x3f')]=_[_0xdfde('0x40')](_0xcf3d54['query']);_0x42a827[_0xdfde('0x41')]=_['intersection'](_0x42a827[_0xdfde('0x42')],_0x42a827[_0xdfde('0x3f')]);_0x475aff[_0xdfde('0x43')]=_['intersection'](_0x42a827[_0xdfde('0x42')],qs[_0xdfde('0x45')](_0xcf3d54[_0xdfde('0x3f')][_0xdfde('0x45')]));_0x475aff['attributes']=_0x475aff[_0xdfde('0x43')][_0xdfde('0x46')]?_0x475aff[_0xdfde('0x43')]:_0x42a827[_0xdfde('0x42')];if(!_0xcf3d54[_0xdfde('0x3f')]['hasOwnProperty'](_0xdfde('0x48'))){_0x475aff[_0xdfde('0x23')]=qs[_0xdfde('0x23')](_0xcf3d54[_0xdfde('0x3f')][_0xdfde('0x23')]);_0x475aff[_0xdfde('0x20')]=qs['offset'](_0xcf3d54['query'][_0xdfde('0x20')]);}_0x475aff[_0xdfde('0x6b')]=qs['sort'](_0xcf3d54[_0xdfde('0x3f')][_0xdfde('0x66')]);_0x475aff[_0xdfde('0x49')]=qs[_0xdfde('0x41')](_['pick'](_0xcf3d54['query'],_0x42a827[_0xdfde('0x41')]));_0x475aff['where']['VoiceQueueId']=_0x37e811['id'];if(_0xcf3d54[_0xdfde('0x3f')][_0xdfde('0x4b')]){_0x475aff['where']=_['merge'](_0x475aff['where'],{'$or':_[_0xdfde('0x3d')](_0x475aff[_0xdfde('0x43')],function(_0x99517d){var _0x49ce7e={};_0x49ce7e[_0x99517d]={'$like':'%'+_0xcf3d54[_0xdfde('0x3f')][_0xdfde('0x4b')]+'%'};return _0x49ce7e;})});}_0x475aff=_[_0xdfde('0x37')]({},_0x475aff,_0xcf3d54[_0xdfde('0x4d')]);return db['CmHopperHistory'][_0xdfde('0x22')]({'where':_0x475aff[_0xdfde('0x49')]})[_0xdfde('0x28')](function(_0x2cee03){_0x3d5816[_0xdfde('0x22')]=_0x2cee03;if(_0xcf3d54['query']['includeAll']){_0x475aff['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xdfde('0x50')](_0x475aff);})['then'](function(_0x166ad5){_0x3d5816[_0xdfde('0x68')]=_0x166ad5;return _0x3d5816;});}})[_0xdfde('0x28')](respondWithFilteredResult(_0x57c32b,_0x475aff))[_0xdfde('0x51')](handleError(_0x57c32b,null));};exports[_0xdfde('0x6c')]=function(_0x135a3d,_0x4b5036,_0x29fa0d){var _0xa491ca={'raw':!![],'where':{}};var _0xc29ba8={};var _0x4f97d5={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xdfde('0x64')]({'where':{'id':_0x135a3d[_0xdfde('0x53')]['id']}})['then'](handleEntityNotFound(_0x4b5036,null))['then'](function(_0x37000e){if(_0x37000e){_0xc29ba8[_0xdfde('0x42')]=_[_0xdfde('0x40')](db[_0xdfde('0x6d')][_0xdfde('0x5c')]);_0xc29ba8[_0xdfde('0x3f')]=_['keys'](_0x135a3d[_0xdfde('0x3f')]);_0xc29ba8['filters']=_[_0xdfde('0x44')](_0xc29ba8[_0xdfde('0x42')],_0xc29ba8['query']);_0xa491ca[_0xdfde('0x43')]=_[_0xdfde('0x44')](_0xc29ba8['model'],qs['fields'](_0x135a3d[_0xdfde('0x3f')]['fields']));_0xa491ca[_0xdfde('0x43')]=_0xa491ca[_0xdfde('0x43')][_0xdfde('0x46')]?_0xa491ca['attributes']:_0xc29ba8[_0xdfde('0x42')];if(!_0x135a3d['query'][_0xdfde('0x47')]('nolimit')){_0xa491ca[_0xdfde('0x23')]=qs[_0xdfde('0x23')](_0x135a3d[_0xdfde('0x3f')][_0xdfde('0x23')]);_0xa491ca[_0xdfde('0x20')]=qs['offset'](_0x135a3d[_0xdfde('0x3f')][_0xdfde('0x20')]);}_0xa491ca[_0xdfde('0x6b')]=qs[_0xdfde('0x66')](_0x135a3d[_0xdfde('0x3f')][_0xdfde('0x66')]);_0xa491ca[_0xdfde('0x49')]=qs[_0xdfde('0x41')](_[_0xdfde('0x4a')](_0x135a3d[_0xdfde('0x3f')],_0xc29ba8[_0xdfde('0x41')]));_0xa491ca['where'][_0xdfde('0x67')]=_0x37000e['id'];if(_0x135a3d[_0xdfde('0x3f')][_0xdfde('0x4b')]){_0xa491ca['where']=_[_0xdfde('0x37')](_0xa491ca[_0xdfde('0x49')],{'$or':_[_0xdfde('0x3d')](_0xa491ca[_0xdfde('0x43')],function(_0x3c8565){var _0x5cb8dc={};_0x5cb8dc[_0x3c8565]={'$like':'%'+_0x135a3d[_0xdfde('0x3f')][_0xdfde('0x4b')]+'%'};return _0x5cb8dc;})});}_0xa491ca=_['merge']({},_0xa491ca,_0x135a3d[_0xdfde('0x4d')]);return db['CmHopperFinal']['count']({'where':_0xa491ca[_0xdfde('0x49')]})[_0xdfde('0x28')](function(_0x117906){_0x4f97d5[_0xdfde('0x22')]=_0x117906;if(_0x135a3d[_0xdfde('0x3f')][_0xdfde('0x4e')]){_0xa491ca[_0xdfde('0x4f')]=[{'all':!![]}];}return db[_0xdfde('0x6d')][_0xdfde('0x50')](_0xa491ca);})[_0xdfde('0x28')](function(_0x50ace5){_0x4f97d5['rows']=_0x50ace5;return _0x4f97d5;});}})[_0xdfde('0x28')](respondWithFilteredResult(_0x4b5036,_0xa491ca))['catch'](handleError(_0x4b5036,null));};exports[_0xdfde('0x6e')]=function(_0x13d43b,_0x2b272d,_0x2af86b){var _0x6c2669={'raw':!![],'where':{}};var _0x1cbcd9={};var _0x37f953={'count':0x0,'rows':[]};return db[_0xdfde('0x54')][_0xdfde('0x64')]({'where':{'id':_0x13d43b['params']['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x2b272d,null))[_0xdfde('0x28')](function(_0x2ec6da){if(_0x2ec6da){_0x1cbcd9['model']=_[_0xdfde('0x40')](db[_0xdfde('0x6f')][_0xdfde('0x5c')]);_0x1cbcd9[_0xdfde('0x3f')]=_[_0xdfde('0x40')](_0x13d43b['query']);_0x1cbcd9[_0xdfde('0x41')]=_[_0xdfde('0x44')](_0x1cbcd9[_0xdfde('0x42')],_0x1cbcd9['query']);_0x6c2669[_0xdfde('0x43')]=_[_0xdfde('0x44')](_0x1cbcd9[_0xdfde('0x42')],qs[_0xdfde('0x45')](_0x13d43b[_0xdfde('0x3f')]['fields']));_0x6c2669[_0xdfde('0x43')]=_0x6c2669[_0xdfde('0x43')][_0xdfde('0x46')]?_0x6c2669[_0xdfde('0x43')]:_0x1cbcd9[_0xdfde('0x42')];if(!_0x13d43b['query'][_0xdfde('0x47')](_0xdfde('0x48'))){_0x6c2669[_0xdfde('0x23')]=qs['limit'](_0x13d43b[_0xdfde('0x3f')][_0xdfde('0x23')]);_0x6c2669[_0xdfde('0x20')]=qs[_0xdfde('0x20')](_0x13d43b['query']['offset']);}_0x6c2669[_0xdfde('0x6b')]=qs[_0xdfde('0x66')](_0x13d43b[_0xdfde('0x3f')][_0xdfde('0x66')]);_0x6c2669[_0xdfde('0x49')]=qs[_0xdfde('0x41')](_[_0xdfde('0x4a')](_0x13d43b[_0xdfde('0x3f')],_0x1cbcd9['filters']));_0x6c2669[_0xdfde('0x49')][_0xdfde('0x67')]=_0x2ec6da['id'];if(_0x13d43b[_0xdfde('0x3f')][_0xdfde('0x4b')]){_0x6c2669['where']=_['merge'](_0x6c2669[_0xdfde('0x49')],{'$or':_[_0xdfde('0x3d')](_0x6c2669['attributes'],function(_0x1539b0){var _0x18b488={};_0x18b488[_0x1539b0]={'$like':'%'+_0x13d43b['query'][_0xdfde('0x4b')]+'%'};return _0x18b488;})});}_0x6c2669=_['merge']({},_0x6c2669,_0x13d43b[_0xdfde('0x4d')]);return db[_0xdfde('0x6f')][_0xdfde('0x22')]({'where':_0x6c2669[_0xdfde('0x49')]})[_0xdfde('0x28')](function(_0xfc181d){_0x37f953['count']=_0xfc181d;if(_0x13d43b[_0xdfde('0x3f')]['includeAll']){_0x6c2669[_0xdfde('0x4f')]=[{'all':!![]}];}return db[_0xdfde('0x6f')]['findAll'](_0x6c2669);})['then'](function(_0x471739){_0x37f953[_0xdfde('0x68')]=_0x471739;return _0x37f953;});}})[_0xdfde('0x28')](respondWithFilteredResult(_0x2b272d,_0x6c2669))[_0xdfde('0x51')](handleError(_0x2b272d,null));};exports[_0xdfde('0x70')]=function(_0x1573bc,_0xfc8c0d,_0x5d926a){var _0x2f5421={};var _0x90bc30={};var _0x59843f;var _0x14d7ad;return db[_0xdfde('0x54')][_0xdfde('0x64')]({'where':{'id':_0x1573bc[_0xdfde('0x53')]['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0xfc8c0d,null))['then'](function(_0x34b984){if(_0x34b984){_0x59843f=_0x34b984;_0x90bc30[_0xdfde('0x42')]=_['keys'](db['Team'][_0xdfde('0x5c')]);_0x90bc30[_0xdfde('0x3f')]=_[_0xdfde('0x40')](_0x1573bc[_0xdfde('0x3f')]);_0x90bc30[_0xdfde('0x41')]=_[_0xdfde('0x44')](_0x90bc30['model'],_0x90bc30[_0xdfde('0x3f')]);_0x2f5421['attributes']=_[_0xdfde('0x44')](_0x90bc30[_0xdfde('0x42')],qs['fields'](_0x1573bc[_0xdfde('0x3f')][_0xdfde('0x45')]));_0x2f5421['attributes']=_0x2f5421['attributes'][_0xdfde('0x46')]?_0x2f5421[_0xdfde('0x43')]:_0x90bc30[_0xdfde('0x42')];_0x2f5421[_0xdfde('0x6b')]=qs['sort'](_0x1573bc[_0xdfde('0x3f')][_0xdfde('0x66')]);_0x2f5421['where']=qs[_0xdfde('0x41')](_['pick'](_0x1573bc[_0xdfde('0x3f')],_0x90bc30[_0xdfde('0x41')]));if(_0x1573bc[_0xdfde('0x3f')][_0xdfde('0x4b')]){_0x2f5421['where']=_['merge'](_0x2f5421[_0xdfde('0x49')],{'$or':_['map'](_0x2f5421[_0xdfde('0x43')],function(_0x31b415){var _0x5e740f={};_0x5e740f[_0x31b415]={'$like':'%'+_0x1573bc[_0xdfde('0x3f')][_0xdfde('0x4b')]+'%'};return _0x5e740f;})});}_0x2f5421=_[_0xdfde('0x37')]({},_0x2f5421,_0x1573bc['options']);return _0x59843f['getTeams'](_0x2f5421);}})[_0xdfde('0x28')](function(_0x53fad0){if(_0x53fad0){_0x14d7ad=_0x53fad0[_0xdfde('0x46')];if(!_0x1573bc[_0xdfde('0x3f')][_0xdfde('0x47')](_0xdfde('0x48'))){_0x2f5421['limit']=qs['limit'](_0x1573bc['query'][_0xdfde('0x23')]);_0x2f5421['offset']=qs[_0xdfde('0x20')](_0x1573bc[_0xdfde('0x3f')][_0xdfde('0x20')]);}return _0x59843f['getTeams'](_0x2f5421);}})[_0xdfde('0x28')](function(_0x2274ef){if(_0x2274ef){return _0x2274ef?{'count':_0x14d7ad,'rows':_0x2274ef}:null;}})[_0xdfde('0x28')](respondWithResult(_0xfc8c0d,null))[_0xdfde('0x51')](handleError(_0xfc8c0d,null));};exports[_0xdfde('0x71')]=function(_0x2ee3c3,_0x44163e,_0x22e52b){var _0x98fc93=_0x2ee3c3[_0xdfde('0x38')][_0xdfde('0x72')];var _0x4bb181=_[_0xdfde('0x3d')](_0x98fc93,'id');return db[_0xdfde('0x73')][_0xdfde('0x50')]({'where':{'id':_0x4bb181},'attributes':['id'],'include':[{'model':db[_0xdfde('0x74')],'as':_0xdfde('0x75'),'attributes':['id',_0xdfde('0x31'),_0xdfde('0x76'),_0xdfde('0x77'),_0xdfde('0x78')],'raw':!![]}]})[_0xdfde('0x28')](function(_0x595410){if(_0x595410){var _0x141b34=_[_0xdfde('0x79')](_0x595410,function(_0x4cc7ae){var _0x4a5382=_0x4cc7ae[_0xdfde('0x2a')]({'plain':!![]});_0x4a5382[_0xdfde('0x75')][_0xdfde('0x7a')](function(_0x1744a1){_0x1744a1[_0xdfde('0x7b')]=_[_0xdfde('0x30')](_0x98fc93,{'id':_0x4a5382['id']})[_0xdfde('0x7b')];});return _0x4a5382[_0xdfde('0x75')];});return db[_0xdfde('0x54')]['find']({'where':{'id':_0x2ee3c3['params']['id']}})[_0xdfde('0x28')](function(_0x190c7d){return db[_0xdfde('0x7c')][_0xdfde('0x7d')](function(_0x20ad0d){return _0x190c7d[_0xdfde('0x71')](_0x4bb181,{'transaction':_0x20ad0d})[_0xdfde('0x28')](function(){return BPromise[_0xdfde('0x7e')](_0x98fc93,function(_0x276556){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x276556['id'],'VoiceQueueId':_0x2ee3c3[_0xdfde('0x53')]['id'],'penalty':_0x276556[_0xdfde('0x7b')]},{'transaction':_0x20ad0d});});})['then'](function(){return BPromise[_0xdfde('0x7e')](_0x141b34,function(_0x1670f3){return db[_0xdfde('0x7f')][_0xdfde('0x80')]({'where':{'UserId':_0x1670f3['id'],'VoiceQueueId':_0x2ee3c3[_0xdfde('0x53')]['id']},'defaults':{'penalty':_0x1670f3[_0xdfde('0x7b')]},'transaction':_0x20ad0d});});})[_0xdfde('0x28')](function(){return BPromise[_0xdfde('0x7e')](_['filter'](_0x141b34,{'online':!![]}),function(_0x5d034d){return db['UserVoiceQueueRt'][_0xdfde('0x81')]({'membername':_0x5d034d['name'],'UserId':_0x5d034d['id'],'queue_name':_0x190c7d[_0xdfde('0x31')],'VoiceQueueId':_0x190c7d['id'],'interface':_[_0xdfde('0x82')](_0x5d034d['interface'])?util[_0xdfde('0x83')](_0xdfde('0x84'),_0x5d034d[_0xdfde('0x31')]):_0x5d034d['interface'],'paused':_0x5d034d[_0xdfde('0x77')]||![],'penalty':_0x5d034d[_0xdfde('0x7b')]},{'transaction':_0x20ad0d});});})[_0xdfde('0x28')](function(){_0x141b34[_0xdfde('0x7a')](function(_0x1ff163){socket[_0xdfde('0x85')](_0xdfde('0x86'),{'UserId':_0x1ff163['id'],'VoiceQueueId':_0x190c7d['id']});});});});});}})[_0xdfde('0x28')](respondWithStatusCode(_0x44163e,null))[_0xdfde('0x51')](handleError(_0x44163e,null));};exports[_0xdfde('0x87')]=function(_0x3ff553,_0x4ddcf8,_0x423265){return db[_0xdfde('0x73')][_0xdfde('0x50')]({'where':{'id':_0x3ff553[_0xdfde('0x3f')][_0xdfde('0x88')]},'attributes':['id'],'include':[{'model':db[_0xdfde('0x74')],'as':_0xdfde('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4ddcf8,null))['then'](function(_0x313498){var _0x4cab33=_[_0xdfde('0x3d')](_0x313498,'id');var _0x1a029d=[];var _0x279110=[];var _0x42214e=squel[_0xdfde('0x89')]();_0x42214e[_0xdfde('0x8a')](_0xdfde('0x8b'))[_0xdfde('0x8c')](_0xdfde('0x8d'),'tq')['join'](_0xdfde('0x8e'),'ut',_0xdfde('0x8f'))[_0xdfde('0x49')](_0xdfde('0x90'),_0x3ff553['params']['id']);for(var _0x485047=0x0;_0x485047<_0x313498[_0xdfde('0x46')];_0x485047+=0x1){let _0x2d1c18=_0x313498[_0x485047];for(var _0x340d4c=0x0;_0x340d4c<_0x2d1c18[_0xdfde('0x75')]['length'];_0x340d4c+=0x1){let _0x215b6b=_0x2d1c18[_0xdfde('0x75')][_0x340d4c];var _0x164157=_0x42214e[_0xdfde('0x91')]();_0x164157[_0xdfde('0x49')](_0xdfde('0x92'),_0x215b6b['id']);_0x279110[_0xdfde('0x93')](db[_0xdfde('0x7c')][_0xdfde('0x3f')](_0x164157[_0xdfde('0x94')](),{'type':db[_0xdfde('0x7c')][_0xdfde('0x95')][_0xdfde('0x96')]})[_0xdfde('0x28')](function(_0x383361){if(_0x383361['length']===0x1){return _0x215b6b['id'];}else{var _0x5c662b=_[_0xdfde('0x97')](_[_0xdfde('0x3d')](_0x383361,_0xdfde('0x98')),function(_0x315474){return _[_0xdfde('0x2e')](_0x4cab33,_0x315474);});if(_0x5c662b){return _0x215b6b['id'];}}}));}}return BPromise[_0xdfde('0x99')](_0x279110)[_0xdfde('0x28')](function(_0x3a513a){_0x1a029d=_(_0x1a029d)[_0xdfde('0x9a')](_0x3a513a)[_0xdfde('0x9b')]()[_0xdfde('0x2d')]();return db[_0xdfde('0x54')][_0xdfde('0x30')]({'where':{'id':_0x3ff553['params']['id']}})['then'](function(_0x5ee09f){return db[_0xdfde('0x7c')][_0xdfde('0x7d')](function(_0x1534a9){return _0x5ee09f[_0xdfde('0x87')](_0x3ff553[_0xdfde('0x3f')]['ids'],{'transaction':_0x1534a9})['then'](function(){if(!_['isEmpty'](_0x1a029d)){return _0x5ee09f[_0xdfde('0x9c')](_0x1a029d,{'transaction':_0x1534a9})[_0xdfde('0x28')](function(){return db[_0xdfde('0x9d')][_0xdfde('0x29')]({'where':{'VoiceQueueId':_0x3ff553[_0xdfde('0x53')]['id'],'UserId':_0x1a029d},'transaction':_0x1534a9});});}})[_0xdfde('0x28')](function(){_0x1a029d[_0xdfde('0x7a')](function(_0x27c3aa){socket['emit'](_0xdfde('0x9e'),{'UserId':_0x27c3aa,'VoiceQueueId':_0x5ee09f['id']});});});});});});})[_0xdfde('0x28')](respondWithStatusCode(_0x4ddcf8,null))[_0xdfde('0x51')](handleError(_0x4ddcf8,null));};exports['addAgents']=function(_0x562103,_0x20e438,_0x43285b){var _0x56b4a1,_0x35a1b2;return db[_0xdfde('0x54')][_0xdfde('0x30')]({'where':{'id':_0x562103[_0xdfde('0x53')]['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x20e438,null))[_0xdfde('0x28')](function(_0x362bee){if(_0x362bee){_0x35a1b2=_0x362bee;return _0x362bee[_0xdfde('0x9f')](_0x562103[_0xdfde('0x38')][_0xdfde('0x88')],_[_0xdfde('0x5d')](_0x562103['body'],[_0xdfde('0x88'),'id'])||{})['spread'](function(_0x5bd5ae){for(var _0x1d4982=0x0;_0x1d4982<_0x562103['body']['ids'][_0xdfde('0x46')];_0x1d4982+=0x1){socket[_0xdfde('0x85')](_0xdfde('0x86'),{'UserId':_0x562103[_0xdfde('0x38')][_0xdfde('0x88')][_0x1d4982],'VoiceQueueId':_0x562103[_0xdfde('0x53')]['id']});}return _0x5bd5ae;});}})[_0xdfde('0x28')](function(_0x3a4fb0){_0x56b4a1=_0x3a4fb0||[];if(_0x35a1b2){return db['User'][_0xdfde('0x50')]({'where':{'id':_0x562103[_0xdfde('0x38')][_0xdfde('0x88')]},'attributes':['id',_0xdfde('0x31'),_0xdfde('0x76'),_0xdfde('0x77'),_0xdfde('0x78')],'raw':!![]});}})['then'](function(_0x200d86){if(!_[_0xdfde('0xa0')](_0x200d86)){var _0x4d7966=[];for(var _0x24f25a=0x0;_0x24f25a<_0x200d86[_0xdfde('0x46')];_0x24f25a++){if(_0x200d86[_0x24f25a][_0xdfde('0x76')]){_0x4d7966[_0xdfde('0x93')](db[_0xdfde('0x9d')][_0xdfde('0x81')]({'membername':_0x200d86[_0x24f25a]['name'],'UserId':_0x200d86[_0x24f25a]['id'],'queue_name':_0x35a1b2[_0xdfde('0x31')],'VoiceQueueId':_0x35a1b2['id'],'interface':_['isNil'](_0x200d86[_0x24f25a][_0xdfde('0x78')])?util[_0xdfde('0x83')]('SIP/%s',_0x200d86[_0x24f25a]['name']):_0x200d86[_0x24f25a][_0xdfde('0x78')],'paused':_0x200d86[_0x24f25a][_0xdfde('0x77')]||![],'penalty':_0x562103[_0xdfde('0x38')][_0xdfde('0x7b')]||0x0}));}}return BPromise[_0xdfde('0x99')](_0x4d7966);}})['then'](function(){return _0x56b4a1;})[_0xdfde('0x28')](respondWithResult(_0x20e438,null))[_0xdfde('0x51')](handleError(_0x20e438,null));};exports[_0xdfde('0x9c')]=function(_0x27fe09,_0x5ec4bf,_0x44622b){return db[_0xdfde('0x54')]['find']({'where':{'id':_0x27fe09[_0xdfde('0x53')]['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x5ec4bf,null))[_0xdfde('0x28')](function(_0x2248ff){if(_0x2248ff){return _0x2248ff['removeAgents'](_0x27fe09[_0xdfde('0x3f')][_0xdfde('0x88')])[_0xdfde('0x28')](function(){if(_[_0xdfde('0xa1')](_0x27fe09[_0xdfde('0x3f')][_0xdfde('0x88')])){for(var _0x411f0f=0x0;_0x411f0f<_0x27fe09[_0xdfde('0x3f')]['ids']['length'];_0x411f0f+=0x1){socket[_0xdfde('0x85')]('userVoiceQueue:remove',{'UserId':Number(_0x27fe09[_0xdfde('0x3f')][_0xdfde('0x88')][_0x411f0f]),'VoiceQueueId':Number(_0x27fe09['params']['id'])});}}else{socket['emit'](_0xdfde('0x9e'),{'UserId':Number(_0x27fe09[_0xdfde('0x3f')][_0xdfde('0x88')]),'VoiceQueueId':Number(_0x27fe09[_0xdfde('0x53')]['id'])});}});}})['then'](function(_0x563d48){return db[_0xdfde('0x9d')]['destroy']({'where':{'VoiceQueueId':_0x27fe09[_0xdfde('0x53')]['id'],'UserId':_0x27fe09[_0xdfde('0x3f')][_0xdfde('0x88')]}})[_0xdfde('0x28')](function(){return _0x563d48;});})[_0xdfde('0x28')](respondWithStatusCode(_0x5ec4bf,null))[_0xdfde('0x51')](handleError(_0x5ec4bf,null));};exports['getAgents']=function(_0x360075,_0x343274,_0x471e44){var _0x3b5e72={};var _0x4d2567={};var _0x571ad8;var _0x5ebbe2;return db[_0xdfde('0x54')]['findOne']({'where':{'id':_0x360075[_0xdfde('0x53')]['id']}})['then'](handleEntityNotFound(_0x343274,null))[_0xdfde('0x28')](function(_0xc83efb){if(_0xc83efb){_0x571ad8=_0xc83efb;_0x4d2567[_0xdfde('0x42')]=_[_0xdfde('0x40')](db[_0xdfde('0x74')][_0xdfde('0x5c')]);_0x4d2567[_0xdfde('0x3f')]=_[_0xdfde('0x40')](_0x360075[_0xdfde('0x3f')]);_0x4d2567['filters']=_['intersection'](_0x4d2567[_0xdfde('0x42')],_0x4d2567['query']);_0x3b5e72[_0xdfde('0x43')]=_[_0xdfde('0x44')](_0x4d2567[_0xdfde('0x42')],qs['fields'](_0x360075[_0xdfde('0x3f')][_0xdfde('0x45')]));_0x3b5e72['attributes']=_0x3b5e72['attributes'][_0xdfde('0x46')]?_0x3b5e72['attributes']:_0x4d2567['model'];_0x3b5e72[_0xdfde('0x6b')]=qs[_0xdfde('0x66')](_0x360075[_0xdfde('0x3f')][_0xdfde('0x66')]);_0x3b5e72[_0xdfde('0x49')]=qs['filters'](_[_0xdfde('0x4a')](_0x360075[_0xdfde('0x3f')],_0x4d2567['filters']));if(_0x360075[_0xdfde('0x3f')][_0xdfde('0x4b')]){_0x3b5e72[_0xdfde('0x49')]=_[_0xdfde('0x37')](_0x3b5e72['where'],{'$or':_['map'](_0x3b5e72[_0xdfde('0x43')],function(_0x2e4273){var _0x1d83ea={};_0x1d83ea[_0x2e4273]={'$like':'%'+_0x360075[_0xdfde('0x3f')][_0xdfde('0x4b')]+'%'};return _0x1d83ea;})});}_0x3b5e72=_['merge']({},_0x3b5e72,_0x360075[_0xdfde('0x4d')]);return _0x571ad8[_0xdfde('0xa2')](_0x3b5e72);}})[_0xdfde('0x28')](function(_0x7677c3){if(_0x7677c3){_0x5ebbe2=_0x7677c3[_0xdfde('0x46')];if(!_0x360075[_0xdfde('0x3f')][_0xdfde('0x47')]('nolimit')){_0x3b5e72[_0xdfde('0x23')]=qs[_0xdfde('0x23')](_0x360075['query'][_0xdfde('0x23')]);_0x3b5e72[_0xdfde('0x20')]=qs[_0xdfde('0x20')](_0x360075[_0xdfde('0x3f')][_0xdfde('0x20')]);}return _0x571ad8[_0xdfde('0xa2')](_0x3b5e72);}})[_0xdfde('0x28')](function(_0x2cf88){if(_0x2cf88){return _0x2cf88?{'count':_0x5ebbe2,'rows':_0x2cf88}:null;}})[_0xdfde('0x28')](respondWithResult(_0x343274,null))[_0xdfde('0x51')](handleError(_0x343274,null));};exports[_0xdfde('0xa3')]=function(_0x38d73a,_0x1cba7e,_0xfd6422){var _0x2ff1c9={};var _0x2d844d={};var _0x380c86;var _0x2ad633;return db[_0xdfde('0x54')][_0xdfde('0x64')]({'where':{'id':_0x38d73a['params']['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x1cba7e,null))['then'](function(_0x143fcc){if(_0x143fcc){_0x380c86=_0x143fcc;_0x2d844d[_0xdfde('0x42')]=_[_0xdfde('0x40')](db[_0xdfde('0x9d')]['rawAttributes']);_0x2d844d[_0xdfde('0x3f')]=_[_0xdfde('0x40')](_0x38d73a[_0xdfde('0x3f')]);_0x2d844d['filters']=_['intersection'](_0x2d844d[_0xdfde('0x42')],_0x2d844d['query']);_0x2ff1c9[_0xdfde('0x43')]=_[_0xdfde('0x44')](_0x2d844d['model'],qs[_0xdfde('0x45')](_0x38d73a[_0xdfde('0x3f')]['fields']));_0x2ff1c9[_0xdfde('0x43')]=_0x2ff1c9[_0xdfde('0x43')][_0xdfde('0x46')]?_0x2ff1c9[_0xdfde('0x43')]:_0x2d844d[_0xdfde('0x42')];_0x2ff1c9[_0xdfde('0x6b')]=qs[_0xdfde('0x66')](_0x38d73a[_0xdfde('0x3f')][_0xdfde('0x66')]);_0x2ff1c9[_0xdfde('0x49')]=qs['filters'](_[_0xdfde('0x4a')](_0x38d73a['query'],_0x2d844d['filters']));if(_0x38d73a[_0xdfde('0x3f')][_0xdfde('0x4b')]){_0x2ff1c9[_0xdfde('0x49')]=_[_0xdfde('0x37')](_0x2ff1c9[_0xdfde('0x49')],{'$or':_[_0xdfde('0x3d')](_0x2ff1c9[_0xdfde('0x43')],function(_0x3ef0b9){var _0x11fd0a={};_0x11fd0a[_0x3ef0b9]={'$like':'%'+_0x38d73a['query'][_0xdfde('0x4b')]+'%'};return _0x11fd0a;})});}_0x2ff1c9=_[_0xdfde('0x37')]({},_0x2ff1c9,_0x38d73a[_0xdfde('0x4d')]);return _0x380c86[_0xdfde('0xa3')](_0x2ff1c9);}})[_0xdfde('0x28')](function(_0x3a6163){if(_0x3a6163){_0x2ad633=_0x3a6163[_0xdfde('0x46')];if(!_0x38d73a[_0xdfde('0x3f')][_0xdfde('0x47')]('nolimit')){_0x2ff1c9['limit']=qs['limit'](_0x38d73a[_0xdfde('0x3f')][_0xdfde('0x23')]);_0x2ff1c9['offset']=qs[_0xdfde('0x20')](_0x38d73a['query'][_0xdfde('0x20')]);}return _0x380c86[_0xdfde('0xa3')](_0x2ff1c9);}})[_0xdfde('0x28')](function(_0x143153){return _0x143153?{'count':_0x2ad633,'rows':_0x143153}:null;})[_0xdfde('0x28')](respondWithResult(_0x1cba7e,null))[_0xdfde('0x51')](handleError(_0x1cba7e,null));};exports[_0xdfde('0xa4')]=function(_0x3f5c9a,_0x3996d6,_0x36259d){var _0x3d683f={};var _0x2b64c6={};var _0xa5b189;var _0x5e53ff;return db[_0xdfde('0x54')][_0xdfde('0x64')]({'where':{'id':_0x3f5c9a[_0xdfde('0x53')]['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x3996d6,null))[_0xdfde('0x28')](function(_0x5e876b){if(_0x5e876b){_0xa5b189=_0x5e876b;_0x2b64c6[_0xdfde('0x42')]=_[_0xdfde('0x40')](db[_0xdfde('0xa5')][_0xdfde('0x5c')]);_0x2b64c6['query']=_['keys'](_0x3f5c9a['query']);_0x2b64c6[_0xdfde('0x41')]=_[_0xdfde('0x44')](_0x2b64c6[_0xdfde('0x42')],_0x2b64c6[_0xdfde('0x3f')]);_0x3d683f['attributes']=_['intersection'](_0x2b64c6['model'],qs['fields'](_0x3f5c9a[_0xdfde('0x3f')]['fields']));_0x3d683f[_0xdfde('0x43')]=_0x3d683f['attributes'][_0xdfde('0x46')]?_0x3d683f[_0xdfde('0x43')]:_0x2b64c6[_0xdfde('0x42')];_0x3d683f['order']=qs['sort'](_0x3f5c9a[_0xdfde('0x3f')]['sort']);_0x3d683f[_0xdfde('0x49')]=qs[_0xdfde('0x41')](_[_0xdfde('0x4a')](_0x3f5c9a['query'],_0x2b64c6[_0xdfde('0x41')]));if(_0x3f5c9a[_0xdfde('0x3f')][_0xdfde('0x4b')]){_0x3d683f[_0xdfde('0x49')]=_[_0xdfde('0x37')](_0x3d683f[_0xdfde('0x49')],{'$or':_[_0xdfde('0x3d')](_0x3d683f[_0xdfde('0x43')],function(_0x5eadda){var _0x1b74c9={};_0x1b74c9[_0x5eadda]={'$like':'%'+_0x3f5c9a['query'][_0xdfde('0x4b')]+'%'};return _0x1b74c9;})});}_0x3d683f=_[_0xdfde('0x37')]({},_0x3d683f,_0x3f5c9a[_0xdfde('0x4d')]);return _0xa5b189['getLists'](_0x3d683f);}})['then'](function(_0x4cbd85){if(_0x4cbd85){_0x5e53ff=_0x4cbd85[_0xdfde('0x46')];if(!_0x3f5c9a[_0xdfde('0x3f')]['hasOwnProperty']('nolimit')){_0x3d683f['limit']=qs[_0xdfde('0x23')](_0x3f5c9a[_0xdfde('0x3f')]['limit']);_0x3d683f[_0xdfde('0x20')]=qs[_0xdfde('0x20')](_0x3f5c9a[_0xdfde('0x3f')][_0xdfde('0x20')]);}return _0xa5b189[_0xdfde('0xa4')](_0x3d683f);}})['then'](function(_0x75e549){if(_0x75e549){return _0x75e549?{'count':_0x5e53ff,'rows':_0x75e549}:null;}})[_0xdfde('0x28')](respondWithResult(_0x3996d6,null))[_0xdfde('0x51')](handleError(_0x3996d6,null));};exports['addLists']=function(_0x133476,_0x2e9ebd,_0x316df5){var _0x39550e,_0xd47dbc;return db[_0xdfde('0x54')]['find']({'where':{'id':_0x133476[_0xdfde('0x53')]['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x2e9ebd,null))['then'](function(_0x3dee72){if(_0x3dee72){_0xd47dbc=_0x3dee72;return _0x3dee72[_0xdfde('0xa6')](_0x133476['body'][_0xdfde('0x88')],_[_0xdfde('0x5d')](_0x133476[_0xdfde('0x38')],['ids','id'])||{});}return null;})[_0xdfde('0xa7')](function(_0x36db12){var _0x264b26;_0x39550e=_0x36db12||[];var _0x4d6fa5=[];if(_0x36db12){for(var _0x11ccee=0x0;_0x11ccee<_0x36db12[_0xdfde('0x46')];_0x11ccee+=0x1){var _0x2288ce=_0x36db12[_0x11ccee]['get']({'plain':!![]});_0xd47dbc[_0xdfde('0xa8')]=_0x133476['body']['dialCheckDuplicateType']?_0x133476[_0xdfde('0x38')][_0xdfde('0xa8')]:_0xd47dbc[_0xdfde('0xa8')];switch(_0xd47dbc[_0xdfde('0xa8')]){case _0xdfde('0xa9'):_0x264b26=squel[_0xdfde('0xaa')]()[_0xdfde('0xab')](_0xdfde('0xac'))[_0xdfde('0xad')]([_0xdfde('0xae'),_0xdfde('0xaf'),_0xdfde('0xb0'),_0xdfde('0xb1'),'VoiceQueueId',_0xdfde('0x5e'),_0xdfde('0x5f')],squel[_0xdfde('0x89')]()[_0xdfde('0x8a')](_0xdfde('0xae'),_0xdfde('0xae'))['field'](_0xdfde('0xb2'),_0xdfde('0xaf'))[_0xdfde('0x8a')]('id',_0xdfde('0xb0'))[_0xdfde('0x8a')](_0x2288ce[_0xdfde('0xb3')][_0xdfde('0x94')](),'ListId')[_0xdfde('0x8a')](_0x133476[_0xdfde('0x53')]['id']['toString'](),_0xdfde('0x67'))[_0xdfde('0x8a')]('NOW()',_0xdfde('0x5e'))[_0xdfde('0x8a')](_0xdfde('0xb2'),_0xdfde('0x5f'))['from'](_0xdfde('0xb4'))['where'](_0xdfde('0xb5'))[_0xdfde('0x49')](_0xdfde('0xb6'),_0x2288ce['CmListId'][_0xdfde('0x94')]())[_0xdfde('0x49')](_0xdfde('0xb7'))[_0xdfde('0x49')](_0xdfde('0xb8'),squel['select']()['field'](_0xdfde('0xb9'))['from']('cm_hopper_final')['where'](_0xdfde('0x90'),_0x133476[_0xdfde('0x53')]['id'][_0xdfde('0x94')]()))['where'](_0xdfde('0xb8'),squel[_0xdfde('0x89')]()['field'](_0xdfde('0xba'))[_0xdfde('0x8c')]('cm_hopper')['where'](_0xdfde('0x90'),_0x133476[_0xdfde('0x53')]['id'][_0xdfde('0x94')]())))[_0xdfde('0x94')]();break;case _0xdfde('0xbb'):_0x264b26=squel['insert']()[_0xdfde('0xab')](_0xdfde('0xac'))[_0xdfde('0xad')](['phone',_0xdfde('0xaf'),_0xdfde('0xb0'),'ListId',_0xdfde('0x67'),_0xdfde('0x5e'),_0xdfde('0x5f')],squel[_0xdfde('0x89')]()[_0xdfde('0x8a')](_0xdfde('0xae'),_0xdfde('0xae'))[_0xdfde('0x8a')](_0xdfde('0xb2'),_0xdfde('0xaf'))[_0xdfde('0x8a')]('id',_0xdfde('0xb0'))[_0xdfde('0x8a')](_0x2288ce[_0xdfde('0xb3')]['toString'](),_0xdfde('0xb1'))[_0xdfde('0x8a')](_0x133476[_0xdfde('0x53')]['id'][_0xdfde('0x94')](),_0xdfde('0x67'))[_0xdfde('0x8a')](_0xdfde('0xb2'),_0xdfde('0x5e'))[_0xdfde('0x8a')](_0xdfde('0xb2'),_0xdfde('0x5f'))[_0xdfde('0x8c')]('cm_contacts')['where'](_0xdfde('0xb5'))[_0xdfde('0x49')]('ListId\x20=\x20?',_0x2288ce[_0xdfde('0xb3')][_0xdfde('0x94')]())[_0xdfde('0x49')](_0xdfde('0xb7'))[_0xdfde('0x49')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xdfde('0x8a')](_0xdfde('0xba'))['from'](_0xdfde('0xac'))['where'](_0xdfde('0x90'),_0x133476[_0xdfde('0x53')]['id'][_0xdfde('0x94')]())))[_0xdfde('0x94')]();break;default:_0x264b26=squel[_0xdfde('0xaa')]()['into'](_0xdfde('0xac'))[_0xdfde('0xad')]([_0xdfde('0xae'),'scheduledAt',_0xdfde('0xb0'),_0xdfde('0xb1'),'VoiceQueueId',_0xdfde('0x5e'),_0xdfde('0x5f')],squel[_0xdfde('0x89')]()['field'](_0xdfde('0xae'),_0xdfde('0xae'))['field']('NOW()',_0xdfde('0xaf'))[_0xdfde('0x8a')]('id',_0xdfde('0xb0'))[_0xdfde('0x8a')](_0x2288ce[_0xdfde('0xb3')][_0xdfde('0x94')](),_0xdfde('0xb1'))['field'](_0x133476['params']['id'][_0xdfde('0x94')](),_0xdfde('0x67'))[_0xdfde('0x8a')]('NOW()','createdAt')[_0xdfde('0x8a')](_0xdfde('0xb2'),'updatedAt')[_0xdfde('0x8c')](_0xdfde('0xb4'))[_0xdfde('0x49')](_0xdfde('0xb5'))[_0xdfde('0x49')](_0xdfde('0xb6'),_0x2288ce['CmListId'][_0xdfde('0x94')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xdfde('0x94')]();}_0x4d6fa5[_0xdfde('0x93')](db['sequelize'][_0xdfde('0x3f')](_0x264b26));}return BPromise[_0xdfde('0x99')](_0x4d6fa5);}})[_0xdfde('0x28')](function(){return _0x39550e;})['then'](respondWithResult(_0x2e9ebd,null))[_0xdfde('0x51')](handleError(_0x2e9ebd,null));};exports['removeLists']=function(_0x5679c3,_0x450275,_0x512af9){return db[_0xdfde('0x54')]['find']({'where':{'id':_0x5679c3['params']['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x450275,null))[_0xdfde('0x28')](function(_0x20dd82){if(_0x20dd82){return _0x20dd82['removeLists'](_0x5679c3[_0xdfde('0x3f')][_0xdfde('0x88')]);}})[_0xdfde('0x28')](function(_0x19ce9f){if(_0x19ce9f){return db['CmHopper'][_0xdfde('0x29')]({'where':{'ListId':_0x5679c3[_0xdfde('0x3f')]['ids'],'VoiceQueueId':_0x5679c3[_0xdfde('0x53')]['id']}})[_0xdfde('0x28')](function(){return _0x19ce9f;});}})[_0xdfde('0x28')](respondWithStatusCode(_0x450275,null))[_0xdfde('0x51')](handleError(_0x450275,null));};exports[_0xdfde('0xbc')]=function(_0x2b6460,_0x2141d2,_0x29176e){var _0x25a4cd={};var _0x41569f={};var _0x35cbe6;var _0x1728d5;return db[_0xdfde('0x54')][_0xdfde('0x64')]({'where':{'id':_0x2b6460['params']['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x2141d2,null))[_0xdfde('0x28')](function(_0x45214c){if(_0x45214c){_0x35cbe6=_0x45214c;_0x41569f[_0xdfde('0x42')]=_[_0xdfde('0x40')](db['CmList'][_0xdfde('0x5c')]);_0x41569f['query']=_[_0xdfde('0x40')](_0x2b6460[_0xdfde('0x3f')]);_0x41569f['filters']=_[_0xdfde('0x44')](_0x41569f[_0xdfde('0x42')],_0x41569f[_0xdfde('0x3f')]);_0x25a4cd['attributes']=_[_0xdfde('0x44')](_0x41569f[_0xdfde('0x42')],qs[_0xdfde('0x45')](_0x2b6460[_0xdfde('0x3f')][_0xdfde('0x45')]));_0x25a4cd[_0xdfde('0x43')]=_0x25a4cd[_0xdfde('0x43')][_0xdfde('0x46')]?_0x25a4cd['attributes']:_0x41569f['model'];_0x25a4cd['order']=qs[_0xdfde('0x66')](_0x2b6460['query'][_0xdfde('0x66')]);_0x25a4cd['where']=qs[_0xdfde('0x41')](_[_0xdfde('0x4a')](_0x2b6460[_0xdfde('0x3f')],_0x41569f[_0xdfde('0x41')]));if(_0x2b6460[_0xdfde('0x3f')][_0xdfde('0x4b')]){_0x25a4cd['where']=_[_0xdfde('0x37')](_0x25a4cd[_0xdfde('0x49')],{'$or':_['map'](_0x25a4cd[_0xdfde('0x43')],function(_0x1a83f8){var _0x430634={};_0x430634[_0x1a83f8]={'$like':'%'+_0x2b6460['query'][_0xdfde('0x4b')]+'%'};return _0x430634;})});}_0x25a4cd=_['merge']({},_0x25a4cd,_0x2b6460[_0xdfde('0x4d')]);return _0x35cbe6[_0xdfde('0xbc')](_0x25a4cd);}})[_0xdfde('0x28')](function(_0x385c11){if(_0x385c11){_0x1728d5=_0x385c11[_0xdfde('0x46')];if(!_0x2b6460['query']['hasOwnProperty'](_0xdfde('0x48'))){_0x25a4cd[_0xdfde('0x23')]=qs[_0xdfde('0x23')](_0x2b6460['query']['limit']);_0x25a4cd[_0xdfde('0x20')]=qs[_0xdfde('0x20')](_0x2b6460[_0xdfde('0x3f')][_0xdfde('0x20')]);}return _0x35cbe6['getBlackLists'](_0x25a4cd);}})['then'](function(_0x2345e5){if(_0x2345e5){return _0x2345e5?{'count':_0x1728d5,'rows':_0x2345e5}:null;}})['then'](respondWithResult(_0x2141d2,null))['catch'](handleError(_0x2141d2,null));};exports[_0xdfde('0xbd')]=function(_0x2cf933,_0xac2bae,_0x50160c){var _0x295304,_0x4d2aae;return db[_0xdfde('0x54')][_0xdfde('0x30')]({'where':{'id':_0x2cf933[_0xdfde('0x53')]['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0xac2bae,null))[_0xdfde('0x28')](function(_0x40cab3){if(_0x40cab3){_0x4d2aae=_0x40cab3;return _0x40cab3[_0xdfde('0xbd')](_0x2cf933['body'][_0xdfde('0x88')],_[_0xdfde('0x5d')](_0x2cf933[_0xdfde('0x38')],[_0xdfde('0x88'),'id'])||{});}return null;})[_0xdfde('0xa7')](function(_0x56a002){var _0x153e6b;_0x295304=_0x56a002||[];var _0x49eeb9=[];if(_0x56a002){for(var _0x215702=0x0;_0x215702<_0x56a002['length'];_0x215702+=0x1){var _0x4ab590=_0x56a002[_0x215702][_0xdfde('0x2a')]({'plain':!![]});_0x153e6b=squel[_0xdfde('0xaa')]()[_0xdfde('0xab')](_0xdfde('0xbe'))['fromQuery']([_0xdfde('0xae'),_0xdfde('0xb0'),_0xdfde('0xb1'),_0xdfde('0x67'),_0xdfde('0x5e'),_0xdfde('0x5f')],squel['select']()[_0xdfde('0x8a')](_0xdfde('0xae'),'phone')[_0xdfde('0x8a')]('id',_0xdfde('0xb0'))['field'](_0x4ab590[_0xdfde('0xb3')]['toString'](),'ListId')['field'](_0x2cf933['params']['id'][_0xdfde('0x94')](),_0xdfde('0x67'))[_0xdfde('0x8a')]('NOW()','createdAt')['field']('NOW()',_0xdfde('0x5f'))['from'](_0xdfde('0xb4'))[_0xdfde('0x49')]('deletedAt\x20IS\x20NULL')[_0xdfde('0x49')]('ListId\x20=\x20?',_0x4ab590[_0xdfde('0xb3')][_0xdfde('0x94')]())['where'](_0xdfde('0xb7')))[_0xdfde('0x94')]();_0x49eeb9[_0xdfde('0x93')](db[_0xdfde('0x7c')]['query'](_0x153e6b));}return BPromise['all'](_0x49eeb9);}})[_0xdfde('0x28')](function(){return _0x295304;})['then'](respondWithResult(_0xac2bae,null))[_0xdfde('0x51')](handleError(_0xac2bae,null));};exports[_0xdfde('0xbf')]=function(_0x482113,_0x1cbb12,_0x429ae3){return db[_0xdfde('0x54')][_0xdfde('0x30')]({'where':{'id':_0x482113['params']['id']}})[_0xdfde('0x28')](handleEntityNotFound(_0x1cbb12,null))[_0xdfde('0x28')](function(_0x289675){if(_0x289675){return _0x289675['removeBlackLists'](_0x482113[_0xdfde('0x3f')]['ids']);}})[_0xdfde('0x28')](function(_0x53d4a6){if(_0x53d4a6){return db[_0xdfde('0x6f')]['destroy']({'where':{'ListId':_0x482113['query'][_0xdfde('0x88')],'VoiceQueueId':_0x482113[_0xdfde('0x53')]['id']}})['then'](function(){return _0x53d4a6;});}})[_0xdfde('0x28')](respondWithStatusCode(_0x1cbb12,null))[_0xdfde('0x51')](handleError(_0x1cbb12,null));}; \ No newline at end of file +var _0x9c2c=['register','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','render','merge','body','contact','message','agent','account','map','rawAttributes','fieldName','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','VoiceQueue','includeAll','include','findAll','rows','show','create','user','role','outbound','UserProfileSection','userProfileId','autoAssociation','catch','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperBlacks','CmHopperBlack','Team','getTeams','User','Agents','online','voicePause','interface','flatMap','forEach','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','penalty','findOrCreate','UserVoiceQueueRt','isNil','format','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','ids','isEmpty','removeAgents','userVoiceQueue:remove','spread','SIP/%s','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','ContactId','CmListId','ListId','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter'];(function(_0x153cdf,_0x327346){var _0x7313bb=function(_0xa99f72){while(--_0xa99f72){_0x153cdf['push'](_0x153cdf['shift']());}};_0x7313bb(++_0x327346);}(_0x9c2c,0x161));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc9c2('0x0'));var rimraf=require(_0xc9c2('0x1'));var zipdir=require(_0xc9c2('0x2'));var jsonpatch=require(_0xc9c2('0x3'));var rp=require(_0xc9c2('0x4'));var moment=require(_0xc9c2('0x5'));var BPromise=require(_0xc9c2('0x6'));var Mustache=require(_0xc9c2('0x7'));var util=require(_0xc9c2('0x8'));var path=require(_0xc9c2('0x9'));var sox=require(_0xc9c2('0xa'));var csv=require('to-csv');var ejs=require(_0xc9c2('0xb'));var fs=require('fs');var fs_extra=require(_0xc9c2('0xc'));var _=require('lodash');var squel=require(_0xc9c2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc9c2('0xe'));var toCsv=require(_0xc9c2('0xf'));var querystring=require(_0xc9c2('0x10'));var Papa=require(_0xc9c2('0x11'));var Redis=require(_0xc9c2('0x12'));var authService=require(_0xc9c2('0x13'));var qs=require(_0xc9c2('0x14'));var as=require(_0xc9c2('0x15'));var hardwareService=require(_0xc9c2('0x16'));var logger=require('../../config/logger')(_0xc9c2('0x17'));var utils=require(_0xc9c2('0x18'));var config=require(_0xc9c2('0x19'));var licenseUtil=require(_0xc9c2('0x1a'));var db=require('../../mysqldb')['db'];config[_0xc9c2('0x1b')]=_['defaults'](config[_0xc9c2('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc9c2('0x1c'))(new Redis(config[_0xc9c2('0x1b')]));require('./voiceQueue.socket')[_0xc9c2('0x1d')](socket);function respondWithStatusCode(_0x152ef6,_0x5beccd){_0x5beccd=_0x5beccd||0xcc;return function(_0x5efb67){if(_0x5efb67){return _0x152ef6[_0xc9c2('0x1e')](_0x5beccd);}return _0x152ef6['status'](_0x5beccd)['end']();};}function respondWithResult(_0x589885,_0x398f17){_0x398f17=_0x398f17||0xc8;return function(_0x4f014b){if(_0x4f014b){return _0x589885['status'](_0x398f17)[_0xc9c2('0x1f')](_0x4f014b);}};}function respondWithFilteredResult(_0x450b9a,_0x255897){return function(_0x76f3a7){if(_0x76f3a7){var _0x37226c=typeof _0x255897[_0xc9c2('0x20')]===_0xc9c2('0x21')&&typeof _0x255897[_0xc9c2('0x22')]===_0xc9c2('0x21');var _0x15c1e5=_0x76f3a7[_0xc9c2('0x23')];var _0x308cf1=_0x37226c?0x0:_0x255897[_0xc9c2('0x20')];var _0x15b185=_0x37226c?_0x76f3a7[_0xc9c2('0x23')]:_0x255897[_0xc9c2('0x20')]+_0x255897[_0xc9c2('0x22')];var _0xffedc;if(_0x15b185>=_0x15c1e5){_0x15b185=_0x15c1e5;_0xffedc=0xc8;}else{_0xffedc=0xce;}_0x450b9a[_0xc9c2('0x24')](_0xffedc);return _0x450b9a[_0xc9c2('0x25')](_0xc9c2('0x26'),_0x308cf1+'-'+_0x15b185+'/'+_0x15c1e5)['json'](_0x76f3a7);}return null;};}function patchUpdates(_0x371815){return function(_0x50e878){try{jsonpatch[_0xc9c2('0x27')](_0x50e878,_0x371815,!![]);}catch(_0x2de3bd){return BPromise[_0xc9c2('0x28')](_0x2de3bd);}return _0x50e878[_0xc9c2('0x29')]();};}function saveUpdates(_0x5155e1,_0x3d2c76){return function(_0x1d699d){if(_0x1d699d){return _0x1d699d[_0xc9c2('0x2a')](_0x5155e1)[_0xc9c2('0x2b')](function(_0x2cb88c){return _0x2cb88c;});}return null;};}function removeEntity(_0xf057f1,_0x245568){return function(_0x4829a6){if(_0x4829a6){return _0x4829a6[_0xc9c2('0x2c')]()[_0xc9c2('0x2b')](function(){var _0x497cef=_0x4829a6[_0xc9c2('0x2d')]({'plain':!![]});var _0x32faf4=[{'name':_0xc9c2('0x2e'),'value':_0xc9c2('0x2f'),'ignore':![]},{'name':_0xc9c2('0x30'),'value':'outbound','ignore':![]}];var _0x31ea6e=_(_0x32faf4)['filter'](_0xc9c2('0x31'))['map'](_0xc9c2('0x32'))[_0xc9c2('0x32')]();if(_[_0xc9c2('0x33')](_0x31ea6e,_0x497cef[_0xc9c2('0x34')])){return;}var _0x31d33f=_[_0xc9c2('0x35')](_0x32faf4,[_0xc9c2('0x32'),_0x497cef[_0xc9c2('0x34')]])[_0xc9c2('0x36')];return db[_0xc9c2('0x37')][_0xc9c2('0x2c')]({'where':{'type':_0x31d33f,'resourceId':_0x497cef['id']}})[_0xc9c2('0x2b')](function(){return _0x4829a6;});})['then'](function(){_0xf057f1[_0xc9c2('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d021a,_0x4fdbe1){return function(_0x3b462e){if(!_0x3b462e){_0x1d021a[_0xc9c2('0x1e')](0x194);}return _0x3b462e;};}function handleError(_0x48874b,_0x34136d){_0x34136d=_0x34136d||0x1f4;return function(_0x310cc7){logger[_0xc9c2('0x38')](_0x310cc7[_0xc9c2('0x39')]);if(_0x310cc7['name']){delete _0x310cc7[_0xc9c2('0x36')];}_0x48874b[_0xc9c2('0x24')](_0x34136d)[_0xc9c2('0x3a')](_0x310cc7);};}function getMustacheRender(_0x25e481,_0x4dfddf){return Mustache[_0xc9c2('0x3b')](_0x25e481,_[_0xc9c2('0x3c')](_0x4dfddf[_0xc9c2('0x3d')],{'contact':_0x4dfddf[_0xc9c2('0x3e')],'message':_0x4dfddf[_0xc9c2('0x3f')],'agent':_0x4dfddf[_0xc9c2('0x40')],'interaction':_0x4dfddf['interaction'],'account':_0x4dfddf[_0xc9c2('0x41')]}))||'';}exports['index']=function(_0x1b9802,_0x98b306){var _0x325b8b={},_0x4b6a30={},_0x32d89c={'count':0x0,'rows':[]};var _0xb3c0c5=_[_0xc9c2('0x42')](db['VoiceQueue'][_0xc9c2('0x43')],function(_0x3dd51b){return{'name':_0x3dd51b[_0xc9c2('0x44')],'type':_0x3dd51b[_0xc9c2('0x34')]['key']};});_0x4b6a30[_0xc9c2('0x45')]=_['map'](_0xb3c0c5,'name');_0x4b6a30['query']=_[_0xc9c2('0x46')](_0x1b9802['query']);_0x4b6a30['filters']=_['intersection'](_0x4b6a30[_0xc9c2('0x45')],_0x4b6a30[_0xc9c2('0x47')]);_0x325b8b[_0xc9c2('0x48')]=_[_0xc9c2('0x49')](_0x4b6a30[_0xc9c2('0x45')],qs[_0xc9c2('0x4a')](_0x1b9802[_0xc9c2('0x47')][_0xc9c2('0x4a')]));_0x325b8b['attributes']=_0x325b8b[_0xc9c2('0x48')][_0xc9c2('0x4b')]?_0x325b8b[_0xc9c2('0x48')]:_0x4b6a30[_0xc9c2('0x45')];if(!_0x1b9802[_0xc9c2('0x47')][_0xc9c2('0x4c')](_0xc9c2('0x4d'))){_0x325b8b['limit']=qs['limit'](_0x1b9802[_0xc9c2('0x47')][_0xc9c2('0x22')]);_0x325b8b['offset']=qs[_0xc9c2('0x20')](_0x1b9802[_0xc9c2('0x47')][_0xc9c2('0x20')]);}_0x325b8b[_0xc9c2('0x4e')]=qs[_0xc9c2('0x4f')](_0x1b9802[_0xc9c2('0x47')][_0xc9c2('0x4f')]);_0x325b8b[_0xc9c2('0x50')]=qs[_0xc9c2('0x51')](_[_0xc9c2('0x52')](_0x1b9802[_0xc9c2('0x47')],_0x4b6a30[_0xc9c2('0x51')]),_0xb3c0c5);if(_0x1b9802[_0xc9c2('0x47')][_0xc9c2('0x53')]){_0x325b8b[_0xc9c2('0x50')]=_[_0xc9c2('0x3c')](_0x325b8b['where'],{'$or':_[_0xc9c2('0x42')](_0xb3c0c5,function(_0x362fbb){if(_0x362fbb[_0xc9c2('0x34')]!==_0xc9c2('0x54')){var _0x149869={};_0x149869[_0x362fbb['name']]={'$like':'%'+_0x1b9802[_0xc9c2('0x47')][_0xc9c2('0x53')]+'%'};return _0x149869;}})});}_0x325b8b=_['merge']({},_0x325b8b,_0x1b9802[_0xc9c2('0x55')]);var _0x410f66={'where':_0x325b8b[_0xc9c2('0x50')]};return db[_0xc9c2('0x56')]['count'](_0x410f66)[_0xc9c2('0x2b')](function(_0x4f784b){_0x32d89c[_0xc9c2('0x23')]=_0x4f784b;if(_0x1b9802[_0xc9c2('0x47')][_0xc9c2('0x57')]){_0x325b8b[_0xc9c2('0x58')]=[{'all':!![]}];}return db[_0xc9c2('0x56')][_0xc9c2('0x59')](_0x325b8b);})[_0xc9c2('0x2b')](function(_0x407dcb){_0x32d89c[_0xc9c2('0x5a')]=_0x407dcb;return _0x32d89c;})[_0xc9c2('0x2b')](respondWithFilteredResult(_0x98b306,_0x325b8b))['catch'](handleError(_0x98b306,null));};exports[_0xc9c2('0x5b')]=function(_0x511536,_0x587d8f){var _0x23c3ae={'raw':![],'where':{'id':_0x511536['params']['id']}},_0x3fa50f={};_0x3fa50f[_0xc9c2('0x45')]=_[_0xc9c2('0x46')](db[_0xc9c2('0x56')][_0xc9c2('0x43')]);_0x3fa50f[_0xc9c2('0x47')]=_[_0xc9c2('0x46')](_0x511536['query']);_0x3fa50f[_0xc9c2('0x51')]=_[_0xc9c2('0x49')](_0x3fa50f[_0xc9c2('0x45')],_0x3fa50f[_0xc9c2('0x47')]);_0x23c3ae['attributes']=_[_0xc9c2('0x49')](_0x3fa50f[_0xc9c2('0x45')],qs[_0xc9c2('0x4a')](_0x511536[_0xc9c2('0x47')]['fields']));_0x23c3ae[_0xc9c2('0x48')]=_0x23c3ae['attributes']['length']?_0x23c3ae[_0xc9c2('0x48')]:_0x3fa50f[_0xc9c2('0x45')];if(_0x511536[_0xc9c2('0x47')]['includeAll']){_0x23c3ae[_0xc9c2('0x58')]=[{'all':!![]}];}_0x23c3ae=_[_0xc9c2('0x3c')]({},_0x23c3ae,_0x511536[_0xc9c2('0x55')]);return db['VoiceQueue']['find'](_0x23c3ae)['then'](handleEntityNotFound(_0x587d8f,null))[_0xc9c2('0x2b')](respondWithResult(_0x587d8f,null))['catch'](handleError(_0x587d8f,null));};exports[_0xc9c2('0x5c')]=function(_0x2b5570,_0x5bbb89){return db[_0xc9c2('0x56')][_0xc9c2('0x5c')](_0x2b5570[_0xc9c2('0x3d')],{})[_0xc9c2('0x2b')](function(_0x4a19e0){var _0x5249d8=_0x2b5570[_0xc9c2('0x5d')]['get']({'plain':!![]});if(!_0x5249d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5249d8[_0xc9c2('0x5e')]===_0xc9c2('0x5d')){var _0x1090f9=_0x4a19e0[_0xc9c2('0x2d')]({'plain':!![]});var _0x1df130=[{'name':_0xc9c2('0x2e'),'value':_0xc9c2('0x2f')},{'name':'QueueCampaigns','value':_0xc9c2('0x5f')}];var _0xa2554d=_['find'](_0x1df130,['value',_0x1090f9[_0xc9c2('0x34')]])['name'];return db[_0xc9c2('0x60')][_0xc9c2('0x35')]({'where':{'name':_0xa2554d,'userProfileId':_0x5249d8[_0xc9c2('0x61')]},'raw':!![]})[_0xc9c2('0x2b')](function(_0x4394ba){if(_0x4394ba&&_0x4394ba[_0xc9c2('0x62')]===0x0){return db[_0xc9c2('0x37')][_0xc9c2('0x5c')]({'name':_0x1090f9[_0xc9c2('0x36')],'resourceId':_0x1090f9['id'],'type':_0x4394ba[_0xc9c2('0x36')],'sectionId':_0x4394ba['id']},{})['then'](function(){return _0x4a19e0;});}else{return _0x4a19e0;}})[_0xc9c2('0x63')](function(_0x10c7a3){logger[_0xc9c2('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10c7a3);throw _0x10c7a3;});}return _0x4a19e0;})[_0xc9c2('0x2b')](respondWithResult(_0x5bbb89,0xc9))[_0xc9c2('0x63')](handleError(_0x5bbb89,null));};exports[_0xc9c2('0x64')]=function(_0x378484,_0x43483e){var _0x54b132={'where':{'id':_0x378484['params']['id']}},_0x32df74={};_0x32df74[_0xc9c2('0x45')]=_[_0xc9c2('0x46')](db[_0xc9c2('0x56')]['rawAttributes']);_0x54b132[_0xc9c2('0x48')]=_['intersection'](_0x32df74[_0xc9c2('0x45')],qs[_0xc9c2('0x4a')](_0x378484['query'][_0xc9c2('0x4a')]));_0x54b132['attributes']=_0x54b132[_0xc9c2('0x48')][_0xc9c2('0x4b')]?_0x54b132['attributes']:_0x32df74[_0xc9c2('0x45')];if(_0x378484[_0xc9c2('0x47')]['includeAll']){_0x54b132['include']=[{'all':!![]}];}_0x54b132=_[_0xc9c2('0x3c')]({},_0x54b132,_0x378484[_0xc9c2('0x55')]);return db[_0xc9c2('0x56')]['find'](_0x54b132)[_0xc9c2('0x2b')](handleEntityNotFound(_0x43483e,null))['then'](function(_0x1c40f8){if(_0x1c40f8){var _0x44f024=_0x1c40f8[_0xc9c2('0x2d')]({'plain':!![]});_0x44f024=qs[_0xc9c2('0x65')](_0x44f024,['id',_0xc9c2('0x66'),'updatedAt']);_0x378484[_0xc9c2('0x3d')]=_[_0xc9c2('0x65')](_0x378484[_0xc9c2('0x3d')],['id','createdAt',_0xc9c2('0x67')]);return db[_0xc9c2('0x56')][_0xc9c2('0x5c')](_[_0xc9c2('0x3c')](_0x44f024,_0x378484[_0xc9c2('0x3d')]),{'include':_0x378484['query']['includeAll']?[{'all':!![]}]:undefined})[_0xc9c2('0x2b')](function(_0xe3fefb){var _0x31d2a0=_0x378484[_0xc9c2('0x5d')][_0xc9c2('0x2d')]({'plain':!![]});if(!_0x31d2a0)throw new Error(_0xc9c2('0x68'));if(_0x31d2a0['role']===_0xc9c2('0x5d')){var _0x392109=_0xe3fefb[_0xc9c2('0x2d')]({'plain':!![]});var _0x3f89ed=[{'name':_0xc9c2('0x2e'),'value':_0xc9c2('0x2f')},{'name':'QueueCampaigns','value':_0xc9c2('0x5f')}];var _0x17d645=_[_0xc9c2('0x35')](_0x3f89ed,['value',_0x392109['type']])[_0xc9c2('0x36')];return db[_0xc9c2('0x60')][_0xc9c2('0x35')]({'where':{'name':_0x17d645,'userProfileId':_0x31d2a0[_0xc9c2('0x61')]},'raw':!![]})['then'](function(_0x13885b){if(_0x13885b&&_0x13885b['autoAssociation']===0x0){return db[_0xc9c2('0x37')][_0xc9c2('0x5c')]({'name':_0x392109[_0xc9c2('0x36')],'resourceId':_0x392109['id'],'type':_0x13885b['name'],'sectionId':_0x13885b['id']},{})[_0xc9c2('0x2b')](function(){return _0xe3fefb;});}else{return _0xe3fefb;}})[_0xc9c2('0x63')](function(_0x4d8045){logger['error'](_0xc9c2('0x69'),_0x4d8045);throw _0x4d8045;});}return _0xe3fefb;});}})['then'](respondWithResult(_0x43483e,0xc9))['catch'](handleError(_0x43483e,null));};exports['update']=function(_0xbfdf2e,_0x304bcc){if(_0xbfdf2e[_0xc9c2('0x3d')]['id']){delete _0xbfdf2e[_0xc9c2('0x3d')]['id'];}return db[_0xc9c2('0x56')][_0xc9c2('0x35')]({'where':{'id':_0xbfdf2e['params']['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x304bcc,null))[_0xc9c2('0x2b')](saveUpdates(_0xbfdf2e[_0xc9c2('0x3d')],null))[_0xc9c2('0x2b')](respondWithResult(_0x304bcc,null))[_0xc9c2('0x63')](handleError(_0x304bcc,null));};exports[_0xc9c2('0x2c')]=function(_0x37b455,_0x49f247){return db['VoiceQueue'][_0xc9c2('0x35')]({'where':{'id':_0x37b455[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x49f247,null))[_0xc9c2('0x2b')](removeEntity(_0x49f247,null))[_0xc9c2('0x63')](handleError(_0x49f247,null));};exports[_0xc9c2('0x6b')]=function(_0x4fe174,_0x2efba2,_0x43f600){var _0x132af9={'raw':![],'where':{}};var _0x29cb67={};var _0x2418a6={'count':0x0,'rows':[]};return db[_0xc9c2('0x56')][_0xc9c2('0x6c')]({'where':{'id':_0x4fe174[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x2efba2,null))[_0xc9c2('0x2b')](function(_0x16bc8c){if(_0x16bc8c){_0x29cb67[_0xc9c2('0x45')]=_['keys'](db['CmHopper'][_0xc9c2('0x43')]);_0x29cb67[_0xc9c2('0x47')]=_[_0xc9c2('0x46')](_0x4fe174['query']);_0x29cb67[_0xc9c2('0x51')]=_['intersection'](_0x29cb67['model'],_0x29cb67[_0xc9c2('0x47')]);_0x132af9[_0xc9c2('0x48')]=_[_0xc9c2('0x49')](_0x29cb67['model'],qs['fields'](_0x4fe174[_0xc9c2('0x47')][_0xc9c2('0x4a')]));_0x132af9['attributes']=_0x132af9[_0xc9c2('0x48')][_0xc9c2('0x4b')]?_0x132af9['attributes']:_0x29cb67[_0xc9c2('0x45')];if(!_0x4fe174[_0xc9c2('0x47')]['hasOwnProperty'](_0xc9c2('0x4d'))){_0x132af9['limit']=qs[_0xc9c2('0x22')](_0x4fe174['query'][_0xc9c2('0x22')]);_0x132af9['offset']=qs[_0xc9c2('0x20')](_0x4fe174[_0xc9c2('0x47')][_0xc9c2('0x20')]);}_0x132af9[_0xc9c2('0x4e')]=qs['sort'](_0x4fe174['query'][_0xc9c2('0x4f')]);_0x132af9[_0xc9c2('0x50')]=qs[_0xc9c2('0x51')](_[_0xc9c2('0x52')](_0x4fe174[_0xc9c2('0x47')],_0x29cb67[_0xc9c2('0x51')]));_0x132af9[_0xc9c2('0x50')][_0xc9c2('0x6d')]=_0x16bc8c['id'];if(_0x4fe174[_0xc9c2('0x47')]['filter']){_0x132af9['where']=_[_0xc9c2('0x3c')](_0x132af9[_0xc9c2('0x50')],{'$or':_[_0xc9c2('0x42')](_0x132af9['attributes'],function(_0x5ed6f5){var _0x596a23={};_0x596a23[_0x5ed6f5]={'$like':'%'+_0x4fe174[_0xc9c2('0x47')][_0xc9c2('0x53')]+'%'};return _0x596a23;})});}_0x132af9=_[_0xc9c2('0x3c')]({},_0x132af9,_0x4fe174[_0xc9c2('0x55')]);return db[_0xc9c2('0x6e')][_0xc9c2('0x23')]({'where':_0x132af9[_0xc9c2('0x50')]})[_0xc9c2('0x2b')](function(_0x4ac68b){_0x2418a6[_0xc9c2('0x23')]=_0x4ac68b;if(_0x4fe174[_0xc9c2('0x47')][_0xc9c2('0x57')]){_0x132af9[_0xc9c2('0x58')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x132af9);})[_0xc9c2('0x2b')](function(_0x3d2771){_0x2418a6[_0xc9c2('0x5a')]=_0x3d2771;return _0x2418a6;});}})[_0xc9c2('0x2b')](respondWithFilteredResult(_0x2efba2,_0x132af9))[_0xc9c2('0x63')](handleError(_0x2efba2,null));};exports[_0xc9c2('0x6f')]=function(_0x51eb65,_0xcef32c,_0x54f7a8){var _0x4e85a2={'raw':!![],'where':{}};var _0x2d30c8={};var _0x11544c={'count':0x0,'rows':[]};return db[_0xc9c2('0x56')][_0xc9c2('0x6c')]({'where':{'id':_0x51eb65['params']['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0xcef32c,null))[_0xc9c2('0x2b')](function(_0x4ca55f){if(_0x4ca55f){_0x2d30c8[_0xc9c2('0x45')]=_[_0xc9c2('0x46')](db[_0xc9c2('0x70')][_0xc9c2('0x43')]);_0x2d30c8[_0xc9c2('0x47')]=_[_0xc9c2('0x46')](_0x51eb65[_0xc9c2('0x47')]);_0x2d30c8[_0xc9c2('0x51')]=_[_0xc9c2('0x49')](_0x2d30c8[_0xc9c2('0x45')],_0x2d30c8[_0xc9c2('0x47')]);_0x4e85a2['attributes']=_[_0xc9c2('0x49')](_0x2d30c8[_0xc9c2('0x45')],qs[_0xc9c2('0x4a')](_0x51eb65[_0xc9c2('0x47')][_0xc9c2('0x4a')]));_0x4e85a2['attributes']=_0x4e85a2[_0xc9c2('0x48')][_0xc9c2('0x4b')]?_0x4e85a2[_0xc9c2('0x48')]:_0x2d30c8[_0xc9c2('0x45')];if(!_0x51eb65[_0xc9c2('0x47')][_0xc9c2('0x4c')](_0xc9c2('0x4d'))){_0x4e85a2['limit']=qs[_0xc9c2('0x22')](_0x51eb65[_0xc9c2('0x47')][_0xc9c2('0x22')]);_0x4e85a2[_0xc9c2('0x20')]=qs[_0xc9c2('0x20')](_0x51eb65['query'][_0xc9c2('0x20')]);}_0x4e85a2[_0xc9c2('0x4e')]=qs['sort'](_0x51eb65[_0xc9c2('0x47')][_0xc9c2('0x4f')]);_0x4e85a2[_0xc9c2('0x50')]=qs[_0xc9c2('0x51')](_[_0xc9c2('0x52')](_0x51eb65[_0xc9c2('0x47')],_0x2d30c8['filters']));_0x4e85a2['where'][_0xc9c2('0x6d')]=_0x4ca55f['id'];if(_0x51eb65[_0xc9c2('0x47')][_0xc9c2('0x53')]){_0x4e85a2[_0xc9c2('0x50')]=_['merge'](_0x4e85a2[_0xc9c2('0x50')],{'$or':_['map'](_0x4e85a2[_0xc9c2('0x48')],function(_0x44bfbc){var _0x6e92b={};_0x6e92b[_0x44bfbc]={'$like':'%'+_0x51eb65[_0xc9c2('0x47')][_0xc9c2('0x53')]+'%'};return _0x6e92b;})});}_0x4e85a2=_[_0xc9c2('0x3c')]({},_0x4e85a2,_0x51eb65[_0xc9c2('0x55')]);return db[_0xc9c2('0x70')][_0xc9c2('0x23')]({'where':_0x4e85a2[_0xc9c2('0x50')]})[_0xc9c2('0x2b')](function(_0x340dc2){_0x11544c[_0xc9c2('0x23')]=_0x340dc2;if(_0x51eb65['query'][_0xc9c2('0x57')]){_0x4e85a2['include']=[{'all':!![]}];}return db[_0xc9c2('0x70')]['findAll'](_0x4e85a2);})[_0xc9c2('0x2b')](function(_0x340282){_0x11544c[_0xc9c2('0x5a')]=_0x340282;return _0x11544c;});}})['then'](respondWithFilteredResult(_0xcef32c,_0x4e85a2))[_0xc9c2('0x63')](handleError(_0xcef32c,null));};exports['getHopperFinals']=function(_0x33fc91,_0x5f23e8,_0x31f35e){var _0x44d7d2={'raw':!![],'where':{}};var _0x33cac1={};var _0x699f3d={'count':0x0,'rows':[]};return db[_0xc9c2('0x56')][_0xc9c2('0x6c')]({'where':{'id':_0x33fc91[_0xc9c2('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5f23e8,null))[_0xc9c2('0x2b')](function(_0x19c722){if(_0x19c722){_0x33cac1['model']=_['keys'](db['CmHopperFinal'][_0xc9c2('0x43')]);_0x33cac1[_0xc9c2('0x47')]=_[_0xc9c2('0x46')](_0x33fc91[_0xc9c2('0x47')]);_0x33cac1[_0xc9c2('0x51')]=_[_0xc9c2('0x49')](_0x33cac1[_0xc9c2('0x45')],_0x33cac1['query']);_0x44d7d2[_0xc9c2('0x48')]=_[_0xc9c2('0x49')](_0x33cac1[_0xc9c2('0x45')],qs['fields'](_0x33fc91[_0xc9c2('0x47')][_0xc9c2('0x4a')]));_0x44d7d2[_0xc9c2('0x48')]=_0x44d7d2['attributes'][_0xc9c2('0x4b')]?_0x44d7d2[_0xc9c2('0x48')]:_0x33cac1['model'];if(!_0x33fc91[_0xc9c2('0x47')][_0xc9c2('0x4c')](_0xc9c2('0x4d'))){_0x44d7d2[_0xc9c2('0x22')]=qs[_0xc9c2('0x22')](_0x33fc91[_0xc9c2('0x47')][_0xc9c2('0x22')]);_0x44d7d2['offset']=qs[_0xc9c2('0x20')](_0x33fc91[_0xc9c2('0x47')][_0xc9c2('0x20')]);}_0x44d7d2[_0xc9c2('0x4e')]=qs[_0xc9c2('0x4f')](_0x33fc91[_0xc9c2('0x47')][_0xc9c2('0x4f')]);_0x44d7d2[_0xc9c2('0x50')]=qs['filters'](_['pick'](_0x33fc91['query'],_0x33cac1['filters']));_0x44d7d2['where'][_0xc9c2('0x6d')]=_0x19c722['id'];if(_0x33fc91[_0xc9c2('0x47')]['filter']){_0x44d7d2[_0xc9c2('0x50')]=_[_0xc9c2('0x3c')](_0x44d7d2['where'],{'$or':_[_0xc9c2('0x42')](_0x44d7d2['attributes'],function(_0x23482c){var _0x577d72={};_0x577d72[_0x23482c]={'$like':'%'+_0x33fc91[_0xc9c2('0x47')][_0xc9c2('0x53')]+'%'};return _0x577d72;})});}_0x44d7d2=_[_0xc9c2('0x3c')]({},_0x44d7d2,_0x33fc91['options']);return db['CmHopperFinal']['count']({'where':_0x44d7d2[_0xc9c2('0x50')]})[_0xc9c2('0x2b')](function(_0x28e25a){_0x699f3d['count']=_0x28e25a;if(_0x33fc91[_0xc9c2('0x47')][_0xc9c2('0x57')]){_0x44d7d2[_0xc9c2('0x58')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xc9c2('0x59')](_0x44d7d2);})[_0xc9c2('0x2b')](function(_0xfd70ce){_0x699f3d[_0xc9c2('0x5a')]=_0xfd70ce;return _0x699f3d;});}})[_0xc9c2('0x2b')](respondWithFilteredResult(_0x5f23e8,_0x44d7d2))[_0xc9c2('0x63')](handleError(_0x5f23e8,null));};exports[_0xc9c2('0x71')]=function(_0x8a6d09,_0x15691b,_0x576604){var _0x1bba79={'raw':!![],'where':{}};var _0x43ddc1={};var _0x1f5f37={'count':0x0,'rows':[]};return db[_0xc9c2('0x56')][_0xc9c2('0x6c')]({'where':{'id':_0x8a6d09[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x15691b,null))['then'](function(_0x26a069){if(_0x26a069){_0x43ddc1[_0xc9c2('0x45')]=_[_0xc9c2('0x46')](db[_0xc9c2('0x72')][_0xc9c2('0x43')]);_0x43ddc1[_0xc9c2('0x47')]=_[_0xc9c2('0x46')](_0x8a6d09[_0xc9c2('0x47')]);_0x43ddc1['filters']=_['intersection'](_0x43ddc1[_0xc9c2('0x45')],_0x43ddc1[_0xc9c2('0x47')]);_0x1bba79[_0xc9c2('0x48')]=_['intersection'](_0x43ddc1['model'],qs[_0xc9c2('0x4a')](_0x8a6d09[_0xc9c2('0x47')][_0xc9c2('0x4a')]));_0x1bba79[_0xc9c2('0x48')]=_0x1bba79['attributes'][_0xc9c2('0x4b')]?_0x1bba79['attributes']:_0x43ddc1[_0xc9c2('0x45')];if(!_0x8a6d09[_0xc9c2('0x47')][_0xc9c2('0x4c')](_0xc9c2('0x4d'))){_0x1bba79[_0xc9c2('0x22')]=qs[_0xc9c2('0x22')](_0x8a6d09[_0xc9c2('0x47')][_0xc9c2('0x22')]);_0x1bba79[_0xc9c2('0x20')]=qs[_0xc9c2('0x20')](_0x8a6d09[_0xc9c2('0x47')][_0xc9c2('0x20')]);}_0x1bba79[_0xc9c2('0x4e')]=qs[_0xc9c2('0x4f')](_0x8a6d09[_0xc9c2('0x47')]['sort']);_0x1bba79[_0xc9c2('0x50')]=qs[_0xc9c2('0x51')](_[_0xc9c2('0x52')](_0x8a6d09[_0xc9c2('0x47')],_0x43ddc1[_0xc9c2('0x51')]));_0x1bba79['where'][_0xc9c2('0x6d')]=_0x26a069['id'];if(_0x8a6d09[_0xc9c2('0x47')][_0xc9c2('0x53')]){_0x1bba79[_0xc9c2('0x50')]=_[_0xc9c2('0x3c')](_0x1bba79[_0xc9c2('0x50')],{'$or':_[_0xc9c2('0x42')](_0x1bba79['attributes'],function(_0x411ffa){var _0x269188={};_0x269188[_0x411ffa]={'$like':'%'+_0x8a6d09[_0xc9c2('0x47')][_0xc9c2('0x53')]+'%'};return _0x269188;})});}_0x1bba79=_['merge']({},_0x1bba79,_0x8a6d09[_0xc9c2('0x55')]);return db['CmHopperBlack'][_0xc9c2('0x23')]({'where':_0x1bba79['where']})[_0xc9c2('0x2b')](function(_0x950a4d){_0x1f5f37[_0xc9c2('0x23')]=_0x950a4d;if(_0x8a6d09['query']['includeAll']){_0x1bba79[_0xc9c2('0x58')]=[{'all':!![]}];}return db[_0xc9c2('0x72')][_0xc9c2('0x59')](_0x1bba79);})[_0xc9c2('0x2b')](function(_0x27a630){_0x1f5f37[_0xc9c2('0x5a')]=_0x27a630;return _0x1f5f37;});}})[_0xc9c2('0x2b')](respondWithFilteredResult(_0x15691b,_0x1bba79))[_0xc9c2('0x63')](handleError(_0x15691b,null));};exports['getTeams']=function(_0x4889d9,_0x855ea9,_0x10989d){var _0x2b27e1={};var _0x45d6bf={};var _0x3e736c;var _0x348e60;return db[_0xc9c2('0x56')][_0xc9c2('0x6c')]({'where':{'id':_0x4889d9[_0xc9c2('0x6a')]['id']}})['then'](handleEntityNotFound(_0x855ea9,null))[_0xc9c2('0x2b')](function(_0x3548ed){if(_0x3548ed){_0x3e736c=_0x3548ed;_0x45d6bf[_0xc9c2('0x45')]=_[_0xc9c2('0x46')](db[_0xc9c2('0x73')][_0xc9c2('0x43')]);_0x45d6bf['query']=_[_0xc9c2('0x46')](_0x4889d9['query']);_0x45d6bf[_0xc9c2('0x51')]=_[_0xc9c2('0x49')](_0x45d6bf[_0xc9c2('0x45')],_0x45d6bf[_0xc9c2('0x47')]);_0x2b27e1[_0xc9c2('0x48')]=_[_0xc9c2('0x49')](_0x45d6bf[_0xc9c2('0x45')],qs['fields'](_0x4889d9[_0xc9c2('0x47')][_0xc9c2('0x4a')]));_0x2b27e1[_0xc9c2('0x48')]=_0x2b27e1[_0xc9c2('0x48')][_0xc9c2('0x4b')]?_0x2b27e1[_0xc9c2('0x48')]:_0x45d6bf[_0xc9c2('0x45')];_0x2b27e1['order']=qs['sort'](_0x4889d9['query'][_0xc9c2('0x4f')]);_0x2b27e1[_0xc9c2('0x50')]=qs[_0xc9c2('0x51')](_[_0xc9c2('0x52')](_0x4889d9[_0xc9c2('0x47')],_0x45d6bf[_0xc9c2('0x51')]));if(_0x4889d9['query'][_0xc9c2('0x53')]){_0x2b27e1[_0xc9c2('0x50')]=_['merge'](_0x2b27e1[_0xc9c2('0x50')],{'$or':_[_0xc9c2('0x42')](_0x2b27e1['attributes'],function(_0x31ca94){var _0x222e8e={};_0x222e8e[_0x31ca94]={'$like':'%'+_0x4889d9[_0xc9c2('0x47')][_0xc9c2('0x53')]+'%'};return _0x222e8e;})});}_0x2b27e1=_[_0xc9c2('0x3c')]({},_0x2b27e1,_0x4889d9[_0xc9c2('0x55')]);return _0x3e736c[_0xc9c2('0x74')](_0x2b27e1);}})['then'](function(_0x2146f2){if(_0x2146f2){_0x348e60=_0x2146f2[_0xc9c2('0x4b')];if(!_0x4889d9[_0xc9c2('0x47')]['hasOwnProperty'](_0xc9c2('0x4d'))){_0x2b27e1[_0xc9c2('0x22')]=qs[_0xc9c2('0x22')](_0x4889d9[_0xc9c2('0x47')][_0xc9c2('0x22')]);_0x2b27e1[_0xc9c2('0x20')]=qs[_0xc9c2('0x20')](_0x4889d9[_0xc9c2('0x47')][_0xc9c2('0x20')]);}return _0x3e736c['getTeams'](_0x2b27e1);}})[_0xc9c2('0x2b')](function(_0x33c040){if(_0x33c040){return _0x33c040?{'count':_0x348e60,'rows':_0x33c040}:null;}})['then'](respondWithResult(_0x855ea9,null))[_0xc9c2('0x63')](handleError(_0x855ea9,null));};exports['addTeams']=function(_0x1de448,_0x3ffed5,_0x4473a7){var _0x39d99a=_0x1de448[_0xc9c2('0x3d')]['teams'];var _0x3ad20b=_[_0xc9c2('0x42')](_0x39d99a,'id');return db[_0xc9c2('0x73')][_0xc9c2('0x59')]({'where':{'id':_0x3ad20b},'attributes':['id'],'include':[{'model':db[_0xc9c2('0x75')],'as':_0xc9c2('0x76'),'attributes':['id',_0xc9c2('0x36'),_0xc9c2('0x77'),_0xc9c2('0x78'),_0xc9c2('0x79')],'raw':!![]}]})[_0xc9c2('0x2b')](function(_0x2ca032){if(_0x2ca032){var _0x3840d9=_[_0xc9c2('0x7a')](_0x2ca032,function(_0x249da0){var _0x179cf1=_0x249da0[_0xc9c2('0x2d')]({'plain':!![]});_0x179cf1[_0xc9c2('0x76')][_0xc9c2('0x7b')](function(_0x359f96){_0x359f96['penalty']=_[_0xc9c2('0x35')](_0x39d99a,{'id':_0x179cf1['id']})['penalty'];});return _0x179cf1[_0xc9c2('0x76')];});return db[_0xc9c2('0x56')][_0xc9c2('0x35')]({'where':{'id':_0x1de448['params']['id']}})[_0xc9c2('0x2b')](function(_0x56c2a5){return db[_0xc9c2('0x7c')][_0xc9c2('0x7d')](function(_0x63c3bf){return _0x56c2a5[_0xc9c2('0x7e')](_0x3ad20b,{'transaction':_0x63c3bf})[_0xc9c2('0x2b')](function(){return BPromise[_0xc9c2('0x7f')](_0x39d99a,function(_0x482d48){return db[_0xc9c2('0x80')][_0xc9c2('0x81')]({'TeamId':_0x482d48['id'],'VoiceQueueId':_0x1de448[_0xc9c2('0x6a')]['id'],'penalty':_0x482d48[_0xc9c2('0x82')]},{'transaction':_0x63c3bf});});})[_0xc9c2('0x2b')](function(){return BPromise[_0xc9c2('0x7f')](_0x3840d9,function(_0x464aa2){return db['UserVoiceQueue'][_0xc9c2('0x83')]({'where':{'UserId':_0x464aa2['id'],'VoiceQueueId':_0x1de448[_0xc9c2('0x6a')]['id']},'defaults':{'penalty':_0x464aa2[_0xc9c2('0x82')]},'transaction':_0x63c3bf});});})[_0xc9c2('0x2b')](function(){return BPromise['each'](_[_0xc9c2('0x53')](_0x3840d9,{'online':!![]}),function(_0x2fa521){return db[_0xc9c2('0x84')]['upsert']({'membername':_0x2fa521[_0xc9c2('0x36')],'UserId':_0x2fa521['id'],'queue_name':_0x56c2a5['name'],'VoiceQueueId':_0x56c2a5['id'],'interface':_[_0xc9c2('0x85')](_0x2fa521[_0xc9c2('0x79')])?util[_0xc9c2('0x86')]('SIP/%s',_0x2fa521[_0xc9c2('0x36')]):_0x2fa521['interface'],'paused':_0x2fa521[_0xc9c2('0x78')]||![],'penalty':_0x2fa521[_0xc9c2('0x82')]},{'transaction':_0x63c3bf});});})[_0xc9c2('0x2b')](function(){_0x3840d9['forEach'](function(_0x4d45de){socket[_0xc9c2('0x87')](_0xc9c2('0x88'),{'UserId':_0x4d45de['id'],'VoiceQueueId':_0x56c2a5['id']});});});});});}})[_0xc9c2('0x2b')](respondWithStatusCode(_0x3ffed5,null))[_0xc9c2('0x63')](handleError(_0x3ffed5,null));};exports[_0xc9c2('0x89')]=function(_0x32a9fb,_0x27038f,_0xc15abc){return db[_0xc9c2('0x73')][_0xc9c2('0x59')]({'where':{'id':_0x32a9fb[_0xc9c2('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc9c2('0x75')],'as':_0xc9c2('0x76'),'attributes':['id'],'raw':!![]}]})[_0xc9c2('0x2b')](handleEntityNotFound(_0x27038f,null))[_0xc9c2('0x2b')](function(_0xfa2140){var _0x1a7f1d=_[_0xc9c2('0x42')](_0xfa2140,'id');var _0x5bc567=[];var _0x47803d=[];var _0x4be025=squel[_0xc9c2('0x8a')]();_0x4be025[_0xc9c2('0x8b')](_0xc9c2('0x8c'))['from'](_0xc9c2('0x8d'),'tq')[_0xc9c2('0x8e')]('user_has_teams','ut',_0xc9c2('0x8f'))[_0xc9c2('0x50')](_0xc9c2('0x90'),_0x32a9fb[_0xc9c2('0x6a')]['id']);for(var _0x532a45=0x0;_0x532a45<_0xfa2140[_0xc9c2('0x4b')];_0x532a45+=0x1){let _0x479a88=_0xfa2140[_0x532a45];for(var _0x3fd198=0x0;_0x3fd198<_0x479a88['Agents'][_0xc9c2('0x4b')];_0x3fd198+=0x1){let _0x259359=_0x479a88[_0xc9c2('0x76')][_0x3fd198];var _0x47dd9c=_0x4be025[_0xc9c2('0x64')]();_0x47dd9c['where'](_0xc9c2('0x91'),_0x259359['id']);_0x47803d[_0xc9c2('0x92')](db[_0xc9c2('0x7c')]['query'](_0x47dd9c[_0xc9c2('0x93')](),{'type':db['sequelize'][_0xc9c2('0x94')][_0xc9c2('0x95')]})['then'](function(_0x4f25ce){if(_0x4f25ce[_0xc9c2('0x4b')]===0x1){return _0x259359['id'];}else{var _0x629d5f=_['every'](_[_0xc9c2('0x42')](_0x4f25ce,_0xc9c2('0x96')),function(_0xc6487f){return _[_0xc9c2('0x33')](_0x1a7f1d,_0xc6487f);});if(_0x629d5f){return _0x259359['id'];}}}));}}return BPromise[_0xc9c2('0x97')](_0x47803d)[_0xc9c2('0x2b')](function(_0x3ae9db){_0x5bc567=_(_0x5bc567)[_0xc9c2('0x98')](_0x3ae9db)['compact']()[_0xc9c2('0x32')]();return db[_0xc9c2('0x56')]['find']({'where':{'id':_0x32a9fb[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](function(_0xe57485){return db[_0xc9c2('0x7c')][_0xc9c2('0x7d')](function(_0x13b724){return _0xe57485[_0xc9c2('0x89')](_0x32a9fb[_0xc9c2('0x47')][_0xc9c2('0x99')],{'transaction':_0x13b724})['then'](function(){if(!_[_0xc9c2('0x9a')](_0x5bc567)){return _0xe57485[_0xc9c2('0x9b')](_0x5bc567,{'transaction':_0x13b724})['then'](function(){return db[_0xc9c2('0x84')]['destroy']({'where':{'VoiceQueueId':_0x32a9fb[_0xc9c2('0x6a')]['id'],'UserId':_0x5bc567},'transaction':_0x13b724});});}})['then'](function(){_0x5bc567[_0xc9c2('0x7b')](function(_0x1d1ced){socket['emit'](_0xc9c2('0x9c'),{'UserId':_0x1d1ced,'VoiceQueueId':_0xe57485['id']});});});});});});})[_0xc9c2('0x2b')](respondWithStatusCode(_0x27038f,null))[_0xc9c2('0x63')](handleError(_0x27038f,null));};exports['addAgents']=function(_0x344611,_0x371026,_0x3b562a){var _0x7d490b,_0x5be25f;return db[_0xc9c2('0x56')][_0xc9c2('0x35')]({'where':{'id':_0x344611[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x371026,null))[_0xc9c2('0x2b')](function(_0x588dac){if(_0x588dac){_0x5be25f=_0x588dac;return _0x588dac['addAgents'](_0x344611['body'][_0xc9c2('0x99')],_['omit'](_0x344611[_0xc9c2('0x3d')],[_0xc9c2('0x99'),'id'])||{})[_0xc9c2('0x9d')](function(_0x44a43c){for(var _0x5d4e5d=0x0;_0x5d4e5d<_0x344611[_0xc9c2('0x3d')][_0xc9c2('0x99')][_0xc9c2('0x4b')];_0x5d4e5d+=0x1){socket[_0xc9c2('0x87')](_0xc9c2('0x88'),{'UserId':_0x344611[_0xc9c2('0x3d')]['ids'][_0x5d4e5d],'VoiceQueueId':_0x344611[_0xc9c2('0x6a')]['id']});}return _0x44a43c;});}})['then'](function(_0x315eab){_0x7d490b=_0x315eab||[];if(_0x5be25f){return db[_0xc9c2('0x75')]['findAll']({'where':{'id':_0x344611[_0xc9c2('0x3d')][_0xc9c2('0x99')]},'attributes':['id',_0xc9c2('0x36'),_0xc9c2('0x77'),_0xc9c2('0x78'),_0xc9c2('0x79')],'raw':!![]});}})[_0xc9c2('0x2b')](function(_0x44c10c){if(!_[_0xc9c2('0x9a')](_0x44c10c)){var _0x59634c=[];for(var _0x5ab288=0x0;_0x5ab288<_0x44c10c['length'];_0x5ab288++){if(_0x44c10c[_0x5ab288][_0xc9c2('0x77')]){_0x59634c['push'](db[_0xc9c2('0x84')][_0xc9c2('0x81')]({'membername':_0x44c10c[_0x5ab288]['name'],'UserId':_0x44c10c[_0x5ab288]['id'],'queue_name':_0x5be25f[_0xc9c2('0x36')],'VoiceQueueId':_0x5be25f['id'],'interface':_[_0xc9c2('0x85')](_0x44c10c[_0x5ab288]['interface'])?util['format'](_0xc9c2('0x9e'),_0x44c10c[_0x5ab288][_0xc9c2('0x36')]):_0x44c10c[_0x5ab288][_0xc9c2('0x79')],'paused':_0x44c10c[_0x5ab288][_0xc9c2('0x78')]||![],'penalty':_0x344611[_0xc9c2('0x3d')][_0xc9c2('0x82')]||0x0}));}}return BPromise[_0xc9c2('0x97')](_0x59634c);}})['then'](function(){return _0x7d490b;})[_0xc9c2('0x2b')](respondWithResult(_0x371026,null))[_0xc9c2('0x63')](handleError(_0x371026,null));};exports[_0xc9c2('0x9b')]=function(_0x59571a,_0xdf3853,_0x473a49){return db[_0xc9c2('0x56')][_0xc9c2('0x35')]({'where':{'id':_0x59571a[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0xdf3853,null))[_0xc9c2('0x2b')](function(_0x16ea71){if(_0x16ea71){return _0x16ea71['removeAgents'](_0x59571a[_0xc9c2('0x47')][_0xc9c2('0x99')])['then'](function(){if(_['isArray'](_0x59571a[_0xc9c2('0x47')]['ids'])){for(var _0xbe60a7=0x0;_0xbe60a7<_0x59571a[_0xc9c2('0x47')][_0xc9c2('0x99')][_0xc9c2('0x4b')];_0xbe60a7+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x59571a[_0xc9c2('0x47')][_0xc9c2('0x99')][_0xbe60a7]),'VoiceQueueId':Number(_0x59571a[_0xc9c2('0x6a')]['id'])});}}else{socket[_0xc9c2('0x87')](_0xc9c2('0x9c'),{'UserId':Number(_0x59571a[_0xc9c2('0x47')][_0xc9c2('0x99')]),'VoiceQueueId':Number(_0x59571a[_0xc9c2('0x6a')]['id'])});}});}})['then'](function(_0x33f2fa){return db[_0xc9c2('0x84')][_0xc9c2('0x2c')]({'where':{'VoiceQueueId':_0x59571a[_0xc9c2('0x6a')]['id'],'UserId':_0x59571a[_0xc9c2('0x47')][_0xc9c2('0x99')]}})[_0xc9c2('0x2b')](function(){return _0x33f2fa;});})[_0xc9c2('0x2b')](respondWithStatusCode(_0xdf3853,null))[_0xc9c2('0x63')](handleError(_0xdf3853,null));};exports['getAgents']=function(_0x4fae4e,_0x393623,_0xf0e306){var _0x7fa719={};var _0x49770a={};var _0x49d547;var _0x14aa42;return db[_0xc9c2('0x56')][_0xc9c2('0x6c')]({'where':{'id':_0x4fae4e['params']['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x393623,null))[_0xc9c2('0x2b')](function(_0x12f9e6){if(_0x12f9e6){_0x49d547=_0x12f9e6;_0x49770a['model']=_[_0xc9c2('0x46')](db['User'][_0xc9c2('0x43')]);_0x49770a[_0xc9c2('0x47')]=_['keys'](_0x4fae4e[_0xc9c2('0x47')]);_0x49770a[_0xc9c2('0x51')]=_[_0xc9c2('0x49')](_0x49770a['model'],_0x49770a[_0xc9c2('0x47')]);_0x7fa719[_0xc9c2('0x48')]=_[_0xc9c2('0x49')](_0x49770a['model'],qs[_0xc9c2('0x4a')](_0x4fae4e[_0xc9c2('0x47')]['fields']));_0x7fa719[_0xc9c2('0x48')]=_0x7fa719['attributes'][_0xc9c2('0x4b')]?_0x7fa719[_0xc9c2('0x48')]:_0x49770a[_0xc9c2('0x45')];_0x7fa719[_0xc9c2('0x4e')]=qs[_0xc9c2('0x4f')](_0x4fae4e[_0xc9c2('0x47')]['sort']);_0x7fa719[_0xc9c2('0x50')]=qs[_0xc9c2('0x51')](_[_0xc9c2('0x52')](_0x4fae4e['query'],_0x49770a[_0xc9c2('0x51')]));if(_0x4fae4e['query'][_0xc9c2('0x53')]){_0x7fa719[_0xc9c2('0x50')]=_[_0xc9c2('0x3c')](_0x7fa719[_0xc9c2('0x50')],{'$or':_['map'](_0x7fa719['attributes'],function(_0x247e2f){var _0xd86920={};_0xd86920[_0x247e2f]={'$like':'%'+_0x4fae4e[_0xc9c2('0x47')][_0xc9c2('0x53')]+'%'};return _0xd86920;})});}_0x7fa719=_[_0xc9c2('0x3c')]({},_0x7fa719,_0x4fae4e[_0xc9c2('0x55')]);return _0x49d547[_0xc9c2('0x9f')](_0x7fa719);}})['then'](function(_0x29343c){if(_0x29343c){_0x14aa42=_0x29343c[_0xc9c2('0x4b')];if(!_0x4fae4e[_0xc9c2('0x47')][_0xc9c2('0x4c')]('nolimit')){_0x7fa719[_0xc9c2('0x22')]=qs['limit'](_0x4fae4e[_0xc9c2('0x47')][_0xc9c2('0x22')]);_0x7fa719['offset']=qs[_0xc9c2('0x20')](_0x4fae4e[_0xc9c2('0x47')]['offset']);}return _0x49d547['getAgents'](_0x7fa719);}})[_0xc9c2('0x2b')](function(_0x20d89b){if(_0x20d89b){return _0x20d89b?{'count':_0x14aa42,'rows':_0x20d89b}:null;}})['then'](respondWithResult(_0x393623,null))[_0xc9c2('0x63')](handleError(_0x393623,null));};exports['getMembers']=function(_0x1abd22,_0x1af2f9,_0x38a048){var _0x26030b={};var _0x41fe6d={};var _0x13cdc0;var _0x2010ff;return db[_0xc9c2('0x56')][_0xc9c2('0x6c')]({'where':{'id':_0x1abd22[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x1af2f9,null))['then'](function(_0x485424){if(_0x485424){_0x13cdc0=_0x485424;_0x41fe6d['model']=_[_0xc9c2('0x46')](db[_0xc9c2('0x84')][_0xc9c2('0x43')]);_0x41fe6d[_0xc9c2('0x47')]=_[_0xc9c2('0x46')](_0x1abd22['query']);_0x41fe6d[_0xc9c2('0x51')]=_[_0xc9c2('0x49')](_0x41fe6d['model'],_0x41fe6d[_0xc9c2('0x47')]);_0x26030b[_0xc9c2('0x48')]=_['intersection'](_0x41fe6d['model'],qs[_0xc9c2('0x4a')](_0x1abd22[_0xc9c2('0x47')][_0xc9c2('0x4a')]));_0x26030b[_0xc9c2('0x48')]=_0x26030b[_0xc9c2('0x48')]['length']?_0x26030b['attributes']:_0x41fe6d[_0xc9c2('0x45')];_0x26030b[_0xc9c2('0x4e')]=qs[_0xc9c2('0x4f')](_0x1abd22[_0xc9c2('0x47')]['sort']);_0x26030b[_0xc9c2('0x50')]=qs[_0xc9c2('0x51')](_[_0xc9c2('0x52')](_0x1abd22[_0xc9c2('0x47')],_0x41fe6d[_0xc9c2('0x51')]));if(_0x1abd22['query']['filter']){_0x26030b[_0xc9c2('0x50')]=_[_0xc9c2('0x3c')](_0x26030b[_0xc9c2('0x50')],{'$or':_[_0xc9c2('0x42')](_0x26030b[_0xc9c2('0x48')],function(_0x33c47b){var _0x5d58b0={};_0x5d58b0[_0x33c47b]={'$like':'%'+_0x1abd22['query'][_0xc9c2('0x53')]+'%'};return _0x5d58b0;})});}_0x26030b=_['merge']({},_0x26030b,_0x1abd22[_0xc9c2('0x55')]);return _0x13cdc0[_0xc9c2('0xa0')](_0x26030b);}})[_0xc9c2('0x2b')](function(_0x15d8fb){if(_0x15d8fb){_0x2010ff=_0x15d8fb[_0xc9c2('0x4b')];if(!_0x1abd22[_0xc9c2('0x47')][_0xc9c2('0x4c')](_0xc9c2('0x4d'))){_0x26030b['limit']=qs[_0xc9c2('0x22')](_0x1abd22[_0xc9c2('0x47')][_0xc9c2('0x22')]);_0x26030b['offset']=qs[_0xc9c2('0x20')](_0x1abd22[_0xc9c2('0x47')][_0xc9c2('0x20')]);}return _0x13cdc0[_0xc9c2('0xa0')](_0x26030b);}})[_0xc9c2('0x2b')](function(_0x52d015){return _0x52d015?{'count':_0x2010ff,'rows':_0x52d015}:null;})[_0xc9c2('0x2b')](respondWithResult(_0x1af2f9,null))['catch'](handleError(_0x1af2f9,null));};exports['getLists']=function(_0x367c7d,_0x4404ae,_0x13b992){var _0x7844e1={};var _0x4577f8={};var _0x47fa04;var _0x17d0e2;return db[_0xc9c2('0x56')][_0xc9c2('0x6c')]({'where':{'id':_0x367c7d[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x4404ae,null))[_0xc9c2('0x2b')](function(_0x11bb1d){if(_0x11bb1d){_0x47fa04=_0x11bb1d;_0x4577f8['model']=_[_0xc9c2('0x46')](db[_0xc9c2('0xa1')][_0xc9c2('0x43')]);_0x4577f8['query']=_[_0xc9c2('0x46')](_0x367c7d[_0xc9c2('0x47')]);_0x4577f8[_0xc9c2('0x51')]=_[_0xc9c2('0x49')](_0x4577f8['model'],_0x4577f8[_0xc9c2('0x47')]);_0x7844e1[_0xc9c2('0x48')]=_['intersection'](_0x4577f8[_0xc9c2('0x45')],qs[_0xc9c2('0x4a')](_0x367c7d[_0xc9c2('0x47')][_0xc9c2('0x4a')]));_0x7844e1[_0xc9c2('0x48')]=_0x7844e1[_0xc9c2('0x48')][_0xc9c2('0x4b')]?_0x7844e1[_0xc9c2('0x48')]:_0x4577f8[_0xc9c2('0x45')];_0x7844e1[_0xc9c2('0x4e')]=qs[_0xc9c2('0x4f')](_0x367c7d['query']['sort']);_0x7844e1['where']=qs[_0xc9c2('0x51')](_[_0xc9c2('0x52')](_0x367c7d['query'],_0x4577f8['filters']));if(_0x367c7d[_0xc9c2('0x47')][_0xc9c2('0x53')]){_0x7844e1[_0xc9c2('0x50')]=_[_0xc9c2('0x3c')](_0x7844e1[_0xc9c2('0x50')],{'$or':_[_0xc9c2('0x42')](_0x7844e1[_0xc9c2('0x48')],function(_0xf1ebfb){var _0x240f8e={};_0x240f8e[_0xf1ebfb]={'$like':'%'+_0x367c7d[_0xc9c2('0x47')][_0xc9c2('0x53')]+'%'};return _0x240f8e;})});}_0x7844e1=_['merge']({},_0x7844e1,_0x367c7d[_0xc9c2('0x55')]);return _0x47fa04[_0xc9c2('0xa2')](_0x7844e1);}})[_0xc9c2('0x2b')](function(_0x5543ba){if(_0x5543ba){_0x17d0e2=_0x5543ba[_0xc9c2('0x4b')];if(!_0x367c7d['query'][_0xc9c2('0x4c')](_0xc9c2('0x4d'))){_0x7844e1[_0xc9c2('0x22')]=qs[_0xc9c2('0x22')](_0x367c7d['query'][_0xc9c2('0x22')]);_0x7844e1[_0xc9c2('0x20')]=qs[_0xc9c2('0x20')](_0x367c7d[_0xc9c2('0x47')][_0xc9c2('0x20')]);}return _0x47fa04['getLists'](_0x7844e1);}})[_0xc9c2('0x2b')](function(_0x23f7ab){if(_0x23f7ab){return _0x23f7ab?{'count':_0x17d0e2,'rows':_0x23f7ab}:null;}})['then'](respondWithResult(_0x4404ae,null))[_0xc9c2('0x63')](handleError(_0x4404ae,null));};exports[_0xc9c2('0xa3')]=function(_0x59c119,_0x303aad,_0x3289e7){var _0x32a244,_0x454330;return db[_0xc9c2('0x56')][_0xc9c2('0x35')]({'where':{'id':_0x59c119[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x303aad,null))[_0xc9c2('0x2b')](function(_0x5ec881){if(_0x5ec881){_0x454330=_0x5ec881;return _0x5ec881[_0xc9c2('0xa3')](_0x59c119[_0xc9c2('0x3d')]['ids'],_[_0xc9c2('0x65')](_0x59c119[_0xc9c2('0x3d')],[_0xc9c2('0x99'),'id'])||{});}return null;})['spread'](function(_0x2cfdeb){var _0x4b6821;_0x32a244=_0x2cfdeb||[];var _0x381a82=[];if(_0x2cfdeb){for(var _0x825165=0x0;_0x825165<_0x2cfdeb[_0xc9c2('0x4b')];_0x825165+=0x1){var _0x3c0f43=_0x2cfdeb[_0x825165][_0xc9c2('0x2d')]({'plain':!![]});_0x454330[_0xc9c2('0xa4')]=_0x59c119[_0xc9c2('0x3d')]['dialCheckDuplicateType']?_0x59c119['body']['dialCheckDuplicateType']:_0x454330[_0xc9c2('0xa4')];switch(_0x454330[_0xc9c2('0xa4')]){case _0xc9c2('0xa5'):_0x4b6821=squel[_0xc9c2('0xa6')]()['into'](_0xc9c2('0xa7'))['fromQuery']([_0xc9c2('0xa8'),_0xc9c2('0xa9'),_0xc9c2('0xaa'),'ListId',_0xc9c2('0x6d'),_0xc9c2('0x66'),_0xc9c2('0x67')],squel['select']()[_0xc9c2('0x8b')](_0xc9c2('0xa8'),_0xc9c2('0xa8'))[_0xc9c2('0x8b')]('NOW()',_0xc9c2('0xa9'))[_0xc9c2('0x8b')]('id',_0xc9c2('0xaa'))[_0xc9c2('0x8b')](_0x3c0f43[_0xc9c2('0xab')][_0xc9c2('0x93')](),_0xc9c2('0xac'))[_0xc9c2('0x8b')](_0x59c119[_0xc9c2('0x6a')]['id'][_0xc9c2('0x93')](),_0xc9c2('0x6d'))[_0xc9c2('0x8b')](_0xc9c2('0xad'),'createdAt')['field']('NOW()',_0xc9c2('0x67'))[_0xc9c2('0xae')](_0xc9c2('0xaf'))[_0xc9c2('0x50')](_0xc9c2('0xb0'))[_0xc9c2('0x50')](_0xc9c2('0xb1'),_0x3c0f43[_0xc9c2('0xab')]['toString']())[_0xc9c2('0x50')](_0xc9c2('0xb2'))[_0xc9c2('0x50')](_0xc9c2('0xb3'),squel[_0xc9c2('0x8a')]()['field'](_0xc9c2('0xb4'))[_0xc9c2('0xae')](_0xc9c2('0xb5'))[_0xc9c2('0x50')]('VoiceQueueId\x20=\x20?',_0x59c119[_0xc9c2('0x6a')]['id']['toString']()))[_0xc9c2('0x50')](_0xc9c2('0xb3'),squel[_0xc9c2('0x8a')]()['field'](_0xc9c2('0xb6'))[_0xc9c2('0xae')](_0xc9c2('0xa7'))[_0xc9c2('0x50')](_0xc9c2('0x90'),_0x59c119[_0xc9c2('0x6a')]['id'][_0xc9c2('0x93')]())))[_0xc9c2('0x93')]();break;case _0xc9c2('0xb7'):_0x4b6821=squel['insert']()[_0xc9c2('0xb8')](_0xc9c2('0xa7'))[_0xc9c2('0xb9')]([_0xc9c2('0xa8'),'scheduledAt',_0xc9c2('0xaa'),_0xc9c2('0xac'),_0xc9c2('0x6d'),_0xc9c2('0x66'),'updatedAt'],squel['select']()[_0xc9c2('0x8b')](_0xc9c2('0xa8'),_0xc9c2('0xa8'))[_0xc9c2('0x8b')](_0xc9c2('0xad'),_0xc9c2('0xa9'))[_0xc9c2('0x8b')]('id',_0xc9c2('0xaa'))[_0xc9c2('0x8b')](_0x3c0f43[_0xc9c2('0xab')][_0xc9c2('0x93')](),_0xc9c2('0xac'))[_0xc9c2('0x8b')](_0x59c119[_0xc9c2('0x6a')]['id'][_0xc9c2('0x93')](),_0xc9c2('0x6d'))[_0xc9c2('0x8b')](_0xc9c2('0xad'),_0xc9c2('0x66'))[_0xc9c2('0x8b')]('NOW()','updatedAt')[_0xc9c2('0xae')](_0xc9c2('0xaf'))[_0xc9c2('0x50')](_0xc9c2('0xb0'))[_0xc9c2('0x50')](_0xc9c2('0xb1'),_0x3c0f43['CmListId'][_0xc9c2('0x93')]())[_0xc9c2('0x50')](_0xc9c2('0xb2'))[_0xc9c2('0x50')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc9c2('0x8b')](_0xc9c2('0xb6'))[_0xc9c2('0xae')](_0xc9c2('0xa7'))[_0xc9c2('0x50')](_0xc9c2('0x90'),_0x59c119['params']['id'][_0xc9c2('0x93')]())))[_0xc9c2('0x93')]();break;default:_0x4b6821=squel[_0xc9c2('0xa6')]()[_0xc9c2('0xb8')](_0xc9c2('0xa7'))['fromQuery']([_0xc9c2('0xa8'),_0xc9c2('0xa9'),_0xc9c2('0xaa'),_0xc9c2('0xac'),_0xc9c2('0x6d'),_0xc9c2('0x66'),_0xc9c2('0x67')],squel['select']()['field'](_0xc9c2('0xa8'),_0xc9c2('0xa8'))[_0xc9c2('0x8b')]('NOW()','scheduledAt')['field']('id',_0xc9c2('0xaa'))[_0xc9c2('0x8b')](_0x3c0f43['CmListId']['toString'](),'ListId')['field'](_0x59c119['params']['id'][_0xc9c2('0x93')](),_0xc9c2('0x6d'))[_0xc9c2('0x8b')]('NOW()','createdAt')[_0xc9c2('0x8b')]('NOW()',_0xc9c2('0x67'))['from'](_0xc9c2('0xaf'))[_0xc9c2('0x50')]('deletedAt\x20IS\x20NULL')[_0xc9c2('0x50')](_0xc9c2('0xb1'),_0x3c0f43['CmListId'][_0xc9c2('0x93')]())[_0xc9c2('0x50')](_0xc9c2('0xb2')))[_0xc9c2('0x93')]();}_0x381a82['push'](db[_0xc9c2('0x7c')]['query'](_0x4b6821));}return BPromise[_0xc9c2('0x97')](_0x381a82);}})[_0xc9c2('0x2b')](function(){return _0x32a244;})[_0xc9c2('0x2b')](respondWithResult(_0x303aad,null))[_0xc9c2('0x63')](handleError(_0x303aad,null));};exports[_0xc9c2('0xba')]=function(_0xbc201d,_0x39b802,_0x1022ee){return db['VoiceQueue']['find']({'where':{'id':_0xbc201d['params']['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x39b802,null))[_0xc9c2('0x2b')](function(_0x23425b){if(_0x23425b){return _0x23425b[_0xc9c2('0xba')](_0xbc201d[_0xc9c2('0x47')][_0xc9c2('0x99')]);}})[_0xc9c2('0x2b')](function(_0x2bfec3){if(_0x2bfec3){return db['CmHopper'][_0xc9c2('0x2c')]({'where':{'ListId':_0xbc201d[_0xc9c2('0x47')][_0xc9c2('0x99')],'VoiceQueueId':_0xbc201d[_0xc9c2('0x6a')]['id']}})['then'](function(){return _0x2bfec3;});}})[_0xc9c2('0x2b')](respondWithStatusCode(_0x39b802,null))['catch'](handleError(_0x39b802,null));};exports[_0xc9c2('0xbb')]=function(_0x318523,_0x23cafd,_0x35ad25){var _0x87b38={};var _0x2d37d3={};var _0x22ef6b;var _0x266611;return db[_0xc9c2('0x56')][_0xc9c2('0x6c')]({'where':{'id':_0x318523[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x23cafd,null))['then'](function(_0x60b882){if(_0x60b882){_0x22ef6b=_0x60b882;_0x2d37d3['model']=_[_0xc9c2('0x46')](db[_0xc9c2('0xa1')][_0xc9c2('0x43')]);_0x2d37d3[_0xc9c2('0x47')]=_[_0xc9c2('0x46')](_0x318523[_0xc9c2('0x47')]);_0x2d37d3[_0xc9c2('0x51')]=_['intersection'](_0x2d37d3[_0xc9c2('0x45')],_0x2d37d3[_0xc9c2('0x47')]);_0x87b38[_0xc9c2('0x48')]=_[_0xc9c2('0x49')](_0x2d37d3[_0xc9c2('0x45')],qs[_0xc9c2('0x4a')](_0x318523[_0xc9c2('0x47')][_0xc9c2('0x4a')]));_0x87b38[_0xc9c2('0x48')]=_0x87b38[_0xc9c2('0x48')]['length']?_0x87b38['attributes']:_0x2d37d3[_0xc9c2('0x45')];_0x87b38[_0xc9c2('0x4e')]=qs[_0xc9c2('0x4f')](_0x318523[_0xc9c2('0x47')]['sort']);_0x87b38[_0xc9c2('0x50')]=qs[_0xc9c2('0x51')](_[_0xc9c2('0x52')](_0x318523['query'],_0x2d37d3['filters']));if(_0x318523[_0xc9c2('0x47')][_0xc9c2('0x53')]){_0x87b38['where']=_[_0xc9c2('0x3c')](_0x87b38[_0xc9c2('0x50')],{'$or':_[_0xc9c2('0x42')](_0x87b38['attributes'],function(_0x31fc83){var _0x368d22={};_0x368d22[_0x31fc83]={'$like':'%'+_0x318523['query'][_0xc9c2('0x53')]+'%'};return _0x368d22;})});}_0x87b38=_['merge']({},_0x87b38,_0x318523[_0xc9c2('0x55')]);return _0x22ef6b[_0xc9c2('0xbb')](_0x87b38);}})[_0xc9c2('0x2b')](function(_0x4db8cc){if(_0x4db8cc){_0x266611=_0x4db8cc[_0xc9c2('0x4b')];if(!_0x318523[_0xc9c2('0x47')][_0xc9c2('0x4c')](_0xc9c2('0x4d'))){_0x87b38[_0xc9c2('0x22')]=qs[_0xc9c2('0x22')](_0x318523[_0xc9c2('0x47')][_0xc9c2('0x22')]);_0x87b38['offset']=qs[_0xc9c2('0x20')](_0x318523[_0xc9c2('0x47')][_0xc9c2('0x20')]);}return _0x22ef6b[_0xc9c2('0xbb')](_0x87b38);}})[_0xc9c2('0x2b')](function(_0x5d048a){if(_0x5d048a){return _0x5d048a?{'count':_0x266611,'rows':_0x5d048a}:null;}})[_0xc9c2('0x2b')](respondWithResult(_0x23cafd,null))[_0xc9c2('0x63')](handleError(_0x23cafd,null));};exports[_0xc9c2('0xbc')]=function(_0x41012a,_0x283db4,_0x5216ea){var _0x341d9e,_0x419956;return db[_0xc9c2('0x56')][_0xc9c2('0x35')]({'where':{'id':_0x41012a[_0xc9c2('0x6a')]['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x283db4,null))[_0xc9c2('0x2b')](function(_0x30b76b){if(_0x30b76b){_0x419956=_0x30b76b;return _0x30b76b[_0xc9c2('0xbc')](_0x41012a[_0xc9c2('0x3d')][_0xc9c2('0x99')],_[_0xc9c2('0x65')](_0x41012a['body'],['ids','id'])||{});}return null;})[_0xc9c2('0x9d')](function(_0x43039f){var _0x9aa833;_0x341d9e=_0x43039f||[];var _0x22ebfa=[];if(_0x43039f){for(var _0x15fade=0x0;_0x15fade<_0x43039f[_0xc9c2('0x4b')];_0x15fade+=0x1){var _0x1c0327=_0x43039f[_0x15fade][_0xc9c2('0x2d')]({'plain':!![]});_0x9aa833=squel[_0xc9c2('0xa6')]()[_0xc9c2('0xb8')](_0xc9c2('0xbd'))[_0xc9c2('0xb9')]([_0xc9c2('0xa8'),_0xc9c2('0xaa'),_0xc9c2('0xac'),_0xc9c2('0x6d'),_0xc9c2('0x66'),'updatedAt'],squel[_0xc9c2('0x8a')]()['field'](_0xc9c2('0xa8'),_0xc9c2('0xa8'))[_0xc9c2('0x8b')]('id',_0xc9c2('0xaa'))[_0xc9c2('0x8b')](_0x1c0327['CmListId'][_0xc9c2('0x93')](),_0xc9c2('0xac'))[_0xc9c2('0x8b')](_0x41012a[_0xc9c2('0x6a')]['id'][_0xc9c2('0x93')](),_0xc9c2('0x6d'))[_0xc9c2('0x8b')](_0xc9c2('0xad'),_0xc9c2('0x66'))[_0xc9c2('0x8b')](_0xc9c2('0xad'),_0xc9c2('0x67'))[_0xc9c2('0xae')]('cm_contacts')[_0xc9c2('0x50')](_0xc9c2('0xb0'))[_0xc9c2('0x50')](_0xc9c2('0xb1'),_0x1c0327[_0xc9c2('0xab')][_0xc9c2('0x93')]())[_0xc9c2('0x50')](_0xc9c2('0xb2')))[_0xc9c2('0x93')]();_0x22ebfa[_0xc9c2('0x92')](db[_0xc9c2('0x7c')]['query'](_0x9aa833));}return BPromise[_0xc9c2('0x97')](_0x22ebfa);}})['then'](function(){return _0x341d9e;})[_0xc9c2('0x2b')](respondWithResult(_0x283db4,null))['catch'](handleError(_0x283db4,null));};exports[_0xc9c2('0xbe')]=function(_0x37058d,_0x1c5f5a,_0xdde5ef){return db['VoiceQueue'][_0xc9c2('0x35')]({'where':{'id':_0x37058d['params']['id']}})[_0xc9c2('0x2b')](handleEntityNotFound(_0x1c5f5a,null))[_0xc9c2('0x2b')](function(_0x484351){if(_0x484351){return _0x484351[_0xc9c2('0xbe')](_0x37058d[_0xc9c2('0x47')][_0xc9c2('0x99')]);}})[_0xc9c2('0x2b')](function(_0x3310bf){if(_0x3310bf){return db[_0xc9c2('0x72')]['destroy']({'where':{'ListId':_0x37058d[_0xc9c2('0x47')][_0xc9c2('0x99')],'VoiceQueueId':_0x37058d[_0xc9c2('0x6a')]['id']}})['then'](function(){return _0x3310bf;});}})[_0xc9c2('0x2b')](respondWithStatusCode(_0x1c5f5a,null))[_0xc9c2('0x63')](handleError(_0x1c5f5a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e369feb..3cef1ff 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 _0x068f=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x44e3f3,_0x335eda){var _0x50c650=function(_0x352d6d){while(--_0x352d6d){_0x44e3f3['push'](_0x44e3f3['shift']());}};_0x50c650(++_0x335eda);}(_0x068f,0x72));var _0xf068=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x068f[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require(_0xf068('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf068('0x1')](0x0);var events={'afterCreate':_0xf068('0x2'),'afterUpdate':_0xf068('0x3'),'afterDestroy':_0xf068('0x4')};function emitEvent(_0x558b1b){return function(_0x21726f,_0x5f4436,_0x174576){VoiceQueueEvents['emit'](_0x558b1b+':'+_0x21726f['id'],_0x21726f);VoiceQueueEvents[_0xf068('0x5')](_0x558b1b,_0x21726f);_0x174576(null);};}for(var e in events){if(events[_0xf068('0x6')](e)){var event=events[e];VoiceQueue[_0xf068('0x7')](e,emitEvent(event));}}module[_0xf068('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xa158=['save','update','remove','emit','hook','exports','../../mysqldb','VoiceQueue'];(function(_0x111db1,_0x272c66){var _0x475265=function(_0x5cf168){while(--_0x5cf168){_0x111db1['push'](_0x111db1['shift']());}};_0x475265(++_0x272c66);}(_0xa158,0x1a6));var _0x8a15=function(_0x5f4ddd,_0x14028c){_0x5f4ddd=_0x5f4ddd-0x0;var _0x11da02=_0xa158[_0x5f4ddd];return _0x11da02;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x8a15('0x0'))['db'][_0x8a15('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a15('0x2'),'afterUpdate':_0x8a15('0x3'),'afterDestroy':_0x8a15('0x4')};function emitEvent(_0x23f1d3){return function(_0xca40e4,_0x532142,_0x4c1917){VoiceQueueEvents[_0x8a15('0x5')](_0x23f1d3+':'+_0xca40e4['id'],_0xca40e4);VoiceQueueEvents[_0x8a15('0x5')](_0x23f1d3,_0xca40e4);_0x4c1917(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x8a15('0x6')](e,emitEvent(event));}}module[_0x8a15('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index d11630a..a5ba69d 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 _0x8002=['path','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x8002,0xbc));var _0x2800=function(_0x2cd710,_0x49331c){_0x2cd710=_0x2cd710-0x0;var _0x14c873=_0x8002[_0x2cd710];return _0x14c873;};'use strict';var _=require(_0x2800('0x0'));var util=require(_0x2800('0x1'));var logger=require(_0x2800('0x2'))(_0x2800('0x3'));var moment=require(_0x2800('0x4'));var BPromise=require(_0x2800('0x5'));var rp=require(_0x2800('0x6'));var fs=require('fs');var path=require(_0x2800('0x7'));var rimraf=require('rimraf');var config=require(_0x2800('0x8'));var attributes=require(_0x2800('0x9'));module[_0x2800('0xa')]=function(_0x38c5c5,_0x5d9f33){return _0x38c5c5['define'](_0x2800('0xb'),attributes,{'tableName':_0x2800('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1194=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','define','voice_queues'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x1194,0x120));var _0x4119=function(_0x50856f,_0x262f2c){_0x50856f=_0x50856f-0x0;var _0x505ca2=_0x1194[_0x50856f];return _0x505ca2;};'use strict';var _=require(_0x4119('0x0'));var util=require(_0x4119('0x1'));var logger=require(_0x4119('0x2'))(_0x4119('0x3'));var moment=require(_0x4119('0x4'));var BPromise=require(_0x4119('0x5'));var rp=require(_0x4119('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4119('0x7'));var config=require(_0x4119('0x8'));var attributes=require(_0x4119('0x9'));module['exports']=function(_0x3c6346,_0x4fcbe4){return _0x3c6346[_0x4119('0xa')]('VoiceQueue',attributes,{'tableName':_0x4119('0xb'),'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 924d80a..f714701 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 _0x7dd7=['localhost','socket.io-emitter','register','request','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueue,\x20%s,\x20%s','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','limit','include','model','attributes','map','then','find','ShowVoiceQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x27f533,_0x3f53d5){var _0x53f9ee=function(_0x5654ef){while(--_0x5654ef){_0x27f533['push'](_0x27f533['shift']());}};_0x53f9ee(++_0x3f53d5);}(_0x7dd7,0x112));var _0x77dd=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7dd7[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x77dd('0x0'));var util=require(_0x77dd('0x1'));var moment=require(_0x77dd('0x2'));var BPromise=require(_0x77dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77dd('0x4'))['db'];var utils=require(_0x77dd('0x5'));var logger=require(_0x77dd('0x6'))(_0x77dd('0x7'));var config=require(_0x77dd('0x8'));var jayson=require(_0x77dd('0x9'));var client=jayson[_0x77dd('0xa')][_0x77dd('0xb')]({'port':0x232a});config[_0x77dd('0xc')]=_['defaults'](config['redis'],{'host':_0x77dd('0xd'),'port':0x18eb});var socket=require(_0x77dd('0xe'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x77dd('0xf')](socket);function respondWithRpcPromise(_0x4003b5,_0x4ba1e6,_0x7f5ec4){return new BPromise(function(_0x1597db,_0x267c9f){return client[_0x77dd('0x10')](_0x4003b5,_0x7f5ec4)['then'](function(_0x376c8d){logger[_0x77dd('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x4ba1e6,_0x77dd('0x12'));logger[_0x77dd('0x13')](_0x77dd('0x14'),_0x4ba1e6,_0x77dd('0x12'),JSON[_0x77dd('0x15')](_0x376c8d));if(_0x376c8d[_0x77dd('0x16')]){if(_0x376c8d[_0x77dd('0x16')][_0x77dd('0x17')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x4ba1e6,_0x376c8d[_0x77dd('0x16')][_0x77dd('0x18')]);return _0x267c9f(_0x376c8d['error']['message']);}logger[_0x77dd('0x16')](_0x77dd('0x19'),_0x4ba1e6,_0x376c8d[_0x77dd('0x16')]['message']);return _0x1597db(_0x376c8d[_0x77dd('0x16')][_0x77dd('0x18')]);}else{logger[_0x77dd('0x11')](_0x77dd('0x19'),_0x4ba1e6,_0x77dd('0x12'));_0x1597db(_0x376c8d[_0x77dd('0x1a')][_0x77dd('0x18')]);}})[_0x77dd('0x1b')](function(_0x2f9b5a){logger[_0x77dd('0x16')](_0x77dd('0x19'),_0x4ba1e6,_0x2f9b5a);_0x267c9f(_0x2f9b5a);});});}exports[_0x77dd('0x1c')]=function(_0x20d1eb){var _0x5235fa=this;return new Promise(function(_0x4751e4,_0x4bcda0){return db[_0x77dd('0x1d')]['findAll']({'raw':_0x20d1eb[_0x77dd('0x1e')]?_0x20d1eb[_0x77dd('0x1e')][_0x77dd('0x1f')]===undefined?!![]:![]:!![],'where':_0x20d1eb[_0x77dd('0x1e')]?_0x20d1eb[_0x77dd('0x1e')][_0x77dd('0x20')]||null:null,'attributes':_0x20d1eb['options']?_0x20d1eb['options']['attributes']||null:null,'limit':_0x20d1eb['options']?_0x20d1eb[_0x77dd('0x1e')][_0x77dd('0x21')]||null:null,'include':_0x20d1eb['options']?_0x20d1eb[_0x77dd('0x1e')][_0x77dd('0x22')]?_['map'](_0x20d1eb[_0x77dd('0x1e')][_0x77dd('0x22')],function(_0x50ee53){return{'model':db[_0x50ee53[_0x77dd('0x23')]],'as':_0x50ee53['as'],'attributes':_0x50ee53[_0x77dd('0x24')],'include':_0x50ee53[_0x77dd('0x22')]?_[_0x77dd('0x25')](_0x50ee53['include'],function(_0x5170d8){return{'model':db[_0x5170d8['model']],'as':_0x5170d8['as'],'attributes':_0x5170d8[_0x77dd('0x24')],'include':_0x5170d8[_0x77dd('0x22')]?_[_0x77dd('0x25')](_0x5170d8['include'],function(_0x590281){return{'model':db[_0x590281['model']],'as':_0x590281['as'],'attributes':_0x590281[_0x77dd('0x24')]};}):[]};}):[]};}):[]:[]})[_0x77dd('0x26')](function(_0x4584e7){logger[_0x77dd('0x11')](_0x77dd('0x1c'),_0x20d1eb);logger[_0x77dd('0x13')]('GetVoiceQueue',_0x20d1eb,JSON[_0x77dd('0x15')](_0x4584e7));_0x4751e4(_0x4584e7);})[_0x77dd('0x1b')](function(_0x2d8b3e){logger[_0x77dd('0x16')]('GetVoiceQueue',_0x2d8b3e[_0x77dd('0x18')],_0x20d1eb);_0x4bcda0(_0x5235fa['error'](0x1f4,_0x2d8b3e[_0x77dd('0x18')]));});});};exports['ShowVoiceQueue']=function(_0x31c720){var _0x1cd0b8=this;return new Promise(function(_0x4577b9,_0x3ca7c0){return db[_0x77dd('0x1d')][_0x77dd('0x27')]({'raw':_0x31c720[_0x77dd('0x1e')]?_0x31c720[_0x77dd('0x1e')][_0x77dd('0x1f')]===undefined?!![]:![]:!![],'where':_0x31c720['options']?_0x31c720[_0x77dd('0x1e')][_0x77dd('0x20')]||null:null,'attributes':_0x31c720['options']?_0x31c720[_0x77dd('0x1e')]['attributes']||null:null,'include':_0x31c720['options']?_0x31c720['options']['include']?_['map'](_0x31c720['options'][_0x77dd('0x22')],function(_0x449f94){return{'model':db[_0x449f94[_0x77dd('0x23')]],'as':_0x449f94['as'],'attributes':_0x449f94['attributes'],'include':_0x449f94[_0x77dd('0x22')]?_[_0x77dd('0x25')](_0x449f94[_0x77dd('0x22')],function(_0x2f2948){return{'model':db[_0x2f2948[_0x77dd('0x23')]],'as':_0x2f2948['as'],'attributes':_0x2f2948[_0x77dd('0x24')],'include':_0x2f2948[_0x77dd('0x22')]?_[_0x77dd('0x25')](_0x2f2948['include'],function(_0x481eda){return{'model':db[_0x481eda[_0x77dd('0x23')]],'as':_0x481eda['as'],'attributes':_0x481eda[_0x77dd('0x24')]};}):[]};}):[]};}):[]:[]})[_0x77dd('0x26')](function(_0x50369b){logger[_0x77dd('0x11')](_0x77dd('0x28'),_0x31c720);logger[_0x77dd('0x13')](_0x77dd('0x28'),_0x31c720,JSON[_0x77dd('0x15')](_0x50369b));_0x4577b9(_0x50369b);})[_0x77dd('0x1b')](function(_0x586be4){logger[_0x77dd('0x16')](_0x77dd('0x28'),_0x586be4[_0x77dd('0x18')],_0x31c720);_0x3ca7c0(_0x1cd0b8[_0x77dd('0x16')](0x1f4,_0x586be4['message']));});});}; \ No newline at end of file +var _0x7360=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceQueue,\x20%s,\x20%s','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue','find','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x7360,0xef));var _0x0736=function(_0x2fc5f7,_0x1a2ea2){_0x2fc5f7=_0x2fc5f7-0x0;var _0x5c4dab=_0x7360[_0x2fc5f7];return _0x5c4dab;};'use strict';var _=require(_0x0736('0x0'));var util=require(_0x0736('0x1'));var moment=require(_0x0736('0x2'));var BPromise=require(_0x0736('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0736('0x4'));var db=require(_0x0736('0x5'))['db'];var utils=require(_0x0736('0x6'));var logger=require(_0x0736('0x7'))(_0x0736('0x8'));var config=require(_0x0736('0x9'));var jayson=require(_0x0736('0xa'));var client=jayson['client'][_0x0736('0xb')]({'port':0x232a});config[_0x0736('0xc')]=_['defaults'](config[_0x0736('0xc')],{'host':_0x0736('0xd'),'port':0x18eb});var socket=require(_0x0736('0xe'))(new Redis(config[_0x0736('0xc')]));require(_0x0736('0xf'))['register'](socket);function respondWithRpcPromise(_0xbe21ce,_0x4a53d7,_0x3b20ed){return new BPromise(function(_0x540191,_0x276947){return client[_0x0736('0x10')](_0xbe21ce,_0x3b20ed)['then'](function(_0x1917a1){logger[_0x0736('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x4a53d7,'request\x20sent');logger['debug'](_0x0736('0x12'),_0x4a53d7,_0x0736('0x13'),JSON[_0x0736('0x14')](_0x1917a1));if(_0x1917a1[_0x0736('0x15')]){if(_0x1917a1[_0x0736('0x15')]['code']===0x1f4){logger[_0x0736('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x4a53d7,_0x1917a1[_0x0736('0x15')][_0x0736('0x16')]);return _0x276947(_0x1917a1[_0x0736('0x15')]['message']);}logger[_0x0736('0x15')](_0x0736('0x17'),_0x4a53d7,_0x1917a1[_0x0736('0x15')][_0x0736('0x16')]);return _0x540191(_0x1917a1[_0x0736('0x15')][_0x0736('0x16')]);}else{logger[_0x0736('0x11')](_0x0736('0x17'),_0x4a53d7,'request\x20sent');_0x540191(_0x1917a1[_0x0736('0x18')]['message']);}})[_0x0736('0x19')](function(_0x429e8d){logger['error'](_0x0736('0x17'),_0x4a53d7,_0x429e8d);_0x276947(_0x429e8d);});});}exports[_0x0736('0x1a')]=function(_0x6ad359){var _0x3d62c5=this;return new Promise(function(_0x46afa0,_0x402bd0){return db[_0x0736('0x1b')][_0x0736('0x1c')]({'raw':_0x6ad359['options']?_0x6ad359[_0x0736('0x1d')][_0x0736('0x1e')]===undefined?!![]:![]:!![],'where':_0x6ad359[_0x0736('0x1d')]?_0x6ad359[_0x0736('0x1d')][_0x0736('0x1f')]||null:null,'attributes':_0x6ad359[_0x0736('0x1d')]?_0x6ad359[_0x0736('0x1d')][_0x0736('0x20')]||null:null,'limit':_0x6ad359['options']?_0x6ad359[_0x0736('0x1d')][_0x0736('0x21')]||null:null,'include':_0x6ad359[_0x0736('0x1d')]?_0x6ad359[_0x0736('0x1d')][_0x0736('0x22')]?_[_0x0736('0x23')](_0x6ad359[_0x0736('0x1d')][_0x0736('0x22')],function(_0x1af291){return{'model':db[_0x1af291[_0x0736('0x24')]],'as':_0x1af291['as'],'attributes':_0x1af291[_0x0736('0x20')],'include':_0x1af291['include']?_[_0x0736('0x23')](_0x1af291['include'],function(_0x577dd6){return{'model':db[_0x577dd6['model']],'as':_0x577dd6['as'],'attributes':_0x577dd6[_0x0736('0x20')],'include':_0x577dd6['include']?_['map'](_0x577dd6[_0x0736('0x22')],function(_0x1140b5){return{'model':db[_0x1140b5['model']],'as':_0x1140b5['as'],'attributes':_0x1140b5['attributes']};}):[]};}):[]};}):[]:[]})[_0x0736('0x25')](function(_0x3e9535){logger['info'](_0x0736('0x1a'),_0x6ad359);logger['debug'](_0x0736('0x1a'),_0x6ad359,JSON[_0x0736('0x14')](_0x3e9535));_0x46afa0(_0x3e9535);})[_0x0736('0x19')](function(_0x466101){logger[_0x0736('0x15')](_0x0736('0x1a'),_0x466101[_0x0736('0x16')],_0x6ad359);_0x402bd0(_0x3d62c5[_0x0736('0x15')](0x1f4,_0x466101[_0x0736('0x16')]));});});};exports[_0x0736('0x26')]=function(_0x27e07a){var _0x240ef2=this;return new Promise(function(_0x2eba83,_0x316499){return db[_0x0736('0x1b')][_0x0736('0x27')]({'raw':_0x27e07a[_0x0736('0x1d')]?_0x27e07a[_0x0736('0x1d')][_0x0736('0x1e')]===undefined?!![]:![]:!![],'where':_0x27e07a[_0x0736('0x1d')]?_0x27e07a['options']['where']||null:null,'attributes':_0x27e07a[_0x0736('0x1d')]?_0x27e07a[_0x0736('0x1d')][_0x0736('0x20')]||null:null,'include':_0x27e07a['options']?_0x27e07a[_0x0736('0x1d')]['include']?_[_0x0736('0x23')](_0x27e07a['options'][_0x0736('0x22')],function(_0x219652){return{'model':db[_0x219652[_0x0736('0x24')]],'as':_0x219652['as'],'attributes':_0x219652[_0x0736('0x20')],'include':_0x219652['include']?_[_0x0736('0x23')](_0x219652['include'],function(_0x323c2a){return{'model':db[_0x323c2a['model']],'as':_0x323c2a['as'],'attributes':_0x323c2a[_0x0736('0x20')],'include':_0x323c2a['include']?_[_0x0736('0x23')](_0x323c2a[_0x0736('0x22')],function(_0x4cae0c){return{'model':db[_0x4cae0c[_0x0736('0x24')]],'as':_0x4cae0c['as'],'attributes':_0x4cae0c[_0x0736('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0736('0x25')](function(_0xdcaf4){logger['info'](_0x0736('0x26'),_0x27e07a);logger[_0x0736('0x28')]('ShowVoiceQueue',_0x27e07a,JSON[_0x0736('0x14')](_0xdcaf4));_0x2eba83(_0xdcaf4);})[_0x0736('0x19')](function(_0xb62ed0){logger['error'](_0x0736('0x26'),_0xb62ed0[_0x0736('0x16')],_0x27e07a);_0x316499(_0x240ef2[_0x0736('0x15')](0x1f4,_0xb62ed0['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4d3a3e1..3b58545 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 _0x675c=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','register'];(function(_0x2ff86e,_0x1d543e){var _0x471b38=function(_0x5f5b36){while(--_0x5f5b36){_0x2ff86e['push'](_0x2ff86e['shift']());}};_0x471b38(++_0x1d543e);}(_0x675c,0x72));var _0xc675=function(_0x3b4934,_0x5b02da){_0x3b4934=_0x3b4934-0x0;var _0x4a56ad=_0x675c[_0x3b4934];return _0x4a56ad;};'use strict';var VoiceQueueEvents=require(_0xc675('0x0'));var events=[_0xc675('0x1'),_0xc675('0x2'),_0xc675('0x3')];function createListener(_0x578e33,_0x18b106){return function(_0x195ce2){_0x18b106[_0xc675('0x4')](_0x578e33,_0x195ce2);};}function removeListener(_0x1c81fc,_0x59a2e6){return function(){VoiceQueueEvents['removeListener'](_0x1c81fc,_0x59a2e6);};}exports[_0xc675('0x5')]=function(_0x29162c){for(var _0x248744=0x0,_0x559dc3=events[_0xc675('0x6')];_0x248744<_0x559dc3;_0x248744++){var _0x2a970a=events[_0x248744];var _0x39ef81=createListener(_0xc675('0x7')+_0x2a970a,_0x29162c);VoiceQueueEvents['on'](_0x2a970a,_0x39ef81);}}; \ No newline at end of file +var _0xbeb5=['register','length','voiceQueue:','save','remove','update','removeListener'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xbeb5,0x14c));var _0x5beb=function(_0x267d84,_0xa9450a){_0x267d84=_0x267d84-0x0;var _0x549fe8=_0xbeb5[_0x267d84];return _0x549fe8;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x5beb('0x0'),_0x5beb('0x1'),_0x5beb('0x2')];function createListener(_0x1ef31b,_0xfaa995){return function(_0x5874f0){_0xfaa995['emit'](_0x1ef31b,_0x5874f0);};}function removeListener(_0x54e588,_0x47b269){return function(){VoiceQueueEvents[_0x5beb('0x3')](_0x54e588,_0x47b269);};}exports[_0x5beb('0x4')]=function(_0xc7dc60){for(var _0x4ec2a8=0x0,_0x46385a=events[_0x5beb('0x5')];_0x4ec2a8<_0x46385a;_0x4ec2a8++){var _0x2df6cc=events[_0x4ec2a8];var _0x4acacf=createListener(_0x5beb('0x6')+_0x2df6cc,_0xc7dc60);VoiceQueueEvents['on'](_0x2df6cc,_0x4acacf);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f31dca1..94d301a 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 _0x9030=['get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller'];(function(_0x3b9028,_0x57ac10){var _0x4106bd=function(_0x431d03){while(--_0x431d03){_0x3b9028['push'](_0x3b9028['shift']());}};_0x4106bd(++_0x57ac10);}(_0x9030,0x1dc));var _0x0903=function(_0x4b00d7,_0x2bd992){_0x4b00d7=_0x4b00d7-0x0;var _0x54f515=_0x9030[_0x4b00d7];return _0x54f515;};'use strict';var multer=require(_0x0903('0x0'));var util=require('util');var path=require(_0x0903('0x1'));var timeout=require('connect-timeout');var express=require(_0x0903('0x2'));var router=express[_0x0903('0x3')]();var fs_extra=require(_0x0903('0x4'));var auth=require(_0x0903('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0903('0x6'));var controller=require(_0x0903('0x7'));router[_0x0903('0x8')]('/',auth['isAuthenticated'](),controller[_0x0903('0x9')]);router[_0x0903('0x8')](_0x0903('0xa'),auth[_0x0903('0xb')](),controller[_0x0903('0xc')]);router[_0x0903('0x8')](_0x0903('0xd'),auth[_0x0903('0xb')](),controller[_0x0903('0xe')]);router['get'](_0x0903('0xf'),auth[_0x0903('0xb')](),controller['show']);router[_0x0903('0x10')]('/',auth['isAuthenticated'](),controller[_0x0903('0x11')]);router[_0x0903('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0903('0x13')]);router[_0x0903('0x14')](_0x0903('0xf'),auth[_0x0903('0xb')](),controller[_0x0903('0x15')]);module['exports']=router; \ No newline at end of file +var _0x21d5=['/index','getVoiceQueuesReport','/:id','show','post','put','update','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x5cedbe,_0x5a0ae6){var _0x4d9395=function(_0xc314e7){while(--_0xc314e7){_0x5cedbe['push'](_0x5cedbe['shift']());}};_0x4d9395(++_0x5a0ae6);}(_0x21d5,0xd1));var _0x521d=function(_0x195918,_0x1ade71){_0x195918=_0x195918-0x0;var _0x580e56=_0x21d5[_0x195918];return _0x580e56;};'use strict';var multer=require(_0x521d('0x0'));var util=require('util');var path=require(_0x521d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x521d('0x2')]();var fs_extra=require(_0x521d('0x3'));var auth=require(_0x521d('0x4'));var interaction=require(_0x521d('0x5'));var config=require(_0x521d('0x6'));var controller=require(_0x521d('0x7'));router[_0x521d('0x8')]('/',auth[_0x521d('0x9')](),controller['index']);router['get'](_0x521d('0xa'),auth[_0x521d('0x9')](),controller['describe']);router['get'](_0x521d('0xb'),auth['isAuthenticated'](),controller[_0x521d('0xc')]);router[_0x521d('0x8')](_0x521d('0xd'),auth[_0x521d('0x9')](),controller[_0x521d('0xe')]);router[_0x521d('0xf')]('/',auth[_0x521d('0x9')](),controller['create']);router[_0x521d('0x10')](_0x521d('0xd'),auth['isAuthenticated'](),controller[_0x521d('0x11')]);router['delete'](_0x521d('0xd'),auth[_0x521d('0x9')](),controller[_0x521d('0x12')]);module[_0x521d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index b71768a..42b0a53 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 _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x49cf0b,_0x3850bc){var _0x4c72d8=function(_0x4271dd){while(--_0x4271dd){_0x49cf0b['push'](_0x49cf0b['shift']());}};_0x4c72d8(++_0x3850bc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb7e7[_0x3ea913];return _0x2b4f28;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x15d985,_0x1d93de){var _0xf9ace0=function(_0x1a0143){while(--_0x1a0143){_0x15d985['push'](_0x15d985['shift']());}};_0xf9ace0(++_0x1d93de);}(_0xb7e7,0x121));var _0x7b7e=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xb7e7[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'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 7d7104d..2262bec 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 _0x9f15=['apply','reject','save','update','destroy','then','error','name','send','merge','contact','message','agent','interaction','account','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','nolimit','order','rows','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','moment','util','path','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x9f15,0x1dc));var _0x59f1=function(_0x4d93c9,_0x4775ae){_0x4d93c9=_0x4d93c9-0x0;var _0x48536d=_0x9f15[_0x4d93c9];return _0x48536d;};'use strict';var emlformat=require(_0x59f1('0x0'));var rimraf=require(_0x59f1('0x1'));var zipdir=require(_0x59f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x59f1('0x3'));var moment=require(_0x59f1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x59f1('0x5'));var path=require(_0x59f1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x59f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59f1('0x8'));var squel=require('squel');var crypto=require(_0x59f1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x59f1('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x59f1('0xb'));var Redis=require('ioredis');var authService=require(_0x59f1('0xc'));var qs=require(_0x59f1('0xd'));var as=require(_0x59f1('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59f1('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x59f1('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x59f1('0x11'))['db'];config[_0x59f1('0x12')]=_[_0x59f1('0x13')](config[_0x59f1('0x12')],{'host':_0x59f1('0x14'),'port':0x18eb});var socket=require(_0x59f1('0x15'))(new Redis(config['redis']));require(_0x59f1('0x16'))[_0x59f1('0x17')](socket);function respondWithStatusCode(_0x571233,_0x15f553){_0x15f553=_0x15f553||0xcc;return function(_0x317a8a){if(_0x317a8a){return _0x571233[_0x59f1('0x18')](_0x15f553);}return _0x571233[_0x59f1('0x19')](_0x15f553)[_0x59f1('0x1a')]();};}function respondWithResult(_0x209b8b,_0x5edfe9){_0x5edfe9=_0x5edfe9||0xc8;return function(_0x258902){if(_0x258902){return _0x209b8b[_0x59f1('0x19')](_0x5edfe9)['json'](_0x258902);}};}function respondWithFilteredResult(_0x5dd2c3,_0x367bc6){return function(_0x3a5df2){if(_0x3a5df2){var _0x3ccd82=typeof _0x367bc6[_0x59f1('0x1b')]==='undefined'&&typeof _0x367bc6['limit']===_0x59f1('0x1c');var _0x5ed8bd=_0x3a5df2[_0x59f1('0x1d')];var _0x4c767c=_0x3ccd82?0x0:_0x367bc6[_0x59f1('0x1b')];var _0x2b159e=_0x3ccd82?_0x3a5df2[_0x59f1('0x1d')]:_0x367bc6[_0x59f1('0x1b')]+_0x367bc6[_0x59f1('0x1e')];var _0x9cd64;if(_0x2b159e>=_0x5ed8bd){_0x2b159e=_0x5ed8bd;_0x9cd64=0xc8;}else{_0x9cd64=0xce;}_0x5dd2c3[_0x59f1('0x19')](_0x9cd64);return _0x5dd2c3[_0x59f1('0x1f')](_0x59f1('0x20'),_0x4c767c+'-'+_0x2b159e+'/'+_0x5ed8bd)[_0x59f1('0x21')](_0x3a5df2);}return null;};}function patchUpdates(_0x16cf92){return function(_0x3f847b){try{jsonpatch[_0x59f1('0x22')](_0x3f847b,_0x16cf92,!![]);}catch(_0x5e1a44){return BPromise[_0x59f1('0x23')](_0x5e1a44);}return _0x3f847b[_0x59f1('0x24')]();};}function saveUpdates(_0x517325,_0x5bcbbb){return function(_0x6185d9){if(_0x6185d9){return _0x6185d9[_0x59f1('0x25')](_0x517325)['then'](function(_0x270efd){return _0x270efd;});}return null;};}function removeEntity(_0x5461b2,_0x22ae1){return function(_0x1c4173){if(_0x1c4173){return _0x1c4173[_0x59f1('0x26')]()[_0x59f1('0x27')](function(){_0x5461b2[_0x59f1('0x19')](0xcc)[_0x59f1('0x1a')]();});}};}function handleEntityNotFound(_0x59f744,_0xb2a91f){return function(_0x9aa7f1){if(!_0x9aa7f1){_0x59f744[_0x59f1('0x18')](0x194);}return _0x9aa7f1;};}function handleError(_0x4d565c,_0x43e83a){_0x43e83a=_0x43e83a||0x1f4;return function(_0x58fd69){logger[_0x59f1('0x28')](_0x58fd69['stack']);if(_0x58fd69[_0x59f1('0x29')]){delete _0x58fd69[_0x59f1('0x29')];}_0x4d565c['status'](_0x43e83a)[_0x59f1('0x2a')](_0x58fd69);};}function getMustacheRender(_0x45ef01,_0x5ec502){return Mustache['render'](_0x45ef01,_[_0x59f1('0x2b')](_0x5ec502['body'],{'contact':_0x5ec502[_0x59f1('0x2c')],'message':_0x5ec502[_0x59f1('0x2d')],'agent':_0x5ec502[_0x59f1('0x2e')],'interaction':_0x5ec502[_0x59f1('0x2f')],'account':_0x5ec502[_0x59f1('0x30')]}))||'';}exports[_0x59f1('0x31')]=function(_0x44c2cc,_0x48e9aa){var _0x49dae1={},_0xb85ca9={},_0x391963={'count':0x0,'rows':[]};var _0x54bccd=_['map'](db[_0x59f1('0x32')][_0x59f1('0x33')],function(_0x9a809a){return{'name':_0x9a809a[_0x59f1('0x34')],'type':_0x9a809a[_0x59f1('0x35')][_0x59f1('0x36')]};});_0xb85ca9[_0x59f1('0x37')]=_[_0x59f1('0x38')](_0x54bccd,_0x59f1('0x29'));_0xb85ca9[_0x59f1('0x39')]=_[_0x59f1('0x3a')](_0x44c2cc[_0x59f1('0x39')]);_0xb85ca9[_0x59f1('0x3b')]=_['intersection'](_0xb85ca9['model'],_0xb85ca9[_0x59f1('0x39')]);_0x49dae1[_0x59f1('0x3c')]=_[_0x59f1('0x3d')](_0xb85ca9['model'],qs[_0x59f1('0x3e')](_0x44c2cc[_0x59f1('0x39')][_0x59f1('0x3e')]));_0x49dae1[_0x59f1('0x3c')]=_0x49dae1[_0x59f1('0x3c')][_0x59f1('0x3f')]?_0x49dae1[_0x59f1('0x3c')]:_0xb85ca9[_0x59f1('0x37')];if(!_0x44c2cc[_0x59f1('0x39')][_0x59f1('0x40')]('nolimit')){_0x49dae1[_0x59f1('0x1e')]=qs[_0x59f1('0x1e')](_0x44c2cc['query'][_0x59f1('0x1e')]);_0x49dae1['offset']=qs[_0x59f1('0x1b')](_0x44c2cc[_0x59f1('0x39')]['offset']);}_0x49dae1['order']=qs[_0x59f1('0x41')](_0x44c2cc[_0x59f1('0x39')][_0x59f1('0x41')]);_0x49dae1[_0x59f1('0x42')]=qs[_0x59f1('0x3b')](_[_0x59f1('0x43')](_0x44c2cc['query'],_0xb85ca9[_0x59f1('0x3b')]),_0x54bccd);if(_0x44c2cc[_0x59f1('0x39')]['filter']){_0x49dae1[_0x59f1('0x42')]=_['merge'](_0x49dae1[_0x59f1('0x42')],{'$or':_[_0x59f1('0x38')](_0x54bccd,function(_0x2be2f8){if(_0x2be2f8['type']!==_0x59f1('0x44')){var _0x14f063={};_0x14f063[_0x2be2f8[_0x59f1('0x29')]]={'$like':'%'+_0x44c2cc[_0x59f1('0x39')][_0x59f1('0x45')]+'%'};return _0x14f063;}})});}_0x49dae1=_[_0x59f1('0x2b')]({},_0x49dae1,_0x44c2cc[_0x59f1('0x46')]);var _0x121884={'where':_0x49dae1['where']};return db[_0x59f1('0x32')]['count'](_0x121884)['then'](function(_0x1f97b0){_0x391963[_0x59f1('0x1d')]=_0x1f97b0;if(_0x44c2cc[_0x59f1('0x39')][_0x59f1('0x47')]){_0x49dae1['include']=[{'all':!![]}];}return db[_0x59f1('0x32')][_0x59f1('0x48')](_0x49dae1);})['then'](function(_0x39626a){_0x391963['rows']=_0x39626a;return _0x391963;})['then'](respondWithFilteredResult(_0x48e9aa,_0x49dae1))[_0x59f1('0x49')](handleError(_0x48e9aa,null));};exports[_0x59f1('0x4a')]=function(_0x3e4f14,_0xd61a64){var _0x25b3ed={'raw':![],'where':{'id':_0x3e4f14[_0x59f1('0x4b')]['id']}},_0x1a87d7={};_0x1a87d7[_0x59f1('0x37')]=_[_0x59f1('0x3a')](db[_0x59f1('0x32')]['rawAttributes']);_0x1a87d7[_0x59f1('0x39')]=_[_0x59f1('0x3a')](_0x3e4f14[_0x59f1('0x39')]);_0x1a87d7['filters']=_[_0x59f1('0x3d')](_0x1a87d7[_0x59f1('0x37')],_0x1a87d7[_0x59f1('0x39')]);_0x25b3ed[_0x59f1('0x3c')]=_[_0x59f1('0x3d')](_0x1a87d7['model'],qs['fields'](_0x3e4f14[_0x59f1('0x39')][_0x59f1('0x3e')]));_0x25b3ed[_0x59f1('0x3c')]=_0x25b3ed[_0x59f1('0x3c')]['length']?_0x25b3ed[_0x59f1('0x3c')]:_0x1a87d7[_0x59f1('0x37')];if(_0x3e4f14[_0x59f1('0x39')]['includeAll']){_0x25b3ed[_0x59f1('0x4c')]=[{'all':!![]}];}_0x25b3ed=_['merge']({},_0x25b3ed,_0x3e4f14[_0x59f1('0x46')]);return db[_0x59f1('0x32')][_0x59f1('0x4d')](_0x25b3ed)[_0x59f1('0x27')](handleEntityNotFound(_0xd61a64,null))['then'](respondWithResult(_0xd61a64,null))[_0x59f1('0x49')](handleError(_0xd61a64,null));};exports[_0x59f1('0x4e')]=function(_0x55238a,_0x5f1751){return db['VoiceQueueReport'][_0x59f1('0x4e')](_0x55238a['body'],{})[_0x59f1('0x27')](respondWithResult(_0x5f1751,0xc9))['catch'](handleError(_0x5f1751,null));};exports[_0x59f1('0x25')]=function(_0x466b3c,_0xae3d2b){if(_0x466b3c['body']['id']){delete _0x466b3c[_0x59f1('0x4f')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x466b3c[_0x59f1('0x4b')]['id']}})[_0x59f1('0x27')](handleEntityNotFound(_0xae3d2b,null))[_0x59f1('0x27')](saveUpdates(_0x466b3c[_0x59f1('0x4f')],null))[_0x59f1('0x27')](respondWithResult(_0xae3d2b,null))[_0x59f1('0x49')](handleError(_0xae3d2b,null));};exports[_0x59f1('0x26')]=function(_0x41746f,_0x119927){return db[_0x59f1('0x32')]['find']({'where':{'id':_0x41746f[_0x59f1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x119927,null))[_0x59f1('0x27')](removeEntity(_0x119927,null))['catch'](handleError(_0x119927,null));};exports[_0x59f1('0x50')]=function(_0x56dc0d,_0x4a4ec9){return db[_0x59f1('0x32')]['describe']()[_0x59f1('0x27')](respondWithResult(_0x4a4ec9,null))[_0x59f1('0x49')](handleError(_0x4a4ec9,null));};exports['getVoiceQueuesReport']=function(_0x5e62d0,_0x21d78b){var _0x232c8b={},_0x4436da={},_0x40e863={'count':0x0,'rows':[]};_0x4436da[_0x59f1('0x37')]=_[_0x59f1('0x3a')](db[_0x59f1('0x32')]['rawAttributes']);_0x4436da[_0x59f1('0x39')]=_[_0x59f1('0x3a')](_0x5e62d0[_0x59f1('0x39')]);_0x4436da[_0x59f1('0x3b')]=_[_0x59f1('0x3d')](_0x4436da[_0x59f1('0x37')],_0x4436da[_0x59f1('0x39')]);_0x232c8b[_0x59f1('0x3c')]=_[_0x59f1('0x3d')](_0x4436da['model'],qs['fields'](_0x5e62d0['query'][_0x59f1('0x3e')]));_0x232c8b['attributes']=_0x232c8b[_0x59f1('0x3c')]['length']?_0x232c8b[_0x59f1('0x3c')]:_0x4436da[_0x59f1('0x37')];if(!_0x5e62d0['query'][_0x59f1('0x40')](_0x59f1('0x51'))){_0x232c8b['limit']=qs['limit'](_0x5e62d0['query'][_0x59f1('0x1e')]);_0x232c8b[_0x59f1('0x1b')]=qs[_0x59f1('0x1b')](_0x5e62d0['query'][_0x59f1('0x1b')]);}_0x232c8b[_0x59f1('0x52')]=qs[_0x59f1('0x41')](_0x5e62d0[_0x59f1('0x39')][_0x59f1('0x41')]);_0x232c8b['where']=qs[_0x59f1('0x3b')](_[_0x59f1('0x43')](_0x5e62d0[_0x59f1('0x39')],_0x4436da[_0x59f1('0x3b')]));if(_0x5e62d0[_0x59f1('0x39')]['filter']){_0x232c8b[_0x59f1('0x42')]=_[_0x59f1('0x2b')](_0x232c8b[_0x59f1('0x42')],{'$or':_[_0x59f1('0x38')](_0x232c8b['attributes'],function(_0x5553d4){var _0x433c60={};_0x433c60[_0x5553d4]={'$like':'%'+_0x5e62d0['query'][_0x59f1('0x45')]+'%'};return _0x433c60;})});}_0x232c8b=_[_0x59f1('0x2b')]({},_0x232c8b,_0x5e62d0[_0x59f1('0x46')]);var _0x326566={'where':_0x232c8b[_0x59f1('0x42')]};return db[_0x59f1('0x32')]['count'](_0x326566)['then'](function(_0x17e73d){_0x40e863[_0x59f1('0x1d')]=_0x17e73d;if(_0x5e62d0[_0x59f1('0x39')][_0x59f1('0x47')]){_0x232c8b['include']=[{'all':!![]}];}return db[_0x59f1('0x32')]['findAll'](_0x232c8b);})['then'](function(_0x45374e){_0x40e863[_0x59f1('0x53')]=_0x45374e;return _0x40e863;})[_0x59f1('0x27')](respondWithFilteredResult(_0x21d78b,_0x232c8b,_0x59f1('0x54')))[_0x59f1('0x49')](handleError(_0x21d78b,null,_0x59f1('0x54')));}; \ No newline at end of file +var _0xdd11=['../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','render','body','contact','message','interaction','account','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','find','catch','create','params','destroy','describe','getVoiceQueuesReport','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis'];(function(_0xe08452,_0x1d621e){var _0x56d605=function(_0x4ac5b4){while(--_0x4ac5b4){_0xe08452['push'](_0xe08452['shift']());}};_0x56d605(++_0x1d621e);}(_0xdd11,0x96));var _0x1dd1=function(_0x265f52,_0x2d59d1){_0x265f52=_0x265f52-0x0;var _0x108c85=_0xdd11[_0x265f52];return _0x108c85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1dd1('0x0'));var zipdir=require(_0x1dd1('0x1'));var jsonpatch=require(_0x1dd1('0x2'));var rp=require(_0x1dd1('0x3'));var moment=require(_0x1dd1('0x4'));var BPromise=require(_0x1dd1('0x5'));var Mustache=require(_0x1dd1('0x6'));var util=require(_0x1dd1('0x7'));var path=require('path');var sox=require(_0x1dd1('0x8'));var csv=require(_0x1dd1('0x9'));var ejs=require(_0x1dd1('0xa'));var fs=require('fs');var fs_extra=require(_0x1dd1('0xb'));var _=require(_0x1dd1('0xc'));var squel=require(_0x1dd1('0xd'));var crypto=require(_0x1dd1('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1dd1('0x9'));var querystring=require(_0x1dd1('0xf'));var Papa=require(_0x1dd1('0x10'));var Redis=require(_0x1dd1('0x11'));var authService=require(_0x1dd1('0x12'));var qs=require(_0x1dd1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1dd1('0x14'));var utils=require('../../config/utils');var config=require(_0x1dd1('0x15'));var licenseUtil=require(_0x1dd1('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1dd1('0x17')](config[_0x1dd1('0x18')],{'host':_0x1dd1('0x19'),'port':0x18eb});var socket=require(_0x1dd1('0x1a'))(new Redis(config[_0x1dd1('0x18')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x41dc34,_0x4cee1b){_0x4cee1b=_0x4cee1b||0xcc;return function(_0x29df6c){if(_0x29df6c){return _0x41dc34[_0x1dd1('0x1b')](_0x4cee1b);}return _0x41dc34[_0x1dd1('0x1c')](_0x4cee1b)[_0x1dd1('0x1d')]();};}function respondWithResult(_0x2d4104,_0x2fe15a){_0x2fe15a=_0x2fe15a||0xc8;return function(_0x5de647){if(_0x5de647){return _0x2d4104[_0x1dd1('0x1c')](_0x2fe15a)['json'](_0x5de647);}};}function respondWithFilteredResult(_0xddf539,_0x2d4d80){return function(_0x5011be){if(_0x5011be){var _0x12ab89=typeof _0x2d4d80['offset']===_0x1dd1('0x1e')&&typeof _0x2d4d80[_0x1dd1('0x1f')]===_0x1dd1('0x1e');var _0x2ab9b6=_0x5011be[_0x1dd1('0x20')];var _0x228180=_0x12ab89?0x0:_0x2d4d80[_0x1dd1('0x21')];var _0x5a9bf5=_0x12ab89?_0x5011be['count']:_0x2d4d80[_0x1dd1('0x21')]+_0x2d4d80[_0x1dd1('0x1f')];var _0x43b91f;if(_0x5a9bf5>=_0x2ab9b6){_0x5a9bf5=_0x2ab9b6;_0x43b91f=0xc8;}else{_0x43b91f=0xce;}_0xddf539[_0x1dd1('0x1c')](_0x43b91f);return _0xddf539[_0x1dd1('0x22')](_0x1dd1('0x23'),_0x228180+'-'+_0x5a9bf5+'/'+_0x2ab9b6)['json'](_0x5011be);}return null;};}function patchUpdates(_0x23f5d4){return function(_0x16d48c){try{jsonpatch['apply'](_0x16d48c,_0x23f5d4,!![]);}catch(_0x2742b3){return BPromise[_0x1dd1('0x24')](_0x2742b3);}return _0x16d48c[_0x1dd1('0x25')]();};}function saveUpdates(_0x4521b2,_0x591b7e){return function(_0x39de1a){if(_0x39de1a){return _0x39de1a[_0x1dd1('0x26')](_0x4521b2)[_0x1dd1('0x27')](function(_0x272bbf){return _0x272bbf;});}return null;};}function removeEntity(_0x18647e,_0x520b2d){return function(_0x56bdfa){if(_0x56bdfa){return _0x56bdfa['destroy']()[_0x1dd1('0x27')](function(){_0x18647e['status'](0xcc)[_0x1dd1('0x1d')]();});}};}function handleEntityNotFound(_0x346686,_0x3d18be){return function(_0x591f4d){if(!_0x591f4d){_0x346686[_0x1dd1('0x1b')](0x194);}return _0x591f4d;};}function handleError(_0x54bd67,_0x4a1f7c){_0x4a1f7c=_0x4a1f7c||0x1f4;return function(_0x47b920){logger[_0x1dd1('0x28')](_0x47b920[_0x1dd1('0x29')]);if(_0x47b920[_0x1dd1('0x2a')]){delete _0x47b920[_0x1dd1('0x2a')];}_0x54bd67['status'](_0x4a1f7c)[_0x1dd1('0x2b')](_0x47b920);};}function getMustacheRender(_0x24d13e,_0x1f80e1){return Mustache[_0x1dd1('0x2c')](_0x24d13e,_['merge'](_0x1f80e1[_0x1dd1('0x2d')],{'contact':_0x1f80e1[_0x1dd1('0x2e')],'message':_0x1f80e1[_0x1dd1('0x2f')],'agent':_0x1f80e1['agent'],'interaction':_0x1f80e1[_0x1dd1('0x30')],'account':_0x1f80e1[_0x1dd1('0x31')]}))||'';}exports['index']=function(_0xe1e44b,_0x132bb1){var _0x58e45a={},_0x3d2f30={},_0x342eef={'count':0x0,'rows':[]};var _0xa5eed3=_['map'](db['VoiceQueueReport'][_0x1dd1('0x32')],function(_0x2fa6a8){return{'name':_0x2fa6a8['fieldName'],'type':_0x2fa6a8[_0x1dd1('0x33')][_0x1dd1('0x34')]};});_0x3d2f30[_0x1dd1('0x35')]=_[_0x1dd1('0x36')](_0xa5eed3,'name');_0x3d2f30['query']=_[_0x1dd1('0x37')](_0xe1e44b[_0x1dd1('0x38')]);_0x3d2f30[_0x1dd1('0x39')]=_[_0x1dd1('0x3a')](_0x3d2f30[_0x1dd1('0x35')],_0x3d2f30['query']);_0x58e45a['attributes']=_[_0x1dd1('0x3a')](_0x3d2f30[_0x1dd1('0x35')],qs['fields'](_0xe1e44b['query'][_0x1dd1('0x3b')]));_0x58e45a[_0x1dd1('0x3c')]=_0x58e45a[_0x1dd1('0x3c')][_0x1dd1('0x3d')]?_0x58e45a[_0x1dd1('0x3c')]:_0x3d2f30['model'];if(!_0xe1e44b[_0x1dd1('0x38')][_0x1dd1('0x3e')](_0x1dd1('0x3f'))){_0x58e45a[_0x1dd1('0x1f')]=qs[_0x1dd1('0x1f')](_0xe1e44b[_0x1dd1('0x38')]['limit']);_0x58e45a['offset']=qs[_0x1dd1('0x21')](_0xe1e44b[_0x1dd1('0x38')]['offset']);}_0x58e45a['order']=qs[_0x1dd1('0x40')](_0xe1e44b['query'][_0x1dd1('0x40')]);_0x58e45a[_0x1dd1('0x41')]=qs[_0x1dd1('0x39')](_[_0x1dd1('0x42')](_0xe1e44b[_0x1dd1('0x38')],_0x3d2f30[_0x1dd1('0x39')]),_0xa5eed3);if(_0xe1e44b[_0x1dd1('0x38')][_0x1dd1('0x43')]){_0x58e45a[_0x1dd1('0x41')]=_[_0x1dd1('0x44')](_0x58e45a['where'],{'$or':_[_0x1dd1('0x36')](_0xa5eed3,function(_0x4acfdb){if(_0x4acfdb[_0x1dd1('0x33')]!==_0x1dd1('0x45')){var _0x4e3c79={};_0x4e3c79[_0x4acfdb[_0x1dd1('0x2a')]]={'$like':'%'+_0xe1e44b['query'][_0x1dd1('0x43')]+'%'};return _0x4e3c79;}})});}_0x58e45a=_[_0x1dd1('0x44')]({},_0x58e45a,_0xe1e44b[_0x1dd1('0x46')]);var _0x3c832b={'where':_0x58e45a[_0x1dd1('0x41')]};return db[_0x1dd1('0x47')][_0x1dd1('0x20')](_0x3c832b)[_0x1dd1('0x27')](function(_0x46fde4){_0x342eef[_0x1dd1('0x20')]=_0x46fde4;if(_0xe1e44b['query'][_0x1dd1('0x48')]){_0x58e45a[_0x1dd1('0x49')]=[{'all':!![]}];}return db[_0x1dd1('0x47')][_0x1dd1('0x4a')](_0x58e45a);})[_0x1dd1('0x27')](function(_0x331ed9){_0x342eef[_0x1dd1('0x4b')]=_0x331ed9;return _0x342eef;})[_0x1dd1('0x27')](respondWithFilteredResult(_0x132bb1,_0x58e45a))['catch'](handleError(_0x132bb1,null));};exports['show']=function(_0x26b42a,_0x3ca019){var _0x5a2230={'raw':![],'where':{'id':_0x26b42a['params']['id']}},_0xaa6a12={};_0xaa6a12['model']=_[_0x1dd1('0x37')](db[_0x1dd1('0x47')][_0x1dd1('0x32')]);_0xaa6a12[_0x1dd1('0x38')]=_[_0x1dd1('0x37')](_0x26b42a[_0x1dd1('0x38')]);_0xaa6a12[_0x1dd1('0x39')]=_[_0x1dd1('0x3a')](_0xaa6a12[_0x1dd1('0x35')],_0xaa6a12[_0x1dd1('0x38')]);_0x5a2230[_0x1dd1('0x3c')]=_['intersection'](_0xaa6a12[_0x1dd1('0x35')],qs[_0x1dd1('0x3b')](_0x26b42a[_0x1dd1('0x38')]['fields']));_0x5a2230[_0x1dd1('0x3c')]=_0x5a2230[_0x1dd1('0x3c')]['length']?_0x5a2230[_0x1dd1('0x3c')]:_0xaa6a12[_0x1dd1('0x35')];if(_0x26b42a[_0x1dd1('0x38')][_0x1dd1('0x48')]){_0x5a2230[_0x1dd1('0x49')]=[{'all':!![]}];}_0x5a2230=_[_0x1dd1('0x44')]({},_0x5a2230,_0x26b42a[_0x1dd1('0x46')]);return db[_0x1dd1('0x47')][_0x1dd1('0x4c')](_0x5a2230)[_0x1dd1('0x27')](handleEntityNotFound(_0x3ca019,null))['then'](respondWithResult(_0x3ca019,null))[_0x1dd1('0x4d')](handleError(_0x3ca019,null));};exports[_0x1dd1('0x4e')]=function(_0x42334d,_0x24c1d9){return db['VoiceQueueReport']['create'](_0x42334d[_0x1dd1('0x2d')],{})[_0x1dd1('0x27')](respondWithResult(_0x24c1d9,0xc9))[_0x1dd1('0x4d')](handleError(_0x24c1d9,null));};exports['update']=function(_0x43eb0e,_0x35d8ec){if(_0x43eb0e[_0x1dd1('0x2d')]['id']){delete _0x43eb0e[_0x1dd1('0x2d')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x43eb0e[_0x1dd1('0x4f')]['id']}})[_0x1dd1('0x27')](handleEntityNotFound(_0x35d8ec,null))[_0x1dd1('0x27')](saveUpdates(_0x43eb0e[_0x1dd1('0x2d')],null))[_0x1dd1('0x27')](respondWithResult(_0x35d8ec,null))[_0x1dd1('0x4d')](handleError(_0x35d8ec,null));};exports[_0x1dd1('0x50')]=function(_0x68c6ed,_0x171795){return db[_0x1dd1('0x47')][_0x1dd1('0x4c')]({'where':{'id':_0x68c6ed[_0x1dd1('0x4f')]['id']}})[_0x1dd1('0x27')](handleEntityNotFound(_0x171795,null))[_0x1dd1('0x27')](removeEntity(_0x171795,null))[_0x1dd1('0x4d')](handleError(_0x171795,null));};exports[_0x1dd1('0x51')]=function(_0x123db1,_0x3ac9f7){return db[_0x1dd1('0x47')][_0x1dd1('0x51')]()[_0x1dd1('0x27')](respondWithResult(_0x3ac9f7,null))[_0x1dd1('0x4d')](handleError(_0x3ac9f7,null));};exports[_0x1dd1('0x52')]=function(_0xc32087,_0x36d132){var _0x31b4be={},_0xa9f0e1={},_0x18febd={'count':0x0,'rows':[]};_0xa9f0e1['model']=_[_0x1dd1('0x37')](db[_0x1dd1('0x47')][_0x1dd1('0x32')]);_0xa9f0e1[_0x1dd1('0x38')]=_[_0x1dd1('0x37')](_0xc32087[_0x1dd1('0x38')]);_0xa9f0e1[_0x1dd1('0x39')]=_['intersection'](_0xa9f0e1['model'],_0xa9f0e1[_0x1dd1('0x38')]);_0x31b4be[_0x1dd1('0x3c')]=_['intersection'](_0xa9f0e1[_0x1dd1('0x35')],qs[_0x1dd1('0x3b')](_0xc32087[_0x1dd1('0x38')]['fields']));_0x31b4be[_0x1dd1('0x3c')]=_0x31b4be[_0x1dd1('0x3c')][_0x1dd1('0x3d')]?_0x31b4be[_0x1dd1('0x3c')]:_0xa9f0e1[_0x1dd1('0x35')];if(!_0xc32087[_0x1dd1('0x38')][_0x1dd1('0x3e')](_0x1dd1('0x3f'))){_0x31b4be['limit']=qs[_0x1dd1('0x1f')](_0xc32087[_0x1dd1('0x38')][_0x1dd1('0x1f')]);_0x31b4be['offset']=qs[_0x1dd1('0x21')](_0xc32087['query']['offset']);}_0x31b4be[_0x1dd1('0x53')]=qs[_0x1dd1('0x40')](_0xc32087['query'][_0x1dd1('0x40')]);_0x31b4be['where']=qs[_0x1dd1('0x39')](_[_0x1dd1('0x42')](_0xc32087[_0x1dd1('0x38')],_0xa9f0e1[_0x1dd1('0x39')]));if(_0xc32087[_0x1dd1('0x38')][_0x1dd1('0x43')]){_0x31b4be[_0x1dd1('0x41')]=_[_0x1dd1('0x44')](_0x31b4be[_0x1dd1('0x41')],{'$or':_[_0x1dd1('0x36')](_0x31b4be['attributes'],function(_0x15d83f){var _0x164bda={};_0x164bda[_0x15d83f]={'$like':'%'+_0xc32087[_0x1dd1('0x38')][_0x1dd1('0x43')]+'%'};return _0x164bda;})});}_0x31b4be=_[_0x1dd1('0x44')]({},_0x31b4be,_0xc32087[_0x1dd1('0x46')]);var _0x20c6f0={'where':_0x31b4be[_0x1dd1('0x41')]};return db['VoiceQueueReport'][_0x1dd1('0x20')](_0x20c6f0)[_0x1dd1('0x27')](function(_0x2511f6){_0x18febd[_0x1dd1('0x20')]=_0x2511f6;if(_0xc32087[_0x1dd1('0x38')][_0x1dd1('0x48')]){_0x31b4be[_0x1dd1('0x49')]=[{'all':!![]}];}return db[_0x1dd1('0x47')]['findAll'](_0x31b4be);})[_0x1dd1('0x27')](function(_0x12ebe0){_0x18febd[_0x1dd1('0x4b')]=_0x12ebe0;return _0x18febd;})[_0x1dd1('0x27')](respondWithFilteredResult(_0x36d132,_0x31b4be,_0x1dd1('0x52')))['catch'](handleError(_0x36d132,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index aefeb17..03cf5b9 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 _0x8e5f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x1d529b,_0x2ca487){var _0x12a9d8=function(_0x35b70b){while(--_0x35b70b){_0x1d529b['push'](_0x1d529b['shift']());}};_0x12a9d8(++_0x2ca487);}(_0x8e5f,0x144));var _0xf8e5=function(_0x36c47e,_0x2d5d2d){_0x36c47e=_0x36c47e-0x0;var _0x15589a=_0x8e5f[_0x36c47e];return _0x15589a;};'use strict';var EventEmitter=require(_0xf8e5('0x0'));var VoiceQueueReport=require(_0xf8e5('0x1'))['db'][_0xf8e5('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf8e5('0x3')](0x0);var events={'afterCreate':_0xf8e5('0x4'),'afterUpdate':_0xf8e5('0x5'),'afterDestroy':_0xf8e5('0x6')};function emitEvent(_0x451603){return function(_0x5c6729,_0x5d6b33,_0x2ca10d){VoiceQueueReportEvents['emit'](_0x451603+':'+_0x5c6729['id'],_0x5c6729);VoiceQueueReportEvents[_0xf8e5('0x7')](_0x451603,_0x5c6729);_0x2ca10d(null);};}for(var e in events){if(events[_0xf8e5('0x8')](e)){var event=events[e];VoiceQueueReport[_0xf8e5('0x9')](e,emitEvent(event));}}module[_0xf8e5('0xa')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x0cb6=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x0cb6,0x120));var _0x60cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cb6[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x60cb('0x0'));var VoiceQueueReport=require(_0x60cb('0x1'))['db'][_0x60cb('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x60cb('0x3')](0x0);var events={'afterCreate':_0x60cb('0x4'),'afterUpdate':_0x60cb('0x5'),'afterDestroy':_0x60cb('0x6')};function emitEvent(_0x2fb781){return function(_0x37da43,_0xdadfd0,_0x53c80e){VoiceQueueReportEvents['emit'](_0x2fb781+':'+_0x37da43['id'],_0x37da43);VoiceQueueReportEvents[_0x60cb('0x7')](_0x2fb781,_0x37da43);_0x53c80e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x60cb('0x8')](e,emitEvent(event));}}module[_0x60cb('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9cf32af..164b2b6 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 _0x0b0e=['calleridnum','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0x184396,_0xcb407f){var _0x2f55ac=function(_0x1c39b7){while(--_0x1c39b7){_0x184396['push'](_0x184396['shift']());}};_0x2f55ac(++_0xcb407f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x0b0e[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0b0('0xb')]},{'fields':[_0xe0b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x8db2aa,_0x162d71){var _0x47450b=function(_0x1bcc29){while(--_0x1bcc29){_0x8db2aa['push'](_0x8db2aa['shift']());}};_0x47450b(++_0x162d71);}(_0x757a,0xde));var _0xa757=function(_0x2cc8f7,_0x43d79e){_0x2cc8f7=_0x2cc8f7-0x0;var _0x3cb8fc=_0x757a[_0x2cc8f7];return _0x3cb8fc;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa757('0xa')]},{'fields':[_0xa757('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d566337..9a8acb7 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 _0x1088=['lodash','moment','../../config/utils','rpc','client','http','redis','localhost','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetVoiceQueueReport','options','raw','where','limit','include','map','model','attributes','debug','stringify','catch','CreateVoiceQueueReport','VoiceQueueReport','create','body','update','UpdateVoiceQueueReport'];(function(_0x27d020,_0x3e50af){var _0x14a24b=function(_0x2cf88b){while(--_0x2cf88b){_0x27d020['push'](_0x27d020['shift']());}};_0x14a24b(++_0x3e50af);}(_0x1088,0xd8));var _0x8108=function(_0x20bc8a,_0x3f0662){_0x20bc8a=_0x20bc8a-0x0;var _0x4d0971=_0x1088[_0x20bc8a];return _0x4d0971;};'use strict';var _=require(_0x8108('0x0'));var util=require('util');var moment=require(_0x8108('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8108('0x2'));var logger=require('../../config/logger')(_0x8108('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8108('0x4')][_0x8108('0x5')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8108('0x6')],{'host':_0x8108('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8108('0x6')]));require('./voiceQueueReport.socket')[_0x8108('0x8')](socket);function respondWithRpcPromise(_0x5238e4,_0x419660,_0x81cdb9){return new BPromise(function(_0x733548,_0xcebf5d){return client[_0x8108('0x9')](_0x5238e4,_0x81cdb9)[_0x8108('0xa')](function(_0x16908){logger[_0x8108('0xb')](_0x8108('0xc'),_0x419660,_0x8108('0xd'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x419660,'request\x20sent',JSON['stringify'](_0x16908));if(_0x16908[_0x8108('0xe')]){if(_0x16908[_0x8108('0xe')][_0x8108('0xf')]===0x1f4){logger[_0x8108('0xe')](_0x8108('0xc'),_0x419660,_0x16908[_0x8108('0xe')][_0x8108('0x10')]);return _0xcebf5d(_0x16908[_0x8108('0xe')][_0x8108('0x10')]);}logger['error'](_0x8108('0xc'),_0x419660,_0x16908[_0x8108('0xe')][_0x8108('0x10')]);return _0x733548(_0x16908[_0x8108('0xe')]['message']);}else{logger[_0x8108('0xb')](_0x8108('0xc'),_0x419660,_0x8108('0xd'));_0x733548(_0x16908[_0x8108('0x11')][_0x8108('0x10')]);}})['catch'](function(_0x15a7fb){logger['error'](_0x8108('0xc'),_0x419660,_0x15a7fb);_0xcebf5d(_0x15a7fb);});});}exports[_0x8108('0x12')]=function(_0x4028aa){var _0x16646a=this;return new Promise(function(_0x4afd15,_0x5a8f45){return db['VoiceQueueReport']['findAll']({'raw':_0x4028aa[_0x8108('0x13')]?_0x4028aa[_0x8108('0x13')][_0x8108('0x14')]===undefined?!![]:![]:!![],'where':_0x4028aa['options']?_0x4028aa[_0x8108('0x13')][_0x8108('0x15')]||null:null,'attributes':_0x4028aa['options']?_0x4028aa[_0x8108('0x13')]['attributes']||null:null,'limit':_0x4028aa['options']?_0x4028aa['options'][_0x8108('0x16')]||null:null,'include':_0x4028aa[_0x8108('0x13')]?_0x4028aa[_0x8108('0x13')][_0x8108('0x17')]?_[_0x8108('0x18')](_0x4028aa[_0x8108('0x13')][_0x8108('0x17')],function(_0xf47c62){return{'model':db[_0xf47c62[_0x8108('0x19')]],'as':_0xf47c62['as'],'attributes':_0xf47c62[_0x8108('0x1a')],'include':_0xf47c62['include']?_[_0x8108('0x18')](_0xf47c62[_0x8108('0x17')],function(_0x17d2d2){return{'model':db[_0x17d2d2[_0x8108('0x19')]],'as':_0x17d2d2['as'],'attributes':_0x17d2d2[_0x8108('0x1a')],'include':_0x17d2d2[_0x8108('0x17')]?_['map'](_0x17d2d2['include'],function(_0x28e468){return{'model':db[_0x28e468[_0x8108('0x19')]],'as':_0x28e468['as'],'attributes':_0x28e468[_0x8108('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8108('0xa')](function(_0x5174dc){logger['info'](_0x8108('0x12'),_0x4028aa);logger[_0x8108('0x1b')]('GetVoiceQueueReport',_0x4028aa,JSON[_0x8108('0x1c')](_0x5174dc));_0x4afd15(_0x5174dc);})[_0x8108('0x1d')](function(_0x7869f3){logger[_0x8108('0xe')](_0x8108('0x12'),_0x7869f3['message'],_0x4028aa);_0x5a8f45(_0x16646a[_0x8108('0xe')](0x1f4,_0x7869f3['message']));});});};exports[_0x8108('0x1e')]=function(_0x1a8eae){var _0x5bf55e=this;return new Promise(function(_0x1b0820,_0x4c927b){return db[_0x8108('0x1f')][_0x8108('0x20')](_0x1a8eae[_0x8108('0x21')],{'raw':_0x1a8eae[_0x8108('0x13')]?_0x1a8eae[_0x8108('0x13')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2419dd){logger[_0x8108('0xb')]('CreateVoiceQueueReport',_0x1a8eae);logger[_0x8108('0x1b')](_0x8108('0x1e'),_0x1a8eae,JSON[_0x8108('0x1c')](_0x2419dd));_0x1b0820(_0x2419dd);})[_0x8108('0x1d')](function(_0xfd33ff){logger[_0x8108('0xe')](_0x8108('0x1e'),_0xfd33ff[_0x8108('0x10')],_0x1a8eae);_0x4c927b(_0x5bf55e['error'](0x1f4,_0xfd33ff[_0x8108('0x10')]));});});};exports['UpdateVoiceQueueReport']=function(_0x441edb){var _0x5a4d00=this;return new Promise(function(_0x1516bf,_0x337e1d){return db[_0x8108('0x1f')][_0x8108('0x22')](_0x441edb[_0x8108('0x21')],{'raw':_0x441edb[_0x8108('0x13')]?_0x441edb['options'][_0x8108('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x441edb[_0x8108('0x13')]?_0x441edb[_0x8108('0x13')]['where']||null:null,'attributes':_0x441edb[_0x8108('0x13')]?_0x441edb[_0x8108('0x13')][_0x8108('0x1a')]||null:null,'limit':_0x441edb[_0x8108('0x13')]?_0x441edb[_0x8108('0x13')][_0x8108('0x16')]||null:null})[_0x8108('0xa')](function(_0x54e83a){logger['info'](_0x8108('0x23'),_0x441edb);logger[_0x8108('0x1b')](_0x8108('0x23'),_0x441edb,JSON[_0x8108('0x1c')](_0x54e83a));_0x1516bf(_0x54e83a);})[_0x8108('0x1d')](function(_0x5436f8){logger[_0x8108('0xe')](_0x8108('0x23'),_0x5436f8[_0x8108('0x10')],_0x441edb);_0x337e1d(_0x5a4d00[_0x8108('0xe')](0x1f4,_0x5436f8['message']));});});}; \ No newline at end of file +var _0x7b40=['error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7b40,0x1a1));var _0x07b4=function(_0x2d7bba,_0x55ef06){_0x2d7bba=_0x2d7bba-0x0;var _0x440c39=_0x7b40[_0x2d7bba];return _0x440c39;};'use strict';var _=require(_0x07b4('0x0'));var util=require(_0x07b4('0x1'));var moment=require(_0x07b4('0x2'));var BPromise=require(_0x07b4('0x3'));var rs=require(_0x07b4('0x4'));var fs=require('fs');var Redis=require(_0x07b4('0x5'));var db=require(_0x07b4('0x6'))['db'];var utils=require(_0x07b4('0x7'));var logger=require(_0x07b4('0x8'))(_0x07b4('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x07b4('0xa')]({'port':0x232a});config[_0x07b4('0xb')]=_[_0x07b4('0xc')](config[_0x07b4('0xb')],{'host':_0x07b4('0xd'),'port':0x18eb});var socket=require(_0x07b4('0xe'))(new Redis(config['redis']));require(_0x07b4('0xf'))['register'](socket);function respondWithRpcPromise(_0x248775,_0x1cac47,_0x4915b0){return new BPromise(function(_0x6e3103,_0x3b6404){return client[_0x07b4('0x10')](_0x248775,_0x4915b0)[_0x07b4('0x11')](function(_0x11a483){logger[_0x07b4('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1cac47,'request\x20sent');logger[_0x07b4('0x13')](_0x07b4('0x14'),_0x1cac47,_0x07b4('0x15'),JSON[_0x07b4('0x16')](_0x11a483));if(_0x11a483[_0x07b4('0x17')]){if(_0x11a483[_0x07b4('0x17')][_0x07b4('0x18')]===0x1f4){logger[_0x07b4('0x17')](_0x07b4('0x19'),_0x1cac47,_0x11a483[_0x07b4('0x17')]['message']);return _0x3b6404(_0x11a483[_0x07b4('0x17')][_0x07b4('0x1a')]);}logger[_0x07b4('0x17')](_0x07b4('0x19'),_0x1cac47,_0x11a483['error'][_0x07b4('0x1a')]);return _0x6e3103(_0x11a483['error'][_0x07b4('0x1a')]);}else{logger[_0x07b4('0x12')](_0x07b4('0x19'),_0x1cac47,_0x07b4('0x15'));_0x6e3103(_0x11a483[_0x07b4('0x1b')][_0x07b4('0x1a')]);}})[_0x07b4('0x1c')](function(_0x488a51){logger[_0x07b4('0x17')](_0x07b4('0x19'),_0x1cac47,_0x488a51);_0x3b6404(_0x488a51);});});}exports[_0x07b4('0x1d')]=function(_0x3741be){var _0x5cfd25=this;return new Promise(function(_0x5bbf77,_0x2a25e3){return db[_0x07b4('0x1e')][_0x07b4('0x1f')]({'raw':_0x3741be[_0x07b4('0x20')]?_0x3741be[_0x07b4('0x20')][_0x07b4('0x21')]===undefined?!![]:![]:!![],'where':_0x3741be[_0x07b4('0x20')]?_0x3741be[_0x07b4('0x20')][_0x07b4('0x22')]||null:null,'attributes':_0x3741be['options']?_0x3741be[_0x07b4('0x20')][_0x07b4('0x23')]||null:null,'limit':_0x3741be[_0x07b4('0x20')]?_0x3741be['options']['limit']||null:null,'include':_0x3741be['options']?_0x3741be[_0x07b4('0x20')][_0x07b4('0x24')]?_['map'](_0x3741be[_0x07b4('0x20')]['include'],function(_0x3696a9){return{'model':db[_0x3696a9['model']],'as':_0x3696a9['as'],'attributes':_0x3696a9[_0x07b4('0x23')],'include':_0x3696a9[_0x07b4('0x24')]?_[_0x07b4('0x25')](_0x3696a9[_0x07b4('0x24')],function(_0x54f463){return{'model':db[_0x54f463[_0x07b4('0x26')]],'as':_0x54f463['as'],'attributes':_0x54f463['attributes'],'include':_0x54f463[_0x07b4('0x24')]?_['map'](_0x54f463['include'],function(_0x39ec6e){return{'model':db[_0x39ec6e['model']],'as':_0x39ec6e['as'],'attributes':_0x39ec6e[_0x07b4('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5305b0){logger[_0x07b4('0x12')](_0x07b4('0x1d'),_0x3741be);logger[_0x07b4('0x13')](_0x07b4('0x1d'),_0x3741be,JSON[_0x07b4('0x16')](_0x5305b0));_0x5bbf77(_0x5305b0);})[_0x07b4('0x1c')](function(_0x2e7f65){logger[_0x07b4('0x17')]('GetVoiceQueueReport',_0x2e7f65['message'],_0x3741be);_0x2a25e3(_0x5cfd25[_0x07b4('0x17')](0x1f4,_0x2e7f65[_0x07b4('0x1a')]));});});};exports[_0x07b4('0x27')]=function(_0x2ddadb){var _0x10de70=this;return new Promise(function(_0x24f547,_0xcb6e75){return db[_0x07b4('0x1e')][_0x07b4('0x28')](_0x2ddadb[_0x07b4('0x29')],{'raw':_0x2ddadb[_0x07b4('0x20')]?_0x2ddadb[_0x07b4('0x20')][_0x07b4('0x21')]===undefined?!![]:![]:!![]})[_0x07b4('0x11')](function(_0x2d1e57){logger[_0x07b4('0x12')]('CreateVoiceQueueReport',_0x2ddadb);logger[_0x07b4('0x13')](_0x07b4('0x27'),_0x2ddadb,JSON['stringify'](_0x2d1e57));_0x24f547(_0x2d1e57);})['catch'](function(_0x334d54){logger['error']('CreateVoiceQueueReport',_0x334d54[_0x07b4('0x1a')],_0x2ddadb);_0xcb6e75(_0x10de70[_0x07b4('0x17')](0x1f4,_0x334d54[_0x07b4('0x1a')]));});});};exports[_0x07b4('0x2a')]=function(_0x537a26){var _0x3652d7=this;return new Promise(function(_0x30bcfc,_0x544cc0){return db[_0x07b4('0x1e')][_0x07b4('0x2b')](_0x537a26[_0x07b4('0x29')],{'raw':_0x537a26[_0x07b4('0x20')]?_0x537a26[_0x07b4('0x20')][_0x07b4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537a26[_0x07b4('0x20')]?_0x537a26[_0x07b4('0x20')][_0x07b4('0x22')]||null:null,'attributes':_0x537a26[_0x07b4('0x20')]?_0x537a26[_0x07b4('0x20')]['attributes']||null:null,'limit':_0x537a26[_0x07b4('0x20')]?_0x537a26[_0x07b4('0x20')]['limit']||null:null})[_0x07b4('0x11')](function(_0x571875){logger['info']('UpdateVoiceQueueReport',_0x537a26);logger[_0x07b4('0x13')]('UpdateVoiceQueueReport',_0x537a26,JSON[_0x07b4('0x16')](_0x571875));_0x30bcfc(_0x571875);})[_0x07b4('0x1c')](function(_0x59f3d4){logger[_0x07b4('0x17')](_0x07b4('0x2a'),_0x59f3d4[_0x07b4('0x1a')],_0x537a26);_0x544cc0(_0x3652d7[_0x07b4('0x17')](0x1f4,_0x59f3d4[_0x07b4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index f6a8bad..7fdb2a9 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 _0xfd3a=['voiceQueueReport:','./voiceQueueReport.events','remove','update','removeListener','register','length'];(function(_0x595270,_0x19282f){var _0x215e9a=function(_0x36ee85){while(--_0x36ee85){_0x595270['push'](_0x595270['shift']());}};_0x215e9a(++_0x19282f);}(_0xfd3a,0x189));var _0xafd3=function(_0x3a69a6,_0x524813){_0x3a69a6=_0x3a69a6-0x0;var _0x3b20c9=_0xfd3a[_0x3a69a6];return _0x3b20c9;};'use strict';var VoiceQueueReportEvents=require(_0xafd3('0x0'));var events=['save',_0xafd3('0x1'),_0xafd3('0x2')];function createListener(_0x1f8084,_0x45f737){return function(_0x5d8019){_0x45f737['emit'](_0x1f8084,_0x5d8019);};}function removeListener(_0x275f9f,_0x463338){return function(){VoiceQueueReportEvents[_0xafd3('0x3')](_0x275f9f,_0x463338);};}exports[_0xafd3('0x4')]=function(_0x25f856){for(var _0x146d55=0x0,_0x2ae048=events[_0xafd3('0x5')];_0x146d55<_0x2ae048;_0x146d55++){var _0x49c7c1=events[_0x146d55];var _0x254f05=createListener(_0xafd3('0x6')+_0x49c7c1,_0x25f856);VoiceQueueReportEvents['on'](_0x49c7c1,_0x254f05);}}; \ No newline at end of file +var _0x160a=['update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x4d551d,_0x1dbd18){var _0x5dee7c=function(_0x5c5dd2){while(--_0x5c5dd2){_0x4d551d['push'](_0x4d551d['shift']());}};_0x5dee7c(++_0x1dbd18);}(_0x160a,0x1bf));var _0xa160=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x160a[_0x53afe9];return _0x396396;};'use strict';var VoiceQueueReportEvents=require(_0xa160('0x0'));var events=[_0xa160('0x1'),_0xa160('0x2'),_0xa160('0x3')];function createListener(_0x48ed1f,_0x355f51){return function(_0x48c050){_0x355f51[_0xa160('0x4')](_0x48ed1f,_0x48c050);};}function removeListener(_0x5ce0a6,_0x1f7823){return function(){VoiceQueueReportEvents[_0xa160('0x5')](_0x5ce0a6,_0x1f7823);};}exports[_0xa160('0x6')]=function(_0x5955cc){for(var _0x19a11d=0x0,_0x4836ef=events[_0xa160('0x7')];_0x19a11d<_0x4836ef;_0x19a11d++){var _0x454124=events[_0x19a11d];var _0x524c47=createListener(_0xa160('0x8')+_0x454124,_0x5955cc);VoiceQueueReportEvents['on'](_0x454124,_0x524c47);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e700e49..1719c7f 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 _0xe08b=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','delete','destroy','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe08b,0x10e));var _0xbe08=function(_0x363b81,_0x81e6ca){_0x363b81=_0x363b81-0x0;var _0x1d92fb=_0xe08b[_0x363b81];return _0x1d92fb;};'use strict';var multer=require(_0xbe08('0x0'));var util=require('util');var path=require(_0xbe08('0x1'));var timeout=require(_0xbe08('0x2'));var express=require('express');var router=express[_0xbe08('0x3')]();var fs_extra=require(_0xbe08('0x4'));var auth=require(_0xbe08('0x5'));var interaction=require(_0xbe08('0x6'));var config=require(_0xbe08('0x7'));var controller=require(_0xbe08('0x8'));router[_0xbe08('0x9')]('/',auth[_0xbe08('0xa')](),controller[_0xbe08('0xb')]);router[_0xbe08('0x9')](_0xbe08('0xc'),auth[_0xbe08('0xa')](),controller[_0xbe08('0xd')]);router['post']('/',auth[_0xbe08('0xa')](),controller[_0xbe08('0xe')]);router['put'](_0xbe08('0xc'),auth[_0xbe08('0xa')](),controller['update']);router[_0xbe08('0xf')](_0xbe08('0xc'),auth['isAuthenticated'](),controller[_0xbe08('0x10')]);module[_0xbe08('0x11')]=router; \ No newline at end of file +var _0x62f1=['index','isAuthenticated','show','post','create','put','/:id','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x62f1,0x112));var _0x162f=function(_0x49e83a,_0x46e512){_0x49e83a=_0x49e83a-0x0;var _0x1ceed6=_0x62f1[_0x49e83a];return _0x1ceed6;};'use strict';var multer=require(_0x162f('0x0'));var util=require('util');var path=require(_0x162f('0x1'));var timeout=require(_0x162f('0x2'));var express=require(_0x162f('0x3'));var router=express[_0x162f('0x4')]();var fs_extra=require(_0x162f('0x5'));var auth=require(_0x162f('0x6'));var interaction=require(_0x162f('0x7'));var config=require(_0x162f('0x8'));var controller=require(_0x162f('0x9'));router[_0x162f('0xa')]('/',auth['isAuthenticated'](),controller[_0x162f('0xb')]);router[_0x162f('0xa')]('/:id',auth[_0x162f('0xc')](),controller[_0x162f('0xd')]);router[_0x162f('0xe')]('/',auth['isAuthenticated'](),controller[_0x162f('0xf')]);router[_0x162f('0x10')](_0x162f('0x11'),auth[_0x162f('0xc')](),controller['update']);router[_0x162f('0x12')](_0x162f('0x11'),auth[_0x162f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 5cdb4bc..d6c8a0f 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 _0x7a23=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0xc6fe98,_0xc877c){var _0x177697=function(_0xa5f5b0){while(--_0xa5f5b0){_0xc6fe98['push'](_0xc6fe98['shift']());}};_0x177697(++_0xc877c);}(_0x7a23,0xd0));var _0x37a2=function(_0x2cc3a1,_0x3019fa){_0x2cc3a1=_0x2cc3a1-0x0;var _0x1391b7=_0x7a23[_0x2cc3a1];return _0x1391b7;};'use strict';var Sequelize=require(_0x37a2('0x0'));var moment=require('moment');module[_0x37a2('0x1')]={'time':{'type':Sequelize[_0x37a2('0x2')]},'callid':{'type':Sequelize[_0x37a2('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x37a2('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x37a2('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x37a2('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x37a2('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x37a2('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x37a2('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x37a2('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x37a2('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0x37a2('0x4'))}}; \ No newline at end of file +var _0x44ef=['sequelize','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2ccf68,_0x1d41df){var _0x2793f7=function(_0x3351af){while(--_0x3351af){_0x2ccf68['push'](_0x2ccf68['shift']());}};_0x2793f7(++_0x1d41df);}(_0x44ef,0x104));var _0xf44e=function(_0x4f6c0f,_0x8b0399){_0x4f6c0f=_0x4f6c0f-0x0;var _0x16c9e0=_0x44ef[_0x4f6c0f];return _0x16c9e0;};'use strict';var Sequelize=require(_0xf44e('0x0'));var moment=require('moment');module[_0xf44e('0x1')]={'time':{'type':Sequelize[_0xf44e('0x2')]},'callid':{'type':Sequelize[_0xf44e('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf44e('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf44e('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf44e('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf44e('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf44e('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xf44e('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf44e('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xf44e('0x3')](_0xf44e('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 6e0cd5e..f0af4da 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 _0xbaf0=['save','update','error','stack','name','send','render','body','contact','agent','interaction','account','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','include','rows','catch','show','find','create','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x51435d,_0x5c4a92){var _0x1304fc=function(_0x27a7e3){while(--_0x27a7e3){_0x51435d['push'](_0x51435d['shift']());}};_0x1304fc(++_0x5c4a92);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xcc;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0x1b')](_0xe4378c);}return _0x465dd7['status'](_0xe4378c)[_0x0baf('0x1c')]();};}function respondWithResult(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0xc8;return function(_0x1f50c3){if(_0x1f50c3){return _0x49e44b[_0x0baf('0x1d')](_0x1c76a8)[_0x0baf('0x1e')](_0x1f50c3);}};}function respondWithFilteredResult(_0xb8339e,_0x469599){return function(_0x4f80a8){if(_0x4f80a8){var _0x4cd79d=typeof _0x469599[_0x0baf('0x1f')]===_0x0baf('0x20')&&typeof _0x469599[_0x0baf('0x21')]===_0x0baf('0x20');var _0x2cf7da=_0x4f80a8[_0x0baf('0x22')];var _0x53c338=_0x4cd79d?0x0:_0x469599[_0x0baf('0x1f')];var _0xfbecec=_0x4cd79d?_0x4f80a8[_0x0baf('0x22')]:_0x469599[_0x0baf('0x1f')]+_0x469599[_0x0baf('0x21')];var _0x42b7f2;if(_0xfbecec>=_0x2cf7da){_0xfbecec=_0x2cf7da;_0x42b7f2=0xc8;}else{_0x42b7f2=0xce;}_0xb8339e['status'](_0x42b7f2);return _0xb8339e['set'](_0x0baf('0x23'),_0x53c338+'-'+_0xfbecec+'/'+_0x2cf7da)[_0x0baf('0x1e')](_0x4f80a8);}return null;};}function patchUpdates(_0x32e839){return function(_0x1848e8){try{jsonpatch[_0x0baf('0x24')](_0x1848e8,_0x32e839,!![]);}catch(_0x3e3e20){return BPromise[_0x0baf('0x25')](_0x3e3e20);}return _0x1848e8[_0x0baf('0x26')]();};}function saveUpdates(_0x2c42e2,_0x15a2c3){return function(_0x54f2fa){if(_0x54f2fa){return _0x54f2fa[_0x0baf('0x27')](_0x2c42e2)['then'](function(_0xf6c158){return _0xf6c158;});}return null;};}function removeEntity(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(_0x2ef0aa){return _0x2ef0aa['destroy']()['then'](function(){_0x5dbf00[_0x0baf('0x1d')](0xcc)[_0x0baf('0x1c')]();});}};}function handleEntityNotFound(_0x34e264,_0x19d9fd){return function(_0x3a1ba1){if(!_0x3a1ba1){_0x34e264['sendStatus'](0x194);}return _0x3a1ba1;};}function handleError(_0x448617,_0x4681c5){_0x4681c5=_0x4681c5||0x1f4;return function(_0x1ca35a){logger[_0x0baf('0x28')](_0x1ca35a[_0x0baf('0x29')]);if(_0x1ca35a[_0x0baf('0x2a')]){delete _0x1ca35a[_0x0baf('0x2a')];}_0x448617['status'](_0x4681c5)[_0x0baf('0x2b')](_0x1ca35a);};}function getMustacheRender(_0x393a5a,_0xcaf13d){return Mustache[_0x0baf('0x2c')](_0x393a5a,_['merge'](_0xcaf13d[_0x0baf('0x2d')],{'contact':_0xcaf13d[_0x0baf('0x2e')],'message':_0xcaf13d['message'],'agent':_0xcaf13d[_0x0baf('0x2f')],'interaction':_0xcaf13d[_0x0baf('0x30')],'account':_0xcaf13d[_0x0baf('0x31')]}))||'';}exports[_0x0baf('0x32')]=function(_0xd14f0f,_0x366924){var _0x213a6a={},_0x57476f={},_0xe92c2c={'count':0x0,'rows':[]};var _0x156ed7=_[_0x0baf('0x33')](db[_0x0baf('0x34')][_0x0baf('0x35')],function(_0x275ea1){return{'name':_0x275ea1[_0x0baf('0x36')],'type':_0x275ea1[_0x0baf('0x37')][_0x0baf('0x38')]};});_0x57476f[_0x0baf('0x39')]=_[_0x0baf('0x33')](_0x156ed7,_0x0baf('0x2a'));_0x57476f[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0xd14f0f['query']);_0x57476f[_0x0baf('0x3c')]=_['intersection'](_0x57476f[_0x0baf('0x39')],_0x57476f[_0x0baf('0x3a')]);_0x213a6a[_0x0baf('0x3d')]=_[_0x0baf('0x3e')](_0x57476f['model'],qs[_0x0baf('0x3f')](_0xd14f0f[_0x0baf('0x3a')]['fields']));_0x213a6a[_0x0baf('0x3d')]=_0x213a6a[_0x0baf('0x3d')][_0x0baf('0x40')]?_0x213a6a[_0x0baf('0x3d')]:_0x57476f[_0x0baf('0x39')];if(!_0xd14f0f[_0x0baf('0x3a')][_0x0baf('0x41')](_0x0baf('0x42'))){_0x213a6a['limit']=qs[_0x0baf('0x21')](_0xd14f0f[_0x0baf('0x3a')]['limit']);_0x213a6a[_0x0baf('0x1f')]=qs['offset'](_0xd14f0f['query'][_0x0baf('0x1f')]);}_0x213a6a[_0x0baf('0x43')]=qs['sort'](_0xd14f0f['query'][_0x0baf('0x44')]);_0x213a6a[_0x0baf('0x45')]=qs[_0x0baf('0x3c')](_[_0x0baf('0x46')](_0xd14f0f[_0x0baf('0x3a')],_0x57476f[_0x0baf('0x3c')]),_0x156ed7);if(_0xd14f0f[_0x0baf('0x3a')][_0x0baf('0x47')]){_0x213a6a[_0x0baf('0x45')]=_[_0x0baf('0x48')](_0x213a6a[_0x0baf('0x45')],{'$or':_[_0x0baf('0x33')](_0x156ed7,function(_0x354cb1){if(_0x354cb1[_0x0baf('0x37')]!=='VIRTUAL'){var _0x3573ce={};_0x3573ce[_0x354cb1[_0x0baf('0x2a')]]={'$like':'%'+_0xd14f0f['query'][_0x0baf('0x47')]+'%'};return _0x3573ce;}})});}_0x213a6a=_[_0x0baf('0x48')]({},_0x213a6a,_0xd14f0f[_0x0baf('0x49')]);var _0x299f93={'where':_0x213a6a[_0x0baf('0x45')]};return db[_0x0baf('0x34')]['count'](_0x299f93)[_0x0baf('0x4a')](function(_0x465361){_0xe92c2c['count']=_0x465361;if(_0xd14f0f[_0x0baf('0x3a')][_0x0baf('0x4b')]){_0x213a6a[_0x0baf('0x4c')]=[{'all':!![]}];}return db[_0x0baf('0x34')]['findAll'](_0x213a6a);})[_0x0baf('0x4a')](function(_0x43919e){_0xe92c2c[_0x0baf('0x4d')]=_0x43919e;return _0xe92c2c;})[_0x0baf('0x4a')](respondWithFilteredResult(_0x366924,_0x213a6a))[_0x0baf('0x4e')](handleError(_0x366924,null));};exports[_0x0baf('0x4f')]=function(_0x33da34,_0x1fa237){var _0xce1bf0={'raw':!![],'where':{'id':_0x33da34['params']['id']}},_0x355033={};_0x355033[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x34')][_0x0baf('0x35')]);_0x355033[_0x0baf('0x3a')]=_['keys'](_0x33da34[_0x0baf('0x3a')]);_0x355033[_0x0baf('0x3c')]=_[_0x0baf('0x3e')](_0x355033[_0x0baf('0x39')],_0x355033[_0x0baf('0x3a')]);_0xce1bf0['attributes']=_[_0x0baf('0x3e')](_0x355033[_0x0baf('0x39')],qs[_0x0baf('0x3f')](_0x33da34[_0x0baf('0x3a')][_0x0baf('0x3f')]));_0xce1bf0[_0x0baf('0x3d')]=_0xce1bf0[_0x0baf('0x3d')]['length']?_0xce1bf0[_0x0baf('0x3d')]:_0x355033[_0x0baf('0x39')];if(_0x33da34[_0x0baf('0x3a')]['includeAll']){_0xce1bf0[_0x0baf('0x4c')]=[{'all':!![]}];}_0xce1bf0=_[_0x0baf('0x48')]({},_0xce1bf0,_0x33da34[_0x0baf('0x49')]);return db[_0x0baf('0x34')][_0x0baf('0x50')](_0xce1bf0)[_0x0baf('0x4a')](handleEntityNotFound(_0x1fa237,null))[_0x0baf('0x4a')](respondWithResult(_0x1fa237,null))['catch'](handleError(_0x1fa237,null));};exports[_0x0baf('0x51')]=function(_0x428c9b,_0x214a1d){return db[_0x0baf('0x34')][_0x0baf('0x51')](_0x428c9b[_0x0baf('0x2d')],{})[_0x0baf('0x4a')](respondWithResult(_0x214a1d,0xc9))[_0x0baf('0x4e')](handleError(_0x214a1d,null));};exports[_0x0baf('0x27')]=function(_0x19c008,_0x2c6cdf){if(_0x19c008['body']['id']){delete _0x19c008['body']['id'];}return db[_0x0baf('0x34')][_0x0baf('0x50')]({'where':{'id':_0x19c008[_0x0baf('0x52')]['id']}})[_0x0baf('0x4a')](handleEntityNotFound(_0x2c6cdf,null))[_0x0baf('0x4a')](saveUpdates(_0x19c008[_0x0baf('0x2d')],null))[_0x0baf('0x4a')](respondWithResult(_0x2c6cdf,null))['catch'](handleError(_0x2c6cdf,null));};exports[_0x0baf('0x53')]=function(_0x2ef4c1,_0xf2424){return db[_0x0baf('0x34')][_0x0baf('0x50')]({'where':{'id':_0x2ef4c1[_0x0baf('0x52')]['id']}})['then'](handleEntityNotFound(_0xf2424,null))[_0x0baf('0x4a')](removeEntity(_0xf2424,null))['catch'](handleError(_0xf2424,null));}; \ No newline at end of file +var _0xbdb7=['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','update','error','stack','name','send','render','merge','body','contact','message','agent','interaction','index','map','VoiceQueuesLog','rawAttributes','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','then','include','findAll','rows','catch','show','params','includeAll','options','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4380e2,_0x4834fe){_0x4380e2=_0x4380e2-0x0;var _0x339df9=_0xbdb7[_0x4380e2];return _0x339df9;};'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);};}function getMustacheRender(_0xe1141d,_0x371e8a){return Mustache[_0x7bdb('0x27')](_0xe1141d,_[_0x7bdb('0x28')](_0x371e8a[_0x7bdb('0x29')],{'contact':_0x371e8a[_0x7bdb('0x2a')],'message':_0x371e8a[_0x7bdb('0x2b')],'agent':_0x371e8a[_0x7bdb('0x2c')],'interaction':_0x371e8a[_0x7bdb('0x2d')],'account':_0x371e8a['account']}))||'';}exports[_0x7bdb('0x2e')]=function(_0x23fc3a,_0x8f7672){var _0x9f5c1={},_0x29eac5={},_0x5da819={'count':0x0,'rows':[]};var _0x28aa2f=_[_0x7bdb('0x2f')](db[_0x7bdb('0x30')][_0x7bdb('0x31')],function(_0x58c6b7){return{'name':_0x58c6b7['fieldName'],'type':_0x58c6b7['type'][_0x7bdb('0x32')]};});_0x29eac5['model']=_[_0x7bdb('0x2f')](_0x28aa2f,'name');_0x29eac5[_0x7bdb('0x33')]=_[_0x7bdb('0x34')](_0x23fc3a[_0x7bdb('0x33')]);_0x29eac5['filters']=_[_0x7bdb('0x35')](_0x29eac5['model'],_0x29eac5['query']);_0x9f5c1[_0x7bdb('0x36')]=_['intersection'](_0x29eac5[_0x7bdb('0x37')],qs['fields'](_0x23fc3a['query'][_0x7bdb('0x38')]));_0x9f5c1[_0x7bdb('0x36')]=_0x9f5c1[_0x7bdb('0x36')][_0x7bdb('0x39')]?_0x9f5c1[_0x7bdb('0x36')]:_0x29eac5[_0x7bdb('0x37')];if(!_0x23fc3a['query'][_0x7bdb('0x3a')](_0x7bdb('0x3b'))){_0x9f5c1[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x23fc3a[_0x7bdb('0x33')][_0x7bdb('0x1b')]);_0x9f5c1[_0x7bdb('0x19')]=qs[_0x7bdb('0x19')](_0x23fc3a[_0x7bdb('0x33')]['offset']);}_0x9f5c1['order']=qs[_0x7bdb('0x3c')](_0x23fc3a[_0x7bdb('0x33')][_0x7bdb('0x3c')]);_0x9f5c1[_0x7bdb('0x3d')]=qs[_0x7bdb('0x3e')](_['pick'](_0x23fc3a['query'],_0x29eac5[_0x7bdb('0x3e')]),_0x28aa2f);if(_0x23fc3a['query'][_0x7bdb('0x3f')]){_0x9f5c1['where']=_[_0x7bdb('0x28')](_0x9f5c1['where'],{'$or':_['map'](_0x28aa2f,function(_0x21dae7){if(_0x21dae7[_0x7bdb('0x40')]!==_0x7bdb('0x41')){var _0x29435f={};_0x29435f[_0x21dae7[_0x7bdb('0x25')]]={'$like':'%'+_0x23fc3a[_0x7bdb('0x33')][_0x7bdb('0x3f')]+'%'};return _0x29435f;}})});}_0x9f5c1=_['merge']({},_0x9f5c1,_0x23fc3a['options']);var _0x18bdf6={'where':_0x9f5c1[_0x7bdb('0x3d')]};return db[_0x7bdb('0x30')][_0x7bdb('0x1c')](_0x18bdf6)[_0x7bdb('0x42')](function(_0x1824c6){_0x5da819[_0x7bdb('0x1c')]=_0x1824c6;if(_0x23fc3a['query']['includeAll']){_0x9f5c1[_0x7bdb('0x43')]=[{'all':!![]}];}return db[_0x7bdb('0x30')][_0x7bdb('0x44')](_0x9f5c1);})[_0x7bdb('0x42')](function(_0x52158e){_0x5da819[_0x7bdb('0x45')]=_0x52158e;return _0x5da819;})['then'](respondWithFilteredResult(_0x8f7672,_0x9f5c1))[_0x7bdb('0x46')](handleError(_0x8f7672,null));};exports[_0x7bdb('0x47')]=function(_0x218361,_0x264f3a){var _0x6b10d4={'raw':!![],'where':{'id':_0x218361[_0x7bdb('0x48')]['id']}},_0x375deb={};_0x375deb[_0x7bdb('0x37')]=_[_0x7bdb('0x34')](db['VoiceQueuesLog'][_0x7bdb('0x31')]);_0x375deb[_0x7bdb('0x33')]=_['keys'](_0x218361[_0x7bdb('0x33')]);_0x375deb['filters']=_[_0x7bdb('0x35')](_0x375deb[_0x7bdb('0x37')],_0x375deb[_0x7bdb('0x33')]);_0x6b10d4[_0x7bdb('0x36')]=_[_0x7bdb('0x35')](_0x375deb['model'],qs[_0x7bdb('0x38')](_0x218361[_0x7bdb('0x33')][_0x7bdb('0x38')]));_0x6b10d4[_0x7bdb('0x36')]=_0x6b10d4[_0x7bdb('0x36')]['length']?_0x6b10d4[_0x7bdb('0x36')]:_0x375deb[_0x7bdb('0x37')];if(_0x218361[_0x7bdb('0x33')][_0x7bdb('0x49')]){_0x6b10d4[_0x7bdb('0x43')]=[{'all':!![]}];}_0x6b10d4=_[_0x7bdb('0x28')]({},_0x6b10d4,_0x218361[_0x7bdb('0x4a')]);return db[_0x7bdb('0x30')][_0x7bdb('0x4b')](_0x6b10d4)[_0x7bdb('0x42')](handleEntityNotFound(_0x264f3a,null))['then'](respondWithResult(_0x264f3a,null))[_0x7bdb('0x46')](handleError(_0x264f3a,null));};exports['create']=function(_0x47cccd,_0x1a7cbf){return db[_0x7bdb('0x30')]['create'](_0x47cccd[_0x7bdb('0x29')],{})[_0x7bdb('0x42')](respondWithResult(_0x1a7cbf,0xc9))['catch'](handleError(_0x1a7cbf,null));};exports['update']=function(_0x4edd0d,_0x21b7a9){if(_0x4edd0d[_0x7bdb('0x29')]['id']){delete _0x4edd0d[_0x7bdb('0x29')]['id'];}return db[_0x7bdb('0x30')][_0x7bdb('0x4b')]({'where':{'id':_0x4edd0d[_0x7bdb('0x48')]['id']}})[_0x7bdb('0x42')](handleEntityNotFound(_0x21b7a9,null))[_0x7bdb('0x42')](saveUpdates(_0x4edd0d[_0x7bdb('0x29')],null))[_0x7bdb('0x42')](respondWithResult(_0x21b7a9,null))['catch'](handleError(_0x21b7a9,null));};exports[_0x7bdb('0x4c')]=function(_0x4806e0,_0x240425){return db[_0x7bdb('0x30')][_0x7bdb('0x4b')]({'where':{'id':_0x4806e0[_0x7bdb('0x48')]['id']}})['then'](handleEntityNotFound(_0x240425,null))[_0x7bdb('0x42')](removeEntity(_0x240425,null))['catch'](handleError(_0x240425,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 839c813..d7f7355 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 _0x4fbe=['moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api'];(function(_0x22c058,_0x37d408){var _0x337b6d=function(_0x1f4691){while(--_0x1f4691){_0x22c058['push'](_0x22c058['shift']());}};_0x337b6d(++_0x37d408);}(_0x4fbe,0x1a0));var _0xe4fb=function(_0x518511,_0x3053d1){_0x518511=_0x518511-0x0;var _0x4c024c=_0x4fbe[_0x518511];return _0x4c024c;};'use strict';var _=require(_0xe4fb('0x0'));var util=require(_0xe4fb('0x1'));var logger=require(_0xe4fb('0x2'))(_0xe4fb('0x3'));var moment=require(_0xe4fb('0x4'));var BPromise=require('bluebird');var rp=require(_0xe4fb('0x5'));var fs=require('fs');var path=require(_0xe4fb('0x6'));var rimraf=require(_0xe4fb('0x7'));var config=require(_0xe4fb('0x8'));var attributes=require(_0xe4fb('0x9'));module['exports']=function(_0x15e338,_0x444fcd){return _0x15e338['define'](_0xe4fb('0xa'),attributes,{'tableName':_0xe4fb('0xb'),'paranoid':![],'indexes':[{'name':_0xe4fb('0xc'),'fields':[_0xe4fb('0xd'),_0xe4fb('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5315=['./voiceQueuesLog.attributes','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x531355,_0x10737a){var _0x3f6f88=function(_0xb8b0eb){while(--_0xb8b0eb){_0x531355['push'](_0x531355['shift']());}};_0x3f6f88(++_0x10737a);}(_0x5315,0x1b9));var _0x5531=function(_0x50d315,_0x4babbc){_0x50d315=_0x50d315-0x0;var _0x431516=_0x5315[_0x50d315];return _0x431516;};'use strict';var _=require(_0x5531('0x0'));var util=require(_0x5531('0x1'));var logger=require(_0x5531('0x2'))('api');var moment=require(_0x5531('0x3'));var BPromise=require(_0x5531('0x4'));var rp=require(_0x5531('0x5'));var fs=require('fs');var path=require(_0x5531('0x6'));var rimraf=require(_0x5531('0x7'));var config=require(_0x5531('0x8'));var attributes=require(_0x5531('0x9'));module['exports']=function(_0x419919,_0x330a77){return _0x419919[_0x5531('0xa')](_0x5531('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x5531('0xc'),'fields':[_0x5531('0xd'),_0x5531('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index ac43682..9015c1a 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 _0xee4f=['VoiceQueuesLog,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','client','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4d501a,_0x293e79){var _0x22d3d2=function(_0x28756a){while(--_0x28756a){_0x4d501a['push'](_0x4d501a['shift']());}};_0x22d3d2(++_0x293e79);}(_0xee4f,0xad));var _0xfee4=function(_0x5b6bab,_0x3aecd4){_0x5b6bab=_0x5b6bab-0x0;var _0x26cbee=_0xee4f[_0x5b6bab];return _0x26cbee;};'use strict';var _=require(_0xfee4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfee4('0x1'));var rs=require(_0xfee4('0x2'));var fs=require('fs');var Redis=require(_0xfee4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfee4('0x4'));var logger=require('../../config/logger')(_0xfee4('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfee4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52fb6b,_0x2fb1b3,_0x16cc9a){return new BPromise(function(_0x34908a,_0x4d3c71){return client['request'](_0x52fb6b,_0x16cc9a)[_0xfee4('0x7')](function(_0x11556d){logger[_0xfee4('0x8')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2fb1b3,'request\x20sent');logger[_0xfee4('0x9')](_0xfee4('0xa'),_0x2fb1b3,_0xfee4('0xb'),JSON['stringify'](_0x11556d));if(_0x11556d[_0xfee4('0xc')]){if(_0x11556d[_0xfee4('0xc')][_0xfee4('0xd')]===0x1f4){logger[_0xfee4('0xc')](_0xfee4('0xe'),_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x4d3c71(_0x11556d['error'][_0xfee4('0xf')]);}logger[_0xfee4('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x34908a(_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);}else{logger[_0xfee4('0x8')](_0xfee4('0xe'),_0x2fb1b3,_0xfee4('0xb'));_0x34908a(_0x11556d['result'][_0xfee4('0xf')]);}})[_0xfee4('0x10')](function(_0x437979){logger['error'](_0xfee4('0xe'),_0x2fb1b3,_0x437979);_0x4d3c71(_0x437979);});});} \ No newline at end of file +var _0x263f=['client','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x263f,0x182));var _0xf263=function(_0x19b392,_0x1df894){_0x19b392=_0x19b392-0x0;var _0x29a9f4=_0x263f[_0x19b392];return _0x29a9f4;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var moment=require(_0xf263('0x2'));var BPromise=require(_0xf263('0x3'));var rs=require(_0xf263('0x4'));var fs=require('fs');var Redis=require(_0xf263('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf263('0x6'));var logger=require(_0xf263('0x7'))(_0xf263('0x8'));var config=require('../../config/environment');var jayson=require(_0xf263('0x9'));var client=jayson[_0xf263('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fded6,_0xa2b1b0,_0x9644ab){return new BPromise(function(_0xa2e77e,_0x16ff53){return client['request'](_0x4fded6,_0x9644ab)[_0xf263('0xb')](function(_0x26504c){logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));logger[_0xf263('0xf')](_0xf263('0x10'),_0xa2b1b0,'request\x20sent',JSON[_0xf263('0x11')](_0x26504c));if(_0x26504c['error']){if(_0x26504c[_0xf263('0x12')]['code']===0x1f4){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);return _0x16ff53(_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);}logger[_0xf263('0x12')](_0xf263('0xd'),_0xa2b1b0,_0x26504c['error'][_0xf263('0x13')]);return _0xa2e77e(_0x26504c['error'][_0xf263('0x13')]);}else{logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));_0xa2e77e(_0x26504c[_0xf263('0x14')][_0xf263('0x13')]);}})[_0xf263('0x15')](function(_0x57c655){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x57c655);_0x16ff53(_0x57c655);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c12b813..2c15bd1 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 _0x8cd6=['/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x56e58a,_0x1e2274){var _0x3866a4=function(_0x35dde0){while(--_0x35dde0){_0x56e58a['push'](_0x56e58a['shift']());}};_0x3866a4(++_0x1e2274);}(_0x8cd6,0x187));var _0x68cd=function(_0x4d59d5,_0x1e53ca){_0x4d59d5=_0x4d59d5-0x0;var _0x258aa3=_0x8cd6[_0x4d59d5];return _0x258aa3;};'use strict';var multer=require(_0x68cd('0x0'));var util=require(_0x68cd('0x1'));var path=require(_0x68cd('0x2'));var timeout=require(_0x68cd('0x3'));var express=require(_0x68cd('0x4'));var router=express[_0x68cd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x68cd('0x6'));var interaction=require(_0x68cd('0x7'));var config=require(_0x68cd('0x8'));var controller=require(_0x68cd('0x9'));router[_0x68cd('0xa')]('/',auth[_0x68cd('0xb')](),controller[_0x68cd('0xc')]);router[_0x68cd('0xa')](_0x68cd('0xd'),auth[_0x68cd('0xb')](),controller[_0x68cd('0xe')]);router[_0x68cd('0xa')](_0x68cd('0xf'),auth['isAuthenticated'](),controller[_0x68cd('0x10')]);router[_0x68cd('0xa')](_0x68cd('0x11'),auth[_0x68cd('0xb')](),controller[_0x68cd('0x12')]);router[_0x68cd('0xa')](_0x68cd('0x13'),controller[_0x68cd('0x14')]);router['get'](_0x68cd('0x15'),auth[_0x68cd('0xb')](),controller['downloadTranscribe']);router[_0x68cd('0x16')]('/',auth[_0x68cd('0xb')](),controller[_0x68cd('0x17')]);router[_0x68cd('0x16')]('/:id/transcribe',auth[_0x68cd('0xb')](),controller[_0x68cd('0x18')]);router[_0x68cd('0x19')](_0x68cd('0xf'),auth['isAuthenticated'](),controller[_0x68cd('0x1a')]);router[_0x68cd('0x1b')](_0x68cd('0xf'),auth[_0x68cd('0xb')](),controller[_0x68cd('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xdb06=['update','delete','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','/:id'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xdb06,0x1b3));var _0x6db0=function(_0x4d806f,_0xd136ca){_0x4d806f=_0x4d806f-0x0;var _0x2eab66=_0xdb06[_0x4d806f];return _0x2eab66;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6db0('0x0'));var timeout=require(_0x6db0('0x1'));var express=require('express');var router=express[_0x6db0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6db0('0x3'));var interaction=require(_0x6db0('0x4'));var config=require(_0x6db0('0x5'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x6db0('0x6')](),controller[_0x6db0('0x7')]);router[_0x6db0('0x8')](_0x6db0('0x9'),auth[_0x6db0('0x6')](),controller['describe']);router[_0x6db0('0x8')]('/:id',auth[_0x6db0('0x6')](),controller[_0x6db0('0xa')]);router[_0x6db0('0x8')](_0x6db0('0xb'),auth['isAuthenticated'](),controller[_0x6db0('0xc')]);router['get'](_0x6db0('0xd'),controller[_0x6db0('0xe')]);router[_0x6db0('0x8')](_0x6db0('0xf'),auth[_0x6db0('0x6')](),controller[_0x6db0('0x10')]);router[_0x6db0('0x11')]('/',auth[_0x6db0('0x6')](),controller[_0x6db0('0x12')]);router[_0x6db0('0x11')]('/:id/transcribe',auth[_0x6db0('0x6')](),controller[_0x6db0('0x13')]);router['put'](_0x6db0('0x14'),auth['isAuthenticated'](),controller[_0x6db0('0x15')]);router[_0x6db0('0x16')](_0x6db0('0x14'),auth[_0x6db0('0x6')](),controller['destroy']);module[_0x6db0('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5ee6a2e..2b99036 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 _0x01bc=['TEXT','NEW','FLOAT','BOOLEAN','DATE','getDataValue','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','value','STRING','setDataValue','INTEGER'];(function(_0xef46b4,_0x2308c5){var _0x1ced71=function(_0x5261ff){while(--_0x5261ff){_0xef46b4['push'](_0xef46b4['shift']());}};_0x1ced71(++_0x2308c5);}(_0x01bc,0x1d7));var _0xc01b=function(_0x25146b,_0x5cfdd9){_0x25146b=_0x25146b-0x0;var _0x3d7bb0=_0x01bc[_0x25146b];return _0x3d7bb0;};'use strict';var Sequelize=require(_0xc01b('0x0'));var moment=require(_0xc01b('0x1'));var path=require(_0xc01b('0x2'));module[_0xc01b('0x3')]={'format':{'type':Sequelize[_0xc01b('0x4')],'get':function(){return this['getDataValue'](_0xc01b('0x5'))?path['extname'](this['getDataValue'](_0xc01b('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xc01b('0x6')]},'channel':{'type':Sequelize[_0xc01b('0x6')],'set':function(_0x493314){if(_0x493314){this[_0xc01b('0x7')]('channel',_0x493314);this[_0xc01b('0x7')]('membername',_0x493314['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xc01b('0x6')]},'calleridnum':{'type':Sequelize[_0xc01b('0x6')]},'calleridname':{'type':Sequelize[_0xc01b('0x6')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc01b('0x6')]},'accountcode':{'type':Sequelize[_0xc01b('0x6')]},'context':{'type':Sequelize[_0xc01b('0x6')]},'exten':{'type':Sequelize[_0xc01b('0x6')]},'value':{'type':Sequelize[_0xc01b('0x6')]},'type':{'type':Sequelize[_0xc01b('0x6')]},'rating':{'type':Sequelize[_0xc01b('0x8')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xc01b('0x6')]},'userSecondDisposition':{'type':Sequelize[_0xc01b('0x6')]},'userThirdDisposition':{'type':Sequelize[_0xc01b('0x6')]},'location':{'type':Sequelize[_0xc01b('0x9')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0xc01b('0x6')],'defaultValue':_0xc01b('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0xc01b('0x9')]},'sentiment':{'type':Sequelize[_0xc01b('0x6')]},'sPositive':{'type':Sequelize[_0xc01b('0xb')]},'sNegative':{'type':Sequelize[_0xc01b('0xb')]},'sNeutral':{'type':Sequelize[_0xc01b('0xb')]},'sMixed':{'type':Sequelize[_0xc01b('0xb')]},'tempSentiment':{'type':Sequelize[_0xc01b('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xc01b('0xd')],'get':function(){return moment(this[_0xc01b('0xe')](_0xc01b('0xf')))[_0xc01b('0x10')](_0xc01b('0x11'))[_0xc01b('0x12')]();}},'updatedAt':{'type':Sequelize[_0xc01b('0xd')],'get':function(){return moment(this[_0xc01b('0xe')](_0xc01b('0x13')))[_0xc01b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xc01b('0x12')]();}}}; \ No newline at end of file +var _0x8099=['value','extname','STRING','setDataValue','membername','split','INTEGER','TEXT','FLOAT','BOOLEAN','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','path','exports','getDataValue'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x8099,0x177));var _0x9809=function(_0x262c8e,_0x4deb4a){_0x262c8e=_0x262c8e-0x0;var _0x573957=_0x8099[_0x262c8e];return _0x573957;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x9809('0x0'));module[_0x9809('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9809('0x2')](_0x9809('0x3'))?path[_0x9809('0x4')](this[_0x9809('0x2')](_0x9809('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0x9809('0x5')]},'channel':{'type':Sequelize[_0x9809('0x5')],'set':function(_0x3dc62f){if(_0x3dc62f){this[_0x9809('0x6')]('channel',_0x3dc62f);this[_0x9809('0x6')](_0x9809('0x7'),_0x3dc62f[_0x9809('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x9809('0x5')]},'calleridnum':{'type':Sequelize[_0x9809('0x5')]},'calleridname':{'type':Sequelize[_0x9809('0x5')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9809('0x5')]},'accountcode':{'type':Sequelize[_0x9809('0x5')]},'context':{'type':Sequelize[_0x9809('0x5')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9809('0x5')]},'rating':{'type':Sequelize[_0x9809('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x9809('0x5')]},'userDisposition':{'type':Sequelize[_0x9809('0x5')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x9809('0x5')]},'location':{'type':Sequelize[_0x9809('0xa')]},'transcribeName':{'type':Sequelize[_0x9809('0x5')]},'transcribeStatus':{'type':Sequelize[_0x9809('0x5')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x9809('0xa')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x9809('0xa')]},'sentiment':{'type':Sequelize[_0x9809('0x5')]},'sPositive':{'type':Sequelize[_0x9809('0xb')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x9809('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x9809('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x9809('0xd')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x9809('0xe')](_0x9809('0xf'))[_0x9809('0x10')]();}},'updatedAt':{'type':Sequelize[_0x9809('0xd')],'get':function(){return moment(this[_0x9809('0x2')](_0x9809('0x11')))['format'](_0x9809('0xf'))[_0x9809('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 83be7fe..a06aeae 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 _0x9f15=['info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','bucket','Bucket','location','Location','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','message','agent','interaction','account','index','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','describe','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','download','Not\x20found','downloads','sequelize','col','token','$and','push','secrets','recording','Entity\x20not\x20found'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x9f15,0x16e));var _0x59f1=function(_0x44ca6e,_0x5e2c91){_0x44ca6e=_0x44ca6e-0x0;var _0x2edab2=_0x9f15[_0x44ca6e];return _0x2edab2;};'use strict';var emlformat=require(_0x59f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59f1('0x1'));var jsonpatch=require(_0x59f1('0x2'));var rp=require(_0x59f1('0x3'));var moment=require('moment');var BPromise=require(_0x59f1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x59f1('0x5'));var sox=require('sox');var csv=require(_0x59f1('0x6'));var ejs=require(_0x59f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59f1('0x8'));var squel=require(_0x59f1('0x9'));var crypto=require(_0x59f1('0xa'));var jsforce=require(_0x59f1('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x59f1('0xc'));var Papa=require(_0x59f1('0xd'));var AWS=require(_0x59f1('0xe'));var uuidv4=require(_0x59f1('0xf'));var Redis=require(_0x59f1('0x10'));var authService=require(_0x59f1('0x11'));var qs=require(_0x59f1('0x12'));var as=require(_0x59f1('0x13'));var hardwareService=require(_0x59f1('0x14'));var logger=require('../../config/logger')(_0x59f1('0x15'));var utils=require(_0x59f1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x59f1('0x17'));var db=require(_0x59f1('0x18'))['db'];function respondWithStatusCode(_0x5541eb,_0x552ec2){_0x552ec2=_0x552ec2||0xcc;return function(_0x46bf82){if(_0x46bf82){return _0x5541eb[_0x59f1('0x19')](_0x552ec2);}return _0x5541eb[_0x59f1('0x1a')](_0x552ec2)[_0x59f1('0x1b')]();};}function respondWithResult(_0x120023,_0x1a7b01){_0x1a7b01=_0x1a7b01||0xc8;return function(_0x3b753d){if(_0x3b753d){return _0x120023[_0x59f1('0x1a')](_0x1a7b01)[_0x59f1('0x1c')](_0x3b753d);}};}function respondWithFilteredResult(_0x26c8c0,_0x4546d8){return function(_0x2e0612){if(_0x2e0612){var _0x19c75d=typeof _0x4546d8[_0x59f1('0x1d')]===_0x59f1('0x1e')&&typeof _0x4546d8[_0x59f1('0x1f')]===_0x59f1('0x1e');var _0x2fa856=_0x2e0612[_0x59f1('0x20')];var _0x15674a=_0x19c75d?0x0:_0x4546d8[_0x59f1('0x1d')];var _0x1458f4=_0x19c75d?_0x2e0612[_0x59f1('0x20')]:_0x4546d8[_0x59f1('0x1d')]+_0x4546d8[_0x59f1('0x1f')];var _0x1c5d97;if(_0x1458f4>=_0x2fa856){_0x1458f4=_0x2fa856;_0x1c5d97=0xc8;}else{_0x1c5d97=0xce;}_0x26c8c0[_0x59f1('0x1a')](_0x1c5d97);return _0x26c8c0[_0x59f1('0x21')](_0x59f1('0x22'),_0x15674a+'-'+_0x1458f4+'/'+_0x2fa856)[_0x59f1('0x1c')](_0x2e0612);}return null;};}function patchUpdates(_0x19fe3a){return function(_0x42ac33){try{jsonpatch['apply'](_0x42ac33,_0x19fe3a,!![]);}catch(_0x4e1fe9){return BPromise[_0x59f1('0x23')](_0x4e1fe9);}return _0x42ac33[_0x59f1('0x24')]();};}function saveUpdates(_0x439cb2,_0x1862b3){return function(_0x597c1c){if(_0x597c1c){return _0x597c1c[_0x59f1('0x25')](_0x439cb2)[_0x59f1('0x26')](function(_0x4477f9){return _0x4477f9;});}return null;};}function removeEntity(_0x5c7f6a,_0x11fd22){return function(_0x5c9525){if(_0x5c9525){return _0x5c9525[_0x59f1('0x27')]()[_0x59f1('0x26')](function(){_0x5c7f6a[_0x59f1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d537a,_0x1df61c){return function(_0x3e1087){if(!_0x3e1087){_0x2d537a[_0x59f1('0x19')](0x194);}return _0x3e1087;};}function handleError(_0x1b4831,_0x31e7e6){_0x31e7e6=_0x31e7e6||0x1f4;return function(_0x28a11c){logger[_0x59f1('0x28')](_0x28a11c[_0x59f1('0x29')]);if(_0x28a11c[_0x59f1('0x2a')]){delete _0x28a11c[_0x59f1('0x2a')];}_0x1b4831[_0x59f1('0x1a')](_0x31e7e6)[_0x59f1('0x2b')](_0x28a11c);};}function getMustacheRender(_0x508606,_0x56adb6){return Mustache[_0x59f1('0x2c')](_0x508606,_[_0x59f1('0x2d')](_0x56adb6[_0x59f1('0x2e')],{'contact':_0x56adb6['contact'],'message':_0x56adb6[_0x59f1('0x2f')],'agent':_0x56adb6[_0x59f1('0x30')],'interaction':_0x56adb6[_0x59f1('0x31')],'account':_0x56adb6[_0x59f1('0x32')]}))||'';}exports[_0x59f1('0x33')]=function(_0x52697c,_0x473b63){var _0x331abd={},_0x2e3e39={},_0x4c614e={'count':0x0,'rows':[]};var _0x1a223d=_['map'](db[_0x59f1('0x34')][_0x59f1('0x35')],function(_0x3f395c){return{'name':_0x3f395c[_0x59f1('0x36')],'type':_0x3f395c[_0x59f1('0x37')]['key']};});_0x2e3e39[_0x59f1('0x38')]=_[_0x59f1('0x39')](_['map'](_0x1a223d,_0x59f1('0x2a')),[_0x59f1('0x3a')]);_0x2e3e39[_0x59f1('0x3b')]=_[_0x59f1('0x3c')](_0x52697c[_0x59f1('0x3b')]);_0x2e3e39['filters']=_[_0x59f1('0x3d')](_0x2e3e39[_0x59f1('0x38')],_0x2e3e39['query']);_0x331abd[_0x59f1('0x3e')]=_[_0x59f1('0x3d')](_0x2e3e39[_0x59f1('0x38')],qs[_0x59f1('0x3f')](_0x52697c[_0x59f1('0x3b')][_0x59f1('0x3f')]));_0x331abd['attributes']=_0x331abd[_0x59f1('0x3e')][_0x59f1('0x40')]?_0x331abd['attributes']:_0x2e3e39[_0x59f1('0x38')];if(!_0x52697c[_0x59f1('0x3b')][_0x59f1('0x41')](_0x59f1('0x42'))){_0x331abd['limit']=qs[_0x59f1('0x1f')](_0x52697c[_0x59f1('0x3b')][_0x59f1('0x1f')]);_0x331abd[_0x59f1('0x1d')]=qs[_0x59f1('0x1d')](_0x52697c[_0x59f1('0x3b')][_0x59f1('0x1d')]);}_0x331abd['order']=qs['sort'](_0x52697c['query']['sort']);_0x331abd[_0x59f1('0x43')]=qs[_0x59f1('0x44')](_[_0x59f1('0x45')](_0x52697c[_0x59f1('0x3b')],_0x2e3e39[_0x59f1('0x44')]),_0x1a223d);if(_0x52697c['query'][_0x59f1('0x46')]){_0x331abd[_0x59f1('0x43')]=_[_0x59f1('0x2d')](_0x331abd[_0x59f1('0x43')],{'$or':_['map'](_0x1a223d,function(_0x4846ff){if(_0x4846ff[_0x59f1('0x37')]!==_0x59f1('0x47')){var _0x2d9620={};_0x2d9620[_0x4846ff[_0x59f1('0x2a')]]={'$like':'%'+_0x52697c[_0x59f1('0x3b')][_0x59f1('0x46')]+'%'};return _0x2d9620;}})});}_0x331abd=_['merge']({},_0x331abd,_0x52697c[_0x59f1('0x48')]);var _0x220793={'where':_0x331abd[_0x59f1('0x43')]};return db['VoiceRecording'][_0x59f1('0x20')](_0x220793)[_0x59f1('0x26')](function(_0x5a1f1e){_0x4c614e[_0x59f1('0x20')]=_0x5a1f1e;if(_0x52697c[_0x59f1('0x3b')][_0x59f1('0x49')]){_0x331abd[_0x59f1('0x4a')]=[{'all':!![]}];}return db[_0x59f1('0x34')]['findAll'](_0x331abd);})['then'](function(_0x360566){_0x4c614e[_0x59f1('0x4b')]=_0x360566;return _0x4c614e;})[_0x59f1('0x26')](respondWithFilteredResult(_0x473b63,_0x331abd))[_0x59f1('0x4c')](handleError(_0x473b63,null));};exports[_0x59f1('0x4d')]=function(_0x48cb23,_0x145886){var _0x5473bf={'raw':![],'where':{'id':_0x48cb23['params']['id']}},_0x3ecbd6={};_0x3ecbd6[_0x59f1('0x38')]=_['keys'](db['VoiceRecording'][_0x59f1('0x35')]);_0x3ecbd6[_0x59f1('0x3b')]=_[_0x59f1('0x3c')](_0x48cb23[_0x59f1('0x3b')]);_0x3ecbd6['filters']=_['intersection'](_0x3ecbd6['model'],_0x3ecbd6['query']);_0x5473bf[_0x59f1('0x3e')]=_[_0x59f1('0x3d')](_0x3ecbd6[_0x59f1('0x38')],qs[_0x59f1('0x3f')](_0x48cb23[_0x59f1('0x3b')][_0x59f1('0x3f')]));_0x5473bf[_0x59f1('0x3e')]=_0x5473bf[_0x59f1('0x3e')][_0x59f1('0x40')]?_0x5473bf[_0x59f1('0x3e')]:_0x3ecbd6[_0x59f1('0x38')];if(_0x48cb23[_0x59f1('0x3b')][_0x59f1('0x49')]){_0x5473bf[_0x59f1('0x4a')]=[{'all':!![]}];}_0x5473bf=_[_0x59f1('0x2d')]({},_0x5473bf,_0x48cb23[_0x59f1('0x48')]);return db[_0x59f1('0x34')][_0x59f1('0x4e')](_0x5473bf)[_0x59f1('0x26')](handleEntityNotFound(_0x145886,null))[_0x59f1('0x26')](respondWithResult(_0x145886,null))[_0x59f1('0x4c')](handleError(_0x145886,null));};exports[_0x59f1('0x4f')]=function(_0x4f556a,_0xea2029){return db['VoiceRecording'][_0x59f1('0x4f')](_0x4f556a[_0x59f1('0x2e')],{})[_0x59f1('0x26')](respondWithResult(_0xea2029,0xc9))['catch'](handleError(_0xea2029,null));};exports['update']=function(_0x22e3ff,_0x38d238){if(_0x22e3ff[_0x59f1('0x2e')]['id']){delete _0x22e3ff[_0x59f1('0x2e')]['id'];}return db[_0x59f1('0x34')][_0x59f1('0x4e')]({'where':{'id':_0x22e3ff['params']['id']}})[_0x59f1('0x26')](handleEntityNotFound(_0x38d238,null))[_0x59f1('0x26')](saveUpdates(_0x22e3ff[_0x59f1('0x2e')],null))['then'](respondWithResult(_0x38d238,null))['catch'](handleError(_0x38d238,null));};exports[_0x59f1('0x50')]=function(_0x37b417,_0x2adc11){return db[_0x59f1('0x34')][_0x59f1('0x50')]()[_0x59f1('0x26')](respondWithResult(_0x2adc11,null))[_0x59f1('0x4c')](handleError(_0x2adc11,null));};exports['download']=function(_0x305c85,_0x75f5ed,_0x409eea){var _0x2c0af2=require(_0x59f1('0x51'));var _0x32553b=![];var _0x556b7b={};if(_0x305c85[_0x59f1('0x3b')][_0x59f1('0x37')]&&_0x305c85[_0x59f1('0x3b')][_0x59f1('0x37')]===_0x59f1('0x52')){_0x556b7b[_0x59f1('0x52')]=_0x305c85[_0x59f1('0x53')]['id'];}else{_0x556b7b['id']=_0x305c85[_0x59f1('0x53')]['id'];}return db['VoiceRecording']['find']({'where':_0x556b7b,'attributes':['id',_0x59f1('0x54')],'raw':!![]})[_0x59f1('0x26')](handleEntityNotFound(_0x75f5ed,null))[_0x59f1('0x26')](function(_0x55525e){if(_0x55525e){var _0x10d906=_0x55525e[_0x59f1('0x54')];var _0x2b87d1=util[_0x59f1('0x3a')](_0x59f1('0x55'),_0x10d906);if(fs[_0x59f1('0x56')](_0x2b87d1)){_0x32553b=!![];return _0x2c0af2[_0x59f1('0x57')](_0x2b87d1,_0x10d906,config['secrets']['recording'])[_0x59f1('0x26')](function(){return _0x55525e;});}return _0x55525e;}})[_0x59f1('0x26')](function(_0x265d5e){if(_0x265d5e){var _0x2fa948=_0x265d5e[_0x59f1('0x54')];if(!fs['existsSync'](_0x2fa948)){throw new db[(_0x59f1('0x58'))][(_0x59f1('0x59'))](_0x59f1('0x5a'));}if(_0x265d5e[_0x59f1('0x5b')]){return _0x75f5ed['download'](_0x2fa948,_0x265d5e[_0x59f1('0x5b')]+path[_0x59f1('0x5c')](_0x2fa948),function(){if(_0x32553b){fs[_0x59f1('0x5d')](_0x2fa948);}});}else{return _0x75f5ed[_0x59f1('0x5e')](_0x2fa948,function(_0x403eae){if(_0x32553b){fs[_0x59f1('0x5d')](_0x2fa948);}});}}})['catch'](function(_0xa3b928){if(_0xa3b928[_0x59f1('0x2f')]===_0x59f1('0x5a')){_0x75f5ed['status'](0x194)[_0x59f1('0x2b')](_0x59f1('0x5f'));}else{return handleError(_0x75f5ed,null);}});};exports[_0x59f1('0x60')]=function(_0x508e40,_0x40c8ca,_0x39a0d2){var _0x2a631e=require(_0x59f1('0x51'));var _0x233d1b=![];var _0x437f4f={'$and':[db[_0x59f1('0x61')][_0x59f1('0x43')](db[_0x59f1('0x61')]['fn']('MD5',db[_0x59f1('0x61')][_0x59f1('0x62')](_0x59f1('0x52'))),_0x508e40['query'][_0x59f1('0x63')])]};if(_0x508e40['query'][_0x59f1('0x37')]&&_0x508e40[_0x59f1('0x3b')]['type']===_0x59f1('0x52')){_0x437f4f[_0x59f1('0x64')][_0x59f1('0x65')]({'uniqueid':_0x508e40['params']['id']});}else{_0x437f4f['$and'][_0x59f1('0x65')]({'id':_0x508e40[_0x59f1('0x53')]['id']});}return db[_0x59f1('0x34')][_0x59f1('0x4e')]({'where':_0x437f4f,'attributes':['id',_0x59f1('0x54')],'raw':!![]})[_0x59f1('0x26')](handleEntityNotFound(_0x40c8ca,null))[_0x59f1('0x26')](function(_0x4050af){if(_0x4050af){var _0x55b688=util['format'](_0x59f1('0x55'),_0x4050af[_0x59f1('0x54')]);if(fs[_0x59f1('0x56')](_0x55b688)){_0x233d1b=!![];return _0x2a631e['decryptFile'](_0x55b688,_0x4050af[_0x59f1('0x54')],config[_0x59f1('0x66')][_0x59f1('0x67')])[_0x59f1('0x26')](function(){return _0x4050af;});}return _0x4050af;}})['then'](function(_0x1b3921){if(_0x1b3921){if(!fs['existsSync'](_0x1b3921[_0x59f1('0x54')])){throw new db[(_0x59f1('0x58'))][(_0x59f1('0x59'))](_0x59f1('0x5a'));}if(_0x1b3921[_0x59f1('0x5b')]){return _0x40c8ca[_0x59f1('0x5e')](_0x1b3921[_0x59f1('0x54')],_0x1b3921[_0x59f1('0x5b')]+path[_0x59f1('0x5c')](_0x1b3921[_0x59f1('0x54')]),function(){if(_0x233d1b){fs[_0x59f1('0x5d')](_0x1b3921[_0x59f1('0x54')]);}});}else{return _0x40c8ca[_0x59f1('0x5e')](_0x1b3921[_0x59f1('0x54')],function(_0x227b1f){if(_0x233d1b){fs[_0x59f1('0x5d')](_0x1b3921[_0x59f1('0x54')]);}});}}})[_0x59f1('0x4c')](handleError(_0x40c8ca,null));};exports[_0x59f1('0x27')]=function(_0x3fa305,_0x29c629){return db[_0x59f1('0x34')][_0x59f1('0x4e')]({'where':{'id':_0x3fa305[_0x59f1('0x53')]['id']}})[_0x59f1('0x26')](function(_0x36597e){if(_['isNil'](_0x36597e)){throw new ReferenceError(_0x59f1('0x68'));}return _0x36597e;})['then'](function(_0x4d2608){var _0x1e192e=_0x4d2608[_0x59f1('0x54')];logger[_0x59f1('0x69')](_0x59f1('0x6a'),_0x1e192e);if(!_['isNil'](_0x4d2608[_0x59f1('0x54')])&&fs[_0x59f1('0x56')](_0x1e192e)){logger[_0x59f1('0x69')](_0x59f1('0x6b')+_0x1e192e+_0x59f1('0x6c'));fs[_0x59f1('0x6d')](_0x1e192e);}_0x1e192e=_0x1e192e+_0x59f1('0x6e');if(!_[_0x59f1('0x6f')](_0x4d2608['value'])&&fs[_0x59f1('0x56')](_0x1e192e)){logger['info'](_0x59f1('0x6b')+_0x1e192e+_0x59f1('0x6c'));fs['unlinkSync'](_0x1e192e);}return _0x4d2608;})[_0x59f1('0x26')](function(_0x18cdfd){if(!_0x18cdfd)throw new InternalError();return _0x18cdfd[_0x59f1('0x27')]();})[_0x59f1('0x26')](function(){_0x29c629[_0x59f1('0x1a')](0xcc)[_0x59f1('0x1b')]();})[_0x59f1('0x4c')](handleError(_0x29c629,null));};function getBucketslist(_0x8d800e,_0x54da6a,_0x50d227){return new Promise(function(_0x464498,_0x17a654){var _0x43a21f=new AWS['S3']({'accessKeyId':_0x54da6a,'secretAccessKey':_0x8d800e,'region':_0x50d227});_0x43a21f[_0x59f1('0x70')]({},function(_0x23ad3f,_0x23a7e8){if(_0x23ad3f){return _0x17a654(_0x23ad3f);}else{return _0x464498(_0x23a7e8);}});});}function createBucket(_0xeeff15,_0x1fadd1,_0x2e76b7,_0x5222cc){return new Promise(function(_0x513855,_0x3a7056){var _0x3f7958=new AWS['S3']({'accessKeyId':_0x1fadd1,'secretAccessKey':_0xeeff15,'region':_0x2e76b7});_0x3f7958[_0x59f1('0x71')]({'Bucket':_0x5222cc},function(_0x2b9a4f,_0x3ae342){if(_0x2b9a4f){return _0x3a7056(_0x2b9a4f);}else{return _0x513855(_0x3ae342);}});});}function uploadFile(_0x3951f2,_0x4c1d8b,_0xff116d,_0x4c713f,_0x1a1bf7,_0x2180e8){return new Promise(function(_0x3c9e21,_0x40e767){var _0xec2b13=new AWS['S3']({'accessKeyId':_0x4c1d8b,'secretAccessKey':_0x3951f2,'region':_0xff116d});_0xec2b13[_0x59f1('0x72')]({'Bucket':_0x4c713f,'Key':_0x1a1bf7,'Body':_0x2180e8},function(_0x230442,_0x4cd54b){if(_0x230442){return _0x40e767(_0x230442);}else{return _0x3c9e21(_0x4cd54b);}});});}function startTranscribe(_0x536b62,_0x4f0b9d,_0x5c9851,_0x38fb34,_0x5cb5ec,_0x9d011d){return new Promise(function(_0x462284,_0x2c12cb){var _0x69668a=new AWS[(_0x59f1('0x73'))]({'accessKeyId':_0x4f0b9d,'secretAccessKey':_0x536b62,'region':_0x5c9851});_0x69668a['startTranscriptionJob']({'TranscriptionJobName':_0x38fb34,'LanguageCode':_0x5cb5ec,'Media':{'MediaFileUri':_0x9d011d}},function(_0x41c132,_0x12854b){if(_0x41c132){return _0x2c12cb(_0x41c132);}else{return _0x462284(_0x12854b);}});});}function transcribe(_0x37dad5,_0x2627e1,_0x1c80d2,_0x36bc3a,_0x3bdc29,_0x3daf6f,_0x58316c){return new Promise(function(_0x105516,_0x2bbfe8){var _0x52234b={};logger['info'](util[_0x59f1('0x3a')](_0x59f1('0x74'),_0x37dad5,_0x3bdc29));return uploadFile(_0x2627e1,_0x1c80d2,_0x36bc3a,_0x3bdc29,path[_0x59f1('0x75')](_0x3daf6f),fs[_0x59f1('0x76')](_0x3daf6f))[_0x59f1('0x26')](function(_0x549469){logger[_0x59f1('0x69')](util[_0x59f1('0x3a')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x37dad5,_0x3bdc29,_0x549469['Location']));_0x52234b[_0x59f1('0x77')]=_0x549469[_0x59f1('0x78')];_0x52234b[_0x59f1('0x79')]=_0x549469[_0x59f1('0x7a')];logger['info'](util[_0x59f1('0x3a')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x37dad5));return startTranscribe(_0x2627e1,_0x1c80d2,_0x36bc3a,uuidv4(),_0x58316c,_0x549469[_0x59f1('0x7a')]);})[_0x59f1('0x26')](function(_0x95b40f){logger[_0x59f1('0x69')](util[_0x59f1('0x3a')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x37dad5,_0x95b40f[_0x59f1('0x7b')][_0x59f1('0x7c')]));_0x52234b[_0x59f1('0x7d')]=_0x95b40f[_0x59f1('0x7b')][_0x59f1('0x7c')];_0x52234b['transcribeStatus']=_0x95b40f[_0x59f1('0x7b')][_0x59f1('0x7e')];return _0x105516(_0x52234b);})[_0x59f1('0x4c')](function(_0x3b5f80){return _0x2bbfe8(_0x3b5f80);});});}exports['runTranscribe']=function(_0x112eb2,_0x26c64f,_0x3d8083){var _0xb4600d;var _0x59ee9a;var _0x26710f;var _0x5eb2c8=require(_0x59f1('0x51'));return db['VoiceRecording'][_0x59f1('0x7f')]({'where':{'id':_0x112eb2[_0x59f1('0x53')]['id']}})[_0x59f1('0x26')](function(_0x1ca2a9){if(_0x1ca2a9){var _0x35c086=util[_0x59f1('0x3a')](_0x59f1('0x55'),_0x1ca2a9[_0x59f1('0x54')]);if(fs['existsSync'](_0x35c086)){cypher=!![];return _0x5eb2c8[_0x59f1('0x57')](_0x35c086,_0x1ca2a9[_0x59f1('0x54')],config[_0x59f1('0x66')][_0x59f1('0x67')])[_0x59f1('0x26')](function(){return _0x1ca2a9;});}return _0x1ca2a9;}})[_0x59f1('0x26')](function(_0x5f55cf){if(!_0x5f55cf){throw new db[(_0x59f1('0x58'))][(_0x59f1('0x59'))](_0x59f1('0x80'));}_0x59ee9a=_0x5f55cf;return db[_0x59f1('0x81')][_0x59f1('0x7f')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x26c64f,null))[_0x59f1('0x26')](function(_0x38c0e5){if(_0x38c0e5){_0xb4600d=_0x38c0e5;if(!_0xb4600d[_0x59f1('0x82')]||!_0xb4600d['transcribeAccountId']||!_0xb4600d[_0x59f1('0x83')]||!_0xb4600d[_0x59f1('0x84')]||!_0xb4600d['bucket']){throw new db[(_0x59f1('0x58'))]['ValidationError'](_0x59f1('0x85'));}if(_0x112eb2[_0x59f1('0x2e')][_0x59f1('0x86')]&&(!_0xb4600d['sentiment']||!_0xb4600d[_0x59f1('0x87')]||!_0xb4600d[_0x59f1('0x88')]||!_0xb4600d[_0x59f1('0x84')]||!_0xb4600d[_0x59f1('0x77')])){throw new db['Sequelize'][(_0x59f1('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x59f1('0x89')][_0x59f1('0x7f')]({'where':{'id':_0xb4600d[_0x59f1('0x8a')]}});}})['then'](function(_0x55cf19){if(!_0x55cf19){throw new db[(_0x59f1('0x58'))][(_0x59f1('0x59'))](_0x59f1('0x8b'));}if(!_0x55cf19[_0x59f1('0x8c')]||!_0x55cf19[_0x59f1('0x8d')]){throw new db[(_0x59f1('0x58'))][(_0x59f1('0x59'))](_0x59f1('0x8e'));}_0x26710f=_0x55cf19;return getBucketslist(_0x26710f['data1'],_0x26710f[_0x59f1('0x8d')],_0xb4600d[_0x59f1('0x83')]);})['then'](function(_0xa3fb13){if(_0xa3fb13&&_0xa3fb13[_0x59f1('0x8f')]){var _0x3ddcdf=_[_0x59f1('0x4e')](_0xa3fb13[_0x59f1('0x8f')],function(_0x463c7d){return _0x463c7d[_0x59f1('0x90')]===_0xb4600d['bucket'];});if(!_0x3ddcdf){logger[_0x59f1('0x69')](util[_0x59f1('0x3a')](_0x59f1('0x91'),_0x112eb2[_0x59f1('0x53')]['id'],_0xb4600d[_0x59f1('0x77')]));return createBucket(_0x26710f[_0x59f1('0x8c')],_0x26710f[_0x59f1('0x8d')],_0xb4600d[_0x59f1('0x83')],_0xb4600d[_0x59f1('0x77')]);}logger[_0x59f1('0x69')](util[_0x59f1('0x3a')](_0x59f1('0x92'),_0x112eb2[_0x59f1('0x53')]['id'],_0xb4600d[_0x59f1('0x77')]));return;}})[_0x59f1('0x26')](function(_0x4f6ae9){if(_0x59ee9a[_0x59f1('0x93')]==='NEW'){return transcribe(_0x112eb2['params']['id'],_0x26710f[_0x59f1('0x8c')],_0x26710f[_0x59f1('0x8d')],_0xb4600d[_0x59f1('0x83')],_0xb4600d['bucket'],_0x59ee9a[_0x59f1('0x54')],_0xb4600d[_0x59f1('0x84')]);}else{logger['info'](util[_0x59f1('0x3a')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x112eb2['params']['id']));return{'transcribeStatus':_0x59f1('0x94')};}})[_0x59f1('0x26')](function(_0x8238c1){if(_0x8238c1){_0x8238c1[_0x59f1('0x95')]=_0x112eb2[_0x59f1('0x2e')][_0x59f1('0x86')];return _0x59ee9a['updateAttributes'](_0x8238c1);}})[_0x59f1('0x26')](respondWithResult(_0x26c64f,null))[_0x59f1('0x4c')](handleError(_0x26c64f,null));};function writeFile(_0x524fdb,_0x350649){return new Promise(function(_0x533cb8,_0x173d03){fs[_0x59f1('0x96')](_0x350649,_0x524fdb,function(_0x41be4a,_0x33e253){if(_0x41be4a){return _0x173d03(_0x41be4a);}else{return _0x533cb8(_0x33e253);}});});}exports[_0x59f1('0x97')]=function(_0x329b44,_0x2cb951,_0x29b7c8){return db[_0x59f1('0x34')][_0x59f1('0x7f')]({'where':{'id':_0x329b44[_0x59f1('0x53')]['id']}})[_0x59f1('0x26')](handleEntityNotFound(_0x2cb951))[_0x59f1('0x26')](function(_0x38e96a){if(_0x38e96a&&_0x38e96a[_0x59f1('0x98')]){var _0x5b2384=_0x38e96a['fileText'];var _0x77b283=config[_0x59f1('0x99')]+_0x59f1('0x9a')+_0x38e96a['id']+_0x59f1('0x9b');if(fs[_0x59f1('0x56')](_0x77b283)){return _0x77b283;}return writeFile(_0x5b2384,_0x77b283)['then'](function(){return _0x77b283;});}else{throw new db['Sequelize'][(_0x59f1('0x59'))](_0x59f1('0x9c'));}})[_0x59f1('0x26')](function(_0x34fae0){return _0x2cb951[_0x59f1('0x5e')](_0x34fae0);})[_0x59f1('0x4c')](handleError(_0x2cb951));}; \ No newline at end of file +var _0xa2a5=['download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','secrets','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','recording','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','render','merge','body','contact','agent','interaction','VoiceRecording','rawAttributes','type','key','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','find','catch','describe'];(function(_0x511c2c,_0x1ad32e){var _0x3b0420=function(_0x231c75){while(--_0x231c75){_0x511c2c['push'](_0x511c2c['shift']());}};_0x3b0420(++_0x1ad32e);}(_0xa2a5,0xe4));var _0x5a2a=function(_0x362207,_0x4d90cf){_0x362207=_0x362207-0x0;var _0x2e0a37=_0xa2a5[_0x362207];return _0x2e0a37;};'use strict';var emlformat=require(_0x5a2a('0x0'));var rimraf=require(_0x5a2a('0x1'));var zipdir=require(_0x5a2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5a2a('0x3'));var BPromise=require(_0x5a2a('0x4'));var Mustache=require(_0x5a2a('0x5'));var util=require('util');var path=require(_0x5a2a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5a2a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5a2a('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x5a2a('0x9'));var toCsv=require(_0x5a2a('0xa'));var querystring=require('querystring');var Papa=require(_0x5a2a('0xb'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x5a2a('0xc'));var authService=require(_0x5a2a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5a2a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a2a('0xf'))(_0x5a2a('0x10'));var utils=require('../../config/utils');var config=require(_0x5a2a('0x11'));var licenseUtil=require(_0x5a2a('0x12'));var db=require(_0x5a2a('0x13'))['db'];function respondWithStatusCode(_0x595158,_0x274e4a){_0x274e4a=_0x274e4a||0xcc;return function(_0x23b191){if(_0x23b191){return _0x595158['sendStatus'](_0x274e4a);}return _0x595158[_0x5a2a('0x14')](_0x274e4a)[_0x5a2a('0x15')]();};}function respondWithResult(_0x14ddea,_0x4fd37d){_0x4fd37d=_0x4fd37d||0xc8;return function(_0x1d978b){if(_0x1d978b){return _0x14ddea[_0x5a2a('0x14')](_0x4fd37d)[_0x5a2a('0x16')](_0x1d978b);}};}function respondWithFilteredResult(_0xbaed6e,_0x47617d){return function(_0x3822ab){if(_0x3822ab){var _0x34e959=typeof _0x47617d[_0x5a2a('0x17')]===_0x5a2a('0x18')&&typeof _0x47617d['limit']===_0x5a2a('0x18');var _0x43ac73=_0x3822ab[_0x5a2a('0x19')];var _0x36c762=_0x34e959?0x0:_0x47617d[_0x5a2a('0x17')];var _0x2f4405=_0x34e959?_0x3822ab[_0x5a2a('0x19')]:_0x47617d['offset']+_0x47617d[_0x5a2a('0x1a')];var _0x23bae0;if(_0x2f4405>=_0x43ac73){_0x2f4405=_0x43ac73;_0x23bae0=0xc8;}else{_0x23bae0=0xce;}_0xbaed6e[_0x5a2a('0x14')](_0x23bae0);return _0xbaed6e[_0x5a2a('0x1b')](_0x5a2a('0x1c'),_0x36c762+'-'+_0x2f4405+'/'+_0x43ac73)[_0x5a2a('0x16')](_0x3822ab);}return null;};}function patchUpdates(_0x46bb5e){return function(_0x294ecb){try{jsonpatch['apply'](_0x294ecb,_0x46bb5e,!![]);}catch(_0xf83356){return BPromise[_0x5a2a('0x1d')](_0xf83356);}return _0x294ecb[_0x5a2a('0x1e')]();};}function saveUpdates(_0x4655c4,_0x2b1b37){return function(_0x22e61c){if(_0x22e61c){return _0x22e61c[_0x5a2a('0x1f')](_0x4655c4)[_0x5a2a('0x20')](function(_0x4ecf25){return _0x4ecf25;});}return null;};}function removeEntity(_0x2f1134,_0x4892b2){return function(_0x31888d){if(_0x31888d){return _0x31888d[_0x5a2a('0x21')]()[_0x5a2a('0x20')](function(){_0x2f1134[_0x5a2a('0x14')](0xcc)[_0x5a2a('0x15')]();});}};}function handleEntityNotFound(_0x4b0b7c,_0x2fdf96){return function(_0xfb8108){if(!_0xfb8108){_0x4b0b7c[_0x5a2a('0x22')](0x194);}return _0xfb8108;};}function handleError(_0xedeb9c,_0x32c4f6){_0x32c4f6=_0x32c4f6||0x1f4;return function(_0x2f195c){logger[_0x5a2a('0x23')](_0x2f195c['stack']);if(_0x2f195c['name']){delete _0x2f195c[_0x5a2a('0x24')];}_0xedeb9c['status'](_0x32c4f6)[_0x5a2a('0x25')](_0x2f195c);};}function getMustacheRender(_0x2c03ea,_0x8b3f44){return Mustache[_0x5a2a('0x26')](_0x2c03ea,_[_0x5a2a('0x27')](_0x8b3f44[_0x5a2a('0x28')],{'contact':_0x8b3f44[_0x5a2a('0x29')],'message':_0x8b3f44['message'],'agent':_0x8b3f44[_0x5a2a('0x2a')],'interaction':_0x8b3f44[_0x5a2a('0x2b')],'account':_0x8b3f44['account']}))||'';}exports['index']=function(_0x350672,_0x5db8b6){var _0x3fa506={},_0x3e2064={},_0x173ca6={'count':0x0,'rows':[]};var _0x5541f5=_['map'](db[_0x5a2a('0x2c')][_0x5a2a('0x2d')],function(_0xc6a272){return{'name':_0xc6a272['fieldName'],'type':_0xc6a272[_0x5a2a('0x2e')][_0x5a2a('0x2f')]};});_0x3e2064[_0x5a2a('0x30')]=_[_0x5a2a('0x31')](_[_0x5a2a('0x32')](_0x5541f5,_0x5a2a('0x24')),[_0x5a2a('0x33')]);_0x3e2064[_0x5a2a('0x34')]=_[_0x5a2a('0x35')](_0x350672[_0x5a2a('0x34')]);_0x3e2064[_0x5a2a('0x36')]=_[_0x5a2a('0x37')](_0x3e2064['model'],_0x3e2064['query']);_0x3fa506[_0x5a2a('0x38')]=_[_0x5a2a('0x37')](_0x3e2064[_0x5a2a('0x30')],qs[_0x5a2a('0x39')](_0x350672[_0x5a2a('0x34')][_0x5a2a('0x39')]));_0x3fa506[_0x5a2a('0x38')]=_0x3fa506['attributes'][_0x5a2a('0x3a')]?_0x3fa506[_0x5a2a('0x38')]:_0x3e2064[_0x5a2a('0x30')];if(!_0x350672[_0x5a2a('0x34')][_0x5a2a('0x3b')](_0x5a2a('0x3c'))){_0x3fa506['limit']=qs[_0x5a2a('0x1a')](_0x350672['query'][_0x5a2a('0x1a')]);_0x3fa506[_0x5a2a('0x17')]=qs[_0x5a2a('0x17')](_0x350672[_0x5a2a('0x34')]['offset']);}_0x3fa506[_0x5a2a('0x3d')]=qs[_0x5a2a('0x3e')](_0x350672['query'][_0x5a2a('0x3e')]);_0x3fa506[_0x5a2a('0x3f')]=qs['filters'](_[_0x5a2a('0x40')](_0x350672[_0x5a2a('0x34')],_0x3e2064[_0x5a2a('0x36')]),_0x5541f5);if(_0x350672[_0x5a2a('0x34')][_0x5a2a('0x41')]){_0x3fa506[_0x5a2a('0x3f')]=_[_0x5a2a('0x27')](_0x3fa506[_0x5a2a('0x3f')],{'$or':_[_0x5a2a('0x32')](_0x5541f5,function(_0x5d850d){if(_0x5d850d[_0x5a2a('0x2e')]!=='VIRTUAL'){var _0x58072d={};_0x58072d[_0x5d850d['name']]={'$like':'%'+_0x350672[_0x5a2a('0x34')]['filter']+'%'};return _0x58072d;}})});}_0x3fa506=_[_0x5a2a('0x27')]({},_0x3fa506,_0x350672[_0x5a2a('0x42')]);var _0x1cfb50={'where':_0x3fa506[_0x5a2a('0x3f')]};return db[_0x5a2a('0x2c')][_0x5a2a('0x19')](_0x1cfb50)[_0x5a2a('0x20')](function(_0x23b285){_0x173ca6[_0x5a2a('0x19')]=_0x23b285;if(_0x350672['query'][_0x5a2a('0x43')]){_0x3fa506[_0x5a2a('0x44')]=[{'all':!![]}];}return db[_0x5a2a('0x2c')][_0x5a2a('0x45')](_0x3fa506);})[_0x5a2a('0x20')](function(_0x527f5b){_0x173ca6[_0x5a2a('0x46')]=_0x527f5b;return _0x173ca6;})['then'](respondWithFilteredResult(_0x5db8b6,_0x3fa506))['catch'](handleError(_0x5db8b6,null));};exports[_0x5a2a('0x47')]=function(_0x5792a6,_0x35b5c0){var _0x28bf99={'raw':![],'where':{'id':_0x5792a6[_0x5a2a('0x48')]['id']}},_0x355189={};_0x355189['model']=_['keys'](db['VoiceRecording'][_0x5a2a('0x2d')]);_0x355189[_0x5a2a('0x34')]=_[_0x5a2a('0x35')](_0x5792a6[_0x5a2a('0x34')]);_0x355189[_0x5a2a('0x36')]=_['intersection'](_0x355189[_0x5a2a('0x30')],_0x355189['query']);_0x28bf99[_0x5a2a('0x38')]=_[_0x5a2a('0x37')](_0x355189[_0x5a2a('0x30')],qs[_0x5a2a('0x39')](_0x5792a6[_0x5a2a('0x34')][_0x5a2a('0x39')]));_0x28bf99[_0x5a2a('0x38')]=_0x28bf99[_0x5a2a('0x38')][_0x5a2a('0x3a')]?_0x28bf99[_0x5a2a('0x38')]:_0x355189[_0x5a2a('0x30')];if(_0x5792a6[_0x5a2a('0x34')][_0x5a2a('0x43')]){_0x28bf99[_0x5a2a('0x44')]=[{'all':!![]}];}_0x28bf99=_['merge']({},_0x28bf99,_0x5792a6['options']);return db[_0x5a2a('0x2c')][_0x5a2a('0x49')](_0x28bf99)[_0x5a2a('0x20')](handleEntityNotFound(_0x35b5c0,null))[_0x5a2a('0x20')](respondWithResult(_0x35b5c0,null))['catch'](handleError(_0x35b5c0,null));};exports['create']=function(_0x5587b8,_0x221f58){return db[_0x5a2a('0x2c')]['create'](_0x5587b8['body'],{})['then'](respondWithResult(_0x221f58,0xc9))[_0x5a2a('0x4a')](handleError(_0x221f58,null));};exports['update']=function(_0x46d09b,_0x5bf608){if(_0x46d09b[_0x5a2a('0x28')]['id']){delete _0x46d09b[_0x5a2a('0x28')]['id'];}return db[_0x5a2a('0x2c')][_0x5a2a('0x49')]({'where':{'id':_0x46d09b[_0x5a2a('0x48')]['id']}})[_0x5a2a('0x20')](handleEntityNotFound(_0x5bf608,null))[_0x5a2a('0x20')](saveUpdates(_0x46d09b[_0x5a2a('0x28')],null))[_0x5a2a('0x20')](respondWithResult(_0x5bf608,null))[_0x5a2a('0x4a')](handleError(_0x5bf608,null));};exports[_0x5a2a('0x4b')]=function(_0x5c9279,_0x1bec01){return db[_0x5a2a('0x2c')][_0x5a2a('0x4b')]()[_0x5a2a('0x20')](respondWithResult(_0x1bec01,null))['catch'](handleError(_0x1bec01,null));};exports[_0x5a2a('0x4c')]=function(_0x6ae071,_0x2a84a8,_0x4fc5df){var _0x1e8cca=require(_0x5a2a('0x4d'));var _0x3116e9=![];var _0x2f6403={};if(_0x6ae071['query'][_0x5a2a('0x2e')]&&_0x6ae071[_0x5a2a('0x34')][_0x5a2a('0x2e')]===_0x5a2a('0x4e')){_0x2f6403[_0x5a2a('0x4e')]=_0x6ae071[_0x5a2a('0x48')]['id'];}else{_0x2f6403['id']=_0x6ae071[_0x5a2a('0x48')]['id'];}return db['VoiceRecording'][_0x5a2a('0x49')]({'where':_0x2f6403,'attributes':['id',_0x5a2a('0x4f')],'raw':!![]})[_0x5a2a('0x20')](handleEntityNotFound(_0x2a84a8,null))[_0x5a2a('0x20')](function(_0x101b20){if(_0x101b20){var _0x3da766=_0x101b20[_0x5a2a('0x4f')];var _0x45be15=util[_0x5a2a('0x33')](_0x5a2a('0x50'),_0x3da766);if(fs['existsSync'](_0x45be15)){_0x3116e9=!![];return _0x1e8cca[_0x5a2a('0x51')](_0x45be15,_0x3da766,config['secrets']['recording'])['then'](function(){return _0x101b20;});}return _0x101b20;}})[_0x5a2a('0x20')](function(_0x157629){if(_0x157629){var _0x524923=_0x157629['value'];if(!fs[_0x5a2a('0x52')](_0x524923)){throw new db[(_0x5a2a('0x53'))][(_0x5a2a('0x54'))](_0x5a2a('0x55'));}if(_0x157629[_0x5a2a('0x56')]){return _0x2a84a8[_0x5a2a('0x4c')](_0x524923,_0x157629['filename']+path['extname'](_0x524923),function(){if(_0x3116e9){fs[_0x5a2a('0x57')](_0x524923);}});}else{return _0x2a84a8[_0x5a2a('0x4c')](_0x524923,function(_0xd7a6bc){if(_0x3116e9){fs[_0x5a2a('0x57')](_0x524923);}});}}})[_0x5a2a('0x4a')](function(_0x3d78c2){if(_0x3d78c2[_0x5a2a('0x58')]===_0x5a2a('0x55')){_0x2a84a8[_0x5a2a('0x14')](0x194)[_0x5a2a('0x25')](_0x5a2a('0x59'));}else{return handleError(_0x2a84a8,null);}});};exports[_0x5a2a('0x5a')]=function(_0x56bf23,_0x48633b,_0x5750ed){var _0x3e2ee8=require(_0x5a2a('0x4d'));var _0x3776ff=![];var _0x28d7a5={'$and':[db[_0x5a2a('0x5b')][_0x5a2a('0x3f')](db[_0x5a2a('0x5b')]['fn'](_0x5a2a('0x5c'),db[_0x5a2a('0x5b')][_0x5a2a('0x5d')](_0x5a2a('0x4e'))),_0x56bf23['query'][_0x5a2a('0x5e')])]};if(_0x56bf23[_0x5a2a('0x34')][_0x5a2a('0x2e')]&&_0x56bf23[_0x5a2a('0x34')][_0x5a2a('0x2e')]===_0x5a2a('0x4e')){_0x28d7a5[_0x5a2a('0x5f')][_0x5a2a('0x60')]({'uniqueid':_0x56bf23[_0x5a2a('0x48')]['id']});}else{_0x28d7a5[_0x5a2a('0x5f')]['push']({'id':_0x56bf23[_0x5a2a('0x48')]['id']});}return db['VoiceRecording']['find']({'where':_0x28d7a5,'attributes':['id',_0x5a2a('0x4f')],'raw':!![]})[_0x5a2a('0x20')](handleEntityNotFound(_0x48633b,null))[_0x5a2a('0x20')](function(_0x522928){if(_0x522928){var _0x3387a1=util[_0x5a2a('0x33')](_0x5a2a('0x50'),_0x522928[_0x5a2a('0x4f')]);if(fs['existsSync'](_0x3387a1)){_0x3776ff=!![];return _0x3e2ee8[_0x5a2a('0x51')](_0x3387a1,_0x522928['value'],config[_0x5a2a('0x61')]['recording'])[_0x5a2a('0x20')](function(){return _0x522928;});}return _0x522928;}})['then'](function(_0x3e2788){if(_0x3e2788){if(!fs[_0x5a2a('0x52')](_0x3e2788['value'])){throw new db[(_0x5a2a('0x53'))][(_0x5a2a('0x54'))](_0x5a2a('0x55'));}if(_0x3e2788[_0x5a2a('0x56')]){return _0x48633b['download'](_0x3e2788[_0x5a2a('0x4f')],_0x3e2788[_0x5a2a('0x56')]+path[_0x5a2a('0x62')](_0x3e2788[_0x5a2a('0x4f')]),function(){if(_0x3776ff){fs[_0x5a2a('0x57')](_0x3e2788[_0x5a2a('0x4f')]);}});}else{return _0x48633b[_0x5a2a('0x4c')](_0x3e2788[_0x5a2a('0x4f')],function(_0x2ab2f6){if(_0x3776ff){fs[_0x5a2a('0x57')](_0x3e2788['value']);}});}}})[_0x5a2a('0x4a')](handleError(_0x48633b,null));};exports[_0x5a2a('0x21')]=function(_0x1deece,_0x46318a){return db[_0x5a2a('0x2c')][_0x5a2a('0x49')]({'where':{'id':_0x1deece[_0x5a2a('0x48')]['id']}})[_0x5a2a('0x20')](function(_0xf010a){if(_[_0x5a2a('0x63')](_0xf010a)){throw new ReferenceError(_0x5a2a('0x64'));}return _0xf010a;})[_0x5a2a('0x20')](function(_0x1e8457){var _0xa5caf3=_0x1e8457['value'];logger[_0x5a2a('0x65')](_0x5a2a('0x66'),_0xa5caf3);if(!_[_0x5a2a('0x63')](_0x1e8457[_0x5a2a('0x4f')])&&fs[_0x5a2a('0x52')](_0xa5caf3)){logger[_0x5a2a('0x65')](_0x5a2a('0x67')+_0xa5caf3+_0x5a2a('0x68'));fs[_0x5a2a('0x69')](_0xa5caf3);}_0xa5caf3=_0xa5caf3+_0x5a2a('0x6a');if(!_[_0x5a2a('0x63')](_0x1e8457[_0x5a2a('0x4f')])&&fs['existsSync'](_0xa5caf3)){logger[_0x5a2a('0x65')]('File:\x20\x22'+_0xa5caf3+_0x5a2a('0x68'));fs[_0x5a2a('0x69')](_0xa5caf3);}return _0x1e8457;})[_0x5a2a('0x20')](function(_0x2feee5){if(!_0x2feee5)throw new InternalError();return _0x2feee5[_0x5a2a('0x21')]();})[_0x5a2a('0x20')](function(){_0x46318a['status'](0xcc)[_0x5a2a('0x15')]();})[_0x5a2a('0x4a')](handleError(_0x46318a,null));};function getBucketslist(_0x3a53bd,_0x4fe99b,_0x157f24){return new Promise(function(_0x368811,_0x4972d4){var _0x3362ef=new AWS['S3']({'accessKeyId':_0x4fe99b,'secretAccessKey':_0x3a53bd,'region':_0x157f24});_0x3362ef['listBuckets']({},function(_0x1cb903,_0xcc3e4b){if(_0x1cb903){return _0x4972d4(_0x1cb903);}else{return _0x368811(_0xcc3e4b);}});});}function createBucket(_0x1a9ce9,_0xf6cfb6,_0x2b4ca1,_0x1aadaa){return new Promise(function(_0x57065d,_0x2926f0){var _0xbb0143=new AWS['S3']({'accessKeyId':_0xf6cfb6,'secretAccessKey':_0x1a9ce9,'region':_0x2b4ca1});_0xbb0143[_0x5a2a('0x6b')]({'Bucket':_0x1aadaa},function(_0x4fcd94,_0x2f6a0a){if(_0x4fcd94){return _0x2926f0(_0x4fcd94);}else{return _0x57065d(_0x2f6a0a);}});});}function uploadFile(_0x566620,_0x47c218,_0xee38e4,_0x46c7e2,_0x44bf86,_0xa7a652){return new Promise(function(_0x54639f,_0x15cbaf){var _0x599393=new AWS['S3']({'accessKeyId':_0x47c218,'secretAccessKey':_0x566620,'region':_0xee38e4});_0x599393[_0x5a2a('0x6c')]({'Bucket':_0x46c7e2,'Key':_0x44bf86,'Body':_0xa7a652},function(_0x57ab8f,_0x102750){if(_0x57ab8f){return _0x15cbaf(_0x57ab8f);}else{return _0x54639f(_0x102750);}});});}function startTranscribe(_0x592c0f,_0x447774,_0x3143f6,_0xa5b334,_0x5d9d8e,_0x1e941a){return new Promise(function(_0x2ef316,_0x1a8562){var _0x23aee1=new AWS[(_0x5a2a('0x6d'))]({'accessKeyId':_0x447774,'secretAccessKey':_0x592c0f,'region':_0x3143f6});_0x23aee1[_0x5a2a('0x6e')]({'TranscriptionJobName':_0xa5b334,'LanguageCode':_0x5d9d8e,'Media':{'MediaFileUri':_0x1e941a}},function(_0x2f498f,_0x58366b){if(_0x2f498f){return _0x1a8562(_0x2f498f);}else{return _0x2ef316(_0x58366b);}});});}function transcribe(_0x767bbe,_0x79d8b5,_0x2aff24,_0x44db9f,_0x14866c,_0xfa86c1,_0xdd907d){return new Promise(function(_0x36610d,_0x3cb768){var _0x445c9f={};logger[_0x5a2a('0x65')](util[_0x5a2a('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x767bbe,_0x14866c));return uploadFile(_0x79d8b5,_0x2aff24,_0x44db9f,_0x14866c,path[_0x5a2a('0x6f')](_0xfa86c1),fs[_0x5a2a('0x70')](_0xfa86c1))['then'](function(_0x4f42d4){logger[_0x5a2a('0x65')](util[_0x5a2a('0x33')](_0x5a2a('0x71'),_0x767bbe,_0x14866c,_0x4f42d4[_0x5a2a('0x72')]));_0x445c9f['bucket']=_0x4f42d4[_0x5a2a('0x73')];_0x445c9f['location']=_0x4f42d4[_0x5a2a('0x72')];logger[_0x5a2a('0x65')](util[_0x5a2a('0x33')](_0x5a2a('0x74'),_0x767bbe));return startTranscribe(_0x79d8b5,_0x2aff24,_0x44db9f,uuidv4(),_0xdd907d,_0x4f42d4['Location']);})[_0x5a2a('0x20')](function(_0x14328a){logger[_0x5a2a('0x65')](util[_0x5a2a('0x33')](_0x5a2a('0x75'),_0x767bbe,_0x14328a[_0x5a2a('0x76')]['TranscriptionJobName']));_0x445c9f['transcribeName']=_0x14328a[_0x5a2a('0x76')]['TranscriptionJobName'];_0x445c9f[_0x5a2a('0x77')]=_0x14328a['TranscriptionJob'][_0x5a2a('0x78')];return _0x36610d(_0x445c9f);})[_0x5a2a('0x4a')](function(_0x1e0e95){return _0x3cb768(_0x1e0e95);});});}exports['runTranscribe']=function(_0x174c0c,_0x2ad9be,_0x1bd319){var _0x26fbf7;var _0x2aca9a;var _0x40cb34;var _0x5bfef5=require('../../components/encryptor');return db[_0x5a2a('0x2c')]['findOne']({'where':{'id':_0x174c0c['params']['id']}})[_0x5a2a('0x20')](function(_0x43eed9){if(_0x43eed9){var _0x38ae96=util[_0x5a2a('0x33')](_0x5a2a('0x50'),_0x43eed9[_0x5a2a('0x4f')]);if(fs[_0x5a2a('0x52')](_0x38ae96)){cypher=!![];return _0x5bfef5['decryptFile'](_0x38ae96,_0x43eed9[_0x5a2a('0x4f')],config[_0x5a2a('0x61')][_0x5a2a('0x79')])['then'](function(){return _0x43eed9;});}return _0x43eed9;}})['then'](function(_0x357eb7){if(!_0x357eb7){throw new db['Sequelize'][(_0x5a2a('0x54'))](_0x5a2a('0x7a'));}_0x2aca9a=_0x357eb7;return db[_0x5a2a('0x7b')][_0x5a2a('0x7c')]({'where':{'id':0x1}});})[_0x5a2a('0x20')](handleEntityNotFound(_0x2ad9be,null))[_0x5a2a('0x20')](function(_0x3d4f99){if(_0x3d4f99){_0x26fbf7=_0x3d4f99;if(!_0x26fbf7[_0x5a2a('0x7d')]||!_0x26fbf7['transcribeAccountId']||!_0x26fbf7[_0x5a2a('0x7e')]||!_0x26fbf7[_0x5a2a('0x7f')]||!_0x26fbf7[_0x5a2a('0x80')]){throw new db[(_0x5a2a('0x53'))][(_0x5a2a('0x54'))](_0x5a2a('0x81'));}if(_0x174c0c['body'][_0x5a2a('0x82')]&&(!_0x26fbf7[_0x5a2a('0x83')]||!_0x26fbf7[_0x5a2a('0x84')]||!_0x26fbf7[_0x5a2a('0x85')]||!_0x26fbf7[_0x5a2a('0x7f')]||!_0x26fbf7[_0x5a2a('0x80')])){throw new db[(_0x5a2a('0x53'))]['ValidationError'](_0x5a2a('0x86'));}return db[_0x5a2a('0x87')]['findOne']({'where':{'id':_0x26fbf7[_0x5a2a('0x88')]}});}})[_0x5a2a('0x20')](function(_0x260d1c){if(!_0x260d1c){throw new db[(_0x5a2a('0x53'))][(_0x5a2a('0x54'))](_0x5a2a('0x89'));}if(!_0x260d1c['data1']||!_0x260d1c['data2']){throw new db[(_0x5a2a('0x53'))][(_0x5a2a('0x54'))](_0x5a2a('0x8a'));}_0x40cb34=_0x260d1c;return getBucketslist(_0x40cb34[_0x5a2a('0x8b')],_0x40cb34[_0x5a2a('0x8c')],_0x26fbf7['transcribeRegion']);})['then'](function(_0x183b75){if(_0x183b75&&_0x183b75[_0x5a2a('0x8d')]){var _0x50c384=_[_0x5a2a('0x49')](_0x183b75[_0x5a2a('0x8d')],function(_0x434ca7){return _0x434ca7[_0x5a2a('0x8e')]===_0x26fbf7['bucket'];});if(!_0x50c384){logger['info'](util[_0x5a2a('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x174c0c[_0x5a2a('0x48')]['id'],_0x26fbf7['bucket']));return createBucket(_0x40cb34[_0x5a2a('0x8b')],_0x40cb34[_0x5a2a('0x8c')],_0x26fbf7['transcribeRegion'],_0x26fbf7[_0x5a2a('0x80')]);}logger[_0x5a2a('0x65')](util[_0x5a2a('0x33')](_0x5a2a('0x8f'),_0x174c0c[_0x5a2a('0x48')]['id'],_0x26fbf7[_0x5a2a('0x80')]));return;}})[_0x5a2a('0x20')](function(_0x45bd1e){if(_0x2aca9a[_0x5a2a('0x77')]===_0x5a2a('0x90')){return transcribe(_0x174c0c[_0x5a2a('0x48')]['id'],_0x40cb34['data1'],_0x40cb34[_0x5a2a('0x8c')],_0x26fbf7[_0x5a2a('0x7e')],_0x26fbf7['bucket'],_0x2aca9a['value'],_0x26fbf7['language']);}else{logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x174c0c[_0x5a2a('0x48')]['id']));return{'transcribeStatus':_0x5a2a('0x91')};}})[_0x5a2a('0x20')](function(_0x7851e2){if(_0x7851e2){_0x7851e2[_0x5a2a('0x92')]=_0x174c0c[_0x5a2a('0x28')]['runSentiment'];return _0x2aca9a['updateAttributes'](_0x7851e2);}})['then'](respondWithResult(_0x2ad9be,null))[_0x5a2a('0x4a')](handleError(_0x2ad9be,null));};function writeFile(_0x100d5b,_0x3116f2){return new Promise(function(_0x215281,_0x19faa8){fs[_0x5a2a('0x93')](_0x3116f2,_0x100d5b,function(_0x598051,_0x25eaeb){if(_0x598051){return _0x19faa8(_0x598051);}else{return _0x215281(_0x25eaeb);}});});}exports[_0x5a2a('0x94')]=function(_0x40df20,_0x15fc18,_0x4fbfa2){return db[_0x5a2a('0x2c')][_0x5a2a('0x7c')]({'where':{'id':_0x40df20[_0x5a2a('0x48')]['id']}})['then'](handleEntityNotFound(_0x15fc18))[_0x5a2a('0x20')](function(_0xc1371a){if(_0xc1371a&&_0xc1371a['fileText']){var _0x230146=_0xc1371a[_0x5a2a('0x95')];var _0x229afc=config[_0x5a2a('0x96')]+_0x5a2a('0x97')+_0xc1371a['id']+'.txt';if(fs[_0x5a2a('0x52')](_0x229afc)){return _0x229afc;}return writeFile(_0x230146,_0x229afc)[_0x5a2a('0x20')](function(){return _0x229afc;});}else{throw new db[(_0x5a2a('0x53'))][(_0x5a2a('0x54'))]('Transcript\x20not\x20available');}})['then'](function(_0x1a5e66){return _0x15fc18[_0x5a2a('0x4c')](_0x1a5e66);})['catch'](handleError(_0x15fc18));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 94c1f09..37eb03f 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 _0x1fb1=['request-promise','rimraf','../../config/environment','./voiceRecording.attributes','define','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x52922a,_0x5d457f){var _0x21ca07=function(_0x5f31d9){while(--_0x5f31d9){_0x52922a['push'](_0x52922a['shift']());}};_0x21ca07(++_0x5d457f);}(_0x1fb1,0x132));var _0x11fb=function(_0x439718,_0x1635cc){_0x439718=_0x439718-0x0;var _0xb369e0=_0x1fb1[_0x439718];return _0xb369e0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x11fb('0x0'))(_0x11fb('0x1'));var moment=require(_0x11fb('0x2'));var BPromise=require(_0x11fb('0x3'));var rp=require(_0x11fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11fb('0x5'));var config=require(_0x11fb('0x6'));var attributes=require(_0x11fb('0x7'));module['exports']=function(_0x219666,_0x59cab6){return _0x219666[_0x11fb('0x8')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x11fb('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5837=['exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x270aea,_0x10c943){var _0x4596a8=function(_0x5cc7bf){while(--_0x5cc7bf){_0x270aea['push'](_0x270aea['shift']());}};_0x4596a8(++_0x10c943);}(_0x5837,0x14f));var _0x7583=function(_0x3382f4,_0x32b70b){_0x3382f4=_0x3382f4-0x0;var _0x3a3368=_0x5837[_0x3382f4];return _0x3a3368;};'use strict';var _=require(_0x7583('0x0'));var util=require(_0x7583('0x1'));var logger=require(_0x7583('0x2'))(_0x7583('0x3'));var moment=require(_0x7583('0x4'));var BPromise=require('bluebird');var rp=require(_0x7583('0x5'));var fs=require('fs');var path=require(_0x7583('0x6'));var rimraf=require(_0x7583('0x7'));var config=require(_0x7583('0x8'));var attributes=require(_0x7583('0x9'));module[_0x7583('0xa')]=function(_0x3869cb,_0x32f499){return _0x3869cb[_0x7583('0xb')](_0x7583('0xc'),attributes,{'tableName':_0x7583('0xd'),'paranoid':![],'indexes':[{'name':_0x7583('0xe'),'fields':[_0x7583('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 7b12179..474815c 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 _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x52a8da,_0x5d9213){var _0x5e9460=function(_0x191193){while(--_0x191193){_0x52a8da['push'](_0x52a8da['shift']());}};_0x5e9460(++_0x5d9213);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x105736,_0x141625){var _0x55178c=function(_0x49bdc9){while(--_0x49bdc9){_0x105736['push'](_0x105736['shift']());}};_0x55178c(++_0x141625);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index dd1c96a..451d45b 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 _0xf5f0=['show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf5f0,0x149));var _0x0f5f=function(_0x2935c3,_0x548fe1){_0x2935c3=_0x2935c3-0x0;var _0x33b6b7=_0xf5f0[_0x2935c3];return _0x33b6b7;};'use strict';var multer=require(_0x0f5f('0x0'));var util=require(_0x0f5f('0x1'));var path=require(_0x0f5f('0x2'));var timeout=require(_0x0f5f('0x3'));var express=require(_0x0f5f('0x4'));var router=express[_0x0f5f('0x5')]();var fs_extra=require(_0x0f5f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0f5f('0x7'));var config=require(_0x0f5f('0x8'));var controller=require(_0x0f5f('0x9'));router['get']('/',auth[_0x0f5f('0xa')](),controller[_0x0f5f('0xb')]);router['get'](_0x0f5f('0xc'),auth[_0x0f5f('0xa')](),controller[_0x0f5f('0xd')]);router[_0x0f5f('0xe')](_0x0f5f('0xf'),auth[_0x0f5f('0xa')](),controller[_0x0f5f('0x10')]);router[_0x0f5f('0x11')]('/',auth['isAuthenticated'](),controller[_0x0f5f('0x12')]);router[_0x0f5f('0x13')](_0x0f5f('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x0f5f('0x14')](_0x0f5f('0xf'),auth[_0x0f5f('0xa')](),controller[_0x0f5f('0x15')]);module[_0x0f5f('0x16')]=router; \ No newline at end of file +var _0x29e4=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3a6a96,_0x192c24){var _0x47de23=function(_0x2ac4ba){while(--_0x2ac4ba){_0x3a6a96['push'](_0x3a6a96['shift']());}};_0x47de23(++_0x192c24);}(_0x29e4,0x14d));var _0x429e=function(_0x449581,_0x206cba){_0x449581=_0x449581-0x0;var _0x23c881=_0x29e4[_0x449581];return _0x23c881;};'use strict';var multer=require(_0x429e('0x0'));var util=require(_0x429e('0x1'));var path=require('path');var timeout=require(_0x429e('0x2'));var express=require(_0x429e('0x3'));var router=express[_0x429e('0x4')]();var fs_extra=require(_0x429e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429e('0x6'));var config=require(_0x429e('0x7'));var controller=require(_0x429e('0x8'));router[_0x429e('0x9')]('/',auth[_0x429e('0xa')](),controller[_0x429e('0xb')]);router[_0x429e('0x9')](_0x429e('0xc'),auth[_0x429e('0xa')](),controller[_0x429e('0xd')]);router[_0x429e('0x9')](_0x429e('0xe'),auth[_0x429e('0xa')](),controller[_0x429e('0xf')]);router[_0x429e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x429e('0xe'),auth[_0x429e('0xa')](),controller[_0x429e('0x11')]);router[_0x429e('0x12')](_0x429e('0xe'),auth[_0x429e('0xa')](),controller['destroy']);module[_0x429e('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 2cd0400..062e67a 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 _0xc099=['STRING','Yes','sequelize','moment','ENUM','blind','attended'];(function(_0x3de176,_0x5b8b72){var _0x5086fc=function(_0x3e5aeb){while(--_0x3e5aeb){_0x3de176['push'](_0x3de176['shift']());}};_0x5086fc(++_0x5b8b72);}(_0xc099,0x1bb));var _0x9c09=function(_0x2b58fb,_0x14f4e0){_0x2b58fb=_0x2b58fb-0x0;var _0x4d2598=_0xc099[_0x2b58fb];return _0x4d2598;};'use strict';var Sequelize=require(_0x9c09('0x0'));var moment=require(_0x9c09('0x1'));module['exports']={'type':{'type':Sequelize[_0x9c09('0x2')](_0x9c09('0x3'),_0x9c09('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x9c09('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x9c09('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x9c09('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x9c09('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x9c09('0x5')]},'transfererexten':{'type':Sequelize[_0x9c09('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x9c09('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x9c09('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x9c09('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x9c09('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x9c09('0x5')]},'transfereecontext':{'type':Sequelize[_0x9c09('0x5')]},'transfereeexten':{'type':Sequelize[_0x9c09('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x9c09('0x5')]},'isexternal':{'type':Sequelize[_0x9c09('0x2')](_0x9c09('0x6'),'No')},'context':{'type':Sequelize[_0x9c09('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x465e=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x372f50,_0x4b310f){var _0x2ace30=function(_0x3683d1){while(--_0x3683d1){_0x372f50['push'](_0x372f50['shift']());}};_0x2ace30(++_0x4b310f);}(_0x465e,0x1cf));var _0xe465=function(_0x33d581,_0x2da6d0){_0x33d581=_0x33d581-0x0;var _0x3320da=_0x465e[_0x33d581];return _0x3320da;};'use strict';var Sequelize=require(_0xe465('0x0'));var moment=require(_0xe465('0x1'));module[_0xe465('0x2')]={'type':{'type':Sequelize[_0xe465('0x3')](_0xe465('0x4'),_0xe465('0x5'))},'result':{'type':Sequelize[_0xe465('0x6')]},'transfererchannel':{'type':Sequelize[_0xe465('0x6')]},'transferercalleridnum':{'type':Sequelize[_0xe465('0x6')]},'transferercalleridname':{'type':Sequelize[_0xe465('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe465('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xe465('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xe465('0x6')]},'transfererexten':{'type':Sequelize[_0xe465('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xe465('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xe465('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe465('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe465('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xe465('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xe465('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0xe465('0x7'),'No')},'context':{'type':Sequelize[_0xe465('0x6')]},'extension':{'type':Sequelize[_0xe465('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index adb5ad1..e1978e7 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 _0x9025=['nolimit','order','sort','filters','pick','filter','VIRTUAL','options','where','count','include','findAll','rows','params','keys','includeAll','find','catch','create','describe','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','render','merge','body','contact','message','index','VoiceTransferReport','rawAttributes','type','query','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x2421f5,_0xa8a6d6){var _0x422a02=function(_0x313154){while(--_0x313154){_0x2421f5['push'](_0x2421f5['shift']());}};_0x422a02(++_0xa8a6d6);}(_0x9025,0x17c));var _0x5902=function(_0x370a1c,_0x233bff){_0x370a1c=_0x370a1c-0x0;var _0x5126ea=_0x9025[_0x370a1c];return _0x5126ea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5902('0x0'));var rp=require(_0x5902('0x1'));var moment=require(_0x5902('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5902('0x3'));var util=require(_0x5902('0x4'));var path=require(_0x5902('0x5'));var sox=require(_0x5902('0x6'));var csv=require(_0x5902('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5902('0x8'));var jsforce=require(_0x5902('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5902('0x7'));var querystring=require(_0x5902('0xa'));var Papa=require(_0x5902('0xb'));var Redis=require(_0x5902('0xc'));var authService=require(_0x5902('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5902('0xe'));var hardwareService=require(_0x5902('0xf'));var logger=require(_0x5902('0x10'))(_0x5902('0x11'));var utils=require(_0x5902('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ca7b,_0x52137d){_0x52137d=_0x52137d||0xcc;return function(_0x341bf1){if(_0x341bf1){return _0x24ca7b[_0x5902('0x13')](_0x52137d);}return _0x24ca7b['status'](_0x52137d)[_0x5902('0x14')]();};}function respondWithResult(_0x5b4fcd,_0x4979da){_0x4979da=_0x4979da||0xc8;return function(_0x40da85){if(_0x40da85){return _0x5b4fcd[_0x5902('0x15')](_0x4979da)[_0x5902('0x16')](_0x40da85);}};}function respondWithFilteredResult(_0x78ccf4,_0x5e867d){return function(_0x58cfb9){if(_0x58cfb9){var _0x1a3aee=typeof _0x5e867d[_0x5902('0x17')]===_0x5902('0x18')&&typeof _0x5e867d[_0x5902('0x19')]==='undefined';var _0x48043a=_0x58cfb9['count'];var _0x465bc6=_0x1a3aee?0x0:_0x5e867d[_0x5902('0x17')];var _0x3025d6=_0x1a3aee?_0x58cfb9['count']:_0x5e867d[_0x5902('0x17')]+_0x5e867d[_0x5902('0x19')];var _0x37ba3d;if(_0x3025d6>=_0x48043a){_0x3025d6=_0x48043a;_0x37ba3d=0xc8;}else{_0x37ba3d=0xce;}_0x78ccf4[_0x5902('0x15')](_0x37ba3d);return _0x78ccf4[_0x5902('0x1a')](_0x5902('0x1b'),_0x465bc6+'-'+_0x3025d6+'/'+_0x48043a)[_0x5902('0x16')](_0x58cfb9);}return null;};}function patchUpdates(_0x40f498){return function(_0x596073){try{jsonpatch[_0x5902('0x1c')](_0x596073,_0x40f498,!![]);}catch(_0x3bba88){return BPromise[_0x5902('0x1d')](_0x3bba88);}return _0x596073[_0x5902('0x1e')]();};}function saveUpdates(_0x4028ef,_0xdfabd7){return function(_0x37465a){if(_0x37465a){return _0x37465a[_0x5902('0x1f')](_0x4028ef)[_0x5902('0x20')](function(_0x2a6919){return _0x2a6919;});}return null;};}function removeEntity(_0x4ce6ee,_0x219200){return function(_0x3fd220){if(_0x3fd220){return _0x3fd220['destroy']()[_0x5902('0x20')](function(){_0x4ce6ee[_0x5902('0x15')](0xcc)[_0x5902('0x14')]();});}};}function handleEntityNotFound(_0x3506a,_0x5b403d){return function(_0x347fab){if(!_0x347fab){_0x3506a['sendStatus'](0x194);}return _0x347fab;};}function handleError(_0x472bf1,_0x45a08e){_0x45a08e=_0x45a08e||0x1f4;return function(_0x5c0a3d){logger[_0x5902('0x21')](_0x5c0a3d['stack']);if(_0x5c0a3d['name']){delete _0x5c0a3d[_0x5902('0x22')];}_0x472bf1[_0x5902('0x15')](_0x45a08e)[_0x5902('0x23')](_0x5c0a3d);};}function getMustacheRender(_0x468871,_0x26c9f8){return Mustache[_0x5902('0x24')](_0x468871,_[_0x5902('0x25')](_0x26c9f8[_0x5902('0x26')],{'contact':_0x26c9f8[_0x5902('0x27')],'message':_0x26c9f8[_0x5902('0x28')],'agent':_0x26c9f8['agent'],'interaction':_0x26c9f8['interaction'],'account':_0x26c9f8['account']}))||'';}exports[_0x5902('0x29')]=function(_0x2e925d,_0x25e8c5){var _0x4b0f13={},_0x346d1b={},_0x46782a={'count':0x0,'rows':[]};var _0x41b8bd=_['map'](db[_0x5902('0x2a')][_0x5902('0x2b')],function(_0x420b64){return{'name':_0x420b64['fieldName'],'type':_0x420b64[_0x5902('0x2c')]['key']};});_0x346d1b['model']=_['map'](_0x41b8bd,'name');_0x346d1b['query']=_['keys'](_0x2e925d[_0x5902('0x2d')]);_0x346d1b['filters']=_[_0x5902('0x2e')](_0x346d1b[_0x5902('0x2f')],_0x346d1b[_0x5902('0x2d')]);_0x4b0f13[_0x5902('0x30')]=_[_0x5902('0x2e')](_0x346d1b[_0x5902('0x2f')],qs[_0x5902('0x31')](_0x2e925d[_0x5902('0x2d')][_0x5902('0x31')]));_0x4b0f13['attributes']=_0x4b0f13[_0x5902('0x30')][_0x5902('0x32')]?_0x4b0f13[_0x5902('0x30')]:_0x346d1b['model'];if(!_0x2e925d['query'][_0x5902('0x33')](_0x5902('0x34'))){_0x4b0f13['limit']=qs[_0x5902('0x19')](_0x2e925d[_0x5902('0x2d')][_0x5902('0x19')]);_0x4b0f13[_0x5902('0x17')]=qs['offset'](_0x2e925d[_0x5902('0x2d')][_0x5902('0x17')]);}_0x4b0f13[_0x5902('0x35')]=qs['sort'](_0x2e925d['query'][_0x5902('0x36')]);_0x4b0f13['where']=qs[_0x5902('0x37')](_[_0x5902('0x38')](_0x2e925d[_0x5902('0x2d')],_0x346d1b['filters']),_0x41b8bd);if(_0x2e925d[_0x5902('0x2d')][_0x5902('0x39')]){_0x4b0f13['where']=_[_0x5902('0x25')](_0x4b0f13['where'],{'$or':_['map'](_0x41b8bd,function(_0x188c93){if(_0x188c93[_0x5902('0x2c')]!==_0x5902('0x3a')){var _0x117ff4={};_0x117ff4[_0x188c93[_0x5902('0x22')]]={'$like':'%'+_0x2e925d[_0x5902('0x2d')][_0x5902('0x39')]+'%'};return _0x117ff4;}})});}_0x4b0f13=_[_0x5902('0x25')]({},_0x4b0f13,_0x2e925d[_0x5902('0x3b')]);var _0x178e20={'where':_0x4b0f13[_0x5902('0x3c')]};return db['VoiceTransferReport'][_0x5902('0x3d')](_0x178e20)[_0x5902('0x20')](function(_0x44a1ef){_0x46782a[_0x5902('0x3d')]=_0x44a1ef;if(_0x2e925d[_0x5902('0x2d')]['includeAll']){_0x4b0f13[_0x5902('0x3e')]=[{'all':!![]}];}return db[_0x5902('0x2a')][_0x5902('0x3f')](_0x4b0f13);})['then'](function(_0x2a537a){_0x46782a[_0x5902('0x40')]=_0x2a537a;return _0x46782a;})[_0x5902('0x20')](respondWithFilteredResult(_0x25e8c5,_0x4b0f13))['catch'](handleError(_0x25e8c5,null));};exports['show']=function(_0x5a4de0,_0x286706){var _0x4bbb07={'raw':!![],'where':{'id':_0x5a4de0[_0x5902('0x41')]['id']}},_0x188b99={};_0x188b99[_0x5902('0x2f')]=_['keys'](db[_0x5902('0x2a')][_0x5902('0x2b')]);_0x188b99[_0x5902('0x2d')]=_[_0x5902('0x42')](_0x5a4de0[_0x5902('0x2d')]);_0x188b99[_0x5902('0x37')]=_[_0x5902('0x2e')](_0x188b99[_0x5902('0x2f')],_0x188b99[_0x5902('0x2d')]);_0x4bbb07[_0x5902('0x30')]=_[_0x5902('0x2e')](_0x188b99[_0x5902('0x2f')],qs['fields'](_0x5a4de0['query']['fields']));_0x4bbb07[_0x5902('0x30')]=_0x4bbb07[_0x5902('0x30')]['length']?_0x4bbb07[_0x5902('0x30')]:_0x188b99[_0x5902('0x2f')];if(_0x5a4de0['query'][_0x5902('0x43')]){_0x4bbb07['include']=[{'all':!![]}];}_0x4bbb07=_[_0x5902('0x25')]({},_0x4bbb07,_0x5a4de0[_0x5902('0x3b')]);return db[_0x5902('0x2a')][_0x5902('0x44')](_0x4bbb07)[_0x5902('0x20')](handleEntityNotFound(_0x286706,null))[_0x5902('0x20')](respondWithResult(_0x286706,null))[_0x5902('0x45')](handleError(_0x286706,null));};exports[_0x5902('0x46')]=function(_0x2b98d9,_0x196095){return db[_0x5902('0x2a')][_0x5902('0x46')](_0x2b98d9[_0x5902('0x26')],{})[_0x5902('0x20')](respondWithResult(_0x196095,0xc9))[_0x5902('0x45')](handleError(_0x196095,null));};exports[_0x5902('0x1f')]=function(_0x2fde52,_0x51f8d0){if(_0x2fde52[_0x5902('0x26')]['id']){delete _0x2fde52['body']['id'];}return db[_0x5902('0x2a')][_0x5902('0x44')]({'where':{'id':_0x2fde52[_0x5902('0x41')]['id']}})['then'](handleEntityNotFound(_0x51f8d0,null))['then'](saveUpdates(_0x2fde52['body'],null))['then'](respondWithResult(_0x51f8d0,null))['catch'](handleError(_0x51f8d0,null));};exports['destroy']=function(_0x4d4942,_0x12cad9){return db[_0x5902('0x2a')][_0x5902('0x44')]({'where':{'id':_0x4d4942[_0x5902('0x41')]['id']}})[_0x5902('0x20')](handleEntityNotFound(_0x12cad9,null))[_0x5902('0x20')](removeEntity(_0x12cad9,null))[_0x5902('0x45')](handleError(_0x12cad9,null));};exports[_0x5902('0x47')]=function(_0x56db43,_0x5dfc13){return db[_0x5902('0x2a')][_0x5902('0x47')]()['then'](respondWithResult(_0x5dfc13,null))['catch'](handleError(_0x5dfc13,null));}; \ No newline at end of file +var _0x6aa4=['includeAll','include','findAll','rows','show','params','find','catch','create','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','name','send','render','body','contact','message','agent','interaction','account','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x91e807,_0x4ce3d7){var _0x272a99=function(_0x5e6c09){while(--_0x5e6c09){_0x91e807['push'](_0x91e807['shift']());}};_0x272a99(++_0x4ce3d7);}(_0x6aa4,0xb2));var _0x46aa=function(_0x36a815,_0x56256c){_0x36a815=_0x36a815-0x0;var _0x4565c0=_0x6aa4[_0x36a815];return _0x4565c0;};'use strict';var emlformat=require(_0x46aa('0x0'));var rimraf=require(_0x46aa('0x1'));var zipdir=require(_0x46aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x46aa('0x3'));var moment=require(_0x46aa('0x4'));var BPromise=require(_0x46aa('0x5'));var Mustache=require(_0x46aa('0x6'));var util=require(_0x46aa('0x7'));var path=require(_0x46aa('0x8'));var sox=require(_0x46aa('0x9'));var csv=require(_0x46aa('0xa'));var ejs=require(_0x46aa('0xb'));var fs=require('fs');var fs_extra=require(_0x46aa('0xc'));var _=require(_0x46aa('0xd'));var squel=require(_0x46aa('0xe'));var crypto=require('crypto');var jsforce=require(_0x46aa('0xf'));var deskjs=require(_0x46aa('0x10'));var toCsv=require(_0x46aa('0xa'));var querystring=require(_0x46aa('0x11'));var Papa=require(_0x46aa('0x12'));var Redis=require(_0x46aa('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x46aa('0x14'));var as=require(_0x46aa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46aa('0x16'))(_0x46aa('0x17'));var utils=require(_0x46aa('0x18'));var config=require(_0x46aa('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x46aa('0x1a'))['db'];function respondWithStatusCode(_0x5f1237,_0x6a73c1){_0x6a73c1=_0x6a73c1||0xcc;return function(_0x39f8cd){if(_0x39f8cd){return _0x5f1237['sendStatus'](_0x6a73c1);}return _0x5f1237['status'](_0x6a73c1)['end']();};}function respondWithResult(_0x28d892,_0x3d5360){_0x3d5360=_0x3d5360||0xc8;return function(_0x52c2ce){if(_0x52c2ce){return _0x28d892[_0x46aa('0x1b')](_0x3d5360)[_0x46aa('0x1c')](_0x52c2ce);}};}function respondWithFilteredResult(_0x16f11d,_0x22eb21){return function(_0x2ee765){if(_0x2ee765){var _0x25d695=typeof _0x22eb21[_0x46aa('0x1d')]===_0x46aa('0x1e')&&typeof _0x22eb21['limit']===_0x46aa('0x1e');var _0x5af58e=_0x2ee765[_0x46aa('0x1f')];var _0x41cd19=_0x25d695?0x0:_0x22eb21[_0x46aa('0x1d')];var _0x403e8=_0x25d695?_0x2ee765[_0x46aa('0x1f')]:_0x22eb21[_0x46aa('0x1d')]+_0x22eb21[_0x46aa('0x20')];var _0x2b6f45;if(_0x403e8>=_0x5af58e){_0x403e8=_0x5af58e;_0x2b6f45=0xc8;}else{_0x2b6f45=0xce;}_0x16f11d[_0x46aa('0x1b')](_0x2b6f45);return _0x16f11d[_0x46aa('0x21')](_0x46aa('0x22'),_0x41cd19+'-'+_0x403e8+'/'+_0x5af58e)[_0x46aa('0x1c')](_0x2ee765);}return null;};}function patchUpdates(_0x547695){return function(_0x5a1de8){try{jsonpatch[_0x46aa('0x23')](_0x5a1de8,_0x547695,!![]);}catch(_0x8e7d2d){return BPromise[_0x46aa('0x24')](_0x8e7d2d);}return _0x5a1de8['save']();};}function saveUpdates(_0x43d375,_0x1bdf90){return function(_0x57f0c5){if(_0x57f0c5){return _0x57f0c5[_0x46aa('0x25')](_0x43d375)['then'](function(_0x8bf4ba){return _0x8bf4ba;});}return null;};}function removeEntity(_0x3ba429,_0xde8034){return function(_0x5087f){if(_0x5087f){return _0x5087f[_0x46aa('0x26')]()[_0x46aa('0x27')](function(){_0x3ba429[_0x46aa('0x1b')](0xcc)[_0x46aa('0x28')]();});}};}function handleEntityNotFound(_0x311a30,_0x478da2){return function(_0x515dff){if(!_0x515dff){_0x311a30['sendStatus'](0x194);}return _0x515dff;};}function handleError(_0xa6750b,_0x5155f5){_0x5155f5=_0x5155f5||0x1f4;return function(_0x1a7675){logger[_0x46aa('0x29')](_0x1a7675['stack']);if(_0x1a7675[_0x46aa('0x2a')]){delete _0x1a7675['name'];}_0xa6750b[_0x46aa('0x1b')](_0x5155f5)[_0x46aa('0x2b')](_0x1a7675);};}function getMustacheRender(_0x4dfc05,_0xae5250){return Mustache[_0x46aa('0x2c')](_0x4dfc05,_['merge'](_0xae5250[_0x46aa('0x2d')],{'contact':_0xae5250[_0x46aa('0x2e')],'message':_0xae5250[_0x46aa('0x2f')],'agent':_0xae5250[_0x46aa('0x30')],'interaction':_0xae5250[_0x46aa('0x31')],'account':_0xae5250[_0x46aa('0x32')]}))||'';}exports['index']=function(_0x4906b7,_0x452112){var _0x780075={},_0x40f74d={},_0x23dbb7={'count':0x0,'rows':[]};var _0x81133b=_[_0x46aa('0x33')](db[_0x46aa('0x34')][_0x46aa('0x35')],function(_0x5f671f){return{'name':_0x5f671f[_0x46aa('0x36')],'type':_0x5f671f[_0x46aa('0x37')]['key']};});_0x40f74d[_0x46aa('0x38')]=_[_0x46aa('0x33')](_0x81133b,_0x46aa('0x2a'));_0x40f74d[_0x46aa('0x39')]=_[_0x46aa('0x3a')](_0x4906b7['query']);_0x40f74d[_0x46aa('0x3b')]=_[_0x46aa('0x3c')](_0x40f74d['model'],_0x40f74d[_0x46aa('0x39')]);_0x780075[_0x46aa('0x3d')]=_[_0x46aa('0x3c')](_0x40f74d[_0x46aa('0x38')],qs[_0x46aa('0x3e')](_0x4906b7[_0x46aa('0x39')]['fields']));_0x780075['attributes']=_0x780075['attributes'][_0x46aa('0x3f')]?_0x780075[_0x46aa('0x3d')]:_0x40f74d['model'];if(!_0x4906b7['query'][_0x46aa('0x40')](_0x46aa('0x41'))){_0x780075[_0x46aa('0x20')]=qs['limit'](_0x4906b7[_0x46aa('0x39')][_0x46aa('0x20')]);_0x780075[_0x46aa('0x1d')]=qs[_0x46aa('0x1d')](_0x4906b7[_0x46aa('0x39')][_0x46aa('0x1d')]);}_0x780075[_0x46aa('0x42')]=qs[_0x46aa('0x43')](_0x4906b7['query']['sort']);_0x780075[_0x46aa('0x44')]=qs[_0x46aa('0x3b')](_[_0x46aa('0x45')](_0x4906b7[_0x46aa('0x39')],_0x40f74d['filters']),_0x81133b);if(_0x4906b7[_0x46aa('0x39')][_0x46aa('0x46')]){_0x780075[_0x46aa('0x44')]=_[_0x46aa('0x47')](_0x780075[_0x46aa('0x44')],{'$or':_[_0x46aa('0x33')](_0x81133b,function(_0xd82e9a){if(_0xd82e9a[_0x46aa('0x37')]!==_0x46aa('0x48')){var _0x26e492={};_0x26e492[_0xd82e9a[_0x46aa('0x2a')]]={'$like':'%'+_0x4906b7[_0x46aa('0x39')][_0x46aa('0x46')]+'%'};return _0x26e492;}})});}_0x780075=_['merge']({},_0x780075,_0x4906b7[_0x46aa('0x49')]);var _0x122212={'where':_0x780075[_0x46aa('0x44')]};return db[_0x46aa('0x34')][_0x46aa('0x1f')](_0x122212)[_0x46aa('0x27')](function(_0xb4b6d8){_0x23dbb7[_0x46aa('0x1f')]=_0xb4b6d8;if(_0x4906b7[_0x46aa('0x39')][_0x46aa('0x4a')]){_0x780075[_0x46aa('0x4b')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x46aa('0x4c')](_0x780075);})[_0x46aa('0x27')](function(_0x39aebe){_0x23dbb7[_0x46aa('0x4d')]=_0x39aebe;return _0x23dbb7;})[_0x46aa('0x27')](respondWithFilteredResult(_0x452112,_0x780075))['catch'](handleError(_0x452112,null));};exports[_0x46aa('0x4e')]=function(_0x425f5f,_0x492823){var _0x158261={'raw':!![],'where':{'id':_0x425f5f[_0x46aa('0x4f')]['id']}},_0x4f35d3={};_0x4f35d3['model']=_[_0x46aa('0x3a')](db[_0x46aa('0x34')][_0x46aa('0x35')]);_0x4f35d3['query']=_[_0x46aa('0x3a')](_0x425f5f[_0x46aa('0x39')]);_0x4f35d3[_0x46aa('0x3b')]=_[_0x46aa('0x3c')](_0x4f35d3[_0x46aa('0x38')],_0x4f35d3[_0x46aa('0x39')]);_0x158261[_0x46aa('0x3d')]=_[_0x46aa('0x3c')](_0x4f35d3[_0x46aa('0x38')],qs[_0x46aa('0x3e')](_0x425f5f['query'][_0x46aa('0x3e')]));_0x158261[_0x46aa('0x3d')]=_0x158261[_0x46aa('0x3d')]['length']?_0x158261['attributes']:_0x4f35d3[_0x46aa('0x38')];if(_0x425f5f[_0x46aa('0x39')][_0x46aa('0x4a')]){_0x158261[_0x46aa('0x4b')]=[{'all':!![]}];}_0x158261=_[_0x46aa('0x47')]({},_0x158261,_0x425f5f[_0x46aa('0x49')]);return db[_0x46aa('0x34')][_0x46aa('0x50')](_0x158261)[_0x46aa('0x27')](handleEntityNotFound(_0x492823,null))[_0x46aa('0x27')](respondWithResult(_0x492823,null))[_0x46aa('0x51')](handleError(_0x492823,null));};exports['create']=function(_0x5bd838,_0x53022c){return db[_0x46aa('0x34')][_0x46aa('0x52')](_0x5bd838[_0x46aa('0x2d')],{})['then'](respondWithResult(_0x53022c,0xc9))[_0x46aa('0x51')](handleError(_0x53022c,null));};exports['update']=function(_0x4aa998,_0x1dade9){if(_0x4aa998[_0x46aa('0x2d')]['id']){delete _0x4aa998[_0x46aa('0x2d')]['id'];}return db['VoiceTransferReport'][_0x46aa('0x50')]({'where':{'id':_0x4aa998[_0x46aa('0x4f')]['id']}})[_0x46aa('0x27')](handleEntityNotFound(_0x1dade9,null))['then'](saveUpdates(_0x4aa998[_0x46aa('0x2d')],null))[_0x46aa('0x27')](respondWithResult(_0x1dade9,null))[_0x46aa('0x51')](handleError(_0x1dade9,null));};exports[_0x46aa('0x26')]=function(_0xa2bf8,_0x39d450){return db['VoiceTransferReport']['find']({'where':{'id':_0xa2bf8[_0x46aa('0x4f')]['id']}})[_0x46aa('0x27')](handleEntityNotFound(_0x39d450,null))[_0x46aa('0x27')](removeEntity(_0x39d450,null))[_0x46aa('0x51')](handleError(_0x39d450,null));};exports[_0x46aa('0x53')]=function(_0x586912,_0x3ec735){return db['VoiceTransferReport'][_0x46aa('0x53')]()[_0x46aa('0x27')](respondWithResult(_0x3ec735,null))[_0x46aa('0x51')](handleError(_0x3ec735,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 7dadeeb..495018a 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 _0xce47=['api','moment','bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','../../config/logger'];(function(_0x5a82c3,_0x1d5e92){var _0xf95c67=function(_0xc75fb4){while(--_0xc75fb4){_0x5a82c3['push'](_0x5a82c3['shift']());}};_0xf95c67(++_0x1d5e92);}(_0xce47,0x17f));var _0x7ce4=function(_0x5b7de2,_0x378764){_0x5b7de2=_0x5b7de2-0x0;var _0xcb933a=_0xce47[_0x5b7de2];return _0xcb933a;};'use strict';var _=require(_0x7ce4('0x0'));var util=require('util');var logger=require(_0x7ce4('0x1'))(_0x7ce4('0x2'));var moment=require(_0x7ce4('0x3'));var BPromise=require(_0x7ce4('0x4'));var rp=require(_0x7ce4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ce4('0x6'));var config=require('../../config/environment');var attributes=require(_0x7ce4('0x7'));module[_0x7ce4('0x8')]=function(_0x90832b,_0x5e5126){return _0x90832b[_0x7ce4('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x7ce4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd058=['exports','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xd058,0xe7));var _0x8d05=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0xd058[_0x90a39a];return _0x2b62f7;};'use strict';var _=require('lodash');var util=require(_0x8d05('0x0'));var logger=require(_0x8d05('0x1'))(_0x8d05('0x2'));var moment=require(_0x8d05('0x3'));var BPromise=require(_0x8d05('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d05('0x5'));var rimraf=require(_0x8d05('0x6'));var config=require(_0x8d05('0x7'));var attributes=require(_0x8d05('0x8'));module[_0x8d05('0x9')]=function(_0x5bf637,_0x1913aa){return _0x5bf637['define'](_0x8d05('0xa'),attributes,{'tableName':_0x8d05('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index b8c491c..d63d04b 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 _0xd420=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','lodash','util','bluebird'];(function(_0x26a932,_0x1e08a6){var _0x75f39=function(_0x4052e2){while(--_0x4052e2){_0x26a932['push'](_0x26a932['shift']());}};_0x75f39(++_0x1e08a6);}(_0xd420,0x1d9));var _0x0d42=function(_0x2669a2,_0x58e53a){_0x2669a2=_0x2669a2-0x0;var _0x491e94=_0xd420[_0x2669a2];return _0x491e94;};'use strict';var _=require(_0x0d42('0x0'));var util=require(_0x0d42('0x1'));var moment=require('moment');var BPromise=require(_0x0d42('0x2'));var rs=require(_0x0d42('0x3'));var fs=require('fs');var Redis=require(_0x0d42('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d42('0x5'));var logger=require(_0x0d42('0x6'))(_0x0d42('0x7'));var config=require(_0x0d42('0x8'));var jayson=require(_0x0d42('0x9'));var client=jayson[_0x0d42('0xa')][_0x0d42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46be19,_0x2649d5,_0x494507){return new BPromise(function(_0x3fa332,_0x55063e){return client['request'](_0x46be19,_0x494507)['then'](function(_0x54ea8b){logger['info'](_0x0d42('0xc'),_0x2649d5,_0x0d42('0xd'));logger[_0x0d42('0xe')](_0x0d42('0xf'),_0x2649d5,_0x0d42('0xd'),JSON[_0x0d42('0x10')](_0x54ea8b));if(_0x54ea8b['error']){if(_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x12')]===0x1f4){logger[_0x0d42('0x11')](_0x0d42('0xc'),_0x2649d5,_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x13')]);return _0x55063e(_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x13')]);}logger[_0x0d42('0x11')](_0x0d42('0xc'),_0x2649d5,_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x13')]);return _0x3fa332(_0x54ea8b['error'][_0x0d42('0x13')]);}else{logger[_0x0d42('0x14')](_0x0d42('0xc'),_0x2649d5,_0x0d42('0xd'));_0x3fa332(_0x54ea8b['result'][_0x0d42('0x13')]);}})['catch'](function(_0x132c4e){logger[_0x0d42('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2649d5,_0x132c4e);_0x55063e(_0x132c4e);});});}exports[_0x0d42('0x15')]=function(_0x28b5b8){var _0x20cda7=this;return new Promise(function(_0x3a51cc,_0xfc9e3b){return db[_0x0d42('0x16')][_0x0d42('0x17')](_0x28b5b8[_0x0d42('0x18')],{'raw':_0x28b5b8[_0x0d42('0x19')]?_0x28b5b8[_0x0d42('0x19')][_0x0d42('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x6a6967){logger[_0x0d42('0x14')](_0x0d42('0x15'),_0x28b5b8);logger['debug']('CreateVoiceTransferReport',_0x28b5b8,JSON[_0x0d42('0x10')](_0x6a6967));_0x3a51cc(_0x6a6967);})[_0x0d42('0x1b')](function(_0x264ebb){logger[_0x0d42('0x11')](_0x0d42('0x15'),_0x264ebb[_0x0d42('0x13')],_0x28b5b8);_0xfc9e3b(_0x20cda7[_0x0d42('0x11')](0x1f4,_0x264ebb[_0x0d42('0x13')]));});});}; \ No newline at end of file +var _0x17d7=['then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','VoiceTransferReport','body','options','raw','CreateVoiceTransferReport','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xf4e5cb,_0x10c733){var _0x11a71a=function(_0x38786a){while(--_0x38786a){_0xf4e5cb['push'](_0xf4e5cb['shift']());}};_0x11a71a(++_0x10c733);}(_0x17d7,0x15b));var _0x717d=function(_0x4b318e,_0x15fe4f){_0x4b318e=_0x4b318e-0x0;var _0x3b6a2f=_0x17d7[_0x4b318e];return _0x3b6a2f;};'use strict';var _=require(_0x717d('0x0'));var util=require(_0x717d('0x1'));var moment=require('moment');var BPromise=require(_0x717d('0x2'));var rs=require(_0x717d('0x3'));var fs=require('fs');var Redis=require(_0x717d('0x4'));var db=require(_0x717d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x717d('0x6'))(_0x717d('0x7'));var config=require(_0x717d('0x8'));var jayson=require(_0x717d('0x9'));var client=jayson[_0x717d('0xa')][_0x717d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58a431,_0x1fce88,_0x276687){return new BPromise(function(_0x1ac224,_0x286ca6){return client[_0x717d('0xc')](_0x58a431,_0x276687)[_0x717d('0xd')](function(_0x1937f0){logger['info'](_0x717d('0xe'),_0x1fce88,_0x717d('0xf'));logger[_0x717d('0x10')](_0x717d('0x11'),_0x1fce88,_0x717d('0xf'),JSON[_0x717d('0x12')](_0x1937f0));if(_0x1937f0[_0x717d('0x13')]){if(_0x1937f0[_0x717d('0x13')][_0x717d('0x14')]===0x1f4){logger[_0x717d('0x13')](_0x717d('0xe'),_0x1fce88,_0x1937f0['error'][_0x717d('0x15')]);return _0x286ca6(_0x1937f0['error'][_0x717d('0x15')]);}logger[_0x717d('0x13')](_0x717d('0xe'),_0x1fce88,_0x1937f0[_0x717d('0x13')][_0x717d('0x15')]);return _0x1ac224(_0x1937f0[_0x717d('0x13')][_0x717d('0x15')]);}else{logger[_0x717d('0x16')](_0x717d('0xe'),_0x1fce88,_0x717d('0xf'));_0x1ac224(_0x1937f0[_0x717d('0x17')][_0x717d('0x15')]);}})['catch'](function(_0x84dcfa){logger[_0x717d('0x13')](_0x717d('0xe'),_0x1fce88,_0x84dcfa);_0x286ca6(_0x84dcfa);});});}exports['CreateVoiceTransferReport']=function(_0x2e1ecd){var _0x4f86c3=this;return new Promise(function(_0x52c06b,_0x3f6ffd){return db[_0x717d('0x18')]['create'](_0x2e1ecd[_0x717d('0x19')],{'raw':_0x2e1ecd['options']?_0x2e1ecd[_0x717d('0x1a')][_0x717d('0x1b')]===undefined?!![]:![]:!![]})[_0x717d('0xd')](function(_0x246fae){logger['info']('CreateVoiceTransferReport',_0x2e1ecd);logger[_0x717d('0x10')](_0x717d('0x1c'),_0x2e1ecd,JSON['stringify'](_0x246fae));_0x52c06b(_0x246fae);})[_0x717d('0x1d')](function(_0x599f61){logger['error'](_0x717d('0x1c'),_0x599f61[_0x717d('0x15')],_0x2e1ecd);_0x3f6ffd(_0x4f86c3['error'](0x1f4,_0x599f61[_0x717d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 97342d7..be1ad96 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 _0xb90d=['Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','hangup','/answer','answer','/hold','canUpdate','hold','/unhold','/calls','calls','/transfer'];(function(_0x344d73,_0x2b46e8){var _0x37e503=function(_0x36c570){while(--_0x36c570){_0x344d73['push'](_0x344d73['shift']());}};_0x37e503(++_0x2b46e8);}(_0xb90d,0x17a));var _0xdb90=function(_0x328ac9,_0x2f7225){_0x328ac9=_0x328ac9-0x0;var _0x2b3a0a=_0xb90d[_0x328ac9];return _0x2b3a0a;};'use strict';var express=require('express');var router=express[_0xdb90('0x0')]();var auth=require(_0xdb90('0x1'));var controller=require(_0xdb90('0x2'));router[_0xdb90('0x3')](_0xdb90('0x4'),auth[_0xdb90('0x5')](),auth['canUpdate'](),controller[_0xdb90('0x6')]);router[_0xdb90('0x3')](_0xdb90('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xdb90('0x8')]);router[_0xdb90('0x3')](_0xdb90('0x9'),auth[_0xdb90('0x5')](),auth['canUpdate'](),controller[_0xdb90('0xa')]);router[_0xdb90('0x3')](_0xdb90('0xb'),auth['isAuthenticated'](),auth[_0xdb90('0xc')](),controller[_0xdb90('0xd')]);router[_0xdb90('0x3')](_0xdb90('0xe'),auth[_0xdb90('0x5')](),auth['canUpdate'](),controller['unhold']);router['post'](_0xdb90('0xf'),auth[_0xdb90('0x5')](),auth[_0xdb90('0xc')](),controller[_0xdb90('0x10')]);router[_0xdb90('0x3')](_0xdb90('0x11'),auth['isAuthenticated'](),auth['canUpdate'](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0x8eeb=['/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','express','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','canUpdate','originate','post','hangup'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8eeb,0x183));var _0xb8ee=function(_0x5ae33e,_0x165149){_0x5ae33e=_0x5ae33e-0x0;var _0xb37934=_0x8eeb[_0x5ae33e];return _0xb37934;};'use strict';var express=require(_0xb8ee('0x0'));var router=express['Router']();var auth=require(_0xb8ee('0x1'));var controller=require(_0xb8ee('0x2'));router['post'](_0xb8ee('0x3'),auth[_0xb8ee('0x4')](),auth[_0xb8ee('0x5')](),controller[_0xb8ee('0x6')]);router[_0xb8ee('0x7')]('/hangup',auth[_0xb8ee('0x4')](),auth['canUpdate'](),controller[_0xb8ee('0x8')]);router[_0xb8ee('0x7')](_0xb8ee('0x9'),auth[_0xb8ee('0x4')](),auth['canUpdate'](),controller[_0xb8ee('0xa')]);router[_0xb8ee('0x7')](_0xb8ee('0xb'),auth['isAuthenticated'](),auth[_0xb8ee('0x5')](),controller['hold']);router[_0xb8ee('0x7')](_0xb8ee('0xc'),auth[_0xb8ee('0x4')](),auth[_0xb8ee('0x5')](),controller[_0xb8ee('0xd')]);router[_0xb8ee('0x7')](_0xb8ee('0xe'),auth[_0xb8ee('0x4')](),auth['canUpdate'](),controller[_0xb8ee('0xf')]);router[_0xb8ee('0x7')](_0xb8ee('0x10'),auth[_0xb8ee('0x4')](),auth[_0xb8ee('0x5')](),controller[_0xb8ee('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index aded2f6..a2096ee 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 _0xbf04=['then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','userId','callerId','callbackUrl','entityFound:','format','user:%s','json','originate\x20executed!','hangup','hangup\x20fired:','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','../../config/logger','webbarapi','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','status','send','NotFound'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0xbf04,0xc1));var _0x4bf0=function(_0x9bc2e0,_0x153cf8){_0x9bc2e0=_0x9bc2e0-0x0;var _0x52c05f=_0xbf04[_0x9bc2e0];return _0x52c05f;};'use strict';var path=require(_0x4bf0('0x0'));var fs=require('fs');var _=require(_0x4bf0('0x1'));var db=require(_0x4bf0('0x2'))['db'];var config=require(_0x4bf0('0x3'));var util=require('util');var BPromise=require(_0x4bf0('0x4'));var jayson=require(_0x4bf0('0x5'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x4bf0('0x6'))(_0x4bf0('0x7'));var Redis=require('ioredis');config[_0x4bf0('0x8')]=_[_0x4bf0('0x9')](config[_0x4bf0('0x8')],{'host':_0x4bf0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4bf0('0x8')]));var Schema=require(_0x4bf0('0xb'));var originateValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]},'callNumber':{'type':_0x4bf0('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x4bf0('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]},'sessionId':{'type':_0x4bf0('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4bf0('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4bf0('0xe'),'required':[!![],_0x4bf0('0xf')]},'transferNumber':{'type':_0x4bf0('0xe'),'required':[!![],_0x4bf0('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]},'sessionId':{'type':_0x4bf0('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]}});function emit(_0x56c73a,_0x11e0fb,_0x5e678c){logger['info'](_0x56c73a,_0x11e0fb,JSON[_0x4bf0('0x11')](_0x5e678c));io['to'](_0x56c73a)['emit'](_0x11e0fb,_0x5e678c);}function handleError(_0x8d8802){return function(_0x365e72){console[_0x4bf0('0x12')](_0x4bf0('0x13'),_0x365e72,_0x365e72 instanceof RangeError);logger[_0x4bf0('0x14')](_0x365e72[_0x4bf0('0x15')]);if(_0x365e72 instanceof RangeError){if(_0x365e72['name']){delete _0x365e72[_0x4bf0('0x16')];}_0x8d8802[_0x4bf0('0x17')](0x194)[_0x4bf0('0x18')](_0x365e72);}else{if(_0x365e72['name']){delete _0x365e72['name'];}_0x8d8802[_0x4bf0('0x17')](0x1f4)['send'](_0x365e72);}};}function checkError(){return function(_0x25a1d1){if(!_0x25a1d1){throw new RangeError(_0x4bf0('0x19'));}return _0x25a1d1;};}function respondWithRpcPromise(_0x5e3fdd,_0x1c269c){return new BPromise(function(_0x488b71,_0x4a5be8){var _0x35cbee=amiClient;return _0x35cbee['request'](_0x5e3fdd,_0x1c269c)[_0x4bf0('0x1a')](function(_0x4c2835){if(_0x4c2835[_0x4bf0('0x14')]){if(_0x4c2835[_0x4bf0('0x14')][_0x4bf0('0x1b')]===0x1f4){return _0x4a5be8(_0x4c2835['error'][_0x4bf0('0x1c')]);}return _0x488b71(_0x4c2835[_0x4bf0('0x14')][_0x4bf0('0x1c')]);}else{_0x488b71(_0x4c2835[_0x4bf0('0x1d')]);}})[_0x4bf0('0x1e')](function(_0x2ec628){_0x4a5be8(_0x2ec628);});});}function getAgent(_0x3b535f){return db[_0x4bf0('0x1f')][_0x4bf0('0x20')]({'where':{'id':_0x3b535f,'role':'agent'}})[_0x4bf0('0x1a')](checkError());}function getAgentCheckSession(_0xd86467,_0x4af1cd){return new BPromise(function(_0x1d4e37,_0x4d8e60){var _0x2773da=respondWithRpcPromise(_0x4bf0('0x21'));var _0x4de014=getAgent(_0xd86467);Promise[_0x4bf0('0x22')]([_0x2773da,_0x4de014])[_0x4bf0('0x1a')](function(_0x479cdf){var _0x4e53f2=_0x479cdf[0x0];var _0x5dda42=_0x479cdf[0x1];var _0x332a66=_[_0x4bf0('0x23')](_0x4e53f2[_0x4bf0('0x24')],function(_0x25909){return _0x25909[_0x4bf0('0x25')]==_0x5dda42['id']&&_0x25909[_0x4bf0('0x26')]==_0x4af1cd;});if(_0x332a66[_0x4bf0('0x27')]==0x1){_0x1d4e37(_0x5dda42);}else{_0x4d8e60(new RangeError(_0x4bf0('0x28')+_0x4af1cd+_0x4bf0('0x29')));}});});}exports['originate']=function(_0x2abc1e,_0x1868e4){logger[_0x4bf0('0x2a')](_0x4bf0('0x2b'),_0x2abc1e[_0x4bf0('0x2c')]);var _0x522b80=originateValidation[_0x4bf0('0xb')](_0x2abc1e[_0x4bf0('0x2c')]);if(_0x522b80[_0x4bf0('0x27')]>0x0){return _0x1868e4[_0x4bf0('0x17')](0x190)['json'](_0x522b80);}var _0x18c916=_0x2abc1e[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x22ad76=_0x2abc1e['body']['callNumber'];var _0x5f4b85=_0x2abc1e[_0x4bf0('0x2c')][_0x4bf0('0x2e')];var _0x3cdf5f=_0x2abc1e[_0x4bf0('0x2c')][_0x4bf0('0x2f')];return getAgent(_0x18c916)[_0x4bf0('0x1a')](function(_0x2c6d89){logger['info'](_0x4bf0('0x30'),_0x2c6d89[_0x4bf0('0x16')]);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x2c6d89[_0x4bf0('0x16')]),'webbar:originate',{'callNumber':_0x22ad76,'callerId':_0x5f4b85,'callbackUrl':_0x3cdf5f});return _0x1868e4[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'error':![],'message':_0x4bf0('0x34')});})['catch'](handleError(_0x1868e4));};exports[_0x4bf0('0x35')]=function(_0x2ba575,_0x578ca9){logger[_0x4bf0('0x2a')](_0x4bf0('0x36'),_0x2ba575['body']);var _0x34f478=hangupValidation['validate'](_0x2ba575['body']);if(_0x34f478[_0x4bf0('0x27')]>0x0){return _0x578ca9['status'](0x190)[_0x4bf0('0x33')](_0x34f478);}var _0x59bb06=_0x2ba575[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x218c32=_0x2ba575[_0x4bf0('0x2c')]['sessionId'];return getAgent(_0x59bb06)[_0x4bf0('0x1a')](function(_0x493da4){logger['info'](_0x4bf0('0x30'),_0x493da4[_0x4bf0('0x16')]);emit(util['format'](_0x4bf0('0x32'),_0x493da4[_0x4bf0('0x16')]),'webbar:hangup',{'sessionId':_0x218c32});return _0x578ca9[_0x4bf0('0x17')](0xc8)['json']({'error':![],'message':_0x4bf0('0x37')});})[_0x4bf0('0x1e')](handleError(_0x578ca9));};exports[_0x4bf0('0x38')]=function(_0xc31c13,_0x13ca49){logger['info']('answer\x20fired:',_0xc31c13['body']);var _0x458911=answerValidation['validate'](_0xc31c13[_0x4bf0('0x2c')]);if(_0x458911[_0x4bf0('0x27')]>0x0){return _0x13ca49['status'](0x190)[_0x4bf0('0x33')](_0x458911);}var _0x564c5a=_0xc31c13[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x3b02c5=_0xc31c13[_0x4bf0('0x2c')][_0x4bf0('0x26')];return getAgent(_0x564c5a)[_0x4bf0('0x1a')](function(_0x422b63){logger[_0x4bf0('0x2a')](_0x4bf0('0x30'),_0x422b63[_0x4bf0('0x16')]);emit(util[_0x4bf0('0x31')]('user:%s',_0x422b63[_0x4bf0('0x16')]),_0x4bf0('0x39'),{'sessionId':_0x3b02c5});return _0x13ca49[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'error':![],'message':_0x4bf0('0x3a')});})[_0x4bf0('0x1e')](handleError(_0x13ca49));};exports[_0x4bf0('0x3b')]=function(_0x3ed00b,_0x47521f){logger[_0x4bf0('0x2a')]('hold\x20fired:',_0x3ed00b[_0x4bf0('0x2c')]);var _0x622e4b=holdValidation[_0x4bf0('0xb')](_0x3ed00b[_0x4bf0('0x2c')]);if(_0x622e4b[_0x4bf0('0x27')]>0x0){return _0x47521f[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x622e4b);}var _0x5c5157=_0x3ed00b[_0x4bf0('0x2c')]['userId'];var _0x254a8d=_0x3ed00b[_0x4bf0('0x2c')][_0x4bf0('0x26')];return getAgent(_0x5c5157)[_0x4bf0('0x1a')](function(_0x52dc0){logger['info'](_0x4bf0('0x30'),_0x52dc0['name']);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x52dc0[_0x4bf0('0x16')]),_0x4bf0('0x3c'),{'sessionId':_0x254a8d});return _0x47521f[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x47521f));};exports[_0x4bf0('0x3d')]=function(_0x4209a5,_0xd3611c){logger[_0x4bf0('0x2a')](_0x4bf0('0x3e'),_0x4209a5['body']);var _0x566fe9=unholdValidation[_0x4bf0('0xb')](_0x4209a5['body']);if(_0x566fe9[_0x4bf0('0x27')]>0x0){return _0xd3611c[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x566fe9);}var _0x24af84=_0x4209a5[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x274a31=_0x4209a5[_0x4bf0('0x2c')]['sessionId'];return getAgent(_0x24af84)[_0x4bf0('0x1a')](function(_0x3e4755){logger[_0x4bf0('0x2a')](_0x4bf0('0x30'),_0x3e4755[_0x4bf0('0x16')]);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x3e4755[_0x4bf0('0x16')]),_0x4bf0('0x3f'),{'sessionId':_0x274a31});return _0xd3611c['status'](0xc8)[_0x4bf0('0x33')]({'error':![],'message':'unhold\x20executed!'});})[_0x4bf0('0x1e')](handleError(_0xd3611c));};exports['calls']=function(_0x1f3df3,_0x5150c0){logger[_0x4bf0('0x2a')](_0x4bf0('0x40'),_0x5150c0[_0x4bf0('0x2c')]);var _0x311ad4=callsValidation[_0x4bf0('0xb')](_0x1f3df3['body']);if(_0x311ad4['length']>0x0){return _0x5150c0[_0x4bf0('0x17')](0x190)['json'](_0x311ad4);}var _0x3c26b5=_0x1f3df3['body']['userId'];var _0x2a4550=respondWithRpcPromise('VoiceChannels');var _0x560064=getAgent(_0x3c26b5);return Promise[_0x4bf0('0x22')]([_0x2a4550,_0x560064])['then'](function(_0x243527){var _0x293ff0=_0x243527[0x0];var _0x502bfa=_0x243527[0x1];var _0x57b45f=_[_0x4bf0('0x23')](_0x293ff0[_0x4bf0('0x24')],function(_0xbf04f7){return _0xbf04f7['UserId']==_0x502bfa['id'];});return _0x5150c0[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'count':_0x57b45f[_0x4bf0('0x27')],'rows':_0x57b45f});})['catch'](handleError(_0x5150c0));};exports[_0x4bf0('0x41')]=function(_0x1a625a,_0x3d4863){logger[_0x4bf0('0x2a')](_0x4bf0('0x42'),_0x1a625a[_0x4bf0('0x2c')]);var _0x3a1b0b=conferenceValidation[_0x4bf0('0xb')](_0x1a625a['body']);if(_0x3a1b0b['length']>0x0){return _0x3d4863[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x3a1b0b);}var _0x33834c=_0x1a625a[_0x4bf0('0x2c')][_0x4bf0('0x2d')];return getAgent(_0x33834c)['then'](function(_0x164288){logger[_0x4bf0('0x2a')](_0x4bf0('0x30'),_0x164288['name']);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x164288['name']),_0x4bf0('0x43'));return _0x3d4863[_0x4bf0('0x17')](0xc8)['json']({'error':![],'message':_0x4bf0('0x44')});})[_0x4bf0('0x1e')](handleError(_0x3d4863));};exports[_0x4bf0('0x45')]=function(_0x4ec516,_0x23afd1){logger[_0x4bf0('0x2a')](_0x4bf0('0x46'),_0x4ec516[_0x4bf0('0x2c')]);var _0x2cdee4=transferValidation[_0x4bf0('0xb')](_0x4ec516['body']);if(_0x2cdee4['length']>0x0){return _0x23afd1[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x2cdee4);}var _0x531808=_0x4ec516[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x37aef7=_0x4ec516[_0x4bf0('0x2c')][_0x4bf0('0x26')];var _0x1d8843=_0x4ec516[_0x4bf0('0x2c')]['transferNumber'];return getAgent(_0x531808)[_0x4bf0('0x1a')](function(_0x3ba6c5){logger[_0x4bf0('0x2a')]('entityFound:',_0x3ba6c5['name']);emit(util['format'](_0x4bf0('0x32'),_0x3ba6c5[_0x4bf0('0x16')]),_0x4bf0('0x47'),{'sessionId':_0x37aef7,'transferNumber':_0x1d8843});return _0x23afd1['status'](0xc8)[_0x4bf0('0x33')]({'error':![],'message':_0x4bf0('0x48')});})[_0x4bf0('0x1e')](handleError(_0x23afd1));}; \ No newline at end of file +var _0x05c2=['validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','send','request','then','error','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','catch','hangup','userId','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','UserId','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','path','lodash','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter'];(function(_0x44b9f5,_0x2d4c9e){var _0x9550f7=function(_0x532be0){while(--_0x532be0){_0x44b9f5['push'](_0x44b9f5['shift']());}};_0x9550f7(++_0x2d4c9e);}(_0x05c2,0x174));var _0x205c=function(_0x19fd4e,_0xcbad06){_0x19fd4e=_0x19fd4e-0x0;var _0x35bab3=_0x05c2[_0x19fd4e];return _0x35bab3;};'use strict';var path=require(_0x205c('0x0'));var fs=require('fs');var _=require(_0x205c('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x205c('0x2'));var util=require(_0x205c('0x3'));var BPromise=require(_0x205c('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x205c('0x5')][_0x205c('0x6')]({'port':0x232a});var logger=require(_0x205c('0x7'))(_0x205c('0x8'));var Redis=require(_0x205c('0x9'));config[_0x205c('0xa')]=_['defaults'](config[_0x205c('0xa')],{'host':_0x205c('0xb'),'port':0x18eb});var io=require(_0x205c('0xc'))(new Redis(config[_0x205c('0xa')]));var Schema=require(_0x205c('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x205c('0xe')]},'callNumber':{'type':_0x205c('0xf'),'required':[!![],_0x205c('0x10')]},'callerId':{'type':_0x205c('0xf')},'callbackUrl':{'type':_0x205c('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x205c('0x11'),'required':[!![],_0x205c('0xe')]},'sessionId':{'type':_0x205c('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x205c('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x205c('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x205c('0xf'),'required':[!![],_0x205c('0x12')]},'transferNumber':{'type':_0x205c('0xf'),'required':[!![],_0x205c('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x205c('0x11'),'required':[!![],_0x205c('0xe')]},'sessionId':{'type':_0x205c('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x205c('0x11'),'required':[!![],_0x205c('0xe')]},'sessionId':{'type':_0x205c('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x205c('0x11'),'required':[!![],_0x205c('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x205c('0x11'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x84c0b2,_0x14dc00,_0x4c2b73){logger[_0x205c('0x14')](_0x84c0b2,_0x14dc00,JSON[_0x205c('0x15')](_0x4c2b73));io['to'](_0x84c0b2)[_0x205c('0x16')](_0x14dc00,_0x4c2b73);}function handleError(_0x3d9e5a){return function(_0x3af718){console[_0x205c('0x17')](_0x205c('0x18'),_0x3af718,_0x3af718 instanceof RangeError);logger['error'](_0x3af718[_0x205c('0x19')]);if(_0x3af718 instanceof RangeError){if(_0x3af718['name']){delete _0x3af718[_0x205c('0x1a')];}_0x3d9e5a[_0x205c('0x1b')](0x194)[_0x205c('0x1c')](_0x3af718);}else{if(_0x3af718[_0x205c('0x1a')]){delete _0x3af718[_0x205c('0x1a')];}_0x3d9e5a[_0x205c('0x1b')](0x1f4)[_0x205c('0x1c')](_0x3af718);}};}function checkError(){return function(_0x80a8ab){if(!_0x80a8ab){throw new RangeError('NotFound');}return _0x80a8ab;};}function respondWithRpcPromise(_0xc1ec3b,_0x4f688f){return new BPromise(function(_0x3f4975,_0x212d0d){var _0x3eb928=amiClient;return _0x3eb928[_0x205c('0x1d')](_0xc1ec3b,_0x4f688f)[_0x205c('0x1e')](function(_0x13f907){if(_0x13f907[_0x205c('0x1f')]){if(_0x13f907['error'][_0x205c('0x20')]===0x1f4){return _0x212d0d(_0x13f907['error'][_0x205c('0x21')]);}return _0x3f4975(_0x13f907[_0x205c('0x1f')]['message']);}else{_0x3f4975(_0x13f907[_0x205c('0x22')]);}})['catch'](function(_0x2227cd){_0x212d0d(_0x2227cd);});});}function getAgent(_0x1f928d){return db[_0x205c('0x23')][_0x205c('0x24')]({'where':{'id':_0x1f928d,'role':_0x205c('0x25')}})[_0x205c('0x1e')](checkError());}function getAgentCheckSession(_0x5a639d,_0x2a41b3){return new BPromise(function(_0x188719,_0x5be9b3){var _0x4b1ae2=respondWithRpcPromise(_0x205c('0x26'));var _0x26ddd1=getAgent(_0x5a639d);Promise[_0x205c('0x27')]([_0x4b1ae2,_0x26ddd1])['then'](function(_0x51db2d){var _0x28df2e=_0x51db2d[0x0];var _0xaca540=_0x51db2d[0x1];var _0x23d063=_[_0x205c('0x28')](_0x28df2e[_0x205c('0x29')],function(_0x427744){return _0x427744['UserId']==_0xaca540['id']&&_0x427744[_0x205c('0x2a')]==_0x2a41b3;});if(_0x23d063[_0x205c('0x2b')]==0x1){_0x188719(_0xaca540);}else{_0x5be9b3(new RangeError(_0x205c('0x2c')+_0x2a41b3+_0x205c('0x2d')));}});});}exports[_0x205c('0x2e')]=function(_0x49b573,_0x4a386d){logger['info'](_0x205c('0x2f'),_0x49b573['body']);var _0x20d6c6=originateValidation[_0x205c('0xd')](_0x49b573[_0x205c('0x30')]);if(_0x20d6c6['length']>0x0){return _0x4a386d[_0x205c('0x1b')](0x190)[_0x205c('0x31')](_0x20d6c6);}var _0x1b4194=_0x49b573[_0x205c('0x30')]['userId'];var _0x5b21a6=_0x49b573[_0x205c('0x30')][_0x205c('0x32')];var _0x570297=_0x49b573[_0x205c('0x30')]['callerId'];var _0xd312f2=_0x49b573['body'][_0x205c('0x33')];return getAgent(_0x1b4194)[_0x205c('0x1e')](function(_0xf5f97c){logger['info'](_0x205c('0x34'),_0xf5f97c[_0x205c('0x1a')]);emit(util[_0x205c('0x35')]('user:%s',_0xf5f97c[_0x205c('0x1a')]),_0x205c('0x36'),{'callNumber':_0x5b21a6,'callerId':_0x570297,'callbackUrl':_0xd312f2});return _0x4a386d[_0x205c('0x1b')](0xc8)[_0x205c('0x31')]({'error':![],'message':_0x205c('0x37')});})[_0x205c('0x38')](handleError(_0x4a386d));};exports[_0x205c('0x39')]=function(_0x37a210,_0x156d5a){logger[_0x205c('0x14')]('hangup\x20fired:',_0x37a210[_0x205c('0x30')]);var _0x565612=hangupValidation['validate'](_0x37a210['body']);if(_0x565612['length']>0x0){return _0x156d5a[_0x205c('0x1b')](0x190)[_0x205c('0x31')](_0x565612);}var _0x1fcc7b=_0x37a210['body'][_0x205c('0x3a')];var _0x2bdcc8=_0x37a210['body']['sessionId'];return getAgent(_0x1fcc7b)[_0x205c('0x1e')](function(_0x61dad3){logger['info'](_0x205c('0x34'),_0x61dad3['name']);emit(util[_0x205c('0x35')](_0x205c('0x3b'),_0x61dad3[_0x205c('0x1a')]),_0x205c('0x3c'),{'sessionId':_0x2bdcc8});return _0x156d5a[_0x205c('0x1b')](0xc8)[_0x205c('0x31')]({'error':![],'message':_0x205c('0x3d')});})[_0x205c('0x38')](handleError(_0x156d5a));};exports[_0x205c('0x3e')]=function(_0x257805,_0x5acefe){logger['info'](_0x205c('0x3f'),_0x257805[_0x205c('0x30')]);var _0x5dfe37=answerValidation[_0x205c('0xd')](_0x257805[_0x205c('0x30')]);if(_0x5dfe37[_0x205c('0x2b')]>0x0){return _0x5acefe['status'](0x190)[_0x205c('0x31')](_0x5dfe37);}var _0x2d9bee=_0x257805[_0x205c('0x30')]['userId'];var _0xb3e913=_0x257805['body'][_0x205c('0x2a')];return getAgent(_0x2d9bee)['then'](function(_0x501b45){logger[_0x205c('0x14')](_0x205c('0x34'),_0x501b45[_0x205c('0x1a')]);emit(util[_0x205c('0x35')]('user:%s',_0x501b45[_0x205c('0x1a')]),_0x205c('0x40'),{'sessionId':_0xb3e913});return _0x5acefe['status'](0xc8)[_0x205c('0x31')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x5acefe));};exports['hold']=function(_0x61fa8f,_0x278e2b){logger[_0x205c('0x14')]('hold\x20fired:',_0x61fa8f['body']);var _0x5c2d31=holdValidation[_0x205c('0xd')](_0x61fa8f[_0x205c('0x30')]);if(_0x5c2d31[_0x205c('0x2b')]>0x0){return _0x278e2b['status'](0x190)[_0x205c('0x31')](_0x5c2d31);}var _0x5f053b=_0x61fa8f[_0x205c('0x30')][_0x205c('0x3a')];var _0x1a1046=_0x61fa8f[_0x205c('0x30')][_0x205c('0x2a')];return getAgent(_0x5f053b)['then'](function(_0x26a97a){logger['info'](_0x205c('0x34'),_0x26a97a[_0x205c('0x1a')]);emit(util[_0x205c('0x35')](_0x205c('0x3b'),_0x26a97a['name']),'webbar:hold',{'sessionId':_0x1a1046});return _0x278e2b[_0x205c('0x1b')](0xc8)[_0x205c('0x31')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x278e2b));};exports[_0x205c('0x41')]=function(_0x288636,_0x308d64){logger[_0x205c('0x14')](_0x205c('0x42'),_0x288636['body']);var _0x3553d1=unholdValidation[_0x205c('0xd')](_0x288636['body']);if(_0x3553d1['length']>0x0){return _0x308d64['status'](0x190)[_0x205c('0x31')](_0x3553d1);}var _0x2c0108=_0x288636[_0x205c('0x30')][_0x205c('0x3a')];var _0x151938=_0x288636[_0x205c('0x30')][_0x205c('0x2a')];return getAgent(_0x2c0108)['then'](function(_0x5e41a0){logger[_0x205c('0x14')](_0x205c('0x34'),_0x5e41a0['name']);emit(util[_0x205c('0x35')](_0x205c('0x3b'),_0x5e41a0[_0x205c('0x1a')]),_0x205c('0x43'),{'sessionId':_0x151938});return _0x308d64[_0x205c('0x1b')](0xc8)[_0x205c('0x31')]({'error':![],'message':_0x205c('0x44')});})['catch'](handleError(_0x308d64));};exports[_0x205c('0x45')]=function(_0x4b7700,_0x2ad356){logger[_0x205c('0x14')]('calls\x20fired:',_0x2ad356[_0x205c('0x30')]);var _0x16a4e6=callsValidation[_0x205c('0xd')](_0x4b7700[_0x205c('0x30')]);if(_0x16a4e6[_0x205c('0x2b')]>0x0){return _0x2ad356['status'](0x190)['json'](_0x16a4e6);}var _0x1806db=_0x4b7700[_0x205c('0x30')][_0x205c('0x3a')];var _0x158b26=respondWithRpcPromise(_0x205c('0x26'));var _0x53727a=getAgent(_0x1806db);return Promise['all']([_0x158b26,_0x53727a])[_0x205c('0x1e')](function(_0x5ed64f){var _0x1183c6=_0x5ed64f[0x0];var _0x1f087c=_0x5ed64f[0x1];var _0x5cb431=_[_0x205c('0x28')](_0x1183c6['rows'],function(_0x45e4a1){return _0x45e4a1[_0x205c('0x46')]==_0x1f087c['id'];});return _0x2ad356[_0x205c('0x1b')](0xc8)['json']({'count':_0x5cb431[_0x205c('0x2b')],'rows':_0x5cb431});})['catch'](handleError(_0x2ad356));};exports[_0x205c('0x47')]=function(_0x5089c4,_0x202045){logger[_0x205c('0x14')](_0x205c('0x48'),_0x5089c4[_0x205c('0x30')]);var _0x34cc0f=conferenceValidation[_0x205c('0xd')](_0x5089c4[_0x205c('0x30')]);if(_0x34cc0f[_0x205c('0x2b')]>0x0){return _0x202045[_0x205c('0x1b')](0x190)[_0x205c('0x31')](_0x34cc0f);}var _0x41b965=_0x5089c4[_0x205c('0x30')]['userId'];return getAgent(_0x41b965)[_0x205c('0x1e')](function(_0x5bd3c6){logger[_0x205c('0x14')](_0x205c('0x34'),_0x5bd3c6[_0x205c('0x1a')]);emit(util[_0x205c('0x35')]('user:%s',_0x5bd3c6[_0x205c('0x1a')]),'webbar:conference');return _0x202045[_0x205c('0x1b')](0xc8)['json']({'error':![],'message':_0x205c('0x49')});})[_0x205c('0x38')](handleError(_0x202045));};exports[_0x205c('0x4a')]=function(_0x1ba9ce,_0x779f97){logger[_0x205c('0x14')](_0x205c('0x4b'),_0x1ba9ce[_0x205c('0x30')]);var _0xbbc541=transferValidation['validate'](_0x1ba9ce[_0x205c('0x30')]);if(_0xbbc541[_0x205c('0x2b')]>0x0){return _0x779f97[_0x205c('0x1b')](0x190)[_0x205c('0x31')](_0xbbc541);}var _0x5c382e=_0x1ba9ce[_0x205c('0x30')][_0x205c('0x3a')];var _0x2b3288=_0x1ba9ce[_0x205c('0x30')]['sessionId'];var _0x45dae6=_0x1ba9ce[_0x205c('0x30')]['transferNumber'];return getAgent(_0x5c382e)['then'](function(_0x4d2317){logger[_0x205c('0x14')]('entityFound:',_0x4d2317[_0x205c('0x1a')]);emit(util[_0x205c('0x35')]('user:%s',_0x4d2317[_0x205c('0x1a')]),_0x205c('0x4c'),{'sessionId':_0x2b3288,'transferNumber':_0x45dae6});return _0x779f97[_0x205c('0x1b')](0xc8)[_0x205c('0x31')]({'error':![],'message':'transfer\x20executed!'});})[_0x205c('0x38')](handleError(_0x779f97));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b314ccc..f2affe4 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 _0x6cd9=['show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6cd9,0x9e));var _0x96cd=function(_0xb1157a,_0x2d5b6){_0xb1157a=_0xb1157a-0x0;var _0x23a37b=_0x6cd9[_0xb1157a];return _0x23a37b;};'use strict';var multer=require(_0x96cd('0x0'));var util=require('util');var path=require(_0x96cd('0x1'));var timeout=require('connect-timeout');var express=require(_0x96cd('0x2'));var router=express[_0x96cd('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x96cd('0x4'));var config=require(_0x96cd('0x5'));var controller=require(_0x96cd('0x6'));router[_0x96cd('0x7')]('/',auth['isAuthenticated'](),controller[_0x96cd('0x8')]);router['get'](_0x96cd('0x9'),auth[_0x96cd('0xa')](),controller['describe']);router[_0x96cd('0x7')](_0x96cd('0xb'),auth[_0x96cd('0xa')](),controller[_0x96cd('0xc')]);router[_0x96cd('0x7')](_0x96cd('0xd'),auth[_0x96cd('0xa')](),controller[_0x96cd('0xe')]);router[_0x96cd('0x7')](_0x96cd('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x96cd('0x7')](_0x96cd('0x10'),auth[_0x96cd('0xa')](),controller[_0x96cd('0x11')]);router[_0x96cd('0x7')](_0x96cd('0x12'),auth[_0x96cd('0xa')](),controller[_0x96cd('0x13')]);router[_0x96cd('0x14')]('/',auth['isAuthenticated'](),controller[_0x96cd('0x15')]);router[_0x96cd('0x14')](_0x96cd('0xd'),auth[_0x96cd('0xa')](),controller[_0x96cd('0x16')]);router[_0x96cd('0x14')](_0x96cd('0xf'),auth[_0x96cd('0xa')](),controller['addAnswer']);router[_0x96cd('0x14')](_0x96cd('0x10'),auth['isAuthenticated'](),controller[_0x96cd('0x17')]);router[_0x96cd('0x14')]('/:id/applications',auth['isAuthenticated'](),controller[_0x96cd('0x18')]);router['post'](_0x96cd('0x19'),controller[_0x96cd('0x1a')]);router[_0x96cd('0x14')]('/:id/send',auth[_0x96cd('0xa')](),controller[_0x96cd('0x1b')]);router[_0x96cd('0x1c')](_0x96cd('0xb'),auth[_0x96cd('0xa')](),controller['update']);router['delete'](_0x96cd('0xb'),auth['isAuthenticated'](),controller[_0x96cd('0x1d')]);router[_0x96cd('0x1e')](_0x96cd('0xd'),auth['isAuthenticated'](),controller[_0x96cd('0x1f')]);router[_0x96cd('0x1e')]('/:id/canned_answers',auth[_0x96cd('0xa')](),controller[_0x96cd('0x20')]);router[_0x96cd('0x1e')](_0x96cd('0x10'),auth[_0x96cd('0xa')](),controller['removeAgents']);module[_0x96cd('0x21')]=router; \ No newline at end of file +var _0x20c6=['put','/:id','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','getApplications','create','addDisposition','post','addAnswer','/:id/users','addAgents','/:id/applications','/:id/notify','notify','/:id/send','send'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x20c6,0xa7));var _0x620c=function(_0x2ec83c,_0x48a61b){_0x2ec83c=_0x2ec83c-0x0;var _0x39c721=_0x20c6[_0x2ec83c];return _0x39c721;};'use strict';var multer=require(_0x620c('0x0'));var util=require(_0x620c('0x1'));var path=require(_0x620c('0x2'));var timeout=require(_0x620c('0x3'));var express=require(_0x620c('0x4'));var router=express[_0x620c('0x5')]();var fs_extra=require(_0x620c('0x6'));var auth=require(_0x620c('0x7'));var interaction=require(_0x620c('0x8'));var config=require(_0x620c('0x9'));var controller=require(_0x620c('0xa'));router[_0x620c('0xb')]('/',auth[_0x620c('0xc')](),controller[_0x620c('0xd')]);router['get']('/describe',auth[_0x620c('0xc')](),controller[_0x620c('0xe')]);router[_0x620c('0xb')]('/:id',auth[_0x620c('0xc')](),controller[_0x620c('0xf')]);router[_0x620c('0xb')](_0x620c('0x10'),auth['isAuthenticated'](),controller[_0x620c('0x11')]);router[_0x620c('0xb')](_0x620c('0x12'),auth[_0x620c('0xc')](),controller[_0x620c('0x13')]);router[_0x620c('0xb')]('/:id/users',auth[_0x620c('0xc')](),controller[_0x620c('0x14')]);router[_0x620c('0xb')]('/:id/applications',auth[_0x620c('0xc')](),controller[_0x620c('0x15')]);router['post']('/',auth[_0x620c('0xc')](),controller[_0x620c('0x16')]);router['post'](_0x620c('0x10'),auth['isAuthenticated'](),controller[_0x620c('0x17')]);router[_0x620c('0x18')]('/:id/canned_answers',auth[_0x620c('0xc')](),controller[_0x620c('0x19')]);router[_0x620c('0x18')](_0x620c('0x1a'),auth[_0x620c('0xc')](),controller[_0x620c('0x1b')]);router[_0x620c('0x18')](_0x620c('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router[_0x620c('0x18')](_0x620c('0x1d'),controller[_0x620c('0x1e')]);router[_0x620c('0x18')](_0x620c('0x1f'),auth[_0x620c('0xc')](),controller[_0x620c('0x20')]);router[_0x620c('0x21')](_0x620c('0x22'),auth[_0x620c('0xc')](),controller[_0x620c('0x23')]);router[_0x620c('0x24')](_0x620c('0x22'),auth['isAuthenticated'](),controller[_0x620c('0x25')]);router[_0x620c('0x24')](_0x620c('0x10'),auth[_0x620c('0xc')](),controller[_0x620c('0x26')]);router[_0x620c('0x24')](_0x620c('0x12'),auth[_0x620c('0xc')](),controller['removeAnswers']);router[_0x620c('0x24')](_0x620c('0x1a'),auth[_0x620c('0xc')](),controller[_0x620c('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 48a7a0a..09c760d 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 _0xa30c=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','ENUM','twilio','TEXT','BOOLEAN'];(function(_0x1c34f9,_0x580b8a){var _0x23fcab=function(_0x2530ce){while(--_0x2530ce){_0x1c34f9['push'](_0x1c34f9['shift']());}};_0x23fcab(++_0x580b8a);}(_0xa30c,0x171));var _0xca30=function(_0x4e213e,_0x1823f4){_0x4e213e=_0x4e213e-0x0;var _0x430575=_0xa30c[_0x4e213e];return _0x430575;};'use strict';var Sequelize=require(_0xca30('0x0'));var rs=require(_0xca30('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xca30('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xca30('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xca30('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xca30('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xca30('0x3')]},'type':{'type':Sequelize[_0xca30('0x4')](_0xca30('0x5'))},'accountSid':{'type':Sequelize[_0xca30('0x3')]},'authToken':{'type':Sequelize[_0xca30('0x3')]},'notificationTemplate':{'type':Sequelize[_0xca30('0x6')],'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[_0xca30('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xca30('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xca30('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xca30('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xca30('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xca30('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xca30('0x7')],'defaultValue':![],'comment':_0xca30('0x9'),'set':function(_0xa6dc4e){if(!_0xa6dc4e){this[_0xca30('0xa')](_0xca30('0xb'),null);}this[_0xca30('0xa')](_0xca30('0xc'),_0xa6dc4e);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x626e=['exports','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x626e,0xee));var _0xe626=function(_0x466a1e,_0x32729c){_0x466a1e=_0x466a1e-0x0;var _0x3f4654=_0x626e[_0x466a1e];return _0x3f4654;};'use strict';var Sequelize=require(_0xe626('0x0'));var rs=require(_0xe626('0x1'));module[_0xe626('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xe626('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xe626('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe626('0x3')],'defaultValue':function(){return rs[_0xe626('0x4')]();}},'phone':{'type':Sequelize[_0xe626('0x3')]},'type':{'type':Sequelize[_0xe626('0x5')](_0xe626('0x6'))},'accountSid':{'type':Sequelize[_0xe626('0x3')]},'authToken':{'type':Sequelize[_0xe626('0x3')]},'notificationTemplate':{'type':Sequelize[_0xe626('0x7')],'defaultValue':function(){return _0xe626('0x8');}},'notificationSound':{'type':Sequelize[_0xe626('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe626('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe626('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe626('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe626('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe626('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe626('0xa')],'comment':_0xe626('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe626('0xc'),'set':function(_0x160943){if(!_0x160943){this[_0xe626('0xd')](_0xe626('0xe'),null);}this['setDataValue']('mandatoryDisposition',_0x160943);}},'description':{'type':Sequelize[_0xe626('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 17037c7..415fd3e 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 _0xae7b=['send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','client','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','render','merge','body','contact','agent','account','Pause','map','WhatsappAccount','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','show','params','mandatoryDispositionPause','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','CannedAnswer','getAnswers','includeAll','rows','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','applications','orderBy','Applications','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','From','replace','Body','MessageSid','from','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','Contacts','DESC','WhatsappInteraction','interaction','push','close','unmanaged','created','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml'];(function(_0x53744c,_0x210eb9){var _0x469a08=function(_0x2ffbf1){while(--_0x2ffbf1){_0x53744c['push'](_0x53744c['shift']());}};_0x469a08(++_0x210eb9);}(_0xae7b,0xbe));var _0xbae7=function(_0x24e2fe,_0x17b452){_0x24e2fe=_0x24e2fe-0x0;var _0x349218=_0xae7b[_0x24e2fe];return _0x349218;};'use strict';var emlformat=require(_0xbae7('0x0'));var rimraf=require(_0xbae7('0x1'));var zipdir=require(_0xbae7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbae7('0x3'));var BPromise=require(_0xbae7('0x4'));var Mustache=require(_0xbae7('0x5'));var util=require(_0xbae7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbae7('0x7'));var ejs=require(_0xbae7('0x8'));var fs=require('fs');var fs_extra=require(_0xbae7('0x9'));var _=require('lodash');var squel=require(_0xbae7('0xa'));var crypto=require('crypto');var jsforce=require(_0xbae7('0xb'));var deskjs=require(_0xbae7('0xc'));var toCsv=require(_0xbae7('0x7'));var querystring=require('querystring');var Papa=require(_0xbae7('0xd'));var Redis=require('ioredis');var authService=require(_0xbae7('0xe'));var qs=require(_0xbae7('0xf'));var as=require(_0xbae7('0x10'));var hardwareService=require(_0xbae7('0x11'));var logger=require('../../config/logger')(_0xbae7('0x12'));var utils=require(_0xbae7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbae7('0x14'));var db=require('../../mysqldb')['db'];config[_0xbae7('0x15')]=_[_0xbae7('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbae7('0x17'))(new Redis(config[_0xbae7('0x15')]));require(_0xbae7('0x18'))[_0xbae7('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbae7('0x1a')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5aae99,_0x249669,_0xb272c4,_0x1b9ee1){return new BPromise(function(_0x181512,_0x241b80){var _0x2d41e4=_0x1b9ee1||client;return _0x2d41e4['request'](_0x5aae99,_0xb272c4)[_0xbae7('0x1b')](function(_0x450c85){logger[_0xbae7('0x1c')](_0xbae7('0x1d'),_0x249669,_0xbae7('0x1e'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x249669,'request\x20sent',JSON[_0xbae7('0x1f')](_0x450c85));if(_0x450c85[_0xbae7('0x20')]){if(_0x450c85[_0xbae7('0x20')][_0xbae7('0x21')]===0x1f4){logger[_0xbae7('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x249669,_0x450c85[_0xbae7('0x20')][_0xbae7('0x22')]);return _0x241b80(_0x450c85[_0xbae7('0x20')][_0xbae7('0x22')]);}logger[_0xbae7('0x20')](_0xbae7('0x1d'),_0x249669,_0x450c85[_0xbae7('0x20')][_0xbae7('0x22')]);return _0x181512(_0x450c85[_0xbae7('0x20')][_0xbae7('0x22')]);}else{logger[_0xbae7('0x1c')](_0xbae7('0x1d'),_0x249669,_0xbae7('0x1e'));_0x181512(_0x450c85['result']['message']);}})[_0xbae7('0x23')](function(_0x3bedda){logger[_0xbae7('0x20')](_0xbae7('0x1d'),_0x249669,_0x3bedda);_0x241b80(_0x3bedda);});});}function respondWithStatusCode(_0x61170a,_0x3e003d){_0x3e003d=_0x3e003d||0xcc;return function(_0x410360){if(_0x410360){return _0x61170a[_0xbae7('0x24')](_0x3e003d);}return _0x61170a[_0xbae7('0x25')](_0x3e003d)[_0xbae7('0x26')]();};}function respondWithResult(_0x3df1f1,_0x3523f0){_0x3523f0=_0x3523f0||0xc8;return function(_0x47eb5d){if(_0x47eb5d){return _0x3df1f1['status'](_0x3523f0)['json'](_0x47eb5d);}};}function respondWithFilteredResult(_0xa60a1c,_0x105a50){return function(_0x203848){if(_0x203848){var _0x12dd23=typeof _0x105a50[_0xbae7('0x27')]===_0xbae7('0x28')&&typeof _0x105a50['limit']==='undefined';var _0x41d4fa=_0x203848[_0xbae7('0x29')];var _0x34feff=_0x12dd23?0x0:_0x105a50[_0xbae7('0x27')];var _0xcee3dd=_0x12dd23?_0x203848[_0xbae7('0x29')]:_0x105a50['offset']+_0x105a50[_0xbae7('0x2a')];var _0x33a435;if(_0xcee3dd>=_0x41d4fa){_0xcee3dd=_0x41d4fa;_0x33a435=0xc8;}else{_0x33a435=0xce;}_0xa60a1c[_0xbae7('0x25')](_0x33a435);return _0xa60a1c[_0xbae7('0x2b')](_0xbae7('0x2c'),_0x34feff+'-'+_0xcee3dd+'/'+_0x41d4fa)[_0xbae7('0x2d')](_0x203848);}return null;};}function patchUpdates(_0x1153f0){return function(_0x36d945){try{jsonpatch[_0xbae7('0x2e')](_0x36d945,_0x1153f0,!![]);}catch(_0x364cf9){return BPromise[_0xbae7('0x2f')](_0x364cf9);}return _0x36d945[_0xbae7('0x30')]();};}function saveUpdates(_0x49e79b,_0x17860d){return function(_0x3516b0){if(_0x3516b0){return _0x3516b0[_0xbae7('0x31')](_0x49e79b)['then'](function(_0x2ef327){return _0x2ef327;});}return null;};}function removeEntity(_0x2c752a,_0x5c417e){return function(_0x245dde){if(_0x245dde){return _0x245dde[_0xbae7('0x32')]()[_0xbae7('0x1b')](function(){var _0xfbedad=_0x245dde[_0xbae7('0x33')]({'plain':!![]});var _0x2b0f60=_0xbae7('0x34');return db[_0xbae7('0x35')][_0xbae7('0x32')]({'where':{'type':_0x2b0f60,'resourceId':_0xfbedad['id']}})['then'](function(){return _0x245dde;});})['then'](function(){_0x2c752a[_0xbae7('0x25')](0xcc)[_0xbae7('0x26')]();});}};}function handleEntityNotFound(_0x519a0d,_0x1194be){return function(_0x43d138){if(!_0x43d138){_0x519a0d[_0xbae7('0x24')](0x194);}return _0x43d138;};}function handleError(_0x28afe4,_0x16b26){_0x16b26=_0x16b26||0x1f4;return function(_0x112178){logger[_0xbae7('0x20')](_0x112178[_0xbae7('0x36')]);if(_0x112178['name']){delete _0x112178['name'];}_0x28afe4[_0xbae7('0x25')](_0x16b26)['send'](_0x112178);};}function getMustacheRender(_0xc6f1c5,_0x59e90b){return Mustache[_0xbae7('0x37')](_0xc6f1c5,_[_0xbae7('0x38')](_0x59e90b[_0xbae7('0x39')],{'contact':_0x59e90b[_0xbae7('0x3a')],'message':_0x59e90b[_0xbae7('0x22')],'agent':_0x59e90b[_0xbae7('0x3b')],'interaction':_0x59e90b['interaction'],'account':_0x59e90b[_0xbae7('0x3c')]}))||'';}exports['index']=function(_0x525772,_0x29e238){var _0x1eb10f={'include':[{'model':db[_0xbae7('0x3d')],'as':'mandatoryDispositionPause'}]},_0xafa9de={},_0xc1c69e={'count':0x0,'rows':[]};var _0x151c1a=_[_0xbae7('0x3e')](db[_0xbae7('0x3f')][_0xbae7('0x40')],function(_0x18e20d){return{'name':_0x18e20d['fieldName'],'type':_0x18e20d[_0xbae7('0x41')]['key']};});_0xafa9de[_0xbae7('0x42')]=_[_0xbae7('0x3e')](_0x151c1a,_0xbae7('0x43'));_0xafa9de[_0xbae7('0x44')]=_[_0xbae7('0x45')](_0x525772['query']);_0xafa9de[_0xbae7('0x46')]=_[_0xbae7('0x47')](_0xafa9de[_0xbae7('0x42')],_0xafa9de[_0xbae7('0x44')]);_0x1eb10f[_0xbae7('0x48')]=_[_0xbae7('0x47')](_0xafa9de[_0xbae7('0x42')],qs['fields'](_0x525772[_0xbae7('0x44')][_0xbae7('0x49')]));_0x1eb10f[_0xbae7('0x48')]=_0x1eb10f[_0xbae7('0x48')][_0xbae7('0x4a')]?_0x1eb10f[_0xbae7('0x48')]:_0xafa9de['model'];if(!_0x525772['query'][_0xbae7('0x4b')](_0xbae7('0x4c'))){_0x1eb10f['limit']=qs[_0xbae7('0x2a')](_0x525772[_0xbae7('0x44')][_0xbae7('0x2a')]);_0x1eb10f[_0xbae7('0x27')]=qs[_0xbae7('0x27')](_0x525772['query'][_0xbae7('0x27')]);}_0x1eb10f[_0xbae7('0x4d')]=qs[_0xbae7('0x4e')](_0x525772[_0xbae7('0x44')]['sort']);_0x1eb10f[_0xbae7('0x4f')]=qs[_0xbae7('0x46')](_[_0xbae7('0x50')](_0x525772[_0xbae7('0x44')],_0xafa9de['filters']),_0x151c1a);if(_0x525772[_0xbae7('0x44')][_0xbae7('0x51')]){_0x1eb10f[_0xbae7('0x4f')]=_[_0xbae7('0x38')](_0x1eb10f['where'],{'$or':_[_0xbae7('0x3e')](_0x151c1a,function(_0x12f398){if(_0x12f398[_0xbae7('0x41')]!==_0xbae7('0x52')){var _0x30b469={};_0x30b469[_0x12f398['name']]={'$like':'%'+_0x525772['query']['filter']+'%'};return _0x30b469;}})});}_0x1eb10f=_[_0xbae7('0x38')]({},_0x1eb10f,_0x525772[_0xbae7('0x53')]);var _0x4266cc={'where':_0x1eb10f[_0xbae7('0x4f')]};return db[_0xbae7('0x3f')]['count'](_0x4266cc)['then'](function(_0x1bb00a){_0xc1c69e[_0xbae7('0x29')]=_0x1bb00a;if(_0x525772[_0xbae7('0x44')]['includeAll']){_0x1eb10f[_0xbae7('0x54')]=[{'all':!![]}];}return db[_0xbae7('0x3f')][_0xbae7('0x55')](_0x1eb10f);})[_0xbae7('0x1b')](function(_0x405b3e){_0xc1c69e['rows']=_0x405b3e;return _0xc1c69e;})[_0xbae7('0x1b')](respondWithFilteredResult(_0x29e238,_0x1eb10f))['catch'](handleError(_0x29e238,null));};exports[_0xbae7('0x56')]=function(_0x35b301,_0x472a20){var _0x891e31={'raw':![],'where':{'id':_0x35b301[_0xbae7('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xbae7('0x58')}]},_0x384fbc={};_0x384fbc[_0xbae7('0x42')]=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x384fbc['query']=_[_0xbae7('0x45')](_0x35b301[_0xbae7('0x44')]);_0x384fbc[_0xbae7('0x46')]=_[_0xbae7('0x47')](_0x384fbc[_0xbae7('0x42')],_0x384fbc[_0xbae7('0x44')]);_0x891e31['attributes']=_[_0xbae7('0x47')](_0x384fbc[_0xbae7('0x42')],qs[_0xbae7('0x49')](_0x35b301[_0xbae7('0x44')]['fields']));_0x891e31[_0xbae7('0x48')]=_0x891e31[_0xbae7('0x48')]['length']?_0x891e31[_0xbae7('0x48')]:_0x384fbc[_0xbae7('0x42')];if(_0x35b301['query']['includeAll']){_0x891e31[_0xbae7('0x54')]=[{'all':!![]}];}_0x891e31=_[_0xbae7('0x38')]({},_0x891e31,_0x35b301[_0xbae7('0x53')]);return db[_0xbae7('0x3f')][_0xbae7('0x59')](_0x891e31)[_0xbae7('0x1b')](handleEntityNotFound(_0x472a20,null))[_0xbae7('0x1b')](respondWithResult(_0x472a20,null))[_0xbae7('0x23')](handleError(_0x472a20,null));};exports[_0xbae7('0x5a')]=function(_0x16d1e5,_0x49f649){return db[_0xbae7('0x3f')][_0xbae7('0x5a')](_0x16d1e5[_0xbae7('0x39')],{})[_0xbae7('0x1b')](function(_0x2897aa){var _0x19debb=_0x16d1e5['user'][_0xbae7('0x33')]({'plain':!![]});if(!_0x19debb)throw new Error(_0xbae7('0x5b'));if(_0x19debb[_0xbae7('0x5c')]===_0xbae7('0x5d')){var _0x4c3c57=_0x2897aa[_0xbae7('0x33')]({'plain':!![]});var _0x599cc6=_0xbae7('0x34');return db[_0xbae7('0x5e')][_0xbae7('0x59')]({'where':{'name':_0x599cc6,'userProfileId':_0x19debb[_0xbae7('0x5f')]},'raw':!![]})[_0xbae7('0x1b')](function(_0x5ea811){if(_0x5ea811&&_0x5ea811[_0xbae7('0x60')]===0x0){return db[_0xbae7('0x35')][_0xbae7('0x5a')]({'name':_0x4c3c57['name'],'resourceId':_0x4c3c57['id'],'type':_0x5ea811['name'],'sectionId':_0x5ea811['id']},{})['then'](function(){return _0x2897aa;});}else{return _0x2897aa;}})['catch'](function(_0x195460){logger['error'](_0xbae7('0x61'),_0x195460);throw _0x195460;});}return _0x2897aa;})[_0xbae7('0x1b')](respondWithResult(_0x49f649,0xc9))[_0xbae7('0x23')](handleError(_0x49f649,null));};exports[_0xbae7('0x31')]=function(_0x54e404,_0x39e0af){if(_0x54e404[_0xbae7('0x39')]['id']){delete _0x54e404[_0xbae7('0x39')]['id'];}return db[_0xbae7('0x3f')][_0xbae7('0x59')]({'where':{'id':_0x54e404[_0xbae7('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xbae7('0x58')}]})[_0xbae7('0x1b')](handleEntityNotFound(_0x39e0af,null))[_0xbae7('0x1b')](saveUpdates(_0x54e404[_0xbae7('0x39')],null))['then'](respondWithResult(_0x39e0af,null))['catch'](handleError(_0x39e0af,null));};exports['destroy']=function(_0x43303c,_0x20c218){return db[_0xbae7('0x3f')][_0xbae7('0x59')]({'where':{'id':_0x43303c[_0xbae7('0x57')]['id']}})['then'](handleEntityNotFound(_0x20c218,null))[_0xbae7('0x1b')](removeEntity(_0x20c218,null))[_0xbae7('0x23')](handleError(_0x20c218,null));};exports['describe']=function(_0x1d6ed9,_0x204eb1){return db[_0xbae7('0x3f')][_0xbae7('0x62')]()['then'](respondWithResult(_0x204eb1,null))['catch'](handleError(_0x204eb1,null));};exports['addDisposition']=function(_0x384425,_0x208f70,_0x12b3e){if(_0x384425[_0xbae7('0x39')]['id']){delete _0x384425[_0xbae7('0x39')]['id'];}return db['WhatsappAccount'][_0xbae7('0x59')]({'where':{'id':_0x384425[_0xbae7('0x57')]['id']}})[_0xbae7('0x1b')](handleEntityNotFound(_0x208f70,null))[_0xbae7('0x1b')](function(_0x359e6d){if(_0x359e6d){_0x384425[_0xbae7('0x39')]['WhatsappAccountId']=_0x359e6d['id'];return db[_0xbae7('0x63')][_0xbae7('0x5a')](_0x384425['body']);}})['then'](respondWithResult(_0x208f70,null))[_0xbae7('0x23')](handleError(_0x208f70,null));};exports[_0xbae7('0x64')]=function(_0x12adbd,_0x218e76,_0x5867ff){var _0x532cb8={'raw':![],'where':{}};var _0x4498bc={};var _0x1d415b={'count':0x0,'rows':[]};return db[_0xbae7('0x3f')][_0xbae7('0x65')]({'where':{'id':_0x12adbd[_0xbae7('0x57')]['id']}})['then'](handleEntityNotFound(_0x218e76,null))[_0xbae7('0x1b')](function(_0x58f677){if(_0x58f677){_0x4498bc[_0xbae7('0x42')]=_[_0xbae7('0x45')](db[_0xbae7('0x63')][_0xbae7('0x40')]);_0x4498bc[_0xbae7('0x44')]=_[_0xbae7('0x45')](_0x12adbd['query']);_0x4498bc[_0xbae7('0x46')]=_[_0xbae7('0x47')](_0x4498bc['model'],_0x4498bc['query']);_0x532cb8['attributes']=_[_0xbae7('0x47')](_0x4498bc['model'],qs['fields'](_0x12adbd[_0xbae7('0x44')][_0xbae7('0x49')]));_0x532cb8[_0xbae7('0x48')]=_0x532cb8[_0xbae7('0x48')][_0xbae7('0x4a')]?_0x532cb8[_0xbae7('0x48')]:_0x4498bc[_0xbae7('0x42')];if(!_0x12adbd[_0xbae7('0x44')][_0xbae7('0x4b')](_0xbae7('0x4c'))){_0x532cb8[_0xbae7('0x2a')]=qs['limit'](_0x12adbd[_0xbae7('0x44')][_0xbae7('0x2a')]);_0x532cb8[_0xbae7('0x27')]=qs[_0xbae7('0x27')](_0x12adbd[_0xbae7('0x44')]['offset']);}_0x532cb8[_0xbae7('0x4d')]=qs[_0xbae7('0x4e')](_0x12adbd[_0xbae7('0x44')][_0xbae7('0x4e')]);_0x532cb8[_0xbae7('0x4f')]=qs['filters'](_[_0xbae7('0x50')](_0x12adbd[_0xbae7('0x44')],_0x4498bc[_0xbae7('0x46')]));_0x532cb8['where'][_0xbae7('0x66')]=_0x58f677['id'];if(_0x12adbd[_0xbae7('0x44')][_0xbae7('0x51')]){_0x532cb8[_0xbae7('0x4f')]=_['merge'](_0x532cb8[_0xbae7('0x4f')],{'$or':_[_0xbae7('0x3e')](_0x532cb8[_0xbae7('0x48')],function(_0x4fb5e5){var _0x2cb621={};_0x2cb621[_0x4fb5e5]={'$like':'%'+_0x12adbd[_0xbae7('0x44')][_0xbae7('0x51')]+'%'};return _0x2cb621;})});}_0x532cb8=_[_0xbae7('0x38')]({},_0x532cb8,_0x12adbd['options']);return db['Disposition'][_0xbae7('0x29')]({'where':_0x532cb8[_0xbae7('0x4f')]})['then'](function(_0x198063){_0x1d415b['count']=_0x198063;if(_0x12adbd[_0xbae7('0x44')]['includeAll']){_0x532cb8[_0xbae7('0x54')]=[{'all':!![]}];}return db[_0xbae7('0x63')][_0xbae7('0x55')](_0x532cb8);})[_0xbae7('0x1b')](function(_0x4f3ee6){_0x1d415b['rows']=_0x4f3ee6;return _0x1d415b;});}})[_0xbae7('0x1b')](respondWithFilteredResult(_0x218e76,_0x532cb8))[_0xbae7('0x23')](handleError(_0x218e76,null));};exports[_0xbae7('0x67')]=function(_0x1ab98f,_0x55010d,_0x4d7278){return db[_0xbae7('0x3f')][_0xbae7('0x59')]({'where':{'id':_0x1ab98f['params']['id']}})[_0xbae7('0x1b')](handleEntityNotFound(_0x55010d,null))[_0xbae7('0x1b')](function(_0x22c2c4){if(_0x22c2c4){return _0x22c2c4[_0xbae7('0x67')](_0x1ab98f[_0xbae7('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x55010d,null))[_0xbae7('0x23')](handleError(_0x55010d,null));};exports['addAnswer']=function(_0x15561e,_0x288b7f,_0x8a30cc){if(_0x15561e[_0xbae7('0x39')]['id']){delete _0x15561e['body']['id'];}return db['WhatsappAccount'][_0xbae7('0x59')]({'where':{'id':_0x15561e['params']['id']}})[_0xbae7('0x1b')](handleEntityNotFound(_0x288b7f,null))[_0xbae7('0x1b')](function(_0xa8ba2b){if(_0xa8ba2b){_0x15561e['body'][_0xbae7('0x66')]=_0xa8ba2b['id'];return db[_0xbae7('0x68')][_0xbae7('0x5a')](_0x15561e['body']);}})[_0xbae7('0x1b')](respondWithResult(_0x288b7f,null))[_0xbae7('0x23')](handleError(_0x288b7f,null));};exports[_0xbae7('0x69')]=function(_0x576781,_0x3a2620,_0x2c8347){var _0x20a43a={'raw':![],'where':{}};var _0x404e32={};var _0x188044={'count':0x0,'rows':[]};return db[_0xbae7('0x3f')][_0xbae7('0x65')]({'where':{'id':_0x576781[_0xbae7('0x57')]['id']}})['then'](handleEntityNotFound(_0x3a2620,null))['then'](function(_0xe73a0e){if(_0xe73a0e){_0x404e32[_0xbae7('0x42')]=_[_0xbae7('0x45')](db[_0xbae7('0x68')]['rawAttributes']);_0x404e32[_0xbae7('0x44')]=_[_0xbae7('0x45')](_0x576781[_0xbae7('0x44')]);_0x404e32['filters']=_['intersection'](_0x404e32[_0xbae7('0x42')],_0x404e32[_0xbae7('0x44')]);_0x20a43a['attributes']=_[_0xbae7('0x47')](_0x404e32[_0xbae7('0x42')],qs[_0xbae7('0x49')](_0x576781[_0xbae7('0x44')][_0xbae7('0x49')]));_0x20a43a[_0xbae7('0x48')]=_0x20a43a[_0xbae7('0x48')][_0xbae7('0x4a')]?_0x20a43a[_0xbae7('0x48')]:_0x404e32['model'];if(!_0x576781[_0xbae7('0x44')][_0xbae7('0x4b')](_0xbae7('0x4c'))){_0x20a43a[_0xbae7('0x2a')]=qs['limit'](_0x576781[_0xbae7('0x44')][_0xbae7('0x2a')]);_0x20a43a['offset']=qs[_0xbae7('0x27')](_0x576781[_0xbae7('0x44')]['offset']);}_0x20a43a[_0xbae7('0x4d')]=qs[_0xbae7('0x4e')](_0x576781[_0xbae7('0x44')][_0xbae7('0x4e')]);_0x20a43a['where']=qs[_0xbae7('0x46')](_[_0xbae7('0x50')](_0x576781[_0xbae7('0x44')],_0x404e32[_0xbae7('0x46')]));_0x20a43a[_0xbae7('0x4f')]['WhatsappAccountId']=_0xe73a0e['id'];if(_0x576781[_0xbae7('0x44')][_0xbae7('0x51')]){_0x20a43a[_0xbae7('0x4f')]=_['merge'](_0x20a43a[_0xbae7('0x4f')],{'$or':_[_0xbae7('0x3e')](_0x20a43a[_0xbae7('0x48')],function(_0x3a1b8f){var _0x1ad448={};_0x1ad448[_0x3a1b8f]={'$like':'%'+_0x576781[_0xbae7('0x44')][_0xbae7('0x51')]+'%'};return _0x1ad448;})});}_0x20a43a=_[_0xbae7('0x38')]({},_0x20a43a,_0x576781['options']);return db[_0xbae7('0x68')]['count']({'where':_0x20a43a[_0xbae7('0x4f')]})[_0xbae7('0x1b')](function(_0x1b91f0){_0x188044[_0xbae7('0x29')]=_0x1b91f0;if(_0x576781['query'][_0xbae7('0x6a')]){_0x20a43a[_0xbae7('0x54')]=[{'all':!![]}];}return db[_0xbae7('0x68')][_0xbae7('0x55')](_0x20a43a);})['then'](function(_0x3ac000){_0x188044[_0xbae7('0x6b')]=_0x3ac000;return _0x188044;});}})[_0xbae7('0x1b')](respondWithFilteredResult(_0x3a2620,_0x20a43a))['catch'](handleError(_0x3a2620,null));};exports[_0xbae7('0x6c')]=function(_0x30819e,_0x10840f,_0xcd3ea8){return db[_0xbae7('0x3f')][_0xbae7('0x59')]({'where':{'id':_0x30819e[_0xbae7('0x57')]['id']}})[_0xbae7('0x1b')](handleEntityNotFound(_0x10840f,null))[_0xbae7('0x1b')](function(_0x590314){if(_0x590314){return _0x590314[_0xbae7('0x6c')](_0x30819e[_0xbae7('0x44')][_0xbae7('0x6d')]);}})[_0xbae7('0x1b')](respondWithStatusCode(_0x10840f,null))[_0xbae7('0x23')](handleError(_0x10840f,null));};exports[_0xbae7('0x6e')]=function(_0x851a46,_0x1c09d5,_0x1805b8){return db[_0xbae7('0x3f')][_0xbae7('0x59')]({'where':{'id':_0x851a46['params']['id']}})[_0xbae7('0x1b')](handleEntityNotFound(_0x1c09d5,null))['then'](function(_0x5810bf){if(_0x5810bf){return _0x5810bf['addAgents'](_0x851a46[_0xbae7('0x39')]['ids'],_[_0xbae7('0x6f')](_0x851a46[_0xbae7('0x39')],[_0xbae7('0x6d'),'id'])||{})[_0xbae7('0x70')](function(_0x4a4e35){for(var _0x280fe0=0x0;_0x280fe0<_0x851a46[_0xbae7('0x39')][_0xbae7('0x6d')][_0xbae7('0x4a')];_0x280fe0+=0x1){socket[_0xbae7('0x71')](_0xbae7('0x72'),{'UserId':_0x851a46['body'][_0xbae7('0x6d')][_0x280fe0],'WhatsappAccountId':_0x851a46['params']['id']});}return _0x4a4e35;});}})[_0xbae7('0x1b')](respondWithResult(_0x1c09d5,null))[_0xbae7('0x23')](handleError(_0x1c09d5,null));};exports['removeAgents']=function(_0x368a8c,_0x225438,_0x220077){return db[_0xbae7('0x3f')][_0xbae7('0x59')]({'where':{'id':_0x368a8c['params']['id']}})[_0xbae7('0x1b')](handleEntityNotFound(_0x225438,null))[_0xbae7('0x1b')](function(_0x4058bb){if(_0x4058bb){return _0x4058bb[_0xbae7('0x73')](_0x368a8c[_0xbae7('0x44')][_0xbae7('0x6d')])[_0xbae7('0x1b')](function(){if(_[_0xbae7('0x74')](_0x368a8c[_0xbae7('0x44')][_0xbae7('0x6d')])){for(var _0x40ccd1=0x0;_0x40ccd1<_0x368a8c['query'][_0xbae7('0x6d')]['length'];_0x40ccd1+=0x1){socket[_0xbae7('0x71')](_0xbae7('0x75'),{'UserId':Number(_0x368a8c[_0xbae7('0x44')][_0xbae7('0x6d')][_0x40ccd1]),'WhatsappAccountId':Number(_0x368a8c['params']['id'])});}}else{socket[_0xbae7('0x71')](_0xbae7('0x75'),{'UserId':Number(_0x368a8c[_0xbae7('0x44')]['ids']),'WhatsappAccountId':Number(_0x368a8c['params']['id'])});}});}})[_0xbae7('0x1b')](respondWithStatusCode(_0x225438,null))[_0xbae7('0x23')](handleError(_0x225438,null));};exports[_0xbae7('0x76')]=function(_0x13c34d,_0x53fce6,_0x476e8d){var _0x2d0ca4={};var _0x9d7412={};var _0x56e76a;var _0x494c95;return db[_0xbae7('0x3f')]['findOne']({'where':{'id':_0x13c34d[_0xbae7('0x57')]['id']}})['then'](handleEntityNotFound(_0x53fce6,null))['then'](function(_0x322163){if(_0x322163){_0x56e76a=_0x322163;_0x9d7412[_0xbae7('0x42')]=_[_0xbae7('0x45')](db['User'][_0xbae7('0x40')]);_0x9d7412['query']=_[_0xbae7('0x45')](_0x13c34d[_0xbae7('0x44')]);_0x9d7412['filters']=_[_0xbae7('0x47')](_0x9d7412[_0xbae7('0x42')],_0x9d7412[_0xbae7('0x44')]);_0x2d0ca4[_0xbae7('0x48')]=_['intersection'](_0x9d7412[_0xbae7('0x42')],qs[_0xbae7('0x49')](_0x13c34d[_0xbae7('0x44')][_0xbae7('0x49')]));_0x2d0ca4['attributes']=_0x2d0ca4[_0xbae7('0x48')][_0xbae7('0x4a')]?_0x2d0ca4['attributes']:_0x9d7412[_0xbae7('0x42')];_0x2d0ca4[_0xbae7('0x4d')]=qs['sort'](_0x13c34d[_0xbae7('0x44')][_0xbae7('0x4e')]);_0x2d0ca4['where']=qs[_0xbae7('0x46')](_['pick'](_0x13c34d[_0xbae7('0x44')],_0x9d7412[_0xbae7('0x46')]));if(_0x13c34d[_0xbae7('0x44')][_0xbae7('0x51')]){_0x2d0ca4[_0xbae7('0x4f')]=_['merge'](_0x2d0ca4[_0xbae7('0x4f')],{'$or':_[_0xbae7('0x3e')](_0x2d0ca4[_0xbae7('0x48')],function(_0x4db453){var _0x1e1624={};_0x1e1624[_0x4db453]={'$like':'%'+_0x13c34d[_0xbae7('0x44')][_0xbae7('0x51')]+'%'};return _0x1e1624;})});}_0x2d0ca4=_[_0xbae7('0x38')]({},_0x2d0ca4,_0x13c34d[_0xbae7('0x53')]);return _0x56e76a['getAgents'](_0x2d0ca4);}})[_0xbae7('0x1b')](function(_0x2b17d0){if(_0x2b17d0){_0x494c95=_0x2b17d0['length'];if(!_0x13c34d[_0xbae7('0x44')][_0xbae7('0x4b')](_0xbae7('0x4c'))){_0x2d0ca4[_0xbae7('0x2a')]=qs['limit'](_0x13c34d[_0xbae7('0x44')][_0xbae7('0x2a')]);_0x2d0ca4[_0xbae7('0x27')]=qs[_0xbae7('0x27')](_0x13c34d['query'][_0xbae7('0x27')]);}return _0x56e76a['getAgents'](_0x2d0ca4);}})[_0xbae7('0x1b')](function(_0x55112f){if(_0x55112f){return _0x55112f?{'count':_0x494c95,'rows':_0x55112f}:null;}})['then'](respondWithResult(_0x53fce6,null))['catch'](handleError(_0x53fce6,null));};exports[_0xbae7('0x77')]=function(_0x138065,_0xbdb29a,_0x31c6de){return db[_0xbae7('0x3f')][_0xbae7('0x65')]({'where':{'id':_0x138065[_0xbae7('0x57')]['id']}})['then'](handleEntityNotFound(_0xbdb29a,null))[_0xbae7('0x1b')](function(_0x5bfdf3){if(_0x5bfdf3){return db[_0xbae7('0x78')][_0xbae7('0x79')](function(_0x3088d9){return db[_0xbae7('0x7a')][_0xbae7('0x32')]({'where':{'WhatsappAccountId':_0x138065['params']['id']},'transaction':_0x3088d9})['then'](function(_0x162f1f){var _0x4ca02d=_[_0xbae7('0x3e')](_0x138065[_0xbae7('0x39')],function(_0x160568){_0x160568[_0xbae7('0x66')]=_0x138065[_0xbae7('0x57')]['id'];return _0x160568;});return db['WhatsappApplication']['bulkCreate'](_0x4ca02d,{'transaction':_0x3088d9});});})['then'](function(){return db[_0xbae7('0x7a')][_0xbae7('0x7b')]({'where':{'WhatsappAccountId':_0x138065[_0xbae7('0x57')]['id']},'order':_0xbae7('0x7c')});});}})[_0xbae7('0x1b')](respondWithResult(_0xbdb29a,null))[_0xbae7('0x23')](handleError(_0xbdb29a,null));};exports[_0xbae7('0x7d')]=function(_0x2e3ff1,_0x5eb8c1,_0x39121d){var _0x55aea0={};var _0x336652={};var _0x313344;var _0x57a054;return db[_0xbae7('0x3f')][_0xbae7('0x65')]({'where':{'id':_0x2e3ff1[_0xbae7('0x57')]['id']}})[_0xbae7('0x1b')](handleEntityNotFound(_0x5eb8c1,null))[_0xbae7('0x1b')](function(_0x527974){if(_0x527974){_0x313344=_0x527974;_0x336652[_0xbae7('0x42')]=_[_0xbae7('0x45')](db[_0xbae7('0x7a')][_0xbae7('0x40')]);_0x336652[_0xbae7('0x44')]=_[_0xbae7('0x45')](_0x2e3ff1[_0xbae7('0x44')]);_0x336652[_0xbae7('0x46')]=_[_0xbae7('0x47')](_0x336652['model'],_0x336652[_0xbae7('0x44')]);_0x55aea0[_0xbae7('0x48')]=_[_0xbae7('0x47')](_0x336652[_0xbae7('0x42')],qs[_0xbae7('0x49')](_0x2e3ff1[_0xbae7('0x44')][_0xbae7('0x49')]));_0x55aea0[_0xbae7('0x48')]=_0x55aea0[_0xbae7('0x48')][_0xbae7('0x4a')]?_0x55aea0['attributes']:_0x336652[_0xbae7('0x42')];_0x55aea0[_0xbae7('0x4d')]=qs[_0xbae7('0x4e')](_0x2e3ff1[_0xbae7('0x44')][_0xbae7('0x4e')]);_0x55aea0[_0xbae7('0x4f')]=qs[_0xbae7('0x46')](_[_0xbae7('0x50')](_0x2e3ff1[_0xbae7('0x44')],_0x336652[_0xbae7('0x46')]));if(_0x2e3ff1[_0xbae7('0x44')][_0xbae7('0x51')]){_0x55aea0[_0xbae7('0x4f')]=_[_0xbae7('0x38')](_0x55aea0[_0xbae7('0x4f')],{'$or':_[_0xbae7('0x3e')](_0x55aea0[_0xbae7('0x48')],function(_0x55e3c7){var _0x2056d1={};_0x2056d1[_0x55e3c7]={'$like':'%'+_0x2e3ff1['query'][_0xbae7('0x51')]+'%'};return _0x2056d1;})});}_0x55aea0=_[_0xbae7('0x38')]({},_0x55aea0,_0x2e3ff1[_0xbae7('0x53')]);return _0x313344[_0xbae7('0x7d')](_0x55aea0);}})[_0xbae7('0x1b')](function(_0x352b00){if(_0x352b00){_0x57a054=_0x352b00['length'];if(!_0x2e3ff1[_0xbae7('0x44')]['hasOwnProperty']('nolimit')){_0x55aea0['limit']=qs['limit'](_0x2e3ff1[_0xbae7('0x44')]['limit']);_0x55aea0[_0xbae7('0x27')]=qs['offset'](_0x2e3ff1[_0xbae7('0x44')][_0xbae7('0x27')]);}return _0x313344[_0xbae7('0x7d')](_0x55aea0);}})['then'](function(_0xbf2513){if(_0xbf2513){return _0xbf2513?{'count':_0x57a054,'rows':_0xbf2513}:null;}})['then'](respondWithResult(_0x5eb8c1,null))[_0xbae7('0x23')](handleError(_0x5eb8c1,null));};exports[_0xbae7('0x7e')]=function(_0x41dc07,_0x466bb6,_0x3d0379){var _0x5d9302={'channel':_0xbae7('0x7f')};var _0x1387b1=[];var _0x40bfc1=[];var _0x4463fb={};return db[_0xbae7('0x3f')][_0xbae7('0x59')]({'where':{'id':_0x41dc07[_0xbae7('0x57')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0xbae7('0x1b')](handleEntityNotFound(_0x466bb6,null))[_0xbae7('0x1b')](function(_0x403c1c){_0x5d9302[_0xbae7('0x3c')]=_0x403c1c;_0x5d9302[_0xbae7('0x80')]=_[_0xbae7('0x81')](_0x403c1c[_0xbae7('0x82')],[_0xbae7('0x7c')],['asc']);if(_0x5d9302[_0xbae7('0x3c')]['Applications']){delete _0x5d9302['account']['Applications'];}return db['CmContact']['describe']();})['then'](function(_0x308fd7){if(!_0x308fd7){throw new db[(_0xbae7('0x83'))][(_0xbae7('0x84'))](_0xbae7('0x85'));}_0x1387b1=_[_0xbae7('0x86')](_[_0xbae7('0x45')](_0x308fd7),[_0xbae7('0x87'),_0xbae7('0x88')]);_0x40bfc1=_[_0xbae7('0x86')](_[_0xbae7('0x45')](_0x308fd7),['createdAt',_0xbae7('0x88'),_0xbae7('0x89'),'ListId']);_0x5d9302[_0xbae7('0x39')]={'mapKey':'mobile'};if(_0x5d9302['account'][_0xbae7('0x41')]&&_0x5d9302[_0xbae7('0x3c')]['type']===_0xbae7('0x8a')){_0x5d9302['body']['from']=_0x41dc07[_0xbae7('0x39')][_0xbae7('0x8b')][_0xbae7('0x8c')]('whatsapp:','');_0x5d9302[_0xbae7('0x39')][_0xbae7('0x39')]=_0x41dc07[_0xbae7('0x39')][_0xbae7('0x8d')];_0x5d9302[_0xbae7('0x39')]['messageId']=_0x41dc07[_0xbae7('0x39')][_0xbae7('0x8e')];}if(_0x5d9302[_0xbae7('0x39')]['id']){delete _0x5d9302['body']['id'];}if(_['isNil'](_0x5d9302['body'][_0xbae7('0x8f')])){throw new db[(_0xbae7('0x83'))][(_0xbae7('0x84'))]('from\x20is\x20mandatory');}if(_[_0xbae7('0x90')](_0x5d9302[_0xbae7('0x39')][_0xbae7('0x39')])||_0x5d9302[_0xbae7('0x39')][_0xbae7('0x39')]===''){throw new db[(_0xbae7('0x83'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbae7('0x90')](_0x5d9302[_0xbae7('0x39')][_0xbae7('0x91')])){throw new db[(_0xbae7('0x83'))][(_0xbae7('0x84'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x40bfc1);}if(!_[_0xbae7('0x92')](_0x40bfc1,_0x5d9302['body'][_0xbae7('0x91')])){throw new db[(_0xbae7('0x83'))][(_0xbae7('0x84'))](_0xbae7('0x93')+_0x40bfc1);}_0x4463fb[_0x5d9302[_0xbae7('0x39')][_0xbae7('0x91')]]=_0x5d9302[_0xbae7('0x39')][_0xbae7('0x8f')];return db[_0xbae7('0x94')][_0xbae7('0x59')]({'where':{'id':_0x5d9302[_0xbae7('0x3c')][_0xbae7('0x95')]},'include':[{'model':db[_0xbae7('0x96')],'as':_0xbae7('0x97'),'where':_0x4463fb,'limit':0x1,'order':[[_0xbae7('0x88'),_0xbae7('0x98')]]}]});})[_0xbae7('0x1b')](handleEntityNotFound(_0x466bb6,null))[_0xbae7('0x1b')](function(_0x11293c){if(_0x11293c){_0x5d9302['list']=_['omit'](_0x11293c,[_0xbae7('0x97')]);if(_0x11293c['Contacts'][_0xbae7('0x4a')]){return _0x11293c[_0xbae7('0x97')][0x0];}var _0x24d9ba=_[_0xbae7('0x16')](_0x5d9302[_0xbae7('0x39')],{'firstName':_0x5d9302[_0xbae7('0x39')][_0xbae7('0x8f')],'ListId':_0x11293c['id']});_0x24d9ba[_0x5d9302[_0xbae7('0x39')][_0xbae7('0x91')]]=_0x5d9302[_0xbae7('0x39')][_0xbae7('0x8f')];return db[_0xbae7('0x96')][_0xbae7('0x5a')](_0x24d9ba,{'fields':_0x1387b1,'raw':!![]});}})[_0xbae7('0x1b')](handleEntityNotFound(_0x466bb6,null))[_0xbae7('0x1b')](function(_0x52e648){if(_0x52e648){_0x5d9302[_0xbae7('0x3a')]=_0x52e648;var _0x33eaa8={'ContactId':_0x52e648['id'],'phone':_0x5d9302[_0xbae7('0x39')][_0xbae7('0x8f')],'WhatsappAccountId':_0x41dc07[_0xbae7('0x57')]['id']};var _0x2798cc={'ContactId':_0x52e648['id'],'WhatsappAccountId':_0x41dc07[_0xbae7('0x57')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xbae7('0x59')]({'where':_0x2798cc})[_0xbae7('0x1b')](function(_0x5dd4d0){if(_0x5dd4d0){return[_0x5dd4d0,![]];}return db[_0xbae7('0x99')]['create'](_0x33eaa8)[_0xbae7('0x1b')](function(_0x3f6c25){return[_0x3f6c25,!![]];});});}})['spread'](function(_0x19652e,_0x4519a8){_0x5d9302[_0xbae7('0x9a')]=_0x19652e[_0xbae7('0x33')]({'plain':!![]});_0x5d9302[_0xbae7('0x9a')]['created']=![];if(_0x4519a8){if(_0x5d9302[_0xbae7('0x3c')]['autoclose']){_0x5d9302[_0xbae7('0x80')][_0xbae7('0x9b')]({'id':0x0,'priority':_0x5d9302[_0xbae7('0x80')]['length']+0x1,'app':_0xbae7('0x9c'),'appdata':_0xbae7('0x9d'),'interval':'*,*,*,*'});}_0x5d9302[_0xbae7('0x9a')][_0xbae7('0x9e')]=!![];}return db[_0xbae7('0x9f')]['create']({'phone':_0x5d9302['body']['from'],'messageId':_0x5d9302[_0xbae7('0x39')][_0xbae7('0xa0')],'body':_0x5d9302[_0xbae7('0x39')][_0xbae7('0x39')],'WhatsappAccountId':_0x41dc07['params']['id'],'WhatsappInteractionId':_0x19652e['id'],'direction':'in','ContactId':_0x19652e[_0xbae7('0xa1')],'AttachmentId':_0x5d9302[_0xbae7('0x39')][_0xbae7('0xa2')]});})[_0xbae7('0x1b')](function(_0x4f8f97){_0x5d9302[_0xbae7('0x22')]=_0x4f8f97;if(_0x5d9302[_0xbae7('0x9a')][_0xbae7('0xa3')]){return db[_0xbae7('0xa4')][_0xbae7('0x59')]({'attributes':['id','name'],'where':{'id':_0x5d9302[_0xbae7('0x9a')]['UserId']}})[_0xbae7('0x1b')](function(_0xf15f67){if(_0xf15f67){_0x5d9302[_0xbae7('0x80')][_0xbae7('0xa5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xf15f67[_0xbae7('0x43')]+','+(_0x5d9302[_0xbae7('0x3c')][_0xbae7('0xa6')]||0xa),'interval':_0xbae7('0xa7')});}return respondWithRpcPromise(_0xbae7('0xa8'),'startRouting',_0x5d9302);});}return respondWithRpcPromise(_0xbae7('0xa8'),_0xbae7('0xa9'),_0x5d9302);})[_0xbae7('0x1b')](function(_0x43cbb6){if(_0x43cbb6){var _0x1910f1=0xc8;var _0x4d0e16=_0xbae7('0xaa');logger[_0xbae7('0x1c')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4d0e16,_0x1910f1,_0xbae7('0xab'));logger[_0xbae7('0xac')](_0xbae7('0xad'),_0x4d0e16,_0x1910f1,_0xbae7('0xab'),JSON[_0xbae7('0x1f')](_0x43cbb6));if(_0x5d9302[_0xbae7('0x3c')][_0xbae7('0x41')]===_0xbae7('0x8a')){return _0x466bb6[_0xbae7('0x25')](_0x1910f1)[_0xbae7('0x2b')](_0xbae7('0xae'),_0xbae7('0xaf'))[_0xbae7('0xb0')](_0xbae7('0xb1'));}else{return _0x466bb6[_0xbae7('0x25')](_0x1910f1)[_0xbae7('0x2d')](_0x43cbb6);}}})[_0xbae7('0x23')](handleError(_0x466bb6,null));};exports[_0xbae7('0xb0')]=function(_0x3d5d5e,_0x3a4865,_0x1a72b1){var _0x2382a3,_0x53f632,_0x53a528;if(_[_0xbae7('0x90')](_0x3d5d5e['body'][_0xbae7('0x39')])||_0x3d5d5e['body'][_0xbae7('0x39')]===''){throw new db[(_0xbae7('0x83'))][(_0xbae7('0x84'))](_0xbae7('0xb2'));}if(_[_0xbae7('0x90')](_0x3d5d5e['body']['to'])){throw new db[(_0xbae7('0x83'))][(_0xbae7('0x84'))]('to\x20is\x20mandatory');}_0x2382a3=_0x3d5d5e[_0xbae7('0x39')]['to'];return db[_0xbae7('0x3f')][_0xbae7('0x59')]({'where':{'id':_0x3d5d5e[_0xbae7('0x57')]['id']},'include':[{'model':db[_0xbae7('0x94')],'as':_0xbae7('0xb3'),'include':[{'model':db['CmContact'],'as':_0xbae7('0x97'),'where':{'mobile':_0x2382a3},'limit':0x1,'order':[[_0xbae7('0x88'),_0xbae7('0x98')]]}]}]})[_0xbae7('0x1b')](handleEntityNotFound(_0x3a4865,null))[_0xbae7('0x1b')](function(_0x1e48ed){if(_0x1e48ed&&_0x1e48ed[_0xbae7('0xb3')]){_0x53f632=_0x1e48ed[_0xbae7('0x33')]({'plain':!![]});if(_0x53f632[_0xbae7('0xb3')]&&_0x53f632[_0xbae7('0xb3')][_0xbae7('0x97')][_0xbae7('0x4a')]){return _0x53f632[_0xbae7('0xb3')][_0xbae7('0x97')][0x0];}return db[_0xbae7('0x96')][_0xbae7('0x5a')](_[_0xbae7('0x16')](_0x3d5d5e[_0xbae7('0x39')],{'firstName':_0x2382a3,'mobile':_0x2382a3,'phone':_0x2382a3,'ListId':_0x53f632[_0xbae7('0x95')]}));}})['then'](handleEntityNotFound(_0x3a4865,null))['then'](function(_0x4d3096){if(_0x4d3096){_0x53a528=_0x4d3096;return db[_0xbae7('0x99')][_0xbae7('0x59')]({'where':{'ContactId':_0x53a528['id'],'closed':![],'WhatsappAccountId':_0x53f632['id']}})['then'](function(_0x21cbe6){if(_0x21cbe6){return[_0x21cbe6,![]];}return db['WhatsappInteraction'][_0xbae7('0x5a')]({'UserId':_0x3d5d5e['user']['id'],'ContactId':_0x53a528['id'],'WhatsappAccountId':_0x53f632['id'],'phone':_0x2382a3,'firstMsgDirection':_0xbae7('0xb4'),'Messages':[_[_0xbae7('0x38')](_0x3d5d5e['body'],{'read':![],'body':_0x3d5d5e['body']['body'],'phone':_0x2382a3,'WhatsappAccountId':_0x53f632['id'],'UserId':_0x3d5d5e[_0xbae7('0x5d')]['id'],'ContactId':_0x53a528['id']})]},{'include':[{'model':db[_0xbae7('0x9f')],'as':'Messages'}]})[_0xbae7('0x1b')](function(_0xd60ab4){return[_0xd60ab4,!![]];});});}})[_0xbae7('0x70')](function(_0x1f1974,_0xee51af){if(_0xee51af){return _0x1f1974;}return db[_0xbae7('0x9f')][_0xbae7('0x5a')](_[_0xbae7('0x38')](_0x3d5d5e[_0xbae7('0x39')],{'read':![],'body':_0x3d5d5e[_0xbae7('0x39')][_0xbae7('0x39')],'phone':_0x2382a3,'WhatsappAccountId':_0x53f632['id'],'WhatsappInteractionId':_0x1f1974['id'],'UserId':_0x3d5d5e[_0xbae7('0x5d')]['id'],'ContactId':_0x53a528['id']}))[_0xbae7('0x1b')](function(_0x480cf4){_0x1f1974['dataValues'][_0xbae7('0xb5')]=[];_0x1f1974['dataValues'][_0xbae7('0xb5')][_0xbae7('0x9b')](_0x480cf4[_0xbae7('0xb6')]);return _0x1f1974;});})[_0xbae7('0x1b')](respondWithResult(_0x3a4865,null))[_0xbae7('0x23')](handleError(_0x3a4865,null));}; \ No newline at end of file +var _0x2948=['*,*,*,*','WhatsappMessage','ContactId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','DESC','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','body','agent','account','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','keys','filters','model','attributes','intersection','query','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','WhatsappAccount','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','WhatsappAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','ids','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','notify','Applications','applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','mobile','twilio','from','From','replace','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','ListId','CmContact','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged'];(function(_0x32e777,_0x78e2b6){var _0x47e697=function(_0x325759){while(--_0x325759){_0x32e777['push'](_0x32e777['shift']());}};_0x47e697(++_0x78e2b6);}(_0x2948,0xcb));var _0x8294=function(_0x506c62,_0x4d350e){_0x506c62=_0x506c62-0x0;var _0x117363=_0x2948[_0x506c62];return _0x117363;};'use strict';var emlformat=require(_0x8294('0x0'));var rimraf=require(_0x8294('0x1'));var zipdir=require(_0x8294('0x2'));var jsonpatch=require(_0x8294('0x3'));var rp=require(_0x8294('0x4'));var moment=require(_0x8294('0x5'));var BPromise=require(_0x8294('0x6'));var Mustache=require(_0x8294('0x7'));var util=require(_0x8294('0x8'));var path=require('path');var sox=require(_0x8294('0x9'));var csv=require('to-csv');var ejs=require(_0x8294('0xa'));var fs=require('fs');var fs_extra=require(_0x8294('0xb'));var _=require(_0x8294('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8294('0xd'));var querystring=require(_0x8294('0xe'));var Papa=require('papaparse');var Redis=require(_0x8294('0xf'));var authService=require(_0x8294('0x10'));var qs=require(_0x8294('0x11'));var as=require(_0x8294('0x12'));var hardwareService=require(_0x8294('0x13'));var logger=require(_0x8294('0x14'))('api');var utils=require(_0x8294('0x15'));var config=require(_0x8294('0x16'));var licenseUtil=require(_0x8294('0x17'));var db=require(_0x8294('0x18'))['db'];config[_0x8294('0x19')]=_[_0x8294('0x1a')](config[_0x8294('0x19')],{'host':_0x8294('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8294('0x19')]));require(_0x8294('0x1c'))[_0x8294('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x19295d,_0x1bccf6,_0x25c9ae,_0x2ca14b){return new BPromise(function(_0x38e295,_0x37ea5b){var _0x2a501a=_0x2ca14b||client;return _0x2a501a[_0x8294('0x1e')](_0x19295d,_0x25c9ae)[_0x8294('0x1f')](function(_0x1ecf57){logger[_0x8294('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x1bccf6,_0x8294('0x21'));logger['debug'](_0x8294('0x22'),_0x1bccf6,_0x8294('0x21'),JSON[_0x8294('0x23')](_0x1ecf57));if(_0x1ecf57[_0x8294('0x24')]){if(_0x1ecf57[_0x8294('0x24')][_0x8294('0x25')]===0x1f4){logger[_0x8294('0x24')](_0x8294('0x26'),_0x1bccf6,_0x1ecf57[_0x8294('0x24')]['message']);return _0x37ea5b(_0x1ecf57[_0x8294('0x24')][_0x8294('0x27')]);}logger['error'](_0x8294('0x26'),_0x1bccf6,_0x1ecf57[_0x8294('0x24')][_0x8294('0x27')]);return _0x38e295(_0x1ecf57[_0x8294('0x24')][_0x8294('0x27')]);}else{logger[_0x8294('0x20')](_0x8294('0x26'),_0x1bccf6,_0x8294('0x21'));_0x38e295(_0x1ecf57[_0x8294('0x28')][_0x8294('0x27')]);}})[_0x8294('0x29')](function(_0x54fbf3){logger['error'](_0x8294('0x26'),_0x1bccf6,_0x54fbf3);_0x37ea5b(_0x54fbf3);});});}function respondWithStatusCode(_0x557529,_0x83f0c4){_0x83f0c4=_0x83f0c4||0xcc;return function(_0x5cb365){if(_0x5cb365){return _0x557529['sendStatus'](_0x83f0c4);}return _0x557529[_0x8294('0x2a')](_0x83f0c4)[_0x8294('0x2b')]();};}function respondWithResult(_0x51ef39,_0x373fe7){_0x373fe7=_0x373fe7||0xc8;return function(_0x3d0452){if(_0x3d0452){return _0x51ef39[_0x8294('0x2a')](_0x373fe7)[_0x8294('0x2c')](_0x3d0452);}};}function respondWithFilteredResult(_0x58c4d2,_0x4ce49e){return function(_0x311e6b){if(_0x311e6b){var _0x2d6312=typeof _0x4ce49e[_0x8294('0x2d')]==='undefined'&&typeof _0x4ce49e['limit']===_0x8294('0x2e');var _0x45072c=_0x311e6b[_0x8294('0x2f')];var _0x4925e0=_0x2d6312?0x0:_0x4ce49e['offset'];var _0x221519=_0x2d6312?_0x311e6b[_0x8294('0x2f')]:_0x4ce49e['offset']+_0x4ce49e[_0x8294('0x30')];var _0x1f0149;if(_0x221519>=_0x45072c){_0x221519=_0x45072c;_0x1f0149=0xc8;}else{_0x1f0149=0xce;}_0x58c4d2['status'](_0x1f0149);return _0x58c4d2[_0x8294('0x31')]('Content-Range',_0x4925e0+'-'+_0x221519+'/'+_0x45072c)[_0x8294('0x2c')](_0x311e6b);}return null;};}function patchUpdates(_0x51a347){return function(_0x3f3228){try{jsonpatch[_0x8294('0x32')](_0x3f3228,_0x51a347,!![]);}catch(_0x35a9cc){return BPromise[_0x8294('0x33')](_0x35a9cc);}return _0x3f3228[_0x8294('0x34')]();};}function saveUpdates(_0x254581,_0x29f70c){return function(_0x57470e){if(_0x57470e){return _0x57470e[_0x8294('0x35')](_0x254581)[_0x8294('0x1f')](function(_0x26e29a){return _0x26e29a;});}return null;};}function removeEntity(_0x584fe3,_0xfa4ec6){return function(_0x38e4b5){if(_0x38e4b5){return _0x38e4b5[_0x8294('0x36')]()['then'](function(){var _0x59508c=_0x38e4b5[_0x8294('0x37')]({'plain':!![]});var _0x35a80d=_0x8294('0x38');return db[_0x8294('0x39')][_0x8294('0x36')]({'where':{'type':_0x35a80d,'resourceId':_0x59508c['id']}})[_0x8294('0x1f')](function(){return _0x38e4b5;});})[_0x8294('0x1f')](function(){_0x584fe3[_0x8294('0x2a')](0xcc)[_0x8294('0x2b')]();});}};}function handleEntityNotFound(_0x55087a,_0x3f1246){return function(_0x1a9a0d){if(!_0x1a9a0d){_0x55087a['sendStatus'](0x194);}return _0x1a9a0d;};}function handleError(_0xbf910,_0x8ad38c){_0x8ad38c=_0x8ad38c||0x1f4;return function(_0x1f2b33){logger[_0x8294('0x24')](_0x1f2b33['stack']);if(_0x1f2b33[_0x8294('0x3a')]){delete _0x1f2b33[_0x8294('0x3a')];}_0xbf910[_0x8294('0x2a')](_0x8ad38c)[_0x8294('0x3b')](_0x1f2b33);};}function getMustacheRender(_0x81b7b0,_0x1c1107){return Mustache['render'](_0x81b7b0,_['merge'](_0x1c1107[_0x8294('0x3c')],{'contact':_0x1c1107['contact'],'message':_0x1c1107[_0x8294('0x27')],'agent':_0x1c1107[_0x8294('0x3d')],'interaction':_0x1c1107['interaction'],'account':_0x1c1107[_0x8294('0x3e')]}))||'';}exports[_0x8294('0x3f')]=function(_0x1e07f9,_0xe800ac){var _0x109d0b={'include':[{'model':db[_0x8294('0x40')],'as':_0x8294('0x41')}]},_0x3ade04={},_0x3cd9d2={'count':0x0,'rows':[]};var _0x3d162b=_[_0x8294('0x42')](db['WhatsappAccount'][_0x8294('0x43')],function(_0x456ed4){return{'name':_0x456ed4[_0x8294('0x44')],'type':_0x456ed4['type'][_0x8294('0x45')]};});_0x3ade04['model']=_[_0x8294('0x42')](_0x3d162b,'name');_0x3ade04['query']=_[_0x8294('0x46')](_0x1e07f9['query']);_0x3ade04[_0x8294('0x47')]=_['intersection'](_0x3ade04[_0x8294('0x48')],_0x3ade04['query']);_0x109d0b[_0x8294('0x49')]=_[_0x8294('0x4a')](_0x3ade04[_0x8294('0x48')],qs['fields'](_0x1e07f9[_0x8294('0x4b')][_0x8294('0x4c')]));_0x109d0b[_0x8294('0x49')]=_0x109d0b['attributes'][_0x8294('0x4d')]?_0x109d0b[_0x8294('0x49')]:_0x3ade04['model'];if(!_0x1e07f9[_0x8294('0x4b')][_0x8294('0x4e')](_0x8294('0x4f'))){_0x109d0b[_0x8294('0x30')]=qs[_0x8294('0x30')](_0x1e07f9[_0x8294('0x4b')]['limit']);_0x109d0b[_0x8294('0x2d')]=qs['offset'](_0x1e07f9[_0x8294('0x4b')]['offset']);}_0x109d0b[_0x8294('0x50')]=qs[_0x8294('0x51')](_0x1e07f9['query']['sort']);_0x109d0b['where']=qs['filters'](_[_0x8294('0x52')](_0x1e07f9[_0x8294('0x4b')],_0x3ade04[_0x8294('0x47')]),_0x3d162b);if(_0x1e07f9['query'][_0x8294('0x53')]){_0x109d0b[_0x8294('0x54')]=_[_0x8294('0x55')](_0x109d0b['where'],{'$or':_['map'](_0x3d162b,function(_0x358aa7){if(_0x358aa7[_0x8294('0x56')]!==_0x8294('0x57')){var _0x2aa43c={};_0x2aa43c[_0x358aa7['name']]={'$like':'%'+_0x1e07f9[_0x8294('0x4b')][_0x8294('0x53')]+'%'};return _0x2aa43c;}})});}_0x109d0b=_[_0x8294('0x55')]({},_0x109d0b,_0x1e07f9[_0x8294('0x58')]);var _0x43cd25={'where':_0x109d0b[_0x8294('0x54')]};return db['WhatsappAccount'][_0x8294('0x2f')](_0x43cd25)['then'](function(_0x15bbf7){_0x3cd9d2[_0x8294('0x2f')]=_0x15bbf7;if(_0x1e07f9[_0x8294('0x4b')][_0x8294('0x59')]){_0x109d0b[_0x8294('0x5a')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x8294('0x5b')](_0x109d0b);})[_0x8294('0x1f')](function(_0x4e9d80){_0x3cd9d2['rows']=_0x4e9d80;return _0x3cd9d2;})['then'](respondWithFilteredResult(_0xe800ac,_0x109d0b))['catch'](handleError(_0xe800ac,null));};exports['show']=function(_0x465526,_0x437c83){var _0x573c4c={'raw':![],'where':{'id':_0x465526['params']['id']},'include':[{'model':db[_0x8294('0x40')],'as':'mandatoryDispositionPause'}]},_0x1bcdfd={};_0x1bcdfd['model']=_[_0x8294('0x46')](db[_0x8294('0x5c')][_0x8294('0x43')]);_0x1bcdfd[_0x8294('0x4b')]=_['keys'](_0x465526['query']);_0x1bcdfd[_0x8294('0x47')]=_[_0x8294('0x4a')](_0x1bcdfd[_0x8294('0x48')],_0x1bcdfd['query']);_0x573c4c['attributes']=_[_0x8294('0x4a')](_0x1bcdfd[_0x8294('0x48')],qs[_0x8294('0x4c')](_0x465526[_0x8294('0x4b')][_0x8294('0x4c')]));_0x573c4c[_0x8294('0x49')]=_0x573c4c[_0x8294('0x49')][_0x8294('0x4d')]?_0x573c4c[_0x8294('0x49')]:_0x1bcdfd[_0x8294('0x48')];if(_0x465526[_0x8294('0x4b')][_0x8294('0x59')]){_0x573c4c[_0x8294('0x5a')]=[{'all':!![]}];}_0x573c4c=_[_0x8294('0x55')]({},_0x573c4c,_0x465526['options']);return db[_0x8294('0x5c')][_0x8294('0x5d')](_0x573c4c)['then'](handleEntityNotFound(_0x437c83,null))[_0x8294('0x1f')](respondWithResult(_0x437c83,null))[_0x8294('0x29')](handleError(_0x437c83,null));};exports[_0x8294('0x5e')]=function(_0x389205,_0x4036cf){return db[_0x8294('0x5c')][_0x8294('0x5e')](_0x389205['body'],{})['then'](function(_0x17747d){var _0x1593b1=_0x389205[_0x8294('0x5f')][_0x8294('0x37')]({'plain':!![]});if(!_0x1593b1)throw new Error(_0x8294('0x60'));if(_0x1593b1[_0x8294('0x61')]===_0x8294('0x5f')){var _0x5b9d7a=_0x17747d[_0x8294('0x37')]({'plain':!![]});var _0x41b1f2='WhatsappAccounts';return db[_0x8294('0x62')][_0x8294('0x5d')]({'where':{'name':_0x41b1f2,'userProfileId':_0x1593b1[_0x8294('0x63')]},'raw':!![]})[_0x8294('0x1f')](function(_0x4ad6d7){if(_0x4ad6d7&&_0x4ad6d7[_0x8294('0x64')]===0x0){return db[_0x8294('0x39')][_0x8294('0x5e')]({'name':_0x5b9d7a[_0x8294('0x3a')],'resourceId':_0x5b9d7a['id'],'type':_0x4ad6d7['name'],'sectionId':_0x4ad6d7['id']},{})[_0x8294('0x1f')](function(){return _0x17747d;});}else{return _0x17747d;}})[_0x8294('0x29')](function(_0x17a962){logger[_0x8294('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17a962);throw _0x17a962;});}return _0x17747d;})[_0x8294('0x1f')](respondWithResult(_0x4036cf,0xc9))['catch'](handleError(_0x4036cf,null));};exports[_0x8294('0x35')]=function(_0x1a2853,_0xedfa85){if(_0x1a2853[_0x8294('0x3c')]['id']){delete _0x1a2853['body']['id'];}return db[_0x8294('0x5c')][_0x8294('0x5d')]({'where':{'id':_0x1a2853[_0x8294('0x65')]['id']},'include':[{'model':db[_0x8294('0x40')],'as':_0x8294('0x41')}]})[_0x8294('0x1f')](handleEntityNotFound(_0xedfa85,null))['then'](saveUpdates(_0x1a2853[_0x8294('0x3c')],null))[_0x8294('0x1f')](respondWithResult(_0xedfa85,null))[_0x8294('0x29')](handleError(_0xedfa85,null));};exports[_0x8294('0x36')]=function(_0x352663,_0x59e2ba){return db[_0x8294('0x5c')][_0x8294('0x5d')]({'where':{'id':_0x352663[_0x8294('0x65')]['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x59e2ba,null))[_0x8294('0x1f')](removeEntity(_0x59e2ba,null))['catch'](handleError(_0x59e2ba,null));};exports[_0x8294('0x66')]=function(_0x3bef45,_0x466fdf){return db[_0x8294('0x5c')][_0x8294('0x66')]()[_0x8294('0x1f')](respondWithResult(_0x466fdf,null))['catch'](handleError(_0x466fdf,null));};exports['addDisposition']=function(_0x5e9482,_0x2059f0,_0x1c2303){if(_0x5e9482['body']['id']){delete _0x5e9482['body']['id'];}return db[_0x8294('0x5c')][_0x8294('0x5d')]({'where':{'id':_0x5e9482['params']['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x2059f0,null))['then'](function(_0x1a7751){if(_0x1a7751){_0x5e9482[_0x8294('0x3c')][_0x8294('0x67')]=_0x1a7751['id'];return db[_0x8294('0x68')][_0x8294('0x5e')](_0x5e9482['body']);}})[_0x8294('0x1f')](respondWithResult(_0x2059f0,null))[_0x8294('0x29')](handleError(_0x2059f0,null));};exports[_0x8294('0x69')]=function(_0x544dcb,_0x1a94eb,_0x4361b4){var _0x51743f={'raw':![],'where':{}};var _0x2650c8={};var _0x3c16ff={'count':0x0,'rows':[]};return db[_0x8294('0x5c')][_0x8294('0x6a')]({'where':{'id':_0x544dcb['params']['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x1a94eb,null))[_0x8294('0x1f')](function(_0x2f3e45){if(_0x2f3e45){_0x2650c8[_0x8294('0x48')]=_[_0x8294('0x46')](db[_0x8294('0x68')]['rawAttributes']);_0x2650c8[_0x8294('0x4b')]=_[_0x8294('0x46')](_0x544dcb['query']);_0x2650c8[_0x8294('0x47')]=_[_0x8294('0x4a')](_0x2650c8['model'],_0x2650c8[_0x8294('0x4b')]);_0x51743f['attributes']=_[_0x8294('0x4a')](_0x2650c8[_0x8294('0x48')],qs[_0x8294('0x4c')](_0x544dcb[_0x8294('0x4b')]['fields']));_0x51743f[_0x8294('0x49')]=_0x51743f[_0x8294('0x49')][_0x8294('0x4d')]?_0x51743f['attributes']:_0x2650c8['model'];if(!_0x544dcb[_0x8294('0x4b')]['hasOwnProperty']('nolimit')){_0x51743f[_0x8294('0x30')]=qs[_0x8294('0x30')](_0x544dcb[_0x8294('0x4b')]['limit']);_0x51743f['offset']=qs[_0x8294('0x2d')](_0x544dcb[_0x8294('0x4b')]['offset']);}_0x51743f['order']=qs[_0x8294('0x51')](_0x544dcb['query']['sort']);_0x51743f['where']=qs['filters'](_[_0x8294('0x52')](_0x544dcb['query'],_0x2650c8[_0x8294('0x47')]));_0x51743f[_0x8294('0x54')][_0x8294('0x67')]=_0x2f3e45['id'];if(_0x544dcb[_0x8294('0x4b')][_0x8294('0x53')]){_0x51743f[_0x8294('0x54')]=_[_0x8294('0x55')](_0x51743f[_0x8294('0x54')],{'$or':_[_0x8294('0x42')](_0x51743f['attributes'],function(_0x3bdcf2){var _0x40ea21={};_0x40ea21[_0x3bdcf2]={'$like':'%'+_0x544dcb[_0x8294('0x4b')][_0x8294('0x53')]+'%'};return _0x40ea21;})});}_0x51743f=_[_0x8294('0x55')]({},_0x51743f,_0x544dcb[_0x8294('0x58')]);return db['Disposition'][_0x8294('0x2f')]({'where':_0x51743f['where']})[_0x8294('0x1f')](function(_0x15b26e){_0x3c16ff[_0x8294('0x2f')]=_0x15b26e;if(_0x544dcb['query']['includeAll']){_0x51743f[_0x8294('0x5a')]=[{'all':!![]}];}return db[_0x8294('0x68')][_0x8294('0x5b')](_0x51743f);})[_0x8294('0x1f')](function(_0x56d5d6){_0x3c16ff[_0x8294('0x6b')]=_0x56d5d6;return _0x3c16ff;});}})['then'](respondWithFilteredResult(_0x1a94eb,_0x51743f))['catch'](handleError(_0x1a94eb,null));};exports[_0x8294('0x6c')]=function(_0x13f160,_0x3d1894,_0x5c6126){return db[_0x8294('0x5c')]['find']({'where':{'id':_0x13f160[_0x8294('0x65')]['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x3d1894,null))[_0x8294('0x1f')](function(_0x4d3de8){if(_0x4d3de8){return _0x4d3de8[_0x8294('0x6c')](_0x13f160[_0x8294('0x4b')]['ids']);}})[_0x8294('0x1f')](respondWithStatusCode(_0x3d1894,null))[_0x8294('0x29')](handleError(_0x3d1894,null));};exports[_0x8294('0x6d')]=function(_0xcf9741,_0x3671c8,_0x4ba88e){if(_0xcf9741[_0x8294('0x3c')]['id']){delete _0xcf9741['body']['id'];}return db[_0x8294('0x5c')][_0x8294('0x5d')]({'where':{'id':_0xcf9741['params']['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x3671c8,null))[_0x8294('0x1f')](function(_0x27d3f2){if(_0x27d3f2){_0xcf9741[_0x8294('0x3c')][_0x8294('0x67')]=_0x27d3f2['id'];return db[_0x8294('0x6e')][_0x8294('0x5e')](_0xcf9741[_0x8294('0x3c')]);}})[_0x8294('0x1f')](respondWithResult(_0x3671c8,null))[_0x8294('0x29')](handleError(_0x3671c8,null));};exports['getAnswers']=function(_0x3c57f9,_0x338fe4,_0x3f7887){var _0x462395={'raw':![],'where':{}};var _0x4b8028={};var _0x371963={'count':0x0,'rows':[]};return db[_0x8294('0x5c')][_0x8294('0x6a')]({'where':{'id':_0x3c57f9[_0x8294('0x65')]['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x338fe4,null))[_0x8294('0x1f')](function(_0x2a7968){if(_0x2a7968){_0x4b8028[_0x8294('0x48')]=_[_0x8294('0x46')](db[_0x8294('0x6e')]['rawAttributes']);_0x4b8028[_0x8294('0x4b')]=_['keys'](_0x3c57f9[_0x8294('0x4b')]);_0x4b8028[_0x8294('0x47')]=_['intersection'](_0x4b8028['model'],_0x4b8028[_0x8294('0x4b')]);_0x462395[_0x8294('0x49')]=_[_0x8294('0x4a')](_0x4b8028['model'],qs[_0x8294('0x4c')](_0x3c57f9[_0x8294('0x4b')][_0x8294('0x4c')]));_0x462395[_0x8294('0x49')]=_0x462395[_0x8294('0x49')][_0x8294('0x4d')]?_0x462395[_0x8294('0x49')]:_0x4b8028[_0x8294('0x48')];if(!_0x3c57f9['query'][_0x8294('0x4e')](_0x8294('0x4f'))){_0x462395[_0x8294('0x30')]=qs[_0x8294('0x30')](_0x3c57f9[_0x8294('0x4b')][_0x8294('0x30')]);_0x462395['offset']=qs[_0x8294('0x2d')](_0x3c57f9[_0x8294('0x4b')][_0x8294('0x2d')]);}_0x462395['order']=qs[_0x8294('0x51')](_0x3c57f9[_0x8294('0x4b')][_0x8294('0x51')]);_0x462395[_0x8294('0x54')]=qs[_0x8294('0x47')](_[_0x8294('0x52')](_0x3c57f9[_0x8294('0x4b')],_0x4b8028[_0x8294('0x47')]));_0x462395[_0x8294('0x54')][_0x8294('0x67')]=_0x2a7968['id'];if(_0x3c57f9[_0x8294('0x4b')][_0x8294('0x53')]){_0x462395[_0x8294('0x54')]=_[_0x8294('0x55')](_0x462395[_0x8294('0x54')],{'$or':_[_0x8294('0x42')](_0x462395[_0x8294('0x49')],function(_0x21ffbd){var _0x1ee266={};_0x1ee266[_0x21ffbd]={'$like':'%'+_0x3c57f9['query'][_0x8294('0x53')]+'%'};return _0x1ee266;})});}_0x462395=_[_0x8294('0x55')]({},_0x462395,_0x3c57f9['options']);return db[_0x8294('0x6e')]['count']({'where':_0x462395['where']})[_0x8294('0x1f')](function(_0x5b42a4){_0x371963[_0x8294('0x2f')]=_0x5b42a4;if(_0x3c57f9[_0x8294('0x4b')][_0x8294('0x59')]){_0x462395['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x8294('0x5b')](_0x462395);})[_0x8294('0x1f')](function(_0x5e8b0b){_0x371963[_0x8294('0x6b')]=_0x5e8b0b;return _0x371963;});}})['then'](respondWithFilteredResult(_0x338fe4,_0x462395))['catch'](handleError(_0x338fe4,null));};exports[_0x8294('0x6f')]=function(_0x23a628,_0x491ad4,_0x3ed72d){return db[_0x8294('0x5c')][_0x8294('0x5d')]({'where':{'id':_0x23a628[_0x8294('0x65')]['id']}})['then'](handleEntityNotFound(_0x491ad4,null))[_0x8294('0x1f')](function(_0xf5c3f6){if(_0xf5c3f6){return _0xf5c3f6[_0x8294('0x6f')](_0x23a628[_0x8294('0x4b')]['ids']);}})[_0x8294('0x1f')](respondWithStatusCode(_0x491ad4,null))[_0x8294('0x29')](handleError(_0x491ad4,null));};exports['addAgents']=function(_0x33e722,_0x4207ca,_0xf9e99e){return db['WhatsappAccount'][_0x8294('0x5d')]({'where':{'id':_0x33e722[_0x8294('0x65')]['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x4207ca,null))[_0x8294('0x1f')](function(_0x24d6a5){if(_0x24d6a5){return _0x24d6a5[_0x8294('0x70')](_0x33e722['body']['ids'],_[_0x8294('0x71')](_0x33e722[_0x8294('0x3c')],['ids','id'])||{})[_0x8294('0x72')](function(_0x4ef7b3){for(var _0x21abba=0x0;_0x21abba<_0x33e722[_0x8294('0x3c')][_0x8294('0x73')]['length'];_0x21abba+=0x1){socket[_0x8294('0x74')](_0x8294('0x75'),{'UserId':_0x33e722['body'][_0x8294('0x73')][_0x21abba],'WhatsappAccountId':_0x33e722[_0x8294('0x65')]['id']});}return _0x4ef7b3;});}})[_0x8294('0x1f')](respondWithResult(_0x4207ca,null))[_0x8294('0x29')](handleError(_0x4207ca,null));};exports[_0x8294('0x76')]=function(_0x539664,_0x27cbb1,_0x1336b1){return db[_0x8294('0x5c')][_0x8294('0x5d')]({'where':{'id':_0x539664[_0x8294('0x65')]['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x27cbb1,null))[_0x8294('0x1f')](function(_0x6e9d73){if(_0x6e9d73){return _0x6e9d73[_0x8294('0x76')](_0x539664[_0x8294('0x4b')]['ids'])[_0x8294('0x1f')](function(){if(_[_0x8294('0x77')](_0x539664[_0x8294('0x4b')][_0x8294('0x73')])){for(var _0x239cb2=0x0;_0x239cb2<_0x539664[_0x8294('0x4b')][_0x8294('0x73')][_0x8294('0x4d')];_0x239cb2+=0x1){socket[_0x8294('0x74')](_0x8294('0x78'),{'UserId':Number(_0x539664['query'][_0x8294('0x73')][_0x239cb2]),'WhatsappAccountId':Number(_0x539664['params']['id'])});}}else{socket['emit'](_0x8294('0x78'),{'UserId':Number(_0x539664[_0x8294('0x4b')][_0x8294('0x73')]),'WhatsappAccountId':Number(_0x539664['params']['id'])});}});}})[_0x8294('0x1f')](respondWithStatusCode(_0x27cbb1,null))[_0x8294('0x29')](handleError(_0x27cbb1,null));};exports[_0x8294('0x79')]=function(_0xbe975a,_0x9a4cad,_0x4d6115){var _0x51e1a3={};var _0x3f916a={};var _0x49f072;var _0x5e4251;return db[_0x8294('0x5c')]['findOne']({'where':{'id':_0xbe975a[_0x8294('0x65')]['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x9a4cad,null))[_0x8294('0x1f')](function(_0xdc3f69){if(_0xdc3f69){_0x49f072=_0xdc3f69;_0x3f916a['model']=_[_0x8294('0x46')](db[_0x8294('0x7a')][_0x8294('0x43')]);_0x3f916a[_0x8294('0x4b')]=_['keys'](_0xbe975a[_0x8294('0x4b')]);_0x3f916a['filters']=_[_0x8294('0x4a')](_0x3f916a[_0x8294('0x48')],_0x3f916a[_0x8294('0x4b')]);_0x51e1a3[_0x8294('0x49')]=_[_0x8294('0x4a')](_0x3f916a['model'],qs['fields'](_0xbe975a[_0x8294('0x4b')][_0x8294('0x4c')]));_0x51e1a3['attributes']=_0x51e1a3[_0x8294('0x49')][_0x8294('0x4d')]?_0x51e1a3['attributes']:_0x3f916a['model'];_0x51e1a3['order']=qs[_0x8294('0x51')](_0xbe975a[_0x8294('0x4b')][_0x8294('0x51')]);_0x51e1a3[_0x8294('0x54')]=qs['filters'](_[_0x8294('0x52')](_0xbe975a[_0x8294('0x4b')],_0x3f916a[_0x8294('0x47')]));if(_0xbe975a[_0x8294('0x4b')][_0x8294('0x53')]){_0x51e1a3[_0x8294('0x54')]=_[_0x8294('0x55')](_0x51e1a3[_0x8294('0x54')],{'$or':_[_0x8294('0x42')](_0x51e1a3[_0x8294('0x49')],function(_0x212608){var _0x4bbf5b={};_0x4bbf5b[_0x212608]={'$like':'%'+_0xbe975a['query']['filter']+'%'};return _0x4bbf5b;})});}_0x51e1a3=_['merge']({},_0x51e1a3,_0xbe975a[_0x8294('0x58')]);return _0x49f072['getAgents'](_0x51e1a3);}})[_0x8294('0x1f')](function(_0x53dd7d){if(_0x53dd7d){_0x5e4251=_0x53dd7d[_0x8294('0x4d')];if(!_0xbe975a['query'][_0x8294('0x4e')](_0x8294('0x4f'))){_0x51e1a3[_0x8294('0x30')]=qs[_0x8294('0x30')](_0xbe975a[_0x8294('0x4b')][_0x8294('0x30')]);_0x51e1a3[_0x8294('0x2d')]=qs[_0x8294('0x2d')](_0xbe975a['query'][_0x8294('0x2d')]);}return _0x49f072[_0x8294('0x79')](_0x51e1a3);}})[_0x8294('0x1f')](function(_0x226182){if(_0x226182){return _0x226182?{'count':_0x5e4251,'rows':_0x226182}:null;}})[_0x8294('0x1f')](respondWithResult(_0x9a4cad,null))['catch'](handleError(_0x9a4cad,null));};exports[_0x8294('0x7b')]=function(_0x4c83df,_0x2a2beb,_0x222db7){return db[_0x8294('0x5c')][_0x8294('0x6a')]({'where':{'id':_0x4c83df[_0x8294('0x65')]['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x2a2beb,null))[_0x8294('0x1f')](function(_0x5a3e23){if(_0x5a3e23){return db[_0x8294('0x7c')][_0x8294('0x7d')](function(_0x43a011){return db[_0x8294('0x7e')][_0x8294('0x36')]({'where':{'WhatsappAccountId':_0x4c83df['params']['id']},'transaction':_0x43a011})[_0x8294('0x1f')](function(_0x367015){var _0x47199e=_['map'](_0x4c83df['body'],function(_0x26ff69){_0x26ff69[_0x8294('0x67')]=_0x4c83df[_0x8294('0x65')]['id'];return _0x26ff69;});return db[_0x8294('0x7e')][_0x8294('0x7f')](_0x47199e,{'transaction':_0x43a011});});})[_0x8294('0x1f')](function(){return db[_0x8294('0x7e')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x4c83df[_0x8294('0x65')]['id']},'order':_0x8294('0x80')});});}})[_0x8294('0x1f')](respondWithResult(_0x2a2beb,null))[_0x8294('0x29')](handleError(_0x2a2beb,null));};exports[_0x8294('0x81')]=function(_0x39fc5d,_0x26122f,_0x4b0bfe){var _0x36f79b={};var _0x3b917f={};var _0x579fad;var _0x43d677;return db['WhatsappAccount'][_0x8294('0x6a')]({'where':{'id':_0x39fc5d[_0x8294('0x65')]['id']}})[_0x8294('0x1f')](handleEntityNotFound(_0x26122f,null))[_0x8294('0x1f')](function(_0x32945b){if(_0x32945b){_0x579fad=_0x32945b;_0x3b917f[_0x8294('0x48')]=_['keys'](db['WhatsappApplication'][_0x8294('0x43')]);_0x3b917f[_0x8294('0x4b')]=_[_0x8294('0x46')](_0x39fc5d['query']);_0x3b917f['filters']=_['intersection'](_0x3b917f[_0x8294('0x48')],_0x3b917f[_0x8294('0x4b')]);_0x36f79b[_0x8294('0x49')]=_[_0x8294('0x4a')](_0x3b917f['model'],qs[_0x8294('0x4c')](_0x39fc5d[_0x8294('0x4b')][_0x8294('0x4c')]));_0x36f79b[_0x8294('0x49')]=_0x36f79b[_0x8294('0x49')][_0x8294('0x4d')]?_0x36f79b[_0x8294('0x49')]:_0x3b917f[_0x8294('0x48')];_0x36f79b['order']=qs['sort'](_0x39fc5d[_0x8294('0x4b')][_0x8294('0x51')]);_0x36f79b['where']=qs[_0x8294('0x47')](_[_0x8294('0x52')](_0x39fc5d['query'],_0x3b917f[_0x8294('0x47')]));if(_0x39fc5d[_0x8294('0x4b')][_0x8294('0x53')]){_0x36f79b[_0x8294('0x54')]=_['merge'](_0x36f79b[_0x8294('0x54')],{'$or':_[_0x8294('0x42')](_0x36f79b[_0x8294('0x49')],function(_0x26354a){var _0x453e4c={};_0x453e4c[_0x26354a]={'$like':'%'+_0x39fc5d[_0x8294('0x4b')][_0x8294('0x53')]+'%'};return _0x453e4c;})});}_0x36f79b=_['merge']({},_0x36f79b,_0x39fc5d[_0x8294('0x58')]);return _0x579fad[_0x8294('0x81')](_0x36f79b);}})[_0x8294('0x1f')](function(_0x5bd578){if(_0x5bd578){_0x43d677=_0x5bd578['length'];if(!_0x39fc5d[_0x8294('0x4b')][_0x8294('0x4e')](_0x8294('0x4f'))){_0x36f79b[_0x8294('0x30')]=qs[_0x8294('0x30')](_0x39fc5d['query'][_0x8294('0x30')]);_0x36f79b['offset']=qs[_0x8294('0x2d')](_0x39fc5d[_0x8294('0x4b')][_0x8294('0x2d')]);}return _0x579fad[_0x8294('0x81')](_0x36f79b);}})[_0x8294('0x1f')](function(_0x5b3548){if(_0x5b3548){return _0x5b3548?{'count':_0x43d677,'rows':_0x5b3548}:null;}})[_0x8294('0x1f')](respondWithResult(_0x26122f,null))['catch'](handleError(_0x26122f,null));};exports[_0x8294('0x82')]=function(_0xf8f219,_0x4cdfd6,_0x1b12ef){var _0x4f09a0={'channel':'whatsapp'};var _0x4d37f0=[];var _0x553502=[];var _0x3b7458={};return db[_0x8294('0x5c')][_0x8294('0x5d')]({'where':{'id':_0xf8f219[_0x8294('0x65')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x8294('0x83')}]})[_0x8294('0x1f')](handleEntityNotFound(_0x4cdfd6,null))[_0x8294('0x1f')](function(_0x534c58){_0x4f09a0[_0x8294('0x3e')]=_0x534c58;_0x4f09a0[_0x8294('0x84')]=_['orderBy'](_0x534c58[_0x8294('0x83')],[_0x8294('0x80')],[_0x8294('0x85')]);if(_0x4f09a0[_0x8294('0x3e')][_0x8294('0x83')]){delete _0x4f09a0['account'][_0x8294('0x83')];}return db['CmContact'][_0x8294('0x66')]();})[_0x8294('0x1f')](function(_0x3edd08){if(!_0x3edd08){throw new db[(_0x8294('0x86'))][(_0x8294('0x87'))](_0x8294('0x88'));}_0x4d37f0=_['difference'](_[_0x8294('0x46')](_0x3edd08),['createdAt',_0x8294('0x89')]);_0x553502=_[_0x8294('0x8a')](_['keys'](_0x3edd08),[_0x8294('0x8b'),_0x8294('0x89'),'CompanyId','ListId']);_0x4f09a0[_0x8294('0x3c')]={'mapKey':_0x8294('0x8c')};if(_0x4f09a0[_0x8294('0x3e')][_0x8294('0x56')]&&_0x4f09a0[_0x8294('0x3e')][_0x8294('0x56')]===_0x8294('0x8d')){_0x4f09a0[_0x8294('0x3c')][_0x8294('0x8e')]=_0xf8f219[_0x8294('0x3c')][_0x8294('0x8f')][_0x8294('0x90')]('whatsapp:','');_0x4f09a0['body'][_0x8294('0x3c')]=_0xf8f219[_0x8294('0x3c')]['Body'];_0x4f09a0[_0x8294('0x3c')][_0x8294('0x91')]=_0xf8f219[_0x8294('0x3c')][_0x8294('0x92')];}if(_0x4f09a0[_0x8294('0x3c')]['id']){delete _0x4f09a0[_0x8294('0x3c')]['id'];}if(_[_0x8294('0x93')](_0x4f09a0['body']['from'])){throw new db[(_0x8294('0x86'))][(_0x8294('0x87'))](_0x8294('0x94'));}if(_[_0x8294('0x93')](_0x4f09a0[_0x8294('0x3c')][_0x8294('0x3c')])||_0x4f09a0[_0x8294('0x3c')][_0x8294('0x3c')]===''){throw new db[(_0x8294('0x86'))][(_0x8294('0x87'))](_0x8294('0x95'));}if(_[_0x8294('0x93')](_0x4f09a0[_0x8294('0x3c')][_0x8294('0x96')])){throw new db[(_0x8294('0x86'))][(_0x8294('0x87'))](_0x8294('0x97')+_0x553502);}if(!_[_0x8294('0x98')](_0x553502,_0x4f09a0[_0x8294('0x3c')][_0x8294('0x96')])){throw new db[(_0x8294('0x86'))][(_0x8294('0x87'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x553502);}_0x3b7458[_0x4f09a0['body'][_0x8294('0x96')]]=_0x4f09a0[_0x8294('0x3c')][_0x8294('0x8e')];return db[_0x8294('0x99')][_0x8294('0x5d')]({'where':{'id':_0x4f09a0[_0x8294('0x3e')][_0x8294('0x9a')]},'include':[{'model':db[_0x8294('0x9b')],'as':_0x8294('0x9c'),'where':_0x3b7458,'limit':0x1,'order':[[_0x8294('0x89'),'DESC']]}]});})['then'](handleEntityNotFound(_0x4cdfd6,null))[_0x8294('0x1f')](function(_0xbd083b){if(_0xbd083b){_0x4f09a0['list']=_[_0x8294('0x71')](_0xbd083b,[_0x8294('0x9c')]);if(_0xbd083b['Contacts'][_0x8294('0x4d')]){return _0xbd083b['Contacts'][0x0];}var _0x30d362=_[_0x8294('0x1a')](_0x4f09a0['body'],{'firstName':_0x4f09a0[_0x8294('0x3c')][_0x8294('0x8e')],'ListId':_0xbd083b['id']});_0x30d362[_0x4f09a0[_0x8294('0x3c')][_0x8294('0x96')]]=_0x4f09a0[_0x8294('0x3c')][_0x8294('0x8e')];return db[_0x8294('0x9b')][_0x8294('0x5e')](_0x30d362,{'fields':_0x4d37f0,'raw':!![]});}})[_0x8294('0x1f')](handleEntityNotFound(_0x4cdfd6,null))['then'](function(_0x597f8b){if(_0x597f8b){_0x4f09a0[_0x8294('0x9d')]=_0x597f8b;var _0x59bd72={'ContactId':_0x597f8b['id'],'phone':_0x4f09a0['body'][_0x8294('0x8e')],'WhatsappAccountId':_0xf8f219['params']['id']};var _0x255e25={'ContactId':_0x597f8b['id'],'WhatsappAccountId':_0xf8f219[_0x8294('0x65')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x8294('0x5d')]({'where':_0x255e25})['then'](function(_0x2441fc){if(_0x2441fc){return[_0x2441fc,![]];}return db[_0x8294('0x9e')][_0x8294('0x5e')](_0x59bd72)[_0x8294('0x1f')](function(_0x4ecb1b){return[_0x4ecb1b,!![]];});});}})[_0x8294('0x72')](function(_0x39570b,_0x3930e0){_0x4f09a0['interaction']=_0x39570b[_0x8294('0x37')]({'plain':!![]});_0x4f09a0[_0x8294('0x9f')][_0x8294('0xa0')]=![];if(_0x3930e0){if(_0x4f09a0[_0x8294('0x3e')][_0x8294('0xa1')]){_0x4f09a0[_0x8294('0x84')][_0x8294('0xa2')]({'id':0x0,'priority':_0x4f09a0[_0x8294('0x84')]['length']+0x1,'app':_0x8294('0xa3'),'appdata':_0x8294('0xa4'),'interval':_0x8294('0xa5')});}_0x4f09a0[_0x8294('0x9f')]['created']=!![];}return db[_0x8294('0xa6')][_0x8294('0x5e')]({'phone':_0x4f09a0[_0x8294('0x3c')]['from'],'messageId':_0x4f09a0[_0x8294('0x3c')][_0x8294('0x91')],'body':_0x4f09a0[_0x8294('0x3c')][_0x8294('0x3c')],'WhatsappAccountId':_0xf8f219[_0x8294('0x65')]['id'],'WhatsappInteractionId':_0x39570b['id'],'direction':'in','ContactId':_0x39570b[_0x8294('0xa7')],'AttachmentId':_0x4f09a0[_0x8294('0x3c')]['AttachmentId']});})[_0x8294('0x1f')](function(_0x464351){_0x4f09a0[_0x8294('0x27')]=_0x464351;if(_0x4f09a0[_0x8294('0x9f')]['UserId']){return db[_0x8294('0x7a')][_0x8294('0x5d')]({'attributes':['id','name'],'where':{'id':_0x4f09a0[_0x8294('0x9f')][_0x8294('0xa8')]}})[_0x8294('0x1f')](function(_0x265c25){if(_0x265c25){_0x4f09a0[_0x8294('0x84')][_0x8294('0xa9')]({'id':0x0,'priority':0x0,'app':_0x8294('0x3d'),'appdata':_0x265c25[_0x8294('0x3a')]+','+(_0x4f09a0['account'][_0x8294('0xaa')]||0xa),'interval':_0x8294('0xa5')});}return respondWithRpcPromise(_0x8294('0xab'),_0x8294('0xac'),_0x4f09a0);});}return respondWithRpcPromise(_0x8294('0xab'),_0x8294('0xac'),_0x4f09a0);})['then'](function(_0x27659d){if(_0x27659d){var _0x344f02=0xc8;var _0x5debc4='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5debc4,_0x344f02,_0x8294('0xad'));logger[_0x8294('0xae')](_0x8294('0xaf'),_0x5debc4,_0x344f02,'entity\x20found',JSON[_0x8294('0x23')](_0x27659d));if(_0x4f09a0[_0x8294('0x3e')]['type']==='twilio'){return _0x4cdfd6[_0x8294('0x2a')](_0x344f02)[_0x8294('0x31')](_0x8294('0xb0'),_0x8294('0xb1'))['send'](_0x8294('0xb2'));}else{return _0x4cdfd6[_0x8294('0x2a')](_0x344f02)['json'](_0x27659d);}}})['catch'](handleError(_0x4cdfd6,null));};exports[_0x8294('0x3b')]=function(_0x4b8e73,_0xc937a9,_0x469d91){var _0x16ada8,_0x44ff17,_0x3f7d3c;if(_['isNil'](_0x4b8e73[_0x8294('0x3c')][_0x8294('0x3c')])||_0x4b8e73[_0x8294('0x3c')][_0x8294('0x3c')]===''){throw new db[(_0x8294('0x86'))][(_0x8294('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8294('0x93')](_0x4b8e73[_0x8294('0x3c')]['to'])){throw new db[(_0x8294('0x86'))][(_0x8294('0x87'))]('to\x20is\x20mandatory');}_0x16ada8=_0x4b8e73[_0x8294('0x3c')]['to'];return db[_0x8294('0x5c')]['find']({'where':{'id':_0x4b8e73[_0x8294('0x65')]['id']},'include':[{'model':db[_0x8294('0x99')],'as':'List','include':[{'model':db[_0x8294('0x9b')],'as':_0x8294('0x9c'),'where':{'mobile':_0x16ada8},'limit':0x1,'order':[[_0x8294('0x89'),_0x8294('0xb3')]]}]}]})['then'](handleEntityNotFound(_0xc937a9,null))[_0x8294('0x1f')](function(_0x4ba160){if(_0x4ba160&&_0x4ba160['List']){_0x44ff17=_0x4ba160[_0x8294('0x37')]({'plain':!![]});if(_0x44ff17[_0x8294('0xb4')]&&_0x44ff17[_0x8294('0xb4')][_0x8294('0x9c')][_0x8294('0x4d')]){return _0x44ff17[_0x8294('0xb4')]['Contacts'][0x0];}return db[_0x8294('0x9b')][_0x8294('0x5e')](_['defaults'](_0x4b8e73[_0x8294('0x3c')],{'firstName':_0x16ada8,'mobile':_0x16ada8,'phone':_0x16ada8,'ListId':_0x44ff17[_0x8294('0x9a')]}));}})['then'](handleEntityNotFound(_0xc937a9,null))['then'](function(_0x4f45f3){if(_0x4f45f3){_0x3f7d3c=_0x4f45f3;return db[_0x8294('0x9e')][_0x8294('0x5d')]({'where':{'ContactId':_0x3f7d3c['id'],'closed':![],'WhatsappAccountId':_0x44ff17['id']}})[_0x8294('0x1f')](function(_0x51be5a){if(_0x51be5a){return[_0x51be5a,![]];}return db[_0x8294('0x9e')][_0x8294('0x5e')]({'UserId':_0x4b8e73[_0x8294('0x5f')]['id'],'ContactId':_0x3f7d3c['id'],'WhatsappAccountId':_0x44ff17['id'],'phone':_0x16ada8,'firstMsgDirection':_0x8294('0xb5'),'Messages':[_['merge'](_0x4b8e73['body'],{'read':![],'body':_0x4b8e73[_0x8294('0x3c')][_0x8294('0x3c')],'phone':_0x16ada8,'WhatsappAccountId':_0x44ff17['id'],'UserId':_0x4b8e73[_0x8294('0x5f')]['id'],'ContactId':_0x3f7d3c['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x8294('0xb6')}]})['then'](function(_0x5d6889){return[_0x5d6889,!![]];});});}})[_0x8294('0x72')](function(_0xc2924f,_0x43525d){if(_0x43525d){return _0xc2924f;}return db['WhatsappMessage'][_0x8294('0x5e')](_['merge'](_0x4b8e73[_0x8294('0x3c')],{'read':![],'body':_0x4b8e73[_0x8294('0x3c')][_0x8294('0x3c')],'phone':_0x16ada8,'WhatsappAccountId':_0x44ff17['id'],'WhatsappInteractionId':_0xc2924f['id'],'UserId':_0x4b8e73['user']['id'],'ContactId':_0x3f7d3c['id']}))[_0x8294('0x1f')](function(_0xc1d3dd){_0xc2924f[_0x8294('0xb7')]['Messages']=[];_0xc2924f[_0x8294('0xb7')][_0x8294('0xb6')]['push'](_0xc1d3dd[_0x8294('0xb7')]);return _0xc2924f;});})[_0x8294('0x1f')](respondWithResult(_0xc937a9,null))[_0x8294('0x29')](handleError(_0xc937a9,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2e966b5..cdd3e88 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 _0x9f37=['../../mysqldb','setMaxListeners','remove','emit','hook','exports','events'];(function(_0xb5fc40,_0x4e9383){var _0x303955=function(_0x11b94e){while(--_0x11b94e){_0xb5fc40['push'](_0xb5fc40['shift']());}};_0x303955(++_0x4e9383);}(_0x9f37,0xd1));var _0x79f3=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x9f37[_0x243b2f];return _0xcb3c2d;};'use strict';var EventEmitter=require(_0x79f3('0x0'));var WhatsappAccount=require(_0x79f3('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x79f3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x79f3('0x3')};function emitEvent(_0x3c3d35){return function(_0x4b11da,_0x599d3a,_0x361808){WhatsappAccountEvents[_0x79f3('0x4')](_0x3c3d35+':'+_0x4b11da['id'],_0x4b11da);WhatsappAccountEvents['emit'](_0x3c3d35,_0x4b11da);_0x361808(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x79f3('0x5')](e,emitEvent(event));}}module[_0x79f3('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0xeda8=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xeda8,0x104));var _0x8eda=function(_0x1b412a,_0x362c44){_0x1b412a=_0x1b412a-0x0;var _0x1c0860=_0xeda8[_0x1b412a];return _0x1c0860;};'use strict';var EventEmitter=require(_0x8eda('0x0'));var WhatsappAccount=require(_0x8eda('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8eda('0x2')](0x0);var events={'afterCreate':_0x8eda('0x3'),'afterUpdate':_0x8eda('0x4'),'afterDestroy':_0x8eda('0x5')};function emitEvent(_0x37ab2c){return function(_0x94b83f,_0x25b19a,_0x3eb7b1){WhatsappAccountEvents[_0x8eda('0x6')](_0x37ab2c+':'+_0x94b83f['id'],_0x94b83f);WhatsappAccountEvents[_0x8eda('0x6')](_0x37ab2c,_0x94b83f);_0x3eb7b1(null);};}for(var e in events){if(events[_0x8eda('0x7')](e)){var event=events[e];WhatsappAccount[_0x8eda('0x8')](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 7a22218..9499b5c 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 _0x4f89=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x2dd63f,_0x5338b7){var _0x5172fd=function(_0x3b8f32){while(--_0x3b8f32){_0x2dd63f['push'](_0x2dd63f['shift']());}};_0x5172fd(++_0x5338b7);}(_0x4f89,0x12c));var _0x94f8=function(_0x4ac931,_0x502806){_0x4ac931=_0x4ac931-0x0;var _0x1e0532=_0x4f89[_0x4ac931];return _0x1e0532;};'use strict';var _=require(_0x94f8('0x0'));var util=require(_0x94f8('0x1'));var logger=require(_0x94f8('0x2'))(_0x94f8('0x3'));var moment=require(_0x94f8('0x4'));var BPromise=require(_0x94f8('0x5'));var rp=require(_0x94f8('0x6'));var fs=require('fs');var path=require(_0x94f8('0x7'));var rimraf=require('rimraf');var config=require(_0x94f8('0x8'));var attributes=require(_0x94f8('0x9'));module[_0x94f8('0xa')]=function(_0x283b08,_0x90d4d6){return _0x283b08[_0x94f8('0xb')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d18=['api','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','util','../../config/logger'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x7d18,0x1ca));var _0x87d1=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0x7d18[_0x1f83a5];return _0x45edf0;};'use strict';var _=require('lodash');var util=require(_0x87d1('0x0'));var logger=require(_0x87d1('0x1'))(_0x87d1('0x2'));var moment=require('moment');var BPromise=require(_0x87d1('0x3'));var rp=require(_0x87d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x87d1('0x5'));var config=require(_0x87d1('0x6'));var attributes=require(_0x87d1('0x7'));module[_0x87d1('0x8')]=function(_0x50aca8,_0x4d2ae7){return _0x50aca8['define'](_0x87d1('0x9'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 734779c..e28f3a2 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 _0x3ce2=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','include','model','map','attributes','stringify','lodash','util','bluebird','randomstring','ioredis'];(function(_0xfff28b,_0x204443){var _0x13c9f0=function(_0x4d9f58){while(--_0x4d9f58){_0xfff28b['push'](_0xfff28b['shift']());}};_0x13c9f0(++_0x204443);}(_0x3ce2,0x192));var _0x23ce=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x3ce2[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0x23ce('0x0'));var util=require(_0x23ce('0x1'));var moment=require('moment');var BPromise=require(_0x23ce('0x2'));var rs=require(_0x23ce('0x3'));var fs=require('fs');var Redis=require(_0x23ce('0x4'));var db=require(_0x23ce('0x5'))['db'];var utils=require(_0x23ce('0x6'));var logger=require('../../config/logger')(_0x23ce('0x7'));var config=require(_0x23ce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23ce('0x9')][_0x23ce('0xa')]({'port':0x232a});config[_0x23ce('0xb')]=_[_0x23ce('0xc')](config[_0x23ce('0xb')],{'host':_0x23ce('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23ce('0xb')]));require(_0x23ce('0xe'))['register'](socket);function respondWithRpcPromise(_0x58e051,_0x5a8ffc,_0x59ca1a){return new BPromise(function(_0x3bba5b,_0x19964f){return client[_0x23ce('0xf')](_0x58e051,_0x59ca1a)[_0x23ce('0x10')](function(_0x246916){logger[_0x23ce('0x11')](_0x23ce('0x12'),_0x5a8ffc,'request\x20sent');logger[_0x23ce('0x13')](_0x23ce('0x14'),_0x5a8ffc,_0x23ce('0x15'),JSON['stringify'](_0x246916));if(_0x246916[_0x23ce('0x16')]){if(_0x246916['error'][_0x23ce('0x17')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5a8ffc,_0x246916[_0x23ce('0x16')][_0x23ce('0x18')]);return _0x19964f(_0x246916[_0x23ce('0x16')][_0x23ce('0x18')]);}logger[_0x23ce('0x16')](_0x23ce('0x12'),_0x5a8ffc,_0x246916[_0x23ce('0x16')][_0x23ce('0x18')]);return _0x3bba5b(_0x246916[_0x23ce('0x16')][_0x23ce('0x18')]);}else{logger[_0x23ce('0x11')](_0x23ce('0x12'),_0x5a8ffc,_0x23ce('0x15'));_0x3bba5b(_0x246916[_0x23ce('0x19')][_0x23ce('0x18')]);}})[_0x23ce('0x1a')](function(_0x2af883){logger[_0x23ce('0x16')](_0x23ce('0x12'),_0x5a8ffc,_0x2af883);_0x19964f(_0x2af883);});});}exports[_0x23ce('0x1b')]=function(_0x172a65){var _0x1a162e=this;return new Promise(function(_0x23abc7,_0x42658a){return db[_0x23ce('0x1c')]['find']({'raw':_0x172a65[_0x23ce('0x1d')]?_0x172a65[_0x23ce('0x1d')][_0x23ce('0x1e')]===undefined?!![]:![]:!![],'where':_0x172a65[_0x23ce('0x1d')]?_0x172a65[_0x23ce('0x1d')][_0x23ce('0x1f')]||null:null,'attributes':_0x172a65[_0x23ce('0x1d')]?_0x172a65[_0x23ce('0x1d')]['attributes']||null:null,'include':_0x172a65[_0x23ce('0x1d')]?_0x172a65[_0x23ce('0x1d')][_0x23ce('0x20')]?_['map'](_0x172a65[_0x23ce('0x1d')][_0x23ce('0x20')],function(_0x1b838f){return{'model':db[_0x1b838f[_0x23ce('0x21')]],'as':_0x1b838f['as'],'attributes':_0x1b838f['attributes'],'include':_0x1b838f[_0x23ce('0x20')]?_[_0x23ce('0x22')](_0x1b838f[_0x23ce('0x20')],function(_0x236e68){return{'model':db[_0x236e68['model']],'as':_0x236e68['as'],'attributes':_0x236e68[_0x23ce('0x23')],'include':_0x236e68['include']?_[_0x23ce('0x22')](_0x236e68[_0x23ce('0x20')],function(_0x5980ac){return{'model':db[_0x5980ac['model']],'as':_0x5980ac['as'],'attributes':_0x5980ac[_0x23ce('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d0b75){logger[_0x23ce('0x11')](_0x23ce('0x1b'),_0x172a65);logger[_0x23ce('0x13')](_0x23ce('0x1b'),_0x172a65,JSON[_0x23ce('0x24')](_0x2d0b75));_0x23abc7(_0x2d0b75);})[_0x23ce('0x1a')](function(_0x3600cd){logger['error'](_0x23ce('0x1b'),_0x3600cd[_0x23ce('0x18')],_0x172a65);_0x42658a(_0x1a162e[_0x23ce('0x16')](0x1f4,_0x3600cd['message']));});});}; \ No newline at end of file +var _0xc30f=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowWhatsappAccount','find','raw','options','attributes','include','map','model','lodash','util','moment'];(function(_0x125171,_0x1d331f){var _0x517f5d=function(_0x33c2bb){while(--_0x33c2bb){_0x125171['push'](_0x125171['shift']());}};_0x517f5d(++_0x1d331f);}(_0xc30f,0x1a1));var _0xfc30=function(_0x6ce349,_0x5ca89e){_0x6ce349=_0x6ce349-0x0;var _0x2dcda5=_0xc30f[_0x6ce349];return _0x2dcda5;};'use strict';var _=require(_0xfc30('0x0'));var util=require(_0xfc30('0x1'));var moment=require(_0xfc30('0x2'));var BPromise=require(_0xfc30('0x3'));var rs=require(_0xfc30('0x4'));var fs=require('fs');var Redis=require(_0xfc30('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc30('0x6'));var logger=require(_0xfc30('0x7'))('rpc');var config=require(_0xfc30('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xfc30('0x9')]=_[_0xfc30('0xa')](config[_0xfc30('0x9')],{'host':_0xfc30('0xb'),'port':0x18eb});var socket=require(_0xfc30('0xc'))(new Redis(config[_0xfc30('0x9')]));require(_0xfc30('0xd'))[_0xfc30('0xe')](socket);function respondWithRpcPromise(_0xe8a4c5,_0x277d5c,_0x434541){return new BPromise(function(_0x5a7d30,_0x4fb392){return client[_0xfc30('0xf')](_0xe8a4c5,_0x434541)[_0xfc30('0x10')](function(_0x18a630){logger[_0xfc30('0x11')](_0xfc30('0x12'),_0x277d5c,'request\x20sent');logger[_0xfc30('0x13')](_0xfc30('0x14'),_0x277d5c,_0xfc30('0x15'),JSON[_0xfc30('0x16')](_0x18a630));if(_0x18a630[_0xfc30('0x17')]){if(_0x18a630['error']['code']===0x1f4){logger[_0xfc30('0x17')](_0xfc30('0x12'),_0x277d5c,_0x18a630[_0xfc30('0x17')][_0xfc30('0x18')]);return _0x4fb392(_0x18a630[_0xfc30('0x17')]['message']);}logger[_0xfc30('0x17')](_0xfc30('0x12'),_0x277d5c,_0x18a630['error'][_0xfc30('0x18')]);return _0x5a7d30(_0x18a630[_0xfc30('0x17')][_0xfc30('0x18')]);}else{logger[_0xfc30('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x277d5c,'request\x20sent');_0x5a7d30(_0x18a630[_0xfc30('0x19')]['message']);}})[_0xfc30('0x1a')](function(_0x51cce3){logger['error'](_0xfc30('0x12'),_0x277d5c,_0x51cce3);_0x4fb392(_0x51cce3);});});}exports[_0xfc30('0x1b')]=function(_0x4eb476){var _0x5a292b=this;return new Promise(function(_0x16ee34,_0x52d75b){return db['WhatsappAccount'][_0xfc30('0x1c')]({'raw':_0x4eb476['options']?_0x4eb476['options'][_0xfc30('0x1d')]===undefined?!![]:![]:!![],'where':_0x4eb476[_0xfc30('0x1e')]?_0x4eb476[_0xfc30('0x1e')]['where']||null:null,'attributes':_0x4eb476[_0xfc30('0x1e')]?_0x4eb476[_0xfc30('0x1e')][_0xfc30('0x1f')]||null:null,'include':_0x4eb476[_0xfc30('0x1e')]?_0x4eb476[_0xfc30('0x1e')][_0xfc30('0x20')]?_[_0xfc30('0x21')](_0x4eb476['options'][_0xfc30('0x20')],function(_0x252403){return{'model':db[_0x252403[_0xfc30('0x22')]],'as':_0x252403['as'],'attributes':_0x252403[_0xfc30('0x1f')],'include':_0x252403[_0xfc30('0x20')]?_['map'](_0x252403[_0xfc30('0x20')],function(_0x57c7f2){return{'model':db[_0x57c7f2[_0xfc30('0x22')]],'as':_0x57c7f2['as'],'attributes':_0x57c7f2['attributes'],'include':_0x57c7f2[_0xfc30('0x20')]?_[_0xfc30('0x21')](_0x57c7f2[_0xfc30('0x20')],function(_0x26cd12){return{'model':db[_0x26cd12[_0xfc30('0x22')]],'as':_0x26cd12['as'],'attributes':_0x26cd12['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc30('0x10')](function(_0x2b5639){logger[_0xfc30('0x11')](_0xfc30('0x1b'),_0x4eb476);logger[_0xfc30('0x13')](_0xfc30('0x1b'),_0x4eb476,JSON[_0xfc30('0x16')](_0x2b5639));_0x16ee34(_0x2b5639);})[_0xfc30('0x1a')](function(_0x4aca98){logger['error'](_0xfc30('0x1b'),_0x4aca98['message'],_0x4eb476);_0x52d75b(_0x5a292b[_0xfc30('0x17')](0x1f4,_0x4aca98[_0xfc30('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index f0f6b72..ec7254a 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 _0x173f=['remove','update','removeListener','register','whatsappAccount:','./whatsappAccount.events'];(function(_0x45cd35,_0x41147c){var _0x16db84=function(_0x1ce5e9){while(--_0x1ce5e9){_0x45cd35['push'](_0x45cd35['shift']());}};_0x16db84(++_0x41147c);}(_0x173f,0x101));var _0xf173=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x173f[_0x321bb2];return _0x9c12ed;};'use strict';var WhatsappAccountEvents=require(_0xf173('0x0'));var events=['save',_0xf173('0x1'),_0xf173('0x2')];function createListener(_0x212f78,_0x1f6565){return function(_0x22b5ae){_0x1f6565['emit'](_0x212f78,_0x22b5ae);};}function removeListener(_0x4989bb,_0xfb6c92){return function(){WhatsappAccountEvents[_0xf173('0x3')](_0x4989bb,_0xfb6c92);};}exports[_0xf173('0x4')]=function(_0x1c4de9){for(var _0x500326=0x0,_0x39ee1a=events['length'];_0x500326<_0x39ee1a;_0x500326++){var _0x147b07=events[_0x500326];var _0x113803=createListener(_0xf173('0x5')+_0x147b07,_0x1c4de9);WhatsappAccountEvents['on'](_0x147b07,_0x113803);}}; \ No newline at end of file +var _0x505f=['length','whatsappAccount:','./whatsappAccount.events','remove','update','emit'];(function(_0x3599fc,_0x5455e8){var _0x5991c7=function(_0x82374f){while(--_0x82374f){_0x3599fc['push'](_0x3599fc['shift']());}};_0x5991c7(++_0x5455e8);}(_0x505f,0x1a0));var _0xf505=function(_0x2f5a36,_0x34a9af){_0x2f5a36=_0x2f5a36-0x0;var _0x561c9b=_0x505f[_0x2f5a36];return _0x561c9b;};'use strict';var WhatsappAccountEvents=require(_0xf505('0x0'));var events=['save',_0xf505('0x1'),_0xf505('0x2')];function createListener(_0x1a176f,_0x4bd3bc){return function(_0x1ab09e){_0x4bd3bc[_0xf505('0x3')](_0x1a176f,_0x1ab09e);};}function removeListener(_0x5dfe52,_0x499970){return function(){WhatsappAccountEvents['removeListener'](_0x5dfe52,_0x499970);};}exports['register']=function(_0xc45929){for(var _0x3b75af=0x0,_0x2523c8=events[_0xf505('0x4')];_0x3b75af<_0x2523c8;_0x3b75af++){var _0x49e931=events[_0x3b75af];var _0x560cdc=createListener(_0xf505('0x5')+_0x49e931,_0xc45929);WhatsappAccountEvents['on'](_0x49e931,_0x560cdc);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 6653da8..5641fab 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 _0x5c78=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x211f2e,_0x28b432){var _0x2bb0d1=function(_0x55b7a0){while(--_0x55b7a0){_0x211f2e['push'](_0x211f2e['shift']());}};_0x2bb0d1(++_0x28b432);}(_0x5c78,0x74));var _0x85c7=function(_0x53fa8f,_0x59454f){_0x53fa8f=_0x53fa8f-0x0;var _0x12dc09=_0x5c78[_0x53fa8f];return _0x12dc09;};'use strict';var multer=require(_0x85c7('0x0'));var util=require(_0x85c7('0x1'));var path=require(_0x85c7('0x2'));var timeout=require(_0x85c7('0x3'));var express=require(_0x85c7('0x4'));var router=express[_0x85c7('0x5')]();var fs_extra=require(_0x85c7('0x6'));var auth=require(_0x85c7('0x7'));var interaction=require(_0x85c7('0x8'));var config=require(_0x85c7('0x9'));var controller=require('./whatsappApplication.controller');router[_0x85c7('0xa')]('/',auth['isAuthenticated'](),controller[_0x85c7('0xb')]);router[_0x85c7('0xa')](_0x85c7('0xc'),auth[_0x85c7('0xd')](),controller[_0x85c7('0xe')]);router['post']('/',auth[_0x85c7('0xd')](),controller[_0x85c7('0xf')]);router['put'](_0x85c7('0xc'),auth['isAuthenticated'](),controller[_0x85c7('0x10')]);router[_0x85c7('0x11')](_0x85c7('0xc'),auth['isAuthenticated'](),controller[_0x85c7('0x12')]);module[_0x85c7('0x13')]=router; \ No newline at end of file +var _0xa5f6=['destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x157b44,_0x1efab5){var _0x1fddb7=function(_0x5d82e7){while(--_0x5d82e7){_0x157b44['push'](_0x157b44['shift']());}};_0x1fddb7(++_0x1efab5);}(_0xa5f6,0x177));var _0x6a5f=function(_0x43f681,_0x1d7b5e){_0x43f681=_0x43f681-0x0;var _0x13a6ca=_0xa5f6[_0x43f681];return _0x13a6ca;};'use strict';var multer=require(_0x6a5f('0x0'));var util=require('util');var path=require(_0x6a5f('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a5f('0x2'));var router=express[_0x6a5f('0x3')]();var fs_extra=require(_0x6a5f('0x4'));var auth=require(_0x6a5f('0x5'));var interaction=require(_0x6a5f('0x6'));var config=require('../../config/environment');var controller=require(_0x6a5f('0x7'));router[_0x6a5f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6a5f('0x8')](_0x6a5f('0x9'),auth['isAuthenticated'](),controller[_0x6a5f('0xa')]);router[_0x6a5f('0xb')]('/',auth[_0x6a5f('0xc')](),controller[_0x6a5f('0xd')]);router[_0x6a5f('0xe')](_0x6a5f('0x9'),auth[_0x6a5f('0xc')](),controller[_0x6a5f('0xf')]);router['delete'](_0x6a5f('0x9'),auth[_0x6a5f('0xc')](),controller[_0x6a5f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 19eafc6..a4cc157 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 _0xf730=['noop','STRING','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf730,0x1d9));var _0x0f73=function(_0x5673c4,_0x5b672d){_0x5673c4=_0x5673c4-0x0;var _0x32b859=_0xf730[_0x5673c4];return _0x32b859;};'use strict';var Sequelize=require('sequelize');module[_0x0f73('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0f73('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0f73('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x62ae=['STRING','*,*,*,*','sequelize','exports','INTEGER','TEXT'];(function(_0x297400,_0x43bb1e){var _0x411663=function(_0x318c1f){while(--_0x318c1f){_0x297400['push'](_0x297400['shift']());}};_0x411663(++_0x43bb1e);}(_0x62ae,0x17c));var _0xe62a=function(_0x28d160,_0x19a922){_0x28d160=_0x28d160-0x0;var _0x94ce66=_0x62ae[_0x28d160];return _0x94ce66;};'use strict';var Sequelize=require(_0xe62a('0x0'));module[_0xe62a('0x1')]={'priority':{'type':Sequelize[_0xe62a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe62a('0x3')]()},'description':{'type':Sequelize[_0xe62a('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe62a('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index cfb2627..e9262ed 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 _0xaff2=['create','params','eml-format','rimraf','zip-dir','request-promise','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','name','send','merge','body','contact','message','agent','interaction','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find','catch'];(function(_0x380f96,_0x582012){var _0x128e02=function(_0x18c87f){while(--_0x18c87f){_0x380f96['push'](_0x380f96['shift']());}};_0x128e02(++_0x582012);}(_0xaff2,0x174));var _0x2aff=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xaff2[_0x277721];return _0x286051;};'use strict';var emlformat=require(_0x2aff('0x0'));var rimraf=require(_0x2aff('0x1'));var zipdir=require(_0x2aff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2aff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2aff('0x4'));var csv=require(_0x2aff('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2aff('0x6'));var _=require(_0x2aff('0x7'));var squel=require(_0x2aff('0x8'));var crypto=require(_0x2aff('0x9'));var jsforce=require(_0x2aff('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2aff('0xb'));var Papa=require(_0x2aff('0xc'));var Redis=require(_0x2aff('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2aff('0xe'));var as=require(_0x2aff('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2aff('0x10'));var config=require(_0x2aff('0x11'));var licenseUtil=require(_0x2aff('0x12'));var db=require(_0x2aff('0x13'))['db'];function respondWithStatusCode(_0x2f4508,_0x28c4d3){_0x28c4d3=_0x28c4d3||0xcc;return function(_0x14351f){if(_0x14351f){return _0x2f4508[_0x2aff('0x14')](_0x28c4d3);}return _0x2f4508[_0x2aff('0x15')](_0x28c4d3)[_0x2aff('0x16')]();};}function respondWithResult(_0xb75866,_0x22bb16){_0x22bb16=_0x22bb16||0xc8;return function(_0x5466b0){if(_0x5466b0){return _0xb75866[_0x2aff('0x15')](_0x22bb16)[_0x2aff('0x17')](_0x5466b0);}};}function respondWithFilteredResult(_0x178182,_0x5a19c9){return function(_0x3cdad0){if(_0x3cdad0){var _0xb5d17d=typeof _0x5a19c9[_0x2aff('0x18')]===_0x2aff('0x19')&&typeof _0x5a19c9[_0x2aff('0x1a')]===_0x2aff('0x19');var _0x434538=_0x3cdad0['count'];var _0x137c1e=_0xb5d17d?0x0:_0x5a19c9[_0x2aff('0x18')];var _0x2f4bd7=_0xb5d17d?_0x3cdad0[_0x2aff('0x1b')]:_0x5a19c9['offset']+_0x5a19c9['limit'];var _0x10ee1a;if(_0x2f4bd7>=_0x434538){_0x2f4bd7=_0x434538;_0x10ee1a=0xc8;}else{_0x10ee1a=0xce;}_0x178182[_0x2aff('0x15')](_0x10ee1a);return _0x178182[_0x2aff('0x1c')]('Content-Range',_0x137c1e+'-'+_0x2f4bd7+'/'+_0x434538)['json'](_0x3cdad0);}return null;};}function patchUpdates(_0x430905){return function(_0x6fe60e){try{jsonpatch[_0x2aff('0x1d')](_0x6fe60e,_0x430905,!![]);}catch(_0x10a42e){return BPromise[_0x2aff('0x1e')](_0x10a42e);}return _0x6fe60e['save']();};}function saveUpdates(_0x44cb79,_0x15919d){return function(_0x44a2dc){if(_0x44a2dc){return _0x44a2dc[_0x2aff('0x1f')](_0x44cb79)[_0x2aff('0x20')](function(_0x2c703e){return _0x2c703e;});}return null;};}function removeEntity(_0xbfa102,_0x4630c8){return function(_0x2e4867){if(_0x2e4867){return _0x2e4867[_0x2aff('0x21')]()[_0x2aff('0x20')](function(){_0xbfa102['status'](0xcc)[_0x2aff('0x16')]();});}};}function handleEntityNotFound(_0x303528,_0x1819a1){return function(_0x24c216){if(!_0x24c216){_0x303528[_0x2aff('0x14')](0x194);}return _0x24c216;};}function handleError(_0x473358,_0x4ef2de){_0x4ef2de=_0x4ef2de||0x1f4;return function(_0x2b7a62){logger['error'](_0x2b7a62['stack']);if(_0x2b7a62['name']){delete _0x2b7a62[_0x2aff('0x22')];}_0x473358[_0x2aff('0x15')](_0x4ef2de)[_0x2aff('0x23')](_0x2b7a62);};}function getMustacheRender(_0x2a15c4,_0x46e96d){return Mustache['render'](_0x2a15c4,_[_0x2aff('0x24')](_0x46e96d[_0x2aff('0x25')],{'contact':_0x46e96d[_0x2aff('0x26')],'message':_0x46e96d[_0x2aff('0x27')],'agent':_0x46e96d[_0x2aff('0x28')],'interaction':_0x46e96d[_0x2aff('0x29')],'account':_0x46e96d['account']}))||'';}exports[_0x2aff('0x2a')]=function(_0x134adc,_0x1b9be1){var _0x472e43={},_0x218e33={},_0x15da28={'count':0x0,'rows':[]};var _0x904eda=_['map'](db[_0x2aff('0x2b')][_0x2aff('0x2c')],function(_0x473809){return{'name':_0x473809[_0x2aff('0x2d')],'type':_0x473809[_0x2aff('0x2e')][_0x2aff('0x2f')]};});_0x218e33[_0x2aff('0x30')]=_[_0x2aff('0x31')](_0x904eda,'name');_0x218e33['query']=_[_0x2aff('0x32')](_0x134adc[_0x2aff('0x33')]);_0x218e33[_0x2aff('0x34')]=_['intersection'](_0x218e33['model'],_0x218e33[_0x2aff('0x33')]);_0x472e43[_0x2aff('0x35')]=_['intersection'](_0x218e33['model'],qs[_0x2aff('0x36')](_0x134adc[_0x2aff('0x33')][_0x2aff('0x36')]));_0x472e43['attributes']=_0x472e43[_0x2aff('0x35')][_0x2aff('0x37')]?_0x472e43[_0x2aff('0x35')]:_0x218e33[_0x2aff('0x30')];if(!_0x134adc[_0x2aff('0x33')][_0x2aff('0x38')]('nolimit')){_0x472e43[_0x2aff('0x1a')]=qs['limit'](_0x134adc[_0x2aff('0x33')][_0x2aff('0x1a')]);_0x472e43[_0x2aff('0x18')]=qs[_0x2aff('0x18')](_0x134adc[_0x2aff('0x33')]['offset']);}_0x472e43[_0x2aff('0x39')]=qs[_0x2aff('0x3a')](_0x134adc[_0x2aff('0x33')][_0x2aff('0x3a')]);_0x472e43[_0x2aff('0x3b')]=qs[_0x2aff('0x34')](_[_0x2aff('0x3c')](_0x134adc['query'],_0x218e33['filters']),_0x904eda);if(_0x134adc['query'][_0x2aff('0x3d')]){_0x472e43[_0x2aff('0x3b')]=_['merge'](_0x472e43[_0x2aff('0x3b')],{'$or':_['map'](_0x904eda,function(_0x1dbad7){if(_0x1dbad7[_0x2aff('0x2e')]!==_0x2aff('0x3e')){var _0x4fbb34={};_0x4fbb34[_0x1dbad7[_0x2aff('0x22')]]={'$like':'%'+_0x134adc[_0x2aff('0x33')]['filter']+'%'};return _0x4fbb34;}})});}_0x472e43=_[_0x2aff('0x24')]({},_0x472e43,_0x134adc[_0x2aff('0x3f')]);var _0x1ebe6b={'where':_0x472e43[_0x2aff('0x3b')]};return db[_0x2aff('0x2b')][_0x2aff('0x1b')](_0x1ebe6b)[_0x2aff('0x20')](function(_0x1748d3){_0x15da28[_0x2aff('0x1b')]=_0x1748d3;if(_0x134adc[_0x2aff('0x33')][_0x2aff('0x40')]){_0x472e43[_0x2aff('0x41')]=[{'all':!![]}];}return db[_0x2aff('0x2b')][_0x2aff('0x42')](_0x472e43);})['then'](function(_0x4e01b2){_0x15da28[_0x2aff('0x43')]=_0x4e01b2;return _0x15da28;})['then'](respondWithFilteredResult(_0x1b9be1,_0x472e43))['catch'](handleError(_0x1b9be1,null));};exports[_0x2aff('0x44')]=function(_0x5205b2,_0x4df9a7){var _0x45b775={'raw':!![],'where':{'id':_0x5205b2['params']['id']}},_0x3917ce={};_0x3917ce['model']=_[_0x2aff('0x32')](db[_0x2aff('0x2b')][_0x2aff('0x2c')]);_0x3917ce[_0x2aff('0x33')]=_[_0x2aff('0x32')](_0x5205b2[_0x2aff('0x33')]);_0x3917ce[_0x2aff('0x34')]=_[_0x2aff('0x45')](_0x3917ce[_0x2aff('0x30')],_0x3917ce[_0x2aff('0x33')]);_0x45b775[_0x2aff('0x35')]=_['intersection'](_0x3917ce[_0x2aff('0x30')],qs['fields'](_0x5205b2['query']['fields']));_0x45b775[_0x2aff('0x35')]=_0x45b775['attributes'][_0x2aff('0x37')]?_0x45b775[_0x2aff('0x35')]:_0x3917ce[_0x2aff('0x30')];if(_0x5205b2[_0x2aff('0x33')][_0x2aff('0x40')]){_0x45b775[_0x2aff('0x41')]=[{'all':!![]}];}_0x45b775=_[_0x2aff('0x24')]({},_0x45b775,_0x5205b2[_0x2aff('0x3f')]);return db['WhatsappApplication'][_0x2aff('0x46')](_0x45b775)[_0x2aff('0x20')](handleEntityNotFound(_0x4df9a7,null))[_0x2aff('0x20')](respondWithResult(_0x4df9a7,null))[_0x2aff('0x47')](handleError(_0x4df9a7,null));};exports[_0x2aff('0x48')]=function(_0x559599,_0x20d02d){return db[_0x2aff('0x2b')][_0x2aff('0x48')](_0x559599[_0x2aff('0x25')],{})[_0x2aff('0x20')](respondWithResult(_0x20d02d,0xc9))['catch'](handleError(_0x20d02d,null));};exports[_0x2aff('0x1f')]=function(_0x43ca7b,_0x2f8a52){if(_0x43ca7b[_0x2aff('0x25')]['id']){delete _0x43ca7b['body']['id'];}return db[_0x2aff('0x2b')][_0x2aff('0x46')]({'where':{'id':_0x43ca7b[_0x2aff('0x49')]['id']}})[_0x2aff('0x20')](handleEntityNotFound(_0x2f8a52,null))[_0x2aff('0x20')](saveUpdates(_0x43ca7b['body'],null))[_0x2aff('0x20')](respondWithResult(_0x2f8a52,null))[_0x2aff('0x47')](handleError(_0x2f8a52,null));};exports[_0x2aff('0x21')]=function(_0x3fed58,_0x6ea43b){return db[_0x2aff('0x2b')][_0x2aff('0x46')]({'where':{'id':_0x3fed58[_0x2aff('0x49')]['id']}})['then'](handleEntityNotFound(_0x6ea43b,null))['then'](removeEntity(_0x6ea43b,null))[_0x2aff('0x47')](handleError(_0x6ea43b,null));}; \ No newline at end of file +var _0x97b4=['destroy','error','stack','name','send','merge','body','message','agent','interaction','account','index','map','WhatsappApplication','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','pick','where','type','filter','options','includeAll','include','catch','params','rawAttributes','create','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x97b4,0x1a4));var _0x497b=function(_0x4f00c3,_0x424d27){_0x4f00c3=_0x4f00c3-0x0;var _0x15cbb3=_0x97b4[_0x4f00c3];return _0x15cbb3;};'use strict';var emlformat=require(_0x497b('0x0'));var rimraf=require(_0x497b('0x1'));var zipdir=require(_0x497b('0x2'));var jsonpatch=require(_0x497b('0x3'));var rp=require(_0x497b('0x4'));var moment=require('moment');var BPromise=require(_0x497b('0x5'));var Mustache=require('mustache');var util=require(_0x497b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x497b('0x7'));var ejs=require(_0x497b('0x8'));var fs=require('fs');var fs_extra=require(_0x497b('0x9'));var _=require('lodash');var squel=require(_0x497b('0xa'));var crypto=require('crypto');var jsforce=require(_0x497b('0xb'));var deskjs=require(_0x497b('0xc'));var toCsv=require(_0x497b('0x7'));var querystring=require(_0x497b('0xd'));var Papa=require(_0x497b('0xe'));var Redis=require(_0x497b('0xf'));var authService=require(_0x497b('0x10'));var qs=require(_0x497b('0x11'));var as=require(_0x497b('0x12'));var hardwareService=require(_0x497b('0x13'));var logger=require(_0x497b('0x14'))('api');var utils=require(_0x497b('0x15'));var config=require(_0x497b('0x16'));var licenseUtil=require(_0x497b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ce9d9,_0x4f65c9){_0x4f65c9=_0x4f65c9||0xcc;return function(_0xed9b89){if(_0xed9b89){return _0x1ce9d9[_0x497b('0x18')](_0x4f65c9);}return _0x1ce9d9[_0x497b('0x19')](_0x4f65c9)[_0x497b('0x1a')]();};}function respondWithResult(_0x43c8ec,_0x5003a1){_0x5003a1=_0x5003a1||0xc8;return function(_0x3aabd9){if(_0x3aabd9){return _0x43c8ec[_0x497b('0x19')](_0x5003a1)[_0x497b('0x1b')](_0x3aabd9);}};}function respondWithFilteredResult(_0x333564,_0x2c2520){return function(_0x1d1549){if(_0x1d1549){var _0x4cec28=typeof _0x2c2520[_0x497b('0x1c')]===_0x497b('0x1d')&&typeof _0x2c2520['limit']===_0x497b('0x1d');var _0x459c6b=_0x1d1549[_0x497b('0x1e')];var _0x4ec2a9=_0x4cec28?0x0:_0x2c2520[_0x497b('0x1c')];var _0x20747e=_0x4cec28?_0x1d1549['count']:_0x2c2520[_0x497b('0x1c')]+_0x2c2520['limit'];var _0xe2b279;if(_0x20747e>=_0x459c6b){_0x20747e=_0x459c6b;_0xe2b279=0xc8;}else{_0xe2b279=0xce;}_0x333564[_0x497b('0x19')](_0xe2b279);return _0x333564[_0x497b('0x1f')](_0x497b('0x20'),_0x4ec2a9+'-'+_0x20747e+'/'+_0x459c6b)[_0x497b('0x1b')](_0x1d1549);}return null;};}function patchUpdates(_0x39d790){return function(_0x4892c7){try{jsonpatch[_0x497b('0x21')](_0x4892c7,_0x39d790,!![]);}catch(_0x2deea1){return BPromise[_0x497b('0x22')](_0x2deea1);}return _0x4892c7['save']();};}function saveUpdates(_0x420405,_0xbdc26d){return function(_0x80d1f4){if(_0x80d1f4){return _0x80d1f4['update'](_0x420405)[_0x497b('0x23')](function(_0x3e1fe4){return _0x3e1fe4;});}return null;};}function removeEntity(_0x580e3a,_0x5efd12){return function(_0xe99a80){if(_0xe99a80){return _0xe99a80[_0x497b('0x24')]()[_0x497b('0x23')](function(){_0x580e3a[_0x497b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44684d,_0x453f3b){return function(_0x8005f9){if(!_0x8005f9){_0x44684d[_0x497b('0x18')](0x194);}return _0x8005f9;};}function handleError(_0x527057,_0x3289a0){_0x3289a0=_0x3289a0||0x1f4;return function(_0x29fa89){logger[_0x497b('0x25')](_0x29fa89[_0x497b('0x26')]);if(_0x29fa89[_0x497b('0x27')]){delete _0x29fa89['name'];}_0x527057[_0x497b('0x19')](_0x3289a0)[_0x497b('0x28')](_0x29fa89);};}function getMustacheRender(_0x2707f1,_0x3d203f){return Mustache['render'](_0x2707f1,_[_0x497b('0x29')](_0x3d203f[_0x497b('0x2a')],{'contact':_0x3d203f['contact'],'message':_0x3d203f[_0x497b('0x2b')],'agent':_0x3d203f[_0x497b('0x2c')],'interaction':_0x3d203f[_0x497b('0x2d')],'account':_0x3d203f[_0x497b('0x2e')]}))||'';}exports[_0x497b('0x2f')]=function(_0x555ca2,_0x40a560){var _0x4bcbca={},_0x2563a8={},_0x34c9ad={'count':0x0,'rows':[]};var _0x40a7c7=_[_0x497b('0x30')](db[_0x497b('0x31')]['rawAttributes'],function(_0x53a73f){return{'name':_0x53a73f['fieldName'],'type':_0x53a73f['type'][_0x497b('0x32')]};});_0x2563a8[_0x497b('0x33')]=_['map'](_0x40a7c7,'name');_0x2563a8[_0x497b('0x34')]=_[_0x497b('0x35')](_0x555ca2[_0x497b('0x34')]);_0x2563a8[_0x497b('0x36')]=_[_0x497b('0x37')](_0x2563a8[_0x497b('0x33')],_0x2563a8[_0x497b('0x34')]);_0x4bcbca['attributes']=_[_0x497b('0x37')](_0x2563a8[_0x497b('0x33')],qs['fields'](_0x555ca2[_0x497b('0x34')][_0x497b('0x38')]));_0x4bcbca['attributes']=_0x4bcbca[_0x497b('0x39')][_0x497b('0x3a')]?_0x4bcbca[_0x497b('0x39')]:_0x2563a8[_0x497b('0x33')];if(!_0x555ca2['query'][_0x497b('0x3b')](_0x497b('0x3c'))){_0x4bcbca['limit']=qs[_0x497b('0x3d')](_0x555ca2[_0x497b('0x34')]['limit']);_0x4bcbca[_0x497b('0x1c')]=qs[_0x497b('0x1c')](_0x555ca2[_0x497b('0x34')][_0x497b('0x1c')]);}_0x4bcbca[_0x497b('0x3e')]=qs['sort'](_0x555ca2[_0x497b('0x34')]['sort']);_0x4bcbca['where']=qs[_0x497b('0x36')](_[_0x497b('0x3f')](_0x555ca2[_0x497b('0x34')],_0x2563a8[_0x497b('0x36')]),_0x40a7c7);if(_0x555ca2['query']['filter']){_0x4bcbca['where']=_['merge'](_0x4bcbca[_0x497b('0x40')],{'$or':_['map'](_0x40a7c7,function(_0x2ec90d){if(_0x2ec90d[_0x497b('0x41')]!=='VIRTUAL'){var _0x1fa607={};_0x1fa607[_0x2ec90d[_0x497b('0x27')]]={'$like':'%'+_0x555ca2[_0x497b('0x34')][_0x497b('0x42')]+'%'};return _0x1fa607;}})});}_0x4bcbca=_[_0x497b('0x29')]({},_0x4bcbca,_0x555ca2[_0x497b('0x43')]);var _0xe89958={'where':_0x4bcbca[_0x497b('0x40')]};return db[_0x497b('0x31')][_0x497b('0x1e')](_0xe89958)[_0x497b('0x23')](function(_0x4f69f0){_0x34c9ad[_0x497b('0x1e')]=_0x4f69f0;if(_0x555ca2['query'][_0x497b('0x44')]){_0x4bcbca[_0x497b('0x45')]=[{'all':!![]}];}return db[_0x497b('0x31')]['findAll'](_0x4bcbca);})[_0x497b('0x23')](function(_0x7402f6){_0x34c9ad['rows']=_0x7402f6;return _0x34c9ad;})[_0x497b('0x23')](respondWithFilteredResult(_0x40a560,_0x4bcbca))[_0x497b('0x46')](handleError(_0x40a560,null));};exports['show']=function(_0x1713b1,_0x1bd0c){var _0x3d9584={'raw':!![],'where':{'id':_0x1713b1[_0x497b('0x47')]['id']}},_0x2aea51={};_0x2aea51[_0x497b('0x33')]=_[_0x497b('0x35')](db[_0x497b('0x31')][_0x497b('0x48')]);_0x2aea51[_0x497b('0x34')]=_[_0x497b('0x35')](_0x1713b1[_0x497b('0x34')]);_0x2aea51[_0x497b('0x36')]=_[_0x497b('0x37')](_0x2aea51['model'],_0x2aea51['query']);_0x3d9584[_0x497b('0x39')]=_['intersection'](_0x2aea51[_0x497b('0x33')],qs[_0x497b('0x38')](_0x1713b1[_0x497b('0x34')][_0x497b('0x38')]));_0x3d9584[_0x497b('0x39')]=_0x3d9584[_0x497b('0x39')][_0x497b('0x3a')]?_0x3d9584[_0x497b('0x39')]:_0x2aea51[_0x497b('0x33')];if(_0x1713b1['query'][_0x497b('0x44')]){_0x3d9584[_0x497b('0x45')]=[{'all':!![]}];}_0x3d9584=_[_0x497b('0x29')]({},_0x3d9584,_0x1713b1[_0x497b('0x43')]);return db[_0x497b('0x31')]['find'](_0x3d9584)[_0x497b('0x23')](handleEntityNotFound(_0x1bd0c,null))[_0x497b('0x23')](respondWithResult(_0x1bd0c,null))['catch'](handleError(_0x1bd0c,null));};exports['create']=function(_0x3e613f,_0x3ed3a2){return db[_0x497b('0x31')][_0x497b('0x49')](_0x3e613f[_0x497b('0x2a')],{})[_0x497b('0x23')](respondWithResult(_0x3ed3a2,0xc9))[_0x497b('0x46')](handleError(_0x3ed3a2,null));};exports[_0x497b('0x4a')]=function(_0x5c6fbb,_0x3d1f14){if(_0x5c6fbb[_0x497b('0x2a')]['id']){delete _0x5c6fbb[_0x497b('0x2a')]['id'];}return db[_0x497b('0x31')][_0x497b('0x4b')]({'where':{'id':_0x5c6fbb[_0x497b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d1f14,null))['then'](saveUpdates(_0x5c6fbb[_0x497b('0x2a')],null))[_0x497b('0x23')](respondWithResult(_0x3d1f14,null))[_0x497b('0x46')](handleError(_0x3d1f14,null));};exports[_0x497b('0x24')]=function(_0x5536f,_0x25414f){return db[_0x497b('0x31')][_0x497b('0x4b')]({'where':{'id':_0x5536f[_0x497b('0x47')]['id']}})['then'](handleEntityNotFound(_0x25414f,null))[_0x497b('0x23')](removeEntity(_0x25414f,null))[_0x497b('0x46')](handleError(_0x25414f,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index eb7fece..7364520 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 _0x894d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','whatsapp_applications','utf8mb4','lodash'];(function(_0x1fd5eb,_0x235203){var _0x102365=function(_0x54de1f){while(--_0x54de1f){_0x1fd5eb['push'](_0x1fd5eb['shift']());}};_0x102365(++_0x235203);}(_0x894d,0x74));var _0xd894=function(_0x240d77,_0x35b080){_0x240d77=_0x240d77-0x0;var _0x2ca181=_0x894d[_0x240d77];return _0x2ca181;};'use strict';var _=require(_0xd894('0x0'));var util=require('util');var logger=require(_0xd894('0x1'))(_0xd894('0x2'));var moment=require(_0xd894('0x3'));var BPromise=require(_0xd894('0x4'));var rp=require(_0xd894('0x5'));var fs=require('fs');var path=require(_0xd894('0x6'));var rimraf=require(_0xd894('0x7'));var config=require(_0xd894('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0xd894('0x9')]=function(_0x83432d,_0x1761bb){return _0x83432d[_0xd894('0xa')]('WhatsappApplication',attributes,{'tableName':_0xd894('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd894('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9122=['../../config/logger','api','moment','request-promise','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','lodash','util'];(function(_0x2aac3d,_0x3ea0bf){var _0x51d468=function(_0x5de059){while(--_0x5de059){_0x2aac3d['push'](_0x2aac3d['shift']());}};_0x51d468(++_0x3ea0bf);}(_0x9122,0x82));var _0x2912=function(_0xab2e36,_0x515f33){_0xab2e36=_0xab2e36-0x0;var _0x23fb63=_0x9122[_0xab2e36];return _0x23fb63;};'use strict';var _=require(_0x2912('0x0'));var util=require(_0x2912('0x1'));var logger=require(_0x2912('0x2'))(_0x2912('0x3'));var moment=require(_0x2912('0x4'));var BPromise=require('bluebird');var rp=require(_0x2912('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2912('0x6'));var attributes=require(_0x2912('0x7'));module[_0x2912('0x8')]=function(_0x3367cc,_0x4d45ca){return _0x3367cc[_0x2912('0x9')](_0x2912('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 3d51616..28305bd 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 _0xa786=['moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util'];(function(_0x2a9940,_0x31b6ff){var _0x331e68=function(_0x4c1374){while(--_0x4c1374){_0x2a9940['push'](_0x2a9940['shift']());}};_0x331e68(++_0x31b6ff);}(_0xa786,0x71));var _0x6a78=function(_0x498a76,_0x5d1864){_0x498a76=_0x498a76-0x0;var _0x4c25e1=_0xa786[_0x498a76];return _0x4c25e1;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a78('0x4'));var logger=require(_0x6a78('0x5'))(_0x6a78('0x6'));var config=require(_0x6a78('0x7'));var jayson=require(_0x6a78('0x8'));var client=jayson[_0x6a78('0x9')][_0x6a78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dd11b,_0xcd6019,_0x103f4a){return new BPromise(function(_0x23ebbd,_0x30debf){return client[_0x6a78('0xb')](_0x4dd11b,_0x103f4a)[_0x6a78('0xc')](function(_0x1264c6){logger[_0x6a78('0xd')](_0x6a78('0xe'),_0xcd6019,'request\x20sent');logger[_0x6a78('0xf')](_0x6a78('0x10'),_0xcd6019,_0x6a78('0x11'),JSON['stringify'](_0x1264c6));if(_0x1264c6[_0x6a78('0x12')]){if(_0x1264c6[_0x6a78('0x12')][_0x6a78('0x13')]===0x1f4){logger[_0x6a78('0x12')](_0x6a78('0xe'),_0xcd6019,_0x1264c6['error'][_0x6a78('0x14')]);return _0x30debf(_0x1264c6[_0x6a78('0x12')][_0x6a78('0x14')]);}logger['error'](_0x6a78('0xe'),_0xcd6019,_0x1264c6[_0x6a78('0x12')]['message']);return _0x23ebbd(_0x1264c6[_0x6a78('0x12')][_0x6a78('0x14')]);}else{logger[_0x6a78('0xd')](_0x6a78('0xe'),_0xcd6019,_0x6a78('0x11'));_0x23ebbd(_0x1264c6[_0x6a78('0x15')]['message']);}})[_0x6a78('0x16')](function(_0x122362){logger[_0x6a78('0x12')](_0x6a78('0xe'),_0xcd6019,_0x122362);_0x30debf(_0x122362);});});} \ No newline at end of file +var _0xc359=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xc359,0x1d9));var _0x9c35=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0xc359[_0x5fe69a];return _0x3f1aee;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var moment=require('moment');var BPromise=require(_0x9c35('0x1'));var rs=require(_0x9c35('0x2'));var fs=require('fs');var Redis=require(_0x9c35('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c35('0x4'));var logger=require('../../config/logger')(_0x9c35('0x5'));var config=require('../../config/environment');var jayson=require(_0x9c35('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53d9d7,_0x4b61d6,_0x279ba9){return new BPromise(function(_0x2993da,_0x1ab745){return client[_0x9c35('0x7')](_0x53d9d7,_0x279ba9)[_0x9c35('0x8')](function(_0x2efae8){logger['info'](_0x9c35('0x9'),_0x4b61d6,_0x9c35('0xa'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4b61d6,'request\x20sent',JSON[_0x9c35('0xb')](_0x2efae8));if(_0x2efae8['error']){if(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xd')]===0x1f4){logger[_0x9c35('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x4b61d6,_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);return _0x1ab745(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);}logger[_0x9c35('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x4b61d6,_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);return _0x2993da(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);}else{logger[_0x9c35('0xf')](_0x9c35('0x9'),_0x4b61d6,_0x9c35('0xa'));_0x2993da(_0x2efae8[_0x9c35('0x10')][_0x9c35('0xe')]);}})[_0x9c35('0x11')](function(_0x387dd7){logger[_0x9c35('0xc')](_0x9c35('0x9'),_0x4b61d6,_0x387dd7);_0x1ab745(_0x387dd7);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f32325b..2eadf88 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 _0xc775=['whatsapp','addTags','put','whatsappinteraction:update','whatsappinteraction:destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x2bddf9,_0x22c873){var _0x3f3ae9=function(_0x2d91ac){while(--_0x2d91ac){_0x2bddf9['push'](_0x2bddf9['shift']());}};_0x3f3ae9(++_0x22c873);}(_0xc775,0x1b9));var _0x5c77=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc775[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c77('0x0'));var timeout=require(_0x5c77('0x1'));var express=require(_0x5c77('0x2'));var router=express[_0x5c77('0x3')]();var fs_extra=require(_0x5c77('0x4'));var auth=require(_0x5c77('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5c77('0x6'));var controller=require(_0x5c77('0x7'));router[_0x5c77('0x8')]('/',auth[_0x5c77('0x9')](),controller[_0x5c77('0xa')]);router[_0x5c77('0x8')](_0x5c77('0xb'),auth[_0x5c77('0x9')](),controller[_0x5c77('0xc')]);router[_0x5c77('0x8')](_0x5c77('0xd'),auth['isAuthenticated'](),controller[_0x5c77('0xe')]);router[_0x5c77('0x8')]('/:id/messages',auth[_0x5c77('0x9')](),controller[_0x5c77('0xf')]);router[_0x5c77('0x8')](_0x5c77('0x10'),auth['isAuthenticated'](),controller[_0x5c77('0x11')]);router[_0x5c77('0x12')]('/',auth['isAuthenticated'](),controller[_0x5c77('0x13')]);router[_0x5c77('0x12')](_0x5c77('0x14'),auth['isAuthenticated'](),controller[_0x5c77('0x15')]);router[_0x5c77('0x12')](_0x5c77('0x16'),auth['isAuthenticated'](),interaction[_0x5c77('0x17')](_0x5c77('0x18'),'whatsappinteraction:addtags'),controller[_0x5c77('0x19')]);router[_0x5c77('0x1a')](_0x5c77('0xd'),auth[_0x5c77('0x9')](),interaction['tracked']('whatsapp',_0x5c77('0x1b')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x5c77('0x17')]('whatsapp',_0x5c77('0x1c')),controller['destroy']);router['delete'](_0x5c77('0x16'),auth[_0x5c77('0x9')](),controller[_0x5c77('0x1d')]);module[_0x5c77('0x1e')]=router; \ No newline at end of file +var _0x4a24=['update','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','whatsapp','put','whatsappinteraction:update'];(function(_0x568363,_0x2e79a7){var _0x47f0ed=function(_0x7d922b){while(--_0x7d922b){_0x568363['push'](_0x568363['shift']());}};_0x47f0ed(++_0x2e79a7);}(_0x4a24,0x17e));var _0x44a2=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x4a24[_0x391c55];return _0xa434e0;};'use strict';var multer=require(_0x44a2('0x0'));var util=require(_0x44a2('0x1'));var path=require('path');var timeout=require(_0x44a2('0x2'));var express=require(_0x44a2('0x3'));var router=express[_0x44a2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x44a2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x44a2('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x44a2('0x7')]('/',auth[_0x44a2('0x8')](),controller[_0x44a2('0x9')]);router[_0x44a2('0x7')](_0x44a2('0xa'),auth[_0x44a2('0x8')](),controller[_0x44a2('0xb')]);router['get'](_0x44a2('0xc'),auth[_0x44a2('0x8')](),controller['show']);router[_0x44a2('0x7')](_0x44a2('0xd'),auth[_0x44a2('0x8')](),controller['getMessages']);router[_0x44a2('0x7')](_0x44a2('0xe'),auth[_0x44a2('0x8')](),controller[_0x44a2('0xf')]);router['post']('/',auth[_0x44a2('0x8')](),controller[_0x44a2('0x10')]);router['post'](_0x44a2('0xd'),auth[_0x44a2('0x8')](),controller[_0x44a2('0x11')]);router[_0x44a2('0x12')](_0x44a2('0x13'),auth[_0x44a2('0x8')](),interaction[_0x44a2('0x14')](_0x44a2('0x15'),'whatsappinteraction:addtags'),controller['addTags']);router[_0x44a2('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x44a2('0x15'),_0x44a2('0x17')),controller[_0x44a2('0x18')]);router['delete'](_0x44a2('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x44a2('0x15'),'whatsappinteraction:destroy'),controller[_0x44a2('0x19')]);router[_0x44a2('0x1a')]('/:id/tags',auth[_0x44a2('0x8')](),controller[_0x44a2('0x1b')]);module[_0x44a2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 27d7398..a1bb7f5 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 _0x90e0=['exports','BOOLEAN','DATE','STRING','out','moment'];(function(_0xc0be57,_0x2d1e96){var _0x2d786d=function(_0x5c91fc){while(--_0x5c91fc){_0xc0be57['push'](_0xc0be57['shift']());}};_0x2d786d(++_0x2d1e96);}(_0x90e0,0xe3));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x090e('0x0'));module[_0x090e('0x1')]={'closed':{'type':Sequelize[_0x090e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x090e('0x3')]},'disposition':{'type':Sequelize[_0x090e('0x4')]},'secondDisposition':{'type':Sequelize[_0x090e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x090e('0x4')]},'note':{'type':Sequelize[_0x090e('0x4')]},'phone':{'type':Sequelize[_0x090e('0x4')]},'read1stAt':{'type':Sequelize[_0x090e('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x090e('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x04e7=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x224539,_0x351725){var _0xefc11c=function(_0x1e53de){while(--_0x1e53de){_0x224539['push'](_0x224539['shift']());}};_0xefc11c(++_0x351725);}(_0x04e7,0x6e));var _0x704e=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0x04e7[_0x427352];return _0x23e0e6;};'use strict';var Sequelize=require(_0x704e('0x0'));var moment=require(_0x704e('0x1'));module[_0x704e('0x2')]={'closed':{'type':Sequelize[_0x704e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x704e('0x4')]},'disposition':{'type':Sequelize[_0x704e('0x5')]},'secondDisposition':{'type':Sequelize[_0x704e('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x704e('0x5')]},'phone':{'type':Sequelize[_0x704e('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x704e('0x6')]('in',_0x704e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x704e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x704e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index cf89d33..741af34 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 _0x4351=['status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','merge','body','contact','message','interaction','account','Users','fullname','TagIds','forEach','Tags','push','catch','map','WhatsappInteraction','rawAttributes','fieldName','type','model','keys','filters','query','attributes','fields','hasOwnProperty','sort','where','pick','field','color','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','left_join','u.id\x20=\x20ui.UserId','select','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','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','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','$lte','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)','i.id','Sequelize','SELECT','clone','order','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','length','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','rows','show','params','intersection','options','create','update','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','nolimit','$gte','format','includeAll','include','findAll','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','Owner','get','mkdirSync','Whatsapp','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','createReadStream','pipe','basename','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','sendStatus'];(function(_0x32e6b0,_0xad08f2){var _0x523387=function(_0x30369d){while(--_0x30369d){_0x32e6b0['push'](_0x32e6b0['shift']());}};_0x523387(++_0xad08f2);}(_0x4351,0x1b5));var _0x1435=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x4351[_0x33032e];return _0x13316b;};'use strict';var emlformat=require(_0x1435('0x0'));var rimraf=require(_0x1435('0x1'));var zipdir=require(_0x1435('0x2'));var jsonpatch=require(_0x1435('0x3'));var rp=require(_0x1435('0x4'));var moment=require(_0x1435('0x5'));var BPromise=require(_0x1435('0x6'));var Mustache=require(_0x1435('0x7'));var util=require(_0x1435('0x8'));var path=require(_0x1435('0x9'));var sox=require(_0x1435('0xa'));var csv=require(_0x1435('0xb'));var ejs=require(_0x1435('0xc'));var fs=require('fs');var fs_extra=require(_0x1435('0xd'));var _=require(_0x1435('0xe'));var squel=require('squel');var crypto=require(_0x1435('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1435('0xb'));var querystring=require(_0x1435('0x10'));var Papa=require(_0x1435('0x11'));var Redis=require(_0x1435('0x12'));var authService=require(_0x1435('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1435('0x14'));var pdf=require(_0x1435('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1435('0x16'));var utils=require('../../config/utils');var config=require(_0x1435('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1435('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1435('0x19'),'port':0x18eb});var socket=require(_0x1435('0x1a'))(new Redis(config[_0x1435('0x1b')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x103ba3,_0x49fb9c){_0x49fb9c=_0x49fb9c||0xcc;return function(_0x39405c){if(_0x39405c){return _0x103ba3[_0x1435('0x1c')](_0x49fb9c);}return _0x103ba3[_0x1435('0x1d')](_0x49fb9c)[_0x1435('0x1e')]();};}function respondWithResult(_0x5d4b48,_0x1cc531){_0x1cc531=_0x1cc531||0xc8;return function(_0x5ecd){if(_0x5ecd){return _0x5d4b48[_0x1435('0x1d')](_0x1cc531)[_0x1435('0x1f')](_0x5ecd);}};}function respondWithFilteredResult(_0x189f4a,_0x430367){return function(_0x19c9fe){if(_0x19c9fe){var _0x68f503=typeof _0x430367[_0x1435('0x20')]===_0x1435('0x21')&&typeof _0x430367['limit']===_0x1435('0x21');var _0x34f555=_0x19c9fe['count'];var _0x4694cb=_0x68f503?0x0:_0x430367['offset'];var _0x15d7c0=_0x68f503?_0x19c9fe[_0x1435('0x22')]:_0x430367[_0x1435('0x20')]+_0x430367[_0x1435('0x23')];var _0x2551d5;if(_0x15d7c0>=_0x34f555){_0x15d7c0=_0x34f555;_0x2551d5=0xc8;}else{_0x2551d5=0xce;}_0x189f4a[_0x1435('0x1d')](_0x2551d5);return _0x189f4a['set'](_0x1435('0x24'),_0x4694cb+'-'+_0x15d7c0+'/'+_0x34f555)[_0x1435('0x1f')](_0x19c9fe);}return null;};}function patchUpdates(_0x7c856a){return function(_0x40d2ef){try{jsonpatch[_0x1435('0x25')](_0x40d2ef,_0x7c856a,!![]);}catch(_0x1b6259){return BPromise[_0x1435('0x26')](_0x1b6259);}return _0x40d2ef[_0x1435('0x27')]();};}function saveUpdates(_0x34655a,_0x119238){return function(_0x236b6f){if(_0x236b6f){return _0x236b6f['update'](_0x34655a)['then'](function(_0x22241f){return _0x22241f;});}return null;};}function removeEntity(_0x2b4828,_0x3d452f){return function(_0x4f86f0){if(_0x4f86f0){return _0x4f86f0[_0x1435('0x28')]()[_0x1435('0x29')](function(){_0x2b4828[_0x1435('0x1d')](0xcc)[_0x1435('0x1e')]();});}};}function handleEntityNotFound(_0x24f328,_0x5966ef){return function(_0x208ea2){if(!_0x208ea2){_0x24f328[_0x1435('0x1c')](0x194);}return _0x208ea2;};}function handleError(_0x35042b,_0x453d68){_0x453d68=_0x453d68||0x1f4;return function(_0x1c3b7e){logger[_0x1435('0x2a')](_0x1c3b7e[_0x1435('0x2b')]);if(_0x1c3b7e['name']){delete _0x1c3b7e[_0x1435('0x2c')];}_0x35042b[_0x1435('0x1d')](_0x453d68)[_0x1435('0x2d')](_0x1c3b7e);};}function getMustacheRender(_0x344625,_0x297edf){return Mustache['render'](_0x344625,_[_0x1435('0x2e')](_0x297edf[_0x1435('0x2f')],{'contact':_0x297edf[_0x1435('0x30')],'message':_0x297edf[_0x1435('0x31')],'agent':_0x297edf['agent'],'interaction':_0x297edf[_0x1435('0x32')],'account':_0x297edf[_0x1435('0x33')]}))||'';}function getInteractionUsers(_0x49209a,_0x4503a1){return new BPromise(function(_0x5071cc,_0x4903f2){try{if(_0x4503a1[_0x49209a['id']]){_0x49209a[_0x1435('0x34')]=_['map'](_0x4503a1[_0x49209a['id']],function(_0x1709f8){return{'id':_0x1709f8['id'],'fullname':_0x1709f8[_0x1435('0x35')]};});}}catch(_0x5a86ac){_0x4903f2(_0x5a86ac);}_0x5071cc(_0x49209a);});}function getInteractionTags(_0x4e10db,_0x5c5075){return new BPromise(function(_0x10d6c3,_0x48777e){try{if(_0x4e10db[_0x1435('0x36')]){_0x4e10db['Tags']=[];_0x4e10db[_0x1435('0x36')]['split'](',')[_0x1435('0x37')](function(_0x558ce7){_0x4e10db[_0x1435('0x38')][_0x1435('0x39')](_0x5c5075[_0x558ce7]);});}delete _0x4e10db[_0x1435('0x36')];}catch(_0x180ca6){_0x48777e(_0x180ca6);}_0x10d6c3(_0x4e10db);});}function updateWhatsappInteraction(_0x4a51a1,_0x1fe8dd,_0x138597){return new BPromise(function(_0x42cb7e,_0x1c0fa5){return getInteractionUsers(_0x4a51a1,_0x138597)[_0x1435('0x29')](function(_0x592e22){return getInteractionTags(_0x592e22,_0x1fe8dd);})[_0x1435('0x29')](function(_0x578845){_0x42cb7e(_0x578845);})[_0x1435('0x3a')](function(_0x3c4bff){_0x1c0fa5(_0x3c4bff);});});}exports['index']=function(_0x11cf64,_0x2061b9){var _0x4169ab={},_0xed44d5={},_0x228238={'count':0x0,'rows':[]};var _0x1cde88=_[_0x1435('0x3b')](db[_0x1435('0x3c')][_0x1435('0x3d')],function(_0xeb29d0){return{'name':_0xeb29d0[_0x1435('0x3e')],'type':_0xeb29d0[_0x1435('0x3f')]['key']};});_0xed44d5[_0x1435('0x40')]=_['map'](_0x1cde88,_0x1435('0x2c'));_0xed44d5['query']=_[_0x1435('0x41')](_0x11cf64['query']);_0xed44d5[_0x1435('0x42')]=_['intersection'](_0xed44d5[_0x1435('0x40')],_0xed44d5[_0x1435('0x43')]);_0x4169ab[_0x1435('0x44')]=_['intersection'](_0xed44d5[_0x1435('0x40')],qs[_0x1435('0x45')](_0x11cf64[_0x1435('0x43')]['fields']));_0x4169ab[_0x1435('0x44')]=_0x4169ab[_0x1435('0x44')]['length']?_0x4169ab['attributes']:_0xed44d5[_0x1435('0x40')];if(!_0x11cf64[_0x1435('0x43')][_0x1435('0x46')]('nolimit')){_0x4169ab['limit']=qs[_0x1435('0x23')](_0x11cf64['query'][_0x1435('0x23')]);_0x4169ab['offset']=qs[_0x1435('0x20')](_0x11cf64['query'][_0x1435('0x20')]);}_0x4169ab['order']=qs[_0x1435('0x47')](_0x11cf64['query'][_0x1435('0x47')]);_0x4169ab[_0x1435('0x48')]=qs['filters'](_[_0x1435('0x49')](_0x11cf64['query'],_0xed44d5[_0x1435('0x42')]),_0x1cde88);var _0x218fae=[];var _0x309f8f=squel['select']()[_0x1435('0x4a')]('id')[_0x1435('0x4a')]('name')[_0x1435('0x4a')](_0x1435('0x4b'))['from'](_0x1435('0x4c'));var _0x2cbaa3=squel['select']()[_0x1435('0x4a')](_0x1435('0x4d'))['field'](_0x1435('0x4e'))[_0x1435('0x4a')](_0x1435('0x4f'))['from']('user_has_whatsapp_interactions','ui')[_0x1435('0x50')]('users','u',_0x1435('0x51'));var _0x57de7a=squel[_0x1435('0x52')]()[_0x1435('0x53')](_0x1435('0x54'),'i')[_0x1435('0x50')](_0x1435('0x55'),'c',_0x1435('0x56'))[_0x1435('0x50')]('users','o',_0x1435('0x57'))[_0x1435('0x50')](_0x1435('0x58'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x1435('0x50')](_0x1435('0x59'),'me',_0x1435('0x5a'))[_0x1435('0x50')](_0x1435('0x5b'),'it',_0x1435('0x5c'))[_0x1435('0x50')](_0x1435('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x1142c9=squel[_0x1435('0x5d')]();var _0x14ffe0=[];var _0x4244e1=squel['expr']();var _0x597ef2;if(_0x11cf64[_0x1435('0x43')][_0x1435('0x5e')]){_0x597ef2=as[_0x1435('0x5f')](_0x11cf64[_0x1435('0x43')][_0x1435('0x5e')]);var _0x19d532=_0x597ef2[_0x1435('0x60')];for(var _0xc399e5=0x0;_0xc399e5<_0x597ef2[_0x1435('0x61')]['length'];_0xc399e5++){var _0x50aa82=_0x597ef2[_0x1435('0x61')][_0xc399e5];var _0x54869a='i';var _0x39cc49=_[_0x1435('0x62')](_0x1cde88,[_0x1435('0x2c'),_0x50aa82[_0x1435('0x4a')]]);if(!_0x39cc49){switch(_0x50aa82[_0x1435('0x4a')]){case _0x1435('0x63'):if(_0x50aa82[_0x1435('0x64')]==0x1){_0x57de7a['having']('`'+_0x50aa82[_0x1435('0x4a')]+'`\x20=\x200');}else{_0x57de7a[_0x1435('0x65')]('`'+_0x50aa82[_0x1435('0x4a')]+'`\x20>\x200');}break;case _0x1435('0x66'):if(_0x50aa82[_0x1435('0x67')]===_0x1435('0x68')){if(_0x50aa82[_0x1435('0x64')][_0x1435('0x69')]('\x20')['length']>0x1){_0x1142c9[_0x19d532](_0x1435('0x6a'),qs[_0x1435('0x6b')](_0x50aa82[_0x1435('0x64')]),null);}else{var _0x2a93f0='%'+_0x50aa82[_0x1435('0x64')]+'%';_0x1142c9[_0x19d532](_0x1435('0x6c'),_0x2a93f0,_0x2a93f0,_0x2a93f0);}}else{_0x39cc49=_['find'](_0x1cde88,['name',_0x1435('0x6d')]);_0x50aa82[_0x1435('0x4a')]=_0x1435('0x6d');_0x5d681e=as[_0x1435('0x6e')](_0x54869a,_0x39cc49[_0x1435('0x3f')],_0x50aa82);_0x1142c9[_0x19d532](_0x5d681e[_0x1435('0x6f')],_0x5d681e[_0x1435('0x64')][_0x1435('0x70')],_0x5d681e['value'][_0x1435('0x1e')]);}break;case'Tag':var _0x17e39a=_0x50aa82[_0x1435('0x64')]['split'](',')[_0x1435('0x3b')](function(_0x250a5e){return Number(_0x250a5e);});_0x17e39a['forEach'](function(_0x1e34db){_0x4244e1['or'](_0x1435('0x71'),'%,'+_0x1e34db+',%');});_0x14ffe0=_['union'](_0x14ffe0,_0x17e39a);break;case _0x1435('0x72'):if(_0x50aa82['operator']==='$substring'){_0x1142c9[_0x19d532](_0x1435('0x73'),'%'+_0x50aa82[_0x1435('0x64')]+'%',null);}else{_0x39cc49=_[_0x1435('0x62')](_0x1cde88,[_0x1435('0x2c'),'UserId']);_0x50aa82[_0x1435('0x4a')]=_0x1435('0x74');_0x5d681e=as['buildExpression'](_0x54869a,_0x39cc49[_0x1435('0x3f')],_0x50aa82);_0x1142c9[_0x19d532](_0x5d681e[_0x1435('0x6f')],_0x5d681e['value'][_0x1435('0x70')],_0x5d681e[_0x1435('0x64')][_0x1435('0x1e')]);}break;case _0x1435('0x2f'):_0x5d681e=as['buildExpression']('me',null,_0x50aa82);_0x1142c9[_0x19d532](_0x5d681e['text'],_0x5d681e[_0x1435('0x64')][_0x1435('0x70')],_0x5d681e[_0x1435('0x64')][_0x1435('0x1e')]);break;}}else{var _0x5d681e=as[_0x1435('0x6e')](_0x54869a,_0x39cc49[_0x1435('0x3f')],_0x50aa82);_0x1142c9[_0x19d532](_0x5d681e[_0x1435('0x6f')],_0x5d681e[_0x1435('0x64')]['start'],_0x5d681e[_0x1435('0x64')][_0x1435('0x1e')]);}}}else{var _0x171ba6=_(_0x11cf64['query'])[_0x1435('0x41')]()[_0x1435('0x3b')](function(_0x2c0c3b){return _[_0x1435('0x75')](_0x1cde88,[_0x1435('0x2c'),_0x2c0c3b])?_0x2c0c3b:undefined;})[_0x1435('0x76')]()[_0x1435('0x64')]();if(!_[_0x1435('0x77')](_0x171ba6)){_0x171ba6[_0x1435('0x37')](function(_0x54e6de){if(_0x54e6de===_0x1435('0x78')){_0x57de7a[_0x1435('0x48')](_0x1435('0x79'),[][_0x1435('0x7a')](_0x11cf64['query'][_0x54e6de]));}else if(_0x54e6de==='createdAt'){var _0xbc7f9b=JSON['parse'](_0x11cf64['query'][_0x54e6de])['$gte'];var _0x3c1ce2=JSON['parse'](_0x11cf64['query'][_0x54e6de])[_0x1435('0x7b')];_0x57de7a[_0x1435('0x48')](_0x1435('0x7c'),_0xbc7f9b,_0x3c1ce2);}else{if(_0x11cf64[_0x1435('0x43')][_0x54e6de]===_0x1435('0x7d')){_0x57de7a['where']('i.'+_0x54e6de+_0x1435('0x7e'));}else{_0x57de7a[_0x1435('0x48')]('i.'+_0x54e6de+_0x1435('0x7f'),_0x11cf64[_0x1435('0x43')][_0x54e6de]);}}});}if(_0x11cf64['query'][_0x1435('0x80')]){if(_0x11cf64['query'][_0x1435('0x80')]==0x1){_0x57de7a[_0x1435('0x65')]('`unreadMessages`\x20=\x200');}else{_0x57de7a[_0x1435('0x65')](_0x1435('0x81'));}}if(_0x11cf64[_0x1435('0x43')][_0x1435('0x82')]){_0x14ffe0=_[_0x1435('0x83')](_0x11cf64[_0x1435('0x43')][_0x1435('0x82')])?_0x11cf64[_0x1435('0x43')][_0x1435('0x82')]:new Array(_0x11cf64[_0x1435('0x43')][_0x1435('0x82')]);_0x14ffe0[_0x1435('0x37')](function(_0x9a21a){_0x4244e1['or'](_0x1435('0x71'),'%,'+_0x9a21a+',%');});}if(_0x11cf64[_0x1435('0x43')][_0x1435('0x84')]){var _0x570d90=_0x11cf64[_0x1435('0x43')][_0x1435('0x84')]['replace']('\x5c','\x5c\x5c')[_0x1435('0x85')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x570d90)){_0x1142c9['or']('i.id\x20LIKE\x20?',_0x570d90+'%')['or'](_0x1435('0x86'),_0x570d90+'%');}else{_0x1142c9['or'](_0x1435('0x87'),qs['getFullTextValue'](_0x570d90))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x570d90+'%');}}}_0x57de7a[_0x1435('0x48')](_0x1142c9);_0x57de7a['group'](_0x1435('0x88'));var _0x17650a={'type':db[_0x1435('0x89')]['QueryTypes'][_0x1435('0x8a')],'raw':!![]};var _0xae71e=_0x57de7a[_0x1435('0x8b')]();_0xae71e[_0x1435('0x4a')](_0x1435('0x88'));_0xae71e[_0x1435('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1435('0x63'));if(_0x4169ab[_0x1435('0x8c')]){_0x4169ab[_0x1435('0x8c')]['forEach'](function(_0x4a841f){var _0x5ec626=_0x4a841f[0x0]===_0x1435('0x8d')?_0x4a841f[0x0]:'i.'+_0x4a841f[0x0];_0x57de7a[_0x1435('0x8c')](_0x5ec626,_0x4a841f[0x1]==='DESC'?![]:!![]);});}if(!_[_0x1435('0x77')](_0x14ffe0)){_0x57de7a[_0x1435('0x65')](_0x4244e1);_0xae71e[_0x1435('0x48')](_0x1435('0x8e'),_0x14ffe0);}BPromise[_0x1435('0x8f')]()[_0x1435('0x29')](function(){if(!_0x597ef2){if(_0x11cf64[_0x1435('0x43')][_0x1435('0x78')])return;_0xae71e[_0x1435('0x48')](_0x1435('0x90'));_0x57de7a['where'](_0x1435('0x90'));return;}if(_0x11cf64[_0x1435('0x91')][_0x1435('0x92')]!=='agent')return;return _0x11cf64[_0x1435('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x4c67a5){if(_[_0x1435('0x77')](_0x4c67a5)){_0xae71e['where'](_0x1435('0x93'));_0x57de7a[_0x1435('0x48')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0xae71e['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x1435('0x3b')](_0x4c67a5,'id'));_0x57de7a[_0x1435('0x48')]('i.WhatsappAccountId\x20IN\x20?',_[_0x1435('0x3b')](_0x4c67a5,'id'));}});})['then'](function(){if(_0x11cf64[_0x1435('0x91')][_0x1435('0x92')]==='agent'&&!_0x597ef2&&!_0x11cf64[_0x1435('0x43')][_0x1435('0x78')])return[];return db[_0x1435('0x94')][_0x1435('0x43')](_0xae71e[_0x1435('0x95')](),_0x17650a);})[_0x1435('0x29')](function(_0x10b996){_0x228238[_0x1435('0x22')]=_0x10b996[_0x1435('0x96')];if(_0x228238[_0x1435('0x22')]===0x0)return[];return db['sequelize'][_0x1435('0x43')](_0x309f8f[_0x1435('0x95')](),_0x17650a)[_0x1435('0x29')](function(_0x248a2b){_0x218fae=_[_0x1435('0x97')](_0x248a2b,'id');_0x17650a=_[_0x1435('0x2e')](_0x17650a,{'model':db[_0x1435('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x11cf64[_0x1435('0x43')][_0x1435('0x45')]){_0x4169ab[_0x1435('0x44')]['forEach'](function(_0x5c3119){_0x57de7a['field']('i.'+_0x5c3119);});}else{_0x57de7a[_0x1435('0x4a')](_0x1435('0x98'),_0x1435('0x63'));_0x57de7a[_0x1435('0x4a')]('a.key',_0x1435('0x99'));_0x57de7a['field'](_0x1435('0x9a'),_0x1435('0x9b'));_0x57de7a[_0x1435('0x4a')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x1435('0x8d'));_0x57de7a[_0x1435('0x4a')](_0x1435('0x9c'));_0x57de7a['field'](_0x1435('0x9d'),'Contact.firstName');_0x57de7a[_0x1435('0x4a')](_0x1435('0x9e'),'Contact.lastName');_0x57de7a['field'](_0x1435('0x9f'),_0x1435('0xa0'));_0x57de7a[_0x1435('0x4a')](_0x1435('0xa1'),'Contact.phone');_0x57de7a['field']('c.mobile',_0x1435('0xa2'));_0x57de7a[_0x1435('0x4a')](_0x1435('0xa3'),_0x1435('0xa4'));_0x57de7a[_0x1435('0x4a')]('o.fullname',_0x1435('0xa5'));_0x57de7a[_0x1435('0x4a')]('o.internal','Owner.internal');_0x57de7a[_0x1435('0x4a')](_0x1435('0xa6'),_0x1435('0x36'));}if(_0x4169ab['limit'])_0x57de7a[_0x1435('0x23')](_0x4169ab['limit']);if(_0x4169ab['offset'])_0x57de7a[_0x1435('0x20')](_0x4169ab[_0x1435('0x20')]);return db[_0x1435('0x94')][_0x1435('0x43')](_0x57de7a[_0x1435('0x95')](),_0x17650a);})[_0x1435('0x29')](function(_0x15af72){if(_0x15af72[_0x1435('0x96')]>0x0)_0x2cbaa3[_0x1435('0x48')](_0x1435('0xa7'),_['map'](_0x15af72,'id'));return db[_0x1435('0x94')][_0x1435('0x43')](_0x2cbaa3[_0x1435('0x95')](),_0x17650a)[_0x1435('0x29')](function(_0x4f1476){var _0x1dd597=_['groupBy'](_0x4f1476,_0x1435('0xa8'));var _0x3bd016=[];_0x15af72['forEach'](function(_0x31e206){_0x3bd016[_0x1435('0x39')](updateWhatsappInteraction(_0x31e206,_0x218fae,_0x1dd597));});return BPromise[_0x1435('0xa9')](_0x3bd016);});});})['then'](function(_0x3a783b){_0x228238[_0x1435('0xaa')]=_0x3a783b;return _0x228238;})[_0x1435('0x29')](respondWithFilteredResult(_0x2061b9,_0x4169ab))[_0x1435('0x3a')](handleError(_0x2061b9,null));};exports[_0x1435('0xab')]=function(_0x55fe3e,_0x36d84e){var _0x49a963={'raw':![],'where':{'id':_0x55fe3e[_0x1435('0xac')]['id']}},_0x183d47={};_0x183d47['model']=_[_0x1435('0x41')](db['WhatsappInteraction'][_0x1435('0x3d')]);_0x183d47[_0x1435('0x43')]=_['keys'](_0x55fe3e[_0x1435('0x43')]);_0x183d47[_0x1435('0x42')]=_['intersection'](_0x183d47[_0x1435('0x40')],_0x183d47[_0x1435('0x43')]);_0x49a963[_0x1435('0x44')]=_[_0x1435('0xad')](_0x183d47[_0x1435('0x40')],qs[_0x1435('0x45')](_0x55fe3e[_0x1435('0x43')][_0x1435('0x45')]));_0x49a963['attributes']=_0x49a963[_0x1435('0x44')][_0x1435('0x96')]?_0x49a963[_0x1435('0x44')]:_0x183d47['model'];if(_0x55fe3e[_0x1435('0x43')]['includeAll']){_0x49a963['include']=[{'all':!![]}];}_0x49a963=_['merge']({},_0x49a963,_0x55fe3e[_0x1435('0xae')]);return db[_0x1435('0x3c')]['find'](_0x49a963)[_0x1435('0x29')](handleEntityNotFound(_0x36d84e,null))[_0x1435('0x29')](respondWithResult(_0x36d84e,null))[_0x1435('0x3a')](handleError(_0x36d84e,null));};exports[_0x1435('0xaf')]=function(_0x45106b,_0xaaa864){return db[_0x1435('0x3c')][_0x1435('0xaf')](_0x45106b[_0x1435('0x2f')],{})['then'](respondWithResult(_0xaaa864,0xc9))[_0x1435('0x3a')](handleError(_0xaaa864,null));};exports[_0x1435('0xb0')]=function(_0x189d49,_0x133d52){if(_0x189d49[_0x1435('0x2f')]['id']){delete _0x189d49[_0x1435('0x2f')]['id'];}return db[_0x1435('0x3c')][_0x1435('0x62')]({'where':{'id':_0x189d49[_0x1435('0xac')]['id']}})['then'](handleEntityNotFound(_0x133d52,null))[_0x1435('0x29')](saveUpdates(_0x189d49[_0x1435('0x2f')],null))[_0x1435('0x29')](respondWithResult(_0x133d52,null))[_0x1435('0x3a')](handleError(_0x133d52,null));};exports[_0x1435('0x28')]=function(_0x323701,_0x1e83db){return db[_0x1435('0x3c')]['find']({'where':{'id':_0x323701[_0x1435('0xac')]['id']}})[_0x1435('0x29')](handleEntityNotFound(_0x1e83db,null))[_0x1435('0x29')](removeEntity(_0x1e83db,null))['catch'](handleError(_0x1e83db,null));};exports[_0x1435('0xb1')]=function(_0xf37d65,_0x81a232){return db['WhatsappInteraction'][_0x1435('0xb1')]()['then'](respondWithResult(_0x81a232,null))[_0x1435('0x3a')](handleError(_0x81a232,null));};exports[_0x1435('0xb2')]=function(_0x2258fc,_0x4e90bf,_0xed9c9f){return db[_0x1435('0xb3')][_0x1435('0x62')]({'where':{'id':_0x2258fc[_0x1435('0xac')]['id']}})[_0x1435('0x29')](handleEntityNotFound(_0x4e90bf,null))[_0x1435('0x29')](function(_0x413949){if(_0x413949){return _0x413949[_0x1435('0xb2')](_0x2258fc[_0x1435('0x2f')]['ids'],_['omit'](_0x2258fc[_0x1435('0x2f')],[_0x1435('0xb4'),'id'])||{});}})[_0x1435('0x29')](respondWithResult(_0x4e90bf,null))[_0x1435('0x3a')](handleError(_0x4e90bf,null));};exports[_0x1435('0xb5')]=function(_0x2bb40e,_0x8cf97e,_0x3e30fa){var _0x3dc18b={'raw':![],'where':{}};var _0x266d2e={};var _0x22b271={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x1435('0xb6')]({'where':{'id':_0x2bb40e[_0x1435('0xac')]['id']}})[_0x1435('0x29')](handleEntityNotFound(_0x8cf97e,null))[_0x1435('0x29')](function(_0x33807c){if(_0x33807c){_0x266d2e[_0x1435('0x40')]=_[_0x1435('0x41')](db[_0x1435('0xb3')]['rawAttributes']);_0x266d2e[_0x1435('0x43')]=_[_0x1435('0x41')](_0x2bb40e[_0x1435('0x43')]);_0x266d2e[_0x1435('0x42')]=_[_0x1435('0xad')](_0x266d2e[_0x1435('0x40')],_0x266d2e[_0x1435('0x43')]);_0x3dc18b[_0x1435('0x44')]=_[_0x1435('0xad')](_0x266d2e[_0x1435('0x40')],qs['fields'](_0x2bb40e[_0x1435('0x43')][_0x1435('0x45')]));_0x3dc18b['attributes']=_0x3dc18b[_0x1435('0x44')][_0x1435('0x96')]?_0x3dc18b[_0x1435('0x44')]:_0x266d2e[_0x1435('0x40')];if(!_0x2bb40e[_0x1435('0x43')][_0x1435('0x46')](_0x1435('0xb7'))){_0x3dc18b[_0x1435('0x23')]=qs[_0x1435('0x23')](_0x2bb40e[_0x1435('0x43')][_0x1435('0x23')]);_0x3dc18b[_0x1435('0x20')]=qs[_0x1435('0x20')](_0x2bb40e[_0x1435('0x43')][_0x1435('0x20')]);}_0x3dc18b[_0x1435('0x8c')]=qs['sort'](_0x2bb40e['query']['sort']);_0x3dc18b[_0x1435('0x48')]=qs['filters'](_['pick'](_0x2bb40e[_0x1435('0x43')],_0x266d2e[_0x1435('0x42')]));_0x3dc18b['where'][_0x1435('0xa8')]=_0x33807c['id'];if(_0x2bb40e[_0x1435('0x43')][_0x1435('0x84')]){_0x3dc18b[_0x1435('0x48')]=_['merge'](_0x3dc18b[_0x1435('0x48')],{'$or':_[_0x1435('0x3b')](_0x3dc18b[_0x1435('0x44')],function(_0x36f57c){var _0x26cefd={};_0x26cefd[_0x36f57c]={'$like':'%'+_0x2bb40e[_0x1435('0x43')][_0x1435('0x84')]+'%'};return _0x26cefd;})});}if(_0x2bb40e[_0x1435('0x43')]['$gte']){var _0x4521c5=_0x2bb40e['query'][_0x1435('0xb8')]['split'](',');var _0x46738e={};_0x46738e[_0x4521c5[0x0]]={'$gte':moment(_0x4521c5[0x1])[_0x1435('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3dc18b[_0x1435('0x48')]=_[_0x1435('0x2e')](_0x3dc18b[_0x1435('0x48')],_0x46738e);}_0x3dc18b=_[_0x1435('0x2e')]({},_0x3dc18b,_0x2bb40e[_0x1435('0xae')]);return db['WhatsappMessage'][_0x1435('0x22')]({'where':_0x3dc18b[_0x1435('0x48')]})[_0x1435('0x29')](function(_0xcb5e49){_0x22b271[_0x1435('0x22')]=_0xcb5e49;if(_0x2bb40e[_0x1435('0x43')][_0x1435('0xba')]){_0x3dc18b[_0x1435('0xbb')]=[{'all':!![]}];}return db[_0x1435('0xb3')][_0x1435('0xbc')](_0x3dc18b);})[_0x1435('0x29')](function(_0x34b8a9){_0x22b271[_0x1435('0xaa')]=_0x34b8a9;return _0x22b271;});}})['then'](respondWithFilteredResult(_0x8cf97e,_0x3dc18b))['catch'](handleError(_0x8cf97e,null));};exports[_0x1435('0xbd')]=function(_0x18ea13,_0x345495,_0x3109a4){return db[_0x1435('0x3c')][_0x1435('0x62')]({'where':{'id':_0x18ea13[_0x1435('0xac')]['id']}})['then'](handleEntityNotFound(_0x345495,null))[_0x1435('0x29')](function(_0x586c39){if(_0x586c39){return _0x586c39[_0x1435('0xbe')](_0x18ea13[_0x1435('0x2f')][_0x1435('0xb4')],_['omit'](_0x18ea13[_0x1435('0x2f')],[_0x1435('0xb4'),'id'])||{})[_0x1435('0xbf')](function(){return db[_0x1435('0xc0')]['findAll']({'attributes':['id',_0x1435('0x2c'),'color'],'where':{'id':_0x18ea13['body'][_0x1435('0xb4')]}});})['then'](function(_0x214357){socket[_0x1435('0xc1')](_0x1435('0xc2'),{'id':Number(_0x18ea13[_0x1435('0xac')]['id']),'tags':_0x214357||[]});return{'id':Number(_0x18ea13[_0x1435('0xac')]['id']),'tags':_0x214357||[]};});}})['then'](respondWithResult(_0x345495,null))[_0x1435('0x3a')](handleError(_0x345495,null));};exports[_0x1435('0xc3')]=function(_0x310d98,_0x3f7aa4,_0x4a28a9){return db[_0x1435('0x3c')][_0x1435('0x62')]({'where':{'id':_0x310d98[_0x1435('0xac')]['id']}})[_0x1435('0x29')](handleEntityNotFound(_0x3f7aa4,null))[_0x1435('0x29')](function(_0x545d34){if(_0x545d34){return _0x545d34[_0x1435('0xc3')](_0x310d98[_0x1435('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x3f7aa4,null))[_0x1435('0x3a')](handleError(_0x3f7aa4,null));};exports['download']=function(_0x7ed37b,_0x53c4dc){var _0x5bfb55=moment()['unix']()[_0x1435('0x95')]();var _0x36f655=path[_0x1435('0xc4')](config[_0x1435('0xc5')],_0x1435('0xc6'),_0x1435('0xc7'),_0x1435('0xc8'));var _0xbfdb20=path[_0x1435('0xc4')](config['root'],_0x1435('0xc6'),'files',_0x1435('0xc9'));var _0x460c37=path[_0x1435('0xc4')](_0x36f655,_0x5bfb55);var _0x405948=util['format'](_0x1435('0xca'),_0x7ed37b[_0x1435('0xac')]['id'],_0x5bfb55);var _0x352e30=path[_0x1435('0xc4')](_0x36f655,_0x405948);var _0x35806b=[];_0x35806b[_0x1435('0x39')]({'model':db[_0x1435('0x72')],'as':_0x1435('0x72'),'attributes':['id','fullname'],'raw':!![]});_0x35806b['push']({'model':db[_0x1435('0xcb')],'as':_0x1435('0x66'),'attributes':['id',_0x1435('0xcc'),_0x1435('0xcd')],'raw':!![]});if(_0x7ed37b['query']['attachments']){_0x35806b['push']({'model':db[_0x1435('0xce')],'as':_0x1435('0xce'),'raw':!![]});}var _0x41893e=[{'model':db[_0x1435('0xb3')],'as':_0x1435('0xcf'),'attributes':['id',_0x1435('0x2f'),_0x1435('0xd0'),_0x1435('0xd1'),_0x1435('0xd2'),_0x1435('0x80')],'include':_0x35806b}];_0x41893e[_0x1435('0x39')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x1435('0x2c')]});_0x41893e['push']({'model':db[_0x1435('0x72')],'as':_0x1435('0xd3'),'attributes':['id',_0x1435('0x35')]});return db[_0x1435('0x3c')]['find']({'where':{'id':_0x7ed37b[_0x1435('0xac')]['id']},'include':_0x41893e})[_0x1435('0x29')](handleEntityNotFound(_0x53c4dc,null))[_0x1435('0x29')](function(_0xff25a3){if(_0xff25a3){var _0x38bb79=_0xff25a3[_0x1435('0xd4')]({'plain':!![]});fs[_0x1435('0xd5')](_0x460c37);var _0x1196f9={'channel':_0x1435('0xd6'),'account':_0x38bb79[_0x1435('0xd7')][_0x1435('0x2c')],'agent':_0x38bb79[_0x1435('0xd3')]?_0x38bb79[_0x1435('0xd3')][_0x1435('0x35')]:_0x1435('0xd8'),'createdAt':moment(_0x38bb79['createdAt'])[_0x1435('0xb9')](_0x1435('0xd9'))['toString'](),'closedAt':_0x38bb79[_0x1435('0xda')]?moment(_0x38bb79[_0x1435('0xdb')])[_0x1435('0xb9')](_0x1435('0xd9'))['toString']():'','disposition':_0x38bb79['disposition'],'messages':_(_0x38bb79[_0x1435('0xcf')])[_0x1435('0x84')]({'secret':![]})['map'](function(_0x573bc2){if(_0x573bc2[_0x1435('0xce')]){var _0xd27dd7=path[_0x1435('0xc4')](_0xbfdb20,_0x573bc2[_0x1435('0xce')]['basename']);if(fs['existsSync'](_0xd27dd7)){fs[_0x1435('0xdc')](_0xd27dd7)[_0x1435('0xdd')](fs['createWriteStream'](path[_0x1435('0xc4')](_0x460c37,_0x573bc2[_0x1435('0xce')][_0x1435('0xde')])));}}return{'date':moment(_0x573bc2[_0x1435('0xd0')])['format'](_0x1435('0xd9'))['toString'](),'sender':_0x573bc2[_0x1435('0xd1')]==='out'?_0x573bc2[_0x1435('0x72')]?_0x573bc2[_0x1435('0x72')][_0x1435('0x35')]:_0x1435('0xdf'):_0x573bc2[_0x1435('0x66')][_0x1435('0xcc')]+(_0x573bc2[_0x1435('0x66')][_0x1435('0xcd')]?'\x20'+_0x573bc2[_0x1435('0x66')][_0x1435('0xcd')]:''),'body':_0x573bc2[_0x1435('0xce')]?_0x573bc2['Attachment'][_0x1435('0xde')]:_0x573bc2[_0x1435('0x2f')],'direction':_0x573bc2[_0x1435('0xd1')]==='out'?'A':'C','secret':_0x573bc2[_0x1435('0xd2')],'read':_0x573bc2[_0x1435('0x80')],'attachment':_0x573bc2[_0x1435('0xce')]};})['value']()};return ejs[_0x1435('0xe0')](path[_0x1435('0xc4')](config[_0x1435('0xc5')],_0x1435('0xc6'),_0x1435('0xe1'),'downloadInteraction.html'),{'interaction':_0x1196f9})[_0x1435('0x29')](function(_0x3b90cc){var _0x33a819=path[_0x1435('0xc4')](_0x460c37,_0x1435('0xe2')+_0x38bb79['id']+'-'+_0x5bfb55+_0x1435('0xe3'));var _0x30c3cb={'path':_0x33a819,'channel':_0x1435('0xd6'),'interactionId':_0x38bb79['id']};return pdf[_0x1435('0xe4')](_0x3b90cc,_0x30c3cb);})[_0x1435('0x29')](function(){return new BPromise(function(_0x480b8f,_0x32b4ab){zipdir(_0x460c37,{'saveTo':_0x352e30},function(_0x3e2bfe,_0x5b37ae){if(_0x3e2bfe)return _0x32b4ab(_0x3e2bfe);return _0x480b8f(_0x5b37ae);});})[_0x1435('0x29')](function(){return new BPromise(function(_0x3f2cc8,_0x4f971){rimraf(_0x460c37,function(_0x3e49de){if(_0x3e49de)_0x4f971(_0x3e49de);return _0x3f2cc8();});});})[_0x1435('0x29')](function(){return _0x53c4dc[_0x1435('0xe5')](_0x352e30,_0x405948,function(_0x506d5d){if(_0x506d5d){console[_0x1435('0xe6')](_0x1435('0xe7'),_0x506d5d);}else{fs[_0x1435('0xe8')](_0x352e30);}});});});}else{return _0x53c4dc[_0x1435('0x1c')](0xc8);}})[_0x1435('0x3a')](handleError(_0x53c4dc,null));}; \ No newline at end of file +var _0x4bd3=['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_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','type','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','contactName','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','all','catch','show','params','includeAll','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','emit','whatsappInteractionTags:save','removeTags','download','join','root','server','tmp','files','attachments','User','firstName','lastName','Attachment','Messages','createdAt','secret','WhatsappAccount','Owner','get','mkdirSync','Account','N.A.','closed','closedAt','disposition','basename','existsSync','direction','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','render','merge','body','agent','interaction','account','Users','map','fullname','TagIds','split','Tags','push','index','WhatsappInteraction','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','u.fullname','users','whatsapp_interactions','left_join'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4bd3,0x174));var _0x34bd=function(_0xf1c1d8,_0x51e295){_0xf1c1d8=_0xf1c1d8-0x0;var _0x9fe658=_0x4bd3[_0xf1c1d8];return _0x9fe658;};'use strict';var emlformat=require(_0x34bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34bd('0x1'));var jsonpatch=require(_0x34bd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x34bd('0x3'));var util=require(_0x34bd('0x4'));var path=require(_0x34bd('0x5'));var sox=require('sox');var csv=require(_0x34bd('0x6'));var ejs=require(_0x34bd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bd('0x8'));var squel=require(_0x34bd('0x9'));var crypto=require('crypto');var jsforce=require(_0x34bd('0xa'));var deskjs=require(_0x34bd('0xb'));var toCsv=require(_0x34bd('0x6'));var querystring=require(_0x34bd('0xc'));var Papa=require(_0x34bd('0xd'));var Redis=require(_0x34bd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x34bd('0xf'));var as=require(_0x34bd('0x10'));var pdf=require(_0x34bd('0x11'));var hardwareService=require(_0x34bd('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x34bd('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x34bd('0x14'))['db'];config[_0x34bd('0x15')]=_[_0x34bd('0x16')](config[_0x34bd('0x15')],{'host':_0x34bd('0x17'),'port':0x18eb});var socket=require(_0x34bd('0x18'))(new Redis(config[_0x34bd('0x15')]));require(_0x34bd('0x19'))[_0x34bd('0x1a')](socket);function respondWithStatusCode(_0x59ed5d,_0x3fa6a8){_0x3fa6a8=_0x3fa6a8||0xcc;return function(_0x4d4955){if(_0x4d4955){return _0x59ed5d['sendStatus'](_0x3fa6a8);}return _0x59ed5d[_0x34bd('0x1b')](_0x3fa6a8)[_0x34bd('0x1c')]();};}function respondWithResult(_0x280c1a,_0x2dc917){_0x2dc917=_0x2dc917||0xc8;return function(_0x34b91b){if(_0x34b91b){return _0x280c1a[_0x34bd('0x1b')](_0x2dc917)[_0x34bd('0x1d')](_0x34b91b);}};}function respondWithFilteredResult(_0x1c12e8,_0x3b4bf8){return function(_0x72b197){if(_0x72b197){var _0x4b5ebb=typeof _0x3b4bf8['offset']===_0x34bd('0x1e')&&typeof _0x3b4bf8[_0x34bd('0x1f')]===_0x34bd('0x1e');var _0x220666=_0x72b197[_0x34bd('0x20')];var _0x23a94a=_0x4b5ebb?0x0:_0x3b4bf8[_0x34bd('0x21')];var _0x3d5f76=_0x4b5ebb?_0x72b197[_0x34bd('0x20')]:_0x3b4bf8['offset']+_0x3b4bf8[_0x34bd('0x1f')];var _0xe02cc5;if(_0x3d5f76>=_0x220666){_0x3d5f76=_0x220666;_0xe02cc5=0xc8;}else{_0xe02cc5=0xce;}_0x1c12e8[_0x34bd('0x1b')](_0xe02cc5);return _0x1c12e8[_0x34bd('0x22')](_0x34bd('0x23'),_0x23a94a+'-'+_0x3d5f76+'/'+_0x220666)['json'](_0x72b197);}return null;};}function patchUpdates(_0x582772){return function(_0x5da62a){try{jsonpatch['apply'](_0x5da62a,_0x582772,!![]);}catch(_0x3dafe8){return BPromise['reject'](_0x3dafe8);}return _0x5da62a[_0x34bd('0x24')]();};}function saveUpdates(_0x1c2282,_0x428140){return function(_0x5c3c85){if(_0x5c3c85){return _0x5c3c85[_0x34bd('0x25')](_0x1c2282)[_0x34bd('0x26')](function(_0x4f0dff){return _0x4f0dff;});}return null;};}function removeEntity(_0x457006,_0x5be702){return function(_0x29bda8){if(_0x29bda8){return _0x29bda8[_0x34bd('0x27')]()[_0x34bd('0x26')](function(){_0x457006[_0x34bd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b4eb,_0x3fe8b0){return function(_0x5d2e3d){if(!_0x5d2e3d){_0x45b4eb[_0x34bd('0x28')](0x194);}return _0x5d2e3d;};}function handleError(_0x510a30,_0x16581f){_0x16581f=_0x16581f||0x1f4;return function(_0x3f675c){logger[_0x34bd('0x29')](_0x3f675c[_0x34bd('0x2a')]);if(_0x3f675c[_0x34bd('0x2b')]){delete _0x3f675c['name'];}_0x510a30[_0x34bd('0x1b')](_0x16581f)[_0x34bd('0x2c')](_0x3f675c);};}function getMustacheRender(_0x56d3b9,_0x5d1662){return Mustache[_0x34bd('0x2d')](_0x56d3b9,_[_0x34bd('0x2e')](_0x5d1662[_0x34bd('0x2f')],{'contact':_0x5d1662['contact'],'message':_0x5d1662['message'],'agent':_0x5d1662[_0x34bd('0x30')],'interaction':_0x5d1662[_0x34bd('0x31')],'account':_0x5d1662[_0x34bd('0x32')]}))||'';}function getInteractionUsers(_0x19eb5d,_0x5680c3){return new BPromise(function(_0x3a6fb2,_0x28d415){try{if(_0x5680c3[_0x19eb5d['id']]){_0x19eb5d[_0x34bd('0x33')]=_[_0x34bd('0x34')](_0x5680c3[_0x19eb5d['id']],function(_0x2ef58f){return{'id':_0x2ef58f['id'],'fullname':_0x2ef58f[_0x34bd('0x35')]};});}}catch(_0x4ae886){_0x28d415(_0x4ae886);}_0x3a6fb2(_0x19eb5d);});}function getInteractionTags(_0x72bb10,_0x4b3587){return new BPromise(function(_0xadfa97,_0x3b7b54){try{if(_0x72bb10[_0x34bd('0x36')]){_0x72bb10['Tags']=[];_0x72bb10[_0x34bd('0x36')][_0x34bd('0x37')](',')['forEach'](function(_0x3c5e1d){_0x72bb10[_0x34bd('0x38')][_0x34bd('0x39')](_0x4b3587[_0x3c5e1d]);});}delete _0x72bb10['TagIds'];}catch(_0x1574c8){_0x3b7b54(_0x1574c8);}_0xadfa97(_0x72bb10);});}function updateWhatsappInteraction(_0x235576,_0x4bfb6c,_0x117188){return new BPromise(function(_0x41c377,_0x2bcbf9){return getInteractionUsers(_0x235576,_0x117188)[_0x34bd('0x26')](function(_0x320643){return getInteractionTags(_0x320643,_0x4bfb6c);})[_0x34bd('0x26')](function(_0x4fb244){_0x41c377(_0x4fb244);})['catch'](function(_0x56e805){_0x2bcbf9(_0x56e805);});});}exports[_0x34bd('0x3a')]=function(_0x1258cf,_0x5e30c5){var _0x5b5f86={},_0x13d2f0={},_0x4f5c8f={'count':0x0,'rows':[]};var _0x597a82=_[_0x34bd('0x34')](db[_0x34bd('0x3b')][_0x34bd('0x3c')],function(_0xdc3496){return{'name':_0xdc3496[_0x34bd('0x3d')],'type':_0xdc3496['type']['key']};});_0x13d2f0[_0x34bd('0x3e')]=_['map'](_0x597a82,_0x34bd('0x2b'));_0x13d2f0[_0x34bd('0x3f')]=_[_0x34bd('0x40')](_0x1258cf[_0x34bd('0x3f')]);_0x13d2f0[_0x34bd('0x41')]=_['intersection'](_0x13d2f0[_0x34bd('0x3e')],_0x13d2f0[_0x34bd('0x3f')]);_0x5b5f86[_0x34bd('0x42')]=_[_0x34bd('0x43')](_0x13d2f0['model'],qs[_0x34bd('0x44')](_0x1258cf['query'][_0x34bd('0x44')]));_0x5b5f86[_0x34bd('0x42')]=_0x5b5f86['attributes'][_0x34bd('0x45')]?_0x5b5f86['attributes']:_0x13d2f0[_0x34bd('0x3e')];if(!_0x1258cf[_0x34bd('0x3f')][_0x34bd('0x46')](_0x34bd('0x47'))){_0x5b5f86[_0x34bd('0x1f')]=qs[_0x34bd('0x1f')](_0x1258cf[_0x34bd('0x3f')]['limit']);_0x5b5f86['offset']=qs['offset'](_0x1258cf[_0x34bd('0x3f')][_0x34bd('0x21')]);}_0x5b5f86[_0x34bd('0x48')]=qs[_0x34bd('0x49')](_0x1258cf['query'][_0x34bd('0x49')]);_0x5b5f86[_0x34bd('0x4a')]=qs[_0x34bd('0x41')](_[_0x34bd('0x4b')](_0x1258cf[_0x34bd('0x3f')],_0x13d2f0['filters']),_0x597a82);var _0x3687b9=[];var _0x557094=squel['select']()[_0x34bd('0x4c')]('id')['field'](_0x34bd('0x2b'))[_0x34bd('0x4c')](_0x34bd('0x4d'))[_0x34bd('0x4e')](_0x34bd('0x4f'));var _0x5b061a=squel['select']()[_0x34bd('0x4c')]('u.id')[_0x34bd('0x4c')](_0x34bd('0x50'))[_0x34bd('0x4c')]('ui.WhatsappInteractionId')['from']('user_has_whatsapp_interactions','ui')['left_join'](_0x34bd('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x21d2ea=squel['select']()[_0x34bd('0x4e')](_0x34bd('0x52'),'i')[_0x34bd('0x53')](_0x34bd('0x54'),'c',_0x34bd('0x55'))['left_join'](_0x34bd('0x51'),'o',_0x34bd('0x56'))[_0x34bd('0x53')](_0x34bd('0x57'),'a',_0x34bd('0x58'))['left_join'](_0x34bd('0x59'),'me',_0x34bd('0x5a'))['left_join'](_0x34bd('0x5b'),'it',_0x34bd('0x5c'))['left_join']('tools_tags','t',_0x34bd('0x5d'));var _0x4e9d52=squel['expr']();var _0x2fb748=[];var _0x5df6a5=squel['expr']();var _0x52d479;if(_0x1258cf['query']['search']){_0x52d479=as[_0x34bd('0x5e')](_0x1258cf[_0x34bd('0x3f')]['search']);var _0x4a8291=_0x52d479['sqlOperator'];for(var _0x477fd4=0x0;_0x477fd4<_0x52d479[_0x34bd('0x5f')]['length'];_0x477fd4++){var _0x162a08=_0x52d479[_0x34bd('0x5f')][_0x477fd4];var _0x3f714b='i';var _0x2c4064=_[_0x34bd('0x60')](_0x597a82,[_0x34bd('0x2b'),_0x162a08['field']]);if(!_0x2c4064){switch(_0x162a08[_0x34bd('0x4c')]){case _0x34bd('0x61'):if(_0x162a08[_0x34bd('0x62')]==0x1){_0x21d2ea[_0x34bd('0x63')]('`'+_0x162a08['field']+_0x34bd('0x64'));}else{_0x21d2ea['having']('`'+_0x162a08[_0x34bd('0x4c')]+'`\x20>\x200');}break;case _0x34bd('0x65'):if(_0x162a08[_0x34bd('0x66')]===_0x34bd('0x67')){if(_0x162a08[_0x34bd('0x62')][_0x34bd('0x37')]('\x20')[_0x34bd('0x45')]>0x1){_0x4e9d52[_0x4a8291](_0x34bd('0x68'),qs[_0x34bd('0x69')](_0x162a08[_0x34bd('0x62')]),null);}else{var _0x3b1dd5='%'+_0x162a08[_0x34bd('0x62')]+'%';_0x4e9d52[_0x4a8291]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3b1dd5,_0x3b1dd5,_0x3b1dd5);}}else{_0x2c4064=_[_0x34bd('0x60')](_0x597a82,['name',_0x34bd('0x6a')]);_0x162a08['field']=_0x34bd('0x6a');_0x2cd75b=as['buildExpression'](_0x3f714b,_0x2c4064[_0x34bd('0x6b')],_0x162a08);_0x4e9d52[_0x4a8291](_0x2cd75b[_0x34bd('0x6c')],_0x2cd75b[_0x34bd('0x62')][_0x34bd('0x6d')],_0x2cd75b[_0x34bd('0x62')][_0x34bd('0x1c')]);}break;case _0x34bd('0x6e'):var _0xeffa5d=_0x162a08[_0x34bd('0x62')][_0x34bd('0x37')](',')[_0x34bd('0x34')](function(_0x3e65e6){return Number(_0x3e65e6);});_0xeffa5d[_0x34bd('0x6f')](function(_0x5c7de8){_0x5df6a5['or'](_0x34bd('0x70'),'%,'+_0x5c7de8+',%');});_0x2fb748=_['union'](_0x2fb748,_0xeffa5d);break;case'User':if(_0x162a08[_0x34bd('0x66')]===_0x34bd('0x67')){_0x4e9d52[_0x4a8291](_0x34bd('0x71'),'%'+_0x162a08[_0x34bd('0x62')]+'%',null);}else{_0x2c4064=_[_0x34bd('0x60')](_0x597a82,['name','UserId']);_0x162a08['field']='UserId';_0x2cd75b=as[_0x34bd('0x72')](_0x3f714b,_0x2c4064[_0x34bd('0x6b')],_0x162a08);_0x4e9d52[_0x4a8291](_0x2cd75b['text'],_0x2cd75b[_0x34bd('0x62')][_0x34bd('0x6d')],_0x2cd75b[_0x34bd('0x62')]['end']);}break;case _0x34bd('0x2f'):_0x2cd75b=as[_0x34bd('0x72')]('me',null,_0x162a08);_0x4e9d52[_0x4a8291](_0x2cd75b[_0x34bd('0x6c')],_0x2cd75b[_0x34bd('0x62')][_0x34bd('0x6d')],_0x2cd75b[_0x34bd('0x62')][_0x34bd('0x1c')]);break;}}else{var _0x2cd75b=as['buildExpression'](_0x3f714b,_0x2c4064['type'],_0x162a08);_0x4e9d52[_0x4a8291](_0x2cd75b[_0x34bd('0x6c')],_0x2cd75b['value'][_0x34bd('0x6d')],_0x2cd75b[_0x34bd('0x62')][_0x34bd('0x1c')]);}}}else{var _0x58a6eb=_(_0x1258cf['query'])[_0x34bd('0x40')]()[_0x34bd('0x34')](function(_0x3c2e61){return _['some'](_0x597a82,['name',_0x3c2e61])?_0x3c2e61:undefined;})[_0x34bd('0x73')]()[_0x34bd('0x62')]();if(!_[_0x34bd('0x74')](_0x58a6eb)){_0x58a6eb[_0x34bd('0x6f')](function(_0x29b588){if(_0x29b588===_0x34bd('0x75')){_0x21d2ea[_0x34bd('0x4a')](_0x34bd('0x76'),[][_0x34bd('0x77')](_0x1258cf['query'][_0x29b588]));}else if(_0x29b588==='createdAt'){var _0x3878a0=JSON['parse'](_0x1258cf[_0x34bd('0x3f')][_0x29b588])[_0x34bd('0x78')];var _0x1639de=JSON[_0x34bd('0x79')](_0x1258cf['query'][_0x29b588])['$lte'];_0x21d2ea[_0x34bd('0x4a')](_0x34bd('0x7a'),_0x3878a0,_0x1639de);}else{if(_0x1258cf[_0x34bd('0x3f')][_0x29b588]==='null'){_0x21d2ea[_0x34bd('0x4a')]('i.'+_0x29b588+'\x20IS\x20NULL');}else{_0x21d2ea[_0x34bd('0x4a')]('i.'+_0x29b588+_0x34bd('0x7b'),_0x1258cf[_0x34bd('0x3f')][_0x29b588]);}}});}if(_0x1258cf['query'][_0x34bd('0x7c')]){if(_0x1258cf['query']['read']==0x1){_0x21d2ea[_0x34bd('0x63')](_0x34bd('0x7d'));}else{_0x21d2ea[_0x34bd('0x63')]('`unreadMessages`\x20>\x200');}}if(_0x1258cf[_0x34bd('0x3f')][_0x34bd('0x7e')]){_0x2fb748=_[_0x34bd('0x7f')](_0x1258cf['query'][_0x34bd('0x7e')])?_0x1258cf[_0x34bd('0x3f')][_0x34bd('0x7e')]:new Array(_0x1258cf[_0x34bd('0x3f')][_0x34bd('0x7e')]);_0x2fb748[_0x34bd('0x6f')](function(_0x4637d8){_0x5df6a5['or'](_0x34bd('0x70'),'%,'+_0x4637d8+',%');});}if(_0x1258cf[_0x34bd('0x3f')][_0x34bd('0x80')]){var _0x14601f=_0x1258cf['query'][_0x34bd('0x80')]['replace']('\x5c','\x5c\x5c')[_0x34bd('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x14601f)){_0x4e9d52['or'](_0x34bd('0x82'),_0x14601f+'%')['or'](_0x34bd('0x83'),_0x14601f+'%');}else{_0x4e9d52['or'](_0x34bd('0x84'),qs[_0x34bd('0x69')](_0x14601f))['or'](_0x34bd('0x85'),_0x14601f+'%');}}}_0x21d2ea[_0x34bd('0x4a')](_0x4e9d52);_0x21d2ea[_0x34bd('0x86')](_0x34bd('0x87'));var _0x21088a={'type':db[_0x34bd('0x88')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1caaf3=_0x21d2ea[_0x34bd('0x89')]();_0x1caaf3[_0x34bd('0x4c')]('i.id');_0x1caaf3['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x34bd('0x61'));if(_0x5b5f86[_0x34bd('0x48')]){_0x5b5f86[_0x34bd('0x48')][_0x34bd('0x6f')](function(_0x7fef8b){var _0x5da01c=_0x7fef8b[0x0]===_0x34bd('0x8a')?_0x7fef8b[0x0]:'i.'+_0x7fef8b[0x0];_0x21d2ea['order'](_0x5da01c,_0x7fef8b[0x1]===_0x34bd('0x8b')?![]:!![]);});}if(!_[_0x34bd('0x74')](_0x2fb748)){_0x21d2ea['having'](_0x5df6a5);_0x1caaf3[_0x34bd('0x4a')]('t.id\x20IN\x20?',_0x2fb748);}BPromise[_0x34bd('0x8c')]()['then'](function(){if(!_0x52d479){if(_0x1258cf[_0x34bd('0x3f')]['WhatsappAccountId'])return;_0x1caaf3[_0x34bd('0x4a')](_0x34bd('0x8d'));_0x21d2ea[_0x34bd('0x4a')](_0x34bd('0x8d'));return;}if(_0x1258cf[_0x34bd('0x8e')][_0x34bd('0x8f')]!==_0x34bd('0x30'))return;return _0x1258cf[_0x34bd('0x8e')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x34bd('0x26')](function(_0x217306){if(_[_0x34bd('0x74')](_0x217306)){_0x1caaf3['where']('i.WhatsappAccountId\x20IS\x20NULL');_0x21d2ea['where'](_0x34bd('0x90'));}else{_0x1caaf3[_0x34bd('0x4a')]('i.WhatsappAccountId\x20IN\x20?',_[_0x34bd('0x34')](_0x217306,'id'));_0x21d2ea['where'](_0x34bd('0x76'),_[_0x34bd('0x34')](_0x217306,'id'));}});})[_0x34bd('0x26')](function(){if(_0x1258cf['user'][_0x34bd('0x8f')]==='agent'&&!_0x52d479&&!_0x1258cf[_0x34bd('0x3f')][_0x34bd('0x75')])return[];return db[_0x34bd('0x91')][_0x34bd('0x3f')](_0x1caaf3[_0x34bd('0x92')](),_0x21088a);})[_0x34bd('0x26')](function(_0x414c59){_0x4f5c8f[_0x34bd('0x20')]=_0x414c59[_0x34bd('0x45')];if(_0x4f5c8f[_0x34bd('0x20')]===0x0)return[];return db[_0x34bd('0x91')][_0x34bd('0x3f')](_0x557094[_0x34bd('0x92')](),_0x21088a)[_0x34bd('0x26')](function(_0x59c473){_0x3687b9=_[_0x34bd('0x93')](_0x59c473,'id');_0x21088a=_[_0x34bd('0x2e')](_0x21088a,{'model':db[_0x34bd('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1258cf[_0x34bd('0x3f')][_0x34bd('0x44')]){_0x5b5f86['attributes'][_0x34bd('0x6f')](function(_0x1d4259){_0x21d2ea[_0x34bd('0x4c')]('i.'+_0x1d4259);});}else{_0x21d2ea[_0x34bd('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x34bd('0x61'));_0x21d2ea['field']('a.key','Account.key');_0x21d2ea['field'](_0x34bd('0x94'),_0x34bd('0x95'));_0x21d2ea[_0x34bd('0x4c')]('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',_0x34bd('0x8a'));_0x21d2ea[_0x34bd('0x4c')](_0x34bd('0x96'));_0x21d2ea[_0x34bd('0x4c')](_0x34bd('0x97'),_0x34bd('0x98'));_0x21d2ea[_0x34bd('0x4c')](_0x34bd('0x99'),_0x34bd('0x9a'));_0x21d2ea[_0x34bd('0x4c')](_0x34bd('0x9b'),'Contact.email');_0x21d2ea['field'](_0x34bd('0x9c'),'Contact.phone');_0x21d2ea[_0x34bd('0x4c')](_0x34bd('0x9d'),_0x34bd('0x9e'));_0x21d2ea[_0x34bd('0x4c')](_0x34bd('0x9f'),_0x34bd('0xa0'));_0x21d2ea[_0x34bd('0x4c')](_0x34bd('0xa1'),'Owner.fullname');_0x21d2ea[_0x34bd('0x4c')](_0x34bd('0xa2'),_0x34bd('0xa3'));_0x21d2ea['field'](_0x34bd('0xa4'),_0x34bd('0x36'));}if(_0x5b5f86[_0x34bd('0x1f')])_0x21d2ea[_0x34bd('0x1f')](_0x5b5f86['limit']);if(_0x5b5f86[_0x34bd('0x21')])_0x21d2ea[_0x34bd('0x21')](_0x5b5f86[_0x34bd('0x21')]);return db[_0x34bd('0x91')][_0x34bd('0x3f')](_0x21d2ea[_0x34bd('0x92')](),_0x21088a);})[_0x34bd('0x26')](function(_0x193f37){if(_0x193f37[_0x34bd('0x45')]>0x0)_0x5b061a[_0x34bd('0x4a')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x34bd('0x34')](_0x193f37,'id'));return db[_0x34bd('0x91')][_0x34bd('0x3f')](_0x5b061a[_0x34bd('0x92')](),_0x21088a)[_0x34bd('0x26')](function(_0x38752d){var _0x3ab44e=_[_0x34bd('0xa5')](_0x38752d,_0x34bd('0xa6'));var _0x3d6c4a=[];_0x193f37[_0x34bd('0x6f')](function(_0x1d735f){_0x3d6c4a[_0x34bd('0x39')](updateWhatsappInteraction(_0x1d735f,_0x3687b9,_0x3ab44e));});return BPromise[_0x34bd('0xa7')](_0x3d6c4a);});});})['then'](function(_0x70c6a9){_0x4f5c8f['rows']=_0x70c6a9;return _0x4f5c8f;})[_0x34bd('0x26')](respondWithFilteredResult(_0x5e30c5,_0x5b5f86))[_0x34bd('0xa8')](handleError(_0x5e30c5,null));};exports[_0x34bd('0xa9')]=function(_0x24d607,_0x2ba918){var _0x1cd10c={'raw':![],'where':{'id':_0x24d607[_0x34bd('0xaa')]['id']}},_0x334c57={};_0x334c57['model']=_[_0x34bd('0x40')](db[_0x34bd('0x3b')][_0x34bd('0x3c')]);_0x334c57['query']=_[_0x34bd('0x40')](_0x24d607[_0x34bd('0x3f')]);_0x334c57[_0x34bd('0x41')]=_[_0x34bd('0x43')](_0x334c57['model'],_0x334c57[_0x34bd('0x3f')]);_0x1cd10c[_0x34bd('0x42')]=_[_0x34bd('0x43')](_0x334c57[_0x34bd('0x3e')],qs[_0x34bd('0x44')](_0x24d607['query'][_0x34bd('0x44')]));_0x1cd10c['attributes']=_0x1cd10c['attributes'][_0x34bd('0x45')]?_0x1cd10c[_0x34bd('0x42')]:_0x334c57[_0x34bd('0x3e')];if(_0x24d607['query'][_0x34bd('0xab')]){_0x1cd10c['include']=[{'all':!![]}];}_0x1cd10c=_[_0x34bd('0x2e')]({},_0x1cd10c,_0x24d607[_0x34bd('0xac')]);return db['WhatsappInteraction']['find'](_0x1cd10c)['then'](handleEntityNotFound(_0x2ba918,null))[_0x34bd('0x26')](respondWithResult(_0x2ba918,null))[_0x34bd('0xa8')](handleError(_0x2ba918,null));};exports['create']=function(_0x476c1f,_0x56093c){return db[_0x34bd('0x3b')][_0x34bd('0xad')](_0x476c1f[_0x34bd('0x2f')],{})[_0x34bd('0x26')](respondWithResult(_0x56093c,0xc9))[_0x34bd('0xa8')](handleError(_0x56093c,null));};exports[_0x34bd('0x25')]=function(_0x239e74,_0x350872){if(_0x239e74['body']['id']){delete _0x239e74[_0x34bd('0x2f')]['id'];}return db[_0x34bd('0x3b')][_0x34bd('0x60')]({'where':{'id':_0x239e74[_0x34bd('0xaa')]['id']}})[_0x34bd('0x26')](handleEntityNotFound(_0x350872,null))[_0x34bd('0x26')](saveUpdates(_0x239e74[_0x34bd('0x2f')],null))[_0x34bd('0x26')](respondWithResult(_0x350872,null))[_0x34bd('0xa8')](handleError(_0x350872,null));};exports[_0x34bd('0x27')]=function(_0x499703,_0xf785e){return db['WhatsappInteraction']['find']({'where':{'id':_0x499703[_0x34bd('0xaa')]['id']}})[_0x34bd('0x26')](handleEntityNotFound(_0xf785e,null))[_0x34bd('0x26')](removeEntity(_0xf785e,null))[_0x34bd('0xa8')](handleError(_0xf785e,null));};exports['describe']=function(_0x1a4dfa,_0x4122fb){return db[_0x34bd('0x3b')][_0x34bd('0xae')]()['then'](respondWithResult(_0x4122fb,null))['catch'](handleError(_0x4122fb,null));};exports[_0x34bd('0xaf')]=function(_0x2ba84a,_0x496bf8,_0x19e584){return db[_0x34bd('0xb0')]['find']({'where':{'id':_0x2ba84a[_0x34bd('0xaa')]['id']}})[_0x34bd('0x26')](handleEntityNotFound(_0x496bf8,null))[_0x34bd('0x26')](function(_0x3fa52b){if(_0x3fa52b){return _0x3fa52b[_0x34bd('0xaf')](_0x2ba84a[_0x34bd('0x2f')][_0x34bd('0xb1')],_[_0x34bd('0xb2')](_0x2ba84a['body'],['ids','id'])||{});}})[_0x34bd('0x26')](respondWithResult(_0x496bf8,null))[_0x34bd('0xa8')](handleError(_0x496bf8,null));};exports[_0x34bd('0xb3')]=function(_0x2d2d06,_0x1cdc3a,_0x585910){var _0x14abe1={'raw':![],'where':{}};var _0x58a162={};var _0x2659ec={'count':0x0,'rows':[]};return db[_0x34bd('0x3b')][_0x34bd('0xb4')]({'where':{'id':_0x2d2d06[_0x34bd('0xaa')]['id']}})[_0x34bd('0x26')](handleEntityNotFound(_0x1cdc3a,null))[_0x34bd('0x26')](function(_0x5be4d3){if(_0x5be4d3){_0x58a162['model']=_[_0x34bd('0x40')](db[_0x34bd('0xb0')][_0x34bd('0x3c')]);_0x58a162[_0x34bd('0x3f')]=_['keys'](_0x2d2d06[_0x34bd('0x3f')]);_0x58a162[_0x34bd('0x41')]=_[_0x34bd('0x43')](_0x58a162[_0x34bd('0x3e')],_0x58a162[_0x34bd('0x3f')]);_0x14abe1[_0x34bd('0x42')]=_[_0x34bd('0x43')](_0x58a162['model'],qs['fields'](_0x2d2d06[_0x34bd('0x3f')]['fields']));_0x14abe1[_0x34bd('0x42')]=_0x14abe1[_0x34bd('0x42')]['length']?_0x14abe1[_0x34bd('0x42')]:_0x58a162[_0x34bd('0x3e')];if(!_0x2d2d06['query'][_0x34bd('0x46')](_0x34bd('0x47'))){_0x14abe1['limit']=qs['limit'](_0x2d2d06[_0x34bd('0x3f')]['limit']);_0x14abe1[_0x34bd('0x21')]=qs[_0x34bd('0x21')](_0x2d2d06[_0x34bd('0x3f')][_0x34bd('0x21')]);}_0x14abe1[_0x34bd('0x48')]=qs[_0x34bd('0x49')](_0x2d2d06[_0x34bd('0x3f')][_0x34bd('0x49')]);_0x14abe1[_0x34bd('0x4a')]=qs[_0x34bd('0x41')](_['pick'](_0x2d2d06[_0x34bd('0x3f')],_0x58a162[_0x34bd('0x41')]));_0x14abe1['where'][_0x34bd('0xa6')]=_0x5be4d3['id'];if(_0x2d2d06[_0x34bd('0x3f')][_0x34bd('0x80')]){_0x14abe1['where']=_[_0x34bd('0x2e')](_0x14abe1[_0x34bd('0x4a')],{'$or':_['map'](_0x14abe1[_0x34bd('0x42')],function(_0x443af3){var _0x12ac03={};_0x12ac03[_0x443af3]={'$like':'%'+_0x2d2d06[_0x34bd('0x3f')]['filter']+'%'};return _0x12ac03;})});}if(_0x2d2d06[_0x34bd('0x3f')][_0x34bd('0x78')]){var _0x1d7da8=_0x2d2d06[_0x34bd('0x3f')][_0x34bd('0x78')]['split'](',');var _0x554253={};_0x554253[_0x1d7da8[0x0]]={'$gte':moment(_0x1d7da8[0x1])[_0x34bd('0xb5')](_0x34bd('0xb6'))};_0x14abe1[_0x34bd('0x4a')]=_[_0x34bd('0x2e')](_0x14abe1[_0x34bd('0x4a')],_0x554253);}_0x14abe1=_['merge']({},_0x14abe1,_0x2d2d06['options']);return db[_0x34bd('0xb0')][_0x34bd('0x20')]({'where':_0x14abe1[_0x34bd('0x4a')]})[_0x34bd('0x26')](function(_0x844977){_0x2659ec[_0x34bd('0x20')]=_0x844977;if(_0x2d2d06[_0x34bd('0x3f')][_0x34bd('0xab')]){_0x14abe1[_0x34bd('0xb7')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x34bd('0xb8')](_0x14abe1);})[_0x34bd('0x26')](function(_0x55ae22){_0x2659ec[_0x34bd('0xb9')]=_0x55ae22;return _0x2659ec;});}})[_0x34bd('0x26')](respondWithFilteredResult(_0x1cdc3a,_0x14abe1))[_0x34bd('0xa8')](handleError(_0x1cdc3a,null));};exports[_0x34bd('0xba')]=function(_0x4f9b3e,_0x3c40f2,_0x223165){return db['WhatsappInteraction'][_0x34bd('0x60')]({'where':{'id':_0x4f9b3e['params']['id']}})[_0x34bd('0x26')](handleEntityNotFound(_0x3c40f2,null))[_0x34bd('0x26')](function(_0x571612){if(_0x571612){return _0x571612[_0x34bd('0xbb')](_0x4f9b3e[_0x34bd('0x2f')]['ids'],_[_0x34bd('0xb2')](_0x4f9b3e[_0x34bd('0x2f')],[_0x34bd('0xb1'),'id'])||{})['spread'](function(){return db[_0x34bd('0x6e')][_0x34bd('0xb8')]({'attributes':['id',_0x34bd('0x2b'),_0x34bd('0x4d')],'where':{'id':_0x4f9b3e[_0x34bd('0x2f')][_0x34bd('0xb1')]}});})[_0x34bd('0x26')](function(_0x35364b){socket[_0x34bd('0xbc')](_0x34bd('0xbd'),{'id':Number(_0x4f9b3e['params']['id']),'tags':_0x35364b||[]});return{'id':Number(_0x4f9b3e['params']['id']),'tags':_0x35364b||[]};});}})[_0x34bd('0x26')](respondWithResult(_0x3c40f2,null))[_0x34bd('0xa8')](handleError(_0x3c40f2,null));};exports[_0x34bd('0xbe')]=function(_0x2edca4,_0x321218,_0x321cde){return db['WhatsappInteraction'][_0x34bd('0x60')]({'where':{'id':_0x2edca4[_0x34bd('0xaa')]['id']}})['then'](handleEntityNotFound(_0x321218,null))[_0x34bd('0x26')](function(_0x44d525){if(_0x44d525){return _0x44d525[_0x34bd('0xbe')](_0x2edca4[_0x34bd('0x3f')][_0x34bd('0xb1')]);}})[_0x34bd('0x26')](respondWithStatusCode(_0x321218,null))[_0x34bd('0xa8')](handleError(_0x321218,null));};exports[_0x34bd('0xbf')]=function(_0x393688,_0x15a4a4){var _0x1d957b=moment()['unix']()[_0x34bd('0x92')]();var _0x2a6106=path[_0x34bd('0xc0')](config[_0x34bd('0xc1')],_0x34bd('0xc2'),'files',_0x34bd('0xc3'));var _0x5ab1fc=path[_0x34bd('0xc0')](config[_0x34bd('0xc1')],_0x34bd('0xc2'),_0x34bd('0xc4'),_0x34bd('0xc5'));var _0x463cc8=path[_0x34bd('0xc0')](_0x2a6106,_0x1d957b);var _0x1445be=util[_0x34bd('0xb5')]('transcript-%d-%s.zip',_0x393688[_0x34bd('0xaa')]['id'],_0x1d957b);var _0x3abd21=path['join'](_0x2a6106,_0x1445be);var _0xcdc6a8=[];_0xcdc6a8[_0x34bd('0x39')]({'model':db[_0x34bd('0xc6')],'as':_0x34bd('0xc6'),'attributes':['id',_0x34bd('0x35')],'raw':!![]});_0xcdc6a8[_0x34bd('0x39')]({'model':db['CmContact'],'as':_0x34bd('0x65'),'attributes':['id',_0x34bd('0xc7'),_0x34bd('0xc8')],'raw':!![]});if(_0x393688[_0x34bd('0x3f')][_0x34bd('0xc5')]){_0xcdc6a8[_0x34bd('0x39')]({'model':db[_0x34bd('0xc9')],'as':_0x34bd('0xc9'),'raw':!![]});}var _0x2c42b2=[{'model':db[_0x34bd('0xb0')],'as':_0x34bd('0xca'),'attributes':['id',_0x34bd('0x2f'),_0x34bd('0xcb'),'direction',_0x34bd('0xcc'),_0x34bd('0x7c')],'include':_0xcdc6a8}];_0x2c42b2[_0x34bd('0x39')]({'model':db[_0x34bd('0xcd')],'as':'Account','attributes':['id',_0x34bd('0x2b')]});_0x2c42b2[_0x34bd('0x39')]({'model':db[_0x34bd('0xc6')],'as':_0x34bd('0xce'),'attributes':['id','fullname']});return db[_0x34bd('0x3b')][_0x34bd('0x60')]({'where':{'id':_0x393688[_0x34bd('0xaa')]['id']},'include':_0x2c42b2})[_0x34bd('0x26')](handleEntityNotFound(_0x15a4a4,null))[_0x34bd('0x26')](function(_0x34467d){if(_0x34467d){var _0x4668bd=_0x34467d[_0x34bd('0xcf')]({'plain':!![]});fs[_0x34bd('0xd0')](_0x463cc8);var _0x9a9f98={'channel':'Whatsapp','account':_0x4668bd[_0x34bd('0xd1')][_0x34bd('0x2b')],'agent':_0x4668bd[_0x34bd('0xce')]?_0x4668bd['Owner'][_0x34bd('0x35')]:_0x34bd('0xd2'),'createdAt':moment(_0x4668bd['createdAt'])[_0x34bd('0xb5')](_0x34bd('0xb6'))[_0x34bd('0x92')](),'closedAt':_0x4668bd[_0x34bd('0xd3')]?moment(_0x4668bd[_0x34bd('0xd4')])[_0x34bd('0xb5')](_0x34bd('0xb6'))[_0x34bd('0x92')]():'','disposition':_0x4668bd[_0x34bd('0xd5')],'messages':_(_0x4668bd['Messages'])[_0x34bd('0x80')]({'secret':![]})['map'](function(_0x1af0d7){if(_0x1af0d7[_0x34bd('0xc9')]){var _0x44e0f8=path[_0x34bd('0xc0')](_0x5ab1fc,_0x1af0d7[_0x34bd('0xc9')][_0x34bd('0xd6')]);if(fs[_0x34bd('0xd7')](_0x44e0f8)){fs['createReadStream'](_0x44e0f8)['pipe'](fs['createWriteStream'](path[_0x34bd('0xc0')](_0x463cc8,_0x1af0d7[_0x34bd('0xc9')][_0x34bd('0xd6')])));}}return{'date':moment(_0x1af0d7[_0x34bd('0xcb')])['format'](_0x34bd('0xb6'))[_0x34bd('0x92')](),'sender':_0x1af0d7[_0x34bd('0xd8')]===_0x34bd('0xd9')?_0x1af0d7[_0x34bd('0xc6')]?_0x1af0d7[_0x34bd('0xc6')][_0x34bd('0x35')]:_0x34bd('0xda'):_0x1af0d7['Contact']['firstName']+(_0x1af0d7[_0x34bd('0x65')][_0x34bd('0xc8')]?'\x20'+_0x1af0d7[_0x34bd('0x65')][_0x34bd('0xc8')]:''),'body':_0x1af0d7[_0x34bd('0xc9')]?_0x1af0d7[_0x34bd('0xc9')][_0x34bd('0xd6')]:_0x1af0d7[_0x34bd('0x2f')],'direction':_0x1af0d7[_0x34bd('0xd8')]==='out'?'A':'C','secret':_0x1af0d7[_0x34bd('0xcc')],'read':_0x1af0d7[_0x34bd('0x7c')],'attachment':_0x1af0d7[_0x34bd('0xc9')]};})[_0x34bd('0x62')]()};return ejs[_0x34bd('0xdb')](path[_0x34bd('0xc0')](config['root'],_0x34bd('0xc2'),_0x34bd('0xdc'),_0x34bd('0xdd')),{'interaction':_0x9a9f98})['then'](function(_0x3a6e19){var _0x4c7fad=path[_0x34bd('0xc0')](_0x463cc8,_0x34bd('0xde')+_0x4668bd['id']+'-'+_0x1d957b+_0x34bd('0xdf'));var _0x4dfed3={'path':_0x4c7fad,'channel':_0x34bd('0xe0'),'interactionId':_0x4668bd['id']};return pdf[_0x34bd('0xe1')](_0x3a6e19,_0x4dfed3);})[_0x34bd('0x26')](function(){return new BPromise(function(_0x12f210,_0x460bbe){zipdir(_0x463cc8,{'saveTo':_0x3abd21},function(_0x1847f9,_0x31da2b){if(_0x1847f9)return _0x460bbe(_0x1847f9);return _0x12f210(_0x31da2b);});})[_0x34bd('0x26')](function(){return new BPromise(function(_0x266d33,_0x583c91){rimraf(_0x463cc8,function(_0x3aecec){if(_0x3aecec)_0x583c91(_0x3aecec);return _0x266d33();});});})[_0x34bd('0x26')](function(){return _0x15a4a4[_0x34bd('0xbf')](_0x3abd21,_0x1445be,function(_0x3fd142){if(_0x3fd142){console[_0x34bd('0xe2')](_0x34bd('0xe3'),_0x3fd142);}else{fs['unlinkSync'](_0x3abd21);}});});});}else{return _0x15a4a4['sendStatus'](0xc8);}})['catch'](handleError(_0x15a4a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 3b61c6b..2131bad 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 _0xbc09=['findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map'];(function(_0x10fb76,_0x4346b2){var _0xc6453f=function(_0xd2f815){while(--_0xd2f815){_0x10fb76['push'](_0x10fb76['shift']());}};_0xc6453f(++_0x4346b2);}(_0xbc09,0x103));var _0x9bc0=function(_0x7c7c1a,_0x204d66){_0x7c7c1a=_0x7c7c1a-0x0;var _0x33ab44=_0xbc09[_0x7c7c1a];return _0x33ab44;};'use strict';var EventEmitter=require(_0x9bc0('0x0'));var WhatsappInteraction=require(_0x9bc0('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x9bc0('0x1'))['db'][_0x9bc0('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9bc0('0x3')](0x0);var events={'afterCreate':_0x9bc0('0x4'),'afterUpdate':_0x9bc0('0x5'),'afterDestroy':_0x9bc0('0x6')};function emitEvent(_0x47143b){return function(_0x3679e6,_0x5ccc9b,_0x3fb72e){_0x3679e6['getUsers']({'attributes':['id'],'raw':!![]})[_0x9bc0('0x7')](function(_0xc4f0c0){_0x3679e6[_0x9bc0('0x8')](_0x9bc0('0x9'),_0xc4f0c0[_0x9bc0('0xa')](function(_0x1a81e1){return{'id':_0x1a81e1['id']};}));return WhatsappMessage[_0x9bc0('0xb')]({'where':{'WhatsappInteractionId':_0x3679e6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x13fd90){_0x3679e6[_0x9bc0('0x8')]('unreadMessages',_0x13fd90[_0x9bc0('0xc')]);WhatsappInteractionEvents[_0x9bc0('0xd')](_0x47143b+':'+_0x3679e6['id'],_0x3679e6);WhatsappInteractionEvents[_0x9bc0('0xd')](_0x47143b,_0x3679e6);_0x3fb72e(null);})[_0x9bc0('0xe')](_0x3fb72e(null));};}for(var e in events){if(events[_0x9bc0('0xf')](e)){var event=events[e];WhatsappInteraction[_0x9bc0('0x10')](e,emitEvent(event));}}module[_0x9bc0('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x0fbd=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x1d6e15,_0x321938){var _0x2b188b=function(_0x5d5734){while(--_0x5d5734){_0x1d6e15['push'](_0x1d6e15['shift']());}};_0x2b188b(++_0x321938);}(_0x0fbd,0x1b9));var _0xd0fb=function(_0x4adf49,_0x1511f9){_0x4adf49=_0x4adf49-0x0;var _0x57ef33=_0x0fbd[_0x4adf49];return _0x57ef33;};'use strict';var EventEmitter=require(_0xd0fb('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xd0fb('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xd0fb('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd0fb('0x3')](0x0);var events={'afterCreate':_0xd0fb('0x4'),'afterUpdate':'update','afterDestroy':_0xd0fb('0x5')};function emitEvent(_0x5a02c6){return function(_0x3bede4,_0xce3260,_0x59cd91){_0x3bede4[_0xd0fb('0x6')]({'attributes':['id'],'raw':!![]})[_0xd0fb('0x7')](function(_0x2a2510){_0x3bede4[_0xd0fb('0x8')]('Users',_0x2a2510['map'](function(_0x614226){return{'id':_0x614226['id']};}));return WhatsappMessage[_0xd0fb('0x9')]({'where':{'WhatsappInteractionId':_0x3bede4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd0fb('0x7')](function(_0x10a723){_0x3bede4[_0xd0fb('0x8')](_0xd0fb('0xa'),_0x10a723[_0xd0fb('0xb')]);WhatsappInteractionEvents[_0xd0fb('0xc')](_0x5a02c6+':'+_0x3bede4['id'],_0x3bede4);WhatsappInteractionEvents[_0xd0fb('0xc')](_0x5a02c6,_0x3bede4);_0x59cd91(null);})[_0xd0fb('0xd')](_0x59cd91(null));};}for(var e in events){if(events[_0xd0fb('0xe')](e)){var event=events[e];WhatsappInteraction[_0xd0fb('0xf')](e,emitEvent(event));}}module[_0xd0fb('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 610f646..f8db781 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 _0xc022=['format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','changed','closed','closedAt'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc022,0x144));var _0x2c02=function(_0x478e2f,_0xcc2041){_0x478e2f=_0x478e2f-0x0;var _0x4b088d=_0xc022[_0x478e2f];return _0x4b088d;};'use strict';var _=require('lodash');var util=require(_0x2c02('0x0'));var logger=require(_0x2c02('0x1'))(_0x2c02('0x2'));var moment=require('moment');var BPromise=require(_0x2c02('0x3'));var rp=require(_0x2c02('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c02('0x5'));var config=require(_0x2c02('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0x2c02('0x7')]=function(_0x42923f,_0x3a3b63){return _0x42923f[_0x2c02('0x8')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x44cf55,_0x5836d5,_0x34dcf5){if(_0x44cf55[_0x2c02('0x9')](_0x2c02('0xa'))){_0x44cf55[_0x2c02('0xb')]=moment()[_0x2c02('0xc')](_0x2c02('0xd'));}_0x34dcf5(null,_0x44cf55);}}});}; \ No newline at end of file +var _0x36c1=['changed','closedAt','format','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x5710c7,_0x2a22d0){var _0x232cd6=function(_0x42c64f){while(--_0x42c64f){_0x5710c7['push'](_0x5710c7['shift']());}};_0x232cd6(++_0x2a22d0);}(_0x36c1,0x161));var _0x136c=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x36c1[_0x24a654];return _0x458651;};'use strict';var _=require(_0x136c('0x0'));var util=require(_0x136c('0x1'));var logger=require(_0x136c('0x2'))('api');var moment=require(_0x136c('0x3'));var BPromise=require(_0x136c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x136c('0x5'));var config=require(_0x136c('0x6'));var attributes=require(_0x136c('0x7'));module[_0x136c('0x8')]=function(_0x34f2e9,_0x5a1682){return _0x34f2e9[_0x136c('0x9')](_0x136c('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3cf26a,_0x48e332,_0xcc24d4){if(_0x3cf26a[_0x136c('0xb')]('closed')){_0x3cf26a[_0x136c('0xc')]=moment()[_0x136c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0xcc24d4(null,_0x3cf26a);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index f5df984..0b8f172 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 _0x213e=['request\x20sent','stringify','error','message','info','result','UpdateWhatsappInteraction','update','body','options','where','attributes','limit','catch','WhatsappInteraction','find','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2fd719,_0xa1c429){var _0x3fcc83=function(_0x8e31fa){while(--_0x8e31fa){_0x2fd719['push'](_0x2fd719['shift']());}};_0x3fcc83(++_0xa1c429);}(_0x213e,0xb1));var _0xe213=function(_0x12206c,_0x31d17a){_0x12206c=_0x12206c-0x0;var _0x435890=_0x213e[_0x12206c];return _0x435890;};'use strict';var _=require(_0xe213('0x0'));var util=require(_0xe213('0x1'));var moment=require(_0xe213('0x2'));var BPromise=require(_0xe213('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe213('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe213('0x5'))(_0xe213('0x6'));var config=require(_0xe213('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe213('0x8')]['http']({'port':0x232a});config['redis']=_[_0xe213('0x9')](config[_0xe213('0xa')],{'host':_0xe213('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe213('0xa')]));require(_0xe213('0xc'))[_0xe213('0xd')](socket);function respondWithRpcPromise(_0x3ec721,_0x1f44d5,_0x47a29a){return new BPromise(function(_0x79d3f9,_0x297d51){return client[_0xe213('0xe')](_0x3ec721,_0x47a29a)[_0xe213('0xf')](function(_0x4884ad){logger['info'](_0xe213('0x10'),_0x1f44d5,'request\x20sent');logger['debug'](_0xe213('0x11'),_0x1f44d5,_0xe213('0x12'),JSON[_0xe213('0x13')](_0x4884ad));if(_0x4884ad[_0xe213('0x14')]){if(_0x4884ad[_0xe213('0x14')]['code']===0x1f4){logger[_0xe213('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x1f44d5,_0x4884ad[_0xe213('0x14')]['message']);return _0x297d51(_0x4884ad['error'][_0xe213('0x15')]);}logger[_0xe213('0x14')](_0xe213('0x10'),_0x1f44d5,_0x4884ad[_0xe213('0x14')][_0xe213('0x15')]);return _0x79d3f9(_0x4884ad['error']['message']);}else{logger[_0xe213('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x1f44d5,_0xe213('0x12'));_0x79d3f9(_0x4884ad[_0xe213('0x17')][_0xe213('0x15')]);}})['catch'](function(_0xd99319){logger[_0xe213('0x14')](_0xe213('0x10'),_0x1f44d5,_0xd99319);_0x297d51(_0xd99319);});});}exports[_0xe213('0x18')]=function(_0x156319){var _0x458c5a=this;return new Promise(function(_0xe55f7a,_0x1a3d97){return db['WhatsappInteraction'][_0xe213('0x19')](_0x156319[_0xe213('0x1a')],{'raw':_0x156319[_0xe213('0x1b')]?_0x156319[_0xe213('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x156319['options']?_0x156319[_0xe213('0x1b')][_0xe213('0x1c')]||null:null,'attributes':_0x156319[_0xe213('0x1b')]?_0x156319['options'][_0xe213('0x1d')]||null:null,'limit':_0x156319[_0xe213('0x1b')]?_0x156319[_0xe213('0x1b')][_0xe213('0x1e')]||null:null})[_0xe213('0xf')](function(_0x4c6b2b){logger[_0xe213('0x16')]('UpdateWhatsappInteraction',_0x156319);logger['debug'](_0xe213('0x18'),_0x156319,JSON[_0xe213('0x13')](_0x4c6b2b));_0xe55f7a(_0x4c6b2b);})[_0xe213('0x1f')](function(_0x58944d){logger['error']('UpdateWhatsappInteraction',_0x58944d[_0xe213('0x15')],_0x156319);_0x1a3d97(_0x458c5a['error'](0x1f4,_0x58944d[_0xe213('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x11d272){return new Promise(function(_0x28ebd5,_0x431e88){return db[_0xe213('0x20')][_0xe213('0x21')]({'where':_0x11d272[_0xe213('0x1b')]?_0x11d272[_0xe213('0x1b')]['where']||null:null})['then'](function(_0x515a4e){if(_0x515a4e){return _0x515a4e['addTags'](_0x11d272[_0xe213('0x1a')][_0xe213('0x22')],_[_0xe213('0x23')](_0x11d272[_0xe213('0x1a')],[_0xe213('0x22'),'id'])||{});}})[_0xe213('0x24')](function(_0x58ec8d){logger[_0xe213('0x16')]('AddTags',_0x11d272);logger[_0xe213('0x25')]('AddTags',_0x11d272,JSON[_0xe213('0x13')](_0x58ec8d));_0x28ebd5(_0x58ec8d);})[_0xe213('0x1f')](function(_0x4e4b33){logger['error'](_0xe213('0x26'),_0x4e4b33['message'],_0x11d272);_0x431e88(_this[_0xe213('0x14')](0x1f4,_0x4e4b33['message']));});});}; \ No newline at end of file +var _0xafc8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','then','AddTagsToWhatsappInteraction','find','body','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis'];(function(_0x587fdb,_0x50dd97){var _0x38ae8e=function(_0x3b5385){while(--_0x3b5385){_0x587fdb['push'](_0x587fdb['shift']());}};_0x38ae8e(++_0x50dd97);}(_0xafc8,0x15c));var _0x8afc=function(_0x3a3fd9,_0x421abc){_0x3a3fd9=_0x3a3fd9-0x0;var _0x5deee2=_0xafc8[_0x3a3fd9];return _0x5deee2;};'use strict';var _=require(_0x8afc('0x0'));var util=require(_0x8afc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8afc('0x2'));var fs=require('fs');var Redis=require(_0x8afc('0x3'));var db=require(_0x8afc('0x4'))['db'];var utils=require(_0x8afc('0x5'));var logger=require(_0x8afc('0x6'))(_0x8afc('0x7'));var config=require(_0x8afc('0x8'));var jayson=require(_0x8afc('0x9'));var client=jayson[_0x8afc('0xa')][_0x8afc('0xb')]({'port':0x232a});config[_0x8afc('0xc')]=_[_0x8afc('0xd')](config[_0x8afc('0xc')],{'host':_0x8afc('0xe'),'port':0x18eb});var socket=require(_0x8afc('0xf'))(new Redis(config[_0x8afc('0xc')]));require('./whatsappInteraction.socket')[_0x8afc('0x10')](socket);function respondWithRpcPromise(_0x4678bc,_0x1dd2b8,_0x277033){return new BPromise(function(_0x2f54c4,_0x418b48){return client['request'](_0x4678bc,_0x277033)['then'](function(_0x5e5235){logger['info'](_0x8afc('0x11'),_0x1dd2b8,_0x8afc('0x12'));logger[_0x8afc('0x13')](_0x8afc('0x14'),_0x1dd2b8,_0x8afc('0x12'),JSON[_0x8afc('0x15')](_0x5e5235));if(_0x5e5235['error']){if(_0x5e5235[_0x8afc('0x16')][_0x8afc('0x17')]===0x1f4){logger[_0x8afc('0x16')](_0x8afc('0x11'),_0x1dd2b8,_0x5e5235[_0x8afc('0x16')][_0x8afc('0x18')]);return _0x418b48(_0x5e5235['error'][_0x8afc('0x18')]);}logger[_0x8afc('0x16')](_0x8afc('0x11'),_0x1dd2b8,_0x5e5235[_0x8afc('0x16')][_0x8afc('0x18')]);return _0x2f54c4(_0x5e5235[_0x8afc('0x16')][_0x8afc('0x18')]);}else{logger[_0x8afc('0x19')](_0x8afc('0x11'),_0x1dd2b8,_0x8afc('0x12'));_0x2f54c4(_0x5e5235[_0x8afc('0x1a')]['message']);}})[_0x8afc('0x1b')](function(_0x1ad783){logger[_0x8afc('0x16')](_0x8afc('0x11'),_0x1dd2b8,_0x1ad783);_0x418b48(_0x1ad783);});});}exports[_0x8afc('0x1c')]=function(_0x6b4d4f){var _0x5ceb44=this;return new Promise(function(_0x38dc99,_0x54cbb3){return db[_0x8afc('0x1d')][_0x8afc('0x1e')](_0x6b4d4f['body'],{'raw':_0x6b4d4f[_0x8afc('0x1f')]?_0x6b4d4f[_0x8afc('0x1f')][_0x8afc('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6b4d4f[_0x8afc('0x1f')]?_0x6b4d4f['options'][_0x8afc('0x21')]||null:null,'attributes':_0x6b4d4f[_0x8afc('0x1f')]?_0x6b4d4f[_0x8afc('0x1f')][_0x8afc('0x22')]||null:null,'limit':_0x6b4d4f[_0x8afc('0x1f')]?_0x6b4d4f[_0x8afc('0x1f')][_0x8afc('0x23')]||null:null})[_0x8afc('0x24')](function(_0x1e723b){logger[_0x8afc('0x19')](_0x8afc('0x1c'),_0x6b4d4f);logger[_0x8afc('0x13')](_0x8afc('0x1c'),_0x6b4d4f,JSON['stringify'](_0x1e723b));_0x38dc99(_0x1e723b);})['catch'](function(_0x4ad10d){logger[_0x8afc('0x16')]('UpdateWhatsappInteraction',_0x4ad10d['message'],_0x6b4d4f);_0x54cbb3(_0x5ceb44[_0x8afc('0x16')](0x1f4,_0x4ad10d[_0x8afc('0x18')]));});});};exports[_0x8afc('0x25')]=function(_0x3fa71c){return new Promise(function(_0xaa1051,_0x5e908d){return db[_0x8afc('0x1d')][_0x8afc('0x26')]({'where':_0x3fa71c['options']?_0x3fa71c[_0x8afc('0x1f')]['where']||null:null})[_0x8afc('0x24')](function(_0x2e576a){if(_0x2e576a){return _0x2e576a['addTags'](_0x3fa71c[_0x8afc('0x27')][_0x8afc('0x28')],_[_0x8afc('0x29')](_0x3fa71c['body'],[_0x8afc('0x28'),'id'])||{});}})[_0x8afc('0x2a')](function(_0xc96f2){logger['info'](_0x8afc('0x2b'),_0x3fa71c);logger[_0x8afc('0x13')](_0x8afc('0x2b'),_0x3fa71c,JSON[_0x8afc('0x15')](_0xc96f2));_0xaa1051(_0xc96f2);})['catch'](function(_0x5b9094){logger[_0x8afc('0x16')]('AddTags',_0x5b9094[_0x8afc('0x18')],_0x3fa71c);_0x5e908d(_this['error'](0x1f4,_0x5b9094[_0x8afc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index a2d94b4..7a82c6c 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 _0x4612=['remove','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x4612,0xa9));var _0x2461=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4612[_0x19e35c];return _0x3e1fe8;};'use strict';var WhatsappInteractionEvents=require(_0x2461('0x0'));var events=[_0x2461('0x1'),_0x2461('0x2'),_0x2461('0x3')];function createListener(_0x3d1027,_0x10c55a){return function(_0x26a299){_0x10c55a[_0x2461('0x4')](_0x3d1027,_0x26a299);};}function removeListener(_0x4a1774,_0x469983){return function(){WhatsappInteractionEvents[_0x2461('0x5')](_0x4a1774,_0x469983);};}exports[_0x2461('0x6')]=function(_0x1c6bd2){for(var _0x348ea5=0x0,_0x256df8=events[_0x2461('0x7')];_0x348ea5<_0x256df8;_0x348ea5++){var _0x1b9fd9=events[_0x348ea5];var _0x49bca3=createListener(_0x2461('0x8')+_0x1b9fd9,_0x1c6bd2);WhatsappInteractionEvents['on'](_0x1b9fd9,_0x49bca3);}}; \ No newline at end of file +var _0x7fd2=['removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','emit'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x7fd2,0x154));var _0x27fd=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x7fd2[_0x42bc91];return _0x3f5507;};'use strict';var WhatsappInteractionEvents=require(_0x27fd('0x0'));var events=['save','remove','update'];function createListener(_0x114c1a,_0x8d4b59){return function(_0xbc9617){_0x8d4b59[_0x27fd('0x1')](_0x114c1a,_0xbc9617);};}function removeListener(_0x4d258d,_0x15da6b){return function(){WhatsappInteractionEvents[_0x27fd('0x2')](_0x4d258d,_0x15da6b);};}exports[_0x27fd('0x3')]=function(_0x1dbd90){for(var _0x4e5256=0x0,_0x38931f=events[_0x27fd('0x4')];_0x4e5256<_0x38931f;_0x4e5256++){var _0x1f3d28=events[_0x4e5256];var _0x1c5479=createListener(_0x27fd('0x5')+_0x1f3d28,_0x1dbd90);WhatsappInteractionEvents['on'](_0x1f3d28,_0x1c5479);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 56fd1ff..496e8bd 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 _0xb138=['./whatsappMessage.controller','isAuthenticated','index','/describe','describe','/:id','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1d3ff5,_0x56e923){var _0x208da5=function(_0x58dcdc){while(--_0x58dcdc){_0x1d3ff5['push'](_0x1d3ff5['shift']());}};_0x208da5(++_0x56e923);}(_0xb138,0x1dd));var _0x8b13=function(_0x4c1ae0,_0x4189e7){_0x4c1ae0=_0x4c1ae0-0x0;var _0x3ddda3=_0xb138[_0x4c1ae0];return _0x3ddda3;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['get'](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['show']);router['post']('/',auth[_0x8b13('0xa')](),interaction[_0x8b13('0xf')](_0x8b13('0x10'),_0x8b13('0x11')),controller[_0x8b13('0x12')]);router['post'](_0x8b13('0x13'),controller[_0x8b13('0x14')]);router[_0x8b13('0x15')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x16')]);router['put']('/:id/accept',auth[_0x8b13('0xa')](),controller[_0x8b13('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x8b13('0x18')]);router[_0x8b13('0x19')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x008c=['reject','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','show','post','whatsappmessage:create','create','/:id/status','status','put','/:id','update','accept','/:id/reject'];(function(_0x5ac3f6,_0x40570f){var _0x50fef8=function(_0xec8d54){while(--_0xec8d54){_0x5ac3f6['push'](_0x5ac3f6['shift']());}};_0x50fef8(++_0x40570f);}(_0x008c,0x188));var _0xc008=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x008c[_0x1cb18a];return _0x22442e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xe')]('/',auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xc008('0xf')),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0x14'),auth[_0xc008('0xb')](),controller[_0xc008('0x15')]);router[_0xc008('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xc008('0x16')]);router['put'](_0xc008('0x17'),auth[_0xc008('0xb')](),controller[_0xc008('0x18')]);router[_0xc008('0x19')](_0xc008('0x14'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3b10117..4d7bf18 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 _0x0a18=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x2538bc,_0x35ced2){var _0x3287e3=function(_0x190b44){while(--_0x190b44){_0x2538bc['push'](_0x2538bc['shift']());}};_0x3287e3(++_0x35ced2);}(_0x0a18,0x100));var _0x80a1=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x0a18[_0x4ed520];return _0x4415a6;};'use strict';var Sequelize=require(_0x80a1('0x0'));module[_0x80a1('0x1')]={'body':{'type':Sequelize[_0x80a1('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x80a1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x80a1('0x4')]('in','out'),'defaultValue':_0x80a1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x80a1('0x6')](0xbe)},'phone':{'type':Sequelize[_0x80a1('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x80a1('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x80a1('0x6')]},'providerResponse':{'type':Sequelize[_0x80a1('0x2')]}}; \ No newline at end of file +var _0x4cdd=['ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x14ac41,_0x3f5e86){var _0x55dc94=function(_0x4489e6){while(--_0x4489e6){_0x14ac41['push'](_0x14ac41['shift']());}};_0x55dc94(++_0x3f5e86);}(_0x4cdd,0x10a));var _0xd4cd=function(_0x81a262,_0x24d7f4){_0x81a262=_0x81a262-0x0;var _0x23ff08=_0x4cdd[_0x81a262];return _0x23ff08;};'use strict';var Sequelize=require(_0xd4cd('0x0'));module[_0xd4cd('0x1')]={'body':{'type':Sequelize[_0xd4cd('0x2')](_0xd4cd('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd4cd('0x4')]('in','out'),'defaultValue':_0xd4cd('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd4cd('0x6')](0xbe)},'phone':{'type':Sequelize[_0xd4cd('0x6')]},'readAt':{'type':Sequelize[_0xd4cd('0x7')]},'secret':{'type':Sequelize[_0xd4cd('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd4cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ad670a3..1d09f6d 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 _0x20c8=['message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','merge','body','contact','agent','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','create','find','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','SIP/%s','channel','EventManager','RejectMessage','rejectMessage','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x20c8,0xd2));var _0x820c=function(_0x19121f,_0x26bf39){_0x19121f=_0x19121f-0x0;var _0x3c9880=_0x20c8[_0x19121f];return _0x3c9880;};'use strict';var emlformat=require(_0x820c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x820c('0x1'));var jsonpatch=require(_0x820c('0x2'));var rp=require(_0x820c('0x3'));var moment=require('moment');var BPromise=require(_0x820c('0x4'));var Mustache=require('mustache');var util=require(_0x820c('0x5'));var path=require(_0x820c('0x6'));var sox=require('sox');var csv=require(_0x820c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x820c('0x8'));var _=require(_0x820c('0x9'));var squel=require('squel');var crypto=require(_0x820c('0xa'));var jsforce=require(_0x820c('0xb'));var deskjs=require(_0x820c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x820c('0xd'));var Papa=require(_0x820c('0xe'));var Redis=require(_0x820c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x820c('0x10'));var as=require(_0x820c('0x11'));var hardwareService=require(_0x820c('0x12'));var logger=require('../../config/logger')(_0x820c('0x13'));var utils=require('../../config/utils');var config=require(_0x820c('0x14'));var licenseUtil=require(_0x820c('0x15'));var db=require(_0x820c('0x16'))['db'];config[_0x820c('0x17')]=_[_0x820c('0x18')](config['redis'],{'host':_0x820c('0x19'),'port':0x18eb});var socket=require(_0x820c('0x1a'))(new Redis(config[_0x820c('0x17')]));require('./whatsappMessage.socket')[_0x820c('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x820c('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x820c('0x1c')][_0x820c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x149670,_0x2911db,_0x4346d4,_0x593cef){return new BPromise(function(_0x35edfe,_0x4735fb){var _0x47826d=_0x593cef||client;return _0x47826d[_0x820c('0x1e')](_0x149670,_0x4346d4)[_0x820c('0x1f')](function(_0x2645ac){logger[_0x820c('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x2911db,_0x820c('0x21'));logger[_0x820c('0x22')](_0x820c('0x23'),_0x2911db,_0x820c('0x21'),JSON[_0x820c('0x24')](_0x2645ac));if(_0x2645ac['error']){if(_0x2645ac[_0x820c('0x25')][_0x820c('0x26')]===0x1f4){logger[_0x820c('0x25')](_0x820c('0x27'),_0x2911db,_0x2645ac[_0x820c('0x25')][_0x820c('0x28')]);return _0x4735fb(_0x2645ac['error'][_0x820c('0x28')]);}logger[_0x820c('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x2911db,_0x2645ac[_0x820c('0x25')][_0x820c('0x28')]);return _0x35edfe(_0x2645ac['error'][_0x820c('0x28')]);}else{logger[_0x820c('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x2911db,'request\x20sent');_0x35edfe(_0x2645ac[_0x820c('0x29')][_0x820c('0x28')]);}})[_0x820c('0x2a')](function(_0x273b82){logger[_0x820c('0x25')](_0x820c('0x27'),_0x2911db,_0x273b82);_0x4735fb(_0x273b82);});});}function respondWithStatusCode(_0x18fc59,_0xbdbe0f){_0xbdbe0f=_0xbdbe0f||0xcc;return function(_0x3cbb2c){if(_0x3cbb2c){return _0x18fc59[_0x820c('0x2b')](_0xbdbe0f);}return _0x18fc59[_0x820c('0x2c')](_0xbdbe0f)[_0x820c('0x2d')]();};}function respondWithResult(_0x5f48da,_0x58de50){_0x58de50=_0x58de50||0xc8;return function(_0x15c2a8){if(_0x15c2a8){return _0x5f48da[_0x820c('0x2c')](_0x58de50)['json'](_0x15c2a8);}};}function respondWithFilteredResult(_0x5ced49,_0x43a410){return function(_0x8a9b0e){if(_0x8a9b0e){var _0x29f4aa=typeof _0x43a410[_0x820c('0x2e')]===_0x820c('0x2f')&&typeof _0x43a410[_0x820c('0x30')]==='undefined';var _0x365246=_0x8a9b0e[_0x820c('0x31')];var _0x249fee=_0x29f4aa?0x0:_0x43a410[_0x820c('0x2e')];var _0xb3fe1f=_0x29f4aa?_0x8a9b0e[_0x820c('0x31')]:_0x43a410[_0x820c('0x2e')]+_0x43a410[_0x820c('0x30')];var _0x4c4ac3;if(_0xb3fe1f>=_0x365246){_0xb3fe1f=_0x365246;_0x4c4ac3=0xc8;}else{_0x4c4ac3=0xce;}_0x5ced49[_0x820c('0x2c')](_0x4c4ac3);return _0x5ced49[_0x820c('0x32')](_0x820c('0x33'),_0x249fee+'-'+_0xb3fe1f+'/'+_0x365246)['json'](_0x8a9b0e);}return null;};}function patchUpdates(_0x4e8464){return function(_0x162312){try{jsonpatch[_0x820c('0x34')](_0x162312,_0x4e8464,!![]);}catch(_0x180b4d){return BPromise[_0x820c('0x35')](_0x180b4d);}return _0x162312[_0x820c('0x36')]();};}function saveUpdates(_0x4ad59f,_0xa9c29f){return function(_0x572f98){if(_0x572f98){return _0x572f98[_0x820c('0x37')](_0x4ad59f)[_0x820c('0x1f')](function(_0x3b3e82){return _0x3b3e82;});}return null;};}function removeEntity(_0x338c0d,_0x1bfe6c){return function(_0x4d9d91){if(_0x4d9d91){return _0x4d9d91[_0x820c('0x38')]()[_0x820c('0x1f')](function(){_0x338c0d[_0x820c('0x2c')](0xcc)[_0x820c('0x2d')]();});}};}function handleEntityNotFound(_0x3cc91c,_0x4ce33d){return function(_0x464604){if(!_0x464604){_0x3cc91c[_0x820c('0x2b')](0x194);}return _0x464604;};}function handleError(_0x2d92f6,_0x2c59b4){_0x2c59b4=_0x2c59b4||0x1f4;return function(_0x571d35){logger['error'](_0x571d35['stack']);if(_0x571d35[_0x820c('0x39')]){delete _0x571d35[_0x820c('0x39')];}_0x2d92f6['status'](_0x2c59b4)[_0x820c('0x3a')](_0x571d35);};}function getMustacheRender(_0x506d82,_0x32d46b){return Mustache['render'](_0x506d82,_[_0x820c('0x3b')](_0x32d46b[_0x820c('0x3c')],{'contact':_0x32d46b[_0x820c('0x3d')],'message':_0x32d46b[_0x820c('0x28')],'agent':_0x32d46b[_0x820c('0x3e')],'interaction':_0x32d46b['interaction'],'account':_0x32d46b['account']}))||'';}exports[_0x820c('0x3f')]=function(_0xcb876e,_0x10818a){var _0x14729b={},_0x5e1e68={},_0xfa14fd={'count':0x0,'rows':[]};var _0xcf499e=_[_0x820c('0x40')](db[_0x820c('0x41')][_0x820c('0x42')],function(_0xefed5d){return{'name':_0xefed5d[_0x820c('0x43')],'type':_0xefed5d[_0x820c('0x44')]['key']};});_0x5e1e68[_0x820c('0x45')]=_[_0x820c('0x40')](_0xcf499e,_0x820c('0x39'));_0x5e1e68[_0x820c('0x46')]=_[_0x820c('0x47')](_0xcb876e[_0x820c('0x46')]);_0x5e1e68['filters']=_[_0x820c('0x48')](_0x5e1e68[_0x820c('0x45')],_0x5e1e68['query']);_0x14729b[_0x820c('0x49')]=_[_0x820c('0x48')](_0x5e1e68[_0x820c('0x45')],qs[_0x820c('0x4a')](_0xcb876e[_0x820c('0x46')][_0x820c('0x4a')]));_0x14729b['attributes']=_0x14729b[_0x820c('0x49')][_0x820c('0x4b')]?_0x14729b[_0x820c('0x49')]:_0x5e1e68[_0x820c('0x45')];if(!_0xcb876e[_0x820c('0x46')]['hasOwnProperty'](_0x820c('0x4c'))){_0x14729b[_0x820c('0x30')]=qs[_0x820c('0x30')](_0xcb876e[_0x820c('0x46')]['limit']);_0x14729b[_0x820c('0x2e')]=qs['offset'](_0xcb876e[_0x820c('0x46')]['offset']);}_0x14729b['order']=qs['sort'](_0xcb876e['query'][_0x820c('0x4d')]);_0x14729b[_0x820c('0x4e')]=qs[_0x820c('0x4f')](_[_0x820c('0x50')](_0xcb876e['query'],_0x5e1e68[_0x820c('0x4f')]),_0xcf499e);if(_0xcb876e[_0x820c('0x46')][_0x820c('0x51')]){_0x14729b['where']=_[_0x820c('0x3b')](_0x14729b[_0x820c('0x4e')],{'$or':_[_0x820c('0x40')](_0xcf499e,function(_0x3958d8){if(_0x3958d8[_0x820c('0x44')]!==_0x820c('0x52')){var _0x5e724a={};_0x5e724a[_0x3958d8[_0x820c('0x39')]]={'$like':'%'+_0xcb876e[_0x820c('0x46')][_0x820c('0x51')]+'%'};return _0x5e724a;}})});}_0x14729b=_['merge']({},_0x14729b,_0xcb876e[_0x820c('0x53')]);var _0x5d60c3={'where':_0x14729b[_0x820c('0x4e')]};return db[_0x820c('0x41')]['count'](_0x5d60c3)[_0x820c('0x1f')](function(_0x480da0){_0xfa14fd[_0x820c('0x31')]=_0x480da0;if(_0xcb876e[_0x820c('0x46')][_0x820c('0x54')]){_0x14729b['include']=[{'all':!![]}];}return db[_0x820c('0x41')][_0x820c('0x55')](_0x14729b);})[_0x820c('0x1f')](function(_0x14ce6c){_0xfa14fd[_0x820c('0x56')]=_0x14ce6c;return _0xfa14fd;})['then'](respondWithFilteredResult(_0x10818a,_0x14729b))[_0x820c('0x2a')](handleError(_0x10818a,null));};exports[_0x820c('0x57')]=function(_0x2d2f35,_0x38ae35){var _0x2e889d={'raw':!![],'where':{'id':_0x2d2f35[_0x820c('0x58')]['id']}},_0x2ecec1={};_0x2ecec1[_0x820c('0x45')]=_[_0x820c('0x47')](db['WhatsappMessage'][_0x820c('0x42')]);_0x2ecec1[_0x820c('0x46')]=_[_0x820c('0x47')](_0x2d2f35['query']);_0x2ecec1[_0x820c('0x4f')]=_[_0x820c('0x48')](_0x2ecec1[_0x820c('0x45')],_0x2ecec1[_0x820c('0x46')]);_0x2e889d[_0x820c('0x49')]=_[_0x820c('0x48')](_0x2ecec1['model'],qs[_0x820c('0x4a')](_0x2d2f35[_0x820c('0x46')][_0x820c('0x4a')]));_0x2e889d['attributes']=_0x2e889d[_0x820c('0x49')][_0x820c('0x4b')]?_0x2e889d[_0x820c('0x49')]:_0x2ecec1[_0x820c('0x45')];if(_0x2d2f35[_0x820c('0x46')][_0x820c('0x54')]){_0x2e889d['include']=[{'all':!![]}];}_0x2e889d=_[_0x820c('0x3b')]({},_0x2e889d,_0x2d2f35['options']);return db['WhatsappMessage']['find'](_0x2e889d)[_0x820c('0x1f')](handleEntityNotFound(_0x38ae35,null))['then'](respondWithResult(_0x38ae35,null))[_0x820c('0x2a')](handleError(_0x38ae35,null));};exports[_0x820c('0x59')]=function(_0x1e2278,_0x539ae5){return db[_0x820c('0x41')][_0x820c('0x59')](_0x1e2278[_0x820c('0x3c')],{})['then'](respondWithResult(_0x539ae5,0xc9))[_0x820c('0x2a')](handleError(_0x539ae5,null));};exports[_0x820c('0x37')]=function(_0x1d5087,_0x32c336){if(_0x1d5087[_0x820c('0x3c')]['id']){delete _0x1d5087['body']['id'];}return db[_0x820c('0x41')]['find']({'where':{'id':_0x1d5087[_0x820c('0x58')]['id']}})['then'](handleEntityNotFound(_0x32c336,null))['then'](saveUpdates(_0x1d5087[_0x820c('0x3c')],null))[_0x820c('0x1f')](respondWithResult(_0x32c336,null))[_0x820c('0x2a')](handleError(_0x32c336,null));};exports[_0x820c('0x38')]=function(_0xa79a18,_0x465861){return db[_0x820c('0x41')][_0x820c('0x5a')]({'where':{'id':_0xa79a18[_0x820c('0x58')]['id']}})[_0x820c('0x1f')](handleEntityNotFound(_0x465861,null))['then'](removeEntity(_0x465861,null))[_0x820c('0x2a')](handleError(_0x465861,null));};exports['describe']=function(_0x2c4354,_0x32775f){return db[_0x820c('0x41')][_0x820c('0x5b')]()[_0x820c('0x1f')](respondWithResult(_0x32775f,null))['catch'](handleError(_0x32775f,null));};var interaction_log=require(_0x820c('0x5c'))(_0x820c('0x5d'));exports[_0x820c('0x5e')]=function(_0x23391a,_0x15a9c4,_0x1dd2f3){var _0x38e3f2={'agent':{},'channel':_0x820c('0x5f')};if(_0x23391a[_0x820c('0x3c')]['id']){delete _0x23391a[_0x820c('0x3c')]['id'];}_0x23391a[_0x820c('0x3c')][_0x820c('0x60')]=!![];_0x23391a[_0x820c('0x3c')][_0x820c('0x61')]=moment()[_0x820c('0x62')](_0x820c('0x63'));_0x23391a['body'][_0x820c('0x64')]=_0x23391a[_0x820c('0x3c')][_0x820c('0x64')]||_0x23391a[_0x820c('0x65')]['id'];_0x38e3f2[_0x820c('0x3e')]['id']=_0x23391a[_0x820c('0x3c')][_0x820c('0x64')];return db[_0x820c('0x41')][_0x820c('0x5a')]({'where':{'id':_0x23391a[_0x820c('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x820c('0x66')],'as':_0x820c('0x67')}]})[_0x820c('0x1f')](handleEntityNotFound(_0x15a9c4,null))[_0x820c('0x1f')](saveUpdates(_0x23391a[_0x820c('0x3c')],null))[_0x820c('0x1f')](function(_0x4abc6c){if(_0x4abc6c){_0x38e3f2[_0x820c('0x28')]=_0x4abc6c[_0x820c('0x68')]({'plain':!![]});return db[_0x820c('0x69')][_0x820c('0x5a')]({'where':{'id':_0x4abc6c[_0x820c('0x6a')]}});}return null;})[_0x820c('0x1f')](handleEntityNotFound(_0x15a9c4,null))[_0x820c('0x1f')](function(_0x15e778){if(_0x15e778){return _0x15e778[_0x820c('0x37')]({'UserId':_0x23391a['body'][_0x820c('0x64')],'read1stAt':_['isNil'](_0x15e778[_0x820c('0x6b')])?moment()[_0x820c('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x820c('0x1f')](function(_0x359b70){if(_0x359b70){_0x38e3f2[_0x820c('0x6c')]=_0x359b70[_0x820c('0x68')]({'plain':!![]});interaction_log[_0x820c('0x20')](_0x820c('0x6d'),_0x23391a[_0x820c('0x65')]['id'],_0x23391a['user']['name'],_0x23391a[_0x820c('0x65')][_0x820c('0x6e')],_0x38e3f2[_0x820c('0x6c')]['id'],_0x23391a[_0x820c('0x3c')]?JSON[_0x820c('0x24')](_0x23391a['body']):_0x820c('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x38e3f2);}return null;})[_0x820c('0x1f')](function(_0x456d6c){if(_0x456d6c){if(_0x23391a[_0x820c('0x3c')][_0x820c('0x70')]){_0x38e3f2[_0x820c('0x28')]['interface']=util[_0x820c('0x62')](_0x820c('0x71'),_0x23391a[_0x820c('0x65')][_0x820c('0x39')]);_0x38e3f2['message'][_0x820c('0x72')]=_0x38e3f2[_0x820c('0x72')];_0x38e3f2[_0x820c('0x28')]['event']='accept';return respondWithRpcPromise('EventManager',_0x820c('0x73'),{'event':'acceptmessage','message':_0x38e3f2[_0x820c('0x28')]},client9002)['then'](function(){return _0x38e3f2;});}return _0x38e3f2;}return null;})[_0x820c('0x1f')](respondWithResult(_0x15a9c4,null))['catch'](handleError(_0x15a9c4,null));};var interaction_log=require(_0x820c('0x5c'))(_0x820c('0x5d'));exports['reject']=function(_0xfeb57,_0x4e006c,_0xe8b992){var _0x3b9ee6={'agent':{},'channel':_0x820c('0x5f')};if(_0xfeb57[_0x820c('0x3c')]['id']){delete _0xfeb57[_0x820c('0x3c')]['id'];}_0xfeb57[_0x820c('0x3c')][_0x820c('0x64')]=_0xfeb57['body'][_0x820c('0x64')]||_0xfeb57[_0x820c('0x65')]['id'];_0x3b9ee6[_0x820c('0x3e')]['id']=_0xfeb57[_0x820c('0x3c')][_0x820c('0x64')];return db['WhatsappMessage'][_0x820c('0x5a')]({'where':{'id':_0xfeb57[_0x820c('0x58')]['id'],'UserId':null}})[_0x820c('0x1f')](handleEntityNotFound(_0x4e006c,null))[_0x820c('0x1f')](function(_0x216202){if(_0x216202){_0x3b9ee6['message']=_0x216202[_0x820c('0x68')]({'plain':!![]});return db[_0x820c('0x69')][_0x820c('0x5a')]({'where':{'id':_0x216202[_0x820c('0x6a')]}});}return null;})[_0x820c('0x1f')](handleEntityNotFound(_0x4e006c,null))['then'](function(_0xb8b9c0){if(_0xb8b9c0){_0x3b9ee6['interaction']=_0xb8b9c0[_0x820c('0x68')]({'plain':!![]});interaction_log[_0x820c('0x20')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xfeb57[_0x820c('0x65')]['id'],_0xfeb57[_0x820c('0x65')][_0x820c('0x39')],_0xfeb57[_0x820c('0x65')][_0x820c('0x6e')],_0x3b9ee6[_0x820c('0x6c')]['id'],_0xfeb57['body']?JSON[_0x820c('0x24')](_0xfeb57['body']):_0x820c('0x6f'));return respondWithRpcPromise(_0x820c('0x74'),_0x820c('0x75'),_0x3b9ee6);}return null;})['then'](function(_0x1d9a57){if(_0x1d9a57){_0x1d9a57[_0x820c('0x28')]['interface']=util['format'](_0x820c('0x71'),_0xfeb57[_0x820c('0x65')][_0x820c('0x39')]);_0x1d9a57[_0x820c('0x28')][_0x820c('0x72')]=_0x3b9ee6[_0x820c('0x72')];_0x1d9a57['message']['event']=_0x820c('0x35');respondWithRpcPromise(_0x820c('0x73'),_0x820c('0x73'),{'event':'rejectmessage','message':_0x1d9a57['message']},client9002);return _0x3b9ee6;}return null;})['then'](respondWithResult(_0x4e006c,null))['catch'](handleError(_0x4e006c,null));};exports[_0x820c('0x2c')]=function(_0xa2c2e9,_0x248320,_0x1c5e63){if(_0xa2c2e9[_0x820c('0x3c')]['id']){delete _0xa2c2e9[_0x820c('0x3c')]['id'];}var _0x1172d6;return db['WhatsappMessage'][_0x820c('0x5a')]({'where':{'id':_0xa2c2e9[_0x820c('0x58')]['id']}})[_0x820c('0x1f')](handleEntityNotFound(_0x248320,null))[_0x820c('0x1f')](function(_0x18a095){if(_0x18a095){_0x1172d6=_0x18a095;return db[_0x820c('0x76')][_0x820c('0x5a')]({'where':{'id':_0x18a095['WhatsappAccountId']}});}})[_0x820c('0x1f')](handleEntityNotFound(_0x248320,null))['then'](function(_0x47f26c){if(_0x47f26c){logger[_0x820c('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x820c('0x77'),_0x47f26c[_0x820c('0x44')],util[_0x820c('0x78')](_0xa2c2e9['body'],{'showHidden':![],'depth':null}));switch(_0x47f26c['type']){case'twilio':if(_0xa2c2e9[_0x820c('0x3c')]['MessageSid']&&_0xa2c2e9[_0x820c('0x3c')]['MessageSid']===_0x1172d6[_0x820c('0x79')]&&_0xa2c2e9[_0x820c('0x3c')][_0x820c('0x7a')]&&_0xa2c2e9['body']['MessageStatus']===_0x820c('0x60')){return _0x1172d6['update']({'read':!![]});}else{logger[_0x820c('0x25')](_0x820c('0x7b'),_0x820c('0x2c'),_0x820c('0x7c'),util['inspect'](_0xa2c2e9[_0x820c('0x3c')],{'showHidden':![],'depth':null}));}break;}return _0x1172d6;}})[_0x820c('0x1f')](respondWithResult(_0x248320,null))['catch'](handleError(_0x248320,null));}; \ No newline at end of file +var _0x5312=['read1stAt','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','name','send','render','merge','body','contact','interaction','account','WhatsappMessage','rawAttributes','fieldName','type','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','describe','../../config/logger','whatsapp-interactions','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId'];(function(_0x49fc31,_0x237194){var _0x1c074e=function(_0x18788d){while(--_0x18788d){_0x49fc31['push'](_0x49fc31['shift']());}};_0x1c074e(++_0x237194);}(_0x5312,0x126));var _0x2531=function(_0x5261bf,_0x18dec7){_0x5261bf=_0x5261bf-0x0;var _0x4d5ddb=_0x5312[_0x5261bf];return _0x4d5ddb;};'use strict';var emlformat=require(_0x2531('0x0'));var rimraf=require(_0x2531('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2531('0x2'));var rp=require(_0x2531('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2531('0x4'));var util=require(_0x2531('0x5'));var path=require('path');var sox=require(_0x2531('0x6'));var csv=require(_0x2531('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2531('0x8'));var squel=require('squel');var crypto=require(_0x2531('0x9'));var jsforce=require(_0x2531('0xa'));var deskjs=require(_0x2531('0xb'));var toCsv=require(_0x2531('0x7'));var querystring=require(_0x2531('0xc'));var Papa=require('papaparse');var Redis=require(_0x2531('0xd'));var authService=require(_0x2531('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2531('0xf'));var hardwareService=require(_0x2531('0x10'));var logger=require('../../config/logger')(_0x2531('0x11'));var utils=require(_0x2531('0x12'));var config=require(_0x2531('0x13'));var licenseUtil=require(_0x2531('0x14'));var db=require(_0x2531('0x15'))['db'];config['redis']=_[_0x2531('0x16')](config[_0x2531('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2531('0x18'))(new Redis(config[_0x2531('0x17')]));require(_0x2531('0x19'))['register'](socket);var jayson=require(_0x2531('0x1a'));var client=jayson[_0x2531('0x1b')][_0x2531('0x1c')]({'port':0x232c});var client9002=jayson[_0x2531('0x1b')][_0x2531('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17a7cf,_0x15634b,_0x3476d5,_0x176f4b){return new BPromise(function(_0x45d401,_0x2e9653){var _0x29920a=_0x176f4b||client;return _0x29920a[_0x2531('0x1d')](_0x17a7cf,_0x3476d5)[_0x2531('0x1e')](function(_0x332d3c){logger['info'](_0x2531('0x1f'),_0x15634b,_0x2531('0x20'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x15634b,'request\x20sent',JSON[_0x2531('0x21')](_0x332d3c));if(_0x332d3c[_0x2531('0x22')]){if(_0x332d3c[_0x2531('0x22')][_0x2531('0x23')]===0x1f4){logger[_0x2531('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x15634b,_0x332d3c[_0x2531('0x22')]['message']);return _0x2e9653(_0x332d3c['error']['message']);}logger[_0x2531('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x15634b,_0x332d3c['error'][_0x2531('0x24')]);return _0x45d401(_0x332d3c['error'][_0x2531('0x24')]);}else{logger[_0x2531('0x25')](_0x2531('0x1f'),_0x15634b,_0x2531('0x20'));_0x45d401(_0x332d3c[_0x2531('0x26')][_0x2531('0x24')]);}})['catch'](function(_0x4edeb5){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x15634b,_0x4edeb5);_0x2e9653(_0x4edeb5);});});}function respondWithStatusCode(_0x27f6bd,_0x424a41){_0x424a41=_0x424a41||0xcc;return function(_0xbc0407){if(_0xbc0407){return _0x27f6bd[_0x2531('0x27')](_0x424a41);}return _0x27f6bd[_0x2531('0x28')](_0x424a41)[_0x2531('0x29')]();};}function respondWithResult(_0x453ffa,_0x80ff54){_0x80ff54=_0x80ff54||0xc8;return function(_0x1d0add){if(_0x1d0add){return _0x453ffa[_0x2531('0x28')](_0x80ff54)[_0x2531('0x2a')](_0x1d0add);}};}function respondWithFilteredResult(_0x28fe6b,_0x25b66a){return function(_0x5629fd){if(_0x5629fd){var _0x15abba=typeof _0x25b66a[_0x2531('0x2b')]===_0x2531('0x2c')&&typeof _0x25b66a['limit']===_0x2531('0x2c');var _0x527516=_0x5629fd[_0x2531('0x2d')];var _0x1063bf=_0x15abba?0x0:_0x25b66a[_0x2531('0x2b')];var _0x789c69=_0x15abba?_0x5629fd['count']:_0x25b66a[_0x2531('0x2b')]+_0x25b66a[_0x2531('0x2e')];var _0x1b32b;if(_0x789c69>=_0x527516){_0x789c69=_0x527516;_0x1b32b=0xc8;}else{_0x1b32b=0xce;}_0x28fe6b[_0x2531('0x28')](_0x1b32b);return _0x28fe6b[_0x2531('0x2f')](_0x2531('0x30'),_0x1063bf+'-'+_0x789c69+'/'+_0x527516)[_0x2531('0x2a')](_0x5629fd);}return null;};}function patchUpdates(_0x938188){return function(_0xc2b2a8){try{jsonpatch[_0x2531('0x31')](_0xc2b2a8,_0x938188,!![]);}catch(_0xbd95ff){return BPromise[_0x2531('0x32')](_0xbd95ff);}return _0xc2b2a8['save']();};}function saveUpdates(_0x16e519,_0x1323e0){return function(_0x39cd05){if(_0x39cd05){return _0x39cd05[_0x2531('0x33')](_0x16e519)['then'](function(_0xa48587){return _0xa48587;});}return null;};}function removeEntity(_0x3b6417,_0x593e79){return function(_0x5f3fd7){if(_0x5f3fd7){return _0x5f3fd7[_0x2531('0x34')]()[_0x2531('0x1e')](function(){_0x3b6417[_0x2531('0x28')](0xcc)[_0x2531('0x29')]();});}};}function handleEntityNotFound(_0x1b21fd,_0x2e725e){return function(_0x31e3a6){if(!_0x31e3a6){_0x1b21fd[_0x2531('0x27')](0x194);}return _0x31e3a6;};}function handleError(_0x49a501,_0x758c7e){_0x758c7e=_0x758c7e||0x1f4;return function(_0x211069){logger[_0x2531('0x22')](_0x211069['stack']);if(_0x211069[_0x2531('0x35')]){delete _0x211069[_0x2531('0x35')];}_0x49a501[_0x2531('0x28')](_0x758c7e)[_0x2531('0x36')](_0x211069);};}function getMustacheRender(_0x483db3,_0x50abfd){return Mustache[_0x2531('0x37')](_0x483db3,_[_0x2531('0x38')](_0x50abfd[_0x2531('0x39')],{'contact':_0x50abfd[_0x2531('0x3a')],'message':_0x50abfd[_0x2531('0x24')],'agent':_0x50abfd['agent'],'interaction':_0x50abfd[_0x2531('0x3b')],'account':_0x50abfd[_0x2531('0x3c')]}))||'';}exports['index']=function(_0x2811bb,_0x59c53b){var _0x4abcf6={},_0x14531a={},_0xeb5d76={'count':0x0,'rows':[]};var _0x2f1f75=_['map'](db[_0x2531('0x3d')][_0x2531('0x3e')],function(_0x379fb6){return{'name':_0x379fb6[_0x2531('0x3f')],'type':_0x379fb6[_0x2531('0x40')]['key']};});_0x14531a[_0x2531('0x41')]=_[_0x2531('0x42')](_0x2f1f75,'name');_0x14531a[_0x2531('0x43')]=_[_0x2531('0x44')](_0x2811bb[_0x2531('0x43')]);_0x14531a['filters']=_['intersection'](_0x14531a[_0x2531('0x41')],_0x14531a[_0x2531('0x43')]);_0x4abcf6[_0x2531('0x45')]=_['intersection'](_0x14531a['model'],qs[_0x2531('0x46')](_0x2811bb[_0x2531('0x43')][_0x2531('0x46')]));_0x4abcf6[_0x2531('0x45')]=_0x4abcf6['attributes'][_0x2531('0x47')]?_0x4abcf6['attributes']:_0x14531a['model'];if(!_0x2811bb[_0x2531('0x43')][_0x2531('0x48')](_0x2531('0x49'))){_0x4abcf6[_0x2531('0x2e')]=qs[_0x2531('0x2e')](_0x2811bb['query'][_0x2531('0x2e')]);_0x4abcf6['offset']=qs[_0x2531('0x2b')](_0x2811bb[_0x2531('0x43')][_0x2531('0x2b')]);}_0x4abcf6[_0x2531('0x4a')]=qs[_0x2531('0x4b')](_0x2811bb[_0x2531('0x43')][_0x2531('0x4b')]);_0x4abcf6['where']=qs[_0x2531('0x4c')](_[_0x2531('0x4d')](_0x2811bb['query'],_0x14531a[_0x2531('0x4c')]),_0x2f1f75);if(_0x2811bb['query'][_0x2531('0x4e')]){_0x4abcf6[_0x2531('0x4f')]=_[_0x2531('0x38')](_0x4abcf6[_0x2531('0x4f')],{'$or':_['map'](_0x2f1f75,function(_0x3b4fb6){if(_0x3b4fb6[_0x2531('0x40')]!==_0x2531('0x50')){var _0x3cbf93={};_0x3cbf93[_0x3b4fb6[_0x2531('0x35')]]={'$like':'%'+_0x2811bb[_0x2531('0x43')]['filter']+'%'};return _0x3cbf93;}})});}_0x4abcf6=_[_0x2531('0x38')]({},_0x4abcf6,_0x2811bb[_0x2531('0x51')]);var _0xb92e0e={'where':_0x4abcf6[_0x2531('0x4f')]};return db[_0x2531('0x3d')][_0x2531('0x2d')](_0xb92e0e)[_0x2531('0x1e')](function(_0x3595f7){_0xeb5d76[_0x2531('0x2d')]=_0x3595f7;if(_0x2811bb[_0x2531('0x43')][_0x2531('0x52')]){_0x4abcf6[_0x2531('0x53')]=[{'all':!![]}];}return db[_0x2531('0x3d')][_0x2531('0x54')](_0x4abcf6);})['then'](function(_0x450c2b){_0xeb5d76[_0x2531('0x55')]=_0x450c2b;return _0xeb5d76;})[_0x2531('0x1e')](respondWithFilteredResult(_0x59c53b,_0x4abcf6))[_0x2531('0x56')](handleError(_0x59c53b,null));};exports[_0x2531('0x57')]=function(_0x30c3a6,_0x52be10){var _0x460267={'raw':!![],'where':{'id':_0x30c3a6[_0x2531('0x58')]['id']}},_0x4256a4={};_0x4256a4['model']=_['keys'](db['WhatsappMessage'][_0x2531('0x3e')]);_0x4256a4[_0x2531('0x43')]=_[_0x2531('0x44')](_0x30c3a6[_0x2531('0x43')]);_0x4256a4[_0x2531('0x4c')]=_['intersection'](_0x4256a4['model'],_0x4256a4[_0x2531('0x43')]);_0x460267[_0x2531('0x45')]=_[_0x2531('0x59')](_0x4256a4[_0x2531('0x41')],qs['fields'](_0x30c3a6[_0x2531('0x43')][_0x2531('0x46')]));_0x460267[_0x2531('0x45')]=_0x460267[_0x2531('0x45')]['length']?_0x460267[_0x2531('0x45')]:_0x4256a4[_0x2531('0x41')];if(_0x30c3a6['query'][_0x2531('0x52')]){_0x460267[_0x2531('0x53')]=[{'all':!![]}];}_0x460267=_[_0x2531('0x38')]({},_0x460267,_0x30c3a6[_0x2531('0x51')]);return db[_0x2531('0x3d')][_0x2531('0x5a')](_0x460267)['then'](handleEntityNotFound(_0x52be10,null))['then'](respondWithResult(_0x52be10,null))['catch'](handleError(_0x52be10,null));};exports[_0x2531('0x5b')]=function(_0x34108e,_0x16950e){return db[_0x2531('0x3d')][_0x2531('0x5b')](_0x34108e[_0x2531('0x39')],{})['then'](respondWithResult(_0x16950e,0xc9))['catch'](handleError(_0x16950e,null));};exports[_0x2531('0x33')]=function(_0x3d6426,_0x4b2b29){if(_0x3d6426[_0x2531('0x39')]['id']){delete _0x3d6426[_0x2531('0x39')]['id'];}return db[_0x2531('0x3d')]['find']({'where':{'id':_0x3d6426[_0x2531('0x58')]['id']}})[_0x2531('0x1e')](handleEntityNotFound(_0x4b2b29,null))[_0x2531('0x1e')](saveUpdates(_0x3d6426['body'],null))[_0x2531('0x1e')](respondWithResult(_0x4b2b29,null))[_0x2531('0x56')](handleError(_0x4b2b29,null));};exports['destroy']=function(_0x2e9d5a,_0x38f3c6){return db[_0x2531('0x3d')][_0x2531('0x5a')]({'where':{'id':_0x2e9d5a[_0x2531('0x58')]['id']}})[_0x2531('0x1e')](handleEntityNotFound(_0x38f3c6,null))[_0x2531('0x1e')](removeEntity(_0x38f3c6,null))[_0x2531('0x56')](handleError(_0x38f3c6,null));};exports[_0x2531('0x5c')]=function(_0x4c7774,_0x2b4b7e){return db[_0x2531('0x3d')][_0x2531('0x5c')]()[_0x2531('0x1e')](respondWithResult(_0x2b4b7e,null))[_0x2531('0x56')](handleError(_0x2b4b7e,null));};var interaction_log=require(_0x2531('0x5d'))(_0x2531('0x5e'));exports['accept']=function(_0x5c6db6,_0x36534a,_0x17992a){var _0x446188={'agent':{},'channel':_0x2531('0x5f')};if(_0x5c6db6['body']['id']){delete _0x5c6db6['body']['id'];}_0x5c6db6[_0x2531('0x39')][_0x2531('0x60')]=!![];_0x5c6db6[_0x2531('0x39')]['readAt']=moment()[_0x2531('0x61')](_0x2531('0x62'));_0x5c6db6[_0x2531('0x39')][_0x2531('0x63')]=_0x5c6db6[_0x2531('0x39')]['UserId']||_0x5c6db6['user']['id'];_0x446188[_0x2531('0x64')]['id']=_0x5c6db6[_0x2531('0x39')][_0x2531('0x63')];return db['WhatsappMessage'][_0x2531('0x5a')]({'where':{'id':_0x5c6db6[_0x2531('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x2531('0x65')],'as':_0x2531('0x66')}]})[_0x2531('0x1e')](handleEntityNotFound(_0x36534a,null))[_0x2531('0x1e')](saveUpdates(_0x5c6db6[_0x2531('0x39')],null))[_0x2531('0x1e')](function(_0x3b0bb2){if(_0x3b0bb2){_0x446188[_0x2531('0x24')]=_0x3b0bb2['get']({'plain':!![]});return db[_0x2531('0x67')][_0x2531('0x5a')]({'where':{'id':_0x3b0bb2[_0x2531('0x68')]}});}return null;})[_0x2531('0x1e')](handleEntityNotFound(_0x36534a,null))[_0x2531('0x1e')](function(_0x1cd04a){if(_0x1cd04a){return _0x1cd04a['update']({'UserId':_0x5c6db6[_0x2531('0x39')]['UserId'],'read1stAt':_['isNil'](_0x1cd04a[_0x2531('0x69')])?moment()[_0x2531('0x61')](_0x2531('0x62')):undefined});}return null;})[_0x2531('0x1e')](function(_0x4525b6){if(_0x4525b6){_0x446188[_0x2531('0x3b')]=_0x4525b6[_0x2531('0x6a')]({'plain':!![]});interaction_log[_0x2531('0x25')](_0x2531('0x6b'),_0x5c6db6[_0x2531('0x6c')]['id'],_0x5c6db6[_0x2531('0x6c')]['name'],_0x5c6db6[_0x2531('0x6c')][_0x2531('0x6d')],_0x446188[_0x2531('0x3b')]['id'],_0x5c6db6['body']?JSON[_0x2531('0x21')](_0x5c6db6[_0x2531('0x39')]):_0x2531('0x6e'));return respondWithRpcPromise(_0x2531('0x6f'),'acceptMessage',_0x446188);}return null;})[_0x2531('0x1e')](function(_0x56f22b){if(_0x56f22b){if(_0x5c6db6[_0x2531('0x39')][_0x2531('0x70')]){_0x446188[_0x2531('0x24')][_0x2531('0x71')]=util['format'](_0x2531('0x72'),_0x5c6db6[_0x2531('0x6c')]['name']);_0x446188[_0x2531('0x24')][_0x2531('0x73')]=_0x446188['channel'];_0x446188[_0x2531('0x24')][_0x2531('0x74')]=_0x2531('0x75');return respondWithRpcPromise(_0x2531('0x76'),'EventManager',{'event':'acceptmessage','message':_0x446188[_0x2531('0x24')]},client9002)[_0x2531('0x1e')](function(){return _0x446188;});}return _0x446188;}return null;})['then'](respondWithResult(_0x36534a,null))[_0x2531('0x56')](handleError(_0x36534a,null));};var interaction_log=require(_0x2531('0x5d'))('whatsapp-interactions');exports[_0x2531('0x32')]=function(_0x354a22,_0x3f6e70,_0x3442da){var _0x4012ae={'agent':{},'channel':_0x2531('0x5f')};if(_0x354a22[_0x2531('0x39')]['id']){delete _0x354a22[_0x2531('0x39')]['id'];}_0x354a22[_0x2531('0x39')][_0x2531('0x63')]=_0x354a22[_0x2531('0x39')][_0x2531('0x63')]||_0x354a22[_0x2531('0x6c')]['id'];_0x4012ae[_0x2531('0x64')]['id']=_0x354a22[_0x2531('0x39')]['UserId'];return db['WhatsappMessage'][_0x2531('0x5a')]({'where':{'id':_0x354a22['params']['id'],'UserId':null}})[_0x2531('0x1e')](handleEntityNotFound(_0x3f6e70,null))[_0x2531('0x1e')](function(_0x51af95){if(_0x51af95){_0x4012ae[_0x2531('0x24')]=_0x51af95['get']({'plain':!![]});return db[_0x2531('0x67')][_0x2531('0x5a')]({'where':{'id':_0x51af95[_0x2531('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x3f6e70,null))['then'](function(_0x5e5855){if(_0x5e5855){_0x4012ae['interaction']=_0x5e5855[_0x2531('0x6a')]({'plain':!![]});interaction_log[_0x2531('0x25')](_0x2531('0x77'),_0x354a22[_0x2531('0x6c')]['id'],_0x354a22[_0x2531('0x6c')][_0x2531('0x35')],_0x354a22[_0x2531('0x6c')]['role'],_0x4012ae[_0x2531('0x3b')]['id'],_0x354a22[_0x2531('0x39')]?JSON[_0x2531('0x21')](_0x354a22[_0x2531('0x39')]):_0x2531('0x6e'));return respondWithRpcPromise('RejectMessage',_0x2531('0x78'),_0x4012ae);}return null;})[_0x2531('0x1e')](function(_0x595e6b){if(_0x595e6b){_0x595e6b['message']['interface']=util[_0x2531('0x61')]('SIP/%s',_0x354a22[_0x2531('0x6c')][_0x2531('0x35')]);_0x595e6b[_0x2531('0x24')][_0x2531('0x73')]=_0x4012ae[_0x2531('0x73')];_0x595e6b[_0x2531('0x24')]['event']=_0x2531('0x32');respondWithRpcPromise(_0x2531('0x76'),_0x2531('0x76'),{'event':_0x2531('0x79'),'message':_0x595e6b[_0x2531('0x24')]},client9002);return _0x4012ae;}return null;})[_0x2531('0x1e')](respondWithResult(_0x3f6e70,null))['catch'](handleError(_0x3f6e70,null));};exports[_0x2531('0x28')]=function(_0x2e7981,_0x222c97,_0x3f5d08){if(_0x2e7981['body']['id']){delete _0x2e7981[_0x2531('0x39')]['id'];}var _0x36f71e;return db[_0x2531('0x3d')][_0x2531('0x5a')]({'where':{'id':_0x2e7981[_0x2531('0x58')]['id']}})[_0x2531('0x1e')](handleEntityNotFound(_0x222c97,null))[_0x2531('0x1e')](function(_0x16c003){if(_0x16c003){_0x36f71e=_0x16c003;return db[_0x2531('0x7a')][_0x2531('0x5a')]({'where':{'id':_0x16c003[_0x2531('0x7b')]}});}})[_0x2531('0x1e')](handleEntityNotFound(_0x222c97,null))['then'](function(_0x4dd88c){if(_0x4dd88c){logger[_0x2531('0x7c')](_0x2531('0x7d'),_0x2531('0x28'),_0x2531('0x7e'),_0x4dd88c[_0x2531('0x40')],util[_0x2531('0x7f')](_0x2e7981[_0x2531('0x39')],{'showHidden':![],'depth':null}));switch(_0x4dd88c[_0x2531('0x40')]){case _0x2531('0x80'):if(_0x2e7981[_0x2531('0x39')]['MessageSid']&&_0x2e7981[_0x2531('0x39')][_0x2531('0x81')]===_0x36f71e[_0x2531('0x82')]&&_0x2e7981[_0x2531('0x39')]['MessageStatus']&&_0x2e7981['body'][_0x2531('0x83')]===_0x2531('0x60')){return _0x36f71e[_0x2531('0x33')]({'read':!![]});}else{logger[_0x2531('0x22')](_0x2531('0x84'),_0x2531('0x28'),_0x2531('0x80'),util[_0x2531('0x7f')](_0x2e7981[_0x2531('0x39')],{'showHidden':![],'depth':null}));}break;}return _0x36f71e;}})[_0x2531('0x1e')](respondWithResult(_0x222c97,null))['catch'](handleError(_0x222c97,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 42af849..57e7d95 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x5ab9a6,_0x1de8a8){var _0x28dfbf=function(_0x533548){while(--_0x533548){_0x5ab9a6['push'](_0x5ab9a6['shift']());}};_0x28dfbf(++_0x1de8a8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2a57e5,_0x2531ae){_0x2a57e5=_0x2a57e5-0x0;var _0x10ac5c=_0x5f2f[_0x2a57e5];return _0x10ac5c;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x33ee05,_0x2f7cb7){var _0x349aa0=function(_0x3b1a38){while(--_0x3b1a38){_0x33ee05['push'](_0x33ee05['shift']());}};_0x349aa0(++_0x2f7cb7);}(_0x7a54,0x106));var _0x47a5=function(_0x3269b7,_0x5ac066){_0x3269b7=_0x3269b7-0x0;var _0x736599=_0x7a54[_0x3269b7];return _0x736599;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 2cf0232..92737ff 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 _0xf1c4=['WhatsappAccountId','type','twilio','accountSid','phone','authToken','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','out','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','direction','secret','find'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0xf1c4,0x15b));var _0x4f1c=function(_0x21d3d5,_0x2ef038){_0x21d3d5=_0x21d3d5-0x0;var _0x2bf601=_0xf1c4[_0x21d3d5];return _0x2bf601;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f1c('0x0'))(_0x4f1c('0x1'));var moment=require(_0x4f1c('0x2'));var BPromise=require('bluebird');var rp=require(_0x4f1c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f1c('0x4'));var config=require(_0x4f1c('0x5'));var attributes=require(_0x4f1c('0x6'));module[_0x4f1c('0x7')]=function(_0x5582a1,_0x51582e){return _0x5582a1[_0x4f1c('0x8')](_0x4f1c('0x9'),attributes,{'tableName':_0x4f1c('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x4f1c('0xb'),'fields':[_0x4f1c('0xc')],'type':_0x4f1c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ee899,_0x1d0906,_0xeb71df){var _0x423a67=_0x5582a1[_0x4f1c('0xe')];var _0xce2314=_0x3ee899[_0x4f1c('0xf')]({'plain':!![]});if(_0xce2314['direction'][_0x4f1c('0x10')]()==='in'||_0xce2314['direction'][_0x4f1c('0x10')]()===_0x4f1c('0x11')&&!_0xce2314['secret']&&!_['isNil'](_0xce2314[_0x4f1c('0x12')])){_0x423a67[_0x4f1c('0x13')][_0x4f1c('0x14')]({'where':{'id':_0xce2314[_0x4f1c('0x15')]}})[_0x4f1c('0x16')](function(_0xdf7ab6){if(_0xdf7ab6){_0xdf7ab6[_0x4f1c('0x17')]({'lastMsgAt':_0xce2314[_0x4f1c('0x18')],'lastMsgDirection':_0xce2314['direction']['toLowerCase']()});}})['catch'](function(_0x4e5ede){console[_0x4f1c('0x19')](_0x4e5ede);});}if(_0xce2314[_0x4f1c('0x1a')]===_0x4f1c('0x11')&&!_0xce2314[_0x4f1c('0x1b')]){var _0xb7287a;_0x423a67['WhatsappAccount'][_0x4f1c('0x1c')]({'where':{'id':_0xce2314[_0x4f1c('0x1d')]},'raw':!![]})[_0x4f1c('0x16')](function(_0x1bf722){_0xb7287a=_0x1bf722;if(_0xb7287a&&_0xb7287a[_0x4f1c('0x1e')]){switch(_0xb7287a[_0x4f1c('0x1e')]){case _0x4f1c('0x1f'):var _0x191ee0=require(_0x4f1c('0x1f'));if(_0xb7287a[_0x4f1c('0x20')]&&_0xb7287a['authToken']&&_0xb7287a[_0x4f1c('0x21')]){var _0x58b714=new _0x191ee0(_0xb7287a[_0x4f1c('0x20')],_0xb7287a[_0x4f1c('0x22')]);_0x58b714['messages'][_0x4f1c('0x23')]({'body':_0xce2314[_0x4f1c('0xc')],'to':'whatsapp:'+_0xce2314['phone'],'from':_0x4f1c('0x24')+_0xb7287a[_0x4f1c('0x21')],'statusCallback':_0xb7287a[_0x4f1c('0x25')]+_0x4f1c('0x26')+_0xce2314['id']+'/status?token='+_0xb7287a[_0x4f1c('0x27')]})[_0x4f1c('0x16')](function(_0x17c4a3){if(_0x17c4a3[_0x4f1c('0x28')]){return _0x3ee899[_0x4f1c('0x17')]({'messageId':_0x17c4a3[_0x4f1c('0x28')]});}})[_0x4f1c('0x29')](function(_0x3165b7){logger[_0x4f1c('0x19')](_0x4f1c('0x2a'),_0x4f1c('0x2b'),_0x4f1c('0x1f'),util[_0x4f1c('0x2c')](_0x3165b7,{'showHidden':![],'depth':null}));});}else{logger[_0x4f1c('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x4f1c('0x2d'));}break;}}})['finally'](function(){_0xeb71df();});}else{_0xeb71df();}}},'charset':'utf8mb4','collate':_0x4f1c('0x2e')});}; \ No newline at end of file +var _0xe285=['../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','models','get','direction','toLowerCase','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','find','type','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xe285,0xe5));var _0x5e28=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xe285[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x5e28('0x0'));var util=require(_0x5e28('0x1'));var logger=require(_0x5e28('0x2'))(_0x5e28('0x3'));var moment=require(_0x5e28('0x4'));var BPromise=require(_0x5e28('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5e28('0x6'));var attributes=require(_0x5e28('0x7'));module['exports']=function(_0x1df66c,_0x230bd0){return _0x1df66c[_0x5e28('0x8')](_0x5e28('0x9'),attributes,{'tableName':_0x5e28('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x5e28('0xb'),'fields':[_0x5e28('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12d02c,_0x9d40bf,_0x8cc84d){var _0x5e8aa9=_0x1df66c[_0x5e28('0xd')];var _0x5ba216=_0x12d02c[_0x5e28('0xe')]({'plain':!![]});if(_0x5ba216[_0x5e28('0xf')][_0x5e28('0x10')]()==='in'||_0x5ba216[_0x5e28('0xf')][_0x5e28('0x10')]()==='out'&&!_0x5ba216[_0x5e28('0x11')]&&!_[_0x5e28('0x12')](_0x5ba216['UserId'])){_0x5e8aa9[_0x5e28('0x13')][_0x5e28('0x14')]({'where':{'id':_0x5ba216[_0x5e28('0x15')]}})[_0x5e28('0x16')](function(_0x78d5aa){if(_0x78d5aa){_0x78d5aa[_0x5e28('0x17')]({'lastMsgAt':_0x5ba216[_0x5e28('0x18')],'lastMsgDirection':_0x5ba216['direction'][_0x5e28('0x10')]()});}})[_0x5e28('0x19')](function(_0x1a818b){console[_0x5e28('0x1a')](_0x1a818b);});}if(_0x5ba216[_0x5e28('0xf')]===_0x5e28('0x1b')&&!_0x5ba216['secret']){var _0x21abfd;_0x5e8aa9['WhatsappAccount'][_0x5e28('0x1c')]({'where':{'id':_0x5ba216['WhatsappAccountId']},'raw':!![]})['then'](function(_0x550a03){_0x21abfd=_0x550a03;if(_0x21abfd&&_0x21abfd[_0x5e28('0x1d')]){switch(_0x21abfd[_0x5e28('0x1d')]){case'twilio':var _0xd98cb0=require('twilio');if(_0x21abfd[_0x5e28('0x1e')]&&_0x21abfd[_0x5e28('0x1f')]&&_0x21abfd['phone']){var _0xb16025=new _0xd98cb0(_0x21abfd[_0x5e28('0x1e')],_0x21abfd['authToken']);_0xb16025[_0x5e28('0x20')][_0x5e28('0x21')]({'body':_0x5ba216['body'],'to':_0x5e28('0x22')+_0x5ba216[_0x5e28('0x23')],'from':'whatsapp:'+_0x21abfd[_0x5e28('0x23')],'statusCallback':_0x21abfd[_0x5e28('0x24')]+_0x5e28('0x25')+_0x5ba216['id']+_0x5e28('0x26')+_0x21abfd['token']})[_0x5e28('0x16')](function(_0x49c8d2){if(_0x49c8d2['sid']){return _0x12d02c[_0x5e28('0x17')]({'messageId':_0x49c8d2[_0x5e28('0x27')]});}})[_0x5e28('0x19')](function(_0x3cd329){logger[_0x5e28('0x1a')](_0x5e28('0x28'),_0x5e28('0x29'),_0x5e28('0x2a'),util[_0x5e28('0x2b')](_0x3cd329,{'showHidden':![],'depth':null}));});}else{logger[_0x5e28('0x1a')](_0x5e28('0x28'),'afterCreate',_0x5e28('0x2a'),_0x5e28('0x2c'));}break;}}})[_0x5e28('0x2d')](function(){_0x8cc84d();});}else{_0x8cc84d();}}},'charset':_0x5e28('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 04fb195..7f3b438 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 _0xcdeb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','WhatsappMessage','options','CreateWhatsappMessage','debug','util','moment','bluebird'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcdeb,0xbd));var _0xbcde=function(_0x2243a9,_0x936fc2){_0x2243a9=_0x2243a9-0x0;var _0x2ec557=_0xcdeb[_0x2243a9];return _0x2ec557;};'use strict';var _=require('lodash');var util=require(_0xbcde('0x0'));var moment=require(_0xbcde('0x1'));var BPromise=require(_0xbcde('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcde('0x3'));var db=require(_0xbcde('0x4'))['db'];var utils=require(_0xbcde('0x5'));var logger=require(_0xbcde('0x6'))('rpc');var config=require(_0xbcde('0x7'));var jayson=require(_0xbcde('0x8'));var client=jayson[_0xbcde('0x9')][_0xbcde('0xa')]({'port':0x232a});config[_0xbcde('0xb')]=_[_0xbcde('0xc')](config[_0xbcde('0xb')],{'host':_0xbcde('0xd'),'port':0x18eb});var socket=require(_0xbcde('0xe'))(new Redis(config[_0xbcde('0xb')]));require('./whatsappMessage.socket')[_0xbcde('0xf')](socket);function respondWithRpcPromise(_0x2a49f4,_0x2064f4,_0x45e5ce){return new BPromise(function(_0x5da0a8,_0x39db3e){return client[_0xbcde('0x10')](_0x2a49f4,_0x45e5ce)[_0xbcde('0x11')](function(_0x279299){logger[_0xbcde('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x2064f4,'request\x20sent');logger['debug'](_0xbcde('0x13'),_0x2064f4,_0xbcde('0x14'),JSON[_0xbcde('0x15')](_0x279299));if(_0x279299[_0xbcde('0x16')]){if(_0x279299[_0xbcde('0x16')][_0xbcde('0x17')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2064f4,_0x279299[_0xbcde('0x16')][_0xbcde('0x18')]);return _0x39db3e(_0x279299[_0xbcde('0x16')][_0xbcde('0x18')]);}logger[_0xbcde('0x16')](_0xbcde('0x19'),_0x2064f4,_0x279299[_0xbcde('0x16')][_0xbcde('0x18')]);return _0x5da0a8(_0x279299[_0xbcde('0x16')][_0xbcde('0x18')]);}else{logger['info'](_0xbcde('0x19'),_0x2064f4,'request\x20sent');_0x5da0a8(_0x279299[_0xbcde('0x1a')]['message']);}})[_0xbcde('0x1b')](function(_0x51ffd0){logger[_0xbcde('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x2064f4,_0x51ffd0);_0x39db3e(_0x51ffd0);});});}exports['CreateWhatsappMessage']=function(_0x5d8b72){var _0x4aaa8c=this;return new Promise(function(_0x395f9f,_0x599b4a){return db[_0xbcde('0x1c')]['create'](_0x5d8b72['body'],{'raw':_0x5d8b72[_0xbcde('0x1d')]?_0x5d8b72[_0xbcde('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xbcde('0x11')](function(_0x5e9156){logger[_0xbcde('0x12')](_0xbcde('0x1e'),_0x5d8b72);logger[_0xbcde('0x1f')](_0xbcde('0x1e'),_0x5d8b72,JSON[_0xbcde('0x15')](_0x5e9156));_0x395f9f(_0x5e9156);})[_0xbcde('0x1b')](function(_0xdf8906){logger[_0xbcde('0x16')](_0xbcde('0x1e'),_0xdf8906[_0xbcde('0x18')],_0x5d8b72);_0x599b4a(_0x4aaa8c[_0xbcde('0x16')](0x1f4,_0xdf8906[_0xbcde('0x18')]));});});}; \ No newline at end of file +var _0x4100=['ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappMessage','WhatsappMessage','body','options','raw','catch','lodash','moment','bluebird','randomstring'];(function(_0x439cea,_0x115a1c){var _0x55f8a9=function(_0x3ed1cd){while(--_0x3ed1cd){_0x439cea['push'](_0x439cea['shift']());}};_0x55f8a9(++_0x115a1c);}(_0x4100,0x10a));var _0x0410=function(_0x31e972,_0x4f072d){_0x31e972=_0x31e972-0x0;var _0x32747b=_0x4100[_0x31e972];return _0x32747b;};'use strict';var _=require(_0x0410('0x0'));var util=require('util');var moment=require(_0x0410('0x1'));var BPromise=require(_0x0410('0x2'));var rs=require(_0x0410('0x3'));var fs=require('fs');var Redis=require(_0x0410('0x4'));var db=require(_0x0410('0x5'))['db'];var utils=require(_0x0410('0x6'));var logger=require('../../config/logger')(_0x0410('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0410('0x8')][_0x0410('0x9')]({'port':0x232a});config[_0x0410('0xa')]=_['defaults'](config[_0x0410('0xa')],{'host':_0x0410('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0410('0xa')]));require('./whatsappMessage.socket')[_0x0410('0xc')](socket);function respondWithRpcPromise(_0x2751cd,_0x1448b8,_0x3694f7){return new BPromise(function(_0x47ddac,_0xa1b6e5){return client[_0x0410('0xd')](_0x2751cd,_0x3694f7)[_0x0410('0xe')](function(_0xee4e0e){logger[_0x0410('0xf')](_0x0410('0x10'),_0x1448b8,_0x0410('0x11'));logger[_0x0410('0x12')](_0x0410('0x13'),_0x1448b8,'request\x20sent',JSON[_0x0410('0x14')](_0xee4e0e));if(_0xee4e0e[_0x0410('0x15')]){if(_0xee4e0e['error']['code']===0x1f4){logger[_0x0410('0x15')](_0x0410('0x10'),_0x1448b8,_0xee4e0e[_0x0410('0x15')][_0x0410('0x16')]);return _0xa1b6e5(_0xee4e0e[_0x0410('0x15')][_0x0410('0x16')]);}logger[_0x0410('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x1448b8,_0xee4e0e[_0x0410('0x15')]['message']);return _0x47ddac(_0xee4e0e[_0x0410('0x15')][_0x0410('0x16')]);}else{logger[_0x0410('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x1448b8,_0x0410('0x11'));_0x47ddac(_0xee4e0e[_0x0410('0x17')][_0x0410('0x16')]);}})['catch'](function(_0x26e6d4){logger['error'](_0x0410('0x10'),_0x1448b8,_0x26e6d4);_0xa1b6e5(_0x26e6d4);});});}exports[_0x0410('0x18')]=function(_0xd0d089){var _0x47f1fc=this;return new Promise(function(_0x487c8e,_0x34e102){return db[_0x0410('0x19')]['create'](_0xd0d089[_0x0410('0x1a')],{'raw':_0xd0d089[_0x0410('0x1b')]?_0xd0d089['options'][_0x0410('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4936ba){logger[_0x0410('0xf')](_0x0410('0x18'),_0xd0d089);logger[_0x0410('0x12')](_0x0410('0x18'),_0xd0d089,JSON[_0x0410('0x14')](_0x4936ba));_0x487c8e(_0x4936ba);})[_0x0410('0x1d')](function(_0x27b77c){logger[_0x0410('0x15')](_0x0410('0x18'),_0x27b77c[_0x0410('0x16')],_0xd0d089);_0x34e102(_0x47f1fc[_0x0410('0x15')](0x1f4,_0x27b77c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 49c99ac..dba5f27 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 _0xc2e5=['remove','update','emit','removeListener','register','length','whatsappMessage:','save'];(function(_0x586124,_0x4103b1){var _0x5907c9=function(_0x220936){while(--_0x220936){_0x586124['push'](_0x586124['shift']());}};_0x5907c9(++_0x4103b1);}(_0xc2e5,0x6f));var _0x5c2e=function(_0x5d23be,_0x3b4f3c){_0x5d23be=_0x5d23be-0x0;var _0x4d60a9=_0xc2e5[_0x5d23be];return _0x4d60a9;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x5c2e('0x0'),_0x5c2e('0x1'),_0x5c2e('0x2')];function createListener(_0x4439fa,_0x1ecbf0){return function(_0x379955){_0x1ecbf0[_0x5c2e('0x3')](_0x4439fa,_0x379955);};}function removeListener(_0x495ec6,_0x2809c4){return function(){WhatsappMessageEvents[_0x5c2e('0x4')](_0x495ec6,_0x2809c4);};}exports[_0x5c2e('0x5')]=function(_0x599061){for(var _0x42f424=0x0,_0x5316f3=events[_0x5c2e('0x6')];_0x42f424<_0x5316f3;_0x42f424++){var _0x461b83=events[_0x42f424];var _0x11782c=createListener(_0x5c2e('0x7')+_0x461b83,_0x599061);WhatsappMessageEvents['on'](_0x461b83,_0x11782c);}}; \ No newline at end of file +var _0xbc48=['whatsappMessage:','./whatsappMessage.events','save','removeListener','register','length'];(function(_0x5302ca,_0x17fad6){var _0xbe0bdc=function(_0x417d21){while(--_0x417d21){_0x5302ca['push'](_0x5302ca['shift']());}};_0xbe0bdc(++_0x17fad6);}(_0xbc48,0x97));var _0x8bc4=function(_0xde4af3,_0x5c2500){_0xde4af3=_0xde4af3-0x0;var _0x4a0b5e=_0xbc48[_0xde4af3];return _0x4a0b5e;};'use strict';var WhatsappMessageEvents=require(_0x8bc4('0x0'));var events=[_0x8bc4('0x1'),'remove','update'];function createListener(_0x4b7b94,_0x1cdfc4){return function(_0x429559){_0x1cdfc4['emit'](_0x4b7b94,_0x429559);};}function removeListener(_0xfbb420,_0x217267){return function(){WhatsappMessageEvents[_0x8bc4('0x2')](_0xfbb420,_0x217267);};}exports[_0x8bc4('0x3')]=function(_0x26b0ee){for(var _0x558d31=0x0,_0x488915=events[_0x8bc4('0x4')];_0x558d31<_0x488915;_0x558d31++){var _0x315432=events[_0x558d31];var _0x1176f9=createListener(_0x8bc4('0x5')+_0x315432,_0x26b0ee);WhatsappMessageEvents['on'](_0x315432,_0x1176f9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index f44b285..217599d 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 _0xc611=['get','/describe','isAuthenticated','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller'];(function(_0x106acc,_0x1fb863){var _0x235f03=function(_0x35bb1b){while(--_0x35bb1b){_0x106acc['push'](_0x106acc['shift']());}};_0x235f03(++_0x1fb863);}(_0xc611,0x99));var _0x1c61=function(_0xa82dcc,_0x4aa25e){_0xa82dcc=_0xa82dcc-0x0;var _0x4c993b=_0xc611[_0xa82dcc];return _0x4c993b;};'use strict';var multer=require(_0x1c61('0x0'));var util=require('util');var path=require(_0x1c61('0x1'));var timeout=require(_0x1c61('0x2'));var express=require('express');var router=express[_0x1c61('0x3')]();var fs_extra=require(_0x1c61('0x4'));var auth=require(_0x1c61('0x5'));var interaction=require(_0x1c61('0x6'));var config=require(_0x1c61('0x7'));var controller=require(_0x1c61('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1c61('0x9')](_0x1c61('0xa'),auth[_0x1c61('0xb')](),controller[_0x1c61('0xc')]);router['get'](_0x1c61('0xd'),auth[_0x1c61('0xb')](),controller['show']);router[_0x1c61('0x9')]('/:id/members',auth[_0x1c61('0xb')](),controller[_0x1c61('0xe')]);router[_0x1c61('0x9')](_0x1c61('0xf'),auth['isAuthenticated'](),controller[_0x1c61('0x10')]);router[_0x1c61('0x9')](_0x1c61('0x11'),auth['isAuthenticated'](),controller[_0x1c61('0x12')]);router[_0x1c61('0x13')]('/',auth[_0x1c61('0xb')](),controller['create']);router['post']('/:id/teams',auth[_0x1c61('0xb')](),controller[_0x1c61('0x14')]);router[_0x1c61('0x13')]('/:id/users',auth[_0x1c61('0xb')](),controller['addAgents']);router[_0x1c61('0x15')](_0x1c61('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x1c61('0x16')](_0x1c61('0xd'),auth[_0x1c61('0xb')](),controller[_0x1c61('0x17')]);router[_0x1c61('0x16')](_0x1c61('0xf'),auth[_0x1c61('0xb')](),controller[_0x1c61('0x18')]);router[_0x1c61('0x16')]('/:id/users',auth[_0x1c61('0xb')](),controller[_0x1c61('0x19')]);module[_0x1c61('0x1a')]=router; \ No newline at end of file +var _0x61ad=['../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','update','delete','removeTeams','removeAgents','exports','connect-timeout','express','Router'];(function(_0x4199b0,_0x33f8ac){var _0x2b9375=function(_0x1fdac5){while(--_0x1fdac5){_0x4199b0['push'](_0x4199b0['shift']());}};_0x2b9375(++_0x33f8ac);}(_0x61ad,0x19d));var _0xd61a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x61ad[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd61a('0x0'));var express=require(_0xd61a('0x1'));var router=express[_0xd61a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd61a('0x3'));var interaction=require(_0xd61a('0x4'));var config=require('../../config/environment');var controller=require(_0xd61a('0x5'));router[_0xd61a('0x6')]('/',auth['isAuthenticated'](),controller[_0xd61a('0x7')]);router[_0xd61a('0x6')](_0xd61a('0x8'),auth['isAuthenticated'](),controller[_0xd61a('0x9')]);router[_0xd61a('0x6')](_0xd61a('0xa'),auth[_0xd61a('0xb')](),controller[_0xd61a('0xc')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xd61a('0xd')]);router['get'](_0xd61a('0xe'),auth[_0xd61a('0xb')](),controller[_0xd61a('0xf')]);router[_0xd61a('0x6')]('/:id/users',auth[_0xd61a('0xb')](),controller[_0xd61a('0x10')]);router[_0xd61a('0x11')]('/',auth[_0xd61a('0xb')](),controller['create']);router[_0xd61a('0x11')](_0xd61a('0xe'),auth[_0xd61a('0xb')](),controller[_0xd61a('0x12')]);router[_0xd61a('0x11')](_0xd61a('0x13'),auth[_0xd61a('0xb')](),controller[_0xd61a('0x14')]);router['put'](_0xd61a('0xa'),auth['isAuthenticated'](),controller[_0xd61a('0x15')]);router[_0xd61a('0x16')](_0xd61a('0xa'),auth[_0xd61a('0xb')](),controller['destroy']);router[_0xd61a('0x16')](_0xd61a('0xe'),auth[_0xd61a('0xb')](),controller[_0xd61a('0x17')]);router[_0xd61a('0x16')](_0xd61a('0x13'),auth['isAuthenticated'](),controller[_0xd61a('0x18')]);module[_0xd61a('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 8644033..bb1c2b6 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 _0x2c4f=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x595c1d,_0x5abc2){var _0x21a838=function(_0x5750f7){while(--_0x5750f7){_0x595c1d['push'](_0x595c1d['shift']());}};_0x21a838(++_0x5abc2);}(_0x2c4f,0x190));var _0xf2c4=function(_0x9915b5,_0x548b24){_0x9915b5=_0x9915b5-0x0;var _0x551f2b=_0x2c4f[_0x9915b5];return _0x551f2b;};'use strict';var Sequelize=require(_0xf2c4('0x0'));module[_0xf2c4('0x1')]={'name':{'type':Sequelize[_0xf2c4('0x2')],'unique':_0xf2c4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xf2c4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf2c4('0x5')](_0xf2c4('0x6'),_0xf2c4('0x7'),_0xf2c4('0x8'))},'description':{'type':Sequelize[_0xf2c4('0x2')]}}; \ No newline at end of file +var _0x173a=['roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x32ab72,_0x47dd1b){var _0x83eea5=function(_0x5dc26c){while(--_0x5dc26c){_0x32ab72['push'](_0x32ab72['shift']());}};_0x83eea5(++_0x47dd1b);}(_0x173a,0x1d9));var _0xa173=function(_0x5d9115,_0x373432){_0x5d9115=_0x5d9115-0x0;var _0x5c5e3b=_0x173a[_0x5d9115];return _0x5c5e3b;};'use strict';var Sequelize=require(_0xa173('0x0'));module[_0xa173('0x1')]={'name':{'type':Sequelize[_0xa173('0x2')],'unique':_0xa173('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa173('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa173('0x5'),_0xa173('0x6'),_0xa173('0x7'))},'description':{'type':Sequelize[_0xa173('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 06c3500..e8eb788 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 _0x1348=['filter','merge','VIRTUAL','name','options','include','findAll','rows','params','keys','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','catch','update','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','pick','addTeams','ids','Team','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','push','toString','sequelize','every','TeamId','includes','all','compact','value','isEmpty','emit','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','UserProfileResource','error','stack','send','render','body','message','agent','interaction','index','WhatsappQueue','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x1348,0x1e1));var _0x8134=function(_0x2d27d2,_0xe7a445){_0x2d27d2=_0x2d27d2-0x0;var _0x5f1355=_0x1348[_0x2d27d2];return _0x5f1355;};'use strict';var emlformat=require(_0x8134('0x0'));var rimraf=require(_0x8134('0x1'));var zipdir=require(_0x8134('0x2'));var jsonpatch=require(_0x8134('0x3'));var rp=require(_0x8134('0x4'));var moment=require(_0x8134('0x5'));var BPromise=require(_0x8134('0x6'));var Mustache=require('mustache');var util=require(_0x8134('0x7'));var path=require('path');var sox=require(_0x8134('0x8'));var csv=require(_0x8134('0x9'));var ejs=require(_0x8134('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8134('0xb'));var squel=require('squel');var crypto=require(_0x8134('0xc'));var jsforce=require(_0x8134('0xd'));var deskjs=require(_0x8134('0xe'));var toCsv=require(_0x8134('0x9'));var querystring=require(_0x8134('0xf'));var Papa=require('papaparse');var Redis=require(_0x8134('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8134('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8134('0x12'))(_0x8134('0x13'));var utils=require(_0x8134('0x14'));var config=require(_0x8134('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8134('0x16')]=_[_0x8134('0x17')](config[_0x8134('0x16')],{'host':_0x8134('0x18'),'port':0x18eb});var socket=require(_0x8134('0x19'))(new Redis(config[_0x8134('0x16')]));require('./whatsappQueue.socket')[_0x8134('0x1a')](socket);function respondWithStatusCode(_0x469fc6,_0x4ba2d4){_0x4ba2d4=_0x4ba2d4||0xcc;return function(_0x534ccd){if(_0x534ccd){return _0x469fc6[_0x8134('0x1b')](_0x4ba2d4);}return _0x469fc6[_0x8134('0x1c')](_0x4ba2d4)[_0x8134('0x1d')]();};}function respondWithResult(_0x129c01,_0x5ab9f5){_0x5ab9f5=_0x5ab9f5||0xc8;return function(_0x2d89e4){if(_0x2d89e4){return _0x129c01[_0x8134('0x1c')](_0x5ab9f5)[_0x8134('0x1e')](_0x2d89e4);}};}function respondWithFilteredResult(_0x5d83cc,_0x2d10fe){return function(_0x14c0d9){if(_0x14c0d9){var _0xe098c3=typeof _0x2d10fe[_0x8134('0x1f')]===_0x8134('0x20')&&typeof _0x2d10fe[_0x8134('0x21')]===_0x8134('0x20');var _0x3a718e=_0x14c0d9[_0x8134('0x22')];var _0x368ad1=_0xe098c3?0x0:_0x2d10fe[_0x8134('0x1f')];var _0x31d8f3=_0xe098c3?_0x14c0d9[_0x8134('0x22')]:_0x2d10fe[_0x8134('0x1f')]+_0x2d10fe[_0x8134('0x21')];var _0xc1705c;if(_0x31d8f3>=_0x3a718e){_0x31d8f3=_0x3a718e;_0xc1705c=0xc8;}else{_0xc1705c=0xce;}_0x5d83cc[_0x8134('0x1c')](_0xc1705c);return _0x5d83cc[_0x8134('0x23')](_0x8134('0x24'),_0x368ad1+'-'+_0x31d8f3+'/'+_0x3a718e)['json'](_0x14c0d9);}return null;};}function patchUpdates(_0x549dfc){return function(_0x2370a1){try{jsonpatch[_0x8134('0x25')](_0x2370a1,_0x549dfc,!![]);}catch(_0x3b3097){return BPromise['reject'](_0x3b3097);}return _0x2370a1[_0x8134('0x26')]();};}function saveUpdates(_0x5fb21d,_0x4d5697){return function(_0x373fe9){if(_0x373fe9){return _0x373fe9['update'](_0x5fb21d)[_0x8134('0x27')](function(_0xc3e2f6){return _0xc3e2f6;});}return null;};}function removeEntity(_0x3c3b73,_0x3a4f02){return function(_0x5e4cbe){if(_0x5e4cbe){return _0x5e4cbe[_0x8134('0x28')]()['then'](function(){var _0x348b6f=_0x5e4cbe['get']({'plain':!![]});var _0x25e0dd='WhatsappQueues';return db[_0x8134('0x29')][_0x8134('0x28')]({'where':{'type':_0x25e0dd,'resourceId':_0x348b6f['id']}})[_0x8134('0x27')](function(){return _0x5e4cbe;});})[_0x8134('0x27')](function(){_0x3c3b73['status'](0xcc)[_0x8134('0x1d')]();});}};}function handleEntityNotFound(_0x2c7b8c,_0x49ab00){return function(_0x55bf25){if(!_0x55bf25){_0x2c7b8c[_0x8134('0x1b')](0x194);}return _0x55bf25;};}function handleError(_0x5ae844,_0x55309){_0x55309=_0x55309||0x1f4;return function(_0x2013a5){logger[_0x8134('0x2a')](_0x2013a5[_0x8134('0x2b')]);if(_0x2013a5['name']){delete _0x2013a5['name'];}_0x5ae844[_0x8134('0x1c')](_0x55309)[_0x8134('0x2c')](_0x2013a5);};}function getMustacheRender(_0x37b116,_0x336e17){return Mustache[_0x8134('0x2d')](_0x37b116,_['merge'](_0x336e17[_0x8134('0x2e')],{'contact':_0x336e17['contact'],'message':_0x336e17[_0x8134('0x2f')],'agent':_0x336e17[_0x8134('0x30')],'interaction':_0x336e17[_0x8134('0x31')],'account':_0x336e17['account']}))||'';}exports[_0x8134('0x32')]=function(_0x4a2503,_0x450b1c){var _0x279eac={},_0x1f2c40={},_0x58656c={'count':0x0,'rows':[]};var _0xde800c=_['map'](db[_0x8134('0x33')]['rawAttributes'],function(_0xdc8f00){return{'name':_0xdc8f00['fieldName'],'type':_0xdc8f00[_0x8134('0x34')][_0x8134('0x35')]};});_0x1f2c40[_0x8134('0x36')]=_[_0x8134('0x37')](_0xde800c,'name');_0x1f2c40[_0x8134('0x38')]=_['keys'](_0x4a2503[_0x8134('0x38')]);_0x1f2c40['filters']=_[_0x8134('0x39')](_0x1f2c40[_0x8134('0x36')],_0x1f2c40[_0x8134('0x38')]);_0x279eac['attributes']=_['intersection'](_0x1f2c40[_0x8134('0x36')],qs['fields'](_0x4a2503[_0x8134('0x38')][_0x8134('0x3a')]));_0x279eac[_0x8134('0x3b')]=_0x279eac[_0x8134('0x3b')][_0x8134('0x3c')]?_0x279eac['attributes']:_0x1f2c40[_0x8134('0x36')];if(!_0x4a2503[_0x8134('0x38')][_0x8134('0x3d')](_0x8134('0x3e'))){_0x279eac[_0x8134('0x21')]=qs[_0x8134('0x21')](_0x4a2503[_0x8134('0x38')][_0x8134('0x21')]);_0x279eac[_0x8134('0x1f')]=qs[_0x8134('0x1f')](_0x4a2503[_0x8134('0x38')][_0x8134('0x1f')]);}_0x279eac[_0x8134('0x3f')]=qs[_0x8134('0x40')](_0x4a2503[_0x8134('0x38')][_0x8134('0x40')]);_0x279eac[_0x8134('0x41')]=qs[_0x8134('0x42')](_['pick'](_0x4a2503[_0x8134('0x38')],_0x1f2c40[_0x8134('0x42')]),_0xde800c);if(_0x4a2503['query'][_0x8134('0x43')]){_0x279eac['where']=_[_0x8134('0x44')](_0x279eac[_0x8134('0x41')],{'$or':_['map'](_0xde800c,function(_0x1fa596){if(_0x1fa596['type']!==_0x8134('0x45')){var _0x596961={};_0x596961[_0x1fa596[_0x8134('0x46')]]={'$like':'%'+_0x4a2503[_0x8134('0x38')][_0x8134('0x43')]+'%'};return _0x596961;}})});}_0x279eac=_[_0x8134('0x44')]({},_0x279eac,_0x4a2503[_0x8134('0x47')]);var _0x4f8fdf={'where':_0x279eac[_0x8134('0x41')]};return db['WhatsappQueue'][_0x8134('0x22')](_0x4f8fdf)['then'](function(_0x1abdb0){_0x58656c[_0x8134('0x22')]=_0x1abdb0;if(_0x4a2503[_0x8134('0x38')]['includeAll']){_0x279eac[_0x8134('0x48')]=[{'all':!![]}];}return db[_0x8134('0x33')][_0x8134('0x49')](_0x279eac);})[_0x8134('0x27')](function(_0x29a525){_0x58656c[_0x8134('0x4a')]=_0x29a525;return _0x58656c;})[_0x8134('0x27')](respondWithFilteredResult(_0x450b1c,_0x279eac))['catch'](handleError(_0x450b1c,null));};exports['show']=function(_0x91f5b7,_0x2acec5){var _0x21cfbd={'raw':!![],'where':{'id':_0x91f5b7[_0x8134('0x4b')]['id']}},_0x283952={};_0x283952[_0x8134('0x36')]=_[_0x8134('0x4c')](db[_0x8134('0x33')][_0x8134('0x4d')]);_0x283952[_0x8134('0x38')]=_[_0x8134('0x4c')](_0x91f5b7['query']);_0x283952[_0x8134('0x42')]=_[_0x8134('0x39')](_0x283952[_0x8134('0x36')],_0x283952[_0x8134('0x38')]);_0x21cfbd['attributes']=_[_0x8134('0x39')](_0x283952[_0x8134('0x36')],qs[_0x8134('0x3a')](_0x91f5b7['query'][_0x8134('0x3a')]));_0x21cfbd['attributes']=_0x21cfbd[_0x8134('0x3b')][_0x8134('0x3c')]?_0x21cfbd[_0x8134('0x3b')]:_0x283952['model'];if(_0x91f5b7['query'][_0x8134('0x4e')]){_0x21cfbd[_0x8134('0x48')]=[{'all':!![]}];}_0x21cfbd=_[_0x8134('0x44')]({},_0x21cfbd,_0x91f5b7['options']);return db['WhatsappQueue'][_0x8134('0x4f')](_0x21cfbd)[_0x8134('0x27')](handleEntityNotFound(_0x2acec5,null))[_0x8134('0x27')](respondWithResult(_0x2acec5,null))['catch'](handleError(_0x2acec5,null));};exports[_0x8134('0x50')]=function(_0x49d571,_0x189986){return db[_0x8134('0x33')][_0x8134('0x50')](_0x49d571['body'],{})['then'](function(_0x211a4a){var _0xcd4b7b=_0x49d571[_0x8134('0x51')]['get']({'plain':!![]});if(!_0xcd4b7b)throw new Error(_0x8134('0x52'));if(_0xcd4b7b['role']==='user'){var _0x5511a0=_0x211a4a[_0x8134('0x53')]({'plain':!![]});var _0x43aae6=_0x8134('0x54');return db[_0x8134('0x55')][_0x8134('0x4f')]({'where':{'name':_0x43aae6,'userProfileId':_0xcd4b7b[_0x8134('0x56')]},'raw':!![]})[_0x8134('0x27')](function(_0x85155a){if(_0x85155a&&_0x85155a[_0x8134('0x57')]===0x0){return db['UserProfileResource'][_0x8134('0x50')]({'name':_0x5511a0[_0x8134('0x46')],'resourceId':_0x5511a0['id'],'type':_0x85155a[_0x8134('0x46')],'sectionId':_0x85155a['id']},{})[_0x8134('0x27')](function(){return _0x211a4a;});}else{return _0x211a4a;}})[_0x8134('0x58')](function(_0x1447a8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1447a8);throw _0x1447a8;});}return _0x211a4a;})[_0x8134('0x27')](respondWithResult(_0x189986,0xc9))[_0x8134('0x58')](handleError(_0x189986,null));};exports[_0x8134('0x59')]=function(_0x54bcbf,_0xaa0124){if(_0x54bcbf['body']['id']){delete _0x54bcbf['body']['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x54bcbf[_0x8134('0x4b')]['id']}})['then'](handleEntityNotFound(_0xaa0124,null))['then'](saveUpdates(_0x54bcbf['body'],null))[_0x8134('0x27')](respondWithResult(_0xaa0124,null))['catch'](handleError(_0xaa0124,null));};exports['destroy']=function(_0x2497ca,_0x4072e7){return db['WhatsappQueue']['find']({'where':{'id':_0x2497ca[_0x8134('0x4b')]['id']}})[_0x8134('0x27')](handleEntityNotFound(_0x4072e7,null))['then'](removeEntity(_0x4072e7,null))['catch'](handleError(_0x4072e7,null));};exports[_0x8134('0x5a')]=function(_0x1a0a48,_0x2f7477){return db['WhatsappQueue'][_0x8134('0x5a')]()[_0x8134('0x27')](respondWithResult(_0x2f7477,null))[_0x8134('0x58')](handleError(_0x2f7477,null));};exports[_0x8134('0x5b')]=function(_0xec2eba,_0x27fb24,_0x4bbc97){var _0x152df0={'raw':!![],'where':{}},_0x59aeb1={},_0x16d6a7;return db[_0x8134('0x33')][_0x8134('0x5c')]({'where':{'id':_0xec2eba[_0x8134('0x4b')]['id']}})[_0x8134('0x27')](handleEntityNotFound(_0x27fb24,null))[_0x8134('0x27')](function(_0x43c7bd){if(_0x43c7bd){_0x16d6a7=_0x43c7bd[_0x8134('0x53')]({'plain':!![]});_0x59aeb1['model']=_[_0x8134('0x4c')](db[_0x8134('0x5d')][_0x8134('0x4d')]);_0x59aeb1['query']=_['keys'](_0xec2eba[_0x8134('0x38')]);_0x59aeb1['filters']=_[_0x8134('0x39')](_0x59aeb1['model'],_0x59aeb1[_0x8134('0x38')]);_0x152df0[_0x8134('0x3b')]=_[_0x8134('0x39')](_0x59aeb1[_0x8134('0x36')],qs[_0x8134('0x3a')](_0xec2eba[_0x8134('0x38')][_0x8134('0x3a')]));_0x152df0[_0x8134('0x3b')]=_0x152df0[_0x8134('0x3b')][_0x8134('0x3c')]?_0x152df0[_0x8134('0x3b')]:_0x59aeb1[_0x8134('0x36')];if(!_0xec2eba[_0x8134('0x38')][_0x8134('0x3d')]('nolimit')){_0x152df0[_0x8134('0x21')]=qs[_0x8134('0x21')](_0xec2eba[_0x8134('0x38')][_0x8134('0x21')]);_0x152df0[_0x8134('0x1f')]=qs[_0x8134('0x1f')](_0xec2eba[_0x8134('0x38')][_0x8134('0x1f')]);}_0x152df0[_0x8134('0x3f')]=qs[_0x8134('0x40')](_0xec2eba[_0x8134('0x38')]['sort']);_0x152df0[_0x8134('0x41')]=qs[_0x8134('0x42')](_['pick'](_0xec2eba[_0x8134('0x38')],_0x59aeb1[_0x8134('0x42')]));_0x152df0[_0x8134('0x41')][_0x8134('0x5e')]=_0x43c7bd['id'];if(_0xec2eba[_0x8134('0x38')]['filter']){_0x152df0['where']=_['merge'](_0x152df0['where'],{'$or':_[_0x8134('0x37')](_0x152df0[_0x8134('0x3b')],function(_0x49ff0d){var _0x5cb7d0={};_0x5cb7d0[_0x49ff0d]={'$like':'%'+_0xec2eba[_0x8134('0x38')][_0x8134('0x43')]+'%'};return _0x5cb7d0;})});}_0x152df0=_[_0x8134('0x44')]({},_0x152df0,_0xec2eba['options']);return db[_0x8134('0x5d')][_0x8134('0x49')](_0x152df0);}})[_0x8134('0x27')](function(_0xedda85){if(_0xedda85){return db[_0x8134('0x5f')]['findAndCountAll']({'where':{'id':_[_0x8134('0x37')](_0xedda85,'UserId'),'role':_0x8134('0x30')},'attributes':['id',_0x8134('0x46'),_0x8134('0x60'),_0x8134('0x61'),_0x8134('0x62')]});}})[_0x8134('0x27')](function(_0x5b8527){if(_0x5b8527){return{'count':_0x5b8527['count'],'rows':_[_0x8134('0x37')](_0x5b8527['rows'],function(_0x3e92f9){return{'membername':_0x3e92f9['name'],'UserId':_0x3e92f9['id'],'queue_name':_0x16d6a7['name'],'WhatsappQueueId':_0x16d6a7['id'],'interface':util[_0x8134('0x63')](_0x8134('0x64'),_0x8134('0x65'),_0x3e92f9[_0x8134('0x46')]),'penalty':0x0,'paused':_0x3e92f9['whatsappPause'],'createdAt':_0x3e92f9[_0x8134('0x62')],'updatedAt':_0x3e92f9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8134('0x27')](respondWithFilteredResult(_0x27fb24,_0x152df0))[_0x8134('0x58')](handleError(_0x27fb24,null));};exports[_0x8134('0x66')]=function(_0xb40990,_0x4ce4bc,_0x582c00){var _0x140763={};var _0x117601={};var _0x152d60;var _0x340761;return db[_0x8134('0x33')][_0x8134('0x5c')]({'where':{'id':_0xb40990[_0x8134('0x4b')]['id']}})[_0x8134('0x27')](handleEntityNotFound(_0x4ce4bc,null))[_0x8134('0x27')](function(_0x4dc7f1){if(_0x4dc7f1){_0x152d60=_0x4dc7f1;_0x117601[_0x8134('0x36')]=_[_0x8134('0x4c')](db['Team'][_0x8134('0x4d')]);_0x117601[_0x8134('0x38')]=_[_0x8134('0x4c')](_0xb40990[_0x8134('0x38')]);_0x117601[_0x8134('0x42')]=_[_0x8134('0x39')](_0x117601['model'],_0x117601[_0x8134('0x38')]);_0x140763[_0x8134('0x3b')]=_[_0x8134('0x39')](_0x117601[_0x8134('0x36')],qs[_0x8134('0x3a')](_0xb40990[_0x8134('0x38')][_0x8134('0x3a')]));_0x140763[_0x8134('0x3b')]=_0x140763[_0x8134('0x3b')][_0x8134('0x3c')]?_0x140763[_0x8134('0x3b')]:_0x117601['model'];_0x140763[_0x8134('0x3f')]=qs[_0x8134('0x40')](_0xb40990[_0x8134('0x38')][_0x8134('0x40')]);_0x140763[_0x8134('0x41')]=qs[_0x8134('0x42')](_[_0x8134('0x67')](_0xb40990[_0x8134('0x38')],_0x117601['filters']));if(_0xb40990[_0x8134('0x38')][_0x8134('0x43')]){_0x140763[_0x8134('0x41')]=_[_0x8134('0x44')](_0x140763['where'],{'$or':_[_0x8134('0x37')](_0x140763['attributes'],function(_0xe699a2){var _0x27d7cd={};_0x27d7cd[_0xe699a2]={'$like':'%'+_0xb40990['query']['filter']+'%'};return _0x27d7cd;})});}_0x140763=_[_0x8134('0x44')]({},_0x140763,_0xb40990[_0x8134('0x47')]);return _0x152d60[_0x8134('0x66')](_0x140763);}})['then'](function(_0x270e3d){if(_0x270e3d){_0x340761=_0x270e3d[_0x8134('0x3c')];if(!_0xb40990[_0x8134('0x38')][_0x8134('0x3d')](_0x8134('0x3e'))){_0x140763[_0x8134('0x21')]=qs['limit'](_0xb40990['query']['limit']);_0x140763[_0x8134('0x1f')]=qs[_0x8134('0x1f')](_0xb40990['query'][_0x8134('0x1f')]);}return _0x152d60['getTeams'](_0x140763);}})[_0x8134('0x27')](function(_0x3c1381){if(_0x3c1381){return _0x3c1381?{'count':_0x340761,'rows':_0x3c1381}:null;}})[_0x8134('0x27')](respondWithResult(_0x4ce4bc,null))['catch'](handleError(_0x4ce4bc,null));};exports[_0x8134('0x68')]=function(_0xea97cc,_0xdd65f3,_0x95f248){var _0x2c4fea=_0xea97cc['body'][_0x8134('0x69')];return db[_0x8134('0x6a')][_0x8134('0x49')]({'where':{'id':_0x2c4fea},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x8134('0x6b'),_0x8134('0x6c'),'interface'],'raw':!![]}]})[_0x8134('0x27')](function(_0x3165d6){if(_0x3165d6){var _0x446864=_[_0x8134('0x6d')](_0x3165d6,function(_0xad159c){var _0x441f15=_0xad159c['get']({'plain':!![]});return _0x441f15['Agents'];});return db[_0x8134('0x33')]['find']({'where':{'id':_0xea97cc['params']['id']}})[_0x8134('0x27')](function(_0xb16de4){return db['sequelize'][_0x8134('0x6e')](function(_0x15ad78){return _0xb16de4['addTeams'](_0x2c4fea,{'transaction':_0x15ad78})[_0x8134('0x27')](function(){return BPromise[_0x8134('0x6f')](_0x446864,function(_0x42fc0b){return db[_0x8134('0x5d')][_0x8134('0x70')]({'where':{'UserId':_0x42fc0b['id'],'WhatsappQueueId':_0xea97cc[_0x8134('0x4b')]['id']},'transaction':_0x15ad78});});})[_0x8134('0x27')](function(){_0x446864[_0x8134('0x71')](function(_0x20a837){socket['emit'](_0x8134('0x72'),{'UserId':_0x20a837['id'],'WhatsappQueueId':_0xb16de4['id']});});});});});}})[_0x8134('0x27')](respondWithStatusCode(_0xdd65f3,null))[_0x8134('0x58')](handleError(_0xdd65f3,null));};exports[_0x8134('0x73')]=function(_0x346176,_0x47ceb5,_0xf73773){return db[_0x8134('0x6a')][_0x8134('0x49')]({'where':{'id':_0x346176['query'][_0x8134('0x69')]},'attributes':['id'],'include':[{'model':db[_0x8134('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x47ceb5,null))[_0x8134('0x27')](function(_0x13bc8e){var _0x1b7ac7=_[_0x8134('0x37')](_0x13bc8e,'id');var _0x50bb9b=[];var _0x46bdc9=[];var _0x1bad71=squel[_0x8134('0x74')]();_0x1bad71['field']('tq.TeamId')[_0x8134('0x75')](_0x8134('0x76'),'tq')[_0x8134('0x77')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8134('0x41')](_0x8134('0x78'),_0x346176[_0x8134('0x4b')]['id']);for(var _0x26ecba=0x0;_0x26ecba<_0x13bc8e[_0x8134('0x3c')];_0x26ecba+=0x1){let _0x2234a2=_0x13bc8e[_0x26ecba];for(var _0x211026=0x0;_0x211026<_0x2234a2['Agents']['length'];_0x211026+=0x1){let _0x41d303=_0x2234a2['Agents'][_0x211026];var _0x49ef42=_0x1bad71['clone']();_0x49ef42[_0x8134('0x41')]('ut.UserId\x20=\x20?',_0x41d303['id']);_0x46bdc9[_0x8134('0x79')](db['sequelize'][_0x8134('0x38')](_0x49ef42[_0x8134('0x7a')](),{'type':db[_0x8134('0x7b')]['QueryTypes']['SELECT']})[_0x8134('0x27')](function(_0xa59459){if(_0xa59459['length']===0x1){return _0x41d303['id'];}else{var _0x5de8fc=_[_0x8134('0x7c')](_['map'](_0xa59459,_0x8134('0x7d')),function(_0x164f7f){return _[_0x8134('0x7e')](_0x1b7ac7,_0x164f7f);});if(_0x5de8fc){return _0x41d303['id'];}}}));}}return BPromise[_0x8134('0x7f')](_0x46bdc9)[_0x8134('0x27')](function(_0x540505){_0x50bb9b=_(_0x50bb9b)['union'](_0x540505)[_0x8134('0x80')]()[_0x8134('0x81')]();return db[_0x8134('0x33')][_0x8134('0x4f')]({'where':{'id':_0x346176[_0x8134('0x4b')]['id']}})['then'](function(_0x259bba){return db[_0x8134('0x7b')][_0x8134('0x6e')](function(_0x4d1c31){return _0x259bba[_0x8134('0x73')](_0x346176['query'][_0x8134('0x69')],{'transaction':_0x4d1c31})[_0x8134('0x27')](function(){if(!_[_0x8134('0x82')](_0x50bb9b)){return _0x259bba['removeAgents'](_0x50bb9b,{'transaction':_0x4d1c31});}})[_0x8134('0x27')](function(){_0x50bb9b['forEach'](function(_0x21b626){socket[_0x8134('0x83')](_0x8134('0x84'),{'UserId':_0x21b626,'WhatsappQueueId':_0x259bba['id']});});});});});});})[_0x8134('0x27')](respondWithStatusCode(_0x47ceb5,null))[_0x8134('0x58')](handleError(_0x47ceb5,null));};exports[_0x8134('0x85')]=function(_0x30d438,_0x1d6139,_0x571b83){return db[_0x8134('0x33')][_0x8134('0x4f')]({'where':{'id':_0x30d438[_0x8134('0x4b')]['id']}})[_0x8134('0x27')](handleEntityNotFound(_0x1d6139,null))[_0x8134('0x27')](function(_0x6a0d4f){if(_0x6a0d4f){return _0x6a0d4f['addAgents'](_0x30d438[_0x8134('0x2e')]['ids'],_['omit'](_0x30d438[_0x8134('0x2e')],[_0x8134('0x69'),'id'])||{})[_0x8134('0x86')](function(_0x1b24e4){for(var _0x6af7ad=0x0;_0x6af7ad<_0x30d438[_0x8134('0x2e')][_0x8134('0x69')][_0x8134('0x3c')];_0x6af7ad+=0x1){socket[_0x8134('0x83')](_0x8134('0x72'),{'UserId':_0x30d438[_0x8134('0x2e')][_0x8134('0x69')][_0x6af7ad],'WhatsappQueueId':_0x30d438[_0x8134('0x4b')]['id']});}return _0x1b24e4;});}})[_0x8134('0x27')](respondWithResult(_0x1d6139,null))[_0x8134('0x58')](handleError(_0x1d6139,null));};exports['removeAgents']=function(_0x1fba00,_0x4c86bf,_0x413a3d){return db[_0x8134('0x33')][_0x8134('0x4f')]({'where':{'id':_0x1fba00[_0x8134('0x4b')]['id']}})[_0x8134('0x27')](handleEntityNotFound(_0x4c86bf,null))[_0x8134('0x27')](function(_0x4ea63d){if(_0x4ea63d){return _0x4ea63d['removeAgents'](_0x1fba00[_0x8134('0x38')][_0x8134('0x69')])[_0x8134('0x27')](function(){if(_[_0x8134('0x87')](_0x1fba00['query'][_0x8134('0x69')])){for(var _0xc244a7=0x0;_0xc244a7<_0x1fba00['query'][_0x8134('0x69')]['length'];_0xc244a7+=0x1){socket['emit'](_0x8134('0x84'),{'UserId':Number(_0x1fba00[_0x8134('0x38')][_0x8134('0x69')][_0xc244a7]),'WhatsappQueueId':Number(_0x1fba00[_0x8134('0x4b')]['id'])});}}else{socket['emit'](_0x8134('0x84'),{'UserId':Number(_0x1fba00['query']['ids']),'WhatsappQueueId':Number(_0x1fba00[_0x8134('0x4b')]['id'])});}});}})[_0x8134('0x27')](respondWithStatusCode(_0x4c86bf,null))[_0x8134('0x58')](handleError(_0x4c86bf,null));};exports[_0x8134('0x88')]=function(_0x2e4235,_0x2bff5a,_0x40ed07){var _0x3d90c1={};var _0x1f032f={};var _0x3acce8;var _0x3946ce;return db['WhatsappQueue'][_0x8134('0x5c')]({'where':{'id':_0x2e4235['params']['id']}})[_0x8134('0x27')](handleEntityNotFound(_0x2bff5a,null))['then'](function(_0x53e955){if(_0x53e955){_0x3acce8=_0x53e955;_0x1f032f[_0x8134('0x36')]=_[_0x8134('0x4c')](db[_0x8134('0x5f')][_0x8134('0x4d')]);_0x1f032f['query']=_[_0x8134('0x4c')](_0x2e4235['query']);_0x1f032f['filters']=_[_0x8134('0x39')](_0x1f032f[_0x8134('0x36')],_0x1f032f['query']);_0x3d90c1['attributes']=_[_0x8134('0x39')](_0x1f032f[_0x8134('0x36')],qs[_0x8134('0x3a')](_0x2e4235[_0x8134('0x38')][_0x8134('0x3a')]));_0x3d90c1[_0x8134('0x3b')]=_0x3d90c1[_0x8134('0x3b')]['length']?_0x3d90c1[_0x8134('0x3b')]:_0x1f032f[_0x8134('0x36')];_0x3d90c1['order']=qs['sort'](_0x2e4235[_0x8134('0x38')]['sort']);_0x3d90c1['where']=qs['filters'](_[_0x8134('0x67')](_0x2e4235[_0x8134('0x38')],_0x1f032f[_0x8134('0x42')]));if(_0x2e4235[_0x8134('0x38')][_0x8134('0x43')]){_0x3d90c1[_0x8134('0x41')]=_[_0x8134('0x44')](_0x3d90c1[_0x8134('0x41')],{'$or':_['map'](_0x3d90c1[_0x8134('0x3b')],function(_0x8f5de5){var _0x19c8c0={};_0x19c8c0[_0x8f5de5]={'$like':'%'+_0x2e4235[_0x8134('0x38')]['filter']+'%'};return _0x19c8c0;})});}_0x3d90c1=_[_0x8134('0x44')]({},_0x3d90c1,_0x2e4235['options']);return _0x3acce8[_0x8134('0x88')](_0x3d90c1);}})[_0x8134('0x27')](function(_0x38b98e){if(_0x38b98e){_0x3946ce=_0x38b98e[_0x8134('0x3c')];if(!_0x2e4235['query'][_0x8134('0x3d')](_0x8134('0x3e'))){_0x3d90c1['limit']=qs[_0x8134('0x21')](_0x2e4235[_0x8134('0x38')][_0x8134('0x21')]);_0x3d90c1[_0x8134('0x1f')]=qs[_0x8134('0x1f')](_0x2e4235[_0x8134('0x38')][_0x8134('0x1f')]);}return _0x3acce8[_0x8134('0x88')](_0x3d90c1);}})['then'](function(_0x114b20){if(_0x114b20){return _0x114b20?{'count':_0x3946ce,'rows':_0x114b20}:null;}})[_0x8134('0x27')](respondWithResult(_0x2bff5a,null))['catch'](handleError(_0x2bff5a,null));}; \ No newline at end of file +var _0x6a00=['json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','render','merge','body','contact','agent','interaction','account','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','findAll','rows','catch','show','length','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','params','describe','WhatsappQueueId','options','UserWhatsappQueue','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','clone','toString','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status'];(function(_0x8c49c3,_0x27d179){var _0x2d6e46=function(_0x28661b){while(--_0x28661b){_0x8c49c3['push'](_0x8c49c3['shift']());}};_0x2d6e46(++_0x27d179);}(_0x6a00,0x183));var _0x06a0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6a00[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x06a0('0x0'));var rimraf=require(_0x06a0('0x1'));var zipdir=require(_0x06a0('0x2'));var jsonpatch=require(_0x06a0('0x3'));var rp=require(_0x06a0('0x4'));var moment=require(_0x06a0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x06a0('0x6'));var util=require(_0x06a0('0x7'));var path=require(_0x06a0('0x8'));var sox=require(_0x06a0('0x9'));var csv=require('to-csv');var ejs=require(_0x06a0('0xa'));var fs=require('fs');var fs_extra=require(_0x06a0('0xb'));var _=require(_0x06a0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x06a0('0xd'));var querystring=require(_0x06a0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x06a0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x06a0('0x10'));var hardwareService=require(_0x06a0('0x11'));var logger=require(_0x06a0('0x12'))(_0x06a0('0x13'));var utils=require(_0x06a0('0x14'));var config=require(_0x06a0('0x15'));var licenseUtil=require(_0x06a0('0x16'));var db=require('../../mysqldb')['db'];config[_0x06a0('0x17')]=_[_0x06a0('0x18')](config[_0x06a0('0x17')],{'host':_0x06a0('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x06a0('0x1a'))[_0x06a0('0x1b')](socket);function respondWithStatusCode(_0x45ef75,_0x5c2406){_0x5c2406=_0x5c2406||0xcc;return function(_0x58410b){if(_0x58410b){return _0x45ef75[_0x06a0('0x1c')](_0x5c2406);}return _0x45ef75['status'](_0x5c2406)['end']();};}function respondWithResult(_0x1e9ada,_0x103125){_0x103125=_0x103125||0xc8;return function(_0x4745e0){if(_0x4745e0){return _0x1e9ada[_0x06a0('0x1d')](_0x103125)[_0x06a0('0x1e')](_0x4745e0);}};}function respondWithFilteredResult(_0x2d5f8e,_0x5d18dc){return function(_0x1c64f1){if(_0x1c64f1){var _0x37dd2f=typeof _0x5d18dc[_0x06a0('0x1f')]==='undefined'&&typeof _0x5d18dc[_0x06a0('0x20')]===_0x06a0('0x21');var _0x19c21e=_0x1c64f1['count'];var _0x461e2f=_0x37dd2f?0x0:_0x5d18dc[_0x06a0('0x1f')];var _0x3da57c=_0x37dd2f?_0x1c64f1[_0x06a0('0x22')]:_0x5d18dc[_0x06a0('0x1f')]+_0x5d18dc[_0x06a0('0x20')];var _0x11ef33;if(_0x3da57c>=_0x19c21e){_0x3da57c=_0x19c21e;_0x11ef33=0xc8;}else{_0x11ef33=0xce;}_0x2d5f8e[_0x06a0('0x1d')](_0x11ef33);return _0x2d5f8e[_0x06a0('0x23')]('Content-Range',_0x461e2f+'-'+_0x3da57c+'/'+_0x19c21e)[_0x06a0('0x1e')](_0x1c64f1);}return null;};}function patchUpdates(_0x463870){return function(_0x551fc4){try{jsonpatch[_0x06a0('0x24')](_0x551fc4,_0x463870,!![]);}catch(_0x42edf3){return BPromise[_0x06a0('0x25')](_0x42edf3);}return _0x551fc4[_0x06a0('0x26')]();};}function saveUpdates(_0x5133ac,_0x53a44b){return function(_0x517e89){if(_0x517e89){return _0x517e89[_0x06a0('0x27')](_0x5133ac)[_0x06a0('0x28')](function(_0x3f60e0){return _0x3f60e0;});}return null;};}function removeEntity(_0x4f8c40,_0x31c622){return function(_0x6eae6b){if(_0x6eae6b){return _0x6eae6b[_0x06a0('0x29')]()['then'](function(){var _0x1beb08=_0x6eae6b[_0x06a0('0x2a')]({'plain':!![]});var _0x5a42c5=_0x06a0('0x2b');return db[_0x06a0('0x2c')]['destroy']({'where':{'type':_0x5a42c5,'resourceId':_0x1beb08['id']}})[_0x06a0('0x28')](function(){return _0x6eae6b;});})[_0x06a0('0x28')](function(){_0x4f8c40['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aaea0,_0x537318){return function(_0x43b4fa){if(!_0x43b4fa){_0x1aaea0[_0x06a0('0x1c')](0x194);}return _0x43b4fa;};}function handleError(_0xb602dd,_0x3d02a9){_0x3d02a9=_0x3d02a9||0x1f4;return function(_0x5581f){logger[_0x06a0('0x2d')](_0x5581f[_0x06a0('0x2e')]);if(_0x5581f['name']){delete _0x5581f[_0x06a0('0x2f')];}_0xb602dd[_0x06a0('0x1d')](_0x3d02a9)[_0x06a0('0x30')](_0x5581f);};}function getMustacheRender(_0x44dd8,_0x3f74c9){return Mustache[_0x06a0('0x31')](_0x44dd8,_[_0x06a0('0x32')](_0x3f74c9[_0x06a0('0x33')],{'contact':_0x3f74c9[_0x06a0('0x34')],'message':_0x3f74c9['message'],'agent':_0x3f74c9[_0x06a0('0x35')],'interaction':_0x3f74c9[_0x06a0('0x36')],'account':_0x3f74c9[_0x06a0('0x37')]}))||'';}exports['index']=function(_0x2ffe23,_0x1ae0dd){var _0x42cdb6={},_0x4b93ec={},_0x342ace={'count':0x0,'rows':[]};var _0x24e0f4=_[_0x06a0('0x38')](db[_0x06a0('0x39')][_0x06a0('0x3a')],function(_0x5815d6){return{'name':_0x5815d6[_0x06a0('0x3b')],'type':_0x5815d6[_0x06a0('0x3c')]['key']};});_0x4b93ec[_0x06a0('0x3d')]=_[_0x06a0('0x38')](_0x24e0f4,_0x06a0('0x2f'));_0x4b93ec[_0x06a0('0x3e')]=_[_0x06a0('0x3f')](_0x2ffe23[_0x06a0('0x3e')]);_0x4b93ec[_0x06a0('0x40')]=_[_0x06a0('0x41')](_0x4b93ec['model'],_0x4b93ec[_0x06a0('0x3e')]);_0x42cdb6['attributes']=_[_0x06a0('0x41')](_0x4b93ec['model'],qs[_0x06a0('0x42')](_0x2ffe23[_0x06a0('0x3e')]['fields']));_0x42cdb6['attributes']=_0x42cdb6[_0x06a0('0x43')]['length']?_0x42cdb6['attributes']:_0x4b93ec['model'];if(!_0x2ffe23[_0x06a0('0x3e')][_0x06a0('0x44')](_0x06a0('0x45'))){_0x42cdb6[_0x06a0('0x20')]=qs[_0x06a0('0x20')](_0x2ffe23[_0x06a0('0x3e')][_0x06a0('0x20')]);_0x42cdb6[_0x06a0('0x1f')]=qs['offset'](_0x2ffe23[_0x06a0('0x3e')][_0x06a0('0x1f')]);}_0x42cdb6[_0x06a0('0x46')]=qs['sort'](_0x2ffe23[_0x06a0('0x3e')][_0x06a0('0x47')]);_0x42cdb6['where']=qs['filters'](_[_0x06a0('0x48')](_0x2ffe23[_0x06a0('0x3e')],_0x4b93ec[_0x06a0('0x40')]),_0x24e0f4);if(_0x2ffe23[_0x06a0('0x3e')][_0x06a0('0x49')]){_0x42cdb6[_0x06a0('0x4a')]=_[_0x06a0('0x32')](_0x42cdb6['where'],{'$or':_[_0x06a0('0x38')](_0x24e0f4,function(_0x22e98a){if(_0x22e98a[_0x06a0('0x3c')]!=='VIRTUAL'){var _0x1cdae6={};_0x1cdae6[_0x22e98a[_0x06a0('0x2f')]]={'$like':'%'+_0x2ffe23['query'][_0x06a0('0x49')]+'%'};return _0x1cdae6;}})});}_0x42cdb6=_[_0x06a0('0x32')]({},_0x42cdb6,_0x2ffe23['options']);var _0x46b27e={'where':_0x42cdb6[_0x06a0('0x4a')]};return db[_0x06a0('0x39')][_0x06a0('0x22')](_0x46b27e)['then'](function(_0x387c41){_0x342ace[_0x06a0('0x22')]=_0x387c41;if(_0x2ffe23[_0x06a0('0x3e')]['includeAll']){_0x42cdb6['include']=[{'all':!![]}];}return db[_0x06a0('0x39')][_0x06a0('0x4b')](_0x42cdb6);})[_0x06a0('0x28')](function(_0x2f0854){_0x342ace[_0x06a0('0x4c')]=_0x2f0854;return _0x342ace;})[_0x06a0('0x28')](respondWithFilteredResult(_0x1ae0dd,_0x42cdb6))[_0x06a0('0x4d')](handleError(_0x1ae0dd,null));};exports[_0x06a0('0x4e')]=function(_0x70f2c4,_0x236b37){var _0x4e61aa={'raw':!![],'where':{'id':_0x70f2c4['params']['id']}},_0x561e4a={};_0x561e4a[_0x06a0('0x3d')]=_['keys'](db[_0x06a0('0x39')][_0x06a0('0x3a')]);_0x561e4a['query']=_['keys'](_0x70f2c4[_0x06a0('0x3e')]);_0x561e4a[_0x06a0('0x40')]=_['intersection'](_0x561e4a[_0x06a0('0x3d')],_0x561e4a['query']);_0x4e61aa[_0x06a0('0x43')]=_[_0x06a0('0x41')](_0x561e4a[_0x06a0('0x3d')],qs['fields'](_0x70f2c4[_0x06a0('0x3e')][_0x06a0('0x42')]));_0x4e61aa[_0x06a0('0x43')]=_0x4e61aa[_0x06a0('0x43')][_0x06a0('0x4f')]?_0x4e61aa['attributes']:_0x561e4a['model'];if(_0x70f2c4[_0x06a0('0x3e')][_0x06a0('0x50')]){_0x4e61aa[_0x06a0('0x51')]=[{'all':!![]}];}_0x4e61aa=_[_0x06a0('0x32')]({},_0x4e61aa,_0x70f2c4['options']);return db['WhatsappQueue'][_0x06a0('0x52')](_0x4e61aa)[_0x06a0('0x28')](handleEntityNotFound(_0x236b37,null))['then'](respondWithResult(_0x236b37,null))[_0x06a0('0x4d')](handleError(_0x236b37,null));};exports[_0x06a0('0x53')]=function(_0xeae537,_0xd82a84){return db[_0x06a0('0x39')][_0x06a0('0x53')](_0xeae537[_0x06a0('0x33')],{})[_0x06a0('0x28')](function(_0x3941a7){var _0x2a2839=_0xeae537[_0x06a0('0x54')][_0x06a0('0x2a')]({'plain':!![]});if(!_0x2a2839)throw new Error(_0x06a0('0x55'));if(_0x2a2839[_0x06a0('0x56')]===_0x06a0('0x54')){var _0x5de5f9=_0x3941a7['get']({'plain':!![]});var _0x1d9f5f=_0x06a0('0x2b');return db['UserProfileSection'][_0x06a0('0x52')]({'where':{'name':_0x1d9f5f,'userProfileId':_0x2a2839[_0x06a0('0x57')]},'raw':!![]})[_0x06a0('0x28')](function(_0x1bbda8){if(_0x1bbda8&&_0x1bbda8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5de5f9['name'],'resourceId':_0x5de5f9['id'],'type':_0x1bbda8[_0x06a0('0x2f')],'sectionId':_0x1bbda8['id']},{})[_0x06a0('0x28')](function(){return _0x3941a7;});}else{return _0x3941a7;}})[_0x06a0('0x4d')](function(_0x4c6037){logger[_0x06a0('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c6037);throw _0x4c6037;});}return _0x3941a7;})['then'](respondWithResult(_0xd82a84,0xc9))[_0x06a0('0x4d')](handleError(_0xd82a84,null));};exports[_0x06a0('0x27')]=function(_0x51953a,_0x4204ce){if(_0x51953a[_0x06a0('0x33')]['id']){delete _0x51953a[_0x06a0('0x33')]['id'];}return db[_0x06a0('0x39')][_0x06a0('0x52')]({'where':{'id':_0x51953a['params']['id']}})[_0x06a0('0x28')](handleEntityNotFound(_0x4204ce,null))['then'](saveUpdates(_0x51953a[_0x06a0('0x33')],null))[_0x06a0('0x28')](respondWithResult(_0x4204ce,null))[_0x06a0('0x4d')](handleError(_0x4204ce,null));};exports['destroy']=function(_0x33ff05,_0x2f7605){return db['WhatsappQueue']['find']({'where':{'id':_0x33ff05[_0x06a0('0x58')]['id']}})[_0x06a0('0x28')](handleEntityNotFound(_0x2f7605,null))[_0x06a0('0x28')](removeEntity(_0x2f7605,null))['catch'](handleError(_0x2f7605,null));};exports[_0x06a0('0x59')]=function(_0x4b0b2f,_0x53b7f2){return db['WhatsappQueue']['describe']()[_0x06a0('0x28')](respondWithResult(_0x53b7f2,null))[_0x06a0('0x4d')](handleError(_0x53b7f2,null));};exports['getMembers']=function(_0x49c910,_0x131c6c,_0x895401){var _0x138438={'raw':!![],'where':{}},_0x291665={},_0x515ba7;return db[_0x06a0('0x39')]['findOne']({'where':{'id':_0x49c910[_0x06a0('0x58')]['id']}})[_0x06a0('0x28')](handleEntityNotFound(_0x131c6c,null))[_0x06a0('0x28')](function(_0x3853e4){if(_0x3853e4){_0x515ba7=_0x3853e4[_0x06a0('0x2a')]({'plain':!![]});_0x291665['model']=_['keys'](db['UserWhatsappQueue'][_0x06a0('0x3a')]);_0x291665[_0x06a0('0x3e')]=_['keys'](_0x49c910[_0x06a0('0x3e')]);_0x291665[_0x06a0('0x40')]=_[_0x06a0('0x41')](_0x291665[_0x06a0('0x3d')],_0x291665[_0x06a0('0x3e')]);_0x138438['attributes']=_['intersection'](_0x291665['model'],qs[_0x06a0('0x42')](_0x49c910['query'][_0x06a0('0x42')]));_0x138438[_0x06a0('0x43')]=_0x138438['attributes'][_0x06a0('0x4f')]?_0x138438[_0x06a0('0x43')]:_0x291665[_0x06a0('0x3d')];if(!_0x49c910['query'][_0x06a0('0x44')](_0x06a0('0x45'))){_0x138438[_0x06a0('0x20')]=qs[_0x06a0('0x20')](_0x49c910['query'][_0x06a0('0x20')]);_0x138438[_0x06a0('0x1f')]=qs['offset'](_0x49c910['query'][_0x06a0('0x1f')]);}_0x138438['order']=qs[_0x06a0('0x47')](_0x49c910[_0x06a0('0x3e')][_0x06a0('0x47')]);_0x138438[_0x06a0('0x4a')]=qs[_0x06a0('0x40')](_['pick'](_0x49c910['query'],_0x291665[_0x06a0('0x40')]));_0x138438['where'][_0x06a0('0x5a')]=_0x3853e4['id'];if(_0x49c910[_0x06a0('0x3e')][_0x06a0('0x49')]){_0x138438['where']=_['merge'](_0x138438[_0x06a0('0x4a')],{'$or':_[_0x06a0('0x38')](_0x138438[_0x06a0('0x43')],function(_0x29ceb9){var _0x23f4bb={};_0x23f4bb[_0x29ceb9]={'$like':'%'+_0x49c910[_0x06a0('0x3e')][_0x06a0('0x49')]+'%'};return _0x23f4bb;})});}_0x138438=_[_0x06a0('0x32')]({},_0x138438,_0x49c910[_0x06a0('0x5b')]);return db[_0x06a0('0x5c')]['findAll'](_0x138438);}})[_0x06a0('0x28')](function(_0x25a50d){if(_0x25a50d){return db[_0x06a0('0x5d')][_0x06a0('0x5e')]({'where':{'id':_[_0x06a0('0x38')](_0x25a50d,_0x06a0('0x5f')),'role':_0x06a0('0x35')},'attributes':['id',_0x06a0('0x2f'),_0x06a0('0x60'),_0x06a0('0x61'),_0x06a0('0x62')]});}})[_0x06a0('0x28')](function(_0x5acbc4){if(_0x5acbc4){return{'count':_0x5acbc4[_0x06a0('0x22')],'rows':_[_0x06a0('0x38')](_0x5acbc4['rows'],function(_0x169f32){return{'membername':_0x169f32[_0x06a0('0x2f')],'UserId':_0x169f32['id'],'queue_name':_0x515ba7['name'],'WhatsappQueueId':_0x515ba7['id'],'interface':util['format']('%s/%s',_0x06a0('0x63'),_0x169f32[_0x06a0('0x2f')]),'penalty':0x0,'paused':_0x169f32[_0x06a0('0x60')],'createdAt':_0x169f32['createdAt'],'updatedAt':_0x169f32['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x06a0('0x28')](respondWithFilteredResult(_0x131c6c,_0x138438))[_0x06a0('0x4d')](handleError(_0x131c6c,null));};exports[_0x06a0('0x64')]=function(_0x5d5ad9,_0x22f0b0,_0x34c3c5){var _0x53ac50={};var _0x474eac={};var _0x11971d;var _0x7f3e5e;return db['WhatsappQueue']['findOne']({'where':{'id':_0x5d5ad9['params']['id']}})['then'](handleEntityNotFound(_0x22f0b0,null))[_0x06a0('0x28')](function(_0x1cb5a8){if(_0x1cb5a8){_0x11971d=_0x1cb5a8;_0x474eac[_0x06a0('0x3d')]=_['keys'](db[_0x06a0('0x65')]['rawAttributes']);_0x474eac[_0x06a0('0x3e')]=_['keys'](_0x5d5ad9['query']);_0x474eac[_0x06a0('0x40')]=_[_0x06a0('0x41')](_0x474eac[_0x06a0('0x3d')],_0x474eac['query']);_0x53ac50[_0x06a0('0x43')]=_[_0x06a0('0x41')](_0x474eac[_0x06a0('0x3d')],qs[_0x06a0('0x42')](_0x5d5ad9[_0x06a0('0x3e')][_0x06a0('0x42')]));_0x53ac50[_0x06a0('0x43')]=_0x53ac50[_0x06a0('0x43')]['length']?_0x53ac50[_0x06a0('0x43')]:_0x474eac[_0x06a0('0x3d')];_0x53ac50['order']=qs[_0x06a0('0x47')](_0x5d5ad9[_0x06a0('0x3e')][_0x06a0('0x47')]);_0x53ac50['where']=qs[_0x06a0('0x40')](_['pick'](_0x5d5ad9[_0x06a0('0x3e')],_0x474eac[_0x06a0('0x40')]));if(_0x5d5ad9[_0x06a0('0x3e')][_0x06a0('0x49')]){_0x53ac50[_0x06a0('0x4a')]=_[_0x06a0('0x32')](_0x53ac50[_0x06a0('0x4a')],{'$or':_[_0x06a0('0x38')](_0x53ac50['attributes'],function(_0x2f7e66){var _0x1dfe17={};_0x1dfe17[_0x2f7e66]={'$like':'%'+_0x5d5ad9[_0x06a0('0x3e')][_0x06a0('0x49')]+'%'};return _0x1dfe17;})});}_0x53ac50=_[_0x06a0('0x32')]({},_0x53ac50,_0x5d5ad9['options']);return _0x11971d['getTeams'](_0x53ac50);}})[_0x06a0('0x28')](function(_0x50a61b){if(_0x50a61b){_0x7f3e5e=_0x50a61b[_0x06a0('0x4f')];if(!_0x5d5ad9['query'][_0x06a0('0x44')](_0x06a0('0x45'))){_0x53ac50[_0x06a0('0x20')]=qs[_0x06a0('0x20')](_0x5d5ad9[_0x06a0('0x3e')][_0x06a0('0x20')]);_0x53ac50[_0x06a0('0x1f')]=qs[_0x06a0('0x1f')](_0x5d5ad9[_0x06a0('0x3e')][_0x06a0('0x1f')]);}return _0x11971d[_0x06a0('0x64')](_0x53ac50);}})[_0x06a0('0x28')](function(_0x509d9f){if(_0x509d9f){return _0x509d9f?{'count':_0x7f3e5e,'rows':_0x509d9f}:null;}})['then'](respondWithResult(_0x22f0b0,null))[_0x06a0('0x4d')](handleError(_0x22f0b0,null));};exports[_0x06a0('0x66')]=function(_0x5165fe,_0xf359dd,_0x561376){var _0x33edb8=_0x5165fe['body'][_0x06a0('0x67')];return db[_0x06a0('0x65')]['findAll']({'where':{'id':_0x33edb8},'attributes':['id'],'include':[{'model':db[_0x06a0('0x5d')],'as':_0x06a0('0x68'),'attributes':['id',_0x06a0('0x2f'),_0x06a0('0x69'),_0x06a0('0x6a'),_0x06a0('0x6b')],'raw':!![]}]})[_0x06a0('0x28')](function(_0x3487b7){if(_0x3487b7){var _0x80258=_['flatMap'](_0x3487b7,function(_0x5d03b6){var _0x148752=_0x5d03b6[_0x06a0('0x2a')]({'plain':!![]});return _0x148752[_0x06a0('0x68')];});return db[_0x06a0('0x39')][_0x06a0('0x52')]({'where':{'id':_0x5165fe[_0x06a0('0x58')]['id']}})[_0x06a0('0x28')](function(_0x3d238d){return db[_0x06a0('0x6c')][_0x06a0('0x6d')](function(_0x33d140){return _0x3d238d[_0x06a0('0x66')](_0x33edb8,{'transaction':_0x33d140})['then'](function(){return BPromise[_0x06a0('0x6e')](_0x80258,function(_0xfe0c55){return db[_0x06a0('0x5c')]['findOrCreate']({'where':{'UserId':_0xfe0c55['id'],'WhatsappQueueId':_0x5165fe[_0x06a0('0x58')]['id']},'transaction':_0x33d140});});})[_0x06a0('0x28')](function(){_0x80258['forEach'](function(_0x702f42){socket[_0x06a0('0x6f')](_0x06a0('0x70'),{'UserId':_0x702f42['id'],'WhatsappQueueId':_0x3d238d['id']});});});});});}})[_0x06a0('0x28')](respondWithStatusCode(_0xf359dd,null))[_0x06a0('0x4d')](handleError(_0xf359dd,null));};exports[_0x06a0('0x71')]=function(_0x3011fa,_0x1e8610,_0x1aed87){return db[_0x06a0('0x65')]['findAll']({'where':{'id':_0x3011fa[_0x06a0('0x3e')][_0x06a0('0x67')]},'attributes':['id'],'include':[{'model':db[_0x06a0('0x5d')],'as':_0x06a0('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e8610,null))[_0x06a0('0x28')](function(_0x220e66){var _0x7d51cf=_['map'](_0x220e66,'id');var _0x40699a=[];var _0x8de7f8=[];var _0x1551f3=squel[_0x06a0('0x72')]();_0x1551f3[_0x06a0('0x73')](_0x06a0('0x74'))[_0x06a0('0x75')](_0x06a0('0x76'),'tq')[_0x06a0('0x77')](_0x06a0('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x06a0('0x4a')]('WhatsappQueueId\x20=\x20?',_0x3011fa[_0x06a0('0x58')]['id']);for(var _0x1abdc0=0x0;_0x1abdc0<_0x220e66[_0x06a0('0x4f')];_0x1abdc0+=0x1){let _0x559636=_0x220e66[_0x1abdc0];for(var _0xb89293=0x0;_0xb89293<_0x559636[_0x06a0('0x68')][_0x06a0('0x4f')];_0xb89293+=0x1){let _0x3c1abb=_0x559636['Agents'][_0xb89293];var _0x42d6f1=_0x1551f3[_0x06a0('0x79')]();_0x42d6f1[_0x06a0('0x4a')]('ut.UserId\x20=\x20?',_0x3c1abb['id']);_0x8de7f8['push'](db[_0x06a0('0x6c')]['query'](_0x42d6f1[_0x06a0('0x7a')](),{'type':db[_0x06a0('0x6c')]['QueryTypes'][_0x06a0('0x7b')]})['then'](function(_0x6f8b55){if(_0x6f8b55[_0x06a0('0x4f')]===0x1){return _0x3c1abb['id'];}else{var _0x4f29eb=_[_0x06a0('0x7c')](_[_0x06a0('0x38')](_0x6f8b55,_0x06a0('0x7d')),function(_0x31efa0){return _[_0x06a0('0x7e')](_0x7d51cf,_0x31efa0);});if(_0x4f29eb){return _0x3c1abb['id'];}}}));}}return BPromise[_0x06a0('0x7f')](_0x8de7f8)[_0x06a0('0x28')](function(_0x2c2e25){_0x40699a=_(_0x40699a)[_0x06a0('0x80')](_0x2c2e25)['compact']()['value']();return db[_0x06a0('0x39')][_0x06a0('0x52')]({'where':{'id':_0x3011fa[_0x06a0('0x58')]['id']}})[_0x06a0('0x28')](function(_0x47befe){return db[_0x06a0('0x6c')][_0x06a0('0x6d')](function(_0x2a5adf){return _0x47befe[_0x06a0('0x71')](_0x3011fa[_0x06a0('0x3e')][_0x06a0('0x67')],{'transaction':_0x2a5adf})[_0x06a0('0x28')](function(){if(!_[_0x06a0('0x81')](_0x40699a)){return _0x47befe[_0x06a0('0x82')](_0x40699a,{'transaction':_0x2a5adf});}})[_0x06a0('0x28')](function(){_0x40699a[_0x06a0('0x83')](function(_0xcab7b5){socket[_0x06a0('0x6f')](_0x06a0('0x84'),{'UserId':_0xcab7b5,'WhatsappQueueId':_0x47befe['id']});});});});});});})['then'](respondWithStatusCode(_0x1e8610,null))[_0x06a0('0x4d')](handleError(_0x1e8610,null));};exports[_0x06a0('0x85')]=function(_0xb463f7,_0x435ce1,_0x8b19fb){return db['WhatsappQueue'][_0x06a0('0x52')]({'where':{'id':_0xb463f7['params']['id']}})[_0x06a0('0x28')](handleEntityNotFound(_0x435ce1,null))['then'](function(_0xd75cd1){if(_0xd75cd1){return _0xd75cd1[_0x06a0('0x85')](_0xb463f7['body'][_0x06a0('0x67')],_[_0x06a0('0x86')](_0xb463f7[_0x06a0('0x33')],['ids','id'])||{})[_0x06a0('0x87')](function(_0x343dec){for(var _0x16176a=0x0;_0x16176a<_0xb463f7[_0x06a0('0x33')][_0x06a0('0x67')][_0x06a0('0x4f')];_0x16176a+=0x1){socket[_0x06a0('0x6f')](_0x06a0('0x70'),{'UserId':_0xb463f7['body'][_0x06a0('0x67')][_0x16176a],'WhatsappQueueId':_0xb463f7[_0x06a0('0x58')]['id']});}return _0x343dec;});}})['then'](respondWithResult(_0x435ce1,null))['catch'](handleError(_0x435ce1,null));};exports['removeAgents']=function(_0x4a9225,_0x2b3a3f,_0xc17ebf){return db[_0x06a0('0x39')]['find']({'where':{'id':_0x4a9225[_0x06a0('0x58')]['id']}})[_0x06a0('0x28')](handleEntityNotFound(_0x2b3a3f,null))['then'](function(_0x18b1f1){if(_0x18b1f1){return _0x18b1f1[_0x06a0('0x82')](_0x4a9225[_0x06a0('0x3e')][_0x06a0('0x67')])[_0x06a0('0x28')](function(){if(_[_0x06a0('0x88')](_0x4a9225[_0x06a0('0x3e')][_0x06a0('0x67')])){for(var _0x1f8739=0x0;_0x1f8739<_0x4a9225[_0x06a0('0x3e')]['ids']['length'];_0x1f8739+=0x1){socket[_0x06a0('0x6f')](_0x06a0('0x84'),{'UserId':Number(_0x4a9225[_0x06a0('0x3e')][_0x06a0('0x67')][_0x1f8739]),'WhatsappQueueId':Number(_0x4a9225[_0x06a0('0x58')]['id'])});}}else{socket[_0x06a0('0x6f')]('userWhatsappQueue:remove',{'UserId':Number(_0x4a9225[_0x06a0('0x3e')][_0x06a0('0x67')]),'WhatsappQueueId':Number(_0x4a9225[_0x06a0('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x2b3a3f,null))[_0x06a0('0x4d')](handleError(_0x2b3a3f,null));};exports[_0x06a0('0x89')]=function(_0x220106,_0x4bc76b,_0x2a5e34){var _0x2b2fc7={};var _0x40a8e0={};var _0x4b968a;var _0x50cc8e;return db[_0x06a0('0x39')][_0x06a0('0x8a')]({'where':{'id':_0x220106[_0x06a0('0x58')]['id']}})[_0x06a0('0x28')](handleEntityNotFound(_0x4bc76b,null))[_0x06a0('0x28')](function(_0x23d2f5){if(_0x23d2f5){_0x4b968a=_0x23d2f5;_0x40a8e0['model']=_['keys'](db[_0x06a0('0x5d')][_0x06a0('0x3a')]);_0x40a8e0[_0x06a0('0x3e')]=_[_0x06a0('0x3f')](_0x220106[_0x06a0('0x3e')]);_0x40a8e0['filters']=_['intersection'](_0x40a8e0[_0x06a0('0x3d')],_0x40a8e0['query']);_0x2b2fc7[_0x06a0('0x43')]=_[_0x06a0('0x41')](_0x40a8e0['model'],qs['fields'](_0x220106[_0x06a0('0x3e')][_0x06a0('0x42')]));_0x2b2fc7['attributes']=_0x2b2fc7[_0x06a0('0x43')][_0x06a0('0x4f')]?_0x2b2fc7['attributes']:_0x40a8e0[_0x06a0('0x3d')];_0x2b2fc7[_0x06a0('0x46')]=qs['sort'](_0x220106[_0x06a0('0x3e')][_0x06a0('0x47')]);_0x2b2fc7['where']=qs[_0x06a0('0x40')](_[_0x06a0('0x48')](_0x220106[_0x06a0('0x3e')],_0x40a8e0['filters']));if(_0x220106[_0x06a0('0x3e')][_0x06a0('0x49')]){_0x2b2fc7['where']=_[_0x06a0('0x32')](_0x2b2fc7[_0x06a0('0x4a')],{'$or':_['map'](_0x2b2fc7[_0x06a0('0x43')],function(_0x30bc8e){var _0x21a351={};_0x21a351[_0x30bc8e]={'$like':'%'+_0x220106[_0x06a0('0x3e')][_0x06a0('0x49')]+'%'};return _0x21a351;})});}_0x2b2fc7=_[_0x06a0('0x32')]({},_0x2b2fc7,_0x220106[_0x06a0('0x5b')]);return _0x4b968a[_0x06a0('0x89')](_0x2b2fc7);}})['then'](function(_0x3489f3){if(_0x3489f3){_0x50cc8e=_0x3489f3[_0x06a0('0x4f')];if(!_0x220106[_0x06a0('0x3e')]['hasOwnProperty']('nolimit')){_0x2b2fc7[_0x06a0('0x20')]=qs[_0x06a0('0x20')](_0x220106[_0x06a0('0x3e')][_0x06a0('0x20')]);_0x2b2fc7['offset']=qs['offset'](_0x220106[_0x06a0('0x3e')][_0x06a0('0x1f')]);}return _0x4b968a['getAgents'](_0x2b2fc7);}})[_0x06a0('0x28')](function(_0x5c3f51){if(_0x5c3f51){return _0x5c3f51?{'count':_0x50cc8e,'rows':_0x5c3f51}:null;}})[_0x06a0('0x28')](respondWithResult(_0x4bc76b,null))[_0x06a0('0x4d')](handleError(_0x4bc76b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 43e8843..05cd217 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 _0xee36=['update','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x1a45a3,_0xfcc0c6){var _0x844909=function(_0x57c9db){while(--_0x57c9db){_0x1a45a3['push'](_0x1a45a3['shift']());}};_0x844909(++_0xfcc0c6);}(_0xee36,0x1f4));var _0x6ee3=function(_0x1f398f,_0x1db69f){_0x1f398f=_0x1f398f-0x0;var _0x2c88d3=_0xee36[_0x1f398f];return _0x2c88d3;};'use strict';var EventEmitter=require(_0x6ee3('0x0'));var WhatsappQueue=require(_0x6ee3('0x1'))['db'][_0x6ee3('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6ee3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ee3('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa40b26){return function(_0x50f42c,_0x53aeaf,_0x237d9d){WhatsappQueueEvents['emit'](_0xa40b26+':'+_0x50f42c['id'],_0x50f42c);WhatsappQueueEvents[_0x6ee3('0x5')](_0xa40b26,_0x50f42c);_0x237d9d(null);};}for(var e in events){if(events[_0x6ee3('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x6ee3('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x0d29=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x3da312,_0x391ccd){var _0x28fb08=function(_0x1792bf){while(--_0x1792bf){_0x3da312['push'](_0x3da312['shift']());}};_0x28fb08(++_0x391ccd);}(_0x0d29,0xb4));var _0x90d2=function(_0x413a0e,_0x46c5fc){_0x413a0e=_0x413a0e-0x0;var _0x2c2a98=_0x0d29[_0x413a0e];return _0x2c2a98;};'use strict';var EventEmitter=require(_0x90d2('0x0'));var WhatsappQueue=require(_0x90d2('0x1'))['db'][_0x90d2('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x90d2('0x3')](0x0);var events={'afterCreate':_0x90d2('0x4'),'afterUpdate':_0x90d2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x35be37){return function(_0x2623b2,_0x2cd663,_0x1116b7){WhatsappQueueEvents[_0x90d2('0x6')](_0x35be37+':'+_0x2623b2['id'],_0x2623b2);WhatsappQueueEvents[_0x90d2('0x6')](_0x35be37,_0x2623b2);_0x1116b7(null);};}for(var e in events){if(events[_0x90d2('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x90d2('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 90fab36..d30393f 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 _0xae09=['rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xae09,0x10b));var _0x9ae0=function(_0x25db45,_0xa6675a){_0x25db45=_0x25db45-0x0;var _0x4f4f4e=_0xae09[_0x25db45];return _0x4f4f4e;};'use strict';var _=require('lodash');var util=require(_0x9ae0('0x0'));var logger=require(_0x9ae0('0x1'))(_0x9ae0('0x2'));var moment=require(_0x9ae0('0x3'));var BPromise=require('bluebird');var rp=require(_0x9ae0('0x4'));var fs=require('fs');var path=require(_0x9ae0('0x5'));var rimraf=require(_0x9ae0('0x6'));var config=require(_0x9ae0('0x7'));var attributes=require(_0x9ae0('0x8'));module[_0x9ae0('0x9')]=function(_0x13f195,_0x553422){return _0x13f195[_0x9ae0('0xa')](_0x9ae0('0xb'),attributes,{'tableName':_0x9ae0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74a5=['whatsapp_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','WhatsappQueue'];(function(_0x3e465a,_0x762b6b){var _0x204a35=function(_0x197152){while(--_0x197152){_0x3e465a['push'](_0x3e465a['shift']());}};_0x204a35(++_0x762b6b);}(_0x74a5,0x83));var _0x574a=function(_0x457e16,_0x427f04){_0x457e16=_0x457e16-0x0;var _0x564cef=_0x74a5[_0x457e16];return _0x564cef;};'use strict';var _=require('lodash');var util=require(_0x574a('0x0'));var logger=require(_0x574a('0x1'))(_0x574a('0x2'));var moment=require('moment');var BPromise=require(_0x574a('0x3'));var rp=require(_0x574a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x574a('0x5'));var config=require(_0x574a('0x6'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x2fb52e,_0x2760da){return _0x2fb52e[_0x574a('0x7')](_0x574a('0x8'),attributes,{'tableName':_0x574a('0x9'),'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 d45ff32..764b102 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 _0xa88d=['../../config/logger','jayson/promise','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetWhatsappQueue','ShowWhatsappQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3da39a,_0x10b4c8){var _0x25894d=function(_0x55598d){while(--_0x55598d){_0x3da39a['push'](_0x3da39a['shift']());}};_0x25894d(++_0x10b4c8);}(_0xa88d,0x71));var _0xda88=function(_0x5bf02f,_0x4839d4){_0x5bf02f=_0x5bf02f-0x0;var _0x5e2b7d=_0xa88d[_0x5bf02f];return _0x5e2b7d;};'use strict';var _=require(_0xda88('0x0'));var util=require('util');var moment=require(_0xda88('0x1'));var BPromise=require(_0xda88('0x2'));var rs=require(_0xda88('0x3'));var fs=require('fs');var Redis=require(_0xda88('0x4'));var db=require(_0xda88('0x5'))['db'];var utils=require(_0xda88('0x6'));var logger=require(_0xda88('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda88('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xda88('0x9')](config[_0xda88('0xa')],{'host':_0xda88('0xb'),'port':0x18eb});var socket=require(_0xda88('0xc'))(new Redis(config[_0xda88('0xa')]));require(_0xda88('0xd'))[_0xda88('0xe')](socket);function respondWithRpcPromise(_0x321758,_0x102069,_0x48036f){return new BPromise(function(_0x2b64f4,_0x1ff5c3){return client[_0xda88('0xf')](_0x321758,_0x48036f)['then'](function(_0x2a8686){logger['info'](_0xda88('0x10'),_0x102069,'request\x20sent');logger[_0xda88('0x11')](_0xda88('0x12'),_0x102069,_0xda88('0x13'),JSON[_0xda88('0x14')](_0x2a8686));if(_0x2a8686['error']){if(_0x2a8686[_0xda88('0x15')][_0xda88('0x16')]===0x1f4){logger[_0xda88('0x15')](_0xda88('0x10'),_0x102069,_0x2a8686[_0xda88('0x15')][_0xda88('0x17')]);return _0x1ff5c3(_0x2a8686['error'][_0xda88('0x17')]);}logger[_0xda88('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x102069,_0x2a8686[_0xda88('0x15')][_0xda88('0x17')]);return _0x2b64f4(_0x2a8686[_0xda88('0x15')]['message']);}else{logger['info'](_0xda88('0x10'),_0x102069,_0xda88('0x13'));_0x2b64f4(_0x2a8686[_0xda88('0x18')][_0xda88('0x17')]);}})[_0xda88('0x19')](function(_0x56dd8f){logger[_0xda88('0x15')](_0xda88('0x10'),_0x102069,_0x56dd8f);_0x1ff5c3(_0x56dd8f);});});}exports['GetWhatsappQueue']=function(_0x1e8ab0){var _0x5cc987=this;return new Promise(function(_0x589aaa,_0x2691ed){return db[_0xda88('0x1a')][_0xda88('0x1b')]({'raw':_0x1e8ab0[_0xda88('0x1c')]?_0x1e8ab0[_0xda88('0x1c')][_0xda88('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e8ab0['options']?_0x1e8ab0[_0xda88('0x1c')][_0xda88('0x1e')]||null:null,'attributes':_0x1e8ab0['options']?_0x1e8ab0[_0xda88('0x1c')][_0xda88('0x1f')]||null:null,'limit':_0x1e8ab0['options']?_0x1e8ab0[_0xda88('0x1c')][_0xda88('0x20')]||null:null,'include':_0x1e8ab0[_0xda88('0x1c')]?_0x1e8ab0['options'][_0xda88('0x21')]?_['map'](_0x1e8ab0['options'][_0xda88('0x21')],function(_0x9bb153){return{'model':db[_0x9bb153['model']],'as':_0x9bb153['as'],'attributes':_0x9bb153[_0xda88('0x1f')],'include':_0x9bb153[_0xda88('0x21')]?_[_0xda88('0x22')](_0x9bb153[_0xda88('0x21')],function(_0x5c1068){return{'model':db[_0x5c1068['model']],'as':_0x5c1068['as'],'attributes':_0x5c1068[_0xda88('0x1f')],'include':_0x5c1068[_0xda88('0x21')]?_[_0xda88('0x22')](_0x5c1068[_0xda88('0x21')],function(_0x1ccd17){return{'model':db[_0x1ccd17[_0xda88('0x23')]],'as':_0x1ccd17['as'],'attributes':_0x1ccd17[_0xda88('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xda88('0x24')](function(_0x1c40c6){logger[_0xda88('0x25')](_0xda88('0x26'),_0x1e8ab0);logger[_0xda88('0x11')]('GetWhatsappQueue',_0x1e8ab0,JSON[_0xda88('0x14')](_0x1c40c6));_0x589aaa(_0x1c40c6);})['catch'](function(_0xf7bd32){logger[_0xda88('0x15')](_0xda88('0x26'),_0xf7bd32[_0xda88('0x17')],_0x1e8ab0);_0x2691ed(_0x5cc987[_0xda88('0x15')](0x1f4,_0xf7bd32['message']));});});};exports[_0xda88('0x27')]=function(_0x41eecf){var _0x3ed380=this;return new Promise(function(_0x16db6c,_0x4b717e){return db[_0xda88('0x1a')]['find']({'raw':_0x41eecf['options']?_0x41eecf[_0xda88('0x1c')][_0xda88('0x1d')]===undefined?!![]:![]:!![],'where':_0x41eecf[_0xda88('0x1c')]?_0x41eecf[_0xda88('0x1c')][_0xda88('0x1e')]||null:null,'attributes':_0x41eecf[_0xda88('0x1c')]?_0x41eecf[_0xda88('0x1c')][_0xda88('0x1f')]||null:null,'include':_0x41eecf[_0xda88('0x1c')]?_0x41eecf[_0xda88('0x1c')][_0xda88('0x21')]?_[_0xda88('0x22')](_0x41eecf[_0xda88('0x1c')][_0xda88('0x21')],function(_0x40dc17){return{'model':db[_0x40dc17['model']],'as':_0x40dc17['as'],'attributes':_0x40dc17[_0xda88('0x1f')],'include':_0x40dc17[_0xda88('0x21')]?_['map'](_0x40dc17[_0xda88('0x21')],function(_0x13c2eb){return{'model':db[_0x13c2eb[_0xda88('0x23')]],'as':_0x13c2eb['as'],'attributes':_0x13c2eb[_0xda88('0x1f')],'include':_0x13c2eb[_0xda88('0x21')]?_[_0xda88('0x22')](_0x13c2eb['include'],function(_0x829765){return{'model':db[_0x829765[_0xda88('0x23')]],'as':_0x829765['as'],'attributes':_0x829765['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xde2cbc){logger[_0xda88('0x25')](_0xda88('0x27'),_0x41eecf);logger[_0xda88('0x11')](_0xda88('0x27'),_0x41eecf,JSON['stringify'](_0xde2cbc));_0x16db6c(_0xde2cbc);})[_0xda88('0x19')](function(_0xb08d47){logger[_0xda88('0x15')]('ShowWhatsappQueue',_0xb08d47['message'],_0x41eecf);_0x4b717e(_0x3ed380['error'](0x1f4,_0xb08d47[_0xda88('0x17')]));});});}; \ No newline at end of file +var _0xacae=['message','WhatsappQueue,\x20%s,\x20%s','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','map','include','model','ShowWhatsappQueue','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x46fd05,_0x2a121d){var _0xdcbee=function(_0x32967f){while(--_0x32967f){_0x46fd05['push'](_0x46fd05['shift']());}};_0xdcbee(++_0x2a121d);}(_0xacae,0x166));var _0xeaca=function(_0x5e32e3,_0x422cd5){_0x5e32e3=_0x5e32e3-0x0;var _0x5df07c=_0xacae[_0x5e32e3];return _0x5df07c;};'use strict';var _=require(_0xeaca('0x0'));var util=require(_0xeaca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeaca('0x2'));var fs=require('fs');var Redis=require(_0xeaca('0x3'));var db=require(_0xeaca('0x4'))['db'];var utils=require(_0xeaca('0x5'));var logger=require('../../config/logger')(_0xeaca('0x6'));var config=require(_0xeaca('0x7'));var jayson=require(_0xeaca('0x8'));var client=jayson[_0xeaca('0x9')]['http']({'port':0x232a});config[_0xeaca('0xa')]=_[_0xeaca('0xb')](config['redis'],{'host':_0xeaca('0xc'),'port':0x18eb});var socket=require(_0xeaca('0xd'))(new Redis(config['redis']));require(_0xeaca('0xe'))['register'](socket);function respondWithRpcPromise(_0x57a7a3,_0x4b5a82,_0x107e27){return new BPromise(function(_0x26f5fe,_0x2143d4){return client[_0xeaca('0xf')](_0x57a7a3,_0x107e27)[_0xeaca('0x10')](function(_0x322ad7){logger[_0xeaca('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x4b5a82,'request\x20sent');logger['debug'](_0xeaca('0x12'),_0x4b5a82,_0xeaca('0x13'),JSON[_0xeaca('0x14')](_0x322ad7));if(_0x322ad7['error']){if(_0x322ad7[_0xeaca('0x15')]['code']===0x1f4){logger[_0xeaca('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4b5a82,_0x322ad7[_0xeaca('0x15')][_0xeaca('0x16')]);return _0x2143d4(_0x322ad7['error'][_0xeaca('0x16')]);}logger[_0xeaca('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4b5a82,_0x322ad7[_0xeaca('0x15')][_0xeaca('0x16')]);return _0x26f5fe(_0x322ad7[_0xeaca('0x15')]['message']);}else{logger[_0xeaca('0x11')](_0xeaca('0x17'),_0x4b5a82,_0xeaca('0x13'));_0x26f5fe(_0x322ad7[_0xeaca('0x18')][_0xeaca('0x16')]);}})[_0xeaca('0x19')](function(_0x4d783a){logger[_0xeaca('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4b5a82,_0x4d783a);_0x2143d4(_0x4d783a);});});}exports[_0xeaca('0x1a')]=function(_0x3fe676){var _0x2512fc=this;return new Promise(function(_0xc32a9f,_0x234d56){return db[_0xeaca('0x1b')][_0xeaca('0x1c')]({'raw':_0x3fe676[_0xeaca('0x1d')]?_0x3fe676['options'][_0xeaca('0x1e')]===undefined?!![]:![]:!![],'where':_0x3fe676[_0xeaca('0x1d')]?_0x3fe676[_0xeaca('0x1d')][_0xeaca('0x1f')]||null:null,'attributes':_0x3fe676[_0xeaca('0x1d')]?_0x3fe676[_0xeaca('0x1d')][_0xeaca('0x20')]||null:null,'limit':_0x3fe676[_0xeaca('0x1d')]?_0x3fe676[_0xeaca('0x1d')]['limit']||null:null,'include':_0x3fe676['options']?_0x3fe676[_0xeaca('0x1d')]['include']?_[_0xeaca('0x21')](_0x3fe676['options'][_0xeaca('0x22')],function(_0x3cab12){return{'model':db[_0x3cab12[_0xeaca('0x23')]],'as':_0x3cab12['as'],'attributes':_0x3cab12[_0xeaca('0x20')],'include':_0x3cab12[_0xeaca('0x22')]?_[_0xeaca('0x21')](_0x3cab12[_0xeaca('0x22')],function(_0x297e79){return{'model':db[_0x297e79[_0xeaca('0x23')]],'as':_0x297e79['as'],'attributes':_0x297e79['attributes'],'include':_0x297e79[_0xeaca('0x22')]?_[_0xeaca('0x21')](_0x297e79[_0xeaca('0x22')],function(_0x1165fa){return{'model':db[_0x1165fa[_0xeaca('0x23')]],'as':_0x1165fa['as'],'attributes':_0x1165fa[_0xeaca('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeaca('0x10')](function(_0x188fcc){logger[_0xeaca('0x11')](_0xeaca('0x1a'),_0x3fe676);logger['debug'](_0xeaca('0x1a'),_0x3fe676,JSON[_0xeaca('0x14')](_0x188fcc));_0xc32a9f(_0x188fcc);})[_0xeaca('0x19')](function(_0x3272b6){logger[_0xeaca('0x15')](_0xeaca('0x1a'),_0x3272b6['message'],_0x3fe676);_0x234d56(_0x2512fc['error'](0x1f4,_0x3272b6['message']));});});};exports['ShowWhatsappQueue']=function(_0x5dbbeb){var _0x51ebba=this;return new Promise(function(_0x3c990c,_0x10fa46){return db[_0xeaca('0x1b')]['find']({'raw':_0x5dbbeb[_0xeaca('0x1d')]?_0x5dbbeb[_0xeaca('0x1d')][_0xeaca('0x1e')]===undefined?!![]:![]:!![],'where':_0x5dbbeb['options']?_0x5dbbeb['options'][_0xeaca('0x1f')]||null:null,'attributes':_0x5dbbeb['options']?_0x5dbbeb[_0xeaca('0x1d')]['attributes']||null:null,'include':_0x5dbbeb[_0xeaca('0x1d')]?_0x5dbbeb[_0xeaca('0x1d')][_0xeaca('0x22')]?_[_0xeaca('0x21')](_0x5dbbeb[_0xeaca('0x1d')][_0xeaca('0x22')],function(_0x63148d){return{'model':db[_0x63148d[_0xeaca('0x23')]],'as':_0x63148d['as'],'attributes':_0x63148d[_0xeaca('0x20')],'include':_0x63148d[_0xeaca('0x22')]?_[_0xeaca('0x21')](_0x63148d[_0xeaca('0x22')],function(_0xe54004){return{'model':db[_0xe54004[_0xeaca('0x23')]],'as':_0xe54004['as'],'attributes':_0xe54004[_0xeaca('0x20')],'include':_0xe54004[_0xeaca('0x22')]?_[_0xeaca('0x21')](_0xe54004[_0xeaca('0x22')],function(_0xd3e486){return{'model':db[_0xd3e486[_0xeaca('0x23')]],'as':_0xd3e486['as'],'attributes':_0xd3e486[_0xeaca('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeaca('0x10')](function(_0xa60f19){logger['info'](_0xeaca('0x24'),_0x5dbbeb);logger[_0xeaca('0x25')](_0xeaca('0x24'),_0x5dbbeb,JSON['stringify'](_0xa60f19));_0x3c990c(_0xa60f19);})[_0xeaca('0x19')](function(_0x588b8b){logger[_0xeaca('0x15')](_0xeaca('0x24'),_0x588b8b[_0xeaca('0x16')],_0x5dbbeb);_0x10fa46(_0x51ebba[_0xeaca('0x15')](0x1f4,_0x588b8b[_0xeaca('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 24913f7..16d5745 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 _0xf097=['removeListener','register','./whatsappQueue.events','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf097,0x1b2));var _0x7f09=function(_0x211a95,_0x3a7951){_0x211a95=_0x211a95-0x0;var _0x4f8368=_0xf097[_0x211a95];return _0x4f8368;};'use strict';var WhatsappQueueEvents=require(_0x7f09('0x0'));var events=[_0x7f09('0x1'),_0x7f09('0x2'),_0x7f09('0x3')];function createListener(_0x90f42e,_0x168ccd){return function(_0x45263e){_0x168ccd['emit'](_0x90f42e,_0x45263e);};}function removeListener(_0x4a510b,_0x54b149){return function(){WhatsappQueueEvents[_0x7f09('0x4')](_0x4a510b,_0x54b149);};}exports[_0x7f09('0x5')]=function(_0x3afb02){for(var _0x44ef71=0x0,_0x3c1103=events['length'];_0x44ef71<_0x3c1103;_0x44ef71++){var _0x42bd04=events[_0x44ef71];var _0x92c7d=createListener('whatsappQueue:'+_0x42bd04,_0x3afb02);WhatsappQueueEvents['on'](_0x42bd04,_0x92c7d);}}; \ No newline at end of file +var _0xb04a=['save','remove','update','emit','removeListener','register','whatsappQueue:','./whatsappQueue.events'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0xb04a,0xcf));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require(_0xab04('0x0'));var events=[_0xab04('0x1'),_0xab04('0x2'),_0xab04('0x3')];function createListener(_0x565575,_0x28963e){return function(_0x4657c4){_0x28963e[_0xab04('0x4')](_0x565575,_0x4657c4);};}function removeListener(_0x4b8c0f,_0x2b5b06){return function(){WhatsappQueueEvents[_0xab04('0x5')](_0x4b8c0f,_0x2b5b06);};}exports[_0xab04('0x6')]=function(_0x488ced){for(var _0x3b68e3=0x0,_0x46d9b2=events['length'];_0x3b68e3<_0x46d9b2;_0x3b68e3++){var _0x53a969=events[_0x3b68e3];var _0x4d47f5=createListener(_0xab04('0x7')+_0x53a969,_0x488ced);WhatsappQueueEvents['on'](_0x53a969,_0x4d47f5);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5360f55..87ac001 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 _0x97a2=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x66195f,_0x4a1a3d){var _0x89b1b7=function(_0x3825a3){while(--_0x3825a3){_0x66195f['push'](_0x66195f['shift']());}};_0x89b1b7(++_0x4a1a3d);}(_0x97a2,0x1b1));var _0x297a=function(_0xca0c64,_0x15ddee){_0xca0c64=_0xca0c64-0x0;var _0x26dd04=_0x97a2[_0xca0c64];return _0x26dd04;};'use strict';var multer=require(_0x297a('0x0'));var util=require('util');var path=require(_0x297a('0x1'));var timeout=require(_0x297a('0x2'));var express=require(_0x297a('0x3'));var router=express[_0x297a('0x4')]();var fs_extra=require(_0x297a('0x5'));var auth=require(_0x297a('0x6'));var interaction=require(_0x297a('0x7'));var config=require(_0x297a('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x297a('0x9')]('/',auth[_0x297a('0xa')](),controller[_0x297a('0xb')]);router[_0x297a('0x9')](_0x297a('0xc'),auth[_0x297a('0xa')](),controller['describe']);router[_0x297a('0x9')](_0x297a('0xd'),auth[_0x297a('0xa')](),controller[_0x297a('0xe')]);router[_0x297a('0xf')]('/',auth[_0x297a('0xa')](),controller['create']);router['put']('/:id',auth[_0x297a('0xa')](),controller[_0x297a('0x10')]);router[_0x297a('0x11')](_0x297a('0xd'),auth['isAuthenticated'](),controller[_0x297a('0x12')]);module[_0x297a('0x13')]=router; \ No newline at end of file +var _0x705f=['delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','create','put','update'];(function(_0x50b383,_0x271261){var _0x557b3e=function(_0x1dae51){while(--_0x1dae51){_0x50b383['push'](_0x50b383['shift']());}};_0x557b3e(++_0x271261);}(_0x705f,0x75));var _0xf705=function(_0x23eb8c,_0x5618e8){_0x23eb8c=_0x23eb8c-0x0;var _0x4978ba=_0x705f[_0x23eb8c];return _0x4978ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf705('0x0'));var timeout=require('connect-timeout');var express=require(_0xf705('0x1'));var router=express[_0xf705('0x2')]();var fs_extra=require(_0xf705('0x3'));var auth=require(_0xf705('0x4'));var interaction=require(_0xf705('0x5'));var config=require(_0xf705('0x6'));var controller=require(_0xf705('0x7'));router[_0xf705('0x8')]('/',auth[_0xf705('0x9')](),controller[_0xf705('0xa')]);router[_0xf705('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf705('0xb')]);router['get'](_0xf705('0xc'),auth[_0xf705('0x9')](),controller['show']);router['post']('/',auth[_0xf705('0x9')](),controller[_0xf705('0xd')]);router[_0xf705('0xe')](_0xf705('0xc'),auth[_0xf705('0x9')](),controller[_0xf705('0xf')]);router[_0xf705('0x10')](_0xf705('0xc'),auth['isAuthenticated'](),controller[_0xf705('0x11')]);module[_0xf705('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e27b3a4..895fbad 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 _0x7217=['sequelize','STRING','DATE'];(function(_0x59f25c,_0x1e36ea){var _0x5afb03=function(_0x3104ea){while(--_0x3104ea){_0x59f25c['push'](_0x59f25c['shift']());}};_0x5afb03(++_0x1e36ea);}(_0x7217,0x19e));var _0x7721=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7217[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7721('0x1')]},'joinAt':{'type':Sequelize[_0x7721('0x2')]},'leaveAt':{'type':Sequelize[_0x7721('0x2')]},'acceptAt':{'type':Sequelize[_0x7721('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6aa7=['DATE','sequelize','STRING'];(function(_0x3a88d2,_0xe952a9){var _0x44f609=function(_0x469c81){while(--_0x469c81){_0x3a88d2['push'](_0x3a88d2['shift']());}};_0x44f609(++_0xe952a9);}(_0x6aa7,0x178));var _0x76aa=function(_0x5319df,_0x10259f){_0x5319df=_0x5319df-0x0;var _0x141a94=_0x6aa7[_0x5319df];return _0x141a94;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x76aa('0x1')]},'joinAt':{'type':Sequelize[_0x76aa('0x2')]},'leaveAt':{'type':Sequelize[_0x76aa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x76aa('0x2')]},'reason':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 21bc930..ccfad34 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 _0x8161=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','catch','show','params','create','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','name','send','render','merge','body','contact','message','agent','account','index','map','WhatsappQueueReport','fieldName','key','model','query'];(function(_0x24fe39,_0xfd77a6){var _0x2e8960=function(_0x3a466e){while(--_0x3a466e){_0x24fe39['push'](_0x24fe39['shift']());}};_0x2e8960(++_0xfd77a6);}(_0x8161,0x14b));var _0x1816=function(_0x12dbf4,_0x530d09){_0x12dbf4=_0x12dbf4-0x0;var _0x45b6cc=_0x8161[_0x12dbf4];return _0x45b6cc;};'use strict';var emlformat=require(_0x1816('0x0'));var rimraf=require(_0x1816('0x1'));var zipdir=require(_0x1816('0x2'));var jsonpatch=require(_0x1816('0x3'));var rp=require('request-promise');var moment=require(_0x1816('0x4'));var BPromise=require(_0x1816('0x5'));var Mustache=require(_0x1816('0x6'));var util=require(_0x1816('0x7'));var path=require('path');var sox=require(_0x1816('0x8'));var csv=require(_0x1816('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1816('0xa'));var _=require(_0x1816('0xb'));var squel=require(_0x1816('0xc'));var crypto=require(_0x1816('0xd'));var jsforce=require(_0x1816('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1816('0x9'));var querystring=require(_0x1816('0xf'));var Papa=require(_0x1816('0x10'));var Redis=require('ioredis');var authService=require(_0x1816('0x11'));var qs=require(_0x1816('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1816('0x13'))(_0x1816('0x14'));var utils=require(_0x1816('0x15'));var config=require(_0x1816('0x16'));var licenseUtil=require(_0x1816('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e9c1a,_0x5461cb){_0x5461cb=_0x5461cb||0xcc;return function(_0x354d81){if(_0x354d81){return _0x5e9c1a[_0x1816('0x18')](_0x5461cb);}return _0x5e9c1a[_0x1816('0x19')](_0x5461cb)[_0x1816('0x1a')]();};}function respondWithResult(_0x181411,_0x23daeb){_0x23daeb=_0x23daeb||0xc8;return function(_0x1d3bd5){if(_0x1d3bd5){return _0x181411[_0x1816('0x19')](_0x23daeb)[_0x1816('0x1b')](_0x1d3bd5);}};}function respondWithFilteredResult(_0x243e44,_0x1db8d7){return function(_0x1b240e){if(_0x1b240e){var _0x3314d1=typeof _0x1db8d7[_0x1816('0x1c')]==='undefined'&&typeof _0x1db8d7[_0x1816('0x1d')]===_0x1816('0x1e');var _0x30f938=_0x1b240e[_0x1816('0x1f')];var _0x4cd9fc=_0x3314d1?0x0:_0x1db8d7['offset'];var _0x5e5435=_0x3314d1?_0x1b240e['count']:_0x1db8d7[_0x1816('0x1c')]+_0x1db8d7['limit'];var _0xfbe5a3;if(_0x5e5435>=_0x30f938){_0x5e5435=_0x30f938;_0xfbe5a3=0xc8;}else{_0xfbe5a3=0xce;}_0x243e44['status'](_0xfbe5a3);return _0x243e44[_0x1816('0x20')](_0x1816('0x21'),_0x4cd9fc+'-'+_0x5e5435+'/'+_0x30f938)['json'](_0x1b240e);}return null;};}function patchUpdates(_0x47a1d5){return function(_0x3b2df5){try{jsonpatch['apply'](_0x3b2df5,_0x47a1d5,!![]);}catch(_0x197b4a){return BPromise[_0x1816('0x22')](_0x197b4a);}return _0x3b2df5['save']();};}function saveUpdates(_0x384358,_0x25bee3){return function(_0x489acd){if(_0x489acd){return _0x489acd[_0x1816('0x23')](_0x384358)[_0x1816('0x24')](function(_0x23da78){return _0x23da78;});}return null;};}function removeEntity(_0x27eeae,_0x2d201f){return function(_0x5c7a70){if(_0x5c7a70){return _0x5c7a70[_0x1816('0x25')]()['then'](function(){_0x27eeae[_0x1816('0x19')](0xcc)[_0x1816('0x1a')]();});}};}function handleEntityNotFound(_0x108223,_0x2f67df){return function(_0x2d9dd6){if(!_0x2d9dd6){_0x108223[_0x1816('0x18')](0x194);}return _0x2d9dd6;};}function handleError(_0x4b2851,_0xeea574){_0xeea574=_0xeea574||0x1f4;return function(_0x4732ae){logger['error'](_0x4732ae['stack']);if(_0x4732ae[_0x1816('0x26')]){delete _0x4732ae[_0x1816('0x26')];}_0x4b2851[_0x1816('0x19')](_0xeea574)[_0x1816('0x27')](_0x4732ae);};}function getMustacheRender(_0x12e655,_0x24b75f){return Mustache[_0x1816('0x28')](_0x12e655,_[_0x1816('0x29')](_0x24b75f[_0x1816('0x2a')],{'contact':_0x24b75f[_0x1816('0x2b')],'message':_0x24b75f[_0x1816('0x2c')],'agent':_0x24b75f[_0x1816('0x2d')],'interaction':_0x24b75f['interaction'],'account':_0x24b75f[_0x1816('0x2e')]}))||'';}exports[_0x1816('0x2f')]=function(_0x3e19a7,_0x2249e9){var _0x13aa36={},_0x2cedd9={},_0x1c5a20={'count':0x0,'rows':[]};var _0x4ca3d1=_[_0x1816('0x30')](db[_0x1816('0x31')]['rawAttributes'],function(_0xb83b18){return{'name':_0xb83b18[_0x1816('0x32')],'type':_0xb83b18['type'][_0x1816('0x33')]};});_0x2cedd9[_0x1816('0x34')]=_[_0x1816('0x30')](_0x4ca3d1,'name');_0x2cedd9[_0x1816('0x35')]=_[_0x1816('0x36')](_0x3e19a7[_0x1816('0x35')]);_0x2cedd9[_0x1816('0x37')]=_[_0x1816('0x38')](_0x2cedd9['model'],_0x2cedd9[_0x1816('0x35')]);_0x13aa36[_0x1816('0x39')]=_['intersection'](_0x2cedd9['model'],qs[_0x1816('0x3a')](_0x3e19a7[_0x1816('0x35')][_0x1816('0x3a')]));_0x13aa36['attributes']=_0x13aa36['attributes'][_0x1816('0x3b')]?_0x13aa36[_0x1816('0x39')]:_0x2cedd9[_0x1816('0x34')];if(!_0x3e19a7[_0x1816('0x35')][_0x1816('0x3c')](_0x1816('0x3d'))){_0x13aa36[_0x1816('0x1d')]=qs[_0x1816('0x1d')](_0x3e19a7[_0x1816('0x35')]['limit']);_0x13aa36['offset']=qs['offset'](_0x3e19a7[_0x1816('0x35')][_0x1816('0x1c')]);}_0x13aa36[_0x1816('0x3e')]=qs[_0x1816('0x3f')](_0x3e19a7[_0x1816('0x35')][_0x1816('0x3f')]);_0x13aa36[_0x1816('0x40')]=qs[_0x1816('0x37')](_[_0x1816('0x41')](_0x3e19a7['query'],_0x2cedd9['filters']),_0x4ca3d1);if(_0x3e19a7[_0x1816('0x35')][_0x1816('0x42')]){_0x13aa36[_0x1816('0x40')]=_[_0x1816('0x29')](_0x13aa36[_0x1816('0x40')],{'$or':_[_0x1816('0x30')](_0x4ca3d1,function(_0x1b53a3){if(_0x1b53a3['type']!==_0x1816('0x43')){var _0x1d3b76={};_0x1d3b76[_0x1b53a3[_0x1816('0x26')]]={'$like':'%'+_0x3e19a7[_0x1816('0x35')]['filter']+'%'};return _0x1d3b76;}})});}_0x13aa36=_[_0x1816('0x29')]({},_0x13aa36,_0x3e19a7['options']);var _0x18a333={'where':_0x13aa36[_0x1816('0x40')]};return db[_0x1816('0x31')][_0x1816('0x1f')](_0x18a333)['then'](function(_0x1a1ef2){_0x1c5a20[_0x1816('0x1f')]=_0x1a1ef2;if(_0x3e19a7[_0x1816('0x35')][_0x1816('0x44')]){_0x13aa36[_0x1816('0x45')]=[{'all':!![]}];}return db[_0x1816('0x31')]['findAll'](_0x13aa36);})[_0x1816('0x24')](function(_0x4846b7){_0x1c5a20[_0x1816('0x46')]=_0x4846b7;return _0x1c5a20;})[_0x1816('0x24')](respondWithFilteredResult(_0x2249e9,_0x13aa36))[_0x1816('0x47')](handleError(_0x2249e9,null));};exports[_0x1816('0x48')]=function(_0x3f11b0,_0x16a3ee){var _0xf8075={'raw':!![],'where':{'id':_0x3f11b0[_0x1816('0x49')]['id']}},_0x5212db={};_0x5212db[_0x1816('0x34')]=_[_0x1816('0x36')](db[_0x1816('0x31')]['rawAttributes']);_0x5212db[_0x1816('0x35')]=_[_0x1816('0x36')](_0x3f11b0['query']);_0x5212db['filters']=_[_0x1816('0x38')](_0x5212db[_0x1816('0x34')],_0x5212db['query']);_0xf8075[_0x1816('0x39')]=_[_0x1816('0x38')](_0x5212db[_0x1816('0x34')],qs[_0x1816('0x3a')](_0x3f11b0[_0x1816('0x35')]['fields']));_0xf8075[_0x1816('0x39')]=_0xf8075['attributes']['length']?_0xf8075[_0x1816('0x39')]:_0x5212db[_0x1816('0x34')];if(_0x3f11b0['query'][_0x1816('0x44')]){_0xf8075[_0x1816('0x45')]=[{'all':!![]}];}_0xf8075=_[_0x1816('0x29')]({},_0xf8075,_0x3f11b0['options']);return db[_0x1816('0x31')]['find'](_0xf8075)[_0x1816('0x24')](handleEntityNotFound(_0x16a3ee,null))[_0x1816('0x24')](respondWithResult(_0x16a3ee,null))[_0x1816('0x47')](handleError(_0x16a3ee,null));};exports[_0x1816('0x4a')]=function(_0x14439c,_0x26d169){return db[_0x1816('0x31')][_0x1816('0x4a')](_0x14439c['body'],{})[_0x1816('0x24')](respondWithResult(_0x26d169,0xc9))[_0x1816('0x47')](handleError(_0x26d169,null));};exports[_0x1816('0x23')]=function(_0x5c4528,_0x21a076){if(_0x5c4528[_0x1816('0x2a')]['id']){delete _0x5c4528[_0x1816('0x2a')]['id'];}return db[_0x1816('0x31')][_0x1816('0x4b')]({'where':{'id':_0x5c4528[_0x1816('0x49')]['id']}})['then'](handleEntityNotFound(_0x21a076,null))[_0x1816('0x24')](saveUpdates(_0x5c4528[_0x1816('0x2a')],null))[_0x1816('0x24')](respondWithResult(_0x21a076,null))[_0x1816('0x47')](handleError(_0x21a076,null));};exports[_0x1816('0x25')]=function(_0x519809,_0x52fb56){return db[_0x1816('0x31')][_0x1816('0x4b')]({'where':{'id':_0x519809[_0x1816('0x49')]['id']}})[_0x1816('0x24')](handleEntityNotFound(_0x52fb56,null))[_0x1816('0x24')](removeEntity(_0x52fb56,null))[_0x1816('0x47')](handleError(_0x52fb56,null));};exports[_0x1816('0x4c')]=function(_0x4b4c98,_0x19a924){return db[_0x1816('0x31')][_0x1816('0x4c')]()['then'](respondWithResult(_0x19a924,null))[_0x1816('0x47')](handleError(_0x19a924,null));}; \ No newline at end of file +var _0x596e=['where','pick','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','update','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','then','destroy','end','error','name','render','merge','body','message','agent','interaction','account','index','map','WhatsappQueueReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1f3f8d,_0x4363f4){var _0x42d007=function(_0x157a73){while(--_0x157a73){_0x1f3f8d['push'](_0x1f3f8d['shift']());}};_0x42d007(++_0x4363f4);}(_0x596e,0xb3));var _0xe596=function(_0x2ca55d,_0x50e744){_0x2ca55d=_0x2ca55d-0x0;var _0x53302c=_0x596e[_0x2ca55d];return _0x53302c;};'use strict';var emlformat=require(_0xe596('0x0'));var rimraf=require(_0xe596('0x1'));var zipdir=require(_0xe596('0x2'));var jsonpatch=require(_0xe596('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe596('0x4'));var Mustache=require(_0xe596('0x5'));var util=require(_0xe596('0x6'));var path=require(_0xe596('0x7'));var sox=require('sox');var csv=require(_0xe596('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe596('0x9'));var _=require(_0xe596('0xa'));var squel=require(_0xe596('0xb'));var crypto=require(_0xe596('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe596('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe596('0xe'));var Papa=require(_0xe596('0xf'));var Redis=require(_0xe596('0x10'));var authService=require(_0xe596('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe596('0x12'));var logger=require(_0xe596('0x13'))(_0xe596('0x14'));var utils=require(_0xe596('0x15'));var config=require(_0xe596('0x16'));var licenseUtil=require(_0xe596('0x17'));var db=require(_0xe596('0x18'))['db'];function respondWithStatusCode(_0x4ef3cd,_0x3b0e17){_0x3b0e17=_0x3b0e17||0xcc;return function(_0x3f9e50){if(_0x3f9e50){return _0x4ef3cd[_0xe596('0x19')](_0x3b0e17);}return _0x4ef3cd[_0xe596('0x1a')](_0x3b0e17)['end']();};}function respondWithResult(_0x2e77e3,_0x3f75dd){_0x3f75dd=_0x3f75dd||0xc8;return function(_0x102623){if(_0x102623){return _0x2e77e3[_0xe596('0x1a')](_0x3f75dd)[_0xe596('0x1b')](_0x102623);}};}function respondWithFilteredResult(_0x3eae3b,_0x420122){return function(_0x5307ef){if(_0x5307ef){var _0x5c3827=typeof _0x420122[_0xe596('0x1c')]==='undefined'&&typeof _0x420122[_0xe596('0x1d')]===_0xe596('0x1e');var _0x342a60=_0x5307ef[_0xe596('0x1f')];var _0xcfe0e8=_0x5c3827?0x0:_0x420122[_0xe596('0x1c')];var _0x105ed6=_0x5c3827?_0x5307ef['count']:_0x420122['offset']+_0x420122[_0xe596('0x1d')];var _0x2590bb;if(_0x105ed6>=_0x342a60){_0x105ed6=_0x342a60;_0x2590bb=0xc8;}else{_0x2590bb=0xce;}_0x3eae3b[_0xe596('0x1a')](_0x2590bb);return _0x3eae3b[_0xe596('0x20')]('Content-Range',_0xcfe0e8+'-'+_0x105ed6+'/'+_0x342a60)[_0xe596('0x1b')](_0x5307ef);}return null;};}function patchUpdates(_0x321fed){return function(_0x2347bf){try{jsonpatch['apply'](_0x2347bf,_0x321fed,!![]);}catch(_0x4d7e2d){return BPromise[_0xe596('0x21')](_0x4d7e2d);}return _0x2347bf[_0xe596('0x22')]();};}function saveUpdates(_0x11fc1b,_0x133232){return function(_0x103c9c){if(_0x103c9c){return _0x103c9c['update'](_0x11fc1b)[_0xe596('0x23')](function(_0xa11811){return _0xa11811;});}return null;};}function removeEntity(_0x49fb2c,_0x968169){return function(_0x5cc196){if(_0x5cc196){return _0x5cc196[_0xe596('0x24')]()[_0xe596('0x23')](function(){_0x49fb2c[_0xe596('0x1a')](0xcc)[_0xe596('0x25')]();});}};}function handleEntityNotFound(_0x38a367,_0x5aa48b){return function(_0x41bf43){if(!_0x41bf43){_0x38a367[_0xe596('0x19')](0x194);}return _0x41bf43;};}function handleError(_0x53ce82,_0x43ff3d){_0x43ff3d=_0x43ff3d||0x1f4;return function(_0x486e29){logger[_0xe596('0x26')](_0x486e29['stack']);if(_0x486e29[_0xe596('0x27')]){delete _0x486e29[_0xe596('0x27')];}_0x53ce82[_0xe596('0x1a')](_0x43ff3d)['send'](_0x486e29);};}function getMustacheRender(_0x2ea453,_0x34d6d8){return Mustache[_0xe596('0x28')](_0x2ea453,_[_0xe596('0x29')](_0x34d6d8[_0xe596('0x2a')],{'contact':_0x34d6d8['contact'],'message':_0x34d6d8[_0xe596('0x2b')],'agent':_0x34d6d8[_0xe596('0x2c')],'interaction':_0x34d6d8[_0xe596('0x2d')],'account':_0x34d6d8[_0xe596('0x2e')]}))||'';}exports[_0xe596('0x2f')]=function(_0x171d9d,_0x1e8858){var _0x1fa414={},_0x44c2a5={},_0x5c430f={'count':0x0,'rows':[]};var _0x500e18=_[_0xe596('0x30')](db[_0xe596('0x31')]['rawAttributes'],function(_0x415da5){return{'name':_0x415da5[_0xe596('0x32')],'type':_0x415da5[_0xe596('0x33')][_0xe596('0x34')]};});_0x44c2a5[_0xe596('0x35')]=_[_0xe596('0x30')](_0x500e18,_0xe596('0x27'));_0x44c2a5[_0xe596('0x36')]=_['keys'](_0x171d9d['query']);_0x44c2a5[_0xe596('0x37')]=_[_0xe596('0x38')](_0x44c2a5[_0xe596('0x35')],_0x44c2a5[_0xe596('0x36')]);_0x1fa414[_0xe596('0x39')]=_[_0xe596('0x38')](_0x44c2a5[_0xe596('0x35')],qs[_0xe596('0x3a')](_0x171d9d[_0xe596('0x36')][_0xe596('0x3a')]));_0x1fa414['attributes']=_0x1fa414[_0xe596('0x39')][_0xe596('0x3b')]?_0x1fa414[_0xe596('0x39')]:_0x44c2a5[_0xe596('0x35')];if(!_0x171d9d[_0xe596('0x36')][_0xe596('0x3c')](_0xe596('0x3d'))){_0x1fa414[_0xe596('0x1d')]=qs[_0xe596('0x1d')](_0x171d9d[_0xe596('0x36')][_0xe596('0x1d')]);_0x1fa414[_0xe596('0x1c')]=qs['offset'](_0x171d9d[_0xe596('0x36')][_0xe596('0x1c')]);}_0x1fa414[_0xe596('0x3e')]=qs['sort'](_0x171d9d[_0xe596('0x36')][_0xe596('0x3f')]);_0x1fa414[_0xe596('0x40')]=qs['filters'](_[_0xe596('0x41')](_0x171d9d['query'],_0x44c2a5[_0xe596('0x37')]),_0x500e18);if(_0x171d9d[_0xe596('0x36')][_0xe596('0x42')]){_0x1fa414['where']=_[_0xe596('0x29')](_0x1fa414[_0xe596('0x40')],{'$or':_[_0xe596('0x30')](_0x500e18,function(_0x34ef7d){if(_0x34ef7d[_0xe596('0x33')]!=='VIRTUAL'){var _0x54dab1={};_0x54dab1[_0x34ef7d[_0xe596('0x27')]]={'$like':'%'+_0x171d9d['query'][_0xe596('0x42')]+'%'};return _0x54dab1;}})});}_0x1fa414=_['merge']({},_0x1fa414,_0x171d9d[_0xe596('0x43')]);var _0x3dc6ac={'where':_0x1fa414[_0xe596('0x40')]};return db[_0xe596('0x31')][_0xe596('0x1f')](_0x3dc6ac)[_0xe596('0x23')](function(_0x5716e1){_0x5c430f[_0xe596('0x1f')]=_0x5716e1;if(_0x171d9d[_0xe596('0x36')][_0xe596('0x44')]){_0x1fa414[_0xe596('0x45')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xe596('0x46')](_0x1fa414);})[_0xe596('0x23')](function(_0x265f7f){_0x5c430f[_0xe596('0x47')]=_0x265f7f;return _0x5c430f;})[_0xe596('0x23')](respondWithFilteredResult(_0x1e8858,_0x1fa414))['catch'](handleError(_0x1e8858,null));};exports[_0xe596('0x48')]=function(_0x38fdd6,_0xb965d8){var _0x2fb192={'raw':!![],'where':{'id':_0x38fdd6[_0xe596('0x49')]['id']}},_0x27ad88={};_0x27ad88['model']=_[_0xe596('0x4a')](db[_0xe596('0x31')][_0xe596('0x4b')]);_0x27ad88[_0xe596('0x36')]=_[_0xe596('0x4a')](_0x38fdd6[_0xe596('0x36')]);_0x27ad88[_0xe596('0x37')]=_['intersection'](_0x27ad88[_0xe596('0x35')],_0x27ad88[_0xe596('0x36')]);_0x2fb192['attributes']=_['intersection'](_0x27ad88[_0xe596('0x35')],qs[_0xe596('0x3a')](_0x38fdd6[_0xe596('0x36')][_0xe596('0x3a')]));_0x2fb192[_0xe596('0x39')]=_0x2fb192[_0xe596('0x39')][_0xe596('0x3b')]?_0x2fb192['attributes']:_0x27ad88[_0xe596('0x35')];if(_0x38fdd6[_0xe596('0x36')][_0xe596('0x44')]){_0x2fb192[_0xe596('0x45')]=[{'all':!![]}];}_0x2fb192=_[_0xe596('0x29')]({},_0x2fb192,_0x38fdd6[_0xe596('0x43')]);return db['WhatsappQueueReport'][_0xe596('0x4c')](_0x2fb192)[_0xe596('0x23')](handleEntityNotFound(_0xb965d8,null))[_0xe596('0x23')](respondWithResult(_0xb965d8,null))['catch'](handleError(_0xb965d8,null));};exports['create']=function(_0x9051bf,_0x5b4c32){return db[_0xe596('0x31')][_0xe596('0x4d')](_0x9051bf[_0xe596('0x2a')],{})[_0xe596('0x23')](respondWithResult(_0x5b4c32,0xc9))['catch'](handleError(_0x5b4c32,null));};exports[_0xe596('0x4e')]=function(_0x56bd85,_0x2ee578){if(_0x56bd85[_0xe596('0x2a')]['id']){delete _0x56bd85[_0xe596('0x2a')]['id'];}return db[_0xe596('0x31')][_0xe596('0x4c')]({'where':{'id':_0x56bd85[_0xe596('0x49')]['id']}})[_0xe596('0x23')](handleEntityNotFound(_0x2ee578,null))[_0xe596('0x23')](saveUpdates(_0x56bd85['body'],null))[_0xe596('0x23')](respondWithResult(_0x2ee578,null))[_0xe596('0x4f')](handleError(_0x2ee578,null));};exports[_0xe596('0x24')]=function(_0x2a5f2c,_0x3287ff){return db[_0xe596('0x31')][_0xe596('0x4c')]({'where':{'id':_0x2a5f2c[_0xe596('0x49')]['id']}})[_0xe596('0x23')](handleEntityNotFound(_0x3287ff,null))['then'](removeEntity(_0x3287ff,null))[_0xe596('0x4f')](handleError(_0x3287ff,null));};exports[_0xe596('0x50')]=function(_0x5c78d6,_0xca90a8){return db[_0xe596('0x31')][_0xe596('0x50')]()[_0xe596('0x23')](respondWithResult(_0xca90a8,null))[_0xe596('0x4f')](handleError(_0xca90a8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index d42aaf9..61cc8d1 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 _0xc384=['rimraf','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x70a9b4,_0x8bc5f){var _0x40030f=function(_0x355dfa){while(--_0x355dfa){_0x70a9b4['push'](_0x70a9b4['shift']());}};_0x40030f(++_0x8bc5f);}(_0xc384,0xc6));var _0x4c38=function(_0x25c4c9,_0x3fba8e){_0x25c4c9=_0x25c4c9-0x0;var _0x5059c6=_0xc384[_0x25c4c9];return _0x5059c6;};'use strict';var _=require(_0x4c38('0x0'));var util=require(_0x4c38('0x1'));var logger=require(_0x4c38('0x2'))('api');var moment=require(_0x4c38('0x3'));var BPromise=require(_0x4c38('0x4'));var rp=require(_0x4c38('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c38('0x6'));var config=require(_0x4c38('0x7'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x2c77bf,_0x3d4007){return _0x2c77bf[_0x4c38('0x8')](_0x4c38('0x9'),attributes,{'tableName':_0x4c38('0xa'),'paranoid':![],'indexes':[{'name':_0x4c38('0xb'),'fields':[_0x4c38('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf909=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0xf9742f,_0x102043){var _0x4cc398=function(_0x3f37c6){while(--_0x3f37c6){_0xf9742f['push'](_0xf9742f['shift']());}};_0x4cc398(++_0x102043);}(_0xf909,0xa2));var _0x9f90=function(_0xbbed01,_0x466a47){_0xbbed01=_0xbbed01-0x0;var _0x42a888=_0xf909[_0xbbed01];return _0x42a888;};'use strict';var _=require(_0x9f90('0x0'));var util=require(_0x9f90('0x1'));var logger=require(_0x9f90('0x2'))(_0x9f90('0x3'));var moment=require(_0x9f90('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f90('0x5'));var rimraf=require(_0x9f90('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f90('0x7'));module[_0x9f90('0x8')]=function(_0x560db6,_0x53d117){return _0x560db6[_0x9f90('0x9')](_0x9f90('0xa'),attributes,{'tableName':_0x9f90('0xb'),'paranoid':![],'indexes':[{'name':_0x9f90('0xc'),'fields':[_0x9f90('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index de35159..ca91e13 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 _0x3c5f=['stringify','error','code','message','request\x20sent','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','debug','catch','UpdateWhatsappQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x37cdf7,_0x540a3f){var _0x68fdb4=function(_0x54071e){while(--_0x54071e){_0x37cdf7['push'](_0x37cdf7['shift']());}};_0x68fdb4(++_0x540a3f);}(_0x3c5f,0x1b1));var _0xf3c5=function(_0x5f3d2f,_0x307960){_0x5f3d2f=_0x5f3d2f-0x0;var _0xc5fc30=_0x3c5f[_0x5f3d2f];return _0xc5fc30;};'use strict';var _=require(_0xf3c5('0x0'));var util=require(_0xf3c5('0x1'));var moment=require('moment');var BPromise=require(_0xf3c5('0x2'));var rs=require(_0xf3c5('0x3'));var fs=require('fs');var Redis=require(_0xf3c5('0x4'));var db=require(_0xf3c5('0x5'))['db'];var utils=require(_0xf3c5('0x6'));var logger=require(_0xf3c5('0x7'))(_0xf3c5('0x8'));var config=require('../../config/environment');var jayson=require(_0xf3c5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13a57b,_0x4e7d6b,_0x437de2){return new BPromise(function(_0x1c707e,_0x5c4353){return client[_0xf3c5('0xa')](_0x13a57b,_0x437de2)[_0xf3c5('0xb')](function(_0x2b11d4){logger[_0xf3c5('0xc')](_0xf3c5('0xd'),_0x4e7d6b,'request\x20sent');logger['debug'](_0xf3c5('0xe'),_0x4e7d6b,'request\x20sent',JSON[_0xf3c5('0xf')](_0x2b11d4));if(_0x2b11d4['error']){if(_0x2b11d4[_0xf3c5('0x10')][_0xf3c5('0x11')]===0x1f4){logger['error'](_0xf3c5('0xd'),_0x4e7d6b,_0x2b11d4['error'][_0xf3c5('0x12')]);return _0x5c4353(_0x2b11d4[_0xf3c5('0x10')]['message']);}logger[_0xf3c5('0x10')](_0xf3c5('0xd'),_0x4e7d6b,_0x2b11d4[_0xf3c5('0x10')][_0xf3c5('0x12')]);return _0x1c707e(_0x2b11d4[_0xf3c5('0x10')][_0xf3c5('0x12')]);}else{logger[_0xf3c5('0xc')](_0xf3c5('0xd'),_0x4e7d6b,_0xf3c5('0x13'));_0x1c707e(_0x2b11d4['result']['message']);}})['catch'](function(_0x15ef21){logger[_0xf3c5('0x10')](_0xf3c5('0xd'),_0x4e7d6b,_0x15ef21);_0x5c4353(_0x15ef21);});});}exports[_0xf3c5('0x14')]=function(_0x4295a7){var _0x4bb23d=this;return new Promise(function(_0x789701,_0x33bf8a){return db[_0xf3c5('0x15')][_0xf3c5('0x16')](_0x4295a7[_0xf3c5('0x17')],{'raw':_0x4295a7[_0xf3c5('0x18')]?_0x4295a7[_0xf3c5('0x18')][_0xf3c5('0x19')]===undefined?!![]:![]:!![]})[_0xf3c5('0xb')](function(_0x680964){logger[_0xf3c5('0xc')](_0xf3c5('0x14'),_0x4295a7);logger[_0xf3c5('0x1a')](_0xf3c5('0x14'),_0x4295a7,JSON['stringify'](_0x680964));_0x789701(_0x680964);})[_0xf3c5('0x1b')](function(_0x434d47){logger[_0xf3c5('0x10')]('CreateWhatsappQueueReport',_0x434d47[_0xf3c5('0x12')],_0x4295a7);_0x33bf8a(_0x4bb23d[_0xf3c5('0x10')](0x1f4,_0x434d47[_0xf3c5('0x12')]));});});};exports[_0xf3c5('0x1c')]=function(_0x138c32){var _0x398dd6=this;return new Promise(function(_0x26bc40,_0x17bd66){return db['WhatsappQueueReport'][_0xf3c5('0x1d')](_0x138c32[_0xf3c5('0x17')],{'raw':_0x138c32[_0xf3c5('0x18')]?_0x138c32[_0xf3c5('0x18')][_0xf3c5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x138c32[_0xf3c5('0x18')]?_0x138c32[_0xf3c5('0x18')]['where']||null:null,'attributes':_0x138c32[_0xf3c5('0x18')]?_0x138c32[_0xf3c5('0x18')][_0xf3c5('0x1e')]||null:null,'limit':_0x138c32[_0xf3c5('0x18')]?_0x138c32[_0xf3c5('0x18')][_0xf3c5('0x1f')]||null:null})[_0xf3c5('0xb')](function(_0x25d075){logger[_0xf3c5('0xc')](_0xf3c5('0x1c'),_0x138c32);logger[_0xf3c5('0x1a')](_0xf3c5('0x1c'),_0x138c32,JSON[_0xf3c5('0xf')](_0x25d075));_0x26bc40(_0x25d075);})[_0xf3c5('0x1b')](function(_0x79afde){logger[_0xf3c5('0x10')](_0xf3c5('0x1c'),_0x79afde['message'],_0x138c32);_0x17bd66(_0x398dd6[_0xf3c5('0x10')](0x1f4,_0x79afde[_0xf3c5('0x12')]));});});}; \ No newline at end of file +var _0x6760=['raw','CreateWhatsappQueueReport','stringify','UpdateWhatsappQueueReport','WhatsappQueueReport','update','attributes','limit','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','WhatsappQueueReport,\x20%s,\x20%s','result','create','body','options'];(function(_0x10c16f,_0x29daf3){var _0x410ba2=function(_0x1c0ccb){while(--_0x1c0ccb){_0x10c16f['push'](_0x10c16f['shift']());}};_0x410ba2(++_0x29daf3);}(_0x6760,0x1d7));var _0x0676=function(_0x3060bd,_0x21635b){_0x3060bd=_0x3060bd-0x0;var _0x52d0f0=_0x6760[_0x3060bd];return _0x52d0f0;};'use strict';var _=require(_0x0676('0x0'));var util=require('util');var moment=require(_0x0676('0x1'));var BPromise=require('bluebird');var rs=require(_0x0676('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0676('0x3'))['db'];var utils=require(_0x0676('0x4'));var logger=require('../../config/logger')(_0x0676('0x5'));var config=require(_0x0676('0x6'));var jayson=require(_0x0676('0x7'));var client=jayson[_0x0676('0x8')][_0x0676('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4976a6,_0x1487ff,_0x510861){return new BPromise(function(_0x44af78,_0x49769e){return client[_0x0676('0xa')](_0x4976a6,_0x510861)[_0x0676('0xb')](function(_0x2b220d){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x1487ff,_0x0676('0xc'));logger[_0x0676('0xd')](_0x0676('0xe'),_0x1487ff,'request\x20sent',JSON['stringify'](_0x2b220d));if(_0x2b220d[_0x0676('0xf')]){if(_0x2b220d[_0x0676('0xf')][_0x0676('0x10')]===0x1f4){logger[_0x0676('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1487ff,_0x2b220d['error'][_0x0676('0x11')]);return _0x49769e(_0x2b220d[_0x0676('0xf')][_0x0676('0x11')]);}logger[_0x0676('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1487ff,_0x2b220d[_0x0676('0xf')][_0x0676('0x11')]);return _0x44af78(_0x2b220d['error'][_0x0676('0x11')]);}else{logger[_0x0676('0x12')](_0x0676('0x13'),_0x1487ff,_0x0676('0xc'));_0x44af78(_0x2b220d[_0x0676('0x14')][_0x0676('0x11')]);}})['catch'](function(_0x500c6f){logger[_0x0676('0xf')](_0x0676('0x13'),_0x1487ff,_0x500c6f);_0x49769e(_0x500c6f);});});}exports['CreateWhatsappQueueReport']=function(_0x3e7169){var _0x1a1c89=this;return new Promise(function(_0x406589,_0x18ab0b){return db['WhatsappQueueReport'][_0x0676('0x15')](_0x3e7169[_0x0676('0x16')],{'raw':_0x3e7169[_0x0676('0x17')]?_0x3e7169[_0x0676('0x17')][_0x0676('0x18')]===undefined?!![]:![]:!![]})[_0x0676('0xb')](function(_0x43e932){logger[_0x0676('0x12')](_0x0676('0x19'),_0x3e7169);logger['debug']('CreateWhatsappQueueReport',_0x3e7169,JSON[_0x0676('0x1a')](_0x43e932));_0x406589(_0x43e932);})['catch'](function(_0xb9a6f6){logger[_0x0676('0xf')](_0x0676('0x19'),_0xb9a6f6[_0x0676('0x11')],_0x3e7169);_0x18ab0b(_0x1a1c89[_0x0676('0xf')](0x1f4,_0xb9a6f6[_0x0676('0x11')]));});});};exports[_0x0676('0x1b')]=function(_0x35a4af){var _0x3bc7b0=this;return new Promise(function(_0x4c6a97,_0x29461a){return db[_0x0676('0x1c')][_0x0676('0x1d')](_0x35a4af[_0x0676('0x16')],{'raw':_0x35a4af[_0x0676('0x17')]?_0x35a4af['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35a4af[_0x0676('0x17')]?_0x35a4af[_0x0676('0x17')]['where']||null:null,'attributes':_0x35a4af[_0x0676('0x17')]?_0x35a4af[_0x0676('0x17')][_0x0676('0x1e')]||null:null,'limit':_0x35a4af[_0x0676('0x17')]?_0x35a4af[_0x0676('0x17')][_0x0676('0x1f')]||null:null})[_0x0676('0xb')](function(_0x462743){logger['info'](_0x0676('0x1b'),_0x35a4af);logger['debug']('UpdateWhatsappQueueReport',_0x35a4af,JSON[_0x0676('0x1a')](_0x462743));_0x4c6a97(_0x462743);})[_0x0676('0x20')](function(_0x4805c7){logger[_0x0676('0xf')](_0x0676('0x1b'),_0x4805c7[_0x0676('0x11')],_0x35a4af);_0x29461a(_0x3bc7b0[_0x0676('0xf')](0x1f4,_0x4805c7[_0x0676('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 45ba74f..5b73016 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 _0xb730=['create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xb730,0xf7));var _0x0b73=function(_0x5c1e44,_0x37fe72){_0x5c1e44=_0x5c1e44-0x0;var _0x59a659=_0xb730[_0x5c1e44];return _0x59a659;};'use strict';var multer=require(_0x0b73('0x0'));var util=require(_0x0b73('0x1'));var path=require('path');var timeout=require(_0x0b73('0x2'));var express=require(_0x0b73('0x3'));var router=express['Router']();var fs_extra=require(_0x0b73('0x4'));var auth=require(_0x0b73('0x5'));var interaction=require(_0x0b73('0x6'));var config=require(_0x0b73('0x7'));var controller=require(_0x0b73('0x8'));router[_0x0b73('0x9')]('/',auth['isAuthenticated'](),controller[_0x0b73('0xa')]);router[_0x0b73('0x9')](_0x0b73('0xb'),auth[_0x0b73('0xc')](),controller[_0x0b73('0xd')]);router[_0x0b73('0x9')](_0x0b73('0xe'),auth[_0x0b73('0xc')](),controller[_0x0b73('0xf')]);router[_0x0b73('0x10')]('/',auth[_0x0b73('0xc')](),controller[_0x0b73('0x11')]);router[_0x0b73('0x12')](_0x0b73('0xe'),auth[_0x0b73('0xc')](),controller[_0x0b73('0x13')]);router[_0x0b73('0x14')](_0x0b73('0xe'),auth[_0x0b73('0xc')](),controller[_0x0b73('0x15')]);module['exports']=router; \ No newline at end of file +var _0xf371=['put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xd303d1,_0x2a2446){var _0x27ac34=function(_0x184f84){while(--_0x184f84){_0xd303d1['push'](_0xd303d1['shift']());}};_0x27ac34(++_0x2a2446);}(_0xf371,0x194));var _0x1f37=function(_0x182229,_0x4c6f19){_0x182229=_0x182229-0x0;var _0xf2e06a=_0xf371[_0x182229];return _0xf2e06a;};'use strict';var multer=require(_0x1f37('0x0'));var util=require(_0x1f37('0x1'));var path=require('path');var timeout=require(_0x1f37('0x2'));var express=require('express');var router=express[_0x1f37('0x3')]();var fs_extra=require(_0x1f37('0x4'));var auth=require(_0x1f37('0x5'));var interaction=require(_0x1f37('0x6'));var config=require(_0x1f37('0x7'));var controller=require(_0x1f37('0x8'));router[_0x1f37('0x9')]('/',auth[_0x1f37('0xa')](),controller[_0x1f37('0xb')]);router[_0x1f37('0x9')](_0x1f37('0xc'),auth['isAuthenticated'](),controller[_0x1f37('0xd')]);router[_0x1f37('0x9')](_0x1f37('0xe'),auth[_0x1f37('0xa')](),controller[_0x1f37('0xf')]);router['post']('/',auth[_0x1f37('0xa')](),controller['create']);router[_0x1f37('0x10')](_0x1f37('0xe'),auth[_0x1f37('0xa')](),controller[_0x1f37('0x11')]);router['delete']('/:id',auth[_0x1f37('0xa')](),controller[_0x1f37('0x12')]);module[_0x1f37('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 cdbc2b9..13b08c6 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 _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0b0e,0x187));var _0xe0b0=function(_0x558099,_0x4be744){_0x558099=_0x558099-0x0;var _0x18ac2e=_0x0b0e[_0x558099];return _0x18ac2e;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file +var _0x757a=['queue','DATE','exports','STRING'];(function(_0x4266b4,_0x4859ad){var _0x1442aa=function(_0x21f8c1){while(--_0x21f8c1){_0x4266b4['push'](_0x4266b4['shift']());}};_0x1442aa(++_0x4859ad);}(_0x757a,0xde));var _0xa757=function(_0x13b9c1,_0x2b22fe){_0x13b9c1=_0x13b9c1-0x0;var _0x10d7e4=_0x757a[_0x13b9c1];return _0x10d7e4;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'uniqueid':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xa757('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa757('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index e102aa6..e000309 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 _0x35b6=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','name','send','merge','body','contact','message','agent','interaction','account','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','then','includeAll','include','rows','catch','show','params','create','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x553bb0,_0x52e291){var _0x4cfcad=function(_0x1d37f5){while(--_0x1d37f5){_0x553bb0['push'](_0x553bb0['shift']());}};_0x4cfcad(++_0x52e291);}(_0x35b6,0x132));var _0x635b=function(_0x6016b6,_0x4e52c8){_0x6016b6=_0x6016b6-0x0;var _0x19ddd6=_0x35b6[_0x6016b6];return _0x19ddd6;};'use strict';var emlformat=require(_0x635b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x635b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x635b('0x2'));var moment=require(_0x635b('0x3'));var BPromise=require(_0x635b('0x4'));var Mustache=require(_0x635b('0x5'));var util=require(_0x635b('0x6'));var path=require(_0x635b('0x7'));var sox=require(_0x635b('0x8'));var csv=require(_0x635b('0x9'));var ejs=require(_0x635b('0xa'));var fs=require('fs');var fs_extra=require(_0x635b('0xb'));var _=require(_0x635b('0xc'));var squel=require(_0x635b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x635b('0x9'));var querystring=require(_0x635b('0xe'));var Papa=require(_0x635b('0xf'));var Redis=require(_0x635b('0x10'));var authService=require(_0x635b('0x11'));var qs=require(_0x635b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x635b('0x13'));var logger=require(_0x635b('0x14'))('api');var utils=require(_0x635b('0x15'));var config=require(_0x635b('0x16'));var licenseUtil=require(_0x635b('0x17'));var db=require(_0x635b('0x18'))['db'];function respondWithStatusCode(_0x4e12d6,_0xea8b93){_0xea8b93=_0xea8b93||0xcc;return function(_0x431249){if(_0x431249){return _0x4e12d6['sendStatus'](_0xea8b93);}return _0x4e12d6[_0x635b('0x19')](_0xea8b93)[_0x635b('0x1a')]();};}function respondWithResult(_0x3bfad8,_0x4fddbc){_0x4fddbc=_0x4fddbc||0xc8;return function(_0x2bdeaf){if(_0x2bdeaf){return _0x3bfad8['status'](_0x4fddbc)[_0x635b('0x1b')](_0x2bdeaf);}};}function respondWithFilteredResult(_0xa5a487,_0x44f0cf){return function(_0x13bdae){if(_0x13bdae){var _0x4de1ce=typeof _0x44f0cf['offset']===_0x635b('0x1c')&&typeof _0x44f0cf[_0x635b('0x1d')]===_0x635b('0x1c');var _0x52774b=_0x13bdae[_0x635b('0x1e')];var _0x331df1=_0x4de1ce?0x0:_0x44f0cf[_0x635b('0x1f')];var _0x365b64=_0x4de1ce?_0x13bdae[_0x635b('0x1e')]:_0x44f0cf[_0x635b('0x1f')]+_0x44f0cf['limit'];var _0x381940;if(_0x365b64>=_0x52774b){_0x365b64=_0x52774b;_0x381940=0xc8;}else{_0x381940=0xce;}_0xa5a487[_0x635b('0x19')](_0x381940);return _0xa5a487[_0x635b('0x20')](_0x635b('0x21'),_0x331df1+'-'+_0x365b64+'/'+_0x52774b)['json'](_0x13bdae);}return null;};}function patchUpdates(_0x3a6fc2){return function(_0x343bfe){try{jsonpatch[_0x635b('0x22')](_0x343bfe,_0x3a6fc2,!![]);}catch(_0x2207cd){return BPromise[_0x635b('0x23')](_0x2207cd);}return _0x343bfe[_0x635b('0x24')]();};}function saveUpdates(_0x3daaa1,_0x3ea744){return function(_0x154f09){if(_0x154f09){return _0x154f09[_0x635b('0x25')](_0x3daaa1)['then'](function(_0x28673d){return _0x28673d;});}return null;};}function removeEntity(_0x53e967,_0x2aee50){return function(_0x2842f0){if(_0x2842f0){return _0x2842f0[_0x635b('0x26')]()['then'](function(){_0x53e967[_0x635b('0x19')](0xcc)[_0x635b('0x1a')]();});}};}function handleEntityNotFound(_0x2e2b9a,_0x5c0945){return function(_0x2cc25d){if(!_0x2cc25d){_0x2e2b9a['sendStatus'](0x194);}return _0x2cc25d;};}function handleError(_0x4ba7d9,_0x1a9461){_0x1a9461=_0x1a9461||0x1f4;return function(_0x280a18){logger[_0x635b('0x27')](_0x280a18['stack']);if(_0x280a18[_0x635b('0x28')]){delete _0x280a18[_0x635b('0x28')];}_0x4ba7d9['status'](_0x1a9461)[_0x635b('0x29')](_0x280a18);};}function getMustacheRender(_0x1d0b8c,_0x591d66){return Mustache['render'](_0x1d0b8c,_[_0x635b('0x2a')](_0x591d66[_0x635b('0x2b')],{'contact':_0x591d66[_0x635b('0x2c')],'message':_0x591d66[_0x635b('0x2d')],'agent':_0x591d66[_0x635b('0x2e')],'interaction':_0x591d66[_0x635b('0x2f')],'account':_0x591d66[_0x635b('0x30')]}))||'';}exports['index']=function(_0x5dc17f,_0x1ffb97){var _0x540f4c={},_0x581f34={},_0x4c547a={'count':0x0,'rows':[]};var _0xad17ae=_[_0x635b('0x31')](db[_0x635b('0x32')][_0x635b('0x33')],function(_0x5aa8a2){return{'name':_0x5aa8a2[_0x635b('0x34')],'type':_0x5aa8a2[_0x635b('0x35')][_0x635b('0x36')]};});_0x581f34[_0x635b('0x37')]=_[_0x635b('0x31')](_0xad17ae,_0x635b('0x28'));_0x581f34[_0x635b('0x38')]=_[_0x635b('0x39')](_0x5dc17f[_0x635b('0x38')]);_0x581f34[_0x635b('0x3a')]=_[_0x635b('0x3b')](_0x581f34['model'],_0x581f34[_0x635b('0x38')]);_0x540f4c['attributes']=_[_0x635b('0x3b')](_0x581f34[_0x635b('0x37')],qs[_0x635b('0x3c')](_0x5dc17f[_0x635b('0x38')][_0x635b('0x3c')]));_0x540f4c[_0x635b('0x3d')]=_0x540f4c[_0x635b('0x3d')][_0x635b('0x3e')]?_0x540f4c[_0x635b('0x3d')]:_0x581f34[_0x635b('0x37')];if(!_0x5dc17f[_0x635b('0x38')][_0x635b('0x3f')](_0x635b('0x40'))){_0x540f4c[_0x635b('0x1d')]=qs[_0x635b('0x1d')](_0x5dc17f[_0x635b('0x38')][_0x635b('0x1d')]);_0x540f4c[_0x635b('0x1f')]=qs['offset'](_0x5dc17f['query'][_0x635b('0x1f')]);}_0x540f4c['order']=qs[_0x635b('0x41')](_0x5dc17f['query'][_0x635b('0x41')]);_0x540f4c[_0x635b('0x42')]=qs['filters'](_[_0x635b('0x43')](_0x5dc17f[_0x635b('0x38')],_0x581f34[_0x635b('0x3a')]),_0xad17ae);if(_0x5dc17f[_0x635b('0x38')]['filter']){_0x540f4c[_0x635b('0x42')]=_[_0x635b('0x2a')](_0x540f4c[_0x635b('0x42')],{'$or':_[_0x635b('0x31')](_0xad17ae,function(_0x49e260){if(_0x49e260[_0x635b('0x35')]!==_0x635b('0x44')){var _0xffd3af={};_0xffd3af[_0x49e260['name']]={'$like':'%'+_0x5dc17f[_0x635b('0x38')][_0x635b('0x45')]+'%'};return _0xffd3af;}})});}_0x540f4c=_[_0x635b('0x2a')]({},_0x540f4c,_0x5dc17f[_0x635b('0x46')]);var _0x280f20={'where':_0x540f4c[_0x635b('0x42')]};return db[_0x635b('0x32')]['count'](_0x280f20)[_0x635b('0x47')](function(_0x2e7960){_0x4c547a[_0x635b('0x1e')]=_0x2e7960;if(_0x5dc17f['query'][_0x635b('0x48')]){_0x540f4c[_0x635b('0x49')]=[{'all':!![]}];}return db[_0x635b('0x32')]['findAll'](_0x540f4c);})[_0x635b('0x47')](function(_0x1c85ad){_0x4c547a[_0x635b('0x4a')]=_0x1c85ad;return _0x4c547a;})[_0x635b('0x47')](respondWithFilteredResult(_0x1ffb97,_0x540f4c))[_0x635b('0x4b')](handleError(_0x1ffb97,null));};exports[_0x635b('0x4c')]=function(_0x4a57b,_0xd4915d){var _0x52e7f6={'raw':!![],'where':{'id':_0x4a57b[_0x635b('0x4d')]['id']}},_0x18b0ed={};_0x18b0ed['model']=_[_0x635b('0x39')](db[_0x635b('0x32')][_0x635b('0x33')]);_0x18b0ed[_0x635b('0x38')]=_[_0x635b('0x39')](_0x4a57b[_0x635b('0x38')]);_0x18b0ed['filters']=_[_0x635b('0x3b')](_0x18b0ed['model'],_0x18b0ed[_0x635b('0x38')]);_0x52e7f6[_0x635b('0x3d')]=_[_0x635b('0x3b')](_0x18b0ed['model'],qs[_0x635b('0x3c')](_0x4a57b['query'][_0x635b('0x3c')]));_0x52e7f6['attributes']=_0x52e7f6[_0x635b('0x3d')][_0x635b('0x3e')]?_0x52e7f6[_0x635b('0x3d')]:_0x18b0ed[_0x635b('0x37')];if(_0x4a57b[_0x635b('0x38')]['includeAll']){_0x52e7f6[_0x635b('0x49')]=[{'all':!![]}];}_0x52e7f6=_[_0x635b('0x2a')]({},_0x52e7f6,_0x4a57b['options']);return db['WhatsappTransferReport']['find'](_0x52e7f6)[_0x635b('0x47')](handleEntityNotFound(_0xd4915d,null))[_0x635b('0x47')](respondWithResult(_0xd4915d,null))[_0x635b('0x4b')](handleError(_0xd4915d,null));};exports[_0x635b('0x4e')]=function(_0x553668,_0x386737){return db[_0x635b('0x32')][_0x635b('0x4e')](_0x553668[_0x635b('0x2b')],{})[_0x635b('0x47')](respondWithResult(_0x386737,0xc9))[_0x635b('0x4b')](handleError(_0x386737,null));};exports[_0x635b('0x25')]=function(_0xb1c35e,_0x540859){if(_0xb1c35e[_0x635b('0x2b')]['id']){delete _0xb1c35e['body']['id'];}return db[_0x635b('0x32')]['find']({'where':{'id':_0xb1c35e['params']['id']}})[_0x635b('0x47')](handleEntityNotFound(_0x540859,null))[_0x635b('0x47')](saveUpdates(_0xb1c35e[_0x635b('0x2b')],null))[_0x635b('0x47')](respondWithResult(_0x540859,null))[_0x635b('0x4b')](handleError(_0x540859,null));};exports[_0x635b('0x26')]=function(_0x168d80,_0x6be7a7){return db[_0x635b('0x32')][_0x635b('0x4f')]({'where':{'id':_0x168d80['params']['id']}})['then'](handleEntityNotFound(_0x6be7a7,null))[_0x635b('0x47')](removeEntity(_0x6be7a7,null))[_0x635b('0x4b')](handleError(_0x6be7a7,null));};exports[_0x635b('0x50')]=function(_0x16b6c9,_0x3a65ef){return db['WhatsappTransferReport'][_0x635b('0x50')]()[_0x635b('0x47')](respondWithResult(_0x3a65ef,null))['catch'](handleError(_0x3a65ef,null));}; \ No newline at end of file +var _0x3420=['params','rawAttributes','filters','create','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','merge','contact','agent','account','index','map','WhatsappTransferReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show'];(function(_0x2f1ee0,_0x4ca1f4){var _0x576314=function(_0xeec5c2){while(--_0xeec5c2){_0x2f1ee0['push'](_0x2f1ee0['shift']());}};_0x576314(++_0x4ca1f4);}(_0x3420,0x150));var _0x0342=function(_0x115dfa,_0xa32a7b){_0x115dfa=_0x115dfa-0x0;var _0x358464=_0x3420[_0x115dfa];return _0x358464;};'use strict';var emlformat=require(_0x0342('0x0'));var rimraf=require(_0x0342('0x1'));var zipdir=require(_0x0342('0x2'));var jsonpatch=require(_0x0342('0x3'));var rp=require(_0x0342('0x4'));var moment=require('moment');var BPromise=require(_0x0342('0x5'));var Mustache=require(_0x0342('0x6'));var util=require(_0x0342('0x7'));var path=require(_0x0342('0x8'));var sox=require('sox');var csv=require(_0x0342('0x9'));var ejs=require(_0x0342('0xa'));var fs=require('fs');var fs_extra=require(_0x0342('0xb'));var _=require('lodash');var squel=require(_0x0342('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0342('0xd'));var toCsv=require(_0x0342('0x9'));var querystring=require(_0x0342('0xe'));var Papa=require(_0x0342('0xf'));var Redis=require(_0x0342('0x10'));var authService=require(_0x0342('0x11'));var qs=require(_0x0342('0x12'));var as=require(_0x0342('0x13'));var hardwareService=require(_0x0342('0x14'));var logger=require(_0x0342('0x15'))(_0x0342('0x16'));var utils=require(_0x0342('0x17'));var config=require(_0x0342('0x18'));var licenseUtil=require(_0x0342('0x19'));var db=require(_0x0342('0x1a'))['db'];function respondWithStatusCode(_0x4edd35,_0x246b24){_0x246b24=_0x246b24||0xcc;return function(_0x5b26ec){if(_0x5b26ec){return _0x4edd35[_0x0342('0x1b')](_0x246b24);}return _0x4edd35[_0x0342('0x1c')](_0x246b24)['end']();};}function respondWithResult(_0x3089e2,_0x54c66a){_0x54c66a=_0x54c66a||0xc8;return function(_0x50aeb7){if(_0x50aeb7){return _0x3089e2['status'](_0x54c66a)[_0x0342('0x1d')](_0x50aeb7);}};}function respondWithFilteredResult(_0x1ed5f5,_0x54e5ec){return function(_0x3ad530){if(_0x3ad530){var _0x2c31da=typeof _0x54e5ec[_0x0342('0x1e')]===_0x0342('0x1f')&&typeof _0x54e5ec[_0x0342('0x20')]===_0x0342('0x1f');var _0x134613=_0x3ad530[_0x0342('0x21')];var _0x1b4f14=_0x2c31da?0x0:_0x54e5ec['offset'];var _0x2576e0=_0x2c31da?_0x3ad530['count']:_0x54e5ec[_0x0342('0x1e')]+_0x54e5ec[_0x0342('0x20')];var _0x53d3cc;if(_0x2576e0>=_0x134613){_0x2576e0=_0x134613;_0x53d3cc=0xc8;}else{_0x53d3cc=0xce;}_0x1ed5f5['status'](_0x53d3cc);return _0x1ed5f5['set'](_0x0342('0x22'),_0x1b4f14+'-'+_0x2576e0+'/'+_0x134613)[_0x0342('0x1d')](_0x3ad530);}return null;};}function patchUpdates(_0x342bd7){return function(_0x1ca6b4){try{jsonpatch[_0x0342('0x23')](_0x1ca6b4,_0x342bd7,!![]);}catch(_0x1e4db4){return BPromise[_0x0342('0x24')](_0x1e4db4);}return _0x1ca6b4[_0x0342('0x25')]();};}function saveUpdates(_0xe87087,_0x24c42b){return function(_0x1c3ed5){if(_0x1c3ed5){return _0x1c3ed5[_0x0342('0x26')](_0xe87087)['then'](function(_0x203c29){return _0x203c29;});}return null;};}function removeEntity(_0x1e165e,_0x4dd6a5){return function(_0x442ef7){if(_0x442ef7){return _0x442ef7[_0x0342('0x27')]()[_0x0342('0x28')](function(){_0x1e165e[_0x0342('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fa323,_0x3e9c68){return function(_0x113d80){if(!_0x113d80){_0x4fa323[_0x0342('0x1b')](0x194);}return _0x113d80;};}function handleError(_0x2110d4,_0x5d64ec){_0x5d64ec=_0x5d64ec||0x1f4;return function(_0x2f8be4){logger['error'](_0x2f8be4[_0x0342('0x29')]);if(_0x2f8be4[_0x0342('0x2a')]){delete _0x2f8be4['name'];}_0x2110d4[_0x0342('0x1c')](_0x5d64ec)[_0x0342('0x2b')](_0x2f8be4);};}function getMustacheRender(_0x328785,_0x54a4d9){return Mustache['render'](_0x328785,_[_0x0342('0x2c')](_0x54a4d9['body'],{'contact':_0x54a4d9[_0x0342('0x2d')],'message':_0x54a4d9['message'],'agent':_0x54a4d9[_0x0342('0x2e')],'interaction':_0x54a4d9['interaction'],'account':_0x54a4d9[_0x0342('0x2f')]}))||'';}exports[_0x0342('0x30')]=function(_0x3f7ad0,_0x1aa92f){var _0x29271e={},_0x558aa6={},_0x5bc00c={'count':0x0,'rows':[]};var _0x1ff328=_[_0x0342('0x31')](db[_0x0342('0x32')]['rawAttributes'],function(_0x57f6b7){return{'name':_0x57f6b7[_0x0342('0x33')],'type':_0x57f6b7[_0x0342('0x34')][_0x0342('0x35')]};});_0x558aa6[_0x0342('0x36')]=_['map'](_0x1ff328,'name');_0x558aa6['query']=_[_0x0342('0x37')](_0x3f7ad0[_0x0342('0x38')]);_0x558aa6['filters']=_[_0x0342('0x39')](_0x558aa6['model'],_0x558aa6[_0x0342('0x38')]);_0x29271e[_0x0342('0x3a')]=_[_0x0342('0x39')](_0x558aa6[_0x0342('0x36')],qs[_0x0342('0x3b')](_0x3f7ad0[_0x0342('0x38')]['fields']));_0x29271e[_0x0342('0x3a')]=_0x29271e['attributes'][_0x0342('0x3c')]?_0x29271e[_0x0342('0x3a')]:_0x558aa6[_0x0342('0x36')];if(!_0x3f7ad0[_0x0342('0x38')][_0x0342('0x3d')](_0x0342('0x3e'))){_0x29271e[_0x0342('0x20')]=qs['limit'](_0x3f7ad0[_0x0342('0x38')]['limit']);_0x29271e[_0x0342('0x1e')]=qs[_0x0342('0x1e')](_0x3f7ad0[_0x0342('0x38')][_0x0342('0x1e')]);}_0x29271e[_0x0342('0x3f')]=qs[_0x0342('0x40')](_0x3f7ad0[_0x0342('0x38')][_0x0342('0x40')]);_0x29271e[_0x0342('0x41')]=qs['filters'](_[_0x0342('0x42')](_0x3f7ad0[_0x0342('0x38')],_0x558aa6['filters']),_0x1ff328);if(_0x3f7ad0[_0x0342('0x38')][_0x0342('0x43')]){_0x29271e[_0x0342('0x41')]=_[_0x0342('0x2c')](_0x29271e[_0x0342('0x41')],{'$or':_[_0x0342('0x31')](_0x1ff328,function(_0x50bba5){if(_0x50bba5[_0x0342('0x34')]!==_0x0342('0x44')){var _0x3932f3={};_0x3932f3[_0x50bba5[_0x0342('0x2a')]]={'$like':'%'+_0x3f7ad0[_0x0342('0x38')][_0x0342('0x43')]+'%'};return _0x3932f3;}})});}_0x29271e=_['merge']({},_0x29271e,_0x3f7ad0['options']);var _0x30d586={'where':_0x29271e[_0x0342('0x41')]};return db[_0x0342('0x32')][_0x0342('0x21')](_0x30d586)[_0x0342('0x28')](function(_0x51bf79){_0x5bc00c[_0x0342('0x21')]=_0x51bf79;if(_0x3f7ad0[_0x0342('0x38')][_0x0342('0x45')]){_0x29271e[_0x0342('0x46')]=[{'all':!![]}];}return db[_0x0342('0x32')][_0x0342('0x47')](_0x29271e);})[_0x0342('0x28')](function(_0x5692b0){_0x5bc00c[_0x0342('0x48')]=_0x5692b0;return _0x5bc00c;})[_0x0342('0x28')](respondWithFilteredResult(_0x1aa92f,_0x29271e))['catch'](handleError(_0x1aa92f,null));};exports[_0x0342('0x49')]=function(_0x3f9af7,_0xbdc50b){var _0x238191={'raw':!![],'where':{'id':_0x3f9af7[_0x0342('0x4a')]['id']}},_0x3bf061={};_0x3bf061[_0x0342('0x36')]=_['keys'](db[_0x0342('0x32')][_0x0342('0x4b')]);_0x3bf061[_0x0342('0x38')]=_[_0x0342('0x37')](_0x3f9af7['query']);_0x3bf061[_0x0342('0x4c')]=_[_0x0342('0x39')](_0x3bf061[_0x0342('0x36')],_0x3bf061[_0x0342('0x38')]);_0x238191[_0x0342('0x3a')]=_['intersection'](_0x3bf061[_0x0342('0x36')],qs[_0x0342('0x3b')](_0x3f9af7['query'][_0x0342('0x3b')]));_0x238191['attributes']=_0x238191[_0x0342('0x3a')]['length']?_0x238191['attributes']:_0x3bf061['model'];if(_0x3f9af7[_0x0342('0x38')][_0x0342('0x45')]){_0x238191[_0x0342('0x46')]=[{'all':!![]}];}_0x238191=_['merge']({},_0x238191,_0x3f9af7['options']);return db[_0x0342('0x32')]['find'](_0x238191)[_0x0342('0x28')](handleEntityNotFound(_0xbdc50b,null))['then'](respondWithResult(_0xbdc50b,null))['catch'](handleError(_0xbdc50b,null));};exports[_0x0342('0x4d')]=function(_0x360219,_0x2667a8){return db[_0x0342('0x32')][_0x0342('0x4d')](_0x360219['body'],{})[_0x0342('0x28')](respondWithResult(_0x2667a8,0xc9))[_0x0342('0x4e')](handleError(_0x2667a8,null));};exports[_0x0342('0x26')]=function(_0x17738b,_0x318e4e){if(_0x17738b[_0x0342('0x4f')]['id']){delete _0x17738b['body']['id'];}return db['WhatsappTransferReport'][_0x0342('0x50')]({'where':{'id':_0x17738b[_0x0342('0x4a')]['id']}})[_0x0342('0x28')](handleEntityNotFound(_0x318e4e,null))[_0x0342('0x28')](saveUpdates(_0x17738b[_0x0342('0x4f')],null))[_0x0342('0x28')](respondWithResult(_0x318e4e,null))['catch'](handleError(_0x318e4e,null));};exports[_0x0342('0x27')]=function(_0x1f118d,_0x94cdfb){return db[_0x0342('0x32')][_0x0342('0x50')]({'where':{'id':_0x1f118d[_0x0342('0x4a')]['id']}})[_0x0342('0x28')](handleEntityNotFound(_0x94cdfb,null))[_0x0342('0x28')](removeEntity(_0x94cdfb,null))[_0x0342('0x4e')](handleError(_0x94cdfb,null));};exports['describe']=function(_0x427765,_0x2a7c8a){return db['WhatsappTransferReport'][_0x0342('0x51')]()[_0x0342('0x28')](respondWithResult(_0x2a7c8a,null))['catch'](handleError(_0x2a7c8a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index c211e92..2948ea7 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 _0x1cc2=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3ce594,_0x551d92){var _0x14fd06=function(_0x381396){while(--_0x381396){_0x3ce594['push'](_0x3ce594['shift']());}};_0x14fd06(++_0x551d92);}(_0x1cc2,0x1aa));var _0x21cc=function(_0x44b676,_0x40e28f){_0x44b676=_0x44b676-0x0;var _0x21dbf8=_0x1cc2[_0x44b676];return _0x21dbf8;};'use strict';var _=require('lodash');var util=require(_0x21cc('0x0'));var logger=require(_0x21cc('0x1'))(_0x21cc('0x2'));var moment=require(_0x21cc('0x3'));var BPromise=require(_0x21cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x21cc('0x5'));var rimraf=require(_0x21cc('0x6'));var config=require(_0x21cc('0x7'));var attributes=require(_0x21cc('0x8'));module[_0x21cc('0x9')]=function(_0x4250db,_0x253a87){return _0x4250db[_0x21cc('0xa')](_0x21cc('0xb'),attributes,{'tableName':_0x21cc('0xc'),'paranoid':![],'indexes':[{'name':_0x21cc('0xd'),'fields':[_0x21cc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf542=['bluebird','request-promise','path','rimraf','define','WhatsappTransferReport','util','api'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xf542,0x156));var _0x2f54=function(_0x42d256,_0x405508){_0x42d256=_0x42d256-0x0;var _0x230db6=_0xf542[_0x42d256];return _0x230db6;};'use strict';var _=require('lodash');var util=require(_0x2f54('0x0'));var logger=require('../../config/logger')(_0x2f54('0x1'));var moment=require('moment');var BPromise=require(_0x2f54('0x2'));var rp=require(_0x2f54('0x3'));var fs=require('fs');var path=require(_0x2f54('0x4'));var rimraf=require(_0x2f54('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x4d4f91,_0x16d1e7){return _0x4d4f91[_0x2f54('0x6')](_0x2f54('0x7'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b123f86..4aca83f 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 _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x1aff04,_0x191254){var _0x1d1cde=function(_0x518107){while(--_0x518107){_0x1aff04['push'](_0x1aff04['shift']());}};_0x1d1cde(++_0x191254);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x1950f6,_0x14fdba){var _0x340d09=function(_0x10cfb7){while(--_0x10cfb7){_0x1950f6['push'](_0x1950f6['shift']());}};_0x340d09(++_0x14fdba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 40e7e80..9914486 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3646=['./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','map','online','name','join','status','None','seedDB','./config/seedDB','default','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3646,0x15f));var _0x6364=function(_0xce5270,_0x4d11e4){_0xce5270=_0xce5270-0x0;var _0x361ecd=_0x3646[_0xce5270];return _0x361ecd;};'use strict';var _=require(_0x6364('0x0'));var mysqldb=require(_0x6364('0x1'));var rpc=require(_0x6364('0x2'));var config=require(_0x6364('0x3'));var logger=require('./config/logger')(_0x6364('0x4'));var pm2=require(_0x6364('0x5'));var pm2Config=require(_0x6364('0x6'));var schedule=require(_0x6364('0x7'));var chat=require(_0x6364('0x8'));var whatsapp=require(_0x6364('0x9'));var transcribe=require(_0x6364('0xa'));function main(){return mysqldb['db'][_0x6364('0xb')][_0x6364('0xc')]()[_0x6364('0xd')](function(){return rpc[_0x6364('0xe')]();})['then'](function(_0x1be238){logger[_0x6364('0xf')](_0x1be238);return chat[_0x6364('0x10')]();})[_0x6364('0xd')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x6364('0xd')](function(){return transcribe[_0x6364('0x10')]();})[_0x6364('0xd')](function(_0x3cdd63){logger[_0x6364('0xf')](_0x3cdd63);return pm2[_0x6364('0x10')](pm2Config);})[_0x6364('0xd')](function(_0x536daf){logger[_0x6364('0xf')](_0x6364('0x11'),_[_0x6364('0x12')](_['filter'](_0x536daf,{'status':_0x6364('0x13')}),_0x6364('0x14'))[_0x6364('0x15')]());logger[_0x6364('0xf')]('Offline\x20apps:',_[_0x6364('0x12')](_['filter'](_0x536daf,function(_0x24bf33){return _0x24bf33[_0x6364('0x16')]!==_0x6364('0x13');}),'name')[_0x6364('0x15')]()||_0x6364('0x17'));config[_0x6364('0x18')]&&require(_0x6364('0x19'))[_0x6364('0x1a')]();require(_0x6364('0x1b'))[_0x6364('0x1a')]();})['catch'](function(_0xfb0fbb){logger['error'](_0x6364('0x1c'),_0xfb0fbb);process[_0x6364('0x1d')](0x1);});}main(); \ No newline at end of file +var _0xb4f8=['Offline\x20apps:','map','status','None','seedDB','./config/seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','info','start','Online\x20apps:','filter','online','name','join'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0xb4f8,0x83));var _0x8b4f=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xb4f8[_0x2555d0];return _0x3bb486;};'use strict';var _=require('lodash');var mysqldb=require(_0x8b4f('0x0'));var rpc=require(_0x8b4f('0x1'));var config=require(_0x8b4f('0x2'));var logger=require(_0x8b4f('0x3'))(_0x8b4f('0x4'));var pm2=require(_0x8b4f('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x8b4f('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x8b4f('0x7'));var transcribe=require(_0x8b4f('0x8'));function main(){return mysqldb['db'][_0x8b4f('0x9')][_0x8b4f('0xa')]()[_0x8b4f('0xb')](function(){return rpc['listen']();})[_0x8b4f('0xb')](function(_0xa91c09){logger[_0x8b4f('0xc')](_0xa91c09);return chat['start']();})[_0x8b4f('0xb')](function(){return whatsapp[_0x8b4f('0xd')]();})[_0x8b4f('0xb')](function(){return schedule[_0x8b4f('0xd')]();})[_0x8b4f('0xb')](function(){return transcribe['start']();})[_0x8b4f('0xb')](function(_0x2c23b8){logger['info'](_0x2c23b8);return pm2[_0x8b4f('0xd')](pm2Config);})[_0x8b4f('0xb')](function(_0x4fecd7){logger[_0x8b4f('0xc')](_0x8b4f('0xe'),_['map'](_[_0x8b4f('0xf')](_0x4fecd7,{'status':_0x8b4f('0x10')}),_0x8b4f('0x11'))[_0x8b4f('0x12')]());logger['info'](_0x8b4f('0x13'),_[_0x8b4f('0x14')](_[_0x8b4f('0xf')](_0x4fecd7,function(_0x3c42f1){return _0x3c42f1[_0x8b4f('0x15')]!==_0x8b4f('0x10');}),'name')[_0x8b4f('0x12')]()||_0x8b4f('0x16'));config[_0x8b4f('0x17')]&&require(_0x8b4f('0x18'))[_0x8b4f('0x19')]();require(_0x8b4f('0x1a'))[_0x8b4f('0x19')]();})['catch'](function(_0x24307f){logger[_0x8b4f('0x1b')](_0x8b4f('0x1c'),_0x24307f);process[_0x8b4f('0x1d')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 68fe245..f3c82dd 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 _0xa383=['Invalid\x20API\x20access\x20key','find','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','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','unshift','encryptString','join','promisify','session','options','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','express-jwt','composable-middleware','basic-auth','crypto','util','secrets','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','Unmanaged.','catch','headers','authorization','startsWith','Basic','User','status','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockedAt','minutes'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa383,0xa1));var _0x3a38=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xa383[_0xb1cf84];return _0x4bad2e;};'use strict';var db=require(_0x3a38('0x0'))['db'];var config=require(_0x3a38('0x1'));var hardwareConf=require(_0x3a38('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x3a38('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x3a38('0x4'));var compose=require(_0x3a38('0x5'));var basicAuth=require(_0x3a38('0x6'));var crypto=require(_0x3a38('0x7'));var BPromise=require('bluebird');var util=require(_0x3a38('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x3a38('0x9')]['session']});var userAttributes=['id',_0x3a38('0xa'),_0x3a38('0xb'),_0x3a38('0xc'),_0x3a38('0xd'),'email','userpic',_0x3a38('0xe'),_0x3a38('0xf'),_0x3a38('0x10'),_0x3a38('0x11'),_0x3a38('0x12'),'faxPause',_0x3a38('0x13'),_0x3a38('0x14'),_0x3a38('0x15'),'showWebBar',_0x3a38('0x16'),_0x3a38('0x17'),_0x3a38('0x18'),_0x3a38('0x19'),_0x3a38('0x1a'),'alias',_0x3a38('0x1b'),_0x3a38('0x1c'),_0x3a38('0x1d'),_0x3a38('0x1e'),_0x3a38('0x1f'),'phoneBarEnableSettings','phoneBarExpires',_0x3a38('0x20'),_0x3a38('0x21'),_0x3a38('0x22'),_0x3a38('0x23'),_0x3a38('0x24'),_0x3a38('0x25'),'privacyEnabled',_0x3a38('0x26'),_0x3a38('0x27'),_0x3a38('0x28'),_0x3a38('0x29'),_0x3a38('0x2a')];exports[_0x3a38('0x2b')]=function(){return this[_0x3a38('0x2c')](!![])[_0x3a38('0x2d')](function(_0x2a1058,_0x2e3f1e,_0x110bc5){if(_0x2a1058[_0x3a38('0x2e')]){_0x110bc5();}else{return db[_0x3a38('0x2f')][_0x3a38('0x30')]({'where':{'id':_0x2a1058['params']['id']},'attributes':['id',_0x3a38('0x31'),_0x3a38('0x32')],'raw':!![]})[_0x3a38('0x33')](function(_0x977d8){if(_0x977d8&&_0x977d8['closed']){return _0x2e3f1e['status'](_0x977d8[_0x3a38('0x32')]==='unmanaged'?0x195:0x193)['json']({'message':_0x977d8[_0x3a38('0x32')]===_0x3a38('0x34')?_0x3a38('0x35'):'Forbidden.'});}else{_0x110bc5();}})[_0x3a38('0x36')](function(_0xf3bd1){_0x110bc5(_0xf3bd1);});}});};exports[_0x3a38('0x2c')]=function isAuthenticated(_0x4f077f){return compose()[_0x3a38('0x2d')](function(_0x1e044f,_0x454cb9,_0x3b5e08){var _0x3a6cec;if(_0x1e044f[_0x3a38('0x37')][_0x3a38('0x38')]){if(_[_0x3a38('0x39')](_0x1e044f[_0x3a38('0x37')][_0x3a38('0x38')],_0x3a38('0x3a'))){var _0x4bebd3=basicAuth(_0x1e044f);db[_0x3a38('0x3b')]['find']({'where':{'name':_0x4bebd3['name']}})[_0x3a38('0x33')](function(_0x5be4bb){if(!_0x5be4bb||!_0x5be4bb['authenticate'](_0x4bebd3['pass'])){return _0x454cb9[_0x3a38('0x3c')](0x191)[_0x3a38('0x3d')]({'message':_0x3a38('0x3e')});}_0x1e044f[_0x3a38('0x2e')]={'id':_0x5be4bb['id']};_0x3b5e08();})['catch'](function(_0x3399be){_0x3b5e08(_0x3399be);});}else if(_[_0x3a38('0x39')](_0x1e044f[_0x3a38('0x37')]['authorization'],_0x3a38('0x3f'))){validateJwt(_0x1e044f,_0x454cb9,_0x3b5e08);}else{if(_0x4f077f){_0x3b5e08();}else{return _0x454cb9[_0x3a38('0x3c')](0x193)[_0x3a38('0x3d')]({'message':_0x3a38('0x40')});}}}else if(_0x1e044f[_0x3a38('0x41')][_0x3a38('0x42')]){try{var _0x209e79={'audience':hardwareConf[_0x3a38('0x43')](),'issuer':hardwareConf[_0x3a38('0x43')]()};verifyJwt(_0x1e044f[_0x3a38('0x41')][_0x3a38('0x42')],_0x209e79)[_0x3a38('0x33')](function(_0x47af1f){return db['User']['find']({'where':{'id':_0x47af1f['sub']}})['then'](function(_0x30ca50){_0x3a6cec=_0x30ca50;return db[_0x3a38('0x44')][_0x3a38('0x30')]({'where':{'id':0x1},'attributes':[_0x3a38('0x45'),_0x3a38('0x46')],'raw':!![]});})[_0x3a38('0x33')](function(_0x4b8a11){if(!_0x3a6cec||!_[_0x3a38('0x47')](_0x3a6cec['apiKeyNonce'],_0x47af1f[_0x3a38('0x48')])){return _0x454cb9[_0x3a38('0x3c')](0x191)[_0x3a38('0x3d')]({'message':_0x3a38('0x49')});}if(_0x3a6cec[_0x3a38('0x4a')]){return _0x454cb9[_0x3a38('0x3c')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x3a6cec['blocked']){if(_0x4b8a11[_0x3a38('0x46')]>0x0){if(moment(_0x3a6cec[_0x3a38('0x4b')])['add'](_0x4b8a11['blockDuration'],_0x3a38('0x4c'))>moment()){return _0x454cb9[_0x3a38('0x3c')](0x191)[_0x3a38('0x3d')]({'message':_0x3a38('0x4d')});}}else{return _0x454cb9[_0x3a38('0x3c')](0x191)['json']({'message':_0x3a38('0x4d')});}}_0x1e044f[_0x3a38('0x2e')]={'id':_0x3a6cec['id']};_0x3b5e08();});})[_0x3a38('0x36')](function(){return _0x454cb9[_0x3a38('0x3c')](0x191)['json']({'message':_0x3a38('0x4d')});});}catch(_0x66c3a7){_0x3b5e08(_0x66c3a7);}}else if(_0x4f077f){_0x3b5e08();}else{return _0x454cb9[_0x3a38('0x3c')](0x193)[_0x3a38('0x3d')]({'message':'Unknown\x20authorization\x20format'});}})[_0x3a38('0x2d')](function(_0x3a4cd1,_0x5bf907,_0x4e127a){if(_0x3a4cd1[_0x3a38('0x2e')]){db['User'][_0x3a38('0x4e')]({'where':{'id':_0x3a4cd1[_0x3a38('0x2e')]['id']},'attributes':userAttributes})[_0x3a38('0x33')](function(_0x38ac86){if(!_0x38ac86){return _0x5bf907[_0x3a38('0x3c')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x3a4cd1[_0x3a38('0x2e')]=_0x38ac86;_0x4e127a();})['catch'](function(_0x3cdef4){_0x4e127a(_0x3cdef4);});}else if(_0x4f077f){_0x4e127a();}else{return _0x5bf907[_0x3a38('0x3c')](0x194)[_0x3a38('0x3d')]({'message':_0x3a38('0x4f')});}});};exports[_0x3a38('0x50')]=function canUpdate(){return compose()['use'](function(_0x5907bc,_0xf8dd83,_0x30873b){return licenseUtil[_0x3a38('0x51')]()[_0x3a38('0x33')](function(_0x28cf3f){if(_0x28cf3f[_0x3a38('0x52')]){_0x30873b();}else{return _0xf8dd83[_0x3a38('0x3c')](0x193)[_0x3a38('0x3d')]({'message':_0x3a38('0x53')});}})[_0x3a38('0x36')](function(_0x1bb015){_0x30873b(_0x1bb015);});});};exports['isMiddleware']=function(_0x5c767f,_0x43275b,_0x30575c){_0x5c767f['isMiddleware']=!![];return _0x30575c();};exports[_0x3a38('0x54')]=function signToken(_0x25a368){return signJwt(_0x25a368);};exports[_0x3a38('0x55')]=function(_0x20ddb0,_0x431e61){if(!_0x20ddb0[_0x3a38('0x2e')]){return _0x431e61[_0x3a38('0x3c')](0x194)[_0x3a38('0x3d')]({'message':_0x3a38('0x56')});}var _0x464ded={'payload':{'id':_0x20ddb0[_0x3a38('0x2e')]['id'],'role':_0x20ddb0[_0x3a38('0x2e')][_0x3a38('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x464ded)[_0x3a38('0x33')](function(_0x41e6a8){_0x431e61[_0x3a38('0x57')](_0x3a38('0x58'),_0x41e6a8);_0x431e61[_0x3a38('0x59')]('/dashboards/general');})[_0x3a38('0x36')](function(_0x17eca1){return _0x431e61['status'](0x1f4)[_0x3a38('0x5a')](_0x17eca1);});};exports[_0x3a38('0x5b')]=function(_0x1d7f23){if(_['isNil'](_0x1d7f23['apiKeyNonce'])||_['isNil'](_0x1d7f23[_0x3a38('0x5c')])){return null;}else{return createJwt(_0x1d7f23);}};exports[_0x3a38('0x5d')]=function(_0x23f6f7){_0x23f6f7[_0x3a38('0x5e')]=generateNonce();_0x23f6f7[_0x3a38('0x5c')]=generateIssuedAt();return createJwt(_0x23f6f7);};exports[_0x3a38('0x5f')]=function(_0x320605,_0x2552c0){var _0x312aaf=_0x320605[_0x3a38('0x41')]['apikey'];if(_0x312aaf){var _0x7e2c58={'nonce':_0x2552c0[_0x3a38('0x5e')],'iat':_0x2552c0[_0x3a38('0x5c')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x312aaf,_0x7e2c58)[_0x3a38('0x33')](function(){return generateApiKey(_0x2552c0);});}else{throw{'message':_0x3a38('0x60')};}};exports['validatePasswordPattern']=function(_0x1ec4e6){var _0x3da6cf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3da6cf['test'](_0x1ec4e6))throw new db[(_0x3a38('0x61'))]['ValidationError'](_0x3a38('0x62'));return;};exports[_0x3a38('0x63')]=function(_0x506625,_0x2ff1c7,_0x33b209){var _0x3475d1=encryptor[_0x3a38('0x64')](_0x2ff1c7)[_0x3a38('0x65')](',');for(var _0x5bd65c=0x0;_0x5bd65c<_0x33b209;_0x5bd65c++){if(!_0x3475d1[_0x5bd65c])break;if(_0x506625[_0x3a38('0x66')]()===_0x3475d1[_0x5bd65c][_0x3a38('0x66')]()){var _0x57be45=util[_0x3a38('0x67')](_0x3a38('0x68'),_0x33b209);if(_0x33b209===0x1){_0x57be45=_0x3a38('0x69');}throw new db[(_0x3a38('0x61'))]['ValidationError'](_0x57be45);}}return;};exports[_0x3a38('0x6a')]=function(_0x3483bd,_0x317596){var _0x22556d=_0x317596?encryptor['decryptString'](_0x317596)[_0x3a38('0x65')](','):[];if(_0x22556d[_0x3a38('0x6b')]===0x5){_0x22556d[_0x3a38('0x6c')](-0x1,0x1);}_0x22556d[_0x3a38('0x6d')](_0x3483bd);return encryptor[_0x3a38('0x6e')](_0x22556d[_0x3a38('0x6f')](','));};function signJwt(_0xf04b13){var _0x13ace0=BPromise[_0x3a38('0x70')](jwt['sign'],{'context':jwt});var _0x4e0bc7=_0xf04b13['secret']||config['secrets'][_0x3a38('0x71')];return new BPromise(function(_0x4f9197,_0x4e6755){_0x13ace0(_0xf04b13['payload'],_0x4e0bc7,_0xf04b13[_0x3a38('0x72')])[_0x3a38('0x33')](function(_0x3adda0){_0x4f9197(_0x3adda0);})[_0x3a38('0x36')](function(_0x1aa96f){_0x4e6755(_0x1aa96f);});});}function verifyJwt(_0xa0eaf8,_0xf3366f,_0x4ea1d7){var _0x22e4c1=BPromise[_0x3a38('0x70')](jwt['verify'],{'context':jwt});var _0x492a95=_0x4ea1d7||config[_0x3a38('0x9')]['session'];return new BPromise(function(_0x43f3d5,_0x2ac720){_0x22e4c1(_0xa0eaf8,_0x492a95,_0xf3366f)[_0x3a38('0x33')](function(_0x13da1d){_0x43f3d5(_0x13da1d);})[_0x3a38('0x36')](function(_0x4e99aa){_0x2ac720(_0x4e99aa);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x3a38('0x73')]('hex');}function generateIssuedAt(){return Math[_0x3a38('0x74')](Date[_0x3a38('0x75')]()/0x3e8)[_0x3a38('0x73')]();}function createJwt(_0x55cae2){var _0xc8e752={'payload':{'iat':_0x55cae2[_0x3a38('0x5c')],'nonce':_0x55cae2[_0x3a38('0x5e')]},'options':{'algorithm':_0x3a38('0x76'),'subject':_0x55cae2['id'][_0x3a38('0x73')](),'issuer':hardwareConf[_0x3a38('0x43')](),'audience':hardwareConf[_0x3a38('0x43')]()}};return signJwt(_0xc8e752)[_0x3a38('0x33')](function(_0x3377c2){return{'iat':_0x55cae2['apiKeyIat'],'nonce':_0x55cae2[_0x3a38('0x5e')],'token':_0x3377c2};});} \ No newline at end of file +var _0x09eb=['interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','use','headers','authorization','startsWith','find','authenticate','pass','Wrong\x20credentials.','catch','Bearer','query','apikey','User','sub','Setting','allowedLoginAttempts','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','user','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','getUuid','validatePasswordPattern','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.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','payload','verify','randomBytes','toString','hex','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','composable-middleware','basic-auth','bluebird','util','secrets','session','role','fullname','name','internal','email','userpic','md5secret','voicePause','chatPause','mailPause','pauseType','showWebBar','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk'];(function(_0x24f430,_0x523751){var _0x23cc82=function(_0x2bf6fc){while(--_0x2bf6fc){_0x24f430['push'](_0x24f430['shift']());}};_0x23cc82(++_0x523751);}(_0x09eb,0x1b0));var _0xb09e=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x09eb[_0x4347ec];return _0x4c8314;};'use strict';var db=require(_0xb09e('0x0'))['db'];var config=require(_0xb09e('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xb09e('0x2'));var encryptor=require(_0xb09e('0x3'));var _=require(_0xb09e('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xb09e('0x5'));var basicAuth=require(_0xb09e('0x6'));var crypto=require('crypto');var BPromise=require(_0xb09e('0x7'));var util=require(_0xb09e('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb09e('0x9')][_0xb09e('0xa')]});var userAttributes=['id',_0xb09e('0xb'),_0xb09e('0xc'),_0xb09e('0xd'),_0xb09e('0xe'),_0xb09e('0xf'),_0xb09e('0x10'),'permissions',_0xb09e('0x11'),_0xb09e('0x12'),_0xb09e('0x13'),_0xb09e('0x14'),'faxPause','smsPause','openchannelPause',_0xb09e('0x15'),_0xb09e('0x16'),'lastLoginAt','lastPauseAt',_0xb09e('0x17'),_0xb09e('0x18'),'passwordResetAt',_0xb09e('0x19'),_0xb09e('0x1a'),_0xb09e('0x1b'),_0xb09e('0x1c'),_0xb09e('0x1d'),_0xb09e('0x1e'),_0xb09e('0x1f'),_0xb09e('0x20'),_0xb09e('0x21'),_0xb09e('0x22'),'phoneBarRemoteControlPort',_0xb09e('0x23'),_0xb09e('0x24'),_0xb09e('0x25'),_0xb09e('0x26'),_0xb09e('0x27'),_0xb09e('0x28'),_0xb09e('0x29'),'downloadOmnichannelInteractions',_0xb09e('0x2a')];exports[_0xb09e('0x2b')]=function(){return this[_0xb09e('0x2c')](!![])['use'](function(_0x133f2b,_0x51a2ec,_0x551306){if(_0x133f2b['user']){_0x551306();}else{return db[_0xb09e('0x2d')][_0xb09e('0x2e')]({'where':{'id':_0x133f2b[_0xb09e('0x2f')]['id']},'attributes':['id',_0xb09e('0x30'),_0xb09e('0x31')],'raw':!![]})[_0xb09e('0x32')](function(_0x3e0032){if(_0x3e0032&&_0x3e0032[_0xb09e('0x30')]){return _0x51a2ec[_0xb09e('0x33')](_0x3e0032[_0xb09e('0x31')]===_0xb09e('0x34')?0x195:0x193)[_0xb09e('0x35')]({'message':_0x3e0032[_0xb09e('0x31')]===_0xb09e('0x34')?_0xb09e('0x36'):'Forbidden.'});}else{_0x551306();}})['catch'](function(_0x5b7ae8){_0x551306(_0x5b7ae8);});}});};exports[_0xb09e('0x2c')]=function isAuthenticated(_0x3e51d2){return compose()[_0xb09e('0x37')](function(_0x317250,_0x51f611,_0x5aa104){var _0x501f6d;if(_0x317250[_0xb09e('0x38')][_0xb09e('0x39')]){if(_[_0xb09e('0x3a')](_0x317250[_0xb09e('0x38')][_0xb09e('0x39')],'Basic')){var _0x3430af=basicAuth(_0x317250);db['User'][_0xb09e('0x3b')]({'where':{'name':_0x3430af[_0xb09e('0xd')]}})[_0xb09e('0x32')](function(_0x316e29){if(!_0x316e29||!_0x316e29[_0xb09e('0x3c')](_0x3430af[_0xb09e('0x3d')])){return _0x51f611[_0xb09e('0x33')](0x191)[_0xb09e('0x35')]({'message':_0xb09e('0x3e')});}_0x317250['user']={'id':_0x316e29['id']};_0x5aa104();})[_0xb09e('0x3f')](function(_0x2d8d0a){_0x5aa104(_0x2d8d0a);});}else if(_[_0xb09e('0x3a')](_0x317250[_0xb09e('0x38')][_0xb09e('0x39')],_0xb09e('0x40'))){validateJwt(_0x317250,_0x51f611,_0x5aa104);}else{if(_0x3e51d2){_0x5aa104();}else{return _0x51f611[_0xb09e('0x33')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x317250[_0xb09e('0x41')][_0xb09e('0x42')]){try{var _0x151c6d={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x317250[_0xb09e('0x41')][_0xb09e('0x42')],_0x151c6d)[_0xb09e('0x32')](function(_0x14da7c){return db[_0xb09e('0x43')][_0xb09e('0x3b')]({'where':{'id':_0x14da7c[_0xb09e('0x44')]}})[_0xb09e('0x32')](function(_0x5c04ac){_0x501f6d=_0x5c04ac;return db[_0xb09e('0x45')][_0xb09e('0x2e')]({'where':{'id':0x1},'attributes':[_0xb09e('0x46'),'blockDuration'],'raw':!![]});})[_0xb09e('0x32')](function(_0x4e04ab){if(!_0x501f6d||!_['isEqual'](_0x501f6d['apiKeyNonce'],_0x14da7c['nonce'])){return _0x51f611[_0xb09e('0x33')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x501f6d[_0xb09e('0x47')]){return _0x51f611[_0xb09e('0x33')](0x191)[_0xb09e('0x35')]({'message':_0xb09e('0x48')});}if(_0x501f6d[_0xb09e('0x49')]){if(_0x4e04ab['blockDuration']>0x0){if(moment(_0x501f6d[_0xb09e('0x4a')])['add'](_0x4e04ab['blockDuration'],_0xb09e('0x4b'))>moment()){return _0x51f611['status'](0x191)[_0xb09e('0x35')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x51f611[_0xb09e('0x33')](0x191)[_0xb09e('0x35')]({'message':_0xb09e('0x48')});}}_0x317250[_0xb09e('0x4c')]={'id':_0x501f6d['id']};_0x5aa104();});})['catch'](function(){return _0x51f611[_0xb09e('0x33')](0x191)[_0xb09e('0x35')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1e850c){_0x5aa104(_0x1e850c);}}else if(_0x3e51d2){_0x5aa104();}else{return _0x51f611[_0xb09e('0x33')](0x193)[_0xb09e('0x35')]({'message':_0xb09e('0x4d')});}})[_0xb09e('0x37')](function(_0x38436d,_0x1303ce,_0x33fc38){if(_0x38436d[_0xb09e('0x4c')]){db[_0xb09e('0x43')]['find']({'where':{'id':_0x38436d[_0xb09e('0x4c')]['id']},'attributes':userAttributes})['then'](function(_0x4a6e68){if(!_0x4a6e68){return _0x1303ce[_0xb09e('0x33')](0x194)[_0xb09e('0x35')]({'message':_0xb09e('0x4e')});}_0x38436d['user']=_0x4a6e68;_0x33fc38();})[_0xb09e('0x3f')](function(_0xb83674){_0x33fc38(_0xb83674);});}else if(_0x3e51d2){_0x33fc38();}else{return _0x1303ce[_0xb09e('0x33')](0x194)[_0xb09e('0x35')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xb09e('0x4f')]=function canUpdate(){return compose()['use'](function(_0x59a7d4,_0x2d33f9,_0x58b7cd){return licenseUtil['getLicense']()['then'](function(_0x4c1f51){if(_0x4c1f51[_0xb09e('0x50')]){_0x58b7cd();}else{return _0x2d33f9[_0xb09e('0x33')](0x193)[_0xb09e('0x35')]({'message':_0xb09e('0x51')});}})['catch'](function(_0x48e154){_0x58b7cd(_0x48e154);});});};exports[_0xb09e('0x52')]=function(_0x32e10f,_0x8f0a4e,_0x382cc0){_0x32e10f[_0xb09e('0x52')]=!![];return _0x382cc0();};exports[_0xb09e('0x53')]=function signToken(_0x4d49e8){return signJwt(_0x4d49e8);};exports[_0xb09e('0x54')]=function(_0x3cd412,_0x1d80a3){if(!_0x3cd412[_0xb09e('0x4c')]){return _0x1d80a3[_0xb09e('0x33')](0x194)[_0xb09e('0x35')]({'message':_0xb09e('0x55')});}var _0x43ba95={'payload':{'id':_0x3cd412[_0xb09e('0x4c')]['id'],'role':_0x3cd412['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x43ba95)['then'](function(_0x5caddc){_0x1d80a3['cookie']('motion.token',_0x5caddc);_0x1d80a3[_0xb09e('0x56')](_0xb09e('0x57'));})[_0xb09e('0x3f')](function(_0x5ea106){return _0x1d80a3[_0xb09e('0x33')](0x1f4)[_0xb09e('0x58')](_0x5ea106);});};exports[_0xb09e('0x59')]=function(_0x1219ef){if(_['isNil'](_0x1219ef[_0xb09e('0x5a')])||_[_0xb09e('0x5b')](_0x1219ef['apiKeyIat'])){return null;}else{return createJwt(_0x1219ef);}};exports['generateApiKey']=function(_0x515d28){_0x515d28[_0xb09e('0x5a')]=generateNonce();_0x515d28[_0xb09e('0x5c')]=generateIssuedAt();return createJwt(_0x515d28);};exports['regenerateApiKey']=function(_0x42849f,_0xa4fefc){var _0x58d2c7=_0x42849f[_0xb09e('0x41')][_0xb09e('0x42')];if(_0x58d2c7){var _0x45a4a8={'nonce':_0xa4fefc[_0xb09e('0x5a')],'iat':_0xa4fefc['apiKeyIat'],'audience':hardwareConf[_0xb09e('0x5d')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x58d2c7,_0x45a4a8)[_0xb09e('0x32')](function(){return generateApiKey(_0xa4fefc);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xb09e('0x5e')]=function(_0x3656ee){var _0x46440c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x46440c['test'](_0x3656ee))throw new db['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~!@#$%^&-_=+[{]}.');return;};exports[_0xb09e('0x5f')]=function(_0x11c427,_0x2d8a09,_0x4db6b4){var _0x294f88=encryptor[_0xb09e('0x60')](_0x2d8a09)[_0xb09e('0x61')](',');for(var _0x7c5a35=0x0;_0x7c5a35<_0x4db6b4;_0x7c5a35++){if(!_0x294f88[_0x7c5a35])break;if(_0x11c427[_0xb09e('0x62')]()===_0x294f88[_0x7c5a35][_0xb09e('0x62')]()){var _0x4937e9=util[_0xb09e('0x63')](_0xb09e('0x64'),_0x4db6b4);if(_0x4db6b4===0x1){_0x4937e9=_0xb09e('0x65');}throw new db[(_0xb09e('0x66'))][(_0xb09e('0x67'))](_0x4937e9);}}return;};exports[_0xb09e('0x68')]=function(_0x5c6bdc,_0x275cd5){var _0x4201e2=_0x275cd5?encryptor['decryptString'](_0x275cd5)[_0xb09e('0x61')](','):[];if(_0x4201e2[_0xb09e('0x69')]===0x5){_0x4201e2[_0xb09e('0x6a')](-0x1,0x1);}_0x4201e2[_0xb09e('0x6b')](_0x5c6bdc);return encryptor[_0xb09e('0x6c')](_0x4201e2[_0xb09e('0x6d')](','));};function signJwt(_0x3c0b2b){var _0x46b4c6=BPromise['promisify'](jwt[_0xb09e('0x6e')],{'context':jwt});var _0x18cfa9=_0x3c0b2b[_0xb09e('0x6f')]||config['secrets'][_0xb09e('0xa')];return new BPromise(function(_0x30b8f7,_0x286f8a){_0x46b4c6(_0x3c0b2b[_0xb09e('0x70')],_0x18cfa9,_0x3c0b2b['options'])[_0xb09e('0x32')](function(_0x3fd806){_0x30b8f7(_0x3fd806);})[_0xb09e('0x3f')](function(_0x566b8){_0x286f8a(_0x566b8);});});}function verifyJwt(_0x10245a,_0x50b9b7,_0xe57e9e){var _0x102a99=BPromise['promisify'](jwt[_0xb09e('0x71')],{'context':jwt});var _0x524b77=_0xe57e9e||config['secrets']['session'];return new BPromise(function(_0x4275b6,_0x3765f1){_0x102a99(_0x10245a,_0x524b77,_0x50b9b7)['then'](function(_0x97baba){_0x4275b6(_0x97baba);})['catch'](function(_0x2e91aa){_0x3765f1(_0x2e91aa);});});}function generateNonce(){return crypto[_0xb09e('0x72')](0x10)[_0xb09e('0x73')](_0xb09e('0x74'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0xb09e('0x73')]();}function createJwt(_0x1b0190){var _0xbe3e30={'payload':{'iat':_0x1b0190['apiKeyIat'],'nonce':_0x1b0190[_0xb09e('0x5a')]},'options':{'algorithm':'HS512','subject':_0x1b0190['id'][_0xb09e('0x73')](),'issuer':hardwareConf[_0xb09e('0x5d')](),'audience':hardwareConf[_0xb09e('0x5d')]()}};return signJwt(_0xbe3e30)[_0xb09e('0x32')](function(_0x46be5b){return{'iat':_0x1b0190[_0xb09e('0x5c')],'nonce':_0x1b0190[_0xb09e('0x5a')],'token':_0x46be5b};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e776d59..25e28c5 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 _0x5dc3=['aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','binary','end','final','close','createDecipher','data','write','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr'];(function(_0x17860c,_0xc68d53){var _0x4af837=function(_0x2ccdb2){while(--_0x2ccdb2){_0x17860c['push'](_0x17860c['shift']());}};_0x4af837(++_0xc68d53);}(_0x5dc3,0xa7));var _0x35dc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5dc3[_0x6c993a];return _0x27f547;};'use strict';var crypto=require(_0x35dc('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x35dc('0x1'));var config=require(_0x35dc('0x2'));var logger=require(_0x35dc('0x3'))(_0x35dc('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x35dc('0x5')][_0x35dc('0x6')],'algorithm':_0x35dc('0x7')};const fileOptions={'algorithm':_0x35dc('0x8')};if(config[_0x35dc('0x9')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x35dc('0x9')][_0x35dc('0xa')]);if(isSupported){fileOptions[_0x35dc('0xa')]=config['encrypt'][_0x35dc('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x35dc('0xb')](',\x20');logger['error'](config[_0x35dc('0x9')][_0x35dc('0xa')],_0x35dc('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x15850a){return AES_SUPPORTED_RX[_0x35dc('0xd')](_0x15850a);}function getSupportedCiphers(){return crypto[_0x35dc('0xe')]()[_0x35dc('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x2b6e80){return getSupportedCiphers()[_0x35dc('0x10')](_0x2b6e80)>-0x1;}function combineOptions(_0x31134e){var _0x48a206={};for(var _0x1f9e37 in fileOptions){if(fileOptions['hasOwnProperty'](_0x1f9e37)){_0x48a206[_0x1f9e37]=fileOptions[_0x1f9e37];}}if(_0x31134e){for(var _0x18f20b in _0x31134e){if(_0x31134e[_0x35dc('0x11')](_0x18f20b)){_0x48a206[_0x18f20b]=_0x31134e[_0x18f20b];}}}return _0x48a206;}exports[_0x35dc('0x12')]=function(_0xc90a67,_0x167f7a,_0x560198,_0x3e71c0){return new BPromise(function(_0x30305d,_0x5e9b5f){_0x3e71c0=combineOptions(_0x3e71c0);var _0x986615=new Buffer(_0x560198);var _0x4c575b=fs[_0x35dc('0x13')](_0xc90a67);var _0x3c3e14=fs[_0x35dc('0x14')](_0x167f7a);var _0x2ab972=crypto[_0x35dc('0x15')](_0x3e71c0[_0x35dc('0xa')],_0x986615);_0x4c575b['on']('data',function(_0x56df95){var _0x1d3255=new Buffer(_0x2ab972[_0x35dc('0x16')](_0x56df95),_0x35dc('0x17'));_0x3c3e14['write'](_0x1d3255);});_0x4c575b['on'](_0x35dc('0x18'),function(){try{var _0x188ec3=new Buffer(_0x2ab972[_0x35dc('0x19')](_0x35dc('0x17')),'binary');_0x3c3e14['write'](_0x188ec3);_0x3c3e14['end']();_0x3c3e14['on'](_0x35dc('0x1a'),function(){return _0x30305d(_0x167f7a);});}catch(_0x3c076e){fs['unlink'](_0x167f7a);return _0x5e9b5f(_0x3c076e);}});});};exports['decryptFile']=function(_0x3208e5,_0x1afb44,_0x27a16d,_0x24dbf5){return new BPromise(function(_0x228ca3,_0x2cc8d6){_0x24dbf5=combineOptions(_0x24dbf5);var _0x5e4002=new Buffer(_0x27a16d);var _0x3d3231=fs[_0x35dc('0x13')](_0x3208e5);var _0x11feb0=fs[_0x35dc('0x14')](_0x1afb44);var _0x4ac1e7=crypto[_0x35dc('0x1b')](_0x24dbf5[_0x35dc('0xa')],_0x5e4002);_0x3d3231['on'](_0x35dc('0x1c'),function(_0x373127){var _0x5ad13e=new Buffer(_0x4ac1e7['update'](_0x373127),'binary');_0x11feb0[_0x35dc('0x1d')](_0x5ad13e);});_0x3d3231['on'](_0x35dc('0x18'),function(){try{var _0x50c63d=new Buffer(_0x4ac1e7['final'](_0x35dc('0x17')),'binary');_0x11feb0[_0x35dc('0x1d')](_0x50c63d);_0x11feb0[_0x35dc('0x18')]();_0x11feb0['on'](_0x35dc('0x1a'),function(){return _0x228ca3(_0x1afb44);});}catch(_0x430e22){fs['unlink'](_0x1afb44);return _0x2cc8d6(_0x430e22);}});});};exports[_0x35dc('0x1e')]=function(_0x406e61,_0x1663bf,_0x4a1d91){var _0x44275e=_0x4a1d91||stringOptions[_0x35dc('0xa')];var _0x2d7cf4=_0x1663bf||stringOptions[_0x35dc('0x1f')];var _0x386d9f=crypto['createCipher'](_0x44275e,_0x2d7cf4);var _0x44908e=_0x386d9f[_0x35dc('0x16')](_0x406e61,_0x35dc('0x20'),_0x35dc('0x21'));_0x44908e+=_0x386d9f[_0x35dc('0x19')](_0x35dc('0x21'));return _0x44908e;};exports[_0x35dc('0x22')]=function(_0x29955b,_0x2b043,_0x29a2ca){var _0x4ff4c2=_0x29a2ca||stringOptions[_0x35dc('0xa')];var _0xf9f563=_0x2b043||stringOptions[_0x35dc('0x1f')];var _0x32b3be=crypto[_0x35dc('0x1b')](_0x4ff4c2,_0xf9f563);var _0x496e0c=_0x32b3be[_0x35dc('0x16')](_0x29955b,_0x35dc('0x21'),_0x35dc('0x20'));_0x496e0c+=_0x32b3be[_0x35dc('0x19')](_0x35dc('0x20'));return _0x496e0c;}; \ No newline at end of file +var _0x45c9=['app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','write','end','final','close','decryptFile','createDecipher','unlink','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger'];(function(_0x161cb0,_0x49e476){var _0x1966c6=function(_0x51ca31){while(--_0x51ca31){_0x161cb0['push'](_0x161cb0['shift']());}};_0x1966c6(++_0x49e476);}(_0x45c9,0x1c2));var _0x945c=function(_0x4fa554,_0x3d2529){_0x4fa554=_0x4fa554-0x0;var _0x8ffbfc=_0x45c9[_0x4fa554];return _0x8ffbfc;};'use strict';var crypto=require(_0x945c('0x0'));var fs=require('fs');var BPromise=require(_0x945c('0x1'));var _=require(_0x945c('0x2'));var config=require(_0x945c('0x3'));var logger=require(_0x945c('0x4'))(_0x945c('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x945c('0x6')][_0x945c('0x7')],'algorithm':_0x945c('0x8')};const fileOptions={'algorithm':'aes192'};if(config[_0x945c('0x9')]&&config[_0x945c('0x9')][_0x945c('0xa')]){var isSupported=isAlgorithmSupported(config[_0x945c('0x9')][_0x945c('0xa')]);if(isSupported){fileOptions[_0x945c('0xa')]=config['encrypt'][_0x945c('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x945c('0xb')](',\x20');logger[_0x945c('0xc')](config[_0x945c('0x9')][_0x945c('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x56e948){return AES_SUPPORTED_RX['test'](_0x56e948);}function getSupportedCiphers(){return crypto[_0x945c('0xd')]()[_0x945c('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x40f5d0){return getSupportedCiphers()[_0x945c('0xf')](_0x40f5d0)>-0x1;}function combineOptions(_0x12c87c){var _0x3b112e={};for(var _0xdd04e2 in fileOptions){if(fileOptions[_0x945c('0x10')](_0xdd04e2)){_0x3b112e[_0xdd04e2]=fileOptions[_0xdd04e2];}}if(_0x12c87c){for(var _0x1daca1 in _0x12c87c){if(_0x12c87c[_0x945c('0x10')](_0x1daca1)){_0x3b112e[_0x1daca1]=_0x12c87c[_0x1daca1];}}}return _0x3b112e;}exports[_0x945c('0x11')]=function(_0x3d27f7,_0x5c2301,_0x2e5e84,_0x418a89){return new BPromise(function(_0x59c7ab,_0x9e239f){_0x418a89=combineOptions(_0x418a89);var _0x425064=new Buffer(_0x2e5e84);var _0x1c7829=fs[_0x945c('0x12')](_0x3d27f7);var _0x24b9ac=fs[_0x945c('0x13')](_0x5c2301);var _0x5d6ee2=crypto['createCipher'](_0x418a89[_0x945c('0xa')],_0x425064);_0x1c7829['on'](_0x945c('0x14'),function(_0x4ecf8e){var _0x451581=new Buffer(_0x5d6ee2[_0x945c('0x15')](_0x4ecf8e),_0x945c('0x16'));_0x24b9ac[_0x945c('0x17')](_0x451581);});_0x1c7829['on'](_0x945c('0x18'),function(){try{var _0x4cc344=new Buffer(_0x5d6ee2[_0x945c('0x19')](_0x945c('0x16')),'binary');_0x24b9ac[_0x945c('0x17')](_0x4cc344);_0x24b9ac['end']();_0x24b9ac['on'](_0x945c('0x1a'),function(){return _0x59c7ab(_0x5c2301);});}catch(_0x57b02f){fs['unlink'](_0x5c2301);return _0x9e239f(_0x57b02f);}});});};exports[_0x945c('0x1b')]=function(_0xc5334a,_0x9d41d4,_0x141f9e,_0x107f91){return new BPromise(function(_0x1eb463,_0x1a207f){_0x107f91=combineOptions(_0x107f91);var _0x4bf3d5=new Buffer(_0x141f9e);var _0x535423=fs['createReadStream'](_0xc5334a);var _0x18b529=fs['createWriteStream'](_0x9d41d4);var _0x277ceb=crypto[_0x945c('0x1c')](_0x107f91[_0x945c('0xa')],_0x4bf3d5);_0x535423['on'](_0x945c('0x14'),function(_0x54c7f6){var _0x168547=new Buffer(_0x277ceb[_0x945c('0x15')](_0x54c7f6),'binary');_0x18b529[_0x945c('0x17')](_0x168547);});_0x535423['on']('end',function(){try{var _0x5160a8=new Buffer(_0x277ceb['final'](_0x945c('0x16')),_0x945c('0x16'));_0x18b529[_0x945c('0x17')](_0x5160a8);_0x18b529[_0x945c('0x18')]();_0x18b529['on']('close',function(){return _0x1eb463(_0x9d41d4);});}catch(_0x576a3e){fs[_0x945c('0x1d')](_0x9d41d4);return _0x1a207f(_0x576a3e);}});});};exports[_0x945c('0x1e')]=function(_0x3b93de,_0x4821fd,_0x115507){var _0x3d4e14=_0x115507||stringOptions[_0x945c('0xa')];var _0x263be1=_0x4821fd||stringOptions[_0x945c('0x1f')];var _0x75bbc9=crypto['createCipher'](_0x3d4e14,_0x263be1);var _0x4c811a=_0x75bbc9['update'](_0x3b93de,_0x945c('0x20'),_0x945c('0x21'));_0x4c811a+=_0x75bbc9[_0x945c('0x19')](_0x945c('0x21'));return _0x4c811a;};exports[_0x945c('0x22')]=function(_0x372b8b,_0x3258ad,_0x66821d){var _0x12b18a=_0x66821d||stringOptions[_0x945c('0xa')];var _0x4de60b=_0x3258ad||stringOptions[_0x945c('0x1f')];var _0x29a73d=crypto[_0x945c('0x1c')](_0x12b18a,_0x4de60b);var _0x550cf1=_0x29a73d['update'](_0x372b8b,_0x945c('0x21'),_0x945c('0x20'));_0x550cf1+=_0x29a73d['final'](_0x945c('0x20'));return _0x550cf1;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 5131408..a428ace 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 _0x64bf=['to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','num','Empty','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','.csv','existsSync','join','mkdirSync','length','csv','%s.%s','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','inspect','Failed','finally','util'];(function(_0x1a64f3,_0x4b2b6b){var _0x37d68f=function(_0x386b3f){while(--_0x386b3f){_0x1a64f3['push'](_0x1a64f3['shift']());}};_0x37d68f(++_0x4b2b6b);}(_0x64bf,0x179));var _0xf64b=function(_0x257a83,_0x2283e1){_0x257a83=_0x257a83-0x0;var _0xce18ca=_0x64bf[_0x257a83];return _0xce18ca;};'use strict';var util=require(_0xf64b('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0xf64b('0x1'));var fs=require('fs');var BPromise=require(_0xf64b('0x2'));var zipdir=require(_0xf64b('0x3'));var rimraf=require(_0xf64b('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf64b('0x5'))[_0xf64b('0x6')];var logger=require(_0xf64b('0x7'))(_0xf64b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xf64b('0x9')][0x2]);var QUERY=process[_0xf64b('0x9')][0x3];var PATH=process[_0xf64b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x30c373,_0x5659ec){var _0x5b9771={'status':_0x30c373};var _0x329409={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5659ec){_0x5b9771[_0xf64b('0xa')]=_0x5659ec;}return db['AnalyticExtractedReport'][_0xf64b('0xb')](_0x5b9771,_0x329409);}function main(){var _0x511542=0x1388;var _0x426558;logger[_0xf64b('0xc')](util[_0xf64b('0xd')](_0xf64b('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xf64b('0xf')][_0xf64b('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf64b('0x11'),_0xf64b('0x12')]})[_0xf64b('0x13')](function(_0x3ddfa6){if(_0x3ddfa6){_0x426558=_0x3ddfa6;_0x511542=_0x426558[_0xf64b('0x12')]||0x1388;}})[_0xf64b('0x13')](function(){return dbH[_0xf64b('0x14')][_0xf64b('0x15')](util[_0xf64b('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf64b('0x14')]['QueryTypes']['SELECT']});})[_0xf64b('0x13')](function(_0x175e26){if(!_0x175e26[0x0][_0xf64b('0x16')]){return analyticExtractedReport(_0xf64b('0x17'));}var _0x59d5ff=[];var _0x299b5d=0x0;var _0x57d736=!![];if(_0x175e26&&_0x175e26['length']){var _0x1f6e4e=_0x175e26[0x0][_0xf64b('0x16')]%(_0x299b5d+_0x511542);if(_0x426558['split']){for(;_0x57d736;_0x299b5d+=_0x511542,_0x1f6e4e=_0x175e26[0x0]['num']%(_0x299b5d+_0x511542)){if(_0x1f6e4e==0x0||_0x1f6e4e==_0x175e26[0x0][_0xf64b('0x16')]){_0x57d736=![];}_0x59d5ff[_0xf64b('0x18')](dbH[_0xf64b('0x14')]['query'](util[_0xf64b('0xd')](_0xf64b('0x19'),QUERY,_0x511542,_0x299b5d),{'type':dbH[_0xf64b('0x14')][_0xf64b('0x1a')][_0xf64b('0x1b')]}));}}else{_0x59d5ff[_0xf64b('0x18')](dbH[_0xf64b('0x14')][_0xf64b('0x15')](QUERY,{'type':dbH[_0xf64b('0x14')]['QueryTypes'][_0xf64b('0x1b')]}));}}var _0x4b7c59=path['dirname'](PATH);var _0x52add7=path['basename'](PATH,_0xf64b('0x1c'));var _0x7ada4e=_0x426558[_0xf64b('0x11')]&&_0x59d5ff['length']>0x1;var _0x4556fc=[];if(!fs[_0xf64b('0x1d')](path[_0xf64b('0x1e')](_0x4b7c59,_0x52add7))&&_0x7ada4e){fs[_0xf64b('0x1f')](path['join'](_0x4b7c59,_0x52add7));}return BPromise['each'](_0x59d5ff,function(_0x24f670){_0x4556fc[_0xf64b('0x18')](_0x24f670);})[_0xf64b('0x13')](function(){for(var _0x143c2b=0x0;_0x143c2b<_0x4556fc[_0xf64b('0x20')];_0x143c2b+=0x1){var _0x507ff3;var _0x42e2f7=_0x4556fc[_0x143c2b];if(_0x7ada4e){_0x507ff3=path['join'](_0x4b7c59,_0x52add7,util[_0xf64b('0xd')]('%s%d.%s',_0x52add7,_0x143c2b,_0xf64b('0x21')));}else{_0x507ff3=path[_0xf64b('0x1e')](_0x4b7c59,util[_0xf64b('0xd')](_0xf64b('0x22'),_0x52add7,_0xf64b('0x21')));}fs['writeFileSync'](_0x507ff3,csv(_0x42e2f7));}})[_0xf64b('0x13')](function(){if(_0x7ada4e){zipdir(path['join'](_0x4b7c59,_0x52add7),{'saveTo':path[_0xf64b('0x1e')](_0x4b7c59,util[_0xf64b('0xd')](_0xf64b('0x22'),_0x52add7,_0xf64b('0x23')))},function(_0x5d9b27,_0x3a35ba){});rimraf(path['join'](_0x4b7c59,_0x52add7),function(){});}})['then'](function(){logger[_0xf64b('0xc')](util[_0xf64b('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xf64b('0x24'),_0x7ada4e?util['format'](_0xf64b('0x22'),_0x52add7,_0x7ada4e?_0xf64b('0x23'):_0xf64b('0x21')):null);});})['catch'](function(_0x415135){logger[_0xf64b('0xc')](util[_0xf64b('0xd')](_0xf64b('0x25'),EXTRACTED_REPORT_ID,_0xf64b('0x26')),util[_0xf64b('0x27')](_0x415135,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf64b('0x28'));})[_0xf64b('0x29')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb3eb=['push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','mkdirSync','each','join','%s.%s','csv','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','split'];(function(_0x36d5e0,_0x33b060){var _0x33667a=function(_0x17dbd9){while(--_0x17dbd9){_0x36d5e0['push'](_0x36d5e0['shift']());}};_0x33667a(++_0x33b060);}(_0xb3eb,0x1a7));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var path=require(_0xbb3e('0x0'));var _=require('lodash');var csv=require(_0xbb3e('0x1'));var fs=require('fs');var BPromise=require(_0xbb3e('0x2'));var zipdir=require(_0xbb3e('0x3'));var rimraf=require('rimraf');var db=require(_0xbb3e('0x4'))['db'];var dbH=require(_0xbb3e('0x4'))[_0xbb3e('0x5')];var logger=require(_0xbb3e('0x6'))(_0xbb3e('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xbb3e('0x8')][0x2]);var QUERY=process[_0xbb3e('0x8')][0x3];var PATH=process[_0xbb3e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x499a4e,_0x5ad811){var _0x30c96e={'status':_0x499a4e};var _0x40eb32={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ad811){_0x30c96e[_0xbb3e('0x9')]=_0x5ad811;}return db[_0xbb3e('0xa')][_0xbb3e('0xb')](_0x30c96e,_0x40eb32);}function main(){var _0x547846=0x1388;var _0x25ba1d;logger[_0xbb3e('0xc')](util[_0xbb3e('0xd')](_0xbb3e('0xe'),EXTRACTED_REPORT_ID,_0xbb3e('0xf')));return db['Setting'][_0xbb3e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xbb3e('0x11')]})[_0xbb3e('0x12')](function(_0x496a52){if(_0x496a52){_0x25ba1d=_0x496a52;_0x547846=_0x25ba1d['splitSizeCsv']||0x1388;}})[_0xbb3e('0x12')](function(){return dbH[_0xbb3e('0x13')]['query'](util[_0xbb3e('0xd')](_0xbb3e('0x14'),QUERY),{'type':dbH[_0xbb3e('0x13')][_0xbb3e('0x15')][_0xbb3e('0x16')]});})[_0xbb3e('0x12')](function(_0x45efe5){if(!_0x45efe5[0x0][_0xbb3e('0x17')]){return analyticExtractedReport(_0xbb3e('0x18'));}var _0x2039b3=[];var _0x51d9fe=0x0;var _0x3a38d1=!![];if(_0x45efe5&&_0x45efe5[_0xbb3e('0x19')]){var _0x103d28=_0x45efe5[0x0]['num']%(_0x51d9fe+_0x547846);if(_0x25ba1d[_0xbb3e('0x1a')]){for(;_0x3a38d1;_0x51d9fe+=_0x547846,_0x103d28=_0x45efe5[0x0][_0xbb3e('0x17')]%(_0x51d9fe+_0x547846)){if(_0x103d28==0x0||_0x103d28==_0x45efe5[0x0][_0xbb3e('0x17')]){_0x3a38d1=![];}_0x2039b3[_0xbb3e('0x1b')](dbH[_0xbb3e('0x13')][_0xbb3e('0x1c')](util[_0xbb3e('0xd')](_0xbb3e('0x1d'),QUERY,_0x547846,_0x51d9fe),{'type':dbH[_0xbb3e('0x13')][_0xbb3e('0x15')][_0xbb3e('0x16')]}));}}else{_0x2039b3[_0xbb3e('0x1b')](dbH[_0xbb3e('0x13')][_0xbb3e('0x1c')](QUERY,{'type':dbH[_0xbb3e('0x13')]['QueryTypes'][_0xbb3e('0x16')]}));}}var _0x407b8f=path[_0xbb3e('0x1e')](PATH);var _0x34c2b0=path[_0xbb3e('0x1f')](PATH,'.csv');var _0x1b7073=_0x25ba1d[_0xbb3e('0x1a')]&&_0x2039b3[_0xbb3e('0x19')]>0x1;var _0x3c3430=[];if(!fs[_0xbb3e('0x20')](path['join'](_0x407b8f,_0x34c2b0))&&_0x1b7073){fs[_0xbb3e('0x21')](path['join'](_0x407b8f,_0x34c2b0));}return BPromise[_0xbb3e('0x22')](_0x2039b3,function(_0x5ded9d){_0x3c3430[_0xbb3e('0x1b')](_0x5ded9d);})[_0xbb3e('0x12')](function(){for(var _0x157892=0x0;_0x157892<_0x3c3430[_0xbb3e('0x19')];_0x157892+=0x1){var _0x1ff0c6;var _0xb1d20=_0x3c3430[_0x157892];if(_0x1b7073){_0x1ff0c6=path[_0xbb3e('0x23')](_0x407b8f,_0x34c2b0,util[_0xbb3e('0xd')]('%s%d.%s',_0x34c2b0,_0x157892,'csv'));}else{_0x1ff0c6=path[_0xbb3e('0x23')](_0x407b8f,util['format'](_0xbb3e('0x24'),_0x34c2b0,_0xbb3e('0x25')));}fs['writeFileSync'](_0x1ff0c6,csv(_0xb1d20));}})[_0xbb3e('0x12')](function(){if(_0x1b7073){zipdir(path[_0xbb3e('0x23')](_0x407b8f,_0x34c2b0),{'saveTo':path[_0xbb3e('0x23')](_0x407b8f,util[_0xbb3e('0xd')](_0xbb3e('0x24'),_0x34c2b0,_0xbb3e('0x26')))},function(_0x328c72,_0x50c6a5){});rimraf(path['join'](_0x407b8f,_0x34c2b0),function(){});}})[_0xbb3e('0x12')](function(){logger['info'](util[_0xbb3e('0xd')](_0xbb3e('0x27'),EXTRACTED_REPORT_ID,_0xbb3e('0xf')));return analyticExtractedReport('Completed',_0x1b7073?util[_0xbb3e('0xd')](_0xbb3e('0x24'),_0x34c2b0,_0x1b7073?_0xbb3e('0x26'):_0xbb3e('0x25')):null);});})[_0xbb3e('0x28')](function(_0x45d9bb){logger[_0xbb3e('0xc')](util[_0xbb3e('0xd')](_0xbb3e('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x45d9bb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbb3e('0x2a'));})[_0xbb3e('0x2b')](function(){process[_0xbb3e('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 35b50da..c2aaaf2 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 _0xc10a=['tableHeader','toString','value','body','push','keys','length','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','pageBreak','before','margin','landscape','\x20/\x20','black','right','num','Empty','%s.%s','pdf','Setting','find','split','splitSizePdf','then','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','existsSync','join','mkdirSync','all','flatten','createPdfKitDocument','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','PDF','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','end','createPdfFromHTML','lodash','path','html-to-pdfmake','rimraf','jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map'];(function(_0x50330d,_0x111b8c){var _0x1efa82=function(_0x722d98){while(--_0x722d98){_0x50330d['push'](_0x50330d['shift']());}};_0x1efa82(++_0x111b8c);}(_0xc10a,0x190));var _0xac10=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xc10a[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xac10('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xac10('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0xac10('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xac10('0x3'));var JSDOM=require(_0xac10('0x4'))[_0xac10('0x5')];var window=new JSDOM('')['window'];var db=require(_0xac10('0x6'))['db'];var dbH=require('../../mysqldb')[_0xac10('0x7')];var logger=require(_0xac10('0x8'))(_0xac10('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xac10('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xac10('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3cb886,_0x59cda0){var _0x1669cb={'status':_0x3cb886};var _0x4d7127={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59cda0){_0x1669cb[_0xac10('0xc')]=_0x59cda0;}return db['AnalyticExtractedReport'][_0xac10('0xd')](_0x1669cb,_0x4d7127);}function getHeaders(_0x8dec9c){return _[_0xac10('0xe')](_0x8dec9c,function(_0x65d95f){return{'text':_0x65d95f,'style':_0xac10('0xf')};});}function getRows(_0x4469ea,_0x1ac45d){return _[_0xac10('0xe')](_0x1ac45d,function(_0x4d98c2){return _(_0x4d98c2)['pick'](_0x4469ea)[_0xac10('0xe')](function(_0x2d4688){return _0x2d4688?_[_0xac10('0x10')](_0x2d4688):'';})[_0xac10('0x11')]();});}function createTable(_0x3d4c67,_0x761ec5){var _0x486c61={'widths':_['fill'](Array(_0x3d4c67['length']),0x91),'heights':function(_0x47764b){return _0x47764b===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x34b749=getHeaders(_0x3d4c67);_0x486c61[_0xac10('0x12')][_0xac10('0x13')](_0x34b749);var _0xd9e211=getRows(_0x3d4c67,_0x761ec5);_0x486c61['body']=_0x486c61[_0xac10('0x12')]['concat'](_0xd9e211);return _0x486c61;}function createTables(_0x2fbb57){var _0x5b8868=[];var _0xc189f3=Object[_0xac10('0x14')](_0x2fbb57[0x0]);if(_0xc189f3[_0xac10('0x15')]>0x5)_0xc189f3=_[_0xac10('0x16')](Object[_0xac10('0x14')](_0x2fbb57[0x0]),0x5);_0xc189f3['forEach'](function(_0x2019cf){_0x5b8868[_0xac10('0x13')](createTable(_0x2019cf,_0x2fbb57));});return _0x5b8868;}function getPDFDocDefinition(_0x19819f){var _0x1625ee=util[_0xac10('0x17')](_0xac10('0x18'),NAME,EXTRACTED_REPORT[_0xac10('0x19')],moment(EXTRACTED_REPORT[_0xac10('0x1a')])[_0xac10('0x17')](FORMAT),moment(EXTRACTED_REPORT[_0xac10('0x1b')])[_0xac10('0x17')](FORMAT));var _0x1ec174=[];for(var _0x276fea=0x0;_0x276fea<_0x19819f[_0xac10('0x15')];_0x276fea++){var _0xeb4e78=[];if(_0x276fea===0x0){_0xeb4e78[_0xac10('0x13')]({'text':_0x1625ee,'style':'header'});}var _0x1d0ddb={'table':_0x19819f[_0x276fea]};if(_0x276fea>0x0){_0x1d0ddb[_0xac10('0x1c')]=_0xac10('0x1d');_0x1d0ddb[_0xac10('0x1e')]=[0x0,0x46,0x0,0x0];}_0xeb4e78[_0xac10('0x13')](_0x1d0ddb);_0x1ec174[_0xac10('0x13')](_0xeb4e78);}return{'pageSize':'A4','pageOrientation':_0xac10('0x1f'),'content':_0x1ec174,'footer':function(_0x5ad3f3,_0x460e21){return{'text':_0x5ad3f3[_0xac10('0x10')]()+_0xac10('0x20')+_0x460e21,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xac10('0x21')},'footer':{'alignment':_0xac10('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1aa60d){var _0xa04b1=0x1388;var _0x389e1e;if(!_0x1aa60d[0x0][_0xac10('0x23')]){return analyticExtractedReport(_0xac10('0x24'));}var _0x2128ac=[];var _0x1dcd57=0x0;var _0x19b7b9=!![];var _0x1451b4=path['dirname'](PATH);var _0x155143=path['basename'](PATH,'.pdf');var _0x5e9476=path['join'](_0x1451b4,util[_0xac10('0x17')](_0xac10('0x25'),_0x155143,_0xac10('0x26')));var _0x48d15b=![];return db[_0xac10('0x27')][_0xac10('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xac10('0x29'),_0xac10('0x2a')]})[_0xac10('0x2b')](function(_0x3ebae2){if(_0x3ebae2){_0x389e1e=_0x3ebae2;_0xa04b1=_0x389e1e['splitSizePdf']||0x3e8;}})['then'](function(){if(_0x1aa60d&&_0x1aa60d[_0xac10('0x15')]){var _0x152309=_0x1aa60d[0x0]['num']%(_0x1dcd57+_0xa04b1);if(_0x389e1e['split']){for(;_0x19b7b9;_0x1dcd57+=_0xa04b1,_0x152309=_0x1aa60d[0x0][_0xac10('0x23')]%(_0x1dcd57+_0xa04b1)){if(_0x152309==0x0||_0x152309==_0x1aa60d[0x0][_0xac10('0x23')]){_0x19b7b9=![];}_0x2128ac[_0xac10('0x13')](dbH[_0xac10('0x2c')]['query'](util[_0xac10('0x17')](_0xac10('0x2d'),QUERY,_0xa04b1,_0x1dcd57),{'type':dbH[_0xac10('0x2c')][_0xac10('0x2e')][_0xac10('0x2f')]}));}}else{_0x2128ac['push'](dbH[_0xac10('0x2c')][_0xac10('0x30')](QUERY,{'type':dbH[_0xac10('0x2c')]['QueryTypes']['SELECT']}));}}_0x48d15b=_0x389e1e[_0xac10('0x29')]&&_0x2128ac['length']>0x1;if(!fs[_0xac10('0x31')](path[_0xac10('0x32')](_0x1451b4,_0x155143))&&_0x48d15b){fs[_0xac10('0x33')](path[_0xac10('0x32')](_0x1451b4,_0x155143));}return Promise[_0xac10('0x34')](_0x2128ac);})['then'](function(_0x11c692){return createTables(_[_0xac10('0x35')](_0x11c692));})[_0xac10('0x2b')](function(_0x3d63c4){var _0x5b045b=getPDFDocDefinition(_0x3d63c4);var _0x2c2d2b=getPDFPrinter();var _0x1f4613=_0x2c2d2b[_0xac10('0x36')](_0x5b045b);if(_0x48d15b)_0x5e9476=path[_0xac10('0x32')](_0x1451b4,_0x155143,util[_0xac10('0x17')]('%s%d.%s',_0x155143,index,_0xac10('0x26')));return writePDFDocument(_0x1f4613,_0x5e9476);})[_0xac10('0x2b')](function(){if(!_0x48d15b)return;zipdir(path[_0xac10('0x32')](_0x1451b4,_0x155143),{'saveTo':path['join'](_0x1451b4,util[_0xac10('0x17')](_0xac10('0x25'),_0x155143,_0xac10('0x37')))},function(_0x440812){if(_0x440812)throw _0x440812;return;});})[_0xac10('0x2b')](function(){if(!_0x48d15b)return;rimraf(path[_0xac10('0x32')](_0x1451b4,_0x155143),function(){});})[_0xac10('0x2b')](function(){logger[_0xac10('0x38')](util[_0xac10('0x17')](_0xac10('0x39'),EXTRACTED_REPORT_ID,_0xac10('0x3a')));return analyticExtractedReport(_0xac10('0x3b'),_0x48d15b?util[_0xac10('0x17')](_0xac10('0x25'),_0x155143,_0x48d15b?'zip':'pdf'):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xac10('0x38')](util[_0xac10('0x17')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xac10('0x3c')));return db[_0xac10('0x3d')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xac10('0x2b')](function(_0x4a600c){EXTRACTED_REPORT=_0x4a600c;return dbH[_0xac10('0x2c')][_0xac10('0x30')](util[_0xac10('0x17')](_0xac10('0x3e'),QUERY),{'type':dbH[_0xac10('0x2c')][_0xac10('0x2e')][_0xac10('0x2f')]});})['then'](extractReport)[_0xac10('0x3f')](function(_0x29fd11){logger[_0xac10('0x38')](util[_0xac10('0x17')](_0xac10('0x40'),EXTRACTED_REPORT_ID,_0xac10('0x3c')),util[_0xac10('0x41')](_0x29fd11,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xac10('0x42'));})[_0xac10('0x43')](function(){process[_0xac10('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x59c9a7=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xac10('0x45'),'italics':__dirname+_0xac10('0x46'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x59c9a7;}function getPDFDocDefinitionFromHTML(_0x5b3ac2,_0x8fdb8d){var _0x2753d3=util[_0xac10('0x17')]('%s\x20#%d',_0x8fdb8d[_0xac10('0x47')],_0x8fdb8d[_0xac10('0x48')]);var _0x102e6a=moment()['format'](_0xac10('0x49'))['toString']();var _0x5c3bb9=htmlToPdfmake(_0x5b3ac2,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5c3bb9],'defaultStyle':{'font':_0xac10('0x4a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xac10('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xac10('0x4c'),'style':'header'}];},'footer':function(_0x2b910f,_0x5a8e8a){return[{'text':util[_0xac10('0x17')](_0xac10('0x4d'),_0x2753d3,_0x2b910f,_0x5a8e8a,_0x102e6a),'style':_0xac10('0x4e')}];}};}function writePDFDocument(_0x38104a,_0x451c95){return new Promise(function(_0x4010d3,_0x4f01e2){var _0x4603d1=_0x38104a['pipe'](fs[_0xac10('0x4f')](_0x451c95));_0x4603d1['on']('finish',function(){_0x4010d3(_0xac10('0x50'));});_0x4603d1['on']('error',function(_0x5cf50b){_0x4f01e2(_0x5cf50b);});_0x38104a[_0xac10('0x51')]();});}exports[_0xac10('0x52')]=function(_0x186f00,_0xc1ff6a){var _0x2dce79=getPDFPrinter();var _0x29b663=getPDFDocDefinitionFromHTML(_0x186f00,_0xc1ff6a);var _0x253d47=_0x2dce79[_0xac10('0x36')](_0x29b663);return writePDFDocument(_0x253d47,_0xc1ff6a[_0xac10('0x1')])[_0xac10('0x3f')](function(_0x4ce842){throw _0x4ce842;});}; \ No newline at end of file +var _0x27ed=['existsSync','join','all','flatten','createPdfKitDocument','%s%d.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','PDF','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','center','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','util','path','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','auto','body','push','concat','keys','chunk','forEach','format','endDate','before','\x20/\x20','footer','Arial','black','num','Empty','dirname','basename','.pdf','%s.%s','pdf','Setting','find','split','splitSizePdf','then','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT'];(function(_0x51f877,_0x2fe830){var _0xa5fa62=function(_0x3bfc49){while(--_0x3bfc49){_0x51f877['push'](_0x51f877['shift']());}};_0xa5fa62(++_0x2fe830);}(_0x27ed,0x1d3));var _0xd27e=function(_0x5b86ea,_0x488ce9){_0x5b86ea=_0x5b86ea-0x0;var _0x51dd6e=_0x27ed[_0x5b86ea];return _0x51dd6e;};'use strict';var _=require(_0xd27e('0x0'));var fs=require('fs');var util=require(_0xd27e('0x1'));var path=require(_0xd27e('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0xd27e('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xd27e('0x4'));var rimraf=require(_0xd27e('0x5'));var JSDOM=require(_0xd27e('0x6'))[_0xd27e('0x7')];var window=new JSDOM('')[_0xd27e('0x8')];var db=require(_0xd27e('0x9'))['db'];var dbH=require('../../mysqldb')[_0xd27e('0xa')];var logger=require(_0xd27e('0xb'))(_0xd27e('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xd27e('0xd')][0x2]);var QUERY=process[_0xd27e('0xd')][0x3];var PATH=process[_0xd27e('0xd')][0x4];var NAME=process[_0xd27e('0xd')][0x5];var FORMAT=_0xd27e('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1eb09d,_0x4f4ef8){var _0x1e205f={'status':_0x1eb09d};var _0x7bf174={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f4ef8){_0x1e205f[_0xd27e('0xf')]=_0x4f4ef8;}return db[_0xd27e('0x10')][_0xd27e('0x11')](_0x1e205f,_0x7bf174);}function getHeaders(_0x2239d5){return _[_0xd27e('0x12')](_0x2239d5,function(_0x235b38){return{'text':_0x235b38,'style':'tableHeader'};});}function getRows(_0x27691e,_0x3531c2){return _[_0xd27e('0x12')](_0x3531c2,function(_0x176388){return _(_0x176388)[_0xd27e('0x13')](_0x27691e)[_0xd27e('0x12')](function(_0x20707c){return _0x20707c?_[_0xd27e('0x14')](_0x20707c):'';})[_0xd27e('0x15')]();});}function createTable(_0x511cc3,_0x172cef){var _0xcbe906={'widths':_[_0xd27e('0x16')](Array(_0x511cc3[_0xd27e('0x17')]),0x91),'heights':function(_0x1adbb2){return _0x1adbb2===0x0?_0xd27e('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x33e5f0=getHeaders(_0x511cc3);_0xcbe906[_0xd27e('0x19')][_0xd27e('0x1a')](_0x33e5f0);var _0x3484a0=getRows(_0x511cc3,_0x172cef);_0xcbe906['body']=_0xcbe906['body'][_0xd27e('0x1b')](_0x3484a0);return _0xcbe906;}function createTables(_0x24df9b){var _0x26dee1=[];var _0x460dd2=Object[_0xd27e('0x1c')](_0x24df9b[0x0]);if(_0x460dd2[_0xd27e('0x17')]>0x5)_0x460dd2=_[_0xd27e('0x1d')](Object[_0xd27e('0x1c')](_0x24df9b[0x0]),0x5);_0x460dd2[_0xd27e('0x1e')](function(_0x2dbbd0){_0x26dee1[_0xd27e('0x1a')](createTable(_0x2dbbd0,_0x24df9b));});return _0x26dee1;}function getPDFDocDefinition(_0x4cb8ea){var _0x318325=util[_0xd27e('0x1f')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xd27e('0x20')])[_0xd27e('0x1f')](FORMAT));var _0xf0dd48=[];for(var _0x427a07=0x0;_0x427a07<_0x4cb8ea[_0xd27e('0x17')];_0x427a07++){var _0x173180=[];if(_0x427a07===0x0){_0x173180[_0xd27e('0x1a')]({'text':_0x318325,'style':'header'});}var _0x44c061={'table':_0x4cb8ea[_0x427a07]};if(_0x427a07>0x0){_0x44c061['pageBreak']=_0xd27e('0x21');_0x44c061['margin']=[0x0,0x46,0x0,0x0];}_0x173180['push'](_0x44c061);_0xf0dd48[_0xd27e('0x1a')](_0x173180);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0xf0dd48,'footer':function(_0x9a35c8,_0x57c27d){return{'text':_0x9a35c8[_0xd27e('0x14')]()+_0xd27e('0x22')+_0x57c27d,'style':_0xd27e('0x23')};},'defaultStyle':{'font':_0xd27e('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd27e('0x25')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x411b9e){var _0x32b21a=0x1388;var _0x4bb27e;if(!_0x411b9e[0x0][_0xd27e('0x26')]){return analyticExtractedReport(_0xd27e('0x27'));}var _0x5b4db9=[];var _0x406eb9=0x0;var _0x17547a=!![];var _0x43c6a1=path[_0xd27e('0x28')](PATH);var _0x44464e=path[_0xd27e('0x29')](PATH,_0xd27e('0x2a'));var _0x489b13=path['join'](_0x43c6a1,util[_0xd27e('0x1f')](_0xd27e('0x2b'),_0x44464e,_0xd27e('0x2c')));var _0x32d157=![];return db[_0xd27e('0x2d')][_0xd27e('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd27e('0x2f'),_0xd27e('0x30')]})['then'](function(_0xb72381){if(_0xb72381){_0x4bb27e=_0xb72381;_0x32b21a=_0x4bb27e[_0xd27e('0x30')]||0x3e8;}})[_0xd27e('0x31')](function(){if(_0x411b9e&&_0x411b9e[_0xd27e('0x17')]){var _0x131608=_0x411b9e[0x0][_0xd27e('0x26')]%(_0x406eb9+_0x32b21a);if(_0x4bb27e[_0xd27e('0x2f')]){for(;_0x17547a;_0x406eb9+=_0x32b21a,_0x131608=_0x411b9e[0x0]['num']%(_0x406eb9+_0x32b21a)){if(_0x131608==0x0||_0x131608==_0x411b9e[0x0][_0xd27e('0x26')]){_0x17547a=![];}_0x5b4db9[_0xd27e('0x1a')](dbH[_0xd27e('0x32')][_0xd27e('0x33')](util['format'](_0xd27e('0x34'),QUERY,_0x32b21a,_0x406eb9),{'type':dbH['sequelize'][_0xd27e('0x35')][_0xd27e('0x36')]}));}}else{_0x5b4db9[_0xd27e('0x1a')](dbH[_0xd27e('0x32')][_0xd27e('0x33')](QUERY,{'type':dbH[_0xd27e('0x32')][_0xd27e('0x35')][_0xd27e('0x36')]}));}}_0x32d157=_0x4bb27e['split']&&_0x5b4db9[_0xd27e('0x17')]>0x1;if(!fs[_0xd27e('0x37')](path[_0xd27e('0x38')](_0x43c6a1,_0x44464e))&&_0x32d157){fs['mkdirSync'](path[_0xd27e('0x38')](_0x43c6a1,_0x44464e));}return Promise[_0xd27e('0x39')](_0x5b4db9);})['then'](function(_0x4f4b43){return createTables(_[_0xd27e('0x3a')](_0x4f4b43));})['then'](function(_0x3b673b){var _0x1d5171=getPDFDocDefinition(_0x3b673b);var _0x408a61=getPDFPrinter();var _0x5f4ee5=_0x408a61[_0xd27e('0x3b')](_0x1d5171);if(_0x32d157)_0x489b13=path[_0xd27e('0x38')](_0x43c6a1,_0x44464e,util[_0xd27e('0x1f')](_0xd27e('0x3c'),_0x44464e,index,_0xd27e('0x2c')));return writePDFDocument(_0x5f4ee5,_0x489b13);})[_0xd27e('0x31')](function(){if(!_0x32d157)return;zipdir(path['join'](_0x43c6a1,_0x44464e),{'saveTo':path[_0xd27e('0x38')](_0x43c6a1,util[_0xd27e('0x1f')]('%s.%s',_0x44464e,_0xd27e('0x3d')))},function(_0x5561d9){if(_0x5561d9)throw _0x5561d9;return;});})[_0xd27e('0x31')](function(){if(!_0x32d157)return;rimraf(path[_0xd27e('0x38')](_0x43c6a1,_0x44464e),function(){});})['then'](function(){logger['info'](util['format'](_0xd27e('0x3e'),EXTRACTED_REPORT_ID,_0xd27e('0x3f')));return analyticExtractedReport(_0xd27e('0x40'),_0x32d157?util['format'](_0xd27e('0x2b'),_0x44464e,_0x32d157?_0xd27e('0x3d'):_0xd27e('0x2c')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd27e('0x41')](util[_0xd27e('0x1f')](_0xd27e('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xd27e('0x10')][_0xd27e('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x5ed3ae){EXTRACTED_REPORT=_0x5ed3ae;return dbH[_0xd27e('0x32')]['query'](util['format'](_0xd27e('0x44'),QUERY),{'type':dbH['sequelize'][_0xd27e('0x35')]['SELECT']});})[_0xd27e('0x31')](extractReport)[_0xd27e('0x45')](function(_0x63addd){logger['info'](util[_0xd27e('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd27e('0x46')),util[_0xd27e('0x47')](_0x63addd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd27e('0x48'));})['finally'](function(){process[_0xd27e('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x34a66c=new PdfPrinter({'Arial':{'normal':__dirname+_0xd27e('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xd27e('0x4b'),'bolditalics':__dirname+_0xd27e('0x4c')}});return _0x34a66c;}function getPDFDocDefinitionFromHTML(_0x5a5f33,_0x1cd624){var _0x270bc1=util['format'](_0xd27e('0x4d'),_0x1cd624['channel'],_0x1cd624[_0xd27e('0x4e')]);var _0x54afa7=moment()[_0xd27e('0x1f')]('YYYY-MM-DD')[_0xd27e('0x14')]();var _0x5326f7=htmlToPdfmake(_0x5a5f33,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5326f7],'defaultStyle':{'font':_0xd27e('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd27e('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd27e('0x4f')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xd27e('0x50')}];},'footer':function(_0x35a314,_0x3bdb63){return[{'text':util[_0xd27e('0x1f')](_0xd27e('0x51'),_0x270bc1,_0x35a314,_0x3bdb63,_0x54afa7),'style':'footer'}];}};}function writePDFDocument(_0x37ccc0,_0x5d9311){return new Promise(function(_0x4953d7,_0x35f84d){var _0x3fbece=_0x37ccc0[_0xd27e('0x52')](fs[_0xd27e('0x53')](_0x5d9311));_0x3fbece['on'](_0xd27e('0x54'),function(){_0x4953d7('finish');});_0x3fbece['on'](_0xd27e('0x55'),function(_0x26fc8b){_0x35f84d(_0x26fc8b);});_0x37ccc0['end']();});}exports[_0xd27e('0x56')]=function(_0x234cb7,_0x8240df){var _0x281654=getPDFPrinter();var _0x15104b=getPDFDocDefinitionFromHTML(_0x234cb7,_0x8240df);var _0x389c38=_0x281654['createPdfKitDocument'](_0x15104b);return writePDFDocument(_0x389c38,_0x8240df[_0xd27e('0x2')])['catch'](function(_0x151b99){throw _0x151b99;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index a2799da..3fc01ea 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 _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f719a91..9d457e6 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 _0x087f=['error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','outbound','extension','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','map','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','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','bulkCreate','catch'];(function(_0x3a9f78,_0x45a77b){var _0x415fb2=function(_0x7faa13){while(--_0x7faa13){_0x3a9f78['push'](_0x3a9f78['shift']());}};_0x415fb2(++_0x45a77b);}(_0x087f,0x1a6));var _0xf087=function(_0x427473,_0x19939a){_0x427473=_0x427473-0x0;var _0x3a9bf1=_0x087f[_0x427473];return _0x3a9bf1;};'use strict';var _=require('lodash');var util=require(_0xf087('0x0'));function rewrite(_0x5adddc,_0x87edbc){var _0xfec2f9=this;return _0x5adddc[_0xf087('0x1')][_0xf087('0x2')][_0xf087('0x3')]({'raw':!![]})[_0xf087('0x4')](function(_0x58b8ae){_0xfec2f9[_0xf087('0x5')]=_0x58b8ae;return _0x5adddc[_0xf087('0x1')][_0xf087('0x6')][_0xf087('0x3')]({'where':{'IntervalId':_0x87edbc[_0xf087('0x7')]},'raw':!![]});})['then'](function(_0x54fb34){return _0x5adddc['models'][_0xf087('0x6')][_0xf087('0x3')]({'where':{'exten':{'$in':_[_0xf087('0x8')](_['map'](_0x54fb34,_0xf087('0x9')))}},'order':[{'raw':_0xf087('0xa')}],'raw':!![]});})[_0xf087('0x4')](function(_0x375423){var _0x2931a8=_[_0xf087('0xb')](_0x375423,{'priority':'1'});var _0x528345=_[_0xf087('0xb')](_0x375423,{'isApp':0x1});var _0x370535=_[_0xf087('0xc')](_0x528345,'exten');var _0x32a1ed=['queue',_0xf087('0xd')];var _0x35b9c9=[];var _0x2a7592=[];for(var _0x4e3a27 in _0x370535){if(_0x370535[_0xf087('0xe')](_0x4e3a27)){_0xfec2f9[_0xf087('0xf')]=0x2;_0xfec2f9[_0xf087('0x10')]=[];_0xfec2f9['extension']=_[_0xf087('0x11')](_0x2931a8,{'exten':_0x370535[_0x4e3a27][0x0][_0xf087('0x9')]});_0xfec2f9[_0xf087('0x10')][_0xf087('0x12')]({'type':_0x370535[_0x4e3a27][0x0][_0xf087('0x13')],'app':_0xf087('0x14'),'appdata':util['format'](_0xf087('0x15'),_0x370535[_0x4e3a27][0x0][_0xf087('0x13')]),'context':_0x370535[_0x4e3a27][0x0][_0xf087('0x16')],'exten':_0x370535[_0x4e3a27][0x0][_0xf087('0x9')],'priority':_0xfec2f9[_0xf087('0xf')]++,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0][_0xf087('0x17')]});if(_0x370535[_0x4e3a27][0x0][_0xf087('0x13')]===_0xf087('0x18')){if(_0xfec2f9[_0xf087('0x19')]){_0xfec2f9[_0xf087('0x10')][_0xf087('0x12')]({'type':_0x370535[_0x4e3a27][0x0][_0xf087('0x13')],'app':_0xf087('0x14'),'appdata':_0xf087('0x1a')+(_0xfec2f9[_0xf087('0x19')]['cutdigits']?_0xf087('0x1b')+_0xfec2f9[_0xf087('0x19')][_0xf087('0x1c')]+'}':_0xf087('0x1d')),'context':_0x370535[_0x4e3a27][0x0]['context'],'exten':_0x370535[_0x4e3a27][0x0][_0xf087('0x9')],'priority':_0xfec2f9['priority']++,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0][_0xf087('0x17')]});}_0xfec2f9[_0xf087('0x10')][_0xf087('0x12')]({'type':_0x370535[_0x4e3a27][0x0][_0xf087('0x13')],'app':_0xf087('0x14'),'appdata':_0xf087('0x1e')+_0x370535[_0x4e3a27][0x0]['VoiceExtensionId'],'context':_0x370535[_0x4e3a27][0x0]['context'],'exten':_0x370535[_0x4e3a27][0x0][_0xf087('0x9')],'priority':_0xfec2f9[_0xf087('0xf')]++,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0]['VoiceExtensionId']});var _0x3143b5=_0xfec2f9['priority']++;_0xfec2f9[_0xf087('0x10')][_0xf087('0x12')]({'type':_0x370535[_0x4e3a27][0x0][_0xf087('0x13')],'app':_0xf087('0x1f'),'appdata':_0xf087('0x20')+(_0x3143b5+0x2)+_0xf087('0x21')+(_0x3143b5+0x1)+')','context':_0x370535[_0x4e3a27][0x0]['context'],'exten':_0x370535[_0x4e3a27][0x0]['exten'],'priority':_0x3143b5,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0][_0xf087('0x17')]});if(_0xfec2f9['extension']){_0xfec2f9['extensions'][_0xf087('0x12')]({'type':_0x370535[_0x4e3a27][0x0]['type'],'app':_0xf087('0x14'),'appdata':_0xfec2f9[_0xf087('0x19')]['cutdigits']?_0xf087('0x22')+_0xfec2f9[_0xf087('0x19')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x370535[_0x4e3a27][0x0][_0xf087('0x16')],'exten':_0x370535[_0x4e3a27][0x0][_0xf087('0x9')],'priority':_0xfec2f9[_0xf087('0xf')]++,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0][_0xf087('0x17')]});}_0xfec2f9[_0xf087('0x10')][_0xf087('0x12')]({'type':_0x370535[_0x4e3a27][0x0][_0xf087('0x13')],'app':_0xf087('0x14'),'appdata':'outboundrouteid='+_0x370535[_0x4e3a27][0x0][_0xf087('0x17')],'context':_0x370535[_0x4e3a27][0x0][_0xf087('0x16')],'exten':_0x370535[_0x4e3a27][0x0][_0xf087('0x9')],'priority':_0xfec2f9[_0xf087('0xf')]++,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0][_0xf087('0x17')]});if(_0xfec2f9[_0xf087('0x19')]&&_0xfec2f9[_0xf087('0x19')][_0xf087('0xe')](_0xf087('0x23'))&&_0xfec2f9[_0xf087('0x19')][_0xf087('0x23')]!=='none'){_0xfec2f9['extensions'][_0xf087('0x12')]({'type':_0x370535[_0x4e3a27][0x0][_0xf087('0x13')],'app':_0xf087('0x14'),'appdata':_0xf087('0x24'),'context':_0x370535[_0x4e3a27][0x0][_0xf087('0x16')],'exten':_0x370535[_0x4e3a27][0x0][_0xf087('0x9')],'priority':_0xfec2f9[_0xf087('0xf')]++,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0][_0xf087('0x17')]});_0xfec2f9[_0xf087('0x10')]['push']({'type':_0x370535[_0x4e3a27][0x0][_0xf087('0x13')],'app':'Set','appdata':_0xf087('0x25')+_0xfec2f9['extension'][_0xf087('0x23')]||'wav','context':_0x370535[_0x4e3a27][0x0][_0xf087('0x16')],'exten':_0x370535[_0x4e3a27][0x0][_0xf087('0x9')],'priority':_0xfec2f9[_0xf087('0xf')]++,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0]['VoiceExtensionId']});}}_0xfec2f9['extensions'][_0xf087('0x12')]({'type':_0x370535[_0x4e3a27][0x0][_0xf087('0x13')],'app':_0xf087('0x14'),'appdata':_0xf087('0x26'),'context':_0x370535[_0x4e3a27][0x0][_0xf087('0x16')],'exten':_0x370535[_0x4e3a27][0x0]['exten'],'priority':_0xfec2f9['priority']++,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0][_0xf087('0x17')]});_0xfec2f9[_0xf087('0x10')]['push']({'type':_0x370535[_0x4e3a27][0x0][_0xf087('0x13')],'app':_0xf087('0x14'),'appdata':_0xf087('0x27'),'context':_0x370535[_0x4e3a27][0x0][_0xf087('0x16')],'exten':_0x370535[_0x4e3a27][0x0][_0xf087('0x9')],'priority':_0xfec2f9[_0xf087('0xf')]++,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0]['VoiceExtensionId']});_0xfec2f9[_0xf087('0x10')][_0xf087('0x12')]({'type':_0x370535[_0x4e3a27][0x0]['type'],'app':_0xf087('0x14'),'appdata':_0xf087('0x28'),'context':_0x370535[_0x4e3a27][0x0][_0xf087('0x16')],'exten':_0x370535[_0x4e3a27][0x0][_0xf087('0x9')],'priority':_0xfec2f9[_0xf087('0xf')]++,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0][_0xf087('0x17')]});for(var _0x3c0f0c=0x0,_0x21ab45=0x0;_0x3c0f0c<_0x370535[_0x4e3a27][_0xf087('0x29')];_0x3c0f0c+=0x1,_0x21ab45=0x0){var _0x1488ca=_0x370535[_0x4e3a27][_0x3c0f0c];if(_0x1488ca['type']){_0x1488ca['type']=_0x1488ca['type'][_0xf087('0x2a')]();}var _0x2dcdb1=[];var _0x41bea5=[];delete _0x1488ca['id'];delete _0x1488ca[_0xf087('0x2b')];delete _0x1488ca[_0xf087('0x2c')];var _0x3ebd8f=_0x1488ca['interval']!==_0xf087('0x2d')?[_0x1488ca['interval']]:_0x1488ca[_0xf087('0x7')]?_[_0xf087('0x2e')](_[_0xf087('0xb')](_0xfec2f9['intervals'],{'IntervalId':_0x1488ca[_0xf087('0x7')]}),_0xf087('0x2f')):[];if(_0x1488ca[_0xf087('0xe')](_0xf087('0x30'))){if(_0x1488ca['tag']&&_0x1488ca[_0xf087('0x30')]!=='--'){_0x2dcdb1[_0xf087('0x12')]({'type':_0x1488ca[_0xf087('0x13')],'app':_0xf087('0x14'),'appdata':_0xf087('0x31')+_0x1488ca['tag'],'context':_0x1488ca[_0xf087('0x16')],'exten':_0x1488ca[_0xf087('0x9')],'priority':_0x3ebd8f[_0xf087('0x29')]+_0xfec2f9[_0xf087('0xf')]+_0x21ab45++,'VoiceExtensionId':_0x1488ca[_0xf087('0x17')]});}}if(_0x1488ca[_0xf087('0x13')]===_0xf087('0x18')&&_0x1488ca[_0xf087('0xe')](_0xf087('0x32'))){if(_0x1488ca[_0xf087('0x32')]){_0x2dcdb1[_0xf087('0x12')]({'type':_0x1488ca[_0xf087('0x13')],'app':_0xf087('0x1f'),'appdata':_0xf087('0x33')+_0x1488ca['callerID']+')','context':_0x1488ca['context'],'exten':_0x1488ca[_0xf087('0x9')],'priority':_0x3ebd8f['length']+_0xfec2f9['priority']+_0x21ab45++,'VoiceExtensionId':_0x1488ca['VoiceExtensionId']});}else{_0x2dcdb1['push']({'type':_0x1488ca[_0xf087('0x13')],'app':'ExecIf','appdata':_0xf087('0x34'),'context':_0x1488ca[_0xf087('0x16')],'exten':_0x1488ca[_0xf087('0x9')],'priority':_0x3ebd8f[_0xf087('0x29')]+_0xfec2f9[_0xf087('0xf')]+_0x21ab45++,'VoiceExtensionId':_0x1488ca[_0xf087('0x17')]});}}if(_0x1488ca[_0xf087('0xe')](_0xf087('0x35'))){if(_0x32a1ed['indexOf'](_0x1488ca[_0xf087('0x36')][_0xf087('0x2a')]())>=0x0&&_0x1488ca[_0xf087('0x37')]!==_0xf087('0x38')){if(_0x1488ca[_0xf087('0x35')]){_0x2dcdb1[_0xf087('0x12')]({'type':_0x1488ca[_0xf087('0x13')],'app':'ExecIf','appdata':_0xf087('0x39'),'context':_0x1488ca[_0xf087('0x16')],'exten':_0x1488ca[_0xf087('0x9')],'priority':_0x3ebd8f[_0xf087('0x29')]+_0xfec2f9[_0xf087('0xf')]+_0x21ab45++,'VoiceExtensionId':_0x1488ca['VoiceExtensionId']});_0x2dcdb1[_0xf087('0x12')]({'type':_0x1488ca[_0xf087('0x13')],'app':'Set','appdata':_0xf087('0x3a'),'context':_0x1488ca[_0xf087('0x16')],'exten':_0x1488ca[_0xf087('0x9')],'priority':_0x3ebd8f[_0xf087('0x29')]+_0xfec2f9['priority']+_0x21ab45++,'VoiceExtensionId':_0x1488ca[_0xf087('0x17')]});}else{_0x2dcdb1[_0xf087('0x12')]({'type':_0x1488ca[_0xf087('0x13')],'app':'ExecIf','appdata':_0xf087('0x3b'),'context':_0x1488ca[_0xf087('0x16')],'exten':_0x1488ca[_0xf087('0x9')],'priority':_0x3ebd8f[_0xf087('0x29')]+_0xfec2f9[_0xf087('0xf')]+_0x21ab45++,'VoiceExtensionId':_0x1488ca[_0xf087('0x17')]});_0x2dcdb1[_0xf087('0x12')]({'type':_0x1488ca[_0xf087('0x13')],'app':_0xf087('0x14'),'appdata':_0xf087('0x3c'),'context':_0x1488ca['context'],'exten':_0x1488ca[_0xf087('0x9')],'priority':_0x3ebd8f[_0xf087('0x29')]+_0xfec2f9['priority']+_0x21ab45++,'VoiceExtensionId':_0x1488ca['VoiceExtensionId']});}}}for(var _0x38813a=0x0;_0x38813a<_0x3ebd8f['length'];_0x38813a+=0x1){var _0x1d71b5=_0xfec2f9[_0xf087('0xf')]+_0x3ebd8f['length'];var _0x5cf917=_0x38813a===_0x3ebd8f[_0xf087('0x29')]-0x1?_0xfec2f9[_0xf087('0xf')]+_0x2dcdb1[_0xf087('0x29')]+_0x41bea5[_0xf087('0x29')]+0x2:_0xfec2f9[_0xf087('0xf')]+_0x38813a+0x1;_0x2dcdb1['splice'](_0x38813a,0x0,{'type':_0x1488ca[_0xf087('0x13')],'app':_0xf087('0x3d'),'appdata':_0x3ebd8f[_0x38813a]+'?'+_0x1488ca[_0xf087('0x16')]+_0xf087('0x3e')+_0x1d71b5+':'+_0x1488ca['context']+',${EXTEN},'+_0x5cf917,'exten':_0x1488ca[_0xf087('0x9')],'context':_0x1488ca['context'],'priority':_0xfec2f9['priority']+_0x38813a,'VoiceExtensionId':_0x370535[_0x4e3a27][0x0][_0xf087('0x17')]});}_0x1488ca[_0xf087('0xf')]=_0x2dcdb1[_0xf087('0x29')]?_[_0xf087('0x3f')](_0x2dcdb1)[_0xf087('0xf')]+0x1:_0xfec2f9[_0xf087('0xf')];_0xfec2f9['priority']=(_0x41bea5[_0xf087('0x29')]?_[_0xf087('0x3f')](_0x41bea5)[_0xf087('0xf')]:_0x1488ca[_0xf087('0xf')])+0x1;_0xfec2f9['extensions']=_[_0xf087('0x40')](_0xfec2f9['extensions'],_0x2dcdb1,[_0x1488ca],_0x41bea5);}_0xfec2f9[_0xf087('0x10')][_0xf087('0x12')]({'type':_0x370535[_0x4e3a27][0x0]['type'],'app':_0xf087('0x41'),'exten':_0x370535[_0x4e3a27][0x0]['exten'],'context':_0x370535[_0x4e3a27][0x0][_0xf087('0x16')],'priority':_0xfec2f9['priority'],'VoiceExtensionId':_0x370535[_0x4e3a27][0x0]['VoiceExtensionId']});_0x35b9c9[_0xf087('0x12')](_0x370535[_0x4e3a27][0x0][_0xf087('0x17')]);_0x2a7592=_[_0xf087('0x40')](_0x2a7592,_0xfec2f9[_0xf087('0x10')]);}}return _0x5adddc['transaction'](function(_0x3260f4){return _0x5adddc['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x35b9c9}},'transaction':_0x3260f4})['then'](function(_0x3db881){return _0x5adddc[_0xf087('0x1')][_0xf087('0x6')][_0xf087('0x42')](_['sortBy'](_0x2a7592,_0xf087('0xf')),{'transaction':_0x3260f4});});});})[_0xf087('0x43')](function(_0x323896){console[_0xf087('0x44')](_0x323896);});}exports[_0xf087('0x45')]=rewrite; \ No newline at end of file +var _0x4584=['outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','extensions','extension','find','push','type','Set','CDR(type)=%s','context','priority','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix'];(function(_0x3c8c6f,_0x248fd4){var _0x40dd17=function(_0x13f5ad){while(--_0x13f5ad){_0x3c8c6f['push'](_0x3c8c6f['shift']());}};_0x40dd17(++_0x248fd4);}(_0x4584,0x1cf));var _0x4458=function(_0x26d492,_0x4e9f12){_0x26d492=_0x26d492-0x0;var _0x189f2c=_0x4584[_0x26d492];return _0x189f2c;};'use strict';var _=require(_0x4458('0x0'));var util=require('util');function rewrite(_0x2d7385,_0x284655){var _0x23b438=this;return _0x2d7385['models']['Interval'][_0x4458('0x1')]({'raw':!![]})[_0x4458('0x2')](function(_0x37118c){_0x23b438[_0x4458('0x3')]=_0x37118c;return _0x2d7385[_0x4458('0x4')][_0x4458('0x5')][_0x4458('0x1')]({'where':{'IntervalId':_0x284655[_0x4458('0x6')]},'raw':!![]});})[_0x4458('0x2')](function(_0x51da14){return _0x2d7385[_0x4458('0x4')][_0x4458('0x5')][_0x4458('0x1')]({'where':{'exten':{'$in':_[_0x4458('0x7')](_[_0x4458('0x8')](_0x51da14,_0x4458('0x9')))}},'order':[{'raw':_0x4458('0xa')}],'raw':!![]});})[_0x4458('0x2')](function(_0x43eb54){var _0x4e3c1c=_[_0x4458('0xb')](_0x43eb54,{'priority':'1'});var _0x347edc=_[_0x4458('0xb')](_0x43eb54,{'isApp':0x1});var _0x167214=_[_0x4458('0xc')](_0x347edc,'exten');var _0x302552=['queue',_0x4458('0xd')];var _0x511f6c=[];var _0x1089ff=[];for(var _0x162c33 in _0x167214){if(_0x167214['hasOwnProperty'](_0x162c33)){_0x23b438['priority']=0x2;_0x23b438[_0x4458('0xe')]=[];_0x23b438[_0x4458('0xf')]=_[_0x4458('0x10')](_0x4e3c1c,{'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')]});_0x23b438[_0x4458('0xe')][_0x4458('0x11')]({'type':_0x167214[_0x162c33][0x0][_0x4458('0x12')],'app':_0x4458('0x13'),'appdata':util['format'](_0x4458('0x14'),_0x167214[_0x162c33][0x0]['type']),'context':_0x167214[_0x162c33][0x0][_0x4458('0x15')],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x23b438[_0x4458('0x16')]++,'VoiceExtensionId':_0x167214[_0x162c33][0x0]['VoiceExtensionId']});if(_0x167214[_0x162c33][0x0][_0x4458('0x12')]===_0x4458('0x17')){if(_0x23b438[_0x4458('0xf')]){_0x23b438[_0x4458('0xe')][_0x4458('0x11')]({'type':_0x167214[_0x162c33][0x0][_0x4458('0x12')],'app':_0x4458('0x13'),'appdata':_0x4458('0x18')+(_0x23b438[_0x4458('0xf')][_0x4458('0x19')]?'${EXTEN:'+_0x23b438[_0x4458('0xf')][_0x4458('0x19')]+'}':_0x4458('0x1a')),'context':_0x167214[_0x162c33][0x0]['context'],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x23b438[_0x4458('0x16')]++,'VoiceExtensionId':_0x167214[_0x162c33][0x0]['VoiceExtensionId']});}_0x23b438[_0x4458('0xe')][_0x4458('0x11')]({'type':_0x167214[_0x162c33][0x0]['type'],'app':_0x4458('0x13'),'appdata':_0x4458('0x1b')+_0x167214[_0x162c33][0x0][_0x4458('0x1c')],'context':_0x167214[_0x162c33][0x0]['context'],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x23b438['priority']++,'VoiceExtensionId':_0x167214[_0x162c33][0x0][_0x4458('0x1c')]});var _0x504a86=_0x23b438['priority']++;_0x23b438[_0x4458('0xe')][_0x4458('0x11')]({'type':_0x167214[_0x162c33][0x0][_0x4458('0x12')],'app':_0x4458('0x1d'),'appdata':_0x4458('0x1e')+(_0x504a86+0x2)+_0x4458('0x1f')+(_0x504a86+0x1)+')','context':_0x167214[_0x162c33][0x0][_0x4458('0x15')],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x504a86,'VoiceExtensionId':_0x167214[_0x162c33][0x0][_0x4458('0x1c')]});if(_0x23b438[_0x4458('0xf')]){_0x23b438[_0x4458('0xe')]['push']({'type':_0x167214[_0x162c33][0x0][_0x4458('0x12')],'app':'Set','appdata':_0x23b438[_0x4458('0xf')]['cutdigits']?_0x4458('0x20')+_0x23b438[_0x4458('0xf')][_0x4458('0x19')]+'}':_0x4458('0x21'),'context':_0x167214[_0x162c33][0x0][_0x4458('0x15')],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x23b438[_0x4458('0x16')]++,'VoiceExtensionId':_0x167214[_0x162c33][0x0][_0x4458('0x1c')]});}_0x23b438[_0x4458('0xe')][_0x4458('0x11')]({'type':_0x167214[_0x162c33][0x0][_0x4458('0x12')],'app':_0x4458('0x13'),'appdata':_0x4458('0x22')+_0x167214[_0x162c33][0x0][_0x4458('0x1c')],'context':_0x167214[_0x162c33][0x0]['context'],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x23b438[_0x4458('0x16')]++,'VoiceExtensionId':_0x167214[_0x162c33][0x0][_0x4458('0x1c')]});if(_0x23b438[_0x4458('0xf')]&&_0x23b438[_0x4458('0xf')][_0x4458('0x23')](_0x4458('0x24'))&&_0x23b438[_0x4458('0xf')]['recordingFormat']!=='none'){_0x23b438['extensions'][_0x4458('0x11')]({'type':_0x167214[_0x162c33][0x0][_0x4458('0x12')],'app':_0x4458('0x13'),'appdata':_0x4458('0x25'),'context':_0x167214[_0x162c33][0x0][_0x4458('0x15')],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x23b438[_0x4458('0x16')]++,'VoiceExtensionId':_0x167214[_0x162c33][0x0][_0x4458('0x1c')]});_0x23b438[_0x4458('0xe')][_0x4458('0x11')]({'type':_0x167214[_0x162c33][0x0][_0x4458('0x12')],'app':_0x4458('0x13'),'appdata':_0x4458('0x26')+_0x23b438['extension'][_0x4458('0x24')]||'wav','context':_0x167214[_0x162c33][0x0][_0x4458('0x15')],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x23b438[_0x4458('0x16')]++,'VoiceExtensionId':_0x167214[_0x162c33][0x0][_0x4458('0x1c')]});}}_0x23b438['extensions']['push']({'type':_0x167214[_0x162c33][0x0][_0x4458('0x12')],'app':_0x4458('0x13'),'appdata':_0x4458('0x27'),'context':_0x167214[_0x162c33][0x0]['context'],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x23b438[_0x4458('0x16')]++,'VoiceExtensionId':_0x167214[_0x162c33][0x0][_0x4458('0x1c')]});_0x23b438[_0x4458('0xe')][_0x4458('0x11')]({'type':_0x167214[_0x162c33][0x0][_0x4458('0x12')],'app':_0x4458('0x13'),'appdata':_0x4458('0x28'),'context':_0x167214[_0x162c33][0x0][_0x4458('0x15')],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x23b438['priority']++,'VoiceExtensionId':_0x167214[_0x162c33][0x0]['VoiceExtensionId']});_0x23b438[_0x4458('0xe')][_0x4458('0x11')]({'type':_0x167214[_0x162c33][0x0][_0x4458('0x12')],'app':_0x4458('0x13'),'appdata':_0x4458('0x29'),'context':_0x167214[_0x162c33][0x0][_0x4458('0x15')],'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'priority':_0x23b438[_0x4458('0x16')]++,'VoiceExtensionId':_0x167214[_0x162c33][0x0][_0x4458('0x1c')]});for(var _0x524b6c=0x0,_0x34bd8c=0x0;_0x524b6c<_0x167214[_0x162c33][_0x4458('0x2a')];_0x524b6c+=0x1,_0x34bd8c=0x0){var _0x362ba3=_0x167214[_0x162c33][_0x524b6c];if(_0x362ba3[_0x4458('0x12')]){_0x362ba3[_0x4458('0x12')]=_0x362ba3[_0x4458('0x12')][_0x4458('0x2b')]();}var _0x3bc949=[];var _0x41bc7a=[];delete _0x362ba3['id'];delete _0x362ba3[_0x4458('0x2c')];delete _0x362ba3['updatedAt'];var _0x35b56f=_0x362ba3[_0x4458('0x2d')]!==_0x4458('0x2e')?[_0x362ba3[_0x4458('0x2d')]]:_0x362ba3[_0x4458('0x6')]?_['map'](_['filter'](_0x23b438['intervals'],{'IntervalId':_0x362ba3[_0x4458('0x6')]}),_0x4458('0x2d')):[];if(_0x362ba3[_0x4458('0x23')]('tag')){if(_0x362ba3[_0x4458('0x2f')]&&_0x362ba3['tag']!=='--'){_0x3bc949['push']({'type':_0x362ba3['type'],'app':_0x4458('0x13'),'appdata':_0x4458('0x30')+_0x362ba3['tag'],'context':_0x362ba3[_0x4458('0x15')],'exten':_0x362ba3[_0x4458('0x9')],'priority':_0x35b56f['length']+_0x23b438['priority']+_0x34bd8c++,'VoiceExtensionId':_0x362ba3[_0x4458('0x1c')]});}}if(_0x362ba3[_0x4458('0x12')]===_0x4458('0x17')&&_0x362ba3[_0x4458('0x23')](_0x4458('0x31'))){if(_0x362ba3['callerID']){_0x3bc949[_0x4458('0x11')]({'type':_0x362ba3['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x362ba3['callerID']+')','context':_0x362ba3[_0x4458('0x15')],'exten':_0x362ba3[_0x4458('0x9')],'priority':_0x35b56f['length']+_0x23b438[_0x4458('0x16')]+_0x34bd8c++,'VoiceExtensionId':_0x362ba3['VoiceExtensionId']});}else{_0x3bc949[_0x4458('0x11')]({'type':_0x362ba3[_0x4458('0x12')],'app':_0x4458('0x1d'),'appdata':_0x4458('0x32'),'context':_0x362ba3[_0x4458('0x15')],'exten':_0x362ba3[_0x4458('0x9')],'priority':_0x35b56f[_0x4458('0x2a')]+_0x23b438[_0x4458('0x16')]+_0x34bd8c++,'VoiceExtensionId':_0x362ba3[_0x4458('0x1c')]});}}if(_0x362ba3[_0x4458('0x23')](_0x4458('0x33'))){if(_0x302552[_0x4458('0x34')](_0x362ba3[_0x4458('0x35')][_0x4458('0x2b')]())>=0x0&&_0x362ba3[_0x4458('0x36')]!==_0x4458('0x37')){if(_0x362ba3['answer']){_0x3bc949[_0x4458('0x11')]({'type':_0x362ba3['type'],'app':_0x4458('0x1d'),'appdata':_0x4458('0x38'),'context':_0x362ba3[_0x4458('0x15')],'exten':_0x362ba3['exten'],'priority':_0x35b56f[_0x4458('0x2a')]+_0x23b438[_0x4458('0x16')]+_0x34bd8c++,'VoiceExtensionId':_0x362ba3['VoiceExtensionId']});_0x3bc949[_0x4458('0x11')]({'type':_0x362ba3[_0x4458('0x12')],'app':_0x4458('0x13'),'appdata':_0x4458('0x39'),'context':_0x362ba3[_0x4458('0x15')],'exten':_0x362ba3[_0x4458('0x9')],'priority':_0x35b56f['length']+_0x23b438['priority']+_0x34bd8c++,'VoiceExtensionId':_0x362ba3[_0x4458('0x1c')]});}else{_0x3bc949[_0x4458('0x11')]({'type':_0x362ba3[_0x4458('0x12')],'app':_0x4458('0x1d'),'appdata':_0x4458('0x3a'),'context':_0x362ba3[_0x4458('0x15')],'exten':_0x362ba3['exten'],'priority':_0x35b56f[_0x4458('0x2a')]+_0x23b438[_0x4458('0x16')]+_0x34bd8c++,'VoiceExtensionId':_0x362ba3['VoiceExtensionId']});_0x3bc949[_0x4458('0x11')]({'type':_0x362ba3[_0x4458('0x12')],'app':_0x4458('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x362ba3[_0x4458('0x15')],'exten':_0x362ba3[_0x4458('0x9')],'priority':_0x35b56f[_0x4458('0x2a')]+_0x23b438['priority']+_0x34bd8c++,'VoiceExtensionId':_0x362ba3['VoiceExtensionId']});}}}for(var _0x54bb3f=0x0;_0x54bb3f<_0x35b56f[_0x4458('0x2a')];_0x54bb3f+=0x1){var _0xd89fae=_0x23b438[_0x4458('0x16')]+_0x35b56f[_0x4458('0x2a')];var _0x2676d4=_0x54bb3f===_0x35b56f[_0x4458('0x2a')]-0x1?_0x23b438[_0x4458('0x16')]+_0x3bc949[_0x4458('0x2a')]+_0x41bc7a[_0x4458('0x2a')]+0x2:_0x23b438[_0x4458('0x16')]+_0x54bb3f+0x1;_0x3bc949[_0x4458('0x3b')](_0x54bb3f,0x0,{'type':_0x362ba3['type'],'app':_0x4458('0x3c'),'appdata':_0x35b56f[_0x54bb3f]+'?'+_0x362ba3[_0x4458('0x15')]+_0x4458('0x3d')+_0xd89fae+':'+_0x362ba3[_0x4458('0x15')]+_0x4458('0x3d')+_0x2676d4,'exten':_0x362ba3[_0x4458('0x9')],'context':_0x362ba3['context'],'priority':_0x23b438[_0x4458('0x16')]+_0x54bb3f,'VoiceExtensionId':_0x167214[_0x162c33][0x0]['VoiceExtensionId']});}_0x362ba3[_0x4458('0x16')]=_0x3bc949[_0x4458('0x2a')]?_[_0x4458('0x3e')](_0x3bc949)[_0x4458('0x16')]+0x1:_0x23b438[_0x4458('0x16')];_0x23b438[_0x4458('0x16')]=(_0x41bc7a[_0x4458('0x2a')]?_[_0x4458('0x3e')](_0x41bc7a)[_0x4458('0x16')]:_0x362ba3['priority'])+0x1;_0x23b438[_0x4458('0xe')]=_[_0x4458('0x3f')](_0x23b438[_0x4458('0xe')],_0x3bc949,[_0x362ba3],_0x41bc7a);}_0x23b438[_0x4458('0xe')][_0x4458('0x11')]({'type':_0x167214[_0x162c33][0x0]['type'],'app':_0x4458('0x40'),'exten':_0x167214[_0x162c33][0x0][_0x4458('0x9')],'context':_0x167214[_0x162c33][0x0]['context'],'priority':_0x23b438[_0x4458('0x16')],'VoiceExtensionId':_0x167214[_0x162c33][0x0][_0x4458('0x1c')]});_0x511f6c[_0x4458('0x11')](_0x167214[_0x162c33][0x0][_0x4458('0x1c')]);_0x1089ff=_[_0x4458('0x3f')](_0x1089ff,_0x23b438[_0x4458('0xe')]);}}return _0x2d7385[_0x4458('0x41')](function(_0xe503a0){return _0x2d7385[_0x4458('0x4')][_0x4458('0x5')][_0x4458('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x511f6c}},'transaction':_0xe503a0})[_0x4458('0x2')](function(_0x427094){return _0x2d7385[_0x4458('0x4')]['VoiceExtension'][_0x4458('0x43')](_['sortBy'](_0x1089ff,_0x4458('0x16')),{'transaction':_0xe503a0});});});})[_0x4458('0x44')](function(_0x278299){console[_0x4458('0x45')](_0x278299);});}exports[_0x4458('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index a42e29f..ca5ad5d 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 _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','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!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x532c5f,_0x4fb867){var _0x454c86=function(_0x48c644){while(--_0x48c644){_0x532c5f['push'](_0x532c5f['shift']());}};_0x454c86(++_0x4fb867);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);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(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){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))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xbaf0=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','cm_contacts','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate'];(function(_0x3d8c07,_0x2e2623){var _0x94d903=function(_0x2de0a7){while(--_0x2de0a7){_0x3d8c07['push'](_0x3d8c07['shift']());}};_0x94d903(++_0x2e2623);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var fs=require('fs');var squel=require(_0x0baf('0x2'));var Papa=require(_0x0baf('0x3'));var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));config[_0x0baf('0x8')]=_[_0x0baf('0x9')](config[_0x0baf('0x8')],{'host':_0x0baf('0xa'),'port':0x18eb});var socket=require(_0x0baf('0xb'))(new Redis(config[_0x0baf('0x8')]));require(_0x0baf('0xc'))['register'](socket);try{if(!process[_0x0baf('0xd')][0x2]||process['argv'][0x2]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x2]===_0x0baf('0xf')){throw new Error(_0x0baf('0x10'));}var FILEPATH=process[_0x0baf('0xd')][0x2];if(!process[_0x0baf('0xd')][0x3]||process[_0x0baf('0xd')][0x3]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x3]===_0x0baf('0xf')||!process[_0x0baf('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x0baf('0xd')][0x4]===_0x0baf('0xf')){throw new Error(_0x0baf('0x11'));}var FIELDS=_[_0x0baf('0x12')](process['argv'][0x3][_0x0baf('0x13')](','),process['argv'][0x4][_0x0baf('0x13')](','));if(!process[_0x0baf('0xd')][0x5]||process[_0x0baf('0xd')][0x5]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x5]===_0x0baf('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0baf('0xd')][0x6]&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x7]:null;if(!process[_0x0baf('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0baf('0xd')][0x8]===_0x0baf('0xf')){throw new Error(_0x0baf('0x14'));}var SOCKET_TIMESTAMP=process[_0x0baf('0xd')][0x8];}catch(_0x1fa92b){logger[_0x0baf('0x15')](_0x1fa92b);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(_0x210cd8,_0x636a13,_0x2c42e2,_0x15a2c3){var _0x54f2fa={'message':_0x636a13};_0x54f2fa[_0x210cd8]=!![];if(_0x2c42e2){_0x54f2fa[_0x0baf('0x16')]=_0x2c42e2;}if(_0x15a2c3){_0x54f2fa['index']=_0x15a2c3;}return _0x54f2fa;}function isEmail(_0xf6c158){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0xf6c158);}function checkRow(_0x4de74c,_0x2ef0aa,_0x48a0e9){return new BPromise(function(_0x4be1b9,_0x47c4b){if(_[_0x0baf('0x17')](_0x4de74c)){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x18'),null,_0x48a0e9));}if(_0x4de74c[_0x0baf('0x19')]&&_0x4de74c['errors'][_0x0baf('0x1a')]){var _0x4681c5=_[_0x0baf('0x1b')](_0x4de74c[_0x0baf('0x19')],_0x0baf('0x1c'))[_0x0baf('0x1d')](';');return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x4681c5,null,_0x48a0e9));}var _0x549fd0={};for(var _0x1590b4 in FIELDS){if(FIELDS[_0x0baf('0x1e')](_0x1590b4)&&FIELDS[_0x1590b4]){_0x549fd0[_0x1590b4]=_0x4de74c[_0x0baf('0x1f')][0x0][FIELDS[_0x1590b4]]||_0x4de74c[_0x0baf('0x1f')][0x0]['\ufeff'+FIELDS[_0x1590b4]];}}if(!_0x549fd0['firstName']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x20'),null,_0x48a0e9));}if(!_0x549fd0['phone']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x21'),null,_0x48a0e9));}if(_0x549fd0[_0x0baf('0x22')]){var _0xb4dbb1=moment(_0x549fd0[_0x0baf('0x22')],_0x0baf('0x23'));if(!_0xb4dbb1[_0x0baf('0x24')]()){return _0x47c4b(handleCheckRowError('error',_0x0baf('0x25'),null,_0x48a0e9));}}if(_0x549fd0[_0x0baf('0x26')]){if(!isEmail(_0x549fd0[_0x0baf('0x26')])){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x27'),null,_0x48a0e9));}}_0x549fd0[_0x0baf('0x28')]=LISTID;_0x549fd0[_0x0baf('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0baf('0x1a')]&&_0x2ef0aa){var _0x59431b={};for(var _0x3ded64=0x0,_0x2adfd7=DUPLICATES[_0x0baf('0x1a')];_0x3ded64<_0x2adfd7;_0x3ded64+=0x1){_0x59431b[DUPLICATES[_0x3ded64]]=_0x549fd0[DUPLICATES[_0x3ded64]];}var _0x45294a=_[_0x0baf('0x2a')](_0x2ef0aa,_0x59431b);if(_0x45294a){return _0x47c4b(handleCheckRowError('duplicate',_0x0baf('0x2b'),_0x45294a,_0x48a0e9));}}return db['CmContact'][_0x0baf('0x2c')](_0x549fd0,{'raw':!![],'hooks':![],'fields':_[_0x0baf('0x2d')](_0x549fd0)})[_0x0baf('0x2e')](function(_0x3d65f2){if(DUPLICATES&&DUPLICATES['length']&&_0x2ef0aa){_0x2ef0aa[_0x0baf('0x2f')](_[_0x0baf('0x30')](_0x549fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d65f2['id'];return _0x4be1b9();})['catch'](function(_0x23d890){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x31')+(_0x23d890[_0x0baf('0x1c')]||JSON[_0x0baf('0x32')](_0x23d890)),null,_0x48a0e9));});});}function checkHopper(){function _0x1b0991(){return function(_0xe03d82){logger[_0x0baf('0x15')]('cmContact',_0x0baf('0x33'),util[_0x0baf('0x34')](_0xe03d82,{'showHidden':![],'depth':null}));};}var _0x5b991f=function(_0x32c022,_0x57783c){var _0x5c545f=squel[_0x0baf('0x35')]()[_0x0baf('0x36')]('cm_hopper')['fromQuery']([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x28'),_0x57783c,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))[_0x0baf('0x3d')]('id','ContactId')[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x32c022['id'][_0x0baf('0x3f')](),_0x57783c)[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3a'))[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')]('cm_contacts')[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID['toString']())[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'))[_0x0baf('0x40')](_0x0baf('0x46'))[_0x0baf('0x41')](_0x57783c+'\x20=\x20?',_0x32c022['id'][_0x0baf('0x3f')]())))[_0x0baf('0x3f')]();return _0x5c545f;};var _0x1daf1d=function(_0x339aff,_0x22207a){var _0x55f4f8=squel[_0x0baf('0x35')]()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),'scheduledAt',_0x0baf('0x39'),_0x0baf('0x28'),_0x22207a,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),'phone')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))['field']('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x339aff['id'][_0x0baf('0x3f')](),_0x22207a)[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3a'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')]('calleridnum')[_0x0baf('0x40')](_0x0baf('0x4a'))[_0x0baf('0x41')](_0x22207a+_0x0baf('0x4b'),_0x339aff['id'][_0x0baf('0x3f')]()))[_0x0baf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0baf('0x3c')]()['field'](_0x0baf('0x37'))['from'](_0x0baf('0x46'))['where'](_0x22207a+_0x0baf('0x4b'),_0x339aff['id']['toString']())))[_0x0baf('0x3f')]();return _0x55f4f8;};function _0xcf7b8d(_0x411c1f,_0x4520d1){var _0x42a68b=squel['insert']()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),'ListId',_0x4520d1,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')]('NOW()','scheduledAt')[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x411c1f['id'][_0x0baf('0x3f')](),_0x4520d1)[_0x0baf('0x3d')](_0x0baf('0x3e'),'createdAt')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))['where'](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))[_0x0baf('0x3f')]();return _0x42a68b;}function _0x498405(_0x178495,_0x5dc434){var _0x3c00e7=squel['insert']()['into'](_0x0baf('0x4d'))['fromQuery']([_0x0baf('0x37'),_0x0baf('0x39'),'ListId',_0x5dc434,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()['field']('phone',_0x0baf('0x37'))[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x178495['id']['toString'](),_0x5dc434)['field']('NOW()',_0x0baf('0x3a'))['field']('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')]('ListId\x20=\x20?',LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))['toString']();return _0x3c00e7;}return db[_0x0baf('0x4e')][_0x0baf('0x4f')]({'where':{'type':_0x0baf('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x2c20fe){var _0x125906=[];if(_0x2c20fe){var _0x27a959;for(var _0x4cc046=0x0,_0x5874cc;_0x4cc046<_0x2c20fe['length'];_0x4cc046+=0x1){_0x5874cc=_0x2c20fe[_0x4cc046]['get']({'plain':!![]});switch(_0x5874cc[_0x0baf('0x53')]){case _0x0baf('0x54'):_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x1daf1d(_0x5874cc,_0x0baf('0x57')))['then'](function(){})['catch'](_0x1b0991()));break;case _0x0baf('0x58'):_0x125906['push'](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x5874cc,'VoiceQueueId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;default:_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x5874cc,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}}return _0x125906;})[_0x0baf('0x5a')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x333b07){var _0x20a514=[];if(_0x333b07){var _0x5093f5;for(var _0x1be7f2=0x0,_0x410f6c;_0x1be7f2<_0x333b07['length'];_0x1be7f2+=0x1){_0x410f6c=_0x333b07[_0x1be7f2]['get']({'plain':!![]});_0x20a514[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x498405(_0x410f6c,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x20a514;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id',_0x0baf('0x53')],'include':[{'model':db['CmList'],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x538f24){var _0x97d385=[];if(_0x538f24){for(var _0x4043d5=0x0,_0x421ca0;_0x4043d5<_0x538f24[_0x0baf('0x1a')];_0x4043d5+=0x1){_0x421ca0=_0x538f24[_0x4043d5][_0x0baf('0x5c')]({'plain':!![]});switch(_0x421ca0['dialCheckDuplicateType']){case'always':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x1daf1d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;case'onlyIfOpen':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x421ca0,'CampaignId'))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));break;default:_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));}}}return _0x97d385;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x1cbbcc){var _0x250df2=[];if(_0x1cbbcc){for(var _0xa4fd1b=0x0,_0x1cda78;_0xa4fd1b<_0x1cbbcc[_0x0baf('0x1a')];_0xa4fd1b+=0x1){_0x1cda78=_0x1cbbcc[_0xa4fd1b][_0x0baf('0x5c')]({'plain':!![]});_0x250df2[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x498405(_0x1cda78,'CampaignId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x250df2;})[_0x0baf('0x5a')]();})['catch'](function(_0x507783){logger[_0x0baf('0x15')](_0x0baf('0x5e'),_0x0baf('0x5f'),_0x507783[_0x0baf('0x1c')]);});}var processPromises=function(_0x2dcdfe){return BPromise[_0x0baf('0x5a')](promises)[_0x0baf('0x2e')](function(_0xa2d315){})[_0x0baf('0x59')](function(_0x4e8e85){logger[_0x0baf('0x15')](_0x0baf('0x60'),JSON[_0x0baf('0x32')](_0x4e8e85));})[_0x0baf('0x61')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dcdfe){return _0x2dcdfe['resume']();}});};var endCsv=function(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x0baf('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0baf('0x64')](FILEPATH);}catch(_0x52e0c4){logger[_0x0baf('0x15')](_0x0baf('0x65'),JSON[_0x0baf('0x32')](_0x52e0c4));}finally{process[_0x0baf('0x66')](0x0);}});};process['on'](_0x0baf('0x67'),function(){logger[_0x0baf('0x68')](_0x0baf('0x69'));endCsv();});function main(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0baf('0x13')](',');return db[_0x0baf('0x6a')][_0x0baf('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ed607){var _0xd0f63b=fs[_0x0baf('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0baf('0x6c')](_0xd0f63b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c37b4,_0x195303){total+=0x1;var _0x49d411=total;promises[_0x0baf('0x2f')](checkRow(_0x3c37b4,_0x1ed607,_0x49d411)[_0x0baf('0x2e')](function(){success+=0x1;})[_0x0baf('0x59')](function(_0x457ae8){if(_0x457ae8[_0x0baf('0x15')]){errors+=0x1;delete _0x457ae8['error'];}else if(_0x457ae8[_0x0baf('0x6d')]){duplicates+=0x1;delete _0x457ae8[_0x0baf('0x6d')];}rows[_0x0baf('0x2f')](_0x457ae8);}));if(total%0xc8===0x0){_0x195303[_0x0baf('0x6e')]();return processPromises(_0x195303);}},'complete':function(){return processPromises()[_0x0baf('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xb5f4e5,_0x5a2454){logger[_0x0baf('0x68')]('CSV\x20parse\x20error',JSON[_0x0baf('0x32')](_0xb5f4e5));endCsv();}});})[_0x0baf('0x59')](function(_0x1ce7bb){logger[_0x0baf('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0baf('0x32')](_0x1ce7bb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 0759166..909ccc3 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 _0xb46e=[')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','push','code','sequelize','query','spread','main','stringify','send','start','socket_timestamp','server/files/tmp','.csv','keys','header','parse','data','length','rows','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','\x20not\x20specified','emit','contact:import:','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','each','finish','affectedRows','unlink','catch','complete','root','argv','existsSync','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format','select','field','phone','from','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','priority','recallme','fields','cm_contacts.ListId\x20=\x20','.id\x20=\x20','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','\x20=\x20?','CompanyId','updatedAt','insert','cm_contacts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb46e,0xca));var _0xeb46=function(_0x5f5b7a,_0x563e61){_0x5f5b7a=_0x5f5b7a-0x0;var _0x7d276d=_0xb46e[_0x5f5b7a];return _0x7d276d;};'use strict';var fs=require('fs');var path=require(_0xeb46('0x0'));var _=require(_0xeb46('0x1'));var Papa=require(_0xeb46('0x2'));var util=require(_0xeb46('0x3'));var BPromise=require(_0xeb46('0x4'));var moment=require(_0xeb46('0x5'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0xeb46('0x6'))['db'];var config=require(_0xeb46('0x7'));var logger=require(_0xeb46('0x8'))(_0xeb46('0x9'));config[_0xeb46('0xa')]=_[_0xeb46('0xb')](config[_0xeb46('0xa')],{'host':_0xeb46('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb46('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xeb46('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x2e288c){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x2e288c);}function selectNotIn(_0x2e6444,_0x5ac74d,_0x56d5e2,_0x10d975,_0x17fc33){return squel[_0xeb46('0xe')]()[_0xeb46('0xf')](_0xeb46('0x10'))[_0xeb46('0x11')](_0x10d975)[_0xeb46('0x12')](_0x5ac74d,null,_0x5ac74d+'.id\x20=\x20'+_0x10d975+'.'+_0x56d5e2)['where'](_0x10d975+'.'+_0x56d5e2+_0xeb46('0x13')+_0x2e6444+'.'+_0x56d5e2)[_0xeb46('0x14')](_0x5ac74d+_0xeb46('0x15')+_0x17fc33[_0xeb46('0x12')]()+')');}function insertCmHopper(_0x11701a,_0x170362,_0x54ae79,_0x33beac,_0x3d52e6){var _0x20c34f=['cm_contacts.phone',_0xeb46('0x16'),_0xeb46('0x17'),_0xeb46('0x18'),_0x170362+'.'+_0x33beac,'cm_contacts.createdAt',_0xeb46('0x19'),'cm_contacts.priority',_0xeb46('0x1a'),'\x22'+_0x3d52e6+'\x22'];return squel['insert']()[_0xeb46('0x1b')](_0xeb46('0x1c'))[_0xeb46('0x1d')]([_0xeb46('0x10'),_0xeb46('0x1e'),_0xeb46('0x1f'),_0xeb46('0x20'),_0x33beac,'createdAt','updatedAt',_0xeb46('0x21'),'UserId',_0xeb46('0x22')],squel[_0xeb46('0xe')]()[_0xeb46('0x23')](_0x20c34f)['from'](_0x170362)[_0xeb46('0x12')]('cm_contacts',null,_0xeb46('0x24')+_0x170362+'.CmListId')[_0xeb46('0x12')](_0x54ae79,null,_0x54ae79+_0xeb46('0x25')+_0x170362+'.'+_0x33beac)[_0xeb46('0x14')](_0x170362+'.CmListId\x20=\x20?',_0x11701a)[_0xeb46('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xeb46('0x14')](_0xeb46('0x26'),selectNotIn(_0x170362,_0x54ae79,_0x33beac,_0xeb46('0x1c'),['\x22always\x22',_0xeb46('0x27')]))[_0xeb46('0x14')](_0xeb46('0x26'),selectNotIn(_0x170362,_0x54ae79,_0x33beac,_0xeb46('0x1c'),['\x22always\x22'])))[_0xeb46('0x28')]();}function insertCmHopperBlack(_0x31596d,_0xd8d30e,_0x461aab,_0x24ab76){var _0x450a44=[_0xeb46('0x29'),'cm_contacts.id',_0xeb46('0x18'),_0xd8d30e+'.'+_0x24ab76,'cm_contacts.createdAt',_0xeb46('0x19')];return squel['insert']()[_0xeb46('0x1b')](_0xeb46('0x2a'))[_0xeb46('0x1d')]([_0xeb46('0x10'),_0xeb46('0x1f'),_0xeb46('0x20'),_0x24ab76,'createdAt','updatedAt'],squel[_0xeb46('0xe')]()['fields'](_0x450a44)[_0xeb46('0x11')](_0xd8d30e)['join']('cm_contacts',null,_0xeb46('0x24')+_0xd8d30e+'.CmListId')[_0xeb46('0x12')](_0x461aab,null,_0x461aab+_0xeb46('0x25')+_0xd8d30e+'.'+_0x24ab76)[_0xeb46('0x14')](_0xd8d30e+'.CmListId\x20=\x20?',_0x31596d)[_0xeb46('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xeb46('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xeb46('0xf')](_0xeb46('0x10'))[_0xeb46('0x11')](_0xeb46('0x2a'))['where']('ListId\x20=\x20?',_0x31596d)['where'](_0x24ab76+_0xeb46('0x2b'),_0xd8d30e+'.'+_0x24ab76)))[_0xeb46('0x28')]();}function insertCmContact(_0x5e6a6c,_0x3c92e5,_0x24edd0,_0x43a82f){var _0x211657=_['concat'](_['keys'](_0x43a82f),[_0xeb46('0x20'),_0xeb46('0x2c'),'createdAt',_0xeb46('0x2d')]);return squel[_0xeb46('0x2e')]()[_0xeb46('0x1b')](_0xeb46('0x2f'))[_0xeb46('0x1d')](_0x211657,squel[_0xeb46('0xe')]()[_0xeb46('0x23')](_0x211657)[_0xeb46('0x11')](_0x3c92e5)['where']('('+_0x24edd0['join'](',')+_0xeb46('0x30'),squel[_0xeb46('0xe')]()['fields'](_0x24edd0)[_0xeb46('0x11')]('cm_contacts')[_0xeb46('0x14')](_0xeb46('0x31'),_0x5e6a6c)[_0xeb46('0x14')](_0xeb46('0x32')))[_0xeb46('0x14')](_0xeb46('0x33'),squel['select']()[_0xeb46('0xf')](_0xeb46('0x34'),_0xeb46('0x35'))[_0xeb46('0x11')](_0x3c92e5)[_0xeb46('0x36')](_0x24edd0[_0xeb46('0x12')](','))))[_0xeb46('0x28')]();}function handleStop(){logger[_0xeb46('0x37')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2423c4){logger[_0xeb46('0x38')](_0x2423c4[_0xeb46('0x39')]);process[_0xeb46('0x3a')](0x1);}function handleError(_0x93a7ef,_0x1751a9){stats[_0xeb46('0x3b')][_0xeb46('0x3c')]({'name':_0x1751a9[_0xeb46('0x3d')],'message':_0x1751a9[_0xeb46('0x39')],'row':_0x93a7ef});}function handleQuery(_0x3c0183){logger[_0xeb46('0x37')](_0x3c0183);return db[_0xeb46('0x3e')][_0xeb46('0x3f')](_0x3c0183)[_0xeb46('0x40')](function(_0x4b37f6){results[_0xeb46('0x3c')](_0x4b37f6);})['catch'](function(_0x2f22f7){logger[_0xeb46('0x38')](_0x2f22f7[_0xeb46('0x39')]);});}function main(_0x4deecd,_0x262193,_0x54bc9a,_0x49d26c){logger[_0xeb46('0x37')](_0xeb46('0x41'),_0x4deecd,JSON[_0xeb46('0x42')](_0x262193));process[_0xeb46('0x43')](_0xeb46('0x44'));var _0x18fca2=_0x262193['binding'];var _0x47ae4b=_0x262193[_0xeb46('0x45')];var _0x445eef=path['join'](config['root'],_0xeb46('0x46'),_0x47ae4b+_0xeb46('0x47'));var _0x3e6eef=_[_0xeb46('0x48')](_0x18fca2)[_0xeb46('0x12')]();logger['info'](_0xeb46('0x49'),_0x3e6eef);fs['writeFileSync'](_0x445eef,_0x3e6eef+'\x0a');Papa[_0xeb46('0x4a')](fs['createReadStream'](_0x4deecd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4bb282,_0xa4140){try{for(var _0x1e13f5=0x0,_0x152217=[];_0x1e13f5<_0x4bb282[_0xeb46('0x4b')][_0xeb46('0x4c')];_0x1e13f5++){stats[_0xeb46('0x4d')]+=0x1;if(_0x4bb282[_0xeb46('0x3b')][_0x1e13f5]){handleError(_0x4bb282['data'][_0x1e13f5],_0x4bb282[_0xeb46('0x3b')][_0x1e13f5]);}else{var _0x310b8a=[];for(var _0x403db6 in _0x18fca2){if(_0x18fca2['hasOwnProperty'](_0x403db6)){if(_0x4bb282['data'][_0x1e13f5][_0x18fca2[_0x403db6]]){var _0x249e92=_[_0xeb46('0x4e')](_0x4bb282[_0xeb46('0x4b')][_0x1e13f5][_0x18fca2[_0x403db6]][_0xeb46('0x4f')](/"/g,'\x27'));switch(_0x403db6){case'scheduledat':var _0x24ba76=moment(_0x249e92,_0xeb46('0x50'),!![]);if(_0x24ba76['isValid']()){_0x152217['push']('\x22'+_0x249e92+'\x22');}else{_0x310b8a[_0xeb46('0x3c')](_0xeb46('0x51'));}break;case _0xeb46('0x21'):var _0xaee29d=parseInt(_0x249e92);_0x249e92=_['isNaN'](_0xaee29d)||_0xaee29d<0x0||_0xaee29d>0x4?_0x49d26c?0x3:0x2:_0xaee29d;_0x152217[_0xeb46('0x3c')]('\x22'+_0x249e92+'\x22');break;case'UserId':var _0x1b8798=parseInt(_0x249e92);if(_[_0xeb46('0x52')](_0x1b8798)&&_['includes'](_0x54bc9a,_0x1b8798)){_0x152217[_0xeb46('0x3c')]('\x22'+_0x1b8798+'\x22');}else{_0x310b8a['push'](_0xeb46('0x53'));}break;case _0xeb46('0x54'):if(isEmail(_0x249e92)){_0x152217['push']('\x22'+_0x249e92+'\x22');}else{_0x310b8a[_0xeb46('0x3c')](_0xeb46('0x55'));}break;case'dateOfBirth':var _0x1b2465=moment(_0x249e92,_0xeb46('0x56'),!![]);if(_0x1b2465['isValid']()){_0x152217[_0xeb46('0x3c')]('\x22'+_0x249e92+'\x22');}else{_0x310b8a[_0xeb46('0x3c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x152217[_0xeb46('0x3c')]('\x22'+_0x249e92+'\x22');}}else{switch(_0x403db6){case'firstName':case _0xeb46('0x10'):_0x310b8a[_0xeb46('0x3c')](_0x403db6+_0xeb46('0x57'));break;default:_0x152217[_0xeb46('0x3c')]('\x22\x22');}}}}if(_0x310b8a['length']){handleError(_0x4bb282[_0xeb46('0x4b')][_0x1e13f5],{'code':'SystemRow','message':_0x310b8a[_0xeb46('0x12')]()});}else{fs['appendFileSync'](_0x445eef,_0x152217[_0xeb46('0x12')]()+'\x0a');}_0x152217=[];}if(!(stats[_0xeb46('0x4d')]%0xc8)){socket[_0xeb46('0x58')](_0xeb46('0x59')+_0x47ae4b,stats);stats[_0xeb46('0x3b')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0xa4140[_0xeb46('0x5a')]();}}catch(_0x200ee4){handleError(_0x4bb282[_0xeb46('0x4b')][_0x1e13f5],{'code':_0xeb46('0x5b'),'message':_0x200ee4['message']});logger[_0xeb46('0x38')]('step',_0x200ee4[_0xeb46('0x39')]);}},'complete':function(){try{var _0x3e4850=[];var _0xe3f6b0=_0xeb46('0x2f');if(_0x262193['duplicates']&&_0x262193[_0xeb46('0x5c')][_0xeb46('0x4c')]){_0xe3f6b0=_0xeb46('0x5d')+_0x47ae4b;_0x3e4850['push'](_0xeb46('0x5e')+_0xe3f6b0+_0xeb46('0x5f'));}var _0x7abdb0=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x445eef,_0xe3f6b0,_0x3e6eef,_0x262193[_0xeb46('0x20')],_0x262193[_0xeb46('0x2c')]||null,NOW,NOW);if(_[_0xeb46('0x60')](_0x18fca2[_0xeb46('0x1e')])){_0x7abdb0+=_0xeb46('0x61');}_0x3e4850[_0xeb46('0x3c')](_0x7abdb0);if(_0x262193['duplicates']&&_0x262193[_0xeb46('0x5c')][_0xeb46('0x4c')]){_0x3e4850[_0xeb46('0x3c')](insertCmContact(_0x262193[_0xeb46('0x20')],_0xe3f6b0,_0x262193[_0xeb46('0x5c')],_0x18fca2));_0x3e4850['push'](_0xeb46('0x62')+_0xe3f6b0+';');}_0x3e4850[_0xeb46('0x3c')](insertCmHopper(_0x262193['ListId'],_0xeb46('0x63'),_0xeb46('0x64'),'VoiceQueueId',_0x49d26c));_0x3e4850[_0xeb46('0x3c')](insertCmHopperBlack(_0x262193['ListId'],_0xeb46('0x65'),_0xeb46('0x64'),_0xeb46('0x66')));_0x3e4850[_0xeb46('0x3c')](insertCmHopper(_0x262193['ListId'],_0xeb46('0x67'),_0xeb46('0x68'),_0xeb46('0x69'),_0x49d26c));_0x3e4850[_0xeb46('0x3c')](insertCmHopperBlack(_0x262193[_0xeb46('0x20')],'campaigns_has_cm_blacklists',_0xeb46('0x68'),_0xeb46('0x69')));BPromise[_0xeb46('0x6a')](_0x3e4850,handleQuery)['then'](function(_0x5debc5){stats[_0xeb46('0x6b')]=!![];stats[_0xeb46('0x6c')]=_0x262193[_0xeb46('0x5c')]&&_0x262193[_0xeb46('0x5c')][_0xeb46('0x4c')]?results[0x2][_0xeb46('0x6c')]:results[0x0][_0xeb46('0x6c')];socket[_0xeb46('0x58')](_0xeb46('0x59')+_0x47ae4b,stats);fs[_0xeb46('0x6d')](_0x4deecd);fs[_0xeb46('0x6d')](_0x445eef);process[_0xeb46('0x3a')](0x0);})[_0xeb46('0x6e')](function(_0x3d22c0){logger['error'](_0x3d22c0[_0xeb46('0x39')]);process[_0xeb46('0x3a')](0x1);});}catch(_0x596873){logger['error'](_0xeb46('0x6f'),_0x596873['message']);process[_0xeb46('0x3a')](0x1);}},'error':function(_0x5d64d4,_0x337a7d,_0x1f1946,_0x171045){throw new Error(_0x171045);}});}function validate(){if(process['argv']&&process['argv'][_0xeb46('0x4c')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x5abcb5=path[_0xeb46('0x12')](config[_0xeb46('0x70')],_0xeb46('0x46'),process[_0xeb46('0x71')][0x2]);if(!fs[_0xeb46('0x72')](_0x5abcb5)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x174b85={};try{_0x174b85=JSON['parse'](process[_0xeb46('0x71')][0x3]);if(!_0x174b85[_0xeb46('0x73')]){throw new Error(_0xeb46('0x74'));}if(!_0x174b85[_0xeb46('0x73')][_0xeb46('0x10')]){throw new Error(_0xeb46('0x75'));}if(!_0x174b85[_0xeb46('0x73')][_0xeb46('0x76')]){throw new Error('firstName\x20is\x20mandatory');}var _0x2e977f=0x0;if(_0x174b85['binding'][_0xeb46('0x77')]){_0x2e977f=0x1;}if(!_0x174b85[_0xeb46('0x20')]){throw new Error(_0xeb46('0x78'));}}catch(_0x4f7757){throw new Error(_0xeb46('0x79'));}var _0x2ae94b=[];try{_0x2ae94b=_[_0xeb46('0x7a')](JSON[_0xeb46('0x4a')](process[_0xeb46('0x71')][0x4]),'id');}catch(_0x36b62a){logger[_0xeb46('0x37')](_0xeb46('0x7b'));}main(_0x5abcb5,_0x174b85,_0x2ae94b,_0x2e977f);}validate();process['on']('SIGINT',handleStop);process['on'](_0xeb46('0x7c'),handleUncaughtException); \ No newline at end of file +var _0x4863=['email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','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()','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','each','affectedRows','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','../../../config/environment','../../../config/logger','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.createdAt','insert','cm_hopper_black','ListId','select','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','id\x20IN\x20?','MIN(id)','group','toString','info','Received\x20SIGINT','error','exit','message','query','spread','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header','parse','createReadStream','data','length','errors','hasOwnProperty','isValid','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email'];(function(_0x1e7ca5,_0x4e3a03){var _0xc81295=function(_0x4a509b){while(--_0x4a509b){_0x1e7ca5['push'](_0x1e7ca5['shift']());}};_0xc81295(++_0x4e3a03);}(_0x4863,0xa6));var _0x3486=function(_0x4b8761,_0x2f710f){_0x4b8761=_0x4b8761-0x0;var _0x516d13=_0x4863[_0x4b8761];return _0x516d13;};'use strict';var fs=require('fs');var path=require(_0x3486('0x0'));var _=require(_0x3486('0x1'));var Papa=require('papaparse');var util=require(_0x3486('0x2'));var BPromise=require(_0x3486('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x3486('0x4'));var logger=require(_0x3486('0x5'))('import');config[_0x3486('0x6')]=_['defaults'](config[_0x3486('0x6')],{'host':_0x3486('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x3486('0x8')](_0x3486('0x9'));function isEmail(_0x5b06ab){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))*$/[_0x3486('0xa')](_0x5b06ab);}function selectNotIn(_0x14d53d,_0xce596d,_0x43956a,_0x556f01,_0x27fab4){return squel['select']()[_0x3486('0xb')](_0x3486('0xc'))[_0x3486('0xd')](_0x556f01)[_0x3486('0xe')](_0xce596d,null,_0xce596d+_0x3486('0xf')+_0x556f01+'.'+_0x43956a)[_0x3486('0x10')](_0x556f01+'.'+_0x43956a+'\x20=\x20'+_0x14d53d+'.'+_0x43956a)[_0x3486('0x10')](_0xce596d+_0x3486('0x11')+_0x27fab4[_0x3486('0xe')]()+')');}function insertCmHopper(_0x308e47,_0x4ca5b3,_0x576c48,_0x4e118f,_0x381324){var _0x240545=[_0x3486('0x12'),'cm_contacts.scheduledat',_0x3486('0x13'),_0x3486('0x14'),_0x4ca5b3+'.'+_0x4e118f,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x3486('0x15'),_0x3486('0x16'),'\x22'+_0x381324+'\x22'];return squel['insert']()[_0x3486('0x17')](_0x3486('0x18'))[_0x3486('0x19')]([_0x3486('0xc'),_0x3486('0x1a'),_0x3486('0x1b'),'ListId',_0x4e118f,_0x3486('0x1c'),'updatedAt',_0x3486('0x1d'),_0x3486('0x1e'),_0x3486('0x1f')],squel['select']()[_0x3486('0x20')](_0x240545)[_0x3486('0xd')](_0x4ca5b3)['join'](_0x3486('0x21'),null,'cm_contacts.ListId\x20=\x20'+_0x4ca5b3+_0x3486('0x22'))[_0x3486('0xe')](_0x576c48,null,_0x576c48+_0x3486('0xf')+_0x4ca5b3+'.'+_0x4e118f)[_0x3486('0x10')](_0x4ca5b3+_0x3486('0x23'),_0x308e47)[_0x3486('0x10')](_0x3486('0x24'),NOW)[_0x3486('0x10')](_0x3486('0x25'),selectNotIn(_0x4ca5b3,_0x576c48,_0x4e118f,_0x3486('0x18'),[_0x3486('0x26'),'\x22onlyIfOpen\x22']))[_0x3486('0x10')](_0x3486('0x25'),selectNotIn(_0x4ca5b3,_0x576c48,_0x4e118f,_0x3486('0x18'),[_0x3486('0x26')])))['toString']();}function insertCmHopperBlack(_0x6f4389,_0x1bc645,_0x5ee692,_0x101926){var _0x1d299b=[_0x3486('0x12'),_0x3486('0x13'),'cm_contacts.ListId',_0x1bc645+'.'+_0x101926,_0x3486('0x27'),'cm_contacts.updatedAt'];return squel[_0x3486('0x28')]()[_0x3486('0x17')](_0x3486('0x29'))[_0x3486('0x19')]([_0x3486('0xc'),_0x3486('0x1b'),_0x3486('0x2a'),_0x101926,_0x3486('0x1c'),'updatedAt'],squel[_0x3486('0x2b')]()['fields'](_0x1d299b)['from'](_0x1bc645)[_0x3486('0xe')]('cm_contacts',null,_0x3486('0x2c')+_0x1bc645+_0x3486('0x22'))['join'](_0x5ee692,null,_0x5ee692+'.id\x20=\x20'+_0x1bc645+'.'+_0x101926)[_0x3486('0x10')](_0x1bc645+_0x3486('0x23'),_0x6f4389)[_0x3486('0x10')](_0x3486('0x24'),NOW)[_0x3486('0x10')](_0x3486('0x25'),squel[_0x3486('0x2b')]()[_0x3486('0xb')](_0x3486('0xc'))[_0x3486('0xd')](_0x3486('0x29'))[_0x3486('0x10')](_0x3486('0x2d'),_0x6f4389)[_0x3486('0x10')](_0x101926+_0x3486('0x2e'),_0x1bc645+'.'+_0x101926)))['toString']();}function insertCmContact(_0x4229bd,_0x45705a,_0x131e3e,_0x2ccf07){var _0x5d67ef=_['concat'](_[_0x3486('0x2f')](_0x2ccf07),[_0x3486('0x2a'),_0x3486('0x30'),_0x3486('0x1c'),'updatedAt']);return squel[_0x3486('0x28')]()['into'](_0x3486('0x21'))[_0x3486('0x19')](_0x5d67ef,squel[_0x3486('0x2b')]()[_0x3486('0x20')](_0x5d67ef)[_0x3486('0xd')](_0x45705a)['where']('('+_0x131e3e[_0x3486('0xe')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x3486('0x20')](_0x131e3e)['from']('cm_contacts')['where'](_0x3486('0x2d'),_0x4229bd)['where']('deletedAt\x20IS\x20NULL'))['where'](_0x3486('0x31'),squel['select']()[_0x3486('0xb')](_0x3486('0x32'),'min_id')[_0x3486('0xd')](_0x45705a)[_0x3486('0x33')](_0x131e3e[_0x3486('0xe')](','))))[_0x3486('0x34')]();}function handleStop(){logger[_0x3486('0x35')](_0x3486('0x36'));stopped=!![];}function handleUncaughtException(_0x4c1fef){logger[_0x3486('0x37')](_0x4c1fef['message']);process[_0x3486('0x38')](0x1);}function handleError(_0x5751eb,_0x69c73){stats['errors']['push']({'name':_0x69c73['code'],'message':_0x69c73[_0x3486('0x39')],'row':_0x5751eb});}function handleQuery(_0x11b383){logger['info'](_0x11b383);return db['sequelize'][_0x3486('0x3a')](_0x11b383)[_0x3486('0x3b')](function(_0x2bd458){results['push'](_0x2bd458);})[_0x3486('0x3c')](function(_0xc37f72){logger[_0x3486('0x37')](_0xc37f72[_0x3486('0x39')]);});}function main(_0x464b6c,_0x4db214,_0x3209bf,_0x274ff5){logger[_0x3486('0x35')](_0x3486('0x3d'),_0x464b6c,JSON[_0x3486('0x3e')](_0x4db214));process[_0x3486('0x3f')](_0x3486('0x40'));var _0x4961fa=_0x4db214[_0x3486('0x41')];var _0x4c6ac3=_0x4db214[_0x3486('0x42')];var _0x396f9d=path[_0x3486('0xe')](config[_0x3486('0x43')],_0x3486('0x44'),_0x4c6ac3+'.csv');var _0x42f286=_[_0x3486('0x2f')](_0x4961fa)[_0x3486('0xe')]();logger['info'](_0x3486('0x45'),_0x42f286);fs['writeFileSync'](_0x396f9d,_0x42f286+'\x0a');Papa[_0x3486('0x46')](fs[_0x3486('0x47')](_0x464b6c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x53257e,_0x5172d5){try{for(var _0x523424=0x0,_0x93e656=[];_0x523424<_0x53257e[_0x3486('0x48')][_0x3486('0x49')];_0x523424++){stats['rows']+=0x1;if(_0x53257e[_0x3486('0x4a')][_0x523424]){handleError(_0x53257e[_0x3486('0x48')][_0x523424],_0x53257e[_0x3486('0x4a')][_0x523424]);}else{var _0x4959f4=[];for(var _0x295bf5 in _0x4961fa){if(_0x4961fa[_0x3486('0x4b')](_0x295bf5)){if(_0x53257e[_0x3486('0x48')][_0x523424][_0x4961fa[_0x295bf5]]){var _0x23d383=_['trim'](_0x53257e[_0x3486('0x48')][_0x523424][_0x4961fa[_0x295bf5]]['replace'](/"/g,'\x27'));switch(_0x295bf5){case _0x3486('0x1a'):var _0x97c62e=moment(_0x23d383,_0x3486('0x9'),!![]);if(_0x97c62e[_0x3486('0x4c')]()){_0x93e656[_0x3486('0x4d')]('\x22'+_0x23d383+'\x22');}else{_0x4959f4['push'](_0x3486('0x4e'));}break;case _0x3486('0x1d'):var _0x50e510=parseInt(_0x23d383);_0x23d383=_[_0x3486('0x4f')](_0x50e510)||_0x50e510<0x0||_0x50e510>0x4?_0x274ff5?0x3:0x2:_0x50e510;_0x93e656['push']('\x22'+_0x23d383+'\x22');break;case _0x3486('0x1e'):var _0x3632ab=parseInt(_0x23d383);if(_[_0x3486('0x50')](_0x3632ab)&&_[_0x3486('0x51')](_0x3209bf,_0x3632ab)){_0x93e656[_0x3486('0x4d')]('\x22'+_0x3632ab+'\x22');}else{_0x4959f4[_0x3486('0x4d')](_0x3486('0x52'));}break;case _0x3486('0x53'):if(isEmail(_0x23d383)){_0x93e656[_0x3486('0x4d')]('\x22'+_0x23d383+'\x22');}else{_0x4959f4[_0x3486('0x4d')](_0x3486('0x54'));}break;case _0x3486('0x55'):var _0x147d1a=moment(_0x23d383,_0x3486('0x56'),!![]);if(_0x147d1a[_0x3486('0x4c')]()){_0x93e656[_0x3486('0x4d')]('\x22'+_0x23d383+'\x22');}else{_0x4959f4[_0x3486('0x4d')](_0x3486('0x57'));}break;default:_0x93e656['push']('\x22'+_0x23d383+'\x22');}}else{switch(_0x295bf5){case _0x3486('0x58'):case _0x3486('0xc'):_0x4959f4[_0x3486('0x4d')](_0x295bf5+'\x20not\x20specified');break;default:_0x93e656[_0x3486('0x4d')]('\x22\x22');}}}}if(_0x4959f4[_0x3486('0x49')]){handleError(_0x53257e['data'][_0x523424],{'code':'SystemRow','message':_0x4959f4[_0x3486('0xe')]()});}else{fs[_0x3486('0x59')](_0x396f9d,_0x93e656[_0x3486('0xe')]()+'\x0a');}_0x93e656=[];}if(!(stats[_0x3486('0x5a')]%0xc8)){socket[_0x3486('0x5b')](_0x3486('0x5c')+_0x4c6ac3,stats);stats[_0x3486('0x4a')]=[];}}if(stopped){logger[_0x3486('0x35')](_0x3486('0x5d'));_0x5172d5[_0x3486('0x5e')]();}}catch(_0x2b10ca){handleError(_0x53257e['data'][_0x523424],{'code':_0x3486('0x5f'),'message':_0x2b10ca['message']});logger[_0x3486('0x37')](_0x3486('0x60'),_0x2b10ca[_0x3486('0x39')]);}},'complete':function(){try{var _0xd66804=[];var _0x35cca1=_0x3486('0x21');if(_0x4db214[_0x3486('0x61')]&&_0x4db214[_0x3486('0x61')][_0x3486('0x49')]){_0x35cca1=_0x3486('0x62')+_0x4c6ac3;_0xd66804[_0x3486('0x4d')](_0x3486('0x63')+_0x35cca1+_0x3486('0x64'));}var _0xea501e=util[_0x3486('0x8')](_0x3486('0x65'),_0x396f9d,_0x35cca1,_0x42f286,_0x4db214[_0x3486('0x2a')],_0x4db214['CompanyId']||null,NOW,NOW);if(_[_0x3486('0x66')](_0x4961fa[_0x3486('0x1a')])){_0xea501e+=_0x3486('0x67');}_0xd66804[_0x3486('0x4d')](_0xea501e);if(_0x4db214[_0x3486('0x61')]&&_0x4db214[_0x3486('0x61')][_0x3486('0x49')]){_0xd66804[_0x3486('0x4d')](insertCmContact(_0x4db214[_0x3486('0x2a')],_0x35cca1,_0x4db214['duplicates'],_0x4961fa));_0xd66804[_0x3486('0x4d')]('DROP\x20TABLE\x20'+_0x35cca1+';');}_0xd66804[_0x3486('0x4d')](insertCmHopper(_0x4db214[_0x3486('0x2a')],_0x3486('0x68'),_0x3486('0x69'),'VoiceQueueId',_0x274ff5));_0xd66804['push'](insertCmHopperBlack(_0x4db214['ListId'],_0x3486('0x6a'),_0x3486('0x69'),_0x3486('0x6b')));_0xd66804['push'](insertCmHopper(_0x4db214['ListId'],_0x3486('0x6c'),_0x3486('0x6d'),_0x3486('0x6e'),_0x274ff5));_0xd66804['push'](insertCmHopperBlack(_0x4db214[_0x3486('0x2a')],'campaigns_has_cm_blacklists',_0x3486('0x6d'),_0x3486('0x6e')));BPromise[_0x3486('0x6f')](_0xd66804,handleQuery)['then'](function(_0x285790){stats['finish']=!![];stats[_0x3486('0x70')]=_0x4db214[_0x3486('0x61')]&&_0x4db214[_0x3486('0x61')][_0x3486('0x49')]?results[0x2][_0x3486('0x70')]:results[0x0]['affectedRows'];socket[_0x3486('0x5b')](_0x3486('0x5c')+_0x4c6ac3,stats);fs[_0x3486('0x71')](_0x464b6c);fs['unlink'](_0x396f9d);process[_0x3486('0x38')](0x0);})[_0x3486('0x3c')](function(_0x212101){logger[_0x3486('0x37')](_0x212101[_0x3486('0x39')]);process[_0x3486('0x38')](0x1);});}catch(_0x1614ca){logger['error']('complete',_0x1614ca['message']);process['exit'](0x1);}},'error':function(_0x17124f,_0x4fc2b6,_0x477fdd,_0x89d034){throw new Error(_0x89d034);}});}function validate(){if(process['argv']&&process[_0x3486('0x72')][_0x3486('0x49')]<0x4){throw new Error(_0x3486('0x73'));}var _0x3099a7=path[_0x3486('0xe')](config[_0x3486('0x43')],_0x3486('0x44'),process[_0x3486('0x72')][0x2]);if(!fs['existsSync'](_0x3099a7)){throw new Error(_0x3486('0x74'));}var _0x504abe={};try{_0x504abe=JSON[_0x3486('0x46')](process[_0x3486('0x72')][0x3]);if(!_0x504abe['binding']){throw new Error(_0x3486('0x75'));}if(!_0x504abe[_0x3486('0x41')]['phone']){throw new Error(_0x3486('0x76'));}if(!_0x504abe[_0x3486('0x41')][_0x3486('0x58')]){throw new Error(_0x3486('0x77'));}var _0xfa1715=0x0;if(_0x504abe[_0x3486('0x41')][_0x3486('0x1e')]){_0xfa1715=0x1;}if(!_0x504abe[_0x3486('0x2a')]){throw new Error(_0x3486('0x78'));}}catch(_0x2ee34c){throw new Error(_0x3486('0x79'));}var _0x53622b=[];try{_0x53622b=_[_0x3486('0x7a')](JSON[_0x3486('0x46')](process['argv'][0x4]),'id');}catch(_0x3d68f2){logger['info'](_0x3486('0x7b'));}main(_0x3099a7,_0x504abe,_0x53622b,_0xfa1715);}validate();process['on'](_0x3486('0x7c'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index c236f65..09b06ef 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','exit','code','message','stringify','send','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','header','parse','data','rows','errors','find','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','trim','itemTypeId','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','moment','squel','ioredis','../../../mysqldb','../../../config/logger','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','from','join','.id\x20=\x20','where','sequelize','spread','isNil','AdditionalPhones','push','all','then','catch','error','length','split','findOne','update','updated','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.createdAt','insert','into','ListId','cm_contacts.ListId\x20=\x20','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys'];(function(_0xa20086,_0x3978a9){var _0x121c6e=function(_0x16a848){while(--_0x16a848){_0xa20086['push'](_0xa20086['shift']());}};_0x121c6e(++_0x3978a9);}(_0x70e0,0x17b));var _0x070e=function(_0x164ffd,_0x34bc69){_0x164ffd=_0x164ffd-0x0;var _0x249db7=_0x70e0[_0x164ffd];return _0x249db7;};'use strict';var fs=require('fs');var path=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var Papa=require(_0x070e('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x070e('0x3'));var squel=require(_0x070e('0x4'));var Redis=require(_0x070e('0x5'));var db=require(_0x070e('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x070e('0x7'))('import');config[_0x070e('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x070e('0x9'))(new Redis(config[_0x070e('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x070e('0xa')](_0x070e('0xb'));var tempTableName=_0x070e('0xc')+moment()[_0x070e('0xa')](_0x070e('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4e99e6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4e99e6);}function selectNotIn(_0x50f4eb,_0x2e3e5e,_0x12bb37,_0xb8d819,_0xa927a2){return squel[_0x070e('0xe')]()[_0x070e('0xf')](_0x070e('0x10'))[_0x070e('0x11')](_0xb8d819)[_0x070e('0x12')](_0x2e3e5e,null,_0x2e3e5e+_0x070e('0x13')+_0xb8d819+'.'+_0x12bb37)['where'](_0xb8d819+'.'+_0x12bb37+'\x20=\x20'+_0x50f4eb+'.'+_0x12bb37)[_0x070e('0x14')](_0x2e3e5e+'.dialCheckDuplicateType\x20IN\x20('+_0xa927a2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5bae0f,_0x11d2ce){promisesAdditionalPhones=[];promisesContact=[];return db[_0x070e('0x15')]['query']('select\x20*\x20from\x20'+tempTableName)[_0x070e('0x16')](function(_0xeae1a5){if(_0xeae1a5!==null){var _0x180897=[];for(var _0x19d9da=0x0;_0x19d9da<_0xeae1a5['length'];_0x19d9da++){var _0x49861b=_0xeae1a5[_0x19d9da];if(!_[_0x070e('0x17')](_0x49861b[_0x070e('0x10')])){if(!_[_0x070e('0x17')](_0x49861b[_0x070e('0x18')]))_0x180897[_0x070e('0x19')](insertAdditionalPhones(_0x49861b));promisesContact['push']({'contact':_0x49861b});}}}Promise[_0x070e('0x1a')](_0x180897)[_0x070e('0x1b')](function(){_0x5bae0f({'val':0x1});});})[_0x070e('0x1c')](function(_0x3ea105){logger[_0x070e('0x1d')](_0x3ea105['message']);});});}function insertAdditionalPhones(_0x5b2f48){return new Promise(function(_0x4e958f,_0x9907cf){var _0x3004f0=_0x5b2f48[_0x070e('0x18')];if(_['isNil'](_0x3004f0))_0x9907cf({'val':0x0});else{var _0x5b184=_0x3004f0['split'](';');var _0xf8dd5d=[];orderBy=0x0;for(var _0x3f6985=0x0;_0x3f6985<_0x5b184[_0x070e('0x1e')];_0x3f6985++){_0xf8dd5d[_0x070e('0x19')](splitAdditionalPhone(_0x5b2f48['id'],_0x5b184[_0x3f6985]));}Promise[_0x070e('0x1a')](_0xf8dd5d)[_0x070e('0x1b')](function(){_0x4e958f({'val':_0x5b184[_0x070e('0x1e')]});});}});}function splitAdditionalPhone(_0x164cdf,_0x595c7e){return new Promise(function(_0x2f8055,_0x270061){var _0x4790eb=_0x595c7e['split'](':');var _0xf17c56=_0x4790eb[0x0];var _0x5f3e9d=_0x4790eb[0x1];if(_0x5f3e9d!==''){var _0x4a2dbd=_0x5f3e9d[_0x070e('0x1f')]('|');var _0x25f6e=[];for(var _0x41deb1=0x0;_0x41deb1<_0x4a2dbd[_0x070e('0x1e')];_0x41deb1++){if(_0x4a2dbd[_0x41deb1]!==''){var _0x4763c6=_['filter'](promisesAdditionalPhones,{'contactId':_0x164cdf,'phone':_0x4a2dbd[_0x41deb1]});if(_0x4763c6[_0x070e('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x070e('0x19')]({'contactId':_0x164cdf,'contactTypeId':_0xf17c56,'phone':_0x4a2dbd[_0x41deb1],'orderBy':orderBy});}}}_0x2f8055({'ok':0x1});}else _0x2f8055({'res':0x0});});}function createAdditionalPhone(_0x1d72d6,_0x1d2a34,_0x43dd96,_0x28d7f2){var _0x1a1892='';var _0x26373b='';var _0x5e8326=_0x43dd96[_0x070e('0x1f')]('§');_0x1a1892=_0x5e8326[0x0];if(_0x5e8326[_0x070e('0x1e')]==0x2)_0x26373b=_0x5e8326[0x1];return new Promise(function(_0x3a16d0,_0x56fc12){return db['CmContactHasItem'][_0x070e('0x20')]({'where':{'CmContactId':_0x1d72d6,'item':_0x1a1892}})[_0x070e('0x1b')](function(_0xa6c0ab){if(_0xa6c0ab){return db['CmContactHasItem'][_0x070e('0x21')]({'ItemTypeId':_0x1d2a34,'description':_0x26373b,'OrderBy':_0x28d7f2},{'where':{'CmContactId':_0x1d72d6,'item':_0x1a1892}})[_0x070e('0x1b')](function(_0x3a9425){_0x3a16d0({'res':_0x070e('0x22')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x1d72d6,'item':_0x1a1892,'ItemTypeId':_0x1d2a34,'description':_0x26373b,'OrderBy':_0x28d7f2,'ItemClass':'PHONE'})['then'](function(_0xdf8945){_0x3a16d0({'res':'inserted'});});}});});}function updateContact(_0x1dff97){return new Promise(function(_0x323cf1,_0x4f8130){var _0x47a739=_0x1dff97['id'];delete _0x1dff97['id'];return db[_0x070e('0x23')][_0x070e('0x21')](_0x1dff97,{'where':{'id':_0x47a739}})['then'](function(_0x546a16){updatedRows+=0x1;return db[_0x070e('0x24')][_0x070e('0x21')]({'phone':_0x1dff97[_0x070e('0x10')]},{'where':{'ContactId':_0x47a739}})[_0x070e('0x1b')](function(_0x18f0ad){_0x323cf1({'ret':'OK'});});});});}function insertCmHopper(_0x5f530d,_0x482cc2,_0x24d17d,_0x3011c4,_0x4bb439){var _0xf57ed=[_0x070e('0x25'),'cm_contacts.scheduledat',_0x070e('0x26'),_0x070e('0x27'),_0x482cc2+'.'+_0x3011c4,'cm_contacts.createdAt',_0x070e('0x28'),_0x070e('0x29'),'cm_contacts.UserId','\x22'+_0x4bb439+'\x22'];return squel['insert']()['into'](_0x070e('0x2a'))[_0x070e('0x2b')]([_0x070e('0x10'),_0x070e('0x2c'),_0x070e('0x2d'),'ListId',_0x3011c4,_0x070e('0x2e'),_0x070e('0x2f'),_0x070e('0x30'),'UserId',_0x070e('0x31')],squel[_0x070e('0xe')]()[_0x070e('0x32')](_0xf57ed)['from'](_0x482cc2)[_0x070e('0x12')](_0x070e('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x482cc2+_0x070e('0x34'))['join'](_0x24d17d,null,_0x24d17d+_0x070e('0x13')+_0x482cc2+'.'+_0x3011c4)[_0x070e('0x14')](_0x482cc2+_0x070e('0x35'),_0x5f530d)[_0x070e('0x14')](_0x070e('0x36'),NOW)['where'](_0x070e('0x37'),selectNotIn(_0x482cc2,_0x24d17d,_0x3011c4,'cm_hopper',['\x22always\x22',_0x070e('0x38')]))[_0x070e('0x14')](_0x070e('0x37'),selectNotIn(_0x482cc2,_0x24d17d,_0x3011c4,'cm_hopper',[_0x070e('0x39')])))[_0x070e('0x3a')]();}function insertCmHopperBlack(_0x556bf3,_0x7dc240,_0x4a4ee3,_0x13e4e0){var _0x5851ab=['cm_contacts.phone','cm_contacts.id',_0x070e('0x27'),_0x7dc240+'.'+_0x13e4e0,_0x070e('0x3b'),_0x070e('0x28')];return squel[_0x070e('0x3c')]()[_0x070e('0x3d')]('cm_hopper_black')[_0x070e('0x2b')](['phone',_0x070e('0x2d'),_0x070e('0x3e'),_0x13e4e0,_0x070e('0x2e'),'updatedAt'],squel['select']()[_0x070e('0x32')](_0x5851ab)['from'](_0x7dc240)[_0x070e('0x12')](_0x070e('0x33'),null,_0x070e('0x3f')+_0x7dc240+'.CmListId')[_0x070e('0x12')](_0x4a4ee3,null,_0x4a4ee3+_0x070e('0x13')+_0x7dc240+'.'+_0x13e4e0)['where'](_0x7dc240+'.CmListId\x20=\x20?',_0x556bf3)[_0x070e('0x14')](_0x070e('0x36'),NOW)[_0x070e('0x14')](_0x070e('0x37'),squel[_0x070e('0xe')]()['field'](_0x070e('0x10'))[_0x070e('0x11')](_0x070e('0x40'))[_0x070e('0x14')](_0x070e('0x41'),_0x556bf3)[_0x070e('0x14')](_0x13e4e0+_0x070e('0x42'),_0x7dc240+'.'+_0x13e4e0)))[_0x070e('0x3a')]();}function insertCmHopperAdditionalPhones(_0xd67987){var _0x66a3f3=[_0x070e('0x43'),_0x070e('0x44'),_0x070e('0x45'),_0x070e('0x46'),_0x070e('0x47')];return squel['insert']()[_0x070e('0x3d')](_0x070e('0x48'))[_0x070e('0x2b')]([_0x070e('0x49'),_0x070e('0x10'),_0x070e('0x4a'),_0x070e('0x2e'),_0x070e('0x2f')],squel[_0x070e('0xe')]()['fields'](_0x66a3f3)[_0x070e('0x11')]('cm_hopper')[_0x070e('0x12')](_0x070e('0x33'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x070e('0x12')](_0x070e('0x4b'),null,_0x070e('0x4c'))[_0x070e('0x14')](_0x070e('0x4d'),_0xd67987)[_0x070e('0x14')](_0x070e('0x36'),NOW))['toString']();}function insertCmContact(_0x296978,_0x5bacbd,_0x516161,_0x3a06c6){var _0x3d1b5e=_[_0x070e('0x4e')](_[_0x070e('0x4f')](_0x3a06c6),[_0x070e('0x3e'),_0x070e('0x50'),_0x070e('0x2e'),_0x070e('0x2f')]);return squel['insert']()[_0x070e('0x3d')]('cm_contacts')['fromQuery'](_0x3d1b5e,squel[_0x070e('0xe')]()[_0x070e('0x32')](_0x3d1b5e)['from'](_0x5bacbd)[_0x070e('0x14')]('('+_0x516161[_0x070e('0x12')](',')+_0x070e('0x51'),squel[_0x070e('0xe')]()[_0x070e('0x32')](_0x516161)[_0x070e('0x11')](_0x070e('0x33'))['where']('ListId\x20=\x20?',_0x296978))['where'](_0x070e('0x52'),squel[_0x070e('0xe')]()[_0x070e('0xf')](_0x070e('0x53'),'min_id')[_0x070e('0x11')](_0x5bacbd)['group'](_0x516161[_0x070e('0x12')](','))))[_0x070e('0x3a')]();}function handleStop(){logger[_0x070e('0x54')](_0x070e('0x55'));stopped=!![];}function handleUncaughtException(_0x3ab11c){logger[_0x070e('0x1d')](_0x3ab11c['message']);process[_0x070e('0x56')](0x1);}function handleError(_0x18e8d0,_0x8aaf00){stats['errors'][_0x070e('0x19')]({'name':_0x8aaf00[_0x070e('0x57')],'message':_0x8aaf00['message'],'row':_0x18e8d0});}function handleQuery(_0x1f1df5){logger['info'](_0x1f1df5);return db[_0x070e('0x15')]['query'](_0x1f1df5)['spread'](function(_0x4b354d){results[_0x070e('0x19')](_0x4b354d);})[_0x070e('0x1c')](function(_0x1100d8){logger[_0x070e('0x1d')](_0x1100d8[_0x070e('0x58')]);});}function main(_0x3a00bb,_0x498bc6,_0x841c89,_0x54d4f9){logger[_0x070e('0x54')]('main',_0x3a00bb,JSON[_0x070e('0x59')](_0x498bc6));process[_0x070e('0x5a')]('start');var _0x1bcdc3=_0x498bc6['binding'];var _0x1a9e25=_[_0x070e('0x5b')](_0x1bcdc3);var _0x2f1604=_0x498bc6[_0x070e('0x5c')];var _0x764b06=path[_0x070e('0x12')](config[_0x070e('0x5d')],_0x070e('0x5e'),_0x2f1604+_0x070e('0x5f'));logger[_0x070e('0x54')](_0x070e('0x60'),_0x498bc6);db[_0x070e('0x61')][_0x070e('0x62')]({'raw':!![],'attributes':['id',_0x070e('0x63')]})['then'](function(_0x45bf20){for(var _0x19d78c=0x0;_0x19d78c<_0x45bf20[_0x070e('0x1e')];_0x19d78c++){if(_0x45bf20[_0x19d78c][_0x070e('0x63')]in _0x1bcdc3){contactItemTypes['push'](_0x45bf20[_0x19d78c]);delete _0x1a9e25[_0x45bf20[_0x19d78c][_0x070e('0x63')]];hasAdditionalPhones=!![];}for(var _0x4e8e58 in _0x1bcdc3){if(_0x45bf20[_0x19d78c][_0x070e('0x63')]+_0x070e('0x64')===_0x4e8e58){phoneDescriptions[_0x070e('0x19')]({'itemTypeId':_0x45bf20[_0x19d78c]['id'],'description':_0x4e8e58});delete _0x1a9e25[_0x4e8e58];}}}if(hasAdditionalPhones)_0x1a9e25[_0x070e('0x18')]='';var _0x55524b=_[_0x070e('0x4f')](_0x1a9e25)[_0x070e('0x12')]();logger[_0x070e('0x54')](_0x070e('0x65'),_0x55524b);fs['writeFileSync'](_0x764b06,_0x55524b+'\x0a');Papa[_0x070e('0x66')](fs['createReadStream'](_0x3a00bb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x10d95d,_0x36373d){try{for(var _0x3a1ad2=0x0,_0x150bf6=[];_0x3a1ad2<_0x10d95d[_0x070e('0x67')]['length'];_0x3a1ad2++){stats[_0x070e('0x68')]+=0x1;if(_0x10d95d[_0x070e('0x69')][_0x3a1ad2]){handleError(_0x10d95d[_0x070e('0x67')][_0x3a1ad2],_0x10d95d[_0x070e('0x69')][_0x3a1ad2]);}else{var _0x5591dd=[];var _0x26b2c0=[];var _0x5cadcf={};for(var _0x399055 in _0x1bcdc3){let _0x44e465=contactItemTypes[_0x070e('0x6a')](_0x57585e=>_0x57585e[_0x070e('0x63')]===_0x399055);let _0x4d344c=contactItemTypes[_0x070e('0x6a')](_0x5ce157=>_0x5ce157[_0x070e('0x63')]+_0x070e('0x64')===_0x399055);if(_['isNil'](_0x44e465)&&_[_0x070e('0x17')](_0x4d344c)){if(_0x1bcdc3['hasOwnProperty'](_0x399055)){if(_0x10d95d[_0x070e('0x67')][_0x3a1ad2][_0x1bcdc3[_0x399055]]){var _0x416dde=_['trim'](_0x10d95d['data'][_0x3a1ad2][_0x1bcdc3[_0x399055]][_0x070e('0x6b')](/"/g,'\x27'));switch(_0x399055){case _0x070e('0x2c'):var _0xf67cfd=moment(_0x416dde,_0x070e('0xb'),!![]);if(_0xf67cfd[_0x070e('0x6c')]()){_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}else{_0x5591dd[_0x070e('0x19')](_0x070e('0x6d'));}break;case _0x070e('0x30'):var _0x1d1f44=parseInt(_0x416dde);_0x416dde=_[_0x070e('0x6e')](_0x1d1f44)||_0x1d1f44<0x0||_0x1d1f44>0x4?_0x54d4f9?0x3:0x2:_0x1d1f44;_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');break;case _0x070e('0x6f'):var _0x5c88fe=parseInt(_0x416dde);if(_[_0x070e('0x70')](_0x5c88fe)&&_[_0x070e('0x71')](_0x841c89,_0x5c88fe)){_0x150bf6['push']('\x22'+_0x5c88fe+'\x22');}else{_0x5591dd['push'](_0x070e('0x72'));}break;case _0x070e('0x73'):if(isEmail(_0x416dde)){_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}else{_0x5591dd[_0x070e('0x19')](_0x070e('0x74'));}break;case _0x070e('0x75'):var _0x3223a4=moment(_0x416dde,_0x070e('0x76'),!![]);if(_0x3223a4[_0x070e('0x6c')]()){_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}else{_0x5591dd[_0x070e('0x19')](_0x070e('0x77'));}break;default:_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}}else{switch(_0x399055){case'firstName':case'phone':_0x5591dd['push'](_0x399055+_0x070e('0x78'));break;default:_0x150bf6[_0x070e('0x19')]('\x22\x22');}}}}else{var _0x2c4e67='';if(!_[_0x070e('0x17')](_0x44e465)){if(!_0x5cadcf['hasOwnProperty'](_0x44e465['id'])){for(var _0x33bfed=0x0;_0x33bfed<_0x1bcdc3[_0x399055][_0x070e('0x1e')];_0x33bfed++){var _0x416dde=_[_0x070e('0x79')](_0x10d95d[_0x070e('0x67')][_0x3a1ad2][_0x1bcdc3[_0x399055][_0x33bfed]][_0x070e('0x6b')](/"/g,'\x27'));var _0x4a7129=phoneDescriptions[_0x070e('0x6a')](_0x5c56bd=>_0x5c56bd[_0x070e('0x7a')]===_0x44e465['id']);if(!_[_0x070e('0x17')](_0x4a7129)){var _0x2f704b=_[_0x070e('0x79')](_0x10d95d[_0x070e('0x67')][_0x3a1ad2][_0x1bcdc3[_0x4a7129['description']][0x0]][_0x070e('0x6b')](/"/g,'\x27'));if(!_[_0x070e('0x17')](_0x2f704b))_0x416dde=_0x416dde+'§'+_0x2f704b;}if(_0x2c4e67=='')_0x2c4e67=_0x416dde;else _0x2c4e67+='|'+_0x416dde;}_0x26b2c0['push'](_0x44e465['id']+':'+_0x2c4e67);_0x5cadcf[_0x44e465['id']]=0x1;}}}}if(hasAdditionalPhones){_0x150bf6[_0x070e('0x19')]('\x22'+_0x26b2c0[_0x070e('0x12')](';')+'\x22');}if(_0x5591dd['length']){handleError(_0x10d95d[_0x070e('0x67')][_0x3a1ad2],{'code':_0x070e('0x7b'),'message':_0x5591dd[_0x070e('0x12')]()});}else{fs['appendFileSync'](_0x764b06,_0x150bf6[_0x070e('0x12')]()+'\x0a');}_0x150bf6=[];}if(!(stats[_0x070e('0x68')]%0xc8)){socket[_0x070e('0x7c')](_0x070e('0x7d')+_0x2f1604,stats);stats[_0x070e('0x69')]=[];}}if(stopped){logger[_0x070e('0x54')](_0x070e('0x7e'));_0x36373d[_0x070e('0x7f')]();}}catch(_0x206b97){handleError(_0x10d95d[_0x070e('0x67')][_0x3a1ad2],{'code':_0x070e('0x80'),'message':_0x206b97[_0x070e('0x58')]});logger[_0x070e('0x1d')]('step',_0x206b97[_0x070e('0x58')]);}},'complete':function(){try{var _0x2df184=[];var _0x392c45=tempTableName;_0x2df184[_0x070e('0x19')](_0x070e('0x81')+_0x392c45+_0x070e('0x82'));logger['info']('CIS\x20len',contactItemTypes['length']);var _0x3c9abf=util[_0x070e('0xa')](_0x070e('0x83'),_0x764b06,_0x392c45,_0x55524b,_0x498bc6[_0x070e('0x3e')],_0x498bc6['CompanyId']||null,NOW,NOW);if(_[_0x070e('0x17')](_0x1bcdc3[_0x070e('0x2c')])){_0x3c9abf+=_0x070e('0x84');}_0x2df184['push'](_0x3c9abf);BPromise[_0x070e('0x85')](_0x2df184,handleQuery)['then'](function(_0x237e3b){BPromise[_0x070e('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x2df184=[];for(var _0x59fe3e=0x0;_0x59fe3e\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','moment','squel','ioredis','../../../mysqldb','../../../config/logger','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','from','join','.id\x20=\x20','where','sequelize','spread','isNil','AdditionalPhones','push','all','then','catch','error','length','split','findOne','update','updated','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.createdAt','insert','into','ListId','cm_contacts.ListId\x20=\x20','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys'];(function(_0x115850,_0x4bb634){var _0xbad084=function(_0xa14074){while(--_0xa14074){_0x115850['push'](_0x115850['shift']());}};_0xbad084(++_0x4bb634);}(_0x70e0,0x17b));var _0x070e=function(_0x348c6c,_0x45232a){_0x348c6c=_0x348c6c-0x0;var _0x372ec6=_0x70e0[_0x348c6c];return _0x372ec6;};'use strict';var fs=require('fs');var path=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var Papa=require(_0x070e('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x070e('0x3'));var squel=require(_0x070e('0x4'));var Redis=require(_0x070e('0x5'));var db=require(_0x070e('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x070e('0x7'))('import');config[_0x070e('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x070e('0x9'))(new Redis(config[_0x070e('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x070e('0xa')](_0x070e('0xb'));var tempTableName=_0x070e('0xc')+moment()[_0x070e('0xa')](_0x070e('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4e99e6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4e99e6);}function selectNotIn(_0x50f4eb,_0x2e3e5e,_0x12bb37,_0xb8d819,_0xa927a2){return squel[_0x070e('0xe')]()[_0x070e('0xf')](_0x070e('0x10'))[_0x070e('0x11')](_0xb8d819)[_0x070e('0x12')](_0x2e3e5e,null,_0x2e3e5e+_0x070e('0x13')+_0xb8d819+'.'+_0x12bb37)['where'](_0xb8d819+'.'+_0x12bb37+'\x20=\x20'+_0x50f4eb+'.'+_0x12bb37)[_0x070e('0x14')](_0x2e3e5e+'.dialCheckDuplicateType\x20IN\x20('+_0xa927a2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5bae0f,_0x11d2ce){promisesAdditionalPhones=[];promisesContact=[];return db[_0x070e('0x15')]['query']('select\x20*\x20from\x20'+tempTableName)[_0x070e('0x16')](function(_0xeae1a5){if(_0xeae1a5!==null){var _0x180897=[];for(var _0x19d9da=0x0;_0x19d9da<_0xeae1a5['length'];_0x19d9da++){var _0x49861b=_0xeae1a5[_0x19d9da];if(!_[_0x070e('0x17')](_0x49861b[_0x070e('0x10')])){if(!_[_0x070e('0x17')](_0x49861b[_0x070e('0x18')]))_0x180897[_0x070e('0x19')](insertAdditionalPhones(_0x49861b));promisesContact['push']({'contact':_0x49861b});}}}Promise[_0x070e('0x1a')](_0x180897)[_0x070e('0x1b')](function(){_0x5bae0f({'val':0x1});});})[_0x070e('0x1c')](function(_0x3ea105){logger[_0x070e('0x1d')](_0x3ea105['message']);});});}function insertAdditionalPhones(_0x5b2f48){return new Promise(function(_0x4e958f,_0x9907cf){var _0x3004f0=_0x5b2f48[_0x070e('0x18')];if(_['isNil'](_0x3004f0))_0x9907cf({'val':0x0});else{var _0x5b184=_0x3004f0['split'](';');var _0xf8dd5d=[];orderBy=0x0;for(var _0x3f6985=0x0;_0x3f6985<_0x5b184[_0x070e('0x1e')];_0x3f6985++){_0xf8dd5d[_0x070e('0x19')](splitAdditionalPhone(_0x5b2f48['id'],_0x5b184[_0x3f6985]));}Promise[_0x070e('0x1a')](_0xf8dd5d)[_0x070e('0x1b')](function(){_0x4e958f({'val':_0x5b184[_0x070e('0x1e')]});});}});}function splitAdditionalPhone(_0x164cdf,_0x595c7e){return new Promise(function(_0x2f8055,_0x270061){var _0x4790eb=_0x595c7e['split'](':');var _0xf17c56=_0x4790eb[0x0];var _0x5f3e9d=_0x4790eb[0x1];if(_0x5f3e9d!==''){var _0x4a2dbd=_0x5f3e9d[_0x070e('0x1f')]('|');var _0x25f6e=[];for(var _0x41deb1=0x0;_0x41deb1<_0x4a2dbd[_0x070e('0x1e')];_0x41deb1++){if(_0x4a2dbd[_0x41deb1]!==''){var _0x4763c6=_['filter'](promisesAdditionalPhones,{'contactId':_0x164cdf,'phone':_0x4a2dbd[_0x41deb1]});if(_0x4763c6[_0x070e('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x070e('0x19')]({'contactId':_0x164cdf,'contactTypeId':_0xf17c56,'phone':_0x4a2dbd[_0x41deb1],'orderBy':orderBy});}}}_0x2f8055({'ok':0x1});}else _0x2f8055({'res':0x0});});}function createAdditionalPhone(_0x1d72d6,_0x1d2a34,_0x43dd96,_0x28d7f2){var _0x1a1892='';var _0x26373b='';var _0x5e8326=_0x43dd96[_0x070e('0x1f')]('§');_0x1a1892=_0x5e8326[0x0];if(_0x5e8326[_0x070e('0x1e')]==0x2)_0x26373b=_0x5e8326[0x1];return new Promise(function(_0x3a16d0,_0x56fc12){return db['CmContactHasItem'][_0x070e('0x20')]({'where':{'CmContactId':_0x1d72d6,'item':_0x1a1892}})[_0x070e('0x1b')](function(_0xa6c0ab){if(_0xa6c0ab){return db['CmContactHasItem'][_0x070e('0x21')]({'ItemTypeId':_0x1d2a34,'description':_0x26373b,'OrderBy':_0x28d7f2},{'where':{'CmContactId':_0x1d72d6,'item':_0x1a1892}})[_0x070e('0x1b')](function(_0x3a9425){_0x3a16d0({'res':_0x070e('0x22')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x1d72d6,'item':_0x1a1892,'ItemTypeId':_0x1d2a34,'description':_0x26373b,'OrderBy':_0x28d7f2,'ItemClass':'PHONE'})['then'](function(_0xdf8945){_0x3a16d0({'res':'inserted'});});}});});}function updateContact(_0x1dff97){return new Promise(function(_0x323cf1,_0x4f8130){var _0x47a739=_0x1dff97['id'];delete _0x1dff97['id'];return db[_0x070e('0x23')][_0x070e('0x21')](_0x1dff97,{'where':{'id':_0x47a739}})['then'](function(_0x546a16){updatedRows+=0x1;return db[_0x070e('0x24')][_0x070e('0x21')]({'phone':_0x1dff97[_0x070e('0x10')]},{'where':{'ContactId':_0x47a739}})[_0x070e('0x1b')](function(_0x18f0ad){_0x323cf1({'ret':'OK'});});});});}function insertCmHopper(_0x5f530d,_0x482cc2,_0x24d17d,_0x3011c4,_0x4bb439){var _0xf57ed=[_0x070e('0x25'),'cm_contacts.scheduledat',_0x070e('0x26'),_0x070e('0x27'),_0x482cc2+'.'+_0x3011c4,'cm_contacts.createdAt',_0x070e('0x28'),_0x070e('0x29'),'cm_contacts.UserId','\x22'+_0x4bb439+'\x22'];return squel['insert']()['into'](_0x070e('0x2a'))[_0x070e('0x2b')]([_0x070e('0x10'),_0x070e('0x2c'),_0x070e('0x2d'),'ListId',_0x3011c4,_0x070e('0x2e'),_0x070e('0x2f'),_0x070e('0x30'),'UserId',_0x070e('0x31')],squel[_0x070e('0xe')]()[_0x070e('0x32')](_0xf57ed)['from'](_0x482cc2)[_0x070e('0x12')](_0x070e('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x482cc2+_0x070e('0x34'))['join'](_0x24d17d,null,_0x24d17d+_0x070e('0x13')+_0x482cc2+'.'+_0x3011c4)[_0x070e('0x14')](_0x482cc2+_0x070e('0x35'),_0x5f530d)[_0x070e('0x14')](_0x070e('0x36'),NOW)['where'](_0x070e('0x37'),selectNotIn(_0x482cc2,_0x24d17d,_0x3011c4,'cm_hopper',['\x22always\x22',_0x070e('0x38')]))[_0x070e('0x14')](_0x070e('0x37'),selectNotIn(_0x482cc2,_0x24d17d,_0x3011c4,'cm_hopper',[_0x070e('0x39')])))[_0x070e('0x3a')]();}function insertCmHopperBlack(_0x556bf3,_0x7dc240,_0x4a4ee3,_0x13e4e0){var _0x5851ab=['cm_contacts.phone','cm_contacts.id',_0x070e('0x27'),_0x7dc240+'.'+_0x13e4e0,_0x070e('0x3b'),_0x070e('0x28')];return squel[_0x070e('0x3c')]()[_0x070e('0x3d')]('cm_hopper_black')[_0x070e('0x2b')](['phone',_0x070e('0x2d'),_0x070e('0x3e'),_0x13e4e0,_0x070e('0x2e'),'updatedAt'],squel['select']()[_0x070e('0x32')](_0x5851ab)['from'](_0x7dc240)[_0x070e('0x12')](_0x070e('0x33'),null,_0x070e('0x3f')+_0x7dc240+'.CmListId')[_0x070e('0x12')](_0x4a4ee3,null,_0x4a4ee3+_0x070e('0x13')+_0x7dc240+'.'+_0x13e4e0)['where'](_0x7dc240+'.CmListId\x20=\x20?',_0x556bf3)[_0x070e('0x14')](_0x070e('0x36'),NOW)[_0x070e('0x14')](_0x070e('0x37'),squel[_0x070e('0xe')]()['field'](_0x070e('0x10'))[_0x070e('0x11')](_0x070e('0x40'))[_0x070e('0x14')](_0x070e('0x41'),_0x556bf3)[_0x070e('0x14')](_0x13e4e0+_0x070e('0x42'),_0x7dc240+'.'+_0x13e4e0)))[_0x070e('0x3a')]();}function insertCmHopperAdditionalPhones(_0xd67987){var _0x66a3f3=[_0x070e('0x43'),_0x070e('0x44'),_0x070e('0x45'),_0x070e('0x46'),_0x070e('0x47')];return squel['insert']()[_0x070e('0x3d')](_0x070e('0x48'))[_0x070e('0x2b')]([_0x070e('0x49'),_0x070e('0x10'),_0x070e('0x4a'),_0x070e('0x2e'),_0x070e('0x2f')],squel[_0x070e('0xe')]()['fields'](_0x66a3f3)[_0x070e('0x11')]('cm_hopper')[_0x070e('0x12')](_0x070e('0x33'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x070e('0x12')](_0x070e('0x4b'),null,_0x070e('0x4c'))[_0x070e('0x14')](_0x070e('0x4d'),_0xd67987)[_0x070e('0x14')](_0x070e('0x36'),NOW))['toString']();}function insertCmContact(_0x296978,_0x5bacbd,_0x516161,_0x3a06c6){var _0x3d1b5e=_[_0x070e('0x4e')](_[_0x070e('0x4f')](_0x3a06c6),[_0x070e('0x3e'),_0x070e('0x50'),_0x070e('0x2e'),_0x070e('0x2f')]);return squel['insert']()[_0x070e('0x3d')]('cm_contacts')['fromQuery'](_0x3d1b5e,squel[_0x070e('0xe')]()[_0x070e('0x32')](_0x3d1b5e)['from'](_0x5bacbd)[_0x070e('0x14')]('('+_0x516161[_0x070e('0x12')](',')+_0x070e('0x51'),squel[_0x070e('0xe')]()[_0x070e('0x32')](_0x516161)[_0x070e('0x11')](_0x070e('0x33'))['where']('ListId\x20=\x20?',_0x296978))['where'](_0x070e('0x52'),squel[_0x070e('0xe')]()[_0x070e('0xf')](_0x070e('0x53'),'min_id')[_0x070e('0x11')](_0x5bacbd)['group'](_0x516161[_0x070e('0x12')](','))))[_0x070e('0x3a')]();}function handleStop(){logger[_0x070e('0x54')](_0x070e('0x55'));stopped=!![];}function handleUncaughtException(_0x3ab11c){logger[_0x070e('0x1d')](_0x3ab11c['message']);process[_0x070e('0x56')](0x1);}function handleError(_0x18e8d0,_0x8aaf00){stats['errors'][_0x070e('0x19')]({'name':_0x8aaf00[_0x070e('0x57')],'message':_0x8aaf00['message'],'row':_0x18e8d0});}function handleQuery(_0x1f1df5){logger['info'](_0x1f1df5);return db[_0x070e('0x15')]['query'](_0x1f1df5)['spread'](function(_0x4b354d){results[_0x070e('0x19')](_0x4b354d);})[_0x070e('0x1c')](function(_0x1100d8){logger[_0x070e('0x1d')](_0x1100d8[_0x070e('0x58')]);});}function main(_0x3a00bb,_0x498bc6,_0x841c89,_0x54d4f9){logger[_0x070e('0x54')]('main',_0x3a00bb,JSON[_0x070e('0x59')](_0x498bc6));process[_0x070e('0x5a')]('start');var _0x1bcdc3=_0x498bc6['binding'];var _0x1a9e25=_[_0x070e('0x5b')](_0x1bcdc3);var _0x2f1604=_0x498bc6[_0x070e('0x5c')];var _0x764b06=path[_0x070e('0x12')](config[_0x070e('0x5d')],_0x070e('0x5e'),_0x2f1604+_0x070e('0x5f'));logger[_0x070e('0x54')](_0x070e('0x60'),_0x498bc6);db[_0x070e('0x61')][_0x070e('0x62')]({'raw':!![],'attributes':['id',_0x070e('0x63')]})['then'](function(_0x45bf20){for(var _0x19d78c=0x0;_0x19d78c<_0x45bf20[_0x070e('0x1e')];_0x19d78c++){if(_0x45bf20[_0x19d78c][_0x070e('0x63')]in _0x1bcdc3){contactItemTypes['push'](_0x45bf20[_0x19d78c]);delete _0x1a9e25[_0x45bf20[_0x19d78c][_0x070e('0x63')]];hasAdditionalPhones=!![];}for(var _0x4e8e58 in _0x1bcdc3){if(_0x45bf20[_0x19d78c][_0x070e('0x63')]+_0x070e('0x64')===_0x4e8e58){phoneDescriptions[_0x070e('0x19')]({'itemTypeId':_0x45bf20[_0x19d78c]['id'],'description':_0x4e8e58});delete _0x1a9e25[_0x4e8e58];}}}if(hasAdditionalPhones)_0x1a9e25[_0x070e('0x18')]='';var _0x55524b=_[_0x070e('0x4f')](_0x1a9e25)[_0x070e('0x12')]();logger[_0x070e('0x54')](_0x070e('0x65'),_0x55524b);fs['writeFileSync'](_0x764b06,_0x55524b+'\x0a');Papa[_0x070e('0x66')](fs['createReadStream'](_0x3a00bb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x10d95d,_0x36373d){try{for(var _0x3a1ad2=0x0,_0x150bf6=[];_0x3a1ad2<_0x10d95d[_0x070e('0x67')]['length'];_0x3a1ad2++){stats[_0x070e('0x68')]+=0x1;if(_0x10d95d[_0x070e('0x69')][_0x3a1ad2]){handleError(_0x10d95d[_0x070e('0x67')][_0x3a1ad2],_0x10d95d[_0x070e('0x69')][_0x3a1ad2]);}else{var _0x5591dd=[];var _0x26b2c0=[];var _0x5cadcf={};for(var _0x399055 in _0x1bcdc3){let _0x44e465=contactItemTypes[_0x070e('0x6a')](_0x57585e=>_0x57585e[_0x070e('0x63')]===_0x399055);let _0x4d344c=contactItemTypes[_0x070e('0x6a')](_0x5ce157=>_0x5ce157[_0x070e('0x63')]+_0x070e('0x64')===_0x399055);if(_['isNil'](_0x44e465)&&_[_0x070e('0x17')](_0x4d344c)){if(_0x1bcdc3['hasOwnProperty'](_0x399055)){if(_0x10d95d[_0x070e('0x67')][_0x3a1ad2][_0x1bcdc3[_0x399055]]){var _0x416dde=_['trim'](_0x10d95d['data'][_0x3a1ad2][_0x1bcdc3[_0x399055]][_0x070e('0x6b')](/"/g,'\x27'));switch(_0x399055){case _0x070e('0x2c'):var _0xf67cfd=moment(_0x416dde,_0x070e('0xb'),!![]);if(_0xf67cfd[_0x070e('0x6c')]()){_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}else{_0x5591dd[_0x070e('0x19')](_0x070e('0x6d'));}break;case _0x070e('0x30'):var _0x1d1f44=parseInt(_0x416dde);_0x416dde=_[_0x070e('0x6e')](_0x1d1f44)||_0x1d1f44<0x0||_0x1d1f44>0x4?_0x54d4f9?0x3:0x2:_0x1d1f44;_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');break;case _0x070e('0x6f'):var _0x5c88fe=parseInt(_0x416dde);if(_[_0x070e('0x70')](_0x5c88fe)&&_[_0x070e('0x71')](_0x841c89,_0x5c88fe)){_0x150bf6['push']('\x22'+_0x5c88fe+'\x22');}else{_0x5591dd['push'](_0x070e('0x72'));}break;case _0x070e('0x73'):if(isEmail(_0x416dde)){_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}else{_0x5591dd[_0x070e('0x19')](_0x070e('0x74'));}break;case _0x070e('0x75'):var _0x3223a4=moment(_0x416dde,_0x070e('0x76'),!![]);if(_0x3223a4[_0x070e('0x6c')]()){_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}else{_0x5591dd[_0x070e('0x19')](_0x070e('0x77'));}break;default:_0x150bf6[_0x070e('0x19')]('\x22'+_0x416dde+'\x22');}}else{switch(_0x399055){case'firstName':case'phone':_0x5591dd['push'](_0x399055+_0x070e('0x78'));break;default:_0x150bf6[_0x070e('0x19')]('\x22\x22');}}}}else{var _0x2c4e67='';if(!_[_0x070e('0x17')](_0x44e465)){if(!_0x5cadcf['hasOwnProperty'](_0x44e465['id'])){for(var _0x33bfed=0x0;_0x33bfed<_0x1bcdc3[_0x399055][_0x070e('0x1e')];_0x33bfed++){var _0x416dde=_[_0x070e('0x79')](_0x10d95d[_0x070e('0x67')][_0x3a1ad2][_0x1bcdc3[_0x399055][_0x33bfed]][_0x070e('0x6b')](/"/g,'\x27'));var _0x4a7129=phoneDescriptions[_0x070e('0x6a')](_0x5c56bd=>_0x5c56bd[_0x070e('0x7a')]===_0x44e465['id']);if(!_[_0x070e('0x17')](_0x4a7129)){var _0x2f704b=_[_0x070e('0x79')](_0x10d95d[_0x070e('0x67')][_0x3a1ad2][_0x1bcdc3[_0x4a7129['description']][0x0]][_0x070e('0x6b')](/"/g,'\x27'));if(!_[_0x070e('0x17')](_0x2f704b))_0x416dde=_0x416dde+'§'+_0x2f704b;}if(_0x2c4e67=='')_0x2c4e67=_0x416dde;else _0x2c4e67+='|'+_0x416dde;}_0x26b2c0['push'](_0x44e465['id']+':'+_0x2c4e67);_0x5cadcf[_0x44e465['id']]=0x1;}}}}if(hasAdditionalPhones){_0x150bf6[_0x070e('0x19')]('\x22'+_0x26b2c0[_0x070e('0x12')](';')+'\x22');}if(_0x5591dd['length']){handleError(_0x10d95d[_0x070e('0x67')][_0x3a1ad2],{'code':_0x070e('0x7b'),'message':_0x5591dd[_0x070e('0x12')]()});}else{fs['appendFileSync'](_0x764b06,_0x150bf6[_0x070e('0x12')]()+'\x0a');}_0x150bf6=[];}if(!(stats[_0x070e('0x68')]%0xc8)){socket[_0x070e('0x7c')](_0x070e('0x7d')+_0x2f1604,stats);stats[_0x070e('0x69')]=[];}}if(stopped){logger[_0x070e('0x54')](_0x070e('0x7e'));_0x36373d[_0x070e('0x7f')]();}}catch(_0x206b97){handleError(_0x10d95d[_0x070e('0x67')][_0x3a1ad2],{'code':_0x070e('0x80'),'message':_0x206b97[_0x070e('0x58')]});logger[_0x070e('0x1d')]('step',_0x206b97[_0x070e('0x58')]);}},'complete':function(){try{var _0x2df184=[];var _0x392c45=tempTableName;_0x2df184[_0x070e('0x19')](_0x070e('0x81')+_0x392c45+_0x070e('0x82'));logger['info']('CIS\x20len',contactItemTypes['length']);var _0x3c9abf=util[_0x070e('0xa')](_0x070e('0x83'),_0x764b06,_0x392c45,_0x55524b,_0x498bc6[_0x070e('0x3e')],_0x498bc6['CompanyId']||null,NOW,NOW);if(_[_0x070e('0x17')](_0x1bcdc3[_0x070e('0x2c')])){_0x3c9abf+=_0x070e('0x84');}_0x2df184['push'](_0x3c9abf);BPromise[_0x070e('0x85')](_0x2df184,handleQuery)['then'](function(_0x237e3b){BPromise[_0x070e('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x2df184=[];for(var _0x59fe3e=0x0;_0x59fe3e=_0x3dd539){return _0xe88001[_0xa89b('0x14')](0x193)[_0xa89b('0x15')]({'message':util[_0xa89b('0x8')](_0xa89b('0x16'),_0x53b4df)});}_0x512ec6();})[_0xa89b('0x17')](function(_0x3a1f15){_0x512ec6(_0x3a1f15);});});}function isUserLimit(){return isLimit(_0xa89b('0x18'),0x1,db[_0xa89b('0x19')],{'where':{'$or':[{'role':_0xa89b('0x1a')},{'role':_0xa89b('0x1b')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xfffd=['composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','hasOwnProperty','use','License','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','crypto','util'];(function(_0x11ee5a,_0x2262ce){var _0x3338dd=function(_0x2c51af){while(--_0x2c51af){_0x11ee5a['push'](_0x11ee5a['shift']());}};_0x3338dd(++_0x2262ce);}(_0xfffd,0x142));var _0xdfff=function(_0x2b4bc0,_0xfaa5a){_0x2b4bc0=_0x2b4bc0-0x0;var _0x585a71=_0xfffd[_0x2b4bc0];return _0x585a71;};'use strict';var crypto=require(_0xdfff('0x0'));var util=require(_0xdfff('0x1'));var compose=require(_0xdfff('0x2'));var db=require(_0xdfff('0x3'))['db'];var config=require(_0xdfff('0x4'));function getValueFromLicense(_0x188c76,_0x376538){if(_0x188c76&&_0x376538){if(_0x376538[_0xdfff('0x5')]&&_0x376538[_0xdfff('0x6')]){var _0x3433bb=_0x376538['data1'];var _0x2f7b3f=_0x376538[_0xdfff('0x6')];var _0x2b8c4e=_0x3433bb[_0xdfff('0x7')]('-')[0x4];var _0x254ca9=_0x3433bb['split']('-')[0x0];var _0x5c52c6=crypto[_0xdfff('0x8')](_0xdfff('0x9'),util['format'](_0xdfff('0xa'),_0x2b8c4e,_0x3433bb,_0x254ca9));var _0x3f247b=_0x5c52c6[_0xdfff('0xb')](_0x2f7b3f,_0xdfff('0xc'),_0xdfff('0xd'));_0x3f247b+=_0x5c52c6['final']('utf8');var _0x3ebaf6=JSON['parse'](_0x3f247b);return _0x3ebaf6[_0xdfff('0xe')](_0x188c76)?_0x3ebaf6[_0x188c76]:null;}}return null;}function isLimit(_0x526d63,_0x1ec1c3,_0x136ddb,_0x54006e){var _0x3e3758=_0x1ec1c3;return compose()[_0xdfff('0xf')](function(_0x19eae2,_0x2a8c75,_0x2844e1){return db[_0xdfff('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xdfff('0x11')](function(_0x369aa9){var _0x3e6013=getValueFromLicense(_0x526d63,_0x369aa9);return _0x3e6013?_0x3e6013:_0x3e3758;})[_0xdfff('0x11')](function(_0x4d61a2){_0x3e3758=_0x4d61a2;return _0x136ddb['count'](_0x54006e);})[_0xdfff('0x11')](function(_0x13434e){if(_0x13434e>=_0x3e3758){return _0x2a8c75[_0xdfff('0x12')](0x193)[_0xdfff('0x13')]({'message':util[_0xdfff('0x14')](_0xdfff('0x15'),_0x526d63)});}_0x2844e1();})[_0xdfff('0x16')](function(_0x19bf88){_0x2844e1(_0x19bf88);});});}function isUserLimit(){return isLimit(_0xdfff('0x17'),0x1,db[_0xdfff('0x18')],{'where':{'$or':[{'role':_0xdfff('0x19')},{'role':_0xdfff('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 24d0551..9e44213 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 _0x93ba=['NOT\x20IN\x20?','<>\x20?','$substring','$endsWith','$lt','<\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','utcOffset','hours','seconds','format','moment','parseSearch','startsWith','and','[$and]','replace','[$or]','split','slice','forEach','shift','match','map','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x93ba,0x76));var _0xa93b=function(_0x4ae2b5,_0x18e250){_0x4ae2b5=_0x4ae2b5-0x0;var _0x452abe=_0x93ba[_0x4ae2b5];return _0x452abe;};'use strict';var _=require('lodash');var moment=require(_0xa93b('0x0'));exports[_0xa93b('0x1')]=function(_0x575ce9){var _0x543b4a={'conditions':[]};_0x543b4a['sqlOperator']=_[_0xa93b('0x2')](_0x575ce9,'[$or]')?'or':_0xa93b('0x3');var _0x3b9e66=_0x575ce9['replace'](_0xa93b('0x4'),'')[_0xa93b('0x5')](_0xa93b('0x6'),'')[_0xa93b('0x7')]('||');for(var _0xade278=0x0;_0xade278<_0x3b9e66['length'];_0xade278++){var _0x36f5d4=_0x3b9e66[_0xade278]['split'](':=');var _0x46a97e=_0x36f5d4[0x0];var _0x5ff00a=_0x36f5d4[_0xa93b('0x8')](0x1);_0x5ff00a[_0xa93b('0x9')](function(_0x438f27){var _0x3e67e7=_0x438f27[_0xa93b('0x7')]('[')[_0xa93b('0xa')]();var _0x49f656=_0x438f27[_0xa93b('0xb')](/\[(.*?)\]/g);_0x49f656['forEach'](function(_0x3c25d4){var _0x32ade7=_0x3c25d4[_0xa93b('0x7')]('[')['filter'](function(_0x3e6734){return _0x3e6734['indexOf'](']')>-0x1;})[_0xa93b('0xc')](function(_0x45d9f7){return _0x45d9f7[_0xa93b('0x7')](']')[0x0];})[0x0];_0x543b4a['conditions']['push']({'field':_0x46a97e,'operator':_0x3e67e7,'value':_0x32ade7});});});}return _0x543b4a;};exports[_0xa93b('0xd')]=function(_0x5ec225,_0x14e7c7,_0x46873f){var _0x3ee2ea={};if(_0x14e7c7===_0xa93b('0xe')){if(_0x46873f[_0xa93b('0xf')]===_0xa93b('0x10')){_0x46873f[_0xa93b('0xf')]=_0xa93b('0x11');_0x46873f['value']+=','+_0x46873f[_0xa93b('0x12')];}else if(_['includes']([_0xa93b('0x13'),_0xa93b('0x14')],_0x46873f[_0xa93b('0xf')])){_0x46873f[_0xa93b('0x12')]=moment(_0x46873f[_0xa93b('0x12')])[_0xa93b('0x15')](0x1,_0xa93b('0x16'))['format'](_0xa93b('0x17'));}}if(_0x46873f[_0xa93b('0x18')]){_0x14e7c7=_0x46873f[_0xa93b('0x18')];_0x3ee2ea[_0xa93b('0x19')]=_0xa93b('0x1a')+_0x5ec225+'.'+_0x46873f[_0xa93b('0x1b')]+_0xa93b('0x1c')+_0x46873f[_0xa93b('0x18')]+')\x20'+parseOperator(_0x46873f[_0xa93b('0xf')]);}else{_0x3ee2ea['text']=_0x5ec225+'.'+_0x46873f[_0xa93b('0x1b')]+'\x20'+parseOperator(_0x46873f[_0xa93b('0xf')]);}if(_['includes']([_0xa93b('0x1d'),'$notIn'],_0x46873f[_0xa93b('0xf')]))_0x3ee2ea[_0xa93b('0x19')]='('+_0x3ee2ea[_0xa93b('0x19')]+_0xa93b('0x1e')+_0x5ec225+'.'+_0x46873f[_0xa93b('0x1b')]+_0xa93b('0x1f');_0x3ee2ea[_0xa93b('0x12')]=parseValue(_0x14e7c7,_0x46873f[_0xa93b('0xf')],_0x46873f['value']);return _0x3ee2ea;};function parseOperator(_0x11bd65){var _0x3aa5e1;switch(_0x11bd65){case _0xa93b('0x20'):_0x3aa5e1=_0xa93b('0x21');break;case _0xa93b('0x22'):_0x3aa5e1=_0xa93b('0x23');break;case _0xa93b('0x10'):_0x3aa5e1='=\x20?';break;case _0xa93b('0x1d'):_0x3aa5e1=_0xa93b('0x24');break;case _0xa93b('0x25'):case'$startsWith':case _0xa93b('0x26'):_0x3aa5e1='LIKE\x20?';break;case _0xa93b('0x27'):_0x3aa5e1=_0xa93b('0x28');break;case _0xa93b('0x13'):_0x3aa5e1='>\x20?';break;case _0xa93b('0x14'):_0x3aa5e1='<=\x20?';break;case _0xa93b('0x29'):_0x3aa5e1=_0xa93b('0x2a');break;case'$between':_0x3aa5e1=_0xa93b('0x2b');break;}return _0x3aa5e1;}function parseValue(_0x1a5cc3,_0x114681,_0x5344c1){var _0x56edf5={'start':undefined,'end':undefined};switch(_0x114681){case _0xa93b('0x20'):case _0xa93b('0x22'):_0x56edf5['start']=_0x5344c1['split'](',');break;case _0xa93b('0x25'):_0x56edf5[_0xa93b('0x2c')]='%'+_0x5344c1+'%';break;case _0xa93b('0x2d'):_0x56edf5[_0xa93b('0x2c')]=_0x5344c1+'%';break;case _0xa93b('0x26'):_0x56edf5[_0xa93b('0x2c')]='%'+_0x5344c1;break;case _0xa93b('0x11'):var _0x28dff9=_0x5344c1[_0xa93b('0x7')](',');var _0x5344c1=_0x28dff9[_0xa93b('0xa')]();var _0x6df350=_0x28dff9[_0xa93b('0x2e')]();if(_0x1a5cc3===_0xa93b('0xe')){_0x5344c1=moment(_0x5344c1)['utcOffset'](0x0,!![])['format']();_0x6df350=moment(_0x6df350)[_0xa93b('0x2f')](0x0,!![])[_0xa93b('0x15')](0x17,_0xa93b('0x30'))['add'](0x3b,'minutes')['add'](0x3b,_0xa93b('0x31'))[_0xa93b('0x32')]();}_0x56edf5={'start':_0x5344c1,'end':_0x6df350};break;default:_0x56edf5[_0xa93b('0x2c')]=_0x5344c1;break;}return _0x56edf5;} \ No newline at end of file +var _0x731b=['$gt','$lte','add','days','castTo','text','\x20AS\x20','field','\x20IS\x20NULL)','$in','IN\x20?','$notIn','=\x20?','$ne','<>\x20?','$startsWith','$endsWith','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','shift','pop','utcOffset','format','hours','seconds','moment','parseSearch','startsWith','[$or]','and','replace','length','split','slice','forEach','match','filter','push','buildExpression','DATE','operator','$eq','$between','value'];(function(_0x3f3181,_0x47900a){var _0x1db92a=function(_0x59b6c1){while(--_0x59b6c1){_0x3f3181['push'](_0x3f3181['shift']());}};_0x1db92a(++_0x47900a);}(_0x731b,0x1e1));var _0xb731=function(_0x528e14,_0x529d9c){_0x528e14=_0x528e14-0x0;var _0x58ac6b=_0x731b[_0x528e14];return _0x58ac6b;};'use strict';var _=require('lodash');var moment=require(_0xb731('0x0'));exports[_0xb731('0x1')]=function(_0x347ad9){var _0x25e94d={'conditions':[]};_0x25e94d['sqlOperator']=_[_0xb731('0x2')](_0x347ad9,_0xb731('0x3'))?'or':_0xb731('0x4');var _0xd33154=_0x347ad9[_0xb731('0x5')]('[$and]','')[_0xb731('0x5')](_0xb731('0x3'),'')['split']('||');for(var _0x29c906=0x0;_0x29c906<_0xd33154[_0xb731('0x6')];_0x29c906++){var _0x3abb08=_0xd33154[_0x29c906][_0xb731('0x7')](':=');var _0x83093e=_0x3abb08[0x0];var _0x833fad=_0x3abb08[_0xb731('0x8')](0x1);_0x833fad[_0xb731('0x9')](function(_0x36ca20){var _0x225b26=_0x36ca20[_0xb731('0x7')]('[')['shift']();var _0x2b978c=_0x36ca20[_0xb731('0xa')](/\[(.*?)\]/g);_0x2b978c[_0xb731('0x9')](function(_0x43cdca){var _0xf7ad18=_0x43cdca[_0xb731('0x7')]('[')[_0xb731('0xb')](function(_0x543984){return _0x543984['indexOf'](']')>-0x1;})['map'](function(_0x592cc6){return _0x592cc6[_0xb731('0x7')](']')[0x0];})[0x0];_0x25e94d['conditions'][_0xb731('0xc')]({'field':_0x83093e,'operator':_0x225b26,'value':_0xf7ad18});});});}return _0x25e94d;};exports[_0xb731('0xd')]=function(_0x12c08c,_0xcf224e,_0x199957){var _0xaf05ca={};if(_0xcf224e===_0xb731('0xe')){if(_0x199957[_0xb731('0xf')]===_0xb731('0x10')){_0x199957[_0xb731('0xf')]=_0xb731('0x11');_0x199957[_0xb731('0x12')]+=','+_0x199957[_0xb731('0x12')];}else if(_['includes']([_0xb731('0x13'),_0xb731('0x14')],_0x199957['operator'])){_0x199957['value']=moment(_0x199957[_0xb731('0x12')])[_0xb731('0x15')](0x1,_0xb731('0x16'))['format']('YYYY-MM-DD');}}if(_0x199957['castTo']){_0xcf224e=_0x199957[_0xb731('0x17')];_0xaf05ca[_0xb731('0x18')]='CAST('+_0x12c08c+'.'+_0x199957['field']+_0xb731('0x19')+_0x199957['castTo']+')\x20'+parseOperator(_0x199957['operator']);}else{_0xaf05ca[_0xb731('0x18')]=_0x12c08c+'.'+_0x199957[_0xb731('0x1a')]+'\x20'+parseOperator(_0x199957[_0xb731('0xf')]);}if(_['includes'](['$ne','$notIn'],_0x199957[_0xb731('0xf')]))_0xaf05ca[_0xb731('0x18')]='('+_0xaf05ca[_0xb731('0x18')]+'\x20OR\x20'+_0x12c08c+'.'+_0x199957[_0xb731('0x1a')]+_0xb731('0x1b');_0xaf05ca[_0xb731('0x12')]=parseValue(_0xcf224e,_0x199957[_0xb731('0xf')],_0x199957[_0xb731('0x12')]);return _0xaf05ca;};function parseOperator(_0x9c9ff5){var _0x1a85c5;switch(_0x9c9ff5){case _0xb731('0x1c'):_0x1a85c5=_0xb731('0x1d');break;case _0xb731('0x1e'):_0x1a85c5='NOT\x20IN\x20?';break;case _0xb731('0x10'):_0x1a85c5=_0xb731('0x1f');break;case _0xb731('0x20'):_0x1a85c5=_0xb731('0x21');break;case'$substring':case _0xb731('0x22'):case _0xb731('0x23'):_0x1a85c5='LIKE\x20?';break;case'$lt':_0x1a85c5=_0xb731('0x24');break;case _0xb731('0x13'):_0x1a85c5=_0xb731('0x25');break;case _0xb731('0x14'):_0x1a85c5=_0xb731('0x26');break;case _0xb731('0x27'):_0x1a85c5=_0xb731('0x28');break;case'$between':_0x1a85c5=_0xb731('0x29');break;}return _0x1a85c5;}function parseValue(_0x2ca5ed,_0x2c137a,_0x345eb7){var _0x1a7543={'start':undefined,'end':undefined};switch(_0x2c137a){case'$in':case _0xb731('0x1e'):_0x1a7543[_0xb731('0x2a')]=_0x345eb7[_0xb731('0x7')](',');break;case _0xb731('0x2b'):_0x1a7543[_0xb731('0x2a')]='%'+_0x345eb7+'%';break;case _0xb731('0x22'):_0x1a7543[_0xb731('0x2a')]=_0x345eb7+'%';break;case _0xb731('0x23'):_0x1a7543[_0xb731('0x2a')]='%'+_0x345eb7;break;case _0xb731('0x11'):var _0x22b5ef=_0x345eb7[_0xb731('0x7')](',');var _0x345eb7=_0x22b5ef[_0xb731('0x2c')]();var _0x17cd10=_0x22b5ef[_0xb731('0x2d')]();if(_0x2ca5ed===_0xb731('0xe')){_0x345eb7=moment(_0x345eb7)[_0xb731('0x2e')](0x0,!![])[_0xb731('0x2f')]();_0x17cd10=moment(_0x17cd10)['utcOffset'](0x0,!![])[_0xb731('0x15')](0x17,_0xb731('0x30'))[_0xb731('0x15')](0x3b,'minutes')['add'](0x3b,_0xb731('0x31'))[_0xb731('0x2f')]();}_0x1a7543={'start':_0x345eb7,'end':_0x17cd10};break;default:_0x1a7543[_0xb731('0x2a')]=_0x345eb7;break;}return _0x1a7543;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d7b7fb0..fa215b3 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 _0x105d=['substr','ASC','omit','isObject','isString','unset','forEach','includes','push','join','lodash','filters','isEmpty','forOwn','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','subtract','uniqueid','isArray','split','limit','offset','sort','indexOf','cast','col','priority','unsigned'];(function(_0x5c4d70,_0x236625){var _0x2e9561=function(_0x28f98f){while(--_0x28f98f){_0x5c4d70['push'](_0x5c4d70['shift']());}};_0x2e9561(++_0x236625);}(_0x105d,0x8e));var _0xd105=function(_0xe5a862,_0x5b7f20){_0xe5a862=_0xe5a862-0x0;var _0x313545=_0x105d[_0xe5a862];return _0x313545;};'use strict';var _=require(_0xd105('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x2b5830){var _0x1fdced=null;if(_0x2b5830){_0x1fdced=_0x2b5830['split'](',');}return _0x1fdced;};exports[_0xd105('0x1')]=function(_0x492bb1,_0x5a5cd4){var _0x2cf4f2={};if(!_[_0xd105('0x2')](_0x492bb1)){_[_0xd105('0x3')](_0x492bb1,function(_0x21bd35,_0x40c373){try{if(_0x5a5cd4){var _0x5df05d=_['find'](_0x5a5cd4,{'name':_0x40c373})||{};if(_0x5df05d['type']===_0xd105('0x4')&&_[_0xd105('0x5')](_0x21bd35)){var _0x5476d9=JSON[_0xd105('0x6')](_0x21bd35);var _0x1ac237={'$gte':moment(moment(_0x5476d9[_0xd105('0x7')])[_0xd105('0x8')](_0xd105('0x9')))[_0xd105('0xa')]()[_0xd105('0x8')](),'$lte':moment(moment(_0x5476d9['$lte'])[_0xd105('0x8')]('YYYY-MM-DD'))['utc']()[_0xd105('0xb')](0x1,'s')[_0xd105('0x8')]()};_0x2cf4f2[_0x40c373]=_0x1ac237;}else if(_0x5df05d['name']===_0xd105('0xc')){_0x2cf4f2[_0x40c373]=_0x21bd35;}else{_0x2cf4f2[_0x40c373]=_[_0xd105('0xd')](_0x21bd35)?_0x21bd35:JSON['parse'](_0x21bd35);}}else{_0x2cf4f2[_0x40c373]=_[_0xd105('0xd')](_0x21bd35)?_0x21bd35:JSON['parse'](_0x21bd35);}}catch(_0x2cc09f){_0x2cf4f2[_0x40c373]=_0x21bd35[_0xd105('0xe')](',');}});}return _0x2cf4f2;};exports[_0xd105('0xf')]=function(_0x515b24){_0x515b24=parseInt(_0x515b24,0xa);if(!_0x515b24||_0x515b24<0x0){_0x515b24=LIMIT_VALUE;}return _0x515b24;};exports[_0xd105('0x10')]=function(_0x5003d5){_0x5003d5=parseInt(_0x5003d5,0xa);if(!_0x5003d5||_0x5003d5<0x0){_0x5003d5=0x0;}return _0x5003d5;};exports[_0xd105('0x11')]=function(_0xa14d50){var _0x3e573c,_0x343b6e=null;if(_0xa14d50){_0x3e573c=_0xa14d50['split'](',');_0x343b6e=_['map'](_0x3e573c,function(_0x24b435){if(_0x24b435[_0xd105('0x12')]('-')===0x0){return[_0x24b435==='priority'?sequelize[_0xd105('0x13')](sequelize[_0xd105('0x14')](_0xd105('0x15')),_0xd105('0x16')):_0x24b435[_0xd105('0x17')](0x1),'DESC'];}else{return[_0x24b435===_0xd105('0x15')?sequelize[_0xd105('0x13')](sequelize[_0xd105('0x14')]('priority'),_0xd105('0x16')):_0x24b435,_0xd105('0x18')];}});}return _0x343b6e;};exports['omit']=function(_0x121670,_0xd0d0f5){if(_[_0xd105('0x2')](_0x121670)){return _0x121670;}if(_[_0xd105('0xd')](_0x121670)){for(var _0x44ef9d=0x0;_0x44ef9d<_0x121670['length'];_0x44ef9d+=0x1){_0x121670[_0x44ef9d]=this[_0xd105('0x19')](_0x121670[_0x44ef9d],_0xd0d0f5);}return _0x121670;}if(!_[_0xd105('0x1a')](_0x121670)){return _0x121670;}if(_[_0xd105('0x1b')](_0xd0d0f5)){_0xd0d0f5=[_0xd0d0f5];}if(!_[_0xd105('0xd')](_0xd0d0f5)){return _0x121670;}for(var _0x288889=0x0;_0x288889<_0xd0d0f5['length'];_0x288889+=0x1){_[_0xd105('0x1c')](_0x121670,_0xd0d0f5[_0x288889]);}for(var _0x1da8c8 in _0x121670){if(_0x121670['hasOwnProperty'](_0x1da8c8)){_0x121670[_0x1da8c8]=this[_0xd105('0x19')](_0x121670[_0x1da8c8],_0xd0d0f5);}}return _0x121670;};exports['isNumeric']=function(_0x56f277){return _0x56f277['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x163e9d){return _0x163e9d['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x2bb012){var _0x4f0add=[];_0x2bb012[_0xd105('0xe')](/[ ,]+/)[_0xd105('0x1d')](function(_0x5957fe){_0x5957fe=_0x5957fe['replace'](/([^:]")"+/g,'$1');_0x5957fe='+'+_0x5957fe+'*';if(_0x5957fe[_0xd105('0x1e')]('@'))_0x5957fe='\x22'+_0x5957fe+'\x22';_0x4f0add[_0xd105('0x1f')](_0x5957fe);});return _0x4f0add[_0xd105('0x20')]('\x20');}; \ No newline at end of file +var _0xb6bf=['sequelize','fields','split','filters','forOwn','find','type','DATE','parse','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','isEmail','match','getFullTextValue','forEach','replace','includes','push','join'];(function(_0x2cd061,_0x3fde39){var _0xee1f5f=function(_0x553c16){while(--_0x553c16){_0x2cd061['push'](_0x2cd061['shift']());}};_0xee1f5f(++_0x3fde39);}(_0xb6bf,0x168));var _0xfb6b=function(_0x3c56d2,_0x10cb12){_0x3c56d2=_0x3c56d2-0x0;var _0xd4397d=_0xb6bf[_0x3c56d2];return _0xd4397d;};'use strict';var _=require('lodash');var sequelize=require(_0xfb6b('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0xfb6b('0x1')]=function(_0x491ad3){var _0x11e1a8=null;if(_0x491ad3){_0x11e1a8=_0x491ad3[_0xfb6b('0x2')](',');}return _0x11e1a8;};exports[_0xfb6b('0x3')]=function(_0x5a743f,_0x323368){var _0x4a8481={};if(!_['isEmpty'](_0x5a743f)){_[_0xfb6b('0x4')](_0x5a743f,function(_0x2902f1,_0x2e2369){try{if(_0x323368){var _0x3af88e=_[_0xfb6b('0x5')](_0x323368,{'name':_0x2e2369})||{};if(_0x3af88e[_0xfb6b('0x6')]===_0xfb6b('0x7')&&_['isPlainObject'](_0x2902f1)){var _0x1832c4=JSON[_0xfb6b('0x8')](_0x2902f1);var _0x204b56={'$gte':moment(moment(_0x1832c4['$gte'])[_0xfb6b('0x9')](_0xfb6b('0xa')))[_0xfb6b('0xb')]()[_0xfb6b('0x9')](),'$lte':moment(moment(_0x1832c4[_0xfb6b('0xc')])[_0xfb6b('0x9')](_0xfb6b('0xa')))[_0xfb6b('0xb')]()[_0xfb6b('0xd')](0x1,'s')['format']()};_0x4a8481[_0x2e2369]=_0x204b56;}else if(_0x3af88e[_0xfb6b('0xe')]===_0xfb6b('0xf')){_0x4a8481[_0x2e2369]=_0x2902f1;}else{_0x4a8481[_0x2e2369]=_[_0xfb6b('0x10')](_0x2902f1)?_0x2902f1:JSON[_0xfb6b('0x8')](_0x2902f1);}}else{_0x4a8481[_0x2e2369]=_[_0xfb6b('0x10')](_0x2902f1)?_0x2902f1:JSON[_0xfb6b('0x8')](_0x2902f1);}}catch(_0x2606d4){_0x4a8481[_0x2e2369]=_0x2902f1[_0xfb6b('0x2')](',');}});}return _0x4a8481;};exports[_0xfb6b('0x11')]=function(_0x58a9e7){_0x58a9e7=parseInt(_0x58a9e7,0xa);if(!_0x58a9e7||_0x58a9e7<0x0){_0x58a9e7=LIMIT_VALUE;}return _0x58a9e7;};exports['offset']=function(_0x5942c6){_0x5942c6=parseInt(_0x5942c6,0xa);if(!_0x5942c6||_0x5942c6<0x0){_0x5942c6=0x0;}return _0x5942c6;};exports['sort']=function(_0x7b0b7){var _0x56a313,_0x48a9fb=null;if(_0x7b0b7){_0x56a313=_0x7b0b7['split'](',');_0x48a9fb=_[_0xfb6b('0x12')](_0x56a313,function(_0x4eb39c){if(_0x4eb39c[_0xfb6b('0x13')]('-')===0x0){return[_0x4eb39c===_0xfb6b('0x14')?sequelize[_0xfb6b('0x15')](sequelize[_0xfb6b('0x16')](_0xfb6b('0x14')),_0xfb6b('0x17')):_0x4eb39c[_0xfb6b('0x18')](0x1),'DESC'];}else{return[_0x4eb39c==='priority'?sequelize['cast'](sequelize[_0xfb6b('0x16')](_0xfb6b('0x14')),_0xfb6b('0x17')):_0x4eb39c,_0xfb6b('0x19')];}});}return _0x48a9fb;};exports[_0xfb6b('0x1a')]=function(_0x57f221,_0x4b6098){if(_['isEmpty'](_0x57f221)){return _0x57f221;}if(_[_0xfb6b('0x10')](_0x57f221)){for(var _0x513897=0x0;_0x513897<_0x57f221[_0xfb6b('0x1b')];_0x513897+=0x1){_0x57f221[_0x513897]=this[_0xfb6b('0x1a')](_0x57f221[_0x513897],_0x4b6098);}return _0x57f221;}if(!_[_0xfb6b('0x1c')](_0x57f221)){return _0x57f221;}if(_['isString'](_0x4b6098)){_0x4b6098=[_0x4b6098];}if(!_[_0xfb6b('0x10')](_0x4b6098)){return _0x57f221;}for(var _0x2b818e=0x0;_0x2b818e<_0x4b6098['length'];_0x2b818e+=0x1){_[_0xfb6b('0x1d')](_0x57f221,_0x4b6098[_0x2b818e]);}for(var _0x3a967b in _0x57f221){if(_0x57f221[_0xfb6b('0x1e')](_0x3a967b)){_0x57f221[_0x3a967b]=this['omit'](_0x57f221[_0x3a967b],_0x4b6098);}}return _0x57f221;};exports[_0xfb6b('0x1f')]=function(_0x10646a){return _0x10646a['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xfb6b('0x20')]=function(_0x12a6b1){return _0x12a6b1[_0xfb6b('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xfb6b('0x22')]=function(_0x4de21c){var _0x28fbe0=[];_0x4de21c['split'](/[ ,]+/)[_0xfb6b('0x23')](function(_0x226852){_0x226852=_0x226852[_0xfb6b('0x24')](/([^:]")"+/g,'$1');_0x226852='+'+_0x226852+'*';if(_0x226852[_0xfb6b('0x25')]('@'))_0x226852='\x22'+_0x226852+'\x22';_0x28fbe0[_0xfb6b('0x26')](_0x226852);});return _0x28fbe0[_0xfb6b('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 19b8823..52ea668 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a17=['root','development','test','set','appPath','client','use','json\x20replacer','static','get','views','/server/views','engine','html','ejs','view\x20engine','urlencoded','express','serve-favicon','body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','env','production'];(function(_0x8b52bd,_0x4377c8){var _0x2dee1e=function(_0x405fef){while(--_0x405fef){_0x8b52bd['push'](_0x8b52bd['shift']());}};_0x2dee1e(++_0x4377c8);}(_0x5a17,0x6e));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x75a1('0x0'));var favicon=require(_0x75a1('0x1'));var bodyParser=require(_0x75a1('0x2'));var methodOverride=require(_0x75a1('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x75a1('0x4'));var path=require(_0x75a1('0x5'));var passport=require(_0x75a1('0x6'));var cors=require(_0x75a1('0x7'));var moment=require(_0x75a1('0x8'));var config=require(_0x75a1('0x9'));var db=require(_0x75a1('0xa'))['db'];exports[_0x75a1('0xb')]=function(_0x405276){var _0x45bda7=_0x405276['get'](_0x75a1('0xc'));if(_0x45bda7===_0x75a1('0xd')){_0x405276['set']('appPath',path['join'](config[_0x75a1('0xe')],'public'));}if(_0x45bda7===_0x75a1('0xf')||_0x45bda7===_0x75a1('0x10')){_0x405276[_0x75a1('0x11')](_0x75a1('0x12'),path['join'](config[_0x75a1('0xe')],_0x75a1('0x13')));_0x405276[_0x75a1('0x14')](errorHandler());}_0x405276[_0x75a1('0x11')](_0x75a1('0x15'),function(_0x56c39e,_0x5efb19){if(this[_0x56c39e]instanceof Date){_0x5efb19=this[_0x56c39e]['toISOString']()['split']('.')[0x0]+'Z';}return _0x5efb19;});_0x405276['use'](express[_0x75a1('0x16')](_0x405276[_0x75a1('0x17')](_0x75a1('0x12'))));_0x405276[_0x75a1('0x11')](_0x75a1('0x18'),config['root']+_0x75a1('0x19'));_0x405276[_0x75a1('0x1a')](_0x75a1('0x1b'),require(_0x75a1('0x1c'))['renderFile']);_0x405276[_0x75a1('0x11')](_0x75a1('0x1d'),'html');_0x405276[_0x75a1('0x14')](bodyParser[_0x75a1('0x1e')]({'limit':'50mb','extended':!![]}));_0x405276['use'](bodyParser['json']({'limit':'50mb'}));_0x405276[_0x75a1('0x14')](cors());_0x405276[_0x75a1('0x14')](methodOverride());_0x405276[_0x75a1('0x14')](cookieParser());_0x405276['use'](passport['initialize']());}; \ No newline at end of file +var _0xf6c2=['toISOString','static','views','engine','view\x20engine','html','urlencoded','50mb','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','default','get','production','set','appPath','join','root','public','development','test','client','use'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xf6c2,0x189));var _0x2f6c=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xf6c2[_0x4b2436];return _0x4f5ab2;};'use strict';var express=require(_0x2f6c('0x0'));var favicon=require(_0x2f6c('0x1'));var bodyParser=require(_0x2f6c('0x2'));var methodOverride=require(_0x2f6c('0x3'));var cookieParser=require(_0x2f6c('0x4'));var errorHandler=require(_0x2f6c('0x5'));var path=require(_0x2f6c('0x6'));var passport=require(_0x2f6c('0x7'));var cors=require(_0x2f6c('0x8'));var moment=require(_0x2f6c('0x9'));var config=require(_0x2f6c('0xa'));var db=require('../mysqldb')['db'];exports[_0x2f6c('0xb')]=function(_0x3a2b6c){var _0x528810=_0x3a2b6c[_0x2f6c('0xc')]('env');if(_0x528810===_0x2f6c('0xd')){_0x3a2b6c[_0x2f6c('0xe')](_0x2f6c('0xf'),path[_0x2f6c('0x10')](config[_0x2f6c('0x11')],_0x2f6c('0x12')));}if(_0x528810===_0x2f6c('0x13')||_0x528810===_0x2f6c('0x14')){_0x3a2b6c['set'](_0x2f6c('0xf'),path['join'](config[_0x2f6c('0x11')],_0x2f6c('0x15')));_0x3a2b6c[_0x2f6c('0x16')](errorHandler());}_0x3a2b6c[_0x2f6c('0xe')]('json\x20replacer',function(_0x2046e3,_0x14c68b){if(this[_0x2046e3]instanceof Date){_0x14c68b=this[_0x2046e3][_0x2f6c('0x17')]()['split']('.')[0x0]+'Z';}return _0x14c68b;});_0x3a2b6c['use'](express[_0x2f6c('0x18')](_0x3a2b6c[_0x2f6c('0xc')](_0x2f6c('0xf'))));_0x3a2b6c[_0x2f6c('0xe')](_0x2f6c('0x19'),config[_0x2f6c('0x11')]+'/server/views');_0x3a2b6c[_0x2f6c('0x1a')]('html',require('ejs')['renderFile']);_0x3a2b6c['set'](_0x2f6c('0x1b'),_0x2f6c('0x1c'));_0x3a2b6c[_0x2f6c('0x16')](bodyParser[_0x2f6c('0x1d')]({'limit':_0x2f6c('0x1e'),'extended':!![]}));_0x3a2b6c['use'](bodyParser['json']({'limit':_0x2f6c('0x1e')}));_0x3a2b6c[_0x2f6c('0x16')](cors());_0x3a2b6c[_0x2f6c('0x16')](methodOverride());_0x3a2b6c[_0x2f6c('0x16')](cookieParser());_0x3a2b6c['use'](passport[_0x2f6c('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a096115..a426ea8 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 _0xeca7=['lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','filter','IPv4','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','macAddress','ipAddress','substring'];(function(_0x1d6e8b,_0x1c1676){var _0x5f2977=function(_0xbf2d98){while(--_0xbf2d98){_0x1d6e8b['push'](_0x1d6e8b['shift']());}};_0x5f2977(++_0x1c1676);}(_0xeca7,0xba));var _0x7eca=function(_0xbd4254,_0x31c08b){_0xbd4254=_0xbd4254-0x0;var _0x46c0f3=_0xeca7[_0xbd4254];return _0x46c0f3;};'use strict';var _=require(_0x7eca('0x0'));var os=require('os');var crypto=require(_0x7eca('0x1'));var machine=require(_0x7eca('0x2'));var exec=require('child_process')[_0x7eca('0x3')];var config=require(_0x7eca('0x4'));function getInterfaces(){var _0x5a033f=[];var _0x2b5721=os[_0x7eca('0x5')]();var _0x519867=_[_0x7eca('0x6')](_[_0x7eca('0x7')](_0x2b5721));for(var _0x35b9cb=0x0;_0x35b9cb<_0x519867['length'];_0x35b9cb++){var _0x1c0553=_0x2b5721[_0x519867[_0x35b9cb]][_0x7eca('0x8')](function(_0x61f0f3){return _0x61f0f3['family']===_0x7eca('0x9')&&_0x61f0f3['internal']===![];});_0x5a033f=_0x5a033f['concat'](_0x1c0553);}return _0x5a033f;}function getFirstInterface(){var _0x1e3ff2=_['head'](getInterfaces());return{'macAddress':_0x1e3ff2&&_0x1e3ff2[_0x7eca('0xa')]?_0x1e3ff2['mac']:_0x7eca('0xb'),'ipAddress':_0x1e3ff2&&_0x1e3ff2['address']?_0x1e3ff2['address']:_0x7eca('0xc')};}exports[_0x7eca('0xd')]=getFirstInterface;function getCPUhash(){var _0x19221f=_['orderBy'](os[_0x7eca('0xe')]()[_0x7eca('0xf')](function(_0x4ec732){return _0x4ec732['model'];}))[_0x7eca('0x10')](':');return crypto[_0x7eca('0x11')](_0x7eca('0x12'))[_0x7eca('0x13')](_0x19221f)[_0x7eca('0x14')](_0x7eca('0x15'));}exports[_0x7eca('0x16')]=function(){var _0x567122=os[_0x7eca('0x17')]();var _0x7d640e=/[0-9a-f-]{36}/;if(config[_0x7eca('0x18')]&&_0x7d640e[_0x7eca('0x19')](config[_0x7eca('0x18')])){return config[_0x7eca('0x18')];}else if(_0x567122===_0x7eca('0x1a')){return exec(_0x7eca('0x1b'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0xc91f60=getFirstInterface();var _0xbec2b8=getCPUhash();var _0x499e44=_0xbec2b8+'|'+os['hostname']()+'|'+_0xc91f60[_0x7eca('0x1c')]+'|'+_0xc91f60[_0x7eca('0x1d')];var _0x242dad=crypto['createHash'](_0x7eca('0x12'))[_0x7eca('0x13')](_0x499e44)['digest'](_0x7eca('0x15'));return _0x242dad[_0x7eca('0x1e')](0x0,0x8)+'-'+_0x242dad['substring'](0x8,0xc)+'-'+_0x242dad[_0x7eca('0x1e')](0xc,0x10)+'-'+_0x242dad[_0x7eca('0x1e')](0x10,0x14)+'-'+_0x242dad[_0x7eca('0x1e')](0x14);}}; \ No newline at end of file +var _0xda3f=['lodash','child_process','execSync','../environment','orderBy','filter','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','md5','update','substring'];(function(_0x433778,_0xf42c22){var _0x2f530f=function(_0x340373){while(--_0x340373){_0x433778['push'](_0x433778['shift']());}};_0x2f530f(++_0xf42c22);}(_0xda3f,0x120));var _0xfda3=function(_0x227789,_0x510fcd){_0x227789=_0x227789-0x0;var _0x4b6b8b=_0xda3f[_0x227789];return _0x4b6b8b;};'use strict';var _=require(_0xfda3('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0xfda3('0x1'))[_0xfda3('0x2')];var config=require(_0xfda3('0x3'));function getInterfaces(){var _0x7bbd4a=[];var _0x33822e=os['networkInterfaces']();var _0x379d5c=_[_0xfda3('0x4')](_['keys'](_0x33822e));for(var _0x3462b5=0x0;_0x3462b5<_0x379d5c['length'];_0x3462b5++){var _0x1d5510=_0x33822e[_0x379d5c[_0x3462b5]][_0xfda3('0x5')](function(_0x5900c3){return _0x5900c3['family']==='IPv4'&&_0x5900c3['internal']===![];});_0x7bbd4a=_0x7bbd4a[_0xfda3('0x6')](_0x1d5510);}return _0x7bbd4a;}function getFirstInterface(){var _0x506d0c=_[_0xfda3('0x7')](getInterfaces());return{'macAddress':_0x506d0c&&_0x506d0c[_0xfda3('0x8')]?_0x506d0c['mac']:_0xfda3('0x9'),'ipAddress':_0x506d0c&&_0x506d0c[_0xfda3('0xa')]?_0x506d0c['address']:_0xfda3('0xb')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x2036a2=_[_0xfda3('0x4')](os[_0xfda3('0xc')]()[_0xfda3('0xd')](function(_0x353c35){return _0x353c35[_0xfda3('0xe')];}))[_0xfda3('0xf')](':');return crypto['createHash']('md5')['update'](_0x2036a2)[_0xfda3('0x10')]('hex');}exports[_0xfda3('0x11')]=function(){var _0xba3ca=os[_0xfda3('0x12')]();var _0x56f6c2=/[0-9a-f-]{36}/;if(config[_0xfda3('0x13')]&&_0x56f6c2[_0xfda3('0x14')](config[_0xfda3('0x13')])){return config[_0xfda3('0x13')];}else if(_0xba3ca===_0xfda3('0x15')){return exec(_0xfda3('0x16'),{'encoding':_0xfda3('0x17')})[_0xfda3('0x18')]('\x0d\x0a','');}else{var _0x147145=getFirstInterface();var _0x5a0a68=getCPUhash();var _0x565cf9=_0x5a0a68+'|'+os[_0xfda3('0x19')]()+'|'+_0x147145[_0xfda3('0x1a')]+'|'+_0x147145[_0xfda3('0x1b')];var _0x24ea9c=crypto[_0xfda3('0x1c')](_0xfda3('0x1d'))[_0xfda3('0x1e')](_0x565cf9)[_0xfda3('0x10')]('hex');return _0x24ea9c[_0xfda3('0x1f')](0x0,0x8)+'-'+_0x24ea9c[_0xfda3('0x1f')](0x8,0xc)+'-'+_0x24ea9c[_0xfda3('0x1f')](0xc,0x10)+'-'+_0x24ea9c[_0xfda3('0x1f')](0x10,0x14)+'-'+_0x24ea9c[_0xfda3('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index e655746..b262b37 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 _0x7720=['DEMO\x20START\x20AT\x20%s','catch','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','moment','request-promise','pkginfo','../../components/encryptor','../logger','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','then','get','data1','data2','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','diff','days'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0x7720,0x190));var _0x0772=function(_0x335764,_0x3b52ed){_0x335764=_0x335764-0x0;var _0x3ce137=_0x7720[_0x335764];return _0x3ce137;};'use strict';var util=require(_0x0772('0x0'));var moment=require(_0x0772('0x1'));var rp=require(_0x0772('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x0772('0x3'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x0772('0x4'));var hardware=require('./hardware');var logger=require(_0x0772('0x5'))('license');var HOST=_0x0772('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5100e2){return new BPromise(function(_0x10f4ba,_0x228374){var _0x138871=util[_0x0772('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0x5100e2,module[_0x0772('0x8')]['version']);if(oldToken){_0x138871=util[_0x0772('0x7')](_0x0772('0x9'),HOST,_0x5100e2,module[_0x0772('0x8')][_0x0772('0xa')],oldToken);}var _0x246eca={'uri':_0x138871,'method':_0x0772('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x246eca)[_0x0772('0xc')](function(_0x103832){_0x10f4ba(_0x103832);})['catch'](function(_0x115575){_0x228374(_0x115575);});});}function manageLicense(_0x24f2c4,_0x424f3b){var _0x5b49c9=_0x424f3b[_0x0772('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x5b49c9[_0x0772('0xe')]!==_0x24f2c4&&!_0x5b49c9[_0x0772('0xf')]){oldToken=_0x5b49c9[_0x0772('0xe')];}httpRequest(_0x24f2c4)[_0x0772('0xc')](function(_0x2caad3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2caad3['active']){isOldTokenSent=![];if(!_0x5b49c9[_0x0772('0x10')]&&_0x5b49c9['license']!=_0x2caad3[_0x0772('0x10')]||_0x5b49c9['license']&&_0x5b49c9[_0x0772('0xf')]){logger[_0x0772('0x11')](_0x0772('0x12'));}if(_0x5b49c9[_0x0772('0x10')]&&!_0x5b49c9[_0x0772('0xf')]&&_0x5b49c9[_0x0772('0x10')]!=_0x2caad3[_0x0772('0x10')]){logger[_0x0772('0x11')](_0x0772('0x13'));}if(_0x5b49c9[_0x0772('0x10')]&&!_0x5b49c9['data2']&&_0x5b49c9['license']==_0x2caad3['license']){return _0x424f3b;}return _0x424f3b['update']({'data1':_0x24f2c4,'data2':null,'license':_0x2caad3[_0x0772('0x10')]});}else{if(_0x2caad3[_0x0772('0x10')]||_0x5b49c9[_0x0772('0x10')]){if(!_0x5b49c9[_0x0772('0xf')]){if(_0x5b49c9[_0x0772('0xe')]==_0x24f2c4){GRAY_PERIOD_REASON='Disabled';logger[_0x0772('0x11')](_0x0772('0x14'));}else{GRAY_PERIOD_REASON=_0x0772('0x15');logger[_0x0772('0x11')](_0x0772('0x16'),_0x5b49c9['data1'],_0x24f2c4);}logger[_0x0772('0x11')](_0x0772('0x17'),GRAY_PERIOD_REASON[_0x0772('0x18')](),moment()[_0x0772('0x7')](_0x0772('0x19')));return _0x424f3b[_0x0772('0x1a')]({'data2':encryptor['encryptString'](moment()[_0x0772('0x7')](_0x0772('0x19')))});}else{if(moment()[_0x0772('0x1b')](encryptor['decryptString'](_0x5b49c9[_0x0772('0xf')]),_0x0772('0x1c'))>DAYS){logger[_0x0772('0x11')](_0x0772('0x1d'),moment()['format'](_0x0772('0x19')));isOldTokenSent=![];return _0x424f3b[_0x0772('0x1a')]({'data1':_0x24f2c4,'data2':null,'license':null});}}}else{if(_0x5b49c9[_0x0772('0xe')]!=_0x24f2c4){logger[_0x0772('0x11')](_0x0772('0x16'),_0x5b49c9['data1'],_0x24f2c4);return _0x424f3b['update']({'data1':_0x24f2c4,'data2':null,'license':null});}}}return _0x424f3b;})[_0x0772('0xc')](function(_0x157645){_0x424f3b=_0x157645;})[_0x0772('0x1e')](function(_0x131a9f){logger['error'](_0x131a9f['message']);})[_0x0772('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x0772('0x20')](),_0x424f3b);},TIME);});}function defaultLicense(){var _0x2d8ddc=hardware[_0x0772('0x20')]();if(_0x2d8ddc){return db['License'][_0x0772('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x2d8ddc}})[_0x0772('0x22')](function(_0x522f00,_0x134003){logger[_0x0772('0x11')](_0x0772('0x23'),_0x2d8ddc);manageLicense(_0x2d8ddc,_0x522f00);})['catch'](function(_0x4b29a7){logger[_0x0772('0x24')](_0x4b29a7[_0x0772('0x25')]);});}}exports[_0x0772('0x26')]=defaultLicense; \ No newline at end of file +var _0x9809=['data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','catch','message','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','request-promise','bluebird','version','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update'];(function(_0x20ed91,_0x2cae58){var _0x27bc21=function(_0x4f7450){while(--_0x4f7450){_0x20ed91['push'](_0x20ed91['shift']());}};_0x27bc21(++_0x2cae58);}(_0x9809,0x156));var _0x9980=function(_0x54bc81,_0x140c59){_0x54bc81=_0x54bc81-0x0;var _0x4155d5=_0x9809[_0x54bc81];return _0x4155d5;};'use strict';var util=require(_0x9980('0x0'));var moment=require('moment');var rp=require(_0x9980('0x1'));var BPromise=require(_0x9980('0x2'));var pkginfo=require('pkginfo')(module,_0x9980('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x9980('0x4'));var hardware=require('./hardware');var logger=require(_0x9980('0x5'))(_0x9980('0x6'));var HOST=_0x9980('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x54dd93){return new BPromise(function(_0x4e11cb,_0x57a643){var _0x3fa809=util[_0x9980('0x8')](_0x9980('0x9'),HOST,_0x54dd93,module['exports']['version']);if(oldToken){_0x3fa809=util[_0x9980('0x8')](_0x9980('0xa'),HOST,_0x54dd93,module[_0x9980('0xb')][_0x9980('0x3')],oldToken);}var _0x5caa5d={'uri':_0x3fa809,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x5caa5d)['then'](function(_0x285919){_0x4e11cb(_0x285919);})['catch'](function(_0x328e94){_0x57a643(_0x328e94);});});}function manageLicense(_0x2a0a57,_0x22ec51){var _0x3586bd=_0x22ec51['get']({'plain':!![]});if(!isOldTokenSent&&_0x3586bd['data1']!==_0x2a0a57&&!_0x3586bd[_0x9980('0xc')]){oldToken=_0x3586bd['data1'];}httpRequest(_0x2a0a57)[_0x9980('0xd')](function(_0x260a14){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x260a14[_0x9980('0xe')]){isOldTokenSent=![];if(!_0x3586bd[_0x9980('0x6')]&&_0x3586bd[_0x9980('0x6')]!=_0x260a14[_0x9980('0x6')]||_0x3586bd[_0x9980('0x6')]&&_0x3586bd['data2']){logger[_0x9980('0xf')](_0x9980('0x10'));}if(_0x3586bd[_0x9980('0x6')]&&!_0x3586bd[_0x9980('0xc')]&&_0x3586bd[_0x9980('0x6')]!=_0x260a14[_0x9980('0x6')]){logger[_0x9980('0xf')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3586bd[_0x9980('0x6')]&&!_0x3586bd[_0x9980('0xc')]&&_0x3586bd[_0x9980('0x6')]==_0x260a14[_0x9980('0x6')]){return _0x22ec51;}return _0x22ec51[_0x9980('0x11')]({'data1':_0x2a0a57,'data2':null,'license':_0x260a14[_0x9980('0x6')]});}else{if(_0x260a14['license']||_0x3586bd[_0x9980('0x6')]){if(!_0x3586bd[_0x9980('0xc')]){if(_0x3586bd[_0x9980('0x12')]==_0x2a0a57){GRAY_PERIOD_REASON='Disabled';logger[_0x9980('0xf')](_0x9980('0x13'));}else{GRAY_PERIOD_REASON=_0x9980('0x14');logger['info'](_0x9980('0x15'),_0x3586bd[_0x9980('0x12')],_0x2a0a57);}logger[_0x9980('0xf')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x9980('0x16')](),moment()['format'](_0x9980('0x17')));return _0x22ec51['update']({'data2':encryptor[_0x9980('0x18')](moment()[_0x9980('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x9980('0x19')](encryptor[_0x9980('0x1a')](_0x3586bd[_0x9980('0xc')]),'days')>DAYS){logger['info'](_0x9980('0x1b'),moment()[_0x9980('0x8')](_0x9980('0x17')));isOldTokenSent=![];return _0x22ec51['update']({'data1':_0x2a0a57,'data2':null,'license':null});}}}else{if(_0x3586bd[_0x9980('0x12')]!=_0x2a0a57){logger[_0x9980('0xf')](_0x9980('0x15'),_0x3586bd['data1'],_0x2a0a57);return _0x22ec51[_0x9980('0x11')]({'data1':_0x2a0a57,'data2':null,'license':null});}}}return _0x22ec51;})[_0x9980('0xd')](function(_0x2986a5){_0x22ec51=_0x2986a5;})[_0x9980('0x1c')](function(_0x1444ba){logger['error'](_0x1444ba[_0x9980('0x1d')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x9980('0x1e')](),_0x22ec51);},TIME);});}function defaultLicense(){var _0x294e45=hardware[_0x9980('0x1e')]();if(_0x294e45){return db[_0x9980('0x1f')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x294e45}})[_0x9980('0x20')](function(_0x12e9fe,_0x58b993){logger['info'](_0x9980('0x21'),_0x294e45);manageLicense(_0x294e45,_0x12e9fe);})['catch'](function(_0x3deff7){logger[_0x9980('0x22')](_0x3deff7['message']);});}}exports[_0x9980('0x23')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 89e251b..061c22e 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 _0x2c1e=['count','catch','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','%s:%s:%s','parse','demo','machineUuid','deadline','days','changed','disabled','message','findAll','sequelize','COUNT','col','role','admin','telephone','users','telephones','forEach','user'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0x2c1e,0x165));var _0xe2c1=function(_0x3899a3,_0xcb527){_0x3899a3=_0x3899a3-0x0;var _0x13e1ce=_0x2c1e[_0x3899a3];return _0x13e1ce;};'use strict';var util=require(_0xe2c1('0x0'));var _=require('lodash');var moment=require(_0xe2c1('0x1'));var BPromise=require(_0xe2c1('0x2'));var hardware=require(_0xe2c1('0x3'));var encryptor=require(_0xe2c1('0x4'));var db=require(_0xe2c1('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe2c1('0x6'),'machineUuid':hardware[_0xe2c1('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe2c1('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xe2c1('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x31ad33){return new BPromise(function(_0x579048,_0x58e2e8){return db['License'][_0xe2c1('0x9')](_[_0xe2c1('0xa')](_0x31ad33,{'raw':!![],'where':{'id':0x1}}))[_0xe2c1('0xb')](function(_0x55f8ae){return checkLicense(_0x55f8ae,null);})[_0xe2c1('0xb')](function(_0x59f722){_0x579048(_0x59f722);return;})['catch'](function(_0x1f875f){_0x58e2e8(_0x1f875f);});});}function checkLicense(_0x1e1648,_0x4ba45e){if(!_0x1e1648){demoLicense[_0xe2c1('0xc')]=_0x1e1648[_0xe2c1('0xd')];return demoLicense;}try{var _0x5c9311=_0x4ba45e||_0x1e1648[_0xe2c1('0xe')];if(_[_0xe2c1('0xf')](_0x5c9311)){throw new Error(_0xe2c1('0x10'));}var _0x3a7c5d=_0x1e1648[_0xe2c1('0xd')];var _0x2493d5=_0x1e1648['data2'];var _0x368d0e=_0x3a7c5d[_0xe2c1('0x11')]('-')[0x4];var _0x3e764c=_0x3a7c5d[_0xe2c1('0x11')]('-')[0x0];var _0x558e9c=encryptor[_0xe2c1('0x12')](_0x5c9311,util['format'](_0xe2c1('0x13'),_0x368d0e,_0x3a7c5d,_0x3e764c));var _0x437bf8=JSON[_0xe2c1('0x14')](_0x558e9c);_0x437bf8[_0xe2c1('0x15')]=![];_0x437bf8[_0xe2c1('0xc')]=_0x3a7c5d;_0x437bf8[_0xe2c1('0x16')]=hardware['getUuid']();if(_0x2493d5){var _0x175af9=encryptor[_0xe2c1('0x12')](_0x2493d5);_0x437bf8['gray']=_0x175af9;_0x437bf8[_0xe2c1('0x17')]=moment(_0x175af9)['add'](0x7,_0xe2c1('0x18'))['format']();_0x437bf8['grayReason']=_0x437bf8['uuid']!=_0x437bf8[_0xe2c1('0x16')]?_0xe2c1('0x19'):_0xe2c1('0x1a');}return _0x437bf8;}catch(_0x1b15d8){breakingLicense[_0xe2c1('0xc')]=_0x1e1648[_0xe2c1('0xd')];breakingLicense['message']=_0x1b15d8[_0xe2c1('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2c602f,_0x48da6a){getLicense()[_0xe2c1('0xb')](function(_0x54d824){return db['User'][_0xe2c1('0x1c')]({'attributes':['role',[db[_0xe2c1('0x1d')]['fn'](_0xe2c1('0x1e'),db[_0xe2c1('0x1d')][_0xe2c1('0x1f')](_0xe2c1('0x20'))),'count']],'group':_0xe2c1('0x20'),'where':{'role':{'$or':[_0xe2c1('0x21'),'user',_0xe2c1('0x22')]}},'raw':!![]})[_0xe2c1('0xb')](function(_0x11f5cf){var _0x5368db={'user':_0x54d824[_0xe2c1('0x23')]||0x0,'telephone':_0x54d824[_0xe2c1('0x24')]||0x0};_0x11f5cf[_0xe2c1('0x25')](function(_0x1a38c8){var _0x11db67=_0x1a38c8[_0xe2c1('0x20')]===_0xe2c1('0x21')?_0xe2c1('0x26'):_0x1a38c8['role'];_0x5368db[_0x11db67]-=_0x1a38c8[_0xe2c1('0x27')];if(_0x5368db[_0x11db67]<0x0)_0x5368db[_0x11db67]=0x0;});_0x2c602f(_0x5368db);return;});})[_0xe2c1('0x28')](function(_0x2b0db3){_0x48da6a(_0x2b0db3);});});}function checkUserLimits(_0x5ca802){return new BPromise(function(_0x3be9cb,_0x316dc3){getLimits()['then'](function(_0x2934c9){var _0xc0f244=_[_0xe2c1('0x29')](_[_0xe2c1('0x2a')](_0x5ca802,'role'),[_0xe2c1('0x21'),_0xe2c1('0x26'),_0xe2c1('0x22')]);var _0x1c3a18=(_0xc0f244[_0xe2c1('0x21')]||0x0)+(_0xc0f244[_0xe2c1('0x26')]||0x0);var _0x6b9206=_0xc0f244[_0xe2c1('0x22')]||0x0;if(_0x1c3a18>_0x2934c9['user'])return _0x316dc3('License\x20limit\x20reached\x20for\x20users');if(_0x6b9206>_0x2934c9[_0xe2c1('0x22')])return _0x316dc3(_0xe2c1('0x2b'));return _0x3be9cb();})[_0xe2c1('0x28')](function(_0x192686){_0x316dc3(_0x192686);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xc933=['forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','decryptString','%s:%s:%s','parse','demo','gray','deadline','add','days','changed','disabled','message','role','sequelize','COUNT','col','admin','user','telephone','users'];(function(_0x1c09a5,_0x38c0e6){var _0x53bc8d=function(_0x14c113){while(--_0x14c113){_0x1c09a5['push'](_0x1c09a5['shift']());}};_0x53bc8d(++_0x38c0e6);}(_0xc933,0x189));var _0x3c93=function(_0x2bddca,_0x28c4b6){_0x2bddca=_0x2bddca-0x0;var _0x4a0d36=_0xc933[_0x2bddca];return _0x4a0d36;};'use strict';var util=require(_0x3c93('0x0'));var _=require('lodash');var moment=require(_0x3c93('0x1'));var BPromise=require(_0x3c93('0x2'));var hardware=require('./hardware');var encryptor=require(_0x3c93('0x3'));var db=require(_0x3c93('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3c93('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3c93('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3c93('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3c93('0x7'),'machineUuid':hardware[_0x3c93('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3d686f){return new BPromise(function(_0x2afa39,_0x50cb09){return db['License']['find'](_[_0x3c93('0x9')](_0x3d686f,{'raw':!![],'where':{'id':0x1}}))[_0x3c93('0xa')](function(_0x522e9a){return checkLicense(_0x522e9a,null);})[_0x3c93('0xa')](function(_0x3896d9){_0x2afa39(_0x3896d9);return;})[_0x3c93('0xb')](function(_0x4698fb){_0x50cb09(_0x4698fb);});});}function checkLicense(_0x368c98,_0x52cc27){if(!_0x368c98){demoLicense[_0x3c93('0xc')]=_0x368c98['data1'];return demoLicense;}try{var _0x19b019=_0x52cc27||_0x368c98[_0x3c93('0xd')];if(_[_0x3c93('0xe')](_0x19b019)){throw new Error(_0x3c93('0xf'));}var _0x529c06=_0x368c98[_0x3c93('0x10')];var _0x867d7d=_0x368c98['data2'];var _0x5d197f=_0x529c06[_0x3c93('0x11')]('-')[0x4];var _0x404692=_0x529c06[_0x3c93('0x11')]('-')[0x0];var _0x809b56=encryptor[_0x3c93('0x12')](_0x19b019,util['format'](_0x3c93('0x13'),_0x5d197f,_0x529c06,_0x404692));var _0x4dfbe0=JSON[_0x3c93('0x14')](_0x809b56);_0x4dfbe0[_0x3c93('0x15')]=![];_0x4dfbe0[_0x3c93('0xc')]=_0x529c06;_0x4dfbe0['machineUuid']=hardware[_0x3c93('0x8')]();if(_0x867d7d){var _0x41a8ff=encryptor[_0x3c93('0x12')](_0x867d7d);_0x4dfbe0[_0x3c93('0x16')]=_0x41a8ff;_0x4dfbe0[_0x3c93('0x17')]=moment(_0x41a8ff)[_0x3c93('0x18')](0x7,_0x3c93('0x19'))['format']();_0x4dfbe0['grayReason']=_0x4dfbe0[_0x3c93('0xc')]!=_0x4dfbe0['machineUuid']?_0x3c93('0x1a'):_0x3c93('0x1b');}return _0x4dfbe0;}catch(_0x21d11e){breakingLicense[_0x3c93('0xc')]=_0x368c98[_0x3c93('0x10')];breakingLicense[_0x3c93('0x1c')]=_0x21d11e[_0x3c93('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xf67780,_0x43fd9c){getLicense()[_0x3c93('0xa')](function(_0x212359){return db['User']['findAll']({'attributes':[_0x3c93('0x1d'),[db[_0x3c93('0x1e')]['fn'](_0x3c93('0x1f'),db[_0x3c93('0x1e')][_0x3c93('0x20')]('role')),'count']],'group':_0x3c93('0x1d'),'where':{'role':{'$or':[_0x3c93('0x21'),_0x3c93('0x22'),_0x3c93('0x23')]}},'raw':!![]})['then'](function(_0x22dd1f){var _0x52b63a={'user':_0x212359[_0x3c93('0x24')]||0x0,'telephone':_0x212359['telephones']||0x0};_0x22dd1f[_0x3c93('0x25')](function(_0x2d6a01){var _0xc1ec=_0x2d6a01[_0x3c93('0x1d')]===_0x3c93('0x21')?'user':_0x2d6a01[_0x3c93('0x1d')];_0x52b63a[_0xc1ec]-=_0x2d6a01[_0x3c93('0x26')];if(_0x52b63a[_0xc1ec]<0x0)_0x52b63a[_0xc1ec]=0x0;});_0xf67780(_0x52b63a);return;});})[_0x3c93('0xb')](function(_0x3ecb41){_0x43fd9c(_0x3ecb41);});});}function checkUserLimits(_0x252773){return new BPromise(function(_0x5cb8b6,_0x46ed3c){getLimits()[_0x3c93('0xa')](function(_0x3a97ce){var _0x67b77b=_[_0x3c93('0x27')](_[_0x3c93('0x28')](_0x252773,'role'),[_0x3c93('0x21'),_0x3c93('0x22'),_0x3c93('0x23')]);var _0xc8c4af=(_0x67b77b[_0x3c93('0x21')]||0x0)+(_0x67b77b[_0x3c93('0x22')]||0x0);var _0x19404b=_0x67b77b[_0x3c93('0x23')]||0x0;if(_0xc8c4af>_0x3a97ce[_0x3c93('0x22')])return _0x46ed3c('License\x20limit\x20reached\x20for\x20users');if(_0x19404b>_0x3a97ce[_0x3c93('0x23')])return _0x46ed3c(_0x3c93('0x29'));return _0x5cb8b6();})[_0x3c93('0xb')](function(_0x539256){_0x46ed3c(_0x539256);});});}module[_0x3c93('0x2a')]={'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 83687fe..e0f6144 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 _0xe423=['myappanuglar-secret','exports','http://localhost:9000'];(function(_0x185908,_0x437ada){var _0x592056=function(_0x1429f4){while(--_0x1429f4){_0x185908['push'](_0x185908['shift']());}};_0x592056(++_0x437ada);}(_0xe423,0xf4));var _0x3e42=function(_0x4192a6,_0x38ca0d){_0x4192a6=_0x4192a6-0x0;var _0x1b3a38=_0xe423[_0x4192a6];return _0x1b3a38;};'use strict';module[_0x3e42('0x0')]={'DOMAIN':_0x3e42('0x1'),'SESSION_SECRET':_0x3e42('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x896a=['http://localhost:9000','myappanuglar-secret','app-id','exports'];(function(_0x57004c,_0x510722){var _0x3af11b=function(_0x1594df){while(--_0x1594df){_0x57004c['push'](_0x57004c['shift']());}};_0x3af11b(++_0x510722);}(_0x896a,0x117));var _0xa896=function(_0x4971e5,_0xb8cf85){_0x4971e5=_0x4971e5-0x0;var _0x308df9=_0x896a[_0x4971e5];return _0x308df9;};'use strict';module[_0xa896('0x0')]={'DOMAIN':_0xa896('0x1'),'SESSION_SECRET':_0xa896('0x2'),'GOOGLE_ID':_0xa896('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index b932b26..5bd4ae8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb028=['level','exports','Logger','transports','%s-%s','error','File','info','Console','env','moment','winston','util','path','INFO','join','/var','log','xcally','%s-%s.log','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xb028,0x14e));var _0x8b02=function(_0x44ede8,_0x4e1b37){_0x44ede8=_0x44ede8-0x0;var _0x12fa9d=_0xb028[_0x44ede8];return _0x12fa9d;};'use strict';var moment=require(_0x8b02('0x0'));var winston=require(_0x8b02('0x1'));var util=require(_0x8b02('0x2'));var path=require(_0x8b02('0x3'));var debugLevel=_0x8b02('0x4');function filename(_0x5490eb,_0x5ebaec){return path[_0x8b02('0x5')](_0x8b02('0x6'),_0x8b02('0x7'),_0x8b02('0x8'),util['format'](_0x8b02('0x9'),_0x5490eb,_0x5ebaec));}function formatter(_0x45683f,_0x16600f){_0x16600f['message']=_0x16600f[_0x8b02('0xa')][_0x8b02('0xb')](/@@{/g,_0x8b02('0xc'))[_0x8b02('0xb')](/}@@/g,_0x8b02('0xd'))[_0x8b02('0xb')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x8b02('0xe')](_0x8b02('0xf'),moment()[_0x8b02('0xe')](_0x8b02('0x10')),_0x16600f[_0x8b02('0x11')]['toUpperCase'](),_0x45683f,_0x16600f[_0x8b02('0xa')]);}module[_0x8b02('0x12')]=function(_0x3b8431){return new winston[(_0x8b02('0x13'))]({'transports':[new winston[(_0x8b02('0x14'))]['File']({'name':util[_0x8b02('0xe')](_0x8b02('0x15'),_0x3b8431,_0x8b02('0x16')),'filename':filename(_0x3b8431,_0x8b02('0x16')),'level':_0x8b02('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x567b42){return formatter(_0x3b8431,_0x567b42);}}),new winston['transports'][(_0x8b02('0x17'))]({'name':util['format'](_0x8b02('0x15'),_0x3b8431,'info'),'filename':filename(_0x3b8431,_0x8b02('0x18')),'level':_0x8b02('0x18'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x45bd30){return formatter(_0x3b8431,_0x45bd30);}}),new winston[(_0x8b02('0x14'))][(_0x8b02('0x19'))]({'level':process[_0x8b02('0x1a')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x55fc85){return formatter(_0x3b8431,_0x55fc85);}})]});}; \ No newline at end of file +var _0x9bb1=['{{{','}}}','replace','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','moment','winston','util','/var','log','xcally','format','%s-%s.log','message'];(function(_0x2865c9,_0x4bfeb6){var _0x4cf486=function(_0x527056){while(--_0x527056){_0x2865c9['push'](_0x2865c9['shift']());}};_0x4cf486(++_0x4bfeb6);}(_0x9bb1,0xe9));var _0x19bb=function(_0x5278d3,_0x17253e){_0x5278d3=_0x5278d3-0x0;var _0x1e3c04=_0x9bb1[_0x5278d3];return _0x1e3c04;};'use strict';var moment=require(_0x19bb('0x0'));var winston=require(_0x19bb('0x1'));var util=require(_0x19bb('0x2'));var path=require('path');var debugLevel='INFO';function filename(_0x261e80,_0xdafd03){return path['join'](_0x19bb('0x3'),_0x19bb('0x4'),_0x19bb('0x5'),util[_0x19bb('0x6')](_0x19bb('0x7'),_0x261e80,_0xdafd03));}function formatter(_0x158139,_0x3ab6d4){_0x3ab6d4[_0x19bb('0x8')]=_0x3ab6d4[_0x19bb('0x8')]['replace'](/@@{/g,_0x19bb('0x9'))['replace'](/}@@/g,_0x19bb('0xa'))['replace'](/@{/g,'{{')[_0x19bb('0xb')](/}@/g,'}}');return util[_0x19bb('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x19bb('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3ab6d4[_0x19bb('0xc')][_0x19bb('0xd')](),_0x158139,_0x3ab6d4[_0x19bb('0x8')]);}module['exports']=function(_0x484b30){return new winston[(_0x19bb('0xe'))]({'transports':[new winston[(_0x19bb('0xf'))][(_0x19bb('0x10'))]({'name':util['format'](_0x19bb('0x11'),_0x484b30,_0x19bb('0x12')),'filename':filename(_0x484b30,_0x19bb('0x12')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x586e10){return formatter(_0x484b30,_0x586e10);}}),new winston[(_0x19bb('0xf'))][(_0x19bb('0x10'))]({'name':util[_0x19bb('0x6')](_0x19bb('0x11'),_0x484b30,_0x19bb('0x13')),'filename':filename(_0x484b30,_0x19bb('0x13')),'level':_0x19bb('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x247f80){return formatter(_0x484b30,_0x247f80);}}),new winston[(_0x19bb('0xf'))][(_0x19bb('0x14'))]({'level':process[_0x19bb('0x15')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x1199ca){return formatter(_0x484b30,_0x1199ca);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 053f4ef..785a029 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 _0xd846=['../../services/agi/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join'];(function(_0x562f3c,_0x20e195){var _0x529c8b=function(_0x67e9df){while(--_0x67e9df){_0x562f3c['push'](_0x562f3c['shift']());}};_0x529c8b(++_0x20e195);}(_0xd846,0x195));var _0x6d84=function(_0x14bddc,_0x163602){_0x14bddc=_0x14bddc-0x0;var _0x25e030=_0xd846[_0x14bddc];return _0x25e030;};'use strict';var path=require(_0x6d84('0x0'));var os=require('os');var config={'apps':[{'name':_0x6d84('0x1'),'script':path[_0x6d84('0x2')](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0x6d84('0x2')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x6d84('0x2')](__dirname,_0x6d84('0x3'))},{'name':'email','script':path[_0x6d84('0x2')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0x6d84('0x2')](__dirname,_0x6d84('0x4'))},{'name':_0x6d84('0x5'),'script':path[_0x6d84('0x2')](__dirname,_0x6d84('0x6'))}]};module[_0x6d84('0x7')]=config; \ No newline at end of file +var _0x6985=['express','join','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path'];(function(_0x4f1ee6,_0x3a0ac1){var _0x331ef3=function(_0x2ca0dd){while(--_0x2ca0dd){_0x4f1ee6['push'](_0x4f1ee6['shift']());}};_0x331ef3(++_0x3a0ac1);}(_0x6985,0x67));var _0x5698=function(_0x2c8de2,_0x43dd73){_0x2c8de2=_0x2c8de2-0x0;var _0x5bd005=_0x6985[_0x2c8de2];return _0x5bd005;};'use strict';var path=require(_0x5698('0x0'));var os=require('os');var config={'apps':[{'name':_0x5698('0x1'),'script':path[_0x5698('0x2')](__dirname,_0x5698('0x3'))},{'name':_0x5698('0x4'),'script':path[_0x5698('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x5698('0x5'),'script':path[_0x5698('0x2')](__dirname,_0x5698('0x6'))},{'name':_0x5698('0x7'),'script':path['join'](__dirname,_0x5698('0x8'))},{'name':_0x5698('0x9'),'script':path[_0x5698('0x2')](__dirname,_0x5698('0xa'))},{'name':_0x5698('0xb'),'script':path[_0x5698('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x5698('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index f8df847..4a305fe 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 _0x10af=['then','describe','delete','dump','saved','pm2','./config','connect','connected','start','disconnect','stop','list'];(function(_0x3b0acc,_0x2293f5){var _0x20d307=function(_0x23cbf0){while(--_0x23cbf0){_0x3b0acc['push'](_0x3b0acc['shift']());}};_0x20d307(++_0x2293f5);}(_0x10af,0xfc));var _0xf10a=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x10af[_0x263a74];return _0x2aa86c;};'use strict';var pm2=require(_0xf10a('0x0'));var BPromise=require('bluebird');var config=require(_0xf10a('0x1'));function connect(){return new BPromise(function(_0x6b2db9,_0x1e42f5){return pm2[_0xf10a('0x2')](function(_0x453e1a){if(_0x453e1a){return _0x1e42f5(_0x453e1a);}return _0x6b2db9(_0xf10a('0x3'));});});};exports[_0xf10a('0x4')]=function(_0x13b338){return connect()['then'](function(){return new BPromise(function(_0x32060a,_0xf86ea1){return pm2['start'](_0x13b338,function(_0x4cd7e4,_0x8c9add){if(_0x4cd7e4){return _0xf86ea1(_0x4cd7e4);}pm2[_0xf10a('0x5')]();return _0x32060a(_0x8c9add);});});});};exports[_0xf10a('0x6')]=function(_0x110583){return connect()['then'](function(){return new BPromise(function(_0x2045aa,_0x52502e){return pm2[_0xf10a('0x6')](_0x110583,function(_0x5e3d9b,_0x150d52){if(_0x5e3d9b){return _0x52502e(_0x5e3d9b);}pm2['disconnect']();return _0x2045aa(_0x150d52);});});});};exports['restart']=function(_0x208c5a){return connect()['then'](function(){return new BPromise(function(_0x3558c6,_0x13de1f){return pm2['restart'](_0x208c5a,function(_0x3fb6c0,_0x24632c){if(_0x3fb6c0){return _0x13de1f(_0x3fb6c0);}pm2[_0xf10a('0x5')]();return _0x3558c6(_0x24632c);});});});};exports[_0xf10a('0x7')]=function(){return connect()[_0xf10a('0x8')](function(){return new BPromise(function(_0xb96a64,_0x2a5a02){return pm2[_0xf10a('0x7')](function(_0xe03766,_0x50ba60){if(_0xe03766){return _0x2a5a02(_0xe03766);}pm2[_0xf10a('0x5')]();return _0xb96a64(_0x50ba60);});});});};exports['describe']=function(_0x5b72ad){return connect()[_0xf10a('0x8')](function(){return new BPromise(function(_0x3117cd,_0x484c3a){return pm2[_0xf10a('0x9')](_0x5b72ad,function(_0x18cb80,_0x549d50){if(_0x18cb80){return _0x484c3a(_0x18cb80);}pm2[_0xf10a('0x5')]();return _0x3117cd(_0x549d50);});});});};exports[_0xf10a('0xa')]=function(_0x6f2520){return connect()[_0xf10a('0x8')](function(){return new BPromise(function(_0x1e41e3,_0x20a858){return pm2[_0xf10a('0xa')](_0x6f2520,function(_0x27482c,_0xba875f){if(_0x27482c){return _0x20a858(_0x27482c);}pm2[_0xf10a('0x5')]();return _0x1e41e3(_0xba875f);});});});};exports[_0xf10a('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3525a2,_0x2e658e){return pm2[_0xf10a('0xb')](function(_0x4db4b0){if(_0x4db4b0){return _0x2e658e(_0x4db4b0);}return _0x3525a2(_0xf10a('0xc'));});});});}; \ No newline at end of file +var _0x0f36=['describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list'];(function(_0x34fc8d,_0xa41c7c){var _0x19e3f2=function(_0x14707c){while(--_0x14707c){_0x34fc8d['push'](_0x34fc8d['shift']());}};_0x19e3f2(++_0xa41c7c);}(_0x0f36,0x8b));var _0x60f3=function(_0x47ee00,_0x256539){_0x47ee00=_0x47ee00-0x0;var _0x3d35f9=_0x0f36[_0x47ee00];return _0x3d35f9;};'use strict';var pm2=require(_0x60f3('0x0'));var BPromise=require(_0x60f3('0x1'));var config=require(_0x60f3('0x2'));function connect(){return new BPromise(function(_0x21a66c,_0x131132){return pm2[_0x60f3('0x3')](function(_0x160cd1){if(_0x160cd1){return _0x131132(_0x160cd1);}return _0x21a66c(_0x60f3('0x4'));});});};exports[_0x60f3('0x5')]=function(_0xb6e678){return connect()[_0x60f3('0x6')](function(){return new BPromise(function(_0x137daa,_0x91491d){return pm2[_0x60f3('0x5')](_0xb6e678,function(_0xd8fc9d,_0x4b34ee){if(_0xd8fc9d){return _0x91491d(_0xd8fc9d);}pm2[_0x60f3('0x7')]();return _0x137daa(_0x4b34ee);});});});};exports[_0x60f3('0x8')]=function(_0x4ef52b){return connect()[_0x60f3('0x6')](function(){return new BPromise(function(_0x145b3,_0x3271cb){return pm2[_0x60f3('0x8')](_0x4ef52b,function(_0x462768,_0xeea1be){if(_0x462768){return _0x3271cb(_0x462768);}pm2['disconnect']();return _0x145b3(_0xeea1be);});});});};exports[_0x60f3('0x9')]=function(_0x45503b){return connect()[_0x60f3('0x6')](function(){return new BPromise(function(_0x22dc03,_0x327446){return pm2['restart'](_0x45503b,function(_0x24eb6c,_0x1d174c){if(_0x24eb6c){return _0x327446(_0x24eb6c);}pm2[_0x60f3('0x7')]();return _0x22dc03(_0x1d174c);});});});};exports[_0x60f3('0xa')]=function(){return connect()[_0x60f3('0x6')](function(){return new BPromise(function(_0x57b139,_0x499503){return pm2[_0x60f3('0xa')](function(_0x285fee,_0x3909d2){if(_0x285fee){return _0x499503(_0x285fee);}pm2['disconnect']();return _0x57b139(_0x3909d2);});});});};exports[_0x60f3('0xb')]=function(_0x5786cb){return connect()[_0x60f3('0x6')](function(){return new BPromise(function(_0x3ca686,_0x260302){return pm2[_0x60f3('0xb')](_0x5786cb,function(_0x438621,_0x1f4990){if(_0x438621){return _0x260302(_0x438621);}pm2[_0x60f3('0x7')]();return _0x3ca686(_0x1f4990);});});});};exports[_0x60f3('0xc')]=function(_0x1c2d71){return connect()[_0x60f3('0x6')](function(){return new BPromise(function(_0x1b29e1,_0x34512a){return pm2[_0x60f3('0xc')](_0x1c2d71,function(_0x3c967c,_0x561c7d){if(_0x3c967c){return _0x34512a(_0x3c967c);}pm2[_0x60f3('0x7')]();return _0x1b29e1(_0x561c7d);});});});};exports[_0x60f3('0xd')]=function(){return connect()[_0x60f3('0x6')](function(){return new BPromise(function(_0x11cb86,_0xc6edad){return pm2[_0x60f3('0xd')](function(_0x5e9213){if(_0x5e9213){return _0xc6edad(_0x5e9213);}return _0x11cb86(_0x60f3('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5c73ef9..d538dff 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 _0x6630=['moment','ioredis','../../mysqldb','redis','defaults','chatTimeout','then','ChatInteraction','findAll','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash'];(function(_0x3a0694,_0x339d53){var _0x5252ec=function(_0x62ddc9){while(--_0x62ddc9){_0x3a0694['push'](_0x3a0694['shift']());}};_0x5252ec(++_0x339d53);}(_0x6630,0x12b));var _0x0663=function(_0x19a66a,_0x976b00){_0x19a66a=_0x19a66a-0x0;var _0x4e632b=_0x6630[_0x19a66a];return _0x4e632b;};'use strict';var _=require(_0x0663('0x0'));var moment=require(_0x0663('0x1'));var Redis=require(_0x0663('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x0663('0x3'))['db'];var logger=require('../logger')('schedule');config[_0x0663('0x4')]=_[_0x0663('0x5')](config[_0x0663('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x542ae0=0x0;var _0x17337d=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x0663('0x6')],'where':{'id':0x1}})[_0x0663('0x7')](function(_0x42314c){_0x542ae0=_0x42314c[_0x0663('0x6')];if(_0x542ae0){return db[_0x0663('0x8')][_0x0663('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x42314c[_0x0663('0x6')],'minutes')}}});}else{return[];}})[_0x0663('0x7')](function(_0x493b84){if(_0x493b84&&_0x493b84['length']){_0x17337d=_[_0x0663('0xa')](_0x493b84||[],'id');logger['info'](_0x0663('0xb'),_0x17337d[_0x0663('0xc')]());return db[_0x0663('0x8')][_0x0663('0xd')]({'closeReason':_0x0663('0xe'),'disposition':_0x0663('0xf'),'closed':!![],'closedAt':moment()[_0x0663('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x17337d}});}})[_0x0663('0x7')](function(){if(_0x17337d&&_0x17337d[_0x0663('0x11')]){logger[_0x0663('0x12')](_0x0663('0x13'),_0x17337d[_0x0663('0xc')]());for(var _0x35be9a=0x0;_0x35be9a<_0x17337d[_0x0663('0x11')];_0x35be9a++){io[_0x0663('0x14')]('chatInteraction:update',{'id':_0x17337d[_0x35be9a],'closed':!![]});}}})[_0x0663('0x15')](function(_0x55fb44){logger[_0x0663('0x16')](_0x0663('0x17'),_0x55fb44?util['inspect'](_0x55fb44,{'showHidden':![],'depth':null}):'');});}exports[_0x0663('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd9b6=['YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0xd9b6,0x11d));var _0x6d9b=function(_0x26a84c,_0x5724a7){_0x26a84c=_0x26a84c-0x0;var _0xa7793f=_0xd9b6[_0x26a84c];return _0xa7793f;};'use strict';var _=require(_0x6d9b('0x0'));var moment=require(_0x6d9b('0x1'));var Redis=require(_0x6d9b('0x2'));var util=require(_0x6d9b('0x3'));var config=require(_0x6d9b('0x4'));var db=require(_0x6d9b('0x5'))['db'];var logger=require('../logger')('schedule');config[_0x6d9b('0x6')]=_[_0x6d9b('0x7')](config[_0x6d9b('0x6')],{'host':_0x6d9b('0x8'),'port':0x18eb});var io=require(_0x6d9b('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x46090b=0x0;var _0x1e610b=[];return db['Setting'][_0x6d9b('0xa')]({'raw':!![],'attributes':['id',_0x6d9b('0xb')],'where':{'id':0x1}})[_0x6d9b('0xc')](function(_0x369538){_0x46090b=_0x369538[_0x6d9b('0xb')];if(_0x46090b){return db[_0x6d9b('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x6d9b('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6d9b('0xf')](_0x369538[_0x6d9b('0xb')],_0x6d9b('0x10'))}}});}else{return[];}})[_0x6d9b('0xc')](function(_0x2ad665){if(_0x2ad665&&_0x2ad665['length']){_0x1e610b=_['map'](_0x2ad665||[],'id');logger[_0x6d9b('0x11')](_0x6d9b('0x12'),_0x1e610b[_0x6d9b('0x13')]());return db[_0x6d9b('0xd')][_0x6d9b('0x14')]({'closeReason':_0x6d9b('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x6d9b('0x16')](_0x6d9b('0x17'))},{'where':{'id':_0x1e610b}});}})[_0x6d9b('0xc')](function(){if(_0x1e610b&&_0x1e610b['length']){logger[_0x6d9b('0x11')](_0x6d9b('0x18'),_0x1e610b[_0x6d9b('0x13')]());for(var _0x2271b7=0x0;_0x2271b7<_0x1e610b['length'];_0x2271b7++){io['emit']('chatInteraction:update',{'id':_0x1e610b[_0x2271b7],'closed':!![]});}}})[_0x6d9b('0x19')](function(_0x2e86e8){logger['error'](_0x6d9b('0x1a'),_0x2e86e8?util['inspect'](_0x2e86e8,{'showHidden':![],'depth':null}):'');});}exports[_0x6d9b('0x1b')]=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 6b46928..fa54790 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 _0x5e56=['basename','extname','zip','existsSync','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','empty\x20file,\x20email\x20not\x20sent','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','my\x20id','cron','active','isBetween','endAt','add','start','add\x20cron','startAt','update','update\x20cron','stop\x20cron','run','util','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','host','port','Smtp','secure','authentication','auth','user','pass','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s'];(function(_0x39395a,_0x1edfe4){var _0x168be9=function(_0xfb5dae){while(--_0xfb5dae){_0x39395a['push'](_0x39395a['shift']());}};_0x168be9(++_0x1edfe4);}(_0x5e56,0x143));var _0x65e5=function(_0x274d70,_0x53d47b){_0x274d70=_0x274d70-0x0;var _0x1cb3b5=_0x5e56[_0x274d70];return _0x1cb3b5;};'use strict';var fs=require('fs');var util=require(_0x65e5('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x65e5('0x1'));var CronJobManager=require(_0x65e5('0x2'));var jayson=require(_0x65e5('0x3'));var BPromise=require(_0x65e5('0x4'));var logger=require('../logger')(_0x65e5('0x5'));var db=require(_0x65e5('0x6'))['db'];var analyticCustomReportController=require(_0x65e5('0x7'));var analyticDefaultReportController=require(_0x65e5('0x8'));var client=jayson['client'][_0x65e5('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3271e9,_0x1f1c3b){return function(){logger[_0x65e5('0xa')](_0x65e5('0xb'),_0x3271e9[_0x65e5('0xc')]);var _0x4897c5=!![];var _0x12c128={'tls':{'rejectUnauthorized':![]}};if(_0x3271e9['MailAccount']['Smtp']['service']){_0x12c128[_0x65e5('0xd')]=_0x3271e9[_0x65e5('0xe')]['Smtp'][_0x65e5('0xd')];}else{_0x12c128[_0x65e5('0xf')]=_0x3271e9[_0x65e5('0xe')]['Smtp'][_0x65e5('0xf')];_0x12c128[_0x65e5('0x10')]=_0x3271e9[_0x65e5('0xe')][_0x65e5('0x11')][_0x65e5('0x10')];_0x12c128['secure']=_0x3271e9[_0x65e5('0xe')]['Smtp'][_0x65e5('0x12')];}if(_0x3271e9[_0x65e5('0xe')][_0x65e5('0x11')][_0x65e5('0x13')]){_0x12c128[_0x65e5('0x14')]={'user':_0x3271e9[_0x65e5('0xe')][_0x65e5('0x11')][_0x65e5('0x15')],'pass':_0x3271e9['MailAccount'][_0x65e5('0x11')][_0x65e5('0x16')]};}var _0x4b9433={'account':_0x12c128,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x3271e9[_0x65e5('0xe')]['name'],_0x3271e9[_0x65e5('0xe')][_0x65e5('0xc')]||_0x3271e9['MailAccount']['Smtp'][_0x65e5('0x15')]),'to':_0x3271e9[_0x65e5('0xc')],'cc':_0x3271e9['cc'],'bcc':_0x3271e9[_0x65e5('0x17')],'subject':util[_0x65e5('0x18')](_0x65e5('0x19'),_0x1f1c3b[_0x65e5('0x1a')],_0x3271e9[_0x65e5('0x1b')],_0x3271e9[_0x65e5('0x1c')])}};var _0x5a22fb=path[_0x65e5('0x1d')](__dirname,_0x65e5('0x1e'));var _0x1e0f13=_0x1f1c3b[_0x65e5('0x1f')];var _0x1327cc=util[_0x65e5('0x18')](_0x65e5('0x20'),path[_0x65e5('0x21')](_0x1f1c3b[_0x65e5('0x1f')],path[_0x65e5('0x22')](_0x1f1c3b['savename'])),_0x65e5('0x23'));var _0x32abad=path['join'](_0x5a22fb,_0x1e0f13);var _0x777c0=path[_0x65e5('0x1d')](_0x5a22fb,_0x1327cc);if(fs[_0x65e5('0x24')](_0x32abad)){_0x1f1c3b['status']='Sent';_0x4b9433['message'][_0x65e5('0x25')]=[{'filename':_0x1e0f13,'path':_0x32abad}];_0x4b9433[_0x65e5('0x26')][_0x65e5('0x27')]=util['format'](_0x65e5('0x28'),JSON[_0x65e5('0x29')](_0x1f1c3b,null,0x2));}else if(fs[_0x65e5('0x24')](_0x777c0)){_0x1f1c3b['status']=_0x65e5('0x2a');_0x4b9433[_0x65e5('0x26')]['attachments']=[{'filename':_0x1327cc,'path':_0x777c0}];}else{_0x4b9433[_0x65e5('0x26')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3271e9['sendIfEmpty']){_0x4897c5=![];logger['info'](_0x65e5('0x2b'));}}if(_0x4897c5){return client['request']('SendMail',_0x4b9433)[_0x65e5('0x2c')](function(_0x18f584){if(_0x18f584['error']){return logger[_0x65e5('0x2d')]('error\x20mail',JSON[_0x65e5('0x29')](_0x18f584));}return logger[_0x65e5('0xa')](_0x65e5('0x2e'));})[_0x65e5('0x2f')](function(_0x559f20){return logger['error'](_0x65e5('0x30'),JSON[_0x65e5('0x29')](_0x559f20));});}};}function handleError(){return function(_0x152eb6){return logger[_0x65e5('0x2d')](JSON[_0x65e5('0x29')](_0x152eb6));};}function handleResult(_0x35280e){return function(_0x593576){logger['info'](_0x65e5('0x31'),JSON[_0x65e5('0x29')](_0x593576));if(_0x35280e[_0x65e5('0xe')]&&_0x35280e['MailAccount'][_0x65e5('0x11')]&&!_[_0x65e5('0x32')](_0x35280e[_0x65e5('0xc')])){setTimeout(handleSendEmail(_0x35280e,_0x593576),0x3c*0x3e8);}};}function handleJob(_0x53afdd){return function(){try{if(_[_0x65e5('0x32')](_0x53afdd['subtractNumber'])){return logger[_0x65e5('0xa')](_0x65e5('0x33'));}if(_[_0x65e5('0x32')](_0x53afdd[_0x65e5('0x1c')])){return logger['info'](_0x65e5('0x34'));}var _0x46e39f={'startDate':moment()[_0x65e5('0x35')](_0x53afdd['subtractNumber'],_0x53afdd[_0x65e5('0x1c')])['format'](_0x65e5('0x36')),'endDate':moment()[_0x65e5('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x65e5('0x37'),'output':_0x53afdd[_0x65e5('0x38')],'name':_0x53afdd['name']};if(!_['isNil'](_0x53afdd[_0x65e5('0x39')])){logger['info'](_0x65e5('0x3a'),_0x53afdd[_0x65e5('0x39')]);return analyticDefaultReportController[_0x65e5('0x3b')]({'id':_0x53afdd[_0x65e5('0x39')]},_0x46e39f)[_0x65e5('0x2c')](handleResult(_0x53afdd))[_0x65e5('0x2f')](handleError());}if(!_[_0x65e5('0x32')](_0x53afdd[_0x65e5('0x3c')])){logger[_0x65e5('0xa')](_0x65e5('0x3d'),_0x53afdd['CustomReportId']);return analyticCustomReportController[_0x65e5('0x3b')]({'id':_0x53afdd[_0x65e5('0x3c')]},_0x46e39f)[_0x65e5('0x2c')](handleResult(_0x53afdd))[_0x65e5('0x2f')](handleError());}}catch(_0x4d9ad4){logger[_0x65e5('0x2d')](JSON['stringify'](_0x4d9ad4));}return logger[_0x65e5('0xa')]('no\x20report\x20id');};}function getJobs(_0x580505){var _0x552b8e={};if(_0x580505){_0x552b8e['id']=_0x580505;}return db[_0x65e5('0x3e')]['findAll']({'where':_0x552b8e,'include':[{'model':db['MailAccount'],'attributes':['id',_0x65e5('0x1a'),'email'],'include':[{'model':db[_0x65e5('0x3f')],'as':_0x65e5('0x11')}]}]})[_0x65e5('0x2c')](function(_0x343a3f){var _0x1120c9=_[_0x65e5('0x40')](manager[_0x65e5('0x41')]);var _0x4f7162=_[_0x65e5('0x42')](_0x343a3f,function(_0x5a0e6a){return _0x5a0e6a['id'][_0x65e5('0x43')]();});var _0x22e9e5=_[_0x65e5('0x44')](_0x343a3f,function(_0x3580ae){return _0x3580ae['id'][_0x65e5('0x43')]();});var _0x4b3925=_0x580505?_0x4f7162:_[_0x65e5('0x45')](_0x4f7162,_0x1120c9);var _0x414279=_[_0x65e5('0x46')](_0x4f7162,_0x1120c9);var _0x378b8=_['difference'](_0x1120c9,_0x4f7162);var _0x5b1c41;var _0x2a25a2;for(_0x5b1c41=0x0;_0x5b1c41<_0x378b8[_0x65e5('0x47')]&&!_0x580505;_0x5b1c41+=0x1){_0x2a25a2=_0x378b8[_0x5b1c41][_0x65e5('0x43')]();if(manager[_0x65e5('0x48')](_0x2a25a2)){manager[_0x65e5('0x49')](_0x2a25a2);manager[_0x65e5('0x4a')](_0x2a25a2);logger[_0x65e5('0xa')](_0x65e5('0x4b'),_0x2a25a2);}}logger[_0x65e5('0xa')]('toRun',JSON[_0x65e5('0x29')](_0x4b3925));for(_0x5b1c41=0x0;_0x5b1c41<_0x4b3925[_0x65e5('0x47')];_0x5b1c41+=0x1){_0x2a25a2=_0x4b3925[_0x5b1c41][_0x65e5('0x43')]();logger['info']('index',_0x2a25a2);if(_0x580505){logger[_0x65e5('0xa')](_0x65e5('0x4c'),_0x580505);logger[_0x65e5('0xa')](JSON[_0x65e5('0x29')](_0x22e9e5[_0x2a25a2]));BPromise['resolve']()[_0x65e5('0x2c')](handleJob(_0x22e9e5[_0x2a25a2]));logger[_0x65e5('0xa')]('run\x20job',_0x22e9e5[_0x2a25a2][_0x65e5('0x1a')],_0x22e9e5[_0x2a25a2]['cron']);}else if(_0x22e9e5[_0x2a25a2][_0x65e5('0x4d')]&&_0x22e9e5[_0x2a25a2][_0x65e5('0x4e')]&&moment()[_0x65e5('0x4f')](_0x22e9e5[_0x2a25a2]['startAt'],_0x22e9e5[_0x2a25a2][_0x65e5('0x50')])){manager[_0x65e5('0x51')](_0x2a25a2,_0x22e9e5[_0x2a25a2][_0x65e5('0x4d')],handleJob(_0x22e9e5[_0x2a25a2]));manager[_0x65e5('0x52')](_0x2a25a2);logger[_0x65e5('0xa')](_0x65e5('0x53'),_0x22e9e5[_0x2a25a2][_0x65e5('0x1a')],_0x22e9e5[_0x2a25a2][_0x65e5('0x4d')]);}else if(manager['exists'](_0x2a25a2)){manager['stop'](_0x2a25a2);manager[_0x65e5('0x4a')](_0x2a25a2);logger['info']('stop\x20cron',_0x22e9e5[_0x2a25a2]['name'],_0x22e9e5[_0x2a25a2][_0x65e5('0x4d')]);}}for(_0x5b1c41=0x0,_0x2a25a2;_0x5b1c41<_0x414279[_0x65e5('0x47')]&&!_0x580505;_0x5b1c41+=0x1){_0x2a25a2=_0x414279[_0x5b1c41][_0x65e5('0x43')]();if(manager[_0x65e5('0x48')](_0x2a25a2)){if(_0x22e9e5[_0x2a25a2][_0x65e5('0x4d')]&&_0x22e9e5[_0x2a25a2][_0x65e5('0x4e')]&&moment()[_0x65e5('0x4f')](_0x22e9e5[_0x2a25a2][_0x65e5('0x54')],_0x22e9e5[_0x2a25a2]['endAt'])){manager[_0x65e5('0x55')](_0x2a25a2,_0x22e9e5[_0x2a25a2][_0x65e5('0x4d')],handleJob(_0x22e9e5[_0x2a25a2]));logger[_0x65e5('0xa')](_0x65e5('0x56'),_0x22e9e5[_0x2a25a2][_0x65e5('0x1a')],_0x22e9e5[_0x2a25a2]['cron']);}else{manager[_0x65e5('0x49')](_0x2a25a2);manager[_0x65e5('0x4a')](_0x2a25a2);logger[_0x65e5('0xa')](_0x65e5('0x57'),_0x22e9e5[_0x2a25a2]['name'],_0x22e9e5[_0x2a25a2][_0x65e5('0x4d')]);}}}})[_0x65e5('0x2f')](function(_0x5559ab){logger[_0x65e5('0x2d')](JSON[_0x65e5('0x29')](_0x5559ab));});}exports[_0x65e5('0x58')]=function(_0x8bd735){return getJobs(_0x8bd735);};exports[_0x65e5('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xa07a=['CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','difference','exists','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','start','length','active','stop','deleteJob','stop\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','name','subtractNumber','subtractUnit','join','../../files/reports','savename','extname','status','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','existsSync','Sent','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','request','SendMail','then','error','stringify','email\x20sent','catch','error\x20mail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport'];(function(_0x39c684,_0x1e0093){var _0x3da800=function(_0x2ac946){while(--_0x2ac946){_0x39c684['push'](_0x39c684['shift']());}};_0x3da800(++_0x1e0093);}(_0xa07a,0x11e));var _0xaa07=function(_0x51ef2b,_0x37f6a6){_0x51ef2b=_0x51ef2b-0x0;var _0x296beb=_0xa07a[_0x51ef2b];return _0x296beb;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xaa07('0x0'));var _=require(_0xaa07('0x1'));var moment=require(_0xaa07('0x2'));var CronJobManager=require(_0xaa07('0x3'));var jayson=require(_0xaa07('0x4'));var BPromise=require(_0xaa07('0x5'));var logger=require('../logger')('schedule');var db=require(_0xaa07('0x6'))['db'];var analyticCustomReportController=require(_0xaa07('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xaa07('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x39d33,_0x19b331){return function(){logger['info'](_0xaa07('0x9'),_0x39d33[_0xaa07('0xa')]);var _0x34843d=!![];var _0x553f00={'tls':{'rejectUnauthorized':![]}};if(_0x39d33[_0xaa07('0xb')]['Smtp'][_0xaa07('0xc')]){_0x553f00[_0xaa07('0xc')]=_0x39d33['MailAccount'][_0xaa07('0xd')]['service'];}else{_0x553f00[_0xaa07('0xe')]=_0x39d33['MailAccount'][_0xaa07('0xd')][_0xaa07('0xe')];_0x553f00[_0xaa07('0xf')]=_0x39d33[_0xaa07('0xb')][_0xaa07('0xd')][_0xaa07('0xf')];_0x553f00['secure']=_0x39d33['MailAccount'][_0xaa07('0xd')]['secure'];}if(_0x39d33[_0xaa07('0xb')][_0xaa07('0xd')][_0xaa07('0x10')]){_0x553f00[_0xaa07('0x11')]={'user':_0x39d33['MailAccount'][_0xaa07('0xd')][_0xaa07('0x12')],'pass':_0x39d33['MailAccount'][_0xaa07('0xd')][_0xaa07('0x13')]};}var _0x19d589={'account':_0x553f00,'message':{'from':util[_0xaa07('0x14')](_0xaa07('0x15'),_0x39d33[_0xaa07('0xb')]['name'],_0x39d33[_0xaa07('0xb')][_0xaa07('0xa')]||_0x39d33[_0xaa07('0xb')][_0xaa07('0xd')][_0xaa07('0x12')]),'to':_0x39d33[_0xaa07('0xa')],'cc':_0x39d33['cc'],'bcc':_0x39d33[_0xaa07('0x16')],'subject':util[_0xaa07('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x19b331[_0xaa07('0x17')],_0x39d33[_0xaa07('0x18')],_0x39d33[_0xaa07('0x19')])}};var _0x315890=path[_0xaa07('0x1a')](__dirname,_0xaa07('0x1b'));var _0x1cc758=_0x19b331['savename'];var _0x3ccfaf=util[_0xaa07('0x14')]('%s.%s',path['basename'](_0x19b331[_0xaa07('0x1c')],path[_0xaa07('0x1d')](_0x19b331['savename'])),'zip');var _0x503b70=path[_0xaa07('0x1a')](_0x315890,_0x1cc758);var _0x4040a6=path[_0xaa07('0x1a')](_0x315890,_0x3ccfaf);if(fs['existsSync'](_0x503b70)){_0x19b331[_0xaa07('0x1e')]='Sent';_0x19d589[_0xaa07('0x1f')][_0xaa07('0x20')]=[{'filename':_0x1cc758,'path':_0x503b70}];_0x19d589[_0xaa07('0x1f')][_0xaa07('0x21')]=util[_0xaa07('0x14')](_0xaa07('0x22'),JSON['stringify'](_0x19b331,null,0x2));}else if(fs[_0xaa07('0x23')](_0x4040a6)){_0x19b331[_0xaa07('0x1e')]=_0xaa07('0x24');_0x19d589[_0xaa07('0x1f')][_0xaa07('0x20')]=[{'filename':_0x3ccfaf,'path':_0x4040a6}];}else{_0x19d589[_0xaa07('0x1f')][_0xaa07('0x21')]=_0xaa07('0x25');if(!_0x39d33[_0xaa07('0x26')]){_0x34843d=![];logger[_0xaa07('0x27')](_0xaa07('0x28'));}}if(_0x34843d){return client[_0xaa07('0x29')](_0xaa07('0x2a'),_0x19d589)[_0xaa07('0x2b')](function(_0x5cb18c){if(_0x5cb18c[_0xaa07('0x2c')]){return logger[_0xaa07('0x2c')]('error\x20mail',JSON[_0xaa07('0x2d')](_0x5cb18c));}return logger[_0xaa07('0x27')](_0xaa07('0x2e'));})[_0xaa07('0x2f')](function(_0x4700c0){return logger[_0xaa07('0x2c')](_0xaa07('0x30'),JSON[_0xaa07('0x2d')](_0x4700c0));});}};}function handleError(){return function(_0x44af10){return logger['error'](JSON['stringify'](_0x44af10));};}function handleResult(_0x40444d){return function(_0x3477ad){logger['info']('data',JSON[_0xaa07('0x2d')](_0x3477ad));if(_0x40444d['MailAccount']&&_0x40444d['MailAccount'][_0xaa07('0xd')]&&!_[_0xaa07('0x31')](_0x40444d['email'])){setTimeout(handleSendEmail(_0x40444d,_0x3477ad),0x3c*0x3e8);}};}function handleJob(_0x3e3534){return function(){try{if(_[_0xaa07('0x31')](_0x3e3534[_0xaa07('0x18')])){return logger[_0xaa07('0x27')](_0xaa07('0x32'));}if(_['isNil'](_0x3e3534['subtractUnit'])){return logger[_0xaa07('0x27')](_0xaa07('0x33'));}var _0x393ddc={'startDate':moment()['subtract'](_0x3e3534['subtractNumber'],_0x3e3534[_0xaa07('0x19')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xaa07('0x14')](_0xaa07('0x34')),'type':_0xaa07('0x35'),'output':_0x3e3534[_0xaa07('0x36')],'name':_0x3e3534[_0xaa07('0x17')]};if(!_[_0xaa07('0x31')](_0x3e3534['DefaultReportId'])){logger[_0xaa07('0x27')](_0xaa07('0x37'),_0x3e3534[_0xaa07('0x38')]);return analyticDefaultReportController[_0xaa07('0x39')]({'id':_0x3e3534[_0xaa07('0x38')]},_0x393ddc)['then'](handleResult(_0x3e3534))[_0xaa07('0x2f')](handleError());}if(!_[_0xaa07('0x31')](_0x3e3534[_0xaa07('0x3a')])){logger[_0xaa07('0x27')](_0xaa07('0x3b'),_0x3e3534[_0xaa07('0x3a')]);return analyticCustomReportController[_0xaa07('0x39')]({'id':_0x3e3534[_0xaa07('0x3a')]},_0x393ddc)['then'](handleResult(_0x3e3534))[_0xaa07('0x2f')](handleError());}}catch(_0x2f874f){logger['error'](JSON['stringify'](_0x2f874f));}return logger['info'](_0xaa07('0x3c'));};}function getJobs(_0x35db18){var _0x26a1e3={};if(_0x35db18){_0x26a1e3['id']=_0x35db18;}return db[_0xaa07('0x3d')][_0xaa07('0x3e')]({'where':_0x26a1e3,'include':[{'model':db[_0xaa07('0xb')],'attributes':['id',_0xaa07('0x17'),'email'],'include':[{'model':db[_0xaa07('0x3f')],'as':_0xaa07('0xd')}]}]})[_0xaa07('0x2b')](function(_0x218ae5){var _0x529ab8=_['keys'](manager[_0xaa07('0x40')]);var _0x1b8b4a=_[_0xaa07('0x41')](_0x218ae5,function(_0x13fe86){return _0x13fe86['id'][_0xaa07('0x42')]();});var _0x1eea18=_[_0xaa07('0x43')](_0x218ae5,function(_0x4e755b){return _0x4e755b['id']['toString']();});var _0x538707=_0x35db18?_0x1b8b4a:_[_0xaa07('0x44')](_0x1b8b4a,_0x529ab8);var _0x20f473=_['intersection'](_0x1b8b4a,_0x529ab8);var _0x2e3c39=_[_0xaa07('0x44')](_0x529ab8,_0x1b8b4a);var _0x3b5348;var _0x5cc0f5;for(_0x3b5348=0x0;_0x3b5348<_0x2e3c39['length']&&!_0x35db18;_0x3b5348+=0x1){_0x5cc0f5=_0x2e3c39[_0x3b5348][_0xaa07('0x42')]();if(manager[_0xaa07('0x45')](_0x5cc0f5)){manager['stop'](_0x5cc0f5);manager['deleteJob'](_0x5cc0f5);logger[_0xaa07('0x27')](_0xaa07('0x46'),_0x5cc0f5);}}logger[_0xaa07('0x27')]('toRun',JSON[_0xaa07('0x2d')](_0x538707));for(_0x3b5348=0x0;_0x3b5348<_0x538707['length'];_0x3b5348+=0x1){_0x5cc0f5=_0x538707[_0x3b5348][_0xaa07('0x42')]();logger[_0xaa07('0x27')](_0xaa07('0x47'),_0x5cc0f5);if(_0x35db18){logger['info'](_0xaa07('0x48'),_0x35db18);logger['info'](JSON[_0xaa07('0x2d')](_0x1eea18[_0x5cc0f5]));BPromise[_0xaa07('0x49')]()['then'](handleJob(_0x1eea18[_0x5cc0f5]));logger[_0xaa07('0x27')](_0xaa07('0x4a'),_0x1eea18[_0x5cc0f5][_0xaa07('0x17')],_0x1eea18[_0x5cc0f5][_0xaa07('0x4b')]);}else if(_0x1eea18[_0x5cc0f5][_0xaa07('0x4b')]&&_0x1eea18[_0x5cc0f5]['active']&&moment()[_0xaa07('0x4c')](_0x1eea18[_0x5cc0f5][_0xaa07('0x4d')],_0x1eea18[_0x5cc0f5][_0xaa07('0x4e')])){manager['add'](_0x5cc0f5,_0x1eea18[_0x5cc0f5][_0xaa07('0x4b')],handleJob(_0x1eea18[_0x5cc0f5]));manager[_0xaa07('0x4f')](_0x5cc0f5);logger[_0xaa07('0x27')]('add\x20cron',_0x1eea18[_0x5cc0f5][_0xaa07('0x17')],_0x1eea18[_0x5cc0f5][_0xaa07('0x4b')]);}else if(manager[_0xaa07('0x45')](_0x5cc0f5)){manager['stop'](_0x5cc0f5);manager['deleteJob'](_0x5cc0f5);logger[_0xaa07('0x27')]('stop\x20cron',_0x1eea18[_0x5cc0f5][_0xaa07('0x17')],_0x1eea18[_0x5cc0f5][_0xaa07('0x4b')]);}}for(_0x3b5348=0x0,_0x5cc0f5;_0x3b5348<_0x20f473[_0xaa07('0x50')]&&!_0x35db18;_0x3b5348+=0x1){_0x5cc0f5=_0x20f473[_0x3b5348]['toString']();if(manager[_0xaa07('0x45')](_0x5cc0f5)){if(_0x1eea18[_0x5cc0f5][_0xaa07('0x4b')]&&_0x1eea18[_0x5cc0f5][_0xaa07('0x51')]&&moment()[_0xaa07('0x4c')](_0x1eea18[_0x5cc0f5]['startAt'],_0x1eea18[_0x5cc0f5]['endAt'])){manager['update'](_0x5cc0f5,_0x1eea18[_0x5cc0f5][_0xaa07('0x4b')],handleJob(_0x1eea18[_0x5cc0f5]));logger[_0xaa07('0x27')]('update\x20cron',_0x1eea18[_0x5cc0f5][_0xaa07('0x17')],_0x1eea18[_0x5cc0f5]['cron']);}else{manager[_0xaa07('0x52')](_0x5cc0f5);manager[_0xaa07('0x53')](_0x5cc0f5);logger['info'](_0xaa07('0x54'),_0x1eea18[_0x5cc0f5]['name'],_0x1eea18[_0x5cc0f5][_0xaa07('0x4b')]);}}}})[_0xaa07('0x2f')](function(_0x4534c9){logger[_0xaa07('0x2c')](JSON[_0xaa07('0x2d')](_0x4534c9));});}exports[_0xaa07('0x55')]=function(_0x5ed546){return getJobs(_0x5ed546);};exports[_0xaa07('0x4f')]=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 6c7946a..954fb29 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 _0x6198=['data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','ValidationError','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Neutral','COMPLETED','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','transcribeName'];(function(_0x5f0fbd,_0x36b2ae){var _0x2dfde0=function(_0x3ab74f){while(--_0x3ab74f){_0x5f0fbd['push'](_0x5f0fbd['shift']());}};_0x2dfde0(++_0x36b2ae);}(_0x6198,0x1ba));var _0x8619=function(_0x54640c,_0x2a7887){_0x54640c=_0x54640c-0x0;var _0x2fa24d=_0x6198[_0x54640c];return _0x2fa24d;};var _=require(_0x8619('0x0'));var AWS=require(_0x8619('0x1'));var rp=require(_0x8619('0x2'));var util=require(_0x8619('0x3'));var BPromise=require(_0x8619('0x4'));var db=require(_0x8619('0x5'))['db'];var logger=require(_0x8619('0x6'))('transcribe');function getTranscriptionJob(_0xe4145f,_0x30bb99,_0x36a2f6,_0x5a4feb){return new Promise(function(_0x4b2109,_0x45070f){var _0x47e7e8=new AWS[(_0x8619('0x7'))]({'accessKeyId':_0x30bb99,'secretAccessKey':_0xe4145f,'region':_0x36a2f6});_0x47e7e8[_0x8619('0x8')]({'TranscriptionJobName':_0x5a4feb},function(_0x50705a,_0x50d039){if(_0x50705a){return _0x45070f(_0x50705a);}else{return _0x4b2109(_0x50d039);}});});}function sentiment(_0x51854c,_0x4ea8f8,_0x1a4446,_0x4d9c34,_0x562365){return new Promise(function(_0x29b06d,_0x54cb0e){var _0x539f4b=new AWS[(_0x8619('0x9'))]({'accessKeyId':_0x4ea8f8,'secretAccessKey':_0x51854c,'region':_0x1a4446});_0x539f4b[_0x8619('0xa')]({'Text':_0x4d9c34,'LanguageCode':_0x562365['substring'](0x0,0x2)},function(_0x47ef22,_0x557136){if(_0x47ef22){return _0x54cb0e(_0x47ef22);}else{return _0x29b06d(_0x557136);}});});}function checkTranscribeJob(_0x5e155d,_0x114a4d,_0x3b1881){var _0x2cd291;return new BPromise(function(_0xd575bf,_0x35b5f9){logger[_0x8619('0xb')](util[_0x8619('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5e155d['id'],_0x5e155d[_0x8619('0xd')]));return getTranscriptionJob(_0x3b1881['data1'],_0x3b1881[_0x8619('0xe')],_0x114a4d[_0x8619('0xf')],_0x5e155d[_0x8619('0xd')])[_0x8619('0x10')](function(_0x426302){logger[_0x8619('0xb')](util['format'](_0x8619('0x11'),_0x5e155d['id'],_0x5e155d[_0x8619('0xd')],_0x426302[_0x8619('0x12')]['TranscriptionJobStatus']));if(!_0x5e155d['fileText']){switch(_0x426302[_0x8619('0x12')][_0x8619('0x13')]){case'COMPLETED':var _0x335dfb={'transcribeStatus':_0x426302[_0x8619('0x12')]['TranscriptionJobStatus'],'fileUri':_0x426302[_0x8619('0x12')][_0x8619('0x14')][_0x8619('0x15')]};logger[_0x8619('0xb')](util[_0x8619('0xc')](_0x8619('0x16'),_0x5e155d['id']));return rp({'uri':_0x426302[_0x8619('0x12')][_0x8619('0x14')][_0x8619('0x15')],'json':!![]})[_0x8619('0x10')](function(_0x3f45b1){logger[_0x8619('0xb')](util['format'](_0x8619('0x17'),_0x5e155d['id']));if(_0x3f45b1&&_0x3f45b1[_0x8619('0x18')]&&_0x3f45b1[_0x8619('0x18')][_0x8619('0x19')]&&_0x3f45b1[_0x8619('0x18')]['transcripts'][_0x8619('0x1a')]){_0x335dfb[_0x8619('0x1b')]='';for(var _0x4712a8=0x0;_0x4712a8<_0x3f45b1[_0x8619('0x18')][_0x8619('0x19')]['length'];_0x4712a8++){_0x335dfb['fileText']+=_0x3f45b1[_0x8619('0x18')][_0x8619('0x19')][_0x4712a8][_0x8619('0x1c')]+'';}}return _0x5e155d[_0x8619('0x1d')](_0x335dfb);})[_0x8619('0x10')](function(){logger[_0x8619('0xb')](util[_0x8619('0xc')](_0x8619('0x1e'),_0x5e155d['id']));if(!_0x5e155d[_0x8619('0x1f')]){throw new db[(_0x8619('0x20'))]['ValidationError'](_0x8619('0x21'));}if(!_0x114a4d[_0x8619('0x22')]||!_0x114a4d['sentimentAccountId']||!_0x114a4d['sentimentRegion']||!_0x114a4d[_0x8619('0x23')]||!_0x114a4d['bucket']){throw new db['Sequelize'][(_0x8619('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x335dfb[_0x8619('0x1b')]){throw new Error(_0x8619('0x25'));}if(_0x114a4d[_0x8619('0x26')]===_0x3b1881['id']){return _0x3b1881;}else{return db['CloudProvider'][_0x8619('0x27')]({'where':{'id':_settings[_0x8619('0x26')]}});}})[_0x8619('0x10')](function(_0x378e1e){if(!_0x378e1e){throw new db['Sequelize']['ValidationError'](_0x8619('0x28'));}if(!_0x378e1e[_0x8619('0x29')]||!_0x378e1e[_0x8619('0xe')]){throw new db[(_0x8619('0x20'))][(_0x8619('0x24'))](_0x8619('0x2a'));}_0x2cd291=_0x378e1e;logger[_0x8619('0xb')](util[_0x8619('0xc')](_0x8619('0x2b'),_0x5e155d['id']));return sentiment(_0x2cd291[_0x8619('0x29')],_0x2cd291['data2'],_0x114a4d['sentimentRegion'],_0x335dfb[_0x8619('0x1b')],_0x114a4d['language']);})['then'](function(_0x432ed4){logger[_0x8619('0xb')](util['format'](_0x8619('0x2c'),_0x5e155d['id']));return _0x5e155d['update']({'sentiment':_0x432ed4[_0x8619('0x2d')],'sPositive':_0x432ed4[_0x8619('0x2e')][_0x8619('0x2f')],'sNegative':_0x432ed4[_0x8619('0x2e')][_0x8619('0x30')],'sMixed':_0x432ed4[_0x8619('0x2e')][_0x8619('0x31')],'sNeutral':_0x432ed4[_0x8619('0x2e')]['Neutral']});})['then'](function(){logger[_0x8619('0xb')](util[_0x8619('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5e155d['id']));_0xd575bf();});case _0x8619('0x32'):return _0x5e155d[_0x8619('0x1d')]({'transcribeStatus':_0x8619('0x32'),'failureReason':_0x426302[_0x8619('0x12')]['FailureReason']})[_0x8619('0x10')](function(){logger['info'](util[_0x8619('0xc')](_0x8619('0x1e'),_0x5e155d['id']));_0xd575bf();});default:logger[_0x8619('0xb')](util[_0x8619('0xc')](_0x8619('0x33'),_0x5e155d['id']));break;}}else{return BPromise[_0x8619('0x34')]()[_0x8619('0x10')](function(){if(!_0x5e155d['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0x8619('0x21'));}if(!_0x114a4d[_0x8619('0x22')]||!_0x114a4d['sentimentAccountId']||!_0x114a4d[_0x8619('0x35')]||!_0x114a4d['language']||!_0x114a4d[_0x8619('0x36')]){throw new db[(_0x8619('0x20'))][(_0x8619('0x24'))](_0x8619('0x37'));}if(!_0x5e155d[_0x8619('0x1b')]){throw new Error(_0x8619('0x25'));}if(_0x114a4d[_0x8619('0x26')]===_0x3b1881['id']){return _0x3b1881;}else{return db[_0x8619('0x38')][_0x8619('0x27')]({'where':{'id':_settings[_0x8619('0x26')]}});}})[_0x8619('0x10')](function(_0x5061d2){if(!_0x5061d2){throw new db[(_0x8619('0x20'))][(_0x8619('0x24'))](_0x8619('0x28'));}if(!_0x5061d2[_0x8619('0x29')]||!_0x5061d2[_0x8619('0xe')]){throw new db['Sequelize'][(_0x8619('0x24'))](_0x8619('0x2a'));}_0x2cd291=_0x5061d2;logger[_0x8619('0xb')](util['format'](_0x8619('0x2b'),_0x5e155d['id']));return sentiment(_0x2cd291['data1'],_0x2cd291[_0x8619('0xe')],_0x114a4d[_0x8619('0x35')],_0x5e155d[_0x8619('0x1b')],_0x114a4d[_0x8619('0x23')]);})[_0x8619('0x10')](function(_0xdc14ef){logger[_0x8619('0xb')](util[_0x8619('0xc')](_0x8619('0x2c'),_0x5e155d['id']));return _0x5e155d[_0x8619('0x1d')]({'sentiment':_0xdc14ef['Sentiment'],'sPositive':_0xdc14ef['SentimentScore'][_0x8619('0x2f')],'sNegative':_0xdc14ef[_0x8619('0x2e')]['Negative'],'sMixed':_0xdc14ef[_0x8619('0x2e')][_0x8619('0x31')],'sNeutral':_0xdc14ef['SentimentScore'][_0x8619('0x39')],'transcribeStatus':_0x8619('0x3a')});})[_0x8619('0x10')](function(){logger[_0x8619('0xb')](util[_0x8619('0xc')](_0x8619('0x1e'),_0x5e155d['id']));_0xd575bf();});}})['catch'](function(_0x5f0e41){if(_0x5f0e41){if(!_0x5f0e41['name']||_0x5f0e41[_0x8619('0x3b')]!==_0x8619('0x3c')){logger['error'](util[_0x8619('0xc')](_0x8619('0x3d'),_0x5e155d['id']),util[_0x8619('0x3e')](_0x5f0e41,{'showHidden':![],'depth':null}));}}_0xd575bf();});});}function checkTranscribe(){var _0x5a7a9e;var _0x48b3c7;var _0xe093c5;return db[_0x8619('0x3f')][_0x8619('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x1b3404){if(!_0x1b3404||!_0x1b3404[_0x8619('0x1a')]){throw new db[(_0x8619('0x20'))][(_0x8619('0x24'))](_0x8619('0x41'));}_0x5a7a9e=_0x1b3404;return db[_0x8619('0x42')][_0x8619('0x27')]({'where':{'id':0x1}});})[_0x8619('0x10')](function(_0x255b47){if(!_0x255b47){throw new db['Sequelize']['ValidationError'](_0x8619('0x43'));}_0x48b3c7=_0x255b47;if(!_0x48b3c7[_0x8619('0x44')]||!_0x48b3c7[_0x8619('0x45')]||!_0x48b3c7[_0x8619('0xf')]||!_0x48b3c7[_0x8619('0x23')]||!_0x48b3c7[_0x8619('0x36')]){throw new db['Sequelize'][(_0x8619('0x24'))](_0x8619('0x46'));}return db['CloudProvider'][_0x8619('0x27')]({'where':{'id':_0x48b3c7['transcribeAccountId']}});})[_0x8619('0x10')](function(_0x102472){if(!_0x102472){throw new db[(_0x8619('0x20'))]['ValidationError'](_0x8619('0x28'));}if(!_0x102472[_0x8619('0x29')]||!_0x102472[_0x8619('0xe')]){throw new db[(_0x8619('0x20'))][(_0x8619('0x24'))](_0x8619('0x2a'));}_0xe093c5=_0x102472;var _0x1d8c06=[];_0x5a7a9e[_0x8619('0x47')](function(_0x18dd1e){_0x1d8c06[_0x8619('0x48')](checkTranscribeJob(_0x18dd1e,_0x48b3c7,_0xe093c5));});return BPromise[_0x8619('0x49')](_0x1d8c06);})['catch'](function(_0x54fbb2){if(_0x54fbb2){if(!_0x54fbb2[_0x8619('0x3b')]||_0x54fbb2[_0x8619('0x3b')]!=='SequelizeValidationError'){logger[_0x8619('0x4a')](util['inspect'](_0x54fbb2,{'showHidden':![],'depth':null}));}}});}exports[_0x8619('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x6bc9=['results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','Negative','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribe','transcribeAccountId','push','all','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x417774,_0x1b95e6){var _0x10015d=function(_0x2526b3){while(--_0x2526b3){_0x417774['push'](_0x417774['shift']());}};_0x10015d(++_0x1b95e6);}(_0x6bc9,0xc6));var _0x96bc=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x6bc9[_0x29d623];return _0x242e59;};var _=require(_0x96bc('0x0'));var AWS=require('aws-sdk');var rp=require(_0x96bc('0x1'));var util=require(_0x96bc('0x2'));var BPromise=require(_0x96bc('0x3'));var db=require(_0x96bc('0x4'))['db'];var logger=require(_0x96bc('0x5'))('transcribe');function getTranscriptionJob(_0x4e83b5,_0x375342,_0x3caf16,_0x266b46){return new Promise(function(_0x6b33,_0x21ea0c){var _0x1fb155=new AWS[(_0x96bc('0x6'))]({'accessKeyId':_0x375342,'secretAccessKey':_0x4e83b5,'region':_0x3caf16});_0x1fb155[_0x96bc('0x7')]({'TranscriptionJobName':_0x266b46},function(_0x44ce45,_0x39926){if(_0x44ce45){return _0x21ea0c(_0x44ce45);}else{return _0x6b33(_0x39926);}});});}function sentiment(_0x15bcf4,_0x1711d8,_0x176aa7,_0xd5786,_0x384cc1){return new Promise(function(_0x1b0b31,_0x427ea6){var _0x249ee5=new AWS[(_0x96bc('0x8'))]({'accessKeyId':_0x1711d8,'secretAccessKey':_0x15bcf4,'region':_0x176aa7});_0x249ee5[_0x96bc('0x9')]({'Text':_0xd5786,'LanguageCode':_0x384cc1['substring'](0x0,0x2)},function(_0x5a8d9e,_0x2911f1){if(_0x5a8d9e){return _0x427ea6(_0x5a8d9e);}else{return _0x1b0b31(_0x2911f1);}});});}function checkTranscribeJob(_0x2bd407,_0x4894be,_0x40cb3d){var _0x5dfe70;return new BPromise(function(_0x19b648,_0x5247fc){logger[_0x96bc('0xa')](util[_0x96bc('0xb')](_0x96bc('0xc'),_0x2bd407['id'],_0x2bd407[_0x96bc('0xd')]));return getTranscriptionJob(_0x40cb3d['data1'],_0x40cb3d['data2'],_0x4894be[_0x96bc('0xe')],_0x2bd407[_0x96bc('0xd')])[_0x96bc('0xf')](function(_0x3e650b){logger[_0x96bc('0xa')](util[_0x96bc('0xb')](_0x96bc('0x10'),_0x2bd407['id'],_0x2bd407[_0x96bc('0xd')],_0x3e650b[_0x96bc('0x11')][_0x96bc('0x12')]));if(!_0x2bd407[_0x96bc('0x13')]){switch(_0x3e650b['TranscriptionJob'][_0x96bc('0x12')]){case _0x96bc('0x14'):var _0x2ced21={'transcribeStatus':_0x3e650b[_0x96bc('0x11')]['TranscriptionJobStatus'],'fileUri':_0x3e650b[_0x96bc('0x11')][_0x96bc('0x15')][_0x96bc('0x16')]};logger[_0x96bc('0xa')](util[_0x96bc('0xb')](_0x96bc('0x17'),_0x2bd407['id']));return rp({'uri':_0x3e650b[_0x96bc('0x11')]['Transcript'][_0x96bc('0x16')],'json':!![]})[_0x96bc('0xf')](function(_0x4ef464){logger[_0x96bc('0xa')](util[_0x96bc('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x2bd407['id']));if(_0x4ef464&&_0x4ef464[_0x96bc('0x18')]&&_0x4ef464['results'][_0x96bc('0x19')]&&_0x4ef464[_0x96bc('0x18')][_0x96bc('0x19')][_0x96bc('0x1a')]){_0x2ced21['fileText']='';for(var _0x147dca=0x0;_0x147dca<_0x4ef464['results'][_0x96bc('0x19')][_0x96bc('0x1a')];_0x147dca++){_0x2ced21[_0x96bc('0x13')]+=_0x4ef464[_0x96bc('0x18')][_0x96bc('0x19')][_0x147dca][_0x96bc('0x1b')]+'';}}return _0x2bd407[_0x96bc('0x1c')](_0x2ced21);})[_0x96bc('0xf')](function(){logger[_0x96bc('0xa')](util[_0x96bc('0xb')](_0x96bc('0x1d'),_0x2bd407['id']));if(!_0x2bd407['tempSentiment']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4894be[_0x96bc('0x1e')]||!_0x4894be[_0x96bc('0x1f')]||!_0x4894be[_0x96bc('0x20')]||!_0x4894be[_0x96bc('0x21')]||!_0x4894be[_0x96bc('0x22')]){throw new db[(_0x96bc('0x23'))][(_0x96bc('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2ced21[_0x96bc('0x13')]){throw new Error(_0x96bc('0x25'));}if(_0x4894be[_0x96bc('0x1f')]===_0x40cb3d['id']){return _0x40cb3d;}else{return db[_0x96bc('0x26')][_0x96bc('0x27')]({'where':{'id':_settings[_0x96bc('0x1f')]}});}})['then'](function(_0x5a4473){if(!_0x5a4473){throw new db[(_0x96bc('0x23'))][(_0x96bc('0x24'))](_0x96bc('0x28'));}if(!_0x5a4473[_0x96bc('0x29')]||!_0x5a4473[_0x96bc('0x2a')]){throw new db[(_0x96bc('0x23'))][(_0x96bc('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x5dfe70=_0x5a4473;logger[_0x96bc('0xa')](util[_0x96bc('0xb')](_0x96bc('0x2b'),_0x2bd407['id']));return sentiment(_0x5dfe70[_0x96bc('0x29')],_0x5dfe70['data2'],_0x4894be[_0x96bc('0x20')],_0x2ced21[_0x96bc('0x13')],_0x4894be[_0x96bc('0x21')]);})[_0x96bc('0xf')](function(_0x466aca){logger[_0x96bc('0xa')](util[_0x96bc('0xb')](_0x96bc('0x2c'),_0x2bd407['id']));return _0x2bd407[_0x96bc('0x1c')]({'sentiment':_0x466aca[_0x96bc('0x2d')],'sPositive':_0x466aca['SentimentScore'][_0x96bc('0x2e')],'sNegative':_0x466aca[_0x96bc('0x2f')]['Negative'],'sMixed':_0x466aca[_0x96bc('0x2f')][_0x96bc('0x30')],'sNeutral':_0x466aca[_0x96bc('0x2f')][_0x96bc('0x31')]});})['then'](function(){logger[_0x96bc('0xa')](util[_0x96bc('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2bd407['id']));_0x19b648();});case _0x96bc('0x32'):return _0x2bd407[_0x96bc('0x1c')]({'transcribeStatus':_0x96bc('0x32'),'failureReason':_0x3e650b[_0x96bc('0x11')][_0x96bc('0x33')]})[_0x96bc('0xf')](function(){logger[_0x96bc('0xa')](util['format'](_0x96bc('0x1d'),_0x2bd407['id']));_0x19b648();});default:logger[_0x96bc('0xa')](util[_0x96bc('0xb')](_0x96bc('0x34'),_0x2bd407['id']));break;}}else{return BPromise[_0x96bc('0x35')]()[_0x96bc('0xf')](function(){if(!_0x2bd407[_0x96bc('0x36')]){throw new db[(_0x96bc('0x23'))][(_0x96bc('0x24'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4894be[_0x96bc('0x1e')]||!_0x4894be[_0x96bc('0x1f')]||!_0x4894be[_0x96bc('0x20')]||!_0x4894be[_0x96bc('0x21')]||!_0x4894be[_0x96bc('0x22')]){throw new db[(_0x96bc('0x23'))][(_0x96bc('0x24'))](_0x96bc('0x37'));}if(!_0x2bd407[_0x96bc('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x4894be[_0x96bc('0x1f')]===_0x40cb3d['id']){return _0x40cb3d;}else{return db[_0x96bc('0x26')]['findOne']({'where':{'id':_settings[_0x96bc('0x1f')]}});}})[_0x96bc('0xf')](function(_0x5dd254){if(!_0x5dd254){throw new db[(_0x96bc('0x23'))][(_0x96bc('0x24'))](_0x96bc('0x28'));}if(!_0x5dd254['data1']||!_0x5dd254[_0x96bc('0x2a')]){throw new db[(_0x96bc('0x23'))][(_0x96bc('0x24'))](_0x96bc('0x38'));}_0x5dfe70=_0x5dd254;logger[_0x96bc('0xa')](util['format'](_0x96bc('0x2b'),_0x2bd407['id']));return sentiment(_0x5dfe70[_0x96bc('0x29')],_0x5dfe70['data2'],_0x4894be[_0x96bc('0x20')],_0x2bd407[_0x96bc('0x13')],_0x4894be[_0x96bc('0x21')]);})[_0x96bc('0xf')](function(_0x1b79e2){logger['info'](util[_0x96bc('0xb')](_0x96bc('0x2c'),_0x2bd407['id']));return _0x2bd407[_0x96bc('0x1c')]({'sentiment':_0x1b79e2[_0x96bc('0x2d')],'sPositive':_0x1b79e2[_0x96bc('0x2f')][_0x96bc('0x2e')],'sNegative':_0x1b79e2[_0x96bc('0x2f')][_0x96bc('0x39')],'sMixed':_0x1b79e2[_0x96bc('0x2f')][_0x96bc('0x30')],'sNeutral':_0x1b79e2['SentimentScore'][_0x96bc('0x31')],'transcribeStatus':_0x96bc('0x14')});})[_0x96bc('0xf')](function(){logger[_0x96bc('0xa')](util[_0x96bc('0xb')](_0x96bc('0x1d'),_0x2bd407['id']));_0x19b648();});}})[_0x96bc('0x3a')](function(_0x25eb91){if(_0x25eb91){if(!_0x25eb91[_0x96bc('0x3b')]||_0x25eb91[_0x96bc('0x3b')]!==_0x96bc('0x3c')){logger[_0x96bc('0x3d')](util[_0x96bc('0xb')](_0x96bc('0x3e'),_0x2bd407['id']),util[_0x96bc('0x3f')](_0x25eb91,{'showHidden':![],'depth':null}));}}_0x19b648();});});}function checkTranscribe(){var _0x1af69a;var _0x201cfd;var _0x764518;return db[_0x96bc('0x40')][_0x96bc('0x41')]({'where':{'transcribeStatus':_0x96bc('0x42')}})[_0x96bc('0xf')](function(_0x128a69){if(!_0x128a69||!_0x128a69[_0x96bc('0x1a')]){throw new db['Sequelize']['ValidationError'](_0x96bc('0x43'));}_0x1af69a=_0x128a69;return db[_0x96bc('0x44')][_0x96bc('0x27')]({'where':{'id':0x1}});})['then'](function(_0x271dbf){if(!_0x271dbf){throw new db[(_0x96bc('0x23'))]['ValidationError']('Settings\x20not\x20available');}_0x201cfd=_0x271dbf;if(!_0x201cfd[_0x96bc('0x45')]||!_0x201cfd['transcribeAccountId']||!_0x201cfd[_0x96bc('0xe')]||!_0x201cfd[_0x96bc('0x21')]||!_0x201cfd[_0x96bc('0x22')]){throw new db[(_0x96bc('0x23'))][(_0x96bc('0x24'))]('Transcribe\x20not\x20configured');}return db[_0x96bc('0x26')][_0x96bc('0x27')]({'where':{'id':_0x201cfd[_0x96bc('0x46')]}});})['then'](function(_0x52f3a6){if(!_0x52f3a6){throw new db['Sequelize'][(_0x96bc('0x24'))](_0x96bc('0x28'));}if(!_0x52f3a6[_0x96bc('0x29')]||!_0x52f3a6[_0x96bc('0x2a')]){throw new db[(_0x96bc('0x23'))][(_0x96bc('0x24'))](_0x96bc('0x38'));}_0x764518=_0x52f3a6;var _0x4107ac=[];_0x1af69a['forEach'](function(_0x52b8b4){_0x4107ac[_0x96bc('0x47')](checkTranscribeJob(_0x52b8b4,_0x201cfd,_0x764518));});return BPromise[_0x96bc('0x48')](_0x4107ac);})['catch'](function(_0x119d08){if(_0x119d08){if(!_0x119d08[_0x96bc('0x3b')]||_0x119d08[_0x96bc('0x3b')]!==_0x96bc('0x3c')){logger['error'](util[_0x96bc('0x3f')](_0x119d08,{'showHidden':![],'depth':null}));}}});}exports[_0x96bc('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 8053f58..c0ef5a2 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 _0xea25=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../mysqldb','schedule','redis','defaults','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','join','update','system','timeout','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea25,0x78));var _0x5ea2=function(_0x11c1fb,_0x6eecac){_0x11c1fb=_0x11c1fb-0x0;var _0x2c5fe0=_0xea25[_0x11c1fb];return _0x2c5fe0;};'use strict';var _=require(_0x5ea2('0x0'));var moment=require(_0x5ea2('0x1'));var Redis=require(_0x5ea2('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x5ea2('0x3'))['db'];var logger=require('../logger')(_0x5ea2('0x4'));config[_0x5ea2('0x5')]=_[_0x5ea2('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5ea2('0x5')]));function closeInteractions(){var _0x458e5c=[];return db[_0x5ea2('0x7')][_0x5ea2('0x8')]({'raw':!![],'attributes':['id',_0x5ea2('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5ea2('0xa')](0x18,_0x5ea2('0xb'))}}})['then'](function(_0x2a65de){if(_0x2a65de&&_0x2a65de[_0x5ea2('0xc')]){_0x458e5c=_[_0x5ea2('0xd')](_0x2a65de||[],'id');logger[_0x5ea2('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x458e5c[_0x5ea2('0xf')]());return db['WhatsappInteraction'][_0x5ea2('0x10')]({'closeReason':_0x5ea2('0x11'),'disposition':_0x5ea2('0x12'),'closed':!![],'closedAt':moment()[_0x5ea2('0x13')](_0x5ea2('0x14'))},{'where':{'id':_0x458e5c}});}})['then'](function(){if(_0x458e5c&&_0x458e5c[_0x5ea2('0xc')]){logger['info'](_0x5ea2('0x15'),_0x458e5c[_0x5ea2('0xf')]());for(var _0x27abf6=0x0;_0x27abf6<_0x458e5c[_0x5ea2('0xc')];_0x27abf6++){io[_0x5ea2('0x16')](_0x5ea2('0x17'),{'id':_0x458e5c[_0x27abf6],'closed':!![]});}}})['catch'](function(_0x1bae02){logger[_0x5ea2('0x18')](_0x5ea2('0x19'),_0x1bae02?util[_0x5ea2('0x1a')](_0x1bae02,{'showHidden':![],'depth':null}):'');});}exports[_0x5ea2('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x692c=['util','../../mysqldb','../logger','schedule','defaults','redis','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','join','update','system','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis'];(function(_0x4d4d24,_0x20f814){var _0x36b299=function(_0x34f137){while(--_0x34f137){_0x4d4d24['push'](_0x4d4d24['shift']());}};_0x36b299(++_0x20f814);}(_0x692c,0x1a1));var _0xc692=function(_0x350fe1,_0x539a46){_0x350fe1=_0x350fe1-0x0;var _0x32765b=_0x692c[_0x350fe1];return _0x32765b;};'use strict';var _=require(_0xc692('0x0'));var moment=require(_0xc692('0x1'));var Redis=require(_0xc692('0x2'));var util=require(_0xc692('0x3'));var config=require('../../config/environment');var db=require(_0xc692('0x4'))['db'];var logger=require(_0xc692('0x5'))(_0xc692('0x6'));config['redis']=_[_0xc692('0x7')](config[_0xc692('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc692('0x9'))(new Redis(config[_0xc692('0x8')]));function closeInteractions(){var _0x1fde4a=[];return db[_0xc692('0xa')][_0xc692('0xb')]({'raw':!![],'attributes':['id',_0xc692('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xc692('0xd')](0x18,_0xc692('0xe'))}}})['then'](function(_0x1135a9){if(_0x1135a9&&_0x1135a9[_0xc692('0xf')]){_0x1fde4a=_[_0xc692('0x10')](_0x1135a9||[],'id');logger[_0xc692('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x1fde4a[_0xc692('0x12')]());return db[_0xc692('0xa')][_0xc692('0x13')]({'closeReason':_0xc692('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xc692('0x15'))},{'where':{'id':_0x1fde4a}});}})[_0xc692('0x16')](function(){if(_0x1fde4a&&_0x1fde4a[_0xc692('0xf')]){logger['info'](_0xc692('0x17'),_0x1fde4a[_0xc692('0x12')]());for(var _0x2088b9=0x0;_0x2088b9<_0x1fde4a[_0xc692('0xf')];_0x2088b9++){io['emit'](_0xc692('0x18'),{'id':_0x1fde4a[_0x2088b9],'closed':!![]});}}})[_0xc692('0x19')](function(_0x4a74b1){logger[_0xc692('0x1a')](_0xc692('0x1b'),_0x4a74b1?util[_0xc692('0x1c')](_0x4a74b1,{'showHidden':![],'depth':null}):'');});}exports[_0xc692('0x1d')]=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 f9f4f35..165d94d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf56b=['catch','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2'];(function(_0x64976f,_0x3cdab6){var _0x5533a7=function(_0x57236e){while(--_0x57236e){_0x64976f['push'](_0x64976f['shift']());}};_0x5533a7(++_0x3cdab6);}(_0xf56b,0xfd));var _0xbf56=function(_0x125fce,_0x5cd9d4){_0x125fce=_0x125fce-0x0;var _0x5e2320=_0xf56b[_0x125fce];return _0x5e2320;};'use strict';var util=require('util');var db=require(_0xbf56('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbf56('0x1')]({'id':i,'firstName':_0xbf56('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbf56('0x3')+i+_0xbf56('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbf56('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xbf56('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbf56('0x5')](),'updatedAt':Date[_0xbf56('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbf56('0x1')]({'id':i,'firstName':_0xbf56('0x2')+i,'lastName':_0xbf56('0x6')+i,'phone':0xf879fb460+i,'email':_0xbf56('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xbf56('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbf56('0x5')](),'updatedAt':Date['now']()});}db[_0xbf56('0x7')][_0xbf56('0x8')]({'where':{}})[_0xbf56('0x9')](function(){return db['CmContact'][_0xbf56('0xa')](contacts);})[_0xbf56('0x9')](function(){console[_0xbf56('0xb')](_0xbf56('0xc'),_0xbf56('0xd'));return db['CmHopper'][_0xbf56('0x8')]({'where':{}});})['then'](function(){return db[_0xbf56('0xe')][_0xbf56('0xa')](hopper);})['then'](function(){console[_0xbf56('0xb')](_0xbf56('0xc'),_0xbf56('0xf'));return db[_0xbf56('0x7')][_0xbf56('0xa')](contacts2);})[_0xbf56('0x9')](function(){console[_0xbf56('0xb')](_0xbf56('0xc'),'contacts2');return db['CmHopper'][_0xbf56('0xa')](hopper2);})[_0xbf56('0x9')](function(){console['log'](_0xbf56('0xc'),_0xbf56('0x10'));})[_0xbf56('0x11')](function(_0x49ee0d){console[_0xbf56('0xb')](_0x49ee0d);}); \ No newline at end of file +var _0x562a=['destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact'];(function(_0x2cc761,_0x59ce9f){var _0x5c160b=function(_0x1376ba){while(--_0x1376ba){_0x2cc761['push'](_0x2cc761['shift']());}};_0x5c160b(++_0x59ce9f);}(_0x562a,0x76));var _0xa562=function(_0x164399,_0x5a7a6c){_0x164399=_0x164399-0x0;var _0x155835=_0x562a[_0x164399];return _0x155835;};'use strict';var util=require('util');var db=require(_0xa562('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xa562('0x1')]({'id':i,'firstName':_0xa562('0x2')+i,'lastName':_0xa562('0x3')+i,'phone':0xf879fb460+i,'email':_0xa562('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xa562('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa562('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xa562('0x1')]({'id':i,'firstName':_0xa562('0x2')+i,'lastName':_0xa562('0x3')+i,'phone':0xf879fb460+i,'email':_0xa562('0x4')+i+_0xa562('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xa562('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xa562('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xa562('0x5')]()});}db[_0xa562('0x7')][_0xa562('0x8')]({'where':{}})[_0xa562('0x9')](function(){return db[_0xa562('0x7')][_0xa562('0xa')](contacts);})[_0xa562('0x9')](function(){console[_0xa562('0xb')](_0xa562('0xc'),_0xa562('0xd'));return db[_0xa562('0xe')][_0xa562('0x8')]({'where':{}});})[_0xa562('0x9')](function(){return db[_0xa562('0xe')][_0xa562('0xa')](hopper);})['then'](function(){console[_0xa562('0xb')](_0xa562('0xc'),_0xa562('0xf'));return db[_0xa562('0x7')][_0xa562('0xa')](contacts2);})['then'](function(){console[_0xa562('0xb')](_0xa562('0xc'),_0xa562('0x10'));return db[_0xa562('0xe')][_0xa562('0xa')](hopper2);})[_0xa562('0x9')](function(){console[_0xa562('0xb')](_0xa562('0xc'),'hopper2');})[_0xa562('0x11')](function(_0x363a91){console['log'](_0x363a91);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 33bc067..ad5c01a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a9f=['add\x20user','log','util','push','format','%s%s','agent','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x5a9f,0x17c));var _0xf5a9=function(_0x1cddff,_0x5c41c1){_0x1cddff=_0x1cddff-0x0;var _0x496d09=_0x5a9f[_0x1cddff];return _0x496d09;};'use strict';var util=require(_0xf5a9('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf5a9('0x1')]({'name':util[_0xf5a9('0x2')](_0xf5a9('0x3'),_0xf5a9('0x4'),i),'fullname':util['format'](_0xf5a9('0x3'),_0xf5a9('0x4'),i),'email':util['format']('%s%s@xcally.com',_0xf5a9('0x4'),i),'role':_0xf5a9('0x4'),'password':_0xf5a9('0x5'),'internal':0xfa0+i,'type':'friend','transport':[_0xf5a9('0x6'),'ws',_0xf5a9('0x7')],'disallow':[_0xf5a9('0x8')],'allow':[_0xf5a9('0x9')],'defaultuser':util[_0xf5a9('0x2')]('%s%s',_0xf5a9('0x4'),i),'encryption':_0xf5a9('0xa'),'avpf':_0xf5a9('0xa'),'force_avp':'yes','icesupport':_0xf5a9('0xa'),'dtlsenable':_0xf5a9('0xa'),'dtlsverify':'no','dtlscertfile':_0xf5a9('0xb'),'dtlsprivatekey':_0xf5a9('0xc'),'dtlssetup':'actpass','callerid':util[_0xf5a9('0x2')](_0xf5a9('0xd'),util['format'](_0xf5a9('0x3'),_0xf5a9('0x4'),i),0xfa0+i)});}db[_0xf5a9('0xe')]['bulkCreate'](users)[_0xf5a9('0xf')](function(){console['log'](_0xf5a9('0x10'));})['catch'](function(_0x3b1650){console[_0xf5a9('0x11')](_0x3b1650);}); \ No newline at end of file +var _0xd2c1=['udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','../mysqldb','push','format','%s%s','%s%s@xcally.com','agent','password','friend'];(function(_0x4631eb,_0x55649e){var _0x562eca=function(_0x25a436){while(--_0x25a436){_0x4631eb['push'](_0x4631eb['shift']());}};_0x562eca(++_0x55649e);}(_0xd2c1,0x6a));var _0x1d2c=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0xd2c1[_0x4af01e];return _0x178c11;};'use strict';var util=require('util');var db=require(_0x1d2c('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1d2c('0x1')]({'name':util[_0x1d2c('0x2')](_0x1d2c('0x3'),'agent',i),'fullname':util[_0x1d2c('0x2')](_0x1d2c('0x3'),'agent',i),'email':util[_0x1d2c('0x2')](_0x1d2c('0x4'),_0x1d2c('0x5'),i),'role':_0x1d2c('0x5'),'password':_0x1d2c('0x6'),'internal':0xfa0+i,'type':_0x1d2c('0x7'),'transport':[_0x1d2c('0x8'),'ws','wss'],'disallow':[_0x1d2c('0x9')],'allow':[_0x1d2c('0xa')],'defaultuser':util[_0x1d2c('0x2')]('%s%s',_0x1d2c('0x5'),i),'encryption':_0x1d2c('0xb'),'avpf':_0x1d2c('0xb'),'force_avp':_0x1d2c('0xb'),'icesupport':_0x1d2c('0xb'),'dtlsenable':_0x1d2c('0xb'),'dtlsverify':'no','dtlscertfile':_0x1d2c('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x1d2c('0x2')](_0x1d2c('0xd'),util['format']('%s%s',_0x1d2c('0x5'),i),0xfa0+i)});}db[_0x1d2c('0xe')][_0x1d2c('0xf')](users)[_0x1d2c('0x10')](function(){console[_0x1d2c('0x11')](_0x1d2c('0x12'));})['catch'](function(_0x50f72b){console[_0x1d2c('0x11')](_0x50f72b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 741f2be..9abbc78 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76e4=['User','role','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','type','%s:queue:%s','format','user:%s','query','find','userProfileId','handshake','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','MailQueue','WhatsappQueues','voice:inbound','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','connection','address','request','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents'];(function(_0x89a7ea,_0x15aa82){var _0x4cdbf0=function(_0x27162d){while(--_0x27162d){_0x89a7ea['push'](_0x89a7ea['shift']());}};_0x4cdbf0(++_0x15aa82);}(_0x76e4,0x12c));var _0x476e=function(_0x4045d1,_0x5d14bf){_0x4045d1=_0x4045d1-0x0;var _0x50764c=_0x76e4[_0x4045d1];return _0x50764c;};'use strict';var _=require(_0x476e('0x0'));var util=require('util');var BPromise=require(_0x476e('0x1'));var db=require(_0x476e('0x2'))['db'];var config=require(_0x476e('0x3'));var queryQueues={'attributes':['id',_0x476e('0x4')],'include':[{'as':_0x476e('0x5'),'model':db[_0x476e('0x6')],'attributes':['id',_0x476e('0x4'),_0x476e('0x7')],'raw':!![],'where':{'role':_0x476e('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x476e('0x4')],'where':{'role':_0x476e('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x476e('0x4'),'type'],'where':{'type':_0x476e('0x9')}};function getAssociatedResources(_0x803a48,_0x13f896,_0x6b5536){return db[_0x476e('0xa')][_0x476e('0xb')]({'where':{'name':_0x803a48,'userProfileId':_0x13f896},'raw':!![]})[_0x476e('0xc')](function(_0x3694ff){if(_0x3694ff){if(_0x3694ff[_0x476e('0xd')]){switch(_0x803a48){case _0x476e('0xe'):case _0x476e('0xf'):case _0x476e('0x10'):case'SmsQueues':case _0x476e('0x11'):case _0x476e('0x12'):case'WhatsappQueues':return db[_0x6b5536][_0x476e('0x13')](queryQueues);case _0x476e('0x14'):return db[_0x6b5536]['findAll'](queryTelephones);case _0x476e('0x15'):return db[_0x6b5536][_0x476e('0x13')](queryTrunks);case _0x476e('0x16'):return db[_0x6b5536][_0x476e('0x13')](queryCampaigns);}}else{return db[_0x476e('0x17')]['findAll']({'attributes':[_0x476e('0x18')],'where':{'sectionId':_0x3694ff['id']},'raw':!![]})['then'](function(_0x4543fb){if(_0x4543fb){var _0x3ce24b={'where':{'id':_[_0x476e('0x19')](_0x4543fb,_0x476e('0x18'))},'raw':!![]};switch(_0x6b5536){case _0x476e('0x6'):_0x3ce24b['where']['role']='telephone';break;case _0x476e('0x1a'):_0x3ce24b['where'][_0x476e('0x1b')]='ivr';break;}return db[_0x6b5536][_0x476e('0x13')](_0x3ce24b);}else{return[];}});}}else{return[];}})[_0x476e('0xc')](function(_0x5caf2e){return _0x5caf2e;});}function joinOrLeaveQueues(_0x26c00e,_0x52cb28,_0xef6e47,_0x2a2924){_0x26c00e[_0x52cb28](util['format'](_0x476e('0x1c'),_0xef6e47,_0x2a2924['name']));if(_0x2a2924['Agents']){for(var _0x946637=0x0;_0x946637<_0x2a2924[_0x476e('0x5')]['length'];_0x946637+=0x1){_0x26c00e[_0x52cb28](util[_0x476e('0x1d')](_0x476e('0x1e'),_0x2a2924['Agents'][_0x946637][_0x476e('0x4')]));}}}function joinOrLeave(_0xf24f5d,_0x469f4f,_0xef5cd0){var _0x574d0d;if(_0xf24f5d['handshake'][_0x476e('0x1f')]['id']){db[_0x476e('0x6')][_0x476e('0x20')]({'attributes':['id',_0x476e('0x4'),_0x476e('0x7'),_0x476e('0x21')],'where':{'id':_0xf24f5d[_0x476e('0x22')][_0x476e('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x476e('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x476e('0x24')],'as':_0x476e('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x476e('0x26')],'as':_0x476e('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x476e('0x28')],'as':_0x476e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x476e('0x2a')],'as':_0x476e('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x476e('0x2c')],'as':_0x476e('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x476e('0xc')](function(_0x21b18c){if(_0x21b18c){_0x574d0d=_0x21b18c;_0xf24f5d[_0x469f4f](util[_0x476e('0x1d')](_0x476e('0x1e'),_0x21b18c['name']));var _0x1ceca1=[];switch(_0x21b18c['role']){case _0x476e('0x2e'):_0xf24f5d[_0x469f4f]('voice:inbound');_0xf24f5d[_0x469f4f](_0x476e('0x2f'));if(queryQueues[_0x476e('0x30')](_0x476e('0x31'))){delete queryQueues[_0x476e('0x31')];}_0x1ceca1[_0x476e('0x32')](db[_0x476e('0x33')]['findAll'](queryQueues));_0x1ceca1[_0x476e('0x32')](db[_0x476e('0x34')][_0x476e('0x13')](queryQueues));_0x1ceca1[_0x476e('0x32')](db[_0x476e('0x35')]['findAll'](queryQueues));_0x1ceca1[_0x476e('0x32')](db[_0x476e('0x36')][_0x476e('0x13')](queryQueues));_0x1ceca1['push'](db['MailQueue'][_0x476e('0x13')](queryQueues));_0x1ceca1[_0x476e('0x32')](db[_0x476e('0x37')][_0x476e('0x13')](queryQueues));_0x1ceca1[_0x476e('0x32')](db[_0x476e('0x38')][_0x476e('0x13')](queryQueues));_0x1ceca1['push'](db[_0x476e('0x6')][_0x476e('0x13')](queryTelephones));_0x1ceca1[_0x476e('0x32')](db[_0x476e('0x39')][_0x476e('0x13')](queryTrunks));_0x1ceca1[_0x476e('0x32')](db[_0x476e('0x1a')][_0x476e('0x13')](queryCampaigns));_0x1ceca1['push'](db[_0x476e('0x6')][_0x476e('0x13')](queryAgents));break;case _0x476e('0x3a'):_0xf24f5d[_0x469f4f]('voice:inbound');_0xf24f5d[_0x469f4f](_0x476e('0x2f'));_0x1ceca1[_0x476e('0x32')](getAssociatedResources(_0x476e('0xe'),_0x21b18c[_0x476e('0x21')],'VoiceQueue'));_0x1ceca1[_0x476e('0x32')](getAssociatedResources(_0x476e('0xf'),_0x21b18c['userProfileId'],_0x476e('0x34')));_0x1ceca1['push'](getAssociatedResources(_0x476e('0x10'),_0x21b18c['userProfileId'],_0x476e('0x35')));_0x1ceca1['push'](getAssociatedResources('SmsQueues',_0x21b18c['userProfileId'],_0x476e('0x36')));_0x1ceca1[_0x476e('0x32')](getAssociatedResources(_0x476e('0x11'),_0x21b18c['userProfileId'],_0x476e('0x3b')));_0x1ceca1[_0x476e('0x32')](getAssociatedResources('OpenchannelQueues',_0x21b18c[_0x476e('0x21')],_0x476e('0x37')));_0x1ceca1[_0x476e('0x32')](getAssociatedResources(_0x476e('0x3c'),_0x21b18c['userProfileId'],_0x476e('0x38')));_0x1ceca1[_0x476e('0x32')](getAssociatedResources(_0x476e('0x14'),_0x21b18c[_0x476e('0x21')],'User'));_0x1ceca1[_0x476e('0x32')](getAssociatedResources(_0x476e('0x15'),_0x21b18c[_0x476e('0x21')],'Trunk'));_0x1ceca1[_0x476e('0x32')](getAssociatedResources(_0x476e('0x16'),_0x21b18c[_0x476e('0x21')],_0x476e('0x1a')));_0x1ceca1[_0x476e('0x32')](db[_0x476e('0x6')][_0x476e('0x13')](queryAgents));break;case _0x476e('0x8'):_0xf24f5d[_0x469f4f](_0x476e('0x3d'));_0xf24f5d[_0x469f4f]('voice:outbound');_0x1ceca1[_0x476e('0x32')](_0x21b18c[_0x476e('0x3e')]({'attributes':['id',_0x476e('0x4')]}));_0x1ceca1[_0x476e('0x32')](_0x21b18c['getChatQueues']({'attributes':['id','name']}));_0x1ceca1['push'](_0x21b18c['getFaxQueues']({'attributes':['id',_0x476e('0x4')]}));_0x1ceca1[_0x476e('0x32')](_0x21b18c[_0x476e('0x3f')]({'attributes':['id',_0x476e('0x4')]}));_0x1ceca1[_0x476e('0x32')](_0x21b18c[_0x476e('0x40')]({'attributes':['id',_0x476e('0x4')]}));_0x1ceca1[_0x476e('0x32')](_0x21b18c[_0x476e('0x41')]({'attributes':['id',_0x476e('0x4')]}));_0x1ceca1[_0x476e('0x32')](_0x21b18c['getWhatsappQueues']({'attributes':['id',_0x476e('0x4')]}));break;}return BPromise['all'](_0x1ceca1);}})[_0x476e('0xc')](function(_0x2186e6){if(_0x2186e6&&_0x2186e6[_0x476e('0x42')]){for(var _0x2d3ddd=0x0;_0x2d3ddd<_0x2186e6[_0x476e('0x42')];_0x2d3ddd+=0x1){for(var _0x29f147=0x0;_0x29f147<_0x2186e6[_0x2d3ddd][_0x476e('0x42')];_0x29f147+=0x1){switch(_0x2d3ddd){case 0x0:joinOrLeaveQueues(_0xf24f5d,_0x469f4f,_0x476e('0x43'),_0x2186e6[_0x2d3ddd][_0x29f147]);break;case 0x1:joinOrLeaveQueues(_0xf24f5d,_0x469f4f,_0x476e('0x44'),_0x2186e6[_0x2d3ddd][_0x29f147]);break;case 0x2:joinOrLeaveQueues(_0xf24f5d,_0x469f4f,_0x476e('0x45'),_0x2186e6[_0x2d3ddd][_0x29f147]);break;case 0x3:joinOrLeaveQueues(_0xf24f5d,_0x469f4f,_0x476e('0x46'),_0x2186e6[_0x2d3ddd][_0x29f147]);break;case 0x4:joinOrLeaveQueues(_0xf24f5d,_0x469f4f,_0x476e('0x47'),_0x2186e6[_0x2d3ddd][_0x29f147]);break;case 0x5:joinOrLeaveQueues(_0xf24f5d,_0x469f4f,_0x476e('0x48'),_0x2186e6[_0x2d3ddd][_0x29f147]);break;case 0x6:joinOrLeaveQueues(_0xf24f5d,_0x469f4f,_0x476e('0x49'),_0x2186e6[_0x2d3ddd][_0x29f147]);break;case 0x7:if(_0x574d0d[_0x476e('0x7')]!==_0x476e('0x8'))_0xf24f5d[_0x469f4f](util['format'](_0x476e('0x4a'),_0x2186e6[_0x2d3ddd][_0x29f147][_0x476e('0x4')]));break;case 0x8:if(_0x574d0d[_0x476e('0x7')]!==_0x476e('0x8'))_0xf24f5d[_0x469f4f](util[_0x476e('0x1d')](_0x476e('0x4b'),_0x2186e6[_0x2d3ddd][_0x29f147][_0x476e('0x4')]));break;case 0x9:if(_0x574d0d[_0x476e('0x7')]!=='agent')_0xf24f5d[_0x469f4f](util[_0x476e('0x1d')](_0x476e('0x4c'),_0x2186e6[_0x2d3ddd][_0x29f147][_0x476e('0x1b')],_0x2186e6[_0x2d3ddd][_0x29f147][_0x476e('0x4')]));break;case 0xa:_0xf24f5d[_0x469f4f](util['format'](_0x476e('0x1e'),_0x2186e6[_0x2d3ddd][_0x29f147][_0x476e('0x4')]));break;}}}}})['then'](function(){if(_0x469f4f===_0x476e('0x4d')){var _0xb03317=_[_0x476e('0x19')](_0x574d0d[_0x476e('0x23')],'id');return _0x574d0d[_0x476e('0x4e')](_0xb03317)[_0x476e('0xc')](function(){for(var _0x50b366=0x0;_0x50b366<_0xb03317['length'];_0x50b366+=0x1){_0xef5cd0[_0x476e('0x4f')](_0x476e('0x50'),{'ChatInteractionId':Number(_0xb03317[_0x50b366]),'UserId':Number(_0x574d0d['id'])});}});}})['then'](function(){if(_0x469f4f==='leave'){var _0x206b5f=_[_0x476e('0x19')](_0x574d0d['MailInteractions'],'id');return _0x574d0d['removeMailInteractions'](_0x206b5f)[_0x476e('0xc')](function(){for(var _0x993d7e=0x0;_0x993d7e<_0x206b5f[_0x476e('0x42')];_0x993d7e+=0x1){_0xef5cd0[_0x476e('0x4f')](_0x476e('0x51'),{'MailInteractionId':Number(_0x206b5f[_0x993d7e]),'UserId':Number(_0x574d0d['id'])});}});}})['then'](function(){if(_0x469f4f===_0x476e('0x4d')){var _0x330e92=_['map'](_0x574d0d['FaxInteractions'],'id');return _0x574d0d[_0x476e('0x52')](_0x330e92)[_0x476e('0xc')](function(){for(var _0x31e7bc=0x0;_0x31e7bc<_0x330e92[_0x476e('0x42')];_0x31e7bc+=0x1){_0xef5cd0[_0x476e('0x4f')](_0x476e('0x53'),{'FaxInteractionId':Number(_0x330e92[_0x31e7bc]),'UserId':Number(_0x574d0d['id'])});}});}})[_0x476e('0xc')](function(){if(_0x469f4f===_0x476e('0x4d')){var _0x5c79a2=_['map'](_0x574d0d[_0x476e('0x29')],'id');return _0x574d0d[_0x476e('0x54')](_0x5c79a2)[_0x476e('0xc')](function(){for(var _0x58dfa7=0x0;_0x58dfa7<_0x5c79a2['length'];_0x58dfa7+=0x1){_0xef5cd0[_0x476e('0x4f')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x5c79a2[_0x58dfa7]),'UserId':Number(_0x574d0d['id'])});}});}})[_0x476e('0xc')](function(){if(_0x469f4f==='leave'){var _0x11c0ac=_[_0x476e('0x19')](_0x574d0d[_0x476e('0x2b')],'id');return _0x574d0d[_0x476e('0x55')](_0x11c0ac)[_0x476e('0xc')](function(){for(var _0x2727a4=0x0;_0x2727a4<_0x11c0ac[_0x476e('0x42')];_0x2727a4+=0x1){_0xef5cd0[_0x476e('0x4f')](_0x476e('0x56'),{'OpenchannelInteractionId':Number(_0x11c0ac[_0x2727a4]),'UserId':Number(_0x574d0d['id'])});}});}})['then'](function(){if(_0x469f4f===_0x476e('0x4d')){var _0x45bc7e=_['map'](_0x574d0d[_0x476e('0x2d')],'id');return _0x574d0d[_0x476e('0x57')](_0x45bc7e)[_0x476e('0xc')](function(){for(var _0x4300fe=0x0;_0x4300fe<_0x45bc7e[_0x476e('0x42')];_0x4300fe+=0x1){_0xef5cd0[_0x476e('0x4f')](_0x476e('0x58'),{'WhatsappInteractionId':Number(_0x45bc7e[_0x4300fe]),'UserId':Number(_0x574d0d['id'])});}});}})['catch'](function(_0x27bfb3){_0xf24f5d['log'](_0x27bfb3);});}}function onDisconnect(_0x327003,_0x29cd82){joinOrLeave(_0x327003,_0x476e('0x4d'),_0x29cd82);}function onConnect(_0x1c5bc8){joinOrLeave(_0x1c5bc8,_0x476e('0x59'));}exports[_0x476e('0x5a')]=function(_0x2f0656){_0x2f0656['on'](_0x476e('0x5b'),function(_0x21bc19){_0x21bc19['setMaxListeners'](0x0);_0x21bc19[_0x476e('0x5c')]=_0x21bc19[_0x476e('0x5d')][_0x476e('0x5b')]['remoteAddress']+':'+_0x21bc19['request'][_0x476e('0x5b')][_0x476e('0x5e')];_0x21bc19[_0x476e('0x5f')]=new Date();_0x21bc19[_0x476e('0x60')]=function(_0x1b4423){console[_0x476e('0x60')](_0x476e('0x61')+_0x21bc19[_0x476e('0x62')][_0x476e('0x4')]+'['+_0x21bc19['address']+']',_0x1b4423);};_0x21bc19['on'](_0x476e('0x63'),function(){onDisconnect(_0x21bc19,_0x2f0656);_0x21bc19['log'](_0x476e('0x64'));});onConnect(_0x21bc19);_0x21bc19['log'](_0x476e('0x65'));});}; \ No newline at end of file +var _0xebb6=['IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','%s:queue:%s','Agents','format','handshake','query','find','userProfileId','MailInteractions','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','VoiceQueue','ChatQueue','push','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','FaxQueues','agent','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','all','length','voice','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','User','role','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xebb6,0x17e));var _0x6ebb=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xebb6[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require('lodash');var util=require(_0x6ebb('0x0'));var BPromise=require(_0x6ebb('0x1'));var db=require(_0x6ebb('0x2'))['db'];var config=require(_0x6ebb('0x3'));var queryQueues={'attributes':['id',_0x6ebb('0x4')],'include':[{'as':'Agents','model':db[_0x6ebb('0x5')],'attributes':['id',_0x6ebb('0x4'),_0x6ebb('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6ebb('0x4')],'where':{'role':_0x6ebb('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6ebb('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6ebb('0x4'),_0x6ebb('0x8')],'where':{'type':_0x6ebb('0x9')}};function getAssociatedResources(_0x4829ff,_0x49c43c,_0x594c03){return db[_0x6ebb('0xa')][_0x6ebb('0xb')]({'where':{'name':_0x4829ff,'userProfileId':_0x49c43c},'raw':!![]})['then'](function(_0x250d04){if(_0x250d04){if(_0x250d04[_0x6ebb('0xc')]){switch(_0x4829ff){case _0x6ebb('0xd'):case _0x6ebb('0xe'):case'FaxQueues':case _0x6ebb('0xf'):case _0x6ebb('0x10'):case _0x6ebb('0x11'):case _0x6ebb('0x12'):return db[_0x594c03]['findAll'](queryQueues);case _0x6ebb('0x13'):return db[_0x594c03][_0x6ebb('0x14')](queryTelephones);case _0x6ebb('0x15'):return db[_0x594c03][_0x6ebb('0x14')](queryTrunks);case _0x6ebb('0x16'):return db[_0x594c03][_0x6ebb('0x14')](queryCampaigns);}}else{return db[_0x6ebb('0x17')]['findAll']({'attributes':[_0x6ebb('0x18')],'where':{'sectionId':_0x250d04['id']},'raw':!![]})[_0x6ebb('0x19')](function(_0x33b875){if(_0x33b875){var _0x38c09e={'where':{'id':_[_0x6ebb('0x1a')](_0x33b875,_0x6ebb('0x18'))},'raw':!![]};switch(_0x594c03){case _0x6ebb('0x5'):_0x38c09e[_0x6ebb('0x1b')][_0x6ebb('0x6')]='telephone';break;case _0x6ebb('0x1c'):_0x38c09e[_0x6ebb('0x1b')][_0x6ebb('0x8')]=_0x6ebb('0x9');break;}return db[_0x594c03][_0x6ebb('0x14')](_0x38c09e);}else{return[];}});}}else{return[];}})[_0x6ebb('0x19')](function(_0x384c30){return _0x384c30;});}function joinOrLeaveQueues(_0x44fd33,_0x274bdb,_0x54201c,_0x53990c){_0x44fd33[_0x274bdb](util['format'](_0x6ebb('0x1d'),_0x54201c,_0x53990c[_0x6ebb('0x4')]));if(_0x53990c[_0x6ebb('0x1e')]){for(var _0x27487c=0x0;_0x27487c<_0x53990c[_0x6ebb('0x1e')]['length'];_0x27487c+=0x1){_0x44fd33[_0x274bdb](util[_0x6ebb('0x1f')]('user:%s',_0x53990c[_0x6ebb('0x1e')][_0x27487c][_0x6ebb('0x4')]));}}}function joinOrLeave(_0x7d43be,_0x23a482,_0x36e82a){var _0x2a01ee;if(_0x7d43be[_0x6ebb('0x20')][_0x6ebb('0x21')]['id']){db['User'][_0x6ebb('0x22')]({'attributes':['id',_0x6ebb('0x4'),_0x6ebb('0x6'),_0x6ebb('0x23')],'where':{'id':_0x7d43be[_0x6ebb('0x20')][_0x6ebb('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x6ebb('0x24'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x6ebb('0x25'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x6ebb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x6ebb('0x27')],'as':_0x6ebb('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x6ebb('0x29')],'as':_0x6ebb('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x6ebb('0x19')](function(_0x2c0724){if(_0x2c0724){_0x2a01ee=_0x2c0724;_0x7d43be[_0x23a482](util[_0x6ebb('0x1f')]('user:%s',_0x2c0724[_0x6ebb('0x4')]));var _0x3dcb57=[];switch(_0x2c0724['role']){case _0x6ebb('0x2b'):_0x7d43be[_0x23a482](_0x6ebb('0x2c'));_0x7d43be[_0x23a482]('voice:outbound');if(queryQueues[_0x6ebb('0x2d')](_0x6ebb('0x2e'))){delete queryQueues[_0x6ebb('0x2e')];}_0x3dcb57['push'](db[_0x6ebb('0x2f')][_0x6ebb('0x14')](queryQueues));_0x3dcb57['push'](db[_0x6ebb('0x30')][_0x6ebb('0x14')](queryQueues));_0x3dcb57[_0x6ebb('0x31')](db[_0x6ebb('0x32')]['findAll'](queryQueues));_0x3dcb57['push'](db[_0x6ebb('0x33')]['findAll'](queryQueues));_0x3dcb57['push'](db['MailQueue'][_0x6ebb('0x14')](queryQueues));_0x3dcb57[_0x6ebb('0x31')](db[_0x6ebb('0x34')][_0x6ebb('0x14')](queryQueues));_0x3dcb57[_0x6ebb('0x31')](db[_0x6ebb('0x35')][_0x6ebb('0x14')](queryQueues));_0x3dcb57['push'](db[_0x6ebb('0x5')]['findAll'](queryTelephones));_0x3dcb57[_0x6ebb('0x31')](db[_0x6ebb('0x36')][_0x6ebb('0x14')](queryTrunks));_0x3dcb57[_0x6ebb('0x31')](db[_0x6ebb('0x1c')][_0x6ebb('0x14')](queryCampaigns));_0x3dcb57[_0x6ebb('0x31')](db[_0x6ebb('0x5')][_0x6ebb('0x14')](queryAgents));break;case _0x6ebb('0x37'):_0x7d43be[_0x23a482](_0x6ebb('0x2c'));_0x7d43be[_0x23a482](_0x6ebb('0x38'));_0x3dcb57[_0x6ebb('0x31')](getAssociatedResources(_0x6ebb('0xd'),_0x2c0724[_0x6ebb('0x23')],_0x6ebb('0x2f')));_0x3dcb57[_0x6ebb('0x31')](getAssociatedResources(_0x6ebb('0xe'),_0x2c0724[_0x6ebb('0x23')],_0x6ebb('0x30')));_0x3dcb57[_0x6ebb('0x31')](getAssociatedResources(_0x6ebb('0x39'),_0x2c0724[_0x6ebb('0x23')],_0x6ebb('0x32')));_0x3dcb57[_0x6ebb('0x31')](getAssociatedResources(_0x6ebb('0xf'),_0x2c0724['userProfileId'],_0x6ebb('0x33')));_0x3dcb57[_0x6ebb('0x31')](getAssociatedResources(_0x6ebb('0x10'),_0x2c0724[_0x6ebb('0x23')],'MailQueue'));_0x3dcb57[_0x6ebb('0x31')](getAssociatedResources('OpenchannelQueues',_0x2c0724[_0x6ebb('0x23')],_0x6ebb('0x34')));_0x3dcb57[_0x6ebb('0x31')](getAssociatedResources(_0x6ebb('0x12'),_0x2c0724[_0x6ebb('0x23')],_0x6ebb('0x35')));_0x3dcb57[_0x6ebb('0x31')](getAssociatedResources(_0x6ebb('0x13'),_0x2c0724[_0x6ebb('0x23')],_0x6ebb('0x5')));_0x3dcb57[_0x6ebb('0x31')](getAssociatedResources(_0x6ebb('0x15'),_0x2c0724[_0x6ebb('0x23')],_0x6ebb('0x36')));_0x3dcb57[_0x6ebb('0x31')](getAssociatedResources(_0x6ebb('0x16'),_0x2c0724['userProfileId'],_0x6ebb('0x1c')));_0x3dcb57[_0x6ebb('0x31')](db[_0x6ebb('0x5')][_0x6ebb('0x14')](queryAgents));break;case _0x6ebb('0x3a'):_0x7d43be[_0x23a482](_0x6ebb('0x2c'));_0x7d43be[_0x23a482](_0x6ebb('0x38'));_0x3dcb57['push'](_0x2c0724['getVoiceQueues']({'attributes':['id','name']}));_0x3dcb57[_0x6ebb('0x31')](_0x2c0724[_0x6ebb('0x3b')]({'attributes':['id',_0x6ebb('0x4')]}));_0x3dcb57[_0x6ebb('0x31')](_0x2c0724[_0x6ebb('0x3c')]({'attributes':['id',_0x6ebb('0x4')]}));_0x3dcb57[_0x6ebb('0x31')](_0x2c0724[_0x6ebb('0x3d')]({'attributes':['id','name']}));_0x3dcb57['push'](_0x2c0724[_0x6ebb('0x3e')]({'attributes':['id','name']}));_0x3dcb57['push'](_0x2c0724['getOpenchannelQueues']({'attributes':['id',_0x6ebb('0x4')]}));_0x3dcb57[_0x6ebb('0x31')](_0x2c0724['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x6ebb('0x3f')](_0x3dcb57);}})[_0x6ebb('0x19')](function(_0x189314){if(_0x189314&&_0x189314[_0x6ebb('0x40')]){for(var _0x1c3e11=0x0;_0x1c3e11<_0x189314['length'];_0x1c3e11+=0x1){for(var _0x5cf5cf=0x0;_0x5cf5cf<_0x189314[_0x1c3e11][_0x6ebb('0x40')];_0x5cf5cf+=0x1){switch(_0x1c3e11){case 0x0:joinOrLeaveQueues(_0x7d43be,_0x23a482,_0x6ebb('0x41'),_0x189314[_0x1c3e11][_0x5cf5cf]);break;case 0x1:joinOrLeaveQueues(_0x7d43be,_0x23a482,'chat',_0x189314[_0x1c3e11][_0x5cf5cf]);break;case 0x2:joinOrLeaveQueues(_0x7d43be,_0x23a482,_0x6ebb('0x42'),_0x189314[_0x1c3e11][_0x5cf5cf]);break;case 0x3:joinOrLeaveQueues(_0x7d43be,_0x23a482,_0x6ebb('0x43'),_0x189314[_0x1c3e11][_0x5cf5cf]);break;case 0x4:joinOrLeaveQueues(_0x7d43be,_0x23a482,_0x6ebb('0x44'),_0x189314[_0x1c3e11][_0x5cf5cf]);break;case 0x5:joinOrLeaveQueues(_0x7d43be,_0x23a482,'openchannel',_0x189314[_0x1c3e11][_0x5cf5cf]);break;case 0x6:joinOrLeaveQueues(_0x7d43be,_0x23a482,_0x6ebb('0x45'),_0x189314[_0x1c3e11][_0x5cf5cf]);break;case 0x7:if(_0x2a01ee[_0x6ebb('0x6')]!==_0x6ebb('0x3a'))_0x7d43be[_0x23a482](util[_0x6ebb('0x1f')](_0x6ebb('0x46'),_0x189314[_0x1c3e11][_0x5cf5cf][_0x6ebb('0x4')]));break;case 0x8:if(_0x2a01ee[_0x6ebb('0x6')]!==_0x6ebb('0x3a'))_0x7d43be[_0x23a482](util[_0x6ebb('0x1f')](_0x6ebb('0x47'),_0x189314[_0x1c3e11][_0x5cf5cf][_0x6ebb('0x4')]));break;case 0x9:if(_0x2a01ee[_0x6ebb('0x6')]!==_0x6ebb('0x3a'))_0x7d43be[_0x23a482](util[_0x6ebb('0x1f')](_0x6ebb('0x48'),_0x189314[_0x1c3e11][_0x5cf5cf]['type'],_0x189314[_0x1c3e11][_0x5cf5cf][_0x6ebb('0x4')]));break;case 0xa:_0x7d43be[_0x23a482](util[_0x6ebb('0x1f')]('user:%s',_0x189314[_0x1c3e11][_0x5cf5cf][_0x6ebb('0x4')]));break;}}}}})['then'](function(){if(_0x23a482==='leave'){var _0x1f763f=_[_0x6ebb('0x1a')](_0x2a01ee[_0x6ebb('0x49')],'id');return _0x2a01ee[_0x6ebb('0x4a')](_0x1f763f)[_0x6ebb('0x19')](function(){for(var _0x4dac6f=0x0;_0x4dac6f<_0x1f763f[_0x6ebb('0x40')];_0x4dac6f+=0x1){_0x36e82a[_0x6ebb('0x4b')](_0x6ebb('0x4c'),{'ChatInteractionId':Number(_0x1f763f[_0x4dac6f]),'UserId':Number(_0x2a01ee['id'])});}});}})['then'](function(){if(_0x23a482===_0x6ebb('0x4d')){var _0x48876f=_['map'](_0x2a01ee[_0x6ebb('0x24')],'id');return _0x2a01ee[_0x6ebb('0x4e')](_0x48876f)[_0x6ebb('0x19')](function(){for(var _0x468337=0x0;_0x468337<_0x48876f['length'];_0x468337+=0x1){_0x36e82a[_0x6ebb('0x4b')](_0x6ebb('0x4f'),{'MailInteractionId':Number(_0x48876f[_0x468337]),'UserId':Number(_0x2a01ee['id'])});}});}})[_0x6ebb('0x19')](function(){if(_0x23a482===_0x6ebb('0x4d')){var _0x42ae0b=_[_0x6ebb('0x1a')](_0x2a01ee[_0x6ebb('0x25')],'id');return _0x2a01ee[_0x6ebb('0x50')](_0x42ae0b)['then'](function(){for(var _0x52eb63=0x0;_0x52eb63<_0x42ae0b[_0x6ebb('0x40')];_0x52eb63+=0x1){_0x36e82a[_0x6ebb('0x4b')](_0x6ebb('0x51'),{'FaxInteractionId':Number(_0x42ae0b[_0x52eb63]),'UserId':Number(_0x2a01ee['id'])});}});}})[_0x6ebb('0x19')](function(){if(_0x23a482===_0x6ebb('0x4d')){var _0x5a43e2=_['map'](_0x2a01ee['SmsInteractions'],'id');return _0x2a01ee[_0x6ebb('0x52')](_0x5a43e2)[_0x6ebb('0x19')](function(){for(var _0xd26930=0x0;_0xd26930<_0x5a43e2[_0x6ebb('0x40')];_0xd26930+=0x1){_0x36e82a[_0x6ebb('0x4b')](_0x6ebb('0x53'),{'SmsInteractionId':Number(_0x5a43e2[_0xd26930]),'UserId':Number(_0x2a01ee['id'])});}});}})[_0x6ebb('0x19')](function(){if(_0x23a482===_0x6ebb('0x4d')){var _0x14f527=_[_0x6ebb('0x1a')](_0x2a01ee[_0x6ebb('0x28')],'id');return _0x2a01ee[_0x6ebb('0x54')](_0x14f527)[_0x6ebb('0x19')](function(){for(var _0x53504b=0x0;_0x53504b<_0x14f527[_0x6ebb('0x40')];_0x53504b+=0x1){_0x36e82a[_0x6ebb('0x4b')](_0x6ebb('0x55'),{'OpenchannelInteractionId':Number(_0x14f527[_0x53504b]),'UserId':Number(_0x2a01ee['id'])});}});}})[_0x6ebb('0x19')](function(){if(_0x23a482==='leave'){var _0x11c166=_[_0x6ebb('0x1a')](_0x2a01ee[_0x6ebb('0x2a')],'id');return _0x2a01ee[_0x6ebb('0x56')](_0x11c166)[_0x6ebb('0x19')](function(){for(var _0x5485a2=0x0;_0x5485a2<_0x11c166[_0x6ebb('0x40')];_0x5485a2+=0x1){_0x36e82a[_0x6ebb('0x4b')](_0x6ebb('0x57'),{'WhatsappInteractionId':Number(_0x11c166[_0x5485a2]),'UserId':Number(_0x2a01ee['id'])});}});}})[_0x6ebb('0x58')](function(_0x4100ce){_0x7d43be[_0x6ebb('0x59')](_0x4100ce);});}}function onDisconnect(_0x55fddb,_0x30823d){joinOrLeave(_0x55fddb,_0x6ebb('0x4d'),_0x30823d);}function onConnect(_0x38134e){joinOrLeave(_0x38134e,'join');}exports[_0x6ebb('0x5a')]=function(_0x39b852){_0x39b852['on'](_0x6ebb('0x5b'),function(_0x2b387e){_0x2b387e[_0x6ebb('0x5c')](0x0);_0x2b387e[_0x6ebb('0x5d')]=_0x2b387e[_0x6ebb('0x5e')][_0x6ebb('0x5b')]['remoteAddress']+':'+_0x2b387e[_0x6ebb('0x5e')][_0x6ebb('0x5b')][_0x6ebb('0x5f')];_0x2b387e[_0x6ebb('0x60')]=new Date();_0x2b387e[_0x6ebb('0x59')]=function(_0x12bd32){console['log'](_0x6ebb('0x61')+_0x2b387e[_0x6ebb('0x62')][_0x6ebb('0x4')]+'['+_0x2b387e['address']+']',_0x12bd32);};_0x2b387e['on']('disconnect',function(){onDisconnect(_0x2b387e,_0x39b852);_0x2b387e[_0x6ebb('0x59')](_0x6ebb('0x63'));});onConnect(_0x2b387e);_0x2b387e[_0x6ebb('0x59')](_0x6ebb('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index de44a63..7fd502c 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 _0x5f55=['toLowerCase','condition','util','../../mysqldb','jayson/promise','triggers','client','newinteraction','Chat','ChatInteraction','afterUpdate','ChatMessage','afterCreate','newmessage','Sms','SmsInteraction','closedinteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','EventManager','error','code','Trigger,\x20%s','catch','get','channel','event','direction','UserId','name','interface','format','outgoingmessage','opened','changed','closed','User','find','default','length','hasOwnProperty','model','hook','callback'];(function(_0x2c14ce,_0x47a0f3){var _0x3c0757=function(_0x13ea47){while(--_0x13ea47){_0x2c14ce['push'](_0x2c14ce['shift']());}};_0x3c0757(++_0x47a0f3);}(_0x5f55,0x1f1));var _0x55f5=function(_0xbeb3fb,_0x289ba7){_0xbeb3fb=_0xbeb3fb-0x0;var _0x4b45d5=_0x5f55[_0xbeb3fb];return _0x4b45d5;};'use strict';var util=require(_0x55f5('0x0'));var db=require(_0x55f5('0x1'))['db'];var jayson=require(_0x55f5('0x2'));var logger=require('../logger')(_0x55f5('0x3'));var client=jayson[_0x55f5('0x4')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':'afterCreate','condition':_0x55f5('0x5'),'callback':afterCreate},{'channel':_0x55f5('0x6'),'model':_0x55f5('0x7'),'event':_0x55f5('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x55f5('0x6'),'model':_0x55f5('0x9'),'event':_0x55f5('0xa'),'condition':_0x55f5('0xb'),'callback':afterCreateMessage},{'channel':_0x55f5('0xc'),'model':_0x55f5('0xd'),'event':_0x55f5('0xa'),'condition':_0x55f5('0x5'),'callback':afterCreate},{'channel':_0x55f5('0xc'),'model':'SmsInteraction','event':_0x55f5('0x8'),'condition':_0x55f5('0xe'),'callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':'afterCreate','condition':_0x55f5('0xb'),'callback':afterCreateMessage},{'channel':_0x55f5('0xf'),'model':'WhatsappInteraction','event':_0x55f5('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x55f5('0xf'),'model':'WhatsappInteraction','event':_0x55f5('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x55f5('0xf'),'model':_0x55f5('0x10'),'event':_0x55f5('0xa'),'condition':_0x55f5('0xb'),'callback':afterCreateMessage},{'channel':_0x55f5('0x11'),'model':'FaxInteraction','event':_0x55f5('0xa'),'condition':_0x55f5('0x5'),'callback':afterCreate},{'channel':'Fax','model':_0x55f5('0x12'),'event':_0x55f5('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x55f5('0x11'),'model':_0x55f5('0x13'),'event':_0x55f5('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x55f5('0x14'),'model':'MailInteraction','event':_0x55f5('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x55f5('0x14'),'model':_0x55f5('0x15'),'event':_0x55f5('0x8'),'condition':_0x55f5('0xe'),'callback':afterUpdate},{'channel':_0x55f5('0x14'),'model':_0x55f5('0x16'),'event':_0x55f5('0xa'),'condition':_0x55f5('0xb'),'callback':afterCreateMessage},{'channel':_0x55f5('0x17'),'model':'OpenchannelInteraction','event':_0x55f5('0xa'),'condition':_0x55f5('0x5'),'callback':afterCreate},{'channel':_0x55f5('0x17'),'model':_0x55f5('0x18'),'event':_0x55f5('0x8'),'condition':_0x55f5('0xe'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x55f5('0x19'),'event':_0x55f5('0xa'),'condition':_0x55f5('0xb'),'callback':afterCreateMessage}];function request(_0x15ffd9){return client[_0x55f5('0x1a')]('EventManager',_0x15ffd9)[_0x55f5('0x1b')](function(_0x13428e){logger['info']('Trigger,\x20%s',_0x55f5('0x1c'),_0x13428e);if(_0x13428e[_0x55f5('0x1d')]){if(_0x13428e[_0x55f5('0x1d')][_0x55f5('0x1e')]===0x1f4){logger[_0x55f5('0x1d')](_0x55f5('0x1f'),'EventManager',_0x13428e[_0x55f5('0x1d')]);}}})[_0x55f5('0x20')](function(_0x35a9a3){logger['error'](_0x55f5('0x1f'),_0x55f5('0x1c'),_0x35a9a3);});}function afterCreateMessage(_0x2d878c,_0x20149e){return function(_0x54eac1,_0x3cbf4d){_0x54eac1=_0x54eac1[_0x55f5('0x21')]({'plain':!![]});_0x54eac1[_0x55f5('0x22')]=_0x2d878c;_0x54eac1[_0x55f5('0x23')]=_0x54eac1[_0x55f5('0x24')];if(_0x54eac1[_0x55f5('0x25')]){return db['User']['find']({'where':{'id':_0x54eac1[_0x55f5('0x25')]},'attributes':['id',_0x55f5('0x26')],'raw':!![]})[_0x55f5('0x1b')](function(_0x4e5c67){_0x54eac1[_0x55f5('0x27')]=util[_0x55f5('0x28')]('SIP/%s',_0x4e5c67['name']);_0x54eac1[_0x55f5('0x22')]=_0x2d878c;return request({'event':'incomingmessage','message':_0x54eac1});})['catch'](function(_0x5ef712){console[_0x55f5('0x1d')](_0x5ef712);});}else{return request({'event':_0x55f5('0x29'),'message':_0x54eac1});}};}function afterCreate(_0x5009ff,_0x2cc570){return function(_0x4c9032,_0x18228a){_0x4c9032=_0x4c9032[_0x55f5('0x21')]({'plain':!![]});_0x4c9032[_0x55f5('0x22')]=_0x5009ff;_0x4c9032[_0x55f5('0x23')]=_0x55f5('0x2a');return request({'event':_0x2cc570,'message':_0x4c9032});};}function afterUpdate(_0x5cedd4,_0x5e6a60){return function(_0x541780,_0x3e126b){if(_0x541780[_0x55f5('0x2b')](_0x55f5('0x2c'))&&_0x541780[_0x55f5('0x2c')]){_0x541780=_0x541780[_0x55f5('0x21')]({'plain':!![]});_0x541780[_0x55f5('0x22')]=_0x5cedd4;_0x541780[_0x55f5('0x23')]=_0x55f5('0x2c');if(_0x541780[_0x55f5('0x25')]){return db[_0x55f5('0x2d')][_0x55f5('0x2e')]({'where':{'id':_0x541780['UserId']},'attributes':['id','name'],'raw':!![]})[_0x55f5('0x1b')](function(_0x3cd324){_0x541780['interface']=util[_0x55f5('0x28')]('SIP/%s',_0x3cd324[_0x55f5('0x26')]);return request({'event':_0x5e6a60,'message':_0x541780});})[_0x55f5('0x20')](function(_0x25b434){console[_0x55f5('0x1d')](_0x25b434);});}else{return request({'event':_0x5e6a60,'message':_0x541780});}}};}exports[_0x55f5('0x2f')]=function(){for(var _0x46ae29=0x0;_0x46ae29=_0x46bf8b[_0x1bb0('0x15')]){throw Error(_0x1bb0('0x16'));}_0x2cb330(_0x5e83df);})[_0x1bb0('0x17')](function(_0x455fe5){_0x2cc8b8(_0x455fe5);});});}; \ No newline at end of file +var _0x2e6c=['mail','chat','fax','sms','whatsapp','openchannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird'];(function(_0x40ca11,_0x28a4be){var _0x1e1544=function(_0x3e1985){while(--_0x3e1985){_0x40ca11['push'](_0x40ca11['shift']());}};_0x1e1544(++_0x28a4be);}(_0x2e6c,0xbc));var _0xc2e6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2e6c[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var BPromise=require(_0xc2e6('0x0'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0xc2e6('0x1'),_0xc2e6('0x2'),_0xc2e6('0x3'),_0xc2e6('0x4'),_0xc2e6('0x5'),_0xc2e6('0x6')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x1d59a7){_0x1d59a7=_0x1d59a7[_0xc2e6('0x7')]();return _[_0xc2e6('0x8')](channels,_0x1d59a7);};exports[_0xc2e6('0x9')]=function(_0x4d2dbc,_0x3c71db,_0x79370f,_0x25b928){var _0x32f98b={'loginAttempts':_0x3c71db,'blocked':_0x79370f};if(!_[_0xc2e6('0xa')](_0x25b928)){_0x32f98b[_0xc2e6('0xb')]=_0x25b928;}return _0x4d2dbc[_0xc2e6('0xc')](_0x32f98b);};exports[_0xc2e6('0xd')]=function(_0x32302d){return new BPromise(function(_0x2152a2,_0x5e3eb4){var _0xb2e51a=0x0;if(_0x32302d[_0xc2e6('0xe')]!==_0xc2e6('0xf')){_0x2152a2(_0x32302d);}db['User'][_0xc2e6('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x32302d['id']}}})[_0xc2e6('0x11')](function(_0x44c5af){_0xb2e51a=_0x44c5af;return util['getLicense']();})['then'](function(_0x3b4f4b){if(_0x3b4f4b&&_0x3b4f4b[_0xc2e6('0x12')]&&_0xb2e51a>=_0x3b4f4b[_0xc2e6('0x12')]){throw Error(_0xc2e6('0x13'));}_0x2152a2(_0x32302d);})[_0xc2e6('0x14')](function(_0x581830){_0x5e3eb4(_0x581830);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 7d09cfe..9e11a15 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76b4=['404','status','send','exports'];(function(_0x3fab10,_0x75e2af){var _0x30ef04=function(_0xc29024){while(--_0xc29024){_0x3fab10['push'](_0x3fab10['shift']());}};_0x30ef04(++_0x75e2af);}(_0x76b4,0x14b));var _0x476b=function(_0x36dcd5,_0x125980){_0x36dcd5=_0x36dcd5-0x0;var _0x1edee9=_0x76b4[_0x36dcd5];return _0x1edee9;};'use strict';module[_0x476b('0x0')][0x194]=function pageNotFound(_0x1dc11f,_0x61d0b8){var _0x3802e2=_0x476b('0x1');var _0x20ed84=0x194;var _0x32ae28={'status':_0x20ed84};_0x61d0b8[_0x476b('0x2')](_0x32ae28[_0x476b('0x2')]);_0x61d0b8['render'](_0x3802e2,{},function(_0x5a003d,_0x4d4717){if(_0x5a003d){return _0x61d0b8['status'](_0x32ae28[_0x476b('0x2')])['json'](_0x32ae28);}_0x61d0b8[_0x476b('0x3')](_0x4d4717);});}; \ No newline at end of file +var _0xb8f8=['exports','status','render','json'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xb8f8,0x1cc));var _0x8b8f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xb8f8[_0x4e676e];return _0x336a3c;};'use strict';module[_0x8b8f('0x0')][0x194]=function pageNotFound(_0x4855fd,_0x7ed2fb){var _0x2c1a01='404';var _0x470c31=0x194;var _0x4001ed={'status':_0x470c31};_0x7ed2fb[_0x8b8f('0x1')](_0x4001ed[_0x8b8f('0x1')]);_0x7ed2fb[_0x8b8f('0x2')](_0x2c1a01,{},function(_0x121002,_0x3b21cb){if(_0x121002){return _0x7ed2fb['status'](_0x4001ed[_0x8b8f('0x1')])[_0x8b8f('0x3')](_0x4001ed);}_0x7ed2fb['send'](_0x3b21cb);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 0caabd7..eef5b9c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82ba=['CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/team/team.model','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','ReportAgentPreview','FaxInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','BlackLists','mailboxuser','mailbox','VoiceCallReport','uniqueid','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','Imap','Dispositions','Answers','Interactions','MailApplication','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','Messages','MailInteractionId','Owner','mail_interaction_has_tags','ThroughTags','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','restrict','List','ListId','FaxAccountId','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','Teams','FaxQueueReport','SmsAccountId','user_has_sms_accounts','Tags','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueue','OpenchannelQueueId','IntervalId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','Agent','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','Attachments','team_has_chat_queues','ChatGroupId','CompanyId','OpenchannelInteractions','ChatInteractions','Company','cm_contact_has_tags','Queue','Campaign','CampaignId','CmHopperBlack','Automation','All','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Sound','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','Trigger','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','AnalyticFieldReport','Fields','DefaultReportId','MetricId','Configurations','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Description','Field','VariableId','Subject','DeskConfiguration','Subjects','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerField','ServicenowField','Dynamics365Account','FreshsalesConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','SquareProject','team_has_whatsapp_queues','TrunkBackupId','campaigns_has_cm_blacklists','FromAccount','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatWebsiteId','FromFaxAccountId','FromAgent','ToQueue','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Contacts','HopperHistory','Queues','UserProfileSections','Resources','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','utf8mb4','sequelizeHistory','motion2','utf8','utf8_general_ci','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.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','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model'];(function(_0x549c30,_0x431517){var _0x271034=function(_0xafef29){while(--_0xafef29){_0x549c30['push'](_0x549c30['shift']());}};_0x271034(++_0x431517);}(_0x82ba,0x174));var _0xa82b=function(_0x3bcec5,_0x136a64){_0x3bcec5=_0x3bcec5-0x0;var _0x41ed83=_0x82ba[_0x3bcec5];return _0x41ed83;};'use strict';var path=require(_0xa82b('0x0'));var config=require(_0xa82b('0x1'));var Sequelize=require(_0xa82b('0x2'));var _=require(_0xa82b('0x3'));var jstz=require(_0xa82b('0x4'));var timezone=jstz[_0xa82b('0x5')]();config[_0xa82b('0x2')]=_[_0xa82b('0x6')](config[_0xa82b('0x2')],{'database':'motion2','username':_0xa82b('0x7'),'password':_0xa82b('0x8'),'options':{'host':_0xa82b('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xa82b('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0xa82b('0xb')]=_[_0xa82b('0x6')](config[_0xa82b('0xb')],{'database':_0xa82b('0xc'),'username':_0xa82b('0x7'),'password':_0xa82b('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xa82b('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xa82b('0xd'),'collate':_0xa82b('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0xa82b('0x2')][_0xa82b('0xf')],config[_0xa82b('0x2')][_0xa82b('0x10')],config[_0xa82b('0x2')][_0xa82b('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa82b('0xb')]['database'],config[_0xa82b('0xb')][_0xa82b('0xf')],config['sequelizeHistory'][_0xa82b('0x10')],config[_0xa82b('0xb')][_0xa82b('0x11')])};db[_0xa82b('0x12')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x14'));db[_0xa82b('0x15')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x16'));db['VoiceContext']=db['sequelize'][_0xa82b('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xa82b('0x2')]['import']('../api/voiceExtension/voiceExtension.model');db[_0xa82b('0x17')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x18'));db[_0xa82b('0x19')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x1a'));db['VoiceRecording']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x1b'));db['ScreenRecording']=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x1c'));db[_0xa82b('0x1d')]=db[_0xa82b('0x2')]['import']('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x1e'));db['VoiceCallReport']=db[_0xa82b('0x2')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0xa82b('0x1f')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0xa82b('0x20')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x21'));db[_0xa82b('0x22')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x23'));db[_0xa82b('0x24')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x25'));db[_0xa82b('0x26')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0xa82b('0x2')]['import'](_0xa82b('0x27'));db['UserVoiceQueueRt']=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x28'));db[_0xa82b('0x29')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x2a'));db[_0xa82b('0x2b')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x2c'));db[_0xa82b('0x2d')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x2e'));db[_0xa82b('0x2f')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x30'));db[_0xa82b('0x31')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x32'));db[_0xa82b('0x33')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xa82b('0x34')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x35'));db['MailServerIn']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x36'));db[_0xa82b('0x37')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x38'));db[_0xa82b('0x39')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x3a'));db['MailQueue']=db[_0xa82b('0x2')]['import'](_0xa82b('0x3b'));db['MailSubstatus']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x3c'));db[_0xa82b('0x3d')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x3e'));db[_0xa82b('0x3f')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x40'));db['MailApplication']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x41'));db[_0xa82b('0x42')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x43'));db[_0xa82b('0x44')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x45'));db[_0xa82b('0x46')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x47'));db[_0xa82b('0x48')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x49'));db[_0xa82b('0x4a')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x4b'));db[_0xa82b('0x4c')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x4d'));db[_0xa82b('0x4e')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x4f'));db[_0xa82b('0x50')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x51'));db['FaxQueueReport']=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x52'));db[_0xa82b('0x53')]=db['sequelize'][_0xa82b('0x13')]('../api/smsAccount/smsAccount.model');db[_0xa82b('0x54')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x55'));db[_0xa82b('0x56')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x57'));db[_0xa82b('0x58')]=db[_0xa82b('0x2')]['import']('../api/smsMessage/smsMessage.model');db[_0xa82b('0x59')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x5a'));db[_0xa82b('0x5b')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x5c'));db[_0xa82b('0x5d')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x5e'));db[_0xa82b('0x5f')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x60'));db[_0xa82b('0x61')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x62'));db['OpenchannelQueue']=db['sequelize']['import'](_0xa82b('0x63'));db['ChatWebsite']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x64'));db[_0xa82b('0x65')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x66'));db[_0xa82b('0x67')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x68'));db[_0xa82b('0x69')]=db['sequelize']['import'](_0xa82b('0x6a'));db[_0xa82b('0x6b')]=db[_0xa82b('0x2')]['import']('../api/chatMessage/chatMessage.model');db[_0xa82b('0x6c')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x6d'));db[_0xa82b('0x6e')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x6f'));db[_0xa82b('0x70')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x71'));db['ChatProactiveAction']=db['sequelize'][_0xa82b('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xa82b('0x72')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x73'));db[_0xa82b('0x74')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x75'));db[_0xa82b('0x76')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x77'));db['CmHopperBlack']=db[_0xa82b('0x2')]['import'](_0xa82b('0x78'));db[_0xa82b('0x79')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x7a'));db[_0xa82b('0x7b')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x7c'));db['ReportAgentPreview']=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xa82b('0x7d')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x7e'));db[_0xa82b('0x7f')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/action/action.model');db['Automation']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x80'));db[_0xa82b('0x81')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x82'));db[_0xa82b('0x83')]=db[_0xa82b('0x2')]['import']('../api/disposition/disposition.model');db[_0xa82b('0x84')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x85'));db[_0xa82b('0x86')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x87'));db[_0xa82b('0x88')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x89'));db[_0xa82b('0x8a')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x8b'));db[_0xa82b('0x8c')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x8d'));db[_0xa82b('0x8e')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x8f'));db['Sound']=db[_0xa82b('0x2')]['import'](_0xa82b('0x90'));db[_0xa82b('0x91')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x92'));db[_0xa82b('0x93')]=db['sequelize']['import'](_0xa82b('0x94'));db['Trigger']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x95'));db[_0xa82b('0x96')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x97'));db[_0xa82b('0x98')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x99'));db['IntegrationReport']=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db['sequelize'][_0xa82b('0x13')](_0xa82b('0x9a'));db[_0xa82b('0x9b')]=db['sequelize']['import'](_0xa82b('0x9c'));db['AnalyticExtractedReport']=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xa82b('0x9d')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x9e'));db['AnalyticFieldReport']=db[_0xa82b('0x2')]['import'](_0xa82b('0x9f'));db[_0xa82b('0xa0')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xa1'));db[_0xa82b('0xa2')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xa3'));db[_0xa82b('0xa4')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xa5'));db[_0xa82b('0xa6')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xa7'));db[_0xa82b('0xa8')]=db[_0xa82b('0x2')]['import'](_0xa82b('0xa9'));db[_0xa82b('0xaa')]=db[_0xa82b('0x2')]['import'](_0xa82b('0xab'));db[_0xa82b('0xac')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xad'));db[_0xa82b('0xae')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xaf'));db[_0xa82b('0xb0')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0xb1'));db[_0xa82b('0xb2')]=db['sequelize'][_0xa82b('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0xa82b('0xb3')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0xb4'));db[_0xa82b('0xb5')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xb6'));db[_0xa82b('0xb7')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xb8'));db[_0xa82b('0xb9')]=db[_0xa82b('0x2')]['import'](_0xa82b('0xba'));db['FreshdeskAccount']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xbb'));db['FreshdeskConfiguration']=db['sequelize']['import'](_0xa82b('0xbc'));db['FreshdeskField']=db['sequelize']['import'](_0xa82b('0xbd'));db[_0xa82b('0xbe')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xbf'));db[_0xa82b('0xc0')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xc1'));db['VtigerField']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xc2'));db[_0xa82b('0xc3')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xc4'));db[_0xa82b('0xc5')]=db[_0xa82b('0x2')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xc6'));db['Dynamics365Account']=db['sequelize'][_0xa82b('0x13')](_0xa82b('0xc7'));db[_0xa82b('0xc8')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0xc9'));db[_0xa82b('0xca')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xa82b('0xcb')]=db['sequelize']['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0xa82b('0x2')]['import'](_0xa82b('0xcc'));db[_0xa82b('0xcd')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xce'));db['Integration']=db[_0xa82b('0x2')]['import'](_0xa82b('0x99'));db[_0xa82b('0xcf')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/network/network.model');db[_0xa82b('0xd0')]=db['sequelize'][_0xa82b('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0xa82b('0xd1')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0xd2'));db['JscriptyAnswerReport']=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xd3'));db[_0xa82b('0xd4')]=db[_0xa82b('0x2')]['import'](_0xa82b('0xd5'));db[_0xa82b('0xd6')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xd7'));db[_0xa82b('0xd8')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xd9'));db['SquareDetailsReport']=db[_0xa82b('0x2')]['import'](_0xa82b('0xda'));db[_0xa82b('0xdb')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0xdc'));db[_0xa82b('0xdd')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xde'));db[_0xa82b('0xdf')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xe0'));db['SquareProject']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xe1'));db[_0xa82b('0xe2')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0xe3'));db[_0xa82b('0xe4')]=db['sequelize'][_0xa82b('0x13')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0xa82b('0x2')]['import'](_0xa82b('0xe5'));db['License']=db[_0xa82b('0x2')]['import'](_0xa82b('0xe6'));db['Campaign']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xe7'));db[_0xa82b('0xe8')]=db[_0xa82b('0x2')]['import'](_0xa82b('0xe9'));db[_0xa82b('0xea')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/attachment/attachment.model');db[_0xa82b('0xeb')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xec'));db[_0xa82b('0xed')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xa82b('0xee')]=db[_0xa82b('0x2')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0xa82b('0xef')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xf0'));db[_0xa82b('0xf1')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xf2'));db[_0xa82b('0xf3')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xf4'));db[_0xa82b('0xf5')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/cmList/cmList.model');db[_0xa82b('0xf6')]=db['sequelize'][_0xa82b('0x13')](_0xa82b('0xf7'));db[_0xa82b('0xf8')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/userProfile/userProfile.model');db[_0xa82b('0xf9')]=db[_0xa82b('0x2')]['import'](_0xa82b('0xfa'));db[_0xa82b('0xfb')]=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0xa82b('0xfc')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xfd'));db['WhatsappAccount']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0xfe'));db['WhatsappApplication']=db[_0xa82b('0x2')][_0xa82b('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0xa82b('0xff')]=db['sequelize']['import'](_0xa82b('0x100'));db['WhatsappMessage']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x101'));db[_0xa82b('0x102')]=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x103'));db[_0xa82b('0x104')]=db['sequelize']['import'](_0xa82b('0x105'));db['WhatsappQueue']=db[_0xa82b('0x2')]['import'](_0xa82b('0x106'));db['CloudProvider']=db[_0xa82b('0x2')][_0xa82b('0x13')](_0xa82b('0x107'));db[_0xa82b('0x108')]=db[_0xa82b('0x2')]['import'](_0xa82b('0x109'));db[_0xa82b('0x12')][_0xa82b('0x10a')](db['VoiceMail'],{'as':_0xa82b('0x1d'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x12')][_0xa82b('0x10d')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0xa82b('0x10c')});db['User'][_0xa82b('0x10d')](db[_0xa82b('0x10e')],{'as':_0xa82b('0x10f'),'foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x12')][_0xa82b('0x10d')](db[_0xa82b('0x110')],{'as':_0xa82b('0x111'),'onDelete':'cascade','hooks':!![]});db['User'][_0xa82b('0x10d')](db[_0xa82b('0x79')],{'as':'HopperFinals','foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x12')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xa82b('0x10c')});db['User'][_0xa82b('0x10d')](db['ReportAgentPreview'],{'as':_0xa82b('0x112'),'foreignKey':'UserId'});db[_0xa82b('0x12')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x12')][_0xa82b('0x10d')](db[_0xa82b('0x69')],{'as':'ChatInteractions','foreignKey':_0xa82b('0x10c')});db['User'][_0xa82b('0x10d')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xa82b('0x12')]['hasMany'](db[_0xa82b('0x4c')],{'as':_0xa82b('0x113'),'foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x12')][_0xa82b('0x10d')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x12')][_0xa82b('0x10d')](db[_0xa82b('0xff')],{'as':_0xa82b('0x114'),'foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x12')][_0xa82b('0x10d')](db[_0xa82b('0xfc')],{'as':_0xa82b('0x115'),'foreignKey':'SenderId'});db[_0xa82b('0x12')][_0xa82b('0x116')](db[_0xa82b('0xf8')],{'as':'UserProfile','foreignKey':_0xa82b('0x117')});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x70')],{'as':_0xa82b('0x119'),'through':_0xa82b('0x11a')});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x74')],{'as':'Contacts','through':_0xa82b('0x11b')});db[_0xa82b('0x12')]['belongsToMany'](db[_0xa82b('0xf5')],{'as':_0xa82b('0x11c'),'through':_0xa82b('0x11d')});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x11e')],{'through':_0xa82b('0x11f')});db[_0xa82b('0x12')][_0xa82b('0x118')](db['MailInteraction'],{'as':_0xa82b('0x120'),'through':_0xa82b('0x121')});db[_0xa82b('0x12')]['belongsToMany'](db[_0xa82b('0x69')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0xa82b('0x4c')],{'as':_0xa82b('0x113'),'through':_0xa82b('0x122')});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x56')],{'as':_0xa82b('0x123'),'through':_0xa82b('0x124')});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x5f')],{'as':'OpenchannelInteractions','through':_0xa82b('0x125')});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0xff')],{'as':_0xa82b('0x114'),'through':_0xa82b('0x126')});db[_0xa82b('0x12')]['belongsToMany'](db[_0xa82b('0x19')],{'as':_0xa82b('0x127'),'through':_0xa82b('0x29'),'required':![]});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x128')],{'as':_0xa82b('0x129'),'through':_0xa82b('0x2d'),'required':![]});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x6e')],{'as':_0xa82b('0x12a'),'through':_0xa82b('0x2b'),'required':![],'hooks':!![]});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x50')],{'as':_0xa82b('0x12b'),'through':_0xa82b('0x2f'),'required':![]});db[_0xa82b('0x12')]['belongsToMany'](db[_0xa82b('0x59')],{'as':_0xa82b('0x12c'),'through':_0xa82b('0x31'),'required':![]});db[_0xa82b('0x12')][_0xa82b('0x118')](db['OpenchannelQueue'],{'as':_0xa82b('0x12d'),'through':_0xa82b('0x33'),'required':![]});db['User'][_0xa82b('0x118')](db[_0xa82b('0x12e')],{'as':_0xa82b('0x12f'),'through':_0xa82b('0x34'),'required':![]});db[_0xa82b('0x12')][_0xa82b('0x118')](db['CmList'],{'through':_0xa82b('0x11d')});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0xf6')],{'as':_0xa82b('0x130'),'through':_0xa82b('0x131'),'required':![]});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x132')],{'as':_0xa82b('0x133'),'through':_0xa82b('0x134')});db[_0xa82b('0x12')][_0xa82b('0x118')](db['FaxAccount'],{'as':_0xa82b('0x135'),'through':_0xa82b('0x136')});db[_0xa82b('0x12')]['belongsToMany'](db[_0xa82b('0x39')],{'as':_0xa82b('0x137'),'through':_0xa82b('0x138')});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x5b')],{'as':'OpenchannelAccounts','through':_0xa82b('0x139')});db[_0xa82b('0x12')][_0xa82b('0x118')](db[_0xa82b('0x53')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0xa82b('0x12')][_0xa82b('0x118')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xa82b('0x13a')});db['User'][_0xa82b('0x118')](db['SquareProject'],{'as':'SquareProjects','through':_0xa82b('0x13b')});db[_0xa82b('0x15')][_0xa82b('0x10d')](db[_0xa82b('0x110')],{'as':_0xa82b('0x13c'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x13d')});db['VoiceContext'][_0xa82b('0x10d')](db['VoiceExtension'],{'onDelete':_0xa82b('0x10b')});db[_0xa82b('0x110')]['hasMany'](db[_0xa82b('0x110')],{'as':_0xa82b('0x13e'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0xa82b('0x118')](db['Sound'],{'as':_0xa82b('0x13f'),'through':'moh_has_sounds'});db[_0xa82b('0x19')]['hasMany'](db[_0xa82b('0x10e')],{'as':_0xa82b('0x140'),'foreignKey':_0xa82b('0x141')});db['VoiceQueue'][_0xa82b('0x10d')](db[_0xa82b('0x76')],{'as':_0xa82b('0x142'),'foreignKey':_0xa82b('0x141')});db[_0xa82b('0x19')][_0xa82b('0x10d')](db[_0xa82b('0x79')],{'as':_0xa82b('0x143'),'foreignKey':_0xa82b('0x141')});db['VoiceQueue']['hasMany'](db[_0xa82b('0x7b')],{'as':_0xa82b('0x144'),'foreignKey':_0xa82b('0x141')});db[_0xa82b('0x19')][_0xa82b('0x10d')](db[_0xa82b('0x112')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0xa82b('0x19')][_0xa82b('0x10d')](db['CmHopperBlack'],{'as':_0xa82b('0x145'),'foreignKey':_0xa82b('0x141')});db['VoiceQueue'][_0xa82b('0x10d')](db['JscriptySessionReport'],{'as':_0xa82b('0x146'),'foreignKey':_0xa82b('0x141')});db['VoiceQueue'][_0xa82b('0x116')](db[_0xa82b('0x26')],{'as':_0xa82b('0x26'),'foreignKey':_0xa82b('0x147')});db[_0xa82b('0x19')]['belongsTo'](db[_0xa82b('0x26')],{'as':_0xa82b('0x148'),'foreignKey':'TrunkBackupId'});db[_0xa82b('0x19')][_0xa82b('0x116')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db['VoiceQueue'][_0xa82b('0x116')](db[_0xa82b('0x88')],{'as':_0xa82b('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue']['belongsToMany'](db[_0xa82b('0xf5')],{'as':'Lists','through':_0xa82b('0x14a')});db['VoiceQueue'][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':_0xa82b('0x14b'),'through':_0xa82b('0x29')});db[_0xa82b('0x19')][_0xa82b('0x118')](db[_0xa82b('0x11e')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0xa82b('0x19')][_0xa82b('0x118')](db[_0xa82b('0xf5')],{'as':_0xa82b('0x14c'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0xa82b('0x116')](db['User'],{'as':'User','foreignKey':_0xa82b('0x10c')});db['ScreenRecording'][_0xa82b('0x116')](db[_0xa82b('0x12')],{'as':_0xa82b('0x12'),'foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x1d')]['hasMany'](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x14d'),'sourceKey':_0xa82b('0x14e')});db['VoiceMailMessage'][_0xa82b('0x116')](db[_0xa82b('0x1d')],{'foreignKey':_0xa82b('0x14d'),'targetKey':'mailbox'});db[_0xa82b('0x14f')][_0xa82b('0x10d')](db[_0xa82b('0x22')],{'as':'QueueCalls','foreignKey':_0xa82b('0x150'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0xa82b('0x20')],{'as':_0xa82b('0x151'),'foreignKey':_0xa82b('0x150'),'constraints':![]});db[_0xa82b('0x14f')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'as':_0xa82b('0x12'),'foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x14f')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153')});db[_0xa82b('0x154')]['belongsTo'](db[_0xa82b('0x39')],{'as':_0xa82b('0x39'),'foreignKey':'MailAccountId'});db['MailServerOut']['belongsTo'](db[_0xa82b('0x39')],{'as':_0xa82b('0x39'),'foreignKey':_0xa82b('0x155')});db[_0xa82b('0x39')][_0xa82b('0x10a')](db[_0xa82b('0x154')],{'as':_0xa82b('0x156'),'onDelete':_0xa82b('0x10b')});db[_0xa82b('0x39')][_0xa82b('0x10a')](db[_0xa82b('0x37')],{'as':'Smtp','onDelete':_0xa82b('0x10b')});db[_0xa82b('0x39')]['hasMany'](db[_0xa82b('0x83')],{'as':_0xa82b('0x157'),'foreignKey':_0xa82b('0x155')});db['MailAccount']['hasMany'](db[_0xa82b('0x81')],{'as':_0xa82b('0x158'),'foreignKey':'MailAccountId'});db[_0xa82b('0x39')][_0xa82b('0x10d')](db[_0xa82b('0x3f')],{'as':'Messages','foreignKey':_0xa82b('0x155')});db['MailAccount'][_0xa82b('0x10d')](db[_0xa82b('0x3d')],{'as':_0xa82b('0x159')});db[_0xa82b('0x39')]['hasMany'](db[_0xa82b('0x15a')],{'as':_0xa82b('0x13e')});db[_0xa82b('0x39')][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':'List','foreignKey':'ListId'});db[_0xa82b('0x39')]['belongsTo'](db[_0xa82b('0x93')],{'as':_0xa82b('0x93'),'foreignKey':_0xa82b('0x15b')});db[_0xa82b('0x39')][_0xa82b('0x116')](db[_0xa82b('0x88')],{'as':_0xa82b('0x149'),'foreignKey':_0xa82b('0x15c')});db[_0xa82b('0x39')][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':_0xa82b('0x14b'),'through':_0xa82b('0x138')});db[_0xa82b('0x128')][_0xa82b('0x118')](db['User'],{'as':_0xa82b('0x14b'),'through':'UserMailQueue'});db[_0xa82b('0x128')][_0xa82b('0x118')](db[_0xa82b('0x11e')],{'through':_0xa82b('0x15d'),'as':'Teams'});db[_0xa82b('0x3d')][_0xa82b('0x10d')](db[_0xa82b('0x3f')],{'as':_0xa82b('0x15e'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x15f')});db['MailInteraction'][_0xa82b('0x116')](db['MailAccount'],{'as':'Account','foreignKey':_0xa82b('0x155')});db['MailInteraction'][_0xa82b('0x116')](db[_0xa82b('0x74')],{'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153')});db[_0xa82b('0x3d')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'as':_0xa82b('0x160'),'foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x3d')][_0xa82b('0x118')](db[_0xa82b('0x91')],{'through':_0xa82b('0x161'),'as':'Tags'});db['MailInteraction'][_0xa82b('0x118')](db[_0xa82b('0x91')],{'through':_0xa82b('0x161'),'as':_0xa82b('0x162')});db[_0xa82b('0x3d')]['belongsToMany'](db[_0xa82b('0x12')],{'as':'Users','through':_0xa82b('0x121'),'foreignKey':_0xa82b('0x15f')});db[_0xa82b('0x3f')][_0xa82b('0x10d')](db[_0xa82b('0xea')],{'as':'Attachments','onDelete':_0xa82b('0x10b')});db['MailMessage'][_0xa82b('0x116')](db[_0xa82b('0x12')],{'as':_0xa82b('0x12')});db[_0xa82b('0x3f')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'onDelete':_0xa82b('0x10b'),'as':_0xa82b('0x152')});db['MailMessage'][_0xa82b('0x116')](db[_0xa82b('0x3d')],{'as':_0xa82b('0x163'),'foreignKey':_0xa82b('0x15f')});db[_0xa82b('0x3f')]['belongsTo'](db[_0xa82b('0x39')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x155')});db['MailMessage'][_0xa82b('0x116')](db[_0xa82b('0x132')],{'as':_0xa82b('0x132'),'foreignKey':_0xa82b('0x165')});db[_0xa82b('0x3f')][_0xa82b('0x116')](db[_0xa82b('0x6c')],{'as':'ChatOfflineMessage','foreignKey':_0xa82b('0x166')});db['MailApplication'][_0xa82b('0x116')](db[_0xa82b('0x12')],{'onDelete':_0xa82b('0x167')});db[_0xa82b('0x15a')][_0xa82b('0x116')](db[_0xa82b('0x128')],{'onDelete':_0xa82b('0x167')});db[_0xa82b('0x15a')][_0xa82b('0x116')](db[_0xa82b('0x39')],{'onDelete':_0xa82b('0x167')});db[_0xa82b('0x15a')]['belongsTo'](db[_0xa82b('0x86')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['MailApplication']['belongsTo'](db[_0xa82b('0x91')],{'onDelete':_0xa82b('0x167'),'foreignKey':'TagId'});db[_0xa82b('0x42')]['belongsTo'](db[_0xa82b('0x39')],{});db[_0xa82b('0x42')][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':_0xa82b('0x168'),'foreignKey':_0xa82b('0x169')});db[_0xa82b('0x42')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153')});db['MailQueueReport'][_0xa82b('0x116')](db[_0xa82b('0x3d')],{});db[_0xa82b('0x42')]['belongsTo'](db[_0xa82b('0x3f')],{});db[_0xa82b('0x42')][_0xa82b('0x116')](db['User'],{});db[_0xa82b('0x42')][_0xa82b('0x116')](db[_0xa82b('0x128')],{});db[_0xa82b('0x44')][_0xa82b('0x10d')](db[_0xa82b('0x46')],{'as':'Items','onDelete':_0xa82b('0x10b')});db[_0xa82b('0x48')]['hasMany'](db[_0xa82b('0x83')],{'as':_0xa82b('0x157'),'foreignKey':_0xa82b('0x16a')});db['FaxAccount'][_0xa82b('0x10d')](db[_0xa82b('0x81')],{'as':_0xa82b('0x158'),'foreignKey':_0xa82b('0x16a')});db[_0xa82b('0x48')][_0xa82b('0x10d')](db[_0xa82b('0x4c')],{'as':_0xa82b('0x159')});db[_0xa82b('0x48')][_0xa82b('0x10d')](db[_0xa82b('0x4a')],{'as':_0xa82b('0x13e')});db[_0xa82b('0x48')][_0xa82b('0x10d')](db[_0xa82b('0x110')],{'as':_0xa82b('0x16b'),'onDelete':_0xa82b('0x10b')});db[_0xa82b('0x48')][_0xa82b('0x10d')](db[_0xa82b('0x4e')],{'as':_0xa82b('0x15e')});db[_0xa82b('0x48')][_0xa82b('0x116')](db[_0xa82b('0x26')],{'as':_0xa82b('0x26')});db['FaxAccount'][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':_0xa82b('0x168'),'foreignKey':_0xa82b('0x169')});db[_0xa82b('0x48')][_0xa82b('0x116')](db[_0xa82b('0x88')],{'as':_0xa82b('0x149'),'foreignKey':_0xa82b('0x15c')});db[_0xa82b('0x48')]['belongsToMany'](db[_0xa82b('0x12')],{'as':_0xa82b('0x14b'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0xa82b('0x116')](db['User'],{'onDelete':_0xa82b('0x167')});db[_0xa82b('0x4a')][_0xa82b('0x116')](db[_0xa82b('0x50')],{'onDelete':_0xa82b('0x167')});db[_0xa82b('0x4a')][_0xa82b('0x116')](db[_0xa82b('0x48')],{'onDelete':'restrict'});db[_0xa82b('0x4a')][_0xa82b('0x116')](db['Tag'],{'onDelete':_0xa82b('0x167'),'foreignKey':_0xa82b('0x16c')});db[_0xa82b('0x4c')][_0xa82b('0x10d')](db['FaxMessage'],{'as':_0xa82b('0x15e'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x16d')});db[_0xa82b('0x4c')][_0xa82b('0x116')](db[_0xa82b('0x48')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x16a')});db[_0xa82b('0x4c')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153')});db[_0xa82b('0x4c')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'as':_0xa82b('0x160'),'foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x4c')][_0xa82b('0x118')](db['Tag'],{'through':_0xa82b('0x16e'),'as':'Tags'});db[_0xa82b('0x4c')][_0xa82b('0x118')](db[_0xa82b('0x91')],{'through':'fax_interaction_has_tags','as':_0xa82b('0x162')});db[_0xa82b('0x4c')][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':_0xa82b('0x16f'),'through':_0xa82b('0x122'),'foreignKey':_0xa82b('0x16d')});db[_0xa82b('0x4e')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'onDelete':_0xa82b('0x10b'),'as':'User'});db[_0xa82b('0x4e')][_0xa82b('0x116')](db['FaxInteraction'],{'as':_0xa82b('0x163'),'foreignKey':_0xa82b('0x16d')});db[_0xa82b('0x4e')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'onDelete':_0xa82b('0x10b'),'as':_0xa82b('0x152')});db[_0xa82b('0x4e')][_0xa82b('0x116')](db[_0xa82b('0xea')],{'as':'Attachment','foreignKey':_0xa82b('0x170')});db[_0xa82b('0x4e')][_0xa82b('0x116')](db[_0xa82b('0x48')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x16a')});db[_0xa82b('0x50')][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':'Agents','through':_0xa82b('0x2f')});db[_0xa82b('0x50')]['belongsToMany'](db[_0xa82b('0x11e')],{'through':_0xa82b('0x171'),'as':_0xa82b('0x172')});db[_0xa82b('0x173')][_0xa82b('0x116')](db[_0xa82b('0x48')],{});db['FaxQueueReport'][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':_0xa82b('0x168'),'foreignKey':_0xa82b('0x169')});db[_0xa82b('0x173')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'as':_0xa82b('0x152'),'foreignKey':'ContactId'});db[_0xa82b('0x173')][_0xa82b('0x116')](db[_0xa82b('0x4c')],{});db[_0xa82b('0x173')][_0xa82b('0x116')](db[_0xa82b('0x4e')],{});db[_0xa82b('0x173')][_0xa82b('0x116')](db['User'],{});db['FaxQueueReport'][_0xa82b('0x116')](db[_0xa82b('0x50')],{});db['SmsAccount']['hasMany'](db[_0xa82b('0x83')],{'as':_0xa82b('0x157'),'foreignKey':_0xa82b('0x174')});db[_0xa82b('0x53')][_0xa82b('0x10d')](db[_0xa82b('0x81')],{'as':_0xa82b('0x158'),'foreignKey':_0xa82b('0x174')});db[_0xa82b('0x53')]['hasMany'](db[_0xa82b('0x58')],{'as':'Messages','foreignKey':_0xa82b('0x174')});db[_0xa82b('0x53')][_0xa82b('0x10d')](db[_0xa82b('0x56')],{'as':_0xa82b('0x159')});db[_0xa82b('0x53')][_0xa82b('0x10d')](db['SmsApplication'],{'as':'Applications'});db['SmsAccount'][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':_0xa82b('0x168'),'foreignKey':_0xa82b('0x169')});db['SmsAccount']['belongsTo'](db[_0xa82b('0x88')],{'as':_0xa82b('0x149'),'foreignKey':_0xa82b('0x15c')});db[_0xa82b('0x53')][_0xa82b('0x118')](db['User'],{'as':_0xa82b('0x14b'),'through':_0xa82b('0x175')});db['SmsApplication'][_0xa82b('0x116')](db[_0xa82b('0x12')],{'onDelete':_0xa82b('0x167')});db[_0xa82b('0x54')]['belongsTo'](db[_0xa82b('0x59')],{'onDelete':_0xa82b('0x167')});db[_0xa82b('0x54')][_0xa82b('0x116')](db[_0xa82b('0x53')],{'onDelete':'restrict'});db[_0xa82b('0x54')][_0xa82b('0x116')](db[_0xa82b('0x86')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xa82b('0x54')][_0xa82b('0x116')](db[_0xa82b('0x91')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xa82b('0x56')][_0xa82b('0x10d')](db[_0xa82b('0x58')],{'as':_0xa82b('0x15e'),'onDelete':_0xa82b('0x10b'),'foreignKey':'SmsInteractionId'});db[_0xa82b('0x56')]['belongsTo'](db['SmsAccount'],{'as':_0xa82b('0x164'),'foreignKey':'SmsAccountId'});db[_0xa82b('0x56')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'as':'Contact','foreignKey':'ContactId'});db['SmsInteraction'][_0xa82b('0x116')](db[_0xa82b('0x12')],{'as':_0xa82b('0x160'),'foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x56')][_0xa82b('0x118')](db[_0xa82b('0x91')],{'through':'sms_interaction_has_tags','as':_0xa82b('0x176')});db['SmsInteraction']['belongsToMany'](db[_0xa82b('0x91')],{'through':_0xa82b('0x177'),'as':_0xa82b('0x162')});db[_0xa82b('0x56')][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':_0xa82b('0x16f'),'through':_0xa82b('0x124'),'foreignKey':'SmsInteractionId'});db[_0xa82b('0x58')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'as':'User'});db[_0xa82b('0x58')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'onDelete':_0xa82b('0x10b'),'as':'Contact'});db['SmsMessage'][_0xa82b('0x116')](db[_0xa82b('0x56')],{'onDelete':_0xa82b('0x10b'),'as':_0xa82b('0x163'),'foreignKey':_0xa82b('0x178')});db[_0xa82b('0x58')][_0xa82b('0x116')](db['SmsAccount'],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x174')});db[_0xa82b('0x59')][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':'Agents','through':_0xa82b('0x31'),'foreignKey':_0xa82b('0x179')});db['SmsQueue'][_0xa82b('0x118')](db['Team'],{'through':_0xa82b('0x17a'),'as':'Teams'});db[_0xa82b('0x5b')]['hasMany'](db[_0xa82b('0x83')],{'as':_0xa82b('0x157'),'foreignKey':_0xa82b('0x17b')});db[_0xa82b('0x5b')][_0xa82b('0x10d')](db[_0xa82b('0x81')],{'as':_0xa82b('0x158'),'foreignKey':_0xa82b('0x17b')});db[_0xa82b('0x5b')][_0xa82b('0x10d')](db[_0xa82b('0x5f')],{'as':_0xa82b('0x159'),'foreignKey':_0xa82b('0x17b')});db[_0xa82b('0x5b')][_0xa82b('0x10d')](db[_0xa82b('0x61')],{'as':_0xa82b('0x15e'),'foreignKey':'OpenchannelAccountId'});db[_0xa82b('0x5b')][_0xa82b('0x10d')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xa82b('0x116')](db['CmList'],{'as':_0xa82b('0x168'),'foreignKey':_0xa82b('0x169')});db[_0xa82b('0x5b')][_0xa82b('0x116')](db[_0xa82b('0x88')],{'as':_0xa82b('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa82b('0x5b')][_0xa82b('0x118')](db['User'],{'as':'Agents','through':_0xa82b('0x139')});db[_0xa82b('0x5d')]['belongsTo'](db['User'],{'onDelete':_0xa82b('0x167')});db[_0xa82b('0x5d')][_0xa82b('0x116')](db[_0xa82b('0x17c')],{'onDelete':'restrict','foreignKey':_0xa82b('0x17d')});db[_0xa82b('0x5d')][_0xa82b('0x116')](db[_0xa82b('0x5b')],{'onDelete':_0xa82b('0x167'),'foreignKey':_0xa82b('0x17b')});db[_0xa82b('0x5d')]['belongsTo'](db[_0xa82b('0x86')],{'onDelete':'restrict','foreignKey':_0xa82b('0x17e')});db[_0xa82b('0x5d')][_0xa82b('0x116')](db[_0xa82b('0x91')],{'onDelete':_0xa82b('0x167'),'foreignKey':'TagId'});db['OpenchannelInteraction']['hasMany'](db[_0xa82b('0x61')],{'as':_0xa82b('0x15e'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x17f')});db['OpenchannelInteraction'][_0xa82b('0x116')](db[_0xa82b('0x5b')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x17b')});db[_0xa82b('0x5f')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'as':_0xa82b('0x152'),'foreignKey':'ContactId'});db[_0xa82b('0x5f')][_0xa82b('0x116')](db['User'],{'as':_0xa82b('0x160'),'foreignKey':_0xa82b('0x10c')});db['OpenchannelInteraction'][_0xa82b('0x118')](db[_0xa82b('0x91')],{'through':'openchannel_interaction_has_tags','as':_0xa82b('0x176')});db[_0xa82b('0x5f')]['belongsToMany'](db[_0xa82b('0x91')],{'through':_0xa82b('0x180'),'as':_0xa82b('0x162')});db[_0xa82b('0x5f')]['belongsToMany'](db[_0xa82b('0x12')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0xa82b('0x17f')});db[_0xa82b('0x61')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'onDelete':'cascade','as':_0xa82b('0x12')});db[_0xa82b('0x61')]['belongsTo'](db[_0xa82b('0x74')],{'onDelete':_0xa82b('0x10b'),'as':'Contact'});db['OpenchannelMessage']['belongsTo'](db[_0xa82b('0x5f')],{'onDelete':'cascade','as':_0xa82b('0x163'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xa82b('0x116')](db[_0xa82b('0xea')],{'as':'Attachment','foreignKey':_0xa82b('0x170')});db['OpenchannelMessage'][_0xa82b('0x116')](db[_0xa82b('0x5b')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x17b')});db[_0xa82b('0x17c')][_0xa82b('0x118')](db['User'],{'as':_0xa82b('0x14b'),'through':_0xa82b('0x33'),'foreignKey':_0xa82b('0x17d')});db[_0xa82b('0x17c')][_0xa82b('0x118')](db['Team'],{'through':_0xa82b('0x181'),'as':'Teams'});db[_0xa82b('0x132')][_0xa82b('0x10d')](db[_0xa82b('0x83')],{'as':_0xa82b('0x157'),'foreignKey':_0xa82b('0x165')});db[_0xa82b('0x132')][_0xa82b('0x10d')](db['CannedAnswer'],{'as':_0xa82b('0x158'),'foreignKey':_0xa82b('0x165')});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':_0xa82b('0x182')});db[_0xa82b('0x132')][_0xa82b('0x10d')](db['ChatInteraction'],{'as':'Interactions'});db[_0xa82b('0x132')][_0xa82b('0x10d')](db[_0xa82b('0x67')],{'as':_0xa82b('0x13e')});db[_0xa82b('0x132')][_0xa82b('0x10d')](db[_0xa82b('0x6b')],{'as':'Messages'});db[_0xa82b('0x132')][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':_0xa82b('0x168'),'foreignKey':_0xa82b('0x169')});db['ChatWebsite'][_0xa82b('0x116')](db['Interval'],{'as':_0xa82b('0x86'),'foreignKey':'IntervalId'});db[_0xa82b('0x132')][_0xa82b('0x116')](db[_0xa82b('0x39')],{'as':_0xa82b('0x39'),'foreignKey':_0xa82b('0x155')});db['ChatWebsite'][_0xa82b('0x116')](db['Pause'],{'as':_0xa82b('0x149'),'foreignKey':_0xa82b('0x15c')});db['ChatWebsite'][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':_0xa82b('0x14b'),'through':_0xa82b('0x134')});db[_0xa82b('0x65')][_0xa82b('0x116')](db[_0xa82b('0x5b')],{});db[_0xa82b('0x65')][_0xa82b('0x116')](db['CmList'],{'as':_0xa82b('0x168'),'foreignKey':_0xa82b('0x169')});db[_0xa82b('0x65')][_0xa82b('0x116')](db['CmContact'],{'as':'Contact','foreignKey':_0xa82b('0x153')});db[_0xa82b('0x65')]['belongsTo'](db[_0xa82b('0x5f')],{});db[_0xa82b('0x65')][_0xa82b('0x116')](db['OpenchannelMessage'],{});db[_0xa82b('0x65')][_0xa82b('0x116')](db[_0xa82b('0x12')],{});db[_0xa82b('0x65')][_0xa82b('0x116')](db[_0xa82b('0x17c')],{});db[_0xa82b('0x67')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'as':_0xa82b('0x183'),'foreignKey':'UserId','onDelete':_0xa82b('0x167')});db[_0xa82b('0x67')][_0xa82b('0x116')](db[_0xa82b('0x6e')],{'as':'Queue','foreignKey':_0xa82b('0x184'),'onDelete':_0xa82b('0x167')});db[_0xa82b('0x67')][_0xa82b('0x116')](db[_0xa82b('0x132')],{'as':_0xa82b('0x185'),'foreignKey':_0xa82b('0x165'),'onDelete':_0xa82b('0x167')});db[_0xa82b('0x67')][_0xa82b('0x116')](db[_0xa82b('0x91')],{'onDelete':_0xa82b('0x167'),'foreignKey':'TagId'});db[_0xa82b('0x69')][_0xa82b('0x10d')](db['ChatMessage'],{'as':_0xa82b('0x15e'),'onDelete':_0xa82b('0x10b'),'foreignKey':'ChatInteractionId'});db['ChatInteraction']['belongsTo'](db[_0xa82b('0x132')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x165')});db[_0xa82b('0x69')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153')});db[_0xa82b('0x69')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'as':_0xa82b('0x160'),'foreignKey':'UserId'});db['ChatInteraction'][_0xa82b('0x118')](db[_0xa82b('0x91')],{'through':_0xa82b('0x186'),'as':'Tags'});db[_0xa82b('0x69')][_0xa82b('0x118')](db['Tag'],{'through':_0xa82b('0x186'),'as':_0xa82b('0x162')});db[_0xa82b('0x69')][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':_0xa82b('0x16f'),'through':_0xa82b('0x187'),'foreignKey':'ChatInteractionId'});db[_0xa82b('0x6b')]['belongsTo'](db[_0xa82b('0x12')],{'onDelete':_0xa82b('0x10b'),'as':'User'});db[_0xa82b('0x6b')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'onDelete':_0xa82b('0x10b'),'as':'Contact','foreignKey':'ContactId'});db[_0xa82b('0x6b')][_0xa82b('0x116')](db[_0xa82b('0x69')],{'onDelete':_0xa82b('0x10b'),'as':_0xa82b('0x163'),'foreignKey':_0xa82b('0x188')});db[_0xa82b('0x6b')][_0xa82b('0x116')](db['Attachment'],{'as':_0xa82b('0xea'),'foreignKey':_0xa82b('0x170')});db[_0xa82b('0x6b')][_0xa82b('0x116')](db['ChatWebsite'],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x165')});db[_0xa82b('0x6c')]['hasMany'](db[_0xa82b('0xea')],{'as':_0xa82b('0x189'),'foreignKey':_0xa82b('0x166'),'onDelete':_0xa82b('0x10b'),'hooks':!![]});db[_0xa82b('0x6c')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'onDelete':_0xa82b('0x10b'),'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153')});db['ChatOfflineMessage'][_0xa82b('0x116')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xa82b('0x165')});db['ChatQueue']['belongsToMany'](db[_0xa82b('0x12')],{'as':_0xa82b('0x14b'),'through':_0xa82b('0x2b'),'hooks':!![]});db['ChatQueue'][_0xa82b('0x118')](db[_0xa82b('0x11e')],{'through':_0xa82b('0x18a'),'as':'Teams'});db[_0xa82b('0x70')][_0xa82b('0x10d')](db['ChatInternalMessage'],{'as':_0xa82b('0x15e'),'foreignKey':_0xa82b('0x18b'),'onDelete':_0xa82b('0x10b')});db['ChatGroup'][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':'Members','through':_0xa82b('0x11a')});db['ChatProactiveAction']['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':_0xa82b('0x165')});db[_0xa82b('0x72')][_0xa82b('0x10d')](db['CmContact'],{'as':'Contacts','foreignKey':_0xa82b('0x18c')});db['CmContact'][_0xa82b('0x10d')](db[_0xa82b('0x76')],{'as':'Hoppers','foreignKey':_0xa82b('0x153')});db[_0xa82b('0x74')][_0xa82b('0x10d')](db[_0xa82b('0x79')],{'as':_0xa82b('0x143'),'foreignKey':_0xa82b('0x153')});db[_0xa82b('0x74')]['hasMany'](db[_0xa82b('0x7b')],{'as':_0xa82b('0x144'),'foreignKey':_0xa82b('0x153')});db[_0xa82b('0x74')][_0xa82b('0x10d')](db[_0xa82b('0x112')],{'as':_0xa82b('0x112'),'foreignKey':'ContactId'});db[_0xa82b('0x74')]['hasMany'](db[_0xa82b('0xd4')],{'as':_0xa82b('0x146'),'foreignKey':_0xa82b('0x153')});db[_0xa82b('0x74')][_0xa82b('0x10d')](db[_0xa82b('0x5f')],{'as':_0xa82b('0x18d'),'foreignKey':'ContactId','onDelete':_0xa82b('0x167')});db[_0xa82b('0x74')]['hasMany'](db['ChatInteraction'],{'as':_0xa82b('0x18e'),'foreignKey':_0xa82b('0x153'),'onDelete':_0xa82b('0x167')});db[_0xa82b('0x74')][_0xa82b('0x10d')](db[_0xa82b('0x56')],{'as':'SmsInteractions','foreignKey':_0xa82b('0x153'),'onDelete':_0xa82b('0x167')});db[_0xa82b('0x74')]['hasMany'](db['FaxInteraction'],{'as':_0xa82b('0x113'),'foreignKey':_0xa82b('0x153'),'onDelete':_0xa82b('0x167')});db['CmContact'][_0xa82b('0x10d')](db[_0xa82b('0x3d')],{'as':_0xa82b('0x120'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xa82b('0x74')][_0xa82b('0x116')](db[_0xa82b('0x72')],{'as':_0xa82b('0x18f'),'foreignKey':_0xa82b('0x18c')});db[_0xa82b('0x74')][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':_0xa82b('0x168'),'foreignKey':'ListId','onDelete':_0xa82b('0x10b')});db[_0xa82b('0x74')][_0xa82b('0x118')](db['User'],{'as':'Users','through':_0xa82b('0x11b')});db[_0xa82b('0x74')][_0xa82b('0x118')](db['Tag'],{'as':'Tags','through':_0xa82b('0x190')});db[_0xa82b('0x74')][_0xa82b('0x118')](db[_0xa82b('0x91')],{'through':'cm_contact_has_tags','as':_0xa82b('0x162')});db[_0xa82b('0x76')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153'),'onDelete':_0xa82b('0x10b')});db[_0xa82b('0x76')]['belongsTo'](db[_0xa82b('0xf5')],{'as':'List','foreignKey':_0xa82b('0x169'),'onDelete':_0xa82b('0x10b')});db['CmHopper'][_0xa82b('0x116')](db['User'],{'as':_0xa82b('0x183'),'foreignKey':_0xa82b('0x10c')});db[_0xa82b('0x76')][_0xa82b('0x116')](db[_0xa82b('0x19')],{'as':_0xa82b('0x191'),'foreignKey':_0xa82b('0x141'),'onDelete':_0xa82b('0x10b')});db[_0xa82b('0x76')][_0xa82b('0x116')](db[_0xa82b('0x192')],{'as':_0xa82b('0x192'),'foreignKey':_0xa82b('0x193'),'onDelete':_0xa82b('0x10b')});db[_0xa82b('0x76')][_0xa82b('0x116')](db['User'],{'as':'Owner','foreignKey':'OwnerId'});db[_0xa82b('0x194')][_0xa82b('0x116')](db[_0xa82b('0x74')],{'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153'),'onDelete':_0xa82b('0x10b')});db['CmHopperBlack'][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':_0xa82b('0x168'),'foreignKey':_0xa82b('0x169'),'onDelete':'cascade'});db[_0xa82b('0x194')][_0xa82b('0x116')](db['VoiceQueue'],{'as':_0xa82b('0x191'),'foreignKey':'VoiceQueueId','onDelete':_0xa82b('0x10b')});db['CmHopperBlack'][_0xa82b('0x116')](db['Campaign'],{'as':'Campaign','foreignKey':_0xa82b('0x193'),'onDelete':_0xa82b('0x10b')});db[_0xa82b('0x195')]['hasMany'](db[_0xa82b('0x84')],{'as':{'plural':_0xa82b('0x196'),'singular':'OneAll'},'foreignKey':_0xa82b('0x197'),'onDelete':'cascade','hooks':!![]});db[_0xa82b('0x195')][_0xa82b('0x10d')](db[_0xa82b('0x84')],{'as':{'plural':_0xa82b('0x198'),'singular':_0xa82b('0x199')},'foreignKey':_0xa82b('0x19a'),'onDelete':_0xa82b('0x10b'),'hooks':!![]});db['Automation']['hasMany'](db[_0xa82b('0x7f')],{'as':'Actions','foreignKey':_0xa82b('0x19b'),'onDelete':_0xa82b('0x10b'),'hooks':!![]});db[_0xa82b('0x83')][_0xa82b('0x10d')](db[_0xa82b('0x83')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0xa82b('0x10b')});db['Interval'][_0xa82b('0x10d')](db['Interval'],{'as':_0xa82b('0x19c'),'foreignKey':'IntervalId','onDelete':_0xa82b('0x10b'),'hooks':!![],'required':![]});db['Interval'][_0xa82b('0x10d')](db[_0xa82b('0x110')],{'as':_0xa82b('0x111'),'foreignKey':'IntervalId','onDelete':_0xa82b('0x167')});db[_0xa82b('0x86')][_0xa82b('0x10d')](db[_0xa82b('0x15a')],{'as':_0xa82b('0x19d'),'foreignKey':'IntervalId'});db[_0xa82b('0x86')][_0xa82b('0x10d')](db[_0xa82b('0x67')],{'as':_0xa82b('0x19e'),'foreignKey':'IntervalId'});db[_0xa82b('0x86')][_0xa82b('0x10d')](db[_0xa82b('0x4a')],{'as':_0xa82b('0x19f'),'foreignKey':_0xa82b('0x17e')});db[_0xa82b('0x86')][_0xa82b('0x10d')](db['SmsApplication'],{'as':_0xa82b('0x1a0'),'foreignKey':_0xa82b('0x17e')});db['Schedule'][_0xa82b('0x116')](db[_0xa82b('0x39')],{});db[_0xa82b('0x8e')][_0xa82b('0x116')](db[_0xa82b('0x9b')],{'foreignKey':'DefaultReportId'});db[_0xa82b('0x8e')][_0xa82b('0x116')](db['AnalyticCustomReport'],{'foreignKey':_0xa82b('0x1a1')});db[_0xa82b('0x1a2')][_0xa82b('0x118')](db[_0xa82b('0x17')],{'as':_0xa82b('0x1a3'),'through':_0xa82b('0x1a4'),'onDelete':_0xa82b('0x167')});db[_0xa82b('0x91')][_0xa82b('0x118')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xa82b('0x91')][_0xa82b('0x118')](db[_0xa82b('0x69')],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xa82b('0x91')][_0xa82b('0x118')](db[_0xa82b('0x56')],{'through':_0xa82b('0x177')});db[_0xa82b('0x91')][_0xa82b('0x118')](db[_0xa82b('0x4c')],{'through':_0xa82b('0x16e')});db[_0xa82b('0x91')][_0xa82b('0x118')](db[_0xa82b('0x5f')],{'through':_0xa82b('0x180')});db['Tag'][_0xa82b('0x118')](db[_0xa82b('0xff')],{'through':_0xa82b('0x1a5')});db[_0xa82b('0x1a6')][_0xa82b('0x10d')](db[_0xa82b('0x84')],{'as':{'plural':'AllConditions','singular':_0xa82b('0x1a7')},'foreignKey':_0xa82b('0x1a8'),'onDelete':_0xa82b('0x10b'),'hooks':!![]});db[_0xa82b('0x1a6')][_0xa82b('0x10d')](db[_0xa82b('0x84')],{'as':{'plural':_0xa82b('0x1a9'),'singular':_0xa82b('0x1aa')},'foreignKey':'TriggerAnyId','onDelete':_0xa82b('0x10b'),'hooks':!![]});db['Trigger'][_0xa82b('0x10d')](db[_0xa82b('0x7f')],{'as':_0xa82b('0x1ab'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xa82b('0x1ac')],{'as':_0xa82b('0x1ad'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1a1'),'hooks':!![]});db[_0xa82b('0x9b')][_0xa82b('0x10d')](db[_0xa82b('0x1ac')],{'as':_0xa82b('0x1ad'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1ae')});db[_0xa82b('0x9d')]['hasMany'](db[_0xa82b('0x1ac')],{'as':_0xa82b('0x1ad'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1af')});db[_0xa82b('0x1ac')][_0xa82b('0x116')](db['AnalyticMetric'],{'foreignKey':_0xa82b('0x1af')});db['SalesforceAccount']['hasMany'](db[_0xa82b('0xa4')],{'as':_0xa82b('0x1b0'),'onDelete':_0xa82b('0x10b'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0xa82b('0x10d')](db[_0xa82b('0xa6')],{'as':'Subjects','onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b1')});db[_0xa82b('0xa4')]['hasMany'](db[_0xa82b('0xa6')],{'as':_0xa82b('0x1b2'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0xa4')][_0xa82b('0x10d')](db[_0xa82b('0xa6')],{'as':_0xa82b('0x1ad'),'onDelete':'cascade','foreignKey':_0xa82b('0x1b4')});db['SalesforceConfiguration'][_0xa82b('0x116')](db[_0xa82b('0xa2')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x1b5')});db[_0xa82b('0xa6')]['hasMany'](db[_0xa82b('0xa6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xa82b('0xa6')][_0xa82b('0x10d')](db[_0xa82b('0xa6')],{'as':_0xa82b('0x1b6'),'foreignKey':_0xa82b('0x1b3')});db['SalesforceField'][_0xa82b('0x10d')](db['SalesforceField'],{'as':_0xa82b('0x1b7'),'foreignKey':_0xa82b('0x1b4')});db['SalesforceField'][_0xa82b('0x116')](db['Variable'],{'as':_0xa82b('0x96'),'foreignKey':_0xa82b('0x1b8')});db[_0xa82b('0xa8')]['hasMany'](db[_0xa82b('0xaa')],{'as':_0xa82b('0x1b0'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b5')});db[_0xa82b('0xaa')]['hasMany'](db[_0xa82b('0xac')],{'as':'Subjects','onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b1')});db['SugarcrmConfiguration'][_0xa82b('0x10d')](db[_0xa82b('0xac')],{'as':_0xa82b('0x1b2'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0xaa')][_0xa82b('0x10d')](db[_0xa82b('0xac')],{'as':_0xa82b('0x1ad'),'onDelete':_0xa82b('0x10b'),'foreignKey':'FieldId'});db[_0xa82b('0xaa')]['belongsTo'](db['SugarcrmAccount'],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x1b5')});db[_0xa82b('0xac')]['hasMany'](db[_0xa82b('0xac')],{'as':_0xa82b('0x1b9'),'foreignKey':_0xa82b('0x1b1')});db[_0xa82b('0xac')]['hasMany'](db[_0xa82b('0xac')],{'as':'Description','foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0xac')][_0xa82b('0x10d')](db['SugarcrmField'],{'as':_0xa82b('0x1b7'),'foreignKey':_0xa82b('0x1b4')});db[_0xa82b('0xac')]['belongsTo'](db[_0xa82b('0x96')],{'as':_0xa82b('0x96'),'foreignKey':_0xa82b('0x1b8')});db[_0xa82b('0xae')][_0xa82b('0x10d')](db[_0xa82b('0x1ba')],{'as':_0xa82b('0x1b0'),'onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration']['hasMany'](db[_0xa82b('0xb0')],{'as':_0xa82b('0x1bb'),'onDelete':'cascade','foreignKey':_0xa82b('0x1b1')});db[_0xa82b('0x1ba')]['hasMany'](db['DeskField'],{'as':'Descriptions','onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0x1ba')]['hasMany'](db[_0xa82b('0xb0')],{'as':_0xa82b('0x1ad'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b4')});db['DeskConfiguration'][_0xa82b('0x116')](db[_0xa82b('0xae')],{'as':_0xa82b('0x164'),'foreignKey':'AccountId'});db[_0xa82b('0x1ba')]['belongsToMany'](db['Tag'],{'through':_0xa82b('0x1bc')});db[_0xa82b('0xb0')][_0xa82b('0x10d')](db['DeskField'],{'as':_0xa82b('0x1b9'),'foreignKey':'SubjectId'});db['DeskField'][_0xa82b('0x10d')](db[_0xa82b('0xb0')],{'as':_0xa82b('0x1b6'),'foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0xb0')][_0xa82b('0x10d')](db['DeskField'],{'as':_0xa82b('0x1b7'),'foreignKey':_0xa82b('0x1b4')});db[_0xa82b('0xb0')][_0xa82b('0x116')](db['Variable'],{'as':'Variable','foreignKey':_0xa82b('0x1b8')});db[_0xa82b('0xb2')][_0xa82b('0x10d')](db[_0xa82b('0xb3')],{'as':_0xa82b('0x1b0'),'onDelete':_0xa82b('0x10b'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0xa82b('0x10d')](db[_0xa82b('0xb5')],{'as':'Subjects','onDelete':_0xa82b('0x10b'),'foreignKey':'SubjectId'});db[_0xa82b('0xb3')][_0xa82b('0x10d')](db[_0xa82b('0xb5')],{'as':_0xa82b('0x1b2'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0xb3')][_0xa82b('0x10d')](db[_0xa82b('0xb5')],{'as':_0xa82b('0x1ad'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b4')});db[_0xa82b('0xb3')]['belongsTo'](db[_0xa82b('0xb2')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x1b5')});db[_0xa82b('0xb5')][_0xa82b('0x10d')](db[_0xa82b('0xb5')],{'as':_0xa82b('0x1b9'),'foreignKey':_0xa82b('0x1b1')});db['ZohoField'][_0xa82b('0x10d')](db[_0xa82b('0xb5')],{'as':_0xa82b('0x1b6'),'foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0xb5')]['hasMany'](db[_0xa82b('0xb5')],{'as':_0xa82b('0x1b7'),'foreignKey':_0xa82b('0x1b4')});db[_0xa82b('0xb5')][_0xa82b('0x116')](db[_0xa82b('0x96')],{'as':_0xa82b('0x96'),'foreignKey':'VariableId'});db[_0xa82b('0xb7')][_0xa82b('0x10d')](db[_0xa82b('0x1bd')],{'as':_0xa82b('0x1b0'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b5')});db[_0xa82b('0x1bd')]['hasMany'](db[_0xa82b('0xb9')],{'as':_0xa82b('0x1bb'),'foreignKey':_0xa82b('0x1b1')});db[_0xa82b('0x1bd')][_0xa82b('0x10d')](db[_0xa82b('0xb9')],{'as':_0xa82b('0x1b2'),'foreignKey':'DescriptionId'});db[_0xa82b('0x1bd')][_0xa82b('0x10d')](db['ZendeskField'],{'as':_0xa82b('0x1ad'),'foreignKey':_0xa82b('0x1b4')});db[_0xa82b('0x1bd')][_0xa82b('0x116')](db[_0xa82b('0xb7')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x1b5')});db[_0xa82b('0x1bd')]['belongsToMany'](db['Tag'],{'through':_0xa82b('0x1be')});db[_0xa82b('0xb9')][_0xa82b('0x10d')](db['ZendeskField'],{'as':_0xa82b('0x1b9'),'foreignKey':_0xa82b('0x1b1')});db[_0xa82b('0xb9')]['hasMany'](db['ZendeskField'],{'as':_0xa82b('0x1b6'),'foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0xb9')][_0xa82b('0x10d')](db[_0xa82b('0xb9')],{'as':_0xa82b('0x1b7'),'foreignKey':_0xa82b('0x1b4')});db['ZendeskField'][_0xa82b('0x116')](db['Variable'],{'as':_0xa82b('0x96'),'foreignKey':_0xa82b('0x1b8')});db[_0xa82b('0x1bf')][_0xa82b('0x10d')](db[_0xa82b('0x1c0')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xa82b('0x1b5')});db[_0xa82b('0x1c0')][_0xa82b('0x10d')](db[_0xa82b('0x1c1')],{'as':_0xa82b('0x1bb'),'onDelete':'cascade','foreignKey':_0xa82b('0x1b1')});db['FreshdeskConfiguration'][_0xa82b('0x10d')](db['FreshdeskField'],{'as':_0xa82b('0x1b2'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0x1c0')][_0xa82b('0x10d')](db['FreshdeskField'],{'as':_0xa82b('0x1ad'),'onDelete':_0xa82b('0x10b'),'foreignKey':'FieldId'});db[_0xa82b('0x1c0')][_0xa82b('0x116')](db[_0xa82b('0x1bf')],{'as':_0xa82b('0x164'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xa82b('0x118')](db[_0xa82b('0x91')],{'through':_0xa82b('0x1c2')});db[_0xa82b('0x1c1')][_0xa82b('0x10d')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0xa82b('0x1b1')});db['FreshdeskField'][_0xa82b('0x10d')](db[_0xa82b('0x1c1')],{'as':_0xa82b('0x1b6'),'foreignKey':_0xa82b('0x1b3')});db['FreshdeskField'][_0xa82b('0x10d')](db[_0xa82b('0x1c1')],{'as':_0xa82b('0x1b7'),'foreignKey':_0xa82b('0x1b4')});db[_0xa82b('0x1c1')][_0xa82b('0x116')](db[_0xa82b('0x96')],{'as':'Variable','foreignKey':_0xa82b('0x1b8')});db['VtigerAccount'][_0xa82b('0x10d')](db[_0xa82b('0xc0')],{'as':_0xa82b('0x1b0'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b5')});db[_0xa82b('0xc0')][_0xa82b('0x10d')](db[_0xa82b('0x1c3')],{'as':_0xa82b('0x1bb'),'foreignKey':_0xa82b('0x1b1')});db[_0xa82b('0xc0')]['hasMany'](db[_0xa82b('0x1c3')],{'as':_0xa82b('0x1b2'),'foreignKey':'DescriptionId'});db['VtigerConfiguration']['hasMany'](db[_0xa82b('0x1c3')],{'as':_0xa82b('0x1ad'),'foreignKey':_0xa82b('0x1b4')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':'Account','foreignKey':_0xa82b('0x1b5')});db['VtigerField'][_0xa82b('0x10d')](db[_0xa82b('0x1c3')],{'as':_0xa82b('0x1b9'),'foreignKey':_0xa82b('0x1b1')});db[_0xa82b('0x1c3')][_0xa82b('0x10d')](db[_0xa82b('0x1c3')],{'as':_0xa82b('0x1b6'),'foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0x1c3')][_0xa82b('0x10d')](db[_0xa82b('0x1c3')],{'as':_0xa82b('0x1b7'),'foreignKey':_0xa82b('0x1b4')});db['VtigerField'][_0xa82b('0x116')](db[_0xa82b('0x96')],{'as':_0xa82b('0x96'),'foreignKey':_0xa82b('0x1b8')});db[_0xa82b('0xc3')]['hasMany'](db[_0xa82b('0xc5')],{'as':_0xa82b('0x1b0'),'onDelete':'cascade','foreignKey':_0xa82b('0x1b5')});db[_0xa82b('0xc5')]['hasMany'](db[_0xa82b('0x1c4')],{'as':_0xa82b('0x1bb'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xa82b('0x10d')](db[_0xa82b('0x1c4')],{'as':_0xa82b('0x1b2'),'foreignKey':'DescriptionId'});db[_0xa82b('0xc5')][_0xa82b('0x10d')](db['ServicenowField'],{'as':'Fields','foreignKey':_0xa82b('0x1b4')});db[_0xa82b('0xc5')][_0xa82b('0x116')](db['ServicenowAccount'],{'as':_0xa82b('0x164'),'foreignKey':'AccountId'});db[_0xa82b('0x1c4')][_0xa82b('0x10d')](db[_0xa82b('0x1c4')],{'as':'Subject','foreignKey':_0xa82b('0x1b1')});db[_0xa82b('0x1c4')]['hasMany'](db[_0xa82b('0x1c4')],{'as':_0xa82b('0x1b6'),'foreignKey':'DescriptionId'});db[_0xa82b('0x1c4')][_0xa82b('0x10d')](db['ServicenowField'],{'as':'Field','foreignKey':'FieldId'});db[_0xa82b('0x1c4')][_0xa82b('0x116')](db[_0xa82b('0x96')],{'as':_0xa82b('0x96'),'foreignKey':_0xa82b('0x1b8')});db[_0xa82b('0x1c5')][_0xa82b('0x10d')](db[_0xa82b('0xc8')],{'as':_0xa82b('0x1b0'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b5')});db[_0xa82b('0xc8')][_0xa82b('0x10d')](db['Dynamics365Field'],{'as':_0xa82b('0x1bb'),'onDelete':_0xa82b('0x10b'),'foreignKey':'SubjectId'});db[_0xa82b('0xc8')][_0xa82b('0x10d')](db[_0xa82b('0xca')],{'as':_0xa82b('0x1b2'),'onDelete':'cascade','foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0xc8')][_0xa82b('0x10d')](db[_0xa82b('0xca')],{'as':_0xa82b('0x1ad'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1b4')});db[_0xa82b('0xc8')]['belongsTo'](db[_0xa82b('0x1c5')],{'as':_0xa82b('0x164'),'foreignKey':'AccountId'});db[_0xa82b('0xca')][_0xa82b('0x10d')](db['Dynamics365Field'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xa82b('0xca')]['hasMany'](db['Dynamics365Field'],{'as':_0xa82b('0x1b6'),'foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0xca')][_0xa82b('0x10d')](db[_0xa82b('0xca')],{'as':_0xa82b('0x1b7'),'foreignKey':_0xa82b('0x1b4')});db[_0xa82b('0xca')][_0xa82b('0x116')](db[_0xa82b('0x96')],{'as':_0xa82b('0x96'),'foreignKey':'VariableId'});db[_0xa82b('0xcb')][_0xa82b('0x10d')](db[_0xa82b('0x1c6')],{'as':'Configurations','onDelete':_0xa82b('0x10b'),'foreignKey':'AccountId'});db[_0xa82b('0x1c6')]['hasMany'](db[_0xa82b('0xcd')],{'as':'Subjects','foreignKey':_0xa82b('0x1b1')});db[_0xa82b('0x1c6')][_0xa82b('0x10d')](db[_0xa82b('0xcd')],{'as':'Descriptions','foreignKey':_0xa82b('0x1b3')});db[_0xa82b('0x1c6')][_0xa82b('0x10d')](db[_0xa82b('0xcd')],{'as':_0xa82b('0x1ad'),'foreignKey':'FieldId'});db[_0xa82b('0x1c6')][_0xa82b('0x116')](db[_0xa82b('0xcb')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x1b5')});db['FreshsalesField']['hasMany'](db[_0xa82b('0xcd')],{'as':_0xa82b('0x1b9'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0xa82b('0x10d')](db[_0xa82b('0xcd')],{'as':_0xa82b('0x1b6'),'foreignKey':_0xa82b('0x1b3')});db['FreshsalesField'][_0xa82b('0x10d')](db[_0xa82b('0xcd')],{'as':'Field','foreignKey':'FieldId'});db[_0xa82b('0xcd')][_0xa82b('0x116')](db[_0xa82b('0x96')],{'as':'Variable','foreignKey':'VariableId'});db[_0xa82b('0xd0')][_0xa82b('0x116')](db[_0xa82b('0x132')],{});db[_0xa82b('0xd0')][_0xa82b('0x116')](db['CmList'],{'as':_0xa82b('0x168'),'foreignKey':_0xa82b('0x169')});db[_0xa82b('0xd0')][_0xa82b('0x116')](db['CmContact'],{'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153')});db[_0xa82b('0xd0')]['belongsTo'](db[_0xa82b('0x69')],{});db[_0xa82b('0xd0')][_0xa82b('0x116')](db[_0xa82b('0x6b')],{});db[_0xa82b('0xd0')]['belongsTo'](db[_0xa82b('0x12')],{});db['ChatQueueReport'][_0xa82b('0x116')](db[_0xa82b('0x6e')],{});db[_0xa82b('0xd1')]['belongsTo'](db['User'],{'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1c7')});db[_0xa82b('0xd1')]['belongsTo'](db['User'],{'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1c8')});db[_0xa82b('0xd4')][_0xa82b('0x10d')](db[_0xa82b('0x1c9')],{'foreignKey':_0xa82b('0x1ca'),'onDelete':_0xa82b('0x10b')});db[_0xa82b('0xd4')][_0xa82b('0x10d')](db['JscriptyAnswerReport'],{'foreignKey':_0xa82b('0x1ca'),'onDelete':'cascade'});db[_0xa82b('0xd6')][_0xa82b('0x116')](db[_0xa82b('0x53')],{});db['SmsQueueReport'][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':'List','foreignKey':_0xa82b('0x169')});db['SmsQueueReport'][_0xa82b('0x116')](db['CmContact'],{'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153')});db['SmsQueueReport'][_0xa82b('0x116')](db[_0xa82b('0x56')],{});db['SmsQueueReport'][_0xa82b('0x116')](db[_0xa82b('0x58')],{});db['SmsQueueReport'][_0xa82b('0x116')](db[_0xa82b('0x12')],{});db[_0xa82b('0xd6')][_0xa82b('0x116')](db[_0xa82b('0x59')],{});db[_0xa82b('0xdb')][_0xa82b('0x10d')](db[_0xa82b('0xd4')],{'foreignKey':'ProjectId'});db[_0xa82b('0xdb')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0xa82b('0xdb')][_0xa82b('0x10d')](db[_0xa82b('0x1cb')],{'foreignKey':_0xa82b('0x1cc')});db[_0xa82b('0x1cd')]['belongsToMany'](db[_0xa82b('0x12')],{'as':_0xa82b('0x16f'),'through':_0xa82b('0x13b')});db[_0xa82b('0x11e')][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':'Agents','through':_0xa82b('0x11f')});db[_0xa82b('0x11e')]['belongsToMany'](db[_0xa82b('0x19')],{'through':'TeamVoiceQueue','as':_0xa82b('0x127')});db['Team']['belongsToMany'](db[_0xa82b('0x128')],{'through':'team_has_mail_queues','as':_0xa82b('0x129')});db[_0xa82b('0x11e')][_0xa82b('0x118')](db[_0xa82b('0x6e')],{'through':_0xa82b('0x18a'),'as':_0xa82b('0x12a')});db[_0xa82b('0x11e')][_0xa82b('0x118')](db['FaxQueue'],{'through':_0xa82b('0x171'),'as':'FaxQueues'});db[_0xa82b('0x11e')]['belongsToMany'](db['SmsQueue'],{'through':_0xa82b('0x17a'),'as':_0xa82b('0x12c')});db[_0xa82b('0x11e')]['belongsToMany'](db[_0xa82b('0x17c')],{'through':_0xa82b('0x181'),'as':_0xa82b('0x12d')});db['Team'][_0xa82b('0x118')](db[_0xa82b('0x12e')],{'through':_0xa82b('0x1ce'),'as':'WhatsappQueues'});db[_0xa82b('0x192')][_0xa82b('0x10d')](db[_0xa82b('0x76')],{'as':_0xa82b('0x142'),'foreignKey':_0xa82b('0x193')});db[_0xa82b('0x192')][_0xa82b('0x10d')](db[_0xa82b('0x79')],{'as':_0xa82b('0x143'),'foreignKey':'CampaignId'});db[_0xa82b('0x192')][_0xa82b('0x10d')](db['CmHopperHistory'],{'as':_0xa82b('0x144'),'foreignKey':_0xa82b('0x193')});db[_0xa82b('0x192')][_0xa82b('0x10d')](db[_0xa82b('0x194')],{'as':_0xa82b('0x145'),'foreignKey':_0xa82b('0x193')});db[_0xa82b('0x192')]['belongsTo'](db[_0xa82b('0x26')],{'as':_0xa82b('0x26'),'foreignKey':_0xa82b('0x147')});db[_0xa82b('0x192')]['belongsTo'](db['Trunk'],{'as':_0xa82b('0x148'),'foreignKey':_0xa82b('0x1cf')});db[_0xa82b('0x192')][_0xa82b('0x116')](db[_0xa82b('0x86')],{'as':_0xa82b('0x86'),'foreignKey':_0xa82b('0x17e')});db['Campaign'][_0xa82b('0x116')](db['SquareProject'],{'as':_0xa82b('0x1cd'),'foreignKey':'SquareProjectId'});db[_0xa82b('0x192')][_0xa82b('0x118')](db[_0xa82b('0xf5')],{'as':_0xa82b('0x11c'),'through':'campaigns_has_cm_lists'});db[_0xa82b('0x192')][_0xa82b('0x118')](db['CmList'],{'as':_0xa82b('0x14c'),'through':_0xa82b('0x1d0')});db[_0xa82b('0xea')][_0xa82b('0x116')](db[_0xa82b('0x6c')],{'as':_0xa82b('0x6c'),'foreignKey':_0xa82b('0x166')});db[_0xa82b('0xed')]['belongsTo'](db[_0xa82b('0x3f')],{});db[_0xa82b('0xed')][_0xa82b('0x116')](db['MailInteraction'],{});db[_0xa82b('0xed')][_0xa82b('0x116')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xa82b('0x1d1')});db['MailTransferReport'][_0xa82b('0x116')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db['MailTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x12')],{'foreignKey':_0xa82b('0x1d2'),'as':_0xa82b('0x1d3')});db['MailTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x128')],{'foreignKey':_0xa82b('0x1d4'),'as':'ToQueue'});db[_0xa82b('0xed')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xa82b('0x1d5'),'as':_0xa82b('0x1d6')});db['ChatTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x6b')],{});db[_0xa82b('0xee')][_0xa82b('0x116')](db[_0xa82b('0x69')],{});db['ChatTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x132')],{'foreignKey':_0xa82b('0x1d7'),'as':_0xa82b('0x1d1')});db['ChatTransferReport'][_0xa82b('0x116')](db['User'],{'foreignKey':_0xa82b('0x1d8'),'as':'FromAgent'});db[_0xa82b('0xee')][_0xa82b('0x116')](db['User'],{'foreignKey':'ToUserId','as':_0xa82b('0x1d3')});db[_0xa82b('0xee')]['belongsTo'](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xa82b('0xee')][_0xa82b('0x116')](db[_0xa82b('0x132')],{'foreignKey':_0xa82b('0x1d9'),'as':'ToAccount'});db['FaxTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x4e')],{});db['FaxTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x4c')],{});db[_0xa82b('0xef')][_0xa82b('0x116')](db[_0xa82b('0x48')],{'foreignKey':_0xa82b('0x1da'),'as':_0xa82b('0x1d1')});db['FaxTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x12')],{'foreignKey':_0xa82b('0x1d8'),'as':_0xa82b('0x1db')});db['FaxTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x12')],{'foreignKey':_0xa82b('0x1d2'),'as':_0xa82b('0x1d3')});db[_0xa82b('0xef')][_0xa82b('0x116')](db[_0xa82b('0x50')],{'foreignKey':'ToFaxQueueId','as':_0xa82b('0x1dc')});db[_0xa82b('0xef')]['belongsTo'](db[_0xa82b('0x48')],{'foreignKey':'ToFaxAccountId','as':_0xa82b('0x1d6')});db['OpenchannelTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x61')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x5b')],{'foreignKey':'FromOpenchannelAccountId','as':_0xa82b('0x1d1')});db[_0xa82b('0xf1')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'foreignKey':_0xa82b('0x1d8'),'as':_0xa82b('0x1db')});db[_0xa82b('0xf1')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'foreignKey':_0xa82b('0x1d2'),'as':_0xa82b('0x1d3')});db[_0xa82b('0xf1')][_0xa82b('0x116')](db[_0xa82b('0x17c')],{'foreignKey':_0xa82b('0x1dd'),'as':_0xa82b('0x1dc')});db[_0xa82b('0xf1')]['belongsTo'](db[_0xa82b('0x5b')],{'foreignKey':_0xa82b('0x1de'),'as':_0xa82b('0x1d6')});db[_0xa82b('0xf3')][_0xa82b('0x116')](db['SmsMessage'],{});db['SmsTransferReport'][_0xa82b('0x116')](db['SmsInteraction'],{});db[_0xa82b('0xf3')]['belongsTo'](db[_0xa82b('0x53')],{'foreignKey':_0xa82b('0x1df'),'as':'FromAccount'});db[_0xa82b('0xf3')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'foreignKey':'FromUserId','as':_0xa82b('0x1db')});db[_0xa82b('0xf3')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'foreignKey':_0xa82b('0x1d2'),'as':_0xa82b('0x1d3')});db[_0xa82b('0xf3')][_0xa82b('0x116')](db[_0xa82b('0x59')],{'foreignKey':_0xa82b('0x1e0'),'as':_0xa82b('0x1dc')});db[_0xa82b('0xf3')][_0xa82b('0x116')](db['SmsAccount'],{'foreignKey':_0xa82b('0x1e1'),'as':_0xa82b('0x1d6')});db[_0xa82b('0xf5')][_0xa82b('0x10d')](db['Disposition'],{'as':_0xa82b('0x157'),'foreignKey':_0xa82b('0x169')});db['CmList'][_0xa82b('0x10d')](db[_0xa82b('0x7d')],{'as':_0xa82b('0x1e2'),'foreignKey':'ListId'});db['CmList'][_0xa82b('0x10d')](db[_0xa82b('0x74')],{'as':_0xa82b('0x1e3'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x169')});db[_0xa82b('0xf5')][_0xa82b('0x10d')](db[_0xa82b('0x79')],{'as':_0xa82b('0x143'),'foreignKey':_0xa82b('0x169')});db[_0xa82b('0xf5')]['hasMany'](db['CmHopperHistory'],{'as':_0xa82b('0x1e4'),'foreignKey':_0xa82b('0x169')});db[_0xa82b('0xf5')][_0xa82b('0x10d')](db[_0xa82b('0x112')],{'as':'ReportAgentPreview','foreignKey':_0xa82b('0x169')});db[_0xa82b('0xf5')]['belongsToMany'](db[_0xa82b('0x19')],{'as':_0xa82b('0x1e5'),'through':_0xa82b('0x14a')});db[_0xa82b('0xf5')][_0xa82b('0x118')](db['User'],{'as':_0xa82b('0x14b'),'through':_0xa82b('0x11d')});db[_0xa82b('0xf6')][_0xa82b('0x10d')](db[_0xa82b('0x110')],{'as':_0xa82b('0x111'),'onDelete':_0xa82b('0x10b')});db['VoicePrefix'][_0xa82b('0x118')](db['User'],{'as':_0xa82b('0x14b'),'through':_0xa82b('0x131')});db['UserProfile'][_0xa82b('0x10d')](db[_0xa82b('0x12')],{'as':_0xa82b('0x16f'),'foreignKey':'userProfileId'});db[_0xa82b('0xf8')][_0xa82b('0x10d')](db[_0xa82b('0xf9')],{'as':_0xa82b('0x1e6'),'foreignKey':_0xa82b('0x117'),'onDelete':_0xa82b('0x10b')});db[_0xa82b('0xf9')][_0xa82b('0x10d')](db[_0xa82b('0xfb')],{'as':_0xa82b('0x1e7'),'foreignKey':_0xa82b('0x1e8'),'onDelete':_0xa82b('0x10b')});db[_0xa82b('0x1e9')][_0xa82b('0x10d')](db['Disposition'],{'as':_0xa82b('0x157'),'foreignKey':_0xa82b('0x1ea')});db[_0xa82b('0x1e9')][_0xa82b('0x10d')](db[_0xa82b('0x81')],{'as':_0xa82b('0x158'),'foreignKey':_0xa82b('0x1ea')});db['WhatsappAccount']['hasMany'](db[_0xa82b('0x1eb')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0xa82b('0x1e9')][_0xa82b('0x10d')](db[_0xa82b('0xff')],{'as':_0xa82b('0x159')});db[_0xa82b('0x1e9')][_0xa82b('0x10d')](db[_0xa82b('0x1ec')],{'as':_0xa82b('0x13e')});db['WhatsappAccount'][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':'List','foreignKey':_0xa82b('0x169')});db['WhatsappAccount']['belongsTo'](db[_0xa82b('0x88')],{'as':_0xa82b('0x149'),'foreignKey':_0xa82b('0x15c')});db[_0xa82b('0x1e9')]['belongsToMany'](db[_0xa82b('0x12')],{'as':_0xa82b('0x14b'),'through':_0xa82b('0x13a')});db['WhatsappApplication']['belongsTo'](db[_0xa82b('0x12')],{'onDelete':_0xa82b('0x167')});db[_0xa82b('0x1ec')][_0xa82b('0x116')](db[_0xa82b('0x12e')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xa82b('0x116')](db[_0xa82b('0x1e9')],{'onDelete':_0xa82b('0x167')});db[_0xa82b('0x1ec')][_0xa82b('0x116')](db[_0xa82b('0x86')],{'onDelete':_0xa82b('0x167'),'foreignKey':_0xa82b('0x17e')});db[_0xa82b('0x1ec')]['belongsTo'](db[_0xa82b('0x91')],{'onDelete':'restrict','foreignKey':_0xa82b('0x16c')});db[_0xa82b('0xff')][_0xa82b('0x10d')](db['WhatsappMessage'],{'as':_0xa82b('0x15e'),'onDelete':_0xa82b('0x10b'),'foreignKey':_0xa82b('0x1ed')});db[_0xa82b('0xff')][_0xa82b('0x116')](db[_0xa82b('0x1e9')],{'as':_0xa82b('0x164'),'foreignKey':_0xa82b('0x1ea')});db['WhatsappInteraction']['belongsTo'](db['CmContact'],{'as':_0xa82b('0x152'),'foreignKey':_0xa82b('0x153')});db[_0xa82b('0xff')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'as':'Owner','foreignKey':_0xa82b('0x10c')});db[_0xa82b('0xff')][_0xa82b('0x118')](db['Tag'],{'through':_0xa82b('0x1a5'),'as':'Tags'});db[_0xa82b('0xff')][_0xa82b('0x118')](db['Tag'],{'through':_0xa82b('0x1a5'),'as':'ThroughTags'});db[_0xa82b('0xff')][_0xa82b('0x118')](db[_0xa82b('0x12')],{'as':_0xa82b('0x16f'),'through':_0xa82b('0x126'),'foreignKey':_0xa82b('0x1ed')});db[_0xa82b('0x1eb')][_0xa82b('0x116')](db['User'],{'as':_0xa82b('0x12')});db[_0xa82b('0x1eb')][_0xa82b('0x116')](db['CmContact'],{'onDelete':_0xa82b('0x10b'),'as':_0xa82b('0x152')});db['WhatsappMessage'][_0xa82b('0x116')](db[_0xa82b('0xff')],{'onDelete':_0xa82b('0x10b'),'as':_0xa82b('0x163'),'foreignKey':'WhatsappInteractionId'});db[_0xa82b('0x1eb')][_0xa82b('0x116')](db[_0xa82b('0x1e9')],{'as':'Account','foreignKey':_0xa82b('0x1ea')});db[_0xa82b('0x102')][_0xa82b('0x116')](db[_0xa82b('0x1e9')],{});db[_0xa82b('0x102')][_0xa82b('0x116')](db[_0xa82b('0xf5')],{'as':_0xa82b('0x168'),'foreignKey':_0xa82b('0x169')});db[_0xa82b('0x102')]['belongsTo'](db[_0xa82b('0x74')],{'as':_0xa82b('0x152'),'foreignKey':'ContactId'});db[_0xa82b('0x102')][_0xa82b('0x116')](db[_0xa82b('0xff')],{});db[_0xa82b('0x102')][_0xa82b('0x116')](db[_0xa82b('0x12e')],{});db[_0xa82b('0x102')][_0xa82b('0x116')](db[_0xa82b('0x1eb')],{});db[_0xa82b('0x102')][_0xa82b('0x116')](db[_0xa82b('0x12')],{});db['WhatsappTransferReport'][_0xa82b('0x116')](db[_0xa82b('0x1eb')],{});db[_0xa82b('0x104')][_0xa82b('0x116')](db[_0xa82b('0xff')],{});db[_0xa82b('0x104')]['belongsTo'](db[_0xa82b('0x1e9')],{'foreignKey':_0xa82b('0x1ee'),'as':'FromAccount'});db[_0xa82b('0x104')][_0xa82b('0x116')](db[_0xa82b('0x1e9')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0xa82b('0x104')][_0xa82b('0x116')](db['WhatsappQueue'],{'foreignKey':_0xa82b('0x1ef'),'as':'ToQueue'});db[_0xa82b('0x104')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'foreignKey':_0xa82b('0x1d8'),'as':_0xa82b('0x1db')});db[_0xa82b('0x104')][_0xa82b('0x116')](db[_0xa82b('0x12')],{'foreignKey':_0xa82b('0x1d2'),'as':_0xa82b('0x1d3')});db[_0xa82b('0x12e')][_0xa82b('0x118')](db['User'],{'as':_0xa82b('0x14b'),'through':_0xa82b('0x34'),'foreignKey':'WhatsappQueueId'});db[_0xa82b('0x12e')][_0xa82b('0x118')](db[_0xa82b('0x11e')],{'through':_0xa82b('0x1ce'),'as':_0xa82b('0x172')});module[_0xa82b('0x1f0')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x405c=['../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','VoiceRecording','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteraction','UserNotifications','SenderId','belongsTo','userProfileId','Groups','belongsToMany','Contacts','cm_user_has_contacts','Lists','MailInteraction','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','UserVoiceQueue','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceExtension','Applications','Sound','Sounds','Members','VoiceQueueId','Hoppers','JscriptySessions','TrunkId','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Answers','Interactions','ListId','TemplateId','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','Users','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','List','Dashboard','Items','FaxAccount','Dispositions','Messages','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','IntervalId','SmsInteractionId','sms_interaction_has_tags','ThroughTags','user_has_sms_interactions','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatApplication','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','UserChatQueue','team_has_chat_queues','ChatGroupId','chat_group_has_users','CmCompany','HopperHistories','CompanyId','cm_contact_has_tags','Agent','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','Schedule','DefaultReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','AnalyticCustomReport','CustomReportId','Fields','AnalyticMetric','MetricId','AccountId','Subjects','SubjectId','Descriptions','FieldId','Description','DescriptionId','Field','VariableId','SugarcrmConfiguration','Configurations','DeskField','int_desk_configuration_has_tags','Subject','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','FromId','ToId','SessionId','ProjectId','user_has_teams','MailQueues','WhatsappQueue','team_has_whatsapp_queues','HopperBlacks','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','FromAccount','FromUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CmCustomField','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','path','../config/environment','lodash','jstz','sequelize','xcall','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','xC@LL1234','username','password','options','database','User','../api/user/user.model','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/schedule/schedule.model','Template','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticDefaultReport','AnalyticExtractedReport'];(function(_0x30d0c9,_0x48d21f){var _0x14f441=function(_0xd1b9de){while(--_0xd1b9de){_0x30d0c9['push'](_0x30d0c9['shift']());}};_0x14f441(++_0x48d21f);}(_0x405c,0x160));var _0xc405=function(_0x5e3d72,_0x15c9e9){_0x5e3d72=_0x5e3d72-0x0;var _0x4866dc=_0x405c[_0x5e3d72];return _0x4866dc;};'use strict';var path=require(_0xc405('0x0'));var config=require(_0xc405('0x1'));var Sequelize=require('sequelize');var _=require(_0xc405('0x2'));var jstz=require(_0xc405('0x3'));var timezone=jstz['determine']();config[_0xc405('0x4')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':_0xc405('0x5'),'password':'xC@LL1234','options':{'host':_0xc405('0x6'),'port':0xcea,'dialect':_0xc405('0x7'),'dialectOptions':{'charset':_0xc405('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xc405('0x9'),'collate':_0xc405('0xa')}}});config[_0xc405('0xb')]=_[_0xc405('0xc')](config[_0xc405('0xb')],{'database':_0xc405('0xd'),'username':_0xc405('0x5'),'password':_0xc405('0xe'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xc405('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xc405('0x9'),'collate':_0xc405('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc405('0x4')]['database'],config[_0xc405('0x4')][_0xc405('0xf')],config[_0xc405('0x4')][_0xc405('0x10')],config[_0xc405('0x4')][_0xc405('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc405('0xb')][_0xc405('0x12')],config[_0xc405('0xb')][_0xc405('0xf')],config['sequelizeHistory']['password'],config[_0xc405('0xb')]['options'])};db[_0xc405('0x13')]=db[_0xc405('0x4')]['import'](_0xc405('0x14'));db['VoiceChanSpy']=db[_0xc405('0x4')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0xc405('0x15')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x17'));db['VoiceExtension']=db[_0xc405('0x4')][_0xc405('0x16')]('../api/voiceExtension/voiceExtension.model');db[_0xc405('0x18')]=db['sequelize']['import'](_0xc405('0x19'));db['VoiceQueue']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x1a'));db['VoiceRecording']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x1b'));db[_0xc405('0x1c')]=db[_0xc405('0x4')]['import'](_0xc405('0x1d'));db[_0xc405('0x1e')]=db['sequelize'][_0xc405('0x16')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x1f'));db[_0xc405('0x20')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x21'));db[_0xc405('0x22')]=db[_0xc405('0x4')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xc405('0x23')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x24'));db['VoiceQueueReport']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x25'));db[_0xc405('0x26')]=db['sequelize'][_0xc405('0x16')](_0xc405('0x27'));db[_0xc405('0x28')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0xc405('0x4')]['import'](_0xc405('0x29'));db[_0xc405('0x2a')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x2b'));db['UserVoiceQueue']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x2c'));db['UserChatQueue']=db[_0xc405('0x4')][_0xc405('0x16')]('../api/userChatQueue/userChatQueue.model');db[_0xc405('0x2d')]=db['sequelize'][_0xc405('0x16')](_0xc405('0x2e'));db[_0xc405('0x2f')]=db['sequelize'][_0xc405('0x16')](_0xc405('0x30'));db['UserSmsQueue']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x31'));db['UserOpenchannelQueue']=db[_0xc405('0x4')][_0xc405('0x16')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xc405('0x32')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xc405('0x33')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x34'));db[_0xc405('0x35')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x36'));db[_0xc405('0x37')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x38'));db[_0xc405('0x39')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/mailQueue/mailQueue.model');db[_0xc405('0x3a')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x3b'));db[_0xc405('0x3c')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x3d'));db[_0xc405('0x3e')]=db[_0xc405('0x4')]['import']('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x3f'));db['Dashboard']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x40'));db[_0xc405('0x41')]=db[_0xc405('0x4')]['import'](_0xc405('0x42'));db['FaxAccount']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x43'));db[_0xc405('0x44')]=db[_0xc405('0x4')]['import'](_0xc405('0x45'));db['FaxInteraction']=db[_0xc405('0x4')][_0xc405('0x16')]('../api/faxInteraction/faxInteraction.model');db[_0xc405('0x46')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x47'));db[_0xc405('0x48')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/faxQueue/faxQueue.model');db[_0xc405('0x49')]=db['sequelize'][_0xc405('0x16')](_0xc405('0x4a'));db[_0xc405('0x4b')]=db['sequelize']['import'](_0xc405('0x4c'));db['SmsApplication']=db['sequelize'][_0xc405('0x16')](_0xc405('0x4d'));db[_0xc405('0x4e')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x4f'));db[_0xc405('0x50')]=db['sequelize'][_0xc405('0x16')](_0xc405('0x51'));db[_0xc405('0x52')]=db['sequelize'][_0xc405('0x16')]('../api/smsQueue/smsQueue.model');db[_0xc405('0x53')]=db['sequelize'][_0xc405('0x16')]('../api/openchannelAccount/openchannelAccount.model');db[_0xc405('0x54')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/openchannelApplication/openchannelApplication.model');db[_0xc405('0x55')]=db[_0xc405('0x4')]['import'](_0xc405('0x56'));db['OpenchannelMessage']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x57'));db[_0xc405('0x58')]=db[_0xc405('0x4')]['import'](_0xc405('0x59'));db[_0xc405('0x5a')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/chatWebsite/chatWebsite.model');db[_0xc405('0x5b')]=db['sequelize']['import'](_0xc405('0x5c'));db['ChatApplication']=db['sequelize'][_0xc405('0x16')](_0xc405('0x5d'));db['ChatInteraction']=db[_0xc405('0x4')][_0xc405('0x16')]('../api/chatInteraction/chatInteraction.model');db[_0xc405('0x5e')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/chatMessage/chatMessage.model');db[_0xc405('0x5f')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x60'));db[_0xc405('0x61')]=db['sequelize']['import'](_0xc405('0x62'));db[_0xc405('0x63')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/chatGroup/chatGroup.model');db[_0xc405('0x64')]=db['sequelize']['import'](_0xc405('0x65'));db['CmCompany']=db['sequelize'][_0xc405('0x16')](_0xc405('0x66'));db[_0xc405('0x67')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x68'));db[_0xc405('0x69')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x6a'));db[_0xc405('0x6b')]=db['sequelize'][_0xc405('0x16')](_0xc405('0x6c'));db[_0xc405('0x6d')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x6e'));db[_0xc405('0x6f')]=db['sequelize'][_0xc405('0x16')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0xc405('0x16')](_0xc405('0x70'));db[_0xc405('0x71')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x72'));db[_0xc405('0x73')]=db[_0xc405('0x4')]['import'](_0xc405('0x74'));db[_0xc405('0x75')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x76'));db[_0xc405('0x77')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x78'));db[_0xc405('0x79')]=db[_0xc405('0x4')]['import']('../api/condition/condition.model');db[_0xc405('0x7a')]=db['sequelize'][_0xc405('0x16')](_0xc405('0x7b'));db[_0xc405('0x7c')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x7d'));db[_0xc405('0x7e')]=db[_0xc405('0x4')]['import']('../api/cdr/cdr.model');db[_0xc405('0x7f')]=db['sequelize'][_0xc405('0x16')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x80'));db['Sound']=db['sequelize'][_0xc405('0x16')]('../api/sound/sound.model');db['Tag']=db[_0xc405('0x4')][_0xc405('0x16')]('../api/tag/tag.model');db[_0xc405('0x81')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/template/template.model');db['Trigger']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x82'));db[_0xc405('0x83')]=db['sequelize'][_0xc405('0x16')](_0xc405('0x84'));db[_0xc405('0x85')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x86'));db[_0xc405('0x87')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0xc405('0x4')][_0xc405('0x16')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xc405('0x88')]=db['sequelize']['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xc405('0x89')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x8a'));db['AnalyticMetric']=db['sequelize'][_0xc405('0x16')]('../api/analyticMetric/analyticMetric.model');db[_0xc405('0x8b')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xc405('0x8c')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xc405('0x8d')]=db['sequelize'][_0xc405('0x16')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xc405('0x8e')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x8f'));db[_0xc405('0x90')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x91'));db[_0xc405('0x92')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x93'));db['SugarcrmConfiguration']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x94'));db[_0xc405('0x95')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xc405('0x96')]=db['sequelize']['import']('../api/intDeskAccount/intDeskAccount.model');db[_0xc405('0x97')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x98'));db['DeskField']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x99'));db[_0xc405('0x9a')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0x9b'));db[_0xc405('0x9c')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xc405('0x9d')]=db['sequelize'][_0xc405('0x16')](_0xc405('0x9e'));db[_0xc405('0x9f')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xc405('0xa0')]=db['sequelize'][_0xc405('0x16')](_0xc405('0xa1'));db['ZendeskField']=db[_0xc405('0x4')][_0xc405('0x16')]('../api/intZendeskField/intZendeskField.model');db[_0xc405('0xa2')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xc405('0xa3')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xa4'));db[_0xc405('0xa5')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xc405('0xa6')]=db[_0xc405('0x4')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0xc405('0x4')]['import'](_0xc405('0xa7'));db[_0xc405('0xa8')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xa9'));db[_0xc405('0xaa')]=db[_0xc405('0x4')]['import'](_0xc405('0xab'));db[_0xc405('0xac')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xad'));db[_0xc405('0xae')]=db[_0xc405('0x4')]['import'](_0xc405('0xaf'));db[_0xc405('0xb0')]=db[_0xc405('0x4')]['import'](_0xc405('0xb1'));db[_0xc405('0xb2')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xb3'));db[_0xc405('0xb4')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0xc405('0x4')]['import'](_0xc405('0xb5'));db[_0xc405('0xb6')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xb7'));db[_0xc405('0xb8')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xb9'));db[_0xc405('0x85')]=db[_0xc405('0x4')]['import']('../api/integration/integration.model');db['Network']=db[_0xc405('0x4')][_0xc405('0x16')]('../api/network/network.model');db[_0xc405('0xba')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xbb'));db[_0xc405('0xbc')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xc405('0xbd')]=db[_0xc405('0x4')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xc405('0xbe')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xc405('0xbf')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xc405('0xc0')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/smsQueueReport/smsQueueReport.model');db[_0xc405('0xc1')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xc2'));db[_0xc405('0xc3')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xc4'));db[_0xc405('0xc5')]=db['sequelize']['import'](_0xc405('0xc6'));db[_0xc405('0xc7')]=db[_0xc405('0x4')]['import'](_0xc405('0xc8'));db[_0xc405('0xc9')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xca'));db[_0xc405('0xcb')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xcc'));db[_0xc405('0xcd')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xce'));db[_0xc405('0xcf')]=db[_0xc405('0x4')]['import']('../api/squareMessage/squareMessage.model');db[_0xc405('0xd0')]=db[_0xc405('0x4')]['import'](_0xc405('0xd1'));db[_0xc405('0xd2')]=db['sequelize'][_0xc405('0x16')](_0xc405('0xd3'));db[_0xc405('0xd4')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/campaign/campaign.model');db[_0xc405('0xd5')]=db[_0xc405('0x4')][_0xc405('0x16')]('../api/migration/migration.model');db['Attachment']=db['sequelize'][_0xc405('0x16')](_0xc405('0xd6'));db['Plugin']=db[_0xc405('0x4')]['import'](_0xc405('0xd7'));db[_0xc405('0xd8')]=db[_0xc405('0x4')]['import'](_0xc405('0xd9'));db[_0xc405('0xda')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xdb'));db[_0xc405('0xdc')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xdd'));db['OpenchannelTransferReport']=db['sequelize'][_0xc405('0x16')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0xc405('0x4')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0xc405('0xde')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xdf'));db[_0xc405('0xe0')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xe1'));db[_0xc405('0xe2')]=db[_0xc405('0x4')]['import'](_0xc405('0xe3'));db[_0xc405('0xe4')]=db['sequelize']['import'](_0xc405('0xe5'));db[_0xc405('0xe6')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xe7'));db[_0xc405('0xe8')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xe9'));db['WhatsappAccount']=db[_0xc405('0x4')]['import'](_0xc405('0xea'));db['WhatsappApplication']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xeb'));db[_0xc405('0xec')]=db['sequelize'][_0xc405('0x16')](_0xc405('0xed'));db[_0xc405('0xee')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xef'));db['WhatsappQueueReport']=db[_0xc405('0x4')][_0xc405('0x16')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xc405('0xf0')]=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xf1'));db['WhatsappQueue']=db['sequelize'][_0xc405('0x16')](_0xc405('0xf2'));db['CloudProvider']=db['sequelize'][_0xc405('0x16')](_0xc405('0xf3'));db['TeamVoiceQueue']=db[_0xc405('0x4')][_0xc405('0x16')](_0xc405('0xf4'));db[_0xc405('0x13')][_0xc405('0xf5')](db['VoiceMail'],{'as':_0xc405('0x1e'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0xf7')});db[_0xc405('0x13')][_0xc405('0xf8')](db[_0xc405('0xf9')],{'as':'Recordings','foreignKey':'UserId'});db[_0xc405('0x13')][_0xc405('0xf8')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0xc405('0xf7')});db[_0xc405('0x13')]['hasMany'](db['VoiceExtension'],{'as':_0xc405('0xfa'),'onDelete':_0xc405('0xf6'),'hooks':!![]});db['User'][_0xc405('0xf8')](db[_0xc405('0x6d')],{'as':_0xc405('0xfb'),'foreignKey':_0xc405('0xf7')});db[_0xc405('0x13')][_0xc405('0xf8')](db[_0xc405('0xfc')],{'as':_0xc405('0xfd'),'foreignKey':'UserId'});db[_0xc405('0x13')]['hasMany'](db[_0xc405('0x6f')],{'as':_0xc405('0x6f'),'foreignKey':_0xc405('0xf7')});db[_0xc405('0x13')]['hasMany'](db[_0xc405('0x55')],{'as':_0xc405('0xfe'),'foreignKey':_0xc405('0xf7')});db[_0xc405('0x13')][_0xc405('0xf8')](db[_0xc405('0xff')],{'as':_0xc405('0x100'),'foreignKey':_0xc405('0xf7')});db[_0xc405('0x13')][_0xc405('0xf8')](db[_0xc405('0x4e')],{'as':_0xc405('0x101'),'foreignKey':_0xc405('0xf7')});db[_0xc405('0x13')][_0xc405('0xf8')](db[_0xc405('0x102')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0xc405('0x13')][_0xc405('0xf8')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'UserId'});db[_0xc405('0x13')][_0xc405('0xf8')](db[_0xc405('0xec')],{'as':'WhatsappInteractions','foreignKey':_0xc405('0xf7')});db[_0xc405('0x13')][_0xc405('0xf8')](db['UserNotification'],{'as':_0xc405('0x103'),'foreignKey':_0xc405('0x104')});db[_0xc405('0x13')][_0xc405('0x105')](db[_0xc405('0xe2')],{'as':_0xc405('0xe2'),'foreignKey':_0xc405('0x106')});db['User']['belongsToMany'](db[_0xc405('0x63')],{'as':_0xc405('0x107'),'through':'chat_group_has_users'});db[_0xc405('0x13')][_0xc405('0x108')](db['CmContact'],{'as':_0xc405('0x109'),'through':_0xc405('0x10a')});db[_0xc405('0x13')][_0xc405('0x108')](db['CmList'],{'as':_0xc405('0x10b'),'through':'cm_user_has_lists'});db[_0xc405('0x13')]['belongsToMany'](db[_0xc405('0xd0')],{'through':'user_has_teams'});db[_0xc405('0x13')][_0xc405('0x108')](db[_0xc405('0x10c')],{'as':_0xc405('0x10d'),'through':_0xc405('0x10e')});db['User'][_0xc405('0x108')](db[_0xc405('0xff')],{'as':_0xc405('0x100'),'through':_0xc405('0x10f')});db[_0xc405('0x13')][_0xc405('0x108')](db[_0xc405('0x102')],{'as':_0xc405('0x110'),'through':_0xc405('0x111')});db[_0xc405('0x13')]['belongsToMany'](db[_0xc405('0x4e')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db['User'][_0xc405('0x108')](db[_0xc405('0x55')],{'as':'OpenchannelInteractions','through':_0xc405('0x112')});db[_0xc405('0x13')][_0xc405('0x108')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xc405('0x13')][_0xc405('0x108')](db[_0xc405('0x113')],{'as':_0xc405('0x114'),'through':_0xc405('0x115'),'required':![]});db[_0xc405('0x13')][_0xc405('0x108')](db['MailQueue'],{'as':'MailQueues','through':_0xc405('0x2d'),'required':![]});db[_0xc405('0x13')][_0xc405('0x108')](db['ChatQueue'],{'as':_0xc405('0x116'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xc405('0x13')][_0xc405('0x108')](db[_0xc405('0x48')],{'as':_0xc405('0x117'),'through':'UserFaxQueue','required':![]});db['User'][_0xc405('0x108')](db['SmsQueue'],{'as':_0xc405('0x118'),'through':_0xc405('0x119'),'required':![]});db[_0xc405('0x13')][_0xc405('0x108')](db[_0xc405('0x58')],{'as':_0xc405('0x11a'),'through':_0xc405('0x11b'),'required':![]});db[_0xc405('0x13')][_0xc405('0x108')](db['WhatsappQueue'],{'as':_0xc405('0x11c'),'through':_0xc405('0x32'),'required':![]});db[_0xc405('0x13')][_0xc405('0x108')](db[_0xc405('0xde')],{'through':_0xc405('0x11d')});db[_0xc405('0x13')][_0xc405('0x108')](db[_0xc405('0xe0')],{'as':_0xc405('0x11e'),'through':_0xc405('0x11f'),'required':![]});db[_0xc405('0x13')][_0xc405('0x108')](db['ChatWebsite'],{'as':_0xc405('0x120'),'through':_0xc405('0x121')});db[_0xc405('0x13')][_0xc405('0x108')](db['FaxAccount'],{'as':_0xc405('0x122'),'through':_0xc405('0x123')});db[_0xc405('0x13')]['belongsToMany'](db[_0xc405('0x37')],{'as':_0xc405('0x124'),'through':_0xc405('0x125')});db[_0xc405('0x13')][_0xc405('0x108')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db['User'][_0xc405('0x108')](db[_0xc405('0x4b')],{'as':_0xc405('0x126'),'through':_0xc405('0x127')});db['User'][_0xc405('0x108')](db[_0xc405('0x128')],{'as':_0xc405('0x129'),'through':_0xc405('0x12a')});db['User'][_0xc405('0x108')](db[_0xc405('0xcb')],{'as':_0xc405('0x12b'),'through':_0xc405('0x12c')});db['VoiceChanSpy']['hasMany'](db['VoiceExtension'],{'as':_0xc405('0x12d'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x12e')});db['VoiceContext'][_0xc405('0xf8')](db[_0xc405('0x12f')],{'onDelete':_0xc405('0xf6')});db[_0xc405('0x12f')][_0xc405('0xf8')](db[_0xc405('0x12f')],{'as':_0xc405('0x130'),'onDelete':_0xc405('0xf6')});db[_0xc405('0x18')]['belongsToMany'](db[_0xc405('0x131')],{'as':_0xc405('0x132'),'through':'moh_has_sounds'});db[_0xc405('0x113')][_0xc405('0xf8')](db[_0xc405('0x2a')],{'as':_0xc405('0x133'),'foreignKey':_0xc405('0x134')});db[_0xc405('0x113')][_0xc405('0xf8')](db['CmHopper'],{'as':_0xc405('0x135'),'foreignKey':_0xc405('0x134')});db['VoiceQueue'][_0xc405('0xf8')](db[_0xc405('0x6d')],{'as':_0xc405('0xfb'),'foreignKey':'VoiceQueueId'});db[_0xc405('0x113')]['hasMany'](db[_0xc405('0xfc')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xc405('0x113')][_0xc405('0xf8')](db['ReportAgentPreview'],{'as':_0xc405('0x6f'),'foreignKey':_0xc405('0x134')});db[_0xc405('0x113')]['hasMany'](db[_0xc405('0x6b')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xc405('0xf8')](db[_0xc405('0xbf')],{'as':_0xc405('0x136'),'foreignKey':'VoiceQueueId'});db[_0xc405('0x113')]['belongsTo'](db[_0xc405('0x28')],{'as':_0xc405('0x28'),'foreignKey':_0xc405('0x137')});db[_0xc405('0x113')][_0xc405('0x105')](db[_0xc405('0x28')],{'as':'TrunkBackup','foreignKey':_0xc405('0x138')});db[_0xc405('0x113')][_0xc405('0x105')](db[_0xc405('0x7a')],{'as':_0xc405('0x7a'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0xc405('0x105')](db[_0xc405('0x7c')],{'as':_0xc405('0x139'),'foreignKey':_0xc405('0x13a')});db[_0xc405('0x113')]['belongsToMany'](db[_0xc405('0xde')],{'as':_0xc405('0x10b'),'through':'voice_queues_has_cm_lists'});db[_0xc405('0x113')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':_0xc405('0x13b'),'through':_0xc405('0x115')});db['VoiceQueue'][_0xc405('0x108')](db[_0xc405('0xd0')],{'as':_0xc405('0x13c'),'through':_0xc405('0x13d')});db[_0xc405('0x113')][_0xc405('0x108')](db[_0xc405('0xde')],{'as':_0xc405('0x13e'),'through':_0xc405('0x13f')});db[_0xc405('0xf9')][_0xc405('0x105')](db[_0xc405('0x13')],{'as':'User','foreignKey':_0xc405('0xf7')});db[_0xc405('0x1c')][_0xc405('0x105')](db[_0xc405('0x13')],{'as':'User','foreignKey':_0xc405('0xf7')});db['VoiceMail'][_0xc405('0xf8')](db[_0xc405('0x140')],{'as':'Messages','onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x141'),'sourceKey':_0xc405('0x142')});db[_0xc405('0x140')][_0xc405('0x105')](db['VoiceMail'],{'foreignKey':_0xc405('0x141'),'targetKey':_0xc405('0x142')});db[_0xc405('0x20')]['hasMany'](db[_0xc405('0x143')],{'as':_0xc405('0x144'),'foreignKey':_0xc405('0x145'),'constraints':![]});db['VoiceCallReport'][_0xc405('0xf8')](db[_0xc405('0x23')],{'as':_0xc405('0x146'),'foreignKey':_0xc405('0x145'),'constraints':![]});db[_0xc405('0x20')][_0xc405('0x105')](db['User'],{'as':_0xc405('0x13'),'foreignKey':_0xc405('0xf7')});db[_0xc405('0x20')][_0xc405('0x105')](db[_0xc405('0x67')],{'as':_0xc405('0x147'),'foreignKey':_0xc405('0x148')});db['MailServerIn']['belongsTo'](db[_0xc405('0x37')],{'as':'MailAccount','foreignKey':_0xc405('0x149')});db[_0xc405('0x35')][_0xc405('0x105')](db['MailAccount'],{'as':_0xc405('0x37'),'foreignKey':_0xc405('0x149')});db['MailAccount'][_0xc405('0xf5')](db[_0xc405('0x33')],{'as':_0xc405('0x14a'),'onDelete':_0xc405('0xf6')});db[_0xc405('0x37')][_0xc405('0xf5')](db[_0xc405('0x35')],{'as':_0xc405('0x14b'),'onDelete':_0xc405('0xf6')});db[_0xc405('0x37')][_0xc405('0xf8')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xc405('0x149')});db[_0xc405('0x37')][_0xc405('0xf8')](db[_0xc405('0x75')],{'as':_0xc405('0x14c'),'foreignKey':_0xc405('0x149')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':'Messages','foreignKey':_0xc405('0x149')});db['MailAccount'][_0xc405('0xf8')](db[_0xc405('0x10c')],{'as':_0xc405('0x14d')});db['MailAccount'][_0xc405('0xf8')](db[_0xc405('0x3e')],{'as':_0xc405('0x130')});db['MailAccount'][_0xc405('0x105')](db['CmList'],{'as':'List','foreignKey':_0xc405('0x14e')});db[_0xc405('0x37')]['belongsTo'](db[_0xc405('0x81')],{'as':_0xc405('0x81'),'foreignKey':_0xc405('0x14f')});db['MailAccount']['belongsTo'](db[_0xc405('0x7c')],{'as':_0xc405('0x139'),'foreignKey':_0xc405('0x13a')});db[_0xc405('0x37')]['belongsToMany'](db[_0xc405('0x13')],{'as':'Agents','through':_0xc405('0x125')});db[_0xc405('0x39')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':'Agents','through':_0xc405('0x2d')});db['MailQueue']['belongsToMany'](db[_0xc405('0xd0')],{'through':'team_has_mail_queues','as':_0xc405('0x13c')});db['MailInteraction'][_0xc405('0xf8')](db['MailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xc405('0x150')});db[_0xc405('0x10c')]['belongsTo'](db['MailAccount'],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x149')});db[_0xc405('0x10c')][_0xc405('0x105')](db[_0xc405('0x67')],{'as':_0xc405('0x147'),'foreignKey':'ContactId'});db[_0xc405('0x10c')][_0xc405('0x105')](db[_0xc405('0x13')],{'as':_0xc405('0x152'),'foreignKey':_0xc405('0xf7')});db[_0xc405('0x10c')][_0xc405('0x108')](db[_0xc405('0x153')],{'through':_0xc405('0x154'),'as':_0xc405('0x155')});db[_0xc405('0x10c')]['belongsToMany'](db[_0xc405('0x153')],{'through':_0xc405('0x154'),'as':'ThroughTags'});db[_0xc405('0x10c')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':_0xc405('0x156'),'through':'user_has_mail_interactions','foreignKey':_0xc405('0x150')});db[_0xc405('0x3c')][_0xc405('0xf8')](db[_0xc405('0x157')],{'as':_0xc405('0x158'),'onDelete':_0xc405('0xf6')});db[_0xc405('0x3c')][_0xc405('0x105')](db['User'],{'as':_0xc405('0x13')});db['MailMessage'][_0xc405('0x105')](db[_0xc405('0x67')],{'onDelete':'cascade','as':'Contact'});db[_0xc405('0x3c')]['belongsTo'](db[_0xc405('0x10c')],{'as':_0xc405('0x159'),'foreignKey':_0xc405('0x150')});db[_0xc405('0x3c')][_0xc405('0x105')](db[_0xc405('0x37')],{'as':_0xc405('0x151'),'foreignKey':'MailAccountId'});db[_0xc405('0x3c')][_0xc405('0x105')](db['ChatWebsite'],{'as':_0xc405('0x5a'),'foreignKey':_0xc405('0x15a')});db[_0xc405('0x3c')]['belongsTo'](db[_0xc405('0x5f')],{'as':'ChatOfflineMessage','foreignKey':_0xc405('0x15b')});db[_0xc405('0x3e')][_0xc405('0x105')](db['User'],{'onDelete':_0xc405('0x15c')});db['MailApplication']['belongsTo'](db[_0xc405('0x39')],{'onDelete':'restrict'});db[_0xc405('0x3e')]['belongsTo'](db[_0xc405('0x37')],{'onDelete':'restrict'});db[_0xc405('0x3e')]['belongsTo'](db[_0xc405('0x7a')],{'onDelete':_0xc405('0x15c'),'foreignKey':'IntervalId'});db[_0xc405('0x3e')][_0xc405('0x105')](db['Tag'],{'onDelete':_0xc405('0x15c'),'foreignKey':_0xc405('0x15d')});db[_0xc405('0x15e')][_0xc405('0x105')](db[_0xc405('0x37')],{});db['MailQueueReport'][_0xc405('0x105')](db['CmList'],{'as':_0xc405('0x15f'),'foreignKey':_0xc405('0x14e')});db[_0xc405('0x15e')][_0xc405('0x105')](db[_0xc405('0x67')],{'as':'Contact','foreignKey':_0xc405('0x148')});db[_0xc405('0x15e')][_0xc405('0x105')](db[_0xc405('0x10c')],{});db['MailQueueReport'][_0xc405('0x105')](db['MailMessage'],{});db['MailQueueReport'][_0xc405('0x105')](db[_0xc405('0x13')],{});db[_0xc405('0x15e')]['belongsTo'](db['MailQueue'],{});db[_0xc405('0x160')][_0xc405('0xf8')](db['DashboardItem'],{'as':_0xc405('0x161'),'onDelete':_0xc405('0xf6')});db[_0xc405('0x162')][_0xc405('0xf8')](db['Disposition'],{'as':_0xc405('0x163'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xc405('0xf8')](db[_0xc405('0x75')],{'as':_0xc405('0x14c'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xc405('0xf8')](db[_0xc405('0x102')],{'as':'Interactions'});db[_0xc405('0x162')][_0xc405('0xf8')](db['FaxApplication'],{'as':'Applications'});db[_0xc405('0x162')]['hasMany'](db[_0xc405('0x12f')],{'as':'Exntensions','onDelete':'cascade'});db['FaxAccount'][_0xc405('0xf8')](db[_0xc405('0x46')],{'as':_0xc405('0x164')});db[_0xc405('0x162')][_0xc405('0x105')](db[_0xc405('0x28')],{'as':'Trunk'});db[_0xc405('0x162')][_0xc405('0x105')](db[_0xc405('0xde')],{'as':_0xc405('0x15f'),'foreignKey':'ListId'});db[_0xc405('0x162')][_0xc405('0x105')](db[_0xc405('0x7c')],{'as':_0xc405('0x139'),'foreignKey':_0xc405('0x13a')});db[_0xc405('0x162')]['belongsToMany'](db['User'],{'as':_0xc405('0x13b'),'through':_0xc405('0x123')});db['FaxApplication']['belongsTo'](db[_0xc405('0x13')],{'onDelete':_0xc405('0x15c')});db[_0xc405('0x44')][_0xc405('0x105')](db[_0xc405('0x48')],{'onDelete':_0xc405('0x15c')});db[_0xc405('0x44')][_0xc405('0x105')](db[_0xc405('0x162')],{'onDelete':_0xc405('0x15c')});db[_0xc405('0x44')]['belongsTo'](db[_0xc405('0x153')],{'onDelete':_0xc405('0x15c'),'foreignKey':_0xc405('0x15d')});db['FaxInteraction'][_0xc405('0xf8')](db[_0xc405('0x46')],{'as':_0xc405('0x164'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x165')});db['FaxInteraction'][_0xc405('0x105')](db[_0xc405('0x162')],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x166')});db[_0xc405('0x102')][_0xc405('0x105')](db[_0xc405('0x67')],{'as':_0xc405('0x147'),'foreignKey':'ContactId'});db[_0xc405('0x102')]['belongsTo'](db['User'],{'as':_0xc405('0x152'),'foreignKey':'UserId'});db[_0xc405('0x102')][_0xc405('0x108')](db['Tag'],{'through':_0xc405('0x167'),'as':_0xc405('0x155')});db[_0xc405('0x102')]['belongsToMany'](db[_0xc405('0x153')],{'through':_0xc405('0x167'),'as':'ThroughTags'});db['FaxInteraction'][_0xc405('0x108')](db['User'],{'as':'Users','through':_0xc405('0x111'),'foreignKey':_0xc405('0x165')});db['FaxMessage']['belongsTo'](db[_0xc405('0x13')],{'onDelete':'cascade','as':_0xc405('0x13')});db[_0xc405('0x46')]['belongsTo'](db[_0xc405('0x102')],{'as':_0xc405('0x159'),'foreignKey':_0xc405('0x165')});db[_0xc405('0x46')]['belongsTo'](db[_0xc405('0x67')],{'onDelete':_0xc405('0xf6'),'as':_0xc405('0x147')});db[_0xc405('0x46')][_0xc405('0x105')](db[_0xc405('0x157')],{'as':_0xc405('0x157'),'foreignKey':_0xc405('0x168')});db[_0xc405('0x46')][_0xc405('0x105')](db[_0xc405('0x162')],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x166')});db[_0xc405('0x48')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':_0xc405('0x13b'),'through':_0xc405('0x2f')});db[_0xc405('0x48')][_0xc405('0x108')](db[_0xc405('0xd0')],{'through':_0xc405('0x169'),'as':'Teams'});db[_0xc405('0x49')][_0xc405('0x105')](db['FaxAccount'],{});db[_0xc405('0x49')][_0xc405('0x105')](db[_0xc405('0xde')],{'as':'List','foreignKey':'ListId'});db[_0xc405('0x49')]['belongsTo'](db['CmContact'],{'as':_0xc405('0x147'),'foreignKey':_0xc405('0x148')});db['FaxQueueReport'][_0xc405('0x105')](db[_0xc405('0x102')],{});db[_0xc405('0x49')]['belongsTo'](db['FaxMessage'],{});db[_0xc405('0x49')][_0xc405('0x105')](db[_0xc405('0x13')],{});db['FaxQueueReport'][_0xc405('0x105')](db[_0xc405('0x48')],{});db[_0xc405('0x4b')][_0xc405('0xf8')](db[_0xc405('0x77')],{'as':_0xc405('0x163'),'foreignKey':'SmsAccountId'});db[_0xc405('0x4b')][_0xc405('0xf8')](db['CannedAnswer'],{'as':_0xc405('0x14c'),'foreignKey':_0xc405('0x16a')});db[_0xc405('0x4b')][_0xc405('0xf8')](db['SmsMessage'],{'as':_0xc405('0x164'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0xc405('0x14d')});db['SmsAccount'][_0xc405('0xf8')](db[_0xc405('0x16b')],{'as':'Applications'});db[_0xc405('0x4b')][_0xc405('0x105')](db[_0xc405('0xde')],{'as':'List','foreignKey':'ListId'});db[_0xc405('0x4b')][_0xc405('0x105')](db[_0xc405('0x7c')],{'as':_0xc405('0x139'),'foreignKey':_0xc405('0x13a')});db[_0xc405('0x4b')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':_0xc405('0x13b'),'through':_0xc405('0x127')});db[_0xc405('0x16b')][_0xc405('0x105')](db[_0xc405('0x13')],{'onDelete':_0xc405('0x15c')});db[_0xc405('0x16b')][_0xc405('0x105')](db[_0xc405('0x52')],{'onDelete':_0xc405('0x15c')});db['SmsApplication']['belongsTo'](db['SmsAccount'],{'onDelete':_0xc405('0x15c')});db[_0xc405('0x16b')][_0xc405('0x105')](db[_0xc405('0x7a')],{'onDelete':_0xc405('0x15c'),'foreignKey':_0xc405('0x16c')});db[_0xc405('0x16b')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xc405('0x4e')][_0xc405('0xf8')](db[_0xc405('0x50')],{'as':_0xc405('0x164'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x16d')});db[_0xc405('0x4e')][_0xc405('0x105')](db['SmsAccount'],{'as':_0xc405('0x151'),'foreignKey':'SmsAccountId'});db['SmsInteraction']['belongsTo'](db[_0xc405('0x67')],{'as':_0xc405('0x147'),'foreignKey':_0xc405('0x148')});db[_0xc405('0x4e')][_0xc405('0x105')](db[_0xc405('0x13')],{'as':_0xc405('0x152'),'foreignKey':'UserId'});db[_0xc405('0x4e')][_0xc405('0x108')](db[_0xc405('0x153')],{'through':_0xc405('0x16e'),'as':_0xc405('0x155')});db[_0xc405('0x4e')][_0xc405('0x108')](db[_0xc405('0x153')],{'through':_0xc405('0x16e'),'as':_0xc405('0x16f')});db[_0xc405('0x4e')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':_0xc405('0x156'),'through':_0xc405('0x170'),'foreignKey':_0xc405('0x16d')});db[_0xc405('0x50')]['belongsTo'](db[_0xc405('0x13')],{'as':'User'});db[_0xc405('0x50')][_0xc405('0x105')](db[_0xc405('0x67')],{'onDelete':_0xc405('0xf6'),'as':_0xc405('0x147')});db[_0xc405('0x50')][_0xc405('0x105')](db[_0xc405('0x4e')],{'onDelete':'cascade','as':_0xc405('0x159'),'foreignKey':_0xc405('0x16d')});db[_0xc405('0x50')][_0xc405('0x105')](db[_0xc405('0x4b')],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x16a')});db['SmsQueue'][_0xc405('0x108')](db['User'],{'as':_0xc405('0x13b'),'through':_0xc405('0x119'),'foreignKey':'SmsQueueId'});db[_0xc405('0x52')]['belongsToMany'](db[_0xc405('0xd0')],{'through':_0xc405('0x171'),'as':_0xc405('0x13c')});db[_0xc405('0x53')]['hasMany'](db[_0xc405('0x77')],{'as':_0xc405('0x163'),'foreignKey':_0xc405('0x172')});db[_0xc405('0x53')]['hasMany'](db[_0xc405('0x75')],{'as':'Answers','foreignKey':_0xc405('0x172')});db[_0xc405('0x53')]['hasMany'](db[_0xc405('0x55')],{'as':_0xc405('0x14d'),'foreignKey':_0xc405('0x172')});db[_0xc405('0x53')][_0xc405('0xf8')](db[_0xc405('0x173')],{'as':_0xc405('0x164'),'foreignKey':'OpenchannelAccountId'});db[_0xc405('0x53')][_0xc405('0xf8')](db[_0xc405('0x54')],{'as':_0xc405('0x130'),'foreignKey':_0xc405('0x172')});db['OpenchannelAccount'][_0xc405('0x105')](db[_0xc405('0xde')],{'as':_0xc405('0x15f'),'foreignKey':_0xc405('0x14e')});db[_0xc405('0x53')][_0xc405('0x105')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xc405('0x13a')});db[_0xc405('0x53')][_0xc405('0x108')](db['User'],{'as':_0xc405('0x13b'),'through':_0xc405('0x174')});db[_0xc405('0x54')][_0xc405('0x105')](db[_0xc405('0x13')],{'onDelete':_0xc405('0x15c')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xc405('0x15c'),'foreignKey':'OpenchannelQueueId'});db[_0xc405('0x54')][_0xc405('0x105')](db[_0xc405('0x53')],{'onDelete':_0xc405('0x15c'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication']['belongsTo'](db['Interval'],{'onDelete':_0xc405('0x15c'),'foreignKey':_0xc405('0x16c')});db[_0xc405('0x54')][_0xc405('0x105')](db[_0xc405('0x153')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xc405('0x55')][_0xc405('0xf8')](db['OpenchannelMessage'],{'as':_0xc405('0x164'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x175')});db[_0xc405('0x55')]['belongsTo'](db[_0xc405('0x53')],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x172')});db[_0xc405('0x55')][_0xc405('0x105')](db[_0xc405('0x67')],{'as':_0xc405('0x147'),'foreignKey':_0xc405('0x148')});db[_0xc405('0x55')]['belongsTo'](db['User'],{'as':_0xc405('0x152'),'foreignKey':'UserId'});db[_0xc405('0x55')][_0xc405('0x108')](db[_0xc405('0x153')],{'through':_0xc405('0x176'),'as':'Tags'});db[_0xc405('0x55')][_0xc405('0x108')](db[_0xc405('0x153')],{'through':_0xc405('0x176'),'as':_0xc405('0x16f')});db[_0xc405('0x55')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':_0xc405('0x156'),'through':_0xc405('0x112'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xc405('0x105')](db['User'],{'onDelete':_0xc405('0xf6'),'as':_0xc405('0x13')});db[_0xc405('0x173')][_0xc405('0x105')](db[_0xc405('0x67')],{'onDelete':_0xc405('0xf6'),'as':_0xc405('0x147')});db[_0xc405('0x173')][_0xc405('0x105')](db['OpenchannelInteraction'],{'onDelete':_0xc405('0xf6'),'as':'Interaction','foreignKey':_0xc405('0x175')});db['OpenchannelMessage'][_0xc405('0x105')](db['Attachment'],{'as':_0xc405('0x157'),'foreignKey':'AttachmentId'});db[_0xc405('0x173')][_0xc405('0x105')](db[_0xc405('0x53')],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x172')});db[_0xc405('0x58')][_0xc405('0x108')](db['User'],{'as':_0xc405('0x13b'),'through':_0xc405('0x11b'),'foreignKey':_0xc405('0x177')});db[_0xc405('0x58')][_0xc405('0x108')](db[_0xc405('0xd0')],{'through':_0xc405('0x178'),'as':_0xc405('0x13c')});db['ChatWebsite'][_0xc405('0xf8')](db[_0xc405('0x77')],{'as':_0xc405('0x163'),'foreignKey':_0xc405('0x15a')});db[_0xc405('0x5a')][_0xc405('0xf8')](db['CannedAnswer'],{'as':_0xc405('0x14c'),'foreignKey':_0xc405('0x15a')});db['ChatWebsite']['hasMany'](db[_0xc405('0x64')],{'as':_0xc405('0x179')});db['ChatWebsite'][_0xc405('0xf8')](db[_0xc405('0xff')],{'as':_0xc405('0x14d')});db['ChatWebsite']['hasMany'](db['ChatApplication'],{'as':'Applications'});db[_0xc405('0x5a')]['hasMany'](db[_0xc405('0x5e')],{'as':_0xc405('0x164')});db[_0xc405('0x5a')][_0xc405('0x105')](db[_0xc405('0xde')],{'as':_0xc405('0x15f'),'foreignKey':'ListId'});db['ChatWebsite'][_0xc405('0x105')](db[_0xc405('0x7a')],{'as':_0xc405('0x7a'),'foreignKey':_0xc405('0x16c')});db[_0xc405('0x5a')][_0xc405('0x105')](db['MailAccount'],{'as':_0xc405('0x37'),'foreignKey':_0xc405('0x149')});db[_0xc405('0x5a')][_0xc405('0x105')](db[_0xc405('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xc405('0x5a')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':_0xc405('0x13b'),'through':_0xc405('0x121')});db[_0xc405('0x5b')]['belongsTo'](db[_0xc405('0x53')],{});db['OpenchannelQueueReport'][_0xc405('0x105')](db[_0xc405('0xde')],{'as':_0xc405('0x15f'),'foreignKey':_0xc405('0x14e')});db[_0xc405('0x5b')][_0xc405('0x105')](db['CmContact'],{'as':_0xc405('0x147'),'foreignKey':_0xc405('0x148')});db[_0xc405('0x5b')][_0xc405('0x105')](db['OpenchannelInteraction'],{});db[_0xc405('0x5b')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xc405('0x5b')][_0xc405('0x105')](db['User'],{});db[_0xc405('0x5b')][_0xc405('0x105')](db[_0xc405('0x58')],{});db[_0xc405('0x17a')][_0xc405('0x105')](db['User'],{'as':'Agent','foreignKey':_0xc405('0xf7'),'onDelete':_0xc405('0x15c')});db[_0xc405('0x17a')][_0xc405('0x105')](db[_0xc405('0x61')],{'as':'Queue','foreignKey':_0xc405('0x17b'),'onDelete':'restrict'});db[_0xc405('0x17a')][_0xc405('0x105')](db['ChatWebsite'],{'as':_0xc405('0x17c'),'foreignKey':_0xc405('0x15a'),'onDelete':_0xc405('0x15c')});db[_0xc405('0x17a')][_0xc405('0x105')](db[_0xc405('0x153')],{'onDelete':_0xc405('0x15c'),'foreignKey':_0xc405('0x15d')});db[_0xc405('0xff')]['hasMany'](db[_0xc405('0x5e')],{'as':_0xc405('0x164'),'onDelete':_0xc405('0xf6'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0xc405('0x105')](db['ChatWebsite'],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x15a')});db[_0xc405('0xff')][_0xc405('0x105')](db['CmContact'],{'as':_0xc405('0x147'),'foreignKey':_0xc405('0x148')});db[_0xc405('0xff')][_0xc405('0x105')](db[_0xc405('0x13')],{'as':'Owner','foreignKey':_0xc405('0xf7')});db['ChatInteraction'][_0xc405('0x108')](db[_0xc405('0x153')],{'through':_0xc405('0x17d'),'as':_0xc405('0x155')});db[_0xc405('0xff')][_0xc405('0x108')](db[_0xc405('0x153')],{'through':_0xc405('0x17d'),'as':'ThroughTags'});db[_0xc405('0xff')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':_0xc405('0x156'),'through':'user_has_chat_interactions','foreignKey':_0xc405('0x17e')});db['ChatMessage'][_0xc405('0x105')](db[_0xc405('0x13')],{'onDelete':_0xc405('0xf6'),'as':_0xc405('0x13')});db[_0xc405('0x5e')][_0xc405('0x105')](db[_0xc405('0x67')],{'onDelete':_0xc405('0xf6'),'as':_0xc405('0x147'),'foreignKey':_0xc405('0x148')});db[_0xc405('0x5e')][_0xc405('0x105')](db[_0xc405('0xff')],{'onDelete':_0xc405('0xf6'),'as':_0xc405('0x159'),'foreignKey':_0xc405('0x17e')});db[_0xc405('0x5e')][_0xc405('0x105')](db[_0xc405('0x157')],{'as':_0xc405('0x157'),'foreignKey':_0xc405('0x168')});db[_0xc405('0x5e')][_0xc405('0x105')](db['ChatWebsite'],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x15a')});db[_0xc405('0x5f')][_0xc405('0xf8')](db[_0xc405('0x157')],{'as':_0xc405('0x158'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xc405('0xf6'),'hooks':!![]});db['ChatOfflineMessage'][_0xc405('0x105')](db[_0xc405('0x67')],{'onDelete':_0xc405('0xf6'),'as':'Contact','foreignKey':_0xc405('0x148')});db[_0xc405('0x5f')][_0xc405('0x105')](db[_0xc405('0x5a')],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x15a')});db['ChatQueue']['belongsToMany'](db['User'],{'as':_0xc405('0x13b'),'through':_0xc405('0x17f'),'hooks':!![]});db[_0xc405('0x61')][_0xc405('0x108')](db['Team'],{'through':_0xc405('0x180'),'as':_0xc405('0x13c')});db[_0xc405('0x63')][_0xc405('0xf8')](db[_0xc405('0xbc')],{'as':_0xc405('0x164'),'foreignKey':_0xc405('0x181'),'onDelete':'cascade'});db[_0xc405('0x63')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':'Members','through':_0xc405('0x182')});db[_0xc405('0x64')][_0xc405('0x105')](db[_0xc405('0x5a')],{'as':_0xc405('0x17c'),'foreignKey':'ChatWebsiteId'});db[_0xc405('0x183')][_0xc405('0xf8')](db[_0xc405('0x67')],{'as':_0xc405('0x109'),'foreignKey':'CompanyId'});db[_0xc405('0x67')][_0xc405('0xf8')](db['CmHopper'],{'as':_0xc405('0x135'),'foreignKey':_0xc405('0x148')});db[_0xc405('0x67')][_0xc405('0xf8')](db[_0xc405('0x6d')],{'as':_0xc405('0xfb'),'foreignKey':_0xc405('0x148')});db[_0xc405('0x67')][_0xc405('0xf8')](db['CmHopperHistory'],{'as':_0xc405('0x184'),'foreignKey':_0xc405('0x148')});db[_0xc405('0x67')][_0xc405('0xf8')](db[_0xc405('0x6f')],{'as':'ReportAgentPreview','foreignKey':_0xc405('0x148')});db[_0xc405('0x67')]['hasMany'](db[_0xc405('0xbf')],{'as':_0xc405('0x136'),'foreignKey':_0xc405('0x148')});db[_0xc405('0x67')][_0xc405('0xf8')](db['OpenchannelInteraction'],{'as':_0xc405('0xfe'),'foreignKey':_0xc405('0x148'),'onDelete':_0xc405('0x15c')});db[_0xc405('0x67')][_0xc405('0xf8')](db[_0xc405('0xff')],{'as':_0xc405('0x100'),'foreignKey':_0xc405('0x148'),'onDelete':_0xc405('0x15c')});db[_0xc405('0x67')]['hasMany'](db[_0xc405('0x4e')],{'as':_0xc405('0x101'),'foreignKey':_0xc405('0x148'),'onDelete':'restrict'});db['CmContact'][_0xc405('0xf8')](db[_0xc405('0x102')],{'as':'FaxInteractions','foreignKey':_0xc405('0x148'),'onDelete':_0xc405('0x15c')});db[_0xc405('0x67')]['hasMany'](db[_0xc405('0x10c')],{'as':_0xc405('0x10d'),'foreignKey':_0xc405('0x148'),'onDelete':'restrict'});db[_0xc405('0x67')][_0xc405('0x105')](db['CmCompany'],{'as':'Company','foreignKey':_0xc405('0x185')});db[_0xc405('0x67')][_0xc405('0x105')](db[_0xc405('0xde')],{'as':_0xc405('0x15f'),'foreignKey':'ListId','onDelete':_0xc405('0xf6')});db[_0xc405('0x67')]['belongsToMany'](db['User'],{'as':_0xc405('0x156'),'through':_0xc405('0x10a')});db[_0xc405('0x67')][_0xc405('0x108')](db['Tag'],{'as':_0xc405('0x155'),'through':_0xc405('0x186')});db[_0xc405('0x67')][_0xc405('0x108')](db['Tag'],{'through':_0xc405('0x186'),'as':_0xc405('0x16f')});db['CmHopper'][_0xc405('0x105')](db[_0xc405('0x67')],{'as':'Contact','foreignKey':_0xc405('0x148'),'onDelete':_0xc405('0xf6')});db['CmHopper'][_0xc405('0x105')](db[_0xc405('0xde')],{'as':_0xc405('0x15f'),'foreignKey':_0xc405('0x14e'),'onDelete':_0xc405('0xf6')});db[_0xc405('0x69')][_0xc405('0x105')](db[_0xc405('0x13')],{'as':_0xc405('0x187'),'foreignKey':'UserId'});db[_0xc405('0x69')][_0xc405('0x105')](db['VoiceQueue'],{'as':_0xc405('0x188'),'foreignKey':_0xc405('0x134'),'onDelete':_0xc405('0xf6')});db[_0xc405('0x69')][_0xc405('0x105')](db[_0xc405('0xd4')],{'as':_0xc405('0xd4'),'foreignKey':_0xc405('0x189'),'onDelete':_0xc405('0xf6')});db[_0xc405('0x69')][_0xc405('0x105')](db[_0xc405('0x13')],{'as':_0xc405('0x152'),'foreignKey':_0xc405('0x18a')});db[_0xc405('0x6b')][_0xc405('0x105')](db['CmContact'],{'as':'Contact','foreignKey':_0xc405('0x148'),'onDelete':_0xc405('0xf6')});db['CmHopperBlack'][_0xc405('0x105')](db[_0xc405('0xde')],{'as':_0xc405('0x15f'),'foreignKey':_0xc405('0x14e'),'onDelete':'cascade'});db[_0xc405('0x6b')]['belongsTo'](db[_0xc405('0x113')],{'as':_0xc405('0x188'),'foreignKey':_0xc405('0x134'),'onDelete':_0xc405('0xf6')});db[_0xc405('0x6b')]['belongsTo'](db[_0xc405('0xd4')],{'as':_0xc405('0xd4'),'foreignKey':_0xc405('0x189'),'onDelete':_0xc405('0xf6')});db['Automation'][_0xc405('0xf8')](db[_0xc405('0x79')],{'as':{'plural':_0xc405('0x18b'),'singular':_0xc405('0x18c')},'foreignKey':_0xc405('0x18d'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xc405('0xf8')](db[_0xc405('0x79')],{'as':{'plural':_0xc405('0x18e'),'singular':'OneAny'},'foreignKey':_0xc405('0x18f'),'onDelete':'cascade','hooks':!![]});db[_0xc405('0x73')]['hasMany'](db['Action'],{'as':_0xc405('0x190'),'foreignKey':_0xc405('0x191'),'onDelete':_0xc405('0xf6'),'hooks':!![]});db[_0xc405('0x77')][_0xc405('0xf8')](db[_0xc405('0x77')],{'as':'Dispositions','foreignKey':_0xc405('0x192'),'onDelete':'cascade'});db['Interval'][_0xc405('0xf8')](db[_0xc405('0x7a')],{'as':_0xc405('0x193'),'foreignKey':_0xc405('0x16c'),'onDelete':_0xc405('0xf6'),'hooks':!![],'required':![]});db[_0xc405('0x7a')][_0xc405('0xf8')](db['VoiceExtension'],{'as':_0xc405('0xfa'),'foreignKey':_0xc405('0x16c'),'onDelete':_0xc405('0x15c')});db[_0xc405('0x7a')]['hasMany'](db['MailApplication'],{'as':_0xc405('0x194'),'foreignKey':'IntervalId'});db[_0xc405('0x7a')][_0xc405('0xf8')](db[_0xc405('0x17a')],{'as':_0xc405('0x195'),'foreignKey':'IntervalId'});db['Interval'][_0xc405('0xf8')](db[_0xc405('0x44')],{'as':'FaxApplications','foreignKey':_0xc405('0x16c')});db[_0xc405('0x7a')][_0xc405('0xf8')](db['SmsApplication'],{'as':_0xc405('0x196'),'foreignKey':'IntervalId'});db[_0xc405('0x197')][_0xc405('0x105')](db[_0xc405('0x37')],{});db[_0xc405('0x197')][_0xc405('0x105')](db[_0xc405('0x88')],{'foreignKey':_0xc405('0x198')});db[_0xc405('0x197')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db['Sound'][_0xc405('0x108')](db[_0xc405('0x18')],{'as':_0xc405('0x199'),'through':'moh_has_sounds','onDelete':_0xc405('0x15c')});db[_0xc405('0x153')]['belongsToMany'](db[_0xc405('0x67')],{'through':_0xc405('0x186')});db['Tag']['belongsToMany'](db[_0xc405('0xff')],{'through':'chat_interaction_has_tags'});db[_0xc405('0x153')][_0xc405('0x108')](db[_0xc405('0x10c')],{'through':'mail_interaction_has_tags'});db['Tag']['belongsToMany'](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0xc405('0x153')][_0xc405('0x108')](db[_0xc405('0x102')],{'through':_0xc405('0x167')});db[_0xc405('0x153')]['belongsToMany'](db[_0xc405('0x55')],{'through':_0xc405('0x176')});db['Tag'][_0xc405('0x108')](db['WhatsappInteraction'],{'through':_0xc405('0x19a')});db[_0xc405('0x19b')]['hasMany'](db[_0xc405('0x79')],{'as':{'plural':_0xc405('0x19c'),'singular':_0xc405('0x19d')},'foreignKey':_0xc405('0x19e'),'onDelete':_0xc405('0xf6'),'hooks':!![]});db[_0xc405('0x19b')][_0xc405('0xf8')](db['Condition'],{'as':{'plural':_0xc405('0x19f'),'singular':_0xc405('0x1a0')},'foreignKey':'TriggerAnyId','onDelete':_0xc405('0xf6'),'hooks':!![]});db[_0xc405('0x19b')][_0xc405('0xf8')](db[_0xc405('0x71')],{'as':'Actions','foreignKey':_0xc405('0x1a1'),'onDelete':_0xc405('0xf6'),'hooks':!![]});db[_0xc405('0x1a2')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a3'),'hooks':!![]});db[_0xc405('0x88')]['hasMany'](db[_0xc405('0x8b')],{'as':_0xc405('0x1a4'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x198')});db[_0xc405('0x1a5')][_0xc405('0xf8')](db['AnalyticFieldReport'],{'as':_0xc405('0x1a4'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a6')});db[_0xc405('0x8b')][_0xc405('0x105')](db[_0xc405('0x1a5')],{'foreignKey':_0xc405('0x1a6')});db[_0xc405('0x8d')]['hasMany'](db[_0xc405('0x8e')],{'as':'Configurations','onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a7')});db[_0xc405('0x8e')]['hasMany'](db[_0xc405('0x90')],{'as':_0xc405('0x1a8'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a9')});db[_0xc405('0x8e')]['hasMany'](db[_0xc405('0x90')],{'as':_0xc405('0x1aa'),'onDelete':_0xc405('0xf6'),'foreignKey':'DescriptionId'});db[_0xc405('0x8e')][_0xc405('0xf8')](db[_0xc405('0x90')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc405('0x1ab')});db[_0xc405('0x8e')]['belongsTo'](db[_0xc405('0x8d')],{'as':_0xc405('0x151'),'foreignKey':'AccountId'});db[_0xc405('0x90')][_0xc405('0xf8')](db[_0xc405('0x90')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xc405('0x90')][_0xc405('0xf8')](db['SalesforceField'],{'as':_0xc405('0x1ac'),'foreignKey':_0xc405('0x1ad')});db[_0xc405('0x90')][_0xc405('0xf8')](db['SalesforceField'],{'as':_0xc405('0x1ae'),'foreignKey':_0xc405('0x1ab')});db[_0xc405('0x90')][_0xc405('0x105')](db[_0xc405('0x83')],{'as':'Variable','foreignKey':_0xc405('0x1af')});db[_0xc405('0x92')]['hasMany'](db[_0xc405('0x1b0')],{'as':_0xc405('0x1b1'),'onDelete':'cascade','foreignKey':_0xc405('0x1a7')});db[_0xc405('0x1b0')]['hasMany'](db[_0xc405('0x95')],{'as':_0xc405('0x1a8'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a9')});db['SugarcrmConfiguration']['hasMany'](db[_0xc405('0x95')],{'as':_0xc405('0x1aa'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1ad')});db[_0xc405('0x1b0')][_0xc405('0xf8')](db['SugarcrmField'],{'as':_0xc405('0x1a4'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1ab')});db[_0xc405('0x1b0')][_0xc405('0x105')](db[_0xc405('0x92')],{'as':_0xc405('0x151'),'foreignKey':'AccountId'});db['SugarcrmField'][_0xc405('0xf8')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0xc405('0x1a9')});db[_0xc405('0x95')][_0xc405('0xf8')](db[_0xc405('0x95')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc405('0x95')]['hasMany'](db[_0xc405('0x95')],{'as':'Field','foreignKey':_0xc405('0x1ab')});db[_0xc405('0x95')][_0xc405('0x105')](db[_0xc405('0x83')],{'as':_0xc405('0x83'),'foreignKey':_0xc405('0x1af')});db['DeskAccount']['hasMany'](db[_0xc405('0x97')],{'as':_0xc405('0x1b1'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a7')});db['DeskConfiguration'][_0xc405('0xf8')](db['DeskField'],{'as':'Subjects','onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a9')});db[_0xc405('0x97')][_0xc405('0xf8')](db[_0xc405('0x1b2')],{'as':_0xc405('0x1aa'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xc405('0x97')][_0xc405('0xf8')](db[_0xc405('0x1b2')],{'as':_0xc405('0x1a4'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xc405('0x97')]['belongsTo'](db['DeskAccount'],{'as':_0xc405('0x151'),'foreignKey':'AccountId'});db[_0xc405('0x97')][_0xc405('0x108')](db[_0xc405('0x153')],{'through':_0xc405('0x1b3')});db[_0xc405('0x1b2')][_0xc405('0xf8')](db[_0xc405('0x1b2')],{'as':_0xc405('0x1b4'),'foreignKey':_0xc405('0x1a9')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0xc405('0x1ac'),'foreignKey':'DescriptionId'});db['DeskField'][_0xc405('0xf8')](db[_0xc405('0x1b2')],{'as':_0xc405('0x1ae'),'foreignKey':_0xc405('0x1ab')});db[_0xc405('0x1b2')]['belongsTo'](db[_0xc405('0x83')],{'as':_0xc405('0x83'),'foreignKey':_0xc405('0x1af')});db[_0xc405('0x9a')]['hasMany'](db[_0xc405('0x9c')],{'as':_0xc405('0x1b1'),'onDelete':'cascade','foreignKey':_0xc405('0x1a7')});db['ZohoConfiguration'][_0xc405('0xf8')](db['ZohoField'],{'as':_0xc405('0x1a8'),'onDelete':_0xc405('0xf6'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0xc405('0xf8')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1ad')});db[_0xc405('0x9c')][_0xc405('0xf8')](db[_0xc405('0x9d')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xc405('0x9c')][_0xc405('0x105')](db[_0xc405('0x9a')],{'as':'Account','foreignKey':_0xc405('0x1a7')});db[_0xc405('0x9d')][_0xc405('0xf8')](db['ZohoField'],{'as':_0xc405('0x1b4'),'foreignKey':_0xc405('0x1a9')});db['ZohoField'][_0xc405('0xf8')](db[_0xc405('0x9d')],{'as':_0xc405('0x1ac'),'foreignKey':_0xc405('0x1ad')});db[_0xc405('0x9d')][_0xc405('0xf8')](db[_0xc405('0x9d')],{'as':'Field','foreignKey':_0xc405('0x1ab')});db[_0xc405('0x9d')][_0xc405('0x105')](db['Variable'],{'as':'Variable','foreignKey':_0xc405('0x1af')});db['ZendeskAccount'][_0xc405('0xf8')](db[_0xc405('0xa0')],{'as':_0xc405('0x1b1'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a7')});db['ZendeskConfiguration'][_0xc405('0xf8')](db[_0xc405('0x1b5')],{'as':'Subjects','foreignKey':_0xc405('0x1a9')});db[_0xc405('0xa0')][_0xc405('0xf8')](db['ZendeskField'],{'as':_0xc405('0x1aa'),'foreignKey':_0xc405('0x1ad')});db['ZendeskConfiguration'][_0xc405('0xf8')](db[_0xc405('0x1b5')],{'as':'Fields','foreignKey':'FieldId'});db[_0xc405('0xa0')]['belongsTo'](db['ZendeskAccount'],{'as':_0xc405('0x151'),'foreignKey':'AccountId'});db[_0xc405('0xa0')]['belongsToMany'](db[_0xc405('0x153')],{'through':_0xc405('0x1b6')});db[_0xc405('0x1b5')]['hasMany'](db[_0xc405('0x1b5')],{'as':_0xc405('0x1b4'),'foreignKey':_0xc405('0x1a9')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0xc405('0x1ac'),'foreignKey':_0xc405('0x1ad')});db[_0xc405('0x1b5')][_0xc405('0xf8')](db['ZendeskField'],{'as':_0xc405('0x1ae'),'foreignKey':_0xc405('0x1ab')});db[_0xc405('0x1b5')][_0xc405('0x105')](db['Variable'],{'as':_0xc405('0x83'),'foreignKey':_0xc405('0x1af')});db['FreshdeskAccount']['hasMany'](db[_0xc405('0xa3')],{'as':_0xc405('0x1b1'),'onDelete':'cascade','foreignKey':_0xc405('0x1a7')});db['FreshdeskConfiguration'][_0xc405('0xf8')](db[_0xc405('0xa5')],{'as':_0xc405('0x1a8'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a9')});db[_0xc405('0xa3')][_0xc405('0xf8')](db[_0xc405('0xa5')],{'as':_0xc405('0x1aa'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1ad')});db['FreshdeskConfiguration'][_0xc405('0xf8')](db['FreshdeskField'],{'as':_0xc405('0x1a4'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1ab')});db[_0xc405('0xa3')][_0xc405('0x105')](db[_0xc405('0xa2')],{'as':_0xc405('0x151'),'foreignKey':'AccountId'});db[_0xc405('0xa3')]['belongsToMany'](db['Tag'],{'through':_0xc405('0x1b7')});db[_0xc405('0xa5')]['hasMany'](db[_0xc405('0xa5')],{'as':_0xc405('0x1b4'),'foreignKey':_0xc405('0x1a9')});db[_0xc405('0xa5')][_0xc405('0xf8')](db['FreshdeskField'],{'as':_0xc405('0x1ac'),'foreignKey':_0xc405('0x1ad')});db[_0xc405('0xa5')][_0xc405('0xf8')](db[_0xc405('0xa5')],{'as':_0xc405('0x1ae'),'foreignKey':'FieldId'});db[_0xc405('0xa5')][_0xc405('0x105')](db[_0xc405('0x83')],{'as':_0xc405('0x83'),'foreignKey':_0xc405('0x1af')});db[_0xc405('0xa6')][_0xc405('0xf8')](db[_0xc405('0x1b8')],{'as':_0xc405('0x1b1'),'onDelete':_0xc405('0xf6'),'foreignKey':'AccountId'});db[_0xc405('0x1b8')][_0xc405('0xf8')](db['VtigerField'],{'as':_0xc405('0x1a8'),'foreignKey':_0xc405('0x1a9')});db[_0xc405('0x1b8')]['hasMany'](db[_0xc405('0xa8')],{'as':_0xc405('0x1aa'),'foreignKey':_0xc405('0x1ad')});db[_0xc405('0x1b8')]['hasMany'](db[_0xc405('0xa8')],{'as':_0xc405('0x1a4'),'foreignKey':_0xc405('0x1ab')});db[_0xc405('0x1b8')]['belongsTo'](db[_0xc405('0xa6')],{'as':_0xc405('0x151'),'foreignKey':'AccountId'});db['VtigerField'][_0xc405('0xf8')](db[_0xc405('0xa8')],{'as':_0xc405('0x1b4'),'foreignKey':_0xc405('0x1a9')});db['VtigerField']['hasMany'](db[_0xc405('0xa8')],{'as':_0xc405('0x1ac'),'foreignKey':_0xc405('0x1ad')});db[_0xc405('0xa8')][_0xc405('0xf8')](db['VtigerField'],{'as':_0xc405('0x1ae'),'foreignKey':'FieldId'});db[_0xc405('0xa8')][_0xc405('0x105')](db[_0xc405('0x83')],{'as':_0xc405('0x83'),'foreignKey':_0xc405('0x1af')});db['ServicenowAccount'][_0xc405('0xf8')](db[_0xc405('0xac')],{'as':_0xc405('0x1b1'),'onDelete':'cascade','foreignKey':_0xc405('0x1a7')});db[_0xc405('0xac')][_0xc405('0xf8')](db[_0xc405('0xae')],{'as':'Subjects','foreignKey':_0xc405('0x1a9')});db[_0xc405('0xac')]['hasMany'](db[_0xc405('0xae')],{'as':_0xc405('0x1aa'),'foreignKey':_0xc405('0x1ad')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':'Fields','foreignKey':_0xc405('0x1ab')});db['ServicenowConfiguration'][_0xc405('0x105')](db[_0xc405('0xaa')],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x1a7')});db[_0xc405('0xae')][_0xc405('0xf8')](db[_0xc405('0xae')],{'as':_0xc405('0x1b4'),'foreignKey':_0xc405('0x1a9')});db[_0xc405('0xae')][_0xc405('0xf8')](db[_0xc405('0xae')],{'as':_0xc405('0x1ac'),'foreignKey':'DescriptionId'});db[_0xc405('0xae')]['hasMany'](db[_0xc405('0xae')],{'as':_0xc405('0x1ae'),'foreignKey':_0xc405('0x1ab')});db[_0xc405('0xae')]['belongsTo'](db[_0xc405('0x83')],{'as':_0xc405('0x83'),'foreignKey':'VariableId'});db[_0xc405('0xb0')][_0xc405('0xf8')](db[_0xc405('0xb2')],{'as':_0xc405('0x1b1'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a7')});db[_0xc405('0xb2')][_0xc405('0xf8')](db['Dynamics365Field'],{'as':_0xc405('0x1a8'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a9')});db['Dynamics365Configuration'][_0xc405('0xf8')](db[_0xc405('0xb4')],{'as':'Descriptions','onDelete':_0xc405('0xf6'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db[_0xc405('0xb4')],{'as':'Fields','onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1ab')});db[_0xc405('0xb2')][_0xc405('0x105')](db[_0xc405('0xb0')],{'as':'Account','foreignKey':_0xc405('0x1a7')});db[_0xc405('0xb4')][_0xc405('0xf8')](db[_0xc405('0xb4')],{'as':_0xc405('0x1b4'),'foreignKey':_0xc405('0x1a9')});db['Dynamics365Field'][_0xc405('0xf8')](db[_0xc405('0xb4')],{'as':'Description','foreignKey':'DescriptionId'});db['Dynamics365Field'][_0xc405('0xf8')](db[_0xc405('0xb4')],{'as':_0xc405('0x1ae'),'foreignKey':'FieldId'});db[_0xc405('0xb4')][_0xc405('0x105')](db['Variable'],{'as':_0xc405('0x83'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0xc405('0xf8')](db['FreshsalesConfiguration'],{'as':_0xc405('0x1b1'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1a7')});db[_0xc405('0xb6')][_0xc405('0xf8')](db[_0xc405('0xb8')],{'as':_0xc405('0x1a8'),'foreignKey':_0xc405('0x1a9')});db['FreshsalesConfiguration'][_0xc405('0xf8')](db['FreshsalesField'],{'as':_0xc405('0x1aa'),'foreignKey':_0xc405('0x1ad')});db['FreshsalesConfiguration'][_0xc405('0xf8')](db[_0xc405('0xb8')],{'as':_0xc405('0x1a4'),'foreignKey':_0xc405('0x1ab')});db['FreshsalesConfiguration'][_0xc405('0x105')](db['FreshsalesAccount'],{'as':_0xc405('0x151'),'foreignKey':'AccountId'});db['FreshsalesField'][_0xc405('0xf8')](db[_0xc405('0xb8')],{'as':_0xc405('0x1b4'),'foreignKey':_0xc405('0x1a9')});db[_0xc405('0xb8')][_0xc405('0xf8')](db[_0xc405('0xb8')],{'as':_0xc405('0x1ac'),'foreignKey':_0xc405('0x1ad')});db[_0xc405('0xb8')][_0xc405('0xf8')](db[_0xc405('0xb8')],{'as':_0xc405('0x1ae'),'foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db[_0xc405('0x83')],{'as':_0xc405('0x83'),'foreignKey':_0xc405('0x1af')});db[_0xc405('0xba')]['belongsTo'](db[_0xc405('0x5a')],{});db[_0xc405('0xba')][_0xc405('0x105')](db[_0xc405('0xde')],{'as':_0xc405('0x15f'),'foreignKey':'ListId'});db['ChatQueueReport'][_0xc405('0x105')](db[_0xc405('0x67')],{'as':_0xc405('0x147'),'foreignKey':_0xc405('0x148')});db['ChatQueueReport'][_0xc405('0x105')](db['ChatInteraction'],{});db[_0xc405('0xba')][_0xc405('0x105')](db[_0xc405('0x5e')],{});db[_0xc405('0xba')][_0xc405('0x105')](db[_0xc405('0x13')],{});db[_0xc405('0xba')][_0xc405('0x105')](db[_0xc405('0x61')],{});db[_0xc405('0xbc')][_0xc405('0x105')](db[_0xc405('0x13')],{'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1b9')});db[_0xc405('0xbc')][_0xc405('0x105')](db[_0xc405('0x13')],{'onDelete':'cascade','foreignKey':_0xc405('0x1ba')});db[_0xc405('0xbf')][_0xc405('0xf8')](db[_0xc405('0xbe')],{'foreignKey':'SessionId','onDelete':_0xc405('0xf6')});db[_0xc405('0xbf')][_0xc405('0xf8')](db[_0xc405('0xbd')],{'foreignKey':_0xc405('0x1bb'),'onDelete':_0xc405('0xf6')});db[_0xc405('0xc0')][_0xc405('0x105')](db[_0xc405('0x4b')],{});db[_0xc405('0xc0')]['belongsTo'](db[_0xc405('0xde')],{'as':_0xc405('0x15f'),'foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db['CmContact'],{'as':_0xc405('0x147'),'foreignKey':'ContactId'});db['SmsQueueReport']['belongsTo'](db[_0xc405('0x4e')],{});db[_0xc405('0xc0')][_0xc405('0x105')](db[_0xc405('0x50')],{});db['SmsQueueReport'][_0xc405('0x105')](db[_0xc405('0x13')],{});db['SmsQueueReport'][_0xc405('0x105')](db[_0xc405('0x52')],{});db[_0xc405('0xc5')]['hasMany'](db[_0xc405('0xbf')],{'foreignKey':'ProjectId'});db[_0xc405('0xc5')]['hasMany'](db[_0xc405('0xbe')],{'foreignKey':_0xc405('0x1bc')});db[_0xc405('0xc5')][_0xc405('0xf8')](db[_0xc405('0xbd')],{'foreignKey':_0xc405('0x1bc')});db[_0xc405('0xcb')][_0xc405('0x108')](db['User'],{'as':_0xc405('0x156'),'through':_0xc405('0x12c')});db['Team']['belongsToMany'](db[_0xc405('0x13')],{'as':_0xc405('0x13b'),'through':_0xc405('0x1bd')});db['Team'][_0xc405('0x108')](db[_0xc405('0x113')],{'through':_0xc405('0x13d'),'as':_0xc405('0x114')});db[_0xc405('0xd0')][_0xc405('0x108')](db[_0xc405('0x39')],{'through':'team_has_mail_queues','as':_0xc405('0x1be')});db['Team'][_0xc405('0x108')](db[_0xc405('0x61')],{'through':_0xc405('0x180'),'as':_0xc405('0x116')});db[_0xc405('0xd0')][_0xc405('0x108')](db[_0xc405('0x48')],{'through':_0xc405('0x169'),'as':_0xc405('0x117')});db['Team'][_0xc405('0x108')](db[_0xc405('0x52')],{'through':_0xc405('0x171'),'as':_0xc405('0x118')});db['Team']['belongsToMany'](db[_0xc405('0x58')],{'through':_0xc405('0x178'),'as':'OpenchannelQueues'});db[_0xc405('0xd0')][_0xc405('0x108')](db[_0xc405('0x1bf')],{'through':_0xc405('0x1c0'),'as':_0xc405('0x11c')});db[_0xc405('0xd4')][_0xc405('0xf8')](db[_0xc405('0x69')],{'as':_0xc405('0x135'),'foreignKey':'CampaignId'});db['Campaign'][_0xc405('0xf8')](db[_0xc405('0x6d')],{'as':_0xc405('0xfb'),'foreignKey':'CampaignId'});db[_0xc405('0xd4')][_0xc405('0xf8')](db['CmHopperHistory'],{'as':_0xc405('0x184'),'foreignKey':'CampaignId'});db[_0xc405('0xd4')][_0xc405('0xf8')](db[_0xc405('0x6b')],{'as':_0xc405('0x1c1'),'foreignKey':'CampaignId'});db[_0xc405('0xd4')][_0xc405('0x105')](db[_0xc405('0x28')],{'as':_0xc405('0x28'),'foreignKey':_0xc405('0x137')});db['Campaign'][_0xc405('0x105')](db['Trunk'],{'as':_0xc405('0x1c2'),'foreignKey':_0xc405('0x138')});db['Campaign'][_0xc405('0x105')](db[_0xc405('0x7a')],{'as':'Interval','foreignKey':_0xc405('0x16c')});db[_0xc405('0xd4')][_0xc405('0x105')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0xc405('0x1c3')});db[_0xc405('0xd4')][_0xc405('0x108')](db[_0xc405('0xde')],{'as':_0xc405('0x10b'),'through':_0xc405('0x1c4')});db[_0xc405('0xd4')][_0xc405('0x108')](db['CmList'],{'as':_0xc405('0x13e'),'through':_0xc405('0x1c5')});db[_0xc405('0x157')][_0xc405('0x105')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xc405('0xd8')]['belongsTo'](db[_0xc405('0x3c')],{});db[_0xc405('0xd8')][_0xc405('0x105')](db[_0xc405('0x10c')],{});db[_0xc405('0xd8')][_0xc405('0x105')](db[_0xc405('0x37')],{'foreignKey':_0xc405('0x1c6'),'as':'FromAccount'});db[_0xc405('0xd8')][_0xc405('0x105')](db[_0xc405('0x13')],{'foreignKey':'FromUserId','as':_0xc405('0x1c7')});db[_0xc405('0xd8')][_0xc405('0x105')](db[_0xc405('0x13')],{'foreignKey':_0xc405('0x1c8'),'as':'ToAgent'});db[_0xc405('0xd8')][_0xc405('0x105')](db[_0xc405('0x39')],{'foreignKey':_0xc405('0x1c9'),'as':_0xc405('0x1ca')});db[_0xc405('0xd8')][_0xc405('0x105')](db[_0xc405('0x37')],{'foreignKey':_0xc405('0x1cb'),'as':'ToAccount'});db[_0xc405('0xda')][_0xc405('0x105')](db['ChatMessage'],{});db[_0xc405('0xda')][_0xc405('0x105')](db['ChatInteraction'],{});db[_0xc405('0xda')][_0xc405('0x105')](db[_0xc405('0x5a')],{'foreignKey':_0xc405('0x1cc'),'as':_0xc405('0x1cd')});db[_0xc405('0xda')][_0xc405('0x105')](db[_0xc405('0x13')],{'foreignKey':_0xc405('0x1ce'),'as':'FromAgent'});db[_0xc405('0xda')][_0xc405('0x105')](db[_0xc405('0x13')],{'foreignKey':_0xc405('0x1c8'),'as':_0xc405('0x1cf')});db['ChatTransferReport']['belongsTo'](db[_0xc405('0x61')],{'foreignKey':_0xc405('0x1d0'),'as':_0xc405('0x1ca')});db[_0xc405('0xda')][_0xc405('0x105')](db['ChatWebsite'],{'foreignKey':_0xc405('0x1d1'),'as':_0xc405('0x1d2')});db[_0xc405('0xdc')][_0xc405('0x105')](db[_0xc405('0x46')],{});db[_0xc405('0xdc')][_0xc405('0x105')](db[_0xc405('0x102')],{});db[_0xc405('0xdc')][_0xc405('0x105')](db['FaxAccount'],{'foreignKey':_0xc405('0x1d3'),'as':_0xc405('0x1cd')});db[_0xc405('0xdc')][_0xc405('0x105')](db['User'],{'foreignKey':_0xc405('0x1ce'),'as':_0xc405('0x1c7')});db[_0xc405('0xdc')]['belongsTo'](db[_0xc405('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xc405('0xdc')][_0xc405('0x105')](db[_0xc405('0x48')],{'foreignKey':_0xc405('0x1d4'),'as':_0xc405('0x1ca')});db[_0xc405('0xdc')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0xc405('0x1d5'),'as':_0xc405('0x1d2')});db[_0xc405('0x1d6')][_0xc405('0x105')](db[_0xc405('0x173')],{});db['OpenchannelTransferReport'][_0xc405('0x105')](db[_0xc405('0x55')],{});db[_0xc405('0x1d6')][_0xc405('0x105')](db[_0xc405('0x53')],{'foreignKey':'FromOpenchannelAccountId','as':_0xc405('0x1cd')});db[_0xc405('0x1d6')][_0xc405('0x105')](db[_0xc405('0x13')],{'foreignKey':_0xc405('0x1ce'),'as':_0xc405('0x1c7')});db[_0xc405('0x1d6')][_0xc405('0x105')](db[_0xc405('0x13')],{'foreignKey':_0xc405('0x1c8'),'as':_0xc405('0x1cf')});db[_0xc405('0x1d6')][_0xc405('0x105')](db[_0xc405('0x58')],{'foreignKey':_0xc405('0x1d7'),'as':_0xc405('0x1ca')});db[_0xc405('0x1d6')][_0xc405('0x105')](db['OpenchannelAccount'],{'foreignKey':_0xc405('0x1d8'),'as':_0xc405('0x1d2')});db[_0xc405('0x1d9')]['belongsTo'](db[_0xc405('0x50')],{});db[_0xc405('0x1d9')][_0xc405('0x105')](db[_0xc405('0x4e')],{});db[_0xc405('0x1d9')]['belongsTo'](db[_0xc405('0x4b')],{'foreignKey':_0xc405('0x1da'),'as':_0xc405('0x1cd')});db[_0xc405('0x1d9')][_0xc405('0x105')](db[_0xc405('0x13')],{'foreignKey':_0xc405('0x1ce'),'as':'FromAgent'});db[_0xc405('0x1d9')]['belongsTo'](db[_0xc405('0x13')],{'foreignKey':_0xc405('0x1c8'),'as':_0xc405('0x1cf')});db[_0xc405('0x1d9')][_0xc405('0x105')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0xc405('0x1d9')][_0xc405('0x105')](db[_0xc405('0x4b')],{'foreignKey':_0xc405('0x1db'),'as':_0xc405('0x1d2')});db[_0xc405('0xde')][_0xc405('0xf8')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xc405('0x14e')});db[_0xc405('0xde')][_0xc405('0xf8')](db[_0xc405('0x1dc')],{'as':'CustomFields','foreignKey':'ListId'});db[_0xc405('0xde')][_0xc405('0xf8')](db[_0xc405('0x67')],{'as':_0xc405('0x109'),'onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x14e')});db['CmList'][_0xc405('0xf8')](db[_0xc405('0x6d')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0xc405('0xde')][_0xc405('0xf8')](db[_0xc405('0xfc')],{'as':'HopperHistory','foreignKey':_0xc405('0x14e')});db[_0xc405('0xde')][_0xc405('0xf8')](db[_0xc405('0x6f')],{'as':_0xc405('0x6f'),'foreignKey':_0xc405('0x14e')});db[_0xc405('0xde')][_0xc405('0x108')](db[_0xc405('0x113')],{'as':'Queues','through':_0xc405('0x1dd')});db[_0xc405('0xde')]['belongsToMany'](db[_0xc405('0x13')],{'as':_0xc405('0x13b'),'through':'cm_user_has_lists'});db[_0xc405('0xe0')][_0xc405('0xf8')](db[_0xc405('0x12f')],{'as':_0xc405('0xfa'),'onDelete':_0xc405('0xf6')});db[_0xc405('0xe0')][_0xc405('0x108')](db[_0xc405('0x13')],{'as':'Agents','through':_0xc405('0x11f')});db[_0xc405('0xe2')][_0xc405('0xf8')](db[_0xc405('0x13')],{'as':'Users','foreignKey':_0xc405('0x106')});db[_0xc405('0xe2')]['hasMany'](db[_0xc405('0xe4')],{'as':_0xc405('0x1de'),'foreignKey':_0xc405('0x106'),'onDelete':_0xc405('0xf6')});db[_0xc405('0xe4')]['hasMany'](db[_0xc405('0xe6')],{'as':_0xc405('0x1df'),'foreignKey':_0xc405('0x1e0'),'onDelete':_0xc405('0xf6')});db[_0xc405('0x128')][_0xc405('0xf8')](db[_0xc405('0x77')],{'as':'Dispositions','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xc405('0xf8')](db[_0xc405('0x75')],{'as':_0xc405('0x14c'),'foreignKey':_0xc405('0x1e1')});db[_0xc405('0x128')][_0xc405('0xf8')](db[_0xc405('0xee')],{'as':_0xc405('0x164'),'foreignKey':_0xc405('0x1e1')});db[_0xc405('0x128')][_0xc405('0xf8')](db[_0xc405('0xec')],{'as':'Interactions'});db[_0xc405('0x128')][_0xc405('0xf8')](db[_0xc405('0x1e2')],{'as':'Applications'});db['WhatsappAccount']['belongsTo'](db[_0xc405('0xde')],{'as':_0xc405('0x15f'),'foreignKey':_0xc405('0x14e')});db[_0xc405('0x128')][_0xc405('0x105')](db[_0xc405('0x7c')],{'as':_0xc405('0x139'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xc405('0x108')](db[_0xc405('0x13')],{'as':_0xc405('0x13b'),'through':'user_has_whatsapp_accounts'});db[_0xc405('0x1e2')][_0xc405('0x105')](db[_0xc405('0x13')],{'onDelete':_0xc405('0x15c')});db[_0xc405('0x1e2')][_0xc405('0x105')](db['WhatsappQueue'],{'onDelete':_0xc405('0x15c')});db['WhatsappApplication'][_0xc405('0x105')](db[_0xc405('0x128')],{'onDelete':_0xc405('0x15c')});db[_0xc405('0x1e2')][_0xc405('0x105')](db['Interval'],{'onDelete':_0xc405('0x15c'),'foreignKey':_0xc405('0x16c')});db[_0xc405('0x1e2')][_0xc405('0x105')](db['Tag'],{'onDelete':_0xc405('0x15c'),'foreignKey':_0xc405('0x15d')});db[_0xc405('0xec')][_0xc405('0xf8')](db[_0xc405('0xee')],{'as':'Messages','onDelete':_0xc405('0xf6'),'foreignKey':_0xc405('0x1e3')});db[_0xc405('0xec')]['belongsTo'](db[_0xc405('0x128')],{'as':_0xc405('0x151'),'foreignKey':_0xc405('0x1e1')});db['WhatsappInteraction'][_0xc405('0x105')](db['CmContact'],{'as':_0xc405('0x147'),'foreignKey':'ContactId'});db['WhatsappInteraction']['belongsTo'](db[_0xc405('0x13')],{'as':_0xc405('0x152'),'foreignKey':_0xc405('0xf7')});db['WhatsappInteraction'][_0xc405('0x108')](db[_0xc405('0x153')],{'through':_0xc405('0x19a'),'as':'Tags'});db[_0xc405('0xec')][_0xc405('0x108')](db[_0xc405('0x153')],{'through':_0xc405('0x19a'),'as':_0xc405('0x16f')});db[_0xc405('0xec')]['belongsToMany'](db[_0xc405('0x13')],{'as':_0xc405('0x156'),'through':_0xc405('0x1e4'),'foreignKey':_0xc405('0x1e3')});db[_0xc405('0xee')][_0xc405('0x105')](db['User'],{'as':_0xc405('0x13')});db[_0xc405('0xee')]['belongsTo'](db[_0xc405('0x67')],{'onDelete':_0xc405('0xf6'),'as':_0xc405('0x147')});db[_0xc405('0xee')][_0xc405('0x105')](db[_0xc405('0xec')],{'onDelete':_0xc405('0xf6'),'as':_0xc405('0x159'),'foreignKey':_0xc405('0x1e3')});db['WhatsappMessage']['belongsTo'](db[_0xc405('0x128')],{'as':_0xc405('0x151'),'foreignKey':'WhatsappAccountId'});db[_0xc405('0x1e5')][_0xc405('0x105')](db[_0xc405('0x128')],{});db['WhatsappQueueReport'][_0xc405('0x105')](db['CmList'],{'as':_0xc405('0x15f'),'foreignKey':_0xc405('0x14e')});db[_0xc405('0x1e5')][_0xc405('0x105')](db[_0xc405('0x67')],{'as':_0xc405('0x147'),'foreignKey':'ContactId'});db[_0xc405('0x1e5')][_0xc405('0x105')](db[_0xc405('0xec')],{});db[_0xc405('0x1e5')][_0xc405('0x105')](db['WhatsappQueue'],{});db[_0xc405('0x1e5')][_0xc405('0x105')](db['WhatsappMessage'],{});db[_0xc405('0x1e5')][_0xc405('0x105')](db[_0xc405('0x13')],{});db[_0xc405('0xf0')][_0xc405('0x105')](db['WhatsappMessage'],{});db[_0xc405('0xf0')]['belongsTo'](db[_0xc405('0xec')],{});db['WhatsappTransferReport'][_0xc405('0x105')](db[_0xc405('0x128')],{'foreignKey':_0xc405('0x1e6'),'as':_0xc405('0x1cd')});db[_0xc405('0xf0')]['belongsTo'](db[_0xc405('0x128')],{'foreignKey':_0xc405('0x1e7'),'as':_0xc405('0x1d2')});db[_0xc405('0xf0')][_0xc405('0x105')](db[_0xc405('0x1bf')],{'foreignKey':_0xc405('0x1e8'),'as':_0xc405('0x1ca')});db[_0xc405('0xf0')][_0xc405('0x105')](db[_0xc405('0x13')],{'foreignKey':_0xc405('0x1ce'),'as':_0xc405('0x1c7')});db['WhatsappTransferReport'][_0xc405('0x105')](db[_0xc405('0x13')],{'foreignKey':_0xc405('0x1c8'),'as':_0xc405('0x1cf')});db['WhatsappQueue'][_0xc405('0x108')](db['User'],{'as':_0xc405('0x13b'),'through':_0xc405('0x32'),'foreignKey':_0xc405('0x1e9')});db[_0xc405('0x1bf')][_0xc405('0x108')](db['Team'],{'through':_0xc405('0x1c0'),'as':'Teams'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8909380..cb5bb94 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1baa=['body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','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','other','agent_name','test','url','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','./api/chatProactiveAction','/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/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','./api/rpc','/api/version','/api/system','./api/pm2','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','appPath','/index.html','username','password','apiKey','lastName','street','phone','mobile','fax','email','clientSecret','code','token','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','pass','accountSid','localstationid','dsn','registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','path','express-winston','util','./errors','./config/environment','api','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s'];(function(_0x1ec50e,_0x2565f3){var _0x337f97=function(_0x5167c0){while(--_0x5167c0){_0x1ec50e['push'](_0x1ec50e['shift']());}};_0x337f97(++_0x2565f3);}(_0x1baa,0x13d));var _0xa1ba=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1baa[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var path=require(_0xa1ba('0x0'));var express=require('express');var ewinston=require(_0xa1ba('0x1'));var util=require(_0xa1ba('0x2'));var errors=require(_0xa1ba('0x3'));var config=require(_0xa1ba('0x4'));var logger=require('./config/logger')(_0xa1ba('0x5'));var authLogger=require(_0xa1ba('0x6'))(_0xa1ba('0x7'));exports[_0xa1ba('0x8')]=function(_0x472788){_0x472788[_0xa1ba('0x9')](ewinston[_0xa1ba('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x20ea7d,_0x2b1ac9){var _0x3f8dff=_0xa1ba('0xb');if(!_['isEmpty'](_0x20ea7d[_0xa1ba('0xc')])){_0x3f8dff+=_0xa1ba('0xd');var _0x385ff8=_0x20ea7d[_0xa1ba('0xc')];maskSensitiveData(_0x385ff8);}return util[_0xa1ba('0xe')](_0x3f8dff,_0x20ea7d[_0xa1ba('0xf')],_0x20ea7d[_0xa1ba('0x10')][_0xa1ba('0x11')]?_0x20ea7d['headers'][_0xa1ba('0x11')]:_0x20ea7d[_0xa1ba('0x12')][_0xa1ba('0x13')]||_0x20ea7d['ip'],_0x20ea7d['url'],_0x2b1ac9[_0xa1ba('0x14')],_0x2b1ac9[_0xa1ba('0x15')],_0x20ea7d[_0xa1ba('0x16')]?_0x20ea7d[_0xa1ba('0x16')]['id']:null,_0x20ea7d[_0xa1ba('0x16')]?_0x20ea7d['user'][_0xa1ba('0x17')]:null,_0x20ea7d[_0xa1ba('0x16')]?_0x20ea7d[_0xa1ba('0x16')][_0xa1ba('0x18')]:null,_0x385ff8?util[_0xa1ba('0x19')](_0x385ff8,![],null):'');}}));_0x472788['use'](ewinston[_0xa1ba('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1e3c39,_0x7994fb){var _0x5936bc=_0xa1ba('0x1a');if(_0x1e3c39[_0xa1ba('0xc')]&&_0x1e3c39[_0xa1ba('0xc')][_0xa1ba('0x1b')]&&_0x1e3c39[_0xa1ba('0xc')][_0xa1ba('0x1c')]){_0x5936bc='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x5936bc,_0x1e3c39[_0xa1ba('0xf')],_0x1e3c39[_0xa1ba('0x10')]['x-forwarded-for']?_0x1e3c39[_0xa1ba('0x10')]['x-forwarded-for']:_0x1e3c39[_0xa1ba('0x12')]['remoteAddress']||_0x1e3c39['ip'],_0x1e3c39['url'],_0x7994fb['statusCode'],_0x7994fb[_0xa1ba('0x15')],_0x1e3c39[_0xa1ba('0x16')]?_0x1e3c39[_0xa1ba('0x16')]['id']:null,_0x1e3c39[_0xa1ba('0x16')]?_0x1e3c39[_0xa1ba('0x16')][_0xa1ba('0x17')]:null,_0x1e3c39[_0xa1ba('0x16')]?_0x1e3c39[_0xa1ba('0x16')]['role']:null,_0x1e3c39[_0xa1ba('0xc')]&&_0x1e3c39[_0xa1ba('0xc')][_0xa1ba('0x1b')]?_0x1e3c39[_0xa1ba('0xc')]['device']:_0xa1ba('0x1d'),_0x1e3c39[_0xa1ba('0xc')]&&_0x1e3c39[_0xa1ba('0xc')][_0xa1ba('0x1c')]?_0x1e3c39[_0xa1ba('0xc')][_0xa1ba('0x1c')]:'',_0x1e3c39[_0xa1ba('0xc')]&&_0x1e3c39[_0xa1ba('0xc')][_0xa1ba('0x1e')]?_0x1e3c39[_0xa1ba('0xc')][_0xa1ba('0x1e')]:'');},'ignoreRoute':function(_0x4daebf){var _0x5e1f0e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5e1f0e[_0xa1ba('0x1f')](_0x4daebf[_0xa1ba('0x20')]);}}));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x21'),require('./api/user'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x22'),require(_0xa1ba('0x23')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x24'),require(_0xa1ba('0x25')));_0x472788['use'](_0xa1ba('0x26'),require('./api/voiceExtension'));_0x472788[_0xa1ba('0x9')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x472788['use']('/api/voice/queues',require(_0xa1ba('0x27')));_0x472788[_0xa1ba('0x9')]('/api/voice/recordings',require(_0xa1ba('0x28')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x29'),require(_0xa1ba('0x2a')));_0x472788[_0xa1ba('0x9')]('/api/voice/mails',require(_0xa1ba('0x2b')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x2c'),require(_0xa1ba('0x2d')));_0x472788[_0xa1ba('0x9')]('/api/voice/calls/reports',require(_0xa1ba('0x2e')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x2f'),require(_0xa1ba('0x30')));_0x472788['use'](_0xa1ba('0x31'),require(_0xa1ba('0x32')));_0x472788['use'](_0xa1ba('0x33'),require(_0xa1ba('0x34')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x35'),require(_0xa1ba('0x36')));_0x472788[_0xa1ba('0x9')]('/api/trunks',require(_0xa1ba('0x37')));_0x472788['use'](_0xa1ba('0x38'),require(_0xa1ba('0x39')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x3a'),require(_0xa1ba('0x3b')));_0x472788['use'](_0xa1ba('0x3c'),require(_0xa1ba('0x3d')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x3e'),require('./api/mailQueue'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x3f'),require('./api/mailSubstatus'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x40'),require(_0xa1ba('0x41')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x42'),require(_0xa1ba('0x43')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x44'),require('./api/mailApplication'));_0x472788[_0xa1ba('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x472788['use'](_0xa1ba('0x45'),require('./api/dashboard'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x46'),require(_0xa1ba('0x47')));_0x472788['use'](_0xa1ba('0x48'),require(_0xa1ba('0x49')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x4a'),require(_0xa1ba('0x4b')));_0x472788[_0xa1ba('0x9')]('/api/fax/interactions',require(_0xa1ba('0x4c')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x4d'),require(_0xa1ba('0x4e')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x4f'),require(_0xa1ba('0x50')));_0x472788['use']('/api/fax/reports/queue',require(_0xa1ba('0x51')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x52'),require(_0xa1ba('0x53')));_0x472788['use']('/api/sms/applications',require(_0xa1ba('0x54')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x55'),require(_0xa1ba('0x56')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x57'),require(_0xa1ba('0x58')));_0x472788[_0xa1ba('0x9')]('/api/sms/queues',require(_0xa1ba('0x59')));_0x472788['use'](_0xa1ba('0x5a'),require(_0xa1ba('0x5b')));_0x472788['use'](_0xa1ba('0x5c'),require(_0xa1ba('0x5d')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x5e'),require(_0xa1ba('0x5f')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x60'),require(_0xa1ba('0x61')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x62'),require(_0xa1ba('0x63')));_0x472788['use'](_0xa1ba('0x64'),require('./api/chatWebsite'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x65'),require(_0xa1ba('0x66')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x67'),require(_0xa1ba('0x68')));_0x472788['use'](_0xa1ba('0x69'),require(_0xa1ba('0x6a')));_0x472788['use']('/api/chat/messages',require('./api/chatMessage'));_0x472788[_0xa1ba('0x9')]('/api/chat/offline_messages',require(_0xa1ba('0x6b')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x6c'),require(_0xa1ba('0x6d')));_0x472788[_0xa1ba('0x9')]('/api/chat/groups',require(_0xa1ba('0x6e')));_0x472788[_0xa1ba('0x9')]('/api/chat/proactive_actions',require(_0xa1ba('0x6f')));_0x472788[_0xa1ba('0x9')]('/api/cm/companies',require('./api/cmCompany'));_0x472788['use'](_0xa1ba('0x70'),require(_0xa1ba('0x71')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x72'),require(_0xa1ba('0x73')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x74'),require(_0xa1ba('0x75')));_0x472788['use'](_0xa1ba('0x76'),require(_0xa1ba('0x77')));_0x472788[_0xa1ba('0x9')]('/api/cm/hopper_history',require(_0xa1ba('0x78')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x79'),require('./api/cmCustomField'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x7a'),require(_0xa1ba('0x7b')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x7c'),require('./api/automation'));_0x472788[_0xa1ba('0x9')]('/api/canned_answers',require(_0xa1ba('0x7d')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x7e'),require(_0xa1ba('0x7f')));_0x472788['use'](_0xa1ba('0x80'),require(_0xa1ba('0x81')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x82'),require(_0xa1ba('0x83')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x84'),require(_0xa1ba('0x85')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x86'),require(_0xa1ba('0x87')));_0x472788['use']('/api/voiceQueuesLog',require(_0xa1ba('0x88')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x89'),require(_0xa1ba('0x8a')));_0x472788['use'](_0xa1ba('0x8b'),require(_0xa1ba('0x8c')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x8d'),require(_0xa1ba('0x8e')));_0x472788[_0xa1ba('0x9')]('/api/templates',require('./api/template'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x8f'),require(_0xa1ba('0x90')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x91'),require(_0xa1ba('0x92')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x93'),require(_0xa1ba('0x94')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x95'),require(_0xa1ba('0x96')));_0x472788['use'](_0xa1ba('0x97'),require(_0xa1ba('0x98')));_0x472788[_0xa1ba('0x9')]('/api/analytics/default_reports',require(_0xa1ba('0x99')));_0x472788['use'](_0xa1ba('0x9a'),require(_0xa1ba('0x9b')));_0x472788['use'](_0xa1ba('0x9c'),require(_0xa1ba('0x9d')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x9e'),require(_0xa1ba('0x9f')));_0x472788['use'](_0xa1ba('0xa0'),require(_0xa1ba('0xa1')));_0x472788['use']('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xa2'),require('./api/intSalesforceConfiguration'));_0x472788['use'](_0xa1ba('0xa3'),require(_0xa1ba('0xa4')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xa5'),require(_0xa1ba('0xa6')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xa7'),require(_0xa1ba('0xa8')));_0x472788['use'](_0xa1ba('0xa9'),require(_0xa1ba('0xaa')));_0x472788['use'](_0xa1ba('0xab'),require(_0xa1ba('0xac')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xad'),require('./api/intDeskConfiguration'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xae'),require(_0xa1ba('0xaf')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xb0'),require('./api/intZohoAccount'));_0x472788['use'](_0xa1ba('0xb1'),require('./api/intZohoConfiguration'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xb2'),require(_0xa1ba('0xb3')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xb4'),require('./api/intZendeskAccount'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xb5'),require(_0xa1ba('0xb6')));_0x472788['use'](_0xa1ba('0xb7'),require(_0xa1ba('0xb8')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xb9'),require('./api/intFreshdeskAccount'));_0x472788[_0xa1ba('0x9')]('/api/integrations/freshdesk/configurations',require(_0xa1ba('0xba')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xbb'),require('./api/intFreshdeskField'));_0x472788['use'](_0xa1ba('0xbc'),require(_0xa1ba('0xbd')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xbe'),require('./api/intVtigerConfiguration'));_0x472788[_0xa1ba('0x9')]('/api/integrations/vtiger/fields',require(_0xa1ba('0xbf')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xc0'),require('./api/intServicenowAccount'));_0x472788['use']('/api/integrations/servicenow/configurations',require(_0xa1ba('0xc1')));_0x472788[_0xa1ba('0x9')]('/api/integrations/servicenow/fields',require(_0xa1ba('0xc2')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xc3'),require(_0xa1ba('0xc4')));_0x472788[_0xa1ba('0x9')]('/api/integrations/dynamics365/configurations',require(_0xa1ba('0xc5')));_0x472788['use'](_0xa1ba('0xc6'),require(_0xa1ba('0xc7')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xc8'),require(_0xa1ba('0xc9')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xca'),require(_0xa1ba('0xcb')));_0x472788['use'](_0xa1ba('0xcc'),require(_0xa1ba('0xcd')));_0x472788['use'](_0xa1ba('0xce'),require('./api/network'));_0x472788['use'](_0xa1ba('0xcf'),require('./api/chatQueueReport'));_0x472788[_0xa1ba('0x9')]('/api/chat/internal/messages',require(_0xa1ba('0xd0')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xd1'),require(_0xa1ba('0xd2')));_0x472788['use'](_0xa1ba('0xd3'),require(_0xa1ba('0xd4')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xd5'),require(_0xa1ba('0xd6')));_0x472788['use'](_0xa1ba('0xd7'),require(_0xa1ba('0xd8')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xd9'),require(_0xa1ba('0xda')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xdb'),require(_0xa1ba('0xdc')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xdd'),require(_0xa1ba('0xde')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xdf'),require(_0xa1ba('0xe0')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xe1'),require(_0xa1ba('0xe2')));_0x472788[_0xa1ba('0x9')]('/api/square/projects',require(_0xa1ba('0xe3')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xe4'),require(_0xa1ba('0xe5')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xe6'),require(_0xa1ba('0xe7')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xe8'),require(_0xa1ba('0xe9')));_0x472788['use'](_0xa1ba('0xea'),require('./api/license'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xeb'),require(_0xa1ba('0xec')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xed'),require(_0xa1ba('0xee')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xef'),require(_0xa1ba('0xf0')));_0x472788[_0xa1ba('0x9')]('/api/plugins',require('./api/plugin'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xf1'),require(_0xa1ba('0xf2')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xf3'),require(_0xa1ba('0xf4')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xf5'),require('./api/faxTransferReport'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xf6'),require('./api/openchannelTransferReport'));_0x472788[_0xa1ba('0x9')]('/api/sms/reports/transfer',require(_0xa1ba('0xf7')));_0x472788[_0xa1ba('0x9')]('/api/cm/lists',require(_0xa1ba('0xf8')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xf9'),require(_0xa1ba('0xfa')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xfb'),require(_0xa1ba('0xfc')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xfd'),require(_0xa1ba('0xfe')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0xff'),require(_0xa1ba('0x100')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x101'),require('./api/userNotification'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x102'),require(_0xa1ba('0x103')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x104'),require(_0xa1ba('0x105')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x106'),require(_0xa1ba('0x107')));_0x472788['use']('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x108'),require(_0xa1ba('0x109')));_0x472788['use'](_0xa1ba('0x10a'),require(_0xa1ba('0x10b')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x10c'),require(_0xa1ba('0x10d')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x10e'),require(_0xa1ba('0x10f')));_0x472788['use'](_0xa1ba('0x110'),require(_0xa1ba('0x111')));_0x472788[_0xa1ba('0x9')]('/api/auth/google',require('./api/authGoogle'));_0x472788[_0xa1ba('0x9')]('/api/jira',require('./api/jira'));_0x472788[_0xa1ba('0x9')]('/api/rpc',require(_0xa1ba('0x112')));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x113'),require('./api/version'));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x114'),require('./api/system'));_0x472788['use']('/api/pm2',require(_0xa1ba('0x115')));_0x472788[_0xa1ba('0x9')]('/api/webbar',require(_0xa1ba('0x116')));_0x472788[_0xa1ba('0x9')]('/apidoc',express[_0xa1ba('0x117')](path[_0xa1ba('0x118')](config[_0xa1ba('0x119')],_0xa1ba('0x11a'))));_0x472788[_0xa1ba('0x9')]('/www',express[_0xa1ba('0x117')](path[_0xa1ba('0x118')](config[_0xa1ba('0x119')],_0xa1ba('0x11b'))));_0x472788[_0xa1ba('0x9')]('/demo',express[_0xa1ba('0x117')](path[_0xa1ba('0x118')](config[_0xa1ba('0x119')],_0xa1ba('0x11c'))));_0x472788[_0xa1ba('0x9')](_0xa1ba('0x11d'),express['static'](path['join'](config[_0xa1ba('0x119')],_0xa1ba('0x11e'),'3.0.0')));_0x472788[_0xa1ba('0x9')]('/plugins',express[_0xa1ba('0x117')](path['join'](config[_0xa1ba('0x119')],_0xa1ba('0x11f'))));_0x472788['route'](_0xa1ba('0x120'))[_0xa1ba('0x121')](errors[0x194]);_0x472788[_0xa1ba('0x122')]('/*')[_0xa1ba('0x121')](function(_0x3f9b26,_0x39e2ce){_0x39e2ce[_0xa1ba('0x123')](path['resolve'](_0x472788[_0xa1ba('0x121')](_0xa1ba('0x124'))+_0xa1ba('0x125')));});};var sensitiveFields=[_0xa1ba('0x126'),_0xa1ba('0x127'),'newPassword',_0xa1ba('0x128'),'firstName',_0xa1ba('0x129'),_0xa1ba('0x12a'),_0xa1ba('0x12b'),_0xa1ba('0x12c'),_0xa1ba('0x12d'),_0xa1ba('0x12e'),'clientId',_0xa1ba('0x12f'),'securityToken',_0xa1ba('0x130'),'accessKey','tenantId',_0xa1ba('0x131'),'channelSecret','accessToken',_0xa1ba('0x132'),'authToken',_0xa1ba('0x133'),_0xa1ba('0x134'),_0xa1ba('0x135'),'calleridname',_0xa1ba('0x136'),_0xa1ba('0x137'),_0xa1ba('0x138'),_0xa1ba('0x139'),_0xa1ba('0x13a'),_0xa1ba('0x13b'),_0xa1ba('0x13c'),'key',_0xa1ba('0x16'),_0xa1ba('0x13d'),_0xa1ba('0x13e'),_0xa1ba('0x13f'),_0xa1ba('0x140'),'secret',_0xa1ba('0x141'),_0xa1ba('0x142')];function maskSensitiveData(_0x2c818a){var _0x3add60=/(?!^)[\s\S](?!$)/g;if(!_[_0xa1ba('0x143')](_0x2c818a))return;for(var _0x83326f in _0x2c818a){if(_['isArray'](_0x2c818a[_0x83326f])){for(var _0x31e26c=0x0;_0x31e26c<_0x2c818a[_0x83326f][_0xa1ba('0x144')];_0x31e26c++){maskSensitiveData(_0x2c818a[_0x83326f][_0x31e26c]);}}else if(_[_0xa1ba('0x143')](_0x2c818a[_0x83326f])){maskSensitiveData(_0x2c818a[_0x83326f]);}else if(_[_0xa1ba('0x145')](_0x2c818a[_0x83326f])){_0x2c818a[_0x83326f]=_0x2c818a[_0x83326f][_0xa1ba('0x146')](/{{{/g,_0xa1ba('0x147'))[_0xa1ba('0x146')](/}}}/g,_0xa1ba('0x148'))['replace'](/{{/g,'@{')[_0xa1ba('0x146')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x83326f)){_0x2c818a[_0x83326f]=_0x2c818a[_0x83326f][_0xa1ba('0x146')](_0x3add60,'*');}}}} \ No newline at end of file +var _0x701d=['./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','static','join','/demo','3.0.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','get','resolve','/index.html','newPassword','apiKey','firstName','street','mobile','fax','clientSecret','securityToken','code','token','channelSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','key','pass','localstationid','secret','isPlainObject','isString','@@{','replace','}@@','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers','x-forwarded-for','connection','statusCode','responseTime','user','name','role','inspect','logger','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','remoteAddress','url','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages'];(function(_0x2cdb24,_0x50baa4){var _0x39bd6f=function(_0x2addca){while(--_0x2addca){_0x2cdb24['push'](_0x2cdb24['shift']());}};_0x39bd6f(++_0x50baa4);}(_0x701d,0xd6));var _0xd701=function(_0x1cdec3,_0x952d5f){_0x1cdec3=_0x1cdec3-0x0;var _0x5cefc3=_0x701d[_0x1cdec3];return _0x5cefc3;};'use strict';var _=require('lodash');var path=require(_0xd701('0x0'));var express=require(_0xd701('0x1'));var ewinston=require(_0xd701('0x2'));var util=require(_0xd701('0x3'));var errors=require(_0xd701('0x4'));var config=require(_0xd701('0x5'));var logger=require(_0xd701('0x6'))(_0xd701('0x7'));var authLogger=require(_0xd701('0x6'))(_0xd701('0x8'));exports['default']=function(_0x343c7b){_0x343c7b[_0xd701('0x9')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1f08a,_0x1c0e82){var _0x4b511c=_0xd701('0xa');if(!_[_0xd701('0xb')](_0x1f08a[_0xd701('0xc')])){_0x4b511c+='\x20body=%s';var _0x1bcf58=_0x1f08a[_0xd701('0xc')];maskSensitiveData(_0x1bcf58);}return util[_0xd701('0xd')](_0x4b511c,_0x1f08a['method'],_0x1f08a['headers']['x-forwarded-for']?_0x1f08a[_0xd701('0xe')][_0xd701('0xf')]:_0x1f08a[_0xd701('0x10')]['remoteAddress']||_0x1f08a['ip'],_0x1f08a['url'],_0x1c0e82[_0xd701('0x11')],_0x1c0e82[_0xd701('0x12')],_0x1f08a['user']?_0x1f08a[_0xd701('0x13')]['id']:null,_0x1f08a['user']?_0x1f08a['user'][_0xd701('0x14')]:null,_0x1f08a[_0xd701('0x13')]?_0x1f08a[_0xd701('0x13')][_0xd701('0x15')]:null,_0x1bcf58?util[_0xd701('0x16')](_0x1bcf58,![],null):'');}}));_0x343c7b[_0xd701('0x9')](ewinston[_0xd701('0x17')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2b69bf,_0x1a3b26){var _0x40f407='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2b69bf[_0xd701('0xc')]&&_0x2b69bf[_0xd701('0xc')]['device']&&_0x2b69bf['body'][_0xd701('0x18')]){_0x40f407=_0xd701('0x19');}return util[_0xd701('0xd')](_0x40f407,_0x2b69bf[_0xd701('0x1a')],_0x2b69bf[_0xd701('0xe')][_0xd701('0xf')]?_0x2b69bf[_0xd701('0xe')][_0xd701('0xf')]:_0x2b69bf[_0xd701('0x10')][_0xd701('0x1b')]||_0x2b69bf['ip'],_0x2b69bf[_0xd701('0x1c')],_0x1a3b26[_0xd701('0x11')],_0x1a3b26[_0xd701('0x12')],_0x2b69bf[_0xd701('0x13')]?_0x2b69bf[_0xd701('0x13')]['id']:null,_0x2b69bf[_0xd701('0x13')]?_0x2b69bf[_0xd701('0x13')][_0xd701('0x14')]:null,_0x2b69bf[_0xd701('0x13')]?_0x2b69bf['user'][_0xd701('0x15')]:null,_0x2b69bf[_0xd701('0xc')]&&_0x2b69bf['body'][_0xd701('0x1d')]?_0x2b69bf['body']['device']:_0xd701('0x1e'),_0x2b69bf[_0xd701('0xc')]&&_0x2b69bf[_0xd701('0xc')]['agent_id']?_0x2b69bf[_0xd701('0xc')]['agent_id']:'',_0x2b69bf[_0xd701('0xc')]&&_0x2b69bf[_0xd701('0xc')]['agent_name']?_0x2b69bf[_0xd701('0xc')][_0xd701('0x1f')]:'');},'ignoreRoute':function(_0x37dc72){var _0x25a8f1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x25a8f1[_0xd701('0x20')](_0x37dc72[_0xd701('0x1c')]);}}));_0x343c7b['use'](_0xd701('0x21'),require(_0xd701('0x22')));_0x343c7b[_0xd701('0x9')](_0xd701('0x23'),require(_0xd701('0x24')));_0x343c7b[_0xd701('0x9')](_0xd701('0x25'),require('./api/voiceContext'));_0x343c7b[_0xd701('0x9')](_0xd701('0x26'),require('./api/voiceExtension'));_0x343c7b[_0xd701('0x9')]('/api/voice/mohs',require(_0xd701('0x27')));_0x343c7b['use'](_0xd701('0x28'),require(_0xd701('0x29')));_0x343c7b[_0xd701('0x9')]('/api/voice/recordings',require(_0xd701('0x2a')));_0x343c7b[_0xd701('0x9')]('/api/screen/recordings',require(_0xd701('0x2b')));_0x343c7b[_0xd701('0x9')](_0xd701('0x2c'),require(_0xd701('0x2d')));_0x343c7b['use'](_0xd701('0x2e'),require(_0xd701('0x2f')));_0x343c7b[_0xd701('0x9')](_0xd701('0x30'),require(_0xd701('0x31')));_0x343c7b['use'](_0xd701('0x32'),require('./api/voiceDialReport'));_0x343c7b['use'](_0xd701('0x33'),require('./api/voiceAgentReport'));_0x343c7b[_0xd701('0x9')](_0xd701('0x34'),require(_0xd701('0x35')));_0x343c7b['use'](_0xd701('0x36'),require(_0xd701('0x37')));_0x343c7b[_0xd701('0x9')](_0xd701('0x38'),require(_0xd701('0x39')));_0x343c7b[_0xd701('0x9')]('/api/voice/transfers/reports',require(_0xd701('0x3a')));_0x343c7b[_0xd701('0x9')](_0xd701('0x3b'),require(_0xd701('0x3c')));_0x343c7b[_0xd701('0x9')](_0xd701('0x3d'),require(_0xd701('0x3e')));_0x343c7b[_0xd701('0x9')]('/api/mail/queues',require(_0xd701('0x3f')));_0x343c7b['use']('/api/mail/substatuses',require(_0xd701('0x40')));_0x343c7b[_0xd701('0x9')](_0xd701('0x41'),require(_0xd701('0x42')));_0x343c7b[_0xd701('0x9')](_0xd701('0x43'),require('./api/mailMessage'));_0x343c7b['use'](_0xd701('0x44'),require(_0xd701('0x45')));_0x343c7b['use'](_0xd701('0x46'),require(_0xd701('0x47')));_0x343c7b[_0xd701('0x9')](_0xd701('0x48'),require(_0xd701('0x49')));_0x343c7b[_0xd701('0x9')](_0xd701('0x4a'),require(_0xd701('0x4b')));_0x343c7b[_0xd701('0x9')](_0xd701('0x4c'),require('./api/faxAccount'));_0x343c7b[_0xd701('0x9')](_0xd701('0x4d'),require(_0xd701('0x4e')));_0x343c7b[_0xd701('0x9')](_0xd701('0x4f'),require(_0xd701('0x50')));_0x343c7b[_0xd701('0x9')](_0xd701('0x51'),require(_0xd701('0x52')));_0x343c7b['use'](_0xd701('0x53'),require(_0xd701('0x54')));_0x343c7b[_0xd701('0x9')](_0xd701('0x55'),require(_0xd701('0x56')));_0x343c7b[_0xd701('0x9')]('/api/sms/accounts',require('./api/smsAccount'));_0x343c7b['use'](_0xd701('0x57'),require(_0xd701('0x58')));_0x343c7b['use'](_0xd701('0x59'),require(_0xd701('0x5a')));_0x343c7b[_0xd701('0x9')](_0xd701('0x5b'),require(_0xd701('0x5c')));_0x343c7b[_0xd701('0x9')](_0xd701('0x5d'),require(_0xd701('0x5e')));_0x343c7b[_0xd701('0x9')](_0xd701('0x5f'),require(_0xd701('0x60')));_0x343c7b[_0xd701('0x9')]('/api/openchannel/applications',require(_0xd701('0x61')));_0x343c7b[_0xd701('0x9')](_0xd701('0x62'),require(_0xd701('0x63')));_0x343c7b['use']('/api/openchannel/messages',require(_0xd701('0x64')));_0x343c7b[_0xd701('0x9')](_0xd701('0x65'),require(_0xd701('0x66')));_0x343c7b[_0xd701('0x9')](_0xd701('0x67'),require(_0xd701('0x68')));_0x343c7b[_0xd701('0x9')](_0xd701('0x69'),require(_0xd701('0x6a')));_0x343c7b['use'](_0xd701('0x6b'),require(_0xd701('0x6c')));_0x343c7b[_0xd701('0x9')](_0xd701('0x6d'),require(_0xd701('0x6e')));_0x343c7b[_0xd701('0x9')](_0xd701('0x6f'),require(_0xd701('0x70')));_0x343c7b[_0xd701('0x9')](_0xd701('0x71'),require(_0xd701('0x72')));_0x343c7b['use'](_0xd701('0x73'),require(_0xd701('0x74')));_0x343c7b['use'](_0xd701('0x75'),require(_0xd701('0x76')));_0x343c7b[_0xd701('0x9')](_0xd701('0x77'),require('./api/chatProactiveAction'));_0x343c7b[_0xd701('0x9')](_0xd701('0x78'),require(_0xd701('0x79')));_0x343c7b['use'](_0xd701('0x7a'),require(_0xd701('0x7b')));_0x343c7b[_0xd701('0x9')](_0xd701('0x7c'),require(_0xd701('0x7d')));_0x343c7b['use'](_0xd701('0x7e'),require(_0xd701('0x7f')));_0x343c7b[_0xd701('0x9')](_0xd701('0x80'),require(_0xd701('0x81')));_0x343c7b[_0xd701('0x9')](_0xd701('0x82'),require('./api/cmHopperHistory'));_0x343c7b[_0xd701('0x9')](_0xd701('0x83'),require(_0xd701('0x84')));_0x343c7b[_0xd701('0x9')]('/api/actions',require(_0xd701('0x85')));_0x343c7b[_0xd701('0x9')](_0xd701('0x86'),require(_0xd701('0x87')));_0x343c7b['use']('/api/canned_answers',require(_0xd701('0x88')));_0x343c7b[_0xd701('0x9')](_0xd701('0x89'),require(_0xd701('0x8a')));_0x343c7b[_0xd701('0x9')](_0xd701('0x8b'),require(_0xd701('0x8c')));_0x343c7b[_0xd701('0x9')]('/api/intervals',require(_0xd701('0x8d')));_0x343c7b[_0xd701('0x9')]('/api/pauses',require('./api/pause'));_0x343c7b[_0xd701('0x9')]('/api/cdr',require('./api/cdr'));_0x343c7b[_0xd701('0x9')](_0xd701('0x8e'),require(_0xd701('0x8f')));_0x343c7b['use'](_0xd701('0x90'),require(_0xd701('0x91')));_0x343c7b['use']('/api/sounds',require(_0xd701('0x92')));_0x343c7b[_0xd701('0x9')](_0xd701('0x93'),require(_0xd701('0x94')));_0x343c7b[_0xd701('0x9')](_0xd701('0x95'),require(_0xd701('0x96')));_0x343c7b['use'](_0xd701('0x97'),require(_0xd701('0x98')));_0x343c7b[_0xd701('0x9')]('/api/variables',require(_0xd701('0x99')));_0x343c7b[_0xd701('0x9')](_0xd701('0x9a'),require('./api/integration'));_0x343c7b[_0xd701('0x9')](_0xd701('0x9b'),require(_0xd701('0x9c')));_0x343c7b['use']('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x343c7b[_0xd701('0x9')](_0xd701('0x9d'),require(_0xd701('0x9e')));_0x343c7b[_0xd701('0x9')]('/api/analytics/extracted_reports',require(_0xd701('0x9f')));_0x343c7b[_0xd701('0x9')]('/api/analytics/metrics',require(_0xd701('0xa0')));_0x343c7b['use'](_0xd701('0xa1'),require(_0xd701('0xa2')));_0x343c7b[_0xd701('0x9')]('/api/analytics/tree_reports',require(_0xd701('0xa3')));_0x343c7b[_0xd701('0x9')]('/api/integrations/salesforce/accounts',require(_0xd701('0xa4')));_0x343c7b[_0xd701('0x9')](_0xd701('0xa5'),require('./api/intSalesforceConfiguration'));_0x343c7b['use'](_0xd701('0xa6'),require(_0xd701('0xa7')));_0x343c7b[_0xd701('0x9')](_0xd701('0xa8'),require('./api/intSugarcrmAccount'));_0x343c7b[_0xd701('0x9')](_0xd701('0xa9'),require('./api/intSugarcrmConfiguration'));_0x343c7b[_0xd701('0x9')]('/api/integrations/sugarcrm/fields',require(_0xd701('0xaa')));_0x343c7b[_0xd701('0x9')](_0xd701('0xab'),require(_0xd701('0xac')));_0x343c7b['use'](_0xd701('0xad'),require('./api/intDeskConfiguration'));_0x343c7b[_0xd701('0x9')](_0xd701('0xae'),require(_0xd701('0xaf')));_0x343c7b[_0xd701('0x9')](_0xd701('0xb0'),require(_0xd701('0xb1')));_0x343c7b[_0xd701('0x9')]('/api/integrations/zoho/configurations',require(_0xd701('0xb2')));_0x343c7b['use'](_0xd701('0xb3'),require(_0xd701('0xb4')));_0x343c7b[_0xd701('0x9')]('/api/integrations/zendesk/accounts',require(_0xd701('0xb5')));_0x343c7b[_0xd701('0x9')](_0xd701('0xb6'),require(_0xd701('0xb7')));_0x343c7b[_0xd701('0x9')](_0xd701('0xb8'),require('./api/intZendeskField'));_0x343c7b[_0xd701('0x9')](_0xd701('0xb9'),require(_0xd701('0xba')));_0x343c7b[_0xd701('0x9')](_0xd701('0xbb'),require(_0xd701('0xbc')));_0x343c7b[_0xd701('0x9')](_0xd701('0xbd'),require(_0xd701('0xbe')));_0x343c7b[_0xd701('0x9')](_0xd701('0xbf'),require('./api/intVtigerAccount'));_0x343c7b[_0xd701('0x9')]('/api/integrations/vtiger/configurations',require(_0xd701('0xc0')));_0x343c7b['use'](_0xd701('0xc1'),require(_0xd701('0xc2')));_0x343c7b[_0xd701('0x9')](_0xd701('0xc3'),require(_0xd701('0xc4')));_0x343c7b[_0xd701('0x9')](_0xd701('0xc5'),require(_0xd701('0xc6')));_0x343c7b[_0xd701('0x9')]('/api/integrations/servicenow/fields',require(_0xd701('0xc7')));_0x343c7b['use'](_0xd701('0xc8'),require('./api/intDynamics365Account'));_0x343c7b[_0xd701('0x9')](_0xd701('0xc9'),require(_0xd701('0xca')));_0x343c7b[_0xd701('0x9')]('/api/integrations/dynamics365/fields',require(_0xd701('0xcb')));_0x343c7b['use'](_0xd701('0xcc'),require(_0xd701('0xcd')));_0x343c7b[_0xd701('0x9')](_0xd701('0xce'),require(_0xd701('0xcf')));_0x343c7b[_0xd701('0x9')](_0xd701('0xd0'),require(_0xd701('0xd1')));_0x343c7b[_0xd701('0x9')](_0xd701('0xd2'),require(_0xd701('0xd3')));_0x343c7b[_0xd701('0x9')](_0xd701('0xd4'),require('./api/chatQueueReport'));_0x343c7b[_0xd701('0x9')](_0xd701('0xd5'),require(_0xd701('0xd6')));_0x343c7b[_0xd701('0x9')](_0xd701('0xd7'),require('./api/jscriptyAnswerReport'));_0x343c7b['use'](_0xd701('0xd8'),require(_0xd701('0xd9')));_0x343c7b['use'](_0xd701('0xda'),require('./api/jscriptySessionReport'));_0x343c7b[_0xd701('0x9')](_0xd701('0xdb'),require(_0xd701('0xdc')));_0x343c7b[_0xd701('0x9')]('/api/square/reports',require(_0xd701('0xdd')));_0x343c7b[_0xd701('0x9')](_0xd701('0xde'),require(_0xd701('0xdf')));_0x343c7b[_0xd701('0x9')](_0xd701('0xe0'),require(_0xd701('0xe1')));_0x343c7b[_0xd701('0x9')]('/api/settings',require('./api/setting'));_0x343c7b[_0xd701('0x9')]('/api/square/odbc',require(_0xd701('0xe2')));_0x343c7b['use']('/api/square/projects',require(_0xd701('0xe3')));_0x343c7b[_0xd701('0x9')](_0xd701('0xe4'),require(_0xd701('0xe5')));_0x343c7b[_0xd701('0x9')](_0xd701('0xe6'),require(_0xd701('0xe7')));_0x343c7b[_0xd701('0x9')](_0xd701('0xe8'),require(_0xd701('0xe9')));_0x343c7b[_0xd701('0x9')](_0xd701('0xea'),require(_0xd701('0xeb')));_0x343c7b[_0xd701('0x9')](_0xd701('0xec'),require('./api/campaign'));_0x343c7b[_0xd701('0x9')](_0xd701('0xed'),require(_0xd701('0xee')));_0x343c7b[_0xd701('0x9')](_0xd701('0xef'),require(_0xd701('0xf0')));_0x343c7b['use'](_0xd701('0xf1'),require('./api/plugin'));_0x343c7b['use'](_0xd701('0xf2'),require(_0xd701('0xf3')));_0x343c7b[_0xd701('0x9')]('/api/chat/reports/transfer',require(_0xd701('0xf4')));_0x343c7b[_0xd701('0x9')](_0xd701('0xf5'),require(_0xd701('0xf6')));_0x343c7b[_0xd701('0x9')](_0xd701('0xf7'),require(_0xd701('0xf8')));_0x343c7b[_0xd701('0x9')](_0xd701('0xf9'),require(_0xd701('0xfa')));_0x343c7b[_0xd701('0x9')](_0xd701('0xfb'),require('./api/cmList'));_0x343c7b[_0xd701('0x9')]('/api/voice/prefixes',require(_0xd701('0xfc')));_0x343c7b['use'](_0xd701('0xfd'),require(_0xd701('0xfe')));_0x343c7b[_0xd701('0x9')]('/api/userProfile/sections',require(_0xd701('0xff')));_0x343c7b['use'](_0xd701('0x100'),require(_0xd701('0x101')));_0x343c7b[_0xd701('0x9')](_0xd701('0x102'),require(_0xd701('0x103')));_0x343c7b[_0xd701('0x9')](_0xd701('0x104'),require('./api/whatsappAccount'));_0x343c7b[_0xd701('0x9')](_0xd701('0x105'),require(_0xd701('0x106')));_0x343c7b[_0xd701('0x9')](_0xd701('0x107'),require(_0xd701('0x108')));_0x343c7b[_0xd701('0x9')](_0xd701('0x109'),require(_0xd701('0x10a')));_0x343c7b[_0xd701('0x9')](_0xd701('0x10b'),require(_0xd701('0x10c')));_0x343c7b[_0xd701('0x9')](_0xd701('0x10d'),require('./api/whatsappTransferReport'));_0x343c7b[_0xd701('0x9')](_0xd701('0x10e'),require(_0xd701('0x10f')));_0x343c7b[_0xd701('0x9')](_0xd701('0x110'),require('./api/cloudProvider'));_0x343c7b[_0xd701('0x9')](_0xd701('0x111'),require('./api/authLocal'));_0x343c7b[_0xd701('0x9')](_0xd701('0x112'),require(_0xd701('0x113')));_0x343c7b[_0xd701('0x9')](_0xd701('0x114'),require(_0xd701('0x115')));_0x343c7b[_0xd701('0x9')]('/api/rpc',require(_0xd701('0x116')));_0x343c7b[_0xd701('0x9')]('/api/version',require(_0xd701('0x117')));_0x343c7b[_0xd701('0x9')]('/api/system',require(_0xd701('0x118')));_0x343c7b[_0xd701('0x9')](_0xd701('0x119'),require('./api/pm2'));_0x343c7b['use'](_0xd701('0x11a'),require(_0xd701('0x11b')));_0x343c7b['use'](_0xd701('0x11c'),express['static'](path['join'](config[_0xd701('0x11d')],_0xd701('0x11c'))));_0x343c7b[_0xd701('0x9')](_0xd701('0x11e'),express[_0xd701('0x11f')](path[_0xd701('0x120')](config[_0xd701('0x11d')],_0xd701('0x11e'))));_0x343c7b[_0xd701('0x9')](_0xd701('0x121'),express[_0xd701('0x11f')](path[_0xd701('0x120')](config[_0xd701('0x11d')],_0xd701('0x121'))));_0x343c7b[_0xd701('0x9')]('/snippet',express['static'](path[_0xd701('0x120')](config[_0xd701('0x11d')],'snippet',_0xd701('0x122'))));_0x343c7b[_0xd701('0x9')]('/plugins',express[_0xd701('0x11f')](path[_0xd701('0x120')](config['root'],_0xd701('0x123'))));_0x343c7b['route'](_0xd701('0x124'))['get'](errors[0x194]);_0x343c7b[_0xd701('0x125')]('/*')[_0xd701('0x126')](function(_0x2f4419,_0x385633){_0x385633['sendFile'](path[_0xd701('0x127')](_0x343c7b[_0xd701('0x126')]('appPath')+_0xd701('0x128')));});};var sensitiveFields=['username','password',_0xd701('0x129'),_0xd701('0x12a'),_0xd701('0x12b'),'lastName',_0xd701('0x12c'),'phone',_0xd701('0x12d'),_0xd701('0x12e'),'email','clientId',_0xd701('0x12f'),_0xd701('0x130'),_0xd701('0x131'),'accessKey','tenantId',_0xd701('0x132'),_0xd701('0x133'),'accessToken','accessTokenSecret','authToken',_0xd701('0x134'),_0xd701('0x135'),_0xd701('0x136'),_0xd701('0x137'),_0xd701('0x138'),_0xd701('0x139'),_0xd701('0x13a'),_0xd701('0x13b'),'privateKey',_0xd701('0x13c'),'secretaccesskey',_0xd701('0x13d'),_0xd701('0x13'),_0xd701('0x13e'),'accountSid',_0xd701('0x13f'),'dsn',_0xd701('0x140'),'registry','oldPassword'];function maskSensitiveData(_0x32a450){var _0x137f32=/(?!^)[\s\S](?!$)/g;if(!_[_0xd701('0x141')](_0x32a450))return;for(var _0x1809e4 in _0x32a450){if(_['isArray'](_0x32a450[_0x1809e4])){for(var _0x48a69d=0x0;_0x48a69d<_0x32a450[_0x1809e4]['length'];_0x48a69d++){maskSensitiveData(_0x32a450[_0x1809e4][_0x48a69d]);}}else if(_[_0xd701('0x141')](_0x32a450[_0x1809e4])){maskSensitiveData(_0x32a450[_0x1809e4]);}else if(_[_0xd701('0x142')](_0x32a450[_0x1809e4])){_0x32a450[_0x1809e4]=_0x32a450[_0x1809e4]['replace'](/{{{/g,_0xd701('0x143'))[_0xd701('0x144')](/}}}/g,_0xd701('0x145'))[_0xd701('0x144')](/{{/g,'@{')[_0xd701('0x144')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1809e4)){_0x32a450[_0x1809e4]=_0x32a450[_0x1809e4]['replace'](_0x137f32,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index ccd980d..f6d0ec2 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdff1=['../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc'];(function(_0x69d003,_0x391e32){var _0x55aec7=function(_0x305eab){while(--_0x305eab){_0x69d003['push'](_0x69d003['shift']());}};_0x55aec7(++_0x391e32);}(_0xdff1,0x136));var _0x1dff=function(_0x3fcb6e,_0x2ee7af){_0x3fcb6e=_0x3fcb6e-0x0;var _0x21011c=_0xdff1[_0x3fcb6e];return _0x21011c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x1dff('0x0'));var _=require(_0x1dff('0x1'));var config=require('../config/environment');exports[_0x1dff('0x2')]=function(){return new BPromise(function(_0x399dec,_0x590e2c){var _0x1e3888={};_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x4')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x5')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x6')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x7')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x8')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x9')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0xa')));_0x1e3888=_['merge'](_0x1e3888,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0xb')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0xc')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0xd')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0xe')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/mailServerIn/mailServerIn.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/mailAccount/mailAccount.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/mailQueue/mailQueue.rpc'));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0xf')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x10')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/mailApplication/mailApplication.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x11')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/faxAccount/faxAccount.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/faxApplication/faxApplication.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x12')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x13')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x14')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x15')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/smsAccount/smsAccount.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/smsInteraction/smsInteraction.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x16')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x17')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x18')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x19')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x1a')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x1b')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x1c')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x1d')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x1e')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x1f')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x20')));_0x1e3888=_['merge'](_0x1e3888,require('../api/cmHopper/cmHopper.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x21')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x22')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x23')));_0x1e3888=_['merge'](_0x1e3888,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x24')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x25')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x26')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x27')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x28')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/variable/variable.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x29')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x2a')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x2b')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x2c')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x2d')));_0x1e3888=_['merge'](_0x1e3888,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x2e')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x2f')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x30')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x31')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x32')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x33')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x34')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x35')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x36')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x37')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/squareRecording/squareRecording.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x38')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x39')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x3a')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/plugin/plugin.rpc'));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x3b')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require(_0x1dff('0x3c')));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x3d')));_0x1e3888=_[_0x1dff('0x3')](_0x1e3888,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1e3888=_['merge'](_0x1e3888,require(_0x1dff('0x3e')));var _0x4587bc=jayson['server'](_0x1e3888)['http']();var _0x3a8878=config[_0x1dff('0x3f')]['port']||config[_0x1dff('0x40')]+0x1;var _0x1ab73b=config['rpc']['ip']||_0x1dff('0x41');_0x4587bc['on']('error',function(_0x10437c){return _0x590e2c(_0x10437c);});_0x4587bc['listen'](_0x3a8878,_0x1ab73b,function(){console['log'](_0x1dff('0x42'),_0x1ab73b,_0x3a8878);require(_0x1dff('0x43'))[_0x1dff('0x44')]();return _0x399dec(_0x1dff('0x45')+_0x1ab73b+':'+_0x3a8878);});});}; \ No newline at end of file +var _0x120e=['error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.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','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost'];(function(_0x391f3b,_0x376078){var _0x524b23=function(_0x375d7a){while(--_0x375d7a){_0x391f3b['push'](_0x391f3b['shift']());}};_0x524b23(++_0x376078);}(_0x120e,0x116));var _0xe120=function(_0x4c3405,_0x2dc7cc){_0x4c3405=_0x4c3405-0x0;var _0x9705=_0x120e[_0x4c3405];return _0x9705;};'use strict';var jayson=require(_0xe120('0x0'));var BPromise=require('bluebird');var _=require(_0xe120('0x1'));var config=require(_0xe120('0x2'));exports[_0xe120('0x3')]=function(){return new BPromise(function(_0xf8a920,_0x2aaaa5){var _0xda817e={};_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x5')));_0xda817e=_['merge'](_0xda817e,require('../api/voiceExtension/voiceExtension.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/voiceQueue/voiceQueue.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/voiceRecording/voiceRecording.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x6')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x7')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x8')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x9')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0xa')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0xb')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0xc')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0xd')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/mailServerIn/mailServerIn.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0xe')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/mailQueue/mailQueue.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0xf')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x10')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x11')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x12')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/faxAccount/faxAccount.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/faxApplication/faxApplication.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x13')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x14')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/faxQueue/faxQueue.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x15')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x16')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x17')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x18')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x19')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x1a')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x1b')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x1c')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x1d')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x1e')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x1f')));_0xda817e=_['merge'](_0xda817e,require('../api/chatQueue/chatQueue.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x20')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/cmHopper/cmHopper.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x21')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x22')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x23')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x24')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x25')));_0xda817e=_['merge'](_0xda817e,require('../api/sound/sound.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x26')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x27')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x28')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x29')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x2a')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/intZohoAccount/intZohoAccount.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0xda817e=_['merge'](_0xda817e,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x2b')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x2c')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x2d')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x2e')));_0xda817e=_['merge'](_0xda817e,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/squareReport/squareReport.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x2f')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/squareOdbc/squareOdbc.rpc'));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x30')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x31')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require('../api/squareMessage/squareMessage.rpc'));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x32')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x33')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x34')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x35')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x36')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x37')));_0xda817e=_['merge'](_0xda817e,require(_0xe120('0x38')));_0xda817e=_[_0xe120('0x4')](_0xda817e,require(_0xe120('0x39')));var _0x2f4793=jayson['server'](_0xda817e)[_0xe120('0x3a')]();var _0x1e7f99=config[_0xe120('0x3b')][_0xe120('0x3c')]||config[_0xe120('0x3c')]+0x1;var _0xfa4ca2=config[_0xe120('0x3b')]['ip']||_0xe120('0x3d');_0x2f4793['on'](_0xe120('0x3e'),function(_0x51e4e9){return _0x2aaaa5(_0x51e4e9);});_0x2f4793[_0xe120('0x3')](_0x1e7f99,_0xfa4ca2,function(){console[_0xe120('0x3f')](_0xe120('0x40'),_0xfa4ca2,_0x1e7f99);require(_0xe120('0x41'))[_0xe120('0x42')]();return _0xf8a920(_0xe120('0x43')+_0xfa4ca2+':'+_0x1e7f99);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b47201c..b8e8a4a 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 _0xcb91=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','sendRequest','sync','prototype','answer','getData','beep','format'];(function(_0x531e48,_0x4bb96b){var _0x202971=function(_0x403bf5){while(--_0x403bf5){_0x531e48['push'](_0x531e48['shift']());}};_0x202971(++_0x4bb96b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0xcb91[_0x144b30];return _0x1bb7bc;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1cb9('0x0'))[_0x1cb9('0x1')];var AGIReply=require(_0x1cb9('0x2'));var AGIError=require(_0x1cb9('0x3'));function AGIChannel(_0x4c37e8){var _0x8c392f=this,_0x2c17b8=new AGIReply(),_0x545a34=![],_0x13d5fd={};EventEmitter[_0x1cb9('0x4')](_0x8c392f);_0x4c37e8['setEncoding'](_0x1cb9('0x5'));_0x4c37e8[_0x1cb9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2c17b8['setEncoding'](_0x1cb9('0x5'));_0x2c17b8['on'](_0x1cb9('0x7'),function(_0x59d1be){for(var _0x3ae0f1 in _0x59d1be){_0x8c392f[_0x3ae0f1]=_0x59d1be[_0x3ae0f1];}_0x8c392f['emit']('ready');});_0x2c17b8['on'](_0x1cb9('0x8'),function(_0x2fa15c){if(_0x2fa15c[_0x1cb9('0x9')]()==_0x1cb9('0xa')){_0x8c392f[_0x1cb9('0xb')]('hangup');return;}if(_0x2fa15c[_0x1cb9('0xc')](0x0,0xb)==_0x1cb9('0xd')){_0x545a34=!![];}if(_0x545a34){_0x13d5fd['rx']+=_0x2fa15c+'\x0a';if(_0x2fa15c[_0x1cb9('0xe')](_0x1cb9('0xf'))!=-0x1){_0x545a34=![];}}else{_0x13d5fd['rx']=_0x2fa15c;}if(_0x545a34){return;}if(typeof _0x13d5fd['cb']==_0x1cb9('0x10')){var _0x5445e1=_0x13d5fd['rx'][_0x1cb9('0xc')](0x0,0x3),_0x5e3c19=null,_0x59dec3=null;_0x5445e1=parseInt(_0x5445e1);if(isNaN(_0x5445e1)){_0x13d5fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cb9('0x11')});return;}if(_0x5445e1!=0xc8){_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':-0x1,'extra':'KO'});return;}_0x5e3c19=_0x13d5fd['rx'][_0x1cb9('0xc')](0x4)[_0x1cb9('0x12')]('result=','');if(_0x5e3c19[_0x1cb9('0x13')]('\x20')!=-0x1){_0x5e3c19=_0x5e3c19[_0x1cb9('0x14')](0x0,_0x5e3c19[_0x1cb9('0x13')]('\x20'));}if(_[_0x1cb9('0x15')](_0x5e3c19,'-1')){_0x5e3c19=parseInt(_0x5e3c19);}_0x59dec3=_0x13d5fd['rx'][_0x1cb9('0x16')]('\x20');if(_0x59dec3['length']==0x3){_0x59dec3=_0x59dec3[0x2]['substring'](0x1,_0x59dec3[0x2][_0x1cb9('0x17')]-0x1);}else if(_0x59dec3[_0x1cb9('0x17')]>0x3){var _0x3904b7=/\((.+)\)/;var _0x3f1376=_0x13d5fd['rx'][_0x1cb9('0x18')](_0x3904b7);if(_0x3f1376){_0x59dec3=_0x3f1376[0x1];}else{_0x59dec3=null;}}else{_0x59dec3=null;}_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':_0x5e3c19,'extra':_0x59dec3});}});_0x4c37e8['on'](_0x1cb9('0x19'),function(_0x23d3a9){_0x8c392f['emit']('error',new AGIError(_0x1cb9('0x1a'),_0x23d3a9[_0x1cb9('0x1b')]));});_0x4c37e8['on'](_0x1cb9('0x1c'),function(){_0x8c392f[_0x1cb9('0xb')](_0x1cb9('0x1c'),new AGIError(_0x1cb9('0x1d')));});_0x4c37e8['on'](_0x1cb9('0x1e'),function(){_0x8c392f['emit']('timeout',new AGIError(_0x1cb9('0x1f')));_0x4c37e8['destroy']();});_0x4c37e8[_0x1cb9('0x20')](_0x2c17b8);this[_0x1cb9('0x21')]=function(_0x523b26,_0x599275){var _0x523b26=_0x523b26||'',_0x599275=typeof _0x599275==_0x1cb9('0x10')?_0x599275:new Function();_0x13d5fd={'tx':_0x523b26,'rx':'','cb':_0x599275};_0x4c37e8[_0x1cb9('0x22')](_0x523b26+'\x0a');},this[_0x1cb9('0x1c')]=function(){_0x4c37e8[_0x1cb9('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1cb9('0x24')]=function(_0x557199){return this[_0x1cb9('0x21')][_0x1cb9('0x25')](this,_0x557199);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x27')]=function(){return this[_0x1cb9('0x24')]('ANSWER');};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x28')]=function(_0x4c8d76,_0xd6891c,_0x21effa){_0x4c8d76=_0x4c8d76===undefined?_0x1cb9('0x29'):_0x4c8d76;_0xd6891c=_0xd6891c===undefined?'5':_0xd6891c;_0x21effa=_0x21effa===undefined?'1':_0x21effa;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x4c8d76,_0xd6891c*0x3e8,_0x21effa));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x2c')]=function(_0x41e5c2){_0x41e5c2=_0x41e5c2||_0x1cb9('0x2d');return this['sendRequest'](util[_0x1cb9('0x2a')]('VERBOSE\x20\x22%s\x22',_0x41e5c2));};AGIChannel[_0x1cb9('0x26')]['exec']=function(_0x278327,_0x41011c){if(_[_0x1cb9('0x2e')](_0x41011c)){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x2f'),_0x278327,_0x41011c['join'](',')));}return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2f'),_0x278327,_0x41011c));};AGIChannel['prototype'][_0x1cb9('0x30')]=function(_0x5e84fd){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x31'),_0x5e84fd));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x32')]=function(_0xae910){return this['sendRequest'](util[_0x1cb9('0x2a')](_0x1cb9('0x33'),_0xae910));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x34')]=function(_0xc6784c){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x35'),_0xc6784c));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0xa')]=function(){return this[_0x1cb9('0x24')](_0x1cb9('0x36'));};AGIChannel[_0x1cb9('0x26')]['setVariable']=function(_0x54c6e6,_0x299ff8){var _0x30f7e4=_[_0x1cb9('0x37')](_0x299ff8)||_[_0x1cb9('0x38')](_0x299ff8)?_0x299ff8[_0x1cb9('0x39')]():_0x299ff8;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3a'),_0x54c6e6,_0x30f7e4?_0x30f7e4['toString']()[_0x1cb9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3b')]=function(_0x5350f9,_0x2a5aac){return this['sendRequest'](util[_0x1cb9('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5350f9,_0x2a5aac));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3c')]=function(_0x289b73,_0x2bcacd){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3d'),_0x289b73,_0x2bcacd));};AGIChannel['prototype']['sayPhonetic']=function(_0x4111b8,_0x1d2723){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3e'),_0x4111b8,_0x1d2723));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3f')]=function(_0x4a670c,_0xbcaa32,_0x47edad){_0xbcaa32=_0xbcaa32||this['extension'];_0x47edad=_0x47edad||0x1;this['setContext'](_0x4a670c);this[_0x1cb9('0x32')](_0xbcaa32);this[_0x1cb9('0x34')](_0x47edad);return this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x40'),_0x4a670c,_0xbcaa32,_0x47edad));};AGIChannel['prototype'][_0x1cb9('0x41')]=function(_0x523866){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x42'),_0x523866));};AGIChannel['prototype'][_0x1cb9('0x43')]=function(_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x5839aa,_0x24c643){_0xda1a44=_0xda1a44||_0x1cb9('0x44');_0xbc36fc=_0xbc36fc||'';_0x51a898=_0x51a898===undefined?-0x1:_0x51a898==='-1'?-0x1:_0x51a898*0x3e8;_0x5839aa=_0x5839aa===undefined?'':'s='+_0x5839aa;_0x24c643=_0x24c643?_0x1cb9('0x45'):'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x24c643,_0x5839aa));};AGIChannel[_0x1cb9('0x26')]['streamFile']=function(_0x4c59e7,_0x495335){_0x495335=_0x495335||'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x46'),_0x4c59e7,_0x495335));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x47')]=function(_0x2a8b7f){return this[_0x1cb9('0x48')](_0x1cb9('0x49'),_0x2a8b7f);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x4a')]=function(_0x3ea88c){return this['exec'](_0x1cb9('0x4b'),_0x3ea88c);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x19')]=function(_0x55255c,_0x179e81){this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x4c'),_0x55255c['id'],_0x55255c[_0x1cb9('0x4d')],_0x179e81));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x129a5d,_0x374fbe){var _0x142fe5=function(_0x3ff24d){while(--_0x3ff24d){_0x129a5d['push'](_0x129a5d['shift']());}};_0x142fe5(++_0x374fbe);}(_0x70e0,0x17b));var _0x070e=function(_0x316871,_0x5dc8df){_0x316871=_0x316871-0x0;var _0xf53f23=_0x70e0[_0x316871];return _0xf53f23;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 71ffc3c..850c434 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 _0x63a9=['util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','name','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x63a9,0xff));var _0x963a=function(_0x2b1491,_0x49658c){_0x2b1491=_0x2b1491-0x0;var _0x85b954=_0x63a9[_0x2b1491];return _0x85b954;};'use strict';var util=require(_0x963a('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x963a('0x1'),'E_AGI_SERVER_CLOSE':_0x963a('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x963a('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x963a('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x963a('0x5'),'E_AGI_COMMAND_EMPTY':_0x963a('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x963a('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5094a0){var _0x5094a0=_0x5094a0||null,_0x26caa7=_0x26caa7||[],_0x4a742c=0x1,_0xcc6ecd='';if(!error[_0x5094a0]){_0x5094a0=_0x963a('0x8');}_0x26caa7['push'](error[_0x5094a0]);while(arguments[_0x4a742c]){_0x26caa7[_0x963a('0x9')](arguments[_0x4a742c]);_0x4a742c++;}_0xcc6ecd=util[_0x963a('0xa')][_0x963a('0xb')](util,_0x26caa7);this[_0x963a('0xc')]=_0xcc6ecd;this[_0x963a('0xd')]=_0x5094a0;}module[_0x963a('0xe')]=AGIError; \ No newline at end of file +var _0xd73a=['exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message'];(function(_0x196257,_0x256195){var _0x30d5c7=function(_0x100531){while(--_0x100531){_0x196257['push'](_0x196257['shift']());}};_0x30d5c7(++_0x256195);}(_0xd73a,0x171));var _0xad73=function(_0x4dbe30,_0x8172db){_0x4dbe30=_0x4dbe30-0x0;var _0x2a9a44=_0xd73a[_0x4dbe30];return _0x2a9a44;};'use strict';var util=require(_0xad73('0x0'));var error={'E_AGI_UNDEFINED':_0xad73('0x1'),'E_AGI_ARGUMENT_PORT':_0xad73('0x2'),'E_AGI_SERVER_ERROR':_0xad73('0x3'),'E_AGI_SERVER_CLOSE':_0xad73('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xad73('0x5'),'E_AGI_SOCKET_CLOSE':_0xad73('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xad73('0x7'),'E_AGI_COMMAND_EMPTY':_0xad73('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xad73('0x9'),'E_AGI_IVR_ENTRY':_0xad73('0xa')};function AGIError(_0x247d3c){var _0x247d3c=_0x247d3c||null,_0x24d620=_0x24d620||[],_0x15cf28=0x1,_0x1352b3='';if(!error[_0x247d3c]){_0x247d3c='E_AGI_UNDEFINED';}_0x24d620[_0xad73('0xb')](error[_0x247d3c]);while(arguments[_0x15cf28]){_0x24d620['push'](arguments[_0x15cf28]);_0x15cf28++;}_0x1352b3=util[_0xad73('0xc')][_0xad73('0xd')](util,_0x24d620);this[_0xad73('0xe')]=_0x1352b3;this['name']=_0x247d3c;}module[_0xad73('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a2442bb..7b1a7b7 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 _0x4213=['default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','addVertex','edges','addEdge','size','prototype','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','invalid'];(function(_0x3eeca9,_0x57d14b){var _0x2c8cdb=function(_0x4ac724){while(--_0x4ac724){_0x3eeca9['push'](_0x3eeca9['shift']());}};_0x2c8cdb(++_0x57d14b);}(_0x4213,0x77));var _0x3421=function(_0x4ef956,_0x35ef25){_0x4ef956=_0x4ef956-0x0;var _0x3b1e75=_0x4213[_0x4ef956];return _0x3b1e75;};'use strict';var _=require(_0x3421('0x0'));var logger=require(_0x3421('0x1'))(_0x3421('0x2'));var verticesWithRetry=[_0x3421('0x3'),_0x3421('0x4'),_0x3421('0x5')];var Graph=function(){this[_0x3421('0x6')]={};this['edges']={};this[_0x3421('0x7')]=0x0;};Graph['prototype'][_0x3421('0x8')]=function(_0xfe969c){this[_0x3421('0x6')][_0xfe969c['id']]=_0xfe969c;this[_0x3421('0x9')][_0xfe969c['id']]=[];};Graph['prototype'][_0x3421('0xa')]=function(_0x1b152f,_0x130625,_0x1cf6a0){this[_0x3421('0x9')][_0x1b152f]['push']({'target':_0x130625,'condition':_0x1cf6a0});this[_0x3421('0x7')]+=0x1;};Graph['prototype']['size']=function(){return _[_0x3421('0xb')](this['vertices']);};Graph[_0x3421('0xc')][_0x3421('0xd')]=function(){return this[_0x3421('0x7')];};Graph[_0x3421('0xc')][_0x3421('0xe')]=function(_0x55c317){return this[_0x3421('0x6')][_0x55c317];};Graph['prototype'][_0x3421('0xf')]=function(_0x3e2ecd,_0xb4ea90){if(!this[_0x3421('0x6')][_0x3e2ecd]){return logger[_0x3421('0x10')](_0x3421('0x11'));}var _0x25ffd4=_0xb4ea90(this['vertices'][_0x3e2ecd]);if(!_0x25ffd4){return logger[_0x3421('0x10')]('stop\x20traverse');}if(this[_0x3421('0x9')][_0x3e2ecd][_0x3421('0x12')]===0x0){return logger['info'](_0x3421('0x13'));}for(var _0x4c6f7b=0x0,_0x16bc8f=[],_0x23694b=![];_0x4c6f7b\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','addEdge','value','getSquareProject','then','catch','indexOf','agi_','debug','variables','stringify','close','timeout','evtHangup','hangup','sync','production','start','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','response','result','isUndefined','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','toString','[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','priority','continueAt','Project\x20%s\x20not\x20published'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x950a,0x111));var _0xa950=function(_0x1fcd1c,_0x31ccf7){_0x1fcd1c=_0x1fcd1c-0x0;var _0x3b158a=_0x950a[_0x1fcd1c];return _0x3b158a;};'use strict';var parser=require(_0xa950('0x0'));var _=require(_0xa950('0x1'));var syncho=require(_0xa950('0x2'));var util=require(_0xa950('0x3'));var moment=require('moment');var config=require(_0xa950('0x4'));var logger=require(_0xa950('0x5'))(_0xa950('0x6'));var utilLicense=require(_0xa950('0x7'));var rpc=require('./rpc');var mailRpc=require(_0xa950('0x8'));var Graph=require(_0xa950('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xa950('0x6')]=_[_0xa950('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x26e05c){process[_0xa950('0xb')](function(){syncho(function(){try{setChannelVariables(_0x26e05c);agiHandler(_0x26e05c);}catch(_0x7d87b2){logger[_0xa950('0xc')](_0x7d87b2[_0xa950('0xd')]);}});});}function listeningHandler(){console[_0xa950('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger[_0xa950('0xf')](util['format'](_0xa950('0x10'),config[_0xa950('0x6')]['ip'],config[_0xa950('0x6')]['port']));}function errorHandler(_0xc7e9bd){if(_0xc7e9bd&&_0xc7e9bd['name']&&_0xc7e9bd[_0xa950('0x11')]){logger[_0xa950('0xc')](util[_0xa950('0x12')]('[%s]\x20%s',_0xc7e9bd[_0xa950('0x13')],_0xc7e9bd[_0xa950('0x11')]));}else{logger[_0xa950('0xc')](util['format'](_0xa950('0x14'),_0xc7e9bd[_0xa950('0xd')]));}}function closeHandler(){logger[_0xa950('0xf')](util['format'](_0xa950('0x15'),this[_0xa950('0x16')],this[_0xa950('0x17')],this['callerid'],this[_0xa950('0x18')],this[_0xa950('0x19')]));try{createSquareReport(this);}catch(_0x162586){logger[_0xa950('0xc')](_0x162586[_0xa950('0xd')]);}}function timeoutHandler(){logger[_0xa950('0xf')](util[_0xa950('0x12')](_0xa950('0x1a'),this[_0xa950('0x16')],this[_0xa950('0x17')],this[_0xa950('0x1b')],this[_0xa950('0x18')],this[_0xa950('0x19')]));}function hangupHandler(){logger['info'](util[_0xa950('0x12')](_0xa950('0x1c'),this['arg_1'],this[_0xa950('0x17')],this[_0xa950('0x1b')],this['dnid'],this[_0xa950('0x19')]));this['evtHangup']=!![];}function getRoot(_0x2eda79){return parser[_0xa950('0x1d')](_0x2eda79,{'object':!![]})[_0xa950('0x1e')][_0xa950('0x1f')];}function addVertex(_0x5617cd,_0x11b8af,_0x3f4633){_0x11b8af[_0xa950('0x20')]=_0x3f4633;if(_0x11b8af[_0xa950('0x21')](_0xa950('0x22'))){_0x11b8af[_0xa950('0x23')]=parseInt(_0x11b8af[_0xa950('0x22')],0xa);}_0x5617cd[_0xa950('0x24')](_[_0xa950('0x25')](_0x11b8af,_0xa950('0x26')));}function initGraph(_0x3c8c98,_0x26f366){var _0x43f8c8=new Graph();for(var _0x5d82d8 in _0x3c8c98){if(_0x3c8c98[_0xa950('0x21')](_0x5d82d8)){if(_[_0xa950('0x27')](_0x3c8c98[_0x5d82d8])){for(var _0x3f37f8=0x0;_0x3f37f8<_0x3c8c98[_0x5d82d8][_0xa950('0x28')];_0x3f37f8+=0x1){addVertex(_0x43f8c8,_0x3c8c98[_0x5d82d8][_0x3f37f8],_0x5d82d8);}}else{addVertex(_0x43f8c8,_0x3c8c98[_0x5d82d8],_0x5d82d8);}}}for(var _0x31c168=0x0;_0x31c168<_0x26f366[_0xa950('0x28')];_0x31c168+=0x1){if(_0x26f366[_0x31c168][_0xa950('0x29')]&&_0x26f366[_0x31c168]['target']){_0x43f8c8[_0xa950('0x2a')](_0x26f366[_0x31c168][_0xa950('0x29')],_0x26f366[_0x31c168]['target'],_0x26f366[_0x31c168][_0xa950('0x2b')]);}}return _0x43f8c8;}function getSquareProject(_0x2e7674,_0x3e5915){rpc[_0xa950('0x2c')](_0x2e7674)[_0xa950('0x2d')](function(_0x1945ca){_0x3e5915(null,_0x1945ca);})[_0xa950('0x2e')](function(_0x2d0c59){_0x3e5915(null,_0x2d0c59);});}function createSquareReport(_0x203703,_0x3c6ea8){rpc['createSquareReport'](_0x203703)[_0xa950('0x2d')](function(_0x4d3a2d){if(_0x3c6ea8){_0x3c6ea8(null,_0x4d3a2d);}})['catch'](function(_0x26ee82){if(_0x3c6ea8){_0x3c6ea8(null,_0x26ee82);}});}function setChannelVariables(_0x5db455){for(var _0x118d96 in _0x5db455){if(_0x5db455[_0xa950('0x21')](_0x118d96)){if(_0x118d96[_0xa950('0x2f')](_0xa950('0x30'))===0x0){_0x5db455[_0x118d96['substring'](0x4)]=_0x5db455[_0x118d96];delete _0x5db455[_0x118d96];}}}}function getLogFromObject(_0x107e08){return util['inspect'](_0x107e08,{'showHidden':![],'depth':null});}function agiHandler(_0x45846c){var _0x2306f8,_0x5676ad,_0x4c3e3c,_0x44c1a9,_0x1ccbed;logger[_0xa950('0x31')](_0xa950('0x32'),JSON[_0xa950('0x33')](_0x45846c,null,0x2));logger[_0xa950('0xf')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x45846c[_0xa950('0x16')],_0x45846c['calleridname'],_0x45846c[_0xa950('0x1b')],_0x45846c[_0xa950('0x18')],_0x45846c[_0xa950('0x19')]));_0x45846c['on'](_0xa950('0xc'),errorHandler);_0x45846c['on'](_0xa950('0x34'),closeHandler);_0x45846c['on'](_0xa950('0x35'),timeoutHandler);_0x45846c[_0xa950('0x36')]=![];_0x45846c['on'](_0xa950('0x37'),hangupHandler);var _0x1ba2fd=getSquareProject[_0xa950('0x38')](null,_0x45846c['arg_1']);if(_0x1ba2fd){if(_0x1ba2fd[_0xa950('0x39')]){_0x2306f8=getRoot(_0x1ba2fd['production']);if(_0x2306f8&&_0x2306f8[_0xa950('0x3a')]){logger[_0xa950('0x31')]('root',JSON['stringify'](_0x2306f8,null,0x2));_0x45846c[_0xa950('0x3b')]=moment()[_0xa950('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x5676ad=initGraph(_[_0xa950('0x25')](_0x2306f8,_0xa950('0x26')),_0x2306f8['mxCell']);_0x4c3e3c=new Vertices(_0x45846c,rpc,mailRpc);logger[_0xa950('0xf')](util[_0xa950('0x12')](_0xa950('0x3c'),_0x45846c[_0xa950('0x16')],_0x45846c[_0xa950('0x17')],_0x45846c[_0xa950('0x1b')],_0x45846c[_0xa950('0x18')],_0x45846c[_0xa950('0x19')]));_0x5676ad['traverseBFS'](_0x2306f8[_0xa950('0x3a')]['id'],function(_0x1764b2){try{_0x1764b2=_0x4c3e3c['clear'](_0x1764b2);logger[_0xa950('0x31')](_0xa950('0x3d'),JSON[_0xa950('0x33')](_0x1764b2,null,0x2));if(_0x1764b2['agicommand']===_0xa950('0x3e')){logger[_0xa950('0xf')](_0xa950('0x3f'));_0x45846c['context']=_0x1764b2['context']||_0x45846c[_0xa950('0x40')];_0x45846c[_0xa950('0x41')]=_0x1764b2[_0xa950('0x41')];_0x45846c['priority']=_0x1764b2['priority']?_0x1764b2['priority']-0x1:0x1;return null;}else if(_0x1764b2&&_0x4c3e3c[_0x1764b2[_0xa950('0x20')]]){_0x1ccbed=_0x4c3e3c[_0x1764b2[_0xa950('0x20')]](_0x1764b2);logger[_0xa950('0xf')](_0xa950('0x42'),JSON[_0xa950('0x33')](_0x1ccbed,null,0x2));if(_0x1ccbed&&_0x1ccbed['code']===AGI_CODE_SUCCESS&&_0x1ccbed[_0xa950('0x43')]!==AGI_RESULT_ERROR&&!_0x45846c[_0xa950('0x36')]){logger['debug']('response',getLogFromObject(_0x1ccbed));return _[_0xa950('0x44')](_0x1ccbed[_0xa950('0x43')])?null:_0x1ccbed['result']['toString']();}else{logger['error']('response',getLogFromObject(_0x1ccbed));return null;}}else{logger[_0xa950('0xc')](_0xa950('0x45'));return null;}}catch(_0x5ae175){logger['error'](_0x5ae175[_0xa950('0xd')]);return null;}});if(_0x2306f8['finally']){logger[_0xa950('0xf')](util[_0xa950('0x12')](_0xa950('0x46'),_0x45846c[_0xa950('0x16')],_0x45846c[_0xa950('0x17')],_0x45846c[_0xa950('0x1b')],_0x45846c[_0xa950('0x18')],_0x45846c[_0xa950('0x19')]));_0x5676ad['traverseBFS'](_0x2306f8[_0xa950('0x47')]['id'],function(_0x4ede77){try{_0x4ede77=_0x4c3e3c[_0xa950('0x48')](_0x4ede77);logger[_0xa950('0x31')](_0xa950('0x3d'),JSON[_0xa950('0x33')](_0x4ede77,null,0x2));if(_0x4ede77&&_0x4c3e3c[_0x4ede77[_0xa950('0x20')]]){_0x1ccbed=_0x4c3e3c[_0x4ede77[_0xa950('0x20')]](_0x4ede77);if(_0x1ccbed){logger[_0xa950('0x31')](_0xa950('0x42'),getLogFromObject(_0x1ccbed));return _[_0xa950('0x44')](_0x1ccbed['result'])?null:_0x1ccbed[_0xa950('0x43')][_0xa950('0x49')]();}else{logger[_0xa950('0xc')](_0xa950('0x42'),getLogFromObject(_0x1ccbed));return null;}}else{logger[_0xa950('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x237152){logger[_0xa950('0xc')](_0x237152[_0xa950('0xd')]);return null;}});}logger[_0xa950('0xf')](util[_0xa950('0x12')](_0xa950('0x4a'),_0x45846c[_0xa950('0x16')],_0x45846c['calleridname'],_0x45846c[_0xa950('0x1b')],_0x45846c[_0xa950('0x18')],_0x45846c[_0xa950('0x19')]));logger['info'](util['format'](_0xa950('0x4b'),_0x45846c[_0xa950('0x40')],_0x45846c[_0xa950('0x41')],parseInt(_0x45846c[_0xa950('0x4c')],0xa)+0x1));_0x45846c[_0xa950('0x4d')](_0x45846c[_0xa950('0x40')],_0x45846c[_0xa950('0x41')],parseInt(_0x45846c[_0xa950('0x4c')],0xa)+0x1);_0x45846c['close']();}}else{logger[_0xa950('0xc')](util[_0xa950('0x12')](_0xa950('0x4e'),_0x45846c[_0xa950('0x16')]));_0x45846c[_0xa950('0x4d')](_0x45846c['context'],_0x45846c[_0xa950('0x41')],parseInt(_0x45846c['priority'],0xa)+0x1);_0x45846c[_0xa950('0x34')]();}}else{logger[_0xa950('0xc')](util[_0xa950('0x12')](_0xa950('0x4f'),_0x45846c[_0xa950('0x16')]));_0x45846c[_0xa950('0x4d')](_0x45846c['context'],_0x45846c['extension'],parseInt(_0x45846c['priority'],0xa)+0x1);_0x45846c[_0xa950('0x34')]();}}function main(){var _0x18dcd2;return utilLicense[_0xa950('0x50')]()[_0xa950('0x2d')](function(_0x447459){if(_0x447459){if(_0x447459[_0xa950('0x51')]){if(_0x447459[_0xa950('0x52')]&&_0x447459[_0xa950('0x52')]>0x0){logger['info'](util[_0xa950('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x447459[_0xa950('0x52')]));_0x18dcd2=_0x447459['callysquare'];}else{logger[_0xa950('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xa950('0xf')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x18dcd2=-0x1;}}})[_0xa950('0x2e')](function(_0x3e536e){logger[_0xa950('0xc')](_0xa950('0x53'),_0x3e536e[_0xa950('0xd')]);})['finally'](function(){var _0x34db1c=require(_0xa950('0x54'))(config[_0xa950('0x6')][_0xa950('0x55')],config[_0xa950('0x6')]['ip'],_0x18dcd2);_0x34db1c['on']('error',errorHandler);_0x34db1c['on'](_0xa950('0x56'),listeningHandler);_0x34db1c['on'](_0xa950('0x57'),connectionHandler);_0x34db1c['on'](_0xa950('0x34'),closeHandler);});}main(); \ No newline at end of file +var _0xfd87=['sync','start','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','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','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./vertices','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','port','name','message','error','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','getSquareProject','then','createSquareReport','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','close','evtHangup'];(function(_0x2173e7,_0x34fcd3){var _0x550cab=function(_0x743abd){while(--_0x743abd){_0x2173e7['push'](_0x2173e7['shift']());}};_0x550cab(++_0x34fcd3);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require(_0x7fd8('0x0'));var _=require(_0x7fd8('0x1'));var syncho=require(_0x7fd8('0x2'));var util=require(_0x7fd8('0x3'));var moment=require(_0x7fd8('0x4'));var config=require(_0x7fd8('0x5'));var logger=require(_0x7fd8('0x6'))(_0x7fd8('0x7'));var utilLicense=require(_0x7fd8('0x8'));var rpc=require(_0x7fd8('0x9'));var mailRpc=require(_0x7fd8('0xa'));var Graph=require('./graph');var Vertices=require(_0x7fd8('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7fd8('0x7')]=_['defaults'](config[_0x7fd8('0x7')],{'ip':_0x7fd8('0xc'),'port':0x11dd});function connectionHandler(_0x2e2d74){process[_0x7fd8('0xd')](function(){syncho(function(){try{setChannelVariables(_0x2e2d74);agiHandler(_0x2e2d74);}catch(_0x469c2f){logger['error'](_0x469c2f[_0x7fd8('0xe')]);}});});}function listeningHandler(){console[_0x7fd8('0xf')](_0x7fd8('0x10'),config['agi']['port']);logger['info'](util[_0x7fd8('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x7fd8('0x7')]['ip'],config[_0x7fd8('0x7')][_0x7fd8('0x12')]));}function errorHandler(_0x566901){if(_0x566901&&_0x566901[_0x7fd8('0x13')]&&_0x566901[_0x7fd8('0x14')]){logger[_0x7fd8('0x15')](util[_0x7fd8('0x11')](_0x7fd8('0x16'),_0x566901['name'],_0x566901[_0x7fd8('0x14')]));}else{logger[_0x7fd8('0x15')](util[_0x7fd8('0x11')](_0x7fd8('0x17'),_0x566901[_0x7fd8('0xe')]));}}function closeHandler(){logger[_0x7fd8('0x18')](util[_0x7fd8('0x11')](_0x7fd8('0x19'),this[_0x7fd8('0x1a')],this[_0x7fd8('0x1b')],this[_0x7fd8('0x1c')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x5ca7f6){logger[_0x7fd8('0x15')](_0x5ca7f6[_0x7fd8('0xe')]);}}function timeoutHandler(){logger['info'](util[_0x7fd8('0x11')](_0x7fd8('0x1d'),this[_0x7fd8('0x1a')],this[_0x7fd8('0x1b')],this[_0x7fd8('0x1c')],this[_0x7fd8('0x1e')],this[_0x7fd8('0x1f')]));}function hangupHandler(){logger[_0x7fd8('0x18')](util['format'](_0x7fd8('0x20'),this[_0x7fd8('0x1a')],this[_0x7fd8('0x1b')],this[_0x7fd8('0x1c')],this[_0x7fd8('0x1e')],this[_0x7fd8('0x1f')]));this['evtHangup']=!![];}function getRoot(_0xecd3f3){return parser[_0x7fd8('0x21')](_0xecd3f3,{'object':!![]})[_0x7fd8('0x22')][_0x7fd8('0x23')];}function addVertex(_0x52b71a,_0x3f71a4,_0x402fa1){_0x3f71a4[_0x7fd8('0x24')]=_0x402fa1;if(_0x3f71a4[_0x7fd8('0x25')](_0x7fd8('0x26'))){_0x3f71a4['maxRetry']=parseInt(_0x3f71a4['retry'],0xa);}_0x52b71a[_0x7fd8('0x27')](_[_0x7fd8('0x28')](_0x3f71a4,_0x7fd8('0x29')));}function initGraph(_0xd8168f,_0x17b86a){var _0x50f34f=new Graph();for(var _0x12bc21 in _0xd8168f){if(_0xd8168f[_0x7fd8('0x25')](_0x12bc21)){if(_[_0x7fd8('0x2a')](_0xd8168f[_0x12bc21])){for(var _0x40b79b=0x0;_0x40b79b<_0xd8168f[_0x12bc21][_0x7fd8('0x2b')];_0x40b79b+=0x1){addVertex(_0x50f34f,_0xd8168f[_0x12bc21][_0x40b79b],_0x12bc21);}}else{addVertex(_0x50f34f,_0xd8168f[_0x12bc21],_0x12bc21);}}}for(var _0x52e1ed=0x0;_0x52e1ed<_0x17b86a['length'];_0x52e1ed+=0x1){if(_0x17b86a[_0x52e1ed][_0x7fd8('0x2c')]&&_0x17b86a[_0x52e1ed][_0x7fd8('0x2d')]){_0x50f34f[_0x7fd8('0x2e')](_0x17b86a[_0x52e1ed][_0x7fd8('0x2c')],_0x17b86a[_0x52e1ed]['target'],_0x17b86a[_0x52e1ed]['value']);}}return _0x50f34f;}function getSquareProject(_0x8f9a8e,_0x5d439b){rpc[_0x7fd8('0x2f')](_0x8f9a8e)[_0x7fd8('0x30')](function(_0x3df0a2){_0x5d439b(null,_0x3df0a2);})['catch'](function(_0x28e28e){_0x5d439b(null,_0x28e28e);});}function createSquareReport(_0x5a3937,_0x10f56e){rpc[_0x7fd8('0x31')](_0x5a3937)[_0x7fd8('0x30')](function(_0x43ca67){if(_0x10f56e){_0x10f56e(null,_0x43ca67);}})[_0x7fd8('0x32')](function(_0x175c37){if(_0x10f56e){_0x10f56e(null,_0x175c37);}});}function setChannelVariables(_0x33dd4e){for(var _0x5212d3 in _0x33dd4e){if(_0x33dd4e[_0x7fd8('0x25')](_0x5212d3)){if(_0x5212d3[_0x7fd8('0x33')](_0x7fd8('0x34'))===0x0){_0x33dd4e[_0x5212d3[_0x7fd8('0x35')](0x4)]=_0x33dd4e[_0x5212d3];delete _0x33dd4e[_0x5212d3];}}}}function getLogFromObject(_0x4710d4){return util[_0x7fd8('0x36')](_0x4710d4,{'showHidden':![],'depth':null});}function agiHandler(_0x3837cd){var _0x3000a1,_0x4a66a8,_0x5d9f5b,_0x41c3be,_0x23b13f;logger[_0x7fd8('0x37')]('variables',JSON[_0x7fd8('0x38')](_0x3837cd,null,0x2));logger['info'](util['format'](_0x7fd8('0x39'),_0x3837cd[_0x7fd8('0x1a')],_0x3837cd[_0x7fd8('0x1b')],_0x3837cd[_0x7fd8('0x1c')],_0x3837cd[_0x7fd8('0x1e')],_0x3837cd[_0x7fd8('0x1f')]));_0x3837cd['on'](_0x7fd8('0x15'),errorHandler);_0x3837cd['on'](_0x7fd8('0x3a'),closeHandler);_0x3837cd['on']('timeout',timeoutHandler);_0x3837cd[_0x7fd8('0x3b')]=![];_0x3837cd['on']('hangup',hangupHandler);var _0x5e6231=getSquareProject[_0x7fd8('0x3c')](null,_0x3837cd['arg_1']);if(_0x5e6231){if(_0x5e6231['production']){_0x3000a1=getRoot(_0x5e6231['production']);if(_0x3000a1&&_0x3000a1[_0x7fd8('0x3d')]){logger[_0x7fd8('0x37')]('root',JSON[_0x7fd8('0x38')](_0x3000a1,null,0x2));_0x3837cd[_0x7fd8('0x3e')]=moment()[_0x7fd8('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a66a8=initGraph(_['omit'](_0x3000a1,'mxCell'),_0x3000a1[_0x7fd8('0x29')]);_0x5d9f5b=new Vertices(_0x3837cd,rpc,mailRpc);logger[_0x7fd8('0x18')](util[_0x7fd8('0x11')](_0x7fd8('0x3f'),_0x3837cd[_0x7fd8('0x1a')],_0x3837cd[_0x7fd8('0x1b')],_0x3837cd[_0x7fd8('0x1c')],_0x3837cd['dnid'],_0x3837cd['uniqueid']));_0x4a66a8['traverseBFS'](_0x3000a1[_0x7fd8('0x3d')]['id'],function(_0x24a0f8){try{_0x24a0f8=_0x5d9f5b[_0x7fd8('0x40')](_0x24a0f8);logger['debug'](_0x7fd8('0x41'),JSON[_0x7fd8('0x38')](_0x24a0f8,null,0x2));if(_0x24a0f8[_0x7fd8('0x24')]===_0x7fd8('0x42')){logger['info'](_0x7fd8('0x43'));_0x3837cd[_0x7fd8('0x44')]=_0x24a0f8['context']||_0x3837cd[_0x7fd8('0x44')];_0x3837cd['extension']=_0x24a0f8[_0x7fd8('0x45')];_0x3837cd[_0x7fd8('0x46')]=_0x24a0f8[_0x7fd8('0x46')]?_0x24a0f8[_0x7fd8('0x46')]-0x1:0x1;return null;}else if(_0x24a0f8&&_0x5d9f5b[_0x24a0f8['agicommand']]){_0x23b13f=_0x5d9f5b[_0x24a0f8[_0x7fd8('0x24')]](_0x24a0f8);logger[_0x7fd8('0x18')](_0x7fd8('0x47'),JSON[_0x7fd8('0x38')](_0x23b13f,null,0x2));if(_0x23b13f&&_0x23b13f[_0x7fd8('0x48')]===AGI_CODE_SUCCESS&&_0x23b13f[_0x7fd8('0x49')]!==AGI_RESULT_ERROR&&!_0x3837cd['evtHangup']){logger['debug']('response',getLogFromObject(_0x23b13f));return _[_0x7fd8('0x4a')](_0x23b13f[_0x7fd8('0x49')])?null:_0x23b13f['result']['toString']();}else{logger[_0x7fd8('0x15')](_0x7fd8('0x47'),getLogFromObject(_0x23b13f));return null;}}else{logger['error'](_0x7fd8('0x4b'));return null;}}catch(_0x2eb631){logger[_0x7fd8('0x15')](_0x2eb631['stack']);return null;}});if(_0x3000a1[_0x7fd8('0x4c')]){logger[_0x7fd8('0x18')](util['format'](_0x7fd8('0x4d'),_0x3837cd['arg_1'],_0x3837cd[_0x7fd8('0x1b')],_0x3837cd[_0x7fd8('0x1c')],_0x3837cd[_0x7fd8('0x1e')],_0x3837cd[_0x7fd8('0x1f')]));_0x4a66a8[_0x7fd8('0x4e')](_0x3000a1[_0x7fd8('0x4c')]['id'],function(_0x3e79a1){try{_0x3e79a1=_0x5d9f5b[_0x7fd8('0x40')](_0x3e79a1);logger['debug'](_0x7fd8('0x41'),JSON['stringify'](_0x3e79a1,null,0x2));if(_0x3e79a1&&_0x5d9f5b[_0x3e79a1[_0x7fd8('0x24')]]){_0x23b13f=_0x5d9f5b[_0x3e79a1[_0x7fd8('0x24')]](_0x3e79a1);if(_0x23b13f){logger['debug'](_0x7fd8('0x47'),getLogFromObject(_0x23b13f));return _[_0x7fd8('0x4a')](_0x23b13f['result'])?null:_0x23b13f['result']['toString']();}else{logger[_0x7fd8('0x15')]('response',getLogFromObject(_0x23b13f));return null;}}else{logger[_0x7fd8('0x15')](_0x7fd8('0x4b'));return null;}}catch(_0x1690d9){logger[_0x7fd8('0x15')](_0x1690d9[_0x7fd8('0xe')]);return null;}});}logger['info'](util['format'](_0x7fd8('0x4f'),_0x3837cd[_0x7fd8('0x1a')],_0x3837cd[_0x7fd8('0x1b')],_0x3837cd[_0x7fd8('0x1c')],_0x3837cd['dnid'],_0x3837cd[_0x7fd8('0x1f')]));logger['info'](util[_0x7fd8('0x11')](_0x7fd8('0x50'),_0x3837cd[_0x7fd8('0x44')],_0x3837cd[_0x7fd8('0x45')],parseInt(_0x3837cd[_0x7fd8('0x46')],0xa)+0x1));_0x3837cd[_0x7fd8('0x51')](_0x3837cd[_0x7fd8('0x44')],_0x3837cd[_0x7fd8('0x45')],parseInt(_0x3837cd[_0x7fd8('0x46')],0xa)+0x1);_0x3837cd[_0x7fd8('0x3a')]();}}else{logger[_0x7fd8('0x15')](util['format'](_0x7fd8('0x52'),_0x3837cd[_0x7fd8('0x1a')]));_0x3837cd[_0x7fd8('0x51')](_0x3837cd[_0x7fd8('0x44')],_0x3837cd[_0x7fd8('0x45')],parseInt(_0x3837cd['priority'],0xa)+0x1);_0x3837cd['close']();}}else{logger['error'](util[_0x7fd8('0x11')](_0x7fd8('0x53'),_0x3837cd[_0x7fd8('0x1a')]));_0x3837cd[_0x7fd8('0x51')](_0x3837cd[_0x7fd8('0x44')],_0x3837cd[_0x7fd8('0x45')],parseInt(_0x3837cd[_0x7fd8('0x46')],0xa)+0x1);_0x3837cd['close']();}}function main(){var _0x5e2809;return utilLicense[_0x7fd8('0x54')]()['then'](function(_0x8da2c0){if(_0x8da2c0){if(_0x8da2c0[_0x7fd8('0x55')]){if(_0x8da2c0['callysquare']&&_0x8da2c0[_0x7fd8('0x56')]>0x0){logger[_0x7fd8('0x18')](util['format'](_0x7fd8('0x57'),_0x8da2c0[_0x7fd8('0x56')]));_0x5e2809=_0x8da2c0[_0x7fd8('0x56')];}else{logger[_0x7fd8('0x18')](_0x7fd8('0x58'));}}else{logger[_0x7fd8('0x18')](_0x7fd8('0x59'));_0x5e2809=-0x1;}}})['catch'](function(_0x16d36e){logger[_0x7fd8('0x15')](_0x7fd8('0x5a'),_0x16d36e[_0x7fd8('0xe')]);})[_0x7fd8('0x4c')](function(){var _0x52682e=require(_0x7fd8('0x5b'))(config[_0x7fd8('0x7')][_0x7fd8('0x12')],config['agi']['ip'],_0x5e2809);_0x52682e['on']('error',errorHandler);_0x52682e['on'](_0x7fd8('0x5c'),listeningHandler);_0x52682e['on'](_0x7fd8('0x5d'),connectionHandler);_0x52682e['on'](_0x7fd8('0x3a'),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 720e183..6fe4d8d 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x126a74,_0x1f01eb){var _0x5efe5b=function(_0x3ea5c7){while(--_0x3ea5c7){_0x126a74['push'](_0x126a74['shift']());}};_0x5efe5b(++_0x1f01eb);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x5864d4,_0x365841){var _0x327c22=function(_0x1f2d26){while(--_0x1f2d26){_0x5864d4['push'](_0x5864d4['shift']());}};_0x327c22(++_0x365841);}(_0x34e8,0x12c));var _0x834e=function(_0x111609,_0x5f26f4){_0x111609=_0x111609-0x0;var _0x1d6595=_0x34e8[_0x111609];return _0x1d6595;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index e47afdc..d22db0c 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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x1a07fe,_0x38d531){var _0xcb9a20=function(_0x107205){while(--_0x107205){_0x1a07fe['push'](_0x1a07fe['shift']());}};_0xcb9a20(++_0x38d531);}(_0x7a54,0x106));var _0x47a5=function(_0x2552c7,_0x4cc80d){_0x2552c7=_0x2552c7-0x0;var _0x466dd4=_0x7a54[_0x2552c7];return _0x466dd4;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file +var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x43e3f9,_0x409967){var _0x582414=function(_0x867450){while(--_0x867450){_0x43e3f9['push'](_0x43e3f9['shift']());}};_0x582414(++_0x409967);}(_0x7a54,0x106));var _0x47a5=function(_0x466d6f,_0x229e18){_0x466d6f=_0x466d6f-0x0;var _0x33a7f0=_0x7a54[_0x466d6f];return _0x33a7f0;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 2884a70..138d524 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 _0xa962=['getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','client','http','then','error','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','email','getSquareProjectById','name'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xa962,0xd1));var _0x2a96=function(_0x549a84,_0x225007){_0x549a84=_0x549a84-0x0;var _0x121d5d=_0xa962[_0x549a84];return _0x121d5d;};'use strict';var BPromise=require(_0x2a96('0x0'));var moment=require(_0x2a96('0x1'));var _=require(_0x2a96('0x2'));var util=require('util');var jayson=require(_0x2a96('0x3'));var client=jayson[_0x2a96('0x4')][_0x2a96('0x5')]({'port':0x2329});function request(_0x26926c,_0x228711){return new BPromise(function(_0x551ed2,_0x464af6){return client['request'](_0x26926c,_0x228711)[_0x2a96('0x6')](function(_0x91cdfb){if(_0x91cdfb[_0x2a96('0x7')]){return _0x464af6(_0x91cdfb[_0x2a96('0x7')]['message']);}else{return _0x551ed2(_0x91cdfb['result']);}})['catch'](function(_0x254349){return _0x464af6(_0x254349);});});}exports[_0x2a96('0x8')]=function(_0x2b8ec2){return request(_0x2a96('0x9'),{'options':{'raw':![],'where':{'name':_0x2b8ec2},'attributes':['production']}});};exports[_0x2a96('0xa')]=function(_0x12ce02){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x12ce02},'include':[{'model':_0x2a96('0xb'),'as':'Smtp'}],'attributes':['id','name',_0x2a96('0xc')]}});};exports[_0x2a96('0xd')]=function(_0x241a29){return request(_0x2a96('0x9'),{'options':{'where':{'id':_0x241a29},'attributes':[_0x2a96('0xe')]}});};exports[_0x2a96('0xf')]=function(_0x494cd7){return request(_0x2a96('0x10'),{'options':{'where':{'id':_0x494cd7},'attributes':[_0x2a96('0xe')]}});};exports[_0x2a96('0x11')]=function(_0x22168d){return request(_0x2a96('0x12'),{'options':{'where':{'id':_0x22168d},'attributes':[_0x2a96('0xe')]}});};exports[_0x2a96('0x13')]=function(_0x54dd9a){return request(_0x2a96('0x14'),{'options':{'where':{'id':_0x54dd9a},'attributes':[_0x2a96('0x15')]}});};exports[_0x2a96('0x16')]=function(_0x750538){return request(_0x2a96('0x17'),{'options':{'where':{'id':_0x750538},'attributes':[_0x2a96('0xe')]}});};exports[_0x2a96('0x18')]=function(_0x39ebd8){return request(_0x2a96('0x19'),{'options':{'where':{'id':_0x39ebd8},'attributes':[_0x2a96('0xe')]}});};exports[_0x2a96('0x1a')]=function(_0x588eec){return request(_0x2a96('0x1b'),{'options':{'where':{'id':_0x588eec},'attributes':[_0x2a96('0x1c')]}});};exports['getIntervalById']=function(_0x9cee60){return request(_0x2a96('0x1d'),{'options':{'raw':![],'where':{'id':_0x9cee60},'include':[{'model':_0x2a96('0x1e'),'as':_0x2a96('0x1f')}]}});};exports[_0x2a96('0x20')]=function(_0x3d6d65){return request(_0x2a96('0x21'),{'options':{'where':{'id':_0x3d6d65},'attributes':['id',_0x2a96('0xe')]}});};exports['createSmsMessage']=function(_0x12127f){return request('CreateSmsMessage',{'body':_0x12127f});};exports[_0x2a96('0x22')]=function(_0x1aa09d){return request(_0x2a96('0x23'),{'body':_0x1aa09d});};exports[_0x2a96('0x24')]=function(_0x364b67){return request(_0x2a96('0x25'),{'body':_[_0x2a96('0x26')](_0x364b67,{'project_name':_0x364b67[_0x2a96('0x27')],'prev_project_name':_0x364b67[_0x2a96('0x28')]||'','is_subproject':_0x364b67[_0x2a96('0x28')]?!![]:![],'leaveAt':moment()[_0x2a96('0x29')](_0x2a96('0x2a'))})});};exports['createSquareRecording']=function(_0xcb6d0b){return request(_0x2a96('0x2b'),{'body':_0xcb6d0b});};exports[_0x2a96('0x2c')]=function(_0xb8b84f){return request(_0x2a96('0x2d'),{'body':_0xb8b84f});};exports[_0x2a96('0x2e')]=function(_0x30dabf){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x30dabf['phone'],'ListId':_0x30dabf['ListId']}}})['then'](function(_0x3654b8){if(_0x3654b8){return _0x3654b8;}return request('CreateCmContact',{'body':_0x30dabf});});};exports[_0x2a96('0x2f')]=function(_0x14ac21){return request('ShowPause',{'options':{'where':{'id':_0x14ac21},'attributes':[_0x2a96('0xe')]}});};exports[_0x2a96('0x30')]=function(_0xcd2a71,_0xbdf79f){return request(_0x2a96('0x31'),{'body':{'interface':_0xbdf79f},'options':{'where':_0xcd2a71}});};exports[_0x2a96('0x32')]=function(_0x16ded5,_0x441378,_0x33d483){return request(_0x2a96('0x33'),{'body':{'type':_0x441378,'uniqueid':_0x33d483},'options':{'where':_0x16ded5}});};exports[_0x2a96('0x34')]=function(_0x383b9d){return request(_0x2a96('0x35'),{'body':{},'options':{'where':_0x383b9d}});};exports[_0x2a96('0x36')]=function(_0x398c5f){return request(_0x2a96('0x37'),{'body':{},'options':{'where':_0x398c5f}});}; \ No newline at end of file +var _0x6ce7=['getPauseById','ShowPause','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http','request','then','error','message','catch','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','email','getSquareProjectById','name','getVoiceQueueById','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','phone','ListId','CreateCmContact'];(function(_0x17e31a,_0x47d6ea){var _0x87d10a=function(_0x54d597){while(--_0x54d597){_0x17e31a['push'](_0x17e31a['shift']());}};_0x87d10a(++_0x47d6ea);}(_0x6ce7,0x76));var _0x76ce=function(_0x10f219,_0x275af7){_0x10f219=_0x10f219-0x0;var _0x328bbd=_0x6ce7[_0x10f219];return _0x328bbd;};'use strict';var BPromise=require(_0x76ce('0x0'));var moment=require(_0x76ce('0x1'));var _=require(_0x76ce('0x2'));var util=require(_0x76ce('0x3'));var jayson=require(_0x76ce('0x4'));var client=jayson['client'][_0x76ce('0x5')]({'port':0x2329});function request(_0x16ef4e,_0x13f937){return new BPromise(function(_0xf71c76,_0x583dbd){return client[_0x76ce('0x6')](_0x16ef4e,_0x13f937)[_0x76ce('0x7')](function(_0x21dce9){if(_0x21dce9[_0x76ce('0x8')]){return _0x583dbd(_0x21dce9[_0x76ce('0x8')][_0x76ce('0x9')]);}else{return _0xf71c76(_0x21dce9['result']);}})[_0x76ce('0xa')](function(_0x55b111){return _0x583dbd(_0x55b111);});});}exports[_0x76ce('0xb')]=function(_0x53b12f){return request(_0x76ce('0xc'),{'options':{'raw':![],'where':{'name':_0x53b12f},'attributes':['production']}});};exports[_0x76ce('0xd')]=function(_0x5b8e31){return request(_0x76ce('0xe'),{'options':{'raw':![],'where':{'id':_0x5b8e31},'include':[{'model':_0x76ce('0xf'),'as':'Smtp'}],'attributes':['id','name',_0x76ce('0x10')]}});};exports[_0x76ce('0x11')]=function(_0x5ccbec){return request('ShowSquareProject',{'options':{'where':{'id':_0x5ccbec},'attributes':[_0x76ce('0x12')]}});};exports[_0x76ce('0x13')]=function(_0xefc231){return request('ShowVoiceQueue',{'options':{'where':{'id':_0xefc231},'attributes':[_0x76ce('0x12')]}});};exports[_0x76ce('0x14')]=function(_0xb25465){return request(_0x76ce('0x15'),{'options':{'where':{'id':_0xb25465},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x11f67b){return request(_0x76ce('0x16'),{'options':{'where':{'id':_0x11f67b},'attributes':[_0x76ce('0x17')]}});};exports[_0x76ce('0x18')]=function(_0x474930){return request(_0x76ce('0x19'),{'options':{'where':{'id':_0x474930},'attributes':[_0x76ce('0x12')]}});};exports['getTrunkById']=function(_0x3bf311){return request(_0x76ce('0x1a'),{'options':{'where':{'id':_0x3bf311},'attributes':[_0x76ce('0x12')]}});};exports[_0x76ce('0x1b')]=function(_0x33984b){return request('ShowSound',{'options':{'where':{'id':_0x33984b},'attributes':[_0x76ce('0x1c')]}});};exports[_0x76ce('0x1d')]=function(_0x451db8){return request(_0x76ce('0x1e'),{'options':{'raw':![],'where':{'id':_0x451db8},'include':[{'model':_0x76ce('0x1f'),'as':'Intervals'}]}});};exports[_0x76ce('0x20')]=function(_0x3f238a){return request('ShowSmsAccount',{'options':{'where':{'id':_0x3f238a},'attributes':['id',_0x76ce('0x12')]}});};exports[_0x76ce('0x21')]=function(_0x2cd9f){return request('CreateSmsMessage',{'body':_0x2cd9f});};exports[_0x76ce('0x22')]=function(_0x8bf5c3){return request(_0x76ce('0x23'),{'body':_0x8bf5c3});};exports[_0x76ce('0x24')]=function(_0x21ca6c){return request(_0x76ce('0x25'),{'body':_[_0x76ce('0x26')](_0x21ca6c,{'project_name':_0x21ca6c['arg_1'],'prev_project_name':_0x21ca6c[_0x76ce('0x27')]||'','is_subproject':_0x21ca6c['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x76ce('0x28'))})});};exports[_0x76ce('0x29')]=function(_0x427cdf){return request('CreateSquareRecording',{'body':_0x427cdf});};exports[_0x76ce('0x2a')]=function(_0x3db1ee){return request(_0x76ce('0x2b'),{'body':_0x3db1ee});};exports['createCmContact']=function(_0xbf1467){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xbf1467[_0x76ce('0x2c')],'ListId':_0xbf1467[_0x76ce('0x2d')]}}})[_0x76ce('0x7')](function(_0x5448bb){if(_0x5448bb){return _0x5448bb;}return request(_0x76ce('0x2e'),{'body':_0xbf1467});});};exports[_0x76ce('0x2f')]=function(_0x317dee){return request(_0x76ce('0x30'),{'options':{'where':{'id':_0x317dee},'attributes':[_0x76ce('0x12')]}});};exports[_0x76ce('0x31')]=function(_0x44f41c,_0xbd4c42){return request('LoginUser',{'body':{'interface':_0xbd4c42},'options':{'where':_0x44f41c}});};exports['agentPause']=function(_0x3fef41,_0x24a869,_0x4b1b9b){return request(_0x76ce('0x32'),{'body':{'type':_0x24a869,'uniqueid':_0x4b1b9b},'options':{'where':_0x3fef41}});};exports[_0x76ce('0x33')]=function(_0x23f9af){return request(_0x76ce('0x34'),{'body':{},'options':{'where':_0x23f9af}});};exports[_0x76ce('0x35')]=function(_0x5c865d){return request(_0x76ce('0x36'),{'body':{},'options':{'where':_0x5c865d}});}; \ 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 56e0773..9c2dfa8 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 _0x5178=['exports','./lex'];(function(_0x4da276,_0xf970e5){var _0x372e82=function(_0x4fdcd2){while(--_0x4fdcd2){_0x4da276['push'](_0x4da276['shift']());}};_0x372e82(++_0xf970e5);}(_0x5178,0x171));var _0x8517=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5178[_0x6c993a];return _0x27f547;};var polly=require('./polly');var lex=require(_0x8517('0x0'));module[_0x8517('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xadb8=['exports'];(function(_0x49748c,_0x3d2005){var _0xedf6b6=function(_0x11628d){while(--_0x11628d){_0x49748c['push'](_0x49748c['shift']());}};_0xedf6b6(++_0x3d2005);}(_0xadb8,0x1d0));var _0x8adb=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0xadb8[_0x2c9b79];return _0x265032;};var polly=require('./polly');var lex=require('./lex');module[_0x8adb('0x0')]={'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 ea553b0..6c0cdf4 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 _0xeebe=['./lib/api'];(function(_0x157fdc,_0xaec719){var _0x7a87b1=function(_0x415aca){while(--_0x415aca){_0x157fdc['push'](_0x157fdc['shift']());}};_0x7a87b1(++_0xaec719);}(_0xeebe,0xff));var _0xeeeb=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xeebe[_0x580576];return _0x3f55a0;};'use strict';var lex=require(_0xeeeb('0x0'));module['exports']=function(_0x369435,_0x558233,_0x2794b0,_0x1a1a35,_0xb434b3,_0x427b94){return lex(_0x369435,_0x558233,_0x2794b0,_0x1a1a35,_0xb434b3,_0x427b94);}; \ No newline at end of file +var _0x0ba7=['./lib/api'];(function(_0x3e7d64,_0x53d71b){var _0x137f44=function(_0x1c280b){while(--_0x1c280b){_0x3e7d64['push'](_0x3e7d64['shift']());}};_0x137f44(++_0x53d71b);}(_0x0ba7,0x16d));var _0x70ba=function(_0x1fed57,_0x26e4c9){_0x1fed57=_0x1fed57-0x0;var _0x395f0d=_0x0ba7[_0x1fed57];return _0x395f0d;};'use strict';var lex=require(_0x70ba('0x0'));module['exports']=function(_0x469795,_0x15094e,_0xadfc69,_0x42d93c,_0x5e5368,_0x319ca9){return lex(_0x469795,_0x15094e,_0xadfc69,_0x42d93c,_0x5e5368,_0x319ca9);}; \ 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 550d937..56c1b2a 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 _0xbd9c=['slots','slot_','exports','LexRuntime','aws-sdk','postText'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbd9c,0x1d2));var _0xcbd9=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xbd9c[_0x59bcb1];return _0x4a737f;};'use strict';var BPromise=require('bluebird');var AWS=require(_0xcbd9('0x0'));function lexResult(_0x54f9aa,_0x5deba0){return new BPromise(function(_0x2ca809,_0x2249e7){_0x54f9aa[_0xcbd9('0x1')](_0x5deba0,function(_0x5d8f25,_0x2c43ad){if(_0x5d8f25){_0x2249e7(_0x5d8f25);}if(_0x2c43ad['slots']){for(const _0x4ad8c8 in _0x2c43ad[_0xcbd9('0x2')]){if(_0x2c43ad['slots']['hasOwnProperty'](_0x4ad8c8)){var _0x1fd298=_0x2c43ad[_0xcbd9('0x2')][_0x4ad8c8];_0x2c43ad[_0xcbd9('0x3')+_0x4ad8c8]=_0x1fd298;}}}_0x2ca809(_0x2c43ad);});});}module[_0xcbd9('0x4')]=function(_0x39dd11,_0x3f6d5f,_0x1cc562,_0x2f630d,_0x1a36b0,_0x9959bd){var _0x12b8a5=new AWS[(_0xcbd9('0x5'))]({'accessKeyId':_0x3f6d5f,'secretAccessKey':_0x1cc562,'region':_0x2f630d});var _0x4ce0eb={'botAlias':'$LATEST','botName':_0x9959bd,'inputText':_0x1a36b0,'userId':_0x39dd11};return lexResult(_0x12b8a5,_0x4ce0eb);}; \ No newline at end of file +var _0xc463=['hasOwnProperty','exports','LexRuntime','$LATEST','bluebird','aws-sdk','slots'];(function(_0x3a6e14,_0x52c20f){var _0x95e3b3=function(_0x451f2c){while(--_0x451f2c){_0x3a6e14['push'](_0x3a6e14['shift']());}};_0x95e3b3(++_0x52c20f);}(_0xc463,0x1af));var _0x3c46=function(_0x4a94b1,_0x4f2518){_0x4a94b1=_0x4a94b1-0x0;var _0x20949f=_0xc463[_0x4a94b1];return _0x20949f;};'use strict';var BPromise=require(_0x3c46('0x0'));var AWS=require(_0x3c46('0x1'));function lexResult(_0x5abb60,_0x5114d5){return new BPromise(function(_0x24503c,_0x580e93){_0x5abb60['postText'](_0x5114d5,function(_0x3665d5,_0x5732d8){if(_0x3665d5){_0x580e93(_0x3665d5);}if(_0x5732d8['slots']){for(const _0x3d8bf4 in _0x5732d8[_0x3c46('0x2')]){if(_0x5732d8[_0x3c46('0x2')][_0x3c46('0x3')](_0x3d8bf4)){var _0x3b0139=_0x5732d8[_0x3c46('0x2')][_0x3d8bf4];_0x5732d8['slot_'+_0x3d8bf4]=_0x3b0139;}}}_0x24503c(_0x5732d8);});});}module[_0x3c46('0x4')]=function(_0x406aec,_0x1f280f,_0x261058,_0x1235ed,_0x28e066,_0x522e00){var _0x352bd3=new AWS[(_0x3c46('0x5'))]({'accessKeyId':_0x1f280f,'secretAccessKey':_0x261058,'region':_0x1235ed});var _0x36d8af={'botAlias':_0x3c46('0x6'),'botName':_0x522e00,'inputText':_0x28e066,'userId':_0x406aec};return lexResult(_0x352bd3,_0x36d8af);}; \ 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 529dc08..ec5d0dc 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 _0x2191=['exports','./lib/api'];(function(_0x573e5b,_0x3eceaf){var _0x525dbf=function(_0x568e20){while(--_0x568e20){_0x573e5b['push'](_0x573e5b['shift']());}};_0x525dbf(++_0x3eceaf);}(_0x2191,0x131));var _0x1219=function(_0x4d66b9,_0x3280f3){_0x4d66b9=_0x4d66b9-0x0;var _0x46d15b=_0x2191[_0x4d66b9];return _0x46d15b;};'use strict';var polly=require(_0x1219('0x0'));module[_0x1219('0x1')]=function(_0x592b4b,_0x46b851,_0x548c35,_0x2509bf,_0x5631c9,_0x32455f,_0x37be02){return polly(_0x592b4b,_0x46b851,_0x548c35,_0x2509bf,_0x5631c9,_0x32455f,_0x37be02);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0xec79ca,_0x2c8c36,_0x1c03e9,_0x3ea75b,_0x4b5b22,_0x449330,_0x5595eb){return polly(_0xec79ca,_0x2c8c36,_0x1c03e9,_0x3ea75b,_0x4b5b22,_0x449330,_0x5595eb);}; \ 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 562bc86..95086fa 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 _0xc8e7=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path','bluebird','randomstring','aws-sdk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8e7,0xf6));var _0x7c8e=function(_0x537c37,_0x536e74){_0x537c37=_0x537c37-0x0;var _0x241f84=_0xc8e7[_0x537c37];return _0x241f84;};'use strict';var fs=require('fs');var path=require(_0x7c8e('0x0'));var BPromise=require(_0x7c8e('0x1'));var rs=require(_0x7c8e('0x2'));var AWS=require(_0x7c8e('0x3'));function pollyResult(_0x36b03f,_0x5e70e2,_0x558179){return new BPromise(function(_0x143a73,_0x4b4a7c){_0x36b03f['synthesizeSpeech'](_0x5e70e2,function(_0x5c0dcf,_0x4efdb7){if(_0x5c0dcf){_0x4b4a7c(_0x5c0dcf);}else if(_0x4efdb7){if(_0x4efdb7[_0x7c8e('0x4')]instanceof Buffer){fs[_0x7c8e('0x5')](_0x558179,_0x4efdb7[_0x7c8e('0x4')],function(_0xd7fe06){if(_0xd7fe06){_0x4b4a7c(_0xd7fe06);}else{_0x143a73();}});}else{_0x4b4a7c(new Error(_0x7c8e('0x6')));}}else{_0x4b4a7c(new Error(_0x7c8e('0x7')));}});});}module['exports']=function(_0x34d9a1,_0x505fd9,_0x1eef97,_0x38a977,_0x2be4d4,_0x4b7569,_0x261218){var _0x45738d=new AWS[(_0x7c8e('0x8'))]({'accessKeyId':_0x34d9a1,'secretAccessKey':_0x505fd9,'region':_0x1eef97});var _0x47d65f={'Text':_0x2be4d4,'TextType':_0x4b7569||_0x7c8e('0x9'),'OutputFormat':'mp3','VoiceId':_0x38a977};return pollyResult(_0x45738d,_0x47d65f,_0x261218);}; \ No newline at end of file +var _0xb3e1=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path'];(function(_0x124d22,_0x105b34){var _0x49d7d4=function(_0x467801){while(--_0x467801){_0x124d22['push'](_0x124d22['shift']());}};_0x49d7d4(++_0x105b34);}(_0xb3e1,0x103));var _0x1b3e=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0xb3e1[_0x4e170e];return _0x338291;};'use strict';var fs=require('fs');var path=require(_0x1b3e('0x0'));var BPromise=require('bluebird');var rs=require(_0x1b3e('0x1'));var AWS=require(_0x1b3e('0x2'));function pollyResult(_0x5a9e0c,_0xb1abba,_0x291d34){return new BPromise(function(_0xca4e3b,_0x5e846a){_0x5a9e0c[_0x1b3e('0x3')](_0xb1abba,function(_0x4688f3,_0x320d5b){if(_0x4688f3){_0x5e846a(_0x4688f3);}else if(_0x320d5b){if(_0x320d5b[_0x1b3e('0x4')]instanceof Buffer){fs['writeFile'](_0x291d34,_0x320d5b[_0x1b3e('0x4')],function(_0x3b7480){if(_0x3b7480){_0x5e846a(_0x3b7480);}else{_0xca4e3b();}});}else{_0x5e846a(new Error(_0x1b3e('0x5')));}}else{_0x5e846a(new Error(_0x1b3e('0x6')));}});});}module[_0x1b3e('0x7')]=function(_0x2aa795,_0x275e60,_0x567668,_0x41661b,_0x311a47,_0x498494,_0x957fb6){var _0x547eeb=new AWS[(_0x1b3e('0x8'))]({'accessKeyId':_0x2aa795,'secretAccessKey':_0x275e60,'region':_0x567668});var _0xf3936a={'Text':_0x311a47,'TextType':_0x498494||_0x1b3e('0x9'),'OutputFormat':'mp3','VoiceId':_0x41661b};return pollyResult(_0x547eeb,_0xf3936a,_0x957fb6);}; \ 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 1f9d61c..a1413d7 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 _0x9cba=['exports','./lib/api'];(function(_0x2b6064,_0x422f83){var _0xb2a71=function(_0x1a8102){while(--_0x1a8102){_0x2b6064['push'](_0x2b6064['shift']());}};_0xb2a71(++_0x422f83);}(_0x9cba,0xaf));var _0xa9cb=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9cba[_0x2dea24];return _0x309d58;};'use strict';var asr=require(_0xa9cb('0x0'));module[_0xa9cb('0x1')]=function(_0x333866,_0x155788,_0x1f34e6,_0x4fcacf){return asr(_0x333866,_0x155788,_0x1f34e6);}; \ No newline at end of file +var _0x2d17=['exports','./lib/api'];(function(_0x1fc67f,_0x3f0821){var _0x8ec5=function(_0x32b407){while(--_0x32b407){_0x1fc67f['push'](_0x1fc67f['shift']());}};_0x8ec5(++_0x3f0821);}(_0x2d17,0x145));var _0x72d1=function(_0x3d4cae,_0x28e223){_0x3d4cae=_0x3d4cae-0x0;var _0x24e43f=_0x2d17[_0x3d4cae];return _0x24e43f;};'use strict';var asr=require(_0x72d1('0x0'));module[_0x72d1('0x1')]=function(_0x31e097,_0x55bba7,_0x42930a,_0x3309e6){return asr(_0x31e097,_0x55bba7,_0x42930a);}; \ 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 10c404c..130f263 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 _0x2fd3=['LINEAR16','8000','url','bluebird','https://speech.googleapis.com','length','string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x2fd3,0x1af));var _0x32fd=function(_0x22ebfe,_0x2c603e){_0x22ebfe=_0x22ebfe-0x0;var _0x31d930=_0x2fd3[_0x22ebfe];return _0x31d930;};'use strict';var url=require(_0x32fd('0x0'));var BPromise=require(_0x32fd('0x1'));var fs=require('fs');var host=_0x32fd('0x2');module['exports']=function(_0x238e9f,_0x184ff4,_0x100d1c){return new BPromise(function(_0x3622a7,_0x361f66){var _0x48d915;if(typeof _0x238e9f!=='string'||_0x238e9f[_0x32fd('0x3')]===0x0){return _0x361f66('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x184ff4!==_0x32fd('0x4')||_0x184ff4[_0x32fd('0x3')]===0x0){return _0x361f66(_0x32fd('0x5'));}if(typeof _0x100d1c!=='undefined'&&(typeof _0x100d1c!==_0x32fd('0x4')||_0x100d1c[_0x32fd('0x3')]===0x0)){return _0x361f66(_0x32fd('0x6'));}try{_0x48d915=fs[_0x32fd('0x7')](_0x238e9f)[_0x32fd('0x8')](_0x32fd('0x9'));}catch(_0x301075){return _0x361f66(_0x301075);}return _0x3622a7({'method':_0x32fd('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x184ff4,'body':{'config':{'encoding':_0x32fd('0xb'),'sampleRateHertz':_0x32fd('0xc'),'languageCode':_0x100d1c},'audio':{'content':_0x48d915}},'json':!![]});});}; \ No newline at end of file +var _0x07ca=['LINEAR16','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','base64','POST','/v1/speech:recognize?key='];(function(_0x41fdcd,_0x2fa74b){var _0x1f3ed5=function(_0x982392){while(--_0x982392){_0x41fdcd['push'](_0x41fdcd['shift']());}};_0x1f3ed5(++_0x2fa74b);}(_0x07ca,0xc7));var _0xa07c=function(_0x4e7c1c,_0x56eafd){_0x4e7c1c=_0x4e7c1c-0x0;var _0x47adb2=_0x07ca[_0x4e7c1c];return _0x47adb2;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0xa07c('0x0');module[_0xa07c('0x1')]=function(_0x466a21,_0x1036ba,_0x4b114e){return new BPromise(function(_0x58e819,_0x5e3be1){var _0x1ad9a8;if(typeof _0x466a21!=='string'||_0x466a21[_0xa07c('0x2')]===0x0){return _0x5e3be1(_0xa07c('0x3'));}if(typeof _0x1036ba!=='string'||_0x1036ba['length']===0x0){return _0x5e3be1(_0xa07c('0x4'));}if(typeof _0x4b114e!==_0xa07c('0x5')&&(typeof _0x4b114e!=='string'||_0x4b114e[_0xa07c('0x2')]===0x0)){return _0x5e3be1('lang\x20should\x20be\x20a\x20string');}try{_0x1ad9a8=fs[_0xa07c('0x6')](_0x466a21)['toString'](_0xa07c('0x7'));}catch(_0x1a8c62){return _0x5e3be1(_0x1a8c62);}return _0x58e819({'method':_0xa07c('0x8'),'uri':host+_0xa07c('0x9')+_0x1036ba,'body':{'config':{'encoding':_0xa07c('0xa'),'sampleRateHertz':'8000','languageCode':_0x4b114e},'audio':{'content':_0x1ad9a8}},'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 2a4cca8..a25a9ba 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 _0x7f52=['exports'];(function(_0x2178bd,_0x58e528){var _0x38527b=function(_0x4dd59a){while(--_0x4dd59a){_0x2178bd['push'](_0x2178bd['shift']());}};_0x38527b(++_0x58e528);}(_0x7f52,0xec));var _0x27f5=function(_0x3d4407,_0x2735be){_0x3d4407=_0x3d4407-0x0;var _0x5ea719=_0x7f52[_0x3d4407];return _0x5ea719;};var asr=require('./asr');module[_0x27f5('0x0')]={'asr':asr}; \ No newline at end of file +var _0x30fc=['./asr','exports'];(function(_0x421e36,_0x18776e){var _0x20b3e3=function(_0x767de4){while(--_0x767de4){_0x421e36['push'](_0x421e36['shift']());}};_0x20b3e3(++_0x18776e);}(_0x30fc,0x64));var _0xc30f=function(_0x491082,_0x28f78b){_0x491082=_0x491082-0x0;var _0x5797d9=_0x30fc[_0x491082];return _0x5797d9;};var asr=require(_0xc30f('0x0'));module[_0xc30f('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 52cb96c..893addc 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 _0x1f77=['request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','https:','host','end','transcode','error\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','audioConfig','MP3','text:synthesize','.mp3','from','audioContent','resolve','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','data','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','name','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','audiofile','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','protocol','path','WHAT_EVER','get','statusCode','error'];(function(_0x31d02e,_0x3588bb){var _0x1da463=function(_0x1dc3fe){while(--_0x1dc3fe){_0x31d02e['push'](_0x31d02e['shift']());}};_0x1da463(++_0x3588bb);}(_0x1f77,0xf7));var _0x71f7=function(_0x2594ef,_0x41f83b){_0x2594ef=_0x2594ef-0x0;var _0x434df0=_0x1f77[_0x2594ef];return _0x434df0;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x71f7('0x0'));var dialogflow=require(_0x71f7('0x1'));var fs=require('fs');var http=require(_0x71f7('0x2'));var https=require(_0x71f7('0x3'));var md5=require(_0x71f7('0x4'));var path=require('path');var querystring=require(_0x71f7('0x5'));var rp=require(_0x71f7('0x6'));var rs=require(_0x71f7('0x7'));var sox=require(_0x71f7('0x8'));var tts=require(_0x71f7('0x9'));var urlParse=require(_0x71f7('0xa'))[_0x71f7('0xb')];var util=require(_0x71f7('0xc'));var aws=require(_0x71f7('0xd'));var google=require(_0x71f7('0xe'));var sestek=require(_0x71f7('0xf'));var tilde=require(_0x71f7('0x10'));var logger=require('../../../config/logger')('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x1345a2,_0x120f73){return new BPromise(function(_0x47b557,_0x277dce){var _0x5e76eb=urlParse(_0x1345a2);var _0x412d0f=_0x5e76eb[_0x71f7('0x11')]==='https:'?https:http;var _0x342d38={'host':_0x5e76eb['host'],'path':_0x5e76eb[_0x71f7('0x12')],'headers':{'user-agent':_0x71f7('0x13')}};_0x412d0f[_0x71f7('0x14')](_0x342d38,function(_0x436c11){if(_0x436c11[_0x71f7('0x15')]!==0xc8){logger[_0x71f7('0x16')](_0x71f7('0x17')+_0x1345a2+'\x20failed,\x20status\x20code\x20=\x20'+_0x436c11[_0x71f7('0x15')]+'\x20('+_0x436c11[_0x71f7('0x18')]+')');_0x277dce(new Error(_0x71f7('0x17')+_0x1345a2+_0x71f7('0x19')+_0x436c11[_0x71f7('0x15')]+'\x20('+_0x436c11['statusMessage']+')'));return;}var _0x2129c4=fs[_0x71f7('0x1a')](_0x120f73);_0x2129c4['on'](_0x71f7('0x1b'),function(){logger[_0x71f7('0x1c')](_0x71f7('0x1d'));_0x2129c4[_0x71f7('0x1e')](_0x47b557);});_0x2129c4['on'](_0x71f7('0x16'),function(_0x42fe74){fs[_0x71f7('0x1f')](_0x120f73);logger[_0x71f7('0x16')](_0x71f7('0x20'),_0x42fe74);_0x277dce(_0x42fe74);});_0x436c11['pipe'](_0x2129c4);})['on'](_0x71f7('0x16'),function(_0x500811){logger[_0x71f7('0x16')](_0x500811);_0x277dce(_0x500811);})['end']();});}function uploadFile(_0xd1ab24){return new BPromise(function(_0x545a2d,_0x148c47){var _0x314060=urlParse(_0xd1ab24);var _0x2d2dc9=_0x314060['protocol']===_0x71f7('0x21')?https:http;var _0x2c3717={'host':_0x314060[_0x71f7('0x22')],'path':_0x314060[_0x71f7('0x12')],'headers':{'user-agent':_0x71f7('0x13')}};_0x2d2dc9['get'](_0x2c3717,function(_0x51d905){if(_0x51d905[_0x71f7('0x15')]!==0xc8){_0x148c47(new Error(_0x71f7('0x17')+_0xd1ab24+_0x71f7('0x19')+_0x51d905[_0x71f7('0x15')]+'\x20('+_0x51d905[_0x71f7('0x18')]+')'));return;}var _0x49e237='';_0x51d905['on']('data',function(_0x42eace){_0x49e237+=_0x42eace;});_0x51d905['on'](_0x71f7('0x23'),function(){_0x545a2d(_0x49e237);});})['on'](_0x71f7('0x16'),function(_0xf5e6e1){_0x148c47(_0xf5e6e1);})[_0x71f7('0x23')]();});}function convertFile(_0x140342,_0x1bdbd1){return new BPromise(function(_0x11ed74,_0x406f4c){var _0x447537=sox[_0x71f7('0x24')](_0x140342,_0x1bdbd1,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x447537['on'](_0x71f7('0x16'),function(_0x38dee1){logger['error'](_0x71f7('0x25'),_0x38dee1);_0x406f4c(_0x38dee1);});_0x447537['on'](_0x71f7('0x23'),function(){logger[_0x71f7('0x1c')]('finish\x20to\x20convert');_0x11ed74();});_0x447537[_0x71f7('0x26')]();});}function base64Decode(_0x54936f,_0x59cd7b){var _0x518182=path['resolve'](__dirname,_0x71f7('0x27'),rs[_0x71f7('0x28')](0x4)+_0x71f7('0x29'));fs[_0x71f7('0x2a')](_0x518182,_0x54936f,_0x71f7('0x2b'));return convertFile(_0x518182,_0x59cd7b)[_0x71f7('0x2c')](function(){try{fs[_0x71f7('0x1f')](_0x518182);fs[_0x71f7('0x2d')](_0x59cd7b,_0x71f7('0x2e'));}catch(_0x14c189){logger[_0x71f7('0x16')](_0x14c189);}return _0x59cd7b[_0x71f7('0x2f')]('.')[0x0];});}function base64Encode(_0x183dcd){var _0x2b1a61=fs[_0x71f7('0x30')](_0x183dcd);return new Buffer(_0x2b1a61)[_0x71f7('0x31')](_0x71f7('0x2b'));}exports[_0x71f7('0x32')]=function(_0x2be5a5,_0x62e29b,_0x17fbb2,_0x2cd171,_0x3798ee,_0x22626b){var _0x28be22,_0x5b3471;var _0x506fac='https://texttospeech.googleapis.com/v1/';var _0x54d95b=_0x71f7('0x33')+_0x2be5a5;var _0x342b09={};if(_0x62e29b===_0x71f7('0x34')){_0x342b09[_0x71f7('0x35')]={'ssml':_0x17fbb2};}else{_0x342b09[_0x71f7('0x35')]={'text':_0x17fbb2};};_0x342b09['voice']={'languageCode':_0x2cd171,'ssmlGender':_0x3798ee};_0x342b09[_0x71f7('0x36')]={'audioEncoding':_0x71f7('0x37'),'sampleRateHertz':0x1f40};var _0x4e577d={'url':_0x506fac+_0x71f7('0x38')+_0x54d95b,'method':'POST','json':!![],'body':_0x342b09};return rp(_0x4e577d)[_0x71f7('0x2c')](function(_0x5226c9){return new BPromise(function(_0x5bc1bb,_0x52c68d){_0x28be22=path['resolve'](__dirname,_0x71f7('0x27'),rs['generate'](0x4)+_0x71f7('0x39'));var _0x1195fa=Buffer[_0x71f7('0x3a')](_0x5226c9[_0x71f7('0x3b')],_0x71f7('0x2b'));return fs['writeFile'](_0x28be22,_0x1195fa,function(_0x9002e7){_0x52c68d(_0x9002e7);},function(_0x3cf0ed){fs['chmodSync'](_0x28be22,_0x71f7('0x2e'));_0x5bc1bb(_0x3cf0ed);});});})[_0x71f7('0x2c')](function(_0x473687){_0x5b3471=path[_0x71f7('0x3c')](__dirname,_0x71f7('0x27'),rs['generate'](0x4)+_0x71f7('0x29'));return convertFile(_0x28be22,_0x5b3471);})[_0x71f7('0x2c')](function(){try{fs['unlink'](_0x28be22);fs[_0x71f7('0x2d')](_0x5b3471,_0x71f7('0x2e'));}catch(_0x5ce4e1){logger['error'](_0x5ce4e1);}logger[_0x71f7('0x1c')](_0x71f7('0x3d'),_0x5b3471['split']('.')[0x0]);return _0x5b3471[_0x71f7('0x2f')]('.')[0x0];});};exports[_0x71f7('0x3e')]=function(_0x10cc3e,_0x5c4855){var _0x1482c0=_0x71f7('0x3f');var _0x353919,_0x45104c;var _0x5be9e9;var _0x593b30={'encoding':_0x71f7('0x40'),'method':_0x71f7('0x41'),'timeout':0x2710,'url':_0x1482c0,'headers':{'Content-Type':_0x71f7('0x42')},'body':_0x71f7('0x43')+encodeURIComponent(JSON[_0x71f7('0x44')]([[['jQ1olc',JSON[_0x71f7('0x44')]([_0x10cc3e,_0x5c4855||'en',![],_0x71f7('0x45')]),null,_0x71f7('0x46')]]]))};return rp(_0x593b30)['then'](function(_0x5cc582){try{_0x5be9e9=eval(_0x5cc582['slice'](0x5))[0x0][0x2];}catch(_0x1a51bd){throw new Error(_0x71f7('0x47')+_0x5cc582[_0x71f7('0x48')]);}if(!_0x5be9e9){if(_0x10cc3e['length']>0xc8){throw new Error(_0x71f7('0x49'));}else{throw new Error(_0x71f7('0x4a')+_0x5c4855+_0x71f7('0x4b'));}}try{_0x5be9e9=eval(_0x5be9e9)[0x0];}catch(_0xed2641){throw new Error(_0x71f7('0x47')+res['data']);}const _0x5d8273=_0x5be9e9;_0x353919=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x71f7('0x39'));fs['writeFileSync'](_0x353919,_0x5be9e9,{'encoding':_0x71f7('0x2b')});_0x45104c=path[_0x71f7('0x3c')](__dirname,'tmp',rs[_0x71f7('0x28')](0x4)+_0x71f7('0x29'));return convertFile(_0x353919,_0x45104c);})[_0x71f7('0x2c')](function(){try{fs[_0x71f7('0x1f')](_0x353919);fs[_0x71f7('0x2d')](_0x45104c,'777');}catch(_0x481a5e){logger[_0x71f7('0x16')](_0x481a5e);}logger[_0x71f7('0x1c')]('goggleTTS\x20path',_0x45104c[_0x71f7('0x2f')]('.')[0x0]);return _0x45104c['split']('.')[0x0];});};exports[_0x71f7('0x4c')]=function(_0x185327,_0x3dae0e,_0x1d0e98){return google[_0x71f7('0x4d')](_0x185327,_0x3dae0e,_0x1d0e98)[_0x71f7('0x2c')](function(_0x552d45){logger[_0x71f7('0x1c')](_0x552d45['uri']);return rp(_0x552d45);})[_0x71f7('0x2c')](function(_0x4e16b1){var _0x41ce91='';var _0x242cda=0x0;try{fs[_0x71f7('0x1f')](_0x185327);}catch(_0x1b00ef){logger[_0x71f7('0x16')](_0x1b00ef);}if(_0x4e16b1&&_0x4e16b1[_0x71f7('0x4e')]){_0x41ce91=_0x4e16b1[_0x71f7('0x4e')][_0x71f7('0x4f')](function(_0x499673){return _0x499673&&_0x499673[_0x71f7('0x50')][0x0]&&_0x499673[_0x71f7('0x50')][0x0][_0x71f7('0x51')]?_0x499673['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x242cda=_0x4e16b1['results'][_0x71f7('0x4f')](function(_0x50e07a){return _0x50e07a&&_0x50e07a['alternatives'][0x0]&&_0x50e07a[_0x71f7('0x50')][0x0][_0x71f7('0x52')]?_0x50e07a['alternatives'][0x0][_0x71f7('0x52')]:0x0;})[_0x71f7('0x53')]('\x0a');}logger[_0x71f7('0x1c')](_0x71f7('0x54'),_0x41ce91);logger[_0x71f7('0x1c')](_0x71f7('0x55'),_0x242cda);return{'transcript':_0x41ce91,'confidence':_0x242cda};})['catch'](function(_0x18aeca){logger[_0x71f7('0x16')]('[%s]\x20%s:%s',_0x18aeca[_0x71f7('0x15')],_0x18aeca['name'],_0x18aeca['message']);});};exports['googleDialogflow']=function(_0x320f57,_0x49ed28,_0xc28ec0,_0x42f1cb){var _0x55df3c=apiai(_0x49ed28,{'language':_0x42f1cb||'en'});return _0x55df3c[_0x71f7('0x56')](_0xc28ec0,{'sessionId':md5(_0x320f57)})[_0x71f7('0x2c')](function(_0x22d4e3){logger[_0x71f7('0x1c')](JSON['stringify'](_0x22d4e3));return{'source':_0x22d4e3[_0x71f7('0x57')][_0x71f7('0x58')],'resolvedQuery':_0x22d4e3[_0x71f7('0x57')][_0x71f7('0x59')],'action':_0x22d4e3[_0x71f7('0x57')][_0x71f7('0x5a')],'actionIncomplete':_0x22d4e3['result'][_0x71f7('0x5b')],'speech':_0x22d4e3[_0x71f7('0x57')][_0x71f7('0x5c')][_0x71f7('0x5d')],'score':_0x22d4e3[_0x71f7('0x57')]['score'],'statusCode':_0x22d4e3[_0x71f7('0x5e')][_0x71f7('0x5f')],'endConversation':_0x22d4e3[_0x71f7('0x57')][_0x71f7('0x60')][_0x71f7('0x61')]||![],'isFallbackIntent':_0x22d4e3[_0x71f7('0x57')][_0x71f7('0x60')][_0x71f7('0x62')]};});};exports[_0x71f7('0x63')]=function(_0x5b5131,_0x30d987,_0x713303,_0x21fddb,_0x2e3cb9,_0x18c980){var _0x175b06=_0x21fddb[_0x71f7('0x64')](/\\n/g,'\x0a');var _0x5e713b={'credentials':{'private_key':_0x175b06,'client_email':_0x713303}};var _0x154dd1=new dialogflow[(_0x71f7('0x65'))](_0x5e713b);var _0x28b93f=_0x154dd1[_0x71f7('0x66')](_0x30d987,md5(_0x5b5131));var _0x5d4a1b={'session':_0x28b93f,'queryInput':{'text':{'text':_0x2e3cb9,'languageCode':_0x18c980}}};return _0x154dd1[_0x71f7('0x67')](_0x5d4a1b)[_0x71f7('0x2c')](function(_0x180749){if(_0x180749&&_0x180749['length']){logger['info'](_0x71f7('0x68'),JSON[_0x71f7('0x44')](_0x180749));var _0x21c1f2=_0x180749[0x0];if(_0x21c1f2){var _0x4505e3={'action':_0x21c1f2[_0x71f7('0x69')]['action'],'allRequiredParamsPresent':_0x21c1f2[_0x71f7('0x69')][_0x71f7('0x6a')],'endConversation':_0x21c1f2[_0x71f7('0x69')][_0x71f7('0x6b')]&&_0x21c1f2[_0x71f7('0x69')][_0x71f7('0x6b')][_0x71f7('0x6c')]?_0x21c1f2[_0x71f7('0x69')][_0x71f7('0x6b')][_0x71f7('0x6c')][_0x71f7('0x6d')]['boolValue']:![],'fulfillmentText':_0x21c1f2[_0x71f7('0x69')][_0x71f7('0x6e')],'intentName':_0x21c1f2['queryResult']['intent'][_0x71f7('0x6f')],'intentDisplayName':_0x21c1f2[_0x71f7('0x69')][_0x71f7('0x70')][_0x71f7('0x71')],'isFallbackIntent':_0x21c1f2['queryResult']['intent'][_0x71f7('0x72')],'languageCode':_0x21c1f2[_0x71f7('0x69')][_0x71f7('0x73')],'queryText':_0x21c1f2[_0x71f7('0x69')][_0x71f7('0x74')],'responseId':_0x21c1f2['responseId'],'score':_0x21c1f2[_0x71f7('0x69')][_0x71f7('0x75')],'speech':_0x21c1f2[_0x71f7('0x69')]['fulfillmentText'],'providerResponse':JSON[_0x71f7('0x44')](_0x180749)};return _0x4505e3;}}});};exports[_0x71f7('0x76')]=function(_0x5a1faf,_0x199812,_0x3d0c13,_0x2d4582){return tilde[_0x71f7('0x4d')](_0x5a1faf,_0x199812,_0x3d0c13,_0x2d4582)[_0x71f7('0x2c')](function(_0x425cbc){try{fs['unlink'](_0x5a1faf);}catch(_0x399a40){logger['error'](_0x399a40);}logger['info'](_0x71f7('0x77'),_0x425cbc[_0x71f7('0x51')]);logger['info']('Tilde\x20ASR\x20confidence',_0x425cbc[_0x71f7('0x52')]);return _0x425cbc;});};exports['awsPolly']=function(_0x349dc9,_0x109843,_0x1e7c9a,_0x23d4db,_0x6e9224,_0x3833a7){var _0x83a736=path[_0x71f7('0x3c')](__dirname,'tmp',rs[_0x71f7('0x28')](0x4)+_0x71f7('0x39'));var _0x47eb68;return aws[_0x71f7('0x78')](_0x349dc9,_0x109843,_0x1e7c9a,_0x23d4db,_0x6e9224,_0x3833a7,_0x83a736)['then'](function(){_0x47eb68=path[_0x71f7('0x3c')](__dirname,_0x71f7('0x27'),rs['generate'](0x4)+_0x71f7('0x29'));return convertFile(_0x83a736,_0x47eb68);})[_0x71f7('0x2c')](function(){try{fs[_0x71f7('0x1f')](_0x83a736);fs['chmodSync'](_0x47eb68,_0x71f7('0x2e'));}catch(_0x53a936){logger['error'](_0x53a936);}return _0x47eb68['split']('.')[0x0];});};exports[_0x71f7('0x79')]=function(_0x5e8fe7,_0x451ed9,_0x283fdf,_0x3a97e,_0x5361e1,_0x5c91b6){return aws['lex'](_0x5e8fe7,_0x451ed9,_0x283fdf,_0x3a97e,_0x5361e1,_0x5c91b6)[_0x71f7('0x2c')](function(_0x40556a){logger[_0x71f7('0x1c')](JSON[_0x71f7('0x44')](_0x40556a));return _0x40556a;});};exports[_0x71f7('0x7a')]=function(_0x3be6b9,_0x32d519,_0x1b0119,_0x2066c9){var _0x393f2b=util[_0x71f7('0x7b')](_0x71f7('0x7c'),ISPEECH_API,_0x3be6b9,encodeURIComponent(_0x32d519),_0x1b0119,_0x2066c9);var _0x3ec441=path[_0x71f7('0x3c')](__dirname,'tmp',rs[_0x71f7('0x28')](0x4)+'.mp3');var _0x121c2b;return downloadFile(_0x393f2b,_0x3ec441)[_0x71f7('0x2c')](function(){_0x121c2b=path[_0x71f7('0x3c')](__dirname,_0x71f7('0x27'),rs[_0x71f7('0x28')](0x4)+_0x71f7('0x29'));return convertFile(_0x3ec441,_0x121c2b);})[_0x71f7('0x2c')](function(){try{fs['unlink'](_0x3ec441);fs[_0x71f7('0x2d')](_0x121c2b,'777');}catch(_0x27d2bc){logger[_0x71f7('0x16')](_0x27d2bc);}return _0x121c2b[_0x71f7('0x2f')]('.')[0x0];});};exports[_0x71f7('0x7d')]=function(_0x249acc,_0x1d0b3b,_0xb863b5,_0x3844aa){var _0x57b320=util[_0x71f7('0x7b')](_0x71f7('0x7e'),ISPEECH_API,_0x1d0b3b,_0xb863b5,base64Encode(_0x249acc),_0x3844aa?util[_0x71f7('0x7b')](_0x71f7('0x7f'),encodeURIComponent(_0x3844aa)):'freeform=3');return uploadFile(_0x57b320)['then'](function(_0x3fb5a3){return querystring[_0x71f7('0xb')](_0x3fb5a3);});};exports[_0x71f7('0x80')]=function(_0x235c2f,_0x26b8ee){return sestek[_0x71f7('0x81')](_0x235c2f,_0x26b8ee)['then'](function(_0x15ef54){logger[_0x71f7('0x1c')](JSON[_0x71f7('0x44')](_0x15ef54));var _0x2ee9b8={'speech':_0x15ef54[_0x71f7('0x82')],'action':_0x15ef54[_0x71f7('0x83')]?_0x15ef54[_0x71f7('0x83')]['CustomAction']:undefined,'actiondata':_0x15ef54['channelData']?_0x15ef54[_0x71f7('0x83')][_0x71f7('0x84')]:undefined};if(_0x15ef54[_0x71f7('0x83')]&&_0x15ef54[_0x71f7('0x83')][_0x71f7('0x85')]){return base64Decode(_0x15ef54['channelData'][_0x71f7('0x85')]['Data'],path[_0x71f7('0x3c')](__dirname,'tmp',rs[_0x71f7('0x28')](0x4)+'.wav'))['then'](function(_0x285d68){_0x2ee9b8[_0x71f7('0x86')]=_0x285d68;return _0x2ee9b8;});}return _0x2ee9b8;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x7ffb=['jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','[%s]\x20%s:%s','name','message','result','source','resolvedQuery','action','fulfillment','speech','score','status','endConversation','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','tildeASR','Tilde\x20ASR\x20transcription','polly','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','freeform=3','sestekNDA','nda','text','channelData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','querystring','request-promise','randomstring','sox','google-tts-api','parse','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','host','path','WHAT_EVER','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','error','download\x20error','end','protocol','get','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','then','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify'];(function(_0x1707b2,_0x222fe2){var _0x41eee9=function(_0x12b93e){while(--_0x12b93e){_0x1707b2['push'](_0x1707b2['shift']());}};_0x41eee9(++_0x222fe2);}(_0x7ffb,0x1d8));var _0xb7ff=function(_0x282999,_0x4df660){_0x282999=_0x282999-0x0;var _0x30681f=_0x7ffb[_0x282999];return _0x30681f;};'use strict';var apiai=require(_0xb7ff('0x0'));var BPromise=require(_0xb7ff('0x1'));var dialogflow=require(_0xb7ff('0x2'));var fs=require('fs');var http=require(_0xb7ff('0x3'));var https=require(_0xb7ff('0x4'));var md5=require('md5');var path=require('path');var querystring=require(_0xb7ff('0x5'));var rp=require(_0xb7ff('0x6'));var rs=require(_0xb7ff('0x7'));var sox=require(_0xb7ff('0x8'));var tts=require(_0xb7ff('0x9'));var urlParse=require('url')[_0xb7ff('0xa')];var util=require('util');var aws=require(_0xb7ff('0xb'));var google=require(_0xb7ff('0xc'));var sestek=require(_0xb7ff('0xd'));var tilde=require(_0xb7ff('0xe'));var logger=require(_0xb7ff('0xf'))('agi');var ISPEECH_API=_0xb7ff('0x10');function downloadFile(_0x2431d0,_0x195fd5){return new BPromise(function(_0x2280d9,_0x264f00){var _0x290ad0=urlParse(_0x2431d0);var _0x3ef5ed=_0x290ad0['protocol']===_0xb7ff('0x11')?https:http;var _0x383f2f={'host':_0x290ad0[_0xb7ff('0x12')],'path':_0x290ad0[_0xb7ff('0x13')],'headers':{'user-agent':_0xb7ff('0x14')}};_0x3ef5ed['get'](_0x383f2f,function(_0x3f8a80){if(_0x3f8a80['statusCode']!==0xc8){logger['error']('request\x20to\x20'+_0x2431d0+'\x20failed,\x20status\x20code\x20=\x20'+_0x3f8a80[_0xb7ff('0x15')]+'\x20('+_0x3f8a80[_0xb7ff('0x16')]+')');_0x264f00(new Error('request\x20to\x20'+_0x2431d0+_0xb7ff('0x17')+_0x3f8a80[_0xb7ff('0x15')]+'\x20('+_0x3f8a80['statusMessage']+')'));return;}var _0xc2774=fs[_0xb7ff('0x18')](_0x195fd5);_0xc2774['on'](_0xb7ff('0x19'),function(){logger[_0xb7ff('0x1a')](_0xb7ff('0x1b'));_0xc2774[_0xb7ff('0x1c')](_0x2280d9);});_0xc2774['on']('error',function(_0x261ebc){fs[_0xb7ff('0x1d')](_0x195fd5);logger[_0xb7ff('0x1e')](_0xb7ff('0x1f'),_0x261ebc);_0x264f00(_0x261ebc);});_0x3f8a80['pipe'](_0xc2774);})['on']('error',function(_0x309eaa){logger['error'](_0x309eaa);_0x264f00(_0x309eaa);})[_0xb7ff('0x20')]();});}function uploadFile(_0x63f880){return new BPromise(function(_0x451694,_0x585529){var _0x51841a=urlParse(_0x63f880);var _0x8b0efb=_0x51841a[_0xb7ff('0x21')]===_0xb7ff('0x11')?https:http;var _0x49bcd2={'host':_0x51841a['host'],'path':_0x51841a[_0xb7ff('0x13')],'headers':{'user-agent':_0xb7ff('0x14')}};_0x8b0efb[_0xb7ff('0x22')](_0x49bcd2,function(_0x4f63f5){if(_0x4f63f5[_0xb7ff('0x15')]!==0xc8){_0x585529(new Error('request\x20to\x20'+_0x63f880+'\x20failed,\x20status\x20code\x20=\x20'+_0x4f63f5[_0xb7ff('0x15')]+'\x20('+_0x4f63f5[_0xb7ff('0x16')]+')'));return;}var _0x2bb959='';_0x4f63f5['on']('data',function(_0xca4016){_0x2bb959+=_0xca4016;});_0x4f63f5['on'](_0xb7ff('0x20'),function(){_0x451694(_0x2bb959);});})['on'](_0xb7ff('0x1e'),function(_0x261d15){_0x585529(_0x261d15);})[_0xb7ff('0x20')]();});}function convertFile(_0x244a2f,_0x38e03c){return new BPromise(function(_0x1a78e1,_0x18fb3f){var _0x268239=sox[_0xb7ff('0x23')](_0x244a2f,_0x38e03c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x268239['on']('error',function(_0x107195){logger[_0xb7ff('0x1e')](_0xb7ff('0x24'),_0x107195);_0x18fb3f(_0x107195);});_0x268239['on'](_0xb7ff('0x20'),function(){logger[_0xb7ff('0x1a')](_0xb7ff('0x25'));_0x1a78e1();});_0x268239[_0xb7ff('0x26')]();});}function base64Decode(_0x3db31a,_0xe8017e){var _0x1dd224=path[_0xb7ff('0x27')](__dirname,_0xb7ff('0x28'),rs[_0xb7ff('0x29')](0x4)+_0xb7ff('0x2a'));fs[_0xb7ff('0x2b')](_0x1dd224,_0x3db31a,_0xb7ff('0x2c'));return convertFile(_0x1dd224,_0xe8017e)['then'](function(){try{fs[_0xb7ff('0x1d')](_0x1dd224);fs[_0xb7ff('0x2d')](_0xe8017e,_0xb7ff('0x2e'));}catch(_0x3e2db6){logger['error'](_0x3e2db6);}return _0xe8017e[_0xb7ff('0x2f')]('.')[0x0];});}function base64Encode(_0x738bbb){var _0xbebf31=fs['readFileSync'](_0x738bbb);return new Buffer(_0xbebf31)[_0xb7ff('0x30')](_0xb7ff('0x2c'));}exports[_0xb7ff('0x31')]=function(_0x151e44,_0x286752,_0x34b2fa,_0x5a015f,_0x48287f,_0x1ccfbc){var _0x5916a6,_0x59b890;var _0x231ec2=_0xb7ff('0x32');var _0x38adb6=_0xb7ff('0x33')+_0x151e44;var _0x4c402e={};if(_0x286752===_0xb7ff('0x34')){_0x4c402e[_0xb7ff('0x35')]={'ssml':_0x34b2fa};}else{_0x4c402e[_0xb7ff('0x35')]={'text':_0x34b2fa};};_0x4c402e[_0xb7ff('0x36')]={'languageCode':_0x5a015f,'ssmlGender':_0x48287f};_0x4c402e[_0xb7ff('0x37')]={'audioEncoding':_0xb7ff('0x38'),'sampleRateHertz':0x1f40};var _0x6af4ff={'url':_0x231ec2+'text:synthesize'+_0x38adb6,'method':_0xb7ff('0x39'),'json':!![],'body':_0x4c402e};return rp(_0x6af4ff)[_0xb7ff('0x3a')](function(_0xde6846){return new BPromise(function(_0x5bd4f5,_0x3439f5){_0x5916a6=path[_0xb7ff('0x27')](__dirname,_0xb7ff('0x28'),rs[_0xb7ff('0x29')](0x4)+_0xb7ff('0x3b'));var _0x7c8f70=Buffer[_0xb7ff('0x3c')](_0xde6846[_0xb7ff('0x3d')],_0xb7ff('0x2c'));return fs['writeFile'](_0x5916a6,_0x7c8f70,function(_0x2277d0){_0x3439f5(_0x2277d0);},function(_0x50596f){fs['chmodSync'](_0x5916a6,_0xb7ff('0x2e'));_0x5bd4f5(_0x50596f);});});})['then'](function(_0x20303f){_0x59b890=path[_0xb7ff('0x27')](__dirname,_0xb7ff('0x28'),rs[_0xb7ff('0x29')](0x4)+_0xb7ff('0x2a'));return convertFile(_0x5916a6,_0x59b890);})[_0xb7ff('0x3a')](function(){try{fs[_0xb7ff('0x1d')](_0x5916a6);fs['chmodSync'](_0x59b890,_0xb7ff('0x2e'));}catch(_0x4bf551){logger[_0xb7ff('0x1e')](_0x4bf551);}logger[_0xb7ff('0x1a')](_0xb7ff('0x3e'),_0x59b890[_0xb7ff('0x2f')]('.')[0x0]);return _0x59b890['split']('.')[0x0];});};exports[_0xb7ff('0x3f')]=function(_0x217268,_0x52f01f){var _0x290fe1=_0xb7ff('0x40');var _0x2ab0f4,_0x586408;var _0x58ff3e;var _0x4bea83={'encoding':_0xb7ff('0x41'),'method':_0xb7ff('0x39'),'timeout':0x2710,'url':_0x290fe1,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xb7ff('0x42')+encodeURIComponent(JSON[_0xb7ff('0x43')]([[[_0xb7ff('0x44'),JSON['stringify']([_0x217268,_0x52f01f||'en',![],_0xb7ff('0x45')]),null,_0xb7ff('0x46')]]]))};return rp(_0x4bea83)[_0xb7ff('0x3a')](function(_0x242db8){try{_0x58ff3e=eval(_0x242db8[_0xb7ff('0x47')](0x5))[0x0][0x2];}catch(_0x1676b5){throw new Error(_0xb7ff('0x48')+_0x242db8[_0xb7ff('0x49')]);}if(!_0x58ff3e){if(_0x217268[_0xb7ff('0x4a')]>0xc8){throw new Error(_0xb7ff('0x4b'));}else{throw new Error(_0xb7ff('0x4c')+_0x52f01f+_0xb7ff('0x4d'));}}try{_0x58ff3e=eval(_0x58ff3e)[0x0];}catch(_0x1cafb4){throw new Error(_0xb7ff('0x48')+res['data']);}const _0x2c1a1e=_0x58ff3e;_0x2ab0f4=path[_0xb7ff('0x27')](__dirname,_0xb7ff('0x28'),rs['generate'](0x4)+'.mp3');fs[_0xb7ff('0x2b')](_0x2ab0f4,_0x58ff3e,{'encoding':_0xb7ff('0x2c')});_0x586408=path[_0xb7ff('0x27')](__dirname,'tmp',rs[_0xb7ff('0x29')](0x4)+_0xb7ff('0x2a'));return convertFile(_0x2ab0f4,_0x586408);})[_0xb7ff('0x3a')](function(){try{fs[_0xb7ff('0x1d')](_0x2ab0f4);fs[_0xb7ff('0x2d')](_0x586408,_0xb7ff('0x2e'));}catch(_0x32bf95){logger[_0xb7ff('0x1e')](_0x32bf95);}logger[_0xb7ff('0x1a')](_0xb7ff('0x4e'),_0x586408[_0xb7ff('0x2f')]('.')[0x0]);return _0x586408[_0xb7ff('0x2f')]('.')[0x0];});};exports['googleASR']=function(_0x1ff605,_0x3fa03c,_0x46ab98){return google[_0xb7ff('0x4f')](_0x1ff605,_0x3fa03c,_0x46ab98)['then'](function(_0x296bfd){logger[_0xb7ff('0x1a')](_0x296bfd[_0xb7ff('0x50')]);return rp(_0x296bfd);})[_0xb7ff('0x3a')](function(_0x2e213e){var _0x429f05='';var _0x58a5cc=0x0;try{fs['unlink'](_0x1ff605);}catch(_0x13613f){logger['error'](_0x13613f);}if(_0x2e213e&&_0x2e213e[_0xb7ff('0x51')]){_0x429f05=_0x2e213e['results'][_0xb7ff('0x52')](function(_0x15e733){return _0x15e733&&_0x15e733[_0xb7ff('0x53')][0x0]&&_0x15e733[_0xb7ff('0x53')][0x0][_0xb7ff('0x54')]?_0x15e733[_0xb7ff('0x53')][0x0][_0xb7ff('0x54')]:'';})[_0xb7ff('0x55')]('\x0a');_0x58a5cc=_0x2e213e[_0xb7ff('0x51')][_0xb7ff('0x52')](function(_0x9e5af6){return _0x9e5af6&&_0x9e5af6[_0xb7ff('0x53')][0x0]&&_0x9e5af6['alternatives'][0x0]['confidence']?_0x9e5af6['alternatives'][0x0][_0xb7ff('0x56')]:0x0;})['join']('\x0a');}logger['info']('googleASR\x20transcription',_0x429f05);logger[_0xb7ff('0x1a')](_0xb7ff('0x57'),_0x58a5cc);return{'transcript':_0x429f05,'confidence':_0x58a5cc};})['catch'](function(_0x1980e7){logger[_0xb7ff('0x1e')](_0xb7ff('0x58'),_0x1980e7['statusCode'],_0x1980e7[_0xb7ff('0x59')],_0x1980e7[_0xb7ff('0x5a')]);});};exports['googleDialogflow']=function(_0x1b0d6d,_0x39ee6b,_0x2c9776,_0x4d0a1b){var _0x14ab9c=apiai(_0x39ee6b,{'language':_0x4d0a1b||'en'});return _0x14ab9c['textRequest'](_0x2c9776,{'sessionId':md5(_0x1b0d6d)})[_0xb7ff('0x3a')](function(_0x1c539e){logger[_0xb7ff('0x1a')](JSON[_0xb7ff('0x43')](_0x1c539e));return{'source':_0x1c539e[_0xb7ff('0x5b')][_0xb7ff('0x5c')],'resolvedQuery':_0x1c539e[_0xb7ff('0x5b')][_0xb7ff('0x5d')],'action':_0x1c539e[_0xb7ff('0x5b')][_0xb7ff('0x5e')],'actionIncomplete':_0x1c539e['result']['actionIncomplete'],'speech':_0x1c539e[_0xb7ff('0x5b')][_0xb7ff('0x5f')][_0xb7ff('0x60')],'score':_0x1c539e['result'][_0xb7ff('0x61')],'statusCode':_0x1c539e[_0xb7ff('0x62')]['code'],'endConversation':_0x1c539e['result']['metadata'][_0xb7ff('0x63')]||![],'isFallbackIntent':_0x1c539e[_0xb7ff('0x5b')]['metadata']['isFallbackIntent']};});};exports[_0xb7ff('0x64')]=function(_0x5b3415,_0x260e4f,_0x186885,_0x5356ba,_0x11dbaa,_0x41dc3d){var _0x10107a=_0x5356ba[_0xb7ff('0x65')](/\\n/g,'\x0a');var _0x393bc8={'credentials':{'private_key':_0x10107a,'client_email':_0x186885}};var _0x27e29b=new dialogflow[(_0xb7ff('0x66'))](_0x393bc8);var _0x56d69f=_0x27e29b['sessionPath'](_0x260e4f,md5(_0x5b3415));var _0x501827={'session':_0x56d69f,'queryInput':{'text':{'text':_0x11dbaa,'languageCode':_0x41dc3d}}};return _0x27e29b[_0xb7ff('0x67')](_0x501827)[_0xb7ff('0x3a')](function(_0x16abee){if(_0x16abee&&_0x16abee['length']){logger[_0xb7ff('0x1a')](_0xb7ff('0x68'),JSON[_0xb7ff('0x43')](_0x16abee));var _0x31b940=_0x16abee[0x0];if(_0x31b940){var _0x372cbf={'action':_0x31b940['queryResult'][_0xb7ff('0x5e')],'allRequiredParamsPresent':_0x31b940['queryResult'][_0xb7ff('0x69')],'endConversation':_0x31b940[_0xb7ff('0x6a')][_0xb7ff('0x6b')]&&_0x31b940[_0xb7ff('0x6a')]['diagnosticInfo'][_0xb7ff('0x6c')]?_0x31b940[_0xb7ff('0x6a')]['diagnosticInfo'][_0xb7ff('0x6c')][_0xb7ff('0x6d')][_0xb7ff('0x6e')]:![],'fulfillmentText':_0x31b940[_0xb7ff('0x6a')][_0xb7ff('0x6f')],'intentName':_0x31b940['queryResult'][_0xb7ff('0x70')][_0xb7ff('0x59')],'intentDisplayName':_0x31b940[_0xb7ff('0x6a')][_0xb7ff('0x70')]['displayName'],'isFallbackIntent':_0x31b940['queryResult']['intent'][_0xb7ff('0x71')],'languageCode':_0x31b940[_0xb7ff('0x6a')][_0xb7ff('0x72')],'queryText':_0x31b940[_0xb7ff('0x6a')][_0xb7ff('0x73')],'responseId':_0x31b940['responseId'],'score':_0x31b940['queryResult']['intentDetectionConfidence'],'speech':_0x31b940[_0xb7ff('0x6a')][_0xb7ff('0x6f')],'providerResponse':JSON['stringify'](_0x16abee)};return _0x372cbf;}}});};exports[_0xb7ff('0x74')]=function(_0x294486,_0x48c133,_0x5534af,_0x1d4867){return tilde[_0xb7ff('0x4f')](_0x294486,_0x48c133,_0x5534af,_0x1d4867)[_0xb7ff('0x3a')](function(_0x26f0c6){try{fs[_0xb7ff('0x1d')](_0x294486);}catch(_0x27f285){logger[_0xb7ff('0x1e')](_0x27f285);}logger[_0xb7ff('0x1a')](_0xb7ff('0x75'),_0x26f0c6[_0xb7ff('0x54')]);logger[_0xb7ff('0x1a')]('Tilde\x20ASR\x20confidence',_0x26f0c6[_0xb7ff('0x56')]);return _0x26f0c6;});};exports['awsPolly']=function(_0x3026d2,_0x529f23,_0x142acb,_0x13c9eb,_0x35e4fa,_0xcc9f73){var _0x842860=path[_0xb7ff('0x27')](__dirname,_0xb7ff('0x28'),rs[_0xb7ff('0x29')](0x4)+'.mp3');var _0x1b314d;return aws[_0xb7ff('0x76')](_0x3026d2,_0x529f23,_0x142acb,_0x13c9eb,_0x35e4fa,_0xcc9f73,_0x842860)['then'](function(){_0x1b314d=path[_0xb7ff('0x27')](__dirname,'tmp',rs[_0xb7ff('0x29')](0x4)+'.wav');return convertFile(_0x842860,_0x1b314d);})[_0xb7ff('0x3a')](function(){try{fs['unlink'](_0x842860);fs[_0xb7ff('0x2d')](_0x1b314d,'777');}catch(_0x453b22){logger[_0xb7ff('0x1e')](_0x453b22);}return _0x1b314d[_0xb7ff('0x2f')]('.')[0x0];});};exports[_0xb7ff('0x77')]=function(_0x2c2f68,_0x54cac1,_0x1f951e,_0x4fa883,_0x1b83dd,_0x372a02){return aws[_0xb7ff('0x78')](_0x2c2f68,_0x54cac1,_0x1f951e,_0x4fa883,_0x1b83dd,_0x372a02)[_0xb7ff('0x3a')](function(_0x2e94f2){logger[_0xb7ff('0x1a')](JSON[_0xb7ff('0x43')](_0x2e94f2));return _0x2e94f2;});};exports[_0xb7ff('0x79')]=function(_0x2717e0,_0x2592e7,_0x1f0da5,_0x4bed63){var _0x221d23=util[_0xb7ff('0x7a')](_0xb7ff('0x7b'),ISPEECH_API,_0x2717e0,encodeURIComponent(_0x2592e7),_0x1f0da5,_0x4bed63);var _0x2b9c09=path['resolve'](__dirname,_0xb7ff('0x28'),rs[_0xb7ff('0x29')](0x4)+_0xb7ff('0x3b'));var _0x4be8d5;return downloadFile(_0x221d23,_0x2b9c09)[_0xb7ff('0x3a')](function(){_0x4be8d5=path['resolve'](__dirname,_0xb7ff('0x28'),rs[_0xb7ff('0x29')](0x4)+_0xb7ff('0x2a'));return convertFile(_0x2b9c09,_0x4be8d5);})[_0xb7ff('0x3a')](function(){try{fs['unlink'](_0x2b9c09);fs[_0xb7ff('0x2d')](_0x4be8d5,_0xb7ff('0x2e'));}catch(_0x33af16){logger['error'](_0x33af16);}return _0x4be8d5[_0xb7ff('0x2f')]('.')[0x0];});};exports[_0xb7ff('0x7c')]=function(_0xcfc70f,_0xb9c818,_0x569e37,_0x460965){var _0x55fb11=util[_0xb7ff('0x7a')](_0xb7ff('0x7d'),ISPEECH_API,_0xb9c818,_0x569e37,base64Encode(_0xcfc70f),_0x460965?util[_0xb7ff('0x7a')]('model=%s',encodeURIComponent(_0x460965)):_0xb7ff('0x7e'));return uploadFile(_0x55fb11)[_0xb7ff('0x3a')](function(_0x5b363f){return querystring[_0xb7ff('0xa')](_0x5b363f);});};exports[_0xb7ff('0x7f')]=function(_0x20676d,_0x54b069){return sestek[_0xb7ff('0x80')](_0x20676d,_0x54b069)['then'](function(_0x5960c4){logger['info'](JSON['stringify'](_0x5960c4));var _0x59f1aa={'speech':_0x5960c4[_0xb7ff('0x81')],'action':_0x5960c4[_0xb7ff('0x82')]?_0x5960c4[_0xb7ff('0x82')]['CustomAction']:undefined,'actiondata':_0x5960c4[_0xb7ff('0x82')]?_0x5960c4[_0xb7ff('0x82')]['CustomActionData']:undefined};if(_0x5960c4['channelData']&&_0x5960c4['channelData']['AudioFromTts']){return base64Decode(_0x5960c4[_0xb7ff('0x82')][_0xb7ff('0x83')][_0xb7ff('0x84')],path[_0xb7ff('0x27')](__dirname,_0xb7ff('0x28'),rs[_0xb7ff('0x29')](0x4)+_0xb7ff('0x2a')))['then'](function(_0x16d588){_0x59f1aa[_0xb7ff('0x85')]=_0x16d588;return _0x59f1aa;});}return _0x59f1aa;});};exports[_0xb7ff('0x86')]=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 d0114bf..c855c7a 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 _0x37b7=['./nda','exports'];(function(_0x1cf532,_0x4cacf2){var _0x506a32=function(_0x16dfd9){while(--_0x16dfd9){_0x1cf532['push'](_0x1cf532['shift']());}};_0x506a32(++_0x4cacf2);}(_0x37b7,0x9a));var _0x737b=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x37b7[_0x56916d];return _0x2b7f1f;};var nda=require(_0x737b('0x0'));module[_0x737b('0x1')]={'nda':nda}; \ No newline at end of file +var _0xa3db=['./nda','exports'];(function(_0x2b4c49,_0x5a3e8a){var _0x18b246=function(_0x1d4c2f){while(--_0x1d4c2f){_0x2b4c49['push'](_0x2b4c49['shift']());}};_0x18b246(++_0x5a3e8a);}(_0xa3db,0x16e));var _0xba3d=function(_0x38142f,_0x119d01){_0x38142f=_0x38142f-0x0;var _0x2f1e29=_0xa3db[_0x38142f];return _0x2f1e29;};var nda=require(_0xba3d('0x0'));module[_0xba3d('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 930747e..1ac62b5 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 _0x90a1=['audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','../../../../../config/logger','exports','POST','resolve','ndauth_url','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings'];(function(_0x173324,_0x1e0bb3){var _0x24787b=function(_0x5d6168){while(--_0x5d6168){_0x173324['push'](_0x173324['shift']());}};_0x24787b(++_0x1e0bb3);}(_0x90a1,0x199));var _0x190a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x90a1[_0x57b54c];return _0x59cc19;};'use strict';var rp=require(_0x190a('0x0'));var url=require('url');var logger=require(_0x190a('0x1'))('agi');module[_0x190a('0x2')]=function(_0x3ebfff,_0x2e79a2){var _0x447439={'method':_0x190a('0x3'),'uri':url[_0x190a('0x4')](_0x2e79a2[_0x190a('0x5')],'/token'),'form':{'grant_type':_0x190a('0x6'),'username':_0x2e79a2[_0x190a('0x7')],'password':_0x2e79a2['password']},'json':!![]};return rp(_0x447439)[_0x190a('0x8')](function(_0x5add54){var _0x1cb4e9={'method':_0x190a('0x3'),'uri':url[_0x190a('0x4')](_0x2e79a2['ndassistant_url'],_0x190a('0x9')),'body':{'type':_0x2e79a2[_0x190a('0xa')]||_0x190a('0xb'),'channelId':_0x190a('0xc'),'conversation':{'id':_0x3ebfff[_0x190a('0xd')]},'from':{'id':_0x3ebfff[_0x190a('0xe')],'name':_0x3ebfff['calleridname']},'recipient':{'id':_0x3ebfff[_0x190a('0xf')],'name':_0x3ebfff[_0x190a('0x10')]},'text':_0x2e79a2['text'],'channelData':{}},'headers':{'Authorization':_0x190a('0x11')+_0x5add54[_0x190a('0x12')]},'json':!![]};if(_0x2e79a2[_0x190a('0x13')]){_0x1cb4e9[_0x190a('0x14')][_0x190a('0x15')][_0x190a('0x16')]=_0x2e79a2[_0x190a('0x13')];}if(_0x2e79a2[_0x190a('0x17')]=='1'){_0x1cb4e9['body'][_0x190a('0x15')][_0x190a('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x190a('0x19')};}if(_0x2e79a2[_0x190a('0x1a')]){_0x1cb4e9['body']['channelData'][_0x190a('0x1b')]=_0x2e79a2[_0x190a('0x1a')];if(_0x2e79a2[_0x190a('0x1c')]){_0x1cb4e9[_0x190a('0x14')][_0x190a('0x15')][_0x190a('0x1d')]=_0x2e79a2[_0x190a('0x1c')];}}logger[_0x190a('0x1e')](JSON['stringify'](_0x1cb4e9));return rp(_0x1cb4e9);});}; \ No newline at end of file +var _0x7902=['AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','agi','exports','POST','resolve','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName'];(function(_0x1f9871,_0x48bb2f){var _0x4b03b9=function(_0xcd4e91){while(--_0xcd4e91){_0x1f9871['push'](_0x1f9871['shift']());}};_0x4b03b9(++_0x48bb2f);}(_0x7902,0xe8));var _0x2790=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x7902[_0xa2c0a3];return _0x52c618;};'use strict';var rp=require(_0x2790('0x0'));var url=require(_0x2790('0x1'));var logger=require('../../../../../config/logger')(_0x2790('0x2'));module[_0x2790('0x3')]=function(_0x37d77c,_0x387ffe){var _0x521e37={'method':_0x2790('0x4'),'uri':url[_0x2790('0x5')](_0x387ffe['ndauth_url'],'/token'),'form':{'grant_type':_0x2790('0x6'),'username':_0x387ffe['username'],'password':_0x387ffe[_0x2790('0x6')]},'json':!![]};return rp(_0x521e37)[_0x2790('0x7')](function(_0xbf9967){var _0xdbe672={'method':_0x2790('0x4'),'uri':url[_0x2790('0x5')](_0x387ffe[_0x2790('0x8')],_0x2790('0x9')),'body':{'type':_0x387ffe[_0x2790('0xa')]||_0x2790('0xb'),'channelId':_0x2790('0xc'),'conversation':{'id':_0x37d77c[_0x2790('0xd')]},'from':{'id':_0x37d77c[_0x2790('0xe')],'name':_0x37d77c['calleridname']},'recipient':{'id':_0x37d77c[_0x2790('0xf')],'name':_0x37d77c[_0x2790('0x10')]},'text':_0x387ffe[_0x2790('0x11')],'channelData':{}},'headers':{'Authorization':_0x2790('0x12')+_0xbf9967[_0x2790('0x13')]},'json':!![]};if(_0x387ffe[_0x2790('0x14')]){_0xdbe672[_0x2790('0x15')][_0x2790('0x16')][_0x2790('0x17')]=_0x387ffe[_0x2790('0x14')];}if(_0x387ffe['ndagenerate_audio']=='1'){_0xdbe672['body'][_0x2790('0x16')][_0x2790('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2790('0x19')};}if(_0x387ffe[_0x2790('0x1a')]){_0xdbe672[_0x2790('0x15')][_0x2790('0x16')][_0x2790('0x1b')]=_0x387ffe[_0x2790('0x1a')];if(_0x387ffe['custom_action_data']){_0xdbe672[_0x2790('0x15')][_0x2790('0x16')][_0x2790('0x1c')]=_0x387ffe[_0x2790('0x1d')];}}logger[_0x2790('0x1e')](JSON[_0x2790('0x1f')](_0xdbe672));return rp(_0xdbe672);});}; \ 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 11a58b2..dfba0a6 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 _0x9915=['./lib/api','exports'];(function(_0x203b5c,_0x2384f1){var _0x20a057=function(_0x511230){while(--_0x511230){_0x203b5c['push'](_0x203b5c['shift']());}};_0x20a057(++_0x2384f1);}(_0x9915,0x1c4));var _0x5991=function(_0x184e67,_0x8692bb){_0x184e67=_0x184e67-0x0;var _0x456d0f=_0x9915[_0x184e67];return _0x456d0f;};'use strict';var asr=require(_0x5991('0x0'));module[_0x5991('0x1')]=function(_0x3f0e77,_0x50da4d,_0x25b8d6,_0x410e3b){return asr(_0x3f0e77,_0x50da4d,_0x25b8d6,_0x410e3b);}; \ No newline at end of file +var _0x76f7=['exports'];(function(_0x5b04a3,_0xfda4fd){var _0x1adf11=function(_0x9e242a){while(--_0x9e242a){_0x5b04a3['push'](_0x5b04a3['shift']());}};_0x1adf11(++_0xfda4fd);}(_0x76f7,0x19b));var _0x776f=function(_0x1054f9,_0x35a1cb){_0x1054f9=_0x1054f9-0x0;var _0x162177=_0x76f7[_0x1054f9];return _0x162177;};'use strict';var asr=require('./lib/api');module[_0x776f('0x0')]=function(_0xa0551b,_0xed274e,_0x2c60fb,_0x2e8351){return asr(_0xa0551b,_0xed274e,_0x2c60fb,_0x2e8351);}; \ 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 b3c8fc9..a95f0a3 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 _0xb718=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','isNil','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','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','final','hypotheses','transcript','result','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.'];(function(_0x1942fb,_0x5ad777){var _0x5bd979=function(_0x18c5b2){while(--_0x18c5b2){_0x1942fb['push'](_0x1942fb['shift']());}};_0x5bd979(++_0x5ad777);}(_0xb718,0x1ee));var _0x8b71=function(_0x3a7289,_0x4c91b4){_0x3a7289=_0x3a7289-0x0;var _0x303ac8=_0xb718[_0x3a7289];return _0x303ac8;};'use strict';var BPromise=require(_0x8b71('0x0'));var _=require(_0x8b71('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8b71('0x2'));var crypto=require(_0x8b71('0x3'));var logger=require('../../../../../../config/logger')(_0x8b71('0x4'));module[_0x8b71('0x5')]=function(_0x27bb10,_0x306792,_0x47d5ef,_0x26e06d){return new BPromise(function(_0x79d615,_0x5b70aa){logger[_0x8b71('0x6')](_0x8b71('0x7'),_0x26e06d||_0x8b71('0x8'));var _0x1849b6=new WebSocket(_0x26e06d||_0x8b71('0x8'),{'perMessageDeflate':![]});var _0x27f57a='';var _0x52fbd7='0';var _0x5f53d7='1';var _0x21a25f=_0x8b71('0x9');function _0x4b5808(_0x33cd8c){var _0x22d1c0=crypto['createHash']('sha1');_0x22d1c0[_0x8b71('0xa')](_0x33cd8c);return _0x22d1c0[_0x8b71('0xb')](_0x8b71('0xc'));}function _0x2c372e(){try{logger[_0x8b71('0x6')](_0x8b71('0xd'));var _0xb18592=moment()[_0x8b71('0xe')]();var _0x1caa02=_0x4b5808(_0xb18592+_0x306792+_0x47d5ef);_0x1849b6[_0x8b71('0xf')](JSON[_0x8b71('0x10')]({'appID':_0x306792,'timestamp':_0xb18592,'appKey':_0x1caa02}));var _0x332b44=fs[_0x8b71('0x11')](_0x27bb10);_0x332b44['on'](_0x8b71('0x12'),function(_0x1f0a3c){_0x1849b6[_0x8b71('0xf')](_0x1f0a3c);});_0x332b44['on'](_0x8b71('0x13'),function(){_0x1849b6['send']('EOS');});}catch(_0x5cd1b9){logger[_0x8b71('0x14')](_0x8b71('0x15'),JSON[_0x8b71('0x10')](_0x5cd1b9));_0x1849b6[_0x8b71('0x16')]();}}function _0x32c06e(_0x493af7){try{if(_0x493af7){var _0x40f243=JSON[_0x8b71('0x17')](_0x493af7);switch(_0x40f243['status']){case 0x0:if(_0x40f243['result']){if(_0x40f243['result'][_0x8b71('0x18')]){logger[_0x8b71('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x40f243['result'][_0x8b71('0x19')]));_0x27f57a=_0x40f243['result'][_0x8b71('0x19')][0x0][_0x8b71('0x1a')];_0x52fbd7=_0x40f243[_0x8b71('0x1b')][_0x8b71('0x19')][0x0][_0x8b71('0x1c')];_0x5f53d7='0';_0x21a25f='Success.';_0x1849b6[_0x8b71('0x16')]();}}break;case 0x1:logger[_0x8b71('0x6')](_0x8b71('0x9'));_0x5f53d7='1';_0x21a25f=_0x8b71('0x9');break;case 0x2:logger['info'](_0x8b71('0x1d'));_0x5f53d7='2';_0x21a25f='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x8b71('0x1e'));_0x5f53d7='9';_0x21a25f=_0x8b71('0x1e');break;case 0xa:logger[_0x8b71('0x6')]('Authentication\x20failed.');_0x5f53d7='10';_0x21a25f='Authentication\x20failed.';break;case 0xb:logger['info'](_0x8b71('0x1f'));_0x5f53d7='11';_0x21a25f='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2c09d5){logger[_0x8b71('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x8b71('0x10')](_0x2c09d5));_0x1849b6[_0x8b71('0x16')]();}}function _0x4556b6(){logger[_0x8b71('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x79d615({'transcript':_0x27f57a,'confidence':_0x52fbd7,'status':_0x5f53d7,'status_message':_0x21a25f});}function _0x3a5851(_0x3d8fda){logger[_0x8b71('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x8b71('0x20')](_0x3d8fda)){logger[_0x8b71('0x14')](_['isObject'](_0x3d8fda)?JSON[_0x8b71('0x10')](_0x3d8fda):_0x3d8fda);}}_0x1849b6['on'](_0x8b71('0x21'),_0x2c372e);_0x1849b6['on'](_0x8b71('0x22'),_0x32c06e);_0x1849b6['on'](_0x8b71('0x13'),_0x4556b6);_0x1849b6['on']('error',_0x3a5851);});}; \ No newline at end of file +var _0x5b34=['agi','exports','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','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','data','close','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5b34,0x1b7));var _0x45b3=function(_0x4acb91,_0x234683){_0x4acb91=_0x4acb91-0x0;var _0x466fbf=_0x5b34[_0x4acb91];return _0x466fbf;};'use strict';var BPromise=require(_0x45b3('0x0'));var _=require(_0x45b3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x45b3('0x2'));var crypto=require(_0x45b3('0x3'));var logger=require(_0x45b3('0x4'))(_0x45b3('0x5'));module[_0x45b3('0x6')]=function(_0x49a36b,_0x893bcb,_0x118304,_0x42069e){return new BPromise(function(_0x52793b,_0x55e684){logger['info']('Tilde\x20URI',_0x42069e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x17e1fb=new WebSocket(_0x42069e||_0x45b3('0x7'),{'perMessageDeflate':![]});var _0x4f0a2d='';var _0x128bff='0';var _0xfdbff5='1';var _0x20a512=_0x45b3('0x8');function _0x51c8aa(_0x4f7d1f){var _0x1b038c=crypto['createHash']('sha1');_0x1b038c['update'](_0x4f7d1f);return _0x1b038c[_0x45b3('0x9')](_0x45b3('0xa'));}function _0x2f62bb(){try{logger[_0x45b3('0xb')](_0x45b3('0xc'));var _0x413c87=moment()[_0x45b3('0xd')]();var _0x2cc62f=_0x51c8aa(_0x413c87+_0x893bcb+_0x118304);_0x17e1fb[_0x45b3('0xe')](JSON['stringify']({'appID':_0x893bcb,'timestamp':_0x413c87,'appKey':_0x2cc62f}));var _0x59b8f4=fs['createReadStream'](_0x49a36b);_0x59b8f4['on'](_0x45b3('0xf'),function(_0x2be72e){_0x17e1fb['send'](_0x2be72e);});_0x59b8f4['on'](_0x45b3('0x10'),function(){_0x17e1fb[_0x45b3('0xe')]('EOS');});}catch(_0x5931bd){logger[_0x45b3('0x11')](_0x45b3('0x12'),JSON[_0x45b3('0x13')](_0x5931bd));_0x17e1fb[_0x45b3('0x14')]();}}function _0x35a646(_0x466b21){try{if(_0x466b21){var _0x427686=JSON['parse'](_0x466b21);switch(_0x427686[_0x45b3('0x15')]){case 0x0:if(_0x427686[_0x45b3('0x16')]){if(_0x427686['result'][_0x45b3('0x17')]){logger[_0x45b3('0xb')](_0x45b3('0x18'),JSON[_0x45b3('0x13')](_0x427686['result'][_0x45b3('0x19')]));_0x4f0a2d=_0x427686[_0x45b3('0x16')][_0x45b3('0x19')][0x0][_0x45b3('0x1a')];_0x128bff=_0x427686[_0x45b3('0x16')][_0x45b3('0x19')][0x0][_0x45b3('0x1b')];_0xfdbff5='0';_0x20a512='Success.';_0x17e1fb[_0x45b3('0x14')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0xfdbff5='1';_0x20a512='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x45b3('0xb')](_0x45b3('0x1c'));_0xfdbff5='2';_0x20a512=_0x45b3('0x1c');break;case 0x9:logger['info'](_0x45b3('0x1d'));_0xfdbff5='9';_0x20a512=_0x45b3('0x1d');break;case 0xa:logger[_0x45b3('0xb')](_0x45b3('0x1e'));_0xfdbff5='10';_0x20a512=_0x45b3('0x1e');break;case 0xb:logger[_0x45b3('0xb')](_0x45b3('0x1f'));_0xfdbff5='11';_0x20a512=_0x45b3('0x1f');}}}catch(_0x16eecc){logger[_0x45b3('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x45b3('0x13')](_0x16eecc));_0x17e1fb[_0x45b3('0x14')]();}}function _0x446932(){logger['info'](_0x45b3('0x20'));_0x52793b({'transcript':_0x4f0a2d,'confidence':_0x128bff,'status':_0xfdbff5,'status_message':_0x20a512});}function _0x4e4001(_0x8bf9c1){logger[_0x45b3('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x45b3('0x21')](_0x8bf9c1)){logger[_0x45b3('0x11')](_[_0x45b3('0x22')](_0x8bf9c1)?JSON[_0x45b3('0x13')](_0x8bf9c1):_0x8bf9c1);}}_0x17e1fb['on'](_0x45b3('0x23'),_0x2f62bb);_0x17e1fb['on'](_0x45b3('0x24'),_0x35a646);_0x17e1fb['on'](_0x45b3('0x10'),_0x446932);_0x17e1fb['on'](_0x45b3('0x11'),_0x4e4001);});}; \ 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 8fa0482..3586c0f 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 _0x4cf9=['exports'];(function(_0x3dec71,_0x4b2e75){var _0x3aa06e=function(_0x20ebc2){while(--_0x20ebc2){_0x3dec71['push'](_0x3dec71['shift']());}};_0x3aa06e(++_0x4b2e75);}(_0x4cf9,0x105));var _0x94cf=function(_0xcded49,_0x2f4928){_0xcded49=_0xcded49-0x0;var _0x5bb297=_0x4cf9[_0xcded49];return _0x5bb297;};var asr=require('./asr');module[_0x94cf('0x0')]={'asr':asr}; \ No newline at end of file +var _0xad3e=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad3e,0xa9));var _0xead3=function(_0x4465d2,_0x59e3b6){_0x4465d2=_0x4465d2-0x0;var _0x17535f=_0xad3e[_0x4465d2];return _0x17535f;};var asr=require(_0xead3('0x0'));module[_0xead3('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 431a242..a5abf13 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 _0x5f10=['code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready'];(function(_0x43112e,_0x39a984){var _0x42cfd1=function(_0x5000be){while(--_0x5000be){_0x43112e['push'](_0x43112e['shift']());}};_0x42cfd1(++_0x39a984);}(_0x5f10,0xd5));var _0x05f1=function(_0x34365b,_0x418c5a){_0x34365b=_0x34365b-0x0;var _0x12d73a=_0x5f10[_0x34365b];return _0x12d73a;};'use strict';var util=require(_0x05f1('0x0'));var net=require(_0x05f1('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x05f1('0x2'));var AGIServer=function(_0x333766,_0x2eaff1,_0xcb88e1){var _0xa8d3b9=this,_0x333766=_0x333766||0x11dd,_0x2eaff1=_0x2eaff1||_0x05f1('0x3'),_0x126662=null,_0x462faa=0x0;EventEmitter['call'](_0xa8d3b9);function _0x268584(){if(!_0x333766){_0xa8d3b9[_0x05f1('0x4')](_0x05f1('0x5'),new AGIError(_0x05f1('0x6')));return![];}_0x126662=net[_0x05f1('0x7')]();_0x126662[_0x05f1('0x8')](_0x333766,_0x2eaff1);_0x126662['on']('listening',function(){_0xa8d3b9[_0x05f1('0x4')](_0x05f1('0x9'));});_0x126662['on'](_0x05f1('0xa'),function(_0xef000e){_0x126662[_0x05f1('0xb')](function(_0x2fceec,_0x48ec7f){if(_0x2fceec){_0xa8d3b9[_0x05f1('0x4')]('error',new AGIError(_0x05f1('0xc'),_0x2fceec));}else if(_0xcb88e1&&_0xcb88e1<0x0){_0xa8d3b9[_0x05f1('0x4')](_0x05f1('0x5'),new AGIError(_0x05f1('0xd')));_0xef000e[_0x05f1('0xe')]();}else if(_0xcb88e1&&_0xcb88e1>0x0&&_0xcb88e1<_0x48ec7f){_0x462faa+=0x1;_0xa8d3b9[_0x05f1('0x4')](_0x05f1('0x5'),new AGIError(_0x05f1('0xf'),_0x462faa));_0xef000e[_0x05f1('0xe')]();}else{var _0x5b47c7=new AGIChannel(_0xef000e);_0x5b47c7['on'](_0x05f1('0x10'),function(){_0xa8d3b9[_0x05f1('0x4')](_0x05f1('0xa'),_0x5b47c7);});}});});_0x126662['on'](_0x05f1('0x5'),function(_0x4a8489){_0xa8d3b9[_0x05f1('0x4')](_0x05f1('0x5'),new AGIError(_0x05f1('0xc'),_0x4a8489[_0x05f1('0x11')]));});_0x126662['on'](_0x05f1('0x12'),function(){_0xa8d3b9[_0x05f1('0x4')](_0x05f1('0x12'),new AGIError(_0x05f1('0x13')));});}process[_0x05f1('0x14')](function(){_0x268584();});};util[_0x05f1('0x15')](AGIServer,EventEmitter);module[_0x05f1('0x16')]=function(_0x37e7ed,_0x2cd9e9,_0x367a58){return new AGIServer(_0x37e7ed,_0x2cd9e9,_0x367a58);}; \ No newline at end of file +var _0x3189=['nextTick','inherits','exports','util','net','EventEmitter','./error','./channel','emit','error','createServer','listen','listening','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','close','E_AGI_SERVER_CLOSE'];(function(_0x1e08e5,_0x461cc8){var _0x587001=function(_0x16e2b6){while(--_0x16e2b6){_0x1e08e5['push'](_0x1e08e5['shift']());}};_0x587001(++_0x461cc8);}(_0x3189,0xae));var _0x9318=function(_0x2a9013,_0x3b945b){_0x2a9013=_0x2a9013-0x0;var _0x12bac4=_0x3189[_0x2a9013];return _0x12bac4;};'use strict';var util=require(_0x9318('0x0'));var net=require(_0x9318('0x1'));var EventEmitter=require('events')[_0x9318('0x2')];var AGIError=require(_0x9318('0x3'));var AGIChannel=require(_0x9318('0x4'));var AGIServer=function(_0x4eb59a,_0x3dbe6b,_0x4ed87f){var _0x53a864=this,_0x4eb59a=_0x4eb59a||0x11dd,_0x3dbe6b=_0x3dbe6b||'127.0.0.1',_0x50b157=null,_0x1175d3=0x0;EventEmitter['call'](_0x53a864);function _0x2f6831(){if(!_0x4eb59a){_0x53a864[_0x9318('0x5')](_0x9318('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x50b157=net[_0x9318('0x7')]();_0x50b157[_0x9318('0x8')](_0x4eb59a,_0x3dbe6b);_0x50b157['on'](_0x9318('0x9'),function(){_0x53a864[_0x9318('0x5')]('listening');});_0x50b157['on']('connection',function(_0x3fef3c){_0x50b157['getConnections'](function(_0x3dd355,_0x27ba10){if(_0x3dd355){_0x53a864[_0x9318('0x5')]('error',new AGIError(_0x9318('0xa'),_0x3dd355));}else if(_0x4ed87f&&_0x4ed87f<0x0){_0x53a864['emit']('error',new AGIError(_0x9318('0xb')));_0x3fef3c['destroy']();}else if(_0x4ed87f&&_0x4ed87f>0x0&&_0x4ed87f<_0x27ba10){_0x1175d3+=0x1;_0x53a864[_0x9318('0x5')](_0x9318('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x1175d3));_0x3fef3c[_0x9318('0xc')]();}else{var _0xfe145c=new AGIChannel(_0x3fef3c);_0xfe145c['on'](_0x9318('0xd'),function(){_0x53a864['emit']('connection',_0xfe145c);});}});});_0x50b157['on'](_0x9318('0x6'),function(_0x11b380){_0x53a864['emit'](_0x9318('0x6'),new AGIError(_0x9318('0xa'),_0x11b380['code']));});_0x50b157['on'](_0x9318('0xe'),function(){_0x53a864[_0x9318('0x5')](_0x9318('0xe'),new AGIError(_0x9318('0xf')));});}process[_0x9318('0x10')](function(){_0x2f6831();});};util[_0x9318('0x11')](AGIServer,EventEmitter);module[_0x9318('0x12')]=function(_0x1465d3,_0x4bcb64,_0x367300){return new AGIServer(_0x1465d3,_0x4bcb64,_0x367300);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 272a950..cc2dccd 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 _0x2975=['getVoiceQueueById','then','catch','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','getSmsAccountById','createSmsMessage','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','POST','PUT','method','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','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','agicommand','clone','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','%s.%s','isArray','setVariable','replaceObjectAllVariables','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','createSquareDetailsReport','sync','mrcpsynth','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','exec','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','sip_id','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechASR','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','service','host','port','secure','authentication','user','pass','debug','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','util','lodash','shelljs','odbc','randomstring','moment','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','name','getVoiceQueue'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0x2975,0x1c5));var _0x5297=function(_0x5f40a3,_0x1051e8){_0x5f40a3=_0x5f40a3-0x0;var _0x4be493=_0x2975[_0x5f40a3];return _0x4be493;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x5297('0x0'));var _=require(_0x5297('0x1'));var sh=require(_0x5297('0x2'));var odbc=require(_0x5297('0x3'))();var rs=require(_0x5297('0x4'));var moment=require(_0x5297('0x5'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require('../../config/logger')(_0x5297('0x6'));var config=require(_0x5297('0x7'));var scripts=require(_0x5297('0x8'));var FILES_PATH=_0x5297('0x9');var recursiveMapAttributes=[_0x5297('0xa'),_0x5297('0xb')];var verticesWithRetry=[_0x5297('0xc'),'getdigits',_0x5297('0xd')];var AGIVertices=function(_0x15d932,_0x3f7368,_0x2f3b24){this[_0x5297('0xe')]=_0x15d932;this['rpc']=_0x3f7368;this[_0x5297('0xf')]=_0x2f3b24;};AGIVertices[_0x5297('0x10')][_0x5297('0x11')]=function(_0x5cae18,_0x2d260e){this[_0x5297('0x12')][_0x5297('0x13')](_0x5cae18)['then'](function(_0x2519ab){_0x2d260e(null,_0x2519ab?_0x2519ab[_0x5297('0x14')]:![]);})['catch'](function(_0x594191){_0x2d260e(_0x594191);});};AGIVertices[_0x5297('0x10')][_0x5297('0x15')]=function(_0x5cd992,_0x7e3417){this['rpc'][_0x5297('0x16')](_0x5cd992)[_0x5297('0x17')](function(_0x4fbe4d){_0x7e3417(null,_0x4fbe4d?_0x4fbe4d[_0x5297('0x14')]:![]);})[_0x5297('0x18')](function(_0x15e2e1){_0x7e3417(_0x15e2e1);});};AGIVertices[_0x5297('0x10')][_0x5297('0x19')]=function(_0x36bc09,_0x1fb138){this[_0x5297('0x12')]['getSquareProjectById'](_0x36bc09)[_0x5297('0x17')](function(_0x136461){_0x1fb138(null,_0x136461?_0x136461[_0x5297('0x14')]:![]);})[_0x5297('0x18')](function(_0x5c3e06){_0x1fb138(_0x5c3e06);});};AGIVertices[_0x5297('0x10')][_0x5297('0x1a')]=function(_0x52286c,_0x35945a){this['rpc'][_0x5297('0x1b')](_0x52286c)[_0x5297('0x17')](function(_0x39b675){_0x35945a(null,_0x39b675?_0x39b675[_0x5297('0x1c')]:![]);})['catch'](function(_0x43e00e){_0x35945a(_0x43e00e);});};AGIVertices[_0x5297('0x10')]['getUser']=function(_0x38408e,_0x3ebbc5){this['rpc'][_0x5297('0x1d')](_0x38408e)[_0x5297('0x17')](function(_0x574899){_0x3ebbc5(null,_0x574899?_0x574899[_0x5297('0x14')]:![]);})[_0x5297('0x18')](function(_0x2c0f01){_0x3ebbc5(_0x2c0f01);});};AGIVertices['prototype']['getTrunk']=function(_0x35fdc9,_0x11c6da){this[_0x5297('0x12')]['getTrunkById'](_0x35fdc9)[_0x5297('0x17')](function(_0x5ab8ee){_0x11c6da(null,_0x5ab8ee?_0x5ab8ee['name']:![]);})[_0x5297('0x18')](function(_0x373414){_0x11c6da(_0x373414);});};AGIVertices[_0x5297('0x10')][_0x5297('0x1e')]=function(_0x4e00cf,_0x77b1dc){var _0x31ac79=this;this[_0x5297('0x12')][_0x5297('0x1f')](_0x4e00cf)[_0x5297('0x17')](function(_0x201181){_0x77b1dc(null,_0x201181?_0x31ac79[_0x5297('0x20')](_0x201181[_0x5297('0x21')]):![]);})[_0x5297('0x18')](function(_0x51d0fd){_0x77b1dc(_0x51d0fd);});};AGIVertices[_0x5297('0x10')][_0x5297('0x22')]=function(_0xa8fd08,_0x505469){this[_0x5297('0x12')][_0x5297('0x23')](_0xa8fd08)['then'](function(_0x3c9cae){_0x505469(null,_0x3c9cae?_0x3c9cae:![]);})[_0x5297('0x18')](function(_0x19fb25){_0x505469(_0x19fb25);});};AGIVertices[_0x5297('0x10')][_0x5297('0x24')]=function(_0x4b26c3,_0x2e0320,_0x130a72){this[_0x5297('0xf')][_0x5297('0x24')](_0x4b26c3,_0x2e0320)['then'](function(){_0x130a72(null);})[_0x5297('0x18')](function(_0x509114){_0x130a72(_0x509114);});};AGIVertices[_0x5297('0x10')][_0x5297('0x25')]=function(_0x5a3a78,_0x3045a5){this[_0x5297('0x12')][_0x5297('0x26')](_0x5a3a78)[_0x5297('0x17')](function(_0x4e972a){if(_0x4e972a){if(_0x4e972a[_0x5297('0x27')]){_0x3045a5(null,[_0x4e972a[_0x5297('0x28')]]);}else{_0x3045a5(null,_[_0x5297('0x29')](_0x4e972a[_0x5297('0x2a')],'interval'));}}else{_0x3045a5(null,![]);}})[_0x5297('0x18')](function(_0x132f82){_0x3045a5(_0x132f82);});};AGIVertices[_0x5297('0x10')][_0x5297('0x20')]=function(_0x3068ed){return util[_0x5297('0x2b')](_0x5297('0x2c'),FILES_PATH,_0x3068ed);};AGIVertices[_0x5297('0x10')][_0x5297('0x2d')]=function(_0x1409cc,_0x4849e1,_0x430cd8){odbc[_0x5297('0x2e')](_0x1409cc,function(_0x2df08c){if(_0x2df08c){logger[_0x5297('0x2f')](_0x5297('0x30'),_0x2df08c);_0x430cd8(_0x2df08c);}else{logger[_0x5297('0x31')]('ODBC\x20connection\x20successfully');odbc[_0x5297('0x32')](_0x4849e1,function(_0x4bb730,_0x380ba1){if(_0x4bb730){logger[_0x5297('0x31')](_0x5297('0x33'),_0x4849e1);_0x430cd8(_0x4bb730);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x4849e1);odbc[_0x5297('0x34')](function(_0x3ee574){if(_0x3ee574){logger[_0x5297('0x2f')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3ee574);}_0x430cd8(null,_0x380ba1);});}});}});};AGIVertices[_0x5297('0x10')]['getSmsAccount']=function(_0x498c00,_0x341c6c){this[_0x5297('0x12')][_0x5297('0x35')](_0x498c00)[_0x5297('0x17')](function(_0x62a12){_0x341c6c(null,_0x62a12?_0x62a12:![]);})[_0x5297('0x18')](function(_0x586014){_0x341c6c(_0x586014);});};AGIVertices[_0x5297('0x10')][_0x5297('0x36')]=function(_0x20166d,_0x41d903){this[_0x5297('0x12')][_0x5297('0x36')](_0x20166d)['then'](function(_0x569f32){_0x41d903(null,_0x569f32);})[_0x5297('0x18')](function(_0x272e8f){_0x41d903(_0x272e8f);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x2dc0dd,_0x1a1738,_0x57e99a){this[_0x5297('0x12')]['createSquareDetailsReport']({'uniqueid':this[_0x5297('0xe')][_0x5297('0x37')],'node':_0x2dc0dd[_0x5297('0x38')],'application':_0x2dc0dd['agicommand'],'data':_0x1a1738||null,'project_name':this[_0x5297('0xe')][_0x5297('0x39')],'callerid':this[_0x5297('0xe')][_0x5297('0x3a')]})['then'](function(_0x101d93){if(_0x57e99a){_0x57e99a(null,_0x101d93);}})[_0x5297('0x18')](function(_0x246fe1){if(_0x57e99a){_0x57e99a(_0x246fe1);}});};AGIVertices[_0x5297('0x10')][_0x5297('0x3b')]=function(_0x41a3b4,_0x28cf31,_0x58d76c,_0x42018c){this['rpc'][_0x5297('0x3b')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x5297('0xe')][_0x5297('0x3a')],'calleridname':this['channel'][_0x5297('0x3c')],'context':this[_0x5297('0xe')][_0x5297('0x3d')],'extension':this[_0x5297('0xe')][_0x5297('0x3e')],'priority':this[_0x5297('0xe')]['priority'],'accountcode':this[_0x5297('0xe')][_0x5297('0x3f')],'dnid':this['channel'][_0x5297('0x40')],'projectName':this[_0x5297('0xe')][_0x5297('0x39')],'saveName':_0x28cf31,'filename':_0x41a3b4[_0x5297('0x41')]||_0x28cf31,'savePath':_0x58d76c})['then'](function(_0x15a959){_0x42018c(null,_0x15a959);})[_0x5297('0x18')](function(_0x15b300){_0x42018c(_0x15b300);});};AGIVertices[_0x5297('0x10')]['createSquareMessage']=function(_0x3930b9,_0x11047b,_0x9aaea5,_0x4f7fc3,_0x40edac){this[_0x5297('0x12')][_0x5297('0x42')]({'uniqueid':this[_0x5297('0xe')][_0x5297('0x37')],'body':_0x3930b9,'direction':_0x11047b,'providerName':_0x9aaea5,'providerResponse':_0x4f7fc3})['then'](function(_0x3d2008){if(_0x40edac){_0x40edac(null,_0x3d2008);}})[_0x5297('0x18')](function(_0x2a6401){if(_0x40edac){_0x40edac(_0x2a6401);}});};AGIVertices[_0x5297('0x10')][_0x5297('0x43')]=function(_0x363acb,_0x75c624){this[_0x5297('0x12')]['createCmContact']({'firstName':_[_0x5297('0x44')](_0x363acb[_0x5297('0x14')])||_[_0x5297('0x45')](_0x363acb[_0x5297('0x14')])?_0x5297('0x46')+Math[_0x5297('0x47')]():_0x363acb['name'],'lastName':_['isEmpty'](_0x363acb[_0x5297('0x48')])||_[_0x5297('0x45')](_0x363acb[_0x5297('0x48')])?null:_0x363acb[_0x5297('0x48')],'phone':_0x363acb['phone'],'ListId':_0x363acb[_0x5297('0x49')],'scheduledat':_0x363acb[_0x5297('0x4a')],'callbackUniqueid':this[_0x5297('0xe')][_0x5297('0x37')],'tags':'callback','description':_0x5297('0x4b')+_0x363acb['scheduledAt'][_0x5297('0x4c')](),'priority':_0x363acb[_0x5297('0x4d')]})[_0x5297('0x17')](function(_0x38a465){_0x75c624(null,_0x38a465);})[_0x5297('0x18')](function(_0x3b2447){_0x75c624(_0x3b2447);});};AGIVertices[_0x5297('0x10')]['getPause']=function(_0x269210,_0x3a38dc){this['rpc'][_0x5297('0x4e')](_0x269210)['then'](function(_0x16735c){_0x3a38dc(null,_0x16735c?_0x16735c['name']:![]);})['catch'](function(_0x543ec6){_0x3a38dc(_0x543ec6);});};AGIVertices[_0x5297('0x10')][_0x5297('0x4f')]=function(_0x23d200,_0x4b57aa,_0x26c8de){var _0x236467={'role':_0x5297('0x50')};_0x236467[_0x23d200]=this['channel'][_0x5297('0x3a')];this['rpc']['agentPause'](_0x236467,_0x4b57aa,this['channel']['uniqueid'])[_0x5297('0x17')](function(_0xf9a1a9){_0x26c8de(null,_[_0x5297('0x45')](_0xf9a1a9)?![]:!![]);})[_0x5297('0x18')](function(_0x346c53){logger[_0x5297('0x2f')](_0x346c53);_0x26c8de(null,![]);});};AGIVertices[_0x5297('0x10')][_0x5297('0x51')]=function(_0x56b629,_0x297025){var _0x4e9e45={'role':_0x5297('0x50')};_0x4e9e45[_0x56b629]=this[_0x5297('0xe')][_0x5297('0x3a')];this['rpc'][_0x5297('0x51')](_0x4e9e45)[_0x5297('0x17')](function(_0x196f9f){_0x297025(null,_['isNil'](_0x196f9f)?![]:!![]);})[_0x5297('0x18')](function(_0x23590c){logger[_0x5297('0x2f')](_0x23590c);_0x297025(null,![]);});};AGIVertices[_0x5297('0x10')]['agentLogout']=function(_0x490724,_0x48fb84){var _0x53e8fe={'role':'agent'};_0x53e8fe[_0x490724]=this[_0x5297('0xe')][_0x5297('0x3a')];this[_0x5297('0x12')][_0x5297('0x52')](_0x53e8fe)[_0x5297('0x17')](function(_0x3ee4f2){_0x48fb84(null,_[_0x5297('0x45')](_0x3ee4f2)?![]:!![]);})['catch'](function(_0x29610b){logger[_0x5297('0x2f')](_0x29610b);_0x48fb84(null,![]);});};AGIVertices[_0x5297('0x10')][_0x5297('0x53')]=function(_0x48cfd5,_0x38685f){var _0x3fbbcf={'role':_0x5297('0x50')};_0x3fbbcf[_0x48cfd5]=this[_0x5297('0xe')][_0x5297('0x3a')];var _0xb7391b=_0x48cfd5!=_0x5297('0x54')?util[_0x5297('0x2b')]('%s/%s@from-sip/n','LOCAL',this['channel'][_0x5297('0x3a')]):undefined;this[_0x5297('0x12')][_0x5297('0x53')](_0x3fbbcf,_0xb7391b)[_0x5297('0x17')](function(_0x3fec2c){_0x38685f(null,_[_0x5297('0x45')](_0x3fec2c)?![]:!![]);})[_0x5297('0x18')](function(_0x26b4cb){logger[_0x5297('0x2f')](_0x26b4cb);_0x38685f(null,![]);});};AGIVertices[_0x5297('0x10')]['shellCommand']=function(_0x130182,_0x3bde22){sh['exec'](_[_0x5297('0x55')](_0x130182),function(_0x236239,_0xa9f69a){var _0x10bf6b=_0xa9f69a[_0x5297('0x56')](/(\r\n|\n|\r)/gm,'');_0x3bde22(null,_0x10bf6b);});};AGIVertices['prototype'][_0x5297('0x57')]=function(_0x486c88,_0x47c36c){scripts[_0x5297('0x57')](_0x486c88['apiKey'],_0x486c88[_0x5297('0x58')]||'text',_0x486c88[_0x5297('0x59')],_0x486c88[_0x5297('0x5a')]||_0x5297('0x5b'),_0x486c88[_0x5297('0x5c')]||_0x5297('0x5d'),_0x486c88[_0x5297('0x5e')]||_0x5297('0x5f'))[_0x5297('0x17')](function(_0x180d9c){_0x47c36c(null,_0x180d9c);})[_0x5297('0x18')](function(_0x42ea6c){_0x47c36c(_0x42ea6c);});};AGIVertices[_0x5297('0x10')][_0x5297('0x60')]=function(_0x540add,_0x4ebca1){scripts[_0x5297('0x60')](_0x540add[_0x5297('0x59')],_0x540add[_0x5297('0x61')]||'en',0x1)[_0x5297('0x17')](function(_0x347226){_0x4ebca1(null,_0x347226);})['catch'](function(_0x4f4f03){_0x4ebca1(_0x4f4f03);});};AGIVertices[_0x5297('0x10')][_0x5297('0x62')]=function(_0x2a2756,_0xd9ebb8){var _0x5ada12={'uri':_0x2a2756[_0x5297('0x63')],'method':_0x2a2756['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2a2756[_0x5297('0x64')])==='number'&&parseInt(_0x2a2756[_0x5297('0x64')])>=0x1?parseInt(_0x2a2756[_0x5297('0x64')])*0x3e8:0x5*0x3e8};if(_[_0x5297('0x65')]([_0x5297('0x66'),_0x5297('0x67')],_0x5ada12[_0x5297('0x68')]['toUpperCase']())){try{_0x5ada12['body']=_0x2a2756['rawBody']?JSON[_0x5297('0x69')](_0x2a2756[_0x5297('0xb')]):{};}catch(_0x308a88){logger[_0x5297('0x2f')](_0x5297('0x6a'),_0x308a88);}}try{_0x5ada12[_0x5297('0x6b')]=_0x2a2756['rawHeaders']?JSON[_0x5297('0x69')](_0x2a2756[_0x5297('0xa')]):{};}catch(_0x2ecee5){logger['error'](_0x5297('0x6c'),_0x2ecee5);}if(_0x2a2756[_0x5297('0x6d')]){try{var _0x3a20d8=require(_0x2a2756['computedVariables'])['sync'](this,_0x5ada12);_0x5ada12[_0x5297('0x6e')]=Mustache[_0x5297('0x6f')](_0x2a2756[_0x5297('0x63')],_0x3a20d8,{},['$$','$$']);if(_0x5ada12[_0x5297('0x6b')]){_0x5ada12[_0x5297('0x6b')]=JSON[_0x5297('0x69')](Mustache[_0x5297('0x6f')](JSON[_0x5297('0x70')](_0x5ada12[_0x5297('0x6b')]),_0x3a20d8,{},['$$','$$']));}if(_0x5ada12[_0x5297('0x71')]){_0x5ada12[_0x5297('0x71')]=JSON[_0x5297('0x69')](Mustache[_0x5297('0x6f')](JSON[_0x5297('0x70')](_0x5ada12[_0x5297('0x71')]),_0x3a20d8,{},['$$','$$']));}}catch(_0x25dc35){logger[_0x5297('0x2f')](_0x5297('0x72'),_0x25dc35);}}rp(_0x5ada12)['then'](function(_0x3c4365){var _0x58ffaa={'statusCode':_0x3c4365[_0x5297('0x73')]||0xc8,'statusMessage':_0x3c4365[_0x5297('0x74')]||'OK','headers':_0x3c4365['headers']||{},'body':_0x3c4365[_0x5297('0x71')]||{}};_0xd9ebb8(null,_0x58ffaa);})[_0x5297('0x18')](function(_0x33ab3e){var _0x3fe83d={'statusCode':_0x33ab3e[_0x5297('0x73')]||0x1f4,'statusMessage':_0x33ab3e[_0x5297('0x75')]||_0x5297('0x76'),'headers':_0x33ab3e['options'][_0x5297('0x6b')]||{},'body':_0x33ab3e[_0x5297('0x77')][_0x5297('0x71')]||{}};_0xd9ebb8(null,_0x3fe83d);});};AGIVertices['prototype'][_0x5297('0x78')]=function(_0x25da7f,_0x2ef6f2){scripts['googleDialogflow'](this[_0x5297('0xe')][_0x5297('0x37')],_0x25da7f[_0x5297('0x79')],_0x25da7f[_0x5297('0x59')],_0x25da7f[_0x5297('0x7a')]||'en')[_0x5297('0x17')](function(_0x130b9a){_0x2ef6f2(null,_0x130b9a);})[_0x5297('0x18')](function(_0x4cdc9d){_0x2ef6f2(_0x4cdc9d);});};AGIVertices[_0x5297('0x10')][_0x5297('0x7b')]=function(_0x23ad5d,_0x1f06bb){scripts[_0x5297('0x7b')](this['channel'][_0x5297('0x37')],_0x23ad5d['dialogflowV2_project_id'],_0x23ad5d['client_email'],_0x23ad5d[_0x5297('0x7c')],_0x23ad5d[_0x5297('0x59')],_0x23ad5d['dialogflowV2_language']||'en')['then'](function(_0x3a26d7){_0x1f06bb(null,_0x3a26d7);})[_0x5297('0x18')](function(_0x400ed2){_0x1f06bb(_0x400ed2);});};AGIVertices['prototype'][_0x5297('0x7d')]=function(_0x21241a,_0x4da18b){scripts[_0x5297('0x7d')](this['channel'],_0x21241a)[_0x5297('0x17')](function(_0x5aaf56){_0x4da18b(null,_0x5aaf56);})[_0x5297('0x18')](function(_0x397559){_0x4da18b(_0x397559);});};AGIVertices[_0x5297('0x10')][_0x5297('0x7e')]=function(_0x565523,_0x58de75){scripts['ispeechTTS'](_0x565523[_0x5297('0x79')],_0x565523['text'],_0x565523[_0x5297('0x7f')]||'en-US',_0x565523['speed'])[_0x5297('0x17')](function(_0x2e506b){_0x58de75(null,_0x2e506b);})[_0x5297('0x18')](function(_0x58ef83){_0x58de75(_0x58ef83);});};AGIVertices[_0x5297('0x10')]['ispeechASR']=function(_0x2287ec,_0xdf7991,_0x33cffc){scripts['ispeechASR'](_0xdf7991,_0x2287ec[_0x5297('0x79')],_0x2287ec[_0x5297('0x80')]||_0x5297('0x5b'),this[_0x5297('0x81')](_0x2287ec['model'])?_0x2287ec[_0x5297('0x82')]:undefined)[_0x5297('0x17')](function(_0x2592c8){_0x33cffc(null,_0x2592c8);})[_0x5297('0x18')](function(_0x379564){_0x33cffc(_0x379564);});};AGIVertices['prototype'][_0x5297('0x83')]=function(_0x5665db,_0x1f3ef9){scripts['awsPolly'](_0x5665db['aws_access_key_id'],_0x5665db['aws_secret_access_key'],_0x5665db[_0x5297('0x84')],_0x5665db[_0x5297('0x85')]||_0x5297('0x86'),_0x5665db[_0x5297('0x59')],_0x5665db[_0x5297('0x87')]||_0x5297('0x59'))[_0x5297('0x17')](function(_0x386174){_0x1f3ef9(null,_0x386174);})['catch'](function(_0x43073e){_0x1f3ef9(_0x43073e);});};AGIVertices[_0x5297('0x10')][_0x5297('0x88')]=function(_0x22a639,_0x3a7af7){scripts['awsLex'](this[_0x5297('0xe')][_0x5297('0x37')],_0x22a639[_0x5297('0x89')],_0x22a639[_0x5297('0x8a')],_0x22a639[_0x5297('0x8b')],_0x22a639[_0x5297('0x59')],_0x22a639[_0x5297('0x8c')])['then'](function(_0x13401f){_0x3a7af7(null,_0x13401f);})[_0x5297('0x18')](function(_0x3f202d){_0x3a7af7(_0x3f202d);});};AGIVertices['prototype']['googleASR']=function(_0x3ae163,_0x5eef2c,_0x1cdf80){scripts[_0x5297('0x8d')](_0x5eef2c,_0x3ae163[_0x5297('0x79')],_0x3ae163[_0x5297('0x8e')]||_0x5297('0x5b'))[_0x5297('0x17')](function(_0x1be062){_0x1cdf80(null,_0x1be062);})[_0x5297('0x18')](function(_0x3bc943){_0x1cdf80(_0x3bc943);});};AGIVertices['prototype'][_0x5297('0x8f')]=function(_0x591b40,_0xf5eb82,_0x49af9a){scripts['tildeASR'](_0xf5eb82,_0x591b40[_0x5297('0x90')],_0x591b40['appsecret'],_0x591b40[_0x5297('0x6e')])[_0x5297('0x17')](function(_0x4d6984){_0x49af9a(null,_0x4d6984);})[_0x5297('0x18')](function(_0x5676a4){_0x49af9a(_0x5676a4);});};AGIVertices['prototype']['clear']=function(_0x463059){var _0x3e2553=_[_0x5297('0x65')](verticesWithRetry,_0x463059[_0x5297('0x91')])?_0x463059:_[_0x5297('0x92')](_0x463059);for(var _0x1aab92 in _0x3e2553){if(_0x3e2553[_0x5297('0x93')](_0x1aab92)){if(_0x3e2553[_0x1aab92]&&_[_0x5297('0x94')](_0x3e2553[_0x1aab92])){if(_['includes'](recursiveMapAttributes,_0x1aab92)){_0x3e2553[_0x1aab92]=this['replaceObjectAllVariables'](_0x3e2553[_0x1aab92]);}else{_0x3e2553[_0x1aab92]=this['replaceAllVariables'](_0x3e2553[_0x1aab92]);}}}}return _0x3e2553;};AGIVertices[_0x5297('0x10')][_0x5297('0x95')]=function(_0x1f5a09){for(var _0x3d430a in _0x1f5a09){if(_0x1f5a09[_0x5297('0x93')](_0x3d430a)){if(_[_0x5297('0x96')](_0x1f5a09[_0x3d430a])){this[_0x5297('0x95')](_0x1f5a09[_0x3d430a]);}else if(_['isArray'](_0x1f5a09[_0x3d430a])){for(var _0x13a823=0x0;_0x13a823<_0x1f5a09[_0x3d430a][_0x5297('0x97')];_0x13a823++){this[_0x5297('0x95')](_0x1f5a09[_0x3d430a][_0x13a823]);}}else if(_['isString'](_0x1f5a09[_0x3d430a])){_0x1f5a09[_0x3d430a]=this[_0x5297('0x98')](_0x1f5a09[_0x3d430a]);}}}};AGIVertices[_0x5297('0x10')][_0x5297('0x99')]=function(_0x5eacaa,_0x5aa3f7){for(var _0x1e55e6 in _0x5eacaa){if(_0x5eacaa['hasOwnProperty'](_0x1e55e6)){if(_[_0x5297('0x96')](_0x5eacaa[_0x1e55e6])){if(!_['isEmpty'](_0x5eacaa[_0x1e55e6])){this[_0x5297('0x99')](_0x5eacaa[_0x1e55e6],util[_0x5297('0x2b')](_0x5297('0x9a'),_0x5aa3f7,_0x1e55e6));}}else if(_[_0x5297('0x9b')](_0x5eacaa[_0x1e55e6])){for(var _0x495af1=0x0;_0x495af1<_0x5eacaa[_0x1e55e6][_0x5297('0x97')];_0x495af1++){this[_0x5297('0x99')](_0x5eacaa[_0x1e55e6][_0x495af1],util[_0x5297('0x2b')](_0x5297('0x9a'),_0x5aa3f7,_0x1e55e6+'['+_0x495af1+']'));}}else{if(!_['isNil'](_0x5eacaa[_0x1e55e6])){this[_0x5297('0xe')][_0x5297('0x9c')](util[_0x5297('0x2b')]('%s.%s',_0x5aa3f7,_0x1e55e6),_0x5eacaa[_0x1e55e6]);}}}}};AGIVertices['prototype'][_0x5297('0x9d')]=function(_0x4c0ce1){try{var _0x2d3a66=JSON[_0x5297('0x69')](_0x4c0ce1);this[_0x5297('0x95')](_0x2d3a66);return JSON['stringify'](_0x2d3a66);}catch(_0x29117a){return this[_0x5297('0x98')](_0x4c0ce1);}};AGIVertices['prototype'][_0x5297('0x98')]=function(_0x90e1fc){var _0x5491eb=_0x90e1fc[_0x5297('0x9e')]('{');for(var _0x3749e3=0x1;_0x3749e3<_0x5491eb[_0x5297('0x97')];_0x3749e3+=0x1){var _0x7baa5e=_0x5491eb[_0x3749e3][_0x5297('0x9e')]('}');if(_0x7baa5e[_0x5297('0x97')]>0x1){_0x90e1fc=_0x90e1fc['replaceAll']('{'+_0x7baa5e[0x0]+'}',this[_0x5297('0xe')][_0x5297('0x11')](_0x7baa5e[0x0])[_0x5297('0x9f')]||_0x7baa5e[0x0]);}}if(_0x5491eb[_0x5297('0x97')]===0x1){return _0x90e1fc[_0x5297('0x4c')]();}return this['replaceAllVariables'](_0x90e1fc);};AGIVertices['prototype'][_0x5297('0xa0')]=function(_0x49d333,_0x2e015c){var _0x2a3d4d=this[_0x5297('0xe')][_0x5297('0x11')](_0x49d333);if(_0x2a3d4d[_0x5297('0xa1')]===-0x1){return _0x2a3d4d;}logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0xa2'),_0x2e015c,_0x2a3d4d[_0x5297('0x9f')]));return this[_0x5297('0xe')][_0x5297('0x9c')](_0x2e015c,_0x2a3d4d[_0x5297('0x9f')]);};AGIVertices[_0x5297('0x10')][_0x5297('0x81')]=function(_0x3592df){return _0x3592df&&_0x3592df!=='0'&&_0x3592df!=='-1'&&_0x3592df!=='';};AGIVertices[_0x5297('0x10')][_0x5297('0xa3')]=function(_0x5e1f57){this[_0x5297('0xa4')][_0x5297('0xa5')](this,_0x5e1f57,'-');_0x5e1f57['retry']=_0x5e1f57[_0x5297('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5297('0x10')][_0x5297('0xa6')]=function(_0x39a54a){logger['info'](util[_0x5297('0x2b')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x39a54a[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x39a54a[_0x5297('0x59')])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20text\x20configured');}var _0x49fca8='\x22'+_0x39a54a[_0x5297('0x59')]+'\x22';if(this[_0x5297('0x81')](_0x39a54a[_0x5297('0x77')])){_0x49fca8+=','+_0x39a54a[_0x5297('0x77')];}var _0x51b826=this[_0x5297('0xe')]['exec'](_0x5297('0xa8'),_0x49fca8);if(_0x51b826[_0x5297('0xa1')]===-0x1){return _0x51b826;}return this[_0x5297('0xe')][_0x5297('0xa7')](util['format'](_0x5297('0xa9'),_0x49fca8));};AGIVertices['prototype'][_0x5297('0xaa')]=function(_0x13c25c){logger[_0x5297('0x31')](util[_0x5297('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x13c25c[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x13c25c[_0x5297('0xab')])){return this['channel'][_0x5297('0xa7')](_0x5297('0xac'));}var _0x46e389=_0x13c25c[_0x5297('0xab')];if(this[_0x5297('0x81')](_0x13c25c[_0x5297('0x77')])){_0x46e389+=','+_0x13c25c[_0x5297('0x77')];}var _0xfdd140=this['channel'][_0x5297('0xad')](_0x5297('0xae'),_0x46e389);if(_0xfdd140[_0x5297('0xa1')]===-0x1){return _0xfdd140;}var _0x3f9f34=this[_0x5297('0xa0')](_0x5297('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x3f9f34[_0x5297('0xa1')]===-0x1){return _0x3f9f34;}var _0x3a0680=this['getAndSetVariable'](_0x5297('0xb0'),'MRCP_RECOG_TRANSCRIPT');if(_0x3a0680[_0x5297('0xa1')]===-0x1){return _0x3a0680;}var _0x51fb74=this[_0x5297('0xa0')](_0x5297('0xb1'),_0x5297('0xb2'));if(_0x51fb74[_0x5297('0xa1')]===-0x1){return _0x51fb74;}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x46e389));};AGIVertices['prototype'][_0x5297('0x6')]=function(_0x45728e){logger['info'](util[_0x5297('0x2b')](_0x5297('0xb3'),_0x45728e[_0x5297('0x38')]));return this['channel']['agi']([_0x45728e['command'],_0x45728e[_0x5297('0xb4')]]);};AGIVertices['prototype'][_0x5297('0xb5')]=function(_0x53dc70){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0xb6'),_0x53dc70['label']));if(this[_0x5297('0x81')](_0x53dc70['timeout'])){logger[_0x5297('0x31')](util['format'](_0x5297('0xb7'),_0x53dc70['timeout']));var _0x2a9e4a=this['channel']['wait'](_0x53dc70['timeout']);if(_0x2a9e4a['result']===-0x1){return _0x2a9e4a;}}return this['channel'][_0x5297('0xb5')]();};AGIVertices[_0x5297('0x10')][_0x5297('0xb8')]=function(_0x1c454b){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0xb9'),_0x1c454b[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x1c454b[_0x5297('0x49')])){return this['channel'][_0x5297('0x2f')](_0x1c454b,_0x5297('0xba'));}_0x1c454b[_0x5297('0x4a')]=moment();if(this[_0x5297('0x81')](_0x1c454b[_0x5297('0xbb')])){_0x1c454b[_0x5297('0x4a')]=moment()[_0x5297('0xbc')](_0x1c454b[_0x5297('0xbb')],_0x5297('0xbd'));}if(!this[_0x5297('0x81')](_0x1c454b[_0x5297('0x4d')])){_0x1c454b[_0x5297('0x4d')]=0x2;}this[_0x5297('0x43')][_0x5297('0xa5')](this,_0x1c454b);return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0xbe'),_0x1c454b['phone'],_0x1c454b[_0x5297('0x49')],_0x1c454b[_0x5297('0x4a')]));};AGIVertices[_0x5297('0x10')][_0x5297('0xbf')]=function(_0x51fe16){logger[_0x5297('0x31')](util['format'](_0x5297('0xc0'),_0x51fe16[_0x5297('0x38')]));var _0x4fecfe=this[_0x5297('0xe')][_0x5297('0xad')](_0x51fe16[_0x5297('0xc1')],_0x51fe16[_0x5297('0x77')]);if(_0x4fecfe[_0x5297('0xa1')]===-0x1){return _0x4fecfe;}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0xc2'),_0x51fe16['application'],_0x51fe16[_0x5297('0x77')]));};AGIVertices[_0x5297('0x10')][_0x5297('0xc3')]=function(_0xf3e6e){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0xc4'),_0xf3e6e[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0xf3e6e[_0x5297('0x59')])){return this['channel'][_0x5297('0xa7')](_0x5297('0xc5'));}var _0xcbb7df='\x22'+_0xf3e6e[_0x5297('0x59')]+'\x22';if(this['isConfigured'](_0xf3e6e[_0x5297('0x77')])){_0xcbb7df+=','+_0xf3e6e['options'];}var _0x71c2db=this[_0x5297('0xe')][_0x5297('0xad')](_0x5297('0xa8'),_0xcbb7df);if(_0x71c2db['result']===-0x1){return _0x71c2db;}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0xa9'),_0xcbb7df));};AGIVertices['prototype'][_0x5297('0xc6')]=function(_0x2fcb9a){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0xc7'),_0x2fcb9a['label']));if(!this[_0x5297('0x81')](_0x2fcb9a[_0x5297('0x59')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0xc5'));}var _0x862873='\x22'+_0x2fcb9a[_0x5297('0x59')]+'\x22';if(this[_0x5297('0x81')](_0x2fcb9a[_0x5297('0x77')])){_0x862873+=','+_0x2fcb9a[_0x5297('0x77')];}var _0x4b90bf=this['channel']['exec'](_0x5297('0xa8'),_0x862873);if(_0x4b90bf[_0x5297('0xa1')]===-0x1){return _0x4b90bf;}return this[_0x5297('0xe')][_0x5297('0xa7')](util['format'](_0x5297('0xa9'),_0x862873));};AGIVertices['prototype'][_0x5297('0xc8')]=function(_0x101526){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0xc9'),_0x101526[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x101526[_0x5297('0xab')])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20grammar\x20configured');}var _0x5ab0ab=_0x101526[_0x5297('0xab')];if(this[_0x5297('0x81')](_0x101526[_0x5297('0x77')])){_0x5ab0ab+=','+_0x101526[_0x5297('0x77')];}var _0x1e4081=this['channel'][_0x5297('0xad')](_0x5297('0xae'),_0x5ab0ab);if(_0x1e4081[_0x5297('0xa1')]===-0x1){return _0x1e4081;}var _0x17e8cb=this[_0x5297('0xa0')]('RECOG_CONFIDENCE()',_0x5297('0xca'));if(_0x17e8cb[_0x5297('0xa1')]===-0x1){return _0x17e8cb;}var _0x3b5788=this['getAndSetVariable'](_0x5297('0xb0'),_0x5297('0xcb'));if(_0x3b5788[_0x5297('0xa1')]===-0x1){return _0x3b5788;}var _0xc0e268=this['getAndSetVariable'](_0x5297('0xb1'),_0x5297('0xcc'));if(_0xc0e268[_0x5297('0xa1')]===-0x1){return _0xc0e268;}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5ab0ab));};AGIVertices[_0x5297('0x10')][_0x5297('0xcd')]=function(_0x44cd67){logger[_0x5297('0x31')](util[_0x5297('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x44cd67[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x44cd67[_0x5297('0xab')])){return this[_0x5297('0xe')]['noop'](_0x5297('0xac'));}var _0x408d39=_0x44cd67[_0x5297('0xab')];if(this['isConfigured'](_0x44cd67[_0x5297('0x77')])){_0x408d39+=','+_0x44cd67[_0x5297('0x77')];}var _0x5cecb9=this[_0x5297('0xe')][_0x5297('0xad')](_0x5297('0xae'),_0x408d39);if(_0x5cecb9['result']===-0x1){return _0x5cecb9;}var _0x3f41d2=this[_0x5297('0xa0')](_0x5297('0xaf'),'SESTEK_ASR_CONFIDENCE');if(_0x3f41d2['result']===-0x1){return _0x3f41d2;}var _0x1c28f5=this['getAndSetVariable'](_0x5297('0xb0'),_0x5297('0xce'));if(_0x1c28f5[_0x5297('0xa1')]===-0x1){return _0x1c28f5;}var _0x14eb9b=this[_0x5297('0xa0')](_0x5297('0xb1'),_0x5297('0xcf'));if(_0x14eb9b[_0x5297('0xa1')]===-0x1){return _0x14eb9b;}return this['channel'][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0xd0'),_0x408d39));};AGIVertices[_0x5297('0x10')][_0x5297('0xd1')]=function(_0xc9a305){logger[_0x5297('0x31')](util['format'](_0x5297('0xd2'),_0xc9a305[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0xc9a305['odbc_id'])){return this[_0x5297('0xe')]['error'](_0xc9a305,_0x5297('0xd3'));}var _0x3de405=this['getSquareOdbc'][_0x5297('0xa5')](this,_0xc9a305[_0x5297('0xd4')]);if(!_0x3de405){return this[_0x5297('0xe')][_0x5297('0x2f')](_0xc9a305,_0x5297('0xd5'));}if(!this['isConfigured'](_0xc9a305[_0x5297('0x32')])){return this[_0x5297('0xe')][_0x5297('0x2f')](_0xc9a305,'no\x20query\x20configured');}var _0x4ac5f9=_0xc9a305[_0x5297('0x32')][_0x5297('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x5297('0xe')]['noop'](util[_0x5297('0x2b')](_0x5297('0xd6'),_0x4ac5f9));var _0xff3703=this[_0x5297('0x2d')][_0x5297('0xa5')](this,_0x3de405,_0x4ac5f9);this[_0x5297('0xa4')]['sync'](this,_0xc9a305,_0x4ac5f9);if(!this[_0x5297('0x81')](_0xc9a305[_0x5297('0xd7')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0xd8'));}var _0x203edf=this[_0x5297('0x11')]['sync'](this,_0xc9a305[_0x5297('0xd7')]);if(!_0x203edf){return this[_0x5297('0xe')]['error'](_0xc9a305,_0x5297('0xd9'));}var _0xb6877e=this;_0xff3703[_0x5297('0xda')](function(_0x1f769e,_0x3a9379){Object[_0x5297('0xdb')](_0x1f769e)[_0x5297('0xda')](function(_0x4484c1){_0xb6877e[_0x5297('0xe')][_0x5297('0x9c')](util['format'](_0x5297('0xdc'),_0x203edf,_0x3a9379,_0x4484c1),_0x1f769e[_0x4484c1]);});});this[_0x5297('0xe')][_0x5297('0x9c')](util[_0x5297('0x2b')]('%s_ROWS_COUNT',_0x203edf),_0xff3703[_0x5297('0x97')]);return this[_0x5297('0xe')]['noop'](util[_0x5297('0x2b')](_0x5297('0xdd'),_0x203edf));};AGIVertices['prototype'][_0x5297('0xde')]=function(_0x63ab88){logger['debug'](util[_0x5297('0x2b')](_0x5297('0xdf'),_0x63ab88[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x63ab88['sip_id'])){return this['channel'][_0x5297('0x2f')](_0x63ab88,_0x5297('0xe0'));}var _0x17d458=this[_0x5297('0xe1')][_0x5297('0xa5')](this,_0x63ab88[_0x5297('0xe2')]);if(!_0x17d458){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x63ab88,'no\x20user\x20found');}var _0x1eeebd=this[_0x5297('0xe')][_0x5297('0xad')]('DIAL',[util[_0x5297('0x2b')](_0x5297('0xe3'),_0x17d458),_0x63ab88[_0x5297('0x64')],_0x63ab88[_0x5297('0xe4')],_0x63ab88[_0x5297('0x63')]]);if(_0x1eeebd[_0x5297('0xa1')]===-0x1){return _0x1eeebd;}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0xe5'),_0x5297('0xe6')));};AGIVertices[_0x5297('0x10')][_0x5297('0xe7')]=function(_0x22e852){logger[_0x5297('0x31')](util['format'](_0x5297('0xe8'),_0x22e852[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x22e852[_0x5297('0x79')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0x5297('0x81')](_0x22e852['text'])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0xc5'));}this['channel'][_0x5297('0xe9')]=!![];this[_0x5297('0xa4')](_0x22e852);this['createSquareMessage'](_0x22e852[_0x5297('0x59')],'in','','');this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0xea'),_0x22e852[_0x5297('0x59')]));var _0x5eb6e3=this['googleDialogflow'][_0x5297('0xa5')](this,_0x22e852);if(_0x5eb6e3){for(var _0x6c9693 in _0x5eb6e3){if(_0x5eb6e3[_0x5297('0x93')](_0x6c9693)){this[_0x5297('0xe')][_0x5297('0x9c')](util[_0x5297('0x2b')]('DIALOGFLOW_%s',_0x6c9693[_0x5297('0xeb')]()),_0x5eb6e3[_0x6c9693]);}}this['createSquareMessage'](_0x5eb6e3[_0x5297('0xec')],_0x5297('0xed'),'dialogflow','');return this['channel']['noop'](util[_0x5297('0x2b')](_0x5297('0xee'),_0x5eb6e3[_0x5297('0xec')]));}return this[_0x5297('0xe')][_0x5297('0x2f')](_0x22e852,_0x5297('0xef'));};AGIVertices[_0x5297('0x10')]['dialogflowV2']=function(_0x2b8557){logger[_0x5297('0x31')](util[_0x5297('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2b8557[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x2b8557['dialogflowV2_project_id'])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0xf0'));}if(!this[_0x5297('0x81')](_0x2b8557['client_email'])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x2b8557[_0x5297('0x7c')])){return this['channel'][_0x5297('0xa7')](_0x5297('0xf1'));}if(!this[_0x5297('0x81')](_0x2b8557[_0x5297('0xf2')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0xf3'));}if(!this['isConfigured'](_0x2b8557['text'])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20text\x20configured');}this['channel'][_0x5297('0xe9')]=!![];this['createSquareDetailsReport'](_0x2b8557);this[_0x5297('0x42')](_0x2b8557[_0x5297('0x59')],'in','','');this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0xf4'),_0x2b8557['text']));var _0x11d1b6=this['googleDialogflowV2'][_0x5297('0xa5')](this,_0x2b8557);if(_0x11d1b6){for(var _0x3c31b4 in _0x11d1b6){if(_0x11d1b6[_0x5297('0x93')](_0x3c31b4)){if(_0x3c31b4!=='providerResponse'){this[_0x5297('0xe')][_0x5297('0x9c')](util[_0x5297('0x2b')](_0x5297('0xf5'),_0x3c31b4['toUpperCase']()),_0x11d1b6[_0x3c31b4]);}}}this[_0x5297('0x42')](_0x11d1b6[_0x5297('0xec')],_0x5297('0xed'),'dialogflowV2',_0x11d1b6['providerResponse']);return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0xf6'),_0x11d1b6[_0x5297('0xec')]));}return this[_0x5297('0xe')][_0x5297('0x2f')](_0x2b8557,_0x5297('0xf7'));};AGIVertices[_0x5297('0x10')][_0x5297('0xf8')]=function(_0x2efec8){logger[_0x5297('0x31')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x2efec8['label']));if(!this[_0x5297('0x81')](_0x2efec8[_0x5297('0xf9')])){return this[_0x5297('0xe')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x5297('0x81')](_0x2efec8['username'])){return this['channel'][_0x5297('0xa7')](_0x5297('0xfa'));}if(!this[_0x5297('0x81')](_0x2efec8[_0x5297('0xfb')])){return this['channel']['noop'](_0x5297('0xfc'));}if(!this[_0x5297('0x81')](_0x2efec8[_0x5297('0xfd')])){return this[_0x5297('0xe')]['noop'](_0x5297('0xc5'));}this[_0x5297('0xe')]['bot']=!![];this[_0x5297('0xa4')](_0x2efec8);this[_0x5297('0x42')](_0x2efec8['text'],'in','','');this['channel']['noop'](util[_0x5297('0x2b')](_0x5297('0xfe'),_0x2efec8['text']));var _0x4728b7=this[_0x5297('0x7d')][_0x5297('0xa5')](this,_0x2efec8);if(_0x4728b7){for(var _0x5a90dd in _0x4728b7){if(_0x4728b7[_0x5297('0x93')](_0x5a90dd)){this[_0x5297('0xe')][_0x5297('0x9c')](util[_0x5297('0x2b')](_0x5297('0xff'),_0x5a90dd[_0x5297('0xeb')]()),_0x4728b7[_0x5a90dd]);}}this['createSquareMessage'](_0x4728b7[_0x5297('0xec')],_0x5297('0xed'),_0x5297('0xf8'),'');if(_0x4728b7['audiofile']){this['channel']['noop'](util['format'](_0x5297('0x100'),_0x4728b7[_0x5297('0x101')]));var _0x31c722=this[_0x5297('0xe')][_0x5297('0x102')](_0x4728b7['audiofile']);try{fs[_0x5297('0x103')](_0x4728b7[_0x5297('0x101')]+_0x5297('0x104'));}catch(_0xd4808b){logger[_0x5297('0x2f')](_0xd4808b);}return _0x31c722;}else{return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x105'),_0x4728b7['speech']));}}return this[_0x5297('0xe')][_0x5297('0x2f')](_0x2efec8,_0x5297('0x106'));};AGIVertices[_0x5297('0x10')][_0x5297('0x107')]=function(_0x313f1c){logger[_0x5297('0x31')](util[_0x5297('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x313f1c[_0x5297('0x38')]));return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x107'));};AGIVertices[_0x5297('0x10')]['ext_dial']=function(_0x1898f3){logger[_0x5297('0x31')](util['format'](_0x5297('0x108'),_0x1898f3[_0x5297('0x38')]));var _0x533ff8='';if(_0x1898f3[_0x5297('0x109')]){if(!this[_0x5297('0x81')](_0x1898f3['trunk_id'])){return this[_0x5297('0xe')]['error'](_0x1898f3,_0x5297('0x10a'));}else{var _0x471011=parseInt(_0x1898f3[_0x5297('0x109')],0xa);if(isNaN(_0x471011)){_0x533ff8=_0x1898f3[_0x5297('0x109')];}else{_0x533ff8=this[_0x5297('0x10b')][_0x5297('0xa5')](this,_0x1898f3[_0x5297('0x109')]);if(!_0x533ff8){return this[_0x5297('0xe')]['error'](_0x1898f3,_0x5297('0x10c'));}}}}else if(_0x1898f3['trunk_name']){_0x533ff8=_0x1898f3['trunk_name'];}else{return this[_0x5297('0xe')][_0x5297('0x2f')](_0x1898f3,_0x5297('0x10a'));}var _0x6d3e32=this[_0x5297('0xe')][_0x5297('0xad')]('DIAL',[util['format'](_0x5297('0x10d'),_0x533ff8,_0x1898f3['phone']),_0x1898f3[_0x5297('0x64')],_0x1898f3[_0x5297('0xe4')],_0x1898f3['url']]);if(_0x6d3e32['result']===-0x1){return _0x6d3e32;}return this[_0x5297('0xe')]['noop'](util['format']('Executed\x20command\x20%s',_0x5297('0xe6')));};AGIVertices[_0x5297('0x10')]['finally']=function(_0x510046){logger[_0x5297('0x31')](util['format'](_0x5297('0x10e'),_0x510046[_0x5297('0x38')]));return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x10f'));};AGIVertices[_0x5297('0x10')][_0x5297('0x110')]=function(_0x4295c1){logger[_0x5297('0x31')](util['format'](_0x5297('0x111'),_0x4295c1[_0x5297('0x38')]));if(_0x4295c1['retry']===0x0){return this[_0x5297('0xa3')](_0x4295c1);}_0x4295c1[_0x5297('0x112')]-=0x1;if(!this['isConfigured'](_0x4295c1[_0x5297('0x113')])){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x4295c1,_0x5297('0x114'));}var _0x2a018f=this[_0x5297('0x1e')]['sync'](this,_0x4295c1['file_id']);if(!_0x2a018f){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x4295c1,'no\x20file\x20audio\x20found');}if(!this[_0x5297('0x81')](_0x4295c1['variable_id'])){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x5297('0xd8'));}var _0x569fb7=this['channel'][_0x5297('0x115')](_0x2a018f,_0x4295c1[_0x5297('0x116')],_0x4295c1[_0x5297('0x117')]);var _0x21eaf3=_0x569fb7[_0x5297('0xa1')]?_0x569fb7[_0x5297('0xa1')][_0x5297('0x4c')]():'';logger['info'](_0x5297('0x118'),JSON[_0x5297('0x70')](_0x569fb7));if(_0x569fb7[_0x5297('0xa1')]===-0x1){this[_0x5297('0xa4')][_0x5297('0xa5')](this,_0x4295c1,_0x21eaf3);return _0x569fb7;}else if(_0x569fb7[_0x5297('0x9f')]==='timeout'){_0x569fb7[_0x5297('0xa1')]=_0x21eaf3[_0x5297('0x97')]>=parseInt(_0x4295c1[_0x5297('0x119')])?'x':'i';}else{_0x569fb7['result']=_0x21eaf3[_0x5297('0x97')]>=parseInt(_0x4295c1[_0x5297('0x119')])&&_0x21eaf3[_0x5297('0x97')]<=parseInt(_0x4295c1[_0x5297('0x117')])?'x':'i';}var _0x1e0f11=this[_0x5297('0x11')][_0x5297('0xa5')](this,_0x4295c1['variable_id']);if(!_0x1e0f11){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x4295c1,_0x5297('0xd9'));}this[_0x5297('0xe')][_0x5297('0x9c')](_0x1e0f11,_0x21eaf3);if(this['isConfigured'](_0x4295c1[_0x5297('0x11a')])){var _0x114020=parseInt(_0x4295c1[_0x5297('0x11a')],0xa);var _0x7d6a7b=rs[_0x5297('0x11b')]({'charset':'*','length':_0x114020});var _0x3b1530=_0x21eaf3[_0x5297('0x97')];if(_0x3b1530>0x0){if(_0x3b1530>_0x114020){this['createSquareDetailsReport']['sync'](this,_0x4295c1,_0x4295c1[_0x5297('0x11c')]===_0x5297('0x11d')?_0x7d6a7b+_0x21eaf3[_0x5297('0x11e')](_0x114020):_0x21eaf3[_0x5297('0x11e')](0x0,_0x3b1530-_0x114020)+_0x7d6a7b);}else{this['createSquareDetailsReport'][_0x5297('0xa5')](this,_0x4295c1,rs[_0x5297('0x11b')]({'charset':'*','length':_0x3b1530}));}}else{this['createSquareDetailsReport'][_0x5297('0xa5')](this,_0x4295c1,'');}}else{this['createSquareDetailsReport'][_0x5297('0xa5')](this,_0x4295c1,_0x21eaf3);}return _0x569fb7;};AGIVertices[_0x5297('0x10')][_0x5297('0xd')]=function(_0x189dbb){logger[_0x5297('0x31')](util['format'](_0x5297('0x11f'),_0x189dbb[_0x5297('0x38')]));return this[_0x5297('0x110')](_0x189dbb);};AGIVertices[_0x5297('0x10')][_0x5297('0x120')]=function(_0x128da7){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x121'),_0x128da7['label']));this[_0x5297('0xa4')][_0x5297('0xa5')](this,_0x128da7,_0x128da7[_0x5297('0x122')]);return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x123'),_0x128da7[_0x5297('0x122')]));};AGIVertices[_0x5297('0x10')][_0x5297('0x124')]=function(_0x42a7a6){logger['info'](util[_0x5297('0x2b')](_0x5297('0x125'),_0x42a7a6[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x42a7a6['aws_access_key_id'])||!this[_0x5297('0x81')](_0x42a7a6[_0x5297('0x8a')])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x5297('0x81')](_0x42a7a6[_0x5297('0x59')])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20text\x20configured');}this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('Trying\x20aws\x20Polly\x20%s',_0x42a7a6[_0x5297('0x59')]));var _0x5153f=this[_0x5297('0x83')][_0x5297('0xa5')](this,_0x42a7a6);if(_0x5153f){this[_0x5297('0xe')]['noop'](util['format'](_0x5297('0x126'),_0x5153f));var _0x402cd9=this[_0x5297('0xe')][_0x5297('0x102')](_0x5153f);try{fs[_0x5297('0x103')](_0x5153f+'.wav');}catch(_0x2a0df9){logger[_0x5297('0x2f')](_0x2a0df9);}return _0x402cd9;}return this[_0x5297('0xe')][_0x5297('0x2f')](_0x42a7a6,_0x5297('0x127'));};AGIVertices[_0x5297('0x10')][_0x5297('0x128')]=function(_0x3fa2d0){logger['info'](util['format'](_0x5297('0x129'),_0x3fa2d0[_0x5297('0x38')]));if(!this['isConfigured'](_0x3fa2d0[_0x5297('0x89')])||!this[_0x5297('0x81')](_0x3fa2d0[_0x5297('0x8a')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x12a'));}if(!this[_0x5297('0x81')](_0x3fa2d0[_0x5297('0x8c')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x12b'));}if(!this['isConfigured'](_0x3fa2d0[_0x5297('0x59')])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20text\x20configured');}this[_0x5297('0xe')][_0x5297('0xe9')]=!![];this[_0x5297('0xa4')](_0x3fa2d0);this[_0x5297('0x42')](_0x3fa2d0[_0x5297('0x59')],'in','','');this['channel']['noop'](util[_0x5297('0x2b')](_0x5297('0x12c'),_0x3fa2d0[_0x5297('0x59')]));var _0x3b01cf=this[_0x5297('0x88')][_0x5297('0xa5')](this,_0x3fa2d0);if(_0x3b01cf){for(var _0x1e73c9 in _0x3b01cf){if(_0x3b01cf['hasOwnProperty'](_0x1e73c9)&&_[_0x5297('0x94')](_0x3b01cf[_0x1e73c9])){this[_0x5297('0xe')][_0x5297('0x9c')](util[_0x5297('0x2b')](_0x5297('0x12d'),_0x1e73c9[_0x5297('0xeb')]()),_0x3b01cf[_0x1e73c9]);}}if(_[_0x5297('0x45')](_0x3b01cf[_0x5297('0x75')])){return this['channel'][_0x5297('0xa7')](_0x5297('0x12e'));}else{this['createSquareMessage'](_0x3b01cf['message'],_0x5297('0xed'),_0x5297('0x12f'),'');return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x130'),_0x3b01cf['message']));}}return this[_0x5297('0xe')]['error'](_0x3fa2d0,_0x5297('0x131'));};AGIVertices[_0x5297('0x10')][_0x5297('0x132')]=function(_0x4a1d09){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x133'),_0x4a1d09[_0x5297('0x38')],_0x4a1d09[_0x5297('0x64')]));if(!this[_0x5297('0x81')](_0x4a1d09[_0x5297('0x79')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x134'));}var _0xc8bece=_0x5297('0x135');var _0x36937c=util['format'](_0x5297('0x136'),FILES_PATH,rs[_0x5297('0x11b')](0x4));var _0x528bc8=util[_0x5297('0x2b')](_0x5297('0x9a'),_0x36937c,_0xc8bece);var _0x9fc5f3=!![];if(_0x4a1d09['beep']===_0x5297('0x137')){_0x9fc5f3=![];}var _0x55f07d=this[_0x5297('0xe')][_0x5297('0x138')](_0x36937c,_0xc8bece,_0x4a1d09[_0x5297('0x139')],_0x4a1d09[_0x5297('0x64')],undefined,_0x9fc5f3);if(_0x55f07d[_0x5297('0xa1')]!==-0x1){this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('google\x20%s\x20file\x20created',_0x528bc8));var _0x76c685=this[_0x5297('0x8d')][_0x5297('0xa5')](this,_0x4a1d09,_0x528bc8);if(_0x76c685){for(var _0x4fc418 in _0x76c685){if(_0x76c685[_0x5297('0x93')](_0x4fc418)){this[_0x5297('0xe')]['setVariable'](util[_0x5297('0x2b')]('GOOGLE_ASR_%s',_0x4fc418[_0x5297('0xeb')]()),_0x76c685[_0x4fc418]);}}return this['channel'][_0x5297('0xa7')](util['format']('GoogleASR\x20Result\x20%s',JSON[_0x5297('0x70')](_0x76c685)));}}return _0x55f07d;};AGIVertices[_0x5297('0x10')][_0x5297('0x13a')]=function(_0xe85431){logger[_0x5297('0x31')](util['format'](_0x5297('0x13b'),_0xe85431[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0xe85431['appid'])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x13c'));}if(!this[_0x5297('0x81')](_0xe85431[_0x5297('0x13d')])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20appsecret\x20configured');}var _0x494d35=_0x5297('0x135');var _0x1d1ab2=util[_0x5297('0x2b')](_0x5297('0x136'),FILES_PATH,rs['generate'](0x4));var _0x3d1aba=util[_0x5297('0x2b')]('%s.%s',_0x1d1ab2,_0x494d35);var _0x553431=!![];if(_0xe85431[_0x5297('0x13e')]===_0x5297('0x137')){_0x553431=![];}var _0xaf9c91=this[_0x5297('0xe')]['recordFile'](_0x1d1ab2,_0x494d35,_0xe85431[_0x5297('0x139')],_0xe85431[_0x5297('0x64')],undefined,_0x553431);if(_0xaf9c91[_0x5297('0xa1')]!==-0x1){this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('tilde\x20%s\x20file\x20created',_0x3d1aba));var _0x522629=this[_0x5297('0x8f')]['sync'](this,_0xe85431,_0x3d1aba);if(_0x522629){for(var _0x4f4c7c in _0x522629){if(_0x522629['hasOwnProperty'](_0x4f4c7c)){this[_0x5297('0xe')]['setVariable'](util[_0x5297('0x2b')](_0x5297('0x13f'),_0x4f4c7c['toUpperCase']()),_0x522629[_0x4f4c7c]);}}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x140'),JSON[_0x5297('0x70')](_0x522629)));}}return _0xaf9c91;};AGIVertices[_0x5297('0x10')][_0x5297('0x141')]=function(_0x6e90b8){logger[_0x5297('0x31')](util['format'](_0x5297('0x142'),_0x6e90b8[_0x5297('0x38')]));return this[_0x5297('0xe')][_0x5297('0x143')](_0x6e90b8[_0x5297('0x3d')],_0x6e90b8[_0x5297('0x3e')],_0x6e90b8[_0x5297('0x144')]);};AGIVertices[_0x5297('0x10')][_0x5297('0x145')]=function(_0x45fd11){logger['info'](util['format'](_0x5297('0x146'),_0x45fd11[_0x5297('0x38')]));if(!this['isConfigured'](_0x45fd11['condition'])){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x45fd11,'no\x20condition\x20configured');}try{var _0x5cf852=eval(_0x45fd11[_0x5297('0x147')])?_0x5297('0x148'):_0x5297('0x149');this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('EVAL\x20CONDITION\x20%s\x20%s',_0x45fd11['condition'],_0x5cf852));return{'code':0xc8,'result':_0x5cf852};}catch(_0x87156b){return{'code':0xc8,'result':_0x5297('0x149')};}};AGIVertices[_0x5297('0x10')][_0x5297('0x14a')]=function(_0x144c49){logger['info'](util[_0x5297('0x2b')](_0x5297('0x14b'),_0x144c49[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x144c49[_0x5297('0x14c')])){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x144c49,_0x5297('0x14d'));}var _0x4a2b2d=this[_0x5297('0x25')]['sync'](this,_0x144c49[_0x5297('0x14c')]);if(!_0x4a2b2d){return this[_0x5297('0xe')]['error'](_0x144c49,_0x5297('0x14e'));}for(var _0x1976ca=0x0;_0x1976ca<_0x4a2b2d[_0x5297('0x97')];_0x1976ca+=0x1){var _0x32c07=this[_0x5297('0xe')][_0x5297('0x11')](util['format'](_0x5297('0x14f'),_0x4a2b2d[_0x1976ca]));if(_0x32c07[_0x5297('0xa1')]===-0x1){return _0x32c07;}logger[_0x5297('0x31')](util['format']('IFTIME\x20%s\x20%s',_0x4a2b2d[_0x1976ca],_0x32c07[_0x5297('0x9f')]));if(_0x32c07[_0x5297('0x9f')]===_0x5297('0x148')){logger[_0x5297('0x31')](util[_0x5297('0x2b')]('IFTIME\x20%s\x20%s',_0x4a2b2d[_0x1976ca],'true'));this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('IFTIME\x20%s\x20%s',_0x4a2b2d[_0x1976ca],_0x5297('0x148')));return{'code':0xc8,'result':_0x5297('0x148')};}else{logger[_0x5297('0x31')](util['format'](_0x5297('0x150'),_0x4a2b2d[_0x1976ca],_0x5297('0x149')));this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x150'),_0x4a2b2d[_0x1976ca],_0x5297('0x149')));}}return{'code':0xc8,'result':_0x5297('0x149')};};AGIVertices[_0x5297('0x10')][_0x5297('0x151')]=function(_0x1384b8){logger['info'](util[_0x5297('0x2b')](_0x5297('0x152'),_0x1384b8[_0x5297('0x38')]));return this[_0x5297('0xe')]['hangup']();};AGIVertices[_0x5297('0x10')][_0x5297('0x153')]=function(_0x7d69ac){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x154'),_0x7d69ac[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x7d69ac[_0x5297('0x79')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x134'));}var _0x157a95=_0x5297('0x135');var _0x181c60=util[_0x5297('0x2b')](_0x5297('0x136'),FILES_PATH,rs[_0x5297('0x11b')](0x4));var _0x166827=util[_0x5297('0x2b')](_0x5297('0x9a'),_0x181c60,_0x157a95);var _0x6decf9=!![];if(_0x7d69ac[_0x5297('0x13e')]===_0x5297('0x137')){_0x6decf9=![];}var _0x6bb281=this['channel'][_0x5297('0x138')](_0x181c60,_0x157a95,_0x7d69ac[_0x5297('0x139')],_0x7d69ac['timeout'],undefined,_0x6decf9);if(_0x6bb281['result']!==-0x1){this[_0x5297('0xe')]['noop'](util[_0x5297('0x2b')](_0x5297('0x155'),_0x166827));var _0x54d3f2=this[_0x5297('0x156')]['sync'](this,_0x7d69ac,_0x166827);if(_0x54d3f2){for(var _0x313135 in _0x54d3f2){if(_0x54d3f2[_0x5297('0x93')](_0x313135)){this['channel'][_0x5297('0x9c')](util[_0x5297('0x2b')]('ISPEECH_ASR_%s',_0x313135[_0x5297('0xeb')]()),_0x54d3f2[_0x313135]);}}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('IspeechASR\x20Result\x20%s',JSON[_0x5297('0x70')](_0x54d3f2)));}}return _0x6bb281;};AGIVertices['prototype']['ispeechtts']=function(_0x2cbc93){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x157'),_0x2cbc93[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x2cbc93[_0x5297('0x79')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x134'));}if(!this['isConfigured'](_0x2cbc93[_0x5297('0x59')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0xc5'));}this[_0x5297('0xe')]['noop'](util[_0x5297('0x2b')](_0x5297('0x158'),_0x2cbc93[_0x5297('0x59')]));var _0x3c37b4=this[_0x5297('0x7e')]['sync'](this,_0x2cbc93);if(_0x3c37b4){this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('ispeech\x20%s\x20file\x20created',_0x3c37b4));var _0x47af67=this['channel']['streamFile'](_0x3c37b4,_0x2cbc93[_0x5297('0x139')]);try{fs[_0x5297('0x103')](_0x3c37b4+_0x5297('0x104'));}catch(_0x32b953){logger[_0x5297('0x2f')](_0x32b953);}return _0x47af67;}return this[_0x5297('0xe')][_0x5297('0x2f')](_0x2cbc93,_0x5297('0x159'));};AGIVertices[_0x5297('0x10')][_0x5297('0x15a')]=function(_0x355a5d){logger[_0x5297('0x31')](util[_0x5297('0x2b')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x355a5d[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x355a5d[_0x5297('0x15b')])){return this[_0x5297('0xe')]['error'](_0x355a5d,'no\x20find\x20by\x20configured');}logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x15c'),this[_0x5297('0xe')]['callerid'],_0x355a5d[_0x5297('0x15b')]));var _0x1e641b=this[_0x5297('0x53')][_0x5297('0xa5')](this,_0x355a5d[_0x5297('0x15b')]);if(_0x1e641b){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x15d'),this[_0x5297('0xe')]['callerid'],_0x355a5d['findBy']));this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x15d'),this[_0x5297('0xe')]['callerid'],_0x355a5d['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x5297('0x15e'),this['channel']['callerid'],_0x355a5d['findBy']));this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x15e'),this[_0x5297('0xe')][_0x5297('0x3a')],_0x355a5d[_0x5297('0x15b')]));return{'code':0xc8,'result':_0x5297('0x15f')};}};AGIVertices[_0x5297('0x10')][_0x5297('0x160')]=function(_0x5786a8){logger['info'](util[_0x5297('0x2b')](_0x5297('0x161'),_0x5786a8[_0x5297('0x38')]));if(!this['isConfigured'](_0x5786a8[_0x5297('0x15b')])){return this[_0x5297('0xe')]['error'](_0x5786a8,'no\x20find\x20by\x20configured');}logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x15c'),this['channel'][_0x5297('0x3a')],_0x5786a8['findBy']));var _0x3c8675=this[_0x5297('0x52')]['sync'](this,_0x5786a8[_0x5297('0x15b')]);if(_0x3c8675){logger[_0x5297('0x31')](util['format'](_0x5297('0x15d'),this[_0x5297('0xe')][_0x5297('0x3a')],_0x5786a8[_0x5297('0x15b')]));this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5297('0xe')][_0x5297('0x3a')],_0x5786a8[_0x5297('0x15b')]));return{'code':0xc8,'result':_0x5297('0x162')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5297('0xe')][_0x5297('0x3a')],_0x5786a8[_0x5297('0x15b')]));this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5297('0xe')][_0x5297('0x3a')],_0x5786a8[_0x5297('0x15b')]));return{'code':0xc8,'result':_0x5297('0x15f')};}};AGIVertices[_0x5297('0x10')][_0x5297('0x163')]=function(_0x5dea22){logger['info'](util[_0x5297('0x2b')](_0x5297('0x164'),_0x5dea22[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x5dea22[_0x5297('0x165')])){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x5dea22,_0x5297('0x166'));}this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x167'),_0x5dea22[_0x5297('0x165')]));var _0x3ee22d=eval(_0x5dea22[_0x5297('0x165')]);if(!this['isConfigured'](_0x5dea22[_0x5297('0xd7')])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2eee4c=this[_0x5297('0x11')][_0x5297('0xa5')](this,_0x5dea22[_0x5297('0xd7')]);if(!_0x2eee4c){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x5dea22,_0x5297('0xd9'));}if(_['isArray'](_0x3ee22d)){var _0xcb6c98=this;_0x3ee22d['forEach'](function(_0x5b4d45,_0x37bb2d){_0xcb6c98['channel']['setVariable'](util[_0x5297('0x2b')]('%s[%s]',_0x2eee4c,_0x37bb2d),_0x5b4d45);});return this[_0x5297('0xe')]['noop'](util[_0x5297('0x2b')](_0x5297('0x168'),_0x2eee4c));}else{return this['channel'][_0x5297('0x9c')](_0x2eee4c,_0x3ee22d);}};AGIVertices[_0x5297('0x10')][_0x5297('0xc')]=function(_0x274885){logger[_0x5297('0x31')](util[_0x5297('0x2b')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x274885[_0x5297('0x38')]));if(_0x274885[_0x5297('0x112')]===0x0){return this[_0x5297('0xa3')](_0x274885);}_0x274885[_0x5297('0x112')]-=0x1;if(!this[_0x5297('0x81')](_0x274885[_0x5297('0x113')])){return this['channel'][_0x5297('0x2f')](_0x274885,_0x5297('0x114'));}var _0x3c85b7=this[_0x5297('0x1e')][_0x5297('0xa5')](this,_0x274885[_0x5297('0x113')]);if(!_0x3c85b7){return this['channel'][_0x5297('0x2f')](_0x274885,_0x5297('0x169'));}var _0x49cad4=this[_0x5297('0xe')][_0x5297('0x115')](_0x3c85b7,_0x274885[_0x5297('0x116')],_0x274885[_0x5297('0x16a')]);var _0x3bc26a=_0x49cad4[_0x5297('0xa1')];if(_0x49cad4['result']===-0x1){this['createSquareDetailsReport'][_0x5297('0xa5')](this,_0x274885,'-1');return _0x49cad4;}else if(_0x49cad4[_0x5297('0x9f')]===_0x5297('0x64')){_0x49cad4[_0x5297('0xa1')]=_0x49cad4['result'][_0x5297('0x97')]>0x0?_0x49cad4['result']:'t';}else if(_[_0x5297('0x44')](_0x49cad4[_0x5297('0xa1')])){_0x49cad4['result']='#';_0x3bc26a='#';}if(!this['isConfigured'](_0x274885[_0x5297('0xd7')])){this[_0x5297('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0xb73f3=this[_0x5297('0x11')]['sync'](this,_0x274885[_0x5297('0xd7')]);if(!_0xb73f3){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x274885,_0x5297('0xd9'));}this[_0x5297('0xe')]['setVariable'](_0xb73f3,_0x3bc26a);}this[_0x5297('0xa4')][_0x5297('0xa5')](this,_0x274885,_0x3bc26a);return _0x49cad4;};AGIVertices[_0x5297('0x10')][_0x5297('0xa7')]=function(_0x521963){logger['info'](util[_0x5297('0x2b')](_0x5297('0x16b'),_0x521963['label']));return this[_0x5297('0xe')]['noop'](_0x521963[_0x5297('0x16c')]||_0x521963[_0x5297('0x38')]);};AGIVertices['prototype'][_0x5297('0x16d')]=function(_0x223b17){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x16e'),_0x223b17[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x223b17['findBy'])){return this['channel']['error'](_0x223b17,_0x5297('0x16f'));}logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x15c'),this[_0x5297('0xe')][_0x5297('0x3a')],_0x223b17[_0x5297('0x15b')]));var _0x31c657=this[_0x5297('0x170')][_0x5297('0xa5')](this,_0x223b17[_0x5297('0x171')]);var _0x5480ef=this[_0x5297('0x4f')]['sync'](this,_0x223b17[_0x5297('0x15b')],_0x31c657);if(_0x5480ef){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x15d'),this[_0x5297('0xe')]['callerid'],_0x223b17['findBy']));this[_0x5297('0xe')]['noop'](util['format'](_0x5297('0x15d'),this[_0x5297('0xe')][_0x5297('0x3a')],_0x223b17[_0x5297('0x15b')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x5297('0x15e'),this[_0x5297('0xe')][_0x5297('0x3a')],_0x223b17[_0x5297('0x15b')]));this[_0x5297('0xe')][_0x5297('0xa7')](util['format'](_0x5297('0x15d'),this['channel']['callerid'],_0x223b17[_0x5297('0x15b')]));return{'code':0xc8,'result':_0x5297('0x15f')};}};AGIVertices['prototype'][_0x5297('0x172')]=function(_0x363231){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x173'),_0x363231[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x363231[_0x5297('0x113')])){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x363231,'no\x20file\x20audio\x20selected');}var _0x1586bc=this[_0x5297('0x1e')][_0x5297('0xa5')](this,_0x363231[_0x5297('0x113')]);if(!_0x1586bc){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x363231,_0x5297('0x169'));}var _0x45278a=this[_0x5297('0xe')][_0x5297('0xad')]('PLAYBACK',[_0x1586bc,_0x363231[_0x5297('0xe4')]]);if(_0x45278a['result']===-0x1){return _0x45278a;}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0xc2'),_0x5297('0x174'),_0x1586bc));};AGIVertices['prototype']['queue']=function(_0x450fcd){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x175'),_0x450fcd[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x450fcd[_0x5297('0x176')])){return this['channel'][_0x5297('0x2f')](_0x450fcd,_0x5297('0x177'));}var _0x409e9c='';var _0x45c0a8=parseInt(_0x450fcd['queue_id'],0xa);if(isNaN(_0x45c0a8)){_0x409e9c=_0x450fcd['queue_id'];}else{_0x409e9c=this['getVoiceQueue'][_0x5297('0xa5')](this,_0x450fcd[_0x5297('0x176')]);if(!_0x409e9c){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x450fcd,_0x5297('0x178'));}}var _0x4d07ef='';if(this['isConfigured'](_0x450fcd[_0x5297('0x113')])){var _0x592389=this[_0x5297('0x1e')][_0x5297('0xa5')](this,_0x450fcd['file_id']);if(_0x592389){_0x4d07ef=_0x592389;}}this[_0x5297('0xa4')][_0x5297('0xa5')](this,_0x450fcd,_0x409e9c);if(_0x450fcd[_0x5297('0xe4')][_0x5297('0x179')]('x')<0x0){_0x450fcd['opts']+='x';}if(_0x450fcd[_0x5297('0xe4')][_0x5297('0x179')]('X')<0x0){_0x450fcd[_0x5297('0xe4')]+='X';}this[_0x5297('0xe')][_0x5297('0x9c')]('XMCS-QUEUE',_0x409e9c?_0x409e9c[_0x5297('0x17a')]():'');var _0x420237=this[_0x5297('0xe')]['exec'](_0x5297('0x17b'),[_0x409e9c,_0x450fcd[_0x5297('0xe4')],_0x450fcd[_0x5297('0x63')],_0x4d07ef,_0x450fcd[_0x5297('0x64')],_0x450fcd['agi'],_0x450fcd[_0x5297('0x17c')],_0x450fcd[_0x5297('0x17d')],'',_0x450fcd[_0x5297('0x17e')]]);if(_0x420237[_0x5297('0xa1')]===-0x1){return _0x420237;}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('Executed\x20command\x20%s\x20%s',_0x5297('0x17b'),_0x409e9c));};AGIVertices[_0x5297('0x10')][_0x5297('0x17f')]=function(_0xadb408){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x180'),_0xadb408[_0x5297('0x38')]));var _0x3e8cff=_0xadb408['recordingFormat']||'wav';var _0x68ede7=util[_0x5297('0x2b')](_0x5297('0x181'),this['channel'][_0x5297('0x37')],rs['generate'](0x5));var _0x177432=util[_0x5297('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x68ede7,_0x3e8cff);var _0x5f64cd=util[_0x5297('0x2b')](_0x5297('0x136'),FILES_PATH,_0x68ede7);this[_0x5297('0x3b')]['sync'](this,_0xadb408,_0x68ede7,_0x177432);this[_0x5297('0xe')]['setVariable'](_0x5297('0x182'),_0x68ede7);logger['info'](_0x5297('0x183'),_0x5f64cd,_0x3e8cff,_0xadb408[_0x5297('0x184')],_0xadb408[_0x5297('0x64')]);return this[_0x5297('0xe')][_0x5297('0x138')](_0x5f64cd,_0x3e8cff,_0xadb408[_0x5297('0x184')],_0xadb408[_0x5297('0x64')],undefined,!![]);};AGIVertices['prototype'][_0x5297('0x185')]=function(_0x862050){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x186'),_0x862050[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x862050[_0x5297('0x63')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x187'));}var _0x4e8b23=this[_0x5297('0x62')][_0x5297('0xa5')](this,_0x862050);logger['info'](util[_0x5297('0x2b')]('Response:',util[_0x5297('0x188')](_0x4e8b23,{'showHidden':![],'depth':null})));if(!this[_0x5297('0x81')](_0x862050[_0x5297('0xd7')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x189'));}var _0x323d35=this[_0x5297('0x11')][_0x5297('0xa5')](this,_0x862050[_0x5297('0xd7')]);if(!_0x323d35){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x862050,'no\x20variable\x20found');}this['channel'][_0x5297('0x9c')](util[_0x5297('0x2b')](_0x5297('0x18a'),_0x323d35),_0x4e8b23[_0x5297('0x73')]?_0x4e8b23['statusCode']:_0x5297('0x18b'));this[_0x5297('0xe')][_0x5297('0x9c')](util[_0x5297('0x2b')](_0x5297('0x18c'),_0x323d35),_0x4e8b23[_0x5297('0x74')]?_0x4e8b23[_0x5297('0x74')]:'OK');if(_0x4e8b23[_0x5297('0x71')]){try{this[_0x5297('0x99')](_0x4e8b23[_0x5297('0x71')],_0x323d35);}catch(_0x55446e){logger[_0x5297('0x2f')](util['format'](_0x5297('0x18d'),_0x323d35));}}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0xdd'),_0x323d35));};AGIVertices['prototype'][_0x5297('0x18e')]=function(_0x410246){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x18f'),_0x410246[_0x5297('0x38')]));return this[_0x5297('0xe')]['sayDigits'](_0x410246[_0x5297('0x190')][_0x5297('0x56')](/\s+/g,''),_0x410246[_0x5297('0x184')]);};AGIVertices[_0x5297('0x10')]['saynumber']=function(_0x40b991){logger[_0x5297('0x31')](util[_0x5297('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x40b991[_0x5297('0x38')]));return this[_0x5297('0xe')][_0x5297('0x191')](_0x40b991[_0x5297('0x192')][_0x5297('0x56')](/\s+/g,''),_0x40b991[_0x5297('0x184')]);};AGIVertices[_0x5297('0x10')]['sayphonetic']=function(_0x51c7b6){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x193'),_0x51c7b6[_0x5297('0x38')]));return this[_0x5297('0xe')][_0x5297('0x194')](_0x51c7b6['text'],_0x51c7b6[_0x5297('0x184')]);};AGIVertices[_0x5297('0x10')][_0x5297('0x195')]=function(_0x2336ee){logger['info'](util[_0x5297('0x2b')](_0x5297('0x196'),_0x2336ee['label']));if(!this[_0x5297('0x81')](_0x2336ee[_0x5297('0x197')])){return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x198'));}var _0x347c56=this[_0x5297('0x22')][_0x5297('0xa5')](this,_0x2336ee[_0x5297('0x197')]);if(!_0x347c56||!_0x347c56[_0x5297('0x199')]){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x2336ee,_0x5297('0x19a'));}var _0x2b324a={'from':util['format'](_0x5297('0x19b'),_0x347c56['name'],_0x347c56[_0x5297('0x19c')]||_0x347c56[_0x5297('0x199')]['user']),'to':_0x2336ee['to']||'','cc':_0x2336ee['cc']||'','bcc':_0x2336ee['bcc']||'','subject':_0x2336ee[_0x5297('0x19d')],'html':_0x2336ee[_0x5297('0x59')],'text':_0x2336ee[_0x5297('0x59')]};var _0x3cf547={'tls':{'rejectUnauthorized':![]}};if(_0x347c56[_0x5297('0x199')][_0x5297('0x19e')]){_0x3cf547[_0x5297('0x19e')]=_0x347c56['Smtp'][_0x5297('0x19e')];}else{_0x3cf547[_0x5297('0x19f')]=_0x347c56[_0x5297('0x199')]['host'];_0x3cf547[_0x5297('0x1a0')]=_0x347c56[_0x5297('0x199')]['port'];_0x3cf547[_0x5297('0x1a1')]=_0x347c56[_0x5297('0x199')][_0x5297('0x1a1')];}if(_0x347c56[_0x5297('0x199')][_0x5297('0x1a2')]){_0x3cf547['auth']={'user':_0x347c56['Smtp'][_0x5297('0x1a3')],'pass':_0x347c56[_0x5297('0x199')][_0x5297('0x1a4')]};}if(this[_0x5297('0x81')](_0x2336ee['template_id'])){}logger[_0x5297('0x1a5')]('sendMail\x20message',JSON[_0x5297('0x70')](_0x2b324a));this['createSquareDetailsReport'][_0x5297('0xa5')](this,_0x2336ee,_0x2336ee['account_id']);this['channel'][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x1a6'),_0x347c56[_0x5297('0x14')]));this[_0x5297('0x24')]['sync'](this,_0x3cf547,_0x2b324a);return this[_0x5297('0xe')]['noop'](_0x5297('0x1a7'));};AGIVertices[_0x5297('0x10')][_0x5297('0x1a8')]=function(_0x1252e6){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x1a9'),_0x1252e6[_0x5297('0x38')]));return this[_0x5297('0xe')]['noop'](_0x5297('0x1aa'));};AGIVertices[_0x5297('0x10')][_0x5297('0x1ab')]=function(_0x1a83a0){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x1ac'),_0x1a83a0[_0x5297('0x38')]));if(!this['isConfigured'](_0x1a83a0[_0x5297('0x1ad')])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20sms\x20account\x20configured');}var _0x5d8558=this[_0x5297('0x1ae')][_0x5297('0xa5')](this,_0x1a83a0[_0x5297('0x1ad')]);if(!_0x5d8558){return this['channel'][_0x5297('0x2f')](_0x1a83a0,_0x5297('0x1af'));}var _0x1f8238={'body':_0x1a83a0[_0x5297('0x1b0')],'phone':_0x1a83a0['to']||'','SmsAccountId':_0x5d8558['id']};logger['debug'](_0x5297('0x1b1'),JSON[_0x5297('0x70')](_0x1f8238));this[_0x5297('0xa4')][_0x5297('0xa5')](this,_0x1a83a0,_0x1a83a0[_0x5297('0x1ad')]);this[_0x5297('0xe')][_0x5297('0xa7')](util['format'](_0x5297('0x1b2'),_0x5d8558[_0x5297('0x14')]));this['createSmsMessage'][_0x5297('0xa5')](this,_0x1f8238);return this[_0x5297('0xe')]['noop'](_0x5297('0x1b3'));};AGIVertices[_0x5297('0x10')]['set']=function(_0x317915){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x1b4'),_0x317915[_0x5297('0x38')]));if(!this[_0x5297('0x81')](_0x317915[_0x5297('0xd7')])){return this[_0x5297('0xe')]['error'](_0x317915,_0x5297('0x1b5'));}var _0x1dccf3=this[_0x5297('0x11')][_0x5297('0xa5')](this,_0x317915[_0x5297('0xd7')]);if(!_0x1dccf3){return this['channel']['error'](_0x317915,_0x5297('0xd9'));}return this[_0x5297('0xe')][_0x5297('0x9c')](_0x1dccf3,_0x317915['variable_value']);};AGIVertices[_0x5297('0x10')][_0x5297('0x1b6')]=function(_0x55bc84){logger[_0x5297('0x31')](util['format'](_0x5297('0x1b7'),_0x55bc84[_0x5297('0x38')]));this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x1b8'));if(_0x55bc84[_0x5297('0xb5')]==='yes'){this['channel'][_0x5297('0xa7')]('Answer');return this[_0x5297('0xe')][_0x5297('0xb5')]();}return this[_0x5297('0xe')][_0x5297('0xa7')](_0x5297('0x1b9'));};AGIVertices[_0x5297('0x10')][_0x5297('0x1ba')]=function(_0x4a2b6f){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x1bb'),_0x4a2b6f[_0x5297('0x38')]));if(!this['isConfigured'](_0x4a2b6f[_0x5297('0x1bc')])){return this[_0x5297('0xe')]['error'](_0x4a2b6f,_0x5297('0x1bd'));}var _0x39076c=this[_0x5297('0x19')][_0x5297('0xa5')](this,_0x4a2b6f['project_id']);if(!this[_0x5297('0x81')](_0x39076c)){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x4a2b6f,util[_0x5297('0x2b')](_0x5297('0x1be'),_0x4a2b6f[_0x5297('0x1bc')]));}if(_0x39076c===this['channel']['arg_1']){return this['channel'][_0x5297('0x2f')](_0x4a2b6f,_0x5297('0x1bf'));}this['createSquareDetailsReport']['sync'](this,_0x4a2b6f,_0x39076c);var _0x1e213c=this[_0x5297('0xe')][_0x5297('0xad')](_0x5297('0x1c0'),util['format'](_0x5297('0x1c1'),config[_0x5297('0x6')]['host']||_0x5297('0x1c2'),_0x39076c,this[_0x5297('0xe')][_0x5297('0x39')]));if(_0x1e213c[_0x5297('0xa1')]===-0x1){return _0x1e213c;}return this[_0x5297('0xe')][_0x5297('0xa7')](util['format']('Executed\x20command\x20%s\x20%s',_0x5297('0x1c0'),_0x39076c));};AGIVertices['prototype'][_0x5297('0x1c3')]=function(_0x259733){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x1c4'),_0x259733['label']));var _0x23ae8a=this[_0x5297('0x1c5')][_0x5297('0xa5')](this,_0x259733[_0x5297('0x1c6')]);this[_0x5297('0xa4')][_0x5297('0xa5')](this,_0x259733,_0x259733[_0x5297('0x1c6')]);if(this[_0x5297('0x81')](_0x259733[_0x5297('0xd7')])){var _0x3bfa9d=this[_0x5297('0x11')][_0x5297('0xa5')](this,_0x259733[_0x5297('0xd7')]);if(_0x3bfa9d){this['channel'][_0x5297('0x9c')](_0x3bfa9d,_0x23ae8a);return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x1c7'),_0x259733[_0x5297('0x1c6')],_0x3bfa9d));}}return this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x1c8'),_0x259733[_0x5297('0x1c6')]));};AGIVertices['prototype'][_0x5297('0x1c9')]=function(_0x7bfd8d){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x1ca'),_0x7bfd8d[_0x5297('0x38')]));_0x7bfd8d[_0x5297('0x59')]=_0x7bfd8d['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5297('0x81')](_0x7bfd8d['apiKey'])){return this[_0x5297('0xe')][_0x5297('0xa7')]('no\x20apiKey\x20configured');}if(!this[_0x5297('0x81')](_0x7bfd8d[_0x5297('0x59')])){return this['channel'][_0x5297('0xa7')](_0x5297('0xc5'));}this[_0x5297('0xe')]['noop'](util[_0x5297('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x7bfd8d[_0x5297('0x59')]));var _0x28f168=this[_0x5297('0x57')]['sync'](this,_0x7bfd8d);if(_0x28f168){this['channel']['noop'](util[_0x5297('0x2b')](_0x5297('0x1cb'),_0x28f168));var _0x208b96=this[_0x5297('0xe')][_0x5297('0x102')](_0x28f168);try{fs[_0x5297('0x103')](_0x28f168+_0x5297('0x104'));}catch(_0x59142b){logger[_0x5297('0x2f')](_0x59142b);}return _0x208b96;}return this[_0x5297('0xe')][_0x5297('0x2f')](_0x7bfd8d,_0x5297('0x1cc'));};AGIVertices[_0x5297('0x10')][_0x5297('0x1cd')]=function(_0x5ece52){logger[_0x5297('0x31')](util['format'](_0x5297('0x1ce'),_0x5ece52[_0x5297('0x38')]));_0x5ece52[_0x5297('0x59')]=_0x5ece52[_0x5297('0x59')][_0x5297('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5ece52[_0x5297('0x59')])){return this['channel'][_0x5297('0xa7')](_0x5297('0xc5'));}this['channel'][_0x5297('0xa7')](util[_0x5297('0x2b')](_0x5297('0x1cf'),_0x5ece52['text']));var _0x41d8fc=this[_0x5297('0x60')][_0x5297('0xa5')](this,_0x5ece52);if(_0x41d8fc){this[_0x5297('0xe')]['noop'](util['format'](_0x5297('0x1d0'),_0x41d8fc));var _0x320b3a=this[_0x5297('0xe')][_0x5297('0x102')](_0x41d8fc);try{fs[_0x5297('0x103')](_0x41d8fc+_0x5297('0x104'));}catch(_0x1b5406){logger['error'](_0x1b5406);}return _0x320b3a;}return this[_0x5297('0xe')][_0x5297('0x2f')](_0x5ece52,_0x5297('0x1d1'));};AGIVertices[_0x5297('0x10')][_0x5297('0x1d2')]=function(_0x3b6fe2){logger['info'](util[_0x5297('0x2b')](_0x5297('0x1d3'),_0x3b6fe2[_0x5297('0x38')]));if(!this['isConfigured'](_0x3b6fe2[_0x5297('0x15b')])){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x3b6fe2,_0x5297('0x16f'));}logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x15c'),this['channel']['callerid'],_0x3b6fe2[_0x5297('0x15b')]));var _0x1e1c0e=this[_0x5297('0x51')][_0x5297('0xa5')](this,_0x3b6fe2[_0x5297('0x15b')]);if(_0x1e1c0e){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x15d'),this[_0x5297('0xe')]['callerid'],_0x3b6fe2[_0x5297('0x15b')]));this[_0x5297('0xe')][_0x5297('0xa7')](util[_0x5297('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5297('0xe')][_0x5297('0x3a')],_0x3b6fe2[_0x5297('0x15b')]));return{'code':0xc8,'result':_0x5297('0x162')};}else{logger[_0x5297('0x31')](util['format'](_0x5297('0x15e'),this[_0x5297('0xe')]['callerid'],_0x3b6fe2['findBy']));this[_0x5297('0xe')]['noop'](util[_0x5297('0x2b')](_0x5297('0x15e'),this['channel'][_0x5297('0x3a')],_0x3b6fe2['findBy']));return{'code':0xc8,'result':_0x5297('0x15f')};}};AGIVertices['prototype'][_0x5297('0x1d4')]=function(_0x2512a7){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x1d5'),_0x2512a7['label']));var _0x11659a=this[_0x5297('0xe')][_0x5297('0xad')]('VOICEMAIL',[_0x2512a7[_0x5297('0x1d6')],_0x2512a7[_0x5297('0x77')]]);if(_0x11659a[_0x5297('0xa1')]===-0x1){return _0x11659a;}return this['channel']['noop'](util[_0x5297('0x2b')](_0x5297('0xc2'),'VOICEMAIL',_0x2512a7[_0x5297('0x1d6')]));};AGIVertices[_0x5297('0x10')][_0x5297('0x1d7')]=function(_0x141d2a){logger[_0x5297('0x31')](util[_0x5297('0x2b')](_0x5297('0x1d8'),_0x141d2a[_0x5297('0x38')]));if(!this['isConfigured'](_0x141d2a[_0x5297('0xd7')])){return this[_0x5297('0xe')][_0x5297('0x2f')](_0x141d2a,_0x5297('0x1b5'));}var _0x40b880=this[_0x5297('0x11')][_0x5297('0xa5')](this,_0x141d2a['variable_id']);if(!_0x40b880){return this['channel']['error'](_0x141d2a,_0x5297('0xd9'));}var _0x560552=this['channel']['getVariable'](_0x40b880);return{'code':0xc8,'result':_0x560552[_0x5297('0x9f')]?_0x560552[_0x5297('0x9f')]:'-'};};String['prototype'][_0x5297('0x1d9')]=function(_0x4dc4d9,_0x2b07a2){return this[_0x5297('0x9e')](_0x4dc4d9)[_0x5297('0x1da')](_0x2b07a2);};module['exports']=AGIVertices; \ No newline at end of file +var _0x8c46=['trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','split','replaceAll','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','getAndSetVariable','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','add','delay','callback_priority','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','extra','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','substr','generate','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','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','wav','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restapi','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','authentication','auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','start','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','getVariable','getVariableById','then','catch','prototype','name','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','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','createSquareRecording','uniqueid','callerid','calleridname','context','extension','priority','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','callback','scheduledAt','toString','getPause','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand'];(function(_0x381c74,_0x6f357b){var _0x1a0ecf=function(_0x31fb70){while(--_0x31fb70){_0x381c74['push'](_0x381c74['shift']());}};_0x1a0ecf(++_0x6f357b);}(_0x8c46,0x171));var _0x68c4=function(_0x4ba1ab,_0x4277fe){_0x4ba1ab=_0x4ba1ab-0x0;var _0x39c47e=_0x8c46[_0x4ba1ab];return _0x39c47e;};'use strict';var fs=require('fs');var path=require(_0x68c4('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0x68c4('0x1'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x68c4('0x2'));var Mustache=require(_0x68c4('0x3'));var rp=require(_0x68c4('0x4'));var logger=require(_0x68c4('0x5'))(_0x68c4('0x6'));var config=require(_0x68c4('0x7'));var scripts=require(_0x68c4('0x8'));var FILES_PATH=_0x68c4('0x9');var recursiveMapAttributes=[_0x68c4('0xa'),_0x68c4('0xb')];var verticesWithRetry=['menu',_0x68c4('0xc'),_0x68c4('0xd')];var AGIVertices=function(_0x2d3a88,_0x5796cb,_0x356698){this[_0x68c4('0xe')]=_0x2d3a88;this[_0x68c4('0xf')]=_0x5796cb;this['mailRpc']=_0x356698;};AGIVertices['prototype'][_0x68c4('0x10')]=function(_0x2a8c08,_0x50b161){this['rpc'][_0x68c4('0x11')](_0x2a8c08)[_0x68c4('0x12')](function(_0x2796c8){_0x50b161(null,_0x2796c8?_0x2796c8['name']:![]);})[_0x68c4('0x13')](function(_0x1f5f42){_0x50b161(_0x1f5f42);});};AGIVertices[_0x68c4('0x14')]['getVoiceQueue']=function(_0x11eb66,_0x14919c){this[_0x68c4('0xf')]['getVoiceQueueById'](_0x11eb66)[_0x68c4('0x12')](function(_0x38fd57){_0x14919c(null,_0x38fd57?_0x38fd57['name']:![]);})[_0x68c4('0x13')](function(_0x4ea2a4){_0x14919c(_0x4ea2a4);});};AGIVertices[_0x68c4('0x14')]['getSquareProject']=function(_0x5497bf,_0xc2ea2f){this[_0x68c4('0xf')]['getSquareProjectById'](_0x5497bf)[_0x68c4('0x12')](function(_0x1d757c){_0xc2ea2f(null,_0x1d757c?_0x1d757c[_0x68c4('0x15')]:![]);})[_0x68c4('0x13')](function(_0x3a6300){_0xc2ea2f(_0x3a6300);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x16')]=function(_0x415ef2,_0x1ee182){this[_0x68c4('0xf')][_0x68c4('0x17')](_0x415ef2)['then'](function(_0x398a71){_0x1ee182(null,_0x398a71?_0x398a71['dsn']:![]);})['catch'](function(_0x34d3a6){_0x1ee182(_0x34d3a6);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x18')]=function(_0x42f0bc,_0x5b8135){this[_0x68c4('0xf')][_0x68c4('0x19')](_0x42f0bc)['then'](function(_0x201742){_0x5b8135(null,_0x201742?_0x201742[_0x68c4('0x15')]:![]);})[_0x68c4('0x13')](function(_0x10278e){_0x5b8135(_0x10278e);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x1a')]=function(_0x37e9a9,_0x505db4){this[_0x68c4('0xf')]['getTrunkById'](_0x37e9a9)[_0x68c4('0x12')](function(_0x10c67e){_0x505db4(null,_0x10c67e?_0x10c67e[_0x68c4('0x15')]:![]);})['catch'](function(_0x1e14db){_0x505db4(_0x1e14db);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x1b')]=function(_0x31e177,_0x3b62a3){var _0x22f053=this;this[_0x68c4('0xf')]['getSoundById'](_0x31e177)[_0x68c4('0x12')](function(_0x4b4634){_0x3b62a3(null,_0x4b4634?_0x22f053[_0x68c4('0x1c')](_0x4b4634[_0x68c4('0x1d')]):![]);})['catch'](function(_0x2847d1){_0x3b62a3(_0x2847d1);});};AGIVertices[_0x68c4('0x14')]['getMailAccount']=function(_0x29ef9d,_0x3a1b69){this[_0x68c4('0xf')][_0x68c4('0x1e')](_0x29ef9d)[_0x68c4('0x12')](function(_0x586dec){_0x3a1b69(null,_0x586dec?_0x586dec:![]);})[_0x68c4('0x13')](function(_0x319de8){_0x3a1b69(_0x319de8);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x1f')]=function(_0x19bc4a,_0x925289,_0x302237){this[_0x68c4('0x20')][_0x68c4('0x1f')](_0x19bc4a,_0x925289)[_0x68c4('0x12')](function(){_0x302237(null);})[_0x68c4('0x13')](function(_0x106d6e){_0x302237(_0x106d6e);});};AGIVertices['prototype'][_0x68c4('0x21')]=function(_0x194217,_0x25eeea){this[_0x68c4('0xf')][_0x68c4('0x22')](_0x194217)['then'](function(_0x32fef0){if(_0x32fef0){if(_0x32fef0['IntervalId']){_0x25eeea(null,[_0x32fef0['interval']]);}else{_0x25eeea(null,_['map'](_0x32fef0[_0x68c4('0x23')],_0x68c4('0x24')));}}else{_0x25eeea(null,![]);}})[_0x68c4('0x13')](function(_0x21c2f9){_0x25eeea(_0x21c2f9);});};AGIVertices['prototype'][_0x68c4('0x1c')]=function(_0x30ccea){return util[_0x68c4('0x25')]('%s/sounds/converted/%s',FILES_PATH,_0x30ccea);};AGIVertices[_0x68c4('0x14')][_0x68c4('0x26')]=function(_0x3615b1,_0xee8c17,_0x10ad0b){odbc[_0x68c4('0x27')](_0x3615b1,function(_0x39a127){if(_0x39a127){logger[_0x68c4('0x28')](_0x68c4('0x29'),_0x39a127);_0x10ad0b(_0x39a127);}else{logger[_0x68c4('0x2a')]('ODBC\x20connection\x20successfully');odbc['query'](_0xee8c17,function(_0x326940,_0x2baafa){if(_0x326940){logger[_0x68c4('0x2a')](_0x68c4('0x2b'),_0xee8c17);_0x10ad0b(_0x326940);}else{logger[_0x68c4('0x2a')](_0x68c4('0x2c'),_0xee8c17);odbc[_0x68c4('0x2d')](function(_0x199645){if(_0x199645){logger[_0x68c4('0x28')](_0x68c4('0x2e'),_0x199645);}_0x10ad0b(null,_0x2baafa);});}});}});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x2f')]=function(_0xfb2382,_0x4d8077){this['rpc'][_0x68c4('0x30')](_0xfb2382)[_0x68c4('0x12')](function(_0xbc2712){_0x4d8077(null,_0xbc2712?_0xbc2712:![]);})[_0x68c4('0x13')](function(_0x5e577d){_0x4d8077(_0x5e577d);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x31')]=function(_0x4d555c,_0x4a45f2){this['rpc'][_0x68c4('0x31')](_0x4d555c)['then'](function(_0x26d55c){_0x4a45f2(null,_0x26d55c);})['catch'](function(_0x18da6f){_0x4a45f2(_0x18da6f);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x32')]=function(_0xefe68d,_0x5d423b,_0x3d82be){this[_0x68c4('0xf')][_0x68c4('0x32')]({'uniqueid':this[_0x68c4('0xe')]['uniqueid'],'node':_0xefe68d[_0x68c4('0x33')],'application':_0xefe68d[_0x68c4('0x34')],'data':_0x5d423b||null,'project_name':this[_0x68c4('0xe')][_0x68c4('0x35')],'callerid':this[_0x68c4('0xe')]['callerid']})['then'](function(_0x499615){if(_0x3d82be){_0x3d82be(null,_0x499615);}})[_0x68c4('0x13')](function(_0x268bf4){if(_0x3d82be){_0x3d82be(_0x268bf4);}});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x36')]=function(_0x5e8438,_0x2255fa,_0x2169af,_0x3fc17e){this[_0x68c4('0xf')][_0x68c4('0x36')]({'uniqueid':this[_0x68c4('0xe')][_0x68c4('0x37')],'callerid':this[_0x68c4('0xe')][_0x68c4('0x38')],'calleridname':this[_0x68c4('0xe')][_0x68c4('0x39')],'context':this['channel'][_0x68c4('0x3a')],'extension':this['channel'][_0x68c4('0x3b')],'priority':this[_0x68c4('0xe')][_0x68c4('0x3c')],'accountcode':this[_0x68c4('0xe')]['accountcode'],'dnid':this[_0x68c4('0xe')]['dnid'],'projectName':this[_0x68c4('0xe')][_0x68c4('0x35')],'saveName':_0x2255fa,'filename':_0x5e8438['file']||_0x2255fa,'savePath':_0x2169af})[_0x68c4('0x12')](function(_0x2b8572){_0x3fc17e(null,_0x2b8572);})[_0x68c4('0x13')](function(_0x305d5f){_0x3fc17e(_0x305d5f);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x3d')]=function(_0x519ddb,_0x18e6ed,_0x13f9e8,_0x3de389,_0x1b7059){this['rpc'][_0x68c4('0x3d')]({'uniqueid':this[_0x68c4('0xe')][_0x68c4('0x37')],'body':_0x519ddb,'direction':_0x18e6ed,'providerName':_0x13f9e8,'providerResponse':_0x3de389})[_0x68c4('0x12')](function(_0x2a7eff){if(_0x1b7059){_0x1b7059(null,_0x2a7eff);}})[_0x68c4('0x13')](function(_0x49ec55){if(_0x1b7059){_0x1b7059(_0x49ec55);}});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x3e')]=function(_0x3db854,_0x51db14){this[_0x68c4('0xf')][_0x68c4('0x3e')]({'firstName':_['isEmpty'](_0x3db854['name'])||_[_0x68c4('0x3f')](_0x3db854[_0x68c4('0x15')])?_0x68c4('0x40')+Math[_0x68c4('0x41')]():_0x3db854[_0x68c4('0x15')],'lastName':_[_0x68c4('0x42')](_0x3db854[_0x68c4('0x43')])||_[_0x68c4('0x3f')](_0x3db854['lastName'])?null:_0x3db854[_0x68c4('0x43')],'phone':_0x3db854['phone'],'ListId':_0x3db854['list_id'],'scheduledat':_0x3db854['scheduledAt'],'callbackUniqueid':this[_0x68c4('0xe')][_0x68c4('0x37')],'tags':_0x68c4('0x44'),'description':'Callback\x20scheduled\x20at\x20'+_0x3db854[_0x68c4('0x45')][_0x68c4('0x46')](),'priority':_0x3db854['callback_priority']})[_0x68c4('0x12')](function(_0x54b490){_0x51db14(null,_0x54b490);})[_0x68c4('0x13')](function(_0x51d847){_0x51db14(_0x51d847);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x47')]=function(_0x507df8,_0x1303fc){this[_0x68c4('0xf')]['getPauseById'](_0x507df8)[_0x68c4('0x12')](function(_0x120163){_0x1303fc(null,_0x120163?_0x120163['name']:![]);})[_0x68c4('0x13')](function(_0x2a1708){_0x1303fc(_0x2a1708);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x48')]=function(_0x2d50c8,_0x159f8b,_0x1a2ede){var _0x22424b={'role':_0x68c4('0x49')};_0x22424b[_0x2d50c8]=this['channel'][_0x68c4('0x38')];this[_0x68c4('0xf')][_0x68c4('0x48')](_0x22424b,_0x159f8b,this[_0x68c4('0xe')][_0x68c4('0x37')])[_0x68c4('0x12')](function(_0x318662){_0x1a2ede(null,_['isNil'](_0x318662)?![]:!![]);})['catch'](function(_0x345143){logger[_0x68c4('0x28')](_0x345143);_0x1a2ede(null,![]);});};AGIVertices['prototype'][_0x68c4('0x4a')]=function(_0x91e7b6,_0x32d539){var _0x1bde7a={'role':_0x68c4('0x49')};_0x1bde7a[_0x91e7b6]=this[_0x68c4('0xe')]['callerid'];this[_0x68c4('0xf')][_0x68c4('0x4a')](_0x1bde7a)[_0x68c4('0x12')](function(_0x296146){_0x32d539(null,_[_0x68c4('0x3f')](_0x296146)?![]:!![]);})['catch'](function(_0x4bb60c){logger[_0x68c4('0x28')](_0x4bb60c);_0x32d539(null,![]);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x4b')]=function(_0x278f84,_0x294681){var _0x5378db={'role':_0x68c4('0x49')};_0x5378db[_0x278f84]=this[_0x68c4('0xe')][_0x68c4('0x38')];this[_0x68c4('0xf')][_0x68c4('0x4b')](_0x5378db)[_0x68c4('0x12')](function(_0x61851b){_0x294681(null,_[_0x68c4('0x3f')](_0x61851b)?![]:!![]);})[_0x68c4('0x13')](function(_0x11131d){logger['error'](_0x11131d);_0x294681(null,![]);});};AGIVertices[_0x68c4('0x14')]['agentLogin']=function(_0x284f5a,_0x246c48){var _0x3a009b={'role':'agent'};_0x3a009b[_0x284f5a]=this[_0x68c4('0xe')]['callerid'];var _0xd7bbe0=_0x284f5a!=_0x68c4('0x4c')?util[_0x68c4('0x25')](_0x68c4('0x4d'),_0x68c4('0x4e'),this['channel'][_0x68c4('0x38')]):undefined;this[_0x68c4('0xf')][_0x68c4('0x4f')](_0x3a009b,_0xd7bbe0)[_0x68c4('0x12')](function(_0x2696bb){_0x246c48(null,_['isNil'](_0x2696bb)?![]:!![]);})[_0x68c4('0x13')](function(_0x90bbc7){logger[_0x68c4('0x28')](_0x90bbc7);_0x246c48(null,![]);});};AGIVertices['prototype'][_0x68c4('0x50')]=function(_0x210049,_0x4c9d7a){sh['exec'](_[_0x68c4('0x51')](_0x210049),function(_0x5f019b,_0x49a162){var _0x43af21=_0x49a162[_0x68c4('0x52')](/(\r\n|\n|\r)/gm,'');_0x4c9d7a(null,_0x43af21);});};AGIVertices[_0x68c4('0x14')]['googleCloudTTS']=function(_0x5b5353,_0x2395b1){scripts[_0x68c4('0x53')](_0x5b5353['apiKey'],_0x5b5353[_0x68c4('0x54')]||_0x68c4('0x55'),_0x5b5353['text'],_0x5b5353['languageCode']||_0x68c4('0x56'),_0x5b5353[_0x68c4('0x57')]||_0x68c4('0x58'),_0x5b5353[_0x68c4('0x59')]||'MP3')[_0x68c4('0x12')](function(_0x586f04){_0x2395b1(null,_0x586f04);})[_0x68c4('0x13')](function(_0x4208a4){_0x2395b1(_0x4208a4);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x5a')]=function(_0x284783,_0x6d38b0){scripts[_0x68c4('0x5a')](_0x284783[_0x68c4('0x55')],_0x284783['google_tts_language']||'en',0x1)[_0x68c4('0x12')](function(_0x4a0f4e){_0x6d38b0(null,_0x4a0f4e);})[_0x68c4('0x13')](function(_0x2314b2){_0x6d38b0(_0x2314b2);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x5b')]=function(_0x246071,_0x39c3e8){var _0xfd1570={'uri':_0x246071[_0x68c4('0x5c')],'method':_0x246071[_0x68c4('0x5d')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x246071[_0x68c4('0x5e')])===_0x68c4('0x5f')&&parseInt(_0x246071[_0x68c4('0x5e')])>=0x1?parseInt(_0x246071[_0x68c4('0x5e')])*0x3e8:0x5*0x3e8};if(_[_0x68c4('0x60')]([_0x68c4('0x61'),_0x68c4('0x62')],_0xfd1570[_0x68c4('0x5d')][_0x68c4('0x63')]())){try{_0xfd1570[_0x68c4('0x64')]=_0x246071[_0x68c4('0xb')]?JSON[_0x68c4('0x65')](_0x246071[_0x68c4('0xb')]):{};}catch(_0x3348e6){logger[_0x68c4('0x28')](_0x68c4('0x66'),_0x3348e6);}}try{_0xfd1570['headers']=_0x246071[_0x68c4('0xa')]?JSON[_0x68c4('0x65')](_0x246071['rawHeaders']):{};}catch(_0x28b130){logger[_0x68c4('0x28')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x28b130);}if(_0x246071[_0x68c4('0x67')]){try{var _0x1b704d=require(_0x246071[_0x68c4('0x67')])[_0x68c4('0x68')](this,_0xfd1570);_0xfd1570[_0x68c4('0x69')]=Mustache[_0x68c4('0x6a')](_0x246071[_0x68c4('0x5c')],_0x1b704d,{},['$$','$$']);if(_0xfd1570['headers']){_0xfd1570[_0x68c4('0x6b')]=JSON[_0x68c4('0x65')](Mustache[_0x68c4('0x6a')](JSON[_0x68c4('0x6c')](_0xfd1570[_0x68c4('0x6b')]),_0x1b704d,{},['$$','$$']));}if(_0xfd1570['body']){_0xfd1570['body']=JSON[_0x68c4('0x65')](Mustache[_0x68c4('0x6a')](JSON[_0x68c4('0x6c')](_0xfd1570[_0x68c4('0x64')]),_0x1b704d,{},['$$','$$']));}}catch(_0x3f2287){logger[_0x68c4('0x28')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3f2287);}}rp(_0xfd1570)[_0x68c4('0x12')](function(_0x21a6e2){var _0x508f80={'statusCode':_0x21a6e2[_0x68c4('0x6d')]||0xc8,'statusMessage':_0x21a6e2[_0x68c4('0x6e')]||'OK','headers':_0x21a6e2[_0x68c4('0x6b')]||{},'body':_0x21a6e2[_0x68c4('0x64')]||{}};_0x39c3e8(null,_0x508f80);})[_0x68c4('0x13')](function(_0x3aebef){var _0xf1129b={'statusCode':_0x3aebef[_0x68c4('0x6d')]||0x1f4,'statusMessage':_0x3aebef[_0x68c4('0x6f')]||_0x68c4('0x70'),'headers':_0x3aebef[_0x68c4('0x71')][_0x68c4('0x6b')]||{},'body':_0x3aebef[_0x68c4('0x71')][_0x68c4('0x64')]||{}};_0x39c3e8(null,_0xf1129b);});};AGIVertices[_0x68c4('0x14')]['googleDialogflow']=function(_0x3c97d7,_0x134a80){scripts[_0x68c4('0x72')](this['channel']['uniqueid'],_0x3c97d7[_0x68c4('0x73')],_0x3c97d7[_0x68c4('0x55')],_0x3c97d7['dialogflow_language']||'en')[_0x68c4('0x12')](function(_0xd2eab){_0x134a80(null,_0xd2eab);})[_0x68c4('0x13')](function(_0x141acd){_0x134a80(_0x141acd);});};AGIVertices['prototype'][_0x68c4('0x74')]=function(_0x3172dd,_0x281a26){scripts[_0x68c4('0x74')](this['channel'][_0x68c4('0x37')],_0x3172dd[_0x68c4('0x75')],_0x3172dd[_0x68c4('0x76')],_0x3172dd[_0x68c4('0x77')],_0x3172dd[_0x68c4('0x55')],_0x3172dd[_0x68c4('0x78')]||'en')[_0x68c4('0x12')](function(_0x3e0df1){_0x281a26(null,_0x3e0df1);})['catch'](function(_0x5cbe63){_0x281a26(_0x5cbe63);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x79')]=function(_0x3ee9d3,_0x1d10a8){scripts[_0x68c4('0x79')](this[_0x68c4('0xe')],_0x3ee9d3)[_0x68c4('0x12')](function(_0x18d162){_0x1d10a8(null,_0x18d162);})[_0x68c4('0x13')](function(_0xa7aee4){_0x1d10a8(_0xa7aee4);});};AGIVertices['prototype'][_0x68c4('0x7a')]=function(_0x13b970,_0x5f202d){scripts[_0x68c4('0x7a')](_0x13b970[_0x68c4('0x73')],_0x13b970[_0x68c4('0x55')],_0x13b970['ispeech_tts_language']||_0x68c4('0x56'),_0x13b970[_0x68c4('0x7b')])['then'](function(_0x14efe1){_0x5f202d(null,_0x14efe1);})[_0x68c4('0x13')](function(_0x3031ec){_0x5f202d(_0x3031ec);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x7c')]=function(_0x3c5300,_0x9bc613,_0x582c11){scripts[_0x68c4('0x7c')](_0x9bc613,_0x3c5300['key'],_0x3c5300[_0x68c4('0x7d')]||_0x68c4('0x56'),this[_0x68c4('0x7e')](_0x3c5300['model'])?_0x3c5300[_0x68c4('0x7f')]:undefined)[_0x68c4('0x12')](function(_0x50fe77){_0x582c11(null,_0x50fe77);})[_0x68c4('0x13')](function(_0x443ea0){_0x582c11(_0x443ea0);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x80')]=function(_0x6cd79a,_0x556286){scripts[_0x68c4('0x80')](_0x6cd79a[_0x68c4('0x81')],_0x6cd79a['aws_secret_access_key'],_0x6cd79a[_0x68c4('0x82')],_0x6cd79a[_0x68c4('0x83')]||_0x68c4('0x84'),_0x6cd79a[_0x68c4('0x55')],_0x6cd79a[_0x68c4('0x85')]||'text')[_0x68c4('0x12')](function(_0x203076){_0x556286(null,_0x203076);})[_0x68c4('0x13')](function(_0x14f058){_0x556286(_0x14f058);});};AGIVertices[_0x68c4('0x14')]['awsLex']=function(_0x4d8333,_0x4ddc78){scripts['awsLex'](this[_0x68c4('0xe')][_0x68c4('0x37')],_0x4d8333[_0x68c4('0x81')],_0x4d8333[_0x68c4('0x86')],_0x4d8333[_0x68c4('0x87')],_0x4d8333[_0x68c4('0x55')],_0x4d8333[_0x68c4('0x88')])[_0x68c4('0x12')](function(_0x2f671c){_0x4ddc78(null,_0x2f671c);})['catch'](function(_0x340634){_0x4ddc78(_0x340634);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x89')]=function(_0x3e6f5b,_0x9b753c,_0x5e2ad2){scripts['googleASR'](_0x9b753c,_0x3e6f5b[_0x68c4('0x73')],_0x3e6f5b[_0x68c4('0x8a')]||_0x68c4('0x56'))[_0x68c4('0x12')](function(_0x3adde8){_0x5e2ad2(null,_0x3adde8);})[_0x68c4('0x13')](function(_0xeebe60){_0x5e2ad2(_0xeebe60);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x8b')]=function(_0x549e98,_0x3cf4d1,_0x25f34f){scripts[_0x68c4('0x8b')](_0x3cf4d1,_0x549e98[_0x68c4('0x8c')],_0x549e98[_0x68c4('0x8d')],_0x549e98[_0x68c4('0x69')])['then'](function(_0x16cdce){_0x25f34f(null,_0x16cdce);})[_0x68c4('0x13')](function(_0x3fbf6f){_0x25f34f(_0x3fbf6f);});};AGIVertices[_0x68c4('0x14')][_0x68c4('0x8e')]=function(_0x46764f){var _0x2798a8=_[_0x68c4('0x60')](verticesWithRetry,_0x46764f[_0x68c4('0x34')])?_0x46764f:_[_0x68c4('0x8f')](_0x46764f);for(var _0x1af896 in _0x2798a8){if(_0x2798a8[_0x68c4('0x90')](_0x1af896)){if(_0x2798a8[_0x1af896]&&_['isString'](_0x2798a8[_0x1af896])){if(_[_0x68c4('0x60')](recursiveMapAttributes,_0x1af896)){_0x2798a8[_0x1af896]=this[_0x68c4('0x91')](_0x2798a8[_0x1af896]);}else{_0x2798a8[_0x1af896]=this[_0x68c4('0x92')](_0x2798a8[_0x1af896]);}}}}return _0x2798a8;};AGIVertices[_0x68c4('0x14')][_0x68c4('0x93')]=function(_0x394260){for(var _0x42c4f1 in _0x394260){if(_0x394260[_0x68c4('0x90')](_0x42c4f1)){if(_[_0x68c4('0x94')](_0x394260[_0x42c4f1])){this[_0x68c4('0x93')](_0x394260[_0x42c4f1]);}else if(_[_0x68c4('0x95')](_0x394260[_0x42c4f1])){for(var _0x30e248=0x0;_0x30e248<_0x394260[_0x42c4f1][_0x68c4('0x96')];_0x30e248++){this['recursiveNodeIndex'](_0x394260[_0x42c4f1][_0x30e248]);}}else if(_[_0x68c4('0x97')](_0x394260[_0x42c4f1])){_0x394260[_0x42c4f1]=this[_0x68c4('0x92')](_0x394260[_0x42c4f1]);}}}};AGIVertices['prototype'][_0x68c4('0x98')]=function(_0x17eba3,_0x38fa66){for(var _0x30d58b in _0x17eba3){if(_0x17eba3[_0x68c4('0x90')](_0x30d58b)){if(_[_0x68c4('0x94')](_0x17eba3[_0x30d58b])){if(!_[_0x68c4('0x42')](_0x17eba3[_0x30d58b])){this[_0x68c4('0x98')](_0x17eba3[_0x30d58b],util['format'](_0x68c4('0x99'),_0x38fa66,_0x30d58b));}}else if(_['isArray'](_0x17eba3[_0x30d58b])){for(var _0x1991c1=0x0;_0x1991c1<_0x17eba3[_0x30d58b][_0x68c4('0x96')];_0x1991c1++){this[_0x68c4('0x98')](_0x17eba3[_0x30d58b][_0x1991c1],util['format'](_0x68c4('0x99'),_0x38fa66,_0x30d58b+'['+_0x1991c1+']'));}}else{if(!_[_0x68c4('0x3f')](_0x17eba3[_0x30d58b])){this[_0x68c4('0xe')]['setVariable'](util[_0x68c4('0x25')]('%s.%s',_0x38fa66,_0x30d58b),_0x17eba3[_0x30d58b]);}}}}};AGIVertices[_0x68c4('0x14')][_0x68c4('0x91')]=function(_0x11c0bd){try{var _0x567979=JSON[_0x68c4('0x65')](_0x11c0bd);this[_0x68c4('0x93')](_0x567979);return JSON[_0x68c4('0x6c')](_0x567979);}catch(_0x39a536){return this[_0x68c4('0x92')](_0x11c0bd);}};AGIVertices[_0x68c4('0x14')]['replaceAllVariables']=function(_0x643ed4){var _0x52d4e3=_0x643ed4[_0x68c4('0x9a')]('{');for(var _0x509843=0x1;_0x509843<_0x52d4e3[_0x68c4('0x96')];_0x509843+=0x1){var _0x5dbdc3=_0x52d4e3[_0x509843][_0x68c4('0x9a')]('}');if(_0x5dbdc3['length']>0x1){_0x643ed4=_0x643ed4[_0x68c4('0x9b')]('{'+_0x5dbdc3[0x0]+'}',this[_0x68c4('0xe')][_0x68c4('0x10')](_0x5dbdc3[0x0])['extra']||_0x5dbdc3[0x0]);}}if(_0x52d4e3[_0x68c4('0x96')]===0x1){return _0x643ed4[_0x68c4('0x46')]();}return this[_0x68c4('0x92')](_0x643ed4);};AGIVertices[_0x68c4('0x14')]['getAndSetVariable']=function(_0xb9a133,_0x4682a6){var _0xbcbc6c=this[_0x68c4('0xe')][_0x68c4('0x10')](_0xb9a133);if(_0xbcbc6c[_0x68c4('0x9c')]===-0x1){return _0xbcbc6c;}logger[_0x68c4('0x2a')](util['format'](_0x68c4('0x9d'),_0x4682a6,_0xbcbc6c['extra']));return this[_0x68c4('0xe')][_0x68c4('0x9e')](_0x4682a6,_0xbcbc6c['extra']);};AGIVertices[_0x68c4('0x14')][_0x68c4('0x7e')]=function(_0x16809d){return _0x16809d&&_0x16809d!=='0'&&_0x16809d!=='-1'&&_0x16809d!=='';};AGIVertices[_0x68c4('0x14')][_0x68c4('0x9f')]=function(_0x6b0b58){this['createSquareDetailsReport'][_0x68c4('0x68')](this,_0x6b0b58,'-');_0x6b0b58['retry']=_0x6b0b58[_0x68c4('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x68c4('0x14')]['mrcpsynth']=function(_0x350504){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0xa0'),_0x350504[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x350504['text'])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xa2'));}var _0x132b7d='\x22'+_0x350504[_0x68c4('0x55')]+'\x22';if(this[_0x68c4('0x7e')](_0x350504[_0x68c4('0x71')])){_0x132b7d+=','+_0x350504['options'];}var _0x2f0b4b=this[_0x68c4('0xe')][_0x68c4('0xa3')](_0x68c4('0xa4'),_0x132b7d);if(_0x2f0b4b[_0x68c4('0x9c')]===-0x1){return _0x2f0b4b;}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xa5'),_0x132b7d));};AGIVertices[_0x68c4('0x14')][_0x68c4('0xa6')]=function(_0x465b8d){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0xa7'),_0x465b8d[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x465b8d[_0x68c4('0xa8')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xa9'));}var _0x2337c5=_0x465b8d[_0x68c4('0xa8')];if(this[_0x68c4('0x7e')](_0x465b8d['options'])){_0x2337c5+=','+_0x465b8d[_0x68c4('0x71')];}var _0xcfff56=this['channel'][_0x68c4('0xa3')](_0x68c4('0xaa'),_0x2337c5);if(_0xcfff56['result']===-0x1){return _0xcfff56;}var _0x224b46=this['getAndSetVariable'](_0x68c4('0xab'),_0x68c4('0xac'));if(_0x224b46[_0x68c4('0x9c')]===-0x1){return _0x224b46;}var _0x4b4989=this['getAndSetVariable'](_0x68c4('0xad'),_0x68c4('0xae'));if(_0x4b4989['result']===-0x1){return _0x4b4989;}var _0x5397bc=this[_0x68c4('0xaf')](_0x68c4('0xb0'),'MRCP_RECOG_INSTANCE');if(_0x5397bc[_0x68c4('0x9c')]===-0x1){return _0x5397bc;}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xb1'),_0x2337c5));};AGIVertices[_0x68c4('0x14')][_0x68c4('0x6')]=function(_0x47965f){logger['info'](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x47965f[_0x68c4('0x33')]));return this[_0x68c4('0xe')][_0x68c4('0x6')]([_0x47965f[_0x68c4('0xb2')],_0x47965f[_0x68c4('0xb3')]]);};AGIVertices[_0x68c4('0x14')][_0x68c4('0xb4')]=function(_0x2cdec7){logger[_0x68c4('0x2a')](util['format'](_0x68c4('0xb5'),_0x2cdec7['label']));if(this[_0x68c4('0x7e')](_0x2cdec7[_0x68c4('0x5e')])){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0xb6'),_0x2cdec7['timeout']));var _0x37b88a=this['channel'][_0x68c4('0xb7')](_0x2cdec7['timeout']);if(_0x37b88a[_0x68c4('0x9c')]===-0x1){return _0x37b88a;}}return this[_0x68c4('0xe')][_0x68c4('0xb4')]();};AGIVertices['prototype']['callback']=function(_0x51bbd2){logger[_0x68c4('0x2a')](util['format'](_0x68c4('0xb8'),_0x51bbd2[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x51bbd2[_0x68c4('0xb9')])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x51bbd2,_0x68c4('0xba'));}_0x51bbd2[_0x68c4('0x45')]=moment();if(this[_0x68c4('0x7e')](_0x51bbd2['delay'])){_0x51bbd2[_0x68c4('0x45')]=moment()[_0x68c4('0xbb')](_0x51bbd2[_0x68c4('0xbc')],'minutes');}if(!this['isConfigured'](_0x51bbd2[_0x68c4('0xbd')])){_0x51bbd2[_0x68c4('0xbd')]=0x2;}this['createCmContact'][_0x68c4('0x68')](this,_0x51bbd2);return this[_0x68c4('0xe')]['noop'](util[_0x68c4('0x25')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x51bbd2[_0x68c4('0xbe')],_0x51bbd2[_0x68c4('0xb9')],_0x51bbd2[_0x68c4('0x45')]));};AGIVertices['prototype'][_0x68c4('0xbf')]=function(_0x432ee4){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0xc0'),_0x432ee4['label']));var _0x277efe=this['channel'][_0x68c4('0xa3')](_0x432ee4[_0x68c4('0xc1')],_0x432ee4[_0x68c4('0x71')]);if(_0x277efe[_0x68c4('0x9c')]===-0x1){return _0x277efe;}return this[_0x68c4('0xe')]['noop'](util['format'](_0x68c4('0xc2'),_0x432ee4[_0x68c4('0xc1')],_0x432ee4[_0x68c4('0x71')]));};AGIVertices[_0x68c4('0x14')][_0x68c4('0xc3')]=function(_0x5024d1){logger['info'](util[_0x68c4('0x25')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x5024d1['label']));if(!this[_0x68c4('0x7e')](_0x5024d1['text'])){return this[_0x68c4('0xe')][_0x68c4('0xa1')]('no\x20text\x20configured');}var _0x2dcdb1='\x22'+_0x5024d1[_0x68c4('0x55')]+'\x22';if(this[_0x68c4('0x7e')](_0x5024d1['options'])){_0x2dcdb1+=','+_0x5024d1[_0x68c4('0x71')];}var _0xb7ddce=this[_0x68c4('0xe')][_0x68c4('0xa3')](_0x68c4('0xa4'),_0x2dcdb1);if(_0xb7ddce[_0x68c4('0x9c')]===-0x1){return _0xb7ddce;}return this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xa5'),_0x2dcdb1));};AGIVertices[_0x68c4('0x14')][_0x68c4('0xc4')]=function(_0x11db0e){logger[_0x68c4('0x2a')](util['format'](_0x68c4('0xc5'),_0x11db0e[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x11db0e[_0x68c4('0x55')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xa2'));}var _0x178519='\x22'+_0x11db0e[_0x68c4('0x55')]+'\x22';if(this[_0x68c4('0x7e')](_0x11db0e[_0x68c4('0x71')])){_0x178519+=','+_0x11db0e['options'];}var _0x4fbedd=this[_0x68c4('0xe')][_0x68c4('0xa3')]('MRCPSynth',_0x178519);if(_0x4fbedd[_0x68c4('0x9c')]===-0x1){return _0x4fbedd;}return this[_0x68c4('0xe')]['noop'](util[_0x68c4('0x25')](_0x68c4('0xa5'),_0x178519));};AGIVertices[_0x68c4('0x14')][_0x68c4('0xc6')]=function(_0x4642cc){logger[_0x68c4('0x2a')](util['format'](_0x68c4('0xc7'),_0x4642cc[_0x68c4('0x33')]));if(!this['isConfigured'](_0x4642cc['grammar'])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xa9'));}var _0x367bf5=_0x4642cc['grammar'];if(this['isConfigured'](_0x4642cc['options'])){_0x367bf5+=','+_0x4642cc[_0x68c4('0x71')];}var _0x4f2947=this[_0x68c4('0xe')][_0x68c4('0xa3')](_0x68c4('0xaa'),_0x367bf5);if(_0x4f2947[_0x68c4('0x9c')]===-0x1){return _0x4f2947;}var _0x7a7c22=this['getAndSetVariable'](_0x68c4('0xab'),_0x68c4('0xc8'));if(_0x7a7c22[_0x68c4('0x9c')]===-0x1){return _0x7a7c22;}var _0x5b49bf=this[_0x68c4('0xaf')](_0x68c4('0xad'),_0x68c4('0xc9'));if(_0x5b49bf[_0x68c4('0x9c')]===-0x1){return _0x5b49bf;}var _0x433d01=this[_0x68c4('0xaf')](_0x68c4('0xb0'),_0x68c4('0xca'));if(_0x433d01[_0x68c4('0x9c')]===-0x1){return _0x433d01;}return this[_0x68c4('0xe')]['noop'](util[_0x68c4('0x25')](_0x68c4('0xb1'),_0x367bf5));};AGIVertices['prototype']['sestekasr']=function(_0x29ad0e){logger[_0x68c4('0x2a')](util['format'](_0x68c4('0xcb'),_0x29ad0e[_0x68c4('0x33')]));if(!this['isConfigured'](_0x29ad0e[_0x68c4('0xa8')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xa9'));}var _0x54febf=_0x29ad0e['grammar'];if(this['isConfigured'](_0x29ad0e['options'])){_0x54febf+=','+_0x29ad0e[_0x68c4('0x71')];}var _0x2dd4c7=this[_0x68c4('0xe')][_0x68c4('0xa3')](_0x68c4('0xaa'),_0x54febf);if(_0x2dd4c7[_0x68c4('0x9c')]===-0x1){return _0x2dd4c7;}var _0x5ea869=this[_0x68c4('0xaf')](_0x68c4('0xab'),_0x68c4('0xcc'));if(_0x5ea869['result']===-0x1){return _0x5ea869;}var _0x1259a7=this[_0x68c4('0xaf')](_0x68c4('0xad'),_0x68c4('0xcd'));if(_0x1259a7[_0x68c4('0x9c')]===-0x1){return _0x1259a7;}var _0x3479b6=this[_0x68c4('0xaf')](_0x68c4('0xb0'),_0x68c4('0xce'));if(_0x3479b6['result']===-0x1){return _0x3479b6;}return this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xb1'),_0x54febf));};AGIVertices[_0x68c4('0x14')]['database']=function(_0x33c19f){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0xcf'),_0x33c19f['label']));if(!this['isConfigured'](_0x33c19f[_0x68c4('0xd0')])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x33c19f,_0x68c4('0xd1'));}var _0x133195=this['getSquareOdbc'][_0x68c4('0x68')](this,_0x33c19f[_0x68c4('0xd0')]);if(!_0x133195){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x33c19f,_0x68c4('0xd2'));}if(!this['isConfigured'](_0x33c19f[_0x68c4('0xd3')])){return this['channel']['error'](_0x33c19f,_0x68c4('0xd4'));}var _0x43c5e3=_0x33c19f['query'][_0x68c4('0x52')](/(\r\n|\n|\r)/gm,'\x20');this[_0x68c4('0xe')]['noop'](util[_0x68c4('0x25')]('query:\x20%s',_0x43c5e3));var _0x24f1ab=this[_0x68c4('0x26')][_0x68c4('0x68')](this,_0x133195,_0x43c5e3);this[_0x68c4('0x32')][_0x68c4('0x68')](this,_0x33c19f,_0x43c5e3);if(!this[_0x68c4('0x7e')](_0x33c19f['variable_id'])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xd5'));}var _0x15a8cf=this['getVariable']['sync'](this,_0x33c19f[_0x68c4('0xd6')]);if(!_0x15a8cf){return this[_0x68c4('0xe')]['error'](_0x33c19f,'no\x20variable\x20found');}var _0x59d262=this;_0x24f1ab[_0x68c4('0xd7')](function(_0x5f3f65,_0x4742e6){Object[_0x68c4('0xd8')](_0x5f3f65)[_0x68c4('0xd7')](function(_0x59bef6){_0x59d262['channel'][_0x68c4('0x9e')](util[_0x68c4('0x25')](_0x68c4('0xd9'),_0x15a8cf,_0x4742e6,_0x59bef6),_0x5f3f65[_0x59bef6]);});});this[_0x68c4('0xe')][_0x68c4('0x9e')](util[_0x68c4('0x25')](_0x68c4('0xda'),_0x15a8cf),_0x24f1ab[_0x68c4('0x96')]);return this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xdb'),_0x15a8cf));};AGIVertices['prototype']['dial']=function(_0x2cc6ae){logger[_0x68c4('0xdc')](util[_0x68c4('0x25')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2cc6ae[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x2cc6ae[_0x68c4('0xdd')])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x2cc6ae,_0x68c4('0xde'));}var _0x170989=this['getUser'][_0x68c4('0x68')](this,_0x2cc6ae['sip_id']);if(!_0x170989){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x2cc6ae,_0x68c4('0xdf'));}var _0x405794=this[_0x68c4('0xe')]['exec'](_0x68c4('0xe0'),[util[_0x68c4('0x25')](_0x68c4('0xe1'),_0x170989),_0x2cc6ae['timeout'],_0x2cc6ae[_0x68c4('0xe2')],_0x2cc6ae[_0x68c4('0x5c')]]);if(_0x405794[_0x68c4('0x9c')]===-0x1){return _0x405794;}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')]('Executed\x20command\x20%s',_0x68c4('0xe0')));};AGIVertices[_0x68c4('0x14')][_0x68c4('0xe3')]=function(_0x5ed9a3){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5ed9a3['label']));if(!this['isConfigured'](_0x5ed9a3[_0x68c4('0x73')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xe4'));}if(!this['isConfigured'](_0x5ed9a3['text'])){return this['channel'][_0x68c4('0xa1')](_0x68c4('0xa2'));}this[_0x68c4('0xe')][_0x68c4('0xe5')]=!![];this[_0x68c4('0x32')](_0x5ed9a3);this[_0x68c4('0x3d')](_0x5ed9a3[_0x68c4('0x55')],'in','','');this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xe6'),_0x5ed9a3[_0x68c4('0x55')]));var _0x1ead81=this[_0x68c4('0x72')][_0x68c4('0x68')](this,_0x5ed9a3);if(_0x1ead81){for(var _0x3b08e4 in _0x1ead81){if(_0x1ead81[_0x68c4('0x90')](_0x3b08e4)){this['channel'][_0x68c4('0x9e')](util[_0x68c4('0x25')](_0x68c4('0xe7'),_0x3b08e4[_0x68c4('0x63')]()),_0x1ead81[_0x3b08e4]);}}this[_0x68c4('0x3d')](_0x1ead81[_0x68c4('0xe8')],_0x68c4('0xe9'),_0x68c4('0xe3'),'');return this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xea'),_0x1ead81[_0x68c4('0xe8')]));}return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x5ed9a3,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x68c4('0xeb')]=function(_0x365f41){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0xec'),_0x365f41['label']));if(!this['isConfigured'](_0x365f41[_0x68c4('0x75')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xed'));}if(!this[_0x68c4('0x7e')](_0x365f41[_0x68c4('0x76')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')]('no\x20client_email\x20configured');}if(!this[_0x68c4('0x7e')](_0x365f41['private_key'])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xee'));}if(!this[_0x68c4('0x7e')](_0x365f41['dialogflowV2_language'])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xef'));}if(!this[_0x68c4('0x7e')](_0x365f41[_0x68c4('0x55')])){return this[_0x68c4('0xe')]['noop']('no\x20text\x20configured');}this[_0x68c4('0xe')]['bot']=!![];this[_0x68c4('0x32')](_0x365f41);this[_0x68c4('0x3d')](_0x365f41['text'],'in','','');this[_0x68c4('0xe')][_0x68c4('0xa1')](util['format'](_0x68c4('0xf0'),_0x365f41['text']));var _0x29f9dd=this[_0x68c4('0x74')]['sync'](this,_0x365f41);if(_0x29f9dd){for(var _0x4cabdd in _0x29f9dd){if(_0x29f9dd[_0x68c4('0x90')](_0x4cabdd)){if(_0x4cabdd!=='providerResponse'){this[_0x68c4('0xe')][_0x68c4('0x9e')](util['format']('DIALOGFLOW_%s',_0x4cabdd[_0x68c4('0x63')]()),_0x29f9dd[_0x4cabdd]);}}}this[_0x68c4('0x3d')](_0x29f9dd[_0x68c4('0xe8')],_0x68c4('0xe9'),_0x68c4('0xeb'),_0x29f9dd[_0x68c4('0xf1')]);return this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')]('DialogflowV2\x20Result\x20%s',_0x29f9dd[_0x68c4('0xe8')]));}return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x365f41,_0x68c4('0xf2'));};AGIVertices[_0x68c4('0x14')][_0x68c4('0xf3')]=function(_0x5657e6){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0xf4'),_0x5657e6[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x5657e6[_0x68c4('0xf5')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xf6'));}if(!this[_0x68c4('0x7e')](_0x5657e6['username'])){return this['channel']['noop'](_0x68c4('0xf7'));}if(!this[_0x68c4('0x7e')](_0x5657e6['password'])){return this[_0x68c4('0xe')]['noop'](_0x68c4('0xf8'));}if(!this[_0x68c4('0x7e')](_0x5657e6[_0x68c4('0xf9')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')]('no\x20text\x20configured');}this[_0x68c4('0xe')]['bot']=!![];this[_0x68c4('0x32')](_0x5657e6);this[_0x68c4('0x3d')](_0x5657e6[_0x68c4('0x55')],'in','','');this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xfa'),_0x5657e6['text']));var _0x2010a8=this['sestekNDA'][_0x68c4('0x68')](this,_0x5657e6);if(_0x2010a8){for(var _0x402502 in _0x2010a8){if(_0x2010a8[_0x68c4('0x90')](_0x402502)){this[_0x68c4('0xe')][_0x68c4('0x9e')](util[_0x68c4('0x25')](_0x68c4('0xfb'),_0x402502[_0x68c4('0x63')]()),_0x2010a8[_0x402502]);}}this[_0x68c4('0x3d')](_0x2010a8[_0x68c4('0xe8')],'out',_0x68c4('0xf3'),'');if(_0x2010a8['audiofile']){this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x2010a8['audiofile']));var _0xdcc23e=this['channel'][_0x68c4('0xfc')](_0x2010a8[_0x68c4('0xfd')]);try{fs[_0x68c4('0xfe')](_0x2010a8[_0x68c4('0xfd')]+_0x68c4('0xff'));}catch(_0x257de7){logger[_0x68c4('0x28')](_0x257de7);}return _0xdcc23e;}else{return this['channel']['noop'](util['format'](_0x68c4('0x100'),_0x2010a8[_0x68c4('0xe8')]));}}return this['channel'][_0x68c4('0x28')](_0x5657e6,_0x68c4('0x101'));};AGIVertices[_0x68c4('0x14')][_0x68c4('0x102')]=function(_0x2d942f){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x103'),_0x2d942f[_0x68c4('0x33')]));return this[_0x68c4('0xe')]['noop'](_0x68c4('0x102'));};AGIVertices[_0x68c4('0x14')][_0x68c4('0x104')]=function(_0x3c2d85){logger['info'](util[_0x68c4('0x25')](_0x68c4('0x105'),_0x3c2d85[_0x68c4('0x33')]));var _0x4181f1='';if(_0x3c2d85[_0x68c4('0x106')]){if(!this[_0x68c4('0x7e')](_0x3c2d85[_0x68c4('0x106')])){return this['channel'][_0x68c4('0x28')](_0x3c2d85,'no\x20trunk\x20selected');}else{var _0x1ddc37=parseInt(_0x3c2d85[_0x68c4('0x106')],0xa);if(isNaN(_0x1ddc37)){_0x4181f1=_0x3c2d85[_0x68c4('0x106')];}else{_0x4181f1=this[_0x68c4('0x1a')][_0x68c4('0x68')](this,_0x3c2d85[_0x68c4('0x106')]);if(!_0x4181f1){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x3c2d85,'no\x20trunk\x20found');}}}}else if(_0x3c2d85[_0x68c4('0x107')]){_0x4181f1=_0x3c2d85['trunk_name'];}else{return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x3c2d85,'no\x20trunk\x20selected');}var _0x572861=this[_0x68c4('0xe')][_0x68c4('0xa3')](_0x68c4('0xe0'),[util[_0x68c4('0x25')](_0x68c4('0x108'),_0x4181f1,_0x3c2d85['phone']),_0x3c2d85[_0x68c4('0x5e')],_0x3c2d85[_0x68c4('0xe2')],_0x3c2d85[_0x68c4('0x5c')]]);if(_0x572861['result']===-0x1){return _0x572861;}return this[_0x68c4('0xe')]['noop'](util[_0x68c4('0x25')](_0x68c4('0x109'),_0x68c4('0xe0')));};AGIVertices[_0x68c4('0x14')][_0x68c4('0x10a')]=function(_0xa0a7c3){logger['info'](util[_0x68c4('0x25')](_0x68c4('0x10b'),_0xa0a7c3[_0x68c4('0x33')]));return this[_0x68c4('0xe')][_0x68c4('0xa1')]('finally');};AGIVertices[_0x68c4('0x14')]['getdigits']=function(_0x52cf42){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x10c'),_0x52cf42[_0x68c4('0x33')]));if(_0x52cf42[_0x68c4('0x10d')]===0x0){return this[_0x68c4('0x9f')](_0x52cf42);}_0x52cf42[_0x68c4('0x10d')]-=0x1;if(!this[_0x68c4('0x7e')](_0x52cf42[_0x68c4('0x10e')])){return this['channel'][_0x68c4('0x28')](_0x52cf42,_0x68c4('0x10f'));}var _0x53e362=this[_0x68c4('0x1b')]['sync'](this,_0x52cf42['file_id']);if(!_0x53e362){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x52cf42,_0x68c4('0x110'));}if(!this[_0x68c4('0x7e')](_0x52cf42['variable_id'])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x68c4('0xd5'));}var _0x2c0522=this[_0x68c4('0xe')][_0x68c4('0x111')](_0x53e362,_0x52cf42[_0x68c4('0x112')],_0x52cf42[_0x68c4('0x113')]);var _0x316616=_0x2c0522[_0x68c4('0x9c')]?_0x2c0522['result'][_0x68c4('0x46')]():'';logger[_0x68c4('0x2a')](_0x68c4('0x114'),JSON[_0x68c4('0x6c')](_0x2c0522));if(_0x2c0522[_0x68c4('0x9c')]===-0x1){this[_0x68c4('0x32')][_0x68c4('0x68')](this,_0x52cf42,_0x316616);return _0x2c0522;}else if(_0x2c0522[_0x68c4('0x115')]===_0x68c4('0x5e')){_0x2c0522[_0x68c4('0x9c')]=_0x316616[_0x68c4('0x96')]>=parseInt(_0x52cf42['mindigit'])?'x':'i';}else{_0x2c0522[_0x68c4('0x9c')]=_0x316616[_0x68c4('0x96')]>=parseInt(_0x52cf42['mindigit'])&&_0x316616[_0x68c4('0x96')]<=parseInt(_0x52cf42[_0x68c4('0x113')])?'x':'i';}var _0x281b66=this['getVariable'][_0x68c4('0x68')](this,_0x52cf42[_0x68c4('0xd6')]);if(!_0x281b66){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x52cf42,_0x68c4('0x116'));}this[_0x68c4('0xe')]['setVariable'](_0x281b66,_0x316616);if(this[_0x68c4('0x7e')](_0x52cf42['hiddendigitsnum'])){var _0x483968=parseInt(_0x52cf42[_0x68c4('0x117')],0xa);var _0x2f1282=rs['generate']({'charset':'*','length':_0x483968});var _0x3c9163=_0x316616[_0x68c4('0x96')];if(_0x3c9163>0x0){if(_0x3c9163>_0x483968){this[_0x68c4('0x32')][_0x68c4('0x68')](this,_0x52cf42,_0x52cf42[_0x68c4('0x118')]==='first'?_0x2f1282+_0x316616[_0x68c4('0x119')](_0x483968):_0x316616['substr'](0x0,_0x3c9163-_0x483968)+_0x2f1282);}else{this[_0x68c4('0x32')]['sync'](this,_0x52cf42,rs[_0x68c4('0x11a')]({'charset':'*','length':_0x3c9163}));}}else{this[_0x68c4('0x32')][_0x68c4('0x68')](this,_0x52cf42,'');}}else{this['createSquareDetailsReport'][_0x68c4('0x68')](this,_0x52cf42,_0x316616);}return _0x2c0522;};AGIVertices[_0x68c4('0x14')][_0x68c4('0xd')]=function(_0x4673c1){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x4673c1[_0x68c4('0x33')]));return this['getdigits'](_0x4673c1);};AGIVertices[_0x68c4('0x14')]['goal']=function(_0x499905){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x499905[_0x68c4('0x33')]));this['createSquareDetailsReport'][_0x68c4('0x68')](this,_0x499905,_0x499905['goalname']);return this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x11b'),_0x499905['goalname']));};AGIVertices['prototype'][_0x68c4('0x11c')]=function(_0x1da853){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x11d'),_0x1da853[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x1da853['aws_access_key_id'])||!this['isConfigured'](_0x1da853[_0x68c4('0x86')])){return this[_0x68c4('0xe')]['noop'](_0x68c4('0x11e'));}if(!this[_0x68c4('0x7e')](_0x1da853[_0x68c4('0x55')])){return this['channel'][_0x68c4('0xa1')](_0x68c4('0xa2'));}this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x11f'),_0x1da853['text']));var _0x2b7cd1=this[_0x68c4('0x80')][_0x68c4('0x68')](this,_0x1da853);if(_0x2b7cd1){this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x120'),_0x2b7cd1));var _0x9eae09=this[_0x68c4('0xe')]['streamFile'](_0x2b7cd1);try{fs[_0x68c4('0xfe')](_0x2b7cd1+_0x68c4('0xff'));}catch(_0x301176){logger[_0x68c4('0x28')](_0x301176);}return _0x9eae09;}return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x1da853,_0x68c4('0x121'));};AGIVertices[_0x68c4('0x14')][_0x68c4('0x122')]=function(_0x2138ff){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x123'),_0x2138ff[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x2138ff[_0x68c4('0x81')])||!this[_0x68c4('0x7e')](_0x2138ff[_0x68c4('0x86')])){return this[_0x68c4('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x68c4('0x7e')](_0x2138ff['aws_bot_name'])){return this[_0x68c4('0xe')][_0x68c4('0xa1')]('no\x20bot\x20name\x20configured');}if(!this[_0x68c4('0x7e')](_0x2138ff['text'])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xa2'));}this[_0x68c4('0xe')][_0x68c4('0xe5')]=!![];this['createSquareDetailsReport'](_0x2138ff);this[_0x68c4('0x3d')](_0x2138ff[_0x68c4('0x55')],'in','','');this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2138ff[_0x68c4('0x55')]));var _0x5ea318=this['awsLex'][_0x68c4('0x68')](this,_0x2138ff);if(_0x5ea318){for(var _0x4826a8 in _0x5ea318){if(_0x5ea318[_0x68c4('0x90')](_0x4826a8)&&_['isString'](_0x5ea318[_0x4826a8])){this[_0x68c4('0xe')]['setVariable'](util['format'](_0x68c4('0x124'),_0x4826a8[_0x68c4('0x63')]()),_0x5ea318[_0x4826a8]);}}if(_['isNil'](_0x5ea318[_0x68c4('0x6f')])){return this['channel'][_0x68c4('0xa1')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x68c4('0x3d')](_0x5ea318[_0x68c4('0x6f')],_0x68c4('0xe9'),_0x68c4('0x125'),'');return this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x126'),_0x5ea318[_0x68c4('0x6f')]));}}return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x2138ff,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x68c4('0x14')][_0x68c4('0x127')]=function(_0x43efc5){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x43efc5[_0x68c4('0x33')],_0x43efc5[_0x68c4('0x5e')]));if(!this[_0x68c4('0x7e')](_0x43efc5[_0x68c4('0x73')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xe4'));}var _0x52fd6b=_0x68c4('0x128');var _0x3c2208=util[_0x68c4('0x25')](_0x68c4('0x129'),FILES_PATH,rs['generate'](0x4));var _0x2c4295=util[_0x68c4('0x25')](_0x68c4('0x99'),_0x3c2208,_0x52fd6b);var _0x209ae8=!![];if(_0x43efc5[_0x68c4('0x12a')]==='NOBEEP'){_0x209ae8=![];}var _0x6894aa=this['channel']['recordFile'](_0x3c2208,_0x52fd6b,_0x43efc5[_0x68c4('0x12b')],_0x43efc5[_0x68c4('0x5e')],undefined,_0x209ae8);if(_0x6894aa[_0x68c4('0x9c')]!==-0x1){this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x12c'),_0x2c4295));var _0x18236e=this['googleASR'][_0x68c4('0x68')](this,_0x43efc5,_0x2c4295);if(_0x18236e){for(var _0x465a37 in _0x18236e){if(_0x18236e[_0x68c4('0x90')](_0x465a37)){this['channel']['setVariable'](util['format']('GOOGLE_ASR_%s',_0x465a37[_0x68c4('0x63')]()),_0x18236e[_0x465a37]);}}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')]('GoogleASR\x20Result\x20%s',JSON[_0x68c4('0x6c')](_0x18236e)));}}return _0x6894aa;};AGIVertices[_0x68c4('0x14')]['tildeasr']=function(_0x578a6f){logger[_0x68c4('0x2a')](util['format'](_0x68c4('0x12d'),_0x578a6f[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x578a6f[_0x68c4('0x8c')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0x12e'));}if(!this['isConfigured'](_0x578a6f[_0x68c4('0x8d')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0x12f'));}var _0x5e8149=_0x68c4('0x128');var _0x918c4b=util[_0x68c4('0x25')](_0x68c4('0x129'),FILES_PATH,rs[_0x68c4('0x11a')](0x4));var _0x2dc885=util[_0x68c4('0x25')]('%s.%s',_0x918c4b,_0x5e8149);var _0x38bdcd=!![];if(_0x578a6f[_0x68c4('0x12a')]==='NOBEEP'){_0x38bdcd=![];}var _0x44cf8c=this['channel'][_0x68c4('0x130')](_0x918c4b,_0x5e8149,_0x578a6f['intKey'],_0x578a6f[_0x68c4('0x5e')],undefined,_0x38bdcd);if(_0x44cf8c[_0x68c4('0x9c')]!==-0x1){this[_0x68c4('0xe')][_0x68c4('0xa1')](util['format'](_0x68c4('0x131'),_0x2dc885));var _0x3fec79=this[_0x68c4('0x8b')]['sync'](this,_0x578a6f,_0x2dc885);if(_0x3fec79){for(var _0x1ce283 in _0x3fec79){if(_0x3fec79[_0x68c4('0x90')](_0x1ce283)){this[_0x68c4('0xe')][_0x68c4('0x9e')](util[_0x68c4('0x25')](_0x68c4('0x132'),_0x1ce283[_0x68c4('0x63')]()),_0x3fec79[_0x1ce283]);}}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x133'),JSON[_0x68c4('0x6c')](_0x3fec79)));}}return _0x44cf8c;};AGIVertices[_0x68c4('0x14')][_0x68c4('0x134')]=function(_0x425d36){logger['info'](util[_0x68c4('0x25')](_0x68c4('0x135'),_0x425d36[_0x68c4('0x33')]));return this[_0x68c4('0xe')][_0x68c4('0x136')](_0x425d36[_0x68c4('0x3a')],_0x425d36[_0x68c4('0x3b')],_0x425d36[_0x68c4('0x3c')]);};AGIVertices[_0x68c4('0x14')][_0x68c4('0x137')]=function(_0x449583){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x138'),_0x449583['label']));if(!this[_0x68c4('0x7e')](_0x449583[_0x68c4('0x139')])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x449583,_0x68c4('0x13a'));}try{var _0x3903db=eval(_0x449583[_0x68c4('0x139')])?'true':_0x68c4('0x13b');this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x13c'),_0x449583[_0x68c4('0x139')],_0x3903db));return{'code':0xc8,'result':_0x3903db};}catch(_0x521933){return{'code':0xc8,'result':_0x68c4('0x13b')};}};AGIVertices[_0x68c4('0x14')][_0x68c4('0x13d')]=function(_0x14555a){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x14555a[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x14555a[_0x68c4('0x13e')])){return this[_0x68c4('0xe')]['error'](_0x14555a,_0x68c4('0x13f'));}var _0x344cd3=this[_0x68c4('0x21')][_0x68c4('0x68')](this,_0x14555a[_0x68c4('0x13e')]);if(!_0x344cd3){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x14555a,_0x68c4('0x140'));}for(var _0x3094e0=0x0;_0x3094e0<_0x344cd3[_0x68c4('0x96')];_0x3094e0+=0x1){var _0x2aad81=this['channel'][_0x68c4('0x10')](util['format']('IFTIME(%s?true:false)',_0x344cd3[_0x3094e0]));if(_0x2aad81[_0x68c4('0x9c')]===-0x1){return _0x2aad81;}logger[_0x68c4('0x2a')](util['format'](_0x68c4('0x141'),_0x344cd3[_0x3094e0],_0x2aad81[_0x68c4('0x115')]));if(_0x2aad81[_0x68c4('0x115')]===_0x68c4('0x142')){logger[_0x68c4('0x2a')](util['format'](_0x68c4('0x141'),_0x344cd3[_0x3094e0],'true'));this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x141'),_0x344cd3[_0x3094e0],_0x68c4('0x142')));return{'code':0xc8,'result':'true'};}else{logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('IFTIME\x20%s\x20%s',_0x344cd3[_0x3094e0],_0x68c4('0x13b')));this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x141'),_0x344cd3[_0x3094e0],_0x68c4('0x13b')));}}return{'code':0xc8,'result':_0x68c4('0x13b')};};AGIVertices['prototype'][_0x68c4('0x143')]=function(_0x5a48f1){logger['info'](util[_0x68c4('0x25')](_0x68c4('0x144'),_0x5a48f1['label']));return this[_0x68c4('0xe')][_0x68c4('0x143')]();};AGIVertices['prototype']['ispeechasr']=function(_0x20dfb8){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x145'),_0x20dfb8[_0x68c4('0x33')]));if(!this['isConfigured'](_0x20dfb8[_0x68c4('0x73')])){return this[_0x68c4('0xe')]['noop'](_0x68c4('0xe4'));}var _0x1ac624=_0x68c4('0x128');var _0x5506ad=util[_0x68c4('0x25')](_0x68c4('0x129'),FILES_PATH,rs[_0x68c4('0x11a')](0x4));var _0x5ecb02=util['format'](_0x68c4('0x99'),_0x5506ad,_0x1ac624);var _0x2361ed=!![];if(_0x20dfb8[_0x68c4('0x12a')]===_0x68c4('0x146')){_0x2361ed=![];}var _0x1b44dd=this[_0x68c4('0xe')][_0x68c4('0x130')](_0x5506ad,_0x1ac624,_0x20dfb8[_0x68c4('0x12b')],_0x20dfb8['timeout'],undefined,_0x2361ed);if(_0x1b44dd[_0x68c4('0x9c')]!==-0x1){this[_0x68c4('0xe')][_0x68c4('0xa1')](util['format'](_0x68c4('0x147'),_0x5ecb02));var _0x3ac8ce=this[_0x68c4('0x7c')][_0x68c4('0x68')](this,_0x20dfb8,_0x5ecb02);if(_0x3ac8ce){for(var _0x1e1bde in _0x3ac8ce){if(_0x3ac8ce['hasOwnProperty'](_0x1e1bde)){this['channel'][_0x68c4('0x9e')](util['format']('ISPEECH_ASR_%s',_0x1e1bde[_0x68c4('0x63')]()),_0x3ac8ce[_0x1e1bde]);}}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x148'),JSON['stringify'](_0x3ac8ce)));}}return _0x1b44dd;};AGIVertices[_0x68c4('0x14')][_0x68c4('0x149')]=function(_0x451ddf){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x451ddf['label']));if(!this[_0x68c4('0x7e')](_0x451ddf[_0x68c4('0x73')])){return this['channel'][_0x68c4('0xa1')](_0x68c4('0xe4'));}if(!this[_0x68c4('0x7e')](_0x451ddf[_0x68c4('0x55')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xa2'));}this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x14a'),_0x451ddf[_0x68c4('0x55')]));var _0x489cf4=this[_0x68c4('0x7a')][_0x68c4('0x68')](this,_0x451ddf);if(_0x489cf4){this[_0x68c4('0xe')]['noop'](util[_0x68c4('0x25')](_0x68c4('0x147'),_0x489cf4));var _0x3e86aa=this['channel'][_0x68c4('0xfc')](_0x489cf4,_0x451ddf[_0x68c4('0x12b')]);try{fs['unlink'](_0x489cf4+_0x68c4('0xff'));}catch(_0x82ce34){logger['error'](_0x82ce34);}return _0x3e86aa;}return this[_0x68c4('0xe')]['error'](_0x451ddf,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x68c4('0x14')][_0x68c4('0x14b')]=function(_0x2bf317){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x14c'),_0x2bf317[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x2bf317[_0x68c4('0x14d')])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x2bf317,'no\x20find\x20by\x20configured');}logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x68c4('0xe')][_0x68c4('0x38')],_0x2bf317[_0x68c4('0x14d')]));var _0x4f6c6e=this[_0x68c4('0x4f')]['sync'](this,_0x2bf317[_0x68c4('0x14d')]);if(_0x4f6c6e){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x68c4('0xe')][_0x68c4('0x38')],_0x2bf317[_0x68c4('0x14d')]));this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x14e'),this['channel'][_0x68c4('0x38')],_0x2bf317['findBy']));return{'code':0xc8,'result':_0x68c4('0x14f')};}else{logger['info'](util[_0x68c4('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x68c4('0xe')]['callerid'],_0x2bf317[_0x68c4('0x14d')]));this['channel']['noop'](util[_0x68c4('0x25')](_0x68c4('0x150'),this['channel']['callerid'],_0x2bf317[_0x68c4('0x14d')]));return{'code':0xc8,'result':_0x68c4('0x151')};}};AGIVertices[_0x68c4('0x14')]['logout']=function(_0x34817f){logger['info'](util[_0x68c4('0x25')](_0x68c4('0x152'),_0x34817f['label']));if(!this[_0x68c4('0x7e')](_0x34817f[_0x68c4('0x14d')])){return this['channel']['error'](_0x34817f,_0x68c4('0x153'));}logger['info'](util['format'](_0x68c4('0x154'),this[_0x68c4('0xe')][_0x68c4('0x38')],_0x34817f[_0x68c4('0x14d')]));var _0x5e240c=this[_0x68c4('0x4b')][_0x68c4('0x68')](this,_0x34817f[_0x68c4('0x14d')]);if(_0x5e240c){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x14e'),this['channel'][_0x68c4('0x38')],_0x34817f[_0x68c4('0x14d')]));this[_0x68c4('0xe')][_0x68c4('0xa1')](util['format'](_0x68c4('0x14e'),this[_0x68c4('0xe')]['callerid'],_0x34817f[_0x68c4('0x14d')]));return{'code':0xc8,'result':_0x68c4('0x14f')};}else{logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x150'),this[_0x68c4('0xe')][_0x68c4('0x38')],_0x34817f[_0x68c4('0x14d')]));this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x68c4('0xe')][_0x68c4('0x38')],_0x34817f['findBy']));return{'code':0xc8,'result':_0x68c4('0x151')};}};AGIVertices[_0x68c4('0x14')][_0x68c4('0x155')]=function(_0x2b5144){logger['info'](util['format'](_0x68c4('0x156'),_0x2b5144['label']));if(!this[_0x68c4('0x7e')](_0x2b5144[_0x68c4('0x157')])){return this['channel'][_0x68c4('0x28')](_0x2b5144,_0x68c4('0x158'));}this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')]('math\x20%s',_0x2b5144[_0x68c4('0x157')]));var _0x501a23=eval(_0x2b5144[_0x68c4('0x157')]);if(!this['isConfigured'](_0x2b5144[_0x68c4('0xd6')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5a3c65=this[_0x68c4('0x10')]['sync'](this,_0x2b5144['variable_id']);if(!_0x5a3c65){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x2b5144,_0x68c4('0x116'));}if(_[_0x68c4('0x95')](_0x501a23)){var _0x4a6011=this;_0x501a23[_0x68c4('0xd7')](function(_0x5a9357,_0x399262){_0x4a6011['channel']['setVariable'](util[_0x68c4('0x25')](_0x68c4('0x159'),_0x5a3c65,_0x399262),_0x5a9357);});return this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x15a'),_0x5a3c65));}else{return this[_0x68c4('0xe')][_0x68c4('0x9e')](_0x5a3c65,_0x501a23);}};AGIVertices[_0x68c4('0x14')][_0x68c4('0x15b')]=function(_0x3de113){logger['info'](util['format'](_0x68c4('0x15c'),_0x3de113['label']));if(_0x3de113[_0x68c4('0x10d')]===0x0){return this[_0x68c4('0x9f')](_0x3de113);}_0x3de113[_0x68c4('0x10d')]-=0x1;if(!this[_0x68c4('0x7e')](_0x3de113[_0x68c4('0x10e')])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x3de113,_0x68c4('0x10f'));}var _0xed9838=this['getSound'][_0x68c4('0x68')](this,_0x3de113[_0x68c4('0x10e')]);if(!_0xed9838){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x3de113,_0x68c4('0x110'));}var _0x1df63d=this[_0x68c4('0xe')]['getData'](_0xed9838,_0x3de113[_0x68c4('0x112')],_0x3de113[_0x68c4('0x15d')]);var _0x25b69f=_0x1df63d['result'];if(_0x1df63d[_0x68c4('0x9c')]===-0x1){this[_0x68c4('0x32')][_0x68c4('0x68')](this,_0x3de113,'-1');return _0x1df63d;}else if(_0x1df63d['extra']===_0x68c4('0x5e')){_0x1df63d['result']=_0x1df63d['result'][_0x68c4('0x96')]>0x0?_0x1df63d['result']:'t';}else if(_['isEmpty'](_0x1df63d[_0x68c4('0x9c')])){_0x1df63d['result']='#';_0x25b69f='#';}if(!this[_0x68c4('0x7e')](_0x3de113[_0x68c4('0xd6')])){this[_0x68c4('0xe')][_0x68c4('0xa1')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3d98ea=this[_0x68c4('0x10')][_0x68c4('0x68')](this,_0x3de113[_0x68c4('0xd6')]);if(!_0x3d98ea){return this[_0x68c4('0xe')]['error'](_0x3de113,_0x68c4('0x116'));}this[_0x68c4('0xe')][_0x68c4('0x9e')](_0x3d98ea,_0x25b69f);}this['createSquareDetailsReport'][_0x68c4('0x68')](this,_0x3de113,_0x25b69f);return _0x1df63d;};AGIVertices[_0x68c4('0x14')][_0x68c4('0xa1')]=function(_0x28a69f){logger[_0x68c4('0x2a')](util['format'](_0x68c4('0x15e'),_0x28a69f[_0x68c4('0x33')]));return this[_0x68c4('0xe')]['noop'](_0x28a69f['output']||_0x28a69f[_0x68c4('0x33')]);};AGIVertices['prototype']['pause']=function(_0x2bb229){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x15f'),_0x2bb229[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x2bb229[_0x68c4('0x14d')])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x2bb229,'no\x20find\x20by\x20configured');}logger['info'](util[_0x68c4('0x25')](_0x68c4('0x154'),this[_0x68c4('0xe')][_0x68c4('0x38')],_0x2bb229['findBy']));var _0x4e6e05=this[_0x68c4('0x47')][_0x68c4('0x68')](this,_0x2bb229['pause_id']);var _0x2d1fc4=this[_0x68c4('0x48')][_0x68c4('0x68')](this,_0x2bb229[_0x68c4('0x14d')],_0x4e6e05);if(_0x2d1fc4){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x14e'),this[_0x68c4('0xe')][_0x68c4('0x38')],_0x2bb229[_0x68c4('0x14d')]));this['channel'][_0x68c4('0xa1')](util['format'](_0x68c4('0x14e'),this[_0x68c4('0xe')][_0x68c4('0x38')],_0x2bb229[_0x68c4('0x14d')]));return{'code':0xc8,'result':_0x68c4('0x14f')};}else{logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x68c4('0xe')][_0x68c4('0x38')],_0x2bb229['findBy']));this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x14e'),this[_0x68c4('0xe')][_0x68c4('0x38')],_0x2bb229[_0x68c4('0x14d')]));return{'code':0xc8,'result':_0x68c4('0x151')};}};AGIVertices[_0x68c4('0x14')][_0x68c4('0x160')]=function(_0x5dd774){logger['info'](util[_0x68c4('0x25')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x5dd774[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x5dd774[_0x68c4('0x10e')])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x5dd774,'no\x20file\x20audio\x20selected');}var _0x185335=this[_0x68c4('0x1b')][_0x68c4('0x68')](this,_0x5dd774[_0x68c4('0x10e')]);if(!_0x185335){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x5dd774,_0x68c4('0x110'));}var _0x53219b=this[_0x68c4('0xe')][_0x68c4('0xa3')](_0x68c4('0x161'),[_0x185335,_0x5dd774['opts']]);if(_0x53219b[_0x68c4('0x9c')]===-0x1){return _0x53219b;}return this[_0x68c4('0xe')]['noop'](util[_0x68c4('0x25')]('Executed\x20command\x20%s\x20%s',_0x68c4('0x161'),_0x185335));};AGIVertices['prototype'][_0x68c4('0x162')]=function(_0x59663f){logger['info'](util[_0x68c4('0x25')](_0x68c4('0x163'),_0x59663f['label']));if(!this[_0x68c4('0x7e')](_0x59663f['queue_id'])){return this[_0x68c4('0xe')]['error'](_0x59663f,_0x68c4('0x164'));}var _0x4134ab='';var _0xe65ec3=parseInt(_0x59663f[_0x68c4('0x165')],0xa);if(isNaN(_0xe65ec3)){_0x4134ab=_0x59663f[_0x68c4('0x165')];}else{_0x4134ab=this[_0x68c4('0x166')][_0x68c4('0x68')](this,_0x59663f['queue_id']);if(!_0x4134ab){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x59663f,_0x68c4('0x167'));}}var _0x599c25='';if(this['isConfigured'](_0x59663f[_0x68c4('0x10e')])){var _0x27a4ce=this[_0x68c4('0x1b')][_0x68c4('0x68')](this,_0x59663f[_0x68c4('0x10e')]);if(_0x27a4ce){_0x599c25=_0x27a4ce;}}this[_0x68c4('0x32')][_0x68c4('0x68')](this,_0x59663f,_0x4134ab);if(_0x59663f[_0x68c4('0xe2')][_0x68c4('0x168')]('x')<0x0){_0x59663f['opts']+='x';}if(_0x59663f[_0x68c4('0xe2')]['indexOf']('X')<0x0){_0x59663f[_0x68c4('0xe2')]+='X';}this[_0x68c4('0xe')][_0x68c4('0x9e')](_0x68c4('0x169'),_0x4134ab?_0x4134ab[_0x68c4('0x16a')]():'');var _0x21c571=this[_0x68c4('0xe')]['exec'](_0x68c4('0x16b'),[_0x4134ab,_0x59663f['opts'],_0x59663f[_0x68c4('0x5c')],_0x599c25,_0x59663f[_0x68c4('0x5e')],_0x59663f[_0x68c4('0x6')],_0x59663f[_0x68c4('0x16c')],_0x59663f[_0x68c4('0x16d')],'',_0x59663f[_0x68c4('0x16e')]]);if(_0x21c571[_0x68c4('0x9c')]===-0x1){return _0x21c571;}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xc2'),_0x68c4('0x16b'),_0x4134ab));};AGIVertices[_0x68c4('0x14')]['record']=function(_0x5013c7){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x16f'),_0x5013c7[_0x68c4('0x33')]));var _0xd37e07=_0x5013c7[_0x68c4('0x170')]||_0x68c4('0x128');var _0xc599ea=util[_0x68c4('0x25')]('%s_%s',this[_0x68c4('0xe')]['uniqueid'],rs[_0x68c4('0x11a')](0x5));var _0x50a70f=util['format'](_0x68c4('0x171'),FILES_PATH,_0xc599ea,_0xd37e07);var _0x15554a=util[_0x68c4('0x25')](_0x68c4('0x129'),FILES_PATH,_0xc599ea);this[_0x68c4('0x36')][_0x68c4('0x68')](this,_0x5013c7,_0xc599ea,_0x50a70f);this['channel'][_0x68c4('0x9e')](_0x68c4('0x172'),_0xc599ea);logger[_0x68c4('0x2a')](_0x68c4('0x173'),_0x15554a,_0xd37e07,_0x5013c7['escape_digits'],_0x5013c7[_0x68c4('0x5e')]);return this['channel'][_0x68c4('0x130')](_0x15554a,_0xd37e07,_0x5013c7['escape_digits'],_0x5013c7[_0x68c4('0x5e')],undefined,!![]);};AGIVertices[_0x68c4('0x14')][_0x68c4('0x174')]=function(_0x2ae907){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x2ae907[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x2ae907[_0x68c4('0x5c')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x3d6125=this[_0x68c4('0x5b')]['sync'](this,_0x2ae907);logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('Response:',util[_0x68c4('0x175')](_0x3d6125,{'showHidden':![],'depth':null})));if(!this[_0x68c4('0x7e')](_0x2ae907['variable_id'])){return this['channel'][_0x68c4('0xa1')](_0x68c4('0x176'));}var _0x1417a2=this[_0x68c4('0x10')][_0x68c4('0x68')](this,_0x2ae907[_0x68c4('0xd6')]);if(!_0x1417a2){return this['channel'][_0x68c4('0x28')](_0x2ae907,'no\x20variable\x20found');}this['channel']['setVariable'](util[_0x68c4('0x25')](_0x68c4('0x177'),_0x1417a2),_0x3d6125[_0x68c4('0x6d')]?_0x3d6125[_0x68c4('0x6d')]:_0x68c4('0x178'));this['channel'][_0x68c4('0x9e')](util[_0x68c4('0x25')](_0x68c4('0x179'),_0x1417a2),_0x3d6125[_0x68c4('0x6e')]?_0x3d6125['statusMessage']:'OK');if(_0x3d6125['body']){try{this[_0x68c4('0x98')](_0x3d6125[_0x68c4('0x64')],_0x1417a2);}catch(_0x3181f2){logger['error'](util[_0x68c4('0x25')](_0x68c4('0x17a'),_0x1417a2));}}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util['format'](_0x68c4('0xdb'),_0x1417a2));};AGIVertices[_0x68c4('0x14')]['saydigits']=function(_0x5215b7){logger[_0x68c4('0x2a')](util['format'](_0x68c4('0x17b'),_0x5215b7[_0x68c4('0x33')]));return this[_0x68c4('0xe')][_0x68c4('0x17c')](_0x5215b7[_0x68c4('0x17d')][_0x68c4('0x52')](/\s+/g,''),_0x5215b7[_0x68c4('0x17e')]);};AGIVertices[_0x68c4('0x14')][_0x68c4('0x17f')]=function(_0xac8363){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x180'),_0xac8363[_0x68c4('0x33')]));return this[_0x68c4('0xe')]['sayNumber'](_0xac8363[_0x68c4('0x5f')][_0x68c4('0x52')](/\s+/g,''),_0xac8363[_0x68c4('0x17e')]);};AGIVertices[_0x68c4('0x14')]['sayphonetic']=function(_0x36af74){logger['info'](util[_0x68c4('0x25')](_0x68c4('0x181'),_0x36af74[_0x68c4('0x33')]));return this[_0x68c4('0xe')][_0x68c4('0x182')](_0x36af74[_0x68c4('0x55')],_0x36af74['escape_digits']);};AGIVertices[_0x68c4('0x14')]['sendMail']=function(_0x209d5f){logger[_0x68c4('0x2a')](util['format'](_0x68c4('0x183'),_0x209d5f[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x209d5f[_0x68c4('0x184')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0x185'));}var _0x1a8c16=this[_0x68c4('0x186')][_0x68c4('0x68')](this,_0x209d5f[_0x68c4('0x184')]);if(!_0x1a8c16||!_0x1a8c16[_0x68c4('0x187')]){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x209d5f,'no\x20mail\x20account\x20found');}var _0x125a7a={'from':util[_0x68c4('0x25')](_0x68c4('0x188'),_0x1a8c16[_0x68c4('0x15')],_0x1a8c16[_0x68c4('0x189')]||_0x1a8c16[_0x68c4('0x187')][_0x68c4('0x18a')]),'to':_0x209d5f['to']||'','cc':_0x209d5f['cc']||'','bcc':_0x209d5f['bcc']||'','subject':_0x209d5f[_0x68c4('0x18b')],'html':_0x209d5f['text'],'text':_0x209d5f[_0x68c4('0x55')]};var _0x2d5320={'tls':{'rejectUnauthorized':![]}};if(_0x1a8c16['Smtp'][_0x68c4('0x18c')]){_0x2d5320[_0x68c4('0x18c')]=_0x1a8c16[_0x68c4('0x187')]['service'];}else{_0x2d5320[_0x68c4('0x18d')]=_0x1a8c16[_0x68c4('0x187')][_0x68c4('0x18d')];_0x2d5320[_0x68c4('0x18e')]=_0x1a8c16['Smtp'][_0x68c4('0x18e')];_0x2d5320[_0x68c4('0x18f')]=_0x1a8c16[_0x68c4('0x187')][_0x68c4('0x18f')];}if(_0x1a8c16[_0x68c4('0x187')][_0x68c4('0x190')]){_0x2d5320[_0x68c4('0x191')]={'user':_0x1a8c16[_0x68c4('0x187')]['user'],'pass':_0x1a8c16[_0x68c4('0x187')][_0x68c4('0x192')]};}if(this[_0x68c4('0x7e')](_0x209d5f[_0x68c4('0x193')])){}logger[_0x68c4('0xdc')]('sendMail\x20message',JSON[_0x68c4('0x6c')](_0x125a7a));this['createSquareDetailsReport'][_0x68c4('0x68')](this,_0x209d5f,_0x209d5f[_0x68c4('0x184')]);this[_0x68c4('0xe')][_0x68c4('0xa1')](util['format'](_0x68c4('0x194'),_0x1a8c16[_0x68c4('0x15')]));this[_0x68c4('0x1f')]['sync'](this,_0x2d5320,_0x125a7a);return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0x195'));};AGIVertices[_0x68c4('0x14')][_0x68c4('0x196')]=function(_0x17889d){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x17889d[_0x68c4('0x33')]));return this['channel']['noop'](_0x68c4('0x197'));};AGIVertices[_0x68c4('0x14')][_0x68c4('0x198')]=function(_0x9df102){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x199'),_0x9df102['label']));if(!this[_0x68c4('0x7e')](_0x9df102[_0x68c4('0x19a')])){return this[_0x68c4('0xe')]['noop'](_0x68c4('0x19b'));}var _0x4ca1dd=this[_0x68c4('0x2f')][_0x68c4('0x68')](this,_0x9df102[_0x68c4('0x19a')]);if(!_0x4ca1dd){return this[_0x68c4('0xe')]['error'](_0x9df102,_0x68c4('0x19c'));}var _0x2c3b4d={'body':_0x9df102['sms_text'],'phone':_0x9df102['to']||'','SmsAccountId':_0x4ca1dd['id']};logger[_0x68c4('0xdc')]('sendSMS\x20message',JSON[_0x68c4('0x6c')](_0x2c3b4d));this[_0x68c4('0x32')][_0x68c4('0x68')](this,_0x9df102,_0x9df102[_0x68c4('0x19a')]);this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x19d'),_0x4ca1dd[_0x68c4('0x15')]));this[_0x68c4('0x31')]['sync'](this,_0x2c3b4d);return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0x19e'));};AGIVertices['prototype'][_0x68c4('0x19f')]=function(_0x4c40c1){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x1a0'),_0x4c40c1[_0x68c4('0x33')]));if(!this['isConfigured'](_0x4c40c1[_0x68c4('0xd6')])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x4c40c1,'no\x20variable\x20selected');}var _0x4464b7=this['getVariable']['sync'](this,_0x4c40c1[_0x68c4('0xd6')]);if(!_0x4464b7){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x4c40c1,'no\x20variable\x20found');}return this[_0x68c4('0xe')]['setVariable'](_0x4464b7,_0x4c40c1['variable_value']);};AGIVertices['prototype'][_0x68c4('0x1a1')]=function(_0x46295d){logger['info'](util[_0x68c4('0x25')]('Enter\x20in\x20START\x20(%s)\x20block',_0x46295d[_0x68c4('0x33')]));this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0x1a2'));if(_0x46295d['answer']==='yes'){this[_0x68c4('0xe')]['noop'](_0x68c4('0x1a3'));return this[_0x68c4('0xe')][_0x68c4('0xb4')]();}return this[_0x68c4('0xe')]['noop'](_0x68c4('0x1a4'));};AGIVertices[_0x68c4('0x14')][_0x68c4('0x1a5')]=function(_0x30ee7b){logger['info'](util[_0x68c4('0x25')](_0x68c4('0x1a6'),_0x30ee7b[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x30ee7b[_0x68c4('0x1a7')])){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x30ee7b,_0x68c4('0x1a8'));}var _0x2a0129=this[_0x68c4('0x1a9')]['sync'](this,_0x30ee7b[_0x68c4('0x1a7')]);if(!this[_0x68c4('0x7e')](_0x2a0129)){return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x30ee7b,util[_0x68c4('0x25')](_0x68c4('0x1aa'),_0x30ee7b[_0x68c4('0x1a7')]));}if(_0x2a0129===this[_0x68c4('0xe')][_0x68c4('0x35')]){return this['channel'][_0x68c4('0x28')](_0x30ee7b,_0x68c4('0x1ab'));}this[_0x68c4('0x32')][_0x68c4('0x68')](this,_0x30ee7b,_0x2a0129);var _0x1019a2=this[_0x68c4('0xe')]['exec'](_0x68c4('0x1ac'),util[_0x68c4('0x25')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi']['host']||_0x68c4('0x1ad'),_0x2a0129,this['channel'][_0x68c4('0x35')]));if(_0x1019a2['result']===-0x1){return _0x1019a2;}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xc2'),_0x68c4('0x1ac'),_0x2a0129));};AGIVertices['prototype']['system']=function(_0x2390ff){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x1ae'),_0x2390ff[_0x68c4('0x33')]));var _0x49ff30=this[_0x68c4('0x50')][_0x68c4('0x68')](this,_0x2390ff[_0x68c4('0xb2')]);this[_0x68c4('0x32')]['sync'](this,_0x2390ff,_0x2390ff[_0x68c4('0xb2')]);if(this[_0x68c4('0x7e')](_0x2390ff[_0x68c4('0xd6')])){var _0x23a92c=this[_0x68c4('0x10')][_0x68c4('0x68')](this,_0x2390ff[_0x68c4('0xd6')]);if(_0x23a92c){this[_0x68c4('0xe')][_0x68c4('0x9e')](_0x23a92c,_0x49ff30);return this['channel']['noop'](util[_0x68c4('0x25')](_0x68c4('0x1af'),_0x2390ff[_0x68c4('0xb2')],_0x23a92c));}}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2390ff[_0x68c4('0xb2')]));};AGIVertices['prototype'][_0x68c4('0x1b0')]=function(_0x3565a9){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3565a9[_0x68c4('0x33')]));_0x3565a9['text']=_0x3565a9[_0x68c4('0x55')][_0x68c4('0x52')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3565a9[_0x68c4('0x1b1')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0x1b2'));}if(!this['isConfigured'](_0x3565a9[_0x68c4('0x55')])){return this[_0x68c4('0xe')][_0x68c4('0xa1')](_0x68c4('0xa2'));}this[_0x68c4('0xe')][_0x68c4('0xa1')](util['format'](_0x68c4('0x1b3'),_0x3565a9[_0x68c4('0x55')]));var _0x57221b=this[_0x68c4('0x53')]['sync'](this,_0x3565a9);if(_0x57221b){this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x57221b));var _0xb646ff=this[_0x68c4('0xe')]['streamFile'](_0x57221b);try{fs['unlink'](_0x57221b+_0x68c4('0xff'));}catch(_0x99a105){logger[_0x68c4('0x28')](_0x99a105);}return _0xb646ff;}return this[_0x68c4('0xe')][_0x68c4('0x28')](_0x3565a9,_0x68c4('0x1b4'));};AGIVertices[_0x68c4('0x14')][_0x68c4('0x1b5')]=function(_0x31a3a7){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x31a3a7[_0x68c4('0x33')]));_0x31a3a7[_0x68c4('0x55')]=_0x31a3a7[_0x68c4('0x55')][_0x68c4('0x52')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x68c4('0x7e')](_0x31a3a7[_0x68c4('0x55')])){return this['channel'][_0x68c4('0xa1')]('no\x20text\x20configured');}this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x1b6'),_0x31a3a7[_0x68c4('0x55')]));var _0x484627=this['googleTTS'][_0x68c4('0x68')](this,_0x31a3a7);if(_0x484627){this[_0x68c4('0xe')][_0x68c4('0xa1')](util['format'](_0x68c4('0x1b7'),_0x484627));var _0x580ce2=this[_0x68c4('0xe')][_0x68c4('0xfc')](_0x484627);try{fs[_0x68c4('0xfe')](_0x484627+_0x68c4('0xff'));}catch(_0x2927c9){logger[_0x68c4('0x28')](_0x2927c9);}return _0x580ce2;}return this['channel'][_0x68c4('0x28')](_0x31a3a7,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x68c4('0x14')][_0x68c4('0x1b8')]=function(_0x5121ef){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x1b9'),_0x5121ef['label']));if(!this[_0x68c4('0x7e')](_0x5121ef[_0x68c4('0x14d')])){return this[_0x68c4('0xe')]['error'](_0x5121ef,_0x68c4('0x153'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x68c4('0xe')][_0x68c4('0x38')],_0x5121ef[_0x68c4('0x14d')]));var _0xaf9d94=this['agentUnpause']['sync'](this,_0x5121ef[_0x68c4('0x14d')]);if(_0xaf9d94){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x14e'),this['channel'][_0x68c4('0x38')],_0x5121ef[_0x68c4('0x14d')]));this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x14e'),this['channel']['callerid'],_0x5121ef[_0x68c4('0x14d')]));return{'code':0xc8,'result':_0x68c4('0x14f')};}else{logger['info'](util[_0x68c4('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x68c4('0x38')],_0x5121ef[_0x68c4('0x14d')]));this['channel'][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0x150'),this[_0x68c4('0xe')]['callerid'],_0x5121ef[_0x68c4('0x14d')]));return{'code':0xc8,'result':_0x68c4('0x151')};}};AGIVertices[_0x68c4('0x14')]['voicemail']=function(_0x4d1265){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x1ba'),_0x4d1265[_0x68c4('0x33')]));var _0x4267aa=this[_0x68c4('0xe')][_0x68c4('0xa3')]('VOICEMAIL',[_0x4d1265[_0x68c4('0x1bb')],_0x4d1265[_0x68c4('0x71')]]);if(_0x4267aa[_0x68c4('0x9c')]===-0x1){return _0x4267aa;}return this[_0x68c4('0xe')][_0x68c4('0xa1')](util[_0x68c4('0x25')](_0x68c4('0xc2'),_0x68c4('0x1bc'),_0x4d1265[_0x68c4('0x1bb')]));};AGIVertices[_0x68c4('0x14')][_0x68c4('0x1bd')]=function(_0x1c3308){logger[_0x68c4('0x2a')](util[_0x68c4('0x25')](_0x68c4('0x1be'),_0x1c3308[_0x68c4('0x33')]));if(!this[_0x68c4('0x7e')](_0x1c3308[_0x68c4('0xd6')])){return this[_0x68c4('0xe')]['error'](_0x1c3308,_0x68c4('0x1bf'));}var _0x2e0305=this[_0x68c4('0x10')]['sync'](this,_0x1c3308[_0x68c4('0xd6')]);if(!_0x2e0305){return this[_0x68c4('0xe')]['error'](_0x1c3308,_0x68c4('0x116'));}var _0x589a37=this[_0x68c4('0xe')]['getVariable'](_0x2e0305);return{'code':0xc8,'result':_0x589a37['extra']?_0x589a37[_0x68c4('0x115')]:'-'};};String[_0x68c4('0x14')][_0x68c4('0x9b')]=function(_0x374a9b,_0x52ae5f){return this['split'](_0x374a9b)[_0x68c4('0x1c0')](_0x52ae5f);};module[_0x68c4('0x1c1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index b6db661..b761a7f 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 _0x7a54=['[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0x4966b8,_0x45cb3f){var _0x311109=function(_0x47a2db){while(--_0x47a2db){_0x4966b8['push'](_0x4966b8['shift']());}};_0x311109(++_0x45cb3f);}(_0x7a54,0x106));var _0x47a5=function(_0x366dd4,_0x2055fe){_0x366dd4=_0x366dd4-0x0;var _0x31039c=_0x7a54[_0x366dd4];return _0x31039c;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var ami=require('../ami');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x47a5('0x5'));function Acw(_0x11bf85){this[_0x47a5('0x6')]=_0x11bf85[_0x47a5('0x6')];this[_0x47a5('0x7')]=_0x11bf85['agents'];this[_0x47a5('0x8')]=_0x11bf85['timers'];this[_0x47a5('0x9')]={};ami['on'](_0x47a5('0xa'),this['syncAgentConnect'][_0x47a5('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x47a5('0xc'),this[_0x47a5('0xd')]['bind'](this));ami['on'](_0x47a5('0xe'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x47a5('0xf'),this[_0x47a5('0x10')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x11'),this[_0x47a5('0x12')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x13'),this['syncAgentConnectPreview'][_0x47a5('0xb')](this));}function getDiff(_0x221b54){var _0x1cf309=moment()[_0x47a5('0x14')](0x0);var _0x139f25=moment(_0x221b54)[_0x47a5('0x14')](0x0);return _0x1cf309[_0x47a5('0x15')](_0x139f25,_0x47a5('0x16'));}Acw['prototype'][_0x47a5('0x17')]=function(_0x11faf5){try{var _0x3b001e=this;var _0x2a2cbb=this[_0x47a5('0x9')][_0x11faf5]['interface'];var _0x549de3=this[_0x47a5('0x9')][_0x11faf5]['queue'];var _0x5247fd=this[_0x47a5('0x6')][_0x549de3];var _0xaf70a6=![];var _0x2ce454=_0x47a5('0x18');if(_0x5247fd[_0x47a5('0x19')]){if(_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')]){_0xaf70a6=!![];_0x2ce454=_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')];}}ami['Action']({'action':_0x47a5('0x1c'),'interface':_0x2a2cbb,'paused':!![],'reason':_0x2ce454})[_0x47a5('0x1d')](function(_0x47cf3c){if(_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]){return RpcUser[_0x47a5('0x1e')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]['id'])['then'](function(_0xb8ae6c){if(_0xb8ae6c&&!_0xb8ae6c[_0x47a5('0x1f')]){logger[_0x47a5('0x20')](_0x47a5('0x21'),_0x11faf5,_0x2a2cbb,_0x549de3);var _0x5ef1b1=_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x22')]&&_0x3b001e['channels'][_0x11faf5][_0x47a5('0x23')]?_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x23')]:_0x11faf5;return RpcUser[_0x47a5('0x24')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb],_0x2ce454,_0x5ef1b1)['then'](function(_0x53078a){if(!_0xaf70a6){_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]={};logger['info'](_0x47a5('0x25'),_0x11faf5,_0x3b001e['voiceQueues'][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=setTimeout(_0x3b001e[_0x47a5('0x28')][_0x47a5('0xb')](_0x3b001e,_0x2a2cbb),_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')]*0x3e8);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x29')]=moment()[_0x47a5('0x2a')](_0x47a5('0x2b'));_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x2c')]=_0x11faf5;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2d')]=_0x549de3;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2e')]=function(){var _0x9ac908=getDiff(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]['lastPauseAt']);clearTimeout(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x9ac908},_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2c')],_0x2a2cbb)[_0x47a5('0x1d')](function(_0x5bd7eb){logger['info'](_0x47a5('0x2f'),_0x11faf5,_0x9ac908,_0x5bd7eb);})[_0x47a5('0x30')](function(_0x57bff6){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x11faf5,_0x57bff6);});delete _0x3b001e[_0x47a5('0x8')][_0x2a2cbb];};}});}else{logger[_0x47a5('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x11faf5,_0x2a2cbb,_0x549de3);}});}})['catch'](function(_0x274e34){logger['error'](_0x47a5('0x25'),_0x11faf5,_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);})['finally'](function(){delete _0x3b001e[_0x47a5('0x9')][_0x11faf5];});}catch(_0x50c086){logger['error'](_0x47a5('0x32'),_0x50c086['message']);}};Acw[_0x47a5('0x33')]['stopAcw']=function(_0x21ad34){try{var _0x3534cb=this;if(_0x3534cb[_0x47a5('0x8')][_0x21ad34]){_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x27')]=![];var _0xed6320=_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x2c')];var _0x1a0d23=_0x3534cb['timers'][_0x21ad34][_0x47a5('0x2d')];var _0x10f136=_0x3534cb['voiceQueues'][_0x1a0d23][_0x47a5('0x26')];logger[_0x47a5('0x20')](_0x47a5('0x34'),_0xed6320,_0x21ad34);RpcUser['saveUnpause'](this[_0x47a5('0x7')][_0x21ad34]);RpcVoiceAgentReport[_0x47a5('0x35')]({'acwtime':_0x10f136,'agentacw':!![]},_0xed6320,_0x21ad34)['then'](function(_0x2ebba0){logger[_0x47a5('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0xed6320,_0x10f136,_0x2ebba0);})['catch'](function(_0x5ebd8c){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xed6320,_0x5ebd8c);});}else{logger[_0x47a5('0x31')](_0x47a5('0x36'),_0x21ad34);if(_0x3534cb[_0x47a5('0x8')]){logger[_0x47a5('0x20')](_0x47a5('0x37'),JSON[_0x47a5('0x38')](_0x3534cb[_0x47a5('0x8')]));}}}catch(_0x1f3d01){logger[_0x47a5('0x31')](_0x47a5('0x39'),_0x1f3d01[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x3b')]=function(_0x56dbbd){try{if(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]['acw']||this[_0x47a5('0x6')][_0x56dbbd['queue']]['mandatoryDisposition'])){if(this['agents'][_0x56dbbd['interface']]){this[_0x47a5('0x9')][_0x56dbbd['uniqueid']]={'queue':_0x56dbbd[_0x47a5('0x2d')],'interface':_0x56dbbd[_0x47a5('0x3c')],'destlinkedid':_0x56dbbd[_0x47a5('0x23')]};}}}catch(_0x494526){logger[_0x47a5('0x31')](_0x47a5('0x3d'),_0x494526['message']);}};Acw['prototype'][_0x47a5('0x3e')]=function(_0x4edf7f){try{if(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x4')]||this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x19')])){if(this[_0x47a5('0x7')][_0x4edf7f[_0x47a5('0x3c')]]){this[_0x47a5('0x9')][_0x4edf7f[_0x47a5('0x2c')]]={'queue':_0x4edf7f[_0x47a5('0x2d')],'interface':_0x4edf7f[_0x47a5('0x3c')]};}}}catch(_0x4e5e7){logger[_0x47a5('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4e5e7[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncHangupRequest']=function(_0x52b3a8){try{if(this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]['attended'])){logger[_0x47a5('0x20')]('[%s][HANGUP:UNIQUEID]',_0x52b3a8[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x52b3a8[_0x47a5('0x40')]]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['linkedid']]['attended'])){logger[_0x47a5('0x20')](_0x47a5('0x41'),_0x52b3a8[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x40')]);}}catch(_0x2c0c86){logger[_0x47a5('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x2c0c86[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0xd')]=function(_0x5c3c75){try{if(this[_0x47a5('0x9')][_0x5c3c75['uniqueid']]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x2c')]][_0x47a5('0x22')]){logger[_0x47a5('0x20')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5c3c75[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]['attended']){logger[_0x47a5('0x20')](_0x47a5('0x42'),_0x5c3c75[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x40')]);}}catch(_0x1ab0bf){logger['error'](_0x47a5('0x43'),_0x1ab0bf[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncAttendedTransfer']=function(_0x4c5ed){try{if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfereeuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x45')]);if(this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']]){this['channels'][_0x4c5ed[_0x47a5('0x46')]]['attended']=!![];this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']]=this['channels'][_0x4c5ed[_0x47a5('0x46')]];delete this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']];}}else if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x47')]);if(this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x48')]]){this[_0x47a5('0x9')][_0x4c5ed['origtransfereruniqueid']][_0x47a5('0x22')]=!![];this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x45')]]=this['channels'][_0x4c5ed[_0x47a5('0x48')]];delete this['channels'][_0x4c5ed[_0x47a5('0x48')]];}}}catch(_0x470da6){logger[_0x47a5('0x31')](_0x47a5('0x49'),_0x470da6[_0x47a5('0x3a')]);}};Acw['prototype'][_0x47a5('0x12')]=function(_0x5d1550){try{if(this['channels'][_0x5d1550['transfereruniqueid']]){logger['info'](_0x47a5('0x4a'),JSON[_0x47a5('0x38')](_0x5d1550[_0x47a5('0x4b')]));this['startAcw'](_0x5d1550['transfereruniqueid']);}else if(this[_0x47a5('0x9')][_0x5d1550[_0x47a5('0x4c')]]){logger[_0x47a5('0x20')](_0x47a5('0x4d'),JSON[_0x47a5('0x38')](_0x5d1550['transfererlinkedid']));this[_0x47a5('0x17')](_0x5d1550['transfererlinkedid']);}}catch(_0x22c886){logger[_0x47a5('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x22c886[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x4e')]=function(_0x3e8274){try{if(this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]&&this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]['autopause']===_0x47a5('0x4f')){if(this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]]){logger[_0x47a5('0x20')](_0x47a5('0x50'),_0x3e8274['uniqueid'],_0x3e8274[_0x47a5('0x3c')],_0x3e8274[_0x47a5('0x2d')]);return RpcUser[_0x47a5('0x24')](this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]],_0x47a5('0x51'),_0x3e8274[_0x47a5('0x2c')]);}}}catch(_0x149d34){logger[_0x47a5('0x31')](_0x47a5('0x52'),_0x149d34[_0x47a5('0x3a')]);}};module[_0x47a5('0x53')]=Acw; \ No newline at end of file +var _0x7a54=['[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0x5ddc09,_0x4518c9){var _0x5109a4=function(_0x3a10ec){while(--_0x3a10ec){_0x5ddc09['push'](_0x5ddc09['shift']());}};_0x5109a4(++_0x4518c9);}(_0x7a54,0x106));var _0x47a5=function(_0xd3daf6,_0x542efc){_0xd3daf6=_0xd3daf6-0x0;var _0x380e84=_0x7a54[_0xd3daf6];return _0x380e84;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var ami=require('../ami');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x47a5('0x5'));function Acw(_0x11bf85){this[_0x47a5('0x6')]=_0x11bf85[_0x47a5('0x6')];this[_0x47a5('0x7')]=_0x11bf85['agents'];this[_0x47a5('0x8')]=_0x11bf85['timers'];this[_0x47a5('0x9')]={};ami['on'](_0x47a5('0xa'),this['syncAgentConnect'][_0x47a5('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x47a5('0xc'),this[_0x47a5('0xd')]['bind'](this));ami['on'](_0x47a5('0xe'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x47a5('0xf'),this[_0x47a5('0x10')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x11'),this[_0x47a5('0x12')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x13'),this['syncAgentConnectPreview'][_0x47a5('0xb')](this));}function getDiff(_0x221b54){var _0x1cf309=moment()[_0x47a5('0x14')](0x0);var _0x139f25=moment(_0x221b54)[_0x47a5('0x14')](0x0);return _0x1cf309[_0x47a5('0x15')](_0x139f25,_0x47a5('0x16'));}Acw['prototype'][_0x47a5('0x17')]=function(_0x11faf5){try{var _0x3b001e=this;var _0x2a2cbb=this[_0x47a5('0x9')][_0x11faf5]['interface'];var _0x549de3=this[_0x47a5('0x9')][_0x11faf5]['queue'];var _0x5247fd=this[_0x47a5('0x6')][_0x549de3];var _0xaf70a6=![];var _0x2ce454=_0x47a5('0x18');if(_0x5247fd[_0x47a5('0x19')]){if(_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')]){_0xaf70a6=!![];_0x2ce454=_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')];}}ami['Action']({'action':_0x47a5('0x1c'),'interface':_0x2a2cbb,'paused':!![],'reason':_0x2ce454})[_0x47a5('0x1d')](function(_0x47cf3c){if(_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]){return RpcUser[_0x47a5('0x1e')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]['id'])['then'](function(_0xb8ae6c){if(_0xb8ae6c&&!_0xb8ae6c[_0x47a5('0x1f')]){logger[_0x47a5('0x20')](_0x47a5('0x21'),_0x11faf5,_0x2a2cbb,_0x549de3);var _0x5ef1b1=_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x22')]&&_0x3b001e['channels'][_0x11faf5][_0x47a5('0x23')]?_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x23')]:_0x11faf5;return RpcUser[_0x47a5('0x24')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb],_0x2ce454,_0x5ef1b1)['then'](function(_0x53078a){if(!_0xaf70a6){_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]={};logger['info'](_0x47a5('0x25'),_0x11faf5,_0x3b001e['voiceQueues'][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=setTimeout(_0x3b001e[_0x47a5('0x28')][_0x47a5('0xb')](_0x3b001e,_0x2a2cbb),_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')]*0x3e8);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x29')]=moment()[_0x47a5('0x2a')](_0x47a5('0x2b'));_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x2c')]=_0x11faf5;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2d')]=_0x549de3;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2e')]=function(){var _0x9ac908=getDiff(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]['lastPauseAt']);clearTimeout(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x9ac908},_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2c')],_0x2a2cbb)[_0x47a5('0x1d')](function(_0x5bd7eb){logger['info'](_0x47a5('0x2f'),_0x11faf5,_0x9ac908,_0x5bd7eb);})[_0x47a5('0x30')](function(_0x57bff6){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x11faf5,_0x57bff6);});delete _0x3b001e[_0x47a5('0x8')][_0x2a2cbb];};}});}else{logger[_0x47a5('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x11faf5,_0x2a2cbb,_0x549de3);}});}})['catch'](function(_0x274e34){logger['error'](_0x47a5('0x25'),_0x11faf5,_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);})['finally'](function(){delete _0x3b001e[_0x47a5('0x9')][_0x11faf5];});}catch(_0x50c086){logger['error'](_0x47a5('0x32'),_0x50c086['message']);}};Acw[_0x47a5('0x33')]['stopAcw']=function(_0x21ad34){try{var _0x3534cb=this;if(_0x3534cb[_0x47a5('0x8')][_0x21ad34]){_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x27')]=![];var _0xed6320=_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x2c')];var _0x1a0d23=_0x3534cb['timers'][_0x21ad34][_0x47a5('0x2d')];var _0x10f136=_0x3534cb['voiceQueues'][_0x1a0d23][_0x47a5('0x26')];logger[_0x47a5('0x20')](_0x47a5('0x34'),_0xed6320,_0x21ad34);RpcUser['saveUnpause'](this[_0x47a5('0x7')][_0x21ad34]);RpcVoiceAgentReport[_0x47a5('0x35')]({'acwtime':_0x10f136,'agentacw':!![]},_0xed6320,_0x21ad34)['then'](function(_0x2ebba0){logger[_0x47a5('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0xed6320,_0x10f136,_0x2ebba0);})['catch'](function(_0x5ebd8c){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xed6320,_0x5ebd8c);});}else{logger[_0x47a5('0x31')](_0x47a5('0x36'),_0x21ad34);if(_0x3534cb[_0x47a5('0x8')]){logger[_0x47a5('0x20')](_0x47a5('0x37'),JSON[_0x47a5('0x38')](_0x3534cb[_0x47a5('0x8')]));}}}catch(_0x1f3d01){logger[_0x47a5('0x31')](_0x47a5('0x39'),_0x1f3d01[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x3b')]=function(_0x56dbbd){try{if(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]['acw']||this[_0x47a5('0x6')][_0x56dbbd['queue']]['mandatoryDisposition'])){if(this['agents'][_0x56dbbd['interface']]){this[_0x47a5('0x9')][_0x56dbbd['uniqueid']]={'queue':_0x56dbbd[_0x47a5('0x2d')],'interface':_0x56dbbd[_0x47a5('0x3c')],'destlinkedid':_0x56dbbd[_0x47a5('0x23')]};}}}catch(_0x494526){logger[_0x47a5('0x31')](_0x47a5('0x3d'),_0x494526['message']);}};Acw['prototype'][_0x47a5('0x3e')]=function(_0x4edf7f){try{if(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x4')]||this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x19')])){if(this[_0x47a5('0x7')][_0x4edf7f[_0x47a5('0x3c')]]){this[_0x47a5('0x9')][_0x4edf7f[_0x47a5('0x2c')]]={'queue':_0x4edf7f[_0x47a5('0x2d')],'interface':_0x4edf7f[_0x47a5('0x3c')]};}}}catch(_0x4e5e7){logger[_0x47a5('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4e5e7[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncHangupRequest']=function(_0x52b3a8){try{if(this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]['attended'])){logger[_0x47a5('0x20')]('[%s][HANGUP:UNIQUEID]',_0x52b3a8[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x52b3a8[_0x47a5('0x40')]]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['linkedid']]['attended'])){logger[_0x47a5('0x20')](_0x47a5('0x41'),_0x52b3a8[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x40')]);}}catch(_0x2c0c86){logger[_0x47a5('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x2c0c86[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0xd')]=function(_0x5c3c75){try{if(this[_0x47a5('0x9')][_0x5c3c75['uniqueid']]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x2c')]][_0x47a5('0x22')]){logger[_0x47a5('0x20')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5c3c75[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]['attended']){logger[_0x47a5('0x20')](_0x47a5('0x42'),_0x5c3c75[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x40')]);}}catch(_0x1ab0bf){logger['error'](_0x47a5('0x43'),_0x1ab0bf[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncAttendedTransfer']=function(_0x4c5ed){try{if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfereeuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x45')]);if(this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']]){this['channels'][_0x4c5ed[_0x47a5('0x46')]]['attended']=!![];this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']]=this['channels'][_0x4c5ed[_0x47a5('0x46')]];delete this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']];}}else if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x47')]);if(this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x48')]]){this[_0x47a5('0x9')][_0x4c5ed['origtransfereruniqueid']][_0x47a5('0x22')]=!![];this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x45')]]=this['channels'][_0x4c5ed[_0x47a5('0x48')]];delete this['channels'][_0x4c5ed[_0x47a5('0x48')]];}}}catch(_0x470da6){logger[_0x47a5('0x31')](_0x47a5('0x49'),_0x470da6[_0x47a5('0x3a')]);}};Acw['prototype'][_0x47a5('0x12')]=function(_0x5d1550){try{if(this['channels'][_0x5d1550['transfereruniqueid']]){logger['info'](_0x47a5('0x4a'),JSON[_0x47a5('0x38')](_0x5d1550[_0x47a5('0x4b')]));this['startAcw'](_0x5d1550['transfereruniqueid']);}else if(this[_0x47a5('0x9')][_0x5d1550[_0x47a5('0x4c')]]){logger[_0x47a5('0x20')](_0x47a5('0x4d'),JSON[_0x47a5('0x38')](_0x5d1550['transfererlinkedid']));this[_0x47a5('0x17')](_0x5d1550['transfererlinkedid']);}}catch(_0x22c886){logger[_0x47a5('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x22c886[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x4e')]=function(_0x3e8274){try{if(this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]&&this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]['autopause']===_0x47a5('0x4f')){if(this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]]){logger[_0x47a5('0x20')](_0x47a5('0x50'),_0x3e8274['uniqueid'],_0x3e8274[_0x47a5('0x3c')],_0x3e8274[_0x47a5('0x2d')]);return RpcUser[_0x47a5('0x24')](this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]],_0x47a5('0x51'),_0x3e8274[_0x47a5('0x2c')]);}}}catch(_0x149d34){logger[_0x47a5('0x31')](_0x47a5('0x52'),_0x149d34[_0x47a5('0x3a')]);}};module[_0x47a5('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index e4c2edf..eb7160c 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 _0x9fb7=['connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','asterisk','port','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close'];(function(_0x3971fa,_0x5a3d4e){var _0x3c140c=function(_0x47a2f8){while(--_0x47a2f8){_0x3971fa['push'](_0x3971fa['shift']());}};_0x3c140c(++_0x5a3d4e);}(_0x9fb7,0x18d));var _0x79fb=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9fb7[_0x13b02f];return _0x12e9a6;};'use strict';var Manager=require(_0x79fb('0x0'));var BPromise=require(_0x79fb('0x1'));var moment=require(_0x79fb('0x2'));var util=require(_0x79fb('0x3'));var _=require(_0x79fb('0x4'));var logger=require(_0x79fb('0x5'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x79fb('0x6')][_0x79fb('0x7')],config[_0x79fb('0x6')]['ip'],config[_0x79fb('0x6')]['username'],config[_0x79fb('0x6')][_0x79fb('0x8')],!![]);ami[_0x79fb('0x9')]();ami[_0x79fb('0xa')]=BPromise[_0x79fb('0xb')](ami[_0x79fb('0xc')]);function error(_0x41e20a){logger[_0x79fb('0xd')](util[_0x79fb('0xe')](_0x79fb('0xf'),config['asterisk']['username'],config[_0x79fb('0x6')]['ip'],config[_0x79fb('0x6')][_0x79fb('0x7')],util[_0x79fb('0x10')](_0x41e20a,![],null)));}function close(){logger[_0x79fb('0xd')](util['format'](_0x79fb('0x11'),config[_0x79fb('0x6')][_0x79fb('0x12')],config[_0x79fb('0x6')]['ip'],config['asterisk'][_0x79fb('0x7')]));}ami[_0x79fb('0x13')]=function(){return function(){return ami[_0x79fb('0xa')]({'action':_0x79fb('0x14')});};};ami[_0x79fb('0x15')]=function(){return function(){return ami[_0x79fb('0xa')]({'action':_0x79fb('0x16')});};};ami[_0x79fb('0x17')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x79fb('0x18')]=function(){return function(){return ami[_0x79fb('0xa')]({'action':_0x79fb('0x19')});};};ami[_0x79fb('0x1a')]=function(){return function(){return ami[_0x79fb('0xa')]({'action':_0x79fb('0x1b')});};};function connect(_0x33e227){logger[_0x79fb('0x1c')](util[_0x79fb('0xe')](_0x79fb('0x1d'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x79fb('0x6')]['port']));ami['once'](_0x79fb('0xd'),error);ami[_0x79fb('0x1e')](_0x79fb('0x1f'),close);}ami['on'](_0x79fb('0x20'),connect);ami['on'](_0x79fb('0x21'),function(_0x265269){logger[_0x79fb('0x1c')](util[_0x79fb('0xe')](_0x79fb('0x22'),config['asterisk'][_0x79fb('0x12')],config['asterisk']['ip'],config[_0x79fb('0x6')][_0x79fb('0x7')],util[_0x79fb('0x10')](_0x265269,![],null)));});ami['on'](_0x79fb('0x23'),function(_0x996afd){logger[_0x79fb('0x1c')](util[_0x79fb('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x79fb('0x6')][_0x79fb('0x12')],config[_0x79fb('0x6')]['ip'],config['asterisk'][_0x79fb('0x7')]));return BPromise[_0x79fb('0x24')]()[_0x79fb('0x25')](ami[_0x79fb('0x13')]())[_0x79fb('0x25')](ami[_0x79fb('0x15')]())[_0x79fb('0x25')](ami[_0x79fb('0x17')]())['then'](ami['actionQueueSummary']())[_0x79fb('0x25')](ami[_0x79fb('0x1a')]())['catch'](function(_0x390481){console['log'](_0x390481);});});ami['once']('error',error);ami['once'](_0x79fb('0x1f'),close);module[_0x79fb('0x26')]=ami; \ No newline at end of file +var _0x67df=['log','exports','asterisk-manager','../../config/logger','ami','../../config/environment','asterisk','username','password','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','inspect','fullybooted','resolve','then','catch'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x67df,0xe2));var _0xf67d=function(_0x5c2872,_0x3f18df){_0x5c2872=_0x5c2872-0x0;var _0x4d860b=_0x67df[_0x5c2872];return _0x4d860b;};'use strict';var Manager=require(_0xf67d('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0xf67d('0x1'))(_0xf67d('0x2'));var config=require(_0xf67d('0x3'));var ami=new Manager(config[_0xf67d('0x4')]['port'],config[_0xf67d('0x4')]['ip'],config['asterisk'][_0xf67d('0x5')],config[_0xf67d('0x4')][_0xf67d('0x6')],!![]);ami['keepConnected']();ami['Action']=BPromise['promisify'](ami[_0xf67d('0x7')]);function error(_0x507f4f){logger[_0xf67d('0x8')](util[_0xf67d('0x9')](_0xf67d('0xa'),config[_0xf67d('0x4')][_0xf67d('0x5')],config[_0xf67d('0x4')]['ip'],config['asterisk'][_0xf67d('0xb')],util['inspect'](_0x507f4f,![],null)));}function close(){logger[_0xf67d('0x8')](util['format'](_0xf67d('0xc'),config[_0xf67d('0x4')][_0xf67d('0x5')],config['asterisk']['ip'],config[_0xf67d('0x4')][_0xf67d('0xb')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xf67d('0xd')]({'action':'sipshowregistry'});};};ami[_0xf67d('0xe')]=function(){return function(){return ami[_0xf67d('0xd')]({'action':_0xf67d('0xf')});};};ami[_0xf67d('0x10')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xf67d('0x11')]=function(){return function(){return ami[_0xf67d('0xd')]({'action':'queuesummary'});};};ami[_0xf67d('0x12')]=function(){return function(){return ami['Action']({'action':_0xf67d('0x13')});};};function connect(_0x25bc9d){logger[_0xf67d('0x14')](util['format'](_0xf67d('0x15'),config['asterisk'][_0xf67d('0x5')],config['asterisk']['ip'],config[_0xf67d('0x4')][_0xf67d('0xb')]));ami[_0xf67d('0x16')](_0xf67d('0x8'),error);ami[_0xf67d('0x16')](_0xf67d('0x17'),close);}ami['on'](_0xf67d('0x18'),connect);ami['on']('shutdown',function(_0x5b95ac){logger[_0xf67d('0x14')](util[_0xf67d('0x9')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xf67d('0x4')][_0xf67d('0x5')],config['asterisk']['ip'],config[_0xf67d('0x4')]['port'],util[_0xf67d('0x19')](_0x5b95ac,![],null)));});ami['on'](_0xf67d('0x1a'),function(_0x5df628){logger[_0xf67d('0x14')](util[_0xf67d('0x9')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xf67d('0x4')][_0xf67d('0x5')],config['asterisk']['ip'],config[_0xf67d('0x4')]['port']));return BPromise[_0xf67d('0x1b')]()[_0xf67d('0x1c')](ami['actionSipShowRegistry']())[_0xf67d('0x1c')](ami[_0xf67d('0xe')]())['then'](ami['actionSipPeerStatus']())[_0xf67d('0x1c')](ami[_0xf67d('0x11')]())[_0xf67d('0x1c')](ami['actionCoreShowChannels']())[_0xf67d('0x1d')](function(_0x1a397e){console[_0xf67d('0x1e')](_0x1a397e);});});ami[_0xf67d('0x16')]('error',error);ami[_0xf67d('0x16')](_0xf67d('0x17'),close);module[_0xf67d('0x1f')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 9ce6b7b..afecdc4 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 _0x3597=['ami','client','http','debug','rpc','memberReport','error','message','result','catch','bluebird'];(function(_0x5d9e37,_0x5cb2c1){var _0x43b18b=function(_0xad8f67){while(--_0xad8f67){_0x5d9e37['push'](_0x5d9e37['shift']());}};_0x43b18b(++_0x5cb2c1);}(_0x3597,0x83));var _0x7359=function(_0x4f2d94,_0x575953){_0x4f2d94=_0x4f2d94-0x0;var _0x1ab77f=_0x3597[_0x4f2d94];return _0x1ab77f;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7359('0x0'));var logger=require('../../config/logger')(_0x7359('0x1'));var client=jayson[_0x7359('0x2')][_0x7359('0x3')]({'port':0x2329});client['Request']=function(_0x6ba1aa,_0x2f0234){return new BPromise(function(_0x2ff385,_0x329e13){return client['request'](_0x6ba1aa,_0x2f0234)['then'](function(_0x3b60e6){logger[_0x7359('0x4')](_0x7359('0x5'),_0x7359('0x6'),_0x6ba1aa,_0x2f0234,_0x3b60e6);if(_0x3b60e6[_0x7359('0x7')]){logger['error'](_0x7359('0x5'),_0x7359('0x6'),_0x6ba1aa,_0x3b60e6[_0x7359('0x7')][_0x7359('0x8')],_0x2f0234);return _0x329e13(_0x3b60e6['error'][_0x7359('0x8')]);}else{return _0x2ff385(_0x3b60e6[_0x7359('0x9')]);}})[_0x7359('0xa')](function(_0x338fd0){logger[_0x7359('0x7')](_0x7359('0x5'),_0x7359('0x6'),_0x6ba1aa,_0x338fd0,_0x2f0234);return _0x329e13(_0x338fd0);});});};module['exports']=client; \ No newline at end of file +var _0x2890=['bluebird','../../config/logger','ami','client','http','Request','request','then','debug','rpc','memberReport','error','message','result','catch','exports','jayson/promise'];(function(_0x1e27f7,_0x553abc){var _0x1f5f9c=function(_0x583404){while(--_0x583404){_0x1e27f7['push'](_0x1e27f7['shift']());}};_0x1f5f9c(++_0x553abc);}(_0x2890,0x164));var _0x0289=function(_0x3d530b,_0x187c80){_0x3d530b=_0x3d530b-0x0;var _0x4ac31c=_0x2890[_0x3d530b];return _0x4ac31c;};'use strict';var jayson=require(_0x0289('0x0'));var BPromise=require(_0x0289('0x1'));var logger=require(_0x0289('0x2'))(_0x0289('0x3'));var client=jayson[_0x0289('0x4')][_0x0289('0x5')]({'port':0x2329});client[_0x0289('0x6')]=function(_0x2e7aa9,_0x42be79){return new BPromise(function(_0x31a745,_0xb3d168){return client[_0x0289('0x7')](_0x2e7aa9,_0x42be79)[_0x0289('0x8')](function(_0x58d6f2){logger[_0x0289('0x9')](_0x0289('0xa'),_0x0289('0xb'),_0x2e7aa9,_0x42be79,_0x58d6f2);if(_0x58d6f2[_0x0289('0xc')]){logger[_0x0289('0xc')](_0x0289('0xa'),_0x0289('0xb'),_0x2e7aa9,_0x58d6f2[_0x0289('0xc')]['message'],_0x42be79);return _0xb3d168(_0x58d6f2['error'][_0x0289('0xd')]);}else{return _0x31a745(_0x58d6f2[_0x0289('0xe')]);}})[_0x0289('0xf')](function(_0x806379){logger[_0x0289('0xc')](_0x0289('0xa'),_0x0289('0xb'),_0x2e7aa9,_0x806379,_0x42be79);return _0xb3d168(_0x806379);});});};module[_0x0289('0x10')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 1c0634c..55cb3de 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 _0x6cb4=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','number','getQueue','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','active','dialQueueTimeout','scheduledat','countbusyretry'];(function(_0x3f737b,_0x1d1f8b){var _0x404f7c=function(_0x6165a){while(--_0x6165a){_0x3f737b['push'](_0x3f737b['shift']());}};_0x404f7c(++_0x1d1f8b);}(_0x6cb4,0xff));var _0x46cb=function(_0x21fa61,_0x14ff65){_0x21fa61=_0x21fa61-0x0;var _0x109617=_0x6cb4[_0x21fa61];return _0x109617;};'use strict';var util=require(_0x46cb('0x0'));var _=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));function checkNameSurname(_0x3403fc,_0x375bef,_0x36add6){var _0x2b8d70='';if(!_[_0x46cb('0x3')](_0x375bef)&&_0x46cb('0x4')===typeof _0x375bef){_0x2b8d70+=_0x375bef;}if(!_['isNil'](_0x36add6)&&_0x46cb('0x4')===typeof _0x36add6){_0x2b8d70+='\x20'+_0x36add6;}if(_0x2b8d70!==''){return _0x2b8d70;}return _0x3403fc;}function Action(_0x5cb9a4,_0x3d9d3c,_0x4d9f1d){this[_0x46cb('0x5')]=_0x5cb9a4;this[_0x46cb('0x6')]=_0x4d9f1d||undefined;this[_0x46cb('0x7')]=checkNameSurname(_0x3d9d3c[_0x46cb('0x8')][_0x46cb('0x9')],_0x3d9d3c[_0x46cb('0x8')]['firstName'],_0x3d9d3c[_0x46cb('0x8')][_0x46cb('0xa')]);this['number']=_0x3d9d3c[_0x46cb('0x8')][_0x46cb('0x9')];this['queue']=_0x5cb9a4[_0x46cb('0x7')];this[_0x46cb('0xb')]=_0x3d9d3c['active']||![];this['type']=_0x5cb9a4['type'];this[_0x46cb('0xc')]=_0x5cb9a4[_0x46cb('0xc')]||0x3;this[_0x46cb('0xd')]=_0x3d9d3c[_0x46cb('0xd')];this['countbusyretry']=_0x3d9d3c[_0x46cb('0xe')];this[_0x46cb('0xf')]=_0x3d9d3c[_0x46cb('0xf')];this[_0x46cb('0x10')]=_0x3d9d3c[_0x46cb('0x10')];this[_0x46cb('0x11')]=_0x3d9d3c[_0x46cb('0x11')];this[_0x46cb('0x12')]=_0x3d9d3c[_0x46cb('0x12')];this[_0x46cb('0x13')]=_0x3d9d3c[_0x46cb('0x13')];this['countmachineretry']=_0x3d9d3c[_0x46cb('0x14')];this['countagentrejectretry']=_0x3d9d3c[_0x46cb('0x15')];this['ContactId']=_0x3d9d3c['ContactId'];this['ListId']=_0x3d9d3c[_0x46cb('0x16')];this[_0x46cb('0x17')]=_0x3d9d3c[_0x46cb('0x17')];this[_0x46cb('0x18')]=_0x3d9d3c[_0x46cb('0x18')];this[_0x46cb('0x19')]=_0x3d9d3c[_0x46cb('0x19')];this[_0x46cb('0x1a')]=_0x3d9d3c['id'];this[_0x46cb('0x1b')]=_0x3d9d3c[_0x46cb('0x8')][_0x46cb('0x1c')]||'';this[_0x46cb('0x1d')]=moment()[_0x46cb('0x1e')](_0x46cb('0x1f'));this[_0x46cb('0x20')]=_0x3d9d3c[_0x46cb('0x20')];this[_0x46cb('0x21')]=_0x3d9d3c[_0x46cb('0x21')];this[_0x46cb('0x22')]=_0x3d9d3c[_0x46cb('0x22')];this[_0x46cb('0x23')]=_0x3d9d3c[_0x46cb('0x23')];this[_0x46cb('0x24')]='';this[_0x46cb('0x25')]='';}Action[_0x46cb('0x26')]['getCaller']=function(){return util['format'](_0x46cb('0x27'),this[_0x46cb('0x7')],this[_0x46cb('0x5')][_0x46cb('0x28')]>0x0?this[_0x46cb('0x29')]['substring'](this[_0x46cb('0x5')]['dialCutDigit']):this['number']);};Action['prototype'][_0x46cb('0x2a')]=function(){return this[_0x46cb('0x2b')];};module[_0x46cb('0x2c')]=Action; \ No newline at end of file +var _0xee4f=['phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','substring','voiceQueue','dialCutDigit','number','getQueue','exports','util','isNil','uniqueid','name','Contact','firstName','lastName'];(function(_0x4c6087,_0x45f9fb){var _0x84bc54=function(_0x37a020){while(--_0x37a020){_0x4c6087['push'](_0x4c6087['shift']());}};_0x84bc54(++_0x45f9fb);}(_0xee4f,0xad));var _0xfee4=function(_0xefd3bb,_0x191e55){_0xefd3bb=_0xefd3bb-0x0;var _0x4284d1=_0xee4f[_0xefd3bb];return _0x4284d1;};'use strict';var util=require(_0xfee4('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x2afb7d,_0x41b170,_0xf1acd6){var _0x5a03c9='';if(!_[_0xfee4('0x1')](_0x41b170)&&'string'===typeof _0x41b170){_0x5a03c9+=_0x41b170;}if(!_[_0xfee4('0x1')](_0xf1acd6)&&'string'===typeof _0xf1acd6){_0x5a03c9+='\x20'+_0xf1acd6;}if(_0x5a03c9!==''){return _0x5a03c9;}return _0x2afb7d;}function Action(_0x4da9b6,_0x1c39b1,_0x498647){this['voiceQueue']=_0x4da9b6;this[_0xfee4('0x2')]=_0x498647||undefined;this[_0xfee4('0x3')]=checkNameSurname(_0x1c39b1[_0xfee4('0x4')]['phone'],_0x1c39b1['Contact'][_0xfee4('0x5')],_0x1c39b1[_0xfee4('0x4')][_0xfee4('0x6')]);this['number']=_0x1c39b1['Contact'][_0xfee4('0x7')];this[_0xfee4('0x8')]=_0x4da9b6[_0xfee4('0x3')];this['active']=_0x1c39b1[_0xfee4('0x9')]||![];this[_0xfee4('0xa')]=_0x4da9b6[_0xfee4('0xa')];this[_0xfee4('0xb')]=_0x4da9b6[_0xfee4('0xb')]||0x3;this[_0xfee4('0xc')]=_0x1c39b1[_0xfee4('0xc')];this['countbusyretry']=_0x1c39b1[_0xfee4('0xd')];this[_0xfee4('0xe')]=_0x1c39b1['countcongestionretry'];this[_0xfee4('0xf')]=_0x1c39b1[_0xfee4('0xf')];this[_0xfee4('0x10')]=_0x1c39b1[_0xfee4('0x10')];this[_0xfee4('0x11')]=_0x1c39b1[_0xfee4('0x11')];this[_0xfee4('0x12')]=_0x1c39b1['countabandonedretry'];this[_0xfee4('0x13')]=_0x1c39b1[_0xfee4('0x13')];this[_0xfee4('0x14')]=_0x1c39b1['countagentrejectretry'];this[_0xfee4('0x15')]=_0x1c39b1['ContactId'];this['ListId']=_0x1c39b1[_0xfee4('0x16')];this[_0xfee4('0x17')]=_0x1c39b1[_0xfee4('0x17')];this[_0xfee4('0x18')]=_0x1c39b1[_0xfee4('0x18')];this[_0xfee4('0x19')]=_0x1c39b1[_0xfee4('0x19')];this[_0xfee4('0x1a')]=_0x1c39b1['id'];this[_0xfee4('0x1b')]=_0x1c39b1['Contact'][_0xfee4('0x5')]||'';this[_0xfee4('0x1c')]=moment()[_0xfee4('0x1d')](_0xfee4('0x1e'));this[_0xfee4('0x1f')]=_0x1c39b1[_0xfee4('0x1f')];this['callbackuniqueid']=_0x1c39b1[_0xfee4('0x20')];this[_0xfee4('0x21')]=_0x1c39b1[_0xfee4('0x21')];this[_0xfee4('0x22')]=_0x1c39b1[_0xfee4('0x22')];this[_0xfee4('0x23')]='';this[_0xfee4('0x24')]='';}Action[_0xfee4('0x25')][_0xfee4('0x26')]=function(){return util[_0xfee4('0x1d')]('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue']['dialCutDigit']>0x0?this['number'][_0xfee4('0x27')](this[_0xfee4('0x28')][_0xfee4('0x29')]):this[_0xfee4('0x2a')]);};Action[_0xfee4('0x25')][_0xfee4('0x2b')]=function(){return this[_0xfee4('0x8')];};module[_0xfee4('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index b0317dd..495408d 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd373=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','diff','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry'];(function(_0x5871af,_0x4eeecf){var _0x2901d7=function(_0x1229ea){while(--_0x1229ea){_0x5871af['push'](_0x5871af['shift']());}};_0x2901d7(++_0x4eeecf);}(_0xd373,0x1ef));var _0x3d37=function(_0x57ce02,_0x1cacbe){_0x57ce02=_0x57ce02-0x0;var _0x6986d3=_0xd373[_0x57ce02];return _0x6986d3;};'use strict';var util=require(_0x3d37('0x0'));var _=require(_0x3d37('0x1'));var moment=require('moment');function getSeconds(_0xbb236b,_0x5ac254){var _0x4a3d2a=moment(_0xbb236b)['milliseconds'](0x0);var _0x1f0394=moment(_0x5ac254)['milliseconds'](0x0);return _0x4a3d2a[_0x3d37('0x2')](_0x1f0394,'seconds');}function AdditionalPhone(_0x3812d3){this[_0x3d37('0x3')]=_0x3812d3[_0x3d37('0x3')];this[_0x3d37('0x4')]=_0x3812d3['scheduledat']||undefined;this[_0x3d37('0x5')]=_0x3812d3[_0x3d37('0x5')];this['campaigntype']=_0x3812d3[_0x3d37('0x5')]==='outbound'?_0x3d37('0x6'):_0x3812d3[_0x3d37('0x5')];this[_0x3d37('0x7')]=_0x3812d3['countbusyretry'];this[_0x3d37('0x8')]=_0x3812d3[_0x3d37('0x8')];this[_0x3d37('0x9')]=_0x3812d3['countnoanswerretry'];this[_0x3d37('0xa')]=_0x3812d3[_0x3d37('0x7')]+_0x3812d3[_0x3d37('0x8')]+_0x3812d3['countnoanswerretry']+_0x3812d3[_0x3d37('0xb')]+_0x3812d3[_0x3d37('0xc')]+_0x3812d3[_0x3d37('0xd')]+_0x3812d3[_0x3d37('0xe')]+_0x3812d3[_0x3d37('0xf')];this[_0x3d37('0xb')]=_0x3812d3['countnosuchnumberretry'];this[_0x3d37('0xc')]=_0x3812d3[_0x3d37('0xc')];this[_0x3d37('0xd')]=_0x3812d3[_0x3d37('0xd')];this[_0x3d37('0xe')]=_0x3812d3[_0x3d37('0xe')];this['countagentrejectretry']=_0x3812d3[_0x3d37('0xf')];this[_0x3d37('0x6')]=_0x3812d3[_0x3d37('0x6')];this[_0x3d37('0x10')]=_0x3812d3['name'];this[_0x3d37('0x11')]=_0x3812d3['number'];this[_0x3d37('0x12')]=_0x3812d3[_0x3d37('0x12')];this[_0x3d37('0x13')]=_0x3812d3[_0x3d37('0x13')];this[_0x3d37('0x14')]=_0x3812d3[_0x3d37('0x13')];this[_0x3d37('0x15')]=getSeconds(_0x3812d3[_0x3d37('0x13')],_0x3812d3['starttime']);this[_0x3d37('0x16')]=0x0;this[_0x3d37('0x17')]=0x0;this[_0x3d37('0x18')]=_0x3812d3[_0x3d37('0x18')];this['callbackuniqueid']=_0x3812d3[_0x3d37('0x19')];this[_0x3d37('0x1a')]=_0x3812d3[_0x3d37('0x1a')];this[_0x3d37('0x1b')]=_0x3812d3[_0x3d37('0x1b')];this[_0x3d37('0x1c')]=_0x3812d3[_0x3d37('0x1c')];this[_0x3d37('0x1d')]=_0x3812d3[_0x3d37('0x1d')];this[_0x3d37('0x1e')]=_0x3812d3[_0x3d37('0x1e')];this['VoiceQueueId']=_0x3812d3[_0x3d37('0x1f')];this['CampaignId']=_0x3812d3[_0x3d37('0x20')];this[_0x3d37('0x21')]=_0x3812d3[_0x3d37('0x21')]||'';this[_0x3d37('0x22')]=_0x3812d3['originatecalleridname']||'';}module[_0x3d37('0x23')]=History; \ No newline at end of file +var _0x45c6=['calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridname','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name'];(function(_0x5234a6,_0x314a5d){var _0x1f8955=function(_0xb6717c){while(--_0xb6717c){_0x5234a6['push'](_0x5234a6['shift']());}};_0x1f8955(++_0x314a5d);}(_0x45c6,0x1b2));var _0x645c=function(_0x49cdf4,_0x54492b){_0x49cdf4=_0x49cdf4-0x0;var _0x450ba8=_0x45c6[_0x49cdf4];return _0x450ba8;};'use strict';var util=require('util');var _=require(_0x645c('0x0'));var moment=require(_0x645c('0x1'));function getSeconds(_0xa1cb21,_0x17cc20){var _0x4d2f80=moment(_0xa1cb21)[_0x645c('0x2')](0x0);var _0x56792e=moment(_0x17cc20)['milliseconds'](0x0);return _0x4d2f80[_0x645c('0x3')](_0x56792e,_0x645c('0x4'));}function AdditionalPhone(_0x35173c){this[_0x645c('0x5')]=_0x35173c['uniqueid'];this[_0x645c('0x6')]=_0x35173c[_0x645c('0x6')]||undefined;this[_0x645c('0x7')]=_0x35173c[_0x645c('0x7')];this[_0x645c('0x8')]=_0x35173c[_0x645c('0x7')]===_0x645c('0x9')?'queue':_0x35173c[_0x645c('0x7')];this[_0x645c('0xa')]=_0x35173c['countbusyretry'];this[_0x645c('0xb')]=_0x35173c['countcongestionretry'];this[_0x645c('0xc')]=_0x35173c[_0x645c('0xc')];this[_0x645c('0xd')]=_0x35173c[_0x645c('0xa')]+_0x35173c[_0x645c('0xb')]+_0x35173c[_0x645c('0xc')]+_0x35173c[_0x645c('0xe')]+_0x35173c[_0x645c('0xf')]+_0x35173c[_0x645c('0x10')]+_0x35173c[_0x645c('0x11')]+_0x35173c['countagentrejectretry'];this[_0x645c('0xe')]=_0x35173c[_0x645c('0xe')];this[_0x645c('0xf')]=_0x35173c[_0x645c('0xf')];this['countabandonedretry']=_0x35173c['countabandonedretry'];this[_0x645c('0x11')]=_0x35173c[_0x645c('0x11')];this[_0x645c('0x12')]=_0x35173c['countagentrejectretry'];this['queue']=_0x35173c[_0x645c('0x13')];this[_0x645c('0x14')]=_0x35173c[_0x645c('0x15')];this[_0x645c('0x16')]=_0x35173c[_0x645c('0x17')];this[_0x645c('0x18')]=_0x35173c[_0x645c('0x18')];this[_0x645c('0x19')]=_0x35173c[_0x645c('0x19')];this['endtime']=_0x35173c['responsetime'];this[_0x645c('0x1a')]=getSeconds(_0x35173c[_0x645c('0x19')],_0x35173c['starttime']);this[_0x645c('0x1b')]=0x0;this[_0x645c('0x1c')]=0x0;this['callback']=_0x35173c[_0x645c('0x1d')];this[_0x645c('0x1e')]=_0x35173c[_0x645c('0x1e')];this[_0x645c('0x1f')]=_0x35173c['callbackat'];this[_0x645c('0x20')]=_0x35173c['recallme'];this[_0x645c('0x21')]=_0x35173c['ContactId'];this[_0x645c('0x22')]=_0x35173c[_0x645c('0x22')];this[_0x645c('0x23')]=_0x35173c['UserId'];this['VoiceQueueId']=_0x35173c['VoiceQueueId'];this[_0x645c('0x24')]=_0x35173c[_0x645c('0x24')];this['originatecalleridnum']=_0x35173c['originatecalleridnum']||'';this[_0x645c('0x25')]=_0x35173c[_0x645c('0x25')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 1698ae5..517d600 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 _0x61ce=['holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','state','statedesc','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x13391a,_0x4c7f60){var _0x1bdd30=function(_0x972b53){while(--_0x972b53){_0x13391a['push'](_0x13391a['shift']());}};_0x1bdd30(++_0x4c7f60);}(_0x61ce,0xe7));var _0xe61c=function(_0x53925f,_0x38eeac){_0x53925f=_0x53925f-0x0;var _0xb9058=_0x61ce[_0x53925f];return _0xb9058;};'use strict';var util=require(_0xe61c('0x0'));var _=require(_0xe61c('0x1'));var moment=require('moment');function getSeconds(_0x576f75,_0x21a420){var _0x5501d2=moment(_0x576f75)['milliseconds'](0x0);var _0x44ae9a=moment(_0x21a420)[_0xe61c('0x2')](0x0);return _0x5501d2['diff'](_0x44ae9a,_0xe61c('0x3'));}function AgentComplete(_0x4b5a3a,_0x412eae){this[_0xe61c('0x4')]=0x4;this[_0xe61c('0x5')]='Answer';this[_0xe61c('0x6')]=_0x4b5a3a[_0xe61c('0x6')];this[_0xe61c('0x7')]=_0x4b5a3a[_0xe61c('0x7')];this['campaigntype']=_0x4b5a3a[_0xe61c('0x7')]==='outbound'?'queue':_0x4b5a3a[_0xe61c('0x7')];this[_0xe61c('0x8')]=_0x4b5a3a['countbusyretry'];this[_0xe61c('0x9')]=_0x4b5a3a['countcongestionretry'];this[_0xe61c('0xa')]=_0x4b5a3a[_0xe61c('0xa')];this[_0xe61c('0xb')]=_0x4b5a3a[_0xe61c('0x8')]+_0x4b5a3a[_0xe61c('0x9')]+_0x4b5a3a[_0xe61c('0xa')]+_0x4b5a3a[_0xe61c('0xc')]+_0x4b5a3a[_0xe61c('0xd')]+_0x4b5a3a[_0xe61c('0xe')]+_0x4b5a3a[_0xe61c('0xf')]+_0x4b5a3a['countagentrejectretry'];this[_0xe61c('0xc')]=_0x4b5a3a[_0xe61c('0xc')];this['countdropretry']=_0x4b5a3a['countdropretry'];this[_0xe61c('0xe')]=_0x4b5a3a[_0xe61c('0xe')];this['countmachineretry']=_0x4b5a3a['countmachineretry'];this[_0xe61c('0x10')]=_0x4b5a3a['countagentrejectretry'];this[_0xe61c('0x11')]=_0x412eae[_0xe61c('0x11')];this[_0xe61c('0x12')]=_0x4b5a3a[_0xe61c('0x13')];this['calleridnum']=_0x4b5a3a[_0xe61c('0x14')];this[_0xe61c('0x15')]=_0x4b5a3a['starttime'];this[_0xe61c('0x16')]=_0x4b5a3a[_0xe61c('0x16')];this['answertime']=_0x4b5a3a[_0xe61c('0x17')];this[_0xe61c('0x18')]=moment()['format'](_0xe61c('0x19'));this[_0xe61c('0x1a')]=getSeconds(_0x4b5a3a['responsetime'],_0x4b5a3a[_0xe61c('0x15')]);this[_0xe61c('0x1b')]=getSeconds(_0x4b5a3a[_0xe61c('0x17')],_0x4b5a3a[_0xe61c('0x16')]);this['talktime']=getSeconds(this['endtime'],_0x4b5a3a[_0xe61c('0x17')]);this[_0xe61c('0x1c')]=_0x412eae[_0xe61c('0x1c')];this[_0xe61c('0x1d')]=_0x412eae[_0xe61c('0x1d')];this[_0xe61c('0x1e')]=_0x412eae[_0xe61c('0x1e')];this[_0xe61c('0x1f')]=_0x4b5a3a[_0xe61c('0x1f')];this['callbackuniqueid']=_0x4b5a3a[_0xe61c('0x20')];this[_0xe61c('0x21')]=_0x4b5a3a[_0xe61c('0x21')];this[_0xe61c('0x22')]=_0x4b5a3a[_0xe61c('0x22')];this[_0xe61c('0x23')]=_0x4b5a3a[_0xe61c('0x23')];this[_0xe61c('0x24')]=_0x4b5a3a['ListId'];this[_0xe61c('0x25')]=_0x4b5a3a[_0xe61c('0x25')];this[_0xe61c('0x26')]=_0x4b5a3a['VoiceQueueId'];this['CampaignId']=_0x4b5a3a[_0xe61c('0x27')];this[_0xe61c('0x28')]=_0x4b5a3a['originatecalleridnum']||'';this[_0xe61c('0x29')]=_0x4b5a3a[_0xe61c('0x29')]||'';}module[_0xe61c('0x2a')]=AgentComplete; \ No newline at end of file +var _0x9c93=['countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x3415f5,_0x5123b3){var _0x5dbf7a=function(_0x3bf6bf){while(--_0x3bf6bf){_0x3415f5['push'](_0x3415f5['shift']());}};_0x5dbf7a(++_0x5123b3);}(_0x9c93,0x101));var _0x39c9=function(_0x2490ad,_0x33836e){_0x2490ad=_0x2490ad-0x0;var _0x38262d=_0x9c93[_0x2490ad];return _0x38262d;};'use strict';var util=require(_0x39c9('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x573065,_0x3fe770){var _0x5ac1ff=moment(_0x573065)['milliseconds'](0x0);var _0x177e98=moment(_0x3fe770)[_0x39c9('0x1')](0x0);return _0x5ac1ff[_0x39c9('0x2')](_0x177e98,_0x39c9('0x3'));}function AgentComplete(_0x4a1cca,_0x2476a7){this[_0x39c9('0x4')]=0x4;this[_0x39c9('0x5')]=_0x39c9('0x6');this[_0x39c9('0x7')]=_0x4a1cca[_0x39c9('0x7')];this['type']=_0x4a1cca[_0x39c9('0x8')];this[_0x39c9('0x9')]=_0x4a1cca[_0x39c9('0x8')]===_0x39c9('0xa')?_0x39c9('0xb'):_0x4a1cca[_0x39c9('0x8')];this['countbusyretry']=_0x4a1cca['countbusyretry'];this[_0x39c9('0xc')]=_0x4a1cca[_0x39c9('0xc')];this[_0x39c9('0xd')]=_0x4a1cca[_0x39c9('0xd')];this[_0x39c9('0xe')]=_0x4a1cca[_0x39c9('0xf')]+_0x4a1cca[_0x39c9('0xc')]+_0x4a1cca['countnoanswerretry']+_0x4a1cca['countnosuchnumberretry']+_0x4a1cca[_0x39c9('0x10')]+_0x4a1cca[_0x39c9('0x11')]+_0x4a1cca['countmachineretry']+_0x4a1cca[_0x39c9('0x12')];this[_0x39c9('0x13')]=_0x4a1cca[_0x39c9('0x13')];this[_0x39c9('0x10')]=_0x4a1cca[_0x39c9('0x10')];this[_0x39c9('0x11')]=_0x4a1cca[_0x39c9('0x11')];this[_0x39c9('0x14')]=_0x4a1cca[_0x39c9('0x14')];this[_0x39c9('0x12')]=_0x4a1cca[_0x39c9('0x12')];this[_0x39c9('0x15')]=_0x2476a7[_0x39c9('0x15')];this[_0x39c9('0x16')]=_0x4a1cca[_0x39c9('0x17')];this['calleridnum']=_0x4a1cca['number'];this[_0x39c9('0x18')]=_0x4a1cca[_0x39c9('0x18')];this[_0x39c9('0x19')]=_0x4a1cca[_0x39c9('0x19')];this['answertime']=_0x4a1cca[_0x39c9('0x1a')];this[_0x39c9('0x1b')]=moment()[_0x39c9('0x1c')](_0x39c9('0x1d'));this[_0x39c9('0x1e')]=getSeconds(_0x4a1cca[_0x39c9('0x19')],_0x4a1cca[_0x39c9('0x18')]);this[_0x39c9('0x1f')]=getSeconds(_0x4a1cca['answertime'],_0x4a1cca['responsetime']);this[_0x39c9('0x20')]=getSeconds(this[_0x39c9('0x1b')],_0x4a1cca[_0x39c9('0x1a')]);this[_0x39c9('0xb')]=_0x2476a7[_0x39c9('0xb')];this[_0x39c9('0x21')]=_0x2476a7[_0x39c9('0x21')];this[_0x39c9('0x22')]=_0x2476a7[_0x39c9('0x22')];this[_0x39c9('0x23')]=_0x4a1cca[_0x39c9('0x23')];this[_0x39c9('0x24')]=_0x4a1cca['callbackuniqueid'];this[_0x39c9('0x25')]=_0x4a1cca['callbackat'];this[_0x39c9('0x26')]=_0x4a1cca[_0x39c9('0x26')];this[_0x39c9('0x27')]=_0x4a1cca[_0x39c9('0x27')];this[_0x39c9('0x28')]=_0x4a1cca[_0x39c9('0x28')];this[_0x39c9('0x29')]=_0x4a1cca[_0x39c9('0x29')];this[_0x39c9('0x2a')]=_0x4a1cca[_0x39c9('0x2a')];this['CampaignId']=_0x4a1cca[_0x39c9('0x2b')];this['originatecalleridnum']=_0x4a1cca[_0x39c9('0x2c')]||'';this[_0x39c9('0x2d')]=_0x4a1cca[_0x39c9('0x2d')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index c739b7c..8f2b2d4 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 _0x43c4=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x44fef1,_0x132cf4){var _0x3c3a04=function(_0x175a90){while(--_0x175a90){_0x44fef1['push'](_0x44fef1['shift']());}};_0x3c3a04(++_0x132cf4);}(_0x43c4,0x15e));var _0x443c=function(_0x4e6bbd,_0x5b9f7f){_0x4e6bbd=_0x4e6bbd-0x0;var _0xd7cfdb=_0x43c4[_0x4e6bbd];return _0xd7cfdb;};'use strict';var util=require(_0x443c('0x0'));var _=require(_0x443c('0x1'));var moment=require(_0x443c('0x2'));function getSeconds(_0x50fc7f,_0x24fd05){var _0x4cabfc=moment(_0x50fc7f)[_0x443c('0x3')](0x0);var _0x274d6a=moment(_0x24fd05)[_0x443c('0x3')](0x0);return _0x4cabfc[_0x443c('0x4')](_0x274d6a,_0x443c('0x5'));}function Final(_0x29dddc){this[_0x443c('0x6')]=_0x29dddc[_0x443c('0x6')];this[_0x443c('0x7')]=_0x29dddc['scheduledat'];this[_0x443c('0x8')]=_0x29dddc[_0x443c('0x8')];this[_0x443c('0x9')]=_0x29dddc[_0x443c('0x8')]==='outbound'?_0x443c('0xa'):_0x29dddc[_0x443c('0x8')];this[_0x443c('0xb')]=_0x29dddc['countbusyretry'];this[_0x443c('0xc')]=_0x29dddc['countcongestionretry'];this[_0x443c('0xd')]=_0x29dddc['countnoanswerretry'];this[_0x443c('0xe')]=_0x29dddc[_0x443c('0xb')]+_0x29dddc['countcongestionretry']+_0x29dddc[_0x443c('0xd')]+_0x29dddc[_0x443c('0xf')]+_0x29dddc['countdropretry']+_0x29dddc['countabandonedretry']+_0x29dddc['countmachineretry']+_0x29dddc[_0x443c('0x10')];this[_0x443c('0xf')]=_0x29dddc[_0x443c('0xf')];this['countdropretry']=_0x29dddc['countdropretry'];this[_0x443c('0x11')]=_0x29dddc[_0x443c('0x11')];this[_0x443c('0x12')]=_0x29dddc[_0x443c('0x12')];this[_0x443c('0x10')]=_0x29dddc[_0x443c('0x10')];this[_0x443c('0xa')]=_0x29dddc[_0x443c('0xa')];this['calleridname']=_0x29dddc['calleridname'];this['calleridnum']=_0x29dddc[_0x443c('0x13')];this[_0x443c('0x14')]=_0x29dddc['starttime'];this[_0x443c('0x15')]=_0x29dddc['responsetime'];this[_0x443c('0x16')]=_0x29dddc[_0x443c('0x15')];this[_0x443c('0x17')]=_0x29dddc[_0x443c('0x17')]||0x0;this['holdtime']=_0x29dddc[_0x443c('0x18')]||0x0;this[_0x443c('0x19')]=_0x29dddc[_0x443c('0x19')]||0x0;this[_0x443c('0x1a')]=_0x29dddc[_0x443c('0x1a')];this[_0x443c('0x1b')]=_0x29dddc['callbackuniqueid'];this[_0x443c('0x1c')]=_0x29dddc[_0x443c('0x1c')];this[_0x443c('0x1d')]=_0x29dddc[_0x443c('0x1d')];this[_0x443c('0x1e')]=_0x29dddc['ContactId'];this[_0x443c('0x1f')]=_0x29dddc[_0x443c('0x1f')];this[_0x443c('0x20')]=_0x29dddc[_0x443c('0x20')];this['VoiceQueueId']=_0x29dddc[_0x443c('0x21')];this['CampaignId']=_0x29dddc[_0x443c('0x22')];this[_0x443c('0x23')]=_0x29dddc[_0x443c('0x23')]||'';this[_0x443c('0x24')]=_0x29dddc['originatecalleridname']||'';}module[_0x443c('0x25')]=Final; \ No newline at end of file +var _0xe692=['countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','uniqueid','type','outbound','queue','countbusyretry'];(function(_0x8444a5,_0x1b1225){var _0x11e43e=function(_0x55ec72){while(--_0x55ec72){_0x8444a5['push'](_0x8444a5['shift']());}};_0x11e43e(++_0x1b1225);}(_0xe692,0x156));var _0x2e69=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xe692[_0x11c573];return _0x6b72de;};'use strict';var util=require(_0x2e69('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x4b68cf,_0x4c326d){var _0x12497c=moment(_0x4b68cf)[_0x2e69('0x1')](0x0);var _0x2ae324=moment(_0x4c326d)[_0x2e69('0x1')](0x0);return _0x12497c[_0x2e69('0x2')](_0x2ae324,'seconds');}function Final(_0x3a7caf){this[_0x2e69('0x3')]=_0x3a7caf[_0x2e69('0x3')];this['scheduledat']=_0x3a7caf['scheduledat'];this[_0x2e69('0x4')]=_0x3a7caf[_0x2e69('0x4')];this['campaigntype']=_0x3a7caf['type']===_0x2e69('0x5')?_0x2e69('0x6'):_0x3a7caf[_0x2e69('0x4')];this[_0x2e69('0x7')]=_0x3a7caf['countbusyretry'];this['countcongestionretry']=_0x3a7caf['countcongestionretry'];this[_0x2e69('0x8')]=_0x3a7caf[_0x2e69('0x8')];this['countglobal']=_0x3a7caf[_0x2e69('0x7')]+_0x3a7caf[_0x2e69('0x9')]+_0x3a7caf[_0x2e69('0x8')]+_0x3a7caf[_0x2e69('0xa')]+_0x3a7caf[_0x2e69('0xb')]+_0x3a7caf[_0x2e69('0xc')]+_0x3a7caf[_0x2e69('0xd')]+_0x3a7caf[_0x2e69('0xe')];this[_0x2e69('0xa')]=_0x3a7caf[_0x2e69('0xa')];this[_0x2e69('0xb')]=_0x3a7caf['countdropretry'];this['countabandonedretry']=_0x3a7caf[_0x2e69('0xc')];this[_0x2e69('0xd')]=_0x3a7caf[_0x2e69('0xd')];this[_0x2e69('0xe')]=_0x3a7caf[_0x2e69('0xe')];this[_0x2e69('0x6')]=_0x3a7caf[_0x2e69('0x6')];this[_0x2e69('0xf')]=_0x3a7caf[_0x2e69('0xf')];this['calleridnum']=_0x3a7caf[_0x2e69('0x10')];this[_0x2e69('0x11')]=_0x3a7caf[_0x2e69('0x11')];this[_0x2e69('0x12')]=_0x3a7caf[_0x2e69('0x12')];this[_0x2e69('0x13')]=_0x3a7caf['responsetime'];this[_0x2e69('0x14')]=_0x3a7caf[_0x2e69('0x14')]||0x0;this[_0x2e69('0x15')]=_0x3a7caf[_0x2e69('0x15')]||0x0;this[_0x2e69('0x16')]=_0x3a7caf[_0x2e69('0x16')]||0x0;this[_0x2e69('0x17')]=_0x3a7caf[_0x2e69('0x17')];this['callbackuniqueid']=_0x3a7caf[_0x2e69('0x18')];this['callbackat']=_0x3a7caf[_0x2e69('0x19')];this[_0x2e69('0x1a')]=_0x3a7caf[_0x2e69('0x1a')];this[_0x2e69('0x1b')]=_0x3a7caf[_0x2e69('0x1b')];this[_0x2e69('0x1c')]=_0x3a7caf[_0x2e69('0x1c')];this['UserId']=_0x3a7caf[_0x2e69('0x1d')];this['VoiceQueueId']=_0x3a7caf[_0x2e69('0x1e')];this['CampaignId']=_0x3a7caf[_0x2e69('0x1f')];this[_0x2e69('0x20')]=_0x3a7caf['originatecalleridnum']||'';this[_0x2e69('0x21')]=_0x3a7caf[_0x2e69('0x21')]||'';}module[_0x2e69('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a04f798..307feb1 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 _0x5be7=['countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x5be7,0x75));var _0x75be=function(_0x10c90f,_0xf3f52f){_0x10c90f=_0x10c90f-0x0;var _0x24ded9=_0x5be7[_0x10c90f];return _0x24ded9;};'use strict';var util=require('util');var _=require(_0x75be('0x0'));var moment=require(_0x75be('0x1'));function getSeconds(_0x557516,_0x1f3f71){var _0x9318d9=moment(_0x557516)[_0x75be('0x2')](0x0);var _0x44b18d=moment(_0x1f3f71)[_0x75be('0x2')](0x0);return _0x9318d9[_0x75be('0x3')](_0x44b18d,_0x75be('0x4'));}function Hangup(_0x100f23,_0xc03c48){this[_0x75be('0x5')]=0x4;this[_0x75be('0x6')]='Answer';this[_0x75be('0x7')]=_0x100f23[_0x75be('0x7')];this[_0x75be('0x8')]=_0x100f23['type'];this['campaigntype']=_0x100f23['type']===_0x75be('0x9')?_0x75be('0xa'):_0x100f23[_0x75be('0x8')];this[_0x75be('0xb')]=_0x100f23[_0x75be('0xb')];this[_0x75be('0xc')]=_0x100f23['countcongestionretry'];this['countnoanswerretry']=_0x100f23[_0x75be('0xd')];this[_0x75be('0xe')]=_0x100f23[_0x75be('0xb')]+_0x100f23['countcongestionretry']+_0x100f23[_0x75be('0xd')]+_0x100f23[_0x75be('0xf')]+_0x100f23[_0x75be('0x10')]+_0x100f23[_0x75be('0x11')]+_0x100f23['countmachineretry']+_0x100f23[_0x75be('0x12')];this['countnosuchnumberretry']=_0x100f23['countnosuchnumberretry'];this[_0x75be('0x10')]=_0x100f23[_0x75be('0x10')];this[_0x75be('0x11')]=_0x100f23[_0x75be('0x11')];this['countmachineretry']=_0x100f23[_0x75be('0x13')];this['countagentrejectretry']=_0x100f23[_0x75be('0x12')];this[_0x75be('0x14')]=_0xc03c48[_0x75be('0x14')];this[_0x75be('0x15')]=_0x100f23[_0x75be('0x16')];this[_0x75be('0x17')]=_0x100f23[_0x75be('0x18')];this[_0x75be('0x19')]=_0x100f23['starttime'];this[_0x75be('0x1a')]=_0x100f23[_0x75be('0x1a')];this['endtime']=moment()[_0x75be('0x1b')](_0x75be('0x1c'));this[_0x75be('0x1d')]=getSeconds(_0x100f23[_0x75be('0x1a')],_0x100f23[_0x75be('0x19')]);this[_0x75be('0x1e')]=0x0;this[_0x75be('0x1f')]=getSeconds(this[_0x75be('0x20')],_0x100f23[_0x75be('0x1a')]);this['queue']=_0x100f23[_0x75be('0xa')];this[_0x75be('0x21')]='IVR';this['reason']=_0xc03c48[_0x75be('0x22')];this[_0x75be('0x23')]=_0x100f23['callback'];this['callbackuniqueid']=_0x100f23[_0x75be('0x24')];this['callbackat']=_0x100f23[_0x75be('0x25')];this[_0x75be('0x26')]=_0x100f23['recallme'];this[_0x75be('0x27')]=_0x100f23[_0x75be('0x27')];this[_0x75be('0x28')]=_0x100f23['ListId'];this[_0x75be('0x29')]=_0x100f23[_0x75be('0x29')];this[_0x75be('0x2a')]=_0x100f23[_0x75be('0x2a')];this[_0x75be('0x2b')]=_0x100f23[_0x75be('0x2b')];}module['exports']=Hangup; \ No newline at end of file +var _0x472e=['responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime'];(function(_0x48ecc2,_0x3765d2){var _0x5eca17=function(_0x9a3b2e){while(--_0x9a3b2e){_0x48ecc2['push'](_0x48ecc2['shift']());}};_0x5eca17(++_0x3765d2);}(_0x472e,0x17c));var _0xe472=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0x472e[_0x5ce15c];return _0x36e4f5;};'use strict';var util=require(_0xe472('0x0'));var _=require(_0xe472('0x1'));var moment=require(_0xe472('0x2'));function getSeconds(_0x3296f7,_0x4b8409){var _0x43090c=moment(_0x3296f7)[_0xe472('0x3')](0x0);var _0x34c59d=moment(_0x4b8409)[_0xe472('0x3')](0x0);return _0x43090c['diff'](_0x34c59d,'seconds');}function Hangup(_0x1794c9,_0x487881){this[_0xe472('0x4')]=0x4;this[_0xe472('0x5')]='Answer';this['scheduledat']=_0x1794c9[_0xe472('0x6')];this[_0xe472('0x7')]=_0x1794c9[_0xe472('0x7')];this[_0xe472('0x8')]=_0x1794c9[_0xe472('0x7')]===_0xe472('0x9')?_0xe472('0xa'):_0x1794c9['type'];this[_0xe472('0xb')]=_0x1794c9[_0xe472('0xb')];this[_0xe472('0xc')]=_0x1794c9['countcongestionretry'];this['countnoanswerretry']=_0x1794c9[_0xe472('0xd')];this[_0xe472('0xe')]=_0x1794c9[_0xe472('0xb')]+_0x1794c9[_0xe472('0xc')]+_0x1794c9[_0xe472('0xd')]+_0x1794c9[_0xe472('0xf')]+_0x1794c9[_0xe472('0x10')]+_0x1794c9['countabandonedretry']+_0x1794c9[_0xe472('0x11')]+_0x1794c9[_0xe472('0x12')];this[_0xe472('0xf')]=_0x1794c9[_0xe472('0xf')];this[_0xe472('0x10')]=_0x1794c9['countdropretry'];this[_0xe472('0x13')]=_0x1794c9[_0xe472('0x13')];this['countmachineretry']=_0x1794c9[_0xe472('0x11')];this['countagentrejectretry']=_0x1794c9[_0xe472('0x12')];this['uniqueid']=_0x487881['uniqueid'];this[_0xe472('0x14')]=_0x1794c9[_0xe472('0x15')];this[_0xe472('0x16')]=_0x1794c9[_0xe472('0x17')];this[_0xe472('0x18')]=_0x1794c9[_0xe472('0x18')];this[_0xe472('0x19')]=_0x1794c9[_0xe472('0x19')];this['endtime']=moment()[_0xe472('0x1a')](_0xe472('0x1b'));this[_0xe472('0x1c')]=getSeconds(_0x1794c9[_0xe472('0x19')],_0x1794c9['starttime']);this[_0xe472('0x1d')]=0x0;this[_0xe472('0x1e')]=getSeconds(this[_0xe472('0x1f')],_0x1794c9[_0xe472('0x19')]);this[_0xe472('0xa')]=_0x1794c9['queue'];this[_0xe472('0x20')]='IVR';this[_0xe472('0x21')]=_0x487881[_0xe472('0x22')];this[_0xe472('0x23')]=_0x1794c9[_0xe472('0x23')];this['callbackuniqueid']=_0x1794c9[_0xe472('0x24')];this[_0xe472('0x25')]=_0x1794c9['callbackat'];this[_0xe472('0x26')]=_0x1794c9[_0xe472('0x26')];this[_0xe472('0x27')]=_0x1794c9[_0xe472('0x27')];this[_0xe472('0x28')]=_0x1794c9['ListId'];this[_0xe472('0x29')]=_0x1794c9['UserId'];this[_0xe472('0x2a')]=_0x1794c9[_0xe472('0x2a')];this[_0xe472('0x2b')]=_0x1794c9[_0xe472('0x2b')];}module[_0xe472('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 7cacffd..cad44fe 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 _0x7f1d=['endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime'];(function(_0x2335e6,_0x1bade8){var _0x370a50=function(_0x12d7cf){while(--_0x12d7cf){_0x2335e6['push'](_0x2335e6['shift']());}};_0x370a50(++_0x1bade8);}(_0x7f1d,0x180));var _0xd7f1=function(_0x2573f7,_0x1200bc){_0x2573f7=_0x2573f7-0x0;var _0x57740d=_0x7f1d[_0x2573f7];return _0x57740d;};'use strict';var util=require(_0xd7f1('0x0'));var _=require(_0xd7f1('0x1'));var moment=require(_0xd7f1('0x2'));function getSeconds(_0x2fa4f5,_0x39bef1){var _0x539797=moment(_0x2fa4f5)[_0xd7f1('0x3')](0x0);var _0x2dfae7=moment(_0x39bef1)['milliseconds'](0x0);return _0x539797[_0xd7f1('0x4')](_0x2dfae7,_0xd7f1('0x5'));}function History(_0x3c1f3b){this[_0xd7f1('0x6')]=_0x3c1f3b[_0xd7f1('0x6')];this[_0xd7f1('0x7')]=_0x3c1f3b[_0xd7f1('0x7')]||undefined;this['type']=_0x3c1f3b[_0xd7f1('0x8')];this['campaigntype']=_0x3c1f3b[_0xd7f1('0x8')]===_0xd7f1('0x9')?_0xd7f1('0xa'):_0x3c1f3b[_0xd7f1('0x8')];this['countbusyretry']=_0x3c1f3b['countbusyretry'];this['countcongestionretry']=_0x3c1f3b[_0xd7f1('0xb')];this[_0xd7f1('0xc')]=_0x3c1f3b['countnoanswerretry'];this['countglobal']=_0x3c1f3b[_0xd7f1('0xd')]+_0x3c1f3b['countcongestionretry']+_0x3c1f3b['countnoanswerretry']+_0x3c1f3b[_0xd7f1('0xe')]+_0x3c1f3b[_0xd7f1('0xf')]+_0x3c1f3b[_0xd7f1('0x10')]+_0x3c1f3b[_0xd7f1('0x11')]+_0x3c1f3b[_0xd7f1('0x12')];this[_0xd7f1('0xe')]=_0x3c1f3b['countnosuchnumberretry'];this['countdropretry']=_0x3c1f3b['countdropretry'];this[_0xd7f1('0x10')]=_0x3c1f3b[_0xd7f1('0x10')];this[_0xd7f1('0x11')]=_0x3c1f3b[_0xd7f1('0x11')];this['countagentrejectretry']=_0x3c1f3b['countagentrejectretry'];this[_0xd7f1('0xa')]=_0x3c1f3b[_0xd7f1('0xa')];this[_0xd7f1('0x13')]=_0x3c1f3b['name'];this[_0xd7f1('0x14')]=_0x3c1f3b['number'];this[_0xd7f1('0x15')]=_0x3c1f3b['starttime'];this['responsetime']=_0x3c1f3b[_0xd7f1('0x16')];this[_0xd7f1('0x17')]=_0x3c1f3b[_0xd7f1('0x16')];this[_0xd7f1('0x18')]=getSeconds(_0x3c1f3b['responsetime'],_0x3c1f3b[_0xd7f1('0x15')]);this[_0xd7f1('0x19')]=0x0;this[_0xd7f1('0x1a')]=0x0;this['callback']=_0x3c1f3b['callback'];this[_0xd7f1('0x1b')]=_0x3c1f3b[_0xd7f1('0x1b')];this[_0xd7f1('0x1c')]=_0x3c1f3b[_0xd7f1('0x1c')];this[_0xd7f1('0x1d')]=_0x3c1f3b[_0xd7f1('0x1d')];this[_0xd7f1('0x1e')]=_0x3c1f3b[_0xd7f1('0x1e')];this['ListId']=_0x3c1f3b[_0xd7f1('0x1f')];this['UserId']=_0x3c1f3b['UserId'];this[_0xd7f1('0x20')]=_0x3c1f3b[_0xd7f1('0x20')];this['CampaignId']=_0x3c1f3b[_0xd7f1('0x21')];this[_0xd7f1('0x22')]=_0x3c1f3b['originatecalleridnum']||'';this[_0xd7f1('0x23')]=_0x3c1f3b['originatecalleridname']||'';}module[_0xd7f1('0x24')]=History; \ No newline at end of file +var _0x78cc=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','uniqueid','scheduledat','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','name','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x3ce660,_0x2ff52d){var _0x47993d=function(_0x4be1af){while(--_0x4be1af){_0x3ce660['push'](_0x3ce660['shift']());}};_0x47993d(++_0x2ff52d);}(_0x78cc,0x11c));var _0xc78c=function(_0xe7805a,_0x3f86bc){_0xe7805a=_0xe7805a-0x0;var _0x21cfa7=_0x78cc[_0xe7805a];return _0x21cfa7;};'use strict';var util=require(_0xc78c('0x0'));var _=require('lodash');var moment=require(_0xc78c('0x1'));function getSeconds(_0x37ec2e,_0x34f708){var _0x3a87ca=moment(_0x37ec2e)[_0xc78c('0x2')](0x0);var _0x3bf800=moment(_0x34f708)[_0xc78c('0x2')](0x0);return _0x3a87ca[_0xc78c('0x3')](_0x3bf800,'seconds');}function History(_0x523ca9){this['uniqueid']=_0x523ca9[_0xc78c('0x4')];this['scheduledat']=_0x523ca9[_0xc78c('0x5')]||undefined;this['type']=_0x523ca9['type'];this['campaigntype']=_0x523ca9['type']===_0xc78c('0x6')?_0xc78c('0x7'):_0x523ca9[_0xc78c('0x8')];this['countbusyretry']=_0x523ca9[_0xc78c('0x9')];this[_0xc78c('0xa')]=_0x523ca9[_0xc78c('0xa')];this[_0xc78c('0xb')]=_0x523ca9['countnoanswerretry'];this[_0xc78c('0xc')]=_0x523ca9['countbusyretry']+_0x523ca9[_0xc78c('0xa')]+_0x523ca9['countnoanswerretry']+_0x523ca9[_0xc78c('0xd')]+_0x523ca9['countdropretry']+_0x523ca9[_0xc78c('0xe')]+_0x523ca9['countmachineretry']+_0x523ca9['countagentrejectretry'];this[_0xc78c('0xd')]=_0x523ca9[_0xc78c('0xd')];this['countdropretry']=_0x523ca9['countdropretry'];this['countabandonedretry']=_0x523ca9[_0xc78c('0xe')];this[_0xc78c('0xf')]=_0x523ca9[_0xc78c('0xf')];this[_0xc78c('0x10')]=_0x523ca9[_0xc78c('0x10')];this[_0xc78c('0x7')]=_0x523ca9[_0xc78c('0x7')];this['calleridname']=_0x523ca9[_0xc78c('0x11')];this['calleridnum']=_0x523ca9['number'];this[_0xc78c('0x12')]=_0x523ca9[_0xc78c('0x12')];this[_0xc78c('0x13')]=_0x523ca9[_0xc78c('0x13')];this[_0xc78c('0x14')]=_0x523ca9[_0xc78c('0x13')];this['ringtime']=getSeconds(_0x523ca9['responsetime'],_0x523ca9[_0xc78c('0x12')]);this[_0xc78c('0x15')]=0x0;this[_0xc78c('0x16')]=0x0;this[_0xc78c('0x17')]=_0x523ca9[_0xc78c('0x17')];this['callbackuniqueid']=_0x523ca9[_0xc78c('0x18')];this['callbackat']=_0x523ca9[_0xc78c('0x19')];this['recallme']=_0x523ca9[_0xc78c('0x1a')];this[_0xc78c('0x1b')]=_0x523ca9[_0xc78c('0x1b')];this[_0xc78c('0x1c')]=_0x523ca9[_0xc78c('0x1c')];this['UserId']=_0x523ca9[_0xc78c('0x1d')];this[_0xc78c('0x1e')]=_0x523ca9[_0xc78c('0x1e')];this[_0xc78c('0x1f')]=_0x523ca9[_0xc78c('0x1f')];this[_0xc78c('0x20')]=_0x523ca9[_0xc78c('0x20')]||'';this[_0xc78c('0x21')]=_0x523ca9[_0xc78c('0x21')]||'';}module[_0xc78c('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 470fac8..130ab29 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 _0xf269=['\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','content','indexOf','true','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','loggedIn','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIfTimeIntervals','[syncCampaigns]','pow','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','%s%s','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','dialCutDigit','SIP/%s/%s%s','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','outboundRejectCallsDay','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','outboundReCallsDay','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[getContactDialerPredictive]','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','Umin\x20=\x20','lodash','bluebird','moment','md5','ioredis','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','defaults','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','newexten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','milliseconds','diff','seconds','emit','type','outbound','answered','available','pTalking','sumDuration','talking','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangBusyFactor','startProgressive','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','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','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','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','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','statedesc','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','moveContactManagedDialer','syncVarSet','uniqueid','variable','amdstatus','xcally-motion-dialer','HANGUP','HangupInAMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','value','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','AMD','countcongestionretry','countnoanswerretry','dialMachineRetryFrequency','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','endtime','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','strategy','roundrobin','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','syncCampaigns','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones'];(function(_0x325e42,_0x4d06){var _0x5218c7=function(_0x5a97ab){while(--_0x5a97ab){_0x325e42['push'](_0x325e42['shift']());}};_0x5218c7(++_0x4d06);}(_0xf269,0xd2));var _0x9f26=function(_0x5f49c9,_0x447c8d){_0x5f49c9=_0x5f49c9-0x0;var _0x263adc=_0xf269[_0x5f49c9];return _0x263adc;};'use strict';var util=require('util');var _=require(_0x9f26('0x0'));var BPromise=require(_0x9f26('0x1'));var uuid=require('uuid');var moment=require(_0x9f26('0x2'));var rr=require('rr');var md5=require(_0x9f26('0x3'));var Redis=require(_0x9f26('0x4'));var ut=require('../preview/util/util');var config=require(_0x9f26('0x5'));var logger=require('../../../config/logger')(_0x9f26('0x6'));var loggerBooked=require(_0x9f26('0x7'))(_0x9f26('0x8'));var loggerPredictive=require(_0x9f26('0x7'))(_0x9f26('0x9'));var loggerPredictiveCalls=require(_0x9f26('0x7'))(_0x9f26('0xa'));var loggerSyncQueueSummary=require(_0x9f26('0x7'))('syncQueueSummary');var ami=require('../ami');config['redis']=_[_0x9f26('0xb')](config[_0x9f26('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9f26('0xc')]));var cmHopper=require(_0x9f26('0xd'));var cmHopperHistory=require(_0x9f26('0xe'));var cmHopperBlack=require(_0x9f26('0xf'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require('./history');var Final=require(_0x9f26('0x10'));var AgentComplete=require(_0x9f26('0x11'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x9f26('0x12'));var ipAgi=process[_0x9f26('0x13')][_0x9f26('0x14')]||_0x9f26('0x15');var strategy={'rrmemory':_0x9f26('0x16'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x9f26('0x17')][_0x9f26('0x18')]=function(_0x514267){this['tail']=this[_0x9f26('0x19')]?this[_0x9f26('0x19')][_0x9f26('0x1a')](_0x514267):_0x514267();};function Dialer(_0x382bfe,_0x1208e0){this['sequence']=new Sequence();this[_0x9f26('0x1b')]=_0x1208e0;this[_0x9f26('0x1c')]=_0x382bfe[_0x9f26('0x1c')];this[_0x9f26('0x1d')]=_0x382bfe[_0x9f26('0x1d')];this[_0x9f26('0x1e')]=_0x382bfe['agents'];this['trunks']=_0x382bfe[_0x9f26('0x1f')];this['maxNumberOriginate']=config[_0x9f26('0x20')]||0x2;this[_0x9f26('0x21')]={};this[_0x9f26('0x22')]={};this[_0x9f26('0x23')]={};this[_0x9f26('0x24')]={};this[_0x9f26('0x25')]={};this[_0x9f26('0x26')]={};this['startProgressive']={};this[_0x9f26('0x27')]={};this[_0x9f26('0x28')]={};this[_0x9f26('0x29')]={};ami['on'](_0x9f26('0x2a'),this[_0x9f26('0x2b')][_0x9f26('0x2c')](this));ami['on'](_0x9f26('0x2d'),this[_0x9f26('0x2e')][_0x9f26('0x2c')](this));ami['on'](_0x9f26('0x2f'),this[_0x9f26('0x30')][_0x9f26('0x2c')](this));ami['on']('agentcomplete',this[_0x9f26('0x31')][_0x9f26('0x2c')](this));ami['on'](_0x9f26('0x32'),this[_0x9f26('0x33')][_0x9f26('0x2c')](this));ami['on'](_0x9f26('0x34'),this['syncHangup'][_0x9f26('0x2c')](this));ami['on'](_0x9f26('0x35'),this['syncNewExten']['bind'](this));ami['on'](_0x9f26('0x36'),this['syncVarSet'][_0x9f26('0x2c')](this));ami['on']('queuemember',this[_0x9f26('0x37')][_0x9f26('0x2c')](this));ami['on'](_0x9f26('0x38'),this[_0x9f26('0x39')][_0x9f26('0x2c')](this));this[_0x9f26('0x3a')]();this[_0x9f26('0x3b')]();}function isNotNull(_0x315b28){return _0x315b28!==null&&!_[_0x9f26('0x3c')](_0x315b28);}function checkIsLoggedIn(_0x2ad80b,_0x2cc229){return function(){if(_0x2cc229<=0x0){_0x2ad80b[_0x9f26('0x3d')]=_0x9f26('0x3e');throw _0x2ad80b[_0x9f26('0x3f')]+_0x9f26('0x40');}};}function isActive(_0x3267d9){return _0x3267d9;}function checkIsActive(_0x20685e,_0x40a469){return function(){if(!isActive(_0x40a469)){_0x20685e[_0x9f26('0x3d')]=_0x9f26('0x41');throw _0x20685e[_0x9f26('0x3f')]+_0x9f26('0x42');}};}function checkInterval(_0x42b778){return function(){if(!isNotNull(_0x42b778[_0x9f26('0x43')])){_0x42b778['message']=_0x9f26('0x44');throw _0x42b778[_0x9f26('0x3f')]+_0x9f26('0x45');}if(!isNotNull(_0x42b778[_0x9f26('0x43')][_0x9f26('0x46')])){_0x42b778[_0x9f26('0x3d')]='INTERVAL_IS_NULL';throw _0x42b778['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x9f26('0x47')](_0x42b778[_0x9f26('0x43')]['Intervals']))){_0x42b778[_0x9f26('0x3d')]=_0x9f26('0x44');throw _0x42b778[_0x9f26('0x3f')]+_0x9f26('0x45');}};}function msgResponse(_0x1d62fb,_0x10a08c,_0x58037f){return{'action':_0x1d62fb,'response':_0x10a08c,'message':_0x58037f,'stack':_0x58037f};}function myreject(_0x45bbdc){return function(_0x2680ff){return _0x45bbdc(msgResponse('[ifTime][Action]',_0x9f26('0x48'),JSON['stringify'](_0x2680ff)));};}function getSeconds(_0x11e63d,_0x81c266){var _0x1a2bcb=moment(_0x11e63d)[_0x9f26('0x49')](0x0);var _0x54767b=moment(_0x81c266)[_0x9f26('0x49')](0x0);return _0x1a2bcb[_0x9f26('0x4a')](_0x54767b,_0x9f26('0x4b'));}function emit(_0x4f4447,_0x430cc6,_0x102432){io['to'](_0x4f4447)[_0x9f26('0x4c')](_0x430cc6,_0x102432);}function emitVoiceQueueSummary(_0xf8414b){if(_0xf8414b[_0x9f26('0x4d')]===_0x9f26('0x4e')){var _0x4a241d={'id':_0xf8414b['id'],'name':_0xf8414b[_0x9f26('0x3f')],'strategy':_0xf8414b['strategy'],'answered':_0xf8414b[_0x9f26('0x4f')],'available':_0xf8414b[_0x9f26('0x50')],'loggedIn':_0xf8414b['loggedIn'],'pTalking':_0xf8414b[_0x9f26('0x51')],'sumBillable':_0xf8414b['sumBillable'],'sumDuration':_0xf8414b[_0x9f26('0x52')],'sumHoldTime':_0xf8414b['sumHoldTime']||0x0,'talking':_0xf8414b[_0x9f26('0x53')],'total':_0xf8414b['total'],'type':_0xf8414b[_0x9f26('0x4d')],'unmanaged':_0xf8414b[_0x9f26('0x54')],'abandoned':_0xf8414b[_0x9f26('0x55')],'waiting':_0xf8414b[_0x9f26('0x56')],'loggedInDb':_0xf8414b[_0x9f26('0x57')],'dialActive':_0xf8414b['dialActive'],'dialMethod':_0xf8414b[_0x9f26('0x58')],'dialOriginateCallerIdName':_0xf8414b[_0x9f26('0x59')],'dialOriginateCallerIdNumber':_0xf8414b['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xf8414b['dialOriginateTimeout'],'dialPrefix':_0xf8414b[_0x9f26('0x5a')],'outboundAnswerAgiCallsDay':_0xf8414b[_0x9f26('0x5b')],'outboundAnswerCallsDay':_0xf8414b[_0x9f26('0x5c')],'outboundBlacklistCallsDay':_0xf8414b[_0x9f26('0x5d')],'outboundBusyCallsDay':_0xf8414b['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xf8414b[_0x9f26('0x5e')],'outboundDropCallsDayACS':_0xf8414b[_0x9f26('0x5f')],'outboundDropCallsDayCallersExit':_0xf8414b[_0x9f26('0x60')],'outboundDropCallsDayTimeout':_0xf8414b[_0x9f26('0x61')],'outboundNoAnswerCallsDay':_0xf8414b['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xf8414b[_0x9f26('0x62')],'outboundOriginateFailureCallsDay':_0xf8414b['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xf8414b['outboundReCallsDay'],'outboundRejectCallsDay':_0xf8414b['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xf8414b['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0xf8414b[_0x9f26('0x63')],'predictiveIntervalAvgHoldtime':_0xf8414b[_0x9f26('0x64')],'predictiveIntervalAvgTalktime':_0xf8414b[_0x9f26('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0xf8414b['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xf8414b['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0xf8414b[_0x9f26('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0xf8414b['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xf8414b['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xf8414b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xf8414b[_0x9f26('0x67')],'predictiveIntervalAvailable':_0xf8414b[_0x9f26('0x68')],'predictiveIntervalTotalCalls':_0xf8414b[_0x9f26('0x69')],'message':_0xf8414b[_0x9f26('0x3d')],'originated':_0xf8414b[_0x9f26('0x6a')],'erlangCalls':_0xf8414b[_0x9f26('0x6b')],'erlangCallToSecond':_0xf8414b['erlangCallToSecond'],'erlangAbandonmentRate':_0xf8414b['erlangAbandonmentRate'],'erlangBusyFactor':_0xf8414b[_0x9f26('0x6c')],'startPredictive':_0xf8414b[_0x9f26('0x26')],'startProgressive':_0xf8414b[_0x9f26('0x6d')]};if(_0xf8414b[_0x9f26('0x6e')]){_0x4a241d['Trunk']={'id':_0xf8414b[_0x9f26('0x6e')]['id'],'name':_0xf8414b[_0x9f26('0x6e')]['name'],'active':_0xf8414b['Trunk'][_0x9f26('0x6f')],'callerid':_0xf8414b[_0x9f26('0x6e')][_0x9f26('0x70')]};}if(_0xf8414b[_0x9f26('0x43')]){_0x4a241d[_0x9f26('0x43')]={'id':_0xf8414b[_0x9f26('0x43')]['id'],'name':_0xf8414b['Interval'][_0x9f26('0x3f')]};}var _0x2504f=md5(JSON[_0x9f26('0x71')](_0x4a241d));if(_0xf8414b['md5']!==_0x2504f){_0xf8414b['md5']=_0x2504f;emit(util[_0x9f26('0x72')](_0x9f26('0x73'),_0x4a241d[_0x9f26('0x3f')]),_0x9f26('0x74'),_0x4a241d);}}}function emitCampaignSummary(_0x327a48){if(_0x327a48[_0x9f26('0x4d')]===_0x9f26('0x75')){emit(util['format'](_0x9f26('0x76'),_0x327a48['name']),_0x9f26('0x77'),_0x327a48);}}function checkGetDataPredictive(_0x3bdf75){if(isNotNull(_0x3bdf75)&&!_[_0x9f26('0x47')](_0x3bdf75)){loggerPredictive[_0x9f26('0x78')](_0x9f26('0x79'));loggerPredictive[_0x9f26('0x78')](_0x9f26('0x7a'),_0x3bdf75[_0x9f26('0x69')]);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x7b'),_0x3bdf75['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x7c'),_0x3bdf75[_0x9f26('0x7d')]);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x7e'),_0x3bdf75[_0x9f26('0x7f')]);loggerPredictive['info'](_0x9f26('0x80'),_0x3bdf75[_0x9f26('0x64')]);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x81'),_0x3bdf75[_0x9f26('0x65')]);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x82'));if(_0x3bdf75[_0x9f26('0x69')]>0x0){if(!_['isUndefined'](_0x3bdf75[_0x9f26('0x65')])&&_0x3bdf75[_0x9f26('0x65')]>0x0){return!![];}loggerPredictive['info'](_0x9f26('0x83'));if(!_['isUndefined'](_0x3bdf75[_0x9f26('0x64')])&&_0x3bdf75['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x9f26('0x78')](_0x9f26('0x84'));}else{loggerPredictive[_0x9f26('0x78')](_0x9f26('0x85'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x32b0fe){return function(_0x2e12ab){loggerPredictive['info'](_0x9f26('0x86'));loggerPredictive[_0x9f26('0x78')](_0x9f26('0x87'),_0x2e12ab[_0x9f26('0x6b')]);loggerPredictive[_0x9f26('0x78')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e12ab[_0x9f26('0x88')]);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x89'),_0x2e12ab[_0x9f26('0x8a')]);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x8b'),_0x2e12ab['erlangBusyFactor']);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x89'),_0x2e12ab[_0x9f26('0x8a')]);loggerPredictive[_0x9f26('0x78')]('---------------------------');_[_0x9f26('0x8c')](_0x32b0fe,_0x2e12ab);};}function getDiff(_0x2831b6){var _0x2d3198=moment()[_0x9f26('0x49')](0x0);var _0x55d1d5=moment(_0x2831b6)['milliseconds'](0x0);return _0x2d3198[_0x9f26('0x4a')](_0x55d1d5,_0x9f26('0x4b'));}function ifInterval(_0x52cd8d,_0x223f2d){if(_[_0x9f26('0x3c')](_0x223f2d)){return![];}return getDiff(_0x223f2d)<_0x52cd8d*0x3c;}function freeVariablesPredictive(_0x2a1b3e){if(isNotNull(_0x2a1b3e)){if(!_[_0x9f26('0x3c')](_0x2a1b3e[_0x9f26('0x6d')])){_0x2a1b3e['startProgressive']=undefined;loggerPredictive[_0x9f26('0x78')](_0x2a1b3e[_0x9f26('0x3f')],_0x9f26('0x8d'));}if(!_['isUndefined'](_0x2a1b3e['startPredictive'])){_0x2a1b3e[_0x9f26('0x26')]=undefined;loggerPredictive[_0x9f26('0x78')](_0x2a1b3e[_0x9f26('0x3f')],_0x9f26('0x8e'));}if(!_['isUndefined'](_0x2a1b3e[_0x9f26('0x8f')])){clearInterval(_0x2a1b3e[_0x9f26('0x8f')]);_0x2a1b3e[_0x9f26('0x8f')]=undefined;loggerPredictive[_0x9f26('0x78')](_0x2a1b3e[_0x9f26('0x3f')],_0x9f26('0x90'));}}}function erlangb(_0x19e563,_0xaeddf3){if(_0xaeddf3===0x0){return 0x0;}var _0x113c26=0x1;for(var _0xb1aae1=0x1;_0xb1aae1<=_0xaeddf3;_0xb1aae1+=0x1){_0x113c26=0x1+_0x113c26*_0xb1aae1/_0x19e563;}return 0x1/_0x113c26;}function isVoiceQueueOutbound(_0x281a61){return _0x281a61===_0x9f26('0x4e');}function isNotPreview(_0x41b63){return _0x41b63!==_0x9f26('0x1b');}function isCampaignIvr(_0x5135e8){return _0x5135e8===_0x9f26('0x75');}function getCallerId(_0x1fd65a,_0x92c215,_0x3102c0){if(!_[_0x9f26('0x3c')](_0x3102c0)&&typeof _0x3102c0===_0x9f26('0x91')&&!_['isEmpty'](_0x3102c0)){if(!_['isUndefined'](_0x92c215)&&typeof _0x92c215===_0x9f26('0x91')&&!_['isEmpty'](_0x92c215)){return util[_0x9f26('0x72')](_0x9f26('0x92'),_0x92c215,_0x3102c0);}return util[_0x9f26('0x72')]('\x22%s\x22\x20<%s>',_0x3102c0,_0x3102c0);}if(!_[_0x9f26('0x3c')](_0x1fd65a)&&typeof _0x1fd65a===_0x9f26('0x91')&&!_[_0x9f26('0x47')](_0x1fd65a)){return _0x1fd65a;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x455859,_0x412dd8){return function(_0x4655b8){freeVariablesPredictive(_0x412dd8);emitVoiceQueueSummary(_0x412dd8);emitCampaignSummary(_0x412dd8);loggerSyncQueueSummary[_0x9f26('0x93')](_0x455859,util[_0x9f26('0x94')](_0x4655b8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2d22ff,_0x56fa29){return function(_0x38bc4f){loggerPredictive['error'](_0x56fa29['name'],_0x2d22ff);loggerPredictive[_0x9f26('0x93')](_0x38bc4f[_0x9f26('0x95')]);freeVariablesPredictive(_0x56fa29);};}function loggerCatch(_0x19f44e){return function(_0x4ed0ad){logger[_0x9f26('0x93')](_0x19f44e,util[_0x9f26('0x94')](_0x4ed0ad,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x497471){return _0x497471&&!_[_0x9f26('0x3c')](_0x497471)&&_0x497471[_0x9f26('0x96')]>0x0;}function decremetOriginate(_0x9bb8c){if(!_[_0x9f26('0x3c')](_0x9bb8c)&&_0x9bb8c!==null){if(typeof _0x9bb8c[_0x9f26('0x6a')]!==_0x9f26('0x97')){if(_0x9bb8c[_0x9f26('0x6a')]>0x0){_0x9bb8c['originated']-=0x1;}else{logger['error'](_0x9f26('0x98'));}}}else{logger[_0x9f26('0x93')](_0x9f26('0x99'));}}function checkContactLowerLimitOriginate(_0x46b09c,_0x2e2637,_0x53c9fd){if(_0x2e2637>_0x53c9fd){for(var _0x24a35d=0x0;_0x24a35d<_0x2e2637-_0x53c9fd;_0x24a35d+=0x1){decremetOriginate(_0x46b09c);}}}function loggerGetContactDialer(_0x22ba17,_0x32e2bf,_0x4b8000){return function(_0x1319d5){checkContactLowerLimitOriginate(_0x32e2bf,_0x4b8000,0x0);logger['error'](_0x22ba17,util[_0x9f26('0x94')](_0x1319d5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xf02b62){return function(_0x4aaacc){if(isNotNull(_0x4aaacc)&&isNotNull(_0x4aaacc[0x0])){if(_0x4aaacc[0x0][_0x9f26('0x9a')]>0x0){_0xf02b62[_0x9f26('0x3d')]='RESCHEDULED_CONTACTS';logger[_0x9f26('0x78')](_0x9f26('0x9b')+_0xf02b62[_0x9f26('0x3f')],_0x4aaacc[0x0]['contactsRescheduled'],_0x9f26('0x9c'));}else{_0xf02b62[_0x9f26('0x3d')]=_0x9f26('0x9d');logger[_0x9f26('0x78')]('[getContactDialer2][Empty]'+_0xf02b62[_0x9f26('0x3f')]);}}};}function notSendMessagesQueue(_0x1fddb7){if(_0x1fddb7[_0x9f26('0x9e')]){freeVariablesPredictive(_0x1fddb7);if(_0x1fddb7['originated']===0x0&&_0x1fddb7[_0x9f26('0x53')]===0x0&&_0x1fddb7['waiting']===0x0&&(_0x1fddb7['pTalking']||0x0)===0x0){_0x1fddb7[_0x9f26('0x9e')]=![];_0x1fddb7['available']=0x0;_0x1fddb7[_0x9f26('0x3d')]=_0x9f26('0x41');loggerSyncQueueSummary[_0x9f26('0x93')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1fddb7['name'],'is\x20not\x20active');}else{_0x1fddb7[_0x9f26('0x3d')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x9f26('0x93')](_0x9f26('0x9f'),_0x1fddb7[_0x9f26('0x3f')],'is\x20disactive');}emitVoiceQueueSummary(_0x1fddb7);}}function notSendMessagesCampaign(_0x5c8bf7){if(_0x5c8bf7[_0x9f26('0x9e')]){if(_0x5c8bf7[_0x9f26('0x6a')]===0x0){_0x5c8bf7[_0x9f26('0x9e')]=![];_0x5c8bf7['message']=_0x9f26('0x41');loggerSyncQueueSummary['error'](_0x9f26('0xa0'),_0x5c8bf7[_0x9f26('0x3f')],_0x9f26('0xa1'));}else{_0x5c8bf7['message']=_0x9f26('0xa2');loggerSyncQueueSummary[_0x9f26('0x93')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5c8bf7['name'],_0x9f26('0xa3'));}emitCampaignSummary(_0x5c8bf7);}}function createObjHistory(_0x16d8ca,_0x5c49dd,_0x404e63,_0x4f6c42,_0x33b211){_0x16d8ca[_0x9f26('0x3d')]=_0x404e63;var _0x591713=new Action(_0x16d8ca,_0x5c49dd);var _0x136b86=new History(_0x591713);_0x136b86[_0x9f26('0xa4')]=_0x4f6c42;_0x136b86[_0x9f26('0xa5')]=_0x33b211;_0x136b86['endtime']=_0x591713[_0x9f26('0xa6')];return _0x136b86;}Dialer['prototype'][_0x9f26('0x3b')]=function(){var _0x3d8915=this;setInterval(function(){_0x3d8915[_0x9f26('0xa7')](_0x3d8915[_0x9f26('0x24')],_0x9f26('0xa8'));_0x3d8915['clearZombieChannels'](_0x3d8915[_0x9f26('0x22')],_0x9f26('0xa9'));},0x32c8);};Dialer[_0x9f26('0x17')][_0x9f26('0xa7')]=function(_0x21b552,_0x5abc1a){var _0x168854=this;for(var _0x173e12 in _0x21b552){if(typeof _0x21b552[_0x173e12]!==_0x9f26('0x97')){this['sequence'][_0x9f26('0x18')](function(){if(!_[_0x9f26('0xaa')](_0x21b552[_0x173e12])){return ami[_0x9f26('0xab')]({'action':_0x9f26('0xac'),'channel':_0x21b552[_0x173e12][_0x9f26('0xad')]})[_0x9f26('0xae')](function(_0x53364e){if(_0x53364e[_0x9f26('0x3d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x21b552[_0x173e12]&&_0x21b552[_0x173e12][_0x9f26('0x4d')]!==_0x9f26('0x75')){_0x168854[_0x9f26('0xaf')](_0x168854[_0x9f26('0x1c')][_0x21b552[_0x173e12][_0x9f26('0xb0')]]);logger[_0x9f26('0x93')](_0x9f26('0xb1'),_0x5abc1a,_0x173e12,_0x21b552[_0x173e12][_0x9f26('0xb0')]);delete _0x21b552[_0x173e12];}if(_0x21b552[_0x173e12]&&_0x21b552[_0x173e12][_0x9f26('0x4d')]===_0x9f26('0x75')){_0x168854[_0x9f26('0xaf')](_0x168854['campaigns'][_0x21b552[_0x173e12]['queue']]);logger[_0x9f26('0x93')](_0x9f26('0xb2'),_0x5abc1a,_0x173e12,_0x21b552[_0x173e12][_0x9f26('0xb0')]);delete _0x21b552[_0x173e12];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x43ba7b){return BPromise[_0x9f26('0xb3')]()[_0x9f26('0xb4')](cmHopper['countReScheduled'](_0x43ba7b))[_0x9f26('0xae')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x9f26('0x17')]['checkIsBlackList']=function(_0x3e6684){return BPromise[_0x9f26('0xb3')]()[_0x9f26('0xb4')](cmHopperBlack[_0x9f26('0xb5')](_0x3e6684))[_0x9f26('0xae')](loggerCatch(_0x9f26('0xb6')));};Dialer['prototype'][_0x9f26('0xb7')]=function(_0x2a7557){return BPromise[_0x9f26('0xb3')]()['then'](cmHopperBlack[_0x9f26('0xb7')](_0x2a7557))[_0x9f26('0xae')](loggerCatch(_0x9f26('0xb8')));};Dialer['prototype'][_0x9f26('0xb9')]=function(_0x35e6bf){return BPromise[_0x9f26('0xb3')]()['then'](cmHopperHistory[_0x9f26('0xba')](_0x35e6bf))[_0x9f26('0xae')](loggerCatch(_0x9f26('0xbb')));};Dialer[_0x9f26('0x17')]['rescheduleContact']=function(_0x570175){return BPromise['resolve']()[_0x9f26('0xb4')](cmHopper[_0x9f26('0xbc')](_0x570175))[_0x9f26('0xae')](loggerCatch(_0x9f26('0xbd')));};Dialer['prototype'][_0x9f26('0xbe')]=function(_0x303053,_0x482565,_0x309b6f){return BPromise[_0x9f26('0xb3')]()[_0x9f26('0xb4')](cmHopper[_0x9f26('0xbe')](_0x303053,_0x482565,_0x309b6f))[_0x9f26('0xae')](loggerCatch(_0x9f26('0xbf')));};Dialer['prototype'][_0x9f26('0xc0')]=function(_0x2f115d,_0x2df81f,_0x581981,_0x27a1ec){return BPromise['resolve']()[_0x9f26('0xb4')](cmHopper['getContactDialer'](_0x2f115d,_0x2df81f,_0x581981,_0x27a1ec))[_0x9f26('0xae')](loggerCatch(_0x9f26('0xc1')));};Dialer[_0x9f26('0x17')][_0x9f26('0xc2')]=function(_0x69470a,_0x1b3359,_0x2044b9){return BPromise[_0x9f26('0xb3')]()['then'](cmHopper['getContactDialerIvr'](_0x69470a,_0x1b3359,_0x2044b9))[_0x9f26('0xae')](loggerCatch(_0x9f26('0xc1')));};Dialer['prototype'][_0x9f26('0xc3')]=function(_0x407740){return BPromise[_0x9f26('0xb3')]()[_0x9f26('0xb4')](voiceQueueRt[_0x9f26('0xc3')](_0x407740))[_0x9f26('0xae')](loggerCatch(_0x9f26('0xc4')));};Dialer[_0x9f26('0x17')]['moveContactManagedDialer']=function(_0x5a250d){return BPromise[_0x9f26('0xb3')]()['then'](cmHopper['moveContactManagedDialer'](_0x5a250d))[_0x9f26('0xae')](loggerCatch(_0x9f26('0xc5')));};Dialer[_0x9f26('0x17')][_0x9f26('0xc6')]=function(_0xdff1ad){return BPromise['resolve']()[_0x9f26('0xb4')](cmHopperHistory['createHistory'](_0xdff1ad))[_0x9f26('0xae')](loggerCatch(_0x9f26('0xc7')));};Dialer[_0x9f26('0x17')][_0x9f26('0xaf')]=function(_0x586136){if(!_[_0x9f26('0x3c')](_0x586136)&&_0x586136!==null){if(typeof _0x586136[_0x9f26('0x6a')]!=='undefined'){if(_0x586136['originated']>0x0){_0x586136[_0x9f26('0x6a')]-=0x1;}else{logger[_0x9f26('0x93')](_0x9f26('0xc8'));}}}else{logger['error'](_0x9f26('0xc9'));}};Dialer[_0x9f26('0x17')][_0x9f26('0xca')]=function(_0x322427,_0x3a4f63){var _0x4ee915=this;return function(_0x592565){_0x4ee915[_0x9f26('0xaf')](_0x3a4f63);logger[_0x9f26('0x93')](_0x322427,util[_0x9f26('0x94')](_0x592565,{'showHidden':![],'depth':null}));};};Dialer[_0x9f26('0x17')][_0x9f26('0xcb')]=function(_0x121968,_0x4d78f8,_0x9250ad){var _0x4aa68f={'state':0x19,'statedesc':_0x9f26('0xcc')};this[_0x9f26('0xaf')](_0x4d78f8);this[_0x9f26('0xcd')](_['merge'](_0x4aa68f,_[_0x9f26('0xce')](_0x9250ad,[_0x9f26('0xcf'),_0x9f26('0xd0'),'UserId',_0x9f26('0xd1'),_0x9f26('0xd2')])),_0x9f26('0xd3'),_0x9f26('0xd4'));logger[_0x9f26('0x93')](_0x121968);};Dialer['prototype'][_0x9f26('0xd5')]=function(_0x148cca){return _0x148cca===_0x9f26('0xd6');};Dialer['prototype'][_0x9f26('0xd7')]=function(_0x3e16d5){return!_['isUndefined'](_0x3e16d5)&&_0x3e16d5&&!_[_0x9f26('0x3c')](_0x3e16d5[_0x9f26('0x3f')])&&!_[_0x9f26('0x3c')](_0x3e16d5[_0x9f26('0x6f')])&&_0x3e16d5['active']&&(this['trunks'][util['format']('SIP/%s',_0x3e16d5[_0x9f26('0x3f')])][_0x9f26('0xac')]===_0x9f26('0xd8')||this[_0x9f26('0x1f')][util[_0x9f26('0x72')](_0x9f26('0xd9'),_0x3e16d5[_0x9f26('0x3f')])][_0x9f26('0xac')]==='unmonitored');};Dialer[_0x9f26('0x17')][_0x9f26('0xcd')]=function(_0x1c2111,_0x4782f5,_0x43b94d){this[_0x9f26('0xc6')](_0x1c2111)['catch'](loggerCatch(_0x4782f5));this[_0x9f26('0xda')](_0x1c2111)[_0x9f26('0xae')](loggerCatch(_0x43b94d));};Dialer[_0x9f26('0x17')][_0x9f26('0xdb')]=function(_0xbbdce1){var _0x42c2df=this[_0x9f26('0x24')][_0xbbdce1[_0x9f26('0xdc')]];var _0x12ab33;if(!_[_0x9f26('0xaa')](_0xbbdce1)&&!_['isNil'](_0xbbdce1[_0x9f26('0xdd')])&&!_[_0x9f26('0xaa')](_0xbbdce1[_0x9f26('0xdd')][_0x9f26('0xde')])&&_0xbbdce1['exten']===_0x9f26('0xdf')&&_0x42c2df){if(_0x42c2df['type']!==_0x9f26('0x75')&&this[_0x9f26('0x1c')][_0x42c2df[_0x9f26('0xb0')]]['dialAMDActive']&&_0xbbdce1['value']===_0x9f26('0xe0')){delete this[_0x9f26('0x24')][_0xbbdce1[_0x9f26('0xdc')]];this[_0x9f26('0xaf')](this[_0x9f26('0x1c')][_0x42c2df[_0x9f26('0xb0')]]);this[_0x9f26('0x1c')][_0x42c2df[_0x9f26('0xb0')]][_0x9f26('0x5c')]+=0x1;this[_0x9f26('0x1c')][_0x42c2df[_0x9f26('0xb0')]][_0x9f26('0x5b')]+=0x1;_0x12ab33=new Hangup(_0x42c2df,_0xbbdce1);_0x12ab33[_0x9f26('0xa4')]=0x12;_0x12ab33[_0x9f26('0xa5')]=_0x9f26('0xe1');_0x12ab33['membername']='AMD';ami['emit'](_0x9f26('0xe2'),ut[_0x9f26('0xe3')](_0x12ab33,_0x9f26('0xe4')));this[_0x9f26('0xcd')](_0x12ab33,_0x9f26('0xe5'),_0x9f26('0xe6'));}if(_0x42c2df[_0x9f26('0x4d')]!==_0x9f26('0x75')&&this[_0x9f26('0x1c')][_0x42c2df['queue']][_0x9f26('0xe7')]&&_0xbbdce1[_0x9f26('0xe8')]==='MACHINE'){var _0x531ad7=this;return new BPromise(function(_0x4d9285,_0x25bdc9){delete _0x531ad7['uniqueId'][_0xbbdce1[_0x9f26('0xdc')]];_0x531ad7[_0x9f26('0xaf')](_0x531ad7['voiceQueues'][_0x42c2df[_0x9f26('0xb0')]]);_0x531ad7['voiceQueues'][_0x42c2df[_0x9f26('0xb0')]][_0x9f26('0x5c')]+=0x1;_0x531ad7[_0x9f26('0x1c')][_0x42c2df[_0x9f26('0xb0')]][_0x9f26('0x5b')]+=0x1;var _0x2ef54c=_0x531ad7[_0x9f26('0x1c')][_0x42c2df['queue']];var _0x424038=new Hangup(_0x42c2df,_0xbbdce1);_0x424038[_0x9f26('0xa4')]=0x13;_0x424038['statedesc']=_0x9f26('0xe9');_0x424038['membername']='AMD';_0x424038[_0x9f26('0xea')]+=0x1;_0x424038[_0x9f26('0xeb')]+=0x1;_0x424038[_0x9f26('0xe4')]=!![];ami[_0x9f26('0x4c')](_0x9f26('0xe2'),ut[_0x9f26('0xe3')](_0x424038,'amd'));_0x531ad7[_0x9f26('0xc6')](_0x424038)[_0x9f26('0xae')](loggerCatch(_0x9f26('0xec')));if(_0x424038[_0x9f26('0xed')]+_0x424038['countcongestionretry']+_0x424038['countnoanswerretry']+_0x424038[_0x9f26('0xee')]+_0x424038[_0x9f26('0xef')]+_0x424038['countabandonedretry']+_0x424038[_0x9f26('0xea')]+_0x424038[_0x9f26('0xf0')]>=_0x2ef54c[_0x9f26('0xf1')]){_0x531ad7[_0x9f26('0xf2')](_0x424038,_0x4d9285,_0x25bdc9,_0x9f26('0xf3'));}else{if(_0x424038[_0x9f26('0xea')]>=_0x2ef54c[_0x9f26('0xf4')]){_0x531ad7['createStateFinal'](_0x424038,_0x4d9285,_0x25bdc9,_0x9f26('0xf5'));}else{_0x531ad7[_0x9f26('0xbc')]({'active':![],'countmachineretry':_0x424038[_0x9f26('0xea')],'scheduledat':moment()[_0x9f26('0xf6')](_0x2ef54c['dialMachineRetryFrequency'],_0x9f26('0xf7'))[_0x9f26('0x72')](_0x9f26('0xf8')),'ContactId':_0x424038[_0x9f26('0xcf')],'ListId':_0x424038['ListId'],'VoiceQueueId':_0x424038[_0x9f26('0xd1')]||undefined,'CampaignId':_0x424038[_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch('[rescheduleContact][Machine]'));_0x4d9285({'reschedule':0x1});}}});}if(_0x42c2df[_0x9f26('0x4d')]===_0x9f26('0x75')&&this[_0x9f26('0x1d')][_0x42c2df['queue']][_0x9f26('0xe7')]&&_0xbbdce1[_0x9f26('0xe8')]===_0x9f26('0xe0')){delete this['uniqueId'][_0xbbdce1[_0x9f26('0xdc')]];this[_0x9f26('0xaf')](this[_0x9f26('0x1d')][_0x42c2df[_0x9f26('0xb0')]]);_0x12ab33=new Hangup(_0x42c2df,_0xbbdce1);_0x12ab33[_0x9f26('0xa4')]=0x12;_0x12ab33[_0x9f26('0xa5')]=_0x9f26('0xe1');_0x12ab33[_0x9f26('0xf9')]='AMD';ami[_0x9f26('0x4c')](_0x9f26('0xe2'),ut[_0x9f26('0xe3')](_0x12ab33,_0x9f26('0xe4')));this['saveInDb'](_0x12ab33,_0x9f26('0xfa'),_0x9f26('0xfb'));}if(_0x42c2df['type']===_0x9f26('0x75')&&this['campaigns'][_0x42c2df['queue']][_0x9f26('0xe7')]&&_0xbbdce1[_0x9f26('0xe8')]===_0x9f26('0xfc')){var _0x531ad7=this;return new BPromise(function(_0x4beeae,_0x1c881d){delete _0x531ad7[_0x9f26('0x24')][_0xbbdce1[_0x9f26('0xdc')]];_0x531ad7[_0x9f26('0xaf')](_0x531ad7[_0x9f26('0x1d')][_0x42c2df[_0x9f26('0xb0')]]);_0x531ad7[_0x9f26('0x1d')][_0x42c2df[_0x9f26('0xb0')]][_0x9f26('0x5c')]+=0x1;_0x531ad7[_0x9f26('0x1d')][_0x42c2df[_0x9f26('0xb0')]][_0x9f26('0x5b')]+=0x1;var _0x374829=_0x531ad7[_0x9f26('0x1d')][_0x42c2df['queue']];var _0x735fca=new Hangup(_0x42c2df,_0xbbdce1);_0x735fca[_0x9f26('0xa4')]=0x13;_0x735fca[_0x9f26('0xa5')]=_0x9f26('0xe9');_0x735fca['membername']=_0x9f26('0xfd');_0x735fca['countmachineretry']+=0x1;_0x735fca[_0x9f26('0xeb')]+=0x1;_0x735fca['amd']=!![];ami[_0x9f26('0x4c')](_0x9f26('0xe2'),ut['buildObj'](_0x735fca,_0x9f26('0xe4')));_0x531ad7[_0x9f26('0xc6')](_0x735fca)[_0x9f26('0xae')](loggerCatch(_0x9f26('0xec')));if(_0x735fca['countbusyretry']+_0x735fca[_0x9f26('0xfe')]+_0x735fca[_0x9f26('0xff')]+_0x735fca[_0x9f26('0xee')]+_0x735fca['countdropretry']+_0x735fca['countabandonedretry']+_0x735fca[_0x9f26('0xea')]+_0x735fca[_0x9f26('0xf0')]>=_0x374829['dialGlobalMaxRetry']){_0x531ad7[_0x9f26('0xf2')](_0x735fca,_0x4beeae,_0x1c881d,_0x9f26('0xf3'));}else{if(_0x735fca[_0x9f26('0xea')]>=_0x374829[_0x9f26('0xf4')]){_0x531ad7['createStateFinal'](_0x735fca,_0x4beeae,_0x1c881d,_0x9f26('0xf5'));}else{_0x531ad7[_0x9f26('0xbc')]({'active':![],'countmachineretry':_0x735fca['countmachineretry'],'scheduledat':moment()['add'](_0x374829[_0x9f26('0x100')],_0x9f26('0xf7'))[_0x9f26('0x72')](_0x9f26('0xf8')),'ContactId':_0x735fca[_0x9f26('0xcf')],'ListId':_0x735fca[_0x9f26('0xd0')],'VoiceQueueId':_0x735fca[_0x9f26('0xd1')]||undefined,'CampaignId':_0x735fca[_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch(_0x9f26('0x101')));_0x4beeae({'reschedule':0x1});}}});}}};Dialer[_0x9f26('0x17')]['syncHangup']=function(_0x45edcd){var _0x5c0e7a=this['uniqueId'][_0x45edcd[_0x9f26('0xdc')]];var _0x2f7204=this;var _0x2f804b;if(_0x5c0e7a&&_0x5c0e7a['type']===_0x9f26('0x75')){delete this[_0x9f26('0x24')][_0x45edcd['uniqueid']];this['updateOriginated'](this[_0x9f26('0x1d')][_0x5c0e7a['queue']]);this['campaigns'][_0x5c0e7a[_0x9f26('0xb0')]][_0x9f26('0x102')]+=0x1;_0x2f804b=new Hangup(_0x5c0e7a,_0x45edcd);this[_0x9f26('0xc6')](_0x2f804b)[_0x9f26('0xae')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x9f26('0xda')](_0x2f804b)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x103')));}if(_0x5c0e7a&&_0x5c0e7a[_0x9f26('0x4d')]!==_0x9f26('0x75')&&isNotNull(this['voiceQueues'][_0x5c0e7a[_0x9f26('0xb0')]][_0x9f26('0x104')])){delete this[_0x9f26('0x24')][_0x45edcd[_0x9f26('0xdc')]];this[_0x9f26('0xaf')](this[_0x9f26('0x1c')][_0x5c0e7a[_0x9f26('0xb0')]]);this[_0x9f26('0x1c')][_0x5c0e7a[_0x9f26('0xb0')]][_0x9f26('0x5c')]+=0x1;this[_0x9f26('0x1c')][_0x5c0e7a[_0x9f26('0xb0')]][_0x9f26('0x5b')]+=0x1;_0x2f804b=new Hangup(_0x5c0e7a,_0x45edcd);_0x2f804b['state']=0x10;_0x2f804b[_0x9f26('0xa5')]=_0x9f26('0x105');_0x2f804b['membername']=_0x9f26('0x106');this['createHistory'](_0x2f804b)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x107')));this[_0x9f26('0xda')](_0x2f804b)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x103')));}if(_0x5c0e7a&&_0x5c0e7a[_0x9f26('0x4d')]!=='ivr'&&!isNotNull(this[_0x9f26('0x1c')][_0x5c0e7a[_0x9f26('0xb0')]]['dialQueueProject'])){delete this[_0x9f26('0x24')][_0x45edcd[_0x9f26('0xdc')]];this[_0x9f26('0xaf')](this[_0x9f26('0x1c')][_0x5c0e7a[_0x9f26('0xb0')]]);this[_0x9f26('0x1c')][_0x5c0e7a['queue']][_0x9f26('0x108')]+=0x1;_0x2f804b=new Hangup(_0x5c0e7a,_0x45edcd);_0x2f804b[_0x9f26('0xa4')]=0xc;_0x2f804b[_0x9f26('0xa5')]=_0x45edcd[_0x9f26('0x109')];_0x2f804b[_0x9f26('0xf9')]='Unknow';this[_0x9f26('0xc6')](_0x2f804b)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x107')));this[_0x9f26('0xda')](_0x2f804b)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x103')));}};Dialer['prototype']['syncAgentComplete']=function(_0x35c288){var _0x393dfb=this[_0x9f26('0x24')][_0x35c288['uniqueid']];var _0x48ea62=this;if(this[_0x9f26('0x1c')][_0x35c288[_0x9f26('0xb0')]]){if(_0x393dfb&&_0x393dfb[_0x9f26('0x4d')]!==_0x9f26('0x75')){delete this[_0x9f26('0x24')][_0x35c288[_0x9f26('0xdc')]];this[_0x9f26('0x1c')][_0x35c288[_0x9f26('0xb0')]][_0x9f26('0x5c')]+=0x1;var _0x15b9f5=new AgentComplete(_0x393dfb,_0x35c288);if(_0x35c288[_0x9f26('0x10a')]===_0x9f26('0x10b')){_0x15b9f5[_0x9f26('0x10c')]=this[_0x9f26('0x1c')][_0x35c288[_0x9f26('0xb0')]][_0x9f26('0x10d')]&&this[_0x9f26('0x1c')][_0x35c288[_0x9f26('0xb0')]][_0x9f26('0x10e')]?moment()[_0x9f26('0x72')](_0x9f26('0xf8')):undefined;}this['createHistory'](_0x15b9f5)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x10f')));this[_0x9f26('0xda')](_0x15b9f5)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x110')));}}};Dialer[_0x9f26('0x17')][_0x9f26('0x2b')]=function(_0x292b0e){if(this[_0x9f26('0x1c')][_0x292b0e[_0x9f26('0xb0')]]){if(this['uniqueId'][_0x292b0e[_0x9f26('0xdc')]]&&this[_0x9f26('0x24')][_0x292b0e[_0x9f26('0xdc')]][_0x9f26('0x4d')]!==_0x9f26('0x75')){this['updateOriginated'](this[_0x9f26('0x1c')][_0x292b0e[_0x9f26('0xb0')]]);this['uniqueId'][_0x292b0e[_0x9f26('0xdc')]][_0x9f26('0x111')]=moment()[_0x9f26('0x72')](_0x9f26('0xf8'));}}};Dialer['prototype'][_0x9f26('0x112')]=function(_0xfa7702){this[_0x9f26('0xc6')](_0xfa7702)[_0x9f26('0xae')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x9f26('0xda')](_0xfa7702)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x113')));};Dialer[_0x9f26('0x17')][_0x9f26('0x2e')]=function(_0xd83cde){var _0x18c8a3=this[_0x9f26('0x24')][_0xd83cde[_0x9f26('0xdc')]];var _0x1c58db=this;if(this[_0x9f26('0x1c')][_0xd83cde['queue']]){if(_0x18c8a3&&_0x18c8a3['type']!==_0x9f26('0x75')){delete this[_0x9f26('0x24')][_0xd83cde[_0x9f26('0xdc')]];this[_0x9f26('0xaf')](this[_0x9f26('0x1c')][_0xd83cde[_0x9f26('0xb0')]]);_0x18c8a3[_0x9f26('0x114')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x377209=new QueueCallerAbandon(_0x18c8a3,_0xd83cde);if(getSeconds(_0x18c8a3['droptime'],_0x18c8a3[_0x9f26('0x115')])>=_0x18c8a3['dialQueueTimeout']){this['voiceQueues'][_0xd83cde[_0x9f26('0xb0')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x9f26('0x1c')][_0xd83cde[_0x9f26('0xb0')]][_0x9f26('0x61')]+=0x1;this[_0x9f26('0x1c')][_0xd83cde['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x377209[_0x9f26('0xa4')]=0xa;_0x377209[_0x9f26('0xa5')]=_0x9f26('0x116');_0x377209[_0x9f26('0x117')]='TIMEOUT';_0x377209[_0x9f26('0x10c')]=this[_0x9f26('0x1c')][_0xd83cde[_0x9f26('0xb0')]][_0x9f26('0x10d')]?moment()['format'](_0x9f26('0xf8')):undefined;_0x377209[_0x9f26('0xef')]+=0x1;_0x377209[_0x9f26('0xeb')]+=0x1;if(_0x377209[_0x9f26('0xef')]>=this[_0x9f26('0x1c')][_0xd83cde[_0x9f26('0xb0')]][_0x9f26('0x118')]){this[_0x9f26('0x112')](_0x377209);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x377209['countdropretry'],'scheduledat':moment()['add'](this[_0x9f26('0x1c')][_0xd83cde[_0x9f26('0xb0')]][_0x9f26('0x119')],_0x9f26('0xf7'))[_0x9f26('0x72')](_0x9f26('0xf8')),'ContactId':_0x18c8a3[_0x9f26('0xcf')],'ListId':_0x18c8a3['ListId'],'VoiceQueueId':_0x18c8a3[_0x9f26('0xd1')]||undefined,'CampaignId':_0x18c8a3['CampaignId']||undefined})['catch'](loggerCatch(_0x9f26('0x11a')));var _0x3de79e=new History(_0x377209);_0x3de79e[_0x9f26('0xa4')]=0xa;_0x3de79e[_0x9f26('0xa5')]=_0x9f26('0x116');_0x3de79e['starttime']=moment()[_0x9f26('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x3de79e['endtime']=_0x3de79e[_0x9f26('0xa6')];_0x3de79e[_0x9f26('0x11b')]=_0x377209['calleridname'];_0x3de79e[_0x9f26('0x11c')]=_0x377209[_0x9f26('0x11c')];this[_0x9f26('0xc6')](_0x3de79e)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x11d')));}}else{this[_0x9f26('0x1c')][_0xd83cde['queue']][_0x9f26('0x7f')]+=0x1;this[_0x9f26('0x1c')][_0xd83cde[_0x9f26('0xb0')]][_0x9f26('0x60')]+=0x1;_0x377209[_0x9f26('0xa4')]=0xb;_0x377209['statedesc']=_0x9f26('0x11e');_0x377209[_0x9f26('0x117')]='CALLEREXIT';_0x377209[_0x9f26('0x11f')]+=0x1;_0x377209[_0x9f26('0xeb')]+=0x1;if(_0x377209[_0x9f26('0x11f')]>=this[_0x9f26('0x1c')][_0xd83cde[_0x9f26('0xb0')]][_0x9f26('0x120')]){this[_0x9f26('0x112')](_0x377209);}else{this[_0x9f26('0xbc')]({'active':![],'countabandonedretry':_0x377209[_0x9f26('0x11f')],'scheduledat':moment()[_0x9f26('0xf6')](this['voiceQueues'][_0xd83cde[_0x9f26('0xb0')]][_0x9f26('0x121')],_0x9f26('0xf7'))[_0x9f26('0x72')](_0x9f26('0xf8')),'ContactId':_0x18c8a3[_0x9f26('0xcf')],'ListId':_0x18c8a3[_0x9f26('0xd0')],'VoiceQueueId':_0x18c8a3['VoiceQueueId']||undefined,'CampaignId':_0x18c8a3['CampaignId']||undefined})[_0x9f26('0xae')](loggerCatch(_0x9f26('0x122')));var _0x3de79e=new History(_0x377209);_0x3de79e[_0x9f26('0xa4')]=0xb;_0x3de79e[_0x9f26('0xa5')]=_0x9f26('0x11e');_0x3de79e[_0x9f26('0xa6')]=moment()['format'](_0x9f26('0xf8'));_0x3de79e[_0x9f26('0x123')]=_0x3de79e[_0x9f26('0xa6')];_0x3de79e[_0x9f26('0x11b')]=_0x377209[_0x9f26('0x11b')];_0x3de79e[_0x9f26('0x11c')]=_0x377209[_0x9f26('0x11c')];this[_0x9f26('0xc6')](_0x3de79e)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x124')));}}}}};Dialer[_0x9f26('0x17')][_0x9f26('0x125')]=function(_0x33023d){if(this[_0x9f26('0x22')][_0x33023d[_0x9f26('0xdc')]]){this[_0x9f26('0x22')][_0x33023d[_0x9f26('0xdc')]]['channel']=_0x33023d[_0x9f26('0xad')];}if(this[_0x9f26('0x24')][_0x33023d[_0x9f26('0xdc')]]){this[_0x9f26('0x24')][_0x33023d[_0x9f26('0xdc')]][_0x9f26('0xad')]=_0x33023d[_0x9f26('0xad')];}};Dialer[_0x9f26('0x17')][_0x9f26('0x37')]=function(_0x398950){if(strategy[this[_0x9f26('0x1c')][this[_0x9f26('0x22')][_0x398950[_0x9f26('0x126')]]['queue']][_0x9f26('0x127')]]===_0x9f26('0x128')){if(this['actions'][_0x398950['actionid']]&&_[_0x9f26('0xaa')](this[_0x9f26('0x22')][_0x398950[_0x9f26('0x126')]][_0x9f26('0x129')])&&_0x398950[_0x9f26('0xac')]==='1'&&_0x398950[_0x9f26('0x12a')]==='0'){if(this['agents'][_0x398950['stateinterface']]){if(!this[_0x9f26('0x1e')][_0x398950[_0x9f26('0x12b')]]['locked']){this[_0x9f26('0x1e')][_0x398950[_0x9f26('0x12b')]]['locked']=!![];this['actions'][_0x398950[_0x9f26('0x126')]][_0x9f26('0x129')]=!![];this[_0x9f26('0x22')][_0x398950[_0x9f26('0x126')]][_0x9f26('0x12b')]=_0x398950[_0x9f26('0x12b')];}}}}else if((strategy[this[_0x9f26('0x1c')][this[_0x9f26('0x22')][_0x398950[_0x9f26('0x126')]][_0x9f26('0xb0')]][_0x9f26('0x127')]]||_0x9f26('0x16'))===_0x9f26('0x16')){if(this[_0x9f26('0x22')][_0x398950[_0x9f26('0x126')]]){if(this[_0x9f26('0x1e')][_0x398950['stateinterface']]){this[_0x9f26('0x22')][_0x398950[_0x9f26('0x126')]][_0x9f26('0x12b')]=_0x398950[_0x9f26('0x12b')];if(_[_0x9f26('0xaa')](this[_0x9f26('0x28')][this[_0x9f26('0x22')][_0x398950[_0x9f26('0x126')]][_0x9f26('0xb0')]])){this[_0x9f26('0x28')][this[_0x9f26('0x22')][_0x398950['actionid']][_0x9f26('0xb0')]]=[];}this[_0x9f26('0x28')][this['actions'][_0x398950[_0x9f26('0x126')]][_0x9f26('0xb0')]][_0x9f26('0x12c')](_[_0x9f26('0x8c')](_[_0x9f26('0xce')](this[_0x9f26('0x22')][_0x398950['actionid']],[_0x9f26('0x12d'),_0x9f26('0x12b')]),{'status':_0x398950['status'],'paused':_0x398950[_0x9f26('0x12a')]}));}}}};function unlockQueueStatus(_0x4139a0,_0x233ce0){setTimeout(function(){if(_[_0x9f26('0x3c')](_0x4139a0[_0x9f26('0x12e')])){loggerBooked[_0x9f26('0x93')](_0x9f26('0x12f'),_0x233ce0);}_0x4139a0[_0x9f26('0x12e')]=!![];loggerBooked[_0x9f26('0x78')](_0x9f26('0x130'),_0x233ce0,JSON[_0x9f26('0x71')](_[_0x9f26('0xce')](_0x4139a0,[_0x9f26('0x3f'),_0x9f26('0x12e')])));},0x1f3);}Dialer['prototype'][_0x9f26('0x39')]=function(_0x212428){var _0x3f6591=this;var _0x39c3aa=_0x3f6591['voiceQueues'][_0x3f6591[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]][_0x9f26('0xb0')]];if(strategy[this[_0x9f26('0x1c')][this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]][_0x9f26('0xb0')]]['strategy']]===_0x9f26('0x128')){if(this[_0x9f26('0x22')][_0x212428['actionid']]&&this['actions'][_0x212428[_0x9f26('0x126')]][_0x9f26('0x12b')]){this[_0x9f26('0x1b')][_0x9f26('0x131')](this[_0x9f26('0x22')][_0x212428['actionid']][_0x9f26('0x12d')],this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]][_0x9f26('0x12b')])[_0x9f26('0xae')](function(_0x4ea38f){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x9f26('0x94')](_0x4ea38f,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3f6591[_0x9f26('0xaf')](_0x3f6591[_0x9f26('0x1c')][_0x3f6591['actions'][_0x212428[_0x9f26('0x126')]][_0x9f26('0xb0')]]);_0x3f6591[_0x9f26('0x1e')][_0x3f6591[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]]['stateinterface']][_0x9f26('0x129')]=![];delete _0x3f6591[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]];unlockQueueStatus(_0x39c3aa);});}else{this[_0x9f26('0xaf')](this['voiceQueues'][this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]][_0x9f26('0xb0')]]);this[_0x9f26('0xbc')]({'active':![],'ContactId':this['actions'][_0x212428[_0x9f26('0x126')]][_0x9f26('0xcf')],'ListId':this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]][_0x9f26('0xd0')],'VoiceQueueId':this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]][_0x9f26('0xd1')]||undefined,'CampaignId':this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]]['CampaignId']||undefined})['catch'](loggerCatch(_0x9f26('0x132')));delete this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]];unlockQueueStatus(_0x39c3aa);}}else if((strategy[this[_0x9f26('0x1c')][this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]]['queue']][_0x9f26('0x127')]]||_0x9f26('0x16'))===_0x9f26('0x16')){var _0x5adc60;if(this[_0x9f26('0x22')][_0x212428['actionid']]&&!_[_0x9f26('0x47')](this[_0x9f26('0x28')][this[_0x9f26('0x22')][_0x212428['actionid']]['queue']])){if(this['queueBookedRR'][_0x3f6591[_0x9f26('0x22')][_0x212428['actionid']][_0x9f26('0xb0')]]){this[_0x9f26('0x29')][_0x3f6591[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]][_0x9f26('0xb0')]]=this[_0x9f26('0x29')][this[_0x9f26('0x22')][_0x212428['actionid']][_0x9f26('0xb0')]]?this[_0x9f26('0x29')][this['actions'][_0x212428[_0x9f26('0x126')]][_0x9f26('0xb0')]]:this[_0x9f26('0x28')][this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]][_0x9f26('0xb0')]]?this[_0x9f26('0x28')][this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]][_0x9f26('0xb0')]][_0x9f26('0x133')]||0x0:0x0;}this[_0x9f26('0x28')][this['actions'][_0x212428['actionid']][_0x9f26('0xb0')]][_0x9f26('0x133')]=this[_0x9f26('0x29')][this[_0x9f26('0x22')][_0x212428[_0x9f26('0x126')]][_0x9f26('0xb0')]];for(var _0x21e01a=0x0;_0x21e01a=0x0;})['catch'](myreject(_0x5362db)));}}else{_0x55a87f[_0x9f26('0x12c')](ami['Action']({'action':_0x9f26('0x147'),'command':util[_0x9f26('0x72')](_0x9f26('0x148'),_0x2eb778,!_[_0x9f26('0x3c')](config[_0x9f26('0x144')][_0x5b233f])?_0x5b233f:'')})[_0x9f26('0xb4')](function(_0x2b372e){return _0x2b372e[_0x9f26('0x149')][_0x9f26('0x14a')](_0x9f26('0x14b'))>=0x0;})['catch'](myreject(_0x5362db)));}BPromise[_0x9f26('0x14c')](_0x55a87f)[_0x9f26('0xb4')](function(_0x48da6e){var _0x11075c=_[_0x9f26('0x14d')](_0x48da6e);if(_0x11075c){return _0x30daeb(_0x11075c);}else{_0x4be60d['message']=_0x2e71a5?'GLOBAL_INTERVAL_IS_OVERTIME':_0x9f26('0x14e');return _0x5362db(msgResponse(_0x9f26('0x14f'),_0x9f26('0x141'),_0x9f26('0x150')+_0x2e71a5+'\x20'+_0x4b8015+_0x9f26('0x151')+util[_0x9f26('0x94')](_0x2eb778,{'showHidden':![],'depth':null})+_0x9f26('0x152')+_0x5b233f));}})[_0x9f26('0xae')](function(_0x295d8b){return _0x5362db(msgResponse(_0x9f26('0x140'),'Failure',JSON[_0x9f26('0x71')](_0x295d8b)));});});};Dialer[_0x9f26('0x17')][_0x9f26('0x153')]=function(_0x36a5a5){var _0x3da9ed=this;return function(){switch(_0x36a5a5['dialMethod']){case _0x9f26('0x154'):freeVariablesPredictive(_0x36a5a5);_0x3da9ed[_0x9f26('0x155')](_0x36a5a5,0x1);break;case _0x9f26('0x156'):freeVariablesPredictive(_0x36a5a5);_0x3da9ed['handlePower'](_0x36a5a5,_0x36a5a5[_0x9f26('0x157')]);break;case _0x9f26('0x9'):_0x3da9ed[_0x9f26('0x9')](_0x36a5a5);break;case'booked':freeVariablesPredictive(_0x36a5a5);_0x3da9ed[_0x9f26('0x155')](_0x36a5a5,0x1);break;default:freeVariablesPredictive(_0x36a5a5);logger[_0x9f26('0x93')](_0x9f26('0x158'),_0x36a5a5[_0x9f26('0x3f')],_0x9f26('0x159'));}};};Dialer[_0x9f26('0x17')][_0x9f26('0x15a')]=function(_0x316602){var _0x169437=this;return function(){_0x169437[_0x9f26('0x15b')](_0x316602);};};Dialer[_0x9f26('0x17')][_0x9f26('0x33')]=function(_0x1c96aa){var _0x15c3a3=this;if(isNotPreview(_0x1c96aa[_0x9f26('0x58')])){if(isVoiceQueueOutbound(_0x1c96aa[_0x9f26('0x4d')])&&isActive(_0x1c96aa[_0x9f26('0x15c')])){_0x1c96aa[_0x9f26('0x9e')]=!![];BPromise['resolve']()[_0x9f26('0xb4')](checkIsLoggedIn(_0x1c96aa,_0x1c96aa[_0x9f26('0x15d')]))[_0x9f26('0xb4')](checkIsActive(_0x1c96aa,_0x1c96aa[_0x9f26('0x15c')]))[_0x9f26('0xb4')](checkInterval(_0x1c96aa))[_0x9f26('0xb4')](_0x15c3a3[_0x9f26('0x15e')](_0x1c96aa))[_0x9f26('0xb4')](_0x15c3a3[_0x9f26('0x13f')](_0x1c96aa[_0x9f26('0x15f')],_0x1c96aa[_0x9f26('0x160')],_0x1c96aa[_0x9f26('0x3f')],_0x1c96aa))[_0x9f26('0xb4')](_0x15c3a3['checkIfTimeIntervals'](_0x1c96aa['Interval'],_0x1c96aa[_0x9f26('0x160')],_0x1c96aa['name'],_0x1c96aa))[_0x9f26('0xb4')](_0x15c3a3[_0x9f26('0x153')](_0x1c96aa))[_0x9f26('0xae')](loggerCatchQueueSummary(_0x9f26('0x161'),_0x1c96aa));}else{notSendMessagesQueue(_0x1c96aa);}}else{freeVariablesPredictive(_0x1c96aa);}};Dialer[_0x9f26('0x17')][_0x9f26('0x13c')]=function(){var _0x439a95=this;var _0x1248a9;for(var _0x2b21b0 in this[_0x9f26('0x1d')]){if(typeof this[_0x9f26('0x1d')][_0x2b21b0]!==_0x9f26('0x97')){_0x1248a9=this['campaigns'][_0x2b21b0];if(isCampaignIvr(_0x1248a9[_0x9f26('0x4d')])&&isActive(_0x1248a9['active'])){_0x1248a9[_0x9f26('0x9e')]=!![];BPromise[_0x9f26('0xb3')]()[_0x9f26('0xb4')](checkIsActive(_0x1248a9,_0x1248a9[_0x9f26('0x6f')]))[_0x9f26('0xb4')](checkInterval(_0x1248a9))[_0x9f26('0xb4')](_0x439a95['checkIsTrunkReachable'](_0x1248a9))['then'](_0x439a95[_0x9f26('0x13f')](_0x1248a9['dialGlobalInterval'],_0x1248a9[_0x9f26('0x160')],_0x1248a9['name'],_0x1248a9))[_0x9f26('0xb4')](_0x439a95[_0x9f26('0x162')](_0x1248a9[_0x9f26('0x43')],_0x1248a9[_0x9f26('0x160')],_0x1248a9[_0x9f26('0x3f')],_0x1248a9))['then'](_0x439a95[_0x9f26('0x15a')](_0x1248a9))[_0x9f26('0xae')](loggerCatchQueueSummary(_0x9f26('0x163'),_0x1248a9));}else{notSendMessagesCampaign(_0x1248a9);}}}};function getCallerIdRandom(_0xbf7923,_0x3eefc1){var _0xe4e74;var _0x113aa5;var _0x67035f;if(_0x3eefc1<=0x0){_0x3eefc1=0x1;}_0xe4e74=new RegExp('\x5cw{0,'+_0x3eefc1+'}$');_0x113aa5=Math[_0x9f26('0x164')](0xa,_0x3eefc1-0x1);_0x67035f=Math['pow'](0xa,_0x3eefc1)-0x1;return util[_0x9f26('0x72')]('%s',_['replace'](_0xbf7923,_0xe4e74,_[_0x9f26('0x165')](_0x113aa5,_0x67035f)));}function extractCalleridName(_0x5eac2b){var _0x14976d=_0x5eac2b['match'](/"(.*?)"/);return _0x14976d?_0x14976d[0x1]:_0x5eac2b;}function extractCalleridNumber(_0x58922f){var _0x24011a=_0x58922f[_0x9f26('0x166')](/<(.*?)>/);return _0x24011a?_0x24011a[0x1]:_0x58922f;}Dialer['prototype'][_0x9f26('0x167')]=function(_0x4384a2,_0x4b2ed5){var _0x2320a8=this;var _0x6e3965=uuid['v4']();this['actions'][_0x6e3965]=new Action(_0x4384a2,_0x4b2ed5,_0x6e3965);return new BPromise(function(_0x3e5aae,_0x2b43c6){if(_[_0x9f26('0x3c')](_0x4384a2)&&typeof _0x4384a2!=='object'){return _0x2b43c6(msgResponse(_0x9f26('0x168'),_0x9f26('0x141'),_0x9f26('0x169')));}if(_[_0x9f26('0x3c')](_0x4b2ed5['Contact'][_0x9f26('0x16a')])||_0x4b2ed5['Contact'][_0x9f26('0x16a')]===null){return _0x2b43c6(msgResponse(_0x9f26('0x168'),'Failure',_0x9f26('0x16b')));}var _0x2f8921={'XMD-CALLERID':_0x2320a8[_0x9f26('0x22')][_0x6e3965][_0x9f26('0x16c')](),'XMD-AGI':_0x4384a2[_0x9f26('0x104')]?util[_0x9f26('0x72')](_0x9f26('0x16d'),ipAgi,_0x4384a2[_0x9f26('0x104')]):_0x9f26('0x16e'),'XMD-AGIAFTER':_0x4384a2[_0x9f26('0x10d')]?util[_0x9f26('0x72')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4384a2[_0x9f26('0x10d')]):_0x9f26('0x16e'),'XMD-QUEUE':_0x4384a2[_0x9f26('0x4d')]===_0x9f26('0x4e')?util[_0x9f26('0x72')](_0x9f26('0x16f'),_0x4384a2['name'],_0x4384a2['dialQueueOptions']||'',_0x4384a2['dialAgiAfterHangupAgent']?'c':'',_0x4384a2[_0x9f26('0x170')]||0x3):_0x9f26('0x16e'),'XMD-CONTACTID':_0x4b2ed5[_0x9f26('0xcf')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2320a8[_0x9f26('0x22')][_0x6e3965][_0x9f26('0x16c')](),'XMD-AMD':_0x4384a2[_0x9f26('0xe7')]?_0x9f26('0x171'):_0x9f26('0x16e'),'XMD-DESTINATION':_0x9f26('0xdf')};if(_0x4384a2['dialAMDActive']){_0x2f8921['XMD-AMDINITIALSILENCE']=_0x4384a2[_0x9f26('0x172')]||0x9c4;_0x2f8921[_0x9f26('0x173')]=_0x4384a2[_0x9f26('0x174')]||0x5dc;_0x2f8921[_0x9f26('0x175')]=_0x4384a2[_0x9f26('0x176')]||0x320;_0x2f8921[_0x9f26('0x177')]=_0x4384a2['dialAMDTotalAnalysisTime']||0x1388;_0x2f8921[_0x9f26('0x178')]=_0x4384a2[_0x9f26('0x179')]||0x64;_0x2f8921[_0x9f26('0x17a')]=_0x4384a2['dialAMDBetweenWordsSilence']||0x32;_0x2f8921[_0x9f26('0x17b')]=_0x4384a2[_0x9f26('0x17c')]||0x3;_0x2f8921['XMD-AMDSILENCETHRESHOLD']=_0x4384a2['dialAMDSilenceThreshold']||0x100;_0x2f8921['XMD-AMDMAXIMUMWORDLENGTH']=_0x4384a2[_0x9f26('0x17d')]||0x1388;}if(_0x4384a2[_0x9f26('0x4d')]===_0x9f26('0x4e')){_0x2f8921[_0x9f26('0x17e')]=_0x4b2ed5[_0x9f26('0xd1')];}else{_0x2f8921[_0x9f26('0x17f')]=_0x4b2ed5['CampaignId'];}for(var _0x5d49d9 in _0x4b2ed5[_0x9f26('0x180')]){if(typeof _0x4b2ed5[_0x9f26('0x180')][_0x5d49d9]!==_0x9f26('0x97')){if(isNotNull(_0x4b2ed5[_0x9f26('0x180')][_0x5d49d9])&&_0x5d49d9!=='id'&&_0x5d49d9!==_0x9f26('0x181')&&_0x5d49d9!=='createdAt'&&_0x5d49d9!==_0x9f26('0x182')){_0x2f8921[util[_0x9f26('0x72')](_0x9f26('0x183'),'XMD-',_['toUpper'](_0x5d49d9))]=_0x4b2ed5['Contact'][_0x5d49d9];}}}var _0x18016e=_0x2320a8['isTrunkReachable'](_0x4384a2[_0x9f26('0x6e')])?getCallerId(_0x4384a2['Trunk'][_0x9f26('0x70')],_0x4384a2[_0x9f26('0x59')],_0x4384a2[_0x9f26('0x184')]>0x0?getCallerIdRandom(_0x4384a2[_0x9f26('0x185')],_0x4384a2[_0x9f26('0x184')]):_0x4384a2[_0x9f26('0x185')]):getCallerId(_[_0x9f26('0xaa')](_0x4384a2[_0x9f26('0x186')])?_0x4384a2['Trunk'][_0x9f26('0x70')]:_0x4384a2[_0x9f26('0x186')][_0x9f26('0x70')],_0x4384a2[_0x9f26('0x59')],_0x4384a2[_0x9f26('0x184')]>0x0?getCallerIdRandom(_0x4384a2[_0x9f26('0x185')],_0x4384a2[_0x9f26('0x184')]):_0x4384a2[_0x9f26('0x185')]);if(_0x18016e){_0x2f8921[_0x9f26('0x187')]=_0x2320a8[_0x9f26('0x22')][_0x6e3965]['originatecalleridname']=extractCalleridName(_0x18016e);_0x2f8921[_0x9f26('0x188')]=_0x2320a8['actions'][_0x6e3965][_0x9f26('0x189')]=extractCalleridNumber(_0x18016e);}return ami[_0x9f26('0xab')]({'actionid':_0x6e3965,'action':_0x9f26('0x168'),'channel':_0x2320a8[_0x9f26('0xd7')](_0x4384a2[_0x9f26('0x6e')])?util[_0x9f26('0x72')]('SIP/%s/%s%s',_0x4384a2['Trunk'][_0x9f26('0x3f')],isNotNull(_0x4384a2['dialPrefix'])?_0x4384a2['dialPrefix'][_0x9f26('0x18a')]()||'':'',_0x4384a2['dialCutDigit']>0x0?_0x4b2ed5[_0x9f26('0x180')][_0x9f26('0x16a')]['substring'](_0x4384a2[_0x9f26('0x18b')]):_0x4b2ed5[_0x9f26('0x180')][_0x9f26('0x16a')]):util[_0x9f26('0x72')](_0x9f26('0x18c'),_[_0x9f26('0xaa')](_0x4384a2[_0x9f26('0x186')])?_0x4384a2[_0x9f26('0x6e')][_0x9f26('0x3f')]:_0x4384a2['TrunkBackup'][_0x9f26('0x3f')],isNotNull(_0x4384a2[_0x9f26('0x5a')])?_0x4384a2[_0x9f26('0x5a')][_0x9f26('0x18a')]()||'':'',_0x4384a2[_0x9f26('0x18b')]>0x0?_0x4b2ed5[_0x9f26('0x180')][_0x9f26('0x16a')]['substring'](_0x4384a2[_0x9f26('0x18b')]):_0x4b2ed5[_0x9f26('0x180')][_0x9f26('0x16a')]),'callerid':_0x18016e,'Exten':'xcally-motion-dialer','Context':_0x9f26('0x18d'),'Priority':'1','variable':_0x2f8921,'timeout':(_0x4384a2['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x6e3965})[_0x9f26('0xb4')](function(_0x169d70){return _0x3e5aae(_0x169d70);})[_0x9f26('0xae')](function(_0xd796ff){_0x4384a2[_0x9f26('0x18e')]+=0x1;var _0xe79558=new History(_0x2320a8[_0x9f26('0x22')][_0x6e3965]);logger[_0x9f26('0x93')](util[_0x9f26('0x72')]('[originateError]:\x20%s',JSON['stringify'](_0xd796ff)));_0xe79558[_0x9f26('0xa4')]=0xe;_0xe79558[_0x9f26('0xa5')]=_0x9f26('0x18f');_0xe79558[_0x9f26('0xa6')]=moment()[_0x9f26('0x72')](_0x9f26('0xf8'));_0xe79558[_0x9f26('0x123')]=_0xe79558[_0x9f26('0xa6')];_0x2320a8['createHistory'](_0xe79558)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x190')));_0x2320a8[_0x9f26('0xda')](_0xe79558)[_0x9f26('0xae')](loggerCatch('[originate][error]'))[_0x9f26('0x1a')](function(){delete _0x2320a8[_0x9f26('0x22')][_0x6e3965];return _0x2b43c6(msgResponse(_0x9f26('0x168'),_0x9f26('0x48'),'originate\x20action\x20Error'));});});});};Dialer[_0x9f26('0x17')][_0x9f26('0x30')]=function(_0x195393){var _0x1d54dd=this['actions'][_0x195393[_0x9f26('0x126')]];if(_0x1d54dd){delete this[_0x9f26('0x22')][_0x195393[_0x9f26('0x126')]];_0x1d54dd[_0x9f26('0x115')]=moment()[_0x9f26('0x72')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3fa235=_0x1d54dd[_0x9f26('0x4d')]==='ivr'?this[_0x9f26('0x1d')][_0x1d54dd['queue']]:this[_0x9f26('0x1c')][_0x1d54dd['getQueue']()];if(!this[_0x9f26('0xd5')](_0x195393[_0x9f26('0x191')])){this[_0x9f26('0xaf')](_0x3fa235);return this[_0x9f26('0x192')](_0x1d54dd,_0x3fa235,_0x195393)['catch'](loggerCatch(_0x9f26('0x193')));}this[_0x9f26('0x24')][_0x195393[_0x9f26('0xdc')]]=_0x1d54dd;}};Dialer[_0x9f26('0x17')][_0x9f26('0x194')]=function(_0x51b88a,_0x331fc4,_0x290b11){var _0x101621=new History(_0x331fc4);if(_0x101621[_0x9f26('0xed')]+_0x101621[_0x9f26('0xfe')]+_0x101621[_0x9f26('0xff')]+_0x101621[_0x9f26('0xee')]+_0x101621[_0x9f26('0xef')]+_0x101621[_0x9f26('0x11f')]+_0x101621['countmachineretry']+_0x101621['countagentrejectretry']>=_0x290b11[_0x9f26('0xf1')]-0x1){return!![];}switch(_0x51b88a){case 0x3:if(_0x101621[_0x9f26('0xff')]>=_0x290b11[_0x9f26('0x195')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x101621[_0x9f26('0xff')]+=0x1,'scheduledat':moment()['add'](_0x290b11[_0x9f26('0x196')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x101621['ContactId'],'ListId':_0x101621[_0x9f26('0xd0')],'VoiceQueueId':_0x101621['VoiceQueueId']||undefined,'CampaignId':_0x101621[_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch(_0x9f26('0x197')));break;case 0x5:if(_0x101621[_0x9f26('0xed')]>=_0x290b11[_0x9f26('0x198')]-0x1){return!![];}this[_0x9f26('0xbc')]({'active':![],'countbusyretry':_0x101621[_0x9f26('0xed')]+=0x1,'scheduledat':moment()[_0x9f26('0xf6')](_0x290b11[_0x9f26('0x199')],'minutes')['format'](_0x9f26('0xf8')),'ContactId':_0x101621[_0x9f26('0xcf')],'ListId':_0x101621[_0x9f26('0xd0')],'VoiceQueueId':_0x101621['VoiceQueueId']||undefined,'CampaignId':_0x101621['CampaignId']||undefined})['catch'](loggerCatch(_0x9f26('0x19a')));break;case 0x8:if(_0x101621[_0x9f26('0xfe')]>=_0x290b11[_0x9f26('0x19b')]-0x1){return!![];}this[_0x9f26('0xbc')]({'active':![],'countcongestionretry':_0x101621['countcongestionretry']+=0x1,'scheduledat':moment()[_0x9f26('0xf6')](_0x290b11[_0x9f26('0x19c')],_0x9f26('0xf7'))[_0x9f26('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x101621['ContactId'],'ListId':_0x101621[_0x9f26('0xd0')],'VoiceQueueId':_0x101621[_0x9f26('0xd1')]||undefined,'CampaignId':_0x101621[_0x9f26('0xd2')]||undefined})['catch'](loggerCatch(_0x9f26('0x19d')));break;case 0x0:if(_0x101621['countnosuchnumberretry']>=_0x290b11[_0x9f26('0x19e')]-0x1){return!![];}else{this[_0x9f26('0xbc')]({'active':![],'countnosuchnumberretry':_0x101621['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x9f26('0xf6')](_0x290b11[_0x9f26('0x19f')],_0x9f26('0xf7'))[_0x9f26('0x72')](_0x9f26('0xf8')),'ContactId':_0x101621['ContactId'],'ListId':_0x101621[_0x9f26('0xd0')],'VoiceQueueId':_0x101621[_0x9f26('0xd1')]||undefined,'CampaignId':_0x101621[_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch(_0x9f26('0x1a0')));}break;case 0xa:if(_0x101621['countdropretry']>=_0x290b11[_0x9f26('0x118')]-0x1){return!![];}this[_0x9f26('0xbc')]({'active':![],'countdropretry':_0x101621[_0x9f26('0xef')]+=0x1,'scheduledat':moment()[_0x9f26('0xf6')](_0x290b11[_0x9f26('0x119')],_0x9f26('0xf7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x101621[_0x9f26('0xcf')],'ListId':_0x101621['ListId'],'VoiceQueueId':_0x101621[_0x9f26('0xd1')]||undefined,'CampaignId':_0x101621[_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch(_0x9f26('0x11a')));break;case 0xb:if(_0x101621['countabandonedretry']>=_0x290b11['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x9f26('0xbc')]({'active':![],'countabandonedretry':_0x101621[_0x9f26('0x11f')]+=0x1,'scheduledat':moment()[_0x9f26('0xf6')](_0x290b11[_0x9f26('0x121')],_0x9f26('0xf7'))[_0x9f26('0x72')](_0x9f26('0xf8')),'ContactId':_0x101621[_0x9f26('0xcf')],'ListId':_0x101621[_0x9f26('0xd0')],'VoiceQueueId':_0x101621[_0x9f26('0xd1')]||undefined,'CampaignId':_0x101621[_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch(_0x9f26('0x122')));break;case 0x13:if(_0x101621[_0x9f26('0xea')]>=_0x290b11[_0x9f26('0xf4')]-0x1){return!![];}this[_0x9f26('0xbc')]({'active':![],'countmachineretry':_0x101621[_0x9f26('0xea')]+=0x1,'scheduledat':moment()[_0x9f26('0xf6')](_0x290b11[_0x9f26('0x100')],_0x9f26('0xf7'))[_0x9f26('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x101621[_0x9f26('0xcf')],'ListId':_0x101621['ListId'],'VoiceQueueId':_0x101621[_0x9f26('0xd1')]||undefined,'CampaignId':_0x101621[_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch(_0x9f26('0x101')));break;case 0x14:if(_0x101621[_0x9f26('0xf0')]>=_0x290b11[_0x9f26('0x1a1')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x101621[_0x9f26('0xf0')]+=0x1,'scheduledat':moment()[_0x9f26('0xf6')](_0x290b11[_0x9f26('0x1a2')],'minutes')[_0x9f26('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x101621['ContactId'],'ListId':_0x101621[_0x9f26('0xd0')],'VoiceQueueId':_0x101621[_0x9f26('0xd1')]||undefined,'CampaignId':_0x101621[_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch(_0x9f26('0x1a3')));break;default:return!![];}};Dialer[_0x9f26('0x17')][_0x9f26('0x192')]=function(_0x186ab2,_0x361597,_0x354db1){var _0x445b4b=this;var _0x471d17=new History(_0x186ab2);return new BPromise(function(_0x31c066,_0x50e7e9){if(_[_0x9f26('0x3c')](_0x361597)&&typeof _0x361597!==_0x9f26('0x1a4')){return _0x50e7e9(msgResponse(_0x9f26('0x1a5'),_0x9f26('0x141'),_0x9f26('0x1a6')));}if(_['isUndefined'](_0x354db1)&&typeof _0x354db1!==_0x9f26('0x1a4')){return _0x50e7e9(msgResponse('[callProgressDetecting]',_0x9f26('0x141'),'evt\x20is\x20undefine'));}switch(_0x354db1[_0x9f26('0x10a')]){case'0':_0x361597[_0x9f26('0x62')]+=0x1;_0x471d17[_0x9f26('0xa4')]=0x0;_0x471d17[_0x9f26('0xa5')]='NoSuchNumber';_0x471d17['countnosuchnumberretry']+=0x1;_0x471d17[_0x9f26('0xeb')]+=0x1;ami[_0x9f26('0x4c')](_0x9f26('0x1a7'),ut['buildObj'](_0x186ab2,_0x9f26('0x1a8')));_0x445b4b['createHistory'](_0x471d17)[_0x9f26('0xae')](loggerCatch(_0x9f26('0xec')));if(_0x445b4b['checkRetriveMax'](0x0,_0x186ab2,_0x361597)){if(_0x471d17[_0x9f26('0xee')]>=_0x361597['dialNoSuchNumberMaxRetry']){_0x445b4b[_0x9f26('0x1a9')](_0x471d17,_0x31c066,_0x50e7e9,_0x9f26('0x1aa'));}else{_0x445b4b['stateGlobal'](_0x471d17,_0x31c066,_0x50e7e9,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x361597[_0x9f26('0x1ab')]+=0x1;_0x471d17['state']=0x3;_0x471d17['statedesc']=_0x9f26('0x1ac');_0x471d17['countnoanswerretry']+=0x1;_0x471d17[_0x9f26('0xeb')]+=0x1;ami['emit'](_0x9f26('0x1ad'),ut[_0x9f26('0xe3')](_0x186ab2,_0x9f26('0x1ae')));_0x445b4b[_0x9f26('0xc6')](_0x471d17)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x1af')));if(_0x445b4b[_0x9f26('0x194')](0x3,_0x186ab2,_0x361597)){if(_0x471d17[_0x9f26('0xff')]>=_0x361597[_0x9f26('0x195')]){_0x445b4b[_0x9f26('0x1a9')](_0x471d17,_0x31c066,_0x50e7e9,'reason\x203\x20ringing\x20no\x20answer');}else{_0x445b4b[_0x9f26('0xf2')](_0x471d17,_0x31c066,_0x50e7e9,_0x9f26('0x1b0'));}}break;case'5':_0x361597[_0x9f26('0x1b1')]+=0x1;_0x471d17['state']=0x5;_0x471d17['statedesc']='Busy';_0x471d17['countbusyretry']+=0x1;_0x471d17['countglobal']+=0x1;ami[_0x9f26('0x4c')]('custom:agentbusy',ut[_0x9f26('0xe3')](_0x186ab2,'busy'));_0x445b4b[_0x9f26('0xc6')](_0x471d17)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x1b2')));if(_0x445b4b[_0x9f26('0x194')](0x5,_0x186ab2,_0x361597)){if(_0x471d17['countbusyretry']>=_0x361597[_0x9f26('0x198')]){_0x445b4b['createStateFinal'](_0x471d17,_0x31c066,_0x50e7e9,'reason\x205\x20busy');}else{_0x445b4b['stateGlobal'](_0x471d17,_0x31c066,_0x50e7e9,_0x9f26('0x1b3'));}}break;case'8':_0x361597['outboundCongestionCallsDay']+=0x1;_0x471d17['state']=0x8;_0x471d17[_0x9f26('0xa5')]=_0x9f26('0x1b4');_0x471d17[_0x9f26('0xfe')]+=0x1;_0x471d17[_0x9f26('0xeb')]+=0x1;ami['emit'](_0x9f26('0x1b5'),ut[_0x9f26('0xe3')](_0x186ab2,_0x9f26('0x1b6')));_0x445b4b[_0x9f26('0xc6')](_0x471d17)['catch'](loggerCatch(_0x9f26('0x1b7')));if(_0x445b4b[_0x9f26('0x194')](0x8,_0x186ab2,_0x361597)){if(_0x471d17[_0x9f26('0xfe')]>=_0x361597[_0x9f26('0x19b')]){_0x445b4b[_0x9f26('0x1a9')](_0x471d17,_0x31c066,_0x50e7e9,_0x9f26('0x1b8'));}else{_0x445b4b['stateGlobal'](_0x471d17,_0x31c066,_0x50e7e9,'reason\x208\x20congestion');}}break;case'11':_0x361597[_0x9f26('0x1b9')]+=0x1;_0x471d17[_0x9f26('0xa4')]=0xb;_0x471d17[_0x9f26('0xa5')]=_0x9f26('0x11e');_0x471d17[_0x9f26('0x11f')]+=0x1;_0x471d17['countglobal']+=0x1;_0x445b4b[_0x9f26('0xc6')](_0x471d17)[_0x9f26('0xae')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x445b4b[_0x9f26('0x194')](0xb,_0x186ab2,_0x361597)){if(_0x471d17[_0x9f26('0x11f')]>=_0x361597[_0x9f26('0x120')]){_0x445b4b[_0x9f26('0x1a9')](_0x471d17,_0x31c066,_0x50e7e9,'reason\x2011\x20abandoned');}else{_0x445b4b[_0x9f26('0xf2')](_0x471d17,_0x31c066,_0x50e7e9,'reason\x2011\x20abandoned');}}break;case'20':_0x361597[_0x9f26('0x1ba')]+=0x1;_0x471d17[_0x9f26('0xa4')]=0x14;_0x471d17[_0x9f26('0xa5')]=_0x9f26('0x1bb');_0x471d17[_0x9f26('0xf0')]+=0x1;_0x471d17[_0x9f26('0xeb')]+=0x1;ami['emit']('custom:agentreject',ut['buildObj'](_0x186ab2,'agentreject'));_0x445b4b[_0x9f26('0xc6')](_0x471d17)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x1bc')));if(_0x445b4b['checkRetriveMax'](0x14,_0x186ab2,_0x361597)){if(_0x471d17[_0x9f26('0xf0')]>=_0x361597[_0x9f26('0x1a1')]){_0x445b4b['createStateFinal'](_0x471d17,_0x31c066,_0x50e7e9,_0x9f26('0x1bd'));}else{_0x445b4b[_0x9f26('0xf2')](_0x471d17,_0x31c066,_0x50e7e9,'reason\x2020\x20agentreject');}}break;default:_0x361597['outboundUnknownCallsDay']+=0x1;_0x471d17[_0x9f26('0xa4')]=0xc;_0x471d17[_0x9f26('0xa5')]=_0x354db1[_0x9f26('0x10a')];_0x445b4b[_0x9f26('0xc6')](_0x471d17)[_0x9f26('0xae')](loggerCatch(_0x9f26('0x1be')));if(_0x445b4b[_0x9f26('0x194')](_0x354db1[_0x9f26('0x10a')],_0x186ab2,_0x361597)){if(_0x471d17['countbusyretry']+_0x471d17[_0x9f26('0xfe')]+_0x471d17[_0x9f26('0xff')]+_0x471d17['countnosuchnumberretry']+_0x471d17[_0x9f26('0xef')]+_0x471d17[_0x9f26('0x11f')]+_0x471d17['countmachineretry']+_0x471d17[_0x9f26('0xf0')]>=_0x361597[_0x9f26('0xf1')]){_0x445b4b[_0x9f26('0xf2')](_0x471d17,_0x31c066,_0x50e7e9,_0x354db1[_0x9f26('0x10a')]);}else{_0x445b4b[_0x9f26('0x1a9')](_0x471d17,_0x31c066,_0x50e7e9,_0x354db1[_0x9f26('0x10a')]);}}}});};Dialer[_0x9f26('0x17')][_0x9f26('0xf2')]=function(_0x2b54af,_0x444b82,_0x45ed31,_0x31ebfa){var _0x140772=new Final(_0x2b54af);_0x140772[_0x9f26('0xa4')]=0xf;_0x140772['statedesc']='Global';this[_0x9f26('0x1a9')](_0x140772,_0x444b82,_0x45ed31,_0x31ebfa);};Dialer[_0x9f26('0x17')][_0x9f26('0x1a9')]=function(_0x585555,_0x2caaba,_0x28d71e,_0x2b8ea3){this['moveContactManagedDialer'](_0x585555)[_0x9f26('0xb4')](function(){return _0x2caaba(msgResponse('[callProgressDetecting]',_0x9f26('0xd6'),_0x2b8ea3));})[_0x9f26('0xae')](function(){return _0x28d71e(msgResponse(_0x9f26('0x1bf'),'Failure',_0x9f26('0x1c0')));});};Dialer[_0x9f26('0x17')]['predictive']=function(_0x2d8c83){var _0x14352e=_0x2d8c83['dialPredictiveOptimizationPercentage']/0x64;var _0x1e05da=_0x2d8c83[_0x9f26('0x61')]/(_0x2d8c83[_0x9f26('0x61')]+_0x2d8c83['outboundAnswerCallsDay']);var _0x35e79f=Math[_0x9f26('0x1c1')](_0x2d8c83[_0x9f26('0x68')]*(_0x2d8c83[_0x9f26('0x1c2')]/0x64));var _0x536484=Math[_0x9f26('0x1c1')](_0x2d8c83[_0x9f26('0x68')]*(_0x2d8c83[_0x9f26('0x1c3')]/0x64));var _0x2b1379=_0x2d8c83['available']+_0x2d8c83[_0x9f26('0x53')];var _0x43e879=Math[_0x9f26('0x1c4')](_0x2d8c83[_0x9f26('0x6b')]*_0x2d8c83['erlangAbandonmentRate']*_0x2d8c83[_0x9f26('0x1c5')]*_0x2d8c83['predictiveIntervalMultiplicativeFactor']);if(_[_0x9f26('0x3c')](_0x2d8c83['startProgressive'])){if(!_[_0x9f26('0x3c')](_0x2d8c83[_0x9f26('0x26')])){_0x2d8c83[_0x9f26('0x26')]=undefined;loggerPredictive[_0x9f26('0x93')](_0x9f26('0x1c6'),_0x9f26('0x1c7'));}if(!_['isUndefined'](_0x2d8c83['handlePredictive'])){loggerPredictive[_0x9f26('0x93')](_0x9f26('0x1c6'),_0x9f26('0x1c8'));clearInterval(_0x2d8c83['handlePredictive']);_0x2d8c83[_0x9f26('0x8f')]=undefined;}_0x2d8c83[_0x9f26('0x6d')]=moment()[_0x9f26('0x72')](_0x9f26('0xf8'));loggerPredictive[_0x9f26('0x78')](_0x2d8c83[_0x9f26('0x3f')],_0x9f26('0x1c9'),_0x2d8c83['startProgressive']);this[_0x9f26('0x155')](_0x2d8c83,0x1);}else if(ifInterval(_0x2d8c83[_0x9f26('0x1ca')],_0x2d8c83['startProgressive'])){this[_0x9f26('0x155')](_0x2d8c83,0x1);loggerPredictiveCalls['info'](_0x9f26('0x1cb'),_0x2d8c83[_0x9f26('0x6d')],_0x2d8c83[_0x9f26('0x3f')]);_0x2d8c83[_0x9f26('0x6b')]=0x0;_0x2d8c83[_0x9f26('0x1cc')]=0x0;}else if(_0x14352e<_0x1e05da&&_0x2d8c83['dialPredictiveOptimization']===_0x9f26('0x1cd')){freeVariablesPredictive(_0x2d8c83);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x9f26('0x1ce'),_0x1e05da,'startProgressive',_0x2d8c83[_0x9f26('0x3f')]);}else if(_0x43e879<_0x2d8c83[_0x9f26('0x1cc')]&&_0x2d8c83[_0x9f26('0x1cf')]===_0x9f26('0x1cd')){freeVariablesPredictive(_0x2d8c83);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x1d0'),_0x9f26('0x1d1'),_0x43e879,_0x9f26('0x1d2'),_0x2d8c83[_0x9f26('0x1cc')],_0x9f26('0x6d'),_0x2d8c83[_0x9f26('0x3f')]);}else if(!ifInterval(_0x2d8c83[_0x9f26('0x1ca')],_0x2d8c83[_0x9f26('0x6d')])&&_[_0x9f26('0x3c')](_0x2d8c83['startPredictive'])&&!_[_0x9f26('0x3c')](_0x2d8c83[_0x9f26('0x6d')])){_0x2d8c83['startPredictive']=moment()[_0x9f26('0x72')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x9f26('0x78')](_0x2d8c83[_0x9f26('0x3f')],_0x9f26('0x1d3'),_0x2d8c83[_0x9f26('0x26')]);this['averageHandleTime'](_0x2d8c83[_0x9f26('0x1ca')])[_0x9f26('0xb4')](this['getDataPredictive'](_0x2d8c83))['then'](mergeDataErlangB(_0x2d8c83))['then'](this[_0x9f26('0x1d4')](_0x2d8c83))[_0x9f26('0xae')](loggerCatchPredictive(_0x9f26('0x1d5'),_0x2d8c83));}else if(!ifInterval(_0x2d8c83['dialPredictiveInterval'],_0x2d8c83[_0x9f26('0x26')])){_0x2d8c83[_0x9f26('0x1cc')]=0x0;_0x2d8c83[_0x9f26('0x26')]=moment()['format'](_0x9f26('0xf8'));loggerPredictive[_0x9f26('0x78')](_0x2d8c83[_0x9f26('0x3f')],_0x9f26('0x1d6'),_0x2d8c83[_0x9f26('0x26')]);clearInterval(_0x2d8c83['handlePredictive']);_0x2d8c83[_0x9f26('0x8f')]=undefined;this['averageHandleTime'](_0x2d8c83[_0x9f26('0x1ca')])[_0x9f26('0xb4')](this[_0x9f26('0x1d7')](_0x2d8c83))['then'](mergeDataErlangB(_0x2d8c83))[_0x9f26('0xb4')](this['startMethodPredictive'](_0x2d8c83))[_0x9f26('0xae')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x2d8c83));}else if(_0x2d8c83[_0x9f26('0x68')]&&_0x2b1379<_0x2d8c83[_0x9f26('0x68')]-_0x536484){freeVariablesPredictive(_0x2d8c83);loggerPredictive[_0x9f26('0x78')](_0x2d8c83[_0x9f26('0x3f')],_0x9f26('0x1d8'),_0x2b1379,_0x9f26('0x1d9'),_0x2d8c83[_0x9f26('0x68')],'-',_0x536484,'=',_0x2d8c83[_0x9f26('0x68')]-_0x536484,')');}else if(_0x2d8c83['predictiveIntervalAvailable']&&_0x2b1379>_0x2d8c83[_0x9f26('0x68')]+_0x35e79f){freeVariablesPredictive(_0x2d8c83);loggerPredictive[_0x9f26('0x78')](_0x2d8c83[_0x9f26('0x3f')],_0x9f26('0x1d8'),_0x2b1379,')\x20are\x20more\x20than\x20threshold\x20(',_0x2d8c83['predictiveIntervalAvailable'],'+',_0x35e79f,'=',_0x2d8c83[_0x9f26('0x68')]+_0x35e79f,')');}};Dialer['prototype'][_0x9f26('0x1d7')]=function(_0x459674){var _0x11f2b6=this;return function(_0x2a530b){return new BPromise(function(_0x83403b,_0xd53a60){_[_0x9f26('0x8c')](_0x459674,_0x2a530b[0x0]);if(checkGetDataPredictive(_0x2a530b[0x0])){var _0x43fad6=_0x459674[_0x9f26('0x68')]=_0x459674[_0x9f26('0x53')]+_0x459674[_0x9f26('0x50')];var _0x435636=_0x459674['dialPredictiveInterval']*0x3c;var _0x56bc54=_0x2a530b[0x0][_0x9f26('0x65')]+_0x2a530b[0x0][_0x9f26('0x64')];var _0x18e429=(_0x2a530b[0x0][_0x9f26('0x63')]+_0x2a530b[0x0][_0x9f26('0x7d')]+_0x2a530b[0x0][_0x9f26('0x7f')])/_0x2a530b[0x0]['predictiveIntervalTotalCalls'];_0x459674[_0x9f26('0x1c5')]=_0x18e429>0x0?_0x18e429:0x1;switch(_0x459674[_0x9f26('0x1cf')]){case _0x9f26('0x1cd'):var _0x106ff6=_0x459674[_0x9f26('0x1da')]/0x64;return _0x11f2b6[_0x9f26('0x1db')](_0x43fad6,_0x435636,_0x56bc54,_0x18e429,_0x106ff6)[_0x9f26('0xb4')](function(_0x408bfd){return _0x83403b(_0x408bfd);});case _0x9f26('0x1dc'):var _0x5016df=_0x459674[_0x9f26('0x1da')]/0x64;return _0x11f2b6[_0x9f26('0x1dd')](_0x43fad6,_0x435636,_0x56bc54,_0x18e429,_0x5016df)[_0x9f26('0xb4')](function(_0x52e7f6){return _0x83403b(_0x52e7f6);});default:return _0xd53a60(msgResponse(_0x9f26('0x1de'),_0x9f26('0x141'),_0x9f26('0x1df')));}}else{return _0xd53a60(msgResponse('[getDataPredictive]',_0x9f26('0x141'),_0x9f26('0x1e0')));}});};};Dialer['prototype'][_0x9f26('0x1e1')]=function(_0x57b309){var _0xa43f8=this;return function(_0x468f37){return new BPromise(function(_0x5245ed,_0x591466){_[_0x9f26('0x8c')](_0x57b309,_0x468f37[0x0]);if(checkGetDataPredictive(_0x468f37[0x0])){loggerPredictive[_0x9f26('0x78')](JSON[_0x9f26('0x71')](_0x468f37[0x0]));if(_0x57b309[_0x9f26('0x1cf')]===_0x9f26('0x1cd')){return _0xa43f8[_0x9f26('0xc3')](_0x57b309['id'])[_0x9f26('0xb4')](function(_0x2bb08c){var _0x2b1b3c=_0x57b309[_0x9f26('0x15d')]-_0x2bb08c[0x0][_0x9f26('0x1e2')];var _0x58027b=_0x57b309[_0x9f26('0x1ca')]*0x3c;var _0x2180bb=_0x468f37[0x0][_0x9f26('0x65')]+_0x468f37[0x0][_0x9f26('0x64')];var _0x9c6545=(_0x468f37[0x0][_0x9f26('0x63')]+_0x468f37[0x0][_0x9f26('0x7d')]+_0x468f37[0x0][_0x9f26('0x7f')])/_0x468f37[0x0][_0x9f26('0x69')];var _0x5cda53=_0x57b309[_0x9f26('0x1da')]/0x64;_0x57b309[_0x9f26('0x67')]=_0x2bb08c[0x0][_0x9f26('0x1e2')]||0x0;_0x57b309[_0x9f26('0x1c5')]=_0x9c6545>0x0?_0x9c6545:0x1;return _0xa43f8[_0x9f26('0x1db')](_0x2b1b3c,_0x58027b,_0x2180bb,_0x9c6545,_0x5cda53);})[_0x9f26('0xb4')](function(_0x4d46e0){return _0x5245ed(_0x4d46e0);})[_0x9f26('0xae')](function(_0x22ad54){return _0x591466(msgResponse(_0x9f26('0x1e3'),'Failure',JSON[_0x9f26('0x71')](_0x22ad54)));});}if(_0x57b309[_0x9f26('0x1cf')]===_0x9f26('0x1dc')){return _0xa43f8[_0x9f26('0xc3')](_0x57b309['id'])[_0x9f26('0xb4')](function(_0x5c0e45){var _0x7e1986=_0x57b309[_0x9f26('0x15d')]-_0x5c0e45[0x0][_0x9f26('0x1e2')];var _0x3929d2=_0x57b309['dialPredictiveInterval']*0x3c;var _0x30dd81=_0x468f37[0x0][_0x9f26('0x65')]+_0x468f37[0x0]['predictiveIntervalAvgHoldtime'];var _0x42e979=(_0x468f37[0x0]['predictiveIntervalAnsweredCalls']+_0x468f37[0x0][_0x9f26('0x7d')]+_0x468f37[0x0][_0x9f26('0x7f')])/_0x468f37[0x0]['predictiveIntervalTotalCalls'];var _0x37d2cb=_0x57b309['dialPredictiveOptimizationPercentage']/0x64;_0x57b309[_0x9f26('0x67')]=_0x5c0e45[0x0][_0x9f26('0x1e2')]||0x0;_0x57b309['predictiveIntervalHitRate']=_0x42e979>0x0?_0x42e979:0x1;return _0xa43f8[_0x9f26('0x1dd')](_0x7e1986,_0x3929d2,_0x30dd81,_0x42e979,_0x37d2cb);})[_0x9f26('0xb4')](function(_0x316161){return _0x5245ed(_0x316161);})[_0x9f26('0xae')](function(_0x1c98e2){return _0x591466(msgResponse('[CatchErlangB]',_0x9f26('0x141'),JSON[_0x9f26('0x71')](_0x1c98e2)));});}}else{return _0x591466(msgResponse(_0x9f26('0x1de'),_0x9f26('0x141'),_0x9f26('0x1e0')));}});};};Dialer['prototype'][_0x9f26('0x1d4')]=function(_0x14e013){var _0x46d6cd=this;return function(){var _0x5a583f=0x0;var _0x53f25d=Math[_0x9f26('0x1c4')](_0x14e013[_0x9f26('0x88')]*0x3e8);if(_0x53f25d>0x0){_0x53f25d=_0x53f25d<0x64?0x64:_0x53f25d;loggerPredictive['info'](_0x14e013[_0x9f26('0x3f')],_0x9f26('0x1e4'),_0x53f25d,'milliseconds');_0x14e013[_0x9f26('0x8f')]=setInterval(function(){_0x46d6cd[_0x9f26('0x8f')](_0x14e013);loggerPredictiveCalls['info'](_0x9f26('0x1e5'),_0x5a583f+=0x1);},_0x53f25d);}else{loggerPredictive[_0x9f26('0x78')](_0x14e013[_0x9f26('0x3f')],_0x9f26('0x1e6'));}};};Dialer[_0x9f26('0x17')][_0x9f26('0x1e7')]=function(_0x1ed402,_0x69a3ca){var _0x2bc132=this;return function(_0x37f41a){if(_[_0x9f26('0x47')](_0x37f41a)){if(_[_0x9f26('0xaa')](_0x69a3ca['UserId'])||!_0x69a3ca['recallme']){if(_0x1ed402[_0x9f26('0x58')]===_0x9f26('0x8')){_0x1ed402['queueStatusComplete']=_['isUndefined'](_0x1ed402[_0x9f26('0x12e')])?!![]:_0x1ed402[_0x9f26('0x12e')];var _0x4d768e=uuid['v4']();_0x2bc132[_0x9f26('0x22')][_0x4d768e]=new Action(_0x1ed402,_0x69a3ca,_0x4d768e);loggerBooked[_0x9f26('0x78')]('[booked][checkContactBlack]',_0x4d768e,'queueStatusComplete:\x20',JSON[_0x9f26('0x71')](_0x1ed402['queueStatusComplete']),'Queue:\x20',_0x1ed402['name']);if(_0x1ed402[_0x9f26('0x12e')]){_0x1ed402['queueStatusComplete']=![];_0x2bc132[_0x9f26('0x28')][_0x2bc132[_0x9f26('0x22')][_0x4d768e][_0x9f26('0xb0')]]=[];ami['Action']({'actionid':_0x4d768e,'action':_0x9f26('0x1e8'),'queue':_0x1ed402[_0x9f26('0x3f')]})['catch'](function(){_0x2bc132[_0x9f26('0xaf')](_0x1ed402);_0x2bc132[_0x9f26('0xbc')]({'active':![],'ContactId':_0x2bc132['actions'][_0x4d768e][_0x9f26('0xcf')],'ListId':_0x2bc132[_0x9f26('0x22')][_0x4d768e][_0x9f26('0xd0')],'VoiceQueueId':_0x2bc132[_0x9f26('0x22')][_0x4d768e]['VoiceQueueId']||undefined,'CampaignId':_0x2bc132[_0x9f26('0x22')][_0x4d768e][_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2bc132[_0x9f26('0x22')][_0x4d768e];});}else{loggerBooked[_0x9f26('0x78')](_0x9f26('0x1e9'),JSON['stringify'](_0x1ed402['queueStatusComplete']),_0x9f26('0x1ea'),_0x1ed402[_0x9f26('0x3f')]);_0x2bc132[_0x9f26('0xaf')](_0x1ed402);_0x2bc132['rescheduleContact']({'active':![],'ContactId':_0x2bc132[_0x9f26('0x22')][_0x4d768e][_0x9f26('0xcf')],'ListId':_0x2bc132['actions'][_0x4d768e]['ListId'],'VoiceQueueId':_0x2bc132['actions'][_0x4d768e][_0x9f26('0xd1')]||undefined,'CampaignId':_0x2bc132[_0x9f26('0x22')][_0x4d768e][_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch(_0x9f26('0x1eb')));delete _0x2bc132[_0x9f26('0x22')][_0x4d768e];}}else{return _0x2bc132[_0x9f26('0x167')](_0x1ed402,_0x69a3ca);}}else{if(getDiff(_0x69a3ca['scheduledat'])<_0x1ed402[_0x9f26('0x1ec')]*0x3c){if(_0x69a3ca[_0x9f26('0x1ed')]&&!_0x69a3ca[_0x9f26('0x1ed')]['voicePause']){_0x2bc132[_0x9f26('0x1b')][_0x9f26('0x131')](_0x69a3ca['id'])['finally'](function(){_0x2bc132[_0x9f26('0xaf')](_0x1ed402);});}else{_0x2bc132[_0x9f26('0xbe')]({'active':![]},_0x69a3ca['id'],0x1)[_0x9f26('0x1a')](function(){_0x2bc132['updateOriginated'](_0x1ed402);});}}else{_0x1ed402[_0x9f26('0x1ee')]+=0x1;_0x2bc132[_0x9f26('0xaf')](_0x1ed402);if(_0x1ed402['dialRecallInQueue']){_0x2bc132[_0x9f26('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x69a3ca[_0x9f26('0xcf')],'ListId':_0x69a3ca[_0x9f26('0xd0')],'VoiceQueueId':_0x69a3ca['VoiceQueueId']||undefined,'CampaignId':_0x69a3ca[_0x9f26('0xd2')]||undefined})[_0x9f26('0xae')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x2bc132[_0x9f26('0xc6')](createObjHistory(_0x1ed402,_0x69a3ca,_0x9f26('0x1ef'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x9f26('0x1f0')));}else{_0x2bc132[_0x9f26('0xcd')](createObjHistory(_0x1ed402,_0x69a3ca,_0x9f26('0x1f1'),0x16,_0x9f26('0x1f2')),_0x9f26('0x1f3'),_0x9f26('0x1f4'));}}}}else{_0x1ed402[_0x9f26('0x5d')]+=0x1;_0x2bc132[_0x9f26('0xcd')](createObjHistory(_0x1ed402,_0x69a3ca,_0x9f26('0x1f5'),0xd,'Blacklist'),_0x9f26('0x1f6'),_0x9f26('0x1f7'));throw _0x9f26('0x1f8');}};};Dialer[_0x9f26('0x17')]['handleIvr']=function(_0x3c7288){var _0x2897bf=this;var _0x46f946=_0x3c7288[_0x9f26('0x1f9')]-_0x3c7288['originated']-_0x3c7288['temp'];emitCampaignSummary(_0x3c7288);if(_0x46f946>0x0){if(_0x46f946>this[_0x9f26('0x20')]){_0x46f946=this[_0x9f26('0x20')];}_0x3c7288[_0x9f26('0x1fa')]+=_0x46f946;this['getContactDialerIvr'](_0x3c7288['id'],_0x46f946,_0x3c7288[_0x9f26('0x1fb')])[_0x9f26('0xb4')](function(_0x3e46d6){_0x3c7288[_0x9f26('0x1fa')]-=_0x46f946;_0x3c7288[_0x9f26('0x1fa')]=_0x3c7288['temp']>0x0?_0x3c7288[_0x9f26('0x1fa')]:0x0;if(!checkContactEmpty(_0x3e46d6)){_0x3c7288[_0x9f26('0x3d')]=_0x9f26('0x9d');logger[_0x9f26('0x78')](_0x9f26('0x1fc')+_0x3c7288[_0x9f26('0x3f')]);}else{_0x3c7288[_0x9f26('0x6a')]+=_0x3e46d6[_0x9f26('0x96')];_0x3c7288[_0x9f26('0x3d')]=_0x9f26('0x1fd');for(var _0x4ab1c0=0x0;_0x4ab1c0<_0x3e46d6[_0x9f26('0x96')];_0x4ab1c0+=0x1){_0x3c7288[_0x9f26('0x1fe')]+=0x1;if(_[_0x9f26('0xaa')](_0x3e46d6[_0x4ab1c0])||_[_0x9f26('0xaa')](_0x3e46d6[_0x4ab1c0][_0x9f26('0x180')])||_['isNil'](_0x3e46d6[_0x4ab1c0][_0x9f26('0x180')][_0x9f26('0x16a')])){_0x2897bf[_0x9f26('0xcb')](_0x9f26('0x1ff'),_0x3c7288,_0x3e46d6[_0x4ab1c0]);}else{_0x2897bf['checkIsBlackListIvr'](_['pick'](_0x3e46d6[_0x4ab1c0],[_0x9f26('0xd2'),_0x9f26('0x200')]))[_0x9f26('0xb4')](_0x2897bf[_0x9f26('0x1e7')](_0x3c7288,_0x3e46d6[_0x4ab1c0]))[_0x9f26('0xae')](_0x2897bf[_0x9f26('0xca')](_0x9f26('0x201'),_0x3c7288));}}}})[_0x9f26('0xae')](loggerGetContactDialer('[getContactCampaign2]',_0x3c7288,_0x46f946));}};Dialer[_0x9f26('0x17')]['handlePower']=function(_0x9a5d14,_0x105262){var _0x57686f=this;var _0x353deb=[];var _0x7176d8=_0x105262>=0x1?_0x105262:0x1;if(_0x9a5d14[_0x9f26('0x58')]===_0x9f26('0x8')){_0x7176d8=0x1;}var _0x258154=Math[_0x9f26('0x1c4')](_0x9a5d14[_0x9f26('0x50')]*_0x7176d8)-_0x9a5d14[_0x9f26('0x6a')]-_0x9a5d14[_0x9f26('0x1fa')];emitVoiceQueueSummary(_0x9a5d14);if(_0x9a5d14[_0x9f26('0x202')]>0x0){var _0x139377=_0x9a5d14['dialLimitQueue']-_0x9a5d14[_0x9f26('0x6a')]-_0x9a5d14[_0x9f26('0x53')]-_0x9a5d14[_0x9f26('0x1fa')]-_0x9a5d14['pTalking'];if(_0x258154>_0x139377){_0x258154=_0x139377;}}if(_0x258154>0x0){if(_0x9a5d14['dialMethod']===_0x9f26('0x8')){_0x258154=0x1;}if(_0x258154>this[_0x9f26('0x20')]){_0x258154=this['maxNumberOriginate'];}_0x9a5d14[_0x9f26('0x1fa')]+=_0x258154;for(var _0x1ce7fd in this[_0x9f26('0x1e')]){if(typeof this[_0x9f26('0x1e')][_0x1ce7fd]!=='undefined'){if(this[_0x9f26('0x1e')][_0x1ce7fd][_0x9f26('0xa4')]===_0x9f26('0x203')&&this[_0x9f26('0x1e')][_0x1ce7fd][_0x9f26('0xac')]===_0x9f26('0xd8')){_0x353deb[_0x9f26('0x12c')](this['agents'][_0x1ce7fd]['id']);}}}this['getContactDialer'](_0x9a5d14['id'],_0x353deb,_0x258154,_0x9a5d14[_0x9f26('0x1fb')])[_0x9f26('0xb4')](function(_0x6059e4){_0x9a5d14[_0x9f26('0x1fa')]-=_0x258154;_0x9a5d14['temp']=_0x9a5d14['temp']>0x0?_0x9a5d14[_0x9f26('0x1fa')]:0x0;if(!checkContactEmpty(_0x6059e4)){_0x57686f['countReScheduled'](_0x9a5d14)[_0x9f26('0xb4')](sendMessageReschedule(_0x9a5d14))[_0x9f26('0xae')](loggerCatch('[countReScheduled]\x20'));}else{_0x9a5d14[_0x9f26('0x6a')]+=_0x6059e4[_0x9f26('0x96')];_0x9a5d14[_0x9f26('0x3d')]=_0x9a5d14['dialMethod']==='booked'?'ACTIVE':_0x9f26('0x1fd');for(var _0x12b9a2=0x0;_0x12b9a2<_0x6059e4[_0x9f26('0x96')];_0x12b9a2+=0x1){if(_[_0x9f26('0xaa')](_0x6059e4[_0x12b9a2])||_[_0x9f26('0xaa')](_0x6059e4[_0x12b9a2][_0x9f26('0x180')])||_[_0x9f26('0xaa')](_0x6059e4[_0x12b9a2][_0x9f26('0x180')]['phone'])){_0x57686f['emptyContact'](_0x9f26('0x1ff'),_0x9a5d14,_0x6059e4[_0x12b9a2]);}else{_0x57686f['checkIsBlackList'](_[_0x9f26('0xce')](_0x6059e4[_0x12b9a2],[_0x9f26('0xd1'),_0x9f26('0x200')]))[_0x9f26('0xb4')](_0x57686f[_0x9f26('0x1e7')](_0x9a5d14,_0x6059e4[_0x12b9a2]))[_0x9f26('0xae')](_0x57686f[_0x9f26('0xca')](_0x9f26('0x1ff'),_0x9a5d14));}}}})[_0x9f26('0xae')](loggerGetContactDialer(_0x9f26('0x204'),_0x9a5d14,_0x258154));}};Dialer[_0x9f26('0x17')][_0x9f26('0x8f')]=function(_0x4fc3d0){if(_0x4fc3d0['dialLimitQueue']>0x0){var _0x384d2a=_0x4fc3d0[_0x9f26('0x202')]-_0x4fc3d0[_0x9f26('0x6a')]-_0x4fc3d0['talking'];if(_0x384d2a>0x0){this[_0x9f26('0x205')](_0x4fc3d0);}else{loggerPredictiveCalls[_0x9f26('0x78')](_0x9f26('0x206'));}}else{this['tryOriginatePredictive'](_0x4fc3d0);}};Dialer[_0x9f26('0x17')]['tryOriginatePredictive']=function(_0xea68d4){var _0x19b8e7=this;var _0x41f1a9=[];_0xea68d4[_0x9f26('0x6a')]+=0x1;for(var _0x5d1c2a in this['agents']){if(typeof this[_0x9f26('0x1e')][_0x5d1c2a]!=='undefined'){if(this['agents'][_0x5d1c2a][_0x9f26('0xa4')]===_0x9f26('0x203')&&this[_0x9f26('0x1e')][_0x5d1c2a][_0x9f26('0xac')]===_0x9f26('0xd8')){_0x41f1a9[_0x9f26('0x12c')](this[_0x9f26('0x1e')][_0x5d1c2a]['id']);}}}this[_0x9f26('0xc0')](_0xea68d4['id'],_0x41f1a9,0x1,_0xea68d4[_0x9f26('0x1fb')])[_0x9f26('0xb4')](function(_0x144dba){if(!checkContactEmpty(_0x144dba)){checkContactLowerLimitOriginate(_0xea68d4,0x1,0x0);_0x19b8e7['countReScheduled'](_0xea68d4)['then'](sendMessageReschedule(_0xea68d4))[_0x9f26('0xae')](loggerCatch(_0x9f26('0x207')));}else{_0xea68d4[_0x9f26('0x3d')]='RUNNING';if(_['isNil'](_0x144dba[0x0])||_[_0x9f26('0xaa')](_0x144dba[0x0][_0x9f26('0x180')])||_['isNil'](_0x144dba[0x0][_0x9f26('0x180')]['phone'])){_0x19b8e7[_0x9f26('0xcb')](_0x9f26('0x1ff'),_0xea68d4,_0x144dba[0x0]);}else{_0x19b8e7[_0x9f26('0xb5')](_['pick'](_0x144dba[0x0],[_0x9f26('0xd1'),'Contact.phone']))['then'](_0x19b8e7[_0x9f26('0x1e7')](_0xea68d4,_0x144dba[0x0]))[_0x9f26('0xae')](_0x19b8e7[_0x9f26('0xca')]('[actionOriginatePredictive]\x20',_0xea68d4));}}})[_0x9f26('0xae')](loggerGetContactDialer(_0x9f26('0x208'),_0xea68d4,0x1));emitVoiceQueueSummary(_0xea68d4);};Dialer[_0x9f26('0x17')][_0x9f26('0x1db')]=function(_0x1912a0,_0x353d90,_0x284608,_0x2fd144,_0x149597,_0x5a8fe6){loggerPredictive[_0x9f26('0x78')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x9f26('0x78')](_0x9f26('0x209'),_0x1912a0);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x353d90);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x284608);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2fd144);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x20a'),_0x149597);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x44bb17,_0x56f392){if(_0x1912a0<=0x0||isNaN(_0x1912a0)){return _0x56f392(msgResponse(_0x9f26('0x20b'),_0x9f26('0x48'),_0x9f26('0x20c')+_0x1912a0));}if(_0x284608<=0x0||isNaN(_0x284608)){return _0x56f392(msgResponse(_0x9f26('0x20b'),_0x9f26('0x48'),_0x9f26('0x20d')+_0x284608));}if(_0x2fd144<=0x0||isNaN(_0x2fd144)){return _0x56f392(msgResponse(_0x9f26('0x20b'),'Error',_0x9f26('0x20e')+_0x2fd144));}if(_0x353d90<=0x0||isNaN(_0x353d90)){return _0x56f392(msgResponse(_0x9f26('0x20b'),'Error','interval\x20=\x20'+_0x353d90));}if(_0x149597<=0x0||isNaN(_0x149597)){return _0x56f392(msgResponse(_0x9f26('0x20b'),'Error',_0x9f26('0x20f')+_0x149597));}_0x5a8fe6=_0x5a8fe6||0x0;var _0x47c1bc=0x1/_0x284608;var _0x4b33ad=0x0;var _0x3b735f=0x0;var _0x218864=0x0;var _0x78367=0x0;for(var _0xf2d440=0x0;_0x218864<_0x149597;_0xf2d440+=0x1){_0x3b735f=_0xf2d440/_0x353d90;_0x4b33ad=(_0x2fd144*_0x3b735f+_0x5a8fe6)/_0x47c1bc;_0x218864=erlangb(_0x4b33ad,_0x1912a0);_0x78367=_0x4b33ad/_0x1912a0*(0x1-erlangb(_0x4b33ad,_0x1912a0));}return _0x44bb17({'erlangCalls':_0xf2d440,'erlangCallToSecond':_0x353d90/_0xf2d440,'erlangAbandonmentRate':_0x218864,'erlangBusyFactor':_0x78367});});};Dialer['prototype']['busyFactor']=function(_0x23a4a7,_0xa228fa,_0x3fb66d,_0x2fd88c,_0x36cd69,_0x30a3e2){loggerPredictive['info'](_0x9f26('0x210'));loggerPredictive[_0x9f26('0x78')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23a4a7);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x211'),_0xa228fa);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x212'),_0x3fb66d);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x213'),_0x2fd88c);loggerPredictive['info'](_0x9f26('0x214'),_0x36cd69);loggerPredictive[_0x9f26('0x78')](_0x9f26('0x82'));return new BPromise(function(_0x571a00,_0x482b7c){if(_0x23a4a7<=0x0||isNaN(_0x23a4a7)){return _0x482b7c(msgResponse('[busyFactor]',_0x9f26('0x48'),_0x9f26('0x20c')+_0x23a4a7));}if(_0x3fb66d<=0x0||isNaN(_0x3fb66d)){return _0x482b7c(msgResponse('[busyFactor]',_0x9f26('0x48'),_0x9f26('0x20d')+_0x3fb66d));}if(_0x2fd88c<=0x0||isNaN(_0x2fd88c)){return _0x482b7c(msgResponse('[busyFactor]','Error',_0x9f26('0x20e')+_0x2fd88c));}if(_0xa228fa<=0x0||isNaN(_0xa228fa)){return _0x482b7c(msgResponse(_0x9f26('0x215'),'Error','interval\x20=\x20'+_0xa228fa));}if(_0x36cd69<=0x0||isNaN(_0x36cd69)){return _0x482b7c(msgResponse(_0x9f26('0x215'),_0x9f26('0x48'),_0x9f26('0x216')+_0x36cd69));}_0x30a3e2=_0x30a3e2||0x0;var _0x440b51=0x1/_0x3fb66d;var _0x4c33c8=0x0;var _0x2c5450=0x0;var _0x5daae4=0x0;var _0x22e7a9=0x0;for(var _0x2f95d1=0x0;_0x22e7a9<_0x36cd69;_0x2f95d1+=0x1){_0x2c5450=_0x2f95d1/_0xa228fa;_0x4c33c8=(_0x2fd88c*_0x2c5450+_0x30a3e2)/_0x440b51;_0x5daae4=erlangb(_0x4c33c8,_0x23a4a7);_0x22e7a9=_0x4c33c8/_0x23a4a7*(0x1-erlangb(_0x4c33c8,_0x23a4a7));}return _0x571a00({'erlangCalls':_0x2f95d1,'erlangCallToSecond':_0xa228fa/_0x2f95d1,'erlangAbandonmentRate':_0x5daae4,'erlangBusyFactor':_0x22e7a9});});};module['exports']=Dialer; \ No newline at end of file +var _0x4790=['syncOriginateResponse','responsetime','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','handleIvr','dialOrderByScheduledAt','temp','[getContactCampaign2][Empty]','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','not_inuse','ACTIVE','RUNNING','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','Umin\x20=\x20','util','lodash','bluebird','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','newexten','syncQueueMember','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','milliseconds','seconds','type','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice_queue:save','ivr','campaign:ivr:%s','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','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','inspect','error','stack','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','prototype','clearZombieChannels','[uniqueid]','actions','sequence','enqueue','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','emit','custom:amd','buildObj','saveInDb','[syncHangupInAMD]','value','MACHINE','Machine','AMD','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','VoiceQueueId','countnoanswerretry','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','reason','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','outboundDropCallsDayTimeout','Drop','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','predictiveIntervalDroppedCallsCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','paused','stateinterface','push','pick','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','roundrobin','[Catch][Preview][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','run','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','interval','content','true','command','iftime\x20%s,%s','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','dialMethod','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','substring','dialCutDigit','trim','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error'];(function(_0x31c0b7,_0x5c3eb9){var _0x46e490=function(_0x3e7eb5){while(--_0x3e7eb5){_0x31c0b7['push'](_0x31c0b7['shift']());}};_0x46e490(++_0x5c3eb9);}(_0x4790,0x84));var _0x0479=function(_0x4c9d00,_0x5092d5){_0x4c9d00=_0x4c9d00-0x0;var _0x4a73f5=_0x4790[_0x4c9d00];return _0x4a73f5;};'use strict';var util=require(_0x0479('0x0'));var _=require(_0x0479('0x1'));var BPromise=require(_0x0479('0x2'));var uuid=require(_0x0479('0x3'));var moment=require(_0x0479('0x4'));var rr=require('rr');var md5=require(_0x0479('0x5'));var Redis=require('ioredis');var ut=require(_0x0479('0x6'));var config=require(_0x0479('0x7'));var logger=require(_0x0479('0x8'))(_0x0479('0x9'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x0479('0x8'))(_0x0479('0xa'));var loggerPredictiveCalls=require(_0x0479('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x0479('0x8'))(_0x0479('0xb'));var ami=require(_0x0479('0xc'));config[_0x0479('0xd')]=_[_0x0479('0xe')](config['redis'],{'host':_0x0479('0xf'),'port':0x18eb});var io=require(_0x0479('0x10'))(new Redis(config['redis']));var cmHopper=require(_0x0479('0x11'));var cmHopperHistory=require(_0x0479('0x12'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x0479('0x13'));var History=require(_0x0479('0x14'));var Final=require('./final');var AgentComplete=require(_0x0479('0x15'));var QueueCallerAbandon=require(_0x0479('0x16'));var Hangup=require(_0x0479('0x17'));var ipAgi=process['env'][_0x0479('0x18')]||_0x0479('0x19');var strategy={'rrmemory':_0x0479('0x1a'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x5f0243){this[_0x0479('0x1b')]=this[_0x0479('0x1b')]?this[_0x0479('0x1b')][_0x0479('0x1c')](_0x5f0243):_0x5f0243();};function Dialer(_0x34f302,_0x13d590){this['sequence']=new Sequence();this[_0x0479('0x1d')]=_0x13d590;this[_0x0479('0x1e')]=_0x34f302[_0x0479('0x1e')];this[_0x0479('0x1f')]=_0x34f302[_0x0479('0x1f')];this[_0x0479('0x20')]=_0x34f302[_0x0479('0x20')];this[_0x0479('0x21')]=_0x34f302[_0x0479('0x21')];this[_0x0479('0x22')]=config[_0x0479('0x22')]||0x2;this[_0x0479('0x23')]={};this['actions']={};this['contactsId']={};this[_0x0479('0x24')]={};this[_0x0479('0x25')]={};this[_0x0479('0x26')]={};this[_0x0479('0x27')]={};this[_0x0479('0x28')]={};this[_0x0479('0x29')]={};this[_0x0479('0x2a')]={};ami['on'](_0x0479('0x2b'),this[_0x0479('0x2c')]['bind'](this));ami['on']('queuecallerabandon',this[_0x0479('0x2d')][_0x0479('0x2e')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x0479('0x2e')](this));ami['on'](_0x0479('0x2f'),this[_0x0479('0x30')]['bind'](this));ami['on'](_0x0479('0x31'),this['syncQueueSummary'][_0x0479('0x2e')](this));ami['on'](_0x0479('0x32'),this['syncHangup']['bind'](this));ami['on'](_0x0479('0x33'),this['syncNewExten']['bind'](this));ami['on']('varset',this['syncVarSet'][_0x0479('0x2e')](this));ami['on']('queuemember',this[_0x0479('0x34')][_0x0479('0x2e')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete']['bind'](this));this[_0x0479('0x35')]();this[_0x0479('0x36')]();}function isNotNull(_0x26260c){return _0x26260c!==null&&!_[_0x0479('0x37')](_0x26260c);}function checkIsLoggedIn(_0x47482b,_0x52a995){return function(){if(_0x52a995<=0x0){_0x47482b[_0x0479('0x38')]=_0x0479('0x39');throw _0x47482b[_0x0479('0x3a')]+_0x0479('0x3b');}};}function isActive(_0x190932){return _0x190932;}function checkIsActive(_0x2aef6b,_0x58248d){return function(){if(!isActive(_0x58248d)){_0x2aef6b[_0x0479('0x38')]=_0x0479('0x3c');throw _0x2aef6b[_0x0479('0x3a')]+'\x20NOT\x20Active';}};}function checkInterval(_0x55492e){return function(){if(!isNotNull(_0x55492e[_0x0479('0x3d')])){_0x55492e[_0x0479('0x38')]=_0x0479('0x3e');throw _0x55492e[_0x0479('0x3a')]+_0x0479('0x3f');}if(!isNotNull(_0x55492e[_0x0479('0x3d')][_0x0479('0x40')])){_0x55492e[_0x0479('0x38')]='INTERVAL_IS_NULL';throw _0x55492e[_0x0479('0x3a')]+_0x0479('0x3f');}if(!isNotNull(_['isEmpty'](_0x55492e[_0x0479('0x3d')][_0x0479('0x40')]))){_0x55492e['message']='INTERVAL_IS_NULL';throw _0x55492e['name']+_0x0479('0x3f');}};}function msgResponse(_0x370a2b,_0x121cd1,_0x4ec8ae){return{'action':_0x370a2b,'response':_0x121cd1,'message':_0x4ec8ae,'stack':_0x4ec8ae};}function myreject(_0x38e59d){return function(_0x51490b){return _0x38e59d(msgResponse(_0x0479('0x41'),_0x0479('0x42'),JSON['stringify'](_0x51490b)));};}function getSeconds(_0x4c9c3d,_0x2a1897){var _0xcc01b1=moment(_0x4c9c3d)[_0x0479('0x43')](0x0);var _0x48fa53=moment(_0x2a1897)[_0x0479('0x43')](0x0);return _0xcc01b1['diff'](_0x48fa53,_0x0479('0x44'));}function emit(_0x104c76,_0x1c4f18,_0x44ec48){io['to'](_0x104c76)['emit'](_0x1c4f18,_0x44ec48);}function emitVoiceQueueSummary(_0x5a5458){if(_0x5a5458[_0x0479('0x45')]===_0x0479('0x46')){var _0x23392f={'id':_0x5a5458['id'],'name':_0x5a5458[_0x0479('0x3a')],'strategy':_0x5a5458[_0x0479('0x47')],'answered':_0x5a5458[_0x0479('0x48')],'available':_0x5a5458['available'],'loggedIn':_0x5a5458[_0x0479('0x49')],'pTalking':_0x5a5458[_0x0479('0x4a')],'sumBillable':_0x5a5458[_0x0479('0x4b')],'sumDuration':_0x5a5458[_0x0479('0x4c')],'sumHoldTime':_0x5a5458[_0x0479('0x4d')]||0x0,'talking':_0x5a5458[_0x0479('0x4e')],'total':_0x5a5458[_0x0479('0x4f')],'type':_0x5a5458[_0x0479('0x45')],'unmanaged':_0x5a5458['unmanaged'],'abandoned':_0x5a5458[_0x0479('0x50')],'waiting':_0x5a5458['waiting'],'loggedInDb':_0x5a5458[_0x0479('0x51')],'dialActive':_0x5a5458[_0x0479('0x52')],'dialMethod':_0x5a5458['dialMethod'],'dialOriginateCallerIdName':_0x5a5458[_0x0479('0x53')],'dialOriginateCallerIdNumber':_0x5a5458['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5a5458[_0x0479('0x54')],'dialPrefix':_0x5a5458[_0x0479('0x55')],'outboundAnswerAgiCallsDay':_0x5a5458[_0x0479('0x56')],'outboundAnswerCallsDay':_0x5a5458[_0x0479('0x57')],'outboundBlacklistCallsDay':_0x5a5458[_0x0479('0x58')],'outboundBusyCallsDay':_0x5a5458['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5a5458['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5a5458[_0x0479('0x59')],'outboundDropCallsDayCallersExit':_0x5a5458[_0x0479('0x5a')],'outboundDropCallsDayTimeout':_0x5a5458['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5a5458[_0x0479('0x5b')],'outboundNoSuchCallsDay':_0x5a5458[_0x0479('0x5c')],'outboundOriginateFailureCallsDay':_0x5a5458['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5a5458['outboundReCallsDay'],'outboundRejectCallsDay':_0x5a5458[_0x0479('0x5d')],'outboundUnknownCallsDay':_0x5a5458[_0x0479('0x5e')],'predictiveIntervalAnsweredCalls':_0x5a5458['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5a5458[_0x0479('0x5f')],'predictiveIntervalAvgTalktime':_0x5a5458[_0x0479('0x60')],'predictiveIntervalDroppedCallsCallersExit':_0x5a5458['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x5a5458[_0x0479('0x61')],'predictiveIntervalErlangCalls':_0x5a5458[_0x0479('0x62')],'predictiveIntervalErlangCallsDroppedCalls':_0x5a5458[_0x0479('0x63')],'predictiveIntervalHitRate':_0x5a5458[_0x0479('0x64')],'predictiveIntervalMultiplicativeFactor':_0x5a5458[_0x0479('0x65')],'predictiveIntervalPauses':_0x5a5458[_0x0479('0x66')],'predictiveIntervalAvailable':_0x5a5458[_0x0479('0x67')],'predictiveIntervalTotalCalls':_0x5a5458[_0x0479('0x68')],'message':_0x5a5458[_0x0479('0x38')],'originated':_0x5a5458[_0x0479('0x69')],'erlangCalls':_0x5a5458[_0x0479('0x6a')],'erlangCallToSecond':_0x5a5458[_0x0479('0x6b')],'erlangAbandonmentRate':_0x5a5458['erlangAbandonmentRate'],'erlangBusyFactor':_0x5a5458[_0x0479('0x6c')],'startPredictive':_0x5a5458[_0x0479('0x26')],'startProgressive':_0x5a5458[_0x0479('0x27')]};if(_0x5a5458[_0x0479('0x6d')]){_0x23392f[_0x0479('0x6d')]={'id':_0x5a5458[_0x0479('0x6d')]['id'],'name':_0x5a5458[_0x0479('0x6d')][_0x0479('0x3a')],'active':_0x5a5458[_0x0479('0x6d')][_0x0479('0x6e')],'callerid':_0x5a5458[_0x0479('0x6d')][_0x0479('0x6f')]};}if(_0x5a5458[_0x0479('0x3d')]){_0x23392f[_0x0479('0x3d')]={'id':_0x5a5458[_0x0479('0x3d')]['id'],'name':_0x5a5458[_0x0479('0x3d')][_0x0479('0x3a')]};}var _0xce2f8a=md5(JSON[_0x0479('0x70')](_0x23392f));if(_0x5a5458[_0x0479('0x5')]!==_0xce2f8a){_0x5a5458[_0x0479('0x5')]=_0xce2f8a;emit(util[_0x0479('0x71')]('voice:queue:%s',_0x23392f[_0x0479('0x3a')]),_0x0479('0x72'),_0x23392f);}}}function emitCampaignSummary(_0x3462e5){if(_0x3462e5[_0x0479('0x45')]===_0x0479('0x73')){emit(util[_0x0479('0x71')](_0x0479('0x74'),_0x3462e5['name']),'campaign:save',_0x3462e5);}}function checkGetDataPredictive(_0xdae075){if(isNotNull(_0xdae075)&&!_[_0x0479('0x75')](_0xdae075)){loggerPredictive[_0x0479('0x76')](_0x0479('0x77'));loggerPredictive['info'](_0x0479('0x78'),_0xdae075[_0x0479('0x68')]);loggerPredictive[_0x0479('0x76')](_0x0479('0x79'),_0xdae075[_0x0479('0x7a')]);loggerPredictive[_0x0479('0x76')](_0x0479('0x7b'),_0xdae075[_0x0479('0x61')]);loggerPredictive[_0x0479('0x76')](_0x0479('0x7c'),_0xdae075['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x0479('0x7d'),_0xdae075[_0x0479('0x5f')]);loggerPredictive[_0x0479('0x76')](_0x0479('0x7e'),_0xdae075[_0x0479('0x60')]);loggerPredictive[_0x0479('0x76')](_0x0479('0x7f'));if(_0xdae075['predictiveIntervalTotalCalls']>0x0){if(!_[_0x0479('0x37')](_0xdae075[_0x0479('0x60')])&&_0xdae075[_0x0479('0x60')]>0x0){return!![];}loggerPredictive[_0x0479('0x76')](_0x0479('0x80'));if(!_[_0x0479('0x37')](_0xdae075[_0x0479('0x5f')])&&_0xdae075[_0x0479('0x5f')]>0x0){return!![];}loggerPredictive['info'](_0x0479('0x81'));}else{loggerPredictive[_0x0479('0x76')](_0x0479('0x82'));}}else{loggerPredictive['info'](_0x0479('0x83'));}return![];}function mergeDataErlangB(_0x3f9873){return function(_0x16b8bd){loggerPredictive[_0x0479('0x76')](_0x0479('0x84'));loggerPredictive[_0x0479('0x76')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x16b8bd[_0x0479('0x6a')]);loggerPredictive[_0x0479('0x76')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x16b8bd[_0x0479('0x6b')]);loggerPredictive[_0x0479('0x76')](_0x0479('0x85'),_0x16b8bd[_0x0479('0x86')]);loggerPredictive['info'](_0x0479('0x87'),_0x16b8bd[_0x0479('0x6c')]);loggerPredictive[_0x0479('0x76')](_0x0479('0x85'),_0x16b8bd[_0x0479('0x86')]);loggerPredictive[_0x0479('0x76')](_0x0479('0x7f'));_[_0x0479('0x88')](_0x3f9873,_0x16b8bd);};}function getDiff(_0x1b1187){var _0x3eaafa=moment()[_0x0479('0x43')](0x0);var _0x77c4b4=moment(_0x1b1187)[_0x0479('0x43')](0x0);return _0x3eaafa[_0x0479('0x89')](_0x77c4b4,'seconds');}function ifInterval(_0x7a7200,_0x15cdb6){if(_[_0x0479('0x37')](_0x15cdb6)){return![];}return getDiff(_0x15cdb6)<_0x7a7200*0x3c;}function freeVariablesPredictive(_0xbe17a6){if(isNotNull(_0xbe17a6)){if(!_[_0x0479('0x37')](_0xbe17a6[_0x0479('0x27')])){_0xbe17a6[_0x0479('0x27')]=undefined;loggerPredictive[_0x0479('0x76')](_0xbe17a6[_0x0479('0x3a')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x0479('0x37')](_0xbe17a6[_0x0479('0x26')])){_0xbe17a6[_0x0479('0x26')]=undefined;loggerPredictive[_0x0479('0x76')](_0xbe17a6['name'],_0x0479('0x8a'));}if(!_['isUndefined'](_0xbe17a6[_0x0479('0x8b')])){clearInterval(_0xbe17a6[_0x0479('0x8b')]);_0xbe17a6[_0x0479('0x8b')]=undefined;loggerPredictive['info'](_0xbe17a6[_0x0479('0x3a')],_0x0479('0x8c'));}}}function erlangb(_0xfe0ea2,_0x410d0c){if(_0x410d0c===0x0){return 0x0;}var _0x435969=0x1;for(var _0x22338f=0x1;_0x22338f<=_0x410d0c;_0x22338f+=0x1){_0x435969=0x1+_0x435969*_0x22338f/_0xfe0ea2;}return 0x1/_0x435969;}function isVoiceQueueOutbound(_0x251d00){return _0x251d00===_0x0479('0x46');}function isNotPreview(_0x2c734b){return _0x2c734b!==_0x0479('0x1d');}function isCampaignIvr(_0x616007){return _0x616007===_0x0479('0x73');}function getCallerId(_0x2d816c,_0x9dedd1,_0x36652f){if(!_[_0x0479('0x37')](_0x36652f)&&typeof _0x36652f===_0x0479('0x8d')&&!_['isEmpty'](_0x36652f)){if(!_[_0x0479('0x37')](_0x9dedd1)&&typeof _0x9dedd1===_0x0479('0x8d')&&!_[_0x0479('0x75')](_0x9dedd1)){return util[_0x0479('0x71')](_0x0479('0x8e'),_0x9dedd1,_0x36652f);}return util[_0x0479('0x71')](_0x0479('0x8e'),_0x36652f,_0x36652f);}if(!_['isUndefined'](_0x2d816c)&&typeof _0x2d816c===_0x0479('0x8d')&&!_[_0x0479('0x75')](_0x2d816c)){return _0x2d816c;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x246e9f,_0x2750a2){return function(_0xe7edd4){freeVariablesPredictive(_0x2750a2);emitVoiceQueueSummary(_0x2750a2);emitCampaignSummary(_0x2750a2);loggerSyncQueueSummary['error'](_0x246e9f,util[_0x0479('0x8f')](_0xe7edd4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1c5f3d,_0x387d9a){return function(_0x41e716){loggerPredictive[_0x0479('0x90')](_0x387d9a['name'],_0x1c5f3d);loggerPredictive[_0x0479('0x90')](_0x41e716[_0x0479('0x91')]);freeVariablesPredictive(_0x387d9a);};}function loggerCatch(_0x51f793){return function(_0xc14c43){logger[_0x0479('0x90')](_0x51f793,util['inspect'](_0xc14c43,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5f1c14){return _0x5f1c14&&!_[_0x0479('0x37')](_0x5f1c14)&&_0x5f1c14['length']>0x0;}function decremetOriginate(_0x159662){if(!_[_0x0479('0x37')](_0x159662)&&_0x159662!==null){if(typeof _0x159662[_0x0479('0x69')]!==_0x0479('0x92')){if(_0x159662['originated']>0x0){_0x159662[_0x0479('0x69')]-=0x1;}else{logger[_0x0479('0x90')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x0479('0x93'));}}function checkContactLowerLimitOriginate(_0x6f3dff,_0x268972,_0x2c0d6a){if(_0x268972>_0x2c0d6a){for(var _0x256adf=0x0;_0x256adf<_0x268972-_0x2c0d6a;_0x256adf+=0x1){decremetOriginate(_0x6f3dff);}}}function loggerGetContactDialer(_0x5c4412,_0xa3d114,_0x3a3fbe){return function(_0x18cc46){checkContactLowerLimitOriginate(_0xa3d114,_0x3a3fbe,0x0);logger[_0x0479('0x90')](_0x5c4412,util[_0x0479('0x8f')](_0x18cc46,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4b6b7){return function(_0x7fade5){if(isNotNull(_0x7fade5)&&isNotNull(_0x7fade5[0x0])){if(_0x7fade5[0x0]['contactsRescheduled']>0x0){_0x4b6b7[_0x0479('0x38')]=_0x0479('0x94');logger['info'](_0x0479('0x95')+_0x4b6b7['name'],_0x7fade5[0x0][_0x0479('0x96')],_0x0479('0x97'));}else{_0x4b6b7[_0x0479('0x38')]=_0x0479('0x98');logger[_0x0479('0x76')]('[getContactDialer2][Empty]'+_0x4b6b7[_0x0479('0x3a')]);}}};}function notSendMessagesQueue(_0x32023d){if(_0x32023d[_0x0479('0x99')]){freeVariablesPredictive(_0x32023d);if(_0x32023d[_0x0479('0x69')]===0x0&&_0x32023d[_0x0479('0x4e')]===0x0&&_0x32023d[_0x0479('0x9a')]===0x0&&(_0x32023d[_0x0479('0x4a')]||0x0)===0x0){_0x32023d['sendMessageOneNotActive']=![];_0x32023d[_0x0479('0x9b')]=0x0;_0x32023d[_0x0479('0x38')]=_0x0479('0x3c');loggerSyncQueueSummary[_0x0479('0x90')](_0x0479('0x9c'),_0x32023d['name'],_0x0479('0x9d'));}else{_0x32023d[_0x0479('0x38')]=_0x0479('0x9e');loggerSyncQueueSummary[_0x0479('0x90')](_0x0479('0x9c'),_0x32023d[_0x0479('0x3a')],_0x0479('0x9f'));}emitVoiceQueueSummary(_0x32023d);}}function notSendMessagesCampaign(_0x1c357b){if(_0x1c357b[_0x0479('0x99')]){if(_0x1c357b[_0x0479('0x69')]===0x0){_0x1c357b[_0x0479('0x99')]=![];_0x1c357b['message']=_0x0479('0x3c');loggerSyncQueueSummary[_0x0479('0x90')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1c357b[_0x0479('0x3a')],_0x0479('0x9d'));}else{_0x1c357b[_0x0479('0x38')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x0479('0x90')](_0x0479('0xa0'),_0x1c357b['name'],_0x0479('0x9f'));}emitCampaignSummary(_0x1c357b);}}function createObjHistory(_0x29b963,_0x519704,_0x63f017,_0x1614e9,_0x4ecf6a){_0x29b963[_0x0479('0x38')]=_0x63f017;var _0x6e8f31=new Action(_0x29b963,_0x519704);var _0x4916fa=new History(_0x6e8f31);_0x4916fa[_0x0479('0xa1')]=_0x1614e9;_0x4916fa[_0x0479('0xa2')]=_0x4ecf6a;_0x4916fa[_0x0479('0xa3')]=_0x6e8f31[_0x0479('0xa4')];return _0x4916fa;}Dialer[_0x0479('0xa5')][_0x0479('0x36')]=function(){var _0x4246bc=this;setInterval(function(){_0x4246bc[_0x0479('0xa6')](_0x4246bc['uniqueId'],_0x0479('0xa7'));_0x4246bc[_0x0479('0xa6')](_0x4246bc[_0x0479('0xa8')],'[actions]');},0x32c8);};Dialer[_0x0479('0xa5')][_0x0479('0xa6')]=function(_0x4bc8a8,_0x45a66a){var _0xd27b93=this;for(var _0x362cc9 in _0x4bc8a8){if(typeof _0x4bc8a8[_0x362cc9]!==_0x0479('0x92')){this[_0x0479('0xa9')][_0x0479('0xaa')](function(){if(!_['isNil'](_0x4bc8a8[_0x362cc9])){return ami[_0x0479('0xab')]({'action':_0x0479('0xac'),'channel':_0x4bc8a8[_0x362cc9][_0x0479('0xad')]})[_0x0479('0xae')](function(_0x1f1281){if(_0x1f1281[_0x0479('0x38')]===_0x0479('0xaf')){setTimeout(function(){if(_0x4bc8a8[_0x362cc9]&&_0x4bc8a8[_0x362cc9]['type']!==_0x0479('0x73')){_0xd27b93[_0x0479('0xb0')](_0xd27b93[_0x0479('0x1e')][_0x4bc8a8[_0x362cc9]['queue']]);logger['error']('[Dialer][checkChannel]',_0x45a66a,_0x362cc9,_0x4bc8a8[_0x362cc9][_0x0479('0xb1')]);delete _0x4bc8a8[_0x362cc9];}if(_0x4bc8a8[_0x362cc9]&&_0x4bc8a8[_0x362cc9][_0x0479('0x45')]==='ivr'){_0xd27b93[_0x0479('0xb0')](_0xd27b93['campaigns'][_0x4bc8a8[_0x362cc9][_0x0479('0xb1')]]);logger['error'](_0x0479('0xb2'),_0x45a66a,_0x362cc9,_0x4bc8a8[_0x362cc9][_0x0479('0xb1')]);delete _0x4bc8a8[_0x362cc9];}},0x2328);}});}});}}};Dialer[_0x0479('0xa5')][_0x0479('0xb3')]=function(_0x400f1e){return BPromise[_0x0479('0xb4')]()[_0x0479('0xb5')](cmHopper[_0x0479('0xb3')](_0x400f1e))[_0x0479('0xae')](loggerCatch(_0x0479('0xb6')));};Dialer[_0x0479('0xa5')][_0x0479('0xb7')]=function(_0x5d9f14){return BPromise['resolve']()[_0x0479('0xb5')](cmHopperBlack[_0x0479('0xb7')](_0x5d9f14))['catch'](loggerCatch(_0x0479('0xb8')));};Dialer['prototype'][_0x0479('0xb9')]=function(_0x163054){return BPromise[_0x0479('0xb4')]()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x163054))[_0x0479('0xae')](loggerCatch(_0x0479('0xba')));};Dialer['prototype'][_0x0479('0xbb')]=function(_0x3d4333){return BPromise[_0x0479('0xb4')]()[_0x0479('0xb5')](cmHopperHistory['avgHandleTime'](_0x3d4333))[_0x0479('0xae')](loggerCatch(_0x0479('0xbc')));};Dialer[_0x0479('0xa5')][_0x0479('0xbd')]=function(_0x25c827){return BPromise[_0x0479('0xb4')]()['then'](cmHopper[_0x0479('0xbd')](_0x25c827))[_0x0479('0xae')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x0479('0xa5')]['unlockContact']=function(_0x243553,_0x1acfda,_0xa9e5f8){return BPromise[_0x0479('0xb4')]()[_0x0479('0xb5')](cmHopper['unlockContact'](_0x243553,_0x1acfda,_0xa9e5f8))[_0x0479('0xae')](loggerCatch(_0x0479('0xbe')));};Dialer[_0x0479('0xa5')][_0x0479('0xbf')]=function(_0x25b39c,_0x40d768,_0x4d0f23,_0x11b91c){return BPromise['resolve']()[_0x0479('0xb5')](cmHopper['getContactDialer'](_0x25b39c,_0x40d768,_0x4d0f23,_0x11b91c))[_0x0479('0xae')](loggerCatch(_0x0479('0xc0')));};Dialer[_0x0479('0xa5')][_0x0479('0xc1')]=function(_0x7e032,_0x4a5c7f,_0x34b9a9){return BPromise[_0x0479('0xb4')]()[_0x0479('0xb5')](cmHopper[_0x0479('0xc1')](_0x7e032,_0x4a5c7f,_0x34b9a9))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x5a0673){return BPromise[_0x0479('0xb4')]()[_0x0479('0xb5')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5a0673))[_0x0479('0xae')](loggerCatch(_0x0479('0xc2')));};Dialer[_0x0479('0xa5')][_0x0479('0xc3')]=function(_0x14a4cf){return BPromise[_0x0479('0xb4')]()[_0x0479('0xb5')](cmHopper[_0x0479('0xc3')](_0x14a4cf))[_0x0479('0xae')](loggerCatch(_0x0479('0xc4')));};Dialer[_0x0479('0xa5')][_0x0479('0xc5')]=function(_0xc8592e){return BPromise[_0x0479('0xb4')]()[_0x0479('0xb5')](cmHopperHistory[_0x0479('0xc5')](_0xc8592e))['catch'](loggerCatch(_0x0479('0xc6')));};Dialer[_0x0479('0xa5')][_0x0479('0xb0')]=function(_0x35fefd){if(!_[_0x0479('0x37')](_0x35fefd)&&_0x35fefd!==null){if(typeof _0x35fefd[_0x0479('0x69')]!==_0x0479('0x92')){if(_0x35fefd['originated']>0x0){_0x35fefd[_0x0479('0x69')]-=0x1;}else{logger[_0x0479('0x90')](_0x0479('0xc7'));}}}else{logger['error'](_0x0479('0xc8'));}};Dialer[_0x0479('0xa5')][_0x0479('0xc9')]=function(_0xddceb2,_0x109abe){var _0x4c7245=this;return function(_0x7cbc07){_0x4c7245[_0x0479('0xb0')](_0x109abe);logger['error'](_0xddceb2,util[_0x0479('0x8f')](_0x7cbc07,{'showHidden':![],'depth':null}));};};Dialer[_0x0479('0xa5')][_0x0479('0xca')]=function(_0x9ea8d7,_0xd6fa7d,_0x5ac238){var _0x154c79={'state':0x19,'statedesc':'notFound'};this[_0x0479('0xb0')](_0xd6fa7d);this['saveInDb'](_[_0x0479('0x88')](_0x154c79,_['pick'](_0x5ac238,[_0x0479('0xcb'),_0x0479('0xcc'),_0x0479('0xcd'),'VoiceQueueId',_0x0479('0xce')])),_0x0479('0xcf'),'[emptyContact]');logger[_0x0479('0x90')](_0x9ea8d7);};Dialer['prototype'][_0x0479('0xd0')]=function(_0x173441){return _0x173441===_0x0479('0xd1');};Dialer[_0x0479('0xa5')][_0x0479('0xd2')]=function(_0x131707){return!_[_0x0479('0x37')](_0x131707)&&_0x131707&&!_[_0x0479('0x37')](_0x131707[_0x0479('0x3a')])&&!_[_0x0479('0x37')](_0x131707[_0x0479('0x6e')])&&_0x131707[_0x0479('0x6e')]&&(this['trunks'][util['format'](_0x0479('0xd3'),_0x131707[_0x0479('0x3a')])][_0x0479('0xac')]===_0x0479('0xd4')||this['trunks'][util[_0x0479('0x71')](_0x0479('0xd3'),_0x131707[_0x0479('0x3a')])]['status']==='unmonitored');};Dialer[_0x0479('0xa5')]['saveInDb']=function(_0x2810f9,_0xb9a68a,_0x262bd8){this[_0x0479('0xc5')](_0x2810f9)[_0x0479('0xae')](loggerCatch(_0xb9a68a));this[_0x0479('0xc3')](_0x2810f9)[_0x0479('0xae')](loggerCatch(_0x262bd8));};Dialer[_0x0479('0xa5')]['syncVarSet']=function(_0x3ea14e){var _0x4e5486=this[_0x0479('0x24')][_0x3ea14e[_0x0479('0xd5')]];var _0x31e4f9;if(!_[_0x0479('0xd6')](_0x3ea14e)&&!_[_0x0479('0xd6')](_0x3ea14e[_0x0479('0xd7')])&&!_[_0x0479('0xd6')](_0x3ea14e[_0x0479('0xd7')][_0x0479('0xd8')])&&_0x3ea14e[_0x0479('0xd9')]===_0x0479('0xda')&&_0x4e5486){if(_0x4e5486[_0x0479('0x45')]!=='ivr'&&this['voiceQueues'][_0x4e5486[_0x0479('0xb1')]][_0x0479('0xdb')]&&_0x3ea14e['value']===_0x0479('0xdc')){delete this[_0x0479('0x24')][_0x3ea14e[_0x0479('0xd5')]];this['updateOriginated'](this[_0x0479('0x1e')][_0x4e5486[_0x0479('0xb1')]]);this[_0x0479('0x1e')][_0x4e5486[_0x0479('0xb1')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x4e5486[_0x0479('0xb1')]][_0x0479('0x56')]+=0x1;_0x31e4f9=new Hangup(_0x4e5486,_0x3ea14e);_0x31e4f9[_0x0479('0xa1')]=0x12;_0x31e4f9[_0x0479('0xa2')]=_0x0479('0xdd');_0x31e4f9[_0x0479('0xde')]='AMD';ami[_0x0479('0xdf')](_0x0479('0xe0'),ut[_0x0479('0xe1')](_0x31e4f9,'amd'));this[_0x0479('0xe2')](_0x31e4f9,'[syncHangupInAMD][createHistory]',_0x0479('0xe3'));}if(_0x4e5486[_0x0479('0x45')]!=='ivr'&&this['voiceQueues'][_0x4e5486[_0x0479('0xb1')]]['dialAMDActive']&&_0x3ea14e[_0x0479('0xe4')]===_0x0479('0xe5')){var _0x45f57d=this;return new BPromise(function(_0x4bd854,_0x22d31d){delete _0x45f57d[_0x0479('0x24')][_0x3ea14e[_0x0479('0xd5')]];_0x45f57d[_0x0479('0xb0')](_0x45f57d['voiceQueues'][_0x4e5486[_0x0479('0xb1')]]);_0x45f57d[_0x0479('0x1e')][_0x4e5486[_0x0479('0xb1')]][_0x0479('0x57')]+=0x1;_0x45f57d[_0x0479('0x1e')][_0x4e5486[_0x0479('0xb1')]][_0x0479('0x56')]+=0x1;var _0x116134=_0x45f57d[_0x0479('0x1e')][_0x4e5486[_0x0479('0xb1')]];var _0x4b4fea=new Hangup(_0x4e5486,_0x3ea14e);_0x4b4fea[_0x0479('0xa1')]=0x13;_0x4b4fea[_0x0479('0xa2')]=_0x0479('0xe6');_0x4b4fea[_0x0479('0xde')]=_0x0479('0xe7');_0x4b4fea['countmachineretry']+=0x1;_0x4b4fea[_0x0479('0xe8')]+=0x1;_0x4b4fea[_0x0479('0xe9')]=!![];ami[_0x0479('0xdf')](_0x0479('0xe0'),ut['buildObj'](_0x4b4fea,'amd'));_0x45f57d[_0x0479('0xc5')](_0x4b4fea)[_0x0479('0xae')](loggerCatch(_0x0479('0xea')));if(_0x4b4fea[_0x0479('0xeb')]+_0x4b4fea[_0x0479('0xec')]+_0x4b4fea['countnoanswerretry']+_0x4b4fea[_0x0479('0xed')]+_0x4b4fea[_0x0479('0xee')]+_0x4b4fea['countabandonedretry']+_0x4b4fea[_0x0479('0xef')]+_0x4b4fea[_0x0479('0xf0')]>=_0x116134[_0x0479('0xf1')]){_0x45f57d[_0x0479('0xf2')](_0x4b4fea,_0x4bd854,_0x22d31d,_0x0479('0xf3'));}else{if(_0x4b4fea[_0x0479('0xef')]>=_0x116134['dialMachineMaxRetry']){_0x45f57d[_0x0479('0xf4')](_0x4b4fea,_0x4bd854,_0x22d31d,_0x0479('0xf5'));}else{_0x45f57d[_0x0479('0xbd')]({'active':![],'countmachineretry':_0x4b4fea[_0x0479('0xef')],'scheduledat':moment()[_0x0479('0xf6')](_0x116134[_0x0479('0xf7')],_0x0479('0xf8'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b4fea[_0x0479('0xcb')],'ListId':_0x4b4fea[_0x0479('0xcc')],'VoiceQueueId':_0x4b4fea[_0x0479('0xf9')]||undefined,'CampaignId':_0x4b4fea[_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch('[rescheduleContact][Machine]'));_0x4bd854({'reschedule':0x1});}}});}if(_0x4e5486[_0x0479('0x45')]==='ivr'&&this[_0x0479('0x1f')][_0x4e5486['queue']][_0x0479('0xdb')]&&_0x3ea14e[_0x0479('0xe4')]===_0x0479('0xdc')){delete this[_0x0479('0x24')][_0x3ea14e[_0x0479('0xd5')]];this[_0x0479('0xb0')](this[_0x0479('0x1f')][_0x4e5486[_0x0479('0xb1')]]);_0x31e4f9=new Hangup(_0x4e5486,_0x3ea14e);_0x31e4f9[_0x0479('0xa1')]=0x12;_0x31e4f9['statedesc']=_0x0479('0xdd');_0x31e4f9[_0x0479('0xde')]=_0x0479('0xe7');ami[_0x0479('0xdf')](_0x0479('0xe0'),ut[_0x0479('0xe1')](_0x31e4f9,_0x0479('0xe9')));this[_0x0479('0xe2')](_0x31e4f9,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x4e5486['type']==='ivr'&&this[_0x0479('0x1f')][_0x4e5486[_0x0479('0xb1')]]['dialAMDActive']&&_0x3ea14e['value']==='MACHINE'){var _0x45f57d=this;return new BPromise(function(_0x354313,_0x59ecd6){delete _0x45f57d[_0x0479('0x24')][_0x3ea14e['uniqueid']];_0x45f57d[_0x0479('0xb0')](_0x45f57d[_0x0479('0x1f')][_0x4e5486[_0x0479('0xb1')]]);_0x45f57d['campaigns'][_0x4e5486[_0x0479('0xb1')]][_0x0479('0x57')]+=0x1;_0x45f57d[_0x0479('0x1f')][_0x4e5486['queue']][_0x0479('0x56')]+=0x1;var _0x31ef71=_0x45f57d[_0x0479('0x1f')][_0x4e5486[_0x0479('0xb1')]];var _0x5293f7=new Hangup(_0x4e5486,_0x3ea14e);_0x5293f7[_0x0479('0xa1')]=0x13;_0x5293f7[_0x0479('0xa2')]=_0x0479('0xe6');_0x5293f7[_0x0479('0xde')]=_0x0479('0xe7');_0x5293f7[_0x0479('0xef')]+=0x1;_0x5293f7[_0x0479('0xe8')]+=0x1;_0x5293f7[_0x0479('0xe9')]=!![];ami[_0x0479('0xdf')](_0x0479('0xe0'),ut[_0x0479('0xe1')](_0x5293f7,_0x0479('0xe9')));_0x45f57d[_0x0479('0xc5')](_0x5293f7)[_0x0479('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5293f7['countbusyretry']+_0x5293f7[_0x0479('0xec')]+_0x5293f7[_0x0479('0xfa')]+_0x5293f7['countnosuchnumberretry']+_0x5293f7[_0x0479('0xee')]+_0x5293f7['countabandonedretry']+_0x5293f7[_0x0479('0xef')]+_0x5293f7[_0x0479('0xf0')]>=_0x31ef71[_0x0479('0xf1')]){_0x45f57d[_0x0479('0xf2')](_0x5293f7,_0x354313,_0x59ecd6,_0x0479('0xf3'));}else{if(_0x5293f7[_0x0479('0xef')]>=_0x31ef71['dialMachineMaxRetry']){_0x45f57d[_0x0479('0xf4')](_0x5293f7,_0x354313,_0x59ecd6,'reason\x2019\x20machine....');}else{_0x45f57d['rescheduleContact']({'active':![],'countmachineretry':_0x5293f7[_0x0479('0xef')],'scheduledat':moment()['add'](_0x31ef71[_0x0479('0xf7')],_0x0479('0xf8'))[_0x0479('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5293f7[_0x0479('0xcb')],'ListId':_0x5293f7[_0x0479('0xcc')],'VoiceQueueId':_0x5293f7[_0x0479('0xf9')]||undefined,'CampaignId':_0x5293f7[_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch(_0x0479('0xfb')));_0x354313({'reschedule':0x1});}}});}}};Dialer[_0x0479('0xa5')][_0x0479('0xfc')]=function(_0x4c4dfc){var _0x462703=this[_0x0479('0x24')][_0x4c4dfc[_0x0479('0xd5')]];var _0x5d7a10=this;var _0x4f1fd;if(_0x462703&&_0x462703[_0x0479('0x45')]===_0x0479('0x73')){delete this['uniqueId'][_0x4c4dfc[_0x0479('0xd5')]];this['updateOriginated'](this['campaigns'][_0x462703[_0x0479('0xb1')]]);this['campaigns'][_0x462703['queue']][_0x0479('0xfd')]+=0x1;_0x4f1fd=new Hangup(_0x462703,_0x4c4dfc);this[_0x0479('0xc5')](_0x4f1fd)[_0x0479('0xae')](loggerCatch(_0x0479('0xfe')));this['moveContactManagedDialer'](_0x4f1fd)[_0x0479('0xae')](loggerCatch(_0x0479('0xff')));}if(_0x462703&&_0x462703[_0x0479('0x45')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x462703['queue']][_0x0479('0x100')])){delete this[_0x0479('0x24')][_0x4c4dfc[_0x0479('0xd5')]];this[_0x0479('0xb0')](this['voiceQueues'][_0x462703[_0x0479('0xb1')]]);this['voiceQueues'][_0x462703[_0x0479('0xb1')]][_0x0479('0x57')]+=0x1;this[_0x0479('0x1e')][_0x462703[_0x0479('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4f1fd=new Hangup(_0x462703,_0x4c4dfc);_0x4f1fd[_0x0479('0xa1')]=0x10;_0x4f1fd[_0x0479('0xa2')]='AnswerAGI';_0x4f1fd[_0x0479('0xde')]='AGI';this[_0x0479('0xc5')](_0x4f1fd)[_0x0479('0xae')](loggerCatch(_0x0479('0xfe')));this[_0x0479('0xc3')](_0x4f1fd)[_0x0479('0xae')](loggerCatch(_0x0479('0xff')));}if(_0x462703&&_0x462703[_0x0479('0x45')]!=='ivr'&&!isNotNull(this[_0x0479('0x1e')][_0x462703[_0x0479('0xb1')]]['dialQueueProject'])){delete this['uniqueId'][_0x4c4dfc[_0x0479('0xd5')]];this['updateOriginated'](this[_0x0479('0x1e')][_0x462703[_0x0479('0xb1')]]);this[_0x0479('0x1e')][_0x462703[_0x0479('0xb1')]][_0x0479('0x5e')]+=0x1;_0x4f1fd=new Hangup(_0x462703,_0x4c4dfc);_0x4f1fd['state']=0xc;_0x4f1fd['statedesc']=_0x4c4dfc[_0x0479('0x101')];_0x4f1fd['membername']='Unknow';this[_0x0479('0xc5')](_0x4f1fd)[_0x0479('0xae')](loggerCatch(_0x0479('0xfe')));this[_0x0479('0xc3')](_0x4f1fd)[_0x0479('0xae')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x0479('0xa5')][_0x0479('0x30')]=function(_0x13d3ed){var _0x443585=this['uniqueId'][_0x13d3ed[_0x0479('0xd5')]];var _0x1b213e=this;if(this[_0x0479('0x1e')][_0x13d3ed['queue']]){if(_0x443585&&_0x443585[_0x0479('0x45')]!==_0x0479('0x73')){delete this['uniqueId'][_0x13d3ed[_0x0479('0xd5')]];this[_0x0479('0x1e')][_0x13d3ed['queue']][_0x0479('0x57')]+=0x1;var _0x1df9e0=new AgentComplete(_0x443585,_0x13d3ed);if(_0x13d3ed[_0x0479('0x102')]==='agent'){_0x1df9e0['agiafterat']=this[_0x0479('0x1e')][_0x13d3ed[_0x0479('0xb1')]][_0x0479('0x103')]&&this[_0x0479('0x1e')][_0x13d3ed['queue']]['dialAgiAfterHangupAgent']?moment()['format'](_0x0479('0x104')):undefined;}this['createHistory'](_0x1df9e0)[_0x0479('0xae')](loggerCatch(_0x0479('0x105')));this[_0x0479('0xc3')](_0x1df9e0)[_0x0479('0xae')](loggerCatch(_0x0479('0x106')));}}};Dialer['prototype'][_0x0479('0x2c')]=function(_0x3fe425){if(this[_0x0479('0x1e')][_0x3fe425['queue']]){if(this[_0x0479('0x24')][_0x3fe425[_0x0479('0xd5')]]&&this['uniqueId'][_0x3fe425['uniqueid']][_0x0479('0x45')]!=='ivr'){this[_0x0479('0xb0')](this[_0x0479('0x1e')][_0x3fe425[_0x0479('0xb1')]]);this['uniqueId'][_0x3fe425[_0x0479('0xd5')]]['answertime']=moment()[_0x0479('0x71')](_0x0479('0x104'));}}};Dialer[_0x0479('0xa5')][_0x0479('0x107')]=function(_0x505b12){this['createHistory'](_0x505b12)[_0x0479('0xae')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x0479('0xc3')](_0x505b12)['catch'](loggerCatch(_0x0479('0x108')));};Dialer['prototype'][_0x0479('0x2d')]=function(_0x1dce2e){var _0xd671de=this[_0x0479('0x24')][_0x1dce2e[_0x0479('0xd5')]];var _0x7b9e4f=this;if(this[_0x0479('0x1e')][_0x1dce2e['queue']]){if(_0xd671de&&_0xd671de[_0x0479('0x45')]!==_0x0479('0x73')){delete this[_0x0479('0x24')][_0x1dce2e[_0x0479('0xd5')]];this['updateOriginated'](this[_0x0479('0x1e')][_0x1dce2e['queue']]);_0xd671de[_0x0479('0x109')]=moment()[_0x0479('0x71')](_0x0479('0x104'));var _0x763971=new QueueCallerAbandon(_0xd671de,_0x1dce2e);if(getSeconds(_0xd671de[_0x0479('0x109')],_0xd671de['responsetime'])>=_0xd671de['dialQueueTimeout']){this[_0x0479('0x1e')][_0x1dce2e['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x0479('0x1e')][_0x1dce2e[_0x0479('0xb1')]][_0x0479('0x10a')]+=0x1;this['voiceQueues'][_0x1dce2e[_0x0479('0xb1')]][_0x0479('0x63')]+=0x1;_0x763971[_0x0479('0xa1')]=0xa;_0x763971['statedesc']=_0x0479('0x10b');_0x763971['dropreason']='TIMEOUT';_0x763971[_0x0479('0x10c')]=this['voiceQueues'][_0x1dce2e[_0x0479('0xb1')]][_0x0479('0x103')]?moment()[_0x0479('0x71')](_0x0479('0x104')):undefined;_0x763971[_0x0479('0xee')]+=0x1;_0x763971[_0x0479('0xe8')]+=0x1;if(_0x763971[_0x0479('0xee')]>=this[_0x0479('0x1e')][_0x1dce2e[_0x0479('0xb1')]][_0x0479('0x10d')]){this[_0x0479('0x107')](_0x763971);}else{this[_0x0479('0xbd')]({'active':![],'countdropretry':_0x763971[_0x0479('0xee')],'scheduledat':moment()['add'](this[_0x0479('0x1e')][_0x1dce2e[_0x0479('0xb1')]][_0x0479('0x10e')],_0x0479('0xf8'))[_0x0479('0x71')](_0x0479('0x104')),'ContactId':_0xd671de[_0x0479('0xcb')],'ListId':_0xd671de['ListId'],'VoiceQueueId':_0xd671de['VoiceQueueId']||undefined,'CampaignId':_0xd671de[_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch('[rescheduleContact][Drop]'));var _0x40af1f=new History(_0x763971);_0x40af1f['state']=0xa;_0x40af1f['statedesc']=_0x0479('0x10b');_0x40af1f['starttime']=moment()[_0x0479('0x71')]('YYYY-MM-DD\x20HH:mm:ss');_0x40af1f[_0x0479('0xa3')]=_0x40af1f[_0x0479('0xa4')];_0x40af1f[_0x0479('0x10f')]=_0x763971[_0x0479('0x10f')];_0x40af1f[_0x0479('0x110')]=_0x763971['calleridnum'];this[_0x0479('0xc5')](_0x40af1f)[_0x0479('0xae')](loggerCatch(_0x0479('0x111')));}}else{this[_0x0479('0x1e')][_0x1dce2e[_0x0479('0xb1')]][_0x0479('0x112')]+=0x1;this[_0x0479('0x1e')][_0x1dce2e[_0x0479('0xb1')]][_0x0479('0x5a')]+=0x1;_0x763971[_0x0479('0xa1')]=0xb;_0x763971[_0x0479('0xa2')]=_0x0479('0x113');_0x763971[_0x0479('0x114')]=_0x0479('0x115');_0x763971[_0x0479('0x116')]+=0x1;_0x763971[_0x0479('0xe8')]+=0x1;if(_0x763971[_0x0479('0x116')]>=this[_0x0479('0x1e')][_0x1dce2e['queue']]['dialAbandonedMaxRetry']){this[_0x0479('0x107')](_0x763971);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x763971['countabandonedretry'],'scheduledat':moment()[_0x0479('0xf6')](this[_0x0479('0x1e')][_0x1dce2e[_0x0479('0xb1')]][_0x0479('0x117')],_0x0479('0xf8'))[_0x0479('0x71')](_0x0479('0x104')),'ContactId':_0xd671de['ContactId'],'ListId':_0xd671de['ListId'],'VoiceQueueId':_0xd671de['VoiceQueueId']||undefined,'CampaignId':_0xd671de[_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x40af1f=new History(_0x763971);_0x40af1f[_0x0479('0xa1')]=0xb;_0x40af1f[_0x0479('0xa2')]=_0x0479('0x113');_0x40af1f[_0x0479('0xa4')]=moment()[_0x0479('0x71')](_0x0479('0x104'));_0x40af1f[_0x0479('0xa3')]=_0x40af1f['starttime'];_0x40af1f[_0x0479('0x10f')]=_0x763971['calleridname'];_0x40af1f[_0x0479('0x110')]=_0x763971[_0x0479('0x110')];this[_0x0479('0xc5')](_0x40af1f)[_0x0479('0xae')](loggerCatch(_0x0479('0x118')));}}}}};Dialer[_0x0479('0xa5')][_0x0479('0x119')]=function(_0x4e39b9){if(this[_0x0479('0xa8')][_0x4e39b9[_0x0479('0xd5')]]){this['actions'][_0x4e39b9[_0x0479('0xd5')]][_0x0479('0xad')]=_0x4e39b9['channel'];}if(this['uniqueId'][_0x4e39b9['uniqueid']]){this[_0x0479('0x24')][_0x4e39b9[_0x0479('0xd5')]][_0x0479('0xad')]=_0x4e39b9[_0x0479('0xad')];}};Dialer[_0x0479('0xa5')][_0x0479('0x34')]=function(_0x57f8a1){if(strategy[this[_0x0479('0x1e')][this[_0x0479('0xa8')][_0x57f8a1[_0x0479('0x11a')]][_0x0479('0xb1')]]['strategy']]==='roundrobin'){if(this[_0x0479('0xa8')][_0x57f8a1[_0x0479('0x11a')]]&&_[_0x0479('0xd6')](this[_0x0479('0xa8')][_0x57f8a1[_0x0479('0x11a')]][_0x0479('0x11b')])&&_0x57f8a1[_0x0479('0xac')]==='1'&&_0x57f8a1[_0x0479('0x11c')]==='0'){if(this[_0x0479('0x20')][_0x57f8a1[_0x0479('0x11d')]]){if(!this[_0x0479('0x20')][_0x57f8a1[_0x0479('0x11d')]][_0x0479('0x11b')]){this[_0x0479('0x20')][_0x57f8a1[_0x0479('0x11d')]]['locked']=!![];this[_0x0479('0xa8')][_0x57f8a1[_0x0479('0x11a')]][_0x0479('0x11b')]=!![];this[_0x0479('0xa8')][_0x57f8a1[_0x0479('0x11a')]][_0x0479('0x11d')]=_0x57f8a1['stateinterface'];}}}}else if((strategy[this[_0x0479('0x1e')][this['actions'][_0x57f8a1[_0x0479('0x11a')]][_0x0479('0xb1')]][_0x0479('0x47')]]||_0x0479('0x1a'))===_0x0479('0x1a')){if(this[_0x0479('0xa8')][_0x57f8a1[_0x0479('0x11a')]]){if(this[_0x0479('0x20')][_0x57f8a1[_0x0479('0x11d')]]){this['actions'][_0x57f8a1[_0x0479('0x11a')]][_0x0479('0x11d')]=_0x57f8a1[_0x0479('0x11d')];if(_['isNil'](this[_0x0479('0x29')][this[_0x0479('0xa8')][_0x57f8a1['actionid']][_0x0479('0xb1')]])){this[_0x0479('0x29')][this[_0x0479('0xa8')][_0x57f8a1[_0x0479('0x11a')]]['queue']]=[];}this[_0x0479('0x29')][this['actions'][_0x57f8a1[_0x0479('0x11a')]][_0x0479('0xb1')]][_0x0479('0x11e')](_['merge'](_[_0x0479('0x11f')](this[_0x0479('0xa8')][_0x57f8a1[_0x0479('0x11a')]],[_0x0479('0x120'),_0x0479('0x11d')]),{'status':_0x57f8a1['status'],'paused':_0x57f8a1['paused']}));}}}};function unlockQueueStatus(_0x4604a,_0x41226f){setTimeout(function(){if(_['isUndefined'](_0x4604a['queueStatusComplete'])){loggerBooked[_0x0479('0x90')](_0x0479('0x121'),_0x41226f);}_0x4604a[_0x0479('0x122')]=!![];loggerBooked['info'](_0x0479('0x123'),_0x41226f,JSON[_0x0479('0x70')](_[_0x0479('0x11f')](_0x4604a,[_0x0479('0x3a'),_0x0479('0x122')])));},0x1f3);}Dialer[_0x0479('0xa5')]['syncQueueStatusComplete']=function(_0x36f8ec){var _0x36e77f=this;var _0x239e57=_0x36e77f[_0x0479('0x1e')][_0x36e77f['actions'][_0x36f8ec[_0x0479('0x11a')]]['queue']];if(strategy[this[_0x0479('0x1e')][this[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xb1')]][_0x0479('0x47')]]===_0x0479('0x124')){if(this[_0x0479('0xa8')][_0x36f8ec['actionid']]&&this['actions'][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0x11d')]){this[_0x0479('0x1d')]['run'](this['actions'][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0x120')],this[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0x11d')])[_0x0479('0xae')](function(_0x7f15d){logger[_0x0479('0x90')](_0x0479('0x125'),util[_0x0479('0x8f')](_0x7f15d,{'showHidden':![],'depth':null}));})[_0x0479('0x1c')](function(){_0x36e77f[_0x0479('0xb0')](_0x36e77f['voiceQueues'][_0x36e77f[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]]['queue']]);_0x36e77f[_0x0479('0x20')][_0x36e77f[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0x11d')]][_0x0479('0x11b')]=![];delete _0x36e77f[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]];unlockQueueStatus(_0x239e57);});}else{this['updateOriginated'](this[_0x0479('0x1e')][this[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xb1')]]);this[_0x0479('0xbd')]({'active':![],'ContactId':this[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xcb')],'ListId':this['actions'][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xcc')],'VoiceQueueId':this[_0x0479('0xa8')][_0x36f8ec['actionid']][_0x0479('0xf9')]||undefined,'CampaignId':this[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x0479('0xa8')][_0x36f8ec['actionid']];unlockQueueStatus(_0x239e57);}}else if((strategy[this[_0x0479('0x1e')][this['actions'][_0x36f8ec[_0x0479('0x11a')]]['queue']][_0x0479('0x47')]]||'rrmemory')===_0x0479('0x1a')){var _0x5be35b;if(this[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]]&&!_[_0x0479('0x75')](this[_0x0479('0x29')][this[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xb1')]])){if(this[_0x0479('0x2a')][_0x36e77f[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xb1')]]){this[_0x0479('0x2a')][_0x36e77f[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xb1')]]=this[_0x0479('0x2a')][this[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xb1')]]?this[_0x0479('0x2a')][this['actions'][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xb1')]]:this['queueBooked'][this[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xb1')]]?this[_0x0479('0x29')][this[_0x0479('0xa8')][_0x36f8ec[_0x0479('0x11a')]][_0x0479('0xb1')]][_0x0479('0x126')]||0x0:0x0;}this[_0x0479('0x29')][this[_0x0479('0xa8')][_0x36f8ec['actionid']][_0x0479('0xb1')]][_0x0479('0x126')]=this[_0x0479('0x2a')][this[_0x0479('0xa8')][_0x36f8ec['actionid']][_0x0479('0xb1')]];for(var _0x40e4b4=0x0;_0x40e4b4=0x0;})['catch'](myreject(_0x5399b7)));}}else{_0x5cd5d5['push'](ami[_0x0479('0xab')]({'action':_0x0479('0x140'),'command':util[_0x0479('0x71')](_0x0479('0x141'),_0x570210,!_['isUndefined'](config[_0x0479('0x13c')][_0xbbe045])?_0xbbe045:'')})[_0x0479('0xb5')](function(_0x2c00ea){return _0x2c00ea[_0x0479('0x13e')][_0x0479('0x142')](_0x0479('0x13f'))>=0x0;})['catch'](myreject(_0x5399b7)));}BPromise[_0x0479('0x143')](_0x5cd5d5)[_0x0479('0xb5')](function(_0x180214){var _0x127b4a=_[_0x0479('0x144')](_0x180214);if(_0x127b4a){return _0x18b928(_0x127b4a);}else{_0x37220c[_0x0479('0x38')]=_0x5cff7d?_0x0479('0x145'):'INTERVAL_IS_OVERTIME';return _0x5399b7(msgResponse(_0x0479('0x146'),_0x0479('0x138'),_0x0479('0x147')+_0x5cff7d+'\x20'+_0x5d31c0+_0x0479('0x148')+util['inspect'](_0x570210,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0xbbe045));}})[_0x0479('0xae')](function(_0x5267be){return _0x5399b7(msgResponse('ifTime',_0x0479('0x138'),JSON['stringify'](_0x5267be)));});});};Dialer[_0x0479('0xa5')][_0x0479('0x149')]=function(_0x476703){var _0x2b890f=this;return function(){switch(_0x476703['dialMethod']){case _0x0479('0x14a'):freeVariablesPredictive(_0x476703);_0x2b890f[_0x0479('0x14b')](_0x476703,0x1);break;case _0x0479('0x14c'):freeVariablesPredictive(_0x476703);_0x2b890f[_0x0479('0x14b')](_0x476703,_0x476703[_0x0479('0x14d')]);break;case _0x0479('0xa'):_0x2b890f[_0x0479('0xa')](_0x476703);break;case _0x0479('0x14e'):freeVariablesPredictive(_0x476703);_0x2b890f[_0x0479('0x14b')](_0x476703,0x1);break;default:freeVariablesPredictive(_0x476703);logger['error'](_0x0479('0x14f'),_0x476703[_0x0479('0x3a')],_0x0479('0x150'));}};};Dialer[_0x0479('0xa5')]['launchHandleIvr']=function(_0x585969){var _0x36f317=this;return function(){_0x36f317['handleIvr'](_0x585969);};};Dialer[_0x0479('0xa5')]['syncQueueSummary']=function(_0x1b5ffc){var _0x5269fe=this;if(isNotPreview(_0x1b5ffc[_0x0479('0x151')])){if(isVoiceQueueOutbound(_0x1b5ffc['type'])&&isActive(_0x1b5ffc[_0x0479('0x52')])){_0x1b5ffc[_0x0479('0x99')]=!![];BPromise[_0x0479('0xb4')]()[_0x0479('0xb5')](checkIsLoggedIn(_0x1b5ffc,_0x1b5ffc[_0x0479('0x49')]))[_0x0479('0xb5')](checkIsActive(_0x1b5ffc,_0x1b5ffc[_0x0479('0x52')]))[_0x0479('0xb5')](checkInterval(_0x1b5ffc))['then'](_0x5269fe[_0x0479('0x152')](_0x1b5ffc))['then'](_0x5269fe[_0x0479('0x135')](_0x1b5ffc[_0x0479('0x153')],_0x1b5ffc[_0x0479('0x154')],_0x1b5ffc[_0x0479('0x3a')],_0x1b5ffc))[_0x0479('0xb5')](_0x5269fe[_0x0479('0x137')](_0x1b5ffc[_0x0479('0x3d')],_0x1b5ffc[_0x0479('0x154')],_0x1b5ffc[_0x0479('0x3a')],_0x1b5ffc))[_0x0479('0xb5')](_0x5269fe[_0x0479('0x149')](_0x1b5ffc))[_0x0479('0xae')](loggerCatchQueueSummary(_0x0479('0x155'),_0x1b5ffc));}else{notSendMessagesQueue(_0x1b5ffc);}}else{freeVariablesPredictive(_0x1b5ffc);}};Dialer[_0x0479('0xa5')][_0x0479('0x132')]=function(){var _0x4664a7=this;var _0x2c5db3;for(var _0x5f113b in this[_0x0479('0x1f')]){if(typeof this['campaigns'][_0x5f113b]!==_0x0479('0x92')){_0x2c5db3=this['campaigns'][_0x5f113b];if(isCampaignIvr(_0x2c5db3[_0x0479('0x45')])&&isActive(_0x2c5db3[_0x0479('0x6e')])){_0x2c5db3[_0x0479('0x99')]=!![];BPromise[_0x0479('0xb4')]()['then'](checkIsActive(_0x2c5db3,_0x2c5db3[_0x0479('0x6e')]))['then'](checkInterval(_0x2c5db3))[_0x0479('0xb5')](_0x4664a7['checkIsTrunkReachable'](_0x2c5db3))[_0x0479('0xb5')](_0x4664a7[_0x0479('0x135')](_0x2c5db3['dialGlobalInterval'],_0x2c5db3[_0x0479('0x154')],_0x2c5db3[_0x0479('0x3a')],_0x2c5db3))[_0x0479('0xb5')](_0x4664a7[_0x0479('0x137')](_0x2c5db3[_0x0479('0x3d')],_0x2c5db3[_0x0479('0x154')],_0x2c5db3['name'],_0x2c5db3))['then'](_0x4664a7[_0x0479('0x156')](_0x2c5db3))[_0x0479('0xae')](loggerCatchQueueSummary(_0x0479('0x157'),_0x2c5db3));}else{notSendMessagesCampaign(_0x2c5db3);}}}};function getCallerIdRandom(_0x1933b4,_0x3bee73){var _0x11eb37;var _0x59984e;var _0x57de73;if(_0x3bee73<=0x0){_0x3bee73=0x1;}_0x11eb37=new RegExp('\x5cw{0,'+_0x3bee73+'}$');_0x59984e=Math['pow'](0xa,_0x3bee73-0x1);_0x57de73=Math[_0x0479('0x158')](0xa,_0x3bee73)-0x1;return util[_0x0479('0x71')]('%s',_[_0x0479('0x159')](_0x1933b4,_0x11eb37,_[_0x0479('0x15a')](_0x59984e,_0x57de73)));}function extractCalleridName(_0x3cf75d){var _0x92dfb5=_0x3cf75d['match'](/"(.*?)"/);return _0x92dfb5?_0x92dfb5[0x1]:_0x3cf75d;}function extractCalleridNumber(_0x3b3a48){var _0x263823=_0x3b3a48[_0x0479('0x15b')](/<(.*?)>/);return _0x263823?_0x263823[0x1]:_0x3b3a48;}Dialer[_0x0479('0xa5')]['actionOriginate']=function(_0x170a9b,_0x4a6076){var _0x28530c=this;var _0x201c20=uuid['v4']();this['actions'][_0x201c20]=new Action(_0x170a9b,_0x4a6076,_0x201c20);return new BPromise(function(_0x28d182,_0xfe0789){if(_[_0x0479('0x37')](_0x170a9b)&&typeof _0x170a9b!=='object'){return _0xfe0789(msgResponse('originate',_0x0479('0x138'),_0x0479('0x15c')));}if(_['isUndefined'](_0x4a6076['Contact']['phone'])||_0x4a6076[_0x0479('0x15d')][_0x0479('0x15e')]===null){return _0xfe0789(msgResponse(_0x0479('0x15f'),'Failure',_0x0479('0x160')));}var _0x36aa08={'XMD-CALLERID':_0x28530c[_0x0479('0xa8')][_0x201c20][_0x0479('0x161')](),'XMD-AGI':_0x170a9b[_0x0479('0x100')]?util[_0x0479('0x71')]('\x22agi://%s/square,%s\x22',ipAgi,_0x170a9b[_0x0479('0x100')]):_0x0479('0x162'),'XMD-AGIAFTER':_0x170a9b[_0x0479('0x103')]?util[_0x0479('0x71')](_0x0479('0x163'),ipAgi,_0x170a9b['dialQueueProject2']):_0x0479('0x162'),'XMD-QUEUE':_0x170a9b['type']==='outbound'?util[_0x0479('0x71')]('\x22%s,%s%s,,,%s\x22',_0x170a9b['name'],_0x170a9b[_0x0479('0x164')]||'',_0x170a9b[_0x0479('0x165')]?'c':'',_0x170a9b[_0x0479('0x166')]||0x3):'NONE','XMD-CONTACTID':_0x4a6076[_0x0479('0xcb')],'XMD-CDRTYPE':_0x0479('0x9'),'CALLERID(all)':_0x28530c[_0x0479('0xa8')][_0x201c20][_0x0479('0x161')](),'XMD-AMD':_0x170a9b[_0x0479('0xdb')]?'ACTIVE':_0x0479('0x162'),'XMD-DESTINATION':_0x0479('0xda')};if(_0x170a9b['dialAMDActive']){_0x36aa08[_0x0479('0x167')]=_0x170a9b[_0x0479('0x168')]||0x9c4;_0x36aa08[_0x0479('0x169')]=_0x170a9b[_0x0479('0x16a')]||0x5dc;_0x36aa08[_0x0479('0x16b')]=_0x170a9b[_0x0479('0x16c')]||0x320;_0x36aa08[_0x0479('0x16d')]=_0x170a9b['dialAMDTotalAnalysisTime']||0x1388;_0x36aa08['XMD-AMDMINWORDLENGTH']=_0x170a9b[_0x0479('0x16e')]||0x64;_0x36aa08[_0x0479('0x16f')]=_0x170a9b[_0x0479('0x170')]||0x32;_0x36aa08[_0x0479('0x171')]=_0x170a9b[_0x0479('0x172')]||0x3;_0x36aa08[_0x0479('0x173')]=_0x170a9b[_0x0479('0x174')]||0x100;_0x36aa08[_0x0479('0x175')]=_0x170a9b[_0x0479('0x176')]||0x1388;}if(_0x170a9b[_0x0479('0x45')]===_0x0479('0x46')){_0x36aa08['XMD-VOICEQUEUEID']=_0x4a6076[_0x0479('0xf9')];}else{_0x36aa08[_0x0479('0x177')]=_0x4a6076[_0x0479('0xce')];}for(var _0x34e363 in _0x4a6076[_0x0479('0x15d')]){if(typeof _0x4a6076['Contact'][_0x34e363]!==_0x0479('0x92')){if(isNotNull(_0x4a6076[_0x0479('0x15d')][_0x34e363])&&_0x34e363!=='id'&&_0x34e363!==_0x0479('0x178')&&_0x34e363!==_0x0479('0x179')&&_0x34e363!==_0x0479('0x17a')){_0x36aa08[util[_0x0479('0x71')](_0x0479('0x17b'),'XMD-',_[_0x0479('0x17c')](_0x34e363))]=_0x4a6076[_0x0479('0x15d')][_0x34e363];}}}var _0x2b66d6=_0x28530c['isTrunkReachable'](_0x170a9b['Trunk'])?getCallerId(_0x170a9b['Trunk']['callerid'],_0x170a9b[_0x0479('0x53')],_0x170a9b['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x170a9b[_0x0479('0x17d')],_0x170a9b[_0x0479('0x17e')]):_0x170a9b['dialOriginateCallerIdNumber']):getCallerId(_[_0x0479('0xd6')](_0x170a9b[_0x0479('0x133')])?_0x170a9b[_0x0479('0x6d')][_0x0479('0x6f')]:_0x170a9b[_0x0479('0x133')][_0x0479('0x6f')],_0x170a9b['dialOriginateCallerIdName'],_0x170a9b[_0x0479('0x17e')]>0x0?getCallerIdRandom(_0x170a9b[_0x0479('0x17d')],_0x170a9b['dialRandomLastDigitCallerIdNumber']):_0x170a9b['dialOriginateCallerIdNumber']);if(_0x2b66d6){_0x36aa08[_0x0479('0x17f')]=_0x28530c[_0x0479('0xa8')][_0x201c20][_0x0479('0x180')]=extractCalleridName(_0x2b66d6);_0x36aa08[_0x0479('0x181')]=_0x28530c[_0x0479('0xa8')][_0x201c20][_0x0479('0x182')]=extractCalleridNumber(_0x2b66d6);}return ami[_0x0479('0xab')]({'actionid':_0x201c20,'action':_0x0479('0x15f'),'channel':_0x28530c[_0x0479('0xd2')](_0x170a9b[_0x0479('0x6d')])?util[_0x0479('0x71')](_0x0479('0x183'),_0x170a9b[_0x0479('0x6d')][_0x0479('0x3a')],isNotNull(_0x170a9b['dialPrefix'])?_0x170a9b[_0x0479('0x55')]['trim']()||'':'',_0x170a9b['dialCutDigit']>0x0?_0x4a6076[_0x0479('0x15d')][_0x0479('0x15e')][_0x0479('0x184')](_0x170a9b[_0x0479('0x185')]):_0x4a6076[_0x0479('0x15d')][_0x0479('0x15e')]):util[_0x0479('0x71')]('SIP/%s/%s%s',_[_0x0479('0xd6')](_0x170a9b[_0x0479('0x133')])?_0x170a9b[_0x0479('0x6d')][_0x0479('0x3a')]:_0x170a9b['TrunkBackup'][_0x0479('0x3a')],isNotNull(_0x170a9b['dialPrefix'])?_0x170a9b[_0x0479('0x55')][_0x0479('0x186')]()||'':'',_0x170a9b[_0x0479('0x185')]>0x0?_0x4a6076[_0x0479('0x15d')][_0x0479('0x15e')][_0x0479('0x184')](_0x170a9b[_0x0479('0x185')]):_0x4a6076[_0x0479('0x15d')][_0x0479('0x15e')]),'callerid':_0x2b66d6,'Exten':_0x0479('0xda'),'Context':'from-sip','Priority':'1','variable':_0x36aa08,'timeout':(_0x170a9b[_0x0479('0x54')]||0x1e)*0x3e8,'async':!![],'channelid':_0x201c20})['then'](function(_0x580b0e){return _0x28d182(_0x580b0e);})['catch'](function(_0x187cde){_0x170a9b[_0x0479('0x187')]+=0x1;var _0x57dc32=new History(_0x28530c[_0x0479('0xa8')][_0x201c20]);logger[_0x0479('0x90')](util[_0x0479('0x71')](_0x0479('0x188'),JSON[_0x0479('0x70')](_0x187cde)));_0x57dc32['state']=0xe;_0x57dc32[_0x0479('0xa2')]='OriginateError';_0x57dc32[_0x0479('0xa4')]=moment()[_0x0479('0x71')](_0x0479('0x104'));_0x57dc32[_0x0479('0xa3')]=_0x57dc32[_0x0479('0xa4')];_0x28530c[_0x0479('0xc5')](_0x57dc32)[_0x0479('0xae')](loggerCatch(_0x0479('0x189')));_0x28530c[_0x0479('0xc3')](_0x57dc32)[_0x0479('0xae')](loggerCatch(_0x0479('0x189')))[_0x0479('0x1c')](function(){delete _0x28530c[_0x0479('0xa8')][_0x201c20];return _0xfe0789(msgResponse(_0x0479('0x15f'),'Error',_0x0479('0x18a')));});});});};Dialer[_0x0479('0xa5')][_0x0479('0x18b')]=function(_0x429cca){var _0x3823e6=this[_0x0479('0xa8')][_0x429cca['actionid']];if(_0x3823e6){delete this[_0x0479('0xa8')][_0x429cca[_0x0479('0x11a')]];_0x3823e6[_0x0479('0x18c')]=moment()['format'](_0x0479('0x104'));var _0x4bd6fc=_0x3823e6[_0x0479('0x45')]==='ivr'?this[_0x0479('0x1f')][_0x3823e6[_0x0479('0xb1')]]:this[_0x0479('0x1e')][_0x3823e6['getQueue']()];if(!this[_0x0479('0xd0')](_0x429cca[_0x0479('0x18d')])){this[_0x0479('0xb0')](_0x4bd6fc);return this[_0x0479('0x18e')](_0x3823e6,_0x4bd6fc,_0x429cca)['catch'](loggerCatch(_0x0479('0x18f')));}this[_0x0479('0x24')][_0x429cca[_0x0479('0xd5')]]=_0x3823e6;}};Dialer[_0x0479('0xa5')][_0x0479('0x190')]=function(_0x14ce21,_0x496a1a,_0x4dd84d){var _0x4d7250=new History(_0x496a1a);if(_0x4d7250[_0x0479('0xeb')]+_0x4d7250['countcongestionretry']+_0x4d7250[_0x0479('0xfa')]+_0x4d7250[_0x0479('0xed')]+_0x4d7250[_0x0479('0xee')]+_0x4d7250[_0x0479('0x116')]+_0x4d7250[_0x0479('0xef')]+_0x4d7250['countagentrejectretry']>=_0x4dd84d[_0x0479('0xf1')]-0x1){return!![];}switch(_0x14ce21){case 0x3:if(_0x4d7250['countnoanswerretry']>=_0x4dd84d[_0x0479('0x191')]-0x1){return!![];}this[_0x0479('0xbd')]({'active':![],'countnoanswerretry':_0x4d7250['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x4dd84d[_0x0479('0x192')],'minutes')[_0x0479('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4d7250[_0x0479('0xcb')],'ListId':_0x4d7250[_0x0479('0xcc')],'VoiceQueueId':_0x4d7250[_0x0479('0xf9')]||undefined,'CampaignId':_0x4d7250[_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch(_0x0479('0x193')));break;case 0x5:if(_0x4d7250[_0x0479('0xeb')]>=_0x4dd84d[_0x0479('0x194')]-0x1){return!![];}this[_0x0479('0xbd')]({'active':![],'countbusyretry':_0x4d7250[_0x0479('0xeb')]+=0x1,'scheduledat':moment()[_0x0479('0xf6')](_0x4dd84d['dialBusyRetryFrequency'],_0x0479('0xf8'))['format'](_0x0479('0x104')),'ContactId':_0x4d7250[_0x0479('0xcb')],'ListId':_0x4d7250[_0x0479('0xcc')],'VoiceQueueId':_0x4d7250[_0x0479('0xf9')]||undefined,'CampaignId':_0x4d7250[_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch(_0x0479('0x195')));break;case 0x8:if(_0x4d7250[_0x0479('0xec')]>=_0x4dd84d[_0x0479('0x196')]-0x1){return!![];}this[_0x0479('0xbd')]({'active':![],'countcongestionretry':_0x4d7250[_0x0479('0xec')]+=0x1,'scheduledat':moment()[_0x0479('0xf6')](_0x4dd84d[_0x0479('0x197')],'minutes')[_0x0479('0x71')](_0x0479('0x104')),'ContactId':_0x4d7250[_0x0479('0xcb')],'ListId':_0x4d7250[_0x0479('0xcc')],'VoiceQueueId':_0x4d7250[_0x0479('0xf9')]||undefined,'CampaignId':_0x4d7250[_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch(_0x0479('0x198')));break;case 0x0:if(_0x4d7250[_0x0479('0xed')]>=_0x4dd84d['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x0479('0xbd')]({'active':![],'countnosuchnumberretry':_0x4d7250[_0x0479('0xed')]+=0x1,'scheduledat':moment()[_0x0479('0xf6')](_0x4dd84d['dialNoSuchNumberRetryFrequency'],_0x0479('0xf8'))[_0x0479('0x71')](_0x0479('0x104')),'ContactId':_0x4d7250[_0x0479('0xcb')],'ListId':_0x4d7250[_0x0479('0xcc')],'VoiceQueueId':_0x4d7250[_0x0479('0xf9')]||undefined,'CampaignId':_0x4d7250[_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch(_0x0479('0x199')));}break;case 0xa:if(_0x4d7250[_0x0479('0xee')]>=_0x4dd84d['dialDropMaxRetry']-0x1){return!![];}this[_0x0479('0xbd')]({'active':![],'countdropretry':_0x4d7250[_0x0479('0xee')]+=0x1,'scheduledat':moment()[_0x0479('0xf6')](_0x4dd84d[_0x0479('0x10e')],_0x0479('0xf8'))[_0x0479('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4d7250[_0x0479('0xcb')],'ListId':_0x4d7250[_0x0479('0xcc')],'VoiceQueueId':_0x4d7250[_0x0479('0xf9')]||undefined,'CampaignId':_0x4d7250[_0x0479('0xce')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4d7250[_0x0479('0x116')]>=_0x4dd84d[_0x0479('0x19a')]-0x1){return!![];}this[_0x0479('0xbd')]({'active':![],'countabandonedretry':_0x4d7250['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x4dd84d['dialAbandonedRetryFrequency'],_0x0479('0xf8'))[_0x0479('0x71')](_0x0479('0x104')),'ContactId':_0x4d7250[_0x0479('0xcb')],'ListId':_0x4d7250[_0x0479('0xcc')],'VoiceQueueId':_0x4d7250['VoiceQueueId']||undefined,'CampaignId':_0x4d7250[_0x0479('0xce')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x4d7250['countmachineretry']>=_0x4dd84d[_0x0479('0x19b')]-0x1){return!![];}this[_0x0479('0xbd')]({'active':![],'countmachineretry':_0x4d7250[_0x0479('0xef')]+=0x1,'scheduledat':moment()['add'](_0x4dd84d[_0x0479('0xf7')],'minutes')[_0x0479('0x71')](_0x0479('0x104')),'ContactId':_0x4d7250['ContactId'],'ListId':_0x4d7250['ListId'],'VoiceQueueId':_0x4d7250['VoiceQueueId']||undefined,'CampaignId':_0x4d7250[_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch(_0x0479('0xfb')));break;case 0x14:if(_0x4d7250[_0x0479('0xf0')]>=_0x4dd84d[_0x0479('0x19c')]-0x1){return!![];}this[_0x0479('0xbd')]({'active':![],'countagentrejectretry':_0x4d7250[_0x0479('0xf0')]+=0x1,'scheduledat':moment()[_0x0479('0xf6')](_0x4dd84d[_0x0479('0x19d')],'minutes')[_0x0479('0x71')](_0x0479('0x104')),'ContactId':_0x4d7250['ContactId'],'ListId':_0x4d7250[_0x0479('0xcc')],'VoiceQueueId':_0x4d7250[_0x0479('0xf9')]||undefined,'CampaignId':_0x4d7250[_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch(_0x0479('0x19e')));break;default:return!![];}};Dialer['prototype'][_0x0479('0x18e')]=function(_0x1e905d,_0x3cc1c6,_0x874d71){var _0x99a0a9=this;var _0x22d53b=new History(_0x1e905d);return new BPromise(function(_0x324d31,_0xe41e8b){if(_['isUndefined'](_0x3cc1c6)&&typeof _0x3cc1c6!==_0x0479('0x19f')){return _0xe41e8b(msgResponse('[callProgressDetecting]',_0x0479('0x138'),_0x0479('0x1a0')));}if(_[_0x0479('0x37')](_0x874d71)&&typeof _0x874d71!==_0x0479('0x19f')){return _0xe41e8b(msgResponse(_0x0479('0x1a1'),_0x0479('0x138'),_0x0479('0x1a2')));}switch(_0x874d71[_0x0479('0x102')]){case'0':_0x3cc1c6['outboundNoSuchCallsDay']+=0x1;_0x22d53b['state']=0x0;_0x22d53b[_0x0479('0xa2')]='NoSuchNumber';_0x22d53b[_0x0479('0xed')]+=0x1;_0x22d53b[_0x0479('0xe8')]+=0x1;ami['emit'](_0x0479('0x1a3'),ut[_0x0479('0xe1')](_0x1e905d,'nosuchnumber'));_0x99a0a9[_0x0479('0xc5')](_0x22d53b)[_0x0479('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x99a0a9[_0x0479('0x190')](0x0,_0x1e905d,_0x3cc1c6)){if(_0x22d53b[_0x0479('0xed')]>=_0x3cc1c6['dialNoSuchNumberMaxRetry']){_0x99a0a9[_0x0479('0xf4')](_0x22d53b,_0x324d31,_0xe41e8b,_0x0479('0x1a4'));}else{_0x99a0a9['stateGlobal'](_0x22d53b,_0x324d31,_0xe41e8b,_0x0479('0x1a4'));}}break;case'3':_0x3cc1c6[_0x0479('0x5b')]+=0x1;_0x22d53b[_0x0479('0xa1')]=0x3;_0x22d53b[_0x0479('0xa2')]=_0x0479('0x1a5');_0x22d53b['countnoanswerretry']+=0x1;_0x22d53b['countglobal']+=0x1;ami['emit'](_0x0479('0x1a6'),ut['buildObj'](_0x1e905d,'noanswer'));_0x99a0a9['createHistory'](_0x22d53b)[_0x0479('0xae')](loggerCatch(_0x0479('0x1a7')));if(_0x99a0a9['checkRetriveMax'](0x3,_0x1e905d,_0x3cc1c6)){if(_0x22d53b['countnoanswerretry']>=_0x3cc1c6['dialNoAnswerMaxRetry']){_0x99a0a9[_0x0479('0xf4')](_0x22d53b,_0x324d31,_0xe41e8b,_0x0479('0x1a8'));}else{_0x99a0a9[_0x0479('0xf2')](_0x22d53b,_0x324d31,_0xe41e8b,_0x0479('0x1a8'));}}break;case'5':_0x3cc1c6[_0x0479('0x1a9')]+=0x1;_0x22d53b[_0x0479('0xa1')]=0x5;_0x22d53b[_0x0479('0xa2')]='Busy';_0x22d53b['countbusyretry']+=0x1;_0x22d53b[_0x0479('0xe8')]+=0x1;ami[_0x0479('0xdf')](_0x0479('0x1aa'),ut[_0x0479('0xe1')](_0x1e905d,'busy'));_0x99a0a9['createHistory'](_0x22d53b)[_0x0479('0xae')](loggerCatch(_0x0479('0x1ab')));if(_0x99a0a9[_0x0479('0x190')](0x5,_0x1e905d,_0x3cc1c6)){if(_0x22d53b[_0x0479('0xeb')]>=_0x3cc1c6['dialBusyMaxRetry']){_0x99a0a9[_0x0479('0xf4')](_0x22d53b,_0x324d31,_0xe41e8b,_0x0479('0x1ac'));}else{_0x99a0a9['stateGlobal'](_0x22d53b,_0x324d31,_0xe41e8b,'reason\x205\x20busy');}}break;case'8':_0x3cc1c6['outboundCongestionCallsDay']+=0x1;_0x22d53b[_0x0479('0xa1')]=0x8;_0x22d53b[_0x0479('0xa2')]=_0x0479('0x1ad');_0x22d53b['countcongestionretry']+=0x1;_0x22d53b['countglobal']+=0x1;ami[_0x0479('0xdf')](_0x0479('0x1ae'),ut[_0x0479('0xe1')](_0x1e905d,_0x0479('0x1af')));_0x99a0a9[_0x0479('0xc5')](_0x22d53b)['catch'](loggerCatch(_0x0479('0x1b0')));if(_0x99a0a9['checkRetriveMax'](0x8,_0x1e905d,_0x3cc1c6)){if(_0x22d53b[_0x0479('0xec')]>=_0x3cc1c6['dialCongestionMaxRetry']){_0x99a0a9[_0x0479('0xf4')](_0x22d53b,_0x324d31,_0xe41e8b,_0x0479('0x1b1'));}else{_0x99a0a9['stateGlobal'](_0x22d53b,_0x324d31,_0xe41e8b,_0x0479('0x1b1'));}}break;case'11':_0x3cc1c6['outboundAbandonedCallsDay']+=0x1;_0x22d53b[_0x0479('0xa1')]=0xb;_0x22d53b[_0x0479('0xa2')]=_0x0479('0x113');_0x22d53b['countabandonedretry']+=0x1;_0x22d53b[_0x0479('0xe8')]+=0x1;_0x99a0a9['createHistory'](_0x22d53b)[_0x0479('0xae')](loggerCatch(_0x0479('0x118')));if(_0x99a0a9[_0x0479('0x190')](0xb,_0x1e905d,_0x3cc1c6)){if(_0x22d53b['countabandonedretry']>=_0x3cc1c6[_0x0479('0x19a')]){_0x99a0a9[_0x0479('0xf4')](_0x22d53b,_0x324d31,_0xe41e8b,_0x0479('0x1b2'));}else{_0x99a0a9[_0x0479('0xf2')](_0x22d53b,_0x324d31,_0xe41e8b,'reason\x2011\x20abandoned');}}break;case'20':_0x3cc1c6[_0x0479('0x5d')]+=0x1;_0x22d53b['state']=0x14;_0x22d53b[_0x0479('0xa2')]=_0x0479('0x1b3');_0x22d53b[_0x0479('0xf0')]+=0x1;_0x22d53b['countglobal']+=0x1;ami[_0x0479('0xdf')]('custom:agentreject',ut[_0x0479('0xe1')](_0x1e905d,'agentreject'));_0x99a0a9[_0x0479('0xc5')](_0x22d53b)[_0x0479('0xae')](loggerCatch(_0x0479('0x1b4')));if(_0x99a0a9[_0x0479('0x190')](0x14,_0x1e905d,_0x3cc1c6)){if(_0x22d53b[_0x0479('0xf0')]>=_0x3cc1c6['dialAgentRejectMaxRetry']){_0x99a0a9[_0x0479('0xf4')](_0x22d53b,_0x324d31,_0xe41e8b,_0x0479('0x1b5'));}else{_0x99a0a9[_0x0479('0xf2')](_0x22d53b,_0x324d31,_0xe41e8b,_0x0479('0x1b5'));}}break;default:_0x3cc1c6[_0x0479('0x5e')]+=0x1;_0x22d53b[_0x0479('0xa1')]=0xc;_0x22d53b[_0x0479('0xa2')]=_0x874d71[_0x0479('0x102')];_0x99a0a9['createHistory'](_0x22d53b)['catch'](loggerCatch(_0x0479('0x1b6')));if(_0x99a0a9[_0x0479('0x190')](_0x874d71[_0x0479('0x102')],_0x1e905d,_0x3cc1c6)){if(_0x22d53b[_0x0479('0xeb')]+_0x22d53b[_0x0479('0xec')]+_0x22d53b[_0x0479('0xfa')]+_0x22d53b[_0x0479('0xed')]+_0x22d53b[_0x0479('0xee')]+_0x22d53b['countabandonedretry']+_0x22d53b[_0x0479('0xef')]+_0x22d53b['countagentrejectretry']>=_0x3cc1c6[_0x0479('0xf1')]){_0x99a0a9[_0x0479('0xf2')](_0x22d53b,_0x324d31,_0xe41e8b,_0x874d71[_0x0479('0x102')]);}else{_0x99a0a9[_0x0479('0xf4')](_0x22d53b,_0x324d31,_0xe41e8b,_0x874d71[_0x0479('0x102')]);}}}});};Dialer[_0x0479('0xa5')][_0x0479('0xf2')]=function(_0x1a8094,_0x1e71f,_0x3138ce,_0x3a3406){var _0x44c5ce=new Final(_0x1a8094);_0x44c5ce['state']=0xf;_0x44c5ce[_0x0479('0xa2')]='Global';this[_0x0479('0xf4')](_0x44c5ce,_0x1e71f,_0x3138ce,_0x3a3406);};Dialer[_0x0479('0xa5')][_0x0479('0xf4')]=function(_0x5656e6,_0x21f358,_0x30d416,_0x477f80){this[_0x0479('0xc3')](_0x5656e6)[_0x0479('0xb5')](function(){return _0x21f358(msgResponse(_0x0479('0x1a1'),'Success',_0x477f80));})[_0x0479('0xae')](function(){return _0x30d416(msgResponse(_0x0479('0x1b7'),'Failure',_0x0479('0x1b8')));});};Dialer[_0x0479('0xa5')]['predictive']=function(_0xaca514){var _0x1eb683=_0xaca514[_0x0479('0x1b9')]/0x64;var _0x274770=_0xaca514[_0x0479('0x10a')]/(_0xaca514[_0x0479('0x10a')]+_0xaca514[_0x0479('0x57')]);var _0x4c4e41=Math[_0x0479('0x1ba')](_0xaca514[_0x0479('0x67')]*(_0xaca514[_0x0479('0x1bb')]/0x64));var _0x11319=Math[_0x0479('0x1ba')](_0xaca514['predictiveIntervalAvailable']*(_0xaca514[_0x0479('0x1bc')]/0x64));var _0xe19dd0=_0xaca514['available']+_0xaca514[_0x0479('0x4e')];var _0x3540ce=Math[_0x0479('0x1bd')](_0xaca514[_0x0479('0x6a')]*_0xaca514[_0x0479('0x86')]*_0xaca514[_0x0479('0x64')]*_0xaca514[_0x0479('0x65')]);if(_[_0x0479('0x37')](_0xaca514['startProgressive'])){if(!_[_0x0479('0x37')](_0xaca514[_0x0479('0x26')])){_0xaca514[_0x0479('0x26')]=undefined;loggerPredictive[_0x0479('0x90')](_0x0479('0x1be'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x0479('0x37')](_0xaca514['handlePredictive'])){loggerPredictive[_0x0479('0x90')](_0x0479('0x1be'),_0x0479('0x1bf'));clearInterval(_0xaca514[_0x0479('0x8b')]);_0xaca514['handlePredictive']=undefined;}_0xaca514[_0x0479('0x27')]=moment()[_0x0479('0x71')](_0x0479('0x104'));loggerPredictive[_0x0479('0x76')](_0xaca514[_0x0479('0x3a')],_0x0479('0x1c0'),_0xaca514['startProgressive']);this['handlePower'](_0xaca514,0x1);}else if(ifInterval(_0xaca514[_0x0479('0x1c1')],_0xaca514[_0x0479('0x27')])){this['handlePower'](_0xaca514,0x1);loggerPredictiveCalls[_0x0479('0x76')](_0x0479('0x1c2'),_0xaca514[_0x0479('0x27')],_0xaca514['name']);_0xaca514[_0x0479('0x6a')]=0x0;_0xaca514[_0x0479('0x63')]=0x0;}else if(_0x1eb683<_0x274770&&_0xaca514[_0x0479('0x1c3')]===_0x0479('0x1c4')){freeVariablesPredictive(_0xaca514);loggerPredictive['info'](_0x0479('0x1c5'),_0x0479('0x1c6'),_0x274770,_0x0479('0x27'),_0xaca514[_0x0479('0x3a')]);}else if(_0x3540ce<_0xaca514[_0x0479('0x63')]&&_0xaca514['dialPredictiveOptimization']===_0x0479('0x1c4')){freeVariablesPredictive(_0xaca514);loggerPredictive[_0x0479('0x76')](_0x0479('0x1c7'),'Max\x20Drop\x20',_0x3540ce,'Drop\x20in\x20this\x20interval',_0xaca514['predictiveIntervalErlangCallsDroppedCalls'],_0x0479('0x27'),_0xaca514[_0x0479('0x3a')]);}else if(!ifInterval(_0xaca514[_0x0479('0x1c1')],_0xaca514[_0x0479('0x27')])&&_['isUndefined'](_0xaca514[_0x0479('0x26')])&&!_[_0x0479('0x37')](_0xaca514[_0x0479('0x27')])){_0xaca514[_0x0479('0x26')]=moment()[_0x0479('0x71')](_0x0479('0x104'));loggerPredictive[_0x0479('0x76')](_0xaca514[_0x0479('0x3a')],_0x0479('0x1c8'),_0xaca514['startPredictive']);this[_0x0479('0xbb')](_0xaca514[_0x0479('0x1c1')])['then'](this[_0x0479('0x1c9')](_0xaca514))[_0x0479('0xb5')](mergeDataErlangB(_0xaca514))[_0x0479('0xb5')](this[_0x0479('0x1ca')](_0xaca514))['catch'](loggerCatchPredictive(_0x0479('0x1cb'),_0xaca514));}else if(!ifInterval(_0xaca514[_0x0479('0x1c1')],_0xaca514[_0x0479('0x26')])){_0xaca514['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0xaca514[_0x0479('0x26')]=moment()[_0x0479('0x71')](_0x0479('0x104'));loggerPredictive[_0x0479('0x76')](_0xaca514[_0x0479('0x3a')],_0x0479('0x1cc'),_0xaca514[_0x0479('0x26')]);clearInterval(_0xaca514[_0x0479('0x8b')]);_0xaca514[_0x0479('0x8b')]=undefined;this['averageHandleTime'](_0xaca514[_0x0479('0x1c1')])[_0x0479('0xb5')](this[_0x0479('0x1c9')](_0xaca514))['then'](mergeDataErlangB(_0xaca514))[_0x0479('0xb5')](this['startMethodPredictive'](_0xaca514))[_0x0479('0xae')](loggerCatchPredictive(_0x0479('0x1cd'),_0xaca514));}else if(_0xaca514['predictiveIntervalAvailable']&&_0xe19dd0<_0xaca514[_0x0479('0x67')]-_0x11319){freeVariablesPredictive(_0xaca514);loggerPredictive[_0x0479('0x76')](_0xaca514[_0x0479('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xe19dd0,_0x0479('0x1ce'),_0xaca514[_0x0479('0x67')],'-',_0x11319,'=',_0xaca514['predictiveIntervalAvailable']-_0x11319,')');}else if(_0xaca514[_0x0479('0x67')]&&_0xe19dd0>_0xaca514[_0x0479('0x67')]+_0x4c4e41){freeVariablesPredictive(_0xaca514);loggerPredictive['info'](_0xaca514[_0x0479('0x3a')],_0x0479('0x1cf'),_0xe19dd0,')\x20are\x20more\x20than\x20threshold\x20(',_0xaca514['predictiveIntervalAvailable'],'+',_0x4c4e41,'=',_0xaca514[_0x0479('0x67')]+_0x4c4e41,')');}};Dialer['prototype'][_0x0479('0x1c9')]=function(_0x4bc5dc){var _0x677c3e=this;return function(_0x57932f){return new BPromise(function(_0x72edee,_0x18a13a){_[_0x0479('0x88')](_0x4bc5dc,_0x57932f[0x0]);if(checkGetDataPredictive(_0x57932f[0x0])){var _0x3db2a9=_0x4bc5dc[_0x0479('0x67')]=_0x4bc5dc[_0x0479('0x4e')]+_0x4bc5dc[_0x0479('0x9b')];var _0x358a99=_0x4bc5dc[_0x0479('0x1c1')]*0x3c;var _0x4b093c=_0x57932f[0x0]['predictiveIntervalAvgTalktime']+_0x57932f[0x0][_0x0479('0x5f')];var _0x52c193=(_0x57932f[0x0]['predictiveIntervalAnsweredCalls']+_0x57932f[0x0][_0x0479('0x61')]+_0x57932f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x57932f[0x0]['predictiveIntervalTotalCalls'];_0x4bc5dc[_0x0479('0x64')]=_0x52c193>0x0?_0x52c193:0x1;switch(_0x4bc5dc[_0x0479('0x1c3')]){case _0x0479('0x1c4'):var _0x5b0d99=_0x4bc5dc[_0x0479('0x1b9')]/0x64;return _0x677c3e[_0x0479('0x1d0')](_0x3db2a9,_0x358a99,_0x4b093c,_0x52c193,_0x5b0d99)[_0x0479('0xb5')](function(_0x32a921){return _0x72edee(_0x32a921);});case'agentBusyFactor':var _0x5d0678=_0x4bc5dc[_0x0479('0x1b9')]/0x64;return _0x677c3e[_0x0479('0x1d1')](_0x3db2a9,_0x358a99,_0x4b093c,_0x52c193,_0x5d0678)[_0x0479('0xb5')](function(_0x5f8f60){return _0x72edee(_0x5f8f60);});default:return _0x18a13a(msgResponse(_0x0479('0x1d2'),_0x0479('0x138'),_0x0479('0x1d3')));}}else{return _0x18a13a(msgResponse(_0x0479('0x1d2'),_0x0479('0x138'),_0x0479('0x1d4')));}});};};Dialer[_0x0479('0xa5')][_0x0479('0x1d5')]=function(_0x52f320){var _0x11e3ef=this;return function(_0x112390){return new BPromise(function(_0x289a73,_0x29a958){_[_0x0479('0x88')](_0x52f320,_0x112390[0x0]);if(checkGetDataPredictive(_0x112390[0x0])){loggerPredictive[_0x0479('0x76')](JSON['stringify'](_0x112390[0x0]));if(_0x52f320[_0x0479('0x1c3')]===_0x0479('0x1c4')){return _0x11e3ef['getVoiceQueueRtPauses'](_0x52f320['id'])['then'](function(_0x5f10d8){var _0x4b0f90=_0x52f320['loggedIn']-_0x5f10d8[0x0][_0x0479('0x1d6')];var _0x1c2de0=_0x52f320[_0x0479('0x1c1')]*0x3c;var _0x4f08b7=_0x112390[0x0][_0x0479('0x60')]+_0x112390[0x0]['predictiveIntervalAvgHoldtime'];var _0x188b86=(_0x112390[0x0][_0x0479('0x7a')]+_0x112390[0x0][_0x0479('0x61')]+_0x112390[0x0][_0x0479('0x112')])/_0x112390[0x0]['predictiveIntervalTotalCalls'];var _0x860ab8=_0x52f320[_0x0479('0x1b9')]/0x64;_0x52f320['predictiveIntervalPauses']=_0x5f10d8[0x0][_0x0479('0x1d6')]||0x0;_0x52f320[_0x0479('0x64')]=_0x188b86>0x0?_0x188b86:0x1;return _0x11e3ef['abandonmentRate'](_0x4b0f90,_0x1c2de0,_0x4f08b7,_0x188b86,_0x860ab8);})['then'](function(_0x1aa230){return _0x289a73(_0x1aa230);})[_0x0479('0xae')](function(_0x227f7a){return _0x29a958(msgResponse(_0x0479('0x1d7'),_0x0479('0x138'),JSON[_0x0479('0x70')](_0x227f7a)));});}if(_0x52f320[_0x0479('0x1c3')]===_0x0479('0x1d8')){return _0x11e3ef['getVoiceQueueRtPauses'](_0x52f320['id'])['then'](function(_0x51521b){var _0x519862=_0x52f320[_0x0479('0x49')]-_0x51521b[0x0]['outboundQueuePauses'];var _0x14be7c=_0x52f320[_0x0479('0x1c1')]*0x3c;var _0x5a6302=_0x112390[0x0][_0x0479('0x60')]+_0x112390[0x0][_0x0479('0x5f')];var _0x3a2a36=(_0x112390[0x0]['predictiveIntervalAnsweredCalls']+_0x112390[0x0][_0x0479('0x61')]+_0x112390[0x0][_0x0479('0x112')])/_0x112390[0x0]['predictiveIntervalTotalCalls'];var _0x27557c=_0x52f320[_0x0479('0x1b9')]/0x64;_0x52f320[_0x0479('0x66')]=_0x51521b[0x0][_0x0479('0x1d6')]||0x0;_0x52f320[_0x0479('0x64')]=_0x3a2a36>0x0?_0x3a2a36:0x1;return _0x11e3ef[_0x0479('0x1d1')](_0x519862,_0x14be7c,_0x5a6302,_0x3a2a36,_0x27557c);})[_0x0479('0xb5')](function(_0x4ea7de){return _0x289a73(_0x4ea7de);})['catch'](function(_0x3e5346){return _0x29a958(msgResponse(_0x0479('0x1d7'),_0x0479('0x138'),JSON['stringify'](_0x3e5346)));});}}else{return _0x29a958(msgResponse('[getDataPredictive]','Failure',_0x0479('0x1d4')));}});};};Dialer[_0x0479('0xa5')]['startMethodPredictive']=function(_0x3b740c){var _0x28d954=this;return function(){var _0x2383c6=0x0;var _0x5569ef=Math[_0x0479('0x1bd')](_0x3b740c[_0x0479('0x6b')]*0x3e8);if(_0x5569ef>0x0){_0x5569ef=_0x5569ef<0x64?0x64:_0x5569ef;loggerPredictive[_0x0479('0x76')](_0x3b740c[_0x0479('0x3a')],_0x0479('0x1d9'),_0x5569ef,_0x0479('0x43'));_0x3b740c[_0x0479('0x8b')]=setInterval(function(){_0x28d954[_0x0479('0x8b')](_0x3b740c);loggerPredictiveCalls[_0x0479('0x76')]('[handlePredictive]',_0x2383c6+=0x1);},_0x5569ef);}else{loggerPredictive[_0x0479('0x76')](_0x3b740c['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x0479('0xa5')][_0x0479('0x1da')]=function(_0x4d298f,_0x5ec131){var _0x438906=this;return function(_0x38da16){if(_[_0x0479('0x75')](_0x38da16)){if(_[_0x0479('0xd6')](_0x5ec131[_0x0479('0xcd')])||!_0x5ec131[_0x0479('0x1db')]){if(_0x4d298f[_0x0479('0x151')]===_0x0479('0x14e')){_0x4d298f[_0x0479('0x122')]=_[_0x0479('0x37')](_0x4d298f['queueStatusComplete'])?!![]:_0x4d298f[_0x0479('0x122')];var _0x241ebd=uuid['v4']();_0x438906[_0x0479('0xa8')][_0x241ebd]=new Action(_0x4d298f,_0x5ec131,_0x241ebd);loggerBooked[_0x0479('0x76')](_0x0479('0x1dc'),_0x241ebd,_0x0479('0x1dd'),JSON[_0x0479('0x70')](_0x4d298f[_0x0479('0x122')]),_0x0479('0x1de'),_0x4d298f[_0x0479('0x3a')]);if(_0x4d298f[_0x0479('0x122')]){_0x4d298f['queueStatusComplete']=![];_0x438906[_0x0479('0x29')][_0x438906['actions'][_0x241ebd][_0x0479('0xb1')]]=[];ami[_0x0479('0xab')]({'actionid':_0x241ebd,'action':_0x0479('0x1df'),'queue':_0x4d298f['name']})['catch'](function(){_0x438906[_0x0479('0xb0')](_0x4d298f);_0x438906[_0x0479('0xbd')]({'active':![],'ContactId':_0x438906[_0x0479('0xa8')][_0x241ebd][_0x0479('0xcb')],'ListId':_0x438906[_0x0479('0xa8')][_0x241ebd]['ListId'],'VoiceQueueId':_0x438906['actions'][_0x241ebd][_0x0479('0xf9')]||undefined,'CampaignId':_0x438906[_0x0479('0xa8')][_0x241ebd][_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch(_0x0479('0x1e0')));delete _0x438906[_0x0479('0xa8')][_0x241ebd];});}else{loggerBooked['info'](_0x0479('0x1e1'),JSON[_0x0479('0x70')](_0x4d298f[_0x0479('0x122')]),'Queue:\x20',_0x4d298f[_0x0479('0x3a')]);_0x438906[_0x0479('0xb0')](_0x4d298f);_0x438906[_0x0479('0xbd')]({'active':![],'ContactId':_0x438906[_0x0479('0xa8')][_0x241ebd][_0x0479('0xcb')],'ListId':_0x438906[_0x0479('0xa8')][_0x241ebd]['ListId'],'VoiceQueueId':_0x438906[_0x0479('0xa8')][_0x241ebd][_0x0479('0xf9')]||undefined,'CampaignId':_0x438906[_0x0479('0xa8')][_0x241ebd][_0x0479('0xce')]||undefined})[_0x0479('0xae')](loggerCatch(_0x0479('0x1e0')));delete _0x438906['actions'][_0x241ebd];}}else{return _0x438906[_0x0479('0x1e2')](_0x4d298f,_0x5ec131);}}else{if(getDiff(_0x5ec131[_0x0479('0x1e3')])<_0x4d298f[_0x0479('0x1e4')]*0x3c){if(_0x5ec131['Agent']&&!_0x5ec131[_0x0479('0x1e5')][_0x0479('0x1e6')]){_0x438906[_0x0479('0x1d')][_0x0479('0x12b')](_0x5ec131['id'])['finally'](function(){_0x438906['updateOriginated'](_0x4d298f);});}else{_0x438906['unlockContact']({'active':![]},_0x5ec131['id'],0x1)[_0x0479('0x1c')](function(){_0x438906['updateOriginated'](_0x4d298f);});}}else{_0x4d298f[_0x0479('0x1e7')]+=0x1;_0x438906[_0x0479('0xb0')](_0x4d298f);if(_0x4d298f[_0x0479('0x1e8')]){_0x438906[_0x0479('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5ec131[_0x0479('0xcb')],'ListId':_0x5ec131[_0x0479('0xcc')],'VoiceQueueId':_0x5ec131['VoiceQueueId']||undefined,'CampaignId':_0x5ec131['CampaignId']||undefined})[_0x0479('0xae')](loggerCatch(_0x0479('0x1e9')));_0x438906['createHistory'](createObjHistory(_0x4d298f,_0x5ec131,'RECALLINQUEUE',0x17,'RecallInQueue'))['catch'](loggerCatch(_0x0479('0x1ea')));}else{_0x438906['saveInDb'](createObjHistory(_0x4d298f,_0x5ec131,_0x0479('0x1eb'),0x16,'RecallFailedTimeout'),_0x0479('0x1ec'),_0x0479('0x1ed'));}}}}else{_0x4d298f['outboundBlacklistCallsDay']+=0x1;_0x438906['saveInDb'](createObjHistory(_0x4d298f,_0x5ec131,_0x0479('0x1ee'),0xd,_0x0479('0x1ef')),'[Originate][historyBlacklist]',_0x0479('0x1f0'));throw'inBlackList';}};};Dialer['prototype'][_0x0479('0x1f1')]=function(_0x53784c){var _0x212e65=this;var _0x59acbe=_0x53784c['limitCalls']-_0x53784c[_0x0479('0x69')]-_0x53784c['temp'];emitCampaignSummary(_0x53784c);if(_0x59acbe>0x0){if(_0x59acbe>this[_0x0479('0x22')]){_0x59acbe=this[_0x0479('0x22')];}_0x53784c['temp']+=_0x59acbe;this['getContactDialerIvr'](_0x53784c['id'],_0x59acbe,_0x53784c[_0x0479('0x1f2')])[_0x0479('0xb5')](function(_0x116fad){_0x53784c['temp']-=_0x59acbe;_0x53784c[_0x0479('0x1f3')]=_0x53784c[_0x0479('0x1f3')]>0x0?_0x53784c[_0x0479('0x1f3')]:0x0;if(!checkContactEmpty(_0x116fad)){_0x53784c[_0x0479('0x38')]=_0x0479('0x98');logger[_0x0479('0x76')](_0x0479('0x1f4')+_0x53784c[_0x0479('0x3a')]);}else{_0x53784c[_0x0479('0x69')]+=_0x116fad[_0x0479('0x127')];_0x53784c['message']='RUNNING';for(var _0x417887=0x0;_0x417887<_0x116fad[_0x0479('0x127')];_0x417887+=0x1){_0x53784c['ivrTotalCallsDays']+=0x1;if(_[_0x0479('0xd6')](_0x116fad[_0x417887])||_['isNil'](_0x116fad[_0x417887][_0x0479('0x15d')])||_[_0x0479('0xd6')](_0x116fad[_0x417887]['Contact'][_0x0479('0x15e')])){_0x212e65['emptyContact'](_0x0479('0x1f5'),_0x53784c,_0x116fad[_0x417887]);}else{_0x212e65['checkIsBlackListIvr'](_[_0x0479('0x11f')](_0x116fad[_0x417887],[_0x0479('0xce'),_0x0479('0x1f6')]))[_0x0479('0xb5')](_0x212e65[_0x0479('0x1da')](_0x53784c,_0x116fad[_0x417887]))[_0x0479('0xae')](_0x212e65['loggerHandler']('[actionOriginateIvr]\x20',_0x53784c));}}}})[_0x0479('0xae')](loggerGetContactDialer(_0x0479('0x1f7'),_0x53784c,_0x59acbe));}};Dialer['prototype']['handlePower']=function(_0x22eecc,_0x5c07ed){var _0x3b36d3=this;var _0x2f4a0e=[];var _0x57b850=_0x5c07ed>=0x1?_0x5c07ed:0x1;if(_0x22eecc['dialMethod']===_0x0479('0x14e')){_0x57b850=0x1;}var _0x34035c=Math[_0x0479('0x1bd')](_0x22eecc[_0x0479('0x9b')]*_0x57b850)-_0x22eecc[_0x0479('0x69')]-_0x22eecc[_0x0479('0x1f3')];emitVoiceQueueSummary(_0x22eecc);if(_0x22eecc['dialLimitQueue']>0x0){var _0x30fcbc=_0x22eecc['dialLimitQueue']-_0x22eecc[_0x0479('0x69')]-_0x22eecc['talking']-_0x22eecc[_0x0479('0x1f3')]-_0x22eecc[_0x0479('0x4a')];if(_0x34035c>_0x30fcbc){_0x34035c=_0x30fcbc;}}if(_0x34035c>0x0){if(_0x22eecc[_0x0479('0x151')]===_0x0479('0x14e')){_0x34035c=0x1;}if(_0x34035c>this[_0x0479('0x22')]){_0x34035c=this['maxNumberOriginate'];}_0x22eecc['temp']+=_0x34035c;for(var _0x44d45a in this[_0x0479('0x20')]){if(typeof this['agents'][_0x44d45a]!==_0x0479('0x92')){if(this[_0x0479('0x20')][_0x44d45a][_0x0479('0xa1')]===_0x0479('0x1f8')&&this[_0x0479('0x20')][_0x44d45a][_0x0479('0xac')]===_0x0479('0xd4')){_0x2f4a0e[_0x0479('0x11e')](this['agents'][_0x44d45a]['id']);}}}this[_0x0479('0xbf')](_0x22eecc['id'],_0x2f4a0e,_0x34035c,_0x22eecc[_0x0479('0x1f2')])['then'](function(_0x361a24){_0x22eecc[_0x0479('0x1f3')]-=_0x34035c;_0x22eecc[_0x0479('0x1f3')]=_0x22eecc['temp']>0x0?_0x22eecc[_0x0479('0x1f3')]:0x0;if(!checkContactEmpty(_0x361a24)){_0x3b36d3[_0x0479('0xb3')](_0x22eecc)['then'](sendMessageReschedule(_0x22eecc))[_0x0479('0xae')](loggerCatch(_0x0479('0xb6')));}else{_0x22eecc[_0x0479('0x69')]+=_0x361a24['length'];_0x22eecc[_0x0479('0x38')]=_0x22eecc['dialMethod']===_0x0479('0x14e')?_0x0479('0x1f9'):_0x0479('0x1fa');for(var _0x11c6ce=0x0;_0x11c6ce<_0x361a24[_0x0479('0x127')];_0x11c6ce+=0x1){if(_['isNil'](_0x361a24[_0x11c6ce])||_[_0x0479('0xd6')](_0x361a24[_0x11c6ce][_0x0479('0x15d')])||_[_0x0479('0xd6')](_0x361a24[_0x11c6ce][_0x0479('0x15d')][_0x0479('0x15e')])){_0x3b36d3[_0x0479('0xca')](_0x0479('0x1f5'),_0x22eecc,_0x361a24[_0x11c6ce]);}else{_0x3b36d3[_0x0479('0xb7')](_[_0x0479('0x11f')](_0x361a24[_0x11c6ce],[_0x0479('0xf9'),'Contact.phone']))['then'](_0x3b36d3[_0x0479('0x1da')](_0x22eecc,_0x361a24[_0x11c6ce]))[_0x0479('0xae')](_0x3b36d3[_0x0479('0xc9')](_0x0479('0x1f5'),_0x22eecc));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x22eecc,_0x34035c));}};Dialer[_0x0479('0xa5')][_0x0479('0x8b')]=function(_0x17b7f3){if(_0x17b7f3[_0x0479('0x1fb')]>0x0){var _0x18996c=_0x17b7f3['dialLimitQueue']-_0x17b7f3[_0x0479('0x69')]-_0x17b7f3[_0x0479('0x4e')];if(_0x18996c>0x0){this[_0x0479('0x1fc')](_0x17b7f3);}else{loggerPredictiveCalls[_0x0479('0x76')](_0x0479('0x1fd'));}}else{this[_0x0479('0x1fc')](_0x17b7f3);}};Dialer[_0x0479('0xa5')]['tryOriginatePredictive']=function(_0x2343a8){var _0x3349f8=this;var _0x402009=[];_0x2343a8['originated']+=0x1;for(var _0x2d6d4f in this[_0x0479('0x20')]){if(typeof this[_0x0479('0x20')][_0x2d6d4f]!==_0x0479('0x92')){if(this[_0x0479('0x20')][_0x2d6d4f]['state']==='not_inuse'&&this[_0x0479('0x20')][_0x2d6d4f][_0x0479('0xac')]==='reachable'){_0x402009['push'](this[_0x0479('0x20')][_0x2d6d4f]['id']);}}}this[_0x0479('0xbf')](_0x2343a8['id'],_0x402009,0x1,_0x2343a8['dialOrderByScheduledAt'])['then'](function(_0x10b6d6){if(!checkContactEmpty(_0x10b6d6)){checkContactLowerLimitOriginate(_0x2343a8,0x1,0x0);_0x3349f8[_0x0479('0xb3')](_0x2343a8)['then'](sendMessageReschedule(_0x2343a8))['catch'](loggerCatch(_0x0479('0xb6')));}else{_0x2343a8[_0x0479('0x38')]=_0x0479('0x1fa');if(_['isNil'](_0x10b6d6[0x0])||_[_0x0479('0xd6')](_0x10b6d6[0x0][_0x0479('0x15d')])||_[_0x0479('0xd6')](_0x10b6d6[0x0][_0x0479('0x15d')][_0x0479('0x15e')])){_0x3349f8['emptyContact'](_0x0479('0x1f5'),_0x2343a8,_0x10b6d6[0x0]);}else{_0x3349f8['checkIsBlackList'](_[_0x0479('0x11f')](_0x10b6d6[0x0],['VoiceQueueId',_0x0479('0x1f6')]))['then'](_0x3349f8[_0x0479('0x1da')](_0x2343a8,_0x10b6d6[0x0]))['catch'](_0x3349f8[_0x0479('0xc9')]('[actionOriginatePredictive]\x20',_0x2343a8));}}})['catch'](loggerGetContactDialer(_0x0479('0x1fe'),_0x2343a8,0x1));emitVoiceQueueSummary(_0x2343a8);};Dialer[_0x0479('0xa5')]['abandonmentRate']=function(_0x174418,_0x3e00d4,_0x33c32b,_0x37d2ec,_0x1e8a87,_0x3ca0af){loggerPredictive['info'](_0x0479('0x1ff'));loggerPredictive[_0x0479('0x76')](_0x0479('0x200'),_0x174418);loggerPredictive[_0x0479('0x76')](_0x0479('0x201'),_0x3e00d4);loggerPredictive[_0x0479('0x76')]('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',_0x33c32b);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37d2ec);loggerPredictive[_0x0479('0x76')](_0x0479('0x202'),_0x1e8a87);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x53012a,_0x4cb86d){if(_0x174418<=0x0||isNaN(_0x174418)){return _0x4cb86d(msgResponse('[abandonmentRate]',_0x0479('0x42'),_0x0479('0x203')+_0x174418));}if(_0x33c32b<=0x0||isNaN(_0x33c32b)){return _0x4cb86d(msgResponse(_0x0479('0x204'),'Error',_0x0479('0x205')+_0x33c32b));}if(_0x37d2ec<=0x0||isNaN(_0x37d2ec)){return _0x4cb86d(msgResponse('[abandonmentRate]',_0x0479('0x42'),_0x0479('0x206')+_0x37d2ec));}if(_0x3e00d4<=0x0||isNaN(_0x3e00d4)){return _0x4cb86d(msgResponse(_0x0479('0x204'),'Error',_0x0479('0x207')+_0x3e00d4));}if(_0x1e8a87<=0x0||isNaN(_0x1e8a87)){return _0x4cb86d(msgResponse(_0x0479('0x204'),_0x0479('0x42'),_0x0479('0x208')+_0x1e8a87));}_0x3ca0af=_0x3ca0af||0x0;var _0x508e20=0x1/_0x33c32b;var _0xe2098d=0x0;var _0x42e441=0x0;var _0x3bd394=0x0;var _0x4e8d87=0x0;for(var _0x1381c3=0x0;_0x3bd394<_0x1e8a87;_0x1381c3+=0x1){_0x42e441=_0x1381c3/_0x3e00d4;_0xe2098d=(_0x37d2ec*_0x42e441+_0x3ca0af)/_0x508e20;_0x3bd394=erlangb(_0xe2098d,_0x174418);_0x4e8d87=_0xe2098d/_0x174418*(0x1-erlangb(_0xe2098d,_0x174418));}return _0x53012a({'erlangCalls':_0x1381c3,'erlangCallToSecond':_0x3e00d4/_0x1381c3,'erlangAbandonmentRate':_0x3bd394,'erlangBusyFactor':_0x4e8d87});});};Dialer[_0x0479('0xa5')][_0x0479('0x1d1')]=function(_0x1604e8,_0x2d105e,_0x6066b2,_0x46e2e9,_0x486f19,_0x1cedda){loggerPredictive[_0x0479('0x76')](_0x0479('0x209'));loggerPredictive[_0x0479('0x76')](_0x0479('0x200'),_0x1604e8);loggerPredictive['info'](_0x0479('0x201'),_0x2d105e);loggerPredictive[_0x0479('0x76')](_0x0479('0x20a'),_0x6066b2);loggerPredictive[_0x0479('0x76')](_0x0479('0x20b'),_0x46e2e9);loggerPredictive[_0x0479('0x76')](_0x0479('0x20c'),_0x486f19);loggerPredictive[_0x0479('0x76')](_0x0479('0x7f'));return new BPromise(function(_0x376b03,_0x47042c){if(_0x1604e8<=0x0||isNaN(_0x1604e8)){return _0x47042c(msgResponse('[busyFactor]',_0x0479('0x42'),'m\x20=\x20'+_0x1604e8));}if(_0x6066b2<=0x0||isNaN(_0x6066b2)){return _0x47042c(msgResponse(_0x0479('0x20d'),'Error',_0x0479('0x205')+_0x6066b2));}if(_0x46e2e9<=0x0||isNaN(_0x46e2e9)){return _0x47042c(msgResponse(_0x0479('0x20d'),_0x0479('0x42'),_0x0479('0x206')+_0x46e2e9));}if(_0x2d105e<=0x0||isNaN(_0x2d105e)){return _0x47042c(msgResponse(_0x0479('0x20d'),'Error',_0x0479('0x207')+_0x2d105e));}if(_0x486f19<=0x0||isNaN(_0x486f19)){return _0x47042c(msgResponse(_0x0479('0x20d'),_0x0479('0x42'),_0x0479('0x20e')+_0x486f19));}_0x1cedda=_0x1cedda||0x0;var _0x5aa59e=0x1/_0x6066b2;var _0x377be6=0x0;var _0x36d82b=0x0;var _0x5de402=0x0;var _0x2caecc=0x0;for(var _0x287384=0x0;_0x2caecc<_0x486f19;_0x287384+=0x1){_0x36d82b=_0x287384/_0x2d105e;_0x377be6=(_0x46e2e9*_0x36d82b+_0x1cedda)/_0x5aa59e;_0x5de402=erlangb(_0x377be6,_0x1604e8);_0x2caecc=_0x377be6/_0x1604e8*(0x1-erlangb(_0x377be6,_0x1604e8));}return _0x376b03({'erlangCalls':_0x287384,'erlangCallToSecond':_0x2d105e/_0x287384,'erlangAbandonmentRate':_0x5de402,'erlangBusyFactor':_0x2caecc});});};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 bcd6d89..650d46d 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 _0x1981=['originatecalleridname','exports','util','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x340c36,_0x2ff8fd){var _0x92a7d4=function(_0x1a6c50){while(--_0x1a6c50){_0x340c36['push'](_0x340c36['shift']());}};_0x92a7d4(++_0x2ff8fd);}(_0x1981,0x1e2));var _0x1198=function(_0x540fad,_0x5874e5){_0x540fad=_0x540fad-0x0;var _0x8508a2=_0x1981[_0x540fad];return _0x8508a2;};'use strict';var util=require(_0x1198('0x0'));var _=require('lodash');var moment=require(_0x1198('0x1'));function getSeconds(_0x1b249e,_0x12ab38){var _0x50aa3d=moment(_0x1b249e)[_0x1198('0x2')](0x0);var _0xccbd73=moment(_0x12ab38)['milliseconds'](0x0);return _0x50aa3d['diff'](_0xccbd73,_0x1198('0x3'));}function QueueCallerAbandon(_0x4611d2,_0x3dde64){this['scheduledat']=_0x4611d2[_0x1198('0x4')];this[_0x1198('0x5')]=_0x4611d2[_0x1198('0x5')];this[_0x1198('0x6')]=_0x4611d2[_0x1198('0x5')]===_0x1198('0x7')?'queue':_0x4611d2[_0x1198('0x5')];this[_0x1198('0x8')]=_0x4611d2['countbusyretry'];this[_0x1198('0x9')]=_0x4611d2[_0x1198('0x9')];this[_0x1198('0xa')]=_0x4611d2[_0x1198('0xa')];this['countglobal']=_0x4611d2[_0x1198('0x8')]+_0x4611d2[_0x1198('0x9')]+_0x4611d2['countnoanswerretry']+_0x4611d2[_0x1198('0xb')]+_0x4611d2[_0x1198('0xc')]+_0x4611d2[_0x1198('0xd')]+_0x4611d2[_0x1198('0xe')]+_0x4611d2[_0x1198('0xf')];this[_0x1198('0xb')]=_0x4611d2[_0x1198('0xb')];this['countdropretry']=_0x4611d2[_0x1198('0xc')];this['countabandonedretry']=_0x4611d2[_0x1198('0xd')];this[_0x1198('0xe')]=_0x4611d2[_0x1198('0xe')];this[_0x1198('0xf')]=_0x4611d2[_0x1198('0xf')];this[_0x1198('0x10')]=_0x3dde64[_0x1198('0x10')];this[_0x1198('0x11')]=_0x4611d2[_0x1198('0x12')];this[_0x1198('0x13')]=_0x4611d2[_0x1198('0x14')];this[_0x1198('0x15')]=_0x4611d2['starttime'];this['responsetime']=_0x4611d2[_0x1198('0x16')];this[_0x1198('0x17')]=_0x4611d2[_0x1198('0x17')];this['endtime']=this[_0x1198('0x17')];this['ringtime']=getSeconds(_0x4611d2[_0x1198('0x16')],_0x4611d2[_0x1198('0x15')]);this[_0x1198('0x18')]=getSeconds(this['droptime'],_0x4611d2[_0x1198('0x16')]);this['talktime']=0x0;this[_0x1198('0x19')]=_0x3dde64[_0x1198('0x19')];this[_0x1198('0x1a')]=_0x3dde64['connectedlinename'];this[_0x1198('0x1b')]=_0x3dde64['reason'];this[_0x1198('0x1c')]=_0x4611d2['callback'];this[_0x1198('0x1d')]=_0x4611d2[_0x1198('0x1d')];this['callbackat']=_0x4611d2[_0x1198('0x1e')];this[_0x1198('0x1f')]=_0x4611d2[_0x1198('0x1f')];this[_0x1198('0x20')]=_0x4611d2['ContactId'];this[_0x1198('0x21')]=_0x4611d2['ListId'];this[_0x1198('0x22')]=_0x4611d2[_0x1198('0x22')];this[_0x1198('0x23')]=_0x4611d2[_0x1198('0x23')];this['CampaignId']=_0x4611d2[_0x1198('0x24')];this[_0x1198('0x25')]=_0x4611d2[_0x1198('0x25')]||'';this[_0x1198('0x26')]=_0x4611d2[_0x1198('0x26')]||'';}module[_0x1198('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x8ecd=['util','lodash','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x2347f2,_0x5ce297){var _0x4081f6=function(_0x414d79){while(--_0x414d79){_0x2347f2['push'](_0x2347f2['shift']());}};_0x4081f6(++_0x5ce297);}(_0x8ecd,0xc8));var _0xd8ec=function(_0x337ef8,_0x3971ab){_0x337ef8=_0x337ef8-0x0;var _0x585b75=_0x8ecd[_0x337ef8];return _0x585b75;};'use strict';var util=require(_0xd8ec('0x0'));var _=require(_0xd8ec('0x1'));var moment=require('moment');function getSeconds(_0x28ef42,_0x1dfa81){var _0x430cd5=moment(_0x28ef42)['milliseconds'](0x0);var _0x227f7a=moment(_0x1dfa81)[_0xd8ec('0x2')](0x0);return _0x430cd5['diff'](_0x227f7a,_0xd8ec('0x3'));}function QueueCallerAbandon(_0x4b2a6a,_0x290a3f){this[_0xd8ec('0x4')]=_0x4b2a6a[_0xd8ec('0x4')];this[_0xd8ec('0x5')]=_0x4b2a6a[_0xd8ec('0x5')];this[_0xd8ec('0x6')]=_0x4b2a6a['type']===_0xd8ec('0x7')?_0xd8ec('0x8'):_0x4b2a6a['type'];this[_0xd8ec('0x9')]=_0x4b2a6a[_0xd8ec('0x9')];this[_0xd8ec('0xa')]=_0x4b2a6a['countcongestionretry'];this[_0xd8ec('0xb')]=_0x4b2a6a['countnoanswerretry'];this[_0xd8ec('0xc')]=_0x4b2a6a[_0xd8ec('0x9')]+_0x4b2a6a[_0xd8ec('0xa')]+_0x4b2a6a['countnoanswerretry']+_0x4b2a6a['countnosuchnumberretry']+_0x4b2a6a[_0xd8ec('0xd')]+_0x4b2a6a[_0xd8ec('0xe')]+_0x4b2a6a[_0xd8ec('0xf')]+_0x4b2a6a[_0xd8ec('0x10')];this['countnosuchnumberretry']=_0x4b2a6a[_0xd8ec('0x11')];this[_0xd8ec('0xd')]=_0x4b2a6a[_0xd8ec('0xd')];this[_0xd8ec('0xe')]=_0x4b2a6a[_0xd8ec('0xe')];this['countmachineretry']=_0x4b2a6a['countmachineretry'];this[_0xd8ec('0x10')]=_0x4b2a6a[_0xd8ec('0x10')];this[_0xd8ec('0x12')]=_0x290a3f['uniqueid'];this[_0xd8ec('0x13')]=_0x4b2a6a[_0xd8ec('0x14')];this['calleridnum']=_0x4b2a6a[_0xd8ec('0x15')];this[_0xd8ec('0x16')]=_0x4b2a6a[_0xd8ec('0x16')];this[_0xd8ec('0x17')]=_0x4b2a6a[_0xd8ec('0x17')];this[_0xd8ec('0x18')]=_0x4b2a6a['droptime'];this['endtime']=this[_0xd8ec('0x18')];this['ringtime']=getSeconds(_0x4b2a6a[_0xd8ec('0x17')],_0x4b2a6a['starttime']);this[_0xd8ec('0x19')]=getSeconds(this[_0xd8ec('0x18')],_0x4b2a6a['responsetime']);this[_0xd8ec('0x1a')]=0x0;this[_0xd8ec('0x8')]=_0x290a3f[_0xd8ec('0x8')];this[_0xd8ec('0x1b')]=_0x290a3f['connectedlinename'];this[_0xd8ec('0x1c')]=_0x290a3f[_0xd8ec('0x1c')];this[_0xd8ec('0x1d')]=_0x4b2a6a['callback'];this['callbackuniqueid']=_0x4b2a6a[_0xd8ec('0x1e')];this[_0xd8ec('0x1f')]=_0x4b2a6a[_0xd8ec('0x1f')];this['recallme']=_0x4b2a6a['recallme'];this[_0xd8ec('0x20')]=_0x4b2a6a[_0xd8ec('0x20')];this[_0xd8ec('0x21')]=_0x4b2a6a[_0xd8ec('0x21')];this[_0xd8ec('0x22')]=_0x4b2a6a[_0xd8ec('0x22')];this[_0xd8ec('0x23')]=_0x4b2a6a[_0xd8ec('0x23')];this['CampaignId']=_0x4b2a6a[_0xd8ec('0x24')];this[_0xd8ec('0x25')]=_0x4b2a6a[_0xd8ec('0x25')]||'';this['originatecalleridname']=_0x4b2a6a[_0xd8ec('0x26')]||'';}module[_0xd8ec('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 182bc48..f485bd9 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 _0x1793=['moment','%s/%s/%s','tech','name','fax','localstationid','headerinfo','path','AttachmentId','util'];(function(_0x4c825d,_0x10ec2b){var _0x43de87=function(_0xcab4a3){while(--_0xcab4a3){_0x4c825d['push'](_0x4c825d['shift']());}};_0x43de87(++_0x10ec2b);}(_0x1793,0xdb));var _0x3179=function(_0x3e7a28,_0x25a64e){_0x3e7a28=_0x3e7a28-0x0;var _0x51387b=_0x1793[_0x3e7a28];return _0x51387b;};'use strict';var util=require(_0x3179('0x0'));var _=require('lodash');var moment=require(_0x3179('0x1'));function Action(_0x38bff7,_0x82d64,_0x4d1f8e){this['uniqueid']=_0x38bff7||undefined;this['channel']=util['format'](_0x3179('0x2'),_0x82d64[_0x3179('0x3')],_0x82d64['Trunk'][_0x3179('0x4')],_0x4d1f8e[_0x3179('0x5')]);this[_0x3179('0x6')]=_0x82d64[_0x3179('0x6')];this[_0x3179('0x7')]=_0x82d64[_0x3179('0x7')];this[_0x3179('0x8')]=_0x4d1f8e['path'];this[_0x3179('0x9')]=_0x4d1f8e[_0x3179('0x9')];}module['exports']=Action; \ No newline at end of file +var _0x3b82=['%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','util','uniqueid','channel','format'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x3b82,0x182));var _0x23b8=function(_0x25bd2a,_0xc8fe7a){_0x25bd2a=_0x25bd2a-0x0;var _0xb6b479=_0x3b82[_0x25bd2a];return _0xb6b479;};'use strict';var util=require(_0x23b8('0x0'));var _=require('lodash');var moment=require('moment');function Action(_0x2a21ee,_0x18ea48,_0x2d13a9){this[_0x23b8('0x1')]=_0x2a21ee||undefined;this[_0x23b8('0x2')]=util[_0x23b8('0x3')](_0x23b8('0x4'),_0x18ea48[_0x23b8('0x5')],_0x18ea48[_0x23b8('0x6')][_0x23b8('0x7')],_0x2d13a9[_0x23b8('0x8')]);this[_0x23b8('0x9')]=_0x18ea48['localstationid'];this[_0x23b8('0xa')]=_0x18ea48['headerinfo'];this[_0x23b8('0xb')]=_0x2d13a9[_0x23b8('0xb')];this[_0x23b8('0xc')]=_0x2d13a9[_0x23b8('0xc')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 291ef20..a0eb3f8 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 _0x3771=['syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED','send','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','syncVarSet','newstate','syncNewState','newexten','faxstatus'];(function(_0x4a9889,_0x4b1954){var _0x5b496f=function(_0x2ebfdf){while(--_0x2ebfdf){_0x4a9889['push'](_0x4a9889['shift']());}};_0x5b496f(++_0x4b1954);}(_0x3771,0x146));var _0x1377=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x3771[_0x16d10f];return _0x50c823;};'use strict';var util=require(_0x1377('0x0'));var _=require(_0x1377('0x1'));var BPromise=require(_0x1377('0x2'));var uuid=require(_0x1377('0x3'));var moment=require(_0x1377('0x4'));var path=require(_0x1377('0x5'));var tiff2pdf=require(_0x1377('0x6'));var gs=require('./util/gs');var logger=require(_0x1377('0x7'))('fax');var ami=require('../ami');var rpcDb=require(_0x1377('0x8'));var Channel=require(_0x1377('0x9'));var ut=require(_0x1377('0xa'));var Action=require(_0x1377('0xb'));var faxAccount=require(_0x1377('0xc'));var attachment=require(_0x1377('0xd'));var faxMessage=require(_0x1377('0xe'));function Fax(_0xb975e3){this[_0x1377('0xf')]={};this[_0x1377('0x10')]=_0xb975e3['faxAccounts'];this[_0x1377('0x11')]=_0xb975e3['trunks'];this['actions']={};ami['on'](_0x1377('0x12'),this['syncNewchannel'][_0x1377('0x13')](this));ami['on']('varset',this[_0x1377('0x14')]['bind'](this));ami['on'](_0x1377('0x15'),this[_0x1377('0x16')][_0x1377('0x13')](this));ami['on'](_0x1377('0x17'),this['syncNewExten'][_0x1377('0x13')](this));ami['on'](_0x1377('0x18'),this[_0x1377('0x19')][_0x1377('0x13')](this));ami['on'](_0x1377('0x1a'),this[_0x1377('0x1b')]['bind'](this));ami['on'](_0x1377('0x1c'),this[_0x1377('0x1d')]['bind'](this));ami['on'](_0x1377('0x1e'),this[_0x1377('0x1f')][_0x1377('0x13')](this));}Fax['prototype'][_0x1377('0x20')]=function(_0x1d76cc){if(_0x1d76cc['context']===_0x1377('0x21')){for(var _0x1f86b3 in this[_0x1377('0x10')]){if(this[_0x1377('0x10')][_0x1377('0x22')](_0x1f86b3)){if(_0x1d76cc['exten']===this[_0x1377('0x10')][_0x1f86b3][_0x1377('0x23')]){this['channels'][_0x1d76cc[_0x1377('0x24')]]={};this['channels'][_0x1d76cc['uniqueid']][_0x1377('0x25')]=_0x1d76cc[_0x1377('0x25')];this['channels'][_0x1d76cc[_0x1377('0x24')]]['id']=this['faxAccounts'][_0x1f86b3]['id'];this[_0x1377('0xf')][_0x1d76cc[_0x1377('0x24')]]['name']=this[_0x1377('0x10')][_0x1f86b3][_0x1377('0x26')];logger[_0x1377('0x27')](_0x1d76cc[_0x1377('0x24')],_0x1377('0x28'));}}}}if(this[_0x1377('0x29')][_0x1d76cc[_0x1377('0x24')]]){this[_0x1377('0xf')][_0x1d76cc[_0x1377('0x24')]]={};this[_0x1377('0xf')][_0x1d76cc[_0x1377('0x24')]][_0x1377('0x25')]=_0x1d76cc[_0x1377('0x25')];logger[_0x1377('0x27')](_0x1d76cc['uniqueid'],_0x1377('0x28'));}};Fax[_0x1377('0x2a')][_0x1377('0x14')]=function(_0xb00d1f){if(this[_0x1377('0xf')][_0xb00d1f[_0x1377('0x24')]]){for(var _0x384ec8 in _0xb00d1f['variable']){if(_0xb00d1f[_0x1377('0x2b')][_0x1377('0x22')](_0x384ec8)){this['channels'][_0xb00d1f[_0x1377('0x24')]][_0x384ec8]=_0xb00d1f[_0x1377('0x2c')];}}}};Fax[_0x1377('0x2a')][_0x1377('0x16')]=function(_0x931622){if(this['channels'][_0x931622[_0x1377('0x24')]]){this[_0x1377('0xf')][_0x931622[_0x1377('0x24')]][_0x1377('0x2d')]=_0x931622[_0x1377('0x2d')];this[_0x1377('0xf')][_0x931622[_0x1377('0x24')]][_0x1377('0x2e')]=_0x931622[_0x1377('0x2e')];}};Fax['prototype'][_0x1377('0x2f')]=function(_0x1660f5){if(this[_0x1377('0xf')][_0x1660f5['uniqueid']]){for(var _0x5343e4 in _0x1660f5[_0x1377('0x2b')]){if(_0x1660f5[_0x1377('0x2b')][_0x1377('0x22')](_0x5343e4)){this[_0x1377('0xf')][_0x1660f5[_0x1377('0x24')]][_0x5343e4]=_0x1660f5[_0x1377('0x2c')];}}}};Fax[_0x1377('0x2a')][_0x1377('0x19')]=function(_0x1cfa4e){if(this[_0x1377('0xf')][_0x1cfa4e[_0x1377('0x24')]]){this[_0x1377('0xf')][_0x1cfa4e[_0x1377('0x24')]][_0x1377('0x30')]=_0x1cfa4e[_0x1377('0x30')];this['channels'][_0x1cfa4e[_0x1377('0x24')]][_0x1377('0x31')]=_0x1cfa4e[_0x1377('0x31')];this['channels'][_0x1cfa4e['uniqueid']][_0x1377('0x23')]=_0x1cfa4e['localstationid'];this[_0x1377('0xf')][_0x1cfa4e[_0x1377('0x24')]][_0x1377('0x32')]=_0x1cfa4e[_0x1377('0x32')];logger[_0x1377('0x27')](_0x1cfa4e['uniqueid'],_0x1377('0x33'));}};Fax[_0x1377('0x2a')][_0x1377('0x1b')]=function(_0x2469b5){var _0x526902=this;if(this[_0x1377('0xf')][_0x2469b5[_0x1377('0x24')]]){var _0x112896=this[_0x1377('0xf')][_0x2469b5[_0x1377('0x24')]]['id'];this['channels'][_0x2469b5[_0x1377('0x24')]]['remotestationid']=_0x2469b5['remotestationid'];this[_0x1377('0xf')][_0x2469b5['uniqueid']][_0x1377('0x34')]=_0x2469b5[_0x1377('0x34')];this[_0x1377('0xf')][_0x2469b5[_0x1377('0x24')]]['localstationid']=_0x2469b5[_0x1377('0x23')];this[_0x1377('0xf')][_0x2469b5['uniqueid']][_0x1377('0x35')]=_0x2469b5['resolution'];this[_0x1377('0xf')][_0x2469b5[_0x1377('0x24')]]['transferrate']=_0x2469b5['transferrate'];this[_0x1377('0xf')][_0x2469b5[_0x1377('0x24')]][_0x1377('0x32')]=_0x2469b5[_0x1377('0x32')];this[_0x1377('0xf')][_0x2469b5[_0x1377('0x24')]]['calleridnum']=_0x2469b5[_0x1377('0x36')];if(this['channels'][_0x2469b5['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x2469b5[_0x1377('0x32')],_0x1377('0x37'),function(_0x48b73a){logger['info'](_0x2469b5['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x48b73a[_0x1377('0x38')]);attachment[_0x1377('0x39')]({'name':path[_0x1377('0x3a')](_0x2469b5[_0x1377('0x32')])[_0x1377('0x26')],'basename':path['parse'](_0x2469b5['filename'])[_0x1377('0x26')]+_0x1377('0x3b'),'type':_0x1377('0x3c')})[_0x1377('0x3d')](function(_0x222d78){faxAccount[_0x1377('0x3e')](_0x112896,{'from':_0x2469b5[_0x1377('0x36')],'mapKey':_0x1377('0x3f'),'body':path['parse'](_0x2469b5['filename'])[_0x1377('0x26')]+_0x1377('0x3b'),'AttachmentId':_0x222d78['id']})[_0x1377('0x40')](function(_0x167bb2){logger[_0x1377('0x41')](_0x2469b5[_0x1377('0x24')],_0x1377('0x42'),JSON[_0x1377('0x43')](_0x167bb2));});})[_0x1377('0x40')](function(_0x5ef568){logger[_0x1377('0x41')](_0x2469b5['uniqueid'],_0x1377('0x44'),JSON[_0x1377('0x43')](_0x5ef568));});});}logger[_0x1377('0x27')](_0x2469b5[_0x1377('0x24')],_0x1377('0x44'));}};Fax[_0x1377('0x2a')]['syncOriginateResponse']=function(_0x15412b){if(this[_0x1377('0x29')][_0x15412b[_0x1377('0x24')]]){_[_0x1377('0x45')](this[_0x1377('0xf')][_0x15412b[_0x1377('0x24')]],_[_0x1377('0x46')](_0x15412b,[_0x1377('0x47'),_0x1377('0x48')]));}};function updateStatus(_0x265418){if(_0x265418[_0x1377('0x49')]){faxMessage[_0x1377('0x4a')](_0x265418[_0x1377('0x49')],{'failMessage':_0x1377('0x4b')})['then'](function(_0x6d0d1f){ut[_0x1377('0x4c')](_0x1377('0x4d'),_0x6d0d1f);})[_0x1377('0x40')](function(_0x528447){ut['logger'](_0x1377('0x4e'),_0x528447);});}else{ut[_0x1377('0x4c')](_0x1377('0x4f'));}}Fax[_0x1377('0x2a')][_0x1377('0x50')]=function(_0x262545,_0x233f5a,_0x28a473){var _0x235afe=this;var _0x35ff7b={};if(_0x233f5a){_0x35ff7b={'read':_0x233f5a};}else{_0x35ff7b={'failMessage':_0x28a473};}if(this[_0x1377('0x29')][_0x262545]['AttachmentId']){faxMessage[_0x1377('0x4a')](this[_0x1377('0x29')][_0x262545][_0x1377('0x49')],_0x35ff7b)[_0x1377('0x3d')](function(_0x435079){ut[_0x1377('0x4c')]('[Fax][Message][Updated]',_0x435079);})[_0x1377('0x40')](function(_0x3c36c9){ut['logger']('[Fax][Message][NoUpdate1]',_0x3c36c9);})[_0x1377('0x51')](function(){delete _0x235afe[_0x1377('0xf')][_0x262545];delete _0x235afe[_0x1377('0x29')][_0x262545];});}else{ut[_0x1377('0x4c')](_0x1377('0x52'));delete this['channels'][_0x262545];delete this['actions'][_0x262545];}};Fax[_0x1377('0x2a')][_0x1377('0x1d')]=function(_0x717b05){var _0x4be569=this;if(this[_0x1377('0xf')][_0x717b05[_0x1377('0x24')]]){if(this[_0x1377('0x29')][_0x717b05[_0x1377('0x24')]]){this[_0x1377('0xf')][_0x717b05[_0x1377('0x24')]]['id']=this[_0x1377('0x29')][_0x717b05[_0x1377('0x24')]]['id'];this[_0x1377('0xf')][_0x717b05[_0x1377('0x24')]][_0x1377('0x26')]=this['actions'][_0x717b05[_0x1377('0x24')]][_0x1377('0x26')];}logger[_0x1377('0x27')](_0x717b05[_0x1377('0x24')],this['actions'][_0x717b05['uniqueid']]?_0x1377('0x53'):_0x1377('0x54'),JSON[_0x1377('0x43')](this[_0x1377('0xf')][_0x717b05[_0x1377('0x24')]]));if(this[_0x1377('0x29')][_0x717b05[_0x1377('0x24')]]){if(this[_0x1377('0xf')][_0x717b05[_0x1377('0x24')]][_0x1377('0x55')]>0x0&&this[_0x1377('0xf')][_0x717b05[_0x1377('0x24')]][_0x1377('0x18')]===_0x1377('0x56')){this['updateStatus'](_0x717b05[_0x1377('0x24')],!![]);}else{this[_0x1377('0x50')](_0x717b05[_0x1377('0x24')],![],this[_0x1377('0xf')][_0x717b05[_0x1377('0x24')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x717b05[_0x1377('0x24')]]['faxstatusstring']:_0x1377('0x57'));}}}};Fax['prototype'][_0x1377('0x58')]=function(_0x485e23){var _0x409e5e=this;return new BPromise(function(_0x207989,_0x4dff7a){_0x409e5e['execOriginate'](_0x485e23,_0x409e5e[_0x1377('0x10')][_0x485e23['FaxAccountId']])[_0x1377('0x3d')](function(_0x733840){ut[_0x1377('0x4c')]('[Fax][execOriginate][success]',_0x733840);_0x207989(ut[_0x1377('0x38')](_0x1377('0x59')));})[_0x1377('0x40')](function(_0x518ba1){ut[_0x1377('0x4c')](_0x1377('0x5a'),_0x518ba1);updateStatus(_0x485e23);_0x4dff7a(ut[_0x1377('0x38')]('Fax\x20failed'));});});};Fax[_0x1377('0x2a')][_0x1377('0x5b')]=function(_0x4d1393){var _0xa823dd=this;return new BPromise(function(_0x384d6f,_0x4fb1fc){var _0x60048e=_0xa823dd[_0x1377('0x5c')](_0xa823dd[_0x1377('0x10')][_0x4d1393['FaxAccountId']]['Trunk'],_0x4d1393);if(_0x60048e[_0x1377('0x5d')]){_0x384d6f(ut[_0x1377('0x38')](_0x1377('0x5e')));}else{_0x4fb1fc(ut[_0x1377('0x38')](_0x60048e[_0x1377('0x38')]));}});};function originate(_0x152fa1,_0x1d7c43,_0x39bb7a){return new BPromise(function(_0x428ba7,_0x13ef96){if(_0x39bb7a){var _0x4ae592=util[_0x1377('0x5f')](_0x1377('0x60'),path[_0x1377('0x3a')](_0x152fa1[_0x1377('0x5')])['name'],_0x152fa1[_0x1377('0x5')]);gs[_0x1377('0x61')](_0x4ae592)[_0x1377('0x3d')](function(){_0x152fa1[_0x1377('0x5')]=util[_0x1377('0x5f')]('%s/%s.tif',path['parse'](_0x152fa1[_0x1377('0x5')])[_0x1377('0x62')],path[_0x1377('0x3a')](_0x152fa1['path'])[_0x1377('0x26')]);_0x1d7c43[_0x1377('0x63')]=_0x152fa1[_0x1377('0x5')];ut[_0x1377('0x4c')]('Convert\x20pdf\x20to\x20tif','');ami[_0x1377('0x64')](ut[_0x1377('0x65')](_0x152fa1,_0x1d7c43))[_0x1377('0x3d')](function(_0x13c0b7){_0x428ba7(_0x13c0b7);})[_0x1377('0x40')](function(_0x465f11){_0x13ef96(_0x465f11);});})[_0x1377('0x40')](function(_0x302774){_0x13ef96(_0x302774);});}else{ami[_0x1377('0x64')](ut['variablesAction'](_0x152fa1,_0x1d7c43))['then'](function(_0x41fe73){_0x428ba7(_0x41fe73);})[_0x1377('0x40')](function(_0x5180e7){_0x13ef96(_0x5180e7);});}});}Fax[_0x1377('0x2a')][_0x1377('0x66')]=function(_0x47c203,_0x43052a){var _0x11ac3f=this;return new BPromise(function(_0x3d271d,_0x25a192){var _0x7a991f=uuid['v4']();var _0x4e12e4=ut[_0x1377('0x67')](_0x47c203,_0x43052a);_0x11ac3f[_0x1377('0x29')][_0x7a991f]=new Action(_0x7a991f,_0x43052a,_0x47c203);var _0x3d8152=_0x11ac3f[_0x1377('0x29')][_0x7a991f];if(path[_0x1377('0x3a')](_0x47c203[_0x1377('0x5')])[_0x1377('0x68')]===_0x1377('0x3b')){originate(_0x3d8152,_0x4e12e4,!![])[_0x1377('0x3d')](function(_0x260c4e){_0x3d271d(_0x260c4e);})[_0x1377('0x40')](function(_0x552b1d){_0x25a192(_0x552b1d);});}else{originate(_0x3d8152,_0x4e12e4,![])[_0x1377('0x3d')](function(_0x478078){_0x3d271d(_0x478078);})['catch'](function(_0x4a564d){_0x25a192(_0x4a564d);});}});};Fax[_0x1377('0x2a')][_0x1377('0x69')]=function(_0x5e9c9a){return!_[_0x1377('0x6a')](_0x5e9c9a)&&!_[_0x1377('0x6a')](_0x5e9c9a['name'])&&!_[_0x1377('0x6a')](_0x5e9c9a[_0x1377('0x6b')])&&_0x5e9c9a[_0x1377('0x6b')]&&!_[_0x1377('0x6a')](this[_0x1377('0x11')][util[_0x1377('0x5f')](_0x1377('0x6c'),_0x5e9c9a[_0x1377('0x26')])])&&!_[_0x1377('0x6a')](this[_0x1377('0x11')][util['format'](_0x1377('0x6c'),_0x5e9c9a[_0x1377('0x26')])][_0x1377('0x31')])&&(this['trunks'][util[_0x1377('0x5f')](_0x1377('0x6c'),_0x5e9c9a[_0x1377('0x26')])]['status']===_0x1377('0x6d')||this[_0x1377('0x11')][util['format']('SIP/%s',_0x5e9c9a[_0x1377('0x26')])][_0x1377('0x31')]===_0x1377('0x6e'));};Fax[_0x1377('0x2a')][_0x1377('0x5c')]=function(_0x480c42,_0xd96207){if(!this[_0x1377('0x69')](_0x480c42)){ut[_0x1377('0x4c')](_0x1377('0x6f'),_[_0x1377('0x6a')](_0x480c42)?'':_0x480c42[_0x1377('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0xd96207[_0x1377('0x3f')])){ut[_0x1377('0x4c')](_0x1377('0x70'),JSON[_0x1377('0x43')](_0xd96207));return{'isValid':![],'message':_0x1377('0x71')};}if(_[_0x1377('0x6a')](_0xd96207[_0x1377('0x5')])){ut[_0x1377('0x4c')](_0x1377('0x72'),JSON[_0x1377('0x43')](_0xd96207));return{'isValid':![],'message':_0x1377('0x73')};}return{'isValid':!![],'message':_0x1377('0x74')};};module['exports']=Fax; \ No newline at end of file +var _0xc57f=['AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','.pdf','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','hasOwnProperty','exten','uniqueid','channel','name','\x20syncNewchannel\x20','actions','info','prototype','variable','channelstate','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','parse','then','stringify','catch','error','\x20receiveFax\x20','merge','pick','response','reason'];(function(_0x40ae4a,_0x50beb6){var _0x56cb21=function(_0x12fbf4){while(--_0x12fbf4){_0x40ae4a['push'](_0x40ae4a['shift']());}};_0x56cb21(++_0x50beb6);}(_0xc57f,0x10e));var _0xfc57=function(_0xce5ed0,_0x1a8206){_0xce5ed0=_0xce5ed0-0x0;var _0x42820c=_0xc57f[_0xce5ed0];return _0x42820c;};'use strict';var util=require('util');var _=require(_0xfc57('0x0'));var BPromise=require(_0xfc57('0x1'));var uuid=require(_0xfc57('0x2'));var moment=require(_0xfc57('0x3'));var path=require(_0xfc57('0x4'));var tiff2pdf=require(_0xfc57('0x5'));var gs=require(_0xfc57('0x6'));var logger=require('../../../config/logger')(_0xfc57('0x7'));var ami=require('../ami');var rpcDb=require(_0xfc57('0x8'));var Channel=require(_0xfc57('0x9'));var ut=require(_0xfc57('0xa'));var Action=require('./action');var faxAccount=require(_0xfc57('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xfc57('0xc'));function Fax(_0x166927){this[_0xfc57('0xd')]={};this[_0xfc57('0xe')]=_0x166927[_0xfc57('0xe')];this['trunks']=_0x166927['trunks'];this['actions']={};ami['on'](_0xfc57('0xf'),this[_0xfc57('0x10')][_0xfc57('0x11')](this));ami['on'](_0xfc57('0x12'),this[_0xfc57('0x13')][_0xfc57('0x11')](this));ami['on']('newstate',this[_0xfc57('0x14')][_0xfc57('0x11')](this));ami['on']('newexten',this[_0xfc57('0x15')]['bind'](this));ami['on']('faxstatus',this[_0xfc57('0x16')][_0xfc57('0x11')](this));ami['on']('receivefax',this[_0xfc57('0x17')][_0xfc57('0x11')](this));ami['on'](_0xfc57('0x18'),this[_0xfc57('0x19')]['bind'](this));ami['on'](_0xfc57('0x1a'),this[_0xfc57('0x1b')][_0xfc57('0x11')](this));}Fax['prototype']['syncNewchannel']=function(_0x29ff44){if(_0x29ff44['context']==='from-voip-provider'){for(var _0x5bff24 in this[_0xfc57('0xe')]){if(this[_0xfc57('0xe')][_0xfc57('0x1c')](_0x5bff24)){if(_0x29ff44[_0xfc57('0x1d')]===this['faxAccounts'][_0x5bff24]['localstationid']){this[_0xfc57('0xd')][_0x29ff44[_0xfc57('0x1e')]]={};this['channels'][_0x29ff44[_0xfc57('0x1e')]]['channel']=_0x29ff44[_0xfc57('0x1f')];this[_0xfc57('0xd')][_0x29ff44['uniqueid']]['id']=this[_0xfc57('0xe')][_0x5bff24]['id'];this[_0xfc57('0xd')][_0x29ff44[_0xfc57('0x1e')]][_0xfc57('0x20')]=this[_0xfc57('0xe')][_0x5bff24]['name'];logger['info'](_0x29ff44[_0xfc57('0x1e')],_0xfc57('0x21'));}}}}if(this[_0xfc57('0x22')][_0x29ff44[_0xfc57('0x1e')]]){this['channels'][_0x29ff44['uniqueid']]={};this['channels'][_0x29ff44[_0xfc57('0x1e')]][_0xfc57('0x1f')]=_0x29ff44[_0xfc57('0x1f')];logger[_0xfc57('0x23')](_0x29ff44[_0xfc57('0x1e')],_0xfc57('0x21'));}};Fax[_0xfc57('0x24')][_0xfc57('0x13')]=function(_0x142729){if(this[_0xfc57('0xd')][_0x142729[_0xfc57('0x1e')]]){for(var _0x1e4edc in _0x142729[_0xfc57('0x25')]){if(_0x142729[_0xfc57('0x25')][_0xfc57('0x1c')](_0x1e4edc)){this['channels'][_0x142729[_0xfc57('0x1e')]][_0x1e4edc]=_0x142729['value'];}}}};Fax['prototype'][_0xfc57('0x14')]=function(_0xaf3ebd){if(this['channels'][_0xaf3ebd[_0xfc57('0x1e')]]){this[_0xfc57('0xd')][_0xaf3ebd['uniqueid']]['channelstate']=_0xaf3ebd[_0xfc57('0x26')];this[_0xfc57('0xd')][_0xaf3ebd[_0xfc57('0x1e')]]['channelstatedesc']=_0xaf3ebd['channelstatedesc'];}};Fax[_0xfc57('0x24')][_0xfc57('0x15')]=function(_0x5b9635){if(this[_0xfc57('0xd')][_0x5b9635[_0xfc57('0x1e')]]){for(var _0x1661c2 in _0x5b9635[_0xfc57('0x25')]){if(_0x5b9635[_0xfc57('0x25')][_0xfc57('0x1c')](_0x1661c2)){this[_0xfc57('0xd')][_0x5b9635['uniqueid']][_0x1661c2]=_0x5b9635['value'];}}}};Fax['prototype']['syncFaxStatus']=function(_0x400e2d){if(this[_0xfc57('0xd')][_0x400e2d[_0xfc57('0x1e')]]){this[_0xfc57('0xd')][_0x400e2d[_0xfc57('0x1e')]][_0xfc57('0x27')]=_0x400e2d[_0xfc57('0x27')];this[_0xfc57('0xd')][_0x400e2d[_0xfc57('0x1e')]]['status']=_0x400e2d[_0xfc57('0x28')];this[_0xfc57('0xd')][_0x400e2d[_0xfc57('0x1e')]][_0xfc57('0x29')]=_0x400e2d[_0xfc57('0x29')];this['channels'][_0x400e2d['uniqueid']][_0xfc57('0x2a')]=_0x400e2d[_0xfc57('0x2a')];logger[_0xfc57('0x23')](_0x400e2d['uniqueid'],_0xfc57('0x2b'));}};Fax[_0xfc57('0x24')][_0xfc57('0x17')]=function(_0x59f354){var _0x5a8404=this;if(this['channels'][_0x59f354[_0xfc57('0x1e')]]){var _0x4c9ba2=this[_0xfc57('0xd')][_0x59f354[_0xfc57('0x1e')]]['id'];this[_0xfc57('0xd')][_0x59f354[_0xfc57('0x1e')]]['remotestationid']=_0x59f354[_0xfc57('0x2c')];this['channels'][_0x59f354['uniqueid']][_0xfc57('0x2d')]=_0x59f354[_0xfc57('0x2d')];this[_0xfc57('0xd')][_0x59f354[_0xfc57('0x1e')]]['localstationid']=_0x59f354[_0xfc57('0x29')];this[_0xfc57('0xd')][_0x59f354[_0xfc57('0x1e')]][_0xfc57('0x2e')]=_0x59f354['resolution'];this['channels'][_0x59f354[_0xfc57('0x1e')]][_0xfc57('0x2f')]=_0x59f354[_0xfc57('0x2f')];this['channels'][_0x59f354['uniqueid']]['filename']=_0x59f354[_0xfc57('0x2a')];this[_0xfc57('0xd')][_0x59f354[_0xfc57('0x1e')]][_0xfc57('0x30')]=_0x59f354[_0xfc57('0x30')];if(this[_0xfc57('0xd')][_0x59f354[_0xfc57('0x1e')]][_0xfc57('0x2d')]>0x0){tiff2pdf(_0x59f354['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x25ba6c){logger['info'](_0x59f354['uniqueid'],_0xfc57('0x31'),_0x25ba6c['message']);attachment['create']({'name':path['parse'](_0x59f354[_0xfc57('0x2a')])[_0xfc57('0x20')],'basename':path[_0xfc57('0x32')](_0x59f354[_0xfc57('0x2a')])[_0xfc57('0x20')]+'.pdf','type':'application/pdf'})[_0xfc57('0x33')](function(_0x5596aa){faxAccount['notify'](_0x4c9ba2,{'from':_0x59f354['calleridnum'],'mapKey':'fax','body':path[_0xfc57('0x32')](_0x59f354[_0xfc57('0x2a')])[_0xfc57('0x20')]+'.pdf','AttachmentId':_0x5596aa['id']})['catch'](function(_0x3fa4d2){logger['error'](_0x59f354[_0xfc57('0x1e')],'\x20notify\x20',JSON[_0xfc57('0x34')](_0x3fa4d2));});})[_0xfc57('0x35')](function(_0xc87607){logger[_0xfc57('0x36')](_0x59f354['uniqueid'],_0xfc57('0x37'),JSON[_0xfc57('0x34')](_0xc87607));});});}logger[_0xfc57('0x23')](_0x59f354[_0xfc57('0x1e')],_0xfc57('0x37'));}};Fax['prototype']['syncOriginateResponse']=function(_0x446eb8){if(this['actions'][_0x446eb8[_0xfc57('0x1e')]]){_[_0xfc57('0x38')](this['channels'][_0x446eb8[_0xfc57('0x1e')]],_[_0xfc57('0x39')](_0x446eb8,[_0xfc57('0x3a'),_0xfc57('0x3b')]));}};function updateStatus(_0x5cb5fc){if(_0x5cb5fc[_0xfc57('0x3c')]){faxMessage[_0xfc57('0x3d')](_0x5cb5fc['AttachmentId'],{'failMessage':_0xfc57('0x3e')})['then'](function(_0x117fec){ut[_0xfc57('0x3f')](_0xfc57('0x40'),_0x117fec);})[_0xfc57('0x35')](function(_0x2f529d){ut[_0xfc57('0x3f')](_0xfc57('0x41'),_0x2f529d);});}else{ut[_0xfc57('0x3f')](_0xfc57('0x42'));}}Fax['prototype']['updateStatus']=function(_0x5519ca,_0x14fe60,_0x45a3ca){var _0x3db5f3=this;var _0x47e766={};if(_0x14fe60){_0x47e766={'read':_0x14fe60};}else{_0x47e766={'failMessage':_0x45a3ca};}if(this[_0xfc57('0x22')][_0x5519ca][_0xfc57('0x3c')]){faxMessage[_0xfc57('0x3d')](this[_0xfc57('0x22')][_0x5519ca][_0xfc57('0x3c')],_0x47e766)[_0xfc57('0x33')](function(_0xb7a2db){ut[_0xfc57('0x3f')](_0xfc57('0x43'),_0xb7a2db);})[_0xfc57('0x35')](function(_0x32d198){ut['logger'](_0xfc57('0x44'),_0x32d198);})[_0xfc57('0x45')](function(){delete _0x3db5f3[_0xfc57('0xd')][_0x5519ca];delete _0x3db5f3['actions'][_0x5519ca];});}else{ut[_0xfc57('0x3f')]('[Fax][Message][NoUpdate2]');delete this[_0xfc57('0xd')][_0x5519ca];delete this[_0xfc57('0x22')][_0x5519ca];}};Fax['prototype'][_0xfc57('0x19')]=function(_0x3351c0){var _0x96d58b=this;if(this[_0xfc57('0xd')][_0x3351c0[_0xfc57('0x1e')]]){if(this[_0xfc57('0x22')][_0x3351c0['uniqueid']]){this['channels'][_0x3351c0['uniqueid']]['id']=this[_0xfc57('0x22')][_0x3351c0[_0xfc57('0x1e')]]['id'];this['channels'][_0x3351c0['uniqueid']][_0xfc57('0x20')]=this[_0xfc57('0x22')][_0x3351c0[_0xfc57('0x1e')]][_0xfc57('0x20')];}logger[_0xfc57('0x23')](_0x3351c0[_0xfc57('0x1e')],this[_0xfc57('0x22')][_0x3351c0[_0xfc57('0x1e')]]?_0xfc57('0x46'):_0xfc57('0x47'),JSON[_0xfc57('0x34')](this['channels'][_0x3351c0[_0xfc57('0x1e')]]));if(this['actions'][_0x3351c0[_0xfc57('0x1e')]]){if(this[_0xfc57('0xd')][_0x3351c0[_0xfc57('0x1e')]][_0xfc57('0x48')]>0x0&&this['channels'][_0x3351c0[_0xfc57('0x1e')]][_0xfc57('0x49')]==='SUCCESS'){this['updateStatus'](_0x3351c0[_0xfc57('0x1e')],!![]);}else{this[_0xfc57('0x4a')](_0x3351c0[_0xfc57('0x1e')],![],this[_0xfc57('0xd')][_0x3351c0[_0xfc57('0x1e')]][_0xfc57('0x4b')]?_0xfc57('0x4c')+this['channels'][_0x3351c0[_0xfc57('0x1e')]][_0xfc57('0x4b')]:_0xfc57('0x4d'));}}}};Fax['prototype'][_0xfc57('0x4e')]=function(_0x9a7510){var _0x298e8d=this;return new BPromise(function(_0x5e321d,_0x2b2015){_0x298e8d[_0xfc57('0x4f')](_0x9a7510,_0x298e8d[_0xfc57('0xe')][_0x9a7510['FaxAccountId']])[_0xfc57('0x33')](function(_0x26b0e7){ut[_0xfc57('0x3f')](_0xfc57('0x50'),_0x26b0e7);_0x5e321d(ut[_0xfc57('0x51')](_0xfc57('0x52')));})['catch'](function(_0x3c535d){ut[_0xfc57('0x3f')](_0xfc57('0x53'),_0x3c535d);updateStatus(_0x9a7510);_0x2b2015(ut[_0xfc57('0x51')](_0xfc57('0x54')));});});};Fax['prototype'][_0xfc57('0x55')]=function(_0x19c800){var _0x28b1c8=this;return new BPromise(function(_0x3d1260,_0x5632c1){var _0x195434=_0x28b1c8[_0xfc57('0x56')](_0x28b1c8['faxAccounts'][_0x19c800['FaxAccountId']][_0xfc57('0x57')],_0x19c800);if(_0x195434[_0xfc57('0x58')]){_0x3d1260(ut[_0xfc57('0x51')](_0xfc57('0x59')));}else{_0x5632c1(ut[_0xfc57('0x51')](_0x195434[_0xfc57('0x51')]));}});};function originate(_0x17eb8,_0x4a5329,_0x1fdefc){return new BPromise(function(_0x2a1afc,_0xeeba8f){if(_0x1fdefc){var _0x1a2007=util[_0xfc57('0x5a')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xfc57('0x32')](_0x17eb8['path'])[_0xfc57('0x20')],_0x17eb8[_0xfc57('0x4')]);gs[_0xfc57('0x5b')](_0x1a2007)[_0xfc57('0x33')](function(){_0x17eb8['path']=util[_0xfc57('0x5a')](_0xfc57('0x5c'),path[_0xfc57('0x32')](_0x17eb8[_0xfc57('0x4')])[_0xfc57('0x5d')],path[_0xfc57('0x32')](_0x17eb8[_0xfc57('0x4')])[_0xfc57('0x20')]);_0x4a5329['XMF-PATH']=_0x17eb8[_0xfc57('0x4')];ut['logger'](_0xfc57('0x5e'),'');ami[_0xfc57('0x5f')](ut[_0xfc57('0x60')](_0x17eb8,_0x4a5329))['then'](function(_0x4a6160){_0x2a1afc(_0x4a6160);})['catch'](function(_0x1b033b){_0xeeba8f(_0x1b033b);});})[_0xfc57('0x35')](function(_0x536f59){_0xeeba8f(_0x536f59);});}else{ami[_0xfc57('0x5f')](ut['variablesAction'](_0x17eb8,_0x4a5329))[_0xfc57('0x33')](function(_0x516d73){_0x2a1afc(_0x516d73);})['catch'](function(_0x16832b){_0xeeba8f(_0x16832b);});}});}Fax[_0xfc57('0x24')][_0xfc57('0x4f')]=function(_0x556c37,_0x527bd8){var _0x289550=this;return new BPromise(function(_0x4bc1cc,_0x2af4cf){var _0x1c66eb=uuid['v4']();var _0x1d68dc=ut['addVariables'](_0x556c37,_0x527bd8);_0x289550[_0xfc57('0x22')][_0x1c66eb]=new Action(_0x1c66eb,_0x527bd8,_0x556c37);var _0x2249aa=_0x289550[_0xfc57('0x22')][_0x1c66eb];if(path[_0xfc57('0x32')](_0x556c37[_0xfc57('0x4')])[_0xfc57('0x61')]===_0xfc57('0x62')){originate(_0x2249aa,_0x1d68dc,!![])['then'](function(_0x3c4221){_0x4bc1cc(_0x3c4221);})[_0xfc57('0x35')](function(_0x278058){_0x2af4cf(_0x278058);});}else{originate(_0x2249aa,_0x1d68dc,![])[_0xfc57('0x33')](function(_0x4d12ac){_0x4bc1cc(_0x4d12ac);})[_0xfc57('0x35')](function(_0x3b17ea){_0x2af4cf(_0x3b17ea);});}});};Fax['prototype'][_0xfc57('0x63')]=function(_0xaccbc2){return!_[_0xfc57('0x64')](_0xaccbc2)&&!_[_0xfc57('0x64')](_0xaccbc2[_0xfc57('0x20')])&&!_['isNil'](_0xaccbc2[_0xfc57('0x65')])&&_0xaccbc2[_0xfc57('0x65')]&&!_[_0xfc57('0x64')](this[_0xfc57('0x66')][util[_0xfc57('0x5a')](_0xfc57('0x67'),_0xaccbc2['name'])])&&!_[_0xfc57('0x64')](this[_0xfc57('0x66')][util[_0xfc57('0x5a')]('SIP/%s',_0xaccbc2[_0xfc57('0x20')])][_0xfc57('0x28')])&&(this['trunks'][util['format'](_0xfc57('0x67'),_0xaccbc2['name'])]['status']===_0xfc57('0x68')||this['trunks'][util[_0xfc57('0x5a')](_0xfc57('0x67'),_0xaccbc2[_0xfc57('0x20')])]['status']==='unmonitored');};Fax[_0xfc57('0x24')]['checkTrunk']=function(_0x320d05,_0x536dc){if(!this[_0xfc57('0x63')](_0x320d05)){ut[_0xfc57('0x3f')](_0xfc57('0x69'),_[_0xfc57('0x64')](_0x320d05)?'':_0x320d05[_0xfc57('0x20')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xfc57('0x64')](_0x536dc[_0xfc57('0x7')])){ut['logger'](_0xfc57('0x6a'),JSON['stringify'](_0x536dc));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xfc57('0x64')](_0x536dc[_0xfc57('0x4')])){ut[_0xfc57('0x3f')](_0xfc57('0x6b'),JSON[_0xfc57('0x34')](_0x536dc));return{'isValid':![],'message':_0xfc57('0x6c')};}return{'isValid':!![],'message':_0xfc57('0x6d')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index e9268df..00d6c7c 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 _0x56a6=['then','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve'];(function(_0xaaaa71,_0x4fb0ce){var _0x57024c=function(_0x3b57d9){while(--_0x3b57d9){_0xaaaa71['push'](_0xaaaa71['shift']());}};_0x57024c(++_0x4fb0ce);}(_0x56a6,0xba));var _0x656a=function(_0x1ed52b,_0x3faff7){_0x1ed52b=_0x1ed52b-0x0;var _0x1c185a=_0x56a6[_0x1ed52b];return _0x1c185a;};'use strict';var util=require(_0x656a('0x0'));var BPromise=require(_0x656a('0x1'));var logger=require(_0x656a('0x2'))(_0x656a('0x3'));var _=require(_0x656a('0x4'));var faxAccount=require(_0x656a('0x5'));function loggerCatch(_0xcbfb77){return function(_0x5f1864){logger[_0x656a('0x6')](_0xcbfb77,util[_0x656a('0x7')](_0x5f1864,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x12f8a6,_0x9d7c05){return BPromise[_0x656a('0x8')]()[_0x656a('0x9')](faxAccount[_0x656a('0xa')](_0x12f8a6,_0x9d7c05))[_0x656a('0xb')](loggerCatch(_0x656a('0xc')));}; \ No newline at end of file +var _0x4dc5=['util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','then','notify','catch','[Notify]\x20'];(function(_0x4dc65d,_0x19aa67){var _0x130365=function(_0x48e537){while(--_0x48e537){_0x4dc65d['push'](_0x4dc65d['shift']());}};_0x130365(++_0x19aa67);}(_0x4dc5,0xc6));var _0x54dc=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x4dc5[_0x1beef3];return _0x5af964;};'use strict';var util=require(_0x54dc('0x0'));var BPromise=require(_0x54dc('0x1'));var logger=require(_0x54dc('0x2'))(_0x54dc('0x3'));var _=require('lodash');var faxAccount=require(_0x54dc('0x4'));function loggerCatch(_0x4e8319){return function(_0xa63438){logger[_0x54dc('0x5')](_0x4e8319,util[_0x54dc('0x6')](_0xa63438,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0xf5f493,_0x33d922){return BPromise['resolve']()[_0x54dc('0x7')](faxAccount[_0x54dc('0x8')](_0xf5f493,_0x33d922))[_0x54dc('0x9')](loggerCatch(_0x54dc('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 3e82d20..185ccdf 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 _0x06a7=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger'];(function(_0x35ccde,_0xbe027){var _0xbd6110=function(_0xba7aea){while(--_0xba7aea){_0x35ccde['push'](_0x35ccde['shift']());}};_0xbd6110(++_0xbe027);}(_0x06a7,0x117));var _0x706a=function(_0x4b992a,_0x51dd3e){_0x4b992a=_0x4b992a-0x0;var _0x39f09a=_0x06a7[_0x4b992a];return _0x39f09a;};'use strict';var util=require('util');var logger=require(_0x706a('0x0'))(_0x706a('0x1'));var BPromise=require(_0x706a('0x2'));var exec=require(_0x706a('0x3'))[_0x706a('0x4')];exports[_0x706a('0x5')]=function(_0x3f9c53){return new BPromise(function(_0x5baa79,_0x5d93e1){exec(_0x3f9c53,function(_0x356f4d,_0x198a65,_0x36fbd1){logger[_0x706a('0x6')](_0x706a('0x7'),_0x198a65);if(_0x356f4d){logger[_0x706a('0x6')](_0x706a('0x7'),_0x706a('0x8'),util[_0x706a('0x9')](_0x356f4d,{'showHidden':![],'depth':null}),_0x198a65,_0x36fbd1);_0x5d93e1(_0x356f4d);}_0x5baa79(_0x198a65);});});}; \ No newline at end of file +var _0x3a99=['inspect','fax','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x239c7f,_0x342874){var _0x2339e9=function(_0x5d4e2f){while(--_0x5d4e2f){_0x239c7f['push'](_0x239c7f['shift']());}};_0x2339e9(++_0x342874);}(_0x3a99,0xf1));var _0x93a9=function(_0x1cee4e,_0x4eda85){_0x1cee4e=_0x1cee4e-0x0;var _0x246bf2=_0x3a99[_0x1cee4e];return _0x246bf2;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x93a9('0x0'));var BPromise=require(_0x93a9('0x1'));var exec=require(_0x93a9('0x2'))[_0x93a9('0x3')];exports['execute']=function(_0x53a8e5){return new BPromise(function(_0x9ae9d3,_0x52dfd7){exec(_0x53a8e5,function(_0x558028,_0x23b10d,_0x18b495){logger[_0x93a9('0x4')]('Exec\x20gs',_0x23b10d);if(_0x558028){logger[_0x93a9('0x4')](_0x93a9('0x5'),_0x93a9('0x6'),util[_0x93a9('0x7')](_0x558028,{'showHidden':![],'depth':null}),_0x23b10d,_0x18b495);_0x52dfd7(_0x558028);}_0x9ae9d3(_0x23b10d);});});}; \ 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 b803800..3130dc1 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 _0x99e9=['modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','logger','info','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x21e6f1,_0x4d5eb5){var _0x44a394=function(_0x2d0e0e){while(--_0x2d0e0e){_0x21e6f1['push'](_0x21e6f1['shift']());}};_0x44a394(++_0x4d5eb5);}(_0x99e9,0xb4));var _0x999e=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x99e9[_0x234ce7];return _0x57c561;};'use strict';var util=require('util');var _=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var logger=require(_0x999e('0x2'))(_0x999e('0x3'));exports['message']=function(_0x19a818){return{'message':_0x19a818};};exports[_0x999e('0x4')]=function(_0x3aac27,_0x4e2112){logger[_0x999e('0x5')](_0x3aac27,util['inspect'](_0x4e2112,{'showHidden':![],'depth':null}));};exports[_0x999e('0x6')]=function(_0x1bda0a,_0x100330){var _0x18f337={'XMF-ECM':_0x100330['ecm'],'XMF-HEADERINFO':_0x100330[_0x999e('0x7')],'XMF-MINRATE':_0x100330[_0x999e('0x8')],'XMF-MAXRATE':_0x100330[_0x999e('0x9')],'XMF-MODEM':util[_0x999e('0xa')](_0x999e('0xb'),_0x100330[_0x999e('0xc')]),'XMF-GATEWAY':_0x100330[_0x999e('0xd')],'XMF-FAXDETECT':_0x100330[_0x999e('0xe')],'XMF-T38TIMEOUT':_0x100330[_0x999e('0xf')],'XMF-LOCALSTATIONID':_0x100330[_0x999e('0x10')],'XMF-PATH':_0x1bda0a[_0x999e('0x11')]};return _0x18f337;};exports[_0x999e('0x12')]=function(_0x4246b1,_0x188d02){return{'actionid':_0x4246b1[_0x999e('0x13')],'action':_0x999e('0x14'),'channel':_0x4246b1[_0x999e('0x15')],'Exten':'xcally-motion-fax','Context':_0x999e('0x16'),'Priority':'1','callerid':util['format'](_0x999e('0x17'),_0x4246b1[_0x999e('0x7')]?_0x4246b1[_0x999e('0x7')]:'',_0x4246b1['localstationid']),'variable':_0x188d02,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4246b1[_0x999e('0x13')]};}; \ No newline at end of file +var _0xb903=['minrate','maxrate','localstationid','path','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','message','logger','info','inspect','ecm','headerinfo'];(function(_0x130c67,_0x5dcc79){var _0x4e06c7=function(_0x122ea9){while(--_0x122ea9){_0x130c67['push'](_0x130c67['shift']());}};_0x4e06c7(++_0x5dcc79);}(_0xb903,0x185));var _0x3b90=function(_0x50806a,_0x54084f){_0x50806a=_0x50806a-0x0;var _0x304437=_0xb903[_0x50806a];return _0x304437;};'use strict';var util=require(_0x3b90('0x0'));var _=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var logger=require(_0x3b90('0x3'))('fax');exports[_0x3b90('0x4')]=function(_0xf414f4){return{'message':_0xf414f4};};exports[_0x3b90('0x5')]=function(_0x1cd5d8,_0x30d8db){logger[_0x3b90('0x6')](_0x1cd5d8,util[_0x3b90('0x7')](_0x30d8db,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x15b68f,_0x5e845a){var _0x55792c={'XMF-ECM':_0x5e845a[_0x3b90('0x8')],'XMF-HEADERINFO':_0x5e845a[_0x3b90('0x9')],'XMF-MINRATE':_0x5e845a[_0x3b90('0xa')],'XMF-MAXRATE':_0x5e845a[_0x3b90('0xb')],'XMF-MODEM':util['format']('\x22%s\x22',_0x5e845a['modem']),'XMF-GATEWAY':_0x5e845a['gateway'],'XMF-FAXDETECT':_0x5e845a['faxdetect'],'XMF-T38TIMEOUT':_0x5e845a['t38timeout'],'XMF-LOCALSTATIONID':_0x5e845a[_0x3b90('0xc')],'XMF-PATH':_0x15b68f[_0x3b90('0xd')]};return _0x55792c;};exports['variablesAction']=function(_0x30c49c,_0x233509){return{'actionid':_0x30c49c['uniqueid'],'action':_0x3b90('0xe'),'channel':_0x30c49c[_0x3b90('0xf')],'Exten':_0x3b90('0x10'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x3b90('0x11'),_0x30c49c['headerinfo']?_0x30c49c['headerinfo']:'',_0x30c49c[_0x3b90('0xc')]),'variable':_0x233509,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x30c49c[_0x3b90('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 5706737..f2d7bdf 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 _0x9354=['getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','sync','catch','util','moment','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts'];(function(_0x304e2a,_0x4d7190){var _0x2a1848=function(_0x1b708d){while(--_0x1b708d){_0x304e2a['push'](_0x304e2a['shift']());}};_0x2a1848(++_0x4d7190);}(_0x9354,0x96));var _0x4935=function(_0x207140,_0x4c6556){_0x207140=_0x207140-0x0;var _0x39e8cf=_0x9354[_0x207140];return _0x39e8cf;};'use strict';var BPromise=require('bluebird');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var server=require('./server');var Realtime=require(_0x4935('0x2'));var Report=require(_0x4935('0x3'));var Acw=require(_0x4935('0x4'));var Trigger=require(_0x4935('0x5'));var Dialer=require('./dialer');var Preview=require(_0x4935('0x6'));var Fax=require(_0x4935('0x7'));var user=require(_0x4935('0x8'));var voiceQueue=require(_0x4935('0x9'));var voiceQueueReport=require(_0x4935('0xa'));var voiceCallReport=require(_0x4935('0xb'));var trunk=require(_0x4935('0xc'));var trigger=require(_0x4935('0xd'));var template=require(_0x4935('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x4935('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x4935('0x10'));var zendesk=require(_0x4935('0x11'));var salesforce=require(_0x4935('0x12'));var sugarcrm=require(_0x4935('0x13'));var freshdesk=require(_0x4935('0x14'));var desk=require(_0x4935('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x4935('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4935('0x17')](_0x4935('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4935('0x17')](_0x4935('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4935('0x19')]()[_0x4935('0x1a')](user[_0x4935('0x1b')]())[_0x4935('0x1a')](realtime[_0x4935('0x1c')]())[_0x4935('0x1a')](user[_0x4935('0x1d')]())[_0x4935('0x1a')](realtime[_0x4935('0x1e')]())[_0x4935('0x1a')](trunk[_0x4935('0x1f')]())[_0x4935('0x1a')](realtime['initTrunks']())[_0x4935('0x1a')](voiceQueue[_0x4935('0x20')]())[_0x4935('0x1a')](realtime[_0x4935('0x21')]())[_0x4935('0x1a')](trigger[_0x4935('0x22')]())['then'](realtime[_0x4935('0x23')]())[_0x4935('0x1a')](template['getTemplates']())[_0x4935('0x1a')](realtime[_0x4935('0x24')]())[_0x4935('0x1a')](zendesk['getZendeskAccounts']())['then'](realtime[_0x4935('0x25')]())[_0x4935('0x1a')](salesforce[_0x4935('0x26')]())[_0x4935('0x1a')](realtime[_0x4935('0x27')]())[_0x4935('0x1a')](sugarcrm[_0x4935('0x28')]())[_0x4935('0x1a')](realtime['initSugarcrmAccounts']())[_0x4935('0x1a')](freshdesk[_0x4935('0x29')]())[_0x4935('0x1a')](realtime[_0x4935('0x2a')]())[_0x4935('0x1a')](desk['getDeskAccounts']())['then'](realtime[_0x4935('0x2b')]())[_0x4935('0x1a')](zoho[_0x4935('0x2c')]())[_0x4935('0x1a')](realtime[_0x4935('0x2d')]())[_0x4935('0x1a')](vtiger[_0x4935('0x2e')]())[_0x4935('0x1a')](realtime[_0x4935('0x2f')]())[_0x4935('0x1a')](freshsales[_0x4935('0x30')]())[_0x4935('0x1a')](realtime[_0x4935('0x31')]())[_0x4935('0x1a')](servicenow[_0x4935('0x32')]())['then'](realtime['initServicenowAccounts']())['then'](dynamics365[_0x4935('0x33')]())[_0x4935('0x1a')](realtime['initDynamics365Accounts']())[_0x4935('0x1a')](campaign[_0x4935('0x34')]())[_0x4935('0x1a')](realtime[_0x4935('0x35')]())[_0x4935('0x1a')](voiceExtension[_0x4935('0x36')]())[_0x4935('0x1a')](realtime[_0x4935('0x37')]())['then'](faxAccount[_0x4935('0x38')]())[_0x4935('0x1a')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x4935('0x19')]()['then'](voiceQueueReport[_0x4935('0x39')]())[_0x4935('0x1a')](realtime[_0x4935('0x3a')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x4935('0x1a')](realtime[_0x4935('0x3b')]())['then'](cmHopperHistory[_0x4935('0x3c')]())[_0x4935('0x1a')](realtime[_0x4935('0x3d')]())[_0x4935('0x1a')](voiceCallReport[_0x4935('0x3e')]())['then'](realtime['initVoiceCallReports']())[_0x4935('0x1a')](function(_0x1016cc){})['catch'](function(_0x4945a7){console[_0x4935('0x3f')](_0x4945a7);});}function main(){return server['listen'](realtime,preview,fax)[_0x4935('0x1a')](function(_0x3f32fb){return initRealtime();})[_0x4935('0x1a')](function(){return initParams();})[_0x4935('0x1a')](function(){report[_0x4935('0x40')]();setInterval(initRealtime,0x1388);})[_0x4935('0x41')](function(_0x4d1d1c){console[_0x4935('0x3f')](_0x4d1d1c);});}main(); \ No newline at end of file +var _0xb688=['initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getTelephones','initTelephones','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory'];(function(_0x130957,_0x41b097){var _0x5078b7=function(_0x86b30c){while(--_0x86b30c){_0x130957['push'](_0x130957['shift']());}};_0x5078b7(++_0x41b097);}(_0xb688,0xcf));var _0x8b68=function(_0x242e53,_0x5bf52f){_0x242e53=_0x242e53-0x0;var _0x380aa6=_0xb688[_0x242e53];return _0x380aa6;};'use strict';var BPromise=require('bluebird');var util=require(_0x8b68('0x0'));var moment=require(_0x8b68('0x1'));var server=require(_0x8b68('0x2'));var Realtime=require(_0x8b68('0x3'));var Report=require(_0x8b68('0x4'));var Acw=require(_0x8b68('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x8b68('0x6'));var Preview=require(_0x8b68('0x7'));var Fax=require(_0x8b68('0x8'));var user=require(_0x8b68('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x8b68('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x8b68('0xb'));var trigger=require(_0x8b68('0xc'));var template=require(_0x8b68('0xd'));var cmHopperHistory=require(_0x8b68('0xe'));var campaign=require(_0x8b68('0xf'));var voiceExtension=require(_0x8b68('0x10'));var faxAccount=require(_0x8b68('0x11'));var zendesk=require(_0x8b68('0x12'));var salesforce=require(_0x8b68('0x13'));var sugarcrm=require(_0x8b68('0x14'));var freshdesk=require(_0x8b68('0x15'));var desk=require(_0x8b68('0x16'));var zoho=require(_0x8b68('0x17'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x8b68('0x18'));var servicenow=require(_0x8b68('0x19'));var dynamics365=require(_0x8b68('0x1a'));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()[_0x8b68('0x1b')](_0x8b68('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8b68('0x1b')](_0x8b68('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8b68('0x1d')]()[_0x8b68('0x1e')](user['getAgents']())[_0x8b68('0x1e')](realtime['initAgents']())['then'](user[_0x8b68('0x1f')]())[_0x8b68('0x1e')](realtime[_0x8b68('0x20')]())['then'](trunk['getTrunks']())[_0x8b68('0x1e')](realtime['initTrunks']())[_0x8b68('0x1e')](voiceQueue[_0x8b68('0x21')]())[_0x8b68('0x1e')](realtime[_0x8b68('0x22')]())['then'](trigger[_0x8b68('0x23')]())[_0x8b68('0x1e')](realtime['initTriggers']())[_0x8b68('0x1e')](template[_0x8b68('0x24')]())[_0x8b68('0x1e')](realtime[_0x8b68('0x25')]())[_0x8b68('0x1e')](zendesk['getZendeskAccounts']())[_0x8b68('0x1e')](realtime[_0x8b68('0x26')]())[_0x8b68('0x1e')](salesforce[_0x8b68('0x27')]())[_0x8b68('0x1e')](realtime[_0x8b68('0x28')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x8b68('0x1e')](realtime['initSugarcrmAccounts']())[_0x8b68('0x1e')](freshdesk[_0x8b68('0x29')]())[_0x8b68('0x1e')](realtime[_0x8b68('0x2a')]())[_0x8b68('0x1e')](desk[_0x8b68('0x2b')]())['then'](realtime[_0x8b68('0x2c')]())[_0x8b68('0x1e')](zoho['getZohoAccounts']())[_0x8b68('0x1e')](realtime[_0x8b68('0x2d')]())[_0x8b68('0x1e')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0x8b68('0x1e')](freshsales[_0x8b68('0x2e')]())[_0x8b68('0x1e')](realtime['initFreshsalesAccounts']())[_0x8b68('0x1e')](servicenow['getServicenowAccounts']())['then'](realtime[_0x8b68('0x2f')]())['then'](dynamics365[_0x8b68('0x30')]())[_0x8b68('0x1e')](realtime['initDynamics365Accounts']())['then'](campaign[_0x8b68('0x31')]())[_0x8b68('0x1e')](realtime[_0x8b68('0x32')]())[_0x8b68('0x1e')](voiceExtension[_0x8b68('0x33')]())[_0x8b68('0x1e')](realtime[_0x8b68('0x34')]())['then'](faxAccount[_0x8b68('0x35')]())['then'](realtime[_0x8b68('0x36')]())[_0x8b68('0x1e')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x8b68('0x1e')](voiceQueueReport[_0x8b68('0x37')]())[_0x8b68('0x1e')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x8b68('0x38')]())[_0x8b68('0x1e')](realtime[_0x8b68('0x39')]())[_0x8b68('0x1e')](cmHopperHistory[_0x8b68('0x3a')]())[_0x8b68('0x1e')](realtime[_0x8b68('0x3b')]())[_0x8b68('0x1e')](voiceCallReport[_0x8b68('0x3c')]())[_0x8b68('0x1e')](realtime[_0x8b68('0x3d')]())[_0x8b68('0x1e')](function(_0x232fa9){})[_0x8b68('0x3e')](function(_0x10aca9){console[_0x8b68('0x3f')](_0x10aca9);});}function main(){return server[_0x8b68('0x40')](realtime,preview,fax)[_0x8b68('0x1e')](function(_0x120b34){return initRealtime();})[_0x8b68('0x1e')](function(){return initParams();})[_0x8b68('0x1e')](function(){report[_0x8b68('0x41')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x5c158b){console[_0x8b68('0x3f')](_0x5c158b);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index c836627..38ab5c1 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 _0x4434=['format','stringify','user:%s','user:save','emit','exports','util','moment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','voiceStatusTime','toNumber'];(function(_0x257bb2,_0x317166){var _0x39a89f=function(_0x3d1308){while(--_0x3d1308){_0x257bb2['push'](_0x257bb2['shift']());}};_0x39a89f(++_0x317166);}(_0x4434,0x1c2));var _0x4443=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4434[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x4443('0x0'));var moment=require(_0x4443('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x4443('0x2')]=_[_0x4443('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4443('0x4'))(new Redis(config['redis']));function Agent(_0x3702cd){this['id']=_0x3702cd['id']||0x0;this[_0x4443('0x5')]=_0x3702cd[_0x4443('0x5')]||'';this[_0x4443('0x6')]=_0x3702cd[_0x4443('0x6')]||'';this[_0x4443('0x7')]=_0x3702cd['accountcode']||'';this['fullname']=_0x3702cd[_0x4443('0x8')]||'';this[_0x4443('0x9')]=_0x4443('0xa');this[_0x4443('0xb')]=0x0;this[_0x4443('0xc')]=_0x4443('0xa');this[_0x4443('0xd')]='';this[_0x4443('0xe')]='';this[_0x4443('0xf')]='';this[_0x4443('0x10')]='';this[_0x4443('0x11')]=_0x3702cd[_0x4443('0x11')]||![];this[_0x4443('0x12')]=_0x4443('0xa');this['voiceStatusTime']=0x0;this[_0x4443('0x13')]='';this[_0x4443('0x14')]='';this[_0x4443('0x15')]=![];this[_0x4443('0x16')]=![];this[_0x4443('0x17')]='';}Agent['prototype'][_0x4443('0x18')]=function(_0x5e6452){var _0x4acb91;if(_0x5e6452&&_0x5e6452[_0x4443('0x9')]){_0x4acb91=_0x5e6452[_0x4443('0x9')][_0x4443('0x19')]();switch(_0x4acb91){case _0x4443('0x1a'):_0x4acb91=_0x4443('0x1b');break;case'inuse':_0x4acb91=_0x4443('0x1c');break;}}if(_0x4acb91&&this[_0x4443('0x12')]!==_0x4acb91||_0x5e6452['statePause']){this[_0x4443('0x1d')]=_[_0x4443('0x1e')](moment()[_0x4443('0x1f')]('x'));}if(_0x4acb91){this[_0x4443('0x12')]=_0x4acb91;}var _0x25fb51={'id':this['id'],'name':this[_0x4443('0x5')],'email':this[_0x4443('0x6')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x4443('0x9')],'stateTime':this[_0x4443('0xb')],'status':this[_0x4443('0xc')],'address':this['address'],'online':this[_0x4443('0x11')],'voiceStatus':this[_0x4443('0x12')],'voiceStatusTime':this[_0x4443('0x1d')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x4443('0x14')],'interface':this[_0x4443('0x10')],'onhold':this[_0x4443('0x15')]};var _0x7a69d=md5(JSON[_0x4443('0x20')](_0x25fb51));if(this[_0x4443('0x17')]!==_0x7a69d){this[_0x4443('0x17')]=_0x7a69d;io['to'](util['format'](_0x4443('0x21'),_0x25fb51['name']))['emit'](_0x4443('0x22'),_0x25fb51);io[_0x4443('0x23')]('user:presence',_0x25fb51);}};module[_0x4443('0x24')]=Agent; \ No newline at end of file +var _0x305c=['user:presence','exports','moment','md5','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','voiceStatusCallerIdNumber','onhold','stringify','user:%s','user:save','emit'];(function(_0x3e27d6,_0x3858d5){var _0x1576f1=function(_0xf54bb1){while(--_0xf54bb1){_0x3e27d6['push'](_0x3e27d6['shift']());}};_0x1576f1(++_0x3858d5);}(_0x305c,0x1c5));var _0xc305=function(_0x538b31,_0x80e294){_0x538b31=_0x538b31-0x0;var _0x4348f0=_0x305c[_0x538b31];return _0x4348f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc305('0x0'));var md5=require(_0xc305('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xc305('0x2')](config[_0xc305('0x3')],{'host':_0xc305('0x4'),'port':0x18eb});var io=require(_0xc305('0x5'))(new Redis(config['redis']));function Agent(_0x1c932f){this['id']=_0x1c932f['id']||0x0;this[_0xc305('0x6')]=_0x1c932f[_0xc305('0x6')]||'';this[_0xc305('0x7')]=_0x1c932f[_0xc305('0x7')]||'';this[_0xc305('0x8')]=_0x1c932f[_0xc305('0x8')]||'';this[_0xc305('0x9')]=_0x1c932f['fullname']||'';this['state']=_0xc305('0xa');this[_0xc305('0xb')]=0x0;this[_0xc305('0xc')]='unknown';this[_0xc305('0xd')]='';this[_0xc305('0xe')]='';this[_0xc305('0xf')]='';this[_0xc305('0x10')]='';this[_0xc305('0x11')]=_0x1c932f['online']||![];this[_0xc305('0x12')]=_0xc305('0xa');this[_0xc305('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xc305('0x14')]='';this['onhold']=![];this[_0xc305('0x15')]=![];this[_0xc305('0x1')]='';}Agent[_0xc305('0x16')][_0xc305('0x17')]=function(_0x1da829){var _0x295fb8;if(_0x1da829&&_0x1da829['state']){_0x295fb8=_0x1da829[_0xc305('0x18')][_0xc305('0x19')]();switch(_0x295fb8){case _0xc305('0x1a'):_0x295fb8=_0xc305('0x1b');break;case _0xc305('0x1c'):_0x295fb8=_0xc305('0x1d');break;}}if(_0x295fb8&&this['voiceStatus']!==_0x295fb8||_0x1da829[_0xc305('0x1e')]){this[_0xc305('0x13')]=_[_0xc305('0x1f')](moment()[_0xc305('0x20')]('x'));}if(_0x295fb8){this[_0xc305('0x12')]=_0x295fb8;}var _0x18d417={'id':this['id'],'name':this[_0xc305('0x6')],'email':this[_0xc305('0x7')],'accountcode':this[_0xc305('0x8')],'fullname':this[_0xc305('0x9')],'state':this[_0xc305('0x18')],'stateTime':this['stateTime'],'status':this[_0xc305('0xc')],'address':this['address'],'online':this[_0xc305('0x11')],'voiceStatus':this[_0xc305('0x12')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xc305('0x21')],'voiceStatusQueue':this[_0xc305('0x14')],'interface':this['interface'],'onhold':this[_0xc305('0x22')]};var _0xff33cf=md5(JSON[_0xc305('0x23')](_0x18d417));if(this[_0xc305('0x1')]!==_0xff33cf){this['md5']=_0xff33cf;io['to'](util[_0xc305('0x20')](_0xc305('0x24'),_0x18d417['name']))['emit'](_0xc305('0x25'),_0x18d417);io[_0xc305('0x26')](_0xc305('0x27'),_0x18d417);}};module[_0xc305('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index ba0e0fa..3066d54 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 _0x0c4c=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x3f366a,_0x29d630){var _0x2faa28=function(_0x4920a1){while(--_0x4920a1){_0x3f366a['push'](_0x3f366a['shift']());}};_0x2faa28(++_0x29d630);}(_0x0c4c,0x140));var _0xc0c4=function(_0x141307,_0x7694e9){_0x141307=_0x141307-0x0;var _0x32b59e=_0x0c4c[_0x141307];return _0x32b59e;};'use strict';function Campaign(_0x53fd4e){this['id']=_0x53fd4e['id']||0x0;this[_0xc0c4('0x0')]=_0x53fd4e[_0xc0c4('0x0')]||'';this[_0xc0c4('0x1')]=_0x53fd4e[_0xc0c4('0x1')]||_0xc0c4('0x2');this[_0xc0c4('0x3')]=0x0;this[_0xc0c4('0x4')]=0x0;this[_0xc0c4('0x5')]=0x0;this[_0xc0c4('0x6')]=0x0;this[_0xc0c4('0x7')]='';this[_0xc0c4('0x8')]=!![];this['active']=_0x53fd4e['active'];this[_0xc0c4('0x9')]=_0x53fd4e[_0xc0c4('0x9')];this[_0xc0c4('0xa')]=_0x53fd4e[_0xc0c4('0xa')]||null;this[_0xc0c4('0xb')]=_0x53fd4e[_0xc0c4('0xb')]?_0x53fd4e[_0xc0c4('0xb')]:null;this['dialOriginateCallerIdName']=_0x53fd4e[_0xc0c4('0xc')];this[_0xc0c4('0xd')]=_0x53fd4e['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x53fd4e['dialOriginateTimeout']||0x1e;this[_0xc0c4('0xe')]=_0x53fd4e[_0xc0c4('0xe')];this[_0xc0c4('0xf')]=_0x53fd4e[_0xc0c4('0xf')];this[_0xc0c4('0x10')]=_0x53fd4e[_0xc0c4('0x10')];this[_0xc0c4('0x11')]=_0x53fd4e[_0xc0c4('0x11')];this[_0xc0c4('0x12')]=_0x53fd4e[_0xc0c4('0x12')];this['dialNoAnswerRetryFrequency']=_0x53fd4e[_0xc0c4('0x13')];this[_0xc0c4('0x14')]=_0x53fd4e['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x53fd4e[_0xc0c4('0x15')]||0x3;this[_0xc0c4('0x16')]=_0x53fd4e[_0xc0c4('0x16')]||0x96;this[_0xc0c4('0x17')]=_0x53fd4e[_0xc0c4('0x17')]||0x3;this[_0xc0c4('0x18')]=_0x53fd4e['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x53fd4e[_0xc0c4('0x19')]||0x3;this[_0xc0c4('0x1a')]=_0x53fd4e[_0xc0c4('0x1a')]||0x96;this[_0xc0c4('0x1b')]=_0x53fd4e[_0xc0c4('0x1b')]||0x3;this[_0xc0c4('0x1c')]=_0x53fd4e[_0xc0c4('0x1c')]||0x96;this[_0xc0c4('0x1d')]=_0x53fd4e[_0xc0c4('0x1d')]||0x3;this[_0xc0c4('0x1e')]=_0x53fd4e[_0xc0c4('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x53fd4e[_0xc0c4('0x1f')]||_0xc0c4('0x20');this[_0xc0c4('0x21')]=_0x53fd4e[_0xc0c4('0x21')]||undefined;this[_0xc0c4('0x22')]=_0x53fd4e[_0xc0c4('0x22')]||undefined;this[_0xc0c4('0x23')]=_0x53fd4e[_0xc0c4('0x23')]||undefined;this['TrunkBackup']=_0x53fd4e[_0xc0c4('0x24')]?_0x53fd4e[_0xc0c4('0x24')]:undefined;this['Trunk']=_0x53fd4e['Trunk']?_0x53fd4e[_0xc0c4('0x25')]:undefined;this[_0xc0c4('0x26')]=_0x53fd4e[_0xc0c4('0x26')]?_0x53fd4e[_0xc0c4('0x26')]:undefined;this[_0xc0c4('0x27')]=_0x53fd4e[_0xc0c4('0x27')]?_0x53fd4e['SquareProject']:undefined;this[_0xc0c4('0x28')]=_0x53fd4e[_0xc0c4('0x27')]?_0x53fd4e['SquareProject']['name']:undefined;this[_0xc0c4('0x29')]=_0x53fd4e['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x53fd4e[_0xc0c4('0x2a')];this['dialAMDGreeting']=_0x53fd4e[_0xc0c4('0x2b')];this[_0xc0c4('0x2c')]=_0x53fd4e[_0xc0c4('0x2c')];this[_0xc0c4('0x2d')]=_0x53fd4e['dialAMDTotalAnalysisTime'];this[_0xc0c4('0x2e')]=_0x53fd4e['dialAMDMinWordLength'];this[_0xc0c4('0x2f')]=_0x53fd4e[_0xc0c4('0x2f')];this[_0xc0c4('0x30')]=_0x53fd4e[_0xc0c4('0x30')];this[_0xc0c4('0x31')]=_0x53fd4e[_0xc0c4('0x31')];this[_0xc0c4('0x32')]=_0x53fd4e[_0xc0c4('0x32')];}module[_0xc0c4('0x33')]=Campaign; \ No newline at end of file +var _0xdf0a=['dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrTotalCallsDays','message','active','limitCalls'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xdf0a,0x1a9));var _0xadf0=function(_0x208cbf,_0x4ba25a){_0x208cbf=_0x208cbf-0x0;var _0x286a09=_0xdf0a[_0x208cbf];return _0x286a09;};'use strict';function Campaign(_0x1409a1){this['id']=_0x1409a1['id']||0x0;this[_0xadf0('0x0')]=_0x1409a1[_0xadf0('0x0')]||'';this[_0xadf0('0x1')]=_0x1409a1[_0xadf0('0x1')]||'campaign';this[_0xadf0('0x2')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xadf0('0x3')]=0x0;this[_0xadf0('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0xadf0('0x5')]=_0x1409a1[_0xadf0('0x5')];this[_0xadf0('0x6')]=_0x1409a1[_0xadf0('0x6')];this[_0xadf0('0x7')]=_0x1409a1[_0xadf0('0x7')]||null;this[_0xadf0('0x8')]=_0x1409a1[_0xadf0('0x8')]?_0x1409a1['dialGlobalInterval']:null;this[_0xadf0('0x9')]=_0x1409a1[_0xadf0('0x9')];this[_0xadf0('0xa')]=_0x1409a1[_0xadf0('0xa')];this['dialOriginateTimeout']=_0x1409a1[_0xadf0('0xb')]||0x1e;this[_0xadf0('0xc')]=_0x1409a1[_0xadf0('0xc')];this[_0xadf0('0xd')]=_0x1409a1[_0xadf0('0xd')];this['dialBusyMaxRetry']=_0x1409a1[_0xadf0('0xe')];this[_0xadf0('0xf')]=_0x1409a1[_0xadf0('0xf')];this[_0xadf0('0x10')]=_0x1409a1[_0xadf0('0x10')];this[_0xadf0('0x11')]=_0x1409a1[_0xadf0('0x11')];this['dialGlobalMaxRetry']=_0x1409a1[_0xadf0('0x12')];this[_0xadf0('0x13')]=_0x1409a1[_0xadf0('0x13')]||0x3;this[_0xadf0('0x14')]=_0x1409a1[_0xadf0('0x14')]||0x96;this[_0xadf0('0x15')]=_0x1409a1[_0xadf0('0x15')]||0x3;this[_0xadf0('0x16')]=_0x1409a1[_0xadf0('0x16')]||0x96;this[_0xadf0('0x17')]=_0x1409a1['dialAbandonedMaxRetry']||0x3;this[_0xadf0('0x18')]=_0x1409a1[_0xadf0('0x18')]||0x96;this[_0xadf0('0x19')]=_0x1409a1['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x1409a1[_0xadf0('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x1409a1['dialAgentRejectMaxRetry']||0x3;this[_0xadf0('0x1b')]=_0x1409a1[_0xadf0('0x1b')]||0x96;this[_0xadf0('0x1c')]=_0x1409a1[_0xadf0('0x1c')]||_0xadf0('0x1d');this[_0xadf0('0x1e')]=_0x1409a1[_0xadf0('0x1e')]||undefined;this[_0xadf0('0x1f')]=_0x1409a1[_0xadf0('0x1f')]||undefined;this[_0xadf0('0x20')]=_0x1409a1[_0xadf0('0x20')]||undefined;this[_0xadf0('0x21')]=_0x1409a1[_0xadf0('0x21')]?_0x1409a1[_0xadf0('0x21')]:undefined;this[_0xadf0('0x22')]=_0x1409a1[_0xadf0('0x22')]?_0x1409a1[_0xadf0('0x22')]:undefined;this[_0xadf0('0x23')]=_0x1409a1[_0xadf0('0x23')]?_0x1409a1[_0xadf0('0x23')]:undefined;this[_0xadf0('0x24')]=_0x1409a1[_0xadf0('0x24')]?_0x1409a1['SquareProject']:undefined;this['dialQueueProject']=_0x1409a1[_0xadf0('0x24')]?_0x1409a1[_0xadf0('0x24')]['name']:undefined;this[_0xadf0('0x25')]=_0x1409a1['dialAMDActive']||![];this[_0xadf0('0x26')]=_0x1409a1[_0xadf0('0x26')];this['dialAMDGreeting']=_0x1409a1[_0xadf0('0x27')];this[_0xadf0('0x28')]=_0x1409a1[_0xadf0('0x28')];this['dialAMDTotalAnalysisTime']=_0x1409a1[_0xadf0('0x29')];this['dialAMDMinWordLength']=_0x1409a1[_0xadf0('0x2a')];this[_0xadf0('0x2b')]=_0x1409a1[_0xadf0('0x2b')];this[_0xadf0('0x2c')]=_0x1409a1[_0xadf0('0x2c')];this[_0xadf0('0x2d')]=_0x1409a1[_0xadf0('0x2d')];this[_0xadf0('0x2e')]=_0x1409a1[_0xadf0('0x2e')];}module[_0xadf0('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index cc955fa..017be0a 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 _0x70c2=['mohtime','exports','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','endtime','unmanaged','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x5dcf0a,_0x458319){var _0x3c1ffb=function(_0x484130){while(--_0x484130){_0x5dcf0a['push'](_0x5dcf0a['shift']());}};_0x3c1ffb(++_0x458319);}(_0x70c2,0xb8));var _0x270c=function(_0x29775b,_0xccf010){_0x29775b=_0x29775b-0x0;var _0x395d5b=_0x70c2[_0x29775b];return _0x395d5b;};'use strict';function Channel(){this[_0x270c('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x270c('0x1')]=0x0;this[_0x270c('0x2')]='';this[_0x270c('0x3')]=undefined;this[_0x270c('0x4')]=undefined;this[_0x270c('0x5')]=0x0;this['context']='';this[_0x270c('0x6')]=0x0;this[_0x270c('0x7')]=0x0;this[_0x270c('0x8')]=0x0;this['answered']=![];this['answertime']=null;this[_0x270c('0x9')]=null;this[_0x270c('0xa')]=![];this['abandoned']=![];this[_0x270c('0xb')]='';this['lastdata']='';this[_0x270c('0xc')]=0x0;this[_0x270c('0xd')]=0x0;this[_0x270c('0xe')]=0x0;this[_0x270c('0xf')]=null;this[_0x270c('0x10')]=null;this[_0x270c('0x11')]=null;this[_0x270c('0x12')]=![];this['monitorFilename']=null;this[_0x270c('0x13')]=null;this[_0x270c('0x14')]=[];this[_0x270c('0x15')]=undefined;this[_0x270c('0x16')]=undefined;this[_0x270c('0x17')]=undefined;this[_0x270c('0x18')]=0x0;}module[_0x270c('0x19')]=Channel; \ No newline at end of file +var _0x4e60=['queue','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitorFilename'];(function(_0x446818,_0x1b7d6f){var _0x172c45=function(_0x164673){while(--_0x164673){_0x446818['push'](_0x446818['shift']());}};_0x172c45(++_0x1b7d6f);}(_0x4e60,0x1ea));var _0x04e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4e60[_0x14add3];return _0x4a174f;};'use strict';function Channel(){this[_0x04e6('0x0')]=null;this[_0x04e6('0x1')]='';this[_0x04e6('0x2')]='';this[_0x04e6('0x3')]=0x0;this[_0x04e6('0x4')]='';this['connectedlinenum']=undefined;this[_0x04e6('0x5')]=undefined;this[_0x04e6('0x6')]=0x0;this['context']='';this[_0x04e6('0x7')]=0x0;this[_0x04e6('0x8')]=0x0;this[_0x04e6('0x9')]=0x0;this[_0x04e6('0xa')]=![];this[_0x04e6('0xb')]=null;this[_0x04e6('0xc')]=null;this[_0x04e6('0xd')]=![];this[_0x04e6('0xe')]=![];this['lastapplication']='';this[_0x04e6('0xf')]='';this[_0x04e6('0x10')]=0x0;this[_0x04e6('0x11')]=0x0;this[_0x04e6('0x12')]=0x0;this[_0x04e6('0x13')]=null;this[_0x04e6('0x14')]=null;this[_0x04e6('0x15')]=null;this['monitor']=![];this[_0x04e6('0x16')]=null;this[_0x04e6('0x17')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x04e6('0x18')]=undefined;this['transferType']=undefined;this[_0x04e6('0x19')]=0x0;}module[_0x04e6('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index e7fd770..a72282d 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 _0x1ef3=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x236adc,_0x5da2d6){var _0x794970=function(_0xa73edc){while(--_0xa73edc){_0x236adc['push'](_0x236adc['shift']());}};_0x794970(++_0x5da2d6);}(_0x1ef3,0x69));var _0x31ef=function(_0x1d75ae,_0x3c0410){_0x1d75ae=_0x1d75ae-0x0;var _0x1589d7=_0x1ef3[_0x1d75ae];return _0x1589d7;};'use strict';function DeskAccount(_0x387042){this['id']=_0x387042['id']||0x0;this[_0x31ef('0x0')]=_0x387042['name']||'';this[_0x31ef('0x1')]=_0x387042[_0x31ef('0x1')]||'';this[_0x31ef('0x2')]=_0x387042['remoteUri']||'';this[_0x31ef('0x3')]=_0x387042[_0x31ef('0x3')]||'';this['password']=_0x387042[_0x31ef('0x4')]||'';this[_0x31ef('0x5')]=_0x387042[_0x31ef('0x5')]||'';this[_0x31ef('0x6')]=_0x387042[_0x31ef('0x6')]||'';this[_0x31ef('0x7')]=_0x387042['token']||'';this[_0x31ef('0x8')]=_0x387042[_0x31ef('0x8')]||'';this[_0x31ef('0x9')]=_0x387042[_0x31ef('0x9')]||'';this['serverUrl']=_0x387042[_0x31ef('0xa')]||'';this['Configurations']=_0x387042[_0x31ef('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x535f=['remoteUri','authType','password','consumerKey','consumerSecret','tokenSecret','type','serverUrl','exports','name','username'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x535f,0x111));var _0xf535=function(_0x2a9479,_0x394989){_0x2a9479=_0x2a9479-0x0;var _0x472b13=_0x535f[_0x2a9479];return _0x472b13;};'use strict';function DeskAccount(_0x3384ca){this['id']=_0x3384ca['id']||0x0;this[_0xf535('0x0')]=_0x3384ca[_0xf535('0x0')]||'';this['username']=_0x3384ca[_0xf535('0x1')]||'';this[_0xf535('0x2')]=_0x3384ca[_0xf535('0x2')]||'';this[_0xf535('0x3')]=_0x3384ca['authType']||'';this[_0xf535('0x4')]=_0x3384ca[_0xf535('0x4')]||'';this[_0xf535('0x5')]=_0x3384ca[_0xf535('0x5')]||'';this[_0xf535('0x6')]=_0x3384ca[_0xf535('0x6')]||'';this['token']=_0x3384ca['token']||'';this[_0xf535('0x7')]=_0x3384ca[_0xf535('0x7')]||'';this[_0xf535('0x8')]=_0x3384ca['type']||'';this[_0xf535('0x9')]=_0x3384ca[_0xf535('0x9')]||'';this['Configurations']=_0x3384ca['Configurations']||{};}module[_0xf535('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 90d24ab..a39cb76 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 _0x6735=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x22e7a7,_0x5b2650){var _0xe08f58=function(_0x3ff6d5){while(--_0x3ff6d5){_0x22e7a7['push'](_0x22e7a7['shift']());}};_0xe08f58(++_0x5b2650);}(_0x6735,0x125));var _0x5673=function(_0x2aa398,_0x3d0cd5){_0x2aa398=_0x2aa398-0x0;var _0x13b62d=_0x6735[_0x2aa398];return _0x13b62d;};'use strict';function Dynamics365Account(_0x2dd0ea){this['id']=_0x2dd0ea['id']||0x0;this['name']=_0x2dd0ea[_0x5673('0x0')]||'';this[_0x5673('0x1')]=_0x2dd0ea[_0x5673('0x1')]||'';this[_0x5673('0x2')]=_0x2dd0ea[_0x5673('0x2')]||'';this[_0x5673('0x3')]=_0x2dd0ea[_0x5673('0x3')]||'';this['tenantId']=_0x2dd0ea[_0x5673('0x4')]||'';this[_0x5673('0x5')]=_0x2dd0ea[_0x5673('0x5')]||'';this[_0x5673('0x6')]=_0x2dd0ea[_0x5673('0x6')]||{};this[_0x5673('0x7')]=_0x2dd0ea['serverUrl']||'';this['Configurations']=_0x2dd0ea[_0x5673('0x8')]||{};}module[_0x5673('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xe553=['serverUrl','Configurations','exports','name','username','password','remoteUri','clientSecret'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xe553,0xab));var _0x3e55=function(_0x547890,_0x593741){_0x547890=_0x547890-0x0;var _0x2c8daa=_0xe553[_0x547890];return _0x2c8daa;};'use strict';function Dynamics365Account(_0x3336c8){this['id']=_0x3336c8['id']||0x0;this[_0x3e55('0x0')]=_0x3336c8[_0x3e55('0x0')]||'';this['username']=_0x3336c8[_0x3e55('0x1')]||'';this[_0x3e55('0x2')]=_0x3336c8[_0x3e55('0x2')]||'';this['remoteUri']=_0x3336c8[_0x3e55('0x3')]||'';this['tenantId']=_0x3336c8['tenantId']||'';this['clientId']=_0x3336c8['clientId']||'';this[_0x3e55('0x4')]=_0x3336c8['clientSecret']||{};this[_0x3e55('0x5')]=_0x3336c8[_0x3e55('0x5')]||'';this[_0x3e55('0x6')]=_0x3336c8['Configurations']||{};}module[_0x3e55('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 7b29ff5..ac297f1 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 _0x7d2b=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x11bdfb,_0x5bca9a){var _0x4118ec=function(_0xa32ea7){while(--_0xa32ea7){_0x11bdfb['push'](_0x11bdfb['shift']());}};_0x4118ec(++_0x5bca9a);}(_0x7d2b,0x1aa));var _0xb7d2=function(_0x57aef5,_0x3c39b5){_0x57aef5=_0x57aef5-0x0;var _0x2afe84=_0x7d2b[_0x57aef5];return _0x2afe84;};'use strict';function FaxAccount(_0xc516c3){this['id']=_0xc516c3['id']||0x0;this[_0xb7d2('0x0')]=_0xc516c3[_0xb7d2('0x0')]||'';this[_0xb7d2('0x1')]=_0xc516c3['description'];this['ecm']=_0xc516c3[_0xb7d2('0x2')];this[_0xb7d2('0x3')]=_0xc516c3['headerinfo'];this[_0xb7d2('0x4')]=_0xc516c3[_0xb7d2('0x4')];this[_0xb7d2('0x5')]=_0xc516c3[_0xb7d2('0x5')]||0x960;this[_0xb7d2('0x6')]=_0xc516c3[_0xb7d2('0x6')]||0x3840;this['modem']=_0xc516c3[_0xb7d2('0x7')]||'v17,v27,v29';this[_0xb7d2('0x8')]=_0xc516c3['gateway']||'no';this[_0xb7d2('0x9')]=_0xc516c3[_0xb7d2('0x9')]||'no';this[_0xb7d2('0xa')]=_0xc516c3['t38timeout']||0x1388;this['tech']=_0xc516c3[_0xb7d2('0xb')]||_0xb7d2('0xc');this[_0xb7d2('0xd')]=_0xc516c3[_0xb7d2('0xd')]?_0xc516c3[_0xb7d2('0xd')]:undefined;this[_0xb7d2('0xe')]=_0xc516c3[_0xb7d2('0xe')];this[_0xb7d2('0xf')]=_0xc516c3[_0xb7d2('0xf')];}module[_0xb7d2('0x10')]=FaxAccount; \ No newline at end of file +var _0xa533=['ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0xa533,0x13e));var _0x3a53=function(_0x7f53f,_0x3aaa){_0x7f53f=_0x7f53f-0x0;var _0x17ec85=_0xa533[_0x7f53f];return _0x17ec85;};'use strict';function FaxAccount(_0x34171a){this['id']=_0x34171a['id']||0x0;this['name']=_0x34171a[_0x3a53('0x0')]||'';this[_0x3a53('0x1')]=_0x34171a[_0x3a53('0x1')];this['ecm']=_0x34171a[_0x3a53('0x2')];this[_0x3a53('0x3')]=_0x34171a[_0x3a53('0x3')];this[_0x3a53('0x4')]=_0x34171a[_0x3a53('0x4')];this[_0x3a53('0x5')]=_0x34171a[_0x3a53('0x5')]||0x960;this[_0x3a53('0x6')]=_0x34171a[_0x3a53('0x6')]||0x3840;this[_0x3a53('0x7')]=_0x34171a[_0x3a53('0x7')]||'v17,v27,v29';this[_0x3a53('0x8')]=_0x34171a['gateway']||'no';this['faxdetect']=_0x34171a[_0x3a53('0x9')]||'no';this[_0x3a53('0xa')]=_0x34171a[_0x3a53('0xa')]||0x1388;this[_0x3a53('0xb')]=_0x34171a[_0x3a53('0xb')]||_0x3a53('0xc');this[_0x3a53('0xd')]=_0x34171a[_0x3a53('0xd')]?_0x34171a[_0x3a53('0xd')]:undefined;this[_0x3a53('0xe')]=_0x34171a[_0x3a53('0xe')];this['key']=_0x34171a[_0x3a53('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 0c04a9f..6c3d377 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 _0x28e4=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x21dcb5,_0x9a43d0){var _0x7ebe92=function(_0x487272){while(--_0x487272){_0x21dcb5['push'](_0x21dcb5['shift']());}};_0x7ebe92(++_0x9a43d0);}(_0x28e4,0x94));var _0x428e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28e4[_0x321bb2];return _0x9c12ed;};'use strict';function FreshdeskAccount(_0x4f5490){this['id']=_0x4f5490['id']||0x0;this[_0x428e('0x0')]=_0x4f5490[_0x428e('0x0')]||'';this['username']=_0x4f5490[_0x428e('0x1')]||'';this[_0x428e('0x2')]=_0x4f5490[_0x428e('0x3')]||'';this[_0x428e('0x4')]=_0x4f5490[_0x428e('0x4')]||'';this['serverUrl']=_0x4f5490[_0x428e('0x5')]||'';this[_0x428e('0x6')]=_0x4f5490[_0x428e('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x4544=['remoteUri','Configurations','exports','name','username','apiKey','token'];(function(_0x9e999f,_0x305436){var _0x4186ad=function(_0x1485c8){while(--_0x1485c8){_0x9e999f['push'](_0x9e999f['shift']());}};_0x4186ad(++_0x305436);}(_0x4544,0xc7));var _0x4454=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x4544[_0x45783c];return _0x1161da;};'use strict';function FreshdeskAccount(_0x5ceda1){this['id']=_0x5ceda1['id']||0x0;this[_0x4454('0x0')]=_0x5ceda1[_0x4454('0x0')]||'';this[_0x4454('0x1')]=_0x5ceda1[_0x4454('0x1')]||'';this[_0x4454('0x2')]=_0x5ceda1[_0x4454('0x3')]||'';this[_0x4454('0x4')]=_0x5ceda1[_0x4454('0x4')]||'';this['serverUrl']=_0x5ceda1['serverUrl']||'';this[_0x4454('0x5')]=_0x5ceda1[_0x4454('0x5')]||{};}module[_0x4454('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 8bb3ebf..5835ae6 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 _0xe448=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x28add6,_0x1c1430){var _0x2e4b89=function(_0x2aa051){while(--_0x2aa051){_0x28add6['push'](_0x28add6['shift']());}};_0x2e4b89(++_0x1c1430);}(_0xe448,0x1aa));var _0x8e44=function(_0x57fc0c,_0x41334c){_0x57fc0c=_0x57fc0c-0x0;var _0x5ba6dc=_0xe448[_0x57fc0c];return _0x5ba6dc;};'use strict';function FreshsalesAccount(_0x470b18){this['id']=_0x470b18['id']||0x0;this[_0x8e44('0x0')]=_0x470b18[_0x8e44('0x0')]||'';this['username']=_0x470b18['username']||'';this[_0x8e44('0x1')]=_0x470b18[_0x8e44('0x2')]||'';this[_0x8e44('0x3')]=_0x470b18[_0x8e44('0x3')]||'';this[_0x8e44('0x4')]=_0x470b18['serverUrl']||'';this[_0x8e44('0x5')]=_0x470b18[_0x8e44('0x5')]||{};}module[_0x8e44('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xb77b=['Configurations','exports','username','apiKey','token','remoteUri','serverUrl'];(function(_0x285691,_0x2428d5){var _0x2a336b=function(_0x1f1c7e){while(--_0x1f1c7e){_0x285691['push'](_0x285691['shift']());}};_0x2a336b(++_0x2428d5);}(_0xb77b,0xcd));var _0xbb77=function(_0x2436aa,_0x4a1346){_0x2436aa=_0x2436aa-0x0;var _0x4d737c=_0xb77b[_0x2436aa];return _0x4d737c;};'use strict';function FreshsalesAccount(_0x28e7d4){this['id']=_0x28e7d4['id']||0x0;this['name']=_0x28e7d4['name']||'';this[_0xbb77('0x0')]=_0x28e7d4[_0xbb77('0x0')]||'';this[_0xbb77('0x1')]=_0x28e7d4[_0xbb77('0x2')]||'';this['remoteUri']=_0x28e7d4[_0xbb77('0x3')]||'';this[_0xbb77('0x4')]=_0x28e7d4['serverUrl']||'';this[_0xbb77('0x5')]=_0x28e7d4[_0xbb77('0x5')]||{};}module[_0xbb77('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index ad651f3..24c8b6f 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 _0xf454=['queuecallerexitAt','originalposition','context','exten','priority','holdtime','mohtime','variables','type','inbound','uniqueid','calleridname','queuecallerjoinAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x4137ff,_0x22a8c5){var _0x405599=function(_0x47d16e){while(--_0x47d16e){_0x4137ff['push'](_0x4137ff['shift']());}};_0x405599(++_0x22a8c5);}(_0xf454,0xe0));var _0x4f45=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf454[_0x2641f9];return _0x585741;};'use strict';function QueueReport(){this[_0x4f45('0x0')]=_0x4f45('0x1');this[_0x4f45('0x2')]='';this['calleridnum']='';this[_0x4f45('0x3')]='';this['queue']='';this[_0x4f45('0x4')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0x4f45('0x5')]=![];this[_0x4f45('0x6')]=null;this[_0x4f45('0x7')]=![];this[_0x4f45('0x8')]=null;this[_0x4f45('0x9')]=![];this[_0x4f45('0xa')]=null;this[_0x4f45('0xb')]=0x1;this['channel']='';this['connectedlinenum']='';this['connectedlinename']='';this['accountcode']='';this[_0x4f45('0xc')]='';this[_0x4f45('0xd')]='';this[_0x4f45('0xe')]='';this[_0x4f45('0xf')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x4f45('0x10')]=0x0;this[_0x4f45('0x11')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x8bca=['variables','type','inbound','calleridnum','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','exten','holdtime','lastAssignedTo','mohtime'];(function(_0x31d9a7,_0x2905df){var _0x4f1ede=function(_0x4789c3){while(--_0x4789c3){_0x31d9a7['push'](_0x31d9a7['shift']());}};_0x4f1ede(++_0x2905df);}(_0x8bca,0x191));var _0xa8bc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x8bca[_0x3e5086];return _0xfeb102;};'use strict';function QueueReport(){this[_0xa8bc('0x0')]=_0xa8bc('0x1');this['uniqueid']='';this[_0xa8bc('0x2')]='';this['calleridname']='';this['queue']='';this[_0xa8bc('0x3')]=null;this[_0xa8bc('0x4')]=null;this['position']=0x1;this[_0xa8bc('0x5')]=0x1;this[_0xa8bc('0x6')]=![];this[_0xa8bc('0x7')]=null;this[_0xa8bc('0x8')]=![];this[_0xa8bc('0x9')]=null;this['queuecallerexit']=![];this[_0xa8bc('0xa')]=null;this[_0xa8bc('0xb')]=0x1;this['channel']='';this[_0xa8bc('0xc')]='';this[_0xa8bc('0xd')]='';this[_0xa8bc('0xe')]='';this['context']='';this[_0xa8bc('0xf')]='';this['priority']='';this[_0xa8bc('0x10')]=0x0;this['assigned']=![];this[_0xa8bc('0x11')]='';this[_0xa8bc('0x12')]=0x0;this[_0xa8bc('0x13')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 773cf31..936d74a 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 _0x56a2=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x133380,_0x5137b7){var _0x486823=function(_0xbc7be8){while(--_0xbc7be8){_0x133380['push'](_0x133380['shift']());}};_0x486823(++_0x5137b7);}(_0x56a2,0x179));var _0x256a=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x56a2[_0x5d31f3];return _0x1cc88c;};'use strict';function SalesforceAccount(_0x1e4537){this['id']=_0x1e4537['id']||0x0;this[_0x256a('0x0')]=_0x1e4537[_0x256a('0x0')]||'';this[_0x256a('0x1')]=_0x1e4537[_0x256a('0x1')]||'';this[_0x256a('0x2')]=_0x1e4537[_0x256a('0x2')]||'';this[_0x256a('0x3')]=_0x1e4537['password']||'';this[_0x256a('0x4')]=_0x1e4537[_0x256a('0x4')]||'';this[_0x256a('0x5')]=_0x1e4537[_0x256a('0x5')]||'';this['securityToken']=_0x1e4537[_0x256a('0x6')]||'';this['type']=_0x1e4537[_0x256a('0x7')]||'integrationTab';this[_0x256a('0x8')]=_0x1e4537[_0x256a('0x8')]||'';this[_0x256a('0x9')]=_0x1e4537[_0x256a('0x9')]||{};}module[_0x256a('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x82d5=['securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x5058d4,_0x5c9315){var _0x527bc5=function(_0x52ef4d){while(--_0x52ef4d){_0x5058d4['push'](_0x5058d4['shift']());}};_0x527bc5(++_0x5c9315);}(_0x82d5,0x68));var _0x582d=function(_0x509b9d,_0x234651){_0x509b9d=_0x509b9d-0x0;var _0x5a755f=_0x82d5[_0x509b9d];return _0x5a755f;};'use strict';function SalesforceAccount(_0x1adcbe){this['id']=_0x1adcbe['id']||0x0;this[_0x582d('0x0')]=_0x1adcbe[_0x582d('0x0')]||'';this[_0x582d('0x1')]=_0x1adcbe[_0x582d('0x1')]||'';this[_0x582d('0x2')]=_0x1adcbe['remoteUri']||'';this['password']=_0x1adcbe[_0x582d('0x3')]||'';this[_0x582d('0x4')]=_0x1adcbe['clientId']||'';this[_0x582d('0x5')]=_0x1adcbe['clientSecret']||'';this[_0x582d('0x6')]=_0x1adcbe['securityToken']||'';this[_0x582d('0x7')]=_0x1adcbe[_0x582d('0x7')]||'integrationTab';this[_0x582d('0x8')]=_0x1adcbe[_0x582d('0x8')]||'';this[_0x582d('0x9')]=_0x1adcbe['Configurations']||{};}module[_0x582d('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 794b944..501190a 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 _0x0300=['Configurations','exports','username','password','serverUrl'];(function(_0x5d42a5,_0x4eec63){var _0x3b411d=function(_0xe1d3ba){while(--_0xe1d3ba){_0x5d42a5['push'](_0x5d42a5['shift']());}};_0x3b411d(++_0x4eec63);}(_0x0300,0x1f1));var _0x0030=function(_0x61dc60,_0x3b24ed){_0x61dc60=_0x61dc60-0x0;var _0x2d6cf8=_0x0300[_0x61dc60];return _0x2d6cf8;};'use strict';function ServicenowAccount(_0xd11fa4){this['id']=_0xd11fa4['id']||0x0;this['name']=_0xd11fa4['name']||'';this[_0x0030('0x0')]=_0xd11fa4[_0x0030('0x0')]||'';this[_0x0030('0x1')]=_0xd11fa4['password']||'';this['remoteUri']=_0xd11fa4['remoteUri']||'';this[_0x0030('0x2')]=_0xd11fa4[_0x0030('0x2')]||'';this[_0x0030('0x3')]=_0xd11fa4[_0x0030('0x3')]||{};}module[_0x0030('0x4')]=ServicenowAccount; \ No newline at end of file +var _0xaee5=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x41595f,_0x5ab1c5){var _0xc7fc40=function(_0x5eb6e7){while(--_0x5eb6e7){_0x41595f['push'](_0x41595f['shift']());}};_0xc7fc40(++_0x5ab1c5);}(_0xaee5,0x1d0));var _0x5aee=function(_0x59c664,_0x208ce8){_0x59c664=_0x59c664-0x0;var _0x3a2d81=_0xaee5[_0x59c664];return _0x3a2d81;};'use strict';function ServicenowAccount(_0x2b4b71){this['id']=_0x2b4b71['id']||0x0;this[_0x5aee('0x0')]=_0x2b4b71['name']||'';this[_0x5aee('0x1')]=_0x2b4b71['username']||'';this[_0x5aee('0x2')]=_0x2b4b71['password']||'';this[_0x5aee('0x3')]=_0x2b4b71[_0x5aee('0x3')]||'';this[_0x5aee('0x4')]=_0x2b4b71[_0x5aee('0x4')]||'';this[_0x5aee('0x5')]=_0x2b4b71[_0x5aee('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index db0dea7..a26c7bf 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 _0x7ff1=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x592f2c,_0x458bff){var _0x4669af=function(_0x1338c7){while(--_0x1338c7){_0x592f2c['push'](_0x592f2c['shift']());}};_0x4669af(++_0x458bff);}(_0x7ff1,0x7d));var _0x17ff=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0x7ff1[_0x285800];return _0x4b809e;};'use strict';function SugarcrmAccount(_0x276098){this['id']=_0x276098['id']||0x0;this['name']=_0x276098[_0x17ff('0x0')]||'';this[_0x17ff('0x1')]=_0x276098[_0x17ff('0x1')]||'';this[_0x17ff('0x2')]=_0x276098[_0x17ff('0x2')]||'';this[_0x17ff('0x3')]=_0x276098[_0x17ff('0x3')]||'';this[_0x17ff('0x4')]=_0x276098[_0x17ff('0x4')]||'';this[_0x17ff('0x5')]=_0x276098[_0x17ff('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xbd5b=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0xbd5b,0x122));var _0xbbd5=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0xbd5b[_0x587693];return _0x510a1a;};'use strict';function SugarcrmAccount(_0x26008f){this['id']=_0x26008f['id']||0x0;this['name']=_0x26008f[_0xbbd5('0x0')]||'';this[_0xbbd5('0x1')]=_0x26008f['username']||'';this['password']=_0x26008f[_0xbbd5('0x2')]||'';this[_0xbbd5('0x3')]=_0x26008f[_0xbbd5('0x3')]||'';this[_0xbbd5('0x4')]=_0x26008f['serverUrl']||'';this['Configurations']=_0x26008f[_0xbbd5('0x5')]||{};}module[_0xbbd5('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 341402a..8997ee8 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 _0x0bcf=['accountcode','unknown','stateTime','status','address','exports','name'];(function(_0x5dcef0,_0x2d678d){var _0x5a5bd8=function(_0x42a182){while(--_0x42a182){_0x5dcef0['push'](_0x5dcef0['shift']());}};_0x5a5bd8(++_0x2d678d);}(_0x0bcf,0x110));var _0xf0bc=function(_0x180ac2,_0x219d65){_0x180ac2=_0x180ac2-0x0;var _0xfcaede=_0x0bcf[_0x180ac2];return _0xfcaede;};'use strict';function Telephone(_0x3f6904){this['id']=_0x3f6904['id']||0x0;this['name']=_0x3f6904[_0xf0bc('0x0')]||'';this['accountcode']=_0x3f6904[_0xf0bc('0x1')]||'';this['state']=_0xf0bc('0x2');this[_0xf0bc('0x3')]=0x0;this[_0xf0bc('0x4')]=_0xf0bc('0x2');this[_0xf0bc('0x5')]='';}module[_0xf0bc('0x6')]=Telephone; \ No newline at end of file +var _0x9904=['state','unknown','stateTime','address','exports','name','accountcode'];(function(_0x2f1559,_0xcf043c){var _0x12908c=function(_0x259ef3){while(--_0x259ef3){_0x2f1559['push'](_0x2f1559['shift']());}};_0x12908c(++_0xcf043c);}(_0x9904,0x194));var _0x4990=function(_0x400c6e,_0x274fd6){_0x400c6e=_0x400c6e-0x0;var _0x3f8a47=_0x9904[_0x400c6e];return _0x3f8a47;};'use strict';function Telephone(_0x4a03ca){this['id']=_0x4a03ca['id']||0x0;this[_0x4990('0x0')]=_0x4a03ca[_0x4990('0x0')]||'';this[_0x4990('0x1')]=_0x4a03ca[_0x4990('0x1')]||'';this[_0x4990('0x2')]=_0x4990('0x3');this[_0x4990('0x4')]=0x0;this['status']=_0x4990('0x3');this[_0x4990('0x5')]='';}module[_0x4990('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 9ee2f7c..de01bc7 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 _0xa43a=['html','exports','name'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa43a,0xe3));var _0xaa43=function(_0x3e94bc,_0x5ac986){_0x3e94bc=_0x3e94bc-0x0;var _0x421762=_0xa43a[_0x3e94bc];return _0x421762;};'use strict';function template(_0x2f0d10){this['id']=_0x2f0d10['id']||0x0;this[_0xaa43('0x0')]=_0x2f0d10[_0xaa43('0x0')]||'';this[_0xaa43('0x1')]=_0x2f0d10[_0xaa43('0x1')]||'';}module[_0xaa43('0x2')]=template; \ No newline at end of file +var _0x90d2=['exports','name','html'];(function(_0x1b516a,_0x56a9f2){var _0x3321d5=function(_0x94e4ab){while(--_0x94e4ab){_0x1b516a['push'](_0x1b516a['shift']());}};_0x3321d5(++_0x56a9f2);}(_0x90d2,0x64));var _0x290d=function(_0x49c52e,_0x2fd41d){_0x49c52e=_0x49c52e-0x0;var _0x931127=_0x90d2[_0x49c52e];return _0x931127;};'use strict';function template(_0x5c540a){this['id']=_0x5c540a['id']||0x0;this[_0x290d('0x0')]=_0x5c540a[_0x290d('0x0')]||'';this[_0x290d('0x1')]=_0x5c540a['html']||'';}module[_0x290d('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 30394bf..a499b9b 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 _0x34e8=['channel','voice','status','AllConditions','AnyConditions','Actions','name'];(function(_0x4a79bd,_0x3f7827){var _0x26fd6a=function(_0x193ee6){while(--_0x193ee6){_0x4a79bd['push'](_0x4a79bd['shift']());}};_0x26fd6a(++_0x3f7827);}(_0x34e8,0x12c));var _0x834e=function(_0x54ecca,_0x23fd92){_0x54ecca=_0x54ecca-0x0;var _0x51ddda=_0x34e8[_0x54ecca];return _0x51ddda;};'use strict';function Trigger(_0x26715f){this['id']=_0x26715f['id']||0x0;this[_0x834e('0x0')]=_0x26715f[_0x834e('0x0')]||'';this[_0x834e('0x1')]=_0x26715f['channel']||_0x834e('0x2');this[_0x834e('0x3')]=_0x26715f[_0x834e('0x3')]||![];this[_0x834e('0x4')]=_0x26715f[_0x834e('0x4')]||[];this[_0x834e('0x5')]=_0x26715f[_0x834e('0x5')]||[];this['Actions']=_0x26715f[_0x834e('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x55ca=['name','voice','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x55ca,0x126));var _0xa55c=function(_0x409ad2,_0x5129c1){_0x409ad2=_0x409ad2-0x0;var _0x595b5f=_0x55ca[_0x409ad2];return _0x595b5f;};'use strict';function Trigger(_0x53d0d7){this['id']=_0x53d0d7['id']||0x0;this[_0xa55c('0x0')]=_0x53d0d7['name']||'';this['channel']=_0x53d0d7['channel']||_0xa55c('0x1');this[_0xa55c('0x2')]=_0x53d0d7['status']||![];this[_0xa55c('0x3')]=_0x53d0d7[_0xa55c('0x3')]||[];this[_0xa55c('0x4')]=_0x53d0d7[_0xa55c('0x4')]||[];this[_0xa55c('0x5')]=_0x53d0d7[_0xa55c('0x5')]||[];}module[_0xa55c('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 bc2eb2c..797715d 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 _0xeb27=['name','state','unknown','status','registry','indexOf','split','port','domain','refresh','stateRegistry','defaultuser','active'];(function(_0x2a0172,_0x1ed4dc){var _0xde6c71=function(_0xa7bad1){while(--_0xa7bad1){_0x2a0172['push'](_0x2a0172['shift']());}};_0xde6c71(++_0x1ed4dc);}(_0xeb27,0x74));var _0x7eb2=function(_0x4727b9,_0x413ff2){_0x4727b9=_0x4727b9-0x0;var _0x4ec66a=_0xeb27[_0x4727b9];return _0x4ec66a;};'use strict';function Trunk(_0x5a378f){this['id']=_0x5a378f['id']||0x0;this[_0x7eb2('0x0')]=_0x5a378f[_0x7eb2('0x0')]||![];this[_0x7eb2('0x1')]=_0x5a378f['name']||'';this[_0x7eb2('0x2')]=_0x7eb2('0x3');this['stateTime']=0x0;this[_0x7eb2('0x4')]=_0x7eb2('0x3');this['registry']=_0x5a378f[_0x7eb2('0x5')]&&_0x5a378f[_0x7eb2('0x5')][_0x7eb2('0x6')](':')?_0x5a378f[_0x7eb2('0x5')][_0x7eb2('0x7')](':')[0x0]:'';this['host']='';this[_0x7eb2('0x8')]='';this[_0x7eb2('0x9')]='';this['domainport']='';this[_0x7eb2('0xa')]='';this[_0x7eb2('0xb')]=_0x7eb2('0x3');this['registrationtime']='';this['address']='';this[_0x7eb2('0xc')]=_0x5a378f[_0x7eb2('0xc')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xb242=['port','domainport','refresh','address','defaultuser','active','name','state','unknown','stateTime','registry','indexOf','split'];(function(_0x4004cc,_0x50e857){var _0x3de1df=function(_0x39cdab){while(--_0x39cdab){_0x4004cc['push'](_0x4004cc['shift']());}};_0x3de1df(++_0x50e857);}(_0xb242,0x1f3));var _0x2b24=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0xb242[_0x2440fe];return _0x5cf734;};'use strict';function Trunk(_0x4eacb6){this['id']=_0x4eacb6['id']||0x0;this[_0x2b24('0x0')]=_0x4eacb6[_0x2b24('0x0')]||![];this[_0x2b24('0x1')]=_0x4eacb6[_0x2b24('0x1')]||'';this[_0x2b24('0x2')]=_0x2b24('0x3');this[_0x2b24('0x4')]=0x0;this['status']='unknown';this[_0x2b24('0x5')]=_0x4eacb6[_0x2b24('0x5')]&&_0x4eacb6['registry'][_0x2b24('0x6')](':')?_0x4eacb6[_0x2b24('0x5')][_0x2b24('0x7')](':')[0x0]:'';this['host']='';this[_0x2b24('0x8')]='';this['domain']='';this[_0x2b24('0x9')]='';this[_0x2b24('0xa')]='';this['stateRegistry']=_0x2b24('0x3');this['registrationtime']='';this[_0x2b24('0xb')]='';this[_0x2b24('0xc')]=_0x4eacb6['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 da9898c..0e0e22a 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 _0xa22e=['mandatoryDisposition','recordingFormat'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xa22e,0xc5));var _0xea22=function(_0x19022e,_0x2d279f){_0x19022e=_0x19022e-0x0;var _0x2553cd=_0xa22e[_0x19022e];return _0x2553cd;};'use strict';function voiceExtension(_0x240fe6){this['id']=_0x240fe6['id']||0x0;this['exten']=_0x240fe6['exten']||'';this[_0xea22('0x0')]=_0x240fe6[_0xea22('0x0')]||'none';this[_0xea22('0x1')]=_0x240fe6['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xabf8=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xabf8,0x11d));var _0x8abf=function(_0x112a20,_0x10ab04){_0x112a20=_0x112a20-0x0;var _0x2a3b73=_0xabf8[_0x112a20];return _0x2a3b73;};'use strict';function voiceExtension(_0x4fca1a){this['id']=_0x4fca1a['id']||0x0;this[_0x8abf('0x0')]=_0x4fca1a['exten']||'';this[_0x8abf('0x1')]=_0x4fca1a[_0x8abf('0x1')]||_0x8abf('0x2');this[_0x8abf('0x3')]=_0x4fca1a[_0x8abf('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 20b2ada..9aca414 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 _0xc13f=['dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue'];(function(_0x12d617,_0x2652bc){var _0x1f3cd4=function(_0x24769c){while(--_0x24769c){_0x12d617['push'](_0x12d617['shift']());}};_0x1f3cd4(++_0x2652bc);}(_0xc13f,0x82));var _0xfc13=function(_0x3cc618,_0x34f9d1){_0x3cc618=_0x3cc618-0x0;var _0x402582=_0xc13f[_0x3cc618];return _0x402582;};'use strict';var statusDesc=[_0xfc13('0x0'),_0xfc13('0x1'),_0xfc13('0x2'),_0xfc13('0x3'),_0xfc13('0x4'),_0xfc13('0x5'),_0xfc13('0x6'),_0xfc13('0x7'),_0xfc13('0x8')];var monitorFormat={'wav':_0xfc13('0x9'),'wav49':'wav49','gsm':_0xfc13('0xa')};var strategy={'rrmemory':_0xfc13('0xb'),'roundrobin':_0xfc13('0xc')};function VoiceQueue(_0xadf1ab){this['id']=_0xadf1ab['id']||0x0;this[_0xfc13('0xd')]=_0xadf1ab[_0xfc13('0xd')]||'';this['monitor_format']=_0xadf1ab[_0xfc13('0xe')]||'';this[_0xfc13('0xf')]=_0xadf1ab[_0xfc13('0xf')]||_0xfc13('0x10');this[_0xfc13('0x11')]=0x0;this[_0xfc13('0x12')]=0x0;this['total']=0x0;this[_0xfc13('0x13')]=0x0;this[_0xfc13('0x14')]=0x0;this[_0xfc13('0x15')]=0x0;this[_0xfc13('0x16')]=0x0;this[_0xfc13('0x17')]=0x0;this[_0xfc13('0x18')]=0x0;this[_0xfc13('0x19')]=0x0;this[_0xfc13('0x1a')]=0x0;this[_0xfc13('0x1b')]=_0xadf1ab['acw']||![];this[_0xfc13('0x1c')]=_0xadf1ab[_0xfc13('0x1c')]||0xa;this[_0xfc13('0x1d')]=_0xadf1ab[_0xfc13('0x1d')]||'no';this[_0xfc13('0x1e')]=!![];this[_0xfc13('0x1f')]='';this[_0xfc13('0x20')]=0x0;this[_0xfc13('0x21')]=0x0;this[_0xfc13('0x22')]=_0xadf1ab[_0xfc13('0x22')]||null;this[_0xfc13('0x23')]=_0xadf1ab['dialGlobalInterval']?_0xadf1ab[_0xfc13('0x23')]:null;this['dialActive']=_0xadf1ab[_0xfc13('0x24')];this['dialMethod']=_0xadf1ab['dialMethod']||'progressive';this[_0xfc13('0x25')]=_0xadf1ab[_0xfc13('0x25')]||0x0;this[_0xfc13('0x26')]=_0xadf1ab['dialLimitQueue']||0x0;this['dialPowerLevel']=_0xadf1ab[_0xfc13('0x27')]||0x1;this[_0xfc13('0x28')]=_0xadf1ab['dialPredictiveOptimization']||_0xfc13('0x29');this[_0xfc13('0x2a')]=_0xadf1ab['dialPredictiveOptimizationPercentage']||0.03;this[_0xfc13('0x2b')]=_0xadf1ab[_0xfc13('0x2b')]||0x258;this['dialOriginateCallerIdName']=_0xadf1ab[_0xfc13('0x2c')]||_0xfc13('0x2d');this[_0xfc13('0x2e')]=_0xadf1ab[_0xfc13('0x2e')]||_0xfc13('0x2d');this[_0xfc13('0x2f')]=_0xadf1ab['dialOriginateTimeout']||0x1e;this[_0xfc13('0x30')]=_0xadf1ab['dialQueueOptions']||_0xfc13('0x31');this[_0xfc13('0x32')]=_0xadf1ab['dialQueueTimeout']||0x3;this[_0xfc13('0x33')]=_0xadf1ab[_0xfc13('0x33')]||undefined;this[_0xfc13('0x34')]=_0xadf1ab[_0xfc13('0x34')]||0x3;this[_0xfc13('0x35')]=_0xadf1ab[_0xfc13('0x35')]||0x96;this[_0xfc13('0x36')]=_0xadf1ab[_0xfc13('0x36')]||0x3;this['dialBusyRetryFrequency']=_0xadf1ab[_0xfc13('0x37')]||0x96;this[_0xfc13('0x38')]=_0xadf1ab[_0xfc13('0x38')]||0x3;this[_0xfc13('0x39')]=_0xadf1ab[_0xfc13('0x39')]||0x96;this[_0xfc13('0x3a')]=_0xadf1ab['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0xadf1ab[_0xfc13('0x3b')]||0x96;this[_0xfc13('0x3c')]=_0xadf1ab['dialDropMaxRetry']||0x3;this[_0xfc13('0x3d')]=_0xadf1ab[_0xfc13('0x3d')]||0x96;this[_0xfc13('0x3e')]=_0xadf1ab[_0xfc13('0x3e')]||0x3;this[_0xfc13('0x3f')]=_0xadf1ab[_0xfc13('0x3f')]||0x96;this[_0xfc13('0x40')]=_0xadf1ab[_0xfc13('0x40')]||0x3;this['dialMachineRetryFrequency']=_0xadf1ab[_0xfc13('0x41')]||0x96;this['dialAgentRejectMaxRetry']=_0xadf1ab['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0xadf1ab['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0xadf1ab[_0xfc13('0x42')]||0x4;this[_0xfc13('0x43')]=_0xadf1ab[_0xfc13('0x43')]?_0xadf1ab[_0xfc13('0x43')]:undefined;this[_0xfc13('0x44')]=_0xadf1ab[_0xfc13('0x44')]?_0xadf1ab[_0xfc13('0x44')]:undefined;this[_0xfc13('0x45')]=_0xadf1ab['dialPrefix']||undefined;this[_0xfc13('0x46')]=_0xadf1ab[_0xfc13('0x46')]?_0xadf1ab[_0xfc13('0x46')]:undefined;this['dialOrderByScheduledAt']=_0xadf1ab[_0xfc13('0x47')]||_0xfc13('0x48');this[_0xfc13('0x49')]=_0xadf1ab[_0xfc13('0x49')]||undefined;this[_0xfc13('0x4a')]=_0xadf1ab['dialCutDigit']||undefined;this['strategy']=strategy[_0xadf1ab['strategy']]||'rrmemory';this[_0xfc13('0x4b')]=!![];this[_0xfc13('0x4c')]=_0xadf1ab[_0xfc13('0x4c')]||![];this[_0xfc13('0x4d')]=_0xadf1ab[_0xfc13('0x4d')];this['dialAMDGreeting']=_0xadf1ab[_0xfc13('0x4e')];this[_0xfc13('0x4f')]=_0xadf1ab[_0xfc13('0x4f')];this[_0xfc13('0x50')]=_0xadf1ab[_0xfc13('0x50')];this[_0xfc13('0x51')]=_0xadf1ab[_0xfc13('0x51')];this[_0xfc13('0x52')]=_0xadf1ab[_0xfc13('0x52')];this[_0xfc13('0x53')]=_0xadf1ab[_0xfc13('0x53')];this['dialAMDSilenceThreshold']=_0xadf1ab['dialAMDSilenceThreshold'];this[_0xfc13('0x54')]=_0xadf1ab[_0xfc13('0x54')];this['outboundRejectCallsDay']=0x0;this[_0xfc13('0x55')]=0x0;this[_0xfc13('0x56')]=_0xadf1ab[_0xfc13('0x56')];this[_0xfc13('0x57')]=0x0;this[_0xfc13('0x58')]=0x0;this[_0xfc13('0x59')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xfc13('0x5a')]=0x0;this[_0xfc13('0x5b')]=0x0;this[_0xfc13('0x5c')]=0x0;this[_0xfc13('0x5d')]=0x0;this[_0xfc13('0x5e')]=0x0;this[_0xfc13('0x5f')]=0x0;this[_0xfc13('0x60')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0xfc13('0x61')]=undefined;this[_0xfc13('0x62')]=undefined;this['handlePredictive']=undefined;this[_0xfc13('0x63')]=1.05;this[_0xfc13('0x64')]=0x0;this[_0xfc13('0x65')]=0x0;this[_0xfc13('0x66')]=0x0;this[_0xfc13('0x67')]=0x0;this[_0xfc13('0x68')]=0x0;this[_0xfc13('0x69')]=0x0;this[_0xfc13('0x6a')]=0x0;this[_0xfc13('0x6b')]=0x0;this['predictiveIntervalMaxThreshold']=_0xadf1ab['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xfc13('0x6c')]=_0xadf1ab[_0xfc13('0x6d')]||0xa;this[_0xfc13('0x6e')]=0x0;this[_0xfc13('0x6f')]=0x0;this[_0xfc13('0x70')]=0x1;this['erlangCalls']=0x0;this[_0xfc13('0x71')]=0x0;this[_0xfc13('0x72')]=0x0;this[_0xfc13('0x73')]=0x0;this[_0xfc13('0x74')]=_0xadf1ab['dialRecallMeTimeout']||0x1e;this[_0xfc13('0x75')]=_0xadf1ab[_0xfc13('0x75')]||![];this[_0xfc13('0x76')]=_0xadf1ab[_0xfc13('0x76')]||undefined;this[_0xfc13('0x77')]=_0xadf1ab[_0xfc13('0x77')]||![];this[_0xfc13('0x78')]=_0xadf1ab[_0xfc13('0x78')]||![];this[_0xfc13('0xe')]=monitorFormat[_0xadf1ab[_0xfc13('0xe')]]?monitorFormat[_0xadf1ab[_0xfc13('0xe')]]:undefined;this[_0xfc13('0x79')]=_0xadf1ab['mandatoryDisposition']||![];this[_0xfc13('0x7a')]=_0xadf1ab['mandatoryDispositionPause']?_0xadf1ab[_0xfc13('0x7a')]:undefined;}module[_0xfc13('0x7b')]=VoiceQueue; \ No newline at end of file +var _0x4e07=['unavailable','ringing','onhold','wav','wav49','gsm','rrmemory','name','monitor_format','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','acw','autopause','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4e07,0x1b4));var _0x74e0=function(_0x476fac,_0x370d70){_0x476fac=_0x476fac-0x0;var _0x201867=_0x4e07[_0x476fac];return _0x201867;};'use strict';var statusDesc=[_0x74e0('0x0'),_0x74e0('0x1'),'inuse',_0x74e0('0x2'),_0x74e0('0x3'),_0x74e0('0x4'),_0x74e0('0x5'),'ringinuse',_0x74e0('0x6')];var monitorFormat={'wav':_0x74e0('0x7'),'wav49':_0x74e0('0x8'),'gsm':_0x74e0('0x9')};var strategy={'rrmemory':_0x74e0('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x1e1cf9){this['id']=_0x1e1cf9['id']||0x0;this[_0x74e0('0xb')]=_0x1e1cf9[_0x74e0('0xb')]||'';this[_0x74e0('0xc')]=_0x1e1cf9[_0x74e0('0xc')]||'';this['type']=_0x1e1cf9['type']||_0x74e0('0xd');this[_0x74e0('0xe')]=0x0;this[_0x74e0('0xf')]=0x0;this[_0x74e0('0x10')]=0x0;this[_0x74e0('0x11')]=0x0;this[_0x74e0('0x12')]=0x0;this[_0x74e0('0x13')]=0x0;this['sumBillable']=0x0;this[_0x74e0('0x14')]=0x0;this[_0x74e0('0x15')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this['acw']=_0x1e1cf9[_0x74e0('0x16')]||![];this['acwTimeout']=_0x1e1cf9['acwTimeout']||0xa;this[_0x74e0('0x17')]=_0x1e1cf9['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this['originated']=0x0;this[_0x74e0('0x18')]=0x0;this[_0x74e0('0x19')]=_0x1e1cf9[_0x74e0('0x19')]||null;this[_0x74e0('0x1a')]=_0x1e1cf9['dialGlobalInterval']?_0x1e1cf9[_0x74e0('0x1a')]:null;this['dialActive']=_0x1e1cf9['dialActive'];this[_0x74e0('0x1b')]=_0x1e1cf9[_0x74e0('0x1b')]||_0x74e0('0x1c');this['dialLimitChannel']=_0x1e1cf9['dialLimitChannel']||0x0;this[_0x74e0('0x1d')]=_0x1e1cf9[_0x74e0('0x1d')]||0x0;this[_0x74e0('0x1e')]=_0x1e1cf9['dialPowerLevel']||0x1;this[_0x74e0('0x1f')]=_0x1e1cf9[_0x74e0('0x1f')]||_0x74e0('0x20');this[_0x74e0('0x21')]=_0x1e1cf9[_0x74e0('0x21')]||0.03;this[_0x74e0('0x22')]=_0x1e1cf9[_0x74e0('0x22')]||0x258;this[_0x74e0('0x23')]=_0x1e1cf9[_0x74e0('0x23')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x1e1cf9[_0x74e0('0x24')]||'anonymous';this[_0x74e0('0x25')]=_0x1e1cf9['dialOriginateTimeout']||0x1e;this[_0x74e0('0x26')]=_0x1e1cf9[_0x74e0('0x26')]||'tTxX';this[_0x74e0('0x27')]=_0x1e1cf9[_0x74e0('0x27')]||0x3;this['dialQueueProject']=_0x1e1cf9['dialQueueProject']||undefined;this[_0x74e0('0x28')]=_0x1e1cf9[_0x74e0('0x28')]||0x3;this['dialCongestionRetryFrequency']=_0x1e1cf9[_0x74e0('0x29')]||0x96;this[_0x74e0('0x2a')]=_0x1e1cf9[_0x74e0('0x2a')]||0x3;this[_0x74e0('0x2b')]=_0x1e1cf9['dialBusyRetryFrequency']||0x96;this[_0x74e0('0x2c')]=_0x1e1cf9[_0x74e0('0x2c')]||0x3;this[_0x74e0('0x2d')]=_0x1e1cf9['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x1e1cf9[_0x74e0('0x2e')]||0x3;this[_0x74e0('0x2f')]=_0x1e1cf9[_0x74e0('0x2f')]||0x96;this[_0x74e0('0x30')]=_0x1e1cf9['dialDropMaxRetry']||0x3;this[_0x74e0('0x31')]=_0x1e1cf9[_0x74e0('0x31')]||0x96;this[_0x74e0('0x32')]=_0x1e1cf9['dialAbandonedMaxRetry']||0x3;this[_0x74e0('0x33')]=_0x1e1cf9[_0x74e0('0x33')]||0x96;this[_0x74e0('0x34')]=_0x1e1cf9[_0x74e0('0x34')]||0x3;this['dialMachineRetryFrequency']=_0x1e1cf9[_0x74e0('0x35')]||0x96;this[_0x74e0('0x36')]=_0x1e1cf9['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x1e1cf9[_0x74e0('0x37')]||0x96;this[_0x74e0('0x38')]=_0x1e1cf9['dialGlobalMaxRetry']||0x4;this[_0x74e0('0x39')]=_0x1e1cf9[_0x74e0('0x39')]?_0x1e1cf9['Trunk']:undefined;this[_0x74e0('0x3a')]=_0x1e1cf9[_0x74e0('0x3a')]?_0x1e1cf9[_0x74e0('0x3a')]:undefined;this[_0x74e0('0x3b')]=_0x1e1cf9[_0x74e0('0x3b')]||undefined;this['Interval']=_0x1e1cf9['Interval']?_0x1e1cf9['Interval']:undefined;this[_0x74e0('0x3c')]=_0x1e1cf9[_0x74e0('0x3c')]||_0x74e0('0x3d');this[_0x74e0('0x3e')]=_0x1e1cf9[_0x74e0('0x3e')]||undefined;this[_0x74e0('0x3f')]=_0x1e1cf9[_0x74e0('0x3f')]||undefined;this[_0x74e0('0x40')]=strategy[_0x1e1cf9['strategy']]||_0x74e0('0xa');this[_0x74e0('0x41')]=!![];this['dialAMDActive']=_0x1e1cf9[_0x74e0('0x42')]||![];this[_0x74e0('0x43')]=_0x1e1cf9[_0x74e0('0x43')];this[_0x74e0('0x44')]=_0x1e1cf9['dialAMDGreeting'];this[_0x74e0('0x45')]=_0x1e1cf9['dialAMDAfterGreetingSilence'];this[_0x74e0('0x46')]=_0x1e1cf9[_0x74e0('0x46')];this[_0x74e0('0x47')]=_0x1e1cf9[_0x74e0('0x47')];this[_0x74e0('0x48')]=_0x1e1cf9[_0x74e0('0x48')];this[_0x74e0('0x49')]=_0x1e1cf9[_0x74e0('0x49')];this[_0x74e0('0x4a')]=_0x1e1cf9[_0x74e0('0x4a')];this[_0x74e0('0x4b')]=_0x1e1cf9['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x74e0('0x4c')]=0x0;this['timeout']=_0x1e1cf9[_0x74e0('0x4d')];this[_0x74e0('0x4e')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x74e0('0x4f')]=0x0;this[_0x74e0('0x50')]=0x0;this[_0x74e0('0x51')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x74e0('0x52')]=0x0;this[_0x74e0('0x53')]=0x0;this[_0x74e0('0x54')]=0x0;this['outboundReCallsDay']=0x0;this[_0x74e0('0x55')]=0x0;this[_0x74e0('0x56')]=undefined;this['startPredictive']=undefined;this[_0x74e0('0x57')]=undefined;this[_0x74e0('0x58')]=1.05;this[_0x74e0('0x59')]=0x0;this[_0x74e0('0x5a')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x74e0('0x5b')]=0x0;this[_0x74e0('0x5c')]=0x0;this[_0x74e0('0x5d')]=0x0;this[_0x74e0('0x5e')]=0x0;this[_0x74e0('0x5f')]=0x0;this['predictiveIntervalMaxThreshold']=_0x1e1cf9[_0x74e0('0x60')]||0x14;this['predictiveIntervalMinThreshold']=_0x1e1cf9['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x74e0('0x61')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x74e0('0x62')]=0x0;this[_0x74e0('0x63')]=0x0;this[_0x74e0('0x64')]=0x0;this[_0x74e0('0x65')]=0x0;this[_0x74e0('0x66')]=_0x1e1cf9[_0x74e0('0x66')]||0x1e;this[_0x74e0('0x67')]=_0x1e1cf9[_0x74e0('0x67')]||![];this['dialQueueProject2']=_0x1e1cf9[_0x74e0('0x68')]||undefined;this[_0x74e0('0x69')]=_0x1e1cf9[_0x74e0('0x69')]||![];this[_0x74e0('0x6a')]=_0x1e1cf9['dialAgiAfterHangupAgent']||![];this[_0x74e0('0xc')]=monitorFormat[_0x1e1cf9[_0x74e0('0xc')]]?monitorFormat[_0x1e1cf9[_0x74e0('0xc')]]:undefined;this[_0x74e0('0x6b')]=_0x1e1cf9[_0x74e0('0x6b')]||![];this['mandatoryDispositionPause']=_0x1e1cf9[_0x74e0('0x6c')]?_0x1e1cf9['mandatoryDispositionPause']:undefined;}module[_0x74e0('0x6d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 9174cfa..d24b84f 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 _0x6488=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0xe506a9,_0x3105d4){var _0x12ca6f=function(_0x5d512d){while(--_0x5d512d){_0xe506a9['push'](_0xe506a9['shift']());}};_0x12ca6f(++_0x3105d4);}(_0x6488,0xc1));var _0x8648=function(_0x4f103e,_0x284aaf){_0x4f103e=_0x4f103e-0x0;var _0x474b4d=_0x6488[_0x4f103e];return _0x474b4d;};'use strict';function VtigerAccount(_0x765042){this['id']=_0x765042['id']||0x0;this[_0x8648('0x0')]=_0x765042[_0x8648('0x0')]||'';this['username']=_0x765042[_0x8648('0x1')]||'';this[_0x8648('0x2')]=_0x765042['accessKey']||'';this[_0x8648('0x3')]=_0x765042[_0x8648('0x3')]||'';this[_0x8648('0x4')]=_0x765042[_0x8648('0x4')]||'';this[_0x8648('0x5')]=_0x765042[_0x8648('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x7622=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x1ee5be,_0x5f46e3){var _0x177140=function(_0x162779){while(--_0x162779){_0x1ee5be['push'](_0x1ee5be['shift']());}};_0x177140(++_0x5f46e3);}(_0x7622,0x1ba));var _0x2762=function(_0x3591a4,_0x4b7a63){_0x3591a4=_0x3591a4-0x0;var _0x474f7f=_0x7622[_0x3591a4];return _0x474f7f;};'use strict';function VtigerAccount(_0x305435){this['id']=_0x305435['id']||0x0;this[_0x2762('0x0')]=_0x305435[_0x2762('0x0')]||'';this[_0x2762('0x1')]=_0x305435[_0x2762('0x1')]||'';this[_0x2762('0x2')]=_0x305435[_0x2762('0x2')]||'';this[_0x2762('0x3')]=_0x305435[_0x2762('0x3')]||'';this['serverUrl']=_0x305435[_0x2762('0x4')]||'';this[_0x2762('0x5')]=_0x305435['Configurations']||{};}module[_0x2762('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 02b44aa..64a22a5 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 _0x2032=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x3b42c4,_0x37713b){var _0x2eb7ab=function(_0x1a2e80){while(--_0x1a2e80){_0x3b42c4['push'](_0x3b42c4['shift']());}};_0x2eb7ab(++_0x37713b);}(_0x2032,0xd9));var _0x2203=function(_0x447947,_0x4b13b0){_0x447947=_0x447947-0x0;var _0x5ea4d8=_0x2032[_0x447947];return _0x5ea4d8;};'use strict';function ZendeskAccount(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['username']||'';this[_0x2203('0x2')]=_0x4d6c97[_0x2203('0x2')]||'';this['token']=_0x4d6c97[_0x2203('0x3')]||'';this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||'';this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||'';this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||_0x2203('0x7');this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')]||'';this[_0x2203('0x9')]=_0x4d6c97['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x2032=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x3e9d62,_0x849eb){var _0x374b10=function(_0x1b3450){while(--_0x1b3450){_0x3e9d62['push'](_0x3e9d62['shift']());}};_0x374b10(++_0x849eb);}(_0x2032,0xd9));var _0x2203=function(_0x52926b,_0x12c368){_0x52926b=_0x52926b-0x0;var _0x3f63ac=_0x2032[_0x52926b];return _0x3f63ac;};'use strict';function ZendeskAccount(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['username']||'';this[_0x2203('0x2')]=_0x4d6c97[_0x2203('0x2')]||'';this['token']=_0x4d6c97[_0x2203('0x3')]||'';this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||'';this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||'';this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||_0x2203('0x7');this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')]||'';this[_0x2203('0x9')]=_0x4d6c97['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index f539f78..d225dc0 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 _0x5eb8=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x7549bf,_0x375bf8){var _0x3470c8=function(_0x34971e){while(--_0x34971e){_0x7549bf['push'](_0x7549bf['shift']());}};_0x3470c8(++_0x375bf8);}(_0x5eb8,0xb0));var _0x85eb=function(_0x10a904,_0x2bf292){_0x10a904=_0x10a904-0x0;var _0x53815a=_0x5eb8[_0x10a904];return _0x53815a;};'use strict';function ZohoAccount(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||'';this[_0x85eb('0x2')]=_0x5ea4df[_0x85eb('0x2')]||'';this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||'';this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||'';this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||'';this[_0x85eb('0x6')]=_0x5ea4df['serverUrl']||'';this[_0x85eb('0x7')]=_0x5ea4df[_0x85eb('0x7')]||'';this[_0x85eb('0x8')]=_0x5ea4df['refreshToken']||'';this[_0x85eb('0x9')]=_0x5ea4df['Configurations']||{};}module[_0x85eb('0xa')]=ZohoAccount; \ No newline at end of file +var _0xb5fb=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xb5fb,0x172));var _0xbb5f=function(_0x27778c,_0xd171ae){_0x27778c=_0x27778c-0x0;var _0x1edfb4=_0xb5fb[_0x27778c];return _0x1edfb4;};'use strict';function ZohoAccount(_0x529b52){this['id']=_0x529b52['id']||0x0;this[_0xbb5f('0x0')]=_0x529b52[_0xbb5f('0x0')]||'';this[_0xbb5f('0x1')]=_0x529b52[_0xbb5f('0x1')]||'';this[_0xbb5f('0x2')]=_0x529b52[_0xbb5f('0x2')]||'';this[_0xbb5f('0x3')]=_0x529b52[_0xbb5f('0x3')]||'';this[_0xbb5f('0x4')]=_0x529b52[_0xbb5f('0x4')]||'';this[_0xbb5f('0x5')]=_0x529b52[_0xbb5f('0x5')]||'';this[_0xbb5f('0x6')]=_0x529b52['serverUrl']||'';this['code']=_0x529b52[_0xbb5f('0x7')]||'';this['refreshToken']=_0x529b52[_0xbb5f('0x8')]||'';this[_0xbb5f('0x9')]=_0x529b52['Configurations']||{};}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 f865f10..f5593c4 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 _0x91a0=['Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','util','lodash','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x91a0,0x173));var _0x091a=function(_0x57a2a6,_0x3d21b2){_0x57a2a6=_0x57a2a6-0x0;var _0x74724a=_0x91a0[_0x57a2a6];return _0x74724a;};'use strict';var util=require(_0x091a('0x0'));var _=require(_0x091a('0x1'));var moment=require('moment');function checkNameSurname(_0x5d7920,_0x109a3e,_0x22430c){var _0x2ec2b2='';if(!_[_0x091a('0x2')](_0x109a3e)&&_0x091a('0x3')===typeof _0x109a3e){_0x2ec2b2+=_0x109a3e;}if(!_[_0x091a('0x2')](_0x22430c)&&_0x091a('0x3')===typeof _0x22430c){_0x2ec2b2+='\x20'+_0x22430c;}if(_0x2ec2b2!==''){return _0x2ec2b2;}return _0x5d7920;}function Action(_0x23a89c,_0x338fe2,_0x2d19a6,_0x4d27d6,_0x25f69c){this[_0x091a('0x4')]=_0x2d19a6||undefined;this[_0x091a('0x5')]=_0x23a89c['id'];this[_0x091a('0x6')]=_0x338fe2[_0x091a('0x7')];this[_0x091a('0x8')]=_0x338fe2[_0x091a('0x8')];this[_0x091a('0x9')]=_0x091a('0x6');this['dialAnswer']=![];this[_0x091a('0xa')]=_[_0x091a('0x2')](_0x23a89c[_0x091a('0xb')])?undefined:_0x23a89c[_0x091a('0xb')][_0x091a('0x7')];this[_0x091a('0xc')]=this[_0x091a('0xa')]?util[_0x091a('0xd')](_0x091a('0xe'),this[_0x091a('0xa')]):_0x4d27d6||undefined;this[_0x091a('0xf')]=checkNameSurname(_0x23a89c[_0x091a('0x10')][_0x091a('0x11')],_0x23a89c['Contact'][_0x091a('0x12')],_0x23a89c['Contact'][_0x091a('0x13')]);this[_0x091a('0x14')]=_0x23a89c[_0x091a('0x14')]||![];this[_0x091a('0x15')]=_0x23a89c[_0x091a('0x10')][_0x091a('0x11')];this['scheduledat']=_0x23a89c[_0x091a('0x16')];this[_0x091a('0x17')]=_0x23a89c[_0x091a('0x17')]||0x0;this[_0x091a('0x18')]=_0x23a89c[_0x091a('0x18')]||0x0;this[_0x091a('0x19')]=_0x23a89c[_0x091a('0x19')]||0x0;this[_0x091a('0x1a')]=(_0x23a89c[_0x091a('0x17')]||0x0)+(_0x23a89c[_0x091a('0x18')]||0x0)+(_0x23a89c[_0x091a('0x19')]||0x0)+(_0x23a89c[_0x091a('0x1b')]||0x0)+(_0x23a89c[_0x091a('0x1c')]||0x0)+(_0x23a89c[_0x091a('0x1d')]||0x0)+(_0x23a89c[_0x091a('0x1e')]||0x0)+(_0x23a89c[_0x091a('0x1f')]||0x0);this['countnosuchnumberretry']=_0x23a89c[_0x091a('0x1b')]||0x0;this[_0x091a('0x1c')]=_0x23a89c[_0x091a('0x1c')]||0x0;this['countabandonedretry']=_0x23a89c[_0x091a('0x1d')]||0x0;this[_0x091a('0x1e')]=_0x23a89c[_0x091a('0x1e')]||0x0;this[_0x091a('0x1f')]=_0x23a89c[_0x091a('0x1f')]||0x0;this['callback']=_0x23a89c[_0x091a('0x20')];this['callbackuniqueid']=_0x23a89c[_0x091a('0x21')];this[_0x091a('0x22')]=_0x23a89c['callbackat'];this[_0x091a('0x23')]=_0x23a89c[_0x091a('0x23')];this[_0x091a('0x24')]=_0x23a89c[_0x091a('0x24')];this['ListId']=_0x23a89c[_0x091a('0x25')];this[_0x091a('0x26')]=_[_0x091a('0x2')](_0x23a89c['Agent'])?_0x23a89c[_0x091a('0x26')]:_0x23a89c[_0x091a('0xb')]['id'];this['VoiceQueueId']=_0x23a89c[_0x091a('0x27')];this[_0x091a('0x28')]='';this['originatecalleridname']='';}Action[_0x091a('0x29')]['getCaller']=function(){return util[_0x091a('0xd')](_0x091a('0x2a'),this[_0x091a('0xf')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x4272=['exports','util','lodash','isNil','string','uniqueid','idContact','name','type','campaigntype','membername','Agent','channelAgent','SIP/%s','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','calleridname','number'];(function(_0x3f0a09,_0x22db38){var _0x5dad62=function(_0x47b240){while(--_0x47b240){_0x3f0a09['push'](_0x3f0a09['shift']());}};_0x5dad62(++_0x22db38);}(_0x4272,0x13c));var _0x2427=function(_0xe7b76,_0xe8377a){_0xe7b76=_0xe7b76-0x0;var _0x26f1c0=_0x4272[_0xe7b76];return _0x26f1c0;};'use strict';var util=require(_0x2427('0x0'));var _=require(_0x2427('0x1'));var moment=require('moment');function checkNameSurname(_0x274fe3,_0x2a83f0,_0x1e7b20){var _0x25100b='';if(!_[_0x2427('0x2')](_0x2a83f0)&&'string'===typeof _0x2a83f0){_0x25100b+=_0x2a83f0;}if(!_[_0x2427('0x2')](_0x1e7b20)&&_0x2427('0x3')===typeof _0x1e7b20){_0x25100b+='\x20'+_0x1e7b20;}if(_0x25100b!==''){return _0x25100b;}return _0x274fe3;}function Action(_0x2b4569,_0x205701,_0x1b4de9,_0x294b0a,_0x407ec8){this[_0x2427('0x4')]=_0x1b4de9||undefined;this[_0x2427('0x5')]=_0x2b4569['id'];this['queue']=_0x205701[_0x2427('0x6')];this[_0x2427('0x7')]=_0x205701[_0x2427('0x7')];this[_0x2427('0x8')]='queue';this['dialAnswer']=![];this[_0x2427('0x9')]=_[_0x2427('0x2')](_0x2b4569['Agent'])?undefined:_0x2b4569[_0x2427('0xa')][_0x2427('0x6')];this[_0x2427('0xb')]=this['membername']?util['format'](_0x2427('0xc'),this[_0x2427('0x9')]):_0x294b0a||undefined;this['calleridname']=checkNameSurname(_0x2b4569[_0x2427('0xd')]['phone'],_0x2b4569['Contact'][_0x2427('0xe')],_0x2b4569['Contact'][_0x2427('0xf')]);this['active']=_0x2b4569[_0x2427('0x10')]||![];this[_0x2427('0x11')]=_0x2b4569[_0x2427('0xd')][_0x2427('0x12')];this['scheduledat']=_0x2b4569[_0x2427('0x13')];this[_0x2427('0x14')]=_0x2b4569[_0x2427('0x14')]||0x0;this['countcongestionretry']=_0x2b4569[_0x2427('0x15')]||0x0;this['countnoanswerretry']=_0x2b4569[_0x2427('0x16')]||0x0;this['countglobal']=(_0x2b4569[_0x2427('0x14')]||0x0)+(_0x2b4569[_0x2427('0x15')]||0x0)+(_0x2b4569[_0x2427('0x16')]||0x0)+(_0x2b4569[_0x2427('0x17')]||0x0)+(_0x2b4569[_0x2427('0x18')]||0x0)+(_0x2b4569[_0x2427('0x19')]||0x0)+(_0x2b4569[_0x2427('0x1a')]||0x0)+(_0x2b4569[_0x2427('0x1b')]||0x0);this[_0x2427('0x17')]=_0x2b4569[_0x2427('0x17')]||0x0;this[_0x2427('0x18')]=_0x2b4569[_0x2427('0x18')]||0x0;this[_0x2427('0x19')]=_0x2b4569[_0x2427('0x19')]||0x0;this[_0x2427('0x1a')]=_0x2b4569['countmachineretry']||0x0;this['countagentrejectretry']=_0x2b4569[_0x2427('0x1b')]||0x0;this[_0x2427('0x1c')]=_0x2b4569[_0x2427('0x1c')];this[_0x2427('0x1d')]=_0x2b4569['callbackuniqueid'];this[_0x2427('0x1e')]=_0x2b4569[_0x2427('0x1e')];this[_0x2427('0x1f')]=_0x2b4569['recallme'];this[_0x2427('0x20')]=_0x2b4569[_0x2427('0x20')];this[_0x2427('0x21')]=_0x2b4569[_0x2427('0x21')];this['UserId']=_[_0x2427('0x2')](_0x2b4569['Agent'])?_0x2b4569[_0x2427('0x22')]:_0x2b4569[_0x2427('0xa')]['id'];this[_0x2427('0x23')]=_0x2b4569['VoiceQueueId'];this[_0x2427('0x24')]='';this[_0x2427('0x25')]='';}Action[_0x2427('0x26')][_0x2427('0x27')]=function(){return util[_0x2427('0x28')](_0x2427('0x29'),this[_0x2427('0x2a')],this[_0x2427('0x2b')]);};module[_0x2427('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index fd42b0f..957646e 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 _0x7a2c=['execCall','trim','dialCutDigit','substring','SIP/%s/%s%s','TrunkBackup','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','clone','responsetime','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','redis','defaults','localhost','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','blindtransfer','type','outbound','name','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','originated','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','clearZombieChannels','dialActive','setMessage','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','VoiceQueueId','ListId','Action','status','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','size','recallMe','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','run','then','logger2','[RecallMe]','starttime','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','NoSuchNumber','custom:agentnosuchnumber','buildObj','totalGlobal','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','countnosuchnumberretry','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','countglobal','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','activeContact','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','countmachineretry','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','amd','[callProgressDetectingCustomer][machine]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','unlockContact','disableContact','recallme','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x538b08,_0x416fe3){_0x538b08=_0x538b08-0x0;var _0x49b45c=_0x7a2c[_0x538b08];return _0x49b45c;};'use strict';var util=require(_0xc7a2('0x0'));var _=require('lodash');var BPromise=require(_0xc7a2('0x1'));var uuid=require(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var md5=require(_0xc7a2('0x4'));var Redis=require(_0xc7a2('0x5'));var config=require(_0xc7a2('0x6'));var logger=require(_0xc7a2('0x7'))(_0xc7a2('0x8'));var loggerAction=require('../../../config/logger')(_0xc7a2('0x9'));var ami=require(_0xc7a2('0xa'));var rpcDb=require('./rpcDb');var Action=require('./action');var ut=require('./util/util');config[_0xc7a2('0xb')]=_[_0xc7a2('0xc')](config[_0xc7a2('0xb')],{'host':_0xc7a2('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc7a2('0xb')]));var Sequence=function(){};Sequence[_0xc7a2('0xe')][_0xc7a2('0xf')]=function(_0x558839){this[_0xc7a2('0x10')]=this['tail']?this[_0xc7a2('0x10')][_0xc7a2('0x11')](_0x558839):_0x558839();};function Preview(_0x1a9b38){this['sequence']=new Sequence();this[_0xc7a2('0x12')]=_0x1a9b38[_0xc7a2('0x13')];this[_0xc7a2('0x14')]=_0x1a9b38['trunks'];this[_0xc7a2('0x15')]={};this[_0xc7a2('0x16')]=_0x1a9b38[_0xc7a2('0x16')];this[_0xc7a2('0x17')]=0x0;ami['on'](_0xc7a2('0x18'),this[_0xc7a2('0x19')][_0xc7a2('0x1a')](this));ami['on'](_0xc7a2('0x1b'),this[_0xc7a2('0x1c')][_0xc7a2('0x1a')](this));ami['on'](_0xc7a2('0x1d'),this[_0xc7a2('0x1e')][_0xc7a2('0x1a')](this));ami['on'](_0xc7a2('0x1f'),this[_0xc7a2('0x20')]['bind'](this));ami['on'](_0xc7a2('0x21'),this['syncNewExten'][_0xc7a2('0x1a')](this));ami['on'](_0xc7a2('0x22'),this[_0xc7a2('0x23')][_0xc7a2('0x1a')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xc7a2('0x1a')](this));ami['on'](_0xc7a2('0x24'),this['syncBlindTransfer']['bind'](this));this['loopCampaigns'](this[_0xc7a2('0x12')]);}function emit(_0x5a2f40,_0x155c42,_0x260be1){io['to'](_0x5a2f40)['emit'](_0x155c42,_0x260be1);}function emitCampaignPreview(_0x40f3c4){if(_0x40f3c4[_0xc7a2('0x25')]===_0xc7a2('0x26')){var _0x35e0f6={'id':_0x40f3c4['id'],'name':_0x40f3c4[_0xc7a2('0x27')],'strategy':_0x40f3c4[_0xc7a2('0x28')],'answered':_0x40f3c4[_0xc7a2('0x29')],'available':_0x40f3c4['available'],'loggedIn':_0x40f3c4['loggedIn'],'pTalking':_0x40f3c4[_0xc7a2('0x2a')],'sumBillable':_0x40f3c4[_0xc7a2('0x2b')],'sumDuration':_0x40f3c4['sumDuration'],'sumHoldTime':_0x40f3c4[_0xc7a2('0x2c')]||0x0,'talking':_0x40f3c4[_0xc7a2('0x2d')],'total':_0x40f3c4[_0xc7a2('0x2e')],'type':_0x40f3c4[_0xc7a2('0x25')],'unmanaged':_0x40f3c4[_0xc7a2('0x2f')],'abandoned':_0x40f3c4[_0xc7a2('0x30')],'waiting':_0x40f3c4[_0xc7a2('0x31')],'loggedInDb':_0x40f3c4[_0xc7a2('0x32')],'dialActive':_0x40f3c4['dialActive'],'dialMethod':_0x40f3c4[_0xc7a2('0x33')],'dialOriginateCallerIdName':_0x40f3c4['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x40f3c4[_0xc7a2('0x34')],'dialOriginateTimeout':_0x40f3c4['dialOriginateTimeout'],'dialPrefix':_0x40f3c4[_0xc7a2('0x35')],'outboundAnswerAgiCallsDay':_0x40f3c4[_0xc7a2('0x36')],'outboundAnswerCallsDay':_0x40f3c4[_0xc7a2('0x37')],'outboundBlacklistCallsDay':_0x40f3c4[_0xc7a2('0x38')],'outboundBusyCallsDay':_0x40f3c4['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x40f3c4['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x40f3c4[_0xc7a2('0x39')],'outboundDropCallsDayCallersExit':_0x40f3c4[_0xc7a2('0x3a')],'outboundDropCallsDayTimeout':_0x40f3c4[_0xc7a2('0x3b')],'outboundNoAnswerCallsDay':_0x40f3c4[_0xc7a2('0x3c')],'outboundNoSuchCallsDay':_0x40f3c4[_0xc7a2('0x3d')],'outboundOriginateFailureCallsDay':_0x40f3c4[_0xc7a2('0x3e')],'outboundReCallsDay':_0x40f3c4[_0xc7a2('0x3f')],'outboundRejectCallsDay':_0x40f3c4['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x40f3c4[_0xc7a2('0x40')],'outboundAbandonedCallsDay':_0x40f3c4[_0xc7a2('0x41')],'predictiveIntervalAnsweredCalls':_0x40f3c4['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x40f3c4[_0xc7a2('0x42')],'predictiveIntervalAvgTalktime':_0x40f3c4[_0xc7a2('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x40f3c4[_0xc7a2('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x40f3c4['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x40f3c4[_0xc7a2('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x40f3c4['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x40f3c4[_0xc7a2('0x46')],'predictiveIntervalMultiplicativeFactor':_0x40f3c4['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x40f3c4['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x40f3c4[_0xc7a2('0x47')],'predictiveIntervalTotalCalls':_0x40f3c4['predictiveIntervalTotalCalls'],'message':_0x40f3c4['message'],'originated':_0x40f3c4[_0xc7a2('0x48')],'erlangCalls':_0x40f3c4['erlangCalls'],'erlangCallToSecond':_0x40f3c4[_0xc7a2('0x49')],'erlangAbandonmentRate':_0x40f3c4['erlangAbandonmentRate'],'erlangBusyFactor':_0x40f3c4[_0xc7a2('0x4a')],'startPredictive':_0x40f3c4[_0xc7a2('0x4b')],'startProgressive':_0x40f3c4[_0xc7a2('0x4c')]};if(_0x40f3c4[_0xc7a2('0x4d')]){_0x35e0f6[_0xc7a2('0x4d')]={'id':_0x40f3c4[_0xc7a2('0x4d')]['id'],'name':_0x40f3c4[_0xc7a2('0x4d')][_0xc7a2('0x27')],'active':_0x40f3c4[_0xc7a2('0x4d')][_0xc7a2('0x4e')],'callerid':_0x40f3c4['Trunk'][_0xc7a2('0x4f')]};}if(_0x40f3c4[_0xc7a2('0x50')]){_0x35e0f6['Interval']={'id':_0x40f3c4[_0xc7a2('0x50')]['id'],'name':_0x40f3c4[_0xc7a2('0x50')][_0xc7a2('0x27')]};}var _0x23187f=md5(JSON[_0xc7a2('0x51')](_0x35e0f6));if(_0x40f3c4[_0xc7a2('0x4')]!==_0x23187f){_0x40f3c4[_0xc7a2('0x4')]=_0x23187f;emit(util['format'](_0xc7a2('0x52'),_0x35e0f6[_0xc7a2('0x27')]),_0xc7a2('0x53'),_0x35e0f6);}}}function emitVoiceQueueChannelRemove(_0x49ad1f){logger[_0xc7a2('0x54')](_0xc7a2('0x55'),JSON['stringify'](_0x49ad1f));emit(util[_0xc7a2('0x56')](_0xc7a2('0x52'),_0x49ad1f[_0xc7a2('0x27')]),_0xc7a2('0x57'),_0x49ad1f);io[_0xc7a2('0x58')](_0xc7a2('0x59'),_0x49ad1f);}function notSendMessagesQueue(_0x8559fe){if(_0x8559fe[_0xc7a2('0x5a')]){if(_0x8559fe['originated']===0x0&&_0x8559fe[_0xc7a2('0x2a')]===0x0){_0x8559fe['sendMessageOneNotActive']=![];_0x8559fe[_0xc7a2('0x5b')]=0x0;_0x8559fe[_0xc7a2('0x5c')]=0x0;_0x8559fe[_0xc7a2('0x5d')]=_0xc7a2('0x5e');ut[_0xc7a2('0x5f')](_0xc7a2('0x60'),_0x8559fe[_0xc7a2('0x27')]+_0xc7a2('0x61'));}else{_0x8559fe['message']=_0xc7a2('0x62');ut[_0xc7a2('0x5f')](_0xc7a2('0x60'),_0x8559fe[_0xc7a2('0x27')]+_0xc7a2('0x63'));}emitCampaignPreview(_0x8559fe);}}Preview[_0xc7a2('0xe')]['loopCampaigns']=function(){var _0x5ebb9c=this;setInterval(function(){_0x5ebb9c['syncCampaigns']();},0x7cf);};Preview[_0xc7a2('0xe')][_0xc7a2('0x64')]=function(){var _0x28ed1c=this[_0xc7a2('0x12')];this[_0xc7a2('0x17')]+=0x1;for(var _0x20935e in _0x28ed1c){if(_0x28ed1c[_0xc7a2('0x65')](_0x20935e)&&(_0x28ed1c[_0x20935e][_0xc7a2('0x33')]===_0xc7a2('0x8')||_0x28ed1c[_0x20935e]['dialMethod']==='booked')&&_0x28ed1c[_0x20935e]['type']===_0xc7a2('0x26')){if(this[_0xc7a2('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xc7a2('0x66')]();}}if(_0x28ed1c[_0xc7a2('0x65')](_0x20935e)&&_0x28ed1c[_0x20935e][_0xc7a2('0x33')]==='preview'&&_0x28ed1c[_0x20935e][_0xc7a2('0x25')]==='outbound'){if(_0x28ed1c[_0x20935e][_0xc7a2('0x67')]){this[_0xc7a2('0x68')](_0x28ed1c[_0x20935e]);this['recallMe'](_0x28ed1c[_0x20935e]);}else{notSendMessagesQueue(_0x28ed1c[_0x20935e]);}}}};Preview['prototype'][_0xc7a2('0x69')]=function(_0x1311a5){var _0x4f4b62=this;this[_0xc7a2('0x6a')][_0xc7a2('0xf')](function(){if(!_[_0xc7a2('0x6b')](_0x4f4b62[_0xc7a2('0x15')][_0x1311a5])){loggerAction[_0xc7a2('0x54')](_0xc7a2('0x6c'),_0x1311a5,'Queue',_0x4f4b62[_0xc7a2('0x15')][_0x1311a5][_0xc7a2('0x6d')],_0xc7a2('0x6e'),JSON[_0xc7a2('0x51')](_0x4f4b62['campaignsPreview'][_0x4f4b62[_0xc7a2('0x15')][_0x1311a5][_0xc7a2('0x6d')]][_0xc7a2('0x48')]),_0xc7a2('0x6f'),JSON[_0xc7a2('0x51')](_0x4f4b62[_0xc7a2('0x12')][_0x4f4b62[_0xc7a2('0x15')][_0x1311a5][_0xc7a2('0x6d')]]['pTalking']),JSON[_0xc7a2('0x51')](_0x4f4b62[_0xc7a2('0x15')][_0x1311a5][_0xc7a2('0x70')]),JSON[_0xc7a2('0x51')](_['pick'](_0x4f4b62[_0xc7a2('0x15')][_0x1311a5],[_0xc7a2('0x71'),'UserId',_0xc7a2('0x72'),_0xc7a2('0x73')])));return ami[_0xc7a2('0x74')]({'action':_0xc7a2('0x75'),'channel':_0x4f4b62[_0xc7a2('0x15')][_0x1311a5]['channel']})[_0xc7a2('0x76')](function(_0x44716e){if(_0x44716e[_0xc7a2('0x5d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4f4b62['actions'][_0x1311a5]){ut[_0xc7a2('0x77')](_0x4f4b62['campaignsPreview'][_0x4f4b62['actions'][_0x1311a5][_0xc7a2('0x6d')]],_0xc7a2('0x78'));if(_0x4f4b62['actions'][_0x1311a5]['dialAnswer']===!![]){ut[_0xc7a2('0x79')](_0x4f4b62[_0xc7a2('0x12')][_0x4f4b62[_0xc7a2('0x15')][_0x1311a5][_0xc7a2('0x6d')]],_0xc7a2('0x78'));ut['loggerError'](_0xc7a2('0x7a')+_0x1311a5,_0x4f4b62[_0xc7a2('0x15')][_0x1311a5]['queue']);}ut[_0xc7a2('0x7b')](_0xc7a2('0x7c')+_0x1311a5,_0x4f4b62[_0xc7a2('0x15')][_0x1311a5][_0xc7a2('0x6d')]);delete _0x4f4b62[_0xc7a2('0x15')][_0x1311a5];}},0x2328);}});}});};Preview['prototype'][_0xc7a2('0x66')]=function(){var _0x40afd2=this;loggerAction[_0xc7a2('0x54')]('[action]',_[_0xc7a2('0x7d')](this[_0xc7a2('0x15')]));for(var _0x12e004 in this[_0xc7a2('0x15')]){if(_0x40afd2[_0xc7a2('0x15')][_0xc7a2('0x65')](_0x12e004)){_0x40afd2['clearZombieChannel'](_0x12e004);}}};Preview[_0xc7a2('0xe')][_0xc7a2('0x7e')]=function(_0xe97320){var _0x332e8e=this;rpcDb[_0xc7a2('0x7f')](_0xe97320['id'],ut[_0xc7a2('0x80')](this[_0xc7a2('0x16')]))['then'](function(_0x2b1bb3){if(!_['isNil'](_0x2b1bb3)){for(var _0x4e1efa=0x0;_0x4e1efa<_0x2b1bb3[_0xc7a2('0x81')];_0x4e1efa+=0x1){if(ut[_0xc7a2('0x82')](_0x2b1bb3[_0x4e1efa][_0xc7a2('0x83')])<_0xe97320['dialRecallMeTimeout']*0x3c){if(_0x2b1bb3[_0x4e1efa][_0xc7a2('0x84')]&&!_0x2b1bb3[_0x4e1efa]['Agent']['voicePause']){_0x332e8e[_0xc7a2('0x85')](_0x2b1bb3[_0x4e1efa]['id'])[_0xc7a2('0x86')](ut[_0xc7a2('0x87')](_0xc7a2('0x88')))[_0xc7a2('0x76')](ut[_0xc7a2('0x87')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x2b1bb3[_0x4e1efa]['id']);}}else{var _0x5a91d1=new Action(_0x2b1bb3[_0x4e1efa],_0xe97320);_0x5a91d1[_0xc7a2('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xe97320['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x5a91d1,0x17,_0xc7a2('0x8a'));if(_0xe97320[_0xc7a2('0x8b')]){rpcDb[_0xc7a2('0x8c')](ut[_0xc7a2('0x8d')](_0x2b1bb3[_0x4e1efa]));rpcDb['createCustomerHistory'](_0x5a91d1,_0xc7a2('0x8e'));}else{ut[_0xc7a2('0x8f')](_0x5a91d1,0x16,_0xc7a2('0x90'));rpcDb[_0xc7a2('0x91')](_0x5a91d1,_0xc7a2('0x92'));rpcDb[_0xc7a2('0x93')](_0x5a91d1,_0xc7a2('0x92'));}}}}})[_0xc7a2('0x76')](ut[_0xc7a2('0x87')](_0xc7a2('0x94')));};Preview[_0xc7a2('0xe')]['setMessage']=function(_0x531924){_0x531924[_0xc7a2('0x5a')]=!![];if(ut['IsNotLoggedIn'](_0x531924[_0xc7a2('0x95')])){_0x531924[_0xc7a2('0x5d')]=_0xc7a2('0x96');}else if(!ut[_0xc7a2('0x97')](_0x531924['dialActive'])){_0x531924[_0xc7a2('0x5d')]=_0xc7a2('0x5e');}else if(!this[_0xc7a2('0x98')](_0x531924[_0xc7a2('0x4d')])){if(!this[_0xc7a2('0x98')](_0x531924['TrunkBackup'])){_0x531924[_0xc7a2('0x5d')]=_0xc7a2('0x99');}else{_0x531924[_0xc7a2('0x5d')]=_0xc7a2('0x9a');}}else{_0x531924[_0xc7a2('0x5d')]='ACTIVE';}emitCampaignPreview(_0x531924);};Preview[_0xc7a2('0xe')]['callProgressDetectingCustomer']=function(_0x4c146c,_0x3c06a8,_0x3524a4){var _0x2ebe41=this;var _0x559091=this[_0xc7a2('0x15')][_0x3c06a8];var _0x20c3db=this['campaignsPreview'][_0x559091[_0xc7a2('0x6d')]];var _0x19f017;if(_0x20c3db){switch(_0x3524a4){case'1':_0x20c3db[_0xc7a2('0x3d')]+=0x1;_0x559091['countnosuchnumberretry']+=0x1;_0x559091['countglobal']=ut['totalGlobal'](_0x559091);ut[_0xc7a2('0x8f')](_0x559091,0x0,_0xc7a2('0x9b'));ami['emit'](_0xc7a2('0x9c'),ut[_0xc7a2('0x9d')](_0x559091,'nosuchnumber'));rpcDb[_0xc7a2('0x91')](_0x559091,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xc7a2('0x9e')](_0x559091)>=_0x20c3db['dialGlobalMaxRetry']){_0x19f017=ut[_0xc7a2('0x9f')](_0x559091,0xf,_0xc7a2('0xa0'));rpcDb['createCustomerFinal'](_0x19f017,_0xc7a2('0xa1'));}else{if(_0x559091['countnosuchnumberretry']>=_0x20c3db[_0xc7a2('0xa2')]){rpcDb[_0xc7a2('0x93')](_0x559091,_0xc7a2('0xa1'));}else{rpcDb[_0xc7a2('0xa3')](ut[_0xc7a2('0xa4')](_0x559091,_0xc7a2('0xa5'),_0x20c3db['dialNoSuchNumberRetryFrequency']),_0x559091['unlockAgent'],_0x559091['activeContact']);}}delete this[_0xc7a2('0x15')][_0x4c146c[_0xc7a2('0xa6')]];break;case _0xc7a2('0xa7'):var _0x40d701=moment()[_0xc7a2('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x559091['responsetime']=_0x40d701;_0x559091[_0xc7a2('0xa8')]=_0x40d701;_0x559091[_0xc7a2('0x70')]=!![];_0x20c3db[_0xc7a2('0x2a')]+=0x1;logger[_0xc7a2('0x54')](_0xc7a2('0xa9'),_0x559091[_0xc7a2('0xaa')],_0xc7a2('0xab'),_0x20c3db[_0xc7a2('0x27')],_0xc7a2('0x6f'),_0x20c3db[_0xc7a2('0x2a')]);ami['emit']('custom:agentconnect',ut[_0xc7a2('0x9d')](_0x559091,_0xc7a2('0xac'),this['campaignsPreview'][_0x559091[_0xc7a2('0x6d')]]));if(_0x20c3db['acw']){ami[_0xc7a2('0x58')](_0xc7a2('0xad'),ut[_0xc7a2('0xae')](_0x559091));}break;case'16':ami[_0xc7a2('0x58')]('custom:agentcomplete',ut[_0xc7a2('0x9d')](_0x559091,_0xc7a2('0xaf'),this[_0xc7a2('0x12')][_0x559091[_0xc7a2('0x6d')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x559091,_0xc7a2('0xaf')));_0x20c3db[_0xc7a2('0x37')]+=0x1;_0x20c3db[_0xc7a2('0x2e')]+=0x1;_0x20c3db[_0xc7a2('0x29')]+=0x1;ut['decrementTalkink'](_0x20c3db,_0xc7a2('0xb0'));_0x559091['countglobal']=ut['totalGlobal'](_0x559091);ut['logCustomer'](_0x559091,0x4,_0xc7a2('0xb1'));rpcDb['createCustomerHistory'](_0x559091,_0xc7a2('0xb2'));rpcDb['createCustomerFinal'](_0x559091,_0xc7a2('0xb3'));rpcDb[_0xc7a2('0xb4')](_0x559091);_0x20c3db[_0xc7a2('0xb5')]+=_0x559091[_0xc7a2('0xb6')];_0x20c3db[_0xc7a2('0x2b')]+=_0x559091[_0xc7a2('0xb6')];logger[_0xc7a2('0x54')](_0xc7a2('0xb7'),_0x559091[_0xc7a2('0xaa')],'\x20Queue',_0x20c3db[_0xc7a2('0x27')],_0xc7a2('0x6f'),_0x20c3db[_0xc7a2('0x2a')]);delete this[_0xc7a2('0x15')][_0x4c146c[_0xc7a2('0xa6')]];break;case _0xc7a2('0xb8'):_0x20c3db[_0xc7a2('0xb9')]+=0x1;_0x559091[_0xc7a2('0xba')]+=0x1;_0x559091[_0xc7a2('0xbb')]=ut[_0xc7a2('0x9e')](_0x559091);ut[_0xc7a2('0x8f')](_0x559091,0x5,_0xc7a2('0xbc'));ami[_0xc7a2('0x58')](_0xc7a2('0xbd'),ut[_0xc7a2('0x9d')](_0x559091,_0xc7a2('0xbe')));rpcDb[_0xc7a2('0x91')](_0x559091,_0xc7a2('0xbf'));if(ut['totalGlobal'](_0x559091)>=_0x20c3db['dialGlobalMaxRetry']){_0x19f017=ut[_0xc7a2('0x9f')](_0x559091,0xf,_0xc7a2('0xa0'));rpcDb['createCustomerFinal'](_0x19f017,_0xc7a2('0xc0'));}else{if(_0x559091[_0xc7a2('0xba')]>=_0x20c3db['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x559091,_0xc7a2('0xbf'));}else{rpcDb[_0xc7a2('0xa3')](ut[_0xc7a2('0xa4')](_0x559091,_0xc7a2('0xba'),_0x20c3db[_0xc7a2('0xc1')]),_0x559091[_0xc7a2('0xc2')],_0x559091['activeContact']);}}break;case _0xc7a2('0xc3'):_0x20c3db['outboundNoAnswerCallsDay']+=0x1;_0x559091[_0xc7a2('0xc4')]+=0x1;_0x559091['countglobal']=ut[_0xc7a2('0x9e')](_0x559091);ut[_0xc7a2('0x8f')](_0x559091,0x3,_0xc7a2('0xc5'));ami[_0xc7a2('0x58')](_0xc7a2('0xc6'),ut[_0xc7a2('0x9d')](_0x559091,_0xc7a2('0xc7')));rpcDb[_0xc7a2('0x91')](_0x559091,_0xc7a2('0xc8'));if(ut['totalGlobal'](_0x559091)>=_0x20c3db['dialGlobalMaxRetry']){_0x19f017=ut['cloneAction'](_0x559091,0xf,_0xc7a2('0xa0'));rpcDb[_0xc7a2('0x93')](_0x19f017,_0xc7a2('0xc9'));}else{if(_0x559091[_0xc7a2('0xc4')]>=_0x20c3db[_0xc7a2('0xca')]){rpcDb[_0xc7a2('0x93')](_0x559091,_0xc7a2('0xc8'));}else{rpcDb[_0xc7a2('0xa3')](ut[_0xc7a2('0xa4')](_0x559091,_0xc7a2('0xc4'),_0x20c3db['dialNoAnswerRetryFrequency']),_0x559091[_0xc7a2('0xc2')],_0x559091[_0xc7a2('0xcb')]);}}break;case _0xc7a2('0xcc'):_0x20c3db['outboundCongestionCallsDay']+=0x1;_0x559091[_0xc7a2('0xcd')]+=0x1;_0x559091[_0xc7a2('0xbb')]=ut[_0xc7a2('0x9e')](_0x559091);ut['logCustomer'](_0x559091,0x8,_0xc7a2('0xce'));ami[_0xc7a2('0x58')](_0xc7a2('0xcf'),ut[_0xc7a2('0x9d')](_0x559091,'congestion'));rpcDb['createCustomerHistory'](_0x559091,_0xc7a2('0xd0'));if(ut[_0xc7a2('0x9e')](_0x559091)>=_0x20c3db[_0xc7a2('0xd1')]){_0x19f017=ut[_0xc7a2('0x9f')](_0x559091,0xf,_0xc7a2('0xa0'));rpcDb[_0xc7a2('0x93')](_0x19f017,_0xc7a2('0xd2'));}else{if(_0x559091[_0xc7a2('0xcd')]>=_0x20c3db[_0xc7a2('0xd3')]){rpcDb['createCustomerFinal'](_0x559091,_0xc7a2('0xd0'));}else{rpcDb[_0xc7a2('0xa3')](ut[_0xc7a2('0xa4')](_0x559091,_0xc7a2('0xcd'),_0x20c3db['dialBusyRetryFrequency']),_0x559091[_0xc7a2('0xc2')],_0x559091[_0xc7a2('0xcb')]);}}break;case _0xc7a2('0xd4'):_0x20c3db['outboundRejectCallsDay']+=0x1;_0x559091[_0xc7a2('0xd5')]+=0x1;_0x559091[_0xc7a2('0xbb')]=ut[_0xc7a2('0x9e')](_0x559091);ut[_0xc7a2('0x8f')](_0x559091,0x14,'AgentReject');ami[_0xc7a2('0x58')](_0xc7a2('0xd6'),ut['buildObj'](_0x559091,_0xc7a2('0xd7')));rpcDb[_0xc7a2('0x91')](_0x559091,_0xc7a2('0xd8'));if(ut[_0xc7a2('0x9e')](_0x559091)>=_0x20c3db[_0xc7a2('0xd1')]){_0x19f017=ut[_0xc7a2('0x9f')](_0x559091,0x14,_0xc7a2('0xd9'));rpcDb[_0xc7a2('0x93')](_0x19f017,_0xc7a2('0xda'));}else{if(_0x559091[_0xc7a2('0xd5')]>=_0x20c3db['dialAgentRejectMaxRetry']){rpcDb[_0xc7a2('0x93')](_0x559091,_0xc7a2('0xda'));}else{rpcDb['rescheduleContact'](ut[_0xc7a2('0xa4')](_0x559091,_0xc7a2('0xd5'),_0x20c3db[_0xc7a2('0xdb')]),_0x559091[_0xc7a2('0xc2')],_0x559091[_0xc7a2('0xcb')]);}}break;case _0xc7a2('0xdc'):_0x20c3db[_0xc7a2('0x41')]+=0x1;_0x559091['countabandonedretry']+=0x1;_0x559091['countglobal']=ut['totalGlobal'](_0x559091);ut[_0xc7a2('0x8f')](_0x559091,0xb,_0xc7a2('0xdd'));rpcDb[_0xc7a2('0x91')](_0x559091,_0xc7a2('0xde'));if(ut['totalGlobal'](_0x559091)>=_0x20c3db[_0xc7a2('0xd1')]){_0x19f017=ut[_0xc7a2('0x9f')](_0x559091,0xf,_0xc7a2('0xa0'));rpcDb[_0xc7a2('0x93')](_0x19f017,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x559091[_0xc7a2('0xdf')]>=_0x20c3db[_0xc7a2('0xe0')]){rpcDb['createCustomerFinal'](_0x559091,_0xc7a2('0xde'));}else{rpcDb[_0xc7a2('0xa3')](ut[_0xc7a2('0xa4')](_0x559091,_0xc7a2('0xe1'),_0x20c3db['dialAbandonedRetryFrequency']),_0x559091[_0xc7a2('0xc2')],_0x559091['activeContact']);}}break;case'18':_0x20c3db[_0xc7a2('0x40')]+=0x1;_0x559091[_0xc7a2('0xe2')]+=0x1;_0x559091[_0xc7a2('0xbb')]=ut['totalGlobal'](_0x559091);ut['logCustomer'](_0x559091,0x12,_0x4c146c['cause-txt']||_0x4c146c[_0xc7a2('0xe3')]);ami[_0xc7a2('0x58')]('custom:amd',ut[_0xc7a2('0x9d')](_0x559091,'amd'));rpcDb[_0xc7a2('0x91')](_0x559091,_0xc7a2('0xe4'));if(ut['totalGlobal'](_0x559091)>=_0x20c3db[_0xc7a2('0xd1')]){_0x19f017=ut['cloneAction'](_0x559091,0xf,'Global');rpcDb[_0xc7a2('0x93')](_0x19f017,_0xc7a2('0xe4'));}else{rpcDb[_0xc7a2('0x93')](_0x559091,_0xc7a2('0xe4'));}delete this[_0xc7a2('0x15')][_0x4c146c['linkedid']];break;case'19':_0x20c3db[_0xc7a2('0x40')]+=0x1;_0x559091[_0xc7a2('0xbb')]=ut[_0xc7a2('0x9e')](_0x559091);ut[_0xc7a2('0x8f')](_0x559091,0x13,_0x4c146c['cause-txt']||_0x4c146c[_0xc7a2('0xe3')]);ami[_0xc7a2('0x58')](_0xc7a2('0xe5'),ut[_0xc7a2('0x9d')](_0x559091,_0xc7a2('0xe6')));rpcDb[_0xc7a2('0x91')](_0x559091,'[callProgressDetectingCustomer][machine]');if(ut[_0xc7a2('0x9e')](_0x559091)>=_0x20c3db[_0xc7a2('0xd1')]){_0x19f017=ut['cloneAction'](_0x559091,0xf,_0xc7a2('0xa0'));rpcDb[_0xc7a2('0x93')](_0x19f017,_0xc7a2('0xe7'));}else{rpcDb[_0xc7a2('0x93')](_0x559091,_0xc7a2('0xe7'));}delete this['actions'][_0x4c146c[_0xc7a2('0xa6')]];break;default:if(_0x559091[_0xc7a2('0x70')]){ut[_0xc7a2('0x79')](_0x20c3db,'[default]');ut[_0xc7a2('0x7b')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x20c3db['name'],_0x4c146c);}_0x20c3db[_0xc7a2('0x40')]+=0x1;_0x559091[_0xc7a2('0xbb')]=ut[_0xc7a2('0x9e')](_0x559091);ut[_0xc7a2('0x8f')](_0x559091,0xc,_0x4c146c[_0xc7a2('0xe8')]||_0x4c146c['dialstatus']);rpcDb[_0xc7a2('0x91')](_0x559091,_0xc7a2('0xe9'));if(ut[_0xc7a2('0x9e')](_0x559091)>=_0x20c3db[_0xc7a2('0xd1')]){_0x19f017=ut[_0xc7a2('0x9f')](_0x559091,0xf,_0xc7a2('0xa0'));rpcDb[_0xc7a2('0x93')](_0x19f017,_0xc7a2('0xea'));}else{rpcDb['createCustomerFinal'](_0x559091,_0xc7a2('0xea'));}delete this[_0xc7a2('0x15')][_0x4c146c['linkedid']];}if(!(_0x559091[_0xc7a2('0x70')]&&_0x3524a4==='16')){ut[_0xc7a2('0x77')](_0x20c3db,'[callProgressDetectingCustomer]');logger[_0xc7a2('0x54')](_0xc7a2('0xeb'),_0x559091[_0xc7a2('0xaa')],_0xc7a2('0xab'),_0x20c3db['name'],_0xc7a2('0x6e'),_0x20c3db[_0xc7a2('0x48')]);}if(_0x3524a4!==_0xc7a2('0xa7')){delete this['actions'][_0x4c146c['linkedid']];delete this['actions'][_0x4c146c['destlinkedid']];}}};Preview[_0xc7a2('0xe')][_0xc7a2('0xec')]=function(_0x3872c2,_0x230c71,_0x2fa1dd){if(_[_0xc7a2('0xed')](_0x230c71)&&_0xc7a2('0xee')!==typeof _0x230c71){return;}if(_[_0xc7a2('0xed')](_0x2fa1dd)&&'object'!==typeof _0x2fa1dd){return;}switch(_0x2fa1dd[_0xc7a2('0xef')]){case'0':ut['logAgent'](_0x3872c2,0x0,_0xc7a2('0x9b'));rpcDb[_0xc7a2('0xf0')](_0x3872c2,_0xc7a2('0xf1'));break;case'3':ut[_0xc7a2('0xf2')](_0x3872c2,0x3,'NoAnswer');rpcDb[_0xc7a2('0xf0')](_0x3872c2,_0xc7a2('0xf3'));break;case'5':ut[_0xc7a2('0xf2')](_0x3872c2,0x5,_0xc7a2('0xbc'));rpcDb[_0xc7a2('0xf0')](_0x3872c2,_0xc7a2('0xf4'));break;case'8':ut[_0xc7a2('0xf2')](_0x3872c2,0x8,_0xc7a2('0xce'));rpcDb[_0xc7a2('0xf0')](_0x3872c2,_0xc7a2('0xf5'));break;case'22':ut[_0xc7a2('0xf2')](_0x3872c2,0x16,_0xc7a2('0xf6'));rpcDb['createAgentHistory'](_0x3872c2,_0xc7a2('0xf7'));break;default:ut[_0xc7a2('0xf2')](_0x3872c2,0xc,_0x2fa1dd[_0xc7a2('0xef')]);rpcDb[_0xc7a2('0xf0')](_0x3872c2,_0xc7a2('0xf5'));}ut[_0xc7a2('0x77')](_0x230c71,_0xc7a2('0xf8'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x3872c2['uniqueid'],_0xc7a2('0xab'),_0x230c71[_0xc7a2('0x27')],_0xc7a2('0x6e'),_0x230c71[_0xc7a2('0x48')]);delete this[_0xc7a2('0x15')][_0x3872c2['uniqueid']];};Preview['prototype'][_0xc7a2('0xf9')]=function(_0x3bb53d,_0x2c80f2,_0x113470,_0xe785fd,_0x5122d9){var _0x28882e=this;return new BPromise(function(_0x56fa72,_0x445940){if(_[_0xc7a2('0x6b')](_0x2c80f2)||_[_0xc7a2('0x6b')](_0x2c80f2[_0xc7a2('0xfa')])||_[_0xc7a2('0x6b')](_0x2c80f2[_0xc7a2('0xfa')][_0xc7a2('0xfb')])||_[_0xc7a2('0x6b')](_0x2c80f2[_0xc7a2('0x72')])){_0x445940(ut[_0xc7a2('0x5d')](_0xc7a2('0xfc'),_0xe785fd,_0x5122d9));return;}var _0x277168=uuid['v4']();var _0x42ddcc=_0x28882e[_0xc7a2('0x12')][_0x2c80f2['Queue'][_0xc7a2('0x27')]];var _0x171132=_0x113470?_0x28882e[_0xc7a2('0x16')][_0x113470]['id']:undefined;_0x28882e[_0xc7a2('0x15')][_0x277168]=new Action(_0x2c80f2,_0x42ddcc,_0x277168,_0x113470,_0x171132);var _0x360ccb=_0x28882e[_0xc7a2('0x15')][_0x277168];_0x360ccb['unlockAgent']=_0xe785fd;_0x360ccb['activeContact']=_0x5122d9;_0x360ccb[_0xc7a2('0xfd')]=_0x113470;if(_['isEmpty'](_0x3bb53d)){_0x28882e['execCall'](_0x360ccb,_0x42ddcc,_0x2c80f2,_0x113470)[_0xc7a2('0x86')](function(_0x1e79cc){logger[_0xc7a2('0x54')](_0xc7a2('0xfe'),_0xc7a2('0xff')+_0x360ccb[_0xc7a2('0x6d')]+_0xc7a2('0x100')+_0x360ccb['idContact'],JSON[_0xc7a2('0x51')](_0x1e79cc));ami['emit']('custom:agentcalled',ut[_0xc7a2('0x9d')](_0x360ccb,_0xc7a2('0x101'),_0x28882e[_0xc7a2('0x12')][_0x360ccb[_0xc7a2('0x6d')]]));_0x56fa72(ut[_0xc7a2('0x5d')]('Calling'));})['catch'](function(_0x316f06){ut[_0xc7a2('0x5f')](_0xc7a2('0x102'),_0x316f06);_0x445940(ut[_0xc7a2('0x5d')](_0xc7a2('0x103'),_0xe785fd,_0x5122d9));});}else{_0x42ddcc['outboundBlacklistCallsDay']+=0x1;ut[_0xc7a2('0x104')](_0x360ccb);rpcDb['createHistory'](_0x360ccb,'[Blacklist][error]');delete _0x28882e['actions'][_0x277168];_0x445940(ut[_0xc7a2('0x5d')](_0xc7a2('0x105'),_0xe785fd,_0x5122d9));}});};Preview[_0xc7a2('0xe')]['isTrunkReachable']=function(_0x22c0e3){return!_[_0xc7a2('0x6b')](_0x22c0e3)&&!_['isNil'](_0x22c0e3['name'])&&!_[_0xc7a2('0x6b')](_0x22c0e3[_0xc7a2('0x4e')])&&_0x22c0e3[_0xc7a2('0x4e')]&&!_[_0xc7a2('0x6b')](this[_0xc7a2('0x14')][util['format'](_0xc7a2('0x106'),_0x22c0e3[_0xc7a2('0x27')])])&&!_[_0xc7a2('0x6b')](this[_0xc7a2('0x14')][util[_0xc7a2('0x56')]('SIP/%s',_0x22c0e3[_0xc7a2('0x27')])]['status'])&&(this[_0xc7a2('0x14')][util[_0xc7a2('0x56')](_0xc7a2('0x106'),_0x22c0e3[_0xc7a2('0x27')])][_0xc7a2('0x75')]===_0xc7a2('0x107')||this[_0xc7a2('0x14')][util[_0xc7a2('0x56')](_0xc7a2('0x106'),_0x22c0e3['name'])][_0xc7a2('0x75')]===_0xc7a2('0x108'));};Preview['prototype'][_0xc7a2('0x85')]=function(_0x44dd80,_0x1ae50e){var _0x211768=this;return new BPromise(function(_0x1c137a,_0x170f1d){_0x211768[_0xc7a2('0x109')](_0x44dd80,_0x1ae50e)[_0xc7a2('0x86')](function(_0x29b734){_0x1c137a(_[_0xc7a2('0x10a')](_0x29b734,[_0xc7a2('0x5d')]));})[_0xc7a2('0x76')](function(_0x50858f){if(_0x50858f['unlock']){rpcDb[_0xc7a2('0x10b')](_0x44dd80);}if(_0x50858f[_0xc7a2('0x4e')]){rpcDb[_0xc7a2('0x10c')](_0x44dd80);}_0x170f1d(_[_0xc7a2('0x10a')](_0x50858f,[_0xc7a2('0x5d')]));});});};Preview[_0xc7a2('0xe')][_0xc7a2('0x109')]=function(_0x4ea2bf,_0x87280b){var _0x395c5e=this;return new BPromise(function(_0x1e8316,_0xe2af37){var _0x3c30e6,_0x18b097;rpcDb['getContactPreview'](_0x4ea2bf)['then'](function(_0x2d93b5){if(!_[_0xc7a2('0x6b')](_0x2d93b5[0x0])){_0x18b097=_0x2d93b5[0x0][_0xc7a2('0x10d')]?![]:!![];_0x3c30e6=_0x2d93b5[0x0]['recallme']?!![]:![];_0x3c30e6=_0x87280b?!![]:_0x3c30e6;}var _0x5bc0fb=_0x395c5e['validateContact'](_0x2d93b5);if(_0x5bc0fb['isValid']){rpcDb[_0xc7a2('0x10e')](_[_0xc7a2('0x10a')](_0x2d93b5[0x0],[_0xc7a2('0x72'),_0xc7a2('0x10f')]))[_0xc7a2('0x86')](function(_0x269bc0){_0x395c5e[_0xc7a2('0xf9')](_0x269bc0,_0x2d93b5[0x0],_0x87280b,_0x18b097,_0x3c30e6)['then'](function(_0x32815b){_0x1e8316(_0x32815b);})[_0xc7a2('0x76')](function(_0x41f746){_0xe2af37(_0x41f746);});})[_0xc7a2('0x76')](function(_0x29e378){ut[_0xc7a2('0x5f')](_0xc7a2('0x110'),_0x29e378);_0xe2af37(ut[_0xc7a2('0x5d')]('Call\x20unsuccessful',_0x18b097,_0x3c30e6));});}else{_0xe2af37(ut[_0xc7a2('0x5d')](_0x5bc0fb['message'],_0x18b097,_0x3c30e6));}})[_0xc7a2('0x76')](function(_0x37e0f7){ut[_0xc7a2('0x5f')](_0xc7a2('0x111'),_0x37e0f7);_0xe2af37(ut[_0xc7a2('0x5d')](_0xc7a2('0x112'),![],!![]));});});};Preview['prototype'][_0xc7a2('0x113')]=function(_0x3b2885){if(_[_0xc7a2('0x6b')](_0x3b2885)||_[_0xc7a2('0x114')](_0x3b2885)||!_['isNil'](_0x3b2885[0x0][_0xc7a2('0x84')])&&_[_0xc7a2('0x6b')](_0x3b2885[0x0][_0xc7a2('0x84')][_0xc7a2('0x27')])){ut[_0xc7a2('0x5f')](_0xc7a2('0x115'),_0x3b2885);return{'isValid':![],'message':_0xc7a2('0x116')};}var _0x39e60e=this['campaignsPreview'][_0x3b2885[0x0]['Queue'][_0xc7a2('0x27')]];_0x39e60e['message']='ACTIVE';if(_['isNil'](_0x39e60e)){ut[_0xc7a2('0x5f')](_0xc7a2('0x117'),_0x39e60e);return{'isValid':![],'message':_0xc7a2('0x118')};}if(!this[_0xc7a2('0x98')](_0x39e60e[_0xc7a2('0x4d')])){ut[_0xc7a2('0x5f')](_0xc7a2('0x119'),'campaign\x20Name:\x20'+_0x39e60e[_0xc7a2('0x27')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x39e60e['TrunkBackup'])){ut['logger'](_0xc7a2('0x119'),_0x39e60e['name']+_0xc7a2('0x11a'));return{'isValid':![],'message':_0xc7a2('0x11b')};}}if(!ut[_0xc7a2('0x97')](_0x39e60e[_0xc7a2('0x67')])){ut[_0xc7a2('0x5f')]('[Preview][validateContact][Campaign\x20Active]',_0x39e60e[_0xc7a2('0x27')]+_0xc7a2('0x11c'));return{'isValid':![],'message':_0xc7a2('0x11d')+_0x39e60e['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xc7a2('0x11e')};};Preview['prototype'][_0xc7a2('0x11f')]=function(_0x4ac4ae,_0x5bf4f4,_0x4aaecd,_0x1434a1){var _0x2e8f91=this;return new BPromise(function(_0x5625aa,_0x227a05){var _0x482418=_0x4ac4ae[_0xc7a2('0xaa')];var _0x3ad98d=_0x2e8f91[_0xc7a2('0x98')](_0x5bf4f4['Trunk'])?util[_0xc7a2('0x56')]('SIP/%s/%s%s',_0x5bf4f4[_0xc7a2('0x4d')][_0xc7a2('0x27')],_[_0xc7a2('0x6b')](_0x5bf4f4[_0xc7a2('0x35')])?'':_0x5bf4f4[_0xc7a2('0x35')][_0xc7a2('0x120')]()||'',_0x5bf4f4[_0xc7a2('0x121')]>0x0?_0x4aaecd[_0xc7a2('0xfa')]['phone'][_0xc7a2('0x122')](_0x5bf4f4['dialCutDigit']):_0x4aaecd[_0xc7a2('0xfa')][_0xc7a2('0xfb')]):util[_0xc7a2('0x56')](_0xc7a2('0x123'),_[_0xc7a2('0x6b')](_0x5bf4f4[_0xc7a2('0x124')])?_0x5bf4f4['Trunk'][_0xc7a2('0x27')]:_0x5bf4f4['TrunkBackup']['name'],_['isNil'](_0x5bf4f4[_0xc7a2('0x35')])?'':_0x5bf4f4[_0xc7a2('0x35')]['trim']()||'',_0x5bf4f4['dialCutDigit']>0x0?_0x4aaecd[_0xc7a2('0xfa')][_0xc7a2('0xfb')][_0xc7a2('0x122')](_0x5bf4f4['dialCutDigit']):_0x4aaecd['Contact']['phone']);var _0x2ad345=_0x2e8f91[_0xc7a2('0x98')](_0x5bf4f4['Trunk'])?ut[_0xc7a2('0x125')](_0x5bf4f4['Trunk'][_0xc7a2('0x4f')],_0x5bf4f4[_0xc7a2('0x126')],_0x5bf4f4[_0xc7a2('0x127')]>0x0?ut[_0xc7a2('0x128')](_0x5bf4f4[_0xc7a2('0x34')],_0x5bf4f4['dialRandomLastDigitCallerIdNumber']):_0x5bf4f4['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0xc7a2('0x6b')](_0x5bf4f4[_0xc7a2('0x124')])?_0x5bf4f4[_0xc7a2('0x4d')]['callerid']:_0x5bf4f4['TrunkBackup'][_0xc7a2('0x4f')],_0x5bf4f4[_0xc7a2('0x126')],_0x5bf4f4[_0xc7a2('0x127')]>0x0?ut['getCallerIdRandom'](_0x5bf4f4['dialOriginateCallerIdNumber'],_0x5bf4f4[_0xc7a2('0x127')]):_0x5bf4f4['dialOriginateCallerIdNumber']);if(_0x2ad345){_0x4ac4ae[_0xc7a2('0x129')]=ut[_0xc7a2('0x12a')](_0x2ad345);_0x4ac4ae[_0xc7a2('0x12b')]=ut[_0xc7a2('0x12c')](_0x2ad345);}var _0x31b302=ut[_0xc7a2('0x12d')](_0x5bf4f4,_0x4aaecd,_0x3ad98d,_0x2ad345,_0x482418,_0x4ac4ae);_[_0xc7a2('0x12e')](_0x4ac4ae,ut[_0xc7a2('0x12f')](_0x31b302));_0x4ac4ae[_0xc7a2('0x89')]=moment()['format'](_0xc7a2('0x130'));ami[_0xc7a2('0x74')](ut['variablesAction'](_0x4ac4ae,_0x5bf4f4,_0x31b302,_0x4ac4ae['activeContact'],_0x1434a1))['then'](function(_0x3044d2){_0x5bf4f4['originated']+=0x1;logger['info'](_0xc7a2('0x131'),_0x482418,_0xc7a2('0xab'),_0x5bf4f4[_0xc7a2('0x27')],_0xc7a2('0x6e'),_0x5bf4f4[_0xc7a2('0x48')]);_0x5625aa(_0x3044d2);})[_0xc7a2('0x76')](function(_0x13db91){ut[_0xc7a2('0xf2')](_0x4ac4ae,0xe,_0xc7a2('0x132'));rpcDb[_0xc7a2('0xf0')](_0x4ac4ae,_0xc7a2('0x133'));_0x227a05(_0x13db91);});});};Preview[_0xc7a2('0xe')]['syncNewExten']=function(_0x24ac93){if(this[_0xc7a2('0x15')][_0x24ac93[_0xc7a2('0xa6')]]){this[_0xc7a2('0x15')][_0x24ac93[_0xc7a2('0xa6')]][_0xc7a2('0x134')]=_0x24ac93['channel'];}};Preview[_0xc7a2('0xe')]['syncOriginateResponse']=function(_0x53857c){var _0x5d1fa4=this;var _0x2ede9a=this['actions'][_0x53857c['actionid']];if(_0x2ede9a){if(_0x2ede9a[_0xc7a2('0xfd')]&&this['agents'][_0x2ede9a[_0xc7a2('0xfd')]]){ut['logLookAgent'](_0x2ede9a,this[_0xc7a2('0x16')][_0x2ede9a['lookAgent']][_0xc7a2('0x27')],this['agents'][_0x2ede9a['lookAgent']]['id']);}var _0x20fb36=_[_0xc7a2('0x135')](_0x2ede9a);_0x20fb36[_0xc7a2('0x136')]=moment()[_0xc7a2('0x56')](_0xc7a2('0x130'));var _0x283078=_0x5d1fa4['campaignsPreview'][_0x2ede9a[_0xc7a2('0x6d')]];if(ut['isFailure'](_0x53857c['response'])){if(_0x2ede9a[_0xc7a2('0xc2')]){rpcDb[_0xc7a2('0x10b')](_0x2ede9a[_0xc7a2('0x137')]);}if(_0x2ede9a[_0xc7a2('0xcb')]){rpcDb[_0xc7a2('0x10c')](_0x2ede9a[_0xc7a2('0x137')]);}ami[_0xc7a2('0x58')](_0xc7a2('0x138'),ut['buildObj'](_0x2ede9a,_0xc7a2('0x139'),this[_0xc7a2('0x12')][_0x2ede9a[_0xc7a2('0x6d')]]));this[_0xc7a2('0xec')](_0x20fb36,_0x283078,_0x53857c);}else{_0x2ede9a['starttime']=moment()[_0xc7a2('0x56')](_0xc7a2('0x130'));ut[_0xc7a2('0xf2')](_0x20fb36,0x4,_0xc7a2('0xb1'));rpcDb['createAgentHistory'](_0x20fb36,_0xc7a2('0x13a'));}}};Preview[_0xc7a2('0xe')][_0xc7a2('0x1c')]=function(_0x2a0c95){var _0x47a563=this;var _0x34a069=this['actions'][_0x2a0c95[_0xc7a2('0xa6')]];var _0x113bcc;if(_0x34a069){_0x113bcc=this['campaignsPreview'][_0x34a069['queue']];logger[_0xc7a2('0x54')](_0xc7a2('0x13b'),_0x2a0c95[_0xc7a2('0xa6')],_0xc7a2('0xab'),_0x113bcc[_0xc7a2('0x27')],'pTalking:\x20',_0x113bcc[_0xc7a2('0x2a')]);}if(this[_0xc7a2('0x15')][_0x2a0c95[_0xc7a2('0xa6')]]&&_0x2a0c95[_0xc7a2('0xa6')]!==_0x2a0c95[_0xc7a2('0xaa')]){if(_0x2a0c95[_0xc7a2('0x13c')]==='16'&&this[_0xc7a2('0x15')][_0x2a0c95['linkedid']][_0xc7a2('0x70')]){this['callProgressDetectingCustomer'](_0x2a0c95,_0x2a0c95['linkedid'],_0x2a0c95['cause']);}else if(this[_0xc7a2('0x15')][_0x2a0c95['linkedid']][_0xc7a2('0x70')]){logger['info'](_0xc7a2('0x13d'),_0x2a0c95[_0xc7a2('0xa6')],_0x2a0c95[_0xc7a2('0x13c')],_0xc7a2('0xab'),_0x113bcc[_0xc7a2('0x27')],_0xc7a2('0x6f'),_0x113bcc[_0xc7a2('0x2a')]);this[_0xc7a2('0x13e')](_0x2a0c95,_0x2a0c95[_0xc7a2('0xa6')],_0x2a0c95[_0xc7a2('0x13c')]);}}else if(_0x34a069&&_[_0xc7a2('0x6b')](_0x34a069['statedesc'])&&_0x113bcc['dialQueueProject']&&_0x2a0c95[_0xc7a2('0xa6')]===_0x2a0c95[_0xc7a2('0xaa')]&&_[_0xc7a2('0x6b')](_0x2a0c95[_0xc7a2('0xef')])&&_0x2a0c95[_0xc7a2('0x13c')]==='16'&&_0x2a0c95[_0xc7a2('0x13f')]==='6'&&_[_0xc7a2('0xed')](_0x34a069[_0xc7a2('0x140')])){if(_0x34a069[_0xc7a2('0xc2')]){rpcDb['unlockContact'](_0x34a069['idContact']);}if(_0x34a069[_0xc7a2('0xcb')]){rpcDb[_0xc7a2('0x10c')](_0x34a069[_0xc7a2('0x137')]);}_0x2a0c95[_0xc7a2('0xef')]='22';this[_0xc7a2('0xec')](_0x34a069,_0x113bcc,_0x2a0c95);}else if(_0x34a069&&_0x34a069[_0xc7a2('0x140')]){if(_0x2a0c95[_0xc7a2('0x13c')]==='16'&&this['actions'][_0x2a0c95[_0xc7a2('0xa6')]][_0xc7a2('0x70')]){logger[_0xc7a2('0x54')](_0xc7a2('0x141'),_0x2a0c95[_0xc7a2('0xa6')],_0x2a0c95[_0xc7a2('0x13c')],_0xc7a2('0xab'),_0x113bcc['name'],'pTalking:\x20',_0x113bcc[_0xc7a2('0x2a')]);this[_0xc7a2('0x13e')](_0x2a0c95,_0x2a0c95[_0xc7a2('0xa6')],_0x2a0c95[_0xc7a2('0x13c')]);}else if(this[_0xc7a2('0x15')][_0x2a0c95[_0xc7a2('0xa6')]]['dialAnswer']){logger['info'](_0xc7a2('0x13d'),_0x2a0c95[_0xc7a2('0xa6')],_0x2a0c95[_0xc7a2('0x13c')],_0xc7a2('0xab'),_0x113bcc[_0xc7a2('0x27')],_0xc7a2('0x6f'),_0x113bcc['pTalking']);this[_0xc7a2('0x13e')](_0x2a0c95,_0x2a0c95[_0xc7a2('0xa6')],_0x2a0c95[_0xc7a2('0x13c')]);}}};Preview[_0xc7a2('0xe')][_0xc7a2('0x20')]=function(_0x1f9e75){if(this[_0xc7a2('0x15')][_0x1f9e75[_0xc7a2('0x142')]]&&_0x1f9e75[_0xc7a2('0x142')]!==_0x1f9e75[_0xc7a2('0x143')]){this[_0xc7a2('0x13e')](_0x1f9e75,_0x1f9e75[_0xc7a2('0x142')],_0x1f9e75[_0xc7a2('0xe3')]);}};Preview[_0xc7a2('0xe')]['syncHangupRequest']=function(_0x17cdcf){if(this[_0xc7a2('0x15')][_0x17cdcf[_0xc7a2('0xa6')]]&&_0x17cdcf['linkedid']!==_0x17cdcf['uniqueid']&&!this[_0xc7a2('0x15')][_0x17cdcf['linkedid']][_0xc7a2('0x70')]){if(_0x17cdcf[_0xc7a2('0x13c')]==='1'){this[_0xc7a2('0x13e')](_0x17cdcf,_0x17cdcf[_0xc7a2('0xa6')],_0x17cdcf['cause']);}}};Preview[_0xc7a2('0xe')][_0xc7a2('0x144')]=function(_0x307b76,_0x422269,_0x5d6e71){if(this[_0xc7a2('0x15')][_0x307b76]){if(_['isNil'](this['actions'][_0x307b76][_0xc7a2('0x145')])){this[_0xc7a2('0x15')][_0x307b76][_0xc7a2('0x145')]={};}this[_0xc7a2('0x15')][_0x307b76][_0xc7a2('0x145')][_0x422269]=_0x5d6e71;}};Preview['prototype'][_0xc7a2('0x23')]=function(_0x38525a){try{if(!_['isNil'](_0x38525a)){if(ut[_0xc7a2('0x146')](_[_0xc7a2('0x147')](_0x38525a['variable'])[0x0])){this[_0xc7a2('0x144')](_0x38525a['uniqueid'],_[_0xc7a2('0x147')](_0x38525a['variable'])[0x0],_0x38525a['value']);}}}catch(_0x2c7b9c){logger['error']('[syncVarSet][Preview]',util[_0xc7a2('0x148')](_0x2c7b9c,{'showHidden':![],'depth':null}));}};Preview[_0xc7a2('0xe')][_0xc7a2('0x149')]=function(_0x52e111){if(_0x52e111){if(this[_0xc7a2('0x15')][_0x52e111[_0xc7a2('0x14a')]]){this['actions'][_0x52e111['transfertargetlinkedid']][_0xc7a2('0x140')]=!![];}}};Preview[_0xc7a2('0xe')][_0xc7a2('0x14b')]=function(_0x8c9c1a){if(_0x8c9c1a){if(this[_0xc7a2('0x15')][_0x8c9c1a[_0xc7a2('0x14c')]]){this[_0xc7a2('0x15')][_0x8c9c1a[_0xc7a2('0x14c')]][_0xc7a2('0x140')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xf72b=['CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectRetryFrequency','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','substring','SIP/%s/%s%s','dialRandomLastDigitCallerIdNumber','getCallerId','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','lookAgent','logLookAgent','clone','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','statedesc','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','destuniqueid','addVariable','variables','syncVarSet','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','bluebird','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','redis','defaults','localhost','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','name','callerid','Interval','stringify','format','voice:queue:%s','info','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','IS_DISACTIVED','\x20is\x20disactive','prototype','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','hasOwnProperty','agentReadyId','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry'];(function(_0xd2aaa8,_0x20108b){var _0x364802=function(_0x467453){while(--_0x467453){_0xd2aaa8['push'](_0xd2aaa8['shift']());}};_0x364802(++_0x20108b);}(_0xf72b,0x1d9));var _0xbf72=function(_0x2129a8,_0x1f81fc){_0x2129a8=_0x2129a8-0x0;var _0x3d98c0=_0xf72b[_0x2129a8];return _0x3d98c0;};'use strict';var util=require(_0xbf72('0x0'));var _=require('lodash');var BPromise=require(_0xbf72('0x1'));var uuid=require('uuid');var moment=require(_0xbf72('0x2'));var md5=require(_0xbf72('0x3'));var Redis=require('ioredis');var config=require(_0xbf72('0x4'));var logger=require(_0xbf72('0x5'))(_0xbf72('0x6'));var loggerAction=require(_0xbf72('0x5'))(_0xbf72('0x7'));var ami=require(_0xbf72('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0xbf72('0x9'));var ut=require(_0xbf72('0xa'));config[_0xbf72('0xb')]=_[_0xbf72('0xc')](config[_0xbf72('0xb')],{'host':_0xbf72('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbf72('0xb')]));var Sequence=function(){};Sequence['prototype'][_0xbf72('0xe')]=function(_0x1f2be0){this['tail']=this[_0xbf72('0xf')]?this[_0xbf72('0xf')][_0xbf72('0x10')](_0x1f2be0):_0x1f2be0();};function Preview(_0x145acb){this[_0xbf72('0x11')]=new Sequence();this[_0xbf72('0x12')]=_0x145acb[_0xbf72('0x13')];this[_0xbf72('0x14')]=_0x145acb['trunks'];this[_0xbf72('0x15')]={};this[_0xbf72('0x16')]=_0x145acb[_0xbf72('0x16')];this['clockClearZombieChannels']=0x0;ami['on'](_0xbf72('0x17'),this['syncOriginateResponse']['bind'](this));ami['on']('hangup',this[_0xbf72('0x18')][_0xbf72('0x19')](this));ami['on'](_0xbf72('0x1a'),this[_0xbf72('0x1b')][_0xbf72('0x19')](this));ami['on'](_0xbf72('0x1c'),this['syncDialEnd'][_0xbf72('0x19')](this));ami['on'](_0xbf72('0x1d'),this[_0xbf72('0x1e')][_0xbf72('0x19')](this));ami['on'](_0xbf72('0x1f'),this['syncVarSet']['bind'](this));ami['on'](_0xbf72('0x20'),this[_0xbf72('0x21')][_0xbf72('0x19')](this));ami['on'](_0xbf72('0x22'),this[_0xbf72('0x23')][_0xbf72('0x19')](this));this[_0xbf72('0x24')](this['campaignsPreview']);}function emit(_0x2aecae,_0x42a193,_0xcd9c0b){io['to'](_0x2aecae)[_0xbf72('0x25')](_0x42a193,_0xcd9c0b);}function emitCampaignPreview(_0x3486f3){if(_0x3486f3['type']===_0xbf72('0x26')){var _0x1de926={'id':_0x3486f3['id'],'name':_0x3486f3['name'],'strategy':_0x3486f3[_0xbf72('0x27')],'answered':_0x3486f3[_0xbf72('0x28')],'available':_0x3486f3[_0xbf72('0x29')],'loggedIn':_0x3486f3['loggedIn'],'pTalking':_0x3486f3[_0xbf72('0x2a')],'sumBillable':_0x3486f3[_0xbf72('0x2b')],'sumDuration':_0x3486f3[_0xbf72('0x2c')],'sumHoldTime':_0x3486f3[_0xbf72('0x2d')]||0x0,'talking':_0x3486f3['talking'],'total':_0x3486f3[_0xbf72('0x2e')],'type':_0x3486f3[_0xbf72('0x2f')],'unmanaged':_0x3486f3[_0xbf72('0x30')],'abandoned':_0x3486f3['abandoned'],'waiting':_0x3486f3[_0xbf72('0x31')],'loggedInDb':_0x3486f3[_0xbf72('0x32')],'dialActive':_0x3486f3[_0xbf72('0x33')],'dialMethod':_0x3486f3[_0xbf72('0x34')],'dialOriginateCallerIdName':_0x3486f3[_0xbf72('0x35')],'dialOriginateCallerIdNumber':_0x3486f3[_0xbf72('0x36')],'dialOriginateTimeout':_0x3486f3[_0xbf72('0x37')],'dialPrefix':_0x3486f3[_0xbf72('0x38')],'outboundAnswerAgiCallsDay':_0x3486f3[_0xbf72('0x39')],'outboundAnswerCallsDay':_0x3486f3[_0xbf72('0x3a')],'outboundBlacklistCallsDay':_0x3486f3[_0xbf72('0x3b')],'outboundBusyCallsDay':_0x3486f3[_0xbf72('0x3c')],'outboundCongestionCallsDay':_0x3486f3[_0xbf72('0x3d')],'outboundDropCallsDayACS':_0x3486f3[_0xbf72('0x3e')],'outboundDropCallsDayCallersExit':_0x3486f3[_0xbf72('0x3f')],'outboundDropCallsDayTimeout':_0x3486f3['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3486f3[_0xbf72('0x40')],'outboundNoSuchCallsDay':_0x3486f3[_0xbf72('0x41')],'outboundOriginateFailureCallsDay':_0x3486f3[_0xbf72('0x42')],'outboundReCallsDay':_0x3486f3[_0xbf72('0x43')],'outboundRejectCallsDay':_0x3486f3[_0xbf72('0x44')],'outboundUnknownCallsDay':_0x3486f3[_0xbf72('0x45')],'outboundAbandonedCallsDay':_0x3486f3[_0xbf72('0x46')],'predictiveIntervalAnsweredCalls':_0x3486f3[_0xbf72('0x47')],'predictiveIntervalAvgHoldtime':_0x3486f3[_0xbf72('0x48')],'predictiveIntervalAvgTalktime':_0x3486f3[_0xbf72('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x3486f3[_0xbf72('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x3486f3[_0xbf72('0x4b')],'predictiveIntervalErlangCalls':_0x3486f3[_0xbf72('0x4c')],'predictiveIntervalErlangCallsDroppedCalls':_0x3486f3[_0xbf72('0x4d')],'predictiveIntervalHitRate':_0x3486f3['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3486f3[_0xbf72('0x4e')],'predictiveIntervalPauses':_0x3486f3[_0xbf72('0x4f')],'predictiveIntervalAvailable':_0x3486f3[_0xbf72('0x50')],'predictiveIntervalTotalCalls':_0x3486f3['predictiveIntervalTotalCalls'],'message':_0x3486f3['message'],'originated':_0x3486f3['originated'],'erlangCalls':_0x3486f3[_0xbf72('0x51')],'erlangCallToSecond':_0x3486f3[_0xbf72('0x52')],'erlangAbandonmentRate':_0x3486f3[_0xbf72('0x53')],'erlangBusyFactor':_0x3486f3['erlangBusyFactor'],'startPredictive':_0x3486f3[_0xbf72('0x54')],'startProgressive':_0x3486f3[_0xbf72('0x55')]};if(_0x3486f3['Trunk']){_0x1de926[_0xbf72('0x56')]={'id':_0x3486f3['Trunk']['id'],'name':_0x3486f3[_0xbf72('0x56')][_0xbf72('0x57')],'active':_0x3486f3['Trunk']['active'],'callerid':_0x3486f3[_0xbf72('0x56')][_0xbf72('0x58')]};}if(_0x3486f3[_0xbf72('0x59')]){_0x1de926[_0xbf72('0x59')]={'id':_0x3486f3[_0xbf72('0x59')]['id'],'name':_0x3486f3[_0xbf72('0x59')][_0xbf72('0x57')]};}var _0x19b5ba=md5(JSON[_0xbf72('0x5a')](_0x1de926));if(_0x3486f3['md5']!==_0x19b5ba){_0x3486f3[_0xbf72('0x3')]=_0x19b5ba;emit(util[_0xbf72('0x5b')](_0xbf72('0x5c'),_0x1de926[_0xbf72('0x57')]),'voice_queue:save',_0x1de926);}}}function emitVoiceQueueChannelRemove(_0xd0a1a8){logger[_0xbf72('0x5d')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xbf72('0x5a')](_0xd0a1a8));emit(util['format']('voice:queue:%s',_0xd0a1a8['name']),'voice_queue_channel:remove',_0xd0a1a8);io[_0xbf72('0x25')]('voice_queue_presence:remove',_0xd0a1a8);}function notSendMessagesQueue(_0x5e6749){if(_0x5e6749[_0xbf72('0x5e')]){if(_0x5e6749['originated']===0x0&&_0x5e6749[_0xbf72('0x2a')]===0x0){_0x5e6749[_0xbf72('0x5e')]=![];_0x5e6749['available']=0x0;_0x5e6749[_0xbf72('0x5f')]=0x0;_0x5e6749['message']='NOT_ACTIVE';ut[_0xbf72('0x60')](_0xbf72('0x61'),_0x5e6749[_0xbf72('0x57')]+_0xbf72('0x62'));}else{_0x5e6749[_0xbf72('0x63')]=_0xbf72('0x64');ut[_0xbf72('0x60')](_0xbf72('0x61'),_0x5e6749['name']+_0xbf72('0x65'));}emitCampaignPreview(_0x5e6749);}}Preview[_0xbf72('0x66')]['loopCampaigns']=function(){var _0x45dc3a=this;setInterval(function(){_0x45dc3a['syncCampaigns']();},0x7cf);};Preview['prototype'][_0xbf72('0x67')]=function(){var _0x15e4c7=this[_0xbf72('0x12')];this[_0xbf72('0x68')]+=0x1;for(var _0x165557 in _0x15e4c7){if(_0x15e4c7['hasOwnProperty'](_0x165557)&&(_0x15e4c7[_0x165557]['dialMethod']==='preview'||_0x15e4c7[_0x165557][_0xbf72('0x34')]===_0xbf72('0x69'))&&_0x15e4c7[_0x165557][_0xbf72('0x2f')]===_0xbf72('0x26')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xbf72('0x6a')]();}}if(_0x15e4c7['hasOwnProperty'](_0x165557)&&_0x15e4c7[_0x165557][_0xbf72('0x34')]===_0xbf72('0x6')&&_0x15e4c7[_0x165557][_0xbf72('0x2f')]===_0xbf72('0x26')){if(_0x15e4c7[_0x165557]['dialActive']){this[_0xbf72('0x6b')](_0x15e4c7[_0x165557]);this[_0xbf72('0x6c')](_0x15e4c7[_0x165557]);}else{notSendMessagesQueue(_0x15e4c7[_0x165557]);}}}};Preview[_0xbf72('0x66')][_0xbf72('0x6d')]=function(_0x560355){var _0x1bcac8=this;this[_0xbf72('0x11')]['enqueue'](function(){if(!_[_0xbf72('0x6e')](_0x1bcac8[_0xbf72('0x15')][_0x560355])){loggerAction[_0xbf72('0x5d')](_0xbf72('0x6f'),_0x560355,_0xbf72('0x70'),_0x1bcac8[_0xbf72('0x15')][_0x560355][_0xbf72('0x71')],'originated:\x20',JSON['stringify'](_0x1bcac8['campaignsPreview'][_0x1bcac8[_0xbf72('0x15')][_0x560355]['queue']][_0xbf72('0x72')]),'pTalking:\x20',JSON['stringify'](_0x1bcac8['campaignsPreview'][_0x1bcac8[_0xbf72('0x15')][_0x560355][_0xbf72('0x71')]][_0xbf72('0x2a')]),JSON[_0xbf72('0x5a')](_0x1bcac8[_0xbf72('0x15')][_0x560355][_0xbf72('0x73')]),JSON['stringify'](_[_0xbf72('0x74')](_0x1bcac8['actions'][_0x560355],[_0xbf72('0x75'),'UserId',_0xbf72('0x76'),_0xbf72('0x77')])));return ami[_0xbf72('0x78')]({'action':_0xbf72('0x79'),'channel':_0x1bcac8[_0xbf72('0x15')][_0x560355][_0xbf72('0x7a')]})[_0xbf72('0x7b')](function(_0x176a59){if(_0x176a59[_0xbf72('0x63')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1bcac8[_0xbf72('0x15')][_0x560355]){ut[_0xbf72('0x7c')](_0x1bcac8[_0xbf72('0x12')][_0x1bcac8['actions'][_0x560355][_0xbf72('0x71')]],_0xbf72('0x7d'));if(_0x1bcac8[_0xbf72('0x15')][_0x560355][_0xbf72('0x73')]===!![]){ut[_0xbf72('0x7e')](_0x1bcac8['campaignsPreview'][_0x1bcac8[_0xbf72('0x15')][_0x560355][_0xbf72('0x71')]],'[clearZombieChannel]');ut[_0xbf72('0x7f')]('[Dialer][checkChannel][pTalking][Preview]'+_0x560355,_0x1bcac8['actions'][_0x560355][_0xbf72('0x71')]);}ut[_0xbf72('0x7f')](_0xbf72('0x80')+_0x560355,_0x1bcac8[_0xbf72('0x15')][_0x560355][_0xbf72('0x71')]);delete _0x1bcac8['actions'][_0x560355];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x208c63=this;loggerAction[_0xbf72('0x5d')](_0xbf72('0x81'),_[_0xbf72('0x82')](this['actions']));for(var _0x5e2f01 in this[_0xbf72('0x15')]){if(_0x208c63[_0xbf72('0x15')][_0xbf72('0x83')](_0x5e2f01)){_0x208c63['clearZombieChannel'](_0x5e2f01);}}};Preview[_0xbf72('0x66')]['recallMe']=function(_0x24ede7){var _0x3da80c=this;rpcDb['getContactRecallMe'](_0x24ede7['id'],ut[_0xbf72('0x84')](this[_0xbf72('0x16')]))['then'](function(_0x3c3e31){if(!_[_0xbf72('0x6e')](_0x3c3e31)){for(var _0xa50217=0x0;_0xa50217<_0x3c3e31['length'];_0xa50217+=0x1){if(ut['getDiff'](_0x3c3e31[_0xa50217]['scheduledat'])<_0x24ede7[_0xbf72('0x85')]*0x3c){if(_0x3c3e31[_0xa50217][_0xbf72('0x86')]&&!_0x3c3e31[_0xa50217][_0xbf72('0x86')][_0xbf72('0x87')]){_0x3da80c[_0xbf72('0x88')](_0x3c3e31[_0xa50217]['id'])[_0xbf72('0x89')](ut[_0xbf72('0x8a')](_0xbf72('0x8b')))[_0xbf72('0x7b')](ut['logger2'](_0xbf72('0x8b')));}else{rpcDb[_0xbf72('0x8c')](_0x3c3e31[_0xa50217]['id']);}}else{var _0x581110=new Action(_0x3c3e31[_0xa50217],_0x24ede7);_0x581110[_0xbf72('0x8d')]=moment()[_0xbf72('0x5b')](_0xbf72('0x8e'));_0x24ede7[_0xbf72('0x43')]+=0x1;ut[_0xbf72('0x8f')](_0x581110,0x17,_0xbf72('0x90'));if(_0x24ede7[_0xbf72('0x91')]){rpcDb[_0xbf72('0x92')](ut[_0xbf72('0x93')](_0x3c3e31[_0xa50217]));rpcDb['createCustomerHistory'](_0x581110,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xbf72('0x8f')](_0x581110,0x16,_0xbf72('0x94'));rpcDb[_0xbf72('0x95')](_0x581110,_0xbf72('0x96'));rpcDb[_0xbf72('0x97')](_0x581110,_0xbf72('0x96'));}}}}})[_0xbf72('0x7b')](ut[_0xbf72('0x8a')]('[getContactRecallMe]'));};Preview[_0xbf72('0x66')][_0xbf72('0x6b')]=function(_0x3fe70d){_0x3fe70d[_0xbf72('0x5e')]=!![];if(ut[_0xbf72('0x98')](_0x3fe70d[_0xbf72('0x99')])){_0x3fe70d[_0xbf72('0x63')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xbf72('0x9a')](_0x3fe70d[_0xbf72('0x33')])){_0x3fe70d[_0xbf72('0x63')]=_0xbf72('0x9b');}else if(!this[_0xbf72('0x9c')](_0x3fe70d[_0xbf72('0x56')])){if(!this[_0xbf72('0x9c')](_0x3fe70d[_0xbf72('0x9d')])){_0x3fe70d['message']=_0xbf72('0x9e');}else{_0x3fe70d[_0xbf72('0x63')]=_0xbf72('0x9f');}}else{_0x3fe70d['message']=_0xbf72('0x9f');}emitCampaignPreview(_0x3fe70d);};Preview[_0xbf72('0x66')]['callProgressDetectingCustomer']=function(_0x143b0b,_0x287198,_0x5c8b1e){var _0x2b8e26=this;var _0x36f101=this['actions'][_0x287198];var _0x39f734=this[_0xbf72('0x12')][_0x36f101[_0xbf72('0x71')]];var _0x4547d9;if(_0x39f734){switch(_0x5c8b1e){case'1':_0x39f734[_0xbf72('0x41')]+=0x1;_0x36f101[_0xbf72('0xa0')]+=0x1;_0x36f101[_0xbf72('0xa1')]=ut['totalGlobal'](_0x36f101);ut[_0xbf72('0x8f')](_0x36f101,0x0,_0xbf72('0xa2'));ami['emit'](_0xbf72('0xa3'),ut['buildObj'](_0x36f101,'nosuchnumber'));rpcDb[_0xbf72('0x95')](_0x36f101,_0xbf72('0xa4'));if(ut[_0xbf72('0xa5')](_0x36f101)>=_0x39f734[_0xbf72('0xa6')]){_0x4547d9=ut[_0xbf72('0xa7')](_0x36f101,0xf,_0xbf72('0xa8'));rpcDb['createCustomerFinal'](_0x4547d9,_0xbf72('0xa9'));}else{if(_0x36f101[_0xbf72('0xa0')]>=_0x39f734[_0xbf72('0xaa')]){rpcDb[_0xbf72('0x97')](_0x36f101,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xbf72('0xab')](ut[_0xbf72('0xac')](_0x36f101,_0xbf72('0xa0'),_0x39f734[_0xbf72('0xad')]),_0x36f101['unlockAgent'],_0x36f101[_0xbf72('0xae')]);}}delete this['actions'][_0x143b0b[_0xbf72('0xaf')]];break;case _0xbf72('0xb0'):var _0xe1d4ae=moment()['format'](_0xbf72('0x8e'));_0x36f101[_0xbf72('0xb1')]=_0xe1d4ae;_0x36f101[_0xbf72('0xb2')]=_0xe1d4ae;_0x36f101[_0xbf72('0x73')]=!![];_0x39f734[_0xbf72('0x2a')]+=0x1;logger[_0xbf72('0x5d')](_0xbf72('0xb3'),_0x36f101[_0xbf72('0xb4')],_0xbf72('0xb5'),_0x39f734[_0xbf72('0x57')],_0xbf72('0xb6'),_0x39f734[_0xbf72('0x2a')]);ami['emit'](_0xbf72('0xb7'),ut[_0xbf72('0xb8')](_0x36f101,_0xbf72('0xb9'),this['campaignsPreview'][_0x36f101[_0xbf72('0x71')]]));if(_0x39f734['acw']){ami[_0xbf72('0x25')](_0xbf72('0xba'),ut[_0xbf72('0xbb')](_0x36f101));}break;case'16':ami[_0xbf72('0x25')](_0xbf72('0xbc'),ut[_0xbf72('0xb8')](_0x36f101,'complete',this[_0xbf72('0x12')][_0x36f101['queue']]));emitVoiceQueueChannelRemove(ut[_0xbf72('0xb8')](_0x36f101,'complete'));_0x39f734[_0xbf72('0x3a')]+=0x1;_0x39f734[_0xbf72('0x2e')]+=0x1;_0x39f734[_0xbf72('0x28')]+=0x1;ut[_0xbf72('0x7e')](_0x39f734,_0xbf72('0xbd'));_0x36f101[_0xbf72('0xa1')]=ut[_0xbf72('0xa5')](_0x36f101);ut[_0xbf72('0x8f')](_0x36f101,0x4,_0xbf72('0xbe'));rpcDb[_0xbf72('0x95')](_0x36f101,_0xbf72('0xbf'));rpcDb[_0xbf72('0x97')](_0x36f101,_0xbf72('0xc0'));rpcDb[_0xbf72('0xc1')](_0x36f101);_0x39f734[_0xbf72('0x2c')]+=_0x36f101['talktime'];_0x39f734['sumBillable']+=_0x36f101[_0xbf72('0xc2')];logger['info'](_0xbf72('0xc3'),_0x36f101[_0xbf72('0xb4')],'\x20Queue',_0x39f734[_0xbf72('0x57')],_0xbf72('0xb6'),_0x39f734[_0xbf72('0x2a')]);delete this['actions'][_0x143b0b[_0xbf72('0xaf')]];break;case'BUSY':_0x39f734[_0xbf72('0x3c')]+=0x1;_0x36f101[_0xbf72('0xc4')]+=0x1;_0x36f101['countglobal']=ut[_0xbf72('0xa5')](_0x36f101);ut[_0xbf72('0x8f')](_0x36f101,0x5,_0xbf72('0xc5'));ami[_0xbf72('0x25')](_0xbf72('0xc6'),ut[_0xbf72('0xb8')](_0x36f101,_0xbf72('0xc7')));rpcDb[_0xbf72('0x95')](_0x36f101,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x36f101)>=_0x39f734[_0xbf72('0xa6')]){_0x4547d9=ut[_0xbf72('0xa7')](_0x36f101,0xf,_0xbf72('0xa8'));rpcDb['createCustomerFinal'](_0x4547d9,_0xbf72('0xc8'));}else{if(_0x36f101['countbusyretry']>=_0x39f734[_0xbf72('0xc9')]){rpcDb['createCustomerFinal'](_0x36f101,_0xbf72('0xca'));}else{rpcDb[_0xbf72('0xab')](ut[_0xbf72('0xac')](_0x36f101,'countbusyretry',_0x39f734[_0xbf72('0xcb')]),_0x36f101[_0xbf72('0xcc')],_0x36f101['activeContact']);}}break;case _0xbf72('0xcd'):_0x39f734['outboundNoAnswerCallsDay']+=0x1;_0x36f101[_0xbf72('0xce')]+=0x1;_0x36f101[_0xbf72('0xa1')]=ut[_0xbf72('0xa5')](_0x36f101);ut[_0xbf72('0x8f')](_0x36f101,0x3,_0xbf72('0xcf'));ami[_0xbf72('0x25')]('custom:agentnoanswer',ut[_0xbf72('0xb8')](_0x36f101,_0xbf72('0xd0')));rpcDb[_0xbf72('0x95')](_0x36f101,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xbf72('0xa5')](_0x36f101)>=_0x39f734[_0xbf72('0xa6')]){_0x4547d9=ut['cloneAction'](_0x36f101,0xf,'Global');rpcDb['createCustomerFinal'](_0x4547d9,_0xbf72('0xd1'));}else{if(_0x36f101[_0xbf72('0xce')]>=_0x39f734[_0xbf72('0xd2')]){rpcDb[_0xbf72('0x97')](_0x36f101,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xbf72('0xab')](ut['scheduledAt'](_0x36f101,_0xbf72('0xce'),_0x39f734[_0xbf72('0xd3')]),_0x36f101[_0xbf72('0xcc')],_0x36f101['activeContact']);}}break;case _0xbf72('0xd4'):_0x39f734['outboundCongestionCallsDay']+=0x1;_0x36f101[_0xbf72('0xd5')]+=0x1;_0x36f101[_0xbf72('0xa1')]=ut[_0xbf72('0xa5')](_0x36f101);ut['logCustomer'](_0x36f101,0x8,_0xbf72('0xd6'));ami['emit']('custom:agentcongestion',ut[_0xbf72('0xb8')](_0x36f101,_0xbf72('0xd7')));rpcDb['createCustomerHistory'](_0x36f101,_0xbf72('0xd8'));if(ut[_0xbf72('0xa5')](_0x36f101)>=_0x39f734['dialGlobalMaxRetry']){_0x4547d9=ut['cloneAction'](_0x36f101,0xf,_0xbf72('0xa8'));rpcDb[_0xbf72('0x97')](_0x4547d9,_0xbf72('0xd9'));}else{if(_0x36f101['countcongestionretry']>=_0x39f734[_0xbf72('0xda')]){rpcDb[_0xbf72('0x97')](_0x36f101,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xbf72('0xab')](ut['scheduledAt'](_0x36f101,_0xbf72('0xd5'),_0x39f734[_0xbf72('0xcb')]),_0x36f101['unlockAgent'],_0x36f101[_0xbf72('0xae')]);}}break;case _0xbf72('0xdb'):_0x39f734[_0xbf72('0x44')]+=0x1;_0x36f101['countagentrejectretry']+=0x1;_0x36f101[_0xbf72('0xa1')]=ut[_0xbf72('0xa5')](_0x36f101);ut[_0xbf72('0x8f')](_0x36f101,0x14,_0xbf72('0xdc'));ami['emit'](_0xbf72('0xdd'),ut[_0xbf72('0xb8')](_0x36f101,_0xbf72('0xde')));rpcDb[_0xbf72('0x95')](_0x36f101,_0xbf72('0xdf'));if(ut[_0xbf72('0xa5')](_0x36f101)>=_0x39f734[_0xbf72('0xa6')]){_0x4547d9=ut['cloneAction'](_0x36f101,0x14,_0xbf72('0xdc'));rpcDb['createCustomerFinal'](_0x4547d9,_0xbf72('0xe0'));}else{if(_0x36f101[_0xbf72('0xe1')]>=_0x39f734['dialAgentRejectMaxRetry']){rpcDb[_0xbf72('0x97')](_0x36f101,_0xbf72('0xe0'));}else{rpcDb[_0xbf72('0xab')](ut['scheduledAt'](_0x36f101,_0xbf72('0xe1'),_0x39f734[_0xbf72('0xe2')]),_0x36f101['unlockAgent'],_0x36f101[_0xbf72('0xae')]);}}break;case'ABANDONED':_0x39f734[_0xbf72('0x46')]+=0x1;_0x36f101['countabandonedretry']+=0x1;_0x36f101[_0xbf72('0xa1')]=ut[_0xbf72('0xa5')](_0x36f101);ut[_0xbf72('0x8f')](_0x36f101,0xb,_0xbf72('0xe3'));rpcDb[_0xbf72('0x95')](_0x36f101,_0xbf72('0xe4'));if(ut[_0xbf72('0xa5')](_0x36f101)>=_0x39f734[_0xbf72('0xa6')]){_0x4547d9=ut[_0xbf72('0xa7')](_0x36f101,0xf,_0xbf72('0xa8'));rpcDb[_0xbf72('0x97')](_0x4547d9,_0xbf72('0xe4'));}else{if(_0x36f101[_0xbf72('0xe5')]>=_0x39f734[_0xbf72('0xe6')]){rpcDb[_0xbf72('0x97')](_0x36f101,_0xbf72('0xe4'));}else{rpcDb[_0xbf72('0xab')](ut['scheduledAt'](_0x36f101,'countabandonedretry',_0x39f734[_0xbf72('0xe7')]),_0x36f101[_0xbf72('0xcc')],_0x36f101['activeContact']);}}break;case'18':_0x39f734[_0xbf72('0x45')]+=0x1;_0x36f101[_0xbf72('0xe8')]+=0x1;_0x36f101['countglobal']=ut[_0xbf72('0xa5')](_0x36f101);ut['logCustomer'](_0x36f101,0x12,_0x143b0b['cause-txt']||_0x143b0b['dialstatus']);ami[_0xbf72('0x25')]('custom:amd',ut['buildObj'](_0x36f101,_0xbf72('0xe9')));rpcDb[_0xbf72('0x95')](_0x36f101,_0xbf72('0xea'));if(ut[_0xbf72('0xa5')](_0x36f101)>=_0x39f734[_0xbf72('0xa6')]){_0x4547d9=ut[_0xbf72('0xa7')](_0x36f101,0xf,_0xbf72('0xa8'));rpcDb[_0xbf72('0x97')](_0x4547d9,_0xbf72('0xea'));}else{rpcDb[_0xbf72('0x97')](_0x36f101,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xbf72('0x15')][_0x143b0b[_0xbf72('0xaf')]];break;case'19':_0x39f734[_0xbf72('0x45')]+=0x1;_0x36f101['countglobal']=ut[_0xbf72('0xa5')](_0x36f101);ut[_0xbf72('0x8f')](_0x36f101,0x13,_0x143b0b[_0xbf72('0xeb')]||_0x143b0b[_0xbf72('0xec')]);ami['emit'](_0xbf72('0xed'),ut[_0xbf72('0xb8')](_0x36f101,_0xbf72('0xe9')));rpcDb[_0xbf72('0x95')](_0x36f101,'[callProgressDetectingCustomer][machine]');if(ut[_0xbf72('0xa5')](_0x36f101)>=_0x39f734[_0xbf72('0xa6')]){_0x4547d9=ut[_0xbf72('0xa7')](_0x36f101,0xf,_0xbf72('0xa8'));rpcDb[_0xbf72('0x97')](_0x4547d9,_0xbf72('0xee'));}else{rpcDb['createCustomerFinal'](_0x36f101,'[callProgressDetectingCustomer][machine]');}delete this[_0xbf72('0x15')][_0x143b0b[_0xbf72('0xaf')]];break;default:if(_0x36f101[_0xbf72('0x73')]){ut['decrementTalkink'](_0x39f734,_0xbf72('0xef'));ut[_0xbf72('0x7f')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x39f734[_0xbf72('0x57')],_0x143b0b);}_0x39f734[_0xbf72('0x45')]+=0x1;_0x36f101['countglobal']=ut[_0xbf72('0xa5')](_0x36f101);ut[_0xbf72('0x8f')](_0x36f101,0xc,_0x143b0b['cause-txt']||_0x143b0b['dialstatus']);rpcDb[_0xbf72('0x95')](_0x36f101,_0xbf72('0xf0'));if(ut[_0xbf72('0xa5')](_0x36f101)>=_0x39f734[_0xbf72('0xa6')]){_0x4547d9=ut['cloneAction'](_0x36f101,0xf,_0xbf72('0xa8'));rpcDb[_0xbf72('0x97')](_0x4547d9,_0xbf72('0xf1'));}else{rpcDb['createCustomerFinal'](_0x36f101,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x143b0b[_0xbf72('0xaf')]];}if(!(_0x36f101[_0xbf72('0x73')]&&_0x5c8b1e==='16')){ut[_0xbf72('0x7c')](_0x39f734,_0xbf72('0xf2'));logger['info'](_0xbf72('0xf3'),_0x36f101[_0xbf72('0xb4')],_0xbf72('0xb5'),_0x39f734[_0xbf72('0x57')],_0xbf72('0xf4'),_0x39f734[_0xbf72('0x72')]);}if(_0x5c8b1e!==_0xbf72('0xb0')){delete this[_0xbf72('0x15')][_0x143b0b[_0xbf72('0xaf')]];delete this[_0xbf72('0x15')][_0x143b0b['destlinkedid']];}}};Preview[_0xbf72('0x66')][_0xbf72('0xf5')]=function(_0x1f55af,_0x5d38bd,_0x542b64){if(_['isUndefined'](_0x5d38bd)&&_0xbf72('0xf6')!==typeof _0x5d38bd){return;}if(_[_0xbf72('0xf7')](_0x542b64)&&_0xbf72('0xf6')!==typeof _0x542b64){return;}switch(_0x542b64[_0xbf72('0xf8')]){case'0':ut[_0xbf72('0xf9')](_0x1f55af,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x1f55af,_0xbf72('0xfa'));break;case'3':ut[_0xbf72('0xf9')](_0x1f55af,0x3,_0xbf72('0xcf'));rpcDb[_0xbf72('0xfb')](_0x1f55af,_0xbf72('0xfc'));break;case'5':ut[_0xbf72('0xf9')](_0x1f55af,0x5,_0xbf72('0xc5'));rpcDb[_0xbf72('0xfb')](_0x1f55af,_0xbf72('0xfd'));break;case'8':ut[_0xbf72('0xf9')](_0x1f55af,0x8,_0xbf72('0xd6'));rpcDb['createAgentHistory'](_0x1f55af,_0xbf72('0xfe'));break;case'22':ut['logAgent'](_0x1f55af,0x16,_0xbf72('0xff'));rpcDb[_0xbf72('0xfb')](_0x1f55af,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xbf72('0xf9')](_0x1f55af,0xc,_0x542b64['reason']);rpcDb[_0xbf72('0xfb')](_0x1f55af,_0xbf72('0xfe'));}ut['updateOriginated'](_0x5d38bd,_0xbf72('0x100'));logger[_0xbf72('0x5d')](_0xbf72('0x101'),_0x1f55af[_0xbf72('0xb4')],'\x20Queue',_0x5d38bd['name'],_0xbf72('0xf4'),_0x5d38bd[_0xbf72('0x72')]);delete this[_0xbf72('0x15')][_0x1f55af[_0xbf72('0xb4')]];};Preview[_0xbf72('0x66')][_0xbf72('0x102')]=function(_0x227c7f,_0x2bef83,_0x3f5c83,_0x1b59a5,_0xbeac16){var _0x27c6a3=this;return new BPromise(function(_0x1306b9,_0x3525fd){if(_['isNil'](_0x2bef83)||_[_0xbf72('0x6e')](_0x2bef83['Contact'])||_[_0xbf72('0x6e')](_0x2bef83[_0xbf72('0x103')][_0xbf72('0x104')])||_['isNil'](_0x2bef83[_0xbf72('0x76')])){_0x3525fd(ut[_0xbf72('0x63')](_0xbf72('0x105'),_0x1b59a5,_0xbeac16));return;}var _0x314034=uuid['v4']();var _0x15b22e=_0x27c6a3['campaignsPreview'][_0x2bef83[_0xbf72('0x70')][_0xbf72('0x57')]];var _0x331294=_0x3f5c83?_0x27c6a3[_0xbf72('0x16')][_0x3f5c83]['id']:undefined;_0x27c6a3[_0xbf72('0x15')][_0x314034]=new Action(_0x2bef83,_0x15b22e,_0x314034,_0x3f5c83,_0x331294);var _0x20eb63=_0x27c6a3['actions'][_0x314034];_0x20eb63[_0xbf72('0xcc')]=_0x1b59a5;_0x20eb63['activeContact']=_0xbeac16;_0x20eb63['lookAgent']=_0x3f5c83;if(_[_0xbf72('0x106')](_0x227c7f)){_0x27c6a3[_0xbf72('0x107')](_0x20eb63,_0x15b22e,_0x2bef83,_0x3f5c83)[_0xbf72('0x89')](function(_0x5160c4){logger['info']('[Preview][execCall][success]',_0xbf72('0x108')+_0x20eb63[_0xbf72('0x71')]+_0xbf72('0x109')+_0x20eb63[_0xbf72('0x10a')],JSON[_0xbf72('0x5a')](_0x5160c4));ami[_0xbf72('0x25')](_0xbf72('0x10b'),ut[_0xbf72('0xb8')](_0x20eb63,_0xbf72('0x10c'),_0x27c6a3[_0xbf72('0x12')][_0x20eb63[_0xbf72('0x71')]]));_0x1306b9(ut['message'](_0xbf72('0x10d')));})[_0xbf72('0x7b')](function(_0x15f8f4){ut['logger']('[Preview][execCall][failure]',_0x15f8f4);_0x3525fd(ut[_0xbf72('0x63')]('Call\x20failed',_0x1b59a5,_0xbeac16));});}else{_0x15b22e[_0xbf72('0x3b')]+=0x1;ut[_0xbf72('0x10e')](_0x20eb63);rpcDb[_0xbf72('0x10f')](_0x20eb63,_0xbf72('0x110'));delete _0x27c6a3[_0xbf72('0x15')][_0x314034];_0x3525fd(ut['message'](_0xbf72('0x111'),_0x1b59a5,_0xbeac16));}});};Preview['prototype'][_0xbf72('0x9c')]=function(_0x58ebcb){return!_[_0xbf72('0x6e')](_0x58ebcb)&&!_[_0xbf72('0x6e')](_0x58ebcb['name'])&&!_[_0xbf72('0x6e')](_0x58ebcb['active'])&&_0x58ebcb[_0xbf72('0x112')]&&!_[_0xbf72('0x6e')](this[_0xbf72('0x14')][util['format'](_0xbf72('0x113'),_0x58ebcb['name'])])&&!_[_0xbf72('0x6e')](this[_0xbf72('0x14')][util[_0xbf72('0x5b')]('SIP/%s',_0x58ebcb[_0xbf72('0x57')])]['status'])&&(this[_0xbf72('0x14')][util[_0xbf72('0x5b')]('SIP/%s',_0x58ebcb[_0xbf72('0x57')])][_0xbf72('0x79')]===_0xbf72('0x114')||this[_0xbf72('0x14')][util[_0xbf72('0x5b')](_0xbf72('0x113'),_0x58ebcb[_0xbf72('0x57')])][_0xbf72('0x79')]===_0xbf72('0x115'));};Preview[_0xbf72('0x66')][_0xbf72('0x88')]=function(_0x1d257a,_0x1cc0fd){var _0x50d12a=this;return new BPromise(function(_0x57eb75,_0x46eec9){_0x50d12a['execRun'](_0x1d257a,_0x1cc0fd)[_0xbf72('0x89')](function(_0x481e62){_0x57eb75(_['pick'](_0x481e62,[_0xbf72('0x63')]));})[_0xbf72('0x7b')](function(_0x3122e6){if(_0x3122e6[_0xbf72('0x116')]){rpcDb[_0xbf72('0x117')](_0x1d257a);}if(_0x3122e6[_0xbf72('0x112')]){rpcDb['disableContact'](_0x1d257a);}_0x46eec9(_[_0xbf72('0x74')](_0x3122e6,[_0xbf72('0x63')]));});});};Preview[_0xbf72('0x66')]['execRun']=function(_0x3bdea6,_0x3ff87c){var _0x493181=this;return new BPromise(function(_0x18a4b1,_0x5ec206){var _0x25bd38,_0x383749;rpcDb[_0xbf72('0x118')](_0x3bdea6)[_0xbf72('0x89')](function(_0x3d2574){if(!_[_0xbf72('0x6e')](_0x3d2574[0x0])){_0x383749=_0x3d2574[0x0][_0xbf72('0x119')]?![]:!![];_0x25bd38=_0x3d2574[0x0][_0xbf72('0x119')]?!![]:![];_0x25bd38=_0x3ff87c?!![]:_0x25bd38;}var _0x7e2913=_0x493181[_0xbf72('0x11a')](_0x3d2574);if(_0x7e2913[_0xbf72('0x11b')]){rpcDb[_0xbf72('0x11c')](_[_0xbf72('0x74')](_0x3d2574[0x0],[_0xbf72('0x76'),_0xbf72('0x11d')]))['then'](function(_0xefd730){_0x493181['checkInBlack'](_0xefd730,_0x3d2574[0x0],_0x3ff87c,_0x383749,_0x25bd38)[_0xbf72('0x89')](function(_0x3c3bf9){_0x18a4b1(_0x3c3bf9);})[_0xbf72('0x7b')](function(_0x3998ea){_0x5ec206(_0x3998ea);});})[_0xbf72('0x7b')](function(_0xca9907){ut[_0xbf72('0x60')](_0xbf72('0x11e'),_0xca9907);_0x5ec206(ut[_0xbf72('0x63')](_0xbf72('0x11f'),_0x383749,_0x25bd38));});}else{_0x5ec206(ut[_0xbf72('0x63')](_0x7e2913[_0xbf72('0x63')],_0x383749,_0x25bd38));}})[_0xbf72('0x7b')](function(_0x38e14e){ut[_0xbf72('0x60')](_0xbf72('0x120'),_0x38e14e);_0x5ec206(ut[_0xbf72('0x63')](_0xbf72('0x11f'),![],!![]));});});};Preview['prototype'][_0xbf72('0x11a')]=function(_0x3ce6f5){if(_[_0xbf72('0x6e')](_0x3ce6f5)||_[_0xbf72('0x106')](_0x3ce6f5)||!_['isNil'](_0x3ce6f5[0x0][_0xbf72('0x86')])&&_[_0xbf72('0x6e')](_0x3ce6f5[0x0][_0xbf72('0x86')][_0xbf72('0x57')])){ut[_0xbf72('0x60')](_0xbf72('0x121'),_0x3ce6f5);return{'isValid':![],'message':_0xbf72('0x122')};}var _0x52d432=this[_0xbf72('0x12')][_0x3ce6f5[0x0][_0xbf72('0x70')]['name']];_0x52d432[_0xbf72('0x63')]=_0xbf72('0x9f');if(_[_0xbf72('0x6e')](_0x52d432)){ut[_0xbf72('0x60')](_0xbf72('0x123'),_0x52d432);return{'isValid':![],'message':_0xbf72('0x124')};}if(!this[_0xbf72('0x9c')](_0x52d432[_0xbf72('0x56')])){ut['logger'](_0xbf72('0x125'),_0xbf72('0x126')+_0x52d432[_0xbf72('0x57')]+_0xbf72('0x127'));if(!this[_0xbf72('0x9c')](_0x52d432[_0xbf72('0x9d')])){ut[_0xbf72('0x60')](_0xbf72('0x125'),_0x52d432[_0xbf72('0x57')]+_0xbf72('0x128'));return{'isValid':![],'message':_0xbf72('0x129')};}}if(!ut[_0xbf72('0x9a')](_0x52d432['dialActive'])){ut[_0xbf72('0x60')](_0xbf72('0x12a'),_0x52d432['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0xbf72('0x126')+_0x52d432[_0xbf72('0x57')]+_0xbf72('0x12b')};}return{'isValid':!![],'message':_0xbf72('0x12c')};};Preview[_0xbf72('0x66')][_0xbf72('0x107')]=function(_0x3c9d20,_0x8d859d,_0xbfa860,_0x5f44d1){var _0x339af5=this;return new BPromise(function(_0x4ffbfb,_0x4cff5f){var _0x3aebb5=_0x3c9d20[_0xbf72('0xb4')];var _0xdd0f7b=_0x339af5['isTrunkReachable'](_0x8d859d[_0xbf72('0x56')])?util[_0xbf72('0x5b')]('SIP/%s/%s%s',_0x8d859d[_0xbf72('0x56')][_0xbf72('0x57')],_['isNil'](_0x8d859d[_0xbf72('0x38')])?'':_0x8d859d[_0xbf72('0x38')][_0xbf72('0x12d')]()||'',_0x8d859d[_0xbf72('0x12e')]>0x0?_0xbfa860[_0xbf72('0x103')][_0xbf72('0x104')][_0xbf72('0x12f')](_0x8d859d['dialCutDigit']):_0xbfa860['Contact'][_0xbf72('0x104')]):util[_0xbf72('0x5b')](_0xbf72('0x130'),_[_0xbf72('0x6e')](_0x8d859d['TrunkBackup'])?_0x8d859d[_0xbf72('0x56')][_0xbf72('0x57')]:_0x8d859d[_0xbf72('0x9d')][_0xbf72('0x57')],_['isNil'](_0x8d859d[_0xbf72('0x38')])?'':_0x8d859d[_0xbf72('0x38')][_0xbf72('0x12d')]()||'',_0x8d859d[_0xbf72('0x12e')]>0x0?_0xbfa860[_0xbf72('0x103')][_0xbf72('0x104')][_0xbf72('0x12f')](_0x8d859d['dialCutDigit']):_0xbfa860['Contact'][_0xbf72('0x104')]);var _0x591c57=_0x339af5['isTrunkReachable'](_0x8d859d['Trunk'])?ut['getCallerId'](_0x8d859d[_0xbf72('0x56')][_0xbf72('0x58')],_0x8d859d['dialOriginateCallerIdName'],_0x8d859d[_0xbf72('0x131')]>0x0?ut['getCallerIdRandom'](_0x8d859d[_0xbf72('0x36')],_0x8d859d[_0xbf72('0x131')]):_0x8d859d[_0xbf72('0x36')]):ut[_0xbf72('0x132')](_[_0xbf72('0x6e')](_0x8d859d[_0xbf72('0x9d')])?_0x8d859d[_0xbf72('0x56')][_0xbf72('0x58')]:_0x8d859d[_0xbf72('0x9d')][_0xbf72('0x58')],_0x8d859d[_0xbf72('0x35')],_0x8d859d[_0xbf72('0x131')]>0x0?ut[_0xbf72('0x133')](_0x8d859d['dialOriginateCallerIdNumber'],_0x8d859d[_0xbf72('0x131')]):_0x8d859d[_0xbf72('0x36')]);if(_0x591c57){_0x3c9d20['originatecalleridname']=ut[_0xbf72('0x134')](_0x591c57);_0x3c9d20[_0xbf72('0x135')]=ut[_0xbf72('0x136')](_0x591c57);}var _0x56e24b=ut[_0xbf72('0x137')](_0x8d859d,_0xbfa860,_0xdd0f7b,_0x591c57,_0x3aebb5,_0x3c9d20);_[_0xbf72('0x138')](_0x3c9d20,ut['toLowerVariables'](_0x56e24b));_0x3c9d20[_0xbf72('0x8d')]=moment()['format'](_0xbf72('0x8e'));ami[_0xbf72('0x78')](ut[_0xbf72('0x139')](_0x3c9d20,_0x8d859d,_0x56e24b,_0x3c9d20[_0xbf72('0xae')],_0x5f44d1))['then'](function(_0x5ab2ed){_0x8d859d[_0xbf72('0x72')]+=0x1;logger[_0xbf72('0x5d')]('[originated][increment]',_0x3aebb5,_0xbf72('0xb5'),_0x8d859d[_0xbf72('0x57')],'originated:\x20',_0x8d859d[_0xbf72('0x72')]);_0x4ffbfb(_0x5ab2ed);})['catch'](function(_0x2c5d34){ut['logAgent'](_0x3c9d20,0xe,_0xbf72('0x13a'));rpcDb[_0xbf72('0xfb')](_0x3c9d20,_0xbf72('0x13b'));_0x4cff5f(_0x2c5d34);});});};Preview[_0xbf72('0x66')][_0xbf72('0x1e')]=function(_0x3a5d44){if(this[_0xbf72('0x15')][_0x3a5d44[_0xbf72('0xaf')]]){this[_0xbf72('0x15')][_0x3a5d44[_0xbf72('0xaf')]][_0xbf72('0x7a')]=_0x3a5d44[_0xbf72('0x7a')];}};Preview['prototype'][_0xbf72('0x13c')]=function(_0x49a831){var _0x1ddddb=this;var _0x503644=this[_0xbf72('0x15')][_0x49a831[_0xbf72('0x13d')]];if(_0x503644){if(_0x503644['lookAgent']&&this[_0xbf72('0x16')][_0x503644[_0xbf72('0x13e')]]){ut[_0xbf72('0x13f')](_0x503644,this[_0xbf72('0x16')][_0x503644[_0xbf72('0x13e')]][_0xbf72('0x57')],this['agents'][_0x503644[_0xbf72('0x13e')]]['id']);}var _0x57fab5=_[_0xbf72('0x140')](_0x503644);_0x57fab5[_0xbf72('0xb1')]=moment()[_0xbf72('0x5b')](_0xbf72('0x8e'));var _0x5b7a6d=_0x1ddddb['campaignsPreview'][_0x503644['queue']];if(ut[_0xbf72('0x141')](_0x49a831[_0xbf72('0x142')])){if(_0x503644[_0xbf72('0xcc')]){rpcDb[_0xbf72('0x117')](_0x503644[_0xbf72('0x10a')]);}if(_0x503644[_0xbf72('0xae')]){rpcDb[_0xbf72('0x8c')](_0x503644[_0xbf72('0x10a')]);}ami[_0xbf72('0x25')]('custom:agentringnoanswer',ut[_0xbf72('0xb8')](_0x503644,_0xbf72('0x143'),this[_0xbf72('0x12')][_0x503644[_0xbf72('0x71')]]));this['callProgressDetectingAgent'](_0x57fab5,_0x5b7a6d,_0x49a831);}else{_0x503644['starttime']=moment()[_0xbf72('0x5b')](_0xbf72('0x8e'));ut[_0xbf72('0xf9')](_0x57fab5,0x4,_0xbf72('0xbe'));rpcDb[_0xbf72('0xfb')](_0x57fab5,_0xbf72('0x144'));}}};Preview[_0xbf72('0x66')][_0xbf72('0x18')]=function(_0x4ef22d){var _0x4e8ee7=this;var _0x472735=this[_0xbf72('0x15')][_0x4ef22d[_0xbf72('0xaf')]];var _0xb7784c;if(_0x472735){_0xb7784c=this[_0xbf72('0x12')][_0x472735['queue']];logger['info'](_0xbf72('0x145'),_0x4ef22d[_0xbf72('0xaf')],'\x20Queue',_0xb7784c[_0xbf72('0x57')],_0xbf72('0xb6'),_0xb7784c[_0xbf72('0x2a')]);}if(this[_0xbf72('0x15')][_0x4ef22d[_0xbf72('0xaf')]]&&_0x4ef22d[_0xbf72('0xaf')]!==_0x4ef22d[_0xbf72('0xb4')]){if(_0x4ef22d['cause']==='16'&&this[_0xbf72('0x15')][_0x4ef22d[_0xbf72('0xaf')]][_0xbf72('0x73')]){this[_0xbf72('0x146')](_0x4ef22d,_0x4ef22d[_0xbf72('0xaf')],_0x4ef22d[_0xbf72('0x147')]);}else if(this[_0xbf72('0x15')][_0x4ef22d[_0xbf72('0xaf')]]['dialAnswer']){logger[_0xbf72('0x5d')](_0xbf72('0x148'),_0x4ef22d[_0xbf72('0xaf')],_0x4ef22d[_0xbf72('0x147')],'\x20Queue',_0xb7784c[_0xbf72('0x57')],_0xbf72('0xb6'),_0xb7784c[_0xbf72('0x2a')]);this[_0xbf72('0x146')](_0x4ef22d,_0x4ef22d[_0xbf72('0xaf')],_0x4ef22d[_0xbf72('0x147')]);}}else if(_0x472735&&_[_0xbf72('0x6e')](_0x472735[_0xbf72('0x149')])&&_0xb7784c['dialQueueProject']&&_0x4ef22d['linkedid']===_0x4ef22d[_0xbf72('0xb4')]&&_[_0xbf72('0x6e')](_0x4ef22d[_0xbf72('0xf8')])&&_0x4ef22d[_0xbf72('0x147')]==='16'&&_0x4ef22d['channelstate']==='6'&&_['isUndefined'](_0x472735[_0xbf72('0x14a')])){if(_0x472735[_0xbf72('0xcc')]){rpcDb[_0xbf72('0x117')](_0x472735[_0xbf72('0x10a')]);}if(_0x472735['activeContact']){rpcDb[_0xbf72('0x8c')](_0x472735[_0xbf72('0x10a')]);}_0x4ef22d[_0xbf72('0xf8')]='22';this[_0xbf72('0xf5')](_0x472735,_0xb7784c,_0x4ef22d);}else if(_0x472735&&_0x472735[_0xbf72('0x14a')]){if(_0x4ef22d[_0xbf72('0x147')]==='16'&&this[_0xbf72('0x15')][_0x4ef22d[_0xbf72('0xaf')]][_0xbf72('0x73')]){logger['info'](_0xbf72('0x14b'),_0x4ef22d[_0xbf72('0xaf')],_0x4ef22d[_0xbf72('0x147')],_0xbf72('0xb5'),_0xb7784c[_0xbf72('0x57')],'pTalking:\x20',_0xb7784c[_0xbf72('0x2a')]);this[_0xbf72('0x146')](_0x4ef22d,_0x4ef22d[_0xbf72('0xaf')],_0x4ef22d[_0xbf72('0x147')]);}else if(this[_0xbf72('0x15')][_0x4ef22d[_0xbf72('0xaf')]][_0xbf72('0x73')]){logger[_0xbf72('0x5d')](_0xbf72('0x148'),_0x4ef22d[_0xbf72('0xaf')],_0x4ef22d[_0xbf72('0x147')],_0xbf72('0xb5'),_0xb7784c['name'],'pTalking:\x20',_0xb7784c['pTalking']);this[_0xbf72('0x146')](_0x4ef22d,_0x4ef22d[_0xbf72('0xaf')],_0x4ef22d[_0xbf72('0x147')]);}}};Preview[_0xbf72('0x66')][_0xbf72('0x14c')]=function(_0x7b5da8){if(this['actions'][_0x7b5da8['destlinkedid']]&&_0x7b5da8[_0xbf72('0x14d')]!==_0x7b5da8[_0xbf72('0x14e')]){this[_0xbf72('0x146')](_0x7b5da8,_0x7b5da8[_0xbf72('0x14d')],_0x7b5da8[_0xbf72('0xec')]);}};Preview[_0xbf72('0x66')]['syncHangupRequest']=function(_0x39ee85){if(this['actions'][_0x39ee85['linkedid']]&&_0x39ee85[_0xbf72('0xaf')]!==_0x39ee85[_0xbf72('0xb4')]&&!this[_0xbf72('0x15')][_0x39ee85[_0xbf72('0xaf')]][_0xbf72('0x73')]){if(_0x39ee85['cause']==='1'){this['callProgressDetectingCustomer'](_0x39ee85,_0x39ee85['linkedid'],_0x39ee85[_0xbf72('0x147')]);}}};Preview[_0xbf72('0x66')][_0xbf72('0x14f')]=function(_0x837b6f,_0x571e94,_0x15fd04){if(this['actions'][_0x837b6f]){if(_['isNil'](this[_0xbf72('0x15')][_0x837b6f]['variables'])){this[_0xbf72('0x15')][_0x837b6f]['variables']={};}this['actions'][_0x837b6f][_0xbf72('0x150')][_0x571e94]=_0x15fd04;}};Preview['prototype'][_0xbf72('0x151')]=function(_0x5bffd4){try{if(!_['isNil'](_0x5bffd4)){if(ut[_0xbf72('0x152')](_[_0xbf72('0x153')](_0x5bffd4['variable'])[0x0])){this[_0xbf72('0x14f')](_0x5bffd4[_0xbf72('0xb4')],_[_0xbf72('0x153')](_0x5bffd4[_0xbf72('0x154')])[0x0],_0x5bffd4[_0xbf72('0x155')]);}}}catch(_0x1a9ff2){logger['error'](_0xbf72('0x156'),util[_0xbf72('0x157')](_0x1a9ff2,{'showHidden':![],'depth':null}));}};Preview[_0xbf72('0x66')][_0xbf72('0x21')]=function(_0x509ab6){if(_0x509ab6){if(this['actions'][_0x509ab6[_0xbf72('0x158')]]){this[_0xbf72('0x15')][_0x509ab6[_0xbf72('0x158')]][_0xbf72('0x14a')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x5bee7c){if(_0x5bee7c){if(this[_0xbf72('0x15')][_0x5bee7c[_0xbf72('0x159')]]){this[_0xbf72('0x15')][_0x5bee7c['transfererlinkedid']][_0xbf72('0x14a')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 91d492d..9a09be6 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 _0xdc97=['util','bluebird','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x57784b,_0x49a858){var _0x4505fa=function(_0x14f13c){while(--_0x14f13c){_0x57784b['push'](_0x57784b['shift']());}};_0x4505fa(++_0x49a858);}(_0xdc97,0x13b));var _0x7dc9=function(_0x204107,_0x2e1c09){_0x204107=_0x204107-0x0;var _0x303fd0=_0xdc97[_0x204107];return _0x303fd0;};'use strict';var util=require(_0x7dc9('0x0'));var BPromise=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('preview');var _=require(_0x7dc9('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x7dc9('0x4'));var cmHopperHistory=require(_0x7dc9('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x7dc9('0x6'));var agentReportPreview=require(_0x7dc9('0x7'));var voiceQueueReport=require(_0x7dc9('0x8'));function loggerCatch(_0x3ba3ca){return function(_0x589f02){logger[_0x7dc9('0x9')](_0x3ba3ca,util['inspect'](_0x589f02,{'showHidden':![],'depth':null}));};}function create(_0x4b3229){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopperHistory[_0x7dc9('0xc')](_0x4b3229))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0xe')));}function createAgent(_0x5ca05b){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](agentReportPreview[_0x7dc9('0xc')](_0x5ca05b))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0xe')));}function moveContact(_0x3c2af5){return BPromise[_0x7dc9('0xa')]()['then'](cmHopper['moveContactManagedDialer'](_0x3c2af5,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x7dc9('0xf')]=function(_0x14e5db){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopperBlack[_0x7dc9('0xf')](_0x14e5db))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x10')));};exports[_0x7dc9('0x11')]=function(_0x11af93){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopper[_0x7dc9('0x11')](_0x11af93))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x12')));};exports[_0x7dc9('0xc')]=function(_0xbe0437,_0x45698c){create(_0xbe0437)[_0x7dc9('0xd')](loggerCatch(_0x45698c));moveContact(_0xbe0437)[_0x7dc9('0xd')](loggerCatch(_0x45698c));};exports['createAgentHistory']=function(_0x22577e,_0x4afb47){createAgent(_0x22577e)[_0x7dc9('0xd')](loggerCatch(_0x4afb47));};exports[_0x7dc9('0x13')]=function(_0x5d61d7,_0x41f66e){create(_0x5d61d7)[_0x7dc9('0xd')](loggerCatch(_0x41f66e));};exports[_0x7dc9('0x14')]=function(_0x4b2703,_0x43ec33){moveContact(_0x4b2703)[_0x7dc9('0xd')](loggerCatch(_0x43ec33));};exports[_0x7dc9('0x15')]=function(_0x2895f5,_0x155cc4,_0x2b38d6){if(_0x155cc4){_0x2895f5['UserId']=null;}if(_0x2b38d6){_0x2895f5['active']=![];}return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopper['rescheduleContact'](_0x2895f5))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x16')));};exports['countReScheduled']=function(_0xffc080){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopper['countReScheduled'](_0xffc080))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x17')));};exports[_0x7dc9('0x18')]=function(_0x55a482){return BPromise['resolve']()['then'](cmHopper[_0x7dc9('0x18')]({'UserId':null},_0x55a482,0x1))[_0x7dc9('0xd')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x47771b){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopper[_0x7dc9('0x18')]({'active':![]},_0x47771b,0x1))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x19')));};exports[_0x7dc9('0x1a')]=function(_0x450124){var _0x236d42={};_0x236d42[_0x7dc9('0x1b')]=_0x450124[_0x7dc9('0x1b')];_0x236d42[_0x7dc9('0x1c')]=_0x450124[_0x7dc9('0x1c')];_0x236d42[_0x7dc9('0x1d')]=_0x450124['calleridnum'];_0x236d42['calleridname']=_0x450124['calleridname'];_0x236d42['queue']=_0x450124['queue'];_0x236d42['queuecallerjoinAt']=_0x450124['answertime'];_0x236d42['queuecallerleaveAt']=_0x450124[_0x7dc9('0x1e')];_0x236d42[_0x7dc9('0x1f')]=0x1;_0x236d42[_0x7dc9('0x20')]=_0x450124[_0x7dc9('0x21')];_0x236d42[_0x7dc9('0x22')]=_0x450124[_0x7dc9('0x23')];_0x236d42['context']='from-sip';_0x236d42['exten']=_0x7dc9('0x24');_0x236d42['holdtime']=0x0;_0x236d42[_0x7dc9('0x25')]=0x1;_0x236d42[_0x7dc9('0x26')]=_0x450124[_0x7dc9('0x23')];_0x236d42[_0x7dc9('0x27')]=_0x7dc9('0x28');return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](voiceQueueReport[_0x7dc9('0x29')](_0x236d42))['catch'](loggerCatch(_0x7dc9('0x2a')));};exports['getContactRecallMe']=function(_0x421e1a,_0x16431a){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopper['getContactRecallMe'](_0x421e1a,_0x16431a))[_0x7dc9('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7dc9('0x2b')]=function(_0x4f47af){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopper[_0x7dc9('0x15')](_0x4f47af,!![],!![]))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x2c')));}; \ No newline at end of file +var _0xed1f=['../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','then','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','UserId','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt'];(function(_0x55b08d,_0x5c61bd){var _0x3229e8=function(_0xfef7c7){while(--_0xfef7c7){_0x55b08d['push'](_0x55b08d['shift']());}};_0x3229e8(++_0x5c61bd);}(_0xed1f,0x6a));var _0xfed1=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xed1f[_0x38537f];return _0x141e23;};'use strict';var util=require(_0xfed1('0x0'));var BPromise=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var _=require(_0xfed1('0x4'));var cmHopper=require(_0xfed1('0x5'));var cmHopperFinal=require(_0xfed1('0x6'));var cmHopperHistory=require(_0xfed1('0x7'));var cmHopperBlack=require(_0xfed1('0x8'));var voiceQueueRt=require(_0xfed1('0x9'));var agentReportPreview=require(_0xfed1('0xa'));var voiceQueueReport=require(_0xfed1('0xb'));function loggerCatch(_0x3d6706){return function(_0x42751d){logger[_0xfed1('0xc')](_0x3d6706,util[_0xfed1('0xd')](_0x42751d,{'showHidden':![],'depth':null}));};}function create(_0x2a6082){return BPromise[_0xfed1('0xe')]()['then'](cmHopperHistory[_0xfed1('0xf')](_0x2a6082))[_0xfed1('0x10')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1414be){return BPromise[_0xfed1('0xe')]()['then'](agentReportPreview[_0xfed1('0xf')](_0x1414be))['catch'](loggerCatch(_0xfed1('0x11')));}function moveContact(_0x234f4e){return BPromise['resolve']()['then'](cmHopper[_0xfed1('0x12')](_0x234f4e,!![]))[_0xfed1('0x10')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xfed1('0x13')]=function(_0x5a3469){return BPromise['resolve']()[_0xfed1('0x14')](cmHopperBlack[_0xfed1('0x13')](_0x5a3469))['catch'](loggerCatch(_0xfed1('0x15')));};exports['getContactPreview']=function(_0x4cd9d1){return BPromise[_0xfed1('0xe')]()[_0xfed1('0x14')](cmHopper[_0xfed1('0x16')](_0x4cd9d1))[_0xfed1('0x10')](loggerCatch('[getContactPreview]\x20'));};exports[_0xfed1('0xf')]=function(_0x4af928,_0x36ff34){create(_0x4af928)[_0xfed1('0x10')](loggerCatch(_0x36ff34));moveContact(_0x4af928)['catch'](loggerCatch(_0x36ff34));};exports[_0xfed1('0x17')]=function(_0xa72a20,_0x5c0d9f){createAgent(_0xa72a20)['catch'](loggerCatch(_0x5c0d9f));};exports['createCustomerHistory']=function(_0x1e5afb,_0x51f12a){create(_0x1e5afb)[_0xfed1('0x10')](loggerCatch(_0x51f12a));};exports[_0xfed1('0x18')]=function(_0x51a860,_0x94cb84){moveContact(_0x51a860)[_0xfed1('0x10')](loggerCatch(_0x94cb84));};exports['rescheduleContact']=function(_0x3ce944,_0x2ea7a8,_0xff4842){if(_0x2ea7a8){_0x3ce944[_0xfed1('0x19')]=null;}if(_0xff4842){_0x3ce944['active']=![];}return BPromise[_0xfed1('0xe')]()['then'](cmHopper[_0xfed1('0x1a')](_0x3ce944))[_0xfed1('0x10')](loggerCatch(_0xfed1('0x1b')));};exports['countReScheduled']=function(_0x41d22c){return BPromise['resolve']()[_0xfed1('0x14')](cmHopper[_0xfed1('0x1c')](_0x41d22c))[_0xfed1('0x10')](loggerCatch(_0xfed1('0x1d')));};exports[_0xfed1('0x1e')]=function(_0x1199b7){return BPromise['resolve']()[_0xfed1('0x14')](cmHopper[_0xfed1('0x1e')]({'UserId':null},_0x1199b7,0x1))['catch'](loggerCatch(_0xfed1('0x1f')));};exports[_0xfed1('0x20')]=function(_0x1b871a){return BPromise[_0xfed1('0xe')]()[_0xfed1('0x14')](cmHopper[_0xfed1('0x1e')]({'active':![]},_0x1b871a,0x1))['catch'](loggerCatch(_0xfed1('0x21')));};exports['crateCustomerReportQueue']=function(_0x3106ee){var _0x4e5249={};_0x4e5249['type']=_0x3106ee[_0xfed1('0x22')];_0x4e5249[_0xfed1('0x23')]=_0x3106ee[_0xfed1('0x23')];_0x4e5249['calleridnum']=_0x3106ee[_0xfed1('0x24')];_0x4e5249[_0xfed1('0x25')]=_0x3106ee[_0xfed1('0x25')];_0x4e5249[_0xfed1('0x26')]=_0x3106ee[_0xfed1('0x26')];_0x4e5249[_0xfed1('0x27')]=_0x3106ee['answertime'];_0x4e5249[_0xfed1('0x28')]=_0x3106ee[_0xfed1('0x29')];_0x4e5249['queuecallercomplete']=0x1;_0x4e5249['queuecallercompleteAt']=_0x3106ee[_0xfed1('0x2a')];_0x4e5249[_0xfed1('0x2b')]=_0x3106ee[_0xfed1('0x2c')];_0x4e5249[_0xfed1('0x2d')]=_0xfed1('0x2e');_0x4e5249['exten']=_0xfed1('0x2f');_0x4e5249[_0xfed1('0x30')]=0x0;_0x4e5249[_0xfed1('0x31')]=0x1;_0x4e5249[_0xfed1('0x32')]=_0x3106ee[_0xfed1('0x2c')];_0x4e5249['queuecallerexitreason']=_0xfed1('0x33');return BPromise['resolve']()[_0xfed1('0x14')](voiceQueueReport[_0xfed1('0x34')](_0x4e5249))[_0xfed1('0x10')](loggerCatch(_0xfed1('0x35')));};exports[_0xfed1('0x36')]=function(_0x1f5dcf,_0x39db58){return BPromise[_0xfed1('0xe')]()['then'](cmHopper[_0xfed1('0x36')](_0x1f5dcf,_0x39db58))[_0xfed1('0x10')](loggerCatch(_0xfed1('0x37')));};exports[_0xfed1('0x38')]=function(_0x57da75){return BPromise['resolve']()[_0xfed1('0x14')](cmHopper[_0xfed1('0x1a')](_0x57da75,!![],!![]))[_0xfed1('0x10')](loggerCatch(_0xfed1('0x39')));}; \ 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 0f9bc38..2342425 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 _0xaa18=['moment','../../../../config/logger','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','responsetime','ringtime','logLookAgent','membername','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countnoanswerretry','countagentrejectretry','cloneAction','Global','active','add','ContactId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','channelAgent','mandatoryDisposition','buildAcw','agentReadyId','reachable','push','getDiff','ListId','CampaignId','filterKey','idContact','queue','type','campaigntype','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash'];(function(_0x1bc445,_0x2d6fe0){var _0x589e6b=function(_0xcdd664){while(--_0xcdd664){_0x1bc445['push'](_0x1bc445['shift']());}};_0x589e6b(++_0x2d6fe0);}(_0xaa18,0x19f));var _0x8aa1=function(_0x2a3f63,_0x31853f){_0x2a3f63=_0x2a3f63-0x0;var _0x4c686c=_0xaa18[_0x2a3f63];return _0x4c686c;};'use strict';var util=require(_0x8aa1('0x0'));var _=require(_0x8aa1('0x1'));var moment=require(_0x8aa1('0x2'));var logger=require(_0x8aa1('0x3'))('preview');var ipAgi=process[_0x8aa1('0x4')][_0x8aa1('0x5')]||'127.0.0.1';function getSeconds(_0x4d0f7e,_0x3aab50){var _0x4755f9=moment(_0x4d0f7e)[_0x8aa1('0x6')](0x0);var _0x572cd2=moment(_0x3aab50)[_0x8aa1('0x6')](0x0);return _0x4755f9[_0x8aa1('0x7')](_0x572cd2,_0x8aa1('0x8'));}exports[_0x8aa1('0x9')]=function(_0x564f7d){return function(_0x49b8d6){logger[_0x8aa1('0xa')](_0x564f7d,util[_0x8aa1('0xb')](_0x49b8d6,{'showHidden':![],'depth':null}));};};exports[_0x8aa1('0xc')]=function(_0x183858,_0x59577b){logger[_0x8aa1('0xd')](_0x183858,util[_0x8aa1('0xb')](_0x59577b,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x41447c,_0x336bb7){logger[_0x8aa1('0xa')](_0x41447c,util[_0x8aa1('0xb')](_0x336bb7,{'showHidden':![],'depth':null}));};exports[_0x8aa1('0xe')]=function(_0xf3855e){return function(_0x5da4f1){logger[_0x8aa1('0xd')](_0xf3855e,util['inspect'](_0x5da4f1,{'showHidden':![],'depth':null}));};};exports[_0x8aa1('0xf')]=function(_0x3705bc,_0x260ba1,_0x5613ce){return{'message':_0x3705bc,'unlock':_0x260ba1,'active':_0x5613ce};};exports['getCallerId']=function(_0x41971e,_0x43331b,_0x335845){if(!_[_0x8aa1('0x10')](_0x335845)&&_0x8aa1('0x11')===typeof _0x335845&&!_[_0x8aa1('0x12')](_0x335845)){if(!_[_0x8aa1('0x10')](_0x43331b)&&_0x8aa1('0x11')===typeof _0x43331b&&!_['isEmpty'](_0x43331b)){return util[_0x8aa1('0x13')](_0x8aa1('0x14'),_0x43331b,_0x335845);}return util['format']('\x22%s\x22\x20<%s>',_0x335845,_0x335845);}if(!_['isUndefined'](_0x41971e)&&_0x8aa1('0x11')===typeof _0x41971e&&!_[_0x8aa1('0x12')](_0x41971e)){return _0x41971e;}return _0x8aa1('0x15');};exports[_0x8aa1('0x16')]=function(_0x55ee38){if(_[_0x8aa1('0x17')](_0x55ee38)){return![];}return _0x55ee38;};exports[_0x8aa1('0x18')]=function(_0x32e706,_0xc3acce,_0x450f0a,_0x11a44d,_0x2c5a43,_0x3cef51){var _0x37f97b={'XMD-QUEUE':_0xc3acce[_0x8aa1('0x19')]?_0xc3acce[_0x8aa1('0x19')][_0x8aa1('0x1a')]:'','XMD-CALLERID':_0x11a44d,'XMD-CALLERID-PREVIEW':_0x3cef51?util[_0x8aa1('0x13')](_0x8aa1('0x14'),_0x3cef51[_0x8aa1('0x1b')],_0x3cef51[_0x8aa1('0x1c')]):_0x11a44d,'XMD-DIALID':_0x2c5a43,'XMD-CONTACTID':_0xc3acce['ContactId'],'XMD-CDRTYPE':_0x8aa1('0x1d'),'CALLERID(all)':_0x11a44d,'XMD-VOICEQUEUEID':_0xc3acce['VoiceQueueId'],'XMD-DIALCHANNEL':_0x450f0a,'XMD-DIALTIMEOUT':_0x32e706[_0x8aa1('0x1e')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x32e706[_0x8aa1('0x1f')]?'g':'',_[_0x8aa1('0x12')](_0x32e706['monitor_format'])?'':_0x8aa1('0x20')),'XMD-DIALURL':_0x32e706['dialPreviewUrl']||'','XMD-AGI':_0x32e706[_0x8aa1('0x21')]?util['format'](_0x8aa1('0x22'),ipAgi,_0x32e706[_0x8aa1('0x21')]):'NONE','XMD-AGIAFTER':_0x32e706['dialQueueProject2']?util[_0x8aa1('0x13')](_0x8aa1('0x22'),ipAgi,_0x32e706[_0x8aa1('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3cef51?_0x3cef51[_0x8aa1('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3cef51?_0x3cef51[_0x8aa1('0x24')]:'','XMD-DESTINATION':_0x8aa1('0x25')};if(!_['isEmpty'](_0x32e706[_0x8aa1('0x26')])){_0x37f97b[util[_0x8aa1('0x13')]('%s',_0x8aa1('0x27'))]=_0x32e706[_0x8aa1('0x26')];_0x37f97b[util[_0x8aa1('0x13')]('%s',_0x8aa1('0x28'))]=_0x2c5a43;}if(_0xc3acce&&_0xc3acce['Contact']){for(var _0x2a522d in _0xc3acce[_0x8aa1('0x29')]){if(_0xc3acce[_0x8aa1('0x29')][_0x8aa1('0x2a')](_0x2a522d)){if(!_[_0x8aa1('0x17')](_0xc3acce[_0x8aa1('0x29')][_0x2a522d])&&_0x2a522d!=='id'&&_0x2a522d!=='tags'&&_0x2a522d!==_0x8aa1('0x2b')&&_0x2a522d!==_0x8aa1('0x2c')){_0x37f97b[util[_0x8aa1('0x13')]('%s%s',_0x8aa1('0x2d'),_[_0x8aa1('0x2e')](_0x2a522d))]=_0xc3acce['Contact'][_0x2a522d];}}}}return _0x37f97b;};exports[_0x8aa1('0x2f')]=function(_0x23106c){var _0x842a71={};for(var _0x198324 in _0x23106c){if(_0x23106c[_0x8aa1('0x2a')](_0x198324)){_0x842a71[util['format']('%s',_[_0x8aa1('0x30')](_0x198324))]=_0x23106c[_0x198324];}}return{'variables':_0x842a71};};exports[_0x8aa1('0x31')]=function(_0x160f39,_0xcb2b8f){if(!_[_0x8aa1('0x17')](_0x160f39)){if(_0x160f39[_0x8aa1('0x2a')](_0x8aa1('0x32'))){if(_0x160f39[_0x8aa1('0x32')]>0x0){_0x160f39['originated']-=0x1;}else{logger[_0x8aa1('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0xcb2b8f);}}}else{logger['error'](_0x8aa1('0x33'),_0xcb2b8f);}};exports[_0x8aa1('0x34')]=function(_0x2b4579){var _0x2dc951=moment()[_0x8aa1('0x13')](_0x8aa1('0x35'));_0x2b4579[_0x8aa1('0x36')]=0xd;_0x2b4579[_0x8aa1('0x37')]=_0x8aa1('0x38');_0x2b4579[_0x8aa1('0x39')]=_0x2dc951;_0x2b4579['responsetime']=_0x2dc951;_0x2b4579[_0x8aa1('0x3a')]=_0x2dc951;};exports['logAgent']=function(_0x240655,_0x5857b7,_0x156f08){var _0x1ee67c=moment()[_0x8aa1('0x13')](_0x8aa1('0x35'));_0x240655[_0x8aa1('0x36')]=_0x5857b7;_0x240655[_0x8aa1('0x37')]=_0x156f08;_0x240655[_0x8aa1('0x3b')]=_0x1ee67c;_0x240655[_0x8aa1('0x3c')]=getSeconds(_0x240655[_0x8aa1('0x3b')],_0x240655[_0x8aa1('0x39')]);};exports[_0x8aa1('0x3d')]=function(_0x550fee,_0x3a2fde,_0x5f5ca0){_0x550fee[_0x8aa1('0x3e')]=_0x3a2fde;_0x550fee['UserId']=_0x5f5ca0;};exports[_0x8aa1('0x3f')]=function(_0x12931d,_0x2d3730,_0x38df32){var _0x235e56=moment()[_0x8aa1('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x12931d[_0x8aa1('0x36')]=_0x2d3730;_0x12931d[_0x8aa1('0x37')]=_0x38df32;_0x12931d[_0x8aa1('0x3b')]=_0x12931d['responsetime']?_0x12931d[_0x8aa1('0x3b')]:_0x235e56;_0x12931d[_0x8aa1('0x3a')]=_0x12931d['endtime']?_0x12931d[_0x8aa1('0x3a')]:_0x235e56;_0x12931d[_0x8aa1('0x3c')]=getSeconds(_0x12931d[_0x8aa1('0x3b')]||0x0,_0x12931d[_0x8aa1('0x39')]||0x0);_0x12931d['talktime']=_0x12931d['answertime']?getSeconds(_0x12931d[_0x8aa1('0x3a')],_0x12931d[_0x8aa1('0x40')]):0x0;};exports[_0x8aa1('0x41')]=function(_0x4c2e10){return _0x4c2e10===_0x8aa1('0x42');};exports[_0x8aa1('0x43')]=function(_0xedd17e,_0x598cfd,_0xf92247,_0x93076c,_0x4321c8){var _0x46fe29=_0x93076c?_0x8aa1('0x44'):_0xedd17e[_0x8aa1('0x1b')];_0x46fe29=_0x4321c8?_0x8aa1('0x45'):_0x46fe29;return{'actionid':_0xedd17e[_0x8aa1('0x46')],'action':_0x8aa1('0x47'),'channel':_0xedd17e['channelAgent'],'callerid':util['format'](_0x8aa1('0x14'),_0x46fe29,_0xedd17e[_0x8aa1('0x1c')]),'Exten':_0x8aa1('0x25'),'Context':_0x8aa1('0x48'),'Priority':'1','variable':_0xf92247,'timeout':(_0x598cfd[_0x8aa1('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0xedd17e['uniqueid']};};exports[_0x8aa1('0x4a')]=function(_0x3a485c){return _0x3a485c['countbusyretry']+_0x3a485c['countcongestionretry']+_0x3a485c[_0x8aa1('0x4b')]+_0x3a485c[_0x8aa1('0x4c')]+_0x3a485c['countnosuchnumberretry'];};exports[_0x8aa1('0x4d')]=function(_0x10f016){var _0x44e3b8=_['clone'](_0x10f016);_0x44e3b8[_0x8aa1('0x36')]=0xf;_0x44e3b8[_0x8aa1('0x37')]=_0x8aa1('0x4e');return _0x44e3b8;};exports['scheduledAt']=function(_0x9f1bba,_0x10b85a,_0xda2630){var _0x989621={};_0x989621[_0x10b85a]=_0x9f1bba[_0x10b85a];_0x989621[_0x8aa1('0x4f')]=![];_0x989621['scheduledat']=moment()[_0x8aa1('0x50')](_0xda2630,'minutes')[_0x8aa1('0x13')](_0x8aa1('0x35'));_0x989621[_0x8aa1('0x51')]=_0x9f1bba[_0x8aa1('0x51')];_0x989621['ListId']=_0x9f1bba['ListId'];_0x989621[_0x8aa1('0x52')]=_0x9f1bba[_0x8aa1('0x52')]||undefined;return _0x989621;};exports[_0x8aa1('0x53')]=function(_0x21656f,_0x4dbd9f){if(!_[_0x8aa1('0x17')](_0x21656f)){if(_0x21656f[_0x8aa1('0x54')]>0x0){_0x21656f['pTalking']-=0x1;}else{logger[_0x8aa1('0xa')](_0x4dbd9f,_0x8aa1('0x55'));}}else{logger[_0x8aa1('0xa')](_0x4dbd9f,_0x8aa1('0x56'));}};exports[_0x8aa1('0x57')]=function(_0x206205){if(_0x206205<=0x0){return!![];}return![];};exports[_0x8aa1('0x58')]=function(_0x2402e8,_0x11e1cd,_0xfc556e){_0x2402e8[_0x8aa1('0x59')]=_0x11e1cd;_0x2402e8[_0x8aa1('0x1a')]=_0x2402e8['queue'];_0x2402e8[_0x8aa1('0x5a')]=_0x2402e8[_0x8aa1('0x5b')];if(_0xfc556e){_0x2402e8['mandatoryDisposition']=_0xfc556e[_0x8aa1('0x5c')];}return _0x2402e8;};exports[_0x8aa1('0x5d')]=function(_0x3faf7b){var _0x1c764a={};_0x1c764a['queue']=_0x3faf7b['queue'];_0x1c764a[_0x8aa1('0x5a')]=_0x3faf7b[_0x8aa1('0x5b')];_0x1c764a[_0x8aa1('0x46')]=_0x3faf7b['uniqueid'];return _0x1c764a;};exports[_0x8aa1('0x5e')]=function(_0x432863){var _0x341257=[];for(var _0x3c918d in _0x432863){if(_0x432863['hasOwnProperty'](_0x3c918d)){if(!_[_0x8aa1('0x17')](_0x432863[_0x3c918d])&&_0x432863[_0x3c918d][_0x8aa1('0x36')]==='not_inuse'&&_0x432863[_0x3c918d]['status']===_0x8aa1('0x5f')){_0x341257[_0x8aa1('0x60')](_0x432863[_0x3c918d]['id']);}}}return _0x341257;};exports[_0x8aa1('0x61')]=function(_0x3720d8){var _0x16964d=moment()[_0x8aa1('0x6')](0x0);var _0x8838c8=moment(_0x3720d8)[_0x8aa1('0x6')](0x0);return _0x16964d[_0x8aa1('0x7')](_0x8838c8,_0x8aa1('0x8'));};exports['createBody']=function(_0x394482){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x394482[_0x8aa1('0x51')],'ListId':_0x394482[_0x8aa1('0x62')],'VoiceQueueId':_0x394482[_0x8aa1('0x52')]||undefined,'CampaignId':_0x394482[_0x8aa1('0x63')]||undefined};};exports[_0x8aa1('0x64')]=function(_0x9d0da8){if(_0x9d0da8==='uniqueid'||_0x9d0da8===_0x8aa1('0x65')||_0x9d0da8===_0x8aa1('0x66')||_0x9d0da8===_0x8aa1('0x67')||_0x9d0da8===_0x8aa1('0x68')||_0x9d0da8==='dialAnswer'||_0x9d0da8===_0x8aa1('0x3e')||_0x9d0da8===_0x8aa1('0x5b')||_0x9d0da8===_0x8aa1('0x1b')||_0x9d0da8===_0x8aa1('0x4f')||_0x9d0da8===_0x8aa1('0x1c')||_0x9d0da8==='scheduledat'||_0x9d0da8==='countbusyretry'||_0x9d0da8===_0x8aa1('0x69')||_0x9d0da8===_0x8aa1('0x4b')||_0x9d0da8==='countglobal'||_0x9d0da8===_0x8aa1('0x6a')||_0x9d0da8===_0x8aa1('0x6b')||_0x9d0da8===_0x8aa1('0x6c')||_0x9d0da8===_0x8aa1('0x6d')||_0x9d0da8===_0x8aa1('0x51')||_0x9d0da8===_0x8aa1('0x62')||_0x9d0da8===_0x8aa1('0x6e')||_0x9d0da8===_0x8aa1('0x52')||_0x9d0da8===_0x8aa1('0x6f')||_0x9d0da8==='xmd-voicequeueid'||_0x9d0da8===_0x8aa1('0x70')||_0x9d0da8===_0x8aa1('0x71')||_0x9d0da8===_0x8aa1('0x72')||_0x9d0da8===_0x8aa1('0x73')||_0x9d0da8===_0x8aa1('0x74')||_0x9d0da8===_0x8aa1('0x75')||_0x9d0da8===_0x8aa1('0x76')||_0x9d0da8===_0x8aa1('0x77')||_0x9d0da8==='xmd-contactid'||_0x9d0da8==='xmd-cdrtype'||_0x9d0da8==='xmd-callerid'||_0x9d0da8===_0x8aa1('0x78')||_0x9d0da8===_0x8aa1('0x79')||_0x9d0da8===_0x8aa1('0x7a')||_0x9d0da8===_0x8aa1('0x7b')||_0x9d0da8===_0x8aa1('0x7c')||_0x9d0da8===_0x8aa1('0x7d')||_0x9d0da8==='rtpaudioqosloss'||_0x9d0da8===_0x8aa1('0x7e')||_0x9d0da8===_0x8aa1('0x7f')||_0x9d0da8===_0x8aa1('0x80')||_0x9d0da8===_0x8aa1('0x7a')||_0x9d0da8==='rtpaudioqosbridged'||_0x9d0da8===_0x8aa1('0x7c')||_0x9d0da8===_0x8aa1('0x7d')||_0x9d0da8===_0x8aa1('0x81')||_0x9d0da8===_0x8aa1('0x7e')||_0x9d0da8===_0x8aa1('0x7f')||_0x9d0da8===_0x8aa1('0x80')||_0x9d0da8===_0x8aa1('0x82')||_0x9d0da8===_0x8aa1('0x83')||_0x9d0da8==='state'||_0x9d0da8===_0x8aa1('0x37')){return![];}return!![];};exports[_0x8aa1('0x84')]=function(_0x58d4d0,_0x12b817){var _0x263d6e,_0xb0a28,_0x51f58e;if(_0x12b817<=0x0){_0x12b817=0x1;}_0x263d6e=new RegExp('\x5cw{0,'+_0x12b817+'}$');_0xb0a28=Math[_0x8aa1('0x85')](0xa,_0x12b817-0x1);_0x51f58e=Math[_0x8aa1('0x85')](0xa,_0x12b817)-0x1;return util[_0x8aa1('0x13')]('%s',_[_0x8aa1('0x86')](_0x58d4d0,_0x263d6e,_[_0x8aa1('0x87')](_0xb0a28,_0x51f58e)));};exports[_0x8aa1('0x88')]=function(_0x54f77c){var _0x8eb4f8=_0x54f77c[_0x8aa1('0x89')](/"(.*?)"/);return _0x8eb4f8?_0x8eb4f8[0x1]:_0x54f77c;};exports[_0x8aa1('0x8a')]=function(_0x405b04){var _0x27c614=_0x405b04[_0x8aa1('0x89')](/<(.*?)>/);return _0x27c614?_0x27c614[0x1]:_0x405b04;}; \ No newline at end of file +var _0xec09=['timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','active','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosjitter','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','util','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','diff','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','string','isUndefined','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','statedesc','responsetime','ringtime','membername','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','uniqueid','originate','calleridnum','from-sip'];(function(_0x5650db,_0x5b52df){var _0x309520=function(_0x43ad09){while(--_0x43ad09){_0x5650db['push'](_0x5650db['shift']());}};_0x309520(++_0x5b52df);}(_0xec09,0x162));var _0x9ec0=function(_0x3aa4aa,_0x46ec41){_0x3aa4aa=_0x3aa4aa-0x0;var _0x42cf92=_0xec09[_0x3aa4aa];return _0x42cf92;};'use strict';var util=require(_0x9ec0('0x0'));var _=require(_0x9ec0('0x1'));var moment=require('moment');var logger=require(_0x9ec0('0x2'))(_0x9ec0('0x3'));var ipAgi=process['env'][_0x9ec0('0x4')]||'127.0.0.1';function getSeconds(_0x56f10e,_0x4ccf91){var _0x18d8c6=moment(_0x56f10e)['milliseconds'](0x0);var _0x123a3b=moment(_0x4ccf91)['milliseconds'](0x0);return _0x18d8c6[_0x9ec0('0x5')](_0x123a3b,_0x9ec0('0x6'));}exports[_0x9ec0('0x7')]=function(_0x11b74c){return function(_0x300c74){logger[_0x9ec0('0x8')](_0x11b74c,util[_0x9ec0('0x9')](_0x300c74,{'showHidden':![],'depth':null}));};};exports[_0x9ec0('0xa')]=function(_0x207554,_0x5bcd08){logger['info'](_0x207554,util['inspect'](_0x5bcd08,{'showHidden':![],'depth':null}));};exports[_0x9ec0('0xb')]=function(_0x2081b9,_0x4fe3f5){logger[_0x9ec0('0x8')](_0x2081b9,util[_0x9ec0('0x9')](_0x4fe3f5,{'showHidden':![],'depth':null}));};exports[_0x9ec0('0xc')]=function(_0x14b069){return function(_0x5be216){logger[_0x9ec0('0xd')](_0x14b069,util[_0x9ec0('0x9')](_0x5be216,{'showHidden':![],'depth':null}));};};exports[_0x9ec0('0xe')]=function(_0x1a8208,_0x2cb243,_0x566d7e){return{'message':_0x1a8208,'unlock':_0x2cb243,'active':_0x566d7e};};exports['getCallerId']=function(_0x6e0d38,_0x9ee761,_0x510eb6){if(!_['isUndefined'](_0x510eb6)&&_0x9ec0('0xf')===typeof _0x510eb6&&!_['isEmpty'](_0x510eb6)){if(!_[_0x9ec0('0x10')](_0x9ee761)&&'string'===typeof _0x9ee761&&!_[_0x9ec0('0x11')](_0x9ee761)){return util['format'](_0x9ec0('0x12'),_0x9ee761,_0x510eb6);}return util[_0x9ec0('0x13')](_0x9ec0('0x12'),_0x510eb6,_0x510eb6);}if(!_[_0x9ec0('0x10')](_0x6e0d38)&&_0x9ec0('0xf')===typeof _0x6e0d38&&!_['isEmpty'](_0x6e0d38)){return _0x6e0d38;}return _0x9ec0('0x14');};exports[_0x9ec0('0x15')]=function(_0x8b52a6){if(_[_0x9ec0('0x16')](_0x8b52a6)){return![];}return _0x8b52a6;};exports[_0x9ec0('0x17')]=function(_0x130e54,_0x5bf597,_0x5eeb79,_0x29dad9,_0x2045b5,_0x7867ab){var _0x4d5ccd={'XMD-QUEUE':_0x5bf597[_0x9ec0('0x18')]?_0x5bf597['Queue'][_0x9ec0('0x19')]:'','XMD-CALLERID':_0x29dad9,'XMD-CALLERID-PREVIEW':_0x7867ab?util[_0x9ec0('0x13')]('\x22%s\x22\x20<%s>',_0x7867ab[_0x9ec0('0x1a')],_0x7867ab['calleridnum']):_0x29dad9,'XMD-DIALID':_0x2045b5,'XMD-CONTACTID':_0x5bf597[_0x9ec0('0x1b')],'XMD-CDRTYPE':_0x9ec0('0x1c'),'CALLERID(all)':_0x29dad9,'XMD-VOICEQUEUEID':_0x5bf597['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5eeb79,'XMD-DIALTIMEOUT':_0x130e54[_0x9ec0('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x9ec0('0x13')](_0x9ec0('0x1e'),_0x130e54[_0x9ec0('0x1f')]?'g':'',_[_0x9ec0('0x11')](_0x130e54[_0x9ec0('0x20')])?'':_0x9ec0('0x21')),'XMD-DIALURL':_0x130e54['dialPreviewUrl']||'','XMD-AGI':_0x130e54[_0x9ec0('0x22')]?util[_0x9ec0('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x130e54['dialQueueProject']):_0x9ec0('0x23'),'XMD-AGIAFTER':_0x130e54[_0x9ec0('0x1f')]?util['format'](_0x9ec0('0x24'),ipAgi,_0x130e54['dialQueueProject2']):_0x9ec0('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x7867ab?_0x7867ab['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x7867ab?_0x7867ab[_0x9ec0('0x25')]:'','XMD-DESTINATION':_0x9ec0('0x26')};if(!_['isEmpty'](_0x130e54['monitor_format'])){_0x4d5ccd[util[_0x9ec0('0x13')]('%s',_0x9ec0('0x27'))]=_0x130e54['monitor_format'];_0x4d5ccd[util[_0x9ec0('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2045b5;}if(_0x5bf597&&_0x5bf597[_0x9ec0('0x28')]){for(var _0x2a34b2 in _0x5bf597[_0x9ec0('0x28')]){if(_0x5bf597[_0x9ec0('0x28')][_0x9ec0('0x29')](_0x2a34b2)){if(!_[_0x9ec0('0x16')](_0x5bf597[_0x9ec0('0x28')][_0x2a34b2])&&_0x2a34b2!=='id'&&_0x2a34b2!==_0x9ec0('0x2a')&&_0x2a34b2!==_0x9ec0('0x2b')&&_0x2a34b2!==_0x9ec0('0x2c')){_0x4d5ccd[util['format'](_0x9ec0('0x2d'),'XMD-',_[_0x9ec0('0x2e')](_0x2a34b2))]=_0x5bf597['Contact'][_0x2a34b2];}}}}return _0x4d5ccd;};exports[_0x9ec0('0x2f')]=function(_0x17943c){var _0x2b21fd={};for(var _0x289743 in _0x17943c){if(_0x17943c[_0x9ec0('0x29')](_0x289743)){_0x2b21fd[util[_0x9ec0('0x13')]('%s',_[_0x9ec0('0x30')](_0x289743))]=_0x17943c[_0x289743];}}return{'variables':_0x2b21fd};};exports['updateOriginated']=function(_0x2ce499,_0x38e2a6){if(!_[_0x9ec0('0x16')](_0x2ce499)){if(_0x2ce499[_0x9ec0('0x29')](_0x9ec0('0x31'))){if(_0x2ce499[_0x9ec0('0x31')]>0x0){_0x2ce499[_0x9ec0('0x31')]-=0x1;}else{logger['error'](_0x9ec0('0x32'),_0x38e2a6);}}}else{logger[_0x9ec0('0x8')](_0x9ec0('0x33'),_0x38e2a6);}};exports['logBlacklist']=function(_0x440764){var _0x5abc65=moment()[_0x9ec0('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x440764[_0x9ec0('0x34')]=0xd;_0x440764['statedesc']=_0x9ec0('0x35');_0x440764[_0x9ec0('0x36')]=_0x5abc65;_0x440764['responsetime']=_0x5abc65;_0x440764[_0x9ec0('0x37')]=_0x5abc65;};exports[_0x9ec0('0x38')]=function(_0x86c7fe,_0x5af2f4,_0x48d696){var _0x58f3e3=moment()[_0x9ec0('0x13')](_0x9ec0('0x39'));_0x86c7fe[_0x9ec0('0x34')]=_0x5af2f4;_0x86c7fe[_0x9ec0('0x3a')]=_0x48d696;_0x86c7fe[_0x9ec0('0x3b')]=_0x58f3e3;_0x86c7fe[_0x9ec0('0x3c')]=getSeconds(_0x86c7fe[_0x9ec0('0x3b')],_0x86c7fe[_0x9ec0('0x36')]);};exports['logLookAgent']=function(_0x80ff5e,_0x5dfb97,_0x22e0cc){_0x80ff5e[_0x9ec0('0x3d')]=_0x5dfb97;_0x80ff5e[_0x9ec0('0x3e')]=_0x22e0cc;};exports[_0x9ec0('0x3f')]=function(_0x58c2af,_0x554f96,_0x5d96df){var _0x3805a1=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58c2af[_0x9ec0('0x34')]=_0x554f96;_0x58c2af[_0x9ec0('0x3a')]=_0x5d96df;_0x58c2af[_0x9ec0('0x3b')]=_0x58c2af[_0x9ec0('0x3b')]?_0x58c2af[_0x9ec0('0x3b')]:_0x3805a1;_0x58c2af[_0x9ec0('0x37')]=_0x58c2af[_0x9ec0('0x37')]?_0x58c2af[_0x9ec0('0x37')]:_0x3805a1;_0x58c2af['ringtime']=getSeconds(_0x58c2af['responsetime']||0x0,_0x58c2af[_0x9ec0('0x36')]||0x0);_0x58c2af[_0x9ec0('0x40')]=_0x58c2af[_0x9ec0('0x41')]?getSeconds(_0x58c2af[_0x9ec0('0x37')],_0x58c2af['answertime']):0x0;};exports[_0x9ec0('0x42')]=function(_0x345461){return _0x345461==='Failure';};exports[_0x9ec0('0x43')]=function(_0x40e96,_0x19d1be,_0x549f1c,_0x1289a2,_0x402cfe){var _0x3370fd=_0x1289a2?'RECALL':_0x40e96[_0x9ec0('0x1a')];_0x3370fd=_0x402cfe?'BOOKED':_0x3370fd;return{'actionid':_0x40e96[_0x9ec0('0x44')],'action':_0x9ec0('0x45'),'channel':_0x40e96['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x3370fd,_0x40e96[_0x9ec0('0x46')]),'Exten':_0x9ec0('0x26'),'Context':_0x9ec0('0x47'),'Priority':'1','variable':_0x549f1c,'timeout':(_0x19d1be[_0x9ec0('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x40e96[_0x9ec0('0x44')]};};exports['totalGlobal']=function(_0x5c30d8){return _0x5c30d8[_0x9ec0('0x49')]+_0x5c30d8[_0x9ec0('0x4a')]+_0x5c30d8[_0x9ec0('0x4b')]+_0x5c30d8[_0x9ec0('0x4c')]+_0x5c30d8[_0x9ec0('0x4d')];};exports['cloneAction']=function(_0xe74368){var _0x2de42b=_['clone'](_0xe74368);_0x2de42b['state']=0xf;_0x2de42b[_0x9ec0('0x3a')]=_0x9ec0('0x4e');return _0x2de42b;};exports['scheduledAt']=function(_0x315807,_0x30b8d6,_0x3d6614){var _0x254edb={};_0x254edb[_0x30b8d6]=_0x315807[_0x30b8d6];_0x254edb[_0x9ec0('0x4f')]=![];_0x254edb['scheduledat']=moment()[_0x9ec0('0x50')](_0x3d6614,_0x9ec0('0x51'))[_0x9ec0('0x13')](_0x9ec0('0x39'));_0x254edb[_0x9ec0('0x1b')]=_0x315807['ContactId'];_0x254edb[_0x9ec0('0x52')]=_0x315807[_0x9ec0('0x52')];_0x254edb[_0x9ec0('0x53')]=_0x315807['VoiceQueueId']||undefined;return _0x254edb;};exports[_0x9ec0('0x54')]=function(_0x2d0dfd,_0x13df7f){if(!_[_0x9ec0('0x16')](_0x2d0dfd)){if(_0x2d0dfd['pTalking']>0x0){_0x2d0dfd[_0x9ec0('0x55')]-=0x1;}else{logger[_0x9ec0('0x8')](_0x13df7f,_0x9ec0('0x56'));}}else{logger['error'](_0x13df7f,_0x9ec0('0x57'));}};exports[_0x9ec0('0x58')]=function(_0x5a7631){if(_0x5a7631<=0x0){return!![];}return![];};exports[_0x9ec0('0x59')]=function(_0x705444,_0x54e235,_0x38e6f6){_0x705444[_0x9ec0('0x5a')]=_0x54e235;_0x705444[_0x9ec0('0x19')]=_0x705444[_0x9ec0('0x5b')];_0x705444[_0x9ec0('0x5c')]=_0x705444[_0x9ec0('0x5d')];if(_0x38e6f6){_0x705444[_0x9ec0('0x5e')]=_0x38e6f6[_0x9ec0('0x5e')];}return _0x705444;};exports[_0x9ec0('0x5f')]=function(_0xaca092){var _0x45718d={};_0x45718d['queue']=_0xaca092[_0x9ec0('0x5b')];_0x45718d[_0x9ec0('0x5c')]=_0xaca092[_0x9ec0('0x5d')];_0x45718d[_0x9ec0('0x44')]=_0xaca092[_0x9ec0('0x44')];return _0x45718d;};exports[_0x9ec0('0x60')]=function(_0x2f1a3a){var _0x543987=[];for(var _0xb7a2af in _0x2f1a3a){if(_0x2f1a3a[_0x9ec0('0x29')](_0xb7a2af)){if(!_['isNil'](_0x2f1a3a[_0xb7a2af])&&_0x2f1a3a[_0xb7a2af][_0x9ec0('0x34')]===_0x9ec0('0x61')&&_0x2f1a3a[_0xb7a2af][_0x9ec0('0x62')]===_0x9ec0('0x63')){_0x543987[_0x9ec0('0x64')](_0x2f1a3a[_0xb7a2af]['id']);}}}return _0x543987;};exports[_0x9ec0('0x65')]=function(_0x2f3ef4){var _0x2b76ee=moment()[_0x9ec0('0x66')](0x0);var _0x164eaf=moment(_0x2f3ef4)[_0x9ec0('0x66')](0x0);return _0x2b76ee['diff'](_0x164eaf,_0x9ec0('0x6'));};exports[_0x9ec0('0x67')]=function(_0x1df8d3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1df8d3['ContactId'],'ListId':_0x1df8d3[_0x9ec0('0x52')],'VoiceQueueId':_0x1df8d3['VoiceQueueId']||undefined,'CampaignId':_0x1df8d3[_0x9ec0('0x68')]||undefined};};exports[_0x9ec0('0x69')]=function(_0xd97e07){if(_0xd97e07==='uniqueid'||_0xd97e07===_0x9ec0('0x6a')||_0xd97e07===_0x9ec0('0x5b')||_0xd97e07===_0x9ec0('0x6b')||_0xd97e07===_0x9ec0('0x6c')||_0xd97e07===_0x9ec0('0x6d')||_0xd97e07===_0x9ec0('0x3d')||_0xd97e07===_0x9ec0('0x5d')||_0xd97e07===_0x9ec0('0x1a')||_0xd97e07===_0x9ec0('0x4f')||_0xd97e07===_0x9ec0('0x46')||_0xd97e07===_0x9ec0('0x6e')||_0xd97e07==='countbusyretry'||_0xd97e07==='countcongestionretry'||_0xd97e07===_0x9ec0('0x4b')||_0xd97e07===_0x9ec0('0x6f')||_0xd97e07===_0x9ec0('0x70')||_0xd97e07===_0x9ec0('0x71')||_0xd97e07===_0x9ec0('0x72')||_0xd97e07==='recallme'||_0xd97e07===_0x9ec0('0x1b')||_0xd97e07===_0x9ec0('0x52')||_0xd97e07===_0x9ec0('0x3e')||_0xd97e07===_0x9ec0('0x53')||_0xd97e07===_0x9ec0('0x73')||_0xd97e07===_0x9ec0('0x74')||_0xd97e07===_0x9ec0('0x75')||_0xd97e07==='xmd-phone'||_0xd97e07==='xmd-listid'||_0xd97e07==='xmd-dialurl'||_0xd97e07===_0x9ec0('0x76')||_0xd97e07==='xmd-dialoptions'||_0xd97e07===_0x9ec0('0x77')||_0xd97e07===_0x9ec0('0x78')||_0xd97e07===_0x9ec0('0x79')||_0xd97e07===_0x9ec0('0x7a')||_0xd97e07===_0x9ec0('0x7b')||_0xd97e07===_0x9ec0('0x7c')||_0xd97e07===_0x9ec0('0x7d')||_0xd97e07===_0x9ec0('0x7e')||_0xd97e07===_0x9ec0('0x7f')||_0xd97e07==='rtpaudioqosjitter'||_0xd97e07===_0x9ec0('0x80')||_0xd97e07===_0x9ec0('0x81')||_0xd97e07===_0x9ec0('0x82')||_0xd97e07===_0x9ec0('0x83')||_0xd97e07==='rtpaudioqosrttbridged'||_0xd97e07===_0x9ec0('0x7e')||_0xd97e07===_0x9ec0('0x7f')||_0xd97e07===_0x9ec0('0x84')||_0xd97e07===_0x9ec0('0x80')||_0xd97e07===_0x9ec0('0x81')||_0xd97e07===_0x9ec0('0x82')||_0xd97e07===_0x9ec0('0x83')||_0xd97e07===_0x9ec0('0x85')||_0xd97e07===_0x9ec0('0x86')||_0xd97e07===_0x9ec0('0x87')||_0xd97e07==='state'||_0xd97e07===_0x9ec0('0x3a')){return![];}return!![];};exports[_0x9ec0('0x88')]=function(_0x2a00e3,_0x4a8b95){var _0x3a7dce,_0x573bc9,_0x287b9a;if(_0x4a8b95<=0x0){_0x4a8b95=0x1;}_0x3a7dce=new RegExp(_0x9ec0('0x89')+_0x4a8b95+'}$');_0x573bc9=Math[_0x9ec0('0x8a')](0xa,_0x4a8b95-0x1);_0x287b9a=Math[_0x9ec0('0x8a')](0xa,_0x4a8b95)-0x1;return util[_0x9ec0('0x13')]('%s',_['replace'](_0x2a00e3,_0x3a7dce,_[_0x9ec0('0x8b')](_0x573bc9,_0x287b9a)));};exports[_0x9ec0('0x8c')]=function(_0x1d7c2e){var _0x120e90=_0x1d7c2e['match'](/"(.*?)"/);return _0x120e90?_0x120e90[0x1]:_0x1d7c2e;};exports['extractCalleridNumber']=function(_0x38eaeb){var _0x16f02b=_0x38eaeb[_0x9ec0('0x8d')](/<(.*?)>/);return _0x16f02b?_0x16f02b[0x1]:_0x38eaeb;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a1e155c..427e97a 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 _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x232a6a,_0x1934b8){var _0x289831=function(_0x2031cd){while(--_0x2031cd){_0x232a6a['push'](_0x232a6a['shift']());}};_0x289831(++_0x1934b8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c802c,_0x177ac9){_0x1c802c=_0x1c802c-0x0;var _0x1e53da=_0x5f2f[_0x1c802c];return _0x1e53da;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x55070a,_0x2d448c){var _0x2c865b=function(_0x334ada){while(--_0x334ada){_0x55070a['push'](_0x55070a['shift']());}};_0x2c865b(++_0x2d448c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x152350,_0x3b0fe2){_0x152350=_0x152350-0x0;var _0x23a26b=_0x5f2f[_0x152350];return _0x23a26b;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','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 532a600..ccee14d 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 _0x9a19=['interface','SIP/%s','total','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initVoiceQueues','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','disposition','ANSWERED','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','name','isNil'];(function(_0x12aa21,_0x1c91e6){var _0x1dfd10=function(_0x4d149b){while(--_0x4d149b){_0x12aa21['push'](_0x12aa21['shift']());}};_0x1dfd10(++_0x1c91e6);}(_0x9a19,0x114));var _0x99a1=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9a19[_0x68c979];return _0x4f0001;};'use strict';var BPromise=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var _=require(_0x99a1('0x2'));var moment=require('moment');var Agent=require(_0x99a1('0x3'));var Telephone=require(_0x99a1('0x4'));var Trunk=require(_0x99a1('0x5'));var VoiceQueue=require(_0x99a1('0x6'));var Trigger=require(_0x99a1('0x7'));var Template=require(_0x99a1('0x8'));var Campaign=require(_0x99a1('0x9'));var VoiceExtension=require(_0x99a1('0xa'));var ZendeskAccount=require(_0x99a1('0xb'));var SalesforceAccount=require(_0x99a1('0xc'));var FreshdeskAccount=require(_0x99a1('0xd'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x99a1('0xe'));var ServicenowAccount=require(_0x99a1('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x99a1('0x10'));var Realtime=function(){this[_0x99a1('0x11')]={};this[_0x99a1('0x12')]={};this[_0x99a1('0x13')]={};this[_0x99a1('0x14')]={};this['triggers']={};this[_0x99a1('0x15')]={};this[_0x99a1('0x16')]={};this[_0x99a1('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x99a1('0x18')]={};this[_0x99a1('0x19')]={};this[_0x99a1('0x1a')]={};this[_0x99a1('0x1b')]={};this[_0x99a1('0x1c')]={};this[_0x99a1('0x1d')]={};this[_0x99a1('0x1e')]={};this[_0x99a1('0x1f')]={};this[_0x99a1('0x20')]={};this[_0x99a1('0x21')]={};this[_0x99a1('0x22')]={};this[_0x99a1('0x23')]={};this['vtigerAccounts']={};this[_0x99a1('0x24')]={};this[_0x99a1('0x25')]={};this[_0x99a1('0x26')]={};this[_0x99a1('0x27')]={};};function freeIsNotKey(_0x384f05,_0x33e2c1,_0x1ca878){var _0x4e645b=_['mapKeys'](_0x384f05,function(_0x6702d8,_0xbf62f1){return _0x6702d8[_0x1ca878];});for(var _0x1a8c41 in _0x33e2c1){if(_0x33e2c1[_0x99a1('0x28')](_0x1a8c41)){if(!_0x4e645b[_0x1a8c41]){delete _0x33e2c1[_0x1a8c41];}}}}function freeIsNotKeySip(_0x74a113,_0x209021){var _0x228442=_[_0x99a1('0x29')](_0x74a113,function(_0x13389d,_0x2d8cac){return util[_0x99a1('0x2a')]('SIP/%s',_0x13389d[_0x99a1('0x2b')]);});for(var _0x20007e in _0x209021){if(_0x209021['hasOwnProperty'](_0x20007e)){if(!_0x228442[_0x20007e]){delete _0x209021[_0x20007e];}}}}function freeIsNotKeyAgent(_0x38435b,_0x53093d){var _0x458ed3=_[_0x99a1('0x29')](_0x38435b,function(_0x2d6f20,_0x2d3b82){var _0x5a88c6=_[_0x99a1('0x2c')](_0x2d6f20[_0x99a1('0x2d')])?util['format'](_0x99a1('0x2e'),_0x2d6f20['name']):_0x2d6f20[_0x99a1('0x2d')];return _0x5a88c6;});for(var _0x1e5cc6 in _0x53093d){if(_0x53093d[_0x99a1('0x28')](_0x1e5cc6)){if(!_0x458ed3[_0x1e5cc6]){delete _0x53093d[_0x1e5cc6];}}}}function clearVoiceCallReports(_0xdaa27d){_0xdaa27d[_0x99a1('0x2f')]=0x0;_0xdaa27d[_0x99a1('0x30')]=0x0;_0xdaa27d['sumHoldTime']=0x0;_0xdaa27d[_0x99a1('0x31')]=0x0;_0xdaa27d['sumBillable']=0x0;}function clearCampaigns(_0x5dc733){if(!_[_0x99a1('0x32')](_0x5dc733)){for(var _0x440879 in _0x5dc733){if(_0x5dc733[_0x99a1('0x28')](_0x440879)){_0x5dc733[_0x440879][_0x99a1('0x33')]=0x0;_0x5dc733[_0x440879][_0x99a1('0x34')]=0x0;}}}}function clearVoiceQueues(_0x309b93){if(!_[_0x99a1('0x32')](_0x309b93)){for(var _0x549645 in _0x309b93){if(_0x309b93[_0x99a1('0x28')](_0x549645)){_0x309b93[_0x549645]['total']=0x0;_0x309b93[_0x549645][_0x99a1('0x30')]=0x0;_0x309b93[_0x549645][_0x99a1('0x35')]=0x0;_0x309b93[_0x549645][_0x99a1('0x36')]=0x0;_0x309b93[_0x549645]['sumHoldTime']=0x0;_0x309b93[_0x549645][_0x99a1('0x31')]=0x0;_0x309b93[_0x549645][_0x99a1('0x37')]=0x0;_0x309b93[_0x549645]['outboundAnswerAgiCallsDay']=0x0;_0x309b93[_0x549645][_0x99a1('0x38')]=0x0;_0x309b93[_0x549645][_0x99a1('0x39')]=0x0;_0x309b93[_0x549645][_0x99a1('0x3a')]=0x0;_0x309b93[_0x549645][_0x99a1('0x3b')]=0x0;_0x309b93[_0x549645][_0x99a1('0x3c')]=0x0;_0x309b93[_0x549645][_0x99a1('0x3d')]=0x0;_0x309b93[_0x549645][_0x99a1('0x3e')]=0x0;_0x309b93[_0x549645][_0x99a1('0x3f')]=0x0;_0x309b93[_0x549645]['outboundOriginateFailureCallsDay']=0x0;_0x309b93[_0x549645]['outboundRejectCallsDay']=0x0;_0x309b93[_0x549645][_0x99a1('0x40')]=0x0;_0x309b93[_0x549645]['outboundAnswerAgiCallsDay']=0x0;_0x309b93[_0x549645][_0x99a1('0x41')]=0x0;_0x309b93[_0x549645][_0x99a1('0x42')]=!![];}}}}Realtime['prototype'][_0x99a1('0x43')]=function(_0x3503d5,_0x24b903){for(var _0x547ed3 in _0x24b903){if(_0x3503d5[_0x99a1('0x28')](_0x547ed3)){_0x3503d5[_0x547ed3]=_0x24b903[_0x547ed3];}}};Realtime[_0x99a1('0x44')][_0x99a1('0x45')]=function(){var _0x38bb91=this;return function(_0x1db0f8){if(_0x1db0f8){freeIsNotKeyAgent(_0x1db0f8,_0x38bb91[_0x99a1('0x11')]);for(var _0xb43712=0x0,_0x194100={},_0x215c18={};_0xb43712<_0x1db0f8[_0x99a1('0x46')];_0xb43712+=0x1){_0x194100=_0x1db0f8[_0xb43712];var _0x55005e=_['isNil'](_0x194100[_0x99a1('0x2d')])?util[_0x99a1('0x2a')](_0x99a1('0x2e'),_0x194100[_0x99a1('0x2b')]):_0x194100[_0x99a1('0x2d')];if(_[_0x99a1('0x47')](_0x38bb91[_0x99a1('0x11')][_0x55005e])){_0x38bb91['agents'][_0x55005e]=new Agent(_0x194100);}else{_0x38bb91[_0x99a1('0x43')](_0x38bb91[_0x99a1('0x11')][_0x55005e],_0x194100);}}}return _0x38bb91['agents'];};};Realtime[_0x99a1('0x44')][_0x99a1('0x48')]=function(){var _0x391afa=this;return function(_0x3cd1a0){if(_0x3cd1a0){freeIsNotKeySip(_0x3cd1a0,_0x391afa[_0x99a1('0x12')]);for(var _0x399fd4=0x0,_0x30e8a9={},_0x2f8135={};_0x399fd4<_0x3cd1a0[_0x99a1('0x46')];_0x399fd4+=0x1){_0x30e8a9=_0x3cd1a0[_0x399fd4];if(_[_0x99a1('0x47')](_0x391afa[_0x99a1('0x12')][util[_0x99a1('0x2a')](_0x99a1('0x2e'),_0x30e8a9['name'])])){_0x391afa['telephones'][util['format'](_0x99a1('0x2e'),_0x30e8a9[_0x99a1('0x2b')])]=new Telephone(_0x30e8a9);}else{_0x391afa[_0x99a1('0x43')](_0x391afa[_0x99a1('0x12')][util[_0x99a1('0x2a')]('SIP/%s',_0x30e8a9[_0x99a1('0x2b')])],_0x30e8a9);}}}return _0x391afa[_0x99a1('0x12')];};};Realtime[_0x99a1('0x44')]['initTrunks']=function(){var _0x49be37=this;return function(_0x45c481){if(_0x45c481){freeIsNotKeySip(_0x45c481,_0x49be37[_0x99a1('0x13')]);for(var _0x4a5050=0x0,_0x5424e8={},_0x6c4cb={};_0x4a5050<_0x45c481[_0x99a1('0x46')];_0x4a5050+=0x1){_0x5424e8=_0x45c481[_0x4a5050];if(_[_0x99a1('0x47')](_0x49be37[_0x99a1('0x13')][util[_0x99a1('0x2a')](_0x99a1('0x2e'),_0x5424e8[_0x99a1('0x2b')])])){_0x49be37[_0x99a1('0x13')][util[_0x99a1('0x2a')](_0x99a1('0x2e'),_0x5424e8['name'])]=new Trunk(_0x5424e8);}else{_0x49be37[_0x99a1('0x43')](_0x49be37[_0x99a1('0x13')][util[_0x99a1('0x2a')]('SIP/%s',_0x5424e8[_0x99a1('0x2b')])],_0x5424e8);}}}return _0x49be37['trunks'];};};Realtime[_0x99a1('0x44')][_0x99a1('0x49')]=function(){var _0x14193b=this;return function(_0x3d7ec7){if(_0x3d7ec7){freeIsNotKey(_0x3d7ec7,_0x14193b[_0x99a1('0x14')],_0x99a1('0x2b'));for(var _0x5822b1=0x0,_0xf0e085={},_0x49730f={};_0x5822b1<_0x3d7ec7[_0x99a1('0x46')];_0x5822b1+=0x1){_0xf0e085=_0x3d7ec7[_0x5822b1];if(_[_0x99a1('0x47')](_0x14193b[_0x99a1('0x14')][_0xf0e085[_0x99a1('0x2b')]])){_0x14193b[_0x99a1('0x14')][_0xf0e085[_0x99a1('0x2b')]]=new VoiceQueue(_0xf0e085);}else{_0x14193b[_0x99a1('0x43')](_0x14193b[_0x99a1('0x14')][_0xf0e085[_0x99a1('0x2b')]],_0xf0e085);}}}return _0x14193b[_0x99a1('0x14')];};};Realtime[_0x99a1('0x44')]['initTriggers']=function(){var _0x3c1f55=this;return function(_0x330e3b){if(_0x330e3b){freeIsNotKey(_0x330e3b,_0x3c1f55['triggers'],'id');for(var _0x7662fd=0x0,_0x2c7027={},_0x3e35fb={};_0x7662fd<_0x330e3b[_0x99a1('0x46')];_0x7662fd+=0x1){_0x2c7027=_0x330e3b[_0x7662fd];if(_[_0x99a1('0x47')](_0x3c1f55[_0x99a1('0x4a')][_0x2c7027['id']])){_0x3c1f55[_0x99a1('0x4a')][_0x2c7027['id']]=new Trigger(_0x2c7027);}else{_0x3c1f55['mergeFromDatabase'](_0x3c1f55[_0x99a1('0x4a')][_0x2c7027['id']],_0x2c7027);}}}return _0x3c1f55['triggers'];};};Realtime[_0x99a1('0x44')][_0x99a1('0x4b')]=function(){var _0x566442=this;return function(_0x5433f2){if(_0x5433f2){freeIsNotKey(_0x5433f2,_0x566442[_0x99a1('0x16')],'id');for(var _0x28f96b=0x0,_0x462c15={},_0x4519fb={};_0x28f96b<_0x5433f2[_0x99a1('0x46')];_0x28f96b+=0x1){_0x462c15=_0x5433f2[_0x28f96b];if(_['isUndefined'](_0x566442['templates'][_0x462c15['id']])){_0x566442['templates'][_0x462c15['id']]=new Template(_0x462c15);}else{_0x566442[_0x99a1('0x43')](_0x566442[_0x99a1('0x16')][_0x462c15['id']],_0x462c15);}}}return _0x566442[_0x99a1('0x16')];};};Realtime[_0x99a1('0x44')][_0x99a1('0x4c')]=function(){var _0x9d9148=this;return function(_0x1059b1){if(_0x1059b1){freeIsNotKey(_0x1059b1,_0x9d9148['zendeskAccounts'],'id');for(var _0x5d3541=0x0,_0x22bfd8={},_0x451824={};_0x5d3541<_0x1059b1['length'];_0x5d3541+=0x1){_0x22bfd8=_0x1059b1[_0x5d3541];if(_[_0x99a1('0x47')](_0x9d9148['zendeskAccounts'][_0x22bfd8['id']])){_0x9d9148['zendeskAccounts'][_0x22bfd8['id']]=new ZendeskAccount(_0x22bfd8);}else{_0x9d9148[_0x99a1('0x43')](_0x9d9148[_0x99a1('0x1e')][_0x22bfd8['id']],_0x22bfd8);}}}return _0x9d9148[_0x99a1('0x1e')];};};Realtime[_0x99a1('0x44')][_0x99a1('0x4d')]=function(){var _0xf8208a=this;return function(_0x240d2e){if(_0x240d2e){freeIsNotKey(_0x240d2e,_0xf8208a[_0x99a1('0x1f')],'id');for(var _0x16641e=0x0,_0x53e9eb={},_0x211a74={};_0x16641e<_0x240d2e['length'];_0x16641e+=0x1){_0x53e9eb=_0x240d2e[_0x16641e];if(_[_0x99a1('0x47')](_0xf8208a[_0x99a1('0x1f')][_0x53e9eb['id']])){_0xf8208a['salesforceAccounts'][_0x53e9eb['id']]=new SalesforceAccount(_0x53e9eb);}else{_0xf8208a[_0x99a1('0x43')](_0xf8208a[_0x99a1('0x1f')][_0x53e9eb['id']],_0x53e9eb);}}}return _0xf8208a[_0x99a1('0x1f')];};};Realtime[_0x99a1('0x44')][_0x99a1('0x4e')]=function(){var _0x1bff78=this;return function(_0x157c49){if(_0x157c49){freeIsNotKey(_0x157c49,_0x1bff78[_0x99a1('0x21')],'id');for(var _0x28ba8f=0x0,_0x1c2926={},_0xbf1d55={};_0x28ba8f<_0x157c49[_0x99a1('0x46')];_0x28ba8f+=0x1){_0x1c2926=_0x157c49[_0x28ba8f];if(_['isUndefined'](_0x1bff78['freshdeskAccounts'][_0x1c2926['id']])){_0x1bff78[_0x99a1('0x21')][_0x1c2926['id']]=new FreshdeskAccount(_0x1c2926);}else{_0x1bff78[_0x99a1('0x43')](_0x1bff78[_0x99a1('0x21')][_0x1c2926['id']],_0x1c2926);}}}return _0x1bff78[_0x99a1('0x21')];};};Realtime[_0x99a1('0x44')]['initZohoAccounts']=function(){var _0x4e815d=this;return function(_0x35f4a8){if(_0x35f4a8){freeIsNotKey(_0x35f4a8,_0x4e815d['zohoAccounts'],'id');for(var _0x6107cd=0x0,_0x95f20a={},_0x1376f0={};_0x6107cd<_0x35f4a8[_0x99a1('0x46')];_0x6107cd+=0x1){_0x95f20a=_0x35f4a8[_0x6107cd];if(_[_0x99a1('0x47')](_0x4e815d['zohoAccounts'][_0x95f20a['id']])){_0x4e815d[_0x99a1('0x22')][_0x95f20a['id']]=new ZohoAccount(_0x95f20a);}else{_0x4e815d[_0x99a1('0x43')](_0x4e815d[_0x99a1('0x22')][_0x95f20a['id']],_0x95f20a);}}}return _0x4e815d[_0x99a1('0x22')];};};Realtime[_0x99a1('0x44')][_0x99a1('0x4f')]=function(){var _0x59260e=this;return function(_0x45113b){if(_0x45113b){freeIsNotKey(_0x45113b,_0x59260e[_0x99a1('0x23')],'id');for(var _0x5d67c1=0x0,_0x33feb9={},_0x2b228e={};_0x5d67c1<_0x45113b[_0x99a1('0x46')];_0x5d67c1+=0x1){_0x33feb9=_0x45113b[_0x5d67c1];if(_[_0x99a1('0x47')](_0x59260e[_0x99a1('0x23')][_0x33feb9['id']])){_0x59260e['deskAccounts'][_0x33feb9['id']]=new DeskAccount(_0x33feb9);}else{_0x59260e[_0x99a1('0x43')](_0x59260e['deskAccounts'][_0x33feb9['id']],_0x33feb9);}}}return _0x59260e['deskAccounts'];};};Realtime['prototype'][_0x99a1('0x50')]=function(){var _0x3f7c16=this;return function(_0x548952){if(_0x548952){freeIsNotKey(_0x548952,_0x3f7c16['sugarcrmAccounts'],'id');for(var _0x2c605f=0x0,_0x49f8fa={},_0x21a5f6={};_0x2c605f<_0x548952[_0x99a1('0x46')];_0x2c605f+=0x1){_0x49f8fa=_0x548952[_0x2c605f];if(_[_0x99a1('0x47')](_0x3f7c16[_0x99a1('0x20')][_0x49f8fa['id']])){_0x3f7c16['sugarcrmAccounts'][_0x49f8fa['id']]=new SugarcrmAccount(_0x49f8fa);}else{_0x3f7c16[_0x99a1('0x43')](_0x3f7c16[_0x99a1('0x20')][_0x49f8fa['id']],_0x49f8fa);}}}return _0x3f7c16[_0x99a1('0x20')];};};Realtime['prototype'][_0x99a1('0x51')]=function(){var _0x5c5481=this;return function(_0x4ddfcf){if(_0x4ddfcf){freeIsNotKey(_0x4ddfcf,_0x5c5481[_0x99a1('0x52')],'id');for(var _0x16c87e=0x0,_0x125a88={},_0x25fc39={};_0x16c87e<_0x4ddfcf['length'];_0x16c87e+=0x1){_0x125a88=_0x4ddfcf[_0x16c87e];if(_['isUndefined'](_0x5c5481['vtigerAccounts'][_0x125a88['id']])){_0x5c5481[_0x99a1('0x52')][_0x125a88['id']]=new VtigerAccount(_0x125a88);}else{_0x5c5481[_0x99a1('0x43')](_0x5c5481['vtigerAccounts'][_0x125a88['id']],_0x125a88);}}}return _0x5c5481['vtigerAccounts'];};};Realtime[_0x99a1('0x44')][_0x99a1('0x53')]=function(){var _0x401c8f=this;return function(_0x509d4f){if(_0x509d4f){freeIsNotKey(_0x509d4f,_0x401c8f['servicenowAccounts'],'id');for(var _0x2b8df8=0x0,_0x5409b9={},_0x2770fd={};_0x2b8df8<_0x509d4f[_0x99a1('0x46')];_0x2b8df8+=0x1){_0x5409b9=_0x509d4f[_0x2b8df8];if(_[_0x99a1('0x47')](_0x401c8f['servicenowAccounts'][_0x5409b9['id']])){_0x401c8f[_0x99a1('0x24')][_0x5409b9['id']]=new ServicenowAccount(_0x5409b9);}else{_0x401c8f[_0x99a1('0x43')](_0x401c8f['servicenowAccounts'][_0x5409b9['id']],_0x5409b9);}}}return _0x401c8f['servicenowAccounts'];};};Realtime[_0x99a1('0x44')]['initDynamics365Accounts']=function(){var _0x4262a9=this;return function(_0x3a5f6a){if(_0x3a5f6a){freeIsNotKey(_0x3a5f6a,_0x4262a9[_0x99a1('0x25')],'id');for(var _0x57817e=0x0,_0x1b7bde={},_0x35278b={};_0x57817e<_0x3a5f6a[_0x99a1('0x46')];_0x57817e+=0x1){_0x1b7bde=_0x3a5f6a[_0x57817e];if(_[_0x99a1('0x47')](_0x4262a9[_0x99a1('0x25')][_0x1b7bde['id']])){_0x4262a9['dynamics365Accounts'][_0x1b7bde['id']]=new Dynamics365Account(_0x1b7bde);}else{_0x4262a9['mergeFromDatabase'](_0x4262a9[_0x99a1('0x25')][_0x1b7bde['id']],_0x1b7bde);}}}return _0x4262a9[_0x99a1('0x25')];};};Realtime[_0x99a1('0x44')][_0x99a1('0x54')]=function(){var _0x500ba8=this;return function(_0x19f86a){if(_0x19f86a){freeIsNotKey(_0x19f86a,_0x500ba8['freshsalesAccounts'],'id');for(var _0x495eef=0x0,_0x38201b={},_0x1326b3={};_0x495eef<_0x19f86a[_0x99a1('0x46')];_0x495eef+=0x1){_0x38201b=_0x19f86a[_0x495eef];if(_['isUndefined'](_0x500ba8[_0x99a1('0x26')][_0x38201b['id']])){_0x500ba8[_0x99a1('0x26')][_0x38201b['id']]=new FreshsalesAccount(_0x38201b);}else{_0x500ba8[_0x99a1('0x43')](_0x500ba8[_0x99a1('0x26')][_0x38201b['id']],_0x38201b);}}}return _0x500ba8[_0x99a1('0x26')];};};Realtime['prototype'][_0x99a1('0x55')]=function(){var _0x19e306=this;return function(_0x95efd2){for(var _0x3a78e0=0x0;_0x3a78e0<_0x95efd2[_0x99a1('0x46')];_0x3a78e0+=0x1){_[_0x99a1('0x56')](_0x19e306['voiceQueues'][_0x95efd2[_0x3a78e0][_0x99a1('0x2b')]],_0x95efd2[_0x3a78e0]);}return _0x19e306[_0x99a1('0x14')];};};Realtime[_0x99a1('0x44')][_0x99a1('0x57')]=function(){var _0x2172c3=this;return function(_0x579271){clearVoiceQueues(_0x2172c3[_0x99a1('0x14')]);if(_0x579271){_0x579271=_[_0x99a1('0x58')](_0x579271,_0x99a1('0x59'));for(var _0x123fa7 in _0x579271){if(_0x579271[_0x99a1('0x28')](_0x123fa7)){var _0x34d9aa={};for(var _0x48adaa=0x0;_0x48adaa<_0x579271[_0x123fa7][_0x99a1('0x46')];_0x48adaa+=0x1){var _0x33d96b=_0x579271[_0x123fa7][_0x48adaa]['queue'];if(_0x2172c3['voiceQueues'][_0x33d96b]){if(_0x579271[_0x123fa7][_0x48adaa][_0x99a1('0x5a')]){_0x2172c3[_0x99a1('0x14')][_0x33d96b]['unmanaged']+=0x1;}if(_0x579271[_0x123fa7][_0x48adaa][_0x99a1('0x5b')]){_0x2172c3[_0x99a1('0x14')][_0x33d96b][_0x99a1('0x36')]+=0x1;}_0x2172c3[_0x99a1('0x14')][_0x33d96b][_0x99a1('0x5c')]+=moment(_0x579271[_0x123fa7][_0x48adaa][_0x99a1('0x5d')])[_0x99a1('0x5e')](moment(_0x579271[_0x123fa7][_0x48adaa][_0x99a1('0x5f')]),_0x99a1('0x60'))||0x0;if(_0x48adaa===_0x579271[_0x123fa7][_0x99a1('0x46')]-0x1){_0x2172c3[_0x99a1('0x14')][_0x33d96b][_0x99a1('0x31')]+=moment(_0x579271[_0x123fa7][_0x48adaa][_0x99a1('0x61')]||_0x579271[_0x123fa7][_0x48adaa]['queuecallerabandonAt']||_0x579271[_0x123fa7][_0x48adaa][_0x99a1('0x62')])['diff'](moment(_0x579271[_0x123fa7][_0x48adaa]['queuecallerjoinAt']),_0x99a1('0x60'))||0x0;_0x2172c3[_0x99a1('0x14')][_0x33d96b][_0x99a1('0x2f')]+=0x1;if(_0x579271[_0x123fa7][_0x48adaa][_0x99a1('0x63')]){_0x2172c3[_0x99a1('0x14')][_0x33d96b][_0x99a1('0x30')]+=0x1;_0x2172c3[_0x99a1('0x14')][_0x33d96b][_0x99a1('0x37')]+=moment(_0x579271[_0x123fa7][_0x48adaa][_0x99a1('0x61')])['diff'](moment(_0x579271[_0x123fa7][_0x48adaa][_0x99a1('0x5d')]),_0x99a1('0x60'))||0x0;}}else{_0x2172c3[_0x99a1('0x14')][_0x33d96b][_0x99a1('0x31')]+=_0x2172c3[_0x99a1('0x14')][_0x33d96b][_0x99a1('0x5c')]||0x0;}}}}}}return _0x2172c3[_0x99a1('0x14')];};};Realtime[_0x99a1('0x44')]['initVoiceCallReports']=function(){var _0x51dbe3=this;return function(_0x51c289){clearVoiceCallReports(_0x51dbe3[_0x99a1('0x17')]);if(_0x51c289){for(var _0x353f25=0x0;_0x353f25<_0x51c289['length'];_0x353f25+=0x1){_0x51dbe3[_0x99a1('0x17')][_0x99a1('0x2f')]+=0x1;_0x51dbe3[_0x99a1('0x17')][_0x99a1('0x31')]+=_0x51c289[_0x353f25]['duration'];if(_0x51c289[_0x353f25][_0x99a1('0x64')]===_0x99a1('0x65')){_0x51dbe3[_0x99a1('0x17')][_0x99a1('0x30')]+=0x1;_0x51dbe3['outbound'][_0x99a1('0x5c')]+=_0x51c289[_0x353f25]['duration']-_0x51c289[_0x353f25]['billableseconds']||0x0;_0x51dbe3['outbound'][_0x99a1('0x37')]+=_0x51c289[_0x353f25]['billableseconds'];}}}return _0x51dbe3[_0x99a1('0x17')];};};Realtime[_0x99a1('0x44')][_0x99a1('0x66')]=function(){var _0x37e7ef=this;return function(_0x1cc24b){if(_0x1cc24b){freeIsNotKey(_0x1cc24b,_0x37e7ef[_0x99a1('0x15')],_0x99a1('0x2b'));for(var _0x52bdaf=0x0,_0x4fcd65={};_0x52bdaf<_0x1cc24b[_0x99a1('0x46')];_0x52bdaf+=0x1){_0x4fcd65=_0x1cc24b[_0x52bdaf];if(_[_0x99a1('0x47')](_0x37e7ef[_0x99a1('0x15')][_0x4fcd65['name']])){_0x37e7ef[_0x99a1('0x15')][_0x4fcd65[_0x99a1('0x2b')]]=new Campaign(_0x4fcd65);}else{_0x37e7ef[_0x99a1('0x43')](_0x37e7ef['campaigns'][_0x4fcd65[_0x99a1('0x2b')]],_0x4fcd65);_0x37e7ef[_0x99a1('0x15')][_0x4fcd65[_0x99a1('0x2b')]]['dialQueueProject']=_0x4fcd65['SquareProject']?_0x4fcd65[_0x99a1('0x67')][_0x99a1('0x2b')]:undefined;}}}return _0x37e7ef[_0x99a1('0x15')];};};Realtime[_0x99a1('0x44')][_0x99a1('0x68')]=function(){var _0x59b471=this;return function(_0x467661){if(_0x467661){freeIsNotKey(_0x467661,_0x59b471['voiceExtensions'],'id');for(var _0xa1df99=0x0,_0x3c9792={};_0xa1df99<_0x467661[_0x99a1('0x46')];_0xa1df99+=0x1){_0x3c9792=_0x467661[_0xa1df99];if(_[_0x99a1('0x47')](_0x59b471[_0x99a1('0x18')][_0x3c9792['id']])){_0x59b471[_0x99a1('0x18')][_0x3c9792['id']]=new VoiceExtension(_0x3c9792);}else{_0x59b471['mergeFromDatabase'](_0x59b471[_0x99a1('0x18')][_0x3c9792['id']],_0x3c9792);}}}return _0x59b471[_0x99a1('0x18')];};};Realtime[_0x99a1('0x44')][_0x99a1('0x69')]=function(){var _0x8cefd=this;return function(_0x513699){clearCampaigns(_0x8cefd[_0x99a1('0x15')]);for(var _0x583093=0x0;_0x583093<_0x513699[_0x99a1('0x46')];_0x583093+=0x1){_[_0x99a1('0x56')](_0x8cefd['campaigns'][_0x513699[_0x583093][_0x99a1('0x2b')]],_0x513699[_0x583093]);}return _0x8cefd['campaigns'];};};Realtime[_0x99a1('0x44')][_0x99a1('0x6a')]=function(){var _0x104e0e=this;return function(_0x10a95a){if(_0x10a95a){freeIsNotKey(_0x10a95a,_0x104e0e[_0x99a1('0x27')],'id');for(var _0x1f87aa=0x0,_0x541333={},_0x1bfcf9={};_0x1f87aa<_0x10a95a[_0x99a1('0x46')];_0x1f87aa+=0x1){_0x541333=_0x10a95a[_0x1f87aa];if(_['isUndefined'](_0x104e0e[_0x99a1('0x27')][_0x541333['id']])){_0x104e0e[_0x99a1('0x27')][_0x541333['id']]=new FaxAccount(_0x541333);}else{_0x104e0e[_0x99a1('0x43')](_0x104e0e['faxAccounts'][_0x541333['id']],_0x541333);}}}return _0x104e0e[_0x99a1('0x27')];};};module['exports']=Realtime; \ No newline at end of file +var _0x8d0e=['voiceQueues','isUndefined','initTriggers','initTemplates','initZendeskAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','zendeskAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','hasOwnProperty','mapKeys','interface','format','name','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','length','isNil','SIP/%s','initTelephones','initTrunks','trunks','initVoiceQueues'];(function(_0x1f8231,_0x4dea5d){var _0x454072=function(_0x5c3dbf){while(--_0x5c3dbf){_0x1f8231['push'](_0x1f8231['shift']());}};_0x454072(++_0x4dea5d);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x51b383,_0x3a0ad0){_0x51b383=_0x51b383-0x0;var _0x4112bf=_0x8d0e[_0x51b383];return _0x4112bf;};'use strict';var BPromise=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var _=require(_0xe8d0('0x2'));var moment=require(_0xe8d0('0x3'));var Agent=require(_0xe8d0('0x4'));var Telephone=require(_0xe8d0('0x5'));var Trunk=require(_0xe8d0('0x6'));var VoiceQueue=require(_0xe8d0('0x7'));var Trigger=require(_0xe8d0('0x8'));var Template=require('../model/template');var Campaign=require(_0xe8d0('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xe8d0('0xa'));var FreshdeskAccount=require(_0xe8d0('0xb'));var SugarcrmAccount=require(_0xe8d0('0xc'));var ZohoAccount=require(_0xe8d0('0xd'));var DeskAccount=require(_0xe8d0('0xe'));var VtigerAccount=require(_0xe8d0('0xf'));var ServicenowAccount=require(_0xe8d0('0x10'));var Dynamics365Account=require(_0xe8d0('0x11'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xe8d0('0x12'));var Realtime=function(){this[_0xe8d0('0x13')]={};this[_0xe8d0('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0xe8d0('0x15')]={};this[_0xe8d0('0x16')]={};this[_0xe8d0('0x17')]={};this[_0xe8d0('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe8d0('0x19')]={};this[_0xe8d0('0x1a')]={};this['queueChannels']={};this[_0xe8d0('0x1b')]={};this[_0xe8d0('0x1c')]={};this['settings']={};this[_0xe8d0('0x1d')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0xe8d0('0x1e')]={};this[_0xe8d0('0x1f')]={};this[_0xe8d0('0x20')]={};this[_0xe8d0('0x21')]={};this[_0xe8d0('0x22')]={};this[_0xe8d0('0x23')]={};this['freshsalesAccounts']={};this[_0xe8d0('0x24')]={};};function freeIsNotKey(_0x49554d,_0x6d932b,_0x3c526c){var _0xfe8a4=_['mapKeys'](_0x49554d,function(_0x4d0ddb,_0x47c67a){return _0x4d0ddb[_0x3c526c];});for(var _0x1bdd94 in _0x6d932b){if(_0x6d932b[_0xe8d0('0x25')](_0x1bdd94)){if(!_0xfe8a4[_0x1bdd94]){delete _0x6d932b[_0x1bdd94];}}}}function freeIsNotKeySip(_0x27b910,_0x44bbe4){var _0x83177b=_['mapKeys'](_0x27b910,function(_0x105861,_0x12ebf4){return util['format']('SIP/%s',_0x105861['name']);});for(var _0x384a60 in _0x44bbe4){if(_0x44bbe4[_0xe8d0('0x25')](_0x384a60)){if(!_0x83177b[_0x384a60]){delete _0x44bbe4[_0x384a60];}}}}function freeIsNotKeyAgent(_0x25363b,_0x1fbfe8){var _0x25f764=_[_0xe8d0('0x26')](_0x25363b,function(_0x1bd25c,_0x28a6b5){var _0x32e39a=_['isNil'](_0x1bd25c[_0xe8d0('0x27')])?util[_0xe8d0('0x28')]('SIP/%s',_0x1bd25c[_0xe8d0('0x29')]):_0x1bd25c[_0xe8d0('0x27')];return _0x32e39a;});for(var _0x274cac in _0x1fbfe8){if(_0x1fbfe8[_0xe8d0('0x25')](_0x274cac)){if(!_0x25f764[_0x274cac]){delete _0x1fbfe8[_0x274cac];}}}}function clearVoiceCallReports(_0x146783){_0x146783[_0xe8d0('0x2a')]=0x0;_0x146783[_0xe8d0('0x2b')]=0x0;_0x146783[_0xe8d0('0x2c')]=0x0;_0x146783[_0xe8d0('0x2d')]=0x0;_0x146783[_0xe8d0('0x2e')]=0x0;}function clearCampaigns(_0x264de4){if(!_['isEmpty'](_0x264de4)){for(var _0x24982c in _0x264de4){if(_0x264de4[_0xe8d0('0x25')](_0x24982c)){_0x264de4[_0x24982c][_0xe8d0('0x2f')]=0x0;_0x264de4[_0x24982c]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x10a30b){if(!_[_0xe8d0('0x30')](_0x10a30b)){for(var _0x526240 in _0x10a30b){if(_0x10a30b[_0xe8d0('0x25')](_0x526240)){_0x10a30b[_0x526240][_0xe8d0('0x2a')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x2b')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x31')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x32')]=0x0;_0x10a30b[_0x526240]['sumHoldTime']=0x0;_0x10a30b[_0x526240][_0xe8d0('0x2d')]=0x0;_0x10a30b[_0x526240]['sumBillable']=0x0;_0x10a30b[_0x526240]['outboundAnswerAgiCallsDay']=0x0;_0x10a30b[_0x526240]['outboundNoAnswerCallsDay']=0x0;_0x10a30b[_0x526240][_0xe8d0('0x33')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x34')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x35')]=0x0;_0x10a30b[_0x526240]['outboundUnknownCallsDay']=0x0;_0x10a30b[_0x526240]['outboundDropCallsDayTimeout']=0x0;_0x10a30b[_0x526240][_0xe8d0('0x36')]=0x0;_0x10a30b[_0x526240]['outboundBlacklistCallsDay']=0x0;_0x10a30b[_0x526240][_0xe8d0('0x37')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x38')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x39')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x3a')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x3b')]=0x0;_0x10a30b[_0x526240]['queueStatusComplete']=!![];}}}}Realtime[_0xe8d0('0x3c')][_0xe8d0('0x3d')]=function(_0x402e90,_0x145ddb){for(var _0x587819 in _0x145ddb){if(_0x402e90[_0xe8d0('0x25')](_0x587819)){_0x402e90[_0x587819]=_0x145ddb[_0x587819];}}};Realtime[_0xe8d0('0x3c')]['initAgents']=function(){var _0x42c31f=this;return function(_0x51be84){if(_0x51be84){freeIsNotKeyAgent(_0x51be84,_0x42c31f[_0xe8d0('0x13')]);for(var _0x5dc4ca=0x0,_0x197e01={},_0x531835={};_0x5dc4ca<_0x51be84[_0xe8d0('0x3e')];_0x5dc4ca+=0x1){_0x197e01=_0x51be84[_0x5dc4ca];var _0xb2cdbf=_[_0xe8d0('0x3f')](_0x197e01[_0xe8d0('0x27')])?util['format'](_0xe8d0('0x40'),_0x197e01[_0xe8d0('0x29')]):_0x197e01[_0xe8d0('0x27')];if(_['isUndefined'](_0x42c31f[_0xe8d0('0x13')][_0xb2cdbf])){_0x42c31f[_0xe8d0('0x13')][_0xb2cdbf]=new Agent(_0x197e01);}else{_0x42c31f[_0xe8d0('0x3d')](_0x42c31f[_0xe8d0('0x13')][_0xb2cdbf],_0x197e01);}}}return _0x42c31f[_0xe8d0('0x13')];};};Realtime['prototype'][_0xe8d0('0x41')]=function(){var _0x1828c5=this;return function(_0x10970d){if(_0x10970d){freeIsNotKeySip(_0x10970d,_0x1828c5[_0xe8d0('0x14')]);for(var _0x318106=0x0,_0x23d72e={},_0xbb9620={};_0x318106<_0x10970d[_0xe8d0('0x3e')];_0x318106+=0x1){_0x23d72e=_0x10970d[_0x318106];if(_['isUndefined'](_0x1828c5['telephones'][util[_0xe8d0('0x28')](_0xe8d0('0x40'),_0x23d72e[_0xe8d0('0x29')])])){_0x1828c5[_0xe8d0('0x14')][util[_0xe8d0('0x28')]('SIP/%s',_0x23d72e[_0xe8d0('0x29')])]=new Telephone(_0x23d72e);}else{_0x1828c5['mergeFromDatabase'](_0x1828c5[_0xe8d0('0x14')][util[_0xe8d0('0x28')](_0xe8d0('0x40'),_0x23d72e['name'])],_0x23d72e);}}}return _0x1828c5[_0xe8d0('0x14')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x42')]=function(){var _0x230a90=this;return function(_0x87ac2e){if(_0x87ac2e){freeIsNotKeySip(_0x87ac2e,_0x230a90['trunks']);for(var _0x5ca42a=0x0,_0x57de98={},_0x4cf0da={};_0x5ca42a<_0x87ac2e[_0xe8d0('0x3e')];_0x5ca42a+=0x1){_0x57de98=_0x87ac2e[_0x5ca42a];if(_['isUndefined'](_0x230a90[_0xe8d0('0x43')][util[_0xe8d0('0x28')](_0xe8d0('0x40'),_0x57de98[_0xe8d0('0x29')])])){_0x230a90[_0xe8d0('0x43')][util[_0xe8d0('0x28')](_0xe8d0('0x40'),_0x57de98[_0xe8d0('0x29')])]=new Trunk(_0x57de98);}else{_0x230a90['mergeFromDatabase'](_0x230a90[_0xe8d0('0x43')][util[_0xe8d0('0x28')]('SIP/%s',_0x57de98['name'])],_0x57de98);}}}return _0x230a90[_0xe8d0('0x43')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x44')]=function(){var _0x481e99=this;return function(_0x1eb1f1){if(_0x1eb1f1){freeIsNotKey(_0x1eb1f1,_0x481e99[_0xe8d0('0x45')],'name');for(var _0x19731d=0x0,_0x415046={},_0x5370c9={};_0x19731d<_0x1eb1f1[_0xe8d0('0x3e')];_0x19731d+=0x1){_0x415046=_0x1eb1f1[_0x19731d];if(_[_0xe8d0('0x46')](_0x481e99[_0xe8d0('0x45')][_0x415046[_0xe8d0('0x29')]])){_0x481e99[_0xe8d0('0x45')][_0x415046[_0xe8d0('0x29')]]=new VoiceQueue(_0x415046);}else{_0x481e99[_0xe8d0('0x3d')](_0x481e99[_0xe8d0('0x45')][_0x415046['name']],_0x415046);}}}return _0x481e99[_0xe8d0('0x45')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x47')]=function(){var _0x2278ef=this;return function(_0x28d38b){if(_0x28d38b){freeIsNotKey(_0x28d38b,_0x2278ef[_0xe8d0('0x15')],'id');for(var _0x1d0875=0x0,_0x41b8af={},_0x250f51={};_0x1d0875<_0x28d38b[_0xe8d0('0x3e')];_0x1d0875+=0x1){_0x41b8af=_0x28d38b[_0x1d0875];if(_[_0xe8d0('0x46')](_0x2278ef[_0xe8d0('0x15')][_0x41b8af['id']])){_0x2278ef['triggers'][_0x41b8af['id']]=new Trigger(_0x41b8af);}else{_0x2278ef[_0xe8d0('0x3d')](_0x2278ef[_0xe8d0('0x15')][_0x41b8af['id']],_0x41b8af);}}}return _0x2278ef[_0xe8d0('0x15')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x48')]=function(){var _0x2e4caf=this;return function(_0x5a0c7e){if(_0x5a0c7e){freeIsNotKey(_0x5a0c7e,_0x2e4caf['templates'],'id');for(var _0x12324a=0x0,_0x424764={},_0x151cf4={};_0x12324a<_0x5a0c7e[_0xe8d0('0x3e')];_0x12324a+=0x1){_0x424764=_0x5a0c7e[_0x12324a];if(_['isUndefined'](_0x2e4caf[_0xe8d0('0x17')][_0x424764['id']])){_0x2e4caf['templates'][_0x424764['id']]=new Template(_0x424764);}else{_0x2e4caf[_0xe8d0('0x3d')](_0x2e4caf[_0xe8d0('0x17')][_0x424764['id']],_0x424764);}}}return _0x2e4caf[_0xe8d0('0x17')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x49')]=function(){var _0x34efb0=this;return function(_0x1646fb){if(_0x1646fb){freeIsNotKey(_0x1646fb,_0x34efb0['zendeskAccounts'],'id');for(var _0x137bc3=0x0,_0x55f93d={},_0x581a34={};_0x137bc3<_0x1646fb[_0xe8d0('0x3e')];_0x137bc3+=0x1){_0x55f93d=_0x1646fb[_0x137bc3];if(_['isUndefined'](_0x34efb0[_0xe8d0('0x1d')][_0x55f93d['id']])){_0x34efb0['zendeskAccounts'][_0x55f93d['id']]=new ZendeskAccount(_0x55f93d);}else{_0x34efb0[_0xe8d0('0x3d')](_0x34efb0[_0xe8d0('0x1d')][_0x55f93d['id']],_0x55f93d);}}}return _0x34efb0[_0xe8d0('0x1d')];};};Realtime[_0xe8d0('0x3c')]['initSalesforceAccounts']=function(){var _0x3088b1=this;return function(_0xbd55db){if(_0xbd55db){freeIsNotKey(_0xbd55db,_0x3088b1[_0xe8d0('0x4a')],'id');for(var _0x2e3f1d=0x0,_0x18cc14={},_0x57b77a={};_0x2e3f1d<_0xbd55db[_0xe8d0('0x3e')];_0x2e3f1d+=0x1){_0x18cc14=_0xbd55db[_0x2e3f1d];if(_[_0xe8d0('0x46')](_0x3088b1[_0xe8d0('0x4a')][_0x18cc14['id']])){_0x3088b1['salesforceAccounts'][_0x18cc14['id']]=new SalesforceAccount(_0x18cc14);}else{_0x3088b1[_0xe8d0('0x3d')](_0x3088b1['salesforceAccounts'][_0x18cc14['id']],_0x18cc14);}}}return _0x3088b1['salesforceAccounts'];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x4b')]=function(){var _0x4e7b49=this;return function(_0xcb6ce2){if(_0xcb6ce2){freeIsNotKey(_0xcb6ce2,_0x4e7b49[_0xe8d0('0x1e')],'id');for(var _0x47893d=0x0,_0x2a54c1={},_0xe67928={};_0x47893d<_0xcb6ce2[_0xe8d0('0x3e')];_0x47893d+=0x1){_0x2a54c1=_0xcb6ce2[_0x47893d];if(_[_0xe8d0('0x46')](_0x4e7b49['freshdeskAccounts'][_0x2a54c1['id']])){_0x4e7b49[_0xe8d0('0x1e')][_0x2a54c1['id']]=new FreshdeskAccount(_0x2a54c1);}else{_0x4e7b49[_0xe8d0('0x3d')](_0x4e7b49[_0xe8d0('0x1e')][_0x2a54c1['id']],_0x2a54c1);}}}return _0x4e7b49[_0xe8d0('0x1e')];};};Realtime['prototype'][_0xe8d0('0x4c')]=function(){var _0x677679=this;return function(_0x17c044){if(_0x17c044){freeIsNotKey(_0x17c044,_0x677679[_0xe8d0('0x1f')],'id');for(var _0x1a74d0=0x0,_0x29667c={},_0x595b24={};_0x1a74d0<_0x17c044['length'];_0x1a74d0+=0x1){_0x29667c=_0x17c044[_0x1a74d0];if(_[_0xe8d0('0x46')](_0x677679['zohoAccounts'][_0x29667c['id']])){_0x677679[_0xe8d0('0x1f')][_0x29667c['id']]=new ZohoAccount(_0x29667c);}else{_0x677679[_0xe8d0('0x3d')](_0x677679['zohoAccounts'][_0x29667c['id']],_0x29667c);}}}return _0x677679['zohoAccounts'];};};Realtime[_0xe8d0('0x3c')]['initDeskAccounts']=function(){var _0x26af63=this;return function(_0x4c458a){if(_0x4c458a){freeIsNotKey(_0x4c458a,_0x26af63[_0xe8d0('0x20')],'id');for(var _0x2c765d=0x0,_0x13b9f0={},_0x4e2abc={};_0x2c765d<_0x4c458a[_0xe8d0('0x3e')];_0x2c765d+=0x1){_0x13b9f0=_0x4c458a[_0x2c765d];if(_[_0xe8d0('0x46')](_0x26af63['deskAccounts'][_0x13b9f0['id']])){_0x26af63[_0xe8d0('0x20')][_0x13b9f0['id']]=new DeskAccount(_0x13b9f0);}else{_0x26af63['mergeFromDatabase'](_0x26af63[_0xe8d0('0x20')][_0x13b9f0['id']],_0x13b9f0);}}}return _0x26af63['deskAccounts'];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x4d')]=function(){var _0x29467d=this;return function(_0x30817f){if(_0x30817f){freeIsNotKey(_0x30817f,_0x29467d[_0xe8d0('0x4e')],'id');for(var _0x4b271e=0x0,_0x4ee750={},_0xd7d433={};_0x4b271e<_0x30817f['length'];_0x4b271e+=0x1){_0x4ee750=_0x30817f[_0x4b271e];if(_[_0xe8d0('0x46')](_0x29467d[_0xe8d0('0x4e')][_0x4ee750['id']])){_0x29467d[_0xe8d0('0x4e')][_0x4ee750['id']]=new SugarcrmAccount(_0x4ee750);}else{_0x29467d[_0xe8d0('0x3d')](_0x29467d[_0xe8d0('0x4e')][_0x4ee750['id']],_0x4ee750);}}}return _0x29467d[_0xe8d0('0x4e')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x4f')]=function(){var _0x7557d9=this;return function(_0x2fc8bd){if(_0x2fc8bd){freeIsNotKey(_0x2fc8bd,_0x7557d9[_0xe8d0('0x21')],'id');for(var _0x29a7b3=0x0,_0x3258c8={},_0x1c41d8={};_0x29a7b3<_0x2fc8bd[_0xe8d0('0x3e')];_0x29a7b3+=0x1){_0x3258c8=_0x2fc8bd[_0x29a7b3];if(_['isUndefined'](_0x7557d9[_0xe8d0('0x21')][_0x3258c8['id']])){_0x7557d9[_0xe8d0('0x21')][_0x3258c8['id']]=new VtigerAccount(_0x3258c8);}else{_0x7557d9[_0xe8d0('0x3d')](_0x7557d9[_0xe8d0('0x21')][_0x3258c8['id']],_0x3258c8);}}}return _0x7557d9[_0xe8d0('0x21')];};};Realtime['prototype'][_0xe8d0('0x50')]=function(){var _0x1d30c0=this;return function(_0x45b42b){if(_0x45b42b){freeIsNotKey(_0x45b42b,_0x1d30c0[_0xe8d0('0x22')],'id');for(var _0x360633=0x0,_0xa215f={},_0x51eb0b={};_0x360633<_0x45b42b[_0xe8d0('0x3e')];_0x360633+=0x1){_0xa215f=_0x45b42b[_0x360633];if(_[_0xe8d0('0x46')](_0x1d30c0[_0xe8d0('0x22')][_0xa215f['id']])){_0x1d30c0[_0xe8d0('0x22')][_0xa215f['id']]=new ServicenowAccount(_0xa215f);}else{_0x1d30c0[_0xe8d0('0x3d')](_0x1d30c0['servicenowAccounts'][_0xa215f['id']],_0xa215f);}}}return _0x1d30c0['servicenowAccounts'];};};Realtime[_0xe8d0('0x3c')]['initDynamics365Accounts']=function(){var _0x169047=this;return function(_0x209263){if(_0x209263){freeIsNotKey(_0x209263,_0x169047['dynamics365Accounts'],'id');for(var _0x16a989=0x0,_0x1e3d33={},_0x243c09={};_0x16a989<_0x209263[_0xe8d0('0x3e')];_0x16a989+=0x1){_0x1e3d33=_0x209263[_0x16a989];if(_[_0xe8d0('0x46')](_0x169047[_0xe8d0('0x23')][_0x1e3d33['id']])){_0x169047[_0xe8d0('0x23')][_0x1e3d33['id']]=new Dynamics365Account(_0x1e3d33);}else{_0x169047[_0xe8d0('0x3d')](_0x169047[_0xe8d0('0x23')][_0x1e3d33['id']],_0x1e3d33);}}}return _0x169047[_0xe8d0('0x23')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x51')]=function(){var _0xa0c61a=this;return function(_0x2147d5){if(_0x2147d5){freeIsNotKey(_0x2147d5,_0xa0c61a[_0xe8d0('0x52')],'id');for(var _0x391510=0x0,_0xffd884={},_0x33e3ee={};_0x391510<_0x2147d5[_0xe8d0('0x3e')];_0x391510+=0x1){_0xffd884=_0x2147d5[_0x391510];if(_['isUndefined'](_0xa0c61a[_0xe8d0('0x52')][_0xffd884['id']])){_0xa0c61a[_0xe8d0('0x52')][_0xffd884['id']]=new FreshsalesAccount(_0xffd884);}else{_0xa0c61a[_0xe8d0('0x3d')](_0xa0c61a['freshsalesAccounts'][_0xffd884['id']],_0xffd884);}}}return _0xa0c61a[_0xe8d0('0x52')];};};Realtime['prototype'][_0xe8d0('0x53')]=function(){var _0x1c1794=this;return function(_0x22791b){for(var _0x561eb3=0x0;_0x561eb3<_0x22791b[_0xe8d0('0x3e')];_0x561eb3+=0x1){_[_0xe8d0('0x54')](_0x1c1794[_0xe8d0('0x45')][_0x22791b[_0x561eb3][_0xe8d0('0x29')]],_0x22791b[_0x561eb3]);}return _0x1c1794[_0xe8d0('0x45')];};};Realtime['prototype'][_0xe8d0('0x55')]=function(){var _0xbd7ee=this;return function(_0x23ba49){clearVoiceQueues(_0xbd7ee[_0xe8d0('0x45')]);if(_0x23ba49){_0x23ba49=_[_0xe8d0('0x56')](_0x23ba49,_0xe8d0('0x57'));for(var _0x16818f in _0x23ba49){if(_0x23ba49[_0xe8d0('0x25')](_0x16818f)){var _0x5334ee={};for(var _0x20a18b=0x0;_0x20a18b<_0x23ba49[_0x16818f][_0xe8d0('0x3e')];_0x20a18b+=0x1){var _0x14d722=_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x58')];if(_0xbd7ee['voiceQueues'][_0x14d722]){if(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x59')]){_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x31')]+=0x1;}if(_0x23ba49[_0x16818f][_0x20a18b]['queuecallerabandon']){_0xbd7ee[_0xe8d0('0x45')][_0x14d722]['abandoned']+=0x1;}_0xbd7ee[_0xe8d0('0x45')][_0x14d722]['sumHoldTime']+=moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5a')])[_0xe8d0('0x5b')](moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5c')]),_0xe8d0('0x5d'))||0x0;if(_0x20a18b===_0x23ba49[_0x16818f][_0xe8d0('0x3e')]-0x1){_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2d')]+=moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5e')]||_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5f')]||_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x60')])[_0xe8d0('0x5b')](moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5c')]),'seconds')||0x0;_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2a')]+=0x1;if(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x61')]){_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2b')]+=0x1;_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2e')]+=moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5e')])[_0xe8d0('0x5b')](moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5a')]),'seconds')||0x0;}}else{_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2d')]+=_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2c')]||0x0;}}}}}}return _0xbd7ee[_0xe8d0('0x45')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0xca752a=this;return function(_0x5c8c7d){clearVoiceCallReports(_0xca752a[_0xe8d0('0x18')]);if(_0x5c8c7d){for(var _0x16098b=0x0;_0x16098b<_0x5c8c7d[_0xe8d0('0x3e')];_0x16098b+=0x1){_0xca752a['outbound'][_0xe8d0('0x2a')]+=0x1;_0xca752a['outbound'][_0xe8d0('0x2d')]+=_0x5c8c7d[_0x16098b][_0xe8d0('0x62')];if(_0x5c8c7d[_0x16098b][_0xe8d0('0x63')]===_0xe8d0('0x64')){_0xca752a[_0xe8d0('0x18')]['answered']+=0x1;_0xca752a['outbound'][_0xe8d0('0x2c')]+=_0x5c8c7d[_0x16098b][_0xe8d0('0x62')]-_0x5c8c7d[_0x16098b][_0xe8d0('0x65')]||0x0;_0xca752a[_0xe8d0('0x18')][_0xe8d0('0x2e')]+=_0x5c8c7d[_0x16098b][_0xe8d0('0x65')];}}}return _0xca752a[_0xe8d0('0x18')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x66')]=function(){var _0x590397=this;return function(_0x35e14f){if(_0x35e14f){freeIsNotKey(_0x35e14f,_0x590397[_0xe8d0('0x16')],_0xe8d0('0x29'));for(var _0x2f199b=0x0,_0x4a568f={};_0x2f199b<_0x35e14f['length'];_0x2f199b+=0x1){_0x4a568f=_0x35e14f[_0x2f199b];if(_[_0xe8d0('0x46')](_0x590397[_0xe8d0('0x16')][_0x4a568f[_0xe8d0('0x29')]])){_0x590397[_0xe8d0('0x16')][_0x4a568f[_0xe8d0('0x29')]]=new Campaign(_0x4a568f);}else{_0x590397[_0xe8d0('0x3d')](_0x590397[_0xe8d0('0x16')][_0x4a568f[_0xe8d0('0x29')]],_0x4a568f);_0x590397[_0xe8d0('0x16')][_0x4a568f[_0xe8d0('0x29')]]['dialQueueProject']=_0x4a568f[_0xe8d0('0x67')]?_0x4a568f[_0xe8d0('0x67')][_0xe8d0('0x29')]:undefined;}}}return _0x590397[_0xe8d0('0x16')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x68')]=function(){var _0xe674e2=this;return function(_0x1b1bd3){if(_0x1b1bd3){freeIsNotKey(_0x1b1bd3,_0xe674e2[_0xe8d0('0x19')],'id');for(var _0x47bdc2=0x0,_0x52aece={};_0x47bdc2<_0x1b1bd3[_0xe8d0('0x3e')];_0x47bdc2+=0x1){_0x52aece=_0x1b1bd3[_0x47bdc2];if(_[_0xe8d0('0x46')](_0xe674e2['voiceExtensions'][_0x52aece['id']])){_0xe674e2[_0xe8d0('0x19')][_0x52aece['id']]=new VoiceExtension(_0x52aece);}else{_0xe674e2[_0xe8d0('0x3d')](_0xe674e2[_0xe8d0('0x19')][_0x52aece['id']],_0x52aece);}}}return _0xe674e2['voiceExtensions'];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x69')]=function(){var _0x233a5a=this;return function(_0x2746db){clearCampaigns(_0x233a5a['campaigns']);for(var _0x51b0b3=0x0;_0x51b0b3<_0x2746db[_0xe8d0('0x3e')];_0x51b0b3+=0x1){_[_0xe8d0('0x54')](_0x233a5a['campaigns'][_0x2746db[_0x51b0b3]['name']],_0x2746db[_0x51b0b3]);}return _0x233a5a[_0xe8d0('0x16')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x6a')]=function(){var _0x5eaf13=this;return function(_0x1ffd29){if(_0x1ffd29){freeIsNotKey(_0x1ffd29,_0x5eaf13['faxAccounts'],'id');for(var _0x4bd847=0x0,_0x44a4bd={},_0x3fd5d1={};_0x4bd847<_0x1ffd29[_0xe8d0('0x3e')];_0x4bd847+=0x1){_0x44a4bd=_0x1ffd29[_0x4bd847];if(_[_0xe8d0('0x46')](_0x5eaf13[_0xe8d0('0x24')][_0x44a4bd['id']])){_0x5eaf13['faxAccounts'][_0x44a4bd['id']]=new FaxAccount(_0x44a4bd);}else{_0x5eaf13[_0xe8d0('0x3d')](_0x5eaf13[_0xe8d0('0x24')][_0x44a4bd['id']],_0x44a4bd);}}}return _0x5eaf13['faxAccounts'];};};module[_0xe8d0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9836063..d6e7f22 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 _0x6b89=['YYYY-MM-DD\x20HH:mm:ss','create','voiceCallReport','destination','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','Local','substring','indexOf','phone','lastIndexOf','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','custom:voiceAgentReport','voiceDialReport','bind','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x175c3e,_0x54d2bb){var _0x446739=function(_0x2c7305){while(--_0x2c7305){_0x175c3e['push'](_0x175c3e['shift']());}};_0x446739(++_0x54d2bb);}(_0x6b89,0xe4));var _0x96b8=function(_0x26dda3,_0x4d8b4d){_0x26dda3=_0x26dda3-0x0;var _0x3c9ff4=_0x6b89[_0x26dda3];return _0x3c9ff4;};'use strict';var _=require(_0x96b8('0x0'));var moment=require(_0x96b8('0x1'));var util=require(_0x96b8('0x2'));var config=require(_0x96b8('0x3'));var ami=require(_0x96b8('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x96b8('0x5'));var RpcVoiceDialReport=require(_0x96b8('0x6'));var RpcMemberReport=require(_0x96b8('0x7'));var RpcVoiceQueueReport=require(_0x96b8('0x8'));var RpcVoiceRecording=require(_0x96b8('0x9'));var RpcVoiceTransferReport=require(_0x96b8('0xa'));var VoiceQueueReport=require(_0x96b8('0xb'));var VoiceCallReport=require(_0x96b8('0xc'));var VoiceAgentReport=require(_0x96b8('0xd'));var VoiceDialReport=require(_0x96b8('0xe'));var UserReport=require(_0x96b8('0xf'));function Report(_0x232e11){this[_0x96b8('0x10')]=_0x232e11;this[_0x96b8('0x11')]=_0x232e11['agents'];this['telephones']=_0x232e11[_0x96b8('0x12')];}Report[_0x96b8('0x13')][_0x96b8('0x14')]=function(_0x2fe4f6){var _0x23a803=new VoiceQueueReport(this['realtime']);var _0x45cc7d=new VoiceAgentReport(this[_0x96b8('0x10')]);var _0x2f3800=new VoiceDialReport(this['realtime']);var _0x30ffeb=new VoiceCallReport(this[_0x96b8('0x10')]);var _0x86943b=new UserReport(this[_0x96b8('0x10')]);if(config[_0x96b8('0x15')]&&config['xdr'][_0x96b8('0x16')]){ami['on'](_0x96b8('0x17'),this[_0x96b8('0x18')]['bind'](this));ami['on'](_0x96b8('0x19'),this['voiceCallReport']['bind'](this));ami['on'](_0x96b8('0x1a'),this['voiceAgentReport']['bind'](this));ami['on']('custom:voiceDialReport',this[_0x96b8('0x1b')][_0x96b8('0x1c')](this));ami['on'](_0x96b8('0x1d'),this[_0x96b8('0x1e')][_0x96b8('0x1c')](this));ami['on'](_0x96b8('0x1f'),this[_0x96b8('0x20')][_0x96b8('0x1c')](this));}};Report[_0x96b8('0x13')][_0x96b8('0x21')]=function(_0x47e56a){var _0x207a6d;_0x207a6d=_['find'](this[_0x96b8('0x11')],function(_0x121edd){return _0x121edd[_0x96b8('0x22')]==_0x47e56a||_0x121edd[_0x96b8('0x23')]==_0x47e56a;});if(_[_0x96b8('0x24')](_0x207a6d)){var _0x2238b0=_[_0x96b8('0x25')](this[_0x96b8('0x12')],function(_0x1d66f7){return _0x1d66f7[_0x96b8('0x22')]==_0x47e56a||_0x1d66f7[_0x96b8('0x23')]==_0x47e56a;});if(_0x2238b0){_0x207a6d=_['find'](this[_0x96b8('0x11')],function(_0x1c55e1){return _0x1c55e1['interface']==util[_0x96b8('0x26')](_0x96b8('0x27'),_0x2238b0[_0x96b8('0x23')]);});}}return _0x207a6d;};Report[_0x96b8('0x13')]['voiceQueueReport']=function(_0x477e8b){for(var _0x3f89db=0x0;_0x3f89db<_0x477e8b[_0x96b8('0x28')];_0x3f89db+=0x1){var _0x5b2c24=this[_0x96b8('0x21')](_0x477e8b[_0x3f89db][_0x96b8('0x29')]);if(_0x5b2c24){_0x477e8b[_0x3f89db][_0x96b8('0x22')]=_0x5b2c24[_0x96b8('0x22')];_0x477e8b[_0x3f89db][_0x96b8('0x2a')]=!![];_0x477e8b[_0x3f89db][_0x96b8('0x2b')]=_0x5b2c24[_0x96b8('0x23')];_0x477e8b[_0x3f89db]['interface']=_[_0x96b8('0x24')](_0x5b2c24[_0x96b8('0x2c')])?util[_0x96b8('0x26')](_0x96b8('0x27'),_0x5b2c24[_0x96b8('0x23')]):_0x5b2c24[_0x96b8('0x2c')];if(_0x477e8b[_0x3f89db][_0x96b8('0x2d')]){_0x477e8b[_0x3f89db][_0x96b8('0x2e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x477e8b[_0x3f89db][_0x96b8('0x2f')]){_0x477e8b[_0x3f89db]['queuecallerexitAt']=moment()[_0x96b8('0x26')](_0x96b8('0x30'));}RpcMemberReport[_0x96b8('0x18')](_0x477e8b[_0x3f89db]);}RpcVoiceQueueReport[_0x96b8('0x31')](_0x477e8b[_0x3f89db]);}};function extractCalleridNumber(_0x255ff8){var _0x3ca974=_0x255ff8['match'](/<(.*?)>/);return _0x3ca974?_0x3ca974[0x1]:_0x255ff8;}Report[_0x96b8('0x13')][_0x96b8('0x32')]=function(_0x46a686){_0x46a686[_0x96b8('0x33')]=_0x46a686['destination']||_0x46a686['exten'];if(_0x46a686['type']==_0x96b8('0x34')){_0x46a686[_0x96b8('0x35')]='queue';_0x46a686[_0x96b8('0x36')]=_0x46a686[_0x96b8('0x37')];if(_0x46a686[_0x96b8('0x38')]==_0x96b8('0x39')){_0x46a686[_0x96b8('0x22')]='';_0x46a686[_0x96b8('0x33')]=extractCalleridNumber(_0x46a686[_0x96b8('0x3a')]);}else if(_0x46a686[_0x96b8('0x38')]==_0x96b8('0x3b')){if(_0x46a686[_0x96b8('0x33')]==_0x96b8('0x3c')){_0x46a686['destination']=extractCalleridNumber(_0x46a686[_0x96b8('0x3d')]);_0x46a686[_0x96b8('0x3e')]=_0x46a686[_0x96b8('0x3f')];_0x46a686[_0x96b8('0x40')]=[_0x46a686['channel'],_0x46a686[_0x96b8('0x41')]=_0x46a686['destinationchannel']][0x0];_0x46a686[_0x96b8('0x3a')]=_0x46a686[_0x96b8('0x3d')];}else{_0x46a686[_0x96b8('0x33')]=_0x46a686[_0x96b8('0x3e')];_0x46a686['calleridnum']=_0x46a686['originatecalleridnum'];if(_0x46a686[_0x96b8('0x42')]==_0x96b8('0x43')){_0x46a686[_0x96b8('0x22')]=_0x46a686['connectedlinenum'];}else{_0x46a686[_0x96b8('0x22')]='';}}}}else{_0x46a686['callerid']=util[_0x96b8('0x26')](_0x96b8('0x44'),_0x46a686[_0x96b8('0x45')],_0x46a686[_0x96b8('0x3e')]);}if(RpcVoiceTransferReport['transfers'][_0x46a686['linkedid']]){var _0x279e66=RpcVoiceTransferReport[_0x96b8('0x46')][_0x46a686[_0x96b8('0x47')]];_0x279e66[_0x96b8('0x48')]=_0x46a686[_0x96b8('0x49')];RpcVoiceTransferReport[_0x96b8('0x1e')](_0x279e66);delete RpcVoiceTransferReport[_0x96b8('0x46')][_0x46a686[_0x96b8('0x47')]];}RpcVoiceCallReport['create'](_0x46a686);if(_0x46a686[_0x96b8('0x4a')]){for(var _0x40ceb4=0x0;_0x40ceb4<_0x46a686[_0x96b8('0x4b')][_0x96b8('0x28')];_0x40ceb4+=0x1){_0x46a686[_0x96b8('0x4c')]=_0x46a686[_0x96b8('0x4b')][_0x40ceb4][_0x96b8('0x4d')];_0x46a686[_0x96b8('0x4e')]=_0x46a686['monitors'][_0x40ceb4][_0x96b8('0x4e')];if(_0x46a686[_0x96b8('0x4f')]==_0x96b8('0x3c')){_0x46a686[_0x96b8('0x3e')]=_0x46a686['connectedlinenum'];_0x46a686[_0x96b8('0x45')]=_0x46a686['connectedlinename'];_0x46a686['connectedlinenum']=_0x46a686[_0x96b8('0x22')];_0x46a686[_0x96b8('0x50')]=_0x46a686[_0x96b8('0x51')];_0x46a686[_0x96b8('0x4f')]=_0x46a686[_0x96b8('0x3f')];}else if(_0x46a686[_0x96b8('0x4f')]==_0x96b8('0x52')){_0x46a686[_0x96b8('0x3e')]=_0x46a686['destination'];_0x46a686[_0x96b8('0x4f')]=_0x46a686[_0x96b8('0x3f')];}RpcVoiceRecording[_0x96b8('0x31')](_0x46a686);}}};Report[_0x96b8('0x13')][_0x96b8('0x53')]=function(_0x1877b0){if(_[_0x96b8('0x54')](_0x1877b0)){_0x1877b0[_0x96b8('0x55')](function(_0x2a50b8){RpcVoiceAgentReport[_0x96b8('0x31')](_0x2a50b8);});}else{RpcVoiceAgentReport[_0x96b8('0x31')](_0x1877b0);}};Report['prototype'][_0x96b8('0x1b')]=function(_0xc1be8a){RpcVoiceDialReport[_0x96b8('0x31')](_0xc1be8a);var _0xca1fac;var _0x1d9db7;var _0x16eed3=_0xc1be8a[_0x96b8('0x41')];if(_['startsWith'](_0x16eed3,_0x96b8('0x56'))){_0x1d9db7=_0x16eed3[_0x96b8('0x57')](_0x16eed3[_0x96b8('0x58')]('/')+0x1,_0x16eed3['indexOf']('@'));_0xca1fac=_[_0x96b8('0x25')](this[_0x96b8('0x11')],function(_0x4d20be){return _0x4d20be['mobile']==_0x1d9db7||_0x4d20be[_0x96b8('0x59')]==_0x1d9db7||_0x4d20be[_0x96b8('0x22')]==_0x1d9db7;});}else{_0x1d9db7=_0x16eed3['substring'](_0x16eed3[_0x96b8('0x58')]('/')+0x1,_0x16eed3[_0x96b8('0x5a')]('-'));_0xca1fac=this[_0x96b8('0x21')](_0x1d9db7);}if(_0xca1fac){_0xc1be8a['interface']=_[_0x96b8('0x24')](_0xca1fac[_0x96b8('0x2c')])?util[_0x96b8('0x26')](_0x96b8('0x27'),_0xca1fac['name']):_0xca1fac['interface'];_0xc1be8a[_0x96b8('0x51')]=_0xca1fac[_0x96b8('0x23')];_0xc1be8a[_0x96b8('0x22')]=_0xca1fac[_0x96b8('0x22')];RpcMemberReport[_0x96b8('0x1b')](_0xc1be8a);}};Report[_0x96b8('0x13')]['blindTransfer']=function(_0x3f47a0){RpcVoiceTransferReport['transfers'][_0x3f47a0['transfererlinkedid']]=_0x3f47a0;};Report[_0x96b8('0x13')][_0x96b8('0x20')]=function(_0x4d257e){RpcVoiceTransferReport['attendedTransfer'](_0x4d257e);};module[_0x96b8('0x5b')]=Report; \ No newline at end of file +var _0xe802=['phone','lastIndexOf','blindTransfer','transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','connectedlinenum','calleridname','connectedlinename','membername','exten','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe802,0x171));var _0x2e80=function(_0x549d64,_0x1353ad){_0x549d64=_0x549d64-0x0;var _0x336463=_0xe802[_0x549d64];return _0x336463;};'use strict';var _=require(_0x2e80('0x0'));var moment=require('moment');var util=require(_0x2e80('0x1'));var config=require(_0x2e80('0x2'));var ami=require(_0x2e80('0x3'));var RpcVoiceAgentReport=require(_0x2e80('0x4'));var RpcVoiceCallReport=require(_0x2e80('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x2e80('0x6'));var RpcVoiceQueueReport=require(_0x2e80('0x7'));var RpcVoiceRecording=require(_0x2e80('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x2e80('0x9'));var VoiceCallReport=require(_0x2e80('0xa'));var VoiceAgentReport=require(_0x2e80('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x2e80('0xc'));function Report(_0x27e1a0){this[_0x2e80('0xd')]=_0x27e1a0;this[_0x2e80('0xe')]=_0x27e1a0[_0x2e80('0xe')];this[_0x2e80('0xf')]=_0x27e1a0['telephones'];}Report[_0x2e80('0x10')]['sync']=function(_0x4af84d){var _0x4d2ac3=new VoiceQueueReport(this[_0x2e80('0xd')]);var _0x36c628=new VoiceAgentReport(this['realtime']);var _0x48008c=new VoiceDialReport(this[_0x2e80('0xd')]);var _0x5c0a48=new VoiceCallReport(this['realtime']);var _0x2b7d33=new UserReport(this['realtime']);if(config['xdr']&&config[_0x2e80('0x11')]['disabled']){ami['on'](_0x2e80('0x12'),this[_0x2e80('0x13')][_0x2e80('0x14')](this));ami['on']('custom:voiceCallReport',this[_0x2e80('0x15')]['bind'](this));ami['on'](_0x2e80('0x16'),this[_0x2e80('0x17')][_0x2e80('0x14')](this));ami['on'](_0x2e80('0x18'),this[_0x2e80('0x19')][_0x2e80('0x14')](this));ami['on'](_0x2e80('0x1a'),this['blindTransfer'][_0x2e80('0x14')](this));ami['on']('attendedtransfer',this[_0x2e80('0x1b')]['bind'](this));}};Report[_0x2e80('0x10')][_0x2e80('0x1c')]=function(_0x255f88){var _0x19c2b3;_0x19c2b3=_[_0x2e80('0x1d')](this[_0x2e80('0xe')],function(_0x11864a){return _0x11864a[_0x2e80('0x1e')]==_0x255f88||_0x11864a[_0x2e80('0x1f')]==_0x255f88;});if(_[_0x2e80('0x20')](_0x19c2b3)){var _0x212e3d=_[_0x2e80('0x1d')](this['telephones'],function(_0x17fc47){return _0x17fc47[_0x2e80('0x1e')]==_0x255f88||_0x17fc47['name']==_0x255f88;});if(_0x212e3d){_0x19c2b3=_[_0x2e80('0x1d')](this[_0x2e80('0xe')],function(_0x3697c1){return _0x3697c1[_0x2e80('0x21')]==util[_0x2e80('0x22')](_0x2e80('0x23'),_0x212e3d[_0x2e80('0x1f')]);});}}return _0x19c2b3;};Report['prototype'][_0x2e80('0x13')]=function(_0x575ba5){for(var _0x241341=0x0;_0x241341<_0x575ba5[_0x2e80('0x24')];_0x241341+=0x1){var _0x2b6b94=this['findAgent'](_0x575ba5[_0x241341]['connectedlinenum']);if(_0x2b6b94){_0x575ba5[_0x241341]['accountcode']=_0x2b6b94[_0x2e80('0x1e')];_0x575ba5[_0x241341][_0x2e80('0x25')]=!![];_0x575ba5[_0x241341][_0x2e80('0x26')]=_0x2b6b94['name'];_0x575ba5[_0x241341][_0x2e80('0x21')]=_[_0x2e80('0x20')](_0x2b6b94[_0x2e80('0x21')])?util[_0x2e80('0x22')]('SIP/%s',_0x2b6b94[_0x2e80('0x1f')]):_0x2b6b94[_0x2e80('0x21')];if(_0x575ba5[_0x241341][_0x2e80('0x27')]){_0x575ba5[_0x241341][_0x2e80('0x28')]=moment()[_0x2e80('0x22')](_0x2e80('0x29'));}if(_0x575ba5[_0x241341][_0x2e80('0x2a')]){_0x575ba5[_0x241341][_0x2e80('0x2b')]=moment()[_0x2e80('0x22')](_0x2e80('0x29'));}RpcMemberReport[_0x2e80('0x13')](_0x575ba5[_0x241341]);}RpcVoiceQueueReport[_0x2e80('0x2c')](_0x575ba5[_0x241341]);}};function extractCalleridNumber(_0x513043){var _0xfbd9ca=_0x513043[_0x2e80('0x2d')](/<(.*?)>/);return _0xfbd9ca?_0xfbd9ca[0x1]:_0x513043;}Report['prototype']['voiceCallReport']=function(_0x14a380){_0x14a380[_0x2e80('0x2e')]=_0x14a380[_0x2e80('0x2e')]||_0x14a380['exten'];if(_0x14a380[_0x2e80('0x2f')]==_0x2e80('0x30')){_0x14a380[_0x2e80('0x31')]=_0x2e80('0x32');_0x14a380[_0x2e80('0x33')]=_0x14a380[_0x2e80('0x32')];if(_0x14a380[_0x2e80('0x34')]==_0x2e80('0x35')){_0x14a380[_0x2e80('0x1e')]='';_0x14a380['destination']=extractCalleridNumber(_0x14a380[_0x2e80('0x36')]);}else if(_0x14a380[_0x2e80('0x34')]==_0x2e80('0x37')){if(_0x14a380[_0x2e80('0x2e')]==_0x2e80('0x38')){_0x14a380[_0x2e80('0x2e')]=extractCalleridNumber(_0x14a380[_0x2e80('0x39')]);_0x14a380[_0x2e80('0x3a')]=_0x14a380[_0x2e80('0x3b')];_0x14a380[_0x2e80('0x3c')]=[_0x14a380['channel'],_0x14a380[_0x2e80('0x3d')]=_0x14a380[_0x2e80('0x3c')]][0x0];_0x14a380['callerid']=_0x14a380[_0x2e80('0x39')];}else{_0x14a380[_0x2e80('0x2e')]=_0x14a380[_0x2e80('0x3a')];_0x14a380[_0x2e80('0x3a')]=_0x14a380[_0x2e80('0x3b')];if(_0x14a380[_0x2e80('0x3e')]==_0x2e80('0x3f')){_0x14a380[_0x2e80('0x1e')]=_0x14a380['connectedlinenum'];}else{_0x14a380['accountcode']='';}}}}else{_0x14a380[_0x2e80('0x36')]=util[_0x2e80('0x22')](_0x2e80('0x40'),_0x14a380['calleridname'],_0x14a380[_0x2e80('0x3a')]);}if(RpcVoiceTransferReport[_0x2e80('0x41')][_0x14a380['linkedid']]){var _0xa29bfd=RpcVoiceTransferReport['transfers'][_0x14a380['linkedid']];_0xa29bfd[_0x2e80('0x42')]=_0x14a380[_0x2e80('0x43')];RpcVoiceTransferReport['blindTransfer'](_0xa29bfd);delete RpcVoiceTransferReport[_0x2e80('0x41')][_0x14a380['linkedid']];}RpcVoiceCallReport['create'](_0x14a380);if(_0x14a380[_0x2e80('0x44')]){for(var _0x192a9d=0x0;_0x192a9d<_0x14a380[_0x2e80('0x45')][_0x2e80('0x24')];_0x192a9d+=0x1){_0x14a380[_0x2e80('0x46')]=_0x14a380[_0x2e80('0x45')][_0x192a9d][_0x2e80('0x47')];_0x14a380['createdAt']=_0x14a380[_0x2e80('0x45')][_0x192a9d][_0x2e80('0x48')];if(_0x14a380['exten']=='xcally-motion-preview'){_0x14a380[_0x2e80('0x3a')]=_0x14a380[_0x2e80('0x49')];_0x14a380[_0x2e80('0x4a')]=_0x14a380[_0x2e80('0x4b')];_0x14a380['connectedlinenum']=_0x14a380['accountcode'];_0x14a380[_0x2e80('0x4b')]=_0x14a380[_0x2e80('0x4c')];_0x14a380[_0x2e80('0x4d')]=_0x14a380['originatecalleridnum'];}else if(_0x14a380[_0x2e80('0x4d')]==_0x2e80('0x4e')){_0x14a380[_0x2e80('0x3a')]=_0x14a380[_0x2e80('0x2e')];_0x14a380[_0x2e80('0x4d')]=_0x14a380['originatecalleridnum'];}RpcVoiceRecording[_0x2e80('0x2c')](_0x14a380);}}};Report['prototype'][_0x2e80('0x17')]=function(_0xc9179d){if(_[_0x2e80('0x4f')](_0xc9179d)){_0xc9179d[_0x2e80('0x50')](function(_0x2af81f){RpcVoiceAgentReport['create'](_0x2af81f);});}else{RpcVoiceAgentReport['create'](_0xc9179d);}};Report[_0x2e80('0x10')][_0x2e80('0x19')]=function(_0x353173){RpcVoiceDialReport[_0x2e80('0x2c')](_0x353173);var _0x1fc40e;var _0x38d0c6;var _0x3ae2f9=_0x353173['channel'];if(_[_0x2e80('0x51')](_0x3ae2f9,_0x2e80('0x52'))){_0x38d0c6=_0x3ae2f9[_0x2e80('0x53')](_0x3ae2f9[_0x2e80('0x54')]('/')+0x1,_0x3ae2f9[_0x2e80('0x54')]('@'));_0x1fc40e=_[_0x2e80('0x1d')](this[_0x2e80('0xe')],function(_0x56ab6b){return _0x56ab6b[_0x2e80('0x55')]==_0x38d0c6||_0x56ab6b[_0x2e80('0x56')]==_0x38d0c6||_0x56ab6b[_0x2e80('0x1e')]==_0x38d0c6;});}else{_0x38d0c6=_0x3ae2f9[_0x2e80('0x53')](_0x3ae2f9[_0x2e80('0x54')]('/')+0x1,_0x3ae2f9[_0x2e80('0x57')]('-'));_0x1fc40e=this['findAgent'](_0x38d0c6);}if(_0x1fc40e){_0x353173['interface']=_[_0x2e80('0x20')](_0x1fc40e[_0x2e80('0x21')])?util['format'](_0x2e80('0x23'),_0x1fc40e[_0x2e80('0x1f')]):_0x1fc40e[_0x2e80('0x21')];_0x353173[_0x2e80('0x4c')]=_0x1fc40e[_0x2e80('0x1f')];_0x353173[_0x2e80('0x1e')]=_0x1fc40e[_0x2e80('0x1e')];RpcMemberReport[_0x2e80('0x19')](_0x353173);}};Report['prototype'][_0x2e80('0x58')]=function(_0x86ca0a){RpcVoiceTransferReport[_0x2e80('0x41')][_0x86ca0a[_0x2e80('0x59')]]=_0x86ca0a;};Report[_0x2e80('0x10')][_0x2e80('0x1b')]=function(_0x28da6b){RpcVoiceTransferReport[_0x2e80('0x1b')](_0x28da6b);};module[_0x2e80('0x5a')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 03c1b13..5dd5d66 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 _0xf452=['stateRegistry','state','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','mobile','phone','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','address','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','then','isNotNull','isUndefined','emit','syncRegistry','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','find'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xf452,0x70));var _0x2f45=function(_0x177b82,_0x520326){_0x177b82=_0x177b82-0x0;var _0x22c43d=_0xf452[_0x177b82];return _0x22c43d;};'use strict';var _=require(_0x2f45('0x0'));var moment=require(_0x2f45('0x1'));var util=require(_0x2f45('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require('../../../config/environment');var logger=require(_0x2f45('0x3'))(_0x2f45('0x4'));var ami=require(_0x2f45('0x5'));config[_0x2f45('0x6')]=_['defaults'](config['redis'],{'host':_0x2f45('0x7'),'port':0x18eb});var io=require(_0x2f45('0x8'))(new Redis(config['redis']));function UserReport(_0x3bd706){this[_0x2f45('0x9')]=_0x3bd706['trunks'];this[_0x2f45('0xa')]=_0x3bd706[_0x2f45('0xa')];this['telephones']=_0x3bd706[_0x2f45('0xb')];ami['on'](_0x2f45('0xc'),this['syncRegistry'][_0x2f45('0xd')](this));ami['on'](_0x2f45('0xe'),this['syncRegistry'][_0x2f45('0xd')](this));ami['on'](_0x2f45('0xf'),this[_0x2f45('0x10')][_0x2f45('0xd')](this));ami['on'](_0x2f45('0x11'),this['syncPeerStatus']['bind'](this));return this[_0x2f45('0x12')]();}function showSipRegistrations(){Promise[_0x2f45('0x13')]()['then'](ami['actionSipShowRegistry']())[_0x2f45('0x14')](function(_0x4f5009){logger[_0x2f45('0x15')](_0x2f45('0x16'),util[_0x2f45('0x17')](_0x4f5009,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x2f45('0x13')]()['then'](ami[_0x2f45('0x18')]())[_0x2f45('0x14')](function(_0x4e691e){logger['error'](_0x2f45('0x19'),util['inspect'](_0x4e691e,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x2f45('0x13')]()['then'](ami[_0x2f45('0x1a')]())[_0x2f45('0x14')](function(_0x40bb43){logger[_0x2f45('0x15')](_0x2f45('0x1b'),util[_0x2f45('0x17')](_0x40bb43,{'showHidden':![],'depth':null}));});}UserReport[_0x2f45('0x1c')][_0x2f45('0x12')]=function(){setInterval(function(){BPromise[_0x2f45('0x13')]()[_0x2f45('0x1d')](showSipRegistrations())[_0x2f45('0x1d')](listDeviceStates())[_0x2f45('0x1d')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x2f45('0x1e')]=function(_0x490b5b){return _0x490b5b!==null&&!_[_0x2f45('0x1f')](_0x490b5b);};UserReport[_0x2f45('0x1c')][_0x2f45('0x20')]=function(_0x147481,_0x3ca050,_0x342aa1){io['to'](_0x147481)[_0x2f45('0x20')](_0x3ca050,_0x342aa1);};UserReport[_0x2f45('0x1c')][_0x2f45('0x21')]=function(_0x20f4ed){try{if(this[_0x2f45('0x1e')](_0x20f4ed)){logger[_0x2f45('0x22')](_0x2f45('0x23'),_0x20f4ed[_0x2f45('0x24')],_0x20f4ed['state']);logger[_0x2f45('0x25')](_0x2f45('0x26'),util[_0x2f45('0x17')](_0x20f4ed,{'showHidden':![],'depth':null}));var _0x592837=_[_0x2f45('0x27')](this[_0x2f45('0x9')],{'defaultuser':_0x20f4ed[_0x2f45('0x24')]});if(_0x592837){_0x20f4ed[_0x2f45('0x28')]=_0x20f4ed[_0x2f45('0x29')];_[_0x2f45('0x2a')](_0x592837,_[_0x2f45('0x2b')](_0x20f4ed,[_0x2f45('0x2c'),'actionid',_0x2f45('0x24'),_0x2f45('0x29')]));logger['debug'](_0x2f45('0x2d'),util[_0x2f45('0x17')](_0x592837,{'showHidden':![],'depth':null}));this['emit'](util[_0x2f45('0x2e')](_0x2f45('0x2f'),_0x592837[_0x2f45('0x30')]),_0x2f45('0x31'),_0x592837);}}}catch(_0x392429){logger[_0x2f45('0x15')](_0x2f45('0x26'),util[_0x2f45('0x17')](_0x392429,{'showHidden':![],'depth':null}));}};UserReport[_0x2f45('0x1c')]['syncDeviceState']=function(_0x5f2e17){try{if(this[_0x2f45('0x1e')](_0x5f2e17)){logger[_0x2f45('0x22')](_0x2f45('0x32'),_0x5f2e17[_0x2f45('0x33')],_0x5f2e17[_0x2f45('0x29')]);logger[_0x2f45('0x25')](_0x2f45('0x34'),util[_0x2f45('0x17')](_0x5f2e17,{'showHidden':![],'depth':null}));if(this[_0x2f45('0xa')][_0x5f2e17[_0x2f45('0x33')]]){if(!this[_0x2f45('0xa')][_0x5f2e17[_0x2f45('0x33')]]['local']||_0x5f2e17[_0x2f45('0x29')][_0x2f45('0x35')]()==_0x2f45('0x36')){this['agents'][_0x5f2e17[_0x2f45('0x33')]][_0x2f45('0x37')]=![];if(this[_0x2f45('0xa')][_0x5f2e17[_0x2f45('0x33')]][_0x2f45('0x29')]!==_0x5f2e17[_0x2f45('0x29')][_0x2f45('0x35')]()){this['agents'][_0x5f2e17['device']][_0x2f45('0x38')]=_[_0x2f45('0x39')](moment()[_0x2f45('0x2e')]('x'));}this['agents'][_0x5f2e17[_0x2f45('0x33')]]['state']=_0x5f2e17[_0x2f45('0x29')][_0x2f45('0x35')]();this[_0x2f45('0xa')][_0x5f2e17[_0x2f45('0x33')]][_0x2f45('0x3a')](_0x5f2e17);}}else if(this[_0x2f45('0xb')][_0x5f2e17[_0x2f45('0x33')]]){if(this[_0x2f45('0xb')][_0x5f2e17[_0x2f45('0x33')]][_0x2f45('0x29')]!==_0x5f2e17[_0x2f45('0x29')][_0x2f45('0x35')]()){this[_0x2f45('0xb')][_0x5f2e17[_0x2f45('0x33')]][_0x2f45('0x38')]=_['toNumber'](moment()[_0x2f45('0x2e')]('x'));}this['telephones'][_0x5f2e17[_0x2f45('0x33')]][_0x2f45('0x29')]=_0x5f2e17[_0x2f45('0x29')]['toLowerCase']();logger['debug'](_0x2f45('0x3b'),util['inspect'](this[_0x2f45('0xb')][_0x5f2e17[_0x2f45('0x33')]],{'showHidden':![],'depth':null}));this[_0x2f45('0x20')](util[_0x2f45('0x2e')](_0x2f45('0x3c'),this[_0x2f45('0xb')][_0x5f2e17['device']]['name']),_0x2f45('0x3d'),this[_0x2f45('0xb')][_0x5f2e17[_0x2f45('0x33')]]);}else if(this[_0x2f45('0x9')][_0x5f2e17['device']]){if(this[_0x2f45('0x9')][_0x5f2e17[_0x2f45('0x33')]]['state']!==_0x5f2e17[_0x2f45('0x29')]['toLowerCase']()){this['trunks'][_0x5f2e17['device']][_0x2f45('0x38')]=_['toNumber'](moment()['format']('x'));}this['trunks'][_0x5f2e17[_0x2f45('0x33')]][_0x2f45('0x29')]=_0x5f2e17[_0x2f45('0x29')][_0x2f45('0x35')]();logger[_0x2f45('0x25')](_0x2f45('0x3e'),util[_0x2f45('0x17')](this[_0x2f45('0x9')][_0x5f2e17['device']],{'showHidden':![],'depth':null}));this[_0x2f45('0x20')](util[_0x2f45('0x2e')]('trunk:%s',this['trunks'][_0x5f2e17[_0x2f45('0x33')]][_0x2f45('0x30')]),_0x2f45('0x31'),this[_0x2f45('0x9')][_0x5f2e17['device']]);}else if(_[_0x2f45('0x3f')](_0x5f2e17[_0x2f45('0x33')],_0x2f45('0x40'))){var _0x1dd10a=_0x5f2e17['device'];var _0x55e397=_0x1dd10a['substring'](_0x1dd10a[_0x2f45('0x41')]('/')+0x1,_0x1dd10a[_0x2f45('0x41')]('@'));var _0x5172d2=_[_0x2f45('0x27')](this[_0x2f45('0xa')],function(_0x2acfab){return _0x2acfab[_0x2f45('0x42')]==_0x55e397||_0x2acfab[_0x2f45('0x43')]==_0x55e397||_0x2acfab['accountcode']==_0x55e397;});if(_0x5172d2){if(_0x5172d2['state']!==_0x5f2e17[_0x2f45('0x29')][_0x2f45('0x35')]()){_0x5172d2[_0x2f45('0x38')]=_[_0x2f45('0x39')](moment()[_0x2f45('0x2e')]('x'));}_0x5172d2[_0x2f45('0x29')]=_0x5f2e17['state'][_0x2f45('0x35')]();_0x5172d2['local']=!![];_0x5172d2['updateStatusRealtime'](_0x5f2e17);}}}}catch(_0x54e82c){logger[_0x2f45('0x15')](_0x2f45('0x34'),util[_0x2f45('0x17')](_0x54e82c,{'showHidden':![],'depth':null}));}};UserReport[_0x2f45('0x1c')][_0x2f45('0x44')]=function(_0x21c986){try{if(this[_0x2f45('0x1e')](_0x21c986)&&this[_0x2f45('0x1e')](_0x21c986[_0x2f45('0x11')])){logger[_0x2f45('0x22')](_0x2f45('0x45'),_0x21c986[_0x2f45('0x46')],_0x21c986['address'],_0x21c986[_0x2f45('0x11')]);logger[_0x2f45('0x25')](_0x2f45('0x47'),util['inspect'](_0x21c986,{'showHidden':![],'depth':null}));if(this[_0x2f45('0xa')][_0x21c986['peer']]){if(!this['agents'][_0x21c986['peer']][_0x2f45('0x37')]||_0x21c986[_0x2f45('0x11')]['toLowerCase']()==_0x2f45('0x48')){this['agents'][_0x21c986[_0x2f45('0x46')]]['local']=![];this[_0x2f45('0xa')][_0x21c986[_0x2f45('0x46')]]['status']=_0x21c986[_0x2f45('0x11')]['toLowerCase']();this[_0x2f45('0xa')][_0x21c986['peer']][_0x2f45('0x49')]=_0x21c986[_0x2f45('0x49')];this[_0x2f45('0xa')][_0x21c986[_0x2f45('0x46')]][_0x2f45('0x3a')](_0x21c986);}}else if(this[_0x2f45('0xb')][_0x21c986['peer']]){this[_0x2f45('0xb')][_0x21c986[_0x2f45('0x46')]]['status']=_0x21c986['peerstatus']['toLowerCase']();this[_0x2f45('0xb')][_0x21c986[_0x2f45('0x46')]][_0x2f45('0x49')]=_0x21c986['address'];logger[_0x2f45('0x25')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x2f45('0xb')][_0x21c986[_0x2f45('0x46')]],{'showHidden':![],'depth':null}));this[_0x2f45('0x20')](util[_0x2f45('0x2e')]('telephone:%s',this[_0x2f45('0xb')][_0x21c986[_0x2f45('0x46')]][_0x2f45('0x30')]),'telephone:save',this[_0x2f45('0xb')][_0x21c986[_0x2f45('0x46')]]);}else if(this[_0x2f45('0x9')][_0x21c986[_0x2f45('0x46')]]){this[_0x2f45('0x9')][_0x21c986['peer']][_0x2f45('0x4a')]=_0x21c986[_0x2f45('0x11')][_0x2f45('0x35')]();this[_0x2f45('0x9')][_0x21c986['peer']]['address']=_0x21c986[_0x2f45('0x49')];logger['debug'](_0x2f45('0x4b'),util[_0x2f45('0x17')](this[_0x2f45('0x9')][_0x21c986[_0x2f45('0x46')]],{'showHidden':![],'depth':null}));this[_0x2f45('0x20')](util['format'](_0x2f45('0x2f'),this[_0x2f45('0x9')][_0x21c986[_0x2f45('0x46')]][_0x2f45('0x30')]),_0x2f45('0x31'),this[_0x2f45('0x9')][_0x21c986[_0x2f45('0x46')]]);}}}catch(_0x35062d){logger[_0x2f45('0x15')](_0x2f45('0x47'),util[_0x2f45('0x17')](_0x35062d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x28ae=['indexOf','phone','accountcode','syncPeerStatus','peer','address','registered','status','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','bind','syncRegistry','syncDeviceState','peerstatus','syncRealtimeShow','resolve','catch','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','error','[userReport][sippeerstatus]','prototype','then','isNotNull','isUndefined','emit','info','username','state','[userReport][registry]','find','merge','omit','event','debug','trunk:%s','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','toNumber','format','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','name','startsWith','Local','substring'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x28ae,0x176));var _0xe28a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28ae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0xe28a('0x0'));var util=require(_0xe28a('0x1'));var Redis=require(_0xe28a('0x2'));var BPromise=require(_0xe28a('0x3'));var config=require(_0xe28a('0x4'));var logger=require(_0xe28a('0x5'))(_0xe28a('0x6'));var ami=require(_0xe28a('0x7'));config[_0xe28a('0x8')]=_['defaults'](config[_0xe28a('0x8')],{'host':_0xe28a('0x9'),'port':0x18eb});var io=require(_0xe28a('0xa'))(new Redis(config[_0xe28a('0x8')]));function UserReport(_0x13511d){this[_0xe28a('0xb')]=_0x13511d[_0xe28a('0xb')];this[_0xe28a('0xc')]=_0x13511d[_0xe28a('0xc')];this[_0xe28a('0xd')]=_0x13511d['telephones'];ami['on']('registryentry',this['syncRegistry'][_0xe28a('0xe')](this));ami['on']('registry',this[_0xe28a('0xf')]['bind'](this));ami['on']('devicestatechange',this[_0xe28a('0x10')]['bind'](this));ami['on'](_0xe28a('0x11'),this['syncPeerStatus'][_0xe28a('0xe')](this));return this[_0xe28a('0x12')]();}function showSipRegistrations(){Promise[_0xe28a('0x13')]()['then'](ami['actionSipShowRegistry']())[_0xe28a('0x14')](function(_0x265446){logger['error']('[userReport][sipshowregistry]',util[_0xe28a('0x15')](_0x265446,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xe28a('0x13')]()['then'](ami[_0xe28a('0x16')]())['catch'](function(_0x3c57ad){logger['error'](_0xe28a('0x17'),util[_0xe28a('0x15')](_0x3c57ad,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xe28a('0x13')]()['then'](ami[_0xe28a('0x18')]())[_0xe28a('0x14')](function(_0x6432f0){logger[_0xe28a('0x19')](_0xe28a('0x1a'),util[_0xe28a('0x15')](_0x6432f0,{'showHidden':![],'depth':null}));});}UserReport[_0xe28a('0x1b')][_0xe28a('0x12')]=function(){setInterval(function(){BPromise[_0xe28a('0x13')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0xe28a('0x1c')](showPeersStatus());},0x32c8);};UserReport[_0xe28a('0x1b')][_0xe28a('0x1d')]=function(_0x35033d){return _0x35033d!==null&&!_[_0xe28a('0x1e')](_0x35033d);};UserReport[_0xe28a('0x1b')][_0xe28a('0x1f')]=function(_0x3a7467,_0x2cf999,_0x518ea6){io['to'](_0x3a7467)[_0xe28a('0x1f')](_0x2cf999,_0x518ea6);};UserReport[_0xe28a('0x1b')][_0xe28a('0xf')]=function(_0x36aa47){try{if(this[_0xe28a('0x1d')](_0x36aa47)){logger[_0xe28a('0x20')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x36aa47[_0xe28a('0x21')],_0x36aa47[_0xe28a('0x22')]);logger['debug'](_0xe28a('0x23'),util[_0xe28a('0x15')](_0x36aa47,{'showHidden':![],'depth':null}));var _0x2a805f=_[_0xe28a('0x24')](this[_0xe28a('0xb')],{'defaultuser':_0x36aa47[_0xe28a('0x21')]});if(_0x2a805f){_0x36aa47['stateRegistry']=_0x36aa47[_0xe28a('0x22')];_[_0xe28a('0x25')](_0x2a805f,_[_0xe28a('0x26')](_0x36aa47,[_0xe28a('0x27'),'actionid',_0xe28a('0x21'),_0xe28a('0x22')]));logger[_0xe28a('0x28')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xe28a('0x15')](_0x2a805f,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xe28a('0x29'),_0x2a805f['name']),_0xe28a('0x2a'),_0x2a805f);}}}catch(_0xaa7be8){logger[_0xe28a('0x19')](_0xe28a('0x23'),util[_0xe28a('0x15')](_0xaa7be8,{'showHidden':![],'depth':null}));}};UserReport[_0xe28a('0x1b')][_0xe28a('0x10')]=function(_0x4b194a){try{if(this[_0xe28a('0x1d')](_0x4b194a)){logger[_0xe28a('0x20')](_0xe28a('0x2b'),_0x4b194a[_0xe28a('0x2c')],_0x4b194a[_0xe28a('0x22')]);logger[_0xe28a('0x28')](_0xe28a('0x2d'),util[_0xe28a('0x15')](_0x4b194a,{'showHidden':![],'depth':null}));if(this[_0xe28a('0xc')][_0x4b194a[_0xe28a('0x2c')]]){if(!this['agents'][_0x4b194a[_0xe28a('0x2c')]][_0xe28a('0x2e')]||_0x4b194a['state'][_0xe28a('0x2f')]()=='inuse'){this[_0xe28a('0xc')][_0x4b194a['device']][_0xe28a('0x2e')]=![];if(this['agents'][_0x4b194a[_0xe28a('0x2c')]][_0xe28a('0x22')]!==_0x4b194a[_0xe28a('0x22')][_0xe28a('0x2f')]()){this[_0xe28a('0xc')][_0x4b194a[_0xe28a('0x2c')]]['stateTime']=_[_0xe28a('0x30')](moment()[_0xe28a('0x31')]('x'));}this[_0xe28a('0xc')][_0x4b194a['device']][_0xe28a('0x22')]=_0x4b194a[_0xe28a('0x22')]['toLowerCase']();this[_0xe28a('0xc')][_0x4b194a[_0xe28a('0x2c')]]['updateStatusRealtime'](_0x4b194a);}}else if(this[_0xe28a('0xd')][_0x4b194a[_0xe28a('0x2c')]]){if(this[_0xe28a('0xd')][_0x4b194a[_0xe28a('0x2c')]][_0xe28a('0x22')]!==_0x4b194a[_0xe28a('0x22')][_0xe28a('0x2f')]()){this[_0xe28a('0xd')][_0x4b194a[_0xe28a('0x2c')]][_0xe28a('0x32')]=_[_0xe28a('0x30')](moment()[_0xe28a('0x31')]('x'));}this[_0xe28a('0xd')][_0x4b194a[_0xe28a('0x2c')]][_0xe28a('0x22')]=_0x4b194a[_0xe28a('0x22')][_0xe28a('0x2f')]();logger[_0xe28a('0x28')](_0xe28a('0x33'),util[_0xe28a('0x15')](this[_0xe28a('0xd')][_0x4b194a[_0xe28a('0x2c')]],{'showHidden':![],'depth':null}));this[_0xe28a('0x1f')](util[_0xe28a('0x31')](_0xe28a('0x34'),this[_0xe28a('0xd')][_0x4b194a[_0xe28a('0x2c')]]['name']),'telephone:save',this['telephones'][_0x4b194a[_0xe28a('0x2c')]]);}else if(this[_0xe28a('0xb')][_0x4b194a[_0xe28a('0x2c')]]){if(this[_0xe28a('0xb')][_0x4b194a[_0xe28a('0x2c')]][_0xe28a('0x22')]!==_0x4b194a['state']['toLowerCase']()){this[_0xe28a('0xb')][_0x4b194a[_0xe28a('0x2c')]][_0xe28a('0x32')]=_[_0xe28a('0x30')](moment()[_0xe28a('0x31')]('x'));}this['trunks'][_0x4b194a[_0xe28a('0x2c')]]['state']=_0x4b194a['state']['toLowerCase']();logger[_0xe28a('0x28')](_0xe28a('0x35'),util[_0xe28a('0x15')](this['trunks'][_0x4b194a[_0xe28a('0x2c')]],{'showHidden':![],'depth':null}));this[_0xe28a('0x1f')](util[_0xe28a('0x31')](_0xe28a('0x29'),this[_0xe28a('0xb')][_0x4b194a[_0xe28a('0x2c')]][_0xe28a('0x36')]),_0xe28a('0x2a'),this['trunks'][_0x4b194a[_0xe28a('0x2c')]]);}else if(_[_0xe28a('0x37')](_0x4b194a[_0xe28a('0x2c')],_0xe28a('0x38'))){var _0xf4dfad=_0x4b194a[_0xe28a('0x2c')];var _0x3c9d02=_0xf4dfad[_0xe28a('0x39')](_0xf4dfad[_0xe28a('0x3a')]('/')+0x1,_0xf4dfad[_0xe28a('0x3a')]('@'));var _0x5fee18=_[_0xe28a('0x24')](this[_0xe28a('0xc')],function(_0x1cacfc){return _0x1cacfc['mobile']==_0x3c9d02||_0x1cacfc[_0xe28a('0x3b')]==_0x3c9d02||_0x1cacfc[_0xe28a('0x3c')]==_0x3c9d02;});if(_0x5fee18){if(_0x5fee18[_0xe28a('0x22')]!==_0x4b194a[_0xe28a('0x22')][_0xe28a('0x2f')]()){_0x5fee18[_0xe28a('0x32')]=_[_0xe28a('0x30')](moment()[_0xe28a('0x31')]('x'));}_0x5fee18[_0xe28a('0x22')]=_0x4b194a[_0xe28a('0x22')][_0xe28a('0x2f')]();_0x5fee18[_0xe28a('0x2e')]=!![];_0x5fee18['updateStatusRealtime'](_0x4b194a);}}}}catch(_0x22d315){logger['error']('[userReport][devicestatechange]',util[_0xe28a('0x15')](_0x22d315,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xe28a('0x3d')]=function(_0x35eec1){try{if(this[_0xe28a('0x1d')](_0x35eec1)&&this[_0xe28a('0x1d')](_0x35eec1[_0xe28a('0x11')])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x35eec1[_0xe28a('0x3e')],_0x35eec1[_0xe28a('0x3f')],_0x35eec1['peerstatus']);logger['debug']('[userReport][peerstatus]',util[_0xe28a('0x15')](_0x35eec1,{'showHidden':![],'depth':null}));if(this[_0xe28a('0xc')][_0x35eec1[_0xe28a('0x3e')]]){if(!this[_0xe28a('0xc')][_0x35eec1[_0xe28a('0x3e')]]['local']||_0x35eec1[_0xe28a('0x11')][_0xe28a('0x2f')]()==_0xe28a('0x40')){this['agents'][_0x35eec1['peer']][_0xe28a('0x2e')]=![];this[_0xe28a('0xc')][_0x35eec1[_0xe28a('0x3e')]][_0xe28a('0x41')]=_0x35eec1['peerstatus'][_0xe28a('0x2f')]();this['agents'][_0x35eec1[_0xe28a('0x3e')]][_0xe28a('0x3f')]=_0x35eec1[_0xe28a('0x3f')];this['agents'][_0x35eec1[_0xe28a('0x3e')]][_0xe28a('0x42')](_0x35eec1);}}else if(this[_0xe28a('0xd')][_0x35eec1[_0xe28a('0x3e')]]){this[_0xe28a('0xd')][_0x35eec1['peer']][_0xe28a('0x41')]=_0x35eec1[_0xe28a('0x11')][_0xe28a('0x2f')]();this['telephones'][_0x35eec1[_0xe28a('0x3e')]][_0xe28a('0x3f')]=_0x35eec1[_0xe28a('0x3f')];logger['debug'](_0xe28a('0x43'),util[_0xe28a('0x15')](this['telephones'][_0x35eec1['peer']],{'showHidden':![],'depth':null}));this[_0xe28a('0x1f')](util[_0xe28a('0x31')](_0xe28a('0x34'),this[_0xe28a('0xd')][_0x35eec1['peer']][_0xe28a('0x36')]),_0xe28a('0x44'),this[_0xe28a('0xd')][_0x35eec1[_0xe28a('0x3e')]]);}else if(this[_0xe28a('0xb')][_0x35eec1[_0xe28a('0x3e')]]){this[_0xe28a('0xb')][_0x35eec1[_0xe28a('0x3e')]][_0xe28a('0x41')]=_0x35eec1[_0xe28a('0x11')][_0xe28a('0x2f')]();this[_0xe28a('0xb')][_0x35eec1[_0xe28a('0x3e')]][_0xe28a('0x3f')]=_0x35eec1['address'];logger['debug'](_0xe28a('0x45'),util['inspect'](this['trunks'][_0x35eec1[_0xe28a('0x3e')]],{'showHidden':![],'depth':null}));this[_0xe28a('0x1f')](util['format'](_0xe28a('0x29'),this[_0xe28a('0xb')][_0x35eec1[_0xe28a('0x3e')]][_0xe28a('0x36')]),'trunk:save',this[_0xe28a('0xb')][_0x35eec1[_0xe28a('0x3e')]]);}}}catch(_0x4ebd2a){logger[_0xe28a('0x19')](_0xe28a('0x46'),util['inspect'](_0x4ebd2a,{'showHidden':![],'depth':null}));}};module[_0xe28a('0x47')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 96a5ab2..891130f 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 _0x4187=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberpenalty','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','hangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','queue','inbound','merge','omit','event','privilege','debug','inspect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','user:agentconnect','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]','agentcomplete','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]'];(function(_0x548a22,_0x266250){var _0x4644b0=function(_0x1a34cb){while(--_0x1a34cb){_0x548a22['push'](_0x548a22['shift']());}};_0x4644b0(++_0x266250);}(_0x4187,0xbf));var _0x7418=function(_0x163489,_0x5bfed0){_0x163489=_0x163489-0x0;var _0xef3ef6=_0x4187[_0x163489];return _0xef3ef6;};'use strict';var _=require(_0x7418('0x0'));var moment=require(_0x7418('0x1'));var util=require(_0x7418('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x7418('0x3'))(_0x7418('0x4'));var ami=require('../ami');config[_0x7418('0x5')]=_[_0x7418('0x6')](config['redis'],{'host':_0x7418('0x7'),'port':0x18eb});var io=require(_0x7418('0x8'))(new Redis(config[_0x7418('0x5')]));function VoiceAgentReport(_0x417823){this[_0x7418('0x9')]={};this[_0x7418('0xa')]=_0x417823['voiceQueues'];this[_0x7418('0xb')]=_0x417823['agents'];this[_0x7418('0xc')]={};ami['on'](_0x7418('0xd'),this[_0x7418('0xe')][_0x7418('0xf')](this));ami['on'](_0x7418('0x10'),this[_0x7418('0x11')][_0x7418('0xf')](this));ami['on'](_0x7418('0x12'),this[_0x7418('0x13')][_0x7418('0xf')](this));ami['on'](_0x7418('0x14'),this[_0x7418('0x15')][_0x7418('0xf')](this));ami['on']('agentcomplete',this[_0x7418('0x16')][_0x7418('0xf')](this));ami['on']('varset',this['syncVarSet'][_0x7418('0xf')](this));ami['on'](_0x7418('0x17'),this['syncHangup'][_0x7418('0xf')](this));ami['on'](_0x7418('0x18'),this[_0x7418('0x19')][_0x7418('0xf')](this));ami['on']('musiconholdstop',this[_0x7418('0x1a')][_0x7418('0xf')](this));ami['on'](_0x7418('0x1b'),this[_0x7418('0x1c')][_0x7418('0xf')](this));ami['on'](_0x7418('0x1d'),this[_0x7418('0x1e')]['bind'](this));}VoiceAgentReport['prototype'][_0x7418('0x1f')]=function(_0x244ab2,_0x4d4467,_0x56235b){io['to'](_0x244ab2)[_0x7418('0x1f')](_0x4d4467,_0x56235b);};VoiceAgentReport[_0x7418('0x20')][_0x7418('0x21')]=function(_0xf8deb7){return _0xf8deb7!==null&&!_[_0x7418('0x22')](_0xf8deb7);};VoiceAgentReport[_0x7418('0x20')]['syncAgentCalled']=function(_0xc7159c){try{if(this['isNotNull'](_0xc7159c)){logger[_0x7418('0x23')](_0x7418('0x24'),_0xc7159c[_0x7418('0x25')],_0xc7159c[_0x7418('0x26')],_0xc7159c[_0x7418('0x27')]);logger['debug'](_0x7418('0x28'),_0xc7159c['uniqueid'],util['inspect'](_0xc7159c,{'showHidden':![],'depth':null}));if(_[_0x7418('0x22')](this['channels'][_0xc7159c[_0x7418('0x25')]])){this[_0x7418('0x9')][_0xc7159c[_0x7418('0x25')]]={};}if(_[_0x7418('0x22')](this[_0x7418('0x9')][_0xc7159c['uniqueid']][_0xc7159c[_0x7418('0x27')]])){this[_0x7418('0x9')][_0xc7159c[_0x7418('0x25')]][_0xc7159c[_0x7418('0x27')]]={'agentcalledAt':moment()[_0x7418('0x29')](_0x7418('0x2a')),'lastevent':_0x7418('0x2b'),'mandatoryDisposition':this[_0x7418('0xa')][_0xc7159c['queue']]?this[_0x7418('0xa')][_0xc7159c['queue']][_0x7418('0x2c')]||![]:![],'type':this[_0x7418('0xa')][_0xc7159c['queue']]?this[_0x7418('0xa')][_0xc7159c[_0x7418('0x2d')]]['type']||_0x7418('0x2e'):_0x7418('0x2e'),'variables':this['variables'][_0xc7159c[_0x7418('0x25')]]};}_[_0x7418('0x2f')](this[_0x7418('0x9')][_0xc7159c[_0x7418('0x25')]][_0xc7159c['destuniqueid']],_[_0x7418('0x30')](_0xc7159c,[_0x7418('0x31'),_0x7418('0x32')]));logger[_0x7418('0x33')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0xc7159c[_0x7418('0x25')],util[_0x7418('0x34')](this[_0x7418('0x9')][_0xc7159c[_0x7418('0x25')]][_0xc7159c[_0x7418('0x27')]],{'showHidden':![],'depth':null}));ami[_0x7418('0x1f')]('custom:agentcalled',this[_0x7418('0x9')][_0xc7159c[_0x7418('0x25')]][_0xc7159c[_0x7418('0x27')]]);logger[_0x7418('0x33')](_0x7418('0x35'),_0xc7159c[_0x7418('0x25')],util[_0x7418('0x34')](this[_0x7418('0x9')][_0xc7159c['uniqueid']][_0xc7159c[_0x7418('0x27')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x7418('0x29')](_0x7418('0x36'),_0xc7159c['membername']),_0x7418('0x37'),this[_0x7418('0x9')][_0xc7159c[_0x7418('0x25')]][_0xc7159c[_0x7418('0x27')]]);}}catch(_0x2d6754){logger[_0x7418('0x38')](_0x7418('0x39'),_0xc7159c['uniqueid'],util[_0x7418('0x34')](_0x2d6754,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7418('0x20')][_0x7418('0x11')]=function(_0xcfe3fc){try{if(this['isNotNull'](_0xcfe3fc)){if(this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]]){logger['debug'](_0x7418('0x3a'),_0xcfe3fc[_0x7418('0x25')],util[_0x7418('0x34')](_0xcfe3fc,{'showHidden':![],'depth':null}));for(var _0x5a3ec8 in this['channels'][_0xcfe3fc['uniqueid']]){if(this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0x7418('0x3b')](_0x5a3ec8)){if(_0xcfe3fc['destuniqueid']===_0x5a3ec8){logger[_0x7418('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0xcfe3fc['uniqueid'],_0xcfe3fc[_0x7418('0x26')],_0xcfe3fc[_0x7418('0x27')]);this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x3c')]=moment()[_0x7418('0x29')](_0x7418('0x2a'));this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x3d')]=_0xcfe3fc['connectedlinename'];this['channels'][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x3e')]=_0xcfe3fc[_0x7418('0x3e')];this['channels'][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x3f')]=_0xcfe3fc[_0x7418('0x3f')];this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x40')]=_0xcfe3fc[_0x7418('0x40')];this['channels'][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x41')]=_0xcfe3fc['holdtime'];this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x42')]=_0x7418('0x43');_['merge'](this[_0x7418('0xb')][_0xcfe3fc[_0x7418('0x44')]],_[_0x7418('0x45')](_0xcfe3fc,[_0x7418('0x2d'),_0x7418('0x46')]));logger['debug'](_0x7418('0x47'),_0xcfe3fc[_0x7418('0x25')],util[_0x7418('0x34')](this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0xcfe3fc[_0x7418('0x27')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentconnect',this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0xcfe3fc[_0x7418('0x27')]]);logger[_0x7418('0x33')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0xcfe3fc[_0x7418('0x25')],util[_0x7418('0x34')](this[_0x7418('0x9')][_0xcfe3fc['uniqueid']][_0xcfe3fc[_0x7418('0x27')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0xcfe3fc[_0x7418('0x26')]),_0x7418('0x48'),this['channels'][_0xcfe3fc[_0x7418('0x25')]][_0xcfe3fc[_0x7418('0x27')]]);}else if(!this['channels'][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x12')]&&!this['channels'][_0xcfe3fc['uniqueid']][_0x5a3ec8]['agentcomplete']){logger[_0x7418('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0xcfe3fc['uniqueid'],this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x26')],_0x5a3ec8);this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x12')]=!![];this[_0x7418('0x9')][_0xcfe3fc['uniqueid']][_0x5a3ec8]['agentringnoanswerAt']=moment()[_0x7418('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x49')]=_0xcfe3fc[_0x7418('0x27')];this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x4a')]=_0xcfe3fc[_0x7418('0x26')];this['channels'][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x42')]=_0x7418('0x4b');this[_0x7418('0x9')][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8][_0x7418('0x4c')]=_0x7418('0x4b');logger[_0x7418('0x33')](_0x7418('0x4d'),_0xcfe3fc[_0x7418('0x25')],util[_0x7418('0x34')](this['channels'][_0xcfe3fc[_0x7418('0x25')]][_0x5a3ec8],{'showHidden':![],'depth':null}));ami[_0x7418('0x1f')](_0x7418('0x4e'),this[_0x7418('0x9')][_0xcfe3fc['uniqueid']][_0x5a3ec8]);}}}}}}catch(_0x4759c8){logger['error'](_0x7418('0x4f'),_0xcfe3fc[_0x7418('0x25')],util[_0x7418('0x34')](_0x4759c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7418('0x20')][_0x7418('0x13')]=function(_0x53a9d5){try{if(this[_0x7418('0x21')](_0x53a9d5)){logger[_0x7418('0x33')](_0x7418('0x50'),_0x53a9d5[_0x7418('0x25')],util[_0x7418('0x34')](_0x53a9d5,{'showHidden':![],'depth':null}));if(this[_0x7418('0x9')][_0x53a9d5[_0x7418('0x25')]]&&this[_0x7418('0x9')][_0x53a9d5[_0x7418('0x25')]][_0x53a9d5[_0x7418('0x27')]]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x53a9d5[_0x7418('0x25')],_0x53a9d5[_0x7418('0x26')],_0x53a9d5[_0x7418('0x27')]);this[_0x7418('0x9')][_0x53a9d5['uniqueid']][_0x53a9d5[_0x7418('0x27')]][_0x7418('0x12')]=!![];this['channels'][_0x53a9d5['uniqueid']][_0x53a9d5[_0x7418('0x27')]][_0x7418('0x51')]=moment()['format'](_0x7418('0x2a'));this['channels'][_0x53a9d5[_0x7418('0x25')]][_0x53a9d5['destuniqueid']][_0x7418('0x42')]=_0x7418('0x52');this['channels'][_0x53a9d5[_0x7418('0x25')]][_0x53a9d5['destuniqueid']][_0x7418('0x4c')]=_0x7418('0x52');logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x53a9d5['uniqueid'],util[_0x7418('0x34')](this['channels'][_0x53a9d5[_0x7418('0x25')]][_0x53a9d5[_0x7418('0x27')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentringnoanswer',this[_0x7418('0x9')][_0x53a9d5['uniqueid']][_0x53a9d5[_0x7418('0x27')]]);}}}catch(_0x10592f){logger[_0x7418('0x38')](_0x7418('0x53'),_0x53a9d5['uniqueid'],util['inspect'](_0x10592f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7418('0x20')]['syncQueueCallerAbandon']=function(_0x7e3ac0){try{if(this[_0x7418('0x21')](_0x7e3ac0)){logger[_0x7418('0x33')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x7e3ac0['uniqueid'],util[_0x7418('0x34')](_0x7e3ac0,{'showHidden':![],'depth':null}));if(this[_0x7418('0x9')][_0x7e3ac0[_0x7418('0x25')]]){for(var _0x30038a in this[_0x7418('0x9')][_0x7e3ac0[_0x7418('0x25')]]){if(this['channels'][_0x7e3ac0['uniqueid']][_0x7418('0x3b')](_0x30038a)&&!this[_0x7418('0x9')][_0x7e3ac0['uniqueid']][_0x30038a][_0x7418('0x12')]&&!this[_0x7418('0x9')][_0x7e3ac0[_0x7418('0x25')]][_0x30038a][_0x7418('0x54')]){logger['info']('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x7e3ac0[_0x7418('0x25')],this[_0x7418('0x9')][_0x7e3ac0[_0x7418('0x25')]][_0x30038a][_0x7418('0x26')],_0x30038a);this[_0x7418('0x9')][_0x7e3ac0[_0x7418('0x25')]][_0x30038a]['agentringnoanswer']=!![];this['channels'][_0x7e3ac0[_0x7418('0x25')]][_0x30038a][_0x7418('0x51')]=moment()[_0x7418('0x29')](_0x7418('0x2a'));this[_0x7418('0x9')][_0x7e3ac0[_0x7418('0x25')]][_0x30038a][_0x7418('0x42')]='abandoned';this[_0x7418('0x9')][_0x7e3ac0[_0x7418('0x25')]][_0x30038a][_0x7418('0x4c')]=_0x7418('0x55');logger[_0x7418('0x33')](_0x7418('0x56'),_0x7e3ac0['uniqueid'],util[_0x7418('0x34')](this[_0x7418('0x9')][_0x7e3ac0[_0x7418('0x25')]][_0x30038a],{'showHidden':![],'depth':null}));ami[_0x7418('0x1f')](_0x7418('0x57'),this[_0x7418('0x9')][_0x7e3ac0[_0x7418('0x25')]][_0x30038a]);}}}}}catch(_0x144090){logger[_0x7418('0x38')](_0x7418('0x58'),_0x7e3ac0[_0x7418('0x25')],util[_0x7418('0x34')](_0x144090,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7418('0x20')][_0x7418('0x16')]=function(_0x40bfd5){try{if(this['isNotNull'](_0x40bfd5)){logger[_0x7418('0x33')](_0x7418('0x59'),_0x40bfd5['uniqueid'],util[_0x7418('0x34')](_0x40bfd5,{'showHidden':![],'depth':null}));if(this[_0x7418('0x9')][_0x40bfd5['uniqueid']]){for(var _0xbf2fab in this[_0x7418('0x9')][_0x40bfd5[_0x7418('0x25')]]){if(this[_0x7418('0x9')][_0x40bfd5['uniqueid']][_0x7418('0x3b')](_0xbf2fab)){if(this[_0x7418('0x9')][_0x40bfd5[_0x7418('0x25')]][_0xbf2fab][_0x7418('0x3c')]&&!this['channels'][_0x40bfd5['uniqueid']][_0xbf2fab][_0x7418('0x54')]){logger[_0x7418('0x23')](_0x7418('0x5a'),_0x40bfd5[_0x7418('0x25')],this['channels'][_0x40bfd5[_0x7418('0x25')]][_0xbf2fab]['membername'],_0xbf2fab);this[_0x7418('0x9')][_0x40bfd5[_0x7418('0x25')]][_0xbf2fab][_0x7418('0x54')]=!![];this['channels'][_0x40bfd5[_0x7418('0x25')]][_0xbf2fab][_0x7418('0x5b')]=moment()[_0x7418('0x29')](_0x7418('0x2a'));this[_0x7418('0x9')][_0x40bfd5['uniqueid']][_0xbf2fab][_0x7418('0x42')]=_0x7418('0x5c');this[_0x7418('0x9')][_0x40bfd5[_0x7418('0x25')]][_0xbf2fab][_0x7418('0x4c')]=_0x40bfd5[_0x7418('0x4c')]==_0x7418('0x5d')?'agent':_0x40bfd5['reason'];this[_0x7418('0x9')][_0x40bfd5[_0x7418('0x25')]][_0xbf2fab][_0x7418('0x5e')]=_0x40bfd5[_0x7418('0x5e')];if(this['voiceQueues'][_0x40bfd5[_0x7418('0x2d')]]&&this[_0x7418('0xa')][_0x40bfd5[_0x7418('0x2d')]][_0x7418('0x5f')]){this[_0x7418('0x9')][_0x40bfd5['uniqueid']][_0xbf2fab][_0x7418('0x60')]=this[_0x7418('0xa')][_0x40bfd5[_0x7418('0x2d')]][_0x7418('0x61')];this[_0x7418('0x9')][_0x40bfd5[_0x7418('0x25')]][_0xbf2fab]['agentacw']=!![];}this[_0x7418('0xb')][_0x40bfd5[_0x7418('0x44')]]=_['omit'](this[_0x7418('0xb')][_0x40bfd5['interface']],[_0x7418('0x2d'),_0x7418('0x46')]);logger[_0x7418('0x33')](_0x7418('0x62'),_0x40bfd5[_0x7418('0x25')],util[_0x7418('0x34')](this[_0x7418('0x9')][_0x40bfd5[_0x7418('0x25')]][_0xbf2fab],{'showHidden':![],'depth':null}));ami['emit'](_0x7418('0x63'),this['channels'][_0x40bfd5['uniqueid']][_0xbf2fab]);logger[_0x7418('0x33')](_0x7418('0x64'),_0x40bfd5[_0x7418('0x25')],util[_0x7418('0x34')](this[_0x7418('0x9')][_0x40bfd5[_0x7418('0x25')]][_0xbf2fab],{'showHidden':![],'depth':null}));this[_0x7418('0x1f')](util['format'](_0x7418('0x36'),_0x40bfd5['membername']),'user:agentcomplete',this['channels'][_0x40bfd5[_0x7418('0x25')]][_0xbf2fab]);}}}}}}catch(_0x32db0c){logger[_0x7418('0x38')](_0x7418('0x65'),_0x40bfd5[_0x7418('0x25')],util['inspect'](_0x32db0c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7418('0x20')][_0x7418('0x66')]=function(_0x27553f){try{if(this[_0x7418('0x21')](_0x27553f)){logger[_0x7418('0x33')](_0x7418('0x67'),_0x27553f['uniqueid'],util[_0x7418('0x34')](_0x27553f,{'showHidden':![],'depth':null}));this['addVariable'](_0x27553f['uniqueid'],_[_0x7418('0x68')](_0x27553f[_0x7418('0x69')])[0x0],_0x27553f['value']);if(this[_0x7418('0x9')][_0x27553f[_0x7418('0x25')]]){for(var _0x1fbe66 in this[_0x7418('0x9')][_0x27553f[_0x7418('0x25')]]){if(this[_0x7418('0x9')][_0x27553f[_0x7418('0x25')]][_0x7418('0x3b')](_0x1fbe66)){logger['info'](_0x7418('0x6a'),_0x27553f['uniqueid'],_0x1fbe66,_[_0x7418('0x68')](_0x27553f[_0x7418('0x69')])[0x0],_0x27553f[_0x7418('0x6b')]);if(_[_0x7418('0x22')](this[_0x7418('0x9')][_0x27553f[_0x7418('0x25')]][_0x1fbe66][_0x7418('0xc')])){this[_0x7418('0x9')][_0x27553f[_0x7418('0x25')]][_0x1fbe66]['variables']={};}this[_0x7418('0x9')][_0x27553f[_0x7418('0x25')]][_0x1fbe66]['variables']=this[_0x7418('0xc')][_0x27553f[_0x7418('0x25')]];}}}}}catch(_0x373f0b){logger[_0x7418('0x38')](_0x7418('0x6c'),_0x27553f['uniqueid'],util[_0x7418('0x34')](_0x373f0b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7418('0x20')]['addVariable']=function(_0x24eb4c,_0x5d96c8,_0x1ae071){var _0x5a2376=[_0x7418('0x6d'),_0x7418('0x6e'),_0x7418('0x6f'),_0x7418('0x70'),_0x7418('0x71'),_0x7418('0x72'),_0x7418('0x73'),_0x7418('0x74'),_0x7418('0x75'),_0x7418('0x76'),_0x7418('0x77'),'bridgepvtcallid','membercalls',_0x7418('0x78'),'memberinterface','memberlastcall',_0x7418('0x26'),_0x7418('0x79'),'memberrealtime'];if(!_['isNil'](_0x5d96c8)&&!_[_0x7418('0x7a')](_0x5a2376,_0x5d96c8)){if(_[_0x7418('0x22')](this[_0x7418('0xc')][_0x24eb4c])){this['variables'][_0x24eb4c]={};}this['variables'][_0x24eb4c][_0x5d96c8]=_0x1ae071;}};VoiceAgentReport[_0x7418('0x20')][_0x7418('0x7b')]=function(_0xbca716){try{if(this[_0x7418('0x21')](_0xbca716)){logger[_0x7418('0x33')](_0x7418('0x7c'),_0xbca716[_0x7418('0x25')],util[_0x7418('0x34')](_0xbca716,{'showHidden':![],'depth':null}));if(this['channels'][_0xbca716['uniqueid']]){for(var _0x205c8a in this[_0x7418('0x9')][_0xbca716[_0x7418('0x25')]]){if(this[_0x7418('0x9')][_0xbca716[_0x7418('0x25')]][_0x7418('0x3b')](_0x205c8a)){if(this[_0x7418('0x9')][_0xbca716[_0x7418('0x25')]][_0x205c8a][_0x7418('0x4c')]=='transfer'&&this['channels'][_0xbca716[_0x7418('0x25')]][_0x205c8a][_0x7418('0x54')]){logger[_0x7418('0x23')](_0x7418('0x7d'),_0xbca716[_0x7418('0x25')],_0x205c8a);this[_0x7418('0x9')][_0xbca716['uniqueid']][_0x205c8a]['agentcompleteAt']=moment()[_0x7418('0x29')](_0x7418('0x2a'));}}}logger[_0x7418('0x33')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0xbca716[_0x7418('0x25')],util[_0x7418('0x34')](_['values'](this['channels'][_0xbca716[_0x7418('0x25')]]),{'showHidden':![],'depth':null}));ami[_0x7418('0x1f')]('custom:voiceAgentReport',_[_0x7418('0x7e')](this[_0x7418('0x9')][_0xbca716['uniqueid']]));delete this['channels'][_0xbca716[_0x7418('0x25')]];}if(this[_0x7418('0xc')][_0xbca716[_0x7418('0x25')]]){delete this[_0x7418('0xc')][_0xbca716[_0x7418('0x25')]];}}}catch(_0x1ce71c){logger[_0x7418('0x38')](_0x7418('0x7f'),_0xbca716[_0x7418('0x25')],util[_0x7418('0x34')](_0x1ce71c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7418('0x20')][_0x7418('0x1c')]=function(_0x1ad745){try{if(this[_0x7418('0x21')](_0x1ad745)){logger[_0x7418('0x33')](_0x7418('0x80'),_0x1ad745[_0x7418('0x25')],util[_0x7418('0x34')](_0x1ad745,{'showHidden':![],'depth':null}));if(this[_0x7418('0x9')][_0x1ad745[_0x7418('0x81')]]){for(var _0x5068ab in this['channels'][_0x1ad745['transfereeuniqueid']]){if(this[_0x7418('0x9')][_0x1ad745['transfereeuniqueid']]['hasOwnProperty'](_0x5068ab)){if(_0x1ad745['origtransfereruniqueid']===_0x5068ab){logger[_0x7418('0x23')](_0x7418('0x82'),_0x1ad745[_0x7418('0x25')],this[_0x7418('0x9')][_0x1ad745[_0x7418('0x81')]][_0x5068ab][_0x7418('0x26')],_0x5068ab);var _0x3a1c2d=moment();this['channels'][_0x1ad745[_0x7418('0x81')]][_0x5068ab][_0x7418('0x54')]=!![];this[_0x7418('0x9')][_0x1ad745['transfereeuniqueid']][_0x5068ab][_0x7418('0x5b')]=moment()[_0x7418('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7418('0x9')][_0x1ad745['transfereeuniqueid']][_0x5068ab]['lastevent']='complete';this['channels'][_0x1ad745[_0x7418('0x81')]][_0x5068ab]['reason']=_0x7418('0x5d');this[_0x7418('0x9')][_0x1ad745[_0x7418('0x81')]][_0x5068ab][_0x7418('0x5e')]=_0x3a1c2d[_0x7418('0x83')](this[_0x7418('0x9')][_0x1ad745[_0x7418('0x81')]][_0x5068ab][_0x7418('0x3c')],_0x7418('0x84'));}}}}if(this['channels'][_0x1ad745['secondtransfereruniqueid']]){var _0x4fcfef=this[_0x7418('0x9')][_0x1ad745[_0x7418('0x85')]];this[_0x7418('0x9')][_0x1ad745[_0x7418('0x85')]]=this[_0x7418('0x9')][_0x1ad745[_0x7418('0x81')]];this[_0x7418('0x9')][_0x1ad745['transfereeuniqueid']]=_0x4fcfef;}}}catch(_0x1a1e24){logger[_0x7418('0x38')](_0x7418('0x86'),_0x1ad745['uniqueid'],util[_0x7418('0x34')](_0x1a1e24,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7418('0x20')][_0x7418('0x1e')]=function(_0x4ea282){try{if(this[_0x7418('0x21')](_0x4ea282)){logger[_0x7418('0x33')](_0x7418('0x87'),_0x4ea282['uniqueid'],util[_0x7418('0x34')](_0x4ea282,{'showHidden':![],'depth':null}));if(this['channels'][_0x4ea282[_0x7418('0x81')]]){for(var _0x49d2c4 in this['channels'][_0x4ea282[_0x7418('0x81')]]){if(this[_0x7418('0x9')][_0x4ea282[_0x7418('0x81')]][_0x7418('0x3b')](_0x49d2c4)){if(_0x4ea282[_0x7418('0x88')]===_0x49d2c4){logger[_0x7418('0x23')](_0x7418('0x89'),_0x4ea282['uniqueid'],this[_0x7418('0x9')][_0x4ea282['transfereeuniqueid']][_0x49d2c4][_0x7418('0x26')],_0x49d2c4);var _0x5e27b4=moment();this[_0x7418('0x9')][_0x4ea282[_0x7418('0x81')]][_0x49d2c4][_0x7418('0x54')]=!![];this[_0x7418('0x9')][_0x4ea282['transfereeuniqueid']][_0x49d2c4]['agentcompleteAt']=_0x5e27b4;this[_0x7418('0x9')][_0x4ea282[_0x7418('0x81')]][_0x49d2c4][_0x7418('0x42')]=_0x7418('0x5c');this[_0x7418('0x9')][_0x4ea282[_0x7418('0x81')]][_0x49d2c4][_0x7418('0x4c')]=_0x7418('0x5d');this['channels'][_0x4ea282['transfereeuniqueid']][_0x49d2c4][_0x7418('0x5e')]=_0x5e27b4[_0x7418('0x83')](this[_0x7418('0x9')][_0x4ea282['transfereeuniqueid']][_0x49d2c4][_0x7418('0x3c')],_0x7418('0x84'));}}}}}}catch(_0x15a3cc){logger['error'](_0x7418('0x8a'),_0x4ea282['uniqueid'],util['inspect'](_0x15a3cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7418('0x20')]['syncMusicOnHoldStart']=function(_0x833d86){var _0x124313='';try{if(this[_0x7418('0x21')](_0x833d86)){logger['debug'](_0x7418('0x8b'),_0x833d86[_0x7418('0x25')],util[_0x7418('0x34')](_0x833d86,{'showHidden':![],'depth':null}));if(_0x833d86['channel']){_0x124313=_0x833d86[_0x7418('0x8c')][_0x7418('0x8d')](0x0,_0x833d86['channel'][_0x7418('0x8e')]('-'));if(this['agents'][_0x124313]){logger[_0x7418('0x23')](_0x7418('0x8f'),_0x833d86['uniqueid'],_0x124313);this[_0x7418('0xb')][_0x124313][_0x7418('0x90')]=!![];}}}}catch(_0x37db2e){logger[_0x7418('0x38')](_0x7418('0x91'),_0x833d86[_0x7418('0x25')],util[_0x7418('0x34')](_0x37db2e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7418('0x20')][_0x7418('0x1a')]=function(_0x5df702){var _0x307553='';try{if(this[_0x7418('0x21')](_0x5df702)){logger['debug'](_0x7418('0x92'),_0x5df702['uniqueid'],util['inspect'](_0x5df702,{'showHidden':![],'depth':null}));if(_0x5df702[_0x7418('0x8c')]){_0x307553=_0x5df702[_0x7418('0x8c')]['substring'](0x0,_0x5df702[_0x7418('0x8c')][_0x7418('0x8e')]('-'));if(this[_0x7418('0xb')][_0x307553]){logger[_0x7418('0x23')](_0x7418('0x93'),_0x5df702['uniqueid'],_0x307553);this[_0x7418('0xb')][_0x307553][_0x7418('0x90')]=![];}}}}catch(_0x3ceb81){logger[_0x7418('0x38')](_0x7418('0x94'),_0x5df702['uniqueid'],util['inspect'](_0x3ceb81,{'showHidden':![],'depth':null}));}};module[_0x7418('0x95')]=VoiceAgentReport; \ No newline at end of file +var _0xd5bc=['syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]','exports','util','../../../config/logger','redis','localhost','socket.io-emitter','voiceQueues','agents','variables','agentconnect','syncAgentConnect','bind','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','info','uniqueid','destuniqueid','debug','inspect','channels','format','called','queue','mandatoryDisposition','inbound','merge','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]'];(function(_0x379782,_0x5bae01){var _0x192389=function(_0x1d8178){while(--_0x1d8178){_0x379782['push'](_0x379782['shift']());}};_0x192389(++_0x5bae01);}(_0xd5bc,0xd3));var _0xcd5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xcd5b('0x0'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xcd5b('0x1'))('ami');var ami=require('../ami');config[_0xcd5b('0x2')]=_['defaults'](config[_0xcd5b('0x2')],{'host':_0xcd5b('0x3'),'port':0x18eb});var io=require(_0xcd5b('0x4'))(new Redis(config[_0xcd5b('0x2')]));function VoiceAgentReport(_0x126405){this['channels']={};this['voiceQueues']=_0x126405[_0xcd5b('0x5')];this[_0xcd5b('0x6')]=_0x126405['agents'];this[_0xcd5b('0x7')]={};ami['on']('agentcalled',this['syncAgentCalled']['bind'](this));ami['on'](_0xcd5b('0x8'),this[_0xcd5b('0x9')][_0xcd5b('0xa')](this));ami['on'](_0xcd5b('0xb'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xcd5b('0xc'),this[_0xcd5b('0xd')][_0xcd5b('0xa')](this));ami['on']('agentcomplete',this[_0xcd5b('0xe')][_0xcd5b('0xa')](this));ami['on'](_0xcd5b('0xf'),this[_0xcd5b('0x10')]['bind'](this));ami['on'](_0xcd5b('0x11'),this[_0xcd5b('0x12')][_0xcd5b('0xa')](this));ami['on'](_0xcd5b('0x13'),this[_0xcd5b('0x14')]['bind'](this));ami['on'](_0xcd5b('0x15'),this['syncMusicOnHoldStop'][_0xcd5b('0xa')](this));ami['on'](_0xcd5b('0x16'),this[_0xcd5b('0x17')]['bind'](this));ami['on'](_0xcd5b('0x18'),this[_0xcd5b('0x19')]['bind'](this));}VoiceAgentReport['prototype'][_0xcd5b('0x1a')]=function(_0x24c44b,_0x5bec20,_0x50ff66){io['to'](_0x24c44b)[_0xcd5b('0x1a')](_0x5bec20,_0x50ff66);};VoiceAgentReport[_0xcd5b('0x1b')][_0xcd5b('0x1c')]=function(_0x175457){return _0x175457!==null&&!_[_0xcd5b('0x1d')](_0x175457);};VoiceAgentReport['prototype'][_0xcd5b('0x1e')]=function(_0x564cae){try{if(this[_0xcd5b('0x1c')](_0x564cae)){logger[_0xcd5b('0x1f')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x564cae[_0xcd5b('0x20')],_0x564cae['membername'],_0x564cae[_0xcd5b('0x21')]);logger[_0xcd5b('0x22')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x564cae[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x564cae,{'showHidden':![],'depth':null}));if(_[_0xcd5b('0x1d')](this[_0xcd5b('0x24')][_0x564cae[_0xcd5b('0x20')]])){this['channels'][_0x564cae[_0xcd5b('0x20')]]={};}if(_[_0xcd5b('0x1d')](this[_0xcd5b('0x24')][_0x564cae[_0xcd5b('0x20')]][_0x564cae[_0xcd5b('0x21')]])){this['channels'][_0x564cae['uniqueid']][_0x564cae['destuniqueid']]={'agentcalledAt':moment()[_0xcd5b('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xcd5b('0x26'),'mandatoryDisposition':this['voiceQueues'][_0x564cae[_0xcd5b('0x27')]]?this[_0xcd5b('0x5')][_0x564cae['queue']][_0xcd5b('0x28')]||![]:![],'type':this['voiceQueues'][_0x564cae[_0xcd5b('0x27')]]?this['voiceQueues'][_0x564cae['queue']]['type']||_0xcd5b('0x29'):_0xcd5b('0x29'),'variables':this['variables'][_0x564cae['uniqueid']]};}_[_0xcd5b('0x2a')](this[_0xcd5b('0x24')][_0x564cae[_0xcd5b('0x20')]][_0x564cae[_0xcd5b('0x21')]],_[_0xcd5b('0x2b')](_0x564cae,[_0xcd5b('0x2c'),'privilege']));logger[_0xcd5b('0x22')](_0xcd5b('0x2d'),_0x564cae[_0xcd5b('0x20')],util[_0xcd5b('0x23')](this[_0xcd5b('0x24')][_0x564cae[_0xcd5b('0x20')]][_0x564cae[_0xcd5b('0x21')]],{'showHidden':![],'depth':null}));ami[_0xcd5b('0x1a')]('custom:agentcalled',this[_0xcd5b('0x24')][_0x564cae[_0xcd5b('0x20')]][_0x564cae['destuniqueid']]);logger[_0xcd5b('0x22')](_0xcd5b('0x2e'),_0x564cae[_0xcd5b('0x20')],util[_0xcd5b('0x23')](this['channels'][_0x564cae['uniqueid']][_0x564cae[_0xcd5b('0x21')]],{'showHidden':![],'depth':null}));this[_0xcd5b('0x1a')](util[_0xcd5b('0x25')](_0xcd5b('0x2f'),_0x564cae[_0xcd5b('0x30')]),_0xcd5b('0x31'),this[_0xcd5b('0x24')][_0x564cae[_0xcd5b('0x20')]][_0x564cae[_0xcd5b('0x21')]]);}}catch(_0x329c76){logger[_0xcd5b('0x32')](_0xcd5b('0x33'),_0x564cae['uniqueid'],util[_0xcd5b('0x23')](_0x329c76,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd5b('0x1b')][_0xcd5b('0x9')]=function(_0x387770){try{if(this[_0xcd5b('0x1c')](_0x387770)){if(this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]]){logger[_0xcd5b('0x22')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x387770[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x387770,{'showHidden':![],'depth':null}));for(var _0x48d764 in this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]]){if(this[_0xcd5b('0x24')][_0x387770['uniqueid']][_0xcd5b('0x34')](_0x48d764)){if(_0x387770['destuniqueid']===_0x48d764){logger['info'](_0xcd5b('0x35'),_0x387770[_0xcd5b('0x20')],_0x387770[_0xcd5b('0x30')],_0x387770['destuniqueid']);this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764][_0xcd5b('0x36')]=moment()['format'](_0xcd5b('0x37'));this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764]['connectedlinename']=_0x387770['connectedlinename'];this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764][_0xcd5b('0x38')]=_0x387770[_0xcd5b('0x38')];this[_0xcd5b('0x24')][_0x387770['uniqueid']][_0x48d764][_0xcd5b('0x39')]=_0x387770[_0xcd5b('0x39')];this[_0xcd5b('0x24')][_0x387770['uniqueid']][_0x48d764][_0xcd5b('0x3a')]=_0x387770['destchannelstatedesc'];this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764]['holdtime']=_0x387770[_0xcd5b('0x3b')];this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764]['lastevent']=_0xcd5b('0x3c');_[_0xcd5b('0x2a')](this['agents'][_0x387770[_0xcd5b('0x3d')]],_[_0xcd5b('0x3e')](_0x387770,[_0xcd5b('0x27'),_0xcd5b('0x3f')]));logger[_0xcd5b('0x22')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x387770[_0xcd5b('0x20')],util['inspect'](this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x387770['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xcd5b('0x1a')](_0xcd5b('0x40'),this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x387770['destuniqueid']]);logger['debug'](_0xcd5b('0x41'),_0x387770[_0xcd5b('0x20')],util[_0xcd5b('0x23')](this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x387770['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util[_0xcd5b('0x25')](_0xcd5b('0x2f'),_0x387770[_0xcd5b('0x30')]),_0xcd5b('0x42'),this[_0xcd5b('0x24')][_0x387770['uniqueid']][_0x387770[_0xcd5b('0x21')]]);}else if(!this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764]['agentringnoanswer']&&!this['channels'][_0x387770['uniqueid']][_0x48d764][_0xcd5b('0x43')]){logger[_0xcd5b('0x1f')](_0xcd5b('0x44'),_0x387770[_0xcd5b('0x20')],this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764][_0xcd5b('0x30')],_0x48d764);this[_0xcd5b('0x24')][_0x387770['uniqueid']][_0x48d764]['agentringnoanswer']=!![];this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764][_0xcd5b('0x45')]=moment()[_0xcd5b('0x25')](_0xcd5b('0x37'));this[_0xcd5b('0x24')][_0x387770['uniqueid']][_0x48d764]['answeredelsewheredestinationuniqueid']=_0x387770[_0xcd5b('0x21')];this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764][_0xcd5b('0x46')]=_0x387770[_0xcd5b('0x30')];this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764][_0xcd5b('0x47')]=_0xcd5b('0x48');this['channels'][_0x387770['uniqueid']][_0x48d764][_0xcd5b('0x49')]='answered_elsewhere';logger[_0xcd5b('0x22')](_0xcd5b('0x4a'),_0x387770[_0xcd5b('0x20')],util['inspect'](this[_0xcd5b('0x24')][_0x387770[_0xcd5b('0x20')]][_0x48d764],{'showHidden':![],'depth':null}));ami[_0xcd5b('0x1a')](_0xcd5b('0x4b'),this['channels'][_0x387770[_0xcd5b('0x20')]][_0x48d764]);}}}}}}catch(_0x48cba6){logger[_0xcd5b('0x32')](_0xcd5b('0x4c'),_0x387770[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x48cba6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd5b('0x1b')][_0xcd5b('0x4d')]=function(_0x19277e){try{if(this[_0xcd5b('0x1c')](_0x19277e)){logger[_0xcd5b('0x22')](_0xcd5b('0x4e'),_0x19277e[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x19277e,{'showHidden':![],'depth':null}));if(this[_0xcd5b('0x24')][_0x19277e[_0xcd5b('0x20')]]&&this[_0xcd5b('0x24')][_0x19277e[_0xcd5b('0x20')]][_0x19277e['destuniqueid']]){logger[_0xcd5b('0x1f')](_0xcd5b('0x4f'),_0x19277e[_0xcd5b('0x20')],_0x19277e[_0xcd5b('0x30')],_0x19277e['destuniqueid']);this[_0xcd5b('0x24')][_0x19277e[_0xcd5b('0x20')]][_0x19277e[_0xcd5b('0x21')]][_0xcd5b('0xb')]=!![];this['channels'][_0x19277e[_0xcd5b('0x20')]][_0x19277e['destuniqueid']][_0xcd5b('0x45')]=moment()['format'](_0xcd5b('0x37'));this['channels'][_0x19277e[_0xcd5b('0x20')]][_0x19277e[_0xcd5b('0x21')]][_0xcd5b('0x47')]=_0xcd5b('0x50');this['channels'][_0x19277e[_0xcd5b('0x20')]][_0x19277e[_0xcd5b('0x21')]]['reason']=_0xcd5b('0x50');logger[_0xcd5b('0x22')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x19277e[_0xcd5b('0x20')],util[_0xcd5b('0x23')](this[_0xcd5b('0x24')][_0x19277e['uniqueid']][_0x19277e[_0xcd5b('0x21')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentringnoanswer',this[_0xcd5b('0x24')][_0x19277e['uniqueid']][_0x19277e[_0xcd5b('0x21')]]);}}}catch(_0x51eb7e){logger[_0xcd5b('0x32')](_0xcd5b('0x51'),_0x19277e[_0xcd5b('0x20')],util['inspect'](_0x51eb7e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd5b('0x1b')][_0xcd5b('0xd')]=function(_0x568834){try{if(this[_0xcd5b('0x1c')](_0x568834)){logger[_0xcd5b('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x568834['uniqueid'],util[_0xcd5b('0x23')](_0x568834,{'showHidden':![],'depth':null}));if(this[_0xcd5b('0x24')][_0x568834[_0xcd5b('0x20')]]){for(var _0x10c97f in this[_0xcd5b('0x24')][_0x568834[_0xcd5b('0x20')]]){if(this[_0xcd5b('0x24')][_0x568834[_0xcd5b('0x20')]]['hasOwnProperty'](_0x10c97f)&&!this[_0xcd5b('0x24')][_0x568834[_0xcd5b('0x20')]][_0x10c97f][_0xcd5b('0xb')]&&!this[_0xcd5b('0x24')][_0x568834['uniqueid']][_0x10c97f][_0xcd5b('0x43')]){logger[_0xcd5b('0x1f')](_0xcd5b('0x52'),_0x568834[_0xcd5b('0x20')],this[_0xcd5b('0x24')][_0x568834[_0xcd5b('0x20')]][_0x10c97f][_0xcd5b('0x30')],_0x10c97f);this[_0xcd5b('0x24')][_0x568834[_0xcd5b('0x20')]][_0x10c97f]['agentringnoanswer']=!![];this['channels'][_0x568834['uniqueid']][_0x10c97f][_0xcd5b('0x45')]=moment()[_0xcd5b('0x25')](_0xcd5b('0x37'));this[_0xcd5b('0x24')][_0x568834[_0xcd5b('0x20')]][_0x10c97f][_0xcd5b('0x47')]='abandoned';this[_0xcd5b('0x24')][_0x568834[_0xcd5b('0x20')]][_0x10c97f][_0xcd5b('0x49')]=_0xcd5b('0x53');logger['debug'](_0xcd5b('0x54'),_0x568834[_0xcd5b('0x20')],util['inspect'](this[_0xcd5b('0x24')][_0x568834[_0xcd5b('0x20')]][_0x10c97f],{'showHidden':![],'depth':null}));ami[_0xcd5b('0x1a')](_0xcd5b('0x55'),this[_0xcd5b('0x24')][_0x568834['uniqueid']][_0x10c97f]);}}}}}catch(_0x2e5e31){logger[_0xcd5b('0x32')]('[%s][voiceAgentReport][queuecallerabandon]',_0x568834[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x2e5e31,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd5b('0x1b')][_0xcd5b('0xe')]=function(_0x55f962){try{if(this[_0xcd5b('0x1c')](_0x55f962)){logger[_0xcd5b('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x55f962[_0xcd5b('0x20')],util['inspect'](_0x55f962,{'showHidden':![],'depth':null}));if(this[_0xcd5b('0x24')][_0x55f962[_0xcd5b('0x20')]]){for(var _0x57366a in this[_0xcd5b('0x24')][_0x55f962[_0xcd5b('0x20')]]){if(this[_0xcd5b('0x24')][_0x55f962[_0xcd5b('0x20')]][_0xcd5b('0x34')](_0x57366a)){if(this[_0xcd5b('0x24')][_0x55f962[_0xcd5b('0x20')]][_0x57366a][_0xcd5b('0x36')]&&!this[_0xcd5b('0x24')][_0x55f962[_0xcd5b('0x20')]][_0x57366a]['agentcomplete']){logger[_0xcd5b('0x1f')](_0xcd5b('0x56'),_0x55f962[_0xcd5b('0x20')],this['channels'][_0x55f962[_0xcd5b('0x20')]][_0x57366a][_0xcd5b('0x30')],_0x57366a);this[_0xcd5b('0x24')][_0x55f962[_0xcd5b('0x20')]][_0x57366a][_0xcd5b('0x43')]=!![];this[_0xcd5b('0x24')][_0x55f962[_0xcd5b('0x20')]][_0x57366a][_0xcd5b('0x57')]=moment()[_0xcd5b('0x25')](_0xcd5b('0x37'));this['channels'][_0x55f962[_0xcd5b('0x20')]][_0x57366a][_0xcd5b('0x47')]=_0xcd5b('0x58');this['channels'][_0x55f962[_0xcd5b('0x20')]][_0x57366a][_0xcd5b('0x49')]=_0x55f962[_0xcd5b('0x49')]==_0xcd5b('0x59')?_0xcd5b('0x5a'):_0x55f962['reason'];this[_0xcd5b('0x24')][_0x55f962[_0xcd5b('0x20')]][_0x57366a][_0xcd5b('0x5b')]=_0x55f962[_0xcd5b('0x5b')];if(this[_0xcd5b('0x5')][_0x55f962[_0xcd5b('0x27')]]&&this[_0xcd5b('0x5')][_0x55f962['queue']][_0xcd5b('0x5c')]){this[_0xcd5b('0x24')][_0x55f962[_0xcd5b('0x20')]][_0x57366a][_0xcd5b('0x5d')]=this[_0xcd5b('0x5')][_0x55f962['queue']][_0xcd5b('0x5e')];this[_0xcd5b('0x24')][_0x55f962['uniqueid']][_0x57366a][_0xcd5b('0x5f')]=!![];}this[_0xcd5b('0x6')][_0x55f962[_0xcd5b('0x3d')]]=_[_0xcd5b('0x2b')](this[_0xcd5b('0x6')][_0x55f962[_0xcd5b('0x3d')]],['queue','destconnectedlinenum']);logger[_0xcd5b('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x55f962[_0xcd5b('0x20')],util['inspect'](this[_0xcd5b('0x24')][_0x55f962[_0xcd5b('0x20')]][_0x57366a],{'showHidden':![],'depth':null}));ami[_0xcd5b('0x1a')]('custom:agentcomplete',this[_0xcd5b('0x24')][_0x55f962['uniqueid']][_0x57366a]);logger[_0xcd5b('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x55f962[_0xcd5b('0x20')],util[_0xcd5b('0x23')](this['channels'][_0x55f962[_0xcd5b('0x20')]][_0x57366a],{'showHidden':![],'depth':null}));this[_0xcd5b('0x1a')](util[_0xcd5b('0x25')](_0xcd5b('0x2f'),_0x55f962[_0xcd5b('0x30')]),_0xcd5b('0x60'),this['channels'][_0x55f962[_0xcd5b('0x20')]][_0x57366a]);}}}}}}catch(_0xfe2865){logger[_0xcd5b('0x32')](_0xcd5b('0x61'),_0x55f962['uniqueid'],util[_0xcd5b('0x23')](_0xfe2865,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd5b('0x1b')][_0xcd5b('0x10')]=function(_0x8759c2){try{if(this[_0xcd5b('0x1c')](_0x8759c2)){logger['debug'](_0xcd5b('0x62'),_0x8759c2[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x8759c2,{'showHidden':![],'depth':null}));this[_0xcd5b('0x63')](_0x8759c2[_0xcd5b('0x20')],_[_0xcd5b('0x64')](_0x8759c2[_0xcd5b('0x65')])[0x0],_0x8759c2['value']);if(this[_0xcd5b('0x24')][_0x8759c2[_0xcd5b('0x20')]]){for(var _0x536c38 in this[_0xcd5b('0x24')][_0x8759c2[_0xcd5b('0x20')]]){if(this[_0xcd5b('0x24')][_0x8759c2['uniqueid']][_0xcd5b('0x34')](_0x536c38)){logger[_0xcd5b('0x1f')](_0xcd5b('0x66'),_0x8759c2['uniqueid'],_0x536c38,_[_0xcd5b('0x64')](_0x8759c2[_0xcd5b('0x65')])[0x0],_0x8759c2[_0xcd5b('0x67')]);if(_[_0xcd5b('0x1d')](this[_0xcd5b('0x24')][_0x8759c2[_0xcd5b('0x20')]][_0x536c38][_0xcd5b('0x7')])){this[_0xcd5b('0x24')][_0x8759c2[_0xcd5b('0x20')]][_0x536c38][_0xcd5b('0x7')]={};}this[_0xcd5b('0x24')][_0x8759c2[_0xcd5b('0x20')]][_0x536c38][_0xcd5b('0x7')]=this[_0xcd5b('0x7')][_0x8759c2[_0xcd5b('0x20')]];}}}}}catch(_0xb234ba){logger[_0xcd5b('0x32')](_0xcd5b('0x68'),_0x8759c2[_0xcd5b('0x20')],util['inspect'](_0xb234ba,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd5b('0x1b')][_0xcd5b('0x63')]=function(_0x1023ce,_0x209349,_0x215b72){var _0x58b104=[_0xcd5b('0x69'),_0xcd5b('0x6a'),_0xcd5b('0x6b'),'rtpaudioqosjitterbridged',_0xcd5b('0x6c'),'rtpaudioqoslossbridged',_0xcd5b('0x6d'),_0xcd5b('0x6e'),_0xcd5b('0x6f'),_0xcd5b('0x70'),_0xcd5b('0x71'),_0xcd5b('0x72'),_0xcd5b('0x73'),'memberdynamic',_0xcd5b('0x74'),_0xcd5b('0x75'),'membername',_0xcd5b('0x76'),_0xcd5b('0x77')];if(!_['isNil'](_0x209349)&&!_[_0xcd5b('0x78')](_0x58b104,_0x209349)){if(_[_0xcd5b('0x1d')](this['variables'][_0x1023ce])){this[_0xcd5b('0x7')][_0x1023ce]={};}this[_0xcd5b('0x7')][_0x1023ce][_0x209349]=_0x215b72;}};VoiceAgentReport[_0xcd5b('0x1b')][_0xcd5b('0x12')]=function(_0x2e0926){try{if(this[_0xcd5b('0x1c')](_0x2e0926)){logger['debug'](_0xcd5b('0x79'),_0x2e0926[_0xcd5b('0x20')],util['inspect'](_0x2e0926,{'showHidden':![],'depth':null}));if(this['channels'][_0x2e0926[_0xcd5b('0x20')]]){for(var _0x260c8b in this['channels'][_0x2e0926[_0xcd5b('0x20')]]){if(this[_0xcd5b('0x24')][_0x2e0926[_0xcd5b('0x20')]]['hasOwnProperty'](_0x260c8b)){if(this[_0xcd5b('0x24')][_0x2e0926[_0xcd5b('0x20')]][_0x260c8b][_0xcd5b('0x49')]==_0xcd5b('0x59')&&this['channels'][_0x2e0926['uniqueid']][_0x260c8b][_0xcd5b('0x43')]){logger[_0xcd5b('0x1f')](_0xcd5b('0x7a'),_0x2e0926[_0xcd5b('0x20')],_0x260c8b);this[_0xcd5b('0x24')][_0x2e0926[_0xcd5b('0x20')]][_0x260c8b][_0xcd5b('0x57')]=moment()[_0xcd5b('0x25')](_0xcd5b('0x37'));}}}logger[_0xcd5b('0x22')](_0xcd5b('0x7b'),_0x2e0926['uniqueid'],util[_0xcd5b('0x23')](_['values'](this[_0xcd5b('0x24')][_0x2e0926[_0xcd5b('0x20')]]),{'showHidden':![],'depth':null}));ami[_0xcd5b('0x1a')](_0xcd5b('0x7c'),_['values'](this[_0xcd5b('0x24')][_0x2e0926[_0xcd5b('0x20')]]));delete this[_0xcd5b('0x24')][_0x2e0926[_0xcd5b('0x20')]];}if(this[_0xcd5b('0x7')][_0x2e0926[_0xcd5b('0x20')]]){delete this[_0xcd5b('0x7')][_0x2e0926['uniqueid']];}}}catch(_0x2795c6){logger[_0xcd5b('0x32')](_0xcd5b('0x7d'),_0x2e0926[_0xcd5b('0x20')],util['inspect'](_0x2795c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd5b('0x1b')]['syncAttendedTransfer']=function(_0x1b409c){try{if(this[_0xcd5b('0x1c')](_0x1b409c)){logger[_0xcd5b('0x22')](_0xcd5b('0x7e'),_0x1b409c[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x1b409c,{'showHidden':![],'depth':null}));if(this['channels'][_0x1b409c[_0xcd5b('0x7f')]]){for(var _0x4eff02 in this['channels'][_0x1b409c[_0xcd5b('0x7f')]]){if(this[_0xcd5b('0x24')][_0x1b409c[_0xcd5b('0x7f')]][_0xcd5b('0x34')](_0x4eff02)){if(_0x1b409c[_0xcd5b('0x80')]===_0x4eff02){logger[_0xcd5b('0x1f')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1b409c[_0xcd5b('0x20')],this[_0xcd5b('0x24')][_0x1b409c['transfereeuniqueid']][_0x4eff02]['membername'],_0x4eff02);var _0x498204=moment();this['channels'][_0x1b409c['transfereeuniqueid']][_0x4eff02][_0xcd5b('0x43')]=!![];this[_0xcd5b('0x24')][_0x1b409c['transfereeuniqueid']][_0x4eff02][_0xcd5b('0x57')]=moment()[_0xcd5b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcd5b('0x24')][_0x1b409c[_0xcd5b('0x7f')]][_0x4eff02]['lastevent']='complete';this['channels'][_0x1b409c[_0xcd5b('0x7f')]][_0x4eff02][_0xcd5b('0x49')]=_0xcd5b('0x59');this[_0xcd5b('0x24')][_0x1b409c[_0xcd5b('0x7f')]][_0x4eff02][_0xcd5b('0x5b')]=_0x498204[_0xcd5b('0x81')](this[_0xcd5b('0x24')][_0x1b409c[_0xcd5b('0x7f')]][_0x4eff02]['agentconnectAt'],_0xcd5b('0x82'));}}}}if(this[_0xcd5b('0x24')][_0x1b409c['secondtransfereruniqueid']]){var _0x14d634=this[_0xcd5b('0x24')][_0x1b409c[_0xcd5b('0x83')]];this[_0xcd5b('0x24')][_0x1b409c['secondtransfereruniqueid']]=this[_0xcd5b('0x24')][_0x1b409c['transfereeuniqueid']];this[_0xcd5b('0x24')][_0x1b409c[_0xcd5b('0x7f')]]=_0x14d634;}}}catch(_0x126bbc){logger[_0xcd5b('0x32')](_0xcd5b('0x84'),_0x1b409c[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x126bbc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd5b('0x1b')][_0xcd5b('0x19')]=function(_0xd85033){try{if(this['isNotNull'](_0xd85033)){logger[_0xcd5b('0x22')](_0xcd5b('0x85'),_0xd85033[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0xd85033,{'showHidden':![],'depth':null}));if(this[_0xcd5b('0x24')][_0xd85033[_0xcd5b('0x7f')]]){for(var _0x482a5a in this[_0xcd5b('0x24')][_0xd85033[_0xcd5b('0x7f')]]){if(this[_0xcd5b('0x24')][_0xd85033[_0xcd5b('0x7f')]]['hasOwnProperty'](_0x482a5a)){if(_0xd85033['transfereruniqueid']===_0x482a5a){logger[_0xcd5b('0x1f')](_0xcd5b('0x86'),_0xd85033[_0xcd5b('0x20')],this['channels'][_0xd85033[_0xcd5b('0x7f')]][_0x482a5a][_0xcd5b('0x30')],_0x482a5a);var _0x5f44ff=moment();this[_0xcd5b('0x24')][_0xd85033[_0xcd5b('0x7f')]][_0x482a5a][_0xcd5b('0x43')]=!![];this[_0xcd5b('0x24')][_0xd85033[_0xcd5b('0x7f')]][_0x482a5a]['agentcompleteAt']=_0x5f44ff;this[_0xcd5b('0x24')][_0xd85033['transfereeuniqueid']][_0x482a5a][_0xcd5b('0x47')]=_0xcd5b('0x58');this[_0xcd5b('0x24')][_0xd85033[_0xcd5b('0x7f')]][_0x482a5a]['reason']='transfer';this[_0xcd5b('0x24')][_0xd85033[_0xcd5b('0x7f')]][_0x482a5a][_0xcd5b('0x5b')]=_0x5f44ff[_0xcd5b('0x81')](this['channels'][_0xd85033[_0xcd5b('0x7f')]][_0x482a5a][_0xcd5b('0x36')],_0xcd5b('0x82'));}}}}}}catch(_0x48b877){logger[_0xcd5b('0x32')](_0xcd5b('0x87'),_0xd85033[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x48b877,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd5b('0x1b')][_0xcd5b('0x14')]=function(_0x4ba04f){var _0x57bdfe='';try{if(this[_0xcd5b('0x1c')](_0x4ba04f)){logger['debug'](_0xcd5b('0x88'),_0x4ba04f[_0xcd5b('0x20')],util['inspect'](_0x4ba04f,{'showHidden':![],'depth':null}));if(_0x4ba04f['channel']){_0x57bdfe=_0x4ba04f[_0xcd5b('0x89')][_0xcd5b('0x8a')](0x0,_0x4ba04f['channel'][_0xcd5b('0x8b')]('-'));if(this['agents'][_0x57bdfe]){logger['info'](_0xcd5b('0x8c'),_0x4ba04f['uniqueid'],_0x57bdfe);this[_0xcd5b('0x6')][_0x57bdfe]['onhold']=!![];}}}}catch(_0x9311f4){logger[_0xcd5b('0x32')]('[%s][voiceAgentReport][musiconholdstart]',_0x4ba04f[_0xcd5b('0x20')],util['inspect'](_0x9311f4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcd5b('0x8d')]=function(_0x230b8c){var _0xaad856='';try{if(this['isNotNull'](_0x230b8c)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x230b8c[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x230b8c,{'showHidden':![],'depth':null}));if(_0x230b8c[_0xcd5b('0x89')]){_0xaad856=_0x230b8c['channel'][_0xcd5b('0x8a')](0x0,_0x230b8c[_0xcd5b('0x89')][_0xcd5b('0x8b')]('-'));if(this[_0xcd5b('0x6')][_0xaad856]){logger[_0xcd5b('0x1f')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x230b8c[_0xcd5b('0x20')],_0xaad856);this[_0xcd5b('0x6')][_0xaad856]['onhold']=![];}}}}catch(_0x52bac0){logger[_0xcd5b('0x32')](_0xcd5b('0x8e'),_0x230b8c[_0xcd5b('0x20')],util[_0xcd5b('0x23')](_0x52bac0,{'showHidden':![],'depth':null}));}};module[_0xcd5b('0x8f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 11c64f4..91d7f0c 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 _0x68a5=['[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','xcally-motion-preview','connectedlinenum','connectedlinename','toNumber','UserId','membername','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','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','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','diff','from-sip','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','getSettings','Action','StopMixMonitor','catch','finally','destinationchannel','BlindTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfereeuniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','../../../config/environment','../../../config/logger','../model/channel','../rpc/setting','unknown','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','agi','dial','playback','NO\x20ANSWER','BUSY','FAILED','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newchannel','newstate','syncNewState','varset','syncVarSet','syncHangup','attendedtransfer','blindtransfer','musiconholdstart','musiconholdstop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','syncNewCallerId','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','pick','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','merge','keys','split','destconnectedlinenum','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','duration','subtract','seconds','disposition','lastapplication','startsWith','cdr(','match'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x68a5,0x67));var _0x568a=function(_0xec3b33,_0x5cdf24){_0xec3b33=_0xec3b33-0x0;var _0xdb039d=_0x68a5[_0xec3b33];return _0xdb039d;};'use strict';var BPromise=require(_0x568a('0x0'));var _=require(_0x568a('0x1'));var moment=require(_0x568a('0x2'));var util=require(_0x568a('0x3'));var path=require(_0x568a('0x4'));var Redis=require('ioredis');var config=require(_0x568a('0x5'));var logger=require(_0x568a('0x6'))('ami');var ami=require('../ami');var Channel=require(_0x568a('0x7'));var RpcSetting=require(_0x568a('0x8'));var statusDesc=[_0x568a('0x9'),'not_inuse',_0x568a('0xa'),_0x568a('0xb'),_0x568a('0xc'),'unavailable',_0x568a('0xd'),_0x568a('0xe'),_0x568a('0xf')];var applications=[_0x568a('0x10'),_0x568a('0x11'),_0x568a('0x12'),_0x568a('0x13'),_0x568a('0x14'),'voicemail'];var dispositions=[_0x568a('0x15'),'FAILED','FAILED',_0x568a('0x15'),'NO\x20ANSWER',_0x568a('0x15'),'ANSWERED',_0x568a('0x16'),'FAILED','FAILED',_0x568a('0x17')];var actions={};config[_0x568a('0x18')]=_[_0x568a('0x19')](config[_0x568a('0x18')],{'host':_0x568a('0x1a'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x568a('0x18')]));function VoiceCallReport(_0x13acbc){this['channels']=_0x13acbc[_0x568a('0x1b')];this[_0x568a('0x1c')]=_0x13acbc[_0x568a('0x1c')];this[_0x568a('0x1d')]={};ami['on'](_0x568a('0x1e'),this[_0x568a('0x1f')]['bind'](this));ami['on'](_0x568a('0x20'),this[_0x568a('0x1f')][_0x568a('0x21')](this));ami['on'](_0x568a('0x22'),this['syncNewChannel']['bind'](this));ami['on'](_0x568a('0x23'),this[_0x568a('0x24')][_0x568a('0x21')](this));ami['on'](_0x568a('0x25'),this[_0x568a('0x26')][_0x568a('0x21')](this));ami['on']('hangup',this[_0x568a('0x27')][_0x568a('0x21')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x568a('0x21')](this));ami['on'](_0x568a('0x28'),this['syncAttendedTransfer'][_0x568a('0x21')](this));ami['on'](_0x568a('0x29'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x568a('0x2a'),this['syncMusicOnHoldStart'][_0x568a('0x21')](this));ami['on'](_0x568a('0x2b'),this['syncMusicOnHoldStop']['bind'](this));try{logger['info'](_0x568a('0x2c'));ami[_0x568a('0x2d')]();}catch(_0x5d596e){logger[_0x568a('0x2e')](_0x568a('0x2f'),util[_0x568a('0x30')](_0x5d596e,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x568a('0x31')][_0x568a('0x32')]=function(_0x110bc8){return _0x110bc8!==null&&!_[_0x568a('0x33')](_0x110bc8);};VoiceCallReport['prototype']['emit']=function(_0x30d5ee,_0x1f27fd,_0x202785){io['to'](_0x30d5ee)[_0x568a('0x34')](_0x1f27fd,_0x202785);};VoiceCallReport[_0x568a('0x31')][_0x568a('0x35')]=function(_0x4bbdda){try{if(this[_0x568a('0x32')](_0x4bbdda)){logger[_0x568a('0x36')](_0x568a('0x37'),_0x4bbdda[_0x568a('0x38')],_0x4bbdda[_0x568a('0x39')],_0x4bbdda['calleridnum']);logger[_0x568a('0x3a')](_0x568a('0x3b'),_0x4bbdda[_0x568a('0x38')],util['inspect'](_0x4bbdda,{'showHidden':![],'depth':null}));if(_0x4bbdda[_0x568a('0x38')]===_0x4bbdda[_0x568a('0x3c')]){if(!_[_0x568a('0x33')](this[_0x568a('0x1b')][_0x4bbdda['uniqueid']])){_['merge'](this[_0x568a('0x1b')][_0x4bbdda['uniqueid']],_[_0x568a('0x3d')](_0x4bbdda,_['keys'](this[_0x568a('0x1b')][_0x4bbdda['uniqueid']])));}}}}catch(_0x412a43){logger[_0x568a('0x2e')](_0x568a('0x3e'),_0x4bbdda[_0x568a('0x38')],util[_0x568a('0x30')](_0x412a43,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x568a('0x31')]['syncNewChannel']=function(_0x131e4b){try{if(this['isNotNull'](_0x131e4b)){logger[_0x568a('0x3a')](_0x568a('0x3f'),_0x131e4b['uniqueid'],util[_0x568a('0x30')](_0x131e4b,{'showHidden':![],'depth':null}));if(_0x131e4b[_0x568a('0x38')]===_0x131e4b[_0x568a('0x3c')]&&_0x131e4b[_0x568a('0x40')]!=_0x568a('0x41')){if(_[_0x568a('0x33')](this['channels'][_0x131e4b[_0x568a('0x38')]])){logger[_0x568a('0x36')](_0x568a('0x42'),_0x131e4b[_0x568a('0x38')],_0x131e4b[_0x568a('0x43')],_0x131e4b['exten']);this[_0x568a('0x1b')][_0x131e4b[_0x568a('0x38')]]=new Channel();this[_0x568a('0x1b')][_0x131e4b[_0x568a('0x38')]][_0x568a('0x44')]=moment()[_0x568a('0x45')](_0x568a('0x46'));this['channels'][_0x131e4b['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x131e4b['channelstate'])];_[_0x568a('0x47')](this['channels'][_0x131e4b['uniqueid']],_[_0x568a('0x3d')](_0x131e4b,_[_0x568a('0x48')](this[_0x568a('0x1b')][_0x131e4b[_0x568a('0x38')]])));if(_0x131e4b['context']==='from-sip'){if(this[_0x568a('0x1c')][_0x131e4b[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]]){this[_0x568a('0x1c')][_0x131e4b['channel']['split']('-')[0x0]][_0x568a('0x4a')]=_0x131e4b[_0x568a('0x4b')];logger[_0x568a('0x3a')](_0x568a('0x4c'),_0x131e4b[_0x568a('0x38')],util[_0x568a('0x30')]({'destaccountcode':this[_0x568a('0x1c')][_0x131e4b[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]][_0x568a('0x4d')],'destconnectedlinenum':_0x131e4b['exten']},{'showHidden':![],'depth':null}));this[_0x568a('0x34')](util['format'](_0x568a('0x4e'),this[_0x568a('0x1c')][_0x131e4b[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]][_0x568a('0x4f')]),_0x568a('0x50'),{'destaccountcode':this[_0x568a('0x1c')][_0x131e4b[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]][_0x568a('0x4d')],'destconnectedlinenum':_0x131e4b[_0x568a('0x4b')]});}}}}}}catch(_0x193f1e){logger['error'](_0x568a('0x51'),_0x131e4b[_0x568a('0x38')],util[_0x568a('0x30')](_0x193f1e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x568a('0x31')]['syncNewExten']=function(_0x1329a5){try{if(this[_0x568a('0x32')](_0x1329a5)){logger[_0x568a('0x3a')](_0x568a('0x52'),_0x1329a5['uniqueid'],util['inspect'](_0x1329a5,{'showHidden':![],'depth':null}));if(_0x1329a5[_0x568a('0x38')]===_0x1329a5[_0x568a('0x3c')]&&_0x1329a5[_0x568a('0x4b')]!='h'&&_0x1329a5['channel']!=_0x568a('0x41')){_0x1329a5['application']=_0x1329a5[_0x568a('0x53')][_0x568a('0x54')]();_0x1329a5[_0x568a('0x55')]=(_0x1329a5['appdata']||_0x1329a5[_0x568a('0x55')])[_0x568a('0x54')]();logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x1329a5[_0x568a('0x38')],_0x1329a5['application'],_0x1329a5[_0x568a('0x55')]);if(_[_0x568a('0x33')](this[_0x568a('0x1b')][_0x1329a5[_0x568a('0x38')]])){this[_0x568a('0x1b')][_0x1329a5[_0x568a('0x38')]]=new Channel();this[_0x568a('0x1b')][_0x1329a5[_0x568a('0x38')]][_0x568a('0x44')]=_0x1329a5[_0x568a('0x56')]?moment()[_0x568a('0x57')](moment[_0x568a('0x56')](_0x1329a5['duration'])['seconds'](),_0x568a('0x58'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x568a('0x45')](_0x568a('0x46'));this[_0x568a('0x1b')][_0x1329a5['uniqueid']][_0x568a('0x59')]=_0x568a('0x15');}_[_0x568a('0x47')](this[_0x568a('0x1b')][_0x1329a5[_0x568a('0x38')]],_[_0x568a('0x3d')](_0x1329a5,_['keys'](this[_0x568a('0x1b')][_0x1329a5[_0x568a('0x38')]])));if(_['includes'](applications,_0x1329a5['application'])){this['channels'][_0x1329a5[_0x568a('0x38')]][_0x568a('0x5a')]=_0x1329a5['application'];this['channels'][_0x1329a5[_0x568a('0x38')]]['lastdata']=_0x1329a5['applicationdata'];if(_0x1329a5['application']===_0x568a('0x10')&&_[_0x568a('0x5b')](_0x1329a5[_0x568a('0x55')],_0x568a('0x5c'))){var _0x417b2d=_0x1329a5[_0x568a('0x55')][_0x568a('0x49')]('=');var _0x2200a6=_0x417b2d[0x0][_0x568a('0x5d')](/cdr\((.*)\)/);if(_0x2200a6){this['channels'][_0x1329a5[_0x568a('0x38')]][_0x2200a6[0x1]]=_0x417b2d[0x1];}}else if(_0x1329a5['application']==='queue'){this[_0x568a('0x1b')][_0x1329a5[_0x568a('0x38')]][_0x568a('0x11')]=_0x1329a5['applicationdata'][_0x568a('0x49')](',')[0x0];}}}}}catch(_0x545a5d){logger['error']('[%s][voiceCallReport][newexten]',_0x1329a5['uniqueid'],util[_0x568a('0x30')](_0x545a5d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x568a('0x31')]['syncNewState']=function(_0x3102ce){try{if(this[_0x568a('0x32')](_0x3102ce)){logger['info'](_0x568a('0x5e'),_0x3102ce[_0x568a('0x38')],_0x3102ce[_0x568a('0x3c')],_0x3102ce[_0x568a('0x39')],_0x3102ce[_0x568a('0x5f')]);logger['debug'](_0x568a('0x60'),_0x3102ce[_0x568a('0x38')],util['inspect'](_0x3102ce,{'showHidden':![],'depth':null}));if(_0x3102ce[_0x568a('0x38')]!==_0x3102ce[_0x568a('0x3c')]){if(this[_0x568a('0x1b')][_0x3102ce[_0x568a('0x3c')]]){if(_0x3102ce[_0x568a('0x61')]==='6'){if(!this[_0x568a('0x1b')][_0x3102ce['linkedid']][_0x568a('0x62')]){var _0x1fe53f=moment();this[_0x568a('0x1b')][_0x3102ce[_0x568a('0x3c')]]['answered']=!![];this['channels'][_0x3102ce['linkedid']][_0x568a('0x63')]=_0x1fe53f['format'](_0x568a('0x46'));if(this[_0x568a('0x1b')][_0x3102ce['linkedid']][_0x568a('0x44')]){this[_0x568a('0x1b')][_0x3102ce[_0x568a('0x3c')]][_0x568a('0x64')]=_0x1fe53f['diff'](this[_0x568a('0x1b')][_0x3102ce[_0x568a('0x3c')]][_0x568a('0x44')],_0x568a('0x58'));}}this['channels'][_0x3102ce[_0x568a('0x3c')]]['linkedid']=_0x3102ce['uniqueid'];if(_0x3102ce[_0x568a('0x5f')]!==_0x568a('0x65')){this[_0x568a('0x1b')][_0x3102ce[_0x568a('0x3c')]][_0x568a('0x66')]=_0x3102ce[_0x568a('0x5f')];}this[_0x568a('0x1b')][_0x3102ce[_0x568a('0x3c')]][_0x568a('0x67')]=_0x3102ce[_0x568a('0x39')];this['channels'][_0x3102ce[_0x568a('0x3c')]]['destinationchannel']=_0x3102ce['channel'];this[_0x568a('0x1b')][_0x3102ce['linkedid']][_0x568a('0x59')]=dispositions[_[_0x568a('0x68')](_0x3102ce[_0x568a('0x61')])];if(this[_0x568a('0x1c')][_0x3102ce[_0x568a('0x40')]['split']('-')[0x0]]){this['channels'][_0x3102ce[_0x568a('0x3c')]][_0x568a('0x69')]=this[_0x568a('0x1c')][_0x3102ce[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]]['id'];this[_0x568a('0x1b')][_0x3102ce[_0x568a('0x3c')]][_0x568a('0x6a')]=this[_0x568a('0x1c')][_0x3102ce['channel'][_0x568a('0x49')]('-')[0x0]][_0x568a('0x4f')];}}}}else{if(this['channels'][_0x3102ce[_0x568a('0x38')]]){if(_0x3102ce[_0x568a('0x61')]==='6'){if(this[_0x568a('0x1c')][_0x3102ce[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]]){this[_0x568a('0x1b')][_0x3102ce['uniqueid']][_0x568a('0x69')]=this[_0x568a('0x1c')][_0x3102ce[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]]['id'];this['channels'][_0x3102ce['uniqueid']][_0x568a('0x6a')]=this['agents'][_0x3102ce[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]]['name'];}}}}}}catch(_0x3a70a8){logger['error']('[%s][voiceCallReport][newstate]',_0x3102ce[_0x568a('0x38')],util[_0x568a('0x30')](_0x3a70a8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x568a('0x31')][_0x568a('0x6b')]=function(_0x1a686e,_0x38fd55){try{if(this[_0x568a('0x1b')][_0x1a686e]){logger[_0x568a('0x36')](_0x568a('0x6c'),_0x1a686e,_0x38fd55);this['channels'][_0x1a686e][_0x568a('0x6d')]=!![];if(_[_0x568a('0x6e')](_0x38fd55,_0x568a('0x6f'))){_0x38fd55=_0x38fd55[_0x568a('0x70')]('.wav49',_0x568a('0x71'));}this['channels'][_0x1a686e][_0x568a('0x72')]=_0x38fd55;var _0x2ac88c=_[_0x568a('0x73')](this[_0x568a('0x1b')][_0x1a686e][_0x568a('0x74')],{'filename':_0x38fd55});if(_[_0x568a('0x75')](_0x2ac88c)){this[_0x568a('0x1b')][_0x1a686e][_0x568a('0x74')][_0x568a('0x76')]({'filename':_0x38fd55,'createdAt':moment()['format'](_0x568a('0x46')),'mixmonitorid':'','status':_0x568a('0x77')});}}}catch(_0x5e1cc8){logger[_0x568a('0x2e')](_0x568a('0x78'),_0x1a686e,util['inspect'](_0x5e1cc8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x568a('0x31')][_0x568a('0x26')]=function(_0x2c2542){try{if(this[_0x568a('0x32')](_0x2c2542)){logger[_0x568a('0x3a')](_0x568a('0x79'),_0x2c2542[_0x568a('0x38')],util['inspect'](_0x2c2542,{'showHidden':![],'depth':null}));if(this[_0x568a('0x1b')][_0x2c2542[_0x568a('0x38')]]&&_0x2c2542['channel']!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x2c2542['variable'])){if(this['isNotNull'](_0x2c2542[_0x568a('0x7a')][_0x568a('0x7b')])){logger[_0x568a('0x36')](_0x568a('0x7c'),_0x2c2542[_0x568a('0x38')],_0x2c2542['value']);this[_0x568a('0x6b')](_0x2c2542['uniqueid'],_0x2c2542[_0x568a('0x7d')]);}else if(this[_0x568a('0x32')](_0x2c2542[_0x568a('0x7a')]['xmd-phone'])){logger[_0x568a('0x36')](_0x568a('0x7e'),_0x2c2542[_0x568a('0x38')],_0x2c2542[_0x568a('0x7d')]);this[_0x568a('0x1b')][_0x2c2542[_0x568a('0x38')]][_0x568a('0x5f')]=_0x2c2542['value'];}else if(this[_0x568a('0x32')](_0x2c2542[_0x568a('0x7a')][_0x568a('0x7f')])){logger[_0x568a('0x36')](_0x568a('0x80'),_0x2c2542[_0x568a('0x38')],_0x2c2542[_0x568a('0x7d')]);this[_0x568a('0x1b')][_0x2c2542[_0x568a('0x38')]][_0x568a('0x81')]=_0x2c2542[_0x568a('0x7d')];}else if(this[_0x568a('0x32')](_0x2c2542[_0x568a('0x7a')][_0x568a('0x82')])){logger[_0x568a('0x36')](_0x568a('0x83'),_0x2c2542[_0x568a('0x38')],_0x2c2542[_0x568a('0x7d')]);this[_0x568a('0x1b')][_0x2c2542[_0x568a('0x38')]][_0x568a('0x84')]=_0x2c2542[_0x568a('0x7d')];}else if(this[_0x568a('0x32')](_0x2c2542[_0x568a('0x7a')]['xmd-queue'])){logger[_0x568a('0x36')](_0x568a('0x85'),_0x2c2542[_0x568a('0x38')],_0x2c2542[_0x568a('0x7d')][_0x568a('0x49')](',')[0x0]);this[_0x568a('0x1b')][_0x2c2542[_0x568a('0x38')]][_0x568a('0x11')]=_0x2c2542[_0x568a('0x7d')][_0x568a('0x49')](',')[0x0];}else if(this[_0x568a('0x32')](_0x2c2542[_0x568a('0x7a')][_0x568a('0x86')])){logger[_0x568a('0x36')](_0x568a('0x87'),_0x2c2542[_0x568a('0x38')],_0x2c2542['value']);this[_0x568a('0x1b')][_0x2c2542[_0x568a('0x38')]][_0x568a('0x88')]=_0x2c2542[_0x568a('0x7d')];}else if(this[_0x568a('0x32')](_0x2c2542[_0x568a('0x7a')][_0x568a('0x89')])){logger[_0x568a('0x36')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x2c2542[_0x568a('0x38')],_0x2c2542[_0x568a('0x7d')]);this[_0x568a('0x1b')][_0x2c2542[_0x568a('0x38')]][_0x568a('0x8a')]=_0x2c2542[_0x568a('0x7d')];}else if(this[_0x568a('0x32')](_0x2c2542['variable'][_0x568a('0x8b')])){logger[_0x568a('0x36')](_0x568a('0x8c'),_0x2c2542[_0x568a('0x38')],_0x2c2542[_0x568a('0x7d')]);this[_0x568a('0x1b')][_0x2c2542['uniqueid']][_0x568a('0x8d')]=_0x2c2542[_0x568a('0x7d')];}else if(this[_0x568a('0x32')](_0x2c2542[_0x568a('0x7a')]['xmcs-queue'])){logger[_0x568a('0x36')](_0x568a('0x8e'),_0x2c2542[_0x568a('0x38')],_0x2c2542[_0x568a('0x7d')]);this[_0x568a('0x1b')][_0x2c2542[_0x568a('0x38')]][_0x568a('0x11')]=_0x2c2542['value'];}else if(this['isNotNull'](_0x2c2542[_0x568a('0x7a')][_0x568a('0x8f')])){logger[_0x568a('0x36')](_0x568a('0x90'),_0x2c2542[_0x568a('0x38')],_0x2c2542[_0x568a('0x7d')]);this[_0x568a('0x1b')][_0x2c2542['uniqueid']][_0x568a('0x91')]=_0x2c2542[_0x568a('0x7d')];}}}else if(this[_0x568a('0x32')](_0x2c2542[_0x568a('0x7a')][_0x568a('0x7b')])){if(_0x2c2542[_0x568a('0x7d')]){var _0x1e363b=path['parse'](_0x2c2542[_0x568a('0x7d')])[_0x568a('0x4f')];logger[_0x568a('0x36')](_0x568a('0x7c'),_0x1e363b,_0x2c2542[_0x568a('0x7d')]);this[_0x568a('0x6b')](_0x1e363b,_0x2c2542[_0x568a('0x7d')]);}}else if(this[_0x568a('0x1b')][_0x2c2542['linkedid']]){if(this['isNotNull'](_0x2c2542['variable'])){if(this[_0x568a('0x32')](_0x2c2542[_0x568a('0x7a')][_0x568a('0x8f')])){logger['info'](_0x568a('0x90'),_0x2c2542[_0x568a('0x3c')],_0x2c2542[_0x568a('0x7d')]);this['channels'][_0x2c2542[_0x568a('0x3c')]][_0x568a('0x92')]=_0x2c2542[_0x568a('0x7d')];}}}}}catch(_0x5b296c){logger[_0x568a('0x2e')](_0x568a('0x93'),_0x2c2542['uniqueid'],util[_0x568a('0x30')](_0x5b296c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x568a('0x31')][_0x568a('0x27')]=function(_0x54f8a0){try{if(this[_0x568a('0x32')](_0x54f8a0)){logger['debug'](_0x568a('0x94'),_0x54f8a0['uniqueid'],util['inspect'](_0x54f8a0,{'showHidden':![],'depth':null}));if(this[_0x568a('0x1b')][_0x54f8a0[_0x568a('0x38')]]){logger[_0x568a('0x36')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x54f8a0[_0x568a('0x38')],_0x54f8a0[_0x568a('0x95')]);var _0x36ef3b=moment();this[_0x568a('0x1b')][_0x54f8a0[_0x568a('0x38')]]['endtime']=_0x36ef3b[_0x568a('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54f8a0[_0x568a('0x38')]][_0x568a('0x56')]=_0x36ef3b[_0x568a('0x96')](this[_0x568a('0x1b')][_0x54f8a0[_0x568a('0x38')]][_0x568a('0x44')],_0x568a('0x58'));if(this[_0x568a('0x1b')][_0x54f8a0[_0x568a('0x38')]][_0x568a('0x62')]){this['channels'][_0x54f8a0[_0x568a('0x38')]]['billableseconds']=_0x36ef3b[_0x568a('0x96')](this[_0x568a('0x1b')][_0x54f8a0[_0x568a('0x38')]][_0x568a('0x63')],'seconds');this[_0x568a('0x1b')][_0x54f8a0[_0x568a('0x38')]]['holdtime']=this['channels'][_0x54f8a0[_0x568a('0x38')]][_0x568a('0x56')]-this['channels'][_0x54f8a0['uniqueid']]['billableseconds'];}if(_0x54f8a0['context']===_0x568a('0x97')){if(this[_0x568a('0x1c')][_0x54f8a0[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]]){this[_0x568a('0x1c')][_0x54f8a0['channel'][_0x568a('0x49')]('-')[0x0]]=_['omit'](this['agents'][_0x54f8a0[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]],['destconnectedlinenum']);logger[_0x568a('0x3a')](_0x568a('0x98'),_0x54f8a0['uniqueid'],util[_0x568a('0x30')]({'destaccountcode':this['agents'][_0x54f8a0[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]][_0x568a('0x4d')]},{'showHidden':![],'depth':null}));this[_0x568a('0x34')](util[_0x568a('0x45')](_0x568a('0x4e'),this['agents'][_0x54f8a0[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]][_0x568a('0x4f')]),_0x568a('0x99'),{'destaccountcode':this['agents'][_0x54f8a0[_0x568a('0x40')][_0x568a('0x49')]('-')[0x0]][_0x568a('0x4d')]});}}var _0x2d21b6=this;Promise[_0x568a('0x9a')]()[_0x568a('0x9b')](function(){var _0x16f592=_0x2d21b6['channels'][_0x54f8a0[_0x568a('0x38')]];if(typeof _0x16f592[_0x568a('0x9c')]===_0x568a('0x9d'))return;if(_['isEmpty'](_0x16f592[_0x568a('0x74')]))return;return RpcSetting[_0x568a('0x9e')]()[_0x568a('0x9b')](function(_0xb13663){if(!_0xb13663['stopRecordingOnTransfer'])return;return Promise[_0x568a('0x9a')]()['then'](function(){return ami[_0x568a('0x9f')]({'action':_0x568a('0xa0'),'channel':_0x16f592[_0x568a('0x40')]})[_0x568a('0xa1')](function(){});})[_0x568a('0x9b')](function(){return ami[_0x568a('0x9f')]({'action':_0x568a('0xa0'),'channel':_0x16f592['destinationchannel']})[_0x568a('0xa1')](function(){})[_0x568a('0xa2')](function(){var _0x29db0b=_0x2d21b6[_0x568a('0x1c')][_0x16f592[_0x568a('0xa3')][_0x568a('0x49')]('-')[0x0]];if(!_0x29db0b)return;io[_0x568a('0x34')]('webbar:stopmonitors',{'agentId':_0x29db0b['id'],'uniqueid':_0x16f592[_0x568a('0x38')]});});});});})[_0x568a('0x9b')](function(){if(_0x54f8a0['event']===_0x568a('0xa4')){_0x2d21b6[_0x568a('0x1d')][_0x54f8a0[_0x568a('0x38')]]=_0x2d21b6['channels'][_0x54f8a0[_0x568a('0x38')]];}else{if(_0x2d21b6[_0x568a('0x1b')][_0x54f8a0[_0x568a('0x38')]][_0x568a('0x84')]==='outbound'&&_0x2d21b6[_0x568a('0x1d')][_0x54f8a0[_0x568a('0x38')]]){_0x2d21b6['channels'][_0x54f8a0[_0x568a('0x38')]][_0x568a('0x38')]=[_0x2d21b6['channels'][_0x54f8a0[_0x568a('0x38')]][_0x568a('0x3c')],_0x2d21b6[_0x568a('0x1b')][_0x54f8a0['uniqueid']][_0x568a('0x3c')]=_0x2d21b6[_0x568a('0x1b')][_0x54f8a0['uniqueid']][_0x568a('0x38')]][0x0];delete _0x2d21b6[_0x568a('0x1d')][_0x54f8a0[_0x568a('0x38')]];}}logger[_0x568a('0x3a')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x54f8a0[_0x568a('0x38')],util['inspect'](_0x2d21b6[_0x568a('0x1b')][_0x54f8a0[_0x568a('0x38')]],{'showHidden':![],'depth':null}));ami[_0x568a('0x34')]('custom:voiceCallReport',_0x2d21b6['channels'][_0x54f8a0['uniqueid']]);delete _0x2d21b6['channels'][_0x54f8a0[_0x568a('0x38')]];});}}}catch(_0x19cef){logger[_0x568a('0x2e')]('[%s][voiceCallReport][hangup]',_0x54f8a0[_0x568a('0x38')],util[_0x568a('0x30')](_0x19cef,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x568a('0x31')]['syncAttendedTransfer']=function(_0x1f7de9){try{if(this['isNotNull'](_0x1f7de9)){logger[_0x568a('0x36')](_0x568a('0xa5'),_0x1f7de9['uniqueid'],_0x1f7de9[_0x568a('0xa6')],_0x1f7de9[_0x568a('0xa7')]);logger['debug'](_0x568a('0xa8'),_0x1f7de9[_0x568a('0x38')],util[_0x568a('0x30')](_0x1f7de9,{'showHidden':![],'depth':null}));if(this[_0x568a('0x1b')][_0x1f7de9['transfereeuniqueid']]){this[_0x568a('0x1b')][_0x1f7de9['transfereeuniqueid']][_0x568a('0xa9')]=_0x1f7de9['origtransferercalleridnum'];this[_0x568a('0x1b')][_0x1f7de9['transfereeuniqueid']][_0x568a('0xaa')]=_0x1f7de9['transfertargetcalleridnum'];if(this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xab')]]){var _0x3e8b32=this['channels'][_0x1f7de9['secondtransfereruniqueid']];this['channels'][_0x1f7de9['secondtransfereruniqueid']]=this[_0x568a('0x1b')][_0x1f7de9['transfereeuniqueid']];this['channels'][_0x1f7de9[_0x568a('0xac')]]=_0x3e8b32;}}else if(this['channels'][_0x1f7de9[_0x568a('0xad')]]){this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xad')]]['transfercalleridnum']=_0x1f7de9['origtransferercalleridnum'];this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xad')]][_0x568a('0xaa')]=_0x1f7de9[_0x568a('0xa7')];if(this['channels'][_0x1f7de9[_0x568a('0xae')]]){var _0x3e8b32=this['channels'][_0x1f7de9['origtransfereruniqueid']];this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xae')]]=this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xad')]];this[_0x568a('0x1b')][_0x1f7de9['transfertargetuniqueid']]=_0x3e8b32;}}if((this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xae')]]||this['channels'][_0x1f7de9['origtransfererlinkedid']])&&this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xab')]]){var _0x3e8675=_[_0x568a('0xaf')]([this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xae')]],this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xb0')]],this['channels'][_0x1f7de9[_0x568a('0xab')]]],function(_0x3b1987){return _0x3b1987&&_0x3b1987[_0x568a('0x84')]===_0x568a('0xb1')&&_0x3b1987[_0x568a('0xb2')];});if(_0x3e8675){if(this[_0x568a('0x1b')][_0x1f7de9['origtransfereruniqueid']])this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xae')]][_0x568a('0x9c')]=_0x568a('0xb3');if(this['channels'][_0x1f7de9[_0x568a('0xb0')]])this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xb0')]][_0x568a('0x9c')]='ATTENDED';this[_0x568a('0x1b')][_0x1f7de9[_0x568a('0xab')]][_0x568a('0x9c')]=_0x568a('0xb3');}}}}catch(_0x5aefab){logger['error'](_0x568a('0xb4'),_0x1f7de9[_0x568a('0x38')],util[_0x568a('0x30')](_0x5aefab,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0x1f2f87){try{if(this[_0x568a('0x32')](_0x1f2f87)){logger[_0x568a('0x36')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x1f2f87[_0x568a('0x38')],_0x1f2f87[_0x568a('0xb5')],_0x1f2f87[_0x568a('0xb6')]);logger[_0x568a('0x3a')](_0x568a('0xb7'),_0x1f2f87[_0x568a('0x38')],util[_0x568a('0x30')](_0x1f2f87,{'showHidden':![],'depth':null}));if(this['channels'][_0x1f2f87[_0x568a('0xac')]]){this[_0x568a('0x1b')][_0x1f2f87[_0x568a('0xac')]][_0x568a('0xa9')]=_0x1f2f87[_0x568a('0xb5')];this['channels'][_0x1f2f87[_0x568a('0xac')]][_0x568a('0xaa')]=_0x1f2f87[_0x568a('0xb6')];this[_0x568a('0x1b')][_0x1f2f87[_0x568a('0xac')]]['transferType']=_0x568a('0xb8');this[_0x568a('0x27')]({'event':_0x568a('0xa4'),'uniqueid':_0x1f2f87[_0x568a('0xac')],'context':_0x1f2f87[_0x568a('0x43')],'channel':_0x1f2f87[_0x568a('0xb9')]});}else{this[_0x568a('0x1b')][_0x1f2f87[_0x568a('0xba')]]['transferType']=_0x568a('0xb8');}}}catch(_0x2ea440){logger[_0x568a('0x2e')](_0x568a('0xbb'),_0x1f2f87[_0x568a('0x38')],util[_0x568a('0x30')](_0x2ea440,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x568a('0x31')]['syncMusicOnHoldStart']=function(_0x299d34){try{if(this[_0x568a('0x32')](_0x299d34)){logger[_0x568a('0x3a')](_0x568a('0xbc'),_0x299d34['uniqueid'],util['inspect'](_0x299d34,{'showHidden':![],'depth':null}));if(this[_0x568a('0x1b')][_0x299d34[_0x568a('0x38')]]){if(!_['isNil'](this['channels'][_0x299d34[_0x568a('0x38')]][_0x568a('0x63')])){this[_0x568a('0x1b')][_0x299d34[_0x568a('0x38')]][_0x568a('0xbd')]=moment()[_0x568a('0x45')]('YYYY-MM-DD\x20HH:mm:ss');logger['info'](_0x568a('0xbe'),_0x299d34['uniqueid'],this['channels'][_0x299d34['uniqueid']][_0x568a('0xbd')]);}}}}catch(_0x1c9490){logger['error'](_0x568a('0xbf'),_0x299d34['uniqueid'],util[_0x568a('0x30')](_0x1c9490,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x568a('0xc0')]=function(_0x45cd12){try{if(this['isNotNull'](_0x45cd12)){logger[_0x568a('0x3a')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x45cd12[_0x568a('0x38')],util[_0x568a('0x30')](_0x45cd12,{'showHidden':![],'depth':null}));if(this[_0x568a('0x1b')][_0x45cd12[_0x568a('0x38')]]){if(!_['isNil'](this['channels'][_0x45cd12[_0x568a('0x38')]][_0x568a('0xbd')])){this[_0x568a('0x1b')][_0x45cd12[_0x568a('0x38')]][_0x568a('0xc1')]+=moment()['milliseconds'](0x0)[_0x568a('0x96')](this[_0x568a('0x1b')][_0x45cd12[_0x568a('0x38')]][_0x568a('0xbd')],_0x568a('0x58'));logger[_0x568a('0x36')](_0x568a('0xc2'),_0x45cd12[_0x568a('0x38')],this['channels'][_0x45cd12[_0x568a('0x38')]][_0x568a('0xc1')]);delete this[_0x568a('0x1b')][_0x45cd12[_0x568a('0x38')]][_0x568a('0xbd')];}}}}catch(_0x35e3f4){logger['error'](_0x568a('0xc3'),_0x45cd12[_0x568a('0x38')],util['inspect'](_0x35e3f4,{'showHidden':![],'depth':null}));}};module[_0x568a('0xc4')]=VoiceCallReport; \ No newline at end of file +var _0xb281=['varset','syncVarSet','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','info','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','from-sip','split','destconnectedlinenum','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','user:agentconnect','application','toLowerCase','applicationdata','appdata','duration','seconds','includes','lastapplication','lastdata','set','startsWith','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate','answered','holdtime','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','cause-txt','diff','billableseconds','answertime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:%s','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','BlindTransfer','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohstarttime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','path','ioredis','../../../config/environment','../../../config/logger','../ami','not_inuse','invalid','ringing','ringinuse','onhold','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate'];(function(_0xece535,_0x23de0d){var _0x97f68a=function(_0x50cca3){while(--_0x50cca3){_0xece535['push'](_0xece535['shift']());}};_0x97f68a(++_0x23de0d);}(_0xb281,0x176));var _0x1b28=function(_0x3a8513,_0x3dd44b){_0x3a8513=_0x3a8513-0x0;var _0x2742a2=_0xb281[_0x3a8513];return _0x2742a2;};'use strict';var BPromise=require(_0x1b28('0x0'));var _=require('lodash');var moment=require(_0x1b28('0x1'));var util=require('util');var path=require(_0x1b28('0x2'));var Redis=require(_0x1b28('0x3'));var config=require(_0x1b28('0x4'));var logger=require(_0x1b28('0x5'))('ami');var ami=require(_0x1b28('0x6'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var statusDesc=['unknown',_0x1b28('0x7'),'inuse','busy',_0x1b28('0x8'),'unavailable',_0x1b28('0x9'),_0x1b28('0xa'),_0x1b28('0xb')];var applications=['set','queue',_0x1b28('0xc'),_0x1b28('0xd'),_0x1b28('0xe'),_0x1b28('0xf')];var dispositions=['NO\x20ANSWER',_0x1b28('0x10'),_0x1b28('0x10'),_0x1b28('0x11'),_0x1b28('0x11'),_0x1b28('0x11'),_0x1b28('0x12'),_0x1b28('0x13'),'FAILED',_0x1b28('0x10'),_0x1b28('0x10')];var actions={};config[_0x1b28('0x14')]=_[_0x1b28('0x15')](config[_0x1b28('0x14')],{'host':_0x1b28('0x16'),'port':0x18eb});var io=require(_0x1b28('0x17'))(new Redis(config[_0x1b28('0x14')]));function VoiceCallReport(_0x935248){this[_0x1b28('0x18')]=_0x935248['channels'];this[_0x1b28('0x19')]=_0x935248['agents'];this[_0x1b28('0x1a')]={};ami['on'](_0x1b28('0x1b'),this[_0x1b28('0x1c')][_0x1b28('0x1d')](this));ami['on'](_0x1b28('0x1e'),this[_0x1b28('0x1c')]['bind'](this));ami['on'](_0x1b28('0x1f'),this[_0x1b28('0x20')][_0x1b28('0x1d')](this));ami['on'](_0x1b28('0x21'),this['syncNewState'][_0x1b28('0x1d')](this));ami['on'](_0x1b28('0x22'),this[_0x1b28('0x23')][_0x1b28('0x1d')](this));ami['on']('hangup',this[_0x1b28('0x24')][_0x1b28('0x1d')](this));ami['on']('newcallerid',this[_0x1b28('0x25')][_0x1b28('0x1d')](this));ami['on']('attendedtransfer',this[_0x1b28('0x26')][_0x1b28('0x1d')](this));ami['on'](_0x1b28('0x27'),this[_0x1b28('0x28')][_0x1b28('0x1d')](this));ami['on'](_0x1b28('0x29'),this[_0x1b28('0x2a')]['bind'](this));ami['on'](_0x1b28('0x2b'),this[_0x1b28('0x2c')]['bind'](this));try{logger['info'](_0x1b28('0x2d'));ami['actionCoreShowChannels']();}catch(_0x471681){logger[_0x1b28('0x2e')](_0x1b28('0x2f'),util[_0x1b28('0x30')](_0x471681,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1b28('0x31')][_0x1b28('0x32')]=function(_0x2778d5){return _0x2778d5!==null&&!_[_0x1b28('0x33')](_0x2778d5);};VoiceCallReport[_0x1b28('0x31')][_0x1b28('0x34')]=function(_0xcf30a,_0x3b145b,_0x30b345){io['to'](_0xcf30a)[_0x1b28('0x34')](_0x3b145b,_0x30b345);};VoiceCallReport[_0x1b28('0x31')][_0x1b28('0x25')]=function(_0x26f29c){try{if(this[_0x1b28('0x32')](_0x26f29c)){logger['info'](_0x1b28('0x35'),_0x26f29c[_0x1b28('0x36')],_0x26f29c[_0x1b28('0x37')],_0x26f29c['calleridnum']);logger[_0x1b28('0x38')](_0x1b28('0x39'),_0x26f29c[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x26f29c,{'showHidden':![],'depth':null}));if(_0x26f29c[_0x1b28('0x36')]===_0x26f29c[_0x1b28('0x3a')]){if(!_[_0x1b28('0x33')](this[_0x1b28('0x18')][_0x26f29c['uniqueid']])){_[_0x1b28('0x3b')](this[_0x1b28('0x18')][_0x26f29c[_0x1b28('0x36')]],_[_0x1b28('0x3c')](_0x26f29c,_[_0x1b28('0x3d')](this[_0x1b28('0x18')][_0x26f29c[_0x1b28('0x36')]])));}}}}catch(_0x466aab){logger[_0x1b28('0x2e')](_0x1b28('0x3e'),_0x26f29c[_0x1b28('0x36')],util['inspect'](_0x466aab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1b28('0x31')][_0x1b28('0x20')]=function(_0x17e085){try{if(this[_0x1b28('0x32')](_0x17e085)){logger[_0x1b28('0x38')](_0x1b28('0x3f'),_0x17e085[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x17e085,{'showHidden':![],'depth':null}));if(_0x17e085[_0x1b28('0x36')]===_0x17e085[_0x1b28('0x3a')]&&_0x17e085[_0x1b28('0x40')]!=_0x1b28('0x41')){if(_[_0x1b28('0x33')](this['channels'][_0x17e085[_0x1b28('0x36')]])){logger[_0x1b28('0x42')](_0x1b28('0x43'),_0x17e085['uniqueid'],_0x17e085[_0x1b28('0x44')],_0x17e085['exten']);this['channels'][_0x17e085['uniqueid']]=new Channel();this[_0x1b28('0x18')][_0x17e085['uniqueid']][_0x1b28('0x45')]=moment()[_0x1b28('0x46')](_0x1b28('0x47'));this['channels'][_0x17e085[_0x1b28('0x36')]][_0x1b28('0x48')]=dispositions[_['toNumber'](_0x17e085['channelstate'])];_[_0x1b28('0x3b')](this[_0x1b28('0x18')][_0x17e085[_0x1b28('0x36')]],_[_0x1b28('0x3c')](_0x17e085,_[_0x1b28('0x3d')](this[_0x1b28('0x18')][_0x17e085[_0x1b28('0x36')]])));if(_0x17e085[_0x1b28('0x44')]===_0x1b28('0x49')){if(this[_0x1b28('0x19')][_0x17e085['channel'][_0x1b28('0x4a')]('-')[0x0]]){this['agents'][_0x17e085[_0x1b28('0x40')][_0x1b28('0x4a')]('-')[0x0]][_0x1b28('0x4b')]=_0x17e085[_0x1b28('0x4c')];logger[_0x1b28('0x38')](_0x1b28('0x4d'),_0x17e085['uniqueid'],util[_0x1b28('0x30')]({'destaccountcode':this[_0x1b28('0x19')][_0x17e085['channel'][_0x1b28('0x4a')]('-')[0x0]][_0x1b28('0x4e')],'destconnectedlinenum':_0x17e085[_0x1b28('0x4c')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x1b28('0x46')]('user:%s',this[_0x1b28('0x19')][_0x17e085[_0x1b28('0x40')][_0x1b28('0x4a')]('-')[0x0]][_0x1b28('0x4f')]),_0x1b28('0x50'),{'destaccountcode':this[_0x1b28('0x19')][_0x17e085[_0x1b28('0x40')][_0x1b28('0x4a')]('-')[0x0]][_0x1b28('0x4e')],'destconnectedlinenum':_0x17e085[_0x1b28('0x4c')]});}}}}}}catch(_0x52a35a){logger[_0x1b28('0x2e')]('[%s][voiceCallReport][newchannel]',_0x17e085[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x52a35a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1b28('0x1c')]=function(_0x3c0d89){try{if(this[_0x1b28('0x32')](_0x3c0d89)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x3c0d89['uniqueid'],util['inspect'](_0x3c0d89,{'showHidden':![],'depth':null}));if(_0x3c0d89[_0x1b28('0x36')]===_0x3c0d89[_0x1b28('0x3a')]&&_0x3c0d89[_0x1b28('0x4c')]!='h'&&_0x3c0d89[_0x1b28('0x40')]!=_0x1b28('0x41')){_0x3c0d89[_0x1b28('0x51')]=_0x3c0d89['application'][_0x1b28('0x52')]();_0x3c0d89[_0x1b28('0x53')]=(_0x3c0d89[_0x1b28('0x54')]||_0x3c0d89[_0x1b28('0x53')])[_0x1b28('0x52')]();logger[_0x1b28('0x42')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x3c0d89['uniqueid'],_0x3c0d89[_0x1b28('0x51')],_0x3c0d89[_0x1b28('0x53')]);if(_[_0x1b28('0x33')](this[_0x1b28('0x18')][_0x3c0d89[_0x1b28('0x36')]])){this[_0x1b28('0x18')][_0x3c0d89['uniqueid']]=new Channel();this[_0x1b28('0x18')][_0x3c0d89[_0x1b28('0x36')]][_0x1b28('0x45')]=_0x3c0d89[_0x1b28('0x55')]?moment()['subtract'](moment['duration'](_0x3c0d89[_0x1b28('0x55')])[_0x1b28('0x56')](),'seconds')[_0x1b28('0x46')](_0x1b28('0x47')):moment()['format'](_0x1b28('0x47'));this[_0x1b28('0x18')][_0x3c0d89['uniqueid']][_0x1b28('0x48')]='NO\x20ANSWER';}_[_0x1b28('0x3b')](this[_0x1b28('0x18')][_0x3c0d89[_0x1b28('0x36')]],_[_0x1b28('0x3c')](_0x3c0d89,_[_0x1b28('0x3d')](this[_0x1b28('0x18')][_0x3c0d89[_0x1b28('0x36')]])));if(_[_0x1b28('0x57')](applications,_0x3c0d89[_0x1b28('0x51')])){this[_0x1b28('0x18')][_0x3c0d89[_0x1b28('0x36')]][_0x1b28('0x58')]=_0x3c0d89['application'];this[_0x1b28('0x18')][_0x3c0d89[_0x1b28('0x36')]][_0x1b28('0x59')]=_0x3c0d89[_0x1b28('0x53')];if(_0x3c0d89[_0x1b28('0x51')]===_0x1b28('0x5a')&&_[_0x1b28('0x5b')](_0x3c0d89[_0x1b28('0x53')],'cdr(')){var _0x66e0c3=_0x3c0d89[_0x1b28('0x53')][_0x1b28('0x4a')]('=');var _0x1a1d8b=_0x66e0c3[0x0][_0x1b28('0x5c')](/cdr\((.*)\)/);if(_0x1a1d8b){this[_0x1b28('0x18')][_0x3c0d89[_0x1b28('0x36')]][_0x1a1d8b[0x1]]=_0x66e0c3[0x1];}}else if(_0x3c0d89[_0x1b28('0x51')]===_0x1b28('0x5d')){this['channels'][_0x3c0d89[_0x1b28('0x36')]][_0x1b28('0x5d')]=_0x3c0d89[_0x1b28('0x53')][_0x1b28('0x4a')](',')[0x0];}}}}}catch(_0x315da6){logger['error'](_0x1b28('0x5e'),_0x3c0d89[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x315da6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x319d44){try{if(this['isNotNull'](_0x319d44)){logger[_0x1b28('0x42')](_0x1b28('0x5f'),_0x319d44[_0x1b28('0x36')],_0x319d44[_0x1b28('0x3a')],_0x319d44['calleridname'],_0x319d44['calleridnum']);logger[_0x1b28('0x38')]('[%s][voiceCallReport][newstate]\x20event:',_0x319d44[_0x1b28('0x36')],util['inspect'](_0x319d44,{'showHidden':![],'depth':null}));if(_0x319d44[_0x1b28('0x36')]!==_0x319d44['linkedid']){if(this[_0x1b28('0x18')][_0x319d44['linkedid']]){if(_0x319d44[_0x1b28('0x60')]==='6'){if(!this[_0x1b28('0x18')][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x61')]){var _0x50e271=moment();this['channels'][_0x319d44['linkedid']]['answered']=!![];this[_0x1b28('0x18')][_0x319d44[_0x1b28('0x3a')]]['answertime']=_0x50e271[_0x1b28('0x46')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x1b28('0x18')][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x45')]){this['channels'][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x62')]=_0x50e271['diff'](this['channels'][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x45')],_0x1b28('0x56'));}}this[_0x1b28('0x18')][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x3a')]=_0x319d44['uniqueid'];if(_0x319d44[_0x1b28('0x63')]!==_0x1b28('0x64')){this['channels'][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x65')]=_0x319d44[_0x1b28('0x63')];}this[_0x1b28('0x18')][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x66')]=_0x319d44[_0x1b28('0x37')];this['channels'][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x67')]=_0x319d44[_0x1b28('0x40')];this[_0x1b28('0x18')][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x48')]=dispositions[_[_0x1b28('0x68')](_0x319d44[_0x1b28('0x60')])];if(this[_0x1b28('0x19')][_0x319d44[_0x1b28('0x40')]['split']('-')[0x0]]){this[_0x1b28('0x18')][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x69')]=this[_0x1b28('0x19')][_0x319d44[_0x1b28('0x40')][_0x1b28('0x4a')]('-')[0x0]]['id'];this[_0x1b28('0x18')][_0x319d44[_0x1b28('0x3a')]][_0x1b28('0x6a')]=this['agents'][_0x319d44[_0x1b28('0x40')][_0x1b28('0x4a')]('-')[0x0]]['name'];}}}}else{if(this[_0x1b28('0x18')][_0x319d44[_0x1b28('0x36')]]){if(_0x319d44['channelstate']==='6'){if(this[_0x1b28('0x19')][_0x319d44[_0x1b28('0x40')]['split']('-')[0x0]]){this['channels'][_0x319d44[_0x1b28('0x36')]][_0x1b28('0x69')]=this[_0x1b28('0x19')][_0x319d44[_0x1b28('0x40')][_0x1b28('0x4a')]('-')[0x0]]['id'];this[_0x1b28('0x18')][_0x319d44[_0x1b28('0x36')]][_0x1b28('0x6a')]=this[_0x1b28('0x19')][_0x319d44[_0x1b28('0x40')][_0x1b28('0x4a')]('-')[0x0]]['name'];}}}}}}catch(_0x1c4dd6){logger[_0x1b28('0x2e')](_0x1b28('0x6b'),_0x319d44['uniqueid'],util[_0x1b28('0x30')](_0x1c4dd6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1b28('0x31')][_0x1b28('0x6c')]=function(_0x1764e4,_0x439dcf){try{if(this['channels'][_0x1764e4]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x1764e4,_0x439dcf);this[_0x1b28('0x18')][_0x1764e4][_0x1b28('0x6d')]=!![];if(_['endsWith'](_0x439dcf,_0x1b28('0x6e'))){_0x439dcf=_0x439dcf[_0x1b28('0x6f')](_0x1b28('0x6e'),_0x1b28('0x70'));}this[_0x1b28('0x18')][_0x1764e4][_0x1b28('0x71')]=_0x439dcf;var _0x1b91e4=_[_0x1b28('0x72')](this[_0x1b28('0x18')][_0x1764e4][_0x1b28('0x73')],{'filename':_0x439dcf});if(_[_0x1b28('0x74')](_0x1b91e4)){this[_0x1b28('0x18')][_0x1764e4][_0x1b28('0x73')]['push']({'filename':_0x439dcf,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x1b28('0x75')});}}}catch(_0x229c2e){logger[_0x1b28('0x2e')](_0x1b28('0x76'),_0x1764e4,util[_0x1b28('0x30')](_0x229c2e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1b28('0x23')]=function(_0x14b847){try{if(this[_0x1b28('0x32')](_0x14b847)){logger[_0x1b28('0x38')](_0x1b28('0x77'),_0x14b847[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x14b847,{'showHidden':![],'depth':null}));if(this[_0x1b28('0x18')][_0x14b847[_0x1b28('0x36')]]&&_0x14b847['channel']!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x14b847[_0x1b28('0x78')])){if(this[_0x1b28('0x32')](_0x14b847['variable']['mixmonitor_filename'])){logger[_0x1b28('0x42')](_0x1b28('0x79'),_0x14b847[_0x1b28('0x36')],_0x14b847['value']);this[_0x1b28('0x6c')](_0x14b847['uniqueid'],_0x14b847['value']);}else if(this[_0x1b28('0x32')](_0x14b847[_0x1b28('0x78')][_0x1b28('0x7a')])){logger['info'](_0x1b28('0x7b'),_0x14b847[_0x1b28('0x36')],_0x14b847[_0x1b28('0x7c')]);this[_0x1b28('0x18')][_0x14b847[_0x1b28('0x36')]][_0x1b28('0x63')]=_0x14b847[_0x1b28('0x7c')];}else if(this['isNotNull'](_0x14b847['variable'][_0x1b28('0x7d')])){logger[_0x1b28('0x42')](_0x1b28('0x7e'),_0x14b847[_0x1b28('0x36')],_0x14b847[_0x1b28('0x7c')]);this[_0x1b28('0x18')][_0x14b847['uniqueid']]['callerid']=_0x14b847['value'];}else if(this[_0x1b28('0x32')](_0x14b847['variable'][_0x1b28('0x7f')])){logger['info'](_0x1b28('0x80'),_0x14b847[_0x1b28('0x36')],_0x14b847[_0x1b28('0x7c')]);this['channels'][_0x14b847['uniqueid']][_0x1b28('0x81')]=_0x14b847[_0x1b28('0x7c')];}else if(this[_0x1b28('0x32')](_0x14b847[_0x1b28('0x78')][_0x1b28('0x82')])){logger['info'](_0x1b28('0x83'),_0x14b847[_0x1b28('0x36')],_0x14b847[_0x1b28('0x7c')][_0x1b28('0x4a')](',')[0x0]);this[_0x1b28('0x18')][_0x14b847['uniqueid']][_0x1b28('0x5d')]=_0x14b847[_0x1b28('0x7c')][_0x1b28('0x4a')](',')[0x0];}else if(this[_0x1b28('0x32')](_0x14b847['variable'][_0x1b28('0x84')])){logger[_0x1b28('0x42')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x14b847[_0x1b28('0x36')],_0x14b847[_0x1b28('0x7c')]);this[_0x1b28('0x18')][_0x14b847['uniqueid']]['originatecalleridnum']=_0x14b847[_0x1b28('0x7c')];}else if(this[_0x1b28('0x32')](_0x14b847['variable']['xmd-destination'])){logger[_0x1b28('0x42')](_0x1b28('0x85'),_0x14b847[_0x1b28('0x36')],_0x14b847['value']);this[_0x1b28('0x18')][_0x14b847[_0x1b28('0x36')]][_0x1b28('0x86')]=_0x14b847['value'];}else if(this[_0x1b28('0x32')](_0x14b847['variable'][_0x1b28('0x87')])){logger[_0x1b28('0x42')](_0x1b28('0x88'),_0x14b847[_0x1b28('0x36')],_0x14b847['value']);this[_0x1b28('0x18')][_0x14b847[_0x1b28('0x36')]][_0x1b28('0x89')]=_0x14b847[_0x1b28('0x7c')];}else if(this[_0x1b28('0x32')](_0x14b847[_0x1b28('0x78')][_0x1b28('0x8a')])){logger[_0x1b28('0x42')](_0x1b28('0x8b'),_0x14b847[_0x1b28('0x36')],_0x14b847[_0x1b28('0x7c')]);this['channels'][_0x14b847[_0x1b28('0x36')]][_0x1b28('0x5d')]=_0x14b847[_0x1b28('0x7c')];}else if(this['isNotNull'](_0x14b847[_0x1b28('0x78')][_0x1b28('0x8c')])){logger[_0x1b28('0x42')](_0x1b28('0x8d'),_0x14b847[_0x1b28('0x36')],_0x14b847['value']);this[_0x1b28('0x18')][_0x14b847[_0x1b28('0x36')]][_0x1b28('0x8e')]=_0x14b847['value'];}}}else if(this[_0x1b28('0x32')](_0x14b847[_0x1b28('0x78')][_0x1b28('0x8f')])){if(_0x14b847['value']){var _0x71fa37=path[_0x1b28('0x90')](_0x14b847[_0x1b28('0x7c')])[_0x1b28('0x4f')];logger[_0x1b28('0x42')](_0x1b28('0x79'),_0x71fa37,_0x14b847[_0x1b28('0x7c')]);this[_0x1b28('0x6c')](_0x71fa37,_0x14b847[_0x1b28('0x7c')]);}}else if(this['channels'][_0x14b847[_0x1b28('0x3a')]]){if(this[_0x1b28('0x32')](_0x14b847[_0x1b28('0x78')])){if(this[_0x1b28('0x32')](_0x14b847['variable'][_0x1b28('0x8c')])){logger[_0x1b28('0x42')](_0x1b28('0x8d'),_0x14b847[_0x1b28('0x3a')],_0x14b847[_0x1b28('0x7c')]);this[_0x1b28('0x18')][_0x14b847['linkedid']][_0x1b28('0x91')]=_0x14b847[_0x1b28('0x7c')];}}}}}catch(_0x5eba1b){logger[_0x1b28('0x2e')](_0x1b28('0x92'),_0x14b847[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x5eba1b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1b28('0x31')][_0x1b28('0x24')]=function(_0x1e061f){try{if(this['isNotNull'](_0x1e061f)){logger[_0x1b28('0x38')]('[%s][voiceCallReport][hangup]\x20event:',_0x1e061f['uniqueid'],util[_0x1b28('0x30')](_0x1e061f,{'showHidden':![],'depth':null}));if(this[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]]){logger[_0x1b28('0x42')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x1e061f['uniqueid'],_0x1e061f[_0x1b28('0x93')]);var _0x5f4e16=moment();this['channels'][_0x1e061f[_0x1b28('0x36')]]['endtime']=_0x5f4e16['format'](_0x1b28('0x47'));this[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]]['duration']=_0x5f4e16[_0x1b28('0x94')](this[_0x1b28('0x18')][_0x1e061f['uniqueid']][_0x1b28('0x45')],'seconds');if(this[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]][_0x1b28('0x61')]){this['channels'][_0x1e061f[_0x1b28('0x36')]][_0x1b28('0x95')]=_0x5f4e16['diff'](this[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]][_0x1b28('0x96')],_0x1b28('0x56'));this[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]][_0x1b28('0x62')]=this[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]]['duration']-this[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]]['billableseconds'];}if(_0x1e061f[_0x1b28('0x44')]==='from-sip'){if(this['agents'][_0x1e061f[_0x1b28('0x40')]['split']('-')[0x0]]){this['agents'][_0x1e061f[_0x1b28('0x40')]['split']('-')[0x0]]=_[_0x1b28('0x97')](this[_0x1b28('0x19')][_0x1e061f[_0x1b28('0x40')][_0x1b28('0x4a')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x1b28('0x98'),_0x1e061f[_0x1b28('0x36')],util[_0x1b28('0x30')]({'destaccountcode':this[_0x1b28('0x19')][_0x1e061f[_0x1b28('0x40')]['split']('-')[0x0]][_0x1b28('0x4e')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x1b28('0x46')](_0x1b28('0x99'),this[_0x1b28('0x19')][_0x1e061f[_0x1b28('0x40')][_0x1b28('0x4a')]('-')[0x0]][_0x1b28('0x4f')]),_0x1b28('0x9a'),{'destaccountcode':this['agents'][_0x1e061f[_0x1b28('0x40')][_0x1b28('0x4a')]('-')[0x0]][_0x1b28('0x4e')]});}}var _0x578bb8=this;Promise[_0x1b28('0x9b')]()[_0x1b28('0x9c')](function(){var _0x2fa16e=_0x578bb8[_0x1b28('0x18')][_0x1e061f['uniqueid']];if(typeof _0x2fa16e[_0x1b28('0x9d')]===_0x1b28('0x9e'))return;if(_[_0x1b28('0x9f')](_0x2fa16e[_0x1b28('0x73')]))return;return RpcSetting[_0x1b28('0xa0')]()[_0x1b28('0x9c')](function(_0x4cb526){if(!_0x4cb526[_0x1b28('0xa1')])return;return Promise[_0x1b28('0x9b')]()[_0x1b28('0x9c')](function(){return ami[_0x1b28('0xa2')]({'action':_0x1b28('0xa3'),'channel':_0x2fa16e[_0x1b28('0x40')]})[_0x1b28('0xa4')](function(){});})[_0x1b28('0x9c')](function(){return ami[_0x1b28('0xa2')]({'action':_0x1b28('0xa3'),'channel':_0x2fa16e[_0x1b28('0x67')]})[_0x1b28('0xa4')](function(){})[_0x1b28('0xa5')](function(){var _0xe5d17f=_0x578bb8[_0x1b28('0x19')][_0x2fa16e[_0x1b28('0x67')][_0x1b28('0x4a')]('-')[0x0]];if(!_0xe5d17f)return;io[_0x1b28('0x34')](_0x1b28('0xa6'),{'agentId':_0xe5d17f['id'],'uniqueid':_0x2fa16e[_0x1b28('0x36')]});});});});})['then'](function(){if(_0x1e061f[_0x1b28('0xa7')]==='BlindTransfer'){_0x578bb8[_0x1b28('0x1a')][_0x1e061f['uniqueid']]=_0x578bb8[_0x1b28('0x18')][_0x1e061f['uniqueid']];}else{if(_0x578bb8[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]][_0x1b28('0x81')]===_0x1b28('0xa8')&&_0x578bb8['blindTransfers'][_0x1e061f[_0x1b28('0x36')]]){_0x578bb8[_0x1b28('0x18')][_0x1e061f['uniqueid']][_0x1b28('0x36')]=[_0x578bb8[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]][_0x1b28('0x3a')],_0x578bb8[_0x1b28('0x18')][_0x1e061f['uniqueid']][_0x1b28('0x3a')]=_0x578bb8[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]][_0x1b28('0x36')]][0x0];delete _0x578bb8[_0x1b28('0x1a')][_0x1e061f['uniqueid']];}}logger[_0x1b28('0x38')](_0x1b28('0xa9'),_0x1e061f[_0x1b28('0x36')],util['inspect'](_0x578bb8[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]],{'showHidden':![],'depth':null}));ami[_0x1b28('0x34')](_0x1b28('0xaa'),_0x578bb8[_0x1b28('0x18')][_0x1e061f[_0x1b28('0x36')]]);delete _0x578bb8['channels'][_0x1e061f[_0x1b28('0x36')]];});}}}catch(_0x236927){logger[_0x1b28('0x2e')](_0x1b28('0xab'),_0x1e061f[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x236927,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1b28('0x26')]=function(_0x41adde){try{if(this['isNotNull'](_0x41adde)){logger[_0x1b28('0x42')](_0x1b28('0xac'),_0x41adde[_0x1b28('0x36')],_0x41adde[_0x1b28('0xad')],_0x41adde[_0x1b28('0xae')]);logger[_0x1b28('0x38')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x41adde[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x41adde,{'showHidden':![],'depth':null}));if(this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xaf')]]){this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xaf')]]['transfercalleridnum']=_0x41adde['origtransferercalleridnum'];this['channels'][_0x41adde[_0x1b28('0xaf')]]['transferconnectedlinenum']=_0x41adde['transfertargetcalleridnum'];if(this['channels'][_0x41adde['secondtransfereruniqueid']]){var _0x596d00=this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xb0')]];this[_0x1b28('0x18')][_0x41adde['secondtransfereruniqueid']]=this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xaf')]];this['channels'][_0x41adde['transfereeuniqueid']]=_0x596d00;}}else if(this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xb1')]]){this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xb1')]][_0x1b28('0xb2')]=_0x41adde[_0x1b28('0xad')];this['channels'][_0x41adde[_0x1b28('0xb1')]][_0x1b28('0xb3')]=_0x41adde[_0x1b28('0xae')];if(this[_0x1b28('0x18')][_0x41adde['origtransfereruniqueid']]){var _0x596d00=this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xb4')]];this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xb4')]]=this[_0x1b28('0x18')][_0x41adde['transfertargetuniqueid']];this['channels'][_0x41adde['transfertargetuniqueid']]=_0x596d00;}}if((this['channels'][_0x41adde[_0x1b28('0xb4')]]||this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xb5')]])&&this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xb0')]]){var _0x52c95c=_[_0x1b28('0xb6')]([this[_0x1b28('0x18')][_0x41adde['origtransfereruniqueid']],this['channels'][_0x41adde[_0x1b28('0xb5')]],this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xb0')]]],function(_0x71d6c){return _0x71d6c&&_0x71d6c[_0x1b28('0x81')]===_0x1b28('0xa8')&&_0x71d6c['routeid'];});if(_0x52c95c){if(this[_0x1b28('0x18')][_0x41adde['origtransfereruniqueid']])this['channels'][_0x41adde['origtransfereruniqueid']]['transferType']=_0x1b28('0xb7');if(this[_0x1b28('0x18')][_0x41adde[_0x1b28('0xb5')]])this['channels'][_0x41adde[_0x1b28('0xb5')]]['transferType']='ATTENDED';this[_0x1b28('0x18')][_0x41adde['secondtransfereruniqueid']][_0x1b28('0x9d')]=_0x1b28('0xb7');}}}}catch(_0x406055){logger[_0x1b28('0x2e')](_0x1b28('0xb8'),_0x41adde[_0x1b28('0x36')],util['inspect'](_0x406055,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1b28('0x28')]=function(_0x153995){try{if(this[_0x1b28('0x32')](_0x153995)){logger[_0x1b28('0x42')](_0x1b28('0xb9'),_0x153995[_0x1b28('0x36')],_0x153995['transfereecalleridnum'],_0x153995[_0x1b28('0xba')]);logger[_0x1b28('0x38')](_0x1b28('0xbb'),_0x153995[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x153995,{'showHidden':![],'depth':null}));if(this[_0x1b28('0x18')][_0x153995[_0x1b28('0xaf')]]){this[_0x1b28('0x18')][_0x153995[_0x1b28('0xaf')]][_0x1b28('0xb2')]=_0x153995[_0x1b28('0xbc')];this[_0x1b28('0x18')][_0x153995[_0x1b28('0xaf')]][_0x1b28('0xb3')]=_0x153995[_0x1b28('0xba')];this[_0x1b28('0x18')][_0x153995[_0x1b28('0xaf')]][_0x1b28('0x9d')]=_0x1b28('0xbd');this['syncHangup']({'event':_0x1b28('0xbe'),'uniqueid':_0x153995[_0x1b28('0xaf')],'context':_0x153995['context'],'channel':_0x153995[_0x1b28('0xbf')]});}else{this['channels'][_0x153995[_0x1b28('0xc0')]][_0x1b28('0x9d')]=_0x1b28('0xbd');}}}catch(_0x33be7b){logger['error'](_0x1b28('0xc1'),_0x153995[_0x1b28('0x36')],util['inspect'](_0x33be7b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1b28('0x2a')]=function(_0x526867){try{if(this[_0x1b28('0x32')](_0x526867)){logger[_0x1b28('0x38')](_0x1b28('0xc2'),_0x526867[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x526867,{'showHidden':![],'depth':null}));if(this[_0x1b28('0x18')][_0x526867[_0x1b28('0x36')]]){if(!_[_0x1b28('0x74')](this[_0x1b28('0x18')][_0x526867['uniqueid']][_0x1b28('0x96')])){this[_0x1b28('0x18')][_0x526867[_0x1b28('0x36')]]['mohstarttime']=moment()[_0x1b28('0x46')](_0x1b28('0x47'));logger['info'](_0x1b28('0xc3'),_0x526867['uniqueid'],this[_0x1b28('0x18')][_0x526867[_0x1b28('0x36')]]['mohstarttime']);}}}}catch(_0x60c95f){logger[_0x1b28('0x2e')](_0x1b28('0xc4'),_0x526867['uniqueid'],util[_0x1b28('0x30')](_0x60c95f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1b28('0x2c')]=function(_0x27068b){try{if(this[_0x1b28('0x32')](_0x27068b)){logger[_0x1b28('0x38')](_0x1b28('0xc5'),_0x27068b[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x27068b,{'showHidden':![],'depth':null}));if(this[_0x1b28('0x18')][_0x27068b[_0x1b28('0x36')]]){if(!_[_0x1b28('0x74')](this[_0x1b28('0x18')][_0x27068b['uniqueid']][_0x1b28('0xc6')])){this[_0x1b28('0x18')][_0x27068b[_0x1b28('0x36')]]['mohtime']+=moment()[_0x1b28('0xc7')](0x0)['diff'](this[_0x1b28('0x18')][_0x27068b['uniqueid']][_0x1b28('0xc6')],_0x1b28('0x56'));logger[_0x1b28('0x42')](_0x1b28('0xc8'),_0x27068b[_0x1b28('0x36')],this['channels'][_0x27068b[_0x1b28('0x36')]][_0x1b28('0xc9')]);delete this[_0x1b28('0x18')][_0x27068b[_0x1b28('0x36')]][_0x1b28('0xc6')];}}}}catch(_0x4695f5){logger[_0x1b28('0x2e')](_0x1b28('0xca'),_0x27068b[_0x1b28('0x36')],util[_0x1b28('0x30')](_0x4695f5,{'showHidden':![],'depth':null}));}};module[_0x1b28('0xcb')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 502830f..8c01b4e 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 _0xea91=['[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','membername','interface','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','endtime','duration','starttime','complete','total','answertime','answered','seconds','diff','sumHoldTime','holdtime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','linkedid','exports','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','isUndefined','prototype','emit','isNotNull','debug'];(function(_0x23c679,_0x146416){var _0x370759=function(_0x1fb38d){while(--_0x1fb38d){_0x23c679['push'](_0x23c679['shift']());}};_0x370759(++_0x146416);}(_0xea91,0x180));var _0x1ea9=function(_0x291830,_0x386bb0){_0x291830=_0x291830-0x0;var _0x4713e2=_0xea91[_0x291830];return _0x4713e2;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0x1ea9('0x0'));var config=require(_0x1ea9('0x1'));var logger=require(_0x1ea9('0x2'))(_0x1ea9('0x3'));var ami=require(_0x1ea9('0x4'));config[_0x1ea9('0x5')]=_[_0x1ea9('0x6')](config[_0x1ea9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1ea9('0x7'))(new Redis(config['redis']));function VoiceDialReport(_0x713d83){this[_0x1ea9('0x8')]=_0x713d83['outboundChannels'];this[_0x1ea9('0x9')]=_0x713d83[_0x1ea9('0x9')];this[_0x1ea9('0xa')]={};ami['on'](_0x1ea9('0xb'),this[_0x1ea9('0xc')][_0x1ea9('0xd')](this));ami['on'](_0x1ea9('0xe'),this[_0x1ea9('0xf')]['bind'](this));ami['on'](_0x1ea9('0x10'),this['syncVarSet']['bind'](this));ami['on'](_0x1ea9('0x11'),this[_0x1ea9('0x12')]['bind'](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x474936){return _0x474936!==null&&!_[_0x1ea9('0x13')](_0x474936);};VoiceDialReport[_0x1ea9('0x14')][_0x1ea9('0x15')]=function(_0x56b83d,_0x1eecf1,_0x436fd0){io['to'](_0x56b83d)[_0x1ea9('0x15')](_0x1eecf1,_0x436fd0);};VoiceDialReport[_0x1ea9('0x14')][_0x1ea9('0xc')]=function(_0x56ea36){try{if(this[_0x1ea9('0x16')](_0x56ea36)){logger[_0x1ea9('0x17')](_0x1ea9('0x18'),_0x56ea36[_0x1ea9('0x19')],util[_0x1ea9('0x1a')](_0x56ea36,{'showHidden':![],'depth':null}));if(this[_0x1ea9('0x8')][_0x56ea36[_0x1ea9('0x19')]]){_[_0x1ea9('0x1b')](this[_0x1ea9('0x8')][_0x56ea36[_0x1ea9('0x19')]],{'starttime':moment()[_0x1ea9('0x1c')](_0x1ea9('0x1d')),'lastevent':_0x1ea9('0x1e'),'interface':_0x56ea36['channel']['substring'](0x0,_0x56ea36['channel']['lastIndexOf']('-')),'membername':_0x56ea36[_0x1ea9('0x1f')][_0x1ea9('0x20')](_0x56ea36[_0x1ea9('0x1f')][_0x1ea9('0x21')]('/')+0x1,_0x56ea36[_0x1ea9('0x1f')]['lastIndexOf']('-'))},_[_0x1ea9('0x22')](_0x56ea36,[_0x1ea9('0x23'),_0x1ea9('0x24')]));logger[_0x1ea9('0x25')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x56ea36[_0x1ea9('0x19')],this['channels'][_0x56ea36['uniqueid']][_0x1ea9('0x26')],this[_0x1ea9('0x8')][_0x56ea36[_0x1ea9('0x19')]][_0x1ea9('0x27')]);logger[_0x1ea9('0x17')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x56ea36[_0x1ea9('0x19')],util[_0x1ea9('0x1a')](this[_0x1ea9('0x8')][_0x56ea36[_0x1ea9('0x19')]],{'showHidden':![],'depth':null}));this[_0x1ea9('0x15')](_0x1ea9('0x28'),_0x1ea9('0x29'),this['channels'][_0x56ea36['uniqueid']]);logger['debug'](_0x1ea9('0x2a'),_0x56ea36[_0x1ea9('0x19')],util[_0x1ea9('0x1a')](this[_0x1ea9('0x8')][_0x56ea36['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialbegin',this[_0x1ea9('0x8')][_0x56ea36[_0x1ea9('0x19')]]);}}}catch(_0x25f086){logger[_0x1ea9('0x2b')](_0x1ea9('0x2c'),_0x56ea36['uniqueid'],util['inspect'](_0x25f086,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1ea9('0x14')][_0x1ea9('0xf')]=function(_0x20542a){try{if(this[_0x1ea9('0x16')](_0x20542a)){logger['debug']('[%s][voiceDialReport][dialend]\x20event:',_0x20542a[_0x1ea9('0x19')],util['inspect'](_0x20542a,{'showHidden':![],'depth':null}));if(this[_0x1ea9('0x8')][_0x20542a[_0x1ea9('0x19')]]){this[_0x1ea9('0x8')][_0x20542a['uniqueid']][_0x1ea9('0x2d')]=_0x20542a['dialstatus'];if(_0x20542a[_0x1ea9('0x2d')]===_0x1ea9('0x2e')){this[_0x1ea9('0x8')][_0x20542a[_0x1ea9('0x19')]]['connectedlinenum']=_0x20542a[_0x1ea9('0x2f')];this[_0x1ea9('0x8')][_0x20542a[_0x1ea9('0x19')]][_0x1ea9('0x30')]=_0x20542a[_0x1ea9('0x30')];this[_0x1ea9('0x8')][_0x20542a['uniqueid']]['answertime']=moment()['format'](_0x1ea9('0x1d'));this[_0x1ea9('0x8')][_0x20542a[_0x1ea9('0x19')]][_0x1ea9('0x31')]=_0x1ea9('0x32');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x20542a[_0x1ea9('0x19')],_0x20542a[_0x1ea9('0x1f')][_0x1ea9('0x20')](_0x20542a[_0x1ea9('0x1f')][_0x1ea9('0x21')]('/')+0x1,_0x20542a['channel'][_0x1ea9('0x21')]('-')));logger[_0x1ea9('0x17')](_0x1ea9('0x33'),_0x20542a[_0x1ea9('0x19')],util[_0x1ea9('0x1a')](this[_0x1ea9('0x8')][_0x20542a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x1ea9('0x15')](_0x1ea9('0x34'),this['channels'][_0x20542a[_0x1ea9('0x19')]]);}logger[_0x1ea9('0x17')](_0x1ea9('0x35'),_0x20542a['uniqueid'],util[_0x1ea9('0x1a')](this['channels'][_0x20542a[_0x1ea9('0x19')]],{'showHidden':![],'depth':null}));this[_0x1ea9('0x15')](_0x1ea9('0x28'),_0x1ea9('0x29'),this[_0x1ea9('0x8')][_0x20542a['uniqueid']]);}}}catch(_0x3100ee){logger[_0x1ea9('0x2b')](_0x1ea9('0x36'),_0x20542a[_0x1ea9('0x19')],util['inspect'](_0x3100ee,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1ea9('0x14')][_0x1ea9('0x37')]=function(_0x3c6a1e){try{if(this[_0x1ea9('0x16')](_0x3c6a1e)){logger[_0x1ea9('0x17')](_0x1ea9('0x38'),_0x3c6a1e[_0x1ea9('0x19')],util[_0x1ea9('0x1a')](_0x3c6a1e,{'showHidden':![],'depth':null}));this[_0x1ea9('0x39')](_0x3c6a1e[_0x1ea9('0x19')],_[_0x1ea9('0x3a')](_0x3c6a1e[_0x1ea9('0x3b')])[0x0],_0x3c6a1e[_0x1ea9('0x3c')]);if(this[_0x1ea9('0x16')](_0x3c6a1e[_0x1ea9('0x3b')])&&this[_0x1ea9('0x16')](_0x3c6a1e[_0x1ea9('0x3b')][_0x1ea9('0x3d')])){if(_['isUndefined'](this[_0x1ea9('0x8')][_0x3c6a1e[_0x1ea9('0x19')]])){this['channels'][_0x3c6a1e['uniqueid']]={'routeId':_0x3c6a1e['value'],'variables':this[_0x1ea9('0xa')][_0x3c6a1e[_0x1ea9('0x19')]]};logger[_0x1ea9('0x25')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x3c6a1e[_0x1ea9('0x19')],_0x3c6a1e[_0x1ea9('0x3b')]['outboundrouteid'],_['keys'](_0x3c6a1e[_0x1ea9('0x3b')])[0x0],_0x3c6a1e['value']);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x3c6a1e['uniqueid'],util[_0x1ea9('0x1a')](this[_0x1ea9('0x8')][_0x3c6a1e[_0x1ea9('0x19')]],{'showHidden':![],'depth':null}));this[_0x1ea9('0x15')]('voice:outbound',_0x1ea9('0x29'),this['channels'][_0x3c6a1e[_0x1ea9('0x19')]]);}}}}catch(_0x42a889){logger['error'](_0x1ea9('0x3e'),_0x3c6a1e[_0x1ea9('0x19')],util[_0x1ea9('0x1a')](_0x42a889,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1ea9('0x14')]['addVariable']=function(_0x1caff7,_0x4e674d,_0x139e91){var _0x504740=[_0x1ea9('0x3f'),_0x1ea9('0x40'),_0x1ea9('0x41'),_0x1ea9('0x42'),'rtpaudioqosloss',_0x1ea9('0x43'),'rtpaudioqosrtt',_0x1ea9('0x44'),'sipcallid',_0x1ea9('0x45'),_0x1ea9('0x46'),_0x1ea9('0x47'),'membercalls',_0x1ea9('0x48'),_0x1ea9('0x49'),_0x1ea9('0x4a'),_0x1ea9('0x26'),_0x1ea9('0x4b'),_0x1ea9('0x4c')];if(!_['isNil'](_0x4e674d)&&!_[_0x1ea9('0x4d')](_0x504740,_0x4e674d)){if(_[_0x1ea9('0x13')](this[_0x1ea9('0xa')][_0x1caff7])){this[_0x1ea9('0xa')][_0x1caff7]={};}this[_0x1ea9('0xa')][_0x1caff7][_0x4e674d]=_0x139e91;}};VoiceDialReport[_0x1ea9('0x14')][_0x1ea9('0x12')]=function(_0xf2b97e){try{if(this[_0x1ea9('0x16')](_0xf2b97e)){logger[_0x1ea9('0x17')](_0x1ea9('0x4e'),_0xf2b97e['uniqueid'],util[_0x1ea9('0x1a')](_0xf2b97e,{'showHidden':![],'depth':null}));if(this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]]){logger[_0x1ea9('0x25')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0xf2b97e[_0x1ea9('0x19')],_0xf2b97e['cause-txt']);this[_0x1ea9('0x8')][_0xf2b97e['uniqueid']][_0x1ea9('0x4f')]=moment()[_0x1ea9('0x1c')](_0x1ea9('0x1d'));this['channels'][_0xf2b97e[_0x1ea9('0x19')]][_0x1ea9('0x50')]=moment(this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]][_0x1ea9('0x4f')])['diff'](this[_0x1ea9('0x8')][_0xf2b97e['uniqueid']][_0x1ea9('0x51')],'seconds');this['channels'][_0xf2b97e[_0x1ea9('0x19')]][_0x1ea9('0x31')]=_0x1ea9('0x52');this['outbound'][_0x1ea9('0x53')]+=0x1;if(this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]][_0x1ea9('0x54')]){this[_0x1ea9('0x9')][_0x1ea9('0x55')]+=0x1;this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]]['holdtime']=moment(this['channels'][_0xf2b97e[_0x1ea9('0x19')]][_0x1ea9('0x54')])['diff'](this['channels'][_0xf2b97e[_0x1ea9('0x19')]][_0x1ea9('0x51')],_0x1ea9('0x56'));this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]]['billableseconds']=moment(this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]]['endtime'])[_0x1ea9('0x57')](this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]][_0x1ea9('0x54')],_0x1ea9('0x56'));this['outbound'][_0x1ea9('0x58')]+=this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]][_0x1ea9('0x59')]||0x0;this['outbound'][_0x1ea9('0x5a')]+=this['channels'][_0xf2b97e[_0x1ea9('0x19')]][_0x1ea9('0x5b')];}this[_0x1ea9('0x9')][_0x1ea9('0x5c')]+=this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]][_0x1ea9('0x50')];logger[_0x1ea9('0x17')](_0x1ea9('0x5d'),_0xf2b97e[_0x1ea9('0x19')],util[_0x1ea9('0x1a')](this[_0x1ea9('0x8')][_0xf2b97e['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this['channels'][_0xf2b97e['uniqueid']]);logger['debug'](_0x1ea9('0x5e'),_0xf2b97e[_0x1ea9('0x19')],util[_0x1ea9('0x1a')](this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]]);logger[_0x1ea9('0x17')](_0x1ea9('0x5f'),_0xf2b97e[_0x1ea9('0x19')],util['inspect'](this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]],{'showHidden':![],'depth':null}));this[_0x1ea9('0x15')](_0x1ea9('0x28'),_0x1ea9('0x60'),this['outbound']);logger[_0x1ea9('0x25')](_0x1ea9('0x61'),JSON[_0x1ea9('0x62')](this[_0x1ea9('0x8')][_0xf2b97e['uniqueid']]));logger[_0x1ea9('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0xf2b97e[_0x1ea9('0x19')],util['inspect'](this['channels'][_0xf2b97e['uniqueid']],{'showHidden':![],'depth':null}));this[_0x1ea9('0x15')](_0x1ea9('0x28'),_0x1ea9('0x63'),this['channels'][_0xf2b97e[_0x1ea9('0x19')]]);delete this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x19')]];}else if(this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x64')]]){this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x64')]][_0x1ea9('0x19')]=this[_0x1ea9('0x8')][_0xf2b97e[_0x1ea9('0x64')]]['destuniqueid'];}if(this[_0x1ea9('0xa')][_0xf2b97e[_0x1ea9('0x19')]]){delete this['variables'][_0xf2b97e['uniqueid']];}}}catch(_0x13818f){logger[_0x1ea9('0x2b')]('[%s][voiceDialReport][hangup]',_0xf2b97e[_0x1ea9('0x19')],util[_0x1ea9('0x1a')](_0x13818f,{'showHidden':![],'depth':null}));}};module[_0x1ea9('0x65')]=VoiceDialReport; \ No newline at end of file +var _0x4357=['answertime','answered','holdtime','sumHoldTime','billableseconds','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','stringify','voice_outbound_channel:remove','linkedid','destuniqueid','exports','lodash','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','syncDialBegin','syncDialEnd','bind','varset','syncVarSet','hangup','syncHangup','emit','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','inspect','channels','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','prototype','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','isUndefined','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total'];(function(_0x4bf499,_0x3cf93f){var _0x5675de=function(_0x3f9bd2){while(--_0x3f9bd2){_0x4bf499['push'](_0x4bf499['shift']());}};_0x5675de(++_0x3cf93f);}(_0x4357,0x1a2));var _0x7435=function(_0x34fab4,_0x194738){_0x34fab4=_0x34fab4-0x0;var _0x42fa5c=_0x4357[_0x34fab4];return _0x42fa5c;};'use strict';var _=require(_0x7435('0x0'));var moment=require('moment');var util=require(_0x7435('0x1'));var Redis=require(_0x7435('0x2'));var config=require('../../../config/environment');var logger=require(_0x7435('0x3'))(_0x7435('0x4'));var ami=require(_0x7435('0x5'));config[_0x7435('0x6')]=_[_0x7435('0x7')](config[_0x7435('0x6')],{'host':_0x7435('0x8'),'port':0x18eb});var io=require(_0x7435('0x9'))(new Redis(config[_0x7435('0x6')]));function VoiceDialReport(_0x3493c6){this['channels']=_0x3493c6[_0x7435('0xa')];this[_0x7435('0xb')]=_0x3493c6['outbound'];this[_0x7435('0xc')]={};ami['on'](_0x7435('0xd'),this[_0x7435('0xe')]['bind'](this));ami['on']('dialend',this[_0x7435('0xf')][_0x7435('0x10')](this));ami['on'](_0x7435('0x11'),this[_0x7435('0x12')]['bind'](this));ami['on'](_0x7435('0x13'),this[_0x7435('0x14')][_0x7435('0x10')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x41adbc){return _0x41adbc!==null&&!_['isUndefined'](_0x41adbc);};VoiceDialReport['prototype'][_0x7435('0x15')]=function(_0x1015e1,_0x5f568f,_0x5a06bd){io['to'](_0x1015e1)[_0x7435('0x15')](_0x5f568f,_0x5a06bd);};VoiceDialReport['prototype'][_0x7435('0xe')]=function(_0x51075e){try{if(this[_0x7435('0x16')](_0x51075e)){logger['debug'](_0x7435('0x17'),_0x51075e['uniqueid'],util[_0x7435('0x18')](_0x51075e,{'showHidden':![],'depth':null}));if(this[_0x7435('0x19')][_0x51075e['uniqueid']]){_[_0x7435('0x1a')](this[_0x7435('0x19')][_0x51075e['uniqueid']],{'starttime':moment()[_0x7435('0x1b')](_0x7435('0x1c')),'lastevent':'called','interface':_0x51075e[_0x7435('0x1d')][_0x7435('0x1e')](0x0,_0x51075e['channel'][_0x7435('0x1f')]('-')),'membername':_0x51075e[_0x7435('0x1d')][_0x7435('0x1e')](_0x51075e[_0x7435('0x1d')][_0x7435('0x1f')]('/')+0x1,_0x51075e[_0x7435('0x1d')][_0x7435('0x1f')]('-'))},_[_0x7435('0x20')](_0x51075e,[_0x7435('0x21'),_0x7435('0x22')]));logger['info'](_0x7435('0x23'),_0x51075e[_0x7435('0x24')],this[_0x7435('0x19')][_0x51075e[_0x7435('0x24')]][_0x7435('0x25')],this[_0x7435('0x19')][_0x51075e[_0x7435('0x24')]]['interface']);logger[_0x7435('0x26')](_0x7435('0x27'),_0x51075e['uniqueid'],util[_0x7435('0x18')](this['channels'][_0x51075e[_0x7435('0x24')]],{'showHidden':![],'depth':null}));this['emit'](_0x7435('0x28'),_0x7435('0x29'),this[_0x7435('0x19')][_0x51075e[_0x7435('0x24')]]);logger[_0x7435('0x26')](_0x7435('0x2a'),_0x51075e[_0x7435('0x24')],util[_0x7435('0x18')](this[_0x7435('0x19')][_0x51075e[_0x7435('0x24')]],{'showHidden':![],'depth':null}));ami[_0x7435('0x15')](_0x7435('0x2b'),this[_0x7435('0x19')][_0x51075e['uniqueid']]);}}}catch(_0x3766f5){logger[_0x7435('0x2c')](_0x7435('0x2d'),_0x51075e[_0x7435('0x24')],util[_0x7435('0x18')](_0x3766f5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7435('0x2e')][_0x7435('0xf')]=function(_0x13f8a9){try{if(this[_0x7435('0x16')](_0x13f8a9)){logger[_0x7435('0x26')](_0x7435('0x2f'),_0x13f8a9[_0x7435('0x24')],util[_0x7435('0x18')](_0x13f8a9,{'showHidden':![],'depth':null}));if(this[_0x7435('0x19')][_0x13f8a9['uniqueid']]){this['channels'][_0x13f8a9[_0x7435('0x24')]]['dialstatus']=_0x13f8a9['dialstatus'];if(_0x13f8a9[_0x7435('0x30')]===_0x7435('0x31')){this[_0x7435('0x19')][_0x13f8a9[_0x7435('0x24')]][_0x7435('0x32')]=_0x13f8a9['connectedlinenum'];this[_0x7435('0x19')][_0x13f8a9['uniqueid']]['connectedlinename']=_0x13f8a9['connectedlinename'];this['channels'][_0x13f8a9['uniqueid']]['answertime']=moment()[_0x7435('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7435('0x19')][_0x13f8a9[_0x7435('0x24')]][_0x7435('0x33')]=_0x7435('0x34');logger[_0x7435('0x35')](_0x7435('0x36'),_0x13f8a9[_0x7435('0x24')],_0x13f8a9[_0x7435('0x1d')][_0x7435('0x1e')](_0x13f8a9[_0x7435('0x1d')][_0x7435('0x1f')]('/')+0x1,_0x13f8a9['channel']['lastIndexOf']('-')));logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x13f8a9[_0x7435('0x24')],util[_0x7435('0x18')](this[_0x7435('0x19')][_0x13f8a9[_0x7435('0x24')]],{'showHidden':![],'depth':null}));ami[_0x7435('0x15')](_0x7435('0x37'),this[_0x7435('0x19')][_0x13f8a9['uniqueid']]);}logger[_0x7435('0x26')](_0x7435('0x38'),_0x13f8a9[_0x7435('0x24')],util[_0x7435('0x18')](this[_0x7435('0x19')][_0x13f8a9['uniqueid']],{'showHidden':![],'depth':null}));this[_0x7435('0x15')](_0x7435('0x28'),'voice_outbound_channel:save',this['channels'][_0x13f8a9[_0x7435('0x24')]]);}}}catch(_0xc869e9){logger[_0x7435('0x2c')]('[%s][voiceDialReport][dialend]',_0x13f8a9['uniqueid'],util['inspect'](_0xc869e9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7435('0x2e')]['syncVarSet']=function(_0x464da6){try{if(this['isNotNull'](_0x464da6)){logger['debug']('[%s][voiceDialReport][varset]\x20event:',_0x464da6[_0x7435('0x24')],util[_0x7435('0x18')](_0x464da6,{'showHidden':![],'depth':null}));this[_0x7435('0x39')](_0x464da6[_0x7435('0x24')],_[_0x7435('0x3a')](_0x464da6[_0x7435('0x3b')])[0x0],_0x464da6[_0x7435('0x3c')]);if(this['isNotNull'](_0x464da6[_0x7435('0x3b')])&&this[_0x7435('0x16')](_0x464da6['variable'][_0x7435('0x3d')])){if(_['isUndefined'](this[_0x7435('0x19')][_0x464da6[_0x7435('0x24')]])){this['channels'][_0x464da6[_0x7435('0x24')]]={'routeId':_0x464da6[_0x7435('0x3c')],'variables':this[_0x7435('0xc')][_0x464da6[_0x7435('0x24')]]};logger[_0x7435('0x35')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x464da6[_0x7435('0x24')],_0x464da6[_0x7435('0x3b')][_0x7435('0x3d')],_[_0x7435('0x3a')](_0x464da6[_0x7435('0x3b')])[0x0],_0x464da6[_0x7435('0x3c')]);logger['debug'](_0x7435('0x3e'),_0x464da6[_0x7435('0x24')],util[_0x7435('0x18')](this[_0x7435('0x19')][_0x464da6[_0x7435('0x24')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x7435('0x19')][_0x464da6[_0x7435('0x24')]]);}}}}catch(_0x5ac8b1){logger['error']('[%s][voiceDialReport][varset]',_0x464da6[_0x7435('0x24')],util[_0x7435('0x18')](_0x5ac8b1,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x7435('0x39')]=function(_0x3692b4,_0x2828d4,_0x1d70b5){var _0x2d8e4e=[_0x7435('0x3f'),'rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss',_0x7435('0x40'),_0x7435('0x41'),_0x7435('0x42'),_0x7435('0x43'),_0x7435('0x44'),'bridgepeer',_0x7435('0x45'),_0x7435('0x46'),'memberdynamic',_0x7435('0x47'),_0x7435('0x48'),'membername',_0x7435('0x49'),_0x7435('0x4a')];if(!_[_0x7435('0x4b')](_0x2828d4)&&!_['includes'](_0x2d8e4e,_0x2828d4)){if(_[_0x7435('0x4c')](this[_0x7435('0xc')][_0x3692b4])){this[_0x7435('0xc')][_0x3692b4]={};}this[_0x7435('0xc')][_0x3692b4][_0x2828d4]=_0x1d70b5;}};VoiceDialReport[_0x7435('0x2e')][_0x7435('0x14')]=function(_0x33f9ef){try{if(this['isNotNull'](_0x33f9ef)){logger[_0x7435('0x26')](_0x7435('0x4d'),_0x33f9ef[_0x7435('0x24')],util[_0x7435('0x18')](_0x33f9ef,{'showHidden':![],'depth':null}));if(this[_0x7435('0x19')][_0x33f9ef['uniqueid']]){logger[_0x7435('0x35')](_0x7435('0x4e'),_0x33f9ef['uniqueid'],_0x33f9ef[_0x7435('0x4f')]);this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]][_0x7435('0x50')]=moment()[_0x7435('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]][_0x7435('0x51')]=moment(this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]][_0x7435('0x50')])[_0x7435('0x52')](this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]][_0x7435('0x53')],_0x7435('0x54'));this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]][_0x7435('0x33')]=_0x7435('0x55');this['outbound'][_0x7435('0x56')]+=0x1;if(this['channels'][_0x33f9ef[_0x7435('0x24')]][_0x7435('0x57')]){this[_0x7435('0xb')][_0x7435('0x58')]+=0x1;this['channels'][_0x33f9ef['uniqueid']][_0x7435('0x59')]=moment(this[_0x7435('0x19')][_0x33f9ef['uniqueid']][_0x7435('0x57')])[_0x7435('0x52')](this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]][_0x7435('0x53')],_0x7435('0x54'));this['channels'][_0x33f9ef[_0x7435('0x24')]]['billableseconds']=moment(this['channels'][_0x33f9ef['uniqueid']]['endtime'])[_0x7435('0x52')](this['channels'][_0x33f9ef[_0x7435('0x24')]][_0x7435('0x57')],_0x7435('0x54'));this[_0x7435('0xb')][_0x7435('0x5a')]+=this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]][_0x7435('0x59')]||0x0;this[_0x7435('0xb')]['sumBillable']+=this['channels'][_0x33f9ef[_0x7435('0x24')]][_0x7435('0x5b')];}this[_0x7435('0xb')]['sumDuration']+=this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]]['duration'];logger['debug'](_0x7435('0x5c'),_0x33f9ef[_0x7435('0x24')],util['inspect'](this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]],{'showHidden':![],'depth':null}));ami[_0x7435('0x15')]('custom:voiceDialReport',this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]]);logger[_0x7435('0x26')](_0x7435('0x5d'),_0x33f9ef[_0x7435('0x24')],util[_0x7435('0x18')](this['channels'][_0x33f9ef[_0x7435('0x24')]],{'showHidden':![],'depth':null}));ami['emit'](_0x7435('0x5e'),this[_0x7435('0x19')][_0x33f9ef['uniqueid']]);logger[_0x7435('0x26')](_0x7435('0x5f'),_0x33f9ef[_0x7435('0x24')],util[_0x7435('0x18')](this[_0x7435('0x19')][_0x33f9ef['uniqueid']],{'showHidden':![],'depth':null}));this[_0x7435('0x15')](_0x7435('0x28'),'voice_outbound:save',this[_0x7435('0xb')]);logger[_0x7435('0x35')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x7435('0x60')](this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]]));logger[_0x7435('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x33f9ef['uniqueid'],util['inspect'](this[_0x7435('0x19')][_0x33f9ef['uniqueid']],{'showHidden':![],'depth':null}));this[_0x7435('0x15')]('voice:outbound',_0x7435('0x61'),this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x24')]]);delete this[_0x7435('0x19')][_0x33f9ef['uniqueid']];}else if(this['channels'][_0x33f9ef[_0x7435('0x62')]]){this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x62')]][_0x7435('0x24')]=this[_0x7435('0x19')][_0x33f9ef[_0x7435('0x62')]][_0x7435('0x63')];}if(this['variables'][_0x33f9ef['uniqueid']]){delete this['variables'][_0x33f9ef[_0x7435('0x24')]];}}}catch(_0xa3c87d){logger[_0x7435('0x2c')]('[%s][voiceDialReport][hangup]',_0x33f9ef[_0x7435('0x24')],util[_0x7435('0x18')](_0xa3c87d,{'showHidden':![],'depth':null}));}};module[_0x7435('0x64')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 792d1c2..720fd01 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 _0xb6b1=['[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','name','voice_queue_channel:save','emit','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','strategy','answered','available','loggedIn','sumDuration','unmanaged','abandoned','Trunk','active','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','loopQueueSummary','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummary]\x20event:','countBy','queue','toNumber','callers','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','syncAgentConnect','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','queuecallerexitAt','reason','COMPLETED','toLowerCase','local/','linkedid','queuecallerexit','FORWARDTRANSFER','transfer','transfertype','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','agentcomplete','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','variables','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','membercalls','memberinterface','membername','memberpenalty','memberrealtime','includes','length','sumHoldTime','diff','seconds','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','transfereeuniqueid','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','util','ioredis','../../../config/environment','ami','../model/queueReport','redis','defaults','socket.io-emitter','prototype','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','queuesummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','clearZombieChannels','switch','enqueue','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0xb6b1[_0x5db657];return _0x2d6e70;};'use strict';var _=require(_0x1b6b('0x0'));var moment=require('moment');var util=require(_0x1b6b('0x1'));var md5=require('md5');var Redis=require(_0x1b6b('0x2'));var config=require(_0x1b6b('0x3'));var logger=require('../../../config/logger')(_0x1b6b('0x4'));var ami=require('../ami');var QueueReport=require(_0x1b6b('0x5'));config[_0x1b6b('0x6')]=_[_0x1b6b('0x7')](config[_0x1b6b('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x1b6b('0x8'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x1b6b('0x9')]['enqueue']=function(_0x21f403){this[_0x1b6b('0xa')]=this[_0x1b6b('0xa')]?this[_0x1b6b('0xa')]['finally'](_0x21f403):_0x21f403();};function VoiceQueueReport(_0x4c750a){this[_0x1b6b('0xb')]=new Sequence();this[_0x1b6b('0xc')]={};this[_0x1b6b('0xd')]=_0x4c750a[_0x1b6b('0xd')];this[_0x1b6b('0xe')]=_0x4c750a[_0x1b6b('0xf')];this[_0x1b6b('0x10')]=_0x4c750a['voiceQueues'];this[_0x1b6b('0x11')]=!![];this[_0x1b6b('0x12')]=_0x4c750a[_0x1b6b('0x12')];this['variables']={};ami['on'](_0x1b6b('0x13'),this['syncQueueSummary']['bind'](this));ami['on'](_0x1b6b('0x14'),this[_0x1b6b('0x15')][_0x1b6b('0x16')](this));ami['on'](_0x1b6b('0x17'),this[_0x1b6b('0x18')][_0x1b6b('0x16')](this));ami['on'](_0x1b6b('0x19'),this['syncQueueCallerAbandon'][_0x1b6b('0x16')](this));ami['on'](_0x1b6b('0x1a'),this[_0x1b6b('0x1b')][_0x1b6b('0x16')](this));ami['on']('agentcomplete',this[_0x1b6b('0x1c')][_0x1b6b('0x16')](this));ami['on'](_0x1b6b('0x1d'),this['syncAgentConnect'][_0x1b6b('0x16')](this));ami['on'](_0x1b6b('0x1e'),this[_0x1b6b('0x1f')][_0x1b6b('0x16')](this));ami['on'](_0x1b6b('0x20'),this[_0x1b6b('0x21')][_0x1b6b('0x16')](this));ami['on'](_0x1b6b('0x22'),this[_0x1b6b('0x23')][_0x1b6b('0x16')](this));ami['on']('musiconholdstart',this[_0x1b6b('0x24')][_0x1b6b('0x16')](this));ami['on'](_0x1b6b('0x25'),this[_0x1b6b('0x26')][_0x1b6b('0x16')](this));ami['on'](_0x1b6b('0x27'),this[_0x1b6b('0x28')][_0x1b6b('0x16')](this));ami['on'](_0x1b6b('0x29'),this['syncBlindTransfer'][_0x1b6b('0x16')](this));this['loopQueueSummary']();this['loopQueueShow']();}function clearChannels(_0x4cb089){if(!_[_0x1b6b('0x2a')](_0x4cb089)){for(var _0xc9554d in _0x4cb089){if(_0x4cb089['hasOwnProperty'](_0xc9554d)){delete _0x4cb089[_0xc9554d];}}}}function clearCampaigns(_0x6a317c){if(!_['isEmpty'](_0x6a317c)){for(var _0x15dfc7 in _0x6a317c){if(_0x6a317c[_0x1b6b('0x2b')](_0x15dfc7)){_0x6a317c[_0x15dfc7][_0x1b6b('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x308955){if(!_[_0x1b6b('0x2a')](_0x308955)){for(var _0x2aa755 in _0x308955){if(_0x308955['hasOwnProperty'](_0x2aa755)){_0x308955[_0x2aa755][_0x1b6b('0x2c')]=0x0;_0x308955[_0x2aa755][_0x1b6b('0x2d')]=0x0;_0x308955[_0x2aa755][_0x1b6b('0x2e')]=0x0;_0x308955[_0x2aa755][_0x1b6b('0x2f')]=0x0;_0x308955[_0x2aa755]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x23dac4){if(!_['isEmpty'](_0x23dac4)){for(var _0x5bbcd8 in _0x23dac4){if(_0x23dac4[_0x1b6b('0x2b')](_0x5bbcd8)){_0x23dac4[_0x5bbcd8]['unlockRR']=!![];}}}}VoiceQueueReport[_0x1b6b('0x9')][_0x1b6b('0x30')]=function(){var _0x4f89a9=this;for(var _0x4c42a9 in this[_0x1b6b('0xe')]){if(this[_0x1b6b('0xe')]['hasOwnProperty'](_0x4c42a9)&&!this['channels'][_0x4c42a9][_0x1b6b('0x31')]){this[_0x1b6b('0xb')][_0x1b6b('0x32')](function(){if(!_[_0x1b6b('0x33')](_0x4f89a9['channels'][_0x4c42a9])){return ami[_0x1b6b('0x34')]({'action':_0x1b6b('0x35'),'channel':_0x4f89a9[_0x1b6b('0xe')][_0x4c42a9][_0x1b6b('0x36')]})[_0x1b6b('0x37')](function(_0x2bb4a4){if(_0x2bb4a4[_0x1b6b('0x38')]===_0x1b6b('0x39')){setTimeout(function(){if(_0x4f89a9[_0x1b6b('0xe')][_0x4c42a9]){delete _0x4f89a9['channels'][_0x4c42a9];logger[_0x1b6b('0x3a')](_0x1b6b('0x3b'),_0x4c42a9,util[_0x1b6b('0x3c')](_0x2bb4a4,{'showHidden':![],'depth':null}));}if(_0x4f89a9[_0x1b6b('0xc')][_0x4c42a9]){delete _0x4f89a9['queueReports'][_0x4c42a9];logger[_0x1b6b('0x3a')]('[%s][voiceQueueReport][checkQueueReport]',_0x4c42a9,util[_0x1b6b('0x3c')](_0x2bb4a4,{'showHidden':![],'depth':null}));}if(_0x4f89a9['variables'][_0x4c42a9]){delete _0x4f89a9['variables'][_0x4c42a9];logger[_0x1b6b('0x3a')](_0x1b6b('0x3d'),_0x4c42a9,util[_0x1b6b('0x3c')](_0x2bb4a4,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x1b6b('0x23')]=function(){logger[_0x1b6b('0x3a')](_0x1b6b('0x3e'));clearChannels(this[_0x1b6b('0xe')]);this[_0x1b6b('0x3f')](this[_0x1b6b('0xc')]);clearAgentBooked(this[_0x1b6b('0xd')]);clearVoiceQueues(this[_0x1b6b('0x10')]);clearCampaigns(this[_0x1b6b('0x12')]);};VoiceQueueReport[_0x1b6b('0x9')][_0x1b6b('0x3f')]=function(_0x279022){var _0x3fbbb3=this;if(!_[_0x1b6b('0x2a')](_0x279022)){for(var _0x4d4795 in _0x279022){if(_0x279022[_0x1b6b('0x2b')](_0x4d4795)){_0x3fbbb3[_0x1b6b('0x40')](_0x279022[_0x4d4795],'clearqueuereport');delete _0x279022[_0x4d4795];}}}};VoiceQueueReport[_0x1b6b('0x9')]['emit']=function(_0x1beed6,_0x19049f,_0x18f725){io['to'](_0x1beed6)['emit'](_0x19049f,_0x18f725);};VoiceQueueReport[_0x1b6b('0x9')][_0x1b6b('0x41')]=function(_0x401069,_0x5578d9){logger[_0x1b6b('0x42')](_0x1b6b('0x43')+_0x5578d9+_0x1b6b('0x44'),_0x401069['uniqueid'],util['inspect'](_0x401069,{'showHidden':![],'depth':null}));this['emit'](util[_0x1b6b('0x45')](_0x1b6b('0x46'),_0x401069[_0x1b6b('0x47')]),_0x1b6b('0x48'),_0x401069);io[_0x1b6b('0x49')](_0x1b6b('0x4a'),_0x401069);};VoiceQueueReport[_0x1b6b('0x9')]['emitVoiceQueueChannelRemove']=function(_0x229d9e,_0x165384){logger[_0x1b6b('0x42')](_0x1b6b('0x43')+_0x165384+_0x1b6b('0x4b'),_0x229d9e[_0x1b6b('0x4c')],util['inspect'](_0x229d9e,{'showHidden':![],'depth':null}));this[_0x1b6b('0x49')](util[_0x1b6b('0x45')](_0x1b6b('0x46'),_0x229d9e[_0x1b6b('0x47')]),_0x1b6b('0x4d'),_0x229d9e);io[_0x1b6b('0x49')](_0x1b6b('0x4e'),_0x229d9e);};VoiceQueueReport[_0x1b6b('0x9')][_0x1b6b('0x4f')]=function(_0x12df7a,_0x714c01){if(_0x12df7a[_0x1b6b('0x50')]==='inbound'){var _0x30c320={'id':_0x12df7a['id'],'name':_0x12df7a[_0x1b6b('0x47')],'strategy':_0x12df7a[_0x1b6b('0x51')],'answered':_0x12df7a[_0x1b6b('0x52')],'available':_0x12df7a[_0x1b6b('0x53')],'loggedIn':_0x12df7a[_0x1b6b('0x54')],'pTalking':_0x12df7a['pTalking'],'sumBillable':_0x12df7a['sumBillable'],'sumDuration':_0x12df7a[_0x1b6b('0x55')],'sumHoldTime':_0x12df7a['sumHoldTime']||0x0,'talking':_0x12df7a[_0x1b6b('0x2d')],'total':_0x12df7a['total'],'type':_0x12df7a[_0x1b6b('0x50')],'unmanaged':_0x12df7a[_0x1b6b('0x56')],'abandoned':_0x12df7a[_0x1b6b('0x57')],'waiting':_0x12df7a[_0x1b6b('0x2f')]};if(_0x12df7a['Trunk']){_0x30c320[_0x1b6b('0x58')]={'id':_0x12df7a['Trunk']['id'],'name':_0x12df7a['Trunk'][_0x1b6b('0x47')],'active':_0x12df7a[_0x1b6b('0x58')][_0x1b6b('0x59')],'callerid':_0x12df7a[_0x1b6b('0x58')]['callerid']};}if(_0x12df7a[_0x1b6b('0x5a')]){_0x30c320['Interval']={'id':_0x12df7a[_0x1b6b('0x5a')]['id'],'name':_0x12df7a[_0x1b6b('0x5a')][_0x1b6b('0x47')]};}var _0x4b0b47=md5(JSON[_0x1b6b('0x5b')](_0x30c320));if(_0x12df7a['md5']!==_0x4b0b47){_0x12df7a[_0x1b6b('0x5c')]=_0x4b0b47;logger['debug'](_0x1b6b('0x5d')+_0x714c01+_0x1b6b('0x5e'),util[_0x1b6b('0x3c')](_0x30c320,{'showHidden':![],'depth':null}));this[_0x1b6b('0x49')](util[_0x1b6b('0x45')](_0x1b6b('0x46'),_0x30c320['name']),'voice_queue:save',_0x30c320);}}};VoiceQueueReport[_0x1b6b('0x9')][_0x1b6b('0x5f')]=function(_0x56039a){return _0x56039a!==null&&!_[_0x1b6b('0x60')](_0x56039a);};VoiceQueueReport[_0x1b6b('0x9')][_0x1b6b('0x61')]=function(){var _0x6cab33=this;setInterval(function(){_0x6cab33[_0x1b6b('0x30')]();ami['Action']({'action':_0x1b6b('0x62')})['catch'](function(_0x2cb484){logger[_0x1b6b('0x3a')](_0x1b6b('0x63'),util[_0x1b6b('0x3c')](_0x2cb484,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x1b6b('0x9')][_0x1b6b('0x64')]=function(){var _0x32cde4=this;setInterval(function(){if(_0x32cde4[_0x1b6b('0x11')]){return ami[_0x1b6b('0x34')]({'action':'queuesummary'})['then'](function(_0x58c7e7){_0x32cde4[_0x1b6b('0x11')]=![];})['catch'](function(_0x546339){logger[_0x1b6b('0x3a')](_0x1b6b('0x65'),util[_0x1b6b('0x3c')](_0x546339,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x1b6b('0x9')]['syncQueueSummary']=function(_0x1f549c){try{if(this[_0x1b6b('0x5f')](_0x1f549c)&&this[_0x1b6b('0x5f')](_0x1f549c['queue'])){logger['debug'](_0x1b6b('0x66'),util[_0x1b6b('0x3c')](_0x1f549c,{'showHidden':![],'depth':null}));if(this[_0x1b6b('0x10')][_0x1f549c['queue']]){logger['info']('[voiceQueueReport][queuesummary]\x20name:%s',_0x1f549c['queue']);var _0x3f5e23=_[_0x1b6b('0x67')](this[_0x1b6b('0xe')],_0x1b6b('0x68'))[_0x1f549c[_0x1b6b('0x68')]]||0x0;var _0xa01e5=_0x3f5e23-_0x1f549c['callers'];if(this[_0x1b6b('0x10')][_0x1f549c[_0x1b6b('0x68')]][_0x1b6b('0x2f')]!==_[_0x1b6b('0x69')](_0x1f549c[_0x1b6b('0x6a')])||this[_0x1b6b('0x10')][_0x1f549c['queue']][_0x1b6b('0x54')]!==_['toNumber'](_0x1f549c['loggedin'])||this['voiceQueues'][_0x1f549c[_0x1b6b('0x68')]]['available']!==_['toNumber'](_0x1f549c[_0x1b6b('0x53')])||this[_0x1b6b('0x10')][_0x1f549c[_0x1b6b('0x68')]][_0x1b6b('0x2d')]!==_0xa01e5){this[_0x1b6b('0x10')][_0x1f549c[_0x1b6b('0x68')]][_0x1b6b('0x2f')]=_['toNumber'](_0x1f549c[_0x1b6b('0x6a')]);this['voiceQueues'][_0x1f549c[_0x1b6b('0x68')]][_0x1b6b('0x54')]=_[_0x1b6b('0x69')](_0x1f549c['loggedin']);this['voiceQueues'][_0x1f549c[_0x1b6b('0x68')]][_0x1b6b('0x53')]=_[_0x1b6b('0x69')](_0x1f549c[_0x1b6b('0x53')]);this[_0x1b6b('0x10')][_0x1f549c[_0x1b6b('0x68')]][_0x1b6b('0x2d')]=_0xa01e5>0x0?_0xa01e5:0x0;this[_0x1b6b('0x10')][_0x1f549c['queue']]['talking']=this[_0x1b6b('0x10')][_0x1f549c[_0x1b6b('0x68')]][_0x1b6b('0x2d')]>_[_0x1b6b('0x69')](_0x1f549c['loggedin'])?_[_0x1b6b('0x69')](_0x1f549c['loggedin']):this[_0x1b6b('0x10')][_0x1f549c[_0x1b6b('0x68')]]['talking'];this[_0x1b6b('0x4f')](this[_0x1b6b('0x10')][_0x1f549c[_0x1b6b('0x68')]],_0x1b6b('0x13'));}logger[_0x1b6b('0x42')](_0x1b6b('0x6b'),util['inspect'](this[_0x1b6b('0x10')][_0x1f549c[_0x1b6b('0x68')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1b6b('0x6c'),this[_0x1b6b('0x10')][_0x1f549c[_0x1b6b('0x68')]]);}}}catch(_0x1b94b1){logger[_0x1b6b('0x3a')](_0x1b6b('0x65'),util[_0x1b6b('0x3c')](_0x1b94b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b6b('0x9')]['syncQueueSummaryComplete']=function(_0x5a0b10){logger['debug'](_0x1b6b('0x6d'),util[_0x1b6b('0x3c')](_0x5a0b10,{'showHidden':![],'depth':null}));this[_0x1b6b('0x11')]=!![];};VoiceQueueReport[_0x1b6b('0x9')][_0x1b6b('0x18')]=function(_0x11838d){try{if(this['isNotNull'](_0x11838d)){logger['debug'](_0x1b6b('0x6e'),_0x11838d['uniqueid'],util[_0x1b6b('0x3c')](_0x11838d,{'showHidden':![],'depth':null}));if(_[_0x1b6b('0x60')](this[_0x1b6b('0xc')][_0x11838d['uniqueid']])){this[_0x1b6b('0xc')][_0x11838d['uniqueid']]=[];this[_0x1b6b('0xe')][_0x11838d[_0x1b6b('0x4c')]]={};}var _0x53e887=new QueueReport();_0x53e887[_0x1b6b('0x47')]=_0x11838d['queue'];_0x53e887[_0x1b6b('0x50')]=this[_0x1b6b('0x10')][_0x53e887['name']]&&this[_0x1b6b('0x10')][_0x53e887[_0x1b6b('0x47')]][_0x1b6b('0x50')]?this[_0x1b6b('0x10')][_0x53e887[_0x1b6b('0x47')]][_0x1b6b('0x50')]||_0x1b6b('0x6f'):'inbound';_0x53e887[_0x1b6b('0x68')]=_0x11838d['queue'];_0x53e887[_0x1b6b('0x70')]=moment()['format'](_0x1b6b('0x71'));_0x53e887[_0x1b6b('0x72')]=_0x11838d['position'];_0x53e887[_0x1b6b('0x73')]=_0x11838d[_0x1b6b('0x73')];_0x53e887[_0x1b6b('0x4c')]=_0x11838d['uniqueid'];logger['info'](_0x1b6b('0x74'),_0x53e887[_0x1b6b('0x47')],_0x53e887[_0x1b6b('0x50')]);_['merge'](_0x53e887,_[_0x1b6b('0x75')](_0x11838d,_[_0x1b6b('0x76')](_0x53e887)));this[_0x1b6b('0xc')][_0x11838d[_0x1b6b('0x4c')]][_0x1b6b('0x77')](_0x53e887);this[_0x1b6b('0xe')][_0x11838d[_0x1b6b('0x4c')]]=_0x53e887;this[_0x1b6b('0x41')](_0x53e887,_0x1b6b('0x17'));}}catch(_0x979a3e){logger[_0x1b6b('0x3a')](_0x1b6b('0x6e'),_0x11838d[_0x1b6b('0x4c')],util[_0x1b6b('0x3c')](_0x979a3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b6b('0x9')]['syncQueueCallerAbandon']=function(_0x4e73b9){try{if(this[_0x1b6b('0x5f')](_0x4e73b9)){logger['debug'](_0x1b6b('0x78'),_0x4e73b9[_0x1b6b('0x4c')],util[_0x1b6b('0x3c')](_0x4e73b9,{'showHidden':![],'depth':null}));if(this[_0x1b6b('0xc')][_0x4e73b9[_0x1b6b('0x4c')]]){var _0x55df27=_[_0x1b6b('0x79')](this[_0x1b6b('0xc')][_0x4e73b9[_0x1b6b('0x4c')]]);_0x55df27[_0x1b6b('0x7a')]=![];_0x55df27['queuecallercompleteAt']=null;_0x55df27[_0x1b6b('0x7b')]=_0x4e73b9[_0x1b6b('0x7b')];_0x55df27[_0x1b6b('0x7c')]=_0x4e73b9[_0x1b6b('0x7c')];_0x55df27[_0x1b6b('0x19')]=!![];_0x55df27[_0x1b6b('0x7d')]=moment()[_0x1b6b('0x45')](_0x1b6b('0x71'));_0x55df27[_0x1b6b('0x7e')]='ABANDONED';_0x55df27[_0x1b6b('0x7f')]=null;logger[_0x1b6b('0x80')](_0x1b6b('0x81'),_0x55df27[_0x1b6b('0x47')],_0x55df27[_0x1b6b('0x50')]);this[_0x1b6b('0xe')][_0x4e73b9[_0x1b6b('0x4c')]]=_0x55df27;this[_0x1b6b('0x40')](_0x55df27,_0x1b6b('0x19'));}}}catch(_0x1646df){logger['error'](_0x1b6b('0x78'),_0x4e73b9[_0x1b6b('0x4c')],util[_0x1b6b('0x3c')](_0x1646df,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x3c8d43){try{if(this[_0x1b6b('0x5f')](_0x3c8d43)){logger['debug'](_0x1b6b('0x82'),_0x3c8d43[_0x1b6b('0x4c')],util[_0x1b6b('0x3c')](_0x3c8d43,{'showHidden':![],'depth':null}));if(this[_0x1b6b('0xc')][_0x3c8d43[_0x1b6b('0x4c')]]){var _0x3f2c8c=_[_0x1b6b('0x79')](this[_0x1b6b('0xc')][_0x3c8d43['uniqueid']]);_0x3f2c8c[_0x1b6b('0x83')]=moment()[_0x1b6b('0x45')](_0x1b6b('0x71'));_0x3f2c8c['connectedlinenum']=_0x3c8d43[_0x1b6b('0x84')];_0x3f2c8c[_0x1b6b('0x85')]=_0x3c8d43['connectedlinename'];logger[_0x1b6b('0x80')](_0x1b6b('0x86'),_0x3f2c8c[_0x1b6b('0x47')],_0x3f2c8c['type'],_0x3c8d43[_0x1b6b('0x84')],_0x3c8d43[_0x1b6b('0x85')]);this[_0x1b6b('0xe')][_0x3c8d43['uniqueid']]=_0x3f2c8c;this[_0x1b6b('0x41')](_0x3f2c8c,'queuecallerleave');}}}catch(_0x4ebfff){logger[_0x1b6b('0x3a')](_0x1b6b('0x82'),_0x3c8d43['uniqueid'],util['inspect'](_0x4ebfff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b6b('0x9')][_0x1b6b('0x87')]=function(_0x4f776e){try{if(this['isNotNull'](_0x4f776e)){logger[_0x1b6b('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x4f776e[_0x1b6b('0x4c')],util[_0x1b6b('0x3c')](_0x4f776e,{'showHidden':![],'depth':null}));if(this[_0x1b6b('0xc')][_0x4f776e[_0x1b6b('0x4c')]]){var _0x4726c6=_[_0x1b6b('0x79')](this[_0x1b6b('0xc')][_0x4f776e[_0x1b6b('0x4c')]]);_0x4726c6['queuecallercomplete']=!![];_0x4726c6[_0x1b6b('0x7e')]=_0x1b6b('0x88');logger[_0x1b6b('0x80')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4726c6[_0x1b6b('0x47')],_0x4726c6[_0x1b6b('0x50')]);}}}catch(_0x5c2d9a){logger[_0x1b6b('0x3a')](_0x1b6b('0x89'),_0x4f776e[_0x1b6b('0x4c')],util[_0x1b6b('0x3c')](_0x5c2d9a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b6b('0x9')]['syncAgentComplete']=function(_0x49ba01){try{if(this[_0x1b6b('0x5f')](_0x49ba01)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x49ba01[_0x1b6b('0x4c')],util[_0x1b6b('0x3c')](_0x49ba01,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x49ba01['uniqueid']]){var _0x399bc2=_['last'](this[_0x1b6b('0xc')][_0x49ba01['uniqueid']]);_0x399bc2['queuecallerabandon']=![];_0x399bc2[_0x1b6b('0x7d')]=null;_0x399bc2['assigned']=!![];_0x399bc2[_0x1b6b('0x7f')]=_0x49ba01['membername'];_0x399bc2[_0x1b6b('0x7b')]=_0x49ba01['holdtime'];_0x399bc2['queuecallercomplete']=!![];_0x399bc2['queuecallerexit']=![];_0x399bc2[_0x1b6b('0x8a')]=null;if(!_0x399bc2['transfer']){if(_0x49ba01[_0x1b6b('0x8b')]=='transfer'){_0x399bc2[_0x1b6b('0x7e')]=_0x1b6b('0x8c');logger[_0x1b6b('0x80')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x399bc2[_0x1b6b('0x47')],_0x399bc2[_0x1b6b('0x50')]);}else{if(_['startsWith'](_0x49ba01['channel'][_0x1b6b('0x8d')](),_0x1b6b('0x8e'))){if(this[_0x1b6b('0xc')][_0x49ba01[_0x1b6b('0x8f')]]){var _0x205d5c=_[_0x1b6b('0x79')](this['queueReports'][_0x49ba01[_0x1b6b('0x8f')]]);_0x205d5c['queuecallercomplete']=![];_0x205d5c[_0x1b6b('0x90')]=!![];_0x205d5c[_0x1b6b('0x8a')]=moment(_0x399bc2[_0x1b6b('0x70')])['add'](_0x49ba01['holdtime'],'seconds')[_0x1b6b('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x205d5c[_0x1b6b('0x7e')]=_0x1b6b('0x91');_0x205d5c[_0x1b6b('0x92')]=!![];_0x205d5c[_0x1b6b('0x93')]='FORWARD';_0x205d5c[_0x1b6b('0x94')]=_0x49ba01[_0x1b6b('0x95')];_0x205d5c['transferuniqueid']=_0x49ba01[_0x1b6b('0x4c')];logger[_0x1b6b('0x80')](_0x1b6b('0x96'),_0x205d5c[_0x1b6b('0x47')],_0x205d5c[_0x1b6b('0x50')]);var _0x31695f=this[_0x1b6b('0xc')][_0x49ba01[_0x1b6b('0x8f')]];this[_0x1b6b('0xc')][_0x49ba01[_0x1b6b('0x8f')]]=this[_0x1b6b('0xc')][_0x49ba01[_0x1b6b('0x4c')]];this[_0x1b6b('0xc')][_0x49ba01['uniqueid']]=_0x31695f;}}else{_0x399bc2[_0x1b6b('0x7e')]=_0x1b6b('0x97')+_0x49ba01[_0x1b6b('0x8b')][_0x1b6b('0x98')]();logger[_0x1b6b('0x80')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x399bc2[_0x1b6b('0x47')],_0x399bc2['type'],_0x399bc2[_0x1b6b('0x7e')]);}}}this['channels'][_0x49ba01[_0x1b6b('0x4c')]]=_0x399bc2;this[_0x1b6b('0x40')](_0x399bc2,_0x1b6b('0x99'));}}}catch(_0x1be2a8){logger[_0x1b6b('0x3a')](_0x1b6b('0x9a'),_0x49ba01[_0x1b6b('0x4c')],util['inspect'](_0x1be2a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b6b('0x9')]['syncVarSet']=function(_0x153f9f){try{if(this[_0x1b6b('0x5f')](_0x153f9f)){logger[_0x1b6b('0x42')](_0x1b6b('0x9b'),_0x153f9f[_0x1b6b('0x4c')],util[_0x1b6b('0x3c')](_0x153f9f,{'showHidden':![],'depth':null}));this[_0x1b6b('0x9c')](_0x153f9f['uniqueid'],_[_0x1b6b('0x76')](_0x153f9f[_0x1b6b('0x9d')])[0x0],_0x153f9f[_0x1b6b('0x9e')]);if(this[_0x1b6b('0xc')][_0x153f9f[_0x1b6b('0x4c')]]){var _0x4679c5=_[_0x1b6b('0x79')](this[_0x1b6b('0xc')][_0x153f9f['uniqueid']]);if(_0x4679c5){if(this[_0x1b6b('0x5f')](_0x153f9f[_0x1b6b('0x9d')])&&this[_0x1b6b('0x5f')](_0x153f9f['variable']['queuestatus'])){switch(_0x153f9f[_0x1b6b('0x9e')]){case _0x1b6b('0x9f'):_0x4679c5[_0x1b6b('0x90')]=![];_0x4679c5['queuecallerexitAt']=null;break;case _0x1b6b('0xa0'):_0x4679c5[_0x1b6b('0xa1')]=_0x1b6b('0xa2');_0x4679c5['queuecallerexit']=!![];_0x4679c5[_0x1b6b('0x8a')]=moment()['format'](_0x1b6b('0x71'));_0x4679c5[_0x1b6b('0x83')]=moment()['format'](_0x1b6b('0x71'));logger[_0x1b6b('0x42')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x153f9f[_0x1b6b('0x4c')],util['inspect'](_0x4679c5,{'showHidden':![],'depth':null}));ami[_0x1b6b('0x49')](_0x1b6b('0xa3'),_0x4679c5);break;default:_0x4679c5[_0x1b6b('0x90')]=!![];_0x4679c5[_0x1b6b('0x8a')]=moment()[_0x1b6b('0x45')](_0x1b6b('0x71'));_0x4679c5[_0x1b6b('0x83')]=moment()[_0x1b6b('0x45')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4679c5[_0x1b6b('0x19')]=![];_0x4679c5[_0x1b6b('0x7d')]=null;_0x4679c5[_0x1b6b('0x7e')]=_0x153f9f[_0x1b6b('0x9e')];this[_0x1b6b('0xe')][_0x153f9f['uniqueid']]=_0x4679c5;this[_0x1b6b('0x40')](_0x4679c5,_0x1b6b('0x1e'));}else if(this['isNotNull'](_0x153f9f[_0x1b6b('0x9d')])&&this[_0x1b6b('0x5f')](_0x153f9f[_0x1b6b('0x9d')][_0x1b6b('0xa4')])){if(!_0x4679c5[_0x1b6b('0x19')]){_0x4679c5[_0x1b6b('0x90')]=!![];_0x4679c5['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4679c5[_0x1b6b('0x7e')]=_0x1b6b('0xa5');_0x4679c5[_0x1b6b('0x83')]=moment()[_0x1b6b('0x45')](_0x1b6b('0x71'));this[_0x1b6b('0xe')][_0x153f9f['uniqueid']]=_0x4679c5;}}logger[_0x1b6b('0x80')](_0x1b6b('0xa6'),_0x153f9f[_0x1b6b('0x4c')],_0x4679c5[_0x1b6b('0x47')],_0x4679c5[_0x1b6b('0x50')],_['keys'](_0x153f9f[_0x1b6b('0x9d')])[0x0],_0x153f9f['value']);_0x4679c5[_0x1b6b('0xa7')]=this['variables'][_0x153f9f[_0x1b6b('0x4c')]];}}}}catch(_0x5c4310){logger[_0x1b6b('0x3a')](_0x1b6b('0x9b'),_0x153f9f[_0x1b6b('0x4c')],util[_0x1b6b('0x3c')](_0x5c4310,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b6b('0x9')]['addVariable']=function(_0x380955,_0x6bff8,_0x11c4de){var _0x28546d=[_0x1b6b('0xa8'),_0x1b6b('0xa9'),_0x1b6b('0xaa'),_0x1b6b('0xab'),_0x1b6b('0xac'),_0x1b6b('0xad'),_0x1b6b('0xae'),_0x1b6b('0xaf'),_0x1b6b('0xb0'),'sipuri','bridgepeer','bridgepvtcallid',_0x1b6b('0xb1'),'memberdynamic',_0x1b6b('0xb2'),'memberlastcall',_0x1b6b('0xb3'),_0x1b6b('0xb4'),_0x1b6b('0xb5')];if(!_[_0x1b6b('0x33')](_0x6bff8)&&!_[_0x1b6b('0xb6')](_0x28546d,_0x6bff8)){if(_[_0x1b6b('0x60')](this[_0x1b6b('0xa7')][_0x380955])){this[_0x1b6b('0xa7')][_0x380955]={};}this[_0x1b6b('0xa7')][_0x380955][_0x6bff8]=_0x11c4de;}};VoiceQueueReport['prototype'][_0x1b6b('0x21')]=function(_0x45561b){try{if(this['isNotNull'](_0x45561b)){logger[_0x1b6b('0x42')]('[%s][voiceQueueReport][hangup]',_0x45561b[_0x1b6b('0x4c')],util[_0x1b6b('0x3c')](_0x45561b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x45561b[_0x1b6b('0x4c')]]){for(var _0x48178d=0x0,_0x387a7a={};_0x48178d0x0?_0x93bbd6:0x0;this['voiceQueues'][_0x41f025[_0x53a2('0x68')]][_0x53a2('0x30')]=this[_0x53a2('0x14')][_0x41f025[_0x53a2('0x68')]]['talking']>_[_0x53a2('0x6d')](_0x41f025['loggedin'])?_[_0x53a2('0x6d')](_0x41f025[_0x53a2('0x6f')]):this[_0x53a2('0x14')][_0x41f025['queue']][_0x53a2('0x30')];this[_0x53a2('0x53')](this[_0x53a2('0x14')][_0x41f025[_0x53a2('0x68')]],_0x53a2('0x16'));}logger[_0x53a2('0x49')](_0x53a2('0x71'),util[_0x53a2('0x42')](this[_0x53a2('0x14')][_0x41f025[_0x53a2('0x68')]],{'showHidden':![],'depth':null}));ami[_0x53a2('0x48')](_0x53a2('0x72'),this[_0x53a2('0x14')][_0x41f025[_0x53a2('0x68')]]);}}}catch(_0x36d742){logger[_0x53a2('0x40')]('[voiceQueueReport][queuesummary]',util[_0x53a2('0x42')](_0x36d742,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x53a2('0x73')]=function(_0xdde9d3){logger[_0x53a2('0x49')](_0x53a2('0x74'),util[_0x53a2('0x42')](_0xdde9d3,{'showHidden':![],'depth':null}));this[_0x53a2('0x65')]=!![];};VoiceQueueReport[_0x53a2('0xe')][_0x53a2('0x1a')]=function(_0x29c7b2){try{if(this[_0x53a2('0x61')](_0x29c7b2)){logger['debug'](_0x53a2('0x75'),_0x29c7b2[_0x53a2('0x4f')],util[_0x53a2('0x42')](_0x29c7b2,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x53a2('0x12')][_0x29c7b2[_0x53a2('0x4f')]])){this['queueReports'][_0x29c7b2['uniqueid']]=[];this[_0x53a2('0x36')][_0x29c7b2[_0x53a2('0x4f')]]={};}var _0x1f2553=new QueueReport();_0x1f2553[_0x53a2('0x4d')]=_0x29c7b2[_0x53a2('0x68')];_0x1f2553['type']=this[_0x53a2('0x14')][_0x1f2553[_0x53a2('0x4d')]]&&this[_0x53a2('0x14')][_0x1f2553[_0x53a2('0x4d')]][_0x53a2('0x54')]?this[_0x53a2('0x14')][_0x1f2553[_0x53a2('0x4d')]][_0x53a2('0x54')]||_0x53a2('0x55'):'inbound';_0x1f2553[_0x53a2('0x68')]=_0x29c7b2[_0x53a2('0x68')];_0x1f2553[_0x53a2('0x76')]=moment()[_0x53a2('0x50')](_0x53a2('0x77'));_0x1f2553[_0x53a2('0x78')]=_0x29c7b2[_0x53a2('0x78')];_0x1f2553[_0x53a2('0x79')]=_0x29c7b2[_0x53a2('0x79')];_0x1f2553[_0x53a2('0x4f')]=_0x29c7b2[_0x53a2('0x4f')];logger[_0x53a2('0x6a')](_0x53a2('0x7a'),_0x1f2553[_0x53a2('0x4d')],_0x1f2553[_0x53a2('0x54')]);_[_0x53a2('0x7b')](_0x1f2553,_['pick'](_0x29c7b2,_['keys'](_0x1f2553)));this[_0x53a2('0x12')][_0x29c7b2['uniqueid']][_0x53a2('0x7c')](_0x1f2553);this[_0x53a2('0x36')][_0x29c7b2['uniqueid']]=_0x1f2553;this[_0x53a2('0x7d')](_0x1f2553,_0x53a2('0x19'));}}catch(_0x4757ef){logger[_0x53a2('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x29c7b2['uniqueid'],util['inspect'](_0x4757ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53a2('0xe')][_0x53a2('0x1b')]=function(_0x1212bf){try{if(this[_0x53a2('0x61')](_0x1212bf)){logger[_0x53a2('0x49')](_0x53a2('0x7e'),_0x1212bf[_0x53a2('0x4f')],util[_0x53a2('0x42')](_0x1212bf,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1212bf[_0x53a2('0x4f')]]){var _0xa8ab39=_[_0x53a2('0x7f')](this[_0x53a2('0x12')][_0x1212bf['uniqueid']]);_0xa8ab39[_0x53a2('0x80')]=![];_0xa8ab39[_0x53a2('0x81')]=null;_0xa8ab39[_0x53a2('0x82')]=_0x1212bf['holdtime'];_0xa8ab39[_0x53a2('0x83')]=_0x1212bf[_0x53a2('0x83')];_0xa8ab39[_0x53a2('0x84')]=!![];_0xa8ab39[_0x53a2('0x85')]=moment()['format'](_0x53a2('0x77'));_0xa8ab39[_0x53a2('0x86')]=_0x53a2('0x87');_0xa8ab39['lastAssignedTo']=null;logger[_0x53a2('0x6a')](_0x53a2('0x88'),_0xa8ab39[_0x53a2('0x4d')],_0xa8ab39[_0x53a2('0x54')]);this['channels'][_0x1212bf[_0x53a2('0x4f')]]=_0xa8ab39;this[_0x53a2('0x4e')](_0xa8ab39,'queuecallerabandon');}}}catch(_0x56b958){logger['error'](_0x53a2('0x7e'),_0x1212bf['uniqueid'],util['inspect'](_0x56b958,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x53a2('0x1d')]=function(_0x68a73c){try{if(this['isNotNull'](_0x68a73c)){logger[_0x53a2('0x49')](_0x53a2('0x89'),_0x68a73c[_0x53a2('0x4f')],util[_0x53a2('0x42')](_0x68a73c,{'showHidden':![],'depth':null}));if(this[_0x53a2('0x12')][_0x68a73c['uniqueid']]){var _0x1ebe6c=_['last'](this[_0x53a2('0x12')][_0x68a73c[_0x53a2('0x4f')]]);_0x1ebe6c[_0x53a2('0x8a')]=moment()[_0x53a2('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ebe6c[_0x53a2('0x8b')]=_0x68a73c[_0x53a2('0x8b')];_0x1ebe6c[_0x53a2('0x8c')]=_0x68a73c[_0x53a2('0x8c')];logger['info'](_0x53a2('0x8d'),_0x1ebe6c[_0x53a2('0x4d')],_0x1ebe6c['type'],_0x68a73c[_0x53a2('0x8b')],_0x68a73c[_0x53a2('0x8c')]);this[_0x53a2('0x36')][_0x68a73c[_0x53a2('0x4f')]]=_0x1ebe6c;this[_0x53a2('0x7d')](_0x1ebe6c,_0x53a2('0x1c'));}}}catch(_0x55bfc8){logger[_0x53a2('0x40')](_0x53a2('0x89'),_0x68a73c[_0x53a2('0x4f')],util['inspect'](_0x55bfc8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53a2('0xe')][_0x53a2('0x1f')]=function(_0x284bd7){try{if(this[_0x53a2('0x61')](_0x284bd7)){logger[_0x53a2('0x49')]('[%s][voiceQueueReport][agentconnect]',_0x284bd7['uniqueid'],util[_0x53a2('0x42')](_0x284bd7,{'showHidden':![],'depth':null}));if(this[_0x53a2('0x12')][_0x284bd7['uniqueid']]){var _0x173871=_[_0x53a2('0x7f')](this[_0x53a2('0x12')][_0x284bd7['uniqueid']]);_0x173871[_0x53a2('0x80')]=!![];_0x173871['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x53a2('0x6a')](_0x53a2('0x8e'),_0x173871[_0x53a2('0x4d')],_0x173871['type']);}}}catch(_0x5bb767){logger[_0x53a2('0x40')]('[%s][voiceQueueReport][agentconnect]',_0x284bd7['uniqueid'],util['inspect'](_0x5bb767,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53a2('0xe')][_0x53a2('0x8f')]=function(_0x28d9bd){try{if(this[_0x53a2('0x61')](_0x28d9bd)){logger[_0x53a2('0x49')](_0x53a2('0x90'),_0x28d9bd[_0x53a2('0x4f')],util['inspect'](_0x28d9bd,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x28d9bd[_0x53a2('0x4f')]]){var _0x58bc5d=_[_0x53a2('0x7f')](this['queueReports'][_0x28d9bd[_0x53a2('0x4f')]]);_0x58bc5d[_0x53a2('0x84')]=![];_0x58bc5d[_0x53a2('0x85')]=null;_0x58bc5d[_0x53a2('0x91')]=!![];_0x58bc5d[_0x53a2('0x92')]=_0x28d9bd[_0x53a2('0x93')];_0x58bc5d[_0x53a2('0x82')]=_0x28d9bd['holdtime'];_0x58bc5d['queuecallercomplete']=!![];_0x58bc5d[_0x53a2('0x94')]=![];_0x58bc5d['queuecallerexitAt']=null;if(!_0x58bc5d[_0x53a2('0x95')]){if(_0x28d9bd[_0x53a2('0x96')]==_0x53a2('0x95')){_0x58bc5d[_0x53a2('0x86')]=_0x53a2('0x97');logger[_0x53a2('0x6a')](_0x53a2('0x98'),_0x58bc5d[_0x53a2('0x4d')],_0x58bc5d[_0x53a2('0x54')]);}else{if(_[_0x53a2('0x99')](_0x28d9bd['channel'][_0x53a2('0x9a')](),_0x53a2('0x9b'))){if(this[_0x53a2('0x12')][_0x28d9bd['linkedid']]){var _0x12366c=_[_0x53a2('0x7f')](this['queueReports'][_0x28d9bd[_0x53a2('0x9c')]]);_0x12366c[_0x53a2('0x80')]=![];_0x12366c['queuecallerexit']=!![];_0x12366c[_0x53a2('0x9d')]=moment(_0x58bc5d[_0x53a2('0x76')])[_0x53a2('0x9e')](_0x28d9bd[_0x53a2('0x82')],'seconds')[_0x53a2('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x12366c['queuecallerexitreason']=_0x53a2('0x9f');_0x12366c['transfer']=!![];_0x12366c[_0x53a2('0xa0')]='FORWARD';_0x12366c[_0x53a2('0xa1')]=_0x28d9bd[_0x53a2('0xa2')];_0x12366c[_0x53a2('0xa3')]=_0x28d9bd['uniqueid'];logger[_0x53a2('0x6a')](_0x53a2('0xa4'),_0x12366c['name'],_0x12366c['type']);var _0x1d7b8b=this[_0x53a2('0x12')][_0x28d9bd[_0x53a2('0x9c')]];this['queueReports'][_0x28d9bd['linkedid']]=this[_0x53a2('0x12')][_0x28d9bd[_0x53a2('0x4f')]];this[_0x53a2('0x12')][_0x28d9bd[_0x53a2('0x4f')]]=_0x1d7b8b;}}else{_0x58bc5d[_0x53a2('0x86')]=_0x53a2('0xa5')+_0x28d9bd['reason'][_0x53a2('0xa6')]();logger[_0x53a2('0x6a')](_0x53a2('0xa7'),_0x58bc5d[_0x53a2('0x4d')],_0x58bc5d['type'],_0x58bc5d[_0x53a2('0x86')]);}}}this[_0x53a2('0x36')][_0x28d9bd[_0x53a2('0x4f')]]=_0x58bc5d;this[_0x53a2('0x4e')](_0x58bc5d,_0x53a2('0xa8'));}}}catch(_0x56e8c5){logger[_0x53a2('0x40')](_0x53a2('0x90'),_0x28d9bd[_0x53a2('0x4f')],util[_0x53a2('0x42')](_0x56e8c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53a2('0xe')][_0x53a2('0x21')]=function(_0x5c3d42){try{if(this['isNotNull'](_0x5c3d42)){logger['debug'](_0x53a2('0xa9'),_0x5c3d42['uniqueid'],util[_0x53a2('0x42')](_0x5c3d42,{'showHidden':![],'depth':null}));this[_0x53a2('0xaa')](_0x5c3d42['uniqueid'],_[_0x53a2('0xab')](_0x5c3d42['variable'])[0x0],_0x5c3d42[_0x53a2('0xac')]);if(this[_0x53a2('0x12')][_0x5c3d42['uniqueid']]){var _0x18f70b=_[_0x53a2('0x7f')](this['queueReports'][_0x5c3d42[_0x53a2('0x4f')]]);if(_0x18f70b){if(this[_0x53a2('0x61')](_0x5c3d42[_0x53a2('0xad')])&&this[_0x53a2('0x61')](_0x5c3d42[_0x53a2('0xad')][_0x53a2('0xae')])){switch(_0x5c3d42[_0x53a2('0xac')]){case _0x53a2('0xaf'):_0x18f70b[_0x53a2('0x94')]=![];_0x18f70b[_0x53a2('0x9d')]=null;break;case _0x53a2('0xb0'):_0x18f70b[_0x53a2('0xb1')]=_0x53a2('0xb2');_0x18f70b['queuecallerexit']=!![];_0x18f70b[_0x53a2('0x9d')]=moment()[_0x53a2('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x18f70b[_0x53a2('0x8a')]=moment()['format'](_0x53a2('0x77'));logger[_0x53a2('0x49')](_0x53a2('0xb3'),_0x5c3d42[_0x53a2('0x4f')],util['inspect'](_0x18f70b,{'showHidden':![],'depth':null}));ami[_0x53a2('0x48')](_0x53a2('0xb4'),_0x18f70b);break;default:_0x18f70b[_0x53a2('0x94')]=!![];_0x18f70b[_0x53a2('0x9d')]=moment()[_0x53a2('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x18f70b[_0x53a2('0x8a')]=moment()[_0x53a2('0x50')](_0x53a2('0x77'));}_0x18f70b[_0x53a2('0x84')]=![];_0x18f70b[_0x53a2('0x85')]=null;_0x18f70b[_0x53a2('0x86')]=_0x5c3d42['value'];this['channels'][_0x5c3d42['uniqueid']]=_0x18f70b;this['emitVoiceQueueChannelRemove'](_0x18f70b,_0x53a2('0x20'));}else if(this['isNotNull'](_0x5c3d42['variable'])&&this[_0x53a2('0x61')](_0x5c3d42[_0x53a2('0xad')][_0x53a2('0xb5')])){if(!_0x18f70b[_0x53a2('0x84')]){_0x18f70b[_0x53a2('0x94')]=!![];_0x18f70b[_0x53a2('0x9d')]=moment()['format'](_0x53a2('0x77'));_0x18f70b[_0x53a2('0x86')]=_0x53a2('0xb6');_0x18f70b[_0x53a2('0x8a')]=moment()[_0x53a2('0x50')](_0x53a2('0x77'));this['channels'][_0x5c3d42[_0x53a2('0x4f')]]=_0x18f70b;}}logger[_0x53a2('0x6a')](_0x53a2('0xb7'),_0x5c3d42['uniqueid'],_0x18f70b['name'],_0x18f70b[_0x53a2('0x54')],_[_0x53a2('0xab')](_0x5c3d42[_0x53a2('0xad')])[0x0],_0x5c3d42[_0x53a2('0xac')]);_0x18f70b['variables']=this['variables'][_0x5c3d42[_0x53a2('0x4f')]];}}}}catch(_0x351888){logger['error'](_0x53a2('0xa9'),_0x5c3d42['uniqueid'],util[_0x53a2('0x42')](_0x351888,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53a2('0xe')]['addVariable']=function(_0x35ceee,_0x49f0e5,_0x310aaf){var _0x19a65e=[_0x53a2('0xb8'),_0x53a2('0xb9'),'rtpaudioqosjitter',_0x53a2('0xba'),_0x53a2('0xbb'),'rtpaudioqoslossbridged',_0x53a2('0xbc'),'rtpaudioqosrttbridged',_0x53a2('0xbd'),'sipuri',_0x53a2('0xbe'),_0x53a2('0xbf'),_0x53a2('0xc0'),_0x53a2('0xc1'),_0x53a2('0xc2'),_0x53a2('0xc3'),_0x53a2('0x93'),_0x53a2('0xc4'),_0x53a2('0xc5')];if(!_[_0x53a2('0x39')](_0x49f0e5)&&!_['includes'](_0x19a65e,_0x49f0e5)){if(_['isUndefined'](this[_0x53a2('0x15')][_0x35ceee])){this[_0x53a2('0x15')][_0x35ceee]={};}this[_0x53a2('0x15')][_0x35ceee][_0x49f0e5]=_0x310aaf;}};VoiceQueueReport[_0x53a2('0xe')][_0x53a2('0x22')]=function(_0x5c428f){try{if(this[_0x53a2('0x61')](_0x5c428f)){logger[_0x53a2('0x49')](_0x53a2('0xc6'),_0x5c428f['uniqueid'],util['inspect'](_0x5c428f,{'showHidden':![],'depth':null}));if(this[_0x53a2('0x12')][_0x5c428f[_0x53a2('0x4f')]]){for(var _0x3682ea=0x0,_0x5b6782={};_0x3682ea=0x0?moment(_0x359cc2[_0xccc2('0x16')])[_0xccc2('0xd')](_0x359cc2[_0xccc2('0x17')],_0xccc2('0xe')):null,'data1':_0xccc2('0x18'),'data2':_0x359cc2[_0xccc2('0x10')],'data3':_0x359cc2[_0xccc2('0x19')],'data4':_0x359cc2['dialstring']||null,'role':_0xccc2('0xf'),'internal':_0x359cc2[_0xccc2('0x10')]?_[_0xccc2('0x11')](_0x359cc2[_0xccc2('0x10')]):undefined,'uniqueid':_0x359cc2[_0xccc2('0x12')]},'log':_0xccc2('0x13')});}; \ No newline at end of file +var _0x7b6a=['lodash','../client','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','isNil','SIP/%s','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','accountcode','toNumber','voiceDialReport','membername','endtime','starttime','outbound','exten','dialstring','agent','uniqueid','moment'];(function(_0x5ef344,_0x22fc84){var _0x515eb9=function(_0x14be36){while(--_0x14be36){_0x5ef344['push'](_0x5ef344['shift']());}};_0x515eb9(++_0x22fc84);}(_0x7b6a,0xa1));var _0xa7b6=function(_0x5818cf,_0xa96048){_0x5818cf=_0x5818cf-0x0;var _0x4d79b2=_0x7b6a[_0x5818cf];return _0x4d79b2;};'use strict';var moment=require(_0xa7b6('0x0'));var _=require(_0xa7b6('0x1'));var util=require('util');var client=require(_0xa7b6('0x2'));exports['voiceQueueReport']=function(_0x3f483e){var _0x3a1f3c=_0x3f483e[_0xa7b6('0x3')]||_0x3f483e[_0xa7b6('0x4')];return client['Request'](_0xa7b6('0x5'),{'body':{'channel':_0xa7b6('0x6'),'membername':_0x3f483e['lastAssignedTo'],'interface':_[_0xa7b6('0x7')](_0x3f483e['interface'])?util['format'](_0xa7b6('0x8'),_0x3f483e['lastAssignedTo']):_0x3f483e[_0xa7b6('0x9')],'type':_0xa7b6('0xa'),'enterAt':_0x3f483e[_0xa7b6('0xb')],'exitAt':_0x3a1f3c,'duration':moment(_0x3a1f3c)[_0xa7b6('0xc')](_0x3f483e['queuecallerleaveAt'],_0xa7b6('0xd')),'data1':_0xa7b6('0xe'),'data2':_0x3f483e[_0xa7b6('0xf')],'data3':_0x3f483e['exten'],'data4':null,'data5':_0x3f483e['queue'],'role':'agent','internal':_0x3f483e[_0xa7b6('0x10')]?_[_0xa7b6('0x11')](_0x3f483e['accountcode']):undefined,'uniqueid':_0x3f483e['uniqueid']},'log':_0xa7b6('0x5')});};exports[_0xa7b6('0x12')]=function(_0x5d4e24){return client['Request'](_0xa7b6('0x5'),{'body':{'channel':'voice','membername':_0x5d4e24[_0xa7b6('0x13')],'interface':_0x5d4e24['interface'],'type':_0xa7b6('0xa'),'enterAt':_0x5d4e24['starttime'],'exitAt':_0x5d4e24[_0xa7b6('0x14')],'duration':moment(_0x5d4e24['endtime'])['diff'](_0x5d4e24[_0xa7b6('0x15')],_0xa7b6('0xd'))>=0x0?moment(_0x5d4e24[_0xa7b6('0x14')])['diff'](_0x5d4e24[_0xa7b6('0x15')],_0xa7b6('0xd')):null,'data1':_0xa7b6('0x16'),'data2':_0x5d4e24[_0xa7b6('0x10')],'data3':_0x5d4e24[_0xa7b6('0x17')],'data4':_0x5d4e24[_0xa7b6('0x18')]||null,'role':_0xa7b6('0x19'),'internal':_0x5d4e24[_0xa7b6('0x10')]?_[_0xa7b6('0x11')](_0x5d4e24['accountcode']):undefined,'uniqueid':_0x5d4e24[_0xa7b6('0x1a')]},'log':_0xa7b6('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index bb6a963..979b25c 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 _0x41bb=['GetSettings','../client','getSettings','ShowSetting'];(function(_0x1012ee,_0x11c381){var _0x38ce73=function(_0x3f8ddc){while(--_0x3f8ddc){_0x1012ee['push'](_0x1012ee['shift']());}};_0x38ce73(++_0x11c381);}(_0x41bb,0xc5));var _0xb41b=function(_0x1993d4,_0x19d988){_0x1993d4=_0x1993d4-0x0;var _0x12b9ab=_0x41bb[_0x1993d4];return _0x12b9ab;};'use strict';var client=require(_0xb41b('0x0'));exports[_0xb41b('0x1')]=function(){return client['Request'](_0xb41b('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0xb41b('0x3')});}; \ No newline at end of file +var _0x4ded=['stopRecordingOnTransfer','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x3ecc60,_0x2ce741){var _0x3cdb24=function(_0x121981){while(--_0x121981){_0x3ecc60['push'](_0x3ecc60['shift']());}};_0x3cdb24(++_0x2ce741);}(_0x4ded,0x116));var _0xd4de=function(_0x47af61,_0xeb1a04){_0x47af61=_0x47af61-0x0;var _0x2d0f1e=_0x4ded[_0x47af61];return _0x2d0f1e;};'use strict';var client=require(_0xd4de('0x0'));exports[_0xd4de('0x1')]=function(){return client[_0xd4de('0x2')](_0xd4de('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd4de('0x4')]},'log':_0xd4de('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 6fc5f27..dcc9cc9 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 _0xf403=['name','html','../client','Request','GetTemplate'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf403,0x1d3));var _0x3f40=function(_0x430d70,_0x58f6ee){_0x430d70=_0x430d70-0x0;var _0x46e3bc=_0xf403[_0x430d70];return _0x46e3bc;};'use strict';var client=require(_0x3f40('0x0'));exports['getTemplates']=function(_0x456979){return function(_0x197a40){return client[_0x3f40('0x1')](_0x3f40('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3f40('0x3'),_0x3f40('0x4')]},'log':_0x3f40('0x2')});};}; \ No newline at end of file +var _0x6f2f=['GetTemplate','../client','getTemplates'];(function(_0x23a766,_0x2eab2c){var _0x439cd4=function(_0x4b2913){while(--_0x4b2913){_0x23a766['push'](_0x23a766['shift']());}};_0x439cd4(++_0x2eab2c);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x6f2f[_0x2261ce];return _0x524640;};'use strict';var client=require(_0xf6f2('0x0'));exports[_0xf6f2('0x1')]=function(_0x4ef916){return function(_0x4e24e1){return client['Request'](_0xf6f2('0x2'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0xf6f2('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index aec91c7..63db625 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 _0x57d3=['channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name'];(function(_0x128602,_0x320fd7){var _0x361635=function(_0x44d213){while(--_0x44d213){_0x128602['push'](_0x128602['shift']());}};_0x361635(++_0x320fd7);}(_0x57d3,0x1de));var _0x357d=function(_0x510a4e,_0x26bb48){_0x510a4e=_0x510a4e-0x0;var _0x23d1b0=_0x57d3[_0x510a4e];return _0x23d1b0;};'use strict';var client=require(_0x357d('0x0'));exports[_0x357d('0x1')]=function(_0x3dcf53){return function(_0x4c8616){return client[_0x357d('0x2')](_0x357d('0x3'),{'options':{'raw':![],'attributes':['id',_0x357d('0x4'),_0x357d('0x5'),_0x357d('0x6')],'include':[{'model':_0x357d('0x7'),'as':_0x357d('0x8'),'attributes':['id','field',_0x357d('0x9'),_0x357d('0xa')]},{'model':_0x357d('0x7'),'as':_0x357d('0xb'),'attributes':['id',_0x357d('0xc'),_0x357d('0x9'),_0x357d('0xa')]},{'model':_0x357d('0xd'),'as':_0x357d('0xe'),'attributes':['id',_0x357d('0xf'),_0x357d('0x10'),_0x357d('0x11'),_0x357d('0x12'),_0x357d('0x13'),_0x357d('0x14'),_0x357d('0x15'),_0x357d('0x16')]}]},'log':_0x357d('0x3')});};}; \ No newline at end of file +var _0xb606=['getTriggers','Request','GetTrigger','status','Condition','field','operator','value','Action','Actions','action','data1','data2','data4','data6','data7','../client'];(function(_0x38a155,_0x2aa026){var _0x269403=function(_0x47263b){while(--_0x47263b){_0x38a155['push'](_0x38a155['shift']());}};_0x269403(++_0x2aa026);}(_0xb606,0x98));var _0x6b60=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0xb606[_0x5180c3];return _0x55c975;};'use strict';var client=require(_0x6b60('0x0'));exports[_0x6b60('0x1')]=function(_0x42b15b){return function(_0x3b74d){return client[_0x6b60('0x2')](_0x6b60('0x3'),{'options':{'raw':![],'attributes':['id','name','channel',_0x6b60('0x4')],'include':[{'model':_0x6b60('0x5'),'as':'AllConditions','attributes':['id',_0x6b60('0x6'),_0x6b60('0x7'),_0x6b60('0x8')]},{'model':_0x6b60('0x5'),'as':'AnyConditions','attributes':['id','field',_0x6b60('0x7'),_0x6b60('0x8')]},{'model':_0x6b60('0x9'),'as':_0x6b60('0xa'),'attributes':['id',_0x6b60('0xb'),_0x6b60('0xc'),_0x6b60('0xd'),'data3',_0x6b60('0xe'),'data5',_0x6b60('0xf'),_0x6b60('0x10')]}]},'log':_0x6b60('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 3411af1..c3e591f 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 _0x868a=['GetTrunk','../client','getTrunks','Request','name','registry'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0x868a,0xbb));var _0xa868=function(_0x3a5e34,_0x4e3a17){_0x3a5e34=_0x3a5e34-0x0;var _0x129d11=_0x868a[_0x3a5e34];return _0x129d11;};'use strict';var client=require(_0xa868('0x0'));exports[_0xa868('0x1')]=function(_0x119c58){return function(_0xb4015c){return client[_0xa868('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa868('0x3'),_0xa868('0x4'),'defaultuser']},'log':_0xa868('0x5')});};}; \ No newline at end of file +var _0xd0fd=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x18ea99,_0x5d0dc6){var _0x4e1a63=function(_0x560366){while(--_0x560366){_0x18ea99['push'](_0x18ea99['shift']());}};_0x4e1a63(++_0x5d0dc6);}(_0xd0fd,0x1b2));var _0xdd0f=function(_0xaa322,_0x3c77cf){_0xaa322=_0xaa322-0x0;var _0x5d4944=_0xd0fd[_0xaa322];return _0x5d4944;};'use strict';var client=require(_0xdd0f('0x0'));exports[_0xdd0f('0x1')]=function(_0x25af9a){return function(_0x4ab0bc){return client[_0xdd0f('0x2')](_0xdd0f('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xdd0f('0x4'),_0xdd0f('0x5'),_0xdd0f('0x6')]},'log':_0xdd0f('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4c43514..58462f4 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 _0x65ab=['PauseUser','UnpauseUser','savePause','getAgent','agent','../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','phone','mobile','interface','getTelephones'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x65ab,0x7d));var _0xb65a=function(_0x448b0f,_0x35ae70){_0x448b0f=_0x448b0f-0x0;var _0x25fd55=_0x65ab[_0x448b0f];return _0x25fd55;};'use strict';var client=require(_0xb65a('0x0'));exports[_0xb65a('0x1')]=function(){return function(){return client[_0xb65a('0x2')](_0xb65a('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0xb65a('0x4'),_0xb65a('0x5'),_0xb65a('0x6'),_0xb65a('0x7'),_0xb65a('0x8'),_0xb65a('0x9'),_0xb65a('0xa'),'lastPauseAt','voicePause',_0xb65a('0xb'),_0xb65a('0xc'),_0xb65a('0xd')]},'log':_0xb65a('0x1')});};};exports[_0xb65a('0xe')]=function(){return function(){return client[_0xb65a('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xb65a('0x4'),_0xb65a('0x6'),'internal']},'log':_0xb65a('0xe')});};};exports['savePause']=function(_0x6e3b,_0x532f97,_0x2badd6){return client[_0xb65a('0x2')](_0xb65a('0xf'),{'body':{'type':_0x532f97,'uniqueid':_0x2badd6},'options':{'where':{'id':_0x6e3b['id']}},'log':'savePause'});};exports['saveUnpause']=function(_0x599cc0){return client[_0xb65a('0x2')](_0xb65a('0x10'),{'body':{},'options':{'where':{'id':_0x599cc0['id']}},'log':_0xb65a('0x11')});};exports[_0xb65a('0x12')]=function(_0x1176ae){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0xb65a('0x13'),'id':_0x1176ae},'attributes':['id',_0xb65a('0x4'),_0xb65a('0x5'),_0xb65a('0x6'),_0xb65a('0x7'),'online',_0xb65a('0x9'),'pauseType','lastPauseAt','voicePause',_0xb65a('0xd')]},'log':_0xb65a('0x12')});}; \ No newline at end of file +var _0x1a88=['name','email','fullname','pauseType','lastPauseAt','phone','mobile','interface','getTelephones','Request','telephone','accountcode','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','online','lastLoginAt','../client','getAgents','GetUser','agent'];(function(_0x27c250,_0x217d29){var _0xadc7df=function(_0x8726a3){while(--_0x8726a3){_0x27c250['push'](_0x27c250['shift']());}};_0xadc7df(++_0x217d29);}(_0x1a88,0x74));var _0x81a8=function(_0x4d749f,_0x499ca0){_0x4d749f=_0x4d749f-0x0;var _0x20130c=_0x1a88[_0x4d749f];return _0x20130c;};'use strict';var client=require(_0x81a8('0x0'));exports[_0x81a8('0x1')]=function(){return function(){return client['Request'](_0x81a8('0x2'),{'options':{'raw':![],'where':{'role':_0x81a8('0x3')},'attributes':['id',_0x81a8('0x4'),_0x81a8('0x5'),'accountcode',_0x81a8('0x6'),'online','lastLoginAt',_0x81a8('0x7'),_0x81a8('0x8'),'voicePause',_0x81a8('0x9'),_0x81a8('0xa'),_0x81a8('0xb')]},'log':_0x81a8('0x1')});};};exports[_0x81a8('0xc')]=function(){return function(){return client[_0x81a8('0xd')](_0x81a8('0x2'),{'options':{'raw':!![],'where':{'role':_0x81a8('0xe')},'attributes':['id',_0x81a8('0x4'),_0x81a8('0xf'),'internal']},'log':'getTelephones'});};};exports[_0x81a8('0x10')]=function(_0x26cc60,_0x4fe99d,_0x814d48){return client[_0x81a8('0xd')](_0x81a8('0x11'),{'body':{'type':_0x4fe99d,'uniqueid':_0x814d48},'options':{'where':{'id':_0x26cc60['id']}},'log':_0x81a8('0x10')});};exports[_0x81a8('0x12')]=function(_0xc9991e){return client[_0x81a8('0xd')](_0x81a8('0x13'),{'body':{},'options':{'where':{'id':_0xc9991e['id']}},'log':_0x81a8('0x10')});};exports[_0x81a8('0x14')]=function(_0xcff919){return client[_0x81a8('0xd')](_0x81a8('0x15'),{'options':{'raw':![],'where':{'role':_0x81a8('0x3'),'id':_0xcff919},'attributes':['id',_0x81a8('0x4'),_0x81a8('0x5'),_0x81a8('0xf'),'fullname',_0x81a8('0x16'),_0x81a8('0x17'),_0x81a8('0x7'),_0x81a8('0x8'),'voicePause',_0x81a8('0xb')]},'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 4f873d8..916f9f3 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 _0x40d4=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40d4,0x16c));var _0x440d=function(_0x37297f,_0x34f18d){_0x37297f=_0x37297f-0x0;var _0x27d995=_0x40d4[_0x37297f];return _0x27d995;};'use strict';var client=require(_0x440d('0x0'));exports[_0x440d('0x1')]=function(_0x313d14){return client[_0x440d('0x2')](_0x440d('0x3'),{'body':_0x313d14,'log':_0x440d('0x3')});};exports[_0x440d('0x4')]=function(_0x1f38d8,_0x415c1b,_0x16d155){return client['Request'](_0x440d('0x5'),{'body':_0x1f38d8,'options':{'where':{'uniqueid':_0x415c1b,'interface':_0x16d155,'agentcomplete':!![]}},'log':_0x440d('0x5')});}; \ No newline at end of file +var _0xc30d=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xc30d,0x6e));var _0xdc30=function(_0x4db1d7,_0xe0d557){_0x4db1d7=_0x4db1d7-0x0;var _0x53f2d7=_0xc30d[_0x4db1d7];return _0x53f2d7;};'use strict';var client=require(_0xdc30('0x0'));exports['create']=function(_0x26986e){return client[_0xdc30('0x1')](_0xdc30('0x2'),{'body':_0x26986e,'log':_0xdc30('0x2')});};exports[_0xdc30('0x3')]=function(_0x50c802,_0x1cc1bc,_0x53cb76){return client[_0xdc30('0x1')](_0xdc30('0x4'),{'body':_0x50c802,'options':{'where':{'uniqueid':_0x1cc1bc,'interface':_0x53cb76,'agentcomplete':!![]}},'log':_0xdc30('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2a48b12..a7aa4b3 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 _0xf319=['lodash','create','Request','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','duration','billableseconds','GetVoiceCallReports'];(function(_0x5aab6f,_0xc2ee68){var _0x8f8b84=function(_0x3a9002){while(--_0x3a9002){_0x5aab6f['push'](_0x5aab6f['shift']());}};_0x8f8b84(++_0xc2ee68);}(_0xf319,0x156));var _0x9f31=function(_0x148869,_0x1c11c8){_0x148869=_0x148869-0x0;var _0x116c03=_0xf319[_0x148869];return _0x116c03;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x9f31('0x0'));var client=require('../client');exports[_0x9f31('0x1')]=function(_0x11982e){return client[_0x9f31('0x2')]('CreateVoiceCallReport',{'body':_[_0x9f31('0x3')](_0x11982e,{'source':_0x11982e[_0x9f31('0x4')],'destinationcontext':_0x11982e[_0x9f31('0x5')],'callerid':_0x11982e[_0x9f31('0x6')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x9f31('0x7')]=function(){return function(){return client[_0x9f31('0x2')](_0x9f31('0x8'),{'options':{'where':{'type':[_0x9f31('0x9')],'createdAt':{'$between':[moment()[_0x9f31('0xa')]('day')[_0x9f31('0xb')](_0x9f31('0xc')),moment()[_0x9f31('0xd')](_0x9f31('0xe'))[_0x9f31('0xb')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x9f31('0xf'),'disposition',_0x9f31('0x10'),_0x9f31('0x11')]},'log':_0x9f31('0x12')});};}; \ No newline at end of file +var _0xc6b2=['GetVoiceCallReports','moment','../client','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition'];(function(_0x4f8578,_0x14a9be){var _0x2193c=function(_0x5b9658){while(--_0x5b9658){_0x4f8578['push'](_0x4f8578['shift']());}};_0x2193c(++_0x14a9be);}(_0xc6b2,0x10f));var _0x2c6b=function(_0x3829d1,_0x3adb1f){_0x3829d1=_0x3829d1-0x0;var _0xfde864=_0xc6b2[_0x3829d1];return _0xfde864;};'use strict';var moment=require(_0x2c6b('0x0'));var util=require('util');var _=require('lodash');var client=require(_0x2c6b('0x1'));exports['create']=function(_0x507ab4){return client[_0x2c6b('0x2')]('CreateVoiceCallReport',{'body':_[_0x2c6b('0x3')](_0x507ab4,{'source':_0x507ab4[_0x2c6b('0x4')],'destinationcontext':_0x507ab4[_0x2c6b('0x5')],'callerid':_0x507ab4[_0x2c6b('0x6')],'amaflags':_0x2c6b('0x7')}),'log':_0x2c6b('0x8')});};exports[_0x2c6b('0x9')]=function(){return function(){return client[_0x2c6b('0x2')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x2c6b('0xa')],'createdAt':{'$between':[moment()[_0x2c6b('0xb')](_0x2c6b('0xc'))[_0x2c6b('0xd')](_0x2c6b('0xe')),moment()['endOf']('day')[_0x2c6b('0xd')](_0x2c6b('0xe'))]}},'attributes':[_0x2c6b('0xf'),_0x2c6b('0x10'),'duration','billableseconds']},'log':_0x2c6b('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8c76d16..e81c4de 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 _0x84ab=['../client','create','Request','CreateVoiceDialReport'];(function(_0x54d8c4,_0x4d19cf){var _0x3568f4=function(_0x3c60e0){while(--_0x3c60e0){_0x54d8c4['push'](_0x54d8c4['shift']());}};_0x3568f4(++_0x4d19cf);}(_0x84ab,0x16c));var _0xb84a=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0x84ab[_0x37b7b6];return _0x10c4c3;};'use strict';var client=require(_0xb84a('0x0'));exports[_0xb84a('0x1')]=function(_0x25710a){return client[_0xb84a('0x2')](_0xb84a('0x3'),{'body':_0x25710a,'log':_0xb84a('0x3')});}; \ No newline at end of file +var _0x0249=['CreateVoiceDialReport','../client','create','Request'];(function(_0x5ca199,_0x10ccdf){var _0x20be4b=function(_0x5eb239){while(--_0x5eb239){_0x5ca199['push'](_0x5ca199['shift']());}};_0x20be4b(++_0x10ccdf);}(_0x0249,0x16d));var _0x9024=function(_0x18e12b,_0x3423f9){_0x18e12b=_0x18e12b-0x0;var _0x30f764=_0x0249[_0x18e12b];return _0x30f764;};'use strict';var client=require(_0x9024('0x0'));exports[_0x9024('0x1')]=function(_0x35a12e){return client[_0x9024('0x2')]('CreateVoiceDialReport',{'body':_0x35a12e,'log':_0x9024('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index baee91d..19a2dc7 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 _0x6c4d=['recordingFormat','getVoiceExtensions','../client','Request','exten'];(function(_0x501893,_0x15fa8b){var _0x5142dc=function(_0x10ee62){while(--_0x10ee62){_0x501893['push'](_0x501893['shift']());}};_0x5142dc(++_0x15fa8b);}(_0x6c4d,0x1dd));var _0xd6c4=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x6c4d[_0x2763f2];return _0x3ef471;};'use strict';var client=require(_0xd6c4('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xd6c4('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xd6c4('0x2'),_0xd6c4('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xd6c4('0x4')});};}; \ No newline at end of file +var _0xa5dd=['recordingFormat','getVoiceExtensions','../client','GetVoiceExtension','exten'];(function(_0x540a4f,_0x1b0015){var _0x423d32=function(_0x2df484){while(--_0x2df484){_0x540a4f['push'](_0x540a4f['shift']());}};_0x423d32(++_0x1b0015);}(_0xa5dd,0x101));var _0xda5d=function(_0x28c0a4,_0x4d1299){_0x28c0a4=_0x28c0a4-0x0;var _0x5b01a8=_0xa5dd[_0x28c0a4];return _0x5b01a8;};'use strict';var client=require(_0xda5d('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xda5d('0x1'),{'options':{'raw':!![],'attributes':['id',_0xda5d('0x2'),_0xda5d('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xda5d('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 2491a20..aa0fb9b 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 _0x80c6=['monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','interval','getVoiceQueues','../client','Request','name','acw','autopause'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x80c6,0x1f3));var _0x680c=function(_0x4d9d18,_0x2fe116){_0x4d9d18=_0x4d9d18-0x0;var _0x4fcb6c=_0x80c6[_0x4d9d18];return _0x4fcb6c;};'use strict';var client=require(_0x680c('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x680c('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x680c('0x2'),_0x680c('0x3'),'acwTimeout',_0x680c('0x4'),_0x680c('0x5'),_0x680c('0x6'),'dialActive',_0x680c('0x7'),_0x680c('0x8'),'dialLimitQueue',_0x680c('0x9'),_0x680c('0xa'),'dialPredictiveOptimizationPercentage',_0x680c('0xb'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x680c('0xc'),_0x680c('0xd'),_0x680c('0xe'),_0x680c('0xf'),_0x680c('0x10'),_0x680c('0x11'),_0x680c('0x12'),_0x680c('0x13'),_0x680c('0x14'),_0x680c('0x15'),'dialGlobalMaxRetry',_0x680c('0x16'),_0x680c('0x17'),_0x680c('0x18'),_0x680c('0x19'),'dialAMDActive',_0x680c('0x1a'),_0x680c('0x1b'),_0x680c('0x1c'),_0x680c('0x1d'),'dialAMDMinWordLength',_0x680c('0x1e'),_0x680c('0x1f'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x680c('0x20'),_0x680c('0x21'),_0x680c('0x22'),_0x680c('0x23'),_0x680c('0x24'),_0x680c('0x25'),_0x680c('0x26'),_0x680c('0x5'),'strategy',_0x680c('0x27'),_0x680c('0x28'),_0x680c('0x29'),_0x680c('0x2a'),_0x680c('0x2b'),_0x680c('0x2c'),_0x680c('0x2d'),_0x680c('0x2e'),_0x680c('0x2f'),_0x680c('0x30'),_0x680c('0x31'),_0x680c('0x32'),_0x680c('0x33'),_0x680c('0x34'),_0x680c('0x35')],'include':[{'model':_0x680c('0x36'),'as':'Trunk','attributes':['id','name',_0x680c('0x37'),'active']},{'model':_0x680c('0x38'),'as':_0x680c('0x39'),'attributes':['id','name']},{'model':_0x680c('0x36'),'as':_0x680c('0x3a'),'attributes':['id',_0x680c('0x2'),_0x680c('0x37'),_0x680c('0x3b')]},{'model':_0x680c('0x3c'),'as':_0x680c('0x3c'),'attributes':['id','name'],'include':[{'model':_0x680c('0x3c'),'as':'Intervals','attributes':['id','name',_0x680c('0x3d')]}]}]},'log':_0x680c('0x3e')});};}; \ No newline at end of file +var _0x1857=['dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','active','Interval','Intervals','getVoiceQueues','../client','Request','name','acw','acwTimeout','autopause','monitor_format','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive'];(function(_0x1c3d2a,_0x4fce90){var _0x44c8f2=function(_0x2bf12a){while(--_0x2bf12a){_0x1c3d2a['push'](_0x1c3d2a['shift']());}};_0x44c8f2(++_0x4fce90);}(_0x1857,0x125));var _0x7185=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1857[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x7185('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x7185('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x7185('0x2'),_0x7185('0x3'),_0x7185('0x4'),_0x7185('0x5'),_0x7185('0x6'),'type','dialActive','dialMethod',_0x7185('0x7'),_0x7185('0x8'),_0x7185('0x9'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x7185('0xa'),_0x7185('0xb'),'dialOriginateCallerIdNumber',_0x7185('0xc'),_0x7185('0xd'),'dialQueueTimeout',_0x7185('0xe'),_0x7185('0xf'),_0x7185('0x10'),_0x7185('0x11'),'dialBusyRetryFrequency',_0x7185('0x12'),_0x7185('0x13'),_0x7185('0x14'),_0x7185('0x15'),_0x7185('0x16'),'dialPrefix',_0x7185('0x17'),_0x7185('0x18'),'dialAMDInitialSilence','dialAMDGreeting',_0x7185('0x19'),'dialAMDTotalAnalysisTime',_0x7185('0x1a'),_0x7185('0x1b'),_0x7185('0x1c'),_0x7185('0x1d'),_0x7185('0x1e'),_0x7185('0x1f'),'dialRecallMeTimeout',_0x7185('0x20'),_0x7185('0x21'),_0x7185('0x22'),_0x7185('0x23'),_0x7185('0x24'),_0x7185('0x6'),_0x7185('0x25'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x7185('0x26'),'dialNoSuchNumberRetryFrequency',_0x7185('0x27'),'dialDropRetryFrequency',_0x7185('0x28'),_0x7185('0x29'),'dialMachineMaxRetry',_0x7185('0x2a'),_0x7185('0x2b'),_0x7185('0x2c'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x7185('0x2d')],'include':[{'model':_0x7185('0x2e'),'as':_0x7185('0x2e'),'attributes':['id',_0x7185('0x2'),_0x7185('0x2f'),'active']},{'model':_0x7185('0x30'),'as':'mandatoryDispositionPause','attributes':['id',_0x7185('0x2')]},{'model':_0x7185('0x2e'),'as':'TrunkBackup','attributes':['id','name',_0x7185('0x2f'),_0x7185('0x31')]},{'model':_0x7185('0x32'),'as':_0x7185('0x32'),'attributes':['id','name'],'include':[{'model':_0x7185('0x32'),'as':_0x7185('0x33'),'attributes':['id','name','interval']}]}]},'log':_0x7185('0x34')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index a5bca30..68cd7c0 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 _0x5416=['Request','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','moment','lodash','../client','create','CreateVoiceQueueReport','getVoiceQueueReports'];(function(_0x398d85,_0x2465d7){var _0x33c2bb=function(_0x4aa229){while(--_0x4aa229){_0x398d85['push'](_0x398d85['shift']());}};_0x33c2bb(++_0x2465d7);}(_0x5416,0x13d));var _0x6541=function(_0x1ff0b8,_0x4de1c6){_0x1ff0b8=_0x1ff0b8-0x0;var _0x195146=_0x5416[_0x1ff0b8];return _0x195146;};'use strict';var moment=require(_0x6541('0x0'));var _=require(_0x6541('0x1'));var client=require(_0x6541('0x2'));exports[_0x6541('0x3')]=function(_0x19cf2c){return client['Request'](_0x6541('0x4'),{'body':_0x19cf2c,'log':'CreateVoiceQueueReport'});};exports[_0x6541('0x5')]=function(){return function(){return client[_0x6541('0x6')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x6541('0x7')](_0x6541('0x8'))[_0x6541('0x9')](_0x6541('0xa')),moment()[_0x6541('0xb')](_0x6541('0x8'))[_0x6541('0x9')](_0x6541('0xa'))]}},'attributes':[_0x6541('0xc'),_0x6541('0xd'),_0x6541('0xe'),_0x6541('0xf'),_0x6541('0x10'),'queuecallercompleteAt',_0x6541('0x11'),_0x6541('0x12'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0x9e7b=['Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','uniqueid','queue','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','GetVoiceQueueReports','moment','lodash','create'];(function(_0x487a0b,_0x33c302){var _0x4cb1ba=function(_0x2a3615){while(--_0x2a3615){_0x487a0b['push'](_0x487a0b['shift']());}};_0x4cb1ba(++_0x33c302);}(_0x9e7b,0xed));var _0xb9e7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9e7b[_0x40a045];return _0x1a687c;};'use strict';var moment=require(_0xb9e7('0x0'));var _=require(_0xb9e7('0x1'));var client=require('../client');exports[_0xb9e7('0x2')]=function(_0x7efe6f){return client[_0xb9e7('0x3')]('CreateVoiceQueueReport',{'body':_0x7efe6f,'log':_0xb9e7('0x4')});};exports[_0xb9e7('0x5')]=function(){return function(){return client[_0xb9e7('0x3')](_0xb9e7('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xb9e7('0x7')](_0xb9e7('0x8'))['format'](_0xb9e7('0x9')),moment()[_0xb9e7('0xa')](_0xb9e7('0x8'))[_0xb9e7('0xb')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xb9e7('0xc'),_0xb9e7('0xd'),'queuecallerjoinAt','queuecallerleaveAt',_0xb9e7('0xe'),_0xb9e7('0xf'),_0xb9e7('0x10'),_0xb9e7('0x11'),_0xb9e7('0x12'),'queuecallerabandonAt']},'log':_0xb9e7('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index f12936b..7cb6274 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 _0xc278=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x3403bd,_0x2231f2){var _0x5941f8=function(_0x4140c0){while(--_0x4140c0){_0x3403bd['push'](_0x3403bd['shift']());}};_0x5941f8(++_0x2231f2);}(_0xc278,0x1d6));var _0x8c27=function(_0x3cfa9f,_0x31a114){_0x3cfa9f=_0x3cfa9f-0x0;var _0x26771f=_0xc278[_0x3cfa9f];return _0x26771f;};'use strict';var client=require(_0x8c27('0x0'));exports[_0x8c27('0x1')]=function(_0x5c5dd5){return function(){return client['Request'](_0x8c27('0x2'),{'options':{'where':{'VoiceQueueId':_0x5c5dd5,'paused':!![]},'raw':!![]},'log':_0x8c27('0x1')});};}; \ No newline at end of file +var _0xd803=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x20087e,_0x106473){var _0x2900d8=function(_0x3a0038){while(--_0x3a0038){_0x20087e['push'](_0x20087e['shift']());}};_0x2900d8(++_0x106473);}(_0xd803,0x129));var _0x3d80=function(_0x13ff4c,_0x25f86b){_0x13ff4c=_0x13ff4c-0x0;var _0x3a119d=_0xd803[_0x13ff4c];return _0x3a119d;};'use strict';var client=require('../client');exports[_0x3d80('0x0')]=function(_0x977272){return function(){return client[_0x3d80('0x1')](_0x3d80('0x2'),{'options':{'where':{'VoiceQueueId':_0x977272,'paused':!![]},'raw':!![]},'log':_0x3d80('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 177f6e7..6c32222 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 _0x4d0c=['Request','CreateVoiceRecording','lodash','../client','create'];(function(_0xf45b15,_0x47fc7c){var _0x5a4174=function(_0x321981){while(--_0x321981){_0xf45b15['push'](_0xf45b15['shift']());}};_0x5a4174(++_0x47fc7c);}(_0x4d0c,0x84));var _0xc4d0=function(_0x4f4a0d,_0x5c1a72){_0x4f4a0d=_0x4f4a0d-0x0;var _0x2c5115=_0x4d0c[_0x4f4a0d];return _0x2c5115;};'use strict';var _=require(_0xc4d0('0x0'));var client=require(_0xc4d0('0x1'));exports[_0xc4d0('0x2')]=function(_0x514e03){return client[_0xc4d0('0x3')]('CreateVoiceRecording',{'body':_['merge'](_0x514e03,{'value':_0x514e03['monitorFilename']}),'log':_0xc4d0('0x4')});}; \ No newline at end of file +var _0x4cbc=['merge','monitorFilename','lodash','create','CreateVoiceRecording'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x4cbc,0xfc));var _0xc4cb=function(_0x1fb326,_0x4422cb){_0x1fb326=_0x1fb326-0x0;var _0x1f4a8b=_0x4cbc[_0x1fb326];return _0x1f4a8b;};'use strict';var _=require(_0xc4cb('0x0'));var client=require('../client');exports[_0xc4cb('0x1')]=function(_0x1d6e1b){return client['Request'](_0xc4cb('0x2'),{'body':_[_0xc4cb('0x3')](_0x1d6e1b,{'value':_0x1d6e1b[_0xc4cb('0x4')]}),'log':_0xc4cb('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8081a70..76d8d0a 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 _0xc3f1=['transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','Request','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname'];(function(_0x3616f0,_0x1b4301){var _0x1830b6=function(_0x5e52fb){while(--_0x5e52fb){_0x3616f0['push'](_0x3616f0['shift']());}};_0x1830b6(++_0x1b4301);}(_0xc3f1,0xe8));var _0x1c3f=function(_0x4bb8a5,_0x22ffa0){_0x4bb8a5=_0x4bb8a5-0x0;var _0xe389aa=_0xc3f1[_0x4bb8a5];return _0xe389aa;};'use strict';var client=require(_0x1c3f('0x0'));exports[_0x1c3f('0x1')]={};exports[_0x1c3f('0x2')]=function(_0x1d900b){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x1d900b[_0x1c3f('0x3')],'transfererchannel':_0x1d900b[_0x1c3f('0x4')],'transferercalleridnum':_0x1d900b[_0x1c3f('0x5')],'transferercalleridname':_0x1d900b[_0x1c3f('0x6')],'transfererconnectedlinenum':_0x1d900b[_0x1c3f('0x7')],'transfererconnectedlinename':_0x1d900b[_0x1c3f('0x8')],'transfereraccountcode':_0x1d900b[_0x1c3f('0x9')],'transferercontext':_0x1d900b[_0x1c3f('0xa')],'transfererexten':_0x1d900b[_0x1c3f('0xb')],'transfererlinkedid':_0x1d900b[_0x1c3f('0xc')],'transfereechannel':_0x1d900b['transfereechannel'],'transfereecalleridnum':_0x1d900b['transfereecalleridnum'],'transfereecalleridname':_0x1d900b[_0x1c3f('0xd')],'transfereeconnectedlinenum':_0x1d900b[_0x1c3f('0xe')],'transfereeconnectedlinename':_0x1d900b[_0x1c3f('0xf')],'transfereeaccountcode':_0x1d900b[_0x1c3f('0x10')],'transfereecontext':_0x1d900b[_0x1c3f('0x11')],'transfereeexten':_0x1d900b[_0x1c3f('0x12')],'transfereelinkedid':_0x1d900b[_0x1c3f('0x13')],'isexternal':_0x1d900b[_0x1c3f('0x14')],'context':_0x1d900b[_0x1c3f('0x15')],'extension':_0x1d900b['extension'],'type':_0x1c3f('0x16')},'log':'CreateVoiceTransferReport'});};exports[_0x1c3f('0x17')]=function(_0x5292fd){return client[_0x1c3f('0x18')](_0x1c3f('0x19'),{'body':{'result':_0x5292fd[_0x1c3f('0x3')],'transfererchannel':_0x5292fd[_0x1c3f('0x1a')],'transferercalleridnum':_0x5292fd[_0x1c3f('0x1b')],'transferercalleridname':_0x5292fd[_0x1c3f('0x1c')],'transfererconnectedlinenum':_0x5292fd[_0x1c3f('0x1d')],'transfererconnectedlinename':_0x5292fd[_0x1c3f('0x1e')],'transfereraccountcode':_0x5292fd['origtransfereraccountcode'],'transferercontext':_0x5292fd['secondtransferercontext'],'transfererexten':_0x5292fd['secondtransfererexten'],'transfererlinkedid':_0x5292fd[_0x1c3f('0x1f')],'transfereechannel':_0x5292fd[_0x1c3f('0x20')],'transfereecalleridnum':_0x5292fd[_0x1c3f('0x21')],'transfereecalleridname':_0x5292fd[_0x1c3f('0x22')],'transfereeconnectedlinenum':_0x5292fd[_0x1c3f('0x23')],'transfereeconnectedlinename':_0x5292fd[_0x1c3f('0x24')],'transfereeaccountcode':_0x5292fd['transfertargetaccountcode'],'transfereecontext':_0x5292fd['transfertargetcontext'],'transfereeexten':_0x5292fd[_0x1c3f('0x25')],'transfereelinkedid':_0x5292fd[_0x1c3f('0x26')],'isexternal':_0x5292fd[_0x1c3f('0x14')],'context':_0x5292fd['origtransferercontext'],'extension':_0x5292fd[_0x1c3f('0x27')],'type':_0x1c3f('0x28')},'log':_0x1c3f('0x19')});}; \ No newline at end of file +var _0xf65f=['transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode'];(function(_0x60baeb,_0x5cf523){var _0x4a9ef9=function(_0x57087c){while(--_0x57087c){_0x60baeb['push'](_0x60baeb['shift']());}};_0x4a9ef9(++_0x5cf523);}(_0xf65f,0xe6));var _0xff65=function(_0x593307,_0x48d367){_0x593307=_0x593307-0x0;var _0x4eebef=_0xf65f[_0x593307];return _0x4eebef;};'use strict';var client=require(_0xff65('0x0'));exports['transfers']={};exports[_0xff65('0x1')]=function(_0x501fbb){return client[_0xff65('0x2')](_0xff65('0x3'),{'body':{'result':_0x501fbb[_0xff65('0x4')],'transfererchannel':_0x501fbb[_0xff65('0x5')],'transferercalleridnum':_0x501fbb['transferercalleridnum'],'transferercalleridname':_0x501fbb[_0xff65('0x6')],'transfererconnectedlinenum':_0x501fbb[_0xff65('0x7')],'transfererconnectedlinename':_0x501fbb[_0xff65('0x8')],'transfereraccountcode':_0x501fbb[_0xff65('0x9')],'transferercontext':_0x501fbb[_0xff65('0xa')],'transfererexten':_0x501fbb['transfererexten'],'transfererlinkedid':_0x501fbb[_0xff65('0xb')],'transfereechannel':_0x501fbb['transfereechannel'],'transfereecalleridnum':_0x501fbb[_0xff65('0xc')],'transfereecalleridname':_0x501fbb[_0xff65('0xd')],'transfereeconnectedlinenum':_0x501fbb[_0xff65('0xe')],'transfereeconnectedlinename':_0x501fbb['transfereeconnectedlinename'],'transfereeaccountcode':_0x501fbb[_0xff65('0xf')],'transfereecontext':_0x501fbb[_0xff65('0x10')],'transfereeexten':_0x501fbb[_0xff65('0x11')],'transfereelinkedid':_0x501fbb['transfereelinkedid'],'isexternal':_0x501fbb[_0xff65('0x12')],'context':_0x501fbb[_0xff65('0x13')],'extension':_0x501fbb[_0xff65('0x14')],'type':_0xff65('0x15')},'log':_0xff65('0x3')});};exports[_0xff65('0x16')]=function(_0x41d8fd){return client[_0xff65('0x2')](_0xff65('0x3'),{'body':{'result':_0x41d8fd[_0xff65('0x4')],'transfererchannel':_0x41d8fd[_0xff65('0x17')],'transferercalleridnum':_0x41d8fd[_0xff65('0x18')],'transferercalleridname':_0x41d8fd[_0xff65('0x19')],'transfererconnectedlinenum':_0x41d8fd[_0xff65('0x1a')],'transfererconnectedlinename':_0x41d8fd[_0xff65('0x1b')],'transfereraccountcode':_0x41d8fd[_0xff65('0x1c')],'transferercontext':_0x41d8fd[_0xff65('0x1d')],'transfererexten':_0x41d8fd[_0xff65('0x1e')],'transfererlinkedid':_0x41d8fd[_0xff65('0x1f')],'transfereechannel':_0x41d8fd['transfertargetchannel'],'transfereecalleridnum':_0x41d8fd[_0xff65('0x20')],'transfereecalleridname':_0x41d8fd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x41d8fd[_0xff65('0x21')],'transfereeconnectedlinename':_0x41d8fd[_0xff65('0x22')],'transfereeaccountcode':_0x41d8fd[_0xff65('0x23')],'transfereecontext':_0x41d8fd[_0xff65('0x24')],'transfereeexten':_0x41d8fd[_0xff65('0x25')],'transfereelinkedid':_0x41d8fd[_0xff65('0x26')],'isexternal':_0x41d8fd['isexternal'],'context':_0x41d8fd[_0xff65('0x27')],'extension':_0x41d8fd[_0xff65('0x28')],'type':'attended'},'log':_0xff65('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c3fc1b1..caaa8b1 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 _0xa92a=['name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','Reload','Action','then','catch','message','action','Command','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','omit','undefined','channels','voicechannel','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','isNil','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','validate','bluebird','moment','../properties','format','%s/%s','SIP'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa92a,0x18c));var _0xaa92=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa92a[_0x2f3848];return _0x102668;};'use strict';var _=require(_0xaa92('0x0'));var util=require('util');var jayson=require(_0xaa92('0x1'));var schema=require(_0xaa92('0x2'));var BPromise=require(_0xaa92('0x3'));var moment=require(_0xaa92('0x4'));var config=require('../../../config/environment');var properties=require(_0xaa92('0x5'));var ami=require('../ami');exports['listen']=function(_0x4cbfb6,_0x56dc82,_0x32469b){return new BPromise(function(_0x1b206e,_0x29d9ad){var _0x45693a={'QueuePause':function(_0x2592e0){return new Promise(function(_0x418b1b,_0x1e8b19){var _0x391bf9=util[_0xaa92('0x6')](_0xaa92('0x7'),_0xaa92('0x8'),_0x2592e0[_0xaa92('0x9')]);if(_0x4cbfb6[_0xaa92('0xa')]&&_0x4cbfb6['timers'][_0x391bf9]&&_0x4cbfb6['timers'][_0x391bf9][_0xaa92('0xb')]){_0x4cbfb6['timers'][_0x391bf9][_0xaa92('0xc')]();}if(_0x4cbfb6[_0xaa92('0xd')][_0x391bf9]){_0x4cbfb6[_0xaa92('0xd')][_0x391bf9][_0xaa92('0xe')]({'statePause':_0x2592e0['pause']?!![]:![]});}_0x418b1b({'code':0xc8,'message':_0xaa92('0xf')});});},'Reload':function(_0x41c57f){var _0x11d2a7=this;return new Promise(function(_0x504e82,_0x58636c){if(ami[_0xaa92('0x10')]()==![]){return _0x58636c(_0x11d2a7[_0xaa92('0x11')](0x1f4,[config[_0xaa92('0x12')]['ip'],config[_0xaa92('0x12')][_0xaa92('0x13')],_0xaa92('0x14')][_0xaa92('0x15')]('\x20')));}_0x41c57f=_[_0xaa92('0x16')](_0x41c57f,_[_0xaa92('0x17')](properties[_0xaa92('0x18')]));_0x41c57f['action']=_0xaa92('0x19');return ami[_0xaa92('0x1a')](_0x41c57f)[_0xaa92('0x1b')](function(_0x151f98){_0x504e82({'code':0xc8,'message':_0x151f98['message']});})[_0xaa92('0x1c')](function(_0x3a5c3e){_0x58636c(_0x11d2a7['error'](0x1f5,_0x3a5c3e[_0xaa92('0x1d')]));});});},'Command':function(_0x57809a){var _0x544c15=this;return new Promise(function(_0x4beec8,_0x449c46){if(ami[_0xaa92('0x10')]()==![]){return _0x449c46(_0x544c15['error'](0x1f4,[config[_0xaa92('0x12')]['ip'],config[_0xaa92('0x12')]['username'],'ami\x20disconnected'][_0xaa92('0x15')]('\x20')));}_0x57809a=_[_0xaa92('0x16')](_0x57809a,'command');_0x57809a[_0xaa92('0x1e')]=_0xaa92('0x1f');return ami[_0xaa92('0x1a')](_0x57809a)[_0xaa92('0x1b')](function(_0x53dbbb){_0x4beec8({'code':0xc8,'message':_0x53dbbb['content']});})[_0xaa92('0x1c')](function(_0x440bfe){_0x449c46(_0x544c15[_0xaa92('0x11')](0x1f5,_0x440bfe[_0xaa92('0x1d')]));});});},'VoiceQueues':function(_0x104cb9){return new Promise(function(_0x5870d3,_0x1427b5){var _0x52648b=[];for(var _0x484c64 in _0x4cbfb6[_0xaa92('0x20')]){if(_0x4cbfb6[_0xaa92('0x20')][_0xaa92('0x21')](_0x484c64)){var _0x23752f=_0x4cbfb6[_0xaa92('0x20')][_0x484c64];var _0x2dc545={'id':_0x23752f['id'],'name':_0x23752f['name'],'strategy':_0x23752f[_0xaa92('0x22')],'answered':_0x23752f['answered'],'available':_0x23752f['available'],'loggedIn':_0x23752f[_0xaa92('0x23')],'pTalking':_0x23752f[_0xaa92('0x24')],'sumBillable':_0x23752f[_0xaa92('0x25')],'sumDuration':_0x23752f[_0xaa92('0x26')],'sumHoldTime':_0x23752f[_0xaa92('0x27')]||0x0,'talking':_0x23752f[_0xaa92('0x28')],'total':_0x23752f[_0xaa92('0x29')],'type':_0x23752f['type'],'unmanaged':_0x23752f['unmanaged'],'abandoned':_0x23752f[_0xaa92('0x2a')],'waiting':_0x23752f['waiting'],'loggedInDb':_0x23752f['loggedInDb']};if(_0x23752f['type']==='outbound'){_0x2dc545[_0xaa92('0x2b')]=_0x23752f[_0xaa92('0x2b')];_0x2dc545[_0xaa92('0x2c')]=_0x23752f[_0xaa92('0x2c')];_0x2dc545[_0xaa92('0x2d')]=_0x23752f['dialOriginateCallerIdName'];_0x2dc545[_0xaa92('0x2e')]=_0x23752f[_0xaa92('0x2e')];_0x2dc545[_0xaa92('0x2f')]=_0x23752f[_0xaa92('0x2f')];_0x2dc545[_0xaa92('0x30')]=_0x23752f[_0xaa92('0x30')];_0x2dc545['temp']=_0x23752f[_0xaa92('0x31')];_0x2dc545[_0xaa92('0x32')]=_0x23752f['outboundAnswerAgiCallsDay'];_0x2dc545['outboundAnswerCallsDay']=_0x23752f[_0xaa92('0x33')];_0x2dc545[_0xaa92('0x34')]=_0x23752f[_0xaa92('0x34')];_0x2dc545['outboundBusyCallsDay']=_0x23752f['outboundBusyCallsDay'];_0x2dc545['outboundCongestionCallsDay']=_0x23752f[_0xaa92('0x35')];_0x2dc545[_0xaa92('0x36')]=_0x23752f[_0xaa92('0x36')];_0x2dc545[_0xaa92('0x37')]=_0x23752f[_0xaa92('0x37')];_0x2dc545['outboundDropCallsDayTimeout']=_0x23752f['outboundDropCallsDayTimeout'];_0x2dc545['outboundNoAnswerCallsDay']=_0x23752f['outboundNoAnswerCallsDay'];_0x2dc545[_0xaa92('0x38')]=_0x23752f[_0xaa92('0x38')];_0x2dc545[_0xaa92('0x39')]=_0x23752f[_0xaa92('0x39')];_0x2dc545[_0xaa92('0x3a')]=_0x23752f[_0xaa92('0x3a')];_0x2dc545[_0xaa92('0x3b')]=_0x23752f[_0xaa92('0x3b')];_0x2dc545[_0xaa92('0x3c')]=_0x23752f['outboundUnknownCallsDay'];_0x2dc545[_0xaa92('0x3d')]=_0x23752f[_0xaa92('0x3d')];_0x2dc545[_0xaa92('0x3e')]=_0x23752f['predictiveIntervalAvgHoldtime'];_0x2dc545[_0xaa92('0x3f')]=_0x23752f[_0xaa92('0x3f')];_0x2dc545[_0xaa92('0x40')]=_0x23752f[_0xaa92('0x40')];_0x2dc545[_0xaa92('0x41')]=_0x23752f['predictiveIntervalDroppedCallsTimeout'];_0x2dc545['predictiveIntervalErlangCalls']=_0x23752f[_0xaa92('0x42')];_0x2dc545['predictiveIntervalErlangCallsDroppedCalls']=_0x23752f[_0xaa92('0x43')];_0x2dc545[_0xaa92('0x44')]=_0x23752f[_0xaa92('0x44')];_0x2dc545[_0xaa92('0x45')]=_0x23752f['predictiveIntervalMultiplicativeFactor'];_0x2dc545['predictiveIntervalPauses']=_0x23752f[_0xaa92('0x46')];_0x2dc545[_0xaa92('0x47')]=_0x23752f[_0xaa92('0x47')];_0x2dc545[_0xaa92('0x48')]=_0x23752f[_0xaa92('0x48')];_0x2dc545[_0xaa92('0x1d')]=_0x23752f[_0xaa92('0x1d')];_0x2dc545[_0xaa92('0x49')]=_0x23752f[_0xaa92('0x49')];_0x2dc545[_0xaa92('0x4a')]=_0x23752f[_0xaa92('0x4a')];_0x2dc545[_0xaa92('0x4b')]=_0x23752f['erlangCallToSecond'];_0x2dc545[_0xaa92('0x4c')]=_0x23752f[_0xaa92('0x4c')];_0x2dc545['erlangBusyFactor']=_0x23752f[_0xaa92('0x4d')];_0x2dc545['startPredictive']=_0x23752f[_0xaa92('0x4e')];_0x2dc545['startProgressive']=_0x23752f[_0xaa92('0x4f')];}if(_0x23752f[_0xaa92('0x50')]){_0x2dc545['Trunk']={'id':_0x23752f[_0xaa92('0x50')]['id'],'name':_0x23752f[_0xaa92('0x50')][_0xaa92('0x9')],'active':_0x23752f[_0xaa92('0x50')][_0xaa92('0x51')],'callerid':_0x23752f[_0xaa92('0x50')][_0xaa92('0x52')]};}if(_0x23752f['Interval']){_0x2dc545['Interval']={'id':_0x23752f[_0xaa92('0x53')]['id'],'name':_0x23752f[_0xaa92('0x53')]['name']};}_0x52648b[_0xaa92('0x54')](_0x2dc545);}}_0x5870d3({'count':_0x52648b[_0xaa92('0x55')],'rows':_0x52648b});});},'UpdateVoiceQueue':function(_0x46caed){return new Promise(function(_0x5d85e7,_0x4906f6){var _0x2353fc=_['find'](_0x4cbfb6['voiceQueues'],{'id':parseInt(_0x46caed['id'])});var _0xe11acd=_[_0xaa92('0x56')](_0x46caed,['id']);if(_0x2353fc){for(var _0x4438c6 in _0xe11acd){if(typeof _0xe11acd[_0x4438c6]!==_0xaa92('0x57')&&typeof _0x2353fc[_0x4438c6]!=='undefined'){_0x2353fc[_0x4438c6]=_0xe11acd[_0x4438c6];}}_0x5d85e7(_0x2353fc);}else{_0x4906f6();}});},'VoiceChannels':function(_0x2beacf){return new Promise(function(_0x42dd8e,_0x44b749){var _0x2ff6cb=_['values'](_0x4cbfb6[_0xaa92('0x58')]);_0x42dd8e({'count':_0x2ff6cb['length'],'rows':_0x2ff6cb});});},'VoiceChannelMixMonitor':function(_0x11ddc1){var _0x5d07e6=this;return new Promise(function(_0x553820,_0x3ad9a5){if(ami[_0xaa92('0x10')]()==![]){return _0x3ad9a5(_0x5d07e6['error'](0x1f4,[config[_0xaa92('0x12')]['ip'],config[_0xaa92('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x135d1e=schema(properties[_0xaa92('0x59')])[_0xaa92('0x2')](_0x11ddc1);if(_0x135d1e[_0xaa92('0x55')]>0x0){return _0x3ad9a5(_0x5d07e6[_0xaa92('0x11')](0x1f4,_[_0xaa92('0x5a')](_0x135d1e,_0xaa92('0x1d'))[_0xaa92('0x15')](',\x20')));}var _0x3e67a4=_[_0xaa92('0x5b')](_0x4cbfb6['channels'],{'uniqueid':_0x11ddc1[_0xaa92('0x5c')]});if(_0x3e67a4&&_0x3e67a4[_0xaa92('0x5d')]){var _0x3149d6=util[_0xaa92('0x6')](_0xaa92('0x5e'),_0x11ddc1[_0xaa92('0x5f')]||_0x11ddc1[_0xaa92('0x5c')],_0x11ddc1['format']||_0xaa92('0x60'));return ami[_0xaa92('0x1a')]({'action':_0xaa92('0x61'),'channel':_0x3e67a4[_0xaa92('0x5d')],'file':_0x3149d6,'options':_0xaa92('0x62')})['then'](function(_0x5c6ed0){var _0x55e0d7=_['find'](_0x3e67a4[_0xaa92('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x3149d6['toLowerCase']()});if(_[_0xaa92('0x64')](_0x55e0d7)){_0x3e67a4[_0xaa92('0x63')][_0xaa92('0x54')]({'filename':_0xaa92('0x65')+_0x3149d6[_0xaa92('0x66')](),'createdAt':moment()[_0xaa92('0x6')](_0xaa92('0x67')),'mixmonitorid':_0x5c6ed0[_0xaa92('0x68')],'status':_0xaa92('0x69')});}else{_0x55e0d7[_0xaa92('0x68')]=_0x5c6ed0[_0xaa92('0x68')];_0x55e0d7[_0xaa92('0x6a')]=_0xaa92('0x69');}_0x553820({'code':0xc8,'message':[_0x11ddc1[_0xaa92('0x5c')],_0xaa92('0x6b'),_0x5c6ed0[_0xaa92('0x68')]]['join']('\x20'),'mixmonitorid':_0x5c6ed0[_0xaa92('0x68')]});})[_0xaa92('0x1c')](function(_0x121ad7){_0x3ad9a5(_0x5d07e6[_0xaa92('0x11')](0x1f5,[_0x11ddc1[_0xaa92('0x5c')],_0x121ad7[_0xaa92('0x1d')][_0xaa92('0x66')]()][_0xaa92('0x15')]('\x20')));});}else{return _0x3ad9a5(_0x5d07e6[_0xaa92('0x11')](0x1f5,_0xaa92('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x8a791d){var _0x4fc073=this;return new Promise(function(_0x3fb2be,_0x1ac913){if(ami[_0xaa92('0x10')]()==![]){return _0x1ac913(_0x4fc073[_0xaa92('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xaa92('0x13')],_0xaa92('0x14')][_0xaa92('0x15')]('\x20')));}var _0x34afd1=schema(properties[_0xaa92('0x59')])[_0xaa92('0x2')](_0x8a791d);if(_0x34afd1[_0xaa92('0x55')]>0x0){return _0x1ac913(_0x4fc073[_0xaa92('0x11')](0x1f4,_[_0xaa92('0x5a')](_0x34afd1,_0xaa92('0x1d'))[_0xaa92('0x15')](',\x20')));}var _0x3a5430=_['find'](_0x4cbfb6[_0xaa92('0x58')],{'uniqueid':_0x8a791d[_0xaa92('0x5c')]});if(_0x3a5430){return BPromise['resolve']()[_0xaa92('0x1b')](function(){if(_0x3a5430[_0xaa92('0x5d')]){return ami['Action']({'action':_0xaa92('0x6d'),'channel':_0x3a5430[_0xaa92('0x5d')],'mixmonitorid':_0x8a791d[_0xaa92('0x68')]})[_0xaa92('0x1c')](function(_0x4d2435){});}})[_0xaa92('0x1b')](function(){if(_0x3a5430[_0xaa92('0x6e')]){return ami[_0xaa92('0x1a')]({'action':_0xaa92('0x6d'),'channel':_0x3a5430[_0xaa92('0x6e')],'mixmonitorid':_0x8a791d['mixmonitorid']})[_0xaa92('0x1c')](function(_0x19c2c3){});}})[_0xaa92('0x1b')](function(_0x1a3f21){var _0x37f1df=_[_0xaa92('0x5b')](_0x3a5430[_0xaa92('0x63')],{'mixmonitorid':_0x8a791d[_0xaa92('0x68')]});if(_0x37f1df){_0x37f1df[_0xaa92('0x6a')]=_0xaa92('0x6f');}})[_0xaa92('0x1b')](function(){var _0x307f3b=util['format'](_0xaa92('0x5e'),_0x8a791d[_0xaa92('0x5f')]||_0x8a791d['uniqueid'],_0x8a791d[_0xaa92('0x6')]||'wav');var _0xa6d9d8=_[_0xaa92('0x5b')](_0x3a5430[_0xaa92('0x63')],{'filename':_0xaa92('0x65')+_0x307f3b[_0xaa92('0x66')]()});if(_0xa6d9d8){_0xa6d9d8[_0xaa92('0x6a')]=_0xaa92('0x6f');}})[_0xaa92('0x1b')](function(){_0x3fb2be({'code':0xc8,'message':[_0x8a791d['uniqueid'],_0xaa92('0x70')][_0xaa92('0x15')]('\x20')});})[_0xaa92('0x1c')](function(_0x23989d){_0x1ac913(_0x4fc073[_0xaa92('0x11')](0x1f5,[_0x8a791d[_0xaa92('0x5c')],_0x23989d[_0xaa92('0x1d')][_0xaa92('0x66')]()]['join']('\x20')));});}else{return _0x1ac913(_0x4fc073[_0xaa92('0x11')](0x1f5,_0xaa92('0x6c')));}});},'VoiceQueuesChannels':function(_0x521e03){return new Promise(function(_0x2fd9e8,_0xe75c0f){var _0x27aade=_[_0xaa92('0x71')](_0x4cbfb6[_0xaa92('0x72')]);_0x2fd9e8({'count':_0x27aade[_0xaa92('0x55')],'rows':_0x27aade});});},'VoiceQueuesChannel':function(_0x35861b){var _0x719102=this;return new Promise(function(_0x233785,_0x29da75){var _0xd3801f=schema(properties['voicequeuechannel'])[_0xaa92('0x2')](_0x35861b);if(_0xd3801f['length']>0x0){return _0x29da75(_0x719102[_0xaa92('0x11')](0x1f4,_[_0xaa92('0x5a')](_0xd3801f,_0xaa92('0x1d'))['join'](',\x20')));}var _0x591e0f=_[_0xaa92('0x5b')](_0x4cbfb6[_0xaa92('0x72')],{'uniqueid':_0x35861b['uniqueid']});if(_0x591e0f){_0x233785(_0x591e0f);}else{return _0x29da75(_0x719102['error'](0x1f5,_0xaa92('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x51eeff){var _0x511df1=this;return new Promise(function(_0x260563,_0x588d0d){if(ami[_0xaa92('0x10')]()==![]){return _0x588d0d(_0x511df1[_0xaa92('0x11')](0x1f4,[config[_0xaa92('0x12')]['ip'],config[_0xaa92('0x12')][_0xaa92('0x13')],'ami\x20disconnected'][_0xaa92('0x15')]('\x20')));}var _0x52b3f8=schema(properties[_0xaa92('0x73')])['validate'](_0x51eeff);if(_0x52b3f8[_0xaa92('0x55')]>0x0){return _0x588d0d(_0x511df1[_0xaa92('0x11')](0x1f4,_[_0xaa92('0x5a')](_0x52b3f8,_0xaa92('0x1d'))['join'](',\x20')));}var _0x6f64=_[_0xaa92('0x5b')](_0x4cbfb6[_0xaa92('0x72')],{'uniqueid':_0x51eeff['uniqueid']});if(_0x6f64&&_0x6f64[_0xaa92('0x5d')]){return ami[_0xaa92('0x1a')]({'action':_0xaa92('0x74'),'channel':_0x6f64[_0xaa92('0x5d')]})[_0xaa92('0x1b')](function(_0x54f627){_0x260563({'code':0xc8,'message':[_0x51eeff[_0xaa92('0x5c')],_0x54f627[_0xaa92('0x1d')][_0xaa92('0x66')]()]['join']('\x20')});})[_0xaa92('0x1c')](function(_0x54327b){_0x588d0d(_0x511df1[_0xaa92('0x11')](0x1f5,[_0x51eeff[_0xaa92('0x5c')],_0x54327b[_0xaa92('0x1d')]['toLowerCase']()]['join']('\x20')));});}else{return _0x588d0d(_0x511df1[_0xaa92('0x11')](0x1f5,_0xaa92('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x27b236){var _0x42aec5=this;return new Promise(function(_0x139380,_0x504260){if(ami['isConnected']()==![]){return _0x504260(_0x42aec5['error'](0x1f4,[config[_0xaa92('0x12')]['ip'],config[_0xaa92('0x12')][_0xaa92('0x13')],_0xaa92('0x14')][_0xaa92('0x15')]('\x20')));}var _0x3cf36b=schema(properties[_0xaa92('0x75')])[_0xaa92('0x2')](_0x27b236);if(_0x3cf36b[_0xaa92('0x55')]>0x0){return _0x504260(_0x42aec5[_0xaa92('0x11')](0x1f4,_[_0xaa92('0x5a')](_0x3cf36b,_0xaa92('0x1d'))[_0xaa92('0x15')](',\x20')));}var _0x43771f=_['find'](_0x4cbfb6['queueChannels'],{'uniqueid':_0x27b236['uniqueid']});if(_0x43771f&&_0x43771f[_0xaa92('0x5d')]){return ami['Action']({'action':_0xaa92('0x76'),'channel':_0x43771f['channel'],'exten':_0x27b236['exten'],'context':_0x27b236['context']||_0x43771f[_0xaa92('0x77')],'priority':0x1})[_0xaa92('0x1b')](function(_0x565610){_0x139380({'code':0xc8,'message':[_0x27b236[_0xaa92('0x5c')],_0x565610[_0xaa92('0x1d')][_0xaa92('0x66')]()][_0xaa92('0x15')]('\x20')});})[_0xaa92('0x1c')](function(_0xabb665){_0x504260(_0x42aec5['error'](0x1f5,[_0x27b236[_0xaa92('0x5c')],_0xabb665[_0xaa92('0x1d')][_0xaa92('0x66')]()][_0xaa92('0x15')]('\x20')));});}else{return _0x504260(_0x42aec5[_0xaa92('0x11')](0x1f5,_0xaa92('0x6c')));}});},'Agents':function(_0x31572f){return new Promise(function(_0x1da967,_0x280de1){var _0x232ea4=_[_0xaa92('0x71')](_0x4cbfb6[_0xaa92('0xd')]);_0x1da967({'count':_0x232ea4[_0xaa92('0x55')],'rows':_0x232ea4});});},'Telephones':function(_0x1a759d){return new Promise(function(_0x2def25,_0x3f7c1b){var _0x196df6=_[_0xaa92('0x71')](_0x4cbfb6[_0xaa92('0x78')]);_0x2def25({'count':_0x196df6[_0xaa92('0x55')],'rows':_0x196df6});});},'Trunks':function(_0x4427bb){return new Promise(function(_0xd5155f,_0x545cd0){var _0x55d69e=_[_0xaa92('0x71')](_0x4cbfb6[_0xaa92('0x79')]);_0xd5155f({'count':_0x55d69e[_0xaa92('0x55')],'rows':_0x55d69e});});},'OutboundChannels':function(_0x55e48c){return new Promise(function(_0x504f3a,_0x229a52){var _0x397a43=_[_0xaa92('0x71')](_0x4cbfb6[_0xaa92('0x7a')]);_0x504f3a({'count':_0x397a43[_0xaa92('0x55')],'rows':_0x397a43});});},'Outbound':function(_0x2715c9){return new Promise(function(_0x470fb0,_0x5a767b){_0x470fb0(_0x4cbfb6['outbound']);});},'Campaigns':function(_0x1c142d){return new Promise(function(_0x16aea0,_0x5b4afc){var _0xd6b3c5=_[_0xaa92('0x71')](_0x4cbfb6['campaigns']);_0x16aea0({'count':_0xd6b3c5['length'],'rows':_0xd6b3c5});});},'VoiceQueuesPreview':function(_0x4b323d){var _0x39c481=this;return new Promise(function(_0x337a5c,_0xb2d694){_0x56dc82[_0xaa92('0x7b')](_0x4b323d['id'])[_0xaa92('0x1b')](function(_0x31cb19){_0x337a5c({'code':0xc8,'message':_0x31cb19[_0xaa92('0x1d')]});})[_0xaa92('0x1c')](function(_0x32d507){_0xb2d694(_0x39c481[_0xaa92('0x11')](0x1f4,_0x32d507[_0xaa92('0x1d')]));});});},'EventManager':function(_0x463f13){var _0x47120d=this;return new Promise(function(_0x2fb1bc,_0x271689){if(!_0x463f13[_0xaa92('0x7c')]){return _0x271689(_0x47120d[_0xaa92('0x11')](0x1f4,_0xaa92('0x7d')));}ami[_0xaa92('0x7e')](_0xaa92('0x7f')+_0x463f13[_0xaa92('0x7c')],_0x463f13[_0xaa92('0x1d')]);_0x2fb1bc({'code':0xc8,'message':_0x463f13});});},'FaxAccounts':function(_0x55ce8b){return new Promise(function(_0x509a2d,_0x31a2a3){var _0x250fcd=_['values'](_0x4cbfb6[_0xaa92('0x80')]);_0x509a2d({'count':_0x250fcd[_0xaa92('0x55')],'rows':_0x250fcd});});},'SendFax':function(_0x348319){var _0x389a07=this;return new Promise(function(_0xb53a88,_0x3edeb6){_0x32469b[_0xaa92('0x81')](_0x348319)['then'](function(_0x15c538){_0xb53a88({'code':0xc8,'message':_0x15c538[_0xaa92('0x1d')]});})[_0xaa92('0x1c')](function(_0x481e09){_0x3edeb6(_0x389a07[_0xaa92('0x11')](0x1f4,_0x481e09[_0xaa92('0x1d')]));});});},'CheckAfterSend':function(_0x515cb9){var _0x418fd6=this;return new Promise(function(_0x5c81e7,_0x24a3c6){_0x32469b[_0xaa92('0x82')](_0x515cb9)[_0xaa92('0x1b')](function(_0x7c848e){_0x5c81e7({'code':0xc8,'message':_0x7c848e['message']});})[_0xaa92('0x1c')](function(_0x1e13c1){_0x24a3c6(_0x418fd6['error'](0x1f4,_0x1e13c1[_0xaa92('0x1d')]));});});}};var _0x177f43=jayson[_0xaa92('0x83')](_0x45693a)['http']();_0x177f43['on']('error',function(_0x4986a2){return _0x29d9ad(_0x4986a2);});_0x177f43[_0xaa92('0x84')](0x232a,'127.0.0.1',function(){console[_0xaa92('0x85')](_0xaa92('0x86'),0x232a);return _0x1b206e('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x7f9a=['exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','checkAfterSend','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','username','ami\x20disconnected','join','pick','module','Action','then','message','error','asterisk','command','action','Command','content','catch','voiceQueues','hasOwnProperty','strategy','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','find','omit','undefined','channels','length','voicechannel','validate','map','uniqueid','channel','filename','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','stop','%s.%s','wav','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7f9a,0x1a9));var _0xa7f9=function(_0x592aea,_0x523681){_0x592aea=_0x592aea-0x0;var _0x5638e3=_0x7f9a[_0x592aea];return _0x5638e3;};'use strict';var _=require(_0xa7f9('0x0'));var util=require(_0xa7f9('0x1'));var jayson=require(_0xa7f9('0x2'));var schema=require('validate');var BPromise=require(_0xa7f9('0x3'));var moment=require(_0xa7f9('0x4'));var config=require(_0xa7f9('0x5'));var properties=require(_0xa7f9('0x6'));var ami=require('../ami');exports['listen']=function(_0x165548,_0x686532,_0x321487){return new BPromise(function(_0x38ce25,_0x2b59c4){var _0x357628={'QueuePause':function(_0x3e0fa9){return new Promise(function(_0x2bbc9b,_0x359966){var _0x6bba82=util[_0xa7f9('0x7')](_0xa7f9('0x8'),'SIP',_0x3e0fa9[_0xa7f9('0x9')]);if(_0x165548['timers']&&_0x165548[_0xa7f9('0xa')][_0x6bba82]&&_0x165548[_0xa7f9('0xa')][_0x6bba82][_0xa7f9('0xb')]){_0x165548[_0xa7f9('0xa')][_0x6bba82][_0xa7f9('0xc')]();}if(_0x165548['agents'][_0x6bba82]){_0x165548[_0xa7f9('0xd')][_0x6bba82][_0xa7f9('0xe')]({'statePause':_0x3e0fa9[_0xa7f9('0xf')]?!![]:![]});}_0x2bbc9b({'code':0xc8,'message':_0xa7f9('0x10')});});},'Reload':function(_0x225515){var _0x703db5=this;return new Promise(function(_0x1ade06,_0x74f5a6){if(ami[_0xa7f9('0x11')]()==![]){return _0x74f5a6(_0x703db5['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xa7f9('0x12')],_0xa7f9('0x13')][_0xa7f9('0x14')]('\x20')));}_0x225515=_[_0xa7f9('0x15')](_0x225515,_['keys'](properties[_0xa7f9('0x16')]));_0x225515['action']='Reload';return ami[_0xa7f9('0x17')](_0x225515)[_0xa7f9('0x18')](function(_0x13518d){_0x1ade06({'code':0xc8,'message':_0x13518d[_0xa7f9('0x19')]});})['catch'](function(_0x36c5bb){_0x74f5a6(_0x703db5[_0xa7f9('0x1a')](0x1f5,_0x36c5bb['message']));});});},'Command':function(_0x4badbb){var _0x9cb1c7=this;return new Promise(function(_0x50e783,_0x287733){if(ami[_0xa7f9('0x11')]()==![]){return _0x287733(_0x9cb1c7[_0xa7f9('0x1a')](0x1f4,[config[_0xa7f9('0x1b')]['ip'],config[_0xa7f9('0x1b')][_0xa7f9('0x12')],_0xa7f9('0x13')][_0xa7f9('0x14')]('\x20')));}_0x4badbb=_[_0xa7f9('0x15')](_0x4badbb,_0xa7f9('0x1c'));_0x4badbb[_0xa7f9('0x1d')]=_0xa7f9('0x1e');return ami[_0xa7f9('0x17')](_0x4badbb)[_0xa7f9('0x18')](function(_0x16fb74){_0x50e783({'code':0xc8,'message':_0x16fb74[_0xa7f9('0x1f')]});})[_0xa7f9('0x20')](function(_0x408082){_0x287733(_0x9cb1c7[_0xa7f9('0x1a')](0x1f5,_0x408082['message']));});});},'VoiceQueues':function(_0x477a45){return new Promise(function(_0x3bf220,_0x217827){var _0x659360=[];for(var _0x5b096d in _0x165548[_0xa7f9('0x21')]){if(_0x165548['voiceQueues'][_0xa7f9('0x22')](_0x5b096d)){var _0x426a87=_0x165548[_0xa7f9('0x21')][_0x5b096d];var _0x3aefb7={'id':_0x426a87['id'],'name':_0x426a87['name'],'strategy':_0x426a87[_0xa7f9('0x23')],'answered':_0x426a87['answered'],'available':_0x426a87['available'],'loggedIn':_0x426a87['loggedIn'],'pTalking':_0x426a87[_0xa7f9('0x24')],'sumBillable':_0x426a87[_0xa7f9('0x25')],'sumDuration':_0x426a87['sumDuration'],'sumHoldTime':_0x426a87[_0xa7f9('0x26')]||0x0,'talking':_0x426a87[_0xa7f9('0x27')],'total':_0x426a87[_0xa7f9('0x28')],'type':_0x426a87[_0xa7f9('0x29')],'unmanaged':_0x426a87[_0xa7f9('0x2a')],'abandoned':_0x426a87['abandoned'],'waiting':_0x426a87[_0xa7f9('0x2b')],'loggedInDb':_0x426a87[_0xa7f9('0x2c')]};if(_0x426a87['type']===_0xa7f9('0x2d')){_0x3aefb7['dialActive']=_0x426a87['dialActive'];_0x3aefb7[_0xa7f9('0x2e')]=_0x426a87[_0xa7f9('0x2e')];_0x3aefb7[_0xa7f9('0x2f')]=_0x426a87[_0xa7f9('0x2f')];_0x3aefb7[_0xa7f9('0x30')]=_0x426a87[_0xa7f9('0x30')];_0x3aefb7[_0xa7f9('0x31')]=_0x426a87['dialOriginateTimeout'];_0x3aefb7[_0xa7f9('0x32')]=_0x426a87[_0xa7f9('0x32')];_0x3aefb7[_0xa7f9('0x33')]=_0x426a87[_0xa7f9('0x33')];_0x3aefb7[_0xa7f9('0x34')]=_0x426a87[_0xa7f9('0x34')];_0x3aefb7['outboundAnswerCallsDay']=_0x426a87['outboundAnswerCallsDay'];_0x3aefb7[_0xa7f9('0x35')]=_0x426a87[_0xa7f9('0x35')];_0x3aefb7[_0xa7f9('0x36')]=_0x426a87[_0xa7f9('0x36')];_0x3aefb7[_0xa7f9('0x37')]=_0x426a87[_0xa7f9('0x37')];_0x3aefb7[_0xa7f9('0x38')]=_0x426a87[_0xa7f9('0x38')];_0x3aefb7['outboundDropCallsDayCallersExit']=_0x426a87[_0xa7f9('0x39')];_0x3aefb7[_0xa7f9('0x3a')]=_0x426a87['outboundDropCallsDayTimeout'];_0x3aefb7['outboundNoAnswerCallsDay']=_0x426a87[_0xa7f9('0x3b')];_0x3aefb7[_0xa7f9('0x3c')]=_0x426a87[_0xa7f9('0x3c')];_0x3aefb7[_0xa7f9('0x3d')]=_0x426a87[_0xa7f9('0x3d')];_0x3aefb7[_0xa7f9('0x3e')]=_0x426a87[_0xa7f9('0x3e')];_0x3aefb7[_0xa7f9('0x3f')]=_0x426a87[_0xa7f9('0x3f')];_0x3aefb7['outboundUnknownCallsDay']=_0x426a87[_0xa7f9('0x40')];_0x3aefb7[_0xa7f9('0x41')]=_0x426a87[_0xa7f9('0x41')];_0x3aefb7['predictiveIntervalAvgHoldtime']=_0x426a87[_0xa7f9('0x42')];_0x3aefb7['predictiveIntervalAvgTalktime']=_0x426a87['predictiveIntervalAvgTalktime'];_0x3aefb7[_0xa7f9('0x43')]=_0x426a87[_0xa7f9('0x43')];_0x3aefb7[_0xa7f9('0x44')]=_0x426a87[_0xa7f9('0x44')];_0x3aefb7[_0xa7f9('0x45')]=_0x426a87[_0xa7f9('0x45')];_0x3aefb7['predictiveIntervalErlangCallsDroppedCalls']=_0x426a87[_0xa7f9('0x46')];_0x3aefb7[_0xa7f9('0x47')]=_0x426a87[_0xa7f9('0x47')];_0x3aefb7[_0xa7f9('0x48')]=_0x426a87[_0xa7f9('0x48')];_0x3aefb7['predictiveIntervalPauses']=_0x426a87[_0xa7f9('0x49')];_0x3aefb7['predictiveIntervalAvailable']=_0x426a87['predictiveIntervalAvailable'];_0x3aefb7['predictiveIntervalTotalCalls']=_0x426a87[_0xa7f9('0x4a')];_0x3aefb7['message']=_0x426a87[_0xa7f9('0x19')];_0x3aefb7[_0xa7f9('0x4b')]=_0x426a87['originated'];_0x3aefb7[_0xa7f9('0x4c')]=_0x426a87[_0xa7f9('0x4c')];_0x3aefb7[_0xa7f9('0x4d')]=_0x426a87[_0xa7f9('0x4d')];_0x3aefb7[_0xa7f9('0x4e')]=_0x426a87['erlangAbandonmentRate'];_0x3aefb7[_0xa7f9('0x4f')]=_0x426a87['erlangBusyFactor'];_0x3aefb7[_0xa7f9('0x50')]=_0x426a87[_0xa7f9('0x50')];_0x3aefb7[_0xa7f9('0x51')]=_0x426a87['startProgressive'];}if(_0x426a87[_0xa7f9('0x52')]){_0x3aefb7[_0xa7f9('0x52')]={'id':_0x426a87['Trunk']['id'],'name':_0x426a87[_0xa7f9('0x52')][_0xa7f9('0x9')],'active':_0x426a87[_0xa7f9('0x52')][_0xa7f9('0x53')],'callerid':_0x426a87[_0xa7f9('0x52')][_0xa7f9('0x54')]};}if(_0x426a87['Interval']){_0x3aefb7[_0xa7f9('0x55')]={'id':_0x426a87[_0xa7f9('0x55')]['id'],'name':_0x426a87[_0xa7f9('0x55')]['name']};}_0x659360[_0xa7f9('0x56')](_0x3aefb7);}}_0x3bf220({'count':_0x659360['length'],'rows':_0x659360});});},'UpdateVoiceQueue':function(_0x5df0d4){return new Promise(function(_0x3b1a8b,_0x5e4350){var _0x37ffe9=_[_0xa7f9('0x57')](_0x165548[_0xa7f9('0x21')],{'id':parseInt(_0x5df0d4['id'])});var _0x5e9dcd=_[_0xa7f9('0x58')](_0x5df0d4,['id']);if(_0x37ffe9){for(var _0x90c28d in _0x5e9dcd){if(typeof _0x5e9dcd[_0x90c28d]!==_0xa7f9('0x59')&&typeof _0x37ffe9[_0x90c28d]!==_0xa7f9('0x59')){_0x37ffe9[_0x90c28d]=_0x5e9dcd[_0x90c28d];}}_0x3b1a8b(_0x37ffe9);}else{_0x5e4350();}});},'VoiceChannels':function(_0x453687){return new Promise(function(_0x3a8776,_0x5eea5e){var _0x308753=_['values'](_0x165548[_0xa7f9('0x5a')]);_0x3a8776({'count':_0x308753[_0xa7f9('0x5b')],'rows':_0x308753});});},'VoiceChannelMixMonitor':function(_0x36ad31){var _0x446d44=this;return new Promise(function(_0x1eefe2,_0x2cd467){if(ami[_0xa7f9('0x11')]()==![]){return _0x2cd467(_0x446d44[_0xa7f9('0x1a')](0x1f4,[config[_0xa7f9('0x1b')]['ip'],config[_0xa7f9('0x1b')][_0xa7f9('0x12')],_0xa7f9('0x13')][_0xa7f9('0x14')]('\x20')));}var _0x189e83=schema(properties[_0xa7f9('0x5c')])[_0xa7f9('0x5d')](_0x36ad31);if(_0x189e83[_0xa7f9('0x5b')]>0x0){return _0x2cd467(_0x446d44[_0xa7f9('0x1a')](0x1f4,_[_0xa7f9('0x5e')](_0x189e83,_0xa7f9('0x19'))[_0xa7f9('0x14')](',\x20')));}var _0x374d3d=_[_0xa7f9('0x57')](_0x165548[_0xa7f9('0x5a')],{'uniqueid':_0x36ad31[_0xa7f9('0x5f')]});if(_0x374d3d&&_0x374d3d[_0xa7f9('0x60')]){var _0x3f9cdf=util['format']('%s.%s',_0x36ad31[_0xa7f9('0x61')]||_0x36ad31['uniqueid'],_0x36ad31['format']||'wav');return ami[_0xa7f9('0x17')]({'action':_0xa7f9('0x62'),'channel':_0x374d3d[_0xa7f9('0x60')],'file':_0x3f9cdf,'options':_0xa7f9('0x63')})['then'](function(_0x51d756){var _0xa82da=_[_0xa7f9('0x57')](_0x374d3d[_0xa7f9('0x64')],{'filename':_0xa7f9('0x65')+_0x3f9cdf[_0xa7f9('0x66')]()});if(_['isNil'](_0xa82da)){_0x374d3d[_0xa7f9('0x64')]['push']({'filename':'/var/spool/asterisk/monitor/'+_0x3f9cdf['toLowerCase'](),'createdAt':moment()[_0xa7f9('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x51d756[_0xa7f9('0x67')],'status':_0xa7f9('0x68')});}else{_0xa82da[_0xa7f9('0x67')]=_0x51d756[_0xa7f9('0x67')];_0xa82da[_0xa7f9('0x69')]=_0xa7f9('0x68');}_0x1eefe2({'code':0xc8,'message':[_0x36ad31[_0xa7f9('0x5f')],'MixMonitor\x20Success',_0x51d756['mixmonitorid']][_0xa7f9('0x14')]('\x20'),'mixmonitorid':_0x51d756['mixmonitorid']});})[_0xa7f9('0x20')](function(_0x34ec8b){_0x2cd467(_0x446d44[_0xa7f9('0x1a')](0x1f5,[_0x36ad31[_0xa7f9('0x5f')],_0x34ec8b[_0xa7f9('0x19')][_0xa7f9('0x66')]()][_0xa7f9('0x14')]('\x20')));});}else{return _0x2cd467(_0x446d44[_0xa7f9('0x1a')](0x1f5,_0xa7f9('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x12fbd7){var _0xdbebe=this;return new Promise(function(_0x122a81,_0x205094){if(ami[_0xa7f9('0x11')]()==![]){return _0x205094(_0xdbebe[_0xa7f9('0x1a')](0x1f4,[config[_0xa7f9('0x1b')]['ip'],config[_0xa7f9('0x1b')][_0xa7f9('0x12')],_0xa7f9('0x13')][_0xa7f9('0x14')]('\x20')));}var _0xe32456=schema(properties[_0xa7f9('0x5c')])['validate'](_0x12fbd7);if(_0xe32456[_0xa7f9('0x5b')]>0x0){return _0x205094(_0xdbebe[_0xa7f9('0x1a')](0x1f4,_[_0xa7f9('0x5e')](_0xe32456,_0xa7f9('0x19'))[_0xa7f9('0x14')](',\x20')));}var _0xbd5375=_[_0xa7f9('0x57')](_0x165548['channels'],{'uniqueid':_0x12fbd7['uniqueid']});if(_0xbd5375){return BPromise[_0xa7f9('0x6b')]()['then'](function(){if(_0xbd5375[_0xa7f9('0x60')]){return ami[_0xa7f9('0x17')]({'action':'StopMixMonitor','channel':_0xbd5375[_0xa7f9('0x60')],'mixmonitorid':_0x12fbd7['mixmonitorid']})[_0xa7f9('0x20')](function(_0x216b8c){});}})['then'](function(){if(_0xbd5375[_0xa7f9('0x6c')]){return ami[_0xa7f9('0x17')]({'action':_0xa7f9('0x6d'),'channel':_0xbd5375[_0xa7f9('0x6c')],'mixmonitorid':_0x12fbd7[_0xa7f9('0x67')]})[_0xa7f9('0x20')](function(_0x6bff92){});}})[_0xa7f9('0x18')](function(_0xea6220){var _0x1800cd=_[_0xa7f9('0x57')](_0xbd5375['monitors'],{'mixmonitorid':_0x12fbd7['mixmonitorid']});if(_0x1800cd){_0x1800cd['status']=_0xa7f9('0x6e');}})[_0xa7f9('0x18')](function(){var _0x44fc4b=util[_0xa7f9('0x7')](_0xa7f9('0x6f'),_0x12fbd7['filename']||_0x12fbd7[_0xa7f9('0x5f')],_0x12fbd7[_0xa7f9('0x7')]||_0xa7f9('0x70'));var _0x260f75=_['find'](_0xbd5375[_0xa7f9('0x64')],{'filename':_0xa7f9('0x65')+_0x44fc4b[_0xa7f9('0x66')]()});if(_0x260f75){_0x260f75[_0xa7f9('0x69')]='stop';}})[_0xa7f9('0x18')](function(){_0x122a81({'code':0xc8,'message':[_0x12fbd7[_0xa7f9('0x5f')],_0xa7f9('0x71')][_0xa7f9('0x14')]('\x20')});})[_0xa7f9('0x20')](function(_0x2047e1){_0x205094(_0xdbebe[_0xa7f9('0x1a')](0x1f5,[_0x12fbd7[_0xa7f9('0x5f')],_0x2047e1['message'][_0xa7f9('0x66')]()]['join']('\x20')));});}else{return _0x205094(_0xdbebe[_0xa7f9('0x1a')](0x1f5,_0xa7f9('0x6a')));}});},'VoiceQueuesChannels':function(_0x9dec66){return new Promise(function(_0x91a889,_0xc9781c){var _0x5e1949=_[_0xa7f9('0x72')](_0x165548[_0xa7f9('0x73')]);_0x91a889({'count':_0x5e1949[_0xa7f9('0x5b')],'rows':_0x5e1949});});},'VoiceQueuesChannel':function(_0x3c3de6){var _0x4f0096=this;return new Promise(function(_0x1205f1,_0x48f28b){var _0x37d864=schema(properties['voicequeuechannel'])[_0xa7f9('0x5d')](_0x3c3de6);if(_0x37d864[_0xa7f9('0x5b')]>0x0){return _0x48f28b(_0x4f0096['error'](0x1f4,_[_0xa7f9('0x5e')](_0x37d864,'message')[_0xa7f9('0x14')](',\x20')));}var _0x964e79=_[_0xa7f9('0x57')](_0x165548[_0xa7f9('0x73')],{'uniqueid':_0x3c3de6[_0xa7f9('0x5f')]});if(_0x964e79){_0x1205f1(_0x964e79);}else{return _0x48f28b(_0x4f0096[_0xa7f9('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x5efc3c){var _0xa70d08=this;return new Promise(function(_0x449c93,_0x44f1b5){if(ami[_0xa7f9('0x11')]()==![]){return _0x44f1b5(_0xa70d08[_0xa7f9('0x1a')](0x1f4,[config[_0xa7f9('0x1b')]['ip'],config[_0xa7f9('0x1b')][_0xa7f9('0x12')],_0xa7f9('0x13')][_0xa7f9('0x14')]('\x20')));}var _0x24ebf4=schema(properties[_0xa7f9('0x74')])[_0xa7f9('0x5d')](_0x5efc3c);if(_0x24ebf4[_0xa7f9('0x5b')]>0x0){return _0x44f1b5(_0xa70d08[_0xa7f9('0x1a')](0x1f4,_[_0xa7f9('0x5e')](_0x24ebf4,_0xa7f9('0x19'))[_0xa7f9('0x14')](',\x20')));}var _0x136654=_[_0xa7f9('0x57')](_0x165548[_0xa7f9('0x73')],{'uniqueid':_0x5efc3c[_0xa7f9('0x5f')]});if(_0x136654&&_0x136654[_0xa7f9('0x60')]){return ami[_0xa7f9('0x17')]({'action':'Hangup','channel':_0x136654['channel']})[_0xa7f9('0x18')](function(_0x378131){_0x449c93({'code':0xc8,'message':[_0x5efc3c[_0xa7f9('0x5f')],_0x378131[_0xa7f9('0x19')][_0xa7f9('0x66')]()][_0xa7f9('0x14')]('\x20')});})[_0xa7f9('0x20')](function(_0xc79ee2){_0x44f1b5(_0xa70d08[_0xa7f9('0x1a')](0x1f5,[_0x5efc3c[_0xa7f9('0x5f')],_0xc79ee2[_0xa7f9('0x19')][_0xa7f9('0x66')]()]['join']('\x20')));});}else{return _0x44f1b5(_0xa70d08[_0xa7f9('0x1a')](0x1f5,_0xa7f9('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x3241eb){var _0x10d32a=this;return new Promise(function(_0x2c4b09,_0x47f4fc){if(ami[_0xa7f9('0x11')]()==![]){return _0x47f4fc(_0x10d32a[_0xa7f9('0x1a')](0x1f4,[config[_0xa7f9('0x1b')]['ip'],config['asterisk'][_0xa7f9('0x12')],_0xa7f9('0x13')][_0xa7f9('0x14')]('\x20')));}var _0x3e35fc=schema(properties[_0xa7f9('0x75')])['validate'](_0x3241eb);if(_0x3e35fc[_0xa7f9('0x5b')]>0x0){return _0x47f4fc(_0x10d32a[_0xa7f9('0x1a')](0x1f4,_['map'](_0x3e35fc,_0xa7f9('0x19'))[_0xa7f9('0x14')](',\x20')));}var _0xc8e0c6=_[_0xa7f9('0x57')](_0x165548[_0xa7f9('0x73')],{'uniqueid':_0x3241eb['uniqueid']});if(_0xc8e0c6&&_0xc8e0c6[_0xa7f9('0x60')]){return ami[_0xa7f9('0x17')]({'action':_0xa7f9('0x76'),'channel':_0xc8e0c6['channel'],'exten':_0x3241eb[_0xa7f9('0x77')],'context':_0x3241eb['context']||_0xc8e0c6[_0xa7f9('0x78')],'priority':0x1})['then'](function(_0x371349){_0x2c4b09({'code':0xc8,'message':[_0x3241eb[_0xa7f9('0x5f')],_0x371349[_0xa7f9('0x19')][_0xa7f9('0x66')]()][_0xa7f9('0x14')]('\x20')});})['catch'](function(_0x34dab3){_0x47f4fc(_0x10d32a['error'](0x1f5,[_0x3241eb[_0xa7f9('0x5f')],_0x34dab3['message']['toLowerCase']()][_0xa7f9('0x14')]('\x20')));});}else{return _0x47f4fc(_0x10d32a['error'](0x1f5,_0xa7f9('0x6a')));}});},'Agents':function(_0x25ec00){return new Promise(function(_0x2124cd,_0x12ad17){var _0x4f13e8=_[_0xa7f9('0x72')](_0x165548['agents']);_0x2124cd({'count':_0x4f13e8[_0xa7f9('0x5b')],'rows':_0x4f13e8});});},'Telephones':function(_0x59f605){return new Promise(function(_0x3cd3d6,_0x6af8b0){var _0x320f11=_[_0xa7f9('0x72')](_0x165548[_0xa7f9('0x79')]);_0x3cd3d6({'count':_0x320f11['length'],'rows':_0x320f11});});},'Trunks':function(_0x165690){return new Promise(function(_0x4182cf,_0x4ee622){var _0x3145e5=_[_0xa7f9('0x72')](_0x165548[_0xa7f9('0x7a')]);_0x4182cf({'count':_0x3145e5[_0xa7f9('0x5b')],'rows':_0x3145e5});});},'OutboundChannels':function(_0x41adb6){return new Promise(function(_0x4e7ba0,_0x471204){var _0x564052=_[_0xa7f9('0x72')](_0x165548[_0xa7f9('0x7b')]);_0x4e7ba0({'count':_0x564052[_0xa7f9('0x5b')],'rows':_0x564052});});},'Outbound':function(_0x3cd3d5){return new Promise(function(_0x2a92a0,_0x822bf9){_0x2a92a0(_0x165548[_0xa7f9('0x2d')]);});},'Campaigns':function(_0x3d700b){return new Promise(function(_0x562b1c,_0xd58709){var _0x11aba5=_['values'](_0x165548[_0xa7f9('0x7c')]);_0x562b1c({'count':_0x11aba5[_0xa7f9('0x5b')],'rows':_0x11aba5});});},'VoiceQueuesPreview':function(_0xe39e6b){var _0x152d10=this;return new Promise(function(_0x1b2cdd,_0x3e1378){_0x686532[_0xa7f9('0x7d')](_0xe39e6b['id'])[_0xa7f9('0x18')](function(_0x18ff7f){_0x1b2cdd({'code':0xc8,'message':_0x18ff7f[_0xa7f9('0x19')]});})['catch'](function(_0xff906b){_0x3e1378(_0x152d10[_0xa7f9('0x1a')](0x1f4,_0xff906b['message']));});});},'EventManager':function(_0x548e7e){var _0x107c54=this;return new Promise(function(_0x31c3e2,_0x2b858d){if(!_0x548e7e[_0xa7f9('0x7e')]){return _0x2b858d(_0x107c54[_0xa7f9('0x1a')](0x1f4,_0xa7f9('0x7f')));}ami['emit'](_0xa7f9('0x80')+_0x548e7e[_0xa7f9('0x7e')],_0x548e7e[_0xa7f9('0x19')]);_0x31c3e2({'code':0xc8,'message':_0x548e7e});});},'FaxAccounts':function(_0x16b697){return new Promise(function(_0x5bbd67,_0x3ba5da){var _0x571d45=_[_0xa7f9('0x72')](_0x165548['faxAccounts']);_0x5bbd67({'count':_0x571d45[_0xa7f9('0x5b')],'rows':_0x571d45});});},'SendFax':function(_0x3ee922){var _0x266694=this;return new Promise(function(_0x108a45,_0x4a20f9){_0x321487['send'](_0x3ee922)[_0xa7f9('0x18')](function(_0xba9ff5){_0x108a45({'code':0xc8,'message':_0xba9ff5[_0xa7f9('0x19')]});})['catch'](function(_0x3532c6){_0x4a20f9(_0x266694['error'](0x1f4,_0x3532c6[_0xa7f9('0x19')]));});});},'CheckAfterSend':function(_0x57ee60){var _0x3ec232=this;return new Promise(function(_0x245afc,_0x2b532f){_0x321487[_0xa7f9('0x81')](_0x57ee60)['then'](function(_0x1c9539){_0x245afc({'code':0xc8,'message':_0x1c9539[_0xa7f9('0x19')]});})['catch'](function(_0x4f4e57){_0x2b532f(_0x3ec232[_0xa7f9('0x1a')](0x1f4,_0x4f4e57[_0xa7f9('0x19')]));});});}};var _0x3ce005=jayson['server'](_0x357628)[_0xa7f9('0x82')]();_0x3ce005['on'](_0xa7f9('0x1a'),function(_0x14eb6d){return _0x2b59c4(_0x14eb6d);});_0x3ce005[_0xa7f9('0x83')](0x232a,_0xa7f9('0x84'),function(){console[_0xa7f9('0x85')](_0xa7f9('0x86'),0x232a);return _0x38ce25(_0xa7f9('0x87')+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 39faf48..9b872bf 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 _0x6c3d=['updatedAt','union','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','data1','data2','xmd-contactid','ListId','data3','split','$or','destcalleridnum','calleridnum','firstName','phone','mobile','fax','scheduledAt'];(function(_0x5645f2,_0x4b4264){var _0x2854fc=function(_0x44963e){while(--_0x44963e){_0x5645f2['push'](_0x5645f2['shift']());}};_0x2854fc(++_0x4b4264);}(_0x6c3d,0x86));var _0xd6c3=function(_0x147505,_0x1ca5ed){_0x147505=_0x147505-0x0;var _0xa49e96=_0x6c3d[_0x147505];return _0xa49e96;};'use strict';var _=require(_0xd6c3('0x0'));var BPromise=require(_0xd6c3('0x1'));var Redis=require(_0xd6c3('0x2'));var util=require(_0xd6c3('0x3'));var config=require(_0xd6c3('0x4'));var logger=require(_0xd6c3('0x5'))('trigger');var cmContactRpc=require(_0xd6c3('0x6'));config[_0xd6c3('0x7')]=_[_0xd6c3('0x8')](config[_0xd6c3('0x7')],{'host':_0xd6c3('0x9'),'port':0x18eb});var io=require(_0xd6c3('0xa'))(new Redis(config[_0xd6c3('0x7')]));function emit(_0x3ba4ad,_0x2799a5,_0xa60a21,_0x13709c,_0x176674){logger[_0xd6c3('0xb')](_0xd6c3('0xc'),_0x3ba4ad,_0x2799a5['id'],_0xa60a21,_0x13709c,JSON[_0xd6c3('0xd')](_0x176674));io['to'](_0xa60a21)['emit'](_0x13709c,_0x176674);}exports['exec']=function(_0x3bce23,_0x464445,_0x12695d,_0x721522){var _0x21024e,_0x29a591;var _0x2fcef0={};var _0x3757e4=Number(_0x12695d[_0xd6c3('0xe')]);var _0x25462c=_0x12695d[_0xd6c3('0xf')]?Boolean(Number(_0x12695d['data2'])):![];var _0x1fb4a9;if(_0x721522[_0xd6c3('0x10')]){_0x2fcef0['id']=_0x721522[_0xd6c3('0x10')];}if(!_0x2fcef0['id']){_0x2fcef0[_0xd6c3('0x11')]=_0x3757e4;_0x1fb4a9=_0x12695d[_0xd6c3('0x12')]&&_0x12695d[_0xd6c3('0x12')]!=='0'?_0x12695d[_0xd6c3('0x12')][_0xd6c3('0x13')](','):['phone'];_0x2fcef0[_0xd6c3('0x14')]=_['map'](_0x1fb4a9,function(_0x2ca96f){var _0x9bc867={};_0x9bc867[_0x2ca96f]=_0x721522['routeId']?_0x721522[_0xd6c3('0x15')]:_0x721522[_0xd6c3('0x16')];return _0x9bc867;});}var _0x48d075=['id',_0xd6c3('0x17'),'lastName',_0xd6c3('0x18'),_0xd6c3('0x19'),_0xd6c3('0x1a'),'ListId','createdAt',_0xd6c3('0x1b'),_0xd6c3('0x1c')];var _0x247e2c=_[_0xd6c3('0x1d')](_0x48d075,_0x1fb4a9);BPromise['resolve']()[_0xd6c3('0x1e')](cmContactRpc[_0xd6c3('0x1f')]({'attributes':_0x247e2c,'where':_0x2fcef0}))[_0xd6c3('0x1e')](function(_0x81f16c){_0x29a591=_0x81f16c;if(!_['isEmpty'](_0x29a591)){if(_0x29a591['length']===0x1){_0x21024e=_0x29a591[0x0];logger['info'](_0xd6c3('0x20'),_0x721522['uniqueid'],_0x464445['id'],_0x21024e['id']);}else{logger[_0xd6c3('0xb')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x721522[_0xd6c3('0x21')],_0x464445['id'],_[_0xd6c3('0x22')](_0x29a591,'id')['join'](','));}return;}else{logger[_0xd6c3('0xb')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x721522[_0xd6c3('0x21')],_0x464445['id']);var _0x342326={'ListId':_0x3757e4};var _0x17563b=_0x12695d[_0xd6c3('0x23')]&&_0x12695d[_0xd6c3('0x23')]!=='0'?_0x12695d[_0xd6c3('0x23')]:_0xd6c3('0x18');if(_0x25462c){logger[_0xd6c3('0xb')](_0xd6c3('0x24'),_0x721522[_0xd6c3('0x21')],_0x464445['id']);_0x342326[_0x17563b]=_[_0xd6c3('0x25')](_0x721522[_0xd6c3('0x26')])?_0x721522[_0xd6c3('0x16')]:_0x721522[_0xd6c3('0x15')];if(_[_0xd6c3('0x25')](_0x721522[_0xd6c3('0x26')])){_0x342326[_0xd6c3('0x17')]=_0x721522[_0xd6c3('0x27')]&&_0x721522[_0xd6c3('0x27')]!==_0xd6c3('0x28')?_0x721522[_0xd6c3('0x27')]:_0xd6c3('0x29');}else{_0x342326['firstName']=_0x721522[_0xd6c3('0x2a')]&&_0x721522['destcalleridname']!==_0xd6c3('0x28')?_0x721522['destcalleridname']:_0xd6c3('0x29');}return BPromise[_0xd6c3('0x2b')]()[_0xd6c3('0x1e')](cmContactRpc[_0xd6c3('0x2c')](_0x342326))[_0xd6c3('0x1e')](function(_0x5a600b){_0x21024e=_0x5a600b;_0x29a591[_0xd6c3('0x2d')](_0x5a600b);if(_0x21024e){logger[_0xd6c3('0xb')](_0xd6c3('0x2e'),_0x721522[_0xd6c3('0x21')],_0x464445['id'],_0x21024e['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x721522['uniqueid'],_0x464445['id']);_0x342326[_0x17563b]=_[_0xd6c3('0x25')](_0x721522[_0xd6c3('0x26')])?_0x721522[_0xd6c3('0x16')]:_0x721522['destcalleridnum'];if(_[_0xd6c3('0x25')](_0x721522[_0xd6c3('0x26')])){_0x342326[_0xd6c3('0x17')]=_0x721522[_0xd6c3('0x27')]&&_0x721522[_0xd6c3('0x27')]!==_0xd6c3('0x28')?_0x721522[_0xd6c3('0x27')]:'Unknown';}else{_0x342326[_0xd6c3('0x17')]=_0x721522['destcalleridname']&&_0x721522[_0xd6c3('0x2a')]!==_0xd6c3('0x28')?_0x721522[_0xd6c3('0x2a')]:'Unknown';}_0x21024e=_0x342326;_0x29a591[_0xd6c3('0x2d')](_0x342326);return;}}})['then'](function(){if(_0x3bce23){emit(_0x721522['uniqueid'],_0x464445,util[_0xd6c3('0x2f')](_0xd6c3('0x30'),_0x3bce23[_0xd6c3('0x31')]),util['format'](_0xd6c3('0x32'),_0x12695d[_0xd6c3('0x33')]['toLowerCase']()),{'evt':_[_0xd6c3('0x34')](_0x721522,{'autoCreate':_0x25462c}),'contact':_0x21024e===undefined?{}:_0x21024e,'contacts':_0x29a591[_0xd6c3('0x35')]===0x0?undefined:_0x29a591});}});}; \ No newline at end of file +var _0x5da1=['[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data1','data2','xmd-contactid','data3','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','isNil','calleridname','destcalleridname','','Unknown','createContact','push'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0x5da1,0xad));var _0x15da=function(_0x4dc770,_0x362b51){_0x4dc770=_0x4dc770-0x0;var _0x4ccc4d=_0x5da1[_0x4dc770];return _0x4ccc4d;};'use strict';var _=require(_0x15da('0x0'));var BPromise=require(_0x15da('0x1'));var Redis=require(_0x15da('0x2'));var util=require(_0x15da('0x3'));var config=require(_0x15da('0x4'));var logger=require(_0x15da('0x5'))('trigger');var cmContactRpc=require(_0x15da('0x6'));config[_0x15da('0x7')]=_[_0x15da('0x8')](config[_0x15da('0x7')],{'host':_0x15da('0x9'),'port':0x18eb});var io=require(_0x15da('0xa'))(new Redis(config[_0x15da('0x7')]));function emit(_0x4a6bb1,_0x5d8edc,_0x319b6f,_0x10b5a5,_0x2f1136){logger[_0x15da('0xb')]('[CM][%s][%s]',_0x4a6bb1,_0x5d8edc['id'],_0x319b6f,_0x10b5a5,JSON[_0x15da('0xc')](_0x2f1136));io['to'](_0x319b6f)[_0x15da('0xd')](_0x10b5a5,_0x2f1136);}exports[_0x15da('0xe')]=function(_0x358b6f,_0x4a1aa0,_0x294f79,_0x250088){var _0xba6dd2,_0x39623e;var _0x37e1a4={};var _0x234352=Number(_0x294f79[_0x15da('0xf')]);var _0x259037=_0x294f79['data2']?Boolean(Number(_0x294f79[_0x15da('0x10')])):![];var _0x5721da;if(_0x250088[_0x15da('0x11')]){_0x37e1a4['id']=_0x250088['xmd-contactid'];}if(!_0x37e1a4['id']){_0x37e1a4['ListId']=_0x234352;_0x5721da=_0x294f79['data3']&&_0x294f79[_0x15da('0x12')]!=='0'?_0x294f79[_0x15da('0x12')]['split'](','):['phone'];_0x37e1a4[_0x15da('0x13')]=_[_0x15da('0x14')](_0x5721da,function(_0x26a093){var _0x22fd1f={};_0x22fd1f[_0x26a093]=_0x250088[_0x15da('0x15')]?_0x250088[_0x15da('0x16')]:_0x250088[_0x15da('0x17')];return _0x22fd1f;});}var _0x51ea13=['id',_0x15da('0x18'),_0x15da('0x19'),'phone',_0x15da('0x1a'),_0x15da('0x1b'),_0x15da('0x1c'),_0x15da('0x1d'),_0x15da('0x1e'),'updatedAt'];var _0x416311=_[_0x15da('0x1f')](_0x51ea13,_0x5721da);BPromise[_0x15da('0x20')]()['then'](cmContactRpc[_0x15da('0x21')]({'attributes':_0x416311,'where':_0x37e1a4}))[_0x15da('0x22')](function(_0xb83256){_0x39623e=_0xb83256;if(!_[_0x15da('0x23')](_0x39623e)){if(_0x39623e[_0x15da('0x24')]===0x1){_0xba6dd2=_0x39623e[0x0];logger['info'](_0x15da('0x25'),_0x250088[_0x15da('0x26')],_0x4a1aa0['id'],_0xba6dd2['id']);}else{logger[_0x15da('0xb')](_0x15da('0x27'),_0x250088['uniqueid'],_0x4a1aa0['id'],_[_0x15da('0x14')](_0x39623e,'id')[_0x15da('0x28')](','));}return;}else{logger[_0x15da('0xb')](_0x15da('0x29'),_0x250088[_0x15da('0x26')],_0x4a1aa0['id']);var _0x5ca123={'ListId':_0x234352};var _0x5a4ae1=_0x294f79[_0x15da('0x2a')]&&_0x294f79[_0x15da('0x2a')]!=='0'?_0x294f79[_0x15da('0x2a')]:_0x15da('0x2b');if(_0x259037){logger[_0x15da('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x250088[_0x15da('0x26')],_0x4a1aa0['id']);_0x5ca123[_0x5a4ae1]=_[_0x15da('0x2c')](_0x250088[_0x15da('0x15')])?_0x250088['calleridnum']:_0x250088[_0x15da('0x16')];if(_[_0x15da('0x2c')](_0x250088[_0x15da('0x15')])){_0x5ca123[_0x15da('0x18')]=_0x250088[_0x15da('0x2d')]&&_0x250088[_0x15da('0x2d')]!==''?_0x250088['calleridname']:'Unknown';}else{_0x5ca123['firstName']=_0x250088[_0x15da('0x2e')]&&_0x250088[_0x15da('0x2e')]!==_0x15da('0x2f')?_0x250088['destcalleridname']:_0x15da('0x30');}return BPromise[_0x15da('0x20')]()[_0x15da('0x22')](cmContactRpc[_0x15da('0x31')](_0x5ca123))['then'](function(_0x3fb791){_0xba6dd2=_0x3fb791;_0x39623e[_0x15da('0x32')](_0x3fb791);if(_0xba6dd2){logger[_0x15da('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x250088[_0x15da('0x26')],_0x4a1aa0['id'],_0xba6dd2['id']);}return;});}else{logger[_0x15da('0xb')](_0x15da('0x33'),_0x250088[_0x15da('0x26')],_0x4a1aa0['id']);_0x5ca123[_0x5a4ae1]=_[_0x15da('0x2c')](_0x250088[_0x15da('0x15')])?_0x250088['calleridnum']:_0x250088[_0x15da('0x16')];if(_[_0x15da('0x2c')](_0x250088[_0x15da('0x15')])){_0x5ca123[_0x15da('0x18')]=_0x250088[_0x15da('0x2d')]&&_0x250088[_0x15da('0x2d')]!==_0x15da('0x2f')?_0x250088[_0x15da('0x2d')]:_0x15da('0x30');}else{_0x5ca123['firstName']=_0x250088[_0x15da('0x2e')]&&_0x250088[_0x15da('0x2e')]!==''?_0x250088[_0x15da('0x2e')]:_0x15da('0x30');}_0xba6dd2=_0x5ca123;_0x39623e['push'](_0x5ca123);return;}}})[_0x15da('0x22')](function(){if(_0x358b6f){emit(_0x250088['uniqueid'],_0x4a1aa0,util[_0x15da('0x34')]('user:%s',_0x358b6f[_0x15da('0x35')]),util[_0x15da('0x34')]('trigger:%s',_0x294f79[_0x15da('0x36')][_0x15da('0x37')]()),{'evt':_['merge'](_0x250088,{'autoCreate':_0x259037}),'contact':_0xba6dd2===undefined?{}:_0xba6dd2,'contacts':_0x39623e[_0x15da('0x24')]===0x0?undefined:_0x39623e});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 40c4ea2..8b8b519 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 _0xe1f7=['value','upperFirst','AccountId','message','event','agent','membername','lastevent','routeId','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentreject','custom:amd','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','isNil','data3','data4','location','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','integration','voiceQueues','queue','urlforward','buildUri','parse','query','search','AllConditions','length','AnyConditions','some','checkConditions','channel','field','account','chat','ChatWebsiteId','operator'];(function(_0x22e9d8,_0x3c26c2){var _0x93f1a2=function(_0xb6617){while(--_0xb6617){_0x22e9d8['push'](_0x22e9d8['shift']());}};_0x93f1a2(++_0x3c26c2);}(_0xe1f7,0x172));var _0x7e1f=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xe1f7[_0xe66cf2];return _0x2d84e7;};'use strict';var util=require(_0x7e1f('0x0'));var _=require(_0x7e1f('0x1'));var url=require(_0x7e1f('0x2'));var Mustache=require(_0x7e1f('0x3'));var Redis=require(_0x7e1f('0x4'));var urlforward=require(_0x7e1f('0x5'));var integration=require(_0x7e1f('0x6'));var cmContact=require(_0x7e1f('0x7'));var script=require(_0x7e1f('0x8'));var config=require(_0x7e1f('0x9'));var logger=require(_0x7e1f('0xa'))(_0x7e1f('0xb'));var ami=require('../ami');config[_0x7e1f('0xc')]=_['defaults'](config[_0x7e1f('0xc')],{'host':_0x7e1f('0xd'),'port':0x18eb});var io=require(_0x7e1f('0xe'))(new Redis(config[_0x7e1f('0xc')]));var operators={'equals':function(_0x26946,_0x4c12bc){return _0x26946==_0x4c12bc;},'not_equals':function(_0x3f0ebd,_0x363e0f){return _0x3f0ebd!=_0x363e0f;}};var barAndWebActions=[_0x7e1f('0xf'),'url',_0x7e1f('0x10')];function Trigger(_0x51e473){this[_0x7e1f('0x11')]=_0x51e473[_0x7e1f('0x11')];this[_0x7e1f('0x12')]=_0x51e473[_0x7e1f('0x12')];this['voiceQueues']=_0x51e473['voiceQueues'];this[_0x7e1f('0x13')]=_0x51e473[_0x7e1f('0x13')];this[_0x7e1f('0x14')]=_0x51e473[_0x7e1f('0x14')];this[_0x7e1f('0x15')]=_0x51e473['zendeskAccounts'];this[_0x7e1f('0x16')]=_0x51e473[_0x7e1f('0x16')];this[_0x7e1f('0x17')]=_0x51e473[_0x7e1f('0x17')];this[_0x7e1f('0x18')]=_0x51e473['sugarcrmAccounts'];this['zohoAccounts']=_0x51e473[_0x7e1f('0x19')];this['deskAccounts']=_0x51e473[_0x7e1f('0x1a')];this[_0x7e1f('0x1b')]=_0x51e473[_0x7e1f('0x1b')];this[_0x7e1f('0x1c')]=_0x51e473['servicenowAccounts'];this[_0x7e1f('0x1d')]=_0x51e473[_0x7e1f('0x1d')];this[_0x7e1f('0x1e')]=_0x51e473[_0x7e1f('0x1e')];this[_0x7e1f('0x1f')]={'zendesk':this[_0x7e1f('0x15')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x7e1f('0x19')],'desk':this[_0x7e1f('0x1a')],'vtiger':this[_0x7e1f('0x1b')],'dynamics365':this[_0x7e1f('0x1d')],'freshsales':this[_0x7e1f('0x1e')],'servicenow':this[_0x7e1f('0x1c')]};ami['on'](_0x7e1f('0x20'),this['syncCustomEvent'][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x22'),this[_0x7e1f('0x23')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0x7e1f('0x23')][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x24'),this[_0x7e1f('0x23')][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x25'),this['syncCustomEvent'][_0x7e1f('0x21')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0x7e1f('0x21')](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0x7e1f('0x21')](this));ami['on']('custom:agentcongestion',this[_0x7e1f('0x23')][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x26'),this['syncCustomEvent'][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x27'),this[_0x7e1f('0x23')][_0x7e1f('0x21')](this));ami['on']('custom:queuecallerabandon',this[_0x7e1f('0x23')][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x28'),this[_0x7e1f('0x23')][_0x7e1f('0x21')](this));ami['on']('custom:dialbegin',this[_0x7e1f('0x29')][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x2a'),this[_0x7e1f('0x29')][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x2b'),this[_0x7e1f('0x29')][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x2c'),this['syncCustomEvent'][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x2d'),this[_0x7e1f('0x23')]['bind'](this));ami['on'](_0x7e1f('0x2e'),this[_0x7e1f('0x23')][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x2f'),this[_0x7e1f('0x23')][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x30'),this[_0x7e1f('0x23')][_0x7e1f('0x21')](this));ami['on'](_0x7e1f('0x31'),this[_0x7e1f('0x23')][_0x7e1f('0x21')](this));}Trigger[_0x7e1f('0x32')][_0x7e1f('0x33')]=function(_0xa976c2,_0xec026b,_0x41e9e9){logger[_0x7e1f('0x34')](_0xa976c2,_0xec026b,JSON[_0x7e1f('0x35')](_0x41e9e9));io['to'](_0xa976c2)['emit'](_0xec026b,_0x41e9e9);};Trigger['prototype']['syncCustomEvent']=function(_0x5979e0){var _0x5070e3=_[_0x7e1f('0x36')](_0x5979e0);this[_0x7e1f('0x37')](_0x5070e3);};Trigger[_0x7e1f('0x32')][_0x7e1f('0x29')]=function(_0x361408){if(this[_0x7e1f('0x12')][_0x361408[_0x7e1f('0x38')]]){this['syncCustomEvent'](_0x361408);}};Trigger['prototype'][_0x7e1f('0x37')]=function(_0x258783){var _0x4d8cd0;for(var _0x73713d in this[_0x7e1f('0x11')]){if(this[_0x7e1f('0x11')][_0x7e1f('0x39')](_0x73713d)){if(this[_0x7e1f('0x11')][_0x73713d][_0x7e1f('0x3a')]){_0x4d8cd0=this[_0x7e1f('0x3b')](this['triggers'][_0x73713d],_0x258783);if(_0x4d8cd0){_[_0x7e1f('0x3c')](_0x258783,_0x258783[_0x7e1f('0x3d')]);for(var _0x4935ee=0x0,_0x239f29,_0x5dca7d,_0x14d306;_0x4935ee0x0){_0x57c407=_[_0xfd5d('0x2d')](_0x1ad2db,_0x6a2dc7);}return _0x57c407;}function getCustomFields(_0xb44a9e,_0x36ad0e){var _0xaead7e=[];var _0xa86d9b={'custom_fields':{}};if(_0xb44a9e[_0xfd5d('0x2c')]>0x0){_[_0xfd5d('0x2e')](_0xb44a9e,function(_0x5cf76c){if(_[_0xfd5d('0x2f')](['string',_0xfd5d('0x30')],_0x5cf76c[_0xfd5d('0x31')])&&_0x5cf76c[_0xfd5d('0x32')]&&!_0x5cf76c['customField']){_0xa86d9b[_0x5cf76c[_0xfd5d('0x32')]['toLowerCase']()]=_0x5cf76c[_0xfd5d('0x33')][_0xfd5d('0x24')]();}else if(_[_0xfd5d('0x2f')]([_0xfd5d('0x34'),_0xfd5d('0x30')],_0x5cf76c[_0xfd5d('0x31')])&&_0x5cf76c[_0xfd5d('0x35')]&&_0x5cf76c['customField']){_0xa86d9b[_0xfd5d('0x36')][_0x5cf76c[_0xfd5d('0x35')]]=_0x5cf76c['content'][_0xfd5d('0x24')]();}else if(_0x5cf76c[_0xfd5d('0x31')]===_0xfd5d('0x37')&&_0x5cf76c[_0xfd5d('0x38')]&&_0x5cf76c['idField']&&_0x5cf76c[_0xfd5d('0x39')]){_0x36ad0e[_0x5cf76c[_0xfd5d('0x38')]]&&(_0xa86d9b['custom_fields'][_0x5cf76c[_0xfd5d('0x35')]]=_0x36ad0e[_0x5cf76c[_0xfd5d('0x38')]]['toString']());}else if(_0x5cf76c[_0xfd5d('0x31')]===_0xfd5d('0x3a')&&_0x5cf76c[_0xfd5d('0x3b')]&&_0x5cf76c[_0xfd5d('0x3b')][_0xfd5d('0x3c')]&&_0x5cf76c[_0xfd5d('0x35')]&&_0x5cf76c[_0xfd5d('0x39')]){_0x36ad0e[_0x5cf76c[_0xfd5d('0x3b')][_0xfd5d('0x3c')]['toLowerCase']()]&&(_0xa86d9b['custom_fields'][_0x5cf76c[_0xfd5d('0x35')]]=_0x36ad0e[_0x5cf76c['Variable']['name'][_0xfd5d('0x3d')]()]['toString']());}});}if(_0xa86d9b[_0xfd5d('0x3e')]){_0xa86d9b['priority']=Number(_0xa86d9b[_0xfd5d('0x3e')]);}return _0xa86d9b;}function getTicket(_0x585bfa,_0x312714,_0x2b3a61,_0xb759f6,_0x4b9d44){logger[_0xfd5d('0x12')](_0xfd5d('0x3f'));var _0x29e6d7=_[_0xfd5d('0x40')]({'subject':intUtil[_0xfd5d('0x41')](_0xb759f6[_0xfd5d('0x42')],_0x4b9d44,'\x20'),'type':'phone','status':_0xfd5d('0x43'),'labels':['xCALLY',_0xfd5d('0x44'),_0xfd5d('0x45')][_0xfd5d('0x46')](getTags(_0xb759f6[_0xfd5d('0x47')],_0xfd5d('0x3c'))),'description':intUtil[_0xfd5d('0x41')](_0xb759f6[_0xfd5d('0x48')],_0x4b9d44,'\x0a'),'_links':{'assigned_user':{'href':util[_0xfd5d('0x1d')](_0xfd5d('0x49'),_0x312714['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0xfd5d('0x41')](_0xb759f6['Descriptions'],_0x4b9d44,'\x0a')}},getCustomFields(_0xb759f6[_0xfd5d('0x4a')],_0x4b9d44));return request({'uri':util[_0xfd5d('0x1d')](_0xfd5d('0x4b'),_0x585bfa[_0xfd5d('0x14')],_0x2b3a61['id']),'method':_0xfd5d('0x4c'),'body':_0x29e6d7});}exports[_0xfd5d('0x4d')]=function(_0x5bba0e,_0x170b3c,_0x34204e,_0x49a88e,_0x3ba3c4,_0x328051){var _0x3da20c,_0x486325;_0x328051[_0xfd5d('0x14')]=intUtil[_0xfd5d('0x4e')](_0x328051[_0xfd5d('0x14')]);_0x328051[_0xfd5d('0x4f')]=intUtil['stripTrailingSlash'](_0x328051[_0xfd5d('0x4f')]);if(_0x3ba3c4&&_0x3ba3c4[_0xfd5d('0x50')]){logger['info']('[QUEUE]',_0xfd5d('0x51'));_0x170b3c['recordingURL']=util[_0xfd5d('0x1d')](_0xfd5d('0x52'),_0x328051[_0xfd5d('0x4f')],_0x170b3c['uniqueid'],md5(_0x170b3c['uniqueid']));}else{_0x170b3c[_0xfd5d('0x53')]='';}headers[_0xfd5d('0x54')]=getAuth(_0x328051);return getUser(_0x328051,_0x49a88e[_0xfd5d('0x55')])['then'](function(_0x4bd5a9){_0x3da20c=_0x4bd5a9;logger[_0xfd5d('0x12')](_0xfd5d('0x56'),_0x3da20c['id']);return getEndUser(_0x328051,_0x170b3c['calleridname'],_0x170b3c['calleridnum']);})['then'](function(_0x3fd0a9){_0x486325=_0x3fd0a9;logger[_0xfd5d('0x12')](_0xfd5d('0x57'),_0x486325['id']);return getTicket(_0x328051,_0x3da20c,_0x486325,_0x34204e,_0x170b3c);})[_0xfd5d('0xe')](function(_0xc84653){if(_0xc84653){logger[_0xfd5d('0x12')](_0xfd5d('0x58'));logger[_0xfd5d('0x12')](_0xfd5d('0x59'),_0xc84653['id']);switch(_0x328051['type']){case _0xfd5d('0x5a'):logger['info'](_0xfd5d('0x5b'),_0xfd5d('0x5c'));emit(util[_0xfd5d('0x1d')]('user:%s',_0x49a88e[_0xfd5d('0x3c')]),_0xfd5d('0x5d'),{'recordId':_0xc84653['id']});break;case _0xfd5d('0x5e'):logger[_0xfd5d('0x12')](_0xfd5d('0x5b'),_0xfd5d('0x5f'));emit(util['format'](_0xfd5d('0x60'),_0x49a88e['name']),_0xfd5d('0x61'),{'uri':util[_0xfd5d('0x1d')](_0xfd5d('0x62'),_0xc84653['id'])});break;default:logger['error']('[QUEUE]',_0xfd5d('0x63'));}}})['catch'](function(_0x42b74d){console[_0xfd5d('0x64')](_0x42b74d);logger['error']('[QUEUE]',JSON[_0xfd5d('0x19')](_0x42b74d));});};exports[_0xfd5d('0x65')]=function(_0x446965,_0x318f83,_0x3ca666,_0x307064,_0x1cfa58,_0x3e00cc,_0x48f994){var _0x5c0af1,_0x195cbe;_0x3e00cc[_0xfd5d('0x14')]=intUtil[_0xfd5d('0x4e')](_0x3e00cc[_0xfd5d('0x14')]);_0x3e00cc[_0xfd5d('0x4f')]=intUtil['stripTrailingSlash'](_0x3e00cc[_0xfd5d('0x4f')]);if(_0x48f994&&_0x48f994['recordingFormat']&&_0x48f994[_0xfd5d('0x66')]!==_0xfd5d('0x67')){logger[_0xfd5d('0x12')](_0xfd5d('0x68'),_0xfd5d('0x51'));_0x318f83[_0xfd5d('0x53')]=util['format'](_0xfd5d('0x52'),_0x3e00cc[_0xfd5d('0x4f')],_0x318f83[_0xfd5d('0x69')],md5(_0x318f83[_0xfd5d('0x69')]));}headers[_0xfd5d('0x54')]=getAuth(_0x3e00cc);return getUser(_0x3e00cc,_0x307064[_0xfd5d('0x55')])[_0xfd5d('0xe')](function(_0x12292b){_0x5c0af1=_0x12292b;logger[_0xfd5d('0x12')](_0xfd5d('0x56'),_0x5c0af1['id']);return getEndUser(_0x3e00cc,_0x318f83[_0xfd5d('0x6a')],_0x318f83[_0xfd5d('0x6b')]);})[_0xfd5d('0xe')](function(_0x182cb5){_0x195cbe=_0x182cb5;logger['info']('The\x20Enduser\x20ID\x20is:',_0x195cbe['id']);return getTicket(_0x3e00cc,_0x5c0af1,_0x195cbe,_0x3ca666,_0x318f83);})[_0xfd5d('0xe')](function(_0x481ebd){if(_0x481ebd){logger[_0xfd5d('0x12')](_0xfd5d('0x58'));logger[_0xfd5d('0x12')](_0xfd5d('0x59'),_0x481ebd['id']);switch(_0x3e00cc['type']){case _0xfd5d('0x5a'):logger[_0xfd5d('0x12')](_0xfd5d('0x5b'),_0xfd5d('0x5c'));emit(util[_0xfd5d('0x1d')](_0xfd5d('0x60'),_0x307064[_0xfd5d('0x3c')]),'trigger:desk:display',{'recordId':_0x481ebd['id']});break;case _0xfd5d('0x5e'):logger[_0xfd5d('0x12')](_0xfd5d('0x5b'),_0xfd5d('0x5f'));emit(util['format'](_0xfd5d('0x60'),_0x307064[_0xfd5d('0x3c')]),_0xfd5d('0x61'),{'uri':util['format'](_0xfd5d('0x6c'),_0x3e00cc['remoteUri'],_0x481ebd['id'])});break;default:logger['error'](_0xfd5d('0x68'),_0xfd5d('0x63'));}}})[_0xfd5d('0x6d')](function(_0x145cae){logger[_0xfd5d('0x64')]('[OUTBOUND]',JSON[_0xfd5d('0x19')](_0x145cae));});};exports[_0xfd5d('0x6e')]=function(_0x12bc06,_0x91b883,_0x4edce6,_0xa4392c,_0x4616bf,_0x2ae225){var _0x2836ae,_0x3a66aa;_0x2ae225[_0xfd5d('0x14')]=intUtil[_0xfd5d('0x4e')](_0x2ae225[_0xfd5d('0x14')]);_0x2ae225[_0xfd5d('0x4f')]=intUtil['stripTrailingSlash'](_0x2ae225[_0xfd5d('0x4f')]);if(_0x4616bf&&_0x4616bf[_0xfd5d('0x50')]){logger[_0xfd5d('0x12')]('['+_0x91b883[_0xfd5d('0x6f')][_0xfd5d('0x70')]()+']',_0xfd5d('0x51'));_0x91b883[_0xfd5d('0x53')]=util[_0xfd5d('0x1d')](_0xfd5d('0x52'),_0x2ae225['serverUrl'],_0x91b883[_0xfd5d('0x69')],md5(_0x91b883['uniqueid']));}else{_0x91b883['recordingURL']='';}headers[_0xfd5d('0x54')]=getAuth(_0x2ae225);return getUser(_0x2ae225)[_0xfd5d('0xe')](function(_0x21aa01){_0x2836ae=_0x21aa01;logger['info']('The\x20User\x20ID\x20is:',_0x2836ae['id']);return getEndUser(_0x2ae225,_0x91b883[_0xfd5d('0x71')],_0x91b883['calleridnum']);})[_0xfd5d('0xe')](function(_0x277ce0){_0x3a66aa=_0x277ce0;logger[_0xfd5d('0x12')]('The\x20Enduser\x20ID\x20is:',_0x3a66aa['id']);return getTicket(_0x2ae225,_0x2836ae,_0x3a66aa,_0x4edce6,_0x91b883);})[_0xfd5d('0xe')](function(_0x474daa){if(_0x474daa){logger[_0xfd5d('0x12')](_0xfd5d('0x58'));logger[_0xfd5d('0x12')](_0xfd5d('0x59'),_0x474daa['id']);}})[_0xfd5d('0x6d')](function(_0x257215){logger['error']('['+_0x91b883[_0xfd5d('0x6f')]['toUpperCase']()+']',JSON[_0xfd5d('0x19')](_0x257215));});}; \ No newline at end of file +var _0xa89e=['%s/agent/tickets/%s','monitor_format','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','util','ioredis','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','emit','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','%s/customers/search','Enduser\x20found!','POST','work','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','idField','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[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','catch','stringify','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','integrationTab'];(function(_0x40cbc2,_0x3d4908){var _0x4ba077=function(_0xe48c0f){while(--_0xe48c0f){_0x40cbc2['push'](_0x40cbc2['shift']());}};_0x4ba077(++_0x3d4908);}(_0xa89e,0x74));var _0xea89=function(_0x3134e4,_0x1a669a){_0x3134e4=_0x3134e4-0x0;var _0x5ed6b3=_0xa89e[_0x3134e4];return _0x5ed6b3;};'use strict';var _=require(_0xea89('0x0'));var rp=require(_0xea89('0x1'));var md5=require('md5');var util=require(_0xea89('0x2'));var Redis=require(_0xea89('0x3'));var intUtil=require(_0xea89('0x4'));var config=require(_0xea89('0x5'));var logger=require('../../../../config/logger')(_0xea89('0x6'));config[_0xea89('0x7')]=_[_0xea89('0x8')](config['redis'],{'host':_0xea89('0x9'),'port':0x18eb});var io=require(_0xea89('0xa'))(new Redis(config[_0xea89('0x7')]));function emit(_0x311137,_0x50eeb3,_0x480d95){io['to'](_0x311137)[_0xea89('0xb')](_0x50eeb3,_0x480d95);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x4da4c9,_0x479d54){if(intUtil[_0xea89('0xc')](_0x479d54)===!![]){logger[_0xea89('0xd')](_0xea89('0xe'),_0x479d54);return request({'uri':util[_0xea89('0xf')]('%s/users',_0x4da4c9[_0xea89('0x10')])})[_0xea89('0x11')](function(_0x513183){if(_0x513183[_0xea89('0x12')]){return _[_0xea89('0x13')](_0x513183[_0xea89('0x14')][_0xea89('0x15')],{'email':_0x479d54});}})[_0xea89('0x11')](function(_0x2c4666){if(_0x2c4666){logger[_0xea89('0xd')](_0xea89('0x16'));return _0x2c4666;}else{logger['info'](_0xea89('0x17'));return request({'uri':util[_0xea89('0xf')](_0xea89('0x18'),_0x4da4c9[_0xea89('0x10')])});}});}else{logger['info'](_0xea89('0x19'));return request({'uri':util[_0xea89('0xf')](_0xea89('0x18'),_0x4da4c9[_0xea89('0x10')])});}}function request(_0x204f9d){logger['debug'](_0xea89('0x1a'),JSON['stringify'](_0x204f9d));return rp(_[_0xea89('0x8')](_0x204f9d,{'method':_0xea89('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x3a6e5c){var _0xd87747;if(_0x3a6e5c[_0xea89('0x1c')]===_0xea89('0x1d')){_0xd87747=util[_0xea89('0xf')](_0xea89('0x1e'),_0x3a6e5c[_0xea89('0x1f')],_0x3a6e5c[_0xea89('0x20')]);}else if(_0x3a6e5c[_0xea89('0x1c')]===_0xea89('0x21')){_0xd87747=util[_0xea89('0xf')](_0xea89('0x22'),_0x3a6e5c[_0xea89('0x1f')],_0x3a6e5c[_0xea89('0x21')]);}return util['format'](_0xea89('0x23'),new Buffer(_0xd87747)[_0xea89('0x24')](_0xea89('0x25')));}function getEndUser(_0x498209,_0x5cc6c1,_0x33fc75){logger['info']('Searching\x20enduser\x20with\x20phone',_0x33fc75);return request({'uri':util[_0xea89('0xf')](_0xea89('0x26'),_0x498209[_0xea89('0x10')]),'qs':{'phone':_0x33fc75}})[_0xea89('0x11')](function(_0xf80024){if(_0xf80024['total_entries']){logger[_0xea89('0xd')](_0xea89('0x27'));return _0xf80024[_0xea89('0x14')][_0xea89('0x15')][0x0];}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xea89('0xf')]('%s/customers',_0x498209[_0xea89('0x10')]),'method':_0xea89('0x28'),'body':{'first_name':_0x5cc6c1,'title':_0x5cc6c1,'phone_numbers':[{'type':_0xea89('0x29'),'value':_0x33fc75}]}});}});}function getTags(_0x3192e5,_0x4d5954){var _0x4619e1=[];if(_0x3192e5&&_0x3192e5[_0xea89('0x2a')]>0x0){_0x4619e1=_[_0xea89('0x2b')](_0x3192e5,_0x4d5954);}return _0x4619e1;}function getCustomFields(_0x327e7a,_0x3feac2){var _0x51e789=[];var _0x4940ab={'custom_fields':{}};if(_0x327e7a['length']>0x0){_[_0xea89('0x2c')](_0x327e7a,function(_0x39e48f){if(_[_0xea89('0x2d')]([_0xea89('0x2e'),_0xea89('0x2f')],_0x39e48f[_0xea89('0x30')])&&_0x39e48f[_0xea89('0x31')]&&!_0x39e48f[_0xea89('0x32')]){_0x4940ab[_0x39e48f[_0xea89('0x31')][_0xea89('0x33')]()]=_0x39e48f[_0xea89('0x34')][_0xea89('0x24')]();}else if(_[_0xea89('0x2d')]([_0xea89('0x2e'),'picklist'],_0x39e48f[_0xea89('0x30')])&&_0x39e48f['idField']&&_0x39e48f[_0xea89('0x32')]){_0x4940ab[_0xea89('0x35')][_0x39e48f[_0xea89('0x36')]]=_0x39e48f['content'][_0xea89('0x24')]();}else if(_0x39e48f[_0xea89('0x30')]==='variable'&&_0x39e48f['variableName']&&_0x39e48f[_0xea89('0x36')]&&_0x39e48f[_0xea89('0x32')]){_0x3feac2[_0x39e48f[_0xea89('0x37')]]&&(_0x4940ab['custom_fields'][_0x39e48f['idField']]=_0x3feac2[_0x39e48f['variableName']][_0xea89('0x24')]());}else if(_0x39e48f[_0xea89('0x30')]===_0xea89('0x38')&&_0x39e48f['Variable']&&_0x39e48f[_0xea89('0x39')][_0xea89('0x3a')]&&_0x39e48f[_0xea89('0x36')]&&_0x39e48f[_0xea89('0x32')]){_0x3feac2[_0x39e48f['Variable']['name'][_0xea89('0x33')]()]&&(_0x4940ab[_0xea89('0x35')][_0x39e48f['idField']]=_0x3feac2[_0x39e48f[_0xea89('0x39')][_0xea89('0x3a')][_0xea89('0x33')]()][_0xea89('0x24')]());}});}if(_0x4940ab[_0xea89('0x3b')]){_0x4940ab[_0xea89('0x3b')]=Number(_0x4940ab[_0xea89('0x3b')]);}return _0x4940ab;}function getTicket(_0x13e60e,_0x5f485a,_0x232e3f,_0x2db9d2,_0x258c97){logger[_0xea89('0xd')]('Creating\x20new\x20ticket...');var _0x19b1f4=_[_0xea89('0x3c')]({'subject':intUtil[_0xea89('0x3d')](_0x2db9d2[_0xea89('0x3e')],_0x258c97,'\x20'),'type':_0xea89('0x3f'),'status':_0xea89('0x40'),'labels':[_0xea89('0x41'),_0xea89('0x42'),_0xea89('0x43')][_0xea89('0x44')](getTags(_0x2db9d2['Tags'],_0xea89('0x3a'))),'description':intUtil[_0xea89('0x3d')](_0x2db9d2[_0xea89('0x45')],_0x258c97,'\x0a'),'_links':{'assigned_user':{'href':util[_0xea89('0xf')](_0xea89('0x46'),_0x5f485a['id']),'class':_0xea89('0x47')}},'message':{'direction':'in','body':intUtil[_0xea89('0x3d')](_0x2db9d2[_0xea89('0x45')],_0x258c97,'\x0a')}},getCustomFields(_0x2db9d2[_0xea89('0x48')],_0x258c97));return request({'uri':util[_0xea89('0xf')](_0xea89('0x49'),_0x13e60e['remoteUri'],_0x232e3f['id']),'method':_0xea89('0x28'),'body':_0x19b1f4});}exports[_0xea89('0x4a')]=function(_0x59af2e,_0x3f2c95,_0x1993ad,_0x423735,_0x5986dc,_0x2e6a8d){var _0x274be1,_0x8d9f92;_0x2e6a8d[_0xea89('0x10')]=intUtil[_0xea89('0x4b')](_0x2e6a8d[_0xea89('0x10')]);_0x2e6a8d['serverUrl']=intUtil[_0xea89('0x4b')](_0x2e6a8d[_0xea89('0x4c')]);if(_0x5986dc&&_0x5986dc['monitor_format']){logger[_0xea89('0xd')]('[QUEUE]',_0xea89('0x4d'));_0x3f2c95[_0xea89('0x4e')]=util[_0xea89('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e6a8d['serverUrl'],_0x3f2c95[_0xea89('0x4f')],md5(_0x3f2c95['uniqueid']));}else{_0x3f2c95[_0xea89('0x4e')]='';}headers[_0xea89('0x50')]=getAuth(_0x2e6a8d);return getUser(_0x2e6a8d,_0x423735[_0xea89('0x51')])[_0xea89('0x11')](function(_0x37bb50){_0x274be1=_0x37bb50;logger[_0xea89('0xd')]('The\x20User\x20ID\x20is:',_0x274be1['id']);return getEndUser(_0x2e6a8d,_0x3f2c95[_0xea89('0x52')],_0x3f2c95[_0xea89('0x53')]);})[_0xea89('0x11')](function(_0x47fd8a){_0x8d9f92=_0x47fd8a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x8d9f92['id']);return getTicket(_0x2e6a8d,_0x274be1,_0x8d9f92,_0x1993ad,_0x3f2c95);})[_0xea89('0x11')](function(_0x36449c){if(_0x36449c){logger[_0xea89('0xd')](_0xea89('0x54'));logger[_0xea89('0xd')](_0xea89('0x55'),_0x36449c['id']);switch(_0x2e6a8d[_0xea89('0x30')]){case'integrationTab':logger[_0xea89('0xd')](_0xea89('0x56'),_0xea89('0x57'));emit(util[_0xea89('0xf')](_0xea89('0x58'),_0x423735[_0xea89('0x3a')]),_0xea89('0x59'),{'recordId':_0x36449c['id']});break;case _0xea89('0x5a'):logger[_0xea89('0xd')]('[QUEUE]',_0xea89('0x5b'));emit(util[_0xea89('0xf')](_0xea89('0x58'),_0x423735['name']),_0xea89('0x5c'),{'uri':util[_0xea89('0xf')](_0xea89('0x5d'),_0x36449c['id'])});break;default:logger[_0xea89('0x5e')]('[QUEUE]',_0xea89('0x5f'));}}})[_0xea89('0x60')](function(_0x49278c){console[_0xea89('0x5e')](_0x49278c);logger[_0xea89('0x5e')]('[QUEUE]',JSON[_0xea89('0x61')](_0x49278c));});};exports[_0xea89('0x62')]=function(_0x1311a6,_0x406198,_0x3ab20c,_0x4fda72,_0x44ec9c,_0x305e40,_0x32b9b7){var _0x5c05a1,_0x15746b;_0x305e40[_0xea89('0x10')]=intUtil['stripTrailingSlash'](_0x305e40[_0xea89('0x10')]);_0x305e40[_0xea89('0x4c')]=intUtil[_0xea89('0x4b')](_0x305e40[_0xea89('0x4c')]);if(_0x32b9b7&&_0x32b9b7[_0xea89('0x63')]&&_0x32b9b7[_0xea89('0x63')]!=='none'){logger[_0xea89('0xd')](_0xea89('0x64'),'Recording\x20is\x20enabled!');_0x406198['recordingURL']=util[_0xea89('0xf')](_0xea89('0x65'),_0x305e40[_0xea89('0x4c')],_0x406198[_0xea89('0x4f')],md5(_0x406198[_0xea89('0x4f')]));}headers[_0xea89('0x50')]=getAuth(_0x305e40);return getUser(_0x305e40,_0x4fda72[_0xea89('0x51')])['then'](function(_0x57a7d4){_0x5c05a1=_0x57a7d4;logger['info']('The\x20User\x20ID\x20is:',_0x5c05a1['id']);return getEndUser(_0x305e40,_0x406198[_0xea89('0x66')],_0x406198[_0xea89('0x67')]);})[_0xea89('0x11')](function(_0x15a9fe){_0x15746b=_0x15a9fe;logger[_0xea89('0xd')](_0xea89('0x68'),_0x15746b['id']);return getTicket(_0x305e40,_0x5c05a1,_0x15746b,_0x3ab20c,_0x406198);})[_0xea89('0x11')](function(_0x51619f){if(_0x51619f){logger[_0xea89('0xd')](_0xea89('0x54'));logger[_0xea89('0xd')](_0xea89('0x55'),_0x51619f['id']);switch(_0x305e40[_0xea89('0x30')]){case _0xea89('0x69'):logger[_0xea89('0xd')](_0xea89('0x56'),_0xea89('0x57'));emit(util[_0xea89('0xf')](_0xea89('0x58'),_0x4fda72[_0xea89('0x3a')]),_0xea89('0x59'),{'recordId':_0x51619f['id']});break;case _0xea89('0x5a'):logger[_0xea89('0xd')](_0xea89('0x56'),_0xea89('0x5b'));emit(util[_0xea89('0xf')](_0xea89('0x58'),_0x4fda72[_0xea89('0x3a')]),_0xea89('0x5c'),{'uri':util[_0xea89('0xf')](_0xea89('0x6a'),_0x305e40['remoteUri'],_0x51619f['id'])});break;default:logger[_0xea89('0x5e')](_0xea89('0x64'),_0xea89('0x5f'));}}})[_0xea89('0x60')](function(_0x21241d){logger[_0xea89('0x5e')]('[OUTBOUND]',JSON[_0xea89('0x61')](_0x21241d));});};exports['unmanaged']=function(_0x5bd980,_0x375172,_0x35a1e0,_0x6723c4,_0xfbbb46,_0x3006ee){var _0x3bd1b2,_0x280f0c;_0x3006ee[_0xea89('0x10')]=intUtil['stripTrailingSlash'](_0x3006ee[_0xea89('0x10')]);_0x3006ee[_0xea89('0x4c')]=intUtil[_0xea89('0x4b')](_0x3006ee['serverUrl']);if(_0xfbbb46&&_0xfbbb46[_0xea89('0x6b')]){logger[_0xea89('0xd')]('['+_0x375172[_0xea89('0x6c')][_0xea89('0x6d')]()+']',_0xea89('0x4d'));_0x375172[_0xea89('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3006ee[_0xea89('0x4c')],_0x375172[_0xea89('0x4f')],md5(_0x375172[_0xea89('0x4f')]));}else{_0x375172[_0xea89('0x4e')]='';}headers[_0xea89('0x50')]=getAuth(_0x3006ee);return getUser(_0x3006ee)[_0xea89('0x11')](function(_0x578d75){_0x3bd1b2=_0x578d75;logger[_0xea89('0xd')](_0xea89('0x6e'),_0x3bd1b2['id']);return getEndUser(_0x3006ee,_0x375172['calleridname'],_0x375172[_0xea89('0x53')]);})['then'](function(_0x265d87){_0x280f0c=_0x265d87;logger[_0xea89('0xd')]('The\x20Enduser\x20ID\x20is:',_0x280f0c['id']);return getTicket(_0x3006ee,_0x3bd1b2,_0x280f0c,_0x35a1e0,_0x375172);})[_0xea89('0x11')](function(_0x57decd){if(_0x57decd){logger['info']('Ticket\x20created!');logger[_0xea89('0xd')](_0xea89('0x55'),_0x57decd['id']);}})[_0xea89('0x60')](function(_0x29f94c){logger['error']('['+_0x375172['lastevent'][_0xea89('0x6d')]()+']',JSON[_0xea89('0x61')](_0x29f94c));});}; \ 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 e2e0811..f98a0a4 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 _0xe626=['email','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','userEmail','length','username','outbound','destcalleridnum','calleridnum','contacts','odata-entityid','substring','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','type','idField','toLowerCase','content','ticketType','incident','POST','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','phonecalls','assign','getString','callDirection','queue','headers','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','localhost','socket.io-emitter','clientId','remoteUri','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail'];(function(_0x350ff3,_0x2c05a8){var _0x9d68cb=function(_0x4f3d4c){while(--_0x4f3d4c){_0x350ff3['push'](_0x350ff3['shift']());}};_0x9d68cb(++_0x2c05a8);}(_0xe626,0x9d));var _0x6e62=function(_0x55c5b4,_0x3d1cae){_0x55c5b4=_0x55c5b4-0x0;var _0x110c82=_0xe626[_0x55c5b4];return _0x110c82;};'use strict';var _=require(_0x6e62('0x0'));var BPromise=require(_0x6e62('0x1'));var rp=require(_0x6e62('0x2'));var util=require(_0x6e62('0x3'));var intUtil=require('./util');var md5=require(_0x6e62('0x4'));var Redis=require(_0x6e62('0x5'));var logger=require(_0x6e62('0x6'))(_0x6e62('0x7'));var config=require(_0x6e62('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x6e62('0x9'),'port':0x18eb});var io=require(_0x6e62('0xa'))(new Redis(config['redis']));function getAuthToken(_0x32fd89,_0x1dfbaf,_0x16fa52){var _0x3317f1={'method':'POST','uri':_0x1dfbaf,'form':{'client_id':_0x32fd89[_0x6e62('0xb')],'resource':_0x32fd89[_0x6e62('0xc')],'username':_0x32fd89['username'],'password':_0x32fd89[_0x6e62('0xd')],'grant_type':'password','client_secret':_0x32fd89[_0x6e62('0xe')]},'json':!![]};return rp(_0x3317f1)['then'](function(_0x2d8894){return _0x2d8894['access_token'];})[_0x6e62('0xf')](function(_0x103546){logger[_0x6e62('0x10')]('['+[_0x16fa52[_0x6e62('0x11')]()]+_0x6e62('0x12'));return _0x103546[_0x6e62('0x13')];});}function getUser(_0x3b5c11,_0x49be2d,_0x4e7917,_0x44b131,_0x3b980d,_0x5328fe){return new BPromise(function(_0x91facd,_0x40ec9d){return getAuthToken(_0x49be2d,_0x44b131,_0x5328fe)[_0x6e62('0x14')](function(_0x3f4e35){var _0x58d84e={'method':_0x6e62('0x15'),'uri':_0x3b980d+_0x6e62('0x16'),'headers':{'Authorization':_0x6e62('0x17')+_0x3f4e35,'OData-Version':_0x6e62('0x18')},'json':!![]};return rp(_0x58d84e);})[_0x6e62('0x14')](function(_0x31b304){var _0x42c2ea=_0x31b304[_0x6e62('0x19')];var _0x474e58=![];var _0x15bce5=null;if(!_['isNil'](_0x4e7917)){if(intUtil[_0x6e62('0x1a')](_0x4e7917[_0x6e62('0x1b')])){_0x3b5c11['userEmail']=_0x4e7917[_0x6e62('0x1b')];for(_0x15bce5=0x0;_0x15bce5<_0x42c2ea['length'];_0x15bce5++){if(_0x42c2ea[_0x15bce5][_0x6e62('0x1c')]===_0x4e7917[_0x6e62('0x1b')]&&!_0x42c2ea[_0x15bce5][_0x6e62('0x1d')]){_0x474e58=!![];logger[_0x6e62('0x1e')]('['+[_0x5328fe[_0x6e62('0x11')]()]+_0x6e62('0x1f')+_0x42c2ea[_0x15bce5][_0x6e62('0x20')]+'!');_0x3b5c11[_0x6e62('0x21')]=_0x42c2ea[_0x15bce5][_0x6e62('0x20')];}}}}if(!_0x474e58){logger[_0x6e62('0x1e')]('['+[_0x5328fe[_0x6e62('0x11')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3b5c11[_0x6e62('0x22')]=_0x49be2d['username'];for(_0x15bce5=0x0;_0x15bce5<_0x42c2ea[_0x6e62('0x23')];_0x15bce5++){if(_0x42c2ea[_0x15bce5][_0x6e62('0x1c')]===_0x49be2d[_0x6e62('0x24')]){_0x3b5c11[_0x6e62('0x21')]=_0x42c2ea[_0x15bce5][_0x6e62('0x20')];}}}_0x91facd(_0x3b5c11);})[_0x6e62('0xf')](function(_0x4373b5){_0x40ec9d(_0x4373b5[_0x6e62('0x13')]);});});}function createEndUser(_0x2e4fe1,_0x448691,_0x5a6ffa,_0x33f81c,_0x555793,_0x2f9c68){return new BPromise(function(_0x2f9baf,_0x318fc3){return getAuthToken(_0x448691,_0x5a6ffa,_0x2f9c68)[_0x6e62('0x14')](function(_0x3b7dfa){var _0x3e7c90=_0x2f9c68['toLowerCase']()===_0x6e62('0x25')?_0x555793[_0x6e62('0x26')]:_0x555793[_0x6e62('0x27')];var _0x50ba00={'method':'POST','uri':_0x33f81c+_0x6e62('0x28'),'body':{'telephone1':_0x3e7c90,'fullname':_0x3e7c90,'firstname':_0x3e7c90,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2e4fe1['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x3b7dfa,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x50ba00);})[_0x6e62('0x14')](function(_0x4c6af1){var _0x2d9172=_0x4c6af1['headers'][_0x6e62('0x29')];var _0x2fb5ce=_0x2d9172[_0x6e62('0x2a')](_0x2d9172['lastIndexOf']('(')+0x1,_0x2d9172['lastIndexOf'](')'));_0x2e4fe1[_0x6e62('0x2b')]=_0x2fb5ce;_0x2f9baf(_0x2e4fe1);})[_0x6e62('0xf')](function(_0x578607){_0x318fc3(_0x578607['message']);});});}function getEndUser(_0x53dfaa,_0x1f2dd2,_0x537f37,_0xde2488,_0x6af555,_0x3dc663){return new BPromise(function(_0xe525c,_0x190e7b){return getAuthToken(_0x1f2dd2,_0x537f37,_0x3dc663)['then'](function(_0x4b8397){var _0x451e19={'method':_0x6e62('0x15'),'uri':_0xde2488+_0x6e62('0x2c'),'headers':{'Authorization':_0x6e62('0x17')+_0x4b8397,'If-None-Match':null,'OData-Version':_0x6e62('0x18')},'json':!![]};return rp(_0x451e19);})[_0x6e62('0x14')](function(_0x9c62b){var _0x310789=null;if(_0x9c62b){var _0x453fd3=_0x9c62b['value'];var _0xfe27ff=![];for(_0x310789=0x0;_0x310789<_0x453fd3[_0x6e62('0x23')];_0x310789++){var _0x20c71e=_0x3dc663['toLowerCase']()===_0x6e62('0x25')?_0x6af555[_0x6e62('0x26')]:_0x6af555['calleridnum'];if(_0x453fd3[_0x310789][_0x6e62('0x2d')]===_0x20c71e){_0xfe27ff=!![];_0x53dfaa[_0x6e62('0x2b')]=_0x453fd3[_0x310789][_0x6e62('0x2e')];}}if(_0xfe27ff){_0xe525c(_0x53dfaa);}else{return createEndUser(_0x53dfaa,_0x1f2dd2,_0x537f37,_0xde2488,_0x6af555,_0x3dc663)[_0x6e62('0x14')](function(_0x304ac1){logger['info']('['+[_0x3dc663[_0x6e62('0x11')]()]+_0x6e62('0x2f'),_0x304ac1[_0x6e62('0x2b')]);_0xe525c(_0x304ac1);});}}else{return createEndUser(_0x53dfaa,_0x1f2dd2,_0x537f37,_0xde2488,_0x6af555,_0x3dc663)[_0x6e62('0x14')](function(_0x3f069c){logger['info']('['+[_0x3dc663[_0x6e62('0x11')]()]+_0x6e62('0x30'),_0x3f069c[_0x6e62('0x2b')]);_0xe525c(_0x3f069c);});}});});}function getCustomFields(_0x50b715,_0x28af80,_0x362944){var _0x5f3898={};if(_0x50b715['length']>0x0){_[_0x6e62('0x31')](_0x50b715,function(_0x1c2ee1){if(_[_0x6e62('0x32')](['string','picklist'],_0x1c2ee1[_0x6e62('0x33')])&&_0x1c2ee1['nameField']&&!_0x1c2ee1['customField']){var _0xb646d4=_0x1c2ee1[_0x6e62('0x34')][_0x6e62('0x35')]();var _0x3f08e3=_0xb646d4[_0x6e62('0x2a')](0x0,_0xb646d4['indexOf']('_'));var _0x180258=_0xb646d4['substring'](_0xb646d4['indexOf']('_')+0x1);if(_0x3f08e3===_0x362944){_0x5f3898[_0x180258]=_0x1c2ee1[_0x6e62('0x36')];}}});}return _0x5f3898;}function getTicket(_0x469fa1,_0x940288,_0x5352d3,_0x1a7e7f,_0x530162,_0x28bf71,_0x32e3ee){return new BPromise(function(_0x4212e6,_0x2d8565){var _0x38a489;return getAuthToken(_0x940288,_0x5352d3,_0x32e3ee)[_0x6e62('0x14')](function(_0x228519){if(_0x28bf71[_0x6e62('0x37')]===_0x6e62('0x38')){_0x38a489={'method':_0x6e62('0x39'),'uri':_0x1a7e7f+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0x28bf71[_0x6e62('0x3a')],_0x530162,'\x20'),'description':intUtil['getString'](_0x28bf71[_0x6e62('0x3b')],_0x530162,'\x0a'),'customerid_contact@odata.bind':_0x6e62('0x3c')+_0x469fa1['enduserId']+')','ownerid@odata.bind':_0x6e62('0x3d')+_0x469fa1[_0x6e62('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x28bf71[_0x6e62('0x3e')],_0x530162,_0x28bf71[_0x6e62('0x37')])),'headers':{'Authorization':_0x6e62('0x17')+_0x228519,'OData-Version':_0x6e62('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x28bf71[_0x6e62('0x37')]===_0x6e62('0x3f')){_0x38a489={'method':_0x6e62('0x39'),'uri':_0x1a7e7f+_0x6e62('0x40'),'body':Object[_0x6e62('0x41')]({},{'subject':intUtil[_0x6e62('0x42')](_0x28bf71[_0x6e62('0x3a')],_0x530162,'\x20'),'phonenumber':String(_0x530162['calleridnum']),'description':intUtil[_0x6e62('0x42')](_0x28bf71[_0x6e62('0x3b')],_0x530162,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x469fa1[_0x6e62('0x2b')]+')','ownerid@odata.bind':'/systemusers('+_0x469fa1[_0x6e62('0x21')]+')','directioncode':_0x469fa1[_0x6e62('0x43')]===_0x6e62('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x469fa1[_0x6e62('0x21')]+')','participationtypemask':_0x469fa1[_0x6e62('0x43')]===_0x6e62('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x6e62('0x3c')+_0x469fa1[_0x6e62('0x2b')]+')','participationtypemask':_0x469fa1[_0x6e62('0x43')]===_0x6e62('0x44')?0x1:0x2}]},getCustomFields(_0x28bf71[_0x6e62('0x3e')],_0x530162,_0x28bf71[_0x6e62('0x37')])),'headers':{'Authorization':_0x6e62('0x17')+_0x228519,'OData-Version':_0x6e62('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x38a489);})['then'](function(_0x4a009d){var _0x2d7732=_0x4a009d[_0x6e62('0x45')][_0x6e62('0x29')];var _0x15b571=_0x2d7732[_0x6e62('0x2a')](_0x2d7732[_0x6e62('0x46')]('(')+0x1,_0x2d7732['lastIndexOf'](')'));_0x469fa1[_0x6e62('0x47')]=_0x15b571;_0x4212e6(_0x469fa1);})['catch'](function(_0x28bcb3){_0x2d8565(_0x28bcb3[_0x6e62('0x13')]);});});}function emit(_0x3f9dd5,_0x7463fd,_0x43afc9,_0x498f95){var _0x353346={'uri':util[_0x6e62('0x48')](_0x6e62('0x49'),_0x3f9dd5,_0x43afc9,_0x498f95)};io['to'](util[_0x6e62('0x48')]('user:%s',_0x7463fd))[_0x6e62('0x4a')]('trigger:browser:url',_0x353346);}exports['cs']=function(_0x925b76,_0x213bf3,_0x37f77e,_0x21ab5d,_0x366cf4,_0x33d4cf,_0x11d1c4,_0x520ca5){var _0xd821ae={};_0x33d4cf['remoteUri']=intUtil[_0x6e62('0x4b')](_0x33d4cf[_0x6e62('0xc')]);_0x33d4cf[_0x6e62('0x4c')]=intUtil[_0x6e62('0x4b')](_0x33d4cf[_0x6e62('0x4c')]);_0xd821ae['callDirection']=_0x520ca5===_0x6e62('0x44')||_0x520ca5==='unmanaged'?_0x6e62('0x44'):_0x6e62('0x25');var _0x1e513a=util['format'](_0x6e62('0x4d'),_0x33d4cf[_0x6e62('0xc')]);var _0x4daa8d=util[_0x6e62('0x48')]('https://login.microsoftonline.com/%s/oauth2/token',_0x33d4cf[_0x6e62('0x4e')]);var _0x5bf3ef=util[_0x6e62('0x48')](_0x6e62('0x4f'),_0x33d4cf['serverUrl'],_0x213bf3[_0x6e62('0x50')],md5(_0x213bf3[_0x6e62('0x50')]));if(_0x366cf4&&_0x366cf4['monitor_format']){logger['info'](_0x6e62('0x51'),_0x6e62('0x52'));_0x213bf3[_0x6e62('0x53')]=_0x5bf3ef;}else if(_0x11d1c4&&_0x11d1c4[_0x6e62('0x54')]&&_0x11d1c4[_0x6e62('0x54')]!==_0x6e62('0x55')){logger[_0x6e62('0x1e')]('[OUTBOUND]',_0x6e62('0x52'));_0x213bf3[_0x6e62('0x53')]=_0x5bf3ef;}else{_0x213bf3[_0x6e62('0x53')]='';}return getUser(_0xd821ae,_0x33d4cf,_0x21ab5d,_0x4daa8d,_0x1e513a,_0x520ca5)[_0x6e62('0x14')](function(_0x109ff5){logger['info']('['+_0x520ca5[_0x6e62('0x11')]()+_0x6e62('0x56'),_0x109ff5['userId']);logger[_0x6e62('0x1e')]('['+_0x520ca5[_0x6e62('0x11')]()+_0x6e62('0x57'),_0x109ff5[_0x6e62('0x22')]);return getEndUser(_0x109ff5,_0x33d4cf,_0x4daa8d,_0x1e513a,_0x213bf3,_0x520ca5);})[_0x6e62('0x14')](function(_0x4d62d8){logger[_0x6e62('0x1e')]('['+_0x520ca5[_0x6e62('0x11')]()+_0x6e62('0x58'),_0x4d62d8['enduserId']);logger[_0x6e62('0x1e')]('['+_0x520ca5[_0x6e62('0x11')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x213bf3[_0x6e62('0x27')]);return getTicket(_0x4d62d8,_0x33d4cf,_0x4daa8d,_0x1e513a,_0x213bf3,_0x37f77e,_0x520ca5);})['then'](function(_0x29b290){logger[_0x6e62('0x1e')](util[_0x6e62('0x48')]('['+_0x520ca5['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x37f77e[_0x6e62('0x37')],_0x29b290[_0x6e62('0x47')]));logger[_0x6e62('0x1e')](util[_0x6e62('0x48')]('['+_0x520ca5[_0x6e62('0x11')]()+_0x6e62('0x59'),_0x520ca5));if(_0x520ca5!==_0x6e62('0x5a')){logger[_0x6e62('0x1e')]('['+_0x520ca5['toUpperCase']()+']',_0x6e62('0x5b'));emit(_0x33d4cf[_0x6e62('0xc')],_0x21ab5d['name'],_0x37f77e[_0x6e62('0x37')],_0x29b290['ticketId']);}})[_0x6e62('0xf')](function(_0x212cab){logger[_0x6e62('0x10')]('['+_0x520ca5[_0x6e62('0x11')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x212cab,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1298=['phonecalls','/contacts(','queue','callDirection','lastIndexOf','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','remoteUri','serverUrl','unmanaged','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\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...','name','inspect','bluebird','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','password','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','userEmail','username','internalemailaddress','outbound','destcalleridnum','POST','/systemusers(','Bearer\x20','headers','odata-entityid','substring','enduserId','GET','toLowerCase','calleridnum',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','indexOf','content','ticketType','incident','assign','getString','Descriptions','Fields','phonecall'];(function(_0xd5c365,_0x4040b7){var _0x3e4875=function(_0x459ca3){while(--_0x459ca3){_0xd5c365['push'](_0xd5c365['shift']());}};_0x3e4875(++_0x4040b7);}(_0x1298,0x19e));var _0x8129=function(_0x1468bd,_0x2d63aa){_0x1468bd=_0x1468bd-0x0;var _0x4015c1=_0x1298[_0x1468bd];return _0x4015c1;};'use strict';var _=require('lodash');var BPromise=require(_0x8129('0x0'));var rp=require('request-promise');var util=require(_0x8129('0x1'));var intUtil=require(_0x8129('0x2'));var md5=require(_0x8129('0x3'));var Redis=require(_0x8129('0x4'));var logger=require(_0x8129('0x5'))(_0x8129('0x6'));var config=require(_0x8129('0x7'));config['redis']=_[_0x8129('0x8')](config[_0x8129('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8129('0x9')]));function getAuthToken(_0x2d07d5,_0x3ff6e0,_0x3d94f8){var _0x39ad9b={'method':'POST','uri':_0x3ff6e0,'form':{'client_id':_0x2d07d5['clientId'],'resource':_0x2d07d5['remoteUri'],'username':_0x2d07d5['username'],'password':_0x2d07d5[_0x8129('0xa')],'grant_type':_0x8129('0xa'),'client_secret':_0x2d07d5['clientSecret']},'json':!![]};return rp(_0x39ad9b)[_0x8129('0xb')](function(_0x4d25af){return _0x4d25af['access_token'];})[_0x8129('0xc')](function(_0x50fbd4){logger['error']('['+[_0x3d94f8[_0x8129('0xd')]()]+_0x8129('0xe'));return _0x50fbd4[_0x8129('0xf')];});}function getUser(_0x1fcbe0,_0x15942c,_0xce0d4d,_0x562c7f,_0x4dbd35,_0x4027bf){return new BPromise(function(_0x5e7de8,_0x368154){return getAuthToken(_0x15942c,_0x562c7f,_0x4027bf)['then'](function(_0x2f6bf5){var _0x23f01c={'method':'GET','uri':_0x4dbd35+_0x8129('0x10'),'headers':{'Authorization':'Bearer\x20'+_0x2f6bf5,'OData-Version':_0x8129('0x11')},'json':!![]};return rp(_0x23f01c);})[_0x8129('0xb')](function(_0x41e0d3){var _0x56efa1=_0x41e0d3[_0x8129('0x12')];var _0x1ec668=![];var _0x21c6c2=null;if(!_[_0x8129('0x13')](_0xce0d4d)){if(intUtil[_0x8129('0x14')](_0xce0d4d[_0x8129('0x15')])){_0x1fcbe0['userEmail']=_0xce0d4d['email'];for(_0x21c6c2=0x0;_0x21c6c2<_0x56efa1[_0x8129('0x16')];_0x21c6c2++){if(_0x56efa1[_0x21c6c2]['internalemailaddress']===_0xce0d4d[_0x8129('0x15')]&&!_0x56efa1[_0x21c6c2][_0x8129('0x17')]){_0x1ec668=!![];logger[_0x8129('0x18')]('['+[_0x4027bf[_0x8129('0xd')]()]+_0x8129('0x19')+_0x56efa1[_0x21c6c2][_0x8129('0x1a')]+'!');_0x1fcbe0[_0x8129('0x1b')]=_0x56efa1[_0x21c6c2][_0x8129('0x1a')];}}}}if(!_0x1ec668){logger[_0x8129('0x18')]('['+[_0x4027bf[_0x8129('0xd')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1fcbe0[_0x8129('0x1c')]=_0x15942c[_0x8129('0x1d')];for(_0x21c6c2=0x0;_0x21c6c2<_0x56efa1[_0x8129('0x16')];_0x21c6c2++){if(_0x56efa1[_0x21c6c2][_0x8129('0x1e')]===_0x15942c['username']){_0x1fcbe0[_0x8129('0x1b')]=_0x56efa1[_0x21c6c2][_0x8129('0x1a')];}}}_0x5e7de8(_0x1fcbe0);})['catch'](function(_0x36f293){_0x368154(_0x36f293['message']);});});}function createEndUser(_0x193df0,_0x3b6e8e,_0x3aae61,_0x4bbcf4,_0x28d2cb,_0x3a37c0){return new BPromise(function(_0x428cca,_0x4b57f0){return getAuthToken(_0x3b6e8e,_0x3aae61,_0x3a37c0)['then'](function(_0x2e4512){var _0x2ce7c4=_0x3a37c0['toLowerCase']()===_0x8129('0x1f')?_0x28d2cb[_0x8129('0x20')]:_0x28d2cb['calleridnum'];var _0x429ad4={'method':_0x8129('0x21'),'uri':_0x4bbcf4+'contacts','body':{'telephone1':_0x2ce7c4,'fullname':_0x2ce7c4,'firstname':_0x2ce7c4,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8129('0x22')+_0x193df0[_0x8129('0x1b')]+')'},'headers':{'Authorization':_0x8129('0x23')+_0x2e4512,'OData-Version':_0x8129('0x11')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x429ad4);})[_0x8129('0xb')](function(_0x1e48b8){var _0x3708e3=_0x1e48b8[_0x8129('0x24')][_0x8129('0x25')];var _0xcc0ae4=_0x3708e3[_0x8129('0x26')](_0x3708e3['lastIndexOf']('(')+0x1,_0x3708e3['lastIndexOf'](')'));_0x193df0[_0x8129('0x27')]=_0xcc0ae4;_0x428cca(_0x193df0);})[_0x8129('0xc')](function(_0xb3617e){_0x4b57f0(_0xb3617e[_0x8129('0xf')]);});});}function getEndUser(_0x5c20b0,_0x51a643,_0x8d4918,_0x222567,_0x374cc5,_0x301d75){return new BPromise(function(_0x4cbd50,_0x4e5ce9){return getAuthToken(_0x51a643,_0x8d4918,_0x301d75)[_0x8129('0xb')](function(_0x13a934){var _0x19210b={'method':_0x8129('0x28'),'uri':_0x222567+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x13a934,'If-None-Match':null,'OData-Version':_0x8129('0x11')},'json':!![]};return rp(_0x19210b);})['then'](function(_0x23d0d8){var _0x2e937c=null;if(_0x23d0d8){var _0x1c3c3f=_0x23d0d8[_0x8129('0x12')];var _0x11e1b4=![];for(_0x2e937c=0x0;_0x2e937c<_0x1c3c3f[_0x8129('0x16')];_0x2e937c++){var _0x3bfb36=_0x301d75[_0x8129('0x29')]()==='outbound'?_0x374cc5[_0x8129('0x20')]:_0x374cc5[_0x8129('0x2a')];if(_0x1c3c3f[_0x2e937c]['telephone1']===_0x3bfb36){_0x11e1b4=!![];_0x5c20b0['enduserId']=_0x1c3c3f[_0x2e937c]['contactid'];}}if(_0x11e1b4){_0x4cbd50(_0x5c20b0);}else{return createEndUser(_0x5c20b0,_0x51a643,_0x8d4918,_0x222567,_0x374cc5,_0x301d75)[_0x8129('0xb')](function(_0x2e6762){logger[_0x8129('0x18')]('['+[_0x301d75['toUpperCase']()]+_0x8129('0x2b'),_0x2e6762['enduserId']);_0x4cbd50(_0x2e6762);});}}else{return createEndUser(_0x5c20b0,_0x51a643,_0x8d4918,_0x222567,_0x374cc5,_0x301d75)[_0x8129('0xb')](function(_0x1d1fe2){logger[_0x8129('0x18')]('['+[_0x301d75[_0x8129('0xd')]()]+_0x8129('0x2c'),_0x1d1fe2['enduserId']);_0x4cbd50(_0x1d1fe2);});}});});}function getCustomFields(_0x4b4d14,_0x126009,_0x26a42b){var _0x2ab161={};if(_0x4b4d14[_0x8129('0x16')]>0x0){_[_0x8129('0x2d')](_0x4b4d14,function(_0x97dc31){if(_[_0x8129('0x2e')]([_0x8129('0x2f'),_0x8129('0x30')],_0x97dc31[_0x8129('0x31')])&&_0x97dc31[_0x8129('0x32')]&&!_0x97dc31[_0x8129('0x33')]){var _0x3bc3f1=_0x97dc31['idField'][_0x8129('0x29')]();var _0x3efab4=_0x3bc3f1[_0x8129('0x26')](0x0,_0x3bc3f1[_0x8129('0x34')]('_'));var _0x56ef89=_0x3bc3f1['substring'](_0x3bc3f1[_0x8129('0x34')]('_')+0x1);if(_0x3efab4===_0x26a42b){_0x2ab161[_0x56ef89]=_0x97dc31[_0x8129('0x35')];}}});}return _0x2ab161;}function getTicket(_0x55622d,_0x4d144a,_0x4079e3,_0x245316,_0x33aa74,_0x4c5235,_0x567a78){return new BPromise(function(_0x2a5946,_0x4e0247){var _0x4ea935;return getAuthToken(_0x4d144a,_0x4079e3,_0x567a78)[_0x8129('0xb')](function(_0x5d9c02){if(_0x4c5235[_0x8129('0x36')]===_0x8129('0x37')){_0x4ea935={'method':'POST','uri':_0x245316+'incidents','body':Object[_0x8129('0x38')]({},{'title':intUtil[_0x8129('0x39')](_0x4c5235['Subjects'],_0x33aa74,'\x20'),'description':intUtil['getString'](_0x4c5235[_0x8129('0x3a')],_0x33aa74,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x55622d['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x55622d['userId']+')','caseorigincode':'1'},getCustomFields(_0x4c5235[_0x8129('0x3b')],_0x33aa74,_0x4c5235[_0x8129('0x36')])),'headers':{'Authorization':_0x8129('0x23')+_0x5d9c02,'OData-Version':_0x8129('0x11')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4c5235[_0x8129('0x36')]===_0x8129('0x3c')){_0x4ea935={'method':_0x8129('0x21'),'uri':_0x245316+_0x8129('0x3d'),'body':Object[_0x8129('0x38')]({},{'subject':intUtil[_0x8129('0x39')](_0x4c5235['Subjects'],_0x33aa74,'\x20'),'phonenumber':String(_0x33aa74[_0x8129('0x2a')]),'description':intUtil[_0x8129('0x39')](_0x4c5235[_0x8129('0x3a')],_0x33aa74,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8129('0x3e')+_0x55622d[_0x8129('0x27')]+')','ownerid@odata.bind':_0x8129('0x22')+_0x55622d['userId']+')','directioncode':_0x55622d['callDirection']===_0x8129('0x3f')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x8129('0x22')+_0x55622d[_0x8129('0x1b')]+')','participationtypemask':_0x55622d[_0x8129('0x40')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x8129('0x3e')+_0x55622d[_0x8129('0x27')]+')','participationtypemask':_0x55622d[_0x8129('0x40')]==='queue'?0x1:0x2}]},getCustomFields(_0x4c5235[_0x8129('0x3b')],_0x33aa74,_0x4c5235[_0x8129('0x36')])),'headers':{'Authorization':_0x8129('0x23')+_0x5d9c02,'OData-Version':_0x8129('0x11')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4ea935);})[_0x8129('0xb')](function(_0x56bf93){var _0x5a92ff=_0x56bf93[_0x8129('0x24')][_0x8129('0x25')];var _0x25eebd=_0x5a92ff[_0x8129('0x26')](_0x5a92ff['lastIndexOf']('(')+0x1,_0x5a92ff[_0x8129('0x41')](')'));_0x55622d[_0x8129('0x42')]=_0x25eebd;_0x2a5946(_0x55622d);})[_0x8129('0xc')](function(_0x33ec23){_0x4e0247(_0x33ec23['message']);});});}function emit(_0x5c530b,_0x29b0b7,_0x48d1f9,_0x38d132){var _0x268e56={'uri':util['format'](_0x8129('0x43'),_0x5c530b,_0x48d1f9,_0x38d132)};io['to'](util['format'](_0x8129('0x44'),_0x29b0b7))[_0x8129('0x45')](_0x8129('0x46'),_0x268e56);}exports['cs']=function(_0x566742,_0x48b3c7,_0x213013,_0x1a2838,_0x3ec689,_0x570b87,_0x1761f7,_0x37231c){var _0xf89a5a={};_0x570b87['remoteUri']=intUtil[_0x8129('0x47')](_0x570b87[_0x8129('0x48')]);_0x570b87[_0x8129('0x49')]=intUtil[_0x8129('0x47')](_0x570b87[_0x8129('0x49')]);_0xf89a5a[_0x8129('0x40')]=_0x37231c===_0x8129('0x3f')||_0x37231c===_0x8129('0x4a')?'queue':_0x8129('0x1f');var _0xbdeca3=util[_0x8129('0x4b')](_0x8129('0x4c'),_0x570b87[_0x8129('0x48')]);var _0x2da84f=util[_0x8129('0x4b')](_0x8129('0x4d'),_0x570b87[_0x8129('0x4e')]);var _0x557ee7=util['format'](_0x8129('0x4f'),_0x570b87[_0x8129('0x49')],_0x48b3c7[_0x8129('0x50')],md5(_0x48b3c7[_0x8129('0x50')]));if(_0x3ec689&&_0x3ec689[_0x8129('0x51')]){logger['info']('[QUEUE]',_0x8129('0x52'));_0x48b3c7[_0x8129('0x53')]=_0x557ee7;}else if(_0x1761f7&&_0x1761f7['recordingFormat']&&_0x1761f7['recordingFormat']!==_0x8129('0x54')){logger[_0x8129('0x18')](_0x8129('0x55'),_0x8129('0x52'));_0x48b3c7[_0x8129('0x53')]=_0x557ee7;}else{_0x48b3c7[_0x8129('0x53')]='';}return getUser(_0xf89a5a,_0x570b87,_0x1a2838,_0x2da84f,_0xbdeca3,_0x37231c)[_0x8129('0xb')](function(_0xfbfa15){logger['info']('['+_0x37231c[_0x8129('0xd')]()+_0x8129('0x56'),_0xfbfa15[_0x8129('0x1b')]);logger[_0x8129('0x18')]('['+_0x37231c[_0x8129('0xd')]()+_0x8129('0x57'),_0xfbfa15[_0x8129('0x1c')]);return getEndUser(_0xfbfa15,_0x570b87,_0x2da84f,_0xbdeca3,_0x48b3c7,_0x37231c);})[_0x8129('0xb')](function(_0x563543){logger[_0x8129('0x18')]('['+_0x37231c[_0x8129('0xd')]()+_0x8129('0x58'),_0x563543['enduserId']);logger[_0x8129('0x18')]('['+_0x37231c[_0x8129('0xd')]()+_0x8129('0x59'),_0x48b3c7[_0x8129('0x2a')]);return getTicket(_0x563543,_0x570b87,_0x2da84f,_0xbdeca3,_0x48b3c7,_0x213013,_0x37231c);})[_0x8129('0xb')](function(_0x15ac7a){logger[_0x8129('0x18')](util[_0x8129('0x4b')]('['+_0x37231c[_0x8129('0xd')]()+_0x8129('0x5a'),_0x213013[_0x8129('0x36')],_0x15ac7a[_0x8129('0x42')]));logger['info'](util[_0x8129('0x4b')]('['+_0x37231c[_0x8129('0xd')]()+_0x8129('0x5b'),_0x37231c));if(_0x37231c!==_0x8129('0x4a')){logger['info']('['+_0x37231c[_0x8129('0xd')]()+']',_0x8129('0x5c'));emit(_0x570b87['remoteUri'],_0x1a2838[_0x8129('0x5d')],_0x213013['ticketType'],_0x15ac7a[_0x8129('0x42')]);}})[_0x8129('0xc')](function(_0x329b3d){logger['error']('['+_0x37231c[_0x8129('0xd')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x8129('0x5e')](_0x329b3d,{'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 c5b0632..9e7df06 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 _0xef8e=['push','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','user:%s','unmanaged','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','mapValues','keyBy','custom_fields','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','stringify','GET','includes','string','type','nameField','customField','toString','picklist','idField','content','variable','variableName'];(function(_0x428426,_0x306a8a){var _0x2dc25b=function(_0x3c8aae){while(--_0x3c8aae){_0x428426['push'](_0x428426['shift']());}};_0x2dc25b(++_0x306a8a);}(_0xef8e,0x1f0));var _0xeef8=function(_0x553956,_0x57a991){_0x553956=_0x553956-0x0;var _0x2e4172=_0xef8e[_0x553956];return _0x2e4172;};'use strict';var _=require(_0xeef8('0x0'));var rp=require(_0xeef8('0x1'));var md5=require(_0xeef8('0x2'));var util=require(_0xeef8('0x3'));var Redis=require(_0xeef8('0x4'));var intUtil=require(_0xeef8('0x5'));var config=require(_0xeef8('0x6'));var logger=require('../../../../config/logger')(_0xeef8('0x7'));config[_0xeef8('0x8')]=_[_0xeef8('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xeef8('0xa'))(new Redis(config[_0xeef8('0x8')]));var headers={'Content-Type':_0xeef8('0xb'),'Accept':_0xeef8('0xb')};function emit(_0x13084a,_0x5e4dd1,_0x3a5148){io['to'](_0x13084a)['emit'](_0x5e4dd1,_0x3a5148);}function getTicket(_0xb20d12,_0x1f5ec0,_0x1261e5,_0x417853,_0x129de3){logger[_0xeef8('0xc')](_0xeef8('0xd'));var _0x30cc22=_[_0xeef8('0xe')]({'responder_id':_0x1f5ec0['id'],'requester_id':_0x1261e5['id'],'name':util['format'](_0xeef8('0xf'),_0x129de3['calleridname']),'phone':_0x129de3[_0xeef8('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xeef8('0x11')](_0x417853[_0xeef8('0x12')],_0x129de3,'\x20'),'description':intUtil['getString'](_0x417853[_0xeef8('0x13')],_0x129de3,'
'),'tags':getTags(_0x417853[_0xeef8('0x14')],_0xeef8('0x15'))},getCustomFields(_0x417853[_0xeef8('0x16')],_0x129de3));_0x30cc22['custom_fields']=_[_0xeef8('0x17')](_[_0xeef8('0x18')](_0x30cc22[_0xeef8('0x19')],'id'),'value');return request({'uri':util['format'](_0xeef8('0x1a'),_0xb20d12[_0xeef8('0x1b')]),'method':_0xeef8('0x1c'),'body':_0x30cc22})[_0xeef8('0x1d')](function(_0x516657){logger[_0xeef8('0xc')](_0xeef8('0x1e'));return _0x516657;});}function getUser(_0x4fc274,_0x4b53b0){if(intUtil[_0xeef8('0x1f')](_0x4b53b0)){return request({'uri':util['format'](_0xeef8('0x20'),_0x4fc274[_0xeef8('0x1b')]),'qs':{'email':_0x4b53b0}})[_0xeef8('0x1d')](function(_0x690b11){if(_0x690b11[_0xeef8('0x21')]){logger[_0xeef8('0xc')](_0xeef8('0x22'));return _[_0xeef8('0x23')](_0x690b11,function(_0x2d1bb5){return _0x2d1bb5[_0xeef8('0x24')][_0xeef8('0x25')]===_0x4b53b0;});}else{logger['info'](_0xeef8('0x26'));return request({'uri':util[_0xeef8('0x27')]('%s/api/v2/agents/me',_0x4fc274[_0xeef8('0x1b')])})[_0xeef8('0x1d')](function(_0x579775){logger['info'](_0xeef8('0x28'));return _0x579775;});}});}else{logger[_0xeef8('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xeef8('0x27')]('%s/api/v2/agents/me',_0x4fc274[_0xeef8('0x1b')])})[_0xeef8('0x1d')](function(_0x4443b2){logger[_0xeef8('0xc')](_0xeef8('0x28'));return _0x4443b2;});}}function getEndUser(_0x8e0b0c,_0x245c69,_0xed7229){logger['info']('Searching\x20enduser\x20with\x20phone',_0xed7229);return request({'uri':util[_0xeef8('0x27')](_0xeef8('0x29'),_0x8e0b0c['remoteUri']),'qs':{'phone':_0xed7229}})['then'](function(_0x4b421d){if(_0x4b421d[_0xeef8('0x21')]){logger[_0xeef8('0xc')](_0xeef8('0x2a'));return _[_0xeef8('0x23')](_0x4b421d,{'phone':_0xed7229});}else{logger[_0xeef8('0xc')](_0xeef8('0x2b'));return request({'uri':util[_0xeef8('0x27')]('%s/api/v2/contacts',_0x8e0b0c['remoteUri']),'method':'POST','body':{'name':_0x245c69,'phone':_0xed7229}})[_0xeef8('0x1d')](function(_0x230a1b){logger[_0xeef8('0xc')](_0xeef8('0x2c'));return _0x230a1b;});}});}function getAuth(_0x5a5019){return util[_0xeef8('0x27')](_0xeef8('0x2d'),new Buffer(_0x5a5019[_0xeef8('0x2e')]+':X')['toString'](_0xeef8('0x2f')));}function request(_0x8ac95e){logger[_0xeef8('0x30')]('[HTTP]',JSON[_0xeef8('0x31')](_0x8ac95e));return rp(_[_0xeef8('0x9')](_0x8ac95e,{'method':_0xeef8('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x5830f9,_0x20bdd3){var _0x2adc2c=[];if(_0x5830f9&&_0x5830f9[_0xeef8('0x21')]>0x0){_0x2adc2c=_['map'](_0x5830f9,_0x20bdd3);}return _0x2adc2c;}function getCustomFields(_0x509099,_0xdd69fa){var _0x54fbd3=[];var _0x4220f8={'custom_fields':[]};if(_0x509099[_0xeef8('0x21')]>0x0){_['forEach'](_0x509099,function(_0x336c06){if(_[_0xeef8('0x33')]([_0xeef8('0x34'),'picklist'],_0x336c06[_0xeef8('0x35')])&&_0x336c06[_0xeef8('0x36')]&&!_0x336c06[_0xeef8('0x37')]){_0x4220f8[_0x336c06[_0xeef8('0x36')]['toLowerCase']()]=_0x336c06['content'][_0xeef8('0x38')]();}else if(_[_0xeef8('0x33')]([_0xeef8('0x34'),_0xeef8('0x39')],_0x336c06[_0xeef8('0x35')])&&_0x336c06['idField']&&_0x336c06['customField']){_0x4220f8[_0xeef8('0x19')]['push']({'id':_0x336c06[_0xeef8('0x3a')],'value':_0x336c06[_0xeef8('0x3b')]['toString']()});}else if(_0x336c06[_0xeef8('0x35')]===_0xeef8('0x3c')&&_0x336c06[_0xeef8('0x3d')]&&_0x336c06[_0xeef8('0x3a')]&&_0x336c06[_0xeef8('0x37')]){_0xdd69fa[_0x336c06[_0xeef8('0x3d')]]&&_0x4220f8[_0xeef8('0x19')][_0xeef8('0x3e')]({'id':_0x336c06[_0xeef8('0x3a')],'value':_0xdd69fa[_0x336c06[_0xeef8('0x3d')]][_0xeef8('0x38')]()});}else if(_0x336c06[_0xeef8('0x35')]===_0xeef8('0x3f')&&_0x336c06[_0xeef8('0x40')]&&_0x336c06[_0xeef8('0x40')][_0xeef8('0x15')]&&_0x336c06['idField']&&_0x336c06[_0xeef8('0x37')]){_0xdd69fa[_0x336c06[_0xeef8('0x40')][_0xeef8('0x15')][_0xeef8('0x41')]()]&&_0x4220f8['custom_fields'][_0xeef8('0x3e')]({'id':_0x336c06[_0xeef8('0x3a')],'value':_0xdd69fa[_0x336c06[_0xeef8('0x40')][_0xeef8('0x15')][_0xeef8('0x41')]()][_0xeef8('0x38')]()});}});}return _0x4220f8;}exports['queue']=function(_0x1ec5c4,_0x58e439,_0x26bcff,_0x42ea1e,_0x5ccd29,_0x563d2a){var _0xc2b2a2,_0x1244f3;_0x563d2a[_0xeef8('0x1b')]=intUtil[_0xeef8('0x42')](_0x563d2a[_0xeef8('0x1b')]);_0x563d2a[_0xeef8('0x43')]=intUtil[_0xeef8('0x42')](_0x563d2a['serverUrl']);if(_0x5ccd29&&_0x5ccd29[_0xeef8('0x44')]){logger[_0xeef8('0xc')](_0xeef8('0x45'),_0xeef8('0x46'));_0x58e439[_0xeef8('0x47')]=util[_0xeef8('0x27')](_0xeef8('0x48'),_0x563d2a['serverUrl'],_0x58e439[_0xeef8('0x49')],md5(_0x58e439[_0xeef8('0x49')]));}else{_0x58e439[_0xeef8('0x47')]='';}headers['Authorization']=getAuth(_0x563d2a);return getUser(_0x563d2a,_0x42ea1e['email'])[_0xeef8('0x1d')](function(_0x28208e){_0xc2b2a2=_0x28208e;logger[_0xeef8('0xc')](_0xeef8('0x4a'),_0xc2b2a2['id']);return getEndUser(_0x563d2a,_0x58e439[_0xeef8('0x4b')],_0x58e439[_0xeef8('0x10')]);})['then'](function(_0x4ddf7f){_0x1244f3=_0x4ddf7f;logger[_0xeef8('0xc')](_0xeef8('0x4c'),_0x1244f3['id']);return getTicket(_0x563d2a,_0xc2b2a2,_0x1244f3,_0x26bcff,_0x58e439);})[_0xeef8('0x1d')](function(_0x1566ca){if(_0x1566ca&&_0x1566ca['id']){logger[_0xeef8('0xc')](_0xeef8('0x1e'));logger[_0xeef8('0xc')](_0xeef8('0x4d'),_0x1566ca['id']);logger['info'](_0xeef8('0x45'),_0xeef8('0x4e'));emit(util[_0xeef8('0x27')]('user:%s',_0x42ea1e[_0xeef8('0x15')]),_0xeef8('0x4f'),{'uri':util[_0xeef8('0x27')](_0xeef8('0x50'),_0x563d2a[_0xeef8('0x1b')],_0x1566ca['id'])});}})[_0xeef8('0x51')](function(_0x256ad9){logger[_0xeef8('0x52')](_0xeef8('0x45'),JSON[_0xeef8('0x31')](_0x256ad9));});};exports[_0xeef8('0x53')]=function(_0x1e6011,_0x4357f6,_0x3b372d,_0x452515,_0x227968,_0x4956aa,_0x369eaa){var _0x37e34c,_0x4eee78;_0x4956aa[_0xeef8('0x1b')]=intUtil[_0xeef8('0x42')](_0x4956aa[_0xeef8('0x1b')]);_0x4956aa[_0xeef8('0x43')]=intUtil[_0xeef8('0x42')](_0x4956aa['serverUrl']);if(_0x369eaa&&_0x369eaa[_0xeef8('0x54')]&&_0x369eaa[_0xeef8('0x54')]!==_0xeef8('0x55')){logger[_0xeef8('0xc')](_0xeef8('0x56'),'Recording\x20is\x20enabled!');_0x4357f6[_0xeef8('0x47')]=util['format'](_0xeef8('0x48'),_0x4956aa[_0xeef8('0x43')],_0x4357f6[_0xeef8('0x49')],md5(_0x4357f6[_0xeef8('0x49')]));}headers[_0xeef8('0x57')]=getAuth(_0x4956aa);return getUser(_0x4956aa,_0x452515['email'])[_0xeef8('0x1d')](function(_0x56f362){_0x37e34c=_0x56f362;logger['info']('The\x20User\x20ID\x20is:',_0x37e34c['id']);return getEndUser(_0x4956aa,_0x4357f6[_0xeef8('0x58')],_0x4357f6[_0xeef8('0x59')]);})[_0xeef8('0x1d')](function(_0xbc1861){_0x4eee78=_0xbc1861;logger['info'](_0xeef8('0x4c'),_0x4eee78['id']);return getTicket(_0x4956aa,_0x37e34c,_0x4eee78,_0x3b372d,_0x4357f6);})[_0xeef8('0x1d')](function(_0x1c4b2c){if(_0x1c4b2c&&_0x1c4b2c['id']){logger['info']('Ticket\x20created!');logger[_0xeef8('0xc')](_0xeef8('0x4d'),_0x1c4b2c['id']);logger[_0xeef8('0xc')](_0xeef8('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xeef8('0x27')](_0xeef8('0x5a'),_0x452515['name']),_0xeef8('0x4f'),{'uri':util[_0xeef8('0x27')](_0xeef8('0x50'),_0x4956aa[_0xeef8('0x1b')],_0x1c4b2c['id'])});}})[_0xeef8('0x51')](function(_0x229269){logger[_0xeef8('0x52')](_0xeef8('0x56'),JSON[_0xeef8('0x31')](_0x229269));});};exports[_0xeef8('0x5b')]=function(_0x5452f8,_0x163e6f,_0x387240,_0x7898b3,_0x45530e,_0x5b5699){var _0x2a4f68,_0x511adc;_0x5b5699[_0xeef8('0x1b')]=intUtil[_0xeef8('0x42')](_0x5b5699[_0xeef8('0x1b')]);_0x5b5699[_0xeef8('0x43')]=intUtil[_0xeef8('0x42')](_0x5b5699['serverUrl']);if(_0x45530e&&_0x45530e[_0xeef8('0x44')]){logger[_0xeef8('0xc')]('['+_0x163e6f['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x163e6f[_0xeef8('0x47')]=util[_0xeef8('0x27')](_0xeef8('0x48'),_0x5b5699[_0xeef8('0x43')],_0x163e6f[_0xeef8('0x49')],md5(_0x163e6f['uniqueid']));}else{_0x163e6f['recordingURL']='';}headers['Authorization']=getAuth(_0x5b5699);return getUser(_0x5b5699,'')[_0xeef8('0x1d')](function(_0xa7376b){_0x2a4f68=_0xa7376b;logger[_0xeef8('0xc')](_0xeef8('0x4a'),_0x2a4f68['id']);return getEndUser(_0x5b5699,_0x163e6f[_0xeef8('0x4b')],_0x163e6f[_0xeef8('0x10')]);})[_0xeef8('0x1d')](function(_0x182364){_0x511adc=_0x182364;logger[_0xeef8('0xc')](_0xeef8('0x4c'),_0x511adc['id']);return getTicket(_0x5b5699,_0x2a4f68,_0x511adc,_0x387240,_0x163e6f);})[_0xeef8('0x1d')](function(_0x1e6c5d){if(_0x1e6c5d){logger[_0xeef8('0xc')](_0xeef8('0x1e'));logger[_0xeef8('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1e6c5d['id']);}})['catch'](function(_0x5df215){logger[_0xeef8('0x52')]('['+_0x163e6f[_0xeef8('0x5c')]['toUpperCase']()+']',JSON['stringify'](_0x5df215));});}; \ No newline at end of file +var _0xaf83=['picklist','type','nameField','toLowerCase','string','idField','push','content','variable','variableName','customField','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes'];(function(_0x251dd8,_0x501c5f){var _0x431761=function(_0x198460){while(--_0x198460){_0x251dd8['push'](_0x251dd8['shift']());}};_0x431761(++_0x501c5f);}(_0xaf83,0x159));var _0x3af8=function(_0x4b43c0,_0x3a8091){_0x4b43c0=_0x4b43c0-0x0;var _0x574c13=_0xaf83[_0x4b43c0];return _0x574c13;};'use strict';var _=require(_0x3af8('0x0'));var rp=require('request-promise');var md5=require(_0x3af8('0x1'));var util=require(_0x3af8('0x2'));var Redis=require(_0x3af8('0x3'));var intUtil=require(_0x3af8('0x4'));var config=require(_0x3af8('0x5'));var logger=require(_0x3af8('0x6'))('freshdesk');config[_0x3af8('0x7')]=_[_0x3af8('0x8')](config[_0x3af8('0x7')],{'host':_0x3af8('0x9'),'port':0x18eb});var io=require(_0x3af8('0xa'))(new Redis(config[_0x3af8('0x7')]));var headers={'Content-Type':'application/json','Accept':_0x3af8('0xb')};function emit(_0x1c8aff,_0x3bfc86,_0x230353){io['to'](_0x1c8aff)[_0x3af8('0xc')](_0x3bfc86,_0x230353);}function getTicket(_0xc5ecee,_0x34f283,_0x2dfdbc,_0x7ac67,_0x3d3cc7){logger[_0x3af8('0xd')](_0x3af8('0xe'));var _0x52b657=_[_0x3af8('0xf')]({'responder_id':_0x34f283['id'],'requester_id':_0x2dfdbc['id'],'name':util[_0x3af8('0x10')](_0x3af8('0x11'),_0x3d3cc7['calleridname']),'phone':_0x3d3cc7[_0x3af8('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x3af8('0x13')](_0x7ac67[_0x3af8('0x14')],_0x3d3cc7,'\x20'),'description':intUtil['getString'](_0x7ac67[_0x3af8('0x15')],_0x3d3cc7,_0x3af8('0x16')),'tags':getTags(_0x7ac67[_0x3af8('0x17')],_0x3af8('0x18'))},getCustomFields(_0x7ac67[_0x3af8('0x19')],_0x3d3cc7));_0x52b657[_0x3af8('0x1a')]=_[_0x3af8('0x1b')](_[_0x3af8('0x1c')](_0x52b657[_0x3af8('0x1a')],'id'),_0x3af8('0x1d'));return request({'uri':util[_0x3af8('0x10')](_0x3af8('0x1e'),_0xc5ecee[_0x3af8('0x1f')]),'method':_0x3af8('0x20'),'body':_0x52b657})[_0x3af8('0x21')](function(_0x484914){logger[_0x3af8('0xd')](_0x3af8('0x22'));return _0x484914;});}function getUser(_0x1d028d,_0x1b0d20){if(intUtil[_0x3af8('0x23')](_0x1b0d20)){return request({'uri':util[_0x3af8('0x10')](_0x3af8('0x24'),_0x1d028d[_0x3af8('0x1f')]),'qs':{'email':_0x1b0d20}})[_0x3af8('0x21')](function(_0x4f76cd){if(_0x4f76cd[_0x3af8('0x25')]){logger[_0x3af8('0xd')](_0x3af8('0x26'));return _[_0x3af8('0x27')](_0x4f76cd,function(_0x28e0a9){return _0x28e0a9[_0x3af8('0x28')]['email']===_0x1b0d20;});}else{logger[_0x3af8('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3af8('0x10')](_0x3af8('0x29'),_0x1d028d[_0x3af8('0x1f')])})[_0x3af8('0x21')](function(_0x3675e0){logger[_0x3af8('0xd')](_0x3af8('0x2a'));return _0x3675e0;});}});}else{logger[_0x3af8('0xd')](_0x3af8('0x2b'));return request({'uri':util[_0x3af8('0x10')](_0x3af8('0x29'),_0x1d028d['remoteUri'])})[_0x3af8('0x21')](function(_0x3f967a){logger[_0x3af8('0xd')](_0x3af8('0x2a'));return _0x3f967a;});}}function getEndUser(_0x43a579,_0x2abb8a,_0xd0ad36){logger['info'](_0x3af8('0x2c'),_0xd0ad36);return request({'uri':util[_0x3af8('0x10')](_0x3af8('0x2d'),_0x43a579[_0x3af8('0x1f')]),'qs':{'phone':_0xd0ad36}})[_0x3af8('0x21')](function(_0x2c8c48){if(_0x2c8c48[_0x3af8('0x25')]){logger[_0x3af8('0xd')](_0x3af8('0x2e'));return _['find'](_0x2c8c48,{'phone':_0xd0ad36});}else{logger['info'](_0x3af8('0x2f'));return request({'uri':util[_0x3af8('0x10')](_0x3af8('0x2d'),_0x43a579[_0x3af8('0x1f')]),'method':_0x3af8('0x20'),'body':{'name':_0x2abb8a,'phone':_0xd0ad36}})[_0x3af8('0x21')](function(_0x45ef1b){logger[_0x3af8('0xd')]('Enduser\x20created.');return _0x45ef1b;});}});}function getAuth(_0x51676a){return util[_0x3af8('0x10')](_0x3af8('0x30'),new Buffer(_0x51676a[_0x3af8('0x31')]+':X')[_0x3af8('0x32')](_0x3af8('0x33')));}function request(_0x473ec3){logger[_0x3af8('0x34')](_0x3af8('0x35'),JSON[_0x3af8('0x36')](_0x473ec3));return rp(_[_0x3af8('0x8')](_0x473ec3,{'method':_0x3af8('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x4efbfc,_0x30b2fe){var _0x134b34=[];if(_0x4efbfc&&_0x4efbfc['length']>0x0){_0x134b34=_[_0x3af8('0x38')](_0x4efbfc,_0x30b2fe);}return _0x134b34;}function getCustomFields(_0x3102c2,_0x21f2b2){var _0x4f583f=[];var _0xe7636c={'custom_fields':[]};if(_0x3102c2[_0x3af8('0x25')]>0x0){_[_0x3af8('0x39')](_0x3102c2,function(_0x11cdb9){if(_[_0x3af8('0x3a')](['string',_0x3af8('0x3b')],_0x11cdb9[_0x3af8('0x3c')])&&_0x11cdb9[_0x3af8('0x3d')]&&!_0x11cdb9['customField']){_0xe7636c[_0x11cdb9['nameField'][_0x3af8('0x3e')]()]=_0x11cdb9['content'][_0x3af8('0x32')]();}else if(_[_0x3af8('0x3a')]([_0x3af8('0x3f'),_0x3af8('0x3b')],_0x11cdb9[_0x3af8('0x3c')])&&_0x11cdb9[_0x3af8('0x40')]&&_0x11cdb9['customField']){_0xe7636c[_0x3af8('0x1a')][_0x3af8('0x41')]({'id':_0x11cdb9[_0x3af8('0x40')],'value':_0x11cdb9[_0x3af8('0x42')][_0x3af8('0x32')]()});}else if(_0x11cdb9[_0x3af8('0x3c')]===_0x3af8('0x43')&&_0x11cdb9[_0x3af8('0x44')]&&_0x11cdb9[_0x3af8('0x40')]&&_0x11cdb9[_0x3af8('0x45')]){_0x21f2b2[_0x11cdb9[_0x3af8('0x44')]]&&_0xe7636c[_0x3af8('0x1a')][_0x3af8('0x41')]({'id':_0x11cdb9[_0x3af8('0x40')],'value':_0x21f2b2[_0x11cdb9[_0x3af8('0x44')]]['toString']()});}else if(_0x11cdb9[_0x3af8('0x3c')]===_0x3af8('0x46')&&_0x11cdb9[_0x3af8('0x47')]&&_0x11cdb9['Variable'][_0x3af8('0x18')]&&_0x11cdb9['idField']&&_0x11cdb9['customField']){_0x21f2b2[_0x11cdb9['Variable'][_0x3af8('0x18')][_0x3af8('0x3e')]()]&&_0xe7636c[_0x3af8('0x1a')]['push']({'id':_0x11cdb9[_0x3af8('0x40')],'value':_0x21f2b2[_0x11cdb9[_0x3af8('0x47')][_0x3af8('0x18')][_0x3af8('0x3e')]()][_0x3af8('0x32')]()});}});}return _0xe7636c;}exports[_0x3af8('0x48')]=function(_0x6a3960,_0x59902d,_0x33eb87,_0x5a18cb,_0x5ec0b7,_0x4e5817){var _0x1c247d,_0x3f62ff;_0x4e5817[_0x3af8('0x1f')]=intUtil[_0x3af8('0x49')](_0x4e5817['remoteUri']);_0x4e5817[_0x3af8('0x4a')]=intUtil[_0x3af8('0x49')](_0x4e5817[_0x3af8('0x4a')]);if(_0x5ec0b7&&_0x5ec0b7[_0x3af8('0x4b')]){logger[_0x3af8('0xd')](_0x3af8('0x4c'),'Recording\x20is\x20enabled!');_0x59902d[_0x3af8('0x4d')]=util[_0x3af8('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e5817[_0x3af8('0x4a')],_0x59902d['uniqueid'],md5(_0x59902d[_0x3af8('0x4e')]));}else{_0x59902d[_0x3af8('0x4d')]='';}headers['Authorization']=getAuth(_0x4e5817);return getUser(_0x4e5817,_0x5a18cb[_0x3af8('0x4f')])[_0x3af8('0x21')](function(_0x57aded){_0x1c247d=_0x57aded;logger[_0x3af8('0xd')](_0x3af8('0x50'),_0x1c247d['id']);return getEndUser(_0x4e5817,_0x59902d[_0x3af8('0x51')],_0x59902d[_0x3af8('0x12')]);})[_0x3af8('0x21')](function(_0x229ca2){_0x3f62ff=_0x229ca2;logger['info'](_0x3af8('0x52'),_0x3f62ff['id']);return getTicket(_0x4e5817,_0x1c247d,_0x3f62ff,_0x33eb87,_0x59902d);})[_0x3af8('0x21')](function(_0x2b68de){if(_0x2b68de&&_0x2b68de['id']){logger['info']('Ticket\x20created!');logger[_0x3af8('0xd')](_0x3af8('0x53'),_0x2b68de['id']);logger[_0x3af8('0xd')](_0x3af8('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3af8('0x10')](_0x3af8('0x54'),_0x5a18cb[_0x3af8('0x18')]),_0x3af8('0x55'),{'uri':util[_0x3af8('0x10')]('%s/helpdesk/tickets/%d',_0x4e5817[_0x3af8('0x1f')],_0x2b68de['id'])});}})[_0x3af8('0x56')](function(_0x59e5d3){logger[_0x3af8('0x57')](_0x3af8('0x4c'),JSON[_0x3af8('0x36')](_0x59e5d3));});};exports[_0x3af8('0x58')]=function(_0x435f51,_0x220b94,_0x79c71,_0x5bd152,_0x1254fa,_0x3857d2,_0x42f307){var _0x462e9c,_0x26081d;_0x3857d2['remoteUri']=intUtil[_0x3af8('0x49')](_0x3857d2['remoteUri']);_0x3857d2['serverUrl']=intUtil[_0x3af8('0x49')](_0x3857d2[_0x3af8('0x4a')]);if(_0x42f307&&_0x42f307[_0x3af8('0x59')]&&_0x42f307[_0x3af8('0x59')]!=='none'){logger[_0x3af8('0xd')](_0x3af8('0x5a'),_0x3af8('0x5b'));_0x220b94[_0x3af8('0x4d')]=util[_0x3af8('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3857d2[_0x3af8('0x4a')],_0x220b94[_0x3af8('0x4e')],md5(_0x220b94['uniqueid']));}headers[_0x3af8('0x5c')]=getAuth(_0x3857d2);return getUser(_0x3857d2,_0x5bd152[_0x3af8('0x4f')])[_0x3af8('0x21')](function(_0x415c6d){_0x462e9c=_0x415c6d;logger[_0x3af8('0xd')](_0x3af8('0x50'),_0x462e9c['id']);return getEndUser(_0x3857d2,_0x220b94[_0x3af8('0x5d')],_0x220b94[_0x3af8('0x5e')]);})[_0x3af8('0x21')](function(_0x1bfe7c){_0x26081d=_0x1bfe7c;logger[_0x3af8('0xd')](_0x3af8('0x52'),_0x26081d['id']);return getTicket(_0x3857d2,_0x462e9c,_0x26081d,_0x79c71,_0x220b94);})[_0x3af8('0x21')](function(_0x15f59b){if(_0x15f59b&&_0x15f59b['id']){logger[_0x3af8('0xd')]('Ticket\x20created!');logger[_0x3af8('0xd')](_0x3af8('0x53'),_0x15f59b['id']);logger[_0x3af8('0xd')]('[OUTBOUND]',_0x3af8('0x5f'));emit(util[_0x3af8('0x10')](_0x3af8('0x54'),_0x5bd152[_0x3af8('0x18')]),_0x3af8('0x55'),{'uri':util[_0x3af8('0x10')](_0x3af8('0x60'),_0x3857d2[_0x3af8('0x1f')],_0x15f59b['id'])});}})[_0x3af8('0x56')](function(_0x447dd0){logger[_0x3af8('0x57')](_0x3af8('0x5a'),JSON[_0x3af8('0x36')](_0x447dd0));});};exports[_0x3af8('0x61')]=function(_0x3b22fd,_0x2b6add,_0x5d3725,_0x463c39,_0x422702,_0x3089d8){var _0x10248c,_0x1704de;_0x3089d8[_0x3af8('0x1f')]=intUtil['stripTrailingSlash'](_0x3089d8['remoteUri']);_0x3089d8[_0x3af8('0x4a')]=intUtil['stripTrailingSlash'](_0x3089d8[_0x3af8('0x4a')]);if(_0x422702&&_0x422702[_0x3af8('0x4b')]){logger[_0x3af8('0xd')]('['+_0x2b6add[_0x3af8('0x62')][_0x3af8('0x63')]()+']','Recording\x20is\x20enabled!');_0x2b6add[_0x3af8('0x4d')]=util[_0x3af8('0x10')](_0x3af8('0x64'),_0x3089d8['serverUrl'],_0x2b6add[_0x3af8('0x4e')],md5(_0x2b6add[_0x3af8('0x4e')]));}else{_0x2b6add['recordingURL']='';}headers[_0x3af8('0x5c')]=getAuth(_0x3089d8);return getUser(_0x3089d8,'')['then'](function(_0x5e7223){_0x10248c=_0x5e7223;logger[_0x3af8('0xd')]('The\x20User\x20ID\x20is:',_0x10248c['id']);return getEndUser(_0x3089d8,_0x2b6add[_0x3af8('0x51')],_0x2b6add[_0x3af8('0x12')]);})[_0x3af8('0x21')](function(_0x5dff4e){_0x1704de=_0x5dff4e;logger[_0x3af8('0xd')](_0x3af8('0x52'),_0x1704de['id']);return getTicket(_0x3089d8,_0x10248c,_0x1704de,_0x5d3725,_0x2b6add);})[_0x3af8('0x21')](function(_0x5a9108){if(_0x5a9108){logger[_0x3af8('0xd')](_0x3af8('0x22'));logger[_0x3af8('0xd')](_0x3af8('0x53'),_0x5a9108['id']);}})['catch'](function(_0x461f33){logger[_0x3af8('0x57')]('['+_0x2b6add[_0x3af8('0x62')][_0x3af8('0x63')]()+']',JSON[_0x3af8('0x36')](_0x461f33));});}; \ 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 766871b..a4c14a7 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 _0x965d=['Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','localhost','socket.io-emitter','GET','/api/selector/owners','length','email','adminEmail','adminId','Admin\x20found:','error','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','userEmail','info','User\x20found:','userId','Admin\x20selected','Requested\x20Resource\x20not\x20Found','catch','/api/lookup?q=','&f=','&entities=contact','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','YYYY-MM-DDTHH:mm:ss','headers','task','Task\x20created:','ticketId','user:%s','emit'];(function(_0x3d3a63,_0x4f6565){var _0x3e6717=function(_0x367be6){while(--_0x367be6){_0x3d3a63['push'](_0x3d3a63['shift']());}};_0x3e6717(++_0x4f6565);}(_0x965d,0x1be));var _0xd965=function(_0xe9e88a,_0x15376c){_0xe9e88a=_0xe9e88a-0x0;var _0x3ed820=_0x965d[_0xe9e88a];return _0x3ed820;};'use strict';var _=require(_0xd965('0x0'));var rp=require(_0xd965('0x1'));var md5=require('md5');var util=require(_0xd965('0x2'));var moment=require(_0xd965('0x3'));var Promise=require(_0xd965('0x4'));var Redis=require('ioredis');var intUtil=require(_0xd965('0x5'));var config=require(_0xd965('0x6'));var logger=require(_0xd965('0x7'))('freshsales');config['redis']=_['defaults'](config['redis'],{'host':_0xd965('0x8'),'port':0x18eb});var io=require(_0xd965('0x9'))(new Redis(config['redis']));function getAdminId(_0x427868,_0x563c33,_0x358001,_0x1ed34d){return new Promise(function(_0xa4f9f9,_0xb3956f){var _0x59fadc=![];var _0x3d7453={'method':_0xd965('0xa'),'uri':_0x1ed34d+_0xd965('0xb'),'json':!![]};_0x3d7453['headers']=_0x358001;logger['info']('Getting\x20admin\x20information');return rp(_0x3d7453)['then'](function(_0x410aaa){if(_0x410aaa){var _0x21b59d=_0x410aaa['users'];var _0x321065=null;for(_0x321065=0x0;_0x321065<_0x21b59d[_0xd965('0xc')];_0x321065++){if(_0x21b59d[_0x321065][_0xd965('0xd')]===_0x427868[_0xd965('0xe')]){_0x427868[_0xd965('0xf')]=_0x21b59d[_0x321065]['id'];_0x59fadc=!![];}}if(_0x59fadc){logger['info'](_0xd965('0x10'),_0x427868[_0xd965('0xf')]);_0xa4f9f9(_0x427868);}else{_0xb3956f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xb3956f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x30edc3){logger[_0xd965('0x11')]('['+[_0x563c33[_0xd965('0x12')]()]+']',_0x30edc3[_0xd965('0x13')]);_0xb3956f(_0x30edc3);});});}function getUser(_0x4f1960,_0x439eca,_0x236a58){return function(_0x340467){return new Promise(function(_0x233506,_0x45f930){var _0x5dbaff={'method':_0xd965('0xa'),'uri':_0x236a58+'/api/selector/owners','json':!![]};_0x5dbaff['headers']=_0x439eca;logger['info'](_0xd965('0x14'));return rp(_0x5dbaff)[_0xd965('0x15')](function(_0x876ef4){if(_0x876ef4){var _0xabe074=_0x876ef4['users'];var _0x46ccf3=![];var _0x3acaf2=null;if(_0x340467[_0xd965('0x16')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x340467['agentEmail']);_0x340467[_0xd965('0x17')]=_0x340467['agentEmail'];for(_0x3acaf2=0x0;_0x3acaf2<_0xabe074[_0xd965('0xc')];_0x3acaf2++){if(_0xabe074[_0x3acaf2][_0xd965('0xd')]===_0x340467['agentEmail']){_0x46ccf3=!![];_0x340467['userId']=_0xabe074[_0x3acaf2]['id'];logger[_0xd965('0x18')](_0xd965('0x19'),_0x340467[_0xd965('0x1a')]);}}}if(!_0x46ccf3){logger[_0xd965('0x18')](_0xd965('0x1b'));_0x340467[_0xd965('0x17')]=_0x340467[_0xd965('0xe')];_0x340467[_0xd965('0x1a')]=_0x340467[_0xd965('0xf')];_0x46ccf3=!![];}if(_0x46ccf3){_0x233506(_0x340467);}else{_0x45f930({'statusCode':0x194,'message':_0xd965('0x1c')});}}else{_0x45f930({'statusCode':0x194,'message':_0xd965('0x1c')});}})[_0xd965('0x1d')](function(_0x4af63e){logger[_0xd965('0x11')]('['+[_0x4f1960[_0xd965('0x12')]()]+']',_0x4af63e['message']);_0x45f930(_0x4af63e);});});};}function searchContact(_0x47a140,_0x4d6a07,_0x4d5fe8,_0x4fc59f){return new Promise(function(_0x13d11d,_0x182b87){var _0x36fc2c={'method':'GET','headers':_0x4d6a07,'uri':_0x47a140+_0xd965('0x1e')+_0x4fc59f+_0xd965('0x1f')+_0x4d5fe8+_0xd965('0x20'),'json':!![]};rp(_0x36fc2c)['then'](function(_0x280d62){var _0x591ed2=_['find'](_0x280d62[_0xd965('0x21')][_0xd965('0x21')],[_0x4d5fe8,_0x4fc59f]);_0x13d11d(_0x591ed2);})['catch'](function(_0x29b600){_0x182b87(_0x29b600);});});}function getEndUser(_0x5be7a6,_0xec5851,_0x35d404){return function(_0x10fa88){return new Promise(function(_0x9437b2,_0x52202a){logger[_0xd965('0x18')](util[_0xd965('0x22')]('Searching\x20contact\x20with\x20phone\x20%s',_0x10fa88[_0xd965('0x23')]));searchContact(_0x35d404,_0xec5851,_0xd965('0x24'),_0x10fa88['contactNumber'])[_0xd965('0x15')](function(_0x5e36b3){if(_0x5e36b3){_0x10fa88[_0xd965('0x25')]=_0x5e36b3['id'];logger[_0xd965('0x18')](_0xd965('0x26'),_0x10fa88[_0xd965('0x25')]);return _0x9437b2(_0x10fa88);}searchContact(_0x35d404,_0xec5851,'work_number',_0x10fa88[_0xd965('0x23')])[_0xd965('0x15')](function(_0x4e974a){if(_0x4e974a){_0x10fa88[_0xd965('0x25')]=_0x4e974a['id'];logger[_0xd965('0x18')](_0xd965('0x27'),_0x10fa88[_0xd965('0x25')]);return _0x9437b2(_0x10fa88);}createEndUser(_0x10fa88,_0x5be7a6,_0xec5851,_0x35d404)[_0xd965('0x15')](function(_0x32dd2d){logger['info'](_0xd965('0x28'),_0x32dd2d['endUserId']);return _0x9437b2(_0x32dd2d);});});})[_0xd965('0x1d')](function(_0x40b7d7){_0x52202a(_0x40b7d7);});});};}function createEndUser(_0x49caa7,_0x4149a2,_0x7e9d74,_0x17970f){return new Promise(function(_0x844166,_0x99543){var _0x32bd10=moment();var _0x2ee2a3={'method':_0xd965('0x29'),'uri':_0x17970f+_0xd965('0x2a'),'body':{'contact':{'last_name':_0x49caa7[_0xd965('0x23')],'work_number':_0x49caa7['contactNumber'],'mobile_number':_0x49caa7[_0xd965('0x23')],'owner_id':_0x49caa7[_0xd965('0x1a')],'created_at':_0x32bd10[_0xd965('0x22')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x2ee2a3['headers']=_0x7e9d74;logger['info'](_0xd965('0x2b'));return rp(_0x2ee2a3)[_0xd965('0x15')](function(_0x2f3863){_0x49caa7[_0xd965('0x25')]=_0x2f3863[_0xd965('0x2c')]['id'];_0x844166(_0x49caa7);})[_0xd965('0x1d')](function(_0x43da9a){logger[_0xd965('0x11')]('['+[_0x4149a2[_0xd965('0x12')]()]+']',_0x43da9a['message']);_0x99543(_0x43da9a['message']);});});}function getTicket(_0x59501f,_0x3569a9,_0x2d53fb,_0x357656,_0x30cfc5){return function(_0x36d0cd){logger[_0xd965('0x18')](_0xd965('0x2d'));return new Promise(function(_0x19da2d,_0x5c10e7){var _0x3fb2a1=moment();var _0x31b0a0={'method':_0xd965('0x29'),'uri':_0x2d53fb+_0xd965('0x2e'),'body':{'title':intUtil['getString'](_0x357656['Subjects'],_0x30cfc5,'\x20'),'description':intUtil[_0xd965('0x2f')](_0x357656[_0xd965('0x30')],_0x30cfc5,'\x0a'),'owner_id':_0x36d0cd['userId'],'creater_id':_0x36d0cd['adminId'],'targetable_id':_0x36d0cd[_0xd965('0x25')],'targetable_type':_0xd965('0x31'),'created_at':_0x3fb2a1[_0xd965('0x22')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x3fb2a1[_0xd965('0x32')](0x1e,'m')[_0xd965('0x22')](_0xd965('0x33'))},'json':!![]};_0x31b0a0[_0xd965('0x34')]=_0x3569a9;return rp(_0x31b0a0)['then'](function(_0x1671f0){_0x36d0cd['ticketId']=_0x1671f0[_0xd965('0x35')]['id'];logger[_0xd965('0x18')](_0xd965('0x36'),_0x36d0cd[_0xd965('0x37')]);_0x19da2d(_0x36d0cd);})[_0xd965('0x1d')](function(_0xb915ed){logger[_0xd965('0x11')]('['+[_0x59501f[_0xd965('0x12')]()]+']',_0xb915ed[_0xd965('0x13')]);_0x5c10e7(_0xb915ed['message']);});});};}function emit(_0xa5b2cf,_0x543688,_0x36e296){var _0x506cf1={'uri':_0xa5b2cf+'/contacts/'+_0x36e296};io['to'](util['format'](_0xd965('0x38'),_0x543688))[_0xd965('0x39')]('trigger:browser:url',_0x506cf1);}exports['cs']=function(_0x3f5e50,_0x4e2666,_0x2361c0,_0x1fee3c,_0x57a3b2,_0x2c1754,_0x37d3ce,_0x107254){var _0x54d001={};var _0x57ef85={'Authorization':_0xd965('0x3a')+_0x2c1754[_0xd965('0x3b')]};_0x2c1754['remoteUri']=intUtil[_0xd965('0x3c')](_0x2c1754[_0xd965('0x3d')]);_0x2c1754[_0xd965('0x3e')]=intUtil[_0xd965('0x3c')](_0x2c1754['serverUrl']);var _0x1e4ac1=_0x2c1754['remoteUri'];_0x54d001['adminEmail']=_0x2c1754[_0xd965('0x3f')];_0x54d001['contactNumber']=_0x107254[_0xd965('0x40')]()===_0xd965('0x41')?_0x4e2666[_0xd965('0x42')]:_0x4e2666[_0xd965('0x43')];_0x54d001[_0xd965('0x44')]=_0x107254===_0xd965('0x45')||_0x107254===_0xd965('0x46')?_0xd965('0x45'):'outbound';if(_0x1fee3c){_0x54d001['agentEmail']=_0x1fee3c[_0xd965('0xd')];}var _0x1d5d6c=util[_0xd965('0x22')](_0xd965('0x47'),_0x2c1754[_0xd965('0x3e')],_0x4e2666[_0xd965('0x48')],md5(_0x4e2666[_0xd965('0x48')]));if(_0x57a3b2&&_0x57a3b2['monitor_format']){logger[_0xd965('0x18')](_0xd965('0x49'),'Recording\x20is\x20enabled!');_0x4e2666[_0xd965('0x4a')]=_0x1d5d6c;}else if(_0x37d3ce&&_0x37d3ce[_0xd965('0x4b')]&&_0x37d3ce[_0xd965('0x4b')]!==_0xd965('0x4c')){logger[_0xd965('0x18')](_0xd965('0x4d'),_0xd965('0x4e'));_0x4e2666[_0xd965('0x4a')]=_0x1d5d6c;}else{_0x4e2666['recordingURL']='';}return getAdminId(_0x54d001,_0x107254,_0x57ef85,_0x1e4ac1)[_0xd965('0x15')](getUser(_0x107254,_0x57ef85,_0x1e4ac1))['then'](getEndUser(_0x107254,_0x57ef85,_0x1e4ac1))['then'](getTicket(_0x107254,_0x57ef85,_0x1e4ac1,_0x2361c0,_0x4e2666))[_0xd965('0x15')](function(_0x50e4d9){logger[_0xd965('0x18')](util[_0xd965('0x22')](_0xd965('0x4f'),_0x50e4d9[_0xd965('0x37')]));if(_0x107254!==_0xd965('0x46')){logger[_0xd965('0x18')]('['+[_0x107254[_0xd965('0x12')]()]+']',_0xd965('0x50'));emit(_0x1e4ac1,_0x1fee3c[_0xd965('0x51')],_0x50e4d9[_0xd965('0x25')]);}})[_0xd965('0x1d')](function(_0x2047da){logger[_0xd965('0x11')]('['+[_0x107254[_0xd965('0x12')]()]+_0xd965('0x52'),util[_0xd965('0x53')](_0x2047da,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x63b6=['YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','add','ticketId','task','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','ioredis','../../../../config/environment','../../../../config/logger','freshsales','defaults','localhost','redis','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST'];(function(_0x33089b,_0x5b755d){var _0x3299b9=function(_0xdba16b){while(--_0xdba16b){_0x33089b['push'](_0x33089b['shift']());}};_0x3299b9(++_0x5b755d);}(_0x63b6,0x127));var _0x663b=function(_0x2f5638,_0x3f4643){_0x2f5638=_0x2f5638-0x0;var _0x35507f=_0x63b6[_0x2f5638];return _0x35507f;};'use strict';var _=require(_0x663b('0x0'));var rp=require(_0x663b('0x1'));var md5=require(_0x663b('0x2'));var util=require('util');var moment=require(_0x663b('0x3'));var Promise=require('bluebird');var Redis=require(_0x663b('0x4'));var intUtil=require('./util');var config=require(_0x663b('0x5'));var logger=require(_0x663b('0x6'))(_0x663b('0x7'));config['redis']=_[_0x663b('0x8')](config['redis'],{'host':_0x663b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x663b('0xa')]));function getAdminId(_0x2976ff,_0xf8f3ff,_0x3ed933,_0x27b455){return new Promise(function(_0x1e1698,_0x4a9838){var _0x31106e=![];var _0x1a00e3={'method':_0x663b('0xb'),'uri':_0x27b455+_0x663b('0xc'),'json':!![]};_0x1a00e3[_0x663b('0xd')]=_0x3ed933;logger[_0x663b('0xe')](_0x663b('0xf'));return rp(_0x1a00e3)[_0x663b('0x10')](function(_0xcbc917){if(_0xcbc917){var _0x38f7eb=_0xcbc917['users'];var _0x544643=null;for(_0x544643=0x0;_0x544643<_0x38f7eb[_0x663b('0x11')];_0x544643++){if(_0x38f7eb[_0x544643][_0x663b('0x12')]===_0x2976ff[_0x663b('0x13')]){_0x2976ff[_0x663b('0x14')]=_0x38f7eb[_0x544643]['id'];_0x31106e=!![];}}if(_0x31106e){logger[_0x663b('0xe')](_0x663b('0x15'),_0x2976ff['adminId']);_0x1e1698(_0x2976ff);}else{_0x4a9838({'statusCode':0x194,'message':_0x663b('0x16')});}}else{_0x4a9838({'statusCode':0x194,'message':_0x663b('0x16')});}})[_0x663b('0x17')](function(_0x1f8238){logger[_0x663b('0x18')]('['+[_0xf8f3ff[_0x663b('0x19')]()]+']',_0x1f8238[_0x663b('0x1a')]);_0x4a9838(_0x1f8238);});});}function getUser(_0x24bad9,_0x63443b,_0x1b9fef){return function(_0x26a596){return new Promise(function(_0x4d5afd,_0x14be5c){var _0x327a42={'method':'GET','uri':_0x1b9fef+_0x663b('0xc'),'json':!![]};_0x327a42[_0x663b('0xd')]=_0x63443b;logger['info'](_0x663b('0x1b'));return rp(_0x327a42)[_0x663b('0x10')](function(_0x50786f){if(_0x50786f){var _0x593db6=_0x50786f[_0x663b('0x1c')];var _0x12a5b7=![];var _0x33a6b9=null;if(_0x26a596[_0x663b('0x1d')]!==null){logger['info'](_0x663b('0x1e'),_0x26a596[_0x663b('0x1d')]);_0x26a596['userEmail']=_0x26a596['agentEmail'];for(_0x33a6b9=0x0;_0x33a6b9<_0x593db6['length'];_0x33a6b9++){if(_0x593db6[_0x33a6b9]['email']===_0x26a596[_0x663b('0x1d')]){_0x12a5b7=!![];_0x26a596[_0x663b('0x1f')]=_0x593db6[_0x33a6b9]['id'];logger[_0x663b('0xe')](_0x663b('0x20'),_0x26a596[_0x663b('0x1f')]);}}}if(!_0x12a5b7){logger[_0x663b('0xe')](_0x663b('0x21'));_0x26a596[_0x663b('0x22')]=_0x26a596[_0x663b('0x13')];_0x26a596['userId']=_0x26a596[_0x663b('0x14')];_0x12a5b7=!![];}if(_0x12a5b7){_0x4d5afd(_0x26a596);}else{_0x14be5c({'statusCode':0x194,'message':_0x663b('0x16')});}}else{_0x14be5c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x663b('0x17')](function(_0x54bb0d){logger[_0x663b('0x18')]('['+[_0x24bad9[_0x663b('0x19')]()]+']',_0x54bb0d[_0x663b('0x1a')]);_0x14be5c(_0x54bb0d);});});};}function searchContact(_0x513bdd,_0x397e4b,_0x10f2e0,_0x3a3ebc){return new Promise(function(_0x439fc6,_0x5a1580){var _0x4ef875={'method':'GET','headers':_0x397e4b,'uri':_0x513bdd+_0x663b('0x23')+_0x3a3ebc+_0x663b('0x24')+_0x10f2e0+'&entities=contact','json':!![]};rp(_0x4ef875)[_0x663b('0x10')](function(_0x5580e4){var _0x5134c8=_[_0x663b('0x25')](_0x5580e4[_0x663b('0x26')][_0x663b('0x26')],[_0x10f2e0,_0x3a3ebc]);_0x439fc6(_0x5134c8);})['catch'](function(_0x4a165a){_0x5a1580(_0x4a165a);});});}function getEndUser(_0x1aa8a9,_0x8a87da,_0x2e4c3c){return function(_0x38aeb3){return new Promise(function(_0x429f56,_0x4398ab){logger[_0x663b('0xe')](util[_0x663b('0x27')](_0x663b('0x28'),_0x38aeb3[_0x663b('0x29')]));searchContact(_0x2e4c3c,_0x8a87da,_0x663b('0x2a'),_0x38aeb3[_0x663b('0x29')])[_0x663b('0x10')](function(_0x22b48f){if(_0x22b48f){_0x38aeb3['endUserId']=_0x22b48f['id'];logger['info'](_0x663b('0x2b'),_0x38aeb3[_0x663b('0x2c')]);return _0x429f56(_0x38aeb3);}searchContact(_0x2e4c3c,_0x8a87da,_0x663b('0x2d'),_0x38aeb3['contactNumber'])['then'](function(_0x507b20){if(_0x507b20){_0x38aeb3['endUserId']=_0x507b20['id'];logger['info'](_0x663b('0x2e'),_0x38aeb3[_0x663b('0x2c')]);return _0x429f56(_0x38aeb3);}createEndUser(_0x38aeb3,_0x1aa8a9,_0x8a87da,_0x2e4c3c)[_0x663b('0x10')](function(_0x1306d3){logger[_0x663b('0xe')](_0x663b('0x2f'),_0x1306d3['endUserId']);return _0x429f56(_0x1306d3);});});})[_0x663b('0x17')](function(_0x4635db){_0x4398ab(_0x4635db);});});};}function createEndUser(_0x4f8a95,_0x4a411f,_0x15139a,_0x42625b){return new Promise(function(_0x23dab2,_0x56a0b1){var _0x587ad7=moment();var _0x2208eb={'method':_0x663b('0x30'),'uri':_0x42625b+'/api/contacts','body':{'contact':{'last_name':_0x4f8a95[_0x663b('0x29')],'work_number':_0x4f8a95[_0x663b('0x29')],'mobile_number':_0x4f8a95[_0x663b('0x29')],'owner_id':_0x4f8a95['userId'],'created_at':_0x587ad7[_0x663b('0x27')](_0x663b('0x31'))}},'json':!![]};_0x2208eb['headers']=_0x15139a;logger[_0x663b('0xe')](_0x663b('0x32'));return rp(_0x2208eb)[_0x663b('0x10')](function(_0x48e927){_0x4f8a95[_0x663b('0x2c')]=_0x48e927[_0x663b('0x33')]['id'];_0x23dab2(_0x4f8a95);})[_0x663b('0x17')](function(_0x5bf84d){logger[_0x663b('0x18')]('['+[_0x4a411f[_0x663b('0x19')]()]+']',_0x5bf84d['message']);_0x56a0b1(_0x5bf84d[_0x663b('0x1a')]);});});}function getTicket(_0x5a73fa,_0xf8d17f,_0x2bc7d0,_0x4662b9,_0x100844){return function(_0x5bd121){logger[_0x663b('0xe')](_0x663b('0x34'));return new Promise(function(_0x58eae5,_0x2247c8){var _0x300545=moment();var _0xc703c1={'method':_0x663b('0x30'),'uri':_0x2bc7d0+_0x663b('0x35'),'body':{'title':intUtil['getString'](_0x4662b9[_0x663b('0x36')],_0x100844,'\x20'),'description':intUtil[_0x663b('0x37')](_0x4662b9[_0x663b('0x38')],_0x100844,'\x0a'),'owner_id':_0x5bd121[_0x663b('0x1f')],'creater_id':_0x5bd121[_0x663b('0x14')],'targetable_id':_0x5bd121[_0x663b('0x2c')],'targetable_type':'Contact','created_at':_0x300545[_0x663b('0x27')](_0x663b('0x31')),'due_date':_0x300545[_0x663b('0x39')](0x1e,'m')[_0x663b('0x27')](_0x663b('0x31'))},'json':!![]};_0xc703c1[_0x663b('0xd')]=_0xf8d17f;return rp(_0xc703c1)[_0x663b('0x10')](function(_0xa30c0d){_0x5bd121[_0x663b('0x3a')]=_0xa30c0d[_0x663b('0x3b')]['id'];logger[_0x663b('0xe')]('Task\x20created:',_0x5bd121[_0x663b('0x3a')]);_0x58eae5(_0x5bd121);})[_0x663b('0x17')](function(_0x336aee){logger[_0x663b('0x18')]('['+[_0x5a73fa[_0x663b('0x19')]()]+']',_0x336aee[_0x663b('0x1a')]);_0x2247c8(_0x336aee[_0x663b('0x1a')]);});});};}function emit(_0x3809d9,_0x17c438,_0x1ce4c8){var _0x57bcc9={'uri':_0x3809d9+_0x663b('0x3c')+_0x1ce4c8};io['to'](util[_0x663b('0x27')]('user:%s',_0x17c438))[_0x663b('0x3d')](_0x663b('0x3e'),_0x57bcc9);}exports['cs']=function(_0x10ae27,_0x4a4ff5,_0x51f206,_0x56248c,_0x3153f0,_0x5121aa,_0x1cc077,_0x31e831){var _0x4a05ef={};var _0x326b26={'Authorization':_0x663b('0x3f')+_0x5121aa[_0x663b('0x40')]};_0x5121aa[_0x663b('0x41')]=intUtil[_0x663b('0x42')](_0x5121aa['remoteUri']);_0x5121aa[_0x663b('0x43')]=intUtil[_0x663b('0x42')](_0x5121aa['serverUrl']);var _0x596ff4=_0x5121aa[_0x663b('0x41')];_0x4a05ef[_0x663b('0x13')]=_0x5121aa[_0x663b('0x44')];_0x4a05ef[_0x663b('0x29')]=_0x31e831[_0x663b('0x45')]()===_0x663b('0x46')?_0x4a4ff5['destcalleridnum']:_0x4a4ff5[_0x663b('0x47')];_0x4a05ef[_0x663b('0x48')]=_0x31e831===_0x663b('0x49')||_0x31e831===_0x663b('0x4a')?_0x663b('0x49'):_0x663b('0x46');if(_0x56248c){_0x4a05ef[_0x663b('0x1d')]=_0x56248c[_0x663b('0x12')];}var _0x3d641a=util[_0x663b('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5121aa[_0x663b('0x43')],_0x4a4ff5[_0x663b('0x4b')],md5(_0x4a4ff5[_0x663b('0x4b')]));if(_0x3153f0&&_0x3153f0['monitor_format']){logger[_0x663b('0xe')](_0x663b('0x4c'),_0x663b('0x4d'));_0x4a4ff5[_0x663b('0x4e')]=_0x3d641a;}else if(_0x1cc077&&_0x1cc077['recordingFormat']&&_0x1cc077[_0x663b('0x4f')]!==_0x663b('0x50')){logger[_0x663b('0xe')]('[OUTBOUND]',_0x663b('0x4d'));_0x4a4ff5['recordingURL']=_0x3d641a;}else{_0x4a4ff5['recordingURL']='';}return getAdminId(_0x4a05ef,_0x31e831,_0x326b26,_0x596ff4)[_0x663b('0x10')](getUser(_0x31e831,_0x326b26,_0x596ff4))['then'](getEndUser(_0x31e831,_0x326b26,_0x596ff4))[_0x663b('0x10')](getTicket(_0x31e831,_0x326b26,_0x596ff4,_0x51f206,_0x4a4ff5))[_0x663b('0x10')](function(_0x96d5ce){logger['info'](util['format'](_0x663b('0x51'),_0x96d5ce[_0x663b('0x3a')]));if(_0x31e831!=='unmanaged'){logger['info']('['+[_0x31e831[_0x663b('0x19')]()]+']',_0x663b('0x52'));emit(_0x596ff4,_0x56248c[_0x663b('0x53')],_0x96d5ce[_0x663b('0x2c')]);}})[_0x663b('0x17')](function(_0xece6d6){logger['error']('['+[_0x31e831[_0x663b('0x19')]()]+_0x663b('0x54'),util[_0x663b('0x55')](_0xece6d6,{'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 0be8348..bc85e9b 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 _0xbaf0=['format','%s\x20configuration\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]'];(function(_0x512de,_0x40bc90){var _0xd4c561=function(_0x372081){while(--_0x372081){_0x512de['push'](_0x512de['shift']());}};_0xd4c561(++_0x40bc90);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var zendesk=require(_0x0baf('0x1'));var salesforce=require(_0x0baf('0x2'));var sugarcrm=require(_0x0baf('0x3'));var freshdesk=require(_0x0baf('0x4'));var zoho=require(_0x0baf('0x5'));var desk=require('./desk');var vtiger=require(_0x0baf('0x6'));var servicenow=require(_0x0baf('0x7'));var dynamics365=require(_0x0baf('0x8'));var freshsales=require(_0x0baf('0x9'));var integrations=[_0x0baf('0xa'),_0x0baf('0xb'),_0x0baf('0xc'),_0x0baf('0xd'),_0x0baf('0xe'),'desk',_0x0baf('0xf'),'dynamics365',_0x0baf('0x10'),_0x0baf('0x11')];exports[_0x0baf('0x12')]=function(_0x2f46e8,_0x7f54d4,_0xf4c8ac,_0x41cead,_0x245a6b,_0x1fc6b2){if(_0xf4c8ac){if(_[_0x0baf('0x13')](integrations,_0x2f46e8[_0x0baf('0x14')]['toLowerCase']())){try{var _0x5a53e2=null;var _0x465dd7='';var _0xe4378c=_0xf4c8ac[_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')]()];if(_0xe4378c){var _0x5a0583=_0xe4378c[_0x2f46e8[_0x0baf('0x16')]];if(_0x5a0583){var _0x49e44b=_[_0x0baf('0x17')](_0x5a0583[_0x0baf('0x18')],{'id':parseInt(_0x2f46e8[_0x0baf('0x19')],0xa)});if(_0x49e44b){if(_0x41cead){if(_0x245a6b&&_0x7f54d4[_0x0baf('0x1a')]){_0x465dd7=_0x0baf('0x1a');}else if(_0x7f54d4[_0x0baf('0x1b')]){_0x465dd7='outbound';}else{console['log'](_0x0baf('0x1c'),_0x7f54d4);}}else{_0x465dd7=_0x0baf('0x1d');}switch(_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')]()){case _0x0baf('0xa'):zendesk[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xb'):salesforce[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case'sugarcrm':sugarcrm[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xd'):freshdesk[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xe'):zoho[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0x1e'):desk[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xf'):vtiger[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0x10'):freshsales['cs'](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2,_0x465dd7);break;case _0x0baf('0x11'):servicenow['cs'](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2,_0x465dd7);break;case'dynamics365':dynamics365['cs'](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2,_0x465dd7);break;default:console['log'](_0x0baf('0x1f'));}}else{_0x5a53e2=require(_0x0baf('0x20'))(_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')]());_0x5a53e2[_0x0baf('0x21')](_0x0baf('0x22'),util[_0x0baf('0x23')](_0x0baf('0x24'),_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')](),_0x2f46e8['data3']));}}else{_0x5a53e2=require(_0x0baf('0x20'))(_0x2f46e8['data1'][_0x0baf('0x15')]());_0x5a53e2['error']('[EXEC]',util[_0x0baf('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x2f46e8['data1'][_0x0baf('0x15')](),_0x2f46e8[_0x0baf('0x16')]));}}else{}}catch(_0x34e264){console[_0x0baf('0x21')](_0x34e264);}}}}; \ No newline at end of file +var _0xb688=['[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data3','queue','log','unmanaged','zendesk','sugarcrm','unknown\x20integration','../../../../config/logger','error'];(function(_0x39670f,_0x5f8d75){var _0x3b5de1=function(_0x57b973){while(--_0x57b973){_0x39670f['push'](_0x39670f['shift']());}};_0x3b5de1(++_0x5f8d75);}(_0xb688,0xcf));var _0x8b68=function(_0x25fc4f,_0x1fd85b){_0x25fc4f=_0x25fc4f-0x0;var _0x110dd0=_0xb688[_0x25fc4f];return _0x110dd0;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var zendesk=require(_0x8b68('0x1'));var salesforce=require(_0x8b68('0x2'));var sugarcrm=require(_0x8b68('0x3'));var freshdesk=require(_0x8b68('0x4'));var zoho=require(_0x8b68('0x5'));var desk=require('./desk');var vtiger=require(_0x8b68('0x6'));var servicenow=require(_0x8b68('0x7'));var dynamics365=require(_0x8b68('0x8'));var freshsales=require(_0x8b68('0x9'));var integrations=['zendesk',_0x8b68('0xa'),'sugarcrm',_0x8b68('0xb'),_0x8b68('0xc'),_0x8b68('0xd'),_0x8b68('0xe'),_0x8b68('0xf'),_0x8b68('0x10'),_0x8b68('0x11')];exports[_0x8b68('0x12')]=function(_0x24e0b0,_0x2f2e3c,_0x418775,_0x317d01,_0x2a852a,_0x502727){if(_0x418775){if(_[_0x8b68('0x13')](integrations,_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]())){try{var _0x2d8472=null;var _0x1965cf='';var _0x2f3af4=_0x418775[_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]()];if(_0x2f3af4){var _0x2686c7=_0x2f3af4[_0x24e0b0['data2']];if(_0x2686c7){var _0xb2df35=_['find'](_0x2686c7['Configurations'],{'id':parseInt(_0x24e0b0[_0x8b68('0x16')],0xa)});if(_0xb2df35){if(_0x317d01){if(_0x2a852a&&_0x2f2e3c[_0x8b68('0x17')]){_0x1965cf=_0x8b68('0x17');}else if(_0x2f2e3c['routeId']){_0x1965cf='outbound';}else{console[_0x8b68('0x18')]('EVENT\x20UNKNOWN',_0x2f2e3c);}}else{_0x1965cf=_0x8b68('0x19');}switch(_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]()){case _0x8b68('0x1a'):zendesk[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case'salesforce':salesforce[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0x1b'):sugarcrm[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0xb'):freshdesk[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case'zoho':zoho[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0xd'):desk[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0xe'):vtiger[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0x10'):freshsales['cs'](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727,_0x1965cf);break;case _0x8b68('0x11'):servicenow['cs'](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727,_0x1965cf);break;case _0x8b68('0xf'):dynamics365['cs'](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727,_0x1965cf);break;default:console['log'](_0x8b68('0x1c'));}}else{_0x2d8472=require(_0x8b68('0x1d'))(_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]());_0x2d8472[_0x8b68('0x1e')](_0x8b68('0x1f'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x24e0b0[_0x8b68('0x14')]['toLowerCase'](),_0x24e0b0[_0x8b68('0x16')]));}}else{_0x2d8472=require(_0x8b68('0x1d'))(_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]());_0x2d8472[_0x8b68('0x1e')](_0x8b68('0x1f'),util['format'](_0x8b68('0x20'),_0x24e0b0[_0x8b68('0x14')]['toLowerCase'](),_0x24e0b0[_0x8b68('0x21')]));}}else{}}catch(_0x3cf8d2){console[_0x8b68('0x1e')](_0x3cf8d2);}}}}; \ 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 ee7b115..18aa9c2 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 _0xb561=['leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','find','Email','info','Agent\x20%s\x20found.','resolve','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','length','merge','account_contact_lead','additionalSearchAccount','Account','Contact','additionalSearchLead','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','forEach','includes','string','picklist','content','toString','variable','variableName','name','idField','Variable','password','concat','securityToken','Connection','remoteUri','clientId','username','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','contact','ContactId','AccountId'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xb561,0x66));var _0x1b56=function(_0x4a4894,_0x2aaefd){_0x4a4894=_0x4a4894-0x0;var _0x56b6d9=_0xb561[_0x4a4894];return _0x56b6d9;};'use strict';var _=require(_0x1b56('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1b56('0x1'));var md5=require(_0x1b56('0x2'));var jsforce=require('jsforce');var util=require(_0x1b56('0x3'));var Redis=require(_0x1b56('0x4'));var intUtil=require(_0x1b56('0x5'));var config=require(_0x1b56('0x6'));var logger=require(_0x1b56('0x7'))(_0x1b56('0x8'));config[_0x1b56('0x9')]=_[_0x1b56('0xa')](config['redis'],{'host':_0x1b56('0xb'),'port':0x18eb});var io=require(_0x1b56('0xc'))(new Redis(config[_0x1b56('0x9')]));function emit(_0x11ac51,_0x29adb5,_0x40e2fe){io['to'](_0x11ac51)[_0x1b56('0xd')](_0x29adb5,_0x40e2fe);}function getTicket(_0x2234cc,_0x361f4a,_0xb9093a,_0x3e5215,_0x374bf6,_0x348883,_0x466333,_0x3f6fbd){var _0x3a1945=Object[_0x1b56('0xe')]({},{'OwnerId':_0x361f4a['id'],'Subject':intUtil[_0x1b56('0xf')](_0x3e5215['Subjects'],_0x374bf6,'\x20'),'Description':intUtil['getString'](_0x3e5215[_0x1b56('0x10')],_0x374bf6,'\x0a')},getCustomFields(_0x348883,_0x374bf6));if(_0xb9093a){if(_0x3e5215[_0x1b56('0x11')]===_0x1b56('0x12')){_0x3a1945[_0x1b56('0x13')]=moment[_0x1b56('0x14')]();_0x3a1945[_0x1b56('0x15')]=![];_0x3a1945[_0x1b56('0x16')]=![];if(_0xb9093a[_0x1b56('0x17')]==='contact'||_0xb9093a['endUserType']===_0x1b56('0x18')){_0x3a1945[_0x1b56('0x19')]=_0xb9093a['id'];}else if(_0xb9093a['endUserType']===_0x1b56('0x1a')){_0x3a1945[_0x1b56('0x1b')]=_0xb9093a['id'];}}else if(_0x3e5215['ticketType']==='Case'){if(_0xb9093a['endUserType']===_0x1b56('0x1c')){_0x3a1945[_0x1b56('0x1d')]=_0xb9093a['id'];}else if(_0xb9093a['endUserType']===_0x1b56('0x1a')){_0x3a1945[_0x1b56('0x1e')]=_0xb9093a['id'];}else if(_0xb9093a[_0x1b56('0x17')]===_0x1b56('0x18')&&_0x3e5215[_0x1b56('0x1f')]){_0x3a1945[_0x3e5215['leadId']]=_0xb9093a['id'];}else{logger['info'](_0x1b56('0x20'));}}}return _0x466333[_0x1b56('0x21')](_0x3e5215['ticketType'])[_0x1b56('0x22')](_0x3a1945);}function getUser(_0x342d58,_0x5748e8,_0x3f533f){if(!_[_0x1b56('0x23')](_0x5748e8)&&intUtil[_0x1b56('0x24')](_0x5748e8)){var _0x1ce9b4={'Email':_0x5748e8};var _0x106eee={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3f533f[_0x1b56('0x21')](_0x1b56('0x25'))['find'](_0x1ce9b4,_0x106eee)[_0x1b56('0x26')]()[_0x1b56('0x27')](function(_0x2b4a84){if(_0x2b4a84['length']){var _0x5a4062=_[_0x1b56('0x28')](_0x2b4a84,function(_0x599fa3){return _0x599fa3[_0x1b56('0x29')]===_0x5748e8;});if(_0x5a4062){logger[_0x1b56('0x2a')](_0x1b56('0x2b'),_0x5748e8);return BPromise[_0x1b56('0x2c')]({'id':_0x5a4062['Id'],'name':_0x5a4062['Name']});}}else{logger[_0x1b56('0x2a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5748e8);return _0x3f533f[_0x1b56('0x2d')]()[_0x1b56('0x27')](function(_0x2ccef0){return BPromise[_0x1b56('0x2c')]({'id':_0x2ccef0[_0x1b56('0x2e')],'name':_0x2ccef0[_0x1b56('0x2f')]});});}});}else{logger['info'](_0x1b56('0x30'),_0x5748e8);return _0x3f533f[_0x1b56('0x2d')]()[_0x1b56('0x27')](function(_0x8e860f){return BPromise[_0x1b56('0x2c')]({'id':_0x8e860f[_0x1b56('0x2e')],'name':_0x8e860f['display_name']});});}}function getEndUser(_0x205d7d,_0x146b91,_0x282c99,_0x34d400,_0x283563){var _0x3bd5e2={'$or':{'Phone':_0x34d400}};var _0x7d9541={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x1b56('0x27')](function(){logger[_0x1b56('0x2a')](_0x1b56('0x31'),_0x34d400,_0x146b91['moduleSearch']);switch(_0x146b91[_0x1b56('0x32')]){case _0x1b56('0x33'):var _0x4392ba=_[_0x1b56('0x34')](_0x3bd5e2);if(_0x146b91[_0x1b56('0x35')]){var _0x704d7c={};_0x704d7c[_0x146b91[_0x1b56('0x35')]]=_0x34d400;_['merge'](_0x4392ba[_0x1b56('0x36')],_0x704d7c);}return _0x283563['sobject']('Contact')[_0x1b56('0x28')](_0x4392ba,_0x7d9541)[_0x1b56('0x26')]()[_0x1b56('0x27')](function(_0x4996d6){if(_0x4996d6&&_0x4996d6[_0x1b56('0x37')]){return _0x4996d6;}else{var _0x1dcc38=_['cloneDeep'](_0x3bd5e2);if(_0x146b91['additionalSearchLead']){var _0x30a1a9={};_0x30a1a9[_0x146b91['additionalSearchLead']]=_0x34d400;_[_0x1b56('0x38')](_0x1dcc38[_0x1b56('0x36')],_0x30a1a9);}return _0x283563['sobject']('Lead')[_0x1b56('0x28')](_0x1dcc38,_0x7d9541);}});case _0x1b56('0x39'):var _0x2056a6=_[_0x1b56('0x34')](_0x3bd5e2);if(_0x146b91[_0x1b56('0x3a')]){var _0x704d7c={};_0x704d7c[_0x146b91[_0x1b56('0x3a')]]=_0x34d400;_[_0x1b56('0x38')](_0x2056a6[_0x1b56('0x36')],_0x704d7c);}return _0x283563['sobject'](_0x1b56('0x3b'))[_0x1b56('0x28')](_0x2056a6,_0x7d9541)[_0x1b56('0x26')]()[_0x1b56('0x27')](function(_0x32448f){if(_0x32448f&&_0x32448f[_0x1b56('0x37')]){return _0x32448f;}else{var _0xd3486c=_['cloneDeep'](_0x3bd5e2);if(_0x146b91[_0x1b56('0x35')]){var _0x531003={};_0x531003[_0x146b91[_0x1b56('0x35')]]=_0x34d400;_[_0x1b56('0x38')](_0xd3486c[_0x1b56('0x36')],_0x531003);}return _0x283563['sobject'](_0x1b56('0x3c'))['find'](_0xd3486c,_0x7d9541)[_0x1b56('0x27')](function(_0x4d9e40){if(_0x4d9e40&&_0x4d9e40[_0x1b56('0x37')]){return _0x4d9e40;}else{var _0xe57145=_[_0x1b56('0x34')](_0x3bd5e2);if(_0x146b91[_0x1b56('0x3d')]){var _0x5d6138={};_0x5d6138[_0x146b91[_0x1b56('0x3d')]]=_0x34d400;_[_0x1b56('0x38')](_0xe57145[_0x1b56('0x36')],_0x5d6138);}return _0x283563['sobject']('Lead')[_0x1b56('0x28')](_0xe57145,_0x7d9541);}});}});case'contact':var _0x4392ba=_[_0x1b56('0x34')](_0x3bd5e2);if(_0x146b91[_0x1b56('0x35')]){var _0x704d7c={};_0x704d7c[_0x146b91[_0x1b56('0x35')]]=_0x34d400;_[_0x1b56('0x38')](_0x4392ba[_0x1b56('0x36')],_0x704d7c);}return _0x283563['sobject'](_0x1b56('0x3c'))[_0x1b56('0x28')](_0x4392ba,_0x7d9541)[_0x1b56('0x26')]();case _0x1b56('0x18'):var _0x12a083=_[_0x1b56('0x34')](_0x3bd5e2);if(_0x146b91['additionalSearchLead']){var _0x704d7c={};_0x704d7c[_0x146b91[_0x1b56('0x3d')]]=_0x34d400;_[_0x1b56('0x38')](_0x12a083[_0x1b56('0x36')],_0x704d7c);}return _0x283563['sobject']('Lead')['find'](_0x12a083,_0x7d9541);case _0x1b56('0x1a'):var _0x2056a6=_['cloneDeep'](_0x3bd5e2);if(_0x146b91[_0x1b56('0x3a')]){var _0x704d7c={};_0x704d7c[_0x146b91[_0x1b56('0x3a')]]=_0x34d400;_[_0x1b56('0x38')](_0x2056a6[_0x1b56('0x36')],_0x704d7c);}return _0x283563[_0x1b56('0x21')]('Account')[_0x1b56('0x28')](_0x2056a6,_0x7d9541);default:return null;}})[_0x1b56('0x27')](function(_0x41d7ae){if(_0x41d7ae&&_0x41d7ae[_0x1b56('0x37')]){var _0x50b95a=_[_0x1b56('0x3e')](_0x41d7ae);if(_0x50b95a){return BPromise[_0x1b56('0x2c')]({'id':_0x50b95a['Id'],'name':_0x50b95a[_0x1b56('0x3f')],'phone':_0x50b95a[_0x1b56('0x40')],'endUserType':_0x50b95a[_0x1b56('0x41')][_0x1b56('0x42')][_0x1b56('0x43')]()});}}})[_0x1b56('0x27')](function(_0x37566c){if(_0x37566c){logger['info'](_0x1b56('0x44'),_0x37566c[_0x1b56('0x17')],_0x34d400);return BPromise[_0x1b56('0x2c')](_0x37566c);}else{logger[_0x1b56('0x2a')](_0x1b56('0x45'),_0x34d400);var _0x3d97f5={'Phone':_0x34d400};if(_0x146b91[_0x1b56('0x46')]){if(_0x146b91[_0x1b56('0x46')]===_0x1b56('0x1c')){logger[_0x1b56('0x2a')](_0x1b56('0x47'),_0x34d400,_0x146b91[_0x1b56('0x46')]);_0x3d97f5['LastName']=_0x282c99!==_0x1b56('0x48')?_0x282c99:util[_0x1b56('0x49')](_0x1b56('0x4a'),_0x34d400);}else if(_0x146b91[_0x1b56('0x46')]===_0x1b56('0x18')){logger[_0x1b56('0x2a')](_0x1b56('0x47'),_0x34d400,_0x146b91['moduleCreate']);_0x3d97f5[_0x1b56('0x4b')]=_0x282c99!==_0x1b56('0x48')?_0x282c99:util[_0x1b56('0x49')](_0x1b56('0x4a'),_0x34d400);_0x3d97f5[_0x1b56('0x4c')]=_0x1b56('0x4d');}else if(_0x146b91[_0x1b56('0x46')]===_0x1b56('0x1a')){logger[_0x1b56('0x2a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x34d400,_0x146b91[_0x1b56('0x46')]);_0x3d97f5[_0x1b56('0x3f')]=_0x282c99!==_0x1b56('0x48')?_0x282c99:util['format'](_0x1b56('0x4a'),_0x34d400);}else{return null;}}return _0x283563['sobject'](_['upperFirst'](_0x146b91[_0x1b56('0x46')]))[_0x1b56('0x22')](_0x3d97f5)[_0x1b56('0x27')](function(_0x3a84eb){return BPromise[_0x1b56('0x2c')]({'id':_0x3a84eb['id'],'endUserType':_0x146b91[_0x1b56('0x46')]});});}});}function getCustomFields(_0x21b765,_0x12ba99){var _0x2e110a={};if(_0x21b765[_0x1b56('0x37')]>0x0){_[_0x1b56('0x4e')](_0x21b765,function(_0x4456e1){if(_[_0x1b56('0x4f')]([_0x1b56('0x50'),_0x1b56('0x51')],_0x4456e1[_0x1b56('0x42')])&&_0x4456e1['idField']){_0x2e110a[_0x4456e1['idField']]=_0x4456e1[_0x1b56('0x52')][_0x1b56('0x53')]();}else if(_0x4456e1['type']===_0x1b56('0x54')&&_0x4456e1[_0x1b56('0x55')]&&_0x4456e1['idField']){_0x12ba99[_0x4456e1[_0x1b56('0x55')]]&&(_0x2e110a[_0x4456e1['idField']]=_0x12ba99[_0x4456e1[_0x1b56('0x55')]][_0x1b56('0x53')]());}else if(_0x4456e1['type']==='customVariable'&&_0x4456e1['Variable']&&_0x4456e1['Variable'][_0x1b56('0x56')]&&_0x4456e1[_0x1b56('0x57')]){_0x12ba99[_0x4456e1[_0x1b56('0x58')][_0x1b56('0x56')]['toLowerCase']()]&&(_0x2e110a[_0x4456e1[_0x1b56('0x57')]]=_0x12ba99[_0x4456e1['Variable'][_0x1b56('0x56')]['toLowerCase']()]['toString']());}});}return _0x2e110a;}function getConnection(_0x37e5fe){var _0x15d37d=_0x37e5fe[_0x1b56('0x59')][_0x1b56('0x5a')](_0x37e5fe[_0x1b56('0x5b')]);var _0x333766=new jsforce[(_0x1b56('0x5c'))]({'oauth2':{'loginUrl':_0x37e5fe[_0x1b56('0x5d')]||'https://login.salesforce.com','clientId':_0x37e5fe[_0x1b56('0x5e')],'clientSecret':_0x37e5fe['clientSecret']}});return _0x333766['login'](_0x37e5fe[_0x1b56('0x5f')],_0x15d37d)['then'](function(){logger[_0x1b56('0x2a')]('Connection\x20established.');return _0x333766;});}exports['queue']=function(_0x4393ad,_0xbd5533,_0x1d4c62,_0x23750,_0x4c2b9a,_0x21ff5e){var _0x2d2ce5,_0x4718b2,_0xda0c11,_0x268cd0;_0x21ff5e[_0x1b56('0x60')]=intUtil[_0x1b56('0x61')](_0x21ff5e[_0x1b56('0x60')]);_0x21ff5e[_0x1b56('0x5d')]=intUtil[_0x1b56('0x61')](_0x21ff5e[_0x1b56('0x5d')]);if(_0x4c2b9a&&_0x4c2b9a[_0x1b56('0x62')]){logger[_0x1b56('0x2a')](_0x1b56('0x63'),_0x1b56('0x64'));_0xbd5533['recordingURL']=util['format'](_0x1b56('0x65'),_0x21ff5e[_0x1b56('0x60')],_0xbd5533['uniqueid'],md5(_0xbd5533[_0x1b56('0x66')]));}else{_0xbd5533[_0x1b56('0x67')]='';}return getConnection(_0x21ff5e)[_0x1b56('0x27')](function(_0x82376e){_0x268cd0=_0x82376e;return getUser(_0x21ff5e,_0x23750[_0x1b56('0x68')],_0x268cd0);})[_0x1b56('0x27')](function(_0x4537ad){_0x2d2ce5=_0x4537ad;return getEndUser(_0x21ff5e,_0x1d4c62,_0xbd5533[_0x1b56('0x69')],_0xbd5533[_0x1b56('0x6a')],_0x268cd0);})[_0x1b56('0x27')](function(_0x2aeeaf){_0x4718b2=_0x2aeeaf;return getTicket(_0x21ff5e,_0x2d2ce5,_0x4718b2,_0x1d4c62,_0xbd5533,_0x1d4c62[_0x1b56('0x6b')],_0x268cd0,_0x1b56('0x6c'));})[_0x1b56('0x27')](function(_0x4b2da7){_0xda0c11=_0x4b2da7;logger[_0x1b56('0x2a')](_0x1b56('0x6d'),_0xda0c11['id']);logger['info'](_0x1b56('0x6e'),_0xda0c11['id'],_0x23750['name'],_0x21ff5e[_0x1b56('0x42')]);switch(_0x21ff5e[_0x1b56('0x42')]){case _0x1b56('0x6f'):emit(util['format']('user:%s',_0x23750[_0x1b56('0x56')]),_0x1b56('0x70'),{'recordId':_0xda0c11['id']});break;case _0x1b56('0x71'):emit(util['format'](_0x1b56('0x72'),_0x23750[_0x1b56('0x56')]),'trigger:browser:url',{'uri':util[_0x1b56('0x49')](_0x1b56('0x73'),_0x268cd0['instanceUrl'],_0xda0c11['id'])});break;default:logger[_0x1b56('0x74')](_0x1b56('0x75'));}})[_0x1b56('0x76')](function(_0x490a8d){logger[_0x1b56('0x74')]('[QUEUE]',_0x490a8d);});};exports[_0x1b56('0x77')]=function(_0x1cf18d,_0x543dc3,_0x4b83e8,_0x28a570,_0x2da1a1,_0x3132ef,_0x1aa6ef){var _0x55bf14,_0x44cd1e,_0x1f15f2,_0x1e7274;_0x3132ef[_0x1b56('0x60')]=intUtil[_0x1b56('0x61')](_0x3132ef[_0x1b56('0x60')]);_0x3132ef[_0x1b56('0x5d')]=intUtil[_0x1b56('0x61')](_0x3132ef[_0x1b56('0x5d')]);if(_0x1aa6ef&&_0x1aa6ef[_0x1b56('0x78')]&&_0x1aa6ef[_0x1b56('0x78')]!==_0x1b56('0x79')){logger[_0x1b56('0x2a')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x543dc3[_0x1b56('0x67')]=util['format'](_0x1b56('0x65'),_0x3132ef['serverUrl'],_0x543dc3[_0x1b56('0x66')],md5(_0x543dc3['uniqueid']));}return getConnection(_0x3132ef)[_0x1b56('0x27')](function(_0x10de8b){_0x1e7274=_0x10de8b;return getUser(_0x3132ef,_0x28a570[_0x1b56('0x68')],_0x1e7274);})[_0x1b56('0x27')](function(_0x373c30){_0x55bf14=_0x373c30;return getEndUser(_0x3132ef,_0x4b83e8,_0x543dc3['destcalleridname'],_0x543dc3[_0x1b56('0x7a')],_0x1e7274);})[_0x1b56('0x27')](function(_0x3f9fdf){_0x44cd1e=_0x3f9fdf;return getTicket(_0x3132ef,_0x55bf14,_0x44cd1e,_0x4b83e8,_0x543dc3,_0x4b83e8[_0x1b56('0x6b')],_0x1e7274,_0x1b56('0x77'));})[_0x1b56('0x27')](function(_0x3ce80d){_0x1f15f2=_0x3ce80d;logger[_0x1b56('0x2a')](_0x1b56('0x7b'),_0x1f15f2['id']);logger['info'](_0x1b56('0x7c'),_0x1f15f2['id'],_0x28a570['name'],_0x3132ef[_0x1b56('0x42')]);switch(_0x3132ef[_0x1b56('0x42')]){case _0x1b56('0x6f'):emit(util['format']('user:%s',_0x28a570['name']),_0x1b56('0x70'),{'recordId':_0x1f15f2['id']});break;case _0x1b56('0x71'):emit(util['format']('user:%s',_0x28a570['name']),'trigger:browser:url',{'uri':util['format'](_0x1b56('0x73'),_0x1e7274[_0x1b56('0x7d')],_0x1f15f2['id'])});break;default:logger[_0x1b56('0x74')](_0x1b56('0x7e'),_0x1b56('0x7f'));}})[_0x1b56('0x76')](function(_0x3d83b9){logger[_0x1b56('0x74')](_0x1b56('0x7e'),_0x3d83b9);});};exports[_0x1b56('0x80')]=function(_0x19e321,_0x28b361,_0x37cfc6,_0x77bce,_0x54735b,_0x15038a){var _0xa47406,_0x4e0165,_0x25e662,_0x4d60d6;_0x15038a[_0x1b56('0x60')]=intUtil[_0x1b56('0x61')](_0x15038a[_0x1b56('0x60')]);_0x15038a[_0x1b56('0x5d')]=intUtil[_0x1b56('0x61')](_0x15038a[_0x1b56('0x5d')]);if(_0x54735b&&_0x54735b[_0x1b56('0x62')]){logger[_0x1b56('0x2a')]('['+_0x28b361['lastevent'][_0x1b56('0x81')]()+']','Recording\x20is\x20enabled!');_0x28b361[_0x1b56('0x67')]=util[_0x1b56('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x15038a[_0x1b56('0x60')],_0x28b361['uniqueid'],md5(_0x28b361['uniqueid']));}else{_0x28b361[_0x1b56('0x67')]='';}return getConnection(_0x15038a)[_0x1b56('0x27')](function(_0xc85a5b){_0x4d60d6=_0xc85a5b;if(!_[_0x1b56('0x23')](_0x77bce)){return getUser(_0x15038a,_0x77bce[_0x1b56('0x56')],_0x4d60d6);}else{return getUser(_0x15038a,null,_0x4d60d6);}})['then'](function(_0x4e4d6d){_0xa47406=_0x4e4d6d;return getEndUser(_0x15038a,_0x37cfc6,_0x28b361[_0x1b56('0x69')],_0x28b361['calleridnum'],_0x4d60d6);})[_0x1b56('0x27')](function(_0x362806){_0x4e0165=_0x362806;return getTicket(_0x15038a,_0xa47406,_0x4e0165,_0x37cfc6,_0x28b361,_0x37cfc6['Fields'],_0x4d60d6);})[_0x1b56('0x27')](function(_0x4307e9){_0x25e662=_0x4307e9;logger[_0x1b56('0x2a')]('['+_0x28b361[_0x1b56('0x82')][_0x1b56('0x81')]()+_0x1b56('0x83'),_0x25e662['id']);logger['info']('['+_0x28b361['lastevent']['toUpperCase']()+_0x1b56('0x84'),_0x15038a[_0x1b56('0x42')]);})[_0x1b56('0x76')](function(_0x2a8110){logger[_0x1b56('0x74')]('['+_0x28b361[_0x1b56('0x82')][_0x1b56('0x81')]()+']',_0x2a8110);});}; \ No newline at end of file +var _0xb51a=['endUserType','contact','lead','account','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','execute','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','forEach','includes','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','ActivityDate','utc'];(function(_0x3d523f,_0x3a5d85){var _0x210ffc=function(_0x4c3d20){while(--_0x4c3d20){_0x3d523f['push'](_0x3d523f['shift']());}};_0x210ffc(++_0x3a5d85);}(_0xb51a,0x6d));var _0xab51=function(_0xc80c8a,_0x241238){_0xc80c8a=_0xc80c8a-0x0;var _0x169f17=_0xb51a[_0xc80c8a];return _0x169f17;};'use strict';var _=require('lodash');var rp=require(_0xab51('0x0'));var moment=require(_0xab51('0x1'));var BPromise=require(_0xab51('0x2'));var md5=require(_0xab51('0x3'));var jsforce=require(_0xab51('0x4'));var util=require(_0xab51('0x5'));var Redis=require(_0xab51('0x6'));var intUtil=require(_0xab51('0x7'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xab51('0x8'));config[_0xab51('0x9')]=_[_0xab51('0xa')](config[_0xab51('0x9')],{'host':_0xab51('0xb'),'port':0x18eb});var io=require(_0xab51('0xc'))(new Redis(config['redis']));function emit(_0x33a6d1,_0x1aceda,_0x22eca5){io['to'](_0x33a6d1)[_0xab51('0xd')](_0x1aceda,_0x22eca5);}function getTicket(_0x2730dc,_0x359946,_0x10784e,_0xc9c694,_0x1ac7a6,_0x1b021a,_0x227a66,_0x4de86a){var _0x1a4738=Object[_0xab51('0xe')]({},{'OwnerId':_0x359946['id'],'Subject':intUtil[_0xab51('0xf')](_0xc9c694['Subjects'],_0x1ac7a6,'\x20'),'Description':intUtil[_0xab51('0xf')](_0xc9c694[_0xab51('0x10')],_0x1ac7a6,'\x0a')},getCustomFields(_0x1b021a,_0x1ac7a6));if(_0x10784e){if(_0xc9c694[_0xab51('0x11')]==='Task'){_0x1a4738[_0xab51('0x12')]=moment[_0xab51('0x13')]();_0x1a4738['IsReminderSet']=![];_0x1a4738['IsRecurrence']=![];if(_0x10784e[_0xab51('0x14')]===_0xab51('0x15')||_0x10784e['endUserType']===_0xab51('0x16')){_0x1a4738['WhoId']=_0x10784e['id'];}else if(_0x10784e[_0xab51('0x14')]===_0xab51('0x17')){_0x1a4738['WhatId']=_0x10784e['id'];}}else if(_0xc9c694[_0xab51('0x11')]===_0xab51('0x18')){if(_0x10784e[_0xab51('0x14')]==='contact'){_0x1a4738[_0xab51('0x19')]=_0x10784e['id'];}else if(_0x10784e[_0xab51('0x14')]==='account'){_0x1a4738[_0xab51('0x1a')]=_0x10784e['id'];}else if(_0x10784e['endUserType']==='lead'&&_0xc9c694['leadId']){_0x1a4738[_0xc9c694[_0xab51('0x1b')]]=_0x10784e['id'];}else{logger[_0xab51('0x1c')](_0xab51('0x1d'));}}}return _0x227a66[_0xab51('0x1e')](_0xc9c694[_0xab51('0x11')])[_0xab51('0x1f')](_0x1a4738);}function getUser(_0x1b4861,_0x55a391,_0x23ae24){if(!_[_0xab51('0x20')](_0x55a391)&&intUtil[_0xab51('0x21')](_0x55a391)){var _0x45036e={'Email':_0x55a391};var _0x2656be={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x23ae24['sobject'](_0xab51('0x22'))[_0xab51('0x23')](_0x45036e,_0x2656be)['execute']()[_0xab51('0x24')](function(_0x3ae831){if(_0x3ae831[_0xab51('0x25')]){var _0x40eb08=_[_0xab51('0x23')](_0x3ae831,function(_0x14c163){return _0x14c163[_0xab51('0x26')]===_0x55a391;});if(_0x40eb08){logger[_0xab51('0x1c')]('Agent\x20%s\x20found.',_0x55a391);return BPromise['resolve']({'id':_0x40eb08['Id'],'name':_0x40eb08[_0xab51('0x27')]});}}else{logger[_0xab51('0x1c')](_0xab51('0x28'),_0x55a391);return _0x23ae24[_0xab51('0x29')]()[_0xab51('0x24')](function(_0x2d4af9){return BPromise['resolve']({'id':_0x2d4af9[_0xab51('0x2a')],'name':_0x2d4af9[_0xab51('0x2b')]});});}});}else{logger[_0xab51('0x1c')](_0xab51('0x28'),_0x55a391);return _0x23ae24[_0xab51('0x29')]()[_0xab51('0x24')](function(_0x14a042){return BPromise[_0xab51('0x2c')]({'id':_0x14a042[_0xab51('0x2a')],'name':_0x14a042[_0xab51('0x2b')]});});}}function getEndUser(_0x17b5e6,_0x2bb3c0,_0x4ecca0,_0x551fc7,_0x1e789f){var _0x19ac0e={'$or':{'Phone':_0x551fc7}};var _0x435a9f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xab51('0x2c')]()[_0xab51('0x24')](function(){logger[_0xab51('0x1c')](_0xab51('0x2d'),_0x551fc7,_0x2bb3c0[_0xab51('0x2e')]);switch(_0x2bb3c0[_0xab51('0x2e')]){case _0xab51('0x2f'):var _0x3c1ea5=_[_0xab51('0x30')](_0x19ac0e);if(_0x2bb3c0['additionalSearchContact']){var _0xa19d6b={};_0xa19d6b[_0x2bb3c0[_0xab51('0x31')]]=_0x551fc7;_['merge'](_0x3c1ea5[_0xab51('0x32')],_0xa19d6b);}return _0x1e789f['sobject'](_0xab51('0x33'))['find'](_0x3c1ea5,_0x435a9f)[_0xab51('0x34')]()[_0xab51('0x24')](function(_0x481ba8){if(_0x481ba8&&_0x481ba8['length']){return _0x481ba8;}else{var _0x4fab9d=_[_0xab51('0x30')](_0x19ac0e);if(_0x2bb3c0[_0xab51('0x35')]){var _0x57f021={};_0x57f021[_0x2bb3c0[_0xab51('0x35')]]=_0x551fc7;_[_0xab51('0x36')](_0x4fab9d['$or'],_0x57f021);}return _0x1e789f[_0xab51('0x1e')](_0xab51('0x37'))[_0xab51('0x23')](_0x4fab9d,_0x435a9f);}});case _0xab51('0x38'):var _0x58fc9f=_[_0xab51('0x30')](_0x19ac0e);if(_0x2bb3c0['additionalSearchAccount']){var _0xa19d6b={};_0xa19d6b[_0x2bb3c0['additionalSearchAccount']]=_0x551fc7;_[_0xab51('0x36')](_0x58fc9f[_0xab51('0x32')],_0xa19d6b);}return _0x1e789f[_0xab51('0x1e')]('Account')['find'](_0x58fc9f,_0x435a9f)[_0xab51('0x34')]()[_0xab51('0x24')](function(_0x330e22){if(_0x330e22&&_0x330e22[_0xab51('0x25')]){return _0x330e22;}else{var _0x1dd15a=_[_0xab51('0x30')](_0x19ac0e);if(_0x2bb3c0[_0xab51('0x31')]){var _0x228ac5={};_0x228ac5[_0x2bb3c0['additionalSearchContact']]=_0x551fc7;_['merge'](_0x1dd15a['$or'],_0x228ac5);}return _0x1e789f[_0xab51('0x1e')](_0xab51('0x33'))['find'](_0x1dd15a,_0x435a9f)['then'](function(_0x2271ec){if(_0x2271ec&&_0x2271ec[_0xab51('0x25')]){return _0x2271ec;}else{var _0x5b60f9=_[_0xab51('0x30')](_0x19ac0e);if(_0x2bb3c0[_0xab51('0x35')]){var _0x81c32a={};_0x81c32a[_0x2bb3c0['additionalSearchLead']]=_0x551fc7;_[_0xab51('0x36')](_0x5b60f9[_0xab51('0x32')],_0x81c32a);}return _0x1e789f[_0xab51('0x1e')](_0xab51('0x37'))[_0xab51('0x23')](_0x5b60f9,_0x435a9f);}});}});case'contact':var _0x3c1ea5=_[_0xab51('0x30')](_0x19ac0e);if(_0x2bb3c0['additionalSearchContact']){var _0xa19d6b={};_0xa19d6b[_0x2bb3c0['additionalSearchContact']]=_0x551fc7;_[_0xab51('0x36')](_0x3c1ea5[_0xab51('0x32')],_0xa19d6b);}return _0x1e789f[_0xab51('0x1e')]('Contact')['find'](_0x3c1ea5,_0x435a9f)[_0xab51('0x34')]();case'lead':var _0x48241b=_[_0xab51('0x30')](_0x19ac0e);if(_0x2bb3c0[_0xab51('0x35')]){var _0xa19d6b={};_0xa19d6b[_0x2bb3c0['additionalSearchLead']]=_0x551fc7;_['merge'](_0x48241b[_0xab51('0x32')],_0xa19d6b);}return _0x1e789f[_0xab51('0x1e')](_0xab51('0x37'))[_0xab51('0x23')](_0x48241b,_0x435a9f);case _0xab51('0x17'):var _0x58fc9f=_['cloneDeep'](_0x19ac0e);if(_0x2bb3c0[_0xab51('0x39')]){var _0xa19d6b={};_0xa19d6b[_0x2bb3c0['additionalSearchAccount']]=_0x551fc7;_[_0xab51('0x36')](_0x58fc9f[_0xab51('0x32')],_0xa19d6b);}return _0x1e789f[_0xab51('0x1e')](_0xab51('0x3a'))[_0xab51('0x23')](_0x58fc9f,_0x435a9f);default:return null;}})[_0xab51('0x24')](function(_0x2f743c){if(_0x2f743c&&_0x2f743c[_0xab51('0x25')]){var _0x529f9d=_[_0xab51('0x3b')](_0x2f743c);if(_0x529f9d){return BPromise['resolve']({'id':_0x529f9d['Id'],'name':_0x529f9d[_0xab51('0x27')],'phone':_0x529f9d[_0xab51('0x3c')],'endUserType':_0x529f9d[_0xab51('0x3d')][_0xab51('0x3e')][_0xab51('0x3f')]()});}}})[_0xab51('0x24')](function(_0x3e5642){if(_0x3e5642){logger[_0xab51('0x1c')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3e5642[_0xab51('0x14')],_0x551fc7);return BPromise[_0xab51('0x2c')](_0x3e5642);}else{logger[_0xab51('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x551fc7);var _0x22062e={'Phone':_0x551fc7};if(_0x2bb3c0[_0xab51('0x40')]){if(_0x2bb3c0[_0xab51('0x40')]===_0xab51('0x15')){logger[_0xab51('0x1c')](_0xab51('0x41'),_0x551fc7,_0x2bb3c0[_0xab51('0x40')]);_0x22062e[_0xab51('0x42')]=_0x4ecca0!==''?_0x4ecca0:util[_0xab51('0x43')](_0xab51('0x44'),_0x551fc7);}else if(_0x2bb3c0['moduleCreate']===_0xab51('0x16')){logger[_0xab51('0x1c')](_0xab51('0x41'),_0x551fc7,_0x2bb3c0['moduleCreate']);_0x22062e[_0xab51('0x42')]=_0x4ecca0!==_0xab51('0x45')?_0x4ecca0:util[_0xab51('0x43')]('Caller\x20-\x20%s',_0x551fc7);_0x22062e[_0xab51('0x46')]=_0xab51('0x47');}else if(_0x2bb3c0[_0xab51('0x40')]==='account'){logger[_0xab51('0x1c')](_0xab51('0x41'),_0x551fc7,_0x2bb3c0[_0xab51('0x40')]);_0x22062e[_0xab51('0x27')]=_0x4ecca0!==_0xab51('0x45')?_0x4ecca0:util['format'](_0xab51('0x44'),_0x551fc7);}else{return null;}}return _0x1e789f[_0xab51('0x1e')](_[_0xab51('0x48')](_0x2bb3c0[_0xab51('0x40')]))[_0xab51('0x1f')](_0x22062e)[_0xab51('0x24')](function(_0x1d1132){return BPromise[_0xab51('0x2c')]({'id':_0x1d1132['id'],'endUserType':_0x2bb3c0['moduleCreate']});});}});}function getCustomFields(_0x14ae0d,_0x2fafab){var _0xa2d3bb={};if(_0x14ae0d['length']>0x0){_[_0xab51('0x49')](_0x14ae0d,function(_0x35f19a){if(_[_0xab51('0x4a')](['string',_0xab51('0x4b')],_0x35f19a['type'])&&_0x35f19a[_0xab51('0x4c')]){_0xa2d3bb[_0x35f19a[_0xab51('0x4c')]]=_0x35f19a[_0xab51('0x4d')][_0xab51('0x4e')]();}else if(_0x35f19a['type']===_0xab51('0x4f')&&_0x35f19a[_0xab51('0x50')]&&_0x35f19a[_0xab51('0x4c')]){_0x2fafab[_0x35f19a[_0xab51('0x50')]]&&(_0xa2d3bb[_0x35f19a['idField']]=_0x2fafab[_0x35f19a[_0xab51('0x50')]][_0xab51('0x4e')]());}else if(_0x35f19a[_0xab51('0x3e')]===_0xab51('0x51')&&_0x35f19a[_0xab51('0x52')]&&_0x35f19a[_0xab51('0x52')][_0xab51('0x53')]&&_0x35f19a['idField']){_0x2fafab[_0x35f19a[_0xab51('0x52')][_0xab51('0x53')][_0xab51('0x3f')]()]&&(_0xa2d3bb[_0x35f19a[_0xab51('0x4c')]]=_0x2fafab[_0x35f19a['Variable'][_0xab51('0x53')]['toLowerCase']()][_0xab51('0x4e')]());}});}return _0xa2d3bb;}function getConnection(_0x259556){var _0x13d348=_0x259556[_0xab51('0x54')]['concat'](_0x259556[_0xab51('0x55')]);var _0x488f4f=new jsforce[(_0xab51('0x56'))]({'oauth2':{'loginUrl':_0x259556['remoteUri']||_0xab51('0x57'),'clientId':_0x259556[_0xab51('0x58')],'clientSecret':_0x259556[_0xab51('0x59')]}});return _0x488f4f[_0xab51('0x5a')](_0x259556[_0xab51('0x5b')],_0x13d348)['then'](function(){logger['info']('Connection\x20established.');return _0x488f4f;});}exports[_0xab51('0x5c')]=function(_0x2df711,_0x24b011,_0x3e52c5,_0x655954,_0xc0eaff,_0x193b4e){var _0x22d690,_0xfb3ac7,_0x56ca73,_0xf06ad;_0x193b4e[_0xab51('0x5d')]=intUtil[_0xab51('0x5e')](_0x193b4e[_0xab51('0x5d')]);_0x193b4e[_0xab51('0x5f')]=intUtil[_0xab51('0x5e')](_0x193b4e[_0xab51('0x5f')]);if(_0xc0eaff&&_0xc0eaff['monitor_format']){logger[_0xab51('0x1c')](_0xab51('0x60'),_0xab51('0x61'));_0x24b011[_0xab51('0x62')]=util[_0xab51('0x43')](_0xab51('0x63'),_0x193b4e[_0xab51('0x5d')],_0x24b011['uniqueid'],md5(_0x24b011[_0xab51('0x64')]));}else{_0x24b011[_0xab51('0x62')]='';}return getConnection(_0x193b4e)[_0xab51('0x24')](function(_0x3dc3ce){_0xf06ad=_0x3dc3ce;return getUser(_0x193b4e,_0x655954[_0xab51('0x65')],_0xf06ad);})['then'](function(_0x4a28c5){_0x22d690=_0x4a28c5;return getEndUser(_0x193b4e,_0x3e52c5,_0x24b011['calleridname'],_0x24b011[_0xab51('0x66')],_0xf06ad);})['then'](function(_0x41cd23){_0xfb3ac7=_0x41cd23;return getTicket(_0x193b4e,_0x22d690,_0xfb3ac7,_0x3e52c5,_0x24b011,_0x3e52c5[_0xab51('0x67')],_0xf06ad,_0xab51('0x5c'));})[_0xab51('0x24')](function(_0x3b7f91){_0x56ca73=_0x3b7f91;logger['info'](_0xab51('0x68'),_0x56ca73['id']);logger['info'](_0xab51('0x69'),_0x56ca73['id'],_0x655954[_0xab51('0x53')],_0x193b4e[_0xab51('0x3e')]);switch(_0x193b4e['type']){case _0xab51('0x6a'):emit(util[_0xab51('0x43')](_0xab51('0x6b'),_0x655954[_0xab51('0x53')]),_0xab51('0x6c'),{'recordId':_0x56ca73['id']});break;case'newTab':emit(util[_0xab51('0x43')](_0xab51('0x6b'),_0x655954['name']),_0xab51('0x6d'),{'uri':util[_0xab51('0x43')](_0xab51('0x6e'),_0xf06ad['instanceUrl'],_0x56ca73['id'])});break;default:logger[_0xab51('0x6f')](_0xab51('0x70'));}})['catch'](function(_0x599649){logger[_0xab51('0x6f')](_0xab51('0x60'),_0x599649);});};exports[_0xab51('0x71')]=function(_0x38f7a6,_0x2f2c66,_0x465a86,_0x406358,_0x541fc4,_0x43e3d3,_0x217c06){var _0x58a0e6,_0x3a1962,_0x38a28d,_0x4803cf;_0x43e3d3[_0xab51('0x5d')]=intUtil[_0xab51('0x5e')](_0x43e3d3['serverUrl']);_0x43e3d3['remoteUri']=intUtil[_0xab51('0x5e')](_0x43e3d3[_0xab51('0x5f')]);if(_0x217c06&&_0x217c06[_0xab51('0x72')]&&_0x217c06[_0xab51('0x72')]!==_0xab51('0x73')){logger[_0xab51('0x1c')](_0xab51('0x74'),_0xab51('0x61'));_0x2f2c66[_0xab51('0x62')]=util[_0xab51('0x43')](_0xab51('0x63'),_0x43e3d3[_0xab51('0x5d')],_0x2f2c66[_0xab51('0x64')],md5(_0x2f2c66[_0xab51('0x64')]));}return getConnection(_0x43e3d3)['then'](function(_0x42ea0f){_0x4803cf=_0x42ea0f;return getUser(_0x43e3d3,_0x406358['email'],_0x4803cf);})[_0xab51('0x24')](function(_0x230903){_0x58a0e6=_0x230903;return getEndUser(_0x43e3d3,_0x465a86,_0x2f2c66[_0xab51('0x75')],_0x2f2c66['destcalleridnum'],_0x4803cf);})[_0xab51('0x24')](function(_0x4d44a6){_0x3a1962=_0x4d44a6;return getTicket(_0x43e3d3,_0x58a0e6,_0x3a1962,_0x465a86,_0x2f2c66,_0x465a86['Fields'],_0x4803cf,_0xab51('0x71'));})[_0xab51('0x24')](function(_0x4b874f){_0x38a28d=_0x4b874f;logger[_0xab51('0x1c')](_0xab51('0x76'),_0x38a28d['id']);logger[_0xab51('0x1c')](_0xab51('0x77'),_0x38a28d['id'],_0x406358[_0xab51('0x53')],_0x43e3d3[_0xab51('0x3e')]);switch(_0x43e3d3[_0xab51('0x3e')]){case _0xab51('0x6a'):emit(util[_0xab51('0x43')]('user:%s',_0x406358[_0xab51('0x53')]),_0xab51('0x6c'),{'recordId':_0x38a28d['id']});break;case _0xab51('0x78'):emit(util['format']('user:%s',_0x406358[_0xab51('0x53')]),_0xab51('0x6d'),{'uri':util['format'](_0xab51('0x6e'),_0x4803cf[_0xab51('0x79')],_0x38a28d['id'])});break;default:logger[_0xab51('0x6f')](_0xab51('0x74'),_0xab51('0x7a'));}})[_0xab51('0x7b')](function(_0x52b66c){logger[_0xab51('0x6f')](_0xab51('0x74'),_0x52b66c);});};exports['unmanaged']=function(_0x260f4e,_0xd67e36,_0x2fcf7d,_0xf33064,_0x2ce56a,_0x29138c){var _0x4452c3,_0x55663f,_0x551aad,_0x5720d1;_0x29138c[_0xab51('0x5d')]=intUtil['stripTrailingSlash'](_0x29138c[_0xab51('0x5d')]);_0x29138c[_0xab51('0x5f')]=intUtil[_0xab51('0x5e')](_0x29138c[_0xab51('0x5f')]);if(_0x2ce56a&&_0x2ce56a[_0xab51('0x7c')]){logger['info']('['+_0xd67e36[_0xab51('0x7d')][_0xab51('0x7e')]()+']',_0xab51('0x61'));_0xd67e36[_0xab51('0x62')]=util[_0xab51('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x29138c[_0xab51('0x5d')],_0xd67e36[_0xab51('0x64')],md5(_0xd67e36[_0xab51('0x64')]));}else{_0xd67e36[_0xab51('0x62')]='';}return getConnection(_0x29138c)['then'](function(_0x1429a0){_0x5720d1=_0x1429a0;if(!_[_0xab51('0x20')](_0xf33064)){return getUser(_0x29138c,_0xf33064[_0xab51('0x53')],_0x5720d1);}else{return getUser(_0x29138c,null,_0x5720d1);}})[_0xab51('0x24')](function(_0x668d0d){_0x4452c3=_0x668d0d;return getEndUser(_0x29138c,_0x2fcf7d,_0xd67e36[_0xab51('0x7f')],_0xd67e36[_0xab51('0x66')],_0x5720d1);})[_0xab51('0x24')](function(_0x39a712){_0x55663f=_0x39a712;return getTicket(_0x29138c,_0x4452c3,_0x55663f,_0x2fcf7d,_0xd67e36,_0x2fcf7d[_0xab51('0x67')],_0x5720d1);})[_0xab51('0x24')](function(_0x567cc0){_0x551aad=_0x567cc0;logger['info']('['+_0xd67e36[_0xab51('0x7d')][_0xab51('0x7e')]()+_0xab51('0x80'),_0x551aad['id']);logger[_0xab51('0x1c')]('['+_0xd67e36[_0xab51('0x7d')][_0xab51('0x7e')]()+']\x20Integration\x20account\x20type\x20%s.',_0x29138c[_0xab51('0x3e')]);})[_0xab51('0x7b')](function(_0x53c990){logger[_0xab51('0x6f')]('['+_0xd67e36[_0xab51('0x7d')][_0xab51('0x7e')]()+']',_0x53c990);});}; \ 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 c276b06..d043bc5 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 _0xa30a=['call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','GET','userEmail','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','then','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','toString','idField','type','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','username','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]'];(function(_0x11afcf,_0x46133b){var _0x209a87=function(_0x1d6b6c){while(--_0x1d6b6c){_0x11afcf['push'](_0x11afcf['shift']());}};_0x209a87(++_0x46133b);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa30('0x0'));var Promise=require(_0xaa30('0x1'));var rp=require(_0xaa30('0x2'));var util=require('util');var md5=require(_0xaa30('0x3'));var Redis=require(_0xaa30('0x4'));var intUtil=require(_0xaa30('0x5'));var config=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));config[_0xaa30('0x9')]=_['defaults'](config[_0xaa30('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xaa30('0xa'))(new Redis(config[_0xaa30('0x9')]));function getAdminUser(_0x42dc22,_0x5d076a,_0xedbc45,_0x40dbda,_0x2febdd,_0x59d028){return new Promise(function(_0x14a6a6,_0x45419f){var _0x56f686={'method':'GET','uri':_0x40dbda+_0xaa30('0xb')+'&'+_0x2febdd+'&'+_0x59d028,'auth':_0x5d076a,'json':!![]};return rp(_0x56f686)['then'](function(_0x1cb481){if(_0x1cb481[_0xaa30('0xc')][_0xaa30('0xd')]>0x0){_0xedbc45[_0xaa30('0xe')]=_0x1cb481['result'][0x0][_0xaa30('0xf')];}logger[_0xaa30('0x10')]('['+[_0x42dc22[_0xaa30('0x11')]()]+'],\x20getAdminUser\x20crm',_0xedbc45);_0x14a6a6(_0xedbc45);})[_0xaa30('0x12')](function(_0xdea23a){logger[_0xaa30('0x13')]('['+[_0x42dc22[_0xaa30('0x11')]()]+']',_0xdea23a[_0xaa30('0x14')]);_0x45419f(_0xdea23a[_0xaa30('0x14')]);});});}function getUser(_0x3240e9,_0x3b8095,_0x2e37af,_0xfae724,_0x519518){return function(_0x91839d){logger['info']('['+[_0x3240e9['toUpperCase']()]+_0xaa30('0x15'),_0x91839d);return new Promise(function(_0x153939,_0x130606){if(intUtil['validateEmail'](_0x91839d['userEmail'])){var _0x53f9fd={'method':_0xaa30('0x16'),'uri':_0x2e37af+'sys_user?sysparm_query=email%3D'+_0x91839d[_0xaa30('0x17')]+'&'+_0xfae724+'&'+_0x519518,'auth':_0x3b8095,'json':!![]};logger[_0xaa30('0x10')]('['+[_0x3240e9['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x53f9fd);return rp(_0x53f9fd)['then'](function(_0x3cbf92){logger[_0xaa30('0x10')]('['+[_0x3240e9[_0xaa30('0x11')]()]+_0xaa30('0x18'),_0x3cbf92);if(_0x3cbf92[_0xaa30('0xc')]['length']>0x0&&String(_0x3cbf92[_0xaa30('0xc')][0x0][_0xaa30('0x19')])===_0xaa30('0x1a')){_0x91839d[_0xaa30('0x1b')]=_0x3cbf92[_0xaa30('0xc')][0x0]['sys_id'];}else{_0x91839d[_0xaa30('0x1b')]=_0x91839d[_0xaa30('0xe')];_0x91839d[_0xaa30('0x17')]=_0x91839d[_0xaa30('0x1c')];}logger['info']('['+[_0x3240e9[_0xaa30('0x11')]()]+_0xaa30('0x1d'),_0x91839d);_0x153939(_0x91839d);})[_0xaa30('0x12')](function(_0x12da2f){logger[_0xaa30('0x13')]('['+[_0x3240e9[_0xaa30('0x11')]()]+']',_0x12da2f['message']);_0x130606(_0x12da2f[_0xaa30('0x14')]);});}else{logger[_0xaa30('0x10')]('['+[_0x3240e9['toUpperCase']()]+_0xaa30('0x1e'));_0x91839d['userId']=_0x91839d[_0xaa30('0xe')];_0x91839d[_0xaa30('0x17')]=_0x91839d[_0xaa30('0x1c')];_0x153939(_0x91839d);}});};}function createEndUser(_0xd1eb3a,_0x37b4a6,_0xc10b8f,_0x6ff09a,_0x39f708){logger[_0xaa30('0x10')]('['+[_0xd1eb3a[_0xaa30('0x11')]()]+_0xaa30('0x1f'),_0xc10b8f);return new Promise(function(_0x43003f,_0x2038a6){var _0x46abb9={'method':_0xaa30('0x20'),'uri':_0x6ff09a+_0xaa30('0x21')+_0x39f708,'body':{'user_name':_0xc10b8f[_0xaa30('0x22')],'roles':_0xaa30('0x23'),'first_name':_0xc10b8f['endUserNumber'],'active':_0xaa30('0x1a'),'date_format':_0xaa30('0x24'),'phone':_0xc10b8f[_0xaa30('0x22')]},'auth':_0x37b4a6,'json':!![]};return rp(_0x46abb9)[_0xaa30('0x25')](function(_0x2276e0){logger[_0xaa30('0x10')]('['+[_0xd1eb3a['toUpperCase']()]+'],\x20EndUser\x20schema',_0x2276e0['result']);_0xc10b8f[_0xaa30('0x26')]=_0x2276e0[_0xaa30('0xc')][_0xaa30('0xf')];_0x43003f(_0xc10b8f);})[_0xaa30('0x12')](function(_0x1d6d83){logger['error']('['+[_0xd1eb3a['toUpperCase']()]+']',_0x1d6d83[_0xaa30('0x14')]);_0x2038a6(_0x1d6d83[_0xaa30('0x14')]);});});}function getEndUser(_0x4e004e,_0xc81d7e,_0x4c83dd,_0x3ca2b5,_0x5241d2){return function(_0x2ae4ed){logger[_0xaa30('0x10')]('['+[_0x4e004e['toUpperCase']()]+_0xaa30('0x27'),_0x2ae4ed);return new Promise(function(_0x2bc6f2,_0x3dd1ed){var _0x2cca77={'method':_0xaa30('0x16'),'uri':_0x4c83dd+_0xaa30('0x28')+_0x2ae4ed['endUserNumber']+'&'+_0x3ca2b5+'&'+_0x5241d2,'auth':_0xc81d7e,'json':!![]};return rp(_0x2cca77)[_0xaa30('0x25')](function(_0x1a2af6){if(_0x1a2af6['result'][_0xaa30('0xd')]>0x0){_0x2ae4ed[_0xaa30('0x26')]=_0x1a2af6[_0xaa30('0xc')][0x0]['sys_id'];logger['info']('['+[_0x4e004e[_0xaa30('0x11')]()]+_0xaa30('0x29'),_0x2ae4ed);_0x2bc6f2(_0x2ae4ed);}else{return createEndUser(_0x4e004e,_0xc81d7e,_0x2ae4ed,_0x4c83dd,_0x3ca2b5)[_0xaa30('0x25')](function(_0x1b22ed){logger[_0xaa30('0x10')]('['+[_0x4e004e[_0xaa30('0x11')]()]+'],\x20createEndUser\x20crm',_0x1b22ed);_0x2bc6f2(_0x1b22ed);});}})['catch'](function(_0x120c43){logger[_0xaa30('0x13')]('['+[_0x4e004e[_0xaa30('0x11')]()]+']',_0x120c43['message']);_0x3dd1ed(_0x120c43[_0xaa30('0x14')]);});});};}function getCustomFields(_0x1c8cd7,_0x8fb95e){var _0x1db035={};if(_0x1c8cd7['length']>0x0){_[_0xaa30('0x2a')](_0x1c8cd7,function(_0x1fa386){if(_[_0xaa30('0x2b')]([_0xaa30('0x2c'),_0xaa30('0x2d')],_0x1fa386['type'])&&_0x1fa386[_0xaa30('0x2e')]&&!_0x1fa386[_0xaa30('0x2f')]){_0x1db035[_0x1fa386[_0xaa30('0x2e')][_0xaa30('0x30')]()]=_0x1fa386[_0xaa30('0x31')][_0xaa30('0x32')]();}else if(_[_0xaa30('0x2b')]([_0xaa30('0x2c'),'picklist'],_0x1fa386['type'])&&_0x1fa386[_0xaa30('0x33')]&&_0x1fa386['customField']){_0x1db035[_0x1fa386['idField']['toLowerCase']()]=_0x1fa386[_0xaa30('0x31')]['toString']();}else if(_0x1fa386[_0xaa30('0x34')]==='variable'&&_0x1fa386[_0xaa30('0x35')]&&_0x1fa386[_0xaa30('0x33')]&&_0x1fa386[_0xaa30('0x2f')]){_0x1db035[_0x1fa386[_0xaa30('0x33')][_0xaa30('0x30')]()]=_0x8fb95e[_0x1fa386[_0xaa30('0x35')]][_0xaa30('0x32')]();}else if(_0x1fa386[_0xaa30('0x34')]===_0xaa30('0x36')&&_0x1fa386[_0xaa30('0x37')]&&_0x1fa386[_0xaa30('0x37')]['name']&&_0x1fa386[_0xaa30('0x33')]&&_0x1fa386[_0xaa30('0x2f')]){_0x1db035[_0x1fa386[_0xaa30('0x33')][_0xaa30('0x30')]()]=_0x8fb95e[_0x1fa386[_0xaa30('0x37')]['name']['toLowerCase']()][_0xaa30('0x32')]();}});}return _0x1db035;}function getTicket(_0x524d5d,_0x6ad83e,_0xbf9edd,_0xef3564,_0xb29ccc,_0x1f6dd7){return function(_0x3ec15b){logger[_0xaa30('0x10')]('['+[_0x524d5d['toUpperCase']()]+_0xaa30('0x38'),_0x3ec15b);return new Promise(function(_0x6c9da6,_0xfa14bf){var _0x5cacee=_0x524d5d[_0xaa30('0x30')]()===_0xaa30('0x39')?_0x3ec15b['userId']:_0x3ec15b[_0xaa30('0x26')];var _0x4a8fcc={'method':_0xaa30('0x20'),'uri':_0xbf9edd+'incident'+'?'+_0x1f6dd7,'body':Object['assign']({},{'active':_0xaa30('0x1a'),'caller_id':_0x5cacee,'assigned_to':_0x3ec15b['userId'],'short_description':intUtil['getString'](_0xef3564[_0xaa30('0x3a')],_0xb29ccc,'\x20'),'description':intUtil[_0xaa30('0x3b')](_0xef3564[_0xaa30('0x3c')],_0xb29ccc,'\x0a')},getCustomFields(_0xef3564[_0xaa30('0x3d')],_0xb29ccc)),'auth':_0x6ad83e,'json':!![]};return rp(_0x4a8fcc)[_0xaa30('0x25')](function(_0x31131d){logger['info']('['+[_0x524d5d[_0xaa30('0x11')]()]+_0xaa30('0x3e'),_0x31131d[_0xaa30('0xc')]);_0x3ec15b['ticketId']=_0x31131d['result']['sys_id'];_0x3ec15b['ticketNumber']=_0x31131d[_0xaa30('0xc')][_0xaa30('0x3f')];logger[_0xaa30('0x10')]('['+[_0x524d5d[_0xaa30('0x11')]()]+_0xaa30('0x40'),_0x3ec15b);_0x6c9da6(_0x3ec15b);})[_0xaa30('0x12')](function(_0x5993ab){logger[_0xaa30('0x13')]('['+[_0x524d5d[_0xaa30('0x11')]()]+']',_0x5993ab[_0xaa30('0x14')]);_0xfa14bf(_0x5993ab[_0xaa30('0x14')]);});});};}function createRemoteTag(_0x5328c3,_0x2bfac7,_0x2d23f8,_0x399007){return new Promise(function(_0x1edd3a,_0x245d35){var _0x5996e3={'method':'POST','uri':_0x2d23f8+_0xaa30('0x41')+'?'+_0x399007,'body':{'short_description':_0x5328c3,'global':!![],'active':!![],'name':_0x5328c3},'auth':_0x2bfac7,'json':!![]};return rp(_0x5996e3)[_0xaa30('0x25')](function(_0x3c4f07){var _0x5e7032=_0x3c4f07[_0xaa30('0xc')]['sys_id'];_0x1edd3a(_0x5e7032);});});}function getRemoteTag(_0x2fafda,_0x13171f,_0x483a01,_0x1fdca8,_0x3f12f2){return new Promise(function(_0x51a556,_0x2c399e){var _0x5ea6f3={'method':'GET','uri':_0x483a01+_0xaa30('0x41')+_0xaa30('0x42')+_0x2fafda+'&'+_0x1fdca8,'auth':_0x13171f,'json':!![]};return rp(_0x5ea6f3)[_0xaa30('0x25')](function(_0x5a85aa){if(_0x5a85aa[_0xaa30('0xc')][_0xaa30('0xd')]>0x0){var _0x4745ae=_0x5a85aa[_0xaa30('0xc')][0x0][_0xaa30('0xf')];_0x51a556(_0x4745ae);}else{return createRemoteTag(_0x2fafda,_0x13171f,_0x483a01,_0x1fdca8)[_0xaa30('0x25')](function(_0x429ac8){_0x51a556(_0x429ac8);});}});});}function assignTagToIncident(_0xd0653,_0x242b5a,_0x426b90,_0xb1afa8,_0x2f84fa){return new Promise(function(_0x9e96f4,_0x48a03c){var _0x41bac2={'method':_0xaa30('0x20'),'uri':_0x426b90+_0xaa30('0x43')+'?'+_0x2f84fa,'body':{'label':_0xd0653,'table':'incident','id_type':_0xaa30('0x44'),'table_key':_0xb1afa8[_0xaa30('0x45')],'title':_0xaa30('0x46')+_0xb1afa8[_0xaa30('0x47')],'id_display':_0xb1afa8[_0xaa30('0x47')]},'auth':_0x242b5a,'json':!![]};return rp(_0x41bac2)[_0xaa30('0x25')](function(_0x4f1d54){_0x9e96f4();})[_0xaa30('0x12')](function(){_0x9e96f4();});});}function manageTags(_0x4f5222,_0x36242e,_0x4121fb,_0x315303,_0x17155a,_0x59e394,_0x2cbea3){return new Promise(function(_0x263da8,_0x58e329){var _0x26f6f9=[];_0x36242e[_0xaa30('0x2a')](function(_0x1aa115){_0x26f6f9[_0xaa30('0x48')](getRemoteTag(_0x1aa115,_0x4121fb,_0x315303,_0x59e394,_0x2cbea3));});return Promise[_0xaa30('0x49')](_0x26f6f9)[_0xaa30('0x25')](function(_0x5df995){if(_0x5df995[_0xaa30('0xd')]){logger[_0xaa30('0x10')]('['+[_0x4f5222[_0xaa30('0x11')]()]+_0xaa30('0x4a'),_0x5df995);var _0x334ef1=[];_0x5df995[_0xaa30('0x2a')](function(_0x8bda4f){_0x334ef1[_0xaa30('0x48')](assignTagToIncident(_0x8bda4f,_0x4121fb,_0x315303,_0x17155a,_0x59e394));});return Promise[_0xaa30('0x49')](_0x334ef1)[_0xaa30('0x25')](function(){_0x263da8();})[_0xaa30('0x12')](function(){_0x263da8();});}else{_0x263da8();}});});}function getTags(_0x2f4d77,_0x37537e,_0x5ba3c2,_0x195752,_0x58a06a,_0x1c1249){return function(_0x4e1c49){return new Promise(function(_0x13ffc4,_0x2d7725){var _0x211a83=[];var _0x5880b2=_0x195752[_0xaa30('0x4b')];if(_0x5880b2&&_0x5880b2[_0xaa30('0xd')]>0x0){_0x211a83=_['map'](_0x5880b2,_0xaa30('0x4c'));}if(_0x211a83['length']>0x0){return manageTags(_0x2f4d77,_0x211a83,_0x37537e,_0x5ba3c2,_0x4e1c49,_0x58a06a,_0x1c1249)[_0xaa30('0x25')](function(){_0x13ffc4(_0x4e1c49);});}else{_0x13ffc4(_0x4e1c49);}});};}function emit(_0x5c1d14,_0x4f134e,_0x17801d){var _0x99d382=_0xaa30('0x4d')+_0xaa30('0x4e')+_0xaa30('0x4f')+_0xaa30('0x50');var _0x21beee={'uri':_0x5c1d14+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x17801d+_0x99d382};io['to'](util[_0xaa30('0x51')](_0xaa30('0x52'),_0x4f134e))[_0xaa30('0x53')]('trigger:browser:url',_0x21beee);}exports['cs']=function(_0x1f8a61,_0x63f393,_0x394159,_0x4aa9b3,_0x13692f,_0x5a2004,_0x406c71,_0x4d2787){var _0x4cd50e={};var _0x30f9bc={'user':_0x5a2004[_0xaa30('0x54')],'pass':_0x5a2004['password']};var _0x10e200=_0xaa30('0x55');var _0x1a2fc2='sysparm_display_value=true';_0x5a2004[_0xaa30('0x56')]=intUtil[_0xaa30('0x57')](_0x5a2004[_0xaa30('0x56')]);_0x5a2004[_0xaa30('0x58')]=intUtil[_0xaa30('0x57')](_0x5a2004[_0xaa30('0x58')]);var _0x1f9686=util['format'](_0xaa30('0x59'),_0x5a2004[_0xaa30('0x56')]);_0x4cd50e[_0xaa30('0x17')]=!_[_0xaa30('0x5a')](_0x4aa9b3)?_0x4aa9b3['email']:null;_0x4cd50e[_0xaa30('0x1c')]=_0x5a2004[_0xaa30('0x5b')];_0x4cd50e['endUserNumber']=_0x4d2787[_0xaa30('0x30')]()===_0xaa30('0x39')?_0x63f393[_0xaa30('0x5c')]:_0x63f393[_0xaa30('0x5d')];_0x4cd50e[_0xaa30('0x5e')]=_0x4d2787===_0xaa30('0x5f')||_0x4d2787==='unmanaged'?_0xaa30('0x5f'):_0xaa30('0x39');var _0x5948b4=util[_0xaa30('0x51')](_0xaa30('0x60'),_0x5a2004[_0xaa30('0x58')],_0x63f393[_0xaa30('0x61')],md5(_0x63f393[_0xaa30('0x61')]));if(_0x13692f&&_0x13692f['monitor_format']){logger[_0xaa30('0x10')](_0xaa30('0x62'),_0xaa30('0x63'));_0x63f393[_0xaa30('0x64')]=_0x5948b4;}else if(_0x406c71&&_0x406c71[_0xaa30('0x65')]&&_0x406c71[_0xaa30('0x65')]!=='none'){logger[_0xaa30('0x10')](_0xaa30('0x66'),'Recording\x20is\x20enabled!');_0x63f393['recordingURL']=_0x5948b4;}else{_0x63f393[_0xaa30('0x64')]='';}return getAdminUser(_0x4d2787,_0x30f9bc,_0x4cd50e,_0x1f9686,_0x1a2fc2,_0x10e200)[_0xaa30('0x25')](getUser(_0x4d2787,_0x30f9bc,_0x1f9686,_0x1a2fc2,_0x10e200))[_0xaa30('0x25')](getEndUser(_0x4d2787,_0x30f9bc,_0x1f9686,_0x1a2fc2,_0x10e200))[_0xaa30('0x25')](getTicket(_0x4d2787,_0x30f9bc,_0x1f9686,_0x394159,_0x63f393,_0x1a2fc2))[_0xaa30('0x25')](function(_0x25449c){logger[_0xaa30('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x25449c['ticketId']));logger[_0xaa30('0x10')](util[_0xaa30('0x51')](_0xaa30('0x67'),_0x4d2787));if(_0x4d2787!==_0xaa30('0x68')){logger[_0xaa30('0x10')]('['+[_0x4d2787['toUpperCase']()]+']',_0xaa30('0x69'));emit(_0x5a2004[_0xaa30('0x56')],_0x4aa9b3[_0xaa30('0x4c')],_0x25449c[_0xaa30('0x45')]);}})[_0xaa30('0x12')](function(_0xf9624a){logger[_0xaa30('0x13')]('['+[_0x4d2787[_0xaa30('0x11')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0xf9624a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdb28=['Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','isNil','email','outbound','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','GET','then','length','adminId','result','sys_id','info','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','toString','idField','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','endUserId','getString','Subjects','Descriptions'];(function(_0x1fcfc7,_0xf13557){var _0x769525=function(_0x3caa90){while(--_0x3caa90){_0x1fcfc7['push'](_0x1fcfc7['shift']());}};_0x769525(++_0xf13557);}(_0xdb28,0x106));var _0x8db2=function(_0x37cf1c,_0x312aed){_0x37cf1c=_0x37cf1c-0x0;var _0x1374fd=_0xdb28[_0x37cf1c];return _0x1374fd;};'use strict';var _=require(_0x8db2('0x0'));var Promise=require(_0x8db2('0x1'));var rp=require(_0x8db2('0x2'));var util=require(_0x8db2('0x3'));var md5=require('md5');var Redis=require(_0x8db2('0x4'));var intUtil=require(_0x8db2('0x5'));var config=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));function getAdminUser(_0x46932f,_0x131537,_0x29f698,_0x2f3f2f,_0x1ff362,_0x126c78){return new Promise(function(_0x4ba340,_0x30dc90){var _0x476216={'method':_0x8db2('0xb'),'uri':_0x2f3f2f+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x1ff362+'&'+_0x126c78,'auth':_0x131537,'json':!![]};return rp(_0x476216)[_0x8db2('0xc')](function(_0x150942){if(_0x150942['result'][_0x8db2('0xd')]>0x0){_0x29f698[_0x8db2('0xe')]=_0x150942[_0x8db2('0xf')][0x0][_0x8db2('0x10')];}logger[_0x8db2('0x11')]('['+[_0x46932f['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x29f698);_0x4ba340(_0x29f698);})[_0x8db2('0x12')](function(_0x15e87c){logger[_0x8db2('0x13')]('['+[_0x46932f[_0x8db2('0x14')]()]+']',_0x15e87c[_0x8db2('0x15')]);_0x30dc90(_0x15e87c[_0x8db2('0x15')]);});});}function getUser(_0x2f177a,_0x3c96a7,_0x131252,_0x16c8c2,_0x5489a9){return function(_0x13b0f5){logger[_0x8db2('0x11')]('['+[_0x2f177a['toUpperCase']()]+_0x8db2('0x16'),_0x13b0f5);return new Promise(function(_0x44957d,_0x21db8c){if(intUtil[_0x8db2('0x17')](_0x13b0f5[_0x8db2('0x18')])){var _0x46ce14={'method':'GET','uri':_0x131252+'sys_user?sysparm_query=email%3D'+_0x13b0f5[_0x8db2('0x18')]+'&'+_0x16c8c2+'&'+_0x5489a9,'auth':_0x3c96a7,'json':!![]};logger[_0x8db2('0x11')]('['+[_0x2f177a[_0x8db2('0x14')]()]+_0x8db2('0x19'),_0x46ce14);return rp(_0x46ce14)['then'](function(_0x431d60){logger[_0x8db2('0x11')]('['+[_0x2f177a[_0x8db2('0x14')]()]+_0x8db2('0x1a'),_0x431d60);if(_0x431d60[_0x8db2('0xf')]['length']>0x0&&String(_0x431d60[_0x8db2('0xf')][0x0][_0x8db2('0x1b')])===_0x8db2('0x1c')){_0x13b0f5[_0x8db2('0x1d')]=_0x431d60[_0x8db2('0xf')][0x0][_0x8db2('0x10')];}else{_0x13b0f5[_0x8db2('0x1d')]=_0x13b0f5['adminId'];_0x13b0f5[_0x8db2('0x18')]=_0x13b0f5['adminEmail'];}logger['info']('['+[_0x2f177a['toUpperCase']()]+'],\x20getUser\x20crm',_0x13b0f5);_0x44957d(_0x13b0f5);})[_0x8db2('0x12')](function(_0x29b5cd){logger[_0x8db2('0x13')]('['+[_0x2f177a[_0x8db2('0x14')]()]+']',_0x29b5cd[_0x8db2('0x15')]);_0x21db8c(_0x29b5cd[_0x8db2('0x15')]);});}else{logger['info']('['+[_0x2f177a[_0x8db2('0x14')]()]+_0x8db2('0x1e'));_0x13b0f5[_0x8db2('0x1d')]=_0x13b0f5[_0x8db2('0xe')];_0x13b0f5['userEmail']=_0x13b0f5[_0x8db2('0x1f')];_0x44957d(_0x13b0f5);}});};}function createEndUser(_0x11f398,_0x241baf,_0x1687ed,_0xbe5ece,_0x21bae5){logger[_0x8db2('0x11')]('['+[_0x11f398[_0x8db2('0x14')]()]+_0x8db2('0x20'),_0x1687ed);return new Promise(function(_0x493cab,_0x4718ec){var _0x50b28d={'method':'POST','uri':_0xbe5ece+_0x8db2('0x21')+_0x21bae5,'body':{'user_name':_0x1687ed[_0x8db2('0x22')],'roles':_0x8db2('0x23'),'first_name':_0x1687ed['endUserNumber'],'active':_0x8db2('0x1c'),'date_format':'System','phone':_0x1687ed[_0x8db2('0x22')]},'auth':_0x241baf,'json':!![]};return rp(_0x50b28d)[_0x8db2('0xc')](function(_0x14bd12){logger['info']('['+[_0x11f398['toUpperCase']()]+_0x8db2('0x24'),_0x14bd12[_0x8db2('0xf')]);_0x1687ed['endUserId']=_0x14bd12['result'][_0x8db2('0x10')];_0x493cab(_0x1687ed);})[_0x8db2('0x12')](function(_0xc884a){logger[_0x8db2('0x13')]('['+[_0x11f398[_0x8db2('0x14')]()]+']',_0xc884a[_0x8db2('0x15')]);_0x4718ec(_0xc884a[_0x8db2('0x15')]);});});}function getEndUser(_0xae31b7,_0x46e0c8,_0x451c29,_0x502a02,_0x1ab5eb){return function(_0x304a72){logger['info']('['+[_0xae31b7[_0x8db2('0x14')]()]+_0x8db2('0x25'),_0x304a72);return new Promise(function(_0x5962e6,_0x4bf222){var _0x3c1983={'method':'GET','uri':_0x451c29+_0x8db2('0x26')+_0x304a72[_0x8db2('0x22')]+'&'+_0x502a02+'&'+_0x1ab5eb,'auth':_0x46e0c8,'json':!![]};return rp(_0x3c1983)[_0x8db2('0xc')](function(_0x22c896){if(_0x22c896['result'][_0x8db2('0xd')]>0x0){_0x304a72['endUserId']=_0x22c896[_0x8db2('0xf')][0x0][_0x8db2('0x10')];logger[_0x8db2('0x11')]('['+[_0xae31b7[_0x8db2('0x14')]()]+'],\x20getEndUser\x20crm',_0x304a72);_0x5962e6(_0x304a72);}else{return createEndUser(_0xae31b7,_0x46e0c8,_0x304a72,_0x451c29,_0x502a02)['then'](function(_0x2acd1f){logger[_0x8db2('0x11')]('['+[_0xae31b7['toUpperCase']()]+_0x8db2('0x27'),_0x2acd1f);_0x5962e6(_0x2acd1f);});}})[_0x8db2('0x12')](function(_0x656dd2){logger['error']('['+[_0xae31b7[_0x8db2('0x14')]()]+']',_0x656dd2[_0x8db2('0x15')]);_0x4bf222(_0x656dd2[_0x8db2('0x15')]);});});};}function getCustomFields(_0x279e74,_0x2e6f0c){var _0x40d82a={};if(_0x279e74[_0x8db2('0xd')]>0x0){_[_0x8db2('0x28')](_0x279e74,function(_0x3793a4){if(_[_0x8db2('0x29')]([_0x8db2('0x2a'),_0x8db2('0x2b')],_0x3793a4[_0x8db2('0x2c')])&&_0x3793a4['nameField']&&!_0x3793a4[_0x8db2('0x2d')]){_0x40d82a[_0x3793a4[_0x8db2('0x2e')]['toLowerCase']()]=_0x3793a4['content'][_0x8db2('0x2f')]();}else if(_['includes']([_0x8db2('0x2a'),_0x8db2('0x2b')],_0x3793a4[_0x8db2('0x2c')])&&_0x3793a4[_0x8db2('0x30')]&&_0x3793a4[_0x8db2('0x2d')]){_0x40d82a[_0x3793a4[_0x8db2('0x30')][_0x8db2('0x31')]()]=_0x3793a4['content'][_0x8db2('0x2f')]();}else if(_0x3793a4[_0x8db2('0x2c')]===_0x8db2('0x32')&&_0x3793a4[_0x8db2('0x33')]&&_0x3793a4['idField']&&_0x3793a4[_0x8db2('0x2d')]){_0x40d82a[_0x3793a4[_0x8db2('0x30')][_0x8db2('0x31')]()]=_0x2e6f0c[_0x3793a4[_0x8db2('0x33')]]['toString']();}else if(_0x3793a4[_0x8db2('0x2c')]==='customVariable'&&_0x3793a4[_0x8db2('0x34')]&&_0x3793a4[_0x8db2('0x34')][_0x8db2('0x35')]&&_0x3793a4['idField']&&_0x3793a4['customField']){_0x40d82a[_0x3793a4[_0x8db2('0x30')]['toLowerCase']()]=_0x2e6f0c[_0x3793a4[_0x8db2('0x34')][_0x8db2('0x35')][_0x8db2('0x31')]()][_0x8db2('0x2f')]();}});}return _0x40d82a;}function getTicket(_0x2244b9,_0x40c6e6,_0x4355e2,_0xab6bdd,_0x4291e3,_0x12a1ef){return function(_0x1362ed){logger[_0x8db2('0x11')]('['+[_0x2244b9['toUpperCase']()]+_0x8db2('0x36'),_0x1362ed);return new Promise(function(_0x2ada52,_0xdbba64){var _0x3244db=_0x2244b9['toLowerCase']()==='outbound'?_0x1362ed[_0x8db2('0x1d')]:_0x1362ed[_0x8db2('0x37')];var _0x164020={'method':'POST','uri':_0x4355e2+'incident'+'?'+_0x12a1ef,'body':Object['assign']({},{'active':_0x8db2('0x1c'),'caller_id':_0x3244db,'assigned_to':_0x1362ed[_0x8db2('0x1d')],'short_description':intUtil[_0x8db2('0x38')](_0xab6bdd[_0x8db2('0x39')],_0x4291e3,'\x20'),'description':intUtil[_0x8db2('0x38')](_0xab6bdd[_0x8db2('0x3a')],_0x4291e3,'\x0a')},getCustomFields(_0xab6bdd[_0x8db2('0x3b')],_0x4291e3)),'auth':_0x40c6e6,'json':!![]};return rp(_0x164020)['then'](function(_0x5329e6){logger[_0x8db2('0x11')]('['+[_0x2244b9[_0x8db2('0x14')]()]+_0x8db2('0x3c'),_0x5329e6[_0x8db2('0xf')]);_0x1362ed[_0x8db2('0x3d')]=_0x5329e6[_0x8db2('0xf')][_0x8db2('0x10')];_0x1362ed[_0x8db2('0x3e')]=_0x5329e6[_0x8db2('0xf')][_0x8db2('0x3f')];logger[_0x8db2('0x11')]('['+[_0x2244b9[_0x8db2('0x14')]()]+_0x8db2('0x40'),_0x1362ed);_0x2ada52(_0x1362ed);})[_0x8db2('0x12')](function(_0x47696e){logger['error']('['+[_0x2244b9[_0x8db2('0x14')]()]+']',_0x47696e[_0x8db2('0x15')]);_0xdbba64(_0x47696e['message']);});});};}function createRemoteTag(_0x27b644,_0xd78022,_0x3af298,_0x547215){return new Promise(function(_0x3498dc,_0x27acd2){var _0x1872fa={'method':_0x8db2('0x41'),'uri':_0x3af298+_0x8db2('0x42')+'?'+_0x547215,'body':{'short_description':_0x27b644,'global':!![],'active':!![],'name':_0x27b644},'auth':_0xd78022,'json':!![]};return rp(_0x1872fa)['then'](function(_0x467505){var _0x159dcb=_0x467505[_0x8db2('0xf')]['sys_id'];_0x3498dc(_0x159dcb);});});}function getRemoteTag(_0x1e7d1a,_0x18cc13,_0x33dddd,_0x7b0de8,_0x2ac590){return new Promise(function(_0x16d897,_0x12a81a){var _0x5ca295={'method':_0x8db2('0xb'),'uri':_0x33dddd+_0x8db2('0x42')+'?sysparm_query=name%3D'+_0x1e7d1a+'&'+_0x7b0de8,'auth':_0x18cc13,'json':!![]};return rp(_0x5ca295)[_0x8db2('0xc')](function(_0x1683b8){if(_0x1683b8['result'][_0x8db2('0xd')]>0x0){var _0x927c01=_0x1683b8[_0x8db2('0xf')][0x0][_0x8db2('0x10')];_0x16d897(_0x927c01);}else{return createRemoteTag(_0x1e7d1a,_0x18cc13,_0x33dddd,_0x7b0de8)[_0x8db2('0xc')](function(_0x3c7d8c){_0x16d897(_0x3c7d8c);});}});});}function assignTagToIncident(_0x10f267,_0x33a600,_0x120ef2,_0x173a5e,_0x12fd12){return new Promise(function(_0x447a47,_0x3272c6){var _0x1ce89f={'method':_0x8db2('0x41'),'uri':_0x120ef2+_0x8db2('0x43')+'?'+_0x12fd12,'body':{'label':_0x10f267,'table':'incident','id_type':_0x8db2('0x44'),'table_key':_0x173a5e[_0x8db2('0x3d')],'title':_0x8db2('0x45')+_0x173a5e[_0x8db2('0x3e')],'id_display':_0x173a5e[_0x8db2('0x3e')]},'auth':_0x33a600,'json':!![]};return rp(_0x1ce89f)['then'](function(_0x3dd6b1){_0x447a47();})[_0x8db2('0x12')](function(){_0x447a47();});});}function manageTags(_0x3ab670,_0x1e1c0d,_0x2ad70f,_0x348da8,_0x17341d,_0x2c7b04,_0x24cfe9){return new Promise(function(_0x431f24,_0x10f42a){var _0xfe6bac=[];_0x1e1c0d[_0x8db2('0x28')](function(_0x2228d1){_0xfe6bac[_0x8db2('0x46')](getRemoteTag(_0x2228d1,_0x2ad70f,_0x348da8,_0x2c7b04,_0x24cfe9));});return Promise[_0x8db2('0x47')](_0xfe6bac)[_0x8db2('0xc')](function(_0xefb12){if(_0xefb12['length']){logger[_0x8db2('0x11')]('['+[_0x3ab670['toUpperCase']()]+_0x8db2('0x48'),_0xefb12);var _0x570c53=[];_0xefb12[_0x8db2('0x28')](function(_0x39330c){_0x570c53[_0x8db2('0x46')](assignTagToIncident(_0x39330c,_0x2ad70f,_0x348da8,_0x17341d,_0x2c7b04));});return Promise[_0x8db2('0x47')](_0x570c53)[_0x8db2('0xc')](function(){_0x431f24();})['catch'](function(){_0x431f24();});}else{_0x431f24();}});});}function getTags(_0x50c5fb,_0x3d1128,_0x42019e,_0x21ec87,_0x3ba1d2,_0x20b49c){return function(_0x1f28d2){return new Promise(function(_0x3e3de3,_0x79eabc){var _0x504039=[];var _0x2bde16=_0x21ec87[_0x8db2('0x49')];if(_0x2bde16&&_0x2bde16[_0x8db2('0xd')]>0x0){_0x504039=_[_0x8db2('0x4a')](_0x2bde16,_0x8db2('0x35'));}if(_0x504039[_0x8db2('0xd')]>0x0){return manageTags(_0x50c5fb,_0x504039,_0x3d1128,_0x42019e,_0x1f28d2,_0x3ba1d2,_0x20b49c)[_0x8db2('0xc')](function(){_0x3e3de3(_0x1f28d2);});}else{_0x3e3de3(_0x1f28d2);}});};}function emit(_0x20caf0,_0x4938bb,_0x54318c){var _0x358009=_0x8db2('0x4b')+_0x8db2('0x4c')+_0x8db2('0x4d')+_0x8db2('0x4e');var _0x5a074e={'uri':_0x20caf0+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x54318c+_0x358009};io['to'](util[_0x8db2('0x4f')](_0x8db2('0x50'),_0x4938bb))['emit'](_0x8db2('0x51'),_0x5a074e);}exports['cs']=function(_0x2be647,_0x1ab84c,_0x5093e8,_0x26523b,_0x291375,_0x2cf731,_0x4f5458,_0x3ff023){var _0x12049d={};var _0x2a520b={'user':_0x2cf731[_0x8db2('0x52')],'pass':_0x2cf731[_0x8db2('0x53')]};var _0x5923b3=_0x8db2('0x54');var _0x3023fe=_0x8db2('0x55');_0x2cf731['remoteUri']=intUtil['stripTrailingSlash'](_0x2cf731[_0x8db2('0x56')]);_0x2cf731[_0x8db2('0x57')]=intUtil['stripTrailingSlash'](_0x2cf731[_0x8db2('0x57')]);var _0x40a1f4=util[_0x8db2('0x4f')](_0x8db2('0x58'),_0x2cf731[_0x8db2('0x56')]);_0x12049d[_0x8db2('0x18')]=!_[_0x8db2('0x59')](_0x26523b)?_0x26523b[_0x8db2('0x5a')]:null;_0x12049d[_0x8db2('0x1f')]=_0x2cf731[_0x8db2('0x5a')];_0x12049d[_0x8db2('0x22')]=_0x3ff023[_0x8db2('0x31')]()===_0x8db2('0x5b')?_0x1ab84c['destcalleridnum']:_0x1ab84c[_0x8db2('0x5c')];_0x12049d['callDirection']=_0x3ff023===_0x8db2('0x5d')||_0x3ff023===_0x8db2('0x5e')?'queue':_0x8db2('0x5b');var _0x2fa89d=util['format'](_0x8db2('0x5f'),_0x2cf731[_0x8db2('0x57')],_0x1ab84c[_0x8db2('0x60')],md5(_0x1ab84c[_0x8db2('0x60')]));if(_0x291375&&_0x291375[_0x8db2('0x61')]){logger[_0x8db2('0x11')](_0x8db2('0x62'),_0x8db2('0x63'));_0x1ab84c[_0x8db2('0x64')]=_0x2fa89d;}else if(_0x4f5458&&_0x4f5458['recordingFormat']&&_0x4f5458['recordingFormat']!==_0x8db2('0x65')){logger['info'](_0x8db2('0x66'),_0x8db2('0x63'));_0x1ab84c[_0x8db2('0x64')]=_0x2fa89d;}else{_0x1ab84c['recordingURL']='';}return getAdminUser(_0x3ff023,_0x2a520b,_0x12049d,_0x40a1f4,_0x3023fe,_0x5923b3)[_0x8db2('0xc')](getUser(_0x3ff023,_0x2a520b,_0x40a1f4,_0x3023fe,_0x5923b3))[_0x8db2('0xc')](getEndUser(_0x3ff023,_0x2a520b,_0x40a1f4,_0x3023fe,_0x5923b3))[_0x8db2('0xc')](getTicket(_0x3ff023,_0x2a520b,_0x40a1f4,_0x5093e8,_0x1ab84c,_0x3023fe))['then'](function(_0x3ae18c){logger[_0x8db2('0x11')](util[_0x8db2('0x4f')](_0x8db2('0x67'),_0x3ae18c['ticketId']));logger[_0x8db2('0x11')](util[_0x8db2('0x4f')](_0x8db2('0x68'),_0x3ff023));if(_0x3ff023!==_0x8db2('0x5e')){logger[_0x8db2('0x11')]('['+[_0x3ff023[_0x8db2('0x14')]()]+']',_0x8db2('0x69'));emit(_0x2cf731[_0x8db2('0x56')],_0x26523b[_0x8db2('0x35')],_0x3ae18c[_0x8db2('0x3d')]);}})[_0x8db2('0x12')](function(_0x4d1a55){logger[_0x8db2('0x13')]('['+[_0x3ff023[_0x8db2('0x14')]()]+_0x8db2('0x6a'),util['inspect'](_0x4d1a55,{'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 8bfdaff..106223e 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 _0x1aac=['getString','assigned_user_id','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','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!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','Contacts','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','stripTrailingSlash','remoteUri','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','contacts','version','user:%s','trigger:browser:url','catch','outbound','uri','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','Ticket\x20created!','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','sugarcrm','redis','defaults','localhost','POST','info','name'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x1aac,0x6b));var _0xc1aa=function(_0x54978a,_0x1b159a){_0x54978a=_0x54978a-0x0;var _0x3d26c6=_0x1aac[_0x54978a];return _0x3d26c6;};'use strict';var _=require(_0xc1aa('0x0'));var rp=require(_0xc1aa('0x1'));var BPromise=require(_0xc1aa('0x2'));var md5=require(_0xc1aa('0x3'));var util=require(_0xc1aa('0x4'));var Redis=require(_0xc1aa('0x5'));var intUtil=require('./util');var config=require(_0xc1aa('0x6'));var logger=require('../../../../config/logger')(_0xc1aa('0x7'));config[_0xc1aa('0x8')]=_[_0xc1aa('0x9')](config[_0xc1aa('0x8')],{'host':_0xc1aa('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc1aa('0x8')]));var def={'method':_0xc1aa('0xb'),'json':!![]};function emit(_0x1c3d32,_0x222c95,_0x20592d){io['to'](_0x1c3d32)['emit'](_0x222c95,_0x20592d);}function getTicket(_0x4de6a9,_0x2a1276,_0x53749b,_0x412934,_0x4b7ebf,_0xb2a65b,_0x14bf36,_0x5ec3ed){logger[_0xc1aa('0xc')]('Creating\x20new\x20ticket...');var _0x562457=new Date();var _0x39a713=[{'name':_0xc1aa('0xd'),'value':intUtil[_0xc1aa('0xe')](_0x412934['Subjects'],_0x4b7ebf,'\x20')},{'name':_0xc1aa('0xf'),'value':_0x2a1276['id']},{'name':'created_by','value':_0x2a1276['id']},{'name':_0xc1aa('0x10'),'value':intUtil[_0xc1aa('0xe')](_0x412934[_0xc1aa('0x11')],_0x4b7ebf,'\x0a')},{'name':_0xc1aa('0x12'),'value':_0x562457[_0xc1aa('0x13')]()['slice'](0x0,0x13)[_0xc1aa('0x14')]('T','\x20')},{'name':_0xc1aa('0x15'),'value':'0'},{'name':_0xc1aa('0x16'),'value':'15'},{'name':_0xc1aa('0x17'),'value':_0x53749b['id']},{'name':_0xc1aa('0x18'),'value':'Contacts'},{'name':_0xc1aa('0x19'),'value':_0x53749b['name']},{'name':_0xc1aa('0x1a'),'value':_0x5ec3ed}];if(_0xb2a65b[_0xc1aa('0x1b')]){_[_0xc1aa('0x1c')](_0xb2a65b,function(_0x6d12c5){if(_0x4b7ebf[_0x6d12c5[_0xc1aa('0x1d')]]){_0x39a713[_0xc1aa('0x1e')]({'name':_0x6d12c5[_0xc1aa('0x1f')],'value':_0x4b7ebf[_0x6d12c5[_0xc1aa('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xc1aa('0x20'),'response_type':_0xc1aa('0x20'),'rest_data':JSON[_0xc1aa('0x21')]({'session':_0x14bf36['id'],'module_name':_0xc1aa('0x22'),'name_value_list':_0x39a713})}});}function getAuth(_0x576a84){return util['format'](_0xc1aa('0x23'),new Buffer(_0x576a84[_0xc1aa('0x24')]+':X')[_0xc1aa('0x25')](_0xc1aa('0x26')));}function getServerInfo(_0x45ab10){return request({'form':{'method':_0xc1aa('0x27'),'input_type':_0xc1aa('0x20'),'response_type':_0xc1aa('0x20'),'rest_data':JSON[_0xc1aa('0x21')]({'session':_0x45ab10['id']})}});}function getUser(_0x53705b,_0x1b3e5d,_0x48362e){if(!_[_0xc1aa('0x28')](_0x1b3e5d)){logger[_0xc1aa('0xc')](_0xc1aa('0x29'),_0x1b3e5d);return request({'form':{'method':_0xc1aa('0x2a'),'input_type':_0xc1aa('0x20'),'response_type':_0xc1aa('0x20'),'rest_data':JSON[_0xc1aa('0x21')]({'session':_0x48362e['id'],'module_name':_0xc1aa('0x2b'),'query':util[_0xc1aa('0x2c')](_0xc1aa('0x2d'),_0x1b3e5d),'order_by':'','offset':'0','select_fields':['id',_0xc1aa('0xd'),_0xc1aa('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc1aa('0x2f')](function(_0xdea8a1){if(_0xdea8a1[_0xc1aa('0x30')][_0xc1aa('0x1b')]){var _0x3bb0aa=_[_0xc1aa('0x31')](_0xdea8a1[_0xc1aa('0x30')],function(_0x4a966c){return _0x4a966c[_0xc1aa('0x32')][_0xc1aa('0x2e')][_0xc1aa('0x33')]===_0x1b3e5d;});if(_0x3bb0aa){logger[_0xc1aa('0xc')](_0xc1aa('0x34'));return BPromise[_0xc1aa('0x35')]({'id':_0x3bb0aa[_0xc1aa('0x32')]['id'][_0xc1aa('0x33')],'name':_0x3bb0aa['name_value_list'][_0xc1aa('0xd')][_0xc1aa('0x33')]});}}logger[_0xc1aa('0xc')](_0xc1aa('0x36'));return BPromise[_0xc1aa('0x35')]({'id':_0x48362e[_0xc1aa('0x32')][_0xc1aa('0x37')][_0xc1aa('0x33')],'name':_0x48362e[_0xc1aa('0x32')][_0xc1aa('0x2e')]['value']});});}else{logger[_0xc1aa('0xc')](_0xc1aa('0x38'));return BPromise[_0xc1aa('0x35')]({'id':_0x48362e[_0xc1aa('0x32')]['user_id'][_0xc1aa('0x33')],'name':_0x48362e['name_value_list'][_0xc1aa('0x2e')][_0xc1aa('0x33')]});}}function getEndUser(_0x4d3d84,_0x474259,_0x33c0e5,_0x2da7e3){logger['info']('Searching\x20enduser\x20with\x20phone',_0x33c0e5);return request({'form':{'method':_0xc1aa('0x2a'),'input_type':_0xc1aa('0x20'),'response_type':_0xc1aa('0x20'),'rest_data':JSON[_0xc1aa('0x21')]({'session':_0x2da7e3['id'],'module_name':'Contacts','query':util[_0xc1aa('0x2c')](_0xc1aa('0x39'),_0x33c0e5),'order_by':'','offset':'0','select_fields':['id',_0xc1aa('0xd'),_0xc1aa('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc1aa('0x2f')](function(_0x469e35){if(_0x469e35['entry_list'][_0xc1aa('0x1b')]){var _0x713058=_[_0xc1aa('0x31')](_0x469e35[_0xc1aa('0x30')],function(_0x516745){return _0x516745[_0xc1aa('0x32')][_0xc1aa('0x3a')][_0xc1aa('0x33')]===_0x33c0e5;});if(_0x713058){logger[_0xc1aa('0xc')](_0xc1aa('0x3b'));return BPromise[_0xc1aa('0x35')]({'id':_0x713058[_0xc1aa('0x32')]['id']['value'],'name':_0x713058[_0xc1aa('0x32')][_0xc1aa('0xd')][_0xc1aa('0x33')],'phone':_0x713058[_0xc1aa('0x32')][_0xc1aa('0x3a')][_0xc1aa('0x33')]});}}else{logger[_0xc1aa('0xc')](_0xc1aa('0x3c'));return request({'form':{'method':_0xc1aa('0x3d'),'input_type':_0xc1aa('0x20'),'response_type':_0xc1aa('0x20'),'rest_data':JSON[_0xc1aa('0x21')]({'session':_0x2da7e3['id'],'module_name':_0xc1aa('0x3e'),'name_value_list':[{'name':_0xc1aa('0x3f'),'value':_0x474259!==''?_0x474259:util[_0xc1aa('0x2c')](_0xc1aa('0x40'),_0x33c0e5)},{'name':_0xc1aa('0x3a'),'value':_0x33c0e5}]})}})[_0xc1aa('0x2f')](function(_0x450940){logger[_0xc1aa('0xc')](_0xc1aa('0x41'));return BPromise[_0xc1aa('0x35')]({'id':_0x450940['id'],'name':_0x450940[_0xc1aa('0x30')][_0xc1aa('0x3f')]['value'],'phone':_0x450940[_0xc1aa('0x30')][_0xc1aa('0x3a')][_0xc1aa('0x33')]});});}});}function request(_0x223600){logger[_0xc1aa('0x42')](_0xc1aa('0x43'),JSON[_0xc1aa('0x21')](_0x223600));return rp(_[_0xc1aa('0x44')](def,_0x223600));}function getTags(_0x2a01e7,_0x2a17b5){var _0x21da44=[];if(_0x2a01e7&&_0x2a01e7[_0xc1aa('0x1b')]>0x0){_0x21da44=_[_0xc1aa('0x45')](_0x2a01e7,_0x2a17b5);}return _0x21da44;}function getCustomFields(_0x5efa36,_0x31ddd6){var _0x140501=[];var _0x1e3e8e={'custom_fields':[]};if(_0x5efa36[_0xc1aa('0x1b')]>0x0){_[_0xc1aa('0x1c')](_0x5efa36,function(_0x2c1e47){if(_0x2c1e47[_0xc1aa('0x46')]===_0xc1aa('0x47')&&_0x2c1e47[_0xc1aa('0x48')]&&!_0x2c1e47[_0xc1aa('0x49')]){_0x1e3e8e[_0x2c1e47['nameField'][_0xc1aa('0x4a')]()]=_0x2c1e47['content'][_0xc1aa('0x25')]();}else if(_0x2c1e47[_0xc1aa('0x46')]===_0xc1aa('0x47')&&_0x2c1e47['idField']&&_0x2c1e47[_0xc1aa('0x49')]){_0x1e3e8e['custom_fields'][_0xc1aa('0x1e')]({'id':_0x2c1e47['idField'],'value':_0x2c1e47[_0xc1aa('0x4b')][_0xc1aa('0x25')]()});}else if(_0x2c1e47[_0xc1aa('0x46')]===_0xc1aa('0x4c')&&_0x2c1e47[_0xc1aa('0x1d')]&&_0x2c1e47['idField']&&_0x2c1e47[_0xc1aa('0x49')]){_0x31ddd6[_0x2c1e47[_0xc1aa('0x1d')]]&&_0x1e3e8e[_0xc1aa('0x4d')][_0xc1aa('0x1e')]({'id':_0x2c1e47[_0xc1aa('0x1f')],'value':_0x31ddd6[_0x2c1e47['variableName']][_0xc1aa('0x25')]()});}else if(_0x2c1e47['type']===_0xc1aa('0x4e')&&_0x2c1e47[_0xc1aa('0x4f')]&&_0x2c1e47[_0xc1aa('0x4f')]['name']&&_0x2c1e47[_0xc1aa('0x1f')]&&_0x2c1e47[_0xc1aa('0x49')]){_0x31ddd6[_0x2c1e47[_0xc1aa('0x4f')][_0xc1aa('0xd')]['toLowerCase']()]&&_0x1e3e8e[_0xc1aa('0x4d')][_0xc1aa('0x1e')]({'id':_0x2c1e47[_0xc1aa('0x1f')],'value':_0x31ddd6[_0x2c1e47[_0xc1aa('0x4f')][_0xc1aa('0xd')]['toLowerCase']()][_0xc1aa('0x25')]()});}});}return _0x1e3e8e;}function getConnection(_0x28d67c){return request({'method':_0xc1aa('0xb'),'form':{'method':_0xc1aa('0x50'),'input_type':_0xc1aa('0x20'),'response_type':_0xc1aa('0x20'),'rest_data':JSON[_0xc1aa('0x21')]({'user_auth':{'user_name':_0x28d67c[_0xc1aa('0x51')],'password':_0x28d67c[_0xc1aa('0x52')],'encryption':_0xc1aa('0x53')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xc1aa('0x2f')](function(_0x49038d){var _0x49ec18=_0x49038d;if(_0x49ec18['id']){def[_0xc1aa('0x54')]=_0x49ec18['id'];return BPromise[_0xc1aa('0x35')](_0x49ec18);}else{throw new Error(util[_0xc1aa('0x2c')](_0xc1aa('0x55'),_0x28d67c['id']));}});}function setRelationship(_0x1fe968,_0xc4c775,_0x2ab233,_0x424a77){return request({'form':{'method':'set_relationship','input_type':_0xc1aa('0x20'),'response_type':_0xc1aa('0x20'),'rest_data':JSON[_0xc1aa('0x21')]({'session':_0x1fe968['id'],'module_name':_0xc1aa('0x22'),'module_id':_0x2ab233['id'],'link_field_name':_0x424a77,'related_ids':[_0xc4c775['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x428af1,_0x4eb4eb,_0x53dab6,_0x1cc7ab,_0x3517bf,_0x28e021){var _0x3d2818,_0x4c1b27,_0x2f6319,_0x2c23a8;_0x28e021['remoteUri']=intUtil[_0xc1aa('0x56')](_0x28e021[_0xc1aa('0x57')]);_0x28e021['serverUrl']=intUtil[_0xc1aa('0x56')](_0x28e021[_0xc1aa('0x58')]);def['uri']=util['format'](_0xc1aa('0x59'),_0x28e021[_0xc1aa('0x57')]);if(_0x3517bf&&_0x3517bf['monitor_format']){logger['info'](_0xc1aa('0x5a'),_0xc1aa('0x5b'));_0x4eb4eb[_0xc1aa('0x5c')]=util[_0xc1aa('0x2c')](_0xc1aa('0x5d'),_0x28e021['serverUrl'],_0x4eb4eb['uniqueid'],md5(_0x4eb4eb[_0xc1aa('0x5e')]));}else{_0x4eb4eb[_0xc1aa('0x5c')]='';}return getConnection(_0x28e021)['then'](function(_0x2af276){_0x2c23a8=_0x2af276;return getUser(_0x28e021,_0x1cc7ab[_0xc1aa('0xd')],_0x2c23a8);})[_0xc1aa('0x2f')](function(_0x202c8f){_0x3d2818=_0x202c8f;logger[_0xc1aa('0xc')]('The\x20User\x20ID\x20is:',_0x3d2818['id']);return getEndUser(_0x28e021,_0x4eb4eb[_0xc1aa('0x5f')],_0x4eb4eb[_0xc1aa('0x60')],_0x2c23a8);})['then'](function(_0x2bab3f){_0x4c1b27=_0x2bab3f;logger[_0xc1aa('0xc')](_0xc1aa('0x61'),_0x4c1b27['id']);return getTicket(_0x28e021,_0x3d2818,_0x4c1b27,_0x53dab6,_0x4eb4eb,_0x53dab6[_0xc1aa('0x62')],_0x2c23a8,_0xc1aa('0x63'));})[_0xc1aa('0x2f')](function(_0x40ca36){_0x2f6319=_0x40ca36;logger[_0xc1aa('0xc')]('Ticket\x20created!');logger[_0xc1aa('0xc')](_0xc1aa('0x64'),_0x2f6319['id']);return setRelationship(_0x2c23a8,_0x3d2818,_0x2f6319,'users');})[_0xc1aa('0x2f')](function(){return setRelationship(_0x2c23a8,_0x4c1b27,_0x2f6319,_0xc1aa('0x65'));})['then'](function(){return getServerInfo(_0x2c23a8);})[_0xc1aa('0x2f')](function(_0x1fb958){var _0x181360=parseInt(_0x1fb958[_0xc1aa('0x66')]['charAt'](0x0));var _0x5cd185=util[_0xc1aa('0x2c')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x28e021[_0xc1aa('0x57')],_0x2f6319['id']);if(_0x181360>0x6){_0x5cd185=util[_0xc1aa('0x2c')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x28e021[_0xc1aa('0x57')],_0x2f6319['id']);}logger['info'](_0xc1aa('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc1aa('0x2c')](_0xc1aa('0x67'),_0x1cc7ab[_0xc1aa('0xd')]),_0xc1aa('0x68'),{'uri':_0x5cd185});})[_0xc1aa('0x69')](function(_0x468594){logger['error'](_0xc1aa('0x5a'),JSON[_0xc1aa('0x21')](_0x468594));});};exports[_0xc1aa('0x6a')]=function(_0x1a5285,_0x336c94,_0x138f38,_0x1de90f,_0x4d1081,_0x519225,_0x227b07){var _0x31b92c,_0x10bed1,_0x1127e8,_0x984c18;_0x519225[_0xc1aa('0x57')]=intUtil[_0xc1aa('0x56')](_0x519225[_0xc1aa('0x57')]);_0x519225[_0xc1aa('0x58')]=intUtil[_0xc1aa('0x56')](_0x519225[_0xc1aa('0x58')]);def[_0xc1aa('0x6b')]=util[_0xc1aa('0x2c')](_0xc1aa('0x59'),_0x519225[_0xc1aa('0x57')]);if(_0x227b07&&_0x227b07['recordingFormat']&&_0x227b07['recordingFormat']!=='none'){logger[_0xc1aa('0xc')](_0xc1aa('0x6c'),'Recording\x20is\x20enabled!');_0x336c94[_0xc1aa('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x519225[_0xc1aa('0x58')],_0x336c94['uniqueid'],md5(_0x336c94[_0xc1aa('0x5e')]));}return getConnection(_0x519225)['then'](function(_0x19be91){_0x984c18=_0x19be91;return getUser(_0x519225,_0x1de90f[_0xc1aa('0xd')],_0x984c18);})[_0xc1aa('0x2f')](function(_0x187a7e){_0x31b92c=_0x187a7e;logger[_0xc1aa('0xc')](_0xc1aa('0x6d'),_0x31b92c['id']);return getEndUser(_0x519225,_0x336c94['destcalleridname'],_0x336c94[_0xc1aa('0x6e')],_0x984c18);})['then'](function(_0x3a585e){_0x10bed1=_0x3a585e;logger[_0xc1aa('0xc')](_0xc1aa('0x61'),_0x10bed1['id']);return getTicket(_0x519225,_0x31b92c,_0x10bed1,_0x138f38,_0x336c94,_0x138f38[_0xc1aa('0x62')],_0x984c18,_0xc1aa('0x6f'));})[_0xc1aa('0x2f')](function(_0x30f22e){_0x1127e8=_0x30f22e;logger[_0xc1aa('0xc')](_0xc1aa('0x70'));logger[_0xc1aa('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1127e8['id']);return setRelationship(_0x984c18,_0x31b92c,_0x1127e8,_0xc1aa('0x71'));})[_0xc1aa('0x2f')](function(){return setRelationship(_0x984c18,_0x10bed1,_0x1127e8,_0xc1aa('0x65'));})['then'](function(){return getServerInfo(_0x984c18);})[_0xc1aa('0x2f')](function(_0x76e13d){var _0x56893=parseInt(_0x76e13d['version'][_0xc1aa('0x72')](0x0));var _0xde00f5=util[_0xc1aa('0x2c')](_0xc1aa('0x73'),_0x519225['remoteUri'],_0x1127e8['id']);if(_0x56893>0x6){_0xde00f5=util[_0xc1aa('0x2c')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x519225[_0xc1aa('0x57')],_0x1127e8['id']);}logger[_0xc1aa('0xc')]('[OUTBOUND]',_0xc1aa('0x74'));emit(util[_0xc1aa('0x2c')](_0xc1aa('0x67'),_0x1de90f['name']),'trigger:browser:url',{'uri':_0xde00f5});})['catch'](function(_0x26b2e5){logger[_0xc1aa('0x75')]('[OUTBOUND]',JSON['stringify'](_0x26b2e5));});};exports[_0xc1aa('0x76')]=function(_0xb88144,_0x55e507,_0x515a97,_0x24bcc2,_0x207abf,_0x88f9d9){var _0x2df163,_0x2e265b,_0x307dfe,_0x5b3027;_0x88f9d9[_0xc1aa('0x57')]=intUtil['stripTrailingSlash'](_0x88f9d9['remoteUri']);_0x88f9d9[_0xc1aa('0x58')]=intUtil[_0xc1aa('0x56')](_0x88f9d9['serverUrl']);def[_0xc1aa('0x6b')]=util[_0xc1aa('0x2c')](_0xc1aa('0x59'),_0x88f9d9[_0xc1aa('0x57')]);if(_0x207abf&&_0x207abf['monitor_format']){logger['info']('['+_0x55e507[_0xc1aa('0x77')]['toUpperCase']()+']',_0xc1aa('0x5b'));_0x55e507[_0xc1aa('0x5c')]=util[_0xc1aa('0x2c')](_0xc1aa('0x5d'),_0x88f9d9[_0xc1aa('0x58')],_0x55e507[_0xc1aa('0x5e')],md5(_0x55e507[_0xc1aa('0x5e')]));}else{_0x55e507[_0xc1aa('0x5c')]='';}return getConnection(_0x88f9d9)['then'](function(_0x539d95){_0x5b3027=_0x539d95;if(!_[_0xc1aa('0x28')](_0x24bcc2)){return getUser(_0x88f9d9,_0x24bcc2['name'],_0x5b3027);}else{return getUser(_0x88f9d9,null,_0x5b3027);}})['then'](function(_0x340735){_0x2df163=_0x340735;logger[_0xc1aa('0xc')](_0xc1aa('0x6d'),_0x2df163['id']);return getEndUser(_0x88f9d9,_0x55e507[_0xc1aa('0x5f')],_0x55e507['calleridnum'],_0x5b3027);})['then'](function(_0x3e8c11){_0x2e265b=_0x3e8c11;logger['info'](_0xc1aa('0x61'),_0x2e265b['id']);return getTicket(_0x88f9d9,_0x2df163,_0x2e265b,_0x515a97,_0x55e507,_0x515a97[_0xc1aa('0x62')],_0x5b3027,_0xc1aa('0x63'));})['then'](function(_0x182c84){_0x307dfe=_0x182c84;logger['info'](_0xc1aa('0x70'));logger['info'](_0xc1aa('0x64'),_0x307dfe['id']);return setRelationship(_0x5b3027,_0x2df163,_0x307dfe,_0xc1aa('0x71'));})[_0xc1aa('0x2f')](function(){return setRelationship(_0x5b3027,_0x2e265b,_0x307dfe,_0xc1aa('0x65'));})['then'](function(){return getServerInfo(_0x5b3027);})[_0xc1aa('0x69')](function(_0x3d6e82){logger[_0xc1aa('0x75')]('['+_0x55e507['lastevent'][_0xc1aa('0x78')]()+']',JSON[_0xc1aa('0x21')](_0x3d6e82));});}; \ No newline at end of file +var _0x7948=['ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','info','getString','Subjects','assigned_user_id','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','forEach','push','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','get_entry_list','name','user_name','then','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','type','string','nameField','customField','toLowerCase','custom_fields','idField','customVariable','Variable','POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','remoteUri','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:','Fields','Inbound','Ticket\x20created!','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','catch','unmanaged','toUpperCase','isNil','lastevent','request-promise','bluebird','util'];(function(_0x479d8f,_0x861a89){var _0x4f0537=function(_0x1fa522){while(--_0x1fa522){_0x479d8f['push'](_0x479d8f['shift']());}};_0x4f0537(++_0x861a89);}(_0x7948,0x1d1));var _0x8794=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x7948[_0x3e6d5d];return _0x238923;};'use strict';var _=require('lodash');var rp=require(_0x8794('0x0'));var BPromise=require(_0x8794('0x1'));var md5=require('md5');var util=require(_0x8794('0x2'));var Redis=require(_0x8794('0x3'));var intUtil=require(_0x8794('0x4'));var config=require(_0x8794('0x5'));var logger=require(_0x8794('0x6'))(_0x8794('0x7'));config[_0x8794('0x8')]=_[_0x8794('0x9')](config[_0x8794('0x8')],{'host':_0x8794('0xa'),'port':0x18eb});var io=require(_0x8794('0xb'))(new Redis(config[_0x8794('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x3fc249,_0x4a818e,_0x23f279){io['to'](_0x3fc249)['emit'](_0x4a818e,_0x23f279);}function getTicket(_0x10611c,_0x3feb6e,_0x29edc0,_0x261f2c,_0x4edf0f,_0x1fcdaa,_0x461c32,_0x124da8){logger[_0x8794('0xc')]('Creating\x20new\x20ticket...');var _0x48f50a=new Date();var _0x4e1d76=[{'name':'name','value':intUtil[_0x8794('0xd')](_0x261f2c[_0x8794('0xe')],_0x4edf0f,'\x20')},{'name':_0x8794('0xf'),'value':_0x3feb6e['id']},{'name':'created_by','value':_0x3feb6e['id']},{'name':'description','value':intUtil[_0x8794('0xd')](_0x261f2c['Descriptions'],_0x4edf0f,'\x0a')},{'name':'date_start','value':_0x48f50a[_0x8794('0x10')]()[_0x8794('0x11')](0x0,0x13)[_0x8794('0x12')]('T','\x20')},{'name':_0x8794('0x13'),'value':'0'},{'name':_0x8794('0x14'),'value':'15'},{'name':_0x8794('0x15'),'value':_0x29edc0['id']},{'name':_0x8794('0x16'),'value':_0x8794('0x17')},{'name':_0x8794('0x18'),'value':_0x29edc0['name']},{'name':'direction','value':_0x124da8}];if(_0x1fcdaa['length']){_[_0x8794('0x19')](_0x1fcdaa,function(_0x531d42){if(_0x4edf0f[_0x531d42['variableName']]){_0x4e1d76[_0x8794('0x1a')]({'name':_0x531d42['idField'],'value':_0x4edf0f[_0x531d42[_0x8794('0x1b')]]});}});}return request({'form':{'method':_0x8794('0x1c'),'input_type':_0x8794('0x1d'),'response_type':_0x8794('0x1d'),'rest_data':JSON[_0x8794('0x1e')]({'session':_0x461c32['id'],'module_name':_0x8794('0x1f'),'name_value_list':_0x4e1d76})}});}function getAuth(_0x47b7a0){return util[_0x8794('0x20')](_0x8794('0x21'),new Buffer(_0x47b7a0[_0x8794('0x22')]+':X')[_0x8794('0x23')](_0x8794('0x24')));}function getServerInfo(_0x42018c){return request({'form':{'method':_0x8794('0x25'),'input_type':_0x8794('0x1d'),'response_type':'JSON','rest_data':JSON[_0x8794('0x1e')]({'session':_0x42018c['id']})}});}function getUser(_0x53129c,_0x1d7f79,_0x5e7c9c){if(!_['isNil'](_0x1d7f79)){logger['info']('Getting\x20agent\x20with\x20name',_0x1d7f79);return request({'form':{'method':_0x8794('0x26'),'input_type':_0x8794('0x1d'),'response_type':'JSON','rest_data':JSON[_0x8794('0x1e')]({'session':_0x5e7c9c['id'],'module_name':'Employees','query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1d7f79),'order_by':'','offset':'0','select_fields':['id',_0x8794('0x27'),_0x8794('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8794('0x29')](function(_0x57119c){if(_0x57119c[_0x8794('0x2a')][_0x8794('0x2b')]){var _0x17c6ac=_[_0x8794('0x2c')](_0x57119c['entry_list'],function(_0x509d44){return _0x509d44[_0x8794('0x2d')][_0x8794('0x28')][_0x8794('0x2e')]===_0x1d7f79;});if(_0x17c6ac){logger[_0x8794('0xc')](_0x8794('0x2f'));return BPromise[_0x8794('0x30')]({'id':_0x17c6ac[_0x8794('0x2d')]['id'][_0x8794('0x2e')],'name':_0x17c6ac[_0x8794('0x2d')][_0x8794('0x27')][_0x8794('0x2e')]});}}logger[_0x8794('0xc')](_0x8794('0x31'));return BPromise[_0x8794('0x30')]({'id':_0x5e7c9c['name_value_list'][_0x8794('0x32')]['value'],'name':_0x5e7c9c[_0x8794('0x2d')][_0x8794('0x28')]['value']});});}else{logger[_0x8794('0xc')](_0x8794('0x33'));return BPromise['resolve']({'id':_0x5e7c9c[_0x8794('0x2d')][_0x8794('0x32')][_0x8794('0x2e')],'name':_0x5e7c9c[_0x8794('0x2d')]['user_name']['value']});}}function getEndUser(_0x25680b,_0x2630ff,_0x5ac2f8,_0x14bef4){logger[_0x8794('0xc')]('Searching\x20enduser\x20with\x20phone',_0x5ac2f8);return request({'form':{'method':_0x8794('0x26'),'input_type':_0x8794('0x1d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x14bef4['id'],'module_name':_0x8794('0x17'),'query':util['format'](_0x8794('0x34'),_0x5ac2f8),'order_by':'','offset':'0','select_fields':['id',_0x8794('0x27'),_0x8794('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x49a6d5){if(_0x49a6d5[_0x8794('0x2a')]['length']){var _0x4b42a9=_[_0x8794('0x2c')](_0x49a6d5[_0x8794('0x2a')],function(_0x200bb7){return _0x200bb7[_0x8794('0x2d')][_0x8794('0x35')][_0x8794('0x2e')]===_0x5ac2f8;});if(_0x4b42a9){logger[_0x8794('0xc')](_0x8794('0x36'));return BPromise[_0x8794('0x30')]({'id':_0x4b42a9[_0x8794('0x2d')]['id'][_0x8794('0x2e')],'name':_0x4b42a9[_0x8794('0x2d')][_0x8794('0x27')][_0x8794('0x2e')],'phone':_0x4b42a9[_0x8794('0x2d')][_0x8794('0x35')][_0x8794('0x2e')]});}}else{logger[_0x8794('0xc')](_0x8794('0x37'));return request({'form':{'method':'set_entry','input_type':_0x8794('0x1d'),'response_type':_0x8794('0x1d'),'rest_data':JSON['stringify']({'session':_0x14bef4['id'],'module_name':_0x8794('0x17'),'name_value_list':[{'name':_0x8794('0x38'),'value':_0x2630ff!==''?_0x2630ff:util[_0x8794('0x20')](_0x8794('0x39'),_0x5ac2f8)},{'name':'phone_home','value':_0x5ac2f8}]})}})['then'](function(_0x4c20d2){logger[_0x8794('0xc')](_0x8794('0x3a'));return BPromise[_0x8794('0x30')]({'id':_0x4c20d2['id'],'name':_0x4c20d2['entry_list'][_0x8794('0x38')][_0x8794('0x2e')],'phone':_0x4c20d2[_0x8794('0x2a')]['phone_home'][_0x8794('0x2e')]});});}});}function request(_0x33f9d3){logger[_0x8794('0x3b')](_0x8794('0x3c'),JSON[_0x8794('0x1e')](_0x33f9d3));return rp(_['merge'](def,_0x33f9d3));}function getTags(_0x2922e3,_0x48e7f9){var _0x4aa2fd=[];if(_0x2922e3&&_0x2922e3['length']>0x0){_0x4aa2fd=_['map'](_0x2922e3,_0x48e7f9);}return _0x4aa2fd;}function getCustomFields(_0x43620a,_0x133e1e){var _0x1d4507=[];var _0xe45eb7={'custom_fields':[]};if(_0x43620a[_0x8794('0x2b')]>0x0){_['forEach'](_0x43620a,function(_0xe71fc6){if(_0xe71fc6[_0x8794('0x3d')]===_0x8794('0x3e')&&_0xe71fc6[_0x8794('0x3f')]&&!_0xe71fc6[_0x8794('0x40')]){_0xe45eb7[_0xe71fc6[_0x8794('0x3f')][_0x8794('0x41')]()]=_0xe71fc6['content'][_0x8794('0x23')]();}else if(_0xe71fc6[_0x8794('0x3d')]===_0x8794('0x3e')&&_0xe71fc6['idField']&&_0xe71fc6['customField']){_0xe45eb7[_0x8794('0x42')][_0x8794('0x1a')]({'id':_0xe71fc6[_0x8794('0x43')],'value':_0xe71fc6['content']['toString']()});}else if(_0xe71fc6[_0x8794('0x3d')]==='variable'&&_0xe71fc6[_0x8794('0x1b')]&&_0xe71fc6[_0x8794('0x43')]&&_0xe71fc6[_0x8794('0x40')]){_0x133e1e[_0xe71fc6[_0x8794('0x1b')]]&&_0xe45eb7['custom_fields']['push']({'id':_0xe71fc6[_0x8794('0x43')],'value':_0x133e1e[_0xe71fc6[_0x8794('0x1b')]][_0x8794('0x23')]()});}else if(_0xe71fc6[_0x8794('0x3d')]===_0x8794('0x44')&&_0xe71fc6[_0x8794('0x45')]&&_0xe71fc6[_0x8794('0x45')][_0x8794('0x27')]&&_0xe71fc6[_0x8794('0x43')]&&_0xe71fc6[_0x8794('0x40')]){_0x133e1e[_0xe71fc6[_0x8794('0x45')][_0x8794('0x27')][_0x8794('0x41')]()]&&_0xe45eb7[_0x8794('0x42')][_0x8794('0x1a')]({'id':_0xe71fc6[_0x8794('0x43')],'value':_0x133e1e[_0xe71fc6[_0x8794('0x45')][_0x8794('0x27')][_0x8794('0x41')]()][_0x8794('0x23')]()});}});}return _0xe45eb7;}function getConnection(_0x5ab45a){return request({'method':_0x8794('0x46'),'form':{'method':_0x8794('0x47'),'input_type':_0x8794('0x1d'),'response_type':'JSON','rest_data':JSON[_0x8794('0x1e')]({'user_auth':{'user_name':_0x5ab45a[_0x8794('0x48')],'password':_0x5ab45a[_0x8794('0x49')],'encryption':'PLAIN'},'application':_0x8794('0x4a')})}})[_0x8794('0x29')](function(_0xa95153){var _0x17123e=_0xa95153;if(_0x17123e['id']){def[_0x8794('0x4b')]=_0x17123e['id'];return BPromise[_0x8794('0x30')](_0x17123e);}else{throw new Error(util['format'](_0x8794('0x4c'),_0x5ab45a['id']));}});}function setRelationship(_0x3e9c29,_0x309b4b,_0x5a080d,_0x1b0c08){return request({'form':{'method':'set_relationship','input_type':_0x8794('0x1d'),'response_type':_0x8794('0x1d'),'rest_data':JSON[_0x8794('0x1e')]({'session':_0x3e9c29['id'],'module_name':'Calls','module_id':_0x5a080d['id'],'link_field_name':_0x1b0c08,'related_ids':[_0x309b4b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8794('0x4d')]=function(_0x5f19cf,_0x194cba,_0x47d539,_0x553f52,_0xa64373,_0x33a23a){var _0x1e3031,_0x3c2105,_0x52163a,_0x1ec5a3;_0x33a23a['remoteUri']=intUtil[_0x8794('0x4e')](_0x33a23a[_0x8794('0x4f')]);_0x33a23a['serverUrl']=intUtil[_0x8794('0x4e')](_0x33a23a[_0x8794('0x50')]);def[_0x8794('0x51')]=util['format'](_0x8794('0x52'),_0x33a23a['remoteUri']);if(_0xa64373&&_0xa64373[_0x8794('0x53')]){logger['info']('[QUEUE]',_0x8794('0x54'));_0x194cba[_0x8794('0x55')]=util[_0x8794('0x20')](_0x8794('0x56'),_0x33a23a['serverUrl'],_0x194cba[_0x8794('0x57')],md5(_0x194cba[_0x8794('0x57')]));}else{_0x194cba['recordingURL']='';}return getConnection(_0x33a23a)[_0x8794('0x29')](function(_0x18e3d2){_0x1ec5a3=_0x18e3d2;return getUser(_0x33a23a,_0x553f52[_0x8794('0x27')],_0x1ec5a3);})[_0x8794('0x29')](function(_0x4afc5e){_0x1e3031=_0x4afc5e;logger[_0x8794('0xc')](_0x8794('0x58'),_0x1e3031['id']);return getEndUser(_0x33a23a,_0x194cba[_0x8794('0x59')],_0x194cba[_0x8794('0x5a')],_0x1ec5a3);})[_0x8794('0x29')](function(_0x300f03){_0x3c2105=_0x300f03;logger[_0x8794('0xc')](_0x8794('0x5b'),_0x3c2105['id']);return getTicket(_0x33a23a,_0x1e3031,_0x3c2105,_0x47d539,_0x194cba,_0x47d539[_0x8794('0x5c')],_0x1ec5a3,_0x8794('0x5d'));})[_0x8794('0x29')](function(_0x3cad9b){_0x52163a=_0x3cad9b;logger[_0x8794('0xc')](_0x8794('0x5e'));logger[_0x8794('0xc')]('The\x20Ticket\x20ID\x20is:',_0x52163a['id']);return setRelationship(_0x1ec5a3,_0x1e3031,_0x52163a,_0x8794('0x5f'));})[_0x8794('0x29')](function(){return setRelationship(_0x1ec5a3,_0x3c2105,_0x52163a,_0x8794('0x60'));})[_0x8794('0x29')](function(){return getServerInfo(_0x1ec5a3);})[_0x8794('0x29')](function(_0x3d2dfb){var _0x422c27=parseInt(_0x3d2dfb['version'][_0x8794('0x61')](0x0));var _0x239044=util[_0x8794('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x33a23a[_0x8794('0x4f')],_0x52163a['id']);if(_0x422c27>0x6){_0x239044=util[_0x8794('0x20')](_0x8794('0x62'),_0x33a23a[_0x8794('0x4f')],_0x52163a['id']);}logger[_0x8794('0xc')](_0x8794('0x63'),_0x8794('0x64'));emit(util[_0x8794('0x20')]('user:%s',_0x553f52[_0x8794('0x27')]),'trigger:browser:url',{'uri':_0x239044});})['catch'](function(_0x9e9279){logger[_0x8794('0x65')](_0x8794('0x63'),JSON['stringify'](_0x9e9279));});};exports[_0x8794('0x66')]=function(_0x5802ed,_0x49b111,_0x5eb060,_0x31cf1d,_0xfabe2a,_0x4a850a,_0x4d3905){var _0x329de8,_0x4055d4,_0x12a4e0,_0x292509;_0x4a850a[_0x8794('0x4f')]=intUtil[_0x8794('0x4e')](_0x4a850a[_0x8794('0x4f')]);_0x4a850a[_0x8794('0x50')]=intUtil[_0x8794('0x4e')](_0x4a850a['serverUrl']);def['uri']=util[_0x8794('0x20')](_0x8794('0x52'),_0x4a850a['remoteUri']);if(_0x4d3905&&_0x4d3905[_0x8794('0x67')]&&_0x4d3905[_0x8794('0x67')]!==_0x8794('0x68')){logger[_0x8794('0xc')](_0x8794('0x69'),_0x8794('0x54'));_0x49b111[_0x8794('0x55')]=util[_0x8794('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a850a[_0x8794('0x50')],_0x49b111[_0x8794('0x57')],md5(_0x49b111['uniqueid']));}return getConnection(_0x4a850a)['then'](function(_0x131f47){_0x292509=_0x131f47;return getUser(_0x4a850a,_0x31cf1d[_0x8794('0x27')],_0x292509);})[_0x8794('0x29')](function(_0x2d90fb){_0x329de8=_0x2d90fb;logger[_0x8794('0xc')]('The\x20User\x20ID\x20is:',_0x329de8['id']);return getEndUser(_0x4a850a,_0x49b111['destcalleridname'],_0x49b111[_0x8794('0x6a')],_0x292509);})['then'](function(_0x537024){_0x4055d4=_0x537024;logger[_0x8794('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4055d4['id']);return getTicket(_0x4a850a,_0x329de8,_0x4055d4,_0x5eb060,_0x49b111,_0x5eb060[_0x8794('0x5c')],_0x292509,_0x8794('0x6b'));})[_0x8794('0x29')](function(_0x36c435){_0x12a4e0=_0x36c435;logger[_0x8794('0xc')](_0x8794('0x5e'));logger['info'](_0x8794('0x6c'),_0x12a4e0['id']);return setRelationship(_0x292509,_0x329de8,_0x12a4e0,'users');})[_0x8794('0x29')](function(){return setRelationship(_0x292509,_0x4055d4,_0x12a4e0,_0x8794('0x60'));})[_0x8794('0x29')](function(){return getServerInfo(_0x292509);})[_0x8794('0x29')](function(_0x1c0894){var _0x3ceb64=parseInt(_0x1c0894[_0x8794('0x6d')][_0x8794('0x61')](0x0));var _0x5e5ddc=util['format'](_0x8794('0x6e'),_0x4a850a[_0x8794('0x4f')],_0x12a4e0['id']);if(_0x3ceb64>0x6){_0x5e5ddc=util[_0x8794('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4a850a[_0x8794('0x4f')],_0x12a4e0['id']);}logger[_0x8794('0xc')]('[OUTBOUND]',_0x8794('0x64'));emit(util[_0x8794('0x20')](_0x8794('0x6f'),_0x31cf1d[_0x8794('0x27')]),'trigger:browser:url',{'uri':_0x5e5ddc});})[_0x8794('0x70')](function(_0x2ad8ac){logger[_0x8794('0x65')](_0x8794('0x69'),JSON[_0x8794('0x1e')](_0x2ad8ac));});};exports[_0x8794('0x71')]=function(_0x401208,_0x35bfe,_0x2cf5f1,_0x3290ba,_0x9fdf21,_0x561008){var _0x1d7733,_0x2c9b21,_0x406296,_0x250c95;_0x561008[_0x8794('0x4f')]=intUtil[_0x8794('0x4e')](_0x561008[_0x8794('0x4f')]);_0x561008[_0x8794('0x50')]=intUtil['stripTrailingSlash'](_0x561008[_0x8794('0x50')]);def[_0x8794('0x51')]=util[_0x8794('0x20')](_0x8794('0x52'),_0x561008['remoteUri']);if(_0x9fdf21&&_0x9fdf21['monitor_format']){logger[_0x8794('0xc')]('['+_0x35bfe['lastevent'][_0x8794('0x72')]()+']',_0x8794('0x54'));_0x35bfe[_0x8794('0x55')]=util[_0x8794('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x561008[_0x8794('0x50')],_0x35bfe[_0x8794('0x57')],md5(_0x35bfe[_0x8794('0x57')]));}else{_0x35bfe[_0x8794('0x55')]='';}return getConnection(_0x561008)[_0x8794('0x29')](function(_0xa0cc62){_0x250c95=_0xa0cc62;if(!_[_0x8794('0x73')](_0x3290ba)){return getUser(_0x561008,_0x3290ba['name'],_0x250c95);}else{return getUser(_0x561008,null,_0x250c95);}})[_0x8794('0x29')](function(_0x2e357d){_0x1d7733=_0x2e357d;logger[_0x8794('0xc')](_0x8794('0x58'),_0x1d7733['id']);return getEndUser(_0x561008,_0x35bfe['calleridname'],_0x35bfe[_0x8794('0x5a')],_0x250c95);})['then'](function(_0x18cd39){_0x2c9b21=_0x18cd39;logger[_0x8794('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2c9b21['id']);return getTicket(_0x561008,_0x1d7733,_0x2c9b21,_0x2cf5f1,_0x35bfe,_0x2cf5f1[_0x8794('0x5c')],_0x250c95,_0x8794('0x5d'));})[_0x8794('0x29')](function(_0x379e99){_0x406296=_0x379e99;logger[_0x8794('0xc')]('Ticket\x20created!');logger[_0x8794('0xc')]('The\x20Ticket\x20ID\x20is:',_0x406296['id']);return setRelationship(_0x250c95,_0x1d7733,_0x406296,_0x8794('0x5f'));})['then'](function(){return setRelationship(_0x250c95,_0x2c9b21,_0x406296,_0x8794('0x60'));})[_0x8794('0x29')](function(){return getServerInfo(_0x250c95);})[_0x8794('0x70')](function(_0x4b81d7){logger['error']('['+_0x35bfe[_0x8794('0x74')][_0x8794('0x72')]()+']',JSON[_0x8794('0x1e')](_0x4b81d7));});}; \ 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 722e6d2..ae2f21f 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 _0x1fd2=['lastIndexOf','validateEmail','test','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','keyContent','key','customVariable','join','stripTrailingSlash'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x1fd2,0x6f));var _0x21fd=function(_0xfa5a10,_0x23c726){_0xfa5a10=_0xfa5a10-0x0;var _0x3cf0b6=_0x1fd2[_0xfa5a10];return _0x3cf0b6;};'use strict';var _=require(_0x21fd('0x0'));var util=require(_0x21fd('0x1'));exports[_0x21fd('0x2')]=function(_0x3cd9c9,_0x1b0060,_0x2c4a7d){var _0x216d88=[];if(_0x3cd9c9[_0x21fd('0x3')]>0x0){var _0x4a3399=_[_0x21fd('0x4')](_0x3cd9c9,['id']);for(var _0x25c0e2=0x0;_0x25c0e2<_0x4a3399[_0x21fd('0x3')];_0x25c0e2++){var _0x42a2e8=_0x4a3399[_0x25c0e2];if(_0x42a2e8[_0x21fd('0x5')]===_0x21fd('0x6')){_0x216d88[_0x21fd('0x7')](_0x42a2e8[_0x21fd('0x8')]);}else if(_0x42a2e8[_0x21fd('0x5')]===_0x21fd('0x9')&&_0x42a2e8['variableName']){_0x1b0060[_0x42a2e8['variableName']]&&_0x216d88[_0x21fd('0x7')](_0x1b0060[_0x42a2e8[_0x21fd('0xa')]][_0x21fd('0xb')]());}else if(_0x42a2e8[_0x21fd('0x5')]==='customVariable'&&_0x42a2e8[_0x21fd('0xc')]&&_0x42a2e8[_0x21fd('0xc')]['name']){_0x1b0060[_0x42a2e8[_0x21fd('0xc')][_0x21fd('0xd')][_0x21fd('0xe')]()]&&_0x216d88['push'](_0x1b0060[_0x42a2e8[_0x21fd('0xc')][_0x21fd('0xd')]['toLowerCase']()][_0x21fd('0xb')]());}else if(_0x42a2e8['type']===_0x21fd('0xf')){if(_0x42a2e8[_0x21fd('0x10')]===_0x21fd('0x6')&&_0x42a2e8['key']){_0x216d88[_0x21fd('0x7')](util[_0x21fd('0x11')](_0x21fd('0x12'),_0x42a2e8['key'],_0x42a2e8[_0x21fd('0x13')]));}else if(_0x42a2e8[_0x21fd('0x10')]===_0x21fd('0x9')&&_0x42a2e8[_0x21fd('0xa')]&&_0x42a2e8[_0x21fd('0x14')]){_0x1b0060[_0x42a2e8[_0x21fd('0xa')]]&&_0x216d88[_0x21fd('0x7')](util[_0x21fd('0x11')](_0x21fd('0x12'),_0x42a2e8['key'],_0x1b0060[_0x42a2e8['variableName']]));}else if(_0x42a2e8[_0x21fd('0x10')]===_0x21fd('0x15')&&_0x42a2e8[_0x21fd('0xc')]&&_0x42a2e8[_0x21fd('0xc')]['name']&&_0x42a2e8[_0x21fd('0x14')]){_0x1b0060[_0x42a2e8[_0x21fd('0xc')]['name'][_0x21fd('0xe')]()]&&_0x216d88[_0x21fd('0x7')](util[_0x21fd('0x11')](_0x21fd('0x12'),_0x42a2e8[_0x21fd('0x14')],_0x1b0060[_0x42a2e8[_0x21fd('0xc')][_0x21fd('0xd')][_0x21fd('0xe')]()]));}}}}return _0x216d88[_0x21fd('0x16')](_0x2c4a7d);};exports[_0x21fd('0x17')]=function(_0x275979){var _0x53e234=_0x275979['slice'](-0x1);if(_0x53e234==='/'){_0x275979=_0x275979['substring'](0x0,_0x275979[_0x21fd('0x18')](_0x53e234));}return _0x275979;};exports[_0x21fd('0x19')]=function(_0x31a8db){if(!_['isNil'](_0x31a8db)&&_0x31a8db!==''){var _0x56fca8=/^(([^<>()\[\]\\.,;:\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 _0x56fca8[_0x21fd('0x1a')](String(_0x31a8db)[_0x21fd('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xf50a=['slice','substring','lastIndexOf','isNil','test','util','getString','length','type','string','content','variable','push','variableName','name','Variable','toLowerCase','toString','keyValue','keyType','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash'];(function(_0x2eaba9,_0x45e8f7){var _0x300c46=function(_0x22fe58){while(--_0x22fe58){_0x2eaba9['push'](_0x2eaba9['shift']());}};_0x300c46(++_0x45e8f7);}(_0xf50a,0x13d));var _0xaf50=function(_0x49fb23,_0x5340d4){_0x49fb23=_0x49fb23-0x0;var _0x4ef27b=_0xf50a[_0x49fb23];return _0x4ef27b;};'use strict';var _=require('lodash');var util=require(_0xaf50('0x0'));exports[_0xaf50('0x1')]=function(_0x318316,_0x3dca5c,_0x4236c0){var _0xc0bffb=[];if(_0x318316[_0xaf50('0x2')]>0x0){var _0x20da5b=_['sortBy'](_0x318316,['id']);for(var _0xcc42dd=0x0;_0xcc42dd<_0x20da5b[_0xaf50('0x2')];_0xcc42dd++){var _0x93c653=_0x20da5b[_0xcc42dd];if(_0x93c653[_0xaf50('0x3')]===_0xaf50('0x4')){_0xc0bffb['push'](_0x93c653[_0xaf50('0x5')]);}else if(_0x93c653[_0xaf50('0x3')]===_0xaf50('0x6')&&_0x93c653['variableName']){_0x3dca5c[_0x93c653['variableName']]&&_0xc0bffb[_0xaf50('0x7')](_0x3dca5c[_0x93c653[_0xaf50('0x8')]]['toString']());}else if(_0x93c653[_0xaf50('0x3')]==='customVariable'&&_0x93c653['Variable']&&_0x93c653['Variable'][_0xaf50('0x9')]){_0x3dca5c[_0x93c653[_0xaf50('0xa')]['name'][_0xaf50('0xb')]()]&&_0xc0bffb[_0xaf50('0x7')](_0x3dca5c[_0x93c653[_0xaf50('0xa')][_0xaf50('0x9')][_0xaf50('0xb')]()][_0xaf50('0xc')]());}else if(_0x93c653['type']===_0xaf50('0xd')){if(_0x93c653[_0xaf50('0xe')]==='string'&&_0x93c653['key']){_0xc0bffb['push'](util[_0xaf50('0xf')](_0xaf50('0x10'),_0x93c653[_0xaf50('0x11')],_0x93c653[_0xaf50('0x12')]));}else if(_0x93c653['keyType']===_0xaf50('0x6')&&_0x93c653[_0xaf50('0x8')]&&_0x93c653[_0xaf50('0x11')]){_0x3dca5c[_0x93c653[_0xaf50('0x8')]]&&_0xc0bffb[_0xaf50('0x7')](util[_0xaf50('0xf')]('%s:\x20%s',_0x93c653[_0xaf50('0x11')],_0x3dca5c[_0x93c653[_0xaf50('0x8')]]));}else if(_0x93c653[_0xaf50('0xe')]==='customVariable'&&_0x93c653[_0xaf50('0xa')]&&_0x93c653['Variable'][_0xaf50('0x9')]&&_0x93c653[_0xaf50('0x11')]){_0x3dca5c[_0x93c653['Variable'][_0xaf50('0x9')][_0xaf50('0xb')]()]&&_0xc0bffb[_0xaf50('0x7')](util[_0xaf50('0xf')](_0xaf50('0x10'),_0x93c653[_0xaf50('0x11')],_0x3dca5c[_0x93c653[_0xaf50('0xa')][_0xaf50('0x9')][_0xaf50('0xb')]()]));}}}}return _0xc0bffb[_0xaf50('0x13')](_0x4236c0);};exports[_0xaf50('0x14')]=function(_0x1de9de){var _0x43df69=_0x1de9de[_0xaf50('0x15')](-0x1);if(_0x43df69==='/'){_0x1de9de=_0x1de9de[_0xaf50('0x16')](0x0,_0x1de9de[_0xaf50('0x17')](_0x43df69));}return _0x1de9de;};exports['validateEmail']=function(_0xafffe9){if(!_[_0xaf50('0x18')](_0xafffe9)&&_0xafffe9!==''){var _0x531192=/^(([^<>()\[\]\\.,;:\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 _0x531192[_0xaf50('0x19')](String(_0xafffe9)[_0xaf50('0xb')]());}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 630449b..174fa74 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 _0x4fe2=['last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','catch','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','Searching\x20end\x20user\x20with\x20phone','query','Enduser\x20found!','lastname','POST','Contacts','phone','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','lastevent','toUpperCase','calleridnum','lodash','bluebird','md5','ioredis','./util','../../../../config/logger','redis','defaults','emit','length','forEach','string','picklist','idField','content','type','variableName','toString','customVariable','name','toLowerCase','Variable','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','format','remoteUri','create','HelpDesk','then','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','statusCode','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','username','sessionName','Agent\x20found!','resolve','email1','first_name'];(function(_0x5379a7,_0x47b15c){var _0x10c55e=function(_0xc0f5a6){while(--_0xc0f5a6){_0x5379a7['push'](_0x5379a7['shift']());}};_0x10c55e(++_0x47b15c);}(_0x4fe2,0x8e));var _0x24fe=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4fe2[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x24fe('0x0'));var rp=require('request-promise');var BPromise=require(_0x24fe('0x1'));var md5=require(_0x24fe('0x2'));var util=require('util');var Redis=require(_0x24fe('0x3'));var intUtil=require(_0x24fe('0x4'));var config=require('../../../../config/environment');var logger=require(_0x24fe('0x5'))('vTiger');config[_0x24fe('0x6')]=_[_0x24fe('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x24fe('0x6')]));function emit(_0x393a70,_0x1a7b06,_0x403cee){io['to'](_0x393a70)[_0x24fe('0x8')](_0x1a7b06,_0x403cee);}function getCustomFields(_0x2d5bcb,_0x2e4cc5){var _0x3fe331={};if(_0x2d5bcb[_0x24fe('0x9')]>0x0){_[_0x24fe('0xa')](_0x2d5bcb,function(_0x6329b7){if(_['includes']([_0x24fe('0xb'),_0x24fe('0xc')],_0x6329b7['type'])&&_0x6329b7[_0x24fe('0xd')]){_0x3fe331[_0x6329b7[_0x24fe('0xd')]]=_0x6329b7[_0x24fe('0xe')]['toString']();}else if(_0x6329b7[_0x24fe('0xf')]==='variable'&&_0x6329b7['variableName']&&_0x6329b7['idField']&&_0x2e4cc5[_0x6329b7[_0x24fe('0x10')]]){_0x3fe331[_0x6329b7[_0x24fe('0xd')]]=_0x2e4cc5[_0x6329b7['variableName']][_0x24fe('0x11')]();}else if(_0x6329b7[_0x24fe('0xf')]===_0x24fe('0x12')&&_0x6329b7['Variable']&&_0x6329b7['Variable'][_0x24fe('0x13')]&&_0x6329b7[_0x24fe('0xd')]&&_0x2e4cc5[_0x6329b7['Variable']['name'][_0x24fe('0x14')]()]){_0x3fe331[_0x6329b7[_0x24fe('0xd')]]=_0x2e4cc5[_0x6329b7[_0x24fe('0x15')][_0x24fe('0x13')][_0x24fe('0x14')]()][_0x24fe('0x11')]();}});}return _0x3fe331;}function createTicket(_0x1980dc,_0x5a0df5,_0x4537a1,_0x4b029c,_0x552d5c,_0x43ee79,_0xb229e7){logger[_0x24fe('0x16')](_0x24fe('0x17'));var _0x5f226b=_[_0x24fe('0x18')]({'parent_id':'','assigned_user_id':_0x5a0df5['id'],'ticketpriorities':_0x24fe('0x19'),'ticketstatus':_0x24fe('0x1a'),'ticket_title':intUtil[_0x24fe('0x1b')](_0x4b029c[_0x24fe('0x1c')],_0x552d5c,'\x20'),'description':intUtil[_0x24fe('0x1b')](_0x4b029c['Descriptions'],_0x552d5c,'\x0a'),'contact_id':_0x4537a1['id']},getCustomFields(_0x43ee79,_0x552d5c));var _0x3b9bb8={'method':'POST','uri':util[_0x24fe('0x1d')]('%s/webservice.php',_0x1980dc[_0x24fe('0x1e')]),'form':{'operation':_0x24fe('0x1f'),'username':_0x1980dc['username'],'sessionName':_0xb229e7['sessionName'],'elementType':_0x24fe('0x20'),'element':JSON['stringify'](_0x5f226b)},'json':!![]};return request(_0x3b9bb8)[_0x24fe('0x21')](function(_0x30b49a){if(_0x30b49a[_0x24fe('0x22')]){return BPromise['resolve']({'id':_0x30b49a[_0x24fe('0x23')]['id']});}else{throw new Error(util['format'](_0x24fe('0x24'),JSON[_0x24fe('0x25')](_0x30b49a[_0x24fe('0x26')])));}})['catch'](function(_0x3e8eba){var _0x1c8847=_0x3e8eba[_0x24fe('0x27')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x1c8847,JSON[_0x24fe('0x25')](_0x3e8eba));});}function getUser(_0x280f89,_0x3ea22a,_0x5e5430){if(intUtil[_0x24fe('0x28')](_0x3ea22a)){logger['info'](_0x24fe('0x29'),_0x3ea22a);return request({'method':_0x24fe('0x2a'),'uri':util[_0x24fe('0x1d')](_0x24fe('0x2b'),_0x280f89[_0x24fe('0x1e')]),'qs':{'operation':'query','username':_0x280f89[_0x24fe('0x2c')],'sessionName':_0x5e5430[_0x24fe('0x2d')],'query':util[_0x24fe('0x1d')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x3ea22a)},'json':!![]})[_0x24fe('0x21')](function(_0x394d22){if(_0x394d22[_0x24fe('0x22')]&&_0x394d22[_0x24fe('0x23')][_0x24fe('0x9')]){logger[_0x24fe('0x16')](_0x24fe('0x2e'));return BPromise[_0x24fe('0x2f')]({'id':_0x394d22[_0x24fe('0x23')][0x0]['id'],'email':_0x394d22[_0x24fe('0x23')][0x0][_0x24fe('0x30')],'name':_0x394d22['result'][0x0][_0x24fe('0x31')]+'\x20'+_0x394d22[_0x24fe('0x23')][_0x24fe('0x32')]});}else{logger[_0x24fe('0x16')](_0x24fe('0x33'));return BPromise[_0x24fe('0x2f')]({'id':_0x5e5430[_0x24fe('0x34')],'email':_0x280f89[_0x24fe('0x2c')],'name':'admin'});}})[_0x24fe('0x35')](function(_0x3229f6){var _0x167016=_0x3229f6[_0x24fe('0x27')]||0x1f4;logger[_0x24fe('0x26')](_0x24fe('0x36'),_0x24fe('0x37'),_0x167016,JSON[_0x24fe('0x25')](_0x3229f6));});}else{logger[_0x24fe('0x16')](_0x24fe('0x33'));return BPromise[_0x24fe('0x2f')]({'id':_0x5e5430['userId'],'email':_0x280f89[_0x24fe('0x2c')],'name':_0x24fe('0x38')})['catch'](function(_0x453409){var _0x62e817=_0x453409[_0x24fe('0x27')]||0x1f4;logger[_0x24fe('0x26')](_0x24fe('0x36'),_0x24fe('0x37'),_0x62e817,JSON[_0x24fe('0x25')](_0x453409));});}}function getEndUser(_0x51fd63,_0x371d2c,_0x2464ae,_0xb79a0a){logger[_0x24fe('0x16')](_0x24fe('0x39'),_0x2464ae);return request({'method':'GET','uri':util['format'](_0x24fe('0x2b'),_0x51fd63[_0x24fe('0x1e')]),'qs':{'operation':_0x24fe('0x3a'),'username':_0x51fd63[_0x24fe('0x2c')],'sessionName':_0xb79a0a['sessionName'],'query':util[_0x24fe('0x1d')]('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;',_0x2464ae,_0x2464ae,_0x2464ae,_0x2464ae,_0x2464ae)},'json':!![]})[_0x24fe('0x21')](function(_0x50b377){if(_0x50b377['success']&&_0x50b377[_0x24fe('0x23')][_0x24fe('0x9')]){logger[_0x24fe('0x16')](_0x24fe('0x3b'));return BPromise[_0x24fe('0x2f')]({'id':_0x50b377[_0x24fe('0x23')][0x0]['id'],'name':_0x50b377[_0x24fe('0x23')][0x0]['firstname']+'\x20'+_0x50b377[_0x24fe('0x23')][0x0][_0x24fe('0x3c')],'phone':_0x2464ae});}else{logger[_0x24fe('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x24fe('0x3d'),'uri':util[_0x24fe('0x1d')]('%s/webservice.php',_0x51fd63[_0x24fe('0x1e')]),'form':{'operation':'create','sessionName':_0xb79a0a[_0x24fe('0x2d')],'elementType':_0x24fe('0x3e'),'element':JSON[_0x24fe('0x25')]({'lastname':_0x371d2c,'phone':_0x2464ae,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x3dce30){logger[_0x24fe('0x16')]('Enduser\x20created.');return BPromise[_0x24fe('0x2f')]({'id':_0x3dce30[_0x24fe('0x23')]['id'],'name':_0x3dce30[_0x24fe('0x23')][_0x24fe('0x3c')],'phone':_0x3dce30[_0x24fe('0x23')][_0x24fe('0x3f')]});})[_0x24fe('0x35')](function(_0x41be7d){var _0x4d3545=_0x41be7d[_0x24fe('0x27')]||0x1f4;logger['error'](_0x24fe('0x36'),'getEndUser',_0x4d3545,JSON[_0x24fe('0x25')](_0x41be7d));});}});}function getConnection(_0x570eb5){var _0x55c0bd=_0x570eb5['username'];var _0x58527c=_0x570eb5[_0x24fe('0x40')];return request({'method':_0x24fe('0x2a'),'uri':util[_0x24fe('0x1d')](_0x24fe('0x2b'),_0x570eb5[_0x24fe('0x1e')]),'qs':{'operation':'getchallenge','username':_0x55c0bd},'json':!![]})[_0x24fe('0x21')](function(_0x30cfd3){if(_0x30cfd3[_0x24fe('0x22')]){return request({'method':_0x24fe('0x3d'),'uri':util[_0x24fe('0x1d')](_0x24fe('0x2b'),_0x570eb5['remoteUri']),'form':{'operation':_0x24fe('0x41'),'username':_0x55c0bd,'accessKey':md5(_0x30cfd3[_0x24fe('0x23')]['token']+_0x58527c)},'json':!![]});}})[_0x24fe('0x21')](function(_0x213f53){if(_0x213f53[_0x24fe('0x22')]){return BPromise[_0x24fe('0x2f')](_0x213f53['result']);}else{throw new Error(util[_0x24fe('0x1d')](_0x24fe('0x42'),_0x570eb5['id']));}})['catch'](function(_0x21b106){var _0x42b6ca=_0x21b106[_0x24fe('0x27')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x24fe('0x43'),_0x42b6ca,JSON[_0x24fe('0x25')](_0x21b106));});}function request(_0x3e8e2a){logger[_0x24fe('0x16')]('[HTTP]',JSON[_0x24fe('0x25')](_0x3e8e2a));return rp(_0x3e8e2a);}exports[_0x24fe('0x44')]=function(_0x301caf,_0x416c9d,_0x547e3b,_0x8de639,_0x17f461,_0x28c9a1){var _0x21aa6d,_0xb99cd5,_0x522896,_0x2ca4ee;_0x28c9a1[_0x24fe('0x1e')]=intUtil[_0x24fe('0x45')](_0x28c9a1[_0x24fe('0x1e')]);if(_0x17f461&&_0x17f461[_0x24fe('0x46')]){logger[_0x24fe('0x16')](_0x24fe('0x47'),_0x24fe('0x48'));_0x416c9d['recordingURL']=util[_0x24fe('0x1d')](_0x24fe('0x49'),_0x28c9a1[_0x24fe('0x4a')],_0x416c9d['uniqueid'],md5(_0x416c9d[_0x24fe('0x4b')]));}else{_0x416c9d[_0x24fe('0x4c')]='';}return getConnection(_0x28c9a1)[_0x24fe('0x21')](function(_0x4ba0f3){_0x2ca4ee=_0x4ba0f3;return getUser(_0x28c9a1,_0x8de639[_0x24fe('0x4d')],_0x2ca4ee);})[_0x24fe('0x21')](function(_0x1d8202){_0x21aa6d=_0x1d8202;logger[_0x24fe('0x16')](_0x24fe('0x4e'),_0x21aa6d['id']);return getEndUser(_0x28c9a1,_0x416c9d[_0x24fe('0x4f')],_0x416c9d['calleridnum'],_0x2ca4ee);})['then'](function(_0x286d7d){_0xb99cd5=_0x286d7d;logger['info'](_0x24fe('0x50'),_0xb99cd5['id']);return createTicket(_0x28c9a1,_0x21aa6d,_0xb99cd5,_0x547e3b,_0x416c9d,_0x547e3b[_0x24fe('0x51')],_0x2ca4ee);})[_0x24fe('0x21')](function(_0x589e1f){_0x522896=_0x589e1f;logger[_0x24fe('0x16')](_0x24fe('0x52'));logger[_0x24fe('0x16')](_0x24fe('0x53'),_0x522896['id']);var _0x2cbb53=util[_0x24fe('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x28c9a1[_0x24fe('0x1e')],_['split'](_0x522896['id'],'x')[0x1]);logger[_0x24fe('0x16')]('[QUEUE]',_0x24fe('0x54'));emit(util[_0x24fe('0x1d')](_0x24fe('0x55'),_0x8de639[_0x24fe('0x13')]),'trigger:browser:url',{'uri':_0x2cbb53});})[_0x24fe('0x35')](function(_0x26c945){logger[_0x24fe('0x26')](_0x24fe('0x47'),JSON[_0x24fe('0x25')](_0x26c945));});};exports['outbound']=function(_0x5a8f91,_0x246878,_0xb47b5c,_0x3f60a9,_0x50a803,_0x39cd4e,_0x1a0d05){var _0x1e5fe7,_0x7ef013,_0x414e73,_0xf0d6a6;_0x39cd4e[_0x24fe('0x1e')]=intUtil[_0x24fe('0x45')](_0x39cd4e[_0x24fe('0x1e')]);_0x39cd4e[_0x24fe('0x4a')]=intUtil[_0x24fe('0x45')](_0x39cd4e[_0x24fe('0x4a')]);if(_0x1a0d05&&_0x1a0d05[_0x24fe('0x56')]&&_0x1a0d05['recordingFormat']!==_0x24fe('0x57')){logger[_0x24fe('0x16')](_0x24fe('0x58'),_0x24fe('0x48'));_0x246878[_0x24fe('0x4c')]=util[_0x24fe('0x1d')](_0x24fe('0x49'),_0x39cd4e[_0x24fe('0x4a')],_0x246878[_0x24fe('0x4b')],md5(_0x246878[_0x24fe('0x4b')]));}return getConnection(_0x39cd4e)[_0x24fe('0x21')](function(_0x22ccc2){_0xf0d6a6=_0x22ccc2;return getUser(_0x39cd4e,_0x3f60a9[_0x24fe('0x4d')],_0xf0d6a6);})[_0x24fe('0x21')](function(_0x4f0db2){_0x1e5fe7=_0x4f0db2;logger[_0x24fe('0x16')](_0x24fe('0x4e'),_0x1e5fe7['id']);return getEndUser(_0x39cd4e,_0x246878[_0x24fe('0x59')],_0x246878[_0x24fe('0x5a')],_0xf0d6a6);})[_0x24fe('0x21')](function(_0x1867ed){_0x7ef013=_0x1867ed;logger['info'](_0x24fe('0x50'),_0x7ef013['id']);return createTicket(_0x39cd4e,_0x1e5fe7,_0x7ef013,_0xb47b5c,_0x246878,_0xb47b5c[_0x24fe('0x51')],_0xf0d6a6);})['then'](function(_0xf2a7d1){_0x414e73=_0xf2a7d1;logger[_0x24fe('0x16')](_0x24fe('0x52'));logger[_0x24fe('0x16')](_0x24fe('0x53'),_0x414e73['id']);var _0x19eb11=util[_0x24fe('0x1d')](_0x24fe('0x5b'),_0x39cd4e[_0x24fe('0x1e')],_['split'](_0x414e73['id'],'x')[0x1]);logger[_0x24fe('0x16')](_0x24fe('0x58'),_0x24fe('0x54'));emit(util['format'](_0x24fe('0x55'),_0x3f60a9[_0x24fe('0x13')]),_0x24fe('0x5c'),{'uri':_0x19eb11});})[_0x24fe('0x35')](function(_0xe22ef9){logger['error'](_0x24fe('0x58'),JSON['stringify'](_0xe22ef9));});};exports['unmanaged']=function(_0x3341be,_0x5766c9,_0x7dbff9,_0x2c5ead,_0x353195,_0x4f6b59){var _0xa39ccf,_0x4da683,_0x2a9039,_0x5d88d6;_0x4f6b59['remoteUri']=intUtil[_0x24fe('0x45')](_0x4f6b59[_0x24fe('0x1e')]);_0x4f6b59[_0x24fe('0x4a')]=intUtil[_0x24fe('0x45')](_0x4f6b59[_0x24fe('0x4a')]);if(_0x353195&&_0x353195[_0x24fe('0x46')]){logger[_0x24fe('0x16')]('['+_0x5766c9[_0x24fe('0x5d')][_0x24fe('0x5e')]()+']','Recording\x20is\x20enabled!');_0x5766c9[_0x24fe('0x4c')]=util[_0x24fe('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4f6b59[_0x24fe('0x4a')],_0x5766c9[_0x24fe('0x4b')],md5(_0x5766c9[_0x24fe('0x4b')]));}else{_0x5766c9[_0x24fe('0x4c')]='';}return getConnection(_0x4f6b59)[_0x24fe('0x21')](function(_0x3f905e){_0x5d88d6=_0x3f905e;return getUser(_0x4f6b59,'',_0x5d88d6);})[_0x24fe('0x21')](function(_0x22a6cd){_0xa39ccf=_0x22a6cd;logger[_0x24fe('0x16')](_0x24fe('0x4e'),_0xa39ccf['id']);return getEndUser(_0x4f6b59,_0x5766c9[_0x24fe('0x4f')],_0x5766c9[_0x24fe('0x5f')],_0x5d88d6);})[_0x24fe('0x21')](function(_0x3787b6){_0x4da683=_0x3787b6;logger[_0x24fe('0x16')]('The\x20Enduser\x20ID\x20is:',_0x4da683['id']);return createTicket(_0x4f6b59,_0xa39ccf,_0x4da683,_0x7dbff9,_0x5766c9,_0x7dbff9[_0x24fe('0x51')],_0x5d88d6);})['then'](function(_0x1a2418){_0x2a9039=_0x1a2418;logger[_0x24fe('0x16')]('Ticket\x20created!');logger[_0x24fe('0x16')](_0x24fe('0x53'),_0x2a9039['id']);})[_0x24fe('0x35')](function(_0xc935cf){logger[_0x24fe('0x26')]('['+_0x5766c9[_0x24fe('0x5d')][_0x24fe('0x5e')]()+']',JSON[_0x24fe('0x25')](_0xc935cf));});}; \ No newline at end of file +var _0xb713=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','lastevent','toUpperCase','lodash','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','toString','type','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','getString','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','HelpDesk','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','Getting\x20agent\x20with\x20email','query','sessionName','then','first_name','userId','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','success','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','lastname','phone','accessKey','GET','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb713,0x1a6));var _0x3b71=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0xb713[_0x2bda14];return _0xb5dd49;};'use strict';var _=require(_0x3b71('0x0'));var rp=require('request-promise');var BPromise=require(_0x3b71('0x1'));var md5=require(_0x3b71('0x2'));var util=require(_0x3b71('0x3'));var Redis=require(_0x3b71('0x4'));var intUtil=require('./util');var config=require(_0x3b71('0x5'));var logger=require(_0x3b71('0x6'))('vTiger');config['redis']=_[_0x3b71('0x7')](config[_0x3b71('0x8')],{'host':_0x3b71('0x9'),'port':0x18eb});var io=require(_0x3b71('0xa'))(new Redis(config['redis']));function emit(_0x5bfa7b,_0xc8df24,_0x2286d6){io['to'](_0x5bfa7b)[_0x3b71('0xb')](_0xc8df24,_0x2286d6);}function getCustomFields(_0x35752b,_0x5989b1){var _0x4ab436={};if(_0x35752b[_0x3b71('0xc')]>0x0){_[_0x3b71('0xd')](_0x35752b,function(_0x1fcabc){if(_[_0x3b71('0xe')]([_0x3b71('0xf'),'picklist'],_0x1fcabc['type'])&&_0x1fcabc['idField']){_0x4ab436[_0x1fcabc[_0x3b71('0x10')]]=_0x1fcabc['content'][_0x3b71('0x11')]();}else if(_0x1fcabc[_0x3b71('0x12')]==='variable'&&_0x1fcabc[_0x3b71('0x13')]&&_0x1fcabc['idField']&&_0x5989b1[_0x1fcabc[_0x3b71('0x13')]]){_0x4ab436[_0x1fcabc[_0x3b71('0x10')]]=_0x5989b1[_0x1fcabc['variableName']][_0x3b71('0x11')]();}else if(_0x1fcabc[_0x3b71('0x12')]===_0x3b71('0x14')&&_0x1fcabc[_0x3b71('0x15')]&&_0x1fcabc[_0x3b71('0x15')]['name']&&_0x1fcabc[_0x3b71('0x10')]&&_0x5989b1[_0x1fcabc[_0x3b71('0x15')][_0x3b71('0x16')][_0x3b71('0x17')]()]){_0x4ab436[_0x1fcabc['idField']]=_0x5989b1[_0x1fcabc[_0x3b71('0x15')][_0x3b71('0x16')][_0x3b71('0x17')]()][_0x3b71('0x11')]();}});}return _0x4ab436;}function createTicket(_0x1890c1,_0x338e77,_0x1b1abd,_0x5265c4,_0x32eccc,_0x1457d6,_0x291578){logger[_0x3b71('0x18')](_0x3b71('0x19'));var _0x1ae3ad=_['merge']({'parent_id':'','assigned_user_id':_0x338e77['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil[_0x3b71('0x1a')](_0x5265c4['Subjects'],_0x32eccc,'\x20'),'description':intUtil['getString'](_0x5265c4[_0x3b71('0x1b')],_0x32eccc,'\x0a'),'contact_id':_0x1b1abd['id']},getCustomFields(_0x1457d6,_0x32eccc));var _0xec9f3={'method':_0x3b71('0x1c'),'uri':util[_0x3b71('0x1d')](_0x3b71('0x1e'),_0x1890c1[_0x3b71('0x1f')]),'form':{'operation':_0x3b71('0x20'),'username':_0x1890c1[_0x3b71('0x21')],'sessionName':_0x291578['sessionName'],'elementType':_0x3b71('0x22'),'element':JSON['stringify'](_0x1ae3ad)},'json':!![]};return request(_0xec9f3)['then'](function(_0x3d188a){if(_0x3d188a['success']){return BPromise[_0x3b71('0x23')]({'id':_0x3d188a[_0x3b71('0x24')]['id']});}else{throw new Error(util[_0x3b71('0x1d')](_0x3b71('0x25'),JSON[_0x3b71('0x26')](_0x3d188a[_0x3b71('0x27')])));}})[_0x3b71('0x28')](function(_0x4c1cf5){var _0x816262=_0x4c1cf5[_0x3b71('0x29')]||0x1f4;logger[_0x3b71('0x27')](_0x3b71('0x2a'),_0x3b71('0x2b'),_0x816262,JSON['stringify'](_0x4c1cf5));});}function getUser(_0x29a00b,_0x507954,_0x15b40b){if(intUtil['validateEmail'](_0x507954)){logger[_0x3b71('0x18')](_0x3b71('0x2c'),_0x507954);return request({'method':'GET','uri':util[_0x3b71('0x1d')](_0x3b71('0x1e'),_0x29a00b[_0x3b71('0x1f')]),'qs':{'operation':_0x3b71('0x2d'),'username':_0x29a00b['username'],'sessionName':_0x15b40b[_0x3b71('0x2e')],'query':util[_0x3b71('0x1d')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x507954)},'json':!![]})[_0x3b71('0x2f')](function(_0x50b0fc){if(_0x50b0fc['success']&&_0x50b0fc['result'][_0x3b71('0xc')]){logger['info']('Agent\x20found!');return BPromise[_0x3b71('0x23')]({'id':_0x50b0fc[_0x3b71('0x24')][0x0]['id'],'email':_0x50b0fc['result'][0x0]['email1'],'name':_0x50b0fc['result'][0x0][_0x3b71('0x30')]+'\x20'+_0x50b0fc['result']['last_name']});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3b71('0x23')]({'id':_0x15b40b[_0x3b71('0x31')],'email':_0x29a00b[_0x3b71('0x21')],'name':'admin'});}})[_0x3b71('0x28')](function(_0x422f8f){var _0x3d0648=_0x422f8f[_0x3b71('0x29')]||0x1f4;logger[_0x3b71('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x3b71('0x32'),_0x3d0648,JSON[_0x3b71('0x26')](_0x422f8f));});}else{logger[_0x3b71('0x18')](_0x3b71('0x33'));return BPromise[_0x3b71('0x23')]({'id':_0x15b40b[_0x3b71('0x31')],'email':_0x29a00b[_0x3b71('0x21')],'name':_0x3b71('0x34')})[_0x3b71('0x28')](function(_0x86e079){var _0x1a95f7=_0x86e079[_0x3b71('0x29')]||0x1f4;logger[_0x3b71('0x27')](_0x3b71('0x2a'),_0x3b71('0x32'),_0x1a95f7,JSON[_0x3b71('0x26')](_0x86e079));});}}function getEndUser(_0x24ae54,_0x1771e2,_0x342909,_0x3ecfe5){logger['info'](_0x3b71('0x35'),_0x342909);return request({'method':'GET','uri':util['format'](_0x3b71('0x1e'),_0x24ae54[_0x3b71('0x1f')]),'qs':{'operation':'query','username':_0x24ae54[_0x3b71('0x21')],'sessionName':_0x3ecfe5[_0x3b71('0x2e')],'query':util[_0x3b71('0x1d')](_0x3b71('0x36'),_0x342909,_0x342909,_0x342909,_0x342909,_0x342909)},'json':!![]})[_0x3b71('0x2f')](function(_0x5aeac7){if(_0x5aeac7[_0x3b71('0x37')]&&_0x5aeac7['result'][_0x3b71('0xc')]){logger[_0x3b71('0x18')](_0x3b71('0x38'));return BPromise[_0x3b71('0x23')]({'id':_0x5aeac7[_0x3b71('0x24')][0x0]['id'],'name':_0x5aeac7[_0x3b71('0x24')][0x0]['firstname']+'\x20'+_0x5aeac7['result'][0x0]['lastname'],'phone':_0x342909});}else{logger[_0x3b71('0x18')](_0x3b71('0x39'));return request({'method':_0x3b71('0x1c'),'uri':util['format'](_0x3b71('0x1e'),_0x24ae54[_0x3b71('0x1f')]),'form':{'operation':_0x3b71('0x20'),'sessionName':_0x3ecfe5[_0x3b71('0x2e')],'elementType':'Contacts','element':JSON[_0x3b71('0x26')]({'lastname':_0x1771e2,'phone':_0x342909,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x500c35){logger[_0x3b71('0x18')](_0x3b71('0x3a'));return BPromise['resolve']({'id':_0x500c35[_0x3b71('0x24')]['id'],'name':_0x500c35[_0x3b71('0x24')][_0x3b71('0x3b')],'phone':_0x500c35[_0x3b71('0x24')][_0x3b71('0x3c')]});})[_0x3b71('0x28')](function(_0xcc589f){var _0x46b012=_0xcc589f[_0x3b71('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x46b012,JSON[_0x3b71('0x26')](_0xcc589f));});}});}function getConnection(_0x21ebf6){var _0x305419=_0x21ebf6[_0x3b71('0x21')];var _0x2c7fdb=_0x21ebf6[_0x3b71('0x3d')];return request({'method':_0x3b71('0x3e'),'uri':util[_0x3b71('0x1d')](_0x3b71('0x1e'),_0x21ebf6['remoteUri']),'qs':{'operation':_0x3b71('0x3f'),'username':_0x305419},'json':!![]})[_0x3b71('0x2f')](function(_0x391ec4){if(_0x391ec4[_0x3b71('0x37')]){return request({'method':'POST','uri':util[_0x3b71('0x1d')](_0x3b71('0x1e'),_0x21ebf6[_0x3b71('0x1f')]),'form':{'operation':_0x3b71('0x40'),'username':_0x305419,'accessKey':md5(_0x391ec4[_0x3b71('0x24')][_0x3b71('0x41')]+_0x2c7fdb)},'json':!![]});}})[_0x3b71('0x2f')](function(_0x4d0462){if(_0x4d0462[_0x3b71('0x37')]){return BPromise[_0x3b71('0x23')](_0x4d0462[_0x3b71('0x24')]);}else{throw new Error(util['format'](_0x3b71('0x42'),_0x21ebf6['id']));}})['catch'](function(_0x15694a){var _0x22d59f=_0x15694a[_0x3b71('0x29')]||0x1f4;logger[_0x3b71('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x22d59f,JSON['stringify'](_0x15694a));});}function request(_0x234b4b){logger[_0x3b71('0x18')](_0x3b71('0x43'),JSON['stringify'](_0x234b4b));return rp(_0x234b4b);}exports[_0x3b71('0x44')]=function(_0x373e2a,_0x1b9f48,_0x3096b0,_0x381c03,_0x1224b1,_0x592122){var _0xf0847e,_0x31699a,_0x445787,_0x44871a;_0x592122['remoteUri']=intUtil['stripTrailingSlash'](_0x592122[_0x3b71('0x1f')]);if(_0x1224b1&&_0x1224b1[_0x3b71('0x45')]){logger[_0x3b71('0x18')](_0x3b71('0x46'),_0x3b71('0x47'));_0x1b9f48[_0x3b71('0x48')]=util[_0x3b71('0x1d')](_0x3b71('0x49'),_0x592122[_0x3b71('0x4a')],_0x1b9f48[_0x3b71('0x4b')],md5(_0x1b9f48[_0x3b71('0x4b')]));}else{_0x1b9f48['recordingURL']='';}return getConnection(_0x592122)[_0x3b71('0x2f')](function(_0x35e47b){_0x44871a=_0x35e47b;return getUser(_0x592122,_0x381c03[_0x3b71('0x4c')],_0x44871a);})['then'](function(_0x428b72){_0xf0847e=_0x428b72;logger[_0x3b71('0x18')]('The\x20User\x20ID\x20is:',_0xf0847e['id']);return getEndUser(_0x592122,_0x1b9f48[_0x3b71('0x4d')],_0x1b9f48[_0x3b71('0x4e')],_0x44871a);})[_0x3b71('0x2f')](function(_0x50d0cc){_0x31699a=_0x50d0cc;logger[_0x3b71('0x18')](_0x3b71('0x4f'),_0x31699a['id']);return createTicket(_0x592122,_0xf0847e,_0x31699a,_0x3096b0,_0x1b9f48,_0x3096b0['Fields'],_0x44871a);})[_0x3b71('0x2f')](function(_0x5b566e){_0x445787=_0x5b566e;logger[_0x3b71('0x18')](_0x3b71('0x50'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x445787['id']);var _0x36aa5=util[_0x3b71('0x1d')](_0x3b71('0x51'),_0x592122[_0x3b71('0x1f')],_[_0x3b71('0x52')](_0x445787['id'],'x')[0x1]);logger[_0x3b71('0x18')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3b71('0x1d')]('user:%s',_0x381c03[_0x3b71('0x16')]),_0x3b71('0x53'),{'uri':_0x36aa5});})[_0x3b71('0x28')](function(_0x49189d){logger[_0x3b71('0x27')](_0x3b71('0x46'),JSON[_0x3b71('0x26')](_0x49189d));});};exports[_0x3b71('0x54')]=function(_0x2609c9,_0x563a74,_0x36f931,_0x298d07,_0x39e9f7,_0x577ed3,_0x104d51){var _0x4da672,_0x1782c4,_0x58f664,_0xad0c1b;_0x577ed3[_0x3b71('0x1f')]=intUtil[_0x3b71('0x55')](_0x577ed3[_0x3b71('0x1f')]);_0x577ed3[_0x3b71('0x4a')]=intUtil['stripTrailingSlash'](_0x577ed3['serverUrl']);if(_0x104d51&&_0x104d51[_0x3b71('0x56')]&&_0x104d51[_0x3b71('0x56')]!==_0x3b71('0x57')){logger[_0x3b71('0x18')](_0x3b71('0x58'),_0x3b71('0x47'));_0x563a74[_0x3b71('0x48')]=util['format'](_0x3b71('0x49'),_0x577ed3[_0x3b71('0x4a')],_0x563a74[_0x3b71('0x4b')],md5(_0x563a74['uniqueid']));}return getConnection(_0x577ed3)[_0x3b71('0x2f')](function(_0x5308e4){_0xad0c1b=_0x5308e4;return getUser(_0x577ed3,_0x298d07[_0x3b71('0x4c')],_0xad0c1b);})['then'](function(_0x3eab37){_0x4da672=_0x3eab37;logger[_0x3b71('0x18')](_0x3b71('0x59'),_0x4da672['id']);return getEndUser(_0x577ed3,_0x563a74[_0x3b71('0x5a')],_0x563a74[_0x3b71('0x5b')],_0xad0c1b);})[_0x3b71('0x2f')](function(_0x238f73){_0x1782c4=_0x238f73;logger[_0x3b71('0x18')](_0x3b71('0x4f'),_0x1782c4['id']);return createTicket(_0x577ed3,_0x4da672,_0x1782c4,_0x36f931,_0x563a74,_0x36f931[_0x3b71('0x5c')],_0xad0c1b);})[_0x3b71('0x2f')](function(_0x304d75){_0x58f664=_0x304d75;logger[_0x3b71('0x18')](_0x3b71('0x50'));logger['info'](_0x3b71('0x5d'),_0x58f664['id']);var _0x5a0cf9=util['format'](_0x3b71('0x51'),_0x577ed3['remoteUri'],_[_0x3b71('0x52')](_0x58f664['id'],'x')[0x1]);logger[_0x3b71('0x18')](_0x3b71('0x58'),_0x3b71('0x5e'));emit(util[_0x3b71('0x1d')](_0x3b71('0x5f'),_0x298d07['name']),_0x3b71('0x53'),{'uri':_0x5a0cf9});})[_0x3b71('0x28')](function(_0x28dc2c){logger['error'](_0x3b71('0x58'),JSON['stringify'](_0x28dc2c));});};exports[_0x3b71('0x60')]=function(_0x86aab2,_0x2cb4fb,_0x48cd59,_0x405380,_0x3f6fbc,_0x1955ed){var _0x3b13f2,_0x25d4b9,_0x55c643,_0x644885;_0x1955ed['remoteUri']=intUtil[_0x3b71('0x55')](_0x1955ed['remoteUri']);_0x1955ed[_0x3b71('0x4a')]=intUtil[_0x3b71('0x55')](_0x1955ed['serverUrl']);if(_0x3f6fbc&&_0x3f6fbc[_0x3b71('0x45')]){logger[_0x3b71('0x18')]('['+_0x2cb4fb[_0x3b71('0x61')][_0x3b71('0x62')]()+']',_0x3b71('0x47'));_0x2cb4fb[_0x3b71('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1955ed[_0x3b71('0x4a')],_0x2cb4fb[_0x3b71('0x4b')],md5(_0x2cb4fb[_0x3b71('0x4b')]));}else{_0x2cb4fb[_0x3b71('0x48')]='';}return getConnection(_0x1955ed)['then'](function(_0x455f78){_0x644885=_0x455f78;return getUser(_0x1955ed,'',_0x644885);})[_0x3b71('0x2f')](function(_0x2756f5){_0x3b13f2=_0x2756f5;logger[_0x3b71('0x18')](_0x3b71('0x59'),_0x3b13f2['id']);return getEndUser(_0x1955ed,_0x2cb4fb[_0x3b71('0x4d')],_0x2cb4fb['calleridnum'],_0x644885);})[_0x3b71('0x2f')](function(_0x4af274){_0x25d4b9=_0x4af274;logger[_0x3b71('0x18')](_0x3b71('0x4f'),_0x25d4b9['id']);return createTicket(_0x1955ed,_0x3b13f2,_0x25d4b9,_0x48cd59,_0x2cb4fb,_0x48cd59[_0x3b71('0x5c')],_0x644885);})[_0x3b71('0x2f')](function(_0x4d94c0){_0x55c643=_0x4d94c0;logger[_0x3b71('0x18')]('Ticket\x20created!');logger['info'](_0x3b71('0x5d'),_0x55c643['id']);})['catch'](function(_0x315086){logger[_0x3b71('0x27')]('['+_0x2cb4fb[_0x3b71('0x61')]['toUpperCase']()+']',JSON[_0x3b71('0x26')](_0x315086));});}; \ 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 2bd8727..4c0b7d1 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 _0x77ae=['user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','stringify','map','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','inspect','outbound','none','Authorization','destcalleridname','[OUTBOUND]','catch','error','monitor_format','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','util','ioredis','./util','../../../../config/logger','zendesk','defaults','socket.io-emitter','redis','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','then','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.'];(function(_0x1a5035,_0x5d10f6){var _0x3c2328=function(_0x2a6504){while(--_0x2a6504){_0x1a5035['push'](_0x1a5035['shift']());}};_0x3c2328(++_0x5d10f6);}(_0x77ae,0x17e));var _0xe77a=function(_0x34e5ce,_0x57ee8e){_0x34e5ce=_0x34e5ce-0x0;var _0x472d24=_0x77ae[_0x34e5ce];return _0x472d24;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xe77a('0x0'));var Redis=require(_0xe77a('0x1'));var intUtil=require(_0xe77a('0x2'));var config=require('../../../../config/environment');var logger=require(_0xe77a('0x3'))(_0xe77a('0x4'));config['redis']=_[_0xe77a('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe77a('0x6'))(new Redis(config[_0xe77a('0x7')]));function emit(_0x11fc70,_0x2d226c,_0x492995){io['to'](_0x11fc70)[_0xe77a('0x8')](_0x2d226c,_0x492995);}var headers={'Content-Type':'application/json','Accept':_0xe77a('0x9')};function getTicket(_0x224afc,_0x5a8fc9,_0x131c46,_0x371875,_0x43c0b4){logger[_0xe77a('0xa')](_0xe77a('0xb'));return request({'uri':util[_0xe77a('0xc')]('%s/tickets.json',_0x224afc[_0xe77a('0xd')]),'method':_0xe77a('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x131c46['id'],'submitter_id':_0x5a8fc9?_0x5a8fc9['id']:undefined,'assignee_id':_0x5a8fc9?_0x5a8fc9['id']:undefined,'tags':getTags(_0x371875[_0xe77a('0xf')],_0xe77a('0x10')),'subject':intUtil[_0xe77a('0x11')](_0x371875[_0xe77a('0x12')],_0x43c0b4,'\x20'),'description':intUtil[_0xe77a('0x11')](_0x371875[_0xe77a('0x13')],_0x43c0b4,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe77a('0x11')](_0x371875['Descriptions'],_0x43c0b4,'\x0a')}},getCustomFields(_0x371875[_0xe77a('0x14')],_0x43c0b4))}})['then'](function(_0x5c634c){logger[_0xe77a('0xa')](_0xe77a('0x15'));return _0x5c634c[_0xe77a('0x16')];});}function getUser(_0x4fd414,_0xfb888){if(intUtil[_0xe77a('0x17')](_0xfb888)){logger[_0xe77a('0xa')](_0xe77a('0x18'),_0xfb888);return request({'uri':util[_0xe77a('0xc')](_0xe77a('0x19'),_0x4fd414['remoteUri']),'qs':{'query':util[_0xe77a('0xc')]('type:user\x20role:agent\x20email:%s',_0xfb888)}})[_0xe77a('0x1a')](function(_0x26d924){if(_0x26d924[_0xe77a('0x1b')]){logger[_0xe77a('0xa')](_0xe77a('0x1c'));return _['find'](_0x26d924[_0xe77a('0x1d')],{'email':_0xfb888,'role':_0xe77a('0x1e')});}else{logger[_0xe77a('0xa')](_0xe77a('0x1f'));return request({'uri':util[_0xe77a('0xc')](_0xe77a('0x20'),_0x4fd414[_0xe77a('0xd')])})[_0xe77a('0x1a')](function(_0x1121b2){logger['info'](_0xe77a('0x21'));return _0x1121b2[_0xe77a('0x22')];});}});}else{logger[_0xe77a('0xa')](_0xe77a('0x1f'));return request({'uri':util[_0xe77a('0xc')](_0xe77a('0x20'),_0x4fd414[_0xe77a('0xd')])})['then'](function(_0x54817b){logger[_0xe77a('0xa')](_0xe77a('0x21'));return _0x54817b[_0xe77a('0x22')];});}}function getEndUser(_0xee26ec,_0x5d6258,_0x402ea5){logger[_0xe77a('0xa')](_0xe77a('0x23'),_0x402ea5);return request({'uri':util[_0xe77a('0xc')](_0xe77a('0x19'),_0xee26ec['remoteUri']),'qs':{'query':util[_0xe77a('0xc')](_0xe77a('0x24'),_0x402ea5)}})['then'](function(_0x5f5320){var _0xca211a;if(_0x5f5320[_0xe77a('0x1d')]['length']){_0x5f5320['results']=_[_0xe77a('0x25')](_0x5f5320[_0xe77a('0x1d')],{'suspended':![],'role':_0xe77a('0x26')});if(_0x5f5320[_0xe77a('0x1d')]['length']){_0xca211a=_[_0xe77a('0x27')](_0x5f5320[_0xe77a('0x1d')]);}}if(_0xca211a){logger[_0xe77a('0xa')](_0xe77a('0x28'));return _0xca211a;}else{logger[_0xe77a('0xa')](_0xe77a('0x29'));return request({'uri':util[_0xe77a('0xc')](_0xe77a('0x2a'),_0xee26ec[_0xe77a('0xd')]),'method':_0xe77a('0xe'),'body':{'user':{'role':'end-user','name':util[_0xe77a('0xc')]('Caller\x20-\x20%s',_0x5d6258||_0x402ea5),'phone':_0x402ea5}}})['then'](function(_0x34a728){logger['info'](_0xe77a('0x2b'));return _0x34a728[_0xe77a('0x22')];});}});}function getAuth(_0x9df91f){var _0x23f893;if(_0x9df91f['authType']===_0xe77a('0x2c')){_0x23f893=util['format'](_0xe77a('0x2d'),_0x9df91f[_0xe77a('0x2e')],_0x9df91f[_0xe77a('0x2c')]);}else if(_0x9df91f['authType']===_0xe77a('0x2f')){_0x23f893=util[_0xe77a('0xc')](_0xe77a('0x30'),_0x9df91f[_0xe77a('0x2e')],_0x9df91f[_0xe77a('0x2f')]);}return util['format']('Basic\x20%s',new Buffer(_0x23f893)[_0xe77a('0x31')](_0xe77a('0x32')));}function request(_0x2ca39c){logger[_0xe77a('0x33')]('[HTTP]',JSON[_0xe77a('0x34')](_0x2ca39c));return rp(_[_0xe77a('0x5')](_0x2ca39c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xfcbe78,_0x5d68be){var _0xc2f939=[];if(_0xfcbe78&&_0xfcbe78['length']>0x0){_0xc2f939=_[_0xe77a('0x35')](_0xfcbe78,_0x5d68be);}return _0xc2f939;}function getCustomFields(_0x321ebe,_0x3cff34){var _0x3a4873=[];var _0x2fe533={'custom_fields':[]};if(_0x321ebe['length']>0x0){_['forEach'](_0x321ebe,function(_0x49425a){if(_['includes']([_0xe77a('0x36'),_0xe77a('0x37')],_0x49425a[_0xe77a('0x38')])&&_0x49425a[_0xe77a('0x39')]&&!_0x49425a[_0xe77a('0x3a')]){_0x2fe533[_0x49425a[_0xe77a('0x39')][_0xe77a('0x3b')]()]=_0x49425a[_0xe77a('0x3c')][_0xe77a('0x31')]();}else if(_['includes']([_0xe77a('0x36'),'picklist'],_0x49425a[_0xe77a('0x38')])&&_0x49425a[_0xe77a('0x3d')]&&_0x49425a[_0xe77a('0x3a')]){_0x2fe533[_0xe77a('0x3e')][_0xe77a('0x3f')]({'id':_0x49425a[_0xe77a('0x3d')],'value':_0x49425a[_0xe77a('0x3c')][_0xe77a('0x31')]()});}else if(_0x49425a[_0xe77a('0x38')]==='variable'&&_0x49425a[_0xe77a('0x40')]&&_0x49425a[_0xe77a('0x3d')]&&_0x49425a['customField']){_0x3cff34[_0x49425a[_0xe77a('0x40')]]&&_0x2fe533[_0xe77a('0x3e')][_0xe77a('0x3f')]({'id':_0x49425a[_0xe77a('0x3d')],'value':_0x3cff34[_0x49425a['variableName']][_0xe77a('0x31')]()});}else if(_0x49425a[_0xe77a('0x38')]===_0xe77a('0x41')&&_0x49425a[_0xe77a('0x42')]&&_0x49425a[_0xe77a('0x42')][_0xe77a('0x10')]&&_0x49425a['idField']&&_0x49425a[_0xe77a('0x3a')]){_0x3cff34[_0x49425a[_0xe77a('0x42')][_0xe77a('0x10')][_0xe77a('0x3b')]()]&&_0x2fe533[_0xe77a('0x3e')]['push']({'id':_0x49425a['idField'],'value':_0x3cff34[_0x49425a[_0xe77a('0x42')][_0xe77a('0x10')]['toLowerCase']()][_0xe77a('0x31')]()});}});}return _0x2fe533;}exports[_0xe77a('0x43')]=function(_0x4db7d4,_0x3eff78,_0x5ce97f,_0x5cb1b7,_0x349022,_0x2be153){var _0x4d0c88,_0x3f9ef4;_0x2be153[_0xe77a('0xd')]=intUtil[_0xe77a('0x44')](_0x2be153[_0xe77a('0xd')]);_0x2be153['serverUrl']=intUtil[_0xe77a('0x44')](_0x2be153[_0xe77a('0x45')]);if(_0x349022&&_0x349022['monitor_format']){logger[_0xe77a('0xa')]('[QUEUE]',_0xe77a('0x46'));_0x3eff78[_0xe77a('0x47')]=util['format'](_0xe77a('0x48'),_0x2be153['serverUrl'],_0x3eff78[_0xe77a('0x49')],md5(_0x3eff78['uniqueid']));}else{_0x3eff78[_0xe77a('0x47')]='';}headers['Authorization']=getAuth(_0x2be153);return getUser(_0x2be153,_0x5cb1b7[_0xe77a('0x4a')])['then'](function(_0x5ca91f){_0x4d0c88=_0x5ca91f;logger[_0xe77a('0xa')](_0xe77a('0x4b'),_0x4d0c88['id']);return getEndUser(_0x2be153,_0x3eff78[_0xe77a('0x4c')],_0x3eff78[_0xe77a('0x4d')]);})[_0xe77a('0x1a')](function(_0x448424){_0x3f9ef4=_0x448424;logger[_0xe77a('0xa')]('The\x20Enduser\x20ID\x20is:',_0x3f9ef4['id']);return getTicket(_0x2be153,_0x4d0c88,_0x3f9ef4,_0x5ce97f,_0x3eff78);})[_0xe77a('0x1a')](function(_0xb235b){if(_0xb235b){logger['info'](_0xe77a('0x4e'),_0xb235b['id']);switch(_0x2be153[_0xe77a('0x38')]){case _0xe77a('0x4f'):logger[_0xe77a('0xa')](_0xe77a('0x50'),_0xe77a('0x51'));return request({'uri':util['format'](_0xe77a('0x52'),_0x2be153[_0xe77a('0xd')],_0x4d0c88['id'],_0xb235b['id']),'method':_0xe77a('0xe')});case _0xe77a('0x53'):logger[_0xe77a('0xa')](_0xe77a('0x50'),_0xe77a('0x54'));emit(util[_0xe77a('0xc')](_0xe77a('0x55'),_0x5cb1b7['name']),_0xe77a('0x56'),{'uri':util[_0xe77a('0xc')](_0xe77a('0x57'),_0x2be153[_0xe77a('0xd')][_0xe77a('0x58')](_0xe77a('0x59'),''),_0xb235b['id'])});break;default:logger['error']('[QUEUE]',_0xe77a('0x5a'));}}})['catch'](function(_0x31aacd){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xe77a('0x5b')](_0x31aacd,{'showHidden':!![],'depth':null}));});};exports[_0xe77a('0x5c')]=function(_0x983bef,_0x2aee95,_0x31f221,_0x5e78dd,_0x4e4b00,_0x2523ee,_0x431e9a){var _0x2269c0,_0x41dbb1;_0x2523ee[_0xe77a('0xd')]=intUtil[_0xe77a('0x44')](_0x2523ee[_0xe77a('0xd')]);_0x2523ee['serverUrl']=intUtil[_0xe77a('0x44')](_0x2523ee[_0xe77a('0x45')]);if(_0x431e9a&&_0x431e9a['recordingFormat']&&_0x431e9a['recordingFormat']!==_0xe77a('0x5d')){logger['info']('[OUTBOUND]',_0xe77a('0x46'));_0x2aee95['recordingURL']=util[_0xe77a('0xc')](_0xe77a('0x48'),_0x2523ee['serverUrl'],_0x2aee95['uniqueid'],md5(_0x2aee95[_0xe77a('0x49')]));}headers[_0xe77a('0x5e')]=getAuth(_0x2523ee);return getUser(_0x2523ee,_0x5e78dd['email'])[_0xe77a('0x1a')](function(_0x439a94){_0x2269c0=_0x439a94;logger[_0xe77a('0xa')](_0xe77a('0x4b'),_0x2269c0['id']);return getEndUser(_0x2523ee,_0x2aee95[_0xe77a('0x5f')],_0x2aee95['destcalleridnum']);})[_0xe77a('0x1a')](function(_0x1f20c2){_0x41dbb1=_0x1f20c2;logger[_0xe77a('0xa')]('The\x20Enduser\x20ID\x20is:',_0x41dbb1['id']);return getTicket(_0x2523ee,_0x2269c0,_0x41dbb1,_0x31f221,_0x2aee95);})[_0xe77a('0x1a')](function(_0x318709){if(_0x318709){logger['info'](_0xe77a('0x4e'),_0x318709['id']);switch(_0x2523ee['type']){case'integrationTab':logger['info'](_0xe77a('0x60'),_0xe77a('0x51'));return request({'uri':util[_0xe77a('0xc')](_0xe77a('0x52'),_0x2523ee['remoteUri'],_0x2269c0['id'],_0x318709['id']),'method':_0xe77a('0xe')});case'newTab':logger[_0xe77a('0xa')]('[OUTBOUND]',_0xe77a('0x54'));emit(util[_0xe77a('0xc')](_0xe77a('0x55'),_0x5e78dd['name']),_0xe77a('0x56'),{'uri':util[_0xe77a('0xc')](_0xe77a('0x57'),_0x2523ee[_0xe77a('0xd')][_0xe77a('0x58')](_0xe77a('0x59'),''),_0x318709['id'])});break;default:logger['error']('[OUTBOUND]',_0xe77a('0x5a'));}}})[_0xe77a('0x61')](function(_0x1fe55b){logger[_0xe77a('0x62')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xe77a('0x5b')](_0x1fe55b,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1adb02,_0x191f45,_0x2e96ae,_0x5f06e9,_0x330ded,_0x1bc071){var _0x24ce0c,_0x18c5d0;_0x1bc071[_0xe77a('0xd')]=intUtil['stripTrailingSlash'](_0x1bc071['remoteUri']);_0x1bc071[_0xe77a('0x45')]=intUtil['stripTrailingSlash'](_0x1bc071['serverUrl']);if(_0x330ded&&_0x330ded[_0xe77a('0x63')]){logger[_0xe77a('0xa')]('['+_0x191f45[_0xe77a('0x64')][_0xe77a('0x65')]()+']',_0xe77a('0x46'));_0x191f45[_0xe77a('0x47')]=util[_0xe77a('0xc')](_0xe77a('0x48'),_0x1bc071[_0xe77a('0x45')],_0x191f45[_0xe77a('0x49')],md5(_0x191f45[_0xe77a('0x49')]));}else{_0x191f45[_0xe77a('0x47')]='';}headers[_0xe77a('0x5e')]=getAuth(_0x1bc071);return getUser(_0x1bc071)[_0xe77a('0x1a')](function(_0x7147dd){_0x24ce0c=_0x7147dd;logger['info'](_0xe77a('0x4b'),_0x24ce0c['id']);return getEndUser(_0x1bc071,_0x191f45[_0xe77a('0x4c')],_0x191f45[_0xe77a('0x4d')]);})[_0xe77a('0x1a')](function(_0x3f5243){_0x18c5d0=_0x3f5243;logger[_0xe77a('0xa')](_0xe77a('0x66'),_0x18c5d0['id']);return getTicket(_0x1bc071,_0x24ce0c,_0x18c5d0,_0x2e96ae,_0x191f45);})['then'](function(_0x4c2b2f){if(_0x4c2b2f){logger[_0xe77a('0xa')]('The\x20Ticket\x20ID\x20is:',_0x4c2b2f['id']);}})[_0xe77a('0x61')](function(_0x17562a){logger[_0xe77a('0x62')]('['+_0x191f45[_0xe77a('0x64')][_0xe77a('0x65')]()+']'+_0xe77a('0x67'),util[_0xe77a('0x5b')](_0x17562a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe214=['[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','results','%s/users/me.json','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','defaults','GET','includes','string','type','nameField','customField','toLowerCase','content','idField','variable','variableName','custom_fields','push','customVariable','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x326555,_0x1da01b){var _0x3e1d76=function(_0x666ce5){while(--_0x666ce5){_0x326555['push'](_0x326555['shift']());}};_0x3e1d76(++_0x1da01b);}(_0xe214,0x1ba));var _0x4e21=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe214[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x4e21('0x0'));var rp=require(_0x4e21('0x1'));var md5=require(_0x4e21('0x2'));var util=require(_0x4e21('0x3'));var Redis=require('ioredis');var intUtil=require(_0x4e21('0x4'));var config=require(_0x4e21('0x5'));var logger=require(_0x4e21('0x6'))(_0x4e21('0x7'));config['redis']=_['defaults'](config[_0x4e21('0x8')],{'host':_0x4e21('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4e21('0x8')]));function emit(_0x2fdaec,_0x398ee9,_0x388c6d){io['to'](_0x2fdaec)[_0x4e21('0xa')](_0x398ee9,_0x388c6d);}var headers={'Content-Type':_0x4e21('0xb'),'Accept':_0x4e21('0xb')};function getTicket(_0x407de4,_0x11e1df,_0x995fcb,_0x35117c,_0x100881){logger[_0x4e21('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x4e21('0xd')](_0x4e21('0xe'),_0x407de4[_0x4e21('0xf')]),'method':_0x4e21('0x10'),'body':{'ticket':_[_0x4e21('0x11')]({'requester_id':_0x995fcb['id'],'submitter_id':_0x11e1df?_0x11e1df['id']:undefined,'assignee_id':_0x11e1df?_0x11e1df['id']:undefined,'tags':getTags(_0x35117c[_0x4e21('0x12')],_0x4e21('0x13')),'subject':intUtil[_0x4e21('0x14')](_0x35117c[_0x4e21('0x15')],_0x100881,'\x20'),'description':intUtil[_0x4e21('0x14')](_0x35117c[_0x4e21('0x16')],_0x100881,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4e21('0x14')](_0x35117c[_0x4e21('0x16')],_0x100881,'\x0a')}},getCustomFields(_0x35117c['Fields'],_0x100881))}})['then'](function(_0x1cf8aa){logger[_0x4e21('0xc')](_0x4e21('0x17'));return _0x1cf8aa[_0x4e21('0x18')];});}function getUser(_0x22de77,_0x4b5505){if(intUtil['validateEmail'](_0x4b5505)){logger[_0x4e21('0xc')](_0x4e21('0x19'),_0x4b5505);return request({'uri':util['format'](_0x4e21('0x1a'),_0x22de77[_0x4e21('0xf')]),'qs':{'query':util['format'](_0x4e21('0x1b'),_0x4b5505)}})[_0x4e21('0x1c')](function(_0x271be9){if(_0x271be9['count']){logger[_0x4e21('0xc')](_0x4e21('0x1d'));return _[_0x4e21('0x1e')](_0x271be9[_0x4e21('0x1f')],{'email':_0x4b5505,'role':'agent'});}else{logger[_0x4e21('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x4e21('0x20'),_0x22de77[_0x4e21('0xf')])})[_0x4e21('0x1c')](function(_0x37bc31){logger['info']('Admin\x20account\x20selected.');return _0x37bc31['user'];});}});}else{logger[_0x4e21('0xc')](_0x4e21('0x21'));return request({'uri':util['format'](_0x4e21('0x20'),_0x22de77[_0x4e21('0xf')])})[_0x4e21('0x1c')](function(_0xa66fe2){logger['info'](_0x4e21('0x22'));return _0xa66fe2[_0x4e21('0x23')];});}}function getEndUser(_0x30e869,_0x2d8905,_0x2d15df){logger[_0x4e21('0xc')](_0x4e21('0x24'),_0x2d15df);return request({'uri':util[_0x4e21('0xd')](_0x4e21('0x1a'),_0x30e869['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x2d15df)}})['then'](function(_0x2a108a){var _0x2456bd;if(_0x2a108a['results'][_0x4e21('0x25')]){_0x2a108a[_0x4e21('0x1f')]=_[_0x4e21('0x26')](_0x2a108a['results'],{'suspended':![],'role':_0x4e21('0x27')});if(_0x2a108a[_0x4e21('0x1f')][_0x4e21('0x25')]){_0x2456bd=_[_0x4e21('0x28')](_0x2a108a[_0x4e21('0x1f')]);}}if(_0x2456bd){logger['info'](_0x4e21('0x29'));return _0x2456bd;}else{logger[_0x4e21('0xc')](_0x4e21('0x2a'));return request({'uri':util[_0x4e21('0xd')]('%s/users.json',_0x30e869[_0x4e21('0xf')]),'method':_0x4e21('0x10'),'body':{'user':{'role':'end-user','name':util[_0x4e21('0xd')](_0x4e21('0x2b'),_0x2d8905||_0x2d15df),'phone':_0x2d15df}}})['then'](function(_0x1e1c8a){logger[_0x4e21('0xc')](_0x4e21('0x2c'));return _0x1e1c8a[_0x4e21('0x23')];});}});}function getAuth(_0x328f12){var _0x4ffa77;if(_0x328f12[_0x4e21('0x2d')]===_0x4e21('0x2e')){_0x4ffa77=util[_0x4e21('0xd')](_0x4e21('0x2f'),_0x328f12[_0x4e21('0x30')],_0x328f12[_0x4e21('0x2e')]);}else if(_0x328f12[_0x4e21('0x2d')]===_0x4e21('0x31')){_0x4ffa77=util['format'](_0x4e21('0x32'),_0x328f12[_0x4e21('0x30')],_0x328f12[_0x4e21('0x31')]);}return util[_0x4e21('0xd')](_0x4e21('0x33'),new Buffer(_0x4ffa77)[_0x4e21('0x34')](_0x4e21('0x35')));}function request(_0x4ce308){logger[_0x4e21('0x36')]('[HTTP]',JSON[_0x4e21('0x37')](_0x4ce308));return rp(_[_0x4e21('0x38')](_0x4ce308,{'method':_0x4e21('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x5d39ec,_0x2c62a4){var _0x262d8e=[];if(_0x5d39ec&&_0x5d39ec['length']>0x0){_0x262d8e=_['map'](_0x5d39ec,_0x2c62a4);}return _0x262d8e;}function getCustomFields(_0x2856bf,_0x54092f){var _0xf79d67=[];var _0x4411dc={'custom_fields':[]};if(_0x2856bf[_0x4e21('0x25')]>0x0){_['forEach'](_0x2856bf,function(_0x2076a2){if(_[_0x4e21('0x3a')]([_0x4e21('0x3b'),'picklist'],_0x2076a2[_0x4e21('0x3c')])&&_0x2076a2[_0x4e21('0x3d')]&&!_0x2076a2[_0x4e21('0x3e')]){_0x4411dc[_0x2076a2[_0x4e21('0x3d')][_0x4e21('0x3f')]()]=_0x2076a2[_0x4e21('0x40')]['toString']();}else if(_[_0x4e21('0x3a')]([_0x4e21('0x3b'),'picklist'],_0x2076a2[_0x4e21('0x3c')])&&_0x2076a2[_0x4e21('0x41')]&&_0x2076a2['customField']){_0x4411dc['custom_fields']['push']({'id':_0x2076a2[_0x4e21('0x41')],'value':_0x2076a2[_0x4e21('0x40')][_0x4e21('0x34')]()});}else if(_0x2076a2['type']===_0x4e21('0x42')&&_0x2076a2[_0x4e21('0x43')]&&_0x2076a2[_0x4e21('0x41')]&&_0x2076a2['customField']){_0x54092f[_0x2076a2['variableName']]&&_0x4411dc[_0x4e21('0x44')][_0x4e21('0x45')]({'id':_0x2076a2[_0x4e21('0x41')],'value':_0x54092f[_0x2076a2[_0x4e21('0x43')]]['toString']()});}else if(_0x2076a2[_0x4e21('0x3c')]===_0x4e21('0x46')&&_0x2076a2['Variable']&&_0x2076a2[_0x4e21('0x47')][_0x4e21('0x13')]&&_0x2076a2['idField']&&_0x2076a2[_0x4e21('0x3e')]){_0x54092f[_0x2076a2[_0x4e21('0x47')][_0x4e21('0x13')][_0x4e21('0x3f')]()]&&_0x4411dc[_0x4e21('0x44')][_0x4e21('0x45')]({'id':_0x2076a2[_0x4e21('0x41')],'value':_0x54092f[_0x2076a2['Variable']['name']['toLowerCase']()][_0x4e21('0x34')]()});}});}return _0x4411dc;}exports['queue']=function(_0x2c2c0a,_0x17edd8,_0x36af18,_0x305d78,_0x537258,_0x1a7e95){var _0x5d338c,_0x1d4406;_0x1a7e95[_0x4e21('0xf')]=intUtil[_0x4e21('0x48')](_0x1a7e95[_0x4e21('0xf')]);_0x1a7e95['serverUrl']=intUtil[_0x4e21('0x48')](_0x1a7e95[_0x4e21('0x49')]);if(_0x537258&&_0x537258['monitor_format']){logger['info'](_0x4e21('0x4a'),_0x4e21('0x4b'));_0x17edd8[_0x4e21('0x4c')]=util[_0x4e21('0xd')](_0x4e21('0x4d'),_0x1a7e95[_0x4e21('0x49')],_0x17edd8['uniqueid'],md5(_0x17edd8[_0x4e21('0x4e')]));}else{_0x17edd8[_0x4e21('0x4c')]='';}headers[_0x4e21('0x4f')]=getAuth(_0x1a7e95);return getUser(_0x1a7e95,_0x305d78[_0x4e21('0x50')])[_0x4e21('0x1c')](function(_0x54cba8){_0x5d338c=_0x54cba8;logger[_0x4e21('0xc')]('The\x20User\x20ID\x20is:',_0x5d338c['id']);return getEndUser(_0x1a7e95,_0x17edd8[_0x4e21('0x51')],_0x17edd8[_0x4e21('0x52')]);})[_0x4e21('0x1c')](function(_0x2b6cdb){_0x1d4406=_0x2b6cdb;logger[_0x4e21('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1d4406['id']);return getTicket(_0x1a7e95,_0x5d338c,_0x1d4406,_0x36af18,_0x17edd8);})['then'](function(_0x4aa517){if(_0x4aa517){logger[_0x4e21('0xc')](_0x4e21('0x53'),_0x4aa517['id']);switch(_0x1a7e95[_0x4e21('0x3c')]){case _0x4e21('0x54'):logger['info'](_0x4e21('0x4a'),_0x4e21('0x55'));return request({'uri':util[_0x4e21('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1a7e95['remoteUri'],_0x5d338c['id'],_0x4aa517['id']),'method':'POST'});case _0x4e21('0x56'):logger['info'](_0x4e21('0x4a'),_0x4e21('0x57'));emit(util['format'](_0x4e21('0x58'),_0x305d78['name']),_0x4e21('0x59'),{'uri':util['format'](_0x4e21('0x5a'),_0x1a7e95[_0x4e21('0xf')][_0x4e21('0x5b')](_0x4e21('0x5c'),''),_0x4aa517['id'])});break;default:logger[_0x4e21('0x5d')](_0x4e21('0x4a'),_0x4e21('0x5e'));}}})[_0x4e21('0x5f')](function(_0x4c94c1){logger[_0x4e21('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4e21('0x60')](_0x4c94c1,{'showHidden':!![],'depth':null}));});};exports[_0x4e21('0x61')]=function(_0x525a75,_0x563ca4,_0x352d1f,_0xc28fb4,_0x465c2e,_0x508e75,_0x520270){var _0x1a722d,_0x5e6309;_0x508e75[_0x4e21('0xf')]=intUtil[_0x4e21('0x48')](_0x508e75[_0x4e21('0xf')]);_0x508e75[_0x4e21('0x49')]=intUtil[_0x4e21('0x48')](_0x508e75[_0x4e21('0x49')]);if(_0x520270&&_0x520270[_0x4e21('0x62')]&&_0x520270[_0x4e21('0x62')]!=='none'){logger[_0x4e21('0xc')]('[OUTBOUND]',_0x4e21('0x4b'));_0x563ca4['recordingURL']=util[_0x4e21('0xd')](_0x4e21('0x4d'),_0x508e75[_0x4e21('0x49')],_0x563ca4[_0x4e21('0x4e')],md5(_0x563ca4[_0x4e21('0x4e')]));}headers['Authorization']=getAuth(_0x508e75);return getUser(_0x508e75,_0xc28fb4['email'])[_0x4e21('0x1c')](function(_0x3d832e){_0x1a722d=_0x3d832e;logger[_0x4e21('0xc')](_0x4e21('0x63'),_0x1a722d['id']);return getEndUser(_0x508e75,_0x563ca4[_0x4e21('0x64')],_0x563ca4[_0x4e21('0x65')]);})[_0x4e21('0x1c')](function(_0x1da70b){_0x5e6309=_0x1da70b;logger[_0x4e21('0xc')](_0x4e21('0x66'),_0x5e6309['id']);return getTicket(_0x508e75,_0x1a722d,_0x5e6309,_0x352d1f,_0x563ca4);})[_0x4e21('0x1c')](function(_0x21e457){if(_0x21e457){logger['info'](_0x4e21('0x53'),_0x21e457['id']);switch(_0x508e75[_0x4e21('0x3c')]){case'integrationTab':logger[_0x4e21('0xc')](_0x4e21('0x67'),_0x4e21('0x55'));return request({'uri':util[_0x4e21('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x508e75[_0x4e21('0xf')],_0x1a722d['id'],_0x21e457['id']),'method':_0x4e21('0x10')});case _0x4e21('0x56'):logger[_0x4e21('0xc')](_0x4e21('0x67'),_0x4e21('0x57'));emit(util[_0x4e21('0xd')](_0x4e21('0x58'),_0xc28fb4[_0x4e21('0x13')]),_0x4e21('0x59'),{'uri':util[_0x4e21('0xd')](_0x4e21('0x5a'),_0x508e75[_0x4e21('0xf')][_0x4e21('0x5b')]('/api/v2',''),_0x21e457['id'])});break;default:logger[_0x4e21('0x5d')]('[OUTBOUND]',_0x4e21('0x5e'));}}})[_0x4e21('0x5f')](function(_0xf3b493){logger[_0x4e21('0x5d')](_0x4e21('0x68'),util[_0x4e21('0x60')](_0xf3b493,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x597850,_0x2f01af,_0x449515,_0x946fc0,_0x178523,_0x3e1614){var _0x5e5a8d,_0x4d382d;_0x3e1614['remoteUri']=intUtil[_0x4e21('0x48')](_0x3e1614[_0x4e21('0xf')]);_0x3e1614[_0x4e21('0x49')]=intUtil[_0x4e21('0x48')](_0x3e1614[_0x4e21('0x49')]);if(_0x178523&&_0x178523[_0x4e21('0x69')]){logger[_0x4e21('0xc')]('['+_0x2f01af['lastevent']['toUpperCase']()+']',_0x4e21('0x4b'));_0x2f01af[_0x4e21('0x4c')]=util['format'](_0x4e21('0x4d'),_0x3e1614[_0x4e21('0x49')],_0x2f01af[_0x4e21('0x4e')],md5(_0x2f01af[_0x4e21('0x4e')]));}else{_0x2f01af['recordingURL']='';}headers[_0x4e21('0x4f')]=getAuth(_0x3e1614);return getUser(_0x3e1614)[_0x4e21('0x1c')](function(_0x5edbf6){_0x5e5a8d=_0x5edbf6;logger[_0x4e21('0xc')](_0x4e21('0x63'),_0x5e5a8d['id']);return getEndUser(_0x3e1614,_0x2f01af[_0x4e21('0x51')],_0x2f01af[_0x4e21('0x52')]);})[_0x4e21('0x1c')](function(_0x1bcfb7){_0x4d382d=_0x1bcfb7;logger[_0x4e21('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4d382d['id']);return getTicket(_0x3e1614,_0x5e5a8d,_0x4d382d,_0x449515,_0x2f01af);})[_0x4e21('0x1c')](function(_0x5d0dbb){if(_0x5d0dbb){logger['info'](_0x4e21('0x53'),_0x5d0dbb['id']);}})[_0x4e21('0x5f')](function(_0x3e4d63){logger['error']('['+_0x2f01af[_0x4e21('0x6a')][_0x4e21('0x6b')]()+']'+_0x4e21('0x6c'),util[_0x4e21('0x60')](_0x3e4d63,{'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 d96fcf8..f67e417 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 _0x4522=['/oauth/v2/token','refreshToken','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','findIndex','email','info','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','complete','Call_Result','rejected','Rejected','abandoned','Timeout','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','log','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','trigger:browser:url','toUpperCase','/api/voice/recordings/','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','stringify','length','forEach','includes','string','picklist','type','toString','variable','idField','variableName','customVariable','Variable','name','indexOf','split','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x4522,0x1a0));var _0x2452=function(_0x1f46e1,_0x118eb6){_0x1f46e1=_0x1f46e1-0x0;var _0x2276ae=_0x4522[_0x1f46e1];return _0x2276ae;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x2452('0x0'));var util=require(_0x2452('0x1'));var intUtil=require(_0x2452('0x2'));var moment=require('moment');var Redis=require(_0x2452('0x3'));var BPromise=require(_0x2452('0x4'));var config=require(_0x2452('0x5'));var logger=require(_0x2452('0x6'))(_0x2452('0x7'));config[_0x2452('0x8')]=_[_0x2452('0x9')](config[_0x2452('0x8')],{'host':_0x2452('0xa'),'port':0x18eb});var io=require(_0x2452('0xb'))(new Redis(config[_0x2452('0x8')]));function emit(_0x33b935,_0x24073f,_0x365b1f){io['to'](_0x33b935)[_0x2452('0xc')](_0x24073f,_0x365b1f);}function request(_0x2995b5){logger['debug']('[HTTP]',JSON[_0x2452('0xd')](_0x2995b5));return rp(_0x2995b5);}function getCustomFields(_0x5bf6cf,_0x4d665c){var _0x2534bb={};if(_0x5bf6cf[_0x2452('0xe')]>0x0){_[_0x2452('0xf')](_0x5bf6cf,function(_0x3ad6c9){if(_[_0x2452('0x10')]([_0x2452('0x11'),_0x2452('0x12')],_0x3ad6c9[_0x2452('0x13')])&&_0x3ad6c9['idField']){_0x2534bb[_0x3ad6c9['idField']]=_0x3ad6c9['content'][_0x2452('0x14')]();}else if(_0x3ad6c9['type']===_0x2452('0x15')&&_0x3ad6c9['variableName']&&_0x3ad6c9[_0x2452('0x16')]&&_0x4d665c[_0x3ad6c9[_0x2452('0x17')]]){_0x2534bb[_0x3ad6c9['idField']]=_0x4d665c[_0x3ad6c9[_0x2452('0x17')]]['toString']();}else if(_0x3ad6c9[_0x2452('0x13')]===_0x2452('0x18')&&_0x3ad6c9[_0x2452('0x19')]&&_0x3ad6c9[_0x2452('0x19')]['name']&&_0x3ad6c9[_0x2452('0x16')]&&_0x4d665c[_0x3ad6c9[_0x2452('0x19')]['name']['toLowerCase']()]){_0x2534bb[_0x3ad6c9[_0x2452('0x16')]]=_0x4d665c[_0x3ad6c9[_0x2452('0x19')][_0x2452('0x1a')]['toLowerCase']()][_0x2452('0x14')]();}});}return _0x2534bb;}function getName(_0x467963){if(_0x467963[_0x2452('0x1b')]('\x20')>0x0){var _0x18b058=_0x467963[_0x2452('0x1c')](/ (.+)/);if(_0x18b058[0x1]){return _0x18b058;}}return[_0x467963,_0x467963];}var accountsTokens={};function getAccessToken(_0x1c70cb){return new Promise(function(_0x3f48c2,_0xea452e){if(!_['isNil'](accountsTokens[_0x1c70cb['id']])&&!_['isNil'](accountsTokens[_0x1c70cb['id']][_0x2452('0x1d')])){if(moment()[_0x2452('0x1e')](accountsTokens[_0x1c70cb['id']]['expires_in'])){_0x3f48c2(accountsTokens[_0x1c70cb['id']][_0x2452('0x1d')]);}}var _0x395cf1;switch(_0x1c70cb[_0x2452('0x1f')]){case'US':_0x395cf1=_0x2452('0x20');break;case'AU':_0x395cf1=_0x2452('0x21');break;case'EU':_0x395cf1=_0x2452('0x22');break;case'IN':_0x395cf1=_0x2452('0x23');break;case'CN':_0x395cf1='https://accounts.zoho.com.cn';break;default:_0x395cf1=_0x2452('0x22');break;}var _0x27d049={'method':_0x2452('0x24'),'uri':_0x395cf1+_0x2452('0x25'),'qs':{'refresh_token':_0x1c70cb[_0x2452('0x26')],'client_id':_0x1c70cb['clientId'],'client_secret':_0x1c70cb['clientSecret'],'grant_type':_0x2452('0x27')},'json':!![]};return rp(_0x27d049)[_0x2452('0x28')](function(_0x46fcbb){accountsTokens[_0x1c70cb['id']]={'access_token':_0x46fcbb[_0x2452('0x1d')],'expires_in':moment()[_0x2452('0x29')](_0x46fcbb['expires_in'],_0x2452('0x2a'))};_0x3f48c2(_0x46fcbb[_0x2452('0x1d')]);})['catch'](function(_0x4a25aa){logger[_0x2452('0x2b')](_0x2452('0x2c'),_0x4a25aa[_0x2452('0x2d')]);_0xea452e(_0x4a25aa);});});}function getUser(_0x28e6ea,_0x43fde0,_0x258fa6,_0x504162){logger['info'](_0x2452('0x2e'));return request({'method':_0x2452('0x2f'),'uri':util[_0x2452('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0x43fde0),'qs':{'type':_0x2452('0x31')},'headers':{'Authorization':_0x2452('0x32')+_0x28e6ea},'json':!![]})['then'](function(_0x24a9e9){if(_0x24a9e9[_0x2452('0x33')]){var _0x37b5e6=-0x1;if(_[_0x2452('0x34')](_0x24a9e9[_0x2452('0x33')])){if(!_[_0x2452('0x35')](_0x504162)){_0x37b5e6=_[_0x2452('0x36')](_0x24a9e9[_0x2452('0x33')],function(_0x3b96aa){return _0x3b96aa[_0x2452('0x37')]===_0x504162;});}if(_0x37b5e6>=0x0){logger[_0x2452('0x38')](_0x2452('0x39'));}else{logger[_0x2452('0x38')]('Using\x20the\x20admin\x20account!');_0x37b5e6=_[_0x2452('0x36')](_0x24a9e9[_0x2452('0x33')],function(_0x4cd7e2){return _0x4cd7e2[_0x2452('0x3a')]['name']===_0x2452('0x3b');});}return _0x24a9e9[_0x2452('0x33')][_0x37b5e6];}else{if(_0x24a9e9['user'][_0x2452('0x3a')][_0x2452('0x1a')]===_0x2452('0x3b')){logger['info'](_0x2452('0x3c'));user=_0x24a9e9[_0x2452('0x3d')];return user;}else{logger['error'](_0x2452('0x3e'),JSON[_0x2452('0xd')](_0x24a9e9));throw new Error(_0x2452('0x3f')+JSON[_0x2452('0xd')](_0x24a9e9));}}}else{logger[_0x2452('0x2b')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x24a9e9));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x2452('0xd')](_0x24a9e9));}})[_0x2452('0x40')](function(_0x64965c){console[_0x2452('0x2b')](_0x64965c);});}function getZohoUser(_0x408b92,_0x4c4c45){return new BPromise(function(_0x22120a,_0x492a36){request(_0x408b92)['then'](function(_0x28bc06){var _0x515e7b=null;if(_0x28bc06){_0x515e7b=_0x28bc06[_0x2452('0x41')][0x0];_0x515e7b[_0x2452('0x42')]=_0x4c4c45;}_0x22120a(_0x515e7b);})['catch'](function(_0x30b49f){_0x492a36(_0x30b49f);});});}function createEndUser(_0x2cc8a4,_0x28ca0f,_0x34d7f9,_0x2babbe,_0x112849,_0x1a1af5){var _0x34d7f9=getName(_0x34d7f9);return request({'method':'POST','uri':_0x2452('0x43')+_0x28ca0f+'/crm/v2/'+_[_0x2452('0x44')](_0x1a1af5[_0x2452('0x45')])+'s','body':{'data':[{'Last_Name':_0x34d7f9[0x1],'First_Name':_0x34d7f9[0x0],'Phone':_0x2babbe,'Owner':{'name':!_['isNil'](_0x112849[_0x2452('0x46')][_0x2452('0x1a')])?_0x112849[_0x2452('0x46')][_0x2452('0x1a')]:!_[_0x2452('0x35')](_0x112849['first_name'])?_0x112849[_0x2452('0x47')]+'\x20'+_0x112849[_0x2452('0x48')]:_0x112849['last_name'],'id':_0x112849['id']}}]},'headers':{'Authorization':_0x2452('0x32')+_0x2cc8a4},'json':!![]})[_0x2452('0x28')](function(_0xf21655){if(_0xf21655&&_0xf21655[_0x2452('0x41')][0x0]['code']===_0x2452('0x49')){var _0x304942=_0xf21655[_0x2452('0x41')][0x0][_0x2452('0x4a')];_0x304942[_0x2452('0x42')]=_[_0x2452('0x44')](_0x1a1af5['moduleCreate'])+'s';return _0x304942;}logger[_0x2452('0x2b')]('The\x20failing\x20result\x20is',JSON[_0x2452('0xd')](data));throw new Error(_0x2452('0x4b')+JSON['stringify'](data));})['catch'](function(_0x50f700){console['log'](_0x2452('0x4c'),_0x50f700);});}function getEndUser(_0x4ec49f,_0x15f0e7,_0x5e400a,_0x1ef02b,_0x16d938,_0x55de3d,_0x4c6b8a){var _0x251050={'method':'GET','uri':'','headers':{'Authorization':_0x2452('0x32')+_0x4ec49f},'json':!![]};switch(_0x4c6b8a[_0x2452('0x4d')]){case _0x2452('0x4e'):_0x251050[_0x2452('0x4f')]='https://www.zohoapis.'+_0x15f0e7+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x16d938+'))';return getZohoUser(_0x251050,_0x2452('0x50'))[_0x2452('0x28')](function(_0x40a550){if(_0x40a550)return _0x40a550;_0x251050[_0x2452('0x4f')]=_0x2452('0x43')+_0x15f0e7+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x16d938+'))';return getZohoUser(_0x251050,_0x2452('0x51'))['then'](function(_0x3634f7){if(_0x3634f7)return _0x3634f7;if(_0x4c6b8a['moduleCreate']!=_0x2452('0x52')){return createEndUser(_0x4ec49f,_0x15f0e7,_0x1ef02b,_0x16d938,_0x55de3d,_0x4c6b8a);}else{return{};}});});break;case _0x2452('0x53'):_0x251050['uri']=_0x2452('0x43')+_0x15f0e7+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x16d938+'))';return getZohoUser(_0x251050,_0x2452('0x50'))['then'](function(_0x4fc8d4){if(_0x4fc8d4)return _0x4fc8d4;if(_0x4c6b8a['moduleCreate']!=_0x2452('0x52')){return createEndUser(_0x4ec49f,_0x15f0e7,_0x1ef02b,_0x16d938,_0x55de3d,_0x4c6b8a);}else{return{};}});break;case _0x2452('0x54'):_0x251050[_0x2452('0x4f')]='https://www.zohoapis.'+_0x15f0e7+_0x2452('0x55')+_0x16d938+'))';return getZohoUser(_0x251050,_0x2452('0x51'))[_0x2452('0x28')](function(_0x2aeb74){if(_0x2aeb74)return _0x2aeb74;if(_0x4c6b8a[_0x2452('0x45')]!='nothing'){return createEndUser(_0x4ec49f,_0x15f0e7,_0x1ef02b,_0x16d938,_0x55de3d,_0x4c6b8a);}else{return{};}});break;}}function getCall(_0x43507c,_0x52d286,_0x163510,_0x44a6f,_0x1818a9,_0x51eb53,_0x6ee99d,_0x2096e2){logger[_0x2452('0x38')](_0x2452('0x56'));var _0x3629d3={};_0x3629d3['Owner']={'name':!_[_0x2452('0x35')](_0x44a6f['role'][_0x2452('0x1a')])&&!_['isNil'](_0x44a6f[_0x2452('0x3a')][_0x2452('0x1a')])&&_0x44a6f['profile'][_0x2452('0x1a')]===_0x2452('0x57')?_0x44a6f[_0x2452('0x46')][_0x2452('0x1a')]:!_[_0x2452('0x35')](_0x44a6f[_0x2452('0x47')])?_0x44a6f[_0x2452('0x47')]+'\x20'+_0x44a6f[_0x2452('0x48')]:_0x44a6f[_0x2452('0x48')],'id':_0x44a6f['id']};_0x3629d3[_0x2452('0x58')]=intUtil[_0x2452('0x59')](_0x51eb53['Subjects'],_0x6ee99d,'\x20');_0x3629d3[_0x2452('0x5a')]=intUtil['getString'](_0x51eb53[_0x2452('0x5b')],_0x6ee99d,'\x0a');if(_0x1818a9['enduserType']===_0x2452('0x50')){_0x3629d3[_0x2452('0x5c')]={'name':!_[_0x2452('0x35')](_0x1818a9[_0x2452('0x5d')])?_0x1818a9[_0x2452('0x5d')]:!_[_0x2452('0x35')](_0x1818a9[_0x2452('0x5e')])?_0x1818a9[_0x2452('0x5e')]+'\x20'+_0x1818a9[_0x2452('0x5f')]:_0x1818a9[_0x2452('0x5f')],'id':_0x1818a9['id']};}if(_0x1818a9[_0x2452('0x42')]==='Leads'){_0x3629d3[_0x2452('0x60')]={'name':!_[_0x2452('0x35')](_0x1818a9[_0x2452('0x5d')])?_0x1818a9[_0x2452('0x5d')]:!_[_0x2452('0x35')](_0x1818a9[_0x2452('0x5e')])?_0x1818a9['First_Name']+'\x20'+_0x1818a9[_0x2452('0x5f')]:_0x1818a9[_0x2452('0x5f')],'id':_0x1818a9['id']};_0x3629d3['$se_module']=_[_0x2452('0x44')](_0x1818a9[_0x2452('0x42')]);}if(_0x6ee99d[_0x2452('0x61')]){_0x3629d3[_0x2452('0x62')]=moment[_0x2452('0x63')](parseInt(_0x6ee99d[_0x2452('0x61')])*0x3e8)[_0x2452('0x30')](_0x2452('0x64'));}else if(_0x6ee99d[_0x2452('0x65')]&&_0x6ee99d[_0x2452('0x66')]){_0x3629d3[_0x2452('0x62')]=moment['utc'](moment(_0x6ee99d['endtime'],_0x2452('0x67'))['diff'](moment(_0x6ee99d[_0x2452('0x68')],_0x2452('0x67'))))[_0x2452('0x30')](_0x2452('0x64'));}switch(_0x6ee99d[_0x2452('0x69')]){case _0x2452('0x6a'):_0x3629d3['Call_Result']='Called';break;case _0x2452('0x6b'):case'connect':_0x3629d3[_0x2452('0x6c')]='Answered';break;case _0x2452('0x6d'):_0x3629d3[_0x2452('0x6c')]=_0x2452('0x6e');break;case _0x2452('0x6f'):_0x3629d3['Call_Result']='Abandoned';break;case'timeout':_0x3629d3[_0x2452('0x6c')]=_0x2452('0x70');default:}_0x3629d3['Call_Start_Time']=(_0x2096e2==='outbound'?moment(_0x6ee99d['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x6ee99d[_0x2452('0x71')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x2452('0x30')](_0x2452('0x67'));_0x3629d3[_0x2452('0x72')]=_0x2096e2||_0x2452('0x73');_0x3629d3=_[_0x2452('0x74')](_0x3629d3,getCustomFields(_0x51eb53[_0x2452('0x75')],_0x6ee99d));return request({'method':'POST','uri':_0x2452('0x43')+_0x52d286+_0x2452('0x76'),'headers':{'Authorization':_0x2452('0x32')+_0x43507c},'body':{'data':[_0x3629d3]},'json':!![]})['then'](function(_0x490b25){if(_0x490b25&&_0x490b25[_0x2452('0x41')][0x0][_0x2452('0x77')]===_0x2452('0x49')){logger[_0x2452('0x38')](_0x2452('0x78'));return{'id':_0x490b25[_0x2452('0x41')][0x0][_0x2452('0x4a')]['id']};}})[_0x2452('0x40')](function(_0x585648){logger[_0x2452('0x38')](_0x2452('0x79'),_0x585648[_0x2452('0x2d')]);console[_0x2452('0x7a')]('err',_0x585648);});}exports[_0x2452('0x7b')]=function(_0x132cd3,_0x5d5926,_0x20f796,_0x8927c4,_0x1ac90f,_0x3c96d9){var _0x19cf40,_0x23cf93,_0x3e5269;_0x3c96d9[_0x2452('0x7c')]=intUtil['stripTrailingSlash'](_0x3c96d9['host']);_0x3c96d9[_0x2452('0x7d')]=intUtil[_0x2452('0x7e')](_0x3c96d9[_0x2452('0x7d')]);if(_0x1ac90f&&_0x1ac90f[_0x2452('0x7f')]){logger['info'](_0x2452('0x80'),_0x2452('0x81'));_0x5d5926[_0x2452('0x82')]=_0x3c96d9[_0x2452('0x7d')]+'/api/voice/recordings/'+_0x5d5926[_0x2452('0x83')]+_0x2452('0x84')+md5(_0x5d5926[_0x2452('0x83')]);}else{_0x5d5926[_0x2452('0x82')]='';}var _0x552633=_0x3c96d9['host']===_0x2452('0x85')?'eu':_0x2452('0x86');return getAccessToken(_0x3c96d9)['then'](function(_0x388fb8){_0x3e5269=_0x388fb8;return getUser(_0x3e5269,_0x552633,_0x3c96d9,_0x8927c4[_0x2452('0x37')]);})[_0x2452('0x28')](function(_0x19b52b){_0x19cf40=_0x19b52b;logger[_0x2452('0x38')](_0x2452('0x87'),_0x19cf40['id']);return getEndUser(_0x3e5269,_0x552633,_0x3c96d9,_0x5d5926[_0x2452('0x88')],_0x5d5926[_0x2452('0x89')],_0x19cf40,_0x20f796);})[_0x2452('0x28')](function(_0x378224){_0x23cf93=_0x378224;return getCall(_0x3e5269,_0x552633,_0x3c96d9,_0x19cf40,_0x23cf93,_0x20f796,_0x5d5926,_0x2452('0x73'));})[_0x2452('0x28')](function(_0x3abeb7){if(_0x3abeb7){logger[_0x2452('0x38')](_0x2452('0x8a'),_0x3abeb7['id']);logger[_0x2452('0x38')]('[QUEUE]',_0x2452('0x8b'));emit(util[_0x2452('0x30')](_0x2452('0x8c'),_0x8927c4['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x3c96d9[_0x2452('0x7c')]+_0x2452('0x8d')+_0x3abeb7['id']});}})[_0x2452('0x40')](function(_0x36774d){logger['error']('[QUEUE]',JSON['stringify'](_0x36774d));});};exports[_0x2452('0x8e')]=function(_0x47a0e9,_0x1fef69,_0x49c530,_0x1aa7e4,_0x55a97d,_0xc14791,_0x54b831){var _0x4170b8,_0x3d1cd0,_0x20f27b;_0xc14791[_0x2452('0x7c')]=intUtil[_0x2452('0x7e')](_0xc14791['host']);_0xc14791[_0x2452('0x7d')]=intUtil[_0x2452('0x7e')](_0xc14791[_0x2452('0x7d')]);if(_0x54b831&&_0x54b831[_0x2452('0x8f')]&&_0x54b831[_0x2452('0x8f')]!==_0x2452('0x90')){logger[_0x2452('0x38')](_0x2452('0x91'),_0x2452('0x81'));_0x1fef69[_0x2452('0x82')]=_0xc14791[_0x2452('0x7d')]+'/api/voice/recordings/'+_0x1fef69[_0x2452('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x1fef69[_0x2452('0x83')]);}var _0x4976a4=_0xc14791['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0xc14791)['then'](function(_0x4f485c){_0x20f27b=_0x4f485c;return getUser(_0x20f27b,_0x4976a4,_0xc14791,_0x1aa7e4[_0x2452('0x37')]);})[_0x2452('0x28')](function(_0x2cdeca){_0x4170b8=_0x2cdeca;logger['info']('The\x20User\x20ID\x20is:',_0x4170b8['id']);return getEndUser(_0x20f27b,_0x4976a4,_0xc14791,_0x1fef69['destcalleridname'],_0x1fef69[_0x2452('0x92')],_0x4170b8,_0x49c530);})[_0x2452('0x28')](function(_0x16f979){_0x3d1cd0=_0x16f979;return getCall(_0x20f27b,_0x4976a4,_0xc14791,_0x4170b8,_0x3d1cd0,_0x49c530,_0x1fef69,_0x2452('0x93'));})[_0x2452('0x28')](function(_0x5cbc70){if(_0x5cbc70){logger[_0x2452('0x38')]('The\x20Call\x20ID\x20is:',_0x5cbc70['id']);logger[_0x2452('0x38')](_0x2452('0x91'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2452('0x30')](_0x2452('0x8c'),_0x1aa7e4[_0x2452('0x1a')]),_0x2452('0x94'),{'uri':'https://crm.'+_0xc14791[_0x2452('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5cbc70['id']});}})[_0x2452('0x40')](function(_0x38ed2f){logger[_0x2452('0x2b')](_0x2452('0x91'),JSON[_0x2452('0xd')](_0x38ed2f));});};exports['unmanaged']=function(_0x19465d,_0x20ae3c,_0x29682,_0x1f8825,_0x52fc60,_0x11dbd6){var _0x2ea740,_0xdeeeff,_0x22c6ae;_0x11dbd6[_0x2452('0x7c')]=intUtil[_0x2452('0x7e')](_0x11dbd6[_0x2452('0x7c')]);_0x11dbd6['serverUrl']=intUtil[_0x2452('0x7e')](_0x11dbd6['serverUrl']);if(_0x52fc60&&_0x52fc60['monitor_format']){logger['info']('['+_0x20ae3c[_0x2452('0x69')][_0x2452('0x95')]()+']',_0x2452('0x81'));_0x20ae3c[_0x2452('0x82')]=_0x11dbd6[_0x2452('0x7d')]+_0x2452('0x96')+_0x20ae3c[_0x2452('0x83')]+_0x2452('0x84')+md5(_0x20ae3c[_0x2452('0x83')]);}else{_0x20ae3c['recordingURL']='';}var _0x4c85ef=_0x11dbd6['host']===_0x2452('0x85')?'eu':'com';return getAccessToken(_0x11dbd6)['then'](function(_0xec2569){_0x22c6ae=_0xec2569;return getUser(_0x22c6ae,_0x4c85ef,_0x11dbd6);})[_0x2452('0x28')](function(_0x3d7c72){_0x2ea740=_0x3d7c72;logger[_0x2452('0x38')](_0x2452('0x87'),_0x2ea740['id']);return getEndUser(_0x22c6ae,_0x4c85ef,_0x11dbd6,_0x20ae3c['calleridname'],_0x20ae3c[_0x2452('0x89')],_0x2ea740,_0x29682);})[_0x2452('0x28')](function(_0x1c7232){_0xdeeeff=_0x1c7232;return getCall(_0x22c6ae,_0x4c85ef,_0x11dbd6,_0x2ea740,_0xdeeeff,_0x29682,_0x20ae3c,_0x2452('0x73'));})[_0x2452('0x28')](function(_0x48b72b){if(_0x48b72b){logger[_0x2452('0x38')]('The\x20Call\x20ID\x20is:',_0x48b72b['id']);}})[_0x2452('0x40')](function(_0x51b6ef){logger[_0x2452('0x2b')]('['+_0x20ae3c[_0x2452('0x69')][_0x2452('0x95')]()+']',JSON[_0x2452('0xd')](_0x51b6ef));});}; \ No newline at end of file +var _0xbee3=['First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','format','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','Called','complete','connect','Call_Result','rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','SUCCESS','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','https://crm.','lastevent','toUpperCase','request-promise','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','findIndex','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','CREATE\x20ERROR','Contacts','Leads','nothing','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xbee3,0xd5));var _0x3bee=function(_0x4b4c52,_0x387ec2){_0x4b4c52=_0x4b4c52-0x0;var _0x4d0dec=_0xbee3[_0x4b4c52];return _0x4d0dec;};'use strict';var _=require('lodash');var rp=require(_0x3bee('0x0'));var md5=require('md5');var util=require('util');var intUtil=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var Redis=require('ioredis');var BPromise=require(_0x3bee('0x3'));var config=require(_0x3bee('0x4'));var logger=require(_0x3bee('0x5'))('zoho');config[_0x3bee('0x6')]=_[_0x3bee('0x7')](config['redis'],{'host':_0x3bee('0x8'),'port':0x18eb});var io=require(_0x3bee('0x9'))(new Redis(config[_0x3bee('0x6')]));function emit(_0x339223,_0xbdd5d5,_0x9aab05){io['to'](_0x339223)[_0x3bee('0xa')](_0xbdd5d5,_0x9aab05);}function request(_0x518e2d){logger[_0x3bee('0xb')](_0x3bee('0xc'),JSON[_0x3bee('0xd')](_0x518e2d));return rp(_0x518e2d);}function getCustomFields(_0x280dcf,_0x356fef){var _0xc53ada={};if(_0x280dcf['length']>0x0){_[_0x3bee('0xe')](_0x280dcf,function(_0x5bb283){if(_[_0x3bee('0xf')]([_0x3bee('0x10'),_0x3bee('0x11')],_0x5bb283[_0x3bee('0x12')])&&_0x5bb283[_0x3bee('0x13')]){_0xc53ada[_0x5bb283[_0x3bee('0x13')]]=_0x5bb283[_0x3bee('0x14')]['toString']();}else if(_0x5bb283[_0x3bee('0x12')]===_0x3bee('0x15')&&_0x5bb283[_0x3bee('0x16')]&&_0x5bb283[_0x3bee('0x13')]&&_0x356fef[_0x5bb283[_0x3bee('0x16')]]){_0xc53ada[_0x5bb283['idField']]=_0x356fef[_0x5bb283['variableName']][_0x3bee('0x17')]();}else if(_0x5bb283['type']===_0x3bee('0x18')&&_0x5bb283[_0x3bee('0x19')]&&_0x5bb283['Variable']['name']&&_0x5bb283[_0x3bee('0x13')]&&_0x356fef[_0x5bb283[_0x3bee('0x19')][_0x3bee('0x1a')][_0x3bee('0x1b')]()]){_0xc53ada[_0x5bb283['idField']]=_0x356fef[_0x5bb283[_0x3bee('0x19')][_0x3bee('0x1a')][_0x3bee('0x1b')]()][_0x3bee('0x17')]();}});}return _0xc53ada;}function getName(_0x33d812){if(_0x33d812[_0x3bee('0x1c')]('\x20')>0x0){var _0x1ca43c=_0x33d812['split'](/ (.+)/);if(_0x1ca43c[0x1]){return _0x1ca43c;}}return[_0x33d812,_0x33d812];}var accountsTokens={};function getAccessToken(_0x4f36af){return new Promise(function(_0x1afd0f,_0x30bba2){if(!_['isNil'](accountsTokens[_0x4f36af['id']])&&!_[_0x3bee('0x1d')](accountsTokens[_0x4f36af['id']][_0x3bee('0x1e')])){if(moment()[_0x3bee('0x1f')](accountsTokens[_0x4f36af['id']][_0x3bee('0x20')])){_0x1afd0f(accountsTokens[_0x4f36af['id']][_0x3bee('0x1e')]);}}var _0x26e92e;switch(_0x4f36af[_0x3bee('0x21')]){case'US':_0x26e92e='https://accounts.zoho.com';break;case'AU':_0x26e92e=_0x3bee('0x22');break;case'EU':_0x26e92e=_0x3bee('0x23');break;case'IN':_0x26e92e=_0x3bee('0x24');break;case'CN':_0x26e92e=_0x3bee('0x25');break;default:_0x26e92e='https://accounts.zoho.eu';break;}var _0x45249c={'method':_0x3bee('0x26'),'uri':_0x26e92e+_0x3bee('0x27'),'qs':{'refresh_token':_0x4f36af['refreshToken'],'client_id':_0x4f36af['clientId'],'client_secret':_0x4f36af[_0x3bee('0x28')],'grant_type':_0x3bee('0x29')},'json':!![]};return rp(_0x45249c)['then'](function(_0x2c0e50){accountsTokens[_0x4f36af['id']]={'access_token':_0x2c0e50[_0x3bee('0x1e')],'expires_in':moment()[_0x3bee('0x2a')](_0x2c0e50['expires_in'],_0x3bee('0x2b'))};_0x1afd0f(_0x2c0e50[_0x3bee('0x1e')]);})[_0x3bee('0x2c')](function(_0x4f2066){logger[_0x3bee('0x2d')](_0x3bee('0x2e'),_0x4f2066[_0x3bee('0x2f')]);_0x30bba2(_0x4f2066);});});}function getUser(_0x496abd,_0x1115ed,_0x24d523,_0x27ed99){logger[_0x3bee('0x30')](_0x3bee('0x31'));return request({'method':'GET','uri':util['format'](_0x3bee('0x32'),_0x1115ed),'qs':{'type':_0x3bee('0x33')},'headers':{'Authorization':_0x3bee('0x34')+_0x496abd},'json':!![]})[_0x3bee('0x35')](function(_0x4df2ac){if(_0x4df2ac['users']){var _0x38f93c=-0x1;if(_[_0x3bee('0x36')](_0x4df2ac['users'])){if(!_['isNil'](_0x27ed99)){_0x38f93c=_[_0x3bee('0x37')](_0x4df2ac[_0x3bee('0x38')],function(_0x36447b){return _0x36447b[_0x3bee('0x39')]===_0x27ed99;});}if(_0x38f93c>=0x0){logger[_0x3bee('0x30')](_0x3bee('0x3a'));}else{logger[_0x3bee('0x30')](_0x3bee('0x3b'));_0x38f93c=_[_0x3bee('0x37')](_0x4df2ac[_0x3bee('0x38')],function(_0x569675){return _0x569675['profile'][_0x3bee('0x1a')]==='Administrator';});}return _0x4df2ac['users'][_0x38f93c];}else{if(_0x4df2ac[_0x3bee('0x3c')][_0x3bee('0x3d')][_0x3bee('0x1a')]===_0x3bee('0x3e')){logger[_0x3bee('0x30')](_0x3bee('0x3b'));user=_0x4df2ac[_0x3bee('0x3c')];return user;}else{logger[_0x3bee('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x3bee('0xd')](_0x4df2ac));throw new Error(_0x3bee('0x3f')+JSON['stringify'](_0x4df2ac));}}}else{logger[_0x3bee('0x2d')](_0x3bee('0x40'),JSON[_0x3bee('0xd')](_0x4df2ac));throw new Error(_0x3bee('0x3f')+JSON[_0x3bee('0xd')](_0x4df2ac));}})['catch'](function(_0x57a895){console[_0x3bee('0x2d')](_0x57a895);});}function getZohoUser(_0x2ea6fe,_0x59ca12){return new BPromise(function(_0x428953,_0x18ac16){request(_0x2ea6fe)[_0x3bee('0x35')](function(_0x2c6ca3){var _0x114217=null;if(_0x2c6ca3){_0x114217=_0x2c6ca3[_0x3bee('0x41')][0x0];_0x114217[_0x3bee('0x42')]=_0x59ca12;}_0x428953(_0x114217);})[_0x3bee('0x2c')](function(_0x1cfd37){_0x18ac16(_0x1cfd37);});});}function createEndUser(_0x4a8da6,_0xaceed4,_0x1b5eca,_0x25158b,_0x45cf81,_0x268c0e){var _0x1b5eca=getName(_0x1b5eca);return request({'method':_0x3bee('0x26'),'uri':_0x3bee('0x43')+_0xaceed4+_0x3bee('0x44')+_[_0x3bee('0x45')](_0x268c0e[_0x3bee('0x46')])+'s','body':{'data':[{'Last_Name':_0x1b5eca[0x1],'First_Name':_0x1b5eca[0x0],'Phone':_0x25158b,'Owner':{'name':!_[_0x3bee('0x1d')](_0x45cf81[_0x3bee('0x47')]['name'])?_0x45cf81[_0x3bee('0x47')][_0x3bee('0x1a')]:!_[_0x3bee('0x1d')](_0x45cf81[_0x3bee('0x48')])?_0x45cf81[_0x3bee('0x48')]+'\x20'+_0x45cf81[_0x3bee('0x49')]:_0x45cf81[_0x3bee('0x49')],'id':_0x45cf81['id']}}]},'headers':{'Authorization':_0x3bee('0x34')+_0x4a8da6},'json':!![]})['then'](function(_0x10a59d){if(_0x10a59d&&_0x10a59d[_0x3bee('0x41')][0x0][_0x3bee('0x4a')]==='SUCCESS'){var _0x4567f2=_0x10a59d['data'][0x0][_0x3bee('0x4b')];_0x4567f2['enduserType']=_['startCase'](_0x268c0e[_0x3bee('0x46')])+'s';return _0x4567f2;}logger[_0x3bee('0x2d')](_0x3bee('0x40'),JSON[_0x3bee('0xd')](data));throw new Error(_0x3bee('0x4c')+JSON['stringify'](data));})['catch'](function(_0x4188a8){console['log'](_0x3bee('0x4d'),_0x4188a8);});}function getEndUser(_0x4bd1e5,_0x422546,_0x54720c,_0x1b8218,_0x5293d9,_0x34a66b,_0x57e69b){var _0x577a23={'method':'GET','uri':'','headers':{'Authorization':_0x3bee('0x34')+_0x4bd1e5},'json':!![]};switch(_0x57e69b['moduleSearch']){case'contact_lead':_0x577a23['uri']=_0x3bee('0x43')+_0x422546+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5293d9+'))';return getZohoUser(_0x577a23,_0x3bee('0x4e'))[_0x3bee('0x35')](function(_0xd87fd2){if(_0xd87fd2)return _0xd87fd2;_0x577a23['uri']=_0x3bee('0x43')+_0x422546+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5293d9+'))';return getZohoUser(_0x577a23,_0x3bee('0x4f'))['then'](function(_0x26ccd7){if(_0x26ccd7)return _0x26ccd7;if(_0x57e69b[_0x3bee('0x46')]!=_0x3bee('0x50')){return createEndUser(_0x4bd1e5,_0x422546,_0x1b8218,_0x5293d9,_0x34a66b,_0x57e69b);}else{return{};}});});break;case'contact':_0x577a23[_0x3bee('0x51')]=_0x3bee('0x43')+_0x422546+_0x3bee('0x52')+_0x5293d9+'))';return getZohoUser(_0x577a23,'Contacts')['then'](function(_0x6f1388){if(_0x6f1388)return _0x6f1388;if(_0x57e69b[_0x3bee('0x46')]!=_0x3bee('0x50')){return createEndUser(_0x4bd1e5,_0x422546,_0x1b8218,_0x5293d9,_0x34a66b,_0x57e69b);}else{return{};}});break;case _0x3bee('0x53'):_0x577a23[_0x3bee('0x51')]=_0x3bee('0x43')+_0x422546+_0x3bee('0x54')+_0x5293d9+'))';return getZohoUser(_0x577a23,'Leads')[_0x3bee('0x35')](function(_0x1f93b9){if(_0x1f93b9)return _0x1f93b9;if(_0x57e69b['moduleCreate']!='nothing'){return createEndUser(_0x4bd1e5,_0x422546,_0x1b8218,_0x5293d9,_0x34a66b,_0x57e69b);}else{return{};}});break;}}function getCall(_0x3730c5,_0x5d4755,_0x1cb54e,_0x2162ce,_0x1f0f23,_0x4fb836,_0x1a13fd,_0x3beac9){logger[_0x3bee('0x30')]('Creating\x20new\x20call...');var _0x1ee4f0={};_0x1ee4f0[_0x3bee('0x55')]={'name':!_['isNil'](_0x2162ce[_0x3bee('0x47')][_0x3bee('0x1a')])&&!_['isNil'](_0x2162ce[_0x3bee('0x3d')][_0x3bee('0x1a')])&&_0x2162ce[_0x3bee('0x3d')][_0x3bee('0x1a')]===_0x3bee('0x56')?_0x2162ce[_0x3bee('0x47')][_0x3bee('0x1a')]:!_[_0x3bee('0x1d')](_0x2162ce['first_name'])?_0x2162ce['first_name']+'\x20'+_0x2162ce[_0x3bee('0x49')]:_0x2162ce['last_name'],'id':_0x2162ce['id']};_0x1ee4f0[_0x3bee('0x57')]=intUtil[_0x3bee('0x58')](_0x4fb836[_0x3bee('0x59')],_0x1a13fd,'\x20');_0x1ee4f0['Description']=intUtil[_0x3bee('0x58')](_0x4fb836[_0x3bee('0x5a')],_0x1a13fd,'\x0a');if(_0x1f0f23[_0x3bee('0x42')]==='Contacts'){_0x1ee4f0[_0x3bee('0x5b')]={'name':!_['isNil'](_0x1f0f23[_0x3bee('0x5c')])?_0x1f0f23[_0x3bee('0x5c')]:!_[_0x3bee('0x1d')](_0x1f0f23['First_Name'])?_0x1f0f23[_0x3bee('0x5d')]+'\x20'+_0x1f0f23[_0x3bee('0x5e')]:_0x1f0f23[_0x3bee('0x5e')],'id':_0x1f0f23['id']};}if(_0x1f0f23['enduserType']==='Leads'){_0x1ee4f0[_0x3bee('0x5f')]={'name':!_[_0x3bee('0x1d')](_0x1f0f23[_0x3bee('0x5c')])?_0x1f0f23['Full_Name']:!_['isNil'](_0x1f0f23[_0x3bee('0x5d')])?_0x1f0f23['First_Name']+'\x20'+_0x1f0f23['Last_Name']:_0x1f0f23[_0x3bee('0x5e')],'id':_0x1f0f23['id']};_0x1ee4f0[_0x3bee('0x60')]=_[_0x3bee('0x45')](_0x1f0f23['enduserType']);}if(_0x1a13fd['talktime']){_0x1ee4f0[_0x3bee('0x61')]=moment[_0x3bee('0x62')](parseInt(_0x1a13fd['talktime'])*0x3e8)[_0x3bee('0x63')]('mm:ss');}else if(_0x1a13fd[_0x3bee('0x64')]&&_0x1a13fd[_0x3bee('0x65')]){_0x1ee4f0[_0x3bee('0x61')]=moment[_0x3bee('0x62')](moment(_0x1a13fd[_0x3bee('0x65')],_0x3bee('0x66'))[_0x3bee('0x67')](moment(_0x1a13fd[_0x3bee('0x68')],_0x3bee('0x66'))))[_0x3bee('0x63')](_0x3bee('0x69'));}switch(_0x1a13fd['lastevent']){case'called':_0x1ee4f0['Call_Result']=_0x3bee('0x6a');break;case _0x3bee('0x6b'):case _0x3bee('0x6c'):_0x1ee4f0[_0x3bee('0x6d')]='Answered';break;case _0x3bee('0x6e'):_0x1ee4f0[_0x3bee('0x6d')]='Rejected';break;case'abandoned':_0x1ee4f0[_0x3bee('0x6d')]=_0x3bee('0x6f');break;case _0x3bee('0x70'):_0x1ee4f0['Call_Result']=_0x3bee('0x71');default:}_0x1ee4f0[_0x3bee('0x72')]=(_0x3beac9===_0x3bee('0x73')?moment(_0x1a13fd['starttime'])[_0x3bee('0x63')](_0x3bee('0x66')):moment(_0x1a13fd[_0x3bee('0x74')])[_0x3bee('0x63')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x3bee('0x66'));_0x1ee4f0[_0x3bee('0x75')]=_0x3beac9||_0x3bee('0x76');_0x1ee4f0=_[_0x3bee('0x77')](_0x1ee4f0,getCustomFields(_0x4fb836[_0x3bee('0x78')],_0x1a13fd));return request({'method':'POST','uri':_0x3bee('0x43')+_0x5d4755+'/crm/v2/Calls','headers':{'Authorization':_0x3bee('0x34')+_0x3730c5},'body':{'data':[_0x1ee4f0]},'json':!![]})[_0x3bee('0x35')](function(_0x208f9c){if(_0x208f9c&&_0x208f9c[_0x3bee('0x41')][0x0][_0x3bee('0x4a')]===_0x3bee('0x79')){logger[_0x3bee('0x30')]('Call\x20created!');return{'id':_0x208f9c[_0x3bee('0x41')][0x0][_0x3bee('0x4b')]['id']};}})[_0x3bee('0x2c')](function(_0x3a6f56){logger['info'](_0x3bee('0x7a'),_0x3a6f56[_0x3bee('0x2f')]);console[_0x3bee('0x7b')](_0x3bee('0x7a'),_0x3a6f56);});}exports[_0x3bee('0x7c')]=function(_0x2d71fa,_0x1bf2ec,_0x16c374,_0x519efb,_0x1594f4,_0x110575){var _0x339aef,_0x49f2af,_0x2c7926;_0x110575[_0x3bee('0x7d')]=intUtil[_0x3bee('0x7e')](_0x110575[_0x3bee('0x7d')]);_0x110575[_0x3bee('0x7f')]=intUtil[_0x3bee('0x7e')](_0x110575[_0x3bee('0x7f')]);if(_0x1594f4&&_0x1594f4[_0x3bee('0x80')]){logger[_0x3bee('0x30')](_0x3bee('0x81'),_0x3bee('0x82'));_0x1bf2ec[_0x3bee('0x83')]=_0x110575[_0x3bee('0x7f')]+_0x3bee('0x84')+_0x1bf2ec[_0x3bee('0x85')]+_0x3bee('0x86')+md5(_0x1bf2ec[_0x3bee('0x85')]);}else{_0x1bf2ec[_0x3bee('0x83')]='';}var _0x38e1be=_0x110575[_0x3bee('0x7d')]===_0x3bee('0x87')?'eu':_0x3bee('0x88');return getAccessToken(_0x110575)[_0x3bee('0x35')](function(_0x44c0c3){_0x2c7926=_0x44c0c3;return getUser(_0x2c7926,_0x38e1be,_0x110575,_0x519efb[_0x3bee('0x39')]);})['then'](function(_0x35f0fb){_0x339aef=_0x35f0fb;logger[_0x3bee('0x30')](_0x3bee('0x89'),_0x339aef['id']);return getEndUser(_0x2c7926,_0x38e1be,_0x110575,_0x1bf2ec[_0x3bee('0x8a')],_0x1bf2ec[_0x3bee('0x8b')],_0x339aef,_0x16c374);})[_0x3bee('0x35')](function(_0x2d6a3d){_0x49f2af=_0x2d6a3d;return getCall(_0x2c7926,_0x38e1be,_0x110575,_0x339aef,_0x49f2af,_0x16c374,_0x1bf2ec,_0x3bee('0x76'));})[_0x3bee('0x35')](function(_0x4e5bf6){if(_0x4e5bf6){logger[_0x3bee('0x30')](_0x3bee('0x8c'),_0x4e5bf6['id']);logger['info'](_0x3bee('0x81'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3bee('0x63')](_0x3bee('0x8d'),_0x519efb[_0x3bee('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x110575[_0x3bee('0x7d')]+_0x3bee('0x8e')+_0x4e5bf6['id']});}})[_0x3bee('0x2c')](function(_0x31b300){logger[_0x3bee('0x2d')](_0x3bee('0x81'),JSON[_0x3bee('0xd')](_0x31b300));});};exports[_0x3bee('0x73')]=function(_0x5e6f16,_0x137e02,_0x1cfadb,_0x22d336,_0x470ea8,_0x2ce4c2,_0x3ce515){var _0x1945f0,_0x4ae02b,_0x35cad2;_0x2ce4c2[_0x3bee('0x7d')]=intUtil['stripTrailingSlash'](_0x2ce4c2[_0x3bee('0x7d')]);_0x2ce4c2[_0x3bee('0x7f')]=intUtil['stripTrailingSlash'](_0x2ce4c2[_0x3bee('0x7f')]);if(_0x3ce515&&_0x3ce515['recordingFormat']&&_0x3ce515[_0x3bee('0x8f')]!==_0x3bee('0x90')){logger[_0x3bee('0x30')](_0x3bee('0x91'),'Recording\x20is\x20enabled!');_0x137e02[_0x3bee('0x83')]=_0x2ce4c2[_0x3bee('0x7f')]+_0x3bee('0x84')+_0x137e02['uniqueid']+_0x3bee('0x86')+md5(_0x137e02[_0x3bee('0x85')]);}var _0x52ad3d=_0x2ce4c2[_0x3bee('0x7d')]===_0x3bee('0x87')?'eu':'com';return getAccessToken(_0x2ce4c2)[_0x3bee('0x35')](function(_0x49f875){_0x35cad2=_0x49f875;return getUser(_0x35cad2,_0x52ad3d,_0x2ce4c2,_0x22d336[_0x3bee('0x39')]);})[_0x3bee('0x35')](function(_0x1e8d22){_0x1945f0=_0x1e8d22;logger['info'](_0x3bee('0x89'),_0x1945f0['id']);return getEndUser(_0x35cad2,_0x52ad3d,_0x2ce4c2,_0x137e02[_0x3bee('0x92')],_0x137e02[_0x3bee('0x93')],_0x1945f0,_0x1cfadb);})['then'](function(_0x49859c){_0x4ae02b=_0x49859c;return getCall(_0x35cad2,_0x52ad3d,_0x2ce4c2,_0x1945f0,_0x4ae02b,_0x1cfadb,_0x137e02,_0x3bee('0x94'));})[_0x3bee('0x35')](function(_0x1e3abe){if(_0x1e3abe){logger[_0x3bee('0x30')](_0x3bee('0x8c'),_0x1e3abe['id']);logger['info'](_0x3bee('0x91'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3bee('0x63')](_0x3bee('0x8d'),_0x22d336[_0x3bee('0x1a')]),_0x3bee('0x95'),{'uri':_0x3bee('0x96')+_0x2ce4c2[_0x3bee('0x7d')]+_0x3bee('0x8e')+_0x1e3abe['id']});}})[_0x3bee('0x2c')](function(_0x252ef1){logger['error'](_0x3bee('0x91'),JSON['stringify'](_0x252ef1));});};exports['unmanaged']=function(_0x38144b,_0x58858b,_0x49e2f5,_0x2cfc87,_0x402bd4,_0x31f180){var _0x15bb8b,_0xd1898b,_0x2c3f03;_0x31f180[_0x3bee('0x7d')]=intUtil['stripTrailingSlash'](_0x31f180['host']);_0x31f180['serverUrl']=intUtil['stripTrailingSlash'](_0x31f180[_0x3bee('0x7f')]);if(_0x402bd4&&_0x402bd4['monitor_format']){logger[_0x3bee('0x30')]('['+_0x58858b[_0x3bee('0x97')]['toUpperCase']()+']',_0x3bee('0x82'));_0x58858b['recordingURL']=_0x31f180[_0x3bee('0x7f')]+_0x3bee('0x84')+_0x58858b[_0x3bee('0x85')]+_0x3bee('0x86')+md5(_0x58858b[_0x3bee('0x85')]);}else{_0x58858b[_0x3bee('0x83')]='';}var _0x38f6e1=_0x31f180[_0x3bee('0x7d')]===_0x3bee('0x87')?'eu':_0x3bee('0x88');return getAccessToken(_0x31f180)[_0x3bee('0x35')](function(_0x191539){_0x2c3f03=_0x191539;return getUser(_0x2c3f03,_0x38f6e1,_0x31f180);})[_0x3bee('0x35')](function(_0x212189){_0x15bb8b=_0x212189;logger[_0x3bee('0x30')](_0x3bee('0x89'),_0x15bb8b['id']);return getEndUser(_0x2c3f03,_0x38f6e1,_0x31f180,_0x58858b[_0x3bee('0x8a')],_0x58858b['calleridnum'],_0x15bb8b,_0x49e2f5);})[_0x3bee('0x35')](function(_0xd48363){_0xd1898b=_0xd48363;return getCall(_0x2c3f03,_0x38f6e1,_0x31f180,_0x15bb8b,_0xd1898b,_0x49e2f5,_0x58858b,_0x3bee('0x76'));})[_0x3bee('0x35')](function(_0x58c913){if(_0x58c913){logger[_0x3bee('0x30')](_0x3bee('0x8c'),_0x58c913['id']);}})['catch'](function(_0x55abb9){logger[_0x3bee('0x2d')]('['+_0x58858b[_0x3bee('0x97')][_0x3bee('0x98')]()+']',JSON[_0x3bee('0xd')](_0x55abb9));});}; \ 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 05624f7..44d4702 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 _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x3ac303,_0x5c97d5){var _0x703fcd=function(_0x4fb46a){while(--_0x4fb46a){_0x3ac303['push'](_0x3ac303['shift']());}};_0x703fcd(++_0x5c97d5);}(_0x7a54,0x106));var _0x47a5=function(_0x5e52f1,_0xcbeab){_0x5e52f1=_0x5e52f1-0x0;var _0x4d8354=_0x7a54[_0x5e52f1];return _0x4d8354;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x1e1568,_0x1ed401){var _0x5b3769=function(_0x3995ff){while(--_0x3995ff){_0x1e1568['push'](_0x1e1568['shift']());}};_0x5b3769(++_0x1ed401);}(_0x7a54,0x106));var _0x47a5=function(_0x2d2630,_0x3cbc30){_0x2d2630=_0x2d2630-0x0;var _0xe328e6=_0x7a54[_0x2d2630];return _0xe328e6;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ 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 03e1979..97e6e36 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 _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x5efae1,_0xe66cd9){var _0x4efa41=function(_0x225677){while(--_0x225677){_0x5efae1['push'](_0x5efae1['shift']());}};_0x4efa41(++_0xe66cd9);}(_0x7a54,0x106));var _0x47a5=function(_0x27f2f1,_0x24a314){_0x27f2f1=_0x27f2f1-0x0;var _0x2fb44b=_0x7a54[_0x27f2f1];return _0x2fb44b;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x2bf404,_0x59df45){var _0x3475dd=function(_0xe83ebe){while(--_0xe83ebe){_0x2bf404['push'](_0x2bf404['shift']());}};_0x3475dd(++_0x59df45);}(_0x5f2f,0x73));var _0xf5f2=function(_0x54a56c,_0x1efaba){_0x54a56c=_0x54a56c-0x0;var _0x1bbacd=_0x5f2f[_0x54a56c];return _0x1bbacd;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 3ae598f..51577aa 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 _0x2208=['http','Request','then','debug','rpc','error','message','result','catch','exports','bluebird','routing'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2208,0x11e));var _0x8220=function(_0xe2c7d7,_0x5ef289){_0xe2c7d7=_0xe2c7d7-0x0;var _0x1d37ad=_0x2208[_0xe2c7d7];return _0x1d37ad;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x8220('0x0'));var logger=require('../../config/logger')(_0x8220('0x1'));var client=jayson['client'][_0x8220('0x2')]({'port':0x2329});client[_0x8220('0x3')]=function(_0x3d2530,_0x231a4b){return new BPromise(function(_0x464d1c,_0x32703d){return client['request'](_0x3d2530,_0x231a4b)[_0x8220('0x4')](function(_0x4dd1a0){logger[_0x8220('0x5')](_0x8220('0x6'),_0x8220('0x1'),_0x3d2530,_0x231a4b,_0x4dd1a0);if(_0x4dd1a0[_0x8220('0x7')]){logger[_0x8220('0x7')](_0x8220('0x6'),'routing',_0x3d2530,_0x4dd1a0[_0x8220('0x7')][_0x8220('0x8')],_0x231a4b);return _0x32703d(_0x4dd1a0['error'][_0x8220('0x8')]);}else{return _0x464d1c(_0x4dd1a0[_0x8220('0x9')]);}})[_0x8220('0xa')](function(_0x282223){logger[_0x8220('0x7')]('rpc','routing',_0x3d2530,_0x282223,_0x231a4b);return _0x32703d(_0x282223);});});};module[_0x8220('0xb')]=client; \ No newline at end of file +var _0xdad2=['Request','request','then','debug','error','rpc','routing','message','catch','exports','bluebird','../../config/logger','client','http'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdad2,0x14c));var _0x2dad=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xdad2[_0x40a045];return _0x1a687c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x2dad('0x0'));var logger=require(_0x2dad('0x1'))('routing');var client=jayson[_0x2dad('0x2')][_0x2dad('0x3')]({'port':0x2329});client[_0x2dad('0x4')]=function(_0x58acfe,_0x3212a5){return new BPromise(function(_0x1437b9,_0x5d4a94){return client[_0x2dad('0x5')](_0x58acfe,_0x3212a5)[_0x2dad('0x6')](function(_0x27ca04){logger[_0x2dad('0x7')]('rpc','routing',_0x58acfe,_0x3212a5,_0x27ca04);if(_0x27ca04[_0x2dad('0x8')]){logger[_0x2dad('0x8')](_0x2dad('0x9'),_0x2dad('0xa'),_0x58acfe,_0x27ca04[_0x2dad('0x8')][_0x2dad('0xb')],_0x3212a5);return _0x5d4a94(_0x27ca04['error'][_0x2dad('0xb')]);}else{return _0x1437b9(_0x27ca04['result']);}})[_0x2dad('0xc')](function(_0x242ea3){logger['error'](_0x2dad('0x9'),_0x2dad('0xa'),_0x58acfe,_0x242ea3,_0x3212a5);return _0x5d4a94(_0x242ea3);});});};module[_0x2dad('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 259c579..53d4804 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 _0x1211=['log','bluebird','./server','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts','refresh','listen','loginMailFrequency'];(function(_0x4f34d8,_0x40f022){var _0xc97536=function(_0xef9dfc){while(--_0xef9dfc){_0x4f34d8['push'](_0x4f34d8['shift']());}};_0xc97536(++_0x40f022);}(_0x1211,0x1ed));var _0x1121=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1211[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x1121('0x0'));var server=require(_0x1121('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x1121('0x2'));var mailAccount=require(_0x1121('0x3'));var setting=require(_0x1121('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x1121('0x5')]()[_0x1121('0x6')](mailAccount[_0x1121('0x7')]())[_0x1121('0x6')](realtime['initMailAccounts']())['then'](function(){email[_0x1121('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x1121('0x9')](realtime,email)[_0x1121('0x6')](function(){return initRealtime();})[_0x1121('0x6')](function(){return setting['getSettings']();})['then'](function(_0x44afca){return setInterval(initRealtime,_0x44afca[_0x1121('0xa')]*0x3e8);})['catch'](function(_0x25f5fc){console[_0x1121('0xb')](_0x25f5fc);});}main(); \ No newline at end of file +var _0x9e7c=['./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts','refresh','mailAccounts','loginMailFrequency','log','bluebird','./realtime','./lib/email'];(function(_0x4fcd21,_0x3b4148){var _0x3af7b8=function(_0x4a0f72){while(--_0x4a0f72){_0x4fcd21['push'](_0x4fcd21['shift']());}};_0x3af7b8(++_0x3b4148);}(_0x9e7c,0x1d1));var _0xc9e7=function(_0x457e96,_0x37da08){_0x457e96=_0x457e96-0x0;var _0xd5a190=_0x9e7c[_0x457e96];return _0xd5a190;};'use strict';var BPromise=require(_0xc9e7('0x0'));var server=require('./server');var Realtime=require(_0xc9e7('0x1'));var EmailChannel=require(_0xc9e7('0x2'));var mailAccount=require(_0xc9e7('0x3'));var setting=require(_0xc9e7('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xc9e7('0x5')]()[_0xc9e7('0x6')](mailAccount[_0xc9e7('0x7')]())[_0xc9e7('0x6')](realtime['initMailAccounts']())[_0xc9e7('0x6')](function(){email[_0xc9e7('0x8')](realtime[_0xc9e7('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xc9e7('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})['then'](function(_0x2f43b0){return setInterval(initRealtime,_0x2f43b0[_0xc9e7('0xa')]*0x3e8);})['catch'](function(_0x4fa34d){console[_0xc9e7('0xb')](_0x4fa34d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 4d7dc44..010666a 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 _0xf7d4=['verifySmtp','Smtp','then','verified','verify','exports','moment','bluebird','md5','../../../config/logger','email','defaults','redis','localhost','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','prototype','key','active','Imap','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','emit','connected','name','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','notify','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','smtp','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf7d4,0xa5));var _0x4f7d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf7d4[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var moment=require(_0x4f7d('0x0'));var BPromise=require(_0x4f7d('0x1'));var md5=require(_0x4f7d('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x4f7d('0x3'))(_0x4f7d('0x4'));config['redis']=_[_0x4f7d('0x5')](config[_0x4f7d('0x6')],{'host':_0x4f7d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f7d('0x6')]));var EmailImap=require(_0x4f7d('0x8'));var EmailSmtp=require(_0x4f7d('0x9'));var mailAccount=require(_0x4f7d('0xa'));var md5Accounts={};function EmailChannel(_0x24affe){logger[_0x4f7d('0xb')]('start\x20email\x20channel');this[_0x4f7d('0xc')]=_0x24affe['mailAccounts'];this[_0x4f7d('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x4f7d('0xe')]['emit']=function(_0x5547ec){var _0x34b663=this[_0x4f7d('0xc')][_0x5547ec];var _0x372516={'id':_0x34b663['id'],'name':_0x34b663['name'],'key':_0x34b663[_0x4f7d('0xf')],'active':_0x34b663[_0x4f7d('0x10')],'Imap':{'status':_0x34b663[_0x4f7d('0x11')]['status'],'messageStatus':_0x34b663[_0x4f7d('0x11')][_0x4f7d('0x12')],'total':_0x34b663[_0x4f7d('0x11')]['total']}};if(_[_0x4f7d('0x13')](md5Accounts[_0x5547ec])){md5Accounts[_0x5547ec]={};}var _0x596728=md5(JSON[_0x4f7d('0x14')](_0x372516));if(md5Accounts[_0x5547ec][_0x4f7d('0x2')]!==_0x596728){md5Accounts[_0x5547ec][_0x4f7d('0x2')]=_0x596728;io['emit'](_0x4f7d('0x15'),_0x372516);}};EmailChannel['prototype'][_0x4f7d('0x16')]=function(_0x48daa8){for(var _0x47c32c in _0x48daa8){if(_0x48daa8[_0x4f7d('0x17')](_0x47c32c)){if(_0x48daa8[_0x47c32c][_0x4f7d('0x11')]&&_0x48daa8[_0x47c32c]['active']){var _0x277eb8=_0x48daa8[_0x47c32c][_0x4f7d('0x11')];if(!this[_0x4f7d('0xd')][_0x4f7d('0x17')](_0x277eb8['id'])){this[_0x4f7d('0xd')][_0x277eb8['id']]=new EmailImap(_0x277eb8,_0x48daa8[_0x47c32c]['email']);this['imapAccounts'][_0x277eb8['id']]['on']('box',this[_0x4f7d('0x18')][_0x4f7d('0x19')](this,_0x47c32c));this['imapAccounts'][_0x277eb8['id']]['on'](_0x4f7d('0x4'),this[_0x4f7d('0x1a')][_0x4f7d('0x19')](this,_0x47c32c));this[_0x4f7d('0xd')][_0x277eb8['id']]['on'](_0x4f7d('0x1b'),this[_0x4f7d('0x1c')][_0x4f7d('0x19')](this,_0x47c32c));this[_0x4f7d('0xd')][_0x277eb8['id']]['on'](_0x4f7d('0x1d'),this[_0x4f7d('0x1e')]['bind'](this,_0x47c32c));}}else{if(_['isNil'](this[_0x4f7d('0xc')][_0x47c32c][_0x4f7d('0x11')])){this[_0x4f7d('0xc')][_0x47c32c][_0x4f7d('0x11')]={};}this['mailAccounts'][_0x47c32c][_0x4f7d('0x11')][_0x4f7d('0x1f')]=_0x4f7d('0x20');this[_0x4f7d('0xc')][_0x47c32c][_0x4f7d('0x11')][_0x4f7d('0x12')]='';this[_0x4f7d('0x21')](_0x47c32c);}}}};EmailChannel[_0x4f7d('0xe')][_0x4f7d('0x18')]=function(_0x209b32,_0x2c98fe){if(this[_0x4f7d('0xc')][_0x209b32]){this[_0x4f7d('0xc')][_0x209b32][_0x4f7d('0x11')][_0x4f7d('0x1f')]=_0x4f7d('0x22');this[_0x4f7d('0xc')][_0x209b32][_0x4f7d('0x11')][_0x4f7d('0x12')]=_0x2c98fe[_0x4f7d('0x23')];if(_0x2c98fe[_0x4f7d('0x24')]){this[_0x4f7d('0xc')][_0x209b32][_0x4f7d('0x11')][_0x4f7d('0x25')]=_0x2c98fe[_0x4f7d('0x24')][_0x4f7d('0x25')];}return this[_0x4f7d('0x21')](_0x209b32);}};EmailChannel[_0x4f7d('0xe')][_0x4f7d('0x1a')]=function(_0x21319f,_0x1e005b){logger[_0x4f7d('0xb')](_0x4f7d('0x26'),_0x1e005b[_0x4f7d('0x27')],_0x1e005b['lastName'],_0x1e005b['from'],_0x21319f);if(this[_0x4f7d('0xc')][_0x21319f]){return mailAccount[_0x4f7d('0x28')](_0x21319f,_0x1e005b)['then'](function(_0x1c3f82){if(_0x1c3f82){logger['info'](_0x4f7d('0x29'));}})[_0x4f7d('0x2a')](function(_0x342a54){logger[_0x4f7d('0x1d')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x342a54));});}};EmailChannel[_0x4f7d('0xe')][_0x4f7d('0x1c')]=function(_0x472d16){if(this[_0x4f7d('0xc')][_0x472d16]&&this[_0x4f7d('0xc')][_0x472d16][_0x4f7d('0x11')]){if(this[_0x4f7d('0xd')][this[_0x4f7d('0xc')][_0x472d16][_0x4f7d('0x11')]['id']]){delete this[_0x4f7d('0xd')][this['mailAccounts'][_0x472d16][_0x4f7d('0x11')]['id']];}this[_0x4f7d('0xc')][_0x472d16][_0x4f7d('0x11')][_0x4f7d('0x2b')]=moment();this[_0x4f7d('0x21')](_0x472d16);}};EmailChannel['prototype']['handleImapError']=function(_0x13c82c,_0x57399f){if(this[_0x4f7d('0xc')][_0x13c82c]){this[_0x4f7d('0xc')][_0x13c82c][_0x4f7d('0x11')][_0x4f7d('0x1f')]=_0x4f7d('0x1d');this[_0x4f7d('0xc')][_0x13c82c][_0x4f7d('0x11')][_0x4f7d('0x12')]=_0x57399f;return this[_0x4f7d('0x21')](_0x13c82c);}};EmailChannel['prototype'][_0x4f7d('0x2c')]=function(_0x403b40,_0x4aa497){return this[_0x4f7d('0x2d')][_0x4f7d('0x2e')](_0x403b40,_0x4aa497);};EmailChannel[_0x4f7d('0xe')][_0x4f7d('0x2f')]=function(_0x2a4457){var _0x33785c=this;if(this[_0x4f7d('0xc')][_0x2a4457['id']]){if(_['isNil'](this['mailAccounts'][_0x2a4457['id']]['Smtp'])){this['mailAccounts'][_0x2a4457['id']][_0x4f7d('0x30')]={};}this[_0x4f7d('0xc')][_0x2a4457['id']][_0x4f7d('0x30')][_0x4f7d('0x2b')]=moment();return new BPromise(function(_0x300325,_0x29328e){return _0x33785c[_0x4f7d('0x2d')]['verify'](_0x2a4457)[_0x4f7d('0x31')](function(_0x3fe2fa){_0x33785c[_0x4f7d('0xc')][_0x2a4457['id']][_0x4f7d('0x30')][_0x4f7d('0x1f')]=_0x4f7d('0x32');_0x33785c['mailAccounts'][_0x2a4457['id']]['Smtp'][_0x4f7d('0x12')]='';_0x33785c[_0x4f7d('0x21')](_0x2a4457['id']);_0x300325(_0x3fe2fa);})[_0x4f7d('0x2a')](function(_0x1c465e){_0x33785c[_0x4f7d('0xc')][_0x2a4457['id']][_0x4f7d('0x30')][_0x4f7d('0x1f')]='error';_0x33785c[_0x4f7d('0xc')][_0x2a4457['id']][_0x4f7d('0x30')][_0x4f7d('0x12')]=_0x1c465e;_0x33785c[_0x4f7d('0x21')](_0x2a4457['id']);_0x29328e(_0x1c465e);});});}return this[_0x4f7d('0x2d')][_0x4f7d('0x33')](_0x2a4457);};module[_0x4f7d('0x34')]=EmailChannel; \ No newline at end of file +var _0xda2f=['socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','status','messageStatus','Imap','total','isNil','stringify','refresh','hasOwnProperty','box','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults'];(function(_0x213de2,_0x3c28fe){var _0x1e4985=function(_0x1c624c){while(--_0x1c624c){_0x213de2['push'](_0x213de2['shift']());}};_0x1e4985(++_0x3c28fe);}(_0xda2f,0x66));var _0xfda2=function(_0x55f8c4,_0x1bf921){_0x55f8c4=_0x55f8c4-0x0;var _0x48fb8e=_0xda2f[_0x55f8c4];return _0x48fb8e;};'use strict';var _=require(_0xfda2('0x0'));var moment=require('moment');var BPromise=require(_0xfda2('0x1'));var md5=require(_0xfda2('0x2'));var Redis=require(_0xfda2('0x3'));var config=require(_0xfda2('0x4'));var logger=require('../../../config/logger')(_0xfda2('0x5'));config[_0xfda2('0x6')]=_[_0xfda2('0x7')](config[_0xfda2('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xfda2('0x8'))(new Redis(config[_0xfda2('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xfda2('0x9'));var mailAccount=require(_0xfda2('0xa'));var md5Accounts={};function EmailChannel(_0x269714){logger[_0xfda2('0xb')](_0xfda2('0xc'));this[_0xfda2('0xd')]=_0x269714[_0xfda2('0xd')];this[_0xfda2('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xfda2('0xf')][_0xfda2('0x10')]=function(_0x15d897){var _0x588fa6=this['mailAccounts'][_0x15d897];var _0x117dec={'id':_0x588fa6['id'],'name':_0x588fa6[_0xfda2('0x11')],'key':_0x588fa6[_0xfda2('0x12')],'active':_0x588fa6[_0xfda2('0x13')],'Imap':{'status':_0x588fa6['Imap'][_0xfda2('0x14')],'messageStatus':_0x588fa6['Imap'][_0xfda2('0x15')],'total':_0x588fa6[_0xfda2('0x16')][_0xfda2('0x17')]}};if(_[_0xfda2('0x18')](md5Accounts[_0x15d897])){md5Accounts[_0x15d897]={};}var _0x1a6d2e=md5(JSON[_0xfda2('0x19')](_0x117dec));if(md5Accounts[_0x15d897][_0xfda2('0x2')]!==_0x1a6d2e){md5Accounts[_0x15d897][_0xfda2('0x2')]=_0x1a6d2e;io[_0xfda2('0x10')]('mailAccount:update',_0x117dec);}};EmailChannel['prototype'][_0xfda2('0x1a')]=function(_0x1a1db0){for(var _0x23d7ed in _0x1a1db0){if(_0x1a1db0[_0xfda2('0x1b')](_0x23d7ed)){if(_0x1a1db0[_0x23d7ed][_0xfda2('0x16')]&&_0x1a1db0[_0x23d7ed][_0xfda2('0x13')]){var _0x4af101=_0x1a1db0[_0x23d7ed][_0xfda2('0x16')];if(!this[_0xfda2('0xe')]['hasOwnProperty'](_0x4af101['id'])){this['imapAccounts'][_0x4af101['id']]=new EmailImap(_0x4af101,_0x1a1db0[_0x23d7ed][_0xfda2('0x5')]);this['imapAccounts'][_0x4af101['id']]['on'](_0xfda2('0x1c'),this['handleImapBox']['bind'](this,_0x23d7ed));this[_0xfda2('0xe')][_0x4af101['id']]['on'](_0xfda2('0x5'),this[_0xfda2('0x1d')][_0xfda2('0x1e')](this,_0x23d7ed));this[_0xfda2('0xe')][_0x4af101['id']]['on'](_0xfda2('0x1f'),this[_0xfda2('0x20')][_0xfda2('0x1e')](this,_0x23d7ed));this[_0xfda2('0xe')][_0x4af101['id']]['on'](_0xfda2('0x21'),this[_0xfda2('0x22')][_0xfda2('0x1e')](this,_0x23d7ed));}}else{if(_[_0xfda2('0x18')](this['mailAccounts'][_0x23d7ed][_0xfda2('0x16')])){this[_0xfda2('0xd')][_0x23d7ed][_0xfda2('0x16')]={};}this['mailAccounts'][_0x23d7ed][_0xfda2('0x16')]['status']='disabled';this[_0xfda2('0xd')][_0x23d7ed][_0xfda2('0x16')]['messageStatus']='';this['emit'](_0x23d7ed);}}}};EmailChannel[_0xfda2('0xf')][_0xfda2('0x23')]=function(_0x57be25,_0x29f23f){if(this[_0xfda2('0xd')][_0x57be25]){this['mailAccounts'][_0x57be25]['Imap'][_0xfda2('0x14')]=_0xfda2('0x24');this[_0xfda2('0xd')][_0x57be25][_0xfda2('0x16')]['messageStatus']=_0x29f23f[_0xfda2('0x11')];if(_0x29f23f[_0xfda2('0x25')]){this[_0xfda2('0xd')][_0x57be25][_0xfda2('0x16')]['total']=_0x29f23f[_0xfda2('0x25')]['total'];}return this['emit'](_0x57be25);}};EmailChannel['prototype'][_0xfda2('0x1d')]=function(_0x27ef75,_0x49c8ca){logger[_0xfda2('0xb')](_0xfda2('0x26'),_0x49c8ca[_0xfda2('0x27')],_0x49c8ca[_0xfda2('0x28')],_0x49c8ca[_0xfda2('0x29')],_0x27ef75);if(this['mailAccounts'][_0x27ef75]){return mailAccount[_0xfda2('0x2a')](_0x27ef75,_0x49c8ca)[_0xfda2('0x2b')](function(_0x1adf1a){if(_0x1adf1a){logger['info']('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x3698b2){logger['error'](_0xfda2('0x2c'),JSON[_0xfda2('0x19')](_0x3698b2));});}};EmailChannel[_0xfda2('0xf')][_0xfda2('0x20')]=function(_0xff718b){if(this[_0xfda2('0xd')][_0xff718b]&&this[_0xfda2('0xd')][_0xff718b]['Imap']){if(this['imapAccounts'][this[_0xfda2('0xd')][_0xff718b][_0xfda2('0x16')]['id']]){delete this['imapAccounts'][this[_0xfda2('0xd')][_0xff718b][_0xfda2('0x16')]['id']];}this[_0xfda2('0xd')][_0xff718b]['Imap'][_0xfda2('0x2d')]=moment();this[_0xfda2('0x10')](_0xff718b);}};EmailChannel[_0xfda2('0xf')]['handleImapError']=function(_0x5697af,_0x4563dc){if(this[_0xfda2('0xd')][_0x5697af]){this['mailAccounts'][_0x5697af][_0xfda2('0x16')][_0xfda2('0x14')]=_0xfda2('0x21');this[_0xfda2('0xd')][_0x5697af][_0xfda2('0x16')][_0xfda2('0x15')]=_0x4563dc;return this[_0xfda2('0x10')](_0x5697af);}};EmailChannel[_0xfda2('0xf')][_0xfda2('0x2e')]=function(_0x4d9546,_0x99ee76){return this[_0xfda2('0x2f')][_0xfda2('0x30')](_0x4d9546,_0x99ee76);};EmailChannel[_0xfda2('0xf')][_0xfda2('0x31')]=function(_0x45bd55){var _0x29330e=this;if(this[_0xfda2('0xd')][_0x45bd55['id']]){if(_[_0xfda2('0x18')](this[_0xfda2('0xd')][_0x45bd55['id']][_0xfda2('0x32')])){this[_0xfda2('0xd')][_0x45bd55['id']][_0xfda2('0x32')]={};}this[_0xfda2('0xd')][_0x45bd55['id']][_0xfda2('0x32')]['lastSync']=moment();return new BPromise(function(_0x3bda24,_0x3c44f8){return _0x29330e[_0xfda2('0x2f')][_0xfda2('0x33')](_0x45bd55)['then'](function(_0x1e7184){_0x29330e[_0xfda2('0xd')][_0x45bd55['id']][_0xfda2('0x32')][_0xfda2('0x14')]=_0xfda2('0x34');_0x29330e['mailAccounts'][_0x45bd55['id']][_0xfda2('0x32')][_0xfda2('0x15')]='';_0x29330e[_0xfda2('0x10')](_0x45bd55['id']);_0x3bda24(_0x1e7184);})[_0xfda2('0x35')](function(_0x53269a){_0x29330e[_0xfda2('0xd')][_0x45bd55['id']][_0xfda2('0x32')]['status']=_0xfda2('0x21');_0x29330e['mailAccounts'][_0x45bd55['id']][_0xfda2('0x32')][_0xfda2('0x15')]=_0x53269a;_0x29330e[_0xfda2('0x10')](_0x45bd55['id']);_0x3c44f8(_0x53269a);});});}return this[_0xfda2('0x2f')][_0xfda2('0x33')](_0x45bd55);};module[_0xfda2('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 41f972b..93c061c 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 _0xc7ce=['authTimeout','isNil','user','password','host','port','tls','autotls','required','service','email','anonymous@xcally.com','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','path','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','./utils','getAccount','account','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout'];(function(_0x2eef8c,_0x15a03d){var _0x1bec99=function(_0x193a31){while(--_0x193a31){_0x2eef8c['push'](_0x2eef8c['shift']());}};_0x1bec99(++_0x15a03d);}(_0xc7ce,0x18e));var _0xec7c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc7ce[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var path=require(_0xec7c('0x0'));var util=require('util');var Imap=require(_0xec7c('0x1'));var _=require(_0xec7c('0x2'));var rs=require(_0xec7c('0x3'));var simpleParser=require(_0xec7c('0x4'))[_0xec7c('0x5')];var Iconv=require(_0xec7c('0x6'))[_0xec7c('0x7')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0xec7c('0x8'));var logger=require('../../../config/logger')('email');function EmailImap(_0x2ea731,_0x4d6931){this['mailbox']='INBOX';this['account']=this[_0xec7c('0x9')](_0x2ea731,_0x4d6931);this[_0xec7c('0x1')]=new Imap(this[_0xec7c('0xa')]);this['imap'][_0xec7c('0xb')](_0xec7c('0xc'),this[_0xec7c('0xd')][_0xec7c('0xe')](this));this[_0xec7c('0x1')][_0xec7c('0xb')](_0xec7c('0xf'),this[_0xec7c('0x10')][_0xec7c('0xe')](this));this['imap']['on'](_0xec7c('0x11'),this['handleError'][_0xec7c('0xe')](this));this[_0xec7c('0x1')][_0xec7c('0x12')]();}util[_0xec7c('0x13')](EmailImap,EventEmitter);EmailImap[_0xec7c('0x14')]['getAccount']=function(_0x4ed5b9,_0x43ccc5){var _0x1b386a={'connTimeout':_0x4ed5b9[_0xec7c('0x15')]?_0x4ed5b9[_0xec7c('0x15')]*0x3e8:0x2710,'authTimeout':_0x4ed5b9[_0xec7c('0x16')]?_0x4ed5b9[_0xec7c('0x16')]*0x3e8:0x1388};if(_[_0xec7c('0x17')](_0x4ed5b9['service'])){if(_0x4ed5b9['authentication']){_0x1b386a[_0xec7c('0x18')]=_0x4ed5b9[_0xec7c('0x18')];_0x1b386a[_0xec7c('0x19')]=_0x4ed5b9['password'];}_0x1b386a['host']=_0x4ed5b9[_0xec7c('0x1a')];_0x1b386a['port']=_0x4ed5b9[_0xec7c('0x1b')]||0x3e1;if(_0x4ed5b9[_0xec7c('0x1c')]){_0x1b386a[_0xec7c('0x1c')]=!![];}else{_0x1b386a[_0xec7c('0x1c')]=![];_0x1b386a[_0xec7c('0x1d')]=_0xec7c('0x1e');}}else{_0x1b386a[_0xec7c('0x18')]=_0x4ed5b9[_0xec7c('0x18')];_0x1b386a[_0xec7c('0x19')]=_0x4ed5b9[_0xec7c('0x19')];_0x1b386a[_0xec7c('0x1a')]=utils['getHost'](_0x4ed5b9[_0xec7c('0x1f')]);_0x1b386a[_0xec7c('0x1b')]=0x3e1;_0x1b386a[_0xec7c('0x1c')]=!![];}_0x1b386a[_0xec7c('0x20')]=_0x43ccc5||_0x4ed5b9[_0xec7c('0x18')]||_0xec7c('0x21');return _0x1b386a;};EmailImap[_0xec7c('0x14')][_0xec7c('0xd')]=function(){this[_0xec7c('0x1')][_0xec7c('0x22')](this['mailbox'],![],this[_0xec7c('0x23')][_0xec7c('0xe')](this));};EmailImap[_0xec7c('0x14')]['handleOpenBox']=function(_0x12f71f,_0x3415ac){if(_0x12f71f){this[_0xec7c('0x24')](_0x12f71f,!![]);}else{this[_0xec7c('0x25')](_0xec7c('0x26'),_0x3415ac);this[_0xec7c('0x27')]();}};EmailImap[_0xec7c('0x14')][_0xec7c('0x28')]=function(_0x2af480){if(_0x2af480){this[_0xec7c('0x24')](_0x2af480,!![]);}else{this['imap'][_0xec7c('0xf')]();}};EmailImap[_0xec7c('0x14')][_0xec7c('0x27')]=function(){this[_0xec7c('0x1')][_0xec7c('0x29')]([_0xec7c('0x2a')],this[_0xec7c('0x2b')][_0xec7c('0xe')](this));};EmailImap[_0xec7c('0x14')][_0xec7c('0x2b')]=function(_0x20be8b,_0x2bdccb){if(_0x20be8b){this['handleError'](_0x20be8b,!![]);}else{if(_0x2bdccb[_0xec7c('0x2c')]){try{var _0x3ae55f=this[_0xec7c('0x1')][_0xec7c('0x2d')](_0x2bdccb,{'bodies':'','markSeen':!![]});_0x3ae55f['on']('message',this[_0xec7c('0x2e')][_0xec7c('0xe')](this));_0x3ae55f['once'](_0xec7c('0x11'),this[_0xec7c('0x2f')][_0xec7c('0xe')](this));_0x3ae55f[_0xec7c('0xb')](_0xec7c('0xf'),this[_0xec7c('0x30')]['bind'](this));}catch(_0x3f7038){logger[_0xec7c('0x11')](_0x3f7038);}}else{this['imap'][_0xec7c('0x31')](!![],this[_0xec7c('0x28')]['bind'](this));}}};EmailImap['prototype'][_0xec7c('0x2e')]=function(_0x54b8a6,_0x5fa45f){_0x54b8a6['on'](_0xec7c('0x32'),this[_0xec7c('0x33')]['bind'](this));_0x54b8a6[_0xec7c('0xb')]('attributes',this[_0xec7c('0x34')][_0xec7c('0xe')](this));_0x54b8a6[_0xec7c('0xb')](_0xec7c('0xf'),this[_0xec7c('0x35')][_0xec7c('0xe')](this));};EmailImap['prototype'][_0xec7c('0x33')]=function(_0x5186b7,_0x523866){simpleParser(_0x5186b7,{'Iconv':Iconv},this[_0xec7c('0x36')][_0xec7c('0xe')](this));};EmailImap[_0xec7c('0x14')][_0xec7c('0x34')]=function(_0x2c3862){};EmailImap[_0xec7c('0x14')][_0xec7c('0x35')]=function(){};EmailImap['prototype'][_0xec7c('0x36')]=function(_0x454054,_0x89aad3){if(_0x454054){logger[_0xec7c('0x11')](_0x454054);}else{var _0x49ff8c=this;utils[_0xec7c('0x37')](this[_0xec7c('0xa')],_0x89aad3,function(_0x5e0e3e){_0x49ff8c['emit'](_0xec7c('0x20'),_0x5e0e3e);});}};EmailImap[_0xec7c('0x14')]['handleFetchEnd']=function(){this['imap'][_0xec7c('0x31')](!![],this['handleCloseBox'][_0xec7c('0xe')](this));};EmailImap[_0xec7c('0x14')][_0xec7c('0x2f')]=function(_0x3a65f2){this[_0xec7c('0x24')](_0x3a65f2);this[_0xec7c('0x1')][_0xec7c('0x31')](!![],this[_0xec7c('0x28')][_0xec7c('0xe')](this));};EmailImap['prototype'][_0xec7c('0x10')]=function(){this[_0xec7c('0x25')](_0xec7c('0xf'));};EmailImap['prototype'][_0xec7c('0x24')]=function(_0xe61d5c,_0x493295){logger['error']('handleError',this[_0xec7c('0xa')]['email'],JSON[_0xec7c('0x38')](_0xe61d5c));var _0x10ecf9='';if(_0xe61d5c){if(_0xe61d5c[_0xec7c('0x39')]){_0x10ecf9=_0xe61d5c['textCode'];}else{for(var _0x1daf35 in _0xe61d5c){if(_0xe61d5c[_0xec7c('0x3a')](_0x1daf35)){_0x10ecf9+=_[_0xec7c('0x3b')](_0x1daf35)+':\x20'+_0xe61d5c[_0x1daf35]+'\x0a';}}}}if(_0x493295){this[_0xec7c('0x1')]['end']();}else{this[_0xec7c('0x25')](_0xec7c('0x11'),_0x10ecf9);this['emit'](_0xec7c('0xf'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x03b7=['stringify','textCode','hasOwnProperty','upperFirst','exports','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','readUnseen','search','handleReadUnseen','length','message','handleFetchMessage','error','closeBox','handleCloseBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','handleEnd'];(function(_0x20a13f,_0x1bdbee){var _0x24b5d7=function(_0x1549f){while(--_0x1549f){_0x20a13f['push'](_0x20a13f['shift']());}};_0x24b5d7(++_0x1bdbee);}(_0x03b7,0x85));var _0x703b=function(_0x27c38d,_0x1f55bf){_0x27c38d=_0x27c38d-0x0;var _0x4f4bbe=_0x03b7[_0x27c38d];return _0x4f4bbe;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0x703b('0x0'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0x703b('0x1'))[_0x703b('0x2')];var Iconv=require(_0x703b('0x3'))[_0x703b('0x4')];var EventEmitter=require(_0x703b('0x5'))[_0x703b('0x6')];var utils=require(_0x703b('0x7'));var logger=require(_0x703b('0x8'))(_0x703b('0x9'));function EmailImap(_0x1b8b6f,_0x1e80cd){this[_0x703b('0xa')]=_0x703b('0xb');this[_0x703b('0xc')]=this[_0x703b('0xd')](_0x1b8b6f,_0x1e80cd);this[_0x703b('0x0')]=new Imap(this[_0x703b('0xc')]);this[_0x703b('0x0')][_0x703b('0xe')](_0x703b('0xf'),this[_0x703b('0x10')][_0x703b('0x11')](this));this[_0x703b('0x0')][_0x703b('0xe')](_0x703b('0x12'),this['handleEnd'][_0x703b('0x11')](this));this[_0x703b('0x0')]['on']('error',this[_0x703b('0x13')][_0x703b('0x11')](this));this[_0x703b('0x0')][_0x703b('0x14')]();}util[_0x703b('0x15')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x20d4bc,_0x3d6ca3){var _0x511474={'connTimeout':_0x20d4bc['connTimeout']?_0x20d4bc[_0x703b('0x16')]*0x3e8:0x2710,'authTimeout':_0x20d4bc[_0x703b('0x17')]?_0x20d4bc[_0x703b('0x17')]*0x3e8:0x1388};if(_[_0x703b('0x18')](_0x20d4bc[_0x703b('0x19')])){if(_0x20d4bc[_0x703b('0x1a')]){_0x511474[_0x703b('0x1b')]=_0x20d4bc[_0x703b('0x1b')];_0x511474['password']=_0x20d4bc[_0x703b('0x1c')];}_0x511474['host']=_0x20d4bc[_0x703b('0x1d')];_0x511474[_0x703b('0x1e')]=_0x20d4bc['port']||0x3e1;if(_0x20d4bc['tls']){_0x511474['tls']=!![];}else{_0x511474[_0x703b('0x1f')]=![];_0x511474[_0x703b('0x20')]=_0x703b('0x21');}}else{_0x511474[_0x703b('0x1b')]=_0x20d4bc[_0x703b('0x1b')];_0x511474[_0x703b('0x1c')]=_0x20d4bc['password'];_0x511474[_0x703b('0x1d')]=utils[_0x703b('0x22')](_0x20d4bc['service']);_0x511474['port']=0x3e1;_0x511474[_0x703b('0x1f')]=!![];}_0x511474[_0x703b('0x9')]=_0x3d6ca3||_0x20d4bc['user']||_0x703b('0x23');return _0x511474;};EmailImap[_0x703b('0x24')][_0x703b('0x10')]=function(){this['imap'][_0x703b('0x25')](this['mailbox'],![],this['handleOpenBox'][_0x703b('0x11')](this));};EmailImap[_0x703b('0x24')][_0x703b('0x26')]=function(_0x2f4849,_0x67ae23){if(_0x2f4849){this[_0x703b('0x13')](_0x2f4849,!![]);}else{this[_0x703b('0x27')](_0x703b('0x28'),_0x67ae23);this[_0x703b('0x29')]();}};EmailImap[_0x703b('0x24')]['handleCloseBox']=function(_0x4774ec){if(_0x4774ec){this['handleError'](_0x4774ec,!![]);}else{this[_0x703b('0x0')][_0x703b('0x12')]();}};EmailImap[_0x703b('0x24')]['readUnseen']=function(){this[_0x703b('0x0')][_0x703b('0x2a')](['UNSEEN'],this[_0x703b('0x2b')][_0x703b('0x11')](this));};EmailImap[_0x703b('0x24')][_0x703b('0x2b')]=function(_0x770432,_0x49ab87){if(_0x770432){this['handleError'](_0x770432,!![]);}else{if(_0x49ab87[_0x703b('0x2c')]){try{var _0x2c52c8=this[_0x703b('0x0')]['fetch'](_0x49ab87,{'bodies':'','markSeen':!![]});_0x2c52c8['on'](_0x703b('0x2d'),this[_0x703b('0x2e')][_0x703b('0x11')](this));_0x2c52c8[_0x703b('0xe')](_0x703b('0x2f'),this['handleFetchError'][_0x703b('0x11')](this));_0x2c52c8[_0x703b('0xe')](_0x703b('0x12'),this['handleFetchEnd'][_0x703b('0x11')](this));}catch(_0x35f4a1){logger[_0x703b('0x2f')](_0x35f4a1);}}else{this[_0x703b('0x0')][_0x703b('0x30')](!![],this[_0x703b('0x31')][_0x703b('0x11')](this));}}};EmailImap['prototype'][_0x703b('0x2e')]=function(_0x240a70,_0x154860){_0x240a70['on'](_0x703b('0x32'),this[_0x703b('0x33')]['bind'](this));_0x240a70[_0x703b('0xe')]('attributes',this[_0x703b('0x34')]['bind'](this));_0x240a70['once'](_0x703b('0x12'),this[_0x703b('0x35')][_0x703b('0x11')](this));};EmailImap[_0x703b('0x24')][_0x703b('0x33')]=function(_0x3d7af7,_0x12420b){simpleParser(_0x3d7af7,{'Iconv':Iconv},this[_0x703b('0x36')][_0x703b('0x11')](this));};EmailImap[_0x703b('0x24')]['handleMessageAttributes']=function(_0x288cd){};EmailImap[_0x703b('0x24')][_0x703b('0x35')]=function(){};EmailImap['prototype'][_0x703b('0x36')]=function(_0x2e4a2d,_0x455c5e){if(_0x2e4a2d){logger[_0x703b('0x2f')](_0x2e4a2d);}else{var _0x33953a=this;utils[_0x703b('0x37')](this['account'],_0x455c5e,function(_0x4804fd){_0x33953a['emit'](_0x703b('0x9'),_0x4804fd);});}};EmailImap[_0x703b('0x24')][_0x703b('0x38')]=function(){this[_0x703b('0x0')][_0x703b('0x30')](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype'][_0x703b('0x39')]=function(_0x3d12f1){this[_0x703b('0x13')](_0x3d12f1);this['imap'][_0x703b('0x30')](!![],this['handleCloseBox'][_0x703b('0x11')](this));};EmailImap[_0x703b('0x24')][_0x703b('0x3a')]=function(){this[_0x703b('0x27')](_0x703b('0x12'));};EmailImap[_0x703b('0x24')][_0x703b('0x13')]=function(_0x5845a5,_0x2f1bfc){logger['error'](_0x703b('0x13'),this[_0x703b('0xc')]['email'],JSON[_0x703b('0x3b')](_0x5845a5));var _0x5b97af='';if(_0x5845a5){if(_0x5845a5[_0x703b('0x3c')]){_0x5b97af=_0x5845a5[_0x703b('0x3c')];}else{for(var _0x2210d9 in _0x5845a5){if(_0x5845a5[_0x703b('0x3d')](_0x2210d9)){_0x5b97af+=_[_0x703b('0x3e')](_0x2210d9)+':\x20'+_0x5845a5[_0x2210d9]+'\x0a';}}}}if(_0x2f1bfc){this[_0x703b('0x0')][_0x703b('0x12')]();}else{this[_0x703b('0x27')](_0x703b('0x2f'),_0x5b97af);this[_0x703b('0x27')](_0x703b('0x12'));}};module[_0x703b('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 421fc7b..4ca264f 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 _0x4e3c=['compile','toString','verify','bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','use'];(function(_0x5fa432,_0x2bed66){var _0x57cd5a=function(_0x12adfc){while(--_0x12adfc){_0x5fa432['push'](_0x5fa432['shift']());}};_0x57cd5a(++_0x2bed66);}(_0x4e3c,0xb3));var _0xc4e3=function(_0x33ab57,_0x449de8){_0x33ab57=_0x33ab57-0x0;var _0x3af8ce=_0x4e3c[_0x33ab57];return _0x3af8ce;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xc4e3('0x0'));var inlineBase64=require(_0xc4e3('0x1'));function EmailSmtp(){}EmailSmtp[_0xc4e3('0x2')]['send']=function(_0x27d900,_0x152df3){return new BPromise(function(_0x380a61,_0x20f042){var _0x57c6d3=nodemailer[_0xc4e3('0x3')](_0x27d900);_0x57c6d3[_0xc4e3('0x4')](_0xc4e3('0x5'),inlineBase64());_0x57c6d3['sendMail'](_0x152df3,function(_0x187675,_0x1629da){if(_0x187675){_0x20f042(_0x187675[_0xc4e3('0x6')]());}else{_0x380a61(_0x1629da);}});});};EmailSmtp[_0xc4e3('0x2')][_0xc4e3('0x7')]=function(_0x20719f){return new BPromise(function(_0x2a6544,_0x153e15){var _0x12a48d=nodemailer[_0xc4e3('0x3')](_0x20719f);_0x12a48d['verify'](function(_0x34c8fa,_0x43f615){if(_0x34c8fa){_0x153e15(_0x34c8fa[_0xc4e3('0x6')]());}else{if(_0x43f615){_0x2a6544(_0x43f615);}else{_0x153e15('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x9c7b=['nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','toString','verify','exports','nodemailer','bluebird'];(function(_0x4d3f7b,_0x4d0a95){var _0x137115=function(_0x5b05a0){while(--_0x5b05a0){_0x4d3f7b['push'](_0x4d3f7b['shift']());}};_0x137115(++_0x4d0a95);}(_0x9c7b,0xda));var _0xb9c7=function(_0x904517,_0x42677c){_0x904517=_0x904517-0x0;var _0x89c92d=_0x9c7b[_0x904517];return _0x89c92d;};'use strict';var nodemailer=require(_0xb9c7('0x0'));var BPromise=require(_0xb9c7('0x1'));var inlineBase64=require(_0xb9c7('0x2'));function EmailSmtp(){}EmailSmtp[_0xb9c7('0x3')][_0xb9c7('0x4')]=function(_0x1de9c6,_0x49bc13){return new BPromise(function(_0x2d8bf3,_0x48f49e){var _0x4f34b1=nodemailer[_0xb9c7('0x5')](_0x1de9c6);_0x4f34b1['use'](_0xb9c7('0x6'),inlineBase64());_0x4f34b1[_0xb9c7('0x7')](_0x49bc13,function(_0x455e56,_0x148c3c){if(_0x455e56){_0x48f49e(_0x455e56[_0xb9c7('0x8')]());}else{_0x2d8bf3(_0x148c3c);}});});};EmailSmtp[_0xb9c7('0x3')][_0xb9c7('0x9')]=function(_0x305638){return new BPromise(function(_0xde3ae0,_0x308a96){var _0x9037d3=nodemailer[_0xb9c7('0x5')](_0x305638);_0x9037d3[_0xb9c7('0x9')](function(_0xcfc4db,_0x505f30){if(_0xcfc4db){_0x308a96(_0xcfc4db[_0xb9c7('0x8')]());}else{if(_0x505f30){_0xde3ae0(_0x505f30);}else{_0x308a96('Not\x20verifired');}}});});};module[_0xb9c7('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e3fcc9d..3ae7662 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 _0xcc00=['lodash','moment','path','util','node-tnef','email','../../../config/environment','address','generate','head','value','slice','join','name','Anonymous','split','length','isEmpty','anonymous','@xcally.com','html','test','includes','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com'];(function(_0x47c241,_0x303b4b){var _0x2bf94f=function(_0x267285){while(--_0x267285){_0x47c241['push'](_0x47c241['shift']());}};_0x2bf94f(++_0x303b4b);}(_0xcc00,0x159));var _0x0cc0=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0xcc00[_0x1597e2];return _0x4c8c0a;};'use strict';var _=require(_0x0cc0('0x0'));var moment=require(_0x0cc0('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x0cc0('0x2'));var util=require(_0x0cc0('0x3'));var tnef=require(_0x0cc0('0x4'));var logger=require('../../../config/logger')(_0x0cc0('0x5'));var config=require(_0x0cc0('0x6'));function getAddress(_0x7d07b5){var _0x354b9b=_['head'](_0x7d07b5['value']);return _0x354b9b&&_0x354b9b[_0x0cc0('0x7')]?_0x354b9b[_0x0cc0('0x7')]:'anonymous'+random[_0x0cc0('0x8')](0x6)+'@xcally.com';}function getFirstName(_0x351c35){var _0x263aa0=_[_0x0cc0('0x9')](_0x351c35[_0x0cc0('0xa')]);if(_0x263aa0&&_0x263aa0['name']){var _0x10f9a4=_0x263aa0['name']['split'](/\s+/);return _0x10f9a4['length']?_0x10f9a4[_0x0cc0('0xb')](0x0,-0x1)[_0x0cc0('0xc')]('\x20'):_0x263aa0[_0x0cc0('0xd')];}return _0x0cc0('0xe');}function getLastName(_0x238fa5){var _0x5614d8=_[_0x0cc0('0x9')](_0x238fa5[_0x0cc0('0xa')]);if(_0x5614d8&&_0x5614d8['name']){var _0x1dc96=_0x5614d8['name'][_0x0cc0('0xf')](/\s+/);return _0x1dc96[_0x0cc0('0x10')]>0x1?_0x1dc96['pop']():'';}return'';}function getMails(_0x401cda,_0x53b7ab){var _0xaa974a='';for(var _0x1fc2aa=0x0;_0x1fc2aa<_0x53b7ab[_0x0cc0('0xa')][_0x0cc0('0x10')];_0x1fc2aa+=0x1){if(_0x53b7ab[_0x0cc0('0xa')][_0x1fc2aa]['address']!==_0x401cda){if(!_[_0x0cc0('0x11')](_0xaa974a)){_0xaa974a+=',';}_0xaa974a+=_0x53b7ab[_0x0cc0('0xa')][_0x1fc2aa][_0x0cc0('0xd')]||_0x53b7ab['value'][_0x1fc2aa][_0x0cc0('0x7')]||'';_0xaa974a+='\x20<';_0xaa974a+=_0x53b7ab['value'][_0x1fc2aa][_0x0cc0('0x7')]?_0x53b7ab['value'][_0x1fc2aa][_0x0cc0('0x7')]:_0x0cc0('0x12')+random[_0x0cc0('0x8')](0x6)+_0x0cc0('0x13');_0xaa974a+='>';}}return _0xaa974a;}function parseEmail(_0x5eb92b,_0x33d285,_0x59460c){if(_0x33d285[_0x0cc0('0x14')]){var _0x52d938=/)<[^<]*)*<\/script>/gi;while(_0x52d938[_0x0cc0('0x15')](_0x33d285['html'])){_0x33d285[_0x0cc0('0x14')]=_0x33d285[_0x0cc0('0x14')]['replace'](_0x52d938,'');}if(_0x33d285[_0x0cc0('0x14')][_0x0cc0('0x16')](_0x0cc0('0x17'))){var _0x4215f1=[];_0x33d285[_0x0cc0('0x18')][_0x0cc0('0x19')](_0x15fa4f=>{_0x4215f1[_0x0cc0('0x1a')](_0x15fa4f[_0x0cc0('0x1b')]);});var _0x4dfc1a=/]+>/g;var _0x7e0b74=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x3d3133=_0x33d285[_0x0cc0('0x14')][_0x0cc0('0x1c')](_0x7e0b74,'_SRC');var _0x271747=_0x3d3133[_0x0cc0('0x1c')](_0x4dfc1a,_0x0cc0('0x1d'));for(let _0x5bfab4=0x0;_0x5bfab4<_0x4215f1['length'];_0x5bfab4++){var _0x2eabfd=_0x271747[_0x0cc0('0x1c')](_0x0cc0('0x1d'),'\x20[Attachment:\x20'+_0x4215f1[_0x5bfab4]+'\x20]');_0x271747=_0x2eabfd;}_0x33d285[_0x0cc0('0x14')]=_0x271747;}_0x59460c[_0x0cc0('0x1e')]=_0x33d285[_0x0cc0('0x14')];}else{_0x59460c[_0x0cc0('0x1e')]=_0x33d285[_0x0cc0('0x1f')];}if(_0x59460c[_0x0cc0('0x1e')]){_0x59460c[_0x0cc0('0x1e')]=_0x59460c[_0x0cc0('0x1e')]['replace'](/\x20[Attachment:\x20','body','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','@xcally.com','value','name','length','slice'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xb31c,0x108));var _0xcb31=function(_0x357121,_0x35b5a7){_0x357121=_0x357121-0x0;var _0x3dc3d4=_0xb31c[_0x357121];return _0x3dc3d4;};'use strict';var _=require(_0xcb31('0x0'));var moment=require(_0xcb31('0x1'));var random=require(_0xcb31('0x2'));var fs=require('fs');var path=require(_0xcb31('0x3'));var util=require(_0xcb31('0x4'));var tnef=require(_0xcb31('0x5'));var logger=require(_0xcb31('0x6'))(_0xcb31('0x7'));var config=require(_0xcb31('0x8'));function getAddress(_0x1a3ab8){var _0xc4f648=_[_0xcb31('0x9')](_0x1a3ab8['value']);return _0xc4f648&&_0xc4f648[_0xcb31('0xa')]?_0xc4f648[_0xcb31('0xa')]:'anonymous'+random['generate'](0x6)+_0xcb31('0xb');}function getFirstName(_0x404f5f){var _0x24ac8f=_['head'](_0x404f5f[_0xcb31('0xc')]);if(_0x24ac8f&&_0x24ac8f[_0xcb31('0xd')]){var _0x651e21=_0x24ac8f[_0xcb31('0xd')]['split'](/\s+/);return _0x651e21[_0xcb31('0xe')]?_0x651e21[_0xcb31('0xf')](0x0,-0x1)[_0xcb31('0x10')]('\x20'):_0x24ac8f[_0xcb31('0xd')];}return _0xcb31('0x11');}function getLastName(_0xfc86a1){var _0x1b2628=_[_0xcb31('0x9')](_0xfc86a1[_0xcb31('0xc')]);if(_0x1b2628&&_0x1b2628[_0xcb31('0xd')]){var _0x15d11c=_0x1b2628[_0xcb31('0xd')][_0xcb31('0x12')](/\s+/);return _0x15d11c[_0xcb31('0xe')]>0x1?_0x15d11c[_0xcb31('0x13')]():'';}return'';}function getMails(_0x221478,_0x48613f){var _0x51030e='';for(var _0x536f64=0x0;_0x536f64<_0x48613f['value']['length'];_0x536f64+=0x1){if(_0x48613f[_0xcb31('0xc')][_0x536f64]['address']!==_0x221478){if(!_[_0xcb31('0x14')](_0x51030e)){_0x51030e+=',';}_0x51030e+=_0x48613f['value'][_0x536f64][_0xcb31('0xd')]||_0x48613f[_0xcb31('0xc')][_0x536f64]['address']||'';_0x51030e+='\x20<';_0x51030e+=_0x48613f[_0xcb31('0xc')][_0x536f64][_0xcb31('0xa')]?_0x48613f[_0xcb31('0xc')][_0x536f64][_0xcb31('0xa')]:_0xcb31('0x15')+random[_0xcb31('0x16')](0x6)+_0xcb31('0xb');_0x51030e+='>';}}return _0x51030e;}function parseEmail(_0x1b50a9,_0x1c1bac,_0x7cb8db){if(_0x1c1bac[_0xcb31('0x17')]){var _0x5d8194=/)<[^<]*)*<\/script>/gi;while(_0x5d8194[_0xcb31('0x18')](_0x1c1bac[_0xcb31('0x17')])){_0x1c1bac[_0xcb31('0x17')]=_0x1c1bac[_0xcb31('0x17')]['replace'](_0x5d8194,'');}if(_0x1c1bac[_0xcb31('0x17')][_0xcb31('0x19')](_0xcb31('0x1a'))){var _0x4a3278=[];_0x1c1bac[_0xcb31('0x1b')][_0xcb31('0x1c')](_0x405af7=>{_0x4a3278[_0xcb31('0x1d')](_0x405af7[_0xcb31('0x1e')]);});var _0x352102=/]+>/g;var _0xc134e=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x43134e=_0x1c1bac[_0xcb31('0x17')][_0xcb31('0x1f')](_0xc134e,'_SRC');var _0x5182ab=_0x43134e['replace'](_0x352102,_0xcb31('0x20'));for(let _0x2fb49b=0x0;_0x2fb49b<_0x4a3278[_0xcb31('0xe')];_0x2fb49b++){var _0x12bac1=_0x5182ab[_0xcb31('0x1f')](_0xcb31('0x20'),_0xcb31('0x21')+_0x4a3278[_0x2fb49b]+'\x20]');_0x5182ab=_0x12bac1;}_0x1c1bac[_0xcb31('0x17')]=_0x5182ab;}_0x7cb8db[_0xcb31('0x22')]=_0x1c1bac[_0xcb31('0x17')];}else{_0x7cb8db['body']=_0x1c1bac['textAsHtml'];}if(_0x7cb8db[_0xcb31('0x22')]){_0x7cb8db[_0xcb31('0x22')]=_0x7cb8db[_0xcb31('0x22')][_0xcb31('0x1f')](/0x0){if(this[_0x5356f7+_0xdc06('0x2a')]>0x0&&this[_0x5356f7+_0xdc06('0x29')]>=this[_0x5356f7+_0xdc06('0x2a')]){return _0xdc06('0x2b');}else{return _0xdc06('0x2c');}}else{return _0xdc06('0x2d');}};Agent['prototype']['updateRealtime']=function(){var _0x57e3d1=[_0xdc06('0x2e'),_0xdc06('0x2f'),_0xdc06('0x30'),_0xdc06('0x31'),_0xdc06('0x32'),_0xdc06('0x33')];for(var _0x312604=0x0;_0x312604<_0x57e3d1['length'];_0x312604+=0x1){var _0x254333=this['getChannelStatus'](_0x57e3d1[_0x312604]);if(this[_0x57e3d1[_0x312604]+_0xdc06('0x34')]!==_0x254333){this[_0x57e3d1[_0x312604]+_0xdc06('0x35')]=_[_0xdc06('0x36')](moment()[_0xdc06('0x37')]('x'));}this[_0x57e3d1[_0x312604]+_0xdc06('0x34')]=_0x254333;}var _0x15c6e6={'id':this['id'],'name':this[_0xdc06('0x7')],'online':this[_0xdc06('0x8')],'voicePause':this[_0xdc06('0x9')],'chatPause':this[_0xdc06('0xa')],'mailPause':this[_0xdc06('0xb')],'smsPause':this[_0xdc06('0xd')],'faxPause':this[_0xdc06('0xc')],'openchannelPause':this[_0xdc06('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xdc06('0x11')],'chatCapacity':this[_0xdc06('0x12')],'chatCurrentCapacity':this[_0xdc06('0x38')],'mailStatus':this[_0xdc06('0x39')],'mailStatusTime':this[_0xdc06('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xdc06('0x15')],'faxStatus':this[_0xdc06('0x16')],'faxStatusTime':this[_0xdc06('0x17')],'faxCapacity':this[_0xdc06('0x18')],'faxCurrentCapacity':this[_0xdc06('0x19')],'smsStatus':this[_0xdc06('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xdc06('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xdc06('0x3a')],'whatsappStatusTime':this[_0xdc06('0x1e')],'whatsappCapacity':this[_0xdc06('0x1f')],'whatsappCurrentCapacity':this[_0xdc06('0x20')],'openchannelStatus':this[_0xdc06('0x21')],'openchannelStatusTime':this[_0xdc06('0x22')],'openchannelCapacity':this[_0xdc06('0x23')],'openchannelCurrentCapacity':this[_0xdc06('0x24')],'busy':this[_0xdc06('0x3b')],'busyQueue':this[_0xdc06('0x25')]};var _0x57f829=md5(JSON['stringify'](_0x15c6e6));if(this[_0xdc06('0x2')]!==_0x57f829){this[_0xdc06('0x2')]=_0x57f829;io[_0xdc06('0x3c')]('user:save',_0x15c6e6);}};module['exports']=Agent; \ No newline at end of file +var _0xa149=['chatCurrentCapacity','unknown','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelCapacity','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','Status','StatusTime','chatStatus','mailStatus','mailStatusTime','mailCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','busy','busyQueue','stringify','emit','user:save','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity'];(function(_0x2d06f4,_0x443c72){var _0x3ada58=function(_0x436f6c){while(--_0x436f6c){_0x2d06f4['push'](_0x2d06f4['shift']());}};_0x3ada58(++_0x443c72);}(_0xa149,0x18c));var _0x9a14=function(_0x4abf64,_0xc27982){_0x4abf64=_0x4abf64-0x0;var _0x143a68=_0xa149[_0x4abf64];return _0x143a68;};'use strict';var _=require(_0x9a14('0x0'));var moment=require(_0x9a14('0x1'));var md5=require(_0x9a14('0x2'));var Redis=require(_0x9a14('0x3'));var config=require(_0x9a14('0x4'));config[_0x9a14('0x5')]=_[_0x9a14('0x6')](config[_0x9a14('0x5')],{'host':_0x9a14('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9a14('0x5')]));function Agent(_0x183b77){this['id']=_0x183b77['id']||0x0;this['name']=_0x183b77[_0x9a14('0x8')]||'';this[_0x9a14('0x9')]=_0x183b77[_0x9a14('0x9')]||!![];this[_0x9a14('0xa')]=_0x183b77[_0x9a14('0xa')]||![];this[_0x9a14('0xb')]=_0x183b77['chatPause']||![];this[_0x9a14('0xc')]=_0x183b77['mailPause']||![];this[_0x9a14('0xd')]=_0x183b77[_0x9a14('0xd')]||![];this[_0x9a14('0xe')]=_0x183b77[_0x9a14('0xe')]||![];this[_0x9a14('0xf')]=_0x183b77[_0x9a14('0xf')]||![];this['chatStatus']='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x183b77[_0x9a14('0x10')]||0x0;this[_0x9a14('0x11')]=0x0;this['mailStatus']=_0x9a14('0x12');this['mailStatusTime']=0x0;this[_0x9a14('0x13')]=_0x183b77['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x9a14('0x14')]=_0x9a14('0x12');this[_0x9a14('0x15')]=0x0;this[_0x9a14('0x16')]=_0x183b77['faxCapacity']||0x0;this[_0x9a14('0x17')]=0x0;this[_0x9a14('0x18')]=_0x9a14('0x12');this[_0x9a14('0x19')]=0x0;this[_0x9a14('0x1a')]=_0x183b77[_0x9a14('0x1a')]||0x0;this[_0x9a14('0x1b')]=0x0;this[_0x9a14('0x1c')]=_0x9a14('0x12');this[_0x9a14('0x1d')]=0x0;this[_0x9a14('0x1e')]=_0x183b77['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x9a14('0x12');this['openchannelStatusTime']=0x0;this[_0x9a14('0x1f')]=_0x183b77[_0x9a14('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this['busyQueue']=undefined;this['md5']='';this[_0x9a14('0x20')]();}Agent[_0x9a14('0x21')][_0x9a14('0x22')]=function(_0x3c3289){if(this[_0x3c3289+_0x9a14('0x23')]>0x0){if(this[_0x3c3289+_0x9a14('0x24')]>0x0&&this[_0x3c3289+_0x9a14('0x23')]>=this[_0x3c3289+'Capacity']){return'maxcapacity';}else{return _0x9a14('0x25');}}else{return _0x9a14('0x26');}};Agent[_0x9a14('0x21')]['updateRealtime']=function(){var _0x3be9da=[_0x9a14('0x27'),_0x9a14('0x28'),_0x9a14('0x29'),_0x9a14('0x2a'),_0x9a14('0x2b'),_0x9a14('0x2c')];for(var _0x1545c7=0x0;_0x1545c7<_0x3be9da['length'];_0x1545c7+=0x1){var _0x48c0d1=this[_0x9a14('0x22')](_0x3be9da[_0x1545c7]);if(this[_0x3be9da[_0x1545c7]+_0x9a14('0x2d')]!==_0x48c0d1){this[_0x3be9da[_0x1545c7]+_0x9a14('0x2e')]=_['toNumber'](moment()['format']('x'));}this[_0x3be9da[_0x1545c7]+_0x9a14('0x2d')]=_0x48c0d1;}var _0x3ee854={'id':this['id'],'name':this[_0x9a14('0x8')],'online':this[_0x9a14('0x9')],'voicePause':this[_0x9a14('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0x9a14('0xc')],'smsPause':this[_0x9a14('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0x9a14('0xf')],'chatStatus':this[_0x9a14('0x2f')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x9a14('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x9a14('0x30')],'mailStatusTime':this[_0x9a14('0x31')],'mailCapacity':this[_0x9a14('0x13')],'mailCurrentCapacity':this[_0x9a14('0x32')],'faxStatus':this[_0x9a14('0x14')],'faxStatusTime':this[_0x9a14('0x15')],'faxCapacity':this[_0x9a14('0x16')],'faxCurrentCapacity':this[_0x9a14('0x17')],'smsStatus':this[_0x9a14('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x9a14('0x1c')],'whatsappStatusTime':this[_0x9a14('0x1d')],'whatsappCapacity':this[_0x9a14('0x1e')],'whatsappCurrentCapacity':this[_0x9a14('0x33')],'openchannelStatus':this[_0x9a14('0x34')],'openchannelStatusTime':this[_0x9a14('0x35')],'openchannelCapacity':this[_0x9a14('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x9a14('0x36')],'busyQueue':this[_0x9a14('0x37')]};var _0x20d6f9=md5(JSON[_0x9a14('0x38')](_0x3ee854));if(this[_0x9a14('0x2')]!==_0x20d6f9){this['md5']=_0x20d6f9;io[_0x9a14('0x39')](_0x9a14('0x3a'),_0x3ee854);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index c5c6a2c..d622146 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 _0x4980=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','updateRouting','updateRealtime','_rr','Agents','prototype','paused','length','loggedIn','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports'];(function(_0x21bd12,_0x332b10){var _0x30f84b=function(_0x441793){while(--_0x441793){_0x21bd12['push'](_0x21bd12['shift']());}};_0x30f84b(++_0x332b10);}(_0x4980,0x9b));var _0x0498=function(_0x4aa7da,_0x2523cc){_0x4aa7da=_0x4aa7da-0x0;var _0x164a9c=_0x4980[_0x4aa7da];return _0x164a9c;};'use strict';var _=require(_0x0498('0x0'));var md5=require(_0x0498('0x1'));var util=require(_0x0498('0x2'));var Redis=require(_0x0498('0x3'));var config=require(_0x0498('0x4'));config[_0x0498('0x5')]=_[_0x0498('0x6')](config[_0x0498('0x5')],{'host':_0x0498('0x7'),'port':0x18eb});var io=require(_0x0498('0x8'))(new Redis(config[_0x0498('0x5')]));function ChatQueue(_0x45f456){this['id']=_0x45f456['id']||0x0;this[_0x0498('0x9')]=_0x45f456[_0x0498('0x9')]||'';this[_0x0498('0xa')]=_0x45f456['timeout']||0xa;this[_0x0498('0xb')]=_0x45f456['strategy']||_0x0498('0xc');this['Agents']=_0x45f456['Agents'];this[_0x0498('0xd')]={};this['waiting']=0x0;this[_0x0498('0x1')]='';this[_0x0498('0xe')]();this[_0x0498('0xf')]();}ChatQueue['prototype'][_0x0498('0xe')]=function(){var _0x3312c2=this[_0x0498('0xd')][_0x0498('0x10')];this['mapAgentsId']=_['map'](this[_0x0498('0x11')],'id');this[_0x0498('0xd')]['_rr']=_0x3312c2;};ChatQueue[_0x0498('0x12')][_0x0498('0xf')]=function(){this['loggedIn']=0x0;this[_0x0498('0x13')]=0x0;for(var _0x202aef=0x0;_0x202aef=0x0?this[_0x0498('0x17')]:0x0;var _0x26a290={'id':this['id'],'available':this[_0x0498('0x17')],'loggedIn':this[_0x0498('0x15')],'name':this[_0x0498('0x9')],'paused':this[_0x0498('0x13')],'waiting':this[_0x0498('0x18')]};var _0x4ed1b8=md5(JSON[_0x0498('0x19')](_0x26a290));if(this[_0x0498('0x1')]!==_0x4ed1b8){this['md5']=_0x4ed1b8;io['to'](util[_0x0498('0x1a')](_0x0498('0x1b'),_0x26a290[_0x0498('0x9')]))[_0x0498('0x1c')](_0x0498('0x1d'),_0x26a290);}};module[_0x0498('0x1e')]=ChatQueue; \ No newline at end of file +var _0x9332=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','chat:queue:%s','exports','md5','util','ioredis','../../../config/environment','redis','localhost','name'];(function(_0x3c7ba3,_0x3294c5){var _0x55ab57=function(_0x5bf419){while(--_0x5bf419){_0x3c7ba3['push'](_0x3c7ba3['shift']());}};_0x55ab57(++_0x3294c5);}(_0x9332,0x17f));var _0x2933=function(_0x264ff2,_0x47ae2f){_0x264ff2=_0x264ff2-0x0;var _0x3e23d6=_0x9332[_0x264ff2];return _0x3e23d6;};'use strict';var _=require('lodash');var md5=require(_0x2933('0x0'));var util=require(_0x2933('0x1'));var Redis=require(_0x2933('0x2'));var config=require(_0x2933('0x3'));config['redis']=_['defaults'](config[_0x2933('0x4')],{'host':_0x2933('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2933('0x4')]));function ChatQueue(_0x4c3dd5){this['id']=_0x4c3dd5['id']||0x0;this[_0x2933('0x6')]=_0x4c3dd5[_0x2933('0x6')]||'';this[_0x2933('0x7')]=_0x4c3dd5[_0x2933('0x7')]||0xa;this[_0x2933('0x8')]=_0x4c3dd5['strategy']||_0x2933('0x9');this[_0x2933('0xa')]=_0x4c3dd5[_0x2933('0xa')];this[_0x2933('0xb')]={};this[_0x2933('0xc')]=0x0;this[_0x2933('0x0')]='';this[_0x2933('0xd')]();this[_0x2933('0xe')]();}ChatQueue[_0x2933('0xf')][_0x2933('0xd')]=function(){var _0x34f12a=this[_0x2933('0xb')][_0x2933('0x10')];this[_0x2933('0xb')]=_[_0x2933('0x11')](this['Agents'],'id');this[_0x2933('0xb')][_0x2933('0x10')]=_0x34f12a;};ChatQueue[_0x2933('0xf')][_0x2933('0xe')]=function(){this[_0x2933('0x12')]=0x0;this[_0x2933('0x13')]=0x0;for(var _0x30fcf3=0x0;_0x30fcf3=0x0?this[_0x2933('0x17')]:0x0;var _0x281107={'id':this['id'],'available':this[_0x2933('0x17')],'loggedIn':this[_0x2933('0x12')],'name':this[_0x2933('0x6')],'paused':this[_0x2933('0x13')],'waiting':this[_0x2933('0xc')]};var _0x524f9c=md5(JSON['stringify'](_0x281107));if(this['md5']!==_0x524f9c){this[_0x2933('0x0')]=_0x524f9c;io['to'](util['format'](_0x2933('0x18'),_0x281107[_0x2933('0x6')]))['emit']('chat_queue:save',_0x281107);}};module[_0x2933('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 58fc056..1025139 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 _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x4d95ee,_0xf8e54e){var _0x23dda8=function(_0x4b6404){while(--_0x4b6404){_0x4d95ee['push'](_0x4d95ee['shift']());}};_0x23dda8(++_0xf8e54e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x1062f8,_0x5efa48){var _0x22cfc8=function(_0x46356d){while(--_0x46356d){_0x1062f8['push'](_0x1062f8['shift']());}};_0x22cfc8(++_0x5efa48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 95dfa09..7872294 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 _0xb65b=['exports','name','Intervals'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xb65b,0xf1));var _0xbb65=function(_0x4dadb9,_0x93d652){_0x4dadb9=_0x4dadb9-0x0;var _0x4005e5=_0xb65b[_0x4dadb9];return _0x4005e5;};'use strict';function Interval(_0x85384){this['id']=_0x85384['id']||0x0;this[_0xbb65('0x0')]=_0x85384['name']||'';this[_0xbb65('0x1')]=_0x85384[_0xbb65('0x1')]||{};}module[_0xbb65('0x2')]=Interval; \ No newline at end of file +var _0x3f23=['Intervals','exports','name'];(function(_0x33faf1,_0x1ac193){var _0x1f1875=function(_0x2286d){while(--_0x2286d){_0x33faf1['push'](_0x33faf1['shift']());}};_0x1f1875(++_0x1ac193);}(_0x3f23,0x17c));var _0x33f2=function(_0x2204bd,_0x2ed456){_0x2204bd=_0x2204bd-0x0;var _0x570868=_0x3f23[_0x2204bd];return _0x570868;};'use strict';function Interval(_0x625c88){this['id']=_0x625c88['id']||0x0;this['name']=_0x625c88[_0x33f2('0x0')]||'';this[_0x33f2('0x1')]=_0x625c88[_0x33f2('0x1')]||{};}module[_0x33f2('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 a240f5e..1ca99ff 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 _0x1403=['lodash','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','prototype','updateRouting','_rr','map','loggedIn','length','online','mailPause','paused','available','waiting','stringify','format','emit','exports'];(function(_0x500a55,_0x49f8f9){var _0x192ef7=function(_0x426d04){while(--_0x426d04){_0x500a55['push'](_0x500a55['shift']());}};_0x192ef7(++_0x49f8f9);}(_0x1403,0xcb));var _0x3140=function(_0x3650d7,_0x5f2518){_0x3650d7=_0x3650d7-0x0;var _0x1c05ae=_0x1403[_0x3650d7];return _0x1c05ae;};'use strict';var _=require(_0x3140('0x0'));var md5=require('md5');var util=require(_0x3140('0x1'));var Redis=require(_0x3140('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x3140('0x3')](config[_0x3140('0x4')],{'host':_0x3140('0x5'),'port':0x18eb});var io=require(_0x3140('0x6'))(new Redis(config['redis']));function MailQueue(_0x249714){this['id']=_0x249714['id']||0x0;this[_0x3140('0x7')]=_0x249714[_0x3140('0x7')]||'';this[_0x3140('0x8')]=_0x249714[_0x3140('0x8')]||0xa;this[_0x3140('0x9')]=_0x249714[_0x3140('0x9')]||_0x3140('0xa');this[_0x3140('0xb')]=_0x249714[_0x3140('0xb')];this[_0x3140('0xc')]={};this['waiting']=0x0;this[_0x3140('0xd')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x3140('0xe')][_0x3140('0xf')]=function(){var _0x542ca9=this['mapAgentsId'][_0x3140('0x10')];this['mapAgentsId']=_[_0x3140('0x11')](this[_0x3140('0xb')],'id');this['mapAgentsId'][_0x3140('0x10')]=_0x542ca9;};MailQueue[_0x3140('0xe')]['updateRealtime']=function(){this[_0x3140('0x12')]=0x0;this['paused']=0x0;for(var _0x1ae863=0x0;_0x1ae863=0x0?this[_0x3140('0x17')]:0x0;var _0x29781d={'id':this['id'],'available':this[_0x3140('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x3140('0x7')],'paused':this[_0x3140('0x16')],'waiting':this[_0x3140('0x18')]};var _0x49bb55=md5(JSON[_0x3140('0x19')](_0x29781d));if(this[_0x3140('0xd')]!==_0x49bb55){this['md5']=_0x49bb55;io['to'](util[_0x3140('0x1a')]('mail:queue:%s',_0x29781d['name']))[_0x3140('0x1b')]('mail_queue:save',_0x29781d);}};module[_0x3140('0x1c')]=MailQueue; \ No newline at end of file +var _0xdbd3=['paused','length','online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbd3,0xa0));var _0x3dbd=function(_0x29b564,_0x2d95bd){_0x29b564=_0x29b564-0x0;var _0xae0676=_0xdbd3[_0x29b564];return _0xae0676;};'use strict';var _=require(_0x3dbd('0x0'));var md5=require(_0x3dbd('0x1'));var util=require(_0x3dbd('0x2'));var Redis=require(_0x3dbd('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x3dbd('0x4')],{'host':_0x3dbd('0x5'),'port':0x18eb});var io=require(_0x3dbd('0x6'))(new Redis(config[_0x3dbd('0x4')]));function MailQueue(_0x1019e1){this['id']=_0x1019e1['id']||0x0;this[_0x3dbd('0x7')]=_0x1019e1[_0x3dbd('0x7')]||'';this['timeout']=_0x1019e1[_0x3dbd('0x8')]||0xa;this['strategy']=_0x1019e1[_0x3dbd('0x9')]||_0x3dbd('0xa');this['Agents']=_0x1019e1[_0x3dbd('0xb')];this[_0x3dbd('0xc')]={};this[_0x3dbd('0xd')]=0x0;this[_0x3dbd('0x1')]='';this[_0x3dbd('0xe')]();this[_0x3dbd('0xf')]();}MailQueue['prototype'][_0x3dbd('0xe')]=function(){var _0x5a7b7e=this[_0x3dbd('0xc')][_0x3dbd('0x10')];this[_0x3dbd('0xc')]=_[_0x3dbd('0x11')](this[_0x3dbd('0xb')],'id');this[_0x3dbd('0xc')]['_rr']=_0x5a7b7e;};MailQueue[_0x3dbd('0x12')][_0x3dbd('0xf')]=function(){this[_0x3dbd('0x13')]=0x0;this[_0x3dbd('0x14')]=0x0;for(var _0x198f37=0x0;_0x198f37=0x0?this[_0x3dbd('0x18')]:0x0;var _0x483f52={'id':this['id'],'available':this[_0x3dbd('0x18')],'loggedIn':this[_0x3dbd('0x13')],'name':this[_0x3dbd('0x7')],'paused':this[_0x3dbd('0x14')],'waiting':this[_0x3dbd('0xd')]};var _0x2b3a67=md5(JSON[_0x3dbd('0x19')](_0x483f52));if(this[_0x3dbd('0x1')]!==_0x2b3a67){this[_0x3dbd('0x1')]=_0x2b3a67;io['to'](util['format'](_0x3dbd('0x1a'),_0x483f52[_0x3dbd('0x7')]))[_0x3dbd('0x1b')](_0x3dbd('0x1c'),_0x483f52);}};module[_0x3dbd('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a1ba850..5463064 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 _0x6200=['loggedIn','openchannelPause','available','waiting','stringify','format','openchannel:queue:%s','openchannel_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','md5','updateRouting','updateRealtime','map','prototype','paused','length','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6200,0x159));var _0x0620=function(_0x37aed4,_0x254b7d){_0x37aed4=_0x37aed4-0x0;var _0x1ec4f3=_0x6200[_0x37aed4];return _0x1ec4f3;};'use strict';var _=require(_0x0620('0x0'));var md5=require('md5');var util=require(_0x0620('0x1'));var Redis=require(_0x0620('0x2'));var config=require('../../../config/environment');config[_0x0620('0x3')]=_[_0x0620('0x4')](config[_0x0620('0x3')],{'host':_0x0620('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0x48adfe){this['id']=_0x48adfe['id']||0x0;this['name']=_0x48adfe[_0x0620('0x6')]||'';this[_0x0620('0x7')]=_0x48adfe['timeout']||0xa;this[_0x0620('0x8')]=_0x48adfe['strategy']||'beepall';this[_0x0620('0x9')]=_0x48adfe[_0x0620('0x9')];this[_0x0620('0xa')]={};this['waiting']=0x0;this[_0x0620('0xb')]='';this[_0x0620('0xc')]();this[_0x0620('0xd')]();}OpenchannelQueue['prototype'][_0x0620('0xc')]=function(){var _0x170385=this[_0x0620('0xa')]['_rr'];this[_0x0620('0xa')]=_[_0x0620('0xe')](this['Agents'],'id');this[_0x0620('0xa')]['_rr']=_0x170385;};OpenchannelQueue[_0x0620('0xf')][_0x0620('0xd')]=function(){this['loggedIn']=0x0;this[_0x0620('0x10')]=0x0;for(var _0x1eec19=0x0;_0x1eec19=0x0?this[_0x0620('0x15')]:0x0;var _0x5624cc={'id':this['id'],'available':this[_0x0620('0x15')],'loggedIn':this[_0x0620('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x0620('0x16')]};var _0x5727f7=md5(JSON[_0x0620('0x17')](_0x5624cc));if(this[_0x0620('0xb')]!==_0x5727f7){this['md5']=_0x5727f7;io['to'](util[_0x0620('0x18')](_0x0620('0x19'),_0x5624cc[_0x0620('0x6')]))['emit'](_0x0620('0x1a'),_0x5624cc);}};module[_0x0620('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0x81f1=['openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','loggedIn','length','Agents','online','openchannelPause','paused','available','format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x81f1,0x108));var _0x181f=function(_0x213402,_0xf97dc0){_0x213402=_0x213402-0x0;var _0x4b7a7d=_0x81f1[_0x213402];return _0x4b7a7d;};'use strict';var _=require(_0x181f('0x0'));var md5=require(_0x181f('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x181f('0x2'));config['redis']=_['defaults'](config[_0x181f('0x3')],{'host':_0x181f('0x4'),'port':0x18eb});var io=require(_0x181f('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x498b54){this['id']=_0x498b54['id']||0x0;this[_0x181f('0x6')]=_0x498b54[_0x181f('0x6')]||'';this['timeout']=_0x498b54[_0x181f('0x7')]||0xa;this[_0x181f('0x8')]=_0x498b54[_0x181f('0x8')]||'beepall';this['Agents']=_0x498b54['Agents'];this[_0x181f('0x9')]={};this[_0x181f('0xa')]=0x0;this[_0x181f('0x1')]='';this[_0x181f('0xb')]();this[_0x181f('0xc')]();}OpenchannelQueue['prototype'][_0x181f('0xb')]=function(){var _0x285ec0=this['mapAgentsId'][_0x181f('0xd')];this[_0x181f('0x9')]=_['map'](this['Agents'],'id');this[_0x181f('0x9')]['_rr']=_0x285ec0;};OpenchannelQueue['prototype'][_0x181f('0xc')]=function(){this[_0x181f('0xe')]=0x0;this['paused']=0x0;for(var _0x301452=0x0;_0x301452=0x0?this['available']:0x0;var _0x39b4a5={'id':this['id'],'available':this[_0x181f('0x14')],'loggedIn':this[_0x181f('0xe')],'name':this[_0x181f('0x6')],'paused':this[_0x181f('0x13')],'waiting':this[_0x181f('0xa')]};var _0x5e3948=md5(JSON['stringify'](_0x39b4a5));if(this[_0x181f('0x1')]!==_0x5e3948){this[_0x181f('0x1')]=_0x5e3948;io['to'](util[_0x181f('0x15')](_0x181f('0x16'),_0x39b4a5[_0x181f('0x6')]))[_0x181f('0x17')](_0x181f('0x18'),_0x39b4a5);}};module[_0x181f('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 1574768..a0471e8 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 _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0xb10b,0x12a));var _0xbb10=function(_0x10d575,_0x6edf30){_0x10d575=_0x10d575-0x0;var _0x21ce4a=_0xb10b[_0x10d575];return _0x21ce4a;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x26366d,_0x5c63a5){var _0x219ba8=function(_0x5e2601){while(--_0x5e2601){_0x26366d['push'](_0x26366d['shift']());}};_0x219ba8(++_0x5c63a5);}(_0xb7e7,0x121));var _0x7b7e=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb7e7[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 667ccfa..7d63606 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 _0x9dbb=['Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','available','waiting','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9dbb,0x85));var _0xb9db=function(_0x2c1923,_0x5446e9){_0x2c1923=_0x2c1923-0x0;var _0x73c9b4=_0x9dbb[_0x2c1923];return _0x73c9b4;};'use strict';var _=require(_0xb9db('0x0'));var md5=require(_0xb9db('0x1'));var util=require(_0xb9db('0x2'));var Redis=require(_0xb9db('0x3'));var config=require(_0xb9db('0x4'));config['redis']=_['defaults'](config[_0xb9db('0x5')],{'host':_0xb9db('0x6'),'port':0x18eb});var io=require(_0xb9db('0x7'))(new Redis(config[_0xb9db('0x5')]));function WhatsappQueue(_0x29c0e5){this['id']=_0x29c0e5['id']||0x0;this[_0xb9db('0x8')]=_0x29c0e5[_0xb9db('0x8')]||'';this[_0xb9db('0x9')]=_0x29c0e5['timeout']||0xa;this[_0xb9db('0xa')]=_0x29c0e5[_0xb9db('0xa')]||_0xb9db('0xb');this[_0xb9db('0xc')]=_0x29c0e5['Agents'];this[_0xb9db('0xd')]={};this['waiting']=0x0;this[_0xb9db('0x1')]='';this['updateRouting']();this[_0xb9db('0xe')]();}WhatsappQueue[_0xb9db('0xf')][_0xb9db('0x10')]=function(){var _0x5d8c3d=this[_0xb9db('0xd')][_0xb9db('0x11')];this[_0xb9db('0xd')]=_[_0xb9db('0x12')](this[_0xb9db('0xc')],'id');this['mapAgentsId'][_0xb9db('0x11')]=_0x5d8c3d;};WhatsappQueue[_0xb9db('0xf')][_0xb9db('0xe')]=function(){this[_0xb9db('0x13')]=0x0;this['paused']=0x0;for(var _0x3fc3b1=0x0;_0x3fc3b1=0x0?this[_0xb9db('0x15')]:0x0;var _0x2eecb7={'id':this['id'],'available':this[_0xb9db('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb9db('0x16')]};var _0x18fb1a=md5(JSON[_0xb9db('0x17')](_0x2eecb7));if(this['md5']!==_0x18fb1a){this[_0xb9db('0x1')]=_0x18fb1a;io['to'](util[_0xb9db('0x18')](_0xb9db('0x19'),_0x2eecb7[_0xb9db('0x8')]))[_0xb9db('0x1a')](_0xb9db('0x1b'),_0x2eecb7);}};module[_0xb9db('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xdfaf=['localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn','paused','length','available','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults'];(function(_0x1c7a6a,_0x9437c4){var _0x2ba38d=function(_0x406ad9){while(--_0x406ad9){_0x1c7a6a['push'](_0x1c7a6a['shift']());}};_0x2ba38d(++_0x9437c4);}(_0xdfaf,0x132));var _0xfdfa=function(_0x344c22,_0x10c62f){_0x344c22=_0x344c22-0x0;var _0xc4eb4a=_0xdfaf[_0x344c22];return _0xc4eb4a;};'use strict';var _=require(_0xfdfa('0x0'));var md5=require(_0xfdfa('0x1'));var util=require(_0xfdfa('0x2'));var Redis=require('ioredis');var config=require(_0xfdfa('0x3'));config[_0xfdfa('0x4')]=_[_0xfdfa('0x5')](config[_0xfdfa('0x4')],{'host':_0xfdfa('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfdfa('0x4')]));function WhatsappQueue(_0x1d8944){this['id']=_0x1d8944['id']||0x0;this[_0xfdfa('0x7')]=_0x1d8944['name']||'';this['timeout']=_0x1d8944[_0xfdfa('0x8')]||0xa;this[_0xfdfa('0x9')]=_0x1d8944['strategy']||_0xfdfa('0xa');this['Agents']=_0x1d8944[_0xfdfa('0xb')];this['mapAgentsId']={};this[_0xfdfa('0xc')]=0x0;this[_0xfdfa('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue['prototype'][_0xfdfa('0xd')]=function(){var _0x1b2b51=this[_0xfdfa('0xe')][_0xfdfa('0xf')];this[_0xfdfa('0xe')]=_['map'](this[_0xfdfa('0xb')],'id');this[_0xfdfa('0xe')][_0xfdfa('0xf')]=_0x1b2b51;};WhatsappQueue['prototype'][_0xfdfa('0x10')]=function(){this[_0xfdfa('0x11')]=0x0;this[_0xfdfa('0x12')]=0x0;for(var _0x3badd8=0x0;_0x3badd8=0x0?this['available']:0x0;var _0x13372a={'id':this['id'],'available':this[_0xfdfa('0x14')],'loggedIn':this['loggedIn'],'name':this[_0xfdfa('0x7')],'paused':this[_0xfdfa('0x12')],'waiting':this[_0xfdfa('0xc')]};var _0xb9589=md5(JSON[_0xfdfa('0x15')](_0x13372a));if(this[_0xfdfa('0x1')]!==_0xb9589){this['md5']=_0xb9589;io['to'](util[_0xfdfa('0x16')]('whatsapp:queue:%s',_0x13372a[_0xfdfa('0x7')]))[_0xfdfa('0x17')](_0xfdfa('0x18'),_0x13372a);}};module[_0xfdfa('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 5fb9fda..e71050f 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 _0x3e74=['initIntervals','mergeFromDatabase','initOpenchannelQueues','openchannelQueues','updateRealtime','updateRouting','initSmsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/chatQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','length','isUndefined'];(function(_0xbf6a96,_0x2fb2d){var _0x2adb9c=function(_0x54212e){while(--_0x54212e){_0xbf6a96['push'](_0xbf6a96['shift']());}};_0x2adb9c(++_0x2fb2d);}(_0x3e74,0x175));var _0x43e7=function(_0x4e70ea,_0x320fd4){_0x4e70ea=_0x4e70ea-0x0;var _0x2ed6b2=_0x3e74[_0x4e70ea];return _0x2ed6b2;};'use strict';var BPromise=require(_0x43e7('0x0'));var util=require('util');var _=require(_0x43e7('0x1'));var moment=require(_0x43e7('0x2'));var Agent=require(_0x43e7('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x43e7('0x4'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x43e7('0x5'));var FaxQueue=require(_0x43e7('0x6'));var WhatsappQueue=require(_0x43e7('0x7'));var Realtime=function(){this[_0x43e7('0x8')]={};this[_0x43e7('0x9')]={};this['openchannelQueues']={};this[_0x43e7('0xa')]={};this[_0x43e7('0xb')]={};this[_0x43e7('0xc')]={};this[_0x43e7('0xd')]={};this[_0x43e7('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x43e7('0xf')]={};this['openchannelQueuesWaitingInteractions']={};this['smsQueuesWaitingInteractions']={};this[_0x43e7('0x10')]={};this[_0x43e7('0x11')]={};};function freeIsNotKey(_0x5c34f4,_0x2803d9,_0x513707){var _0xf7c520=_[_0x43e7('0x12')](_0x5c34f4,function(_0x4ebc8e,_0x3eb206){return _0x4ebc8e[_0x513707];});for(var _0xc960ea in _0x2803d9){if(_0x2803d9[_0x43e7('0x13')](_0xc960ea)){if(!_0xf7c520[_0xc960ea]){delete _0x2803d9[_0xc960ea];}}}}Realtime[_0x43e7('0x14')]['mergeFromDatabase']=function(_0x583d85,_0x2fcb36){for(var _0x21fdd3 in _0x2fcb36){if(_0x583d85[_0x43e7('0x13')](_0x21fdd3)){_0x583d85[_0x21fdd3]=_0x2fcb36[_0x21fdd3];}}};Realtime['prototype']['initAgents']=function(){var _0x16849c=this;return function(_0x14c146){if(_0x14c146){freeIsNotKey(_0x14c146,_0x16849c[_0x43e7('0x8')],'id');for(var _0x328445=0x0,_0x4de324={},_0x5c4eaa={};_0x328445<_0x14c146[_0x43e7('0x15')];_0x328445+=0x1){_0x4de324=_0x14c146[_0x328445];if(_[_0x43e7('0x16')](_0x16849c[_0x43e7('0x8')][_0x4de324['id']])){_0x16849c['agents'][_0x4de324['id']]=new Agent(_0x4de324);}else{_0x16849c['mergeFromDatabase'](_0x16849c[_0x43e7('0x8')][_0x4de324['id']],_0x4de324);}}}return _0x16849c[_0x43e7('0x8')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x17')]=function(){var _0x3776f5=this;return function(_0x1f24fb){if(_0x1f24fb){freeIsNotKey(_0x1f24fb,_0x3776f5[_0x43e7('0x9')],'id');for(var _0x1441ef=0x0,_0x2377a3={},_0xab63cf={};_0x1441ef<_0x1f24fb[_0x43e7('0x15')];_0x1441ef+=0x1){_0x2377a3=_0x1f24fb[_0x1441ef];if(_[_0x43e7('0x16')](_0x3776f5['intervals'][_0x2377a3['id']])){_0x3776f5[_0x43e7('0x9')][_0x2377a3['id']]=new Interval(_0x2377a3);}else{_0x3776f5[_0x43e7('0x18')](_0x3776f5['intervals'][_0x2377a3['id']],_0x2377a3);}}}return _0x3776f5[_0x43e7('0x9')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x19')]=function(){var _0x28aacc=this;return function(_0x4077fb){if(_0x4077fb){freeIsNotKey(_0x4077fb,_0x28aacc[_0x43e7('0x1a')],'id');for(var _0x54a9e7=0x0,_0x454359={},_0x4eea52={};_0x54a9e7<_0x4077fb['length'];_0x54a9e7+=0x1){_0x454359=_0x4077fb[_0x54a9e7];if(_[_0x43e7('0x16')](_0x28aacc[_0x43e7('0x1a')][_0x454359['id']])){_0x28aacc['openchannelQueues'][_0x454359['id']]=new OpenchannelQueue(_0x454359);}else{_0x28aacc[_0x43e7('0x18')](_0x28aacc['openchannelQueues'][_0x454359['id']],_0x454359);}_0x28aacc[_0x43e7('0x1a')][_0x454359['id']]['updateRouting']();_0x28aacc[_0x43e7('0x1a')][_0x454359['id']][_0x43e7('0x1b')]();}}return _0x28aacc[_0x43e7('0x1a')];};};Realtime[_0x43e7('0x14')]['initChatQueues']=function(){var _0x52b7b3=this;return function(_0x805b54){if(_0x805b54){freeIsNotKey(_0x805b54,_0x52b7b3['chatQueues'],'id');for(var _0x2dd5f=0x0,_0x40dc8f={},_0x3565cf={};_0x2dd5f<_0x805b54[_0x43e7('0x15')];_0x2dd5f+=0x1){_0x40dc8f=_0x805b54[_0x2dd5f];if(_['isUndefined'](_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']])){_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']]=new ChatQueue(_0x40dc8f);}else{_0x52b7b3[_0x43e7('0x18')](_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']],_0x40dc8f);}_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']][_0x43e7('0x1c')]();_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']][_0x43e7('0x1b')]();}}return _0x52b7b3[_0x43e7('0xa')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1d')]=function(){var _0x19725a=this;return function(_0x2bde44){if(_0x2bde44){freeIsNotKey(_0x2bde44,_0x19725a[_0x43e7('0xb')],'id');for(var _0x4bdb17=0x0,_0x238321={},_0x44f6b0={};_0x4bdb17<_0x2bde44[_0x43e7('0x15')];_0x4bdb17+=0x1){_0x238321=_0x2bde44[_0x4bdb17];if(_[_0x43e7('0x16')](_0x19725a[_0x43e7('0xb')][_0x238321['id']])){_0x19725a['smsQueues'][_0x238321['id']]=new SmsQueue(_0x238321);}else{_0x19725a[_0x43e7('0x18')](_0x19725a[_0x43e7('0xb')][_0x238321['id']],_0x238321);}_0x19725a[_0x43e7('0xb')][_0x238321['id']][_0x43e7('0x1c')]();_0x19725a['smsQueues'][_0x238321['id']]['updateRealtime']();}}return _0x19725a['smsQueues'];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1e')]=function(){var _0x117c07=this;return function(_0x234fe6){if(_0x234fe6){freeIsNotKey(_0x234fe6,_0x117c07[_0x43e7('0xc')],'id');for(var _0xde7ed=0x0,_0x485c6c={},_0x47baee={};_0xde7ed<_0x234fe6['length'];_0xde7ed+=0x1){_0x485c6c=_0x234fe6[_0xde7ed];if(_['isUndefined'](_0x117c07['mailQueues'][_0x485c6c['id']])){_0x117c07['mailQueues'][_0x485c6c['id']]=new MailQueue(_0x485c6c);}else{_0x117c07['mergeFromDatabase'](_0x117c07[_0x43e7('0xc')][_0x485c6c['id']],_0x485c6c);}_0x117c07['mailQueues'][_0x485c6c['id']][_0x43e7('0x1c')]();_0x117c07[_0x43e7('0xc')][_0x485c6c['id']][_0x43e7('0x1b')]();}}return _0x117c07[_0x43e7('0xc')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1f')]=function(){var _0x101d45=this;return function(_0x4f1a5f){if(_0x4f1a5f){freeIsNotKey(_0x4f1a5f,_0x101d45['faxQueues'],'id');for(var _0x5d84f4=0x0,_0xfa0474={},_0xfe70e9={};_0x5d84f4<_0x4f1a5f[_0x43e7('0x15')];_0x5d84f4+=0x1){_0xfa0474=_0x4f1a5f[_0x5d84f4];if(_[_0x43e7('0x16')](_0x101d45[_0x43e7('0xd')][_0xfa0474['id']])){_0x101d45[_0x43e7('0xd')][_0xfa0474['id']]=new FaxQueue(_0xfa0474);}else{_0x101d45[_0x43e7('0x18')](_0x101d45[_0x43e7('0xd')][_0xfa0474['id']],_0xfa0474);}_0x101d45['faxQueues'][_0xfa0474['id']][_0x43e7('0x1c')]();_0x101d45[_0x43e7('0xd')][_0xfa0474['id']]['updateRealtime']();}}return _0x101d45[_0x43e7('0xd')];};};Realtime['prototype'][_0x43e7('0x20')]=function(){var _0x2ad008=this;return function(_0x1c6f45){if(_0x1c6f45){freeIsNotKey(_0x1c6f45,_0x2ad008[_0x43e7('0xe')],'id');for(var _0x35ac85=0x0,_0x234d8f={},_0x5e731b={};_0x35ac85<_0x1c6f45['length'];_0x35ac85+=0x1){_0x234d8f=_0x1c6f45[_0x35ac85];if(_[_0x43e7('0x16')](_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']])){_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']]=new WhatsappQueue(_0x234d8f);}else{_0x2ad008[_0x43e7('0x18')](_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']],_0x234d8f);}_0x2ad008['whatsappQueues'][_0x234d8f['id']][_0x43e7('0x1c')]();_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']]['updateRealtime']();}}return _0x2ad008[_0x43e7('0xe')];};};module['exports']=Realtime; \ No newline at end of file +var _0x4b84=['../model/agent','../model/chatQueue','../model/smsQueue','../model/mailQueue','intervals','chatQueues','mailQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','agents','isUndefined','mergeFromDatabase','length','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','bluebird','util'];(function(_0x4df1fb,_0x329dfd){var _0x1f568b=function(_0x3db739){while(--_0x3db739){_0x4df1fb['push'](_0x4df1fb['shift']());}};_0x1f568b(++_0x329dfd);}(_0x4b84,0x1cc));var _0x44b8=function(_0xa2b098,_0x461a08){_0xa2b098=_0xa2b098-0x0;var _0x29502e=_0x4b84[_0xa2b098];return _0x29502e;};'use strict';var BPromise=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x44b8('0x2'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x44b8('0x3'));var SmsQueue=require(_0x44b8('0x4'));var MailQueue=require(_0x44b8('0x5'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this[_0x44b8('0x6')]={};this['openchannelQueues']={};this[_0x44b8('0x7')]={};this['smsQueues']={};this[_0x44b8('0x8')]={};this['faxQueues']={};this['whatsappQueues']={};this[_0x44b8('0x9')]={};this[_0x44b8('0xa')]={};this[_0x44b8('0xb')]={};this['smsQueuesWaitingInteractions']={};this[_0x44b8('0xc')]={};this[_0x44b8('0xd')]={};};function freeIsNotKey(_0x4315f6,_0x9b6048,_0x24dd10){var _0x37e471=_[_0x44b8('0xe')](_0x4315f6,function(_0x4ae8a1,_0x147529){return _0x4ae8a1[_0x24dd10];});for(var _0x4301a6 in _0x9b6048){if(_0x9b6048['hasOwnProperty'](_0x4301a6)){if(!_0x37e471[_0x4301a6]){delete _0x9b6048[_0x4301a6];}}}}Realtime[_0x44b8('0xf')]['mergeFromDatabase']=function(_0x833ea3,_0x18d642){for(var _0x4df670 in _0x18d642){if(_0x833ea3[_0x44b8('0x10')](_0x4df670)){_0x833ea3[_0x4df670]=_0x18d642[_0x4df670];}}};Realtime['prototype']['initAgents']=function(){var _0x2a3e4c=this;return function(_0x2af0ad){if(_0x2af0ad){freeIsNotKey(_0x2af0ad,_0x2a3e4c[_0x44b8('0x11')],'id');for(var _0x41ab46=0x0,_0x5e52f2={},_0x495c74={};_0x41ab46<_0x2af0ad['length'];_0x41ab46+=0x1){_0x5e52f2=_0x2af0ad[_0x41ab46];if(_[_0x44b8('0x12')](_0x2a3e4c['agents'][_0x5e52f2['id']])){_0x2a3e4c[_0x44b8('0x11')][_0x5e52f2['id']]=new Agent(_0x5e52f2);}else{_0x2a3e4c[_0x44b8('0x13')](_0x2a3e4c['agents'][_0x5e52f2['id']],_0x5e52f2);}}}return _0x2a3e4c[_0x44b8('0x11')];};};Realtime[_0x44b8('0xf')]['initIntervals']=function(){var _0x89bc30=this;return function(_0x3f4688){if(_0x3f4688){freeIsNotKey(_0x3f4688,_0x89bc30['intervals'],'id');for(var _0xcce202=0x0,_0x8b4301={},_0xebfe79={};_0xcce202<_0x3f4688[_0x44b8('0x14')];_0xcce202+=0x1){_0x8b4301=_0x3f4688[_0xcce202];if(_[_0x44b8('0x12')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']])){_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']]=new Interval(_0x8b4301);}else{_0x89bc30[_0x44b8('0x13')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']],_0x8b4301);}}}return _0x89bc30[_0x44b8('0x6')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x15')]=function(){var _0x48327e=this;return function(_0x56549a){if(_0x56549a){freeIsNotKey(_0x56549a,_0x48327e[_0x44b8('0x16')],'id');for(var _0x416b34=0x0,_0x1418db={},_0x305a5c={};_0x416b34<_0x56549a['length'];_0x416b34+=0x1){_0x1418db=_0x56549a[_0x416b34];if(_[_0x44b8('0x12')](_0x48327e['openchannelQueues'][_0x1418db['id']])){_0x48327e[_0x44b8('0x16')][_0x1418db['id']]=new OpenchannelQueue(_0x1418db);}else{_0x48327e[_0x44b8('0x13')](_0x48327e[_0x44b8('0x16')][_0x1418db['id']],_0x1418db);}_0x48327e[_0x44b8('0x16')][_0x1418db['id']][_0x44b8('0x17')]();_0x48327e['openchannelQueues'][_0x1418db['id']][_0x44b8('0x18')]();}}return _0x48327e['openchannelQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x19')]=function(){var _0x549a26=this;return function(_0x17ac44){if(_0x17ac44){freeIsNotKey(_0x17ac44,_0x549a26[_0x44b8('0x7')],'id');for(var _0x2656d7=0x0,_0x59c1bf={},_0xb22107={};_0x2656d7<_0x17ac44[_0x44b8('0x14')];_0x2656d7+=0x1){_0x59c1bf=_0x17ac44[_0x2656d7];if(_['isUndefined'](_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']])){_0x549a26['chatQueues'][_0x59c1bf['id']]=new ChatQueue(_0x59c1bf);}else{_0x549a26[_0x44b8('0x13')](_0x549a26['chatQueues'][_0x59c1bf['id']],_0x59c1bf);}_0x549a26['chatQueues'][_0x59c1bf['id']]['updateRouting']();_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']][_0x44b8('0x18')]();}}return _0x549a26[_0x44b8('0x7')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1a')]=function(){var _0xc3f667=this;return function(_0x2cf205){if(_0x2cf205){freeIsNotKey(_0x2cf205,_0xc3f667[_0x44b8('0x1b')],'id');for(var _0xd1d320=0x0,_0x28f918={},_0x5e1129={};_0xd1d320<_0x2cf205[_0x44b8('0x14')];_0xd1d320+=0x1){_0x28f918=_0x2cf205[_0xd1d320];if(_[_0x44b8('0x12')](_0xc3f667['smsQueues'][_0x28f918['id']])){_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']]=new SmsQueue(_0x28f918);}else{_0xc3f667['mergeFromDatabase'](_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']],_0x28f918);}_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x17')]();_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x18')]();}}return _0xc3f667['smsQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1c')]=function(){var _0x26265f=this;return function(_0x339f0f){if(_0x339f0f){freeIsNotKey(_0x339f0f,_0x26265f[_0x44b8('0x8')],'id');for(var _0x5f541d=0x0,_0x3875a5={},_0x400edc={};_0x5f541d<_0x339f0f[_0x44b8('0x14')];_0x5f541d+=0x1){_0x3875a5=_0x339f0f[_0x5f541d];if(_[_0x44b8('0x12')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']])){_0x26265f[_0x44b8('0x8')][_0x3875a5['id']]=new MailQueue(_0x3875a5);}else{_0x26265f[_0x44b8('0x13')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']],_0x3875a5);}_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x17')]();_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x18')]();}}return _0x26265f[_0x44b8('0x8')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1d')]=function(){var _0x1becb0=this;return function(_0x323c50){if(_0x323c50){freeIsNotKey(_0x323c50,_0x1becb0[_0x44b8('0x1e')],'id');for(var _0x28faa9=0x0,_0x3984f8={},_0x2c02d6={};_0x28faa9<_0x323c50[_0x44b8('0x14')];_0x28faa9+=0x1){_0x3984f8=_0x323c50[_0x28faa9];if(_['isUndefined'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']])){_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]=new FaxQueue(_0x3984f8);}else{_0x1becb0['mergeFromDatabase'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']],_0x3984f8);}_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']][_0x44b8('0x17')]();_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]['updateRealtime']();}}return _0x1becb0[_0x44b8('0x1e')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1f')]=function(){var _0x1ee3cc=this;return function(_0x9cb2a){if(_0x9cb2a){freeIsNotKey(_0x9cb2a,_0x1ee3cc[_0x44b8('0x20')],'id');for(var _0x46aadd=0x0,_0x3581b8={},_0x209039={};_0x46aadd<_0x9cb2a[_0x44b8('0x14')];_0x46aadd+=0x1){_0x3581b8=_0x9cb2a[_0x46aadd];if(_[_0x44b8('0x12')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']])){_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]=new WhatsappQueue(_0x3581b8);}else{_0x1ee3cc[_0x44b8('0x13')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']],_0x3581b8);}_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]['updateRouting']();_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']][_0x44b8('0x18')]();}}return _0x1ee3cc[_0x44b8('0x20')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index cc66995..83981c2 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 _0x9322=['Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x4917a4,_0xccfc6){var _0x181a12=function(_0x267e1f){while(--_0x267e1f){_0x4917a4['push'](_0x4917a4['shift']());}};_0x181a12(++_0xccfc6);}(_0x9322,0x11f));var _0x2932=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9322[_0x3ab51d];return _0x29a04e;};'use strict';var client=require('../client');exports[_0x2932('0x0')]=function(_0x5827ba,_0x2c7a87){return client[_0x2932('0x1')](_0x2932('0x2'),{'body':_0x2c7a87,'options':{'where':{'id':_0x5827ba}},'log':_0x2932('0x3')});};exports['addTags']=function(_0x3f9467,_0x263056){return client['Request'](_0x2932('0x4'),{'body':_0x263056,'options':{'where':{'id':_0x3f9467}},'log':_0x2932('0x5')});}; \ No newline at end of file +var _0x3ecd=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','update','UpdateChatInteraction'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0x3ecd,0x132));var _0xd3ec=function(_0x1e78ef,_0x2beefc){_0x1e78ef=_0x1e78ef-0x0;var _0x3fcce5=_0x3ecd[_0x1e78ef];return _0x3fcce5;};'use strict';var client=require('../client');exports[_0xd3ec('0x0')]=function(_0x48fd22,_0x3b6d13){return client['Request'](_0xd3ec('0x1'),{'body':_0x3b6d13,'options':{'where':{'id':_0x48fd22}},'log':_0xd3ec('0x2')});};exports[_0xd3ec('0x3')]=function(_0x27ce35,_0x48cd27){return client[_0xd3ec('0x4')](_0xd3ec('0x5'),{'body':_0x48cd27,'options':{'where':{'id':_0x27ce35}},'log':_0xd3ec('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 6063a33..d41a71b 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 _0xa7b1=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x3ffd2b,_0x1e9fb5){var _0x28d3fe=function(_0x303bfc){while(--_0x303bfc){_0x3ffd2b['push'](_0x3ffd2b['shift']());}};_0x28d3fe(++_0x1e9fb5);}(_0xa7b1,0x138));var _0x1a7b=function(_0x16eb37,_0x18dd0e){_0x16eb37=_0x16eb37-0x0;var _0x40e6db=_0xa7b1[_0x16eb37];return _0x40e6db;};'use strict';var client=require(_0x1a7b('0x0'));exports[_0x1a7b('0x1')]=function(_0x27bd26){return client[_0x1a7b('0x2')](_0x1a7b('0x3'),{'body':_0x27bd26,'log':_0x1a7b('0x4')});}; \ No newline at end of file +var _0x9085=['create','Request','createChatMessage'];(function(_0x4a5026,_0x2706eb){var _0x206d29=function(_0x521965){while(--_0x521965){_0x4a5026['push'](_0x4a5026['shift']());}};_0x206d29(++_0x2706eb);}(_0x9085,0x105));var _0x5908=function(_0x80ab9e,_0x32c636){_0x80ab9e=_0x80ab9e-0x0;var _0x7605e6=_0x9085[_0x80ab9e];return _0x7605e6;};'use strict';var client=require('../client');exports[_0x5908('0x0')]=function(_0xdb472e){return client[_0x5908('0x1')]('CreateChatMessage',{'body':_0xdb472e,'log':_0x5908('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0087eb4..9d64a38 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 _0xaf91=['chatPause','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf91,0x1a5));var _0x1af9=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0xaf91[_0x83af7f];return _0x32d85c;};'use strict';var client=require('../client');exports[_0x1af9('0x0')]=function(){return function(){return client[_0x1af9('0x1')](_0x1af9('0x2'),{'options':{'raw':![],'attributes':['id',_0x1af9('0x3'),_0x1af9('0x4'),_0x1af9('0x5')],'include':[{'model':_0x1af9('0x6'),'as':_0x1af9('0x7'),'attributes':['id','name',_0x1af9('0x8'),_0x1af9('0x9')]}]},'log':_0x1af9('0x0')});};}; \ No newline at end of file +var _0xcc8a=['User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x110571,_0x5328d7){var _0x37b81c=function(_0x581ff4){while(--_0x581ff4){_0x110571['push'](_0x110571['shift']());}};_0x37b81c(++_0x5328d7);}(_0xcc8a,0x1e8));var _0xacc8=function(_0xabc5a5,_0x2811cc){_0xabc5a5=_0xabc5a5-0x0;var _0x460167=_0xcc8a[_0xabc5a5];return _0x460167;};'use strict';var client=require(_0xacc8('0x0'));exports[_0xacc8('0x1')]=function(){return function(){return client[_0xacc8('0x2')](_0xacc8('0x3'),{'options':{'raw':![],'attributes':['id',_0xacc8('0x4'),_0xacc8('0x5'),_0xacc8('0x6')],'include':[{'model':_0xacc8('0x7'),'as':_0xacc8('0x8'),'attributes':['id','name',_0xacc8('0x9'),_0xacc8('0xa')]}]},'log':_0xacc8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 77d595a..12d8e33 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 _0x6bff=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x33892e,_0x3aac54){var _0x1d7d51=function(_0x4afd6f){while(--_0x4afd6f){_0x33892e['push'](_0x33892e['shift']());}};_0x1d7d51(++_0x3aac54);}(_0x6bff,0xa6));var _0xf6bf=function(_0x262e5f,_0x1b356e){_0x262e5f=_0x262e5f-0x0;var _0x101902=_0x6bff[_0x262e5f];return _0x101902;};'use strict';var client=require(_0xf6bf('0x0'));exports[_0xf6bf('0x1')]=function(_0x4cb01e){return client[_0xf6bf('0x2')]('CreateChatQueueReport',{'body':_0x4cb01e,'log':_0xf6bf('0x3')});};exports[_0xf6bf('0x4')]=function(_0x3ab762,_0x14a2d8){return client['Request'](_0xf6bf('0x5'),{'body':_0x14a2d8,'options':{'where':{'uniqueid':_0x3ab762},'order':[['id',_0xf6bf('0x6')]],'limit':0x1},'log':_0xf6bf('0x5')});}; \ No newline at end of file +var _0x9f75=['UpdateChatQueueReport','../client','Request','update','DESC'];(function(_0x6cd4ba,_0x32d828){var _0x525723=function(_0x149ae5){while(--_0x149ae5){_0x6cd4ba['push'](_0x6cd4ba['shift']());}};_0x525723(++_0x32d828);}(_0x9f75,0x15a));var _0x59f7=function(_0x4f4c22,_0xe2aa3){_0x4f4c22=_0x4f4c22-0x0;var _0x4e7624=_0x9f75[_0x4f4c22];return _0x4e7624;};'use strict';var client=require(_0x59f7('0x0'));exports['create']=function(_0x2d26fa){return client[_0x59f7('0x1')]('CreateChatQueueReport',{'body':_0x2d26fa,'log':'CreateChatQueueReport'});};exports[_0x59f7('0x2')]=function(_0x455b84,_0x3b92a2){return client[_0x59f7('0x1')]('UpdateChatQueueReport',{'body':_0x3b92a2,'options':{'where':{'uniqueid':_0x455b84},'order':[['id',_0x59f7('0x3')]],'limit':0x1},'log':_0x59f7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 299ff1e..731034d 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 _0x9813=['addTagsToFaxInteraction','update','updateFaxInteraction','AddTagsToFaxInteraction'];(function(_0x59f9e6,_0x1485df){var _0x415f6c=function(_0x292941){while(--_0x292941){_0x59f9e6['push'](_0x59f9e6['shift']());}};_0x415f6c(++_0x1485df);}(_0x9813,0xb1));var _0x3981=function(_0x2584f5,_0x1f379c){_0x2584f5=_0x2584f5-0x0;var _0x2de37d=_0x9813[_0x2584f5];return _0x2de37d;};'use strict';var client=require('../client');exports[_0x3981('0x0')]=function(_0x286295,_0x4f7009){return client['Request']('UpdateFaxInteraction',{'body':_0x4f7009,'options':{'where':{'id':_0x286295}},'log':_0x3981('0x1')});};exports['addTags']=function(_0xad8899,_0x29af85){return client['Request'](_0x3981('0x2'),{'body':_0x29af85,'options':{'where':{'id':_0xad8899}},'log':_0x3981('0x3')});}; \ No newline at end of file +var _0xa643=['../client','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction'];(function(_0x552e57,_0x1406d1){var _0x36f03c=function(_0x315e72){while(--_0x315e72){_0x552e57['push'](_0x552e57['shift']());}};_0x36f03c(++_0x1406d1);}(_0xa643,0xc4));var _0x3a64=function(_0x28ee2b,_0x17ac26){_0x28ee2b=_0x28ee2b-0x0;var _0x324feb=_0xa643[_0x28ee2b];return _0x324feb;};'use strict';var client=require(_0x3a64('0x0'));exports['update']=function(_0x4e892b,_0x46d5f0){return client[_0x3a64('0x1')](_0x3a64('0x2'),{'body':_0x46d5f0,'options':{'where':{'id':_0x4e892b}},'log':_0x3a64('0x3')});};exports[_0x3a64('0x4')]=function(_0x5de601,_0x153ad7){return client[_0x3a64('0x1')](_0x3a64('0x5'),{'body':_0x153ad7,'options':{'where':{'id':_0x5de601}},'log':_0x3a64('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 23636a0..01f0652 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 _0x9851=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x1f1757,_0x2369c3){var _0x2e1595=function(_0x253778){while(--_0x253778){_0x1f1757['push'](_0x1f1757['shift']());}};_0x2e1595(++_0x2369c3);}(_0x9851,0x1b1));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x1985('0x0'));exports[_0x1985('0x1')]=function(_0x110cb3){return client[_0x1985('0x2')](_0x1985('0x3'),{'body':_0x110cb3,'log':_0x1985('0x4')});}; \ No newline at end of file +var _0x8c7a=['create','Request','../client'];(function(_0xfae241,_0x1e94fe){var _0x54c1d1=function(_0x76884a){while(--_0x76884a){_0xfae241['push'](_0xfae241['shift']());}};_0x54c1d1(++_0x1e94fe);}(_0x8c7a,0x1a0));var _0xa8c7=function(_0x51cd8b,_0x2ae667){_0x51cd8b=_0x51cd8b-0x0;var _0x56d067=_0x8c7a[_0x51cd8b];return _0x56d067;};'use strict';var client=require(_0xa8c7('0x0'));exports[_0xa8c7('0x1')]=function(_0x329591){return client[_0xa8c7('0x2')]('CreateFaxMessage',{'body':_0x329591,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 3b0a8cd..1163f92 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 _0x6e4b=['online','faxPause','../client','getFaxQueues','GetFaxQueue','timeout','Agents','name'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x6e4b,0xaa));var _0xb6e4=function(_0x4d178b,_0x2e5d33){_0x4d178b=_0x4d178b-0x0;var _0x49484e=_0x6e4b[_0x4d178b];return _0x49484e;};'use strict';var client=require(_0xb6e4('0x0'));exports[_0xb6e4('0x1')]=function(){return function(){return client['Request'](_0xb6e4('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xb6e4('0x3'),'strategy'],'include':[{'model':'User','as':_0xb6e4('0x4'),'attributes':['id',_0xb6e4('0x5'),_0xb6e4('0x6'),_0xb6e4('0x7')]}]},'log':_0xb6e4('0x1')});};}; \ No newline at end of file +var _0x9f64=['GetFaxQueue','name','timeout','strategy','User','Agents','online','getFaxQueues','Request'];(function(_0xd6dab8,_0x2d15ed){var _0x5e9e34=function(_0x528703){while(--_0x528703){_0xd6dab8['push'](_0xd6dab8['shift']());}};_0x5e9e34(++_0x2d15ed);}(_0x9f64,0xe8));var _0x49f6=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x9f64[_0x2abc3d];return _0x252745;};'use strict';var client=require('../client');exports[_0x49f6('0x0')]=function(){return function(){return client[_0x49f6('0x1')](_0x49f6('0x2'),{'options':{'raw':![],'attributes':['id',_0x49f6('0x3'),_0x49f6('0x4'),_0x49f6('0x5')],'include':[{'model':_0x49f6('0x6'),'as':_0x49f6('0x7'),'attributes':['id',_0x49f6('0x3'),_0x49f6('0x8'),'faxPause']}]},'log':_0x49f6('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0827e4f..5d731dd 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 _0x6f01=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x6f01,0x1ee));var _0x16f0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6f01[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0x16f0('0x0'));exports[_0x16f0('0x1')]=function(_0x45228d){return client[_0x16f0('0x2')](_0x16f0('0x3'),{'body':_0x45228d,'log':_0x16f0('0x3')});};exports['update']=function(_0x52742a,_0xe39c9){return client['Request'](_0x16f0('0x4'),{'body':_0xe39c9,'options':{'where':{'uniqueid':_0x52742a},'order':[['id',_0x16f0('0x5')]],'limit':0x1},'log':_0x16f0('0x4')});}; \ No newline at end of file +var _0xd5b1=['UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport','update'];(function(_0x17a146,_0x3c086d){var _0x4125b1=function(_0x229e15){while(--_0x229e15){_0x17a146['push'](_0x17a146['shift']());}};_0x4125b1(++_0x3c086d);}(_0xd5b1,0x116));var _0x1d5b=function(_0x17a464,_0x4084f4){_0x17a464=_0x17a464-0x0;var _0x343d5a=_0xd5b1[_0x17a464];return _0x343d5a;};'use strict';var client=require(_0x1d5b('0x0'));exports['create']=function(_0x51b6e5){return client[_0x1d5b('0x1')]('CreateFaxQueueReport',{'body':_0x51b6e5,'log':_0x1d5b('0x2')});};exports[_0x1d5b('0x3')]=function(_0x53a503,_0x41d4cd){return client['Request'](_0x1d5b('0x4'),{'body':_0x41d4cd,'options':{'where':{'uniqueid':_0x53a503},'order':[['id',_0x1d5b('0x5')]],'limit':0x1},'log':_0x1d5b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index beeeef8..28291bd 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 _0x42f4=['Request','GetInterval','name','Interval','Intervals','../client'];(function(_0x470a15,_0x44fdf3){var _0x448575=function(_0x1550f8){while(--_0x1550f8){_0x470a15['push'](_0x470a15['shift']());}};_0x448575(++_0x44fdf3);}(_0x42f4,0x19d));var _0x442f=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x42f4[_0x285824];return _0x311d7e;};'use strict';var client=require(_0x442f('0x0'));exports['getIntervals']=function(){return function(){return client[_0x442f('0x1')](_0x442f('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x442f('0x3')],'include':[{'model':_0x442f('0x4'),'as':_0x442f('0x5'),'attributes':['id','name','interval']}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x693f=['GetInterval','Interval','Intervals','name','interval','../client','getIntervals','Request'];(function(_0x324e96,_0x5b47ed){var _0x825c09=function(_0x455aa6){while(--_0x455aa6){_0x324e96['push'](_0x324e96['shift']());}};_0x825c09(++_0x5b47ed);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xf693('0x0'));exports[_0xf693('0x1')]=function(){return function(){return client[_0xf693('0x2')](_0xf693('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xf693('0x4'),'as':_0xf693('0x5'),'attributes':['id',_0xf693('0x6'),_0xf693('0x7')]}]},'log':_0xf693('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ccb7e41..9e74130 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 _0x1598=['addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x22ec87,_0x1d2e20){var _0x57668b=function(_0x5beed4){while(--_0x5beed4){_0x22ec87['push'](_0x22ec87['shift']());}};_0x57668b(++_0x1d2e20);}(_0x1598,0x1c9));var _0x8159=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1598[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8159('0x0'));exports[_0x8159('0x1')]=function(_0x413aea,_0x32b7b9){return client['Request'](_0x8159('0x2'),{'body':_0x32b7b9,'options':{'where':{'id':_0x413aea}},'log':_0x8159('0x3')});};exports[_0x8159('0x4')]=function(_0xf20b0,_0x4f5493){return client['Request']('AddTagsToMailInteraction',{'body':_0x4f5493,'options':{'where':{'id':_0xf20b0}},'log':_0x8159('0x5')});}; \ No newline at end of file +var _0x6fae=['updateMailInteraction','addTags','addTagsToChatInteraction','update','Request'];(function(_0x178a60,_0x3b374b){var _0x14731e=function(_0x35aa2c){while(--_0x35aa2c){_0x178a60['push'](_0x178a60['shift']());}};_0x14731e(++_0x3b374b);}(_0x6fae,0x111));var _0xe6fa=function(_0x511c07,_0x306e02){_0x511c07=_0x511c07-0x0;var _0x22b8d0=_0x6fae[_0x511c07];return _0x22b8d0;};'use strict';var client=require('../client');exports[_0xe6fa('0x0')]=function(_0x49d0e7,_0x1eec36){return client[_0xe6fa('0x1')]('UpdateMailInteraction',{'body':_0x1eec36,'options':{'where':{'id':_0x49d0e7}},'log':_0xe6fa('0x2')});};exports[_0xe6fa('0x3')]=function(_0x4a835d,_0x5133ee){return client[_0xe6fa('0x1')]('AddTagsToMailInteraction',{'body':_0x5133ee,'options':{'where':{'id':_0x4a835d}},'log':_0xe6fa('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d913ed2..5c108c0 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 _0x3e88=['create','createMailMessage','../client'];(function(_0x206fd1,_0x5038de){var _0x12c27d=function(_0x26060c){while(--_0x26060c){_0x206fd1['push'](_0x206fd1['shift']());}};_0x12c27d(++_0x5038de);}(_0x3e88,0x19d));var _0x83e8=function(_0x56d51f,_0x3a6252){_0x56d51f=_0x56d51f-0x0;var _0x24100c=_0x3e88[_0x56d51f];return _0x24100c;};'use strict';var client=require(_0x83e8('0x0'));exports[_0x83e8('0x1')]=function(_0x3234d0){return client['Request']('CreateMailMessage',{'body':_0x3234d0,'log':_0x83e8('0x2')});}; \ No newline at end of file +var _0x4338=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x3c637e,_0x3caea8){var _0x2f046b=function(_0x2ca558){while(--_0x2ca558){_0x3c637e['push'](_0x3c637e['shift']());}};_0x2f046b(++_0x3caea8);}(_0x4338,0xd2));var _0x8433=function(_0x327ffa,_0x55150e){_0x327ffa=_0x327ffa-0x0;var _0x184b2c=_0x4338[_0x327ffa];return _0x184b2c;};'use strict';var client=require(_0x8433('0x0'));exports[_0x8433('0x1')]=function(_0x40891a){return client['Request'](_0x8433('0x2'),{'body':_0x40891a,'log':_0x8433('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8263a98..2fb39d7 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 _0xcac9=['Request','GetMailQueue','timeout','strategy','User','name','online','mailPause','getMailQueues','../client'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xcac9,0xa9));var _0x9cac=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xcac9[_0x341e0f];return _0x59555a;};'use strict';var client=require(_0x9cac('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x9cac('0x1')](_0x9cac('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9cac('0x3'),_0x9cac('0x4')],'include':[{'model':_0x9cac('0x5'),'as':'Agents','attributes':['id',_0x9cac('0x6'),_0x9cac('0x7'),_0x9cac('0x8')]}]},'log':_0x9cac('0x9')});};}; \ No newline at end of file +var _0x3b51=['name','timeout','User','Agents','mailPause','../client','getMailQueues'];(function(_0x1bc42d,_0x1b8a92){var _0x2a4351=function(_0x247ad2){while(--_0x247ad2){_0x1bc42d['push'](_0x1bc42d['shift']());}};_0x2a4351(++_0x1b8a92);}(_0x3b51,0xde));var _0x13b5=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x3b51[_0xa9a245];return _0x2d0eaa;};'use strict';var client=require(_0x13b5('0x0'));exports[_0x13b5('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x13b5('0x2'),_0x13b5('0x3'),'strategy'],'include':[{'model':_0x13b5('0x4'),'as':_0x13b5('0x5'),'attributes':['id',_0x13b5('0x2'),'online',_0x13b5('0x6')]}]},'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 a7d2f37..771e429 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 _0xb32f=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x1a3cc7,_0x2900e3){var _0x338438=function(_0x5a4872){while(--_0x5a4872){_0x1a3cc7['push'](_0x1a3cc7['shift']());}};_0x338438(++_0x2900e3);}(_0xb32f,0xea));var _0xfb32=function(_0x27e6fb,_0x5012dc){_0x27e6fb=_0x27e6fb-0x0;var _0x5be6f5=_0xb32f[_0x27e6fb];return _0x5be6f5;};'use strict';var client=require(_0xfb32('0x0'));exports[_0xfb32('0x1')]=function(_0x1cdf00){return client[_0xfb32('0x2')](_0xfb32('0x3'),{'body':_0x1cdf00,'log':'CreateMailQueueReport'});};exports[_0xfb32('0x4')]=function(_0x5ce4c7,_0x524391){return client[_0xfb32('0x2')](_0xfb32('0x5'),{'body':_0x524391,'options':{'where':{'uniqueid':_0x5ce4c7},'order':[['id',_0xfb32('0x6')]],'limit':0x1},'log':_0xfb32('0x5')});}; \ No newline at end of file +var _0x06a3=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x261c12,_0x288f38){var _0x2a4d37=function(_0x42b51c){while(--_0x42b51c){_0x261c12['push'](_0x261c12['shift']());}};_0x2a4d37(++_0x288f38);}(_0x06a3,0xce));var _0x306a=function(_0x6330a4,_0x31ce3f){_0x6330a4=_0x6330a4-0x0;var _0x3a9b65=_0x06a3[_0x6330a4];return _0x3a9b65;};'use strict';var client=require(_0x306a('0x0'));exports[_0x306a('0x1')]=function(_0x4f163d){return client[_0x306a('0x2')]('CreateMailQueueReport',{'body':_0x4f163d,'log':_0x306a('0x3')});};exports[_0x306a('0x4')]=function(_0x61190c,_0x44cdf4){return client['Request'](_0x306a('0x5'),{'body':_0x44cdf4,'options':{'where':{'uniqueid':_0x61190c},'order':[['id',_0x306a('0x6')]],'limit':0x1},'log':_0x306a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index be80a48..799918b 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 _0x3108=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x3108,0xaf));var _0x8310=function(_0x798af9,_0x601d79){_0x798af9=_0x798af9-0x0;var _0x826ec0=_0x3108[_0x798af9];return _0x826ec0;};'use strict';var client=require(_0x8310('0x0'));exports[_0x8310('0x1')]=function(_0x589759,_0x3eaee4){return client[_0x8310('0x2')](_0x8310('0x3'),{'body':_0x3eaee4,'options':{'where':{'id':_0x589759}},'log':'updateOpenchannelInteraction'});};exports[_0x8310('0x4')]=function(_0x18e712,_0xe261da){return client[_0x8310('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0xe261da,'options':{'where':{'id':_0x18e712}},'log':_0x8310('0x5')});}; \ No newline at end of file +var _0xfbd6=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x658fd5,_0x13d300){var _0xa99680=function(_0x476427){while(--_0x476427){_0x658fd5['push'](_0x658fd5['shift']());}};_0xa99680(++_0x13d300);}(_0xfbd6,0x105));var _0x6fbd=function(_0x2356c4,_0x5de550){_0x2356c4=_0x2356c4-0x0;var _0x242f19=_0xfbd6[_0x2356c4];return _0x242f19;};'use strict';var client=require('../client');exports[_0x6fbd('0x0')]=function(_0x2b1b9a,_0x1674c5){return client[_0x6fbd('0x1')](_0x6fbd('0x2'),{'body':_0x1674c5,'options':{'where':{'id':_0x2b1b9a}},'log':'updateOpenchannelInteraction'});};exports[_0x6fbd('0x3')]=function(_0x4e7d75,_0x4f5bfc){return client[_0x6fbd('0x1')](_0x6fbd('0x4'),{'body':_0x4f5bfc,'options':{'where':{'id':_0x4e7d75}},'log':_0x6fbd('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 0e0558a..fc7af76 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 _0x00bb=['CreateOpenchannelMessage','../client','create'];(function(_0x41dfac,_0x278319){var _0x12900b=function(_0x3324cd){while(--_0x3324cd){_0x41dfac['push'](_0x41dfac['shift']());}};_0x12900b(++_0x278319);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0xb00b('0x0'));exports[_0xb00b('0x1')]=function(_0x468a51){return client['Request'](_0xb00b('0x2'),{'body':_0x468a51,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xaa88=['create','Request','createOpenchannelMessage','../client'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xaa88,0x137));var _0x8aa8=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xaa88[_0x58fc2f];return _0x3a1312;};'use strict';var client=require(_0x8aa8('0x0'));exports[_0x8aa8('0x1')]=function(_0x1643a6){return client[_0x8aa8('0x2')]('CreateOpenchannelMessage',{'body':_0x1643a6,'log':_0x8aa8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6ae3b55..c814f01 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 _0xa984=['Request','GetOpenchannelQueue','timeout','User','Agents','name','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x4d8d6c,_0x1c5953){var _0x3ef28f=function(_0x46ebc0){while(--_0x46ebc0){_0x4d8d6c['push'](_0x4d8d6c['shift']());}};_0x3ef28f(++_0x1c5953);}(_0xa984,0x1c0));var _0x4a98=function(_0x42e988,_0xd8abe0){_0x42e988=_0x42e988-0x0;var _0x5ce1fb=_0xa984[_0x42e988];return _0x5ce1fb;};'use strict';var client=require(_0x4a98('0x0'));exports[_0x4a98('0x1')]=function(){return function(){return client[_0x4a98('0x2')](_0x4a98('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x4a98('0x4'),'strategy'],'include':[{'model':_0x4a98('0x5'),'as':_0x4a98('0x6'),'attributes':['id',_0x4a98('0x7'),_0x4a98('0x8'),_0x4a98('0x9')]}]},'log':_0x4a98('0x1')});};}; \ No newline at end of file +var _0x4040=['Agents','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x437976,_0xa51fd1){var _0x4eff0b=function(_0x1844e2){while(--_0x1844e2){_0x437976['push'](_0x437976['shift']());}};_0x4eff0b(++_0xa51fd1);}(_0x4040,0x84));var _0x0404=function(_0x3bde5f,_0x44ab4d){_0x3bde5f=_0x3bde5f-0x0;var _0x199c19=_0x4040[_0x3bde5f];return _0x199c19;};'use strict';var client=require(_0x0404('0x0'));exports[_0x0404('0x1')]=function(){return function(){return client[_0x0404('0x2')](_0x0404('0x3'),{'options':{'raw':![],'attributes':['id',_0x0404('0x4'),_0x0404('0x5'),_0x0404('0x6')],'include':[{'model':_0x0404('0x7'),'as':_0x0404('0x8'),'attributes':['id',_0x0404('0x4'),_0x0404('0x9'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 326866c..0f11266 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 _0x2e36=['../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x2e36,0x15e));var _0x62e3=function(_0x59d7fd,_0x4b370c){_0x59d7fd=_0x59d7fd-0x0;var _0x284ed2=_0x2e36[_0x59d7fd];return _0x284ed2;};'use strict';var client=require(_0x62e3('0x0'));exports[_0x62e3('0x1')]=function(_0x345e3d){return client[_0x62e3('0x2')](_0x62e3('0x3'),{'body':_0x345e3d,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x5ebec4,_0x577a4e){return client[_0x62e3('0x2')](_0x62e3('0x4'),{'body':_0x577a4e,'options':{'where':{'uniqueid':_0x5ebec4},'order':[['id','DESC']],'limit':0x1},'log':_0x62e3('0x4')});}; \ No newline at end of file +var _0xbb6c=['Request','UpdateOpenchannelQueueReport','DESC','../client','CreateOpenchannelQueueReport','update'];(function(_0x2e248b,_0x399e4e){var _0x349165=function(_0x230503){while(--_0x230503){_0x2e248b['push'](_0x2e248b['shift']());}};_0x349165(++_0x399e4e);}(_0xbb6c,0xb1));var _0xcbb6=function(_0xd6640b,_0x475e47){_0xd6640b=_0xd6640b-0x0;var _0x4c843e=_0xbb6c[_0xd6640b];return _0x4c843e;};'use strict';var client=require(_0xcbb6('0x0'));exports['create']=function(_0x60794d){return client['Request'](_0xcbb6('0x1'),{'body':_0x60794d,'log':'CreateOpenchannelQueueReport'});};exports[_0xcbb6('0x2')]=function(_0x1fa5fd,_0x488aac){return client[_0xcbb6('0x3')](_0xcbb6('0x4'),{'body':_0x488aac,'options':{'where':{'uniqueid':_0x1fa5fd},'order':[['id',_0xcbb6('0x5')]],'limit':0x1},'log':_0xcbb6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 191178b..7aee37f 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 _0xb6d7=['addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb6d7,0x101));var _0x7b6d=function(_0x2eeb8f,_0x583221){_0x2eeb8f=_0x2eeb8f-0x0;var _0x5302ee=_0xb6d7[_0x2eeb8f];return _0x5302ee;};'use strict';var client=require(_0x7b6d('0x0'));exports[_0x7b6d('0x1')]=function(_0x2a971e,_0x3052a2){return client[_0x7b6d('0x2')](_0x7b6d('0x3'),{'body':_0x3052a2,'options':{'where':{'id':_0x2a971e}},'log':_0x7b6d('0x4')});};exports[_0x7b6d('0x5')]=function(_0x2973fc,_0x3a9d62){return client[_0x7b6d('0x2')](_0x7b6d('0x6'),{'body':_0x3a9d62,'options':{'where':{'id':_0x2973fc}},'log':_0x7b6d('0x7')});}; \ No newline at end of file +var _0xb835=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb835,0xcd));var _0x5b83=function(_0x17945c,_0x3f5f4d){_0x17945c=_0x17945c-0x0;var _0xfee748=_0xb835[_0x17945c];return _0xfee748;};'use strict';var client=require(_0x5b83('0x0'));exports[_0x5b83('0x1')]=function(_0x1a2cc,_0x185a86){return client[_0x5b83('0x2')](_0x5b83('0x3'),{'body':_0x185a86,'options':{'where':{'id':_0x1a2cc}},'log':_0x5b83('0x4')});};exports[_0x5b83('0x5')]=function(_0x2f0f36,_0x4ac305){return client['Request'](_0x5b83('0x6'),{'body':_0x4ac305,'options':{'where':{'id':_0x2f0f36}},'log':_0x5b83('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f4e3ec9..2f572c9 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 _0x4119=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x27ec70,_0x38f5f4){var _0x4547b6=function(_0x15688d){while(--_0x15688d){_0x27ec70['push'](_0x27ec70['shift']());}};_0x4547b6(++_0x38f5f4);}(_0x4119,0xfa));var _0x9411=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x4119[_0x4ae625];return _0x31accf;};'use strict';var client=require(_0x9411('0x0'));exports[_0x9411('0x1')]=function(_0x6cbb18){return client[_0x9411('0x2')](_0x9411('0x3'),{'body':_0x6cbb18,'log':_0x9411('0x4')});}; \ No newline at end of file +var _0x7192=['create','Request','createSmsMessage'];(function(_0x2019b8,_0x436e4d){var _0x362e88=function(_0x34177c){while(--_0x34177c){_0x2019b8['push'](_0x2019b8['shift']());}};_0x362e88(++_0x436e4d);}(_0x7192,0x1ad));var _0x2719=function(_0x2726d2,_0x9a9265){_0x2726d2=_0x2726d2-0x0;var _0x2c7df4=_0x7192[_0x2726d2];return _0x2c7df4;};'use strict';var client=require('../client');exports[_0x2719('0x0')]=function(_0x3b1e86){return client[_0x2719('0x1')]('CreateSmsMessage',{'body':_0x3b1e86,'log':_0x2719('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 30ff927..e567faa 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 _0x8a62=['Request','GetSmsQueue','name','timeout','User','Agents','online','smsPause','getSmsQueues','../client'];(function(_0x5d277d,_0x4b9379){var _0x37a5b5=function(_0x33c233){while(--_0x33c233){_0x5d277d['push'](_0x5d277d['shift']());}};_0x37a5b5(++_0x4b9379);}(_0x8a62,0x18f));var _0x28a6=function(_0xd3259c,_0x3e19b2){_0xd3259c=_0xd3259c-0x0;var _0x340e5d=_0x8a62[_0xd3259c];return _0x340e5d;};'use strict';var client=require(_0x28a6('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x28a6('0x1')](_0x28a6('0x2'),{'options':{'raw':![],'attributes':['id',_0x28a6('0x3'),_0x28a6('0x4'),'strategy'],'include':[{'model':_0x28a6('0x5'),'as':_0x28a6('0x6'),'attributes':['id',_0x28a6('0x3'),_0x28a6('0x7'),_0x28a6('0x8')]}]},'log':_0x28a6('0x9')});};}; \ No newline at end of file +var _0x9780=['GetSmsQueue','name','timeout','Agents','online','getSmsQueues','Request'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0x9780,0x14e));var _0x0978=function(_0x54b749,_0x45913f){_0x54b749=_0x54b749-0x0;var _0x5a1b77=_0x9780[_0x54b749];return _0x5a1b77;};'use strict';var client=require('../client');exports[_0x0978('0x0')]=function(){return function(){return client[_0x0978('0x1')](_0x0978('0x2'),{'options':{'raw':![],'attributes':['id',_0x0978('0x3'),_0x0978('0x4'),'strategy'],'include':[{'model':'User','as':_0x0978('0x5'),'attributes':['id',_0x0978('0x3'),_0x0978('0x6'),'smsPause']}]},'log':_0x0978('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a1be1d1..ec97b93 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 _0x0733=['DESC','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0xad15c0,_0x3c992f){var _0x573458=function(_0x1c4caf){while(--_0x1c4caf){_0xad15c0['push'](_0xad15c0['shift']());}};_0x573458(++_0x3c992f);}(_0x0733,0xc4));var _0x3073=function(_0x5203a9,_0x588b62){_0x5203a9=_0x5203a9-0x0;var _0x47c2d1=_0x0733[_0x5203a9];return _0x47c2d1;};'use strict';var client=require('../client');exports['create']=function(_0x35253e){return client[_0x3073('0x0')](_0x3073('0x1'),{'body':_0x35253e,'log':'CreateSmsQueueReport'});};exports[_0x3073('0x2')]=function(_0x441cd2,_0x5f2625){return client[_0x3073('0x0')](_0x3073('0x3'),{'body':_0x5f2625,'options':{'where':{'uniqueid':_0x441cd2},'order':[['id',_0x3073('0x4')]],'limit':0x1},'log':_0x3073('0x3')});}; \ No newline at end of file +var _0xd125=['create','Request','DESC','UpdateSmsQueueReport','../client'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0xd125,0x176));var _0x5d12=function(_0x22ff76,_0x192835){_0x22ff76=_0x22ff76-0x0;var _0x457a1b=_0xd125[_0x22ff76];return _0x457a1b;};'use strict';var client=require(_0x5d12('0x0'));exports[_0x5d12('0x1')]=function(_0x5b0415){return client[_0x5d12('0x2')]('CreateSmsQueueReport',{'body':_0x5b0415,'log':'CreateSmsQueueReport'});};exports['update']=function(_0x2cc289,_0x43ddfe){return client[_0x5d12('0x2')]('UpdateSmsQueueReport',{'body':_0x43ddfe,'options':{'where':{'uniqueid':_0x2cc289},'order':[['id',_0x5d12('0x3')]],'limit':0x1},'log':_0x5d12('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2eb13f0..c452cf0 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 _0x294e=['smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','name','online','pauseType','lastPauseAt','chatPause','mailPause','faxPause'];(function(_0x509779,_0x43c636){var _0x44c6bb=function(_0x1e793d){while(--_0x1e793d){_0x509779['push'](_0x509779['shift']());}};_0x44c6bb(++_0x43c636);}(_0x294e,0xb4));var _0xe294=function(_0x114fe8,_0x1ef248){_0x114fe8=_0x114fe8-0x0;var _0xe70180=_0x294e[_0x114fe8];return _0xe70180;};'use strict';var client=require(_0xe294('0x0'));exports[_0xe294('0x1')]=function(){return function(){return client[_0xe294('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xe294('0x3'),_0xe294('0x4'),_0xe294('0x5'),_0xe294('0x6'),'voicePause',_0xe294('0x7'),_0xe294('0x8'),_0xe294('0x9'),_0xe294('0xa'),_0xe294('0xb'),_0xe294('0xc'),_0xe294('0xd'),_0xe294('0xe'),_0xe294('0xf'),_0xe294('0x10'),_0xe294('0x11'),_0xe294('0x12')]},'log':_0xe294('0x1')});};}; \ No newline at end of file +var _0xb235=['../client','getAgents','Request','GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause','faxPause','whatsappPause','openchannelPause','mailCapacity','whatsappCapacity','openchannelCapacity'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xb235,0xd0));var _0x5b23=function(_0x485b5d,_0x5692b6){_0x485b5d=_0x485b5d-0x0;var _0xa90291=_0xb235[_0x485b5d];return _0xa90291;};'use strict';var client=require(_0x5b23('0x0'));exports[_0x5b23('0x1')]=function(){return function(){return client[_0x5b23('0x2')](_0x5b23('0x3'),{'options':{'raw':!![],'where':{'role':_0x5b23('0x4')},'attributes':['id',_0x5b23('0x5'),'online',_0x5b23('0x6'),_0x5b23('0x7'),_0x5b23('0x8'),_0x5b23('0x9'),'mailPause',_0x5b23('0xa'),'smsPause',_0x5b23('0xb'),_0x5b23('0xc'),'chatCapacity',_0x5b23('0xd'),'faxCapacity','smsCapacity',_0x5b23('0xe'),_0x5b23('0xf')]},'log':_0x5b23('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index d6faa32..d8a2c87 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 _0xa588=['addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x477394,_0x6689f1){var _0x4f7160=function(_0x1a05ba){while(--_0x1a05ba){_0x477394['push'](_0x477394['shift']());}};_0x4f7160(++_0x6689f1);}(_0xa588,0xe1));var _0x8a58=function(_0xf3c843,_0x8ff24e){_0xf3c843=_0xf3c843-0x0;var _0x3191c6=_0xa588[_0xf3c843];return _0x3191c6;};'use strict';var client=require('../client');exports[_0x8a58('0x0')]=function(_0x3c5387,_0xd12c46){return client[_0x8a58('0x1')](_0x8a58('0x2'),{'body':_0xd12c46,'options':{'where':{'id':_0x3c5387}},'log':_0x8a58('0x3')});};exports[_0x8a58('0x4')]=function(_0x88d792,_0x40b4f0){return client['Request'](_0x8a58('0x5'),{'body':_0x40b4f0,'options':{'where':{'id':_0x88d792}},'log':_0x8a58('0x6')});}; \ No newline at end of file +var _0xa25a=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x41eb25,_0x528852){var _0x4bfa53=function(_0x5490ac){while(--_0x5490ac){_0x41eb25['push'](_0x41eb25['shift']());}};_0x4bfa53(++_0x528852);}(_0xa25a,0x160));var _0xaa25=function(_0x86ceed,_0x2d0ea3){_0x86ceed=_0x86ceed-0x0;var _0x203d3f=_0xa25a[_0x86ceed];return _0x203d3f;};'use strict';var client=require(_0xaa25('0x0'));exports[_0xaa25('0x1')]=function(_0x212df1,_0x22c967){return client[_0xaa25('0x2')](_0xaa25('0x3'),{'body':_0x22c967,'options':{'where':{'id':_0x212df1}},'log':_0xaa25('0x4')});};exports[_0xaa25('0x5')]=function(_0x1aa8a8,_0x5da771){return client['Request'](_0xaa25('0x6'),{'body':_0x5da771,'options':{'where':{'id':_0x1aa8a8}},'log':_0xaa25('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b80353e..f9fcb97 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 _0xcda5=['create','Request'];(function(_0x17f3c6,_0x8a2702){var _0x45db94=function(_0x376cfa){while(--_0x376cfa){_0x17f3c6['push'](_0x17f3c6['shift']());}};_0x45db94(++_0x8a2702);}(_0xcda5,0x100));var _0x5cda=function(_0x6ce7ce,_0x58304d){_0x6ce7ce=_0x6ce7ce-0x0;var _0x50732d=_0xcda5[_0x6ce7ce];return _0x50732d;};'use strict';var client=require('../client');exports[_0x5cda('0x0')]=function(_0x529337){return client[_0x5cda('0x1')]('CreateWhatsappMessage',{'body':_0x529337,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x995a=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x399147,_0x9e8ff8){var _0x1d333e=function(_0x48395a){while(--_0x48395a){_0x399147['push'](_0x399147['shift']());}};_0x1d333e(++_0x9e8ff8);}(_0x995a,0x91));var _0xa995=function(_0x4c858d,_0x7b6436){_0x4c858d=_0x4c858d-0x0;var _0x368363=_0x995a[_0x4c858d];return _0x368363;};'use strict';var client=require(_0xa995('0x0'));exports[_0xa995('0x1')]=function(_0x2cb92c){return client['Request'](_0xa995('0x2'),{'body':_0x2cb92c,'log':_0xa995('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 4b9320b..63e33b3 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 _0xefda=['name','strategy','User','Agents','online','whatsappPause','../client','GetWhatsappQueue'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0xefda,0x96));var _0xaefd=function(_0x27c4e3,_0x3ce966){_0x27c4e3=_0x27c4e3-0x0;var _0x9d7008=_0xefda[_0x27c4e3];return _0x9d7008;};'use strict';var client=require(_0xaefd('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xaefd('0x1'),{'options':{'raw':![],'attributes':['id',_0xaefd('0x2'),'timeout',_0xaefd('0x3')],'include':[{'model':_0xaefd('0x4'),'as':_0xaefd('0x5'),'attributes':['id',_0xaefd('0x2'),_0xaefd('0x6'),_0xaefd('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x7d25=['GetWhatsappQueue','name','timeout','strategy','User','getWhatsappQueues','Request'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7d25,0x8a));var _0x57d2=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7d25[_0x5d6456];return _0x4d66c1;};'use strict';var client=require('../client');exports[_0x57d2('0x0')]=function(){return function(){return client[_0x57d2('0x1')](_0x57d2('0x2'),{'options':{'raw':![],'attributes':['id',_0x57d2('0x3'),_0x57d2('0x4'),_0x57d2('0x5')],'include':[{'model':_0x57d2('0x6'),'as':'Agents','attributes':['id','name','online','whatsappPause']}]},'log':_0x57d2('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 8183278..31c11e2 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 _0x378e=['UpdateWhatsappQueueReport','DESC','../client','CreateWhatsappQueueReport','update','Request'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x378e,0xce));var _0xe378=function(_0x135b26,_0x55cf7e){_0x135b26=_0x135b26-0x0;var _0x2170f7=_0x378e[_0x135b26];return _0x2170f7;};'use strict';var client=require(_0xe378('0x0'));exports['create']=function(_0x5ef50d){return client['Request'](_0xe378('0x1'),{'body':_0x5ef50d,'log':'CreateWhatsappQueueReport'});};exports[_0xe378('0x2')]=function(_0x2c8511,_0x192a91){return client[_0xe378('0x3')](_0xe378('0x4'),{'body':_0x192a91,'options':{'where':{'uniqueid':_0x2c8511},'order':[['id',_0xe378('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x06bc=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','create'];(function(_0x2b8a8f,_0xdcde4e){var _0xf20558=function(_0x598aec){while(--_0x598aec){_0x2b8a8f['push'](_0x2b8a8f['shift']());}};_0xf20558(++_0xdcde4e);}(_0x06bc,0x112));var _0xc06b=function(_0x4b1033,_0x46e9ad){_0x4b1033=_0x4b1033-0x0;var _0x43ceee=_0x06bc[_0x4b1033];return _0x43ceee;};'use strict';var client=require('../client');exports[_0xc06b('0x0')]=function(_0x2ae3d4){return client[_0xc06b('0x1')]('CreateWhatsappQueueReport',{'body':_0x2ae3d4,'log':_0xc06b('0x2')});};exports['update']=function(_0x36aabf,_0x2c7298){return client[_0xc06b('0x1')](_0xc06b('0x3'),{'body':_0x2c7298,'options':{'where':{'uniqueid':_0x36aabf},'order':[['id',_0xc06b('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 500cfa2..6035b2d 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 _0xa751=['createQueue','atimeout','channel','START:%s','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout'];(function(_0x1f3e60,_0x2c40a7){var _0x11d508=function(_0x2b447a){while(--_0x2b447a){_0x1f3e60['push'](_0x1f3e60['shift']());}};_0x11d508(++_0x2c40a7);}(_0xa751,0x10b));var _0x1a75=function(_0x4693ca,_0x4bfc13){_0x4693ca=_0x4693ca-0x0;var _0x43192c=_0xa751[_0x4693ca];return _0x43192c;};'use strict';var schema=require(_0x1a75('0x0'));var _=require(_0x1a75('0x1'));var util=require('util');var seqqueue=require(_0x1a75('0x2'));var logger=require(_0x1a75('0x3'))(_0x1a75('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x1a75('0x5'),'required':!![],'message':_0x1a75('0x6')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x259ec5,_0x1f4382,_0x905abd){return logger[_0x1a75('0x7')](util[_0x1a75('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x259ec5,_0x1f4382[_0x1a75('0x9')],_0x905abd));}function handleFindAgent(_0x4548a2){return function(_0x498e05){return _0x498e05[_0x1a75('0x9')][_0x1a75('0xa')]()===_0x4548a2[_0x1a75('0xa')]();};}exports[_0x1a75('0xb')]=function(_0x1f3bb3,_0x1cb72e,_0x296b7a,_0x2e35e8){return function(_0x2a1765){try{var _0x56f33b={'name':_0x1cb72e[0x0],'timeout':_0x1cb72e[0x1]};var _0x11f4b7=queue[_0x1a75('0x0')](_0x56f33b,{'typecast':!![]});if(_0x11f4b7[_0x1a75('0xc')]){logger[_0x1a75('0xd')](_0x1a75('0xe'),_0x1f3bb3,_[_0x1a75('0xf')](_0x11f4b7,_0x1a75('0x10'))[_0x1a75('0x11')](',\x20'));_0x2a1765[_0x1a75('0x12')]();}else{var _0x29d2b0=_['find'](_0x296b7a[_0x1a75('0x13')],handleFindAgent(_0x56f33b[_0x1a75('0x9')]));if(_0x29d2b0){var _0x26ea6a=(_0x56f33b[_0x1a75('0x14')]||0xa)*0x3e8;var _0x55adec,_0x478635;var _0x22c696=seqqueue[_0x1a75('0x15')](_0x26ea6a);_0x22c696['id']=_0x1f3bb3;_0x22c696[_0x1a75('0x16')]=_0x26ea6a;_0x22c696[_0x1a75('0x17')]=_0x2e35e8[_0x1a75('0x17')];writeLog(_0x1f3bb3,_0x29d2b0,util['format'](_0x1a75('0x18'),_0x26ea6a));_0x296b7a['rules'][_0x1f3bb3]['on']('end',function(){logger[_0x1a75('0x7')](_0x1a75('0x19'),_0x1f3bb3);clearTimeout(_0x478635);_0x478635=undefined;_0x22c696[_0x1a75('0x1a')]();if(_0x296b7a['rules'][_0x1f3bb3]){delete _0x296b7a['rules'][_0x1f3bb3];}_0x2a1765[_0x1a75('0x12')]();});_0x296b7a['rules'][_0x1f3bb3]['on']('complete',function(){if(_0x296b7a['rules'][_0x1f3bb3]){delete _0x296b7a['rules'][_0x1f3bb3];}});_0x478635=setTimeout(function(){logger['info'](_0x1a75('0x1b'),_0x1f3bb3);clearTimeout(_0x478635);_0x22c696[_0x1a75('0x1a')]();_0x2a1765['next']();},_0x26ea6a);strategy[_0x1a75('0x1c')](_0x22c696,_0x29d2b0,_0x296b7a,_0x2e35e8);}else{logger['error'](_0x1a75('0x1d'),_0x1f3bb3,_0x56f33b[_0x1a75('0x9')]);_0x2a1765[_0x1a75('0x12')]();}}}catch(_0x5f08f8){console['log'](_0x5f08f8);logger[_0x1a75('0xd')](_0x1a75('0x1e'),_0x1f3bb3,_0x5f08f8[_0x1a75('0x1f')]);_0x2a1765[_0x1a75('0x12')]();}};}; \ No newline at end of file +var _0xb51f=['stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error'];(function(_0x1fb97b,_0x15284e){var _0x3e3b3d=function(_0x393bdf){while(--_0x393bdf){_0x1fb97b['push'](_0x1fb97b['shift']());}};_0x3e3b3d(++_0x15284e);}(_0xb51f,0x6d));var _0xfb51=function(_0x1a3c28,_0x4d892e){_0x1a3c28=_0x1a3c28-0x0;var _0x259952=_0xb51f[_0x1a3c28];return _0x259952;};'use strict';var schema=require(_0xfb51('0x0'));var _=require(_0xfb51('0x1'));var util=require(_0xfb51('0x2'));var seqqueue=require(_0xfb51('0x3'));var logger=require(_0xfb51('0x4'))(_0xfb51('0x5'));var strategy=require(_0xfb51('0x6'));var queue=schema({'name':{'type':_0xfb51('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xfb51('0x8'),'message':_0xfb51('0x9')}});function writeLog(_0x1e0033,_0x567ef8,_0x5e303b){return logger[_0xfb51('0xa')](util[_0xfb51('0xb')](_0xfb51('0xc'),_0x1e0033,_0x567ef8[_0xfb51('0xd')],_0x5e303b));}function handleFindAgent(_0x1f22d7){return function(_0x148df9){return _0x148df9[_0xfb51('0xd')]['toLowerCase']()===_0x1f22d7[_0xfb51('0xe')]();};}exports['consequence']=function(_0xfe42f5,_0x26495f,_0x31e4dd,_0x55fc5b){return function(_0x11b5e5){try{var _0x38d3c6={'name':_0x26495f[0x0],'timeout':_0x26495f[0x1]};var _0x376c58=queue[_0xfb51('0x0')](_0x38d3c6,{'typecast':!![]});if(_0x376c58[_0xfb51('0xf')]){logger['error'](_0xfb51('0x10'),_0xfe42f5,_['map'](_0x376c58,_0xfb51('0x11'))[_0xfb51('0x12')](',\x20'));_0x11b5e5[_0xfb51('0x13')]();}else{var _0x12d050=_[_0xfb51('0x14')](_0x31e4dd[_0xfb51('0x15')],handleFindAgent(_0x38d3c6[_0xfb51('0xd')]));if(_0x12d050){var _0x1dc4a3=(_0x38d3c6[_0xfb51('0x16')]||0xa)*0x3e8;var _0x5ddf75,_0x4a67c9;var _0x2e1ff3=seqqueue[_0xfb51('0x17')](_0x1dc4a3);_0x2e1ff3['id']=_0xfe42f5;_0x2e1ff3[_0xfb51('0x18')]=_0x1dc4a3;_0x2e1ff3[_0xfb51('0x19')]=_0x55fc5b[_0xfb51('0x19')];writeLog(_0xfe42f5,_0x12d050,util[_0xfb51('0xb')]('START:%s',_0x1dc4a3));_0x31e4dd[_0xfb51('0x1a')][_0xfe42f5]['on'](_0xfb51('0x1b'),function(){logger['info'](_0xfb51('0x1c'),_0xfe42f5);clearTimeout(_0x4a67c9);_0x4a67c9=undefined;_0x2e1ff3[_0xfb51('0x1d')]();if(_0x31e4dd[_0xfb51('0x1a')][_0xfe42f5]){delete _0x31e4dd[_0xfb51('0x1a')][_0xfe42f5];}_0x11b5e5[_0xfb51('0x13')]();});_0x31e4dd['rules'][_0xfe42f5]['on'](_0xfb51('0x1e'),function(){if(_0x31e4dd[_0xfb51('0x1a')][_0xfe42f5]){delete _0x31e4dd['rules'][_0xfe42f5];}});_0x4a67c9=setTimeout(function(){logger[_0xfb51('0xa')](_0xfb51('0x1f'),_0xfe42f5);clearTimeout(_0x4a67c9);_0x2e1ff3['close']();_0x11b5e5['next']();},_0x1dc4a3);strategy['agent'](_0x2e1ff3,_0x12d050,_0x31e4dd,_0x55fc5b);}else{logger['error'](_0xfb51('0x20'),_0xfe42f5,_0x38d3c6[_0xfb51('0xd')]);_0x11b5e5[_0xfb51('0x13')]();}}}catch(_0x439203){console[_0xfb51('0x21')](_0x439203);logger[_0xfb51('0x22')]('[%s][QUEUE]\x20%s',_0xfe42f5,_0x439203[_0xfb51('0x23')]);_0x11b5e5[_0xfb51('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 a51b0ee..3503108 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 _0xf6cf=['stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','body','toString','postText','message','amazonlex','providerResponse','stringify','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','then','catch','error','finally'];(function(_0xee3051,_0xbe4f18){var _0x139e81=function(_0xac81c3){while(--_0xac81c3){_0xee3051['push'](_0xee3051['shift']());}};_0x139e81(++_0xbe4f18);}(_0xf6cf,0x9c));var _0xff6c=function(_0x4c1bd2,_0xc2047c){_0x4c1bd2=_0x4c1bd2-0x0;var _0x5b7235=_0xf6cf[_0x4c1bd2];return _0x5b7235;};'use strict';var _=require(_0xff6c('0x0'));var moment=require(_0xff6c('0x1'));var AWS=require(_0xff6c('0x2'));var utils=require('./utils');var logger=require(_0xff6c('0x3'))(_0xff6c('0x4'));var rpc={'chatMessage':require(_0xff6c('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xff6c('0x6')),'smsMessage':require(_0xff6c('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xff6c('0x8'))};exports[_0xff6c('0x9')]=function(_0x410ab2,_0x450cba){return function(_0x566bfb){try{if(!_[_0xff6c('0xa')](this['interaction'][_0xff6c('0xb')])){logger[_0xff6c('0xc')](_0xff6c('0xd'),_0x410ab2,_0xff6c('0xe'));return _0x566bfb[_0xff6c('0xf')]();}var _0x2a4393={'ContactId':this[_0xff6c('0x10')]['id'],'sentAt':moment()[_0xff6c('0x11')](_0xff6c('0x12')),'direction':'out'};if(this[_0xff6c('0x13')]===_0xff6c('0x14')||this[_0xff6c('0x13')]===_0xff6c('0x15')){_0x2a4393[_0xff6c('0x16')]=this[_0xff6c('0x17')]['phone'];}var _0x52f03c=this[_0xff6c('0x13')];if(_0x52f03c===_0xff6c('0x18')){_0x2a4393[_0xff6c('0x19')]=this['account']['id'];}else{_0x2a4393[_[_0xff6c('0x1a')](_0x52f03c)+'AccountId']=this['account']['id'];}_0x2a4393[_['upperFirst'](_0x52f03c)+_0xff6c('0x1b')]=this['interaction']['id'];if(this[_0xff6c('0x17')]['created']){var _0x6e4b21=_0x450cba[0x4];if(!_[_0xff6c('0x1c')](_0x6e4b21)){_0x2a4393['body']=utils[_0xff6c('0x1d')](_0x6e4b21,this);return rpc[_0x52f03c+_0xff6c('0x1e')][_0xff6c('0x1f')](_0x2a4393)[_0xff6c('0x20')](function(_0x188d12){logger[_0xff6c('0xc')](_0xff6c('0xd'),_0x410ab2,_0x2a4393['body']);})[_0xff6c('0x21')](function(_0x5cf49d){logger[_0xff6c('0x22')]('[%s][AMAZONLEX]\x20%s',_0x410ab2,JSON['stringify'](_0x5cf49d));})[_0xff6c('0x23')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x410ab2);_0x566bfb[_0xff6c('0x24')]();});}else{logger[_0xff6c('0xc')](_0xff6c('0x25'),_0x410ab2);_0x566bfb[_0xff6c('0x24')]();}}else{var _0x4654c5=this;var _0x3d6d09=new AWS[(_0xff6c('0x26'))]({'accessKeyId':_0x450cba[0x0],'secretAccessKey':_0x450cba[0x1],'region':_0x450cba[0x2]});var _0x28e959={'botAlias':'$LATEST','botName':_0x450cba[0x3],'inputText':this['message'][_0xff6c('0x27')],'userId':this['channel']+':'+this[_0xff6c('0x17')]['id'][_0xff6c('0x28')]()};_0x3d6d09[_0xff6c('0x29')](_0x28e959,function(_0x30788d,_0x3d5f5a){if(_0x30788d){logger[_0xff6c('0x22')](_0xff6c('0xd'),_0x410ab2,_0x30788d[_0xff6c('0x2a')]);_0x566bfb[_0xff6c('0xf')]();}else if(_0x3d5f5a&&_0x3d5f5a[_0xff6c('0x2a')]){_0x4654c5[_0xff6c('0x27')][_0xff6c('0x2b')]=_0x3d5f5a;_0x2a4393['body']=_0x3d5f5a[_0xff6c('0x2a')];_0x2a4393['providerName']=_0xff6c('0x2b');_0x2a4393[_0xff6c('0x2c')]=JSON[_0xff6c('0x2d')](_0x3d5f5a);return rpc[_0x52f03c+_0xff6c('0x1e')]['create'](_0x2a4393)['then'](function(_0x550bd5){logger[_0xff6c('0xc')]('[%s][AMAZONLEX]\x20%s',_0x410ab2,_0x2a4393[_0xff6c('0x27')]);if(_0x3d5f5a[_0xff6c('0x2e')]==_0xff6c('0x2f')){_0x566bfb[_0xff6c('0xf')]();}else{_0x566bfb[_0xff6c('0x24')]();}})[_0xff6c('0x21')](function(_0x25174e){logger['error'](_0xff6c('0xd'),_0x410ab2,JSON[_0xff6c('0x2d')](_0x25174e));_0x566bfb[_0xff6c('0xf')]();});}else{_0x566bfb[_0xff6c('0xf')]();}});}}catch(_0xe7b848){logger[_0xff6c('0x22')](_0xff6c('0xd'),_0x410ab2,JSON[_0xff6c('0x2d')](_0xe7b848));_0x566bfb[_0xff6c('0x24')]();}};}; \ No newline at end of file +var _0xa85a=['getMustacheRender','Message','then','[%s][AMAZONLEX]\x20%s','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','create','Failed','stringify','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body'];(function(_0x51bb21,_0x24b883){var _0x32b102=function(_0x16035e){while(--_0x16035e){_0x51bb21['push'](_0x51bb21['shift']());}};_0x32b102(++_0x24b883);}(_0xa85a,0x10f));var _0xaa85=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xa85a[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var moment=require(_0xaa85('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xaa85('0x1'))(_0xaa85('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaa85('0x3')),'mailMessage':require(_0xaa85('0x4')),'smsMessage':require(_0xaa85('0x5')),'faxMessage':require(_0xaa85('0x6')),'whatsappMessage':require(_0xaa85('0x7'))};exports[_0xaa85('0x8')]=function(_0x2cb2a4,_0x291e7f){return function(_0x51bcff){try{if(!_[_0xaa85('0x9')](this[_0xaa85('0xa')]['UserId'])){logger[_0xaa85('0xb')]('[%s][AMAZONLEX]\x20%s',_0x2cb2a4,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x51bcff[_0xaa85('0xc')]();}var _0x204088={'ContactId':this[_0xaa85('0xd')]['id'],'sentAt':moment()[_0xaa85('0xe')](_0xaa85('0xf')),'direction':'out'};if(this[_0xaa85('0x10')]===_0xaa85('0x11')||this['channel']===_0xaa85('0x12')){_0x204088['phone']=this[_0xaa85('0xa')][_0xaa85('0x13')];}var _0x254a26=this[_0xaa85('0x10')];if(_0x254a26===_0xaa85('0x14')){_0x204088[_0xaa85('0x15')]=this['account']['id'];}else{_0x204088[_[_0xaa85('0x16')](_0x254a26)+_0xaa85('0x17')]=this[_0xaa85('0x18')]['id'];}_0x204088[_[_0xaa85('0x16')](_0x254a26)+_0xaa85('0x19')]=this[_0xaa85('0xa')]['id'];if(this['interaction'][_0xaa85('0x1a')]){var _0x5c9d0e=_0x291e7f[0x4];if(!_[_0xaa85('0x1b')](_0x5c9d0e)){_0x204088[_0xaa85('0x1c')]=utils[_0xaa85('0x1d')](_0x5c9d0e,this);return rpc[_0x254a26+_0xaa85('0x1e')]['create'](_0x204088)[_0xaa85('0x1f')](function(_0x58e8db){logger[_0xaa85('0xb')](_0xaa85('0x20'),_0x2cb2a4,_0x204088[_0xaa85('0x1c')]);})[_0xaa85('0x21')](function(_0x2523b1){logger[_0xaa85('0x22')](_0xaa85('0x20'),_0x2cb2a4,JSON['stringify'](_0x2523b1));})[_0xaa85('0x23')](function(){logger[_0xaa85('0xb')](_0xaa85('0x24'),_0x2cb2a4);_0x51bcff[_0xaa85('0x25')]();});}else{logger[_0xaa85('0xb')](_0xaa85('0x26'),_0x2cb2a4);_0x51bcff['stop']();}}else{var _0x10f7b5=this;var _0x110348=new AWS[(_0xaa85('0x27'))]({'accessKeyId':_0x291e7f[0x0],'secretAccessKey':_0x291e7f[0x1],'region':_0x291e7f[0x2]});var _0x54d0d7={'botAlias':_0xaa85('0x28'),'botName':_0x291e7f[0x3],'inputText':this[_0xaa85('0x29')][_0xaa85('0x1c')],'userId':this[_0xaa85('0x10')]+':'+this[_0xaa85('0xa')]['id'][_0xaa85('0x2a')]()};_0x110348[_0xaa85('0x2b')](_0x54d0d7,function(_0x3597b9,_0x5629d8){if(_0x3597b9){logger['error'](_0xaa85('0x20'),_0x2cb2a4,_0x3597b9[_0xaa85('0x29')]);_0x51bcff[_0xaa85('0xc')]();}else if(_0x5629d8&&_0x5629d8[_0xaa85('0x29')]){_0x10f7b5['body'][_0xaa85('0x2c')]=_0x5629d8;_0x204088['body']=_0x5629d8[_0xaa85('0x29')];_0x204088[_0xaa85('0x2d')]=_0xaa85('0x2c');_0x204088[_0xaa85('0x2e')]=JSON['stringify'](_0x5629d8);return rpc[_0x254a26+'Message'][_0xaa85('0x2f')](_0x204088)[_0xaa85('0x1f')](function(_0x967ed3){logger[_0xaa85('0xb')](_0xaa85('0x20'),_0x2cb2a4,_0x204088['body']);if(_0x5629d8['dialogState']==_0xaa85('0x30')){_0x51bcff[_0xaa85('0xc')]();}else{_0x51bcff[_0xaa85('0x25')]();}})[_0xaa85('0x21')](function(_0x40d901){logger[_0xaa85('0x22')](_0xaa85('0x20'),_0x2cb2a4,JSON['stringify'](_0x40d901));_0x51bcff[_0xaa85('0xc')]();});}else{_0x51bcff['next']();}});}}catch(_0x5bc119){logger[_0xaa85('0x22')](_0xaa85('0x20'),_0x2cb2a4,JSON[_0xaa85('0x31')](_0x5bc119));_0x51bcff[_0xaa85('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 445d755..216c499 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 _0xb98e=['finally','next','error','stop','lodash','moment','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','upperFirst','InteractionId','Message','account','Smtp','service','host','port','secure','authentication','auth','pass','inReplyTo','messageId','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xb98e,0x184));var _0xeb98=function(_0xff6f8b,_0x538976){_0xff6f8b=_0xff6f8b-0x0;var _0x55974b=_0xb98e[_0xff6f8b];return _0x55974b;};'use strict';var _=require(_0xeb98('0x0'));var moment=require(_0xeb98('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xeb98('0x2'));var rpc={'chatMessage':require(_0xeb98('0x3')),'openchannelMessage':require(_0xeb98('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xeb98('0x5')),'faxMessage':require(_0xeb98('0x6')),'whatsappMessage':require(_0xeb98('0x7'))};var mailRpc=require('../../mailRpc');exports[_0xeb98('0x8')]=function(_0x5d12df,_0x4a7e79){return function(_0x47c83f){try{if(_0x4a7e79[0x0]==='1'&&(_[_0xeb98('0x9')](this[_0xeb98('0xa')][_0xeb98('0xb')])||!this[_0xeb98('0xa')][_0xeb98('0xb')])){logger[_0xeb98('0xc')](_0xeb98('0xd'),_0x5d12df,_0xeb98('0xe'));return _0x47c83f['next']();}var _0x28483=this[_0xeb98('0xf')];var _0x320092={'ContactId':this[_0xeb98('0x10')]['id'],'sentAt':moment()[_0xeb98('0x11')](_0xeb98('0x12')),'direction':_0xeb98('0x13')};if(this[_0xeb98('0xf')]===_0xeb98('0x14')){_0x320092[_0xeb98('0x15')]=utils[_0xeb98('0x16')](_0x4a7e79[0x2],this);}else{_0x320092['body']=utils[_0xeb98('0x16')](_0x4a7e79[0x1],this);}if(this[_0xeb98('0x17')]){_0x320092['to']=this['message']['from']||'';if(this[_0xeb98('0xf')]===_0xeb98('0x14')&&_0x4a7e79[0x1]==='1'){_0x320092['cc']=this[_0xeb98('0x17')]['cc']||'';}_0x320092[_0xeb98('0x18')]=this[_0xeb98('0x17')]['to']||'';_0x320092[_0xeb98('0x19')]=this[_0xeb98('0x17')][_0xeb98('0x19')]||'';_0x320092[_0xeb98('0x1a')]=!![];if(this[_0xeb98('0x17')][_0xeb98('0x1b')]){_0x320092[_0xeb98('0x1b')]='';_0x320092[_0xeb98('0x1b')]+=_[_0xeb98('0x1c')](this[_0xeb98('0x17')][_0xeb98('0x1b')],_0xeb98('0x1d'))?'':_0xeb98('0x1e');_0x320092[_0xeb98('0x1b')]+=this[_0xeb98('0x17')]['subject'];}}if(this[_0xeb98('0xf')]===_0xeb98('0x1f')){_0x320092['ChatWebsiteId']=this['account']['id'];}else{_0x320092[_[_0xeb98('0x20')](this[_0xeb98('0xf')])+'AccountId']=this['account']['id'];}_0x320092[_[_0xeb98('0x20')](this['channel'])+_0xeb98('0x21')]=this[_0xeb98('0xa')]['id'];if(rpc[this['channel']+_0xeb98('0x22')]){if(this[_0xeb98('0xf')]===_0xeb98('0x14')){var _0x131128={'tls':{'rejectUnauthorized':![]}};if(this[_0xeb98('0x23')][_0xeb98('0x24')][_0xeb98('0x25')]){_0x131128[_0xeb98('0x25')]=this[_0xeb98('0x23')][_0xeb98('0x24')][_0xeb98('0x25')];}else{_0x131128['host']=this[_0xeb98('0x23')][_0xeb98('0x24')][_0xeb98('0x26')];_0x131128[_0xeb98('0x27')]=this[_0xeb98('0x23')][_0xeb98('0x24')][_0xeb98('0x27')];_0x131128[_0xeb98('0x28')]=this[_0xeb98('0x23')][_0xeb98('0x24')][_0xeb98('0x28')];}if(this[_0xeb98('0x23')]['Smtp'][_0xeb98('0x29')]){_0x131128[_0xeb98('0x2a')]={'user':this[_0xeb98('0x23')][_0xeb98('0x24')]['user'],'pass':this[_0xeb98('0x23')][_0xeb98('0x24')][_0xeb98('0x2b')]};}_0x320092[_0xeb98('0x2c')]=this[_0xeb98('0x17')][_0xeb98('0x2d')];_0x320092['html']=''+_[_0xeb98('0x2e')](_0x320092[_0xeb98('0x15')],_0xeb98('0x2f'),_0xeb98('0x30'))+_0xeb98('0x31');_0x320092[_0xeb98('0x32')]={'Auto-Submitted':_0xeb98('0x33'),'X-Auto-Response-Suppress':_0xeb98('0x34'),'Precedence':_0xeb98('0x35')};return mailRpc[_0xeb98('0x36')](_0x131128,_0x320092)[_0xeb98('0x37')](function(_0xc1e6b8){logger[_0xeb98('0xc')](_0xeb98('0x38'),_0x5d12df);_0x320092[_0xeb98('0x2d')]=_0xc1e6b8['message'][_0xeb98('0x2d')];return rpc[_0x28483+_0xeb98('0x22')][_0xeb98('0x39')](_0x320092);})['then'](function(_0x177ce4){logger[_0xeb98('0xc')]('[%s][AUTOREPLY]\x20%s',_0x5d12df,JSON[_0xeb98('0x3a')](_0x177ce4));})[_0xeb98('0x3b')](function(_0x1e469b){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x5d12df,JSON[_0xeb98('0x3a')](_0x1e469b));})[_0xeb98('0x3c')](function(){_0x47c83f[_0xeb98('0x3d')]();});}else{return rpc[this[_0xeb98('0xf')]+'Message'][_0xeb98('0x39')](_0x320092)[_0xeb98('0x37')](function(_0x5b6693){logger[_0xeb98('0xc')]('[%s][AUTOREPLY]\x20%s',_0x5d12df,_0x320092[_0xeb98('0x15')]);})[_0xeb98('0x3b')](function(_0x2ffbdf){logger[_0xeb98('0x3e')](_0xeb98('0xd'),_0x5d12df,JSON['stringify'](_0x2ffbdf));})['finally'](function(){_0x47c83f[_0xeb98('0x3d')]();});}}}catch(_0x2e1492){logger[_0xeb98('0x3e')](_0xeb98('0xd'),_0x5d12df,JSON[_0xeb98('0x3a')](_0x2e1492));_0x47c83f[_0xeb98('0x3f')]();}};}; \ No newline at end of file +var _0x1792=['html','','replace','','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','finally','catch','error','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','created','interaction','info','[%s][AUTOREPLY]\x20%s','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','service','Smtp','host','port','secure','authentication','user','pass','inReplyTo','messageId'];(function(_0x57539e,_0x599827){var _0x22a3ad=function(_0x547b93){while(--_0x547b93){_0x57539e['push'](_0x57539e['shift']());}};_0x22a3ad(++_0x599827);}(_0x1792,0x111));var _0x2179=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0x1792[_0x3e91a9];return _0x25c9ad;};'use strict';var _=require(_0x2179('0x0'));var moment=require(_0x2179('0x1'));var utils=require('./utils');var logger=require(_0x2179('0x2'))(_0x2179('0x3'));var rpc={'chatMessage':require(_0x2179('0x4')),'openchannelMessage':require(_0x2179('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2179('0x6')),'faxMessage':require(_0x2179('0x7')),'whatsappMessage':require(_0x2179('0x8'))};var mailRpc=require(_0x2179('0x9'));exports[_0x2179('0xa')]=function(_0x2e5361,_0x3ef096){return function(_0xc50219){try{if(_0x3ef096[0x0]==='1'&&(_[_0x2179('0xb')](this['interaction'][_0x2179('0xc')])||!this[_0x2179('0xd')][_0x2179('0xc')])){logger[_0x2179('0xe')](_0x2179('0xf'),_0x2e5361,'Autoreply\x20already\x20sent');return _0xc50219[_0x2179('0x10')]();}var _0x4f15e8=this[_0x2179('0x11')];var _0x2e8ec8={'ContactId':this[_0x2179('0x12')]['id'],'sentAt':moment()['format'](_0x2179('0x13')),'direction':_0x2179('0x14')};if(this[_0x2179('0x11')]===_0x2179('0x15')){_0x2e8ec8['body']=utils['getMustacheRender'](_0x3ef096[0x2],this);}else{_0x2e8ec8[_0x2179('0x16')]=utils[_0x2179('0x17')](_0x3ef096[0x1],this);}if(this[_0x2179('0x18')]){_0x2e8ec8['to']=this[_0x2179('0x18')][_0x2179('0x19')]||'';if(this['channel']===_0x2179('0x15')&&_0x3ef096[0x1]==='1'){_0x2e8ec8['cc']=this[_0x2179('0x18')]['cc']||'';}_0x2e8ec8[_0x2179('0x19')]=this[_0x2179('0x18')]['to']||'';_0x2e8ec8[_0x2179('0x1a')]=this[_0x2179('0x18')][_0x2179('0x1a')]||'';_0x2e8ec8[_0x2179('0x1b')]=!![];if(this[_0x2179('0x18')][_0x2179('0x1c')]){_0x2e8ec8['subject']='';_0x2e8ec8[_0x2179('0x1c')]+=_[_0x2179('0x1d')](this['message'][_0x2179('0x1c')],_0x2179('0x1e'))?'':_0x2179('0x1f');_0x2e8ec8['subject']+=this['message']['subject'];}}if(this['channel']===_0x2179('0x20')){_0x2e8ec8[_0x2179('0x21')]=this[_0x2179('0x22')]['id'];}else{_0x2e8ec8[_['upperFirst'](this['channel'])+_0x2179('0x23')]=this['account']['id'];}_0x2e8ec8[_[_0x2179('0x24')](this[_0x2179('0x11')])+'InteractionId']=this[_0x2179('0xd')]['id'];if(rpc[this[_0x2179('0x11')]+'Message']){if(this[_0x2179('0x11')]==='mail'){var _0x5389dc={'tls':{'rejectUnauthorized':![]}};if(this[_0x2179('0x22')]['Smtp'][_0x2179('0x25')]){_0x5389dc['service']=this['account'][_0x2179('0x26')][_0x2179('0x25')];}else{_0x5389dc[_0x2179('0x27')]=this[_0x2179('0x22')][_0x2179('0x26')][_0x2179('0x27')];_0x5389dc['port']=this['account'][_0x2179('0x26')][_0x2179('0x28')];_0x5389dc[_0x2179('0x29')]=this[_0x2179('0x22')][_0x2179('0x26')][_0x2179('0x29')];}if(this[_0x2179('0x22')][_0x2179('0x26')][_0x2179('0x2a')]){_0x5389dc['auth']={'user':this['account'][_0x2179('0x26')][_0x2179('0x2b')],'pass':this[_0x2179('0x22')][_0x2179('0x26')][_0x2179('0x2c')]};}_0x2e8ec8[_0x2179('0x2d')]=this[_0x2179('0x18')][_0x2179('0x2e')];_0x2e8ec8[_0x2179('0x2f')]=_0x2179('0x30')+_[_0x2179('0x31')](_0x2e8ec8[_0x2179('0x16')],_0x2179('0x32'),_0x2179('0x33'))+_0x2179('0x34');_0x2e8ec8['headers']={'Auto-Submitted':_0x2179('0x35'),'X-Auto-Response-Suppress':'All','Precedence':_0x2179('0x36')};return mailRpc[_0x2179('0x37')](_0x5389dc,_0x2e8ec8)[_0x2179('0x38')](function(_0x318c2d){logger[_0x2179('0xe')](_0x2179('0x39'),_0x2e5361);_0x2e8ec8[_0x2179('0x2e')]=_0x318c2d[_0x2179('0x18')][_0x2179('0x2e')];return rpc[_0x4f15e8+_0x2179('0x3a')][_0x2179('0x3b')](_0x2e8ec8);})[_0x2179('0x38')](function(_0x5e1602){logger[_0x2179('0xe')](_0x2179('0xf'),_0x2e5361,JSON['stringify'](_0x5e1602));})['catch'](function(_0x40630d){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x2e5361,JSON[_0x2179('0x3c')](_0x40630d));})[_0x2179('0x3d')](function(){_0xc50219[_0x2179('0x10')]();});}else{return rpc[this[_0x2179('0x11')]+_0x2179('0x3a')]['create'](_0x2e8ec8)[_0x2179('0x38')](function(_0x201952){logger[_0x2179('0xe')]('[%s][AUTOREPLY]\x20%s',_0x2e5361,_0x2e8ec8['body']);})[_0x2179('0x3e')](function(_0x24ca02){logger[_0x2179('0x3f')](_0x2179('0xf'),_0x2e5361,JSON[_0x2179('0x3c')](_0x24ca02));})[_0x2179('0x3d')](function(){_0xc50219[_0x2179('0x10')]();});}}}catch(_0x15991d){logger[_0x2179('0x3f')](_0x2179('0xf'),_0x2e5361,JSON[_0x2179('0x3c')](_0x15991d));_0xc50219['stop']();}};}; \ 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 0ae69ea..14f690f 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 _0xf02c=['stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally'];(function(_0x2bad46,_0x57195e){var _0x282c18=function(_0x52f059){while(--_0x52f059){_0x2bad46['push'](_0x2bad46['shift']());}};_0x282c18(++_0x57195e);}(_0xf02c,0x92));var _0xcf02=function(_0x37d9b9,_0x59ffc5){_0x37d9b9=_0x37d9b9-0x0;var _0x529ff2=_0xf02c[_0x37d9b9];return _0x529ff2;};'use strict';var moment=require(_0xcf02('0x0'));var logger=require(_0xcf02('0x1'))(_0xcf02('0x2'));var rpc={'chatInteraction':require(_0xcf02('0x3')),'openchannelInteraction':require(_0xcf02('0x4')),'smsInteraction':require(_0xcf02('0x5')),'mailInteraction':require(_0xcf02('0x6')),'faxInteraction':require(_0xcf02('0x7')),'whatsappInteraction':require(_0xcf02('0x8'))};exports[_0xcf02('0x9')]=function(_0x3e8829,_0x29b849,_0x162df7,_0x2fe41e){return function(_0x3569a1){try{logger['info'](_0xcf02('0xa'),_0x3e8829,_0x29b849[0x0]);var _0x56c3db={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xcf02('0xb'),'disposition':_0x29b849[0x0]};if(rpc[_0x2fe41e[_0xcf02('0xc')]+_0xcf02('0xd')]){rpc[_0x2fe41e[_0xcf02('0xc')]+'Interaction'][_0xcf02('0xe')](_0x2fe41e[_0xcf02('0xf')]['id'],_0x56c3db)[_0xcf02('0x10')](function(_0x47a52c){logger['info'](_0xcf02('0x11'),_0x3e8829,_0x2fe41e[_0xcf02('0xf')]['id']);})[_0xcf02('0x12')](function(_0x20b8c7){logger[_0xcf02('0x13')]('[%s][CLOSE]\x20%s',_0x3e8829,JSON[_0xcf02('0x14')](_0x20b8c7));})[_0xcf02('0x15')](function(){_0x3569a1[_0xcf02('0x16')]();});}}catch(_0x304dc8){logger[_0xcf02('0x13')](_0xcf02('0x17'),_0x3e8829,JSON[_0xcf02('0x14')](_0x304dc8));_0x3569a1['stop']();}};}; \ No newline at end of file +var _0x631c=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','system','Interaction','channel','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger'];(function(_0x2db441,_0x13a782){var _0x52892f=function(_0x14cd1d){while(--_0x14cd1d){_0x2db441['push'](_0x2db441['shift']());}};_0x52892f(++_0x13a782);}(_0x631c,0x1b6));var _0xc631=function(_0x31407d,_0x38d443){_0x31407d=_0x31407d-0x0;var _0x367e46=_0x631c[_0x31407d];return _0x367e46;};'use strict';var moment=require(_0xc631('0x0'));var logger=require(_0xc631('0x1'))('routing');var rpc={'chatInteraction':require(_0xc631('0x2')),'openchannelInteraction':require(_0xc631('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xc631('0x4')),'faxInteraction':require(_0xc631('0x5')),'whatsappInteraction':require(_0xc631('0x6'))};exports['consequence']=function(_0x17dc11,_0x34263c,_0x5221e6,_0x278ad2){return function(_0x556c29){try{logger[_0xc631('0x7')](_0xc631('0x8'),_0x17dc11,_0x34263c[0x0]);var _0x5605cb={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xc631('0x9'),'disposition':_0x34263c[0x0]};if(rpc[_0x278ad2['channel']+_0xc631('0xa')]){rpc[_0x278ad2[_0xc631('0xb')]+_0xc631('0xa')]['update'](_0x278ad2[_0xc631('0xc')]['id'],_0x5605cb)[_0xc631('0xd')](function(_0x462987){logger[_0xc631('0x7')](_0xc631('0xe'),_0x17dc11,_0x278ad2[_0xc631('0xc')]['id']);})['catch'](function(_0x3a5efd){logger[_0xc631('0xf')](_0xc631('0x10'),_0x17dc11,JSON[_0xc631('0x11')](_0x3a5efd));})[_0xc631('0x12')](function(){_0x556c29['stop']();});}}catch(_0x241e39){logger[_0xc631('0xf')]('[%s][CLOSE]\x20%s',_0x17dc11,JSON[_0xc631('0x11')](_0x241e39));_0x556c29[_0xc631('0x13')]();}};}; \ 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 d8bfbc0..a1913ec 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 _0xa1ee=['finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','dialogflow','fulfillment','speech','providerName','providerResponse','stringify','Message','result','endConversation','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','interaction','isEmpty','body','getMustacheRender','create','then','catch','error'];(function(_0x21df82,_0x28c8cb){var _0x281a77=function(_0x5a7df1){while(--_0x5a7df1){_0x21df82['push'](_0x21df82['shift']());}};_0x281a77(++_0x28c8cb);}(_0xa1ee,0x6c));var _0xea1e=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0xa1ee[_0x8c1005];return _0x175354;};'use strict';var _=require('lodash');var moment=require(_0xea1e('0x0'));var apiai=require(_0xea1e('0x1'));var md5=require(_0xea1e('0x2'));var utils=require(_0xea1e('0x3'));var logger=require(_0xea1e('0x4'))(_0xea1e('0x5'));var rpc={'chatMessage':require(_0xea1e('0x6')),'openchannelMessage':require(_0xea1e('0x7')),'mailMessage':require(_0xea1e('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xea1e('0x9'))};exports[_0xea1e('0xa')]=function(_0x4fdfa6,_0x3aec57){return function(_0x32aa52){try{if(!_[_0xea1e('0xb')](this['interaction'][_0xea1e('0xc')])){logger[_0xea1e('0xd')](_0xea1e('0xe'),_0x4fdfa6,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x32aa52[_0xea1e('0xf')]();}var _0x2adf65={'ContactId':this['contact']['id'],'sentAt':moment()[_0xea1e('0x10')](_0xea1e('0x11')),'direction':_0xea1e('0x12')};if(this[_0xea1e('0x13')]===_0xea1e('0x14')||this[_0xea1e('0x13')]==='whatsapp'){_0x2adf65[_0xea1e('0x15')]=this['interaction'][_0xea1e('0x15')];}var _0x25968c=this[_0xea1e('0x13')];if(_0x25968c==='chat'){_0x2adf65[_0xea1e('0x16')]=this[_0xea1e('0x17')]['id'];}else{_0x2adf65[_[_0xea1e('0x18')](_0x25968c)+'AccountId']=this[_0xea1e('0x17')]['id'];}_0x2adf65[_[_0xea1e('0x18')](_0x25968c)+'InteractionId']=this['interaction']['id'];if(this[_0xea1e('0x19')]['created']){var _0x483027=_0x3aec57[0x2];if(!_[_0xea1e('0x1a')](_0x483027)){_0x2adf65[_0xea1e('0x1b')]=utils[_0xea1e('0x1c')](_0x483027,this);return rpc[_0x25968c+'Message'][_0xea1e('0x1d')](_0x2adf65)[_0xea1e('0x1e')](function(_0x39a2c9){logger[_0xea1e('0xd')](_0xea1e('0xe'),_0x4fdfa6,_0x2adf65['body']);})[_0xea1e('0x1f')](function(_0x57c1eb){logger[_0xea1e('0x20')](_0xea1e('0xe'),_0x4fdfa6,JSON['stringify'](_0x57c1eb));})[_0xea1e('0x21')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4fdfa6);_0x32aa52['stop']();});}else{logger[_0xea1e('0xd')](_0xea1e('0x22'),_0x4fdfa6);_0x32aa52[_0xea1e('0x23')]();}}else{var _0x24b7a5=this;var _0x15b158=apiai(_0x3aec57[0x0],{'language':_0x3aec57[0x1]||'en'});return _0x15b158[_0xea1e('0x24')](this[_0xea1e('0x25')][_0xea1e('0x1b')],{'sessionId':md5(this[_0xea1e('0x19')]['id'])})['then'](function(_0x1d1ed3){_0x24b7a5[_0xea1e('0x1b')][_0xea1e('0x26')]=_0x1d1ed3;_0x2adf65[_0xea1e('0x1b')]=_0x1d1ed3['result'][_0xea1e('0x27')][_0xea1e('0x28')];_0x2adf65[_0xea1e('0x29')]='dialogflow';_0x2adf65[_0xea1e('0x2a')]=JSON[_0xea1e('0x2b')](_0x1d1ed3);return rpc[_0x25968c+_0xea1e('0x2c')][_0xea1e('0x1d')](_0x2adf65)[_0xea1e('0x1e')](function(_0x3899ad){logger['info'](_0xea1e('0xe'),_0x4fdfa6,_0x2adf65[_0xea1e('0x1b')]);if(_0x1d1ed3[_0xea1e('0x2d')]['metadata'][_0xea1e('0x2e')]){_0x32aa52['next']();}else{_0x32aa52[_0xea1e('0x23')]();}})[_0xea1e('0x1f')](function(_0x4bdc00){logger[_0xea1e('0x20')](_0xea1e('0xe'),_0x4fdfa6,JSON['stringify'](_0x4bdc00));_0x32aa52[_0xea1e('0xf')]();});})[_0xea1e('0x1f')](function(_0x4fad15){logger[_0xea1e('0x20')](_0xea1e('0xe'),_0x4fdfa6,_0x4fad15['message']);_0x32aa52[_0xea1e('0xf')]();});}}catch(_0x4f1165){logger[_0xea1e('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x4fdfa6,JSON[_0xea1e('0x2b')](_0x4f1165));_0x32aa52['stop']();}};}; \ No newline at end of file +var _0xfe07=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','endConversation','stringify','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','consequence','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x1eb591,_0x108cbf){var _0x97f0e7=function(_0x4c0b46){while(--_0x4c0b46){_0x1eb591['push'](_0x1eb591['shift']());}};_0x97f0e7(++_0x108cbf);}(_0xfe07,0xdc));var _0x7fe0=function(_0x50af69,_0x2fcd09){_0x50af69=_0x50af69-0x0;var _0x47bd15=_0xfe07[_0x50af69];return _0x47bd15;};'use strict';var _=require(_0x7fe0('0x0'));var moment=require(_0x7fe0('0x1'));var apiai=require(_0x7fe0('0x2'));var md5=require(_0x7fe0('0x3'));var utils=require('./utils');var logger=require(_0x7fe0('0x4'))(_0x7fe0('0x5'));var rpc={'chatMessage':require(_0x7fe0('0x6')),'openchannelMessage':require(_0x7fe0('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7fe0('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x7fe0('0x9')]=function(_0x4a5616,_0x3b6fea){return function(_0x2084c3){try{if(!_['isNil'](this[_0x7fe0('0xa')]['UserId'])){logger[_0x7fe0('0xb')](_0x7fe0('0xc'),_0x4a5616,_0x7fe0('0xd'));return _0x2084c3[_0x7fe0('0xe')]();}var _0x1c2233={'ContactId':this[_0x7fe0('0xf')]['id'],'sentAt':moment()[_0x7fe0('0x10')](_0x7fe0('0x11')),'direction':_0x7fe0('0x12')};if(this[_0x7fe0('0x13')]===_0x7fe0('0x14')||this[_0x7fe0('0x13')]==='whatsapp'){_0x1c2233[_0x7fe0('0x15')]=this['interaction']['phone'];}var _0x1b6f97=this[_0x7fe0('0x13')];if(_0x1b6f97==='chat'){_0x1c2233['ChatWebsiteId']=this[_0x7fe0('0x16')]['id'];}else{_0x1c2233[_[_0x7fe0('0x17')](_0x1b6f97)+_0x7fe0('0x18')]=this[_0x7fe0('0x16')]['id'];}_0x1c2233[_[_0x7fe0('0x17')](_0x1b6f97)+_0x7fe0('0x19')]=this['interaction']['id'];if(this[_0x7fe0('0xa')][_0x7fe0('0x1a')]){var _0x33aea7=_0x3b6fea[0x2];if(!_[_0x7fe0('0x1b')](_0x33aea7)){_0x1c2233[_0x7fe0('0x1c')]=utils[_0x7fe0('0x1d')](_0x33aea7,this);return rpc[_0x1b6f97+_0x7fe0('0x1e')][_0x7fe0('0x1f')](_0x1c2233)[_0x7fe0('0x20')](function(_0x3c4775){logger[_0x7fe0('0xb')](_0x7fe0('0xc'),_0x4a5616,_0x1c2233[_0x7fe0('0x1c')]);})[_0x7fe0('0x21')](function(_0x6b8c51){logger[_0x7fe0('0x22')](_0x7fe0('0xc'),_0x4a5616,JSON['stringify'](_0x6b8c51));})[_0x7fe0('0x23')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4a5616);_0x2084c3[_0x7fe0('0x24')]();});}else{logger[_0x7fe0('0xb')](_0x7fe0('0x25'),_0x4a5616);_0x2084c3['stop']();}}else{var _0x2eed53=this;var _0x4cb3d4=apiai(_0x3b6fea[0x0],{'language':_0x3b6fea[0x1]||'en'});return _0x4cb3d4[_0x7fe0('0x26')](this[_0x7fe0('0x27')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0x7fe0('0x20')](function(_0x11b6eb){_0x2eed53[_0x7fe0('0x1c')][_0x7fe0('0x28')]=_0x11b6eb;_0x1c2233[_0x7fe0('0x1c')]=_0x11b6eb[_0x7fe0('0x29')][_0x7fe0('0x2a')][_0x7fe0('0x2b')];_0x1c2233[_0x7fe0('0x2c')]=_0x7fe0('0x28');_0x1c2233['providerResponse']=JSON['stringify'](_0x11b6eb);return rpc[_0x1b6f97+_0x7fe0('0x1e')][_0x7fe0('0x1f')](_0x1c2233)['then'](function(_0x5bc1f1){logger[_0x7fe0('0xb')](_0x7fe0('0xc'),_0x4a5616,_0x1c2233[_0x7fe0('0x1c')]);if(_0x11b6eb[_0x7fe0('0x29')]['metadata'][_0x7fe0('0x2d')]){_0x2084c3['next']();}else{_0x2084c3['stop']();}})[_0x7fe0('0x21')](function(_0x3828a1){logger[_0x7fe0('0x22')](_0x7fe0('0xc'),_0x4a5616,JSON[_0x7fe0('0x2e')](_0x3828a1));_0x2084c3[_0x7fe0('0xe')]();});})['catch'](function(_0x36ad11){logger[_0x7fe0('0x22')](_0x7fe0('0xc'),_0x4a5616,_0x36ad11[_0x7fe0('0x27')]);_0x2084c3[_0x7fe0('0xe')]();});}}catch(_0x1509dd){logger[_0x7fe0('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x4a5616,JSON[_0x7fe0('0x2e')](_0x1509dd));_0x2084c3[_0x7fe0('0x24')]();}};}; \ 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 047eb00..e64adce 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 _0xa97e=['fulfillmentText','all','dialogflow','md5','moment','bluebird','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','getMustacheRender','create','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','push'];(function(_0x34ed82,_0x3a1975){var _0x38cde3=function(_0x16e86c){while(--_0x16e86c){_0x34ed82['push'](_0x34ed82['shift']());}};_0x38cde3(++_0x3a1975);}(_0xa97e,0xc8));var _0xea97=function(_0x5ab826,_0x3c5682){_0x5ab826=_0x5ab826-0x0;var _0x1e7bc7=_0xa97e[_0x5ab826];return _0x1e7bc7;};'use strict';var _=require('lodash');var dialogflow=require(_0xea97('0x0'));var md5=require(_0xea97('0x1'));var moment=require(_0xea97('0x2'));var Promise=require(_0xea97('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0xea97('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xea97('0x5')),'smsMessage':require(_0xea97('0x6')),'faxMessage':require(_0xea97('0x7')),'whatsappMessage':require(_0xea97('0x8'))};function createMessage(_0x539266,_0x8387aa,_0x834280,_0x141ca4){return new Promise(function(_0x331b62,_0x246eaf){var _0x37f709=_[_0xea97('0x9')](_0x834280);_0x37f709[_0xea97('0xa')]=_0x141ca4;return rpc[_0x8387aa+_0xea97('0xb')]['create'](_0x37f709)[_0xea97('0xc')](function(){logger['info'](_0xea97('0xd'),_0x539266,_0x37f709[_0xea97('0xa')]);_0x331b62();})[_0xea97('0xe')](function(_0x529c6f){logger[_0xea97('0xf')](_0xea97('0xd'),_0x539266,JSON[_0xea97('0x10')](_0x529c6f));_0x246eaf(_0x529c6f);});});}exports['consequence']=function(_0x437cd6,_0x6295b){return function(_0x144e73){try{if(!_[_0xea97('0x11')](this[_0xea97('0x12')]['UserId'])){logger[_0xea97('0x13')](_0xea97('0xd'),_0x437cd6,_0xea97('0x14'));return _0x144e73[_0xea97('0x15')]();}var _0x4c6577={'ContactId':this[_0xea97('0x16')]['id'],'sentAt':moment()[_0xea97('0x17')](_0xea97('0x18')),'direction':_0xea97('0x19')};if(this[_0xea97('0x1a')]===_0xea97('0x1b')||this[_0xea97('0x1a')]===_0xea97('0x1c')){_0x4c6577[_0xea97('0x1d')]=this[_0xea97('0x12')][_0xea97('0x1d')];}var _0x3da80e=this[_0xea97('0x1a')];if(_0x3da80e===_0xea97('0x1e')){_0x4c6577[_0xea97('0x1f')]=this[_0xea97('0x20')]['id'];}else{_0x4c6577[_['upperFirst'](_0x3da80e)+'AccountId']=this[_0xea97('0x20')]['id'];}_0x4c6577[_[_0xea97('0x21')](_0x3da80e)+'InteractionId']=this[_0xea97('0x12')]['id'];if(this['interaction']['created']){var _0x1c732e=_0x6295b[0x4];if(!_['isEmpty'](_0x1c732e)){_0x4c6577[_0xea97('0xa')]=utils[_0xea97('0x22')](_0x1c732e,this);return rpc[_0x3da80e+_0xea97('0xb')][_0xea97('0x23')](_0x4c6577)['then'](function(_0x3d1376){logger[_0xea97('0x13')](_0xea97('0xd'),_0x437cd6,_0x4c6577[_0xea97('0xa')]);})[_0xea97('0xe')](function(_0x42cfb8){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x437cd6,JSON['stringify'](_0x42cfb8));})['finally'](function(){logger[_0xea97('0x13')](_0xea97('0x24'),_0x437cd6);_0x144e73[_0xea97('0x25')]();});}else{logger[_0xea97('0x13')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x437cd6);_0x144e73[_0xea97('0x25')]();}}else{var _0x1043e7=this;var _0x18c000=_0x6295b[0x2]['replace'](/\\n/g,'\x0a');var _0x356c2a={'credentials':{'private_key':_0x18c000,'client_email':_0x6295b[0x1]}};var _0x1eb6d9=new dialogflow[(_0xea97('0x26'))](_0x356c2a);var _0x2d83f3=_0x1eb6d9[_0xea97('0x27')](_0x6295b[0x0],md5(_0x1043e7[_0xea97('0x12')]['id']));var _0x11f9d0={'session':_0x2d83f3,'queryInput':{'text':{'text':_0x1043e7[_0xea97('0x28')][_0xea97('0xa')],'languageCode':_0x6295b[0x3]||'en'}}};return _0x1eb6d9[_0xea97('0x29')](_0x11f9d0)[_0xea97('0xc')](function(_0x384166){if(_0x384166&&_0x384166[_0xea97('0x2a')]){_0x1043e7['body'][_0xea97('0x2b')]=_0x384166;var _0x3a42a4=_0x384166[0x0];var _0x327641=_0x3a42a4[_0xea97('0x2c')][_0xea97('0x2d')]&&_0x3a42a4[_0xea97('0x2c')][_0xea97('0x2d')][_0xea97('0x2e')]?_0x3a42a4[_0xea97('0x2c')][_0xea97('0x2d')]['fields'][_0xea97('0x2f')][_0xea97('0x30')]:![];_0x1043e7[_0xea97('0xa')][_0xea97('0x31')]=_0x3a42a4[_0xea97('0x2c')]['action'];_0x1043e7[_0xea97('0xa')][_0xea97('0x32')]=_0x3a42a4[_0xea97('0x2c')]['allRequiredParamsPresent'];_0x1043e7[_0xea97('0xa')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x3a42a4[_0xea97('0x2c')][_0xea97('0x2d')]&&_0x3a42a4[_0xea97('0x2c')][_0xea97('0x2d')][_0xea97('0x2e')]?_0x3a42a4[_0xea97('0x2c')]['diagnosticInfo']['fields'][_0xea97('0x2f')][_0xea97('0x30')]:![];_0x1043e7[_0xea97('0xa')][_0xea97('0x33')]=_0x3a42a4[_0xea97('0x2c')][_0xea97('0x34')]['name'];_0x1043e7[_0xea97('0xa')][_0xea97('0x35')]=_0x3a42a4[_0xea97('0x2c')]['intent'][_0xea97('0x36')];_0x1043e7[_0xea97('0xa')][_0xea97('0x37')]=_0x3a42a4[_0xea97('0x2c')]['intent'][_0xea97('0x38')];_0x1043e7[_0xea97('0xa')][_0xea97('0x39')]=_0x3a42a4[_0xea97('0x2c')][_0xea97('0x3a')];_0x1043e7[_0xea97('0xa')][_0xea97('0x3b')]=_0x3a42a4[_0xea97('0x2c')]['queryText'];_0x1043e7[_0xea97('0xa')][_0xea97('0x3c')]=_0x3a42a4['queryResult'][_0xea97('0x3d')];_0x4c6577[_0xea97('0x3e')]=_0xea97('0x2b');_0x4c6577['providerResponse']=JSON[_0xea97('0x10')](_0x384166);var _0x579c60=[];for(var _0x5ab93c=0x0;_0x5ab93c<_0x384166['length'];_0x5ab93c++){var _0x49ed1c=_0x384166[_0x5ab93c];if(_0x49ed1c&&_0x49ed1c[_0xea97('0x2c')]&&_0x49ed1c['queryResult']['fulfillmentText']){_0x579c60[_0xea97('0x3f')](createMessage(_0x437cd6,_0x3da80e,_0x4c6577,_0x49ed1c[_0xea97('0x2c')][_0xea97('0x40')]));}}return Promise[_0xea97('0x41')](_0x579c60)[_0xea97('0xc')](function(){if(_0x327641){_0x144e73[_0xea97('0x15')]();}else{_0x144e73[_0xea97('0x25')]();}})[_0xea97('0xe')](function(_0xadf944){logger[_0xea97('0xf')](_0xea97('0xd'),_0x437cd6,JSON['stringify'](_0xadf944));_0x144e73[_0xea97('0x15')]();});}})[_0xea97('0xe')](function(_0x5a2caf){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x437cd6,_0x5a2caf[_0xea97('0x28')]);_0x144e73[_0xea97('0x15')]();});}}catch(_0x1a4195){logger[_0xea97('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x437cd6,JSON[_0xea97('0x10')](_0x1a4195));_0x144e73['stop']();}};}; \ No newline at end of file +var _0x935e=['DIALOGFLOWV2_INTENTDISPLAYNAME','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','length','fulfillmentText','push','all','next','lodash','dialogflow','bluebird','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','Message','info','[%s][DIALOGFLOWV2]\x20%s','body','error','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','catch','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','message','detectIntent','then','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name'];(function(_0x5af0e6,_0x888185){var _0x192c46=function(_0x5e76b6){while(--_0x5e76b6){_0x5af0e6['push'](_0x5af0e6['shift']());}};_0x192c46(++_0x888185);}(_0x935e,0x163));var _0xe935=function(_0x1919a8,_0x2d5ac6){_0x1919a8=_0x1919a8-0x0;var _0x4ccb59=_0x935e[_0x1919a8];return _0x4ccb59;};'use strict';var _=require(_0xe935('0x0'));var dialogflow=require(_0xe935('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require(_0xe935('0x2'));var logger=require(_0xe935('0x3'))('routing');var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xe935('0x4')),'smsMessage':require(_0xe935('0x5')),'faxMessage':require(_0xe935('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x31cfd0,_0x3ee6e5,_0x234848,_0x4ae34c){return new Promise(function(_0x352eff,_0x41298b){var _0xe3d2f9=_[_0xe935('0x7')](_0x234848);_0xe3d2f9['body']=_0x4ae34c;return rpc[_0x3ee6e5+_0xe935('0x8')]['create'](_0xe3d2f9)['then'](function(){logger[_0xe935('0x9')](_0xe935('0xa'),_0x31cfd0,_0xe3d2f9[_0xe935('0xb')]);_0x352eff();})['catch'](function(_0x2fdb03){logger[_0xe935('0xc')](_0xe935('0xa'),_0x31cfd0,JSON['stringify'](_0x2fdb03));_0x41298b(_0x2fdb03);});});}exports[_0xe935('0xd')]=function(_0x286cdb,_0x387114){return function(_0x4ec399){try{if(!_[_0xe935('0xe')](this[_0xe935('0xf')][_0xe935('0x10')])){logger[_0xe935('0x9')](_0xe935('0xa'),_0x286cdb,_0xe935('0x11'));return _0x4ec399['next']();}var _0x435694={'ContactId':this[_0xe935('0x12')]['id'],'sentAt':moment()[_0xe935('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe935('0x14')};if(this[_0xe935('0x15')]===_0xe935('0x16')||this['channel']===_0xe935('0x17')){_0x435694[_0xe935('0x18')]=this[_0xe935('0xf')][_0xe935('0x18')];}var _0x15505e=this[_0xe935('0x15')];if(_0x15505e===_0xe935('0x19')){_0x435694[_0xe935('0x1a')]=this['account']['id'];}else{_0x435694[_[_0xe935('0x1b')](_0x15505e)+_0xe935('0x1c')]=this['account']['id'];}_0x435694[_['upperFirst'](_0x15505e)+_0xe935('0x1d')]=this['interaction']['id'];if(this[_0xe935('0xf')]['created']){var _0x263237=_0x387114[0x4];if(!_[_0xe935('0x1e')](_0x263237)){_0x435694['body']=utils[_0xe935('0x1f')](_0x263237,this);return rpc[_0x15505e+_0xe935('0x8')]['create'](_0x435694)['then'](function(_0x3630fe){logger[_0xe935('0x9')](_0xe935('0xa'),_0x286cdb,_0x435694[_0xe935('0xb')]);})[_0xe935('0x20')](function(_0x5473c9){logger[_0xe935('0xc')](_0xe935('0xa'),_0x286cdb,JSON[_0xe935('0x21')](_0x5473c9));})['finally'](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x286cdb);_0x4ec399['stop']();});}else{logger[_0xe935('0x9')](_0xe935('0x22'),_0x286cdb);_0x4ec399[_0xe935('0x23')]();}}else{var _0xdd192d=this;var _0x253a2f=_0x387114[0x2][_0xe935('0x24')](/\\n/g,'\x0a');var _0x2960b9={'credentials':{'private_key':_0x253a2f,'client_email':_0x387114[0x1]}};var _0x3a5874=new dialogflow[(_0xe935('0x25'))](_0x2960b9);var _0x317c33=_0x3a5874[_0xe935('0x26')](_0x387114[0x0],md5(_0xdd192d['interaction']['id']));var _0x2c130d={'session':_0x317c33,'queryInput':{'text':{'text':_0xdd192d[_0xe935('0x27')]['body'],'languageCode':_0x387114[0x3]||'en'}}};return _0x3a5874[_0xe935('0x28')](_0x2c130d)[_0xe935('0x29')](function(_0x65dd4b){if(_0x65dd4b&&_0x65dd4b['length']){_0xdd192d['body']['dialogflowV2']=_0x65dd4b;var _0x33e08b=_0x65dd4b[0x0];var _0xb0e2b4=_0x33e08b[_0xe935('0x2a')]['diagnosticInfo']&&_0x33e08b[_0xe935('0x2a')][_0xe935('0x2b')][_0xe935('0x2c')]?_0x33e08b['queryResult']['diagnosticInfo']['fields'][_0xe935('0x2d')][_0xe935('0x2e')]:![];_0xdd192d['body']['DIALOGFLOWV2_ACTION']=_0x33e08b[_0xe935('0x2a')][_0xe935('0x2f')];_0xdd192d[_0xe935('0xb')][_0xe935('0x30')]=_0x33e08b[_0xe935('0x2a')][_0xe935('0x31')];_0xdd192d[_0xe935('0xb')][_0xe935('0x32')]=_0x33e08b[_0xe935('0x2a')][_0xe935('0x2b')]&&_0x33e08b[_0xe935('0x2a')][_0xe935('0x2b')][_0xe935('0x2c')]?_0x33e08b[_0xe935('0x2a')][_0xe935('0x2b')]['fields'][_0xe935('0x2d')][_0xe935('0x2e')]:![];_0xdd192d[_0xe935('0xb')][_0xe935('0x33')]=_0x33e08b['queryResult']['intent'][_0xe935('0x34')];_0xdd192d['body'][_0xe935('0x35')]=_0x33e08b['queryResult'][_0xe935('0x36')]['displayName'];_0xdd192d[_0xe935('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x33e08b[_0xe935('0x2a')]['intent'][_0xe935('0x37')];_0xdd192d[_0xe935('0xb')][_0xe935('0x38')]=_0x33e08b[_0xe935('0x2a')]['languageCode'];_0xdd192d[_0xe935('0xb')][_0xe935('0x39')]=_0x33e08b[_0xe935('0x2a')][_0xe935('0x3a')];_0xdd192d['body'][_0xe935('0x3b')]=_0x33e08b[_0xe935('0x2a')][_0xe935('0x3c')];_0x435694[_0xe935('0x3d')]=_0xe935('0x3e');_0x435694['providerResponse']=JSON[_0xe935('0x21')](_0x65dd4b);var _0x1f2d48=[];for(var _0x26b2b8=0x0;_0x26b2b8<_0x65dd4b[_0xe935('0x3f')];_0x26b2b8++){var _0x54fc10=_0x65dd4b[_0x26b2b8];if(_0x54fc10&&_0x54fc10[_0xe935('0x2a')]&&_0x54fc10[_0xe935('0x2a')][_0xe935('0x40')]){_0x1f2d48[_0xe935('0x41')](createMessage(_0x286cdb,_0x15505e,_0x435694,_0x54fc10[_0xe935('0x2a')][_0xe935('0x40')]));}}return Promise[_0xe935('0x42')](_0x1f2d48)[_0xe935('0x29')](function(){if(_0xb0e2b4){_0x4ec399[_0xe935('0x43')]();}else{_0x4ec399['stop']();}})['catch'](function(_0x5400ad){logger[_0xe935('0xc')](_0xe935('0xa'),_0x286cdb,JSON['stringify'](_0x5400ad));_0x4ec399[_0xe935('0x43')]();});}})['catch'](function(_0x42361f){logger[_0xe935('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x286cdb,_0x42361f[_0xe935('0x27')]);_0x4ec399[_0xe935('0x43')]();});}}catch(_0x1709b9){logger[_0xe935('0xc')](_0xe935('0xa'),_0x286cdb,JSON[_0xe935('0x21')](_0x1709b9));_0x4ec399[_0xe935('0x23')]();}};}; \ 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 d003c45..fa54ac5 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 _0x54b4=['./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','info','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','html-to-text'];(function(_0x4c5eac,_0x2e687e){var _0x5a71a9=function(_0x36f220){while(--_0x36f220){_0x4c5eac['push'](_0x4c5eac['shift']());}};_0x5a71a9(++_0x2e687e);}(_0x54b4,0xad));var _0x454b=function(_0x45dbe6,_0x2dc5fc){_0x45dbe6=_0x45dbe6-0x0;var _0x416dc9=_0x54b4[_0x45dbe6];return _0x416dc9;};'use strict';var schema=require(_0x454b('0x0'));var _=require('lodash');var htmlToText=require(_0x454b('0x1'));var utils=require(_0x454b('0x2'));var logger=require(_0x454b('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x454b('0x4'),'required':!![],'message':_0x454b('0x5')},'priorityTrue':{'type':_0x454b('0x6'),'message':_0x454b('0x7')},'priorityFalse':{'type':_0x454b('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x454b('0x8')]=function(_0x556992,_0x2a5444){return function(_0x1afb17){try{var _0x25b37c={'condition':htmlToText[_0x454b('0x9')](utils[_0x454b('0xa')](_0x2a5444[0x0],this),{'wordwrap':![]})[_0x454b('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2a5444[0x1],'priorityFalse':_0x2a5444[0x2]};var _0x293c4f=gotoif['validate'](_0x25b37c,{'typecast':!![]});if(_0x293c4f[_0x454b('0xc')]){logger[_0x454b('0xd')](_0x454b('0xe'),_0x556992,_['map'](_0x293c4f,_0x454b('0xf'))[_0x454b('0x10')](',\x20'));_0x1afb17[_0x454b('0x11')]();}else{try{var _0x5e8dac=eval('('+_0x25b37c[_0x454b('0x12')]+')');var _0x1cce0b=_0x5e8dac?_0x25b37c['priorityTrue']:_0x25b37c['priorityFalse'];logger[_0x454b('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x556992,_0x25b37c[_0x454b('0x12')],_0x5e8dac,_0x1cce0b||_0x454b('0x14'));if(_0x1cce0b){var _0x2fecd3=_[_0x454b('0x15')](_0x1afb17['rules'](),{'p':_0x1cce0b});if(_0x2fecd3>=0x0){logger['info'](_0x454b('0x16'),_0x556992,_0x1cce0b||_0x454b('0x14'),_0x2fecd3);_0x1afb17[_0x454b('0x14')](_0x2fecd3);}else{logger[_0x454b('0x13')](_0x454b('0x17'),_0x556992,_0x1cce0b||_0x454b('0x14'));_0x1afb17['stop']();}}else{_0x1afb17[_0x454b('0x14')]();}}catch(_0x3c586a){logger[_0x454b('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x556992,_0x3c586a[_0x454b('0xf')]);_0x1afb17[_0x454b('0x11')]();}}}catch(_0x46b373){logger[_0x454b('0xd')](_0x454b('0xe'),_0x556992,JSON[_0x454b('0x18')](_0x46b373));_0x1afb17['stop']();}};}; \ No newline at end of file +var _0x4ea1=['./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','error','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ea1,0x75));var _0x14ea=function(_0x230229,_0x465a26){_0x230229=_0x230229-0x0;var _0x1aa165=_0x4ea1[_0x230229];return _0x1aa165;};'use strict';var schema=require(_0x14ea('0x0'));var _=require(_0x14ea('0x1'));var htmlToText=require(_0x14ea('0x2'));var utils=require(_0x14ea('0x3'));var logger=require(_0x14ea('0x4'))(_0x14ea('0x5'));var gotoif=schema({'condition':{'type':_0x14ea('0x6'),'required':!![],'message':_0x14ea('0x7')},'priorityTrue':{'type':_0x14ea('0x8'),'message':_0x14ea('0x9')},'priorityFalse':{'type':_0x14ea('0x8'),'message':_0x14ea('0xa')}});exports['consequence']=function(_0x333a69,_0x325391){return function(_0x3a4eb2){try{var _0x116188={'condition':htmlToText['fromString'](utils[_0x14ea('0xb')](_0x325391[0x0],this),{'wordwrap':![]})[_0x14ea('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x325391[0x1],'priorityFalse':_0x325391[0x2]};var _0x51e4b0=gotoif['validate'](_0x116188,{'typecast':!![]});if(_0x51e4b0[_0x14ea('0xd')]){logger[_0x14ea('0xe')]('[%s][GOTOIF]\x20%s',_0x333a69,_[_0x14ea('0xf')](_0x51e4b0,_0x14ea('0x10'))[_0x14ea('0x11')](',\x20'));_0x3a4eb2[_0x14ea('0x12')]();}else{try{var _0x12c047=eval('('+_0x116188[_0x14ea('0x13')]+')');var _0x17ccf2=_0x12c047?_0x116188['priorityTrue']:_0x116188[_0x14ea('0x14')];logger[_0x14ea('0x15')](_0x14ea('0x16'),_0x333a69,_0x116188[_0x14ea('0x13')],_0x12c047,_0x17ccf2||'next');if(_0x17ccf2){var _0x5b4a55=_[_0x14ea('0x17')](_0x3a4eb2['rules'](),{'p':_0x17ccf2});if(_0x5b4a55>=0x0){logger['info'](_0x14ea('0x18'),_0x333a69,_0x17ccf2||_0x14ea('0x19'),_0x5b4a55);_0x3a4eb2[_0x14ea('0x19')](_0x5b4a55);}else{logger[_0x14ea('0x15')](_0x14ea('0x1a'),_0x333a69,_0x17ccf2||_0x14ea('0x19'));_0x3a4eb2[_0x14ea('0x12')]();}}else{_0x3a4eb2[_0x14ea('0x19')]();}}catch(_0x276b2a){logger[_0x14ea('0xe')](_0x14ea('0x1b'),_0x333a69,_0x276b2a[_0x14ea('0x10')]);_0x3a4eb2[_0x14ea('0x12')]();}}}catch(_0x5930d9){logger[_0x14ea('0xe')](_0x14ea('0x1c'),_0x333a69,JSON[_0x14ea('0x1d')](_0x5930d9));_0x3a4eb2[_0x14ea('0x12')]();}};}; \ 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 499fdfe..e6da4de 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 _0xe900=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe900,0x75));var _0x0e90=function(_0x3c3757,_0x2298b2){_0x3c3757=_0x3c3757-0x0;var _0x23d40a=_0xe900[_0x3c3757];return _0x23d40a;};'use strict';var schema=require(_0x0e90('0x0'));var _=require(_0x0e90('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x0e90('0x2')}});exports[_0x0e90('0x3')]=function(_0x249eff,_0x19907a){return function(_0x454650){try{var _0x5c5e81={'priority':_0x19907a[0x0]};var _0x4cfa3b=gotop[_0x0e90('0x0')](_0x5c5e81,{'typecast':!![]});if(_0x4cfa3b[_0x0e90('0x4')]){logger[_0x0e90('0x5')](_0x0e90('0x6'),_0x249eff,_[_0x0e90('0x7')](_0x4cfa3b,'message')['join'](',\x20'));_0x454650['stop']();}else{logger[_0x0e90('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0x249eff,_0x5c5e81[_0x0e90('0x9')]);if(_0x5c5e81[_0x0e90('0x9')]){var _0x3eec34=_[_0x0e90('0xa')](_0x454650[_0x0e90('0xb')](),{'p':_0x5c5e81[_0x0e90('0x9')]});if(_0x3eec34>=0x0){logger[_0x0e90('0x8')](_0x0e90('0xc'),_0x249eff,_0x5c5e81['priority']||'next',_0x3eec34);_0x454650[_0x0e90('0xd')](_0x3eec34);}else{logger[_0x0e90('0x8')](_0x0e90('0xe'),_0x249eff,_0x5c5e81['priority']||_0x0e90('0xd'));_0x454650[_0x0e90('0xf')]();}}else{_0x454650[_0x0e90('0xd')]();}}}catch(_0x2bff0f){logger[_0x0e90('0x5')](_0x0e90('0x6'),_0x249eff,JSON[_0x0e90('0x10')](_0x2bff0f));_0x454650[_0x0e90('0xf')]();}};}; \ No newline at end of file +var _0xa516=['[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','length','error'];(function(_0xdd3ead,_0x122368){var _0x1314aa=function(_0x21188f){while(--_0x21188f){_0xdd3ead['push'](_0xdd3ead['shift']());}};_0x1314aa(++_0x122368);}(_0xa516,0x1b1));var _0x6a51=function(_0x7e177,_0x14c2f2){_0x7e177=_0x7e177-0x0;var _0x55de41=_0xa516[_0x7e177];return _0x55de41;};'use strict';var schema=require(_0x6a51('0x0'));var _=require(_0x6a51('0x1'));var logger=require(_0x6a51('0x2'))(_0x6a51('0x3'));var gotop=schema({'priority':{'type':_0x6a51('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x4e9ca8,_0x174ff4){return function(_0x1a679a){try{var _0xa71024={'priority':_0x174ff4[0x0]};var _0x2a4f0a=gotop[_0x6a51('0x0')](_0xa71024,{'typecast':!![]});if(_0x2a4f0a[_0x6a51('0x5')]){logger[_0x6a51('0x6')](_0x6a51('0x7'),_0x4e9ca8,_[_0x6a51('0x8')](_0x2a4f0a,_0x6a51('0x9'))[_0x6a51('0xa')](',\x20'));_0x1a679a[_0x6a51('0xb')]();}else{logger[_0x6a51('0xc')](_0x6a51('0xd'),_0x4e9ca8,_0xa71024[_0x6a51('0xe')]);if(_0xa71024[_0x6a51('0xe')]){var _0xf01cb5=_[_0x6a51('0xf')](_0x1a679a['rules'](),{'p':_0xa71024['priority']});if(_0xf01cb5>=0x0){logger['info'](_0x6a51('0x10'),_0x4e9ca8,_0xa71024[_0x6a51('0xe')]||_0x6a51('0x11'),_0xf01cb5);_0x1a679a[_0x6a51('0x11')](_0xf01cb5);}else{logger['info'](_0x6a51('0x12'),_0x4e9ca8,_0xa71024['priority']||_0x6a51('0x11'));_0x1a679a['stop']();}}else{_0x1a679a[_0x6a51('0x11')]();}}}catch(_0x266d88){logger[_0x6a51('0x6')]('[%s][GOTOP]\x20%s',_0x4e9ca8,JSON[_0x6a51('0x13')](_0x266d88));_0x1a679a[_0x6a51('0xb')]();}};}; \ 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 155ef3d..538aa70 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 _0x4ce3=['account','upperFirst','channel','AccountId','InteractionId','interaction','Message','info','body','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat','ChatWebsiteId'];(function(_0x39dcbb,_0x19decd){var _0x10bc88=function(_0xfa0b9a){while(--_0xfa0b9a){_0x39dcbb['push'](_0x39dcbb['shift']());}};_0x10bc88(++_0x19decd);}(_0x4ce3,0x7a));var _0x34ce=function(_0x16ccc4,_0x439e40){_0x16ccc4=_0x16ccc4-0x0;var _0x2d3fd0=_0x4ce3[_0x16ccc4];return _0x2d3fd0;};'use strict';var _=require(_0x34ce('0x0'));var utils=require(_0x34ce('0x1'));var logger=require(_0x34ce('0x2'))('routing');var rpc={'chatMessage':require(_0x34ce('0x3')),'openchannelMessage':require(_0x34ce('0x4')),'mailMessage':require(_0x34ce('0x5')),'smsMessage':require(_0x34ce('0x6')),'faxMessage':require(_0x34ce('0x7')),'whatsappMessage':require(_0x34ce('0x8'))};exports['consequence']=function(_0x2970f8,_0x5547b2){return function(_0x2cb798){try{var _0x460e80={'body':utils[_0x34ce('0x9')](_0x5547b2[0x0],this),'ContactId':this[_0x34ce('0xa')]['id']};if(this['channel']===_0x34ce('0xb')){_0x460e80[_0x34ce('0xc')]=this[_0x34ce('0xd')]['id'];}else{_0x460e80[_[_0x34ce('0xe')](this[_0x34ce('0xf')])+_0x34ce('0x10')]=this['account']['id'];}_0x460e80[_[_0x34ce('0xe')](this[_0x34ce('0xf')])+_0x34ce('0x11')]=this[_0x34ce('0x12')]['id'];if(rpc[this['channel']+_0x34ce('0x13')]){return rpc[this[_0x34ce('0xf')]+_0x34ce('0x13')]['create'](_0x460e80)['then'](function(_0x25096b){logger[_0x34ce('0x14')]('[%s][MESSAGE]\x20%s',_0x2970f8,_0x460e80[_0x34ce('0x15')]);_0x2cb798['next']();})[_0x34ce('0x16')](function(_0x4754d1){logger[_0x34ce('0x17')](_0x34ce('0x18'),_0x2970f8,JSON[_0x34ce('0x19')](_0x4754d1));_0x2cb798[_0x34ce('0x1a')]();});}}catch(_0x3c7dca){logger[_0x34ce('0x17')](_0x34ce('0x18'),_0x2970f8,JSON[_0x34ce('0x19')](_0x3c7dca));_0x2cb798['stop']();}};}; \ No newline at end of file +var _0x74f2=['../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','lodash','./utils'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x74f2,0x1ae));var _0x274f=function(_0x268210,_0x4a4bf5){_0x268210=_0x268210-0x0;var _0x3f8848=_0x74f2[_0x268210];return _0x3f8848;};'use strict';var _=require(_0x274f('0x0'));var utils=require(_0x274f('0x1'));var logger=require(_0x274f('0x2'))('routing');var rpc={'chatMessage':require(_0x274f('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x274f('0x4')),'faxMessage':require(_0x274f('0x5')),'whatsappMessage':require(_0x274f('0x6'))};exports[_0x274f('0x7')]=function(_0x18c9f5,_0x44cd9b){return function(_0x100dce){try{var _0x12b298={'body':utils[_0x274f('0x8')](_0x44cd9b[0x0],this),'ContactId':this[_0x274f('0x9')]['id']};if(this[_0x274f('0xa')]===_0x274f('0xb')){_0x12b298[_0x274f('0xc')]=this[_0x274f('0xd')]['id'];}else{_0x12b298[_[_0x274f('0xe')](this[_0x274f('0xa')])+'AccountId']=this[_0x274f('0xd')]['id'];}_0x12b298[_[_0x274f('0xe')](this[_0x274f('0xa')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x274f('0xa')]+_0x274f('0xf')]){return rpc[this[_0x274f('0xa')]+_0x274f('0xf')][_0x274f('0x10')](_0x12b298)[_0x274f('0x11')](function(_0x1caff4){logger[_0x274f('0x12')](_0x274f('0x13'),_0x18c9f5,_0x12b298[_0x274f('0x14')]);_0x100dce['next']();})[_0x274f('0x15')](function(_0x5bb423){logger['error'](_0x274f('0x13'),_0x18c9f5,JSON['stringify'](_0x5bb423));_0x100dce['stop']();});}}catch(_0x3ac05a){logger[_0x274f('0x16')](_0x274f('0x13'),_0x18c9f5,JSON[_0x274f('0x17')](_0x3ac05a));_0x100dce['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 f805d3d..42e45d6 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 _0xbfee=['./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop'];(function(_0x24745f,_0x575a71){var _0x10c726=function(_0x1b6e96){while(--_0x1b6e96){_0x24745f['push'](_0x24745f['shift']());}};_0x10c726(++_0x575a71);}(_0xbfee,0x120));var _0xebfe=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xbfee[_0x4b055c];return _0x4b62bb;};'use strict';var utils=require(_0xebfe('0x0'));var logger=require(_0xebfe('0x1'))('routing');exports[_0xebfe('0x2')]=function(_0x2761bb,_0x4afbe0){return function(_0x1f2302){try{logger[_0xebfe('0x3')](_0xebfe('0x4'),_0x2761bb,utils[_0xebfe('0x5')](_0x4afbe0[0x0],this));_0x1f2302[_0xebfe('0x6')]();}catch(_0x5e3048){logger[_0xebfe('0x7')](_0xebfe('0x4'),_0x2761bb,JSON['stringify'](_0x5e3048));_0x1f2302[_0xebfe('0x8')]();}};}; \ No newline at end of file +var _0x02a7=['getMustacheRender','next','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x5699b3,_0x29827a){var _0x24307c=function(_0x1811e3){while(--_0x1811e3){_0x5699b3['push'](_0x5699b3['shift']());}};_0x24307c(++_0x29827a);}(_0x02a7,0x82));var _0x702a=function(_0x34c803,_0x39185f){_0x34c803=_0x34c803-0x0;var _0x35aa19=_0x02a7[_0x34c803];return _0x35aa19;};'use strict';var utils=require(_0x702a('0x0'));var logger=require('../../../../config/logger')(_0x702a('0x1'));exports[_0x702a('0x2')]=function(_0x3a886e,_0x31a623){return function(_0x52b3b4){try{logger[_0x702a('0x3')](_0x702a('0x4'),_0x3a886e,utils[_0x702a('0x5')](_0x31a623[0x0],this));_0x52b3b4[_0x702a('0x6')]();}catch(_0x321c53){logger['error']('[%s][NOOP]\x20%s',_0x3a886e,JSON[_0x702a('0x7')](_0x321c53));_0x52b3b4[_0x702a('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 36f9eac..63d2357 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 _0x9c44=['[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','atimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','QueueId','upperFirst','channel','InteractionId','message','AccountId','info','name','QueueReport','create','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x49c4('0x0'));var seqqueue=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var config=require(_0x49c4('0x4'));var logger=require(_0x49c4('0x5'))('routing');var strategy=require('./strategy');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));var attributes=['id',_0x49c4('0x9'),'account',_0x49c4('0xa'),_0x49c4('0xb'),_0x49c4('0xc')];function emit(_0x4487ca,_0x4c7d3a,_0x5ab4a3){io['to'](_0x4487ca)[_0x49c4('0xd')](_0x4c7d3a,_0x5ab4a3);}function emitChannelQueueInteraction(_0x313e73,_0x58cad7,_0xb611a1,_0x459d09,_0x4adb3c,_0x536d42,_0x1d19bf,_0x6d1b08){var _0x5487cd=_[_0x49c4('0xe')](_0xb611a1);_0x5487cd[_0x49c4('0x9')]=_0x6d1b08;_0x5487cd['queue']=_0x58cad7;_0x5487cd[_0x49c4('0xf')]=_0x459d09;_0x5487cd['id']=_0x4adb3c;if(_0x536d42){_0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c]=_[_0x49c4('0x12')](_0x5487cd,attributes);}else{delete _0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c];}emit(util[_0x49c4('0x10')](_0x49c4('0x13'),_0x313e73,_0x58cad7),util['format'](_0x49c4('0x14'),_0x313e73,_0x536d42?_0x49c4('0x15'):_0x49c4('0x16')),_[_0x49c4('0x12')](_0x5487cd,attributes));}var rpc={'openchannelQueueReport':require(_0x49c4('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x49c4('0x18')),'smsQueueReport':require(_0x49c4('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x49c4('0x1a'),'required':!![],'message':_0x49c4('0x1b')},'timeout':{'type':_0x49c4('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x24856d,_0x50b151,_0x2cbd50,_0x1806c2){if(_0x24856d&&_0x50b151&&_0x2cbd50){_0x50b151[_0x49c4('0x1d')]+=0x1;var _0x291526={'uniqueid':_0x24856d,'from':_0x2cbd50[_0x49c4('0x1e')]?_0x2cbd50[_0x49c4('0x1e')][_0x49c4('0xb')]:'','joinAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'ContactId':_0x2cbd50['contact']?_0x2cbd50['contact']['id']:null,'ListId':_0x2cbd50['list']?_0x2cbd50[_0x49c4('0x20')]['id']:null};_0x291526[_['upperFirst'](_0x2cbd50['channel'])+_0x49c4('0x21')]=_0x50b151['id']||null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+_0x49c4('0x24')]=_0x2cbd50['interaction']?_0x2cbd50['interaction']['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+'MessageId']=_0x2cbd50[_0x49c4('0x25')]?_0x2cbd50[_0x49c4('0x25')]['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+(_0x2cbd50['channel']!=='chat'?_0x49c4('0x26'):'WebsiteId')]=_0x2cbd50[_0x49c4('0xf')]?_0x2cbd50[_0x49c4('0xf')]['id']:null;logger[_0x49c4('0x27')](util[_0x49c4('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x24856d,_0x50b151[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2cbd50[_0x49c4('0x23')],_0x50b151[_0x49c4('0x28')],_0x291526,_0x2cbd50[_0x49c4('0xf')][_0x49c4('0x28')],_0x2cbd50[_0x49c4('0x25')]['id'],!![],_0x1806c2,_0x50b151['id']);if(rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2a')](_0x291526)['catch'](function(_0x4f4495){logger['error'](_0x49c4('0x2b'));});}}}function stopRouting(_0x7ee704,_0x1eb035,_0x27e467,_0x28eb47){if(_0x7ee704&&_0x1eb035){_0x1eb035['waiting']-=0x1;var _0x38ad77={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'acceptAt':moment()[_0x49c4('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x49c4('0x27')](util[_0x49c4('0x10')](_0x49c4('0x2c'),_0x7ee704,_0x1eb035[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x27e467[_0x49c4('0x23')],_0x1eb035['name'],_0x27e467[_0x49c4('0x1e')],_0x27e467[_0x49c4('0xf')][_0x49c4('0x28')],_0x27e467['message']['id'],![],_0x28eb47,_0x1eb035['id']);if(rpc[_0x27e467['channel']+_0x49c4('0x29')]){return rpc[_0x27e467[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2d')](_0x7ee704,_0x38ad77)[_0x49c4('0x2e')](function(_0x2cf897){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function endRouting(_0x3209cd,_0x4e0209,_0x2d34ca,_0x5b96df){if(_0x3209cd&&_0x4e0209){_0x4e0209[_0x49c4('0x1d')]-=0x1;var _0x349791={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'exitAt':moment()['format'](_0x49c4('0x1f')),'reason':_0x49c4('0x31')};logger[_0x49c4('0x27')](util['format'](_0x49c4('0x32'),_0x3209cd,_0x4e0209[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2d34ca[_0x49c4('0x23')],_0x4e0209[_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x1e')],_0x2d34ca[_0x49c4('0xf')][_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x25')]['id'],![],_0x5b96df);if(rpc[_0x2d34ca[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2d34ca[_0x49c4('0x23')]+'QueueReport'][_0x49c4('0x2d')](_0x3209cd,_0x349791)[_0x49c4('0x2e')](function(_0x32b172){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function handleFindQueue(_0x29dd5d){return function(_0x1be62d){return _0x1be62d[_0x49c4('0x28')][_0x49c4('0x33')]()===_0x29dd5d[_0x49c4('0x33')]();};}exports[_0x49c4('0x34')]=function(_0xa3d59e,_0x326142,_0x4e38bc,_0x212366){return function(_0x49829e){try{var _0x104efb={'name':_0x326142[0x0],'timeout':_0x326142[0x1]};var _0x4915bc=queue[_0x49c4('0x35')](_0x104efb,{'typecast':!![]});if(_0x4915bc[_0x49c4('0x36')]){logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_['map'](_0x4915bc,'message')[_0x49c4('0x38')](',\x20'));_0x49829e[_0x49c4('0x39')]();}else{var _0x38349b=_[_0x49c4('0x3a')](_0x4e38bc[_0x212366['channel']+_0x49c4('0x3b')],handleFindQueue(_0x104efb[_0x49c4('0x28')]));if(_0x38349b){startRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);var _0x2ccd47=(_0x38349b[_0x49c4('0x31')]||0xa)*0x3e8;var _0x81a674=(_0x104efb[_0x49c4('0x31')]||0x14)*0x3e8;var _0x1a9593,_0x3351c1;if(_0x2ccd47>_0x81a674){_0x81a674=_0x2ccd47;}var _0x3c4a1d=seqqueue['createQueue'](_0x2ccd47);_0x3c4a1d['id']=_0xa3d59e;_0x3c4a1d[_0x49c4('0x3c')]=_0x2ccd47;_0x3c4a1d['qtimeout']=_0x81a674;_0x3c4a1d[_0x49c4('0x23')]=_0x212366[_0x49c4('0x23')];_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x3e'),function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xa3d59e);stopRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x1a9593=undefined;_0x3c4a1d[_0x49c4('0x3f')](!![]);if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc[_0x49c4('0x3d')][_0xa3d59e];}_0x49829e[_0x49c4('0x39')]();});_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x40'),function(){if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc['rules'][_0xa3d59e];}});_0x1a9593=setTimeout(function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xa3d59e);endRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x3c4a1d[_0x49c4('0x3f')](!![]);_0x49829e[_0x49c4('0x41')]();},_0x81a674);switch(_0x38349b[_0x49c4('0x42')]){case _0x49c4('0x43'):strategy[_0x49c4('0x43')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);break;default:strategy[_0x49c4('0x44')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);}}else{logger[_0x49c4('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xa3d59e,_0x104efb[_0x49c4('0x28')]);_0x49829e[_0x49c4('0x39')]();}}}catch(_0x4a5c34){console[_0x49c4('0x45')](_0x4a5c34);logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_0x4a5c34[_0x49c4('0x46')]);_0x49829e['stop']();}};}; \ No newline at end of file +var _0x55ca=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x197cfb,_0x346918){var _0xa765f6=function(_0x333500){while(--_0x333500){_0x197cfb['push'](_0x197cfb['shift']());}};_0xa765f6(++_0x346918);}(_0x55ca,0x126));var _0xa55c=function(_0x5ca353,_0x21eb37){_0x5ca353=_0x5ca353-0x0;var _0x4f2fe5=_0x55ca[_0x5ca353];return _0x4f2fe5;};'use strict';var schema=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));var strategy=require(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa55c('0xa'),_0xa55c('0xb'),'queue',_0xa55c('0xc'),_0xa55c('0xd')];function emit(_0x52a3bc,_0x5849ad,_0x473d0e){io['to'](_0x52a3bc)[_0xa55c('0xe')](_0x5849ad,_0x473d0e);}function emitChannelQueueInteraction(_0x381d07,_0x5d8e5a,_0x31646d,_0xe6d826,_0x508342,_0x70c2de,_0x3998f7,_0x15eec8){var _0x5d47ff=_['clone'](_0x31646d);_0x5d47ff[_0xa55c('0xa')]=_0x15eec8;_0x5d47ff['queue']=_0x5d8e5a;_0x5d47ff['account']=_0xe6d826;_0x5d47ff['id']=_0x508342;if(_0x70c2de){_0x3998f7[util['format'](_0xa55c('0xf'),_0x381d07)][_0x508342]=_[_0xa55c('0x10')](_0x5d47ff,attributes);}else{delete _0x3998f7[util[_0xa55c('0x11')](_0xa55c('0xf'),_0x381d07)][_0x508342];}emit(util[_0xa55c('0x11')](_0xa55c('0x12'),_0x381d07,_0x5d8e5a),util['format'](_0xa55c('0x13'),_0x381d07,_0x70c2de?_0xa55c('0x14'):_0xa55c('0x15')),_[_0xa55c('0x10')](_0x5d47ff,attributes));}var rpc={'openchannelQueueReport':require(_0xa55c('0x16')),'mailQueueReport':require(_0xa55c('0x17')),'chatQueueReport':require(_0xa55c('0x18')),'smsQueueReport':require(_0xa55c('0x19')),'faxQueueReport':require(_0xa55c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa55c('0x1b'),'required':!![],'message':_0xa55c('0x1c')},'timeout':{'type':_0xa55c('0x1d'),'message':_0xa55c('0x1e')}});function startRouting(_0x23a1ae,_0x5426e5,_0x4c0daf,_0x5f5158){if(_0x23a1ae&&_0x5426e5&&_0x4c0daf){_0x5426e5[_0xa55c('0x1f')]+=0x1;var _0x3776ac={'uniqueid':_0x23a1ae,'from':_0x4c0daf[_0xa55c('0x20')]?_0x4c0daf['body'][_0xa55c('0xc')]:'','joinAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c0daf[_0xa55c('0x21')]?_0x4c0daf[_0xa55c('0x21')]['id']:null,'ListId':_0x4c0daf[_0xa55c('0x22')]?_0x4c0daf[_0xa55c('0x22')]['id']:null};_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf['channel'])+_0xa55c('0x24')]=_0x5426e5['id']||null;_0x3776ac[_['upperFirst'](_0x4c0daf['channel'])+'InteractionId']=_0x4c0daf[_0xa55c('0x25')]?_0x4c0daf['interaction']['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+_0xa55c('0x27')]=_0x4c0daf[_0xa55c('0x28')]?_0x4c0daf[_0xa55c('0x28')]['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+(_0x4c0daf[_0xa55c('0x26')]!==_0xa55c('0x29')?_0xa55c('0x2a'):_0xa55c('0x2b'))]=_0x4c0daf['account']?_0x4c0daf[_0xa55c('0xb')]['id']:null;logger[_0xa55c('0x2c')](util[_0xa55c('0x11')](_0xa55c('0x2d'),_0x23a1ae,_0x5426e5['name']));emitChannelQueueInteraction(_0x4c0daf[_0xa55c('0x26')],_0x5426e5[_0xa55c('0x2e')],_0x3776ac,_0x4c0daf[_0xa55c('0xb')][_0xa55c('0x2e')],_0x4c0daf[_0xa55c('0x28')]['id'],!![],_0x5f5158,_0x5426e5['id']);if(rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport']){return rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport'][_0xa55c('0x2f')](_0x3776ac)[_0xa55c('0x30')](function(_0x1cc53e){logger[_0xa55c('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x3d28fb,_0x2096ae,_0x331e58,_0x20da31){if(_0x3d28fb&&_0x2096ae){_0x2096ae[_0xa55c('0x1f')]-=0x1;var _0x1225c3={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'acceptAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'reason':_0xa55c('0x33')};logger['info'](util['format'](_0xa55c('0x34'),_0x3d28fb,_0x2096ae[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x331e58['channel'],_0x2096ae[_0xa55c('0x2e')],_0x331e58[_0xa55c('0x20')],_0x331e58[_0xa55c('0xb')][_0xa55c('0x2e')],_0x331e58[_0xa55c('0x28')]['id'],![],_0x20da31,_0x2096ae['id']);if(rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]){return rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]['update'](_0x3d28fb,_0x1225c3)['catch'](function(_0x4b23d3){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function endRouting(_0x2bb4f0,_0x5802e4,_0x768408,_0x547930){if(_0x2bb4f0&&_0x5802e4){_0x5802e4[_0xa55c('0x1f')]-=0x1;var _0x4ad813={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'exitAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa55c('0x37')};logger[_0xa55c('0x2c')](util['format'](_0xa55c('0x38'),_0x2bb4f0,_0x5802e4[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x768408['channel'],_0x5802e4['name'],_0x768408[_0xa55c('0x20')],_0x768408['account'][_0xa55c('0x2e')],_0x768408[_0xa55c('0x28')]['id'],![],_0x547930);if(rpc[_0x768408['channel']+'QueueReport']){return rpc[_0x768408['channel']+'QueueReport'][_0xa55c('0x39')](_0x2bb4f0,_0x4ad813)[_0xa55c('0x30')](function(_0x429336){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function handleFindQueue(_0x56d17c){return function(_0x3d52d8){return _0x3d52d8[_0xa55c('0x2e')][_0xa55c('0x3a')]()===_0x56d17c[_0xa55c('0x3a')]();};}exports[_0xa55c('0x3b')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){return function(_0x57a972){try{var _0x404e7f={'name':_0x554620[0x0],'timeout':_0x554620[0x1]};var _0x1f63d8=queue['validate'](_0x404e7f,{'typecast':!![]});if(_0x1f63d8[_0xa55c('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x23cef5,_[_0xa55c('0x3d')](_0x1f63d8,_0xa55c('0x28'))[_0xa55c('0x3e')](',\x20'));_0x57a972['stop']();}else{var _0x1b2708=_[_0xa55c('0x3f')](_0x386e34[_0x5ee63d['channel']+_0xa55c('0x40')],handleFindQueue(_0x404e7f['name']));if(_0x1b2708){startRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);var _0x39886a=(_0x1b2708[_0xa55c('0x37')]||0xa)*0x3e8;var _0x5be43f=(_0x404e7f[_0xa55c('0x37')]||0x14)*0x3e8;var _0x1dae70,_0x5d834d;if(_0x39886a>_0x5be43f){_0x5be43f=_0x39886a;}var _0x40c352=seqqueue[_0xa55c('0x41')](_0x39886a);_0x40c352['id']=_0x23cef5;_0x40c352[_0xa55c('0x42')]=_0x39886a;_0x40c352['qtimeout']=_0x5be43f;_0x40c352[_0xa55c('0x26')]=_0x5ee63d['channel'];_0x386e34[_0xa55c('0x43')][_0x23cef5]['on'](_0xa55c('0x44'),function(){logger[_0xa55c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x23cef5);stopRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x1dae70=undefined;_0x40c352[_0xa55c('0x45')](!![]);if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34['rules'][_0x23cef5];}_0x57a972[_0xa55c('0x46')]();});_0x386e34[_0xa55c('0x43')][_0x23cef5]['on']('complete',function(){if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34[_0xa55c('0x43')][_0x23cef5];}});_0x1dae70=setTimeout(function(){logger['info'](_0xa55c('0x47'),_0x23cef5);endRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x40c352[_0xa55c('0x45')](!![]);_0x57a972[_0xa55c('0x48')]();},_0x5be43f);switch(_0x1b2708[_0xa55c('0x49')]){case'rrmemory':strategy[_0xa55c('0x4a')](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);break;default:strategy['beepall'](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);}}else{logger[_0xa55c('0x31')](_0xa55c('0x4b'),_0x23cef5,_0x404e7f[_0xa55c('0x2e')]);_0x57a972['stop']();}}}catch(_0x39bd3d){console[_0xa55c('0x4c')](_0x39bd3d);logger['error'](_0xa55c('0x4d'),_0x23cef5,_0x39bd3d[_0xa55c('0x4e')]);_0x57a972[_0xa55c('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 763288d..deddb5c 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 _0x015a=['isAgentAvailable','realtime','channel','busy','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','exports','lodash','./util','../../../../../config/logger','routing','notificationId','agent','squeue','push','handleRun','bind','handleTimeout','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x015a,0xf2));var _0xa015=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x015a[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0xa015('0x0'));var uuid=require('uuid');var util=require(_0xa015('0x1'));var logger=require(_0xa015('0x2'))(_0xa015('0x3'));var Agent=function(_0x5fedb3,_0x289f94,_0x12e98a,_0x6b6aad){this[_0xa015('0x4')]=uuid['v4']();this['squeue']=_0x5fedb3;this[_0xa015('0x5')]=_0x289f94;this['realtime']=_0x12e98a;this[_0xa015('0x3')]=_0x6b6aad;this[_0xa015('0x6')][_0xa015('0x7')](this[_0xa015('0x8')][_0xa015('0x9')](this),this[_0xa015('0xa')][_0xa015('0x9')](this));this['squeue']['on']('timeout',this[_0xa015('0xa')]['bind'](this));this[_0xa015('0x6')]['on']('drained',this[_0xa015('0xb')][_0xa015('0x9')](this));};Agent['prototype'][_0xa015('0x7')]=function(){this[_0xa015('0x6')]['push'](this[_0xa015('0x8')][_0xa015('0x9')](this),this[_0xa015('0xa')][_0xa015('0x9')](this));};Agent[_0xa015('0xc')][_0xa015('0xb')]=function(){this[_0xa015('0xa')](!![]);};Agent[_0xa015('0xc')][_0xa015('0x8')]=function(_0x358b63){logger[_0xa015('0xd')](_0xa015('0xe'),this[_0xa015('0x6')]['id'],this[_0xa015('0x5')]['id']);if(_[_0xa015('0xf')](this['realtime'][_0xa015('0x10')][this[_0xa015('0x5')]['id']])){logger[_0xa015('0xd')](_0xa015('0x11'),this[_0xa015('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xa015('0x7')][_0xa015('0x9')](this),0x3e8);}else{if(this['routing'][_0xa015('0x12')]||util[_0xa015('0x13')](this[_0xa015('0x6')]['id'],this[_0xa015('0x14')][_0xa015('0x10')][this[_0xa015('0x5')]['id']],this[_0xa015('0x6')][_0xa015('0x15')],![])){this[_0xa015('0x14')]['agents'][this[_0xa015('0x5')]['id']][_0xa015('0x16')]=!![];this[_0xa015('0x14')]['agents'][this[_0xa015('0x5')]['id']][_0xa015('0x17')]=undefined;util[_0xa015('0x18')](this[_0xa015('0x4')],this['squeue']['id'],this['realtime'][_0xa015('0x10')][this[_0xa015('0x5')]['id']],null,this['routing']);util[_0xa015('0x19')](this[_0xa015('0x6')]['id'],this['realtime'][_0xa015('0x10')][this[_0xa015('0x5')]['id']],'RINGING'+(this[_0xa015('0x3')][_0xa015('0x12')]?_0xa015('0x1a'):''));}else{logger[_0xa015('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xa015('0x6')]['id'],this[_0xa015('0x5')]['id']);setTimeout(this['push'][_0xa015('0x9')](this),0x3e8);}}};Agent[_0xa015('0xc')]['handleTimeout']=function(_0x3f2a97){if(_['isNil'](this[_0xa015('0x14')][_0xa015('0x10')][this['agent']['id']])){return logger[_0xa015('0xd')](_0xa015('0x11'),this[_0xa015('0x6')]['id'],this[_0xa015('0x5')]['id']);}else{logger[_0xa015('0xd')](_0xa015('0x1b'),this[_0xa015('0x6')]['id'],this[_0xa015('0x5')]['id']);util['hideNotification'](this[_0xa015('0x4')],this[_0xa015('0x6')]['id'],this[_0xa015('0x14')][_0xa015('0x10')][this[_0xa015('0x5')]['id']],null,this['routing']);this['realtime']['agents'][this['agent']['id']][_0xa015('0x16')]=![];this['realtime'][_0xa015('0x10')][this[_0xa015('0x5')]['id']]['busyQueue']=undefined;util[_0xa015('0x19')](this[_0xa015('0x6')]['id'],this[_0xa015('0x14')][_0xa015('0x10')][this['agent']['id']],_0x3f2a97?'STOP':'TIMEOUT');}if(!_0x3f2a97){setTimeout(this['push'][_0xa015('0x9')](this),0x3e8);}};function agent(_0x17b355,_0x8bebc2,_0x1b6fe0,_0x214d09){return new Agent(_0x17b355,_0x8bebc2,_0x1b6fe0,_0x214d09);}module[_0xa015('0x1c')]=agent; \ No newline at end of file +var _0x3768=['timeout','drained','prototype','handleRun','handleDrained','info','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog',':FORCED','isNil','STOP','TIMEOUT','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout'];(function(_0x3dd6ea,_0x3df362){var _0x2f79bb=function(_0x596871){while(--_0x596871){_0x3dd6ea['push'](_0x3dd6ea['shift']());}};_0x2f79bb(++_0x3df362);}(_0x3768,0x10e));var _0x8376=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x3768[_0x4c05da];return _0x1614db;};'use strict';var _=require('lodash');var uuid=require(_0x8376('0x0'));var util=require('./util');var logger=require(_0x8376('0x1'))(_0x8376('0x2'));var Agent=function(_0x43e25e,_0x2c85f9,_0x419f90,_0x1eddc0){this[_0x8376('0x3')]=uuid['v4']();this[_0x8376('0x4')]=_0x43e25e;this[_0x8376('0x5')]=_0x2c85f9;this[_0x8376('0x6')]=_0x419f90;this['routing']=_0x1eddc0;this[_0x8376('0x4')][_0x8376('0x7')](this['handleRun'][_0x8376('0x8')](this),this[_0x8376('0x9')][_0x8376('0x8')](this));this[_0x8376('0x4')]['on'](_0x8376('0xa'),this[_0x8376('0x9')]['bind'](this));this[_0x8376('0x4')]['on'](_0x8376('0xb'),this['handleDrained'][_0x8376('0x8')](this));};Agent[_0x8376('0xc')][_0x8376('0x7')]=function(){this['squeue']['push'](this[_0x8376('0xd')][_0x8376('0x8')](this),this[_0x8376('0x9')][_0x8376('0x8')](this));};Agent[_0x8376('0xc')][_0x8376('0xe')]=function(){this['handleTimeout'](!![]);};Agent['prototype']['handleRun']=function(_0x396753){logger[_0x8376('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x8376('0x4')]['id'],this[_0x8376('0x5')]['id']);if(_['isNil'](this[_0x8376('0x6')][_0x8376('0x10')][this[_0x8376('0x5')]['id']])){logger['info'](_0x8376('0x11'),this[_0x8376('0x4')]['id'],this[_0x8376('0x5')]['id']);setTimeout(this['push'][_0x8376('0x8')](this),0x3e8);}else{if(this[_0x8376('0x2')][_0x8376('0x12')]||util[_0x8376('0x13')](this['squeue']['id'],this[_0x8376('0x6')]['agents'][this[_0x8376('0x5')]['id']],this[_0x8376('0x4')][_0x8376('0x14')],![])){this[_0x8376('0x6')][_0x8376('0x10')][this[_0x8376('0x5')]['id']]['busy']=!![];this[_0x8376('0x6')][_0x8376('0x10')][this[_0x8376('0x5')]['id']][_0x8376('0x15')]=undefined;util[_0x8376('0x16')](this['notificationId'],this[_0x8376('0x4')]['id'],this[_0x8376('0x6')]['agents'][this[_0x8376('0x5')]['id']],null,this[_0x8376('0x2')]);util[_0x8376('0x17')](this[_0x8376('0x4')]['id'],this['realtime'][_0x8376('0x10')][this[_0x8376('0x5')]['id']],'RINGING'+(this['routing'][_0x8376('0x12')]?_0x8376('0x18'):''));}else{logger[_0x8376('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x8376('0x4')]['id'],this[_0x8376('0x5')]['id']);setTimeout(this[_0x8376('0x7')][_0x8376('0x8')](this),0x3e8);}}};Agent[_0x8376('0xc')]['handleTimeout']=function(_0x3f0840){if(_[_0x8376('0x19')](this[_0x8376('0x6')][_0x8376('0x10')][this[_0x8376('0x5')]['id']])){return logger[_0x8376('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8376('0x4')]['id'],this['agent']['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x8376('0x4')]['id'],this[_0x8376('0x5')]['id']);util['hideNotification'](this['notificationId'],this[_0x8376('0x4')]['id'],this[_0x8376('0x6')][_0x8376('0x10')][this[_0x8376('0x5')]['id']],null,this[_0x8376('0x2')]);this['realtime'][_0x8376('0x10')][this[_0x8376('0x5')]['id']]['busy']=![];this[_0x8376('0x6')][_0x8376('0x10')][this['agent']['id']][_0x8376('0x15')]=undefined;util['writeLog'](this[_0x8376('0x4')]['id'],this[_0x8376('0x6')][_0x8376('0x10')][this['agent']['id']],_0x3f0840?_0x8376('0x1a'):_0x8376('0x1b'));}if(!_0x3f0840){setTimeout(this['push'][_0x8376('0x8')](this),0x3e8);}};function agent(_0x492c65,_0x4cc72c,_0x44dc09,_0x3df52c){return new Agent(_0x492c65,_0x4cc72c,_0x44dc09,_0x3df52c);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index accb310..8a00fda 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 _0x7936=['busyQueue','name','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','exports','lodash','uuid','./util','squeue','queue','realtime','routing','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil','Agents','length','agents','info','isAgentAvailable','channel','writeLog','RINGING'];(function(_0x5a6da9,_0x32df4d){var _0x29d30f=function(_0x2b6742){while(--_0x2b6742){_0x5a6da9['push'](_0x5a6da9['shift']());}};_0x29d30f(++_0x32df4d);}(_0x7936,0x8d));var _0x6793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7936[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6793('0x0'));var uuid=require(_0x6793('0x1'));var util=require(_0x6793('0x2'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x5132d8,_0x4820ab,_0x7d185d,_0x2a4417){this['notificationId']=uuid['v4']();this[_0x6793('0x3')]=_0x5132d8;this[_0x6793('0x4')]=_0x4820ab;this[_0x6793('0x5')]=_0x7d185d;this[_0x6793('0x6')]=_0x2a4417;this[_0x6793('0x3')][_0x6793('0x7')](this[_0x6793('0x8')][_0x6793('0x9')](this),this[_0x6793('0xa')][_0x6793('0x9')](this));this['squeue']['on'](_0x6793('0xb'),this['handleTimeout'][_0x6793('0x9')](this));this[_0x6793('0x3')]['on'](_0x6793('0xc'),this['handleDrained']['bind'](this));};Beepall[_0x6793('0xd')][_0x6793('0x7')]=function(){this[_0x6793('0x3')][_0x6793('0x7')](this['handleRun'][_0x6793('0x9')](this),this[_0x6793('0xa')][_0x6793('0x9')](this));};Beepall['prototype'][_0x6793('0xe')]=function(_0x4b4ce4){this['handleTimeout'](!![]);};Beepall[_0x6793('0xd')]['handleRun']=function(_0x409851){var _0x5015d8=!![];if(!_[_0x6793('0xf')](this[_0x6793('0x4')])&&!_[_0x6793('0xf')](this[_0x6793('0x4')][_0x6793('0x10')])&&this['queue'][_0x6793('0x10')][_0x6793('0x11')]>0x0){for(var _0x144b69=0x0,_0x2be27b;_0x144b690x0){for(var _0x1bb909=0x0,_0x3a9b6e;_0x1bb9090x0&&_0x59fc64[_0x17fb6f+_0xfd2b('0x24')]>=_0x59fc64[_0x17fb6f+_0xfd2b('0x23')]){writeLog(_0x3c9ffa,_0x59fc64,_0x17fb6f[_0xfd2b('0x25')]()+_0xfd2b('0x26'));return![];}}return!![];};exports[_0xfd2b('0x27')]=function(_0x271081,_0x40a15f,_0x56fc80,_0x26fac7,_0x533821){return sendNotification(!![],_0x271081,_0x40a15f,_0x56fc80,_0x26fac7,_0x533821);};exports[_0xfd2b('0x28')]=function(_0x1fbcff,_0x160c54,_0x38a250,_0xa9e1aa,_0x466a7c){return sendNotification(![],_0x1fbcff,_0x160c54,_0x38a250,_0xa9e1aa,_0x466a7c);};exports[_0xfd2b('0x29')]=writeLog; \ No newline at end of file +var _0x63a5=['hideNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','format','user:%s','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x63a5,0x18e));var _0x563a=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x63a5[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var utils=require(_0x563a('0x2'));var Mustache=require('mustache');var Redis=require(_0x563a('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x563a('0x4'))(_0x563a('0x5'));config[_0x563a('0x6')]=_[_0x563a('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x563a('0x8'))(new Redis(config['redis']));function emit(_0x2662f7,_0x4f89b4,_0x4d71a0){io['to'](_0x2662f7)['emit'](_0x4f89b4,_0x4d71a0);}function sendNotification(_0xff1f59,_0x32bf51,_0x32fb35,_0x606235,_0x255922,_0xa61ffa){io['to'](util[_0x563a('0x9')](_0x563a('0xa'),_0x606235[_0x563a('0xb')]))[_0x563a('0xc')](_0x563a('0xd'),_0x606235);var _0x2361dd=_0xa61ffa||{};var _0x25bb99=_0x32fb35[_0x563a('0xe')]('.');var _0x5059f4={'uniqueid':_0x32bf51,'channel':_0x25bb99[0x0],'id':_0x25bb99[0x1],'title':_0x25bb99[0x0]+_0x563a('0xf'),'interactionId':_0x25bb99[0x2],'queue':_0x255922?_0x255922[_0x563a('0xb')]:null,'sound':_0x2361dd[_0x563a('0x10')][_0x563a('0x11')],'shake':_0x2361dd[_0x563a('0x10')][_0x563a('0x12')]};try{if(!_0x2361dd['body']){_0x2361dd[_0x563a('0x13')]={};}if(_0x255922){_0x2361dd[_0x563a('0x13')][_0x563a('0x14')]=_0x255922;}else if(_0x2361dd[_0x563a('0x13')]['queue']){delete _0x2361dd['body'][_0x563a('0x14')];}_0x5059f4[_0x563a('0x15')]=utils['getMustacheRender'](_0x2361dd[_0x563a('0x10')][_0x563a('0x16')],_0x2361dd);}catch(_0x162a5a){_0x5059f4[_0x563a('0x15')]='I\x20can\x27t\x20render\x20your\x20template';logger['error'](util[_0x563a('0x9')](_0x563a('0x17'),_0x32bf51,_0x162a5a[_0x563a('0x18')]));}io['to'](util['format']('user:%s',_0x606235['name']))['emit'](util[_0x563a('0x9')](_0x563a('0x19'),_0xff1f59?_0x563a('0x1a'):_0x563a('0x1b')),_0x5059f4);}function writeLog(_0x562fce,_0x4e3b67,_0x3930f0){return logger[_0x563a('0x1c')](util[_0x563a('0x9')](_0x563a('0x1d'),_0x562fce,_0x4e3b67[_0x563a('0xb')],_0x3930f0));}exports[_0x563a('0x1e')]=function(_0x44b460,_0x563378,_0x506491,_0xd59ba8){if(_0x563378['busy']){writeLog(_0x44b460,_0x563378,_0x563a('0x1f'));return![];}if(!_0x563378[_0x563a('0x20')]){writeLog(_0x44b460,_0x563378,_0x563a('0x21'));return![];}if(_0x563378[_0x506491+_0x563a('0x22')]){writeLog(_0x44b460,_0x563378,_0x563a('0x23'));return![];}if(_0xd59ba8&&_0x563378[_0x563a('0x24')](_0x506491+_0x563a('0x25'))&&_0x563378[_0x563a('0x24')](_0x506491+'CurrentCapacity')){if(_0x563378[_0x506491+_0x563a('0x25')]>0x0&&_0x563378[_0x506491+_0x563a('0x26')]>=_0x563378[_0x506491+_0x563a('0x25')]){writeLog(_0x44b460,_0x563378,_0x506491[_0x563a('0x27')]()+_0x563a('0x28'));return![];}}return!![];};exports[_0x563a('0x29')]=function(_0x1afdff,_0x199045,_0x249db8,_0x8f3429,_0x1a69d5){return sendNotification(!![],_0x1afdff,_0x199045,_0x249db8,_0x8f3429,_0x1a69d5);};exports[_0x563a('0x2a')]=function(_0x1bdfb0,_0x7696c2,_0x579cb5,_0x43379c,_0x3c16d0){return sendNotification(![],_0x1bdfb0,_0x7696c2,_0x579cb5,_0x43379c,_0x3c16d0);};exports[_0x563a('0x2b')]=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 25bb65a..54f80a6 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 _0xeb37=['./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate'];(function(_0x30b520,_0x5133ae){var _0x5f4625=function(_0x21d2f5){while(--_0x21d2f5){_0x30b520['push'](_0x30b520['shift']());}};_0x5f4625(++_0x5133ae);}(_0xeb37,0x8f));var _0x7eb3=function(_0x4c07ff,_0xfd7b6e){_0x4c07ff=_0x4c07ff-0x0;var _0x9c7647=_0xeb37[_0x4c07ff];return _0x9c7647;};'use strict';var schema=require(_0x7eb3('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x7eb3('0x1'));var logger=require('../../../../config/logger')(_0x7eb3('0x2'));var system=schema({'command':{'type':_0x7eb3('0x3'),'required':!![],'message':_0x7eb3('0x4')}});exports['consequence']=function(_0x581fff,_0x183103){return function(_0x241830){try{var _0x16a55e={'command':_0x183103[0x0]};var _0x1bdca1=system[_0x7eb3('0x0')](_0x16a55e,{'typecast':!![]});if(_0x1bdca1[_0x7eb3('0x5')]){logger[_0x7eb3('0x6')](_0x7eb3('0x7'),_0x581fff,_['map'](_0x1bdca1,_0x7eb3('0x8'))[_0x7eb3('0x9')](',\x20'));logger[_0x7eb3('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x581fff);_0x241830[_0x7eb3('0xb')]();}else{var _0xf90bc0=this;var _0x5d1125=utils[_0x7eb3('0xc')](_0x183103[0x0],this);logger[_0x7eb3('0xa')](_0x7eb3('0xd'),_0x581fff,_0x5d1125);sh[_0x7eb3('0xe')](_[_0x7eb3('0xf')](_0x5d1125),function(_0x4565be,_0x1b9c4d){logger[_0x7eb3('0xa')](_0x7eb3('0x10'),_0x581fff,_0x4565be);if(_0x4565be==0x0){var _0xc75720=_0x1b9c4d[_0x7eb3('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x7eb3('0x12')](_0x183103[0x1])||_['isEmpty'](_0x183103[0x1])){logger[_0x7eb3('0xa')](_0x7eb3('0x13'),_0x581fff);_0xf90bc0[_0x7eb3('0x14')][_0x183103[0x1]]=_0xc75720;}else{logger[_0x7eb3('0xa')](_0x7eb3('0x15'),_0x581fff,_0x183103[0x1],_0xc75720);_0xf90bc0[_0x7eb3('0x14')][_0x183103[0x1]]=_0xc75720;}}_0x241830[_0x7eb3('0xb')]();});}}catch(_0x79ba87){logger[_0x7eb3('0x6')](_0x7eb3('0x7'),_0x581fff,_[_0x7eb3('0x16')](_0x79ba87)?JSON['stringify'](_0x79ba87):_0x79ba87);logger[_0x7eb3('0xa')](_0x7eb3('0x17'),_0x581fff);_0x241830['next']();}};}; \ No newline at end of file +var _0x0be4=['next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x14d8bf,_0x3e6f12){var _0x13d4c4=function(_0x3d3bfb){while(--_0x3d3bfb){_0x14d8bf['push'](_0x14d8bf['shift']());}};_0x13d4c4(++_0x3e6f12);}(_0x0be4,0x7e));var _0x40be=function(_0x181f01,_0x513037){_0x181f01=_0x181f01-0x0;var _0x3dfc0d=_0x0be4[_0x181f01];return _0x3dfc0d;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x40be('0x0'));var utils=require(_0x40be('0x1'));var logger=require(_0x40be('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x40be('0x3')}});exports['consequence']=function(_0x561c34,_0xb9cfa3){return function(_0x35a538){try{var _0x2c6479={'command':_0xb9cfa3[0x0]};var _0x7cb812=system[_0x40be('0x4')](_0x2c6479,{'typecast':!![]});if(_0x7cb812[_0x40be('0x5')]){logger[_0x40be('0x6')](_0x40be('0x7'),_0x561c34,_['map'](_0x7cb812,_0x40be('0x8'))[_0x40be('0x9')](',\x20'));logger[_0x40be('0xa')](_0x40be('0xb'),_0x561c34);_0x35a538[_0x40be('0xc')]();}else{var _0x3542f=this;var _0x207d70=utils[_0x40be('0xd')](_0xb9cfa3[0x0],this);logger[_0x40be('0xa')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x561c34,_0x207d70);sh[_0x40be('0xe')](_[_0x40be('0xf')](_0x207d70),function(_0x836c5c,_0x527939){logger[_0x40be('0xa')](_0x40be('0x10'),_0x561c34,_0x836c5c);if(_0x836c5c==0x0){var _0x2aa1e8=_0x527939['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xb9cfa3[0x1])||_[_0x40be('0x11')](_0xb9cfa3[0x1])){logger['info'](_0x40be('0x12'),_0x561c34);_0x3542f[_0x40be('0x13')][_0xb9cfa3[0x1]]=_0x2aa1e8;}else{logger[_0x40be('0xa')](_0x40be('0x14'),_0x561c34,_0xb9cfa3[0x1],_0x2aa1e8);_0x3542f[_0x40be('0x13')][_0xb9cfa3[0x1]]=_0x2aa1e8;}}_0x35a538[_0x40be('0xc')]();});}}catch(_0x2296b){logger['error'](_0x40be('0x7'),_0x561c34,_[_0x40be('0x15')](_0x2296b)?JSON[_0x40be('0x16')](_0x2296b):_0x2296b);logger[_0x40be('0xa')](_0x40be('0xb'),_0x561c34);_0x35a538[_0x40be('0xc')]();}};}; \ 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 6af1195..0476a07 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 _0xf797=['addTags','interaction','then','info','catch','stringify','finally','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','length','error','[%s][TAG]\x20%s','map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction'];(function(_0x17e96d,_0x9034b4){var _0x5594a7=function(_0x6c2966){while(--_0x6c2966){_0x17e96d['push'](_0x17e96d['shift']());}};_0x5594a7(++_0x9034b4);}(_0xf797,0x198));var _0x7f79=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xf797[_0x4ed520];return _0x4415a6;};'use strict';var schema=require(_0x7f79('0x0'));var _=require(_0x7f79('0x1'));var rpc={'chatInteraction':require(_0x7f79('0x2')),'openchannelInteraction':require(_0x7f79('0x3')),'smsInteraction':require(_0x7f79('0x4')),'mailInteraction':require(_0x7f79('0x5')),'faxInteraction':require(_0x7f79('0x6')),'whatsappInteraction':require(_0x7f79('0x7'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x7f79('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0xd6d42,_0x3fdde4,_0x188c0c,_0x2f6038){return function(_0x18b67a){try{var _0x5eaa9f={'tag':_0x3fdde4[0x0]};var _0x593769=tag['validate'](_0x5eaa9f,{'typecast':!![]});if(_0x593769[_0x7f79('0x9')]){logger[_0x7f79('0xa')](_0x7f79('0xb'),_0xd6d42,_[_0x7f79('0xc')](_0x593769,'message')[_0x7f79('0xd')](',\x20'));logger['info'](_0x7f79('0xe'),_0xd6d42);_0x18b67a['next']();}else{var _0x3ccda2={'ids':[_0x3fdde4[0x0]]};if(rpc[_0x2f6038[_0x7f79('0xf')]+_0x7f79('0x10')]){rpc[_0x2f6038[_0x7f79('0xf')]+_0x7f79('0x10')][_0x7f79('0x11')](_0x2f6038[_0x7f79('0x12')]['id'],_0x3ccda2)[_0x7f79('0x13')](function(_0x20bcce){logger[_0x7f79('0x14')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0xd6d42,_0x3fdde4[0x1],_0x2f6038[_0x7f79('0xf')],_0x2f6038[_0x7f79('0x12')]['id']);})[_0x7f79('0x15')](function(_0x4d2992){logger[_0x7f79('0xa')](_0x7f79('0xb'),_0xd6d42,JSON[_0x7f79('0x16')](_0x4d2992));logger[_0x7f79('0x14')](_0x7f79('0xe'),_0xd6d42);})[_0x7f79('0x17')](function(){_0x18b67a[_0x7f79('0x18')]();});}}}catch(_0x605d23){logger[_0x7f79('0xa')](_0x7f79('0xb'),_0xd6d42,_['isObject'](_0x605d23)?JSON[_0x7f79('0x16')](_0x605d23):_0x605d23);logger[_0x7f79('0x14')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xd6d42);_0x18b67a[_0x7f79('0x18')]();}};}; \ No newline at end of file +var _0xcf12=['../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','isObject','validate'];(function(_0x235fd4,_0x523a60){var _0x33af62=function(_0x4076c){while(--_0x4076c){_0x235fd4['push'](_0x235fd4['shift']());}};_0x33af62(++_0x523a60);}(_0xcf12,0x15f));var _0x2cf1=function(_0x1645b4,_0x1b8548){_0x1645b4=_0x1645b4-0x0;var _0xf8945=_0xcf12[_0x1645b4];return _0xf8945;};'use strict';var schema=require(_0x2cf1('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x2cf1('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x2cf1('0x2')),'faxInteraction':require(_0x2cf1('0x3')),'whatsappInteraction':require(_0x2cf1('0x4'))};var logger=require(_0x2cf1('0x5'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x2cf1('0x6')}});exports['consequence']=function(_0x2210f2,_0x13d9ad,_0xd418d9,_0x2d68f8){return function(_0x144549){try{var _0x38266d={'tag':_0x13d9ad[0x0]};var _0x6c1a3c=tag['validate'](_0x38266d,{'typecast':!![]});if(_0x6c1a3c['length']){logger[_0x2cf1('0x7')]('[%s][TAG]\x20%s',_0x2210f2,_[_0x2cf1('0x8')](_0x6c1a3c,_0x2cf1('0x9'))[_0x2cf1('0xa')](',\x20'));logger[_0x2cf1('0xb')](_0x2cf1('0xc'),_0x2210f2);_0x144549[_0x2cf1('0xd')]();}else{var _0x413640={'ids':[_0x13d9ad[0x0]]};if(rpc[_0x2d68f8[_0x2cf1('0xe')]+_0x2cf1('0xf')]){rpc[_0x2d68f8['channel']+_0x2cf1('0xf')][_0x2cf1('0x10')](_0x2d68f8[_0x2cf1('0x11')]['id'],_0x413640)['then'](function(_0x13157a){logger[_0x2cf1('0xb')](_0x2cf1('0x12'),_0x2210f2,_0x13d9ad[0x1],_0x2d68f8[_0x2cf1('0xe')],_0x2d68f8[_0x2cf1('0x11')]['id']);})[_0x2cf1('0x13')](function(_0x3cc6b9){logger[_0x2cf1('0x7')]('[%s][TAG]\x20%s',_0x2210f2,JSON[_0x2cf1('0x14')](_0x3cc6b9));logger[_0x2cf1('0xb')](_0x2cf1('0xc'),_0x2210f2);})['finally'](function(){_0x144549[_0x2cf1('0xd')]();});}}}catch(_0x263954){logger[_0x2cf1('0x7')]('[%s][TAG]\x20%s',_0x2210f2,_[_0x2cf1('0x15')](_0x263954)?JSON[_0x2cf1('0x14')](_0x263954):_0x263954);logger[_0x2cf1('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2210f2);_0x144549[_0x2cf1('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 7ccfd3a..f917a09 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9eb=['\x20-\x20','push','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','params','stringify','POST','application/json-rpc','then','result','logged','accessToken','channelId=','&data=','parse','log','next','validate','shelljs','lodash','request-promise','axios','tough-cookie','./utils','passport','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','replace'];(function(_0x3acb89,_0x2ca05e){var _0x4d38f2=function(_0x4cb6a9){while(--_0x4cb6a9){_0x3acb89['push'](_0x3acb89['shift']());}};_0x4d38f2(++_0x2ca05e);}(_0xd9eb,0xca));var _0xbd9e=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xd9eb[_0x1e3671];return _0x48d5f5;};'use strict';var schema=require(_0xbd9e('0x0'));var sh=require(_0xbd9e('0x1'));var _=require(_0xbd9e('0x2'));var rp=require(_0xbd9e('0x3'));var axios=require(_0xbd9e('0x4'));var tough=require(_0xbd9e('0x5'));var utils=require(_0xbd9e('0x6'));const {session}=require(_0xbd9e('0x7'));var logger=require(_0xbd9e('0x8'))(_0xbd9e('0x9'));var system=schema({'command':{'type':_0xbd9e('0xa'),'required':!![],'message':_0xbd9e('0xb')}});var arr=[];exports[_0xbd9e('0xc')]=function(_0x4ade3f,_0x26408d){return function(_0x37d9a1){var _0x293a79=_0x26408d[0xa];var _0x2dbf84=_0x26408d[0xb];var _0x20cddf=_0x26408d[0xc];var _0x7755b8=_0x26408d[0xd];var _0x131530=_0x26408d[0xe];var _0x82e476=_0x26408d[0xf][_0xbd9e('0xd')](/\n/g,_0xbd9e('0xe'));var _0x341383=_0x26408d[0x10][_0xbd9e('0xd')](/\n/g,'\x20');if(!arr['includes'](_0x2dbf84)){arr[_0xbd9e('0xf')](_0x2dbf84);var _0x1dba37='';var _0x5e6203=_0x26408d[0x3];var _0x381ee7=_0x26408d[0x4];var _0x50cee8=_0x26408d[0x1];var _0x7f185f=_0x26408d[0x0];var _0x4538da={};_0x4538da[_0xbd9e('0x10')]=_0x26408d[0x8]+_0xbd9e('0x11')+_0x20cddf+'|'+_0x293a79+'|'+_0x7755b8+'|'+_0x2dbf84+'|'+_0x131530;_0x4538da[_0xbd9e('0x12')]=_0x26408d[0x7]+_0xbd9e('0x11')+_0x20cddf+'|'+_0x293a79+'|'+_0x7755b8+'|'+_0x2dbf84+'|'+_0x131530+'|'+_0x82e476+'|'+_0x341383;_0x4538da[_0xbd9e('0x13')]=_0x26408d[0x9];var _0x261f51={};_0x261f51['jsonrpc']=_0xbd9e('0x14');_0x261f51[_0xbd9e('0x15')]=_0xbd9e('0x16');var _0xb17dc=[];_0xb17dc[_0xbd9e('0xf')](_0x26408d[0x2]);_0xb17dc[_0xbd9e('0xf')](_0x26408d[0x5]);_0xb17dc[_0xbd9e('0xf')](_0x26408d[0x6]);_0x261f51[_0xbd9e('0x17')]=_0xb17dc;_0x261f51['id']=0x1;var _0x4112a8=JSON[_0xbd9e('0x18')](_0x261f51);var _0x217af8={'encoding':'utf8','method':_0xbd9e('0x19'),'timeout':0x2710,'url':_0x5e6203,'headers':{'Content-Type':_0xbd9e('0x1a')},'body':_0x4112a8};return rp(_0x217af8)[_0xbd9e('0x1b')](function(_0x2b6c35){const _0x46f335=JSON['parse'](_0x2b6c35);if(_0x46f335[_0xbd9e('0x1c')][_0xbd9e('0x1d')]){var _0x37e6d8=_0x2dbf84;_0x1dba37=_0x46f335[_0xbd9e('0x1c')][_0xbd9e('0x1e')];var _0x599c68=_0xbd9e('0x1f')+_0x50cee8+'&serviceId='+_0x7f185f+'&sessionId='+_0x37e6d8+_0xbd9e('0x20')+JSON[_0xbd9e('0x18')](_0x4538da);var _0x2dacc1=_0x381ee7+'?'+_0x599c68;return rp(_0x2dacc1)[_0xbd9e('0x1b')](function(_0x57e206){const _0x435fd3=JSON[_0xbd9e('0x21')](_0x57e206);});}_0x37d9a1['next']();})['catch'](function(_0x2733cb){console[_0xbd9e('0x22')](_0x2733cb);});}else _0x37d9a1[_0xbd9e('0x23')]();};}; \ No newline at end of file +var _0x1893=['2.0','login','push','params','POST','application/json-rpc','then','parse','result','logged','accessToken','channelId=','&serviceId=','&data=','stringify','next','catch','log','lodash','request-promise','axios','tough-cookie','./utils','passport','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','\x20-\x20','replace','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x1893,0xa2));var _0x3189=function(_0x5b9252,_0x4bc2f8){_0x5b9252=_0x5b9252-0x0;var _0x1a4284=_0x1893[_0x5b9252];return _0x1a4284;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x3189('0x0'));var rp=require(_0x3189('0x1'));var axios=require(_0x3189('0x2'));var tough=require(_0x3189('0x3'));var utils=require(_0x3189('0x4'));const {session}=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('routing');var system=schema({'command':{'type':_0x3189('0x7'),'required':!![],'message':_0x3189('0x8')}});var arr=[];exports[_0x3189('0x9')]=function(_0x4080a9,_0x77c566){return function(_0x118970){var _0x14d84b=_0x77c566[0xa];var _0x1f6764=_0x77c566[0xb];var _0x5312a3=_0x77c566[0xc];var _0x1d5f6a=_0x77c566[0xd];var _0x56a190=_0x77c566[0xe];var _0x127449=_0x77c566[0xf]['replace'](/\n/g,_0x3189('0xa'));var _0x33cdfb=_0x77c566[0x10][_0x3189('0xb')](/\n/g,'\x20');if(!arr[_0x3189('0xc')](_0x1f6764)){arr['push'](_0x1f6764);var _0x187f54='';var _0x149428=_0x77c566[0x3];var _0x3b1c39=_0x77c566[0x4];var _0x1375aa=_0x77c566[0x1];var _0x429509=_0x77c566[0x0];var _0x5d9fff={};_0x5d9fff[_0x3189('0xd')]=_0x77c566[0x8]+_0x3189('0xe')+_0x5312a3+'|'+_0x14d84b+'|'+_0x1d5f6a+'|'+_0x1f6764+'|'+_0x56a190;_0x5d9fff[_0x3189('0xf')]=_0x77c566[0x7]+_0x3189('0xe')+_0x5312a3+'|'+_0x14d84b+'|'+_0x1d5f6a+'|'+_0x1f6764+'|'+_0x56a190+'|'+_0x127449+'|'+_0x33cdfb;_0x5d9fff[_0x3189('0x10')]=_0x77c566[0x9];var _0x20dcc2={};_0x20dcc2[_0x3189('0x11')]=_0x3189('0x12');_0x20dcc2['method']=_0x3189('0x13');var _0xb3e4c2=[];_0xb3e4c2[_0x3189('0x14')](_0x77c566[0x2]);_0xb3e4c2[_0x3189('0x14')](_0x77c566[0x5]);_0xb3e4c2['push'](_0x77c566[0x6]);_0x20dcc2[_0x3189('0x15')]=_0xb3e4c2;_0x20dcc2['id']=0x1;var _0x5f2e82=JSON['stringify'](_0x20dcc2);var _0x13f95f={'encoding':'utf8','method':_0x3189('0x16'),'timeout':0x2710,'url':_0x149428,'headers':{'Content-Type':_0x3189('0x17')},'body':_0x5f2e82};return rp(_0x13f95f)[_0x3189('0x18')](function(_0x9905c4){const _0x4c4d9b=JSON[_0x3189('0x19')](_0x9905c4);if(_0x4c4d9b[_0x3189('0x1a')][_0x3189('0x1b')]){var _0x47979d=_0x1f6764;_0x187f54=_0x4c4d9b[_0x3189('0x1a')][_0x3189('0x1c')];var _0x306ed3=_0x3189('0x1d')+_0x1375aa+_0x3189('0x1e')+_0x429509+'&sessionId='+_0x47979d+_0x3189('0x1f')+JSON[_0x3189('0x20')](_0x5d9fff);var _0x29a2ca=_0x3b1c39+'?'+_0x306ed3;return rp(_0x29a2ca)['then'](function(_0x309c6e){const _0x47abb4=JSON[_0x3189('0x19')](_0x309c6e);});}_0x118970[_0x3189('0x21')]();})[_0x3189('0x22')](function(_0x38e56a){console[_0x3189('0x23')](_0x38e56a);});}else _0x118970[_0x3189('0x21')]();};}; \ 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 6a5b5c8..9346be4 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 _0x3402=['exports','body','contact','message','account','interaction','mustache'];(function(_0x48e323,_0x1b18e2){var _0x7016cc=function(_0x349b0d){while(--_0x349b0d){_0x48e323['push'](_0x48e323['shift']());}};_0x7016cc(++_0x1b18e2);}(_0x3402,0x1f0));var _0x2340=function(_0x34e98f,_0x39989e){_0x34e98f=_0x34e98f-0x0;var _0x5b4d1c=_0x3402[_0x34e98f];return _0x5b4d1c;};'use strict';var Mustache=require(_0x2340('0x0'));var _=require('lodash');module[_0x2340('0x1')]={'getMustacheRender':function(_0x2f1b72,_0x3a90e1){return Mustache['render'](_0x2f1b72,_['merge'](_0x3a90e1[_0x2340('0x2')],{'contact':_0x3a90e1[_0x2340('0x3')],'message':_0x3a90e1[_0x2340('0x4')],'account':_0x3a90e1[_0x2340('0x5')],'interaction':_0x3a90e1[_0x2340('0x6')],'list':_0x3a90e1['list']}))||'';}}; \ No newline at end of file +var _0x3b75=['contact','account','interaction','list','mustache','lodash','exports','merge'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x3b75,0xdc));var _0x53b7=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x3b75[_0x1762b4];return _0x29beda;};'use strict';var Mustache=require(_0x53b7('0x0'));var _=require(_0x53b7('0x1'));module[_0x53b7('0x2')]={'getMustacheRender':function(_0x3bd8fc,_0x2eaf0c){return Mustache['render'](_0x3bd8fc,_[_0x53b7('0x3')](_0x2eaf0c['body'],{'contact':_0x2eaf0c[_0x53b7('0x4')],'message':_0x2eaf0c['message'],'account':_0x2eaf0c[_0x53b7('0x5')],'interaction':_0x2eaf0c[_0x53b7('0x6')],'list':_0x2eaf0c[_0x53b7('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ad5c5a0..79f4106 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 _0x3140=['../lib/rule-engine','format','isNil','IntervalId','map','Intervals','interval','rules','channel','message','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','info','stringify','emit','stack','routing\x20is\x20empty','agent','agents','busyQueue','interaction','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport'];(function(_0x5baed9,_0x409757){var _0x43aad3=function(_0x4e6713){while(--_0x4e6713){_0x5baed9['push'](_0x5baed9['shift']());}};_0x43aad3(++_0x409757);}(_0x3140,0xaf));var _0x0314=function(_0x465b0c,_0x569d90){_0x465b0c=_0x465b0c-0x0;var _0x502ff0=_0x3140[_0x465b0c];return _0x502ff0;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var fs=require('fs');var jayson=require(_0x0314('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var config=require(_0x0314('0x4'));var logger=require(_0x0314('0x5'))(_0x0314('0x6'));var rpc={'openchannelQueueReport':require(_0x0314('0x7')),'mailQueueReport':require(_0x0314('0x8')),'chatQueueReport':require(_0x0314('0x9')),'smsQueueReport':require(_0x0314('0xa')),'faxQueueReport':require(_0x0314('0xb')),'whatsappQueueReport':require(_0x0314('0xc'))};var RuleEngine=require(_0x0314('0xd'));function getId(_0x176944,_0x495b27,_0x26031f){return util[_0x0314('0xe')]('%s.%s.%s',_0x176944,_0x495b27||0x0,_0x26031f||0x0);}function getIntervals(_0x5e9bca,_0xf2561e){var _0x4e6545=[];if(!_[_0x0314('0xf')](_0xf2561e[_0x0314('0x10')])&&!_[_0x0314('0xf')](_0x5e9bca[_0xf2561e[_0x0314('0x10')]])&&!_[_0x0314('0xf')](_0x5e9bca[_0xf2561e[_0x0314('0x10')]]['Intervals'])){_0x4e6545=_[_0x0314('0x11')](_0x5e9bca[_0xf2561e[_0x0314('0x10')]][_0x0314('0x12')],_0x0314('0x13'));}else if(!_[_0x0314('0xf')](_0xf2561e[_0x0314('0x13')])){_0x4e6545=[_0xf2561e[_0x0314('0x13')]];}return _0x4e6545;}exports['listen']=function(_0x1c26ff){_0x1c26ff[_0x0314('0x14')]={};return new BPromise(function(_0x1316a0,_0x12d026){var _0x40566e={'Start':function(_0x398c91){var _0x413bfa=this;return new Promise(function(_0x3ea356,_0x5e460f){if(_0x398c91){try{var _0xb9730b=[];var _0x24cd42=getId(_0x398c91[_0x0314('0x15')],_0x398c91['message']?_0x398c91[_0x0314('0x16')]['id']:0x0,_0x398c91['interaction']?_0x398c91['interaction']['id']:0x0);if(_0x398c91[_0x0314('0x17')]&&_[_0x0314('0x18')](_0x398c91['applications'])&&_0x398c91[_0x0314('0x17')][_0x0314('0x19')]){for(var _0x583ffa=0x0;_0x583ffa<_0x398c91[_0x0314('0x17')]['length'];_0x583ffa+=0x1){var _0xd03f0f=_0x398c91[_0x0314('0x17')][_0x583ffa];if(fs[_0x0314('0x1a')](path[_0x0314('0x1b')](__dirname,_0x0314('0x17'),_0xd03f0f[_0x0314('0x1c')]+'.js'))){var _0x56ef33=[];switch(_0xd03f0f[_0x0314('0x1c')][_0x0314('0x1d')]()){case _0x0314('0x1e'):var _0x174119=_0xd03f0f[_0x0314('0x1f')][_0x0314('0x20')](',');if(_0x398c91['channel']===_0x0314('0x21')){_0x56ef33[_0x0314('0x22')](_0x174119[0x0]);_0x56ef33['push'](_0x174119[0x1]);_0x56ef33[_0x0314('0x22')](_0x174119[_0x0314('0x23')](0x2,_0x174119[_0x0314('0x19')])[_0x0314('0x1b')](','));}else{_0x56ef33[_0x0314('0x22')](_0x174119[0x0]);_0x56ef33[_0x0314('0x22')](_0x174119['slice'](0x1,_0x174119[_0x0314('0x19')])[_0x0314('0x1b')](','));}break;case _0x0314('0x24'):var _0x47c2d1=_0xd03f0f[_0x0314('0x1f')][_0x0314('0x20')](',');_0x56ef33['push'](_0x47c2d1[0x0]);_0x56ef33['push'](_0x47c2d1[0x1]);_0x56ef33[_0x0314('0x22')](_0x47c2d1[_0x0314('0x23')](0x2,_0x47c2d1['length'])[_0x0314('0x1b')](','));break;case _0x0314('0x25'):var _0x5291c2=_0xd03f0f['appdata'][_0x0314('0x20')](',');_0x56ef33[_0x0314('0x22')](_0x5291c2[0x0]);_0x56ef33['push'](_0x5291c2[0x1]);_0x56ef33[_0x0314('0x22')](_0x5291c2[0x2]);_0x56ef33[_0x0314('0x22')](_0x5291c2[0x3]);_0x56ef33[_0x0314('0x22')](_0x5291c2['slice'](0x4,_0x5291c2[_0x0314('0x19')])[_0x0314('0x1b')](','));break;case _0x0314('0x26'):var _0x1e42f0=_0xd03f0f['appdata'][_0x0314('0x20')](',');_0x56ef33['push'](_0x1e42f0[0x0]);_0x56ef33['push'](_0x1e42f0[0x1]);_0x56ef33[_0x0314('0x22')](_0x1e42f0[0x2]);_0x56ef33[_0x0314('0x22')](_0x1e42f0[0x3]);_0x56ef33[_0x0314('0x22')](_0x1e42f0['slice'](0x4,_0x1e42f0[_0x0314('0x19')])['join'](','));break;case _0x0314('0x16'):_0x56ef33['push'](_0xd03f0f['appdata']);break;case _0x0314('0x27'):_0x56ef33['push'](_0xd03f0f[_0x0314('0x28')]);_0x56ef33[_0x0314('0x22')](_0xd03f0f[_0x0314('0x1f')]);break;default:_0x56ef33=_[_0x0314('0xf')](_0xd03f0f[_0x0314('0x1f')])?[]:_0xd03f0f[_0x0314('0x1f')][_0x0314('0x20')](',');}var _0x4c763e={'id':util[_0x0314('0xe')](_0x0314('0x29'),_0x24cd42,_0xd03f0f['id'],_0xd03f0f[_0x0314('0x1c')]),'condition':require(_0x0314('0x2a'))[_0x0314('0x2b')](_0x24cd42,getIntervals(_0x1c26ff[_0x0314('0x2c')],_0xd03f0f),_0x1c26ff),'consequence':require('./applications/'+_0xd03f0f[_0x0314('0x1c')])['consequence'](_0x24cd42,_0x56ef33,_0x1c26ff,_0x398c91),'p':_0xd03f0f[_0x0314('0x2d')]||0x0};logger['info'](_0x0314('0x2e'),_0x4c763e['id'],'on\x20interval',getIntervals(_0x1c26ff['intervals'],_0xd03f0f)['join'](_0x0314('0x2f')));_0xb9730b[_0x0314('0x22')](_0x4c763e);}else{logger[_0x0314('0x30')](_0x0314('0x31'),path[_0x0314('0x1b')](__dirname,'applications',_0xd03f0f[_0x0314('0x1c')]+_0x0314('0x32')));}}_0x1c26ff[_0x0314('0x14')][_0x24cd42]=new RuleEngine(_0xb9730b);_0x1c26ff['rules'][_0x24cd42][_0x0314('0x33')](_0x398c91,function(_0x58b650){logger[_0x0314('0x34')]('Applications\x20executed',JSON[_0x0314('0x35')](_0x58b650['matchPath']));if(_0x1c26ff['rules'][_0x24cd42]){_0x1c26ff[_0x0314('0x14')][_0x24cd42][_0x0314('0x36')]('complete');}});return _0x3ea356({'code':0xc8,'message':_0x398c91});}else{logger[_0x0314('0x34')]('No\x20applications\x20to\x20execute');return _0x3ea356({'code':0xc8,'message':_0x398c91});}}catch(_0x31a5b2){logger[_0x0314('0x30')](_0x31a5b2[_0x0314('0x37')]);return _0x5e460f(_0x413bfa[_0x0314('0x30')](0x1f4,_0x31a5b2));}}return _0x5e460f(_0x0314('0x38'));});},'AcceptMessage':function(_0x5751cf){var _0x52a71c=this;return new Promise(function(_0x37c07e,_0x3b070a){if(_0x5751cf['agent']&&_0x5751cf[_0x0314('0x39')]['id']){if(_0x1c26ff[_0x0314('0x3a')][_0x5751cf[_0x0314('0x39')]['id']]){_0x1c26ff['agents'][_0x5751cf[_0x0314('0x39')]['id']]['busy']=![];_0x1c26ff[_0x0314('0x3a')][_0x5751cf[_0x0314('0x39')]['id']][_0x0314('0x3b')]=undefined;}}if(_0x5751cf['message']&&_0x5751cf[_0x0314('0x16')]['id']){try{var _0xf4c4a1=getId(_0x5751cf['channel'],_0x5751cf['message']?_0x5751cf['message']['id']:0x0,_0x5751cf[_0x0314('0x3c')]?_0x5751cf[_0x0314('0x3c')]['id']:0x0);if(_0x1c26ff[_0x0314('0x14')][_0xf4c4a1]){_0x1c26ff['rules'][_0xf4c4a1][_0x0314('0x36')](_0x0314('0x3d'));if(rpc[_0x5751cf[_0x0314('0x15')]+_0x0314('0x3e')]){rpc[_0x5751cf[_0x0314('0x15')]+'QueueReport'][_0x0314('0x3f')](_0xf4c4a1,{'UserId':_0x5751cf[_0x0314('0x16')][_0x0314('0x40')]})[_0x0314('0x41')](function(_0x1b7292){logger[_0x0314('0x30')](_0x0314('0x42'));});}}return _0x37c07e({'code':0xc8,'message':_0x5751cf});}catch(_0x4cfa54){logger[_0x0314('0x30')](_0x4cfa54[_0x0314('0x37')]);return _0x3b070a(_0x52a71c['error'](0x1f4,_0x4cfa54));}}logger[_0x0314('0x30')](_0x0314('0x43'));return _0x3b070a(_0x52a71c[_0x0314('0x30')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x4a1850){var _0x128889=this;return new Promise(function(_0x1a4033,_0x2cbed3){if(_0x4a1850[_0x0314('0x39')]&&_0x4a1850[_0x0314('0x39')]['id']){try{if(_0x1c26ff[_0x0314('0x3a')][_0x4a1850[_0x0314('0x39')]['id']]){_0x1c26ff['agents'][_0x4a1850[_0x0314('0x39')]['id']]['busy']=![];_0x1c26ff[_0x0314('0x3a')][_0x4a1850[_0x0314('0x39')]['id']][_0x0314('0x3b')]=undefined;}return _0x1a4033({'code':0xc8,'message':_0x4a1850});}catch(_0x362b60){logger[_0x0314('0x30')](_0x362b60['stack']);return _0x2cbed3(_0x128889['error'](0x1f4,_0x362b60));}}logger[_0x0314('0x30')](_0x0314('0x43'));return _0x2cbed3(_0x128889[_0x0314('0x30')](0x1f4,_0x0314('0x43')));});},'AbandonInteraction':function(_0x5b3c49){var _0x2f206c=this;return new Promise(function(_0x295fa5,_0x2b601a){if(_0x5b3c49[_0x0314('0x15')]&&_0x5b3c49[_0x0314('0x3c')]&&_0x5b3c49[_0x0314('0x3c')]['id']){try{var _0x1d0a65=getId(_0x5b3c49['channel'],_0x5b3c49[_0x0314('0x16')]?_0x5b3c49[_0x0314('0x16')]['id']:0x0,_0x5b3c49[_0x0314('0x3c')]?_0x5b3c49['interaction']['id']:0x0);if(_0x1c26ff[_0x0314('0x14')][_0x1d0a65]){_0x1c26ff[_0x0314('0x14')][_0x1d0a65]['emit'](_0x0314('0x3d'));}return _0x295fa5({'code':0xc8,'message':_0x5b3c49});}catch(_0xfb5170){logger[_0x0314('0x30')](_0xfb5170[_0x0314('0x37')]);return _0x2b601a(_0x2f206c['error'](0x1f4,_0xfb5170));}}logger[_0x0314('0x30')](_0x0314('0x43'));return _0x2b601a(_0x2f206c[_0x0314('0x30')](0x1f4,_0x0314('0x43')));});},'AgentCapacity':function(_0x227ee1){var _0x10da3a=this;return new Promise(function(_0x35cf11,_0x275a60){if(_0x1c26ff[_0x0314('0x3a')][_0x0314('0x44')](_0x227ee1['id'])){for(var _0x573777 in _0x227ee1[_0x0314('0x45')]){if(_0x227ee1[_0x0314('0x45')][_0x0314('0x44')](_0x573777)){if(_0x1c26ff[_0x0314('0x3a')][_0x227ee1['id']][_0x0314('0x44')](_0x573777+_0x0314('0x46'))){_0x1c26ff[_0x0314('0x3a')][_0x227ee1['id']][_0x573777+'CurrentCapacity']=parseInt(_0x227ee1['capacity'][_0x573777],0xa);}}}_0x1c26ff['agents'][_0x227ee1['id']][_0x0314('0x47')]();return _0x35cf11({'code':0xc8,'message':_0x1c26ff[_0x0314('0x3a')][_0x227ee1['id']]});}else{return _0x275a60(_0x10da3a['error'](0x1f4,_0x0314('0x48')));}});},'Agents':function(_0x35c961){return new Promise(function(_0x2ef23f,_0x4b35d8){var _0x50e8dc=_[_0x0314('0x49')](_0x1c26ff[_0x0314('0x3a')]);_0x2ef23f({'count':_0x50e8dc['length'],'rows':_0x50e8dc});});},'ChatQueues':function(_0x27b7c4){return new Promise(function(_0x4b022a,_0x1b7cee){var _0x143d4c=[];for(var _0x1ba76c in _0x1c26ff[_0x0314('0x4a')]){if(_0x1c26ff['chatQueues'][_0x0314('0x44')](_0x1ba76c)){var _0x3fc295=_0x1c26ff[_0x0314('0x4a')][_0x1ba76c];var _0x59116e={'id':_0x3fc295['id'],'available':_0x3fc295[_0x0314('0x4b')],'loggedIn':_0x3fc295[_0x0314('0x4c')],'name':_0x3fc295[_0x0314('0x4d')],'paused':_0x3fc295[_0x0314('0x4e')],'waiting':_0x3fc295[_0x0314('0x4f')]};_0x143d4c[_0x0314('0x22')](_0x59116e);}}_0x4b022a({'count':_0x143d4c[_0x0314('0x19')],'rows':_0x143d4c});});},'MailQueues':function(_0x4ff97b){return new Promise(function(_0x340676,_0x597f7b){var _0x4d5da1=[];for(var _0xb114f9 in _0x1c26ff['mailQueues']){if(_0x1c26ff[_0x0314('0x50')][_0x0314('0x44')](_0xb114f9)){var _0x26c174=_0x1c26ff[_0x0314('0x50')][_0xb114f9];var _0x2a7b05={'id':_0x26c174['id'],'available':_0x26c174[_0x0314('0x4b')],'loggedIn':_0x26c174[_0x0314('0x4c')],'name':_0x26c174[_0x0314('0x4d')],'paused':_0x26c174['paused'],'waiting':_0x26c174['waiting']};_0x4d5da1[_0x0314('0x22')](_0x2a7b05);}}_0x340676({'count':_0x4d5da1[_0x0314('0x19')],'rows':_0x4d5da1});});},'OpenchannelQueues':function(_0xf480fe){return new Promise(function(_0x582451,_0x4b59b9){var _0x549aaa=[];for(var _0x6f0d19 in _0x1c26ff[_0x0314('0x51')]){if(_0x1c26ff['openchannelQueues'][_0x0314('0x44')](_0x6f0d19)){var _0x3befab=_0x1c26ff[_0x0314('0x51')][_0x6f0d19];var _0x3496a0={'id':_0x3befab['id'],'available':_0x3befab[_0x0314('0x4b')],'loggedIn':_0x3befab[_0x0314('0x4c')],'name':_0x3befab['name'],'paused':_0x3befab[_0x0314('0x4e')],'waiting':_0x3befab[_0x0314('0x4f')]};_0x549aaa[_0x0314('0x22')](_0x3496a0);}}_0x582451({'count':_0x549aaa['length'],'rows':_0x549aaa});});},'SmsQueues':function(_0x1adb61){return new Promise(function(_0x23b551,_0x2cbef3){var _0x51632e=[];for(var _0x2f818e in _0x1c26ff[_0x0314('0x52')]){if(_0x1c26ff['smsQueues'][_0x0314('0x44')](_0x2f818e)){var _0x35a5cc=_0x1c26ff[_0x0314('0x52')][_0x2f818e];var _0x2d0a38={'id':_0x35a5cc['id'],'available':_0x35a5cc[_0x0314('0x4b')],'loggedIn':_0x35a5cc['loggedIn'],'name':_0x35a5cc[_0x0314('0x4d')],'paused':_0x35a5cc[_0x0314('0x4e')],'waiting':_0x35a5cc['waiting']};_0x51632e['push'](_0x2d0a38);}}_0x23b551({'count':_0x51632e[_0x0314('0x19')],'rows':_0x51632e});});},'FaxQueues':function(_0x381a5d){return new Promise(function(_0x30726f,_0x44e3d7){var _0x3359a6=[];for(var _0x2bcaf5 in _0x1c26ff[_0x0314('0x53')]){if(_0x1c26ff['faxQueues'][_0x0314('0x44')](_0x2bcaf5)){var _0x1b6cc5=_0x1c26ff[_0x0314('0x53')][_0x2bcaf5];var _0x11fb3f={'id':_0x1b6cc5['id'],'available':_0x1b6cc5['available'],'loggedIn':_0x1b6cc5[_0x0314('0x4c')],'name':_0x1b6cc5[_0x0314('0x4d')],'paused':_0x1b6cc5['paused'],'waiting':_0x1b6cc5[_0x0314('0x4f')]};_0x3359a6[_0x0314('0x22')](_0x11fb3f);}}_0x30726f({'count':_0x3359a6['length'],'rows':_0x3359a6});});},'WhatsappQueues':function(_0x50f6fa){return new Promise(function(_0x138bf9,_0x572b50){var _0x2fdeb7=[];for(var _0x4aa544 in _0x1c26ff['whatsappQueues']){if(_0x1c26ff[_0x0314('0x54')][_0x0314('0x44')](_0x4aa544)){var _0x452ca7=_0x1c26ff[_0x0314('0x54')][_0x4aa544];var _0x30efcd={'id':_0x452ca7['id'],'available':_0x452ca7['available'],'loggedIn':_0x452ca7[_0x0314('0x4c')],'name':_0x452ca7[_0x0314('0x4d')],'paused':_0x452ca7[_0x0314('0x4e')],'waiting':_0x452ca7[_0x0314('0x4f')]};_0x2fdeb7[_0x0314('0x22')](_0x30efcd);}}_0x138bf9({'count':_0x2fdeb7[_0x0314('0x19')],'rows':_0x2fdeb7});});},'ChatQueuesWaitingInteractions':function(_0x144929){return new Promise(function(_0x68ac7f,_0x2d00ab){var _0x4ed0ed=_[_0x0314('0x49')](_0x1c26ff[_0x0314('0x55')]);_0x68ac7f({'count':_0x4ed0ed[_0x0314('0x19')],'rows':_0x4ed0ed});});},'MailQueuesWaitingInteractions':function(_0x453bf7){return new Promise(function(_0x2b3b46,_0x40fa77){var _0x43ae9c=_[_0x0314('0x49')](_0x1c26ff[_0x0314('0x56')]);_0x2b3b46({'count':_0x43ae9c[_0x0314('0x19')],'rows':_0x43ae9c});});},'OpenchannelQueuesWaitingInteractions':function(_0x1f289d){return new Promise(function(_0x55a6f2,_0x2238e8){var _0x2b1493=_[_0x0314('0x49')](_0x1c26ff['openchannelQueuesWaitingInteractions']);_0x55a6f2({'count':_0x2b1493[_0x0314('0x19')],'rows':_0x2b1493});});},'SmsQueuesWaitingInteractions':function(_0x29e115){return new Promise(function(_0x13ff4a,_0x2ff22c){var _0x1b2d62=_[_0x0314('0x49')](_0x1c26ff[_0x0314('0x57')]);_0x13ff4a({'count':_0x1b2d62[_0x0314('0x19')],'rows':_0x1b2d62});});},'FaxQueuesWaitingInteractions':function(_0xb220cf){return new Promise(function(_0x1c7120,_0x1459e0){var _0x54e58a=_[_0x0314('0x49')](_0x1c26ff[_0x0314('0x58')]);_0x1c7120({'count':_0x54e58a[_0x0314('0x19')],'rows':_0x54e58a});});},'WhatsappQueuesWaitingInteractions':function(_0x110212){return new Promise(function(_0x2da3db,_0x53639d){var _0x3bbd81=_['values'](_0x1c26ff[_0x0314('0x59')]);_0x2da3db({'count':_0x3bbd81['length'],'rows':_0x3bbd81});});}};var _0x4ddec0=jayson[_0x0314('0x5a')](_0x40566e)['http']();_0x4ddec0['on'](_0x0314('0x30'),function(_0x162a48){logger[_0x0314('0x30')](JSON[_0x0314('0x35')](_0x162a48));return _0x12d026(_0x162a48);});_0x4ddec0['listen'](0x232c,_0x0314('0x5b'),function(){console[_0x0314('0x5c')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x1316a0(_0x0314('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x56e6=['mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','appdata','split','push','dialogflow','slice','join','dialogflowv2','amazonlex','tag','%s:%s:%s','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','interaction','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting'];(function(_0x4f9c1a,_0x476bd3){var _0x54dda7=function(_0x200355){while(--_0x200355){_0x4f9c1a['push'](_0x4f9c1a['shift']());}};_0x54dda7(++_0x476bd3);}(_0x56e6,0x6b));var _0x656e=function(_0x3ac99c,_0x219e27){_0x3ac99c=_0x3ac99c-0x0;var _0x57553c=_0x56e6[_0x3ac99c];return _0x57553c;};'use strict';var _=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var path=require(_0x656e('0x2'));var fs=require('fs');var jayson=require(_0x656e('0x3'));var BPromise=require(_0x656e('0x4'));var uuid=require(_0x656e('0x5'));var config=require('../../../config/environment');var logger=require(_0x656e('0x6'))(_0x656e('0x7'));var rpc={'openchannelQueueReport':require(_0x656e('0x8')),'mailQueueReport':require(_0x656e('0x9')),'chatQueueReport':require(_0x656e('0xa')),'smsQueueReport':require(_0x656e('0xb')),'faxQueueReport':require(_0x656e('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x656e('0xd'));function getId(_0x1538a5,_0x1dad4e,_0x2fc011){return util[_0x656e('0xe')](_0x656e('0xf'),_0x1538a5,_0x1dad4e||0x0,_0x2fc011||0x0);}function getIntervals(_0x30d78c,_0x202205){var _0x2fafcc=[];if(!_[_0x656e('0x10')](_0x202205[_0x656e('0x11')])&&!_[_0x656e('0x10')](_0x30d78c[_0x202205[_0x656e('0x11')]])&&!_[_0x656e('0x10')](_0x30d78c[_0x202205['IntervalId']]['Intervals'])){_0x2fafcc=_[_0x656e('0x12')](_0x30d78c[_0x202205[_0x656e('0x11')]][_0x656e('0x13')],_0x656e('0x14'));}else if(!_['isNil'](_0x202205['interval'])){_0x2fafcc=[_0x202205[_0x656e('0x14')]];}return _0x2fafcc;}exports[_0x656e('0x15')]=function(_0x53699e){_0x53699e[_0x656e('0x16')]={};return new BPromise(function(_0x5059d9,_0x2ce681){var _0x7e4d57={'Start':function(_0x2a52f7){var _0x1f839f=this;return new Promise(function(_0x5a1fc3,_0x3ab51b){if(_0x2a52f7){try{var _0x38e2e3=[];var _0x3e4d1e=getId(_0x2a52f7[_0x656e('0x17')],_0x2a52f7[_0x656e('0x18')]?_0x2a52f7['message']['id']:0x0,_0x2a52f7['interaction']?_0x2a52f7['interaction']['id']:0x0);if(_0x2a52f7[_0x656e('0x19')]&&_[_0x656e('0x1a')](_0x2a52f7['applications'])&&_0x2a52f7[_0x656e('0x19')]['length']){for(var _0x495f60=0x0;_0x495f60<_0x2a52f7['applications'][_0x656e('0x1b')];_0x495f60+=0x1){var _0x2f99c6=_0x2a52f7[_0x656e('0x19')][_0x495f60];if(fs[_0x656e('0x1c')](path['join'](__dirname,_0x656e('0x19'),_0x2f99c6[_0x656e('0x1d')]+_0x656e('0x1e')))){var _0x59c19f=[];switch(_0x2f99c6[_0x656e('0x1d')][_0x656e('0x1f')]()){case _0x656e('0x20'):var _0x988f4c=_0x2f99c6[_0x656e('0x21')][_0x656e('0x22')](',');if(_0x2a52f7[_0x656e('0x17')]==='mail'){_0x59c19f[_0x656e('0x23')](_0x988f4c[0x0]);_0x59c19f[_0x656e('0x23')](_0x988f4c[0x1]);_0x59c19f['push'](_0x988f4c['slice'](0x2,_0x988f4c[_0x656e('0x1b')])['join'](','));}else{_0x59c19f[_0x656e('0x23')](_0x988f4c[0x0]);_0x59c19f['push'](_0x988f4c['slice'](0x1,_0x988f4c[_0x656e('0x1b')])['join'](','));}break;case _0x656e('0x24'):var _0x23a4bb=_0x2f99c6[_0x656e('0x21')]['split'](',');_0x59c19f['push'](_0x23a4bb[0x0]);_0x59c19f[_0x656e('0x23')](_0x23a4bb[0x1]);_0x59c19f[_0x656e('0x23')](_0x23a4bb[_0x656e('0x25')](0x2,_0x23a4bb[_0x656e('0x1b')])[_0x656e('0x26')](','));break;case _0x656e('0x27'):var _0xfece84=_0x2f99c6['appdata'][_0x656e('0x22')](',');_0x59c19f['push'](_0xfece84[0x0]);_0x59c19f[_0x656e('0x23')](_0xfece84[0x1]);_0x59c19f[_0x656e('0x23')](_0xfece84[0x2]);_0x59c19f['push'](_0xfece84[0x3]);_0x59c19f[_0x656e('0x23')](_0xfece84['slice'](0x4,_0xfece84['length'])[_0x656e('0x26')](','));break;case _0x656e('0x28'):var _0x33c853=_0x2f99c6['appdata'][_0x656e('0x22')](',');_0x59c19f['push'](_0x33c853[0x0]);_0x59c19f[_0x656e('0x23')](_0x33c853[0x1]);_0x59c19f[_0x656e('0x23')](_0x33c853[0x2]);_0x59c19f['push'](_0x33c853[0x3]);_0x59c19f[_0x656e('0x23')](_0x33c853['slice'](0x4,_0x33c853['length'])[_0x656e('0x26')](','));break;case'message':_0x59c19f[_0x656e('0x23')](_0x2f99c6[_0x656e('0x21')]);break;case _0x656e('0x29'):_0x59c19f[_0x656e('0x23')](_0x2f99c6['TagId']);_0x59c19f['push'](_0x2f99c6[_0x656e('0x21')]);break;default:_0x59c19f=_['isNil'](_0x2f99c6[_0x656e('0x21')])?[]:_0x2f99c6[_0x656e('0x21')][_0x656e('0x22')](',');}var _0x807b17={'id':util[_0x656e('0xe')](_0x656e('0x2a'),_0x3e4d1e,_0x2f99c6['id'],_0x2f99c6['app']),'condition':require('./interval')['condition'](_0x3e4d1e,getIntervals(_0x53699e['intervals'],_0x2f99c6),_0x53699e),'consequence':require('./applications/'+_0x2f99c6[_0x656e('0x1d')])['consequence'](_0x3e4d1e,_0x59c19f,_0x53699e,_0x2a52f7),'p':_0x2f99c6['priority']||0x0};logger[_0x656e('0x2b')](_0x656e('0x2c'),_0x807b17['id'],_0x656e('0x2d'),getIntervals(_0x53699e[_0x656e('0x2e')],_0x2f99c6)[_0x656e('0x26')](_0x656e('0x2f')));_0x38e2e3[_0x656e('0x23')](_0x807b17);}else{logger[_0x656e('0x30')](_0x656e('0x31'),path[_0x656e('0x26')](__dirname,_0x656e('0x19'),_0x2f99c6[_0x656e('0x1d')]+_0x656e('0x1e')));}}_0x53699e['rules'][_0x3e4d1e]=new RuleEngine(_0x38e2e3);_0x53699e[_0x656e('0x16')][_0x3e4d1e]['execute'](_0x2a52f7,function(_0x4bd951){logger[_0x656e('0x2b')](_0x656e('0x32'),JSON[_0x656e('0x33')](_0x4bd951['matchPath']));if(_0x53699e['rules'][_0x3e4d1e]){_0x53699e['rules'][_0x3e4d1e][_0x656e('0x34')](_0x656e('0x35'));}});return _0x5a1fc3({'code':0xc8,'message':_0x2a52f7});}else{logger[_0x656e('0x2b')](_0x656e('0x36'));return _0x5a1fc3({'code':0xc8,'message':_0x2a52f7});}}catch(_0x1e9c67){logger[_0x656e('0x30')](_0x1e9c67[_0x656e('0x37')]);return _0x3ab51b(_0x1f839f[_0x656e('0x30')](0x1f4,_0x1e9c67));}}return _0x3ab51b(_0x656e('0x38'));});},'AcceptMessage':function(_0x4fa5b){var _0x3f81fa=this;return new Promise(function(_0x2fa3ca,_0x100995){if(_0x4fa5b['agent']&&_0x4fa5b[_0x656e('0x39')]['id']){if(_0x53699e['agents'][_0x4fa5b[_0x656e('0x39')]['id']]){_0x53699e[_0x656e('0x3a')][_0x4fa5b[_0x656e('0x39')]['id']][_0x656e('0x3b')]=![];_0x53699e[_0x656e('0x3a')][_0x4fa5b[_0x656e('0x39')]['id']][_0x656e('0x3c')]=undefined;}}if(_0x4fa5b[_0x656e('0x18')]&&_0x4fa5b[_0x656e('0x18')]['id']){try{var _0x325f52=getId(_0x4fa5b['channel'],_0x4fa5b[_0x656e('0x18')]?_0x4fa5b[_0x656e('0x18')]['id']:0x0,_0x4fa5b[_0x656e('0x3d')]?_0x4fa5b['interaction']['id']:0x0);if(_0x53699e['rules'][_0x325f52]){_0x53699e[_0x656e('0x16')][_0x325f52][_0x656e('0x34')](_0x656e('0x3e'));if(rpc[_0x4fa5b[_0x656e('0x17')]+'QueueReport']){rpc[_0x4fa5b[_0x656e('0x17')]+_0x656e('0x3f')][_0x656e('0x40')](_0x325f52,{'UserId':_0x4fa5b[_0x656e('0x18')][_0x656e('0x41')]})['catch'](function(_0x713a86){logger[_0x656e('0x30')](_0x656e('0x42'));});}}return _0x2fa3ca({'code':0xc8,'message':_0x4fa5b});}catch(_0x37af2a){logger[_0x656e('0x30')](_0x37af2a[_0x656e('0x37')]);return _0x100995(_0x3f81fa['error'](0x1f4,_0x37af2a));}}logger[_0x656e('0x30')](_0x656e('0x43'));return _0x100995(_0x3f81fa[_0x656e('0x30')](0x1f4,_0x656e('0x43')));});},'RejectMessage':function(_0x5dbcfb){var _0x4ff9b5=this;return new Promise(function(_0xa70770,_0x5199b9){if(_0x5dbcfb['agent']&&_0x5dbcfb['agent']['id']){try{if(_0x53699e[_0x656e('0x3a')][_0x5dbcfb[_0x656e('0x39')]['id']]){_0x53699e['agents'][_0x5dbcfb['agent']['id']]['busy']=![];_0x53699e['agents'][_0x5dbcfb[_0x656e('0x39')]['id']][_0x656e('0x3c')]=undefined;}return _0xa70770({'code':0xc8,'message':_0x5dbcfb});}catch(_0x4a3880){logger[_0x656e('0x30')](_0x4a3880[_0x656e('0x37')]);return _0x5199b9(_0x4ff9b5[_0x656e('0x30')](0x1f4,_0x4a3880));}}logger[_0x656e('0x30')](_0x656e('0x43'));return _0x5199b9(_0x4ff9b5[_0x656e('0x30')](0x1f4,_0x656e('0x43')));});},'AbandonInteraction':function(_0x2525da){var _0x403a2f=this;return new Promise(function(_0xdba7d3,_0x45ca1f){if(_0x2525da['channel']&&_0x2525da['interaction']&&_0x2525da['interaction']['id']){try{var _0x47e622=getId(_0x2525da[_0x656e('0x17')],_0x2525da[_0x656e('0x18')]?_0x2525da[_0x656e('0x18')]['id']:0x0,_0x2525da['interaction']?_0x2525da['interaction']['id']:0x0);if(_0x53699e[_0x656e('0x16')][_0x47e622]){_0x53699e['rules'][_0x47e622][_0x656e('0x34')](_0x656e('0x3e'));}return _0xdba7d3({'code':0xc8,'message':_0x2525da});}catch(_0xadc6a3){logger['error'](_0xadc6a3['stack']);return _0x45ca1f(_0x403a2f[_0x656e('0x30')](0x1f4,_0xadc6a3));}}logger[_0x656e('0x30')](_0x656e('0x43'));return _0x45ca1f(_0x403a2f[_0x656e('0x30')](0x1f4,_0x656e('0x43')));});},'AgentCapacity':function(_0x4669d6){var _0x449408=this;return new Promise(function(_0x3b5a33,_0x2be5eb){if(_0x53699e['agents'][_0x656e('0x44')](_0x4669d6['id'])){for(var _0xf53f07 in _0x4669d6['capacity']){if(_0x4669d6[_0x656e('0x45')]['hasOwnProperty'](_0xf53f07)){if(_0x53699e['agents'][_0x4669d6['id']][_0x656e('0x44')](_0xf53f07+_0x656e('0x46'))){_0x53699e[_0x656e('0x3a')][_0x4669d6['id']][_0xf53f07+'CurrentCapacity']=parseInt(_0x4669d6[_0x656e('0x45')][_0xf53f07],0xa);}}}_0x53699e[_0x656e('0x3a')][_0x4669d6['id']]['updateRealtime']();return _0x3b5a33({'code':0xc8,'message':_0x53699e['agents'][_0x4669d6['id']]});}else{return _0x2be5eb(_0x449408['error'](0x1f4,_0x656e('0x47')));}});},'Agents':function(_0x1a061c){return new Promise(function(_0x57421c,_0x2a5b61){var _0x21af97=_[_0x656e('0x48')](_0x53699e[_0x656e('0x3a')]);_0x57421c({'count':_0x21af97[_0x656e('0x1b')],'rows':_0x21af97});});},'ChatQueues':function(_0x50c9e2){return new Promise(function(_0x2df8a4,_0x37c2f6){var _0x5d49c8=[];for(var _0x56cbd5 in _0x53699e[_0x656e('0x49')]){if(_0x53699e['chatQueues'][_0x656e('0x44')](_0x56cbd5)){var _0x431ee3=_0x53699e[_0x656e('0x49')][_0x56cbd5];var _0x533ff3={'id':_0x431ee3['id'],'available':_0x431ee3[_0x656e('0x4a')],'loggedIn':_0x431ee3[_0x656e('0x4b')],'name':_0x431ee3[_0x656e('0x4c')],'paused':_0x431ee3[_0x656e('0x4d')],'waiting':_0x431ee3[_0x656e('0x4e')]};_0x5d49c8['push'](_0x533ff3);}}_0x2df8a4({'count':_0x5d49c8[_0x656e('0x1b')],'rows':_0x5d49c8});});},'MailQueues':function(_0x1a47b8){return new Promise(function(_0x5164b9,_0x1f1eaf){var _0x3da2e4=[];for(var _0x2c2cdf in _0x53699e[_0x656e('0x4f')]){if(_0x53699e[_0x656e('0x4f')][_0x656e('0x44')](_0x2c2cdf)){var _0x23dd3b=_0x53699e[_0x656e('0x4f')][_0x2c2cdf];var _0x4d4173={'id':_0x23dd3b['id'],'available':_0x23dd3b[_0x656e('0x4a')],'loggedIn':_0x23dd3b[_0x656e('0x4b')],'name':_0x23dd3b['name'],'paused':_0x23dd3b['paused'],'waiting':_0x23dd3b[_0x656e('0x4e')]};_0x3da2e4[_0x656e('0x23')](_0x4d4173);}}_0x5164b9({'count':_0x3da2e4[_0x656e('0x1b')],'rows':_0x3da2e4});});},'OpenchannelQueues':function(_0x791ec0){return new Promise(function(_0x2b0c91,_0x4c93ea){var _0x3ee153=[];for(var _0x486222 in _0x53699e[_0x656e('0x50')]){if(_0x53699e[_0x656e('0x50')][_0x656e('0x44')](_0x486222)){var _0x574c4b=_0x53699e[_0x656e('0x50')][_0x486222];var _0x5487c6={'id':_0x574c4b['id'],'available':_0x574c4b[_0x656e('0x4a')],'loggedIn':_0x574c4b[_0x656e('0x4b')],'name':_0x574c4b[_0x656e('0x4c')],'paused':_0x574c4b[_0x656e('0x4d')],'waiting':_0x574c4b['waiting']};_0x3ee153[_0x656e('0x23')](_0x5487c6);}}_0x2b0c91({'count':_0x3ee153[_0x656e('0x1b')],'rows':_0x3ee153});});},'SmsQueues':function(_0x7d5258){return new Promise(function(_0x525661,_0x4a5ae6){var _0x560cf8=[];for(var _0x5c2db2 in _0x53699e['smsQueues']){if(_0x53699e[_0x656e('0x51')][_0x656e('0x44')](_0x5c2db2)){var _0x107d28=_0x53699e['smsQueues'][_0x5c2db2];var _0x2d97b1={'id':_0x107d28['id'],'available':_0x107d28['available'],'loggedIn':_0x107d28['loggedIn'],'name':_0x107d28[_0x656e('0x4c')],'paused':_0x107d28[_0x656e('0x4d')],'waiting':_0x107d28['waiting']};_0x560cf8[_0x656e('0x23')](_0x2d97b1);}}_0x525661({'count':_0x560cf8[_0x656e('0x1b')],'rows':_0x560cf8});});},'FaxQueues':function(_0x1bc3ca){return new Promise(function(_0x865fee,_0x249aaa){var _0xb95968=[];for(var _0x18c519 in _0x53699e[_0x656e('0x52')]){if(_0x53699e[_0x656e('0x52')][_0x656e('0x44')](_0x18c519)){var _0x321bad=_0x53699e[_0x656e('0x52')][_0x18c519];var _0x3b007d={'id':_0x321bad['id'],'available':_0x321bad[_0x656e('0x4a')],'loggedIn':_0x321bad[_0x656e('0x4b')],'name':_0x321bad[_0x656e('0x4c')],'paused':_0x321bad[_0x656e('0x4d')],'waiting':_0x321bad[_0x656e('0x4e')]};_0xb95968['push'](_0x3b007d);}}_0x865fee({'count':_0xb95968[_0x656e('0x1b')],'rows':_0xb95968});});},'WhatsappQueues':function(_0x18322a){return new Promise(function(_0x2c67fb,_0x5c794b){var _0x16e6ce=[];for(var _0x482d14 in _0x53699e[_0x656e('0x53')]){if(_0x53699e[_0x656e('0x53')]['hasOwnProperty'](_0x482d14)){var _0x2c04ea=_0x53699e['whatsappQueues'][_0x482d14];var _0x503884={'id':_0x2c04ea['id'],'available':_0x2c04ea[_0x656e('0x4a')],'loggedIn':_0x2c04ea['loggedIn'],'name':_0x2c04ea[_0x656e('0x4c')],'paused':_0x2c04ea[_0x656e('0x4d')],'waiting':_0x2c04ea[_0x656e('0x4e')]};_0x16e6ce[_0x656e('0x23')](_0x503884);}}_0x2c67fb({'count':_0x16e6ce[_0x656e('0x1b')],'rows':_0x16e6ce});});},'ChatQueuesWaitingInteractions':function(_0xe8d91a){return new Promise(function(_0x25788b,_0x42f8cf){var _0x510aa0=_[_0x656e('0x48')](_0x53699e[_0x656e('0x54')]);_0x25788b({'count':_0x510aa0[_0x656e('0x1b')],'rows':_0x510aa0});});},'MailQueuesWaitingInteractions':function(_0x302d28){return new Promise(function(_0x2e1da5,_0x322117){var _0x27defb=_[_0x656e('0x48')](_0x53699e[_0x656e('0x55')]);_0x2e1da5({'count':_0x27defb[_0x656e('0x1b')],'rows':_0x27defb});});},'OpenchannelQueuesWaitingInteractions':function(_0x14eff8){return new Promise(function(_0x3373b5,_0x35ae18){var _0x428de0=_[_0x656e('0x48')](_0x53699e[_0x656e('0x56')]);_0x3373b5({'count':_0x428de0['length'],'rows':_0x428de0});});},'SmsQueuesWaitingInteractions':function(_0x2d8cbe){return new Promise(function(_0x1c451f,_0x8ec10c){var _0x4331a6=_['values'](_0x53699e[_0x656e('0x57')]);_0x1c451f({'count':_0x4331a6[_0x656e('0x1b')],'rows':_0x4331a6});});},'FaxQueuesWaitingInteractions':function(_0x2f066f){return new Promise(function(_0x2a69a6,_0x5ca04b){var _0x313f25=_[_0x656e('0x48')](_0x53699e[_0x656e('0x58')]);_0x2a69a6({'count':_0x313f25[_0x656e('0x1b')],'rows':_0x313f25});});},'WhatsappQueuesWaitingInteractions':function(_0x1bff8e){return new Promise(function(_0x10921d,_0x17c9b7){var _0x4058d2=_[_0x656e('0x48')](_0x53699e[_0x656e('0x59')]);_0x10921d({'count':_0x4058d2[_0x656e('0x1b')],'rows':_0x4058d2});});}};var _0xbd6e0a=jayson[_0x656e('0x5a')](_0x7e4d57)['http']();_0xbd6e0a['on']('error',function(_0xe9865f){logger[_0x656e('0x30')](JSON[_0x656e('0x33')](_0xe9865f));return _0x2ce681(_0xe9865f);});_0xbd6e0a['listen'](0x232c,_0x656e('0x5b'),function(){console[_0x656e('0x5c')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x5059d9('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 77f40f8..0fe2d80 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 _0x0bcf=['all','then','some','\x20|\x20','when','join','stack','util','bluebird','jayson/promise','../../../config/logger','http','error','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','iftime\x20%s','message','indexOf','true','catch','[%s][INTERVAL]\x20%s'];(function(_0xbe46e9,_0x1951d3){var _0x10020c=function(_0x2f8982){while(--_0x2f8982){_0xbe46e9['push'](_0xbe46e9['shift']());}};_0x10020c(++_0x1951d3);}(_0x0bcf,0xa3));var _0xf0bc=function(_0xca162,_0x199a96){_0xca162=_0xca162-0x0;var _0x2e3fa1=_0x0bcf[_0xca162];return _0x2e3fa1;};'use strict';var util=require(_0xf0bc('0x0'));var BPromise=require(_0xf0bc('0x1'));var jayson=require(_0xf0bc('0x2'));var _=require('lodash');var logger=require(_0xf0bc('0x3'))('routing');var client=jayson['client'][_0xf0bc('0x4')]({'port':0x232a});function request(_0xd58c,_0x2df9e2){return new BPromise(function(_0x30b488,_0x25917d){return client['request'](_0xd58c,_0x2df9e2)['then'](function(_0x4100a6){if(_0x4100a6['error']){return _0x25917d(_0x4100a6[_0xf0bc('0x5')]['message']);}else{return _0x30b488(_0x4100a6[_0xf0bc('0x6')]);}})['catch'](function(_0x318fc8){return _0x25917d(_0x318fc8);});});}exports['condition']=function(_0x12ed76,_0x4a3e8e,_0x37bf07){return function(_0x1a6148){if(_0x37bf07[_0xf0bc('0x7')]&&!_0x37bf07['rules'][_0x12ed76]){logger[_0xf0bc('0x8')](_0xf0bc('0x9'),_0x12ed76);return _0x1a6148[_0xf0bc('0xa')]();}var _0xc07a5=[];for(var _0x32806e=0x0;_0x32806e<_0x4a3e8e[_0xf0bc('0xb')];_0x32806e+=0x1){_0xc07a5['push'](request(_0xf0bc('0xc'),{'command':util['format'](_0xf0bc('0xd'),_0x4a3e8e[_0x32806e])})['then'](function(_0x27b3ed){return _0x27b3ed&&_0x27b3ed[_0xf0bc('0xe')]&&_0x27b3ed[_0xf0bc('0xe')][_0xf0bc('0xf')](_0xf0bc('0x10'))>=0x0?!![]:![];})[_0xf0bc('0x11')](function(_0x1e35b7){logger[_0xf0bc('0x5')](_0xf0bc('0x12'),_0x12ed76,_0x4a3e8e[_0x32806e]);}));}BPromise[_0xf0bc('0x13')](_0xc07a5)[_0xf0bc('0x14')](function(_0x2477ae){var _0x2216cb=_[_0xf0bc('0x15')](_0x2477ae);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x12ed76,_0x4a3e8e['join'](_0xf0bc('0x16')),_0x2216cb);_0x1a6148[_0xf0bc('0x17')](_0x2216cb);})['catch'](function(_0x25a1a3){console['log'](_0x25a1a3);logger[_0xf0bc('0x5')]('[%s][INTERVAL]\x20%s\x20%s',_0x12ed76,_0x4a3e8e[_0xf0bc('0x18')](_0xf0bc('0x16')),_0x25a1a3[_0xf0bc('0x19')]);_0x1a6148[_0xf0bc('0xa')]();});};}; \ No newline at end of file +var _0xcbac=['error','message','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','Command','format','then','indexOf','catch','[%s][INTERVAL]\x20%s','all','info','when','log','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stack','stop','util','lodash','../../../config/logger','client','request'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xcbac,0x1b5));var _0xccba=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xcbac[_0x487b0c];return _0x1adbdc;};'use strict';var util=require(_0xccba('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xccba('0x1'));var logger=require(_0xccba('0x2'))('routing');var client=jayson[_0xccba('0x3')]['http']({'port':0x232a});function request(_0x8cdd48,_0x561d30){return new BPromise(function(_0x516140,_0x526e86){return client[_0xccba('0x4')](_0x8cdd48,_0x561d30)['then'](function(_0x145a8e){if(_0x145a8e[_0xccba('0x5')]){return _0x526e86(_0x145a8e['error'][_0xccba('0x6')]);}else{return _0x516140(_0x145a8e[_0xccba('0x7')]);}})['catch'](function(_0x5410cf){return _0x526e86(_0x5410cf);});});}exports[_0xccba('0x8')]=function(_0x2f4b42,_0x4a8270,_0x3ab84d){return function(_0x5c0fea){if(_0x3ab84d[_0xccba('0x9')]&&!_0x3ab84d[_0xccba('0x9')][_0x2f4b42]){logger['info'](_0xccba('0xa'),_0x2f4b42);return _0x5c0fea['stop']();}var _0xc65874=[];for(var _0x5c154a=0x0;_0x5c154a<_0x4a8270[_0xccba('0xb')];_0x5c154a+=0x1){_0xc65874['push'](request(_0xccba('0xc'),{'command':util[_0xccba('0xd')]('iftime\x20%s',_0x4a8270[_0x5c154a])})[_0xccba('0xe')](function(_0x5d73dc){return _0x5d73dc&&_0x5d73dc[_0xccba('0x6')]&&_0x5d73dc['message'][_0xccba('0xf')]('true')>=0x0?!![]:![];})[_0xccba('0x10')](function(_0x160768){logger['error'](_0xccba('0x11'),_0x2f4b42,_0x4a8270[_0x5c154a]);}));}BPromise[_0xccba('0x12')](_0xc65874)[_0xccba('0xe')](function(_0x1d5af7){var _0x348789=_['some'](_0x1d5af7);logger[_0xccba('0x13')]('[%s][INTERVAL]\x20%s\x20%s',_0x2f4b42,_0x4a8270['join']('\x20|\x20'),_0x348789);_0x5c0fea[_0xccba('0x14')](_0x348789);})[_0xccba('0x10')](function(_0x509b9a){console[_0xccba('0x15')](_0x509b9a);logger['error'](_0xccba('0x16'),_0x2f4b42,_0x4a8270['join'](_0xccba('0x17')),_0x509b9a[_0xccba('0x18')]);_0x5c0fea[_0xccba('0x19')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 5b00538..00efc4c 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 _0x7e08=['transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','transfereeuniqueid','clone','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','[%s][agents][hangup]','lodash','util','info','format','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','[%s][agents][agentcalled]','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','error','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s'];(function(_0x242e0e,_0x556a24){var _0x568475=function(_0x437160){while(--_0x437160){_0x242e0e['push'](_0x242e0e['shift']());}};_0x568475(++_0x556a24);}(_0x7e08,0xc4));var _0x87e0=function(_0x3c08bf,_0x551e77){_0x3c08bf=_0x3c08bf-0x0;var _0x21c439=_0x7e08[_0x3c08bf];return _0x21c439;};'use strict';var _=require(_0x87e0('0x0'));var util=require(_0x87e0('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x36ec5a,_0x150b6b){utils[_0x87e0('0x2')](util[_0x87e0('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x36ec5a['uniqueid'],_0x36ec5a[_0x87e0('0x4')],_0x36ec5a[_0x87e0('0x5')],_0x36ec5a[_0x87e0('0x6')],_0x36ec5a[_0x87e0('0x7')],_0x36ec5a[_0x87e0('0x8')],_0x36ec5a[_0x87e0('0x9')],_0x36ec5a[_0x87e0('0xa')]));if(_0x36ec5a[_0x87e0('0x5')]){utils['getVoiceQueueByName'](_0x36ec5a[_0x87e0('0x5')])['then'](function(_0x36bc22){if(_0x36bc22){_0x36ec5a[_0x87e0('0xb')]=_0x36bc22[_0x87e0('0xb')];_0x36ec5a[_0x87e0('0xc')]=_0x36ec5a[_0x87e0('0xd')]?_0x36bc22[_0x87e0('0xe')]:![];_0x36ec5a[_0x87e0('0xf')]=_0x36ec5a[_0x87e0('0xc')]?_0x36bc22[_0x87e0('0x10')]:0x0;}utils[_0x87e0('0x11')](_0x87e0('0x12'),_0x36ec5a);});}else{utils['request'](_0x87e0('0x12'),_0x36ec5a);}if(_0x150b6b){delete transfers[_0x36ec5a[_0x87e0('0x13')]];}else{delete agents[_0x36ec5a[_0x87e0('0x14')]];}}exports[_0x87e0('0x15')]=function(_0x2051e4){try{utils['debug'](util['format'](_0x87e0('0x16'),_0x2051e4['uniqueid']),_0x2051e4);agents[_0x2051e4[_0x87e0('0x14')]]=_0x2051e4;agents[_0x2051e4[_0x87e0('0x14')]]['agentcalledAt']=utils[_0x87e0('0x17')]();agents[_0x2051e4[_0x87e0('0x14')]]['lastevent']=_0x87e0('0x18');agents[_0x2051e4[_0x87e0('0x14')]][_0x87e0('0x9')]=null;agents[_0x2051e4['destuniqueid']][_0x87e0('0x19')]=null;utils[_0x87e0('0x2')](util[_0x87e0('0x3')](_0x87e0('0x1a'),_0x2051e4[_0x87e0('0x13')],agents[_0x2051e4['destuniqueid']][_0x87e0('0x6')],_0x2051e4[_0x87e0('0x14')]));}catch(_0x63e322){utils['error'](util[_0x87e0('0x3')]('[%s][agents][agentcalled]',_0x2051e4[_0x87e0('0x13')]),_0x63e322);}};exports['agentringnoanswer']=function(_0x144af3){try{if(!_[_0x87e0('0x1b')](agents[_0x144af3[_0x87e0('0x14')]])){utils[_0x87e0('0x1c')](util[_0x87e0('0x3')](_0x87e0('0x1d'),_0x144af3[_0x87e0('0x13')]),_0x144af3);utils[_0x87e0('0x2')](util[_0x87e0('0x3')](_0x87e0('0x1e'),_0x144af3[_0x87e0('0x13')],agents[_0x144af3[_0x87e0('0x14')]]['membername'],_0x144af3[_0x87e0('0x14')]));agents[_0x144af3[_0x87e0('0x14')]][_0x87e0('0x1f')]=!![];agents[_0x144af3[_0x87e0('0x14')]][_0x87e0('0x20')]=utils[_0x87e0('0x17')]();agents[_0x144af3[_0x87e0('0x14')]][_0x87e0('0xa')]=_0x87e0('0x21');agents[_0x144af3['destuniqueid']][_0x87e0('0x22')]=_0x87e0('0x21');agents[_0x144af3[_0x87e0('0x14')]][_0x87e0('0x23')]=_0x144af3['ringtime']?parseInt(_0x144af3[_0x87e0('0x24')])/0x3e8:0x0;agents[_0x144af3[_0x87e0('0x14')]]['talktime']=0x0;unanswered[_0x87e0('0x25')](_0x144af3[_0x87e0('0x14')]);}}catch(_0x264e5e){utils[_0x87e0('0x26')](util[_0x87e0('0x3')](_0x87e0('0x1d'),_0x144af3['uniqueid']),_0x264e5e);}};exports['queuecallerabandon']=function(_0x9ec47e){try{_[_0x87e0('0x27')](agents,function(_0x2811f6,_0x497d9c){if(_0x2811f6[_0x87e0('0x13')]==_0x9ec47e['uniqueid']&&!_['includes'](unanswered,_0x2811f6['destuniqueid'])){utils[_0x87e0('0x1c')](util[_0x87e0('0x3')](_0x87e0('0x28'),_0x9ec47e[_0x87e0('0x13')]),_0x9ec47e);utils[_0x87e0('0x2')](util[_0x87e0('0x3')](_0x87e0('0x29'),_0x9ec47e['uniqueid'],_0x2811f6[_0x87e0('0x6')],_0x2811f6[_0x87e0('0x14')]));_0x2811f6[_0x87e0('0x1f')]=!![];_0x2811f6[_0x87e0('0x20')]=utils[_0x87e0('0x17')]();_0x2811f6['lastevent']='abandoned';_0x2811f6['reason']=_0x87e0('0x2a');_0x2811f6[_0x87e0('0x23')]=_0x9ec47e[_0x87e0('0x23')];_0x2811f6[_0x87e0('0x2b')]=0x0;writeDB(_0x2811f6);}});}catch(_0x497401){utils[_0x87e0('0x26')](util[_0x87e0('0x3')](_0x87e0('0x28'),_0x9ec47e[_0x87e0('0x13')]),_0x497401);}};exports['agentconnect']=function(_0x38d36c){try{if(agents[_0x38d36c[_0x87e0('0x14')]]){utils['debug'](util[_0x87e0('0x3')](_0x87e0('0x2c'),_0x38d36c[_0x87e0('0x13')]),_0x38d36c);utils['info'](util[_0x87e0('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x38d36c['uniqueid'],agents[_0x38d36c[_0x87e0('0x14')]][_0x87e0('0x6')],_0x38d36c[_0x87e0('0x14')]));agents[_0x38d36c[_0x87e0('0x14')]][_0x87e0('0x2d')]=utils[_0x87e0('0x17')]();agents[_0x38d36c[_0x87e0('0x14')]][_0x87e0('0x9')]=_0x38d36c[_0x87e0('0x9')];agents[_0x38d36c[_0x87e0('0x14')]][_0x87e0('0x19')]=_0x38d36c[_0x87e0('0x19')];agents[_0x38d36c['destuniqueid']][_0x87e0('0x23')]=_0x38d36c[_0x87e0('0x24')];agents[_0x38d36c[_0x87e0('0x14')]][_0x87e0('0xa')]=_0x87e0('0x2e');_['forIn'](agents,function(_0x118053,_0x4bddc1){if(_0x118053[_0x87e0('0x14')]!=_0x38d36c['destuniqueid']&&_0x118053['uniqueid']==_0x38d36c['uniqueid']){_0x118053[_0x87e0('0x2b')]=0x0;_0x118053[_0x87e0('0x23')]=_0x38d36c[_0x87e0('0x24')];_0x118053[_0x87e0('0x1f')]=!![];_0x118053[_0x87e0('0x20')]=utils[_0x87e0('0x17')]();_0x118053[_0x87e0('0xa')]=_0x87e0('0x2f');_0x118053[_0x87e0('0x22')]=_0x87e0('0x2f');_0x118053[_0x87e0('0x30')]=_0x38d36c[_0x87e0('0x14')];_0x118053[_0x87e0('0x31')]=_0x38d36c[_0x87e0('0x6')];writeDB(_0x118053);}});}}catch(_0x44b299){utils[_0x87e0('0x26')](util[_0x87e0('0x3')](_0x87e0('0x2c'),_0x38d36c['uniqueid']),_0x44b299);}};exports['agentcomplete']=function(_0x4a6c1d){try{if(!_[_0x87e0('0x1b')](agents[_0x4a6c1d[_0x87e0('0x14')]])){utils['debug'](util[_0x87e0('0x3')](_0x87e0('0x32'),_0x4a6c1d[_0x87e0('0x13')]),_0x4a6c1d);utils[_0x87e0('0x2')](util[_0x87e0('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4a6c1d[_0x87e0('0x13')],agents[_0x4a6c1d[_0x87e0('0x14')]][_0x87e0('0x6')],_0x4a6c1d[_0x87e0('0x14')]));agents[_0x4a6c1d[_0x87e0('0x14')]][_0x87e0('0xd')]=!![];agents[_0x4a6c1d[_0x87e0('0x14')]]['agentcompleteAt']=utils[_0x87e0('0x17')]();agents[_0x4a6c1d[_0x87e0('0x14')]]['talktime']=utils['diffTime'](agents[_0x4a6c1d[_0x87e0('0x14')]][_0x87e0('0x33')],agents[_0x4a6c1d[_0x87e0('0x14')]]['agentconnectAt']);agents[_0x4a6c1d[_0x87e0('0x14')]]['reason']=_0x4a6c1d[_0x87e0('0x22')];agents[_0x4a6c1d[_0x87e0('0x14')]]['lastevent']=_0x87e0('0x34');writeDB(agents[_0x4a6c1d[_0x87e0('0x14')]]);}}catch(_0x1a765e){utils[_0x87e0('0x26')](util['format'](_0x87e0('0x32'),_0x4a6c1d[_0x87e0('0x13')]),_0x1a765e);}};exports[_0x87e0('0x35')]=function(_0x57f956){try{if(!_[_0x87e0('0x1b')](agents[_0x57f956['transfereruniqueid']])){utils['debug'](util[_0x87e0('0x3')](_0x87e0('0x36'),_0x57f956['uniqueid']),_0x57f956);utils[_0x87e0('0x2')](util[_0x87e0('0x3')](_0x87e0('0x37'),_0x57f956['uniqueid'],agents[_0x57f956['transfereruniqueid']][_0x87e0('0x6')],agents[_0x57f956[_0x87e0('0x38')]]['uniqueid']));agents[_0x57f956[_0x87e0('0x38')]][_0x87e0('0x39')]=!![];agents[_0x57f956[_0x87e0('0x38')]][_0x87e0('0x3a')]=_0x87e0('0x3b');agents[_0x57f956[_0x87e0('0x38')]]['transferexten']=_0x57f956[_0x87e0('0x3c')];agents[_0x57f956[_0x87e0('0x38')]][_0x87e0('0x3d')]=agents[_0x57f956['transfereruniqueid']]['uniqueid'];}}catch(_0xd4ec80){utils[_0x87e0('0x26')](util[_0x87e0('0x3')](_0x87e0('0x36'),_0x57f956[_0x87e0('0x13')]),_0xd4ec80);}};exports['attendedtransfer']=function(_0x42cd08){try{utils[_0x87e0('0x1c')](util['format'](_0x87e0('0x3e'),_0x42cd08[_0x87e0('0x3f')]),_0x42cd08);if(_0x42cd08[_0x87e0('0x3f')]==_0x42cd08[_0x87e0('0x40')]){if(!_['isNil'](agents[_0x42cd08[_0x87e0('0x41')]])){utils[_0x87e0('0x2')](util[_0x87e0('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x42cd08[_0x87e0('0x3f')],agents[_0x42cd08[_0x87e0('0x41')]][_0x87e0('0x6')]));agents[_0x42cd08[_0x87e0('0x41')]][_0x87e0('0x39')]=!![];agents[_0x42cd08[_0x87e0('0x41')]][_0x87e0('0x3a')]=_0x87e0('0x42');agents[_0x42cd08[_0x87e0('0x41')]][_0x87e0('0x43')]=_0x42cd08['origtransfererexten'];agents[_0x42cd08[_0x87e0('0x41')]][_0x87e0('0x3d')]=_0x42cd08[_0x87e0('0x3f')];}if(_0x42cd08['transfereeuniqueid']&&agents[_0x42cd08['transfereeuniqueid']]){agents[_0x42cd08[_0x87e0('0x44')]]['agententerreason']=0x1;transfers[_0x42cd08[_0x87e0('0x44')]]=_[_0x87e0('0x45')](agents[_0x42cd08[_0x87e0('0x44')]]);transfers[_0x42cd08['transfereeuniqueid']]['calleridnum']=agents[_0x42cd08['secondtransfereruniqueid']][_0x87e0('0x8')];transfers[_0x42cd08['transfereeuniqueid']][_0x87e0('0x46')]=agents[_0x42cd08[_0x87e0('0x41')]][_0x87e0('0x46')];transfers[_0x42cd08[_0x87e0('0x44')]][_0x87e0('0x47')]=utils['now']();transfers[_0x42cd08['transfereeuniqueid']][_0x87e0('0x2d')]=utils[_0x87e0('0x17')]();transfers[_0x42cd08[_0x87e0('0x44')]][_0x87e0('0x23')]=0x0;transfers[_0x42cd08[_0x87e0('0x44')]][_0x87e0('0x48')]=0x2;}}else if(_0x42cd08[_0x87e0('0x41')]==_0x42cd08[_0x87e0('0x49')]){if(!_['isNil'](agents[_0x42cd08[_0x87e0('0x3f')]])){utils['info'](util[_0x87e0('0x3')](_0x87e0('0x4a'),_0x42cd08[_0x87e0('0x3f')],agents[_0x42cd08[_0x87e0('0x3f')]][_0x87e0('0x6')]));agents[_0x42cd08['origtransfereruniqueid']][_0x87e0('0x39')]=!![];agents[_0x42cd08[_0x87e0('0x3f')]][_0x87e0('0x3a')]='ATTENDED';agents[_0x42cd08[_0x87e0('0x3f')]]['transferexten']=_0x42cd08[_0x87e0('0x4b')];agents[_0x42cd08[_0x87e0('0x3f')]]['transferuniqueid']=_0x42cd08[_0x87e0('0x41')];}if(_0x42cd08[_0x87e0('0x4c')]&&agents[_0x42cd08[_0x87e0('0x4c')]]){agents[_0x42cd08[_0x87e0('0x4c')]]['agententerreason']=0x1;transfers[_0x42cd08['transfertargetuniqueid']]=_['clone'](agents[_0x42cd08[_0x87e0('0x4c')]]);transfers[_0x42cd08[_0x87e0('0x4c')]][_0x87e0('0x8')]=agents[_0x42cd08[_0x87e0('0x3f')]][_0x87e0('0x8')];transfers[_0x42cd08[_0x87e0('0x4c')]][_0x87e0('0x46')]=agents[_0x42cd08['origtransfereruniqueid']][_0x87e0('0x46')];transfers[_0x42cd08[_0x87e0('0x4c')]][_0x87e0('0x47')]=utils[_0x87e0('0x17')]();transfers[_0x42cd08[_0x87e0('0x4c')]][_0x87e0('0x2d')]=utils['now']();transfers[_0x42cd08[_0x87e0('0x4c')]][_0x87e0('0x23')]=0x0;transfers[_0x42cd08[_0x87e0('0x4c')]][_0x87e0('0x48')]=0x2;}}}catch(_0x52d4e0){utils[_0x87e0('0x26')](util[_0x87e0('0x3')](_0x87e0('0x3e'),_0x42cd08[_0x87e0('0x3f')]),_0x52d4e0);}};exports['hangup']=function(_0x5301f7){try{utils[_0x87e0('0x1c')](util[_0x87e0('0x3')]('[%s][agents][hangup]',_0x5301f7['uniqueid']),_0x5301f7);if(agents[_0x5301f7[_0x87e0('0x13')]]&&agents[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x22')]===_0x87e0('0x21')){if(_0x5301f7[_0x87e0('0x4d')]==='21'){agents[_0x5301f7['uniqueid']][_0x87e0('0x22')]=_0x87e0('0x4e');agents[_0x5301f7['uniqueid']][_0x87e0('0xa')]=_0x87e0('0x4e');}utils[_0x87e0('0x2')](util[_0x87e0('0x3')](_0x87e0('0x4f'),_0x5301f7['uniqueid'],agents[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x6')],agents[_0x5301f7[_0x87e0('0x13')]]['reason'],agents[_0x5301f7[_0x87e0('0x13')]]['lastevent']));writeDB(agents[_0x5301f7[_0x87e0('0x13')]]);var _0x17a553=unanswered[_0x87e0('0x50')](_0x5301f7[_0x87e0('0x13')]);if(_0x17a553>-0x1){unanswered[_0x87e0('0x51')](_0x17a553,0x1);}}if(transfers[_0x5301f7[_0x87e0('0x13')]]){transfers[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0xd')]=!![];transfers[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x33')]=utils[_0x87e0('0x17')]();transfers[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x2b')]=utils[_0x87e0('0x52')](transfers[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x33')],transfers[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x2d')]);transfers[_0x5301f7['uniqueid']]['reason']='agent';transfers[_0x5301f7[_0x87e0('0x13')]]['lastevent']='complete';utils[_0x87e0('0x2')](util[_0x87e0('0x3')](_0x87e0('0x4f'),_0x5301f7[_0x87e0('0x13')],transfers[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x6')],transfers[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x22')],transfers[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0xa')]));writeDB(transfers[_0x5301f7[_0x87e0('0x13')]],!![]);}if(agents[_0x5301f7[_0x87e0('0x13')]]&&agents[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x2d')]){agents[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0xd')]=!![];agents[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x33')]=utils[_0x87e0('0x17')]();agents[_0x5301f7[_0x87e0('0x13')]]['talktime']=utils[_0x87e0('0x52')](agents[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x33')],agents[_0x5301f7['uniqueid']]['agentconnectAt']);agents[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x22')]=agents[_0x5301f7[_0x87e0('0x13')]]['transfer']?_0x87e0('0x39'):'agent';agents[_0x5301f7['uniqueid']]['lastevent']=_0x87e0('0x34');utils['info'](util[_0x87e0('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5301f7[_0x87e0('0x13')],agents[_0x5301f7['uniqueid']][_0x87e0('0x6')],agents[_0x5301f7[_0x87e0('0x13')]][_0x87e0('0x22')],agents[_0x5301f7['uniqueid']]['lastevent']));writeDB(agents[_0x5301f7[_0x87e0('0x13')]]);}}catch(_0x4036b8){utils[_0x87e0('0x26')](util['format'](_0x87e0('0x53'),_0x5301f7['uniqueid']),_0x4036b8);}}; \ No newline at end of file +var _0x0fc6=['calleridname','secondtransfererlinkedid','transfer','transfertargetuniqueid','clone','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','indexOf','diffTime','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','info','format','uniqueid','channel','queue','membername','interface','lastevent','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinenum','connectedlinename','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','reason','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentconnect]','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0x0fc6,0x161));var _0x60fc=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0fc6[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x60fc('0x0'));var util=require(_0x60fc('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x4cb571,_0x516c76){utils[_0x60fc('0x2')](util[_0x60fc('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x4cb571[_0x60fc('0x4')],_0x4cb571[_0x60fc('0x5')],_0x4cb571[_0x60fc('0x6')],_0x4cb571[_0x60fc('0x7')],_0x4cb571[_0x60fc('0x8')],_0x4cb571['calleridnum'],_0x4cb571['connectedlinenum'],_0x4cb571[_0x60fc('0x9')]));if(_0x4cb571['queue']){utils[_0x60fc('0xa')](_0x4cb571[_0x60fc('0x6')])[_0x60fc('0xb')](function(_0x13be27){if(_0x13be27){_0x4cb571[_0x60fc('0xc')]=_0x13be27[_0x60fc('0xc')];_0x4cb571[_0x60fc('0xd')]=_0x4cb571['agentcomplete']?_0x13be27[_0x60fc('0xe')]:![];_0x4cb571[_0x60fc('0xf')]=_0x4cb571[_0x60fc('0xd')]?_0x13be27[_0x60fc('0x10')]:0x0;}utils[_0x60fc('0x11')](_0x60fc('0x12'),_0x4cb571);});}else{utils[_0x60fc('0x11')](_0x60fc('0x12'),_0x4cb571);}if(_0x516c76){delete transfers[_0x4cb571[_0x60fc('0x4')]];}else{delete agents[_0x4cb571['destuniqueid']];}}exports[_0x60fc('0x13')]=function(_0x588943){try{utils[_0x60fc('0x14')](util[_0x60fc('0x3')](_0x60fc('0x15'),_0x588943[_0x60fc('0x4')]),_0x588943);agents[_0x588943[_0x60fc('0x16')]]=_0x588943;agents[_0x588943[_0x60fc('0x16')]][_0x60fc('0x17')]=utils[_0x60fc('0x18')]();agents[_0x588943[_0x60fc('0x16')]]['lastevent']=_0x60fc('0x19');agents[_0x588943[_0x60fc('0x16')]][_0x60fc('0x1a')]=null;agents[_0x588943[_0x60fc('0x16')]][_0x60fc('0x1b')]=null;utils[_0x60fc('0x2')](util[_0x60fc('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x588943[_0x60fc('0x4')],agents[_0x588943['destuniqueid']][_0x60fc('0x7')],_0x588943[_0x60fc('0x16')]));}catch(_0x2ea193){utils[_0x60fc('0x1c')](util[_0x60fc('0x3')](_0x60fc('0x15'),_0x588943[_0x60fc('0x4')]),_0x2ea193);}};exports[_0x60fc('0x1d')]=function(_0x3e144f){try{if(!_[_0x60fc('0x1e')](agents[_0x3e144f['destuniqueid']])){utils[_0x60fc('0x14')](util[_0x60fc('0x3')](_0x60fc('0x1f'),_0x3e144f[_0x60fc('0x4')]),_0x3e144f);utils[_0x60fc('0x2')](util['format'](_0x60fc('0x20'),_0x3e144f['uniqueid'],agents[_0x3e144f[_0x60fc('0x16')]][_0x60fc('0x7')],_0x3e144f[_0x60fc('0x16')]));agents[_0x3e144f[_0x60fc('0x16')]][_0x60fc('0x1d')]=!![];agents[_0x3e144f[_0x60fc('0x16')]][_0x60fc('0x21')]=utils[_0x60fc('0x18')]();agents[_0x3e144f[_0x60fc('0x16')]][_0x60fc('0x9')]=_0x60fc('0x22');agents[_0x3e144f[_0x60fc('0x16')]]['reason']=_0x60fc('0x22');agents[_0x3e144f[_0x60fc('0x16')]][_0x60fc('0x23')]=_0x3e144f[_0x60fc('0x24')]?parseInt(_0x3e144f['ringtime'])/0x3e8:0x0;agents[_0x3e144f[_0x60fc('0x16')]][_0x60fc('0x25')]=0x0;unanswered[_0x60fc('0x26')](_0x3e144f[_0x60fc('0x16')]);}}catch(_0x10f184){utils[_0x60fc('0x1c')](util[_0x60fc('0x3')](_0x60fc('0x1f'),_0x3e144f['uniqueid']),_0x10f184);}};exports[_0x60fc('0x27')]=function(_0x308079){try{_[_0x60fc('0x28')](agents,function(_0x24a3f7,_0x36ffa2){if(_0x24a3f7[_0x60fc('0x4')]==_0x308079[_0x60fc('0x4')]&&!_[_0x60fc('0x29')](unanswered,_0x24a3f7[_0x60fc('0x16')])){utils[_0x60fc('0x14')](util['format'](_0x60fc('0x2a'),_0x308079[_0x60fc('0x4')]),_0x308079);utils['info'](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x308079['uniqueid'],_0x24a3f7[_0x60fc('0x7')],_0x24a3f7[_0x60fc('0x16')]));_0x24a3f7[_0x60fc('0x1d')]=!![];_0x24a3f7[_0x60fc('0x21')]=utils[_0x60fc('0x18')]();_0x24a3f7['lastevent']=_0x60fc('0x2b');_0x24a3f7[_0x60fc('0x2c')]=_0x60fc('0x2b');_0x24a3f7['holdtime']=_0x308079[_0x60fc('0x23')];_0x24a3f7[_0x60fc('0x25')]=0x0;writeDB(_0x24a3f7);}});}catch(_0x25b37d){utils[_0x60fc('0x1c')](util[_0x60fc('0x3')]('[%s][agents][queuecallerabandon]',_0x308079[_0x60fc('0x4')]),_0x25b37d);}};exports[_0x60fc('0x2d')]=function(_0x19436f){try{if(agents[_0x19436f['destuniqueid']]){utils[_0x60fc('0x14')](util[_0x60fc('0x3')]('[%s][agents][agentconnect]',_0x19436f[_0x60fc('0x4')]),_0x19436f);utils[_0x60fc('0x2')](util[_0x60fc('0x3')](_0x60fc('0x2e'),_0x19436f[_0x60fc('0x4')],agents[_0x19436f[_0x60fc('0x16')]][_0x60fc('0x7')],_0x19436f[_0x60fc('0x16')]));agents[_0x19436f[_0x60fc('0x16')]][_0x60fc('0x2f')]=utils['now']();agents[_0x19436f[_0x60fc('0x16')]][_0x60fc('0x1a')]=_0x19436f[_0x60fc('0x1a')];agents[_0x19436f[_0x60fc('0x16')]][_0x60fc('0x1b')]=_0x19436f[_0x60fc('0x1b')];agents[_0x19436f['destuniqueid']][_0x60fc('0x23')]=_0x19436f['ringtime'];agents[_0x19436f[_0x60fc('0x16')]][_0x60fc('0x9')]=_0x60fc('0x30');_[_0x60fc('0x28')](agents,function(_0x103dba,_0x30927d){if(_0x103dba[_0x60fc('0x16')]!=_0x19436f['destuniqueid']&&_0x103dba[_0x60fc('0x4')]==_0x19436f['uniqueid']){_0x103dba[_0x60fc('0x25')]=0x0;_0x103dba['holdtime']=_0x19436f['ringtime'];_0x103dba[_0x60fc('0x1d')]=!![];_0x103dba[_0x60fc('0x21')]=utils['now']();_0x103dba['lastevent']=_0x60fc('0x31');_0x103dba['reason']=_0x60fc('0x31');_0x103dba['answeredelsewheredestinationuniqueid']=_0x19436f[_0x60fc('0x16')];_0x103dba[_0x60fc('0x32')]=_0x19436f['membername'];writeDB(_0x103dba);}});}}catch(_0x46e4e4){utils[_0x60fc('0x1c')](util[_0x60fc('0x3')](_0x60fc('0x33'),_0x19436f[_0x60fc('0x4')]),_0x46e4e4);}};exports[_0x60fc('0x34')]=function(_0x430365){try{if(!_[_0x60fc('0x1e')](agents[_0x430365['destuniqueid']])){utils['debug'](util[_0x60fc('0x3')](_0x60fc('0x35'),_0x430365[_0x60fc('0x4')]),_0x430365);utils[_0x60fc('0x2')](util[_0x60fc('0x3')](_0x60fc('0x36'),_0x430365['uniqueid'],agents[_0x430365[_0x60fc('0x16')]][_0x60fc('0x7')],_0x430365[_0x60fc('0x16')]));agents[_0x430365[_0x60fc('0x16')]][_0x60fc('0x34')]=!![];agents[_0x430365[_0x60fc('0x16')]][_0x60fc('0x37')]=utils[_0x60fc('0x18')]();agents[_0x430365[_0x60fc('0x16')]]['talktime']=utils['diffTime'](agents[_0x430365[_0x60fc('0x16')]][_0x60fc('0x37')],agents[_0x430365[_0x60fc('0x16')]]['agentconnectAt']);agents[_0x430365['destuniqueid']][_0x60fc('0x2c')]=_0x430365[_0x60fc('0x2c')];agents[_0x430365[_0x60fc('0x16')]][_0x60fc('0x9')]=_0x60fc('0x38');writeDB(agents[_0x430365[_0x60fc('0x16')]]);}}catch(_0x3a4bc4){utils[_0x60fc('0x1c')](util[_0x60fc('0x3')](_0x60fc('0x35'),_0x430365[_0x60fc('0x4')]),_0x3a4bc4);}};exports[_0x60fc('0x39')]=function(_0x481b27){try{if(!_[_0x60fc('0x1e')](agents[_0x481b27[_0x60fc('0x3a')]])){utils['debug'](util[_0x60fc('0x3')]('[%s][agents][blindtransfer]',_0x481b27[_0x60fc('0x4')]),_0x481b27);utils[_0x60fc('0x2')](util['format'](_0x60fc('0x3b'),_0x481b27['uniqueid'],agents[_0x481b27[_0x60fc('0x3a')]][_0x60fc('0x7')],agents[_0x481b27[_0x60fc('0x3a')]][_0x60fc('0x4')]));agents[_0x481b27[_0x60fc('0x3a')]]['transfer']=!![];agents[_0x481b27[_0x60fc('0x3a')]][_0x60fc('0x3c')]=_0x60fc('0x3d');agents[_0x481b27['transfereruniqueid']][_0x60fc('0x3e')]=_0x481b27['extension'];agents[_0x481b27[_0x60fc('0x3a')]][_0x60fc('0x3f')]=agents[_0x481b27['transfereruniqueid']][_0x60fc('0x4')];}}catch(_0x263d9a){utils[_0x60fc('0x1c')](util['format']('[%s][agents][blindtransfer]',_0x481b27[_0x60fc('0x4')]),_0x263d9a);}};exports['attendedtransfer']=function(_0x474023){try{utils['debug'](util[_0x60fc('0x3')]('[%s][agents][attendedtransfer]',_0x474023[_0x60fc('0x40')]),_0x474023);if(_0x474023[_0x60fc('0x40')]==_0x474023[_0x60fc('0x41')]){if(!_[_0x60fc('0x1e')](agents[_0x474023[_0x60fc('0x42')]])){utils[_0x60fc('0x2')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x474023[_0x60fc('0x40')],agents[_0x474023[_0x60fc('0x42')]]['membername']));agents[_0x474023[_0x60fc('0x42')]]['transfer']=!![];agents[_0x474023[_0x60fc('0x42')]][_0x60fc('0x3c')]=_0x60fc('0x43');agents[_0x474023['secondtransfereruniqueid']][_0x60fc('0x3e')]=_0x474023[_0x60fc('0x44')];agents[_0x474023[_0x60fc('0x42')]][_0x60fc('0x3f')]=_0x474023[_0x60fc('0x40')];}if(_0x474023[_0x60fc('0x45')]&&agents[_0x474023[_0x60fc('0x45')]]){agents[_0x474023[_0x60fc('0x45')]][_0x60fc('0x46')]=0x1;transfers[_0x474023[_0x60fc('0x45')]]=_['clone'](agents[_0x474023[_0x60fc('0x45')]]);transfers[_0x474023[_0x60fc('0x45')]][_0x60fc('0x47')]=agents[_0x474023[_0x60fc('0x42')]]['calleridnum'];transfers[_0x474023[_0x60fc('0x45')]][_0x60fc('0x48')]=agents[_0x474023[_0x60fc('0x42')]][_0x60fc('0x48')];transfers[_0x474023[_0x60fc('0x45')]][_0x60fc('0x17')]=utils[_0x60fc('0x18')]();transfers[_0x474023[_0x60fc('0x45')]][_0x60fc('0x2f')]=utils[_0x60fc('0x18')]();transfers[_0x474023[_0x60fc('0x45')]]['holdtime']=0x0;transfers[_0x474023[_0x60fc('0x45')]][_0x60fc('0x46')]=0x2;}}else if(_0x474023['secondtransfereruniqueid']==_0x474023[_0x60fc('0x49')]){if(!_[_0x60fc('0x1e')](agents[_0x474023[_0x60fc('0x40')]])){utils['info'](util[_0x60fc('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x474023['origtransfereruniqueid'],agents[_0x474023['origtransfereruniqueid']][_0x60fc('0x7')]));agents[_0x474023[_0x60fc('0x40')]][_0x60fc('0x4a')]=!![];agents[_0x474023[_0x60fc('0x40')]][_0x60fc('0x3c')]=_0x60fc('0x43');agents[_0x474023['origtransfereruniqueid']][_0x60fc('0x3e')]=_0x474023['secondtransfererexten'];agents[_0x474023['origtransfereruniqueid']][_0x60fc('0x3f')]=_0x474023[_0x60fc('0x42')];}if(_0x474023[_0x60fc('0x4b')]&&agents[_0x474023['transfertargetuniqueid']]){agents[_0x474023[_0x60fc('0x4b')]][_0x60fc('0x46')]=0x1;transfers[_0x474023[_0x60fc('0x4b')]]=_[_0x60fc('0x4c')](agents[_0x474023[_0x60fc('0x4b')]]);transfers[_0x474023[_0x60fc('0x4b')]][_0x60fc('0x47')]=agents[_0x474023['origtransfereruniqueid']]['calleridnum'];transfers[_0x474023['transfertargetuniqueid']][_0x60fc('0x48')]=agents[_0x474023[_0x60fc('0x40')]][_0x60fc('0x48')];transfers[_0x474023['transfertargetuniqueid']][_0x60fc('0x17')]=utils[_0x60fc('0x18')]();transfers[_0x474023[_0x60fc('0x4b')]]['agentconnectAt']=utils[_0x60fc('0x18')]();transfers[_0x474023['transfertargetuniqueid']][_0x60fc('0x23')]=0x0;transfers[_0x474023[_0x60fc('0x4b')]]['agententerreason']=0x2;}}}catch(_0x41effe){utils[_0x60fc('0x1c')](util[_0x60fc('0x3')](_0x60fc('0x4d'),_0x474023[_0x60fc('0x40')]),_0x41effe);}};exports[_0x60fc('0x4e')]=function(_0x2c4455){try{utils[_0x60fc('0x14')](util[_0x60fc('0x3')](_0x60fc('0x4f'),_0x2c4455[_0x60fc('0x4')]),_0x2c4455);if(agents[_0x2c4455[_0x60fc('0x4')]]&&agents[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x2c')]===_0x60fc('0x22')){if(_0x2c4455[_0x60fc('0x50')]==='21'){agents[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x2c')]=_0x60fc('0x51');agents[_0x2c4455['uniqueid']][_0x60fc('0x9')]=_0x60fc('0x51');}utils[_0x60fc('0x2')](util[_0x60fc('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2c4455[_0x60fc('0x4')],agents[_0x2c4455[_0x60fc('0x4')]]['membername'],agents[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x2c')],agents[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x9')]));writeDB(agents[_0x2c4455['uniqueid']]);var _0x10ef4b=unanswered[_0x60fc('0x52')](_0x2c4455['uniqueid']);if(_0x10ef4b>-0x1){unanswered['splice'](_0x10ef4b,0x1);}}if(transfers[_0x2c4455[_0x60fc('0x4')]]){transfers[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x34')]=!![];transfers[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x37')]=utils[_0x60fc('0x18')]();transfers[_0x2c4455['uniqueid']][_0x60fc('0x25')]=utils['diffTime'](transfers[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x37')],transfers[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x2f')]);transfers[_0x2c4455[_0x60fc('0x4')]]['reason']='agent';transfers[_0x2c4455[_0x60fc('0x4')]]['lastevent']=_0x60fc('0x38');utils['info'](util[_0x60fc('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2c4455[_0x60fc('0x4')],transfers[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x7')],transfers[_0x2c4455['uniqueid']][_0x60fc('0x2c')],transfers[_0x2c4455[_0x60fc('0x4')]]['lastevent']));writeDB(transfers[_0x2c4455[_0x60fc('0x4')]],!![]);}if(agents[_0x2c4455[_0x60fc('0x4')]]&&agents[_0x2c4455['uniqueid']][_0x60fc('0x2f')]){agents[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x34')]=!![];agents[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x37')]=utils['now']();agents[_0x2c4455['uniqueid']][_0x60fc('0x25')]=utils[_0x60fc('0x53')](agents[_0x2c4455['uniqueid']][_0x60fc('0x37')],agents[_0x2c4455['uniqueid']][_0x60fc('0x2f')]);agents[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x2c')]=agents[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x4a')]?_0x60fc('0x4a'):'agent';agents[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x9')]=_0x60fc('0x38');utils[_0x60fc('0x2')](util['format'](_0x60fc('0x54'),_0x2c4455[_0x60fc('0x4')],agents[_0x2c4455[_0x60fc('0x4')]]['membername'],agents[_0x2c4455[_0x60fc('0x4')]][_0x60fc('0x2c')],agents[_0x2c4455['uniqueid']][_0x60fc('0x9')]));writeDB(agents[_0x2c4455[_0x60fc('0x4')]]);}}catch(_0x43b582){utils[_0x60fc('0x1c')](util[_0x60fc('0x3')](_0x60fc('0x4f'),_0x2c4455[_0x60fc('0x4')]),_0x43b582);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 8c4530b..c2b6a5e 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 _0x856f=['\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','noop','execif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','now','disposition','toNumber','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','transfertargetchannel','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','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination'];(function(_0x103120,_0x5e7479){var _0x1638c6=function(_0x4c2e38){while(--_0x4c2e38){_0x103120['push'](_0x103120['shift']());}};_0x1638c6(++_0x5e7479);}(_0x856f,0x92));var _0xf856=function(_0x53d6dc,_0x4c6dcc){_0x53d6dc=_0x53d6dc-0x0;var _0x32a8f5=_0x856f[_0x53d6dc];return _0x32a8f5;};'use strict';var _=require(_0xf856('0x0'));var util=require(_0xf856('0x1'));var utils=require(_0xf856('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xf856('0x3'),_0xf856('0x4'),'FAILED',_0xf856('0x3'),_0xf856('0x3'),_0xf856('0x3'),_0xf856('0x5'),_0xf856('0x6'),_0xf856('0x4'),_0xf856('0x4'),_0xf856('0x4')];var channels={};function writeDB(_0x1acfbb){var _0x10b32b;if(transfers[_0xf856('0x7')][_0x1acfbb[_0xf856('0x8')]]){_0x10b32b=_0x1acfbb[_0xf856('0x8')];_0x1acfbb['uniqueid']=transfers[_0xf856('0x7')][_0x1acfbb['uniqueid']][_0xf856('0x9')];}utils[_0xf856('0xa')](util[_0xf856('0xb')](_0xf856('0xc'),_0x1acfbb[_0xf856('0x8')],_0x1acfbb[_0xf856('0xd')],_0x1acfbb[_0xf856('0xe')],_0x1acfbb[_0xf856('0xf')],_0x1acfbb['interface'],_0x1acfbb['calleridnum'],_0x1acfbb['connectedlinenum'],_0x1acfbb[_0xf856('0x10')]));if(_0x1acfbb[_0xf856('0x11')]){utils[_0xf856('0x12')](_0x1acfbb[_0xf856('0x11')])[_0xf856('0x13')](function(_0x53ae93){if(_0x53ae93){_0x1acfbb['UserId']=_0x53ae93['id'];}utils[_0xf856('0x14')](_0xf856('0x15'),_0x1acfbb);});}else{utils['request'](_0xf856('0x15'),_0x1acfbb);}if(channels[_0x1acfbb['uniqueid']]){delete channels[_0x1acfbb[_0xf856('0x8')]];}else if(_0x10b32b&&channels[_0x10b32b]){delete transfers[_0xf856('0x7')][_0x10b32b];delete channels[_0x10b32b];}}exports[_0xf856('0x16')]=function(_0x5662d5){try{utils[_0xf856('0x17')](util['format']('[%s][calls][newchannel]',_0x5662d5[_0xf856('0x8')]),_0x5662d5);if(_0x5662d5[_0xf856('0x8')]==_0x5662d5[_0xf856('0x18')]&&_0x5662d5[_0xf856('0xd')]!=_0xf856('0x19')){utils[_0xf856('0xa')](util[_0xf856('0xb')](_0xf856('0x1a'),_0x5662d5['uniqueid'],_0x5662d5[_0xf856('0x1b')],_0x5662d5[_0xf856('0x1c')]));channels[_0x5662d5[_0xf856('0x8')]]={'uniqueid':_0x5662d5[_0xf856('0x8')],'accountcode':_0x5662d5[_0xf856('0x11')],'source':_0x5662d5[_0xf856('0x1d')],'destination':_0x5662d5['exten'],'destinationcontext':_0x5662d5[_0xf856('0x1b')],'channel':_0x5662d5[_0xf856('0xd')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xf856('0x3'),'amaflags':_0xf856('0x1e')};}}catch(_0xed14f5){utils[_0xf856('0x1f')](util[_0xf856('0xb')](_0xf856('0x20'),_0x5662d5['uniqueid']),_0xed14f5);}};exports[_0xf856('0x21')]=function(_0x3b3877){try{utils[_0xf856('0x17')](util[_0xf856('0xb')](_0xf856('0x22'),_0x3b3877['uniqueid']),_0x3b3877);if(!_['isNil'](channels[_0x3b3877[_0xf856('0x8')]])&&_0x3b3877[_0xf856('0x23')]==0x6){utils[_0xf856('0xa')](util[_0xf856('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3b3877['uniqueid'],_0x3b3877['context'],_0x3b3877[_0xf856('0xd')]));if(_[_0xf856('0x24')](channels[_0x3b3877['uniqueid']][_0xf856('0x25')])){channels[_0x3b3877[_0xf856('0x8')]][_0xf856('0x25')]=utils['now']();}}else if(!_[_0xf856('0x24')](channels[_0x3b3877['linkedid']])&&_0x3b3877['channelstate']==0x6&&_0x3b3877[_0xf856('0x1b')]!=_0xf856('0x26')){utils['info'](util[_0xf856('0xb')](_0xf856('0x27'),_0x3b3877['uniqueid'],_0x3b3877[_0xf856('0x18')],_0x3b3877[_0xf856('0x1b')],_0x3b3877[_0xf856('0xd')]));channels[_0x3b3877['linkedid']]['accountcode']=_0x3b3877['accountcode'];channels[_0x3b3877[_0xf856('0x18')]]['destinationchannel']=_0x3b3877[_0xf856('0xd')];if(_['isNil'](channels[_0x3b3877[_0xf856('0x18')]][_0xf856('0x28')])){channels[_0x3b3877[_0xf856('0x18')]][_0xf856('0x28')]=utils[_0xf856('0x29')]();}channels[_0x3b3877[_0xf856('0x18')]][_0xf856('0x2a')]=dispositions[_[_0xf856('0x2b')](_0x3b3877[_0xf856('0x23')])]||_0xf856('0x5');}}catch(_0x1de4d4){utils[_0xf856('0x1f')](util[_0xf856('0xb')]('[%s][calls][newstate]',_0x3b3877[_0xf856('0x8')]),_0x1de4d4);}};exports[_0xf856('0x2c')]=function(_0x236d18){try{if(!_[_0xf856('0x24')](channels[_0x236d18[_0xf856('0x8')]])){utils['debug'](util[_0xf856('0xb')]('[%s][calls][hangup]',_0x236d18[_0xf856('0x8')]),_0x236d18);if(_[_0xf856('0x24')](channels[_0x236d18[_0xf856('0x8')]][_0xf856('0x2d')])){channels[_0x236d18['uniqueid']]['callerid']=_0x236d18[_0xf856('0x2e')]+'\x20<'+_0x236d18[_0xf856('0x1d')]+'>';}utils[_0xf856('0xa')](util[_0xf856('0xb')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x236d18[_0xf856('0x8')],channels[_0x236d18[_0xf856('0x8')]]['callerid'],_0x236d18[_0xf856('0x2f')]));channels[_0x236d18[_0xf856('0x8')]][_0xf856('0x30')]=utils[_0xf856('0x29')]();channels[_0x236d18[_0xf856('0x8')]][_0xf856('0x31')]=utils[_0xf856('0x32')](channels[_0x236d18[_0xf856('0x8')]][_0xf856('0x30')],channels[_0x236d18[_0xf856('0x8')]][_0xf856('0x33')]);channels[_0x236d18['uniqueid']]['billableseconds']=channels[_0x236d18[_0xf856('0x8')]][_0xf856('0x28')]?utils['diffTime'](channels[_0x236d18['uniqueid']][_0xf856('0x30')],channels[_0x236d18[_0xf856('0x8')]][_0xf856('0x28')]):0x0;writeDB(channels[_0x236d18[_0xf856('0x8')]]);}}catch(_0x5d30db){utils[_0xf856('0x1f')](util[_0xf856('0xb')](_0xf856('0x34'),_0x236d18[_0xf856('0x8')]),_0x5d30db);}};exports[_0xf856('0x35')]=function(_0x2207d4){try{if(!_[_0xf856('0x24')](channels[_0x2207d4[_0xf856('0x36')]])){utils['debug'](util['format'](_0xf856('0x37'),_0x2207d4['origtransfereruniqueid']),_0x2207d4);if(channels[_0x2207d4[_0xf856('0x36')]][_0xf856('0xd')]==_0x2207d4['transfereechannel']){utils['info'](util['format'](_0xf856('0x38'),_0x2207d4[_0xf856('0x39')],_0x2207d4[_0xf856('0x36')],_0x2207d4[_0xf856('0x3a')]));channels[_0x2207d4[_0xf856('0x36')]][_0xf856('0x3b')]=_0x2207d4[_0xf856('0x3a')];channels[_0x2207d4[_0xf856('0x36')]][_0xf856('0x3c')]='_attended';}else if(channels[_0x2207d4['localtwolinkedid']]['channel']=_0x2207d4[_0xf856('0x3d')]){utils[_0xf856('0xa')](util['format'](_0xf856('0x38'),_0x2207d4[_0xf856('0x39')],_0x2207d4[_0xf856('0x36')],_0x2207d4['origtransfererchannel']));channels[_0x2207d4['localtwolinkedid']][_0xf856('0x3b')]=_0x2207d4[_0xf856('0x3e')];channels[_0x2207d4[_0xf856('0x36')]][_0xf856('0x3c')]=_0xf856('0x3f');}}}catch(_0x25d749){utils[_0xf856('0x1f')](util[_0xf856('0xb')](_0xf856('0x37'),_0x2207d4[_0xf856('0x39')]),_0x25d749);}};exports[_0xf856('0x40')]=function(_0x3f235a){try{if(!_[_0xf856('0x24')](channels[_0x3f235a[_0xf856('0x8')]])){utils['debug'](util[_0xf856('0xb')](_0xf856('0x41'),_0x3f235a[_0xf856('0x8')]),_0x3f235a);channels[_0x3f235a[_0xf856('0x8')]][_0xf856('0x42')]=utils[_0xf856('0x29')]();utils['info'](util[_0xf856('0xb')](_0xf856('0x43'),_0x3f235a[_0xf856('0x8')],channels[_0x3f235a[_0xf856('0x8')]][_0xf856('0x42')]));}}catch(_0x24bda7){utils[_0xf856('0x1f')](util['format'](_0xf856('0x41'),_0x3f235a['uniqueid']),_0x24bda7);}};exports[_0xf856('0x44')]=function(_0x4375a8){try{if(!_[_0xf856('0x24')](channels[_0x4375a8['uniqueid']])){utils[_0xf856('0x17')](util[_0xf856('0xb')](_0xf856('0x45'),_0x4375a8[_0xf856('0x8')]),_0x4375a8);if(!_[_0xf856('0x24')](channels[_0x4375a8['uniqueid']][_0xf856('0x42')])){channels[_0x4375a8[_0xf856('0x8')]]['mohtime']+=utils[_0xf856('0x32')](utils[_0xf856('0x29')](),channels[_0x4375a8['uniqueid']][_0xf856('0x42')]);utils[_0xf856('0xa')](util['format'](_0xf856('0x46'),_0x4375a8[_0xf856('0x8')],channels[_0x4375a8[_0xf856('0x8')]][_0xf856('0x47')]));delete channels[_0x4375a8[_0xf856('0x8')]]['musiconholdstartAt'];}}}catch(_0x10cbb2){utils[_0xf856('0x1f')](util[_0xf856('0xb')](_0xf856('0x45'),_0x4375a8['uniqueid']),_0x10cbb2);}};exports['varset']=function(_0x1b8df5){try{if(!_[_0xf856('0x24')](channels[_0x1b8df5[_0xf856('0x8')]])){utils[_0xf856('0x17')](util['format'](_0xf856('0x48'),_0x1b8df5[_0xf856('0x8')]),_0x1b8df5);if(!_['isNil'](_0x1b8df5[_0xf856('0x49')][_0xf856('0x4a')])){utils[_0xf856('0xa')](util[_0xf856('0xb')](_0xf856('0x4b'),_0x1b8df5[_0xf856('0x8')],_0x1b8df5[_0xf856('0x4c')]));channels[_0x1b8df5[_0xf856('0x8')]]['source']=_0x1b8df5[_0xf856('0x4c')];}if(!_[_0xf856('0x24')](_0x1b8df5[_0xf856('0x49')][_0xf856('0x4d')])){utils[_0xf856('0xa')](util['format'](_0xf856('0x4e'),_0x1b8df5[_0xf856('0x8')],_0x1b8df5[_0xf856('0x4c')]));channels[_0x1b8df5[_0xf856('0x8')]][_0xf856('0x4f')]=_0x1b8df5[_0xf856('0x4c')];channels[_0x1b8df5[_0xf856('0x8')]][_0xf856('0x2d')]='\x22'+_0x1b8df5[_0xf856('0x4c')]+_0xf856('0x50')+_0x1b8df5[_0xf856('0x4c')]+'>';}if(!_[_0xf856('0x24')](_0x1b8df5[_0xf856('0x49')][_0xf856('0x51')])||!_[_0xf856('0x24')](_0x1b8df5[_0xf856('0x49')]['xmd-callerid'])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1b8df5['uniqueid'],!_[_0xf856('0x24')](_0x1b8df5[_0xf856('0x49')][_0xf856('0x51')])?_0xf856('0x51'):_0xf856('0x52'),_0x1b8df5[_0xf856('0x4c')]));channels[_0x1b8df5[_0xf856('0x8')]][_0xf856('0x2d')]=_0x1b8df5[_0xf856('0x4c')];}if(!_[_0xf856('0x24')](_0x1b8df5['variable'][_0xf856('0x53')])||!_[_0xf856('0x24')](_0x1b8df5['variable'][_0xf856('0x54')])){utils[_0xf856('0xa')](util[_0xf856('0xb')](_0xf856('0x55'),_0x1b8df5[_0xf856('0x8')],!_['isNil'](_0x1b8df5[_0xf856('0x49')][_0xf856('0x53')])?_0xf856('0x53'):_0xf856('0x54'),_0x1b8df5[_0xf856('0x4c')]));channels[_0x1b8df5['uniqueid']][_0xf856('0x56')]='Queue';channels[_0x1b8df5['uniqueid']][_0xf856('0x57')]=_0x1b8df5[_0xf856('0x4c')];channels[_0x1b8df5[_0xf856('0x8')]][_0xf856('0xe')]=!![];}if(!_['isNil'](_0x1b8df5[_0xf856('0x49')][_0xf856('0x58')])){utils['info'](util['format'](_0xf856('0x59'),_0x1b8df5[_0xf856('0x8')],_0x1b8df5['value']));channels[_0x1b8df5[_0xf856('0x8')]][_0xf856('0x5a')]=_0x1b8df5['value'];}if(!_[_0xf856('0x24')](_0x1b8df5['variable'][_0xf856('0x5b')])){utils[_0xf856('0xa')](util[_0xf856('0xb')](_0xf856('0x5c'),_0x1b8df5[_0xf856('0x8')],_0x1b8df5[_0xf856('0x4c')]));channels[_0x1b8df5[_0xf856('0x8')]][_0xf856('0x5d')]=_0x1b8df5[_0xf856('0x4c')];}if(!_[_0xf856('0x24')](_0x1b8df5['variable'][_0xf856('0x5e')])){utils[_0xf856('0xa')](util[_0xf856('0xb')](_0xf856('0x5f'),_0x1b8df5[_0xf856('0x8')],_0x1b8df5[_0xf856('0x4c')]));channels[_0x1b8df5[_0xf856('0x8')]][_0xf856('0x60')]=_0x1b8df5[_0xf856('0x4c')];}if(!_['isNil'](_0x1b8df5[_0xf856('0x49')][_0xf856('0x61')])){utils[_0xf856('0xa')](util[_0xf856('0xb')](_0xf856('0x62'),_0x1b8df5['uniqueid'],_0x1b8df5[_0xf856('0x4c')]));channels[_0x1b8df5[_0xf856('0x8')]][_0xf856('0x61')]=_0x1b8df5['value'];}}}catch(_0x10d8ae){utils['error'](util[_0xf856('0xb')](_0xf856('0x48'),_0x1b8df5[_0xf856('0x8')]),_0x10d8ae);}};exports[_0xf856('0x63')]=function(_0x3101c8){try{if(!_['isNil'](channels[_0x3101c8[_0xf856('0x8')]])){utils['debug'](util[_0xf856('0xb')](_0xf856('0x64'),_0x3101c8[_0xf856('0x8')]),_0x3101c8);utils[_0xf856('0xa')](util[_0xf856('0xb')](_0xf856('0x65'),_0x3101c8[_0xf856('0x8')],_0x3101c8[_0xf856('0x66')],_0x3101c8[_0xf856('0x67')]));if(_0x3101c8['application'][_0xf856('0x68')]()==_0xf856('0x69')&&_[_0xf856('0x6a')](_0x3101c8[_0xf856('0x67')][_0xf856('0x68')](),_0xf856('0x6b'))){var _0x1e6d5a=_0x3101c8[_0xf856('0x67')]['split']('=');var _0x4bfddc=_0x1e6d5a[0x0][_0xf856('0x6c')](_0x1e6d5a[0x0][_0xf856('0x6d')]('(')+0x1,_0x1e6d5a[0x0][_0xf856('0x6d')](')'));var _0x1a6264=_0x1e6d5a[0x1];channels[_0x3101c8['uniqueid']][_0x4bfddc]=_0x1a6264;}if(!_[_0xf856('0x6e')]([_0xf856('0x2c'),_0xf856('0x6f'),_0xf856('0x70'),'set','gotoif'],_0x3101c8[_0xf856('0x66')][_0xf856('0x68')]())){channels[_0x3101c8[_0xf856('0x8')]][_0xf856('0x56')]=_0x3101c8[_0xf856('0x66')];channels[_0x3101c8[_0xf856('0x8')]][_0xf856('0x57')]=_0x3101c8[_0xf856('0x67')];}}}catch(_0x539e4f){utils[_0xf856('0x1f')](util[_0xf856('0xb')](_0xf856('0x64'),_0x3101c8[_0xf856('0x8')]),_0x539e4f);}}; \ No newline at end of file +var _0xeaf3=['[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','toNumber','ANSWERED','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','diffTime','starttime','billableseconds','answertime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfereruniqueid','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','lastIndexOf','includes','hangup','gotoif','lastdata','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','membername','interface','calleridnum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xeaf3,0x1ea));var _0x3eaf=function(_0x4a732f,_0x25df3d){_0x4a732f=_0x4a732f-0x0;var _0x47f3f3=_0xeaf3[_0x4a732f];return _0x47f3f3;};'use strict';var _=require(_0x3eaf('0x0'));var util=require(_0x3eaf('0x1'));var utils=require(_0x3eaf('0x2'));var transfers=require(_0x3eaf('0x3'));var dispositions=[_0x3eaf('0x4'),_0x3eaf('0x5'),_0x3eaf('0x5'),_0x3eaf('0x4'),'NO\x20ANSWER',_0x3eaf('0x4'),'ANSWERED',_0x3eaf('0x6'),'FAILED',_0x3eaf('0x5'),'FAILED'];var channels={};function writeDB(_0x400c1f){var _0x21f585;if(transfers[_0x3eaf('0x7')][_0x400c1f[_0x3eaf('0x8')]]){_0x21f585=_0x400c1f[_0x3eaf('0x8')];_0x400c1f['uniqueid']=transfers[_0x3eaf('0x7')][_0x400c1f[_0x3eaf('0x8')]][_0x3eaf('0x9')];}utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x400c1f['uniqueid'],_0x400c1f[_0x3eaf('0xc')],_0x400c1f[_0x3eaf('0xd')],_0x400c1f[_0x3eaf('0xe')],_0x400c1f[_0x3eaf('0xf')],_0x400c1f[_0x3eaf('0x10')],_0x400c1f['connectedlinenum'],_0x400c1f['lastevent']));if(_0x400c1f[_0x3eaf('0x11')]){utils[_0x3eaf('0x12')](_0x400c1f[_0x3eaf('0x11')])[_0x3eaf('0x13')](function(_0x58413e){if(_0x58413e){_0x400c1f[_0x3eaf('0x14')]=_0x58413e['id'];}utils[_0x3eaf('0x15')]('CreateVoiceCallReport',_0x400c1f);});}else{utils[_0x3eaf('0x15')](_0x3eaf('0x16'),_0x400c1f);}if(channels[_0x400c1f[_0x3eaf('0x8')]]){delete channels[_0x400c1f[_0x3eaf('0x8')]];}else if(_0x21f585&&channels[_0x21f585]){delete transfers[_0x3eaf('0x7')][_0x21f585];delete channels[_0x21f585];}}exports['newchannel']=function(_0x31a36f){try{utils[_0x3eaf('0x17')](util['format'](_0x3eaf('0x18'),_0x31a36f[_0x3eaf('0x8')]),_0x31a36f);if(_0x31a36f[_0x3eaf('0x8')]==_0x31a36f['linkedid']&&_0x31a36f[_0x3eaf('0xc')]!='OutgoingSpoolFailed'){utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')](_0x3eaf('0x19'),_0x31a36f[_0x3eaf('0x8')],_0x31a36f[_0x3eaf('0x1a')],_0x31a36f['exten']));channels[_0x31a36f[_0x3eaf('0x8')]]={'uniqueid':_0x31a36f['uniqueid'],'accountcode':_0x31a36f[_0x3eaf('0x11')],'source':_0x31a36f[_0x3eaf('0x10')],'destination':_0x31a36f[_0x3eaf('0x1b')],'destinationcontext':_0x31a36f[_0x3eaf('0x1a')],'channel':_0x31a36f[_0x3eaf('0xc')],'starttime':utils[_0x3eaf('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3eaf('0x4'),'amaflags':_0x3eaf('0x1d')};}}catch(_0x189288){utils[_0x3eaf('0x1e')](util['format'](_0x3eaf('0x18'),_0x31a36f[_0x3eaf('0x8')]),_0x189288);}};exports[_0x3eaf('0x1f')]=function(_0x26b1d3){try{utils[_0x3eaf('0x17')](util[_0x3eaf('0xb')](_0x3eaf('0x20'),_0x26b1d3['uniqueid']),_0x26b1d3);if(!_[_0x3eaf('0x21')](channels[_0x26b1d3[_0x3eaf('0x8')]])&&_0x26b1d3[_0x3eaf('0x22')]==0x6){utils['info'](util[_0x3eaf('0xb')](_0x3eaf('0x23'),_0x26b1d3[_0x3eaf('0x8')],_0x26b1d3[_0x3eaf('0x1a')],_0x26b1d3[_0x3eaf('0xc')]));if(_[_0x3eaf('0x21')](channels[_0x26b1d3[_0x3eaf('0x8')]][_0x3eaf('0x24')])){channels[_0x26b1d3[_0x3eaf('0x8')]][_0x3eaf('0x24')]=utils[_0x3eaf('0x1c')]();}}else if(!_[_0x3eaf('0x21')](channels[_0x26b1d3[_0x3eaf('0x25')]])&&_0x26b1d3[_0x3eaf('0x22')]==0x6&&_0x26b1d3[_0x3eaf('0x1a')]!=_0x3eaf('0x26')){utils['info'](util[_0x3eaf('0xb')](_0x3eaf('0x27'),_0x26b1d3[_0x3eaf('0x8')],_0x26b1d3[_0x3eaf('0x25')],_0x26b1d3['context'],_0x26b1d3['channel']));channels[_0x26b1d3['linkedid']][_0x3eaf('0x11')]=_0x26b1d3['accountcode'];channels[_0x26b1d3['linkedid']][_0x3eaf('0x28')]=_0x26b1d3[_0x3eaf('0xc')];if(_['isNil'](channels[_0x26b1d3[_0x3eaf('0x25')]]['answertime'])){channels[_0x26b1d3[_0x3eaf('0x25')]]['answertime']=utils[_0x3eaf('0x1c')]();}channels[_0x26b1d3[_0x3eaf('0x25')]]['disposition']=dispositions[_[_0x3eaf('0x29')](_0x26b1d3[_0x3eaf('0x22')])]||_0x3eaf('0x2a');}}catch(_0x545c12){utils[_0x3eaf('0x1e')](util['format'](_0x3eaf('0x20'),_0x26b1d3[_0x3eaf('0x8')]),_0x545c12);}};exports['hangup']=function(_0x33742){try{if(!_['isNil'](channels[_0x33742[_0x3eaf('0x8')]])){utils['debug'](util[_0x3eaf('0xb')](_0x3eaf('0x2b'),_0x33742[_0x3eaf('0x8')]),_0x33742);if(_[_0x3eaf('0x21')](channels[_0x33742[_0x3eaf('0x8')]][_0x3eaf('0x2c')])){channels[_0x33742['uniqueid']]['callerid']=_0x33742[_0x3eaf('0x2d')]+'\x20<'+_0x33742['calleridnum']+'>';}utils['info'](util[_0x3eaf('0xb')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x33742[_0x3eaf('0x8')],channels[_0x33742[_0x3eaf('0x8')]][_0x3eaf('0x2c')],_0x33742[_0x3eaf('0x2e')]));channels[_0x33742[_0x3eaf('0x8')]][_0x3eaf('0x2f')]=utils[_0x3eaf('0x1c')]();channels[_0x33742[_0x3eaf('0x8')]]['duration']=utils[_0x3eaf('0x30')](channels[_0x33742[_0x3eaf('0x8')]][_0x3eaf('0x2f')],channels[_0x33742[_0x3eaf('0x8')]][_0x3eaf('0x31')]);channels[_0x33742[_0x3eaf('0x8')]][_0x3eaf('0x32')]=channels[_0x33742[_0x3eaf('0x8')]]['answertime']?utils[_0x3eaf('0x30')](channels[_0x33742['uniqueid']][_0x3eaf('0x2f')],channels[_0x33742[_0x3eaf('0x8')]][_0x3eaf('0x33')]):0x0;writeDB(channels[_0x33742[_0x3eaf('0x8')]]);}}catch(_0x279988){utils[_0x3eaf('0x1e')](util[_0x3eaf('0xb')](_0x3eaf('0x2b'),_0x33742[_0x3eaf('0x8')]),_0x279988);}};exports[_0x3eaf('0x34')]=function(_0x223002){try{if(!_[_0x3eaf('0x21')](channels[_0x223002[_0x3eaf('0x35')]])){utils[_0x3eaf('0x17')](util[_0x3eaf('0xb')](_0x3eaf('0x36'),_0x223002['origtransfereruniqueid']),_0x223002);if(channels[_0x223002[_0x3eaf('0x35')]][_0x3eaf('0xc')]==_0x223002[_0x3eaf('0x37')]){utils['info'](util[_0x3eaf('0xb')](_0x3eaf('0x38'),_0x223002['origtransfereruniqueid'],_0x223002['localtwolinkedid'],_0x223002['secondtransfererchannel']));channels[_0x223002[_0x3eaf('0x35')]][_0x3eaf('0x28')]=_0x223002[_0x3eaf('0x39')];channels[_0x223002[_0x3eaf('0x35')]][_0x3eaf('0x3a')]=_0x3eaf('0x3b');}else if(channels[_0x223002[_0x3eaf('0x35')]][_0x3eaf('0xc')]=_0x223002['transfertargetchannel']){utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')](_0x3eaf('0x38'),_0x223002[_0x3eaf('0x3c')],_0x223002[_0x3eaf('0x35')],_0x223002[_0x3eaf('0x3d')]));channels[_0x223002[_0x3eaf('0x35')]][_0x3eaf('0x28')]=_0x223002[_0x3eaf('0x3d')];channels[_0x223002['localtwolinkedid']][_0x3eaf('0x3a')]='_attended';}}}catch(_0x26c3cc){utils['error'](util[_0x3eaf('0xb')](_0x3eaf('0x36'),_0x223002['origtransfereruniqueid']),_0x26c3cc);}};exports[_0x3eaf('0x3e')]=function(_0x32fd8d){try{if(!_[_0x3eaf('0x21')](channels[_0x32fd8d[_0x3eaf('0x8')]])){utils[_0x3eaf('0x17')](util[_0x3eaf('0xb')](_0x3eaf('0x3f'),_0x32fd8d['uniqueid']),_0x32fd8d);channels[_0x32fd8d[_0x3eaf('0x8')]][_0x3eaf('0x40')]=utils[_0x3eaf('0x1c')]();utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')](_0x3eaf('0x41'),_0x32fd8d[_0x3eaf('0x8')],channels[_0x32fd8d[_0x3eaf('0x8')]][_0x3eaf('0x40')]));}}catch(_0xfdf28e){utils['error'](util[_0x3eaf('0xb')](_0x3eaf('0x3f'),_0x32fd8d['uniqueid']),_0xfdf28e);}};exports[_0x3eaf('0x42')]=function(_0x515397){try{if(!_[_0x3eaf('0x21')](channels[_0x515397['uniqueid']])){utils[_0x3eaf('0x17')](util[_0x3eaf('0xb')](_0x3eaf('0x43'),_0x515397[_0x3eaf('0x8')]),_0x515397);if(!_[_0x3eaf('0x21')](channels[_0x515397[_0x3eaf('0x8')]][_0x3eaf('0x40')])){channels[_0x515397[_0x3eaf('0x8')]][_0x3eaf('0x44')]+=utils['diffTime'](utils[_0x3eaf('0x1c')](),channels[_0x515397[_0x3eaf('0x8')]]['musiconholdstartAt']);utils['info'](util['format'](_0x3eaf('0x45'),_0x515397[_0x3eaf('0x8')],channels[_0x515397[_0x3eaf('0x8')]][_0x3eaf('0x44')]));delete channels[_0x515397[_0x3eaf('0x8')]][_0x3eaf('0x40')];}}}catch(_0x2698d4){utils[_0x3eaf('0x1e')](util['format'](_0x3eaf('0x43'),_0x515397[_0x3eaf('0x8')]),_0x2698d4);}};exports['varset']=function(_0x30100f){try{if(!_[_0x3eaf('0x21')](channels[_0x30100f['uniqueid']])){utils[_0x3eaf('0x17')](util[_0x3eaf('0xb')]('[%s][calls][varset]',_0x30100f[_0x3eaf('0x8')]),_0x30100f);if(!_[_0x3eaf('0x21')](_0x30100f[_0x3eaf('0x46')]['xmd-originatecalleridnum'])){utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')](_0x3eaf('0x47'),_0x30100f[_0x3eaf('0x8')],_0x30100f['value']));channels[_0x30100f[_0x3eaf('0x8')]]['source']=_0x30100f[_0x3eaf('0x48')];}if(!_[_0x3eaf('0x21')](_0x30100f[_0x3eaf('0x46')][_0x3eaf('0x49')])){utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x30100f[_0x3eaf('0x8')],_0x30100f[_0x3eaf('0x48')]));channels[_0x30100f[_0x3eaf('0x8')]][_0x3eaf('0x4a')]=_0x30100f[_0x3eaf('0x48')];channels[_0x30100f[_0x3eaf('0x8')]][_0x3eaf('0x2c')]='\x22'+_0x30100f[_0x3eaf('0x48')]+_0x3eaf('0x4b')+_0x30100f[_0x3eaf('0x48')]+'>';}if(!_[_0x3eaf('0x21')](_0x30100f[_0x3eaf('0x46')][_0x3eaf('0x4c')])||!_[_0x3eaf('0x21')](_0x30100f['variable'][_0x3eaf('0x4d')])){utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')](_0x3eaf('0x4e'),_0x30100f[_0x3eaf('0x8')],!_[_0x3eaf('0x21')](_0x30100f[_0x3eaf('0x46')]['xmd-callerid-preview'])?_0x3eaf('0x4c'):_0x3eaf('0x4d'),_0x30100f['value']));channels[_0x30100f[_0x3eaf('0x8')]][_0x3eaf('0x2c')]=_0x30100f[_0x3eaf('0x48')];}if(!_[_0x3eaf('0x21')](_0x30100f[_0x3eaf('0x46')][_0x3eaf('0x4f')])||!_[_0x3eaf('0x21')](_0x30100f[_0x3eaf('0x46')][_0x3eaf('0x50')])){utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x30100f[_0x3eaf('0x8')],!_[_0x3eaf('0x21')](_0x30100f[_0x3eaf('0x46')][_0x3eaf('0x4f')])?_0x3eaf('0x4f'):_0x3eaf('0x50'),_0x30100f['value']));channels[_0x30100f[_0x3eaf('0x8')]][_0x3eaf('0x51')]=_0x3eaf('0x52');channels[_0x30100f[_0x3eaf('0x8')]]['lastdata']=_0x30100f[_0x3eaf('0x48')];channels[_0x30100f[_0x3eaf('0x8')]]['queue']=!![];}if(!_[_0x3eaf('0x21')](_0x30100f[_0x3eaf('0x46')]['xmd-contactid'])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x30100f[_0x3eaf('0x8')],_0x30100f[_0x3eaf('0x48')]));channels[_0x30100f['uniqueid']][_0x3eaf('0x53')]=_0x30100f['value'];}if(!_[_0x3eaf('0x21')](_0x30100f['variable'][_0x3eaf('0x54')])){utils[_0x3eaf('0xa')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x30100f[_0x3eaf('0x8')],_0x30100f[_0x3eaf('0x48')]));channels[_0x30100f[_0x3eaf('0x8')]][_0x3eaf('0x55')]=_0x30100f[_0x3eaf('0x48')];}if(!_[_0x3eaf('0x21')](_0x30100f[_0x3eaf('0x46')][_0x3eaf('0x56')])){utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')](_0x3eaf('0x57'),_0x30100f['uniqueid'],_0x30100f['value']));channels[_0x30100f['uniqueid']]['routeid']=_0x30100f[_0x3eaf('0x48')];}if(!_[_0x3eaf('0x21')](_0x30100f[_0x3eaf('0x46')]['sipcallid'])){utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')](_0x3eaf('0x58'),_0x30100f[_0x3eaf('0x8')],_0x30100f[_0x3eaf('0x48')]));channels[_0x30100f[_0x3eaf('0x8')]][_0x3eaf('0x59')]=_0x30100f[_0x3eaf('0x48')];}}}catch(_0x333a82){utils['error'](util['format'](_0x3eaf('0x5a'),_0x30100f['uniqueid']),_0x333a82);}};exports[_0x3eaf('0x5b')]=function(_0x1c45b6){try{if(!_[_0x3eaf('0x21')](channels[_0x1c45b6[_0x3eaf('0x8')]])){utils['debug'](util[_0x3eaf('0xb')](_0x3eaf('0x5c'),_0x1c45b6[_0x3eaf('0x8')]),_0x1c45b6);utils[_0x3eaf('0xa')](util[_0x3eaf('0xb')](_0x3eaf('0x5d'),_0x1c45b6[_0x3eaf('0x8')],_0x1c45b6[_0x3eaf('0x5e')],_0x1c45b6[_0x3eaf('0x5f')]));if(_0x1c45b6[_0x3eaf('0x5e')][_0x3eaf('0x60')]()==_0x3eaf('0x61')&&_[_0x3eaf('0x62')](_0x1c45b6[_0x3eaf('0x5f')][_0x3eaf('0x60')](),'cdr')){var _0x139670=_0x1c45b6['appdata'][_0x3eaf('0x63')]('=');var _0x5d57df=_0x139670[0x0]['substring'](_0x139670[0x0][_0x3eaf('0x64')]('(')+0x1,_0x139670[0x0][_0x3eaf('0x64')](')'));var _0xb6161c=_0x139670[0x1];channels[_0x1c45b6[_0x3eaf('0x8')]][_0x5d57df]=_0xb6161c;}if(!_[_0x3eaf('0x65')]([_0x3eaf('0x66'),'noop','execif',_0x3eaf('0x61'),_0x3eaf('0x67')],_0x1c45b6['application'][_0x3eaf('0x60')]())){channels[_0x1c45b6[_0x3eaf('0x8')]]['lastapplication']=_0x1c45b6[_0x3eaf('0x5e')];channels[_0x1c45b6[_0x3eaf('0x8')]][_0x3eaf('0x68')]=_0x1c45b6['appdata'];}}}catch(_0x1526e5){utils[_0x3eaf('0x1e')](util['format'](_0x3eaf('0x5c'),_0x1c45b6['uniqueid']),_0x1526e5);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b689c57..0828be1 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 _0x8101=['fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected'];(function(_0x41bc41,_0x24ad98){var _0x269050=function(_0x32ef06){while(--_0x32ef06){_0x41bc41['push'](_0x41bc41['shift']());}};_0x269050(++_0x24ad98);}(_0x8101,0x13c));var _0x1810=function(_0x27a1e0,_0x3ff2cb){_0x27a1e0=_0x27a1e0-0x0;var _0x1ca624=_0x8101[_0x27a1e0];return _0x1ca624;};'use strict';var utils=require(_0x1810('0x0'));exports[_0x1810('0x1')]=function(){utils[_0x1810('0x2')](_0x1810('0x3'));};exports['shutdown']=function(){utils[_0x1810('0x2')]('[core]\x20shutdown');};exports[_0x1810('0x4')]=function(){utils['info'](_0x1810('0x5'));};exports[_0x1810('0x6')]=function(_0x1d759b){utils[_0x1810('0x6')]('[core]\x20error',_0x1d759b);};exports[_0x1810('0x7')]=function(){utils[_0x1810('0x2')](_0x1810('0x8'));};exports[_0x1810('0x9')]=function(_0x4ce6dd){}; \ No newline at end of file +var _0x19ff=['close','[core]\x20close','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x4dc8c6,_0x3fba52){var _0x69ce1d=function(_0x1a726d){while(--_0x1a726d){_0x4dc8c6['push'](_0x4dc8c6['shift']());}};_0x69ce1d(++_0x3fba52);}(_0x19ff,0x89));var _0xf19f=function(_0x1de247,_0xecea63){_0x1de247=_0x1de247-0x0;var _0x30a0f2=_0x19ff[_0x1de247];return _0x30a0f2;};'use strict';var utils=require('./utils');exports[_0xf19f('0x0')]=function(){utils[_0xf19f('0x1')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0xf19f('0x1')](_0xf19f('0x2'));};exports[_0xf19f('0x3')]=function(){utils['info'](_0xf19f('0x4'));};exports[_0xf19f('0x5')]=function(_0x572b89){utils[_0xf19f('0x5')](_0xf19f('0x6'),_0x572b89);};exports[_0xf19f('0x7')]=function(){utils[_0xf19f('0x1')](_0xf19f('0x8'));};exports['managerevent']=function(_0x5d6c81){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e123aca..d344621 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 _0x46d7=['starttime','error','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','duration','endtime','holdtime','billableseconds','util','./utils','info','uniqueid','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','toLowerCase','cdr(routeid)','appdata','split','varset','debug','[%s][dials][varset]','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called'];(function(_0x23067b,_0x1e20c7){var _0x864dbc=function(_0x199435){while(--_0x199435){_0x23067b['push'](_0x23067b['shift']());}};_0x864dbc(++_0x1e20c7);}(_0x46d7,0xb0));var _0x746d=function(_0x165d81,_0x2f48b7){_0x165d81=_0x165d81-0x0;var _0x182046=_0x46d7[_0x165d81];return _0x182046;};'use strict';var _=require('lodash');var util=require(_0x746d('0x0'));var utils=require(_0x746d('0x1'));var dials={};function writeDB(_0x239f3e){utils[_0x746d('0x2')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x239f3e[_0x746d('0x3')],_0x239f3e['channel'],_0x239f3e[_0x746d('0x4')],_0x239f3e['calleridnum'],_0x239f3e[_0x746d('0x5')],_0x239f3e[_0x746d('0x6')]));utils[_0x746d('0x7')](_0x746d('0x8'),_0x239f3e);delete dials[_0x239f3e['uniqueid']];}exports[_0x746d('0x9')]=function(_0x4f9037){try{utils['debug'](util[_0x746d('0xa')](_0x746d('0xb'),_0x4f9037[_0x746d('0x3')]),_0x4f9037);utils[_0x746d('0x2')](util[_0x746d('0xa')](_0x746d('0xc'),_0x4f9037['uniqueid'],_0x4f9037[_0x746d('0xd')],_0x4f9037['appdata']));if(_0x4f9037[_0x746d('0xd')]['toLowerCase']()==_0x746d('0xe')&&_[_0x746d('0xf')](_0x4f9037['appdata'][_0x746d('0x10')](),_0x746d('0x11'))){var _0x4f5233=_0x4f9037[_0x746d('0x12')][_0x746d('0x13')]('=');dials[_0x4f9037[_0x746d('0x3')]]={'routeId':_0x4f5233[0x1]};}}catch(_0x20e786){utils['error'](util[_0x746d('0xa')](_0x746d('0xb'),_0x4f9037['uniqueid']),_0x20e786);}};exports[_0x746d('0x14')]=function(_0x38be8f){try{utils[_0x746d('0x15')](util[_0x746d('0xa')](_0x746d('0x16'),_0x38be8f[_0x746d('0x3')]),_0x38be8f);if(!_[_0x746d('0x17')](_0x38be8f['variable']['outboundrouteid'])){utils[_0x746d('0x2')](util['format'](_0x746d('0x18'),_0x38be8f['uniqueid'],_0x38be8f[_0x746d('0x19')]));dials[_0x38be8f[_0x746d('0x3')]]={'routeId':_0x38be8f[_0x746d('0x19')]};}}catch(_0x44bd0e){utils['error'](util['format']('[%s][dials][varset]',_0x38be8f[_0x746d('0x3')]),_0x44bd0e);}};exports[_0x746d('0x1a')]=function(_0x5e45a6){try{if(!_[_0x746d('0x17')](dials[_0x5e45a6['uniqueid']])){utils['debug'](util[_0x746d('0xa')](_0x746d('0x1b'),_0x5e45a6[_0x746d('0x3')]),_0x5e45a6);dials[_0x5e45a6[_0x746d('0x3')]]=_[_0x746d('0x1c')](dials[_0x5e45a6[_0x746d('0x3')]],_0x5e45a6);dials[_0x5e45a6['uniqueid']]['starttime']=utils[_0x746d('0x1d')]();dials[_0x5e45a6[_0x746d('0x3')]]['lastevent']=_0x746d('0x1e');utils['info'](util[_0x746d('0xa')](_0x746d('0x1f'),_0x5e45a6[_0x746d('0x3')],dials[_0x5e45a6[_0x746d('0x3')]][_0x746d('0x20')]));}}catch(_0xd9fb16){utils[_0x746d('0x21')](util[_0x746d('0xa')](_0x746d('0x1b'),_0x5e45a6[_0x746d('0x3')]),_0xd9fb16);}};exports[_0x746d('0x22')]=function(_0xf4cb64){try{if(!_[_0x746d('0x17')](dials[_0xf4cb64['uniqueid']])){utils['debug'](util[_0x746d('0xa')](_0x746d('0x23'),_0xf4cb64[_0x746d('0x3')]),_0xf4cb64);dials[_0xf4cb64[_0x746d('0x3')]][_0x746d('0x6')]=_0xf4cb64[_0x746d('0x6')];if(_0xf4cb64[_0x746d('0x6')]==_0x746d('0x24')){dials[_0xf4cb64[_0x746d('0x3')]]=_[_0x746d('0x1c')](dials[_0xf4cb64[_0x746d('0x3')]],_0xf4cb64);dials[_0xf4cb64['uniqueid']][_0x746d('0x25')]=utils['now']();dials[_0xf4cb64['uniqueid']][_0x746d('0x26')]=_0x746d('0x27');utils[_0x746d('0x2')](util[_0x746d('0xa')](_0x746d('0x28'),_0xf4cb64[_0x746d('0x3')],_0xf4cb64[_0x746d('0x6')],dials[_0xf4cb64[_0x746d('0x3')]]['answertime']));}else{utils[_0x746d('0x2')](util[_0x746d('0xa')](_0x746d('0x29'),_0xf4cb64[_0x746d('0x3')],_0xf4cb64[_0x746d('0x6')]));}}}catch(_0x56c679){utils[_0x746d('0x21')](util[_0x746d('0xa')](_0x746d('0x23'),_0xf4cb64[_0x746d('0x3')]),_0x56c679);}};exports[_0x746d('0x2a')]=function(_0x2d189d){try{if(!_[_0x746d('0x17')](dials[_0x2d189d['uniqueid']])){utils['debug'](util[_0x746d('0xa')](_0x746d('0x2b'),_0x2d189d['uniqueid']),_0x2d189d);utils[_0x746d('0x2')](util['format'](_0x746d('0x2c'),_0x2d189d[_0x746d('0x3')],_0x2d189d[_0x746d('0x2d')],_0x2d189d[_0x746d('0x2e')],_0x2d189d['cause-txt']));dials[_0x2d189d[_0x746d('0x3')]]=_[_0x746d('0x1c')](dials[_0x2d189d['uniqueid']],{'endtime':utils[_0x746d('0x1d')](),'lastevent':_0x746d('0x2f')});dials[_0x2d189d['uniqueid']][_0x746d('0x30')]=utils['diffTime'](dials[_0x2d189d[_0x746d('0x3')]][_0x746d('0x31')],dials[_0x2d189d[_0x746d('0x3')]][_0x746d('0x20')]);dials[_0x2d189d[_0x746d('0x3')]][_0x746d('0x32')]=utils['diffTime'](dials[_0x2d189d[_0x746d('0x3')]]['answertime']||dials[_0x2d189d['uniqueid']][_0x746d('0x31')],dials[_0x2d189d[_0x746d('0x3')]][_0x746d('0x20')]);dials[_0x2d189d[_0x746d('0x3')]][_0x746d('0x33')]=dials[_0x2d189d[_0x746d('0x3')]]['answertime']?utils['diffTime'](dials[_0x2d189d[_0x746d('0x3')]][_0x746d('0x31')],dials[_0x2d189d[_0x746d('0x3')]][_0x746d('0x25')]):0x0;writeDB(dials[_0x2d189d['uniqueid']]);}}catch(_0x22c700){utils[_0x746d('0x21')](util[_0x746d('0xa')]('[%s][dials][hangup]',_0x2d189d[_0x746d('0x3')]),_0x22c700);}}; \ No newline at end of file +var _0x0322=['calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime','holdtime','./utils','info','format','channel'];(function(_0x26d741,_0x18409b){var _0x564540=function(_0x23250b){while(--_0x23250b){_0x26d741['push'](_0x26d741['shift']());}};_0x564540(++_0x18409b);}(_0x0322,0x89));var _0x2032=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0x0322[_0x2e7a43];return _0x52e9e1;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x2032('0x0'));var dials={};function writeDB(_0x2ecc64){utils[_0x2032('0x1')](util[_0x2032('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2ecc64['uniqueid'],_0x2ecc64[_0x2032('0x3')],_0x2ecc64['dialstring'],_0x2ecc64[_0x2032('0x4')],_0x2ecc64[_0x2032('0x5')],_0x2ecc64[_0x2032('0x6')]));utils[_0x2032('0x7')](_0x2032('0x8'),_0x2ecc64);delete dials[_0x2ecc64[_0x2032('0x9')]];}exports[_0x2032('0xa')]=function(_0x3f4eac){try{utils[_0x2032('0xb')](util[_0x2032('0x2')](_0x2032('0xc'),_0x3f4eac[_0x2032('0x9')]),_0x3f4eac);utils['info'](util[_0x2032('0x2')](_0x2032('0xd'),_0x3f4eac[_0x2032('0x9')],_0x3f4eac[_0x2032('0xe')],_0x3f4eac[_0x2032('0xf')]));if(_0x3f4eac[_0x2032('0xe')][_0x2032('0x10')]()==_0x2032('0x11')&&_['startsWith'](_0x3f4eac[_0x2032('0xf')][_0x2032('0x10')](),_0x2032('0x12'))){var _0x12f30a=_0x3f4eac[_0x2032('0xf')][_0x2032('0x13')]('=');dials[_0x3f4eac['uniqueid']]={'routeId':_0x12f30a[0x1]};}}catch(_0x1eb49f){utils[_0x2032('0x14')](util[_0x2032('0x2')]('[%s][dials][newexten]',_0x3f4eac[_0x2032('0x9')]),_0x1eb49f);}};exports[_0x2032('0x15')]=function(_0x3c8d9b){try{utils[_0x2032('0xb')](util[_0x2032('0x2')](_0x2032('0x16'),_0x3c8d9b[_0x2032('0x9')]),_0x3c8d9b);if(!_[_0x2032('0x17')](_0x3c8d9b[_0x2032('0x18')][_0x2032('0x19')])){utils[_0x2032('0x1')](util[_0x2032('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x3c8d9b[_0x2032('0x9')],_0x3c8d9b[_0x2032('0x1a')]));dials[_0x3c8d9b['uniqueid']]={'routeId':_0x3c8d9b[_0x2032('0x1a')]};}}catch(_0x5e6a41){utils[_0x2032('0x14')](util[_0x2032('0x2')](_0x2032('0x16'),_0x3c8d9b[_0x2032('0x9')]),_0x5e6a41);}};exports[_0x2032('0x1b')]=function(_0xa8aa53){try{if(!_[_0x2032('0x17')](dials[_0xa8aa53[_0x2032('0x9')]])){utils[_0x2032('0xb')](util[_0x2032('0x2')](_0x2032('0x1c'),_0xa8aa53[_0x2032('0x9')]),_0xa8aa53);dials[_0xa8aa53[_0x2032('0x9')]]=_[_0x2032('0x1d')](dials[_0xa8aa53[_0x2032('0x9')]],_0xa8aa53);dials[_0xa8aa53['uniqueid']]['starttime']=utils[_0x2032('0x1e')]();dials[_0xa8aa53[_0x2032('0x9')]][_0x2032('0x1f')]=_0x2032('0x20');utils[_0x2032('0x1')](util[_0x2032('0x2')](_0x2032('0x21'),_0xa8aa53[_0x2032('0x9')],dials[_0xa8aa53[_0x2032('0x9')]][_0x2032('0x22')]));}}catch(_0x5e3fe8){utils['error'](util[_0x2032('0x2')]('[%s][dials][dialbegin]',_0xa8aa53[_0x2032('0x9')]),_0x5e3fe8);}};exports[_0x2032('0x23')]=function(_0x297795){try{if(!_[_0x2032('0x17')](dials[_0x297795[_0x2032('0x9')]])){utils[_0x2032('0xb')](util[_0x2032('0x2')]('[%s][dials][dialend]',_0x297795[_0x2032('0x9')]),_0x297795);dials[_0x297795[_0x2032('0x9')]][_0x2032('0x6')]=_0x297795['dialstatus'];if(_0x297795['dialstatus']=='ANSWER'){dials[_0x297795[_0x2032('0x9')]]=_[_0x2032('0x1d')](dials[_0x297795[_0x2032('0x9')]],_0x297795);dials[_0x297795[_0x2032('0x9')]][_0x2032('0x24')]=utils[_0x2032('0x1e')]();dials[_0x297795[_0x2032('0x9')]][_0x2032('0x1f')]='connect';utils[_0x2032('0x1')](util[_0x2032('0x2')](_0x2032('0x25'),_0x297795[_0x2032('0x9')],_0x297795[_0x2032('0x6')],dials[_0x297795[_0x2032('0x9')]]['answertime']));}else{utils[_0x2032('0x1')](util['format'](_0x2032('0x26'),_0x297795[_0x2032('0x9')],_0x297795[_0x2032('0x6')]));}}}catch(_0x851223){utils[_0x2032('0x14')](util[_0x2032('0x2')](_0x2032('0x27'),_0x297795[_0x2032('0x9')]),_0x851223);}};exports['hangup']=function(_0x2677fe){try{if(!_[_0x2032('0x17')](dials[_0x2677fe[_0x2032('0x9')]])){utils[_0x2032('0xb')](util[_0x2032('0x2')]('[%s][dials][hangup]',_0x2677fe[_0x2032('0x9')]),_0x2677fe);utils[_0x2032('0x1')](util[_0x2032('0x2')](_0x2032('0x28'),_0x2677fe[_0x2032('0x9')],_0x2677fe[_0x2032('0x4')],_0x2677fe[_0x2032('0x29')],_0x2677fe[_0x2032('0x2a')]));dials[_0x2677fe[_0x2032('0x9')]]=_['assign'](dials[_0x2677fe[_0x2032('0x9')]],{'endtime':utils[_0x2032('0x1e')](),'lastevent':_0x2032('0x2b')});dials[_0x2677fe[_0x2032('0x9')]]['duration']=utils[_0x2032('0x2c')](dials[_0x2677fe[_0x2032('0x9')]][_0x2032('0x2d')],dials[_0x2677fe[_0x2032('0x9')]][_0x2032('0x22')]);dials[_0x2677fe['uniqueid']][_0x2032('0x2e')]=utils[_0x2032('0x2c')](dials[_0x2677fe[_0x2032('0x9')]][_0x2032('0x24')]||dials[_0x2677fe[_0x2032('0x9')]][_0x2032('0x2d')],dials[_0x2677fe[_0x2032('0x9')]][_0x2032('0x22')]);dials[_0x2677fe[_0x2032('0x9')]]['billableseconds']=dials[_0x2677fe['uniqueid']][_0x2032('0x24')]?utils[_0x2032('0x2c')](dials[_0x2677fe[_0x2032('0x9')]][_0x2032('0x2d')],dials[_0x2677fe[_0x2032('0x9')]][_0x2032('0x24')]):0x0;writeDB(dials[_0x2677fe[_0x2032('0x9')]]);}}catch(_0x44b002){utils[_0x2032('0x14')](util['format']('[%s][dials][hangup]',_0x2677fe['uniqueid']),_0x44b002);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 327bf7d..285d611 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 _0xefb7=['keepConnected','xdr','info','XDR\x20DISABLED','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','debug','format','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','port','password'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0xefb7,0x1ba));var _0x7efb=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0xefb7[_0x26fc81];return _0x9feece;};var AsteriskManager=require(_0x7efb('0x0'));var config=require(_0x7efb('0x1'));var utils=require(_0x7efb('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0x7efb('0x3')][_0x7efb('0x4')],config['asterisk']['ip'],config[_0x7efb('0x3')]['username'],config['asterisk'][_0x7efb('0x5')],!![]);ami[_0x7efb('0x6')]();if(config['xdr']&&config[_0x7efb('0x7')]['disabled']){utils[_0x7efb('0x8')](_0x7efb('0x9'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x7efb('0xa'));var recordings=require('./recordings.controller');var members=require(_0x7efb('0xb'));var dials=require(_0x7efb('0xc'));var transfers=require(_0x7efb('0xd'));var core=require(_0x7efb('0xe'));ami['on'](_0x7efb('0xf'),core[_0x7efb('0xf')]);ami['on'](_0x7efb('0x10'),core[_0x7efb('0x10')]);ami['on']('fullybooted',core[_0x7efb('0x11')]);ami['on']('error',core[_0x7efb('0x12')]);ami['on'](_0x7efb('0x13'),core[_0x7efb('0x13')]);ami['on'](_0x7efb('0x14'),core[_0x7efb('0x14')]);ami['on'](_0x7efb('0x15'),function(_0x9fec2f){try{utils['debug'](util['format'](_0x7efb('0x16'),_0x9fec2f[_0x7efb('0x17')]),_0x9fec2f);members[_0x7efb('0x15')](_0x9fec2f);}catch(_0x2a8825){utils[_0x7efb('0x12')](util['format'](_0x7efb('0x16'),_0x9fec2f[_0x7efb('0x17')]),_0x2a8825);}});ami['on'](_0x7efb('0x18'),function(_0x1a2674){try{utils['debug'](util['format'](_0x7efb('0x19'),_0x1a2674[_0x7efb('0x1a')]),_0x1a2674);agents[_0x7efb('0x18')](_0x1a2674);}catch(_0x54d300){utils[_0x7efb('0x12')](util['format'](_0x7efb('0x19'),_0x1a2674[_0x7efb('0x1a')]),_0x54d300);}});ami['on']('agentringnoanswer',function(_0x3a6798){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')]('[%s][index][agentringnoanswer]',_0x3a6798[_0x7efb('0x1a')]),_0x3a6798);agents[_0x7efb('0x1d')](_0x3a6798);}catch(_0x184839){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')]('[%s][index][agentringnoanswer]',_0x3a6798[_0x7efb('0x1a')]),_0x184839);}});ami['on'](_0x7efb('0x1e'),function(_0x115da9){try{utils[_0x7efb('0x1b')](util['format']('[%s][index][agentconnect]',_0x115da9[_0x7efb('0x1a')]),_0x115da9);agents[_0x7efb('0x1e')](_0x115da9);queues['agentconnect'](_0x115da9);}catch(_0x58acff){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')](_0x7efb('0x1f'),_0x115da9[_0x7efb('0x1a')]),_0x58acff);}});ami['on'](_0x7efb('0x20'),function(_0x190c4e){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')](_0x7efb('0x21'),_0x190c4e[_0x7efb('0x1a')]),_0x190c4e);agents[_0x7efb('0x20')](_0x190c4e);queues[_0x7efb('0x20')](_0x190c4e);members[_0x7efb('0x20')](_0x190c4e);}catch(_0x5daeb6){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')](_0x7efb('0x21'),_0x190c4e[_0x7efb('0x1a')]),_0x5daeb6);}});ami['on'](_0x7efb('0x22'),function(_0x25bf31){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')](_0x7efb('0x23'),_0x25bf31['uniqueid']),_0x25bf31);agents[_0x7efb('0x22')](_0x25bf31);queues[_0x7efb('0x22')](_0x25bf31);}catch(_0x20ca4c){utils[_0x7efb('0x12')](util['format'](_0x7efb('0x23'),_0x25bf31[_0x7efb('0x1a')]),_0x20ca4c);}});ami['on'](_0x7efb('0x24'),function(_0x317763){try{utils[_0x7efb('0x1b')](util['format']('[%s][index][queuecallerjoin]',_0x317763['uniqueid']),_0x317763);queues[_0x7efb('0x24')](_0x317763);recordings[_0x7efb('0x24')](_0x317763);}catch(_0x24a268){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')]('[%s][index][queuecallerjoin]',_0x317763[_0x7efb('0x1a')]),_0x24a268);}});ami['on'](_0x7efb('0x25'),function(_0x3c70c4){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')](_0x7efb('0x26'),_0x3c70c4[_0x7efb('0x1a')]),_0x3c70c4);queues[_0x7efb('0x25')](_0x3c70c4);}catch(_0x5830d3){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')](_0x7efb('0x26'),_0x3c70c4[_0x7efb('0x1a')]),_0x5830d3);}});ami['on'](_0x7efb('0x27'),function(_0x3523bd){try{utils['debug'](util[_0x7efb('0x1c')](_0x7efb('0x28'),_0x3523bd[_0x7efb('0x1a')]),_0x3523bd);queues[_0x7efb('0x27')](_0x3523bd);calls['musiconholdstart'](_0x3523bd);}catch(_0x346f6d){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')](_0x7efb('0x28'),_0x3523bd[_0x7efb('0x1a')]),_0x346f6d);}});ami['on'](_0x7efb('0x29'),function(_0x44425e){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')]('[%s][index][musiconholdstop]',_0x44425e[_0x7efb('0x1a')]),_0x44425e);queues[_0x7efb('0x29')](_0x44425e);calls[_0x7efb('0x29')](_0x44425e);}catch(_0x4d6bce){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')](_0x7efb('0x2a'),_0x44425e['uniqueid']),_0x4d6bce);}});ami['on']('newstate',function(_0x24c6c1){try{utils[_0x7efb('0x1b')](util['format']('[%s][index][newstate]',_0x24c6c1[_0x7efb('0x1a')]),_0x24c6c1);calls[_0x7efb('0x2b')](_0x24c6c1);recordings[_0x7efb('0x2b')](_0x24c6c1);}catch(_0x39451d){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')](_0x7efb('0x2c'),_0x24c6c1[_0x7efb('0x1a')]),_0x39451d);}});ami['on'](_0x7efb('0x2d'),function(_0x2587fe){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')]('[%s][index][hangup]',_0x2587fe[_0x7efb('0x1a')]),_0x2587fe);calls[_0x7efb('0x2d')](_0x2587fe);recordings[_0x7efb('0x2d')](_0x2587fe);dials[_0x7efb('0x2d')](_0x2587fe);agents[_0x7efb('0x2d')](_0x2587fe);queues[_0x7efb('0x2d')](_0x2587fe);}catch(_0x448edd){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')]('[%s][index][hangup]',_0x2587fe[_0x7efb('0x1a')]),_0x448edd);}});ami['on'](_0x7efb('0x2e'),function(_0x5afbf4){try{utils['debug'](util['format'](_0x7efb('0x2f'),_0x5afbf4[_0x7efb('0x1a')]),_0x5afbf4);members[_0x7efb('0x2e')](_0x5afbf4);}catch(_0x37492a){utils[_0x7efb('0x12')](util['format']('[%s][index][cdr]',_0x5afbf4[_0x7efb('0x1a')]),_0x37492a);}});ami['on'](_0x7efb('0x30'),function(_0x6d651d){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')](_0x7efb('0x31'),_0x6d651d[_0x7efb('0x1a')]),_0x6d651d);queues[_0x7efb('0x30')](_0x6d651d);agents[_0x7efb('0x30')](_0x6d651d);transfers[_0x7efb('0x30')](_0x6d651d);}catch(_0x372b6d){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')](_0x7efb('0x31'),_0x6d651d[_0x7efb('0x1a')]),_0x372b6d);}});ami['on'](_0x7efb('0x32'),function(_0x36e4d5){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')]('[%s][index][attendedtransfer]',_0x36e4d5[_0x7efb('0x33')]),_0x36e4d5);queues[_0x7efb('0x32')](_0x36e4d5);transfers[_0x7efb('0x32')](_0x36e4d5);agents[_0x7efb('0x32')](_0x36e4d5);calls['attendedtransfer'](_0x36e4d5);}catch(_0xdec60b){utils['error'](util[_0x7efb('0x1c')](_0x7efb('0x34'),_0x36e4d5[_0x7efb('0x33')]),_0xdec60b);}});ami['on'](_0x7efb('0x35'),function(_0x204caf){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')](_0x7efb('0x36'),_0x204caf[_0x7efb('0x1a')]),_0x204caf);queues[_0x7efb('0x35')](_0x204caf);recordings[_0x7efb('0x35')](_0x204caf);calls[_0x7efb('0x35')](_0x204caf);dials[_0x7efb('0x35')](_0x204caf);}catch(_0x2b23fa){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')](_0x7efb('0x36'),_0x204caf[_0x7efb('0x1a')]),_0x2b23fa);}});ami['on'](_0x7efb('0x37'),function(_0x1adbda){try{utils['debug'](util[_0x7efb('0x1c')](_0x7efb('0x38'),_0x1adbda[_0x7efb('0x1a')]),_0x1adbda);calls[_0x7efb('0x37')](_0x1adbda);recordings['newexten'](_0x1adbda);dials[_0x7efb('0x37')](_0x1adbda);}catch(_0x559a66){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')]('[%s][index][newexten]',_0x1adbda[_0x7efb('0x1a')]),_0x559a66);}});ami['on'](_0x7efb('0x39'),function(_0x6d9f7e){try{utils[_0x7efb('0x1b')](util['format'](_0x7efb('0x3a'),_0x6d9f7e['uniqueid']),_0x6d9f7e);calls[_0x7efb('0x39')](_0x6d9f7e);recordings[_0x7efb('0x39')](_0x6d9f7e);}catch(_0x156e85){utils['error'](util[_0x7efb('0x1c')](_0x7efb('0x3a'),_0x6d9f7e[_0x7efb('0x1a')]),_0x156e85);}});ami['on'](_0x7efb('0x3b'),function(_0x474e32){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')](_0x7efb('0x3c'),_0x474e32[_0x7efb('0x1a')]),_0x474e32);dials[_0x7efb('0x3b')](_0x474e32);}catch(_0x4ef21a){utils[_0x7efb('0x12')](util[_0x7efb('0x1c')](_0x7efb('0x3d'),_0x474e32['uniqueid']),_0x4ef21a);}});ami['on'](_0x7efb('0x3e'),function(_0x4002cd){try{utils[_0x7efb('0x1b')](util[_0x7efb('0x1c')](_0x7efb('0x3f'),_0x4002cd[_0x7efb('0x1a')]),_0x4002cd);dials['dialend'](_0x4002cd);}catch(_0x560742){utils['error'](util['format'](_0x7efb('0x3f'),_0x4002cd[_0x7efb('0x1a')]),_0x560742);}});} \ No newline at end of file +var _0xf6fb=['[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','../../config/environment','./utils','util','port','asterisk','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./dials.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr'];(function(_0x15bbf1,_0x40ef96){var _0x5c4b47=function(_0x303b4f){while(--_0x303b4f){_0x15bbf1['push'](_0x15bbf1['shift']());}};_0x5c4b47(++_0x40ef96);}(_0xf6fb,0x8e));var _0xbf6f=function(_0x3e0016,_0x12dc04){_0x3e0016=_0x3e0016-0x0;var _0x466d05=_0xf6fb[_0x3e0016];return _0x466d05;};var AsteriskManager=require('asterisk-manager');var config=require(_0xbf6f('0x0'));var utils=require(_0xbf6f('0x1'));var util=require(_0xbf6f('0x2'));var ami=new AsteriskManager(config['asterisk'][_0xbf6f('0x3')],config[_0xbf6f('0x4')]['ip'],config['asterisk'][_0xbf6f('0x5')],config[_0xbf6f('0x4')][_0xbf6f('0x6')],!![]);ami[_0xbf6f('0x7')]();if(config[_0xbf6f('0x8')]&&config[_0xbf6f('0x8')]['disabled']){utils[_0xbf6f('0x9')](_0xbf6f('0xa'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0xbf6f('0xb'));var transfers=require('./transfers.controller');var core=require(_0xbf6f('0xc'));ami['on']('connect',core[_0xbf6f('0xd')]);ami['on'](_0xbf6f('0xe'),core[_0xbf6f('0xe')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xbf6f('0xf'),core[_0xbf6f('0xf')]);ami['on']('close',core[_0xbf6f('0x10')]);ami['on'](_0xbf6f('0x11'),core['managerevent']);ami['on'](_0xbf6f('0x12'),function(_0x4f9b5a){try{utils['debug'](util[_0xbf6f('0x13')](_0xbf6f('0x14'),_0x4f9b5a[_0xbf6f('0x15')]),_0x4f9b5a);members[_0xbf6f('0x12')](_0x4f9b5a);}catch(_0x15365a){utils[_0xbf6f('0xf')](util[_0xbf6f('0x13')](_0xbf6f('0x14'),_0x4f9b5a[_0xbf6f('0x15')]),_0x15365a);}});ami['on'](_0xbf6f('0x16'),function(_0x2348f9){try{utils[_0xbf6f('0x17')](util['format'](_0xbf6f('0x18'),_0x2348f9[_0xbf6f('0x19')]),_0x2348f9);agents[_0xbf6f('0x16')](_0x2348f9);}catch(_0x32a736){utils[_0xbf6f('0xf')](util[_0xbf6f('0x13')](_0xbf6f('0x18'),_0x2348f9[_0xbf6f('0x19')]),_0x32a736);}});ami['on'](_0xbf6f('0x1a'),function(_0x2fddfb){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')](_0xbf6f('0x1b'),_0x2fddfb[_0xbf6f('0x19')]),_0x2fddfb);agents['agentringnoanswer'](_0x2fddfb);}catch(_0xd9475d){utils[_0xbf6f('0xf')](util[_0xbf6f('0x13')](_0xbf6f('0x1b'),_0x2fddfb['uniqueid']),_0xd9475d);}});ami['on'](_0xbf6f('0x1c'),function(_0x37290c){try{utils[_0xbf6f('0x17')](util['format'](_0xbf6f('0x1d'),_0x37290c[_0xbf6f('0x19')]),_0x37290c);agents[_0xbf6f('0x1c')](_0x37290c);queues['agentconnect'](_0x37290c);}catch(_0xc62c3c){utils[_0xbf6f('0xf')](util['format'](_0xbf6f('0x1d'),_0x37290c[_0xbf6f('0x19')]),_0xc62c3c);}});ami['on']('agentcomplete',function(_0x144aa8){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')](_0xbf6f('0x1e'),_0x144aa8[_0xbf6f('0x19')]),_0x144aa8);agents[_0xbf6f('0x1f')](_0x144aa8);queues['agentcomplete'](_0x144aa8);members[_0xbf6f('0x1f')](_0x144aa8);}catch(_0x166d37){utils['error'](util['format'](_0xbf6f('0x1e'),_0x144aa8['uniqueid']),_0x166d37);}});ami['on'](_0xbf6f('0x20'),function(_0x1f17aa){try{utils['debug'](util['format'](_0xbf6f('0x21'),_0x1f17aa['uniqueid']),_0x1f17aa);agents[_0xbf6f('0x20')](_0x1f17aa);queues[_0xbf6f('0x20')](_0x1f17aa);}catch(_0x560e23){utils[_0xbf6f('0xf')](util[_0xbf6f('0x13')]('[%s][index][queuecallerabandon]',_0x1f17aa[_0xbf6f('0x19')]),_0x560e23);}});ami['on'](_0xbf6f('0x22'),function(_0x1f10a7){try{utils['debug'](util[_0xbf6f('0x13')](_0xbf6f('0x23'),_0x1f10a7[_0xbf6f('0x19')]),_0x1f10a7);queues[_0xbf6f('0x22')](_0x1f10a7);recordings['queuecallerjoin'](_0x1f10a7);}catch(_0x489e32){utils[_0xbf6f('0xf')](util['format']('[%s][index][queuecallerjoin]',_0x1f10a7[_0xbf6f('0x19')]),_0x489e32);}});ami['on'](_0xbf6f('0x24'),function(_0x201ab6){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')](_0xbf6f('0x25'),_0x201ab6['uniqueid']),_0x201ab6);queues['queuecallerleave'](_0x201ab6);}catch(_0x1758c6){utils[_0xbf6f('0xf')](util['format'](_0xbf6f('0x25'),_0x201ab6[_0xbf6f('0x19')]),_0x1758c6);}});ami['on'](_0xbf6f('0x26'),function(_0x1b4b0a){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')](_0xbf6f('0x27'),_0x1b4b0a[_0xbf6f('0x19')]),_0x1b4b0a);queues[_0xbf6f('0x26')](_0x1b4b0a);calls[_0xbf6f('0x26')](_0x1b4b0a);}catch(_0x231a3d){utils['error'](util['format'](_0xbf6f('0x27'),_0x1b4b0a['uniqueid']),_0x231a3d);}});ami['on']('musiconholdstop',function(_0x4eeb4d){try{utils['debug'](util[_0xbf6f('0x13')](_0xbf6f('0x28'),_0x4eeb4d[_0xbf6f('0x19')]),_0x4eeb4d);queues[_0xbf6f('0x29')](_0x4eeb4d);calls[_0xbf6f('0x29')](_0x4eeb4d);}catch(_0x4bd8fb){utils[_0xbf6f('0xf')](util[_0xbf6f('0x13')](_0xbf6f('0x28'),_0x4eeb4d[_0xbf6f('0x19')]),_0x4bd8fb);}});ami['on'](_0xbf6f('0x2a'),function(_0x9a35d3){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')](_0xbf6f('0x2b'),_0x9a35d3[_0xbf6f('0x19')]),_0x9a35d3);calls[_0xbf6f('0x2a')](_0x9a35d3);recordings[_0xbf6f('0x2a')](_0x9a35d3);}catch(_0x57cdcb){utils['error'](util[_0xbf6f('0x13')](_0xbf6f('0x2b'),_0x9a35d3[_0xbf6f('0x19')]),_0x57cdcb);}});ami['on'](_0xbf6f('0x2c'),function(_0x1bf7e3){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')](_0xbf6f('0x2d'),_0x1bf7e3['uniqueid']),_0x1bf7e3);calls[_0xbf6f('0x2c')](_0x1bf7e3);recordings[_0xbf6f('0x2c')](_0x1bf7e3);dials['hangup'](_0x1bf7e3);agents['hangup'](_0x1bf7e3);queues['hangup'](_0x1bf7e3);}catch(_0x2be6c2){utils[_0xbf6f('0xf')](util[_0xbf6f('0x13')](_0xbf6f('0x2d'),_0x1bf7e3[_0xbf6f('0x19')]),_0x2be6c2);}});ami['on'](_0xbf6f('0x2e'),function(_0x17aae3){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')]('[%s][index][cdr]',_0x17aae3[_0xbf6f('0x19')]),_0x17aae3);members[_0xbf6f('0x2e')](_0x17aae3);}catch(_0x57210d){utils['error'](util[_0xbf6f('0x13')](_0xbf6f('0x2f'),_0x17aae3['uniqueid']),_0x57210d);}});ami['on'](_0xbf6f('0x30'),function(_0x449d92){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')](_0xbf6f('0x31'),_0x449d92[_0xbf6f('0x19')]),_0x449d92);queues[_0xbf6f('0x30')](_0x449d92);agents[_0xbf6f('0x30')](_0x449d92);transfers['blindtransfer'](_0x449d92);}catch(_0x1b1ee7){utils[_0xbf6f('0xf')](util[_0xbf6f('0x13')](_0xbf6f('0x31'),_0x449d92[_0xbf6f('0x19')]),_0x1b1ee7);}});ami['on'](_0xbf6f('0x32'),function(_0x52a439){try{utils['debug'](util[_0xbf6f('0x13')](_0xbf6f('0x33'),_0x52a439[_0xbf6f('0x34')]),_0x52a439);queues['attendedtransfer'](_0x52a439);transfers[_0xbf6f('0x32')](_0x52a439);agents[_0xbf6f('0x32')](_0x52a439);calls['attendedtransfer'](_0x52a439);}catch(_0x524d1a){utils['error'](util[_0xbf6f('0x13')](_0xbf6f('0x33'),_0x52a439[_0xbf6f('0x34')]),_0x524d1a);}});ami['on'](_0xbf6f('0x35'),function(_0x1106b1){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')](_0xbf6f('0x36'),_0x1106b1[_0xbf6f('0x19')]),_0x1106b1);queues[_0xbf6f('0x35')](_0x1106b1);recordings[_0xbf6f('0x35')](_0x1106b1);calls[_0xbf6f('0x35')](_0x1106b1);dials['varset'](_0x1106b1);}catch(_0x295c0c){utils[_0xbf6f('0xf')](util[_0xbf6f('0x13')](_0xbf6f('0x36'),_0x1106b1[_0xbf6f('0x19')]),_0x295c0c);}});ami['on'](_0xbf6f('0x37'),function(_0x19470c){try{utils[_0xbf6f('0x17')](util['format']('[%s][index][newexten]',_0x19470c[_0xbf6f('0x19')]),_0x19470c);calls[_0xbf6f('0x37')](_0x19470c);recordings['newexten'](_0x19470c);dials[_0xbf6f('0x37')](_0x19470c);}catch(_0x3f2a7d){utils[_0xbf6f('0xf')](util['format'](_0xbf6f('0x38'),_0x19470c[_0xbf6f('0x19')]),_0x3f2a7d);}});ami['on'](_0xbf6f('0x39'),function(_0x265951){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')]('[%s][index][newchannel]',_0x265951[_0xbf6f('0x19')]),_0x265951);calls['newchannel'](_0x265951);recordings[_0xbf6f('0x39')](_0x265951);}catch(_0x6836f2){utils['error'](util['format'](_0xbf6f('0x3a'),_0x265951[_0xbf6f('0x19')]),_0x6836f2);}});ami['on'](_0xbf6f('0x3b'),function(_0x1bcc6b){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')](_0xbf6f('0x3c'),_0x1bcc6b['uniqueid']),_0x1bcc6b);dials[_0xbf6f('0x3b')](_0x1bcc6b);}catch(_0x45dc26){utils[_0xbf6f('0xf')](util[_0xbf6f('0x13')]('[%s]dialbegin',_0x1bcc6b[_0xbf6f('0x19')]),_0x45dc26);}});ami['on'](_0xbf6f('0x3d'),function(_0x49d640){try{utils[_0xbf6f('0x17')](util[_0xbf6f('0x13')](_0xbf6f('0x3e'),_0x49d640['uniqueid']),_0x49d640);dials[_0xbf6f('0x3d')](_0x49d640);}catch(_0x5f1f45){utils['error'](util[_0xbf6f('0x13')](_0xbf6f('0x3e'),_0x49d640[_0xbf6f('0x19')]),_0x5f1f45);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 1904d3f..9a91089 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 _0x9df9=['[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','info','state','INUSE','BUSY','voice','TALKING','NOT_INUSE','isNil','exitAt','now','duration','diffTime','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','channel','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','name','internal','CreateMemberReport','split','then','request','catch','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9df9,0xf1));var _0x99df=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x9df9[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require(_0x99df('0x0'));var utils=require('./utils');var members={};var exclude=[_0x99df('0x1'),_0x99df('0x2')];function writeDB(_0x52bf9e){utils['info'](util[_0x99df('0x3')](_0x99df('0x4'),_0x52bf9e[_0x99df('0x5')],_0x52bf9e[_0x99df('0x6')],_0x52bf9e['channel'],_0x52bf9e[_0x99df('0x7')],_0x52bf9e[_0x99df('0x8')],_0x52bf9e[_0x99df('0x9')]));if(_0x52bf9e[_0x99df('0x6')]){utils[_0x99df('0xa')](_0x52bf9e[_0x99df('0x6')])['then'](function(_0x2b9e6b){if(_0x2b9e6b){_0x52bf9e[_0x99df('0x8')]=_0x2b9e6b[_0x99df('0xb')];_0x52bf9e[_0x99df('0xc')]=_0x2b9e6b[_0x99df('0xc')];utils['request'](_0x99df('0xd'),_0x52bf9e);}else{utils['getUserByName'](_0x52bf9e[_0x99df('0x6')][_0x99df('0xe')]('/')[0x1])[_0x99df('0xf')](function(_0x2fa43b){if(_0x2fa43b){_0x52bf9e[_0x99df('0x8')]=_0x2fa43b[_0x99df('0xb')];_0x52bf9e['internal']=_0x2fa43b[_0x99df('0xc')];utils[_0x99df('0x10')]('CreateMemberReport',_0x52bf9e);}});}})[_0x99df('0x11')](function(_0x25572c){utils[_0x99df('0x12')](util['format'](_0x99df('0x13'),_0x52bf9e[_0x99df('0x5')]),_0x25572c);});}delete members[_0x52bf9e[_0x99df('0x6')]];}function startsWith(_0x1de805,_0xcec067){return _[_0x99df('0x14')](_0x1de805,function(_0x367af2){return _[_0x99df('0x15')](_0xcec067,_0x367af2);});}exports[_0x99df('0x16')]=function(_0x44ca19){try{utils[_0x99df('0x17')](util[_0x99df('0x3')]('[%s][members][devicestatechange]',members[_0x44ca19[_0x99df('0x18')]]?members[_0x44ca19[_0x99df('0x18')]][_0x99df('0x5')]:_0x44ca19[_0x99df('0x18')]),_0x44ca19);utils[_0x99df('0x19')](util[_0x99df('0x3')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x44ca19[_0x99df('0x18')]]?members[_0x44ca19[_0x99df('0x18')]][_0x99df('0x5')]:_0x44ca19[_0x99df('0x18')],_0x44ca19[_0x99df('0x1a')],_0x44ca19[_0x99df('0x18')]));switch(_0x44ca19['state']){case _0x99df('0x1b'):case _0x99df('0x1c'):if(!startsWith(exclude,_0x44ca19['device'])){members[_0x44ca19[_0x99df('0x18')]]={'channel':_0x99df('0x1d'),'interface':_0x44ca19[_0x99df('0x18')],'type':_0x99df('0x1e'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x99df('0x1f'):if(!_[_0x99df('0x20')](members[_0x44ca19[_0x99df('0x18')]])){members[_0x44ca19[_0x99df('0x18')]][_0x99df('0x21')]=utils[_0x99df('0x22')]();members[_0x44ca19[_0x99df('0x18')]][_0x99df('0x23')]=utils[_0x99df('0x24')](members[_0x44ca19['device']][_0x99df('0x21')],members[_0x44ca19[_0x99df('0x18')]]['enterAt']);if(members[_0x44ca19[_0x99df('0x18')]][_0x99df('0x5')]){writeDB(members[_0x44ca19['device']]);}}break;default:break;}}catch(_0x2f942e){utils[_0x99df('0x12')](util[_0x99df('0x3')](_0x99df('0x25'),members[_0x44ca19[_0x99df('0x18')]]?members[_0x44ca19['device']][_0x99df('0x5')]:_0x44ca19[_0x99df('0x18')]),_0x2f942e);}};exports[_0x99df('0x26')]=function(_0x3f9916){try{if(!_[_0x99df('0x20')](members[_0x3f9916['interface']])){utils['debug'](util[_0x99df('0x3')](_0x99df('0x27'),_0x3f9916['uniqueid']),_0x3f9916);utils['info'](util[_0x99df('0x3')](_0x99df('0x28'),_0x3f9916[_0x99df('0x5')],_0x3f9916[_0x99df('0x6')],_0x3f9916[_0x99df('0x29')]));members[_0x3f9916[_0x99df('0x6')]]=_[_0x99df('0x2a')](members[_0x3f9916[_0x99df('0x6')]],{'data4':_0x3f9916['queue'],'uniqueid':_0x3f9916['uniqueid']});}}catch(_0x152e81){utils[_0x99df('0x12')](util[_0x99df('0x3')](_0x99df('0x27'),_0x3f9916[_0x99df('0x5')]),_0x152e81);}};exports[_0x99df('0x2b')]=function(_0x16988e){try{utils[_0x99df('0x17')](util['format']('[%s][members][cdr]',_0x16988e['uniqueid']),_0x16988e);if(_0x16988e[_0x99df('0x2c')]){var _0x302782=_0x16988e[_0x99df('0x2c')][_0x99df('0xe')]('-')[0x0];if(!_[_0x99df('0x20')](members[_0x302782])){members[_0x302782]=_[_0x99df('0x2a')](members[_0x302782],{'data1':members[_0x302782][_0x99df('0x2d')]||_0x16988e[_0x99df('0x9')],'data2':members[_0x302782]['data2']||_0x16988e[_0x99df('0x2e')],'data3':members[_0x302782][_0x99df('0x2f')]||_0x16988e[_0x99df('0x30')],'uniqueid':members[_0x302782][_0x99df('0x5')]||_0x16988e[_0x99df('0x5')]});utils[_0x99df('0x19')](util[_0x99df('0x3')](_0x99df('0x31'),_0x16988e[_0x99df('0x5')],members[_0x302782]['data1'],members[_0x302782][_0x99df('0x7')],members[_0x302782][_0x99df('0x2f')]));if(members[_0x302782]['exitAt']){writeDB(members[_0x302782]);}}}if(_0x16988e[_0x99df('0x32')]){var _0x261913=_0x16988e[_0x99df('0x32')][_0x99df('0xe')]('-')[0x0];if(!_['isNil'](members[_0x261913])){members[_0x261913]=_[_0x99df('0x2a')](members[_0x261913],{'data1':members[_0x261913]['data1']||_0x16988e[_0x99df('0x9')],'data2':members[_0x261913][_0x99df('0x7')]||_0x16988e[_0x99df('0x2e')],'data3':members[_0x261913][_0x99df('0x2f')]||_0x16988e[_0x99df('0x30')],'uniqueid':members[_0x261913][_0x99df('0x5')]||_0x16988e[_0x99df('0x5')]});utils['info'](util[_0x99df('0x3')](_0x99df('0x31'),_0x16988e[_0x99df('0x5')],members[_0x261913][_0x99df('0x2d')],members[_0x261913][_0x99df('0x7')],members[_0x261913][_0x99df('0x2f')]));if(members[_0x261913][_0x99df('0x21')]){writeDB(members[_0x261913]);}}}}catch(_0x39fe83){utils[_0x99df('0x12')](util[_0x99df('0x3')](_0x99df('0x33'),_0x16988e[_0x99df('0x5')]),_0x39fe83);}}; \ No newline at end of file +var _0xf589=['now','agent','NOT_INUSE','isNil','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','exitAt','destinationchannel','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','INUSE','BUSY'];(function(_0x492811,_0x1a7464){var _0x786a07=function(_0x24cc28){while(--_0x24cc28){_0x492811['push'](_0x492811['shift']());}};_0x786a07(++_0x1a7464);}(_0xf589,0xfe));var _0x9f58=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf589[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9f58('0x0'));var members={};var exclude=[_0x9f58('0x1'),_0x9f58('0x2')];function writeDB(_0x191d3d){utils[_0x9f58('0x3')](util[_0x9f58('0x4')](_0x9f58('0x5'),_0x191d3d[_0x9f58('0x6')],_0x191d3d[_0x9f58('0x7')],_0x191d3d[_0x9f58('0x8')],_0x191d3d[_0x9f58('0x9')],_0x191d3d[_0x9f58('0xa')],_0x191d3d['type']));if(_0x191d3d[_0x9f58('0x7')]){utils[_0x9f58('0xb')](_0x191d3d[_0x9f58('0x7')])[_0x9f58('0xc')](function(_0x74f10e){if(_0x74f10e){_0x191d3d['membername']=_0x74f10e[_0x9f58('0xd')];_0x191d3d['internal']=_0x74f10e[_0x9f58('0xe')];utils[_0x9f58('0xf')]('CreateMemberReport',_0x191d3d);}else{utils[_0x9f58('0x10')](_0x191d3d[_0x9f58('0x7')][_0x9f58('0x11')]('/')[0x1])['then'](function(_0x30088f){if(_0x30088f){_0x191d3d[_0x9f58('0xa')]=_0x30088f['name'];_0x191d3d[_0x9f58('0xe')]=_0x30088f[_0x9f58('0xe')];utils['request'](_0x9f58('0x12'),_0x191d3d);}});}})['catch'](function(_0x558c25){utils[_0x9f58('0x13')](util['format']('[%s][members][writeDB]',_0x191d3d[_0x9f58('0x6')]),_0x558c25);});}delete members[_0x191d3d['interface']];}function startsWith(_0x162e2e,_0xce9321){return _[_0x9f58('0x14')](_0x162e2e,function(_0x290422){return _[_0x9f58('0x15')](_0xce9321,_0x290422);});}exports[_0x9f58('0x16')]=function(_0x5e43ba){try{utils[_0x9f58('0x17')](util[_0x9f58('0x4')](_0x9f58('0x18'),members[_0x5e43ba[_0x9f58('0x19')]]?members[_0x5e43ba[_0x9f58('0x19')]][_0x9f58('0x6')]:_0x5e43ba[_0x9f58('0x19')]),_0x5e43ba);utils[_0x9f58('0x3')](util[_0x9f58('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x5e43ba[_0x9f58('0x19')]]?members[_0x5e43ba['device']][_0x9f58('0x6')]:_0x5e43ba[_0x9f58('0x19')],_0x5e43ba['state'],_0x5e43ba[_0x9f58('0x19')]));switch(_0x5e43ba['state']){case _0x9f58('0x1a'):case _0x9f58('0x1b'):if(!startsWith(exclude,_0x5e43ba[_0x9f58('0x19')])){members[_0x5e43ba['device']]={'channel':'voice','interface':_0x5e43ba['device'],'type':'TALKING','enterAt':utils[_0x9f58('0x1c')](),'role':_0x9f58('0x1d')};}break;case _0x9f58('0x1e'):if(!_[_0x9f58('0x1f')](members[_0x5e43ba[_0x9f58('0x19')]])){members[_0x5e43ba[_0x9f58('0x19')]]['exitAt']=utils[_0x9f58('0x1c')]();members[_0x5e43ba[_0x9f58('0x19')]][_0x9f58('0x20')]=utils[_0x9f58('0x21')](members[_0x5e43ba[_0x9f58('0x19')]]['exitAt'],members[_0x5e43ba[_0x9f58('0x19')]][_0x9f58('0x22')]);if(members[_0x5e43ba[_0x9f58('0x19')]]['uniqueid']){writeDB(members[_0x5e43ba['device']]);}}break;default:break;}}catch(_0x2d464d){utils[_0x9f58('0x13')](util[_0x9f58('0x4')](_0x9f58('0x18'),members[_0x5e43ba[_0x9f58('0x19')]]?members[_0x5e43ba[_0x9f58('0x19')]][_0x9f58('0x6')]:_0x5e43ba[_0x9f58('0x19')]),_0x2d464d);}};exports[_0x9f58('0x23')]=function(_0x4cb9a1){try{if(!_[_0x9f58('0x1f')](members[_0x4cb9a1[_0x9f58('0x7')]])){utils[_0x9f58('0x17')](util[_0x9f58('0x4')]('[%s][members][agentcomplete]',_0x4cb9a1[_0x9f58('0x6')]),_0x4cb9a1);utils['info'](util[_0x9f58('0x4')](_0x9f58('0x24'),_0x4cb9a1[_0x9f58('0x6')],_0x4cb9a1[_0x9f58('0x7')],_0x4cb9a1[_0x9f58('0x25')]));members[_0x4cb9a1[_0x9f58('0x7')]]=_[_0x9f58('0x26')](members[_0x4cb9a1[_0x9f58('0x7')]],{'data4':_0x4cb9a1[_0x9f58('0x25')],'uniqueid':_0x4cb9a1['uniqueid']});}}catch(_0x5f1ca4){utils[_0x9f58('0x13')](util[_0x9f58('0x4')]('[%s][members][agentcomplete]',_0x4cb9a1[_0x9f58('0x6')]),_0x5f1ca4);}};exports[_0x9f58('0x27')]=function(_0x1fdff3){try{utils[_0x9f58('0x17')](util[_0x9f58('0x4')]('[%s][members][cdr]',_0x1fdff3['uniqueid']),_0x1fdff3);if(_0x1fdff3[_0x9f58('0x8')]){var _0x528a12=_0x1fdff3[_0x9f58('0x8')]['split']('-')[0x0];if(!_[_0x9f58('0x1f')](members[_0x528a12])){members[_0x528a12]=_['assign'](members[_0x528a12],{'data1':members[_0x528a12]['data1']||_0x1fdff3['type'],'data2':members[_0x528a12][_0x9f58('0x9')]||_0x1fdff3[_0x9f58('0x28')],'data3':members[_0x528a12][_0x9f58('0x29')]||_0x1fdff3[_0x9f58('0x2a')],'uniqueid':members[_0x528a12][_0x9f58('0x6')]||_0x1fdff3['uniqueid']});utils[_0x9f58('0x3')](util['format'](_0x9f58('0x2b'),_0x1fdff3[_0x9f58('0x6')],members[_0x528a12][_0x9f58('0x2c')],members[_0x528a12][_0x9f58('0x9')],members[_0x528a12][_0x9f58('0x29')]));if(members[_0x528a12][_0x9f58('0x2d')]){writeDB(members[_0x528a12]);}}}if(_0x1fdff3[_0x9f58('0x2e')]){var _0x1edc96=_0x1fdff3[_0x9f58('0x2e')][_0x9f58('0x11')]('-')[0x0];if(!_[_0x9f58('0x1f')](members[_0x1edc96])){members[_0x1edc96]=_['assign'](members[_0x1edc96],{'data1':members[_0x1edc96][_0x9f58('0x2c')]||_0x1fdff3['type'],'data2':members[_0x1edc96][_0x9f58('0x9')]||_0x1fdff3[_0x9f58('0x28')],'data3':members[_0x1edc96][_0x9f58('0x29')]||_0x1fdff3[_0x9f58('0x2a')],'uniqueid':members[_0x1edc96][_0x9f58('0x6')]||_0x1fdff3[_0x9f58('0x6')]});utils[_0x9f58('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1fdff3[_0x9f58('0x6')],members[_0x1edc96][_0x9f58('0x2c')],members[_0x1edc96][_0x9f58('0x9')],members[_0x1edc96][_0x9f58('0x29')]));if(members[_0x1edc96]['exitAt']){writeDB(members[_0x1edc96]);}}}}catch(_0x1edbfe){utils['error'](util[_0x9f58('0x4')]('[%s][members][cdr]',_0x1fdff3[_0x9f58('0x6')]),_0x1edbfe);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7568626..d440dad 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 _0x6a95=['EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','hangup','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','[%s][queues][varset]','isNil','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queueposition','queuecallerexitAt'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6a95,0x1db));var _0x56a9=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x6a95[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var utils=require(_0x56a9('0x2'));var queues={};function writeDB(_0xce37aa){utils[_0x56a9('0x3')](util[_0x56a9('0x4')](_0x56a9('0x5'),_0xce37aa['uniqueid'],_0xce37aa['channel'],_0xce37aa[_0x56a9('0x6')],_0xce37aa[_0x56a9('0x7')],_0xce37aa[_0x56a9('0x8')],_0xce37aa[_0x56a9('0x9')],_0xce37aa[_0x56a9('0xa')]));if(_0xce37aa[_0x56a9('0x6')]){utils[_0x56a9('0xb')](_0xce37aa['queue'])['then'](function(_0x3ac626){if(_0x3ac626){_0xce37aa[_0x56a9('0xc')]=_0x3ac626['type'];}utils[_0x56a9('0xd')](_0x56a9('0xe'),_0xce37aa);});}else{utils[_0x56a9('0xd')](_0x56a9('0xe'),_0xce37aa);}if(_0xce37aa[_0x56a9('0xf')]){delete queues[_0xce37aa[_0x56a9('0xf')]];}else{delete queues[_0xce37aa[_0x56a9('0x10')]];}}exports[_0x56a9('0x11')]=function(_0x9ab10c){try{utils['debug'](util[_0x56a9('0x4')]('[%s][queues][queuecallerjoin]',_0x9ab10c[_0x56a9('0x10')]),_0x9ab10c);utils[_0x56a9('0x3')](util[_0x56a9('0x4')](_0x56a9('0x12'),_0x9ab10c[_0x56a9('0x10')],_0x9ab10c[_0x56a9('0x6')],_0x9ab10c[_0x56a9('0x13')]));queues[_0x9ab10c[_0x56a9('0x10')]]=_[_0x56a9('0x14')](_0x9ab10c,{'originalposition':_0x9ab10c['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x2e0dfd){utils[_0x56a9('0x15')](util[_0x56a9('0x4')](_0x56a9('0x16'),_0x9ab10c['uniqueid']),_0x2e0dfd);}};exports[_0x56a9('0x17')]=function(_0x4853a3){try{if(!_['isNil'](queues[_0x4853a3['uniqueid']])){utils[_0x56a9('0x18')](util[_0x56a9('0x4')](_0x56a9('0x19'),_0x4853a3[_0x56a9('0x10')]),_0x4853a3);if(queues[_0x4853a3[_0x56a9('0x10')]][_0x56a9('0x1a')]){if(!queues[_0x4853a3[_0x56a9('0x10')]][_0x56a9('0x1b')]&&!queues[_0x4853a3[_0x56a9('0x10')]][_0x56a9('0x1c')]){queues[_0x4853a3[_0x56a9('0x10')]][_0x56a9('0x1d')]=!![];queues[_0x4853a3['uniqueid']]['queuecallercompleteAt']=utils[_0x56a9('0x1e')]();queues[_0x4853a3[_0x56a9('0x10')]][_0x56a9('0xa')]=_0x56a9('0x1f');}utils['info'](util[_0x56a9('0x4')](_0x56a9('0x20'),_0x4853a3[_0x56a9('0x10')],queues[_0x4853a3[_0x56a9('0x10')]]['name'],queues[_0x4853a3[_0x56a9('0x10')]][_0x56a9('0xa')]));writeDB(queues[_0x4853a3[_0x56a9('0x10')]]);}else if(queues[_0x4853a3[_0x56a9('0x10')]][_0x56a9('0xf')]){utils['info'](util[_0x56a9('0x4')](_0x56a9('0x21'),_0x4853a3[_0x56a9('0x10')],queues[_0x4853a3['uniqueid']][_0x56a9('0x22')],queues[_0x4853a3['uniqueid']][_0x56a9('0xf')]));queues[queues[_0x4853a3[_0x56a9('0x10')]][_0x56a9('0xf')]]=queues[_0x4853a3[_0x56a9('0x10')]];queues[queues[_0x4853a3[_0x56a9('0x10')]][_0x56a9('0xf')]][_0x56a9('0x23')]=0x2;delete queues[_0x4853a3[_0x56a9('0x10')]];}}}catch(_0x51fd64){utils[_0x56a9('0x15')](util[_0x56a9('0x4')]('[%s][queues][hangup]',_0x4853a3[_0x56a9('0x10')]),_0x51fd64);}};exports['varset']=function(_0x54a343){try{utils[_0x56a9('0x18')](util['format'](_0x56a9('0x24'),_0x54a343[_0x56a9('0x10')]),_0x54a343);if(!_[_0x56a9('0x25')](_0x54a343[_0x56a9('0x26')]['queuestatus'])&&_0x54a343[_0x56a9('0x27')][_0x56a9('0x28')]()!==_0x56a9('0x29')){if(!_[_0x56a9('0x25')](queues[_0x54a343[_0x56a9('0x10')]])){queues[_0x54a343[_0x56a9('0x10')]][_0x56a9('0x1b')]=![];queues[_0x54a343[_0x56a9('0x10')]][_0x56a9('0x2a')]=null;queues[_0x54a343[_0x56a9('0x10')]][_0x56a9('0x1c')]=!![];queues[_0x54a343[_0x56a9('0x10')]]['queuecallerexitAt']=utils[_0x56a9('0x1e')]();queues[_0x54a343[_0x56a9('0x10')]][_0x56a9('0xa')]=_0x54a343['value'][_0x56a9('0x28')]();utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x54a343[_0x56a9('0x10')],queues[_0x54a343[_0x56a9('0x10')]]['name'],_0x54a343['value'],queues[_0x54a343[_0x56a9('0x10')]][_0x56a9('0xa')]));writeDB(queues[_0x54a343[_0x56a9('0x10')]]);}}else if(!_[_0x56a9('0x25')](_0x54a343[_0x56a9('0x26')][_0x56a9('0x2b')])){if(!_[_0x56a9('0x25')](queues[_0x54a343[_0x56a9('0x10')]])&&!queues[_0x54a343[_0x56a9('0x10')]][_0x56a9('0x1b')]){queues[_0x54a343['uniqueid']]['queuecallerabandon']=![];queues[_0x54a343['uniqueid']]['queuecallerabandonAt']=null;queues[_0x54a343[_0x56a9('0x10')]][_0x56a9('0x1c')]=!![];queues[_0x54a343['uniqueid']][_0x56a9('0x2c')]=utils[_0x56a9('0x1e')]();queues[_0x54a343[_0x56a9('0x10')]][_0x56a9('0xa')]=_0x56a9('0x2d');utils[_0x56a9('0x3')](util[_0x56a9('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x54a343[_0x56a9('0x10')],queues[_0x54a343[_0x56a9('0x10')]]['name'],_0x54a343['value'],queues[_0x54a343[_0x56a9('0x10')]][_0x56a9('0xa')]));}}}catch(_0x1534d7){utils[_0x56a9('0x15')](util[_0x56a9('0x4')](_0x56a9('0x24'),_0x54a343[_0x56a9('0x10')]),_0x1534d7);}};exports[_0x56a9('0x1b')]=function(_0x21bdbb){try{if(!_[_0x56a9('0x25')](queues[_0x21bdbb[_0x56a9('0x10')]])){utils[_0x56a9('0x18')](util[_0x56a9('0x4')](_0x56a9('0x2e'),_0x21bdbb[_0x56a9('0x10')]),_0x21bdbb);queues[_0x21bdbb[_0x56a9('0x10')]][_0x56a9('0x1c')]=![];queues[_0x21bdbb[_0x56a9('0x10')]]['queuecallerexitAt']=null;queues[_0x21bdbb[_0x56a9('0x10')]][_0x56a9('0x1b')]=!![];queues[_0x21bdbb[_0x56a9('0x10')]]['queuecallerabandonAt']=utils[_0x56a9('0x1e')]();queues[_0x21bdbb['uniqueid']][_0x56a9('0xa')]='ABANDONED';utils[_0x56a9('0x3')](util[_0x56a9('0x4')](_0x56a9('0x2f'),_0x21bdbb[_0x56a9('0x10')],queues[_0x21bdbb['uniqueid']]['name'],queues[_0x21bdbb['uniqueid']][_0x56a9('0xa')]));}}catch(_0x1dc6e9){utils[_0x56a9('0x15')](util[_0x56a9('0x4')](_0x56a9('0x2e'),_0x21bdbb[_0x56a9('0x10')]),_0x1dc6e9);}};exports[_0x56a9('0x30')]=function(_0x5bf15){try{if(!_[_0x56a9('0x25')](queues[_0x5bf15[_0x56a9('0x10')]])){utils[_0x56a9('0x18')](util[_0x56a9('0x4')](_0x56a9('0x31'),_0x5bf15[_0x56a9('0x10')]),_0x5bf15);utils['info'](util[_0x56a9('0x4')](_0x56a9('0x32'),_0x5bf15[_0x56a9('0x10')],queues[_0x5bf15['uniqueid']][_0x56a9('0x22')],_0x5bf15[_0x56a9('0x33')],_0x5bf15['connectedlinename']));queues[_0x5bf15[_0x56a9('0x10')]][_0x56a9('0x30')]=!![];queues[_0x5bf15[_0x56a9('0x10')]][_0x56a9('0x1a')]=utils['now']();queues[_0x5bf15[_0x56a9('0x10')]][_0x56a9('0x34')]=utils[_0x56a9('0x35')](queues[_0x5bf15[_0x56a9('0x10')]][_0x56a9('0x1a')],queues[_0x5bf15[_0x56a9('0x10')]][_0x56a9('0x36')]);queues[_0x5bf15[_0x56a9('0x10')]][_0x56a9('0x13')]=_0x5bf15[_0x56a9('0x13')];queues[_0x5bf15[_0x56a9('0x10')]]['count']=_0x5bf15['count'];queues[_0x5bf15[_0x56a9('0x10')]][_0x56a9('0x33')]=_0x5bf15[_0x56a9('0x33')];queues[_0x5bf15[_0x56a9('0x10')]]['connectedlinename']=_0x5bf15[_0x56a9('0x37')];}}catch(_0x942bee){utils[_0x56a9('0x15')](util[_0x56a9('0x4')]('[%s][queues][queuecallerleave]',_0x5bf15[_0x56a9('0x10')]),_0x942bee);}};exports[_0x56a9('0x38')]=function(_0x52dc06){try{if(!_[_0x56a9('0x25')](queues[_0x52dc06[_0x56a9('0x10')]])){utils['debug'](util[_0x56a9('0x4')](_0x56a9('0x39'),_0x52dc06[_0x56a9('0x10')]),_0x52dc06);utils[_0x56a9('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x52dc06[_0x56a9('0x10')],queues[_0x52dc06[_0x56a9('0x10')]][_0x56a9('0x22')],_0x52dc06[_0x56a9('0x3a')],_0x52dc06[_0x56a9('0x3b')]));queues[_0x52dc06[_0x56a9('0x10')]][_0x56a9('0x1b')]=![];queues[_0x52dc06[_0x56a9('0x10')]][_0x56a9('0x1b')]=![];queues[_0x52dc06[_0x56a9('0x10')]]['queuecallerabandonAt']=null;queues[_0x52dc06[_0x56a9('0x10')]][_0x56a9('0x1c')]=![];queues[_0x52dc06[_0x56a9('0x10')]][_0x56a9('0xa')]=null;queues[_0x52dc06[_0x56a9('0x10')]][_0x56a9('0x2c')]=null;queues[_0x52dc06[_0x56a9('0x10')]]['assigned']=!![];queues[_0x52dc06[_0x56a9('0x10')]][_0x56a9('0x9')]=_0x52dc06[_0x56a9('0x3b')];queues[_0x52dc06[_0x56a9('0x10')]][_0x56a9('0x7')]=_0x52dc06[_0x56a9('0x3a')];}}catch(_0x986480){utils['error'](util[_0x56a9('0x4')]('[%s][queues][agentconnect]',_0x52dc06['uniqueid']),_0x986480);}};exports[_0x56a9('0x3c')]=function(_0x5eba1f){try{if(!_[_0x56a9('0x25')](queues[_0x5eba1f[_0x56a9('0x10')]])){if(queues[_0x5eba1f[_0x56a9('0x10')]][_0x56a9('0x1a')]){utils[_0x56a9('0x18')](util[_0x56a9('0x4')](_0x56a9('0x3d'),_0x5eba1f[_0x56a9('0x10')]),_0x5eba1f);queues[_0x5eba1f[_0x56a9('0x10')]]['queuecallerabandon']=![];queues[_0x5eba1f[_0x56a9('0x10')]][_0x56a9('0x1b')]=![];queues[_0x5eba1f[_0x56a9('0x10')]][_0x56a9('0x2a')]=null;queues[_0x5eba1f[_0x56a9('0x10')]][_0x56a9('0x1c')]=![];queues[_0x5eba1f[_0x56a9('0x10')]][_0x56a9('0x2c')]=null;queues[_0x5eba1f[_0x56a9('0x10')]][_0x56a9('0x3e')]=!![];queues[_0x5eba1f['uniqueid']][_0x56a9('0x7')]=_0x5eba1f[_0x56a9('0x3a')];queues[_0x5eba1f[_0x56a9('0x10')]]['queuecallercomplete']=!![];queues[_0x5eba1f[_0x56a9('0x10')]][_0x56a9('0x3f')]=utils[_0x56a9('0x1e')]();if(_0x5eba1f['reason']=='transfer'){if(!queues[_0x5eba1f[_0x56a9('0x10')]][_0x56a9('0x40')]){queues[_0x5eba1f[_0x56a9('0x10')]][_0x56a9('0xa')]=_0x56a9('0x41');}}else{queues[_0x5eba1f['uniqueid']][_0x56a9('0xa')]='COMPLETEDBY'+_0x5eba1f[_0x56a9('0x42')][_0x56a9('0x28')]();}utils[_0x56a9('0x3')](util[_0x56a9('0x4')](_0x56a9('0x43'),_0x5eba1f['uniqueid'],queues[_0x5eba1f['uniqueid']]['name'],_0x5eba1f[_0x56a9('0x3a')],queues[_0x5eba1f[_0x56a9('0x10')]][_0x56a9('0xa')]));writeDB(queues[_0x5eba1f['uniqueid']]);}}}catch(_0x2313c4){utils['error'](util[_0x56a9('0x4')](_0x56a9('0x3d'),_0x5eba1f[_0x56a9('0x10')]),_0x2313c4);}};exports['blindtransfer']=function(_0x4a67c1){try{if(!_[_0x56a9('0x25')](queues[_0x4a67c1[_0x56a9('0x44')]])){utils[_0x56a9('0x18')](util[_0x56a9('0x4')](_0x56a9('0x45'),_0x4a67c1[_0x56a9('0x10')]),_0x4a67c1);queues[_0x4a67c1['transfereeuniqueid']][_0x56a9('0x40')]=!![];queues[_0x4a67c1[_0x56a9('0x44')]][_0x56a9('0x46')]='BLIND';queues[_0x4a67c1['transfereeuniqueid']]['transferexten']=_0x4a67c1['extension'];queues[_0x4a67c1[_0x56a9('0x44')]][_0x56a9('0x47')]=_0x4a67c1['transfereeuniqueid'];queues[_0x4a67c1[_0x56a9('0x44')]][_0x56a9('0xa')]=_0x56a9('0x48');utils[_0x56a9('0x3')](util['format'](_0x56a9('0x49'),_0x4a67c1[_0x56a9('0x10')],queues[_0x4a67c1[_0x56a9('0x44')]][_0x56a9('0x22')],_0x4a67c1[_0x56a9('0x44')],_0x4a67c1[_0x56a9('0x4a')]));}}catch(_0x36b901){utils[_0x56a9('0x15')](util[_0x56a9('0x4')](_0x56a9('0x45'),_0x4a67c1[_0x56a9('0x10')]),_0x36b901);}};exports[_0x56a9('0x4b')]=function(_0x409466){try{utils[_0x56a9('0x18')](util[_0x56a9('0x4')](_0x56a9('0x4c'),_0x409466['origtransfereruniqueid']),_0x409466);if(_0x409466[_0x56a9('0x4d')]==_0x409466['origtransfererlinkedid']){if(!_[_0x56a9('0x25')](queues[_0x409466[_0x56a9('0x4e')]])){utils[_0x56a9('0x3')](util['format'](_0x56a9('0x4f'),_0x409466['origtransfereruniqueid'],queues[_0x409466['secondtransfererlinkedid']][_0x56a9('0x22')],_0x409466[_0x56a9('0x50')]));queues[_0x409466[_0x56a9('0x4e')]][_0x56a9('0x40')]=!![];queues[_0x409466['secondtransfererlinkedid']][_0x56a9('0x46')]=_0x56a9('0x51');queues[_0x409466[_0x56a9('0x4e')]][_0x56a9('0x52')]=_0x409466['origtransfererexten'];queues[_0x409466['secondtransfererlinkedid']]['transferuniqueid']=_0x409466[_0x56a9('0x4d')];queues[_0x409466[_0x56a9('0x4e')]][_0x56a9('0xa')]=_0x56a9('0x53');}if(!_[_0x56a9('0x25')](queues[_0x409466[_0x56a9('0x54')]])){if(_0x409466[_0x56a9('0x55')]&&queues[_0x409466[_0x56a9('0x55')]]){queues[_0x409466['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x409466['transfereeuniqueid']]=_[_0x56a9('0x56')](queues[_0x409466['transfereelinkedid']]);queues[_0x409466['transfereeuniqueid']]['transfereduniqueid']=_0x409466['transfertargetuniqueid'];queues[_0x409466[_0x56a9('0x44')]][_0x56a9('0x23')]=0x2;queues[_0x409466[_0x56a9('0x44')]][_0x56a9('0x8')]=queues[_0x409466['secondtransfererlinkedid']][_0x56a9('0x8')];queues[_0x409466[_0x56a9('0x44')]][_0x56a9('0x57')]=queues[_0x409466[_0x56a9('0x4e')]][_0x56a9('0x57')];queues[_0x409466[_0x56a9('0x44')]][_0x56a9('0x36')]=utils[_0x56a9('0x1e')]();queues[_0x409466[_0x56a9('0x44')]][_0x56a9('0x1a')]=utils[_0x56a9('0x1e')]();queues[_0x409466[_0x56a9('0x44')]][_0x56a9('0x34')]=0x0;queues[_0x409466['transfereeuniqueid']]['mohtime']=0x0;utils['info'](util['format'](_0x56a9('0x58'),_0x409466[_0x56a9('0x4d')],queues[_0x409466['transfereeuniqueid']][_0x56a9('0x22')],queues[_0x409466[_0x56a9('0x44')]][_0x56a9('0x8')],queues[_0x409466[_0x56a9('0x44')]][_0x56a9('0x57')]));}else{utils[_0x56a9('0x3')](util['format'](_0x56a9('0x59'),_0x409466['origtransfereruniqueid'],queues[_0x409466[_0x56a9('0x54')]][_0x56a9('0x22')],_0x409466[_0x56a9('0x4e')]));queues[_0x409466['origtransfererlinkedid']][_0x56a9('0xf')]=_0x409466[_0x56a9('0x4e')];}}}else if(_0x409466[_0x56a9('0x5a')]==_0x409466[_0x56a9('0x4e')]){if(!_[_0x56a9('0x25')](queues[_0x409466[_0x56a9('0x54')]])){utils['info'](util[_0x56a9('0x4')](_0x56a9('0x5b'),_0x409466[_0x56a9('0x4d')],queues[_0x409466[_0x56a9('0x54')]][_0x56a9('0x22')],_0x409466['secondtransfereruniqueid'],_0x409466[_0x56a9('0x5c')]));queues[_0x409466[_0x56a9('0x54')]][_0x56a9('0x40')]=!![];queues[_0x409466[_0x56a9('0x54')]][_0x56a9('0x46')]='ATTENDED';queues[_0x409466[_0x56a9('0x54')]][_0x56a9('0x52')]=_0x409466['secondtransfererexten'];queues[_0x409466[_0x56a9('0x54')]][_0x56a9('0x47')]=_0x409466[_0x56a9('0x5a')];queues[_0x409466['origtransfererlinkedid']][_0x56a9('0xa')]=_0x56a9('0x53');}if(!_[_0x56a9('0x25')](queues[_0x409466[_0x56a9('0x4e')]])){if(_0x409466[_0x56a9('0x5d')]&&queues[_0x409466[_0x56a9('0x5d')]]){queues[_0x409466[_0x56a9('0x5d')]][_0x56a9('0x23')]=0x1;queues[_0x409466[_0x56a9('0x5e')]]=_[_0x56a9('0x56')](queues[_0x409466['transfertargetlinkedid']]);queues[_0x409466[_0x56a9('0x5e')]][_0x56a9('0xf')]=_0x409466[_0x56a9('0x5e')];queues[_0x409466[_0x56a9('0x5e')]][_0x56a9('0x23')]=0x2;queues[_0x409466[_0x56a9('0x5e')]][_0x56a9('0x8')]=queues[_0x409466['origtransfererlinkedid']][_0x56a9('0x8')];queues[_0x409466['transfertargetuniqueid']][_0x56a9('0x57')]=queues[_0x409466[_0x56a9('0x54')]][_0x56a9('0x57')];queues[_0x409466[_0x56a9('0x5e')]][_0x56a9('0x36')]=utils['now']();queues[_0x409466[_0x56a9('0x5e')]]['queuecallerleaveAt']=utils[_0x56a9('0x1e')]();queues[_0x409466[_0x56a9('0x5e')]][_0x56a9('0x34')]=0x0;queues[_0x409466[_0x56a9('0x5e')]][_0x56a9('0x5f')]=0x0;utils[_0x56a9('0x3')](util[_0x56a9('0x4')](_0x56a9('0x60'),_0x409466[_0x56a9('0x4d')],queues[_0x409466[_0x56a9('0x5e')]]['name'],queues[_0x409466[_0x56a9('0x5e')]]['transfereduniqueid'],queues[_0x409466['transfertargetuniqueid']][_0x56a9('0x8')],queues[_0x409466[_0x56a9('0x5e')]]['calleridname']));}else{utils[_0x56a9('0x3')](util[_0x56a9('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x409466[_0x56a9('0x4d')],queues[_0x409466['secondtransfererlinkedid']][_0x56a9('0x22')],_0x409466[_0x56a9('0x54')]));queues[_0x409466['secondtransfererlinkedid']][_0x56a9('0xf')]=_0x409466['origtransfererlinkedid'];}}}}catch(_0x35eeec){utils['error'](util[_0x56a9('0x4')](_0x56a9('0x4c'),_0x409466[_0x56a9('0x4d')]),_0x35eeec);}};exports[_0x56a9('0x61')]=function(_0x41d0aa){try{if(!_['isNil'](queues[_0x41d0aa[_0x56a9('0x10')]])){utils[_0x56a9('0x18')](util[_0x56a9('0x4')](_0x56a9('0x62'),_0x41d0aa[_0x56a9('0x10')]),_0x41d0aa);queues[_0x41d0aa['uniqueid']][_0x56a9('0x63')]=utils[_0x56a9('0x1e')]();utils[_0x56a9('0x3')](util['format'](_0x56a9('0x64'),_0x41d0aa[_0x56a9('0x10')],queues[_0x41d0aa[_0x56a9('0x10')]][_0x56a9('0x22')],queues[_0x41d0aa['uniqueid']]['musiconholdstartAt']));}}catch(_0x408f08){utils[_0x56a9('0x15')](util[_0x56a9('0x4')](_0x56a9('0x62'),_0x41d0aa[_0x56a9('0x10')]),_0x408f08);}};exports[_0x56a9('0x65')]=function(_0x400b85){try{if(!_[_0x56a9('0x25')](queues[_0x400b85[_0x56a9('0x10')]])){if(!_['isNil'](queues[_0x400b85[_0x56a9('0x10')]]['musiconholdstartAt'])){utils[_0x56a9('0x18')](util[_0x56a9('0x4')](_0x56a9('0x66'),_0x400b85[_0x56a9('0x10')]),_0x400b85);queues[_0x400b85[_0x56a9('0x10')]]['mohtime']+=utils[_0x56a9('0x35')](utils[_0x56a9('0x1e')](),queues[_0x400b85[_0x56a9('0x10')]][_0x56a9('0x63')]);utils[_0x56a9('0x3')](util[_0x56a9('0x4')](_0x56a9('0x67'),_0x400b85['uniqueid'],queues[_0x400b85[_0x56a9('0x10')]][_0x56a9('0x22')],queues[_0x400b85[_0x56a9('0x10')]][_0x56a9('0x5f')]));delete queues[_0x400b85[_0x56a9('0x10')]][_0x56a9('0x63')];}}}catch(_0x4f6601){utils[_0x56a9('0x15')](util['format'](_0x56a9('0x66'),_0x400b85[_0x56a9('0x10')]),_0x4f6601);}}; \ No newline at end of file +var _0xb7de=['then','type','CreateVoiceQueueReport','request','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%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','connectedlinename','diffTime','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transferexten','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue'];(function(_0x1ca3b9,_0x5f006d){var _0x3f1872=function(_0x4ccb9a){while(--_0x4ccb9a){_0x1ca3b9['push'](_0x1ca3b9['shift']());}};_0x3f1872(++_0x5f006d);}(_0xb7de,0xc7));var _0xeb7d=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xb7de[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var utils=require(_0xeb7d('0x2'));var queues={};function writeDB(_0x55dc83){utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x5'),_0x55dc83[_0xeb7d('0x6')],_0x55dc83[_0xeb7d('0x7')],_0x55dc83['queue'],_0x55dc83[_0xeb7d('0x8')],_0x55dc83[_0xeb7d('0x9')],_0x55dc83[_0xeb7d('0xa')],_0x55dc83[_0xeb7d('0xb')]));if(_0x55dc83[_0xeb7d('0xc')]){utils['getVoiceQueueByName'](_0x55dc83['queue'])[_0xeb7d('0xd')](function(_0x13d376){if(_0x13d376){_0x55dc83[_0xeb7d('0xe')]=_0x13d376[_0xeb7d('0xe')];}utils['request'](_0xeb7d('0xf'),_0x55dc83);});}else{utils[_0xeb7d('0x10')](_0xeb7d('0xf'),_0x55dc83);}if(_0x55dc83['transfereduniqueid']){delete queues[_0x55dc83['transfereduniqueid']];}else{delete queues[_0x55dc83[_0xeb7d('0x6')]];}}exports['queuecallerjoin']=function(_0x1aa13a){try{utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x12'),_0x1aa13a[_0xeb7d('0x6')]),_0x1aa13a);utils[_0xeb7d('0x3')](util['format'](_0xeb7d('0x13'),_0x1aa13a[_0xeb7d('0x6')],_0x1aa13a[_0xeb7d('0xc')],_0x1aa13a[_0xeb7d('0x14')]));queues[_0x1aa13a[_0xeb7d('0x6')]]=_['assign'](_0x1aa13a,{'originalposition':_0x1aa13a[_0xeb7d('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x284575){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')]('[%s][queues][queuecallerjoin]',_0x1aa13a['uniqueid']),_0x284575);}};exports[_0xeb7d('0x16')]=function(_0xfcbbce){try{if(!_['isNil'](queues[_0xfcbbce['uniqueid']])){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')]('[%s][queues][hangup]',_0xfcbbce[_0xeb7d('0x6')]),_0xfcbbce);if(queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x17')]){if(!queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x18')]&&!queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x19')]){queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1a')]=!![];queues[_0xfcbbce['uniqueid']][_0xeb7d('0x1b')]=utils['now']();queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0xb')]=_0xeb7d('0x1c');}utils['info'](util[_0xeb7d('0x4')](_0xeb7d('0x1d'),_0xfcbbce['uniqueid'],queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1e')],queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0xb')]));writeDB(queues[_0xfcbbce[_0xeb7d('0x6')]]);}else if(queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1f')]){utils['info'](util[_0xeb7d('0x4')](_0xeb7d('0x20'),_0xfcbbce[_0xeb7d('0x6')],queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1e')],queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1f')]));queues[queues[_0xfcbbce['uniqueid']][_0xeb7d('0x1f')]]=queues[_0xfcbbce[_0xeb7d('0x6')]];queues[queues[_0xfcbbce[_0xeb7d('0x6')]][_0xeb7d('0x1f')]][_0xeb7d('0x21')]=0x2;delete queues[_0xfcbbce[_0xeb7d('0x6')]];}}}catch(_0x58ba4f){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')]('[%s][queues][hangup]',_0xfcbbce[_0xeb7d('0x6')]),_0x58ba4f);}};exports[_0xeb7d('0x22')]=function(_0x9abd4b){try{utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x23'),_0x9abd4b[_0xeb7d('0x6')]),_0x9abd4b);if(!_[_0xeb7d('0x24')](_0x9abd4b[_0xeb7d('0x25')][_0xeb7d('0x26')])&&_0x9abd4b[_0xeb7d('0x27')][_0xeb7d('0x28')]()!==_0xeb7d('0x29')){if(!_[_0xeb7d('0x24')](queues[_0x9abd4b[_0xeb7d('0x6')]])){queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x18')]=![];queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x2a')]=null;queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x19')]=!![];queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x2b')]=utils[_0xeb7d('0x2c')]();queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0xb')]=_0x9abd4b[_0xeb7d('0x27')][_0xeb7d('0x28')]();utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x2d'),_0x9abd4b['uniqueid'],queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x1e')],_0x9abd4b[_0xeb7d('0x27')],queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0xb')]));writeDB(queues[_0x9abd4b['uniqueid']]);}}else if(!_[_0xeb7d('0x24')](_0x9abd4b[_0xeb7d('0x25')]['queueposition'])){if(!_[_0xeb7d('0x24')](queues[_0x9abd4b[_0xeb7d('0x6')]])&&!queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x18')]){queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x18')]=![];queues[_0x9abd4b[_0xeb7d('0x6')]]['queuecallerabandonAt']=null;queues[_0x9abd4b[_0xeb7d('0x6')]]['queuecallerexit']=!![];queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x2b')]=utils[_0xeb7d('0x2c')]();queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0xb')]=_0xeb7d('0x2e');utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x2f'),_0x9abd4b[_0xeb7d('0x6')],queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0x1e')],_0x9abd4b[_0xeb7d('0x27')],queues[_0x9abd4b[_0xeb7d('0x6')]][_0xeb7d('0xb')]));}}}catch(_0x5ed81c){utils['error'](util[_0xeb7d('0x4')](_0xeb7d('0x23'),_0x9abd4b[_0xeb7d('0x6')]),_0x5ed81c);}};exports[_0xeb7d('0x18')]=function(_0x15d845){try{if(!_[_0xeb7d('0x24')](queues[_0x15d845['uniqueid']])){utils[_0xeb7d('0x11')](util['format'](_0xeb7d('0x30'),_0x15d845[_0xeb7d('0x6')]),_0x15d845);queues[_0x15d845[_0xeb7d('0x6')]][_0xeb7d('0x19')]=![];queues[_0x15d845[_0xeb7d('0x6')]]['queuecallerexitAt']=null;queues[_0x15d845[_0xeb7d('0x6')]]['queuecallerabandon']=!![];queues[_0x15d845[_0xeb7d('0x6')]][_0xeb7d('0x2a')]=utils[_0xeb7d('0x2c')]();queues[_0x15d845[_0xeb7d('0x6')]][_0xeb7d('0xb')]=_0xeb7d('0x31');utils[_0xeb7d('0x3')](util['format'](_0xeb7d('0x32'),_0x15d845[_0xeb7d('0x6')],queues[_0x15d845['uniqueid']][_0xeb7d('0x1e')],queues[_0x15d845['uniqueid']][_0xeb7d('0xb')]));}}catch(_0x42b01){utils['error'](util[_0xeb7d('0x4')](_0xeb7d('0x30'),_0x15d845[_0xeb7d('0x6')]),_0x42b01);}};exports['queuecallerleave']=function(_0x2895ef){try{if(!_[_0xeb7d('0x24')](queues[_0x2895ef['uniqueid']])){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x33'),_0x2895ef[_0xeb7d('0x6')]),_0x2895ef);utils['info'](util[_0xeb7d('0x4')](_0xeb7d('0x34'),_0x2895ef[_0xeb7d('0x6')],queues[_0x2895ef[_0xeb7d('0x6')]][_0xeb7d('0x1e')],_0x2895ef['connectedlinenum'],_0x2895ef[_0xeb7d('0x35')]));queues[_0x2895ef[_0xeb7d('0x6')]]['queuecallerleave']=!![];queues[_0x2895ef['uniqueid']]['queuecallerleaveAt']=utils[_0xeb7d('0x2c')]();queues[_0x2895ef[_0xeb7d('0x6')]]['holdtime']=utils[_0xeb7d('0x36')](queues[_0x2895ef[_0xeb7d('0x6')]]['queuecallerleaveAt'],queues[_0x2895ef[_0xeb7d('0x6')]]['queuecallerjoinAt']);queues[_0x2895ef['uniqueid']][_0xeb7d('0x14')]=_0x2895ef[_0xeb7d('0x14')];queues[_0x2895ef[_0xeb7d('0x6')]][_0xeb7d('0x37')]=_0x2895ef[_0xeb7d('0x37')];queues[_0x2895ef[_0xeb7d('0x6')]][_0xeb7d('0x38')]=_0x2895ef['connectedlinenum'];queues[_0x2895ef[_0xeb7d('0x6')]]['connectedlinename']=_0x2895ef[_0xeb7d('0x35')];}}catch(_0x30e777){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')](_0xeb7d('0x33'),_0x2895ef['uniqueid']),_0x30e777);}};exports['agentconnect']=function(_0x3b4490){try{if(!_[_0xeb7d('0x24')](queues[_0x3b4490[_0xeb7d('0x6')]])){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x39'),_0x3b4490['uniqueid']),_0x3b4490);utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x3a'),_0x3b4490[_0xeb7d('0x6')],queues[_0x3b4490['uniqueid']][_0xeb7d('0x1e')],_0x3b4490['membername'],_0x3b4490[_0xeb7d('0x3b')]));queues[_0x3b4490[_0xeb7d('0x6')]][_0xeb7d('0x18')]=![];queues[_0x3b4490[_0xeb7d('0x6')]][_0xeb7d('0x18')]=![];queues[_0x3b4490[_0xeb7d('0x6')]][_0xeb7d('0x2a')]=null;queues[_0x3b4490[_0xeb7d('0x6')]]['queuecallerexit']=![];queues[_0x3b4490[_0xeb7d('0x6')]][_0xeb7d('0xb')]=null;queues[_0x3b4490['uniqueid']][_0xeb7d('0x2b')]=null;queues[_0x3b4490['uniqueid']][_0xeb7d('0x3c')]=!![];queues[_0x3b4490['uniqueid']][_0xeb7d('0xa')]=_0x3b4490[_0xeb7d('0x3b')];queues[_0x3b4490[_0xeb7d('0x6')]]['lastAssignedTo']=_0x3b4490[_0xeb7d('0x3d')];}}catch(_0x352163){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')]('[%s][queues][agentconnect]',_0x3b4490['uniqueid']),_0x352163);}};exports['agentcomplete']=function(_0x159307){try{if(!_[_0xeb7d('0x24')](queues[_0x159307[_0xeb7d('0x6')]])){if(queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x17')]){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x3e'),_0x159307['uniqueid']),_0x159307);queues[_0x159307[_0xeb7d('0x6')]]['queuecallerabandon']=![];queues[_0x159307[_0xeb7d('0x6')]]['queuecallerabandon']=![];queues[_0x159307['uniqueid']]['queuecallerabandonAt']=null;queues[_0x159307['uniqueid']][_0xeb7d('0x19')]=![];queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x2b')]=null;queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x3c')]=!![];queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x8')]=_0x159307['membername'];queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x1a')]=!![];queues[_0x159307['uniqueid']][_0xeb7d('0x1b')]=utils[_0xeb7d('0x2c')]();if(_0x159307[_0xeb7d('0x3f')]==_0xeb7d('0x40')){if(!queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0x40')]){queues[_0x159307['uniqueid']][_0xeb7d('0xb')]=_0xeb7d('0x41');}}else{queues[_0x159307[_0xeb7d('0x6')]][_0xeb7d('0xb')]=_0xeb7d('0x42')+_0x159307[_0xeb7d('0x3f')][_0xeb7d('0x28')]();}utils[_0xeb7d('0x3')](util['format'](_0xeb7d('0x43'),_0x159307[_0xeb7d('0x6')],queues[_0x159307['uniqueid']][_0xeb7d('0x1e')],_0x159307[_0xeb7d('0x3d')],queues[_0x159307[_0xeb7d('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x159307[_0xeb7d('0x6')]]);}}}catch(_0x224095){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')](_0xeb7d('0x3e'),_0x159307[_0xeb7d('0x6')]),_0x224095);}};exports[_0xeb7d('0x44')]=function(_0xd1b6c2){try{if(!_[_0xeb7d('0x24')](queues[_0xd1b6c2[_0xeb7d('0x45')]])){utils[_0xeb7d('0x11')](util['format']('[%s][queues][blindtransfer]',_0xd1b6c2[_0xeb7d('0x6')]),_0xd1b6c2);queues[_0xd1b6c2[_0xeb7d('0x45')]]['transfer']=!![];queues[_0xd1b6c2[_0xeb7d('0x45')]][_0xeb7d('0x46')]='BLIND';queues[_0xd1b6c2[_0xeb7d('0x45')]]['transferexten']=_0xd1b6c2[_0xeb7d('0x47')];queues[_0xd1b6c2[_0xeb7d('0x45')]]['transferuniqueid']=_0xd1b6c2[_0xeb7d('0x45')];queues[_0xd1b6c2[_0xeb7d('0x45')]]['queuecallerexitreason']=_0xeb7d('0x48');utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x49'),_0xd1b6c2[_0xeb7d('0x6')],queues[_0xd1b6c2['transfereeuniqueid']][_0xeb7d('0x1e')],_0xd1b6c2[_0xeb7d('0x45')],_0xd1b6c2[_0xeb7d('0x47')]));}}catch(_0x49b9d3){utils['error'](util[_0xeb7d('0x4')](_0xeb7d('0x4a'),_0xd1b6c2[_0xeb7d('0x6')]),_0x49b9d3);}};exports[_0xeb7d('0x4b')]=function(_0x4a4f6c){try{utils[_0xeb7d('0x11')](util['format'](_0xeb7d('0x4c'),_0x4a4f6c[_0xeb7d('0x4d')]),_0x4a4f6c);if(_0x4a4f6c[_0xeb7d('0x4d')]==_0x4a4f6c[_0xeb7d('0x4e')]){if(!_[_0xeb7d('0x24')](queues[_0x4a4f6c[_0xeb7d('0x4f')]])){utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4a4f6c[_0xeb7d('0x4d')],queues[_0x4a4f6c['secondtransfererlinkedid']][_0xeb7d('0x1e')],_0x4a4f6c['origtransfererexten']));queues[_0x4a4f6c[_0xeb7d('0x4f')]][_0xeb7d('0x40')]=!![];queues[_0x4a4f6c[_0xeb7d('0x4f')]][_0xeb7d('0x46')]='ATTENDED';queues[_0x4a4f6c[_0xeb7d('0x4f')]][_0xeb7d('0x50')]=_0x4a4f6c[_0xeb7d('0x51')];queues[_0x4a4f6c[_0xeb7d('0x4f')]][_0xeb7d('0x52')]=_0x4a4f6c['origtransfereruniqueid'];queues[_0x4a4f6c['secondtransfererlinkedid']][_0xeb7d('0xb')]=_0xeb7d('0x53');}if(!_['isNil'](queues[_0x4a4f6c['origtransfererlinkedid']])){if(_0x4a4f6c[_0xeb7d('0x54')]&&queues[_0x4a4f6c[_0xeb7d('0x54')]]){queues[_0x4a4f6c['transfereelinkedid']][_0xeb7d('0x21')]=0x1;queues[_0x4a4f6c['transfereeuniqueid']]=_[_0xeb7d('0x55')](queues[_0x4a4f6c[_0xeb7d('0x54')]]);queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x1f')]=_0x4a4f6c[_0xeb7d('0x56')];queues[_0x4a4f6c[_0xeb7d('0x45')]]['queuecallerenterreason']=0x2;queues[_0x4a4f6c['transfereeuniqueid']]['calleridnum']=queues[_0x4a4f6c[_0xeb7d('0x4f')]]['calleridnum'];queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x57')]=queues[_0x4a4f6c['secondtransfererlinkedid']][_0xeb7d('0x57')];queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x58')]=utils[_0xeb7d('0x2c')]();queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x17')]=utils[_0xeb7d('0x2c')]();queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x59')]=0x0;queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x5a')]=0x0;utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x5b'),_0x4a4f6c[_0xeb7d('0x4d')],queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x1e')],queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x9')],queues[_0x4a4f6c[_0xeb7d('0x45')]][_0xeb7d('0x57')]));}else{utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x5c'),_0x4a4f6c[_0xeb7d('0x4d')],queues[_0x4a4f6c['origtransfererlinkedid']][_0xeb7d('0x1e')],_0x4a4f6c[_0xeb7d('0x4f')]));queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0x1f')]=_0x4a4f6c[_0xeb7d('0x4f')];}}}else if(_0x4a4f6c[_0xeb7d('0x5d')]==_0x4a4f6c[_0xeb7d('0x4f')]){if(!_['isNil'](queues[_0x4a4f6c[_0xeb7d('0x4e')]])){utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x5e'),_0x4a4f6c[_0xeb7d('0x4d')],queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0x1e')],_0x4a4f6c['secondtransfereruniqueid'],_0x4a4f6c[_0xeb7d('0x5f')]));queues[_0x4a4f6c[_0xeb7d('0x4e')]]['transfer']=!![];queues[_0x4a4f6c['origtransfererlinkedid']][_0xeb7d('0x46')]=_0xeb7d('0x60');queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0x50')]=_0x4a4f6c['secondtransfererexten'];queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0x52')]=_0x4a4f6c[_0xeb7d('0x5d')];queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0xb')]=_0xeb7d('0x53');}if(!_[_0xeb7d('0x24')](queues[_0x4a4f6c[_0xeb7d('0x4f')]])){if(_0x4a4f6c[_0xeb7d('0x61')]&&queues[_0x4a4f6c[_0xeb7d('0x61')]]){queues[_0x4a4f6c[_0xeb7d('0x61')]]['queuecallerenterreason']=0x1;queues[_0x4a4f6c[_0xeb7d('0x56')]]=_[_0xeb7d('0x55')](queues[_0x4a4f6c[_0xeb7d('0x61')]]);queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x1f')]=_0x4a4f6c[_0xeb7d('0x56')];queues[_0x4a4f6c[_0xeb7d('0x56')]]['queuecallerenterreason']=0x2;queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x9')]=queues[_0x4a4f6c['origtransfererlinkedid']][_0xeb7d('0x9')];queues[_0x4a4f6c[_0xeb7d('0x56')]]['calleridname']=queues[_0x4a4f6c[_0xeb7d('0x4e')]][_0xeb7d('0x57')];queues[_0x4a4f6c[_0xeb7d('0x56')]]['queuecallerjoinAt']=utils[_0xeb7d('0x2c')]();queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x17')]=utils[_0xeb7d('0x2c')]();queues[_0x4a4f6c['transfertargetuniqueid']][_0xeb7d('0x59')]=0x0;queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x5a')]=0x0;utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x62'),_0x4a4f6c[_0xeb7d('0x4d')],queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x1e')],queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x1f')],queues[_0x4a4f6c[_0xeb7d('0x56')]][_0xeb7d('0x9')],queues[_0x4a4f6c[_0xeb7d('0x56')]]['calleridname']));}else{utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x5c'),_0x4a4f6c['origtransfereruniqueid'],queues[_0x4a4f6c['secondtransfererlinkedid']][_0xeb7d('0x1e')],_0x4a4f6c['origtransfererlinkedid']));queues[_0x4a4f6c[_0xeb7d('0x4f')]]['transfereduniqueid']=_0x4a4f6c[_0xeb7d('0x4e')];}}}}catch(_0x5eef5a){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')](_0xeb7d('0x4c'),_0x4a4f6c[_0xeb7d('0x4d')]),_0x5eef5a);}};exports[_0xeb7d('0x63')]=function(_0x2ceb80){try{if(!_[_0xeb7d('0x24')](queues[_0x2ceb80[_0xeb7d('0x6')]])){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')]('[%s][queues][musiconholdstart]',_0x2ceb80['uniqueid']),_0x2ceb80);queues[_0x2ceb80['uniqueid']]['musiconholdstartAt']=utils[_0xeb7d('0x2c')]();utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x64'),_0x2ceb80[_0xeb7d('0x6')],queues[_0x2ceb80['uniqueid']][_0xeb7d('0x1e')],queues[_0x2ceb80[_0xeb7d('0x6')]][_0xeb7d('0x65')]));}}catch(_0x1b0d3f){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')](_0xeb7d('0x66'),_0x2ceb80[_0xeb7d('0x6')]),_0x1b0d3f);}};exports[_0xeb7d('0x67')]=function(_0x5dc13b){try{if(!_['isNil'](queues[_0x5dc13b['uniqueid']])){if(!_[_0xeb7d('0x24')](queues[_0x5dc13b[_0xeb7d('0x6')]]['musiconholdstartAt'])){utils[_0xeb7d('0x11')](util[_0xeb7d('0x4')](_0xeb7d('0x68'),_0x5dc13b[_0xeb7d('0x6')]),_0x5dc13b);queues[_0x5dc13b['uniqueid']]['mohtime']+=utils[_0xeb7d('0x36')](utils[_0xeb7d('0x2c')](),queues[_0x5dc13b[_0xeb7d('0x6')]][_0xeb7d('0x65')]);utils[_0xeb7d('0x3')](util[_0xeb7d('0x4')](_0xeb7d('0x69'),_0x5dc13b[_0xeb7d('0x6')],queues[_0x5dc13b[_0xeb7d('0x6')]][_0xeb7d('0x1e')],queues[_0x5dc13b[_0xeb7d('0x6')]][_0xeb7d('0x5a')]));delete queues[_0x5dc13b[_0xeb7d('0x6')]][_0xeb7d('0x65')];}}}catch(_0x31f19f){utils[_0xeb7d('0x15')](util[_0xeb7d('0x4')]('[%s][queues][musiconholdstop]',_0x5dc13b[_0xeb7d('0x6')]),_0x31f19f);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 8e1a6c4..5e3648f 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 _0x5f89=['.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','appdata','application','toLowerCase','startsWith','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','UserId','request','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','debug','format','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value'];(function(_0x1a31c2,_0x4ce29b){var _0x3be639=function(_0x443b1d){while(--_0x443b1d){_0x1a31c2['push'](_0x1a31c2['shift']());}};_0x3be639(++_0x4ce29b);}(_0x5f89,0xc5));var _0x95f8=function(_0x1153aa,_0x19afab){_0x1153aa=_0x1153aa-0x0;var _0x18ed6f=_0x5f89[_0x1153aa];return _0x18ed6f;};'use strict';var _=require(_0x95f8('0x0'));var util=require('util');var utils=require(_0x95f8('0x1'));var recordings={};function writeDB(_0x51880d){utils['info'](util['format'](_0x95f8('0x2'),_0x51880d['uniqueid']));if(_0x51880d[_0x95f8('0x3')]){utils[_0x95f8('0x4')](_0x51880d['accountcode'])[_0x95f8('0x5')](function(_0x3da44d){if(_0x3da44d){_0x51880d['membername']=_0x3da44d['name'];_0x51880d[_0x95f8('0x6')]=_0x3da44d['id'];}utils['request']('CreateVoiceRecording',_0x51880d);});}else{utils[_0x95f8('0x7')]('CreateVoiceRecording',_0x51880d);}}exports['newchannel']=function(_0x61a09e){try{utils['debug'](util['format'](_0x95f8('0x8'),_0x61a09e[_0x95f8('0x9')]),_0x61a09e);if(_0x61a09e[_0x95f8('0x9')]==_0x61a09e[_0x95f8('0xa')]){utils[_0x95f8('0xb')](util['format'](_0x95f8('0xc'),_0x61a09e[_0x95f8('0x9')],_0x61a09e[_0x95f8('0xd')],_0x61a09e[_0x95f8('0xe')]));recordings[_0x61a09e[_0x95f8('0x9')]]={'uniqueid':_0x61a09e['uniqueid'],'accountcode':_0x61a09e[_0x95f8('0x3')],'exten':_0x61a09e['exten'],'context':_0x61a09e[_0x95f8('0xd')],'channel':_0x61a09e[_0x95f8('0xf')],'monitors':[]};}}catch(_0x38573e){utils['error'](util['format'](_0x95f8('0x8'),_0x61a09e['uniqueid']),_0x38573e);}};exports[_0x95f8('0x10')]=function(_0x55ab59){try{utils[_0x95f8('0x11')](util[_0x95f8('0x12')]('[%s][recordings][newstate]',_0x55ab59[_0x95f8('0x9')]),_0x55ab59);if(!_[_0x95f8('0x13')](recordings[_0x55ab59[_0x95f8('0x9')]])&&_0x55ab59[_0x95f8('0x14')]==0x6){utils['info'](util[_0x95f8('0x12')](_0x95f8('0x15'),_0x55ab59['uniqueid'],_0x55ab59[_0x95f8('0xd')],_0x55ab59[_0x95f8('0xf')]));}else if(!_['isNil'](recordings[_0x55ab59[_0x95f8('0xa')]])&&_0x55ab59[_0x95f8('0x14')]==0x6&&_0x55ab59['context']!=_0x95f8('0x16')){utils[_0x95f8('0xb')](util[_0x95f8('0x12')](_0x95f8('0x17'),_0x55ab59['uniqueid'],_0x55ab59[_0x95f8('0xa')],_0x55ab59[_0x95f8('0xd')],_0x55ab59[_0x95f8('0xf')]));recordings[_0x55ab59[_0x95f8('0xa')]]['accountcode']=_0x55ab59[_0x95f8('0x3')];}}catch(_0x23217c){utils[_0x95f8('0x18')](util[_0x95f8('0x12')](_0x95f8('0x19'),_0x55ab59[_0x95f8('0x9')]),_0x23217c);}};exports[_0x95f8('0x1a')]=function(_0x300b46){try{if(!_[_0x95f8('0x13')](_0x300b46[_0x95f8('0x1b')])&&!_[_0x95f8('0x13')](_0x300b46['variable']['mixmonitor_filename'])){utils[_0x95f8('0x11')](util[_0x95f8('0x12')]('[%s][recordings][varset]',_0x300b46[_0x95f8('0x9')]),_0x300b46);utils[_0x95f8('0xb')](util[_0x95f8('0x12')](_0x95f8('0x1c'),_0x300b46[_0x95f8('0x9')],_0x300b46[_0x95f8('0x1b')],_0x300b46['value']));if(_[_0x95f8('0x1d')](_0x300b46[_0x95f8('0x1e')],_0x95f8('0x1f'))){_0x300b46['value']=_0x300b46[_0x95f8('0x1e')][_0x95f8('0x20')](_0x95f8('0x1f'),_0x95f8('0x21'));}if(recordings[_0x300b46[_0x95f8('0xa')]]){var _0x1b1b97=_[_0x95f8('0x22')](recordings[_0x300b46['linkedid']][_0x95f8('0x23')],{'value':_0x300b46[_0x95f8('0x1e')]});if(_[_0x95f8('0x13')](_0x1b1b97)){recordings[_0x300b46[_0x95f8('0xa')]][_0x95f8('0x23')]['push']({'value':_0x300b46[_0x95f8('0x1e')]});}}}}catch(_0x113952){utils['error'](util[_0x95f8('0x12')]('[%s][recordings][varset]',_0x300b46['uniqueid']),_0x113952);}};exports[_0x95f8('0x24')]=function(_0x27ace1){try{if(!_[_0x95f8('0x13')](recordings[_0x27ace1[_0x95f8('0x9')]])){utils['debug'](util[_0x95f8('0x12')]('[%s][recordings][hangup]',_0x27ace1[_0x95f8('0x9')]),_0x27ace1);utils['info'](util[_0x95f8('0x12')](_0x95f8('0x25'),_0x27ace1[_0x95f8('0x9')],_0x27ace1['calleridnum'],_0x27ace1[_0x95f8('0x26')],_0x27ace1[_0x95f8('0x27')]));recordings[_0x27ace1['uniqueid']][_0x95f8('0x28')]=_0x27ace1[_0x95f8('0x28')];recordings[_0x27ace1['uniqueid']][_0x95f8('0x26')]=_0x27ace1[_0x95f8('0x26')];recordings[_0x27ace1[_0x95f8('0x9')]][_0x95f8('0x29')]=_0x27ace1['connectedlinenum'];recordings[_0x27ace1['uniqueid']]['connectedlinename']=_0x27ace1[_0x95f8('0x2a')];if(recordings[_0x27ace1['uniqueid']]['type']==_0x95f8('0x2b')&&recordings[_0x27ace1[_0x95f8('0x9')]]['accountcode']){recordings[_0x27ace1[_0x95f8('0x9')]][_0x95f8('0x29')]=recordings[_0x27ace1[_0x95f8('0x9')]][_0x95f8('0x3')];recordings[_0x27ace1['uniqueid']][_0x95f8('0x2a')]='';}recordings[_0x27ace1[_0x95f8('0x9')]]['monitors'][_0x95f8('0x2c')](function(_0x3bd31f){var _0x154053=_[_0x95f8('0x2d')](recordings[_0x27ace1[_0x95f8('0x9')]]);_0x154053['value']=_0x3bd31f[_0x95f8('0x1e')];writeDB(_0x154053);});delete recordings[_0x27ace1[_0x95f8('0x9')]];}}catch(_0x15590d){utils['error'](util[_0x95f8('0x12')]('[%s][recordings][hangup]',_0x27ace1[_0x95f8('0x9')]),_0x15590d);}};exports[_0x95f8('0x2e')]=function(_0x4c39c4){try{if(!_['isNil'](recordings[_0x4c39c4[_0x95f8('0x9')]])){utils[_0x95f8('0x11')](util[_0x95f8('0x12')](_0x95f8('0x2f'),_0x4c39c4[_0x95f8('0x9')]),_0x4c39c4);utils[_0x95f8('0xb')](util[_0x95f8('0x12')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4c39c4['uniqueid'],_0x4c39c4['application'],_0x4c39c4[_0x95f8('0x30')]));if(_0x4c39c4[_0x95f8('0x31')][_0x95f8('0x32')]()=='set'&&_[_0x95f8('0x33')](_0x4c39c4['appdata'][_0x95f8('0x32')](),'cdr')){var _0x5e4891=_0x4c39c4[_0x95f8('0x30')]['split']('=');var _0x49c577=_0x5e4891[0x0][_0x95f8('0x34')](_0x5e4891[0x0][_0x95f8('0x35')]('(')+0x1,_0x5e4891[0x0]['lastIndexOf'](')'));var _0x12d776=_0x5e4891[0x1];recordings[_0x4c39c4['uniqueid']][_0x49c577]=_0x12d776;}}}catch(_0x52af71){utils[_0x95f8('0x18')](util[_0x95f8('0x12')](_0x95f8('0x2f'),_0x4c39c4[_0x95f8('0x9')]),_0x52af71);}};exports[_0x95f8('0x36')]=function(_0x3dbf35){try{if(!_[_0x95f8('0x13')](recordings[_0x3dbf35[_0x95f8('0x9')]])){utils[_0x95f8('0x11')](util[_0x95f8('0x12')]('[%s][recordings][queuecallerjoin]',_0x3dbf35[_0x95f8('0x9')]),_0x3dbf35);utils[_0x95f8('0xb')](util['format'](_0x95f8('0x37'),_0x3dbf35[_0x95f8('0x9')],_0x3dbf35['queue']));recordings[_0x3dbf35[_0x95f8('0x9')]][_0x95f8('0x38')]=_0x3dbf35['queue'];}}catch(_0x593698){utils[_0x95f8('0x18')](util[_0x95f8('0x12')]('[%s][recordings][queuecallerjoin]',_0x3dbf35[_0x95f8('0x9')]),_0x593698);}}; \ No newline at end of file +var _0x3360=['[%s][recordings][varset]','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','format','accountcode','getUserByInternal','then','UserId','request','CreateVoiceRecording','debug','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','isNil','channelstate','context','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','find','monitors','push'];(function(_0x272cd8,_0x1ea328){var _0x4042df=function(_0x3ed1bb){while(--_0x3ed1bb){_0x272cd8['push'](_0x272cd8['shift']());}};_0x4042df(++_0x1ea328);}(_0x3360,0x1d7));var _0x0336=function(_0x24177b,_0x5e99bd){_0x24177b=_0x24177b-0x0;var _0x555187=_0x3360[_0x24177b];return _0x555187;};'use strict';var _=require(_0x0336('0x0'));var util=require(_0x0336('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x581193){utils['info'](util[_0x0336('0x2')]('[%s][recordings][writeDB]',_0x581193['uniqueid']));if(_0x581193[_0x0336('0x3')]){utils[_0x0336('0x4')](_0x581193[_0x0336('0x3')])[_0x0336('0x5')](function(_0x340a8a){if(_0x340a8a){_0x581193['membername']=_0x340a8a['name'];_0x581193[_0x0336('0x6')]=_0x340a8a['id'];}utils[_0x0336('0x7')](_0x0336('0x8'),_0x581193);});}else{utils[_0x0336('0x7')](_0x0336('0x8'),_0x581193);}}exports['newchannel']=function(_0x1d05e6){try{utils[_0x0336('0x9')](util[_0x0336('0x2')]('[%s][recordings][newchannel]',_0x1d05e6[_0x0336('0xa')]),_0x1d05e6);if(_0x1d05e6['uniqueid']==_0x1d05e6[_0x0336('0xb')]){utils[_0x0336('0xc')](util[_0x0336('0x2')](_0x0336('0xd'),_0x1d05e6[_0x0336('0xa')],_0x1d05e6['context'],_0x1d05e6[_0x0336('0xe')]));recordings[_0x1d05e6[_0x0336('0xa')]]={'uniqueid':_0x1d05e6[_0x0336('0xa')],'accountcode':_0x1d05e6[_0x0336('0x3')],'exten':_0x1d05e6[_0x0336('0xe')],'context':_0x1d05e6['context'],'channel':_0x1d05e6[_0x0336('0xf')],'monitors':[]};}}catch(_0x406614){utils[_0x0336('0x10')](util[_0x0336('0x2')]('[%s][recordings][newchannel]',_0x1d05e6[_0x0336('0xa')]),_0x406614);}};exports['newstate']=function(_0x2279d1){try{utils[_0x0336('0x9')](util['format']('[%s][recordings][newstate]',_0x2279d1['uniqueid']),_0x2279d1);if(!_[_0x0336('0x11')](recordings[_0x2279d1[_0x0336('0xa')]])&&_0x2279d1[_0x0336('0x12')]==0x6){utils[_0x0336('0xc')](util[_0x0336('0x2')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x2279d1[_0x0336('0xa')],_0x2279d1[_0x0336('0x13')],_0x2279d1[_0x0336('0xf')]));}else if(!_[_0x0336('0x11')](recordings[_0x2279d1['linkedid']])&&_0x2279d1['channelstate']==0x6&&_0x2279d1['context']!=_0x0336('0x14')){utils[_0x0336('0xc')](util[_0x0336('0x2')](_0x0336('0x15'),_0x2279d1['uniqueid'],_0x2279d1[_0x0336('0xb')],_0x2279d1[_0x0336('0x13')],_0x2279d1[_0x0336('0xf')]));recordings[_0x2279d1['linkedid']]['accountcode']=_0x2279d1[_0x0336('0x3')];}}catch(_0x21e8a1){utils[_0x0336('0x10')](util[_0x0336('0x2')](_0x0336('0x16'),_0x2279d1[_0x0336('0xa')]),_0x21e8a1);}};exports[_0x0336('0x17')]=function(_0x49f1a8){try{if(!_[_0x0336('0x11')](_0x49f1a8[_0x0336('0x18')])&&!_[_0x0336('0x11')](_0x49f1a8[_0x0336('0x18')][_0x0336('0x19')])){utils[_0x0336('0x9')](util[_0x0336('0x2')]('[%s][recordings][varset]',_0x49f1a8[_0x0336('0xa')]),_0x49f1a8);utils['info'](util[_0x0336('0x2')](_0x0336('0x1a'),_0x49f1a8[_0x0336('0xa')],_0x49f1a8[_0x0336('0x18')],_0x49f1a8[_0x0336('0x1b')]));if(_[_0x0336('0x1c')](_0x49f1a8[_0x0336('0x1b')],_0x0336('0x1d'))){_0x49f1a8[_0x0336('0x1b')]=_0x49f1a8[_0x0336('0x1b')]['replace']('.wav49','.WAV');}if(recordings[_0x49f1a8[_0x0336('0xb')]]){var _0x374680=_[_0x0336('0x1e')](recordings[_0x49f1a8[_0x0336('0xb')]][_0x0336('0x1f')],{'value':_0x49f1a8[_0x0336('0x1b')]});if(_['isNil'](_0x374680)){recordings[_0x49f1a8[_0x0336('0xb')]][_0x0336('0x1f')][_0x0336('0x20')]({'value':_0x49f1a8['value']});}}}}catch(_0x45b2a0){utils[_0x0336('0x10')](util[_0x0336('0x2')](_0x0336('0x21'),_0x49f1a8[_0x0336('0xa')]),_0x45b2a0);}};exports['hangup']=function(_0x2ecdc0){try{if(!_[_0x0336('0x11')](recordings[_0x2ecdc0[_0x0336('0xa')]])){utils['debug'](util[_0x0336('0x2')](_0x0336('0x22'),_0x2ecdc0[_0x0336('0xa')]),_0x2ecdc0);utils[_0x0336('0xc')](util['format'](_0x0336('0x23'),_0x2ecdc0[_0x0336('0xa')],_0x2ecdc0[_0x0336('0x24')],_0x2ecdc0[_0x0336('0x25')],_0x2ecdc0[_0x0336('0x26')]));recordings[_0x2ecdc0[_0x0336('0xa')]][_0x0336('0x24')]=_0x2ecdc0[_0x0336('0x24')];recordings[_0x2ecdc0[_0x0336('0xa')]][_0x0336('0x25')]=_0x2ecdc0[_0x0336('0x25')];recordings[_0x2ecdc0['uniqueid']][_0x0336('0x27')]=_0x2ecdc0[_0x0336('0x27')];recordings[_0x2ecdc0['uniqueid']]['connectedlinename']=_0x2ecdc0[_0x0336('0x28')];if(recordings[_0x2ecdc0[_0x0336('0xa')]]['type']==_0x0336('0x29')&&recordings[_0x2ecdc0[_0x0336('0xa')]][_0x0336('0x3')]){recordings[_0x2ecdc0[_0x0336('0xa')]]['connectedlinenum']=recordings[_0x2ecdc0[_0x0336('0xa')]][_0x0336('0x3')];recordings[_0x2ecdc0[_0x0336('0xa')]][_0x0336('0x28')]='';}recordings[_0x2ecdc0[_0x0336('0xa')]][_0x0336('0x1f')][_0x0336('0x2a')](function(_0x22f6d1){var _0x850f44=_['clone'](recordings[_0x2ecdc0['uniqueid']]);_0x850f44['value']=_0x22f6d1['value'];writeDB(_0x850f44);});delete recordings[_0x2ecdc0[_0x0336('0xa')]];}}catch(_0x223e02){utils[_0x0336('0x10')](util[_0x0336('0x2')](_0x0336('0x22'),_0x2ecdc0['uniqueid']),_0x223e02);}};exports['newexten']=function(_0x4bad7a){try{if(!_['isNil'](recordings[_0x4bad7a[_0x0336('0xa')]])){utils[_0x0336('0x9')](util['format'](_0x0336('0x2b'),_0x4bad7a[_0x0336('0xa')]),_0x4bad7a);utils[_0x0336('0xc')](util[_0x0336('0x2')](_0x0336('0x2c'),_0x4bad7a[_0x0336('0xa')],_0x4bad7a[_0x0336('0x2d')],_0x4bad7a[_0x0336('0x2e')]));if(_0x4bad7a[_0x0336('0x2d')]['toLowerCase']()==_0x0336('0x2f')&&_[_0x0336('0x30')](_0x4bad7a[_0x0336('0x2e')][_0x0336('0x31')](),'cdr')){var _0x326964=_0x4bad7a['appdata'][_0x0336('0x32')]('=');var _0x1449a0=_0x326964[0x0]['substring'](_0x326964[0x0][_0x0336('0x33')]('(')+0x1,_0x326964[0x0]['lastIndexOf'](')'));var _0x39f73e=_0x326964[0x1];recordings[_0x4bad7a[_0x0336('0xa')]][_0x1449a0]=_0x39f73e;}}}catch(_0x19676d){utils[_0x0336('0x10')](util[_0x0336('0x2')](_0x0336('0x2b'),_0x4bad7a[_0x0336('0xa')]),_0x19676d);}};exports[_0x0336('0x34')]=function(_0x2dcbeb){try{if(!_[_0x0336('0x11')](recordings[_0x2dcbeb[_0x0336('0xa')]])){utils[_0x0336('0x9')](util[_0x0336('0x2')](_0x0336('0x35'),_0x2dcbeb[_0x0336('0xa')]),_0x2dcbeb);utils[_0x0336('0xc')](util[_0x0336('0x2')](_0x0336('0x36'),_0x2dcbeb['uniqueid'],_0x2dcbeb[_0x0336('0x37')]));recordings[_0x2dcbeb[_0x0336('0xa')]][_0x0336('0x37')]=_0x2dcbeb[_0x0336('0x37')];}}catch(_0x36cc2a){utils[_0x0336('0x10')](util[_0x0336('0x2')](_0x0336('0x35'),_0x2dcbeb[_0x0336('0xa')]),_0x36cc2a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2f17cfe..5b985b6 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 _0xa95d=['uniqueid','request','CreateVoiceTransferReport','blinds','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid'];(function(_0x6639dc,_0x3bc210){var _0x107275=function(_0x2aefe6){while(--_0x2aefe6){_0x6639dc['push'](_0x6639dc['shift']());}};_0x107275(++_0x3bc210);}(_0xa95d,0x1bc));var _0xda95=function(_0x2ce596,_0x10313b){_0x2ce596=_0x2ce596-0x0;var _0x2e65a4=_0xa95d[_0x2ce596];return _0x2e65a4;};'use strict';var _=require(_0xda95('0x0'));var util=require(_0xda95('0x1'));var utils=require(_0xda95('0x2'));function writeDB(_0x324950){utils[_0xda95('0x3')](util['format'](_0xda95('0x4'),_0x324950[_0xda95('0x5')]==='attended'?_0x324950[_0xda95('0x6')]:_0x324950[_0xda95('0x7')],_0x324950[_0xda95('0x5')]));utils[_0xda95('0x8')](_0xda95('0x9'),_0x324950);}exports[_0xda95('0xa')]={};exports['blindtransfer']=function(_0x565b0b){try{utils[_0xda95('0xb')](util[_0xda95('0xc')](_0xda95('0xd'),_0x565b0b[_0xda95('0x7')]),_0x565b0b);utils[_0xda95('0x3')](util['format'](_0xda95('0xe'),_0x565b0b[_0xda95('0x7')],_0x565b0b[_0xda95('0xf')],_0x565b0b[_0xda95('0x10')],_0x565b0b['transfereecalleridnum'],_0x565b0b['transfereecalleridname']));_0x565b0b['type']=_0xda95('0x11');exports[_0xda95('0xa')][_0x565b0b[_0xda95('0x12')]]=_0x565b0b;writeDB(_0x565b0b);}catch(_0x376922){utils['error'](util[_0xda95('0xc')](_0xda95('0xd'),_0x565b0b[_0xda95('0x7')]),_0x376922);}};exports[_0xda95('0x13')]=function(_0x5f01e5){try{utils['debug'](util[_0xda95('0xc')](_0xda95('0x14'),_0x5f01e5[_0xda95('0x6')]),_0x5f01e5);utils[_0xda95('0x3')](util[_0xda95('0xc')](_0xda95('0x15'),_0x5f01e5[_0xda95('0x6')],_0x5f01e5['origtransferercalleridnum'],_0x5f01e5[_0xda95('0x16')],_0x5f01e5['transfertargetcalleridnum'],_0x5f01e5[_0xda95('0x17')]));_0x5f01e5=_[_0xda95('0x18')](_0x5f01e5,{'transfererchannel':_0x5f01e5[_0xda95('0x19')],'transferercalleridnum':_0x5f01e5[_0xda95('0x1a')],'transferercalleridname':_0x5f01e5['origtransferercalleridname'],'transfererconnectedlinenum':_0x5f01e5['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5f01e5[_0xda95('0x1b')],'transfereraccountcode':_0x5f01e5[_0xda95('0x1c')],'transferercontext':_0x5f01e5[_0xda95('0x1d')],'transfererexten':_0x5f01e5[_0xda95('0x1e')],'transfererlinkedid':_0x5f01e5['origtransfererlinkedid'],'context':_0x5f01e5[_0xda95('0x1f')],'extension':_0x5f01e5[_0xda95('0x20')],'type':_0xda95('0x21')});if(_['isNil'](_0x5f01e5[_0xda95('0x22')])){_0x5f01e5=_[_0xda95('0x18')](_0x5f01e5,{'transfereechannel':_0x5f01e5['transfertargetchannel'],'transfereecalleridnum':_0x5f01e5[_0xda95('0x23')],'transfereecalleridname':_0x5f01e5['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5f01e5[_0xda95('0x24')],'transfereeconnectedlinename':_0x5f01e5[_0xda95('0x25')],'transfereeaccountcode':_0x5f01e5['transfertargetaccountcode'],'transfereecontext':_0x5f01e5[_0xda95('0x26')],'transfereeexten':_0x5f01e5[_0xda95('0x27')],'transfereelinkedid':_0x5f01e5[_0xda95('0x28')]});}writeDB(_0x5f01e5);}catch(_0x19bab6){utils['error'](util[_0xda95('0xc')](_0xda95('0x14'),_0x5f01e5['origtransfereruniqueid']),_0x19bab6);}}; \ No newline at end of file +var _0x04f7=['origtransferercontext','attended','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','request','CreateVoiceTransferReport','format','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','blinds','transfereruniqueid','error','attendedtransfer','debug','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid'];(function(_0x26151a,_0x44c35f){var _0x5432c4=function(_0x2567f4){while(--_0x2567f4){_0x26151a['push'](_0x26151a['shift']());}};_0x5432c4(++_0x44c35f);}(_0x04f7,0x1de));var _0x704f=function(_0x1b2979,_0x1d0243){_0x1b2979=_0x1b2979-0x0;var _0x323fab=_0x04f7[_0x1b2979];return _0x323fab;};'use strict';var _=require(_0x704f('0x0'));var util=require(_0x704f('0x1'));var utils=require(_0x704f('0x2'));function writeDB(_0x370576){utils[_0x704f('0x3')](util['format'](_0x704f('0x4'),_0x370576[_0x704f('0x5')]==='attended'?_0x370576['origtransfereruniqueid']:_0x370576['uniqueid'],_0x370576[_0x704f('0x5')]));utils[_0x704f('0x6')](_0x704f('0x7'),_0x370576);}exports['blinds']={};exports['blindtransfer']=function(_0x3ee0c2){try{utils['debug'](util[_0x704f('0x8')](_0x704f('0x9'),_0x3ee0c2[_0x704f('0xa')]),_0x3ee0c2);utils[_0x704f('0x3')](util[_0x704f('0x8')](_0x704f('0xb'),_0x3ee0c2[_0x704f('0xa')],_0x3ee0c2['transferercalleridnum'],_0x3ee0c2['transferercalleridname'],_0x3ee0c2[_0x704f('0xc')],_0x3ee0c2['transfereecalleridname']));_0x3ee0c2[_0x704f('0x5')]='blind';exports[_0x704f('0xd')][_0x3ee0c2[_0x704f('0xe')]]=_0x3ee0c2;writeDB(_0x3ee0c2);}catch(_0x53b8dc){utils[_0x704f('0xf')](util[_0x704f('0x8')](_0x704f('0x9'),_0x3ee0c2[_0x704f('0xa')]),_0x53b8dc);}};exports[_0x704f('0x10')]=function(_0x2edb4d){try{utils[_0x704f('0x11')](util['format']('[%s][transfers][attendedtransfer]',_0x2edb4d[_0x704f('0x12')]),_0x2edb4d);utils[_0x704f('0x3')](util[_0x704f('0x8')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2edb4d[_0x704f('0x12')],_0x2edb4d[_0x704f('0x13')],_0x2edb4d[_0x704f('0x14')],_0x2edb4d[_0x704f('0x15')],_0x2edb4d[_0x704f('0x16')]));_0x2edb4d=_[_0x704f('0x17')](_0x2edb4d,{'transfererchannel':_0x2edb4d[_0x704f('0x18')],'transferercalleridnum':_0x2edb4d[_0x704f('0x13')],'transferercalleridname':_0x2edb4d[_0x704f('0x14')],'transfererconnectedlinenum':_0x2edb4d[_0x704f('0x19')],'transfererconnectedlinename':_0x2edb4d[_0x704f('0x1a')],'transfereraccountcode':_0x2edb4d['origtransfereraccountcode'],'transferercontext':_0x2edb4d['secondtransferercontext'],'transfererexten':_0x2edb4d[_0x704f('0x1b')],'transfererlinkedid':_0x2edb4d[_0x704f('0x1c')],'context':_0x2edb4d[_0x704f('0x1d')],'extension':_0x2edb4d['origtransfererexten'],'type':_0x704f('0x1e')});if(_['isNil'](_0x2edb4d[_0x704f('0x1f')])){_0x2edb4d=_['assign'](_0x2edb4d,{'transfereechannel':_0x2edb4d[_0x704f('0x20')],'transfereecalleridnum':_0x2edb4d[_0x704f('0x15')],'transfereecalleridname':_0x2edb4d[_0x704f('0x16')],'transfereeconnectedlinenum':_0x2edb4d[_0x704f('0x21')],'transfereeconnectedlinename':_0x2edb4d[_0x704f('0x22')],'transfereeaccountcode':_0x2edb4d[_0x704f('0x23')],'transfereecontext':_0x2edb4d[_0x704f('0x24')],'transfereeexten':_0x2edb4d['transfertargetexten'],'transfereelinkedid':_0x2edb4d[_0x704f('0x25')]});}writeDB(_0x2edb4d);}catch(_0x4efd6f){utils[_0x704f('0xf')](util[_0x704f('0x8')](_0x704f('0x26'),_0x2edb4d[_0x704f('0x12')]),_0x4efd6f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 45797ad..c363b7a 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 _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb10b,0x12a));var _0xbb10=function(_0x423a9a,_0x2ec223){_0x423a9a=_0x423a9a-0x0;var _0x564475=_0xb10b[_0x423a9a];return _0x564475;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb10b,0x12a));var _0xbb10=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xb10b[_0x309d93];return _0x2dd61d;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file